diff -Nru qutecom-2.2+dfsg1/build/build_make.sh qutecom-2.2.1+dfsg1/build/build_make.sh --- qutecom-2.2+dfsg1/build/build_make.sh 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/build/build_make.sh 2011-02-10 10:03:43.000000000 +0000 @@ -123,6 +123,12 @@ ;; esac +case ${OSTYPE} in + darwin10.0) + OPTIONS="${OPTIONS} -DCMAKE_OSX_ARCHITECTURES=i386 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.5.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.5" + ;; +esac + if [ -n "${DOVERBOSE}" ]; then OPTIONS="${OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=1" else diff -Nru qutecom-2.2+dfsg1/debian/changelog qutecom-2.2.1+dfsg1/debian/changelog --- qutecom-2.2+dfsg1/debian/changelog 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/changelog 2011-07-16 19:42:35.000000000 +0000 @@ -1,3 +1,24 @@ +qutecom (2.2.1+dfsg1-1~ppa1) oneiric; urgency=low + + * Upload to PPA. + + -- Ludovico Cavedon Sat, 16 Jul 2011 12:39:39 -0700 + +qutecom (2.2.1+dfsg1-1) unstable; urgency=low + + * New upstream release. + * Remove patches applied upstream: + - fix-include-case.patch + - fix-linking-binutils-gold.patch + - typos-grammar-fixes.patch + * Drop dependecy on quilt (as we are using source version 3). + * Update Standards-Version to 3.9.2. + * Add use-external-tinyxml.patch to link agaist system libtinyxml (and + depend on it). + * Add new-avcodec-api.patch to build with new libav 0.7 API (LP: #791275). + + -- Ludovico Cavedon Sat, 16 Jul 2011 12:32:23 -0700 + qutecom (2.2+dfsg1-5) unstable; urgency=low * Add new-videodev.patch (fix for moved videodev.h) and B-D on libc4l-dev diff -Nru qutecom-2.2+dfsg1/debian/control qutecom-2.2.1+dfsg1/debian/control --- qutecom-2.2+dfsg1/debian/control 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/control 2011-07-08 05:23:59.000000000 +0000 @@ -3,7 +3,7 @@ Priority: optional Maintainer: Debian VoIP Team Uploaders: Marco Nenciarini , Ludovico Cavedon -Build-Depends: cdbs (>= 0.4.27), bzip2, debhelper (>= 7), quilt, +Build-Depends: cdbs (>= 0.4.27), bzip2, debhelper (>= 7), patchutils (>= 0.2.25), cmake (>= 2.6), libqt4-dev (>= 4:4.5), libqtwebkit-dev | libqt4-dev (<< 4:4.7), libglib2.0-dev (>= 2.10.3), libavcodec-dev (>= 0.cvs20060823-3.1), @@ -14,9 +14,9 @@ libxml2-dev (>= 2.6.24), libsamplerate0-dev (>= 0.1.2), libsndfile1-dev (>= 1.0.12), libcurl4-openssl-dev (>= 7.16.1), dpkg-dev (>= 1.13.19), libx11-dev, python-dev, libpurple-dev (>= 2.6.6), - libv4l-dev + libv4l-dev, libtinyxml-dev Build-Conflicts: qt3-dev-tools -Standards-Version: 3.9.1 +Standards-Version: 3.9.2 Homepage: http://www.qutecom.org/ Vcs-Git: git://git.debian.org/pkg-voip/qutecom.git Vcs-Browser: http://git.debian.org/?p=pkg-voip/qutecom.git diff -Nru qutecom-2.2+dfsg1/debian/copyright qutecom-2.2.1+dfsg1/debian/copyright --- qutecom-2.2+dfsg1/debian/copyright 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/copyright 2011-06-29 06:13:47.000000000 +0000 @@ -409,541 +409,6 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -- libpurple (libs/3rdparty/libpurple) -Copyright (C) 1998-2008 Pidgin/libpurple development team - Saleem Abdulrasool - Dave Ahlswede - Manuel Amador - Matt Amato - Geoffrey Antos - Daniel Atallah - Paul Aurich - Patrick Aussems - Anibal Avelar - Ali Albazaz - Christopher Ayoup - Alex Badea - John Bailey - R. Tyler Ballance - Chris Banal - Luca Barbato - Levi Bard - Ryan Barrett - Kevin Barry - Lukas Barth - Derek Battams - Martin Bayard - Curtis Beattie - Dave Bell - Igor Belyi - Brian Bernas - Paul Betts - Jonas Birmé - George-Cristian Bîrzan - Eric Blade - Ethan Blanton - Joshua Blanton - Rainer Blessing - Herman Bloggs - David Blue - Jason Boerner - Hylke Bons - Graham Booker - Paolo Borelli - Julien Bossart - Craig Boston - Chris Boyle - Derrick J Brashear - Mauro Sérgio Ferreira Brasil - Luke Bratch - Matt Brenneke - Jeremy Brooks - Jonathan Brossard - Jeffery Brown - Philip Brown - Dan Bruce - Norbert Buchmuller - Sean Burke - Thomas Butter - Trevor Caira - Andrea Canciani - Damien Carbery - Michael Carlson - Keegan Carruthers-Smith - Steve Cavilia - Julien Cegarra - Cerulean Studios, LLC - Jonathan Champ - Christophe Chapuis - Patrick Cheung - Ka-Hing Cheung - Sadrul Habib Chowdhury - Brian Chu - Arturo Cisneros, Jr. - Vincas Ciziunas - Jonathan Clark - Joe Clarke - Eoin Coffey - Jason Cohen - Todd Cohen - Graham Cole - Jono Cole - Lorenzo Colitti - Collabora Ltd. - Jeff Connelly - Nathan Conrad - Felipe Contreras - Alex Converse - Irving Cordova - Glauber de Oliveira Costa - Adam Cowell - Palmer Cox - Jeramey Crawford - Michael Culbertson - Steven Danna - Chris Davies - Josh Davis - Martijn Dekker - Florian Delizy - Vinicius Depizzol - Philip Derrin - Taso N. Devetzis - Balwinder Singh Dheeman - Andrew Dieffenbach - Finlay Dobbie - Mark Doliner - Nuno Donato - Jim Duchek - Alex Duggan - Tom Dyas - Marc E. - Andrew Echols - John Eckerdal - Sean Egan - William Ehlhardt - Markus Elfring - Nelson Elhage - Ignacio J. Elia - Brian Enigma - Mattias Eriksson - Stefan Esser - Steffen Eschenbacher - Marc Etcheverry - David Everly - Larry Ewing - Gábor Farkas - Jesse Farmer - Gavan Fantom (gavan) - Leonardo Fernandes - David Fiander - Rob Flynn - Rob Foehl (rwf) - Alan Ford - Nathan Fredrickson - Chris J. Friesen - Free Software Foundation - Decklin Foster - Francesco Fracassi - Adam Fritzler - Takao Fujiwara - Max G. - François Gagné - Andrew Gaul - Evgueni V. Gavrilov - Ignacy Gawedzki - Georgi Georgiev - Thomas Gibson-Robinson - Ike Gingerich - Gustavo Giráldez - Richard Gobeille - Ian Goldberg - Matthew Goldstein - Michael Golden - Charlie Gordon - Ryan C. Gordon - Konrad Gräfe - Miah Gregory - David Grohmann - Christian Grothoff - Vladislav Guberinić - Gideon N. Guillen - Christian Hammond - Erick Hamness - Fred Hampton - John Hanauer - Phil Hannent - Casey Harkins - Andy Harrison - Andrew Hart (arhart) - Anders Hasselqvist - Rene Hausleitner - Will Hawkins - G. Sumner Hayes - Michael R. Head - Nick Hebner - Mike Heffner - Justin Heiner - Moos Heintzen - Benjamin Herrenschmidt - Fernando Herrera - hjheins - Hil - Casey Ho - Andrew Hoffman - Iain Holmes - Joshua Honeycutt - Nigel Horne - Jensen Hornick - Juanjo Molinero Horno - Dustin Howett - Nathanael Hoyle - Greg Hudson - Magnus Hult - Karsten Huneycutt - Andrew Hunt - Kevin Hunter - Rian Hunter - Thomas Huriaux - Instant Messaging Freedom, Inc. - Vitaliy Ischenko - Intel Corporation - Scott Jackson - Hans Petter Jansson - Henry Jen - Benjamin Kahn - Anders Kaseorg - Praveen Karadakal - John Kelm - Jochen Kemnade - Akuke Kok - Konstantin Korikov - Cole Kowalski - Matt Kramer - Gary Kramlich - Jan Kratochvil - Andrej Krivulčík - Patrik Kullman - Tuomas Kuosmanen - Tero Kuusela - Richard Laager - Scott Lamb - Dennis Lambe Jr. - Joe LaPenna - Steve Láposi - Daniel Larsson - Peter Lawler - Ho-seok Lee - Jean-Yves Lefort - Moses Lei - Ambrose C. Li - Nicolas Lichtmaier - Wesley Lin - Artem Litvinovich - Josh Littlefield - Daniel Ljungborg - Syd Logan - Lokheed - Norberto Lopes - Shlomi Loubaton - Uli Luckas - Matthew Luckie - Marcus Lundblad - Mike Lundy - Jason Lynch - Iain MacDonnell - Lucio Maciel - Brian Macke - Paolo Maggi - Willian T. Mahan - Kris Marsh - Fidel Martinez - Lalo Martins - John Matthews - Simo Mattila - Michal Matyska - Ryan McCabe - Peter McCurdy - Kurt McKee - Torrey McMahon - Robert McQueen - Mihály Mészáros - Robert Mibus - Lars T. Mikkelsen - Benjamin Miller - Kevin Miller - Paul Miller - Arkadiusz Miskiewicz - David Mohr - Andrew Molloy - Michael Monreal - Marco Monteiro - Benjamin Moody - John Moody - Tim Mooney - Sergio Moretto - Andrei Mozzhuhin - Christian Muise - Richard Nelson - Dennis Nezic - Matthew A. Nicholson - Andreas Nilsson - Henning Norén - Szilard Novaki - Novell - Padraig O'Briain - Christopher O'Brien (siege) - Peter O'Gorman - Jon Oberheide - Yusuke Odate - Ruediger Oertel - Gudmundur Bjarni Olafsson - Bartosz Oler - Oliver - Stefan Ott - Shawn Outman - Nathan Owens (pianocomp81) - John Oyler - Matt Pandina - Laszlo Pandy - Giulio 'Twain28' Pascali - Ricardo Fernandez Pascual - Riley Patterson - Havoc Pennington - Ted Percival - Eduardo Pérez - Matt Perry - Nathan Peterson - Sebastián E. Peyrott - Celso Pinto - Joao Luís Marques Pinto - Aleksander Piotrowski - Julien Pivotto - Eric Polino - Ari Pollak - Robey Pointer - Eric Polino - Stephen Pope - Nathan Poznick - Jory A. Pratt - Brent Priddy - Justin Pryzby - Florian Qu?ze - Ignacio Casal Quinteiro - Federicco Mena Quintero - Yosef Radchenko - David Raeman - R. Ramkumar - Mart Raudsepp - Etan Reisner - Kristian Rietveld - Pekka Riikonen - Tim Ringenbach - Dennis Ristuccia - Lee Roach - Eion Robb - Rhett Robinson - Luciano Miguel Ferreira Rocha - Andrew Rodland - Miguel Rodríguez (migrax) - Bob Rossi - Jason Roth - Jean-Francois Roy - Peter Ruibal - Michael Ruprecht - Sam S. - Thanumalayan S. - Elliott Sales de Andrade - Tomasz Sałaciński - Pradyumna Sampath - Arvind Samptur - Tom Samstag - Neil Sanchala - Laurent Sansonetti - Andrew Sayman - Alceste Scalas - Carsten Schaar - Toby Schaffer - Jonathan Schleifer - Matteo Settenvini - Colin Seymour - Luke Schierer - Ralph Schmieder - David Schmitt - Mark Schneider - Evan Schoenberg - Gabriel Schulhof - Eric Michael Schwelm - Federico Schwindt - Torrey Searle - Peter Seebach - Don Seiler - Leonardo Serra - Jim Seymour - Javeed Shaikh - Joe Shaw - Scott Shedden - Dossy Shiobara - Michael Shkutkov - Shreevatsa R - Dylan Simon - Ettore Simone - John Silvestri - Mukund Sivaraman - Craig Slusher - Alex Smith - Brad Smith - Malcolm Smith - David Smock - Phil Snowberger - Eddie Sohn (tr1sk) - Sony Computer Entertainment America, Inc. - Andy Spencer - Mark Spencer - Peter Speybrouck - Lex Spoon - Chris Stafford - Kevin Stange - Jakub Steiner - Richard Stellingwerff - Charlie Stockman - David Stoddard - Adam Strzelecki - Andreas Stührk - Oleg Sukhodolsky - Sun Microsystems - Mårten Svantesson (fursten) - Amir Szekely (kichik) - Robert T. - Greg Taeger - Peter Tang - Brian Tarricone - Peter Teichman - Philip Tellis - Arun A. Tharuvai - Cestonaro Thilo - Will Thompson - Douglas Thrift (douglaswth) - Mark Tiefenbruck - Andrew Tinney - Jeffery To - Warren Togami - Stu Tomlinson - Bill Tompkins - Gal Topper - Chris Toshok - Ken Tossell - Marcus Trautwig - Tom Tromey - Todd Troxell - Brad Turcotte - Kyle Turman - Junichi Uekawa - Igor Vlasenko - István Váradi - Martijn van Beers - Arjan van de Ven - Philip Van Hoof - Kristof Vansant - James Vega - David Vermeille - Sid Vicious - Jorge Villaseñor (Masca) - Bjoern Voigt - Wan Hing Wah - Philip Walford - Nathan Walp - Jonty Wareing - Eric Warmenhoven - Adam J. Warrington - Denis Washington - Zsombor Welker - Andrew Wellington - Adam Wendt - Simon Wenner - Dave West - Zac West - Daniel Westermann-Clark - Andrew Whewell - Simon Wilkinson - Dan Willemsen - Justin Williams (Jaywalker) - Jason Willis - Matt Wilson - Dan Winship - Scott Wolchok - The Written Word, Inc. - Kevin Wu Won - Pui Lam Wong - Justin Wood - Ximian - Ma Xuan - Jared Yanovich - Timmy Yee - Nickolai Zeldovich - Marco Ziech - Piotr Zielinski - Jeroen Zwartepoorte -License: GPL-2+ - On Debian systems, the complete text of the GNU General Public License version - 2 can be found in `/usr/share/common-licenses/GPL-2'. - -- libpurple GG protocol plugin (libs/3rdparty/libpurple/protocols/gg/lib -Copyright (C) 2001-2003 Wojtek Kaniewski - Robert J. Woźny - Arkadiusz Miśkiewicz - Tomasz Chiliński -License: LGPL-2.1+ - On Debian systems, the complete text of the GNU Lesser General Public License - version 2.1 can be found in `/usr/share/common-licenses/LGPL-2.1'. - -- libpurple Oscar protocol plugin (libs/3rdparty/libpurple/protocols/oscar) -Copyright (C) 2007 ComBOTS Product GmbH (htfv) -Copyright (C) 2005-2006 Jonathan Clark -Copyright (C) 2001-2006 Mark Doliner -Copyright (C) 1998-2001 Adam Fritzler - Josh Myer - Daniel M. Pomerantz - Daniel Reed - Eric Warmenhoven - Brock Wilcox -License: LGPL-2+ - On Debian systems, the complete text of the GNU Lesser General Public License - version 2 can be found in `/usr/share/common-licenses/LGPL-2'. - -- libpurple Zephyr protocol plugin (libs/3rdparty/libpurple/protocols/zephyr) -Copyright (C) 1997-1998 Massachusetts Institute of Technology -License: MIT - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, - provided that the above copyright notice appear in all copies and that - both that copyright notice and this permission notice appear in - supporting documentation, and that the name of the Massachusetts - Institute of Technology (M.I.T.) not be used in advertising or publicity - pertaining to distribution of the software without specific, written - prior permission. - - M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - SOFTWARE. -Copyright (C) 1987-1989 Student Information Processing Board of the - Massachusetts Institute of Technology -License: - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is - hereby granted, provided that the above copyright notice - appear in all copies and that both that copyright notice and - this permission notice appear in supporting documentation, - and that the names of M.I.T. and the M.I.T. S.I.P.B. not be - used in advertising or publicity pertaining to distribution - of the software without specific, written prior permission. - M.I.T. and the M.I.T. S.I.P.B. make no representations about - the suitability of this software for any purpose. It is - provided "as is" without express or implied warranty. - - Emoticons Copyright (C) Nuno Pinheiro (http://pinheiro-kde.blogspot.com/) License: GPL-2+ diff -Nru qutecom-2.2+dfsg1/debian/get-orig-source.sh qutecom-2.2.1+dfsg1/debian/get-orig-source.sh --- qutecom-2.2+dfsg1/debian/get-orig-source.sh 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/get-orig-source.sh 2011-06-29 06:13:47.000000000 +0000 @@ -63,7 +63,7 @@ purge_3rdparty() { purgedir="$1" if [ -z "$purgedir" ] || [ ! -d "$purgedir" ]; then - return 1 + return; fi find $purgedir -depth -type f -not -iname cmake\* -print0 | xargs -0 rm -vf find $purgedir -depth -type d -not -iname cmake\* -print0 | xargs -0 rmdir --ignore-fail-on-non-empty @@ -114,7 +114,7 @@ purge_3rdparty $destdir/libs/3rdparty/openssl # Remove libpurple code -#purge_3rdparty $destdir/libs/3rdparty/libpurple +purge_3rdparty $destdir/libs/3rdparty/libpurple # Remove gnutls code purge_3rdparty $destdir/libs/3rdparty/gnutls @@ -141,10 +141,10 @@ purge_3rdparty $destdir/libs/3rdparty/libstdcpp # Avoid lintian warning on source: ancient-libtool wifo/eXosip/scripts/ltmain.sh 1.4.3 -rm $destdir/wifo/eXosip/scripts/ltmain.sh +rm -f $destdir/wifo/eXosip/scripts/ltmain.sh # Avoid lintian warning on source: source-contains-hg-tags-file .hgtags -rm $destdir/.hg* +rm -f $destdir/.hg* echo "Cleaning done" diff -Nru qutecom-2.2+dfsg1/debian/patches/fix-include-case.patch qutecom-2.2.1+dfsg1/debian/patches/fix-include-case.patch --- qutecom-2.2+dfsg1/debian/patches/fix-include-case.patch 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/patches/fix-include-case.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -Description: fix case of include -Origin: upstream, http://hg.qutecom.org/qutecom-2.2/rev/289be68d1812 -# HG changeset patch -# User laurent -# Date 1287524253 -7200 -# Node ID 289be68d1812aacf1edb2434123fd89c638b5995 -# Parent a0befd202cbc515be3d44501a021e34eb2b79c17 -build fix on linux - -diff -r a0befd202cbc -r 289be68d1812 qutecom/src/presentation/qt/contactlist/QtContactWidget.cpp ---- a/qutecom/src/presentation/qt/contactlist/QtContactWidget.cpp Mon Oct 18 22:22:29 2010 +0200 -+++ b/qutecom/src/presentation/qt/contactlist/QtContactWidget.cpp Tue Oct 19 23:37:33 2010 +0200 -@@ -42,7 +42,7 @@ - - #include - #include --#include -+#include - - #include - -@@ -251,4 +251,4 @@ - void QtContactWidget::languageChanged() - { - _ui->retranslateUi(this); --} -\ No newline at end of file -+} diff -Nru qutecom-2.2+dfsg1/debian/patches/fix-linking-binutils-gold.patch qutecom-2.2.1+dfsg1/debian/patches/fix-linking-binutils-gold.patch --- qutecom-2.2+dfsg1/debian/patches/fix-linking-binutils-gold.patch 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/patches/fix-linking-binutils-gold.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -Description: Explicitely link phapi against libdl on linux. Fixes linking failure with binutils-gold). -Author: Ludovico Cavedon -Bug: http://trac.qutecom.org/ticket/262 -# HG changeset patch -# User Ludovico Cavedon -# Date 1288748482 25200 -# Node ID f52e8735f2f04a70e11c60614efcd7b1815f6bd7 -# Parent 4c82e1dde9c0881245622f972a96a9702cd5eedb -Explicitely link phapi against libdl on linux. Fixes linking failure with binutils-gold). - -diff -r 4c82e1dde9c0 -r f52e8735f2f0 wifo/phapi/CMakeLists.txt ---- a/wifo/phapi/CMakeLists.txt Thu Oct 21 14:37:10 2010 +0200 -+++ b/wifo/phapi/CMakeLists.txt Tue Nov 02 18:41:22 2010 -0700 -@@ -243,6 +243,7 @@ - ow_add_private_libraries( - pthread - rt -+ dl - ) - - ow_add_private_definitions( diff -Nru qutecom-2.2+dfsg1/debian/patches/new-avcodec-api.patch qutecom-2.2.1+dfsg1/debian/patches/new-avcodec-api.patch --- qutecom-2.2+dfsg1/debian/patches/new-avcodec-api.patch 1970-01-01 00:00:00.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/patches/new-avcodec-api.patch 2011-07-13 06:37:58.000000000 +0000 @@ -0,0 +1,25 @@ +Description: use avcodec_decode_video2(), as the avcodec_decode_video() has + been removed in libav 0.7 +Author: Ludovico Cavedon + +Index: qutecom/wifo/phapi/phcodec-avcodec-wrapper.c +=================================================================== +--- qutecom.orig/wifo/phapi/phcodec-avcodec-wrapper.c 2011-07-12 23:31:08.080000003 -0700 ++++ qutecom/wifo/phapi/phcodec-avcodec-wrapper.c 2011-07-12 23:36:22.196000003 -0700 +@@ -62,9 +62,13 @@ + + int dec_len, got_picture = 0; + ph_avcodec_decoder_ctx_t * decoder_t = (ph_avcodec_decoder_ctx_t *) ctx; +- +- dec_len = avcodec_decode_video(decoder_t->context, +- dst, &got_picture, (uint8_t *)src, srcsize); ++ AVPacket avpkt; ++ av_init_packet(&avpkt); ++ avpkt.data = (uint8_t *)src; ++ avpkt.size = srcsize; ++ avpkt.flags = AV_PKT_FLAG_KEY; ++ dec_len = avcodec_decode_video2(decoder_t->context, ++ dst, &got_picture, &avpkt); + + if (got_picture) + { diff -Nru qutecom-2.2+dfsg1/debian/patches/series qutecom-2.2.1+dfsg1/debian/patches/series --- qutecom-2.2+dfsg1/debian/patches/series 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/patches/series 2011-07-13 06:31:01.000000000 +0000 @@ -3,8 +3,7 @@ cmake-force-fpic.patch #purple_perl_tcl_noload.patch #curl-openssl-mt-fix.patch -fix-include-case.patch -fix-linking-binutils-gold.patch -typos-grammar-fixes.patch find-glibconfig.patch new-videodev.patch +use-external-tinyxml.patch +new-avcodec-api.patch diff -Nru qutecom-2.2+dfsg1/debian/patches/typos-grammar-fixes.patch qutecom-2.2.1+dfsg1/debian/patches/typos-grammar-fixes.patch --- qutecom-2.2+dfsg1/debian/patches/typos-grammar-fixes.patch 2011-04-26 07:37:49.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/patches/typos-grammar-fixes.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,8014 +0,0 @@ -Description: Fix typos and grammar mistakes -Origin: http://trac.qutecom.org/changeset/698 -Bug-Debian: http://bugs.debian.org/603260 -Bug: http://trac.qutecom.org/ticket/289 - -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_fr.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_fr.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_fr.ts 2011-02-15 12:30:20.106336529 -0800 -@@ -1,6 +1,6 @@ - - -- -+ - - AIMSettings - -@@ -191,11 +191,11 @@ - - - Need help? -- Besoin d'aide ? -+ Besoin d'aide ? - - - &Back -- &Précédent -+ &Précédent - - - &Connect -@@ -219,13 +219,11 @@ - - - Click here if you don't have a @company@ account -- -- -+ Cliquez ici si vous n'avez pas un compte @company@ - - - Forgot your @company@ password? -- -- -+ Vous avez oublié votre mot de passe @company@ ? - - - -@@ -1032,18 +1030,10 @@ - Appeler le mobile ou la ligne fixe si le contact n'est pas disponible - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Inactivité - -@@ -1063,6 +1053,14 @@ - Automatically start @product@ - Démarrer automatiquement @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Commencer un chat -+ - - - GoogleTalkSettings -@@ -1342,7 +1340,7 @@ - - - Need help? -- Besoin d'aide ? -+ Besoin d'aide ? - - - Cancel -@@ -1362,12 +1360,11 @@ - - - Forgot your @company@ password? -- -- -+ Vous avez oublié votre mot de passe @company@ ? - - - Delete -- Supprimer -+ Supprimer - - - &Modify -@@ -1379,8 +1376,7 @@ - - - <span style="font-size:16pt;">Login</span><br><br><span>Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account</span> -- -- -+ <span style="font-size:16pt;"> connexion </ span> <br> <span> S'il vous plaît, choisissez un profil<br/> déjà utilisé ou remplissez les informations pour se connecter à un <br/> compte @company@ </ span> - - - -@@ -2620,24 +2616,23 @@ - - - Warning -- -+ Attention - - - Do you really want to delete this profile -- -+ Voulez vous vraiment supprimer ce compte - - - Yes -- -+ Oui - - - No -- -+ Non - - - Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account -- -- -+ S'il vous plaît, choisissez un profil<br/> déjà utilisé ou remplissez les informations pour se connecter à un <br/> compte @company@ - - - -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_hu.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_hu.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_hu.ts 2011-02-15 12:30:20.122332418 -0800 -@@ -5,7 +5,7 @@ - AIMSettings - - Login: -- Bejelentkezés: -+ Felhasználónév: - - - Forgot your AIM password? -@@ -32,7 +32,7 @@ - - - Copyright (C)2008 Mbdsys -- -+ Szerzői jog (C)2008 Mbdsys - - - Authors -@@ -48,9 +48,8 @@ - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - Ez egy szabad szoftver; terjeszthető illetve módosítható a --GNU Általános Közreadási Feltételek dokumentumában leírtak --szerint -- 2. vagy későbbi verzió --, melyet a Szabad Szoftver --Alapítvány ad ki. -+GNU Általános Közreadási Feltételek - 2. vagy későbbi verzió - dokumentumában leírtak -+szerint, melyet a Szabad Szoftver Alapítvány ad ki. - - - @product@ - About -@@ -77,7 +76,7 @@ - - - &Accept -- Elfog&adás -+ &Elfogadás - - - &Cancel -@@ -107,7 +106,7 @@ - AddAccount - - Configure your account: -- Fiók beállításai -+ Fiók beállításai: - - - &Next -@@ -154,7 +153,7 @@ - - - Contact Type (protocol): -- Partnerfiók típusa (protokoll): -+ Kapcsolat típusa (protokoll): - - - Contact ID: -@@ -162,7 +161,7 @@ - - - Account: -- Fiók: -+ Fiók: - - - Enable -@@ -209,11 +208,11 @@ - - - <span style="font-size:16pt;">Login</span><br><br><span>Please enter your email address and<br>password</span> -- <span style="font-size:16pt;">Bejelentkezés</span><br><br><span>Kérjük adja meg elektronikus levelezési címét és<br>jelszavát</span> -+ <span style="font-size:16pt;">Bejelentkezés</span><br><br><span>Kérjük adja meg e-mail címét és<br>jelszavát</span> - - - Email Address: -- Elektronikus levelezési-cím: -+ E-mail cím: - - - Click here if you don't have a @company@ account -@@ -260,11 +259,11 @@ - - - login / username: -- Belépés: -+ Belépés / felhasználó neve: - - - Account name: -- Fióknév: -+ Fióknév: - - - Proxy: -@@ -288,7 +287,7 @@ - - - Advanced -- Szakértői -+ További - - - -@@ -334,11 +333,11 @@ - - - Advanced Settings -- Szakértői beállítások -+ További beállítások - - - Advanced Configuration Window -- Szakértői beálltások ablaka -+ További beálltások ablaka - - - Automatically answer incoming calls from -@@ -373,7 +372,7 @@ - - - Chat Theme -- Csevegési sablonok -+ Csevegési téma - - - Form -@@ -421,7 +420,7 @@ - - Be aware, this section is for power users only. - Any change in the order of your codec list may cause problems running your @product@: you might not be able to call your contacts anymore. -- Figyelem, ezek a beállítások csak haladó felhasználók számára ajánlott. -+ Figyelem, csak haladó felhasználók számára ajánlott beállítások. - Bármilyen változtatás a kodekek sorrendjében problémákat okozhat a @product@ használatában: elképzelhető hogy nem fogja tudni felhívni a kapcsolatait többé. - - -@@ -451,7 +450,7 @@ - - - <html><head></head><body>An update is available, click <span style=" text-decoration: underline; color:#0000ff;">here</span> to download the new version<br /><br />Version: %1<br />File Size: %2 (MB)<br /></body></html> -- <html><head></head><body>Újabb frissítés érhető el, kattints <span style=" text-decoration: underline; color:#0000ff;">ide</span>a letöltéshez<br /><br />Verzió: %1<br />Fájlméret: %2 (MB)<br /></body></html> -+ <html><head></head><body>Újabb frissítés érhető el, kattints <span style=" text-decoration: underline; color:#0000ff;">ide</span>a letöltéshez<br /><br />Verzió: %1<br />Fájlméret: %2 (MB)<br /></body></html> - - - -@@ -478,11 +477,11 @@ - - - Disable call forwarding -- Hívástovábbítás tiltása -+ Hívásátirányítás tiltása - - - Forward all unanswered calls to following phone numbers: -- Minden fel nem vett hívás továbbítása a következő telefonszámokra: -+ Minden fel nem vett hívás átirányítása a következő telefonszámokra: - - - For example +3314500XXXX (+33 is the country code and 14500XXXX is the phone number) -@@ -490,7 +489,7 @@ - - - Call forwarding is active if you're not connected to @company@, when your line is busy or 20 seconds after you did not answer a call. You can configure up to three call forwards to landlines, mobile phones or voice mail (if applicable) -- Hivásátirányítás aktív ha ne kapcsolódsz a @company@, mikor foglalt a vonal vagy 20 másodperccel a nemfogadott hívást követően. Beállíthatsz maximum 3 átirányítás vezetékes és mobil telefonokra vagy hangpostára (ha engedélyezett) -+ Hivásátirányítás aktív ha nem kapcsolódsz a @company@-hoz, mikor mással beszélsz, vagy 20 másodperc elteltével sem fogadod a hívást. Maximum 3 átirányítást állíthatsz be: vezetékes-, mobil telefonokra, vagy hangpostára (ha engedélyezett) - - - -@@ -508,7 +507,7 @@ - ChatLogViewer - - Chat History -- Előzmények -+ Csevegési előzmények - - - &Contact -@@ -540,7 +539,7 @@ - - - createChatConf -- createChatConf -+ createChatConf - - - Show Contact Info -@@ -552,7 +551,7 @@ - - - &Save History As... -- Előzmény menté&se másként... -+ &Előzmény mentése másként... - - - actionRestartChat -@@ -599,7 +598,7 @@ - - - &Save History As... -- Előzmény menté&se másként... -+ &Előzmény mentése másként... - - - @company@ -@@ -614,10 +613,6 @@ - &Szerkesztés - - -- Cu&t -- &Kivágás -- -- - Ctrl+X - Ctrl+X - -@@ -639,7 +634,7 @@ - - - Start Chat Conference -- Konferencia indítása -+ Csevegés-konferencia indítása - - - &Close -@@ -649,6 +644,10 @@ - Conference - Konferencia - -+ -+ Cu&t -+ -+ - - - ChatRoomInviteWidget -@@ -696,7 +695,7 @@ - ChatWidget - - Form -- Formula -+ Űrlap - - - -@@ -727,14 +726,14 @@ - - - <span style=" font-size:18pt;">Conference</span><br /><br />Please enter two phone numbers </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ contact ID in order</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">to create a 3-way conference.</p> -- <span style=" font-size:18pt;">Konferencia</span><br /><br />Adjon meg két telefonszámot </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">vagy @company@ kapcsolat azonosítót </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a konferencia indításához</p> -+ <span style=" font-size:18pt;">Konferencia</span><br /><br />Adjon meg két telefonszámot </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">vagy @company@ kapcsolat azonosítót </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a konferencia indításához</p> - - - - ConferenceInviteWidget - - <span style=" font-size:18pt;">Conference</span><br /><br />Please enter two phone numbers </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ contact ID in order</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">to create a 3-way conference.</p> -- <span style=" font-size:18pt;">Konferencia</span><br /><br />Adjon meg két telefonszámot </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">vagy @company@ kapcsolat azonosítót </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a konferencia indításához</p> -+ <span style=" font-size:18pt;">Konferencia</span><br /><br />Adjon meg két telefonszámot </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">vagy @company@ kapcsolat azonosítót </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a konferencia indításához</p> - - - &Add >> -@@ -750,11 +749,11 @@ - - - &Start -- &Indítás -+ &Indítás - - - Cancel -- Mégsem -+ Mégsem - - - -@@ -810,7 +809,7 @@ - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to edit this contact</p></body></html> -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Partner szerkesztése</p></body></html> -@@ -832,11 +831,11 @@ - - - Optional Information -- Egyéb információ -+ Egyéb információ - - - Your Mail: -- Az Ön elektronikus levélcíme: -+ Az Ön e-mail címe: - - - The @product@ execution failed and has generated a diagnostic file. -@@ -844,7 +843,7 @@ - Thanks for your contribution. - - The @product@ Development Team. -- A @product@ végrehajtása közben hibat történt amiről hibanapló készült. -+ A @product@ végrehajtása közben hiba történt amiről hibanapló készült. - Ez a fájl hasznos információkat tartalmaz a probléma elhárításához. - Köszönjük közreműködését. - -@@ -852,11 +851,11 @@ - - - In order to help the developers you can complete this report. This step is optional. -- A fejlesztők munkájának segítéséhez kiegészítheti ezt a jelentést. Nem kötelező. -+ A fejlesztők munkájának segítéséhez kiegészítheti ezt a jelentést. Nem kötelező. - - - Use Case Description: -- Használat körményeinek leírása: -+ A használat körülményeinek leírása: - - - -@@ -867,11 +866,11 @@ - - - Click here to change your call forward settings -- A hívásátirányítás megváltoztatásához kattintson ide -+ A hívásátirányítás beállításainak megváltoztatásához kattintson ide - - - Call forward mode: -- Hívásátirányítás módja: -+ Hívásátirányítás módja: - - - Purchase call out credits -@@ -879,7 +878,7 @@ - - - Call Forward Method -- Hívásátirányítás módja -+ Hívásátirányítás módja - - - Call Voice Mail -@@ -887,7 +886,7 @@ - - - Click here to buy @company@'s credits -- @company@ kredit vásárlásához kattinton ide -+ @company@ kredit vásárlásához kattinton ide - - - -@@ -901,7 +900,7 @@ - DialpadWidget - - Click on the various color changing items to send sounds to your interlocutor. -- Hangok küldéséhez kattintson a színváltó elemekre. -+ Hangok küldéséhez kattintson a színváltó elemekre. - - - -@@ -916,7 +915,7 @@ - - - New Voice Mail: -- Új hangüzenet: -+ Új hangüzenet: - - - Click here to see missed call(s) -@@ -931,19 +930,19 @@ - FacebookSettings - - Facebook Settings -- -+ Facebook beállítások - - - Email Address -- -+ E-mail cím - - - Password -- -+ Jelszó - - - +Get a new Facebook Account -- -+ Új Facebook fiók létrehozása - - - -@@ -978,7 +977,7 @@ - - - @product@ - File Transfer Manager -- @product@ - Fájl átvitel kezelő -+ @product@ - Fájl átvitel kezelő - - - -@@ -989,7 +988,7 @@ - - - Form -- Űrlap -+ Űrlap - - - Pause -@@ -997,14 +996,14 @@ - - - <i>From:</i> -- <i>Küldő:</i> -+ <i>Küldő:</i> - - - - GeneralSettings - - When I double-click on a contact -- Amikor duplán kattintok egy partner nevére -+ Amikor duplán kattintok egy partner nevére - - - Call cell phone or land line if contact not online -@@ -1012,15 +1011,7 @@ - - - Start in background mode -- -- -- -- Prefere start a free call if applicable -- -- -- -- Prefere start a chat -- -+ Indítás a háttérben - - - Idle status -@@ -1042,12 +1033,20 @@ - Automatically start @product@ - @product@ automatikus indítása - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Chat indítása -+ - - - GoogleTalkSettings - - Login: -- Bejelentkezés: -+ Felhasználónév: - - - Password: -@@ -1090,7 +1089,7 @@ - - - <span style="font-size:18pt;">HTTP Proxy Authentication</span><br><br><span>Your local HTTP proxy uses authentication<br>Please enter your login and password</span> -- <span style="font-size:18pt;">HTTP Proxy Authentication</span><br><br><span>Your local HTTP proxy uses authentication<br>Kérem adja meg a felhasználónevét és jelszavát</span> -+ <span style="font-size:18pt;">HTTP Proxy Bejelentkezés</span><br><br><span>A helyi HTTP proxy bejelentkezést kér<br>Kérem adja meg a felhasználónevét és jelszavát</span> - - - OK -@@ -1105,7 +1104,7 @@ - ICQSettings - - Login: -- Bejelentkezés: -+ Felhasználónév: - - - Password: -@@ -1113,7 +1112,7 @@ - - - ICQ Settings -- AIM/ICQ Beállítások -+ ICQ Beállítások - - - Forgot your ICQ password? -@@ -1132,7 +1131,7 @@ - - - Login -- Bejelentkezés -+ Bejelentkezés - - - Add -@@ -1152,7 +1151,7 @@ - - - @product@ - My Instant Messaging Accounts (MSN, Jabber...) -- @product@ - Üzenetküldő fiókjaim (MSN, Jabber...) -+ @product@ - Üzenetküldő fiókjaim (MSN, Jabber...) - - - -@@ -1186,18 +1185,18 @@ - - - Click on the add button below to add a new ID -- Válassza a "Hozzáadás" gombot új felhasználói ID felvételéhez -+ Válassza a "Hozzáadás" gombot új felhasználói azonosító felvételéhez - - - Contact ID -- Kapcsolat ID -+ Kapcsolat azonosító - - - - IMProfileWidget - - Enter your nickname here -- Adja meg a becenevét -+ Adja meg itt a becenevét - - - Add an instant messaging account (MSN, AIM, GoogleTalk...) -@@ -1205,15 +1204,17 @@ - - - Add an IM account -- Fiók hozzáadása -+ Üzenetküldő fiók hozzáadása - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -- -- -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Kattints ide az avatar váltásához</p></body></html> - - - -@@ -1239,7 +1240,7 @@ - JabberSettings - - Login: -- Bejelentkezés: -+ Felhasználónév: - - - Password: -@@ -1279,26 +1280,26 @@ - - - Force old (port 5223) SSL -- Régi SSL használatának kikényszerítése (port 5223) -+ Régi SSL (port 5223) használatának kikényszerítése - - - Resource: -- Erőforrás: -+ Erőforrás: - - - - LanguagesSettings - - Google Translate -- -+ Google fordítás - - - language to convert the messages received -- -+ a bejövő üzeneteket erre a nyelvre fordítsa - - - language to convert the messages sent -- -+ a kimenő üzeneteket erre a nyelvre fordítsa - - - Your language is not here, do you know that you can do your own translation on Launchpad? -@@ -1317,7 +1318,7 @@ - - - Need help? -- Segítségre van szüksége? -+ Segítségre van szüksége? - - - Cancel -@@ -1325,7 +1326,7 @@ - - - Delete -- Törlés -+ Törlés - - - @product@ - Login -@@ -1333,11 +1334,11 @@ - - - Account: -- Fiók: -+ Fiók: - - - &Connect -- &Csatlakozás -+ &Csatlakozás - - - Forgot your @company@ password? -@@ -1349,7 +1350,7 @@ - - - Configure a &New Profile -- Új &felhasználó -+ &Új felhasználó - - - <span style="font-size:16pt;">Login</span><br><br><span>Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account</span> -@@ -1360,7 +1361,7 @@ - MSNSettings - - Login: -- Bejelentkezés: -+ Felhasználónév: - - - Password: -@@ -1391,7 +1392,7 @@ - - - Command::terminate() -- Parancs: megszakítás () -+ Parancs: megszakítás() - - - Command::start() -@@ -1422,34 +1423,34 @@ - - - Unblock User -- Felhasználó-blokkolás feloldása -+ Felhasználó-tiltás feloldása - - - Manage blocked users -- Blokkolt felhasználók kezelése -+ Tiltott felhasználók kezelése - - - @product@ - Manage blocked users -- @product@ - Blokkolt felhasználók kezelése -+ @product@ - Tiltott felhasználók kezelése - - - - MySpaceSettings - - MySpace Settings -- -+ MySpace beállítások - - - Email Address -- -+ E-mail cím - - - Password -- -+ Jelszó - - - + Get a new MySpace Account -- -+ Új MySpace fiók regisztrálása - - - -@@ -1520,11 +1521,11 @@ - PhoneCallWidget - - &Accept -- Elfog&adás -+ &Elfogadás - - - Status -- Státusz -+ Állapot - - - 00:00:00 -@@ -1536,11 +1537,11 @@ - - - &Reject -- Elutasított hívás -+ &Elutasított hívás - - - Dialpad -- Tárcsázó -+ Tárcsázó - - - Audio Smileys -@@ -1548,14 +1549,14 @@ - - - Communication is encrypted -- Kommunikáció titkosítva -+ Titkosított kommunikáció - - - - PrivacySettings - - Manage blocked users -- Blokkolt felhasználók kezelése -+ Tiltott felhasználók kezelése - - - Privacy Rules -@@ -1575,7 +1576,7 @@ - - - Only people from my contact list -- Csak a kapcsolati listában szereplő partnerek -+ Csak a kapcsolati listámon szereplő partnerek - - - Allow calls from -@@ -1583,7 +1584,7 @@ - - - When I sign into @company@ -- Amikor belépek ide @company@ -+ Amikor belépek a @company@-ba - - - -@@ -1601,8 +1602,10 @@ - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -- -- -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Kattints ide az avatar váltásához</p></body></html> - - - General -@@ -1642,7 +1645,7 @@ - - - Web/blog: -- Web/blog -+ Web/blog: - - - Country: -@@ -1666,7 +1669,7 @@ - - - Email: -- Elektronikus levelezési cím: -+ E-mail cím: - - - Notes -@@ -1682,11 +1685,11 @@ - - - Mobile phone -- Mobiletelefon -+ Mobiltelefon - - - dd MMMM yyyy -- nn HHHH eeee -+ nn HHHH éééé - - - Unknown -@@ -1716,18 +1719,18 @@ - - - Accounts Settings -- Fiók beállítások -+ Fiókok beállításai - - - - QtAddAccount - - Configure your voip account -- Internettelefon-fiók beállítása -+ VOIP-fiók beállítása - - - Please tell us if your account is provided<br/>by @company@ or by another service -- Az ön szolgáltatója @company@ vagy más szolgáltató -+ Az ön szolgáltatója @company@ vagy más szolgáltató - - - -@@ -1738,26 +1741,26 @@ - - - Audio Test Call -- Teszt hang hívás -+ Teszthang hívás - - - Video Test Call -- Teszt videó hívás -+ Tesztvideó hívás - - - - QtAddQuteComAccount - - Login -- Bejelentkezés -+ Bejelentkezés - - - Please enter an email address. -- Kérem adja meg az elektronikus levelezési címét <br/> és jelszavát -+ Kérem adjon meg egy e-mail címet. - - - Please enter your email address<br/>and your password -- Kérem adja meg az elektronikus levelezési címét <br/> és jelszavát -+ Kérem adja meg az e-mail címét <br/> és jelszavát - - - @product@ - Login -@@ -1768,11 +1771,11 @@ - QtAddSIPAccount - - Your profile name already exists! -- -+ A profilneve már létezik! - - - Please fill in the information which will<br/>allow your softphone to connect to your<br/>SIP account -- Adja meg SIP fiókjának adatait! -+ Adja meg SIP fiókjának bejeletkezési adatait! - - - Configure your SIP profile -@@ -1815,7 +1818,7 @@ - QtAppearanceSettings - - Me -- Én -+ Én - - - Hello -@@ -1869,22 +1872,22 @@ - QtCallBar - - +(country code) number or nickname -- + (orszám hívószám) szám vagy becenév -+ +(ország hívószám) szám vagy becenév - - - - QtCallForwardSettings - - Call Forward -- Hívástovábbítás -+ Hívásátirányítás - - - Call Forward Settings -- Hívástovábbítás beállításai -+ Hívásátirányítás beállításai - - - To configure call forward settings you need to<BR> be logged in with a @company@ account. -- Hivásátirányítás beállításához szükséges<BR> belépnie egy @company@ fiókkal. -+ Hivásátirányítás beállításához <BR> be kell lépnie egy @company@ fiókkal. - - - -@@ -1898,11 +1901,11 @@ - QtChatLogViewer - - Account -- -+ Fiók - - - Edit Contact -- Partner szerkesztése -+ Partner szerkesztése - - - -@@ -1928,15 +1931,15 @@ - - - Your file can not be sent: your contact must be connected on the @company@ network. -- A fájlt nem lehet elküldeni: a partnerének a @company@ hálózatához kell csatlakoznia. -+ A fájlt nem lehet elküldeni: a partnerének a @company@ hálózatához kell csatlakoznia. - - - Your contact wishes to send a file with @company@. -- Az ön partnere egy fájlt szeretne küldeni @company@ keresztül. -+ Az ön partnere egy fájlt szeretne küldeni @company@-n keresztül. - - - Go to %1 to install it -- Lépjen ide %1 a telepítéshez -+ Lépjen ide %1 a telepítéshez - - - %1 has joined the chat -@@ -1951,15 +1954,15 @@ - QtChatWindow - - Account -- -+ Fiók - - - %1 is typing -- -+ %1 gépel - - - Edit Contact -- Partner szerkesztése -+ Partner szerkesztése - - - @product@ Chat -@@ -1989,7 +1992,7 @@ - QtContactCallListWidget - - <b>You can now inform your first interlocutor he is going to be part of a conference call.</b><br><br>When it's done, click the button below. Your first interlocutor will be put on hold, while your second interlocutor will be called.<br> -- <b>Most közölheti az első partnerrel, hogy konferenciahívásban fog részt venni.</b><br><br>Ha ezzel kész, kattintson a lenti gombra. Amíg a második résztvevőt hívja, addig az első várakoztatásra kerül.<br> -+ <b>Most közölheti az első partnerrel, hogy konferenciahívásban fog részt venni.</b><br><br>Ha ezzel kész, kattintson a lenti gombra. Amíg a második résztvevőt hívja, addig az első várakoztatásra kerül.<br> - - - Hold first interlocutor and call second one -@@ -1997,15 +2000,15 @@ - - - <b>You can now inform your second interlocutor he is going to be part of a conference call.</b><br><br>When it's done, click the button below to start the conference. -- <b>Most közölheti a második partnerrel, hogy konferenciahívásban fog részt venni.</b><br><br>Ha ezzel kész, kattintson a lenti gombra a konferenciahívás megkezdéséhez. -+ <b>Most közölheti a második partnerrel, hogy konferenciahívásban fog részt venni.</b><br><br>Ha ezzel kész, kattintson a lenti gombra a konferenciahívás megkezdéséhez. - - - Start Conference -- Konferencia indítása -+ Konferencia indítása - - - @product@ - Proceed Conference -- @product@ - Konferencia -+ @product@ - Konferencia - - - -@@ -2051,7 +2054,7 @@ - - - Edit Contact -- Partner szerkesztése -+ Partner szerkesztése - - - Do you really want to delete this contact? -@@ -2067,11 +2070,11 @@ - - - Call -- Hívás -+ Hívás - - - Free call -- -+ Ingyenes hívás - - - Work phone -@@ -2087,7 +2090,7 @@ - - - Block contact -- Partner blokkolása -+ Partner tiltása - - - Invite to conference -@@ -2126,23 +2129,23 @@ - - - Click here to edit the contact -- Partner szerkesztéséhez kattintson -+ Partner szerkesztéséhez kattintson ide - - - Click here to send a SMS -- SMS küldése -+ SMS küldéséhez kattintson ide - - - Click here to start a chat -- Csevegés indítása -+ Csevegés indításához kattintson ide - - - Click here to start a free call -- Ingyenes hívás kezdeményezése -+ Ingyenes híváshoz kattintson ide - - - Click here to send a file -- Fájl küldése -+ Fájl küldéséhez kattintson ide - - - -@@ -2156,7 +2159,7 @@ - QtEventWidget - - Do you want to call your voice mail? -- Valóban kívánja a hangpostát hívni? -+ Valóban kívánja a hangpostáját hívni? - - - @product@ - Voice Mail -@@ -2179,7 +2182,7 @@ - - - Overwrite File? -- Felül szeretné írni a fájlt? -+ Felülírja a fájlt? - - - A file called %1 already exists.Do you want to overwrite it? -@@ -2191,7 +2194,7 @@ - - - %1 exceeds the maximum authorized size. -- %1 elérte a maximálisan engedélyezett méretet -+ %1 elérte a maximálisan engedélyezett méretet. - - - %1 has size 0. -@@ -2231,7 +2234,7 @@ - - - is trying to send you a file but his @product@ must be upgraded in order to receive it.Tell him to download the latest version. -- fájlt próbál meg küldeni de frissíteni kell a @product@ a fogadáshoz. Kérje meg, hogy töltse le a legfrissebb verziót. -+ - - - -@@ -2242,7 +2245,7 @@ - - - Remove -- Eltávolítás -+ Eltávolítás - - - Pause -@@ -2282,11 +2285,11 @@ - - - Paused -- Felfüggesztve -+ Szünet - - - Paused by peer -- A partner felfüggesztette -+ A partner szünetelteti - - - Cancelled -@@ -2294,7 +2297,7 @@ - - - Cancelled by peer -- A partner megszakította -+ A partner megszakította - - - Downloading... -@@ -2318,7 +2321,7 @@ - - - Your @product@ is not up to date. Please download the latest version on -- Az ön @product@ nem a legfrissebb verzió. Kérem töltse le és telepítse a legfrissebb verziót -+ Az ön @product@-e nem a legfrissebb verzió. Kérem töltse le és telepítse a legfrissebb verziót - - - The @company@ network may be temporarily unavailable. Please try later. -@@ -2372,19 +2375,19 @@ - - - Type -- Típus -+ Típus - - - Name/ID -- Név/ID -+ Név/Azonosító - - - Date -- Dátum -+ Dátum - - - Duration -- Időtartam -+ Időtartam - - - -@@ -2395,7 +2398,7 @@ - - - Open in SMS window -- SMS ablak megnyitása -+ Megnyitás SMS ablakban - - - Call this peer -@@ -2440,7 +2443,7 @@ - - %1 (%2/%3) - %1 is message, %2 is currentStep, %3 is totalSteps -- %1 (%2/%3) -+ %1 (%2./%3-ból) - - - Online -@@ -2456,7 +2459,7 @@ - - - Do not disturb -- Ne zavarjanak -+ Ne zavarj - - - -@@ -2510,7 +2513,7 @@ - - - Are sure you want to delete the account <b>%1</b>? -- Valóban le kívánja törölni a(z) <b>%1</b> fiókot? -+ Valóban törölni kívánja a(z) <b>%1</b> fiókot? - - - -@@ -2546,23 +2549,23 @@ - - - Warning -- -+ Figyelmeztetés - - - Do you really want to delete this profile -- -+ Biztosan törlni akarja a profilt? - - - Yes -- -+ Igen - - - No -- -+ Nem - - - Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account -- Kérem válasszon egy korábban használt profilt <br/> vagy adja meg a @company@ fiók <br/> használatához szükséges információkat -+ Kérem válasszon egy korábban használt profilt <br/> vagy adja meg a @company@ fiók <br/> használatához szükséges információkat - - - -@@ -2580,11 +2583,11 @@ - - - Outgoing call (ringtone) -- -+ Kimenő hívás (csengőhang) - - - Call closed (hang up tone) -- Hívás megszakítása -+ Hívás bontva (bontás hang) - - - Incoming chat -@@ -2592,11 +2595,11 @@ - - - IM account connected -- IM fiók csatlakoztatása -+ Üzenetváltás fiók elérhető - - - IM account disconnected -- IM fiók lecsatlakoztatása -+ Üzenetváltás fiók kikapcsolva - - - Contact online -@@ -2604,11 +2607,11 @@ - - - Notifications -- Figyelmeztetések -+ Figyelmeztetések - - - Notifications Settings -- Figyelmeztetések beállításai -+ Figyelmeztetések beállításai - - - -@@ -2626,7 +2629,7 @@ - QtPhoneCall - - Status -- Státusz -+ Állapot - - - Incoming Call -@@ -2642,15 +2645,15 @@ - - - Transfert call -- -+ Hívás átirányítása - - - QuteCom - Information -- -+ QuteCom - Információk - - - You must enter a phone number before forwarding -- -+ Meg kell adjon egy telefonszámot az átirányításhoz - - - Error -@@ -2666,19 +2669,19 @@ - - - User busy -- -+ Foglalt - - - Call Rejected -- -+ Hívás visszautasítva - - - User/number not found -- -+ Partner/szám nem található - - - User not available -- -+ Partner nem elérhető - - - Ringing -@@ -2802,7 +2805,7 @@ - - - Select your avatar -- Avatár kiválasztása -+ Avatar kiválasztása - - - @product@ - No Group Selected -@@ -2810,7 +2813,7 @@ - - - @company@ Avatars -- @company@ Avatars -+ @company@ Avatarok - - - -@@ -2829,7 +2832,7 @@ - - - Account -- -+ Fiók - - - Add a Contact -@@ -2837,7 +2840,7 @@ - - - You have unfinished call(s). -- Még van(nak) folyamatban lévő hívás(ok). -+ Még van folyamatban lévő hívása. - - - @product@ - Warning -@@ -2861,19 +2864,19 @@ - - - Please hold all the phone calls before placing a new one -- Újabb hívás előtt tegye várakozó állapotba a már megkezdetteket -+ Újabb hívás előtt tegye várakozó állapotba a már megkezdetteket - - - Can't place a call, you are not connected -- Nem kezdeményezhet hívást, nincs kapcsolódva -+ Nem hívhat, nincs kapcsolódva - - - You must enter a phone number -- Meg kell adnia egy telefonszámot -+ Meg kell adnia egy telefonszámot - - - An error has occured trying to place the call -- Hiba történt hívás kezdeményezésekor -+ Hiba történt híváskor - - - -@@ -2896,7 +2899,7 @@ - - - Call Forward -- Hívástovábbítás -+ Hívásátirányítás - - - Language -@@ -2916,18 +2919,18 @@ - - - security -- titkosítás -+ biztonság - - - Notifications -- Figyelmeztetések -+ Figyelmeztetések - - - - QtRenameGroup - - Bad group name -- Hibás csoport név -+ Hibás csoportnév - - - Group name cannot be empty -@@ -2938,11 +2941,11 @@ - QtSecuritySettings - - Security -- Titkosítás -+ Biztonság - - - Security Settings -- Biztonsági beállítások -+ Biztonsági beállítások - - - BETA -@@ -2976,7 +2979,7 @@ - - SMS. - -- SMS fog kiküldésre kerülni. -+ SMS lesz küldve. - - - -@@ -2996,7 +2999,7 @@ - - - @product@ update failed to start: try to update @product@ manually -- @product@ frissítése nem sikerült: próbálja meg manuálisan -+ @product@ frissítése nem indult el: próbálja meg manuálisan - - - -@@ -3027,7 +3030,7 @@ - - - Click to adjust output volume -- Kimeneti hangerő állításához kattintson -+ Kimeneti hangerő állításához kattintson ide - - - Input volume is muted -@@ -3035,30 +3038,30 @@ - - - Input volume is 0 -- Bemeneti hangerő 0 -+ Bemeneti hangerő 0 - - - Click to adjust input volume -- Bemeneti hangerő állításához kattintson -+ Bemeneti hangerő állításához kattintson ide - - - An error occured: Server error. -- Hiba történt: Kiszolgáló hiba. -+ Hiba történt: Szerver hiba. - - - An error occured: Timeout. -- Hiba történt: Időtúllépés. -+ Hiba történt: Időtúllépés. - - - An error occured: Authentication error. -- Hiba történt: Azonosítás sikertelen. -+ Hiba történt: Azonosítás sikertelen. - - - - QtSystray - - Status -- Státusz -+ Állapot - - - @product@ -@@ -3126,7 +3129,7 @@ - - - Place Call -- Híváskezdeményezés -+ Hívás indítás - - - Send File -@@ -3134,11 +3137,11 @@ - - - Multiple Status -- Több állapot -+ Több állapot - - - Unknown Status -- Ismeretlen állapot -+ Ismeretlen állapot - - - Quit @product@ -@@ -3153,7 +3156,7 @@ - - - @product@ - Proceed Conference -- @product@ - Konferencia -+ @product@ - Konferencia - - - Edit My Profile -@@ -3181,11 +3184,11 @@ - - - You have unfinished call(s). -- Még van(nak) folyamatban lévő hívás(ok). -+ Még van folyamatban lévő hívása. - - - Are you sure you want to log off? -- Biztos, hogy ki akar jelentkezni? -+ Biztos, hogy ki akar jelentkezni? - - - &Log Off -@@ -3201,8 +3204,7 @@ - - - <b>Conference can't be started while there are active phone calls.</b><br><br>Finish all phone calls and try again. -- <b>Nem kezdeményezhető konferenciahívás, amíg más hívások</b><br><br> --<b>vannak folyamatban.</b> -+ <b>Nem kezdeményezhető konferenciahívás, amíg más hívások</b><br><br><b>vannak folyamatban. Fejezze be az összes hívást, majd próbálja újra</b> - - - @product@ - Warning -@@ -3228,15 +3230,15 @@ - QtUserProfile - - Edit Contact -- Partner szerkesztése -+ Partner szerkesztése - - - &Authorize -- &Hozzáférés -+ &Engedélyezés - - - &Block -- &Blokkolás -+ &Tiltás - - - Network error. -@@ -3257,31 +3259,31 @@ - A problem occured while loading your profile. - The last backuped profile has been loaded: - you may have lost last changes made -- Probléma történt a profil betöltések közben. --A legutolsó mentett profil kerül betöltésre: -+ Probléma történt a profil betöltések közben. -+Az utolsó mentett profil kerül betöltésre: - a legutóbbi módosítások elvesztek - - - Your profile could not be loaded. - Choose another profile or create a new one. -- A profilt nem sikerült betölteni. -+ A profilt nem sikerült betölteni. - Válasszon másik profilt vagy hozzon létre egy újat. - - - Wrong email/password entered -- Rossz elektronikus levelezési cím/jelszót adott meg -+ Rossz e-mail címet/jelszót adott meg - - - Wrong login/password entered -- Rossz felhasználónevet/jelszót adott meg -+ Rossz felhasználónevet/jelszót adott meg - - - Connection error -- Kapcsolódási hiba -+ Kapcsolódási hiba - - - Unexpected error (code: %1 -- Váratlan hiba (kód: %1 -+ Váratlan hiba (kód: %1 - - - -@@ -3359,7 +3361,7 @@ - QuteComWindow - - &Accept -- Elfog&adás -+ &Elfogadás - - - &Hidden -@@ -3395,7 +3397,7 @@ - - - Start Conference -- Konferenciahívás indítása -+ Konferenciahívás indítása - - - Send SMS -@@ -3431,7 +3433,7 @@ - - - &HangUp -- &Megszakítás -+ &Bontás - - - &Hold/Resume -@@ -3459,11 +3461,11 @@ - - - Short Text &Messages (SMS) -- S&MS -+ &SMS - - - Rejected Calls -- Hívás visszautasítása -+ Visszautasított hívások - - - &Contacts -@@ -3527,7 +3529,7 @@ - - - View My @company@ Account... -- @company@ fiókom megtekintése... -+ @company@ fiókom megtekintése... - - - Ctrl+W -@@ -3543,7 +3545,7 @@ - - - Learn more about @company@ Services... -- További információ a @company@ szolgáltatásairól... -+ További információ a @company@ szolgáltatásairól... - - - Search -@@ -3563,7 +3565,7 @@ - - - &Text Under Icons -- &Szövegek az ikonok alatt -+ &Ikonok alatti szövegek - - - &Icons Only -@@ -3594,7 +3596,7 @@ - - - Enter the new group name: -- Új csoport neve: -+ Az új csoport neve: - - - @product@ - Rename Contact Group -@@ -3605,7 +3607,7 @@ - SecuritySettings - - Form -- Formula -+ Űrlap - - - Enable call encryption -@@ -3613,11 +3615,11 @@ - - - @product@ can encrypt calls using the AES 128-bits encryption system and Diffie-Hellman for key exchange. -- @product@ titkosítani tudja a hívásokat AES 128-bites titkosítással és a kulcsok váltáshoz Diffie-Hellman használ -+ @product@ titkosítani tudja a hívásokat AES 128-bites titkosítással és a kulcsok váltáshoz Diffie-Hellman módszert használ - - - Note: Your contacts need to enable this option for the call to be encrypted. To know whether this call is indeed encrypted, please check on the bottom of your @product@ window : an icon "lock” appears during the call when it is encrypted. -- Megjegyzés: Parnereinek engedélyezni kell ezt a beállítást a hívás titkosításához. A hívás titkosságáról meggyőződhet ha a @product@ ablakában megjelenik egy "lakat" ikon a hívás ideje alatt. -+ Megjegyzés: Parnereinek engedélyezni kell ezt a beállítást a hívás titkosításához. A hívás titkosságáról meggyőződhet ha a @product@ ablak alján megjelenik egy "lakat" ikon a titkosított hívás ideje alatt. - - - -@@ -3628,66 +3630,66 @@ - - - Yahoo! ID: -- Yahoo! ID: -+ Yahoo! Azonosító: - - - GoogleTalk ID: -- -+ GoogleTalk Azonosító: - - - Jabber ID: -- -+ Jabber Azonosító: - - - FaceBook ID: -- -+ Facebook Azonosító: - - - MySpace ID: -- -+ MySpace Azonosító: - - - Skype ID: -- -+ Skype Azonosító: - - - Twitter ID: -- -+ Twitte Azonosító: - - - MSN ID: -- MSN ID: -+ MSN Azonosító: - - - SIP ID: -- SIP ID: -+ SIP Azonosító: - - - ICQ ID: -- ICQ ID: -+ ICQ Azonosító: - - - AIM ID: -- AIM ID: -+ AIM Azonosító: - - - @company@ ID: -- @company@ ID: -+ @company@ Azonosító: - - - - SkypeSettings - - Skype Settings -- -+ Skype beállítások - - - Skype Id -- -+ Skype azonosító - - - + Get a new Skype Account -- -+ Új Skype fiók létrehozása - - - -@@ -3702,11 +3704,11 @@ - - - Click here to add a phone number -- Telefonszám megadása -+ Telefonszám hozzáadása - - - 0 /160 -- 0 / 160 -+ 0 /160 - - - Enter your signature here -@@ -3722,7 +3724,7 @@ - - - Enter phone number(s) here<br>They must be separated by & or ; or , -- Adja meg a telefonszámo(ka)t <br>. Elválasztáshoz használja a & (és) ; (kettőspont) vagy , (vessző) jeleket -+ Adja meg a telefonszámo(ka)t<br>. Elválasztáshoz használjon & (és) ; (pontosvessző) vagy , (vessző) jeleket - - - -@@ -3742,7 +3744,7 @@ - URL: %2 - File Size: %3 (MB) - Speed: %4 (kB/s) -- @product@ frissítés letöltése... -+ @product@ frissítés letöltése... - - Verzió: %1 - URL: %2 -@@ -3754,33 +3756,33 @@ - StatusBarWidget - - ... -- ... -+ ... - - - - TwitterSettings - - Twitter Settings -- -+ Twitter beállítások - - - Email Address -- -+ E-mail cím - - - Password -- -+ Jelszó - - - + Get a new Twitter Account -- -+ Új Twitter fiók létrehozása - - - - UserFrame - - Form -- Formula -+ Űrlap - - - -@@ -3811,7 +3813,7 @@ - - - Webcam device: -- Webkamera: -+ Webkamera eszköz: - - - Webcam Preview -@@ -3823,7 +3825,7 @@ - - - Video quality -- Videó minődésge -+ Videó minősége - - - Down (kbit/s) -@@ -3880,12 +3882,12 @@ - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When used for the first time we recommend that you select the normal video quality mode, then you can try different modes to find out the most suitable one.</p> - <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> to determine your Internet connection bandwidth.</p></body></html> -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> - p, li { white-space: pre-wrap; } - </style></head><body> --<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Első alkalommal ajánlott a normál videó minőséget választania ,ezután kipróbálhajta a különböző módokat hogy megtalálja önnek megfelelőt .</p> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Első alkalommal ajánlott a normál videó minőséget választania, ezután kipróbálhajta a különböző módokat hogy megtalálja önnek megfelelőt.</p> - <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> --<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ugrás <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> az ön internet kapcsolat sebességének megállapításához.</p></body></html> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Itt <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> mérje meg az internetkapcsolata sebességét.</p></body></html> - - - -@@ -3903,7 +3905,7 @@ - VoicemailSettings - - Form -- Formula -+ Űrlap - - - Phone number of your voicemail: -@@ -3911,7 +3913,7 @@ - - - Please fill in here the information about your voicemail -- Adja meg a hangpostájának adatait -+ Adja meg hangpostájának adatait - - - -@@ -3941,7 +3943,7 @@ - YahooSettings - - Login: -- Bejelentkezés: -+ Felhasználónév: - - - Password: -@@ -3953,7 +3955,7 @@ - - - Use Yahoo! Japan server -- Yahoo! Japán kiszolgáló használata -+ Yahoo! Japán szerver használata - - - Forgot your Yahoo! password? -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_zh_CN.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_zh_CN.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_zh_CN.ts 2011-02-15 12:30:20.391351165 -0800 -@@ -32,7 +32,7 @@ - - - Copyright (C)2008 Mbdsys -- -+ 版权所有(C)2008 Mbdsys - - - Authors -@@ -47,18 +47,16 @@ - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. -- -- -+ 本程序为免费软件,根据自由软件基金会所发表的第二个版本或者(您选择的)之后的任何版本的GNU通用公共许可证,你可以重新发布和/或修改它。 -+ - - - @product@ - About -- -- -+ @product@ - 关于 - - - @product@, a voice over Internet phone -- -- -+ @product@, 一个互联网语音电话 - - - -@@ -77,7 +75,7 @@ - - - &Accept -- 接受(&A) -+ 接受(&A) - - - &Cancel -@@ -115,7 +113,7 @@ - - - Need help? -- 需要帮助? -+ 需要帮助? - - - You don't have any account ? Click here -@@ -123,7 +121,7 @@ - - - &Back -- 后退(&B) -+ 后退(&B) - - - Cancel -@@ -131,23 +129,19 @@ - - - @product@ - Login -- -- -+ @product@ - 登录 - - - <span style="font-size:16pt;">Configure your voip account</span><br><br><span>Please tell us if your account is provided<br/>by @company@ or by another service</span> -- -- -+ <span style="font-size:16pt;">设置您的VoIP帐号</span><br><br><span>请告诉我们是否您的帐号是<br/> 由@company@ 或其它服务所提供</span> - - - @company@ account -- -- -+ @company@ 帐号 - - - Generic SIP account -- -- -+ 通用SIP帐号 - - - -@@ -182,8 +176,7 @@ - - - @product@ - Add a Contact Account -- -- -+ @product@ - 添加一个联系人帐号 - - - -@@ -194,11 +187,11 @@ - - - Need help? -- 需要帮助? -+ 需要帮助? - - - &Back -- 后退(&B) -+ 后退(&B) - - - Cancel -@@ -206,12 +199,11 @@ - - - @product@ - Login -- -- -+ @product@ - 登录 - - - &Connect -- 连接(&C) -+ 连接(&C) - - - <span style="font-size:16pt;">Login</span><br><br><span>Please enter your email address and<br>password</span> -@@ -223,13 +215,11 @@ - - - Click here if you don't have a @company@ account -- -- -+ 如果您没有@company@帐号,请点击这儿. - - - Forgot your @company@ password? -- -- -+ 忘记您@company@密码? - - - -@@ -240,11 +230,11 @@ - - - Need help? -- 需要帮助? -+ 需要帮助? - - - &Back -- 后退(&B) -+ 后退(&B) - - - Cancel -@@ -252,12 +242,11 @@ - - - @product@ - Login -- -- -+ @product@ - 登录 - - - &Connect -- 连接(&C) -+ 连接(&C) - - - Activate presence and chat (SIP/SIMPLE) -@@ -332,8 +321,7 @@ - - - @product@ - Advanced Configuration -- -- -+ @product@ - 高级设置 - - - -@@ -356,7 +344,7 @@ - - - Remove -- 移除 -+ 移除 - - - Warning, this part is for advanced users.<br>Any mistake can badly damage the software. -@@ -367,32 +355,27 @@ - AppearanceSettings - - Toolbar -- -- -+ 工具栏 - - - &Icons && Text -- -- -+ 图标 (& I) 文字 (&& T) - - - Icons &Only -- -- -+ 只有图标 (& O) - - - &Hidden -- -- -+ 隐藏 (& H) - - - Chat Theme -- -- -+ 聊天主题 - - - Form -- 表格 -+ 表格 - - - -@@ -407,42 +390,35 @@ - - - &Input device: -- -- -- -- -- &Output device: -- -- -+ 输入设备 (& I): - - - &Ringing device: -- -- -+ 响铃设备 (& R): - - - &Make a test call -- -- -+ 做一次测试通话 (& M) - - - Test -- -- -+ 测试 - - - &Advanced >> -- -- -+ 高级 (& A) >> - - - &Half Duplex -- -- -+ 半双工 (& H) - - - Be aware, this section is for power users only. - Any change in the order of your codec list may cause problems running your @product@: you might not be able to call your contacts anymore. -+ 请注意,本节只是针对超级用户的。任何有关你的解码器列表的顺序变化可能导致您的 @product@执行问题:您可能不再能打电话给您的联系人。 -+ -+ -+ &Output device: - - - -@@ -468,12 +444,11 @@ - - - @product@ - Update available -- -- -+ @product@ - 更新可用 - - - <html><head></head><body>An update is available, click <span style=" text-decoration: underline; color:#0000ff;">here</span> to download the new version<br /><br />Version: %1<br />File Size: %2 (MB)<br /></body></html> -- -+ <html><head></head><body>有一个可用的更新, 请点击 <span style=" text-decoration: underline; color:#0000ff;">here</span> 以便下载新版本<br /><br />版本: %1<br />文件大小: %2 (MB)<br /></body></html> - - - -@@ -512,8 +487,7 @@ - - - Call forwarding is active if you're not connected to @company@, when your line is busy or 20 seconds after you did not answer a call. You can configure up to three call forwards to landlines, mobile phones or voice mail (if applicable) -- -- -+ 如果您没有连接到 @company@,当您的线路忙或来电20秒之内没有接听,呼叫转移将被激活。您可以配置多达三个呼叫转发到固定电话,移动电话或语音信箱(如果可用的话) - - - -@@ -583,8 +557,7 @@ - - - @company@ -- -- -+ @company@ - - - -@@ -627,8 +600,7 @@ - - - @company@ -- -- -+ @company@ - - - MainWindow -@@ -636,51 +608,43 @@ - - - &Edit -- -- -+ &编辑 - - - Cu&t -- -- -+ 编辑(&t) - - - Ctrl+X -- -- -+ Ctrl+X - - - &Copy -- -- -+ 复制(&C) - - - Ctrl+C -- -- -+ Ctrl+C - - - &Paste -- -- -+ 粘贴(&P) - - - Ctrl+V -- -- -+ Ctrl+V - - - Start Chat Conference -- -- -+ 开始聊天会议 - - - &Close -- 关闭(&C) -+ 关闭(&C) - - - Conference -- 会议 -+ 会议 - - - -@@ -756,44 +720,38 @@ - - - @product@ - Create a Conference -- -- -+ @product@ - 建立一个会议 - - - <span style=" font-size:18pt;">Conference</span><br /><br />Please enter two phone numbers </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ contact ID in order</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">to create a 3-way conference.</p> -- -- -+ <span style=" font-size:18pt;">会议</span><br /><br />请输入两个电话号码 </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ 联系 ID 顺序为</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">以建立一个三方会议.</p> - - - - ConferenceInviteWidget - - <span style=" font-size:18pt;">Conference</span><br /><br />Please enter two phone numbers </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ contact ID in order</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">to create a 3-way conference.</p> -- -- -+ <span style=" font-size:18pt;">会议</span><br /><br />请输入两个电话号码 </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ 联系 ID 顺序为</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">以建立一个三方会议.</p> - - - &Add >> -- -- -+ 追加(&A) >> - - - << &Remove -- -- -+ << (&R)移除 - - - Available Contacts -- -- -+ 可用的联系人 - - - &Start -- 开始(&S) -+ 开始(&S) - - - Cancel -- 取消 -+ 取消 - - - -@@ -831,7 +789,7 @@ - - - goupname -- -+ 组名 - - - -@@ -849,8 +807,10 @@ - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to edit this contact</p></body></html> -- -- -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">点击以编辑这个联系人</p></body></html> - - - -@@ -881,15 +841,17 @@ - Thanks for your contribution. - - The @product@ Development Team. -- -+ @product@执行失败并已经产生了一个诊断文件。该文件包含对解决您所遇到的问题有用的信息。感谢您的贡献。 -+ -+@product@ 开发团队. - - - In order to help the developers you can complete this report. This step is optional. -- -+ 为了帮助开发人员,您可以完成这份报告。这一步是可选的。 - - - Use Case Description: -- -+ 使用事例描述 - - - -@@ -920,8 +882,7 @@ - - - Click here to buy @company@'s credits -- -- -+ 点击这儿购买@company@的信用 - - - -@@ -965,19 +926,19 @@ - FacebookSettings - - Facebook Settings -- -+ Facebook设置 - - - Email Address -- -+ 邮件地址 - - - Password -- -+ 密码 - - - +Get a new Facebook Account -- -+ +获得一个新的Facebook帐号 - - - -@@ -1012,8 +973,7 @@ - - - @product@ - File Transfer Manager -- -- -+ @product@ - 文件传输方法 - - - -@@ -1046,16 +1006,8 @@ - 当联系人不在线,呼叫手机或座机 - - -- Prefere start a free call if applicable -- -- -- - Start in background mode -- -- -- -- Prefere start a chat -- -+ 以后台执行的方式开始 - - - Idle status -@@ -1075,8 +1027,15 @@ - - - Automatically start @product@ -- -- -+ 自动启动@product@ -+ -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ 开始一个文本聊天 - - - -@@ -1134,8 +1093,7 @@ - - - @product@ - Local HTTP Proxy -- -- -+ @product@ - 局部HTTP代理 - - - -@@ -1189,8 +1147,7 @@ - - - @product@ - My Instant Messaging Accounts (MSN, Jabber...) -- -- -+ @product@ - 我的即时信息帐户(MSN, Jabber...) - - - -@@ -1250,8 +1207,10 @@ - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -- -- -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">单击更改你的avatar</p></body></html> - - - -@@ -1321,22 +1280,18 @@ - - - Resource: -- -+ 资源: - - - - LanguagesSettings - - Google Translate -- -- -- -- language to convert the messages received -- -+ Google翻译 - - - language to convert the messages sent -- -+ 用于转换发送信息的语言 - - - Your language is not here, do you know that you can do your own translation on Launchpad? -@@ -1346,6 +1301,10 @@ - More information here. - 更多信息在这里。 - -+ -+ language to convert the messages received -+ -+ - - - LogAccount -@@ -1355,7 +1314,7 @@ - - - Need help? -- 需要帮助? -+ 需要帮助? - - - Cancel -@@ -1363,12 +1322,11 @@ - - - Delete -- 删除 -+ 删除 - - - @product@ - Login -- -- -+ @product@ - 登录 - - - Account: -@@ -1376,12 +1334,11 @@ - - - &Connect -- 连接(&C) -+ 连接(&C) - - - Forgot your @company@ password? -- -- -+ 忘记您@company@ 密码? - - - &Modify -@@ -1389,12 +1346,11 @@ - - - Configure a &New Profile -- 配置一个新的配置(&N) -+ 配置一个新的个人资料(&N) - - - <span style="font-size:16pt;">Login</span><br><br><span>Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account</span> -- -- -+ <span style="font-size:16pt;">Login</span><br><br><span>请选择一个之前使用过的个人资料<br/> 或填写详细信息以连接到<br/> @company@的帐号</span> - - - -@@ -1421,8 +1377,7 @@ - - - Use HTTP method -- -- -+ 使用HTTP方法 - - - -@@ -1472,50 +1427,45 @@ - - - @product@ - Manage blocked users -- -- -+ @product@ - 管理被屏蔽的用户 - - - - MySpaceSettings - - MySpace Settings -- -+ MySpace设置 - - - Email Address -- -+ 电子邮件地址 - - - Password -- -+ 密码 - - - + Get a new MySpace Account -- -+ +获得一个新的MySpace帐号 - - - - NoQuteComAlert - - @product@ - SMS -- -- -+ @product@ - SMS - - - I have a @company@ account -- -- -+ 我有一个@company@帐号 - - - Create a @company@ account -- -- -+ 建立一个@company@帐号 - - - To send a SMS, you need to be logged in with a<br>@company@ account and to have @company@'s credits. -- -- -+ 要发送SMS,您需要用@company@帐号登录并必须有@company@的信用 - - - -@@ -1567,7 +1517,7 @@ - PhoneCallWidget - - &Accept -- 接受(&A) -+ 接受(&A) - - - Status -@@ -1587,7 +1537,7 @@ - - - Dialpad -- 拨号盘 -+ 拨号盘 - - - Audio Smileys -@@ -1595,8 +1545,7 @@ - - - Communication is encrypted -- -- -+ 通信是加密的 - - - -@@ -1631,8 +1580,7 @@ - - - When I sign into @company@ -- -- -+ 当我登录到@company@ - - - -@@ -1650,8 +1598,10 @@ - p, li { white-space: pre-wrap; } - </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -- -- -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">点击改变您的 avatar</p></body></html> - - - General -@@ -1754,8 +1704,7 @@ - QObject - - @product@ -- -- -+ @product@ - - - -@@ -1777,26 +1726,22 @@ - - - Please tell us if your account is provided<br/>by @company@ or by another service -- -- -+ 请告诉我们您的帐号是否是由<br/>by @company@或其它服务提供 - - - - QtAddAccountUtils - - Test -- -- -+ 测试 - - - Audio Test Call -- -- -+ 音频测试呼叫 - - - Video Test Call -- -- -+ 视频测试呼叫 - - - -@@ -1815,15 +1760,14 @@ - - - @product@ - Login -- -- -+ @product@ - 登录 - - - - QtAddSIPAccount - - Your profile name already exists! -- -+ 您的个人资料名字已经存在! - - - Please fill in the information which will<br/>allow your softphone to connect to your<br/>SIP account -@@ -1842,14 +1786,12 @@ - - - @product@ -- -- -+ @product@ - - - Are sure you want to delete this IM contact? - -- -- -+ 您确认要删除这个IM联系人吗? - - - &Delete -@@ -1871,48 +1813,39 @@ - QtAppearanceSettings - - Me -- -- -+ - - - Hello -- -- -+ - - - How are you? -- -- -+ 您好吗? - - - Other -- -- -+ 其它 - - - I am fine -- -- -+ 我很好 - - - Have to go -- -- -+ 得走了 - - - Bye -- -- -+ 再见 - - - Appearance -- -- -+ 外观 - - - Appearance Settings -- -- -+ 外观设置 - - - -@@ -1949,7 +1882,7 @@ - - - To configure call forward settings you need to<BR> be logged in with a @company@ account. -- -+ 为了配置呼叫转移设置,您需要<BR>用@company@帐号登录. - - - -@@ -1963,7 +1896,7 @@ - QtChatLogViewer - - Account -- -+ 帐号 - - - Edit Contact -@@ -1993,28 +1926,23 @@ - - - Your file can not be sent: your contact must be connected on the @company@ network. -- -- -+ 您的文件不能被送出:您的联系人必须连接到@company@网络. - - - Your contact wishes to send a file with @company@. -- -- -+ 您的联系人希望用@company@发送一个文件. - - - Go to %1 to install it -- -- -+ 去%1 以便安装 - - - %1 has joined the chat -- -- -+ %1 已经加入这个聊天 - - - %1 has left the chat -- -- -+ %1 已经离开这个聊天 - - - -@@ -2025,16 +1953,15 @@ - - - @product@ Chat -- -- -+ @product@ 聊天 - - - Account -- -+ 帐号 - - - %1 is typing -- -+ %1 正在输入 - - - -@@ -2053,15 +1980,14 @@ - - - Call @company@ -- -- -+ 呼叫 @company@ - - - - QtContactCallListWidget - - <b>You can now inform your first interlocutor he is going to be part of a conference call.</b><br><br>When it's done, click the button below. Your first interlocutor will be put on hold, while your second interlocutor will be called.<br> -- <b>你现在可以通知你的第一个聊天对象他准备成为会议呼叫的一部分。</b><br><br>当做完之后,点击下面的按钮。你的第一个聊天对象将会被暂停,当你的第二个聊天对象被呼叫时。<br> -+ <b>你现在可以通知你的第一个聊天对象他准备成为会议呼叫的一部分。</b><br><br>当做完之后,点击下面的按钮。你的第一个聊天对象将会被暂停,当你的第二个聊天对象被呼叫时。<br> - - - Hold first interlocutor and call second one -@@ -2069,16 +1995,15 @@ - - - <b>You can now inform your second interlocutor he is going to be part of a conference call.</b><br><br>When it's done, click the button below to start the conference. -- <b>你现在可以通知你的聊天者他准备成为会议的一部分。</b><br><br>当这个完成后,点击下面的按钮来开始会议。 -+ <b>你现在可以通知你的聊天者他准备成为会议的一部分。</b><br><br>当这个完成后,点击下面的按钮来开始会议。 - - - Start Conference -- 开始会议 -+ 开始会议 - - - @product@ - Proceed Conference -- -- -+ @product@ - 继续进行会议 - - - -@@ -2097,8 +2022,7 @@ - - - @product@ - Merge Contacts -- -- -+ @product@ - 合流联系人 - - - -@@ -2121,8 +2045,7 @@ - - - @product@ -- -- -+ @product@ - - - Edit Contact -@@ -2142,11 +2065,11 @@ - - - Call -- 呼叫 -+ 呼叫 - - - Free call -- -+ 免费通话 - - - Work phone -@@ -2154,7 +2077,7 @@ - - - Send SMS -- 发送短消息 -+ 发送短消息 - - - Edit contact -@@ -2224,7 +2147,7 @@ - QtCrashReport - - %1 Crash Report -- -+ %1 当机报告 - - - -@@ -2235,8 +2158,7 @@ - - - @product@ - Voice Mail -- -- -+ @product@ - 语音信箱 - - - -@@ -2295,23 +2217,19 @@ - - - Please upgrade<br> your @product@ -- -- -+ 请升级<br> 您的 @product@ - - - Tell your contact<br> to upgrade<br> his @product@ -- -- -+ 请告诉您的联系人<br> 升级<br> 他的 @product@ - - - The file cannot be received:you must upgrade your @product@ in order to receive it. -- -- -+ 这个文件不能被接收:您必须升级您的@product@以便接收它. - - - is trying to send you a file but his @product@ must be upgraded in order to receive it.Tell him to download the latest version. -- -- -+ 正在试图给您发送一个文件,但是他的@product@必须被升级以便您接收它.请告诉他下载最新的版本. - - - -@@ -2322,7 +2240,7 @@ - - - Remove -- 移除 -+ 移除 - - - Pause -@@ -2398,13 +2316,11 @@ - - - Your @product@ is not up to date. Please download the latest version on -- -- -+ 您的@product@不是最新的.请下载最新的版本,在 - - - The @company@ network may be temporarily unavailable. Please try later. -- -- -+ @company@网络有可能暂时不能使用,请过后再试. - - - -@@ -2450,24 +2366,23 @@ - - - @product@ - Call History -- -- -+ @product@ - 通话纪录 - - - Type -- 类別 -+ 类別 - - - Name/ID -- 名称/帐号 -+ 名称/帐号 - - - Date -- 日期 -+ 日期 - - - Duration -- 耗时 -+ 耗时 - - - -@@ -2497,8 +2412,7 @@ - - - @product@ -- -- -+ @product@ - - - &Delete -@@ -2507,8 +2421,7 @@ - - Are sure you want to delete this account? - -- -- -+ - - - -@@ -2524,7 +2437,7 @@ - - %1 (%2/%3) - %1 is message, %2 is currentStep, %3 is totalSteps -- %1 (%2/%3) -+ %1 (%2/%3) - - - Online -@@ -2547,8 +2460,7 @@ - QtIMAccountPlugin - - @product@ -- -- -+ @product@ - - - Please enter a login -@@ -2563,8 +2475,7 @@ - - - @product@ -- -- -+ @product@ - - - &Delete -@@ -2609,8 +2520,7 @@ - %1 (%2) - %3 - %1 is login, %2 is protocol, %3 is status -- -- -+ %1 (%2) %3 - - - -@@ -2632,32 +2542,30 @@ - - - Warning -- -+ 警告 - - - Do you really want to delete this profile -- -+ 您真的要删除这个个人资料吗? - - - Yes -- -+ - - - No -- -+ 不是 - - - Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account -- -- -+ 请选择一个以前用过的个人资料<br/> 或填写详细信息以便连接到一个 <br/> @company@的帐号 - - - - QtLoginDialog - - @product@ - Login -- -- -+ @product@ - 登录 - - - -@@ -2668,7 +2576,7 @@ - - - Outgoing call (ringtone) -- -+ 拨出电话(铃音) - - - Call closed (hang up tone) -@@ -2692,11 +2600,11 @@ - - - Notifications -- -+ 通知 - - - Notifications Settings -- -+ 通知设置 - - - -@@ -2730,15 +2638,15 @@ - - - Transfert call -- -+ 转移呼叫 - - - QuteCom - Information -- -+ QuteCom - 信息 - - - You must enter a phone number before forwarding -- -+ 在转移前您必须输入一个电话号码 - - - Error -@@ -2754,19 +2662,19 @@ - - - User busy -- -+ 用户忙 - - - Call Rejected -- -+ 呼叫被拒绝 - - - User/number not found -- -+ 用户/号码没有发现 - - - User not available -- -+ 用户不可用 - - - Ringing -@@ -2867,8 +2775,7 @@ - - - Voice mail -- -- -+ 语音邮件 - - - -@@ -2879,8 +2786,7 @@ - - - @product@ -- -- -+ @product@ - - - A contact must have a group, please set a group. -@@ -2896,13 +2802,11 @@ - - - @product@ - No Group Selected -- -- -+ @product@ - 没有组被选择 - - - @company@ Avatars -- -- -+ @company@ Avatars - - - -@@ -2917,11 +2821,11 @@ - - - Call -- 呼叫 -+ 呼叫 - - - Account -- -+ 帐号 - - - Add a Contact -@@ -2929,12 +2833,11 @@ - - - You have unfinished call(s). -- 你有没有完成的呼叫。 -+ 你有没有完成的呼叫。 - - - @product@ - Warning -- -- -+ @product@ - 警告 - - - Home -@@ -2950,24 +2853,23 @@ - - - @product@ - Call Error -- -- -+ @product@ - 呼叫错误 - - - Please hold all the phone calls before placing a new one -- -+ 在接听一个新的呼叫之前,请先保留所有的通话 - - - Can't place a call, you are not connected -- -+ 不能发出呼叫,您没有被连接 - - - You must enter a phone number -- -+ 您必须输入一个电话号码 - - - An error has occured trying to place the call -- -+ 试图发出呼叫时发生了错误 - - - -@@ -3014,7 +2916,7 @@ - - - Notifications -- -+ 通知 - - - -@@ -3062,38 +2964,33 @@ - 你的短信已经发出 - - -- Your message is too long. --This will send -- -- -+ You can not send an empty message. -+ 您不能发送一个空消息。 - - -- SMS. -- -- -- -+ @company@ SMS service -+ @company@ SMS 服务 - - -- You can not send an empty message. -- 您不能发送一个空消息。 -+ Your message is too long. -+This will send -+ - - -- @company@ SMS service -- -- -+ SMS. -+ -+ - - - - QtSoftUpdate - - @product@ - Update failed -- -- -+ @product@ - 更新失败 - - - @product@ update failed to start: try to update @product@ manually -- -- -+ @product@ 更新失败:请尝试手动更新@product@ - - - -@@ -3116,45 +3013,39 @@ - - - Output volume is muted -- -- -+ 输出音量被静音 - - - Output volume is 0 -- -- -+ 输出音量是0 - - - Click to adjust output volume -- -- -+ 点击以调节输出音量 - - - Input volume is muted -- -- -+ 输入音量被静音 - - - Input volume is 0 -- -- -+ 输入音量是0 - - - Click to adjust input volume -- -- -+ 点击以调节输入音量 - - - An error occured: Server error. -- -+ 出错:服务器错误。 - - - An error occured: Timeout. -- -+ 出错:超时。 - - - An error occured: Authentication error. -- -+ 出错:身份验证错误。 - - - -@@ -3165,8 +3056,7 @@ - - - @product@ -- -- -+ @product@ - - - Call SIP -@@ -3182,16 +3072,15 @@ - - - Call @company@ -- -- -+ 呼叫@company@ - - - Call -- 呼叫 -+ 呼叫 - - - Send SMS -- 发送短消息 -+ 发送短消息 - - - Online -@@ -3247,8 +3136,7 @@ - - - Quit @product@ -- -- -+ 推出 @product@ - - - -@@ -3259,8 +3147,7 @@ - - - @product@ - Proceed Conference -- -- -+ @product@ - 继续进行会议 - - - Edit My Profile -@@ -3288,7 +3175,7 @@ - - - You have unfinished call(s). -- 你有没有完成的呼叫。 -+ 你有没有完成的呼叫。 - - - Are you sure you want to log off? -@@ -3312,16 +3199,15 @@ - - - @product@ - Warning -- -- -+ @product@ - 警告 - - - Log &Off... -- 注销(&O)... -+ 注销(&O)... - - - Log &On... -- -+ 登录 (&O)... - - - -@@ -3351,53 +3237,51 @@ - - - @product@ - Authorization Request -- -- -+ @product@ - 身份验证请求 - - - - QtUserProfileHandler - - @product@ -- -- -+ @product@ - - - A problem occured while loading your profile. - The last backuped profile has been loaded: - you may have lost last changes made -- -- -+ 载入您的个人资料是出错。 -+上次备份的个人资料已载入: -+您可能会失去在上次的变化 - - - Your profile could not be loaded. - Choose another profile or create a new one. -- -- -+ 您的个人资料无法被加载。 -+选择另一个个人资料或创建一个新的。 - - - Wrong email/password entered -- 错误的电邮/密码 -+ 输入了错误的电邮/密码 - - - Wrong login/password entered -- -+ 输入了错误的登录名/密码 - - - Connection error -- -+ 连接错误 - - - Unexpected error (code: %1 -- -+ 意外的错误 (code: %1) - - - - QtVideoQt - - @product@ -- -- -+ @product@ - - - -@@ -3442,8 +3326,7 @@ - QtWebDirectory - - @product@ - Directory -- -- -+ @product@ - 目录 - - - -@@ -3462,20 +3345,18 @@ - - - @product@ - Configuration -- -- -+ @product@ - 配置 - - - - QuteComWindow - - &Accept -- 接受(&A) -+ 接受(&A) - - - &Hidden -- -- -+ 隐藏 (&H) - - - &Tools -@@ -3491,8 +3372,7 @@ - - - @company@ -- -- -+ @company@ - - - &Close -@@ -3500,20 +3380,19 @@ - - - Dialpad -- 拨号盘 -+ 拨号盘 - - - @product@ -- -- -+ @product@ - - - Start Conference -- 开始会议 -+ 开始会议 - - - Send SMS -- 发送短消息 -+ 发送短消息 - - - Contacts -@@ -3641,70 +3520,59 @@ - - - View My @company@ Account... -- -- -+ 查看我的 @company@ 帐号 - - - Ctrl+W -- -- -+ Ctrl+W - - - @company@ &Forum... -- -- -+ @company@论坛 (&F) - - - @company@ &Wiki/FAQ... -- -- -+ @company@维基/常见问题 (&W) - - - Learn more about @company@ Services... -- -- -+ 了解更多的@company@服务... - - - Search -- -- -+ 搜索 - - - Find @company@ Contacts -- -- -+ 寻找@company@联系人 - - - &Quit -- -- -+ 推出 (&Q) - - - Ctrl+Q -- -- -+ Ctrl+Q - - - &Text Under Icons -- -- -+ 图标下的文字 (&T) - - - &Icons Only -- -- -+ 只有图标 (&I) - - - Add -- 添加 -+ 添加 - - - SMS -- 短信 -+ 短信 - - - Conference -- 会议 -+ 会议 - - - -@@ -3723,8 +3591,7 @@ - - - @product@ - Rename Contact Group -- -- -+ @product@ - 重新命名联系人组 - - - -@@ -3739,12 +3606,11 @@ - - - @product@ can encrypt calls using the AES 128-bits encryption system and Diffie-Hellman for key exchange. -- -- -+ @product@可以使用AES128位加密系统和Diffie - Hellman密钥交换加密呼叫. - - - Note: Your contacts need to enable this option for the call to be encrypted. To know whether this call is indeed encrypted, please check on the bottom of your @product@ window : an icon "lock” appears during the call when it is encrypted. -- -+ 注意: 您的联系人需要启用呼叫加密的选项. 要知道是否这个呼叫被加密, 请检查您的@product@窗口的底部: 当呼叫被加密的时候,呼叫的同时有一个图标 "lock” 出现. - - - -@@ -3755,67 +3621,66 @@ - - - Yahoo! ID: -- Yahoo!名称: -+ Yahoo! ID: - - - GoogleTalk ID: -- -+ GoogleTalk ID: - - - Jabber ID: -- -+ Jabber ID: - - - FaceBook ID: -- -+ FaceBook ID: - - - MySpace ID: -- -+ MySpace ID: - - - Skype ID: -- -+ Skype ID: - - - Twitter ID: -- -+ Twitter ID: - - - MSN ID: -- MSN 名称: -+ MSN ID: - - - SIP ID: -- SIP 名称: -+ SIP ID: - - - ICQ ID: -- ICQ 名称: -+ ICQ ID: - - - AIM ID: -- AIM 名称: -+ AIM ID: - - - @company@ ID: -- -- -+ @company@ ID: - - - - SkypeSettings - - Skype Settings -- -+ Skype 设置 - - - Skype Id -- -+ Skype Id - - - + Get a new Skype Account -- -+ + 获得一个新的Skype 帐号 - - - -@@ -3826,8 +3691,7 @@ - - - @product@ - SMS -- -- -+ @product@ - SMS - - - Click here to add a phone number -@@ -3862,8 +3726,7 @@ - - - @product@ - Downloading update -- -- -+ @product@ - 正在下载更新 - - - Downloading @product@ update... -@@ -3872,33 +3735,38 @@ - URL: %2 - File Size: %3 (MB) - Speed: %4 (kB/s) -- -+ 正在下载 @product@ 更新... -+ -+版本: %1 -+URL: %2 -+文件大小: %3 (MB) -+速度: %4 (kB/s) - - - - StatusBarWidget - - ... -- ... -+ ... - - - - TwitterSettings - - Twitter Settings -- -+ Twitter 设置 - - - Email Address -- -+ 电子邮件地址 - - - Password -- -+ 密码 - - - + Get a new Twitter Account -- -+ + 获得一个新的Twitter 帐号 - - - -@@ -4005,7 +3873,12 @@ - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When used for the first time we recommend that you select the normal video quality mode, then you can try different modes to find out the most suitable one.</p> - <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> - <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> to determine your Internet connection bandwidth.</p></body></html> -- -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">当第一次使用,我们建议您选择普通的视频质量模式,那么你可以尝试不同的模式,以找出最合适的一个。</p> -+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> 以便确定您的互连网的带宽.</p></body></html> - - - -@@ -4016,8 +3889,7 @@ - - - @product@ - Video -- -- -+ @product@ - 视频 - - - -Index: qutecom-2.2+dfsg1/libs/qtutil/tests/fallback.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/libs/qtutil/tests/fallback.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/libs/qtutil/tests/fallback.ts 2011-02-15 12:30:20.046336299 -0800 -@@ -1226,52 +1226,52 @@ - - GeneralSettings - -- -+ - When I start my computer - - - -- -+ - Automatically start @product@ - - - -- -+ - Start in background mode - - - -- -+ - When I double-click on a contact - - - -- -- Prefere start a free call if applicable -+ -+ Start free phone call if possible - - - -- -- Prefere start a chat -+ -+ Call cell phone or land line if contact not online - - - -- -- Call cell phone or land line if contact not online -+ -+ Start a chat - - - -- -+ - Idle status - - - -- -+ - minutes - - - -- -+ - Show me as "Away" when I am inactive for: - - -@@ -2138,7 +2138,7 @@ - QtAddQuteComAccount - - -- @product@ - Connexion -+ @product@ - Login - - - -@@ -2285,7 +2285,7 @@ - - QtCallBar - -- -+ - +(country code) number or nickname - - -@@ -2325,7 +2325,7 @@ - - - -- -+ - Edit Contact - - -@@ -2346,37 +2346,37 @@ - - - -- -+ - Your file can not be sent: your contact must be connected on the @company@ network. - - - -- -+ - Your contact wishes to send a file with @company@. - - - -- -+ - Go to %1 to install it - - - -- -+ - %1 is connected. - - - -- -+ - %1 is disconnected. - - - -- -+ - %1 has joined the chat - - - -- -+ - %1 has left the chat - - -@@ -2399,7 +2399,7 @@ - - - -- -+ - Edit Contact - - -@@ -2581,49 +2581,49 @@ - - QtContactWidget - -- -+ - No landline phone number set - - - -- -+ - No mobile phone number set - - - -- -- -+ -+ - Click here to call - - - -- -- -+ -+ - Click here to set a phone number - - - -- -+ - Click here to edit the contact - - - -- -+ - Click here to send a SMS - - - -- -+ - Click here to start a chat - - - -- -+ - Click here to start a free call - - - -- -+ - Click here to send a file - - -@@ -3088,14 +3088,14 @@ - - QtIMProfileWidget - -- -+ - %1 (%2) - %3 - %1 is login, %2 is protocol, %3 is status - - - -- -+ - Edit My Profile - - -@@ -3150,7 +3150,7 @@ - QtLoginDialog - - -- @product@ - Connexion -+ @product@ - Login - - - -@@ -3379,38 +3379,38 @@ - - QtProfileBar - -- -+ - Click here to change your status - - - -- -+ - Voice mail - - - -- -+ - Set global presence to: - - - -- -- -+ -+ - active - - - -- -+ - voicemail - - - -- -+ - inactive - - - -- -+ - unauthorized - - -@@ -3457,81 +3457,81 @@ - - QtQuteCom - -- -+ - @product@ - Call Error - - - -- -+ - Please hold all the phone calls before placing a new one - - - -- -+ - Can't place a call, you are not connected - - - -- -+ - You must enter a phone number - - - -- -+ - An error has occured trying to place the call - - - -- -+ - Call - - - -- -- -- -- -+ -+ -+ -+ - Conference - - - -- -+ - @product@ - Warning - - - -- -+ - You have unfinished call(s). - - - -- -+ - Are you sure you want to exit the application? - - - -- -+ - &Exit - - - -- -+ - &Cancel - - - -- -- -+ -+ - Home - - - -- -+ - Account - - - -- -+ - Add a Contact - - -@@ -3920,42 +3920,42 @@ - - - -- -+ - @product@ - Proceed Conference - - - -- -+ - <b>Conference can't be started while there are active phone calls.</b><br><br>Finish all phone calls and try again. - - - -- -+ - @product@ - Warning - - - -- -+ - You have unfinished call(s). - - - -- -+ - Are you sure you want to log off? - - - -- -+ - &Log Off - - - -- -+ - &Cancel - - - -- -+ - - Log &Off... - -Index: qutecom-2.2+dfsg1/libs/qtutil/tests/test.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/libs/qtutil/tests/test.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/libs/qtutil/tests/test.ts 2011-02-15 12:30:20.050343722 -0800 -@@ -1226,52 +1226,52 @@ - - GeneralSettings - -- -+ - When I start my computer - - - -- -+ - Automatically start @product@ - - - -- -+ - Start in background mode - - - -- -+ - When I double-click on a contact - - - -- -- Prefere start a free call if applicable -+ -+ Start free phone call if possible - - - -- -- Prefere start a chat -+ -+ Call cell phone or land line if contact not online - - - -- -- Call cell phone or land line if contact not online -+ -+ Start a chat - - - -- -+ - Idle status - - - -- -+ - minutes - - - -- -+ - Show me as "Away" when I am inactive for: - - -@@ -2138,7 +2138,7 @@ - QtAddQuteComAccount - - -- @product@ - Connexion -+ @product@ - Login - - - -@@ -2285,7 +2285,7 @@ - - QtCallBar - -- -+ - +(country code) number or nickname - - -@@ -2325,7 +2325,7 @@ - - - -- -+ - Edit Contact - - -@@ -2346,37 +2346,37 @@ - - - -- -+ - Your file can not be sent: your contact must be connected on the @company@ network. - - - -- -+ - Your contact wishes to send a file with @company@. - - - -- -+ - Go to %1 to install it - - - -- -+ - %1 is connected. - - - -- -+ - %1 is disconnected. - - - -- -+ - %1 has joined the chat - - - -- -+ - %1 has left the chat - - -@@ -2399,7 +2399,7 @@ - - - -- -+ - Edit Contact - - -@@ -2581,49 +2581,49 @@ - - QtContactWidget - -- -+ - No landline phone number set - - - -- -+ - No mobile phone number set - - - -- -- -+ -+ - Click here to call - - - -- -- -+ -+ - Click here to set a phone number - - - -- -+ - Click here to edit the contact - - - -- -+ - Click here to send a SMS - - - -- -+ - Click here to start a chat - - - -- -+ - Click here to start a free call - - - -- -+ - Click here to send a file - - -@@ -3088,14 +3088,14 @@ - - QtIMProfileWidget - -- -+ - %1 (%2) - %3 - %1 is login, %2 is protocol, %3 is status - - - -- -+ - Edit My Profile - - -@@ -3150,7 +3150,7 @@ - QtLoginDialog - - -- @product@ - Connexion -+ @product@ - Login - - - -@@ -3379,38 +3379,38 @@ - - QtProfileBar - -- -+ - Click here to change your status - - - -- -+ - Voice mail - - - -- -+ - Set global presence to: - - - -- -- -+ -+ - active - - - -- -+ - voicemail - - - -- -+ - inactive - - - -- -+ - unauthorized - - -@@ -3457,81 +3457,81 @@ - - QtQuteCom - -- -+ - @product@ - Call Error - - - -- -+ - Please hold all the phone calls before placing a new one - - - -- -+ - Can't place a call, you are not connected - - - -- -+ - You must enter a phone number - - - -- -+ - An error has occured trying to place the call - - - -- -+ - Call - - - -- -- -- -- -+ -+ -+ -+ - Conference - - - -- -+ - @product@ - Warning - - - -- -+ - You have unfinished call(s). - - - -- -+ - Are you sure you want to exit the application? - - - -- -+ - &Exit - - - -- -+ - &Cancel - - - -- -- -+ -+ - Home - - - -- -+ - Account - - - -- -+ - Add a Contact - - -@@ -3920,42 +3920,42 @@ - - - -- -+ - @product@ - Proceed Conference - - - -- -+ - <b>Conference can't be started while there are active phone calls.</b><br><br>Finish all phone calls and try again. - - - -- -+ - @product@ - Warning - - - -- -+ - You have unfinished call(s). - - - -- -+ - Are you sure you want to log off? - - - -- -+ - &Log Off - - - -- -+ - &Cancel - - - -- -+ - - Log &Off... - -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/config/GeneralSettings.ui -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/config/GeneralSettings.ui 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/config/GeneralSettings.ui 2011-02-15 12:30:20.050343722 -0800 -@@ -11,24 +11,12 @@ - - - -- -- 6 -- -- -- 9 -- - - - - When I start my computer - - -- -- 9 -- -- -- 6 -- - - - -@@ -52,27 +40,15 @@ - When I double-click on a contact - - -- -- 9 -- -- -- 6 -- - - - -- Prefere start a free call if applicable -+ Start free phone call if possible - - - - - -- -- 0 -- -- -- 6 -- - - - -@@ -127,7 +103,7 @@ - - - -- Prefere start a chat -+ Start a chat - - - -@@ -140,12 +116,6 @@ - Idle status - - -- -- 9 -- -- -- 6 -- - - - -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ar_SA.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_ar_SA.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ar_SA.ts 2011-02-15 12:30:20.054353589 -0800 -@@ -1019,18 +1019,10 @@ - عندما أنقر مرتين على عنوان إتصال - - -- Prefere start a free call if applicable -- تفضيل بدء مكالمة مجانية عند الإمكان -- -- - Call cell phone or land line if contact not online - الاتصال بالهاتف الخلوي أو الخط الأرضي إذا كان المخاطب غير متصل بالشبكة - - -- Prefere start a chat -- تفضيل بدء دردشة -- -- - Idle status - حالة خمول - -@@ -1042,6 +1034,14 @@ - Show me as "Away" when I am inactive for: - أظهرني "غائبا" عندما أكون غير نشط لمدة: - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ إبدأ محادثة نصية -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_bg.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_bg.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_bg.ts 2011-02-15 12:30:20.058335520 -0800 -@@ -1003,18 +1003,10 @@ - Обади се на мобилния или стационарния телефон ако контакта не е включен - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Бездействащо състояние - -@@ -1034,6 +1026,14 @@ - Automatically start @product@ - Стартирай @product@ автоматично - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Започни чат -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ca.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_ca.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ca.ts 2011-02-15 12:30:20.062346087 -0800 -@@ -1006,18 +1006,10 @@ - Fes una trucada al telèfon mòbil o telèfon fixe si el contacte no està en línia - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Estat inactiu - -@@ -1037,6 +1029,14 @@ - Automatically start @product@ - Inicia @product@ automàticament - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Inicia un xat -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_cs.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_cs.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_cs.ts 2011-02-15 12:30:20.062346087 -0800 -@@ -1003,18 +1003,10 @@ - Pokud není kontakt online, mobil nebo pevnou linku - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Nečinný - -@@ -1034,6 +1026,14 @@ - Automatically start @product@ - Automaticky spustit @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Začít rozhovor -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_cy.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_cy.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_cy.ts 2011-02-15 12:30:20.070361073 -0800 -@@ -1129,18 +1129,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1165,6 +1157,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_da.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_da.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_da.ts 2011-02-15 12:30:20.070361073 -0800 -@@ -1166,18 +1166,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1202,6 +1194,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_de.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_de.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_de.ts 2011-02-15 12:30:20.074345658 -0800 -@@ -1007,18 +1007,10 @@ - Handy oder Festnetz anrufen, wenn der Kontakt nicht online ist. - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - (Inaktiv) Status - -@@ -1038,6 +1030,14 @@ - Automatically start @product@ - Starte @product@ automatsich - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Chat starten -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_el.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_el.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_el.ts 2011-02-15 12:30:20.078356294 -0800 -@@ -1178,18 +1178,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1214,6 +1206,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_en.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_en.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_en.ts 2011-02-15 12:30:20.082335082 -0800 -@@ -1209,18 +1209,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1245,6 +1237,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_en_GB.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_en_GB.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_en_GB.ts 2011-02-15 12:30:20.086346137 -0800 -@@ -1006,18 +1006,10 @@ - Call mobile phone or landline if contact not online - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Idle status - -@@ -1037,6 +1029,15 @@ - Automatically start @product@ - Automatically start @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_eo.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_eo.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_eo.ts 2011-02-15 12:30:20.086346137 -0800 -@@ -1178,18 +1178,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1214,6 +1206,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_es.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_es.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_es.ts 2011-02-15 12:30:20.090336309 -0800 -@@ -1046,18 +1046,10 @@ - Llamar al teléfono celular o de línea fija si el contacto no se encuentra conectado - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Estado inactivo - -@@ -1078,6 +1070,14 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Iniciar charla -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_fi.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_fi.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_fi.ts 2011-02-15 12:30:20.094335072 -0800 -@@ -1053,18 +1053,10 @@ - Soita matka- tai lankapuhelimeen jos kontakti ei ole tavoitettavissa - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Tilan asetus - -@@ -1085,6 +1077,14 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Aloita keskustelu -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_gl.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_gl.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_gl.ts 2011-02-15 12:30:20.110336968 -0800 -@@ -1123,18 +1123,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1156,6 +1148,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_he.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_he.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_he.ts 2011-02-15 12:30:20.114351235 -0800 -@@ -1110,18 +1110,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1146,6 +1138,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_hi.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_hi.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_hi.ts 2011-02-15 12:30:20.118351255 -0800 -@@ -1209,18 +1209,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1245,6 +1237,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_it.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_it.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_it.ts 2011-02-15 12:30:20.122332418 -0800 -@@ -1006,18 +1006,10 @@ - Chiama cellulare o fisso se il contatto non è in linea - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Inattività - -@@ -1037,6 +1029,14 @@ - Automatically start @product@ - Avvia automaticamente @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Avvia una chat -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ja.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_ja.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ja.ts 2011-02-15 12:30:20.130353689 -0800 -@@ -23,7 +23,7 @@ - AIM Settings - AIMの設定 - -- -+ - - AboutWindow - -@@ -43,10 +43,6 @@ - 閉じる - - -- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -- このプログラムはフリープログラムです。Free Software Foundation に基ずくGNU General Public License により、再配布と修正をしても構いません。バージョン2も同じじくフリープログラムとなります。 -- -- - @product@ - About - @product@ - 関して - -@@ -54,7 +50,14 @@ - @product@, a voice over Internet phone - @product@, ボイスオーバーIP電話 - -- -+ -+ This program is free software; you can redistribute it and/or -+modify it under the terms of the GNU General Public License -+as published by the Free Software Foundation; either version 2 -+of the License, or (at your option) any later version. -+ -+ -+ - - AcceptDialog - -@@ -89,14 +92,14 @@ - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;"><h1>Incoming file</h1></span></p></body></html> - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;"><h1>Incoming file</h1></span></p></body></html> - -- -+ - - AccountSettings - - &Edit my profile - プロフィール編集(&E) - -- -+ - - AddAccount - -@@ -139,7 +142,7 @@ - Generic SIP account - 一般SIPアカウント - -- -+ - - AddIMContact - -@@ -174,7 +177,7 @@ - @product@ - Add a Contact Account - @product@ - コンタクトアカウントの追加 - -- -+ - - AddQuteComAccount - -@@ -217,7 +220,7 @@ - Forgot your @company@ password? - あなたの@company@ passwordを忘れました? - -- -+ - - AddSIPAccount - -@@ -284,7 +287,7 @@ - Advanced - アドバンスト - -- -+ - - AdvancedConfigWindow - -@@ -319,7 +322,7 @@ - @product@ - Advanced Configuration - @product@ -アドバンスト設定 - -- -+ - - AdvancedSettings - -@@ -346,7 +349,7 @@ - Warning, this part is for advanced users.<br>Any mistake can badly damage the software. - 警告, このパートはアドバンストユーザーです。<br>何らかの間違いでソフトウェアに重大なダメージを与えます。 - -- -+ - - AppearanceSettings - -@@ -373,7 +376,7 @@ - Form - フォーム - -- -+ - - AudioSettings - -@@ -397,10 +400,6 @@ - &リングデバイス: - - -- &Make a test call -- &テスト発信コール -- -- - Test - テスト - -@@ -413,24 +412,29 @@ - &ハーフデュプレックス - - -- Be aware, this section is for power users only. Any change in the order of your codec list may cause problems running your @product@: you might not be able to call your contacts anymore. -- 警告!このセクションはパワーユーザーのみです。コーデック順番を変更することによって、あなたの@product@に重大な問題が起こる可能性があります。 以後は連絡されても対応できません。 -+ &Make a test call -+ - -- -+ -+ Be aware, this section is for power users only. -+Any change in the order of your codec list may cause problems running your @product@: you might not be able to call your contacts anymore. -+ -+ -+ - - AvatarFrame - - Form - フォーム - -- -+ - - AvatarWidget - - Form - フォーム - -- -+ - - BrowserSoftUpdateWindow - -@@ -442,10 +446,10 @@ - @product@ - アップデート可能 - - -- <html><head></head><body>An update is available, click <span style=" text-decoration: underline; color:#0000ff;">here</span> to download the new version<br /><br />Version: %1<br />File Size: %2 (MB)<br /></body></html> -- <html><head></head><body>アップデートが可能です。クリックして下さい。 <span style=" text-decoration: underline; color:#0000ff;">here</span>新バージョンをダウンロードできます。 <br /><br />Version: %1<br />File Size: %2 (MB)<br /></body></html> -+ <html><head></head><body>An update is available, click <span style=" text-decoration: underline; color:#0000ff;">here</span> to download the new version<br /><br />Version: %1<br />File Size: %2 (MB)<br /></body></html> -+ - -- -+ - - CallForwardSettings - -@@ -484,7 +488,7 @@ - Call forwarding is active if you're not connected to @company@, when your line is busy or 20 seconds after you did not answer a call. You can configure up to three call forwards to landlines, mobile phones or voice mail (if applicable) - @company@に接続できなくとも着信転送はアクティブです。不在着信してから20秒経過するかビジーの場合、固定電話や携帯電話に転送が行われます。 - -- -+ - - CallToaster - -@@ -495,7 +499,7 @@ - Message - メッセージ - -- -+ - - ChatLogViewer - -@@ -554,7 +558,7 @@ - @company@ - @company@ - -- -+ - - ChatMainWindow - -@@ -641,7 +645,7 @@ - Conference - 会議 - -- -+ - - ChatRoomInviteWidget - -@@ -672,7 +676,7 @@ - &Add - 追加 - -- -+ - - ChatToaster - -@@ -683,14 +687,14 @@ - Incoming Chat - チャットを受信 - -- -+ - - ChatWidget - - Form - フォーム - -- -+ - - ConferenceCallWidget - -@@ -721,7 +725,7 @@ - <span style=" font-size:18pt;">Conference</span><br /><br />Please enter two phone numbers </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ contact ID in order</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">to create a 3-way conference.</p> - <span style=" font-size:18pt;">Conference</span><br /><br />2つの電話番号を入力します。 </p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or @company@ contact ID in order</p><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 3ウェイ会議を作成するためです。</p> - -- -+ - - ConferenceInviteWidget - -@@ -733,10 +737,6 @@ - 追加 >> - - -- <<&Remove -- <<削除 -- -- - Available Contacts - 有効なコンタクト - -@@ -748,7 +748,11 @@ - Cancel - キャンセル - -- -+ -+ << &Remove -+ -+ -+ - - ContactGroupPopupMenu - -@@ -775,7 +779,7 @@ - &No - いいえ(&N) - -- -+ - - ContactList - -@@ -786,7 +790,7 @@ - goupname - グループ名 - -- -+ - - ContactWidget - -@@ -798,10 +802,13 @@ - 固定電話番号がセットされてない - - -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to edit this contact</p></body></html> -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">このコンタクトを編集するにはクリックします。 </p></body></html> -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to edit this contact</p></body></html> -+ - -- -+ - - CrashReport - -@@ -825,10 +832,6 @@ - あなたのメール: - - -- The @product@ execution failed and has generated a diagnostic file. This file contains useful information to solve the problem you are encountering. Thanks for your contribution. The @product@ Development Team. -- @product@ execution は失敗しました。診断ファイルを生成します。あなたが直面した問題を解決するための役立つ情報がこのファイルに含まれています。どうもご協力ありがとうございました。@product@ Developmentチーム一同 -- -- - In order to help the developers you can complete this report. This step is optional. - 開発者に役立てるためにこのレポートを作成して下さい。このステップはオプションです。 - -@@ -836,7 +839,15 @@ - Use Case Description: - ケース記述を使用: - -- -+ -+ The @product@ execution failed and has generated a diagnostic file. -+This file contains useful information to solve the problem you are encountering. -+Thanks for your contribution. -+ -+The @product@ Development Team. -+ -+ -+ - - CreditWidget - -@@ -867,21 +878,21 @@ - Click here to buy @company@'s credits - @company@'s creditsを購入するにはここをクリックします。 - -- -+ - - DesktopService - - Root Folder - ルートフォルダ - -- -+ - - DialpadWidget - - Click on the various color changing items to send sounds to your interlocutor. - あなたの対話者に音声を送るには、様々な色の変更項目をクリックします。 - -- -+ - - EventWidget - -@@ -904,7 +915,7 @@ - Missed Call(s): - 失敗した通話: - -- -+ - - FacebookSettings - -@@ -923,7 +934,7 @@ - +Get a new Facebook Account - +新規Facebookアカウントを取得 - -- -+ - - FileTransferDialog - -@@ -958,7 +969,7 @@ - @product@ - File Transfer Manager - @product@ - ファイル転送マネージャー - -- -+ - - FileTransferItem - -@@ -977,30 +988,18 @@ - <i>From:</i> - <i>From:</i> - -- -+ - - GeneralSettings - -- When I double-click on a contact -- コンタクトをダブルクリック時 -- -- - Call cell phone or land line if contact not online - コンタクトがオフラインなら、携帯電話か固定電話にコール - - -- Prefere start a free call if applicable -- もし可能ならフリーコールを開始 -- -- - Start in background mode - バックグラウンドモードを開始 - - -- Prefere start a chat -- チャット開始 -- -- - Idle status - アイドル状態 - -@@ -1020,7 +1019,19 @@ - Automatically start @product@ - 自動スタート @product@ - -- -+ -+ When I double-click on a contact -+ -+ -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ チャット開始 -+ -+ - - GoogleTalkSettings - -@@ -1043,7 +1054,7 @@ - Get a new GoogleTalk Account - 新規GoogleTalkアカウントを取得 - -- -+ - - HttpProxyLoginWindow - -@@ -1078,7 +1089,7 @@ - @product@ - Local HTTP Proxy - @product@ - ローカルHTTP プロキシ - -- -+ - - ICQSettings - -@@ -1101,7 +1112,7 @@ - Get a new ICQ Account - 新規AIMアカウントを取得 - -- -+ - - IMAccountManager - -@@ -1132,7 +1143,7 @@ - @product@ - My Instant Messaging Accounts (MSN, Jabber...) - @product@ - 私のインスタントメッセージアカウント(MSN, Jabber...) - -- -+ - - IMAccountTemplate - -@@ -1147,7 +1158,7 @@ - IM Account Settings - IMアカウント設定 - -- -+ - - IMContactManager - -@@ -1170,7 +1181,7 @@ - Contact ID - コンタクトID - -- -+ - - IMProfileWidget - -@@ -1186,10 +1197,13 @@ - IM アカウントの追加 - - -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">アバタを変更するにはクリック </p></body></html> -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -+ - -- -+ - - ImageSelector - -@@ -1208,7 +1222,7 @@ - Refresh - リフレッシュ - -- -+ - - JabberSettings - -@@ -1259,7 +1273,7 @@ - Resource: - リソース: - -- -+ - - LanguagesSettings - -@@ -1282,7 +1296,7 @@ - More information here. - より多くの情報はこちら - -- -+ - - LogAccount - -@@ -1329,7 +1343,7 @@ - <span style="font-size:16pt;">Login</span><br><br><span>Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account</span> - <span style="font-size:16pt;">Login</span><br><br><span>前のプロフィールを選択します。 <br/> 接続するために情報を入力します。<br/> @company@ account</span> - -- -+ - - MSNSettings - -@@ -1356,7 +1370,7 @@ - Use HTTP method - HTTP メソッド使用 - -- -+ - - MainWindow - -@@ -1387,7 +1401,7 @@ - Hang Up - ハングアップ - -- -+ - - ManageBlockedUsersSettings - -@@ -1406,7 +1420,7 @@ - @product@ - Manage blocked users - @product@ - ブロックユーザー管理 - -- -+ - - MySpaceSettings - -@@ -1425,7 +1439,7 @@ - + Get a new MySpace Account - + 新規MySpace アカウント取得 - -- -+ - - NoQuteComAlert - -@@ -1444,14 +1458,14 @@ - To send a SMS, you need to be logged in with a<br>@company@ account and to have @company@'s credits. - SMSを送信するためにログインします。<br>@company@ account と@company@'s creditsが必要となります。 - -- -+ - - NotificationSettings - - Select the events for which a sound should be played. - プレイしたサウンドのイベントを選択 - -- -+ - - NotificationSettingsItem - -@@ -1470,7 +1484,7 @@ - Play - プレイ - -- -+ - - NotifyDialog - -@@ -1489,7 +1503,7 @@ - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; font-weight:600;">Upgrade</span></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> - <html><head><meta name="qrichtext" content="1" /></head><body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"><p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16pt; font-weight:600;">Upgrade</span></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html> - -- -+ - - PhoneCallWidget - -@@ -1524,7 +1538,7 @@ - Communication is encrypted - 通話が暗号化 - -- -+ - - PrivacySettings - -@@ -1532,10 +1546,6 @@ - 拒否ユーザ管理 - - -- Privacy Rules -- プライバシールール -- -- - Always sign in as "Invisible" (appear offline to all users) - 常に"不可視"でサインインする(全てのユーザはオフライン) - -@@ -1559,7 +1569,11 @@ - When I sign into @company@ - @company@にサインインする時 - -- -+ -+ Privacy Rules -+ -+ -+ - - ProfileDetails - -@@ -1571,10 +1585,6 @@ - 保存 - - -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">アバタを変更するのにクリックします。 </p></body></html> -- -- - General - 全般 - -@@ -1670,14 +1680,21 @@ - Female - 女性 - -- -+ -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click to change your avatar</p></body></html> -+ -+ -+ - - QObject - - @product@ - @product@ - -- -+ - - QtAccountSettings - -@@ -1688,7 +1705,7 @@ - Accounts Settings - アカウント設定 - -- -+ - - QtAddAccount - -@@ -1699,7 +1716,7 @@ - Please tell us if your account is provided<br/>by @company@ or by another service - あなたのアカウントが供給されているかどうか教えて下さい。<br/>@company@ または他のサービスか - -- -+ - - QtAddAccountUtils - -@@ -1714,7 +1731,7 @@ - Video Test Call - ビデオテストコール - -- -+ - - QtAddQuteComAccount - -@@ -1730,10 +1747,10 @@ - Eメールアドレスとパスワードを<br/>入力してください。 - - -- @product@ - Connexion -- @product@ - Connexion -+ @product@ - Login -+ @product@ - ログイン - -- -+ - - QtAddSIPAccount - -@@ -1748,7 +1765,7 @@ - Configure your SIP profile - SIPプロフィールを設定 - -- -+ - - QtAdvancedIMContactManager - -@@ -1760,14 +1777,15 @@ - @product@ - - -- Are sure you want to delete this IM contact? -- このIMコンタクトを削除したいですか? -- -- - &Delete - 削除(&D) - -- -+ -+ Are sure you want to delete this IM contact? -+ -+ -+ -+ - - QtAdvancedSettings - -@@ -1778,7 +1796,7 @@ - Advanced Settings - アドバンスト設定 - -- -+ - - QtAppearanceSettings - -@@ -1817,7 +1835,7 @@ - Appearance Settings - 概観設定 - -- -+ - - QtAudioSettings - -@@ -1832,14 +1850,14 @@ - Audio Settings - オーディオ設定 - -- -+ - - QtCallBar - - +(country code) number or nickname - +(国別コード)番号またはニックネーム - -- -+ - - QtCallForwardSettings - -@@ -1851,17 +1869,17 @@ - 着信転送の設定 - - -- To configure call forward settings you need to<BR> be logged in with a @company@ account. -- 着信転送の設定するためには<BR>@company@ accountでログインしなければなりません。 -+ To configure call forward settings you need to<BR> be logged in with a @company@ account. -+ - -- -+ - - QtChatHistoryWidget - - Save As - 保存 - -- -+ - - QtChatLogViewer - -@@ -1872,14 +1890,14 @@ - Edit Contact - コンタクトの編集 - -- -+ - - QtChatTabWidget - - Close chat - チャットを閉じる。 - -- -+ - - QtChatWidget - -@@ -1895,14 +1913,6 @@ - 送信 - - -- Your file can not be sent: your contact must be connected on the @company@ network. -- ファイルが送信されません: あなたのコンタクトは、@company@ networkに接続しなければなりません。 -- -- -- Your contact wishes to send a file with @company@. -- あなたのコンタクトで@company@と一緒にファイルを送信します。 -- -- - Go to %1 to install it - インストールするために %1に移動 - -@@ -1914,7 +1924,15 @@ - %1 has left the chat - %1はチャットを離れます。 - -- -+ -+ Your file can not be sent: your contact must be connected on the @company@ network. -+ -+ -+ -+ Your contact wishes to send a file with @company@. -+ -+ -+ - - QtChatWindow - -@@ -1933,7 +1951,7 @@ - %1 is typing - %1 はタイピング - -- -+ - - QtConferenceCallWidget - -@@ -1952,7 +1970,7 @@ - Call @company@ - 発信 @company@ - -- -+ - - QtContactCallListWidget - -@@ -1975,7 +1993,7 @@ - @product@ - Proceed Conference - @product@ - 会議進行 - -- -+ - - QtContactList - -@@ -1994,7 +2012,7 @@ - @product@ - Merge Contacts - @product@ - コンタクトマージ - -- -+ - - QtContactManager - -@@ -2073,7 +2091,7 @@ - Forward to mobile phone - 携帯電話に転送 - -- -+ - - QtContactWidget - -@@ -2112,14 +2130,14 @@ - Click here to send a file - ファイルを送信するにはここをクリックして下さい。 - -- -+ - - QtCrashReport - - %1 Crash Report - %1 クラッシュレポート - -- -+ - - QtEventWidget - -@@ -2130,7 +2148,7 @@ - @product@ - Voice Mail - @product@ - ボイスメール - -- -+ - - QtFileTransfer - -@@ -2201,7 +2219,7 @@ - is trying to send you a file but his @product@ must be upgraded in order to receive it.Tell him to download the latest version. - ファイルを送信しようとしています。しかし、受信するためには、@product@をアップデートしなければなりません。最新バージョンをダウンロードして下さい。 - -- -+ - - QtFileTransferItem - -@@ -2221,14 +2239,6 @@ - 開始しています。 - - -- From: -- From: -- -- -- To: -- To: -- -- - Open - 開く - -@@ -2292,7 +2302,15 @@ - The @company@ network may be temporarily unavailable. Please try later. - @company@ networkは一時的に利用できないかもしれません。後で試して下さい。 - -- -+ -+ From: -+ -+ -+ -+ To: -+ -+ -+ - - QtGeneralSettings - -@@ -2303,7 +2321,7 @@ - General Settings - 一般設定 - -- -+ - - QtHistory - -@@ -2354,7 +2372,7 @@ - Duration - 通話時間 - -- -+ - - QtHistoryWidget - -@@ -2373,7 +2391,7 @@ - Show chat log - チャットログ表示 - -- -+ - - QtIMAccountManager - -@@ -2389,10 +2407,11 @@ - 削除(&D) - - -- Are sure you want to delete this account? -- このアカウントを削除していいですか? -+ Are sure you want to delete this account? -+ -+ - -- -+ - - QtIMAccountMonitor - -@@ -2421,9 +2440,10 @@ - - - %1 (%2/%3) --%1 is message, %2 is currentStep, %3 is totalSteps %1 はメッセージ, %2 は現在のステップ, %3 はトータルステップ -+ %1 is message, %2 is currentStep, %3 is totalSteps -+ %1 はメッセージ, %2 は現在のステップ, %3 はトータルステップ - -- -+ - - QtIMAccountPlugin - -@@ -2434,7 +2454,7 @@ - Please enter a login - ログインして下さい。 - -- -+ - - QtIMAccountPresenceMenuManager - -@@ -2477,7 +2497,7 @@ - Are sure you want to delete the account <b>%1</b>? - アカウントを削除していいですか<b>%1</b>? - -- -+ - - QtIMProfileWidget - -@@ -2485,10 +2505,12 @@ - プロフィールの編集 - - -- %1 (%2) %3 --%1 is login, %2 is protocol, %3 is status %1 はログイン, %2 はプロトコル, %3 はステータス -+ %1 (%2) -+%3 -+ %1 is login, %2 is protocol, %3 is status -+ - -- -+ - - QtLanguagesSettings - -@@ -2499,7 +2521,7 @@ - Language Settings - 言語設定 - -- -+ - - QtLogAccount - -@@ -2526,14 +2548,14 @@ - Please choose a previously used profile<br/> or fill in the informations to connect to a<br/> @company@ account - 前に使用したプロフィールを選択して下さい。<br/>接続するための情報を入力して下さい。<br/>@company@ account - -- -+ - - QtLoginDialog - -- @product@ - Connexion -- @product@ - 接続 -+ @product@ - Login -+ @product@ - ログイン - -- -+ - - QtNotificationSettings - -@@ -2572,7 +2594,7 @@ - Notifications Settings - 通知設定 - -- -+ - - QtNotificationSettingsItem - -@@ -2583,7 +2605,7 @@ - Sounds - サウンド - -- -+ - - QtPhoneCall - -@@ -2678,7 +2700,7 @@ - Add a Contact - コンタクトの追加 - -- -+ - - QtPresenceMenuManager - -@@ -2701,7 +2723,7 @@ - Log off - ログオフ - -- -+ - - QtPrivacySettings - -@@ -2712,7 +2734,7 @@ - Privacy Settings - プライバシー設定 - -- -+ - - QtProfileBar - -@@ -2743,7 +2765,7 @@ - Voice mail - ボイスメール - -- -+ - - QtProfileDetails - -@@ -2759,10 +2781,6 @@ - コンタクトはグループに属する必要があります。グループを選択してくだい。 - - -- <<Simple -- <<シンプル -- -- - Select your avatar - アバタを選択 - -@@ -2774,7 +2792,11 @@ - @company@ Avatars - @company@ アバタ - -- -+ -+ << Simple -+ -+ -+ - - QtQuteCom - -@@ -2837,7 +2859,7 @@ - An error has occured trying to place the call - 発信時にエラーが発生しました。 - -- -+ - - QtQuteComConfigDialog - -@@ -2884,7 +2906,7 @@ - Notifications - 通知 - -- -+ - - QtRenameGroup - -@@ -2895,7 +2917,7 @@ - Group name cannot be empty - グループネームは空にできません。 - -- -+ - - QtSecuritySettings - -@@ -2910,7 +2932,7 @@ - BETA - ベータ - -- -+ - - QtSms - -@@ -2930,14 +2952,6 @@ - SMSは送信されました。 - - -- Your message is too long. This will send -- あなたのメッセージは長すぎます。 -- -- -- SMS. -- SMS -- -- - You can not send an empty message. - 空のメッセージは送信できません。 - -@@ -2945,7 +2959,17 @@ - @company@ SMS service - - -- -+ -+ Your message is too long. -+This will send -+ -+ -+ -+ SMS. -+ -+ -+ -+ - - QtSoftUpdate - -@@ -2956,7 +2980,7 @@ - @product@ update failed to start: try to update @product@ manually - @product@アップデートは失敗しました: @product@ 手動でアップデートして下さい。 - -- -+ - - QtStatusBar - -@@ -3011,7 +3035,7 @@ - An error occured: Authentication error. - エラー発生: 認証エラー.. - -- -+ - - QtSystray - -@@ -3102,7 +3126,7 @@ - Quit @product@ - 中止@product@ - -- -+ - - QtToolBar - -@@ -3173,14 +3197,14 @@ - Log &On... - ログオン… - -- -+ - - QtTreeViewDelegate - - Contacts list - コンタクトリスト - -- -+ - - QtUserProfile - -@@ -3203,7 +3227,7 @@ - @product@ - Authorization Request - @product@ - 認証要求 - -- -+ - - QtUserProfileHandler - -@@ -3211,14 +3235,6 @@ - @product@ - - -- A problem occured while loading your profile. The last backuped profile has been loaded: you may have lost last changes made -- プロフィールをロード中に問題が起きました。最後にバックアップしたプロフィールをロードして下さい。最後に変更した内容は失われます。 -- -- -- Your profile could not be loaded. Choose another profile or create a new one. -- あなたのプロフィールがロードできませんでした。他のプロフィールか新規でプロフィールを作成して下さい。 -- -- - Wrong email/password entered - Eメールまたはパスワードが間違っています。 - -@@ -3234,14 +3250,25 @@ - Unexpected error (code: %1 - 予期せぬエラー (code: %1 - -- -+ -+ A problem occured while loading your profile. -+The last backuped profile has been loaded: -+you may have lost last changes made -+ -+ -+ -+ Your profile could not be loaded. -+Choose another profile or create a new one. -+ -+ -+ - - QtVideoQt - - @product@ - @product@ - -- -+ - - QtVideoSettings - -@@ -3268,7 +3295,7 @@ - Video Settings - ビデオ設定 - -- -+ - - QtVoicemailSettings - -@@ -3279,14 +3306,14 @@ - Voicemail Settings - ボイスメール設定 - -- -+ - - QtWebDirectory - - @product@ - Directory - @product@ - ディレクトリ - -- -+ - - QuteComConfigDialog - -@@ -3305,7 +3332,7 @@ - @product@ - Configuration - @product@ - 設定 - -- -+ - - QuteComWindow - -@@ -3532,7 +3559,7 @@ - Conference - 会議 - -- -+ - - RenameGroupDialog - -@@ -3551,7 +3578,7 @@ - @product@ - Rename Contact Group - @product@ - コンタクトグループリネーム - -- -+ - - SecuritySettings - -@@ -3567,10 +3594,10 @@ - @product@ は、AES 128-bits 暗号化システムとDiffie-Hellman キー交換で暗号化されています。 - - -- Note: Your contacts need to enable this option for the call to be encrypted. To know whether this call is indeed encrypted, please check on the bottom of your @product@ window : an icon "lock" appears during the call when it is encrypted. -- 注記: あなたのコンタクトが暗号化されたコールオプションを有効にする必要があります。暗号化されたかどうかは、@product@ ウィンドウの下をチェックして下さい。アイコンがロックマークがあれば、コールは暗号化されています。 -+ Note: Your contacts need to enable this option for the call to be encrypted. To know whether this call is indeed encrypted, please check on the bottom of your @product@ window : an icon "lock” appears during the call when it is encrypted. -+ - -- -+ - - SimpleIMContactManager - -@@ -3625,7 +3652,7 @@ - @company@ ID: - @company@ ID: - -- -+ - - SkypeSettings - -@@ -3640,7 +3667,7 @@ - + Get a new Skype Account - + 新規Skypeアカウントを取得 - -- -+ - - SmsWindow - -@@ -3675,7 +3702,7 @@ - Enter phone number(s) here<br>They must be separated by & or ; or , - ここに電話番号を入力して下さい。<br>&; か ,で分けなければなりません。 - -- -+ - - SoftUpdateWindow - -@@ -3687,17 +3714,22 @@ - @product@ - アップデートダウンロード中 - - -- Downloading @product@ update... Version: %1 URL: %2 File Size: %3 (MB) Speed: %4 (kB/s) -- ダウンロード中 @product@ アップデート... バージョン: %1 URL: %2ファイルサイズ: %3 (MB) スピード: %4 (kB/s) -+ Downloading @product@ update... -+ -+Version: %1 -+URL: %2 -+File Size: %3 (MB) -+Speed: %4 (kB/s) -+ - -- -+ - - StatusBarWidget - - ... - ... - -- -+ - - TwitterSettings - -@@ -3716,14 +3748,14 @@ - + Get a new Twitter Account - + 新規Twitterアカウント取得 - -- -+ - - UserFrame - - Form - フォーム - -- -+ - - VideoSettings - -@@ -3815,10 +3847,15 @@ - ビデオコールテスト - - -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When used for the first time we recommend that you select the normal video quality mode, then you can try different modes to find out the most suitable one.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> to determine your Internet connection bandwidth.</p></body></html> -- <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">W最初に利用する時は、ノーマルビデオ品質モードを選択することをご推進します。それから最も適したモードに調整してゆきます。</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a>インターネット接続のバンド幅を決定します。</p></body></html> -+ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -+p, li { white-space: pre-wrap; } -+</style></head><body> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When used for the first time we recommend that you select the normal video quality mode, then you can try different modes to find out the most suitable one.</p> -+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Go to <a href="http://test.lvcm.com"><span style=" text-decoration: underline; color:#0000ff;">test.lvcm.com</span></a> to determine your Internet connection bandwidth.</p></body></html> -+ - -- -+ - - VideoWindow - -@@ -3829,7 +3866,7 @@ - @product@ - Video - @product@ - ビデオ - -- -+ - - VoicemailSettings - -@@ -3844,7 +3881,7 @@ - Please fill in here the information about your voicemail - Plボイスメールに関する情報はここで入力します。 - -- -+ - - Wizard - -@@ -3860,14 +3897,14 @@ - 次へ > - - -- <Back -- <戻る -- -- - Simple Wizard - Step %1 of %2 - シンプルウィザード – ステップ%1 of %2 - -- -+ -+ < Back -+ -+ -+ - - YahooSettings - -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ku.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_ku.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ku.ts 2011-02-15 12:30:20.134342884 -0800 -@@ -1134,18 +1134,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1170,6 +1162,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_lv.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_lv.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_lv.ts 2011-02-15 12:30:20.138345907 -0800 -@@ -1209,18 +1209,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1245,6 +1237,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_mn.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_mn.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_mn.ts 2011-02-15 12:30:20.142346066 -0800 -@@ -1202,18 +1202,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1238,6 +1230,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_nb.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_nb.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_nb.ts 2011-02-15 12:30:20.142346066 -0800 -@@ -1007,18 +1007,10 @@ - Ring mobiltelefon eller fasttelefon om kontakten ikke er på nettet - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Ledig tilstand - -@@ -1038,6 +1030,15 @@ - Automatically start @product@ - Automatisk start @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_nl.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_nl.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_nl.ts 2011-02-15 12:30:20.146335959 -0800 -@@ -1011,18 +1011,10 @@ - Bel mobiel of vast nummer als de contactpersoon niet online is - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Inactief status - -@@ -1042,6 +1034,14 @@ - Automatically start @product@ - Start @product@ automatisch - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Begin een chat -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_pl.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_pl.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_pl.ts 2011-02-15 12:30:20.150332347 -0800 -@@ -1006,18 +1006,10 @@ - Jeśli kontakt jest niezalogowany połącz z telefonem komórkowym lub stacjonarnym - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Czas bezczynności - -@@ -1037,6 +1029,14 @@ - Automatically start @product@ - Automatycznie uruchamiaj @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Rozpocznij czat -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_pt.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_pt.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_pt.ts 2011-02-15 12:30:20.154346475 -0800 -@@ -1008,18 +1008,10 @@ - Chamar o telemóvel ou telefone fixo se o contacto não estiver em linha - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Estado inactivo - -@@ -1039,6 +1031,14 @@ - Automatically start @product@ - Iniciar automaticamente o @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Iniciar conversa -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_pt_BR.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_pt_BR.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_pt_BR.ts 2011-02-15 12:30:20.347341034 -0800 -@@ -1076,18 +1076,10 @@ - Chamar telefone celular ou linha fixa caso o contato não esteja online - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Status ocioso - -@@ -1108,6 +1100,14 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Iniciar um bate-papo -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ro.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_ro.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ro.ts 2011-02-15 12:30:20.355342121 -0800 -@@ -1011,18 +1011,10 @@ - Apelează telefon fix sau mobil dacă contactul e neconectat - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Stare de Inactivitate - -@@ -1042,6 +1034,14 @@ - Automatically start @product@ - Pornește automat @product@ - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Pornește un Taifas [Chat] -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ru.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_ru.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_ru.ts 2011-02-15 12:30:20.359335086 -0800 -@@ -1046,18 +1046,10 @@ - Позвонить на мобильный или стационарный телефон, если собеседник не в сети - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Статус бездействия - -@@ -1078,6 +1070,14 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Начать текстовое общение -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sk.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_sk.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sk.ts 2011-02-15 12:30:20.367341621 -0800 -@@ -1122,18 +1122,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1158,6 +1150,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sl.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_sl.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sl.ts 2011-02-15 12:30:20.367341621 -0800 -@@ -1042,18 +1042,10 @@ - Pokliči stacionarni ali prenosni telefon, če stik ni na zvezi. - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Stanje pripravljenosti - -@@ -1074,6 +1066,14 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Začni klepet -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sr.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_sr.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sr.ts 2011-02-15 12:30:20.371350230 -0800 -@@ -1192,18 +1192,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1228,6 +1220,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sv.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_sv.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_sv.ts 2011-02-15 12:30:20.375332789 -0800 -@@ -1006,18 +1006,10 @@ - Ring mobiltelefon eller hemtelefon om kontakten inte är ansluten - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Inaktivitetsstatus - -@@ -1037,6 +1029,14 @@ - Automatically start @product@ - Starta @product@ automatiskt - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Starta en chatt -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_tr.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_tr.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_tr.ts 2011-02-15 12:30:20.379335742 -0800 -@@ -1032,18 +1032,10 @@ - Bağlantı çevrimiçi değilsecebinden ya da sabit numarasından ara - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Boşta - -@@ -1064,6 +1056,14 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ Sohbet başlat -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_uz.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_uz.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_uz.ts 2011-02-15 12:30:20.379335742 -0800 -@@ -1128,18 +1128,10 @@ - - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - - -@@ -1164,6 +1156,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_vi.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_vi.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_vi.ts 2011-02-15 12:30:20.383334854 -0800 -@@ -1073,18 +1073,10 @@ - Gọi số di động hoặc cố định nếu đối tác không online - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - Trạng thái chờ - -@@ -1105,6 +1097,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_zh.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_zh.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_zh.ts 2011-02-15 12:30:20.387339971 -0800 -@@ -1000,18 +1000,10 @@ - 当联系人不在线,呼叫手机或座机 - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - 空闲状态 - -@@ -1031,6 +1023,14 @@ - Automatically start @product@ - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ 开始一个文本聊天 -+ - - - GoogleTalkSettings -Index: qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_zh_HK.ts -=================================================================== ---- qutecom-2.2+dfsg1.orig/qutecom/src/presentation/qt/lang/qtqutecom_zh_HK.ts 2010-10-18 05:50:12.000000000 -0700 -+++ qutecom-2.2+dfsg1/qutecom/src/presentation/qt/lang/qtqutecom_zh_HK.ts 2011-02-15 12:30:20.395336797 -0800 -@@ -1048,18 +1048,10 @@ - 當聯絡人不在線,致電手提電話或固網電話 - - -- Prefere start a free call if applicable -- -- -- - Start in background mode - - - -- Prefere start a chat -- -- -- - Idle status - 空閒狀態 - -@@ -1080,6 +1072,15 @@ - - - -+ -+ Start free phone call if possible -+ -+ -+ -+ Start a chat -+ -+ -+ - - - GoogleTalkSettings diff -Nru qutecom-2.2+dfsg1/debian/patches/use-external-tinyxml.patch qutecom-2.2.1+dfsg1/debian/patches/use-external-tinyxml.patch --- qutecom-2.2+dfsg1/debian/patches/use-external-tinyxml.patch 1970-01-01 00:00:00.000000000 +0000 +++ qutecom-2.2.1+dfsg1/debian/patches/use-external-tinyxml.patch 2011-07-08 07:02:31.000000000 +0000 @@ -0,0 +1,167 @@ +Description: add ability to link against external libtinyxml +Author: Ludovico Cavedon +Forwarded: no +Index: qutecom/libs/3rdparty/CMakeLists.txt +=================================================================== +--- qutecom.orig/libs/3rdparty/CMakeLists.txt 2011-07-07 22:50:01.580000007 -0700 ++++ qutecom/libs/3rdparty/CMakeLists.txt 2011-07-07 22:50:19.716000007 -0700 +@@ -9,6 +9,7 @@ + option(OSIP2_INTERNAL "Use internal oSIP" ON) + option(CURL_INTERNAL "Use internal cURL" OFF) + option(LIBPURPLE_INTERNAL "Use internal libpurple" ON) ++ option(TINYXML_INTERNAL "Use internal tinyxml" OFF) + else (LINUX) + option(PORTAUDIO_INTERNAL "Use internal PortAudio" ON) + option(FFMPEG_INTERNAL "Use internal FFmpeg" ON) +@@ -18,6 +19,7 @@ + option(OSIP2_INTERNAL "Use internal oSIP" ON) + option(CURL_INTERNAL "Use internal cURL" ON) + option(LIBPURPLE_INTERNAL "Use internal libpurple" ON) ++ option(TINYXML_INTERNAL "Use internal tinyxml" ON) + endif (LINUX) + + if (WIN32) +Index: qutecom/libs/3rdparty/tinyxml/CMakeLists-external.txt +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ qutecom/libs/3rdparty/tinyxml/CMakeLists-external.txt 2011-07-07 22:50:19.716000007 -0700 +@@ -0,0 +1,9 @@ ++if (NOT TINYXML_FOUND) ++ find_package(TinyXML REQUIRED) ++endif (NOT TINYXML_FOUND) ++ ++ow_create_project(tinyxml) ++ ++ow_use_public_libraries( ++ TINYXML ++) +Index: qutecom/libs/3rdparty/tinyxml/CMakeLists-internal.txt +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ qutecom/libs/3rdparty/tinyxml/CMakeLists-internal.txt 2011-07-07 22:50:19.716000007 -0700 +@@ -0,0 +1,13 @@ ++ow_create_static_library(tinyxml) ++ ++ow_add_public_include_dirs( ++ ${CMAKE_CURRENT_SOURCE_DIR} ++) ++ ++ow_add_sources( ++ tinyxml.cpp ++ tinyxmlerror.cpp ++ tinyxmlparser.cpp ++) ++ ++ow_create_project_binary() +Index: qutecom/libs/3rdparty/tinyxml/CMakeLists.txt +=================================================================== +--- qutecom.orig/libs/3rdparty/tinyxml/CMakeLists.txt 2011-07-07 22:50:01.592000007 -0700 ++++ qutecom/libs/3rdparty/tinyxml/CMakeLists.txt 2011-07-07 22:50:19.728000007 -0700 +@@ -1,13 +1,5 @@ +-ow_create_static_library(tinyxml) +- +-ow_add_public_include_dirs( +- ${CMAKE_CURRENT_SOURCE_DIR} +-) +- +-ow_add_sources( +- tinyxml.cpp +- tinyxmlerror.cpp +- tinyxmlparser.cpp +-) +- +-ow_create_project_binary() ++if (TINYXML_INTERNAL) ++ include(CMakeLists-internal.txt) ++else (TINYXML_INTERNAL) ++ include(CMakeLists-external.txt) ++endif (TINYXML_INTERNAL) +Index: qutecom/owbuild/FindTinyXML.cmake +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ qutecom/owbuild/FindTinyXML.cmake 2011-07-07 23:11:44.048000006 -0700 +@@ -0,0 +1,84 @@ ++# - Try to find tinyxml ++# Once done this will define ++# ++# TINYXML_FOUND - system has libtinyxml ++# TINYXML_INCLUDE_DIRS - the libtinyxml include directory ++# TINYXML_LIBRARIES - Link these to use libtinyxml ++# TINYXML_DEFINITIONS - Compiler switches required for using libtinyxml ++# ++# Copyright (c) 2011 Ludovico Cavedon ++# Copyright (c) 2006 Andreas Schneider ++# ++# Redistribution and use is allowed according to the terms of the New ++# BSD license. ++# For details see the accompanying COPYING-CMAKE-SCRIPTS file. ++# ++ ++ ++if (TINYXML_LIBRARIES AND TINYXML_INCLUDE_DIRS) ++ # in cache already ++ set(TINYXML_FOUND TRUE) ++else (TINYXML_LIBRARIES AND TINYXML_INCLUDE_DIRS) ++ # use pkg-config to get the directories and then use these values ++ # in the FIND_PATH() and FIND_LIBRARY() calls ++ include(UsePkgConfig) ++ ++ pkgconfig(tinyxml _TINYXMLIncDir _TINYXMLLinkDir _TINYXMLLinkFlags _TINYXMLCflags) ++ ++ set(TINYXML_DEFINITIONS ${_TINYXMLCflags}) ++ ++ find_path(TINYXML_INCLUDE_DIR ++ NAMES ++ tinyxml.h ++ PATHS ++ ${_TINYXMLIncDir} ++ /usr/include ++ /usr/local/include ++ /opt/local/include ++ /sw/include ++ ) ++ ++ find_library(TINYXML_LIBRARY ++ NAMES ++ tinyxml ++ PATHS ++ ${_TINYXMLLinkDir} ++ /usr/lib ++ /usr/local/lib ++ /opt/local/lib ++ /sw/lib ++ ) ++ ++ if (TINYXML_LIBRARY) ++ set(TINYXML_FOUND TRUE) ++ endif (TINYXML_LIBRARY) ++ ++ set(TINYXML_INCLUDE_DIRS ++ ${TINYXML_INCLUDE_DIR} ++ ) ++ ++ if (TINYXML_FOUND) ++ set(TINYXML_LIBRARIES ++ ${TINYXML_LIBRARIES} ++ ${TINYXML_LIBRARY} ++ ) ++ endif (TINYXML_FOUND) ++ ++ if (TINYXML_INCLUDE_DIRS AND TINYXML_LIBRARIES) ++ set(TINYXML_FOUND TRUE) ++ endif (TINYXML_INCLUDE_DIRS AND TINYXML_LIBRARIES) ++ ++ if (TINYXML_FOUND) ++ if (NOT TINYXML_FIND_QUIETLY) ++ message(STATUS "Found tinyxml: ${TINYXML_LIBRARIES}") ++ endif (NOT TINYXML_FIND_QUIETLY) ++ else (TINYXML_FOUND) ++ if (TINYXML_FIND_REQUIRED) ++ message(FATAL_ERROR "Could not find tinyxml") ++ endif (TINYXML_FIND_REQUIRED) ++ endif (TINYXML_FOUND) ++ ++ # show the TINYXML_INCLUDE_DIRS and TINYXML_LIBRARIES variables only in the advanced view ++ mark_as_advanced(TINYXML_INCLUDE_DIRS TINYXML_LIBRARIES) ++ ++endif (TINYXML_LIBRARIES AND TINYXML_INCLUDE_DIRS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/America_Online_Root_Certification_Authority_1.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/America_Online_Root_Certification_Authority_1.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/America_Online_Root_Certification_Authority_1.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/America_Online_Root_Certification_Authority_1.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJV -UzEcMBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1l -cmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4X -DTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkGA1UEBhMCVVMx -HDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJp -Y2EgT25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCa -xlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CGv2BlnEtUiMJIxUo5vxTjWVXl -GbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44zDyL9Hy7n -BzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145Lcx -VR5lu9RhsCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiE -mf4hjUyAtgyC9mZweRrTT6PP8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCu -JKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Zo/Z5 -9m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUA -A4IBAQB8itEfGDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkF -Zu90821fnZmv9ov761KyBZiibyrFVL0lvV+uyIbqRizBs73B6UlwGBaXCBOM -IOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft3OJvx8Fi8eNy1gTI -dGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g -Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j -8uB9Gr784N/Xx6dssPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/AOL_Member_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/AOL_Member_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/AOL_Member_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/AOL_Member_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEKzCCAxOgAwIBAgIBBzANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP -bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4XDTA0MDYwNDE3 -MjYzOVoXDTI5MDYwNDE3MjYzOVowZzELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZp -cmdpbmlhMQ8wDQYDVQQHEwZEdWxsZXMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5l -IEluYy4xFjAUBgNVBAMTDUFPTCBNZW1iZXIgQ0EwggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQD4Y9jxzNYRbwXh1p9DJycl+q9nh3Ss3Nb8wpq9M3JOZbBa -zev4qWlIOW5oLnEWbp5ZfMJ8ze1uQ9gJQk4Nmn3utVojgdKkW6lRVBzf9oTfGcM+ -lC2NuhD46EMIDzI1bDUx+NbT/Akx1qmheiAGWQzgK42EwzegCB7xNXMQ3U/9DHKT -Jm6vxRw548rzlW8wwoU9TYQgyD490EDW/gZKGHMLbldn24PBE2aX071ZvH76LzZF -FM28v6tod79I6xGJTmqE810c5WtqAOZrjUikCbkh3C1mKfRWnvAFaP/MwcmIvNIs -C68ddBqGaKRtFHTsJID4lbnzLjw9IG8JAjjqOjgFAgMBAAGjgeUwgeIwDgYDVR0P -AQH/BAQDAgGGMB0GA1UdDgQWBBRhppltJJ8OEYjmOeD+dNEFaVKpQzAfBgNVHSME -GDAWgBQArdmj9nn2bnSpfzM9gRfXTM8z3jAPBgNVHRMBAf8EBTADAQH/MEgGA1Ud -IARBMD8wPQYEVR0gADA1MDMGCCsGAQUFBwIBFidodHRwczovL3BraS1pbmZvLmFv -bC5jb20vQU9ML2luZGV4Lmh0bWwwNQYDVR0fBC4wLDAqoCigJoYkaHR0cDovL2Ny -bC5hb2wuY29tL0FPTC9NYXN0ZXJDUkwuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQAM -nbzMHdQukRuvoDrrzV78JSopjrMg4Bc3+vy7xbUUuxxmDm9YX8Zx0BOJx60jC+1M -uFjB48KkJExldg2zhmRPKLrPlvhlmg6CJvWChU41ILNFzGDuD04glDorL8sjEJtG -G37DVnVJJKS4TZ8caNTm8i+vju0rt+WWaxw9jb8g028tVC+ceTX92gbeaCAgS69d -q15mwxRke/cC5ieWrRgeq/OCYPxMX7YKUnuenDsuzjxCXzZta/6hdooiIf1b6L1/ -n85RdEhsrLXRomr6B0Te0NupjRgf8bnF6Crruj07GIzADDCzySEcM0w6SVPUqLq6 -OCM9OmWCXnlxFfglK30Z ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Class3.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Class3.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Class3.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Class3.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIGCDCCA/CgAwIBAgIBATANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290 -IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB -IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA -Y2FjZXJ0Lm9yZzAeFw0wNTEwMTQwNzM2NTVaFw0zMzAzMjgwNzM2NTVaMFQxFDAS -BgNVBAoTC0NBY2VydCBJbmMuMR4wHAYDVQQLExVodHRwOi8vd3d3LkNBY2VydC5v -cmcxHDAaBgNVBAMTE0NBY2VydCBDbGFzcyAzIFJvb3QwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCrSTURSHzSJn5TlM9Dqd0o10Iqi/OHeBlYfA+e2ol9 -4fvrcpANdKGWZKufoCSZc9riVXbHF3v1BKxGuMO+f2SNEGwk82GcwPKQ+lHm9WkB -Y8MPVuJKQs/iRIwlKKjFeQl9RrmK8+nzNCkIReQcn8uUBByBqBSzmGXEQ+xOgo0J -0b2qW42S0OzekMV/CsLj6+YxWl50PpczWejDAz1gM7/30W9HxM3uYoNSbi4ImqTZ -FRiRpoWSR7CuSOtttyHshRpocjWr//AQXcD0lKdq1TuSfkyQBX6TwSyLpI5idBVx -bgtxA+qvFTia1NIFcm+M+SvrWnIl+TlG43IbPgTDZCciECqKT1inA62+tC4T7V2q -SNfVfdQqe1z6RgRQ5MwOQluM7dvyz/yWk+DbETZUYjQ4jwxgmzuXVjit89Jbi6Bb -6k6WuHzX1aCGcEDTkSm3ojyt9Yy7zxqSiuQ0e8DYbF/pCsLDpyCaWt8sXVJcukfV -m+8kKHA4IC/VfynAskEDaJLM4JzMl0tF7zoQCqtwOpiVcK01seqFK6QcgCExqa5g -eoAmSAC4AcCTY1UikTxW56/bOiXzjzFU6iaLgVn5odFTEcV7nQP2dBHgbbEsPyyG -kZlxmqZ3izRg0RS0LKydr4wQ05/EavhvE/xzWfdmQnQeiuP43NJvmJzLR5iVQAX7 -6QIDAQABo4G/MIG8MA8GA1UdEwEB/wQFMAMBAf8wXQYIKwYBBQUHAQEEUTBPMCMG -CCsGAQUFBzABhhdodHRwOi8vb2NzcC5DQWNlcnQub3JnLzAoBggrBgEFBQcwAoYc -aHR0cDovL3d3dy5DQWNlcnQub3JnL2NhLmNydDBKBgNVHSAEQzBBMD8GCCsGAQQB -gZBKMDMwMQYIKwYBBQUHAgEWJWh0dHA6Ly93d3cuQ0FjZXJ0Lm9yZy9pbmRleC5w -aHA/aWQ9MTAwDQYJKoZIhvcNAQEEBQADggIBAH8IiKHaGlBJ2on7oQhy84r3HsQ6 -tHlbIDCxRd7CXdNlafHCXVRUPIVfuXtCkcKZ/RtRm6tGpaEQU55tiKxzbiwzpvD0 -nuB1wT6IRanhZkP+VlrRekF490DaSjrxC1uluxYG5sLnk7mFTZdPsR44Q4Dvmw2M -77inYACHV30eRBzLI++bPJmdr7UpHEV5FpZNJ23xHGzDwlVks7wU4vOkHx4y/CcV -Bc/dLq4+gmF78CEQGPZE6lM5+dzQmiDgxrvgu1pPxJnIB721vaLbLmINQjRBvP+L -ivVRIqqIMADisNS8vmW61QNXeZvo3MhN+FDtkaVSKKKs+zZYPumUK5FQhxvWXtaM -zPcPEAxSTtAWYeXlCmy/F8dyRlecmPVsYGN6b165Ti/Iubm7aoW8mA3t+T6XhDSU -rgCvoeXnkm5OvfPi2RSLXNLrAWygF6UtEOucekq9ve7O/e0iQKtwOIj1CodqwqsF -YMlIBdpTwd5Ed2qz8zw87YC8pjhKKSRf/lk7myV6VmMAZLldpGJ9VzZPrYPvH5JT -oI53V93lYRE9IwCQTDz6o2CTBKOvNfYOao9PSmCnhQVsRqGP9Md246FZV/dxssRu -FFxtbUFm3xuTsdQAw+7Lzzw9IYCpX2Nl/N3gX6T0K/CFcUHUZyX7GrGXrtaZghNB -0m6lG5kngOcLqagA ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Root.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Root.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Root.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/CAcert_Root.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290 -IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB -IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA -Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO -BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi -MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ -ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC -CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ -8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6 -zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y -fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7 -w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc -G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k -epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q -laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ -QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU -fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826 -YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w -ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY -gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe -MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0 -IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy -dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw -czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0 -dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl -aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC -AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg -b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB -ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc -nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg -18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c -gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl -Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY -sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T -SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF -CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum -GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk -zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW -omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Entrust.net_Secure_Server_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Entrust.net_Secure_Server_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Entrust.net_Secure_Server_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Entrust.net_Secure_Server_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC -VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u -ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc -KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u -ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 -MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE -ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j -b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF -bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg -U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA -A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ -I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 -wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC -AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb -oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 -BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p -dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk -MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp -b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu -dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 -MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi -E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa -MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI -hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN -95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd -2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQG -EwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1 -cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4 -MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgx -LTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0 -eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2R -FGiYCh7+2gRvE4RiIcPRfM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO -/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuv -K9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAGA1UdHwRp -MGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEt -MCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjAL -BgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gjIBBPM5iQn9Qw -HQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMBAf8w -GgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GB -AFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y -7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2u -FHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_Global_eBusiness_CA-1.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_Global_eBusiness_CA-1.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_Global_eBusiness_CA-1.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Equifax_Secure_Global_eBusiness_CA-1.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT -ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw -MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj -dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l -c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC -UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc -58O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/ -o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH -MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr -aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA -A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA -Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv -8qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/GTE_CyberTrust_Global_Root.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/GTE_CyberTrust_Global_Root.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/GTE_CyberTrust_Global_Root.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/GTE_CyberTrust_Global_Root.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgw -FgYDVQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRy -dXN0IFNvbHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3Qg -R2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1 -MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYD -VQQLEx5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMT -GkdURSBDeWJlclRydXN0IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4usJTQGz0O9pTAipTHBsiQl8i4 -ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcqlHHK6XALn -ZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8F -LztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh3 -46B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq -81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0PlZPvy5TYnh+d -XIVtx6quTx8itc2VrbqnzPmrC3p/ ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -CERTIFICATES = \ - America_Online_Root_Certification_Authority_1.pem \ - CAcert_Root.pem \ - CAcert_Class3.pem \ - Entrust.net_Secure_Server_CA.pem \ - Equifax_Secure_CA.pem \ - Equifax_Secure_Global_eBusiness_CA-1.pem \ - GTE_CyberTrust_Global_Root.pem \ - StartCom_Certification_Authority.pem \ - StartCom_Free_SSL_CA.pem \ - Thawte_Premium_Server_CA.pem \ - Verisign_RSA_Secure_Server_CA.pem \ - Verisign_Class3_Primary_CA.pem \ - VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem \ - VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem - -EXTRA_CERTS = \ - AOL_Member_CA.pem \ - Microsoft_Internet_Authority.pem \ - Microsoft_Secure_Server_Authority.pem \ - VeriSign_Class3_Extended_Validation_CA.pem \ - VeriSign_International_Server_Class_3_CA.pem - - -cacertsdir = $(datadir)/purple/ca-certs - -if INSTALL_SSL_CERTIFICATES -cacerts_DATA = \ - $(CERTIFICATES) \ - $(EXTRA_CERTS) -else -cacerts_DATA = $(EXTRA_CERTS) -endif - -EXTRA_DIST = \ - Makefile.mingw \ - $(CERTIFICATES) \ - $(EXTRA_CERTS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,618 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = share/ca-certs -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(cacertsdir)" -cacertsDATA_INSTALL = $(INSTALL_DATA) -DATA = $(cacerts_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -CERTIFICATES = \ - America_Online_Root_Certification_Authority_1.pem \ - CAcert_Root.pem \ - CAcert_Class3.pem \ - Entrust.net_Secure_Server_CA.pem \ - Equifax_Secure_CA.pem \ - Equifax_Secure_Global_eBusiness_CA-1.pem \ - GTE_CyberTrust_Global_Root.pem \ - StartCom_Certification_Authority.pem \ - StartCom_Free_SSL_CA.pem \ - Thawte_Premium_Server_CA.pem \ - Verisign_RSA_Secure_Server_CA.pem \ - Verisign_Class3_Primary_CA.pem \ - VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem \ - VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem - -EXTRA_CERTS = \ - AOL_Member_CA.pem \ - Microsoft_Internet_Authority.pem \ - Microsoft_Secure_Server_Authority.pem \ - VeriSign_Class3_Extended_Validation_CA.pem \ - VeriSign_International_Server_Class_3_CA.pem - -cacertsdir = $(datadir)/purple/ca-certs -@INSTALL_SSL_CERTIFICATES_FALSE@cacerts_DATA = $(EXTRA_CERTS) -@INSTALL_SSL_CERTIFICATES_TRUE@cacerts_DATA = \ -@INSTALL_SSL_CERTIFICATES_TRUE@ $(CERTIFICATES) \ -@INSTALL_SSL_CERTIFICATES_TRUE@ $(EXTRA_CERTS) - -EXTRA_DIST = \ - Makefile.mingw \ - $(CERTIFICATES) \ - $(EXTRA_CERTS) - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu share/ca-certs/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu share/ca-certs/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-cacertsDATA: $(cacerts_DATA) - @$(NORMAL_INSTALL) - test -z "$(cacertsdir)" || $(mkdir_p) "$(DESTDIR)$(cacertsdir)" - @list='$(cacerts_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(cacertsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(cacertsdir)/$$f'"; \ - $(cacertsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(cacertsdir)/$$f"; \ - done - -uninstall-cacertsDATA: - @$(NORMAL_UNINSTALL) - @list='$(cacerts_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(cacertsdir)/$$f'"; \ - rm -f "$(DESTDIR)$(cacertsdir)/$$f"; \ - done -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(cacertsdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-cacertsDATA - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-cacertsDATA uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-cacertsDATA install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-cacertsDATA uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of Pidgin ca-certs -# - -PIDGIN_TREE_TOP := ../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -datadir := $(PIDGIN_INSTALL_DIR) --include ./Makefile.am.mingw -cacertsdir := $(PIDGIN_INSTALL_DIR)/ca-certs - -.PHONY: install clean - -install: ./Makefile.am.mingw - if test '$(cacerts_DATA)'; then \ - mkdir -p $(cacertsdir); \ - cp $(cacerts_DATA) $(cacertsdir); \ - fi; - -clean: - rm -f ./Makefile.am.mingw - -./Makefile.am.mingw: ./Makefile.am - sed -e 's/^if\ INSTALL_SSL_CERTIFICATES/ifeq (\$$(INSTALL_SSL_CERTIFICATES), 1)/' ./Makefile.am > $@ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Internet_Authority.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Internet_Authority.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Internet_Authority.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Internet_Authority.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFCjCCBHOgAwIBAgIEBycWdTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV -UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU -cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds -b2JhbCBSb290MB4XDTA4MDIxOTE4MjcwMloXDTExMDIxOTE4MjQ1M1owJzElMCMG -A1UEAxMcTWljcm9zb2Z0IEludGVybmV0IEF1dGhvcml0eTCCAiIwDQYJKoZIhvcN -AQEBBQADggIPADCCAgoCggIBAKiloatvDehDG/rQriel2AC9qmSJdvjKb2fmJf30 -K7SaC3zQu8kGQxENUEFsHsH0jmBejJ9vvn9tHZ8hGL+kORvWUVBskdMzP65rC0V0 -VeVgUYzPZ7MvrLfhh9+v3yJ7qRuf1aNgmzJg5t1AA91X+aRrFT4lRzl9BFWhQ1VS -XaD7l6qoiyhD8FbrdLRAe61swsRmzWeXoy6NJpOBsGXaCSG1Jooylro+zkWxt97c -NkNf/wYqoYcIXo02YpFbwreveejW9a0Lh/1z9+e9aiMtC5QnPT57GTqNINt5R0rp -Iz4g3GJhmjXVoVF/tev5DMJuhRgPoz0W0aA3UnSmTWh2RFvgqawLqSRrKUhVjySi -/m5s62uG5xxIftO7/6ljzS061CFoV/RBl/I3WghYp04sr4cSXWa/rL449YhBT8BJ -jltefWCYAOcT1nA4oFXwXbl1qCUIkZ0bqwju2FGW5vl2qh6vmzcQjc3XxD0m2UqC -yJNFa9SUgVXtUCqeOI+KqgLW01tpqZteG10byWKmppTVAvdPwHoGE0bl6wBwXldE -f7Pn4lqu6Yp4bedP3Qv1sfp2H7D98cxSwYRt3UcXN2kjTPv+pby2fEHm9GWf3iE/ -7OtzUI7LYhP7+rGyuCYTtZKH1jDWHrTZBpnAPmrAQQHCI8/4TjF9ZQ1mqRi6x9I9 -9XGfAgMBAAGjggFvMIIBazASBgNVHRMBAf8ECDAGAQH/AgEBMFMGA1UdIARMMEow -SAYJKwYBBAGxPgEAMDswOQYIKwYBBQUHAgEWLWh0dHA6Ly9jeWJlcnRydXN0Lm9t -bmlyb290LmNvbS9yZXBvc2l0b3J5LmNmbTAOBgNVHQ8BAf8EBAMCAYYwgYkGA1Ud -IwSBgTB/oXmkdzB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0 -aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAh -BgNVBAMTGkdURSBDeWJlclRydXN0IEdsb2JhbCBSb290ggIBpTBFBgNVHR8EPjA8 -MDqgOKA2hjRodHRwOi8vd3d3LnB1YmxpYy10cnVzdC5jb20vY2dpLWJpbi9DUkwv -MjAxOC9jZHAuY3JsMB0GA1UdDgQWBBTG27vA2CAZkvFg/IjxWH+8G06PGjANBgkq -hkiG9w0BAQUFAAOBgQBnSDXCyiqGmHTAEJOtZYVm/IbzGtzCY423NF6/yuccYZkm -spJnDoh8nq3nx3P2KBEyPAqoQ1MEFC+ByQjV4AAQ9dMQALUGNRfHhFUhBeeIybYd -bzvKOxSlIYSwO2T56+oXyDlkbQWKmHec5qzCE0lwGHslsRU/CHwhuFu2nH+CxQ== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Secure_Server_Authority.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Secure_Server_Authority.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Secure_Server_Authority.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Microsoft_Secure_Server_Authority.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIGEzCCA/ugAwIBAgIKYRZtLwAEAAAAIDANBgkqhkiG9w0BAQUFADAnMSUwIwYD -VQQDExxNaWNyb3NvZnQgSW50ZXJuZXQgQXV0aG9yaXR5MB4XDTA4MDQwOTIxMzc1 -NFoXDTExMDIxOTE4MjQ1M1owgYsxEzARBgoJkiaJk/IsZAEZFgNjb20xGTAXBgoJ -kiaJk/IsZAEZFgltaWNyb3NvZnQxFDASBgoJkiaJk/IsZAEZFgRjb3JwMRcwFQYK -CZImiZPyLGQBGRYHcmVkbW9uZDEqMCgGA1UEAxMhTWljcm9zb2Z0IFNlY3VyZSBT -ZXJ2ZXIgQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -kYTz6fKXvrdfIr5o3Ue4CRIzhTE+8JE4hrLTQki3emjYn/CfHRPb7hmMiOZmWBdE -DUEymyXOyZ7Sy2tC6WaBC4onVYotPoSsaOZJv6EJeHPk64RiWTfX+XqufRndYOEC -DUmotYQNPV/8InioIBf9+gOSsAMdmyGZF6C1PkJqvPZTRxNv6hxuMMb6uOQIPoFX -/ceQvAOZcJx2qGsAVKsJHylYkC0GgVyFVhOI0vcZZBcP5T+NtOmyjVBWdxS413HL -D+8w+3wG0bOP8EyOeRnuf0KLXGBangte0ZFIRd28GXpo5UrcA/r5000e2RTHmhC4 -8YPMIoi+q9XZoF5R0Z069QIDAQABo4IB2jCCAdYwEgYDVR0TAQH/BAgwBgEB/wIB -ADAdBgNVHQ4EFgQUFFXEOeA9LtFVLkiWsNh+FCIGk7wwCwYDVR0PBAQDAgGGMBIG -CSsGAQQBgjcVAQQFAgMFAAUwIwYJKwYBBAGCNxUCBBYEFM7FoL4P/nlmdZEP8PeS -WzWYqBWzMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMB8GA1UdIwQYMBaAFMbb -u8DYIBmS8WD8iPFYf7wbTo8aMIGjBgNVHR8EgZswgZgwgZWggZKggY+GNmh0dHA6 -Ly9tc2NybC5taWNyb3NvZnQuY29tL3BraS9tc2NvcnAvY3JsL21zd3d3KDQpLmNy -bIY0aHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraS9tc2NvcnAvY3JsL21zd3d3 -KDQpLmNybIYfaHR0cDovL2NvcnBwa2kvY3JsL21zd3d3KDQpLmNybDB5BggrBgEF -BQcBAQRtMGswPAYIKwYBBQUHMAKGMGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9w -a2kvbXNjb3JwL21zd3d3KDQpLmNydDArBggrBgEFBQcwAoYfaHR0cDovL2NvcnBw -a2kvYWlhL21zd3d3KDQpLmNydDANBgkqhkiG9w0BAQUFAAOCAgEAempuzk/VLM4N -H9TAbFtCjKc95iGmyx2bHbEk9m2cbGxXjBre+N4cJoIYYmhLrZ6L712ov1NjM73b -m8fb2Fy8Yw8Cmwc8VtarPZT2yzGr8MhNUDVuZswaKfjCY3H7RYv/XKc7AOMd25WP -/M0WTT4Bna6hl9dUaDGwv5SZFFIJ17FLo4FR2H7IkOOI/WcUPAHeDXUewp4qRPE/ -560xZrLSeNH2lKnOAwwXxwnXSo5WOF5AQXh1nRdbBV9Nu7yI6jH1QV6fKf6oFU2Y -IOjpnJ0FihVB6XoZ0wNOUMzPEEQcTfIoVoc+t0iK02wcmTLgBgbYU703dHvvPTcn -IfdI2mscx8l9MjUOdklIIve0FhCxRPqHpEeKjM95gllbXmWgQxAXiog+A62fEo5d -M7nfeEyiweSlhj1cv+2dyhzyS5saKYkk3ocCnOMCyD0M+4gJx4n4b/zT3rcujyN+ -7m20PbBTjcdTT1+AxOs75rON2hhKUqqrk2MDCpnEJsNK4TuRyDUtm9r+AxaZ4XRK -MT8InY1Xl9hzrIK6MVERYH46kxg6odwpzJ8Urn4dREBiMy6Gzq8mtyXvpYEcmeGL -zz1aT7qNNbQ0qqbPb6RpOMHlUWOIhVWJC71T5WK1pynAc3P9zOm8BkUYvIyJvCbR -bufCGVng4FAtVZ1advxSVRoa4GyuFZ8= ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Certification_Authority.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Certification_Authority.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Certification_Authority.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Certification_Authority.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE -FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9j -ZXJ0LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3Js -LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFM -BgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUHAgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0 -Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRwOi8vY2VydC5zdGFy -dGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYgU3Rh -cnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlh -YmlsaXR5LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2Yg -dGhlIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFp -bGFibGUgYXQgaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL3BvbGljeS5wZGYwEQYJ -YIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNT -TCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOCAgEAFmyZ -9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8 -jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW -FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz -ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1 -ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L -EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu -L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq -yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC -O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V -um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh -NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14= ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Free_SSL_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Free_SSL_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Free_SSL_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/StartCom_Free_SSL_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFFjCCBH+gAwIBAgIBADANBgkqhkiG9w0BAQQFADCBsDELMAkGA1UEBhMCSUwx -DzANBgNVBAgTBklzcmFlbDEOMAwGA1UEBxMFRWlsYXQxFjAUBgNVBAoTDVN0YXJ0 -Q29tIEx0ZC4xGjAYBgNVBAsTEUNBIEF1dGhvcml0eSBEZXAuMSkwJwYDVQQDEyBG -cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYS -YWRtaW5Ac3RhcnRjb20ub3JnMB4XDTA1MDMxNzE3Mzc0OFoXDTM1MDMxMDE3Mzc0 -OFowgbAxCzAJBgNVBAYTAklMMQ8wDQYDVQQIEwZJc3JhZWwxDjAMBgNVBAcTBUVp -bGF0MRYwFAYDVQQKEw1TdGFydENvbSBMdGQuMRowGAYDVQQLExFDQSBBdXRob3Jp -dHkgRGVwLjEpMCcGA1UEAxMgRnJlZSBTU0wgQ2VydGlmaWNhdGlvbiBBdXRob3Jp -dHkxITAfBgkqhkiG9w0BCQEWEmFkbWluQHN0YXJ0Y29tLm9yZzCBnzANBgkqhkiG -9w0BAQEFAAOBjQAwgYkCgYEA7YRgACOeyEpRKSfeOqE5tWmrCbIvNP1h3D3TsM+x -18LEwrHkllbEvqoUDufMOlDIOmKdw6OsWXuO7lUaHEe+o5c5s7XvIywI6Nivcy+5 -yYPo7QAPyHWlLzRMGOh2iCNJitu27Wjaw7ViKUylS7eYtAkUEKD4/mJ2IhULpNYI -LzUCAwEAAaOCAjwwggI4MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgHmMB0G -A1UdDgQWBBQcicOWzL3+MtUNjIExtpidjShkjTCB3QYDVR0jBIHVMIHSgBQcicOW -zL3+MtUNjIExtpidjShkjaGBtqSBszCBsDELMAkGA1UEBhMCSUwxDzANBgNVBAgT -BklzcmFlbDEOMAwGA1UEBxMFRWlsYXQxFjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4x -GjAYBgNVBAsTEUNBIEF1dGhvcml0eSBEZXAuMSkwJwYDVQQDEyBGcmVlIFNTTCBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJARYSYWRtaW5Ac3Rh -cnRjb20ub3JnggEAMB0GA1UdEQQWMBSBEmFkbWluQHN0YXJ0Y29tLm9yZzAdBgNV -HRIEFjAUgRJhZG1pbkBzdGFydGNvbS5vcmcwEQYJYIZIAYb4QgEBBAQDAgAHMC8G -CWCGSAGG+EIBDQQiFiBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAy -BglghkgBhvhCAQQEJRYjaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL2NhLWNybC5j -cmwwKAYJYIZIAYb4QgECBBsWGWh0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy8wOQYJ -YIZIAYb4QgEIBCwWKmh0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9pbmRleC5waHA/ -YXBwPTExMTANBgkqhkiG9w0BAQQFAAOBgQBscSXhnjSRIe/bbL0BCFaPiNhBOlP1 -ct8nV0t2hPdopP7rPwl+KLhX6h/BquL/lp9JmeaylXOWxkjHXo0Hclb4g4+fd68p -00UOpO6wNnQt8M2YI3s3S9r+UZjEHjQ8iP2ZO1CnwYszx8JSFhKVU2Ui77qLzmLb -cCOxgN8aIDjnfg== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Thawte_Premium_Server_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Thawte_Premium_Server_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Thawte_Premium_Server_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Thawte_Premium_Server_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx -FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD -VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv -biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy -dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t -MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB -MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG -A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp -b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl -cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv -bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE -VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ -ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR -uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG -9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI -hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM -pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class3_Extended_Validation_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class3_Extended_Validation_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class3_Extended_Validation_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class3_Extended_Validation_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIF5DCCBMygAwIBAgIQW3dZxheE4V7HJ8AylSkoazANBgkqhkiG9w0BAQUFADCB -yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL -ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp -U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW -ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMTYxMTA3MjM1OTU5WjCBujEL -MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW -ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYDVQQLEzJUZXJtcyBvZiB1c2UgYXQg -aHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYSAoYykwNjE0MDIGA1UEAxMrVmVy -aVNpZ24gQ2xhc3MgMyBFeHRlbmRlZCBWYWxpZGF0aW9uIFNTTCBDQTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBAJjboFXrnP0XeeOabhQdsVuYI4cWbod2 -nLU4O7WgerQHYwkZ5iqISKnnnbYwWgiXDOyq5BZpcmIjmvt6VCiYxQwtt9citsj5 -OBfH3doxRpqUFI6e7nigtyLUSVSXTeV0W5K87Gws3+fBthsaVWtmCAN/Ra+aM/EQ -wGyZSpIkMQht3QI+YXZ4eLbtfjeubPOJ4bfh3BXMt1afgKCxBX9ONxX/ty8ejwY4 -P1C3aSijtWZfNhpSSENmUt+ikk/TGGC+4+peGXEFv54cbGhyJW+ze3PJbb0S/5tB -Ml706H7FC6NMZNFOvCYIZfsZl1h44TO/7Wg+sSdFb8Di7Jdp91zT91ECAwEAAaOC -AdIwggHOMB0GA1UdDgQWBBT8ilC6nrklWntVhU+VAGOP6VhrQzASBgNVHRMBAf8E -CDAGAQH/AgEAMD0GA1UdIAQ2MDQwMgYEVR0gADAqMCgGCCsGAQUFBwIBFhxodHRw -czovL3d3dy52ZXJpc2lnbi5jb20vY3BzMD0GA1UdHwQ2MDQwMqAwoC6GLGh0dHA6 -Ly9FVlNlY3VyZS1jcmwudmVyaXNpZ24uY29tL3BjYTMtZzUuY3JsMA4GA1UdDwEB -/wQEAwIBBjARBglghkgBhvhCAQEEBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZ -MFcwVRYJaW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7 -GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nby5naWYwKQYDVR0R -BCIwIKQeMBwxGjAYBgNVBAMTEUNsYXNzM0NBMjA0OC0xLTQ3MD0GCCsGAQUFBwEB -BDEwLzAtBggrBgEFBQcwAYYhaHR0cDovL0VWU2VjdXJlLW9jc3AudmVyaXNpZ24u -Y29tMB8GA1UdIwQYMBaAFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqGSIb3DQEB -BQUAA4IBAQCWovp/5j3t1CvOtxU/wHIDX4u6FpAl98KD2Md1NGNoElMMU4l7yVYJ -p8M2RE4O0GJis4b66KGbNGeNUyIXPv2s7mcuQ+JdfzOE8qJwwG6Cl8A0/SXGI3/t -5rDFV0OEst4t8dD2SB8UcVeyrDHhlyQjyRNddOVG7wl8nuGZMQoIeRuPcZ8XZsg4 -z+6Ml7YGuXNG5NOUweVgtSV1LdlpMezNlsOjdv3odESsErlNv1HoudRETifLriDR -fip8tmNHnna6l9AW5wtsbfdDbzMLKTB3+p359U64drPNGLT5IO892+bKrZvQTtKH -qQ2mRHNQ3XBb7a1+Srwi1agm5MKFIA3Z ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_Class3_Primary_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_Class3_Primary_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_Class3_Primary_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_Class3_Primary_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG -A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz -cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 -MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV -BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt -YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN -ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE -BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is -I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G -CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do -lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc -AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5_2.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIE3TCCBEagAwIBAgIQWPOeXAErGUchqY7k7uD4vzANBgkqhkiG9w0BAQUFADBf -MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT -LkNsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw -HhcNMDYxMTA4MDAwMDAwWhcNMjExMTA3MjM1OTU5WjCByjELMAkGA1UEBhMCVVMx -FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZv -ciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAz -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8 -RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbext0uz/o9+B1fs70Pb -ZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhDY2pSS9KP6HBR -TdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/ -Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNH -iDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMB -AAGjggGoMIIBpDAPBgNVHRMBAf8EBTADAQH/MDEGA1UdHwQqMCgwJqAkoCKGIGh0 -dHA6Ly9jcmwudmVyaXNpZ24uY29tL3BjYTMuY3JsMA4GA1UdDwEB/wQEAwIBBjBt -BggrBgEFBQcBDARhMF+hXaBbMFkwVzBVFglpbWFnZS9naWYwITAfMAcGBSsOAwIa -BBSP5dMahqyNjmvDz4Bq1EgYLHsZLjAlFiNodHRwOi8vbG9nby52ZXJpc2lnbi5j -b20vdnNsb2dvLmdpZjA9BgNVHSAENjA0MDIGBFUdIAAwKjAoBggrBgEFBQcCARYc -aHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL2NwczAdBgNVHQ4EFgQUf9Nlp8Ld7Lvw -MAnzQzn6Aq8zMTMwgYAGA1UdIwR5MHehY6RhMF8xCzAJBgNVBAYTAlVTMRcwFQYD -VQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJsaWMgUHJp -bWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eYIQcLrkHRDZKTS2OMp7A8y6vzAN -BgkqhkiG9w0BAQUFAAOBgQCfFUleaybO7pjnTaWSP3Vq8DML+gncKJKrjWoxQdlH -MUdGCaE5BT5mZRmLMr9hLBzVagNvRNw7r+8bk1jWvc7Q7baJd1EVWTIoxXqJjNo+ -bVx1rIbUx579OD6Wc0CHNGqETjGo0qK5PE4G3cuyfK7h1Z8edOUk8M/km+wl6s3s -9g== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFEzCCBHygAwIBAgIQV7/7A/ssRtThns7g10N/EzANBgkqhkiG9w0BAQUFADBf -MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT -LkNsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw -HhcNMDYxMTA4MDAwMDAwWhcNMjExMTA3MjM1OTU5WjCByjELMAkGA1UEBhMCVVMx -FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz -dCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZv -ciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAz -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8 -RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbext0uz/o9+B1fs70Pb -ZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhDY2pSS9KP6HBR -TdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/ -Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNH -iDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMB -AAGjggHeMIIB2jAPBgNVHRMBAf8EBTADAQH/MDEGA1UdHwQqMCgwJqAkoCKGIGh0 -dHA6Ly9jcmwudmVyaXNpZ24uY29tL3BjYTMuY3JsMA4GA1UdDwEB/wQEAwIBBjBt -BggrBgEFBQcBDARhMF+hXaBbMFkwVzBVFglpbWFnZS9naWYwITAfMAcGBSsOAwIa -BBSP5dMahqyNjmvDz4Bq1EgYLHsZLjAlFiNodHRwOi8vbG9nby52ZXJpc2lnbi5j -b20vdnNsb2dvLmdpZjA9BgNVHSAENjA0MDIGBFUdIAAwKjAoBggrBgEFBQcCARYc -aHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL2NwczAdBgNVHQ4EFgQUf9Nlp8Ld7Lvw -MAnzQzn6Aq8zMTMwNAYDVR0lBC0wKwYJYIZIAYb4QgQBBgpghkgBhvhFAQgBBggr -BgEFBQcDAQYIKwYBBQUHAwIwgYAGA1UdIwR5MHehY6RhMF8xCzAJBgNVBAYTAlVT -MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMyBQdWJs -aWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eYIQcLrkHRDZKTS2OMp7 -A8y6vzANBgkqhkiG9w0BAQUFAAOBgQCpe2YpMPfVtKaWEtDucvBYEWkVVV9B/9IS -hBOk2QNm/6ngTMntjHKLtNdVOykVYMg8Ie9ELpM9xgsMjSQ/HvsBWnrdg2YU0cf9 -MFNIUYWFE6hU4e52ookY05eJesb9s72UYVo6CM8Uk72T/Qmpe1bIALhEWOneW3e9 -BxxsCzAwxw== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_International_Server_Class_3_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_International_Server_Class_3_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_International_Server_Class_3_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/VeriSign_International_Server_Class_3_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDgzCCAuygAwIBAgIQRvzrurTQLw+SYJgjP5MHjzANBgkqhkiG9w0BAQUFADBf -MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT -LkNsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw -HhcNOTcwNDE3MDAwMDAwWhcNMTYxMDI0MjM1OTU5WjCBujEfMB0GA1UEChMWVmVy -aVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVyaVNpZ24sIEluYy4xMzAx -BgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwgU2VydmVyIENBIC0gQ2xhc3Mg -MzFJMEcGA1UECxNAd3d3LnZlcmlzaWduLmNvbS9DUFMgSW5jb3JwLmJ5IFJlZi4g -TElBQklMSVRZIExURC4oYyk5NyBWZXJpU2lnbjCBnzANBgkqhkiG9w0BAQEFAAOB -jQAwgYkCgYEA2IKA6NYZAn0fhRg5JaJlK+G/1AXTvOY2O6rwTGxbtueqPHNFVbLx -veqXQu2aNAoV1Klc9UAl3dkHwTKydWzEyruj/lYncUOqY/UwPpMo5frxCTvzt01O -OfdcSVq4wR3Tsor+cDCVQsv+K1GLWjw6+SJPkLICp1OcTzTnqwSye28CAwEAAaOB -4zCB4DAPBgNVHRMECDAGAQH/AgEAMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHAQEw -KjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQUzA0BgNV -HSUELTArBggrBgEFBQcDAQYIKwYBBQUHAwIGCWCGSAGG+EIEAQYKYIZIAYb4RQEI -ATALBgNVHQ8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgEGMDEGA1UdHwQqMCgwJqAk -oCKGIGh0dHA6Ly9jcmwudmVyaXNpZ24uY29tL3BjYTMuY3JsMA0GCSqGSIb3DQEB -BQUAA4GBAECOSZeWinPdjk3vPmG3yqBirfQOCrt1PeJu2CzHv/S5jDabyqLQnHJG -OfamggNlEcS8vy2m9dk7CrWY+rN4uR7yK0xi1f2yeh3fM/1z+aXYLYwq6tH8sCi2 -6UlIE0uDihtIeyT3ON5vQVS4q1drBt/HotSp9vE2YoCI8ot11oBx ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_RSA_Secure_Server_CA.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_RSA_Secure_Server_CA.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_RSA_Secure_Server_CA.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/ca-certs/Verisign_RSA_Secure_Server_CA.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNDCCAaECEAKtZn5ORf5eV288mBle3cAwDQYJKoZIhvcNAQECBQAwXzEL -MAkGA1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMu -MS4wLAYDVQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9y -aXR5MB4XDTk0MTEwOTAwMDAwMFoXDTEwMDEwNzIzNTk1OVowXzELMAkGA1UE -BhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD -VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGb -MA0GCSqGSIb3DQEBAQUAA4GJADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6O -LDfO6zV4ZFQD5YRAUcm/jwjiioII0haGN1XpsSECrXZogZoFokvJSyVmIlZs -iAeP94FZbYQHZXATcXY+m3dM41CJVphIuR2nKRoTLkoRWZweFdVJVCxzOmmC -sZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJKoZIhvcNAQECBQADfgBl3X7hsuyw -4jrg7HFGmhkRuNPHoLQDQCYCPgmc4RKz0Vr2N6W3YQO2WxZpO8ZECAyIUwxr -l0nHPjXcbLm7qt9cuzovk2C2qUtN8iD3zV9/ZHuO3ABc1/p3yjkWWW8O6tO1 -g39NTUJWdrTJXwT4OPjr0l91X817/OWOgHz8UA== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/config.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/config.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/config.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,416 +0,0 @@ -/* config.h. Generated by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* configure arguments */ -/* #undef CONFIG_ARGS */ - -/* Define if debugging is enabled. */ -/* #undef DEBUG */ - -/* Define if mono enabled. */ -/* #undef ENABLE_MONO */ - -/* always defined to indicate that i18n is enabled */ -#define ENABLE_NLS 1 - -/* Define if you have the external 'altzone' variable. */ -/* #undef HAVE_ALTZONE */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ARPA_NAMESER_COMPAT_H */ - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Define to 1 if you have the `bind_textdomain_codeset' function. */ -/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */ - -/* Define to 1 if you have the `connect' function. */ -/* #undef HAVE_CONNECT */ - -/* Define to 1 if Cyrus SASL is present */ -/* #undef HAVE_CYRUS_SASL */ - -/* Define if you have the external 'daylight' variable. */ -#define HAVE_DAYLIGHT 1 - -/* Define if we are using D-Bus. */ -/* #undef HAVE_DBUS */ - -/* Define to 1 if you have the `dcgettext' function. */ -/* #undef HAVE_DCGETTEXT */ - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -/* #undef HAVE_DECL_TZNAME */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* whether or not we have dot */ -/* #undef HAVE_DOT */ - -/* whether or not we have doxygen */ -/* #undef HAVE_DOXYGEN */ - -/* Define if we're using evolution addressbook. */ -/* #undef HAVE_EVOLUTION_ADDRESSBOOK */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_EXTERN_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the getaddrinfo function. */ -/* TODO: Use this on new enough versions of Windows */ -/* #define HAVE_GETADDRINFO 1 */ - -/* Define to 1 if you have the `gethostid' function. */ -/* #define HAVE_GETHOSTID 1 */ - -/* Define to 1 if you have the `getopt_long' function. */ -/* #define HAVE_GETOPT_LONG 1 */ - -/* Define if the GNU gettext() function is already present or preinstalled. */ -/* #define HAVE_GETTEXT 1 */ - -/* Define if you have GNUTLS */ - #define HAVE_GNUTLS 1 - -/* Define to 1 if you have the header file. */ - #define HAVE_GNUTLS_GNUTLS_H 1 - -/* Define if exists and doesn't clash with . */ -#define HAVE_INTTYPES_H 1 - -/* Define if we have IOKit */ -/* #undef HAVE_IOKIT */ - -/* Define to 1 if you have the `krb_get_err_text' function. */ -/* #undef HAVE_KRB_GET_ERR_TEXT */ - -/* Define to 1 if you have the `krb_get_lrealm' function. */ -/* #undef HAVE_KRB_GET_LREALM */ - -/* Define to 1 if you have the `krb_log' function. */ -/* #undef HAVE_KRB_LOG */ - -/* Define to 1 if you have the `krb_rd_req' function. */ -/* #undef HAVE_KRB_RD_REQ */ - -/* Define to 1 if you have the `krb_set_key' function. */ -/* #undef HAVE_KRB_SET_KEY */ - -/* Define if your file defines LC_MESSAGES. */ -/* #define HAVE_LC_MESSAGES 1 */ - -/* Define to 1 if you have libgadu. */ -#define HAVE_LIBGADU 1 - -/* Define if you have NetworkManager */ -/* #undef HAVE_LIBNM */ - -/* Define to 1 if you have the `nsl' library (-lnsl). */ -/* #define HAVE_LIBNSL 1 */ - -/* Define to 1 if you have the `resolv' library (-lresolv). */ -/* #define HAVE_LIBRESOLV 1 */ - -/* Define to 1 if you have the `socket' library (-lsocket). */ -/* #undef HAVE_LIBSOCKET */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LOCALE_H 1 - -/* Define to 1 if you have the `lrand48' function. */ -/* #define HAVE_LRAND48 1 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define to 1 if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mono_jit_init' function. */ -/* #undef HAVE_MONO_JIT_INIT */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MONO_JIT_JIT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MONO_METADATA_OBJECT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NSPR_H */ - -/* Define if you have Mozilla NSS */ -#define HAVE_NSS 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NSS_H */ - -/* Define if we have Pango 1.4 or newer. */ -#define HAVE_PANGO14 1 - -/* Define to 1 if you have the header file. */ -/* #define HAVE_PATHS_H 1 */ - -/* Compile with support for perl */ -#define HAVE_PERL 1 - -/* Define to 1 if you have the `Perl_eval_pv' function. */ -/* #undef HAVE_PERL_EVAL_PV */ - -/* Define to 1 if you have the header file. */ -#define HAVE_PERL_H 1 - -/* Define to 1 if you have the `perl_run' function. */ -/* #define HAVE_PERL_RUN 1 */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_PRIO_H */ - -/* Define to 1 if you have the `random' function. */ -/* #define HAVE_RANDOM 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_REGEX_H 1 */ - -/* Define to 1 if you have the `setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SGTTY_H 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SIGNAL_H 1 */ - -/* Define if we have silcmime.h */ -#define HAVE_SILCMIME_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SMIME_H */ - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define if you have SSL */ -#define HAVE_SSL 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SSL_H */ - -/* Define if we're using libstartup-notification. */ -/* #define HAVE_STARTUP_NOTIFICATION 1 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the `strftime' function. */ -#define HAVE_STRFTIME 1 - -/* Define to 1 if you have a strftime() that supports the %z format string. */ -/* #undef HAVE_STRFTIME_Z_FORMAT */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strstr' function. */ -#define HAVE_STRSTR 1 - -/* Define to 1 if `tm_zone' is member of `struct tm'. */ -/* #define HAVE_STRUCT_TM_TM_ZONE 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_CDEFS_H 1 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_FILE_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_FILIO_H */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_IOCTL_H 1 */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_MSGBUF_H */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_SELECT_H 1 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_TIME_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_UIO_H 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_UTSNAME_H 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_SYS_WAIT_H 1 */ - -/* Compile with support for the Tcl toolkit */ -#define HAVE_TCL 1 - -/* Define to 1 if you have the header file. */ -/* #define HAVE_TERMIOS_H 1 */ - -/* Define if you have the external 'timezone' variable. */ -#define HAVE_TIMEZONE 1 - -/* Compile with support for the Tk toolkit */ -#define HAVE_TK 1 - -/* tm_gmtoff is available. */ -/* #define HAVE_TM_GMTOFF 1 */ - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -/* #define HAVE_TM_ZONE 1 */ - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -/* #undef HAVE_TZNAME */ - -/* Define to 1 if you have the header file. */ -/*#define HAVE_UNISTD_H 1*/ - -/* Define to 1 if you have the `vprintf' function. */ -#define HAVE_VPRINTF 1 - -/* Define to 1 if you have X11 */ -/* #define HAVE_X11 1 */ - -/* Define to 1 if you have the header file. */ -/* #define HAVE_X11_SM_SMLIB_H 1 */ - -/* Define if external libzephyr should be used. */ -/* #undef LIBZEPHYR_EXT */ - -/* Define to 1 if you don't have wide-character support. */ -/* #undef NO_WIDECHAR */ - -/* Define if old perl is installed. */ -/* #undef OLD_PERL */ - -/* Name of package */ -#define PACKAGE "pidgin" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "devel@pidgin.im" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "pidgin" - -/* Define to the full name and version of this package. */ -/* #define PACKAGE_STRING "pidgin 2.0.0dev" */ - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "pidgin" - -/* Define to the version of this package. */ -/* #define PACKAGE_VERSION "2.0.0dev" */ - -/* Define if plugins are enabled. */ -//#define PURPLE_PLUGINS 0 - -/* Define as the return type of signal handlers (`int' or `void'). */ -#define RETSIGTYPE void - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 - -/* Loads static protocol plugin module initialization functions. */ -#ifndef STATIC_PROTO_INIT -#define STATIC_PROTO_INIT extern gboolean purple_init_aim_plugin(); extern gboolean purple_init_icq_plugin(); extern gboolean purple_init_ssl_plugin(); extern gboolean purple_init_ssl_openssl_plugin(); extern gboolean purple_init_ssl_gnutls_plugin(); extern gboolean purple_init_msn_plugin(); extern gboolean purple_init_jabber_plugin(); /*extern gboolean purple_init_yahoo_plugin();*/\ - static void static_proto_init(void) { purple_init_ssl_plugin(); purple_init_ssl_gnutls_plugin(); /*purple_init_ssl_openssl_plugin();*/ purple_init_msn_plugin(); purple_init_jabber_plugin();/* purple_init_yahoo_plugin();*/ purple_init_aim_plugin(); purple_init_icq_plugin();} -#endif - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Use GStreamer for playing sounds */ -/* #define USE_GSTREAMER 1 */ - -/* Define if we're using GtkSpell */ -#define USE_GTKSPELL 1 - -/* Define if we're using XScreenSaver. */ -#define USE_SCREENSAVER 1 - -/* Define if we're using X Session Management. */ -/* #define USE_SM 1 */ - -/* Version number of package */ -#define VERSION "2.6.5" -#define DISPLAY_VERSION "2.6.5" - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to 1 if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Size of an int32. */ -#define ZEPHYR_INT32 long - -/* Define if kerberos should be used in Zephyr. */ -/* #undef ZEPHYR_USES_KERBEROS */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #define _FILE_OFFSET_BITS 64 */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* socklen_t size */ -/* #undef socklen_t */ - -/* - * Following are added for Win32 version of Pidgin - */ -#define HAVE_VSNPRINTF 1 - -#define HAVE_FILENO 1 - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2892 +0,0 @@ -/** - * @file account.c Account API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "account.h" -#include "core.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "pounce.h" -#include "prefs.h" -#include "privacy.h" -#include "prpl.h" -#include "request.h" -#include "server.h" -#include "signals.h" -#include "status.h" -#include "util.h" -#include "xmlnode.h" - -typedef struct -{ - PurpleConnectionErrorInfo *current_error; -} PurpleAccountPrivate; - -#define PURPLE_ACCOUNT_GET_PRIVATE(account) \ - ((PurpleAccountPrivate *) (account->priv)) - -/* TODO: Should use PurpleValue instead of this? What about "ui"? */ -typedef struct -{ - PurplePrefType type; - - char *ui; - - union - { - int integer; - char *string; - gboolean boolean; - - } value; - -} PurpleAccountSetting; - -typedef struct -{ - PurpleAccountRequestType type; - PurpleAccount *account; - void *ui_handle; - char *user; - gpointer userdata; - PurpleAccountRequestAuthorizationCb auth_cb; - PurpleAccountRequestAuthorizationCb deny_cb; - guint ref; -} PurpleAccountRequestInfo; - -static PurpleAccountUiOps *account_ui_ops = NULL; - -static GList *accounts = NULL; -static guint save_timer = 0; -static gboolean accounts_loaded = FALSE; - -static GList *handles = NULL; - -static void set_current_error(PurpleAccount *account, - PurpleConnectionErrorInfo *new_err); - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static void -setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *name; - PurpleAccountSetting *setting; - xmlnode *node, *child; - char buf[21]; - - name = (const char *)key; - setting = (PurpleAccountSetting *)value; - node = (xmlnode *)user_data; - - child = xmlnode_new_child(node, "setting"); - xmlnode_set_attrib(child, "name", name); - - if (setting->type == PURPLE_PREF_INT) { - xmlnode_set_attrib(child, "type", "int"); - g_snprintf(buf, sizeof(buf), "%d", setting->value.integer); - xmlnode_insert_data(child, buf, -1); - } - else if (setting->type == PURPLE_PREF_STRING && setting->value.string != NULL) { - xmlnode_set_attrib(child, "type", "string"); - xmlnode_insert_data(child, setting->value.string, -1); - } - else if (setting->type == PURPLE_PREF_BOOLEAN) { - xmlnode_set_attrib(child, "type", "bool"); - g_snprintf(buf, sizeof(buf), "%d", setting->value.boolean); - xmlnode_insert_data(child, buf, -1); - } -} - -static void -ui_setting_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *ui; - GHashTable *table; - xmlnode *node, *child; - - ui = (const char *)key; - table = (GHashTable *)value; - node = (xmlnode *)user_data; - - if (g_hash_table_size(table) > 0) - { - child = xmlnode_new_child(node, "settings"); - xmlnode_set_attrib(child, "ui", ui); - g_hash_table_foreach(table, setting_to_xmlnode, child); - } -} - -static xmlnode * -status_attr_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type, const PurpleStatusAttr *attr) -{ - xmlnode *node; - const char *id; - char *value = NULL; - PurpleStatusAttr *default_attr; - PurpleValue *default_value; - PurpleType attr_type; - PurpleValue *attr_value; - - id = purple_status_attr_get_id(attr); - g_return_val_if_fail(id, NULL); - - attr_value = purple_status_get_attr_value(status, id); - g_return_val_if_fail(attr_value, NULL); - attr_type = purple_value_get_type(attr_value); - - /* - * If attr_value is a different type than it should be - * then don't write it to the file. - */ - default_attr = purple_status_type_get_attr(type, id); - default_value = purple_status_attr_get_value(default_attr); - if (attr_type != purple_value_get_type(default_value)) - return NULL; - - /* - * If attr_value is the same as the default for this status - * then there is no need to write it to the file. - */ - if (attr_type == PURPLE_TYPE_STRING) - { - const char *string_value = purple_value_get_string(attr_value); - const char *default_string_value = purple_value_get_string(default_value); - if (purple_strequal(string_value, default_string_value)) - return NULL; - value = g_strdup(purple_value_get_string(attr_value)); - } - else if (attr_type == PURPLE_TYPE_INT) - { - int int_value = purple_value_get_int(attr_value); - if (int_value == purple_value_get_int(default_value)) - return NULL; - value = g_strdup_printf("%d", int_value); - } - else if (attr_type == PURPLE_TYPE_BOOLEAN) - { - gboolean boolean_value = purple_value_get_boolean(attr_value); - if (boolean_value == purple_value_get_boolean(default_value)) - return NULL; - value = g_strdup(boolean_value ? - "true" : "false"); - } - else - { - return NULL; - } - - g_return_val_if_fail(value, NULL); - - node = xmlnode_new("attribute"); - - xmlnode_set_attrib(node, "id", id); - xmlnode_set_attrib(node, "value", value); - - g_free(value); - - return node; -} - -static xmlnode * -status_attrs_to_xmlnode(const PurpleStatus *status) -{ - PurpleStatusType *type = purple_status_get_type(status); - xmlnode *node, *child; - GList *attrs, *attr; - - node = xmlnode_new("attributes"); - - attrs = purple_status_type_get_attrs(type); - for (attr = attrs; attr != NULL; attr = attr->next) - { - child = status_attr_to_xmlnode(status, type, (const PurpleStatusAttr *)attr->data); - if (child) - xmlnode_insert_child(node, child); - } - - return node; -} - -static xmlnode * -status_to_xmlnode(const PurpleStatus *status) -{ - xmlnode *node, *child; - - node = xmlnode_new("status"); - xmlnode_set_attrib(node, "type", purple_status_get_id(status)); - if (purple_status_get_name(status) != NULL) - xmlnode_set_attrib(node, "name", purple_status_get_name(status)); - xmlnode_set_attrib(node, "active", purple_status_is_active(status) ? "true" : "false"); - - child = status_attrs_to_xmlnode(status); - xmlnode_insert_child(node, child); - - return node; -} - -static xmlnode * -statuses_to_xmlnode(const PurplePresence *presence) -{ - xmlnode *node, *child; - GList *statuses; - PurpleStatus *status; - - node = xmlnode_new("statuses"); - - statuses = purple_presence_get_statuses(presence); - for (; statuses != NULL; statuses = statuses->next) - { - status = statuses->data; - if (purple_status_type_is_saveable(purple_status_get_type(status))) - { - child = status_to_xmlnode(status); - xmlnode_insert_child(node, child); - } - } - - return node; -} - -static xmlnode * -proxy_settings_to_xmlnode(PurpleProxyInfo *proxy_info) -{ - xmlnode *node, *child; - PurpleProxyType proxy_type; - const char *value; - int int_value; - char buf[21]; - - proxy_type = purple_proxy_info_get_type(proxy_info); - - node = xmlnode_new("proxy"); - - child = xmlnode_new_child(node, "type"); - xmlnode_insert_data(child, - (proxy_type == PURPLE_PROXY_USE_GLOBAL ? "global" : - proxy_type == PURPLE_PROXY_NONE ? "none" : - proxy_type == PURPLE_PROXY_HTTP ? "http" : - proxy_type == PURPLE_PROXY_SOCKS4 ? "socks4" : - proxy_type == PURPLE_PROXY_SOCKS5 ? "socks5" : - proxy_type == PURPLE_PROXY_USE_ENVVAR ? "envvar" : "unknown"), -1); - - if ((value = purple_proxy_info_get_host(proxy_info)) != NULL) - { - child = xmlnode_new_child(node, "host"); - xmlnode_insert_data(child, value, -1); - } - - if ((int_value = purple_proxy_info_get_port(proxy_info)) != 0) - { - g_snprintf(buf, sizeof(buf), "%d", int_value); - child = xmlnode_new_child(node, "port"); - xmlnode_insert_data(child, buf, -1); - } - - if ((value = purple_proxy_info_get_username(proxy_info)) != NULL) - { - child = xmlnode_new_child(node, "username"); - xmlnode_insert_data(child, value, -1); - } - - if ((value = purple_proxy_info_get_password(proxy_info)) != NULL) - { - child = xmlnode_new_child(node, "password"); - xmlnode_insert_data(child, value, -1); - } - - return node; -} - -static xmlnode * -current_error_to_xmlnode(PurpleConnectionErrorInfo *err) -{ - xmlnode *node, *child; - char type_str[3]; - - node = xmlnode_new("current_error"); - - if(err == NULL) - return node; - - /* It doesn't make sense to have transient errors persist across a - * restart. - */ - if(!purple_connection_error_is_fatal (err->type)) - return node; - - child = xmlnode_new_child(node, "type"); - g_snprintf(type_str, sizeof(type_str), "%u", err->type); - xmlnode_insert_data(child, type_str, -1); - - child = xmlnode_new_child(node, "description"); - if(err->description) { - char *utf8ized = purple_utf8_try_convert(err->description); - if(utf8ized == NULL) - utf8ized = purple_utf8_salvage(err->description); - xmlnode_insert_data(child, utf8ized, -1); - g_free(utf8ized); - } - - return node; -} - -static xmlnode * -account_to_xmlnode(PurpleAccount *account) -{ - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - - xmlnode *node, *child; - const char *tmp; - PurplePresence *presence; - PurpleProxyInfo *proxy_info; - - node = xmlnode_new("account"); - - child = xmlnode_new_child(node, "protocol"); - xmlnode_insert_data(child, purple_account_get_protocol_id(account), -1); - - child = xmlnode_new_child(node, "name"); - xmlnode_insert_data(child, purple_account_get_username(account), -1); - - if (purple_account_get_remember_password(account) && - ((tmp = purple_account_get_password(account)) != NULL)) - { - child = xmlnode_new_child(node, "password"); - xmlnode_insert_data(child, tmp, -1); - } - - if ((tmp = purple_account_get_alias(account)) != NULL) - { - child = xmlnode_new_child(node, "alias"); - xmlnode_insert_data(child, tmp, -1); - } - - if ((presence = purple_account_get_presence(account)) != NULL) - { - child = statuses_to_xmlnode(presence); - xmlnode_insert_child(node, child); - } - - if ((tmp = purple_account_get_user_info(account)) != NULL) - { - /* TODO: Do we need to call purple_str_strip_char(tmp, '\r') here? */ - child = xmlnode_new_child(node, "userinfo"); - xmlnode_insert_data(child, tmp, -1); - } - - if (g_hash_table_size(account->settings) > 0) - { - child = xmlnode_new_child(node, "settings"); - g_hash_table_foreach(account->settings, setting_to_xmlnode, child); - } - - if (g_hash_table_size(account->ui_settings) > 0) - { - g_hash_table_foreach(account->ui_settings, ui_setting_to_xmlnode, node); - } - - if ((proxy_info = purple_account_get_proxy_info(account)) != NULL) - { - child = proxy_settings_to_xmlnode(proxy_info); - xmlnode_insert_child(node, child); - } - - child = current_error_to_xmlnode(priv->current_error); - xmlnode_insert_child(node, child); - - return node; -} - -static xmlnode * -accounts_to_xmlnode(void) -{ - xmlnode *node, *child; - GList *cur; - - node = xmlnode_new("account"); - xmlnode_set_attrib(node, "version", "1.0"); - - for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) - { - child = account_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static void -sync_accounts(void) -{ - xmlnode *node; - char *data; - - if (!accounts_loaded) - { - purple_debug_error("account", "Attempted to save accounts before " - "they were read!\n"); - return; - } - - node = accounts_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("accounts.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_accounts(); - save_timer = 0; - return FALSE; -} - -static void -schedule_accounts_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ -static void -migrate_yahoo_japan(PurpleAccount *account) -{ - /* detect a Yahoo! JAPAN account that existed prior to 2.6.0 and convert it - * to use the new prpl-yahoojp. Also remove the account-specific settings - * we no longer need */ - - if(purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoo")) { - if(purple_account_get_bool(account, "yahoojp", FALSE)) { - const char *serverjp = purple_account_get_string(account, "serverjp", NULL); - const char *xferjp_host = purple_account_get_string(account, "xferjp_host", NULL); - - g_return_if_fail(serverjp != NULL); - g_return_if_fail(xferjp_host != NULL); - - purple_account_set_string(account, "server", serverjp); - purple_account_set_string(account, "xfer_host", xferjp_host); - - purple_account_set_protocol_id(account, "prpl-yahoojp"); - } - - /* these should always be nuked */ - purple_account_remove_setting(account, "yahoojp"); - purple_account_remove_setting(account, "serverjp"); - purple_account_remove_setting(account, "xferjp_host"); - - } - - return; -} - -static void -parse_settings(xmlnode *node, PurpleAccount *account) -{ - const char *ui; - xmlnode *child; - - /* Get the UI string, if these are UI settings */ - ui = xmlnode_get_attrib(node, "ui"); - - /* Read settings, one by one */ - for (child = xmlnode_get_child(node, "setting"); child != NULL; - child = xmlnode_get_next_twin(child)) - { - const char *name, *str_type; - PurplePrefType type; - char *data; - - name = xmlnode_get_attrib(child, "name"); - if (name == NULL) - /* Ignore this setting */ - continue; - - str_type = xmlnode_get_attrib(child, "type"); - if (str_type == NULL) - /* Ignore this setting */ - continue; - - if (purple_strequal(str_type, "string")) - type = PURPLE_PREF_STRING; - else if (purple_strequal(str_type, "int")) - type = PURPLE_PREF_INT; - else if (purple_strequal(str_type, "bool")) - type = PURPLE_PREF_BOOLEAN; - else - /* Ignore this setting */ - continue; - - data = xmlnode_get_data(child); - if (data == NULL) - /* Ignore this setting */ - continue; - - if (ui == NULL) - { - if (type == PURPLE_PREF_STRING) - purple_account_set_string(account, name, data); - else if (type == PURPLE_PREF_INT) - purple_account_set_int(account, name, atoi(data)); - else if (type == PURPLE_PREF_BOOLEAN) - purple_account_set_bool(account, name, - (*data == '0' ? FALSE : TRUE)); - } else { - if (type == PURPLE_PREF_STRING) - purple_account_set_ui_string(account, ui, name, data); - else if (type == PURPLE_PREF_INT) - purple_account_set_ui_int(account, ui, name, atoi(data)); - else if (type == PURPLE_PREF_BOOLEAN) - purple_account_set_ui_bool(account, ui, name, - (*data == '0' ? FALSE : TRUE)); - } - - g_free(data); - } - - /* we do this here because we need access to account settings to determine - * if we can/should migrate an old Yahoo! JAPAN account */ - migrate_yahoo_japan(account); -} - -static GList * -parse_status_attrs(xmlnode *node, PurpleStatus *status) -{ - GList *list = NULL; - xmlnode *child; - PurpleValue *attr_value; - - for (child = xmlnode_get_child(node, "attribute"); child != NULL; - child = xmlnode_get_next_twin(child)) - { - const char *id = xmlnode_get_attrib(child, "id"); - const char *value = xmlnode_get_attrib(child, "value"); - - if (!id || !*id || !value || !*value) - continue; - - attr_value = purple_status_get_attr_value(status, id); - if (!attr_value) - continue; - - list = g_list_append(list, (char *)id); - - switch (purple_value_get_type(attr_value)) - { - case PURPLE_TYPE_STRING: - list = g_list_append(list, (char *)value); - break; - case PURPLE_TYPE_INT: - case PURPLE_TYPE_BOOLEAN: - { - int v; - if (sscanf(value, "%d", &v) == 1) - list = g_list_append(list, GINT_TO_POINTER(v)); - else - list = g_list_remove(list, id); - break; - } - default: - break; - } - } - - return list; -} - -static void -parse_status(xmlnode *node, PurpleAccount *account) -{ - gboolean active = FALSE; - const char *data; - const char *type; - xmlnode *child; - GList *attrs = NULL; - - /* Get the active/inactive state */ - data = xmlnode_get_attrib(node, "active"); - if (data == NULL) - return; - if (g_ascii_strcasecmp(data, "true") == 0) - active = TRUE; - else if (g_ascii_strcasecmp(data, "false") == 0) - active = FALSE; - else - return; - - /* Get the type of the status */ - type = xmlnode_get_attrib(node, "type"); - if (type == NULL) - return; - - /* Read attributes into a GList */ - child = xmlnode_get_child(node, "attributes"); - if (child != NULL) - { - attrs = parse_status_attrs(child, - purple_account_get_status(account, type)); - } - - purple_account_set_status_list(account, type, active, attrs); - - g_list_free(attrs); -} - -static void -parse_statuses(xmlnode *node, PurpleAccount *account) -{ - xmlnode *child; - - for (child = xmlnode_get_child(node, "status"); child != NULL; - child = xmlnode_get_next_twin(child)) - { - parse_status(child, account); - } -} - -static void -parse_proxy_info(xmlnode *node, PurpleAccount *account) -{ - PurpleProxyInfo *proxy_info; - xmlnode *child; - char *data; - - proxy_info = purple_proxy_info_new(); - - /* Use the global proxy settings, by default */ - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); - - /* Read proxy type */ - child = xmlnode_get_child(node, "type"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - if (purple_strequal(data, "global")) - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_GLOBAL); - else if (purple_strequal(data, "none")) - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE); - else if (purple_strequal(data, "http")) - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_HTTP); - else if (purple_strequal(data, "socks4")) - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS4); - else if (purple_strequal(data, "socks5")) - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_SOCKS5); - else if (purple_strequal(data, "envvar")) - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_USE_ENVVAR); - else - { - purple_debug_error("account", "Invalid proxy type found when " - "loading account information for %s\n", - purple_account_get_username(account)); - } - g_free(data); - } - - /* Read proxy host */ - child = xmlnode_get_child(node, "host"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - purple_proxy_info_set_host(proxy_info, data); - g_free(data); - } - - /* Read proxy port */ - child = xmlnode_get_child(node, "port"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - purple_proxy_info_set_port(proxy_info, atoi(data)); - g_free(data); - } - - /* Read proxy username */ - child = xmlnode_get_child(node, "username"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - purple_proxy_info_set_username(proxy_info, data); - g_free(data); - } - - /* Read proxy password */ - child = xmlnode_get_child(node, "password"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - purple_proxy_info_set_password(proxy_info, data); - g_free(data); - } - - /* If there are no values set then proxy_info NULL */ - if ((purple_proxy_info_get_type(proxy_info) == PURPLE_PROXY_USE_GLOBAL) && - (purple_proxy_info_get_host(proxy_info) == NULL) && - (purple_proxy_info_get_port(proxy_info) == 0) && - (purple_proxy_info_get_username(proxy_info) == NULL) && - (purple_proxy_info_get_password(proxy_info) == NULL)) - { - purple_proxy_info_destroy(proxy_info); - return; - } - - purple_account_set_proxy_info(account, proxy_info); -} - -static void -parse_current_error(xmlnode *node, PurpleAccount *account) -{ - guint type; - char *type_str = NULL, *description = NULL; - xmlnode *child; - PurpleConnectionErrorInfo *current_error = NULL; - - child = xmlnode_get_child(node, "type"); - if (child == NULL || (type_str = xmlnode_get_data(child)) == NULL) - return; - type = atoi(type_str); - g_free(type_str); - - if (type > PURPLE_CONNECTION_ERROR_OTHER_ERROR) - { - purple_debug_error("account", - "Invalid PurpleConnectionError value %d found when " - "loading account information for %s\n", - type, purple_account_get_username(account)); - type = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - } - - child = xmlnode_get_child(node, "description"); - if (child) - description = xmlnode_get_data(child); - if (description == NULL) - description = g_strdup(""); - - current_error = g_new0(PurpleConnectionErrorInfo, 1); - PURPLE_DBUS_REGISTER_POINTER(current_error, PurpleConnectionErrorInfo); - current_error->type = type; - current_error->description = description; - - set_current_error(account, current_error); -} - -static PurpleAccount * -parse_account(xmlnode *node) -{ - PurpleAccount *ret; - xmlnode *child; - char *protocol_id = NULL; - char *name = NULL; - char *data; - - child = xmlnode_get_child(node, "protocol"); - if (child != NULL) - protocol_id = xmlnode_get_data(child); - - child = xmlnode_get_child(node, "name"); - if (child != NULL) - name = xmlnode_get_data(child); - if (name == NULL) - { - /* Do we really need to do this? */ - child = xmlnode_get_child(node, "username"); - if (child != NULL) - name = xmlnode_get_data(child); - } - - if ((protocol_id == NULL) || (name == NULL)) - { - g_free(protocol_id); - g_free(name); - return NULL; - } - - ret = purple_account_new(name, _purple_oscar_convert(name, protocol_id)); /* XXX: */ - g_free(name); - g_free(protocol_id); - - /* Read the password */ - child = xmlnode_get_child(node, "password"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - purple_account_set_remember_password(ret, TRUE); - purple_account_set_password(ret, data); - g_free(data); - } - - /* Read the alias */ - child = xmlnode_get_child(node, "alias"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - if (*data != '\0') - purple_account_set_alias(ret, data); - g_free(data); - } - - /* Read the statuses */ - child = xmlnode_get_child(node, "statuses"); - if (child != NULL) - { - parse_statuses(child, ret); - } - - /* Read the userinfo */ - child = xmlnode_get_child(node, "userinfo"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - purple_account_set_user_info(ret, data); - g_free(data); - } - - /* Read an old buddyicon */ - child = xmlnode_get_child(node, "buddyicon"); - if ((child != NULL) && ((data = xmlnode_get_data(child)) != NULL)) - { - const char *dirname = purple_buddy_icons_get_cache_dir(); - char *filename = g_build_filename(dirname, data, NULL); - gchar *contents; - gsize len; - - if (g_file_get_contents(filename, &contents, &len, NULL)) - { - purple_buddy_icons_set_account_icon(ret, (guchar *)contents, len); - } - else - { - /* Try to see if the icon got left behind in the old cache. */ - g_free(filename); - filename = g_build_filename(g_get_home_dir(), ".gaim", "icons", data, NULL); - if (g_file_get_contents(filename, &contents, &len, NULL)) { - purple_buddy_icons_set_account_icon(ret, (guchar*)contents, len); - } - } - - g_free(filename); - g_free(data); - } - - /* Read settings (both core and UI) */ - for (child = xmlnode_get_child(node, "settings"); child != NULL; - child = xmlnode_get_next_twin(child)) - { - parse_settings(child, ret); - } - - /* Read proxy */ - child = xmlnode_get_child(node, "proxy"); - if (child != NULL) - { - parse_proxy_info(child, ret); - } - - /* Read current error */ - child = xmlnode_get_child(node, "current_error"); - if (child != NULL) - { - parse_current_error(child, ret); - } - - return ret; -} - -static void -load_accounts(void) -{ - xmlnode *node, *child; - - accounts_loaded = TRUE; - - node = purple_util_read_xml_from_file("accounts.xml", _("accounts")); - - if (node == NULL) - return; - - for (child = xmlnode_get_child(node, "account"); child != NULL; - child = xmlnode_get_next_twin(child)) - { - PurpleAccount *new_acct; - new_acct = parse_account(child); - purple_accounts_add(new_acct); - } - - xmlnode_free(node); - - _purple_buddy_icons_account_loaded_cb(); -} - - -static void -delete_setting(void *data) -{ - PurpleAccountSetting *setting = (PurpleAccountSetting *)data; - - g_free(setting->ui); - - if (setting->type == PURPLE_PREF_STRING) - g_free(setting->value.string); - - g_free(setting); -} - -PurpleAccount * -purple_account_new(const char *username, const char *protocol_id) -{ - PurpleAccount *account = NULL; - PurpleAccountPrivate *priv = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleStatusType *status_type; - - g_return_val_if_fail(username != NULL, NULL); - g_return_val_if_fail(protocol_id != NULL, NULL); - - account = purple_accounts_find(username, protocol_id); - - if (account != NULL) - return account; - - account = g_new0(PurpleAccount, 1); - PURPLE_DBUS_REGISTER_POINTER(account, PurpleAccount); - priv = g_new0(PurpleAccountPrivate, 1); - account->priv = priv; - - purple_account_set_username(account, username); - - purple_account_set_protocol_id(account, protocol_id); - - account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, delete_setting); - account->ui_settings = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, (GDestroyNotify)g_hash_table_destroy); - account->system_log = NULL; - /* 0 is not a valid privacy setting */ - account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; - - purple_signal_emit(purple_accounts_get_handle(), "account-created", account); - - prpl = purple_find_prpl(protocol_id); - - if (prpl == NULL) - return account; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info != NULL && prpl_info->status_types != NULL) - purple_account_set_status_types(account, prpl_info->status_types(account)); - - account->presence = purple_presence_new_for_account(account); - - status_type = purple_account_get_status_type_with_primitive(account, PURPLE_STATUS_AVAILABLE); - if (status_type != NULL) - purple_presence_set_status_active(account->presence, - purple_status_type_get_id(status_type), - TRUE); - else - purple_presence_set_status_active(account->presence, - "offline", - TRUE); - - return account; -} - -void -purple_account_destroy(PurpleAccount *account) -{ - PurpleAccountPrivate *priv = NULL; - GList *l; - - g_return_if_fail(account != NULL); - - purple_debug_info("account", "Destroying account %p\n", account); - purple_signal_emit(purple_accounts_get_handle(), "account-destroying", account); - - for (l = purple_get_conversations(); l != NULL; l = l->next) - { - PurpleConversation *conv = (PurpleConversation *)l->data; - - if (purple_conversation_get_account(conv) == account) - purple_conversation_set_account(conv, NULL); - } - - g_free(account->username); - g_free(account->alias); - g_free(account->password); - g_free(account->user_info); - g_free(account->buddy_icon_path); - g_free(account->protocol_id); - - g_hash_table_destroy(account->settings); - g_hash_table_destroy(account->ui_settings); - - purple_account_set_status_types(account, NULL); - - purple_presence_destroy(account->presence); - - if(account->system_log) - purple_log_free(account->system_log); - - while (account->deny) { - g_free(account->deny->data); - account->deny = g_slist_delete_link(account->deny, account->deny); - } - - while (account->permit) { - g_free(account->permit->data); - account->permit = g_slist_delete_link(account->permit, account->permit); - } - - priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error); - if (priv->current_error) { - g_free(priv->current_error->description); - g_free(priv->current_error); - } - g_free(priv); - - PURPLE_DBUS_UNREGISTER_POINTER(account); - g_free(account); -} - -void -purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data) -{ - g_return_if_fail(account != NULL); - - account->registration_cb = cb; - account->registration_cb_user_data = user_data; -} - -void -purple_account_register(PurpleAccount *account) -{ - g_return_if_fail(account != NULL); - - purple_debug_info("account", "Registering account %s\n", - purple_account_get_username(account)); - - _purple_connection_new(account, TRUE, purple_account_get_password(account)); -} - -void -purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) -{ - g_return_if_fail(account != NULL); - - purple_debug_info("account", "Unregistering account %s\n", - purple_account_get_username(account)); - - _purple_connection_new_unregister(account, purple_account_get_password(account), cb, user_data); -} - -static void -request_password_ok_cb(PurpleAccount *account, PurpleRequestFields *fields) -{ - const char *entry; - gboolean remember; - - entry = purple_request_fields_get_string(fields, "password"); - remember = purple_request_fields_get_bool(fields, "remember"); - - if (!entry || !*entry) - { - purple_notify_error(account, NULL, _("Password is required to sign on."), NULL); - return; - } - - if(remember) - purple_account_set_remember_password(account, TRUE); - - purple_account_set_password(account, entry); - - _purple_connection_new(account, FALSE, entry); -} - -static void -request_password_cancel_cb(PurpleAccount *account, PurpleRequestFields *fields) -{ - /* Disable the account as the user has canceled connecting */ - purple_account_set_enabled(account, purple_core_get_ui(), FALSE); -} - - -void -purple_account_request_password(PurpleAccount *account, GCallback ok_cb, - GCallback cancel_cb, void *user_data) -{ - gchar *primary; - const gchar *username; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - PurpleRequestFields *fields; - - /* Close any previous password request windows */ - purple_request_close_with_handle(account); - - username = purple_account_get_username(account); - primary = g_strdup_printf(_("Enter password for %s (%s)"), username, - purple_account_get_protocol_name(account)); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("password", _("Enter Password"), NULL, FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_bool_new("remember", _("Save password"), FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(account, - NULL, - primary, - NULL, - fields, - _("OK"), ok_cb, - _("Cancel"), cancel_cb, - account, NULL, NULL, - user_data); - g_free(primary); -} - -void -purple_account_connect(PurpleAccount *account) -{ - PurplePlugin *prpl; - const char *password, *username; - PurplePluginProtocolInfo *prpl_info; - - g_return_if_fail(account != NULL); - - username = purple_account_get_username(account); - - if (!purple_account_get_enabled(account, purple_core_get_ui())) { - purple_debug_info("account", - "Account %s not enabled, not connecting.\n", - username); - return; - } - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - if (prpl == NULL) { - gchar *message; - - message = g_strdup_printf(_("Missing protocol plugin for %s"), username); - purple_notify_error(account, _("Connection Error"), message, NULL); - g_free(message); - return; - } - - purple_debug_info("account", "Connecting to account %s.\n", username); - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - password = purple_account_get_password(account); - if ((password == NULL) && - !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && - !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) - purple_account_request_password(account, G_CALLBACK(request_password_ok_cb), G_CALLBACK(request_password_cancel_cb), account); - else - _purple_connection_new(account, FALSE, password); -} - -void -purple_account_disconnect(PurpleAccount *account) -{ - PurpleConnection *gc; - const char *username; - - g_return_if_fail(account != NULL); - g_return_if_fail(!purple_account_is_disconnected(account)); - - username = purple_account_get_username(account); - purple_debug_info("account", "Disconnecting account %s (%p)\n", - username ? username : "(null)", account); - - account->disconnecting = TRUE; - - gc = purple_account_get_connection(account); - _purple_connection_destroy(gc); - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_account_set_connection(account, NULL); - - account->disconnecting = FALSE; -} - -void -purple_account_notify_added(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, - const char *message) -{ - PurpleAccountUiOps *ui_ops; - - g_return_if_fail(account != NULL); - g_return_if_fail(remote_user != NULL); - - ui_ops = purple_accounts_get_ui_ops(); - - if (ui_ops != NULL && ui_ops->notify_added != NULL) - ui_ops->notify_added(account, remote_user, id, alias, message); -} - -void -purple_account_request_add(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, - const char *message) -{ - PurpleAccountUiOps *ui_ops; - - g_return_if_fail(account != NULL); - g_return_if_fail(remote_user != NULL); - - ui_ops = purple_accounts_get_ui_ops(); - - if (ui_ops != NULL && ui_ops->request_add != NULL) - ui_ops->request_add(account, remote_user, id, alias, message); -} - -static PurpleAccountRequestInfo * -purple_account_request_info_unref(PurpleAccountRequestInfo *info) -{ - if (--info->ref) - return info; - - /* TODO: This will leak info->user_data, but there is no callback to just clean that up */ - g_free(info->user); - g_free(info); - return NULL; -} - -static void -purple_account_request_close_info(PurpleAccountRequestInfo *info) -{ - PurpleAccountUiOps *ops; - - ops = purple_accounts_get_ui_ops(); - - if (ops != NULL && ops->close_account_request != NULL) - ops->close_account_request(info->ui_handle); - - purple_account_request_info_unref(info); -} - -void -purple_account_request_close_with_account(PurpleAccount *account) -{ - GList *l, *l_next; - - g_return_if_fail(account != NULL); - - for (l = handles; l != NULL; l = l_next) { - PurpleAccountRequestInfo *info = l->data; - - l_next = l->next; - - if (info->account == account) { - handles = g_list_remove(handles, info); - purple_account_request_close_info(info); - } - } -} - -void -purple_account_request_close(void *ui_handle) -{ - GList *l, *l_next; - - g_return_if_fail(ui_handle != NULL); - - for (l = handles; l != NULL; l = l_next) { - PurpleAccountRequestInfo *info = l->data; - - l_next = l->next; - - if (info->ui_handle == ui_handle) { - handles = g_list_remove(handles, info); - purple_account_request_close_info(info); - } - } -} - -static void -request_auth_cb(void *data) -{ - PurpleAccountRequestInfo *info = data; - - handles = g_list_remove(handles, info); - - if (info->auth_cb != NULL) - info->auth_cb(info->userdata); - - purple_signal_emit(purple_accounts_get_handle(), - "account-authorization-granted", info->account, info->user); - - purple_account_request_info_unref(info); -} - -static void -request_deny_cb(void *data) -{ - PurpleAccountRequestInfo *info = data; - - handles = g_list_remove(handles, info); - - if (info->deny_cb != NULL) - info->deny_cb(info->userdata); - - purple_signal_emit(purple_accounts_get_handle(), - "account-authorization-denied", info->account, info->user); - - purple_account_request_info_unref(info); -} - -void * -purple_account_request_authorization(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, const char *message, gboolean on_list, - PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data) -{ - PurpleAccountUiOps *ui_ops; - PurpleAccountRequestInfo *info; - int plugin_return; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(remote_user != NULL, NULL); - - ui_ops = purple_accounts_get_ui_ops(); - - plugin_return = GPOINTER_TO_INT( - purple_signal_emit_return_1(purple_accounts_get_handle(), - "account-authorization-requested", account, remote_user)); - - if (plugin_return > 0) { - if (auth_cb != NULL) - auth_cb(user_data); - return NULL; - } else if (plugin_return < 0) { - if (deny_cb != NULL) - deny_cb(user_data); - return NULL; - } - - if (ui_ops != NULL && ui_ops->request_authorize != NULL) { - info = g_new0(PurpleAccountRequestInfo, 1); - info->type = PURPLE_ACCOUNT_REQUEST_AUTHORIZATION; - info->account = account; - info->auth_cb = auth_cb; - info->deny_cb = deny_cb; - info->userdata = user_data; - info->user = g_strdup(remote_user); - info->ref = 2; /* We hold an extra ref to make sure info remains valid - if any of the callbacks are called synchronously. We - unref it after the function call */ - - info->ui_handle = ui_ops->request_authorize(account, remote_user, id, alias, message, - on_list, request_auth_cb, request_deny_cb, info); - - info = purple_account_request_info_unref(info); - if (info) { - handles = g_list_append(handles, info); - return info->ui_handle; - } - } - - return NULL; -} - -static void -change_password_cb(PurpleAccount *account, PurpleRequestFields *fields) -{ - const char *orig_pass, *new_pass_1, *new_pass_2; - - orig_pass = purple_request_fields_get_string(fields, "password"); - new_pass_1 = purple_request_fields_get_string(fields, "new_password_1"); - new_pass_2 = purple_request_fields_get_string(fields, "new_password_2"); - - if (g_utf8_collate(new_pass_1, new_pass_2)) - { - purple_notify_error(account, NULL, - _("New passwords do not match."), NULL); - - return; - } - - if ((purple_request_fields_is_field_required(fields, "password") && - (orig_pass == NULL || *orig_pass == '\0')) || - (purple_request_fields_is_field_required(fields, "new_password_1") && - (new_pass_1 == NULL || *new_pass_1 == '\0')) || - (purple_request_fields_is_field_required(fields, "new_password_2") && - (new_pass_2 == NULL || *new_pass_2 == '\0'))) - { - purple_notify_error(account, NULL, - _("Fill out all fields completely."), NULL); - return; - } - - purple_account_change_password(account, orig_pass, new_pass_1); -} - -void -purple_account_request_change_password(PurpleAccount *account) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - PurpleConnection *gc; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - char primary[256]; - - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - gc = purple_account_get_connection(account); - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - fields = purple_request_fields_new(); - - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("password", _("Original password"), - NULL, FALSE); - purple_request_field_string_set_masked(field, TRUE); - if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL))) - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("new_password_1", - _("New password"), - NULL, FALSE); - purple_request_field_string_set_masked(field, TRUE); - if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL))) - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("new_password_2", - _("New password (again)"), - NULL, FALSE); - purple_request_field_string_set_masked(field, TRUE); - if (!(prpl_info && (prpl_info->options | OPT_PROTO_PASSWORD_OPTIONAL))) - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - g_snprintf(primary, sizeof(primary), _("Change password for %s"), - purple_account_get_username(account)); - - /* I'm sticking this somewhere in the code: bologna */ - - purple_request_fields(purple_account_get_connection(account), - NULL, - primary, - _("Please enter your current password and your " - "new password."), - fields, - _("OK"), G_CALLBACK(change_password_cb), - _("Cancel"), NULL, - account, NULL, NULL, - account); -} - -static void -set_user_info_cb(PurpleAccount *account, const char *user_info) -{ - PurpleConnection *gc; - - purple_account_set_user_info(account, user_info); - gc = purple_account_get_connection(account); - serv_set_info(gc, user_info); -} - -void -purple_account_request_change_user_info(PurpleAccount *account) -{ - PurpleConnection *gc; - char primary[256]; - - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - gc = purple_account_get_connection(account); - - g_snprintf(primary, sizeof(primary), - _("Change user information for %s"), - purple_account_get_username(account)); - - purple_request_input(gc, _("Set User Info"), primary, NULL, - purple_account_get_user_info(account), - TRUE, FALSE, ((gc != NULL) && - (gc->flags & PURPLE_CONNECTION_HTML) ? "html" : NULL), - _("Save"), G_CALLBACK(set_user_info_cb), - _("Cancel"), NULL, - account, NULL, NULL, - account); -} - -void -purple_account_set_username(PurpleAccount *account, const char *username) -{ - PurpleBlistUiOps *blist_ops; - - g_return_if_fail(account != NULL); - - g_free(account->username); - account->username = g_strdup(username); - - schedule_accounts_save(); - - /* if the name changes, we should re-write the buddy list - * to disk with the new name */ - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); -} - -void -purple_account_set_password(PurpleAccount *account, const char *password) -{ - g_return_if_fail(account != NULL); - - g_free(account->password); - account->password = g_strdup(password); - - schedule_accounts_save(); -} - -void -purple_account_set_alias(PurpleAccount *account, const char *alias) -{ - g_return_if_fail(account != NULL); - - /* - * Do nothing if alias and account->alias are both NULL. Or if - * they're the exact same string. - */ - if (alias == account->alias) - return; - - if ((!alias && account->alias) || (alias && !account->alias) || - g_utf8_collate(account->alias, alias)) - { - char *old = account->alias; - - account->alias = g_strdup(alias); - purple_signal_emit(purple_accounts_get_handle(), "account-alias-changed", - account, old); - g_free(old); - - schedule_accounts_save(); - } -} - -void -purple_account_set_user_info(PurpleAccount *account, const char *user_info) -{ - g_return_if_fail(account != NULL); - - g_free(account->user_info); - account->user_info = g_strdup(user_info); - - schedule_accounts_save(); -} - -void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path) -{ - g_return_if_fail(account != NULL); - - g_free(account->buddy_icon_path); - account->buddy_icon_path = g_strdup(path); - - schedule_accounts_save(); -} - -void -purple_account_set_protocol_id(PurpleAccount *account, const char *protocol_id) -{ - g_return_if_fail(account != NULL); - g_return_if_fail(protocol_id != NULL); - - g_free(account->protocol_id); - account->protocol_id = g_strdup(protocol_id); - - schedule_accounts_save(); -} - -void -purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc) -{ - g_return_if_fail(account != NULL); - - account->gc = gc; -} - -void -purple_account_set_remember_password(PurpleAccount *account, gboolean value) -{ - g_return_if_fail(account != NULL); - - account->remember_pass = value; - - schedule_accounts_save(); -} - -void -purple_account_set_check_mail(PurpleAccount *account, gboolean value) -{ - g_return_if_fail(account != NULL); - - purple_account_set_bool(account, "check-mail", value); -} - -void -purple_account_set_enabled(PurpleAccount *account, const char *ui, - gboolean value) -{ - PurpleConnection *gc; - gboolean was_enabled = FALSE; - - g_return_if_fail(account != NULL); - g_return_if_fail(ui != NULL); - - was_enabled = purple_account_get_enabled(account, ui); - - purple_account_set_ui_bool(account, ui, "auto-login", value); - gc = purple_account_get_connection(account); - - if(was_enabled && !value) - purple_signal_emit(purple_accounts_get_handle(), "account-disabled", account); - else if(!was_enabled && value) - purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account); - - if ((gc != NULL) && (gc->wants_to_die == TRUE)) - return; - - if (value && purple_presence_is_online(account->presence)) - purple_account_connect(account); - else if (!value && !purple_account_is_disconnected(account)) - purple_account_disconnect(account); -} - -void -purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info) -{ - g_return_if_fail(account != NULL); - - if (account->proxy_info != NULL) - purple_proxy_info_destroy(account->proxy_info); - - account->proxy_info = info; - - schedule_accounts_save(); -} - -void -purple_account_set_status_types(PurpleAccount *account, GList *status_types) -{ - g_return_if_fail(account != NULL); - - /* Out with the old... */ - if (account->status_types != NULL) - { - g_list_foreach(account->status_types, (GFunc)purple_status_type_destroy, NULL); - g_list_free(account->status_types); - } - - /* In with the new... */ - account->status_types = status_types; -} - -void -purple_account_set_status(PurpleAccount *account, const char *status_id, - gboolean active, ...) -{ - GList *attrs = NULL; - const gchar *id; - gpointer data; - va_list args; - - va_start(args, active); - while ((id = va_arg(args, const char *)) != NULL) - { - attrs = g_list_append(attrs, (char *)id); - data = va_arg(args, void *); - attrs = g_list_append(attrs, data); - } - purple_account_set_status_list(account, status_id, active, attrs); - g_list_free(attrs); - va_end(args); -} - -void -purple_account_set_status_list(PurpleAccount *account, const char *status_id, - gboolean active, GList *attrs) -{ - PurpleStatus *status; - - g_return_if_fail(account != NULL); - g_return_if_fail(status_id != NULL); - - status = purple_account_get_status(account, status_id); - if (status == NULL) - { - purple_debug_error("account", - "Invalid status ID '%s' for account %s (%s)\n", - status_id, purple_account_get_username(account), - purple_account_get_protocol_id(account)); - return; - } - - if (active || purple_status_is_independent(status)) - purple_status_set_active_with_attrs_list(status, active, attrs); - - /* - * Our current statuses are saved to accounts.xml (so that when we - * reconnect, we go back to the previous status). - */ - schedule_accounts_save(); -} - -void -purple_account_clear_settings(PurpleAccount *account) -{ - g_return_if_fail(account != NULL); - - g_hash_table_destroy(account->settings); - - account->settings = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, delete_setting); -} - -void -purple_account_remove_setting(PurpleAccount *account, const char *setting) -{ - g_return_if_fail(account != NULL); - g_return_if_fail(setting != NULL); - - g_hash_table_remove(account->settings, setting); -} - -void -purple_account_set_int(PurpleAccount *account, const char *name, int value) -{ - PurpleAccountSetting *setting; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - - setting = g_new0(PurpleAccountSetting, 1); - - setting->type = PURPLE_PREF_INT; - setting->value.integer = value; - - g_hash_table_insert(account->settings, g_strdup(name), setting); - - schedule_accounts_save(); -} - -void -purple_account_set_string(PurpleAccount *account, const char *name, - const char *value) -{ - PurpleAccountSetting *setting; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - - setting = g_new0(PurpleAccountSetting, 1); - - setting->type = PURPLE_PREF_STRING; - setting->value.string = g_strdup(value); - - g_hash_table_insert(account->settings, g_strdup(name), setting); - - schedule_accounts_save(); -} - -void -purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value) -{ - PurpleAccountSetting *setting; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - - setting = g_new0(PurpleAccountSetting, 1); - - setting->type = PURPLE_PREF_BOOLEAN; - setting->value.boolean = value; - - g_hash_table_insert(account->settings, g_strdup(name), setting); - - schedule_accounts_save(); -} - -static GHashTable * -get_ui_settings_table(PurpleAccount *account, const char *ui) -{ - GHashTable *table; - - table = g_hash_table_lookup(account->ui_settings, ui); - - if (table == NULL) { - table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - delete_setting); - g_hash_table_insert(account->ui_settings, g_strdup(ui), table); - } - - return table; -} - -void -purple_account_set_ui_int(PurpleAccount *account, const char *ui, - const char *name, int value) -{ - PurpleAccountSetting *setting; - GHashTable *table; - - g_return_if_fail(account != NULL); - g_return_if_fail(ui != NULL); - g_return_if_fail(name != NULL); - - setting = g_new0(PurpleAccountSetting, 1); - - setting->type = PURPLE_PREF_INT; - setting->ui = g_strdup(ui); - setting->value.integer = value; - - table = get_ui_settings_table(account, ui); - - g_hash_table_insert(table, g_strdup(name), setting); - - schedule_accounts_save(); -} - -void -purple_account_set_ui_string(PurpleAccount *account, const char *ui, - const char *name, const char *value) -{ - PurpleAccountSetting *setting; - GHashTable *table; - - g_return_if_fail(account != NULL); - g_return_if_fail(ui != NULL); - g_return_if_fail(name != NULL); - - setting = g_new0(PurpleAccountSetting, 1); - - setting->type = PURPLE_PREF_STRING; - setting->ui = g_strdup(ui); - setting->value.string = g_strdup(value); - - table = get_ui_settings_table(account, ui); - - g_hash_table_insert(table, g_strdup(name), setting); - - schedule_accounts_save(); -} - -void -purple_account_set_ui_bool(PurpleAccount *account, const char *ui, - const char *name, gboolean value) -{ - PurpleAccountSetting *setting; - GHashTable *table; - - g_return_if_fail(account != NULL); - g_return_if_fail(ui != NULL); - g_return_if_fail(name != NULL); - - setting = g_new0(PurpleAccountSetting, 1); - - setting->type = PURPLE_PREF_BOOLEAN; - setting->ui = g_strdup(ui); - setting->value.boolean = value; - - table = get_ui_settings_table(account, ui); - - g_hash_table_insert(table, g_strdup(name), setting); - - schedule_accounts_save(); -} - -static PurpleConnectionState -purple_account_get_state(const PurpleAccount *account) -{ - PurpleConnection *gc; - - g_return_val_if_fail(account != NULL, PURPLE_DISCONNECTED); - - gc = purple_account_get_connection(account); - if (!gc) - return PURPLE_DISCONNECTED; - - return purple_connection_get_state(gc); -} - -gboolean -purple_account_is_connected(const PurpleAccount *account) -{ - return (purple_account_get_state(account) == PURPLE_CONNECTED); -} - -gboolean -purple_account_is_connecting(const PurpleAccount *account) -{ - return (purple_account_get_state(account) == PURPLE_CONNECTING); -} - -gboolean -purple_account_is_disconnected(const PurpleAccount *account) -{ - return (purple_account_get_state(account) == PURPLE_DISCONNECTED); -} - -const char * -purple_account_get_username(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->username; -} - -const char * -purple_account_get_password(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->password; -} - -const char * -purple_account_get_alias(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->alias; -} - -const char * -purple_account_get_user_info(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->user_info; -} - -const char * -purple_account_get_buddy_icon_path(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->buddy_icon_path; -} - -const char * -purple_account_get_protocol_id(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - return account->protocol_id; -} - -const char * -purple_account_get_protocol_name(const PurpleAccount *account) -{ - PurplePlugin *p; - - g_return_val_if_fail(account != NULL, NULL); - - p = purple_find_prpl(purple_account_get_protocol_id(account)); - - return ((p && p->info->name) ? _(p->info->name) : _("Unknown")); -} - -PurpleConnection * -purple_account_get_connection(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->gc; -} - -gboolean -purple_account_get_remember_password(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, FALSE); - - return account->remember_pass; -} - -gboolean -purple_account_get_check_mail(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, FALSE); - - return purple_account_get_bool(account, "check-mail", FALSE); -} - -gboolean -purple_account_get_enabled(const PurpleAccount *account, const char *ui) -{ - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(ui != NULL, FALSE); - - return purple_account_get_ui_bool(account, ui, "auto-login", FALSE); -} - -PurpleProxyInfo * -purple_account_get_proxy_info(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->proxy_info; -} - -PurpleStatus * -purple_account_get_active_status(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return purple_presence_get_active_status(account->presence); -} - -PurpleStatus * -purple_account_get_status(const PurpleAccount *account, const char *status_id) -{ - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(status_id != NULL, NULL); - - return purple_presence_get_status(account->presence, status_id); -} - -PurpleStatusType * -purple_account_get_status_type(const PurpleAccount *account, const char *id) -{ - GList *l; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - for (l = purple_account_get_status_types(account); l != NULL; l = l->next) - { - PurpleStatusType *status_type = (PurpleStatusType *)l->data; - - if (purple_strequal(purple_status_type_get_id(status_type), id)) - return status_type; - } - - return NULL; -} - -PurpleStatusType * -purple_account_get_status_type_with_primitive(const PurpleAccount *account, PurpleStatusPrimitive primitive) -{ - GList *l; - - g_return_val_if_fail(account != NULL, NULL); - - for (l = purple_account_get_status_types(account); l != NULL; l = l->next) - { - PurpleStatusType *status_type = (PurpleStatusType *)l->data; - - if (purple_status_type_get_primitive(status_type) == primitive) - return status_type; - } - - return NULL; -} - -PurplePresence * -purple_account_get_presence(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->presence; -} - -gboolean -purple_account_is_status_active(const PurpleAccount *account, - const char *status_id) -{ - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(status_id != NULL, FALSE); - - return purple_presence_is_status_active(account->presence, status_id); -} - -GList * -purple_account_get_status_types(const PurpleAccount *account) -{ - g_return_val_if_fail(account != NULL, NULL); - - return account->status_types; -} - -int -purple_account_get_int(const PurpleAccount *account, const char *name, - int default_value) -{ - PurpleAccountSetting *setting; - - g_return_val_if_fail(account != NULL, default_value); - g_return_val_if_fail(name != NULL, default_value); - - setting = g_hash_table_lookup(account->settings, name); - - if (setting == NULL) - return default_value; - - g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value); - - return setting->value.integer; -} - -const char * -purple_account_get_string(const PurpleAccount *account, const char *name, - const char *default_value) -{ - PurpleAccountSetting *setting; - - g_return_val_if_fail(account != NULL, default_value); - g_return_val_if_fail(name != NULL, default_value); - - setting = g_hash_table_lookup(account->settings, name); - - if (setting == NULL) - return default_value; - - g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value); - - return setting->value.string; -} - -gboolean -purple_account_get_bool(const PurpleAccount *account, const char *name, - gboolean default_value) -{ - PurpleAccountSetting *setting; - - g_return_val_if_fail(account != NULL, default_value); - g_return_val_if_fail(name != NULL, default_value); - - setting = g_hash_table_lookup(account->settings, name); - - if (setting == NULL) - return default_value; - - g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); - - return setting->value.boolean; -} - -int -purple_account_get_ui_int(const PurpleAccount *account, const char *ui, - const char *name, int default_value) -{ - PurpleAccountSetting *setting; - GHashTable *table; - - g_return_val_if_fail(account != NULL, default_value); - g_return_val_if_fail(ui != NULL, default_value); - g_return_val_if_fail(name != NULL, default_value); - - if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) - return default_value; - - if ((setting = g_hash_table_lookup(table, name)) == NULL) - return default_value; - - g_return_val_if_fail(setting->type == PURPLE_PREF_INT, default_value); - - return setting->value.integer; -} - -const char * -purple_account_get_ui_string(const PurpleAccount *account, const char *ui, - const char *name, const char *default_value) -{ - PurpleAccountSetting *setting; - GHashTable *table; - - g_return_val_if_fail(account != NULL, default_value); - g_return_val_if_fail(ui != NULL, default_value); - g_return_val_if_fail(name != NULL, default_value); - - if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) - return default_value; - - if ((setting = g_hash_table_lookup(table, name)) == NULL) - return default_value; - - g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value); - - return setting->value.string; -} - -gboolean -purple_account_get_ui_bool(const PurpleAccount *account, const char *ui, - const char *name, gboolean default_value) -{ - PurpleAccountSetting *setting; - GHashTable *table; - - g_return_val_if_fail(account != NULL, default_value); - g_return_val_if_fail(ui != NULL, default_value); - g_return_val_if_fail(name != NULL, default_value); - - if ((table = g_hash_table_lookup(account->ui_settings, ui)) == NULL) - return default_value; - - if ((setting = g_hash_table_lookup(table, name)) == NULL) - return default_value; - - g_return_val_if_fail(setting->type == PURPLE_PREF_BOOLEAN, default_value); - - return setting->value.boolean; -} - -PurpleLog * -purple_account_get_log(PurpleAccount *account, gboolean create) -{ - g_return_val_if_fail(account != NULL, NULL); - - if(!account->system_log && create){ - PurplePresence *presence; - int login_time; - - presence = purple_account_get_presence(account); - login_time = purple_presence_get_login_time(presence); - - account->system_log = purple_log_new(PURPLE_LOG_SYSTEM, - purple_account_get_username(account), account, NULL, - (login_time != 0) ? login_time : time(NULL), NULL); - } - - return account->system_log; -} - -void -purple_account_destroy_log(PurpleAccount *account) -{ - g_return_if_fail(account != NULL); - - if(account->system_log){ - purple_log_free(account->system_log); - account->system_log = NULL; - } -} - -void -purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - PurplePlugin *prpl = NULL; - - g_return_if_fail(account != NULL); - g_return_if_fail(buddy != NULL); - - gc = purple_account_get_connection(account); - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info != NULL && prpl_info->add_buddy != NULL) - prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy)); -} - -void -purple_account_add_buddies(PurpleAccount *account, GList *buddies) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info) { - GList *cur, *groups = NULL; - - /* Make a list of what group each buddy is in */ - for (cur = buddies; cur != NULL; cur = cur->next) { - PurpleBuddy *buddy = cur->data; - groups = g_list_append(groups, purple_buddy_get_group(buddy)); - } - - if (prpl_info->add_buddies != NULL) - prpl_info->add_buddies(gc, buddies, groups); - else if (prpl_info->add_buddy != NULL) { - GList *curb = buddies, *curg = groups; - - while ((curb != NULL) && (curg != NULL)) { - prpl_info->add_buddy(gc, curb->data, curg->data); - curb = curb->next; - curg = curg->next; - } - } - - g_list_free(groups); - } -} - -void -purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy, - PurpleGroup *group) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && prpl_info->remove_buddy) - prpl_info->remove_buddy(gc, buddy, group); -} - -void -purple_account_remove_buddies(PurpleAccount *account, GList *buddies, GList *groups) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info) { - if (prpl_info->remove_buddies) - prpl_info->remove_buddies(gc, buddies, groups); - else { - GList *curb = buddies; - GList *curg = groups; - while ((curb != NULL) && (curg != NULL)) { - purple_account_remove_buddy(account, curb->data, curg->data); - curb = curb->next; - curg = curg->next; - } - } - } -} - -void -purple_account_remove_group(PurpleAccount *account, PurpleGroup *group) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && prpl_info->remove_group) - prpl_info->remove_group(gc, group); -} - -void -purple_account_change_password(PurpleAccount *account, const char *orig_pw, - const char *new_pw) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = purple_account_get_connection(account); - PurplePlugin *prpl = NULL; - - purple_account_set_password(account, new_pw); - - if (gc != NULL) - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && prpl_info->change_passwd) - prpl_info->change_passwd(gc, orig_pw, new_pw); -} - -gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy) -{ - PurpleConnection *gc; - PurplePluginProtocolInfo *prpl_info = NULL; - PurplePlugin *prpl = NULL; - - g_return_val_if_fail(account, FALSE); - g_return_val_if_fail(buddy, FALSE); - - gc = purple_account_get_connection(account); - if (gc == NULL) - return FALSE; - - prpl = purple_connection_get_prpl(gc); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (!prpl_info || !prpl_info->offline_message) - return FALSE; - return prpl_info->offline_message(buddy); -} - -static void -signed_on_cb(PurpleConnection *gc, - gpointer unused) -{ - PurpleAccount *account = purple_connection_get_account(gc); - purple_account_clear_current_error(account); -} - -static void -set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err) -{ - PurpleAccountPrivate *priv; - PurpleConnectionErrorInfo *old_err; - - g_return_if_fail(account != NULL); - - priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - old_err = priv->current_error; - - if(new_err == old_err) - return; - - priv->current_error = new_err; - - purple_signal_emit(purple_accounts_get_handle(), - "account-error-changed", - account, old_err, new_err); - schedule_accounts_save(); - - if(old_err) - g_free(old_err->description); - - PURPLE_DBUS_UNREGISTER_POINTER(old_err); - g_free(old_err); -} - -static void -connection_error_cb(PurpleConnection *gc, - PurpleConnectionError type, - const gchar *description, - gpointer unused) -{ - PurpleAccount *account; - PurpleConnectionErrorInfo *err; - - account = purple_connection_get_account(gc); - - g_return_if_fail(account != NULL); - - err = g_new0(PurpleConnectionErrorInfo, 1); - PURPLE_DBUS_REGISTER_POINTER(err, PurpleConnectionErrorInfo); - - err->type = type; - err->description = g_strdup(description); - - set_current_error(account, err); -} - -const PurpleConnectionErrorInfo * -purple_account_get_current_error(PurpleAccount *account) -{ - PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account); - return priv->current_error; -} - -void -purple_account_clear_current_error(PurpleAccount *account) -{ - set_current_error(account, NULL); -} - -void -purple_accounts_add(PurpleAccount *account) -{ - g_return_if_fail(account != NULL); - - if (g_list_find(accounts, account) != NULL) - return; - - accounts = g_list_append(accounts, account); - - schedule_accounts_save(); - - purple_signal_emit(purple_accounts_get_handle(), "account-added", account); -} - -void -purple_accounts_remove(PurpleAccount *account) -{ - g_return_if_fail(account != NULL); - - accounts = g_list_remove(accounts, account); - - schedule_accounts_save(); - - /* Clearing the error ensures that account-error-changed is emitted, - * which is the end of the guarantee that the the error's pointer is - * valid. - */ - purple_account_clear_current_error(account); - purple_signal_emit(purple_accounts_get_handle(), "account-removed", account); -} - -void -purple_accounts_delete(PurpleAccount *account) -{ - PurpleBlistNode *gnode, *cnode, *bnode; - GList *iter; - - g_return_if_fail(account != NULL); - - /* - * Disable the account before blowing it out of the water. - * Conceptually it probably makes more sense to disable the - * account for all UIs rather than the just the current UI, - * but it doesn't really matter. - */ - purple_account_set_enabled(account, purple_core_get_ui(), FALSE); - - purple_notify_close_with_handle(account); - purple_request_close_with_handle(account); - - purple_accounts_remove(account); - - /* Remove this account's buddies */ - for (gnode = purple_blist_get_root(); - gnode != NULL; - gnode = purple_blist_node_get_sibling_next(gnode)) - { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - - cnode = purple_blist_node_get_first_child(gnode); - while (cnode) { - PurpleBlistNode *cnode_next = purple_blist_node_get_sibling_next(cnode); - - if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { - bnode = purple_blist_node_get_first_child(cnode); - while (bnode) { - PurpleBlistNode *bnode_next = purple_blist_node_get_sibling_next(bnode); - - if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { - PurpleBuddy *b = (PurpleBuddy *)bnode; - - if (purple_buddy_get_account(b) == account) - purple_blist_remove_buddy(b); - } - bnode = bnode_next; - } - } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { - PurpleChat *c = (PurpleChat *)cnode; - - if (purple_chat_get_account(c) == account) - purple_blist_remove_chat(c); - } - cnode = cnode_next; - } - } - - /* Remove any open conversation for this account */ - for (iter = purple_get_conversations(); iter; ) { - PurpleConversation *conv = iter->data; - iter = iter->next; - if (purple_conversation_get_account(conv) == account) - purple_conversation_destroy(conv); - } - - /* Remove this account's pounces */ - purple_pounce_destroy_all_by_account(account); - - /* This will cause the deletion of an old buddy icon. */ - purple_buddy_icons_set_account_icon(account, NULL, 0); - - purple_account_destroy(account); -} - -void -purple_accounts_reorder(PurpleAccount *account, gint new_index) -{ - gint index; - GList *l; - - g_return_if_fail(account != NULL); - g_return_if_fail(new_index <= g_list_length(accounts)); - - index = g_list_index(accounts, account); - - if (index == -1) { - purple_debug_error("account", - "Unregistered account (%s) discovered during reorder!\n", - purple_account_get_username(account)); - return; - } - - l = g_list_nth(accounts, index); - - if (new_index > index) - new_index--; - - /* Remove the old one. */ - accounts = g_list_delete_link(accounts, l); - - /* Insert it where it should go. */ - accounts = g_list_insert(accounts, account, new_index); - - schedule_accounts_save(); -} - -GList * -purple_accounts_get_all(void) -{ - return accounts; -} - -GList * -purple_accounts_get_all_active(void) -{ - GList *list = NULL; - GList *all = purple_accounts_get_all(); - - while (all != NULL) { - PurpleAccount *account = all->data; - - if (purple_account_get_enabled(account, purple_core_get_ui())) - list = g_list_append(list, account); - - all = all->next; - } - - return list; -} - -PurpleAccount * -purple_accounts_find(const char *name, const char *protocol_id) -{ - PurpleAccount *account = NULL; - GList *l; - char *who; - - g_return_val_if_fail(name != NULL, NULL); - - for (l = purple_accounts_get_all(); l != NULL; l = l->next) { - account = (PurpleAccount *)l->data; - if (protocol_id && !purple_strequal(account->protocol_id, protocol_id)) - continue; - - who = g_strdup(purple_normalize(account, name)); - if (purple_strequal(purple_normalize(account, purple_account_get_username(account)), who)) { - g_free(who); - return account; - } - g_free(who); - } - - return NULL; -} - -void -purple_accounts_restore_current_statuses() -{ - GList *l; - PurpleAccount *account; - - /* If we're not connected to the Internet right now, we bail on this */ - if (!purple_network_is_available()) - { - purple_debug_warning("account", "Network not connected; skipping reconnect\n"); - return; - } - - for (l = purple_accounts_get_all(); l != NULL; l = l->next) - { - account = (PurpleAccount *)l->data; - if (purple_account_get_enabled(account, purple_core_get_ui()) && - (purple_presence_is_online(account->presence))) - { - purple_account_connect(account); - } - } -} - -void -purple_accounts_set_ui_ops(PurpleAccountUiOps *ops) -{ - account_ui_ops = ops; -} - -PurpleAccountUiOps * -purple_accounts_get_ui_ops(void) -{ - return account_ui_ops; -} - -void * -purple_accounts_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_accounts_init(void) -{ - void *handle = purple_accounts_get_handle(); - void *conn_handle = purple_connections_get_handle(); - - purple_signal_register(handle, "account-connecting", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-disabled", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-enabled", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-setting-info", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "account-set-info", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "account-created", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-destroying", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-added", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-removed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-status-changed", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_STATUS), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_STATUS)); - - purple_signal_register(handle, "account-actions-changed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT)); - - purple_signal_register(handle, "account-alias-changed", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "account-authorization-requested", - purple_marshal_INT__POINTER_POINTER, - purple_value_new(PURPLE_TYPE_INT), 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "account-authorization-denied", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "account-authorization-granted", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "account-error-changed", - purple_marshal_VOID__POINTER_POINTER_POINTER, - NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_POINTER), - purple_value_new(PURPLE_TYPE_POINTER)); - - purple_signal_connect(conn_handle, "signed-on", handle, - PURPLE_CALLBACK(signed_on_cb), NULL); - purple_signal_connect(conn_handle, "connection-error", handle, - PURPLE_CALLBACK(connection_error_cb), NULL); - - load_accounts(); - -} - -void -purple_accounts_uninit(void) -{ - gpointer handle = purple_accounts_get_handle(); - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_accounts(); - } - - for (; accounts; accounts = g_list_delete_link(accounts, accounts)) - purple_account_destroy(accounts->data); - - purple_signals_disconnect_by_handle(handle); - purple_signals_unregister_by_instance(handle); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/account.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1065 +0,0 @@ -/** - * @file account.h Account API - * @ingroup core - * @see @ref account-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_ACCOUNT_H_ -#define _PURPLE_ACCOUNT_H_ - -#include -#include - -/** @copydoc _PurpleAccountUiOps */ -typedef struct _PurpleAccountUiOps PurpleAccountUiOps; -/** @copydoc _PurpleAccount */ -typedef struct _PurpleAccount PurpleAccount; - -typedef gboolean (*PurpleFilterAccountFunc)(PurpleAccount *account); -typedef void (*PurpleAccountRequestAuthorizationCb)(void *); -typedef void (*PurpleAccountRegistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data); -typedef void (*PurpleAccountUnregistrationCb)(PurpleAccount *account, gboolean succeeded, void *user_data); - -#include "connection.h" -#include "log.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "status.h" - -/** - * Account request types. - */ -typedef enum -{ - PURPLE_ACCOUNT_REQUEST_AUTHORIZATION = 0 /* Account authorization request */ -} PurpleAccountRequestType; - - -/** Account UI operations, used to notify the user of status changes and when - * buddies add this account to their buddy lists. - */ -struct _PurpleAccountUiOps -{ - /** A buddy who is already on this account's buddy list added this account - * to their buddy list. - */ - void (*notify_added)(PurpleAccount *account, - const char *remote_user, - const char *id, - const char *alias, - const char *message); - - /** This account's status changed. */ - void (*status_changed)(PurpleAccount *account, - PurpleStatus *status); - - /** Someone we don't have on our list added us; prompt to add them. */ - void (*request_add)(PurpleAccount *account, - const char *remote_user, - const char *id, - const char *alias, - const char *message); - - /** Prompt for authorization when someone adds this account to their buddy - * list. To authorize them to see this account's presence, call \a - * authorize_cb (\a user_data); otherwise call \a deny_cb (\a user_data); - * @return a UI-specific handle, as passed to #close_account_request. - */ - void *(*request_authorize)(PurpleAccount *account, - const char *remote_user, - const char *id, - const char *alias, - const char *message, - gboolean on_list, - PurpleAccountRequestAuthorizationCb authorize_cb, - PurpleAccountRequestAuthorizationCb deny_cb, - void *user_data); - - /** Close a pending request for authorization. \a ui_handle is a handle - * as returned by #request_authorize. - */ - void (*close_account_request)(void *ui_handle); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** Structure representing an account. - */ -struct _PurpleAccount -{ - char *username; /**< The username. */ - char *alias; /**< How you appear to yourself. */ - char *password; /**< The account password. */ - char *user_info; /**< User information. */ - - char *buddy_icon_path; /**< The buddy icon's non-cached path. */ - - gboolean remember_pass; /**< Remember the password. */ - - char *protocol_id; /**< The ID of the protocol. */ - - PurpleConnection *gc; /**< The connection handle. */ - gboolean disconnecting; /**< The account is currently disconnecting */ - - GHashTable *settings; /**< Protocol-specific settings. */ - GHashTable *ui_settings; /**< UI-specific settings. */ - - PurpleProxyInfo *proxy_info; /**< Proxy information. This will be set */ - /* to NULL when the account inherits */ - /* proxy settings from global prefs. */ - - /* - * TODO: Supplementing the next two linked lists with hash tables - * should help performance a lot when these lists are long. This - * matters quite a bit for protocols like MSN, where all your - * buddies are added to your permit list. Currently we have to - * iterate through the entire list if we want to check if someone - * is permitted or denied. We should do this for 3.0.0. - */ - GSList *permit; /**< Permit list. */ - GSList *deny; /**< Deny list. */ - PurplePrivacyType perm_deny; /**< The permit/deny setting. */ - - GList *status_types; /**< Status types. */ - - PurplePresence *presence; /**< Presence. */ - PurpleLog *system_log; /**< The system log */ - - void *ui_data; /**< The UI can put data here. */ - PurpleAccountRegistrationCb registration_cb; - void *registration_cb_user_data; - - gpointer priv; /**< Pointer to opaque private data. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Account API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new account. - * - * @param username The username. - * @param protocol_id The protocol ID. - * - * @return The new account. - */ -PurpleAccount *purple_account_new(const char *username, const char *protocol_id); - -/** - * Destroys an account. - * - * @param account The account to destroy. - */ -void purple_account_destroy(PurpleAccount *account); - -/** - * Connects to an account. - * - * @param account The account to connect to. - */ -void purple_account_connect(PurpleAccount *account); - -/** - * Sets the callback for successful registration. - * - * @param account The account for which this callback should be used - * @param cb The callback - * @param user_data The user data passed to the callback - */ -void purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data); - -/** - * Registers an account. - * - * @param account The account to register. - */ -void purple_account_register(PurpleAccount *account); - -/** - * Unregisters an account (deleting it from the server). - * - * @param account The account to unregister. - * @param cb Optional callback to be called when unregistration is complete - * @param user_data user data to pass to the callback - */ -void purple_account_unregister(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data); - -/** - * Disconnects from an account. - * - * @param account The account to disconnect from. - */ -void purple_account_disconnect(PurpleAccount *account); - -/** - * Notifies the user that the account was added to a remote user's - * buddy list. - * - * This will present a dialog informing the user that he was added to the - * remote user's buddy list. - * - * @param account The account that was added. - * @param remote_user The name of the user that added this account. - * @param id The optional ID of the local account. Rarely used. - * @param alias The optional alias of the user. - * @param message The optional message sent from the user adding you. - */ -void purple_account_notify_added(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, - const char *message); - -/** - * Notifies the user that the account was addded to a remote user's buddy - * list and asks ther user if they want to add the remote user to their buddy - * list. - * - * This will present a dialog informing the local user that the remote user - * added them to the remote user's buddy list and will ask if they want to add - * the remote user to the buddy list. - * - * @param account The account that was added. - * @param remote_user The name of the user that added this account. - * @param id The optional ID of the local account. Rarely used. - * @param alias The optional alias of the user. - * @param message The optional message sent from the user adding you. - */ -void purple_account_request_add(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, - const char *message); - -/** - * Notifies the user that a remote user has wants to add the local user - * to his or her buddy list and requires authorization to do so. - * - * This will present a dialog informing the user of this and ask if the - * user authorizes or denies the remote user from adding him. - * - * @param account The account that was added - * @param remote_user The name of the user that added this account. - * @param id The optional ID of the local account. Rarely used. - * @param alias The optional alias of the remote user. - * @param message The optional message sent by the user wanting to add you. - * @param on_list Is the remote user already on the buddy list? - * @param auth_cb The callback called when the local user accepts - * @param deny_cb The callback called when the local user rejects - * @param user_data Data to be passed back to the above callbacks - * - * @return A UI-specific handle. - */ -void *purple_account_request_authorization(PurpleAccount *account, const char *remote_user, - const char *id, const char *alias, const char *message, gboolean on_list, - PurpleAccountRequestAuthorizationCb auth_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data); - -/** - * Close account requests registered for the given PurpleAccount - * - * @param account The account for which requests should be closed - */ -void purple_account_request_close_with_account(PurpleAccount *account); - -/** - * Close the account request for the given ui handle - * - * @param ui_handle The ui specific handle for which requests should be closed - */ -void purple_account_request_close(void *ui_handle); - -/** - * Requests a password from the user for the account. Does not set the - * account password on success; do that in ok_cb if desired. - * - * @param account The account to request the password for. - * @param ok_cb The callback for the OK button. - * @param cancel_cb The callback for the cancel button. - * @param user_data User data to be passed into callbacks. - */ -void purple_account_request_password(PurpleAccount *account, GCallback ok_cb, - GCallback cancel_cb, void *user_data); - -/** - * Requests information from the user to change the account's password. - * - * @param account The account to change the password on. - */ -void purple_account_request_change_password(PurpleAccount *account); - -/** - * Requests information from the user to change the account's - * user information. - * - * @param account The account to change the user information on. - */ -void purple_account_request_change_user_info(PurpleAccount *account); - -/** - * Sets the account's username. - * - * @param account The account. - * @param username The username. - */ -void purple_account_set_username(PurpleAccount *account, const char *username); - -/** - * Sets the account's password. - * - * @param account The account. - * @param password The password. - */ -void purple_account_set_password(PurpleAccount *account, const char *password); - -/** - * Sets the account's alias. - * - * @param account The account. - * @param alias The alias. - */ -void purple_account_set_alias(PurpleAccount *account, const char *alias); - -/** - * Sets the account's user information - * - * @param account The account. - * @param user_info The user information. - */ -void purple_account_set_user_info(PurpleAccount *account, const char *user_info); - -/** - * Sets the account's buddy icon path. - * - * @param account The account. - * @param path The buddy icon non-cached path. - */ -void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path); - -/** - * Sets the account's protocol ID. - * - * @param account The account. - * @param protocol_id The protocol ID. - */ -void purple_account_set_protocol_id(PurpleAccount *account, - const char *protocol_id); - -/** - * Sets the account's connection. - * - * @param account The account. - * @param gc The connection. - */ -void purple_account_set_connection(PurpleAccount *account, PurpleConnection *gc); - -/** - * Sets whether or not this account should save its password. - * - * @param account The account. - * @param value @c TRUE if it should remember the password. - */ -void purple_account_set_remember_password(PurpleAccount *account, gboolean value); - -/** - * Sets whether or not this account should check for mail. - * - * @param account The account. - * @param value @c TRUE if it should check for mail. - */ -void purple_account_set_check_mail(PurpleAccount *account, gboolean value); - -/** - * Sets whether or not this account is enabled for the specified - * UI. - * - * @param account The account. - * @param ui The UI. - * @param value @c TRUE if it is enabled. - */ -void purple_account_set_enabled(PurpleAccount *account, const char *ui, - gboolean value); - -/** - * Sets the account's proxy information. - * - * @param account The account. - * @param info The proxy information. - */ -void purple_account_set_proxy_info(PurpleAccount *account, PurpleProxyInfo *info); - -/** - * Sets the account's status types. - * - * @param account The account. - * @param status_types The list of status types. - */ -void purple_account_set_status_types(PurpleAccount *account, GList *status_types); - -/** - * Variadic version of purple_account_set_status_list(); the variadic list - * replaces @a attrs, and should be NULL-terminated. - * - * @copydoc purple_account_set_status_list() - */ -void purple_account_set_status(PurpleAccount *account, const char *status_id, - gboolean active, ...) G_GNUC_NULL_TERMINATED; - - -/** - * Activates or deactivates a status. All changes to the statuses of - * an account go through this function or purple_account_set_status(). - * - * You can only deactivate an exclusive status by activating another exclusive - * status. So, if @a status_id is an exclusive status and @a active is @c - * FALSE, this function does nothing. - * - * @param account The account. - * @param status_id The ID of the status. - * @param active Whether @a status_id is to be activated (TRUE) or - * deactivated (FALSE). - * @param attrs A list of const char * attribute names followed by - * const char * attribute values for the status. - * (For example, one pair might be "message" followed - * by "hello, talk to me!".) - */ -void purple_account_set_status_list(PurpleAccount *account, - const char *status_id, gboolean active, GList *attrs); - -/** - * Clears all protocol-specific settings on an account. - * - * @param account The account. - */ -void purple_account_clear_settings(PurpleAccount *account); - -/** - * Removes an account-specific setting by name. - * - * @param account The account. - * @param setting The setting to remove. - * - * @since 2.6.0 - */ -void purple_account_remove_setting(PurpleAccount *account, const char *setting); - -/** - * Sets a protocol-specific integer setting for an account. - * - * @param account The account. - * @param name The name of the setting. - * @param value The setting's value. - */ -void purple_account_set_int(PurpleAccount *account, const char *name, int value); - -/** - * Sets a protocol-specific string setting for an account. - * - * @param account The account. - * @param name The name of the setting. - * @param value The setting's value. - */ -void purple_account_set_string(PurpleAccount *account, const char *name, - const char *value); - -/** - * Sets a protocol-specific boolean setting for an account. - * - * @param account The account. - * @param name The name of the setting. - * @param value The setting's value. - */ -void purple_account_set_bool(PurpleAccount *account, const char *name, - gboolean value); - -/** - * Sets a UI-specific integer setting for an account. - * - * @param account The account. - * @param ui The UI name. - * @param name The name of the setting. - * @param value The setting's value. - */ -void purple_account_set_ui_int(PurpleAccount *account, const char *ui, - const char *name, int value); - -/** - * Sets a UI-specific string setting for an account. - * - * @param account The account. - * @param ui The UI name. - * @param name The name of the setting. - * @param value The setting's value. - */ -void purple_account_set_ui_string(PurpleAccount *account, const char *ui, - const char *name, const char *value); - -/** - * Sets a UI-specific boolean setting for an account. - * - * @param account The account. - * @param ui The UI name. - * @param name The name of the setting. - * @param value The setting's value. - */ -void purple_account_set_ui_bool(PurpleAccount *account, const char *ui, - const char *name, gboolean value); - -/** - * Returns whether or not the account is connected. - * - * @param account The account. - * - * @return @c TRUE if connected, or @c FALSE otherwise. - */ -gboolean purple_account_is_connected(const PurpleAccount *account); - -/** - * Returns whether or not the account is connecting. - * - * @param account The account. - * - * @return @c TRUE if connecting, or @c FALSE otherwise. - */ -gboolean purple_account_is_connecting(const PurpleAccount *account); - -/** - * Returns whether or not the account is disconnected. - * - * @param account The account. - * - * @return @c TRUE if disconnected, or @c FALSE otherwise. - */ -gboolean purple_account_is_disconnected(const PurpleAccount *account); - -/** - * Returns the account's username. - * - * @param account The account. - * - * @return The username. - */ -const char *purple_account_get_username(const PurpleAccount *account); - -/** - * Returns the account's password. - * - * @param account The account. - * - * @return The password. - */ -const char *purple_account_get_password(const PurpleAccount *account); - -/** - * Returns the account's alias. - * - * @param account The account. - * - * @return The alias. - */ -const char *purple_account_get_alias(const PurpleAccount *account); - -/** - * Returns the account's user information. - * - * @param account The account. - * - * @return The user information. - */ -const char *purple_account_get_user_info(const PurpleAccount *account); - -/** - * Gets the account's buddy icon path. - * - * @param account The account. - * - * @return The buddy icon's non-cached path. - */ -const char *purple_account_get_buddy_icon_path(const PurpleAccount *account); - -/** - * Returns the account's protocol ID. - * - * @param account The account. - * - * @return The protocol ID. - */ -const char *purple_account_get_protocol_id(const PurpleAccount *account); - -/** - * Returns the account's protocol name. - * - * @param account The account. - * - * @return The protocol name. - */ -const char *purple_account_get_protocol_name(const PurpleAccount *account); - -/** - * Returns the account's connection. - * - * @param account The account. - * - * @return The connection. - */ -PurpleConnection *purple_account_get_connection(const PurpleAccount *account); - -/** - * Returns whether or not this account should save its password. - * - * @param account The account. - * - * @return @c TRUE if it should remember the password. - */ -gboolean purple_account_get_remember_password(const PurpleAccount *account); - -/** - * Returns whether or not this account should check for mail. - * - * @param account The account. - * - * @return @c TRUE if it should check for mail. - */ -gboolean purple_account_get_check_mail(const PurpleAccount *account); - -/** - * Returns whether or not this account is enabled for the - * specified UI. - * - * @param account The account. - * @param ui The UI. - * - * @return @c TRUE if it enabled on this UI. - */ -gboolean purple_account_get_enabled(const PurpleAccount *account, - const char *ui); - -/** - * Returns the account's proxy information. - * - * @param account The account. - * - * @return The proxy information. - */ -PurpleProxyInfo *purple_account_get_proxy_info(const PurpleAccount *account); - -/** - * Returns the active status for this account. This looks through - * the PurplePresence associated with this account and returns the - * PurpleStatus that has its active flag set to "TRUE." There can be - * only one active PurpleStatus in a PurplePresence. - * - * @param account The account. - * - * @return The active status. - */ -PurpleStatus *purple_account_get_active_status(const PurpleAccount *account); - -/** - * Returns the account status with the specified ID. - * - * Note that this works differently than purple_buddy_get_status() in that - * it will only return NULL if the status was not registered. - * - * @param account The account. - * @param status_id The status ID. - * - * @return The status, or NULL if it was never registered. - */ -PurpleStatus *purple_account_get_status(const PurpleAccount *account, - const char *status_id); - -/** - * Returns the account status type with the specified ID. - * - * @param account The account. - * @param id The ID of the status type to find. - * - * @return The status type if found, or NULL. - */ -PurpleStatusType *purple_account_get_status_type(const PurpleAccount *account, - const char *id); - -/** - * Returns the account status type with the specified primitive. - * Note: It is possible for an account to have more than one - * PurpleStatusType with the same primitive. In this case, the - * first PurpleStatusType is returned. - * - * @param account The account. - * @param primitive The type of the status type to find. - * - * @return The status if found, or NULL. - */ -PurpleStatusType *purple_account_get_status_type_with_primitive( - const PurpleAccount *account, - PurpleStatusPrimitive primitive); - -/** - * Returns the account's presence. - * - * @param account The account. - * - * @return The account's presence. - */ -PurplePresence *purple_account_get_presence(const PurpleAccount *account); - -/** - * Returns whether or not an account status is active. - * - * @param account The account. - * @param status_id The status ID. - * - * @return TRUE if active, or FALSE if not. - */ -gboolean purple_account_is_status_active(const PurpleAccount *account, - const char *status_id); - -/** - * Returns the account's status types. - * - * @param account The account. - * - * @constreturn The account's status types. - */ -GList *purple_account_get_status_types(const PurpleAccount *account); - -/** - * Returns a protocol-specific integer setting for an account. - * - * @param account The account. - * @param name The name of the setting. - * @param default_value The default value. - * - * @return The value. - */ -int purple_account_get_int(const PurpleAccount *account, const char *name, - int default_value); - -/** - * Returns a protocol-specific string setting for an account. - * - * @param account The account. - * @param name The name of the setting. - * @param default_value The default value. - * - * @return The value. - */ -const char *purple_account_get_string(const PurpleAccount *account, - const char *name, - const char *default_value); - -/** - * Returns a protocol-specific boolean setting for an account. - * - * @param account The account. - * @param name The name of the setting. - * @param default_value The default value. - * - * @return The value. - */ -gboolean purple_account_get_bool(const PurpleAccount *account, const char *name, - gboolean default_value); - -/** - * Returns a UI-specific integer setting for an account. - * - * @param account The account. - * @param ui The UI name. - * @param name The name of the setting. - * @param default_value The default value. - * - * @return The value. - */ -int purple_account_get_ui_int(const PurpleAccount *account, const char *ui, - const char *name, int default_value); - -/** - * Returns a UI-specific string setting for an account. - * - * @param account The account. - * @param ui The UI name. - * @param name The name of the setting. - * @param default_value The default value. - * - * @return The value. - */ -const char *purple_account_get_ui_string(const PurpleAccount *account, - const char *ui, const char *name, - const char *default_value); - -/** - * Returns a UI-specific boolean setting for an account. - * - * @param account The account. - * @param ui The UI name. - * @param name The name of the setting. - * @param default_value The default value. - * - * @return The value. - */ -gboolean purple_account_get_ui_bool(const PurpleAccount *account, const char *ui, - const char *name, gboolean default_value); - - -/** - * Returns the system log for an account. - * - * @param account The account. - * @param create Should it be created if it doesn't exist? - * - * @return The log. - * - * @note Callers should almost always pass @c FALSE for @a create. - * Passing @c TRUE could result in an existing log being reopened, - * if the log has already been closed, which not all loggers deal - * with appropriately. - */ -PurpleLog *purple_account_get_log(PurpleAccount *account, gboolean create); - -/** - * Frees the system log of an account - * - * @param account The account. - */ -void purple_account_destroy_log(PurpleAccount *account); - -/** - * Adds a buddy to the server-side buddy list for the specified account. - * - * @param account The account. - * @param buddy The buddy to add. - */ -void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy); -/** - * Adds a list of buddies to the server-side buddy list. - * - * @param account The account. - * @param buddies The list of PurpleBlistNodes representing the buddies to add. - */ -void purple_account_add_buddies(PurpleAccount *account, GList *buddies); - -/** - * Removes a buddy from the server-side buddy list. - * - * @param account The account. - * @param buddy The buddy to remove. - * @param group The group to remove the buddy from. - */ -void purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy, - PurpleGroup *group); - -/** - * Removes a list of buddies from the server-side buddy list. - * - * @note The lists buddies and groups are parallel lists. Be sure that node n of - * groups matches node n of buddies. - * - * @param account The account. - * @param buddies The list of buddies to remove. - * @param groups The list of groups to remove buddies from. Each node of this - * list should match the corresponding node of buddies. - */ -void purple_account_remove_buddies(PurpleAccount *account, GList *buddies, - GList *groups); - -/** - * Removes a group from the server-side buddy list. - * - * @param account The account. - * @param group The group to remove. - */ -void purple_account_remove_group(PurpleAccount *account, PurpleGroup *group); - -/** - * Changes the password on the specified account. - * - * @param account The account. - * @param orig_pw The old password. - * @param new_pw The new password. - */ -void purple_account_change_password(PurpleAccount *account, const char *orig_pw, - const char *new_pw); - -/** - * Whether the account supports sending offline messages to buddy. - * - * @param account The account - * @param buddy The buddy - */ -gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy); - -/** - * Get the error that caused the account to be disconnected, or @c NULL if the - * account is happily connected or disconnected without an error. - * - * @param account The account whose error should be retrieved. - * @constreturn The type of error and a human-readable description of the - * current error, or @c NULL if there is no current error. This - * pointer is guaranteed to remain valid until the @ref - * account-error-changed signal is emitted for @a account. - */ -const PurpleConnectionErrorInfo *purple_account_get_current_error(PurpleAccount *account); - -/** - * Clear an account's current error state, resetting it to @c NULL. - * - * @param account The account whose error state should be cleared. - */ -void purple_account_clear_current_error(PurpleAccount *account); - -/*@}*/ - -/**************************************************************************/ -/** @name Accounts API */ -/**************************************************************************/ -/*@{*/ - -/** - * Adds an account to the list of accounts. - * - * @param account The account. - */ -void purple_accounts_add(PurpleAccount *account); - -/** - * Removes an account from the list of accounts. - * - * @param account The account. - */ -void purple_accounts_remove(PurpleAccount *account); - -/** - * Deletes an account. - * - * This will remove any buddies from the buddy list that belong to this - * account, buddy pounces that belong to this account, and will also - * destroy @a account. - * - * @param account The account. - */ -void purple_accounts_delete(PurpleAccount *account); - -/** - * Reorders an account. - * - * @param account The account to reorder. - * @param new_index The new index for the account. - */ -void purple_accounts_reorder(PurpleAccount *account, gint new_index); - -/** - * Returns a list of all accounts. - * - * @constreturn A list of all accounts. - */ -GList *purple_accounts_get_all(void); - -/** - * Returns a list of all enabled accounts - * - * @return A list of all enabled accounts. The list is owned - * by the caller, and must be g_list_free()d to avoid - * leaking the nodes. - */ -GList *purple_accounts_get_all_active(void); - -/** - * Finds an account with the specified name and protocol id. - * - * @param name The account username. - * @param protocol The account protocol ID. - * - * @return The account, if found, or @c FALSE otherwise. - */ -PurpleAccount *purple_accounts_find(const char *name, const char *protocol); - -/** - * This is called by the core after all subsystems and what - * not have been initialized. It sets all enabled accounts - * to their startup status by signing them on, setting them - * away, etc. - * - * You probably shouldn't call this unless you really know - * what you're doing. - */ -void purple_accounts_restore_current_statuses(void); - -/*@}*/ - - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ -/** - * Sets the UI operations structure to be used for accounts. - * - * @param ops The UI operations structure. - */ -void purple_accounts_set_ui_ops(PurpleAccountUiOps *ops); - -/** - * Returns the UI operations structure used for accounts. - * - * @return The UI operations structure in use. - */ -PurpleAccountUiOps *purple_accounts_get_ui_ops(void); - -/*@}*/ - - -/**************************************************************************/ -/** @name Accounts Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the accounts subsystem handle. - * - * @return The accounts subsystem handle. - */ -void *purple_accounts_get_handle(void); - -/** - * Initializes the accounts subsystem. - */ -void purple_accounts_init(void); - -/** - * Uninitializes the accounts subsystem. - */ -void purple_accounts_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_ACCOUNT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,377 +0,0 @@ -/** - * @file accountopt.c Account Options API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "accountopt.h" -#include "util.h" - -PurpleAccountOption * -purple_account_option_new(PurplePrefType type, const char *text, - const char *pref_name) -{ - PurpleAccountOption *option; - - g_return_val_if_fail(type != PURPLE_PREF_NONE, NULL); - g_return_val_if_fail(text != NULL, NULL); - g_return_val_if_fail(pref_name != NULL, NULL); - - option = g_new0(PurpleAccountOption, 1); - - option->type = type; - option->text = g_strdup(text); - option->pref_name = g_strdup(pref_name); - - return option; -} - -PurpleAccountOption * -purple_account_option_bool_new(const char *text, const char *pref_name, - gboolean default_value) -{ - PurpleAccountOption *option; - - option = purple_account_option_new(PURPLE_PREF_BOOLEAN, text, pref_name); - - if (option == NULL) - return NULL; - - option->default_value.boolean = default_value; - - return option; -} - -PurpleAccountOption * -purple_account_option_int_new(const char *text, const char *pref_name, - int default_value) -{ - PurpleAccountOption *option; - - option = purple_account_option_new(PURPLE_PREF_INT, text, pref_name); - - if (option == NULL) - return NULL; - - option->default_value.integer = default_value; - - return option; -} - -PurpleAccountOption * -purple_account_option_string_new(const char *text, const char *pref_name, - const char *default_value) -{ - PurpleAccountOption *option; - - option = purple_account_option_new(PURPLE_PREF_STRING, text, pref_name); - - if (option == NULL) - return NULL; - - option->default_value.string = g_strdup(default_value); - - return option; -} - -PurpleAccountOption * -purple_account_option_list_new(const char *text, const char *pref_name, - GList *list) -{ - PurpleAccountOption *option; - - option = purple_account_option_new(PURPLE_PREF_STRING_LIST, text, pref_name); - - if (option == NULL) - return NULL; - - option->default_value.list = list; - - return option; -} - -static void -purple_account_option_list_free(gpointer data, gpointer user_data) -{ - PurpleKeyValuePair *kvp = data; - - g_free(kvp->value); - g_free(kvp->key); - g_free(kvp); -} - -void -purple_account_option_destroy(PurpleAccountOption *option) -{ - g_return_if_fail(option != NULL); - - g_free(option->text); - g_free(option->pref_name); - - if (option->type == PURPLE_PREF_STRING) - { - g_free(option->default_value.string); - } - else if (option->type == PURPLE_PREF_STRING_LIST) - { - if (option->default_value.list != NULL) - { - g_list_foreach(option->default_value.list, purple_account_option_list_free, NULL); - g_list_free(option->default_value.list); - } - } - - g_free(option); -} - -void -purple_account_option_set_default_bool(PurpleAccountOption *option, - gboolean value) -{ - g_return_if_fail(option != NULL); - g_return_if_fail(option->type == PURPLE_PREF_BOOLEAN); - - option->default_value.boolean = value; -} - -void -purple_account_option_set_default_int(PurpleAccountOption *option, int value) -{ - g_return_if_fail(option != NULL); - g_return_if_fail(option->type == PURPLE_PREF_INT); - - option->default_value.integer = value; -} - -void -purple_account_option_set_default_string(PurpleAccountOption *option, - const char *value) -{ - g_return_if_fail(option != NULL); - g_return_if_fail(option->type == PURPLE_PREF_STRING); - - g_free(option->default_value.string); - option->default_value.string = g_strdup(value); -} - -void -purple_account_option_set_masked(PurpleAccountOption *option, gboolean masked) -{ - g_return_if_fail(option != NULL); - g_return_if_fail(option->type == PURPLE_PREF_STRING); - - option->masked = masked; -} - - -void -purple_account_option_set_list(PurpleAccountOption *option, GList *values) -{ - g_return_if_fail(option != NULL); - g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST); - - if (option->default_value.list != NULL) - { - g_list_foreach(option->default_value.list, purple_account_option_list_free, NULL); - g_list_free(option->default_value.list); - } - - option->default_value.list = values; -} - -void -purple_account_option_add_list_item(PurpleAccountOption *option, - const char *key, const char *value) -{ - PurpleKeyValuePair *kvp; - - g_return_if_fail(option != NULL); - g_return_if_fail(key != NULL); - g_return_if_fail(value != NULL); - g_return_if_fail(option->type == PURPLE_PREF_STRING_LIST); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(key); - kvp->value = g_strdup(value); - - option->default_value.list = g_list_append(option->default_value.list, - kvp); -} - -PurplePrefType -purple_account_option_get_type(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, PURPLE_PREF_NONE); - - return option->type; -} - -const char * -purple_account_option_get_text(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, NULL); - - return option->text; -} - -const char * -purple_account_option_get_setting(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, NULL); - - return option->pref_name; -} - -gboolean -purple_account_option_get_default_bool(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, FALSE); - g_return_val_if_fail(option->type == PURPLE_PREF_BOOLEAN, FALSE); - - return option->default_value.boolean; -} - -int -purple_account_option_get_default_int(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, -1); - g_return_val_if_fail(option->type == PURPLE_PREF_INT, -1); - - return option->default_value.integer; -} - -const char * -purple_account_option_get_default_string(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, NULL); - g_return_val_if_fail(option->type == PURPLE_PREF_STRING, NULL); - - return option->default_value.string; -} - -const char * -purple_account_option_get_default_list_value(const PurpleAccountOption *option) -{ - PurpleKeyValuePair *kvp; - - g_return_val_if_fail(option != NULL, NULL); - g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL); - - if (option->default_value.list == NULL) - return NULL; - - kvp = option->default_value.list->data; - - return (kvp ? kvp->value : NULL); -} - -gboolean -purple_account_option_get_masked(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, FALSE); - g_return_val_if_fail(option->type == PURPLE_PREF_STRING, FALSE); - - return option->masked; -} - -GList * -purple_account_option_get_list(const PurpleAccountOption *option) -{ - g_return_val_if_fail(option != NULL, NULL); - g_return_val_if_fail(option->type == PURPLE_PREF_STRING_LIST, NULL); - - return option->default_value.list; -} - -/************************************************************************** - * Account User Split API - **************************************************************************/ -PurpleAccountUserSplit * -purple_account_user_split_new(const char *text, const char *default_value, - char sep) -{ - PurpleAccountUserSplit *split; - - g_return_val_if_fail(text != NULL, NULL); - g_return_val_if_fail(sep != 0, NULL); - - split = g_new0(PurpleAccountUserSplit, 1); - - split->text = g_strdup(text); - split->field_sep = sep; - split->default_value = g_strdup(default_value); - split->reverse = TRUE; - - return split; -} - -void -purple_account_user_split_destroy(PurpleAccountUserSplit *split) -{ - g_return_if_fail(split != NULL); - - g_free(split->text); - g_free(split->default_value); - g_free(split); -} - -const char * -purple_account_user_split_get_text(const PurpleAccountUserSplit *split) -{ - g_return_val_if_fail(split != NULL, NULL); - - return split->text; -} - -const char * -purple_account_user_split_get_default_value(const PurpleAccountUserSplit *split) -{ - g_return_val_if_fail(split != NULL, NULL); - - return split->default_value; -} - -char -purple_account_user_split_get_separator(const PurpleAccountUserSplit *split) -{ - g_return_val_if_fail(split != NULL, 0); - - return split->field_sep; -} - -gboolean -purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split) -{ - g_return_val_if_fail(split != NULL, FALSE); - - return split->reverse; -} - -void -purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse) -{ - g_return_if_fail(split != NULL); - - split->reverse = reverse; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/accountopt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ -/** - * @file accountopt.h Account Options API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_ACCOUNTOPT_H_ -#define _PURPLE_ACCOUNTOPT_H_ - -#include "prefs.h" - -/** - * An option for an account. - * - * This is set by protocol plugins, and appears in the account settings - * dialogs. - */ -typedef struct -{ - PurplePrefType type; /**< The type of value. */ - - char *text; /**< The text that will appear to the user. */ - char *pref_name; /**< The name of the associated preference. */ - - union - { - gboolean boolean; /**< The default boolean value. */ - int integer; /**< The default integer value. */ - char *string; /**< The default string value. */ - GList *list; /**< The default list value. */ - - } default_value; - - gboolean masked; /**< Whether the value entered should be - * obscured from view (for passwords and - * similar options) - */ -} PurpleAccountOption; - -/** - * A username split. - * - * This is used by some protocols to separate the fields of the username - * into more human-readable components. - */ -typedef struct -{ - char *text; /**< The text that will appear to the user. */ - char *default_value; /**< The default value. */ - char field_sep; /**< The field separator. */ - gboolean reverse; /**< TRUE if the separator should be found - starting a the end of the string, FALSE - otherwise */ - -} PurpleAccountUserSplit; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Account Option API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new account option. If you know what @a type will be in advance, - * consider using purple_account_option_bool_new(), - * purple_account_option_int_new(), purple_account_option_string_new() or - * purple_account_option_list_new() (as appropriate) instead. - * - * @param type The type of option. - * @param text The text of the option. - * @param pref_name The account preference name for the option. - * - * @return The account option. - */ -PurpleAccountOption *purple_account_option_new(PurplePrefType type, - const char *text, const char *pref_name); - -/** - * Creates a new boolean account option. - * - * @param text The text of the option. - * @param pref_name The account preference name for the option. - * @param default_value The default value. - * - * @return The account option. - */ -PurpleAccountOption *purple_account_option_bool_new(const char *text, - const char *pref_name, gboolean default_value); - -/** - * Creates a new integer account option. - * - * @param text The text of the option. - * @param pref_name The account preference name for the option. - * @param default_value The default value. - * - * @return The account option. - */ -PurpleAccountOption *purple_account_option_int_new(const char *text, - const char *pref_name, int default_value); - -/** - * Creates a new string account option. - * - * @param text The text of the option. - * @param pref_name The account preference name for the option. - * @param default_value The default value. - * - * @return The account option. - */ -PurpleAccountOption *purple_account_option_string_new(const char *text, - const char *pref_name, const char *default_value); - -/** - * Creates a new list account option. - * - * The list passed will be owned by the account option, and the - * strings inside will be freed automatically. - * - * The list is a list of #PurpleKeyValuePair items. The key is the label that - * should be displayed to the user, and the (const char *) value is - * the internal ID that should be passed to purple_account_set_string() to - * choose that value. - * - * @param text The text of the option. - * @param pref_name The account preference name for the option. - * @param list The key, value list. - * - * @return The account option. - */ -PurpleAccountOption *purple_account_option_list_new(const char *text, - const char *pref_name, GList *list); - -/** - * Destroys an account option. - * - * @param option The option to destroy. - */ -void purple_account_option_destroy(PurpleAccountOption *option); - -/** - * Sets the default boolean value for an account option. - * - * @param option The account option. - * @param value The default boolean value. - */ -void purple_account_option_set_default_bool(PurpleAccountOption *option, - gboolean value); - -/** - * Sets the default integer value for an account option. - * - * @param option The account option. - * @param value The default integer value. - */ -void purple_account_option_set_default_int(PurpleAccountOption *option, - int value); - -/** - * Sets the default string value for an account option. - * - * @param option The account option. - * @param value The default string value. - */ -void purple_account_option_set_default_string(PurpleAccountOption *option, - const char *value); - -/** - * Sets the masking for an account option. Setting this to %TRUE acts - * as a hint to the UI that the option's value should be obscured from - * view, like a password. - * - * @param option The account option. - * @param masked The masking. - */ -void -purple_account_option_set_masked(PurpleAccountOption *option, gboolean masked); - -/** - * Sets the list values for an account option. - * - * The list passed will be owned by the account option, and the - * strings inside will be freed automatically. - * - * The list is in key, value pairs. The key is the ID stored and used - * internally, and the value is the label displayed. - * - * @param option The account option. - * @param values The default list value. - */ -void purple_account_option_set_list(PurpleAccountOption *option, GList *values); - -/** - * Adds an item to a list account option. - * - * @param option The account option. - * @param key The key. - * @param value The value. - */ -void purple_account_option_add_list_item(PurpleAccountOption *option, - const char *key, const char *value); - -/** - * Returns the specified account option's type. - * - * @param option The account option. - * - * @return The account option's type. - */ -PurplePrefType purple_account_option_get_type(const PurpleAccountOption *option); - -/** - * Returns the text for an account option. - * - * @param option The account option. - * - * @return The account option's text. - */ -const char *purple_account_option_get_text(const PurpleAccountOption *option); - -/** - * Returns the name of an account option. This corresponds to the @c pref_name - * parameter supplied to purple_account_option_new() or one of the - * type-specific constructors. - * - * @param option The account option. - * - * @return The option's name. - */ -const char *purple_account_option_get_setting(const PurpleAccountOption *option); - -/** - * Returns the default boolean value for an account option. - * - * @param option The account option. - * - * @return The default boolean value. - */ -gboolean purple_account_option_get_default_bool(const PurpleAccountOption *option); - -/** - * Returns the default integer value for an account option. - * - * @param option The account option. - * - * @return The default integer value. - */ -int purple_account_option_get_default_int(const PurpleAccountOption *option); - -/** - * Returns the default string value for an account option. - * - * @param option The account option. - * - * @return The default string value. - */ -const char *purple_account_option_get_default_string( - const PurpleAccountOption *option); - -/** - * Returns the default string value for a list account option. - * - * @param option The account option. - * - * @return The default list string value. - */ -const char *purple_account_option_get_default_list_value( - const PurpleAccountOption *option); - -/** - * Returns whether an option's value should be masked from view, like a - * password. If so, the UI might display each character of the option - * as a '*' (for example). - * - * @param option The account option. - * - * @return %TRUE if the option's value should be obscured. - */ -gboolean -purple_account_option_get_masked(const PurpleAccountOption *option); - -/** - * Returns the list values for an account option. - * - * @param option The account option. - * - * @constreturn A list of #PurpleKeyValuePair, mapping the human-readable - * description of the value to the (const char *) that - * should be passed to purple_account_set_string() to set the - * option. - */ -GList *purple_account_option_get_list(const PurpleAccountOption *option); - -/*@}*/ - - -/**************************************************************************/ -/** @name Account User Split API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new account username split. - * - * @param text The text of the option. - * @param default_value The default value. - * @param sep The field separator. - * - * @return The new user split. - */ -PurpleAccountUserSplit *purple_account_user_split_new(const char *text, - const char *default_value, - char sep); - -/** - * Destroys an account username split. - * - * @param split The split to destroy. - */ -void purple_account_user_split_destroy(PurpleAccountUserSplit *split); - -/** - * Returns the text for an account username split. - * - * @param split The account username split. - * - * @return The account username split's text. - */ -const char *purple_account_user_split_get_text(const PurpleAccountUserSplit *split); - -/** - * Returns the default string value for an account split. - * - * @param split The account username split. - * - * @return The default string. - */ -const char *purple_account_user_split_get_default_value( - const PurpleAccountUserSplit *split); - -/** - * Returns the field separator for an account split. - * - * @param split The account username split. - * - * @return The field separator. - */ -char purple_account_user_split_get_separator(const PurpleAccountUserSplit *split); - -/** - * Returns the 'reverse' value for an account split. - * - * @param split The account username split. - * - * @return The 'reverse' value. - */ -gboolean purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split); - -/** - * Sets the 'reverse' value for an account split. - * - * @param split The account username split. - * @param reverse The 'reverse' value - */ -void purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_ACCOUNTOPT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3239 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#define _PURPLE_BLIST_C_ - -#include "internal.h" -#include "blist.h" -#include "conversation.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "privacy.h" -#include "prpl.h" -#include "server.h" -#include "signals.h" -#include "util.h" -#include "value.h" -#include "xmlnode.h" - -static PurpleBlistUiOps *blist_ui_ops = NULL; - -static PurpleBuddyList *purplebuddylist = NULL; - -/** - * A hash table used for efficient lookups of buddies by name. - * PurpleAccount* => GHashTable*, with the inner hash table being - * struct _purple_hbuddy => PurpleBuddy* - */ -static GHashTable *buddies_cache = NULL; - -/** - * A hash table used for efficient lookups of groups by name. - * UTF-8 collate-key => PurpleGroup*. - */ -static GHashTable *groups_cache = NULL; - -static guint save_timer = 0; -static gboolean blist_loaded = FALSE; - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static PurpleBlistNode *purple_blist_get_last_sibling(PurpleBlistNode *node) -{ - PurpleBlistNode *n = node; - if (!n) - return NULL; - while (n->next) - n = n->next; - return n; -} - -static PurpleBlistNode *purple_blist_get_last_child(PurpleBlistNode *node) -{ - if (!node) - return NULL; - return purple_blist_get_last_sibling(node->child); -} - -struct _list_account_buddies { - GSList *list; - PurpleAccount *account; -}; - -struct _purple_hbuddy { - char *name; - PurpleAccount *account; - PurpleBlistNode *group; -}; - -/* This function must not use purple_normalize */ -static guint _purple_blist_hbuddy_hash(struct _purple_hbuddy *hb) -{ - return g_str_hash(hb->name) ^ g_direct_hash(hb->group) ^ g_direct_hash(hb->account); -} - -/* This function must not use purple_normalize */ -static guint _purple_blist_hbuddy_equal(struct _purple_hbuddy *hb1, struct _purple_hbuddy *hb2) -{ - return (hb1->group == hb2->group && - hb1->account == hb2->account && - g_str_equal(hb1->name, hb2->name)); -} - -static void _purple_blist_hbuddy_free_key(struct _purple_hbuddy *hb) -{ - g_free(hb->name); - g_free(hb); -} - -static void -purple_blist_buddies_cache_add_account(PurpleAccount *account) -{ - GHashTable *account_buddies = g_hash_table_new_full((GHashFunc)_purple_blist_hbuddy_hash, - (GEqualFunc)_purple_blist_hbuddy_equal, - (GDestroyNotify)_purple_blist_hbuddy_free_key, NULL); - g_hash_table_insert(buddies_cache, account, account_buddies); -} - -static void -purple_blist_buddies_cache_remove_account(const PurpleAccount *account) -{ - g_hash_table_remove(buddies_cache, account); -} - - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static void -value_to_xmlnode(gpointer key, gpointer hvalue, gpointer user_data) -{ - const char *name; - PurpleValue *value; - xmlnode *node, *child; - char buf[21]; - - name = (const char *)key; - value = (PurpleValue *)hvalue; - node = (xmlnode *)user_data; - - g_return_if_fail(value != NULL); - - child = xmlnode_new_child(node, "setting"); - xmlnode_set_attrib(child, "name", name); - - if (purple_value_get_type(value) == PURPLE_TYPE_INT) { - xmlnode_set_attrib(child, "type", "int"); - g_snprintf(buf, sizeof(buf), "%d", purple_value_get_int(value)); - xmlnode_insert_data(child, buf, -1); - } - else if (purple_value_get_type(value) == PURPLE_TYPE_STRING) { - xmlnode_set_attrib(child, "type", "string"); - xmlnode_insert_data(child, purple_value_get_string(value), -1); - } - else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) { - xmlnode_set_attrib(child, "type", "bool"); - g_snprintf(buf, sizeof(buf), "%d", purple_value_get_boolean(value)); - xmlnode_insert_data(child, buf, -1); - } -} - -static void -chat_component_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *name; - const char *data; - xmlnode *node, *child; - - name = (const char *)key; - data = (const char *)value; - node = (xmlnode *)user_data; - - g_return_if_fail(data != NULL); - - child = xmlnode_new_child(node, "component"); - xmlnode_set_attrib(child, "name", name); - xmlnode_insert_data(child, data, -1); -} - -static xmlnode * -buddy_to_xmlnode(PurpleBlistNode *bnode) -{ - xmlnode *node, *child; - PurpleBuddy *buddy; - - buddy = (PurpleBuddy *)bnode; - - node = xmlnode_new("buddy"); - xmlnode_set_attrib(node, "account", purple_account_get_username(buddy->account)); - xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(buddy->account)); - - child = xmlnode_new_child(node, "name"); - xmlnode_insert_data(child, buddy->name, -1); - - if (buddy->alias != NULL) - { - child = xmlnode_new_child(node, "alias"); - xmlnode_insert_data(child, buddy->alias, -1); - } - - /* Write buddy settings */ - g_hash_table_foreach(buddy->node.settings, value_to_xmlnode, node); - - return node; -} - -static xmlnode * -contact_to_xmlnode(PurpleBlistNode *cnode) -{ - xmlnode *node, *child; - PurpleContact *contact; - PurpleBlistNode *bnode; - - contact = (PurpleContact *)cnode; - - node = xmlnode_new("contact"); - - if (contact->alias != NULL) - { - xmlnode_set_attrib(node, "alias", contact->alias); - } - - /* Write buddies */ - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - { - if (!PURPLE_BLIST_NODE_SHOULD_SAVE(bnode)) - continue; - if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - { - child = buddy_to_xmlnode(bnode); - xmlnode_insert_child(node, child); - } - } - - /* Write contact settings */ - g_hash_table_foreach(cnode->settings, value_to_xmlnode, node); - - return node; -} - -static xmlnode * -chat_to_xmlnode(PurpleBlistNode *cnode) -{ - xmlnode *node, *child; - PurpleChat *chat; - - chat = (PurpleChat *)cnode; - - node = xmlnode_new("chat"); - xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(chat->account)); - xmlnode_set_attrib(node, "account", purple_account_get_username(chat->account)); - - if (chat->alias != NULL) - { - child = xmlnode_new_child(node, "alias"); - xmlnode_insert_data(child, chat->alias, -1); - } - - /* Write chat components */ - g_hash_table_foreach(chat->components, chat_component_to_xmlnode, node); - - /* Write chat settings */ - g_hash_table_foreach(chat->node.settings, value_to_xmlnode, node); - - return node; -} - -static xmlnode * -group_to_xmlnode(PurpleBlistNode *gnode) -{ - xmlnode *node, *child; - PurpleGroup *group; - PurpleBlistNode *cnode; - - group = (PurpleGroup *)gnode; - - node = xmlnode_new("group"); - xmlnode_set_attrib(node, "name", group->name); - - /* Write settings */ - g_hash_table_foreach(group->node.settings, value_to_xmlnode, node); - - /* Write contacts and chats */ - for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) - { - if (!PURPLE_BLIST_NODE_SHOULD_SAVE(cnode)) - continue; - if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - { - child = contact_to_xmlnode(cnode); - xmlnode_insert_child(node, child); - } - else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) - { - child = chat_to_xmlnode(cnode); - xmlnode_insert_child(node, child); - } - } - - return node; -} - -static xmlnode * -accountprivacy_to_xmlnode(PurpleAccount *account) -{ - xmlnode *node, *child; - GSList *cur; - char buf[10]; - - node = xmlnode_new("account"); - xmlnode_set_attrib(node, "proto", purple_account_get_protocol_id(account)); - xmlnode_set_attrib(node, "name", purple_account_get_username(account)); - g_snprintf(buf, sizeof(buf), "%d", account->perm_deny); - xmlnode_set_attrib(node, "mode", buf); - - for (cur = account->permit; cur; cur = cur->next) - { - child = xmlnode_new_child(node, "permit"); - xmlnode_insert_data(child, cur->data, -1); - } - - for (cur = account->deny; cur; cur = cur->next) - { - child = xmlnode_new_child(node, "block"); - xmlnode_insert_data(child, cur->data, -1); - } - - return node; -} - -static xmlnode * -blist_to_xmlnode(void) -{ - xmlnode *node, *child, *grandchild; - PurpleBlistNode *gnode; - GList *cur; - - node = xmlnode_new("purple"); - xmlnode_set_attrib(node, "version", "1.0"); - - /* Write groups */ - child = xmlnode_new_child(node, "blist"); - for (gnode = purplebuddylist->root; gnode != NULL; gnode = gnode->next) - { - if (!PURPLE_BLIST_NODE_SHOULD_SAVE(gnode)) - continue; - if (PURPLE_BLIST_NODE_IS_GROUP(gnode)) - { - grandchild = group_to_xmlnode(gnode); - xmlnode_insert_child(child, grandchild); - } - } - - /* Write privacy settings */ - child = xmlnode_new_child(node, "privacy"); - for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) - { - grandchild = accountprivacy_to_xmlnode(cur->data); - xmlnode_insert_child(child, grandchild); - } - - return node; -} - -static void -purple_blist_sync(void) -{ - xmlnode *node; - char *data; - - if (!blist_loaded) - { - purple_debug_error("blist", "Attempted to save buddy list before it " - "was read!\n"); - return; - } - - node = blist_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("blist.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - purple_blist_sync(); - save_timer = 0; - return FALSE; -} - -static void -_purple_blist_schedule_save() -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - -static void -purple_blist_save_account(PurpleAccount *account) -{ -#if 1 - _purple_blist_schedule_save(); -#else - if (account != NULL) { - /* Save the buddies and privacy data for this account */ - } else { - /* Save all buddies and privacy data */ - } -#endif -} - -static void -purple_blist_save_node(PurpleBlistNode *node) -{ - _purple_blist_schedule_save(); -} - -void purple_blist_schedule_save() -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - /* Save everything */ - if (ops && ops->save_account) - ops->save_account(NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static void -parse_setting(PurpleBlistNode *node, xmlnode *setting) -{ - const char *name = xmlnode_get_attrib(setting, "name"); - const char *type = xmlnode_get_attrib(setting, "type"); - char *value = xmlnode_get_data(setting); - - if (!value) - return; - - if (!type || purple_strequal(type, "string")) - purple_blist_node_set_string(node, name, value); - else if (purple_strequal(type, "bool")) - purple_blist_node_set_bool(node, name, atoi(value)); - else if (purple_strequal(type, "int")) - purple_blist_node_set_int(node, name, atoi(value)); - - g_free(value); -} - -static void -parse_buddy(PurpleGroup *group, PurpleContact *contact, xmlnode *bnode) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - char *name = NULL, *alias = NULL; - const char *acct_name, *proto, *protocol; - xmlnode *x; - - acct_name = xmlnode_get_attrib(bnode, "account"); - protocol = xmlnode_get_attrib(bnode, "protocol"); - protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ - proto = xmlnode_get_attrib(bnode, "proto"); - proto = _purple_oscar_convert(acct_name, proto); /* XXX: Remove */ - - if (!acct_name || (!proto && !protocol)) - return; - - account = purple_accounts_find(acct_name, proto ? proto : protocol); - - if (!account) - return; - - if ((x = xmlnode_get_child(bnode, "name"))) - name = xmlnode_get_data(x); - - if (!name) - return; - - if ((x = xmlnode_get_child(bnode, "alias"))) - alias = xmlnode_get_data(x); - - buddy = purple_buddy_new(account, name, alias); - purple_blist_add_buddy(buddy, contact, group, - purple_blist_get_last_child((PurpleBlistNode*)contact)); - - for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) { - parse_setting((PurpleBlistNode*)buddy, x); - } - - g_free(name); - g_free(alias); -} - -static void -parse_contact(PurpleGroup *group, xmlnode *cnode) -{ - PurpleContact *contact = purple_contact_new(); - xmlnode *x; - const char *alias; - - purple_blist_add_contact(contact, group, - purple_blist_get_last_child((PurpleBlistNode*)group)); - - if ((alias = xmlnode_get_attrib(cnode, "alias"))) { - purple_blist_alias_contact(contact, alias); - } - - for (x = cnode->child; x; x = x->next) { - if (x->type != XMLNODE_TYPE_TAG) - continue; - if (purple_strequal(x->name, "buddy")) - parse_buddy(group, contact, x); - else if (purple_strequal(x->name, "setting")) - parse_setting((PurpleBlistNode*)contact, x); - } - - /* if the contact is empty, don't keep it around. it causes problems */ - if (!((PurpleBlistNode*)contact)->child) - purple_blist_remove_contact(contact); -} - -static void -parse_chat(PurpleGroup *group, xmlnode *cnode) -{ - PurpleChat *chat; - PurpleAccount *account; - const char *acct_name, *proto, *protocol; - xmlnode *x; - char *alias = NULL; - GHashTable *components; - - acct_name = xmlnode_get_attrib(cnode, "account"); - protocol = xmlnode_get_attrib(cnode, "protocol"); - proto = xmlnode_get_attrib(cnode, "proto"); - - if (!acct_name || (!proto && !protocol)) - return; - - account = purple_accounts_find(acct_name, proto ? proto : protocol); - - if (!account) - return; - - if ((x = xmlnode_get_child(cnode, "alias"))) - alias = xmlnode_get_data(x); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - for (x = xmlnode_get_child(cnode, "component"); x; x = xmlnode_get_next_twin(x)) { - const char *name; - char *value; - - name = xmlnode_get_attrib(x, "name"); - value = xmlnode_get_data(x); - g_hash_table_replace(components, g_strdup(name), value); - } - - chat = purple_chat_new(account, alias, components); - purple_blist_add_chat(chat, group, - purple_blist_get_last_child((PurpleBlistNode*)group)); - - for (x = xmlnode_get_child(cnode, "setting"); x; x = xmlnode_get_next_twin(x)) { - parse_setting((PurpleBlistNode*)chat, x); - } - - g_free(alias); -} - -static void -parse_group(xmlnode *groupnode) -{ - const char *name = xmlnode_get_attrib(groupnode, "name"); - PurpleGroup *group; - xmlnode *cnode; - - if (!name) - name = _("Buddies"); - - group = purple_group_new(name); - purple_blist_add_group(group, - purple_blist_get_last_sibling(purplebuddylist->root)); - - for (cnode = groupnode->child; cnode; cnode = cnode->next) { - if (cnode->type != XMLNODE_TYPE_TAG) - continue; - if (purple_strequal(cnode->name, "setting")) - parse_setting((PurpleBlistNode*)group, cnode); - else if (purple_strequal(cnode->name, "contact") || - purple_strequal(cnode->name, "person")) - parse_contact(group, cnode); - else if (purple_strequal(cnode->name, "chat")) - parse_chat(group, cnode); - } -} - -/* TODO: Make static and rename to load_blist */ -void -purple_blist_load() -{ - xmlnode *purple, *blist, *privacy; - - blist_loaded = TRUE; - - purple = purple_util_read_xml_from_file("blist.xml", _("buddy list")); - - if (purple == NULL) - return; - - blist = xmlnode_get_child(purple, "blist"); - if (blist) { - xmlnode *groupnode; - for (groupnode = xmlnode_get_child(blist, "group"); groupnode != NULL; - groupnode = xmlnode_get_next_twin(groupnode)) { - parse_group(groupnode); - } - } - - privacy = xmlnode_get_child(purple, "privacy"); - if (privacy) { - xmlnode *anode; - for (anode = privacy->child; anode; anode = anode->next) { - xmlnode *x; - PurpleAccount *account; - int imode; - const char *acct_name, *proto, *mode, *protocol; - - acct_name = xmlnode_get_attrib(anode, "name"); - protocol = xmlnode_get_attrib(anode, "protocol"); - proto = xmlnode_get_attrib(anode, "proto"); - mode = xmlnode_get_attrib(anode, "mode"); - - if (!acct_name || (!proto && !protocol) || !mode) - continue; - - account = purple_accounts_find(acct_name, proto ? proto : protocol); - - if (!account) - continue; - - imode = atoi(mode); - account->perm_deny = (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL); - - for (x = anode->child; x; x = x->next) { - char *name; - if (x->type != XMLNODE_TYPE_TAG) - continue; - - if (purple_strequal(x->name, "permit")) { - name = xmlnode_get_data(x); - purple_privacy_permit_add(account, name, TRUE); - g_free(name); - } else if (purple_strequal(x->name, "block")) { - name = xmlnode_get_data(x); - purple_privacy_deny_add(account, name, TRUE); - g_free(name); - } - } - } - } - - xmlnode_free(purple); - - /* This tells the buddy icon code to do its thing. */ - _purple_buddy_icons_blist_loaded_cb(); -} - - -/********************************************************************* - * Stuff * - *********************************************************************/ - -static void -purple_contact_compute_priority_buddy(PurpleContact *contact) -{ - PurpleBlistNode *bnode; - PurpleBuddy *new_priority = NULL; - - g_return_if_fail(contact != NULL); - - contact->priority = NULL; - for (bnode = ((PurpleBlistNode*)contact)->child; - bnode != NULL; - bnode = bnode->next) - { - PurpleBuddy *buddy; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - - buddy = (PurpleBuddy*)bnode; - if (new_priority == NULL) - { - new_priority = buddy; - continue; - } - - if (purple_account_is_connected(buddy->account)) - { - int cmp = 1; - if (purple_account_is_connected(new_priority->account)) - cmp = purple_presence_compare(purple_buddy_get_presence(new_priority), - purple_buddy_get_presence(buddy)); - - if (cmp > 0 || (cmp == 0 && - purple_prefs_get_bool("/purple/contact/last_match"))) - { - new_priority = buddy; - } - } - } - - contact->priority = new_priority; - contact->priority_valid = TRUE; -} - - -/***************************************************************************** - * Public API functions * - *****************************************************************************/ - -PurpleBuddyList *purple_blist_new() -{ - PurpleBlistUiOps *ui_ops; - GList *account; - PurpleBuddyList *gbl = g_new0(PurpleBuddyList, 1); - PURPLE_DBUS_REGISTER_POINTER(gbl, PurpleBuddyList); - - ui_ops = purple_blist_get_ui_ops(); - - gbl->buddies = g_hash_table_new_full((GHashFunc)_purple_blist_hbuddy_hash, - (GEqualFunc)_purple_blist_hbuddy_equal, - (GDestroyNotify)_purple_blist_hbuddy_free_key, NULL); - - buddies_cache = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify)g_hash_table_destroy); - - groups_cache = g_hash_table_new_full((GHashFunc)g_str_hash, - (GEqualFunc)g_str_equal, - (GDestroyNotify)g_free, NULL); - - for (account = purple_accounts_get_all(); account != NULL; account = account->next) - { - purple_blist_buddies_cache_add_account(account->data); - } - - if (ui_ops != NULL && ui_ops->new_list != NULL) - ui_ops->new_list(gbl); - - return gbl; -} - -void -purple_set_blist(PurpleBuddyList *list) -{ - purplebuddylist = list; -} - -PurpleBuddyList * -purple_get_blist() -{ - return purplebuddylist; -} - -PurpleBlistNode * -purple_blist_get_root() -{ - return purplebuddylist ? purplebuddylist->root : NULL; -} - -static void -append_buddy(gpointer key, gpointer value, gpointer user_data) -{ - GSList **list = user_data; - *list = g_slist_prepend(*list, value); -} - -GSList * -purple_blist_get_buddies() -{ - GSList *buddies = NULL; - - if (!purplebuddylist) - return NULL; - - g_hash_table_foreach(purplebuddylist->buddies, append_buddy, &buddies); - return buddies; -} - -void * -purple_blist_get_ui_data() -{ - return purplebuddylist->ui_data; -} - -void -purple_blist_set_ui_data(void *ui_data) -{ - purplebuddylist->ui_data = ui_data; -} - -void purple_blist_show() -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - if (ops && ops->show) - ops->show(purplebuddylist); -} - -void purple_blist_destroy() -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - purple_debug(PURPLE_DEBUG_INFO, "blist", "Destroying\n"); - - if (ops && ops->destroy) - ops->destroy(purplebuddylist); -} - -void purple_blist_set_visible(gboolean show) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - if (ops && ops->set_visible) - ops->set_visible(purplebuddylist, show); -} - -static PurpleBlistNode *get_next_node(PurpleBlistNode *node, gboolean godeep) -{ - if (node == NULL) - return NULL; - - if (godeep && node->child) - return node->child; - - if (node->next) - return node->next; - - return get_next_node(node->parent, FALSE); -} - -PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline) -{ - PurpleBlistNode *ret = node; - - if (offline) - return get_next_node(ret, TRUE); - do - { - ret = get_next_node(ret, TRUE); - } while (ret && PURPLE_BLIST_NODE_IS_BUDDY(ret) && - !purple_account_is_connected(purple_buddy_get_account((PurpleBuddy *)ret))); - - return ret; -} - -PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node) -{ - return node ? node->parent : NULL; -} - -PurpleBlistNode *purple_blist_node_get_first_child(PurpleBlistNode *node) -{ - return node ? node->child : NULL; -} - -PurpleBlistNode *purple_blist_node_get_sibling_next(PurpleBlistNode *node) -{ - return node? node->next : NULL; -} - -PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node) -{ - return node? node->prev : NULL; -} - -void * -purple_blist_node_get_ui_data(const PurpleBlistNode *node) -{ - g_return_val_if_fail(node, NULL); - - return node->ui_data; -} - -void -purple_blist_node_set_ui_data(PurpleBlistNode *node, void *ui_data) { - g_return_if_fail(node); - - node->ui_data = ui_data; -} - -void -purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_status) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurplePresence *presence; - PurpleStatus *status; - PurpleBlistNode *cnode; - - g_return_if_fail(buddy != NULL); - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - purple_debug_info("blist", "Updating buddy status for %s (%s)\n", - buddy->name, purple_account_get_protocol_name(buddy->account)); - - if (purple_status_is_online(status) && - !purple_status_is_online(old_status)) { - - purple_signal_emit(purple_blist_get_handle(), "buddy-signed-on", buddy); - - cnode = buddy->node.parent; - if (++(PURPLE_CONTACT(cnode)->online) == 1) - PURPLE_GROUP(cnode->parent)->online++; - } else if (!purple_status_is_online(status) && - purple_status_is_online(old_status)) { - - purple_blist_node_set_int(&buddy->node, "last_seen", time(NULL)); - purple_signal_emit(purple_blist_get_handle(), "buddy-signed-off", buddy); - - cnode = buddy->node.parent; - if (--(PURPLE_CONTACT(cnode)->online) == 0) - PURPLE_GROUP(cnode->parent)->online--; - } else { - purple_signal_emit(purple_blist_get_handle(), - "buddy-status-changed", buddy, old_status, - status); - } - - /* - * This function used to only call the following two functions if one of - * the above signals had been triggered, but that's not good, because - * if someone's away message changes and they don't go from away to back - * to away then no signal is triggered. - * - * It's a safe assumption that SOMETHING called this function. PROBABLY - * because something, somewhere changed. Calling the stuff below - * certainly won't hurt anything. Unless you're on a K6-2 300. - */ - purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)buddy); -} - -void -purple_blist_update_node_icon(PurpleBlistNode *node) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - g_return_if_fail(node != NULL); - - if (ops && ops->update) - ops->update(purplebuddylist, node); -} - -void -purple_blist_update_buddy_icon(PurpleBuddy *buddy) -{ - purple_blist_update_node_icon((PurpleBlistNode *)buddy); -} - -/* - * TODO: Maybe remove the call to this from server.c and call it - * from oscar.c and toc.c instead? - */ -void purple_blist_rename_buddy(PurpleBuddy *buddy, const char *name) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - struct _purple_hbuddy *hb, *hb2; - GHashTable *account_buddies; - - g_return_if_fail(buddy != NULL); - - hb = g_new(struct _purple_hbuddy, 1); - hb->name = (gchar *)purple_normalize(buddy->account, buddy->name); - hb->account = buddy->account; - hb->group = ((PurpleBlistNode *)buddy)->parent->parent; - g_hash_table_remove(purplebuddylist->buddies, hb); - - account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); - g_hash_table_remove(account_buddies, hb); - - hb->name = g_strdup(purple_normalize(buddy->account, name)); - g_hash_table_replace(purplebuddylist->buddies, hb, buddy); - - hb2 = g_new(struct _purple_hbuddy, 1); - hb2->name = g_strdup(hb->name); - hb2->account = buddy->account; - hb2->group = ((PurpleBlistNode *)buddy)->parent->parent; - - g_hash_table_replace(account_buddies, hb2, buddy); - - g_free(buddy->name); - buddy->name = g_strdup(name); - - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode *) buddy); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)buddy); -} - -static gboolean -purple_strings_are_different(const char *one, const char *two) -{ - return !((one && two && g_utf8_collate(one, two) == 0) || - ((one == NULL || *one == '\0') && (two == NULL || *two == '\0'))); -} - -void purple_blist_alias_contact(PurpleContact *contact, const char *alias) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleConversation *conv; - PurpleBlistNode *bnode; - char *old_alias; - char *new_alias = NULL; - - g_return_if_fail(contact != NULL); - - if ((alias != NULL) && (*alias != '\0')) - new_alias = purple_utf8_strip_unprintables(alias); - - if (!purple_strings_are_different(contact->alias, new_alias)) { - g_free(new_alias); - return; - } - - old_alias = contact->alias; - - if ((new_alias != NULL) && (*new_alias != '\0')) - contact->alias = new_alias; - else { - contact->alias = NULL; - g_free(new_alias); /* could be "\0" */ - } - - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode*) contact); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)contact); - - for(bnode = ((PurpleBlistNode *)contact)->child; bnode != NULL; bnode = bnode->next) - { - PurpleBuddy *buddy = (PurpleBuddy *)bnode; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, - buddy->account); - if (conv) - purple_conversation_autoset_title(conv); - } - - purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", - contact, old_alias); - g_free(old_alias); -} - -void purple_blist_alias_chat(PurpleChat *chat, const char *alias) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - char *old_alias; - char *new_alias = NULL; - - g_return_if_fail(chat != NULL); - - if ((alias != NULL) && (*alias != '\0')) - new_alias = purple_utf8_strip_unprintables(alias); - - if (!purple_strings_are_different(chat->alias, new_alias)) { - g_free(new_alias); - return; - } - - old_alias = chat->alias; - - if ((new_alias != NULL) && (*new_alias != '\0')) - chat->alias = new_alias; - else { - chat->alias = NULL; - g_free(new_alias); /* could be "\0" */ - } - - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode*) chat); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)chat); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", - chat, old_alias); - g_free(old_alias); -} - -void purple_blist_alias_buddy(PurpleBuddy *buddy, const char *alias) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleConversation *conv; - char *old_alias; - char *new_alias = NULL; - - g_return_if_fail(buddy != NULL); - - if ((alias != NULL) && (*alias != '\0')) - new_alias = purple_utf8_strip_unprintables(alias); - - if (!purple_strings_are_different(buddy->alias, new_alias)) { - g_free(new_alias); - return; - } - - old_alias = buddy->alias; - - if ((new_alias != NULL) && (*new_alias != '\0')) - buddy->alias = new_alias; - else { - buddy->alias = NULL; - g_free(new_alias); /* could be "\0" */ - } - - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode*) buddy); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)buddy); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, - buddy->account); - if (conv) - purple_conversation_autoset_title(conv); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", - buddy, old_alias); - g_free(old_alias); -} - -void purple_blist_server_alias_buddy(PurpleBuddy *buddy, const char *alias) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleConversation *conv; - char *old_alias; - char *new_alias = NULL; - - g_return_if_fail(buddy != NULL); - - if ((alias != NULL) && (*alias != '\0') && g_utf8_validate(alias, -1, NULL)) - new_alias = purple_utf8_strip_unprintables(alias); - - if (!purple_strings_are_different(buddy->server_alias, new_alias)) { - g_free(new_alias); - return; - } - - old_alias = buddy->server_alias; - - if ((new_alias != NULL) && (*new_alias != '\0')) - buddy->server_alias = new_alias; - else { - buddy->server_alias = NULL; - g_free(new_alias); /* could be "\0"; */ - } - - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode*) buddy); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)buddy); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, - buddy->account); - if (conv) - purple_conversation_autoset_title(conv); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", - buddy, old_alias); - g_free(old_alias); -} - -/* - * TODO: If merging, prompt the user if they want to merge. - */ -void purple_blist_rename_group(PurpleGroup *source, const char *name) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleGroup *dest; - gchar *old_name; - gchar *new_name; - GList *moved_buddies = NULL; - GSList *accts; - - g_return_if_fail(source != NULL); - g_return_if_fail(name != NULL); - - new_name = purple_utf8_strip_unprintables(name); - - if (*new_name == '\0' || purple_strequal(new_name, source->name)) { - g_free(new_name); - return; - } - - dest = purple_find_group(new_name); - if (dest != NULL && purple_utf8_strcasecmp(source->name, dest->name) != 0) { - /* We're merging two groups */ - PurpleBlistNode *prev, *child, *next; - - prev = purple_blist_get_last_child((PurpleBlistNode*)dest); - child = ((PurpleBlistNode*)source)->child; - - /* - * TODO: This seems like a dumb way to do this... why not just - * append all children from the old group to the end of the new - * one? PRPLs might be expecting to receive an add_buddy() for - * each moved buddy... - */ - while (child) - { - next = child->next; - if (PURPLE_BLIST_NODE_IS_CONTACT(child)) { - PurpleBlistNode *bnode; - purple_blist_add_contact((PurpleContact *)child, dest, prev); - for (bnode = child->child; bnode != NULL; bnode = bnode->next) { - purple_blist_add_buddy((PurpleBuddy *)bnode, (PurpleContact *)child, - NULL, bnode->prev); - moved_buddies = g_list_append(moved_buddies, bnode); - } - prev = child; - } else if (PURPLE_BLIST_NODE_IS_CHAT(child)) { - purple_blist_add_chat((PurpleChat *)child, dest, prev); - prev = child; - } else { - purple_debug(PURPLE_DEBUG_ERROR, "blist", - "Unknown child type in group %s\n", source->name); - } - child = next; - } - - /* Make a copy of the old group name and then delete the old group */ - old_name = g_strdup(source->name); - purple_blist_remove_group(source); - source = dest; - g_free(new_name); - } else { - /* A simple rename */ - PurpleBlistNode *cnode, *bnode; - gchar* key; - - /* Build a GList of all buddies in this group */ - for (cnode = ((PurpleBlistNode *)source)->child; cnode != NULL; cnode = cnode->next) { - if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - moved_buddies = g_list_append(moved_buddies, bnode); - } - - old_name = source->name; - source->name = new_name; - - key = g_utf8_collate_key(old_name, -1); - g_hash_table_remove(groups_cache, key); - g_free(key); - - key = g_utf8_collate_key(new_name, -1); - g_hash_table_insert(groups_cache, key, source); - } - - /* Save our changes */ - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode*) source); - - /* Update the UI */ - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode*)source); - - /* Notify all PRPLs */ - /* TODO: Is this condition needed? Seems like it would always be TRUE */ - if(old_name && !purple_strequal(source->name, old_name)) { - for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) { - PurpleAccount *account = accts->data; - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - GList *l = NULL, *buddies = NULL; - - gc = purple_account_get_connection(account); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(gc && prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(!prpl_info) - continue; - - for(l = moved_buddies; l; l = l->next) { - PurpleBuddy *buddy = (PurpleBuddy *)l->data; - - if(buddy && buddy->account == account) - buddies = g_list_append(buddies, (PurpleBlistNode *)buddy); - } - - if(prpl_info->rename_group) { - prpl_info->rename_group(gc, old_name, source, buddies); - } else { - GList *cur, *groups = NULL; - - /* Make a list of what the groups each buddy is in */ - for(cur = buddies; cur; cur = cur->next) { - PurpleBlistNode *node = (PurpleBlistNode *)cur->data; - groups = g_list_prepend(groups, node->parent->parent); - } - - purple_account_remove_buddies(account, buddies, groups); - g_list_free(groups); - purple_account_add_buddies(account, buddies); - } - - g_list_free(buddies); - } - } - g_list_free(moved_buddies); - g_free(old_name); -} - -static void purple_blist_node_initialize_settings(PurpleBlistNode *node); - -PurpleChat *purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleChat *chat; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(components != NULL, NULL); - - chat = g_new0(PurpleChat, 1); - chat->account = account; - if ((alias != NULL) && (*alias != '\0')) - chat->alias = purple_utf8_strip_unprintables(alias); - chat->components = components; - purple_blist_node_initialize_settings((PurpleBlistNode *)chat); - ((PurpleBlistNode *)chat)->type = PURPLE_BLIST_CHAT_NODE; - - if (ops != NULL && ops->new_node != NULL) - ops->new_node((PurpleBlistNode *)chat); - - PURPLE_DBUS_REGISTER_POINTER(chat, PurpleChat); - return chat; -} - -void -purple_chat_destroy(PurpleChat *chat) -{ - g_hash_table_destroy(chat->components); - g_hash_table_destroy(chat->node.settings); - g_free(chat->alias); - PURPLE_DBUS_UNREGISTER_POINTER(chat); - g_free(chat); -} - -PurpleBuddy *purple_buddy_new(PurpleAccount *account, const char *name, const char *alias) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBuddy *buddy; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - buddy = g_new0(PurpleBuddy, 1); - buddy->account = account; - buddy->name = purple_utf8_strip_unprintables(name); - buddy->alias = purple_utf8_strip_unprintables(alias); - buddy->presence = purple_presence_new_for_buddy(buddy); - ((PurpleBlistNode *)buddy)->type = PURPLE_BLIST_BUDDY_NODE; - - purple_presence_set_status_active(buddy->presence, "offline", TRUE); - - purple_blist_node_initialize_settings((PurpleBlistNode *)buddy); - - if (ops && ops->new_node) - ops->new_node((PurpleBlistNode *)buddy); - - PURPLE_DBUS_REGISTER_POINTER(buddy, PurpleBuddy); - return buddy; -} - -void -purple_buddy_destroy(PurpleBuddy *buddy) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - /* - * Tell the owner PRPL that we're about to free the buddy so it - * can free proto_data - */ - prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); - if (prpl) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info && prpl_info->buddy_free) - prpl_info->buddy_free(buddy); - } - - /* Delete the node */ - purple_buddy_icon_unref(buddy->icon); - g_hash_table_destroy(buddy->node.settings); - purple_presence_destroy(buddy->presence); - g_free(buddy->name); - g_free(buddy->alias); - g_free(buddy->server_alias); - - PURPLE_DBUS_UNREGISTER_POINTER(buddy); - g_free(buddy); - - /* FIXME: Once PurpleBuddy is a GObject, timeout callbacks can - * g_object_ref() it when connecting the callback and - * g_object_unref() it in the handler. That way, it won't - * get freed while the timeout is pending and this line can - * be removed. */ - while (g_source_remove_by_user_data((gpointer *)buddy)); -} - -void -purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon) -{ - g_return_if_fail(buddy != NULL); - - if (buddy->icon != icon) - { - purple_buddy_icon_unref(buddy->icon); - buddy->icon = (icon != NULL ? purple_buddy_icon_ref(icon) : NULL); - } - - purple_signal_emit(purple_blist_get_handle(), "buddy-icon-changed", buddy); - - purple_blist_update_node_icon((PurpleBlistNode*)buddy); -} - -PurpleAccount * -purple_buddy_get_account(const PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - return buddy->account; -} - -const char * -purple_buddy_get_name(const PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - return buddy->name; -} - -PurpleBuddyIcon * -purple_buddy_get_icon(const PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - return buddy->icon; -} - -gpointer -purple_buddy_get_protocol_data(const PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - return buddy->proto_data; -} - -void -purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data) -{ - g_return_if_fail(buddy != NULL); - - buddy->proto_data = data; -} - - -void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node) -{ - PurpleBlistNode *cnode = (PurpleBlistNode*)chat; - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - g_return_if_fail(chat != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT((PurpleBlistNode *)chat)); - - if (node == NULL) { - if (group == NULL) - group = purple_group_new(_("Chats")); - - /* Add group to blist if isn't already on it. Fixes #2752. */ - if (!purple_find_group(group->name)) { - purple_blist_add_group(group, - purple_blist_get_last_sibling(purplebuddylist->root)); - } - } else { - group = (PurpleGroup*)node->parent; - } - - /* if we're moving to overtop of ourselves, do nothing */ - if (cnode == node) - return; - - if (cnode->parent) { - /* This chat was already in the list and is - * being moved. - */ - ((PurpleGroup *)cnode->parent)->totalsize--; - if (purple_account_is_connected(chat->account)) { - ((PurpleGroup *)cnode->parent)->online--; - ((PurpleGroup *)cnode->parent)->currentsize--; - } - if (cnode->next) - cnode->next->prev = cnode->prev; - if (cnode->prev) - cnode->prev->next = cnode->next; - if (cnode->parent->child == cnode) - cnode->parent->child = cnode->next; - - if (ops && ops->remove) - ops->remove(purplebuddylist, cnode); - /* ops->remove() cleaned up the cnode's ui_data, so we need to - * reinitialize it */ - if (ops && ops->new_node) - ops->new_node(cnode); - } - - if (node != NULL) { - if (node->next) - node->next->prev = cnode; - cnode->next = node->next; - cnode->prev = node; - cnode->parent = node->parent; - node->next = cnode; - ((PurpleGroup *)node->parent)->totalsize++; - if (purple_account_is_connected(chat->account)) { - ((PurpleGroup *)node->parent)->online++; - ((PurpleGroup *)node->parent)->currentsize++; - } - } else { - if (((PurpleBlistNode *)group)->child) - ((PurpleBlistNode *)group)->child->prev = cnode; - cnode->next = ((PurpleBlistNode *)group)->child; - cnode->prev = NULL; - ((PurpleBlistNode *)group)->child = cnode; - cnode->parent = (PurpleBlistNode *)group; - group->totalsize++; - if (purple_account_is_connected(chat->account)) { - group->online++; - group->currentsize++; - } - } - - if (ops && ops->save_node) - ops->save_node(cnode); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode *)cnode); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-added", - cnode); -} - -void purple_blist_add_buddy(PurpleBuddy *buddy, PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) -{ - PurpleBlistNode *cnode, *bnode; - PurpleGroup *g; - PurpleContact *c; - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - struct _purple_hbuddy *hb, *hb2; - GHashTable *account_buddies; - - g_return_if_fail(buddy != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY((PurpleBlistNode*)buddy)); - - bnode = (PurpleBlistNode *)buddy; - - /* if we're moving to overtop of ourselves, do nothing */ - if (bnode == node || (!node && bnode->parent && - contact && bnode->parent == (PurpleBlistNode*)contact - && bnode == bnode->parent->child)) - return; - - if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) { - c = (PurpleContact*)node->parent; - g = (PurpleGroup*)node->parent->parent; - } else if (contact) { - c = contact; - g = PURPLE_GROUP(PURPLE_BLIST_NODE(c)->parent); - } else { - g = group; - if (g == NULL) - g = purple_group_new(_("Buddies")); - /* Add group to blist if isn't already on it. Fixes #2752. */ - if (!purple_find_group(g->name)) { - purple_blist_add_group(g, - purple_blist_get_last_sibling(purplebuddylist->root)); - } - c = purple_contact_new(); - purple_blist_add_contact(c, g, - purple_blist_get_last_child((PurpleBlistNode*)g)); - } - - cnode = (PurpleBlistNode *)c; - - if (bnode->parent) { - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - ((PurpleContact*)bnode->parent)->online--; - if (((PurpleContact*)bnode->parent)->online == 0) - ((PurpleGroup*)bnode->parent->parent)->online--; - } - if (purple_account_is_connected(buddy->account)) { - ((PurpleContact*)bnode->parent)->currentsize--; - if (((PurpleContact*)bnode->parent)->currentsize == 0) - ((PurpleGroup*)bnode->parent->parent)->currentsize--; - } - ((PurpleContact*)bnode->parent)->totalsize--; - /* the group totalsize will be taken care of by remove_contact below */ - - if (bnode->parent->parent != (PurpleBlistNode*)g) - serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g); - - if (bnode->next) - bnode->next->prev = bnode->prev; - if (bnode->prev) - bnode->prev->next = bnode->next; - if (bnode->parent->child == bnode) - bnode->parent->child = bnode->next; - - if (ops && ops->remove) - ops->remove(purplebuddylist, bnode); - - if (bnode->parent->parent != (PurpleBlistNode*)g) { - struct _purple_hbuddy hb; - hb.name = (gchar *)purple_normalize(buddy->account, buddy->name); - hb.account = buddy->account; - hb.group = bnode->parent->parent; - g_hash_table_remove(purplebuddylist->buddies, &hb); - - account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); - g_hash_table_remove(account_buddies, &hb); - } - - if (!bnode->parent->child) { - purple_blist_remove_contact((PurpleContact*)bnode->parent); - } else { - purple_contact_invalidate_priority_buddy((PurpleContact*)bnode->parent); - if (ops && ops->update) - ops->update(purplebuddylist, bnode->parent); - } - } - - if (node && PURPLE_BLIST_NODE_IS_BUDDY(node)) { - if (node->next) - node->next->prev = bnode; - bnode->next = node->next; - bnode->prev = node; - bnode->parent = node->parent; - node->next = bnode; - } else { - if (cnode->child) - cnode->child->prev = bnode; - bnode->prev = NULL; - bnode->next = cnode->child; - cnode->child = bnode; - bnode->parent = cnode; - } - - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - if (++(PURPLE_CONTACT(bnode->parent)->online) == 1) - PURPLE_GROUP(bnode->parent->parent)->online++; - } - if (purple_account_is_connected(buddy->account)) { - if (++(PURPLE_CONTACT(bnode->parent)->currentsize) == 1) - PURPLE_GROUP(bnode->parent->parent)->currentsize++; - } - PURPLE_CONTACT(bnode->parent)->totalsize++; - - hb = g_new(struct _purple_hbuddy, 1); - hb->name = g_strdup(purple_normalize(buddy->account, buddy->name)); - hb->account = buddy->account; - hb->group = ((PurpleBlistNode*)buddy)->parent->parent; - - g_hash_table_replace(purplebuddylist->buddies, hb, buddy); - - account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); - - hb2 = g_new(struct _purple_hbuddy, 1); - hb2->name = g_strdup(hb->name); - hb2->account = buddy->account; - hb2->group = ((PurpleBlistNode*)buddy)->parent->parent; - - g_hash_table_replace(account_buddies, hb2, buddy); - - purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); - - if (ops && ops->save_node) - ops->save_node((PurpleBlistNode*) buddy); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode*)buddy); - - /* Signal that the buddy has been added */ - purple_signal_emit(purple_blist_get_handle(), "buddy-added", buddy); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-added", - PURPLE_BLIST_NODE(buddy)); -} - -PurpleContact *purple_contact_new() -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - - PurpleContact *contact = g_new0(PurpleContact, 1); - contact->totalsize = 0; - contact->currentsize = 0; - contact->online = 0; - purple_blist_node_initialize_settings((PurpleBlistNode *)contact); - ((PurpleBlistNode *)contact)->type = PURPLE_BLIST_CONTACT_NODE; - - if (ops && ops->new_node) - ops->new_node((PurpleBlistNode *)contact); - - PURPLE_DBUS_REGISTER_POINTER(contact, PurpleContact); - return contact; -} - -void -purple_contact_destroy(PurpleContact *contact) -{ - g_hash_table_destroy(contact->node.settings); - g_free(contact->alias); - PURPLE_DBUS_UNREGISTER_POINTER(contact); - g_free(contact); -} - -void purple_contact_set_alias(PurpleContact *contact, const char *alias) -{ - purple_blist_alias_contact(contact,alias); -} - -const char *purple_contact_get_alias(PurpleContact* contact) -{ - g_return_val_if_fail(contact != NULL, NULL); - - if (contact->alias) - return contact->alias; - - return purple_buddy_get_alias(purple_contact_get_priority_buddy(contact)); -} - -gboolean purple_contact_on_account(PurpleContact *c, PurpleAccount *account) -{ - PurpleBlistNode *bnode, *cnode = (PurpleBlistNode *) c; - - g_return_val_if_fail(c != NULL, FALSE); - g_return_val_if_fail(account != NULL, FALSE); - - for (bnode = cnode->child; bnode; bnode = bnode->next) { - PurpleBuddy *buddy; - - if (! PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - - buddy = (PurpleBuddy *)bnode; - if (buddy->account == account) - return TRUE; - } - return FALSE; -} - -void purple_contact_invalidate_priority_buddy(PurpleContact *contact) -{ - g_return_if_fail(contact != NULL); - - contact->priority_valid = FALSE; -} - -PurpleGroup *purple_group_new(const char *name) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleGroup *group; - - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(*name != '\0', NULL); - - group = purple_find_group(name); - if (group != NULL) - return group; - - group = g_new0(PurpleGroup, 1); - group->name = purple_utf8_strip_unprintables(name); - group->totalsize = 0; - group->currentsize = 0; - group->online = 0; - purple_blist_node_initialize_settings((PurpleBlistNode *)group); - ((PurpleBlistNode *)group)->type = PURPLE_BLIST_GROUP_NODE; - - if (ops && ops->new_node) - ops->new_node((PurpleBlistNode *)group); - - PURPLE_DBUS_REGISTER_POINTER(group, PurpleGroup); - return group; -} - -void -purple_group_destroy(PurpleGroup *group) -{ - g_hash_table_destroy(group->node.settings); - g_free(group->name); - PURPLE_DBUS_UNREGISTER_POINTER(group); - g_free(group); -} - -void purple_blist_add_contact(PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleGroup *g; - PurpleBlistNode *gnode, *cnode, *bnode; - - g_return_if_fail(contact != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT((PurpleBlistNode*)contact)); - - if (PURPLE_BLIST_NODE(contact) == node) - return; - - if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || - PURPLE_BLIST_NODE_IS_CHAT(node))) - g = (PurpleGroup*)node->parent; - else if (group) - g = group; - else { - g = purple_find_group(_("Buddies")); - if (g == NULL) { - g = purple_group_new(_("Buddies")); - purple_blist_add_group(g, - purple_blist_get_last_sibling(purplebuddylist->root)); - } - } - - gnode = (PurpleBlistNode*)g; - cnode = (PurpleBlistNode*)contact; - - if (cnode->parent) { - if (cnode->parent->child == cnode) - cnode->parent->child = cnode->next; - if (cnode->prev) - cnode->prev->next = cnode->next; - if (cnode->next) - cnode->next->prev = cnode->prev; - - if (cnode->parent != gnode) { - bnode = cnode->child; - while (bnode) { - PurpleBlistNode *next_bnode = bnode->next; - PurpleBuddy *b = (PurpleBuddy*)bnode; - GHashTable *account_buddies; - - struct _purple_hbuddy *hb, *hb2; - - hb = g_new(struct _purple_hbuddy, 1); - hb->name = g_strdup(purple_normalize(b->account, b->name)); - hb->account = b->account; - hb->group = cnode->parent; - - g_hash_table_remove(purplebuddylist->buddies, hb); - - account_buddies = g_hash_table_lookup(buddies_cache, b->account); - g_hash_table_remove(account_buddies, hb); - - if (!purple_find_buddy_in_group(b->account, b->name, g)) { - hb->group = gnode; - g_hash_table_replace(purplebuddylist->buddies, hb, b); - - hb2 = g_new(struct _purple_hbuddy, 1); - hb2->name = g_strdup(hb->name); - hb2->account = b->account; - hb2->group = gnode; - - g_hash_table_replace(account_buddies, hb2, b); - - if (purple_account_get_connection(b->account)) - serv_move_buddy(b, (PurpleGroup *)cnode->parent, g); - } else { - gboolean empty_contact = FALSE; - - /* this buddy already exists in the group, so we're - * gonna delete it instead */ - g_free(hb->name); - g_free(hb); - if (purple_account_get_connection(b->account)) - purple_account_remove_buddy(b->account, b, (PurpleGroup *)cnode->parent); - - if (!cnode->child->next) - empty_contact = TRUE; - purple_blist_remove_buddy(b); - - /** in purple_blist_remove_buddy(), if the last buddy in a - * contact is removed, the contact is cleaned up and - * g_free'd, so we mustn't try to reference bnode->next */ - if (empty_contact) - return; - } - bnode = next_bnode; - } - } - - if (contact->online > 0) - ((PurpleGroup*)cnode->parent)->online--; - if (contact->currentsize > 0) - ((PurpleGroup*)cnode->parent)->currentsize--; - ((PurpleGroup*)cnode->parent)->totalsize--; - - if (ops && ops->remove) - ops->remove(purplebuddylist, cnode); - - if (ops && ops->remove_node) - ops->remove_node(cnode); - } - - if (node && (PURPLE_BLIST_NODE_IS_CONTACT(node) || - PURPLE_BLIST_NODE_IS_CHAT(node))) { - if (node->next) - node->next->prev = cnode; - cnode->next = node->next; - cnode->prev = node; - cnode->parent = node->parent; - node->next = cnode; - } else { - if (gnode->child) - gnode->child->prev = cnode; - cnode->prev = NULL; - cnode->next = gnode->child; - gnode->child = cnode; - cnode->parent = gnode; - } - - if (contact->online > 0) - g->online++; - if (contact->currentsize > 0) - g->currentsize++; - g->totalsize++; - - if (ops && ops->save_node) - { - if (cnode->child) - ops->save_node(cnode); - for (bnode = cnode->child; bnode; bnode = bnode->next) - ops->save_node(bnode); - } - - if (ops && ops->update) - { - if (cnode->child) - ops->update(purplebuddylist, cnode); - - for (bnode = cnode->child; bnode; bnode = bnode->next) - ops->update(purplebuddylist, bnode); - } -} - -void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node) -{ - PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; - PurpleBlistNode *prev, *cur, *next; - PurpleContact *target; - - g_return_if_fail(source != NULL); - g_return_if_fail(node != NULL); - - if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - target = (PurpleContact *)node; - prev = purple_blist_get_last_child(node); - } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - target = (PurpleContact *)node->parent; - prev = node; - } else { - return; - } - - if (source == target || !target) - return; - - next = sourcenode->child; - - while (next) { - cur = next; - next = cur->next; - if (PURPLE_BLIST_NODE_IS_BUDDY(cur)) { - purple_blist_add_buddy((PurpleBuddy *)cur, target, NULL, prev); - prev = cur; - } - } -} - -void purple_blist_add_group(PurpleGroup *group, PurpleBlistNode *node) -{ - PurpleBlistUiOps *ops; - PurpleBlistNode *gnode = (PurpleBlistNode*)group; - gchar* key; - - g_return_if_fail(group != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP((PurpleBlistNode *)group)); - - ops = purple_blist_get_ui_ops(); - - /* if we're moving to overtop of ourselves, do nothing */ - if (gnode == node) { - if (!purplebuddylist->root) - node = NULL; - else - return; - } - - if (purple_find_group(group->name)) { - /* This is just being moved */ - - if (ops && ops->remove) - ops->remove(purplebuddylist, (PurpleBlistNode *)group); - - if (gnode == purplebuddylist->root) - purplebuddylist->root = gnode->next; - if (gnode->prev) - gnode->prev->next = gnode->next; - if (gnode->next) - gnode->next->prev = gnode->prev; - } else { - key = g_utf8_collate_key(group->name, -1); - g_hash_table_insert(groups_cache, key, group); - } - - if (node && PURPLE_BLIST_NODE_IS_GROUP(node)) { - gnode->next = node->next; - gnode->prev = node; - if (node->next) - node->next->prev = gnode; - node->next = gnode; - } else { - if (purplebuddylist->root) - purplebuddylist->root->prev = gnode; - gnode->next = purplebuddylist->root; - gnode->prev = NULL; - purplebuddylist->root = gnode; - } - - if (ops && ops->save_node) { - ops->save_node(gnode); - for (node = gnode->child; node; node = node->next) - ops->save_node(node); - } - - if (ops && ops->update) { - ops->update(purplebuddylist, gnode); - for (node = gnode->child; node; node = node->next) - ops->update(purplebuddylist, node); - } - - purple_signal_emit(purple_blist_get_handle(), "blist-node-added", - gnode); -} - -void purple_blist_remove_contact(PurpleContact *contact) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBlistNode *node, *gnode; - - g_return_if_fail(contact != NULL); - - node = (PurpleBlistNode *)contact; - gnode = node->parent; - - if (node->child) { - /* - * If this contact has children then remove them. When the last - * buddy is removed from the contact, the contact is automatically - * deleted. - */ - while (node->child->next) { - purple_blist_remove_buddy((PurpleBuddy*)node->child); - } - /* - * Remove the last buddy and trigger the deletion of the contact. - * It would probably be cleaner if contact-deletion was done after - * a timeout? Or if it had to be done manually, like below? - */ - purple_blist_remove_buddy((PurpleBuddy*)node->child); - } else { - /* Remove the node from its parent */ - if (gnode->child == node) - gnode->child = node->next; - if (node->prev) - node->prev->next = node->next; - if (node->next) - node->next->prev = node->prev; - - /* Update the UI */ - if (ops && ops->remove) - ops->remove(purplebuddylist, node); - - if (ops && ops->remove_node) - ops->remove_node(node); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", - PURPLE_BLIST_NODE(contact)); - - /* Delete the node */ - purple_contact_destroy(contact); - } -} - -void purple_blist_remove_buddy(PurpleBuddy *buddy) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBlistNode *node, *cnode, *gnode; - PurpleContact *contact; - PurpleGroup *group; - struct _purple_hbuddy hb; - GHashTable *account_buddies; - - g_return_if_fail(buddy != NULL); - - node = (PurpleBlistNode *)buddy; - cnode = node->parent; - gnode = (cnode != NULL) ? cnode->parent : NULL; - contact = (PurpleContact *)cnode; - group = (PurpleGroup *)gnode; - - /* Remove the node from its parent */ - if (node->prev) - node->prev->next = node->next; - if (node->next) - node->next->prev = node->prev; - if ((cnode != NULL) && (cnode->child == node)) - cnode->child = node->next; - - /* Adjust size counts */ - if (contact != NULL) { - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - contact->online--; - if (contact->online == 0) - group->online--; - } - if (purple_account_is_connected(buddy->account)) { - contact->currentsize--; - if (contact->currentsize == 0) - group->currentsize--; - } - contact->totalsize--; - - /* Re-sort the contact */ - if (cnode->child && contact->priority == buddy) { - purple_contact_invalidate_priority_buddy(contact); - if (ops && ops->update) - ops->update(purplebuddylist, cnode); - } - } - - /* Remove this buddy from the buddies hash table */ - hb.name = (gchar *)purple_normalize(buddy->account, buddy->name); - hb.account = buddy->account; - hb.group = gnode; - g_hash_table_remove(purplebuddylist->buddies, &hb); - - account_buddies = g_hash_table_lookup(buddies_cache, buddy->account); - g_hash_table_remove(account_buddies, &hb); - - /* Update the UI */ - if (ops && ops->remove) - ops->remove(purplebuddylist, node); - - if (ops && ops->remove_node) - ops->remove_node(node); - - /* Signal that the buddy has been removed before freeing the memory for it */ - purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", - PURPLE_BLIST_NODE(buddy)); - - purple_buddy_destroy(buddy); - - /* If the contact is empty then remove it */ - if ((contact != NULL) && !cnode->child) - purple_blist_remove_contact(contact); -} - -void purple_blist_remove_chat(PurpleChat *chat) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBlistNode *node, *gnode; - PurpleGroup *group; - - g_return_if_fail(chat != NULL); - - node = (PurpleBlistNode *)chat; - gnode = node->parent; - group = (PurpleGroup *)gnode; - - if (gnode != NULL) - { - /* Remove the node from its parent */ - if (gnode->child == node) - gnode->child = node->next; - if (node->prev) - node->prev->next = node->next; - if (node->next) - node->next->prev = node->prev; - - /* Adjust size counts */ - if (purple_account_is_connected(chat->account)) { - group->online--; - group->currentsize--; - } - group->totalsize--; - - } - - /* Update the UI */ - if (ops && ops->remove) - ops->remove(purplebuddylist, node); - - if (ops && ops->remove_node) - ops->remove_node(node); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", - PURPLE_BLIST_NODE(chat)); - - /* Delete the node */ - purple_chat_destroy(chat); -} - -void purple_blist_remove_group(PurpleGroup *group) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBlistNode *node; - GList *l; - gchar* key; - - g_return_if_fail(group != NULL); - - node = (PurpleBlistNode *)group; - - /* Make sure the group is empty */ - if (node->child) - return; - - /* Remove the node from its parent */ - if (purplebuddylist->root == node) - purplebuddylist->root = node->next; - if (node->prev) - node->prev->next = node->next; - if (node->next) - node->next->prev = node->prev; - - key = g_utf8_collate_key(group->name, -1); - g_hash_table_remove(groups_cache, key); - g_free(key); - - /* Update the UI */ - if (ops && ops->remove) - ops->remove(purplebuddylist, node); - - if (ops && ops->remove_node) - ops->remove_node(node); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-removed", - PURPLE_BLIST_NODE(group)); - - /* Remove the group from all accounts that are online */ - for (l = purple_connections_get_all(); l != NULL; l = l->next) - { - PurpleConnection *gc = (PurpleConnection *)l->data; - - if (purple_connection_get_state(gc) == PURPLE_CONNECTED) - purple_account_remove_group(purple_connection_get_account(gc), group); - } - - /* Delete the node */ - purple_group_destroy(group); -} - -PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact) -{ - g_return_val_if_fail(contact != NULL, NULL); - - if (!contact->priority_valid) - purple_contact_compute_priority_buddy(contact); - - return contact->priority; -} - -const char *purple_buddy_get_alias_only(PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - if ((buddy->alias != NULL) && (*buddy->alias != '\0')) { - return buddy->alias; - } else if ((buddy->server_alias != NULL) && - (*buddy->server_alias != '\0')) { - - return buddy->server_alias; - } - - return NULL; -} - - -const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy) -{ - PurpleContact *c; - - g_return_val_if_fail(buddy != NULL, NULL); - - /* Search for an alias for the buddy. In order of precedence: */ - /* The buddy alias */ - if (buddy->alias != NULL) - return buddy->alias; - - /* The contact alias */ - c = purple_buddy_get_contact(buddy); - if ((c != NULL) && (c->alias != NULL)) - return c->alias; - - /* The server alias */ - if ((buddy->server_alias) && (*buddy->server_alias)) - return buddy->server_alias; - - /* The buddy's user name (i.e. no alias) */ - return buddy->name; -} - - -const char *purple_buddy_get_alias(PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - /* Search for an alias for the buddy. In order of precedence: */ - /* The buddy alias */ - if (buddy->alias != NULL) - return buddy->alias; - - /* The server alias */ - if ((buddy->server_alias) && (*buddy->server_alias)) - return buddy->server_alias; - - /* The buddy's user name (i.e. no alias) */ - return buddy->name; -} - -const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy, NULL); - return buddy->alias; -} - -const char *purple_buddy_get_server_alias(PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - if ((buddy->server_alias) && (*buddy->server_alias)) - return buddy->server_alias; - - return NULL; -} - -const char *purple_buddy_get_local_alias(PurpleBuddy *buddy) -{ - PurpleContact *c; - - g_return_val_if_fail(buddy != NULL, NULL); - - /* Search for an alias for the buddy. In order of precedence: */ - /* The buddy alias */ - if (buddy->alias != NULL) - return buddy->alias; - - /* The contact alias */ - c = purple_buddy_get_contact(buddy); - if ((c != NULL) && (c->alias != NULL)) - return c->alias; - - /* The buddy's user name (i.e. no alias) */ - return buddy->name; -} - -const char *purple_chat_get_name(PurpleChat *chat) -{ - char *ret = NULL; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info = NULL; - - g_return_val_if_fail(chat != NULL, NULL); - - if ((chat->alias != NULL) && (*chat->alias != '\0')) - return chat->alias; - - prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account)); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_info) { - struct proto_chat_entry *pce; - GList *parts = prpl_info->chat_info(purple_account_get_connection(chat->account)); - pce = parts->data; - ret = g_hash_table_lookup(chat->components, pce->identifier); - g_list_foreach(parts, (GFunc)g_free, NULL); - g_list_free(parts); - } - - return ret; -} - -PurpleBuddy *purple_find_buddy(PurpleAccount *account, const char *name) -{ - PurpleBuddy *buddy; - struct _purple_hbuddy hb; - PurpleBlistNode *group; - - g_return_val_if_fail(purplebuddylist != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); - - hb.account = account; - hb.name = (gchar *)purple_normalize(account, name); - - for (group = purplebuddylist->root; group; group = group->next) { - if (!group->child) - continue; - - hb.group = group; - if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb))) { - return buddy; - } - } - - return NULL; -} - -PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name, - PurpleGroup *group) -{ - struct _purple_hbuddy hb; - - g_return_val_if_fail(purplebuddylist != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); - - hb.name = (gchar *)purple_normalize(account, name); - hb.account = account; - hb.group = (PurpleBlistNode*)group; - - return g_hash_table_lookup(purplebuddylist->buddies, &hb); -} - -static void find_acct_buddies(gpointer key, gpointer value, gpointer data) -{ - PurpleBuddy *buddy = value; - GSList **list = data; - - *list = g_slist_prepend(*list, buddy); -} - -GSList *purple_find_buddies(PurpleAccount *account, const char *name) -{ - PurpleBuddy *buddy; - PurpleBlistNode *node; - GSList *ret = NULL; - - g_return_val_if_fail(purplebuddylist != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - if ((name != NULL) && (*name != '\0')) { - struct _purple_hbuddy hb; - - hb.name = (gchar *)purple_normalize(account, name); - hb.account = account; - - for (node = purplebuddylist->root; node != NULL; node = node->next) { - if (!node->child) - continue; - - hb.group = node; - if ((buddy = g_hash_table_lookup(purplebuddylist->buddies, &hb)) != NULL) - ret = g_slist_prepend(ret, buddy); - } - } else { - GSList *list = NULL; - GHashTable *buddies = g_hash_table_lookup(buddies_cache, account); - g_hash_table_foreach(buddies, find_acct_buddies, &list); - ret = list; - } - - return ret; -} - -PurpleGroup *purple_find_group(const char *name) -{ - gchar* key; - PurpleGroup *group; - - g_return_val_if_fail(purplebuddylist != NULL, NULL); - g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); - - key = g_utf8_collate_key(name, -1); - group = g_hash_table_lookup(groups_cache, key); - g_free(key); - - return group; -} - -PurpleChat * -purple_blist_find_chat(PurpleAccount *account, const char *name) -{ - char *chat_name; - PurpleChat *chat; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info = NULL; - struct proto_chat_entry *pce; - PurpleBlistNode *node, *group; - GList *parts; - char *normname; - - g_return_val_if_fail(purplebuddylist != NULL, NULL); - g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL); - - if (!purple_account_is_connected(account)) - return NULL; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->find_blist_chat != NULL) - return prpl_info->find_blist_chat(account, name); - - normname = g_strdup(purple_normalize(account, name)); - for (group = purplebuddylist->root; group != NULL; group = group->next) { - for (node = group->child; node != NULL; node = node->next) { - if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - - chat = (PurpleChat*)node; - - if (account != chat->account) - continue; - - parts = prpl_info->chat_info( - purple_account_get_connection(chat->account)); - - pce = parts->data; - chat_name = g_hash_table_lookup(chat->components, - pce->identifier); - g_list_foreach(parts, (GFunc)g_free, NULL); - g_list_free(parts); - - if (chat->account == account && chat_name != NULL && - normname != NULL && !strcmp(purple_normalize(account, chat_name), normname)) { - g_free(normname); - return chat; - } - } - } - } - - g_free(normname); - return NULL; -} - -PurpleGroup * -purple_chat_get_group(PurpleChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return (PurpleGroup *)(((PurpleBlistNode *)chat)->parent); -} - -PurpleAccount * -purple_chat_get_account(PurpleChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return chat->account; -} - -GHashTable * -purple_chat_get_components(PurpleChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return chat->components; -} - -PurpleContact *purple_buddy_get_contact(PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - return PURPLE_CONTACT(PURPLE_BLIST_NODE(buddy)->parent); -} - -PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - return buddy->presence; -} - -PurpleGroup *purple_buddy_get_group(PurpleBuddy *buddy) -{ - g_return_val_if_fail(buddy != NULL, NULL); - - if (((PurpleBlistNode *)buddy)->parent == NULL) - return NULL; - - return (PurpleGroup *)(((PurpleBlistNode*)buddy)->parent->parent); -} - -GSList *purple_group_get_accounts(PurpleGroup *group) -{ - GSList *l = NULL; - PurpleBlistNode *gnode, *cnode, *bnode; - - gnode = (PurpleBlistNode *)group; - - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { - if (!g_slist_find(l, ((PurpleChat *)cnode)->account)) - l = g_slist_append(l, ((PurpleChat *)cnode)->account); - } else if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { - for (bnode = cnode->child; bnode; bnode = bnode->next) { - if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) { - if (!g_slist_find(l, ((PurpleBuddy *)bnode)->account)) - l = g_slist_append(l, ((PurpleBuddy *)bnode)->account); - } - } - } - } - - return l; -} - -void purple_blist_add_account(PurpleAccount *account) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBlistNode *gnode, *cnode, *bnode; - - g_return_if_fail(purplebuddylist != NULL); - - if (!ops || !ops->update) - return; - - for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { - gboolean recompute = FALSE; - for (bnode = cnode->child; bnode; bnode = bnode->next) { - if (PURPLE_BLIST_NODE_IS_BUDDY(bnode) && - ((PurpleBuddy*)bnode)->account == account) { - recompute = TRUE; - ((PurpleContact*)cnode)->currentsize++; - if (((PurpleContact*)cnode)->currentsize == 1) - ((PurpleGroup*)gnode)->currentsize++; - ops->update(purplebuddylist, bnode); - } - } - if (recompute || - purple_blist_node_get_bool(cnode, "show_offline")) { - purple_contact_invalidate_priority_buddy((PurpleContact*)cnode); - ops->update(purplebuddylist, cnode); - } - } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode) && - ((PurpleChat*)cnode)->account == account) { - ((PurpleGroup *)gnode)->online++; - ((PurpleGroup *)gnode)->currentsize++; - ops->update(purplebuddylist, cnode); - } - } - ops->update(purplebuddylist, gnode); - } -} - -void purple_blist_remove_account(PurpleAccount *account) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleBlistNode *gnode, *cnode, *bnode; - PurpleBuddy *buddy; - PurpleChat *chat; - PurpleContact *contact; - PurpleGroup *group; - GList *list = NULL, *iter = NULL; - - g_return_if_fail(purplebuddylist != NULL); - - for (gnode = purplebuddylist->root; gnode; gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - - group = (PurpleGroup *)gnode; - - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { - gboolean recompute = FALSE; - contact = (PurpleContact *)cnode; - - for (bnode = cnode->child; bnode; bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - - buddy = (PurpleBuddy *)bnode; - if (account == buddy->account) { - PurplePresence *presence; - - presence = purple_buddy_get_presence(buddy); - - if(purple_presence_is_online(presence)) { - contact->online--; - if (contact->online == 0) - group->online--; - - purple_blist_node_set_int(&buddy->node, - "last_seen", time(NULL)); - } - - contact->currentsize--; - if (contact->currentsize == 0) - group->currentsize--; - - if (!g_list_find(list, presence)) - list = g_list_prepend(list, presence); - - if (contact->priority == buddy) - purple_contact_invalidate_priority_buddy(contact); - else - recompute = TRUE; - - if (ops && ops->remove) { - ops->remove(purplebuddylist, bnode); - } - } - } - if (recompute) { - purple_contact_invalidate_priority_buddy(contact); - if (ops && ops->update) - ops->update(purplebuddylist, cnode); - } - } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { - chat = (PurpleChat *)cnode; - - if(chat->account == account) { - group->currentsize--; - group->online--; - - if (ops && ops->remove) - ops->remove(purplebuddylist, cnode); - } - } - } - } - - for (iter = list; iter; iter = iter->next) - { - purple_presence_set_status_active(iter->data, "offline", TRUE); - } - g_list_free(list); -} - -gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account) -{ - PurpleBlistNode *cnode; - for (cnode = ((PurpleBlistNode *)g)->child; cnode; cnode = cnode->next) { - if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) { - if(purple_contact_on_account((PurpleContact *) cnode, account)) - return TRUE; - } else if (PURPLE_BLIST_NODE_IS_CHAT(cnode)) { - PurpleChat *chat = (PurpleChat *)cnode; - if ((!account && purple_account_is_connected(chat->account)) - || chat->account == account) - return TRUE; - } - } - return FALSE; -} - -const char *purple_group_get_name(PurpleGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->name; -} - -void -purple_blist_request_add_buddy(PurpleAccount *account, const char *username, - const char *group, const char *alias) -{ - PurpleBlistUiOps *ui_ops; - - ui_ops = purple_blist_get_ui_ops(); - - if (ui_ops != NULL && ui_ops->request_add_buddy != NULL) - ui_ops->request_add_buddy(account, username, group, alias); -} - -void -purple_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, - const char *alias, const char *name) -{ - PurpleBlistUiOps *ui_ops; - - ui_ops = purple_blist_get_ui_ops(); - - if (ui_ops != NULL && ui_ops->request_add_chat != NULL) - ui_ops->request_add_chat(account, group, alias, name); -} - -void -purple_blist_request_add_group(void) -{ - PurpleBlistUiOps *ui_ops; - - ui_ops = purple_blist_get_ui_ops(); - - if (ui_ops != NULL && ui_ops->request_add_group != NULL) - ui_ops->request_add_group(); -} - -static void -purple_blist_node_destroy(PurpleBlistNode *node) -{ - PurpleBlistUiOps *ui_ops; - PurpleBlistNode *child, *next_child; - - ui_ops = purple_blist_get_ui_ops(); - child = node->child; - while (child) { - next_child = child->next; - purple_blist_node_destroy(child); - child = next_child; - } - - /* Allow the UI to free data */ - node->parent = NULL; - node->child = NULL; - node->next = NULL; - node->prev = NULL; - if (ui_ops && ui_ops->remove) - ui_ops->remove(purplebuddylist, node); - - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) - purple_buddy_destroy((PurpleBuddy*)node); - else if (PURPLE_BLIST_NODE_IS_CHAT(node)) - purple_chat_destroy((PurpleChat*)node); - else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) - purple_contact_destroy((PurpleContact*)node); - else if (PURPLE_BLIST_NODE_IS_GROUP(node)) - purple_group_destroy((PurpleGroup*)node); -} - -static void -purple_blist_node_setting_free(gpointer data) -{ - PurpleValue *value; - - value = (PurpleValue *)data; - - purple_value_destroy(value); -} - -static void purple_blist_node_initialize_settings(PurpleBlistNode *node) -{ - if (node->settings) - return; - - node->settings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)purple_blist_node_setting_free); -} - -void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key) -{ - PurpleBlistUiOps *ops; - g_return_if_fail(node != NULL); - g_return_if_fail(node->settings != NULL); - g_return_if_fail(key != NULL); - - g_hash_table_remove(node->settings, key); - - ops = purple_blist_get_ui_ops(); - if (ops && ops->save_node) - ops->save_node(node); -} - -void -purple_blist_node_set_flags(PurpleBlistNode *node, PurpleBlistNodeFlags flags) -{ - g_return_if_fail(node != NULL); - - node->flags = flags; -} - -PurpleBlistNodeFlags -purple_blist_node_get_flags(PurpleBlistNode *node) -{ - g_return_val_if_fail(node != NULL, 0); - - return node->flags; -} - -PurpleBlistNodeType -purple_blist_node_get_type(PurpleBlistNode *node) -{ - g_return_val_if_fail(node != NULL, PURPLE_BLIST_OTHER_NODE); - return node->type; -} - -void -purple_blist_node_set_bool(PurpleBlistNode* node, const char *key, gboolean data) -{ - PurpleValue *value; - PurpleBlistUiOps *ops; - - g_return_if_fail(node != NULL); - g_return_if_fail(node->settings != NULL); - g_return_if_fail(key != NULL); - - value = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(value, data); - - g_hash_table_replace(node->settings, g_strdup(key), value); - - ops = purple_blist_get_ui_ops(); - if (ops && ops->save_node) - ops->save_node(node); -} - -gboolean -purple_blist_node_get_bool(PurpleBlistNode* node, const char *key) -{ - PurpleValue *value; - - g_return_val_if_fail(node != NULL, FALSE); - g_return_val_if_fail(node->settings != NULL, FALSE); - g_return_val_if_fail(key != NULL, FALSE); - - value = g_hash_table_lookup(node->settings, key); - - if (value == NULL) - return FALSE; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN, FALSE); - - return purple_value_get_boolean(value); -} - -void -purple_blist_node_set_int(PurpleBlistNode* node, const char *key, int data) -{ - PurpleValue *value; - PurpleBlistUiOps *ops; - - g_return_if_fail(node != NULL); - g_return_if_fail(node->settings != NULL); - g_return_if_fail(key != NULL); - - value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(value, data); - - g_hash_table_replace(node->settings, g_strdup(key), value); - - ops = purple_blist_get_ui_ops(); - if (ops && ops->save_node) - ops->save_node(node); -} - -int -purple_blist_node_get_int(PurpleBlistNode* node, const char *key) -{ - PurpleValue *value; - - g_return_val_if_fail(node != NULL, 0); - g_return_val_if_fail(node->settings != NULL, 0); - g_return_val_if_fail(key != NULL, 0); - - value = g_hash_table_lookup(node->settings, key); - - if (value == NULL) - return 0; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_INT, 0); - - return purple_value_get_int(value); -} - -void -purple_blist_node_set_string(PurpleBlistNode* node, const char *key, const char *data) -{ - PurpleValue *value; - PurpleBlistUiOps *ops; - - g_return_if_fail(node != NULL); - g_return_if_fail(node->settings != NULL); - g_return_if_fail(key != NULL); - - value = purple_value_new(PURPLE_TYPE_STRING); - purple_value_set_string(value, data); - - g_hash_table_replace(node->settings, g_strdup(key), value); - - ops = purple_blist_get_ui_ops(); - if (ops && ops->save_node) - ops->save_node(node); -} - -const char * -purple_blist_node_get_string(PurpleBlistNode* node, const char *key) -{ - PurpleValue *value; - - g_return_val_if_fail(node != NULL, NULL); - g_return_val_if_fail(node->settings != NULL, NULL); - g_return_val_if_fail(key != NULL, NULL); - - value = g_hash_table_lookup(node->settings, key); - - if (value == NULL) - return NULL; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_STRING, NULL); - - return purple_value_get_string(value); -} - -GList * -purple_blist_node_get_extended_menu(PurpleBlistNode *n) -{ - GList *menu = NULL; - - g_return_val_if_fail(n != NULL, NULL); - - purple_signal_emit(purple_blist_get_handle(), - "blist-node-extended-menu", - n, &menu); - return menu; -} - -int purple_blist_get_group_size(PurpleGroup *group, gboolean offline) -{ - if (!group) - return 0; - - return offline ? group->totalsize : group->currentsize; -} - -int purple_blist_get_group_online_count(PurpleGroup *group) -{ - if (!group) - return 0; - - return group->online; -} - -void -purple_blist_set_ui_ops(PurpleBlistUiOps *ops) -{ - gboolean overrode = FALSE; - blist_ui_ops = ops; - - if (!ops) - return; - - if (!ops->save_node) { - ops->save_node = purple_blist_save_node; - overrode = TRUE; - } - if (!ops->remove_node) { - ops->remove_node = purple_blist_save_node; - overrode = TRUE; - } - if (!ops->save_account) { - ops->save_account = purple_blist_save_account; - overrode = TRUE; - } - - if (overrode && (ops->save_node != purple_blist_save_node || - ops->remove_node != purple_blist_save_node || - ops->save_account != purple_blist_save_account)) { - purple_debug_warning("blist", "Only some of the blist saving UI ops " - "were overridden. This probably is not what you want!\n"); - } -} - -PurpleBlistUiOps * -purple_blist_get_ui_ops(void) -{ - return blist_ui_ops; -} - - -void * -purple_blist_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_blist_init(void) -{ - void *handle = purple_blist_get_handle(); - - purple_signal_register(handle, "buddy-status-changed", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, - 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_STATUS), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_STATUS)); - purple_signal_register(handle, "buddy-privacy-changed", - purple_marshal_VOID__POINTER, NULL, - 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "buddy-idle-changed", - purple_marshal_VOID__POINTER_INT_INT, NULL, - 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY), - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_INT)); - - - purple_signal_register(handle, "buddy-signed-on", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "buddy-signed-off", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "buddy-got-login-time", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "blist-node-added", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_NODE)); - - purple_signal_register(handle, "blist-node-removed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_NODE)); - - purple_signal_register(handle, "buddy-added", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "buddy-removed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "buddy-icon-changed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_BUDDY)); - - purple_signal_register(handle, "update-idle", purple_marshal_VOID, NULL, 0); - - purple_signal_register(handle, "blist-node-extended-menu", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_NODE), - purple_value_new(PURPLE_TYPE_BOXED, "GList **")); - - purple_signal_register(handle, "blist-node-aliased", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_BLIST_NODE), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_connect(purple_accounts_get_handle(), "account-created", - handle, - PURPLE_CALLBACK(purple_blist_buddies_cache_add_account), - NULL); - - purple_signal_connect(purple_accounts_get_handle(), "account-destroying", - handle, - PURPLE_CALLBACK(purple_blist_buddies_cache_remove_account), - NULL); -} - -void -purple_blist_uninit(void) -{ - PurpleBlistNode *node, *next_node; - - /* This happens if we quit before purple_set_blist is called. */ - if (purplebuddylist == NULL) - return; - - if (save_timer != 0) { - purple_timeout_remove(save_timer); - save_timer = 0; - purple_blist_sync(); - } - - purple_blist_destroy(); - - node = purple_blist_get_root(); - while (node) { - next_node = node->next; - purple_blist_node_destroy(node); - node = next_node; - } - purplebuddylist->root = NULL; - - g_hash_table_destroy(purplebuddylist->buddies); - g_hash_table_destroy(buddies_cache); - g_hash_table_destroy(groups_cache); - - buddies_cache = NULL; - groups_cache = NULL; - - PURPLE_DBUS_UNREGISTER_POINTER(purplebuddylist); - g_free(purplebuddylist); - purplebuddylist = NULL; - - purple_signals_disconnect_by_handle(purple_blist_get_handle()); - purple_signals_unregister_by_instance(purple_blist_get_handle()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/blist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1248 +0,0 @@ -/** - * @file blist.h Buddy List API - * @ingroup core - * @see @ref blist-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_BLIST_H_ -#define _PURPLE_BLIST_H_ - -/* I can't believe I let ChipX86 inspire me to write good code. -Sean */ - -#include - -/** @copydoc _PurpleBuddyList */ -typedef struct _PurpleBuddyList PurpleBuddyList; -/** @copydoc _PurpleBlistUiOps */ -typedef struct _PurpleBlistUiOps PurpleBlistUiOps; -/** @copydoc _PurpleBlistNode */ -typedef struct _PurpleBlistNode PurpleBlistNode; - -/** @copydoc _PurpleChat */ -typedef struct _PurpleChat PurpleChat; -/** @copydoc _PurpleGroup */ -typedef struct _PurpleGroup PurpleGroup; -/** @copydoc _PurpleContact */ -typedef struct _PurpleContact PurpleContact; -/** @copydoc _PurpleBuddy */ -typedef struct _PurpleBuddy PurpleBuddy; - -/**************************************************************************/ -/* Enumerations */ -/**************************************************************************/ -typedef enum -{ - PURPLE_BLIST_GROUP_NODE, - PURPLE_BLIST_CONTACT_NODE, - PURPLE_BLIST_BUDDY_NODE, - PURPLE_BLIST_CHAT_NODE, - PURPLE_BLIST_OTHER_NODE - -} PurpleBlistNodeType; - -#define PURPLE_BLIST_NODE_IS_CHAT(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE) -#define PURPLE_BLIST_NODE_IS_BUDDY(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE) -#define PURPLE_BLIST_NODE_IS_CONTACT(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CONTACT_NODE) -#define PURPLE_BLIST_NODE_IS_GROUP(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_GROUP_NODE) - -#define PURPLE_BUDDY_IS_ONLINE(b) \ - ((b) != NULL && purple_account_is_connected(purple_buddy_get_account(b)) && \ - purple_presence_is_online(purple_buddy_get_presence(b))) - -typedef enum -{ - PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 << 0 /**< node should not be saved with the buddy list */ - -} PurpleBlistNodeFlags; - -/** - * @since 2.6.0 - */ -#define PURPLE_BLIST_NODE(obj) ((PurpleBlistNode *)(obj)) - -#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f)) -#define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE)) - -#define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \ - purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL) - -/** - * @since 2.6.0 - */ -#define PURPLE_GROUP(obj) ((PurpleGroup *)(obj)) - -/** - * @since 2.6.0 - */ -#define PURPLE_CONTACT(obj) ((PurpleContact *)(obj)) - -/** - * @since 2.6.0 - */ -#define PURPLE_BUDDY(obj) ((PurpleBuddy *)(obj)) - -/** - * @since 2.6.0 - */ -#define PURPLE_CHAT(obj) ((PurpleChat *)(obj)) - -#include "account.h" -#include "buddyicon.h" -#include "status.h" - -/**************************************************************************/ -/* Data Structures */ -/**************************************************************************/ - -#if !(defined PURPLE_HIDE_STRUCTS) || (defined _PURPLE_BLIST_C_) - -/** - * A Buddy list node. This can represent a group, a buddy, or anything else. - * This is a base class for PurpleBuddy, PurpleContact, PurpleGroup, and for - * anything else that wants to put itself in the buddy list. */ -struct _PurpleBlistNode { - PurpleBlistNodeType type; /**< The type of node this is */ - PurpleBlistNode *prev; /**< The sibling before this buddy. */ - PurpleBlistNode *next; /**< The sibling after this buddy. */ - PurpleBlistNode *parent; /**< The parent of this node */ - PurpleBlistNode *child; /**< The child of this node */ - GHashTable *settings; /**< per-node settings */ - void *ui_data; /**< The UI can put data here. */ - PurpleBlistNodeFlags flags; /**< The buddy flags */ -}; - -/** - * A buddy. This contains everything Purple will ever need to know about someone on the buddy list. Everything. - */ -struct _PurpleBuddy { - PurpleBlistNode node; /**< The node that this buddy inherits from */ - char *name; /**< The name of the buddy. */ - char *alias; /**< The user-set alias of the buddy */ - char *server_alias; /**< The server-specified alias of the buddy. (i.e. MSN "Friendly Names") */ - void *proto_data; /**< This allows the prpl to associate whatever data it wants with a buddy */ - PurpleBuddyIcon *icon; /**< The buddy icon. */ - PurpleAccount *account; /**< the account this buddy belongs to */ - PurplePresence *presence; -}; - -/** - * A contact. This contains everything Purple will ever need to know about a contact. - */ -struct _PurpleContact { - PurpleBlistNode node; /**< The node that this contact inherits from. */ - char *alias; /**< The user-set alias of the contact */ - int totalsize; /**< The number of buddies in this contact */ - int currentsize; /**< The number of buddies in this contact corresponding to online accounts */ - int online; /**< The number of buddies in this contact who are currently online */ - PurpleBuddy *priority; /**< The "top" buddy for this contact */ - gboolean priority_valid; /**< Is priority valid? */ -}; - - -/** - * A group. This contains everything Purple will ever need to know about a group. - */ -struct _PurpleGroup { - PurpleBlistNode node; /**< The node that this group inherits from */ - char *name; /**< The name of this group. */ - int totalsize; /**< The number of chats and contacts in this group */ - int currentsize; /**< The number of chats and contacts in this group corresponding to online accounts */ - int online; /**< The number of chats and contacts in this group who are currently online */ -}; - -/** - * A chat. This contains everything Purple needs to put a chat room in the - * buddy list. - */ -struct _PurpleChat { - PurpleBlistNode node; /**< The node that this chat inherits from */ - char *alias; /**< The display name of this chat. */ - GHashTable *components; /**< the stuff the protocol needs to know to join the chat */ - PurpleAccount *account; /**< The account this chat is attached to */ -}; - -/** - * The Buddy List - */ -struct _PurpleBuddyList { - PurpleBlistNode *root; /**< The first node in the buddy list */ - GHashTable *buddies; /**< Every buddy in this list */ - void *ui_data; /**< UI-specific data. */ -}; - -#endif /* PURPLE_HIDE_STRUCTS && PURPLE_BLIST_STRUCTS */ - -/** - * Buddy list UI operations. - * - * Any UI representing a buddy list must assign a filled-out PurpleBlistUiOps - * structure to the buddy list core. - */ -struct _PurpleBlistUiOps -{ - void (*new_list)(PurpleBuddyList *list); /**< Sets UI-specific data on a buddy list. */ - void (*new_node)(PurpleBlistNode *node); /**< Sets UI-specific data on a node. */ - void (*show)(PurpleBuddyList *list); /**< The core will call this when it's finished doing its core stuff */ - void (*update)(PurpleBuddyList *list, - PurpleBlistNode *node); /**< This will update a node in the buddy list. */ - void (*remove)(PurpleBuddyList *list, - PurpleBlistNode *node); /**< This removes a node from the list */ - void (*destroy)(PurpleBuddyList *list); /**< When the list is destroyed, this is called to destroy the UI. */ - void (*set_visible)(PurpleBuddyList *list, - gboolean show); /**< Hides or unhides the buddy list */ - void (*request_add_buddy)(PurpleAccount *account, const char *username, - const char *group, const char *alias); - void (*request_add_chat)(PurpleAccount *account, PurpleGroup *group, - const char *alias, const char *name); - void (*request_add_group)(void); - - /** - * This is called when a node has been modified and should be saved. - * - * Implementation of this UI op is OPTIONAL. If not implemented, it will - * be set to a fallback function that saves data to blist.xml like in - * previous libpurple versions. - * - * @param node The node which has been modified. - * - * @since 2.6.0. - */ - void (*save_node)(PurpleBlistNode *node); - - /** - * Called when a node is about to be removed from the buddy list. - * The UI op should update the relevant data structures to remove this - * node (for example, removing a buddy from the group this node is in). - * - * Implementation of this UI op is OPTIONAL. If not implemented, it will - * be set to a fallback function that saves data to blist.xml like in - * previous libpurple versions. - * - * @param node The node which has been modified. - * @since 2.6.0. - */ - void (*remove_node)(PurpleBlistNode *node); - - /** - * Called to save all the data for an account. If the UI sets this, - * the callback must save the privacy and buddy list data for an account. - * If the account is NULL, save the data for all accounts. - * - * Implementation of this UI op is OPTIONAL. If not implemented, it will - * be set to a fallback function that saves data to blist.xml like in - * previous libpurple versions. - * - * @param account The account whose data to save. If NULL, save all data - * for all accounts. - * @since 2.6.0. - */ - void (*save_account)(PurpleAccount *account); - - void (*_purple_reserved1)(void); -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Buddy List API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new buddy list - * - * @return The new buddy list. - * @deprecated In 3.0.0, this will be handled by purple_blist_init() - */ -PurpleBuddyList *purple_blist_new(void); - -/** - * Sets the main buddy list. - * - * @param blist The buddy list you want to use. - * @deprecated In 3.0.0, this will be handled by purple_blist_init() - */ -void purple_set_blist(PurpleBuddyList *blist); - -/** - * Returns the main buddy list. - * - * @return The main buddy list. - */ -PurpleBuddyList *purple_get_blist(void); - -/** - * Returns the root node of the main buddy list. - * - * @return The root node. - */ -PurpleBlistNode *purple_blist_get_root(void); - -/** - * Returns a list of every buddy in the list. Use of this function is - * discouraged if you do not actually need every buddy in the list. Use - * purple_find_buddies instead. - * - * @return A list of every buddy in the list. Caller is responsible for - * freeing the list. - * - * @see purple_find_buddies - * @since 2.6.0 - */ -GSList *purple_blist_get_buddies(void); - -/** - * Returns the UI data for the list. - * - * @return The UI data for the list. - * - * @since 2.6.0 - */ -gpointer purple_blist_get_ui_data(void); - -/** - * Sets the UI data for the list. - * - * @param ui_data The UI data for the list. - * - * @since 2.6.0 - */ -void purple_blist_set_ui_data(gpointer ui_data); - -/** - * Returns the next node of a given node. This function is to be used to iterate - * over the tree returned by purple_get_blist. - * - * @param node A node. - * @param offline Whether to include nodes for offline accounts - * @return The next node - * @see purple_blist_node_get_parent - * @see purple_blist_node_get_first_child - * @see purple_blist_node_get_sibling_next - * @see purple_blist_node_get_sibling_prev - */ -PurpleBlistNode *purple_blist_node_next(PurpleBlistNode *node, gboolean offline); - -/** - * Returns the parent node of a given node. - * - * @param node A node. - * @return The parent node. - * @since 2.4.0 - * @see purple_blist_node_get_first_child - * @see purple_blist_node_get_sibling_next - * @see purple_blist_node_get_sibling_prev - * @see purple_blist_node_next - */ -PurpleBlistNode *purple_blist_node_get_parent(PurpleBlistNode *node); - -/** - * Returns the the first child node of a given node. - * - * @param node A node. - * @return The child node. - * @since 2.4.0 - * @see purple_blist_node_get_parent - * @see purple_blist_node_get_sibling_next - * @see purple_blist_node_get_sibling_prev - * @see purple_blist_node_next - */ -PurpleBlistNode *purple_blist_node_get_first_child(PurpleBlistNode *node); - -/** - * Returns the sibling node of a given node. - * - * @param node A node. - * @return The sibling node. - * @since 2.4.0 - * @see purple_blist_node_get_parent - * @see purple_blist_node_get_first_child - * @see purple_blist_node_get_sibling_prev - * @see purple_blist_node_next - */ -PurpleBlistNode *purple_blist_node_get_sibling_next(PurpleBlistNode *node); - -/** - * Returns the previous sibling node of a given node. - * - * @param node A node. - * @return The sibling node. - * @since 2.4.0 - * @see purple_blist_node_get_parent - * @see purple_blist_node_get_first_child - * @see purple_blist_node_get_sibling_next - * @see purple_blist_node_next - */ -PurpleBlistNode *purple_blist_node_get_sibling_prev(PurpleBlistNode *node); - -/** - * Returns the UI data of a given node. - * - * @param node The node. - * @return The UI data. - * @since 2.6.0 - */ -gpointer purple_blist_node_get_ui_data(const PurpleBlistNode *node); - -/** - * Sets the UI data of a given node. - * - * @param node The node. - * @param ui_data The UI data. - * - * @since 2.6.0 - */ -void purple_blist_node_set_ui_data(PurpleBlistNode *node, gpointer ui_data); - -/** - * Shows the buddy list, creating a new one if necessary. - */ -void purple_blist_show(void); - - -/** - * Destroys the buddy list window. - * - * @deprecated The UI is responsible for cleaning up the - * PurpleBuddyList->ui_data. purple_blist_uninit() will free the - * PurpleBuddyList* itself. - */ -void purple_blist_destroy(void); - -/** - * Hides or unhides the buddy list. - * - * @param show Whether or not to show the buddy list - */ -void purple_blist_set_visible(gboolean show); - -/** - * Updates a buddy's status. - * - * This should only be called from within Purple. - * - * @param buddy The buddy whose status has changed. - * @param old_status The status from which we are changing. - */ -void purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_status); - -/** - * Updates a node's custom icon. - * - * @param node The PurpleBlistNode whose custom icon has changed. - * - * @since 2.5.0 - */ -void purple_blist_update_node_icon(PurpleBlistNode *node); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Updates a buddy's icon. - * - * @param buddy The buddy whose buddy icon has changed - * @deprecated Use purple_blist_update_node_icon() instead. - */ -void purple_blist_update_buddy_icon(PurpleBuddy *buddy); -#endif - -/** - * Renames a buddy in the buddy list. - * - * @param buddy The buddy whose name will be changed. - * @param name The new name of the buddy. - */ -void purple_blist_rename_buddy(PurpleBuddy *buddy, const char *name); - -/** - * Aliases a contact in the buddy list. - * - * @param contact The contact whose alias will be changed. - * @param alias The contact's alias. - */ -void purple_blist_alias_contact(PurpleContact *contact, const char *alias); - -/** - * Aliases a buddy in the buddy list. - * - * @param buddy The buddy whose alias will be changed. - * @param alias The buddy's alias. - */ -void purple_blist_alias_buddy(PurpleBuddy *buddy, const char *alias); - -/** - * Sets the server-sent alias of a buddy in the buddy list. - * PRPLs should call serv_got_alias() instead of this. - * - * @param buddy The buddy whose alias will be changed. - * @param alias The buddy's "official" alias. - */ -void purple_blist_server_alias_buddy(PurpleBuddy *buddy, const char *alias); - -/** - * Aliases a chat in the buddy list. - * - * @param chat The chat whose alias will be changed. - * @param alias The chat's new alias. - */ -void purple_blist_alias_chat(PurpleChat *chat, const char *alias); - -/** - * Renames a group - * - * @param group The group to rename - * @param name The new name - */ -void purple_blist_rename_group(PurpleGroup *group, const char *name); - -/** - * Creates a new chat for the buddy list - * - * @param account The account this chat will get added to - * @param alias The alias of the new chat - * @param components The info the prpl needs to join the chat. The - * hash function should be g_str_hash() and the - * equal function should be g_str_equal(). - * @return A newly allocated chat - */ -PurpleChat *purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components); - -/** - * Destroys a chat - * - * @param chat The chat to destroy - */ -void purple_chat_destroy(PurpleChat *chat); - -/** - * Adds a new chat to the buddy list. - * - * The chat will be inserted right after node or appended to the end - * of group if node is NULL. If both are NULL, the buddy will be added to - * the "Chats" group. - * - * @param chat The new chat who gets added - * @param group The group to add the new chat to. - * @param node The insertion point - */ -void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node); - -/** - * Creates a new buddy. - * - * This function only creates the PurpleBuddy. Use purple_blist_add_buddy - * to add the buddy to the list and purple_account_add_buddy to sync up - * with the server. - * - * @param account The account this buddy will get added to - * @param name The name of the new buddy - * @param alias The alias of the new buddy (or NULL if unaliased) - * @return A newly allocated buddy - * - * @see purple_account_add_buddy - * @see purple_blist_add_buddy - */ -PurpleBuddy *purple_buddy_new(PurpleAccount *account, const char *name, const char *alias); - -/** - * Destroys a buddy - * - * @param buddy The buddy to destroy - */ -void purple_buddy_destroy(PurpleBuddy *buddy); - -/** - * Sets a buddy's icon. - * - * This should only be called from within Purple. You probably want to - * call purple_buddy_icon_set_data(). - * - * @param buddy The buddy. - * @param icon The buddy icon. - * - * @see purple_buddy_icon_set_data() - */ -void purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon); - -/** - * Returns a buddy's account. - * - * @param buddy The buddy. - * - * @return The account - */ -PurpleAccount *purple_buddy_get_account(const PurpleBuddy *buddy); - -/** - * Returns a buddy's name - * - * @param buddy The buddy. - * - * @return The name. - */ -const char *purple_buddy_get_name(const PurpleBuddy *buddy); - -/** - * Returns a buddy's icon. - * - * @param buddy The buddy. - * - * @return The buddy icon. - */ -PurpleBuddyIcon *purple_buddy_get_icon(const PurpleBuddy *buddy); - -/** - * Returns a buddy's protocol-specific data. - * - * This should only be called from the associated prpl. - * - * @param buddy The buddy. - * @return The protocol data. - * - * @see purple_buddy_set_protocol_data() - * @since 2.6.0 - */ -gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy); - -/** - * Sets a buddy's protocol-specific data. - * - * This should only be called from the associated prpl. - * - * @param buddy The buddy. - * @param data The data. - * - * @see purple_buddy_get_protocol_data() - * @since 2.6.0 - */ -void purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data); - -/** - * Returns a buddy's contact. - * - * @param buddy The buddy. - * - * @return The buddy's contact. - */ -PurpleContact *purple_buddy_get_contact(PurpleBuddy *buddy); - -/** - * Returns a buddy's presence. - * - * @param buddy The buddy. - * - * @return The buddy's presence. - */ -PurplePresence *purple_buddy_get_presence(const PurpleBuddy *buddy); - -/** - * Adds a new buddy to the buddy list. - * - * The buddy will be inserted right after node or prepended to the - * group if node is NULL. If both are NULL, the buddy will be added to - * the "Buddies" group. - * - * @param buddy The new buddy who gets added - * @param contact The optional contact to place the buddy in. - * @param group The group to add the new buddy to. - * @param node The insertion point. Pass in NULL to add the node as - * the first child in the given group. - */ -void purple_blist_add_buddy(PurpleBuddy *buddy, PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node); - -/** - * Creates a new group - * - * You can't have more than one group with the same name. Sorry. If you pass - * this the name of a group that already exists, it will return that group. - * - * @param name The name of the new group - * @return A new group struct -*/ -PurpleGroup *purple_group_new(const char *name); - -/** - * Destroys a group - * - * @param group The group to destroy -*/ -void purple_group_destroy(PurpleGroup *group); - -/** - * Adds a new group to the buddy list. - * - * The new group will be inserted after insert or prepended to the list if - * node is NULL. - * - * @param group The group - * @param node The insertion point - */ -void purple_blist_add_group(PurpleGroup *group, PurpleBlistNode *node); - -/** - * Creates a new contact - * - * @return A new contact struct - */ -PurpleContact *purple_contact_new(void); - -/** - * Destroys a contact - * - * @param contact The contact to destroy - */ -void purple_contact_destroy(PurpleContact *contact); - -/** - * Adds a new contact to the buddy list. - * - * The new contact will be inserted after insert or prepended to the list if - * node is NULL. - * - * @param contact The contact - * @param group The group to add the contact to - * @param node The insertion point - */ -void purple_blist_add_contact(PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node); - -/** - * Merges two contacts - * - * All of the buddies from source will be moved to target - * - * @param source The contact to merge - * @param node The place to merge to (a buddy or contact) - */ -void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node); - -/** - * Returns the highest priority buddy for a given contact. - * - * @param contact The contact - * @return The highest priority buddy - */ -PurpleBuddy *purple_contact_get_priority_buddy(PurpleContact *contact); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Sets the alias for a contact. - * - * @param contact The contact - * @param alias The alias to set, or NULL to unset - * - * @deprecated Use purple_blist_alias_contact() instead. - */ -void purple_contact_set_alias(PurpleContact *contact, const char *alias); -#endif - -/** - * Gets the alias for a contact. - * - * @param contact The contact - * @return The alias, or NULL if it is not set. - */ -const char *purple_contact_get_alias(PurpleContact *contact); - -/** - * Determines whether an account owns any buddies in a given contact - * - * @param contact The contact to search through. - * @param account The account. - * - * @return TRUE if there are any buddies from account in the contact, or FALSE otherwise. - */ -gboolean purple_contact_on_account(PurpleContact *contact, PurpleAccount *account); - -/** - * Invalidates the priority buddy so that the next call to - * purple_contact_get_priority_buddy recomputes it. - * - * @param contact The contact - */ -void purple_contact_invalidate_priority_buddy(PurpleContact *contact); - -/** - * Removes a buddy from the buddy list and frees the memory allocated to it. - * This doesn't actually try to remove the buddy from the server list. - * - * @param buddy The buddy to be removed - * - * @see purple_account_remove_buddy - */ -void purple_blist_remove_buddy(PurpleBuddy *buddy); - -/** - * Removes a contact, and any buddies it contains, and frees the memory - * allocated to it. This calls purple_blist_remove_buddy and therefore - * doesn't remove the buddies from the server list. - * - * @param contact The contact to be removed - * - * @see purple_blist_remove_buddy - */ -void purple_blist_remove_contact(PurpleContact *contact); - -/** - * Removes a chat from the buddy list and frees the memory allocated to it. - * - * @param chat The chat to be removed - */ -void purple_blist_remove_chat(PurpleChat *chat); - -/** - * Removes a group from the buddy list and frees the memory allocated to it and to - * its children - * - * @param group The group to be removed - */ -void purple_blist_remove_group(PurpleGroup *group); - -/** - * Returns the alias of a buddy. - * - * @param buddy The buddy whose name will be returned. - * @return The alias (if set), server alias (if set), - * or NULL. - */ -const char *purple_buddy_get_alias_only(PurpleBuddy *buddy); - -/** - * Gets the server alias for a buddy. - * - * @param buddy The buddy whose name will be returned - * @return The server alias, or NULL if it is not set. - */ -const char *purple_buddy_get_server_alias(PurpleBuddy *buddy); - -/** - * Returns the correct name to display for a buddy, taking the contact alias - * into account. In order of precedence: the buddy's alias; the buddy's - * contact alias; the buddy's server alias; the buddy's user name. - * - * @param buddy The buddy whose name will be returned - * @return The appropriate name or alias, or NULL. - * - */ -const char *purple_buddy_get_contact_alias(PurpleBuddy *buddy); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_) -/** - * Returns the correct alias for this user, ignoring server aliases. Used - * when a user-recognizable name is required. In order: buddy's alias; buddy's - * contact alias; buddy's user name. - * - * @param buddy The buddy whose alias will be returned. - * @return The appropriate name or alias. - * @deprecated Try purple_buddy_get_alias(), if server aliases are okay. - */ -const char *purple_buddy_get_local_alias(PurpleBuddy *buddy); -#endif - -/** - * Returns the correct name to display for a buddy. In order of precedence: - * the buddy's alias; the buddy's server alias; the buddy's contact alias; - * the buddy's user name. - * - * @param buddy The buddy whose name will be returned. - * @return The appropriate name or alias, or NULL - */ -const char *purple_buddy_get_alias(PurpleBuddy *buddy); - -/** - * Returns the local alias for the buddy, or @c NULL if none exists. - * - * @param buddy The buddy - * @return The local alias for the buddy - * - * @since 2.6.0 - */ -const char *purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy); - -/** - * Returns the correct name to display for a blist chat. - * - * @param chat The chat whose name will be returned. - * @return The alias (if set), or first component value. - */ -const char *purple_chat_get_name(PurpleChat *chat); - -/** - * Finds the buddy struct given a name and an account - * - * @param account The account this buddy belongs to - * @param name The buddy's name - * @return The buddy or NULL if the buddy does not exist - */ -PurpleBuddy *purple_find_buddy(PurpleAccount *account, const char *name); - -/** - * Finds the buddy struct given a name, an account, and a group - * - * @param account The account this buddy belongs to - * @param name The buddy's name - * @param group The group to look in - * @return The buddy or NULL if the buddy does not exist in the group - */ -PurpleBuddy *purple_find_buddy_in_group(PurpleAccount *account, const char *name, - PurpleGroup *group); - -/** - * Finds all PurpleBuddy structs given a name and an account - * - * @param account The account this buddy belongs to - * @param name The buddy's name (or NULL to return all buddies for the account) - * - * @return A GSList of buddies (which must be freed), or NULL if the buddy doesn't exist - */ -GSList *purple_find_buddies(PurpleAccount *account, const char *name); - - -/** - * Finds a group by name - * - * @param name The group's name - * @return The group or NULL if the group does not exist - */ -PurpleGroup *purple_find_group(const char *name); - -/** - * Finds a chat by name. - * - * @param account The chat's account. - * @param name The chat's name. - * - * @return The chat, or @c NULL if the chat does not exist. - */ -PurpleChat *purple_blist_find_chat(PurpleAccount *account, const char *name); - -/** - * Returns the group of which the chat is a member. - * - * @param chat The chat. - * - * @return The parent group, or @c NULL if the chat is not in a group. - */ -PurpleGroup *purple_chat_get_group(PurpleChat *chat); - -/** - * Returns the account the chat belongs to. - * - * @param chat The chat. - * - * @return The account the chat belongs to. - * - * @since 2.4.0 - */ -PurpleAccount *purple_chat_get_account(PurpleChat *chat); - -/** - * Get a hashtable containing information about a chat. - * - * @param chat The chat. - * - * @constreturn The hashtable. - * - * @since 2.4.0 - */ -GHashTable *purple_chat_get_components(PurpleChat *chat); - -/** - * Returns the group of which the buddy is a member. - * - * @param buddy The buddy - * @return The group or NULL if the buddy is not in a group - */ -PurpleGroup *purple_buddy_get_group(PurpleBuddy *buddy); - - -/** - * Returns a list of accounts that have buddies in this group - * - * @param g The group - * - * @return A GSList of accounts (which must be freed), or NULL if the group - * has no accounts. - */ -GSList *purple_group_get_accounts(PurpleGroup *g); - -/** - * Determines whether an account owns any buddies in a given group - * - * @param g The group to search through. - * @param account The account. - * - * @return TRUE if there are any buddies in the group, or FALSE otherwise. - */ -gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account); - -/** - * Returns the name of a group. - * - * @param group The group. - * - * @return The name of the group. - */ -const char *purple_group_get_name(PurpleGroup *group); - -/** - * Called when an account connects. Tells the UI to update all the - * buddies. - * - * @param account The account - */ -void purple_blist_add_account(PurpleAccount *account); - - -/** - * Called when an account disconnects. Sets the presence of all the buddies to 0 - * and tells the UI to update them. - * - * @param account The account - */ -void purple_blist_remove_account(PurpleAccount *account); - - -/** - * Determines the total size of a group - * - * @param group The group - * @param offline Count buddies in offline accounts - * @return The number of buddies in the group - */ -int purple_blist_get_group_size(PurpleGroup *group, gboolean offline); - -/** - * Determines the number of online buddies in a group - * - * @param group The group - * @return The number of online buddies in the group, or 0 if the group is NULL - */ -int purple_blist_get_group_online_count(PurpleGroup *group); - -/*@}*/ - -/****************************************************************************************/ -/** @name Buddy list file management API */ -/****************************************************************************************/ - -/** - * Loads the buddy list from ~/.purple/blist.xml. - */ -void purple_blist_load(void); - -/** - * Schedule a save of the blist.xml file. This is used by the privacy - * API whenever the privacy settings are changed. If you make a change - * to blist.xml using one of the functions in the buddy list API, then - * the buddy list is saved automatically, so you should not need to - * call this. - */ -void purple_blist_schedule_save(void); - -/** - * Requests from the user information needed to add a buddy to the - * buddy list. - * - * @param account The account the buddy is added to. - * @param username The username of the buddy. - * @param group The name of the group to place the buddy in. - * @param alias The optional alias for the buddy. - */ -void purple_blist_request_add_buddy(PurpleAccount *account, const char *username, - const char *group, const char *alias); - -/** - * Requests from the user information needed to add a chat to the - * buddy list. - * - * @param account The account the buddy is added to. - * @param group The optional group to add the chat to. - * @param alias The optional alias for the chat. - * @param name The required chat name. - */ -void purple_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, - const char *alias, const char *name); - -/** - * Requests from the user information needed to add a group to the - * buddy list. - */ -void purple_blist_request_add_group(void); - -/** - * Associates a boolean with a node in the buddy list - * - * @param node The node to associate the data with - * @param key The identifier for the data - * @param value The value to set - */ -void purple_blist_node_set_bool(PurpleBlistNode *node, const char *key, gboolean value); - -/** - * Retrieves a named boolean setting from a node in the buddy list - * - * @param node The node to retrieve the data from - * @param key The identifier of the data - * - * @return The value, or FALSE if there is no setting - */ -gboolean purple_blist_node_get_bool(PurpleBlistNode *node, const char *key); - -/** - * Associates an integer with a node in the buddy list - * - * @param node The node to associate the data with - * @param key The identifier for the data - * @param value The value to set - */ -void purple_blist_node_set_int(PurpleBlistNode *node, const char *key, int value); - -/** - * Retrieves a named integer setting from a node in the buddy list - * - * @param node The node to retrieve the data from - * @param key The identifier of the data - * - * @return The value, or 0 if there is no setting - */ -int purple_blist_node_get_int(PurpleBlistNode *node, const char *key); - -/** - * Associates a string with a node in the buddy list - * - * @param node The node to associate the data with - * @param key The identifier for the data - * @param value The value to set - */ -void purple_blist_node_set_string(PurpleBlistNode *node, const char *key, - const char *value); - -/** - * Retrieves a named string setting from a node in the buddy list - * - * @param node The node to retrieve the data from - * @param key The identifier of the data - * - * @return The value, or NULL if there is no setting - */ -const char *purple_blist_node_get_string(PurpleBlistNode *node, const char *key); - -/** - * Removes a named setting from a blist node - * - * @param node The node from which to remove the setting - * @param key The name of the setting - */ -void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key); - -/** - * Set the flags for the given node. Setting a node's flags will overwrite - * the old flags, so if you want to save them, you must first call - * purple_blist_node_get_flags and modify that appropriately. - * - * @param node The node on which to set the flags. - * @param flags The flags to set. This is a bitmask. - */ -void purple_blist_node_set_flags(PurpleBlistNode *node, PurpleBlistNodeFlags flags); - -/** - * Get the current flags on a given node. - * - * @param node The node from which to get the flags. - * - * @return The flags on the node. This is a bitmask. - */ -PurpleBlistNodeFlags purple_blist_node_get_flags(PurpleBlistNode *node); - -/** - * Get the type of a given node. - * - * @param node The node. - * - * @return The type of the node. - * - * @since 2.1.0 - */ -PurpleBlistNodeType purple_blist_node_get_type(PurpleBlistNode *node); - -/*@}*/ - -/** - * Retrieves the extended menu items for a buddy list node. - * @param n The blist node for which to obtain the extended menu items. - * @return A list of PurpleMenuAction items, as harvested by the - * blist-node-extended-menu signal. - */ -GList *purple_blist_node_get_extended_menu(PurpleBlistNode *n); - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used for the buddy list. - * - * @param ops The ops struct. - */ -void purple_blist_set_ui_ops(PurpleBlistUiOps *ops); - -/** - * Returns the UI operations structure to be used for the buddy list. - * - * @return The UI operations structure. - */ -PurpleBlistUiOps *purple_blist_get_ui_ops(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Buddy List Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the handle for the buddy list subsystem. - * - * @return The buddy list subsystem handle. - */ -void *purple_blist_get_handle(void); - -/** - * Initializes the buddy list subsystem. - */ -void purple_blist_init(void); - -/** - * Uninitializes the buddy list subsystem. - */ -void purple_blist_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_BLIST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1335 +0,0 @@ -/** - * @file buddyicon.c Buddy Icon API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_BUDDYICON_C_ - -#include "internal.h" -#include "buddyicon.h" -#include "conversation.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "imgstore.h" -#include "util.h" - -/* NOTE: Instances of this struct are allocated without zeroing the memory, so - * NOTE: be sure to update purple_buddy_icon_new() if you add members. */ -struct _PurpleBuddyIcon -{ - PurpleAccount *account; /**< The account the user is on. */ - PurpleStoredImage *img; /**< The stored image containing - the icon data. */ - char *username; /**< The username the icon belongs to. */ - char *checksum; /**< The protocol checksum. */ - int ref_count; /**< The buddy icon reference count. */ -}; - -/** - * This is the big grand daddy hash table that contains references to - * everybody's buddy icons. - * - * Key is a PurpleAccount. - * Value is another hash table, usually referred to as "icon_cache." - * For this inner hash table: - * Key is the username of the buddy whose icon is being stored. - * Value is the PurpleBuddyIcon for this buddy. - */ -static GHashTable *account_cache = NULL; - -/** - * This hash table contains a bunch of PurpleStoredImages that are - * shared across all accounts. - * - * Key is the filename for this image as constructed by - * purple_util_get_image_filename(). So it is the base16 encoded - * sha-1 hash plus an appropriate file extension. For example: - * "0f4972d17d1e70e751c43c90c948e72efbff9796.gif" - * - * The value is a PurpleStoredImage containing the icon data. These - * images are reference counted, and when the count reaches 0 - * imgstore.c emits the image-deleting signal and we remove the image - * from the hash table (but it might still be saved on disk, if the - * icon is being used by offline accounts or some such). - */ -static GHashTable *icon_data_cache = NULL; - -/** - * This hash table contains references counts for how many times each - * icon in the ~/.purple/icons/ directory is being used. It's pretty - * crazy. It maintains the reference count across sessions, too, so - * if you exit Pidgin then this hash table is reconstructed the next - * time Pidgin starts. - * - * Key is the filename for this image as constructed by - * purple_util_get_image_filename(). So it is the base16 encoded - * sha-1 hash plus an appropriate file extension. For example: - * "0f4972d17d1e70e751c43c90c948e72efbff9796.gif" - * - * The value is a GINT_TO_POINTER count of the number of times this - * icon is used. So if four of your buddies are using an icon, and - * you have the icon set for two of your accounts, then this number - * will be six. When this reference count reaches 0 the icon will - * be deleted from disk. - */ -static GHashTable *icon_file_cache = NULL; - -/** - * This hash table is used for both custom buddy icons on PurpleBlistNodes and - * account icons. - */ -static GHashTable *pointer_icon_cache = NULL; - -static char *cache_dir = NULL; - -/** "Should icons be cached to disk?" */ -static gboolean icon_caching = TRUE; - -/* For ~/.gaim to ~/.purple migration. */ -static char *old_icons_dir = NULL; - -static void delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name); - -/* - * Begin functions for dealing with the on-disk icon cache - */ - -static void -ref_filename(const char *filename) -{ - int refs; - - g_return_if_fail(filename != NULL); - - refs = GPOINTER_TO_INT(g_hash_table_lookup(icon_file_cache, filename)); - - g_hash_table_insert(icon_file_cache, g_strdup(filename), - GINT_TO_POINTER(refs + 1)); -} - -static void -unref_filename(const char *filename) -{ - int refs; - - if (filename == NULL) - return; - - refs = GPOINTER_TO_INT(g_hash_table_lookup(icon_file_cache, filename)); - - if (refs == 1) - { - g_hash_table_remove(icon_file_cache, filename); - } - else - { - g_hash_table_insert(icon_file_cache, g_strdup(filename), - GINT_TO_POINTER(refs - 1)); - } -} - -static void -purple_buddy_icon_data_cache(PurpleStoredImage *img) -{ - const char *dirname; - char *path; - - g_return_if_fail(img != NULL); - - if (!purple_buddy_icons_is_caching()) - return; - - dirname = purple_buddy_icons_get_cache_dir(); - path = g_build_filename(dirname, purple_imgstore_get_filename(img), NULL); - - if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) - { - purple_debug_info("buddyicon", "Creating icon cache directory.\n"); - - if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) - { - purple_debug_error("buddyicon", - "Unable to create directory %s: %s\n", - dirname, g_strerror(errno)); - } - } - - purple_util_write_data_to_file_absolute(path, purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - g_free(path); -} - -static void -purple_buddy_icon_data_uncache_file(const char *filename) -{ - const char *dirname; - char *path; - - g_return_if_fail(filename != NULL); - - /* It's possible that there are other references to this icon - * cache file that are not currently loaded into memory. */ - if (GPOINTER_TO_INT(g_hash_table_lookup(icon_file_cache, filename))) - return; - - dirname = purple_buddy_icons_get_cache_dir(); - path = g_build_filename(dirname, filename, NULL); - - if (g_file_test(path, G_FILE_TEST_EXISTS)) - { - if (g_unlink(path)) - { - purple_debug_error("buddyicon", "Failed to delete %s: %s\n", - path, g_strerror(errno)); - } - else - { - purple_debug_info("buddyicon", "Deleted cache file: %s\n", path); - } - } - - g_free(path); -} - -/* - * End functions for dealing with the on-disk icon cache - */ - -/* - * Begin functions for dealing with the in-memory icon cache - */ - -static gboolean -value_equals(gpointer key, gpointer value, gpointer user_data) -{ - return (value == user_data); -} - -static void -image_deleting_cb(const PurpleStoredImage *img, gpointer data) -{ - const char *filename = purple_imgstore_get_filename(img); - - /* If there's no filename, it can't be one of our images. */ - if (filename == NULL) - return; - - if (img == g_hash_table_lookup(icon_data_cache, filename)) - { - purple_buddy_icon_data_uncache_file(filename); - g_hash_table_remove(icon_data_cache, filename); - - /* We could make this O(1) by using another hash table, but - * this is probably good enough. */ - g_hash_table_foreach_remove(pointer_icon_cache, value_equals, (gpointer)img); - } -} - -static PurpleStoredImage * -purple_buddy_icon_data_new(guchar *icon_data, size_t icon_len, const char *filename) -{ - char *file; - PurpleStoredImage *img; - - g_return_val_if_fail(icon_data != NULL, NULL); - g_return_val_if_fail(icon_len > 0, NULL); - - if (filename == NULL) - { - file = purple_util_get_image_filename(icon_data, icon_len); - if (file == NULL) - { - g_free(icon_data); - return NULL; - } - } - else - file = g_strdup(filename); - - if ((img = g_hash_table_lookup(icon_data_cache, file))) - { - g_free(file); - g_free(icon_data); - return purple_imgstore_ref(img); - } - - img = purple_imgstore_add(icon_data, icon_len, file); - - /* This will take ownership of file and g_free it either now or later. */ - g_hash_table_insert(icon_data_cache, file, img); - - purple_buddy_icon_data_cache(img); - - return img; -} - -/* - * End functions for dealing with the in-memory icon cache - */ - -static PurpleBuddyIcon * -purple_buddy_icon_create(PurpleAccount *account, const char *username) -{ - PurpleBuddyIcon *icon; - GHashTable *icon_cache; - - /* This does not zero. See purple_buddy_icon_new() for - * information on which function allocates which member. */ - icon = g_slice_new(PurpleBuddyIcon); - PURPLE_DBUS_REGISTER_POINTER(icon, PurpleBuddyIcon); - - icon->account = account; - icon->username = g_strdup(username); - icon->checksum = NULL; - icon->ref_count = 1; - - icon_cache = g_hash_table_lookup(account_cache, account); - - if (icon_cache == NULL) - { - icon_cache = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(account_cache, account, icon_cache); - } - - g_hash_table_insert(icon_cache, - (char *)purple_buddy_icon_get_username(icon), icon); - return icon; -} - -PurpleBuddyIcon * -purple_buddy_icon_new(PurpleAccount *account, const char *username, - void *icon_data, size_t icon_len, - const char *checksum) -{ - PurpleBuddyIcon *icon; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - g_return_val_if_fail(icon_data != NULL, NULL); - g_return_val_if_fail(icon_len > 0, NULL); - - /* purple_buddy_icons_find() does allocation, so be - * sure to update it as well when members are added. */ - icon = purple_buddy_icons_find(account, username); - - /* purple_buddy_icon_create() sets account & username */ - if (icon == NULL) - icon = purple_buddy_icon_create(account, username); - - /* purple_buddy_icon_set_data() sets img, but it - * references img first, so we need to initialize it */ - icon->img = NULL; - purple_buddy_icon_set_data(icon, icon_data, icon_len, checksum); - - return icon; -} - -PurpleBuddyIcon * -purple_buddy_icon_ref(PurpleBuddyIcon *icon) -{ - g_return_val_if_fail(icon != NULL, NULL); - - icon->ref_count++; - - return icon; -} - -PurpleBuddyIcon * -purple_buddy_icon_unref(PurpleBuddyIcon *icon) -{ - if (icon == NULL) - return NULL; - - g_return_val_if_fail(icon->ref_count > 0, NULL); - - icon->ref_count--; - - if (icon->ref_count == 0) - { - GHashTable *icon_cache = g_hash_table_lookup(account_cache, purple_buddy_icon_get_account(icon)); - - if (icon_cache != NULL) - g_hash_table_remove(icon_cache, purple_buddy_icon_get_username(icon)); - - g_free(icon->username); - g_free(icon->checksum); - purple_imgstore_unref(icon->img); - - PURPLE_DBUS_UNREGISTER_POINTER(icon); - g_slice_free(PurpleBuddyIcon, icon); - - return NULL; - } - - return icon; -} - -void -purple_buddy_icon_update(PurpleBuddyIcon *icon) -{ - PurpleConversation *conv; - PurpleAccount *account; - const char *username; - PurpleBuddyIcon *icon_to_set; - GSList *buddies; - - g_return_if_fail(icon != NULL); - - account = purple_buddy_icon_get_account(icon); - username = purple_buddy_icon_get_username(icon); - - /* If no data exists (icon->img == NULL), then call the functions below - * with NULL to unset the icon. They will then unref the icon and it should - * be destroyed. The only way it wouldn't be destroyed is if someone - * else is holding a reference to it, in which case they can kill - * the icon when they realize it has no data. */ - icon_to_set = icon->img ? icon : NULL; - - /* Ensure that icon remains valid throughout */ - if (icon) purple_buddy_icon_ref(icon); - - buddies = purple_find_buddies(account, username); - while (buddies != NULL) - { - PurpleBuddy *buddy = (PurpleBuddy *)buddies->data; - char *old_icon; - - purple_buddy_set_icon(buddy, icon_to_set); - old_icon = g_strdup(purple_blist_node_get_string((PurpleBlistNode *)buddy, - "buddy_icon")); - if (icon->img && purple_buddy_icons_is_caching()) - { - const char *filename = purple_imgstore_get_filename(icon->img); - purple_blist_node_set_string((PurpleBlistNode *)buddy, - "buddy_icon", - filename); - - if (icon->checksum && *icon->checksum) - { - purple_blist_node_set_string((PurpleBlistNode *)buddy, - "icon_checksum", - icon->checksum); - } - else - { - purple_blist_node_remove_setting((PurpleBlistNode *)buddy, - "icon_checksum"); - } - ref_filename(filename); - } - else if (!icon->img) - { - purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "buddy_icon"); - purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "icon_checksum"); - } - unref_filename(old_icon); - g_free(old_icon); - - buddies = g_slist_delete_link(buddies, buddies); - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, account); - - if (conv != NULL) - purple_conv_im_set_icon(PURPLE_CONV_IM(conv), icon_to_set); - - /* icon's refcount was incremented above */ - if (icon) purple_buddy_icon_unref(icon); -} - -void -purple_buddy_icon_set_data(PurpleBuddyIcon *icon, guchar *data, - size_t len, const char *checksum) -{ - PurpleStoredImage *old_img; - - g_return_if_fail(icon != NULL); - - old_img = icon->img; - icon->img = NULL; - - if (data != NULL) - { - if (len > 0) - icon->img = purple_buddy_icon_data_new(data, len, NULL); - else - g_free(data); - } - - g_free(icon->checksum); - icon->checksum = g_strdup(checksum); - - purple_buddy_icon_update(icon); - - purple_imgstore_unref(old_img); -} - -PurpleAccount * -purple_buddy_icon_get_account(const PurpleBuddyIcon *icon) -{ - g_return_val_if_fail(icon != NULL, NULL); - - return icon->account; -} - -const char * -purple_buddy_icon_get_username(const PurpleBuddyIcon *icon) -{ - g_return_val_if_fail(icon != NULL, NULL); - - return icon->username; -} - -const char * -purple_buddy_icon_get_checksum(const PurpleBuddyIcon *icon) -{ - g_return_val_if_fail(icon != NULL, NULL); - - return icon->checksum; -} - -gconstpointer -purple_buddy_icon_get_data(const PurpleBuddyIcon *icon, size_t *len) -{ - g_return_val_if_fail(icon != NULL, NULL); - - if (icon->img) - { - if (len != NULL) - *len = purple_imgstore_get_size(icon->img); - - return purple_imgstore_get_data(icon->img); - } - - return NULL; -} - -const char * -purple_buddy_icon_get_extension(const PurpleBuddyIcon *icon) -{ - if (icon->img != NULL) - return purple_imgstore_get_extension(icon->img); - - return NULL; -} - -void -purple_buddy_icons_set_for_user(PurpleAccount *account, const char *username, - void *icon_data, size_t icon_len, - const char *checksum) -{ - GHashTable *icon_cache; - PurpleBuddyIcon *icon = NULL; - - g_return_if_fail(account != NULL); - g_return_if_fail(username != NULL); - - icon_cache = g_hash_table_lookup(account_cache, account); - - if (icon_cache != NULL) - icon = g_hash_table_lookup(icon_cache, username); - - if (icon != NULL) - purple_buddy_icon_set_data(icon, icon_data, icon_len, checksum); - else if (icon_data && icon_len > 0) - { - PurpleBuddyIcon *icon = purple_buddy_icon_new(account, username, icon_data, icon_len, checksum); - - /* purple_buddy_icon_new() calls - * purple_buddy_icon_set_data(), which calls - * purple_buddy_icon_update(), which has the buddy list - * and conversations take references as appropriate. - * This function doesn't return icon, so we can't - * leave a reference dangling. */ - purple_buddy_icon_unref(icon); - } - else - { - /* If the buddy list or a conversation was holding a - * reference, we'd have found the icon in the cache. - * Since we know we're deleting the icon, we only - * need a subset of purple_buddy_icon_update(). */ - - GSList *buddies = purple_find_buddies(account, username); - while (buddies != NULL) - { - PurpleBuddy *buddy = (PurpleBuddy *)buddies->data; - - unref_filename(purple_blist_node_get_string((PurpleBlistNode *)buddy, "buddy_icon")); - purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "buddy_icon"); - purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "icon_checksum"); - - buddies = g_slist_delete_link(buddies, buddies); - } - } -} - -char *purple_buddy_icon_get_full_path(PurpleBuddyIcon *icon) -{ - char *path; - - g_return_val_if_fail(icon != NULL, NULL); - - if (icon->img == NULL) - return NULL; - - path = g_build_filename(purple_buddy_icons_get_cache_dir(), - purple_imgstore_get_filename(icon->img), NULL); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - g_free(path); - return NULL; - } - return path; -} - -const char * -purple_buddy_icons_get_checksum_for_user(PurpleBuddy *buddy) -{ - return purple_blist_node_get_string((PurpleBlistNode*)buddy, - "icon_checksum"); -} - -static gboolean -read_icon_file(const char *path, guchar **data, size_t *len) -{ - GError *err = NULL; - - if (!g_file_get_contents(path, (gchar **)data, len, &err)) - { - purple_debug_error("buddyicon", "Error reading %s: %s\n", - path, err->message); - g_error_free(err); - - return FALSE; - } - - return TRUE; -} - -PurpleBuddyIcon * -purple_buddy_icons_find(PurpleAccount *account, const char *username) -{ - GHashTable *icon_cache; - PurpleBuddyIcon *icon = NULL; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - icon_cache = g_hash_table_lookup(account_cache, account); - - if ((icon_cache == NULL) || ((icon = g_hash_table_lookup(icon_cache, username)) == NULL)) - { - PurpleBuddy *b = purple_find_buddy(account, username); - const char *protocol_icon_file; - const char *dirname; - gboolean caching; - guchar *data; - size_t len; - - if (!b) - return NULL; - - protocol_icon_file = purple_blist_node_get_string((PurpleBlistNode*)b, "buddy_icon"); - - if (protocol_icon_file == NULL) - return NULL; - - dirname = purple_buddy_icons_get_cache_dir(); - - caching = purple_buddy_icons_is_caching(); - /* By disabling caching temporarily, we avoid a loop - * and don't have to add special code through several - * functions. */ - purple_buddy_icons_set_caching(FALSE); - - if (protocol_icon_file != NULL) - { - char *path = g_build_filename(dirname, protocol_icon_file, NULL); - if (read_icon_file(path, &data, &len)) - { - const char *checksum; - - icon = purple_buddy_icon_create(account, username); - icon->img = NULL; - checksum = purple_blist_node_get_string((PurpleBlistNode*)b, "icon_checksum"); - purple_buddy_icon_set_data(icon, data, len, checksum); - } - else - delete_buddy_icon_settings((PurpleBlistNode*)b, "buddy_icon"); - - g_free(path); - } - - purple_buddy_icons_set_caching(caching); - } - - return (icon ? purple_buddy_icon_ref(icon) : NULL); -} - -PurpleStoredImage * -purple_buddy_icons_find_account_icon(PurpleAccount *account) -{ - PurpleStoredImage *img; - const char *account_icon_file; - const char *dirname; - char *path; - guchar *data; - size_t len; - - g_return_val_if_fail(account != NULL, NULL); - - if ((img = g_hash_table_lookup(pointer_icon_cache, account))) - { - return purple_imgstore_ref(img); - } - - account_icon_file = purple_account_get_string(account, "buddy_icon", NULL); - - if (account_icon_file == NULL) - return NULL; - - dirname = purple_buddy_icons_get_cache_dir(); - path = g_build_filename(dirname, account_icon_file, NULL); - - if (read_icon_file(path, &data, &len)) - { - g_free(path); - img = purple_buddy_icon_data_new(data, len, account_icon_file); - g_hash_table_insert(pointer_icon_cache, account, img); - return img; - } - g_free(path); - - return NULL; -} - -PurpleStoredImage * -purple_buddy_icons_set_account_icon(PurpleAccount *account, - guchar *icon_data, size_t icon_len) -{ - PurpleStoredImage *old_img; - PurpleStoredImage *img = NULL; - char *old_icon; - - if (icon_data != NULL && icon_len > 0) - { - img = purple_buddy_icon_data_new(icon_data, icon_len, NULL); - } - - old_icon = g_strdup(purple_account_get_string(account, "buddy_icon", NULL)); - if (img && purple_buddy_icons_is_caching()) - { - const char *filename = purple_imgstore_get_filename(img); - purple_account_set_string(account, "buddy_icon", filename); - purple_account_set_int(account, "buddy_icon_timestamp", time(NULL)); - ref_filename(filename); - } - else - { - purple_account_set_string(account, "buddy_icon", NULL); - purple_account_set_int(account, "buddy_icon_timestamp", 0); - } - unref_filename(old_icon); - - old_img = g_hash_table_lookup(pointer_icon_cache, account); - - if (img) - g_hash_table_insert(pointer_icon_cache, account, img); - else - g_hash_table_remove(pointer_icon_cache, account); - - if (purple_account_is_connected(account)) - { - PurpleConnection *gc; - PurplePluginProtocolInfo *prpl_info; - - gc = purple_account_get_connection(account); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - - if (prpl_info && prpl_info->set_buddy_icon) - prpl_info->set_buddy_icon(gc, img); - } - - if (old_img) - purple_imgstore_unref(old_img); - else if (old_icon) - { - /* The old icon may not have been loaded into memory. In that - * case, we'll need to uncache the filename. The filenames - * are ref-counted, so this is safe. */ - purple_buddy_icon_data_uncache_file(old_icon); - } - g_free(old_icon); - - return img; -} - -time_t -purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account) -{ - time_t ret; - - g_return_val_if_fail(account != NULL, 0); - - ret = purple_account_get_int(account, "buddy_icon_timestamp", 0); - - /* This deals with migration cases. */ - if (ret == 0 && purple_account_get_string(account, "buddy_icon", NULL) != NULL) - { - ret = time(NULL); - purple_account_set_int(account, "buddy_icon_timestamp", ret); - } - - return ret; -} - -gboolean -purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node) -{ - g_return_val_if_fail(node != NULL, FALSE); - - return (purple_blist_node_get_string(node, "custom_buddy_icon") != NULL); -} - -PurpleStoredImage * -purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node) -{ - char *path; - size_t len; - guchar *data; - PurpleStoredImage *img; - const char *custom_icon_file, *dirname; - - g_return_val_if_fail(node != NULL, NULL); - - if ((img = g_hash_table_lookup(pointer_icon_cache, node))) - { - return purple_imgstore_ref(img); - } - - custom_icon_file = purple_blist_node_get_string(node, - "custom_buddy_icon"); - - if (custom_icon_file == NULL) - return NULL; - - dirname = purple_buddy_icons_get_cache_dir(); - path = g_build_filename(dirname, custom_icon_file, NULL); - - if (read_icon_file(path, &data, &len)) - { - g_free(path); - img = purple_buddy_icon_data_new(data, len, custom_icon_file); - g_hash_table_insert(pointer_icon_cache, node, img); - return img; - } - g_free(path); - - return NULL; -} - -PurpleStoredImage * -purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, - guchar *icon_data, size_t icon_len) -{ - char *old_icon; - PurpleStoredImage *old_img; - PurpleStoredImage *img = NULL; - - g_return_val_if_fail(node != NULL, NULL); - - if (!PURPLE_BLIST_NODE_IS_CONTACT(node) && - !PURPLE_BLIST_NODE_IS_CHAT(node) && - !PURPLE_BLIST_NODE_IS_GROUP(node)) { - return NULL; - } - - old_img = g_hash_table_lookup(pointer_icon_cache, node); - - if (icon_data != NULL && icon_len > 0) { - img = purple_buddy_icon_data_new(icon_data, icon_len, NULL); - } - - old_icon = g_strdup(purple_blist_node_get_string(node, - "custom_buddy_icon")); - if (img && purple_buddy_icons_is_caching()) { - const char *filename = purple_imgstore_get_filename(img); - purple_blist_node_set_string(node, "custom_buddy_icon", - filename); - ref_filename(filename); - } else { - purple_blist_node_remove_setting(node, "custom_buddy_icon"); - } - unref_filename(old_icon); - - if (img) - g_hash_table_insert(pointer_icon_cache, node, img); - else - g_hash_table_remove(pointer_icon_cache, node); - - if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - PurpleBlistNode *child; - for (child = purple_blist_node_get_first_child(node); - child; - child = purple_blist_node_get_sibling_next(child)) - { - PurpleBuddy *buddy; - PurpleConversation *conv; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(child)) - continue; - - buddy = (PurpleBuddy *)child; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(buddy), purple_buddy_get_account(buddy)); - if (conv) - purple_conversation_update(conv, PURPLE_CONV_UPDATE_ICON); - - /* Is this call necessary anymore? Can the buddies - * themselves need updating when the custom buddy - * icon changes? */ - purple_blist_update_node_icon((PurpleBlistNode*)buddy); - } - } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - PurpleConversation *conv = NULL; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, purple_chat_get_name((PurpleChat*)node), purple_chat_get_account((PurpleChat*)node)); - if (conv) { - purple_conversation_update(conv, PURPLE_CONV_UPDATE_ICON); - } - } - - purple_blist_update_node_icon(node); - - if (old_img) { - purple_imgstore_unref(old_img); - } else if (old_icon) { - /* The old icon may not have been loaded into memory. In that - * case, we'll need to uncache the filename. The filenames - * are ref-counted, so this is safe. */ - purple_buddy_icon_data_uncache_file(old_icon); - } - g_free(old_icon); - - return img; -} - -PurpleStoredImage * -purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, - const gchar *filename) -{ - size_t len = 0; - guchar *data = NULL; - - g_return_val_if_fail(node != NULL, NULL); - - if (!PURPLE_BLIST_NODE_IS_CONTACT(node) && - !PURPLE_BLIST_NODE_IS_CHAT(node) && - !PURPLE_BLIST_NODE_IS_GROUP(node)) { - return NULL; - } - - if (filename != NULL) { - if (!read_icon_file(filename, &data, &len)) { - return NULL; - } - } - - return purple_buddy_icons_node_set_custom_icon(node, data, len); -} - -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_has_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact) -{ - return purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact); -} - -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, guchar *icon_data, - size_t icon_len) -{ - return purple_buddy_icons_node_set_custom_icon((PurpleBlistNode*)contact, icon_data, icon_len); -} - -void -_purple_buddy_icon_set_old_icons_dir(const char *dirname) -{ - old_icons_dir = g_strdup(dirname); -} - -static void -delete_buddy_icon_settings(PurpleBlistNode *node, const char *setting_name) -{ - purple_blist_node_remove_setting(node, setting_name); - - if (purple_strequal(setting_name, "buddy_icon")) - { - purple_blist_node_remove_setting(node, "avatar_hash"); - purple_blist_node_remove_setting(node, "icon_checksum"); - } -} - -static void -migrate_buddy_icon(PurpleBlistNode *node, const char *setting_name, - const char *dirname, const char *filename) -{ - char *path; - - if (filename[0] != '/') - { - path = g_build_filename(dirname, filename, NULL); - if (g_file_test(path, G_FILE_TEST_EXISTS)) - { - g_free(path); - return; - } - g_free(path); - - path = g_build_filename(old_icons_dir, filename, NULL); - } - else - path = g_strdup(filename); - - if (g_file_test(path, G_FILE_TEST_EXISTS)) - { - guchar *icon_data; - size_t icon_len; - FILE *file; - char *new_filename; - - if (!read_icon_file(path, &icon_data, &icon_len)) - { - g_free(path); - delete_buddy_icon_settings(node, setting_name); - return; - } - - if (icon_data == NULL || icon_len <= 0) - { - /* This really applies to the icon_len check. - * icon_data should never be NULL if - * read_icon_file() returns TRUE. */ - purple_debug_error("buddyicon", "Empty buddy icon file: %s\n", path); - delete_buddy_icon_settings(node, setting_name); - g_free(path); - return; - } - - g_free(path); - - new_filename = purple_util_get_image_filename(icon_data, icon_len); - if (new_filename == NULL) - { - purple_debug_error("buddyicon", - "New icon filename is NULL. This should never happen! " - "The old filename was: %s\n", path); - delete_buddy_icon_settings(node, setting_name); - g_return_if_reached(); - } - - path = g_build_filename(dirname, new_filename, NULL); - if ((file = g_fopen(path, "wb")) != NULL) - { - if (!fwrite(icon_data, icon_len, 1, file)) - { - purple_debug_error("buddyicon", "Error writing %s: %s\n", - path, g_strerror(errno)); - } - else - purple_debug_info("buddyicon", "Wrote migrated cache file: %s\n", path); - - fclose(file); - } - else - { - purple_debug_error("buddyicon", "Unable to create file %s: %s\n", - path, g_strerror(errno)); - g_free(new_filename); - g_free(path); - - delete_buddy_icon_settings(node, setting_name); - return; - } - g_free(path); - - purple_blist_node_set_string(node, - setting_name, - new_filename); - ref_filename(new_filename); - - g_free(new_filename); - - if (purple_strequal(setting_name, "buddy_icon")) - { - const char *hash; - - hash = purple_blist_node_get_string(node, "avatar_hash"); - if (hash != NULL) - { - purple_blist_node_set_string(node, "icon_checksum", hash); - purple_blist_node_remove_setting(node, "avatar_hash"); - } - else - { - PurpleAccount *account = purple_buddy_get_account((PurpleBuddy *)node); - const char *prpl_id = purple_account_get_protocol_id(account); - - if (g_str_equal(prpl_id, "prpl-yahoo") || g_str_equal(prpl_id, "prpl-yahoojp")) - { - int checksum = purple_blist_node_get_int(node, "icon_checksum"); - if (checksum != 0) - { - char *checksum_str = g_strdup_printf("%i", checksum); - purple_blist_node_remove_setting(node, "icon_checksum"); - purple_blist_node_set_string(node, "icon_checksum", checksum_str); - g_free(checksum_str); - } - } - } - } - } - else - { - purple_debug_error("buddyicon", "Old icon file doesn't exist: %s\n", path); - delete_buddy_icon_settings(node, setting_name); - g_free(path); - } -} - -void -_purple_buddy_icons_account_loaded_cb() -{ - const char *dirname = purple_buddy_icons_get_cache_dir(); - GList *cur; - - for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next) - { - PurpleAccount *account = cur->data; - const char *account_icon_file = purple_account_get_string(account, "buddy_icon", NULL); - - if (account_icon_file != NULL) - { - char *path = g_build_filename(dirname, account_icon_file, NULL); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - purple_account_set_string(account, "buddy_icon", NULL); - } else { - ref_filename(account_icon_file); - } - g_free(path); - } - } -} - -void -_purple_buddy_icons_blist_loaded_cb() -{ - PurpleBlistNode *node = purple_blist_get_root(); - const char *dirname = purple_buddy_icons_get_cache_dir(); - - /* Doing this once here saves having to check it inside a loop. */ - if (old_icons_dir != NULL) - { - if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) - { - purple_debug_info("buddyicon", "Creating icon cache directory.\n"); - - if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) - { - purple_debug_error("buddyicon", - "Unable to create directory %s: %s\n", - dirname, g_strerror(errno)); - } - } - } - - while (node != NULL) - { - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - const char *filename; - - filename = purple_blist_node_get_string(node, "buddy_icon"); - if (filename != NULL) - { - if (old_icons_dir != NULL) - { - migrate_buddy_icon(node, - "buddy_icon", - dirname, filename); - } - else - { - char *path = g_build_filename(dirname, filename, NULL); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - purple_blist_node_remove_setting(node, - "buddy_icon"); - purple_blist_node_remove_setting(node, - "icon_checksum"); - } - else - ref_filename(filename); - g_free(path); - } - } - } - else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || - PURPLE_BLIST_NODE_IS_CHAT(node) || - PURPLE_BLIST_NODE_IS_GROUP(node)) - { - const char *filename; - - filename = purple_blist_node_get_string(node, "custom_buddy_icon"); - if (filename != NULL) - { - if (old_icons_dir != NULL) - { - migrate_buddy_icon(node, - "custom_buddy_icon", - dirname, filename); - } - else - { - char *path = g_build_filename(dirname, filename, NULL); - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - purple_blist_node_remove_setting(node, - "custom_buddy_icon"); - } - else - ref_filename(filename); - g_free(path); - } - } - } - node = purple_blist_node_next(node, TRUE); - } -} - -void -purple_buddy_icons_set_caching(gboolean caching) -{ - icon_caching = caching; -} - -gboolean -purple_buddy_icons_is_caching(void) -{ - return icon_caching; -} - -void -purple_buddy_icons_set_cache_dir(const char *dir) -{ - g_return_if_fail(dir != NULL); - - g_free(cache_dir); - cache_dir = g_strdup(dir); -} - -const char * -purple_buddy_icons_get_cache_dir(void) -{ - return cache_dir; -} - -void * -purple_buddy_icons_get_handle() -{ - static int handle; - - return &handle; -} - -void -purple_buddy_icons_init() -{ - account_cache = g_hash_table_new_full( - g_direct_hash, g_direct_equal, - NULL, (GFreeFunc)g_hash_table_destroy); - - icon_data_cache = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - icon_file_cache = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - pointer_icon_cache = g_hash_table_new(g_direct_hash, g_direct_equal); - - if (!cache_dir) - cache_dir = g_build_filename(purple_user_dir(), "icons", NULL); - - purple_signal_connect(purple_imgstore_get_handle(), "image-deleting", - purple_buddy_icons_get_handle(), - G_CALLBACK(image_deleting_cb), NULL); -} - -void -purple_buddy_icons_uninit() -{ - purple_signals_disconnect_by_handle(purple_buddy_icons_get_handle()); - - g_hash_table_destroy(account_cache); - g_hash_table_destroy(icon_data_cache); - g_hash_table_destroy(icon_file_cache); - g_hash_table_destroy(pointer_icon_cache); - g_free(old_icons_dir); - g_free(cache_dir); - cache_dir = NULL; -} - -void purple_buddy_icon_get_scale_size(PurpleBuddyIconSpec *spec, int *width, int *height) -{ - int new_width, new_height; - - new_width = *width; - new_height = *height; - - if (*width < spec->min_width) - new_width = spec->min_width; - else if (*width > spec->max_width) - new_width = spec->max_width; - - if (*height < spec->min_height) - new_height = spec->min_height; - else if (*height > spec->max_height) - new_height = spec->max_height; - - /* preserve aspect ratio */ - if ((double)*height * (double)new_width > - (double)*width * (double)new_height) { - new_width = 0.5 + (double)*width * (double)new_height / (double)*height; - } else { - new_height = 0.5 + (double)*height * (double)new_width / (double)*width; - } - - *width = new_width; - *height = new_height; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/buddyicon.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,441 +0,0 @@ -/** - * @file buddyicon.h Buddy Icon API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_BUDDYICON_H_ -#define _PURPLE_BUDDYICON_H_ - -/** An opaque structure representing a buddy icon for a particular user on a - * particular #PurpleAccount. Instances are reference-counted; use - * purple_buddy_icon_ref() and purple_buddy_icon_unref() to take and release - * references. - */ -typedef struct _PurpleBuddyIcon PurpleBuddyIcon; - -#include "account.h" -#include "blist.h" -#include "imgstore.h" -#include "prpl.h" -#include "util.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/**************************************************************************/ -/** @name Buddy Icon API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new buddy icon structure and populates it. - * - * If the buddy icon already exists, you'll get a reference to that structure, - * which will have been updated with the data supplied. - * - * @param account The account the user is on. - * @param username The username the icon belongs to. - * @param icon_data The buddy icon data. - * @param icon_len The buddy icon length. - * @param checksum A protocol checksum from the prpl or @c NULL. - * - * @return The buddy icon structure, with a reference for the caller. - */ -PurpleBuddyIcon *purple_buddy_icon_new(PurpleAccount *account, const char *username, - void *icon_data, size_t icon_len, - const char *checksum); - -/** - * Increments the reference count on a buddy icon. - * - * @param icon The buddy icon. - * - * @return @a icon. - */ -PurpleBuddyIcon *purple_buddy_icon_ref(PurpleBuddyIcon *icon); - -/** - * Decrements the reference count on a buddy icon. - * - * If the reference count reaches 0, the icon will be destroyed. - * - * @param icon The buddy icon. - * - * @return @a icon, or @c NULL if the reference count reached 0. - */ -PurpleBuddyIcon *purple_buddy_icon_unref(PurpleBuddyIcon *icon); - -/** - * Updates every instance of this icon. - * - * @param icon The buddy icon. - */ -void purple_buddy_icon_update(PurpleBuddyIcon *icon); - -/** - * Sets the buddy icon's data. - * - * @param icon The buddy icon. - * @param data The buddy icon data, which the buddy icon code - * takes ownership of and will free. - * @param len The length of the data in @a data. - * @param checksum A protocol checksum from the prpl or @c NULL. - */ -void -purple_buddy_icon_set_data(PurpleBuddyIcon *icon, guchar *data, - size_t len, const char *checksum); - -/** - * Returns the buddy icon's account. - * - * @param icon The buddy icon. - * - * @return The account. - */ -PurpleAccount *purple_buddy_icon_get_account(const PurpleBuddyIcon *icon); - -/** - * Returns the buddy icon's username. - * - * @param icon The buddy icon. - * - * @return The username. - */ -const char *purple_buddy_icon_get_username(const PurpleBuddyIcon *icon); - -/** - * Returns the buddy icon's checksum. - * - * This function is really only for prpl use. - * - * @param icon The buddy icon. - * - * @return The checksum. - */ -const char *purple_buddy_icon_get_checksum(const PurpleBuddyIcon *icon); - -/** - * Returns the buddy icon's data. - * - * @param icon The buddy icon. - * @param len If not @c NULL, the length of the icon data returned will be - * set in the location pointed to by this. - * - * @return A pointer to the icon data. - */ -gconstpointer purple_buddy_icon_get_data(const PurpleBuddyIcon *icon, size_t *len); - -/** - * Returns an extension corresponding to the buddy icon's file type. - * - * @param icon The buddy icon. - * - * @return The icon's extension, "icon" if unknown, or @c NULL if - * the image data has disappeared. - */ -const char *purple_buddy_icon_get_extension(const PurpleBuddyIcon *icon); - -/** - * Returns a full path to an icon. - * - * If the icon has data and the file exists in the cache, this will return - * a full path to the cache file. - * - * In general, it is not appropriate to be poking in the icon cache - * directly. If you find yourself wanting to use this function, think - * very long and hard about it, and then don't. - * - * @param icon The buddy icon - * - * @return A full path to the file, or @c NULL under various conditions. - */ -char *purple_buddy_icon_get_full_path(PurpleBuddyIcon *icon); - -/*@}*/ - -/**************************************************************************/ -/** @name Buddy Icon Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets a buddy icon for a user. - * - * @param account The account the user is on. - * @param username The username of the user. - * @param icon_data The buddy icon data, which the buddy icon code - * takes ownership of and will free. - * @param icon_len The length of the icon data. - * @param checksum A protocol checksum from the prpl or @c NULL. - */ -void -purple_buddy_icons_set_for_user(PurpleAccount *account, const char *username, - void *icon_data, size_t icon_len, - const char *checksum); - -/** - * Returns the checksum for the buddy icon of a specified buddy. - * - * This avoids loading the icon image data from the cache if it's - * not already loaded for some other reason. - * - * @param buddy The buddy - * - * @return The checksum. - */ -const char * -purple_buddy_icons_get_checksum_for_user(PurpleBuddy *buddy); - -/** - * Returns the buddy icon information for a user. - * - * @param account The account the user is on. - * @param username The username of the user. - * - * @return The icon (with a reference for the caller) if found, or @c NULL if - * not found. - */ -PurpleBuddyIcon * -purple_buddy_icons_find(PurpleAccount *account, const char *username); - -/** - * Returns the buddy icon image for an account. - * - * The caller owns a reference to the image in the store, and must dereference - * the image with purple_imgstore_unref() for it to be freed. - * - * This function deals with loading the icon from the cache, if - * needed, so it should be called in any case where you want the - * appropriate icon. - * - * @param account The account - * - * @return The account's buddy icon image. - */ -PurpleStoredImage * -purple_buddy_icons_find_account_icon(PurpleAccount *account); - -/** - * Sets a buddy icon for an account. - * - * This function will deal with saving a record of the icon, - * caching the data, etc. - * - * @param account The account for which to set a custom icon. - * @param icon_data The image data of the icon, which the - * buddy icon code will free. - * @param icon_len The length of the data in @a icon_data. - * - * @return The icon that was set. The caller does NOT own - * a reference to this, and must call purple_imgstore_ref() - * if it wants one. - */ -PurpleStoredImage * -purple_buddy_icons_set_account_icon(PurpleAccount *account, - guchar *icon_data, size_t icon_len); - -/** - * Returns the timestamp of when the icon was set. - * - * This is intended for use in protocols that require a timestamp for - * buddy icon update reasons. - * - * @param account The account - * - * @return The time the icon was set, or 0 if an error occurred. - */ -time_t -purple_buddy_icons_get_account_icon_timestamp(PurpleAccount *account); - -/** - * Returns a boolean indicating if a given blist node has a custom buddy icon. - * - * @param node The blist node. - * - * @return A boolean indicating if @a node has a custom buddy icon. - * @since 2.5.0 - */ -gboolean -purple_buddy_icons_node_has_custom_icon(PurpleBlistNode *node); - -/** - * Returns the custom buddy icon image for a blist node. - * - * The caller owns a reference to the image in the store, and must dereference - * the image with purple_imgstore_unref() for it to be freed. - * - * This function deals with loading the icon from the cache, if - * needed, so it should be called in any case where you want the - * appropriate icon. - * - * @param node The node. - * - * @return The custom buddy icon. - * @since 2.5.0 - */ -PurpleStoredImage * -purple_buddy_icons_node_find_custom_icon(PurpleBlistNode *node); - -/** - * Sets a custom buddy icon for a blist node. - * - * This function will deal with saving a record of the icon, caching the data, - * etc. - * - * @param node The blist node for which to set a custom icon. - * @param icon_data The image data of the icon, which the buddy icon code will - * free. Use NULL to unset the icon. - * @param icon_len The length of the data in @a icon_data. - * - * @return The icon that was set. The caller does NOT own a reference to this, - * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 - */ -PurpleStoredImage * -purple_buddy_icons_node_set_custom_icon(PurpleBlistNode *node, - guchar *icon_data, size_t icon_len); - -/** - * Sets a custom buddy icon for a blist node. - * - * Convenience wrapper around purple_buddy_icons_node_set_custom_icon. - * @see purple_buddy_icons_node_set_custom_icon() - * - * @param node The blist node for which to set a custom icon. - * @param filename The path to the icon to set for the blist node. Use NULL - * to unset the custom icon. - * - * @return The icon that was set. The caller does NOT own a reference to this, - * and must call purple_imgstore_ref() if it wants one. - * @since 2.5.0 - */ -PurpleStoredImage * -purple_buddy_icons_node_set_custom_icon_from_file(PurpleBlistNode *node, - const gchar *filename); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BUDDYICON_C_) -/** - * PurpleContact version of purple_buddy_icons_node_has_custom_icon. - * - * @copydoc purple_buddy_icons_node_has_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_has_custom_icon instead. - */ -gboolean -purple_buddy_icons_has_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_find_custom_icon. - * - * @copydoc purple_buddy_icons_node_find_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_find_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_find_custom_icon(PurpleContact *contact); - -/** - * PurpleContact version of purple_buddy_icons_node_set_custom_icon. - * - * @copydoc purple_buddy_icons_node_set_custom_icon() - * - * @deprecated Use purple_buddy_icons_node_set_custom_icon instead. - */ -PurpleStoredImage * -purple_buddy_icons_set_custom_icon(PurpleContact *contact, - guchar *icon_data, size_t icon_len); -#endif - -/** - * Sets whether or not buddy icon caching is enabled. - * - * @param caching TRUE of buddy icon caching should be enabled, or - * FALSE otherwise. - */ -void purple_buddy_icons_set_caching(gboolean caching); - -/** - * Returns whether or not buddy icon caching should be enabled. - * - * The default is TRUE, unless otherwise specified by - * purple_buddy_icons_set_caching(). - * - * @return TRUE if buddy icon caching is enabled, or FALSE otherwise. - */ -gboolean purple_buddy_icons_is_caching(void); - -/** - * Sets the directory used to store buddy icon cache files. - * - * @param cache_dir The directory to store buddy icon cache files to. - */ -void purple_buddy_icons_set_cache_dir(const char *cache_dir); - -/** - * Returns the directory used to store buddy icon cache files. - * - * The default directory is PURPLEDIR/icons, unless otherwise specified - * by purple_buddy_icons_set_cache_dir(). - * - * @return The directory to store buddy icon cache files to. - */ -const char *purple_buddy_icons_get_cache_dir(void); - -/** - * Returns the buddy icon subsystem handle. - * - * @return The subsystem handle. - */ -void *purple_buddy_icons_get_handle(void); - -/** - * Initializes the buddy icon subsystem. - */ -void purple_buddy_icons_init(void); - -/** - * Uninitializes the buddy icon subsystem. - */ -void purple_buddy_icons_uninit(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Buddy Icon Helper API */ -/**************************************************************************/ -/*@{*/ - -/** - * Gets display size for a buddy icon - */ -void purple_buddy_icon_get_scale_size(PurpleBuddyIconSpec *spec, int *width, int *height); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_BUDDYICON_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2147 +0,0 @@ -/** - * @file certificate.c Public-Key Certificate API - * @ingroup core - */ - -/* - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "certificate.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "request.h" -#include "signals.h" -#include "util.h" - -/** List holding pointers to all registered certificate schemes */ -static GList *cert_schemes = NULL; -/** List of registered Verifiers */ -static GList *cert_verifiers = NULL; -/** List of registered Pools */ -static GList *cert_pools = NULL; - -/* - * TODO: Merge this with PurpleCertificateVerificationStatus for 3.0.0 */ -typedef enum { - PURPLE_CERTIFICATE_UNKNOWN_ERROR = -1, - - /* Not an error */ - PURPLE_CERTIFICATE_NO_PROBLEMS = 0, - - /* Non-fatal */ - PURPLE_CERTIFICATE_NON_FATALS_MASK = 0x0000FFFF, - - /* The certificate is self-signed. */ - PURPLE_CERTIFICATE_SELF_SIGNED = 0x01, - - /* The CA is not in libpurple's pool of certificates. */ - PURPLE_CERTIFICATE_CA_UNKNOWN = 0x02, - - /* The current time is before the certificate's specified - * activation time. - */ - PURPLE_CERTIFICATE_NOT_ACTIVATED = 0x04, - - /* The current time is after the certificate's specified expiration time */ - PURPLE_CERTIFICATE_EXPIRED = 0x08, - - /* The certificate's subject name doesn't match the expected */ - PURPLE_CERTIFICATE_NAME_MISMATCH = 0x10, - - /* No CA pool was found. This shouldn't happen... */ - PURPLE_CERTIFICATE_NO_CA_POOL = 0x20, - - /* Fatal */ - PURPLE_CERTIFICATE_FATALS_MASK = 0xFFFF0000, - - /* The signature chain could not be validated. Due to limitations in the - * the current API, this also indicates one of the CA certificates in the - * chain is expired (or not yet activated). FIXME 3.0.0 */ - PURPLE_CERTIFICATE_INVALID_CHAIN = 0x10000, - - /* The signature has been revoked. */ - PURPLE_CERTIFICATE_REVOKED = 0x20000, - - PURPLE_CERTIFICATE_LAST = 0x40000, -} PurpleCertificateInvalidityFlags; - -static const gchar * -invalidity_reason_to_string(PurpleCertificateInvalidityFlags flag) -{ - switch (flag) { - case PURPLE_CERTIFICATE_SELF_SIGNED: - return _("The certificate is self-signed and cannot be " - "automatically checked."); - break; - case PURPLE_CERTIFICATE_CA_UNKNOWN: - return _("The certificate is not trusted because no certificate " - "that can verify it is currently trusted."); - break; - case PURPLE_CERTIFICATE_NOT_ACTIVATED: - return _("The certificate is not valid yet."); - break; - case PURPLE_CERTIFICATE_EXPIRED: - return _("The certificate has expired and should not be " - "considered valid."); - break; - case PURPLE_CERTIFICATE_NAME_MISMATCH: - /* Translators: "domain" refers to a DNS domain (e.g. talk.google.com) */ - return _("The certificate presented is not issued to this domain."); - break; - case PURPLE_CERTIFICATE_NO_CA_POOL: - return _("You have no database of root certificates, so " - "this certificate cannot be validated."); - break; - case PURPLE_CERTIFICATE_INVALID_CHAIN: - return _("The certificate chain presented is invalid."); - break; - case PURPLE_CERTIFICATE_REVOKED: - return _("The certificate has been revoked."); - break; - case PURPLE_CERTIFICATE_UNKNOWN_ERROR: - default: - return _("An unknown certificate error occurred."); - break; - } -} - -void -purple_certificate_verify (PurpleCertificateVerifier *verifier, - const gchar *subject_name, GList *cert_chain, - PurpleCertificateVerifiedCallback cb, - gpointer cb_data) -{ - PurpleCertificateVerificationRequest *vrq; - PurpleCertificateScheme *scheme; - - g_return_if_fail(subject_name != NULL); - /* If you don't have a cert to check, why are you requesting that it - be verified? */ - g_return_if_fail(cert_chain != NULL); - g_return_if_fail(cb != NULL); - - /* Look up the CertificateScheme */ - scheme = purple_certificate_find_scheme(verifier->scheme_name); - g_return_if_fail(scheme); - - /* Check that at least the first cert in the chain matches the - Verifier scheme */ - g_return_if_fail(scheme == - ((PurpleCertificate *) (cert_chain->data))->scheme); - - /* Construct and fill in the request fields */ - vrq = g_new0(PurpleCertificateVerificationRequest, 1); - vrq->verifier = verifier; - vrq->scheme = scheme; - vrq->subject_name = g_strdup(subject_name); - vrq->cert_chain = purple_certificate_copy_list(cert_chain); - vrq->cb = cb; - vrq->cb_data = cb_data; - - /* Initiate verification */ - (verifier->start_verification)(vrq); -} - -void -purple_certificate_verify_complete(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateVerificationStatus st) -{ - PurpleCertificateVerifier *vr; - - g_return_if_fail(vrq); - - if (st == PURPLE_CERTIFICATE_VALID) { - purple_debug_info("certificate", - "Successfully verified certificate for %s\n", - vrq->subject_name); - } else { - purple_debug_error("certificate", - "Failed to verify certificate for %s\n", - vrq->subject_name); - } - - /* Pass the results on to the request's callback */ - (vrq->cb)(st, vrq->cb_data); - - /* And now to eliminate the request */ - /* Fetch the Verifier responsible... */ - vr = vrq->verifier; - /* ...and order it to KILL */ - (vr->destroy_request)(vrq); - - /* Now the internals have been cleaned up, so clean up the libpurple- - created elements */ - g_free(vrq->subject_name); - purple_certificate_destroy_list(vrq->cert_chain); - - /* A structure born - * to much ado - * and with so much within. - * It reaches now - * its quiet end. */ - g_free(vrq); -} - - -PurpleCertificate * -purple_certificate_copy(PurpleCertificate *crt) -{ - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme, NULL); - g_return_val_if_fail(crt->scheme->copy_certificate, NULL); - - return (crt->scheme->copy_certificate)(crt); -} - -GList * -purple_certificate_copy_list(GList *crt_list) -{ - GList *new_l, *l; - - /* First, make a shallow copy of the list */ - new_l = g_list_copy(crt_list); - - /* Now go through and actually duplicate each certificate */ - for (l = new_l; l; l = l->next) { - l->data = purple_certificate_copy(l->data); - } - - return new_l; -} - -void -purple_certificate_destroy (PurpleCertificate *crt) -{ - PurpleCertificateScheme *scheme; - - if (NULL == crt) return; - - scheme = crt->scheme; - - (scheme->destroy_certificate)(crt); -} - -void -purple_certificate_destroy_list (GList * crt_list) -{ - PurpleCertificate *crt; - GList *l; - - for (l=crt_list; l; l = l->next) { - crt = (PurpleCertificate *) l->data; - purple_certificate_destroy(crt); - } - - g_list_free(crt_list); -} - -gboolean -purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer) -{ - PurpleCertificateScheme *scheme; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(issuer, FALSE); - - scheme = crt->scheme; - g_return_val_if_fail(scheme, FALSE); - /* We can't compare two certs of unrelated schemes, obviously */ - g_return_val_if_fail(issuer->scheme == scheme, FALSE); - - return (scheme->signed_by)(crt, issuer); -} - -gboolean -purple_certificate_check_signature_chain_with_failing(GList *chain, - PurpleCertificate **failing) -{ - GList *cur; - PurpleCertificate *crt, *issuer; - gchar *uid; - time_t now, activation, expiration; - gboolean ret; - - g_return_val_if_fail(chain, FALSE); - - if (failing) - *failing = NULL; - - uid = purple_certificate_get_unique_id((PurpleCertificate *) chain->data); - purple_debug_info("certificate", - "Checking signature chain for uid=%s\n", - uid); - g_free(uid); - - /* If this is a single-certificate chain, say that it is valid */ - if (chain->next == NULL) { - purple_debug_info("certificate", - "...Singleton. We'll say it's valid.\n"); - return TRUE; - } - - now = time(NULL); - - /* Load crt with the first certificate */ - crt = (PurpleCertificate *)(chain->data); - /* And start with the second certificate in the chain */ - for ( cur = chain->next; cur; cur = cur->next ) { - - issuer = (PurpleCertificate *)(cur->data); - - uid = purple_certificate_get_unique_id(issuer); - - ret = purple_certificate_get_times(issuer, &activation, &expiration); - if (!ret || now < activation || now > expiration) { - if (!ret) - purple_debug_error("certificate", - "...Failed to get validity times for certificate %s\n" - "Chain is INVALID\n", uid); - else if (now > expiration) - purple_debug_error("certificate", - "...Issuer %s expired at %s\nChain is INVALID\n", - uid, ctime(&expiration)); - else - purple_debug_error("certificate", - "...Not-yet-activated issuer %s will be valid at %s\n" - "Chain is INVALID\n", uid, ctime(&activation)); - - if (failing) - *failing = crt; - - g_free(uid); - return FALSE; - } - - /* Check the signature for this link */ - if (! purple_certificate_signed_by(crt, issuer) ) { - purple_debug_error("certificate", - "...Bad or missing signature by %s\nChain is INVALID\n", - uid); - g_free(uid); - - if (failing) - *failing = crt; - - return FALSE; - } - - purple_debug_info("certificate", - "...Good signature by %s\n", - uid); - g_free(uid); - - /* The issuer is now the next crt whose signature is to be - checked */ - crt = issuer; - } - - /* If control reaches this point, the chain is valid */ - purple_debug_info("certificate", "Chain is VALID\n"); - return TRUE; -} - -gboolean -purple_certificate_check_signature_chain(GList *chain) -{ - return purple_certificate_check_signature_chain_with_failing(chain, NULL); -} - -PurpleCertificate * -purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename) -{ - g_return_val_if_fail(scheme, NULL); - g_return_val_if_fail(scheme->import_certificate, NULL); - g_return_val_if_fail(filename, NULL); - - return (scheme->import_certificate)(filename); -} - -gboolean -purple_certificate_export(const gchar *filename, PurpleCertificate *crt) -{ - PurpleCertificateScheme *scheme; - - g_return_val_if_fail(filename, FALSE); - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme, FALSE); - - scheme = crt->scheme; - g_return_val_if_fail(scheme->export_certificate, FALSE); - - return (scheme->export_certificate)(filename, crt); -} - -static gboolean -byte_arrays_equal(const GByteArray *array1, const GByteArray *array2) -{ - g_return_val_if_fail(array1 != NULL, FALSE); - g_return_val_if_fail(array2 != NULL, FALSE); - - return (array1->len == array2->len) && - (0 == memcmp(array1->data, array2->data, array1->len)); -} - -GByteArray * -purple_certificate_get_fingerprint_sha1(PurpleCertificate *crt) -{ - PurpleCertificateScheme *scheme; - GByteArray *fpr; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme, NULL); - - scheme = crt->scheme; - - g_return_val_if_fail(scheme->get_fingerprint_sha1, NULL); - - fpr = (scheme->get_fingerprint_sha1)(crt); - - return fpr; -} - -gchar * -purple_certificate_get_unique_id(PurpleCertificate *crt) -{ - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme, NULL); - g_return_val_if_fail(crt->scheme->get_unique_id, NULL); - - return (crt->scheme->get_unique_id)(crt); -} - -gchar * -purple_certificate_get_issuer_unique_id(PurpleCertificate *crt) -{ - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme, NULL); - g_return_val_if_fail(crt->scheme->get_issuer_unique_id, NULL); - - return (crt->scheme->get_issuer_unique_id)(crt); -} - -gchar * -purple_certificate_get_subject_name(PurpleCertificate *crt) -{ - PurpleCertificateScheme *scheme; - gchar *subject_name; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme, NULL); - - scheme = crt->scheme; - - g_return_val_if_fail(scheme->get_subject_name, NULL); - - subject_name = (scheme->get_subject_name)(crt); - - return subject_name; -} - -gboolean -purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name) -{ - PurpleCertificateScheme *scheme; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme, FALSE); - g_return_val_if_fail(name, FALSE); - - scheme = crt->scheme; - - g_return_val_if_fail(scheme->check_subject_name, FALSE); - - return (scheme->check_subject_name)(crt, name); -} - -gboolean -purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration) -{ - PurpleCertificateScheme *scheme; - - g_return_val_if_fail(crt, FALSE); - - scheme = crt->scheme; - - g_return_val_if_fail(scheme, FALSE); - - /* If both provided references are NULL, what are you doing calling - this? */ - g_return_val_if_fail( (activation != NULL) || (expiration != NULL), FALSE); - - /* Throw the request on down to the certscheme */ - return (scheme->get_times)(crt, activation, expiration); -} - -gchar * -purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) -{ - gchar *path; - gchar *esc_scheme_name, *esc_name, *esc_id; - - g_return_val_if_fail(pool, NULL); - g_return_val_if_fail(pool->scheme_name, NULL); - g_return_val_if_fail(pool->name, NULL); - - /* Escape all the elements for filesystem-friendliness */ - esc_scheme_name = pool ? g_strdup(purple_escape_filename(pool->scheme_name)) : NULL; - esc_name = pool ? g_strdup(purple_escape_filename(pool->name)) : NULL; - esc_id = id ? g_strdup(purple_escape_filename(id)) : NULL; - - path = g_build_filename(purple_user_dir(), - "certificates", /* TODO: constantize this? */ - esc_scheme_name, - esc_name, - esc_id, - NULL); - - g_free(esc_scheme_name); - g_free(esc_name); - g_free(esc_id); - return path; -} - -gboolean -purple_certificate_pool_usable(PurpleCertificatePool *pool) -{ - g_return_val_if_fail(pool, FALSE); - g_return_val_if_fail(pool->scheme_name, FALSE); - - /* Check that the pool's scheme is loaded */ - if (purple_certificate_find_scheme(pool->scheme_name) == NULL) { - return FALSE; - } - - return TRUE; -} - -PurpleCertificateScheme * -purple_certificate_pool_get_scheme(PurpleCertificatePool *pool) -{ - g_return_val_if_fail(pool, NULL); - g_return_val_if_fail(pool->scheme_name, NULL); - - return purple_certificate_find_scheme(pool->scheme_name); -} - -gboolean -purple_certificate_pool_contains(PurpleCertificatePool *pool, const gchar *id) -{ - g_return_val_if_fail(pool, FALSE); - g_return_val_if_fail(id, FALSE); - g_return_val_if_fail(pool->cert_in_pool, FALSE); - - return (pool->cert_in_pool)(id); -} - -PurpleCertificate * -purple_certificate_pool_retrieve(PurpleCertificatePool *pool, const gchar *id) -{ - g_return_val_if_fail(pool, NULL); - g_return_val_if_fail(id, NULL); - g_return_val_if_fail(pool->get_cert, NULL); - - return (pool->get_cert)(id); -} - -gboolean -purple_certificate_pool_store(PurpleCertificatePool *pool, const gchar *id, PurpleCertificate *crt) -{ - gboolean ret = FALSE; - - g_return_val_if_fail(pool, FALSE); - g_return_val_if_fail(id, FALSE); - g_return_val_if_fail(pool->put_cert, FALSE); - - /* Whether crt->scheme matches find_scheme(pool->scheme_name) is not - relevant... I think... */ - g_return_val_if_fail( - g_ascii_strcasecmp(pool->scheme_name, crt->scheme->name) == 0, - FALSE); - - ret = (pool->put_cert)(id, crt); - - /* Signal that the certificate was stored if success*/ - if (ret) { - purple_signal_emit(pool, "certificate-stored", - pool, id); - } - - return ret; -} - -gboolean -purple_certificate_pool_delete(PurpleCertificatePool *pool, const gchar *id) -{ - gboolean ret = FALSE; - - g_return_val_if_fail(pool, FALSE); - g_return_val_if_fail(id, FALSE); - g_return_val_if_fail(pool->delete_cert, FALSE); - - ret = (pool->delete_cert)(id); - - /* Signal that the certificate was deleted if success */ - if (ret) { - purple_signal_emit(pool, "certificate-deleted", - pool, id); - } - - return ret; -} - -GList * -purple_certificate_pool_get_idlist(PurpleCertificatePool *pool) -{ - g_return_val_if_fail(pool, NULL); - g_return_val_if_fail(pool->get_idlist, NULL); - - return (pool->get_idlist)(); -} - -void -purple_certificate_pool_destroy_idlist(GList *idlist) -{ - GList *l; - - /* Iterate through and free them strings */ - for ( l = idlist; l; l = l->next ) { - g_free(l->data); - } - - g_list_free(idlist); -} - - -/****************************************************************************/ -/* Builtin Verifiers, Pools, etc. */ -/****************************************************************************/ - -static void -x509_singleuse_verify_cb (PurpleCertificateVerificationRequest *vrq, gint id) -{ - g_return_if_fail(vrq); - - purple_debug_info("certificate/x509_singleuse", - "VRQ on cert from %s gave %d\n", - vrq->subject_name, id); - - /* Signal what happened back to the caller */ - if (1 == id) { - /* Accepted! */ - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_VALID); - } else { - /* Not accepted */ - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_INVALID); - - } -} - -static void -x509_singleuse_start_verify (PurpleCertificateVerificationRequest *vrq) -{ - gchar *sha_asc; - GByteArray *sha_bin; - gchar *cn; - const gchar *cn_match; - gchar *primary, *secondary; - PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data; - - /* Pull out the SHA1 checksum */ - sha_bin = purple_certificate_get_fingerprint_sha1(crt); - /* Now decode it for display */ - sha_asc = purple_base16_encode_chunked(sha_bin->data, - sha_bin->len); - - /* Get the cert Common Name */ - cn = purple_certificate_get_subject_name(crt); - - /* Determine whether the name matches */ - if (purple_certificate_check_subject_name(crt, vrq->subject_name)) { - cn_match = ""; - } else { - cn_match = _("(DOES NOT MATCH)"); - } - - /* Make messages */ - primary = g_strdup_printf(_("%s has presented the following certificate for just-this-once use:"), vrq->subject_name); - secondary = g_strdup_printf(_("Common name: %s %s\nFingerprint (SHA1): %s"), cn, cn_match, sha_asc); - - /* Make a semi-pretty display */ - purple_request_accept_cancel( - vrq->cb_data, /* TODO: Find what the handle ought to be */ - _("Single-use Certificate Verification"), - primary, - secondary, - 0, /* Accept by default */ - NULL, /* No account */ - NULL, /* No other user */ - NULL, /* No associated conversation */ - vrq, - x509_singleuse_verify_cb, - x509_singleuse_verify_cb ); - - /* Cleanup */ - g_free(primary); - g_free(secondary); - g_free(sha_asc); - g_byte_array_free(sha_bin, TRUE); -} - -static void -x509_singleuse_destroy_request (PurpleCertificateVerificationRequest *vrq) -{ - /* I don't do anything! */ -} - -static PurpleCertificateVerifier x509_singleuse = { - "x509", /* Scheme name */ - "singleuse", /* Verifier name */ - x509_singleuse_start_verify, /* start_verification function */ - x509_singleuse_destroy_request, /* Request cleanup operation */ - - NULL, - NULL, - NULL, - NULL -}; - - - -/***** X.509 Certificate Authority pool, keyed by Distinguished Name *****/ -/* This is implemented in what may be the most inefficient and bugprone way - possible; however, future optimizations should not be difficult. */ - -static PurpleCertificatePool x509_ca; - -/** Holds a key-value pair for quickish certificate lookup */ -typedef struct { - gchar *dn; - PurpleCertificate *crt; -} x509_ca_element; - -static void -x509_ca_element_free(x509_ca_element *el) -{ - if (NULL == el) return; - - g_free(el->dn); - purple_certificate_destroy(el->crt); - g_free(el); -} - -/** System directory to probe for CA certificates */ -/* This is set in the lazy_init function */ -static GList *x509_ca_paths = NULL; - -/** A list of loaded CAs, populated from the above path whenever the lazy_init - happens. Contains pointers to x509_ca_elements */ -static GList *x509_ca_certs = NULL; - -/** Used for lazy initialization purposes. */ -static gboolean x509_ca_initialized = FALSE; - -/** Adds a certificate to the in-memory cache, doing nothing else */ -static gboolean -x509_ca_quiet_put_cert(PurpleCertificate *crt) -{ - x509_ca_element *el; - - /* lazy_init calls this function, so calling lazy_init here is a - Bad Thing */ - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme, FALSE); - /* Make sure that this is some kind of X.509 certificate */ - /* TODO: Perhaps just check crt->scheme->name instead? */ - g_return_val_if_fail(crt->scheme == purple_certificate_find_scheme(x509_ca.scheme_name), FALSE); - - el = g_new0(x509_ca_element, 1); - el->dn = purple_certificate_get_unique_id(crt); - el->crt = purple_certificate_copy(crt); - x509_ca_certs = g_list_prepend(x509_ca_certs, el); - - return TRUE; -} - -/* Since the libpurple CertificatePools get registered before plugins are - loaded, an X.509 Scheme is generally not available when x509_ca_init is - called, but x509_ca requires X.509 operations in order to properly load. - - To solve this, I present the lazy_init function. It attempts to finish - initialization of the Pool, but it usually fails when it is called from - x509_ca_init. However, this is OK; initialization is then simply deferred - until someone tries to use functions from the pool. */ -static gboolean -x509_ca_lazy_init(void) -{ - PurpleCertificateScheme *x509; - GDir *certdir; - const gchar *entry; - GPatternSpec *pempat; - GList *iter = NULL; - - if (x509_ca_initialized) return TRUE; - - /* Check that X.509 is registered */ - x509 = purple_certificate_find_scheme(x509_ca.scheme_name); - if ( !x509 ) { - purple_debug_warning("certificate/x509/ca", - "Lazy init failed because an X.509 Scheme " - "is not yet registered. Maybe it will be " - "better later.\n"); - return FALSE; - } - - /* Use a glob to only read .pem files */ - pempat = g_pattern_spec_new("*.pem"); - - /* Populate the certificates pool from the search path(s) */ - for (iter = x509_ca_paths; iter; iter = iter->next) { - certdir = g_dir_open(iter->data, 0, NULL); - if (!certdir) { - purple_debug_error("certificate/x509/ca", "Couldn't open location '%s'\n", (const char *)iter->data); - continue; - } - - while ( (entry = g_dir_read_name(certdir)) ) { - gchar *fullpath; - PurpleCertificate *crt; - - if ( !g_pattern_match_string(pempat, entry) ) { - continue; - } - - fullpath = g_build_filename(iter->data, entry, NULL); - - /* TODO: Respond to a failure in the following? */ - crt = purple_certificate_import(x509, fullpath); - - if (x509_ca_quiet_put_cert(crt)) { - purple_debug_info("certificate/x509/ca", - "Loaded %s\n", - fullpath); - } else { - purple_debug_error("certificate/x509/ca", - "Failed to load %s\n", - fullpath); - } - - purple_certificate_destroy(crt); - g_free(fullpath); - } - g_dir_close(certdir); - } - - g_pattern_spec_free(pempat); - - purple_debug_info("certificate/x509/ca", - "Lazy init completed.\n"); - x509_ca_initialized = TRUE; - return TRUE; -} - -static gboolean -x509_ca_init(void) -{ - /* Attempt to point at the appropriate system path */ - if (NULL == x509_ca_paths) { - - const char *sc; - if ((sc = getenv("QUTECOM_SSL_CERTIFICATES_DIR"))) - x509_ca_paths = g_list_append(NULL, g_strdup(sc)); - -#ifdef _WIN32 - x509_ca_paths = g_list_append(NULL, g_build_filename(DATADIR, - "ca-certs", NULL)); -#else -# ifdef SSL_CERTIFICATES_DIR - x509_ca_paths = g_list_append(NULL, g_strdup(SSL_CERTIFICATES_DIR)); -# else -# endif - x509_ca_paths = g_list_append(x509_ca_paths, - g_build_filename(DATADIR, "purple", "ca-certs", NULL)); -#endif - } - - /* Attempt to initialize now, but if it doesn't work, that's OK; - it will get done later */ - if ( ! x509_ca_lazy_init()) { - purple_debug_info("certificate/x509/ca", - "Init failed, probably because a " - "dependency is not yet registered. " - "It has been deferred to later.\n"); - } - - return TRUE; -} - -static void -x509_ca_uninit(void) -{ - GList *l; - - for (l = x509_ca_certs; l; l = l->next) { - x509_ca_element *el = l->data; - x509_ca_element_free(el); - } - g_list_free(x509_ca_certs); - x509_ca_certs = NULL; - x509_ca_initialized = FALSE; - g_list_foreach(x509_ca_paths, (GFunc)g_free, NULL); - g_list_free(x509_ca_paths); - x509_ca_paths = NULL; -} - -/** Look up a ca_element by dn */ -static x509_ca_element * -x509_ca_locate_cert(GList *lst, const gchar *dn) -{ - GList *cur; - - for (cur = lst; cur; cur = cur->next) { - x509_ca_element *el = cur->data; - if (purple_strequal(dn, el->dn)) { - return el; - } - } - return NULL; -} - -static gboolean -x509_ca_cert_in_pool(const gchar *id) -{ - g_return_val_if_fail(x509_ca_lazy_init(), FALSE); - g_return_val_if_fail(id, FALSE); - - if (x509_ca_locate_cert(x509_ca_certs, id) != NULL) { - return TRUE; - } else { - return FALSE; - } - - return FALSE; -} - -static PurpleCertificate * -x509_ca_get_cert(const gchar *id) -{ - PurpleCertificate *crt = NULL; - x509_ca_element *el; - - g_return_val_if_fail(x509_ca_lazy_init(), NULL); - g_return_val_if_fail(id, NULL); - - /* Search the memory-cached pool */ - el = x509_ca_locate_cert(x509_ca_certs, id); - - if (el != NULL) { - /* Make a copy of the memcached one for the function caller - to play with */ - crt = purple_certificate_copy(el->crt); - } else { - crt = NULL; - } - - return crt; -} - -static gboolean -x509_ca_put_cert(const gchar *id, PurpleCertificate *crt) -{ - gboolean ret = FALSE; - - g_return_val_if_fail(x509_ca_lazy_init(), FALSE); - - /* TODO: This is a quick way of doing this. At some point the change - ought to be flushed to disk somehow. */ - ret = x509_ca_quiet_put_cert(crt); - - return ret; -} - -static gboolean -x509_ca_delete_cert(const gchar *id) -{ - x509_ca_element *el; - - g_return_val_if_fail(x509_ca_lazy_init(), FALSE); - g_return_val_if_fail(id, FALSE); - - /* Is the id even in the pool? */ - el = x509_ca_locate_cert(x509_ca_certs, id); - if ( el == NULL ) { - purple_debug_warning("certificate/x509/ca", - "Id %s wasn't in the pool\n", - id); - return FALSE; - } - - /* Unlink it from the memory cache and destroy it */ - x509_ca_certs = g_list_remove(x509_ca_certs, el); - x509_ca_element_free(el); - - return TRUE; -} - -static GList * -x509_ca_get_idlist(void) -{ - GList *l, *idlist; - - g_return_val_if_fail(x509_ca_lazy_init(), NULL); - - idlist = NULL; - for (l = x509_ca_certs; l; l = l->next) { - x509_ca_element *el = l->data; - idlist = g_list_prepend(idlist, g_strdup(el->dn)); - } - - return idlist; -} - - -static PurpleCertificatePool x509_ca = { - "x509", /* Scheme name */ - "ca", /* Pool name */ - N_("Certificate Authorities"),/* User-friendly name */ - NULL, /* Internal data */ - x509_ca_init, /* init */ - x509_ca_uninit, /* uninit */ - x509_ca_cert_in_pool, /* Certificate exists? */ - x509_ca_get_cert, /* Cert retriever */ - x509_ca_put_cert, /* Cert writer */ - x509_ca_delete_cert, /* Cert remover */ - x509_ca_get_idlist, /* idlist retriever */ - - NULL, - NULL, - NULL, - NULL - -}; - - - -/***** Cache of certificates given by TLS/SSL peers *****/ -static PurpleCertificatePool x509_tls_peers; - -static gboolean -x509_tls_peers_init(void) -{ - gchar *poolpath; - int ret; - - /* Set up key cache here if it isn't already done */ - poolpath = purple_certificate_pool_mkpath(&x509_tls_peers, NULL); - ret = purple_build_dir(poolpath, 0700); /* Make it this user only */ - - if (ret != 0) - purple_debug_info("certificate/tls_peers", - "Could not create %s. Certificates will not be cached.\n", - poolpath); - - g_free(poolpath); - - return TRUE; -} - -static gboolean -x509_tls_peers_cert_in_pool(const gchar *id) -{ - gchar *keypath; - gboolean ret = FALSE; - - g_return_val_if_fail(id, FALSE); - - keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id); - - ret = g_file_test(keypath, G_FILE_TEST_IS_REGULAR); - - g_free(keypath); - return ret; -} - -static PurpleCertificate * -x509_tls_peers_get_cert(const gchar *id) -{ - PurpleCertificateScheme *x509; - PurpleCertificate *crt; - gchar *keypath; - - g_return_val_if_fail(id, NULL); - - /* Is it in the pool? */ - if ( !x509_tls_peers_cert_in_pool(id) ) { - return NULL; - } - - /* Look up the X.509 scheme */ - x509 = purple_certificate_find_scheme("x509"); - g_return_val_if_fail(x509, NULL); - - /* Okay, now find and load that key */ - keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id); - crt = purple_certificate_import(x509, keypath); - - g_free(keypath); - - return crt; -} - -static gboolean -x509_tls_peers_put_cert(const gchar *id, PurpleCertificate *crt) -{ - gboolean ret = FALSE; - gchar *keypath; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme, FALSE); - /* Make sure that this is some kind of X.509 certificate */ - /* TODO: Perhaps just check crt->scheme->name instead? */ - g_return_val_if_fail(crt->scheme == purple_certificate_find_scheme(x509_tls_peers.scheme_name), FALSE); - - /* Work out the filename and export */ - keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id); - ret = purple_certificate_export(keypath, crt); - - g_free(keypath); - return ret; -} - -static gboolean -x509_tls_peers_delete_cert(const gchar *id) -{ - gboolean ret = FALSE; - gchar *keypath; - - g_return_val_if_fail(id, FALSE); - - /* Is the id even in the pool? */ - if (!x509_tls_peers_cert_in_pool(id)) { - purple_debug_warning("certificate/tls_peers", - "Id %s wasn't in the pool\n", - id); - return FALSE; - } - - /* OK, so work out the keypath and delete the thing */ - keypath = purple_certificate_pool_mkpath(&x509_tls_peers, id); - if ( unlink(keypath) != 0 ) { - purple_debug_error("certificate/tls_peers", - "Unlink of %s failed!\n", - keypath); - ret = FALSE; - } else { - ret = TRUE; - } - - g_free(keypath); - return ret; -} - -static GList * -x509_tls_peers_get_idlist(void) -{ - GList *idlist = NULL; - GDir *dir; - const gchar *entry; - gchar *poolpath; - - /* Get a handle on the pool directory */ - poolpath = purple_certificate_pool_mkpath(&x509_tls_peers, NULL); - dir = g_dir_open(poolpath, - 0, /* No flags */ - NULL); /* Not interested in what the error is */ - g_free(poolpath); - - g_return_val_if_fail(dir, NULL); - - /* Traverse the directory listing and create an idlist */ - while ( (entry = g_dir_read_name(dir)) != NULL ) { - /* Unescape the filename */ - const char *unescaped = purple_unescape_filename(entry); - - /* Copy the entry name into our list (GLib owns the original - string) */ - idlist = g_list_prepend(idlist, g_strdup(unescaped)); - } - - /* Release the directory */ - g_dir_close(dir); - - return idlist; -} - -static PurpleCertificatePool x509_tls_peers = { - "x509", /* Scheme name */ - "tls_peers", /* Pool name */ - N_("SSL Peers Cache"), /* User-friendly name */ - NULL, /* Internal data */ - x509_tls_peers_init, /* init */ - NULL, /* uninit not required */ - x509_tls_peers_cert_in_pool, /* Certificate exists? */ - x509_tls_peers_get_cert, /* Cert retriever */ - x509_tls_peers_put_cert, /* Cert writer */ - x509_tls_peers_delete_cert, /* Cert remover */ - x509_tls_peers_get_idlist, /* idlist retriever */ - - NULL, - NULL, - NULL, - NULL -}; - - -/***** A Verifier that uses the tls_peers cache and the CA pool to validate certificates *****/ -static PurpleCertificateVerifier x509_tls_cached; - - -/* The following is several hacks piled together and needs to be fixed. - * It exists because show_cert (see its comments) needs the original reason - * given to user_auth in order to rebuild the dialog. - */ -/* TODO: This will cause a ua_ctx to become memleaked if the request(s) get - closed by handle or otherwise abnormally. */ -typedef struct { - PurpleCertificateVerificationRequest *vrq; - gchar *reason; -} x509_tls_cached_ua_ctx; - -static x509_tls_cached_ua_ctx * -x509_tls_cached_ua_ctx_new(PurpleCertificateVerificationRequest *vrq, - const gchar *reason) -{ - x509_tls_cached_ua_ctx *c; - - c = g_new0(x509_tls_cached_ua_ctx, 1); - c->vrq = vrq; - c->reason = g_strdup(reason); - - return c; -} - - -static void -x509_tls_cached_ua_ctx_free(x509_tls_cached_ua_ctx *c) -{ - g_return_if_fail(c); - g_free(c->reason); - g_free(c); -} - -static void -x509_tls_cached_user_auth(PurpleCertificateVerificationRequest *vrq, - const gchar *reason); - -static void -x509_tls_cached_show_cert(x509_tls_cached_ua_ctx *c, gint id) -{ - PurpleCertificate *disp_crt = c->vrq->cert_chain->data; - - /* Since clicking a button closes the request, show it again */ - x509_tls_cached_user_auth(c->vrq, c->reason); - - /* Show the certificate AFTER re-opening the dialog so that this - appears above the other */ - purple_certificate_display_x509(disp_crt); - - x509_tls_cached_ua_ctx_free(c); -} - -static void -x509_tls_cached_user_auth_cb (x509_tls_cached_ua_ctx *c, gint id) -{ - PurpleCertificateVerificationRequest *vrq; - PurpleCertificatePool *tls_peers; - - g_return_if_fail(c); - g_return_if_fail(c->vrq); - - vrq = c->vrq; - - x509_tls_cached_ua_ctx_free(c); - - tls_peers = purple_certificate_find_pool("x509","tls_peers"); - - if (2 == id) { - gchar *cache_id = vrq->subject_name; - purple_debug_info("certificate/x509/tls_cached", - "User ACCEPTED cert\nCaching first in chain for future use as %s...\n", - cache_id); - - purple_certificate_pool_store(tls_peers, cache_id, - vrq->cert_chain->data); - - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_VALID); - } else { - purple_debug_warning("certificate/x509/tls_cached", - "User REJECTED cert\n"); - purple_certificate_verify_complete(vrq, - PURPLE_CERTIFICATE_INVALID); - } -} - -static void -x509_tls_cached_user_auth_accept_cb(x509_tls_cached_ua_ctx *c, gint ignore) -{ - x509_tls_cached_user_auth_cb(c, 2); -} - -static void -x509_tls_cached_user_auth_reject_cb(x509_tls_cached_ua_ctx *c, gint ignore) -{ - x509_tls_cached_user_auth_cb(c, 1); -} - -/** Validates a certificate by asking the user - * @param reason String to explain why the user needs to accept/refuse the - * certificate. - * @todo Needs a handle argument - */ -static void -x509_tls_cached_user_auth(PurpleCertificateVerificationRequest *vrq, - const gchar *reason) -{ - gchar *primary; - - /* Make messages */ - primary = g_strdup_printf(_("Accept certificate for %s?"), - vrq->subject_name); - - /* Make a semi-pretty display */ - purple_request_action( - vrq->cb_data, /* TODO: Find what the handle ought to be */ - _("SSL Certificate Verification"), - primary, - reason, - 0, /* Accept by default */ - NULL, /* No account */ - NULL, /* No other user */ - NULL, /* No associated conversation */ - x509_tls_cached_ua_ctx_new(vrq, reason), - 3, /* Number of actions */ - _("Accept"), x509_tls_cached_user_auth_accept_cb, - _("Reject"), x509_tls_cached_user_auth_reject_cb, - _("_View Certificate..."), x509_tls_cached_show_cert); - - /* Cleanup */ - g_free(primary); -} - -static void -x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateInvalidityFlags flags); - -static void -x509_tls_cached_complete(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateInvalidityFlags flags) -{ - PurpleCertificatePool *tls_peers; - PurpleCertificate *peer_crt = vrq->cert_chain->data; - - if (flags & PURPLE_CERTIFICATE_FATALS_MASK) { - /* TODO: Also print any other warnings? */ - const gchar *error; - gchar *tmp, *secondary; - - if (flags & PURPLE_CERTIFICATE_INVALID_CHAIN) - error = invalidity_reason_to_string(PURPLE_CERTIFICATE_INVALID_CHAIN); - else if (flags & PURPLE_CERTIFICATE_REVOKED) - error = invalidity_reason_to_string(PURPLE_CERTIFICATE_REVOKED); - else - error = invalidity_reason_to_string(PURPLE_CERTIFICATE_UNKNOWN_ERROR); - - tmp = g_strdup_printf(_("The certificate for %s could not be validated."), - vrq->subject_name); - secondary = g_strconcat(tmp, " ", error, NULL); - g_free(tmp); - - purple_notify_error(NULL, /* TODO: Probably wrong. */ - _("SSL Certificate Error"), - _("Unable to validate certificate"), - secondary); - g_free(secondary); - - purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_INVALID); - return; - } else if (flags & PURPLE_CERTIFICATE_NON_FATALS_MASK) { - /* Non-fatal error. Prompt the user. */ - gchar *tmp; - GString *errors; - guint32 i = 1; - - tmp = g_strdup_printf(_("The certificate for %s could not be validated."), - vrq->subject_name); - errors = g_string_new(tmp); - g_free(tmp); - - errors = g_string_append_c(errors, '\n'); - - /* Special case a name mismatch because we want to display the two names... */ - if (flags & PURPLE_CERTIFICATE_NAME_MISMATCH) { - gchar *sn = purple_certificate_get_subject_name(peer_crt); - - if (sn) { - g_string_append_printf(errors, _("The certificate claims to be " - "from \"%s\" instead. This could mean that you are " - "not connecting to the service you believe you are."), - sn); - g_free(sn); - - flags &= ~PURPLE_CERTIFICATE_NAME_MISMATCH; - } - } - - while (i != PURPLE_CERTIFICATE_LAST) { - if (flags & i) { - errors = g_string_append_c(errors, '\n'); - g_string_append(errors, invalidity_reason_to_string(i)); - } - - i <<= 1; - } - - x509_tls_cached_user_auth(vrq, errors->str); - g_string_free(errors, TRUE); - return; - } - - /* If we reach this point, the certificate is good. */ - - /* Look up the local cache and store it there for future use */ - tls_peers = purple_certificate_find_pool(x509_tls_cached.scheme_name, - "tls_peers"); - if (tls_peers) { - if (!purple_certificate_pool_store(tls_peers,vrq->subject_name, - peer_crt)) { - purple_debug_error("certificate/x509/tls_cached", - "FAILED to cache peer certificate\n"); - } - } else { - purple_debug_error("certificate/x509/tls_cached", - "Unable to locate tls_peers certificate cache.\n"); - } - - purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_VALID); -} - -static void -x509_tls_cached_cert_in_cache(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateInvalidityFlags flags) -{ - /* TODO: Looking this up by name over and over is expensive. - Fix, please! */ - PurpleCertificatePool *tls_peers = - purple_certificate_find_pool(x509_tls_cached.scheme_name, - "tls_peers"); - - /* The peer's certificate should be the first in the list */ - PurpleCertificate *peer_crt = - (PurpleCertificate *) vrq->cert_chain->data; - - PurpleCertificate *cached_crt; - GByteArray *peer_fpr, *cached_fpr; - - /* Load up the cached certificate */ - cached_crt = purple_certificate_pool_retrieve( - tls_peers, vrq->subject_name); - if ( !cached_crt ) { - purple_debug_warning("certificate/x509/tls_cached", - "Lookup failed on cached certificate!\n" - "Falling back to full verification.\n"); - /* vrq now becomes the problem of unknown_peer */ - x509_tls_cached_unknown_peer(vrq, flags); - return; - } - - /* Now get SHA1 sums for both and compare them */ - /* TODO: This is not an elegant way to compare certs */ - peer_fpr = purple_certificate_get_fingerprint_sha1(peer_crt); - cached_fpr = purple_certificate_get_fingerprint_sha1(cached_crt); - if (!memcmp(peer_fpr->data, cached_fpr->data, peer_fpr->len)) { - purple_debug_info("certificate/x509/tls_cached", - "Peer cert matched cached\n"); - x509_tls_cached_complete(vrq, flags); - } else { - purple_debug_error("certificate/x509/tls_cached", - "Peer cert did NOT match cached\n"); - /* vrq now becomes the problem of the user */ - x509_tls_cached_unknown_peer(vrq, flags); - } - - purple_certificate_destroy(cached_crt); - g_byte_array_free(peer_fpr, TRUE); - g_byte_array_free(cached_fpr, TRUE); -} - -/* - * This is called from two points in x509_tls_cached_unknown_peer below - * once we've verified the signature chain is valid. Now we need to verify - * the subject name of the certificate. - */ -static void -x509_tls_cached_check_subject_name(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateInvalidityFlags flags) -{ - PurpleCertificate *peer_crt; - GList *chain = vrq->cert_chain; - - peer_crt = (PurpleCertificate *) chain->data; - - /* Last, check that the hostname matches */ - if ( ! purple_certificate_check_subject_name(peer_crt, - vrq->subject_name) ) { - gchar *sn = purple_certificate_get_subject_name(peer_crt); - - flags |= PURPLE_CERTIFICATE_NAME_MISMATCH; - purple_debug_error("certificate/x509/tls_cached", - "Name mismatch: Certificate given for %s " - "has a name of %s\n", - vrq->subject_name, sn); - } - - x509_tls_cached_complete(vrq, flags); -} - -/* For when we've never communicated with this party before */ -/* TODO: Need ways to specify possibly multiple problems with a cert, or at - least reprioritize them. - */ -static void -x509_tls_cached_unknown_peer(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateInvalidityFlags flags) -{ - PurpleCertificatePool *ca; - PurpleCertificate *peer_crt; - PurpleCertificate *ca_crt, *end_crt; - PurpleCertificate *failing_crt; - GList *chain = vrq->cert_chain; - GByteArray *last_fpr, *ca_fpr; - gchar *ca_id; - - peer_crt = (PurpleCertificate *) chain->data; - - /* TODO: Figure out a way to check for a bad signature, as opposed to - "not self-signed" */ - if ( purple_certificate_signed_by(peer_crt, peer_crt) ) { - flags |= PURPLE_CERTIFICATE_SELF_SIGNED; - - purple_debug_info("certificate/x509/tls_cached", - "Certificate for %s is self-signed.\n", - vrq->subject_name); - - x509_tls_cached_check_subject_name(vrq, flags); - return; - } /* if (self signed) */ - - /* Next, attempt to verify the last certificate against a CA */ - ca = purple_certificate_find_pool(x509_tls_cached.scheme_name, "ca"); - - /* Next, check that the certificate chain is valid */ - if (!purple_certificate_check_signature_chain_with_failing(chain, - &failing_crt)) - { - gboolean chain_validated = FALSE; - /* - * Check if the failing certificate is in the CA store. If it is, then - * consider this fully validated. This works around issues with some - * prominent intermediate CAs whose signature is md5WithRSAEncryption. - * I'm looking at CACert Class 3 here. See #4458 for details. - */ - if (ca) { - gchar *uid = purple_certificate_get_unique_id(failing_crt); - PurpleCertificate *ca_crt = purple_certificate_pool_retrieve(ca, uid); - if (ca_crt != NULL) { - GByteArray *failing_fpr; - GByteArray *ca_fpr; - failing_fpr = purple_certificate_get_fingerprint_sha1(failing_crt); - ca_fpr = purple_certificate_get_fingerprint_sha1(ca_crt); - if (byte_arrays_equal(failing_fpr, ca_fpr)) { - purple_debug_info("certificate/x509/tls_cached", - "Full chain verification failed (probably a bad " - "signature algorithm), but found the last " - "certificate %s in the CA pool.\n", uid); - chain_validated = TRUE; - } - - g_byte_array_free(failing_fpr, TRUE); - g_byte_array_free(ca_fpr, TRUE); - } - - purple_certificate_destroy(ca_crt); - g_free(uid); - } - - /* - * If we get here, either the cert matched the stuff right above - * or it didn't, in which case we give up and complain to the user. - */ - if (!chain_validated) - /* TODO: Tell the user where the chain broke? */ - flags |= PURPLE_CERTIFICATE_INVALID_CHAIN; - - x509_tls_cached_check_subject_name(vrq, flags); - return; - } /* if (signature chain not good) */ - - /* If, for whatever reason, there is no Certificate Authority pool - loaded, we'll verify the subject name and then warn about thsi. */ - if ( !ca ) { - purple_debug_error("certificate/x509/tls_cached", - "No X.509 Certificate Authority pool " - "could be found!\n"); - - flags |= PURPLE_CERTIFICATE_NO_CA_POOL; - - x509_tls_cached_check_subject_name(vrq, flags); - return; - } - - end_crt = g_list_last(chain)->data; - - /* Attempt to look up the last certificate's issuer */ - ca_id = purple_certificate_get_issuer_unique_id(end_crt); - purple_debug_info("certificate/x509/tls_cached", - "Checking for a CA with DN=%s\n", - ca_id); - ca_crt = purple_certificate_pool_retrieve(ca, ca_id); - if ( NULL == ca_crt ) { - flags |= PURPLE_CERTIFICATE_CA_UNKNOWN; - - purple_debug_warning("certificate/x509/tls_cached", - "Certificate Authority with DN='%s' not " - "found. I'll prompt the user, I guess.\n", - ca_id); - g_free(ca_id); - - x509_tls_cached_check_subject_name(vrq, flags); - return; - } - - g_free(ca_id); - - /* - * Check the fingerprints; if they match, then this certificate *is* one - * of the designated "trusted roots", and we don't need to verify the - * signature. This is good because some of the older roots are self-signed - * with bad hash algorithms that we don't want to allow in any other - * circumstances (one of Verisign's root CAs is self-signed with MD2). - * - * If the fingerprints don't match, we'll fall back to checking the - * signature. - * - * GnuTLS doesn't seem to include the final root in the verification - * list, so this check will never succeed. NSS *does* include it in - * the list, so here we are. - */ - last_fpr = purple_certificate_get_fingerprint_sha1(end_crt); - ca_fpr = purple_certificate_get_fingerprint_sha1(ca_crt); - - if ( !byte_arrays_equal(last_fpr, ca_fpr) && - !purple_certificate_signed_by(end_crt, ca_crt) ) - { - /* TODO: If signed_by ever returns a reason, maybe mention - that, too. */ - /* TODO: Also mention the CA involved. While I could do this - now, a full DN is a little much with which to assault the - user's poor, leaky eyes. */ - flags |= PURPLE_CERTIFICATE_INVALID_CHAIN; - } - - g_byte_array_free(ca_fpr, TRUE); - g_byte_array_free(last_fpr, TRUE); - - purple_certificate_destroy(ca_crt); - - x509_tls_cached_check_subject_name(vrq, flags); -} - -static void -x509_tls_cached_start_verify(PurpleCertificateVerificationRequest *vrq) -{ - const gchar *tls_peers_name = "tls_peers"; /* Name of local cache */ - PurpleCertificatePool *tls_peers; - time_t now, activation, expiration; - PurpleCertificateInvalidityFlags flags = PURPLE_CERTIFICATE_NO_PROBLEMS; - gboolean ret; - - g_return_if_fail(vrq); - - purple_debug_info("certificate/x509/tls_cached", - "Starting verify for %s\n", - vrq->subject_name); - - /* - * Verify the first certificate (the main one) has been activated and - * isn't expired, i.e. activation < now < expiration. - */ - now = time(NULL); - ret = purple_certificate_get_times(vrq->cert_chain->data, &activation, - &expiration); - if (!ret) { - flags |= PURPLE_CERTIFICATE_EXPIRED | PURPLE_CERTIFICATE_NOT_ACTIVATED; - purple_debug_error("certificate/x509/tls_cached", - "Failed to get validity times for certificate %s\n", - vrq->subject_name); - } else if (now > expiration) { - flags |= PURPLE_CERTIFICATE_EXPIRED; - purple_debug_error("certificate/x509/tls_cached", - "Certificate %s expired at %s\n", - vrq->subject_name, ctime(&expiration)); - } else if (now < activation) { - flags |= PURPLE_CERTIFICATE_NOT_ACTIVATED; - purple_debug_error("certificate/x509/tls_cached", - "Certificate %s is not yet valid, will be at %s\n", - vrq->subject_name, ctime(&activation)); - } - - tls_peers = purple_certificate_find_pool(x509_tls_cached.scheme_name,tls_peers_name); - - if (!tls_peers) { - purple_debug_error("certificate/x509/tls_cached", - "Couldn't find local peers cache %s\n", - tls_peers_name); - - /* vrq now becomes the problem of unknown_peer */ - x509_tls_cached_unknown_peer(vrq, flags); - return; - } - - /* Check if the peer has a certificate cached already */ - purple_debug_info("certificate/x509/tls_cached", - "Checking for cached cert...\n"); - if (purple_certificate_pool_contains(tls_peers, vrq->subject_name)) { - purple_debug_info("certificate/x509/tls_cached", - "...Found cached cert\n"); - /* vrq is now the responsibility of cert_in_cache */ - x509_tls_cached_cert_in_cache(vrq, flags); - } else { - purple_debug_warning("certificate/x509/tls_cached", - "...Not in cache\n"); - /* vrq now becomes the problem of unknown_peer */ - x509_tls_cached_unknown_peer(vrq, flags); - } -} - -static void -x509_tls_cached_destroy_request(PurpleCertificateVerificationRequest *vrq) -{ - g_return_if_fail(vrq); -} - -static PurpleCertificateVerifier x509_tls_cached = { - "x509", /* Scheme name */ - "tls_cached", /* Verifier name */ - x509_tls_cached_start_verify, /* Verification begin */ - x509_tls_cached_destroy_request,/* Request cleanup */ - - NULL, - NULL, - NULL, - NULL - -}; - -/****************************************************************************/ -/* Subsystem */ -/****************************************************************************/ -void -purple_certificate_init(void) -{ - /* Register builtins */ - purple_certificate_register_verifier(&x509_singleuse); - purple_certificate_register_pool(&x509_ca); - purple_certificate_register_pool(&x509_tls_peers); - purple_certificate_register_verifier(&x509_tls_cached); -} - -void -purple_certificate_uninit(void) -{ - /* Unregister all Verifiers */ - g_list_foreach(cert_verifiers, (GFunc)purple_certificate_unregister_verifier, NULL); - - /* Unregister all Pools */ - g_list_foreach(cert_pools, (GFunc)purple_certificate_unregister_pool, NULL); -} - -gpointer -purple_certificate_get_handle(void) -{ - static gint handle; - return &handle; -} - -PurpleCertificateScheme * -purple_certificate_find_scheme(const gchar *name) -{ - PurpleCertificateScheme *scheme = NULL; - GList *l; - - g_return_val_if_fail(name, NULL); - - /* Traverse the list of registered schemes and locate the - one whose name matches */ - for(l = cert_schemes; l; l = l->next) { - scheme = (PurpleCertificateScheme *)(l->data); - - /* Name matches? that's our man */ - if(!g_ascii_strcasecmp(scheme->name, name)) - return scheme; - } - - purple_debug_warning("certificate", - "CertificateScheme %s requested but not found.\n", - name); - - /* TODO: Signalling and such? */ - - return NULL; -} - -GList * -purple_certificate_get_schemes(void) -{ - return cert_schemes; -} - -gboolean -purple_certificate_register_scheme(PurpleCertificateScheme *scheme) -{ - g_return_val_if_fail(scheme != NULL, FALSE); - - /* Make sure no scheme is registered with the same name */ - if (purple_certificate_find_scheme(scheme->name) != NULL) { - return FALSE; - } - - /* Okay, we're golden. Register it. */ - cert_schemes = g_list_prepend(cert_schemes, scheme); - - /* TODO: Signalling and such? */ - - purple_debug_info("certificate", - "CertificateScheme %s registered\n", - scheme->name); - - return TRUE; -} - -gboolean -purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme) -{ - if (NULL == scheme) { - purple_debug_warning("certificate", - "Attempting to unregister NULL scheme\n"); - return FALSE; - } - - /* TODO: signalling? */ - - /* TODO: unregister all CertificateVerifiers for this scheme?*/ - /* TODO: unregister all CertificatePools for this scheme? */ - /* Neither of the above should be necessary, though */ - cert_schemes = g_list_remove(cert_schemes, scheme); - - purple_debug_info("certificate", - "CertificateScheme %s unregistered\n", - scheme->name); - - - return TRUE; -} - -PurpleCertificateVerifier * -purple_certificate_find_verifier(const gchar *scheme_name, const gchar *ver_name) -{ - PurpleCertificateVerifier *vr = NULL; - GList *l; - - g_return_val_if_fail(scheme_name, NULL); - g_return_val_if_fail(ver_name, NULL); - - /* Traverse the list of registered verifiers and locate the - one whose name matches */ - for(l = cert_verifiers; l; l = l->next) { - vr = (PurpleCertificateVerifier *)(l->data); - - /* Scheme and name match? */ - if(!g_ascii_strcasecmp(vr->scheme_name, scheme_name) && - !g_ascii_strcasecmp(vr->name, ver_name)) - return vr; - } - - purple_debug_warning("certificate", - "CertificateVerifier %s, %s requested but not found.\n", - scheme_name, ver_name); - - /* TODO: Signalling and such? */ - - return NULL; -} - - -GList * -purple_certificate_get_verifiers(void) -{ - return cert_verifiers; -} - -gboolean -purple_certificate_register_verifier(PurpleCertificateVerifier *vr) -{ - g_return_val_if_fail(vr != NULL, FALSE); - - /* Make sure no verifier is registered with the same scheme/name */ - if (purple_certificate_find_verifier(vr->scheme_name, vr->name) != NULL) { - return FALSE; - } - - /* Okay, we're golden. Register it. */ - cert_verifiers = g_list_prepend(cert_verifiers, vr); - - /* TODO: Signalling and such? */ - - purple_debug_info("certificate", - "CertificateVerifier %s registered\n", - vr->name); - return TRUE; -} - -gboolean -purple_certificate_unregister_verifier(PurpleCertificateVerifier *vr) -{ - if (NULL == vr) { - purple_debug_warning("certificate", - "Attempting to unregister NULL verifier\n"); - return FALSE; - } - - /* TODO: signalling? */ - - cert_verifiers = g_list_remove(cert_verifiers, vr); - - - purple_debug_info("certificate", - "CertificateVerifier %s unregistered\n", - vr->name); - - return TRUE; -} - -PurpleCertificatePool * -purple_certificate_find_pool(const gchar *scheme_name, const gchar *pool_name) -{ - PurpleCertificatePool *pool = NULL; - GList *l; - - g_return_val_if_fail(scheme_name, NULL); - g_return_val_if_fail(pool_name, NULL); - - /* Traverse the list of registered pools and locate the - one whose name matches */ - for(l = cert_pools; l; l = l->next) { - pool = (PurpleCertificatePool *)(l->data); - - /* Scheme and name match? */ - if(!g_ascii_strcasecmp(pool->scheme_name, scheme_name) && - !g_ascii_strcasecmp(pool->name, pool_name)) - return pool; - } - - purple_debug_warning("certificate", - "CertificatePool %s, %s requested but not found.\n", - scheme_name, pool_name); - - /* TODO: Signalling and such? */ - - return NULL; - -} - -GList * -purple_certificate_get_pools(void) -{ - return cert_pools; -} - -gboolean -purple_certificate_register_pool(PurpleCertificatePool *pool) -{ - g_return_val_if_fail(pool, FALSE); - g_return_val_if_fail(pool->scheme_name, FALSE); - g_return_val_if_fail(pool->name, FALSE); - g_return_val_if_fail(pool->fullname, FALSE); - - /* Make sure no pools are registered under this name */ - if (purple_certificate_find_pool(pool->scheme_name, pool->name)) { - return FALSE; - } - - /* Initialize the pool if needed */ - if (pool->init) { - gboolean success; - - success = pool->init(); - if (!success) - return FALSE; - } - - /* Register the Pool */ - cert_pools = g_list_prepend(cert_pools, pool); - - /* TODO: Emit a signal that the pool got registered */ - - PURPLE_DBUS_REGISTER_POINTER(pool, PurpleCertificatePool); - purple_signal_register(pool, /* Signals emitted from pool */ - "certificate-stored", - purple_marshal_VOID__POINTER_POINTER, - NULL, /* No callback return value */ - 2, /* Two non-data arguments */ - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CERTIFICATEPOOL), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(pool, /* Signals emitted from pool */ - "certificate-deleted", - purple_marshal_VOID__POINTER_POINTER, - NULL, /* No callback return value */ - 2, /* Two non-data arguments */ - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CERTIFICATEPOOL), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_debug_info("certificate", - "CertificatePool %s registered\n", - pool->name); - - return TRUE; -} - -gboolean -purple_certificate_unregister_pool(PurpleCertificatePool *pool) -{ - if (NULL == pool) { - purple_debug_warning("certificate", - "Attempting to unregister NULL pool\n"); - return FALSE; - } - - /* Check that the pool is registered */ - if (!g_list_find(cert_pools, pool)) { - purple_debug_warning("certificate", - "Pool to unregister isn't registered!\n"); - - return FALSE; - } - - /* Uninit the pool if needed */ - PURPLE_DBUS_UNREGISTER_POINTER(pool); - if (pool->uninit) { - pool->uninit(); - } - - cert_pools = g_list_remove(cert_pools, pool); - - /* TODO: Signalling? */ - purple_signal_unregister(pool, "certificate-stored"); - purple_signal_unregister(pool, "certificate-deleted"); - - purple_debug_info("certificate", - "CertificatePool %s unregistered\n", - pool->name); - return TRUE; -} - -/****************************************************************************/ -/* Scheme-specific functions */ -/****************************************************************************/ - -void -purple_certificate_display_x509(PurpleCertificate *crt) -{ - gchar *sha_asc; - GByteArray *sha_bin; - gchar *cn; - time_t activation, expiration; - gchar *activ_str, *expir_str; - gchar *secondary; - - /* Pull out the SHA1 checksum */ - sha_bin = purple_certificate_get_fingerprint_sha1(crt); - /* Now decode it for display */ - sha_asc = purple_base16_encode_chunked(sha_bin->data, - sha_bin->len); - - /* Get the cert Common Name */ - /* TODO: Will break on CA certs */ - cn = purple_certificate_get_subject_name(crt); - - /* Get the certificate times */ - /* TODO: Check the times against localtime */ - /* TODO: errorcheck? */ - if (!purple_certificate_get_times(crt, &activation, &expiration)) { - purple_debug_error("certificate", - "Failed to get certificate times!\n"); - activation = expiration = 0; - } - activ_str = g_strdup(ctime(&activation)); - expir_str = g_strdup(ctime(&expiration)); - - /* Make messages */ - secondary = g_strdup_printf(_("Common name: %s\n\n" - "Fingerprint (SHA1): %s\n\n" - "Activation date: %s\n" - "Expiration date: %s\n"), - cn ? cn : "(null)", - sha_asc ? sha_asc : "(null)", - activ_str ? activ_str : "(null)", - expir_str ? expir_str : "(null)"); - - /* Make a semi-pretty display */ - purple_notify_info( - NULL, /* TODO: Find what the handle ought to be */ - _("Certificate Information"), - "", - secondary); - - /* Cleanup */ - g_free(cn); - g_free(secondary); - g_free(sha_asc); - g_free(activ_str); - g_free(expir_str); - g_byte_array_free(sha_bin, TRUE); -} - -void purple_certificate_add_ca_search_path(const char *path) -{ - if (g_list_find_custom(x509_ca_paths, path, (GCompareFunc)strcmp)) - return; - x509_ca_paths = g_list_append(x509_ca_paths, g_strdup(path)); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/certificate.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,826 +0,0 @@ -/** - * @file certificate.h Public-Key Certificate API - * @ingroup core - * @see @ref certificate-signals - * @since 2.2.0 - */ - -/* - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_CERTIFICATE_H -#define _PURPLE_CERTIFICATE_H - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -typedef enum -{ - PURPLE_CERTIFICATE_INVALID = 0, - PURPLE_CERTIFICATE_VALID = 1 -} PurpleCertificateVerificationStatus; - -typedef struct _PurpleCertificate PurpleCertificate; -typedef struct _PurpleCertificatePool PurpleCertificatePool; -typedef struct _PurpleCertificateScheme PurpleCertificateScheme; -typedef struct _PurpleCertificateVerifier PurpleCertificateVerifier; -typedef struct _PurpleCertificateVerificationRequest PurpleCertificateVerificationRequest; - -/** - * Callback function for the results of a verification check - * @param st Status code - * @param userdata User-defined data - */ -typedef void (*PurpleCertificateVerifiedCallback) - (PurpleCertificateVerificationStatus st, - gpointer userdata); - -/** A certificate instance - * - * An opaque data structure representing a single certificate under some - * CertificateScheme - */ -struct _PurpleCertificate -{ - /** Scheme this certificate is under */ - PurpleCertificateScheme * scheme; - /** Opaque pointer to internal data */ - gpointer data; -}; - -/** - * Database for retrieval or storage of Certificates - * - * More or less a hash table; all lookups and writes are controlled by a string - * key. - */ -struct _PurpleCertificatePool -{ - /** Scheme this Pool operates for */ - gchar *scheme_name; - /** Internal name to refer to the pool by */ - gchar *name; - - /** User-friendly name for this type - * ex: N_("SSL Servers") - * When this is displayed anywhere, it should be i18ned - * ex: _(pool->fullname) - */ - gchar *fullname; - - /** Internal pool data */ - gpointer data; - - /** - * Set up the Pool's internal state - * - * Upon calling purple_certificate_register_pool() , this function will - * be called. May be NULL. - * @return TRUE if the initialization succeeded, otherwise FALSE - */ - gboolean (* init)(void); - - /** - * Uninit the Pool's internal state - * - * Will be called by purple_certificate_unregister_pool() . May be NULL - */ - void (* uninit)(void); - - /** Check for presence of a certificate in the pool using unique ID */ - gboolean (* cert_in_pool)(const gchar *id); - /** Retrieve a PurpleCertificate from the pool */ - PurpleCertificate * (* get_cert)(const gchar *id); - /** Add a certificate to the pool. Must overwrite any other - * certificates sharing the same ID in the pool. - * @return TRUE if the operation succeeded, otherwise FALSE - */ - gboolean (* put_cert)(const gchar *id, PurpleCertificate *crt); - /** Delete a certificate from the pool */ - gboolean (* delete_cert)(const gchar *id); - - /** Returns a list of IDs stored in the pool */ - GList * (* get_idlist)(void); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** A certificate type - * - * A CertificateScheme must implement all of the fields in the structure, - * and register it using purple_certificate_register_scheme() - * - * There may be only ONE CertificateScheme provided for each certificate - * type, as specified by the "name" field. - */ -struct _PurpleCertificateScheme -{ - /** Name of the certificate type - * ex: "x509", "pgp", etc. - * This must be globally unique - you may not register more than one - * CertificateScheme of the same name at a time. - */ - gchar * name; - - /** User-friendly name for this type - * ex: N_("X.509 Certificates") - * When this is displayed anywhere, it should be i18ned - * ex: _(scheme->fullname) - */ - gchar * fullname; - - /** Imports a certificate from a file - * - * @param filename File to import the certificate from - * @return Pointer to the newly allocated Certificate struct - * or NULL on failure. - */ - PurpleCertificate * (* import_certificate)(const gchar * filename); - - /** - * Exports a certificate to a file - * - * @param filename File to export the certificate to - * @param crt Certificate to export - * @return TRUE if the export succeeded, otherwise FALSE - * @see purple_certificate_export() - */ - gboolean (* export_certificate)(const gchar *filename, PurpleCertificate *crt); - - /** - * Duplicates a certificate - * - * Certificates are generally assumed to be read-only, so feel free to - * do any sort of reference-counting magic you want here. If this ever - * changes, please remember to change the magic accordingly. - * @return Reference to the new copy - */ - PurpleCertificate * (* copy_certificate)(PurpleCertificate *crt); - - /** Destroys and frees a Certificate structure - * - * Destroys a Certificate's internal data structures and calls - * free(crt) - * - * @param crt Certificate instance to be destroyed. It WILL NOT be - * destroyed if it is not of the correct - * CertificateScheme. Can be NULL - */ - void (* destroy_certificate)(PurpleCertificate * crt); - - /** Find whether "crt" has a valid signature from issuer "issuer" - * @see purple_certificate_signed_by() */ - gboolean (*signed_by)(PurpleCertificate *crt, PurpleCertificate *issuer); - /** - * Retrieves the certificate public key fingerprint using SHA1 - * - * @param crt Certificate instance - * @return Binary representation of SHA1 hash - must be freed using - * g_byte_array_free() - */ - GByteArray * (* get_fingerprint_sha1)(PurpleCertificate *crt); - - /** - * Retrieves a unique certificate identifier - * - * @param crt Certificate instance - * @return Newly allocated string that can be used to uniquely - * identify the certificate. - */ - gchar * (* get_unique_id)(PurpleCertificate *crt); - - /** - * Retrieves a unique identifier for the certificate's issuer - * - * @param crt Certificate instance - * @return Newly allocated string that can be used to uniquely - * identify the issuer's certificate. - */ - gchar * (* get_issuer_unique_id)(PurpleCertificate *crt); - - /** - * Gets the certificate subject's name - * - * For X.509, this is the "Common Name" field, as we're only using it - * for hostname verification at the moment - * - * @see purple_certificate_get_subject_name() - * - * @param crt Certificate instance - * @return Newly allocated string with the certificate subject. - */ - gchar * (* get_subject_name)(PurpleCertificate *crt); - - /** - * Check the subject name against that on the certificate - * @see purple_certificate_check_subject_name() - * @return TRUE if it is a match, else FALSE - */ - gboolean (* check_subject_name)(PurpleCertificate *crt, const gchar *name); - - /** Retrieve the certificate activation/expiration times */ - gboolean (* get_times)(PurpleCertificate *crt, time_t *activation, time_t *expiration); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** A set of operations used to provide logic for verifying a Certificate's - * authenticity. - * - * A Verifier provider must fill out these fields, then register it using - * purple_certificate_register_verifier() - * - * The (scheme_name, name) value must be unique for each Verifier - you may not - * register more than one Verifier of the same name for each Scheme - */ -struct _PurpleCertificateVerifier -{ - /** Name of the scheme this Verifier operates on - * - * The scheme will be looked up by name when a Request is generated - * using this Verifier - */ - gchar *scheme_name; - - /** Name of the Verifier - case insensitive */ - gchar *name; - - /** - * Start the verification process - * - * To be called from purple_certificate_verify once it has - * constructed the request. This will use the information in the - * given VerificationRequest to check the certificate and callback - * the requester with the verification results. - * - * @param vrq Request to process - */ - void (* start_verification)(PurpleCertificateVerificationRequest *vrq); - - /** - * Destroy a completed Request under this Verifier - * The function pointed to here is only responsible for cleaning up - * whatever PurpleCertificateVerificationRequest::data points to. - * It should not call free(vrq) - * - * @param vrq Request to destroy - */ - void (* destroy_request)(PurpleCertificateVerificationRequest *vrq); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** Structure for a single certificate request - * - * Useful for keeping track of the state of a verification that involves - * several steps - */ -struct _PurpleCertificateVerificationRequest -{ - /** Reference to the verification logic used */ - PurpleCertificateVerifier *verifier; - /** Reference to the scheme used. - * - * This is looked up from the Verifier when the Request is generated - */ - PurpleCertificateScheme *scheme; - - /** - * Name to check that the certificate is issued to - * - * For X.509 certificates, this is the Common Name - */ - gchar *subject_name; - - /** List of certificates in the chain to be verified (such as that returned by purple_ssl_get_peer_certificates ) - * - * This is most relevant for X.509 certificates used in SSL sessions. - * The list order should be: certificate, issuer, issuer's issuer, etc. - */ - GList *cert_chain; - - /** Internal data used by the Verifier code */ - gpointer data; - - /** Function to call with the verification result */ - PurpleCertificateVerifiedCallback cb; - /** Data to pass to the post-verification callback */ - gpointer cb_data; -}; - -/*****************************************************************************/ -/** @name Certificate Verification Functions */ -/*****************************************************************************/ -/*@{*/ - -/** - * Constructs a verification request and passed control to the specified Verifier - * - * It is possible that the callback will be called immediately upon calling - * this function. Plan accordingly. - * - * @param verifier Verification logic to use. - * @see purple_certificate_find_verifier() - * - * @param subject_name Name that should match the first certificate in the - * chain for the certificate to be valid. Will be strdup'd - * into the Request struct - * - * @param cert_chain Certificate chain to check. If there is more than one - * certificate in the chain (X.509), the peer's - * certificate comes first, then the issuer/signer's - * certificate, etc. The whole list is duplicated into the - * Request struct. - * - * @param cb Callback function to be called with whether the - * certificate was approved or not. - * @param cb_data User-defined data for the above. - */ -void -purple_certificate_verify (PurpleCertificateVerifier *verifier, - const gchar *subject_name, GList *cert_chain, - PurpleCertificateVerifiedCallback cb, - gpointer cb_data); - -/** - * Completes and destroys a VerificationRequest - * - * @param vrq Request to conclude - * @param st Success/failure code to pass to the request's - * completion callback. - */ -void -purple_certificate_verify_complete(PurpleCertificateVerificationRequest *vrq, - PurpleCertificateVerificationStatus st); - -/*@}*/ - -/*****************************************************************************/ -/** @name Certificate Functions */ -/*****************************************************************************/ -/*@{*/ - -/** - * Makes a duplicate of a certificate - * - * @param crt Instance to duplicate - * @return Pointer to new instance - */ -PurpleCertificate * -purple_certificate_copy(PurpleCertificate *crt); - -/** - * Duplicates an entire list of certificates - * - * @param crt_list List to duplicate - * @return New list copy - */ -GList * -purple_certificate_copy_list(GList *crt_list); - -/** - * Destroys and free()'s a Certificate - * - * @param crt Instance to destroy. May be NULL. - */ -void -purple_certificate_destroy (PurpleCertificate *crt); - -/** - * Destroy an entire list of Certificate instances and the containing list - * - * @param crt_list List of certificates to destroy. May be NULL. - */ -void -purple_certificate_destroy_list (GList * crt_list); - -/** - * Check whether 'crt' has a valid signature made by 'issuer' - * - * @param crt Certificate instance to check signature of - * @param issuer Certificate thought to have signed 'crt' - * - * @return TRUE if 'crt' has a valid signature made by 'issuer', - * otherwise FALSE - * @todo Find a way to give the reason (bad signature, not the issuer, etc.) - */ -gboolean -purple_certificate_signed_by(PurpleCertificate *crt, PurpleCertificate *issuer); - -/** - * Check that a certificate chain is valid and, if not, the failing certificate. - * - * Uses purple_certificate_signed_by() to verify that each PurpleCertificate - * in the chain carries a valid signature from the next. A single-certificate - * chain is considered to be valid. - * - * @param chain List of PurpleCertificate instances comprising the chain, - * in the order certificate, issuer, issuer's issuer, etc. - * @param failing A pointer to a PurpleCertificate*. If not NULL, if the - * chain fails to validate, this will be set to the - * certificate whose signature could not be validated. - * @return TRUE if the chain is valid. See description. - * - * @since 2.6.0 - * @deprecated This function will become - * purple_certificate_check_signature_chain in 3.0.0 - */ -gboolean -purple_certificate_check_signature_chain_with_failing(GList *chain, - PurpleCertificate **failing); - -/** - * Check that a certificate chain is valid - * - * Uses purple_certificate_signed_by() to verify that each PurpleCertificate - * in the chain carries a valid signature from the next. A single-certificate - * chain is considered to be valid. - * - * @param chain List of PurpleCertificate instances comprising the chain, - * in the order certificate, issuer, issuer's issuer, etc. - * @return TRUE if the chain is valid. See description. - * @todo Specify which certificate in the chain caused a failure - * @deprecated This function will be removed in 3.0.0 and replaced with - * purple_certificate_check_signature_chain_with_failing - */ -gboolean -purple_certificate_check_signature_chain(GList *chain); - -/** - * Imports a PurpleCertificate from a file - * - * @param scheme Scheme to import under - * @param filename File path to import from - * @return Pointer to a new PurpleCertificate, or NULL on failure - */ -PurpleCertificate * -purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename); - -/** - * Exports a PurpleCertificate to a file - * - * @param filename File to export the certificate to - * @param crt Certificate to export - * @return TRUE if the export succeeded, otherwise FALSE - */ -gboolean -purple_certificate_export(const gchar *filename, PurpleCertificate *crt); - - -/** - * Retrieves the certificate public key fingerprint using SHA1. - * - * @param crt Certificate instance - * @return Binary representation of the hash. You are responsible for free()ing - * this. - * @see purple_base16_encode_chunked() - */ -GByteArray * -purple_certificate_get_fingerprint_sha1(PurpleCertificate *crt); - -/** - * Get a unique identifier for the certificate - * - * @param crt Certificate instance - * @return String representing the certificate uniquely. Must be g_free()'ed - */ -gchar * -purple_certificate_get_unique_id(PurpleCertificate *crt); - -/** - * Get a unique identifier for the certificate's issuer - * - * @param crt Certificate instance - * @return String representing the certificate's issuer uniquely. Must be - * g_free()'ed - */ -gchar * -purple_certificate_get_issuer_unique_id(PurpleCertificate *crt); - -/** - * Gets the certificate subject's name - * - * For X.509, this is the "Common Name" field, as we're only using it - * for hostname verification at the moment - * - * @param crt Certificate instance - * @return Newly allocated string with the certificate subject. - */ -gchar * -purple_certificate_get_subject_name(PurpleCertificate *crt); - -/** - * Check the subject name against that on the certificate - * @param crt Certificate instance - * @param name Name to check. - * @return TRUE if it is a match, else FALSE - */ -gboolean -purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name); - -/** - * Get the expiration/activation times. - * - * @param crt Certificate instance - * @param activation Reference to store the activation time at. May be NULL - * if you don't actually want it. - * @param expiration Reference to store the expiration time at. May be NULL - * if you don't actually want it. - * @return TRUE if the requested values were obtained, otherwise FALSE. - */ -gboolean -purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration); - -/*@}*/ - -/*****************************************************************************/ -/** @name Certificate Pool Functions */ -/*****************************************************************************/ -/*@{*/ -/** - * Helper function for generating file paths in ~/.purple/certificates for - * CertificatePools that use them. - * - * All components will be escaped for filesystem friendliness. - * - * @param pool CertificatePool to build a path for - * @param id Key to look up a Certificate by. May be NULL. - * @return A newly allocated path of the form - * ~/.purple/certificates/scheme_name/pool_name/unique_id - */ -gchar * -purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id); - -/** - * Determines whether a pool can be used. - * - * Checks whether the associated CertificateScheme is loaded. - * - * @param pool Pool to check - * - * @return TRUE if the pool can be used, otherwise FALSE - */ -gboolean -purple_certificate_pool_usable(PurpleCertificatePool *pool); - -/** - * Looks up the scheme the pool operates under - * - * @param pool Pool to get the scheme of - * - * @return Pointer to the pool's scheme, or NULL if it isn't loaded. - * @see purple_certificate_pool_usable() - */ -PurpleCertificateScheme * -purple_certificate_pool_get_scheme(PurpleCertificatePool *pool); - -/** - * Check for presence of an ID in a pool. - * @param pool Pool to look in - * @param id ID to look for - * @return TRUE if the ID is in the pool, else FALSE - */ -gboolean -purple_certificate_pool_contains(PurpleCertificatePool *pool, const gchar *id); - -/** - * Retrieve a certificate from a pool. - * @param pool Pool to fish in - * @param id ID to look up - * @return Retrieved certificate, or NULL if it wasn't there - */ -PurpleCertificate * -purple_certificate_pool_retrieve(PurpleCertificatePool *pool, const gchar *id); - -/** - * Add a certificate to a pool - * - * Any pre-existing certificate of the same ID will be overwritten. - * - * @param pool Pool to add to - * @param id ID to store the certificate with - * @param crt Certificate to store - * @return TRUE if the operation succeeded, otherwise FALSE - */ -gboolean -purple_certificate_pool_store(PurpleCertificatePool *pool, const gchar *id, PurpleCertificate *crt); - -/** - * Remove a certificate from a pool - * - * @param pool Pool to remove from - * @param id ID to remove - * @return TRUE if the operation succeeded, otherwise FALSE - */ -gboolean -purple_certificate_pool_delete(PurpleCertificatePool *pool, const gchar *id); - -/** - * Get the list of IDs currently in the pool. - * - * @param pool Pool to enumerate - * @return GList pointing to newly-allocated id strings. Free using - * purple_certificate_pool_destroy_idlist() - */ -GList * -purple_certificate_pool_get_idlist(PurpleCertificatePool *pool); - -/** - * Destroys the result given by purple_certificate_pool_get_idlist() - * - * @param idlist ID List to destroy - */ -void -purple_certificate_pool_destroy_idlist(GList *idlist); - -/*@}*/ - -/*****************************************************************************/ -/** @name Certificate Subsystem API */ -/*****************************************************************************/ -/*@{*/ - -/** - * Initialize the certificate system - */ -void -purple_certificate_init(void); - -/** - * Un-initialize the certificate system - */ -void -purple_certificate_uninit(void); - -/** - * Get the Certificate subsystem handle for signalling purposes - */ -gpointer -purple_certificate_get_handle(void); - -/** Look up a registered CertificateScheme by name - * @param name The scheme name. Case insensitive. - * @return Pointer to the located Scheme, or NULL if it isn't found. - */ -PurpleCertificateScheme * -purple_certificate_find_scheme(const gchar *name); - -/** - * Get all registered CertificateSchemes - * - * @return GList pointing to all registered CertificateSchemes . This value - * is owned by libpurple - */ -GList * -purple_certificate_get_schemes(void); - -/** Register a CertificateScheme with libpurple - * - * No two schemes can be registered with the same name; this function enforces - * that. - * - * @param scheme Pointer to the scheme to register. - * @return TRUE if the scheme was successfully added, otherwise FALSE - */ -gboolean -purple_certificate_register_scheme(PurpleCertificateScheme *scheme); - -/** Unregister a CertificateScheme from libpurple - * - * @param scheme Scheme to unregister. - * If the scheme is not registered, this is a no-op. - * - * @return TRUE if the unregister completed successfully - */ -gboolean -purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme); - -/** Look up a registered PurpleCertificateVerifier by scheme and name - * @param scheme_name Scheme name. Case insensitive. - * @param ver_name The verifier name. Case insensitive. - * @return Pointer to the located Verifier, or NULL if it isn't found. - */ -PurpleCertificateVerifier * -purple_certificate_find_verifier(const gchar *scheme_name, const gchar *ver_name); - -/** - * Get the list of registered CertificateVerifiers - * - * @return GList of all registered PurpleCertificateVerifier. This value - * is owned by libpurple - */ -GList * -purple_certificate_get_verifiers(void); - -/** - * Register a CertificateVerifier with libpurple - * - * @param vr Verifier to register. - * @return TRUE if register succeeded, otherwise FALSE - */ -gboolean -purple_certificate_register_verifier(PurpleCertificateVerifier *vr); - -/** - * Unregister a CertificateVerifier with libpurple - * - * @param vr Verifier to unregister. - * @return TRUE if unregister succeeded, otherwise FALSE - */ -gboolean -purple_certificate_unregister_verifier(PurpleCertificateVerifier *vr); - -/** Look up a registered PurpleCertificatePool by scheme and name - * @param scheme_name Scheme name. Case insensitive. - * @param pool_name Pool name. Case insensitive. - * @return Pointer to the located Pool, or NULL if it isn't found. - */ -PurpleCertificatePool * -purple_certificate_find_pool(const gchar *scheme_name, const gchar *pool_name); - -/** - * Get the list of registered Pools - * - * @return GList of all registered PurpleCertificatePool s. This value - * is owned by libpurple - */ -GList * -purple_certificate_get_pools(void); - -/** - * Register a CertificatePool with libpurple and call its init function - * - * @param pool Pool to register. - * @return TRUE if the register succeeded, otherwise FALSE - */ -gboolean -purple_certificate_register_pool(PurpleCertificatePool *pool); - -/** - * Unregister a CertificatePool with libpurple and call its uninit function - * - * @param pool Pool to unregister. - * @return TRUE if the unregister succeeded, otherwise FALSE - */ -gboolean -purple_certificate_unregister_pool(PurpleCertificatePool *pool); - -/*@}*/ - - -/** - * Displays a window showing X.509 certificate information - * - * @param crt Certificate under an "x509" Scheme - * @todo Will break on CA certs, as they have no Common Name - */ -void -purple_certificate_display_x509(PurpleCertificate *crt); - -/** - * Add a search path for certificates. - * - * @param path Path to search for certificates. - */ -void purple_certificate_add_ca_search_path(const char *path); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _PURPLE_CERTIFICATE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3291 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Original md5 - * Copyright (C) 2001-2003 Christophe Devine - * - * Original md4 taken from linux kernel - * MD4 Message Digest Algorithm (RFC1320). - * - * Implementation derived from Andrew Tridgell and Steve French's - * CIFS MD4 implementation, and the cryptoapi implementation - * originally based on the public domain implementation written - * by Colin Plumb in 1993. - * - * Copyright (c) Andrew Tridgell 1997-1998. - * Modified by Steve French (sfrench@us.ibm.com) 2002 - * Copyright (c) Cryptoapi developers. - * Copyright (c) 2002 David S. Miller (davem@redhat.com) - * Copyright (c) 2002 James Morris - * - * Original des taken from gpg - * - * des.c - DES and Triple-DES encryption/decryption Algorithm - * Copyright (C) 1998 Free Software Foundation, Inc. - * - * Please see below for more legal information! - * - * According to the definition of DES in FIPS PUB 46-2 from December 1993. - * For a description of triple encryption, see: - * Bruce Schneier: Applied Cryptography. Second Edition. - * John Wiley & Sons, 1996. ISBN 0-471-12845-7. Pages 358 ff. - * - * This file is part of GnuPG. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "cipher.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "signals.h" -#include "value.h" - -#if GLIB_CHECK_VERSION(2,16,0) -static void -purple_g_checksum_init(PurpleCipherContext *context, GChecksumType type) -{ - GChecksum *checksum; - - checksum = g_checksum_new(type); - purple_cipher_context_set_data(context, checksum); -} - -static void -purple_g_checksum_reset(PurpleCipherContext *context, GChecksumType type) -{ - GChecksum *checksum; - - checksum = purple_cipher_context_get_data(context); - g_return_if_fail(checksum != NULL); - -#if GLIB_CHECK_VERSION(2,18,0) - g_checksum_reset(checksum); -#else - g_checksum_free(checksum); - checksum = g_checksum_new(type); - purple_cipher_context_set_data(context, checksum); -#endif -} - -static void -purple_g_checksum_uninit(PurpleCipherContext *context) -{ - GChecksum *checksum; - - checksum = purple_cipher_context_get_data(context); - g_return_if_fail(checksum != NULL); - - g_checksum_free(checksum); -} - -static void -purple_g_checksum_append(PurpleCipherContext *context, const guchar *data, - gsize len) -{ - GChecksum *checksum; - - checksum = purple_cipher_context_get_data(context); - g_return_if_fail(checksum != NULL); - - while (len >= G_MAXSSIZE) { - g_checksum_update(checksum, data, G_MAXSSIZE); - len -= G_MAXSSIZE; - data += G_MAXSSIZE; - } - - if (len) - g_checksum_update(checksum, data, len); -} - -static gboolean -purple_g_checksum_digest(PurpleCipherContext *context, GChecksumType type, - gsize len, guchar *digest, gsize *out_len) -{ - GChecksum *checksum; - const gssize required_length = g_checksum_type_get_length(type); - - checksum = purple_cipher_context_get_data(context); - - g_return_val_if_fail(len >= required_length, FALSE); - g_return_val_if_fail(checksum != NULL, FALSE); - - g_checksum_get_digest(checksum, digest, &len); - - purple_cipher_context_reset(context, NULL); - - if (out_len) - *out_len = len; - - return TRUE; -} -#endif - - -/******************************************************************************* - * MD5 - ******************************************************************************/ -#define MD5_HMAC_BLOCK_SIZE 64 - -static size_t -md5_get_block_size(PurpleCipherContext *context) -{ - /* This does not change (in this case) */ - return MD5_HMAC_BLOCK_SIZE; -} - -#if GLIB_CHECK_VERSION(2,16,0) - -static void -md5_init(PurpleCipherContext *context, void *extra) -{ - purple_g_checksum_init(context, G_CHECKSUM_MD5); -} - -static void -md5_reset(PurpleCipherContext *context, void *extra) -{ - purple_g_checksum_reset(context, G_CHECKSUM_MD5); -} - -static gboolean -md5_digest(PurpleCipherContext *context, gsize in_len, guchar digest[16], - size_t *out_len) -{ - return purple_g_checksum_digest(context, G_CHECKSUM_MD5, in_len, - digest, out_len); -} - -static PurpleCipherOps MD5Ops = { - NULL, /* Set Option */ - NULL, /* Get Option */ - md5_init, /* init */ - md5_reset, /* reset */ - purple_g_checksum_uninit, /* uninit */ - NULL, /* set iv */ - purple_g_checksum_append, /* append */ - md5_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - md5_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -#else /* GLIB_CHECK_VERSION(2,16,0) */ - -struct MD5Context { - guint32 total[2]; - guint32 state[4]; - guchar buffer[64]; -}; - -#define MD5_GET_GUINT32(n,b,i) { \ - (n) = ((guint32)(b) [(i) ] ) \ - | ((guint32)(b) [(i) + 1] << 8) \ - | ((guint32)(b) [(i) + 2] << 16) \ - | ((guint32)(b) [(i) + 3] << 24); \ -} -#define MD5_PUT_GUINT32(n,b,i) { \ - (b)[(i) ] = (guchar)((n) ); \ - (b)[(i) + 1] = (guchar)((n) >> 8); \ - (b)[(i) + 2] = (guchar)((n) >> 16); \ - (b)[(i) + 3] = (guchar)((n) >> 24); \ -} - -static void -md5_init(PurpleCipherContext *context, gpointer extra) { - struct MD5Context *md5_context; - - md5_context = g_new0(struct MD5Context, 1); - - purple_cipher_context_set_data(context, md5_context); - - purple_cipher_context_reset(context, extra); -} - -static void -md5_reset(PurpleCipherContext *context, gpointer extra) { - struct MD5Context *md5_context; - - md5_context = purple_cipher_context_get_data(context); - - md5_context->total[0] = 0; - md5_context->total[1] = 0; - - md5_context->state[0] = 0x67452301; - md5_context->state[1] = 0xEFCDAB89; - md5_context->state[2] = 0x98BADCFE; - md5_context->state[3] = 0x10325476; - - memset(md5_context->buffer, 0, sizeof(md5_context->buffer)); -} - -static void -md5_uninit(PurpleCipherContext *context) { - struct MD5Context *md5_context; - - purple_cipher_context_reset(context, NULL); - - md5_context = purple_cipher_context_get_data(context); - memset(md5_context, 0, sizeof(md5_context)); - - g_free(md5_context); - md5_context = NULL; -} - -static void -md5_process(struct MD5Context *md5_context, const guchar data[64]) { - guint32 X[16], A, B, C, D; - - A = md5_context->state[0]; - B = md5_context->state[1]; - C = md5_context->state[2]; - D = md5_context->state[3]; - - MD5_GET_GUINT32(X[ 0], data, 0); - MD5_GET_GUINT32(X[ 1], data, 4); - MD5_GET_GUINT32(X[ 2], data, 8); - MD5_GET_GUINT32(X[ 3], data, 12); - MD5_GET_GUINT32(X[ 4], data, 16); - MD5_GET_GUINT32(X[ 5], data, 20); - MD5_GET_GUINT32(X[ 6], data, 24); - MD5_GET_GUINT32(X[ 7], data, 28); - MD5_GET_GUINT32(X[ 8], data, 32); - MD5_GET_GUINT32(X[ 9], data, 36); - MD5_GET_GUINT32(X[10], data, 40); - MD5_GET_GUINT32(X[11], data, 44); - MD5_GET_GUINT32(X[12], data, 48); - MD5_GET_GUINT32(X[13], data, 52); - MD5_GET_GUINT32(X[14], data, 56); - MD5_GET_GUINT32(X[15], data, 60); - - #define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) - #define P(a,b,c,d,k,s,t) { \ - a += F(b,c,d) + X[k] + t; \ - a = S(a,s) + b; \ - } - - /* first pass */ - #define F(x,y,z) (z ^ (x & (y ^ z))) - P(A, B, C, D, 0, 7, 0xD76AA478); - P(D, A, B, C, 1, 12, 0xE8C7B756); - P(C, D, A, B, 2, 17, 0x242070DB); - P(B, C, D, A, 3, 22, 0xC1BDCEEE); - P(A, B, C, D, 4, 7, 0xF57C0FAF); - P(D, A, B, C, 5, 12, 0x4787C62A); - P(C, D, A, B, 6, 17, 0xA8304613); - P(B, C, D, A, 7, 22, 0xFD469501); - P(A, B, C, D, 8, 7, 0x698098D8); - P(D, A, B, C, 9, 12, 0x8B44F7AF); - P(C, D, A, B, 10, 17, 0xFFFF5BB1); - P(B, C, D, A, 11, 22, 0x895CD7BE); - P(A, B, C, D, 12, 7, 0x6B901122); - P(D, A, B, C, 13, 12, 0xFD987193); - P(C, D, A, B, 14, 17, 0xA679438E); - P(B, C, D, A, 15, 22, 0x49B40821); - #undef F - - /* second pass */ - #define F(x,y,z) (y ^ (z & (x ^ y))) - P(A, B, C, D, 1, 5, 0xF61E2562); - P(D, A, B, C, 6, 9, 0xC040B340); - P(C, D, A, B, 11, 14, 0x265E5A51); - P(B, C, D, A, 0, 20, 0xE9B6C7AA); - P(A, B, C, D, 5, 5, 0xD62F105D); - P(D, A, B, C, 10, 9, 0x02441453); - P(C, D, A, B, 15, 14, 0xD8A1E681); - P(B, C, D, A, 4, 20, 0xE7D3FBC8); - P(A, B, C, D, 9, 5, 0x21E1CDE6); - P(D, A, B, C, 14, 9, 0xC33707D6); - P(C, D, A, B, 3, 14, 0xF4D50D87); - P(B, C, D, A, 8, 20, 0x455A14ED); - P(A, B, C, D, 13, 5, 0xA9E3E905); - P(D, A, B, C, 2, 9, 0xFCEFA3F8); - P(C, D, A, B, 7, 14, 0x676F02D9); - P(B, C, D, A, 12, 20, 0x8D2A4C8A); - #undef F - - /* third pass */ - #define F(x,y,z) (x ^ y ^ z) - P(A, B, C, D, 5, 4, 0xFFFA3942); - P(D, A, B, C, 8, 11, 0x8771F681); - P(C, D, A, B, 11, 16, 0x6D9D6122); - P(B, C, D, A, 14, 23, 0xFDE5380C); - P(A, B, C, D, 1, 4, 0xA4BEEA44); - P(D, A, B, C, 4, 11, 0x4BDECFA9); - P(C, D, A, B, 7, 16, 0xF6BB4B60); - P(B, C, D, A, 10, 23, 0xBEBFBC70); - P(A, B, C, D, 13, 4, 0x289B7EC6); - P(D, A, B, C, 0, 11, 0xEAA127FA); - P(C, D, A, B, 3, 16, 0xD4EF3085); - P(B, C, D, A, 6, 23, 0x04881D05); - P(A, B, C, D, 9, 4, 0xD9D4D039); - P(D, A, B, C, 12, 11, 0xE6DB99E5); - P(C, D, A, B, 15, 16, 0x1FA27CF8); - P(B, C, D, A, 2, 23, 0xC4AC5665); - #undef F - - /* forth pass */ - #define F(x,y,z) (y ^ (x | ~z)) - P(A, B, C, D, 0, 6, 0xF4292244); - P(D, A, B, C, 7, 10, 0x432AFF97); - P(C, D, A, B, 14, 15, 0xAB9423A7); - P(B, C, D, A, 5, 21, 0xFC93A039); - P(A, B, C, D, 12, 6, 0x655B59C3); - P(D, A, B, C, 3, 10, 0x8F0CCC92); - P(C, D, A, B, 10, 15, 0xFFEFF47D); - P(B, C, D, A, 1, 21, 0x85845DD1); - P(A, B, C, D, 8, 6, 0x6FA87E4F); - P(D, A, B, C, 15, 10, 0xFE2CE6E0); - P(C, D, A, B, 6, 15, 0xA3014314); - P(B, C, D, A, 13, 21, 0x4E0811A1); - P(A, B, C, D, 4, 6, 0xF7537E82); - P(D, A, B, C, 11, 10, 0xBD3AF235); - P(C, D, A, B, 2, 15, 0x2AD7D2BB); - P(B, C, D, A, 9, 21, 0xEB86D391); - #undef F - #undef P - #undef S - - md5_context->state[0] += A; - md5_context->state[1] += B; - md5_context->state[2] += C; - md5_context->state[3] += D; -} - -static void -md5_append(PurpleCipherContext *context, const guchar *data, size_t len) { - struct MD5Context *md5_context = NULL; - guint32 left = 0, fill = 0; - - g_return_if_fail(context != NULL); - - md5_context = purple_cipher_context_get_data(context); - g_return_if_fail(md5_context != NULL); - - left = md5_context->total[0] & 0x3F; - fill = 64 - left; - - md5_context->total[0] += len; - md5_context->total[0] &= 0xFFFFFFFF; - - if(md5_context->total[0] < len) - md5_context->total[1]++; - - if(left && len >= fill) { - memcpy((md5_context->buffer + left), data, fill); - md5_process(md5_context, md5_context->buffer); - len -= fill; - data += fill; - left = 0; - } - - while(len >= 64) { - md5_process(md5_context, data); - len -= 64; - data += 64; - } - - if(len) { - memcpy((md5_context->buffer + left), data, len); - } -} - -static gboolean -md5_digest(PurpleCipherContext *context, size_t in_len, guchar digest[16], - size_t *out_len) -{ - struct MD5Context *md5_context = NULL; - guint32 last, pad; - guint32 high, low; - guchar message[8]; - guchar padding[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - g_return_val_if_fail(in_len >= 16, FALSE); - - md5_context = purple_cipher_context_get_data(context); - - high = (md5_context->total[0] >> 29) - | (md5_context->total[1] << 3); - low = (md5_context->total[0] << 3); - - MD5_PUT_GUINT32(low, message, 0); - MD5_PUT_GUINT32(high, message, 4); - - last = md5_context->total[0] & 0x3F; - pad = (last < 56) ? (56 - last) : (120 - last); - - md5_append(context, padding, pad); - md5_append(context, message, 8); - - MD5_PUT_GUINT32(md5_context->state[0], digest, 0); - MD5_PUT_GUINT32(md5_context->state[1], digest, 4); - MD5_PUT_GUINT32(md5_context->state[2], digest, 8); - MD5_PUT_GUINT32(md5_context->state[3], digest, 12); - - if(out_len) - *out_len = 16; - - return TRUE; -} - -static PurpleCipherOps MD5Ops = { - NULL, /* Set option */ - NULL, /* Get option */ - md5_init, /* init */ - md5_reset, /* reset */ - md5_uninit, /* uninit */ - NULL, /* set iv */ - md5_append, /* append */ - md5_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - md5_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -#endif /* GLIB_CHECK_VERSION(2,16,0) */ - -/******************************************************************************* - * MD4 - ******************************************************************************/ -#define MD4_DIGEST_SIZE 16 -#define MD4_HMAC_BLOCK_SIZE 64 -#define MD4_BLOCK_WORDS 16 -#define MD4_HASH_WORDS 4 - - - -struct MD4_Context { - guint32 hash[MD4_HASH_WORDS]; - guint32 block[MD4_BLOCK_WORDS]; - guint64 byte_count; -}; - -static inline guint32 lshift(guint32 x, unsigned int s) -{ - x &= 0xFFFFFFFF; - return ((x << s) & 0xFFFFFFFF) | (x >> (32 - s)); -} - -static inline guint32 F(guint32 x, guint32 y, guint32 z) -{ - return (x & y) | ((~x) & z); -} - -static inline guint32 G(guint32 x, guint32 y, guint32 z) -{ - return (x & y) | (x & z) | (y & z); -} - -static inline guint32 H(guint32 x, guint32 y, guint32 z) -{ - return x ^ y ^ z; -} - -#define ROUND1(a,b,c,d,k,s) (a = lshift(a + F(b,c,d) + k, s)) -#define ROUND2(a,b,c,d,k,s) (a = lshift(a + G(b,c,d) + k + (guint32)0x5A827999,s)) -#define ROUND3(a,b,c,d,k,s) (a = lshift(a + H(b,c,d) + k + (guint32)0x6ED9EBA1,s)) - -static inline void le32_to_cpu_array(guint32 *buf, unsigned int words) -{ - while (words--) { - *buf=GUINT_FROM_LE(*buf); - buf++; - } -} - -static inline void cpu_to_le32_array(guint32 *buf, unsigned int words) -{ - while (words--) { - *buf=GUINT_TO_LE(*buf); - buf++; - } -} - -static void md4_transform(guint32 *hash, guint32 const *in) -{ - guint32 a, b, c, d; - - a = hash[0]; - b = hash[1]; - c = hash[2]; - d = hash[3]; - - ROUND1(a, b, c, d, in[0], 3); - ROUND1(d, a, b, c, in[1], 7); - ROUND1(c, d, a, b, in[2], 11); - ROUND1(b, c, d, a, in[3], 19); - ROUND1(a, b, c, d, in[4], 3); - ROUND1(d, a, b, c, in[5], 7); - ROUND1(c, d, a, b, in[6], 11); - ROUND1(b, c, d, a, in[7], 19); - ROUND1(a, b, c, d, in[8], 3); - ROUND1(d, a, b, c, in[9], 7); - ROUND1(c, d, a, b, in[10], 11); - ROUND1(b, c, d, a, in[11], 19); - ROUND1(a, b, c, d, in[12], 3); - ROUND1(d, a, b, c, in[13], 7); - ROUND1(c, d, a, b, in[14], 11); - ROUND1(b, c, d, a, in[15], 19); - - ROUND2(a, b, c, d,in[ 0], 3); - ROUND2(d, a, b, c, in[4], 5); - ROUND2(c, d, a, b, in[8], 9); - ROUND2(b, c, d, a, in[12], 13); - ROUND2(a, b, c, d, in[1], 3); - ROUND2(d, a, b, c, in[5], 5); - ROUND2(c, d, a, b, in[9], 9); - ROUND2(b, c, d, a, in[13], 13); - ROUND2(a, b, c, d, in[2], 3); - ROUND2(d, a, b, c, in[6], 5); - ROUND2(c, d, a, b, in[10], 9); - ROUND2(b, c, d, a, in[14], 13); - ROUND2(a, b, c, d, in[3], 3); - ROUND2(d, a, b, c, in[7], 5); - ROUND2(c, d, a, b, in[11], 9); - ROUND2(b, c, d, a, in[15], 13); - - ROUND3(a, b, c, d,in[ 0], 3); - ROUND3(d, a, b, c, in[8], 9); - ROUND3(c, d, a, b, in[4], 11); - ROUND3(b, c, d, a, in[12], 15); - ROUND3(a, b, c, d, in[2], 3); - ROUND3(d, a, b, c, in[10], 9); - ROUND3(c, d, a, b, in[6], 11); - ROUND3(b, c, d, a, in[14], 15); - ROUND3(a, b, c, d, in[1], 3); - ROUND3(d, a, b, c, in[9], 9); - ROUND3(c, d, a, b, in[5], 11); - ROUND3(b, c, d, a, in[13], 15); - ROUND3(a, b, c, d, in[3], 3); - ROUND3(d, a, b, c, in[11], 9); - ROUND3(c, d, a, b, in[7], 11); - ROUND3(b, c, d, a, in[15], 15); - - hash[0] += a; - hash[1] += b; - hash[2] += c; - hash[3] += d; -} - -static inline void md4_transform_helper(struct MD4_Context *ctx) -{ - le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(guint32)); - md4_transform(ctx->hash, ctx->block); -} - -static void -md4_init(PurpleCipherContext *context, gpointer extra) { - struct MD4_Context *mctx; - mctx = g_new0(struct MD4_Context, 1); - purple_cipher_context_set_data(context, mctx); - purple_cipher_context_reset(context, extra); - - mctx->hash[0] = 0x67452301; - mctx->hash[1] = 0xefcdab89; - mctx->hash[2] = 0x98badcfe; - mctx->hash[3] = 0x10325476; - mctx->byte_count = 0; -} - -static void -md4_reset(PurpleCipherContext *context, gpointer extra) { - struct MD4_Context *mctx; - - mctx = purple_cipher_context_get_data(context); - - mctx->hash[0] = 0x67452301; - mctx->hash[1] = 0xefcdab89; - mctx->hash[2] = 0x98badcfe; - mctx->hash[3] = 0x10325476; - mctx->byte_count = 0; -} - -static void -md4_append(PurpleCipherContext *context, const guchar *data, size_t len) -{ - struct MD4_Context *mctx = purple_cipher_context_get_data(context); - const guint32 avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f); - - mctx->byte_count += len; - - if (avail > len) { - memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), - data, len); - return; - } - - memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), - data, avail); - - md4_transform_helper(mctx); - data += avail; - len -= avail; - - while (len >= sizeof(mctx->block)) { - memcpy(mctx->block, data, sizeof(mctx->block)); - md4_transform_helper(mctx); - data += sizeof(mctx->block); - len -= sizeof(mctx->block); - } - - memcpy(mctx->block, data, len); -} - -static gboolean -md4_digest(PurpleCipherContext *context, size_t in_len, guchar *out, - size_t *out_len) -{ - struct MD4_Context *mctx = purple_cipher_context_get_data(context); - const unsigned int offset = mctx->byte_count & 0x3f; - char *p = (char *)mctx->block + offset; - int padding = 56 - (offset + 1); - - - if(in_len<16) return FALSE; - if(out_len) *out_len = 16; - *p++ = 0x80; - if (padding < 0) { - memset(p, 0x00, padding + sizeof (guint64)); - md4_transform_helper(mctx); - p = (char *)mctx->block; - padding = 56; - } - - memset(p, 0, padding); - mctx->block[14] = mctx->byte_count << 3; - mctx->block[15] = mctx->byte_count >> 29; - le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - - sizeof(guint64)) / sizeof(guint32)); - md4_transform(mctx->hash, mctx->block); - cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(guint32)); - memcpy(out, mctx->hash, sizeof(mctx->hash)); - memset(mctx, 0, sizeof(*mctx)); - return TRUE; -} - -static void -md4_uninit(PurpleCipherContext *context) { - struct MD4_Context *md4_context; - - purple_cipher_context_reset(context, NULL); - - md4_context = purple_cipher_context_get_data(context); - memset(md4_context, 0, sizeof(md4_context)); - - g_free(md4_context); - md4_context = NULL; -} - -static size_t -md4_get_block_size(PurpleCipherContext *context) -{ - /* This does not change (in this case) */ - return MD4_HMAC_BLOCK_SIZE; -} - -static PurpleCipherOps MD4Ops = { - NULL, /* Set option */ - NULL, /* Get option */ - md4_init, /* init */ - md4_reset, /* reset */ - md4_uninit, /* uninit */ - NULL, /* set iv */ - md4_append, /* append */ - md4_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - md4_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -/******************************************************************************* - * HMAC - ******************************************************************************/ - -struct HMAC_Context { - PurpleCipherContext *hash; - char *name; - int blocksize; - guchar *opad; -}; - -static void -hmac_init(PurpleCipherContext *context, gpointer extra) -{ - struct HMAC_Context *hctx; - hctx = g_new0(struct HMAC_Context, 1); - purple_cipher_context_set_data(context, hctx); - purple_cipher_context_reset(context, extra); -} - -static void -hmac_reset(PurpleCipherContext *context, gpointer extra) -{ - struct HMAC_Context *hctx; - - hctx = purple_cipher_context_get_data(context); - - g_free(hctx->name); - hctx->name = NULL; - if (hctx->hash) - purple_cipher_context_destroy(hctx->hash); - hctx->hash = NULL; - hctx->blocksize = 0; - g_free(hctx->opad); - hctx->opad = NULL; -} - -static void -hmac_set_opt(PurpleCipherContext *context, const gchar *name, void *value) -{ - struct HMAC_Context *hctx; - - hctx = purple_cipher_context_get_data(context); - - if (purple_strequal(name, "hash")) { - g_free(hctx->name); - if (hctx->hash) - purple_cipher_context_destroy(hctx->hash); - hctx->name = g_strdup((char*)value); - hctx->hash = purple_cipher_context_new_by_name((char *)value, NULL); - hctx->blocksize = purple_cipher_context_get_block_size(hctx->hash); - } -} - -static void * -hmac_get_opt(PurpleCipherContext *context, const gchar *name) -{ - struct HMAC_Context *hctx; - - hctx = purple_cipher_context_get_data(context); - - if (purple_strequal(name, "hash")) { - return hctx->name; - } - - return NULL; -} - -static void -hmac_append(PurpleCipherContext *context, const guchar *data, size_t len) -{ - struct HMAC_Context *hctx = purple_cipher_context_get_data(context); - - g_return_if_fail(hctx->hash != NULL); - - purple_cipher_context_append(hctx->hash, data, len); -} - -static gboolean -hmac_digest(PurpleCipherContext *context, size_t in_len, guchar *out, size_t *out_len) -{ - struct HMAC_Context *hctx = purple_cipher_context_get_data(context); - PurpleCipherContext *hash = hctx->hash; - guchar *inner_hash; - size_t hash_len; - gboolean result; - - g_return_val_if_fail(hash != NULL, FALSE); - - inner_hash = g_malloc(100); /* TODO: Should be enough for now... */ - result = purple_cipher_context_digest(hash, 100, inner_hash, &hash_len); - - purple_cipher_context_reset(hash, NULL); - - purple_cipher_context_append(hash, hctx->opad, hctx->blocksize); - purple_cipher_context_append(hash, inner_hash, hash_len); - - g_free(inner_hash); - - result = result && purple_cipher_context_digest(hash, in_len, out, out_len); - - return result; -} - -static void -hmac_uninit(PurpleCipherContext *context) -{ - struct HMAC_Context *hctx; - - purple_cipher_context_reset(context, NULL); - - hctx = purple_cipher_context_get_data(context); - - g_free(hctx); -} - -static void -hmac_set_key_with_len(PurpleCipherContext *context, const guchar * key, size_t key_len) -{ - struct HMAC_Context *hctx = purple_cipher_context_get_data(context); - int blocksize, i; - guchar *ipad; - guchar *full_key; - - g_return_if_fail(hctx->hash != NULL); - - g_free(hctx->opad); - - blocksize = hctx->blocksize; - ipad = g_malloc(blocksize); - hctx->opad = g_malloc(blocksize); - - if (key_len > blocksize) { - purple_cipher_context_reset(hctx->hash, NULL); - purple_cipher_context_append(hctx->hash, key, key_len); - full_key = g_malloc(100); /* TODO: Should be enough for now... */ - purple_cipher_context_digest(hctx->hash, 100, full_key, &key_len); - } else - full_key = g_memdup(key, key_len); - - if (key_len < blocksize) { - full_key = g_realloc(full_key, blocksize); - memset(full_key + key_len, 0, blocksize - key_len); - } - - for(i = 0; i < blocksize; i++) { - ipad[i] = 0x36 ^ full_key[i]; - hctx->opad[i] = 0x5c ^ full_key[i]; - } - - g_free(full_key); - - purple_cipher_context_reset(hctx->hash, NULL); - purple_cipher_context_append(hctx->hash, ipad, blocksize); - g_free(ipad); -} - -static void -hmac_set_key(PurpleCipherContext *context, const guchar * key) -{ - hmac_set_key_with_len(context, key, strlen((char *)key)); -} - -static size_t -hmac_get_block_size(PurpleCipherContext *context) -{ - struct HMAC_Context *hctx = purple_cipher_context_get_data(context); - - return hctx->blocksize; -} - -static PurpleCipherOps HMACOps = { - hmac_set_opt, /* Set option */ - hmac_get_opt, /* Get option */ - hmac_init, /* init */ - hmac_reset, /* reset */ - hmac_uninit, /* uninit */ - NULL, /* set iv */ - hmac_append, /* append */ - hmac_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - hmac_set_key, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - hmac_get_block_size, /* get block size */ - hmac_set_key_with_len /* set key with len */ -}; - -/****************************************************************************** - * DES - *****************************************************************************/ - -typedef struct _des_ctx -{ - guint32 encrypt_subkeys[32]; - guint32 decrypt_subkeys[32]; -} des_ctx[1]; - -/* - * The s-box values are permuted according to the 'primitive function P' - */ -static const guint32 sbox1[64] = -{ - 0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000, - 0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002, - 0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202, - 0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000, - 0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200, - 0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202, - 0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200, - 0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002 -}; - -static const guint32 sbox2[64] = -{ - 0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010, - 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010, - 0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000, - 0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010, - 0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000, - 0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000, - 0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010, - 0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000 -}; - -static const guint32 sbox3[64] = -{ - 0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100, - 0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104, - 0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104, - 0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000, - 0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000, - 0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004, - 0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004, - 0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100 -}; - -static const guint32 sbox4[64] = -{ - 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000, - 0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000, - 0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040, - 0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040, - 0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000, - 0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040, - 0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040, - 0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040 -}; - -static const guint32 sbox5[64] = -{ - 0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000, - 0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000, - 0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080, - 0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080, - 0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080, - 0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000, - 0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000, - 0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080 -}; - -static const guint32 sbox6[64] = -{ - 0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000, - 0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008, - 0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008, - 0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000, - 0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008, - 0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000, - 0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008, - 0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008 -}; - -static const guint32 sbox7[64] = -{ - 0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400, - 0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401, - 0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001, - 0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400, - 0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001, - 0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400, - 0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401, - 0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001 -}; - -static const guint32 sbox8[64] = -{ - 0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000, - 0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020, - 0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800, - 0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000, - 0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820, - 0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820, - 0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000, - 0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800 -}; - - - -/* - * * These two tables are part of the 'permuted choice 1' function. - * * In this implementation several speed improvements are done. - * */ -static const guint32 leftkey_swap[16] = -{ - 0x00000000, 0x00000001, 0x00000100, 0x00000101, - 0x00010000, 0x00010001, 0x00010100, 0x00010101, - 0x01000000, 0x01000001, 0x01000100, 0x01000101, - 0x01010000, 0x01010001, 0x01010100, 0x01010101 -}; - -static const guint32 rightkey_swap[16] = -{ - 0x00000000, 0x01000000, 0x00010000, 0x01010000, - 0x00000100, 0x01000100, 0x00010100, 0x01010100, - 0x00000001, 0x01000001, 0x00010001, 0x01010001, - 0x00000101, 0x01000101, 0x00010101, 0x01010101, -}; - - - -/* - * Numbers of left shifts per round for encryption subkey schedule - * To calculate the decryption key scheduling we just reverse the - * ordering of the subkeys so we can omit the table for decryption - * subkey schedule. - */ -static const guint8 encrypt_rotate_tab[16] = -{ - 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 -}; - -/* - * Macro to swap bits across two words - **/ -#define DO_PERMUTATION(a, temp, b, offset, mask) \ - temp = ((a>>offset) ^ b) & mask; \ -b ^= temp; \ -a ^= temp<>31)) ^ *subkey++; \ -to ^= sbox8[ work & 0x3f ]; \ -to ^= sbox6[ (work>>8) & 0x3f ]; \ -to ^= sbox4[ (work>>16) & 0x3f ]; \ -to ^= sbox2[ (work>>24) & 0x3f ]; \ -work = ((from>>3) | (from<<29)) ^ *subkey++; \ -to ^= sbox7[ work & 0x3f ]; \ -to ^= sbox5[ (work>>8) & 0x3f ]; \ -to ^= sbox3[ (work>>16) & 0x3f ]; \ -to ^= sbox1[ (work>>24) & 0x3f ]; - - -/* - * Macros to convert 8 bytes from/to 32bit words - **/ -#define READ_64BIT_DATA(data, left, right) \ - left = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; \ -right = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7]; - -#define WRITE_64BIT_DATA(data, left, right) \ - data[0] = (left >> 24) &0xff; data[1] = (left >> 16) &0xff; \ -data[2] = (left >> 8) &0xff; data[3] = left &0xff; \ -data[4] = (right >> 24) &0xff; data[5] = (right >> 16) &0xff; \ -data[6] = (right >> 8) &0xff; data[7] = right &0xff; - - - - - - -/* - * des_key_schedule(): Calculate 16 subkeys pairs (even/odd) for - * 16 encryption rounds. - * To calculate subkeys for decryption the caller - * have to reorder the generated subkeys. - * - * rawkey: 8 Bytes of key data - * subkey: Array of at least 32 guint32s. Will be filled - * with calculated subkeys. - * - **/ -static void -des_key_schedule (const guint8 * rawkey, guint32 * subkey) -{ - guint32 left, right, work; - int round; - - READ_64BIT_DATA (rawkey, left, right) - - DO_PERMUTATION (right, work, left, 4, 0x0f0f0f0f) - DO_PERMUTATION (right, work, left, 0, 0x10101010) - - left = (leftkey_swap[(left >> 0) & 0xf] << 3) | (leftkey_swap[(left >> 8) & 0xf] << 2) - | (leftkey_swap[(left >> 16) & 0xf] << 1) | (leftkey_swap[(left >> 24) & 0xf]) - | (leftkey_swap[(left >> 5) & 0xf] << 7) | (leftkey_swap[(left >> 13) & 0xf] << 6) - | (leftkey_swap[(left >> 21) & 0xf] << 5) | (leftkey_swap[(left >> 29) & 0xf] << 4); - - left &= 0x0fffffff; - - right = (rightkey_swap[(right >> 1) & 0xf] << 3) | (rightkey_swap[(right >> 9) & 0xf] << 2) - | (rightkey_swap[(right >> 17) & 0xf] << 1) | (rightkey_swap[(right >> 25) & 0xf]) - | (rightkey_swap[(right >> 4) & 0xf] << 7) | (rightkey_swap[(right >> 12) & 0xf] << 6) - | (rightkey_swap[(right >> 20) & 0xf] << 5) | (rightkey_swap[(right >> 28) & 0xf] << 4); - - right &= 0x0fffffff; - - for (round = 0; round < 16; ++round) - { - left = ((left << encrypt_rotate_tab[round]) | (left >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff; - right = ((right << encrypt_rotate_tab[round]) | (right >> (28 - encrypt_rotate_tab[round]))) & 0x0fffffff; - - *subkey++ = ((left << 4) & 0x24000000) - | ((left << 28) & 0x10000000) - | ((left << 14) & 0x08000000) - | ((left << 18) & 0x02080000) - | ((left << 6) & 0x01000000) - | ((left << 9) & 0x00200000) - | ((left >> 1) & 0x00100000) - | ((left << 10) & 0x00040000) - | ((left << 2) & 0x00020000) - | ((left >> 10) & 0x00010000) - | ((right >> 13) & 0x00002000) - | ((right >> 4) & 0x00001000) - | ((right << 6) & 0x00000800) - | ((right >> 1) & 0x00000400) - | ((right >> 14) & 0x00000200) - | (right & 0x00000100) - | ((right >> 5) & 0x00000020) - | ((right >> 10) & 0x00000010) - | ((right >> 3) & 0x00000008) - | ((right >> 18) & 0x00000004) - | ((right >> 26) & 0x00000002) - | ((right >> 24) & 0x00000001); - - *subkey++ = ((left << 15) & 0x20000000) - | ((left << 17) & 0x10000000) - | ((left << 10) & 0x08000000) - | ((left << 22) & 0x04000000) - | ((left >> 2) & 0x02000000) - | ((left << 1) & 0x01000000) - | ((left << 16) & 0x00200000) - | ((left << 11) & 0x00100000) - | ((left << 3) & 0x00080000) - | ((left >> 6) & 0x00040000) - | ((left << 15) & 0x00020000) - | ((left >> 4) & 0x00010000) - | ((right >> 2) & 0x00002000) - | ((right << 8) & 0x00001000) - | ((right >> 14) & 0x00000808) - | ((right >> 9) & 0x00000400) - | ((right) & 0x00000200) - | ((right << 7) & 0x00000100) - | ((right >> 7) & 0x00000020) - | ((right >> 3) & 0x00000011) - | ((right << 2) & 0x00000004) - | ((right >> 21) & 0x00000002); - } -} - - - -/* - * Fill a DES context with subkeys calculated from a 64bit key. - * Does not check parity bits, but simply ignore them. - * Does not check for weak keys. - **/ -static void -des_set_key (PurpleCipherContext *context, const guchar * key) -{ - struct _des_ctx *ctx = purple_cipher_context_get_data(context); - int i; - - des_key_schedule (key, ctx->encrypt_subkeys); - - for(i=0; i<32; i+=2) - { - ctx->decrypt_subkeys[i] = ctx->encrypt_subkeys[30-i]; - ctx->decrypt_subkeys[i+1] = ctx->encrypt_subkeys[31-i]; - } -} - - - -/* - * Electronic Codebook Mode DES encryption/decryption of data according - * to 'mode'. - **/ -static int -des_ecb_crypt (struct _des_ctx *ctx, const guint8 * from, guint8 * to, int mode) -{ - guint32 left, right, work; - guint32 *keys; - - keys = mode ? ctx->decrypt_subkeys : ctx->encrypt_subkeys; - - READ_64BIT_DATA (from, left, right) - INITIAL_PERMUTATION (left, work, right) - - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - DES_ROUND (right, left, work, keys) DES_ROUND (left, right, work, keys) - - FINAL_PERMUTATION (right, work, left) - WRITE_64BIT_DATA (to, right, left) - - return 0; -} - -static gint -des_encrypt(PurpleCipherContext *context, const guchar data[], - size_t len, guchar output[], size_t *outlen) { - int offset = 0; - int i = 0; - int tmp; - guint8 buf[8] = {0,0,0,0,0,0,0,0}; - while(offset+8<=len) { - des_ecb_crypt(purple_cipher_context_get_data(context), - data+offset, - output+offset, - 0); - offset+=8; - } - *outlen = len; - if(offsetkey1.encrypt_subkeys); - des_key_schedule (key + 8, ctx->key2.encrypt_subkeys); - des_key_schedule (key + 16, ctx->key3.encrypt_subkeys); - - for (i = 0; i < 32; i += 2) - { - ctx->key1.decrypt_subkeys[i] = ctx->key1.encrypt_subkeys[30-i]; - ctx->key1.decrypt_subkeys[i+1] = ctx->key1.encrypt_subkeys[31-i]; - ctx->key2.decrypt_subkeys[i] = ctx->key2.encrypt_subkeys[30-i]; - ctx->key2.decrypt_subkeys[i+1] = ctx->key2.encrypt_subkeys[31-i]; - ctx->key3.decrypt_subkeys[i] = ctx->key3.encrypt_subkeys[30-i]; - ctx->key3.decrypt_subkeys[i+1] = ctx->key3.encrypt_subkeys[31-i]; - } -} - -static gint -des3_ecb_encrypt(struct _des3_ctx *ctx, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - int offset = 0; - int i = 0; - int tmp; - guint8 buf[8] = {0,0,0,0,0,0,0,0}; - while (offset + 8 <= len) { - des_ecb_crypt(&ctx->key1, - data+offset, - output+offset, - 0); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 1); - des_ecb_crypt(&ctx->key3, - buf, - output+offset, - 0); - offset += 8; - } - *outlen = len; - if (offset < len) { - *outlen += len - offset; - tmp = offset; - memset(buf, 0, 8); - while (tmp < len) { - buf[i++] = data[tmp]; - tmp++; - } - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 0); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 1); - des_ecb_crypt(&ctx->key3, - buf, - output+offset, - 0); - } - return 0; -} - -static gint -des3_cbc_encrypt(struct _des3_ctx *ctx, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - int offset = 0; - int i = 0; - int tmp; - guint8 buf[8]; - memcpy(buf, ctx->iv, 8); - while (offset + 8 <= len) { - for (i = 0; i < 8; i++) - buf[i] ^= data[offset + i]; - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 0); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 1); - des_ecb_crypt(&ctx->key3, - buf, - output+offset, - 0); - memcpy(buf, output+offset, 8); - offset += 8; - } - *outlen = len; - if (offset < len) { - *outlen += len - offset; - tmp = offset; - i = 0; - while (tmp < len) { - buf[i++] ^= data[tmp]; - tmp++; - } - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 0); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 1); - des_ecb_crypt(&ctx->key3, - buf, - output+offset, - 0); - } - return 0; -} - -static gint -des3_encrypt(PurpleCipherContext *context, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - struct _des3_ctx *ctx = purple_cipher_context_get_data(context); - - if (ctx->mode == PURPLE_CIPHER_BATCH_MODE_ECB) { - return des3_ecb_encrypt(ctx, data, len, output, outlen); - } else if (ctx->mode == PURPLE_CIPHER_BATCH_MODE_CBC) { - return des3_cbc_encrypt(ctx, data, len, output, outlen); - } else { - g_return_val_if_reached(0); - } - - return 0; -} - -static gint -des3_ecb_decrypt(struct _des3_ctx *ctx, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - int offset = 0; - int i = 0; - int tmp; - guint8 buf[8] = {0,0,0,0,0,0,0,0}; - while (offset + 8 <= len) { - /* NOTE: Apply key in reverse */ - des_ecb_crypt(&ctx->key3, - data+offset, - output+offset, - 1); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 0); - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 1); - offset+=8; - } - *outlen = len; - if (offset < len) { - *outlen += len - offset; - tmp = offset; - memset(buf, 0, 8); - while (tmp < len) { - buf[i++] = data[tmp]; - tmp++; - } - des_ecb_crypt(&ctx->key3, - buf, - output+offset, - 1); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 0); - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 1); - } - return 0; -} - -static gint -des3_cbc_decrypt(struct _des3_ctx *ctx, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - int offset = 0; - int i = 0; - int tmp; - guint8 buf[8] = {0,0,0,0,0,0,0,0}; - guint8 link[8]; - memcpy(link, ctx->iv, 8); - while (offset + 8 <= len) { - des_ecb_crypt(&ctx->key3, - data+offset, - output+offset, - 1); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 0); - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 1); - for (i = 0; i < 8; i++) - output[offset + i] ^= link[i]; - memcpy(link, data + offset, 8); - offset+=8; - } - *outlen = len; - if(offsetkey3, - buf, - output+offset, - 1); - des_ecb_crypt(&ctx->key2, - output+offset, - buf, - 0); - des_ecb_crypt(&ctx->key1, - buf, - output+offset, - 1); - for (i = 0; i < 8; i++) - output[offset + i] ^= link[i]; - } - return 0; -} - -static gint -des3_decrypt(PurpleCipherContext *context, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - struct _des3_ctx *ctx = purple_cipher_context_get_data(context); - - if (ctx->mode == PURPLE_CIPHER_BATCH_MODE_ECB) { - return des3_ecb_decrypt(ctx, data, len, output, outlen); - } else if (ctx->mode == PURPLE_CIPHER_BATCH_MODE_CBC) { - return des3_cbc_decrypt(ctx, data, len, output, outlen); - } else { - g_return_val_if_reached(0); - } - - return 0; -} - -static void -des3_set_batch(PurpleCipherContext *context, PurpleCipherBatchMode mode) -{ - struct _des3_ctx *ctx = purple_cipher_context_get_data(context); - - ctx->mode = mode; -} - -static PurpleCipherBatchMode -des3_get_batch(PurpleCipherContext *context) -{ - struct _des3_ctx *ctx = purple_cipher_context_get_data(context); - - return ctx->mode; -} - -static void -des3_set_iv(PurpleCipherContext *context, guchar *iv, size_t len) -{ - struct _des3_ctx *ctx; - - g_return_if_fail(len == 8); - - ctx = purple_cipher_context_get_data(context); - - memcpy(ctx->iv, iv, len); -} - -static void -des3_init(PurpleCipherContext *context, gpointer extra) -{ - struct _des3_ctx *mctx; - mctx = g_new0(struct _des3_ctx, 1); - purple_cipher_context_set_data(context, mctx); -} - -static void -des3_uninit(PurpleCipherContext *context) -{ - struct _des3_ctx *des3_context; - - des3_context = purple_cipher_context_get_data(context); - memset(des3_context, 0, sizeof(des3_context)); - - g_free(des3_context); - des3_context = NULL; -} - -static PurpleCipherOps DES3Ops = { - NULL, /* Set option */ - NULL, /* Get option */ - des3_init, /* init */ - NULL, /* reset */ - des3_uninit, /* uninit */ - des3_set_iv, /* set iv */ - NULL, /* append */ - NULL, /* digest */ - des3_encrypt, /* encrypt */ - des3_decrypt, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - des3_set_key, /* set key */ - NULL, /* get key size */ - des3_set_batch, /* set batch mode */ - des3_get_batch, /* get batch mode */ - NULL, /* get block size */ - NULL /* set key with len */ -}; - -/******************************************************************************* - * SHA-1 - ******************************************************************************/ -#define SHA1_HMAC_BLOCK_SIZE 64 - -static size_t -sha1_get_block_size(PurpleCipherContext *context) -{ - /* This does not change (in this case) */ - return SHA1_HMAC_BLOCK_SIZE; -} - - -#if GLIB_CHECK_VERSION(2,16,0) - -static void -sha1_init(PurpleCipherContext *context, void *extra) -{ - purple_g_checksum_init(context, G_CHECKSUM_SHA1); -} - -static void -sha1_reset(PurpleCipherContext *context, void *extra) -{ - purple_g_checksum_reset(context, G_CHECKSUM_SHA1); -} - -static gboolean -sha1_digest(PurpleCipherContext *context, gsize in_len, guchar digest[20], - gsize *out_len) -{ - return purple_g_checksum_digest(context, G_CHECKSUM_SHA1, in_len, - digest, out_len); -} - -static PurpleCipherOps SHA1Ops = { - NULL, /* Set Option */ - NULL, /* Get Option */ - sha1_init, /* init */ - sha1_reset, /* reset */ - purple_g_checksum_uninit, /* uninit */ - NULL, /* set iv */ - purple_g_checksum_append, /* append */ - sha1_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - sha1_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -#else /* GLIB_CHECK_VERSION(2,16,0) */ - -#define SHA1_HMAC_BLOCK_SIZE 64 -#define SHA1_ROTL(X,n) ((((X) << (n)) | ((X) >> (32-(n)))) & 0xFFFFFFFF) - -struct SHA1Context { - guint32 H[5]; - guint32 W[80]; - - gint lenW; - - guint32 sizeHi; - guint32 sizeLo; -}; - -static void -sha1_hash_block(struct SHA1Context *sha1_ctx) { - gint i; - guint32 A, B, C, D, E, T; - - for(i = 16; i < 80; i++) { - sha1_ctx->W[i] = SHA1_ROTL(sha1_ctx->W[i - 3] ^ - sha1_ctx->W[i - 8] ^ - sha1_ctx->W[i - 14] ^ - sha1_ctx->W[i - 16], 1); - } - - A = sha1_ctx->H[0]; - B = sha1_ctx->H[1]; - C = sha1_ctx->H[2]; - D = sha1_ctx->H[3]; - E = sha1_ctx->H[4]; - - for(i = 0; i < 20; i++) { - T = (SHA1_ROTL(A, 5) + (((C ^ D) & B) ^ D) + E + sha1_ctx->W[i] + 0x5A827999) & 0xFFFFFFFF; - E = D; - D = C; - C = SHA1_ROTL(B, 30); - B = A; - A = T; - } - - for(i = 20; i < 40; i++) { - T = (SHA1_ROTL(A, 5) + (B ^ C ^ D) + E + sha1_ctx->W[i] + 0x6ED9EBA1) & 0xFFFFFFFF; - E = D; - D = C; - C = SHA1_ROTL(B, 30); - B = A; - A = T; - } - - for(i = 40; i < 60; i++) { - T = (SHA1_ROTL(A, 5) + ((B & C) | (D & (B | C))) + E + sha1_ctx->W[i] + 0x8F1BBCDC) & 0xFFFFFFFF; - E = D; - D = C; - C = SHA1_ROTL(B, 30); - B = A; - A = T; - } - - for(i = 60; i < 80; i++) { - T = (SHA1_ROTL(A, 5) + (B ^ C ^ D) + E + sha1_ctx->W[i] + 0xCA62C1D6) & 0xFFFFFFFF; - E = D; - D = C; - C = SHA1_ROTL(B, 30); - B = A; - A = T; - } - - sha1_ctx->H[0] += A; - sha1_ctx->H[1] += B; - sha1_ctx->H[2] += C; - sha1_ctx->H[3] += D; - sha1_ctx->H[4] += E; -} - -static void -sha1_set_opt(PurpleCipherContext *context, const gchar *name, void *value) { - struct SHA1Context *ctx; - - ctx = purple_cipher_context_get_data(context); - - if(purple_strequal(name, "sizeHi")) { - ctx->sizeHi = GPOINTER_TO_INT(value); - } else if(purple_strequal(name, "sizeLo")) { - ctx->sizeLo = GPOINTER_TO_INT(value); - } else if(purple_strequal(name, "lenW")) { - ctx->lenW = GPOINTER_TO_INT(value); - } -} - -static void * -sha1_get_opt(PurpleCipherContext *context, const gchar *name) { - struct SHA1Context *ctx; - - ctx = purple_cipher_context_get_data(context); - - if(purple_strequal(name, "sizeHi")) { - return GINT_TO_POINTER(ctx->sizeHi); - } else if(purple_strequal(name, "sizeLo")) { - return GINT_TO_POINTER(ctx->sizeLo); - } else if(purple_strequal(name, "lenW")) { - return GINT_TO_POINTER(ctx->lenW); - } - - return NULL; -} - -static void -sha1_init(PurpleCipherContext *context, void *extra) { - struct SHA1Context *sha1_ctx; - - sha1_ctx = g_new0(struct SHA1Context, 1); - - purple_cipher_context_set_data(context, sha1_ctx); - - purple_cipher_context_reset(context, extra); -} - -static void -sha1_reset(PurpleCipherContext *context, void *extra) { - struct SHA1Context *sha1_ctx; - gint i; - - sha1_ctx = purple_cipher_context_get_data(context); - - g_return_if_fail(sha1_ctx); - - sha1_ctx->lenW = 0; - sha1_ctx->sizeHi = 0; - sha1_ctx->sizeLo = 0; - - sha1_ctx->H[0] = 0x67452301; - sha1_ctx->H[1] = 0xEFCDAB89; - sha1_ctx->H[2] = 0x98BADCFE; - sha1_ctx->H[3] = 0x10325476; - sha1_ctx->H[4] = 0xC3D2E1F0; - - for(i = 0; i < 80; i++) - sha1_ctx->W[i] = 0; -} - -static void -sha1_uninit(PurpleCipherContext *context) { - struct SHA1Context *sha1_ctx; - - purple_cipher_context_reset(context, NULL); - - sha1_ctx = purple_cipher_context_get_data(context); - - memset(sha1_ctx, 0, sizeof(struct SHA1Context)); - - g_free(sha1_ctx); - sha1_ctx = NULL; -} - - -static void -sha1_append(PurpleCipherContext *context, const guchar *data, size_t len) { - struct SHA1Context *sha1_ctx; - gint i; - - sha1_ctx = purple_cipher_context_get_data(context); - - g_return_if_fail(sha1_ctx); - - for(i = 0; i < len; i++) { - sha1_ctx->W[sha1_ctx->lenW / 4] <<= 8; - sha1_ctx->W[sha1_ctx->lenW / 4] |= data[i]; - - if((++sha1_ctx->lenW) % 64 == 0) { - sha1_hash_block(sha1_ctx); - sha1_ctx->lenW = 0; - } - - sha1_ctx->sizeLo += 8; - sha1_ctx->sizeHi += (sha1_ctx->sizeLo < 8); - } -} - -static gboolean -sha1_digest(PurpleCipherContext *context, size_t in_len, guchar digest[20], - size_t *out_len) -{ - struct SHA1Context *sha1_ctx; - guchar pad0x80 = 0x80, pad0x00 = 0x00; - guchar padlen[8]; - gint i; - - g_return_val_if_fail(in_len >= 20, FALSE); - - sha1_ctx = purple_cipher_context_get_data(context); - - g_return_val_if_fail(sha1_ctx, FALSE); - - padlen[0] = (guchar)((sha1_ctx->sizeHi >> 24) & 255); - padlen[1] = (guchar)((sha1_ctx->sizeHi >> 16) & 255); - padlen[2] = (guchar)((sha1_ctx->sizeHi >> 8) & 255); - padlen[3] = (guchar)((sha1_ctx->sizeHi >> 0) & 255); - padlen[4] = (guchar)((sha1_ctx->sizeLo >> 24) & 255); - padlen[5] = (guchar)((sha1_ctx->sizeLo >> 16) & 255); - padlen[6] = (guchar)((sha1_ctx->sizeLo >> 8) & 255); - padlen[7] = (guchar)((sha1_ctx->sizeLo >> 0) & 255); - - /* pad with a 1, then zeroes, then length */ - purple_cipher_context_append(context, &pad0x80, 1); - while(sha1_ctx->lenW != 56) - purple_cipher_context_append(context, &pad0x00, 1); - purple_cipher_context_append(context, padlen, 8); - - for(i = 0; i < 20; i++) { - digest[i] = (guchar)(sha1_ctx->H[i / 4] >> 24); - sha1_ctx->H[i / 4] <<= 8; - } - - purple_cipher_context_reset(context, NULL); - - if(out_len) - *out_len = 20; - - return TRUE; -} - -static PurpleCipherOps SHA1Ops = { - sha1_set_opt, /* Set Option */ - sha1_get_opt, /* Get Option */ - sha1_init, /* init */ - sha1_reset, /* reset */ - sha1_uninit, /* uninit */ - NULL, /* set iv */ - sha1_append, /* append */ - sha1_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - sha1_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -#endif /* GLIB_CHECK_VERSION(2,16,0) */ - -/******************************************************************************* - * SHA-256 - ******************************************************************************/ -#define SHA256_HMAC_BLOCK_SIZE 64 - -static size_t -sha256_get_block_size(PurpleCipherContext *context) -{ - /* This does not change (in this case) */ - return SHA256_HMAC_BLOCK_SIZE; -} - -#if GLIB_CHECK_VERSION(2,16,0) - -static void -sha256_init(PurpleCipherContext *context, void *extra) -{ - purple_g_checksum_init(context, G_CHECKSUM_SHA256); -} - -static void -sha256_reset(PurpleCipherContext *context, void *extra) -{ - purple_g_checksum_reset(context, G_CHECKSUM_SHA256); -} - -static gboolean -sha256_digest(PurpleCipherContext *context, gsize in_len, guchar digest[20], - gsize *out_len) -{ - return purple_g_checksum_digest(context, G_CHECKSUM_SHA256, in_len, - digest, out_len); -} - -static PurpleCipherOps SHA256Ops = { - NULL, /* Set Option */ - NULL, /* Get Option */ - sha256_init, /* init */ - sha256_reset, /* reset */ - purple_g_checksum_uninit, /* uninit */ - NULL, /* set iv */ - purple_g_checksum_append, /* append */ - sha256_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - sha256_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -#else /* GLIB_CHECK_VERSION(2,16,0) */ - -#define SHA256_ROTR(X,n) ((((X) >> (n)) | ((X) << (32-(n)))) & 0xFFFFFFFF) - -static const guint32 sha256_K[64] = -{ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -}; - -struct SHA256Context { - guint32 H[8]; - guint32 W[64]; - - gint lenW; - - guint32 sizeHi; - guint32 sizeLo; -}; - -static void -sha256_hash_block(struct SHA256Context *sha256_ctx) { - gint i; - guint32 A, B, C, D, E, F, G, H, T1, T2; - - for(i = 16; i < 64; i++) { - sha256_ctx->W[i] = - (SHA256_ROTR(sha256_ctx->W[i-2], 17) ^ SHA256_ROTR(sha256_ctx->W[i-2], 19) ^ (sha256_ctx->W[i-2] >> 10)) - + sha256_ctx->W[i-7] - + (SHA256_ROTR(sha256_ctx->W[i-15], 7) ^ SHA256_ROTR(sha256_ctx->W[i-15], 18) ^ (sha256_ctx->W[i-15] >> 3)) - + sha256_ctx->W[i-16]; - } - - A = sha256_ctx->H[0]; - B = sha256_ctx->H[1]; - C = sha256_ctx->H[2]; - D = sha256_ctx->H[3]; - E = sha256_ctx->H[4]; - F = sha256_ctx->H[5]; - G = sha256_ctx->H[6]; - H = sha256_ctx->H[7]; - - for(i = 0; i < 64; i++) { - T1 = H - + (SHA256_ROTR(E, 6) ^ SHA256_ROTR(E, 11) ^ SHA256_ROTR(E, 25)) - + ((E & F) ^ ((~E) & G)) - + sha256_K[i] + sha256_ctx->W[i]; - T2 = (SHA256_ROTR(A, 2) ^ SHA256_ROTR(A, 13) ^ SHA256_ROTR(A, 22)) - + ((A & B) ^ (A & C) ^ (B & C)); - H = G; - G = F; - F = E; - E = D + T1; - D = C; - C = B; - B = A; - A = T1 + T2; - } - - sha256_ctx->H[0] += A; - sha256_ctx->H[1] += B; - sha256_ctx->H[2] += C; - sha256_ctx->H[3] += D; - sha256_ctx->H[4] += E; - sha256_ctx->H[5] += F; - sha256_ctx->H[6] += G; - sha256_ctx->H[7] += H; -} - -static void -sha256_set_opt(PurpleCipherContext *context, const gchar *name, void *value) { - struct SHA256Context *ctx; - - ctx = purple_cipher_context_get_data(context); - - if(!strcmp(name, "sizeHi")) { - ctx->sizeHi = GPOINTER_TO_INT(value); - } else if(!strcmp(name, "sizeLo")) { - ctx->sizeLo = GPOINTER_TO_INT(value); - } else if(!strcmp(name, "lenW")) { - ctx->lenW = GPOINTER_TO_INT(value); - } -} - -static void * -sha256_get_opt(PurpleCipherContext *context, const gchar *name) { - struct SHA256Context *ctx; - - ctx = purple_cipher_context_get_data(context); - - if(!strcmp(name, "sizeHi")) { - return GINT_TO_POINTER(ctx->sizeHi); - } else if(!strcmp(name, "sizeLo")) { - return GINT_TO_POINTER(ctx->sizeLo); - } else if(!strcmp(name, "lenW")) { - return GINT_TO_POINTER(ctx->lenW); - } - - return NULL; -} - -static void -sha256_init(PurpleCipherContext *context, void *extra) { - struct SHA256Context *sha256_ctx; - - sha256_ctx = g_new0(struct SHA256Context, 1); - - purple_cipher_context_set_data(context, sha256_ctx); - - purple_cipher_context_reset(context, extra); -} - -static void -sha256_reset(PurpleCipherContext *context, void *extra) { - struct SHA256Context *sha256_ctx; - gint i; - - sha256_ctx = purple_cipher_context_get_data(context); - - g_return_if_fail(sha256_ctx); - - sha256_ctx->lenW = 0; - sha256_ctx->sizeHi = 0; - sha256_ctx->sizeLo = 0; - - sha256_ctx->H[0] = 0x6a09e667; - sha256_ctx->H[1] = 0xbb67ae85; - sha256_ctx->H[2] = 0x3c6ef372; - sha256_ctx->H[3] = 0xa54ff53a; - sha256_ctx->H[4] = 0x510e527f; - sha256_ctx->H[5] = 0x9b05688c; - sha256_ctx->H[6] = 0x1f83d9ab; - sha256_ctx->H[7] = 0x5be0cd19; - - for(i = 0; i < 64; i++) - sha256_ctx->W[i] = 0; -} - -static void -sha256_uninit(PurpleCipherContext *context) { - struct SHA256Context *sha256_ctx; - - purple_cipher_context_reset(context, NULL); - - sha256_ctx = purple_cipher_context_get_data(context); - - memset(sha256_ctx, 0, sizeof(struct SHA256Context)); - - g_free(sha256_ctx); - sha256_ctx = NULL; -} - - -static void -sha256_append(PurpleCipherContext *context, const guchar *data, size_t len) { - struct SHA256Context *sha256_ctx; - gint i; - - sha256_ctx = purple_cipher_context_get_data(context); - - g_return_if_fail(sha256_ctx); - - for(i = 0; i < len; i++) { - sha256_ctx->W[sha256_ctx->lenW / 4] <<= 8; - sha256_ctx->W[sha256_ctx->lenW / 4] |= data[i]; - - if((++sha256_ctx->lenW) % 64 == 0) { - sha256_hash_block(sha256_ctx); - sha256_ctx->lenW = 0; - } - - sha256_ctx->sizeLo += 8; - sha256_ctx->sizeHi += (sha256_ctx->sizeLo < 8); - } -} - -static gboolean -sha256_digest(PurpleCipherContext *context, size_t in_len, guchar digest[32], - size_t *out_len) -{ - struct SHA256Context *sha256_ctx; - guchar pad0x80 = 0x80, pad0x00 = 0x00; - guchar padlen[8]; - gint i; - - g_return_val_if_fail(in_len >= 32, FALSE); - - sha256_ctx = purple_cipher_context_get_data(context); - - g_return_val_if_fail(sha256_ctx, FALSE); - - padlen[0] = (guchar)((sha256_ctx->sizeHi >> 24) & 255); - padlen[1] = (guchar)((sha256_ctx->sizeHi >> 16) & 255); - padlen[2] = (guchar)((sha256_ctx->sizeHi >> 8) & 255); - padlen[3] = (guchar)((sha256_ctx->sizeHi >> 0) & 255); - padlen[4] = (guchar)((sha256_ctx->sizeLo >> 24) & 255); - padlen[5] = (guchar)((sha256_ctx->sizeLo >> 16) & 255); - padlen[6] = (guchar)((sha256_ctx->sizeLo >> 8) & 255); - padlen[7] = (guchar)((sha256_ctx->sizeLo >> 0) & 255); - - /* pad with a 1, then zeroes, then length */ - purple_cipher_context_append(context, &pad0x80, 1); - while(sha256_ctx->lenW != 56) - purple_cipher_context_append(context, &pad0x00, 1); - purple_cipher_context_append(context, padlen, 8); - - for(i = 0; i < 32; i++) { - digest[i] = (guchar)(sha256_ctx->H[i / 4] >> 24); - sha256_ctx->H[i / 4] <<= 8; - } - - purple_cipher_context_reset(context, NULL); - - if(out_len) - *out_len = 32; - - return TRUE; -} - -static PurpleCipherOps SHA256Ops = { - sha256_set_opt, /* Set Option */ - sha256_get_opt, /* Get Option */ - sha256_init, /* init */ - sha256_reset, /* reset */ - sha256_uninit, /* uninit */ - NULL, /* set iv */ - sha256_append, /* append */ - sha256_digest, /* digest */ - NULL, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - NULL, /* set key */ - NULL, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - sha256_get_block_size, /* get block size */ - NULL /* set key with len */ -}; - -#endif /* GLIB_CHECK_VERSION(2,16,0) */ - -/******************************************************************************* - * RC4 - ******************************************************************************/ - -struct RC4Context { - guchar state[256]; - guchar x; - guchar y; - gint key_len; -}; - -static void -rc4_init(PurpleCipherContext *context, void *extra) { - struct RC4Context *rc4_ctx; - rc4_ctx = g_new0(struct RC4Context, 1); - purple_cipher_context_set_data(context, rc4_ctx); - purple_cipher_context_reset(context, extra); -} - - -static void -rc4_reset(PurpleCipherContext *context, void *extra) { - struct RC4Context *rc4_ctx; - guint i; - - rc4_ctx = purple_cipher_context_get_data(context); - - g_return_if_fail(rc4_ctx); - - for(i = 0; i < 256; i++) - rc4_ctx->state[i] = i; - rc4_ctx->x = 0; - rc4_ctx->y = 0; - - /* default is 5 bytes (40bit key) */ - rc4_ctx->key_len = 5; - -} - -static void -rc4_uninit(PurpleCipherContext *context) { - struct RC4Context *rc4_ctx; - - rc4_ctx = purple_cipher_context_get_data(context); - memset(rc4_ctx, 0, sizeof(rc4_ctx)); - - g_free(rc4_ctx); - rc4_ctx = NULL; -} - - - -static void -rc4_set_key (PurpleCipherContext *context, const guchar * key) { - struct RC4Context *ctx; - guchar *state; - guchar temp_swap; - guchar x, y; - guint i; - - ctx = purple_cipher_context_get_data(context); - - x = 0; - y = 0; - state = &ctx->state[0]; - for(i = 0; i < 256; i++) - { - y = (key[x] + state[i] + y) % 256; - temp_swap = state[i]; - state[i] = state[y]; - state[y] = temp_swap; - x = (x + 1) % ctx->key_len; - } -} - -static void -rc4_set_opt(PurpleCipherContext *context, const gchar *name, void *value) { - struct RC4Context *ctx; - - ctx = purple_cipher_context_get_data(context); - - if(purple_strequal(name, "key_len")) { - ctx->key_len = GPOINTER_TO_INT(value); - } -} - -static size_t -rc4_get_key_size (PurpleCipherContext *context) -{ - struct RC4Context *ctx; - - g_return_val_if_fail(context, -1); - - ctx = purple_cipher_context_get_data(context); - - g_return_val_if_fail(ctx, -1); - - return ctx->key_len; -} - -static void * -rc4_get_opt(PurpleCipherContext *context, const gchar *name) { - struct RC4Context *ctx; - - ctx = purple_cipher_context_get_data(context); - - if(purple_strequal(name, "key_len")) { - return GINT_TO_POINTER(ctx->key_len); - } - - return NULL; -} - -static gint -rc4_encrypt(PurpleCipherContext *context, const guchar data[], - size_t len, guchar output[], size_t *outlen) { - struct RC4Context *ctx; - guchar temp_swap; - guchar x, y, z; - guchar *state; - guint i; - - ctx = purple_cipher_context_get_data(context); - - x = ctx->x; - y = ctx->y; - state = &ctx->state[0]; - - for(i = 0; i < len; i++) - { - x = (x + 1) % 256; - y = (state[x] + y) % 256; - temp_swap = state[x]; - state[x] = state[y]; - state[y] = temp_swap; - z = state[x] + (state[y]) % 256; - output[i] = data[i] ^ state[z]; - } - ctx->x = x; - ctx->y = y; - if(outlen) - *outlen = len; - - return 0; -} - -static PurpleCipherOps RC4Ops = { - rc4_set_opt, /* Set Option */ - rc4_get_opt, /* Get Option */ - rc4_init, /* init */ - rc4_reset, /* reset */ - rc4_uninit, /* uninit */ - NULL, /* set iv */ - NULL, /* append */ - NULL, /* digest */ - rc4_encrypt, /* encrypt */ - NULL, /* decrypt */ - NULL, /* set salt */ - NULL, /* get salt size */ - rc4_set_key, /* set key */ - rc4_get_key_size, /* get key size */ - NULL, /* set batch mode */ - NULL, /* get batch mode */ - NULL, /* get block size */ - NULL /* set key with len */ -}; - -/******************************************************************************* - * Structs - ******************************************************************************/ -struct _PurpleCipher { - gchar *name; /**< Internal name - used for searching */ - PurpleCipherOps *ops; /**< Operations supported by this cipher */ - guint ref; /**< Reference count */ -}; - -struct _PurpleCipherContext { - PurpleCipher *cipher; /**< Cipher this context is under */ - gpointer data; /**< Internal cipher state data */ -}; - -/****************************************************************************** - * Globals - *****************************************************************************/ -static GList *ciphers = NULL; - -/****************************************************************************** - * PurpleCipher API - *****************************************************************************/ -const gchar * -purple_cipher_get_name(PurpleCipher *cipher) { - g_return_val_if_fail(cipher, NULL); - - return cipher->name; -} - -guint -purple_cipher_get_capabilities(PurpleCipher *cipher) { - PurpleCipherOps *ops = NULL; - guint caps = 0; - - g_return_val_if_fail(cipher, 0); - - ops = cipher->ops; - g_return_val_if_fail(ops, 0); - - if(ops->set_option) - caps |= PURPLE_CIPHER_CAPS_SET_OPT; - if(ops->get_option) - caps |= PURPLE_CIPHER_CAPS_GET_OPT; - if(ops->init) - caps |= PURPLE_CIPHER_CAPS_INIT; - if(ops->reset) - caps |= PURPLE_CIPHER_CAPS_RESET; - if(ops->uninit) - caps |= PURPLE_CIPHER_CAPS_UNINIT; - if(ops->set_iv) - caps |= PURPLE_CIPHER_CAPS_SET_IV; - if(ops->append) - caps |= PURPLE_CIPHER_CAPS_APPEND; - if(ops->digest) - caps |= PURPLE_CIPHER_CAPS_DIGEST; - if(ops->encrypt) - caps |= PURPLE_CIPHER_CAPS_ENCRYPT; - if(ops->decrypt) - caps |= PURPLE_CIPHER_CAPS_DECRYPT; - if(ops->set_salt) - caps |= PURPLE_CIPHER_CAPS_SET_SALT; - if(ops->get_salt_size) - caps |= PURPLE_CIPHER_CAPS_GET_SALT_SIZE; - if(ops->set_key) - caps |= PURPLE_CIPHER_CAPS_SET_KEY; - if(ops->get_key_size) - caps |= PURPLE_CIPHER_CAPS_GET_KEY_SIZE; - if(ops->set_batch_mode) - caps |= PURPLE_CIPHER_CAPS_SET_BATCH_MODE; - if(ops->get_batch_mode) - caps |= PURPLE_CIPHER_CAPS_GET_BATCH_MODE; - if(ops->get_block_size) - caps |= PURPLE_CIPHER_CAPS_GET_BLOCK_SIZE; - if(ops->set_key_with_len) - caps |= PURPLE_CIPHER_CAPS_SET_KEY_WITH_LEN; - - return caps; -} - -gboolean -purple_cipher_digest_region(const gchar *name, const guchar *data, - size_t data_len, size_t in_len, - guchar digest[], size_t *out_len) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - gboolean ret = FALSE; - - g_return_val_if_fail(name, FALSE); - g_return_val_if_fail(data, FALSE); - - cipher = purple_ciphers_find_cipher(name); - - g_return_val_if_fail(cipher, FALSE); - - if(!cipher->ops->append || !cipher->ops->digest) { - purple_debug_warning("cipher", "purple_cipher_region failed: " - "the %s cipher does not support appending and or " - "digesting.", cipher->name); - return FALSE; - } - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, data, data_len); - ret = purple_cipher_context_digest(context, in_len, digest, out_len); - purple_cipher_context_destroy(context); - - return ret; -} - -/****************************************************************************** - * PurpleCiphers API - *****************************************************************************/ -PurpleCipher * -purple_ciphers_find_cipher(const gchar *name) { - PurpleCipher *cipher; - GList *l; - - g_return_val_if_fail(name, NULL); - - for(l = ciphers; l; l = l->next) { - cipher = PURPLE_CIPHER(l->data); - - if(!g_ascii_strcasecmp(cipher->name, name)) - return cipher; - } - - return NULL; -} - -PurpleCipher * -purple_ciphers_register_cipher(const gchar *name, PurpleCipherOps *ops) { - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(name, NULL); - g_return_val_if_fail(ops, NULL); - g_return_val_if_fail(!purple_ciphers_find_cipher(name), NULL); - - cipher = g_new0(PurpleCipher, 1); - PURPLE_DBUS_REGISTER_POINTER(cipher, PurpleCipher); - - cipher->name = g_strdup(name); - cipher->ops = ops; - - ciphers = g_list_append(ciphers, cipher); - - purple_signal_emit(purple_ciphers_get_handle(), "cipher-added", cipher); - - return cipher; -} - -gboolean -purple_ciphers_unregister_cipher(PurpleCipher *cipher) { - g_return_val_if_fail(cipher, FALSE); - g_return_val_if_fail(cipher->ref == 0, FALSE); - - purple_signal_emit(purple_ciphers_get_handle(), "cipher-removed", cipher); - - ciphers = g_list_remove(ciphers, cipher); - - g_free(cipher->name); - - PURPLE_DBUS_UNREGISTER_POINTER(cipher); - g_free(cipher); - - return TRUE; -} - -GList * -purple_ciphers_get_ciphers() { - return ciphers; -} - -/****************************************************************************** - * PurpleCipher Subsystem API - *****************************************************************************/ -gpointer -purple_ciphers_get_handle() { - static gint handle; - - return &handle; -} - -void -purple_ciphers_init() { - gpointer handle; - - handle = purple_ciphers_get_handle(); - - purple_signal_register(handle, "cipher-added", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CIPHER)); - purple_signal_register(handle, "cipher-removed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CIPHER)); - - purple_ciphers_register_cipher("md5", &MD5Ops); - purple_ciphers_register_cipher("sha1", &SHA1Ops); - purple_ciphers_register_cipher("sha256", &SHA256Ops); - purple_ciphers_register_cipher("md4", &MD4Ops); - purple_ciphers_register_cipher("hmac", &HMACOps); - purple_ciphers_register_cipher("des", &DESOps); - purple_ciphers_register_cipher("des3", &DES3Ops); - purple_ciphers_register_cipher("rc4", &RC4Ops); -} - -void -purple_ciphers_uninit() { - PurpleCipher *cipher; - GList *l, *ll; - - for(l = ciphers; l; l = ll) { - ll = l->next; - - cipher = PURPLE_CIPHER(l->data); - purple_ciphers_unregister_cipher(cipher); - } - - g_list_free(ciphers); - - purple_signals_unregister_by_instance(purple_ciphers_get_handle()); -} -/****************************************************************************** - * PurpleCipherContext API - *****************************************************************************/ -void -purple_cipher_context_set_option(PurpleCipherContext *context, const gchar *name, - gpointer value) -{ - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - g_return_if_fail(name); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->set_option) - cipher->ops->set_option(context, name, value); - else - purple_debug_warning("cipher", "the %s cipher does not support the " - "set_option operation\n", cipher->name); -} - -gpointer -purple_cipher_context_get_option(PurpleCipherContext *context, const gchar *name) { - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, NULL); - g_return_val_if_fail(name, NULL); - - cipher = context->cipher; - g_return_val_if_fail(cipher, NULL); - - if(cipher->ops && cipher->ops->get_option) - return cipher->ops->get_option(context, name); - else { - purple_debug_warning("cipher", "the %s cipher does not support the " - "get_option operation\n", cipher->name); - - return NULL; - } -} - -PurpleCipherContext * -purple_cipher_context_new(PurpleCipher *cipher, void *extra) { - PurpleCipherContext *context = NULL; - - g_return_val_if_fail(cipher, NULL); - - cipher->ref++; - - context = g_new0(PurpleCipherContext, 1); - context->cipher = cipher; - - if(cipher->ops->init) - cipher->ops->init(context, extra); - - return context; -} - -PurpleCipherContext * -purple_cipher_context_new_by_name(const gchar *name, void *extra) { - PurpleCipher *cipher; - - g_return_val_if_fail(name, NULL); - - cipher = purple_ciphers_find_cipher(name); - - g_return_val_if_fail(cipher, NULL); - - return purple_cipher_context_new(cipher, extra); -} - -void -purple_cipher_context_reset(PurpleCipherContext *context, void *extra) { - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->reset) - context->cipher->ops->reset(context, extra); -} - -void -purple_cipher_context_destroy(PurpleCipherContext *context) { - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - cipher->ref--; - - if(cipher->ops && cipher->ops->uninit) - cipher->ops->uninit(context); - - memset(context, 0, sizeof(context)); - g_free(context); - context = NULL; -} - -void -purple_cipher_context_set_iv(PurpleCipherContext *context, guchar *iv, size_t len) -{ - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - g_return_if_fail(iv); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->set_iv) - cipher->ops->set_iv(context, iv, len); - else - purple_debug_warning("cipher", "the %s cipher does not support the set" - "initialization vector operation\n", cipher->name); -} - -void -purple_cipher_context_append(PurpleCipherContext *context, const guchar *data, - size_t len) -{ - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->append) - cipher->ops->append(context, data, len); - else - purple_debug_warning("cipher", "the %s cipher does not support the append " - "operation\n", cipher->name); -} - -gboolean -purple_cipher_context_digest(PurpleCipherContext *context, size_t in_len, - guchar digest[], size_t *out_len) -{ - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, FALSE); - - cipher = context->cipher; - - if(cipher->ops && cipher->ops->digest) - return cipher->ops->digest(context, in_len, digest, out_len); - else { - purple_debug_warning("cipher", "the %s cipher does not support the digest " - "operation\n", cipher->name); - return FALSE; - } -} - -gboolean -purple_cipher_context_digest_to_str(PurpleCipherContext *context, size_t in_len, - gchar digest_s[], size_t *out_len) -{ - /* 8k is a bit excessive, will tweak later. */ - guchar digest[BUF_LEN * 4]; - gint n = 0; - size_t dlen = 0; - - g_return_val_if_fail(context, FALSE); - g_return_val_if_fail(digest_s, FALSE); - - if(!purple_cipher_context_digest(context, sizeof(digest), digest, &dlen)) - return FALSE; - - /* in_len must be greater than dlen * 2 so we have room for the NUL. */ - if(in_len <= dlen * 2) - return FALSE; - - for(n = 0; n < dlen; n++) - sprintf(digest_s + (n * 2), "%02x", digest[n]); - - digest_s[n * 2] = '\0'; - - if(out_len) - *out_len = dlen * 2; - - return TRUE; -} - -gint -purple_cipher_context_encrypt(PurpleCipherContext *context, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, -1); - - cipher = context->cipher; - g_return_val_if_fail(cipher, -1); - - if(cipher->ops && cipher->ops->encrypt) - return cipher->ops->encrypt(context, data, len, output, outlen); - else { - purple_debug_warning("cipher", "the %s cipher does not support the encrypt" - "operation\n", cipher->name); - - if(outlen) - *outlen = -1; - - return -1; - } -} - -gint -purple_cipher_context_decrypt(PurpleCipherContext *context, const guchar data[], - size_t len, guchar output[], size_t *outlen) -{ - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, -1); - - cipher = context->cipher; - g_return_val_if_fail(cipher, -1); - - if(cipher->ops && cipher->ops->decrypt) - return cipher->ops->decrypt(context, data, len, output, outlen); - else { - purple_debug_warning("cipher", "the %s cipher does not support the decrypt" - "operation\n", cipher->name); - - if(outlen) - *outlen = -1; - - return -1; - } -} - -void -purple_cipher_context_set_salt(PurpleCipherContext *context, guchar *salt) { - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->set_salt) - cipher->ops->set_salt(context, salt); - else - purple_debug_warning("cipher", "the %s cipher does not support the " - "set_salt operation\n", cipher->name); -} - -size_t -purple_cipher_context_get_salt_size(PurpleCipherContext *context) { - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, -1); - - cipher = context->cipher; - g_return_val_if_fail(cipher, -1); - - if(cipher->ops && cipher->ops->get_salt_size) - return cipher->ops->get_salt_size(context); - else { - purple_debug_warning("cipher", "the %s cipher does not support the " - "get_salt_size operation\n", cipher->name); - - return -1; - } -} - -void -purple_cipher_context_set_key(PurpleCipherContext *context, const guchar *key) { - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->set_key) - cipher->ops->set_key(context, key); - else - purple_debug_warning("cipher", "the %s cipher does not support the " - "set_key operation\n", cipher->name); -} - -size_t -purple_cipher_context_get_key_size(PurpleCipherContext *context) { - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, -1); - - cipher = context->cipher; - g_return_val_if_fail(cipher, -1); - - if(cipher->ops && cipher->ops->get_key_size) - return cipher->ops->get_key_size(context); - else { - purple_debug_warning("cipher", "the %s cipher does not support the " - "get_key_size operation\n", cipher->name); - - return -1; - } -} - -void -purple_cipher_context_set_batch_mode(PurpleCipherContext *context, - PurpleCipherBatchMode mode) -{ - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->set_batch_mode) - cipher->ops->set_batch_mode(context, mode); - else - purple_debug_warning("cipher", "The %s cipher does not support the " - "set_batch_mode operation\n", cipher->name); -} - -PurpleCipherBatchMode -purple_cipher_context_get_batch_mode(PurpleCipherContext *context) -{ - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, -1); - - cipher = context->cipher; - g_return_val_if_fail(cipher, -1); - - if(cipher->ops && cipher->ops->get_batch_mode) - return cipher->ops->get_batch_mode(context); - else { - purple_debug_warning("cipher", "The %s cipher does not support the " - "get_batch_mode operation\n", cipher->name); - return -1; - } -} - -size_t -purple_cipher_context_get_block_size(PurpleCipherContext *context) -{ - PurpleCipher *cipher = NULL; - - g_return_val_if_fail(context, -1); - - cipher = context->cipher; - g_return_val_if_fail(cipher, -1); - - if(cipher->ops && cipher->ops->get_block_size) - return cipher->ops->get_block_size(context); - else { - purple_debug_warning("cipher", "The %s cipher does not support the " - "get_block_size operation\n", cipher->name); - return -1; - } -} - -void -purple_cipher_context_set_key_with_len(PurpleCipherContext *context, - const guchar *key, size_t len) -{ - PurpleCipher *cipher = NULL; - - g_return_if_fail(context); - - cipher = context->cipher; - g_return_if_fail(cipher); - - if(cipher->ops && cipher->ops->set_key_with_len) - cipher->ops->set_key_with_len(context, key, len); - else - purple_debug_warning("cipher", "The %s cipher does not support the " - "set_key_with_len operation\n", cipher->name); -} - -void -purple_cipher_context_set_data(PurpleCipherContext *context, gpointer data) { - g_return_if_fail(context); - - context->data = data; -} - -gpointer -purple_cipher_context_get_data(PurpleCipherContext *context) { - g_return_val_if_fail(context, NULL); - - return context->data; -} - -gchar *purple_cipher_http_digest_calculate_session_key( - const gchar *algorithm, - const gchar *username, - const gchar *realm, - const gchar *password, - const gchar *nonce, - const gchar *client_nonce) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - gchar hash[33]; /* We only support MD5. */ - - g_return_val_if_fail(username != NULL, NULL); - g_return_val_if_fail(realm != NULL, NULL); - g_return_val_if_fail(password != NULL, NULL); - g_return_val_if_fail(nonce != NULL, NULL); - - /* Check for a supported algorithm. */ - g_return_val_if_fail(algorithm == NULL || - *algorithm == '\0' || - g_ascii_strcasecmp(algorithm, "MD5") || - g_ascii_strcasecmp(algorithm, "MD5-sess"), NULL); - - cipher = purple_ciphers_find_cipher("md5"); - g_return_val_if_fail(cipher != NULL, NULL); - - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (guchar *)username, strlen(username)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)realm, strlen(realm)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)password, strlen(password)); - - if (algorithm != NULL && !g_ascii_strcasecmp(algorithm, "MD5-sess")) - { - guchar digest[16]; - - if (client_nonce == NULL) - { - purple_cipher_context_destroy(context); - purple_debug_error("cipher", "Required client_nonce missing for MD5-sess digest calculation.\n"); - return NULL; - } - - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, digest, sizeof(digest)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)nonce, strlen(nonce)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)client_nonce, strlen(client_nonce)); - } - - purple_cipher_context_digest_to_str(context, sizeof(hash), hash, NULL); - purple_cipher_context_destroy(context); - - return g_strdup(hash); -} - -gchar *purple_cipher_http_digest_calculate_response( - const gchar *algorithm, - const gchar *method, - const gchar *digest_uri, - const gchar *qop, - const gchar *entity, - const gchar *nonce, - const gchar *nonce_count, - const gchar *client_nonce, - const gchar *session_key) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - static gchar hash2[33]; /* We only support MD5. */ - - g_return_val_if_fail(method != NULL, NULL); - g_return_val_if_fail(digest_uri != NULL, NULL); - g_return_val_if_fail(nonce != NULL, NULL); - g_return_val_if_fail(session_key != NULL, NULL); - - /* Check for a supported algorithm. */ - g_return_val_if_fail(algorithm == NULL || - *algorithm == '\0' || - g_ascii_strcasecmp(algorithm, "MD5") || - g_ascii_strcasecmp(algorithm, "MD5-sess"), NULL); - - /* Check for a supported "quality of protection". */ - g_return_val_if_fail(qop == NULL || - *qop == '\0' || - g_ascii_strcasecmp(qop, "auth") || - g_ascii_strcasecmp(qop, "auth-int"), NULL); - - cipher = purple_ciphers_find_cipher("md5"); - g_return_val_if_fail(cipher != NULL, NULL); - - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (guchar *)method, strlen(method)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)digest_uri, strlen(digest_uri)); - - if (qop != NULL && !g_ascii_strcasecmp(qop, "auth-int")) - { - PurpleCipherContext *context2; - gchar entity_hash[33]; - - if (entity == NULL) - { - purple_cipher_context_destroy(context); - purple_debug_error("cipher", "Required entity missing for auth-int digest calculation.\n"); - return NULL; - } - - context2 = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context2, (guchar *)entity, strlen(entity)); - purple_cipher_context_digest_to_str(context2, sizeof(entity_hash), entity_hash, NULL); - purple_cipher_context_destroy(context2); - - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)entity_hash, strlen(entity_hash)); - } - - purple_cipher_context_digest_to_str(context, sizeof(hash2), hash2, NULL); - purple_cipher_context_destroy(context); - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (guchar *)session_key, strlen(session_key)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)nonce, strlen(nonce)); - purple_cipher_context_append(context, (guchar *)":", 1); - - if (qop != NULL && *qop != '\0') - { - if (nonce_count == NULL) - { - purple_cipher_context_destroy(context); - purple_debug_error("cipher", "Required nonce_count missing for digest calculation.\n"); - return NULL; - } - - if (client_nonce == NULL) - { - purple_cipher_context_destroy(context); - purple_debug_error("cipher", "Required client_nonce missing for digest calculation.\n"); - return NULL; - } - - purple_cipher_context_append(context, (guchar *)nonce_count, strlen(nonce_count)); - purple_cipher_context_append(context, (guchar *)":", 1); - purple_cipher_context_append(context, (guchar *)client_nonce, strlen(client_nonce)); - purple_cipher_context_append(context, (guchar *)":", 1); - - purple_cipher_context_append(context, (guchar *)qop, strlen(qop)); - - purple_cipher_context_append(context, (guchar *)":", 1); - } - - purple_cipher_context_append(context, (guchar *)hash2, strlen(hash2)); - purple_cipher_context_digest_to_str(context, sizeof(hash2), hash2, NULL); - purple_cipher_context_destroy(context); - - return g_strdup(hash2); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cipher.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,505 +0,0 @@ -/** - * @file cipher.h Purple Cipher API - * @ingroup core - * @see @ref cipher-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_CIPHER_H -#define PURPLE_CIPHER_H - -#include - -#define PURPLE_CIPHER(obj) ((PurpleCipher *)(obj)) /**< PurpleCipher typecast helper */ -#define PURPLE_CIPHER_OPS(obj) ((PurpleCipherOps *)(obj)) /**< PurpleCipherInfo typecase helper */ -#define PURPLE_CIPHER_CONTEXT(obj) ((PurpleCipherContext *)(obj)) /**< PurpleCipherContext typecast helper */ - -typedef struct _PurpleCipher PurpleCipher; /**< A handle to a PurpleCipher */ -typedef struct _PurpleCipherOps PurpleCipherOps; /**< Ops for a PurpleCipher */ -typedef struct _PurpleCipherContext PurpleCipherContext; /**< A context for a PurpleCipher */ - -/** - * Modes for batch encrypters - */ -typedef enum _PurpleCipherBatchMode { - PURPLE_CIPHER_BATCH_MODE_ECB, - PURPLE_CIPHER_BATCH_MODE_CBC -} PurpleCipherBatchMode; - -/** - * The operation flags for a cipher - */ -typedef enum _PurpleCipherCaps { - PURPLE_CIPHER_CAPS_SET_OPT = 1 << 1, /**< Set option flag */ - PURPLE_CIPHER_CAPS_GET_OPT = 1 << 2, /**< Get option flag */ - PURPLE_CIPHER_CAPS_INIT = 1 << 3, /**< Init flag */ - PURPLE_CIPHER_CAPS_RESET = 1 << 4, /**< Reset flag */ - PURPLE_CIPHER_CAPS_UNINIT = 1 << 5, /**< Uninit flag */ - PURPLE_CIPHER_CAPS_SET_IV = 1 << 6, /**< Set IV flag */ - PURPLE_CIPHER_CAPS_APPEND = 1 << 7, /**< Append flag */ - PURPLE_CIPHER_CAPS_DIGEST = 1 << 8, /**< Digest flag */ - PURPLE_CIPHER_CAPS_ENCRYPT = 1 << 9, /**< Encrypt flag */ - PURPLE_CIPHER_CAPS_DECRYPT = 1 << 10, /**< Decrypt flag */ - PURPLE_CIPHER_CAPS_SET_SALT = 1 << 11, /**< Set salt flag */ - PURPLE_CIPHER_CAPS_GET_SALT_SIZE = 1 << 12, /**< Get salt size flag */ - PURPLE_CIPHER_CAPS_SET_KEY = 1 << 13, /**< Set key flag */ - PURPLE_CIPHER_CAPS_GET_KEY_SIZE = 1 << 14, /**< Get key size flag */ - PURPLE_CIPHER_CAPS_SET_BATCH_MODE = 1 << 15, /**< Set batch mode flag */ - PURPLE_CIPHER_CAPS_GET_BATCH_MODE = 1 << 16, /**< Get batch mode flag */ - PURPLE_CIPHER_CAPS_GET_BLOCK_SIZE = 1 << 17, /**< The get block size flag */ - PURPLE_CIPHER_CAPS_SET_KEY_WITH_LEN = 1 << 18, /**< The set key with length flag */ - PURPLE_CIPHER_CAPS_UNKNOWN = 1 << 19 /**< Unknown */ -} PurpleCipherCaps; - -/** - * The operations of a cipher. Every cipher must implement one of these. - */ -struct _PurpleCipherOps { - /** The set option function */ - void (*set_option)(PurpleCipherContext *context, const gchar *name, void *value); - - /** The get option function */ - void *(*get_option)(PurpleCipherContext *context, const gchar *name); - - /** The init function */ - void (*init)(PurpleCipherContext *context, void *extra); - - /** The reset function */ - void (*reset)(PurpleCipherContext *context, void *extra); - - /** The uninit function */ - void (*uninit)(PurpleCipherContext *context); - - /** The set initialization vector function */ - void (*set_iv)(PurpleCipherContext *context, guchar *iv, size_t len); - - /** The append data function */ - void (*append)(PurpleCipherContext *context, const guchar *data, size_t len); - - /** The digest function */ - gboolean (*digest)(PurpleCipherContext *context, size_t in_len, guchar digest[], size_t *out_len); - - /** The encrypt function */ - int (*encrypt)(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); - - /** The decrypt function */ - int (*decrypt)(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); - - /** The set salt function */ - void (*set_salt)(PurpleCipherContext *context, guchar *salt); - - /** The get salt size function */ - size_t (*get_salt_size)(PurpleCipherContext *context); - - /** The set key function */ - void (*set_key)(PurpleCipherContext *context, const guchar *key); - - /** The get key size function */ - size_t (*get_key_size)(PurpleCipherContext *context); - - /** The set batch mode function */ - void (*set_batch_mode)(PurpleCipherContext *context, PurpleCipherBatchMode mode); - - /** The get batch mode function */ - PurpleCipherBatchMode (*get_batch_mode)(PurpleCipherContext *context); - - /** The get block size function */ - size_t (*get_block_size)(PurpleCipherContext *context); - - /** The set key with length function */ - void (*set_key_with_len)(PurpleCipherContext *context, const guchar *key, size_t len); -}; - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*****************************************************************************/ -/** @name PurpleCipher API */ -/*****************************************************************************/ -/*@{*/ - -/** - * Gets a cipher's name - * - * @param cipher The cipher handle - * - * @return The cipher's name - */ -const gchar *purple_cipher_get_name(PurpleCipher *cipher); - -/** - * Gets a cipher's capabilities - * - * @param cipher The cipher handle - * - * @return The cipher's info - */ -guint purple_cipher_get_capabilities(PurpleCipher *cipher); - -/** - * Gets a digest from a cipher - * - * @param name The cipher's name - * @param data The data to hash - * @param data_len The length of the data - * @param in_len The length of the buffer - * @param digest The returned digest - * @param out_len The length written - * - * @return @c TRUE if successful, @c FALSE otherwise - */ -gboolean purple_cipher_digest_region(const gchar *name, const guchar *data, size_t data_len, size_t in_len, guchar digest[], size_t *out_len); - -/*@}*/ -/******************************************************************************/ -/** @name PurpleCiphers API */ -/******************************************************************************/ -/*@{*/ - -/** - * Finds a cipher by it's name - * - * @param name The name of the cipher to find - * - * @return The cipher handle or @c NULL - */ -PurpleCipher *purple_ciphers_find_cipher(const gchar *name); - -/** - * Registers a cipher as a usable cipher - * - * @param name The name of the new cipher - * @param ops The cipher ops to register - * - * @return The handle to the new cipher or @c NULL if it failed - */ -PurpleCipher *purple_ciphers_register_cipher(const gchar *name, PurpleCipherOps *ops); - -/** - * Unregisters a cipher - * - * @param cipher The cipher handle to unregister - * - * @return Whether or not the cipher was successfully unloaded - */ -gboolean purple_ciphers_unregister_cipher(PurpleCipher *cipher); - -/** - * Gets the list of ciphers - * - * @return The list of available ciphers - * @note This list should not be modified, it is owned by the cipher core - */ -GList *purple_ciphers_get_ciphers(void); - -/*@}*/ -/******************************************************************************/ -/** @name PurpleCipher Subsystem API */ -/******************************************************************************/ -/*@{*/ - -/** - * Gets the handle to the cipher subsystem - * - * @return The handle to the cipher subsystem - */ -gpointer purple_ciphers_get_handle(void); - -/** - * Initializes the cipher core - */ -void purple_ciphers_init(void); - -/** - * Uninitializes the cipher core - */ -void purple_ciphers_uninit(void); - -/*@}*/ -/******************************************************************************/ -/** @name PurpleCipherContext API */ -/******************************************************************************/ -/*@{*/ - -/** - * Sets the value an option on a cipher context - * - * @param context The cipher context - * @param name The name of the option - * @param value The value to set - */ -void purple_cipher_context_set_option(PurpleCipherContext *context, const gchar *name, gpointer value); - -/** - * Gets the vale of an option on a cipher context - * - * @param context The cipher context - * @param name The name of the option - * @return The value of the option - */ -gpointer purple_cipher_context_get_option(PurpleCipherContext *context, const gchar *name); - -/** - * Creates a new cipher context and initializes it - * - * @param cipher The cipher to use - * @param extra Extra data for the specific cipher - * - * @return The new cipher context - */ -PurpleCipherContext *purple_cipher_context_new(PurpleCipher *cipher, void *extra); - -/** - * Creates a new cipher context by the cipher name and initializes it - * - * @param name The cipher's name - * @param extra Extra data for the specific cipher - * - * @return The new cipher context - */ -PurpleCipherContext *purple_cipher_context_new_by_name(const gchar *name, void *extra); - -/** - * Resets a cipher context to it's default value - * @note If you have set an IV you will have to set it after resetting - * - * @param context The context to reset - * @param extra Extra data for the specific cipher - */ -void purple_cipher_context_reset(PurpleCipherContext *context, gpointer extra); - -/** - * Destorys a cipher context and deinitializes it - * - * @param context The cipher context to destory - */ -void purple_cipher_context_destroy(PurpleCipherContext *context); - -/** - * Sets the initialization vector for a context - * @note This should only be called right after a cipher context is created or reset - * - * @param context The context to set the IV to - * @param iv The initialization vector to set - * @param len The len of the IV - */ -void purple_cipher_context_set_iv(PurpleCipherContext *context, guchar *iv, size_t len); - -/** - * Appends data to the context - * - * @param context The context to append data to - * @param data The data to append - * @param len The length of the data - */ -void purple_cipher_context_append(PurpleCipherContext *context, const guchar *data, size_t len); - -/** - * Digests a context - * - * @param context The context to digest - * @param in_len The length of the buffer - * @param digest The return buffer for the digest - * @param out_len The length of the returned value - */ -gboolean purple_cipher_context_digest(PurpleCipherContext *context, size_t in_len, guchar digest[], size_t *out_len); - -/** - * Converts a guchar digest into a hex string - * - * @param context The context to get a digest from - * @param in_len The length of the buffer - * @param digest_s The return buffer for the string digest - * @param out_len The length of the returned value - */ -gboolean purple_cipher_context_digest_to_str(PurpleCipherContext *context, size_t in_len, gchar digest_s[], size_t *out_len); - -/** - * Encrypts data using the context - * - * @param context The context - * @param data The data to encrypt - * @param len The length of the data - * @param output The output buffer - * @param outlen The len of data that was outputed - * - * @return A cipher specific status code - */ -gint purple_cipher_context_encrypt(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); - -/** - * Decrypts data using the context - * - * @param context The context - * @param data The data to encrypt - * @param len The length of the returned value - * @param output The output buffer - * @param outlen The len of data that was outputed - * - * @return A cipher specific status code - */ -gint purple_cipher_context_decrypt(PurpleCipherContext *context, const guchar data[], size_t len, guchar output[], size_t *outlen); - -/** - * Sets the salt on a context - * - * @param context The context whose salt to set - * @param salt The salt - */ -void purple_cipher_context_set_salt(PurpleCipherContext *context, guchar *salt); - -/** - * Gets the size of the salt if the cipher supports it - * - * @param context The context whose salt size to get - * - * @return The size of the salt - */ -size_t purple_cipher_context_get_salt_size(PurpleCipherContext *context); - -/** - * Sets the key on a context - * - * @param context The context whose key to set - * @param key The key - */ -void purple_cipher_context_set_key(PurpleCipherContext *context, const guchar *key); - -/** - * Gets the key size for a context - * - * @param context The context whose key size to get - * - * @return The size of the key - */ -size_t purple_cipher_context_get_key_size(PurpleCipherContext *context); - -/** - * Sets the batch mode of a context - * - * @param context The context whose batch mode to set - * @param mode The batch mode under which the cipher should operate - * - */ -void purple_cipher_context_set_batch_mode(PurpleCipherContext *context, PurpleCipherBatchMode mode); - -/** - * Gets the batch mode of a context - * - * @param context The context whose batch mode to get - * - * @return The batch mode under which the cipher is operating - */ -PurpleCipherBatchMode purple_cipher_context_get_batch_mode(PurpleCipherContext *context); - -/** - * Gets the block size of a context - * - * @param context The context whose block size to get - * - * @return The block size of the context - */ -size_t purple_cipher_context_get_block_size(PurpleCipherContext *context); - -/** - * Sets the key with a given length on a context - * - * @param context The context whose key to set - * @param key The key - * @param len The length of the key - * - */ -void purple_cipher_context_set_key_with_len(PurpleCipherContext *context, const guchar *key, size_t len); - -/** - * Sets the cipher data for a context - * - * @param context The context whose cipher data to set - * @param data The cipher data to set - */ -void purple_cipher_context_set_data(PurpleCipherContext *context, gpointer data); - -/** - * Gets the cipher data for a context - * - * @param context The context whose cipher data to get - * - * @return The cipher data - */ -gpointer purple_cipher_context_get_data(PurpleCipherContext *context); - -/*@}*/ -/*****************************************************************************/ -/** @name Purple Cipher HTTP Digest Helper Functions */ -/*****************************************************************************/ -/*@{*/ - -/** - * Calculates a session key for HTTP Digest authentation - * - * See RFC 2617 for more information. - * - * @param algorithm The hash algorithm to use - * @param username The username provided by the user - * @param realm The authentication realm provided by the server - * @param password The password provided by the user - * @param nonce The nonce provided by the server - * @param client_nonce The nonce provided by the client - * - * @return The session key, or @c NULL if an error occurred. - */ -gchar *purple_cipher_http_digest_calculate_session_key( - const gchar *algorithm, const gchar *username, - const gchar *realm, const gchar *password, - const gchar *nonce, const gchar *client_nonce); - -/** Calculate a response for HTTP Digest authentication - * - * See RFC 2617 for more information. - * - * @param algorithm The hash algorithm to use - * @param method The HTTP method in use - * @param digest_uri The URI from the initial request - * @param qop The "quality of protection" - * @param entity The entity body - * @param nonce The nonce provided by the server - * @param nonce_count The nonce count - * @param client_nonce The nonce provided by the client - * @param session_key The session key from purple_cipher_http_digest_calculate_session_key() - * - * @return The hashed response, or @c NULL if an error occurred. - */ -gchar *purple_cipher_http_digest_calculate_response( - const gchar *algorithm, const gchar *method, - const gchar *digest_uri, const gchar *qop, - const gchar *entity, const gchar *nonce, - const gchar *nonce_count, const gchar *client_nonce, - const gchar *session_key); - -/*@}*/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* PURPLE_CIPHER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,153 +0,0 @@ -/* - * @file circbuffer.h Buffer Utility Functions - * @ingroup core - */ - -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "circbuffer.h" - -#define DEFAULT_BUF_SIZE 256 - -PurpleCircBuffer * -purple_circ_buffer_new(gsize growsize) { - PurpleCircBuffer *buf = g_new0(PurpleCircBuffer, 1); - buf->growsize = growsize ? growsize : DEFAULT_BUF_SIZE; - return buf; -} - -void purple_circ_buffer_destroy(PurpleCircBuffer *buf) { - g_return_if_fail(buf != NULL); - - g_free(buf->buffer); - g_free(buf); -} - -static void grow_circ_buffer(PurpleCircBuffer *buf, gsize len) { - int in_offset = 0, out_offset = 0; - int start_buflen; - - g_return_if_fail(buf != NULL); - - start_buflen = buf->buflen; - - while ((buf->buflen - buf->bufused) < len) - buf->buflen += buf->growsize; - - if (buf->inptr != NULL) { - in_offset = buf->inptr - buf->buffer; - out_offset = buf->outptr - buf->buffer; - } - buf->buffer = g_realloc(buf->buffer, buf->buflen); - - /* adjust the fill and remove pointer locations */ - if (buf->inptr == NULL) { - buf->inptr = buf->outptr = buf->buffer; - } else { - buf->inptr = buf->buffer + in_offset; - buf->outptr = buf->buffer + out_offset; - } - - /* If the fill pointer is wrapped to before the remove - * pointer, we need to shift the data */ - if (in_offset < out_offset - || (in_offset == out_offset && buf->bufused > 0)) { - int shift_n = MIN(buf->buflen - start_buflen, - in_offset); - memcpy(buf->buffer + start_buflen, buf->buffer, - shift_n); - - /* If we couldn't fit the wrapped read buffer - * at the end */ - if (shift_n < in_offset) { - memmove(buf->buffer, - buf->buffer + shift_n, - in_offset - shift_n); - buf->inptr = buf->buffer + - (in_offset - shift_n); - } else { - buf->inptr = buf->buffer + - start_buflen + in_offset; - } - } -} - -void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len) { - - int len_stored; - - g_return_if_fail(buf != NULL); - - /* Grow the buffer, if necessary */ - if ((buf->buflen - buf->bufused) < len) - grow_circ_buffer(buf, len); - - /* If there is not enough room to copy all of src before hitting - * the end of the buffer then we will need to do two copies. - * One copy from inptr to the end of the buffer, and the - * second copy from the start of the buffer to the end of src. */ - if (buf->inptr >= buf->outptr) - len_stored = MIN(len, buf->buflen - - (buf->inptr - buf->buffer)); - else - len_stored = len; - - if (len_stored > 0) - memcpy(buf->inptr, src, len_stored); - - if (len_stored < len) { - memcpy(buf->buffer, (char*)src + len_stored, len - len_stored); - buf->inptr = buf->buffer + (len - len_stored); - } else { - buf->inptr += len_stored; - } - - buf->bufused += len; -} - -gsize purple_circ_buffer_get_max_read(const PurpleCircBuffer *buf) { - gsize max_read; - - g_return_val_if_fail(buf != NULL, 0); - - if (buf->bufused == 0) - max_read = 0; - else if ((buf->outptr - buf->inptr) >= 0) - max_read = buf->buflen - (buf->outptr - buf->buffer); - else - max_read = buf->inptr - buf->outptr; - - return max_read; -} - -gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len) { - g_return_val_if_fail(buf != NULL, FALSE); - g_return_val_if_fail(purple_circ_buffer_get_max_read(buf) >= len, FALSE); - - buf->outptr += len; - buf->bufused -= len; - /* wrap to the start if we're at the end */ - if ((buf->outptr - buf->buffer) == buf->buflen) - buf->outptr = buf->buffer; - - return TRUE; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/circbuffer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/** - * @file circbuffer.h Buffer Utility Functions - * @ingroup core - */ - -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _CIRCBUFFER_H -#define _CIRCBUFFER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _PurpleCircBuffer { - - /** A pointer to the starting address of our chunk of memory. */ - gchar *buffer; - - /** The incremental amount to increase this buffer by when - * the buffer is not big enough to hold incoming data, in bytes. */ - gsize growsize; - - /** The length of this buffer, in bytes. */ - gsize buflen; - - /** The number of bytes of this buffer that contain unread data. */ - gsize bufused; - - /** A pointer to the next byte where new incoming data is - * buffered to. */ - gchar *inptr; - - /** A pointer to the next byte of buffered data that should be - * read by the consumer. */ - gchar *outptr; - -} PurpleCircBuffer; - -/** - * Creates a new circular buffer. This will not allocate any memory for the - * actual buffer until data is appended to it. - * - * @param growsize The amount that the buffer should grow the first time data - * is appended and every time more space is needed. Pass in - * "0" to use the default of 256 bytes. - * - * @return The new PurpleCircBuffer. This should be freed with - * purple_circ_buffer_destroy when you are done with it - */ -PurpleCircBuffer *purple_circ_buffer_new(gsize growsize); - -/** - * Dispose of the PurpleCircBuffer and free any memory used by it (including any - * memory used by the internal buffer). - * - * @param buf The PurpleCircBuffer to free - */ -void purple_circ_buffer_destroy(PurpleCircBuffer *buf); - -/** - * Append data to the PurpleCircBuffer. This will grow the internal - * buffer to fit the added data, if needed. - * - * @param buf The PurpleCircBuffer to which to append the data - * @param src pointer to the data to copy into the buffer - * @param len number of bytes to copy into the buffer - */ -void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len); - -/** - * Determine the maximum number of contiguous bytes that can be read from the - * PurpleCircBuffer. - * Note: This may not be the total number of bytes that are buffered - a - * subsequent call after calling purple_circ_buffer_mark_read() may indicate more - * data is available to read. - * - * @param buf the PurpleCircBuffer for which to determine the maximum contiguous - * bytes that can be read. - * - * @return the number of bytes that can be read from the PurpleCircBuffer - */ -gsize purple_circ_buffer_get_max_read(const PurpleCircBuffer *buf); - -/** - * Mark the number of bytes that have been read from the buffer. - * - * @param buf The PurpleCircBuffer to mark bytes read from - * @param len The number of bytes to mark as read - * - * @return TRUE if we successfully marked the bytes as having been read, FALSE - * otherwise. - */ -gboolean purple_circ_buffer_mark_read(PurpleCircBuffer *buf, gsize len); - -#ifdef __cplusplus -} -#endif - -#endif /* _CIRCBUFFER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,389 +0,0 @@ -/** - * @file cmds.c Commands API - * @ingroup core - */ - -/* Copyright (C) 2003-2004 Timothy Ringenbach priority > b->priority) - return -1; - else if (a->priority < b->priority) - return 1; - else return 0; -} - -PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, - PurpleCmdPriority p, PurpleCmdFlag f, - const gchar *prpl_id, PurpleCmdFunc func, - const gchar *helpstr, void *data) -{ - PurpleCmdId id; - PurpleCmd *c; - - g_return_val_if_fail(cmd != NULL && *cmd != '\0', 0); - g_return_val_if_fail(args != NULL, 0); - g_return_val_if_fail(func != NULL, 0); - - id = next_id++; - - c = g_new0(PurpleCmd, 1); - c->id = id; - c->cmd = g_strdup(cmd); - c->args = g_strdup(args); - c->priority = p; - c->flags = f; - c->prpl_id = g_strdup(prpl_id); - c->func = func; - c->help = g_strdup(helpstr); - c->data = data; - - cmds = g_list_insert_sorted(cmds, c, (GCompareFunc)cmds_compare_func); - - purple_signal_emit(purple_cmds_get_handle(), "cmd-added", cmd, p, f); - - return id; -} - -static void purple_cmd_free(PurpleCmd *c) -{ - g_free(c->cmd); - g_free(c->args); - g_free(c->prpl_id); - g_free(c->help); - g_free(c); -} - -void purple_cmd_unregister(PurpleCmdId id) -{ - PurpleCmd *c; - GList *l; - - for (l = cmds; l; l = l->next) { - c = l->data; - - if (c->id == id) { - cmds = g_list_remove(cmds, c); - purple_signal_emit(purple_cmds_get_handle(), "cmd-removed", c->cmd); - purple_cmd_free(c); - return; - } - } -} - -/** - * This sets args to a NULL-terminated array of strings. It should - * be freed using g_strfreev(). - */ -static gboolean purple_cmd_parse_args(PurpleCmd *cmd, const gchar *s, const gchar *m, gchar ***args) -{ - int i; - const char *end, *cur; - - *args = g_new0(char *, strlen(cmd->args) + 1); - - cur = s; - - for (i = 0; cmd->args[i]; i++) { - if (!*cur) - return (cmd->flags & PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS); - - switch (cmd->args[i]) { - case 'w': - if (!(end = strchr(cur, ' '))) { - end = cur + strlen(cur); - (*args)[i] = g_strndup(cur, end - cur); - cur = end; - } else { - (*args)[i] = g_strndup(cur, end - cur); - cur = end + 1; - } - break; - case 'W': - if (!(end = strchr(cur, ' '))) { - end = cur + strlen(cur); - (*args)[i] = purple_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end)); - cur = end; - } else { - (*args)[i] = purple_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_pointer_to_offset(s, end)); - cur = end +1; - } - break; - case 's': - (*args)[i] = g_strdup(cur); - cur = cur + strlen(cur); - break; - case 'S': - (*args)[i] = purple_markup_slice(m, g_utf8_pointer_to_offset(s, cur), g_utf8_strlen(cur, -1) + 1); - cur = cur + strlen(cur); - break; - } - } - - if (*cur) - return (cmd->flags & PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS); - - return TRUE; -} - -static void purple_cmd_strip_current_char(gunichar c, char *s, guint len) -{ - int bytes; - - bytes = g_unichar_to_utf8(c, NULL); - memmove(s, s + bytes, len + 1 - bytes); -} - -static void purple_cmd_strip_cmd_from_markup(char *markup) -{ - guint len = strlen(markup); - char *s = markup; - - while (*s) { - gunichar c = g_utf8_get_char(s); - - if (c == '<') { - s = strchr(s, '>'); - if (!s) - return; - } else if (g_unichar_isspace(c)) { - purple_cmd_strip_current_char(c, s, len - (s - markup)); - return; - } else { - purple_cmd_strip_current_char(c, s, len - (s - markup)); - continue; - } - s = g_utf8_next_char(s); - } -} - -PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline, - const gchar *markup, gchar **error) -{ - PurpleCmd *c; - GList *l; - gchar *err = NULL; - gboolean is_im; - gboolean found = FALSE, tried_cmd = FALSE, right_type = FALSE, right_prpl = FALSE; - const gchar *prpl_id; - gchar **args = NULL; - gchar *cmd, *rest, *mrest; - PurpleCmdRet ret = PURPLE_CMD_RET_CONTINUE; - - *error = NULL; - prpl_id = purple_account_get_protocol_id(purple_conversation_get_account(conv)); - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) - is_im = TRUE; - else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) - is_im = FALSE; - else - return PURPLE_CMD_STATUS_FAILED; - - rest = strchr(cmdline, ' '); - if (rest) { - cmd = g_strndup(cmdline, rest - cmdline); - rest++; - } else { - cmd = g_strdup(cmdline); - rest = ""; - } - - mrest = g_strdup(markup); - purple_cmd_strip_cmd_from_markup(mrest); - - for (l = cmds; l; l = l->next) { - c = l->data; - - if (!purple_strequal(c->cmd, cmd)) - continue; - - found = TRUE; - - if (is_im) - if (!(c->flags & PURPLE_CMD_FLAG_IM)) - continue; - if (!is_im) - if (!(c->flags & PURPLE_CMD_FLAG_CHAT)) - continue; - - right_type = TRUE; - - if ((c->flags & PURPLE_CMD_FLAG_PRPL_ONLY) && - !purple_strequal(c->prpl_id, prpl_id)) - continue; - - right_prpl = TRUE; - - /* this checks the allow bad args flag for us */ - if (!purple_cmd_parse_args(c, rest, mrest, &args)) { - g_strfreev(args); - args = NULL; - continue; - } - - tried_cmd = TRUE; - ret = c->func(conv, cmd, args, &err, c->data); - if (ret == PURPLE_CMD_RET_CONTINUE) { - g_free(err); - err = NULL; - g_strfreev(args); - args = NULL; - continue; - } else { - break; - } - - } - - g_strfreev(args); - g_free(cmd); - g_free(mrest); - - if (!found) - return PURPLE_CMD_STATUS_NOT_FOUND; - - if (!right_type) - return PURPLE_CMD_STATUS_WRONG_TYPE; - if (!right_prpl) - return PURPLE_CMD_STATUS_WRONG_PRPL; - if (!tried_cmd) - return PURPLE_CMD_STATUS_WRONG_ARGS; - - if (ret == PURPLE_CMD_RET_OK) { - return PURPLE_CMD_STATUS_OK; - } else { - *error = err; - if (ret == PURPLE_CMD_RET_CONTINUE) - return PURPLE_CMD_STATUS_NOT_FOUND; - else - return PURPLE_CMD_STATUS_FAILED; - } - -} - - -GList *purple_cmd_list(PurpleConversation *conv) -{ - GList *ret = NULL; - PurpleCmd *c; - GList *l; - - for (l = cmds; l; l = l->next) { - c = l->data; - - if (conv && (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)) - if (!(c->flags & PURPLE_CMD_FLAG_IM)) - continue; - if (conv && (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)) - if (!(c->flags & PURPLE_CMD_FLAG_CHAT)) - continue; - - if (conv && (c->flags & PURPLE_CMD_FLAG_PRPL_ONLY) && - !purple_strequal(c->prpl_id, purple_account_get_protocol_id(purple_conversation_get_account(conv)))) - continue; - - ret = g_list_append(ret, c->cmd); - } - - ret = g_list_sort(ret, (GCompareFunc)strcmp); - - return ret; -} - - -GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd) -{ - GList *ret = NULL; - PurpleCmd *c; - GList *l; - - for (l = cmds; l; l = l->next) { - c = l->data; - - if (cmd && !purple_strequal(cmd, c->cmd)) - continue; - - if (conv && (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)) - if (!(c->flags & PURPLE_CMD_FLAG_IM)) - continue; - if (conv && (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)) - if (!(c->flags & PURPLE_CMD_FLAG_CHAT)) - continue; - - if (conv && (c->flags & PURPLE_CMD_FLAG_PRPL_ONLY) && - !purple_strequal(c->prpl_id, purple_account_get_protocol_id(purple_conversation_get_account(conv)))) - continue; - - ret = g_list_append(ret, c->help); - } - - ret = g_list_sort(ret, (GCompareFunc)strcmp); - - return ret; -} - -gpointer purple_cmds_get_handle(void) -{ - static int handle; - return &handle; -} - -void purple_cmds_init(void) -{ - gpointer handle = purple_cmds_get_handle(); - - purple_signal_register(handle, "cmd-added", - purple_marshal_VOID__POINTER_INT_INT, NULL, 3, - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_INT)); - purple_signal_register(handle, "cmd-removed", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_STRING)); -} - -void purple_cmds_uninit(void) -{ - purple_signals_unregister_by_instance(purple_cmds_get_handle()); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/cmds.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,250 +0,0 @@ -/** - * @file cmds.h Commands API - * @ingroup core - * @see @ref cmd-signals - */ - -/* Copyright (C) 2003 Timothy Ringenbach - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _PURPLE_CMDS_H_ -#define _PURPLE_CMDS_H_ - -#include "conversation.h" - -/**************************************************************************/ -/** @name Structures */ -/**************************************************************************/ -/*@{*/ - -/** The possible results of running a command with purple_cmd_do_command(). */ -typedef enum _PurpleCmdStatus { - PURPLE_CMD_STATUS_OK, - PURPLE_CMD_STATUS_FAILED, - PURPLE_CMD_STATUS_NOT_FOUND, - PURPLE_CMD_STATUS_WRONG_ARGS, - PURPLE_CMD_STATUS_WRONG_PRPL, - PURPLE_CMD_STATUS_WRONG_TYPE -} PurpleCmdStatus; - -/** Commands registered with the core return one of these values when run. - * Normally, a command will want to return one of the first two; in some - * unusual cases, you might want to have several functions called for a - * particular command; in this case, they should return - * #PURPLE_CMD_RET_CONTINUE to cause the core to fall through to other - * commands with the same name. - */ -typedef enum _PurpleCmdRet { - PURPLE_CMD_RET_OK, /**< Everything's okay; Don't look for another command to call. */ - PURPLE_CMD_RET_FAILED, /**< The command failed, but stop looking.*/ - PURPLE_CMD_RET_CONTINUE /**< Continue, looking for other commands with the same name to call. */ -} PurpleCmdRet; - -#define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func) - -/** A function implementing a command, as passed to purple_cmd_register(). - * - * @todo document the arguments to these functions. - * */ -typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd, - gchar **args, gchar **error, void *data); -/** A unique integer representing a command registered with - * purple_cmd_register(), which can subsequently be passed to - * purple_cmd_unregister() to unregister that command. - */ -typedef guint PurpleCmdId; - -typedef enum _PurpleCmdPriority { - PURPLE_CMD_P_VERY_LOW = -1000, - PURPLE_CMD_P_LOW = 0, - PURPLE_CMD_P_DEFAULT = 1000, - PURPLE_CMD_P_PRPL = 2000, - PURPLE_CMD_P_PLUGIN = 3000, - PURPLE_CMD_P_ALIAS = 4000, - PURPLE_CMD_P_HIGH = 5000, - PURPLE_CMD_P_VERY_HIGH = 6000 -} PurpleCmdPriority; - -/** Flags used to set various properties of commands. Every command should - * have at least one of #PURPLE_CMD_FLAG_IM and #PURPLE_CMD_FLAG_CHAT set in - * order to be even slighly useful. - * - * @see purple_cmd_register - */ -typedef enum _PurpleCmdFlag { - /** Command is usable in IMs. */ - PURPLE_CMD_FLAG_IM = 0x01, - /** Command is usable in multi-user chats. */ - PURPLE_CMD_FLAG_CHAT = 0x02, - /** Command is usable only for a particular prpl. */ - PURPLE_CMD_FLAG_PRPL_ONLY = 0x04, - /** Incorrect arguments to this command should be accepted anyway. */ - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08 -} PurpleCmdFlag; - - -/*@}*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Commands API */ -/**************************************************************************/ -/*@{*/ - -/** - * Register a new command with the core. - * - * The command will only happen if commands are enabled, - * which is a UI pref. UIs don't have to support commands at all. - * - * @param cmd The command. This should be a UTF-8 (or ASCII) string, with no spaces - * or other white space. - * @param args A string of characters describing to libpurple how to parse this - * command's arguments. If what the user types doesn't match this - * pattern, libpurple will keep looking for another command, unless - * the flag #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed in @a f. - * This string should contain no whitespace, and use a single - * character for each argument. The recognized characters are: - *
    - *
  • 'w': Matches a single word.
  • - *
  • 'W': Matches a single word, with formatting.
  • - *
  • 's': Matches the rest of the arguments after this - * point, as a single string.
  • - *
  • 'S': Same as 's' but with formatting.
  • - *
- * If args is the empty string, then the command accepts no arguments. - * The args passed to the callback @a func will be a @c NULL - * terminated array of @c NULL terminated strings, and will always - * match the number of arguments asked for, unless - * #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed. - * @param p This is the priority. Higher priority commands will be run first, - * and usually the first command will stop any others from being - * called. - * @param f Flags specifying various options about this command, combined with - * | (bitwise OR). You need to at least pass one of - * #PURPLE_CMD_FLAG_IM or #PURPLE_CMD_FLAG_CHAT (you may pass both) in - * order for the command to ever actually be called. - * @param prpl_id If the #PURPLE_CMD_FLAG_PRPL_ONLY flag is set, this is the id - * of the prpl to which the command applies (such as - * "prpl-msn"). If the flag is not set, this parameter - * is ignored; pass @c NULL (or a humourous string of your - * choice!). - * @param func This is the function to call when someone enters this command. - * @param helpstr a whitespace sensitive, UTF-8, HTML string describing how to - * use the command. The preferred format of this string is the - * command's name, followed by a space and any arguments it - * accepts (if it takes any arguments, otherwise no space), - * followed by a colon, two spaces, and a description of the - * command in sentence form. Do not include a slash before the - * command name. - * @param data User defined data to pass to the #PurpleCmdFunc @a f. - * @return A #PurpleCmdId, which is only used for calling - * #purple_cmd_unregister, or @a 0 on failure. - */ -PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f, - const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data); - -/** - * Unregister a command with the core. - * - * All registered commands must be unregistered, if they're registered by a plugin - * or something else that might go away. Normally this is called when the plugin - * unloads itself. - * - * @param id The #PurpleCmdId to unregister, as returned by #purple_cmd_register. - */ -void purple_cmd_unregister(PurpleCmdId id); - -/** - * Do a command. - * - * Normally the UI calls this to perform a command. This might also be useful - * if aliases are ever implemented. - * - * @param conv The conversation the command was typed in. - * @param cmdline The command the user typed (including all arguments) as a single string. - * The caller doesn't have to do any parsing, except removing the command - * prefix, which the core has no knowledge of. cmd should not contain any - * formatting, and should be in plain text (no html entities). - * @param markup This is the same as cmd, but is the formatted version. It should be in - * HTML, with < > and &, at least, escaped to html entities, and should - * include both the default formatting and any extra manual formatting. - * @param errormsg If the command failed errormsg is filled in with the appropriate error - * message. It must be freed by the caller with g_free(). - * @return A #PurpleCmdStatus indicating if the command succeeded or failed. - */ -PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline, - const gchar *markup, gchar **errormsg); - -/** - * List registered commands. - * - * Returns a GList (which must be freed by the caller) of all commands - * that are valid in the context of @a conv, or all commands, if @a conv is @c - * NULL. Don't keep this list around past the main loop, or anything else that - * might unregister a command, as the const char *'s used get freed - * then. - * - * @param conv The conversation, or @c NULL. - * @return A @c GList of const char *, which must be freed with - * g_list_free(). - */ -GList *purple_cmd_list(PurpleConversation *conv); - -/** - * Get the help string for a command. - * - * Returns the help strings for a given command in the form of a GList, - * one node for each matching command. - * - * @param conv The conversation, or @c NULL for no context. - * @param cmd The command. No wildcards accepted, but returns help for all - * commands if @c NULL. - * @return A GList of const char *s, which is the help string - * for that command. - */ -GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd); - -/** - * Get the handle for the commands API - * @return The handle - * @since 2.5.0 - */ -gpointer purple_cmds_get_handle(void); - -/** - * Initialize the commands subsystem. - * @since 2.5.0 - */ -void purple_cmds_init(void); - -/** - * Uninitialize the commands subsystem. - * @since 2.5.0 - */ -void purple_cmds_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_CMDS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,730 +0,0 @@ -/** - * @file connection.c Connection API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_CONNECTION_C_ - -#include "internal.h" -#include "account.h" -#include "blist.h" -#include "connection.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "log.h" -#include "notify.h" -#include "prefs.h" -#include "proxy.h" -#include "request.h" -#include "server.h" -#include "signals.h" -#include "util.h" - -#define KEEPALIVE_INTERVAL 30 - -static GList *connections = NULL; -static GList *connections_connecting = NULL; -static PurpleConnectionUiOps *connection_ui_ops = NULL; - -static int connections_handle; - -static gboolean -send_keepalive(gpointer data) -{ - PurpleConnection *gc = data; - PurplePluginProtocolInfo *prpl_info; - - /* Only send keep-alives if we haven't heard from the - * server in a while. - */ - if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL) - return TRUE; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (prpl_info->keepalive) - prpl_info->keepalive(gc); - - return TRUE; -} - -static void -update_keepalive(PurpleConnection *gc, gboolean on) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - - if (gc != NULL && gc->prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - - if (!prpl_info || !prpl_info->keepalive) - return; - - if (on && !gc->keepalive) - { - purple_debug_info("connection", "Activating keepalive.\n"); - gc->keepalive = purple_timeout_add_seconds(KEEPALIVE_INTERVAL, send_keepalive, gc); - } - else if (!on && gc->keepalive > 0) - { - purple_debug_info("connection", "Deactivating keepalive.\n"); - purple_timeout_remove(gc->keepalive); - gc->keepalive = 0; - } -} - -void -purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) -{ - _purple_connection_new(account, regist, password); -} - -void -_purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) -{ - PurpleConnection *gc; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - g_return_if_fail(account != NULL); - - if (!purple_account_is_disconnected(account)) - return; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - else { - gchar *message; - - message = g_strdup_printf(_("Missing protocol plugin for %s"), - purple_account_get_username(account)); - purple_notify_error(NULL, regist ? _("Registration Error") : - _("Connection Error"), message, NULL); - g_free(message); - return; - } - - if (regist) - { - if (prpl_info->register_user == NULL) - return; - } - else - { - if (((password == NULL) || (*password == '\0')) && - !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && - !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) - { - purple_debug_error("connection", "Can not connect to account %s without " - "a password.\n", purple_account_get_username(account)); - return; - } - } - - gc = g_new0(PurpleConnection, 1); - PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); - - gc->prpl = prpl; - if ((password != NULL) && (*password != '\0')) - gc->password = g_strdup(password); - purple_connection_set_account(gc, account); - purple_connection_set_state(gc, PURPLE_CONNECTING); - connections = g_list_append(connections, gc); - purple_account_set_connection(account, gc); - - purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); - - if (regist) - { - purple_debug_info("connection", "Registering. gc = %p\n", gc); - - /* set this so we don't auto-reconnect after registering */ - gc->wants_to_die = TRUE; - - prpl_info->register_user(account); - } - else - { - purple_debug_info("connection", "Connecting. gc = %p\n", gc); - - purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); - prpl_info->login(account); - } -} -void -purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) -{ - _purple_connection_new_unregister(account, password, cb, user_data); -} - -void -_purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) -{ - /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ - PurpleConnection *gc; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - g_return_if_fail(account != NULL); - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - - if (prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - else { - gchar *message; - - message = g_strdup_printf(_("Missing protocol plugin for %s"), - purple_account_get_username(account)); - purple_notify_error(NULL, _("Unregistration Error"), message, NULL); - g_free(message); - return; - } - - if (!purple_account_is_disconnected(account)) { - prpl_info->unregister_user(account, cb, user_data); - return; - } - - if (((password == NULL) || (*password == '\0')) && - !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && - !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) - { - purple_debug_error("connection", "Can not connect to account %s without " - "a password.\n", purple_account_get_username(account)); - return; - } - - gc = g_new0(PurpleConnection, 1); - PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); - - gc->prpl = prpl; - if ((password != NULL) && (*password != '\0')) - gc->password = g_strdup(password); - purple_connection_set_account(gc, account); - purple_connection_set_state(gc, PURPLE_CONNECTING); - connections = g_list_append(connections, gc); - purple_account_set_connection(account, gc); - - purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); - - purple_debug_info("connection", "Unregistering. gc = %p\n", gc); - - prpl_info->unregister_user(account, cb, user_data); -} - -void -purple_connection_destroy(PurpleConnection *gc) -{ - _purple_connection_destroy(gc); -} - -void -_purple_connection_destroy(PurpleConnection *gc) -{ - PurpleAccount *account; - GSList *buddies; - PurplePluginProtocolInfo *prpl_info = NULL; - gboolean remove = FALSE; - - g_return_if_fail(gc != NULL); - - account = purple_connection_get_account(gc); - - purple_debug_info("connection", "Disconnecting connection %p\n", gc); - - if (purple_connection_get_state(gc) != PURPLE_CONNECTING) - remove = TRUE; - - purple_signal_emit(purple_connections_get_handle(), "signing-off", gc); - - while (gc->buddy_chats) - { - PurpleConversation *b = gc->buddy_chats->data; - - gc->buddy_chats = g_slist_remove(gc->buddy_chats, b); - purple_conv_chat_left(PURPLE_CONV_CHAT(b)); - } - - update_keepalive(gc, FALSE); - - purple_proxy_connect_cancel_with_handle(gc); - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (prpl_info->close) - (prpl_info->close)(gc); - - /* Clear out the proto data that was freed in the prpl close method*/ - buddies = purple_find_buddies(account, NULL); - while (buddies != NULL) { - PurpleBuddy *buddy = buddies->data; - purple_buddy_set_protocol_data(buddy, NULL); - buddies = g_slist_delete_link(buddies, buddies); - } - - connections = g_list_remove(connections, gc); - - purple_connection_set_state(gc, PURPLE_DISCONNECTED); - - if (remove) - purple_blist_remove_account(account); - - purple_signal_emit(purple_connections_get_handle(), "signed-off", gc); - - purple_account_request_close_with_account(account); - purple_request_close_with_handle(gc); - purple_notify_close_with_handle(gc); - - purple_debug_info("connection", "Destroying connection %p\n", gc); - - purple_account_set_connection(account, NULL); - - g_free(gc->password); - g_free(gc->display_name); - - if (gc->disconnect_timeout > 0) - purple_timeout_remove(gc->disconnect_timeout); - - PURPLE_DBUS_UNREGISTER_POINTER(gc); - g_free(gc); -} - -/* - * d:)->-< - * - * d:O-\-< - * - * d:D-/-< - * - * d8D->-< DANCE! - */ - -void -purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state) -{ - PurpleConnectionUiOps *ops; - - g_return_if_fail(gc != NULL); - - if (gc->state == state) - return; - - gc->state = state; - - ops = purple_connections_get_ui_ops(); - - if (gc->state == PURPLE_CONNECTING) { - connections_connecting = g_list_append(connections_connecting, gc); - } - else { - connections_connecting = g_list_remove(connections_connecting, gc); - } - - if (gc->state == PURPLE_CONNECTED) { - PurpleAccount *account; - PurplePresence *presence; - - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - /* Set the time the account came online */ - purple_presence_set_login_time(presence, time(NULL)); - - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, TRUE); - - if (log != NULL) - { - char *msg = g_strdup_printf(_("+++ %s signed on"), - purple_account_get_username(account)); - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_account_get_username(account), - purple_presence_get_login_time(presence), - msg); - g_free(msg); - } - } - - if (ops != NULL && ops->connected != NULL) - ops->connected(gc); - - purple_blist_add_account(account); - - purple_signal_emit(purple_connections_get_handle(), "signed-on", gc); - - serv_set_permit_deny(gc); - - update_keepalive(gc, TRUE); - } - else if (gc->state == PURPLE_DISCONNECTED) { - PurpleAccount *account = purple_connection_get_account(gc); - - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *msg = g_strdup_printf(_("+++ %s signed off"), - purple_account_get_username(account)); - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_account_get_username(account), time(NULL), - msg); - g_free(msg); - } - } - - purple_account_destroy_log(account); - - if (ops != NULL && ops->disconnected != NULL) - ops->disconnected(gc); - } -} - -void -purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account) -{ - g_return_if_fail(gc != NULL); - g_return_if_fail(account != NULL); - - gc->account = account; -} - -void -purple_connection_set_display_name(PurpleConnection *gc, const char *name) -{ - g_return_if_fail(gc != NULL); - - g_free(gc->display_name); - gc->display_name = g_strdup(name); -} - -void -purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data) { - g_return_if_fail(connection != NULL); - - connection->proto_data = proto_data; -} - -PurpleConnectionState -purple_connection_get_state(const PurpleConnection *gc) -{ - g_return_val_if_fail(gc != NULL, PURPLE_DISCONNECTED); - - return gc->state; -} - -PurpleAccount * -purple_connection_get_account(const PurpleConnection *gc) -{ - g_return_val_if_fail(gc != NULL, NULL); - - return gc->account; -} - -PurplePlugin * -purple_connection_get_prpl(const PurpleConnection *gc) -{ - g_return_val_if_fail(gc != NULL, NULL); - - return gc->prpl; -} - -const char * -purple_connection_get_password(const PurpleConnection *gc) -{ - g_return_val_if_fail(gc != NULL, NULL); - - return gc->password ? gc->password : gc->account->password; -} - -const char * -purple_connection_get_display_name(const PurpleConnection *gc) -{ - g_return_val_if_fail(gc != NULL, NULL); - - return gc->display_name; -} - -void * -purple_connection_get_protocol_data(const PurpleConnection *connection) { - g_return_val_if_fail(connection != NULL, NULL); - - return connection->proto_data; -} - -void -purple_connection_update_progress(PurpleConnection *gc, const char *text, - size_t step, size_t count) -{ - PurpleConnectionUiOps *ops; - - g_return_if_fail(gc != NULL); - g_return_if_fail(text != NULL); - g_return_if_fail(step < count); - g_return_if_fail(count > 1); - - ops = purple_connections_get_ui_ops(); - - if (ops != NULL && ops->connect_progress != NULL) - ops->connect_progress(gc, text, step, count); -} - -void -purple_connection_notice(PurpleConnection *gc, const char *text) -{ - PurpleConnectionUiOps *ops; - - g_return_if_fail(gc != NULL); - g_return_if_fail(text != NULL); - - ops = purple_connections_get_ui_ops(); - - if (ops != NULL && ops->notice != NULL) - ops->notice(gc, text); -} - -static gboolean -purple_connection_disconnect_cb(gpointer data) -{ - PurpleAccount *account; - PurpleConnection *gc; - char *password; - - account = data; - gc = purple_account_get_connection(account); - - gc->disconnect_timeout = 0; - - password = g_strdup(purple_account_get_password(account)); - purple_account_disconnect(account); - purple_account_set_password(account, password); - g_free(password); - - return FALSE; -} - -void -purple_connection_error(PurpleConnection *gc, const char *text) -{ - /* prpls that have not been updated to use disconnection reasons will - * be setting wants_to_die before calling this function, so choose - * PURPLE_CONNECTION_ERROR_OTHER_ERROR (which is fatal) if it's true, - * and PURPLE_CONNECTION_ERROR_NETWORK_ERROR (which isn't) if not. See - * the documentation in connection.h. - */ - PurpleConnectionError reason = gc->wants_to_die - ? PURPLE_CONNECTION_ERROR_OTHER_ERROR - : PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - purple_connection_error_reason (gc, reason, text); -} - -void -purple_connection_error_reason (PurpleConnection *gc, - PurpleConnectionError reason, - const char *description) -{ - PurpleConnectionUiOps *ops; - - g_return_if_fail(gc != NULL); - /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR - * being the last member of the PurpleConnectionError enum in - * connection.h; if other reasons are added after it, this check should - * be updated. - */ - if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { - purple_debug_error("connection", - "purple_connection_error_reason: reason %u isn't a " - "valid reason\n", reason); - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - } - - if (description == NULL) { - purple_debug_error("connection", "purple_connection_error_reason called with NULL description\n"); - description = _("Unknown error"); - } - - /* If we've already got one error, we don't need any more */ - if (gc->disconnect_timeout > 0) - return; - - gc->wants_to_die = purple_connection_error_is_fatal (reason); - - purple_debug_info("connection", "Connection error on %p (reason: %u description: %s)\n", - gc, reason, description); - - ops = purple_connections_get_ui_ops(); - - if (ops != NULL) - { - if (ops->report_disconnect_reason != NULL) - ops->report_disconnect_reason (gc, reason, description); - if (ops->report_disconnect != NULL) - ops->report_disconnect (gc, description); - } - - purple_signal_emit(purple_connections_get_handle(), "connection-error", - gc, reason, description); - - gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, - purple_connection_get_account(gc)); -} - -void -purple_connection_ssl_error (PurpleConnection *gc, - PurpleSslErrorType ssl_error) -{ - PurpleConnectionError reason; - - switch (ssl_error) { - case PURPLE_SSL_HANDSHAKE_FAILED: - reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; - break; - case PURPLE_SSL_CONNECT_FAILED: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case PURPLE_SSL_CERTIFICATE_INVALID: - /* TODO: maybe PURPLE_SSL_* should be more specific? */ - reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; - break; - default: - g_assert_not_reached (); - reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR; - } - - purple_connection_error_reason (gc, reason, - purple_ssl_strerror(ssl_error)); -} - -gboolean -purple_connection_error_is_fatal (PurpleConnectionError reason) -{ - switch (reason) - { - case PURPLE_CONNECTION_ERROR_NETWORK_ERROR: - case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: - return FALSE; - case PURPLE_CONNECTION_ERROR_INVALID_USERNAME: - case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: - case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: - case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: - case PURPLE_CONNECTION_ERROR_NAME_IN_USE: - case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: - case PURPLE_CONNECTION_ERROR_OTHER_ERROR: - case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: - case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: - case PURPLE_CONNECTION_ERROR_CERT_EXPIRED: - case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: - case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: - case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: - case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: - case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: - return TRUE; - default: - g_return_val_if_reached(TRUE); - } -} - -void -purple_connections_disconnect_all(void) -{ - GList *l; - PurpleConnection *gc; - - while ((l = purple_connections_get_all()) != NULL) { - gc = l->data; - gc->wants_to_die = TRUE; - purple_account_disconnect(gc->account); - } -} - -GList * -purple_connections_get_all(void) -{ - return connections; -} - -GList * -purple_connections_get_connecting(void) -{ - return connections_connecting; -} - -void -purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) -{ - connection_ui_ops = ops; -} - -PurpleConnectionUiOps * -purple_connections_get_ui_ops(void) -{ - return connection_ui_ops; -} - -void -purple_connections_init(void) -{ - void *handle = purple_connections_get_handle(); - - purple_signal_register(handle, "signing-on", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONNECTION)); - - purple_signal_register(handle, "signed-on", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONNECTION)); - - purple_signal_register(handle, "signing-off", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONNECTION)); - - purple_signal_register(handle, "signed-off", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONNECTION)); - - purple_signal_register(handle, "connection-error", - purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_ENUM), - purple_value_new(PURPLE_TYPE_STRING)); - -} - -void -purple_connections_uninit(void) -{ - purple_signals_unregister_by_instance(purple_connections_get_handle()); -} - -void * -purple_connections_get_handle(void) -{ - return &connections_handle; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/connection.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,625 +0,0 @@ -/** - * @file connection.h Connection API - * @ingroup core - * @see @ref connection-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_CONNECTION_H_ -#define _PURPLE_CONNECTION_H_ - -/** @copydoc _PurpleConnection */ -typedef struct _PurpleConnection PurpleConnection; - -/** - * Flags to change behavior of the client for a given connection. - */ -typedef enum -{ - PURPLE_CONNECTION_HTML = 0x0001, /**< Connection sends/receives in 'HTML'. */ - PURPLE_CONNECTION_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive - background colors. */ - PURPLE_CONNECTION_AUTO_RESP = 0x0004, /**< Send auto responses when away. */ - PURPLE_CONNECTION_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */ - PURPLE_CONNECTION_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */ - PURPLE_CONNECTION_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */ - PURPLE_CONNECTION_NO_URLDESC = 0x0040, /**< Connection does not support descriptions with links */ - PURPLE_CONNECTION_NO_IMAGES = 0x0080, /**< Connection does not support sending of images */ - PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100 /**< Connection supports sending and receiving custom smileys */ - -} PurpleConnectionFlags; - -typedef enum -{ - PURPLE_DISCONNECTED = 0, /**< Disconnected. */ - PURPLE_CONNECTED, /**< Connected. */ - PURPLE_CONNECTING /**< Connecting. */ - -} PurpleConnectionState; - -/** - * Possible errors that can cause a connection to be closed. - * - * @since 2.3.0 - */ -typedef enum -{ - /** There was an error sending or receiving on the network socket, or - * there was some protocol error (such as the server sending malformed - * data). - */ - PURPLE_CONNECTION_ERROR_NETWORK_ERROR = 0, - /** The username supplied was not valid. */ - PURPLE_CONNECTION_ERROR_INVALID_USERNAME = 1, - /** The username, password or some other credential was incorrect. Use - * #PURPLE_CONNECTION_ERROR_INVALID_USERNAME instead if the username - * is known to be invalid. - */ - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 2, - /** libpurple doesn't speak any of the authentication methods the - * server offered. - */ - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE = 3, - /** libpurple was built without SSL support, and the connection needs - * SSL. - */ - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT = 4, - /** There was an error negotiating SSL on this connection, or the - * server does not support encryption but an account option was set to - * require it. - */ - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR = 5, - /** Someone is already connected to the server using the name you are - * trying to connect with. - */ - PURPLE_CONNECTION_ERROR_NAME_IN_USE = 6, - - /** The username/server/other preference for the account isn't valid. - * For instance, on IRC the username cannot contain white space. - * This reason should not be used for incorrect passwords etc: use - * #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED for that. - * - * @todo This reason really shouldn't be necessary. Usernames and - * other account preferences should be validated when the - * account is created. - */ - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS = 7, - - /** The server did not provide a SSL certificate. */ - PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED = 8, - /** The server's SSL certificate could not be trusted. */ - PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED = 9, - /** The server's SSL certificate has expired. */ - PURPLE_CONNECTION_ERROR_CERT_EXPIRED = 10, - /** The server's SSL certificate is not yet valid. */ - PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED = 11, - /** The server's SSL certificate did not match its hostname. */ - PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH = 12, - /** The server's SSL certificate does not have the expected - * fingerprint. - */ - PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH = 13, - /** The server's SSL certificate is self-signed. */ - PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED = 14, - /** There was some other error validating the server's SSL certificate. - */ - PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR = 15, - - /** Some other error occurred which fits into none of the other - * categories. - */ - /* purple_connection_error_reason() in connection.c uses the fact that - * this is the last member of the enum when sanity-checking; if other - * reasons are added after it, the check must be updated. - */ - PURPLE_CONNECTION_ERROR_OTHER_ERROR = 16 -} PurpleConnectionError; - -/** Holds the type of an error along with its description. */ -typedef struct -{ - /** The type of error. */ - PurpleConnectionError type; - /** A localised, human-readable description of the error. */ - char *description; -} PurpleConnectionErrorInfo; - -#include - -#include "account.h" -#include "plugin.h" -#include "status.h" -#include "sslconn.h" - -/** - * Connection UI operations. Used to notify the user of changes to - * connections, such as being disconnected, and to respond to the - * underlying network connection appearing and disappearing. UIs should - * call #purple_connections_set_ui_ops() with an instance of this struct. - * - * @see @ref ui-ops - */ -typedef struct -{ - /** - * When an account is connecting, this operation is called to notify - * the UI of what is happening, as well as which @a step out of @a - * step_count has been reached (which might be displayed as a progress - * bar). - * @see #purple_connection_update_progress - */ - void (*connect_progress)(PurpleConnection *gc, - const char *text, - size_t step, - size_t step_count); - - /** - * Called when a connection is established (just before the - * @ref signed-on signal). - */ - void (*connected)(PurpleConnection *gc); - - /** - * Called when a connection is ended (between the @ref signing-off - * and @ref signed-off signals). - */ - void (*disconnected)(PurpleConnection *gc); - - /** - * Used to display connection-specific notices. (Pidgin's Gtk user - * interface implements this as a no-op; #purple_connection_notice(), - * which uses this operation, is not used by any of the protocols - * shipped with libpurple.) - */ - void (*notice)(PurpleConnection *gc, const char *text); - - /** - * Called when an error causes a connection to be disconnected. - * Called before #disconnected. - * @param text a localized error message. - * @see #purple_connection_error - * @deprecated in favour of - * #PurpleConnectionUiOps.report_disconnect_reason. - */ - void (*report_disconnect)(PurpleConnection *gc, const char *text); - - /** - * Called when libpurple discovers that the computer's network - * connection is active. On Linux, this uses Network Manager if - * available; on Windows, it uses Win32's network change notification - * infrastructure. - */ - void (*network_connected)(void); - - /** - * Called when libpurple discovers that the computer's network - * connection has gone away. - */ - void (*network_disconnected)(void); - - /** - * Called when an error causes a connection to be disconnected. - * Called before #disconnected. This op is intended to replace - * #report_disconnect. If both are implemented, this will be called - * first; however, there's no real reason to implement both. - * - * @param reason why the connection ended, if known, or - * #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not. - * @param text a localized message describing the disconnection - * in more detail to the user. - * @see #purple_connection_error_reason - * - * @since 2.3.0 - */ - void (*report_disconnect_reason)(PurpleConnection *gc, - PurpleConnectionError reason, - const char *text); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); -} PurpleConnectionUiOps; - - -/* Represents an active connection on an account. */ -struct _PurpleConnection -{ - PurplePlugin *prpl; /**< The protocol plugin. */ - PurpleConnectionFlags flags; /**< Connection flags. */ - - PurpleConnectionState state; /**< The connection state. */ - - PurpleAccount *account; /**< The account being connected to. */ - char *password; /**< The password used. */ - int inpa; /**< The input watcher. */ - - GSList *buddy_chats; /**< A list of active chats - (#PurpleConversation structs of type - #PURPLE_CONV_TYPE_CHAT). */ - void *proto_data; /**< Protocol-specific data. */ - - char *display_name; /**< How you appear to other people. */ - guint keepalive; /**< Keep-alive. */ - - /** Wants to Die state. This is set when the user chooses to log out, or - * when the protocol is disconnected and should not be automatically - * reconnected (incorrect password, etc.). prpls should rely on - * purple_connection_error_reason() to set this for them rather than - * setting it themselves. - * @see purple_connection_error_is_fatal - */ - gboolean wants_to_die; - - guint disconnect_timeout; /**< Timer used for nasty stack tricks */ - time_t last_received; /**< When we last received a packet. Set by the - prpl to avoid sending unneeded keepalives */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Connection API */ -/**************************************************************************/ -/*@{*/ - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * This function should only be called by purple_account_connect() - * in account.c. If you're trying to sign on an account, use that - * function instead. - * - * Creates a connection to the specified account and either connects - * or attempts to register a new account. If you are logging in, - * the connection uses the current active status for this account. - * So if you want to sign on as "away," for example, you need to - * have called purple_account_set_status(account, "away"). - * (And this will call purple_account_connect() automatically). - * - * @param account The account the connection should be connecting to. - * @param regist Whether we are registering a new account or just - * trying to do a normal signon. - * @param password The password to use. - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_new(PurpleAccount *account, gboolean regist, - const char *password); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * This function should only be called by purple_account_unregister() - * in account.c. - * - * Tries to unregister the account on the server. If the account is not - * connected, also creates a new connection. - * - * @param account The account to unregister - * @param password The password to use. - * @param cb Optional callback to be called when unregistration is complete - * @param user_data user data to pass to the callback - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_CONNECTION_C_) -/** - * Disconnects and destroys a PurpleConnection. - * - * This function should only be called by purple_account_disconnect() - * in account.c. If you're trying to sign off an account, use that - * function instead. - * - * @param gc The purple connection to destroy. - * - * @deprecated As this is internal, we should make it private in 3.0.0. - */ -void purple_connection_destroy(PurpleConnection *gc); -#endif - -/** - * Sets the connection state. PRPLs should call this and pass in - * the state #PURPLE_CONNECTED when the account is completely - * signed on. What does it mean to be completely signed on? If - * the core can call prpl->set_status, and it successfully changes - * your status, then the account is online. - * - * @param gc The connection. - * @param state The connection state. - */ -void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state); - -/** - * Sets the connection's account. - * - * @param gc The connection. - * @param account The account. - */ -void purple_connection_set_account(PurpleConnection *gc, PurpleAccount *account); - -/** - * Sets the connection's displayed name. - * - * @param gc The connection. - * @param name The displayed name. - */ -void purple_connection_set_display_name(PurpleConnection *gc, const char *name); - -/** - * Sets the protocol data for a connection. - * - * @param connection The PurpleConnection. - * @param proto_data The protocol data to set for the connection. - * - * @since 2.6.0 - */ -void purple_connection_set_protocol_data(PurpleConnection *connection, void *proto_data); - -/** - * Returns the connection state. - * - * @param gc The connection. - * - * @return The connection state. - */ -PurpleConnectionState purple_connection_get_state(const PurpleConnection *gc); - -/** - * Returns TRUE if the account is connected, otherwise returns FALSE. - * - * @return TRUE if the account is connected, otherwise returns FALSE. - */ -#define PURPLE_CONNECTION_IS_CONNECTED(gc) \ - (purple_connection_get_state(gc) == PURPLE_CONNECTED) - -/** - * Returns the connection's account. - * - * @param gc The connection. - * - * @return The connection's account. - */ -PurpleAccount *purple_connection_get_account(const PurpleConnection *gc); - -/** - * Returns the protocol plugin managing a connection. - * - * @param gc The connection. - * - * @return The protocol plugin. - * - * @since 2.4.0 - */ -PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc); - -/** - * Returns the connection's password. - * - * @param gc The connection. - * - * @return The connection's password. - */ -const char *purple_connection_get_password(const PurpleConnection *gc); - -/** - * Returns the connection's displayed name. - * - * @param gc The connection. - * - * @return The connection's displayed name. - */ -const char *purple_connection_get_display_name(const PurpleConnection *gc); - -/** - * Gets the protocol data from a connection. - * - * @param connection The PurpleConnection. - * - * @return The protocol data for the connection. - * - * @since 2.6.0 - */ -void *purple_connection_get_protocol_data(const PurpleConnection *connection); - -/** - * Updates the connection progress. - * - * @param gc The connection. - * @param text Information on the current step. - * @param step The current step. - * @param count The total number of steps. - */ -void purple_connection_update_progress(PurpleConnection *gc, const char *text, - size_t step, size_t count); - -/** - * Displays a connection-specific notice. - * - * @param gc The connection. - * @param text The notice text. - */ -void purple_connection_notice(PurpleConnection *gc, const char *text); - -/** - * Closes a connection with an error. - * - * @param gc The connection. - * @param reason The error text, which may not be @c NULL. - * @deprecated in favour of #purple_connection_error_reason. Calling - * @c purple_connection_error(gc, text) is equivalent to calling - * @c purple_connection_error_reason(gc, reason, text) where @c reason is - * #PURPLE_CONNECTION_ERROR_OTHER_ERROR if @c gc->wants_to_die is @c TRUE, and - * #PURPLE_CONNECTION_ERROR_NETWORK_ERROR if not. (This is to keep - * auto-reconnection behaviour the same when using old prpls which don't use - * reasons yet.) - */ -void purple_connection_error(PurpleConnection *gc, const char *reason); - -/** - * Closes a connection with an error and a human-readable description of the - * error. It also sets @c gc->wants_to_die to the value of - * #purple_connection_error_is_fatal(@a reason), mainly for - * backwards-compatibility. - * - * @param gc the connection which is closing. - * @param reason why the connection is closing. - * @param description a non-@c NULL localized description of the error. - * - * @since 2.3.0 - */ -void -purple_connection_error_reason (PurpleConnection *gc, - PurpleConnectionError reason, - const char *description); - -/** - * Closes a connection due to an SSL error; this is basically a shortcut to - * turning the #PurpleSslErrorType into a #PurpleConnectionError and a - * human-readable string and then calling purple_connection_error_reason(). - * - * @since 2.3.0 - */ -void -purple_connection_ssl_error (PurpleConnection *gc, - PurpleSslErrorType ssl_error); - -/** - * Reports whether a disconnection reason is fatal (in which case the account - * should probably not be automatically reconnected) or transient (so - * auto-reconnection is a good idea). - * For instance, #PURPLE_CONNECTION_ERROR_NETWORK_ERROR is a temporary error, - * which might be caused by losing the network connection, so - * purple_connection_error_is_fatal (PURPLE_CONNECTION_ERROR_NETWORK_ERROR) - * is @c FALSE. On the other hand, - * #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED probably indicates a - * misconfiguration of the account which needs the user to go fix it up, so - * purple_connection_error_is_fatal - * (PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED) is @c TRUE. - * - * (This function is meant to replace checking PurpleConnection.wants_to_die.) - * - * @return @c TRUE if the account should not be automatically reconnected, and - * @c FALSE otherwise. - * - * @since 2.3.0 - */ -gboolean -purple_connection_error_is_fatal (PurpleConnectionError reason); - -/*@}*/ - -/**************************************************************************/ -/** @name Connections API */ -/**************************************************************************/ -/*@{*/ - -/** - * Disconnects from all connections. - */ -void purple_connections_disconnect_all(void); - -/** - * Returns a list of all active connections. This does not - * include connections that are in the process of connecting. - * - * @constreturn A list of all active connections. - */ -GList *purple_connections_get_all(void); - -/** - * Returns a list of all connections in the process of connecting. - * - * @constreturn A list of connecting connections. - */ -GList *purple_connections_get_connecting(void); - -/** - * Checks if gc is still a valid pointer to a gc. - * - * @return @c TRUE if gc is valid. - * - * @deprecated Do not use this. Instead, cancel your asynchronous request - * when the PurpleConnection is destroyed. - */ -/* - * TODO: Eventually this bad boy will be removed, because it is - * a gross fix for a crashy problem. - */ -#define PURPLE_CONNECTION_IS_VALID(gc) (g_list_find(purple_connections_get_all(), (gc)) != NULL) - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used for connections. - * - * @param ops The UI operations structure. - */ -void purple_connections_set_ui_ops(PurpleConnectionUiOps *ops); - -/** - * Returns the UI operations structure used for connections. - * - * @return The UI operations structure in use. - */ -PurpleConnectionUiOps *purple_connections_get_ui_ops(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Connections Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Initializes the connections subsystem. - */ -void purple_connections_init(void); - -/** - * Uninitializes the connections subsystem. - */ -void purple_connections_uninit(void); - -/** - * Returns the handle to the connections subsystem. - * - * @return The connections subsystem handle. - */ -void *purple_connections_get_handle(void); - -/*@}*/ - - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_CONNECTION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2557 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "blist.h" -#include "cmds.h" -#include "conversation.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "imgstore.h" -#include "notify.h" -#include "prefs.h" -#include "prpl.h" -#include "request.h" -#include "signals.h" -#include "util.h" - -#define SEND_TYPED_TIMEOUT_SECONDS 5 - -static GList *conversations = NULL; -static GList *ims = NULL; -static GList *chats = NULL; -static PurpleConversationUiOps *default_ops = NULL; - -/** - * A hash table used for efficient lookups of conversations by name. - * struct _purple_hconv => PurpleConversation* - */ -static GHashTable *conversation_cache = NULL; - -struct _purple_hconv { - PurpleConversationType type; - char *name; - const PurpleAccount *account; -}; - -static guint _purple_conversations_hconv_hash(struct _purple_hconv *hc) -{ - return g_str_hash(hc->name) ^ hc->type ^ g_direct_hash(hc->account); -} - -static guint _purple_conversations_hconv_equal(struct _purple_hconv *hc1, struct _purple_hconv *hc2) -{ - return (hc1->type == hc2->type && - hc1->account == hc2->account && - g_str_equal(hc1->name, hc2->name)); -} - -static void _purple_conversations_hconv_free_key(struct _purple_hconv *hc) -{ - g_free(hc->name); - g_free(hc); -} - -void -purple_conversations_set_ui_ops(PurpleConversationUiOps *ops) -{ - default_ops = ops; -} - -static gboolean -reset_typing_cb(gpointer data) -{ - PurpleConversation *c = (PurpleConversation *)data; - PurpleConvIm *im; - - im = PURPLE_CONV_IM(c); - - purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); - purple_conv_im_stop_typing_timeout(im); - - return FALSE; -} - -static gboolean -send_typed_cb(gpointer data) -{ - PurpleConversation *conv = (PurpleConversation *)data; - PurpleConnection *gc; - const char *name; - - g_return_val_if_fail(conv != NULL, FALSE); - - gc = purple_conversation_get_gc(conv); - name = purple_conversation_get_name(conv); - - if (gc != NULL && name != NULL) { - /* We set this to 1 so that PURPLE_TYPING will be sent - * if the Purple user types anything else. - */ - purple_conv_im_set_type_again(PURPLE_CONV_IM(conv), 1); - - serv_send_typing(gc, name, PURPLE_TYPED); - - purple_debug(PURPLE_DEBUG_MISC, "conversation", "typed...\n"); - } - - return FALSE; -} - -static void -common_send(PurpleConversation *conv, const char *message, PurpleMessageFlags msgflags) -{ - PurpleConversationType type; - PurpleAccount *account; - PurpleConnection *gc; - char *displayed = NULL, *sent = NULL; - int err = 0; - - if (*message == '\0') - return; - - account = purple_conversation_get_account(conv); - gc = purple_conversation_get_gc(conv); - - g_return_if_fail(account != NULL); - g_return_if_fail(gc != NULL); - - type = purple_conversation_get_type(conv); - - /* Always linkfy the text for display, unless we're - * explicitly asked to do otheriwse*/ - if (!(msgflags & PURPLE_MESSAGE_INVISIBLE)) { - if(msgflags & PURPLE_MESSAGE_NO_LINKIFY) - displayed = g_strdup(message); - else - displayed = purple_markup_linkify(message); - } - - if (displayed && (conv->features & PURPLE_CONNECTION_HTML) && - !(msgflags & PURPLE_MESSAGE_RAW)) { - sent = g_strdup(displayed); - } else - sent = g_strdup(message); - - msgflags |= PURPLE_MESSAGE_SEND; - - if (type == PURPLE_CONV_TYPE_IM) { - PurpleConvIm *im = PURPLE_CONV_IM(conv); - - purple_signal_emit(purple_conversations_get_handle(), "sending-im-msg", - account, - purple_conversation_get_name(conv), &sent); - - if (sent != NULL && sent[0] != '\0') { - - err = serv_send_im(gc, purple_conversation_get_name(conv), - sent, msgflags); - - if ((err > 0) && (displayed != NULL)) - purple_conv_im_write(im, NULL, displayed, msgflags, time(NULL)); - - purple_signal_emit(purple_conversations_get_handle(), "sent-im-msg", - account, - purple_conversation_get_name(conv), sent); - } - } - else { - purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg", - account, &sent, - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); - - if (sent != NULL && sent[0] != '\0') { - err = serv_chat_send(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), sent, msgflags); - - purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg", - account, sent, - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); - } - } - - if (err < 0) { - const char *who; - const char *msg; - - who = purple_conversation_get_name(conv); - - if (err == -E2BIG) { - msg = _("Unable to send message: The message is too large."); - - if (!purple_conv_present_error(who, account, msg)) { - char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); - purple_notify_error(gc, NULL, msg2, _("The message is too large.")); - g_free(msg2); - } - } - else if (err == -ENOTCONN) { - purple_debug(PURPLE_DEBUG_ERROR, "conversation", - "Not yet connected.\n"); - } - else { - msg = _("Unable to send message."); - - if (!purple_conv_present_error(who, account, msg)) { - char *msg2 = g_strdup_printf(_("Unable to send message to %s."), who); - purple_notify_error(gc, NULL, msg2, NULL); - g_free(msg2); - } - } - } - - g_free(displayed); - g_free(sent); -} - -static void -open_log(PurpleConversation *conv) -{ - conv->logs = g_list_append(NULL, purple_log_new(conv->type == PURPLE_CONV_TYPE_CHAT ? PURPLE_LOG_CHAT : - PURPLE_LOG_IM, conv->name, conv->account, - conv, time(NULL), NULL)); -} - -/* Functions that deal with PurpleConvMessage */ - -static void -add_message_to_history(PurpleConversation *conv, const char *who, const char *alias, - const char *message, PurpleMessageFlags flags, time_t when) -{ - PurpleConvMessage *msg; - PurpleConnection *gc; - - gc = purple_account_get_connection(conv->account); - - if (flags & PURPLE_MESSAGE_SEND) { - const char *me = NULL; - if (gc) - me = purple_connection_get_display_name(gc); - if (!me) - me = conv->account->username; - who = me; - } - - msg = g_new0(PurpleConvMessage, 1); - PURPLE_DBUS_REGISTER_POINTER(msg, PurpleConvMessage); - msg->who = g_strdup(who); - msg->alias = g_strdup(alias); - msg->flags = flags; - msg->what = g_strdup(message); - msg->when = when; - msg->conv = conv; - - conv->message_history = g_list_prepend(conv->message_history, msg); -} - -static void -free_conv_message(PurpleConvMessage *msg) -{ - g_free(msg->who); - g_free(msg->alias); - g_free(msg->what); - PURPLE_DBUS_UNREGISTER_POINTER(msg); - g_free(msg); -} - -static void -message_history_free(GList *list) -{ - g_list_foreach(list, (GFunc)free_conv_message, NULL); - g_list_free(list); -} - -/************************************************************************** - * Conversation API - **************************************************************************/ -static void -purple_conversation_chat_cleanup_for_rejoin(PurpleConversation *conv) -{ - const char *disp; - PurpleAccount *account; - PurpleConnection *gc; - - account = purple_conversation_get_account(conv); - - purple_conversation_close_logs(conv); - open_log(conv); - - gc = purple_account_get_connection(account); - - if ((disp = purple_connection_get_display_name(gc)) != NULL) - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(conv), disp); - else - { - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(conv), - purple_account_get_username(account)); - } - - purple_conv_chat_clear_users(PURPLE_CONV_CHAT(conv)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, NULL); - PURPLE_CONV_CHAT(conv)->left = FALSE; - - purple_conversation_update(conv, PURPLE_CONV_UPDATE_CHATLEFT); -} - -PurpleConversation * -purple_conversation_new(PurpleConversationType type, PurpleAccount *account, - const char *name) -{ - PurpleConversation *conv; - PurpleConnection *gc; - PurpleConversationUiOps *ops; - struct _purple_hconv *hc; - - g_return_val_if_fail(type != PURPLE_CONV_TYPE_UNKNOWN, NULL); - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - /* Check if this conversation already exists. */ - if ((conv = purple_find_conversation_with_account(type, name, account)) != NULL) - { - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && - !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) { - purple_debug_warning("conversation", "Trying to create multiple " - "chats (%s) with the same name is deprecated and will be " - "removed in libpurple 3.0.0", name); - } - - /* - * This hack is necessary because some prpls (MSN) have unnamed chats - * that all use the same name. A PurpleConversation for one of those - * is only ever re-used if the user has left, so calls to - * purple_conversation_new need to fall-through to creating a new - * chat. - * TODO 3.0.0: Remove this workaround and mandate unique names. - */ - if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT || - purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) - { - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) - purple_conversation_chat_cleanup_for_rejoin(conv); - - return conv; - } - } - - gc = purple_account_get_connection(account); - g_return_val_if_fail(gc != NULL, NULL); - - conv = g_new0(PurpleConversation, 1); - PURPLE_DBUS_REGISTER_POINTER(conv, PurpleConversation); - - conv->type = type; - conv->account = account; - conv->name = g_strdup(name); - conv->title = g_strdup(name); - conv->data = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - /* copy features from the connection. */ - conv->features = gc->flags; - - if (type == PURPLE_CONV_TYPE_IM) - { - PurpleBuddyIcon *icon; - conv->u.im = g_new0(PurpleConvIm, 1); - conv->u.im->conv = conv; - PURPLE_DBUS_REGISTER_POINTER(conv->u.im, PurpleConvIm); - - ims = g_list_prepend(ims, conv); - if ((icon = purple_buddy_icons_find(account, name))) - { - purple_conv_im_set_icon(conv->u.im, icon); - /* purple_conv_im_set_icon refs the icon. */ - purple_buddy_icon_unref(icon); - } - - if (purple_prefs_get_bool("/purple/logging/log_ims")) - { - purple_conversation_set_logging(conv, TRUE); - open_log(conv); - } - } - else if (type == PURPLE_CONV_TYPE_CHAT) - { - const char *disp; - - conv->u.chat = g_new0(PurpleConvChat, 1); - conv->u.chat->conv = conv; - PURPLE_DBUS_REGISTER_POINTER(conv->u.chat, PurpleConvChat); - - chats = g_list_prepend(chats, conv); - - if ((disp = purple_connection_get_display_name(account->gc))) - purple_conv_chat_set_nick(conv->u.chat, disp); - else - purple_conv_chat_set_nick(conv->u.chat, - purple_account_get_username(account)); - - if (purple_prefs_get_bool("/purple/logging/log_chats")) - { - purple_conversation_set_logging(conv, TRUE); - open_log(conv); - } - } - - conversations = g_list_prepend(conversations, conv); - - hc = g_new(struct _purple_hconv, 1); - hc->name = g_strdup(purple_normalize(account, conv->name)); - hc->account = account; - hc->type = type; - - g_hash_table_insert(conversation_cache, hc, conv); - - /* Auto-set the title. */ - purple_conversation_autoset_title(conv); - - /* Don't move this.. it needs to be one of the last things done otherwise - * it causes mysterious crashes on my system. - * -- Gary - */ - ops = conv->ui_ops = default_ops; - if (ops != NULL && ops->create_conversation != NULL) - ops->create_conversation(conv); - - purple_signal_emit(purple_conversations_get_handle(), - "conversation-created", conv); - - return conv; -} - -void -purple_conversation_destroy(PurpleConversation *conv) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConversationUiOps *ops; - PurpleConnection *gc; - const char *name; - struct _purple_hconv hc; - - g_return_if_fail(conv != NULL); - - purple_request_close_with_handle(conv); - - ops = purple_conversation_get_ui_ops(conv); - gc = purple_conversation_get_gc(conv); - name = purple_conversation_get_name(conv); - - if (gc != NULL) - { - /* Still connected */ - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) - { - if (purple_prefs_get_bool("/purple/conversations/im/send_typing")) - serv_send_typing(gc, name, PURPLE_NOT_TYPING); - - if (gc && prpl_info->convo_closed != NULL) - prpl_info->convo_closed(gc, name); - } - else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) - { - int chat_id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); -#if 0 - /* - * This is unfortunately necessary, because calling - * serv_chat_leave() calls this purple_conversation_destroy(), - * which leads to two calls here.. We can't just return after - * this, because then it'll return on the next pass. So, since - * serv_got_chat_left(), which is eventually called from the - * prpl that serv_chat_leave() calls, removes this conversation - * from the gc's buddy_chats list, we're going to check to see - * if this exists in the list. If so, we want to return after - * calling this, because it'll be called again. If not, fall - * through, because it'll have already been removed, and we'd - * be on the 2nd pass. - * - * Long paragraph. <-- Short sentence. - * - * -- ChipX86 - */ - - if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { - serv_chat_leave(gc, chat_id); - - return; - } -#endif - /* - * Instead of all of that, lets just close the window when - * the user tells us to, and let the prpl deal with the - * internals on it's own time. Don't do this if the prpl already - * knows it left the chat. - */ - if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) - serv_chat_leave(gc, chat_id); - - /* - * If they didn't call serv_got_chat_left by now, it's too late. - * So we better do it for them before we destroy the thing. - */ - if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) - serv_got_chat_left(gc, chat_id); - } - } - - /* remove from conversations and im/chats lists prior to emit */ - conversations = g_list_remove(conversations, conv); - - if(conv->type==PURPLE_CONV_TYPE_IM) - ims = g_list_remove(ims, conv); - else if(conv->type==PURPLE_CONV_TYPE_CHAT) - chats = g_list_remove(chats, conv); - - hc.name = (gchar *)purple_normalize(conv->account, conv->name); - hc.account = conv->account; - hc.type = conv->type; - - g_hash_table_remove(conversation_cache, &hc); - - purple_signal_emit(purple_conversations_get_handle(), - "deleting-conversation", conv); - - g_free(conv->name); - g_free(conv->title); - - conv->name = NULL; - conv->title = NULL; - - if (conv->type == PURPLE_CONV_TYPE_IM) { - purple_conv_im_stop_typing_timeout(conv->u.im); - purple_conv_im_stop_send_typed_timeout(conv->u.im); - - purple_buddy_icon_unref(conv->u.im->icon); - conv->u.im->icon = NULL; - - PURPLE_DBUS_UNREGISTER_POINTER(conv->u.im); - g_free(conv->u.im); - conv->u.im = NULL; - } - else if (conv->type == PURPLE_CONV_TYPE_CHAT) { - - g_list_foreach(conv->u.chat->in_room, (GFunc)purple_conv_chat_cb_destroy, NULL); - g_list_free(conv->u.chat->in_room); - - g_list_foreach(conv->u.chat->ignored, (GFunc)g_free, NULL); - g_list_free(conv->u.chat->ignored); - - conv->u.chat->in_room = NULL; - conv->u.chat->ignored = NULL; - - g_free(conv->u.chat->who); - conv->u.chat->who = NULL; - - g_free(conv->u.chat->topic); - conv->u.chat->topic = NULL; - - g_free(conv->u.chat->nick); - - PURPLE_DBUS_UNREGISTER_POINTER(conv->u.chat); - g_free(conv->u.chat); - conv->u.chat = NULL; - } - - g_hash_table_destroy(conv->data); - conv->data = NULL; - - if (ops != NULL && ops->destroy_conversation != NULL) - ops->destroy_conversation(conv); - - purple_conversation_close_logs(conv); - - purple_conversation_clear_message_history(conv); - - PURPLE_DBUS_UNREGISTER_POINTER(conv); - g_free(conv); - conv = NULL; -} - - -void -purple_conversation_present(PurpleConversation *conv) { - PurpleConversationUiOps *ops; - - g_return_if_fail(conv != NULL); - - ops = purple_conversation_get_ui_ops(conv); - if(ops && ops->present) - ops->present(conv); -} - - -void -purple_conversation_set_features(PurpleConversation *conv, PurpleConnectionFlags features) -{ - g_return_if_fail(conv != NULL); - - conv->features = features; - - purple_conversation_update(conv, PURPLE_CONV_UPDATE_FEATURES); -} - - -PurpleConnectionFlags -purple_conversation_get_features(PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, 0); - return conv->features; -} - - -PurpleConversationType -purple_conversation_get_type(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, PURPLE_CONV_TYPE_UNKNOWN); - - return conv->type; -} - -void -purple_conversation_set_ui_ops(PurpleConversation *conv, - PurpleConversationUiOps *ops) -{ - g_return_if_fail(conv != NULL); - - if (conv->ui_ops == ops) - return; - - if (conv->ui_ops != NULL && conv->ui_ops->destroy_conversation != NULL) - conv->ui_ops->destroy_conversation(conv); - - conv->ui_data = NULL; - - conv->ui_ops = ops; -} - -PurpleConversationUiOps * -purple_conversation_get_ui_ops(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, NULL); - - return conv->ui_ops; -} - -void -purple_conversation_set_account(PurpleConversation *conv, PurpleAccount *account) -{ - g_return_if_fail(conv != NULL); - - if (account == purple_conversation_get_account(conv)) - return; - - conv->account = account; - - purple_conversation_update(conv, PURPLE_CONV_UPDATE_ACCOUNT); -} - -PurpleAccount * -purple_conversation_get_account(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, NULL); - - return conv->account; -} - -PurpleConnection * -purple_conversation_get_gc(const PurpleConversation *conv) -{ - PurpleAccount *account; - - g_return_val_if_fail(conv != NULL, NULL); - - account = purple_conversation_get_account(conv); - - if (account == NULL) - return NULL; - - return account->gc; -} - -void -purple_conversation_set_title(PurpleConversation *conv, const char *title) -{ - g_return_if_fail(conv != NULL); - g_return_if_fail(title != NULL); - - g_free(conv->title); - conv->title = g_strdup(title); - - purple_conversation_update(conv, PURPLE_CONV_UPDATE_TITLE); -} - -const char * -purple_conversation_get_title(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, NULL); - - return conv->title; -} - -void -purple_conversation_autoset_title(PurpleConversation *conv) -{ - PurpleAccount *account; - PurpleBuddy *b; - PurpleChat *chat; - const char *text = NULL, *name; - - g_return_if_fail(conv != NULL); - - account = purple_conversation_get_account(conv); - name = purple_conversation_get_name(conv); - - if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - if(account && ((b = purple_find_buddy(account, name)) != NULL)) - text = purple_buddy_get_contact_alias(b); - } else if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - if(account && ((chat = purple_blist_find_chat(account, name)) != NULL)) - text = purple_chat_get_name(chat); - } - - - if(text == NULL) - text = name; - - purple_conversation_set_title(conv, text); -} - -void -purple_conversation_foreach(void (*func)(PurpleConversation *conv)) -{ - PurpleConversation *conv; - GList *l; - - g_return_if_fail(func != NULL); - - for (l = purple_get_conversations(); l != NULL; l = l->next) { - conv = (PurpleConversation *)l->data; - - func(conv); - } -} - -void -purple_conversation_set_name(PurpleConversation *conv, const char *name) -{ - struct _purple_hconv *hc; - g_return_if_fail(conv != NULL); - - hc = g_new(struct _purple_hconv, 1); - hc->type = conv->type; - hc->account = conv->account; - hc->name = (gchar *)purple_normalize(conv->account, conv->name); - - g_hash_table_remove(conversation_cache, hc); - g_free(conv->name); - - conv->name = g_strdup(name); - hc->name = g_strdup(purple_normalize(conv->account, conv->name)); - g_hash_table_insert(conversation_cache, hc, conv); - - purple_conversation_autoset_title(conv); -} - -const char * -purple_conversation_get_name(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, NULL); - - return conv->name; -} - -void -purple_conversation_set_logging(PurpleConversation *conv, gboolean log) -{ - g_return_if_fail(conv != NULL); - - if (conv->logging != log) - { - conv->logging = log; - purple_conversation_update(conv, PURPLE_CONV_UPDATE_LOGGING); - } -} - -gboolean -purple_conversation_is_logging(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, FALSE); - - return conv->logging; -} - -void -purple_conversation_close_logs(PurpleConversation *conv) -{ - g_return_if_fail(conv != NULL); - - g_list_foreach(conv->logs, (GFunc)purple_log_free, NULL); - g_list_free(conv->logs); - conv->logs = NULL; -} - -PurpleConvIm * -purple_conversation_get_im_data(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, NULL); - - if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) - return NULL; - - return conv->u.im; -} - -PurpleConvChat * -purple_conversation_get_chat_data(const PurpleConversation *conv) -{ - g_return_val_if_fail(conv != NULL, NULL); - - if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) - return NULL; - - return conv->u.chat; -} - -void -purple_conversation_set_data(PurpleConversation *conv, const char *key, - gpointer data) -{ - g_return_if_fail(conv != NULL); - g_return_if_fail(key != NULL); - - g_hash_table_replace(conv->data, g_strdup(key), data); -} - -gpointer -purple_conversation_get_data(PurpleConversation *conv, const char *key) -{ - g_return_val_if_fail(conv != NULL, NULL); - g_return_val_if_fail(key != NULL, NULL); - - return g_hash_table_lookup(conv->data, key); -} - -GList * -purple_get_conversations(void) -{ - return conversations; -} - -GList * -purple_get_ims(void) -{ - return ims; -} - -GList * -purple_get_chats(void) -{ - return chats; -} - - -PurpleConversation * -purple_find_conversation_with_account(PurpleConversationType type, - const char *name, - const PurpleAccount *account) -{ - PurpleConversation *c = NULL; - struct _purple_hconv hc; - - g_return_val_if_fail(name != NULL, NULL); - - hc.name = (gchar *)purple_normalize(account, name); - hc.account = account; - hc.type = type; - - switch (type) { - case PURPLE_CONV_TYPE_IM: - case PURPLE_CONV_TYPE_CHAT: - c = g_hash_table_lookup(conversation_cache, &hc); - break; - case PURPLE_CONV_TYPE_ANY: - hc.type = PURPLE_CONV_TYPE_IM; - c = g_hash_table_lookup(conversation_cache, &hc); - if (!c) { - hc.type = PURPLE_CONV_TYPE_CHAT; - c = g_hash_table_lookup(conversation_cache, &hc); - } - break; - default: - g_return_val_if_reached(NULL); - } - - return c; -} - -void -purple_conversation_write(PurpleConversation *conv, const char *who, - const char *message, PurpleMessageFlags flags, - time_t mtime) -{ - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc = NULL; - PurpleAccount *account; - PurpleConversationUiOps *ops; - const char *alias; - char *displayed = NULL; - PurpleBuddy *b; - int plugin_return; - PurpleConversationType type; - /* int logging_font_options = 0; */ - - g_return_if_fail(conv != NULL); - g_return_if_fail(message != NULL); - - ops = purple_conversation_get_ui_ops(conv); - - account = purple_conversation_get_account(conv); - type = purple_conversation_get_type(conv); - - if (account != NULL) - gc = purple_account_get_connection(account); - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && - (gc != NULL && !g_slist_find(gc->buddy_chats, conv))) - return; - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && - !g_list_find(purple_get_conversations(), conv)) - return; - - displayed = g_strdup(message); - - if (who == NULL || *who == '\0') - who = purple_conversation_get_name(conv); - alias = who; - - plugin_return = - GPOINTER_TO_INT(purple_signal_emit_return_1( - purple_conversations_get_handle(), - (type == PURPLE_CONV_TYPE_IM ? "writing-im-msg" : "writing-chat-msg"), - account, who, &displayed, conv, flags)); - - if (displayed == NULL) - return; - - if (plugin_return) { - g_free(displayed); - return; - } - - if (account != NULL) { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM || - !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - - if (flags & PURPLE_MESSAGE_SEND) { - b = purple_find_buddy(account, - purple_account_get_username(account)); - - if (purple_account_get_alias(account) != NULL) - alias = account->alias; - else if (b != NULL && !purple_strequal(purple_buddy_get_name(b), purple_buddy_get_contact_alias(b))) - alias = purple_buddy_get_contact_alias(b); - else if (purple_connection_get_display_name(gc) != NULL) - alias = purple_connection_get_display_name(gc); - else - alias = purple_account_get_username(account); - } - else - { - b = purple_find_buddy(account, who); - - if (b != NULL) - alias = purple_buddy_get_contact_alias(b); - } - } - } - - if (!(flags & PURPLE_MESSAGE_NO_LOG) && purple_conversation_is_logging(conv)) { - GList *log; - - if (conv->logs == NULL) - open_log(conv); - - log = conv->logs; - while (log != NULL) { - purple_log_write((PurpleLog *)log->data, flags, alias, mtime, displayed); - log = log->next; - } - } - - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - if ((flags & PURPLE_MESSAGE_RECV) == PURPLE_MESSAGE_RECV) { - purple_conv_im_set_typing_state(PURPLE_CONV_IM(conv), PURPLE_NOT_TYPING); - } - } - - if (ops && ops->write_conv) - ops->write_conv(conv, who, alias, displayed, flags, mtime); - - add_message_to_history(conv, who, alias, message, flags, mtime); - - purple_signal_emit(purple_conversations_get_handle(), - (type == PURPLE_CONV_TYPE_IM ? "wrote-im-msg" : "wrote-chat-msg"), - account, who, displayed, conv, flags); - - g_free(displayed); -} - -gboolean -purple_conversation_has_focus(PurpleConversation *conv) -{ - gboolean ret = FALSE; - PurpleConversationUiOps *ops; - - g_return_val_if_fail(conv != NULL, FALSE); - - ops = purple_conversation_get_ui_ops(conv); - - if (ops != NULL && ops->has_focus != NULL) - ret = ops->has_focus(conv); - - return ret; -} - -/* - * TODO: Need to make sure calls to this function happen in the core - * instead of the UI. That way UIs have less work to do, and the - * core/UI split is cleaner. Also need to make sure this is called - * when chats are added/removed from the blist. - */ -void -purple_conversation_update(PurpleConversation *conv, PurpleConvUpdateType type) -{ - g_return_if_fail(conv != NULL); - - purple_signal_emit(purple_conversations_get_handle(), - "conversation-updated", conv, type); -} - -/************************************************************************** - * IM Conversation API - **************************************************************************/ -PurpleConversation * -purple_conv_im_get_conversation(const PurpleConvIm *im) -{ - g_return_val_if_fail(im != NULL, NULL); - - return im->conv; -} - -void -purple_conv_im_set_icon(PurpleConvIm *im, PurpleBuddyIcon *icon) -{ - g_return_if_fail(im != NULL); - - if (im->icon != icon) - { - purple_buddy_icon_unref(im->icon); - - im->icon = (icon == NULL ? NULL : purple_buddy_icon_ref(icon)); - } - - purple_conversation_update(purple_conv_im_get_conversation(im), - PURPLE_CONV_UPDATE_ICON); -} - -PurpleBuddyIcon * -purple_conv_im_get_icon(const PurpleConvIm *im) -{ - g_return_val_if_fail(im != NULL, NULL); - - return im->icon; -} - -void -purple_conv_im_set_typing_state(PurpleConvIm *im, PurpleTypingState state) -{ - g_return_if_fail(im != NULL); - - if (im->typing_state != state) - { - im->typing_state = state; - - switch (state) - { - case PURPLE_TYPING: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing", im->conv->account, im->conv->name); - break; - case PURPLE_TYPED: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typed", im->conv->account, im->conv->name); - break; - case PURPLE_NOT_TYPING: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", im->conv->account, im->conv->name); - break; - } - - purple_conv_im_update_typing(im); - } -} - -PurpleTypingState -purple_conv_im_get_typing_state(const PurpleConvIm *im) -{ - g_return_val_if_fail(im != NULL, 0); - - return im->typing_state; -} - -void -purple_conv_im_start_typing_timeout(PurpleConvIm *im, int timeout) -{ - PurpleConversation *conv; - const char *name; - - g_return_if_fail(im != NULL); - - if (im->typing_timeout > 0) - purple_conv_im_stop_typing_timeout(im); - - conv = purple_conv_im_get_conversation(im); - name = purple_conversation_get_name(conv); - - im->typing_timeout = purple_timeout_add_seconds(timeout, reset_typing_cb, conv); -} - -void -purple_conv_im_stop_typing_timeout(PurpleConvIm *im) -{ - g_return_if_fail(im != NULL); - - if (im->typing_timeout == 0) - return; - - purple_timeout_remove(im->typing_timeout); - im->typing_timeout = 0; -} - -guint -purple_conv_im_get_typing_timeout(const PurpleConvIm *im) -{ - g_return_val_if_fail(im != NULL, 0); - - return im->typing_timeout; -} - -void -purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val) -{ - g_return_if_fail(im != NULL); - - if (val == 0) - im->type_again = 0; - else - im->type_again = time(NULL) + val; -} - -time_t -purple_conv_im_get_type_again(const PurpleConvIm *im) -{ - g_return_val_if_fail(im != NULL, 0); - - return im->type_again; -} - -void -purple_conv_im_start_send_typed_timeout(PurpleConvIm *im) -{ - g_return_if_fail(im != NULL); - - im->send_typed_timeout = purple_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS, - send_typed_cb, - purple_conv_im_get_conversation(im)); -} - -void -purple_conv_im_stop_send_typed_timeout(PurpleConvIm *im) -{ - g_return_if_fail(im != NULL); - - if (im->send_typed_timeout == 0) - return; - - purple_timeout_remove(im->send_typed_timeout); - im->send_typed_timeout = 0; -} - -guint -purple_conv_im_get_send_typed_timeout(const PurpleConvIm *im) -{ - g_return_val_if_fail(im != NULL, 0); - - return im->send_typed_timeout; -} - -void -purple_conv_im_update_typing(PurpleConvIm *im) -{ - g_return_if_fail(im != NULL); - - purple_conversation_update(purple_conv_im_get_conversation(im), - PURPLE_CONV_UPDATE_TYPING); -} - -void -purple_conv_im_write(PurpleConvIm *im, const char *who, const char *message, - PurpleMessageFlags flags, time_t mtime) -{ - PurpleConversation *c; - - g_return_if_fail(im != NULL); - g_return_if_fail(message != NULL); - - c = purple_conv_im_get_conversation(im); - - /* Pass this on to either the ops structure or the default write func. */ - if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) - c->ui_ops->write_im(c, who, message, flags, mtime); - else - purple_conversation_write(c, who, message, flags, mtime); -} - -gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what) -{ - PurpleConversation *conv; - - g_return_val_if_fail(who != NULL, FALSE); - g_return_val_if_fail(account !=NULL, FALSE); - g_return_val_if_fail(what != NULL, FALSE); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, what, PURPLE_MESSAGE_ERROR, time(NULL)); - else - return FALSE; - - return TRUE; -} - -void -purple_conv_im_send(PurpleConvIm *im, const char *message) -{ - purple_conv_im_send_with_flags(im, message, 0); -} - -static void -purple_conv_send_confirm_cb(gpointer *data) -{ - PurpleConversation *conv = data[0]; - char *message = data[1]; - - g_free(data); - common_send(conv, message, 0); -} - -void -purple_conv_send_confirm(PurpleConversation *conv, const char *message) -{ - char *text; - gpointer *data; - - g_return_if_fail(conv != NULL); - g_return_if_fail(message != NULL); - - if (conv->ui_ops != NULL && conv->ui_ops->send_confirm != NULL) - { - conv->ui_ops->send_confirm(conv, message); - return; - } - - text = g_strdup_printf("You are about to send the following message:\n%s", message); - data = g_new0(gpointer, 2); - data[0] = conv; - data[1] = (gpointer)message; - - purple_request_action(conv, NULL, _("Send Message"), text, 0, - purple_conversation_get_account(conv), NULL, conv, - data, 2, - _("_Send Message"), G_CALLBACK(purple_conv_send_confirm_cb), - _("Cancel"), NULL); -} - -void -purple_conv_im_send_with_flags(PurpleConvIm *im, const char *message, PurpleMessageFlags flags) -{ - g_return_if_fail(im != NULL); - g_return_if_fail(message != NULL); - - common_send(purple_conv_im_get_conversation(im), message, flags); -} - -gboolean -purple_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, - const char *cksum_type, const char *chksum, - gboolean remote) -{ - if (conv == NULL || smile == NULL || !*smile) { - return FALSE; - } - - /* TODO: check if the icon is in the cache and return false if so */ - /* TODO: add an icon cache (that doesn't suck) */ - if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_add !=NULL) { - return conv->ui_ops->custom_smiley_add(conv, smile, remote); - } else { - purple_debug_info("conversation", "Could not find add custom smiley function"); - return FALSE; - } - -} - -void -purple_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, - const guchar *data, gsize size) -{ - g_return_if_fail(conv != NULL); - g_return_if_fail(smile != NULL && *smile); - - if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_write != NULL) - conv->ui_ops->custom_smiley_write(conv, smile, data, size); - else - purple_debug_info("conversation", "Could not find the smiley write function"); -} - -void -purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) -{ - g_return_if_fail(conv != NULL); - g_return_if_fail(smile != NULL && *smile); - - if (conv->ui_ops != NULL && conv->ui_ops->custom_smiley_close != NULL) - conv->ui_ops->custom_smiley_close(conv, smile); - else - purple_debug_info("conversation", "Could not find custom smiley close function"); -} - - -/************************************************************************** - * Chat Conversation API - **************************************************************************/ - -PurpleConversation * -purple_conv_chat_get_conversation(const PurpleConvChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return chat->conv; -} - -GList * -purple_conv_chat_set_users(PurpleConvChat *chat, GList *users) -{ - g_return_val_if_fail(chat != NULL, NULL); - - chat->in_room = users; - - return users; -} - -GList * -purple_conv_chat_get_users(const PurpleConvChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return chat->in_room; -} - -void -purple_conv_chat_ignore(PurpleConvChat *chat, const char *name) -{ - g_return_if_fail(chat != NULL); - g_return_if_fail(name != NULL); - - /* Make sure the user isn't already ignored. */ - if (purple_conv_chat_is_user_ignored(chat, name)) - return; - - purple_conv_chat_set_ignored(chat, - g_list_append(chat->ignored, g_strdup(name))); -} - -void -purple_conv_chat_unignore(PurpleConvChat *chat, const char *name) -{ - GList *item; - - g_return_if_fail(chat != NULL); - g_return_if_fail(name != NULL); - - /* Make sure the user is actually ignored. */ - if (!purple_conv_chat_is_user_ignored(chat, name)) - return; - - item = g_list_find(purple_conv_chat_get_ignored(chat), - purple_conv_chat_get_ignored_user(chat, name)); - - purple_conv_chat_set_ignored(chat, - g_list_remove_link(chat->ignored, item)); - - g_free(item->data); - g_list_free_1(item); -} - -GList * -purple_conv_chat_set_ignored(PurpleConvChat *chat, GList *ignored) -{ - g_return_val_if_fail(chat != NULL, NULL); - - chat->ignored = ignored; - - return ignored; -} - -GList * -purple_conv_chat_get_ignored(const PurpleConvChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return chat->ignored; -} - -const char * -purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, const char *user) -{ - GList *ignored; - - g_return_val_if_fail(chat != NULL, NULL); - g_return_val_if_fail(user != NULL, NULL); - - for (ignored = purple_conv_chat_get_ignored(chat); - ignored != NULL; - ignored = ignored->next) { - - const char *ign = (const char *)ignored->data; - - if (!purple_utf8_strcasecmp(user, ign) || - ((*ign == '+' || *ign == '%') && !purple_utf8_strcasecmp(user, ign + 1))) - return ign; - - if (*ign == '@') { - ign++; - - if ((*ign == '+' && !purple_utf8_strcasecmp(user, ign + 1)) || - (*ign != '+' && !purple_utf8_strcasecmp(user, ign))) - return ign; - } - } - - return NULL; -} - -gboolean -purple_conv_chat_is_user_ignored(const PurpleConvChat *chat, const char *user) -{ - g_return_val_if_fail(chat != NULL, FALSE); - g_return_val_if_fail(user != NULL, FALSE); - - return (purple_conv_chat_get_ignored_user(chat, user) != NULL); -} - -void -purple_conv_chat_set_topic(PurpleConvChat *chat, const char *who, const char *topic) -{ - g_return_if_fail(chat != NULL); - - g_free(chat->who); - g_free(chat->topic); - - chat->who = g_strdup(who); - chat->topic = g_strdup(topic); - - purple_conversation_update(purple_conv_chat_get_conversation(chat), - PURPLE_CONV_UPDATE_TOPIC); - - purple_signal_emit(purple_conversations_get_handle(), "chat-topic-changed", - chat->conv, chat->who, chat->topic); -} - -const char * -purple_conv_chat_get_topic(const PurpleConvChat *chat) -{ - g_return_val_if_fail(chat != NULL, NULL); - - return chat->topic; -} - -void -purple_conv_chat_set_id(PurpleConvChat *chat, int id) -{ - g_return_if_fail(chat != NULL); - - chat->id = id; -} - -int -purple_conv_chat_get_id(const PurpleConvChat *chat) -{ - g_return_val_if_fail(chat != NULL, -1); - - return chat->id; -} - -void -purple_conv_chat_write(PurpleConvChat *chat, const char *who, const char *message, - PurpleMessageFlags flags, time_t mtime) -{ - PurpleAccount *account; - PurpleConversation *conv; - PurpleConnection *gc; - PurplePluginProtocolInfo *prpl_info; - - g_return_if_fail(chat != NULL); - g_return_if_fail(who != NULL); - g_return_if_fail(message != NULL); - - conv = purple_conv_chat_get_conversation(chat); - gc = purple_conversation_get_gc(conv); - account = purple_connection_get_account(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - - /* Don't display this if the person who wrote it is ignored. */ - if (purple_conv_chat_is_user_ignored(chat, who)) - return; - - if (!(flags & PURPLE_MESSAGE_WHISPER)) { - const char *str; - - str = purple_normalize(account, who); - - if (purple_strequal(str, chat->nick)) { - flags |= PURPLE_MESSAGE_SEND; - } else { - flags |= PURPLE_MESSAGE_RECV; - - if (purple_utf8_has_word(message, chat->nick)) - flags |= PURPLE_MESSAGE_NICK; - } - } - - /* Pass this on to either the ops structure or the default write func. */ - if (conv->ui_ops != NULL && conv->ui_ops->write_chat != NULL) - conv->ui_ops->write_chat(conv, who, message, flags, mtime); - else - purple_conversation_write(conv, who, message, flags, mtime); -} - -void -purple_conv_chat_send(PurpleConvChat *chat, const char *message) -{ - purple_conv_chat_send_with_flags(chat, message, 0); -} - -void -purple_conv_chat_send_with_flags(PurpleConvChat *chat, const char *message, PurpleMessageFlags flags) -{ - g_return_if_fail(chat != NULL); - g_return_if_fail(message != NULL); - - common_send(purple_conv_chat_get_conversation(chat), message, flags); -} - -void -purple_conv_chat_add_user(PurpleConvChat *chat, const char *user, - const char *extra_msg, PurpleConvChatBuddyFlags flags, - gboolean new_arrival) -{ - GList *users = g_list_append(NULL, (char *)user); - GList *extra_msgs = g_list_append(NULL, (char *)extra_msg); - GList *flags2 = g_list_append(NULL, GINT_TO_POINTER(flags)); - - purple_conv_chat_add_users(chat, users, extra_msgs, flags2, new_arrival); - - g_list_free(users); - g_list_free(extra_msgs); - g_list_free(flags2); -} - -static int -purple_conv_chat_cb_compare(PurpleConvChatBuddy *a, PurpleConvChatBuddy *b) -{ - PurpleConvChatBuddyFlags f1 = 0, f2 = 0; - char *user1 = NULL, *user2 = NULL; - gint ret = 0; - - if (a) { - f1 = a->flags; - if (a->alias_key) - user1 = a->alias_key; - else if (a->name) - user1 = a->name; - } - - if (b) { - f2 = b->flags; - if (b->alias_key) - user2 = b->alias_key; - else if (b->name) - user2 = b->name; - } - - if (user1 == NULL || user2 == NULL) { - if (!(user1 == NULL && user2 == NULL)) - ret = (user1 == NULL) ? -1: 1; - } else if (f1 != f2) { - /* sort more important users first */ - ret = (f1 > f2) ? -1 : 1; - } else if (a->buddy != b->buddy) { - ret = a->buddy ? -1 : 1; - } else { - ret = purple_utf8_strcasecmp(user1, user2); - } - - return ret; -} - -void -purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs, - GList *flags, gboolean new_arrivals) -{ - PurpleConversation *conv; - PurpleConversationUiOps *ops; - PurpleConvChatBuddy *cbuddy; - PurpleConnection *gc; - PurplePluginProtocolInfo *prpl_info; - GList *ul, *fl; - GList *cbuddies = NULL; - - g_return_if_fail(chat != NULL); - g_return_if_fail(users != NULL); - - conv = purple_conv_chat_get_conversation(chat); - ops = purple_conversation_get_ui_ops(conv); - - gc = purple_conversation_get_gc(conv); - g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - g_return_if_fail(prpl_info != NULL); - - ul = users; - fl = flags; - while ((ul != NULL) && (fl != NULL)) { - const char *user = (const char *)ul->data; - const char *alias = user; - gboolean quiet; - PurpleConvChatBuddyFlags flag = GPOINTER_TO_INT(fl->data); - const char *extra_msg = (extra_msgs ? extra_msgs->data : NULL); - - if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - if (purple_strequal(chat->nick, purple_normalize(conv->account, user))) { - const char *alias2 = purple_account_get_alias(conv->account); - if (alias2 != NULL) - alias = alias2; - else - { - const char *display_name = purple_connection_get_display_name(gc); - if (display_name != NULL) - alias = display_name; - } - } else { - PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, user)) != NULL) - alias = purple_buddy_get_contact_alias(buddy); - } - } - - quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), - "chat-buddy-joining", conv, user, flag)) || - purple_conv_chat_is_user_ignored(chat, user); - - cbuddy = purple_conv_chat_cb_new(user, alias, flag); - cbuddy->buddy = purple_find_buddy(conv->account, user) != NULL; - /* This seems dumb. Why should we set users thousands of times? */ - purple_conv_chat_set_users(chat, - g_list_prepend(chat->in_room, cbuddy)); - - cbuddies = g_list_prepend(cbuddies, cbuddy); - - if (!quiet && new_arrivals) { - char *alias_esc = g_markup_escape_text(alias, -1); - char *tmp; - - if (extra_msg == NULL) - tmp = g_strdup_printf(_("%s entered the room."), alias_esc); - else { - char *extra_msg_esc = g_markup_escape_text(extra_msg, -1); - tmp = g_strdup_printf(_("%s [%s] entered the room."), - alias_esc, extra_msg_esc); - g_free(extra_msg_esc); - } - g_free(alias_esc); - - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, - time(NULL)); - g_free(tmp); - } - - purple_signal_emit(purple_conversations_get_handle(), - "chat-buddy-joined", conv, user, flag, new_arrivals); - ul = ul->next; - fl = fl->next; - if (extra_msgs != NULL) - extra_msgs = extra_msgs->next; - } - - cbuddies = g_list_sort(cbuddies, (GCompareFunc)purple_conv_chat_cb_compare); - - if (ops != NULL && ops->chat_add_users != NULL) - ops->chat_add_users(conv, cbuddies, new_arrivals); - - g_list_free(cbuddies); -} - -void -purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, - const char *new_user) -{ - PurpleConversation *conv; - PurpleConversationUiOps *ops; - PurpleConnection *gc; - PurplePluginProtocolInfo *prpl_info; - PurpleConvChatBuddy *cb; - PurpleConvChatBuddyFlags flags; - const char *new_alias = new_user; - char tmp[BUF_LONG]; - gboolean is_me = FALSE; - - g_return_if_fail(chat != NULL); - g_return_if_fail(old_user != NULL); - g_return_if_fail(new_user != NULL); - - conv = purple_conv_chat_get_conversation(chat); - ops = purple_conversation_get_ui_ops(conv); - - gc = purple_conversation_get_gc(conv); - g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - g_return_if_fail(prpl_info != NULL); - - if (purple_strequal(chat->nick, purple_normalize(conv->account, old_user))) { - const char *alias; - - /* Note this for later. */ - is_me = TRUE; - - if(!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - alias = purple_account_get_alias(conv->account); - if (alias != NULL) - new_alias = alias; - else - { - const char *display_name = purple_connection_get_display_name(gc); - if (display_name != NULL) - alias = display_name; - } - } - } else if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - PurpleBuddy *buddy; - if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) - new_alias = purple_buddy_get_contact_alias(buddy); - } - - flags = purple_conv_chat_user_get_flags(chat, old_user); - cb = purple_conv_chat_cb_new(new_user, new_alias, flags); - cb->buddy = purple_find_buddy(conv->account, new_user) != NULL; - purple_conv_chat_set_users(chat, - g_list_prepend(chat->in_room, cb)); - - if (ops != NULL && ops->chat_rename_user != NULL) - ops->chat_rename_user(conv, old_user, new_user, new_alias); - - cb = purple_conv_chat_cb_find(chat, old_user); - - if (cb) { - purple_conv_chat_set_users(chat, - g_list_remove(chat->in_room, cb)); - purple_conv_chat_cb_destroy(cb); - } - - if (purple_conv_chat_is_user_ignored(chat, old_user)) { - purple_conv_chat_unignore(chat, old_user); - purple_conv_chat_ignore(chat, new_user); - } - else if (purple_conv_chat_is_user_ignored(chat, new_user)) - purple_conv_chat_unignore(chat, new_user); - - if (is_me) - purple_conv_chat_set_nick(chat, new_user); - - if (purple_prefs_get_bool("/purple/conversations/chat/show_nick_change") && - !purple_conv_chat_is_user_ignored(chat, new_user)) { - - if (is_me) { - char *escaped = g_markup_escape_text(new_user, -1); - g_snprintf(tmp, sizeof(tmp), - _("You are now known as %s"), escaped); - g_free(escaped); - } else { - const char *old_alias = old_user; - const char *new_alias = new_user; - char *escaped; - char *escaped2; - - if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - PurpleBuddy *buddy; - - if ((buddy = purple_find_buddy(gc->account, old_user)) != NULL) - old_alias = purple_buddy_get_contact_alias(buddy); - if ((buddy = purple_find_buddy(gc->account, new_user)) != NULL) - new_alias = purple_buddy_get_contact_alias(buddy); - } - - escaped = g_markup_escape_text(old_alias, -1); - escaped2 = g_markup_escape_text(new_alias, -1); - g_snprintf(tmp, sizeof(tmp), - _("%s is now known as %s"), escaped, escaped2); - g_free(escaped); - g_free(escaped2); - } - - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, - time(NULL)); - } -} - -void -purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, const char *reason) -{ - GList *users = g_list_append(NULL, (char *)user); - - purple_conv_chat_remove_users(chat, users, reason); - - g_list_free(users); -} - -void -purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, const char *reason) -{ - PurpleConversation *conv; - PurpleConnection *gc; - PurplePluginProtocolInfo *prpl_info; - PurpleConversationUiOps *ops; - PurpleConvChatBuddy *cb; - GList *l; - gboolean quiet; - - g_return_if_fail(chat != NULL); - g_return_if_fail(users != NULL); - - conv = purple_conv_chat_get_conversation(chat); - - gc = purple_conversation_get_gc(conv); - g_return_if_fail(gc != NULL); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); - g_return_if_fail(prpl_info != NULL); - - ops = purple_conversation_get_ui_ops(conv); - - for (l = users; l != NULL; l = l->next) { - const char *user = (const char *)l->data; - quiet = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_conversations_get_handle(), - "chat-buddy-leaving", conv, user, reason)) | - purple_conv_chat_is_user_ignored(chat, user); - - cb = purple_conv_chat_cb_find(chat, user); - - if (cb) { - purple_conv_chat_set_users(chat, - g_list_remove(chat->in_room, cb)); - purple_conv_chat_cb_destroy(cb); - } - - /* NOTE: Don't remove them from ignored in case they re-enter. */ - - if (!quiet) { - const char *alias = user; - char *alias_esc; - char *tmp; - - if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { - PurpleBuddy *buddy; - - if ((buddy = purple_find_buddy(gc->account, user)) != NULL) - alias = purple_buddy_get_contact_alias(buddy); - } - - alias_esc = g_markup_escape_text(alias, -1); - - if (reason == NULL || !*reason) - tmp = g_strdup_printf(_("%s left the room."), alias_esc); - else { - char *reason_esc = g_markup_escape_text(reason, -1); - tmp = g_strdup_printf(_("%s left the room (%s)."), - alias_esc, reason_esc); - g_free(reason_esc); - } - g_free(alias_esc); - - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, - time(NULL)); - g_free(tmp); - } - - purple_signal_emit(purple_conversations_get_handle(), "chat-buddy-left", - conv, user, reason); - } - - if (ops != NULL && ops->chat_remove_users != NULL) - ops->chat_remove_users(conv, users); -} - -void -purple_conv_chat_clear_users(PurpleConvChat *chat) -{ - PurpleConversation *conv; - PurpleConversationUiOps *ops; - GList *users; - GList *l; - GList *names = NULL; - - g_return_if_fail(chat != NULL); - - conv = purple_conv_chat_get_conversation(chat); - ops = purple_conversation_get_ui_ops(conv); - users = chat->in_room; - - if (ops != NULL && ops->chat_remove_users != NULL) { - for (l = users; l; l = l->next) { - PurpleConvChatBuddy *cb = l->data; - names = g_list_prepend(names, cb->name); - } - ops->chat_remove_users(conv, names); - g_list_free(names); - } - - for (l = users; l; l = l->next) - { - PurpleConvChatBuddy *cb = l->data; - - purple_signal_emit(purple_conversations_get_handle(), - "chat-buddy-leaving", conv, cb->name, NULL); - purple_signal_emit(purple_conversations_get_handle(), - "chat-buddy-left", conv, cb->name, NULL); - - purple_conv_chat_cb_destroy(cb); - } - - g_list_free(users); - purple_conv_chat_set_users(chat, NULL); -} - - -gboolean -purple_conv_chat_find_user(PurpleConvChat *chat, const char *user) -{ - g_return_val_if_fail(chat != NULL, FALSE); - g_return_val_if_fail(user != NULL, FALSE); - - return (purple_conv_chat_cb_find(chat, user) != NULL); -} - -void -purple_conv_chat_user_set_flags(PurpleConvChat *chat, const char *user, - PurpleConvChatBuddyFlags flags) -{ - PurpleConversation *conv; - PurpleConversationUiOps *ops; - PurpleConvChatBuddy *cb; - PurpleConvChatBuddyFlags oldflags; - - g_return_if_fail(chat != NULL); - g_return_if_fail(user != NULL); - - cb = purple_conv_chat_cb_find(chat, user); - - if (!cb) - return; - - if (flags == cb->flags) - return; - - oldflags = cb->flags; - cb->flags = flags; - - conv = purple_conv_chat_get_conversation(chat); - ops = purple_conversation_get_ui_ops(conv); - - if (ops != NULL && ops->chat_update_user != NULL) - ops->chat_update_user(conv, user); - - purple_signal_emit(purple_conversations_get_handle(), - "chat-buddy-flags", conv, user, oldflags, flags); -} - -PurpleConvChatBuddyFlags -purple_conv_chat_user_get_flags(PurpleConvChat *chat, const char *user) -{ - PurpleConvChatBuddy *cb; - - g_return_val_if_fail(chat != NULL, 0); - g_return_val_if_fail(user != NULL, 0); - - cb = purple_conv_chat_cb_find(chat, user); - - if (!cb) - return PURPLE_CBFLAGS_NONE; - - return cb->flags; -} - -void purple_conv_chat_set_nick(PurpleConvChat *chat, const char *nick) { - g_return_if_fail(chat != NULL); - - g_free(chat->nick); - chat->nick = g_strdup(purple_normalize(chat->conv->account, nick)); -} - -const char *purple_conv_chat_get_nick(PurpleConvChat *chat) { - g_return_val_if_fail(chat != NULL, NULL); - - return chat->nick; -} - -PurpleConversation * -purple_find_chat(const PurpleConnection *gc, int id) -{ - GList *l; - PurpleConversation *conv; - - for (l = purple_get_chats(); l != NULL; l = l->next) { - conv = (PurpleConversation *)l->data; - - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)) == id && - purple_conversation_get_gc(conv) == gc) - return conv; - } - - return NULL; -} - -void -purple_conv_chat_left(PurpleConvChat *chat) -{ - g_return_if_fail(chat != NULL); - - chat->left = TRUE; - purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_CHATLEFT); -} - -static void -invite_user_to_chat(gpointer data, PurpleRequestFields *fields) -{ - PurpleConversation *conv; - PurpleConvChat *chat; - const char *user, *message; - - conv = data; - chat = PURPLE_CONV_CHAT(conv); - user = purple_request_fields_get_string(fields, "screenname"); - message = purple_request_fields_get_string(fields, "message"); - - serv_chat_invite(purple_conversation_get_gc(conv), chat->id, message, user); -} - -void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, - const char *message, gboolean confirm) -{ - PurpleAccount *account; - PurpleConversation *conv; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - g_return_if_fail(chat); - - if (!user || !*user || !message || !*message) - confirm = TRUE; - - conv = chat->conv; - account = conv->account; - - if (!confirm) { - serv_chat_invite(purple_account_get_connection(account), - purple_conv_chat_get_id(chat), message, user); - return; - } - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(_("Invite to chat")); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("screenname", _("Buddy"), user, FALSE); - purple_request_field_group_add_field(group, field); - purple_request_field_set_required(field, TRUE); - purple_request_field_set_type_hint(field, "screenname"); - - field = purple_request_field_string_new("message", _("Message"), message, FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(conv, _("Invite to chat"), NULL, - _("Please enter the name of the user you wish to invite, " - "along with an optional invite message."), - fields, - _("Invite"), G_CALLBACK(invite_user_to_chat), - _("Cancel"), NULL, - account, user, conv, - conv); -} - -gboolean -purple_conv_chat_has_left(PurpleConvChat *chat) -{ - g_return_val_if_fail(chat != NULL, TRUE); - - return chat->left; -} - -PurpleConvChatBuddy * -purple_conv_chat_cb_new(const char *name, const char *alias, PurpleConvChatBuddyFlags flags) -{ - PurpleConvChatBuddy *cb; - - g_return_val_if_fail(name != NULL, NULL); - - cb = g_new0(PurpleConvChatBuddy, 1); - cb->name = g_strdup(name); - cb->flags = flags; - cb->alias = g_strdup(alias); - - PURPLE_DBUS_REGISTER_POINTER(cb, PurpleConvChatBuddy); - return cb; -} - -PurpleConvChatBuddy * -purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name) -{ - GList *l; - PurpleConvChatBuddy *cb = NULL; - - g_return_val_if_fail(chat != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - for (l = purple_conv_chat_get_users(chat); l; l = l->next) { - cb = l->data; - if (!g_utf8_collate(cb->name, name)) - return cb; - } - - return NULL; -} - -void -purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb) -{ - if (cb == NULL) - return; - - g_free(cb->alias); - g_free(cb->alias_key); - g_free(cb->name); - - PURPLE_DBUS_UNREGISTER_POINTER(cb); - g_free(cb); -} - -const char * -purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb) -{ - g_return_val_if_fail(cb != NULL, NULL); - - return cb->name; -} - -GList * -purple_conversation_get_extended_menu(PurpleConversation *conv) -{ - GList *menu = NULL; - - g_return_val_if_fail(conv != NULL, NULL); - - purple_signal_emit(purple_conversations_get_handle(), - "conversation-extended-menu", conv, &menu); - return menu; -} - -void purple_conversation_clear_message_history(PurpleConversation *conv) -{ - GList *list = conv->message_history; - message_history_free(list); - conv->message_history = NULL; -} - -GList *purple_conversation_get_message_history(PurpleConversation *conv) -{ - return conv->message_history; -} - -const char *purple_conversation_message_get_sender(PurpleConvMessage *msg) -{ - g_return_val_if_fail(msg, NULL); - return msg->who; -} - -const char *purple_conversation_message_get_message(PurpleConvMessage *msg) -{ - g_return_val_if_fail(msg, NULL); - return msg->what; -} - -PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg) -{ - g_return_val_if_fail(msg, 0); - return msg->flags; -} - -time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg) -{ - g_return_val_if_fail(msg, 0); - return msg->when; -} - -gboolean -purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, - const gchar *markup, gchar **error) -{ - char *mark = (markup && *markup) ? NULL : g_markup_escape_text(cmdline, -1), *err = NULL; - PurpleCmdStatus status = purple_cmd_do_command(conv, cmdline, mark ? mark : markup, error ? error : &err); - g_free(mark); - g_free(err); - return (status == PURPLE_CMD_STATUS_OK); -} - -void * -purple_conversations_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_conversations_init(void) -{ - void *handle = purple_conversations_get_handle(); - - conversation_cache = g_hash_table_new_full((GHashFunc)_purple_conversations_hconv_hash, - (GEqualFunc)_purple_conversations_hconv_equal, - (GDestroyNotify)_purple_conversations_hconv_free_key, NULL); - - /********************************************************************** - * Register preferences - **********************************************************************/ - - /* Conversations */ - purple_prefs_add_none("/purple/conversations"); - - /* Conversations -> Chat */ - purple_prefs_add_none("/purple/conversations/chat"); - purple_prefs_add_bool("/purple/conversations/chat/show_nick_change", TRUE); - - /* Conversations -> IM */ - purple_prefs_add_none("/purple/conversations/im"); - purple_prefs_add_bool("/purple/conversations/im/send_typing", TRUE); - - - /********************************************************************** - * Register signals - **********************************************************************/ - purple_signal_register(handle, "writing-im-msg", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "wrote-im-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, - NULL, 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "sending-im-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER, - NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "sent-im-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER, - NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "receiving-im-msg", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new_outgoing(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "received-im-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, - NULL, 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "blocked-im-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT, - NULL, 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_UINT), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "writing-chat-msg", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "wrote-chat-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, - NULL, 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "sending-chat-msg", - purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "sent-chat-msg", - purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "receiving-chat-msg", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new_outgoing(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new_outgoing(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "received-chat-msg", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, - NULL, 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "conversation-created", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION)); - - purple_signal_register(handle, "conversation-updated", - purple_marshal_VOID__POINTER_UINT, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "deleting-conversation", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION)); - - purple_signal_register(handle, "buddy-typing", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "buddy-typed", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "buddy-typing-stopped", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "chat-buddy-joining", - purple_marshal_BOOLEAN__POINTER_POINTER_UINT, - purple_value_new(PURPLE_TYPE_BOOLEAN), 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "chat-buddy-joined", - purple_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_UINT), - purple_value_new(PURPLE_TYPE_BOOLEAN)); - - purple_signal_register(handle, "chat-buddy-flags", - purple_marshal_VOID__POINTER_POINTER_UINT_UINT, NULL, 4, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_UINT), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "chat-buddy-leaving", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "chat-buddy-left", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "chat-inviting-user", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "chat-invited-user", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "chat-invited", - purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_INT), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_POINTER)); - - purple_signal_register(handle, "chat-invite-blocked", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER, - NULL, 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_BOXED, "GHashTable *")); - - purple_signal_register(handle, "chat-joined", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION)); - - purple_signal_register(handle, "chat-join-failed", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_POINTER)); - - purple_signal_register(handle, "chat-left", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION)); - - purple_signal_register(handle, "chat-topic-changed", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "conversation-extended-menu", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_CONVERSATION), - purple_value_new(PURPLE_TYPE_BOXED, "GList **")); -} - -void -purple_conversations_uninit(void) -{ - while (conversations) - purple_conversation_destroy((PurpleConversation*)conversations->data); - g_hash_table_destroy(conversation_cache); - purple_signals_unregister_by_instance(purple_conversations_get_handle()); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/conversation.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1423 +0,0 @@ -/** - * @file conversation.h Conversation API - * @ingroup core - * @see @ref conversation-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_CONVERSATION_H_ -#define _PURPLE_CONVERSATION_H_ - -/**************************************************************************/ -/** Data Structures */ -/**************************************************************************/ - - -/** @copydoc _PurpleConversationUiOps */ -typedef struct _PurpleConversationUiOps PurpleConversationUiOps; -/** @copydoc _PurpleConversation */ -typedef struct _PurpleConversation PurpleConversation; -/** @copydoc _PurpleConvIm */ -typedef struct _PurpleConvIm PurpleConvIm; -/** @copydoc _PurpleConvChat */ -typedef struct _PurpleConvChat PurpleConvChat; -/** @copydoc _PurpleConvChatBuddy */ -typedef struct _PurpleConvChatBuddy PurpleConvChatBuddy; -/** @copydoc _PurpleConvMessage */ -typedef struct _PurpleConvMessage PurpleConvMessage; - -/** - * A type of conversation. - */ -typedef enum -{ - PURPLE_CONV_TYPE_UNKNOWN = 0, /**< Unknown conversation type. */ - PURPLE_CONV_TYPE_IM, /**< Instant Message. */ - PURPLE_CONV_TYPE_CHAT, /**< Chat room. */ - PURPLE_CONV_TYPE_MISC, /**< A misc. conversation. */ - PURPLE_CONV_TYPE_ANY /**< Any type of conversation. */ - -} PurpleConversationType; - -/** - * Conversation update type. - */ -typedef enum -{ - PURPLE_CONV_UPDATE_ADD = 0, /**< The buddy associated with the conversation - was added. */ - PURPLE_CONV_UPDATE_REMOVE, /**< The buddy associated with the conversation - was removed. */ - PURPLE_CONV_UPDATE_ACCOUNT, /**< The purple_account was changed. */ - PURPLE_CONV_UPDATE_TYPING, /**< The typing state was updated. */ - PURPLE_CONV_UPDATE_UNSEEN, /**< The unseen state was updated. */ - PURPLE_CONV_UPDATE_LOGGING, /**< Logging for this conversation was - enabled or disabled. */ - PURPLE_CONV_UPDATE_TOPIC, /**< The topic for a chat was updated. */ - /* - * XXX These need to go when we implement a more generic core/UI event - * system. - */ - PURPLE_CONV_ACCOUNT_ONLINE, /**< One of the user's accounts went online. */ - PURPLE_CONV_ACCOUNT_OFFLINE, /**< One of the user's accounts went offline. */ - PURPLE_CONV_UPDATE_AWAY, /**< The other user went away. */ - PURPLE_CONV_UPDATE_ICON, /**< The other user's buddy icon changed. */ - PURPLE_CONV_UPDATE_TITLE, - PURPLE_CONV_UPDATE_CHATLEFT, - - PURPLE_CONV_UPDATE_FEATURES /**< The features for a chat have changed */ - -} PurpleConvUpdateType; - -/** - * The typing state of a user. - */ -typedef enum -{ - PURPLE_NOT_TYPING = 0, /**< Not typing. */ - PURPLE_TYPING, /**< Currently typing. */ - PURPLE_TYPED /**< Stopped typing momentarily. */ - -} PurpleTypingState; - -/** - * Flags applicable to a message. Most will have send, recv or system. - */ -typedef enum -{ - PURPLE_MESSAGE_SEND = 0x0001, /**< Outgoing message. */ - PURPLE_MESSAGE_RECV = 0x0002, /**< Incoming message. */ - PURPLE_MESSAGE_SYSTEM = 0x0004, /**< System message. */ - PURPLE_MESSAGE_AUTO_RESP = 0x0008, /**< Auto response. */ - PURPLE_MESSAGE_ACTIVE_ONLY = 0x0010, /**< Hint to the UI that this - message should not be - shown in conversations - which are only open for - internal UI purposes - (e.g. for contact-aware - conversations). */ - PURPLE_MESSAGE_NICK = 0x0020, /**< Contains your nick. */ - PURPLE_MESSAGE_NO_LOG = 0x0040, /**< Do not log. */ - PURPLE_MESSAGE_WHISPER = 0x0080, /**< Whispered message. */ - PURPLE_MESSAGE_ERROR = 0x0200, /**< Error message. */ - PURPLE_MESSAGE_DELAYED = 0x0400, /**< Delayed message. */ - PURPLE_MESSAGE_RAW = 0x0800, /**< "Raw" message - don't - apply formatting */ - PURPLE_MESSAGE_IMAGES = 0x1000, /**< Message contains images */ - PURPLE_MESSAGE_NOTIFY = 0x2000, /**< Message is a notification */ - PURPLE_MESSAGE_NO_LINKIFY = 0x4000, /**< Message should not be auto- - linkified @since 2.1.0 */ - PURPLE_MESSAGE_INVISIBLE = 0x8000 /**< Message should not be displayed */ -} PurpleMessageFlags; - -/** - * Flags applicable to users in Chats. - */ -typedef enum -{ - PURPLE_CBFLAGS_NONE = 0x0000, /**< No flags */ - PURPLE_CBFLAGS_VOICE = 0x0001, /**< Voiced user or "Participant" */ - PURPLE_CBFLAGS_HALFOP = 0x0002, /**< Half-op */ - PURPLE_CBFLAGS_OP = 0x0004, /**< Channel Op or Moderator */ - PURPLE_CBFLAGS_FOUNDER = 0x0008, /**< Channel Founder */ - PURPLE_CBFLAGS_TYPING = 0x0010 /**< Currently typing */ - -} PurpleConvChatBuddyFlags; - -#include "account.h" -#include "buddyicon.h" -#include "log.h" -#include "server.h" - -/** - * Conversation operations and events. - * - * Any UI representing a conversation must assign a filled-out - * PurpleConversationUiOps structure to the PurpleConversation. - */ -struct _PurpleConversationUiOps -{ - /** Called when @a conv is created (but before the @ref - * conversation-created signal is emitted). - */ - void (*create_conversation)(PurpleConversation *conv); - - /** Called just before @a conv is freed. */ - void (*destroy_conversation)(PurpleConversation *conv); - /** Write a message to a chat. If this field is @c NULL, libpurple will - * fall back to using #write_conv. - * @see purple_conv_chat_write() - */ - void (*write_chat)(PurpleConversation *conv, const char *who, - const char *message, PurpleMessageFlags flags, - time_t mtime); - /** Write a message to an IM conversation. If this field is @c NULL, - * libpurple will fall back to using #write_conv. - * @see purple_conv_im_write() - */ - void (*write_im)(PurpleConversation *conv, const char *who, - const char *message, PurpleMessageFlags flags, - time_t mtime); - /** Write a message to a conversation. This is used rather than the - * chat- or im-specific ops for errors, system messages (such as "x is - * now know as y"), and as the fallback if #write_im and #write_chat - * are not implemented. It should be implemented, or the UI will miss - * conversation error messages and your users will hate you. - * - * @see purple_conversation_write() - */ - void (*write_conv)(PurpleConversation *conv, - const char *name, - const char *alias, - const char *message, - PurpleMessageFlags flags, - time_t mtime); - - /** Add @a cbuddies to a chat. - * @param cbuddies A @c GList of #PurpleConvChatBuddy structs. - * @param new_arrivals Whether join notices should be shown. - * (Join notices are actually written to the - * conversation by #purple_conv_chat_add_users().) - */ - void (*chat_add_users)(PurpleConversation *conv, - GList *cbuddies, - gboolean new_arrivals); - /** Rename the user in this chat named @a old_name to @a new_name. (The - * rename message is written to the conversation by libpurple.) - * @param new_alias @a new_name's new alias, if they have one. - * @see purple_conv_chat_add_users() - */ - void (*chat_rename_user)(PurpleConversation *conv, const char *old_name, - const char *new_name, const char *new_alias); - /** Remove @a users from a chat. - * @param users A @c GList of const char *s. - * @see purple_conv_chat_rename_user() - */ - void (*chat_remove_users)(PurpleConversation *conv, GList *users); - /** Called when a user's flags are changed. - * @see purple_conv_chat_user_set_flags() - */ - void (*chat_update_user)(PurpleConversation *conv, const char *user); - - /** Present this conversation to the user; for example, by displaying - * the IM dialog. - */ - void (*present)(PurpleConversation *conv); - - /** If this UI has a concept of focus (as in a windowing system) and - * this conversation has the focus, return @c TRUE; otherwise, return - * @c FALSE. - */ - gboolean (*has_focus)(PurpleConversation *conv); - - /* Custom Smileys */ - gboolean (*custom_smiley_add)(PurpleConversation *conv, const char *smile, gboolean remote); - void (*custom_smiley_write)(PurpleConversation *conv, const char *smile, - const guchar *data, gsize size); - void (*custom_smiley_close)(PurpleConversation *conv, const char *smile); - - /** Prompt the user for confirmation to send @a message. This function - * should arrange for the message to be sent if the user accepts. If - * this field is @c NULL, libpurple will fall back to using - * #purple_request_action(). - */ - void (*send_confirm)(PurpleConversation *conv, const char *message); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** - * Data specific to Instant Messages. - */ -struct _PurpleConvIm -{ - PurpleConversation *conv; /**< The parent conversation. */ - - PurpleTypingState typing_state; /**< The current typing state. */ - guint typing_timeout; /**< The typing timer handle. */ - time_t type_again; /**< The type again time. */ - guint send_typed_timeout; /**< The type again timer handle. */ - - PurpleBuddyIcon *icon; /**< The buddy icon. */ -}; - -/** - * Data specific to Chats. - */ -struct _PurpleConvChat -{ - PurpleConversation *conv; /**< The parent conversation. */ - - GList *in_room; /**< The users in the room. */ - GList *ignored; /**< Ignored users. */ - char *who; /**< The person who set the topic. */ - char *topic; /**< The topic. */ - int id; /**< The chat ID. */ - char *nick; /**< Your nick in this chat. */ - - gboolean left; /**< We left the chat and kept the window open */ -}; - -/** - * Data for "Chat Buddies" - */ -struct _PurpleConvChatBuddy -{ - char *name; /**< The chat participant's name in the chat. */ - char *alias; /**< The chat participant's alias, if known; - * @a NULL otherwise. - */ - char *alias_key; /**< A string by which this buddy will be sorted, - * or @c NULL if the buddy should be sorted by - * its @c name. (This is currently always @c - * NULL.) - */ - gboolean buddy; /**< @a TRUE if this chat participant is on the - * buddy list; @a FALSE otherwise. - */ - PurpleConvChatBuddyFlags flags; /**< A bitwise OR of flags for this participant, - * such as whether they are a channel operator. - */ -}; - -/** - * Description of a conversation message - * - * @since 2.2.0 - */ -struct _PurpleConvMessage -{ - char *who; - char *what; - PurpleMessageFlags flags; - time_t when; - PurpleConversation *conv; /**< @since 2.3.0 */ - char *alias; /**< @since 2.3.0 */ -}; - -/** - * A core representation of a conversation between two or more people. - * - * The conversation can be an IM or a chat. - */ -struct _PurpleConversation -{ - PurpleConversationType type; /**< The type of conversation. */ - - PurpleAccount *account; /**< The user using this conversation. */ - - - char *name; /**< The name of the conversation. */ - char *title; /**< The window title. */ - - gboolean logging; /**< The status of logging. */ - - GList *logs; /**< This conversation's logs */ - - union - { - PurpleConvIm *im; /**< IM-specific data. */ - PurpleConvChat *chat; /**< Chat-specific data. */ - void *misc; /**< Misc. data. */ - - } u; - - PurpleConversationUiOps *ui_ops; /**< UI-specific operations. */ - void *ui_data; /**< UI-specific data. */ - - GHashTable *data; /**< Plugin-specific data. */ - - PurpleConnectionFlags features; /**< The supported features */ - GList *message_history; /**< Message history, as a GList of PurpleConvMessage's */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Conversation API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new conversation of the specified type. - * - * @param type The type of conversation. - * @param account The account opening the conversation window on the purple - * user's end. - * @param name The name of the conversation. - * - * @return The new conversation. - */ -PurpleConversation *purple_conversation_new(PurpleConversationType type, - PurpleAccount *account, - const char *name); - -/** - * Destroys the specified conversation and removes it from the parent - * window. - * - * If this conversation is the only one contained in the parent window, - * that window is also destroyed. - * - * @param conv The conversation to destroy. - */ -void purple_conversation_destroy(PurpleConversation *conv); - - -/** - * Present a conversation to the user. This allows core code to initiate a - * conversation by displaying the IM dialog. - * @param conv The conversation to present - */ -void purple_conversation_present(PurpleConversation *conv); - - -/** - * Returns the specified conversation's type. - * - * @param conv The conversation. - * - * @return The conversation's type. - */ -PurpleConversationType purple_conversation_get_type(const PurpleConversation *conv); - -/** - * Sets the specified conversation's UI operations structure. - * - * @param conv The conversation. - * @param ops The UI conversation operations structure. - */ -void purple_conversation_set_ui_ops(PurpleConversation *conv, - PurpleConversationUiOps *ops); - -/** - * Sets the default conversation UI operations structure. - * - * @param ops The UI conversation operations structure. - */ -void purple_conversations_set_ui_ops(PurpleConversationUiOps *ops); - -/** - * Returns the specified conversation's UI operations structure. - * - * @param conv The conversation. - * - * @return The operations structure. - */ -PurpleConversationUiOps *purple_conversation_get_ui_ops( - const PurpleConversation *conv); - -/** - * Sets the specified conversation's purple_account. - * - * This purple_account represents the user using purple, not the person the user - * is having a conversation/chat/flame with. - * - * @param conv The conversation. - * @param account The purple_account. - */ -void purple_conversation_set_account(PurpleConversation *conv, - PurpleAccount *account); - -/** - * Returns the specified conversation's purple_account. - * - * This purple_account represents the user using purple, not the person the user - * is having a conversation/chat/flame with. - * - * @param conv The conversation. - * - * @return The conversation's purple_account. - */ -PurpleAccount *purple_conversation_get_account(const PurpleConversation *conv); - -/** - * Returns the specified conversation's purple_connection. - * - * This is the same as purple_conversation_get_user(conv)->gc. - * - * @param conv The conversation. - * - * @return The conversation's purple_connection. - */ -PurpleConnection *purple_conversation_get_gc(const PurpleConversation *conv); - -/** - * Sets the specified conversation's title. - * - * @param conv The conversation. - * @param title The title. - */ -void purple_conversation_set_title(PurpleConversation *conv, const char *title); - -/** - * Returns the specified conversation's title. - * - * @param conv The conversation. - * - * @return The title. - */ -const char *purple_conversation_get_title(const PurpleConversation *conv); - -/** - * Automatically sets the specified conversation's title. - * - * This function takes OPT_IM_ALIAS_TAB into account, as well as the - * user's alias. - * - * @param conv The conversation. - */ -void purple_conversation_autoset_title(PurpleConversation *conv); - -/** - * Sets the specified conversation's name. - * - * @param conv The conversation. - * @param name The conversation's name. - */ -void purple_conversation_set_name(PurpleConversation *conv, const char *name); - -/** - * Returns the specified conversation's name. - * - * @param conv The conversation. - * - * @return The conversation's name. If the conversation is an IM with a PurpleBuddy, - * then it's the name of the PurpleBuddy. - */ -const char *purple_conversation_get_name(const PurpleConversation *conv); - -/** - * Enables or disables logging for this conversation. - * - * @param conv The conversation. - * @param log @c TRUE if logging should be enabled, or @c FALSE otherwise. - */ -void purple_conversation_set_logging(PurpleConversation *conv, gboolean log); - -/** - * Returns whether or not logging is enabled for this conversation. - * - * @param conv The conversation. - * - * @return @c TRUE if logging is enabled, or @c FALSE otherwise. - */ -gboolean purple_conversation_is_logging(const PurpleConversation *conv); - -/** - * Closes any open logs for this conversation. - * - * Note that new logs will be opened as necessary (e.g. upon receipt of a - * message, if the conversation has logging enabled. To disable logging for - * the remainder of the conversation, use purple_conversation_set_logging(). - * - * @param conv The conversation. - */ -void purple_conversation_close_logs(PurpleConversation *conv); - -/** - * Returns the specified conversation's IM-specific data. - * - * If the conversation type is not PURPLE_CONV_TYPE_IM, this will return @c NULL. - * - * @param conv The conversation. - * - * @return The IM-specific data. - */ -PurpleConvIm *purple_conversation_get_im_data(const PurpleConversation *conv); - -#define PURPLE_CONV_IM(c) (purple_conversation_get_im_data(c)) - -/** - * Returns the specified conversation's chat-specific data. - * - * If the conversation type is not PURPLE_CONV_TYPE_CHAT, this will return @c NULL. - * - * @param conv The conversation. - * - * @return The chat-specific data. - */ -PurpleConvChat *purple_conversation_get_chat_data(const PurpleConversation *conv); - -#define PURPLE_CONV_CHAT(c) (purple_conversation_get_chat_data(c)) - -/** - * Sets extra data for a conversation. - * - * @param conv The conversation. - * @param key The unique key. - * @param data The data to assign. - */ -void purple_conversation_set_data(PurpleConversation *conv, const char *key, - gpointer data); - -/** - * Returns extra data in a conversation. - * - * @param conv The conversation. - * @param key The unqiue key. - * - * @return The data associated with the key. - */ -gpointer purple_conversation_get_data(PurpleConversation *conv, const char *key); - -/** - * Returns a list of all conversations. - * - * This list includes both IMs and chats. - * - * @constreturn A GList of all conversations. - */ -GList *purple_get_conversations(void); - -/** - * Returns a list of all IMs. - * - * @constreturn A GList of all IMs. - */ -GList *purple_get_ims(void); - -/** - * Returns a list of all chats. - * - * @constreturn A GList of all chats. - */ -GList *purple_get_chats(void); - -/** - * Finds a conversation with the specified type, name, and Purple account. - * - * @param type The type of the conversation. - * @param name The name of the conversation. - * @param account The purple_account associated with the conversation. - * - * @return The conversation if found, or @c NULL otherwise. - */ -PurpleConversation *purple_find_conversation_with_account( - PurpleConversationType type, const char *name, - const PurpleAccount *account); - -/** - * Writes to a conversation window. - * - * This function should not be used to write IM or chat messages. Use - * purple_conv_im_write() and purple_conv_chat_write() instead. Those functions will - * most likely call this anyway, but they may do their own formatting, - * sound playback, etc. - * - * This can be used to write generic messages, such as "so and so closed - * the conversation window." - * - * @param conv The conversation. - * @param who The user who sent the message. - * @param message The message. - * @param flags The message flags. - * @param mtime The time the message was sent. - * - * @see purple_conv_im_write() - * @see purple_conv_chat_write() - */ -void purple_conversation_write(PurpleConversation *conv, const char *who, - const char *message, PurpleMessageFlags flags, - time_t mtime); - - -/** - Set the features as supported for the given conversation. - @param conv The conversation - @param features Bitset defining supported features -*/ -void purple_conversation_set_features(PurpleConversation *conv, - PurpleConnectionFlags features); - - -/** - Get the features supported by the given conversation. - @param conv The conversation -*/ -PurpleConnectionFlags purple_conversation_get_features(PurpleConversation *conv); - -/** - * Determines if a conversation has focus - * - * @param conv The conversation. - * - * @return @c TRUE if the conversation has focus, @c FALSE if - * it does not or the UI does not have a concept of conversation focus - */ -gboolean purple_conversation_has_focus(PurpleConversation *conv); - -/** - * Updates the visual status and UI of a conversation. - * - * @param conv The conversation. - * @param type The update type. - */ -void purple_conversation_update(PurpleConversation *conv, PurpleConvUpdateType type); - -/** - * Calls a function on each conversation. - * - * @param func The function. - */ -void purple_conversation_foreach(void (*func)(PurpleConversation *conv)); - -/** - * Retrieve the message history of a conversation. - * - * @param conv The conversation - * - * @return A GList of PurpleConvMessage's. The must not modify the list or the data within. - * The list contains the newest message at the beginning, and the oldest message at - * the end. - * - * @since 2.2.0 - */ -GList *purple_conversation_get_message_history(PurpleConversation *conv); - -/** - * Clear the message history of a conversation. - * - * @param conv The conversation - * - * @since 2.2.0 - */ -void purple_conversation_clear_message_history(PurpleConversation *conv); - -/** - * Get the sender from a PurpleConvMessage - * - * @param msg A PurpleConvMessage - * - * @return The name of the sender of the message - * - * @since 2.2.0 - */ -const char *purple_conversation_message_get_sender(PurpleConvMessage *msg); - -/** - * Get the message from a PurpleConvMessage - * - * @param msg A PurpleConvMessage - * - * @return The name of the sender of the message - * - * @since 2.2.0 - */ -const char *purple_conversation_message_get_message(PurpleConvMessage *msg); - -/** - * Get the message-flags of a PurpleConvMessage - * - * @param msg A PurpleConvMessage - * - * @return The message flags - * - * @since 2.2.0 - */ -PurpleMessageFlags purple_conversation_message_get_flags(PurpleConvMessage *msg); - -/** - * Get the timestamp of a PurpleConvMessage - * - * @param msg A PurpleConvMessage - * - * @return The timestamp of the message - * - * @since 2.2.0 - */ -time_t purple_conversation_message_get_timestamp(PurpleConvMessage *msg); - -/*@}*/ - - -/**************************************************************************/ -/** @name IM Conversation API */ -/**************************************************************************/ -/*@{*/ - -/** - * Gets an IM's parent conversation. - * - * @param im The IM. - * - * @return The parent conversation. - */ -PurpleConversation *purple_conv_im_get_conversation(const PurpleConvIm *im); - -/** - * Sets the IM's buddy icon. - * - * This should only be called from within Purple. You probably want to - * call purple_buddy_icon_set_data(). - * - * @param im The IM. - * @param icon The buddy icon. - * - * @see purple_buddy_icon_set_data() - */ -void purple_conv_im_set_icon(PurpleConvIm *im, PurpleBuddyIcon *icon); - -/** - * Returns the IM's buddy icon. - * - * @param im The IM. - * - * @return The buddy icon. - */ -PurpleBuddyIcon *purple_conv_im_get_icon(const PurpleConvIm *im); - -/** - * Sets the IM's typing state. - * - * @param im The IM. - * @param state The typing state. - */ -void purple_conv_im_set_typing_state(PurpleConvIm *im, PurpleTypingState state); - -/** - * Returns the IM's typing state. - * - * @param im The IM. - * - * @return The IM's typing state. - */ -PurpleTypingState purple_conv_im_get_typing_state(const PurpleConvIm *im); - -/** - * Starts the IM's typing timeout. - * - * @param im The IM. - * @param timeout The timeout. - */ -void purple_conv_im_start_typing_timeout(PurpleConvIm *im, int timeout); - -/** - * Stops the IM's typing timeout. - * - * @param im The IM. - */ -void purple_conv_im_stop_typing_timeout(PurpleConvIm *im); - -/** - * Returns the IM's typing timeout. - * - * @param im The IM. - * - * @return The timeout. - */ -guint purple_conv_im_get_typing_timeout(const PurpleConvIm *im); - -/** - * Sets the quiet-time when no PURPLE_TYPING messages will be sent. - * Few protocols need this (maybe only MSN). If the user is still - * typing after this quiet-period, then another PURPLE_TYPING message - * will be sent. - * - * @param im The IM. - * @param val The number of seconds to wait before allowing another - * PURPLE_TYPING message to be sent to the user. Or 0 to - * not send another PURPLE_TYPING message. - */ -void purple_conv_im_set_type_again(PurpleConvIm *im, unsigned int val); - -/** - * Returns the time after which another PURPLE_TYPING message should be sent. - * - * @param im The IM. - * - * @return The time in seconds since the epoch. Or 0 if no additional - * PURPLE_TYPING message should be sent. - */ -time_t purple_conv_im_get_type_again(const PurpleConvIm *im); - -/** - * Starts the IM's type again timeout. - * - * @param im The IM. - */ -void purple_conv_im_start_send_typed_timeout(PurpleConvIm *im); - -/** - * Stops the IM's type again timeout. - * - * @param im The IM. - */ -void purple_conv_im_stop_send_typed_timeout(PurpleConvIm *im); - -/** - * Returns the IM's type again timeout interval. - * - * @param im The IM. - * - * @return The type again timeout interval. - */ -guint purple_conv_im_get_send_typed_timeout(const PurpleConvIm *im); - -/** - * Updates the visual typing notification for an IM conversation. - * - * @param im The IM. - */ -void purple_conv_im_update_typing(PurpleConvIm *im); - -/** - * Writes to an IM. - * - * @param im The IM. - * @param who The user who sent the message. - * @param message The message to write. - * @param flags The message flags. - * @param mtime The time the message was sent. - */ -void purple_conv_im_write(PurpleConvIm *im, const char *who, - const char *message, PurpleMessageFlags flags, - time_t mtime); - -/** - * Presents an IM-error to the user - * - * This is a helper function to find a conversation, write an error to it, and - * raise the window. If a conversation with this user doesn't already exist, - * the function will return FALSE and the calling function can attempt to present - * the error another way (purple_notify_error, most likely) - * - * @param who The user this error is about - * @param account The account this error is on - * @param what The error - * @return TRUE if the error was presented, else FALSE - */ -gboolean purple_conv_present_error(const char *who, PurpleAccount *account, const char *what); - -/** - * Sends a message to this IM conversation. - * - * @param im The IM. - * @param message The message to send. - */ -void purple_conv_im_send(PurpleConvIm *im, const char *message); - -/** - * Sends a message to a conversation after confirming with - * the user. - * - * This function is intended for use in cases where the user - * hasn't explicitly and knowingly caused a message to be sent. - * The confirmation ensures that the user isn't sending a - * message by mistake. - * - * @param conv The conversation. - * @param message The message to send. - */ -void purple_conv_send_confirm(PurpleConversation *conv, const char *message); - -/** - * Sends a message to this IM conversation with specified flags. - * - * @param im The IM. - * @param message The message to send. - * @param flags The PurpleMessageFlags flags to use in addition to PURPLE_MESSAGE_SEND. - */ -void purple_conv_im_send_with_flags(PurpleConvIm *im, const char *message, PurpleMessageFlags flags); - -/** - * Adds a smiley to the conversation's smiley tree. If this returns - * @c TRUE you should call purple_conv_custom_smiley_write() one or more - * times, and then purple_conv_custom_smiley_close(). If this returns - * @c FALSE, either the conv or smile were invalid, or the icon was - * found in the cache. In either case, calling write or close would - * be an error. - * - * @param conv The conversation to associate the smiley with. - * @param smile The text associated with the smiley - * @param cksum_type The type of checksum. - * @param chksum The checksum, as a NUL terminated base64 string. - * @param remote @c TRUE if the custom smiley is set by the remote user (buddy). - * @return @c TRUE if an icon is expected, else FALSE. Note that - * it is an error to never call purple_conv_custom_smiley_close if - * this function returns @c TRUE, but an error to call it if - * @c FALSE is returned. - */ - -gboolean purple_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, - const char *cksum_type, const char *chksum, - gboolean remote); - - -/** - * Updates the image associated with the current smiley. - * - * @param conv The conversation associated with the smiley. - * @param smile The text associated with the smiley. - * @param data The actual image data. - * @param size The length of the data. - */ - -void purple_conv_custom_smiley_write(PurpleConversation *conv, - const char *smile, - const guchar *data, - gsize size); - -/** - * Close the custom smiley, all data has been written with - * purple_conv_custom_smiley_write, and it is no longer valid - * to call that function on that smiley. - * - * @param conv The purple conversation associated with the smiley. - * @param smile The text associated with the smiley - */ - -void purple_conv_custom_smiley_close(PurpleConversation *conv, const char *smile); - -/*@}*/ - - -/**************************************************************************/ -/** @name Chat Conversation API */ -/**************************************************************************/ -/*@{*/ - -/** - * Gets a chat's parent conversation. - * - * @param chat The chat. - * - * @return The parent conversation. - */ -PurpleConversation *purple_conv_chat_get_conversation(const PurpleConvChat *chat); - -/** - * Sets the list of users in the chat room. - * - * @note Calling this function will not update the display of the users. - * Please use purple_conv_chat_add_user(), purple_conv_chat_add_users(), - * purple_conv_chat_remove_user(), and purple_conv_chat_remove_users() instead. - * - * @param chat The chat. - * @param users The list of users. - * - * @return The list passed. - */ -GList *purple_conv_chat_set_users(PurpleConvChat *chat, GList *users); - -/** - * Returns a list of users in the chat room. - * - * @param chat The chat. - * - * @constreturn The list of users. - */ -GList *purple_conv_chat_get_users(const PurpleConvChat *chat); - -/** - * Ignores a user in a chat room. - * - * @param chat The chat. - * @param name The name of the user. - */ -void purple_conv_chat_ignore(PurpleConvChat *chat, const char *name); - -/** - * Unignores a user in a chat room. - * - * @param chat The chat. - * @param name The name of the user. - */ -void purple_conv_chat_unignore(PurpleConvChat *chat, const char *name); - -/** - * Sets the list of ignored users in the chat room. - * - * @param chat The chat. - * @param ignored The list of ignored users. - * - * @return The list passed. - */ -GList *purple_conv_chat_set_ignored(PurpleConvChat *chat, GList *ignored); - -/** - * Returns the list of ignored users in the chat room. - * - * @param chat The chat. - * - * @constreturn The list of ignored users. - */ -GList *purple_conv_chat_get_ignored(const PurpleConvChat *chat); - -/** - * Returns the actual name of the specified ignored user, if it exists in - * the ignore list. - * - * If the user found contains a prefix, such as '+' or '\@', this is also - * returned. The username passed to the function does not have to have this - * formatting. - * - * @param chat The chat. - * @param user The user to check in the ignore list. - * - * @return The ignored user if found, complete with prefixes, or @c NULL - * if not found. - */ -const char *purple_conv_chat_get_ignored_user(const PurpleConvChat *chat, - const char *user); - -/** - * Returns @c TRUE if the specified user is ignored. - * - * @param chat The chat. - * @param user The user. - * - * @return @c TRUE if the user is in the ignore list; @c FALSE otherwise. - */ -gboolean purple_conv_chat_is_user_ignored(const PurpleConvChat *chat, - const char *user); - -/** - * Sets the chat room's topic. - * - * @param chat The chat. - * @param who The user that set the topic. - * @param topic The topic. - */ -void purple_conv_chat_set_topic(PurpleConvChat *chat, const char *who, - const char *topic); - -/** - * Returns the chat room's topic. - * - * @param chat The chat. - * - * @return The chat's topic. - */ -const char *purple_conv_chat_get_topic(const PurpleConvChat *chat); - -/** - * Sets the chat room's ID. - * - * @param chat The chat. - * @param id The ID. - */ -void purple_conv_chat_set_id(PurpleConvChat *chat, int id); - -/** - * Returns the chat room's ID. - * - * @param chat The chat. - * - * @return The ID. - */ -int purple_conv_chat_get_id(const PurpleConvChat *chat); - -/** - * Writes to a chat. - * - * @param chat The chat. - * @param who The user who sent the message. - * @param message The message to write. - * @param flags The flags. - * @param mtime The time the message was sent. - */ -void purple_conv_chat_write(PurpleConvChat *chat, const char *who, - const char *message, PurpleMessageFlags flags, - time_t mtime); - -/** - * Sends a message to this chat conversation. - * - * @param chat The chat. - * @param message The message to send. - */ -void purple_conv_chat_send(PurpleConvChat *chat, const char *message); - -/** - * Sends a message to this chat conversation with specified flags. - * - * @param chat The chat. - * @param message The message to send. - * @param flags The PurpleMessageFlags flags to use. - */ -void purple_conv_chat_send_with_flags(PurpleConvChat *chat, const char *message, PurpleMessageFlags flags); - -/** - * Adds a user to a chat. - * - * @param chat The chat. - * @param user The user to add. - * @param extra_msg An extra message to display with the join message. - * @param flags The users flags - * @param new_arrival Decides whether or not to show a join notice. - */ -void purple_conv_chat_add_user(PurpleConvChat *chat, const char *user, - const char *extra_msg, PurpleConvChatBuddyFlags flags, - gboolean new_arrival); - -/** - * Adds a list of users to a chat. - * - * The data is copied from @a users, @a extra_msgs, and @a flags, so it is up to - * the caller to free this list after calling this function. - * - * @param chat The chat. - * @param users The list of users to add. - * @param extra_msgs An extra message to display with the join message for each - * user. This list may be shorter than @a users, in which - * case, the users after the end of extra_msgs will not have - * an extra message. By extension, this means that extra_msgs - * can simply be @c NULL and none of the users will have an - * extra message. - * @param flags The list of flags for each user. - * @param new_arrivals Decides whether or not to show join notices. - */ -void purple_conv_chat_add_users(PurpleConvChat *chat, GList *users, GList *extra_msgs, - GList *flags, gboolean new_arrivals); - -/** - * Renames a user in a chat. - * - * @param chat The chat. - * @param old_user The old username. - * @param new_user The new username. - */ -void purple_conv_chat_rename_user(PurpleConvChat *chat, const char *old_user, - const char *new_user); - -/** - * Removes a user from a chat, optionally with a reason. - * - * It is up to the developer to free this list after calling this function. - * - * @param chat The chat. - * @param user The user that is being removed. - * @param reason The optional reason given for the removal. Can be @c NULL. - */ -void purple_conv_chat_remove_user(PurpleConvChat *chat, const char *user, - const char *reason); - -/** - * Removes a list of users from a chat, optionally with a single reason. - * - * @param chat The chat. - * @param users The users that are being removed. - * @param reason The optional reason given for the removal. Can be @c NULL. - */ -void purple_conv_chat_remove_users(PurpleConvChat *chat, GList *users, - const char *reason); - -/** - * Finds a user in a chat - * - * @param chat The chat. - * @param user The user to look for. - * - * @return TRUE if the user is in the chat, FALSE if not - */ -gboolean purple_conv_chat_find_user(PurpleConvChat *chat, const char *user); - -/** - * Set a users flags in a chat - * - * @param chat The chat. - * @param user The user to update. - * @param flags The new flags. - */ -void purple_conv_chat_user_set_flags(PurpleConvChat *chat, const char *user, - PurpleConvChatBuddyFlags flags); - -/** - * Get the flags for a user in a chat - * - * @param chat The chat. - * @param user The user to find the flags for - * - * @return The flags for the user - */ -PurpleConvChatBuddyFlags purple_conv_chat_user_get_flags(PurpleConvChat *chat, - const char *user); - -/** - * Clears all users from a chat. - * - * @param chat The chat. - */ -void purple_conv_chat_clear_users(PurpleConvChat *chat); - -/** - * Sets your nickname (used for hilighting) for a chat. - * - * @param chat The chat. - * @param nick The nick. - */ -void purple_conv_chat_set_nick(PurpleConvChat *chat, const char *nick); - -/** - * Gets your nickname (used for hilighting) for a chat. - * - * @param chat The chat. - * @return The nick. - */ -const char *purple_conv_chat_get_nick(PurpleConvChat *chat); - -/** - * Finds a chat with the specified chat ID. - * - * @param gc The purple_connection. - * @param id The chat ID. - * - * @return The chat conversation. - */ -PurpleConversation *purple_find_chat(const PurpleConnection *gc, int id); - -/** - * Lets the core know we left a chat, without destroying it. - * Called from serv_got_chat_left(). - * - * @param chat The chat. - */ -void purple_conv_chat_left(PurpleConvChat *chat); - -/** - * Invite a user to a chat. - * The user will be prompted to enter the user's name or a message if one is - * not given. - * - * @param chat The chat. - * @param user The user to invite to the chat. - * @param message The message to send with the invitation. - * @param confirm Prompt before sending the invitation. The user is always - * prompted if either \a user or \a message is @c NULL. - * - * @since 2.6.0 - */ -void purple_conv_chat_invite_user(PurpleConvChat *chat, const char *user, - const char *message, gboolean confirm); - -/** - * Returns true if we're no longer in this chat, - * and just left the window open. - * - * @param chat The chat. - * - * @return @c TRUE if we left the chat already, @c FALSE if - * we're still there. - */ -gboolean purple_conv_chat_has_left(PurpleConvChat *chat); - -/** - * Creates a new chat buddy - * - * @param name The name. - * @param alias The alias. - * @param flags The flags. - * - * @return The new chat buddy - */ -PurpleConvChatBuddy *purple_conv_chat_cb_new(const char *name, const char *alias, - PurpleConvChatBuddyFlags flags); - -/** - * Find a chat buddy in a chat - * - * @param chat The chat. - * @param name The name of the chat buddy to find. - */ -PurpleConvChatBuddy *purple_conv_chat_cb_find(PurpleConvChat *chat, const char *name); - -/** - * Get the name of a chat buddy - * - * @param cb The chat buddy. - * - * @return The name of the chat buddy. - */ -const char *purple_conv_chat_cb_get_name(PurpleConvChatBuddy *cb); - -/** - * Destroys a chat buddy - * - * @param cb The chat buddy to destroy - */ -void purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb); - -/** - * Retrieves the extended menu items for the conversation. - * - * @param conv The conversation. - * - * @return A list of PurpleMenuAction items, harvested by the - * chat-extended-menu signal. The list and the menuaction - * items should be freed by the caller. - * - * @since 2.1.0 - */ -GList * purple_conversation_get_extended_menu(PurpleConversation *conv); - -/** - * Perform a command in a conversation. Similar to @see purple_cmd_do_command - * - * @param conv The conversation. - * @param cmdline The entire command including the arguments. - * @param markup @c NULL, or the formatted command line. - * @param error If the command failed errormsg is filled in with the appropriate error - * message, if not @c NULL. It must be freed by the caller with g_free(). - * - * @return @c TRUE if the command was executed successfully, @c FALSE otherwise. - * - * @since 2.1.0 - */ -gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); - -/*@}*/ - -/**************************************************************************/ -/** @name Conversations Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the conversation subsystem handle. - * - * @return The conversation subsystem handle. - */ -void *purple_conversations_get_handle(void); - -/** - * Initializes the conversation subsystem. - */ -void purple_conversations_init(void); - -/** - * Uninitializes the conversation subsystem. - */ -void purple_conversations_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_CONVERSATION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,783 +0,0 @@ -/** - * @file core.c Purple Core API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "cipher.h" -#include "certificate.h" -#include "cmds.h" -#include "connection.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "dnsquery.h" -#include "ft.h" -#include "idle.h" -#include "imgstore.h" -#include "network.h" -#include "notify.h" -#include "plugin.h" -#include "pounce.h" -#include "prefs.h" -#include "privacy.h" -#include "proxy.h" -#include "savedstatuses.h" -#include "signals.h" -#include "smiley.h" -#include "sound.h" -#include "sound-theme-loader.h" -#include "sslconn.h" -#include "status.h" -#include "stun.h" -#include "theme-manager.h" -#include "util.h" - -#ifdef HAVE_DBUS -# ifndef DBUS_API_SUBJECT_TO_CHANGE -# define DBUS_API_SUBJECT_TO_CHANGE -# endif -# include -# include "dbus-purple.h" -# include "dbus-server.h" -# include "dbus-bindings.h" -#endif - -struct PurpleCore -{ - char *ui; - - void *reserved; -}; - -static PurpleCoreUiOps *_ops = NULL; -static PurpleCore *_core = NULL; - -STATIC_PROTO_INIT - -gboolean -purple_core_init(const char *ui) -{ - PurpleCoreUiOps *ops; - PurpleCore *core; - - g_return_val_if_fail(ui != NULL, FALSE); - g_return_val_if_fail(purple_get_core() == NULL, FALSE); - -#ifdef ENABLE_NLS - bindtextdomain(PACKAGE, LOCALEDIR); -#endif -#ifdef _WIN32 - wpurple_init(); -#endif - - g_type_init(); - - _core = core = g_new0(PurpleCore, 1); - core->ui = g_strdup(ui); - core->reserved = NULL; - - ops = purple_core_get_ui_ops(); - - /* The signals subsystem is important and should be first. */ - purple_signals_init(); - - purple_util_init(); - - purple_signal_register(core, "uri-handler", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 3, - purple_value_new(PURPLE_TYPE_STRING), /* Protocol */ - purple_value_new(PURPLE_TYPE_STRING), /* Command */ - purple_value_new(PURPLE_TYPE_BOXED, "GHashTable *")); /* Parameters */ - - purple_signal_register(core, "quitting", purple_marshal_VOID, NULL, 0); - - /* The prefs subsystem needs to be initialized before static protocols - * for protocol prefs to work. */ - purple_prefs_init(); - - purple_debug_init(); - - if (ops != NULL) - { - if (ops->ui_prefs_init != NULL) - ops->ui_prefs_init(); - - if (ops->debug_ui_init != NULL) - ops->debug_ui_init(); - } - -#ifdef HAVE_DBUS - purple_dbus_init(); -#endif - - purple_ciphers_init(); - purple_cmds_init(); - - /* Since plugins get probed so early we should probably initialize their - * subsystem right away too. - */ - purple_plugins_init(); - - /* Initialize all static protocols. */ - static_proto_init(); - - purple_plugins_probe(G_MODULE_SUFFIX); - - purple_theme_manager_init(); - - /* The buddy icon code uses the imgstore, so init it early. */ - purple_imgstore_init(); - - /* Accounts use status, buddy icons and connection signals, so - * initialize these before accounts - */ - purple_status_init(); - purple_buddy_icons_init(); - purple_connections_init(); - - purple_accounts_init(); - purple_savedstatuses_init(); - purple_notify_init(); - purple_certificate_init(); - purple_conversations_init(); - purple_blist_init(); - purple_log_init(); - purple_network_init(); - purple_privacy_init(); - purple_pounces_init(); - purple_proxy_init(); - purple_dnsquery_init(); - purple_sound_init(); - purple_ssl_init(); - purple_stun_init(); - purple_xfers_init(); - purple_idle_init(); - purple_smileys_init(); - /* - * Call this early on to try to auto-detect our IP address and - * hopefully save some time later. - */ - purple_network_get_my_ip(-1); - - if (ops != NULL && ops->ui_init != NULL) - ops->ui_init(); - - /* The UI may have registered some theme types, so refresh them */ - purple_theme_manager_refresh(); - - return TRUE; -} - -void -purple_core_quit(void) -{ - PurpleCoreUiOps *ops; - PurpleCore *core = purple_get_core(); - - g_return_if_fail(core != NULL); - - /* The self destruct sequence has been initiated */ - purple_signal_emit(purple_get_core(), "quitting"); - - /* Transmission ends */ - purple_connections_disconnect_all(); - - /* - * Certificates must be destroyed before the SSL plugins, because - * PurpleCertificates contain pointers to PurpleCertificateSchemes, - * and the PurpleCertificateSchemes will be unregistered when the - * SSL plugin is uninit. - */ - purple_certificate_uninit(); - - /* The SSL plugins must be uninit before they're unloaded */ - purple_ssl_uninit(); - - /* Unload all non-loader, non-prpl plugins before shutting down - * subsystems. */ - purple_debug_info("main", "Unloading normal plugins\n"); - purple_plugins_unload(PURPLE_PLUGIN_STANDARD); - - /* Save .xml files, remove signals, etc. */ - purple_smileys_uninit(); - purple_idle_uninit(); - purple_pounces_uninit(); - purple_blist_uninit(); - purple_ciphers_uninit(); - purple_notify_uninit(); - purple_conversations_uninit(); - purple_connections_uninit(); - purple_buddy_icons_uninit(); - purple_savedstatuses_uninit(); - purple_status_uninit(); - purple_accounts_uninit(); - purple_sound_uninit(); - purple_theme_manager_uninit(); - purple_xfers_uninit(); - purple_proxy_uninit(); - purple_dnsquery_uninit(); - purple_imgstore_uninit(); - purple_network_uninit(); - - /* Everything after unloading all plugins must not fail if prpls aren't - * around */ - purple_debug_info("main", "Unloading all plugins\n"); - purple_plugins_destroy_all(); - - ops = purple_core_get_ui_ops(); - if (ops != NULL && ops->quit != NULL) - ops->quit(); - - /* Everything after prefs_uninit must not try to read any prefs */ - purple_prefs_uninit(); - purple_plugins_uninit(); -#ifdef HAVE_DBUS - purple_dbus_uninit(); -#endif - - purple_cmds_uninit(); - /* Everything after util_uninit cannot try to write things to the confdir */ - purple_util_uninit(); - purple_log_uninit(); - - purple_signals_uninit(); - - g_free(core->ui); - g_free(core); - -#ifdef _WIN32 - wpurple_cleanup(); -#endif - - _core = NULL; -} - -gboolean -purple_core_quit_cb(gpointer unused) -{ - purple_core_quit(); - - return FALSE; -} - -const char * -purple_core_get_version(void) -{ - return VERSION; -} - -const char * -purple_core_get_ui(void) -{ - PurpleCore *core = purple_get_core(); - - g_return_val_if_fail(core != NULL, NULL); - - return core->ui; -} - -PurpleCore * -purple_get_core(void) -{ - return _core; -} - -void -purple_core_set_ui_ops(PurpleCoreUiOps *ops) -{ - _ops = ops; -} - -PurpleCoreUiOps * -purple_core_get_ui_ops(void) -{ - return _ops; -} - -#ifdef HAVE_DBUS -static char *purple_dbus_owner_user_dir(void) -{ - DBusMessage *msg = NULL, *reply = NULL; - DBusConnection *dbus_connection = NULL; - DBusError dbus_error; - char *remote_user_dir = NULL; - - if ((dbus_connection = purple_dbus_get_connection()) == NULL) - return NULL; - - if ((msg = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, "PurpleUserDir")) == NULL) - return NULL; - - dbus_error_init(&dbus_error); - reply = dbus_connection_send_with_reply_and_block(dbus_connection, msg, 5000, &dbus_error); - dbus_message_unref(msg); - dbus_error_free(&dbus_error); - - if (reply) - { - dbus_error_init(&dbus_error); - dbus_message_get_args(reply, &dbus_error, DBUS_TYPE_STRING, &remote_user_dir, DBUS_TYPE_INVALID); - remote_user_dir = g_strdup(remote_user_dir); - dbus_error_free(&dbus_error); - dbus_message_unref(reply); - } - - return remote_user_dir; -} - -#endif /* HAVE_DBUS */ - -gboolean -purple_core_ensure_single_instance() -{ - gboolean is_single_instance = TRUE; -#ifdef HAVE_DBUS - /* in the future, other mechanisms might have already set this to FALSE */ - if (is_single_instance) - { - if (!purple_dbus_is_owner()) - { - const char *user_dir = purple_user_dir(); - char *dbus_owner_user_dir = purple_dbus_owner_user_dir(); - - is_single_instance = !purple_strequal(dbus_owner_user_dir, user_dir); - g_free(dbus_owner_user_dir); - } - } -#endif /* HAVE_DBUS */ - - return is_single_instance; -} - -static gboolean -move_and_symlink_dir(const char *path, const char *basename, const char *old_base, const char *new_base, const char *relative) -{ - char *new_name = g_build_filename(new_base, basename, NULL); -#ifndef _WIN32 - char *old_name; -#endif - if (g_rename(path, new_name)) - { - purple_debug_error("core", "Error renaming %s to %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - path, new_name, g_strerror(errno)); - g_free(new_name); - return FALSE; - } - g_free(new_name); - -#ifndef _WIN32 - /* NOTE: This new_name is relative. */ - new_name = g_build_filename(relative, basename, NULL); - old_name = g_build_filename(old_base, basename, NULL); - if (symlink(new_name, old_name)) - { - purple_debug_warning("core", "Error symlinking %s to %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - old_name, new_name, g_strerror(errno)); - } - g_free(old_name); - g_free(new_name); -#endif - - return TRUE; -} - -gboolean -purple_core_migrate(void) -{ - const char *user_dir = purple_user_dir(); - char *old_user_dir = g_strconcat(purple_home_dir(), - G_DIR_SEPARATOR_S ".gaim", NULL); - char *status_file; - FILE *fp; - GDir *dir; - GError *err; - const char *entry; -#ifndef _WIN32 - char *logs_dir; -#endif - char *old_icons_dir; - - if (!g_file_test(old_user_dir, G_FILE_TEST_EXISTS)) - { - /* ~/.gaim doesn't exist, so there's nothing to migrate. */ - g_free(old_user_dir); - return TRUE; - } - - status_file = g_strconcat(user_dir, G_DIR_SEPARATOR_S "migrating", NULL); - - if (g_file_test(user_dir, G_FILE_TEST_EXISTS)) - { - /* If we're here, we have both ~/.gaim and .purple. */ - - if (!g_file_test(status_file, G_FILE_TEST_EXISTS)) - { - /* There's no "migrating" status file, - * so ~/.purple is all up to date. */ - g_free(status_file); - g_free(old_user_dir); - return TRUE; - } - } - - /* If we're here, it's time to migrate from ~/.gaim to ~/.purple. */ - - /* Ensure the user directory exists */ - if (!g_file_test(user_dir, G_FILE_TEST_IS_DIR)) - { - if (g_mkdir(user_dir, S_IRUSR | S_IWUSR | S_IXUSR) == -1) - { - purple_debug_error("core", "Error creating directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - user_dir, g_strerror(errno)); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - - /* This writes ~/.purple/migrating, which allows us to detect - * incomplete migrations and properly retry. */ - if (!(fp = g_fopen(status_file, "w"))) - { - purple_debug_error("core", "Error opening file %s for writing: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - status_file, g_strerror(errno)); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - fclose(fp); - - /* Open ~/.gaim so we can loop over its contents. */ - err = NULL; - if (!(dir = g_dir_open(old_user_dir, 0, &err))) - { - purple_debug_error("core", "Error opening directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - status_file, - (err ? err->message : "Unknown error")); - if (err) - g_error_free(err); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - /* Loop over the contents of ~/.gaim */ - while ((entry = g_dir_read_name(dir))) - { - char *name = g_build_filename(old_user_dir, entry, NULL); - -#ifndef _WIN32 - /* Deal with symlinks... */ - if (g_file_test(name, G_FILE_TEST_IS_SYMLINK)) - { - /* We're only going to duplicate a logs symlink. */ - if (purple_strequal(entry, "logs")) - { - char *link; -#if GLIB_CHECK_VERSION(2,4,0) - err = NULL; - - if ((link = g_file_read_link(name, &err)) == NULL) - { - char *name_utf8 = g_filename_to_utf8(name, -1, NULL, NULL, NULL); - purple_debug_error("core", "Error reading symlink %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name_utf8 ? name_utf8 : name, err->message); - g_free(name_utf8); - g_error_free(err); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } -#else - char buf[MAXPATHLEN]; - size_t linklen; - - if ((linklen = readlink(name, buf, sizeof(buf) - 1) == -1)) - { - char *name_utf8 = g_filename_to_utf8(name, -1, NULL, NULL, NULL); - purple_debug_error("core", "Error reading symlink %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name_utf8, g_strerror(errno)); - g_free(name_utf8); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - buf[linklen] = '\0'; - - /* This way we don't have to GLIB_VERSION_CHECK every g_free(link) below. */ - link = g_strdup(buf); -#endif - - logs_dir = g_build_filename(user_dir, "logs", NULL); - - if (purple_strequal(link, "../.purple/logs") || - purple_strequal(link, logs_dir)) - { - /* If the symlink points to the new directory, we're - * likely just trying again after a failed migration, - * so there's no need to fail here. */ - g_free(link); - g_free(logs_dir); - continue; - } - - /* In case we are trying again after a failed migration, we need - * to unlink any existing symlink. If it's a directory, this - * will fail, and so will the symlink below, which is good - * because the user should sort things out. */ - g_unlink(logs_dir); - - /* Relative links will most likely still be - * valid from ~/.purple, though it's not - * guaranteed. Oh well. */ - if (symlink(link, logs_dir)) - { - purple_debug_error("core", "Error symlinking %s to %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - logs_dir, link, g_strerror(errno)); - g_free(link); - g_free(name); - g_free(logs_dir); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - g_free(link); - g_free(logs_dir); - continue; - } - - /* Ignore all other symlinks. */ - continue; - } -#endif - - /* Deal with directories... */ - if (g_file_test(name, G_FILE_TEST_IS_DIR)) - { - if (purple_strequal(entry, "icons")) - { - /* This is a special case for the Album plugin, which - * stores data in the icons folder. We're not copying - * the icons directory over because previous bugs - * meant that it filled up with junk for many users. - * This is a great time to purge it. */ - - GDir *icons_dir; - char *new_icons_dir; - const char *icons_entry; - - err = NULL; - if (!(icons_dir = g_dir_open(name, 0, &err))) - { - purple_debug_error("core", "Error opening directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name, - (err ? err->message : "Unknown error")); - if (err) - g_error_free(err); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - new_icons_dir = g_build_filename(user_dir, "icons", NULL); - /* Ensure the new icon directory exists */ - if (!g_file_test(new_icons_dir, G_FILE_TEST_IS_DIR)) - { - if (g_mkdir(new_icons_dir, S_IRUSR | S_IWUSR | S_IXUSR) == -1) - { - purple_debug_error("core", "Error creating directory %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_icons_dir, g_strerror(errno)); - g_free(new_icons_dir); - g_dir_close(icons_dir); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - - while ((icons_entry = g_dir_read_name(icons_dir))) - { - char *icons_name = g_build_filename(name, icons_entry, NULL); - - if (g_file_test(icons_name, G_FILE_TEST_IS_DIR)) - { - if (!move_and_symlink_dir(icons_name, icons_entry, - name, new_icons_dir, "../../.purple/icons")) - { - g_free(icons_name); - g_free(new_icons_dir); - g_dir_close(icons_dir); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - g_free(icons_name); - } - - g_dir_close(icons_dir); - } - else if (purple_strequal(entry, "plugins")) - { - /* Do nothing, because we broke plugin compatibility. - * This means that the plugins directory gets left behind. */ - } - else - { - /* All other directories are moved and symlinked. */ - if (!move_and_symlink_dir(name, entry, old_user_dir, user_dir, "../.purple")) - { - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - } - else if (g_file_test(name, G_FILE_TEST_IS_REGULAR)) - { - /* Regular files are copied. */ - - char *new_name; - FILE *new_file; - - if (!(fp = g_fopen(name, "rb"))) - { - purple_debug_error("core", "Error opening file %s for reading: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name, g_strerror(errno)); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - new_name = g_build_filename(user_dir, entry, NULL); - if (!(new_file = g_fopen(new_name, "wb"))) - { - purple_debug_error("core", "Error opening file %s for writing: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_name, g_strerror(errno)); - fclose(fp); - g_free(new_name); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - while (!feof(fp)) - { - unsigned char buf[256]; - size_t size; - - size = fread(buf, 1, sizeof(buf), fp); - if (size != sizeof(buf) && !feof(fp)) - { - purple_debug_error("core", "Error reading %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - name, g_strerror(errno)); - fclose(new_file); - fclose(fp); - g_free(new_name); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - - if (!fwrite(buf, size, 1, new_file) && ferror(new_file) != 0) - { - purple_debug_error("core", "Error writing %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_name, g_strerror(errno)); - fclose(new_file); - fclose(fp); - g_free(new_name); - g_free(name); - g_dir_close(dir); - g_free(status_file); - g_free(old_user_dir); - return FALSE; - } - } - - if (fclose(new_file)) - { - purple_debug_error("core", "Error writing: %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - new_name, g_strerror(errno)); - } - if (fclose(fp)) - { - purple_debug_warning("core", "Error closing %s: %s\n", - name, g_strerror(errno)); - } - g_free(new_name); - } - else - purple_debug_warning("core", "Not a regular file or directory: %s\n", name); - - g_free(name); - } - - /* The migration was successful, so delete the status file. */ - if (g_unlink(status_file)) - { - purple_debug_error("core", "Error unlinking file %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n", - status_file, g_strerror(errno)); - g_free(status_file); - return FALSE; - } - - old_icons_dir = g_build_filename(old_user_dir, "icons", NULL); - _purple_buddy_icon_set_old_icons_dir(old_icons_dir); - g_free(old_icons_dir); - - g_free(old_user_dir); - - g_free(status_file); - return TRUE; -} - -GHashTable* purple_core_get_ui_info() { - PurpleCoreUiOps *ops = purple_core_get_ui_ops(); - - if(NULL == ops || NULL == ops->get_ui_info) - return NULL; - - return ops->get_ui_info(); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/core.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,251 +0,0 @@ -/** - * @file core.h Startup and shutdown of libpurple - * @defgroup core libpurple - * @see @ref core-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -/*! @mainpage Pidgin/Finch/libpurple API Documentation - * - * libpurple is intended to be the core of an IM - * program. Pidgin is a GTK+ frontend - * to libpurple, and Finch is an ncurses - * frontend built using libgnt - * (GLib Ncurses Toolkit). - */ - -#ifndef _PURPLE_CORE_H_ -#define _PURPLE_CORE_H_ - -typedef struct PurpleCore PurpleCore; - -/** Callbacks that fire at different points of the initialization and teardown - * of libpurple, along with a hook to return descriptive information about the - * UI. - */ -typedef struct -{ - /** Called just after the preferences subsystem is initialized; the UI - * could use this callback to add some preferences it needs to be in - * place when other subsystems are initialized. - */ - void (*ui_prefs_init)(void); - /** Called just after the debug subsystem is initialized, but before - * just about every other component's initialization. The UI should - * use this hook to call purple_debug_set_ui_ops() so that debugging - * information for other components can be logged during their - * initialization. - */ - void (*debug_ui_init)(void); - /** Called after all of libpurple has been initialized. The UI should - * use this hook to set all other necessary UiOps structures. - * - * @see @ref ui-ops - */ - void (*ui_init)(void); - /** Called after most of libpurple has been uninitialized. */ - void (*quit)(void); - - /** Called by purple_core_get_ui_info(); should return the information - * documented there. - */ - GHashTable* (*get_ui_info)(void); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); -} PurpleCoreUiOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Initializes the core of purple. - * - * This will setup preferences for all the core subsystems. - * - * @param ui The ID of the UI using the core. This should be a - * unique ID, registered with the purple team. - * - * @return @c TRUE if successful, or @c FALSE otherwise. - */ -gboolean purple_core_init(const char *ui); - -/** - * Quits the core of purple, which, depending on the UI, may quit the - * application using the purple core. - */ -void purple_core_quit(void); - -/** - *

- * Calls purple_core_quit(). This can be used as the function - * passed to purple_timeout_add() when you want to shutdown Purple - * in a specified amount of time. When shutting down Purple - * from a plugin, you must use this instead of purple_core_quit(); - * for an immediate exit, use a timeout value of 0: - *

- * - * purple_timeout_add(0, purple_core_quitcb, NULL); - * - *

- * This is ensures that code from your plugin is not being - * executed when purple_core_quit() is called. If the plugin - * called purple_core_quit() directly, you would get a core dump - * after purple_core_quit() executes and control returns to your - * plugin because purple_core_quit() frees all plugins. - *

- */ -gboolean purple_core_quit_cb(gpointer unused); - -/** - * Returns the version of the core library. - * - * @return The version of the core library. - */ -const char *purple_core_get_version(void); - -/** - * Returns the ID of the UI that is using the core, as passed to - * purple_core_init(). - * - * @return The ID of the UI that is currently using the core. - */ -const char *purple_core_get_ui(void); - -/** - * Returns a handle to the purple core. - * - * This is used to connect to @ref core-signals "core signals". - */ -PurpleCore *purple_get_core(void); - -/** - * Sets the UI ops for the core. - * - * @param ops A UI ops structure for the core. - */ -void purple_core_set_ui_ops(PurpleCoreUiOps *ops); - -/** - * Returns the UI ops for the core. - * - * @return The core's UI ops structure. - */ -PurpleCoreUiOps *purple_core_get_ui_ops(void); - -/** - * Migrates from .gaim to .purple. - * - * UIs must not call this if they have been told to use a - * custom user directory. - * - * @return A boolean indicating success or migration failure. On failure, - * the application must display an error to the user and then exit. - */ -gboolean purple_core_migrate(void); - -/** - * Ensures that only one instance is running. If libpurple is built with D-Bus - * support, this checks if another process owns the libpurple bus name and if - * so whether that process is using the same configuration directory as this - * process. - * - * @return @c TRUE if this is the first instance of libpurple running; - * @c FALSE if there is another instance running. - * - * @since 2.1.0 - */ -gboolean purple_core_ensure_single_instance(void); - -/** - * Returns a hash table containing various information about the UI. The - * following well-known entries may be in the table (along with any others the - * UI might choose to include): - * - *
- *
name
- *
the user-readable name for the UI.
- * - *
version
- *
a user-readable description of the current version of the UI.
- * - *
website
- *
the UI's website, such as http://pidgin.im.
- * - *
dev_website
- *
the UI's development/support website, such as http://developer.pidgin.im.
- * - *
client_type
- *
the type of UI. Possible values include 'pc', 'console', 'phone', - * 'handheld', 'web', and 'bot'. These values are compared - * programmatically and should not be localized.
- * - *
- * - * @return A GHashTable with strings for keys and values. This - * hash table must not be freed and should not be modified. - * - * @since 2.1.0 - * - */ -GHashTable* purple_core_get_ui_info(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_CORE_H_ */ - -/* - - /===- - `//"\\ """"`---.___.-"" - ______-==| | | \\ _-"` - __--""" ,-/-==\\ | | `\ ,' - _-" /' | \\ ___ / / \ / - .' / | \\ /" "\ /' / \ /' - / ____ / | \`\.__/-"" D O \_/' / \/' -/-'" """""---__ | "-/" O G R /' _--"` - \_| / R __--_ t ), __--"" - '""--_/ T _-"_>--<_\ h '-" \ - {\__--_/} / \\__>--<__\ e B \ - /' (_/ _-" | |__>--<__| U | - | _/) )-" | |__>--<__| R | - / /" ,_/ / /__>---<__/ N | - o-o _// /-"_>---<__-" I / - (^(" /"_>---<__- N _-" - ,/| /__>--<__/ A _-" - ,//('( |__>--<__| T / .----_ - ( ( ')) |__>--<__| | /' _---_"\ - `-)) )) ( |__>--<__| O | /' / "\`\ - ,/,'//( ( \__>--<__\ R \ /' // || - ,( ( ((, )) "-__>--<_"-_ "--____---"' _/'/ /' - `"/ )` ) ,/| "-_">--<_/-__ __-" _/ - ._-"//( )/ )) ` ""-'_/_/ /"""""""__--" - ;'( ')/ ,)( """""""""" - ' ') '( (/ - ' ' ` - -*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-functions.py qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-functions.py --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-functions.py 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-functions.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,653 +0,0 @@ -import re -import string -import sys - -# types translated into "int" -simpletypes = ["int", "gint", "guint", "gboolean", "gpointer", "size_t", "gssize", "time_t"] - -# List "excluded" contains functions that shouldn't be exported via -# DBus. If you remove a function from this list, please make sure -# that it does not break "make" with the configure option -# "--enable-dbus" turned on. - -excluded = [\ - # I don't remember why this function is excluded; something to do - # with the fact that it takes a (const) GList as a parameter. - "purple_presence_add_list", - - # These functions are excluded because they involve value of the - # type PurpleConvPlacementFunc, which is a pointer to a function and - # (currently?) can't be translated into a DBus type. Normally, - # functions with untranslatable types are skipped, but this script - # assumes that all non-pointer type names beginning with "Purple" - # are enums, which is not true in this case. - "purple_conv_placement_add_fnc", - "purple_conv_placement_get_fnc", - "purple_conv_placement_get_current_func", - "purple_conv_placement_set_current_func", - - # Similar to the above: - "purple_account_set_register_callback", - "purple_account_unregister", - "purple_connection_new_unregister", - - # These functions are excluded because they involve setting arbitrary - # data via pointers for protocols and UIs. This just won't work. - "purple_blist_get_ui_data", - "purple_blist_set_ui_data", - "purple_blist_node_get_ui_data", - "purple_blist_node_set_ui_data", - "purple_buddy_get_protocol_data", - "purple_buddy_set_protocol_data", - - # This is excluded because this script treats PurpleLogReadFlags* - # as pointer to a struct, instead of a pointer to an enum. This - # causes a compilation error. Someone should fix this script. - "purple_log_read", - ] - -# This is a list of functions that return a GList* or GSList * whose elements -# are strings, not pointers to objects. -stringlists = [ - "purple_prefs_get_path_list", - "purple_prefs_get_string_list", - "purple_uri_list_extract_filenames", - "purple_uri_list_extract_uris", - "purple_prefs_get_children_names", -] - -# This is a list of functions that return a GList* or GSList* that should -# not be freed. Ideally, this information should be obtained from the Doxygen -# documentation at some point. -constlists = [ - "purple_account_get_status_types", - "purple_accounts_get_all", - "purple_account_option_get_list", - "purple_connections_get_all", - "purple_connections_get_connecting", - "purple_get_conversations", - "purple_get_ims", - "purple_get_chats", - "purple_conv_chat_get_users", - "purple_conv_chat_get_ignored", - "purple_mime_document_get_fields", - "purple_mime_document_get_parts", - "purple_mime_part_get_fields", - "purple_notify_user_info_get_entries", - "purple_request_fields_get_required", - "purple_request_field_list_get_selected", - "purple_request_field_list_get_items", - "purple_savedstatuses_get_all", - "purple_status_type_get_attrs", - "purple_presence_get_statuses", - "purple_conversation_get_message_history", -] - -pointer = "#pointer#" - -class MyException(Exception): - pass - -myexception = MyException() - -def ctopascal(name): - newname = "" - for word in name.split("_"): - newname += word.capitalize() - return newname - -class Parameter: - def __init__(self, type, name): - self.name = name - self.type = type - - def fromtokens(tokens, parameternumber = -1): - if len(tokens) == 0: - raise myexception - if (len(tokens) == 1) or (tokens[-1] == pointer): - if parameternumber >= 0: - return Parameter(tokens, "param%i" % parameternumber) - else: - raise myexception - else: - return Parameter(tokens[:-1], tokens[-1]) - - fromtokens = staticmethod(fromtokens) - -class Binding: - def __init__(self, functiontext, paramtexts): - self.function = Parameter.fromtokens(functiontext.split()) - - if self.function.name in excluded: - raise myexception - - self.params = [] - for i in range(len(paramtexts)): - self.params.append(Parameter.fromtokens(paramtexts[i].split(), i)) - - self.call = "%s(%s)" % (self.function.name, - ", ".join(param.name for param in self.params)) - - - def process(self): - for param in self.params: - self.processinput(param.type, param.name) - - self.processoutput(self.function.type, "RESULT") - self.flush() - - - def processinput(self, type, name): - const = False - unsigned = False - if type[0] == "const": - type = type[1:] - const = True - - if type[0] == "unsigned": - type = type[1:] - unsigned = True - - if len(type) == 1: - # simple types (int, gboolean, etc.) and enums - if (type[0] in simpletypes) or ((type[0].startswith("Purple") and not type[0].endswith("Callback"))): - return self.inputsimple(type, name, unsigned) - - # pointers ... - if (len(type) == 2) and (type[1] == pointer): - # strings - if type[0] in ["char", "gchar"]: - if const: - return self.inputstring(type, name, unsigned) - else: - raise myexception - - elif type[0] == "GHashTable": - return self.inputhash(type, name) - - # known object types are transformed to integer handles - elif type[0].startswith("Purple") or type[0] == "xmlnode": - return self.inputpurplestructure(type, name) - - # special case for *_get_data functions, be careful here... - elif (type[0] == "size_t") and (name == "len"): - return self.inputgetdata(type, name) - - # unknown pointers are always replaced with NULL - else: - return self.inputpointer(type, name) - - raise myexception - - - def processoutput(self, type, name): - const = False - unsigned = False - # the "void" type is simple ... - if type == ["void"]: - return self.outputvoid(type, name) - - if type[0] == "const": - type = type[1:] - const = True - - if type[0] == "unsigned": - type = type[1:] - unsigned = True - - # a string - if type == ["char", pointer] or type == ["gchar", pointer]: - return self.outputstring(type, name, const) - - # simple types (ints, booleans, enums, ...) - if (len(type) == 1) and \ - ((type[0] in simpletypes) or (type[0].startswith("Purple"))): - return self.outputsimple(type, name, unsigned) - - # pointers ... - if (len(type) == 2) and (type[1] == pointer): - - # handles - if type[0].startswith("Purple"): - return self.outputpurplestructure(type, name) - - if type[0] in ["GList", "GSList"]: - return self.outputlist(type, name) - - # Special case for *_get_data functions - if type[0] == "gconstpointer": - return self.outputgetdata(type, name) - - raise myexception - - -class ClientBinding (Binding): - def __init__(self, functiontext, paramtexts, knowntypes, headersonly): - Binding.__init__(self, functiontext, paramtexts) - self.knowntypes = knowntypes - self.headersonly = headersonly - self.paramshdr = [] - self.decls = [] - self.inputparams = [] - self.outputparams = [] - self.returncode = [] - - def flush(self): - paramslist = ", ".join(self.paramshdr) - if (paramslist == "") : - paramslist = "void" - print "%s %s(%s)" % (self.functiontype, self.function.name, - paramslist), - - if self.headersonly: - print ";" - return - - print "{" - - for decl in self.decls: - print decl - - print 'dbus_g_proxy_call(purple_proxy, "%s", NULL,' % ctopascal(self.function.name) - - for type_name in self.inputparams: - print "\t%s, %s, " % type_name, - print "G_TYPE_INVALID," - - for type_name in self.outputparams: - print "\t%s, &%s, " % type_name, - print "G_TYPE_INVALID);" - - for code in self.returncode: - print code - - print "}\n" - - - def definepurplestructure(self, type): - if (self.headersonly) and (type[0] not in self.knowntypes): - print "struct _%s;" % type[0] - print "typedef struct _%s %s;" % (type[0], type[0]) - self.knowntypes.append(type[0]) - - def inputsimple(self, type, name, us): - self.paramshdr.append("%s %s" % (type[0], name)) - if us: - self.inputparams.append(("G_TYPE_UINT", name)) - else: - self.inputparams.append(("G_TYPE_INT", name)) - - def inputstring(self, type, name, us): - if us: - self.paramshdr.append("const unsigned char *%s" % name) - else: - self.paramshdr.append("const char *%s" % name) - self.inputparams.append(("G_TYPE_STRING", name)) - - def inputpurplestructure(self, type, name): - self.paramshdr.append("const %s *%s" % (type[0], name)) - self.inputparams.append(("G_TYPE_INT", "GPOINTER_TO_INT(%s)" % name)) - self.definepurplestructure(type) - - def inputpointer(self, type, name): - name += "_NULL" - self.paramshdr.append("const %s *%s" % (type[0], name)) - self.inputparams.append(("G_TYPE_INT", "0")) - - def inputhash(self, type, name): - self.paramshdr.append("const GHashTable *%s" % name) - self.inputparams.append(('dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING)', name)) - - def outputvoid(self, type, name): - self.functiontype = "void" - - def outputstring(self, type, name, const): - self.functiontype = "char*" - self.decls.append("char *%s = NULL;" % name) - self.outputparams.append(("G_TYPE_STRING", name)) -# self.returncode.append("NULLIFY(%s);" % name) - self.returncode.append("return %s;" % name); - - def outputsimple(self, type, name, us): - self.functiontype = type[0] - self.decls.append("%s %s = 0;" % (type[0], name)) - if us: - self.outputparams.append(("G_TYPE_UINT", name)) - else: - self.outputparams.append(("G_TYPE_INT", name)) - self.returncode.append("return %s;" % name); - - # we could add "const" to the return type but this would probably - # be a nuisance - def outputpurplestructure(self, type, name): - name = name + "_ID" - self.functiontype = "%s*" % type[0] - self.decls.append("int %s = 0;" % name) - self.outputparams.append(("G_TYPE_INT", "%s" % name)) - self.returncode.append("return (%s*) GINT_TO_POINTER(%s);" % (type[0], name)); - self.definepurplestructure(type) - - def outputlist(self, type, name): - self.functiontype = "%s*" % type[0] - self.decls.append("GArray *%s;" % name) - self.outputparams.append(('dbus_g_type_get_collection("GArray", G_TYPE_INT)', name)) - self.returncode.append("return garray_int_to_%s(%s);" % - (type[0].lower(), name)); - - # Special case for *_get_data functions, don't need client bindings, - # but do need the name so it doesn't crash - def inputgetdata(self, type, name): - raise myexception - def outputgetdata(self, type, name): - raise myexception - -class ServerBinding (Binding): - def __init__(self, functiontext, paramtexts): - Binding.__init__(self, functiontext, paramtexts) - self.dparams = "" - self.cparams = [] - self.cdecls = [] - self.ccode = [] - self.cparamsout = [] - self.ccodeout = [] - self.argfunc = "dbus_message_get_args" - - def flush(self): - print "static DBusMessage*" - print "%s_DBUS(DBusMessage *message_DBUS, DBusError *error_DBUS) {" % \ - self.function.name - - print "\tDBusMessage *reply_DBUS;" - - for decl in self.cdecls: - print decl - - print "\t%s(message_DBUS, error_DBUS," % self.argfunc, - for param in self.cparams: - print "DBUS_TYPE_%s, &%s," % param, - print "DBUS_TYPE_INVALID);" - - print "\tCHECK_ERROR(error_DBUS);" - - for code in self.ccode: - print code - - print "\treply_DBUS = dbus_message_new_method_return (message_DBUS);" - - print "\tdbus_message_append_args(reply_DBUS,", - for param in self.cparamsout: - if type(param) is str: - print "%s," % param, - else: - print "DBUS_TYPE_%s, &%s," % param, - print "DBUS_TYPE_INVALID);" - - for code in self.ccodeout: - print code - - print "\treturn reply_DBUS;\n}\n" - - - def addstring(self, *items): - for item in items: - self.dparams += item + r"\0" - - def addintype(self, type, name): - self.addstring("in", type, name) - - def addouttype(self, type, name): - self.addstring("out", type, name) - - - # input parameters - - def inputsimple(self, type, name, us): - if us: - self.cdecls.append("\tdbus_uint32_t %s;" % name) - self.cparams.append(("UINT32", name)) - self.addintype("u", name) - else: - self.cdecls.append("\tdbus_int32_t %s;" % name) - self.cparams.append(("INT32", name)) - self.addintype("i", name) - - def inputstring(self, type, name, us): - if us: - self.cdecls.append("\tconst unsigned char *%s;" % name) - else: - self.cdecls.append("\tconst char *%s;" % name) - self.cparams.append(("STRING", name)) - self.ccode.append("\t%s = (%s && %s[0]) ? %s : NULL;" % (name,name,name,name)) - self.addintype("s", name) - - def inputhash(self, type, name): - self.argfunc = "purple_dbus_message_get_args" - self.cdecls.append("\tDBusMessageIter %s_ITER;" % name) - self.cdecls.append("\tGHashTable *%s;" % name) - self.cparams.append(("ARRAY", "%s_ITER" % name)) - self.ccode.append("\t%s = purple_dbus_iter_hash_table(&%s_ITER, error_DBUS);" \ - % (name, name)) - self.ccode.append("\tCHECK_ERROR(error_DBUS);") - self.ccodeout.append("\tg_hash_table_destroy(%s);" % name) - self.addintype("a{ss}", name) - - def inputpurplestructure(self, type, name): - self.cdecls.append("\tdbus_int32_t %s_ID;" % name) - self.cdecls.append("\t%s *%s;" % (type[0], name)) - self.cparams.append(("INT32", name + "_ID")) - self.ccode.append("\tPURPLE_DBUS_ID_TO_POINTER(%s, %s_ID, %s, error_DBUS);" % \ - (name, name, type[0])) - self.addintype("i", name) - - def inputpointer(self, type, name): - self.cdecls.append("\tdbus_int32_t %s_NULL;" % name) - self.cdecls .append("\t%s *%s;" % (type[0], name)) - self.cparams.append(("INT32", name + "_NULL")) - self.ccode .append("\t%s = NULL;" % name) - self.addintype("i", name) - - # output parameters - - def outputvoid(self, type, name): - self.ccode.append("\t%s;" % self.call) # just call the function - - def outputstring(self, type, name, const): - if const: - self.cdecls.append("\tconst char *%s;" % name) - else: - self.cdecls.append("\tchar *%s;" % name) - self.ccode.append("\tif ((%s = %s) == NULL)" % (name, self.call)) - self.ccode.append("\t\t%s = \"\";" % (name)) - self.cparamsout.append(("STRING", name)) - self.addouttype("s", name) - if not const: - self.ccodeout.append("\tg_free(%s);" % name) - - def outputsimple(self, type, name, us): - if us: - self.cdecls.append("\tdbus_uint32_t %s;" % name) - self.cparamsout.append(("UINT32", name)) - self.addouttype("u", name) - else: - self.cdecls.append("\tdbus_int32_t %s;" % name) - self.cparamsout.append(("INT32", name)) - self.addouttype("i", name) - self.ccode.append("\t%s = %s;" % (name, self.call)) - - def outputpurplestructure(self, type, name): - self.cdecls.append("\tdbus_int32_t %s;" % name) - self.ccode .append("\tPURPLE_DBUS_POINTER_TO_ID(%s, %s, error_DBUS);" % (name, self.call)) - self.cparamsout.append(("INT32", name)) - self.addouttype("i", name) - - # GList*, GSList*, assume that list is a list of objects - # unless the function is in stringlists - def outputlist(self, type, name): - self.cdecls.append("\tdbus_int32_t %s_LEN;" % name) - self.ccodeout.append("\tg_free(%s);" % name) - - self.cdecls.append("\t%s *list;" % type[0]); - - if self.function.name in stringlists: - self.cdecls.append("\tchar **%s;" % name) - self.ccode.append("\tlist = %s;" % self.call) - self.ccode.append("\t%s = (char **)purple_%s_to_array(list, FALSE, &%s_LEN);" % \ - (name, type[0], name)) - self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &%s, %s_LEN" \ - % (name, name)) - if (not (self.function.name in constlists)): - type_name = type[0].lower()[1:] - self.ccodeout.append("\tg_%s_foreach(list, (GFunc)g_free, NULL);" % type_name) - self.ccodeout.append("\tg_%s_free(list);" % type_name) - self.addouttype("as", name) - else: - self.cdecls.append("\tdbus_int32_t *%s;" % name) - self.ccode.append("\tlist = %s;" % self.call) - self.ccode.append("\t%s = purple_dbusify_%s(list, FALSE, &%s_LEN);" % \ - (name, type[0], name)) - if (not (self.function.name in constlists)): - self.ccode.append("\tg_%s_free(list);" % type[0].lower()[1:]) - self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &%s, %s_LEN" \ - % (name, name)) - self.addouttype("ai", name) - - # Special case for *_get_data functions - def inputgetdata(self, type, name): - self.cdecls.append("\tsize_t %s = 0;" % name) - return True - def outputgetdata(self, type, name): - # This is a total hack, but self.call is set up before the parameters - # are processed, so we can't tell it to pass a parameter by reference. - self.call = "%s(%s)" % (self.function.name, - ", ".join([(param.name, "&len")[param.name == "len"] for param in self.params])) - - self.cdecls.append("\tgconstpointer %s;" % name) - self.ccode.append("\t%s = %s;" % (name, self.call)) - self.cparamsout.append("DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &%s, %s" \ - % (name, "len")) - self.addouttype("ay", name) - -class BindingSet: - regexp = r"^(\w[^()]*)\(([^()]*)\)\s*;\s*$"; - - def __init__(self, inputfile, fprefix): - self.inputiter = iter(inputfile) - self.functionregexp = \ - re.compile("^%s(\w[^()]*)\(([^()]*)\)\s*;\s*$" % fprefix) - self.typeregexp = re.compile("^\w+\s*\*?\s*$") - - - - def process(self): - print "/* Generated by %s. Do not edit! */" % sys.argv[0] - - for line in self.inputiter: - words = line.split() - if len(words) == 0: # empty line - continue - if line[0] == "#": # preprocessor directive - continue - if words[0] in ["typedef", "struct", "enum", "static"]: - continue - - # accumulate lines until the parentheses are balance or an - # empty line has been encountered - myline = line.strip() - while (myline.count("(") > myline.count(")")) or self.typeregexp.match(myline): - newline = self.inputiter.next().strip() - if len(newline) == 0: - break - myline += " " + newline - - # is this a function declaration? - thematch = self.functionregexp.match( - myline.replace("*", " " + pointer + " ")) - - if thematch is None: - continue - - functiontext = thematch.group(1) - paramstext = thematch.group(2).strip() - - if (paramstext == "void") or (paramstext == ""): - paramtexts = [] - else: - paramtexts = paramstext.split(",") - - try: - self.processfunction(functiontext, paramtexts) - except MyException: -# sys.stderr.write(myline + "\n") - pass - except: -# sys.stderr.write(myline + "\n") - raise - - self.flush() - -class ServerBindingSet (BindingSet): - def __init__(self, inputfile, fprefix): - BindingSet.__init__(self, inputfile, fprefix) - self.functions = [] - - - def processfunction(self, functiontext, paramtexts): - binding = ServerBinding(functiontext, paramtexts) - binding.process() - self.functions.append((binding.function.name, binding.dparams)) - - def flush(self): - print "static PurpleDBusBinding bindings_DBUS[] = { " - for function, params in self.functions: - print '{"%s", "%s", %s_DBUS},' % \ - (ctopascal(function), params, function) - - print "{NULL, NULL, NULL}" - print "};" - - print "#define PURPLE_DBUS_REGISTER_BINDINGS(handle) purple_dbus_register_bindings(handle, bindings_DBUS)" - -class ClientBindingSet (BindingSet): - def __init__(self, inputfile, fprefix, headersonly): - BindingSet.__init__(self, inputfile, fprefix) - self.functions = [] - self.knowntypes = [] - self.headersonly = headersonly - - def processfunction(self, functiontext, paramtexts): - binding = ClientBinding(functiontext, paramtexts, self.knowntypes, self.headersonly) - binding.process() - - def flush(self): - pass - -# Main program - -options = {} - -for arg in sys.argv[1:]: - if arg[0:2] == "--": - mylist = arg[2:].split("=",1) - command = mylist[0] - if len(mylist) > 1: - options[command] = mylist[1] - else: - options[command] = None - -if "export-only" in options: - fprefix = "DBUS_EXPORT\s+" -else: - fprefix = "" - -#sys.stderr.write("%s: Functions not exported:\n" % sys.argv[0]) - -if "client" in options: - bindings = ClientBindingSet(sys.stdin, fprefix, - options.has_key("headers")) -else: - bindings = ServerBindingSet(sys.stdin, fprefix) -bindings.process() - - - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-signals.py qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-signals.py --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-signals.py 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-signals.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -# This program takes a C source as the input and produces the list of -# all signals registered. -# -# Output is: -# -# -# - -import re -import sys - -# List "excluded" contains signals that shouldn't be exported via -# DBus. If you remove a signal from this list, please make sure -# that it does not break "make" with the configure option -# "--enable-dbus" turned on. - -excluded = [\ - # purple_dbus_signal_emit_purple prevents our "dbus-method-called" - # signal from being propagated to dbus. - "dbus-method-called", - ] - -registerregex = re.compile("purple_signal_register[^;]+\"([\w\-]+)\"[^;]+(purple_marshal_\w+)[^;]+;") -nameregex = re.compile('[-_][a-z]') - -print "/* Generated by %s. Do not edit! */" % sys.argv[0] -print "const char *dbus_signals = " -for match in registerregex.finditer(sys.stdin.read()): - signal = match.group(1) - marshal = match.group(2) - if signal in excluded: - continue - - signal = nameregex.sub(lambda x:x.group()[1].upper(), '-'+signal) - print "\"\\n\""%signal - - args = marshal.split('_') - # ['purple', 'marshal', , '', args...] - if len(args) > 4: - for arg in args[4:]: - if arg == "POINTER": - type = 'p' - elif arg == "ENUM": - type = 'i' - elif arg == "INT": - type = 'i' - elif arg == "UINT": - type = 'u' - elif arg == "INT64": - type = 'x' - elif arg == "UINT64": - type = 't' - elif arg == "BOOLEAN": - type = 'b' - print "\"\\n\""%type - - print "\"\\n\"" - -print ";" - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-types.py qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-types.py --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-types.py 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-analyze-types.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -# This program takes a C header/source as the input and produces -# -# with --keyword=enum: the list of all enums -# with --keyword=struct: the list of all structs -# -# the output styles: -# -# --enum DBUS_POINTER_NAME1, -# DBUS_POINTER_NAME2, -# DBUS_POINTER_NAME3, -# -# --list NAME1 -# NAME2 -# NAME3 -# - - -import re -import sys - -options = {} - -def toprint(match, line): - if verbatim: - return line - else: - return pattern % match - -for arg in sys.argv[1:]: - if arg[0:2] == "--": - mylist = arg[2:].split("=",1) - command = mylist[0] - if len(mylist) > 1: - options[command] = mylist[1] - else: - options[command] = None - -keyword = options.get("keyword", "struct") -pattern = options.get("pattern", "%s") -verbatim = options.has_key("verbatim") - -structregexp1 = re.compile(r"^(typedef\s+)?%s\s+\w+\s+(\w+)\s*;" % keyword) -structregexp2 = re.compile(r"^(typedef\s+)?%s" % keyword) -structregexp3 = re.compile(r"^}\s+(\w+)\s*;") - -print "/* Generated by %s. Do not edit! */" % sys.argv[0] - -myinput = iter(sys.stdin) - -for line in myinput: - match = structregexp1.match(line) - if match is not None: - print toprint(match.group(2), line) - continue - - match = structregexp2.match(line) - if match is not None: - while True: - if verbatim: - print line.rstrip() - line = myinput.next() - match = structregexp3.match(line) - if match is not None: - print toprint(match.group(1), line) - break - if line[0] not in [" ", "\t", "{", "\n"]: - if verbatim: - print line - break - - - - - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-bindings.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-bindings.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-bindings.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-bindings.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -/** - * @file dbus-bindings.h Purple DBUS Bindings - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _PURPLE_DBUS_BINDINGS_H_ -#define _PURPLE_DBUS_BINDINGS_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -gint purple_dbus_pointer_to_id(gconstpointer node); -gpointer purple_dbus_id_to_pointer(gint id, PurpleDBusType *type); -gint purple_dbus_pointer_to_id_error(gconstpointer ptr, DBusError *error); -gpointer purple_dbus_id_to_pointer_error(gint id, PurpleDBusType *type, - const char *typename, DBusError *error); - -#define NULLIFY(id) id = empty_to_null(id) - -#define CHECK_ERROR(error) if (dbus_error_is_set(error)) return NULL; - -#define PURPLE_DBUS_ID_TO_POINTER(ptr, id, type, error) \ - G_STMT_START { \ - ptr = (type*) purple_dbus_id_to_pointer_error \ - (id, PURPLE_DBUS_TYPE(type), #type, error); \ - CHECK_ERROR(error); \ - } G_STMT_END - - -#define PURPLE_DBUS_POINTER_TO_ID(id, ptr, error) \ - G_STMT_START { \ - id = purple_dbus_pointer_to_id_error(ptr,error); \ - CHECK_ERROR(error); \ - } G_STMT_END - - -dbus_bool_t -purple_dbus_message_get_args (DBusMessage *message, - DBusError *error, - int first_arg_type, - ...); -dbus_bool_t -purple_dbus_message_get_args_valist (DBusMessage *message, - DBusError *error, - int first_arg_type, - va_list var_args); - -dbus_bool_t -purple_dbus_message_iter_get_args (DBusMessageIter *iter, - DBusError *error, - int first_arg_type, - ...); - -dbus_bool_t -purple_dbus_message_iter_get_args_valist (DBusMessageIter *iter, - DBusError *error, - int first_arg_type, - va_list var_args); - -dbus_int32_t* purple_dbusify_GList(GList *list, gboolean free_memory, - dbus_int32_t *len); -dbus_int32_t* purple_dbusify_GSList(GSList *list, gboolean free_memory, - dbus_int32_t *len); -gpointer* purple_GList_to_array(GList *list, gboolean free_memory, - dbus_int32_t *len); -gpointer* purple_GSList_to_array(GSList *list, gboolean free_memory, - dbus_int32_t *len); -GHashTable *purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error); - -const char* empty_to_null(const char *str); -const char* null_to_empty(const char *s); - -typedef struct { - const char *name; - const char *parameters; - DBusMessage* (*handler)(DBusMessage *request, DBusError *error); -} PurpleDBusBinding; - -void purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings); - -DBusConnection *purple_dbus_get_connection(void); - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-define-api.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-define-api.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-define-api.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-define-api.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#error "This is file is not a valid C code" - -/* This file contains some of the macros from other header files as - function declarations. This does not make sense in C, but it - provides type information for the dbus-analyze-functions.py - program, which makes these macros callable by DBUS. */ - -/* blist.h */ -gboolean PURPLE_BLIST_NODE_IS_CHAT(PurpleBlistNode *node); -gboolean PURPLE_BLIST_NODE_IS_BUDDY(PurpleBlistNode *node); -gboolean PURPLE_BLIST_NODE_IS_CONTACT(PurpleBlistNode *node); -gboolean PURPLE_BLIST_NODE_IS_GROUP(PurpleBlistNode *node); -gboolean PURPLE_BUDDY_IS_ONLINE(PurpleBuddy *buddy); -gboolean PURPLE_BLIST_NODE_HAS_FLAG(PurpleBlistNode *node, int flags); -gboolean PURPLE_BLIST_NODE_SHOULD_SAVE(PurpleBlistNode *node); - -/* connection.h */ -gboolean PURPLE_CONNECTION_IS_CONNECTED(PurpleConnection *connection); -gboolean PURPLE_CONNECTION_IS_VALID(PurpleConnection *connection); - -/* conversation.h */ -PurpleConvIm *PURPLE_CONV_IM(const PurpleConversation *conversation); -PurpleConvIm *PURPLE_CONV_CHAT(const PurpleConversation *conversation); - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-maybe.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-maybe.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-maybe.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-maybe.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* This file contains macros that wrap calls to the purple dbus module. - These macros call the appropriate functions if the build includes - dbus support and do nothing otherwise. See "dbus-server.h" for - documentation. */ - -#ifndef _PURPLE_DBUS_MAYBE_H_ -#define _PURPLE_DBUS_MAYBE_H_ - -#ifdef HAVE_DBUS - -#ifndef DBUS_API_SUBJECT_TO_CHANGE -#define DBUS_API_SUBJECT_TO_CHANGE -#endif - -#include "dbus-server.h" - -/* this provides a type check */ -#define PURPLE_DBUS_REGISTER_POINTER(ptr, type) { \ - type *typed_ptr = ptr; \ - purple_dbus_register_pointer(typed_ptr, PURPLE_DBUS_TYPE(type)); \ -} -#define PURPLE_DBUS_UNREGISTER_POINTER(ptr) purple_dbus_unregister_pointer(ptr) - -#else /* !HAVE_DBUS */ - -#define PURPLE_DBUS_REGISTER_POINTER(ptr, type) { \ - if (ptr) {} \ -} - -#define PURPLE_DBUS_UNREGISTER_POINTER(ptr) -#define DBUS_EXPORT - -#endif /* HAVE_DBUS */ - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-purple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-purple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-purple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-purple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _DBUS_PURPLE_H_ -#define _DBUS_PURPLE_H_ - -#define DBUS_SERVICE_PURPLE "im.pidgin.purple.PurpleService" -#define DBUS_PATH_PURPLE "/im/pidgin/purple/PurpleObject" -#define DBUS_INTERFACE_PURPLE "im.pidgin.purple.PurpleInterface" - -#endif /* _DBUS_PURPLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,859 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef DBUS_API_SUBJECT_TO_CHANGE -#define DBUS_API_SUBJECT_TO_CHANGE -#endif - -/* Allow the code below to see deprecated functions, so we can continue to - * export them via DBus. */ -#undef PURPLE_DISABLE_DEPRECATED - -#include "internal.h" - -#include -#include -#include - -#include "account.h" -#include "blist.h" -#include "conversation.h" -#include "dbus-purple.h" -#include "dbus-server.h" -#include "dbus-useful.h" -#include "dbus-bindings.h" -#include "debug.h" -#include "core.h" -#include "savedstatuses.h" -#include "smiley.h" -#include "util.h" -#include "value.h" -#include "xmlnode.h" - - -/**************************************************************************/ -/** @name Purple DBUS pointer registration mechanism */ -/**************************************************************************/ - -/* - * Here we include the list of #PURPLE_DBUS_DEFINE_TYPE statements for - * all structs defined in purple. This file has been generated by the - * #dbus-analyze-types.py script. - */ - -#include "dbus-types.c" - -/* - * The following three hashtables map are used to translate between - * pointers (nodes) and the corresponding handles (ids). - */ - -static GHashTable *map_node_id; -static GHashTable *map_id_node; -static GHashTable *map_id_type; - -static gchar *init_error; -static int dbus_request_name_reply = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER; - -gboolean purple_dbus_is_owner(void) -{ - return(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER == dbus_request_name_reply); -} - -/** - * This function initializes the pointer-id traslation system. It - * creates the three above hashtables and defines parents of some types. - */ -void -purple_dbus_init_ids(void) -{ - map_id_node = g_hash_table_new(g_direct_hash, g_direct_equal); - map_id_type = g_hash_table_new(g_direct_hash, g_direct_equal); - map_node_id = g_hash_table_new(g_direct_hash, g_direct_equal); - - PURPLE_DBUS_TYPE(PurpleBuddy)->parent = PURPLE_DBUS_TYPE(PurpleBlistNode); - PURPLE_DBUS_TYPE(PurpleContact)->parent = PURPLE_DBUS_TYPE(PurpleBlistNode); - PURPLE_DBUS_TYPE(PurpleChat)->parent = PURPLE_DBUS_TYPE(PurpleBlistNode); - PURPLE_DBUS_TYPE(PurpleGroup)->parent = PURPLE_DBUS_TYPE(PurpleBlistNode); -} - -void -purple_dbus_register_pointer(gpointer node, PurpleDBusType *type) -{ - static gint last_id = 0; - - g_return_if_fail(map_node_id); - g_return_if_fail(g_hash_table_lookup(map_node_id, node) == NULL); - - last_id++; - g_hash_table_insert(map_node_id, node, GINT_TO_POINTER(last_id)); - g_hash_table_insert(map_id_node, GINT_TO_POINTER(last_id), node); - g_hash_table_insert(map_id_type, GINT_TO_POINTER(last_id), type); -} - -void -purple_dbus_unregister_pointer(gpointer node) -{ - gpointer id = g_hash_table_lookup(map_node_id, node); - - g_hash_table_remove(map_node_id, node); - g_hash_table_remove(map_id_node, GINT_TO_POINTER(id)); - g_hash_table_remove(map_id_type, GINT_TO_POINTER(id)); -} - -gint -purple_dbus_pointer_to_id(gconstpointer node) -{ - gint id = GPOINTER_TO_INT(g_hash_table_lookup(map_node_id, node)); - if ((id == 0) && (node != NULL)) - { - if (purple_debug_is_verbose()) - purple_debug_warning("dbus", - "Need to register an object with the dbus subsystem." - " (If you are not a developer, please ignore this message.)\n"); - return 0; - } - return id; -} - -gpointer -purple_dbus_id_to_pointer(gint id, PurpleDBusType *type) -{ - PurpleDBusType *objtype; - - objtype = (PurpleDBusType*)g_hash_table_lookup(map_id_type, - GINT_TO_POINTER(id)); - - while (objtype != type && objtype != NULL) - objtype = objtype->parent; - - if (objtype == type) - return g_hash_table_lookup(map_id_node, GINT_TO_POINTER(id)); - else - return NULL; -} - -gint -purple_dbus_pointer_to_id_error(gconstpointer ptr, DBusError *error) -{ - gint id = purple_dbus_pointer_to_id(ptr); - - if (ptr != NULL && id == 0) - dbus_set_error(error, "im.pidgin.purple.ObjectNotFound", - "The return object is not mapped (this is a Purple error)"); - - return id; -} - -gpointer -purple_dbus_id_to_pointer_error(gint id, PurpleDBusType *type, - const char *typename, DBusError *error) -{ - gpointer ptr = purple_dbus_id_to_pointer(id, type); - - if (ptr == NULL && id != 0) - dbus_set_error(error, "im.pidgin.purple.InvalidHandle", - "%s object with ID = %i not found", typename, id); - - return ptr; -} - - -/**************************************************************************/ -/** @name Modified versions of some DBus functions */ -/**************************************************************************/ - -dbus_bool_t -purple_dbus_message_get_args(DBusMessage *message, - DBusError *error, int first_arg_type, ...) -{ - dbus_bool_t retval; - va_list var_args; - - va_start(var_args, first_arg_type); - retval = purple_dbus_message_get_args_valist(message, error, first_arg_type, var_args); - va_end(var_args); - - return retval; -} - -dbus_bool_t -purple_dbus_message_get_args_valist(DBusMessage *message, - DBusError *error, int first_arg_type, va_list var_args) -{ - DBusMessageIter iter; - - dbus_message_iter_init(message, &iter); - return purple_dbus_message_iter_get_args_valist(&iter, error, first_arg_type, var_args); -} - -dbus_bool_t -purple_dbus_message_iter_get_args(DBusMessageIter *iter, - DBusError *error, int first_arg_type, ...) -{ - dbus_bool_t retval; - va_list var_args; - - va_start(var_args, first_arg_type); - retval = purple_dbus_message_iter_get_args_valist(iter, error, first_arg_type, var_args); - va_end(var_args); - - return retval; -} - -#define TYPE_IS_CONTAINER(typecode) \ - ((typecode) == DBUS_TYPE_STRUCT || \ - (typecode) == DBUS_TYPE_DICT_ENTRY || \ - (typecode) == DBUS_TYPE_VARIANT || \ - (typecode) == DBUS_TYPE_ARRAY) - - -dbus_bool_t -purple_dbus_message_iter_get_args_valist(DBusMessageIter *iter, - DBusError *error, int first_arg_type, va_list var_args) -{ - int spec_type, msg_type, i; - - spec_type = first_arg_type; - - for (i = 0; spec_type != DBUS_TYPE_INVALID; i++) - { - msg_type = dbus_message_iter_get_arg_type(iter); - - if (msg_type != spec_type) - { - dbus_set_error(error, DBUS_ERROR_INVALID_ARGS, - "Argument %d is specified to be of type \"%i\", but " - "is actually of type \"%i\"\n", i, - spec_type, msg_type); - return FALSE; - } - - if (!TYPE_IS_CONTAINER(spec_type)) - { - gpointer ptr; - ptr = va_arg (var_args, gpointer); - dbus_message_iter_get_basic(iter, ptr); - } - else - { - DBusMessageIter *sub; - sub = va_arg (var_args, DBusMessageIter*); - dbus_message_iter_recurse(iter, sub); - purple_debug_info("dbus", "subiter %p:%p\n", sub, * (gpointer*) sub); - break; /* for testing only! */ - } - - spec_type = va_arg(var_args, int); - if (!dbus_message_iter_next(iter) && spec_type != DBUS_TYPE_INVALID) - { - dbus_set_error (error, DBUS_ERROR_INVALID_ARGS, - "Message has only %d arguments, but more were expected", i); - return FALSE; - } - } - - return TRUE; -} - - - -/**************************************************************************/ -/** @name Useful functions */ -/**************************************************************************/ - -const char *empty_to_null(const char *str) -{ - if (str == NULL || str[0] == 0) - return NULL; - else - return str; -} - -const char * -null_to_empty(const char *s) -{ - if (s) - return s; - else - return ""; -} - -dbus_int32_t * -purple_dbusify_GList(GList *list, gboolean free_memory, dbus_int32_t *len) -{ - dbus_int32_t *array; - int i; - GList *elem; - - *len = g_list_length(list); - array = g_new0(dbus_int32_t, *len); - for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) - array[i] = purple_dbus_pointer_to_id(elem->data); - - if (free_memory) - g_list_free(list); - - return array; -} - -dbus_int32_t * -purple_dbusify_GSList(GSList *list, gboolean free_memory, dbus_int32_t *len) -{ - dbus_int32_t *array; - int i; - GSList *elem; - - *len = g_slist_length(list); - array = g_new0(dbus_int32_t, *len); - for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) - array[i] = purple_dbus_pointer_to_id(elem->data); - - if (free_memory) - g_slist_free(list); - - return array; -} - -gpointer * -purple_GList_to_array(GList *list, gboolean free_memory, dbus_int32_t *len) -{ - gpointer *array; - int i; - GList *elem; - - *len = g_list_length(list); - array = g_new0(gpointer, *len); - for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) - array[i] = elem->data; - - if (free_memory) - g_list_free(list); - - return array; -} - -gpointer * -purple_GSList_to_array(GSList *list, gboolean free_memory, dbus_int32_t *len) -{ - gpointer *array; - int i; - GSList *elem; - - *len = g_slist_length(list); - array = g_new0(gpointer, *len); - for (i = 0, elem = list; elem != NULL; elem = elem->next, i++) - array[i] = elem->data; - - if (free_memory) - g_slist_free(list); - - return array; -} - -GHashTable * -purple_dbus_iter_hash_table(DBusMessageIter *iter, DBusError *error) -{ - GHashTable *hash; - - /* we do not need to destroy strings because they are part of the message */ - hash = g_hash_table_new(g_str_hash, g_str_equal); - - do { - char *key, *value; - DBusMessageIter subiter; - - if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_DICT_ENTRY) - goto error; - /* With all due respect to Dijkstra, - * this goto is for exception - * handling, and it is ok because it - * avoids duplication of the code - * responsible for destroying the hash - * table. Exceptional instructions - * for exceptional situations. - */ - - dbus_message_iter_recurse(iter, &subiter); - if (!purple_dbus_message_iter_get_args(&subiter, error, - DBUS_TYPE_STRING, &key, - DBUS_TYPE_STRING, &value, - DBUS_TYPE_INVALID)) - goto error; /* same here */ - - g_hash_table_insert(hash, key, value); - } while (dbus_message_iter_next(iter)); - - return hash; - -error: - g_hash_table_destroy(hash); - return NULL; -} - -/**************************************************************/ -/* DBus bindings ... */ -/**************************************************************/ - -static DBusConnection *purple_dbus_connection; - -DBusConnection * -purple_dbus_get_connection(void) -{ - return purple_dbus_connection; -} - -#include "dbus-bindings.c" -#include "dbus-signals.c" - -static gboolean -purple_dbus_dispatch_cb(DBusConnection *connection, - DBusMessage *message, void *user_data) -{ - const char *name; - PurpleDBusBinding *bindings; - int i; - - bindings = (PurpleDBusBinding*) user_data; - - if (!dbus_message_has_path(message, DBUS_PATH_PURPLE)) - return FALSE; - - name = dbus_message_get_member(message); - - if (name == NULL) - return FALSE; - - if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_METHOD_CALL) - return FALSE; - - for (i = 0; bindings[i].name; i++) - if (!strcmp(name, bindings[i].name)) - { - DBusMessage *reply; - DBusError error; - - dbus_error_init(&error); - - reply = bindings[i].handler(message, &error); - - if (reply == NULL && dbus_error_is_set(&error)) - reply = dbus_message_new_error (message, - error.name, error.message); - - if (reply != NULL) - { - dbus_connection_send(connection, reply, NULL); - dbus_message_unref(reply); - } - - return TRUE; /* return reply! */ - } - - return FALSE; -} - - -static const char * -dbus_gettext(const char **ptr) -{ - const char *text = *ptr; - *ptr += strlen(text) + 1; - return text; -} - -static void -purple_dbus_introspect_cb(GList **bindings_list, void *bindings) -{ - *bindings_list = g_list_prepend(*bindings_list, bindings); -} - -static DBusMessage *purple_dbus_introspect(DBusMessage *message) -{ - DBusMessage *reply; - GString *str; - GList *bindings_list, *node; - const char *signals; - const char *type; - const char *pointer_type; - - str = g_string_sized_new(0x1000); /* TODO: why this size? */ - - g_string_append(str, "\n"); - g_string_append_printf(str, "\n", DBUS_PATH_PURPLE); - g_string_append_printf(str, "\n", DBUS_INTERFACE_PURPLE); - - bindings_list = NULL; - purple_signal_emit(purple_dbus_get_handle(), "dbus-introspect", &bindings_list); - - for (node = bindings_list; node; node = node->next) - { - PurpleDBusBinding *bindings; - int i; - - bindings = (PurpleDBusBinding*)node->data; - - for (i = 0; bindings[i].name; i++) - { - const char *text; - - g_string_append_printf(str, "\n", bindings[i].name); - - text = bindings[i].parameters; - while (*text) - { - const char *name, *direction, *type; - - direction = dbus_gettext(&text); - type = dbus_gettext(&text); - name = dbus_gettext(&text); - - g_string_append_printf(str, - "\n", - name, type, direction); - } - g_string_append(str, "\n"); - } - } - - if (sizeof(int) == sizeof(dbus_int32_t)) - pointer_type = "type='i'"; - else - pointer_type = "type='x'"; - - signals = dbus_signals; - while ((type = strstr(signals, "type='p'")) != NULL) { - g_string_append_len(str, signals, type - signals); - g_string_append(str, pointer_type); - signals = type + sizeof("type='p'") - 1; - } - g_string_append(str, signals); - - g_string_append(str, "\n\n"); - - reply = dbus_message_new_method_return(message); - dbus_message_append_args(reply, DBUS_TYPE_STRING, &(str->str), - DBUS_TYPE_INVALID); - g_string_free(str, TRUE); - g_list_free(bindings_list); - - return reply; -} - -static DBusHandlerResult -purple_dbus_dispatch(DBusConnection *connection, - DBusMessage *message, void *user_data) -{ - if (purple_signal_emit_return_1(purple_dbus_get_handle(), - "dbus-method-called", connection, message)) - return DBUS_HANDLER_RESULT_HANDLED; - - if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL && - dbus_message_has_path(message, DBUS_PATH_PURPLE) && - dbus_message_has_interface(message, DBUS_INTERFACE_INTROSPECTABLE) && - dbus_message_has_member(message, "Introspect")) - { - DBusMessage *reply; - reply = purple_dbus_introspect(message); - dbus_connection_send (connection, reply, NULL); - dbus_message_unref(reply); - return DBUS_HANDLER_RESULT_HANDLED; - } - - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -void -purple_dbus_register_bindings(void *handle, PurpleDBusBinding *bindings) -{ - purple_signal_connect(purple_dbus_get_handle(), "dbus-method-called", - handle, - PURPLE_CALLBACK(purple_dbus_dispatch_cb), - bindings); - purple_signal_connect(purple_dbus_get_handle(), "dbus-introspect", - handle, - PURPLE_CALLBACK(purple_dbus_introspect_cb), - bindings); -} - -static void -purple_dbus_dispatch_init(void) -{ - static DBusObjectPathVTable vtable = {NULL, &purple_dbus_dispatch, NULL, NULL, NULL, NULL}; - DBusError error; - int result; - - dbus_error_init(&error); - purple_dbus_connection = dbus_bus_get(DBUS_BUS_STARTER, &error); - - if (purple_dbus_connection == NULL) - { - init_error = g_strdup_printf(N_("Failed to get connection: %s"), error.message); - dbus_error_free(&error); - return; - } - - /* Do not allow libdbus to exit on connection failure (This may - work around random exit(1) on SIGPIPE errors) */ - dbus_connection_set_exit_on_disconnect (purple_dbus_connection, FALSE); - - if (!dbus_connection_register_object_path(purple_dbus_connection, - DBUS_PATH_PURPLE, &vtable, NULL)) - { - init_error = g_strdup_printf(N_("Failed to get name: %s"), error.name); - dbus_error_free(&error); - return; - } - - dbus_request_name_reply = - result = dbus_bus_request_name(purple_dbus_connection, - DBUS_SERVICE_PURPLE, 0, &error); - - if (dbus_error_is_set(&error)) - { - dbus_connection_unref(purple_dbus_connection); - dbus_error_free(&error); - purple_dbus_connection = NULL; - init_error = g_strdup_printf(N_("Failed to get serv name: %s"), error.name); - return; - } - - dbus_connection_setup_with_g_main(purple_dbus_connection, NULL); - - purple_debug_misc("dbus", "okkk\n"); - - purple_signal_register(purple_dbus_get_handle(), "dbus-method-called", - purple_marshal_BOOLEAN__POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 2, - purple_value_new(PURPLE_TYPE_POINTER), - purple_value_new(PURPLE_TYPE_POINTER)); - - purple_signal_register(purple_dbus_get_handle(), "dbus-introspect", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new_outgoing(PURPLE_TYPE_POINTER)); - - PURPLE_DBUS_REGISTER_BINDINGS(purple_dbus_get_handle()); -} - - - -/**************************************************************************/ -/** @name Signals */ -/**************************************************************************/ - - - -static char * -purple_dbus_convert_signal_name(const char *purple_name) -{ - int purple_index, g_index; - char *g_name = g_new(char, strlen(purple_name) + 1); - gboolean capitalize_next = TRUE; - - for (purple_index = g_index = 0; purple_name[purple_index]; purple_index++) - if (purple_name[purple_index] != '-' && purple_name[purple_index] != '_') - { - if (capitalize_next) - g_name[g_index++] = g_ascii_toupper(purple_name[purple_index]); - else - g_name[g_index++] = purple_name[purple_index]; - capitalize_next = FALSE; - } else - capitalize_next = TRUE; - - g_name[g_index] = 0; - - return g_name; -} - -#define my_arg(type) (ptr != NULL ? * ((type *)ptr) : va_arg(data, type)) - -static gboolean -purple_dbus_message_append_purple_values(DBusMessageIter *iter, - int number, PurpleValue **purple_values, va_list data) -{ - int i; - gboolean error = FALSE; - - for (i = 0; i < number; i++) - { - const char *str; - int id; - gint xint; - guint xuint; - gint64 xint64; - guint64 xuint64; - gboolean xboolean; - gpointer ptr = NULL; - gpointer val; - - if (purple_value_is_outgoing(purple_values[i])) - { - ptr = my_arg(gpointer); - g_return_val_if_fail(ptr, TRUE); - } - - switch (purple_values[i]->type) - { - case PURPLE_TYPE_INT: - case PURPLE_TYPE_ENUM: - xint = my_arg(gint); - dbus_message_iter_append_basic(iter, DBUS_TYPE_INT32, &xint); - break; - case PURPLE_TYPE_UINT: - xuint = my_arg(guint); - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &xuint); - break; - case PURPLE_TYPE_INT64: - xint64 = my_arg(gint64); - dbus_message_iter_append_basic(iter, DBUS_TYPE_INT64, &xint64); - break; - case PURPLE_TYPE_UINT64: - xuint64 = my_arg(guint64); - dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT64, &xuint64); - break; - case PURPLE_TYPE_BOOLEAN: - xboolean = my_arg(gboolean); - dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &xboolean); - break; - case PURPLE_TYPE_STRING: - str = null_to_empty(my_arg(char*)); - if (!g_utf8_validate(str, -1, NULL)) { - gchar *tmp; - purple_debug_error("dbus", "Invalid UTF-8 string passed to signal, emitting salvaged string!\n"); - tmp = purple_utf8_salvage(str); - dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &tmp); - g_free(tmp); - } else { - dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &str); - } - break; - case PURPLE_TYPE_SUBTYPE: /* registered pointers only! */ - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_OBJECT: - case PURPLE_TYPE_BOXED: - val = my_arg(gpointer); - id = purple_dbus_pointer_to_id(val); - if (id == 0 && val != NULL) - error = TRUE; /* Some error happened. */ - dbus_message_iter_append_basic(iter, - (sizeof(id) == sizeof(dbus_int32_t)) ? DBUS_TYPE_INT32 : DBUS_TYPE_INT64, &id); - break; - default: /* no conversion implemented */ - g_return_val_if_reached(TRUE); - } - } - return error; -} - -#undef my_arg - -void -purple_dbus_signal_emit_purple(const char *name, int num_values, - PurpleValue **values, va_list vargs) -{ - DBusMessage *signal; - DBusMessageIter iter; - char *newname; - -#if 0 /* this is noisy with no dbus connection */ - g_return_if_fail(purple_dbus_connection); -#else - if (purple_dbus_connection == NULL) - return; -#endif - - - /* - * The test below is a hack that prevents our "dbus-method-called" - * signal from being propagated to dbus. What we really need is a - * flag for each signal that states whether this signal is to be - * dbus-propagated or not. - */ - if (!strcmp(name, "dbus-method-called")) - return; - - newname = purple_dbus_convert_signal_name(name); - signal = dbus_message_new_signal(DBUS_PATH_PURPLE, DBUS_INTERFACE_PURPLE, newname); - dbus_message_iter_init_append(signal, &iter); - - if (purple_dbus_message_append_purple_values(&iter, num_values, values, vargs)) - if (purple_debug_is_verbose()) - purple_debug_warning("dbus", - "The signal \"%s\" caused some dbus error." - " (If you are not a developer, please ignore this message.)\n", - name); - - dbus_connection_send(purple_dbus_connection, signal, NULL); - - g_free(newname); - dbus_message_unref(signal); -} - -const char * -purple_dbus_get_init_error(void) -{ - return init_error; -} - -void * -purple_dbus_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_dbus_init(void) -{ - if (g_thread_supported()) - dbus_g_thread_init(); - - purple_dbus_init_ids(); - - g_free(init_error); - init_error = NULL; - purple_dbus_dispatch_init(); - if (init_error != NULL) - purple_debug_error("dbus", "%s\n", init_error); -} - -void -purple_dbus_uninit(void) -{ - DBusError error; - if (!purple_dbus_connection) - return; - - dbus_error_init(&error); - dbus_connection_unregister_object_path(purple_dbus_connection, DBUS_PATH_PURPLE); - dbus_bus_release_name(purple_dbus_connection, DBUS_SERVICE_PURPLE, &error); - dbus_error_free(&error); - dbus_connection_unref(purple_dbus_connection); - purple_dbus_connection = NULL; - purple_signals_disconnect_by_handle(purple_dbus_get_handle()); - g_free(init_error); - init_error = NULL; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-server.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -/** - * @file dbus-server.h Purple DBUS Server - * @ingroup core - * @see @ref dbus-server-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_DBUS_SERVER_H_ -#define _PURPLE_DBUS_SERVER_H_ - -#include "dbus-purple.h" -#include "value.h" - -G_BEGIN_DECLS - -/** - Types of pointers are identified by the ADDRESS of a PurpleDbusType - object. This way, plugins can easily access types defined in purple - proper as well as introduce their own types that will not conflict - with those introduced by other plugins. - - The structure PurpleDbusType has only one element (PurpleDBusType::parent), a - contains a pointer to the parent type, or @c NULL if the type has no - parent. Parent means the same as the base class in object oriented - programming. -*/ - -typedef struct _PurpleDBusType PurpleDBusType; - -struct _PurpleDBusType { - PurpleDBusType *parent; -}; - -#include "dbus-bindings.h" - -/* By convention, the PurpleDBusType variable representing each structure - PurpleSomeStructure has the name PURPLE_DBUS_TYPE_PurpleSomeStructure. - The following macros facilitate defining such variables - - #PURPLE_DBUS_DECLARE_TYPE declares an extern variable representing a - given type, for use in header files. - - #PURPLE_DBUS_DEFINE_TYPE defines a variable representing a given - type, use in .c files. It defines a new type without a parent; for - types with a parent use #PURPLE_DBUS_DEFINE_INHERITING_TYPE. - */ - -#define PURPLE_DBUS_TYPE(type) (&PURPLE_DBUS_TYPE_##type) - - -#define PURPLE_DBUS_DECLARE_TYPE(type) \ - extern PurpleDBusType PURPLE_DBUS_TYPE_##type; - -#define PURPLE_DBUS_DEFINE_TYPE(type) \ - PurpleDBusType PURPLE_DBUS_TYPE_##type = { NULL }; - -#define PURPLE_DBUS_DEFINE_INHERITING_TYPE(type, parent) \ - PurpleDBusType PURPLE_DBUS_TYPE_##type = { PURPLE_DBUS_TYPE(parent) }; - -#define PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin) \ - if (purple_dbus_get_init_error() != NULL) \ - { \ - gchar *title; \ - title = g_strdup_printf("Unable to Load %s Plugin", plugin->info->name); \ - purple_notify_error(NULL, title, \ - _("Purple's D-BUS server is not running for the reason listed below"), \ - _(purple_dbus_get_init_error())); \ - g_free(title); \ - return FALSE; \ - } - -/** - Initializes purple dbus pointer registration engine. - - Remote dbus applications need a way of addressing objects exposed - by purple to the outside world. In purple itself, these objects (such - as PurpleBuddy and company) are identified by pointers. The purple - dbus pointer registration engine converts pointers to handles and - back. - - In order for an object to participate in the scheme, it must - register itself and its type with the engine. This registration - allocates an integer id which can be resolved to the pointer and - back. - - Handles are not persistent. They are reissued every time purple is - started. This is not good; external applications that use purple - should work even whether purple was restarted in the middle of the - interaction. - - Pointer registration is only a temporary solution. When PurpleBuddy - and similar structures have been converted into gobjects, this - registration will be done automatically by objects themselves. - - By the way, this kind of object-handle translation should be so - common that there must be a library (maybe even glib) that - implements it. I feel a bit like reinventing the wheel here. -*/ -void purple_dbus_init_ids(void); - -/** - Registers a typed pointer. - - @param node The pointer to register. - @param type Type of that pointer. - */ -void purple_dbus_register_pointer(gpointer node, PurpleDBusType *type); - -/** - Unregisters a pointer previously registered with - purple_dbus_register_pointer. - - @param node The pointer to register. - */ -void purple_dbus_unregister_pointer(gpointer node); - - - -/** - Emits a dbus signal. - - @param name The name of the signal ("bla-bla-blaa") - @param num_values The number of parameters. - @param values Array of pointers to #PurpleValue objects representing - the types of the parameters. - @param vargs A va_list containing the actual parameters. - */ -void purple_dbus_signal_emit_purple(const char *name, int num_values, - PurpleValue **values, va_list vargs); - -/** - * Returns whether Purple's D-BUS subsystem is up and running. If it's - * NOT running then purple_dbus_dispatch_init() failed for some reason, - * and a message should have been purple_debug_error()'ed. - * - * Purple plugins that use D-BUS should use the - * PURPLE_DBUS_RETURN_FALSE_IF_DISABLED macro to short-circuit - * initialization if Purple's D-BUS subsystem is not running. - * - * @return If the D-BUS subsystem started with no problems then this - * will return NULL and everything will be hunky dory. If - * there was an error initializing the D-BUS subsystem then - * this will return an error message explaining why. - */ -const char *purple_dbus_get_init_error(void); - -/** - * Returns the dbus subsystem handle. - * - * @return The dbus subsystem handle. - */ -void *purple_dbus_get_handle(void); - -/** - * Determines whether this instance owns the DBus service name - * - * @since 2.1.0 - */ -gboolean purple_dbus_is_owner(void); - -/** - * Starts Purple's D-BUS server. It is responsible for handling DBUS - * requests from other applications. - */ -void purple_dbus_init(void); - -/** - * Uninitializes Purple's D-BUS server. - */ -void purple_dbus_uninit(void); - -/** - - Macro #DBUS_EXPORT expands to nothing. It is used to indicate to the - dbus-analyze-functions.py script that the given function should be - available to other applications through DBUS. If - dbus-analyze-functions.py is run without the "--export-only" option, - this prefix is ignored. - - */ - -#define DBUS_EXPORT - -/* - Here we include the list of #PURPLE_DBUS_DECLARE_TYPE statements for - all structs defined in purple. This file has been generated by the - #dbus-analyze-types.py script. -*/ - -#include "dbus-types.h" - -G_END_DECLS - -#endif /* _PURPLE_DBUS_SERVER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-types.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-types.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-types.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-types.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/* Generated by ./dbus-analyze-types.py. Do not edit! */ -PURPLE_DBUS_DECLARE_TYPE(PurpleAccountUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleAccount) -PURPLE_DBUS_DECLARE_TYPE(PurpleAccountOption) -PURPLE_DBUS_DECLARE_TYPE(PurpleAccountUserSplit) -PURPLE_DBUS_DECLARE_TYPE(PurpleBuddyList) -PURPLE_DBUS_DECLARE_TYPE(PurpleBlistUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleBlistNode) -PURPLE_DBUS_DECLARE_TYPE(PurpleChat) -PURPLE_DBUS_DECLARE_TYPE(PurpleGroup) -PURPLE_DBUS_DECLARE_TYPE(PurpleContact) -PURPLE_DBUS_DECLARE_TYPE(PurpleBuddy) -PURPLE_DBUS_DECLARE_TYPE(PurpleBuddyIcon) -PURPLE_DBUS_DECLARE_TYPE(PurpleCertificate) -PURPLE_DBUS_DECLARE_TYPE(PurpleCertificatePool) -PURPLE_DBUS_DECLARE_TYPE(PurpleCertificateScheme) -PURPLE_DBUS_DECLARE_TYPE(PurpleCertificateVerifier) -PURPLE_DBUS_DECLARE_TYPE(PurpleCertificateVerificationRequest) -PURPLE_DBUS_DECLARE_TYPE(PurpleCipher) -PURPLE_DBUS_DECLARE_TYPE(PurpleCipherOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleCipherContext) -PURPLE_DBUS_DECLARE_TYPE(PurpleCircBuffer) -PURPLE_DBUS_DECLARE_TYPE(PurpleConnection) -PURPLE_DBUS_DECLARE_TYPE(PurpleConnectionErrorInfo) -PURPLE_DBUS_DECLARE_TYPE(PurpleConnectionUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleConversationUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleConversation) -PURPLE_DBUS_DECLARE_TYPE(PurpleConvIm) -PURPLE_DBUS_DECLARE_TYPE(PurpleConvChat) -PURPLE_DBUS_DECLARE_TYPE(PurpleConvChatBuddy) -PURPLE_DBUS_DECLARE_TYPE(PurpleConvMessage) -PURPLE_DBUS_DECLARE_TYPE(PurpleCore) -PURPLE_DBUS_DECLARE_TYPE(PurpleCoreUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleDebugUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleDesktopItem) -PURPLE_DBUS_DECLARE_TYPE(PurpleEventLoopUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleXfer) -PURPLE_DBUS_DECLARE_TYPE(PurpleXferUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleIdleUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleStoredImage) -PURPLE_DBUS_DECLARE_TYPE(PurpleLog) -PURPLE_DBUS_DECLARE_TYPE(PurpleLogLogger) -PURPLE_DBUS_DECLARE_TYPE(PurpleLogCommonLoggerData) -PURPLE_DBUS_DECLARE_TYPE(PurpleLogSet) -PURPLE_DBUS_DECLARE_TYPE(PurpleMedia) -PURPLE_DBUS_DECLARE_TYPE(PurpleMediaCandidate) -PURPLE_DBUS_DECLARE_TYPE(PurpleMediaCodec) -PURPLE_DBUS_DECLARE_TYPE(PurpleMediaElementInfo) -PURPLE_DBUS_DECLARE_TYPE(PurpleMediaElementInfoClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleMediaManager) -PURPLE_DBUS_DECLARE_TYPE(PurpleMediaManagerClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleMimeDocument) -PURPLE_DBUS_DECLARE_TYPE(PurpleMimePart) -PURPLE_DBUS_DECLARE_TYPE(PurpleNetworkListenData) -PURPLE_DBUS_DECLARE_TYPE(PurpleNotifyUserInfoEntry) -PURPLE_DBUS_DECLARE_TYPE(PurpleNotifyUserInfo) -PURPLE_DBUS_DECLARE_TYPE(PurpleNotifySearchResults) -PURPLE_DBUS_DECLARE_TYPE(PurpleNotifySearchColumn) -PURPLE_DBUS_DECLARE_TYPE(PurpleNotifySearchButton) -PURPLE_DBUS_DECLARE_TYPE(PurpleNotifyUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurplePlugin) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginInfo) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginUiInfo) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginLoaderInfo) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginAction) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginPrefFrame) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginPref) -PURPLE_DBUS_DECLARE_TYPE(PurplePounce) -PURPLE_DBUS_DECLARE_TYPE(PurplePrivacyUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleProxyInfo) -PURPLE_DBUS_DECLARE_TYPE(PurpleProxyConnectData) -PURPLE_DBUS_DECLARE_TYPE(PurplePluginProtocolInfo) -PURPLE_DBUS_DECLARE_TYPE(PurpleAttentionType) -PURPLE_DBUS_DECLARE_TYPE(PurpleBuddyIconSpec) -PURPLE_DBUS_DECLARE_TYPE(PurpleRequestField) -PURPLE_DBUS_DECLARE_TYPE(PurpleRequestFields) -PURPLE_DBUS_DECLARE_TYPE(PurpleRequestFieldGroup) -PURPLE_DBUS_DECLARE_TYPE(PurpleRequestUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleRoomlist) -PURPLE_DBUS_DECLARE_TYPE(PurpleRoomlistRoom) -PURPLE_DBUS_DECLARE_TYPE(PurpleRoomlistField) -PURPLE_DBUS_DECLARE_TYPE(PurpleRoomlistUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleSavedStatus) -PURPLE_DBUS_DECLARE_TYPE(PurpleSavedStatusSub) -PURPLE_DBUS_DECLARE_TYPE(PurpleSmiley) -PURPLE_DBUS_DECLARE_TYPE(PurpleSmileyClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleDnsQueryData) -PURPLE_DBUS_DECLARE_TYPE(PurpleDnsQueryUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleSrvQueryData) -PURPLE_DBUS_DECLARE_TYPE(PurpleSrvResponse) -PURPLE_DBUS_DECLARE_TYPE(PurpleTxtResponse) -PURPLE_DBUS_DECLARE_TYPE(PurpleStatusType) -PURPLE_DBUS_DECLARE_TYPE(PurpleStatusAttr) -PURPLE_DBUS_DECLARE_TYPE(PurplePresence) -PURPLE_DBUS_DECLARE_TYPE(PurpleStatus) -PURPLE_DBUS_DECLARE_TYPE(PurpleStringref) -PURPLE_DBUS_DECLARE_TYPE(PurpleStunNatDiscovery) -PURPLE_DBUS_DECLARE_TYPE(PurpleSoundUiOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleSoundTheme) -PURPLE_DBUS_DECLARE_TYPE(PurpleSoundThemeClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleSoundThemeLoader) -PURPLE_DBUS_DECLARE_TYPE(PurpleSoundThemeLoaderClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleSslConnection) -PURPLE_DBUS_DECLARE_TYPE(PurpleSslOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleTheme) -PURPLE_DBUS_DECLARE_TYPE(PurpleThemeClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleThemeLoader) -PURPLE_DBUS_DECLARE_TYPE(PurpleThemeLoaderClass) -PURPLE_DBUS_DECLARE_TYPE(PurpleThemeManager) -PURPLE_DBUS_DECLARE_TYPE(PurpleThemeManagerClass) -PURPLE_DBUS_DECLARE_TYPE(UPnPMappingAddRemove) -PURPLE_DBUS_DECLARE_TYPE(PurpleUtilFetchUrlData) -PURPLE_DBUS_DECLARE_TYPE(PurpleMenuAction) -PURPLE_DBUS_DECLARE_TYPE(PurpleKeyValuePair) -PURPLE_DBUS_DECLARE_TYPE(PurpleValue) -PURPLE_DBUS_DECLARE_TYPE(xmlnode) -PURPLE_DBUS_DECLARE_TYPE(PurpleWhiteboardPrplOps) -PURPLE_DBUS_DECLARE_TYPE(PurpleWhiteboard) -PURPLE_DBUS_DECLARE_TYPE(PurpleWhiteboardUiOps) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -#include -#include - -#include "dbus-useful.h" -#include "conversation.h" -#include "util.h" - - -PurpleAccount * -purple_accounts_find_ext(const char *name, const char *protocol_id, - gboolean (*account_test)(const PurpleAccount *account)) -{ - PurpleAccount *result = NULL; - GList *l; - char *who; - - if (name) - who = g_strdup(purple_normalize(NULL, name)); - else - who = NULL; - - for (l = purple_accounts_get_all(); l != NULL; l = l->next) { - PurpleAccount *account = (PurpleAccount *)l->data; - - if (who && strcmp(purple_normalize(NULL, purple_account_get_username(account)), who)) - continue; - - if (protocol_id && strcmp(account->protocol_id, protocol_id)) - continue; - - if (account_test && !account_test(account)) - continue; - - result = account; - break; - } - - g_free(who); - - return result; -} - -PurpleAccount *purple_accounts_find_any(const char *name, const char *protocol) -{ - return purple_accounts_find_ext(name, protocol, NULL); -} - -PurpleAccount *purple_accounts_find_connected(const char *name, const char *protocol) -{ - return purple_accounts_find_ext(name, protocol, purple_account_is_connected); -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dbus-useful.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#include "conversation.h" - -PurpleAccount *purple_accounts_find_ext(const char *name, const char *protocol_id, - gboolean (*account_test)(const PurpleAccount *account)); - -PurpleAccount *purple_accounts_find_any(const char *name, const char *protocol); - -PurpleAccount *purple_accounts_find_connected(const char *name, const char *protocol); - - - - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,235 +0,0 @@ -/** - * @file debug.c Debug API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "prefs.h" -#include "util.h" - -static PurpleDebugUiOps *debug_ui_ops = NULL; - -/* - * This determines whether debug info should be written to the - * console or not. - * - * It doesn't make sense to make this a normal Purple preference - * because it's a command line option. This will always be FALSE, - * unless the user explicitly started the UI with the -d flag. - * It doesn't matter what this value was the last time Purple was - * started, so it doesn't make sense to save it in prefs. - */ -static gboolean debug_enabled = FALSE; - -/* - * These determine whether verbose or unsafe debugging are desired. I - * don't want to make these purple preferences because their values should - * not be remembered across instances of the UI. - */ -static gboolean debug_verbose = FALSE; -static gboolean debug_unsafe = FALSE; - -static void -purple_debug_vargs(PurpleDebugLevel level, const char *category, - const char *format, va_list args) -{ - PurpleDebugUiOps *ops; - char *arg_s = NULL; - - g_return_if_fail(level != PURPLE_DEBUG_ALL); - g_return_if_fail(format != NULL); - - ops = purple_debug_get_ui_ops(); - - if (!debug_enabled && ((ops == NULL) || (ops->print == NULL) || - (ops->is_enabled && !ops->is_enabled(level, category)))) - return; - - arg_s = g_strdup_vprintf(format, args); - - if (debug_enabled) { - gchar *ts_s; - const char *mdate; - time_t mtime = time(NULL); - - - mdate = purple_utf8_strftime("%H:%M:%S", localtime(&mtime)); - ts_s = g_strdup_printf("(%s) ", mdate); - - if (category == NULL) - g_print("%s%s", ts_s, arg_s); - else - g_print("%s%s: %s", ts_s, category, arg_s); - - g_free(ts_s); - } - - if (ops != NULL && ops->print != NULL) - ops->print(level, category, arg_s); - - g_free(arg_s); -} - -void -purple_debug(PurpleDebugLevel level, const char *category, - const char *format, ...) -{ - va_list args; - - g_return_if_fail(level != PURPLE_DEBUG_ALL); - g_return_if_fail(format != NULL); - - va_start(args, format); - purple_debug_vargs(level, category, format, args); - va_end(args); -} - -void -purple_debug_misc(const char *category, const char *format, ...) -{ - va_list args; - - g_return_if_fail(format != NULL); - - va_start(args, format); - purple_debug_vargs(PURPLE_DEBUG_MISC, category, format, args); - va_end(args); -} - -void -purple_debug_info(const char *category, const char *format, ...) -{ - va_list args; - - g_return_if_fail(format != NULL); - - va_start(args, format); - purple_debug_vargs(PURPLE_DEBUG_INFO, category, format, args); - va_end(args); -} - -void -purple_debug_warning(const char *category, const char *format, ...) -{ - va_list args; - - g_return_if_fail(format != NULL); - - va_start(args, format); - purple_debug_vargs(PURPLE_DEBUG_WARNING, category, format, args); - va_end(args); -} - -void -purple_debug_error(const char *category, const char *format, ...) -{ - va_list args; - - g_return_if_fail(format != NULL); - - va_start(args, format); - purple_debug_vargs(PURPLE_DEBUG_ERROR, category, format, args); - va_end(args); -} - -void -purple_debug_fatal(const char *category, const char *format, ...) -{ - va_list args; - - g_return_if_fail(format != NULL); - - va_start(args, format); - purple_debug_vargs(PURPLE_DEBUG_FATAL, category, format, args); - va_end(args); -} - -void -purple_debug_set_enabled(gboolean enabled) -{ - debug_enabled = enabled; -} - -gboolean -purple_debug_is_enabled() -{ - return debug_enabled; -} - -void -purple_debug_set_ui_ops(PurpleDebugUiOps *ops) -{ - debug_ui_ops = ops; -} - -gboolean -purple_debug_is_verbose() -{ - return debug_verbose; -} - -void -purple_debug_set_verbose(gboolean verbose) -{ - debug_verbose = verbose; -} - -gboolean -purple_debug_is_unsafe() -{ - return debug_unsafe; -} - -void -purple_debug_set_unsafe(gboolean unsafe) -{ - debug_unsafe = unsafe; -} - -PurpleDebugUiOps * -purple_debug_get_ui_ops(void) -{ - return debug_ui_ops; -} - -void -purple_debug_init(void) -{ - /* Read environment variables once per init */ - if(g_getenv("PURPLE_UNSAFE_DEBUG")) - purple_debug_set_unsafe(TRUE); - - if(g_getenv("PURPLE_VERBOSE_DEBUG")) - purple_debug_set_verbose(TRUE); - - purple_prefs_add_none("/purple/debug"); - - /* - * This pref is obsolete and no longer referenced anywhere. It only - * survives here because it would be an API break if we removed it. - * Remove this when we get to 3.0.0 :) - */ - purple_prefs_add_bool("/purple/debug/timestamps", TRUE); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/debug.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,239 +0,0 @@ -/** - * @file debug.h Debug API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_DEBUG_H_ -#define _PURPLE_DEBUG_H_ - -#include -#include - -/** - * Debug levels. - */ -typedef enum -{ - PURPLE_DEBUG_ALL = 0, /**< All debug levels. */ - PURPLE_DEBUG_MISC, /**< General chatter. */ - PURPLE_DEBUG_INFO, /**< General operation Information. */ - PURPLE_DEBUG_WARNING, /**< Warnings. */ - PURPLE_DEBUG_ERROR, /**< Errors. */ - PURPLE_DEBUG_FATAL /**< Fatal errors. */ - -} PurpleDebugLevel; - -/** - * Debug UI operations. - */ -typedef struct -{ - void (*print)(PurpleDebugLevel level, const char *category, - const char *arg_s); - gboolean (*is_enabled)(PurpleDebugLevel level, - const char *category); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleDebugUiOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Debug API */ -/**************************************************************************/ -/** - * Outputs debug information. - * - * @param level The debug level. - * @param category The category (or @c NULL). - * @param format The format string. - */ -void purple_debug(PurpleDebugLevel level, const char *category, - const char *format, ...) G_GNUC_PRINTF(3, 4); - -/** - * Outputs misc. level debug information. - * - * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_MISC as - * the level. - * - * @param category The category (or @c NULL). - * @param format The format string. - * - * @see purple_debug() - */ -void purple_debug_misc(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); - -/** - * Outputs info level debug information. - * - * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_INFO as - * the level. - * - * @param category The category (or @c NULL). - * @param format The format string. - * - * @see purple_debug() - */ -void purple_debug_info(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); - -/** - * Outputs warning level debug information. - * - * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_WARNING as - * the level. - * - * @param category The category (or @c NULL). - * @param format The format string. - * - * @see purple_debug() - */ -void purple_debug_warning(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); - -/** - * Outputs error level debug information. - * - * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as - * the level. - * - * @param category The category (or @c NULL). - * @param format The format string. - * - * @see purple_debug() - */ -void purple_debug_error(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); - -/** - * Outputs fatal error level debug information. - * - * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as - * the level. - * - * @param category The category (or @c NULL). - * @param format The format string. - * - * @see purple_debug() - */ -void purple_debug_fatal(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3); - -/** - * Enable or disable printing debug output to the console. - * - * @param enabled TRUE to enable debug output or FALSE to disable it. - */ -void purple_debug_set_enabled(gboolean enabled); - -/** - * Check if console debug output is enabled. - * - * @return TRUE if debugging is enabled, FALSE if it is not. - */ -gboolean purple_debug_is_enabled(void); - -/** - * Enable or disable verbose debugging. This ordinarily should only be called - * by #purple_debug_init, but there are cases where this can be useful for - * plugins. - * - * @param verbose TRUE to enable verbose debugging or FALSE to disable it. - * - * @since 2.6.0 - */ -void purple_debug_set_verbose(gboolean verbose); - -/** - * Check if verbose logging is enabled. - * - * @return TRUE if verbose debugging is enabled, FALSE if it is not. - * - * @since 2.6.0 - */ -gboolean purple_debug_is_verbose(void); - -/** - * Enable or disable verbose debugging. This ordinarily should only be called - * by #purple_debug_init, but there are cases where this can be useful for - * plugins. - * - * @param unsafe TRUE to enable verbose debugging or FALSE to disable it. - * - * @since 2.6.0 - */ -void purple_debug_set_unsafe(gboolean unsafe); - -/** - * Check if unsafe debugging is enabled. - * - * @return TRUE if verbose debugging is enabled, FALSE if it is not. - * - * @since 2.6.0 - */ -gboolean purple_debug_is_unsafe(void); - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used when outputting debug - * information. - * - * @param ops The UI operations structure. - */ -void purple_debug_set_ui_ops(PurpleDebugUiOps *ops); - -/** - * Returns the UI operations structure used when outputting debug - * information. - * - * @return The UI operations structure in use. - */ -PurpleDebugUiOps *purple_debug_get_ui_ops(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Debug Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Initializes the debug subsystem. - */ -void purple_debug_init(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_DEBUG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1273 +0,0 @@ -/** - * @file purple-desktop-item.c Functions for managing .desktop files - * @ingroup core - */ - -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* - * The following code has been adapted from gnome-desktop-item.[ch], - * as found on gnome-desktop-2.8.1. - * - * Copyright (C) 2004 by Alceste Scalas . - * - * Original copyright notice: - * - * Copyright (C) 1999, 2000 Red Hat Inc. - * Copyright (C) 2001 Sid Vicious - * All rights reserved. - * - * This file is part of the Gnome Library. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02111-1301, USA. - */ - -#include "internal.h" -#include -#include -#include -#include -#include "desktopitem.h" - -struct _PurpleDesktopItem { - int refcount; - - /* all languages used */ - GList *languages; - - PurpleDesktopItemType type; - - /* `modified' means that the ditem has been - * modified since the last save. */ - gboolean modified; - - /* Keys of the main section only */ - GList *keys; - - GList *sections; - - /* This includes ALL keys, including - * other sections, separated by '/' */ - GHashTable *main_hash; - - char *location; - - time_t mtime; -}; - -typedef struct { - char *name; - GList *keys; -} Section; - -typedef enum { - ENCODING_UNKNOWN, - ENCODING_UTF8, - ENCODING_LEGACY_MIXED -} Encoding; - -/************************************************************************** - * Private utility functions - **************************************************************************/ -static PurpleDesktopItemType -type_from_string (const char *type) -{ - if (!type) - return PURPLE_DESKTOP_ITEM_TYPE_NULL; - - switch (type [0]) { - case 'A': - if (purple_strequal (type, "Application")) - return PURPLE_DESKTOP_ITEM_TYPE_APPLICATION; - break; - case 'L': - if (purple_strequal (type, "Link")) - return PURPLE_DESKTOP_ITEM_TYPE_LINK; - break; - case 'F': - if (purple_strequal (type, "FSDevice")) - return PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE; - break; - case 'M': - if (purple_strequal (type, "MimeType")) - return PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE; - break; - case 'D': - if (purple_strequal (type, "Directory")) - return PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY; - break; - case 'S': - if (purple_strequal (type, "Service")) - return PURPLE_DESKTOP_ITEM_TYPE_SERVICE; - - else if (purple_strequal (type, "ServiceType")) - return PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE; - break; - default: - break; - } - - return PURPLE_DESKTOP_ITEM_TYPE_OTHER; -} - -static Section * -find_section (PurpleDesktopItem *item, const char *section) -{ - GList *li; - Section *sec; - - if (section == NULL) - return NULL; - if (purple_strequal (section, "Desktop Entry")) - return NULL; - - for (li = item->sections; li != NULL; li = li->next) { - sec = li->data; - if (purple_strequal (sec->name, section)) - return sec; - } - - sec = g_new0 (Section, 1); - sec->name = g_strdup (section); - sec->keys = NULL; - - item->sections = g_list_append (item->sections, sec); - - /* Don't mark the item modified, this is just an empty section, - * it won't be saved even */ - - return sec; -} - -static Section * -section_from_key (PurpleDesktopItem *item, const char *key) -{ - char *p; - char *name; - Section *sec; - - if (key == NULL) - return NULL; - - p = strchr (key, '/'); - if (p == NULL) - return NULL; - - name = g_strndup (key, p - key); - - sec = find_section (item, name); - - g_free (name); - - return sec; -} - -static const char * -key_basename (const char *key) -{ - char *p = strrchr (key, '/'); - if (p != NULL) - return p+1; - else - return key; -} - -static void -set (PurpleDesktopItem *item, const char *key, const char *value) -{ - Section *sec = section_from_key (item, key); - - if (sec != NULL) { - if (value != NULL) { - if (g_hash_table_lookup (item->main_hash, key) == NULL) - sec->keys = g_list_append - (sec->keys, - g_strdup (key_basename (key))); - - g_hash_table_replace (item->main_hash, - g_strdup (key), - g_strdup (value)); - } else { - GList *list = g_list_find_custom - (sec->keys, key_basename (key), - (GCompareFunc)strcmp); - if (list != NULL) { - g_free (list->data); - sec->keys = - g_list_delete_link (sec->keys, list); - } - g_hash_table_remove (item->main_hash, key); - } - } else { - if (value != NULL) { - if (g_hash_table_lookup (item->main_hash, key) == NULL) - item->keys = g_list_append (item->keys, - g_strdup (key)); - - g_hash_table_replace (item->main_hash, - g_strdup (key), - g_strdup (value)); - } else { - GList *list = g_list_find_custom - (item->keys, key, (GCompareFunc)strcmp); - if (list != NULL) { - g_free (list->data); - item->keys = - g_list_delete_link (item->keys, list); - } - g_hash_table_remove (item->main_hash, key); - } - } - item->modified = TRUE; -} - - -static void -_purple_desktop_item_set_string (PurpleDesktopItem *item, - const char *attr, - const char *value) -{ - g_return_if_fail (item != NULL); - g_return_if_fail (item->refcount > 0); - g_return_if_fail (attr != NULL); - - set (item, attr, value); - - if (purple_strequal (attr, PURPLE_DESKTOP_ITEM_TYPE)) - item->type = type_from_string (value); -} - -static PurpleDesktopItem * -_purple_desktop_item_new (void) -{ - PurpleDesktopItem *retval; - - retval = g_new0 (PurpleDesktopItem, 1); - - retval->refcount++; - - retval->main_hash = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_free); - - /* These are guaranteed to be set */ - _purple_desktop_item_set_string (retval, - PURPLE_DESKTOP_ITEM_NAME, - _("No name")); - _purple_desktop_item_set_string (retval, - PURPLE_DESKTOP_ITEM_ENCODING, - "UTF-8"); - _purple_desktop_item_set_string (retval, - PURPLE_DESKTOP_ITEM_VERSION, - "1.0"); - - return retval; -} - -static gpointer -_purple_desktop_item_copy (gpointer boxed) -{ - return purple_desktop_item_copy (boxed); -} - -static void -_purple_desktop_item_free (gpointer boxed) -{ - purple_desktop_item_unref (boxed); -} - -/* Note, does not include the trailing \n */ -static char * -my_fgets (char *buf, gsize bufsize, FILE *df) -{ - int c; - gsize pos; - - g_return_val_if_fail (buf != NULL, NULL); - g_return_val_if_fail (df != NULL, NULL); - - pos = 0; - buf[0] = '\0'; - - do { - c = getc (df); - if (c == EOF || c == '\n') - break; - buf[pos++] = c; - } while (pos < bufsize-1); - - if (c == EOF && pos == 0) - return NULL; - - buf[pos++] = '\0'; - - return buf; -} - -static Encoding -get_encoding (FILE *df) -{ - gboolean old_kde = FALSE; - char buf [BUFSIZ]; - gboolean all_valid_utf8 = TRUE; - - while (my_fgets (buf, sizeof (buf), df) != NULL) { - if (strncmp (PURPLE_DESKTOP_ITEM_ENCODING, - buf, - strlen (PURPLE_DESKTOP_ITEM_ENCODING)) == 0) { - char *p = &buf[strlen (PURPLE_DESKTOP_ITEM_ENCODING)]; - if (*p == ' ') - p++; - if (*p != '=') - continue; - p++; - if (*p == ' ') - p++; - if (purple_strequal (p, "UTF-8")) { - return ENCODING_UTF8; - } else if (purple_strequal (p, "Legacy-Mixed")) { - return ENCODING_LEGACY_MIXED; - } else { - /* According to the spec we're not supposed - * to read a file like this */ - return ENCODING_UNKNOWN; - } - } else if (purple_strequal ("[KDE Desktop Entry]", buf)) { - old_kde = TRUE; - /* don't break yet, we still want to support - * Encoding even here */ - } - if (all_valid_utf8 && ! g_utf8_validate (buf, -1, NULL)) - all_valid_utf8 = FALSE; - } - - if (old_kde) - return ENCODING_LEGACY_MIXED; - - /* A dilemma, new KDE files are in UTF-8 but have no Encoding - * info, at this time we really can't tell. The best thing to - * do right now is to just assume UTF-8 if the whole file - * validates as utf8 I suppose */ - - if (all_valid_utf8) - return ENCODING_UTF8; - else - return ENCODING_LEGACY_MIXED; -} - -static char * -snarf_locale_from_key (const char *key) -{ - const char *brace; - char *locale, *p; - - brace = strchr (key, '['); - if (brace == NULL) - return NULL; - - locale = g_strdup (brace + 1); - if (*locale == '\0') { - g_free (locale); - return NULL; - } - p = strchr (locale, ']'); - if (p == NULL) { - g_free (locale); - return NULL; - } - *p = '\0'; - return locale; -} - -static gboolean -check_locale (const char *locale) -{ - GIConv cd = g_iconv_open ("UTF-8", locale); - if ((GIConv)-1 == cd) - return FALSE; - g_iconv_close (cd); - return TRUE; -} - -static void -insert_locales (GHashTable *encodings, char *enc, ...) -{ - va_list args; - char *s; - - va_start (args, enc); - for (;;) { - s = va_arg (args, char *); - if (s == NULL) - break; - g_hash_table_insert (encodings, s, enc); - } - va_end (args); -} - -/* make a standard conversion table from the desktop standard spec */ -static GHashTable * -init_encodings (void) -{ - GHashTable *encodings = g_hash_table_new (g_str_hash, g_str_equal); - - /* "C" is plain ascii */ - insert_locales (encodings, "ASCII", "C", NULL); - - insert_locales (encodings, "ARMSCII-8", "by", NULL); - insert_locales (encodings, "BIG5", "zh_TW", NULL); - insert_locales (encodings, "CP1251", "be", "bg", NULL); - if (check_locale ("EUC-CN")) { - insert_locales (encodings, "EUC-CN", "zh_CN", NULL); - } else { - insert_locales (encodings, "GB2312", "zh_CN", NULL); - } - insert_locales (encodings, "EUC-JP", "ja", NULL); - insert_locales (encodings, "EUC-KR", "ko", NULL); - /*insert_locales (encodings, "GEORGIAN-ACADEMY", NULL);*/ - insert_locales (encodings, "GEORGIAN-PS", "ka", NULL); - insert_locales (encodings, "ISO-8859-1", "br", "ca", "da", "de", "en", "es", "eu", "fi", "fr", "gl", "it", "nl", "wa", "no", "pt", "pt", "sv", NULL); - insert_locales (encodings, "ISO-8859-2", "cs", "hr", "hu", "pl", "ro", "sk", "sl", "sq", "sr", NULL); - insert_locales (encodings, "ISO-8859-3", "eo", NULL); - insert_locales (encodings, "ISO-8859-5", "mk", "sp", NULL); - insert_locales (encodings, "ISO-8859-7", "el", NULL); - insert_locales (encodings, "ISO-8859-9", "tr", NULL); - insert_locales (encodings, "ISO-8859-13", "lt", "lv", "mi", NULL); - insert_locales (encodings, "ISO-8859-14", "ga", "cy", NULL); - insert_locales (encodings, "ISO-8859-15", "et", NULL); - insert_locales (encodings, "KOI8-R", "ru", NULL); - insert_locales (encodings, "KOI8-U", "uk", NULL); - if (check_locale ("TCVN-5712")) { - insert_locales (encodings, "TCVN-5712", "vi", NULL); - } else { - insert_locales (encodings, "TCVN", "vi", NULL); - } - insert_locales (encodings, "TIS-620", "th", NULL); - /*insert_locales (encodings, "VISCII", NULL);*/ - - return encodings; -} - -static const char * -get_encoding_from_locale (const char *locale) -{ - char lang[3]; - const char *encoding; - static GHashTable *encodings = NULL; - - if (locale == NULL) - return NULL; - - /* if locale includes encoding, use it */ - encoding = strchr (locale, '.'); - if (encoding != NULL) { - return encoding+1; - } - - if (encodings == NULL) - encodings = init_encodings (); - - /* first try the entire locale (at this point ll_CC) */ - encoding = g_hash_table_lookup (encodings, locale); - if (encoding != NULL) - return encoding; - - /* Try just the language */ - strncpy (lang, locale, 2); - lang[2] = '\0'; - return g_hash_table_lookup (encodings, lang); -} - -static char * -decode_string_and_dup (const char *s) -{ - char *p = g_malloc (strlen (s) + 1); - char *q = p; - - do { - if (*s == '\\'){ - switch (*(++s)){ - case 's': - *p++ = ' '; - break; - case 't': - *p++ = '\t'; - break; - case 'n': - *p++ = '\n'; - break; - case '\\': - *p++ = '\\'; - break; - case 'r': - *p++ = '\r'; - break; - default: - *p++ = '\\'; - *p++ = *s; - break; - } - } else { - *p++ = *s; - } - } while (*s++); - - return q; -} - -static char * -decode_string (const char *value, Encoding encoding, const char *locale) -{ - char *retval = NULL; - - /* if legacy mixed, then convert */ - if (locale != NULL && encoding == ENCODING_LEGACY_MIXED) { - const char *char_encoding = get_encoding_from_locale (locale); - char *utf8_string; - if (char_encoding == NULL) - return NULL; - if (purple_strequal (char_encoding, "ASCII")) { - return decode_string_and_dup (value); - } - utf8_string = g_convert (value, -1, "UTF-8", char_encoding, - NULL, NULL, NULL); - if (utf8_string == NULL) - return NULL; - retval = decode_string_and_dup (utf8_string); - g_free (utf8_string); - return retval; - /* if utf8, then validate */ - } else if (locale != NULL && encoding == ENCODING_UTF8) { - if ( ! g_utf8_validate (value, -1, NULL)) - /* invalid utf8, ignore this key */ - return NULL; - return decode_string_and_dup (value); - } else { - /* Meaning this is not a localized string */ - return decode_string_and_dup (value); - } -} - -/************************************************************ - * Parser: * - ************************************************************/ - -static gboolean G_GNUC_CONST -standard_is_boolean (const char * key) -{ - static GHashTable *bools = NULL; - - if (bools == NULL) { - bools = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (bools, - PURPLE_DESKTOP_ITEM_NO_DISPLAY, - PURPLE_DESKTOP_ITEM_NO_DISPLAY); - g_hash_table_insert (bools, - PURPLE_DESKTOP_ITEM_HIDDEN, - PURPLE_DESKTOP_ITEM_HIDDEN); - g_hash_table_insert (bools, - PURPLE_DESKTOP_ITEM_TERMINAL, - PURPLE_DESKTOP_ITEM_TERMINAL); - g_hash_table_insert (bools, - PURPLE_DESKTOP_ITEM_READ_ONLY, - PURPLE_DESKTOP_ITEM_READ_ONLY); - } - - return g_hash_table_lookup (bools, key) != NULL; -} - -static gboolean G_GNUC_CONST -standard_is_strings (const char *key) -{ - static GHashTable *strings = NULL; - - if (strings == NULL) { - strings = g_hash_table_new (g_str_hash, g_str_equal); - g_hash_table_insert (strings, - PURPLE_DESKTOP_ITEM_FILE_PATTERN, - PURPLE_DESKTOP_ITEM_FILE_PATTERN); - g_hash_table_insert (strings, - PURPLE_DESKTOP_ITEM_ACTIONS, - PURPLE_DESKTOP_ITEM_ACTIONS); - g_hash_table_insert (strings, - PURPLE_DESKTOP_ITEM_MIME_TYPE, - PURPLE_DESKTOP_ITEM_MIME_TYPE); - g_hash_table_insert (strings, - PURPLE_DESKTOP_ITEM_PATTERNS, - PURPLE_DESKTOP_ITEM_PATTERNS); - g_hash_table_insert (strings, - PURPLE_DESKTOP_ITEM_SORT_ORDER, - PURPLE_DESKTOP_ITEM_SORT_ORDER); - } - - return g_hash_table_lookup (strings, key) != NULL; -} - -/* If no need to cannonize, returns NULL */ -static char * -cannonize (const char *key, const char *value) -{ - if (standard_is_boolean (key)) { - if (value[0] == 'T' || - value[0] == 't' || - value[0] == 'Y' || - value[0] == 'y' || - atoi (value) != 0) { - return g_strdup ("true"); - } else { - return g_strdup ("false"); - } - } else if (standard_is_strings (key)) { - int len = strlen (value); - if (len == 0 || value[len-1] != ';') { - return g_strconcat (value, ";", NULL); - } - } - /* XXX: Perhaps we should canonize numeric values as well, but this - * has caused some subtle problems before so it needs to be done - * carefully if at all */ - return NULL; -} - -static void -insert_key (PurpleDesktopItem *item, - Section *cur_section, - Encoding encoding, - const char *key, - const char *value, - gboolean old_kde, - gboolean no_translations) -{ - char *k; - char *val; - /* we always store everything in UTF-8 */ - if (cur_section == NULL && - purple_strequal (key, PURPLE_DESKTOP_ITEM_ENCODING)) { - k = g_strdup (key); - val = g_strdup ("UTF-8"); - } else { - char *locale = snarf_locale_from_key (key); - /* If we're ignoring translations */ - if (no_translations && locale != NULL) { - g_free (locale); - return; - } - val = decode_string (value, encoding, locale); - - /* Ignore this key, it's whacked */ - if (val == NULL) { - g_free (locale); - return; - } - - g_strchomp (val); - - /* For old KDE entries, we can also split by a comma - * on sort order, so convert to semicolons */ - if (old_kde && - cur_section == NULL && - purple_strequal (key, PURPLE_DESKTOP_ITEM_SORT_ORDER) && - strchr (val, ';') == NULL) { - int i; - for (i = 0; val[i] != '\0'; i++) { - if (val[i] == ',') - val[i] = ';'; - } - } - - /* Check some types, not perfect, but catches a lot - * of things */ - if (cur_section == NULL) { - char *cannon = cannonize (key, val); - if (cannon != NULL) { - g_free (val); - val = cannon; - } - } - - k = g_strdup (key); - - /* Take care of the language part */ - if (locale != NULL && - purple_strequal (locale, "C")) { - char *p; - /* Whack C locale */ - p = strchr (k, '['); - if(p) *p = '\0'; - g_free (locale); - } else if (locale != NULL) { - char *p, *brace; - - /* Whack the encoding part */ - p = strchr (locale, '.'); - if (p != NULL) - *p = '\0'; - - if (g_list_find_custom (item->languages, locale, - (GCompareFunc)strcmp) == NULL) { - item->languages = g_list_prepend - (item->languages, locale); - } else { - g_free (locale); - } - - /* Whack encoding from encoding in the key */ - brace = strchr (k, '['); - if(brace != NULL) { - p = strchr (brace, '.'); - if (p != NULL) { - *p = ']'; - *(p+1) = '\0'; - } - } - } - } - - - if (cur_section == NULL) { - /* only add to list if we haven't seen it before */ - if (g_hash_table_lookup (item->main_hash, k) == NULL) { - item->keys = g_list_prepend (item->keys, - g_strdup (k)); - } - /* later duplicates override earlier ones */ - g_hash_table_replace (item->main_hash, k, val); - } else { - char *full = g_strdup_printf - ("%s/%s", - cur_section->name, k); - /* only add to list if we haven't seen it before */ - if (g_hash_table_lookup (item->main_hash, full) == NULL) { - cur_section->keys = - g_list_prepend (cur_section->keys, k); - } - /* later duplicates override earlier ones */ - g_hash_table_replace (item->main_hash, - full, val); - } -} - -static const char * -lookup (const PurpleDesktopItem *item, const char *key) -{ - return g_hash_table_lookup (item->main_hash, key); -} - -static void -setup_type (PurpleDesktopItem *item, const char *uri) -{ - const char *type = g_hash_table_lookup (item->main_hash, - PURPLE_DESKTOP_ITEM_TYPE); - if (type == NULL && uri != NULL) { - char *base = g_path_get_basename (uri); - if (purple_strequal(base, ".directory")) { - /* This gotta be a directory */ - g_hash_table_replace (item->main_hash, - g_strdup (PURPLE_DESKTOP_ITEM_TYPE), - g_strdup ("Directory")); - item->keys = g_list_prepend - (item->keys, g_strdup (PURPLE_DESKTOP_ITEM_TYPE)); - item->type = PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY; - } else { - item->type = PURPLE_DESKTOP_ITEM_TYPE_NULL; - } - g_free (base); - } else { - item->type = type_from_string (type); - } -} - -static const char * -lookup_locale (const PurpleDesktopItem *item, const char *key, const char *locale) -{ - if (locale == NULL || - purple_strequal (locale, "C")) { - return lookup (item, key); - } else { - const char *ret; - char *full = g_strdup_printf ("%s[%s]", key, locale); - ret = lookup (item, full); - g_free (full); - return ret; - } -} - -/** - * Fallback to find something suitable for C locale. - * - * @return A newly allocated string which should be g_freed by the caller. - */ -static char * -try_english_key (PurpleDesktopItem *item, const char *key) -{ - char *str = NULL; - char *locales[] = { "en_US", "en_GB", "en_AU", "en", NULL }; - int i; - - for (i = 0; locales[i] != NULL && str == NULL; i++) { - str = g_strdup (lookup_locale (item, key, locales[i])); - } - if (str != NULL) { - /* We need a 7-bit ascii string, so whack all - * above 127 chars */ - guchar *p; - for (p = (guchar *)str; *p != '\0'; p++) { - if (*p > 127) - *p = '?'; - } - } - return str; -} - - -static void -sanitize (PurpleDesktopItem *item, const char *uri) -{ - const char *type; - - type = lookup (item, PURPLE_DESKTOP_ITEM_TYPE); - - /* understand old gnome style url exec thingies */ - if (purple_strequal(type, "URL")) { - const char *exec = lookup (item, PURPLE_DESKTOP_ITEM_EXEC); - set (item, PURPLE_DESKTOP_ITEM_TYPE, "Link"); - if (exec != NULL) { - /* Note, this must be in this order */ - set (item, PURPLE_DESKTOP_ITEM_URL, exec); - set (item, PURPLE_DESKTOP_ITEM_EXEC, NULL); - } - } - - /* we make sure we have Name, Encoding and Version */ - if (lookup (item, PURPLE_DESKTOP_ITEM_NAME) == NULL) { - char *name = try_english_key (item, PURPLE_DESKTOP_ITEM_NAME); - /* If no name, use the basename */ - if (name == NULL && uri != NULL) - name = g_path_get_basename (uri); - /* If no uri either, use same default as gnome_desktop_item_new */ - if (name == NULL) - name = g_strdup (_("No name")); - g_hash_table_replace (item->main_hash, - g_strdup (PURPLE_DESKTOP_ITEM_NAME), - name); - item->keys = g_list_prepend - (item->keys, g_strdup (PURPLE_DESKTOP_ITEM_NAME)); - } - if (lookup (item, PURPLE_DESKTOP_ITEM_ENCODING) == NULL) { - /* We store everything in UTF-8 so write that down */ - g_hash_table_replace (item->main_hash, - g_strdup (PURPLE_DESKTOP_ITEM_ENCODING), - g_strdup ("UTF-8")); - item->keys = g_list_prepend - (item->keys, g_strdup (PURPLE_DESKTOP_ITEM_ENCODING)); - } - if (lookup (item, PURPLE_DESKTOP_ITEM_VERSION) == NULL) { - /* this is the version that we follow, so write it down */ - g_hash_table_replace (item->main_hash, - g_strdup (PURPLE_DESKTOP_ITEM_VERSION), - g_strdup ("1.0")); - item->keys = g_list_prepend - (item->keys, g_strdup (PURPLE_DESKTOP_ITEM_VERSION)); - } -} - -enum { - FirstBrace, - OnSecHeader, - IgnoreToEOL, - IgnoreToEOLFirst, - KeyDef, - KeyDefOnKey, - KeyValue -}; - -static PurpleDesktopItem * -ditem_load (FILE *df, - gboolean no_translations, - const char *uri) -{ - int state; - char CharBuffer [1024]; - char *next = CharBuffer; - int c; - Encoding encoding; - PurpleDesktopItem *item; - Section *cur_section = NULL; - char *key = NULL; - gboolean old_kde = FALSE; - - encoding = get_encoding (df); - if (encoding == ENCODING_UNKNOWN) { - fclose(df); - /* spec says, don't read this file */ - printf ("Unknown encoding of .desktop file"); - - return NULL; - } - - /* Rewind since get_encoding goes through the file */ - if (fseek(df, 0L, SEEK_SET)) { - fclose(df); - /* spec says, don't read this file */ - printf ("fseek() error on .desktop file"); - return NULL; - } - - item = _purple_desktop_item_new (); - item->modified = FALSE; - - /* Note: location and mtime are filled in by the new_from_file - * function since it has those values */ - -#define PURPLE_DESKTOP_ITEM_OVERFLOW (next == &CharBuffer [sizeof(CharBuffer)-1]) - - state = FirstBrace; - while ((c = getc (df)) != EOF) { - if (c == '\r') /* Ignore Carriage Return */ - continue; - - switch (state) { - - case OnSecHeader: - if (c == ']' || PURPLE_DESKTOP_ITEM_OVERFLOW) { - *next = '\0'; - next = CharBuffer; - - /* keys were inserted in reverse */ - if (cur_section != NULL && - cur_section->keys != NULL) { - cur_section->keys = g_list_reverse - (cur_section->keys); - } - if (purple_strequal (CharBuffer, "KDE Desktop Entry")) { - /* Main section */ - cur_section = NULL; - old_kde = TRUE; - } else if (purple_strequal(CharBuffer, "Desktop Entry")) { - /* Main section */ - cur_section = NULL; - } else { - cur_section = g_new0 (Section, 1); - cur_section->name = - g_strdup (CharBuffer); - cur_section->keys = NULL; - item->sections = g_list_prepend - (item->sections, cur_section); - } - state = IgnoreToEOL; - } else if (c == '[') { - /* FIXME: probably error out instead of ignoring this */ - } else { - *next++ = c; - } - break; - - case IgnoreToEOL: - case IgnoreToEOLFirst: - if (c == '\n'){ - if (state == IgnoreToEOLFirst) - state = FirstBrace; - else - state = KeyDef; - next = CharBuffer; - } - break; - - case FirstBrace: - case KeyDef: - case KeyDefOnKey: - if (c == '#') { - if (state == FirstBrace) - state = IgnoreToEOLFirst; - else - state = IgnoreToEOL; - break; - } - - if (c == '[' && state != KeyDefOnKey){ - state = OnSecHeader; - next = CharBuffer; - g_free (key); - key = NULL; - break; - } - /* On first pass, don't allow dangling keys */ - if (state == FirstBrace) - break; - - if ((c == ' ' && state != KeyDefOnKey) || c == '\t') - break; - - if (c == '\n' || PURPLE_DESKTOP_ITEM_OVERFLOW) { /* Abort Definition */ - next = CharBuffer; - state = KeyDef; - break; - } - - if (c == '=' || PURPLE_DESKTOP_ITEM_OVERFLOW){ - *next = '\0'; - - g_free (key); - key = g_strdup (CharBuffer); - state = KeyValue; - next = CharBuffer; - } else { - *next++ = c; - state = KeyDefOnKey; - } - break; - - case KeyValue: - if (PURPLE_DESKTOP_ITEM_OVERFLOW || c == '\n'){ - *next = '\0'; - - insert_key (item, cur_section, encoding, - key, CharBuffer, old_kde, - no_translations); - - g_free (key); - key = NULL; - - state = (c == '\n') ? KeyDef : IgnoreToEOL; - next = CharBuffer; - } else { - *next++ = c; - } - break; - - } /* switch */ - - } /* while ((c = getc_unlocked (f)) != EOF) */ - if (c == EOF && state == KeyValue) { - *next = '\0'; - - insert_key (item, cur_section, encoding, - key, CharBuffer, old_kde, - no_translations); - - g_free (key); - key = NULL; - } - -#undef PURPLE_DESKTOP_ITEM_OVERFLOW - - /* keys were inserted in reverse */ - if (cur_section != NULL && - cur_section->keys != NULL) { - cur_section->keys = g_list_reverse (cur_section->keys); - } - /* keys were inserted in reverse */ - item->keys = g_list_reverse (item->keys); - /* sections were inserted in reverse */ - item->sections = g_list_reverse (item->sections); - - /* sanitize some things */ - sanitize (item, uri); - - /* make sure that we set up the type */ - setup_type (item, uri); - - fclose (df); - - return item; -} - -static void -copy_string_hash (gpointer key, gpointer value, gpointer user_data) -{ - GHashTable *copy = user_data; - g_hash_table_replace (copy, - g_strdup (key), - g_strdup (value)); -} - -static void -free_section (gpointer data, gpointer user_data) -{ - Section *section = data; - - g_free (section->name); - section->name = NULL; - - g_list_foreach (section->keys, (GFunc)g_free, NULL); - g_list_free (section->keys); - section->keys = NULL; - - g_free (section); -} - -static Section * -dup_section (Section *sec) -{ - GList *li; - Section *retval = g_new0 (Section, 1); - - retval->name = g_strdup (sec->name); - - retval->keys = g_list_copy (sec->keys); - for (li = retval->keys; li != NULL; li = li->next) - li->data = g_strdup (li->data); - - return retval; -} - -/************************************************************************** - * Public functions - **************************************************************************/ -PurpleDesktopItem * -purple_desktop_item_new_from_file (const char *filename) -{ - PurpleDesktopItem *retval; - FILE *dfile; - - g_return_val_if_fail (filename != NULL, NULL); - - dfile = g_fopen(filename, "r"); - if (!dfile) { - printf ("Can't open %s: %s", filename, g_strerror(errno)); - return NULL; - } - - retval = ditem_load(dfile, FALSE, filename); - - return retval; -} - -PurpleDesktopItemType -purple_desktop_item_get_entry_type (const PurpleDesktopItem *item) -{ - g_return_val_if_fail (item != NULL, 0); - g_return_val_if_fail (item->refcount > 0, 0); - - return item->type; -} - -const char * -purple_desktop_item_get_string (const PurpleDesktopItem *item, - const char *attr) -{ - g_return_val_if_fail (item != NULL, NULL); - g_return_val_if_fail (item->refcount > 0, NULL); - g_return_val_if_fail (attr != NULL, NULL); - - return lookup (item, attr); -} - -PurpleDesktopItem * -purple_desktop_item_copy (const PurpleDesktopItem *item) -{ - GList *li; - PurpleDesktopItem *retval; - - g_return_val_if_fail (item != NULL, NULL); - g_return_val_if_fail (item->refcount > 0, NULL); - - retval = _purple_desktop_item_new (); - - retval->type = item->type; - retval->modified = item->modified; - retval->location = g_strdup (item->location); - retval->mtime = item->mtime; - - /* Languages */ - retval->languages = g_list_copy (item->languages); - for (li = retval->languages; li != NULL; li = li->next) - li->data = g_strdup (li->data); - - /* Keys */ - retval->keys = g_list_copy (item->keys); - for (li = retval->keys; li != NULL; li = li->next) - li->data = g_strdup (li->data); - - /* Sections */ - retval->sections = g_list_copy (item->sections); - for (li = retval->sections; li != NULL; li = li->next) - li->data = dup_section (li->data); - - retval->main_hash = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) g_free); - - g_hash_table_foreach (item->main_hash, - copy_string_hash, - retval->main_hash); - - return retval; -} - -void -purple_desktop_item_unref (PurpleDesktopItem *item) -{ - g_return_if_fail (item != NULL); - g_return_if_fail (item->refcount > 0); - - item->refcount--; - - if(item->refcount != 0) - return; - - g_list_foreach (item->languages, (GFunc)g_free, NULL); - g_list_free (item->languages); - item->languages = NULL; - - g_list_foreach (item->keys, (GFunc)g_free, NULL); - g_list_free (item->keys); - item->keys = NULL; - - g_list_foreach (item->sections, free_section, NULL); - g_list_free (item->sections); - item->sections = NULL; - - g_hash_table_destroy (item->main_hash); - item->main_hash = NULL; - - g_free (item->location); - item->location = NULL; - - g_free (item); -} - -GType -purple_desktop_item_get_type (void) -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static ("PurpleDesktopItem", - _purple_desktop_item_copy, - _purple_desktop_item_free); - } - - return type; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/desktopitem.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -/** - * @file desktopitem.h Functions for managing .desktop files - * @ingroup core - */ - -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* - * The following code has been adapted from gnome-desktop-item.[ch], - * as found on gnome-desktop-2.8.1. - * - * Copyright (C) 2004 by Alceste Scalas . - * - * Original copyright notice: - * - * Copyright (C) 1999, 2000 Red Hat Inc. - * Copyright (C) 2001 Sid Vicious - * All rights reserved. - * - * This file is part of the Gnome Library. - * - * The Gnome Library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The Gnome Library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02111-1301, USA. - */ - -#ifndef _PURPLE_DESKTOP_ITEM_H_ -#define _PURPLE_DESKTOP_ITEM_H_ - -#include -#include - -G_BEGIN_DECLS - -typedef enum { - PURPLE_DESKTOP_ITEM_TYPE_NULL = 0 /* This means its NULL, that is, not - * set */, - PURPLE_DESKTOP_ITEM_TYPE_OTHER /* This means it's not one of the below - strings types, and you must get the - Type attribute. */, - - /* These are the standard compliant types: */ - PURPLE_DESKTOP_ITEM_TYPE_APPLICATION, - PURPLE_DESKTOP_ITEM_TYPE_LINK, - PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE, - PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE, - PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY, - PURPLE_DESKTOP_ITEM_TYPE_SERVICE, - PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE -} PurpleDesktopItemType; - -typedef struct _PurpleDesktopItem PurpleDesktopItem; - -#define PURPLE_TYPE_DESKTOP_ITEM (purple_desktop_item_get_type ()) -GType purple_desktop_item_get_type (void); - -/* standard */ -#define PURPLE_DESKTOP_ITEM_ENCODING "Encoding" /* string */ -#define PURPLE_DESKTOP_ITEM_VERSION "Version" /* numeric */ -#define PURPLE_DESKTOP_ITEM_NAME "Name" /* localestring */ -#define PURPLE_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */ -#define PURPLE_DESKTOP_ITEM_TYPE "Type" /* string */ -#define PURPLE_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */ -#define PURPLE_DESKTOP_ITEM_TRY_EXEC "TryExec" /* string */ -#define PURPLE_DESKTOP_ITEM_NO_DISPLAY "NoDisplay" /* boolean */ -#define PURPLE_DESKTOP_ITEM_COMMENT "Comment" /* localestring */ -#define PURPLE_DESKTOP_ITEM_EXEC "Exec" /* string */ -#define PURPLE_DESKTOP_ITEM_ACTIONS "Actions" /* strings */ -#define PURPLE_DESKTOP_ITEM_ICON "Icon" /* string */ -#define PURPLE_DESKTOP_ITEM_MINI_ICON "MiniIcon" /* string */ -#define PURPLE_DESKTOP_ITEM_HIDDEN "Hidden" /* boolean */ -#define PURPLE_DESKTOP_ITEM_PATH "Path" /* string */ -#define PURPLE_DESKTOP_ITEM_TERMINAL "Terminal" /* boolean */ -#define PURPLE_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */ -#define PURPLE_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */ -#define PURPLE_DESKTOP_ITEM_SWALLOW_EXEC "SwallowExec" /* string */ -#define PURPLE_DESKTOP_ITEM_MIME_TYPE "MimeType" /* regexp(s) */ -#define PURPLE_DESKTOP_ITEM_PATTERNS "Patterns" /* regexp(s) */ -#define PURPLE_DESKTOP_ITEM_DEFAULT_APP "DefaultApp" /* string */ -#define PURPLE_DESKTOP_ITEM_DEV "Dev" /* string */ -#define PURPLE_DESKTOP_ITEM_FS_TYPE "FSType" /* string */ -#define PURPLE_DESKTOP_ITEM_MOUNT_POINT "MountPoint" /* string */ -#define PURPLE_DESKTOP_ITEM_READ_ONLY "ReadOnly" /* boolean */ -#define PURPLE_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */ -#define PURPLE_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */ -#define PURPLE_DESKTOP_ITEM_URL "URL" /* string */ -#define PURPLE_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */ - -/** - * This function loads 'filename' and turns it into a PurpleDesktopItem. - * - * @param filename The filename or directory path to load the PurpleDesktopItem from - * - * @return The newly loaded item, or NULL on error. - */ -PurpleDesktopItem *purple_desktop_item_new_from_file (const char *filename); - -/** - * Gets the type attribute (the 'Type' field) of the item. This should - * usually be 'Application' for an application, but it can be 'Directory' - * for a directory description. There are other types available as well. - * The type usually indicates how the desktop item should be handeled and - * how the 'Exec' field should be handeled. - * - * @param item A desktop item - * - * @return The type of the specified 'item'. The returned memory - * remains owned by the PurpleDesktopItem and should not be freed. - */ -PurpleDesktopItemType purple_desktop_item_get_entry_type (const PurpleDesktopItem *item); - -/** - * Gets the value of an attribute of the item, as a string. - * - * @param item A desktop item - * @param attr The attribute to look for - * - * @return The value of the specified item attribute. - */ -const char *purple_desktop_item_get_string (const PurpleDesktopItem *item, - const char *attr); - -/** - * Creates a copy of a PurpleDesktopItem. The new copy has a refcount of 1. - * Note: Section stack is NOT copied. - * - * @param item The item to be copied - * - * @return The new copy - */ -PurpleDesktopItem *purple_desktop_item_copy (const PurpleDesktopItem *item); - -/** - * Decreases the reference count of the specified item, and destroys - * the item if there are no more references left. - * - * @param item A desktop item - */ -void purple_desktop_item_unref (PurpleDesktopItem *item); - -G_END_DECLS - -#endif /* _PURPLE_DESKTOP_ITEM_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1101 +0,0 @@ -/** - * @file dnsquery.c DNS query API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "debug.h" -#include "dnsquery.h" -#include "network.h" -#include "notify.h" -#include "prefs.h" -#include "util.h" - -#ifndef _WIN32 -#include -#endif - -#if (defined(__APPLE__) || defined (__unix__)) && !defined(__osf__) -#define PURPLE_DNSQUERY_USE_FORK -#endif -/************************************************************************** - * DNS query API - **************************************************************************/ - -static PurpleDnsQueryUiOps *dns_query_ui_ops = NULL; - -typedef struct _PurpleDnsQueryResolverProcess PurpleDnsQueryResolverProcess; - -struct _PurpleDnsQueryData { - char *hostname; - int port; - PurpleDnsQueryConnectFunction callback; - gpointer data; - guint timeout; - -#if defined(PURPLE_DNSQUERY_USE_FORK) - PurpleDnsQueryResolverProcess *resolver; -#elif defined _WIN32 /* end PURPLE_DNSQUERY_USE_FORK */ - GThread *resolver; - GSList *hosts; - gchar *error_message; -#endif -}; - -#if defined(PURPLE_DNSQUERY_USE_FORK) - -#define MAX_DNS_CHILDREN 4 - -/* - * This structure keeps a reference to a child resolver process. - */ -struct _PurpleDnsQueryResolverProcess { - guint inpa; - int fd_in, fd_out; - pid_t dns_pid; -}; - -static GSList *free_dns_children = NULL; -/* TODO: Make me a GQueue when we require >= glib 2.4 */ -static GSList *queued_requests = NULL; - -static int number_of_dns_children = 0; - -/* - * This is a convenience struct used to pass data to - * the child resolver process. - */ -typedef struct { - char hostname[512]; - int port; -} dns_params_t; -#endif /* end PURPLE_DNSQUERY_USE_FORK */ - -static void -purple_dnsquery_resolved(PurpleDnsQueryData *query_data, GSList *hosts) -{ - purple_debug_info("dnsquery", "IP resolved for %s\n", query_data->hostname); - if (query_data->callback != NULL) - query_data->callback(hosts, query_data->data, NULL); - else - { - /* - * Callback is a required parameter, but it can get set to - * NULL if we cancel a thread-based DNS lookup. So we need - * to free hosts. - */ - while (hosts != NULL) - { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - } - -#ifdef PURPLE_DNSQUERY_USE_FORK - /* - * Add the resolver to the list of available resolvers, and set it - * to NULL so that it doesn't get destroyed along with the query_data - */ - if (query_data->resolver) - { - free_dns_children = g_slist_prepend(free_dns_children, query_data->resolver); - query_data->resolver = NULL; - } -#endif /* PURPLE_DNSQUERY_USE_FORK */ - - purple_dnsquery_destroy(query_data); -} - -static void -purple_dnsquery_failed(PurpleDnsQueryData *query_data, const gchar *error_message) -{ - purple_debug_error("dnsquery", "%s\n", error_message); - if (query_data->callback != NULL) - query_data->callback(NULL, query_data->data, error_message); - purple_dnsquery_destroy(query_data); -} - -static gboolean -purple_dnsquery_ui_resolve(PurpleDnsQueryData *query_data) -{ - PurpleDnsQueryUiOps *ops = purple_dnsquery_get_ui_ops(); - - if (ops && ops->resolve_host) - return ops->resolve_host(query_data, purple_dnsquery_resolved, purple_dnsquery_failed); - - return FALSE; -} - -static gboolean -resolve_ip(PurpleDnsQueryData *query_data) -{ - struct sockaddr_in sin; - if (inet_aton(query_data->hostname, &sin.sin_addr)) - { - /* - * The given "hostname" is actually an IP address, so we - * don't need to do anything. - */ - GSList *hosts = NULL; - sin.sin_family = AF_INET; - sin.sin_port = htons(query_data->port); - hosts = g_slist_append(hosts, GINT_TO_POINTER(sizeof(sin))); - hosts = g_slist_append(hosts, g_memdup(&sin, sizeof(sin))); - purple_dnsquery_resolved(query_data, hosts); - - return TRUE; - } - - return FALSE; -} - -#ifdef USE_IDN -static gboolean -dns_str_is_ascii(const char *name) -{ - guchar *c; - for (c = (guchar *)name; c && *c; ++c) { - if (*c > 0x7f) - return FALSE; - } - - return TRUE; -} -#endif - -#if defined(PURPLE_DNSQUERY_USE_FORK) - -/* - * Unix! - */ - -/* - * Begin the DNS resolver child process functions. - */ -#ifdef HAVE_SIGNAL_H -G_GNUC_NORETURN static void -trap_gdb_bug(int sig) -{ - const char *message = - "Purple's DNS child got a SIGTRAP signal.\n" - "This can be caused by trying to run purple inside gdb.\n" - "There is a known gdb bug which prevents this. Supposedly purple\n" - "should have detected you were using gdb and used an ugly hack,\n" - "check cope_with_gdb_brokenness() in dnsquery.c.\n\n" - "For more info about this bug, see http://sources.redhat.com/ml/gdb/2001-07/msg00349.html\n"; - fputs("\n* * *\n",stderr); - fputs(message,stderr); - fputs("* * *\n\n",stderr); - execlp("xmessage","xmessage","-center", message, NULL); - _exit(1); -} -#endif - -static void -write_to_parent(int fd, const void *buf, size_t count) -{ - ssize_t written; - - written = write(fd, buf, count); - if (written != count) { - if (written < 0) - fprintf(stderr, "dns[%d]: Error writing data to " - "parent: %s\n", getpid(), strerror(errno)); - else - fprintf(stderr, "dns[%d]: Error: Tried to write %" - G_GSIZE_FORMAT " bytes to parent but instead " - "wrote %" G_GSIZE_FORMAT " bytes\n", - getpid(), count, written); - } -} - -G_GNUC_NORETURN static void -purple_dnsquery_resolver_run(int child_out, int child_in, gboolean show_debug) -{ - dns_params_t dns_params; - const size_t zero = 0; - int rc; -#ifdef HAVE_GETADDRINFO - struct addrinfo hints, *res, *tmp; - char servname[20]; -#else - struct sockaddr_in sin; - const size_t addrlen = sizeof(sin); -#endif - char *hostname; - -#ifdef HAVE_SIGNAL_H - purple_restore_default_signal_handlers(); - signal(SIGTRAP, trap_gdb_bug); -#endif - - /* - * We resolve 1 host name for each iteration of this - * while loop. - * - * The top half of this reads in the hostname and port - * number from the socket with our parent. The bottom - * half of this resolves the IP (blocking) and sends - * the result back to our parent, when finished. - */ - while (1) { - fd_set fds; - struct timeval tv = { .tv_sec = 20, .tv_usec = 0 }; - FD_ZERO(&fds); - FD_SET(child_in, &fds); - rc = select(child_in + 1, &fds, NULL, NULL, &tv); - if (!rc) { - if (show_debug) - printf("dns[%d]: nobody needs me... =(\n", getpid()); - break; - } - rc = read(child_in, &dns_params, sizeof(dns_params_t)); - if (rc < 0) { - fprintf(stderr, "dns[%d]: Error: Could not read dns_params: " - "%s\n", getpid(), strerror(errno)); - break; - } - if (rc == 0) { - if (show_debug) - printf("dns[%d]: Oops, father has gone, wait for me, wait...!\n", getpid()); - _exit(0); - } - if (dns_params.hostname[0] == '\0') { - fprintf(stderr, "dns[%d]: Error: Parent requested resolution " - "of an empty hostname (port = %d)!!!\n", getpid(), - dns_params.port); - _exit(1); - } - -#ifdef USE_IDN - if (!dns_str_is_ascii(dns_params.hostname)) { - rc = purple_network_convert_idn_to_ascii(dns_params.hostname, &hostname); - if (rc != 0) { - write_to_parent(child_out, &rc, sizeof(rc)); - if (show_debug) - fprintf(stderr, "dns[%d] Error: IDN conversion returned " - "%d\n", getpid(), rc); - dns_params.hostname[0] = '\0'; - break; - } - } else /* intentional to execute the g_strdup */ -#endif - hostname = g_strdup(dns_params.hostname); - - /* We have the hostname and port, now resolve the IP */ - -#ifdef HAVE_GETADDRINFO - g_snprintf(servname, sizeof(servname), "%d", dns_params.port); - memset(&hints, 0, sizeof(hints)); - - /* This is only used to convert a service - * name to a port number. As we know we are - * passing a number already, we know this - * value will not be really used by the C - * library. - */ - hints.ai_socktype = SOCK_STREAM; -#ifdef AI_ADDRCONFIG - hints.ai_flags |= AI_ADDRCONFIG; -#endif /* AI_ADDRCONFIG */ - rc = getaddrinfo(hostname, servname, &hints, &res); - write_to_parent(child_out, &rc, sizeof(rc)); - if (rc != 0) { - if (show_debug) - printf("dns[%d] Error: getaddrinfo returned %d\n", - getpid(), rc); - dns_params.hostname[0] = '\0'; - g_free(hostname); - hostname = NULL; - break; - } - tmp = res; - while (res) { - size_t ai_addrlen = res->ai_addrlen; - write_to_parent(child_out, &ai_addrlen, sizeof(ai_addrlen)); - write_to_parent(child_out, res->ai_addr, res->ai_addrlen); - res = res->ai_next; - } - freeaddrinfo(tmp); -#else - if (!inet_aton(hostname, &sin.sin_addr)) { - struct hostent *hp; - if (!(hp = gethostbyname(hostname))) { - write_to_parent(child_out, &h_errno, sizeof(int)); - close(child_out); - if (show_debug) - printf("DNS Error: %d\n", h_errno); - _exit(0); - } - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - } else - sin.sin_family = AF_INET; - - sin.sin_port = htons(dns_params.port); - rc = 0; - write_to_parent(child_out, &rc, sizeof(rc)); - write_to_parent(child_out, &addrlen, sizeof(addrlen)); - write_to_parent(child_out, &sin, addrlen); -#endif - write_to_parent(child_out, &zero, sizeof(zero)); - dns_params.hostname[0] = '\0'; - - g_free(hostname); - hostname = NULL; - } - - close(child_out); - close(child_in); - - _exit(0); -} -/* - * End the DNS resolver child process functions. - */ - -/* - * Begin the functions for dealing with the DNS child processes. - */ -static void -cope_with_gdb_brokenness(void) -{ -#ifdef __linux__ - static gboolean already_done = FALSE; - char s[256], e[512]; - int n; - pid_t ppid; - - if(already_done) - return; - already_done = TRUE; - ppid = getppid(); - g_snprintf(s, sizeof(s), "/proc/%d/exe", ppid); - n = readlink(s, e, sizeof(e)); - if(n < 0) - return; - - e[MIN(n,sizeof(e)-1)] = '\0'; - - if(strstr(e,"gdb")) { - purple_debug_info("dns", - "Debugger detected, performing useless query...\n"); - gethostbyname("x.x.x.x.x"); - } -#endif -} - -static void -purple_dnsquery_resolver_destroy(PurpleDnsQueryResolverProcess *resolver) -{ - g_return_if_fail(resolver != NULL); - - /* Keep this before the kill() call below. */ - if (resolver->inpa != 0) { - purple_input_remove(resolver->inpa); - resolver->inpa = 0; - } - - /* - * We might as well attempt to kill our child process. It really - * doesn't matter if this fails, because children will expire on - * their own after a few seconds. - */ - if (resolver->dns_pid > 0) - kill(resolver->dns_pid, SIGKILL); - - close(resolver->fd_in); - close(resolver->fd_out); - - g_free(resolver); - - number_of_dns_children--; -} - -static PurpleDnsQueryResolverProcess * -purple_dnsquery_resolver_new(gboolean show_debug) -{ - PurpleDnsQueryResolverProcess *resolver; - int child_out[2], child_in[2]; - - /* Create pipes for communicating with the child process */ - if (pipe(child_out) || pipe(child_in)) { - purple_debug_error("dns", - "Could not create pipes: %s\n", g_strerror(errno)); - return NULL; - } - - resolver = g_new(PurpleDnsQueryResolverProcess, 1); - resolver->inpa = 0; - - cope_with_gdb_brokenness(); - - /* "Go fork and multiply." --Tommy Caldwell (Emily's dad, not the climber) */ - resolver->dns_pid = fork(); - - /* If we are the child process... */ - if (resolver->dns_pid == 0) { - /* We should not access the parent's side of the pipes, so close them */ - close(child_out[0]); - close(child_in[1]); - - purple_dnsquery_resolver_run(child_out[1], child_in[0], show_debug); - /* The thread calls _exit() rather than returning, so we never get here */ - } - - /* We should not access the child's side of the pipes, so close them */ - close(child_out[1]); - close(child_in[0]); - if (resolver->dns_pid == -1) { - purple_debug_error("dns", - "Could not create child process for DNS: %s\n", - g_strerror(errno)); - purple_dnsquery_resolver_destroy(resolver); - return NULL; - } - - resolver->fd_out = child_out[0]; - resolver->fd_in = child_in[1]; - number_of_dns_children++; - purple_debug_info("dns", - "Created new DNS child %d, there are now %d children.\n", - resolver->dns_pid, number_of_dns_children); - - return resolver; -} - -/** - * @return TRUE if the request was sent succesfully. FALSE - * if the request could not be sent. This isn't - * necessarily an error. If the child has expired, - * for example, we won't be able to send the message. - */ -static gboolean -send_dns_request_to_child(PurpleDnsQueryData *query_data, - PurpleDnsQueryResolverProcess *resolver) -{ - pid_t pid; - dns_params_t dns_params; - ssize_t rc; - - /* This waitpid might return the child's PID if it has recently - * exited, or it might return an error if it exited "long - * enough" ago that it has already been reaped; in either - * instance, we can't use it. */ - pid = waitpid(resolver->dns_pid, NULL, WNOHANG); - if (pid > 0) { - purple_debug_warning("dns", "DNS child %d no longer exists\n", - resolver->dns_pid); - purple_dnsquery_resolver_destroy(resolver); - return FALSE; - } else if (pid < 0) { - purple_debug_warning("dns", "Wait for DNS child %d failed: %s\n", - resolver->dns_pid, g_strerror(errno)); - purple_dnsquery_resolver_destroy(resolver); - return FALSE; - } - - /* Copy the hostname and port into a single data structure */ - strncpy(dns_params.hostname, query_data->hostname, sizeof(dns_params.hostname) - 1); - dns_params.hostname[sizeof(dns_params.hostname) - 1] = '\0'; - dns_params.port = query_data->port; - - /* Send the data structure to the child */ - rc = write(resolver->fd_in, &dns_params, sizeof(dns_params)); - if (rc < 0) { - purple_debug_error("dns", "Unable to write to DNS child %d: %s\n", - resolver->dns_pid, g_strerror(errno)); - purple_dnsquery_resolver_destroy(resolver); - return FALSE; - } - if (rc < sizeof(dns_params)) { - purple_debug_error("dns", "Tried to write %" G_GSSIZE_FORMAT - " bytes to child but only wrote %" G_GSSIZE_FORMAT "\n", - sizeof(dns_params), rc); - purple_dnsquery_resolver_destroy(resolver); - return FALSE; - } - - purple_debug_info("dns", - "Successfully sent DNS request to child %d\n", - resolver->dns_pid); - - query_data->resolver = resolver; - - return TRUE; -} - -static void host_resolved(gpointer data, gint source, PurpleInputCondition cond); - -static void -handle_next_queued_request(void) -{ - PurpleDnsQueryData *query_data; - PurpleDnsQueryResolverProcess *resolver; - - if (queued_requests == NULL) - /* No more DNS queries, yay! */ - return; - - query_data = queued_requests->data; - queued_requests = g_slist_delete_link(queued_requests, queued_requests); - - /* - * If we have any children, attempt to have them perform the DNS - * query. If we're able to send the query then resolver will be - * set to the PurpleDnsQueryResolverProcess. Otherwise, resolver - * will be NULL and we'll need to create a new DNS request child. - */ - while (free_dns_children != NULL) - { - resolver = free_dns_children->data; - free_dns_children = g_slist_remove(free_dns_children, resolver); - - if (send_dns_request_to_child(query_data, resolver)) - /* We found an acceptable child, yay */ - break; - } - - /* We need to create a new DNS request child */ - if (query_data->resolver == NULL) - { - if (number_of_dns_children >= MAX_DNS_CHILDREN) - { - /* Apparently all our children are busy */ - queued_requests = g_slist_prepend(queued_requests, query_data); - return; - } - - resolver = purple_dnsquery_resolver_new(purple_debug_is_enabled()); - if (resolver == NULL) - { - purple_dnsquery_failed(query_data, _("Unable to create new resolver process\n")); - return; - } - if (!send_dns_request_to_child(query_data, resolver)) - { - purple_dnsquery_failed(query_data, _("Unable to send request to resolver process\n")); - return; - } - } - - query_data->resolver->inpa = purple_input_add(query_data->resolver->fd_out, - PURPLE_INPUT_READ, host_resolved, query_data); -} - -/* - * End the functions for dealing with the DNS child processes. - */ - -static void -host_resolved(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleDnsQueryData *query_data; - int rc, err; - GSList *hosts = NULL; - struct sockaddr *addr = NULL; - size_t addrlen; - char message[1024]; - - query_data = data; - - purple_debug_info("dns", "Got response for '%s'\n", query_data->hostname); - purple_input_remove(query_data->resolver->inpa); - query_data->resolver->inpa = 0; - - rc = read(query_data->resolver->fd_out, &err, sizeof(err)); - if ((rc == 4) && (err != 0)) - { -#ifdef HAVE_GETADDRINFO - g_snprintf(message, sizeof(message), _("Error resolving %s:\n%s"), - query_data->hostname, purple_gai_strerror(err)); -#else - g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), - query_data->hostname, err); -#endif - /* Re-read resolv.conf and friends in case DNS servers have changed */ - res_init(); - - purple_dnsquery_failed(query_data, message); - } else if (rc > 0) { - /* Success! */ - while (rc > 0) { - rc = read(query_data->resolver->fd_out, &addrlen, sizeof(addrlen)); - if (rc > 0 && addrlen > 0) { - addr = g_malloc(addrlen); - rc = read(query_data->resolver->fd_out, addr, addrlen); - hosts = g_slist_append(hosts, GINT_TO_POINTER(addrlen)); - hosts = g_slist_append(hosts, addr); - } else { - break; - } - } - /* wait4(resolver->dns_pid, NULL, WNOHANG, NULL); */ - purple_dnsquery_resolved(query_data, hosts); - - } else if (rc == -1) { - g_snprintf(message, sizeof(message), _("Error reading from resolver process:\n%s"), g_strerror(errno)); - purple_dnsquery_failed(query_data, message); - - } else if (rc == 0) { - g_snprintf(message, sizeof(message), _("Resolver process exited without answering our request")); - purple_dnsquery_failed(query_data, message); - } - - handle_next_queued_request(); -} - -static gboolean -resolve_host(gpointer data) -{ - PurpleDnsQueryData *query_data; - - query_data = data; - query_data->timeout = 0; - - if (resolve_ip(query_data)) - { - /* resolve_ip calls purple_dnsquery_resolved */ - return FALSE; - } - - if (purple_dnsquery_ui_resolve(query_data)) - { - /* The UI is handling the resolve; we're done */ - return FALSE; - } - - queued_requests = g_slist_append(queued_requests, query_data); - - handle_next_queued_request(); - - return FALSE; -} - -PurpleDnsQueryData * -purple_dnsquery_a(const char *hostname, int port, - PurpleDnsQueryConnectFunction callback, gpointer data) -{ - PurpleDnsQueryData *query_data; - - g_return_val_if_fail(hostname != NULL, NULL); - g_return_val_if_fail(port != 0, NULL); - g_return_val_if_fail(callback != NULL, NULL); - - query_data = g_new(PurpleDnsQueryData, 1); - query_data->hostname = g_strdup(hostname); - g_strstrip(query_data->hostname); - query_data->port = port; - query_data->callback = callback; - query_data->data = data; - query_data->resolver = NULL; - - if (*query_data->hostname == '\0') - { - purple_dnsquery_destroy(query_data); - g_return_val_if_reached(NULL); - } - - purple_debug_info("dns", "DNS query for '%s' queued\n", query_data->hostname); - - query_data->timeout = purple_timeout_add(0, resolve_host, query_data); - - return query_data; -} - -#elif defined _WIN32 /* end PURPLE_DNSQUERY_USE_FORK */ - -/* - * Windows! - */ - -static gboolean -dns_main_thread_cb(gpointer data) -{ - PurpleDnsQueryData *query_data = data; - - /* We're done, so purple_dnsquery_destroy() shouldn't think it is canceling an in-progress lookup */ - query_data->resolver = NULL; - - if (query_data->error_message != NULL) - purple_dnsquery_failed(query_data, query_data->error_message); - else - { - GSList *hosts; - - /* We don't want purple_dns_query_resolved() to free(hosts) */ - hosts = query_data->hosts; - query_data->hosts = NULL; - purple_dnsquery_resolved(query_data, hosts); - } - - return FALSE; -} - -static gpointer -dns_thread(gpointer data) -{ - PurpleDnsQueryData *query_data; -#ifdef HAVE_GETADDRINFO - int rc; - struct addrinfo hints, *res, *tmp; - char servname[20]; -#else - struct sockaddr_in sin; - struct hostent *hp; -#endif - char *hostname; - - query_data = data; - -#ifdef USE_IDN - if (!dns_str_is_ascii(query_data->hostname)) { - rc = purple_network_convert_idn_to_ascii(query_data->hostname, &hostname); - if (rc != 0) { - query_data->error_message = g_strdup_printf(_("Error converting %s " - "to punycode: %d"), query_data->hostname, rc); - /* back to main thread */ - purple_timeout_add(0, dns_main_thread_cb, query_data); - return 0; - } - } else /* intentional fallthru */ -#endif - hostname = g_strdup(query_data->hostname); - -#ifdef HAVE_GETADDRINFO - g_snprintf(servname, sizeof(servname), "%d", query_data->port); - memset(&hints,0,sizeof(hints)); - - /* - * This is only used to convert a service - * name to a port number. As we know we are - * passing a number already, we know this - * value will not be really used by the C - * library. - */ - hints.ai_socktype = SOCK_STREAM; -#ifdef AI_ADDRCONFIG - hints.ai_flags |= AI_ADDRCONFIG; -#endif /* AI_ADDRCONFIG */ - if ((rc = getaddrinfo(hostname, servname, &hints, &res)) == 0) { - tmp = res; - while(res) { - query_data->hosts = g_slist_append(query_data->hosts, - GSIZE_TO_POINTER(res->ai_addrlen)); - query_data->hosts = g_slist_append(query_data->hosts, - g_memdup(res->ai_addr, res->ai_addrlen)); - res = res->ai_next; - } - freeaddrinfo(tmp); - } else { - query_data->error_message = g_strdup_printf(_("Error resolving %s:\n%s"), query_data->hostname, purple_gai_strerror(rc)); - } -#else - if ((hp = gethostbyname(hostname))) { - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - sin.sin_port = htons(query_data->port); - - query_data->hosts = g_slist_append(query_data->hosts, - GSIZE_TO_POINTER(sizeof(sin))); - query_data->hosts = g_slist_append(query_data->hosts, - g_memdup(&sin, sizeof(sin))); - } else { - query_data->error_message = g_strdup_printf(_("Error resolving %s: %d"), query_data->hostname, h_errno); - } -#endif - g_free(hostname); - - /* back to main thread */ - purple_timeout_add(0, dns_main_thread_cb, query_data); - - return 0; -} - -static gboolean -resolve_host(gpointer data) -{ - PurpleDnsQueryData *query_data; - GError *err = NULL; - - query_data = data; - query_data->timeout = 0; - - if (purple_dnsquery_ui_resolve(query_data)) - { - /* The UI is handling the resolve; we're done */ - return FALSE; - } - - if (!resolve_ip(query_data)) - { - /* - * Spin off a separate thread to perform the DNS lookup so - * that we don't block the UI. - */ - query_data->resolver = g_thread_create(dns_thread, - query_data, FALSE, &err); - if (query_data->resolver == NULL) - { - char message[1024]; - g_snprintf(message, sizeof(message), _("Thread creation failure: %s"), - (err && err->message) ? err->message : _("Unknown reason")); - g_error_free(err); - purple_dnsquery_failed(query_data, message); - } - } - - return FALSE; -} - -PurpleDnsQueryData * -purple_dnsquery_a(const char *hostname, int port, - PurpleDnsQueryConnectFunction callback, gpointer data) -{ - PurpleDnsQueryData *query_data; - - g_return_val_if_fail(hostname != NULL, NULL); - g_return_val_if_fail(port != 0, NULL); - g_return_val_if_fail(callback != NULL, NULL); - - purple_debug_info("dnsquery", "Performing DNS lookup for %s\n", hostname); - - query_data = g_new0(PurpleDnsQueryData, 1); - query_data->hostname = g_strdup(hostname); - g_strstrip(query_data->hostname); - query_data->port = port; - query_data->callback = callback; - query_data->data = data; - - if (strlen(query_data->hostname) == 0) - { - purple_dnsquery_destroy(query_data); - g_return_val_if_reached(NULL); - } - - /* Don't call the callback before returning */ - query_data->timeout = purple_timeout_add(0, resolve_host, query_data); - - return query_data; -} - -#else /* not PURPLE_DNSQUERY_USE_FORK or _WIN32 */ - -/* - * We weren't able to do anything fancier above, so use the - * fail-safe name resolution code, which is blocking. - */ - -static gboolean -resolve_host(gpointer data) -{ - PurpleDnsQueryData *query_data; - struct sockaddr_in sin; - GSList *hosts = NULL; - - query_data = data; - query_data->timeout = 0; - - if (purple_dnsquery_ui_resolve(query_data)) - { - /* The UI is handling the resolve; we're done */ - return FALSE; - } - - if (!inet_aton(query_data->hostname, &sin.sin_addr)) { - struct hostent *hp; - gchar *hostname; -#ifdef USE_IDN - if (!dns_str_is_ascii(query_data->hostname)) { - int ret = purple_network_convert_idn_to_ascii(query_data->hostname, - &hostname); - if (ret != 0) { - char message[1024]; - g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), - query_data->hostname, ret); - purple_dnsquery_failed(query_data, message); - return FALSE; - } - } else /* fallthrough is intentional to the g_strdup */ -#endif - hostname = g_strdup(query_data->hostname); - - if(!(hp = gethostbyname(hostname))) { - char message[1024]; - g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), - query_data->hostname, h_errno); - purple_dnsquery_failed(query_data, message); - g_free(hostname); - return FALSE; - } - memset(&sin, 0, sizeof(struct sockaddr_in)); - memcpy(&sin.sin_addr.s_addr, hp->h_addr, hp->h_length); - sin.sin_family = hp->h_addrtype; - g_free(hostname); - } else - sin.sin_family = AF_INET; - sin.sin_port = htons(query_data->port); - - hosts = g_slist_append(hosts, GINT_TO_POINTER(sizeof(sin))); - hosts = g_slist_append(hosts, g_memdup(&sin, sizeof(sin))); - - purple_dnsquery_resolved(query_data, hosts); - - return FALSE; -} - -PurpleDnsQueryData * -purple_dnsquery_a(const char *hostname, int port, - PurpleDnsQueryConnectFunction callback, gpointer data) -{ - PurpleDnsQueryData *query_data; - - g_return_val_if_fail(hostname != NULL, NULL); - g_return_val_if_fail(port != 0, NULL); - g_return_val_if_fail(callback != NULL, NULL); - - query_data = g_new(PurpleDnsQueryData, 1); - query_data->hostname = g_strdup(hostname); - g_strstrip(query_data->hostname); - query_data->port = port; - query_data->callback = callback; - query_data->data = data; - - if (strlen(query_data->hostname) == 0) - { - purple_dnsquery_destroy(query_data); - g_return_val_if_reached(NULL); - } - - /* Don't call the callback before returning */ - query_data->timeout = purple_timeout_add(0, resolve_host, query_data); - - return query_data; -} - -#endif /* not PURPLE_DNSQUERY_USE_FORK or _WIN32 */ - -void -purple_dnsquery_destroy(PurpleDnsQueryData *query_data) -{ - PurpleDnsQueryUiOps *ops = purple_dnsquery_get_ui_ops(); - - if (ops && ops->destroy) - ops->destroy(query_data); - -#if defined(PURPLE_DNSQUERY_USE_FORK) - queued_requests = g_slist_remove(queued_requests, query_data); - - if (query_data->resolver != NULL) - /* - * This is only non-NULL when we're cancelling an in-progress - * query. Ideally we would tell our resolver child to stop - * resolving shit and then we would add it back to the - * free_dns_children linked list. However, it's hard to tell - * children stuff, they just don't listen. So we'll just - * kill the process and allow a new child to be started if we - * have more stuff to resolve. - */ - purple_dnsquery_resolver_destroy(query_data->resolver); -#elif defined _WIN32 /* end PURPLE_DNSQUERY_USE_FORK */ - if (query_data->resolver != NULL) - { - /* - * It's not really possible to kill a thread. So instead we - * just set the callback to NULL and let the DNS lookup - * finish. - */ - query_data->callback = NULL; - return; - } - - while (query_data->hosts != NULL) - { - /* Discard the length... */ - query_data->hosts = g_slist_remove(query_data->hosts, query_data->hosts->data); - /* Free the address... */ - g_free(query_data->hosts->data); - query_data->hosts = g_slist_remove(query_data->hosts, query_data->hosts->data); - } - g_free(query_data->error_message); -#endif /* end _WIN32 */ - - if (query_data->timeout > 0) - purple_timeout_remove(query_data->timeout); - - g_free(query_data->hostname); - g_free(query_data); -} - -char * -purple_dnsquery_get_host(PurpleDnsQueryData *query_data) -{ - g_return_val_if_fail(query_data != NULL, NULL); - - return query_data->hostname; -} - -unsigned short -purple_dnsquery_get_port(PurpleDnsQueryData *query_data) -{ - g_return_val_if_fail(query_data != NULL, 0); - - return query_data->port; -} - -void -purple_dnsquery_set_ui_ops(PurpleDnsQueryUiOps *ops) -{ - dns_query_ui_ops = ops; -} - -PurpleDnsQueryUiOps * -purple_dnsquery_get_ui_ops(void) -{ - /* It is perfectly acceptable for dns_query_ui_ops to be NULL; this just - * means that the default platform-specific implementation will be used. - */ - return dns_query_ui_ops; -} - -void -purple_dnsquery_init(void) -{ -} - -void -purple_dnsquery_uninit(void) -{ -#if defined(PURPLE_DNSQUERY_USE_FORK) - while (free_dns_children != NULL) - { - purple_dnsquery_resolver_destroy(free_dns_children->data); - free_dns_children = g_slist_remove(free_dns_children, free_dns_children->data); - } -#endif /* end PURPLE_DNSQUERY_USE_FORK */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnsquery.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/** - * @file dnsquery.h DNS query API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_DNSQUERY_H_ -#define _PURPLE_DNSQUERY_H_ - -#include -#include "eventloop.h" -#include "account.h" - -/** - * An opaque structure representing a DNS query. The hostname and port - * associated with the query can be retrieved using - * purple_dnsquery_get_host() and purple_dnsquery_get_port(). - */ -typedef struct _PurpleDnsQueryData PurpleDnsQueryData; - -/** - * The "hosts" parameter is a linked list containing pairs of - * one size_t addrlen and one struct sockaddr *addr. It should - * be free'd by the callback function. - */ -typedef void (*PurpleDnsQueryConnectFunction)(GSList *hosts, gpointer data, const char *error_message); - -/** - * Callbacks used by the UI if it handles resolving DNS - */ -typedef void (*PurpleDnsQueryResolvedCallback) (PurpleDnsQueryData *query_data, GSList *hosts); -typedef void (*PurpleDnsQueryFailedCallback) (PurpleDnsQueryData *query_data, const gchar *error_message); - -/** - * DNS Request UI operations; UIs should implement this if they want to do DNS - * lookups themselves, rather than relying on the core. - * - * @see @ref ui-ops - */ -typedef struct -{ - /** If implemented, the UI is responsible for DNS queries */ - gboolean (*resolve_host)(PurpleDnsQueryData *query_data, - PurpleDnsQueryResolvedCallback resolved_cb, - PurpleDnsQueryFailedCallback failed_cb); - - /** Called just before @a query_data is freed; this should cancel any - * further use of @a query_data the UI would make. Unneeded if - * #resolve_host is not implemented. - */ - void (*destroy)(PurpleDnsQueryData *query_data); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleDnsQueryUiOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name DNS query API */ -/**************************************************************************/ -/*@{*/ - -/** - * Perform an asynchronous DNS query. - * - * @param hostname The hostname to resolve. - * @param port A port number which is stored in the struct sockaddr. - * @param callback The callback function to call after resolving. - * @param data Extra data to pass to the callback function. - * - * @return NULL if there was an error, otherwise return a reference to - * a data structure that can be used to cancel the pending - * DNS query, if needed. - */ -PurpleDnsQueryData *purple_dnsquery_a(const char *hostname, int port, PurpleDnsQueryConnectFunction callback, gpointer data); - -/** - * Cancel a DNS query and destroy the associated data structure. - * - * @param query_data The DNS query to cancel. This data structure - * is freed by this function. - */ -void purple_dnsquery_destroy(PurpleDnsQueryData *query_data); - -/** - * Sets the UI operations structure to be used when doing a DNS - * resolve. The UI operations need only be set if the UI wants to - * handle the resolve itself; otherwise, leave it as NULL. - * - * @param ops The UI operations structure. - */ -void purple_dnsquery_set_ui_ops(PurpleDnsQueryUiOps *ops); - -/** - * Returns the UI operations structure to be used when doing a DNS - * resolve. - * - * @return The UI operations structure. - */ -PurpleDnsQueryUiOps *purple_dnsquery_get_ui_ops(void); - -/** - * Get the host associated with a PurpleDnsQueryData - * - * @param query_data The DNS query - * @return The host. - */ -char *purple_dnsquery_get_host(PurpleDnsQueryData *query_data); - -/** - * Get the port associated with a PurpleDnsQueryData - * - * @param query_data The DNS query - * @return The port. - */ -unsigned short purple_dnsquery_get_port(PurpleDnsQueryData *query_data); - -/** - * Initializes the DNS query subsystem. - */ -void purple_dnsquery_init(void); - -/** - * Uninitializes the DNS query subsystem. - */ -void purple_dnsquery_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_DNSQUERY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,955 +0,0 @@ -/** - * @file dnssrv.c - */ - -/* purple - * - * Copyright (C) 2005 Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "util.h" - -#ifndef _WIN32 -#include -#include -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -#include -#endif -#ifndef T_SRV -#define T_SRV 33 -#endif -#ifndef T_TXT -#define T_TXT 16 -#endif -#else /* WIN32 */ -#include -/* Missing from the mingw headers */ -#ifndef DNS_TYPE_SRV -# define DNS_TYPE_SRV 33 -#endif -#ifndef DNS_TYPE_TXT -# define DNS_TYPE_TXT 16 -#endif -#endif - -#include "debug.h" -#include "dnssrv.h" -#include "eventloop.h" -#include "network.h" - -#ifndef _WIN32 -typedef union { - HEADER hdr; - u_char buf[1024]; -} queryans; -#else -static DNS_STATUS (WINAPI *MyDnsQuery_UTF8) ( - PCSTR lpstrName, WORD wType, DWORD fOptions, - PIP4_ARRAY aipServers, PDNS_RECORD* ppQueryResultsSet, - PVOID* pReserved) = NULL; -static void (WINAPI *MyDnsRecordListFree) (PDNS_RECORD pRecordList, - DNS_FREE_TYPE FreeType) = NULL; -#endif - -struct _PurpleTxtResponse { - char *content; -}; - -struct _PurpleSrvQueryData { - union { - PurpleSrvCallback srv; - PurpleTxtCallback txt; - } cb; - - gpointer extradata; - guint handle; - int type; -#ifdef _WIN32 - GThread *resolver; - char *query; - char *error_message; - GList *results; -#else - int fd_in, fd_out; - pid_t pid; -#endif -}; - -typedef struct _PurpleSrvInternalQuery { - int type; - char query[256]; -} PurpleSrvInternalQuery; - -typedef struct _PurpleSrvResponseContainer { - PurpleSrvResponse *response; - int sum; -} PurpleSrvResponseContainer; - -/** - * Sort by priority, then by weight. Strictly numerically--no - * randomness. Technically we only need to sort by pref and then - * make sure any records with weight 0 are at the beginning of - * their group, but it's just as easy to sort by weight. - */ -static gint -responsecompare(gconstpointer ar, gconstpointer br) -{ - PurpleSrvResponse *a = (PurpleSrvResponse*)ar; - PurpleSrvResponse *b = (PurpleSrvResponse*)br; - - if(a->pref == b->pref) { - if(a->weight == b->weight) - return 0; - if(a->weight < b->weight) - return -1; - return 1; - } - if(a->pref < b->pref) - return -1; - return 1; -} - -/** - * Iterate over a list of PurpleSrvResponseContainer making the sum - * the running total of the sums. Select a random integer in the range - * (1, sum+1), then find the first element greater than or equal to the - * number selected. From RFC 2782. - * - * @param list The list of PurpleSrvResponseContainer. This function - * removes a node from this list and returns the new list. - * @param container_ptr The PurpleSrvResponseContainer that was chosen - * will be returned here. - */ -static GList * -select_random_response(GList *list, PurpleSrvResponseContainer **container_ptr) -{ - GList *cur; - size_t runningtotal; - int r; - - runningtotal = 0; - cur = list; - - while (cur) { - PurpleSrvResponseContainer *container = cur->data; - runningtotal += container->response->weight; - container->sum = runningtotal; - cur = cur->next; - } - - /* - * If the running total is greater than 0, pick a number between - * 1 and the runningtotal inclusive. (This is not precisely what - * the RFC algorithm describes, but we wish to deal with integers - * and avoid floats. This is functionally equivalent.) - * If running total is 0, then choose r = 0. - */ - r = runningtotal ? g_random_int_range(1, runningtotal + 1) : 0; - cur = list; - while (r > ((PurpleSrvResponseContainer *)cur->data)->sum) { - cur = cur->next; - } - - /* Set the return parameter and remove cur from the list */ - *container_ptr = cur->data; - return g_list_delete_link(list, cur); -} - -/** - * Reorder a GList of PurpleSrvResponses that have the same priority - * (aka "pref"). - */ -static void -srv_reorder(GList *list, int num) -{ - int i; - GList *cur, *container_list = NULL; - PurpleSrvResponseContainer *container; - - if (num < 2) - /* Nothing to sort */ - return; - - /* First build a list of container structs */ - for (i = 0, cur = list; i < num; i++, cur = cur->next) { - container = g_new(PurpleSrvResponseContainer, 1); - container->response = cur->data; - container_list = g_list_prepend(container_list, container); - } - container_list = g_list_reverse(container_list); - - /* - * Re-order the list that was passed in as a parameter. We leave - * the list nodes in place, but replace their data pointers. - */ - cur = list; - while (container_list) { - container_list = select_random_response(container_list, &container); - cur->data = container->response; - g_free(container); - cur = cur->next; - } -} - -/** - * Sorts a GList of PurpleSrvResponses according to the - * algorithm described in RFC 2782. - * - * @param response GList of PurpleSrvResponse's - * @param The original list, resorted - */ -static GList * -purple_srv_sort(GList *list) -{ - int pref, count; - GList *cur, *start; - - if (!list || !list->next) { - /* Nothing to sort */ - return list; - } - - list = g_list_sort(list, responsecompare); - - start = cur = list; - count = 1; - while (cur) { - PurpleSrvResponse *next_response; - pref = ((PurpleSrvResponse *)cur->data)->pref; - next_response = cur->next ? cur->next->data : NULL; - if (!next_response || next_response->pref != pref) { - /* - * The 'count' records starting at 'start' all have the same - * priority. Sort them by weight. - */ - srv_reorder(start, count); - start = cur->next; - count = 0; - } - count++; - cur = cur->next; - } - - return list; -} - -#ifdef USE_IDN -static gboolean -dns_str_is_ascii(const char *name) -{ - guchar *c; - for (c = (guchar *)name; c && *c; ++c) { - if (*c > 0x7f) - return FALSE; - } - - return TRUE; -} -#endif - -#ifndef _WIN32 -static void -write_to_parent(int in, int out, gconstpointer data, gsize size) -{ - const guchar *buf = data; - gssize w; - - do { - w = write(out, buf, size); - if (w > 0) { - buf += w; - size -= w; - } else if (w < 0 && errno == EINTR) { - /* Let's try some more; */ - w = 1; - } - } while (size > 0 && w > 0); - - if (size != 0) { - /* An error occurred */ - close(out); - close(in); - _exit(0); - } -} - -/* Read size bytes to data. Dies if an error occurs. */ -static void -read_from_parent(int in, int out, gpointer data, gsize size) -{ - guchar *buf = data; - gssize r; - - do { - r = read(in, data, size); - if (r > 0) { - buf += r; - size -= r; - } else if (r < 0 && errno == EINTR) { - /* Let's try some more; */ - r = 1; - } - } while (size > 0 && r > 0); - - if (size != 0) { - /* An error occurred */ - close(out); - close(in); - _exit(0); - } -} - - -G_GNUC_NORETURN static void -resolve(int in, int out) -{ - GList *ret = NULL; - PurpleSrvResponse *srvres; - PurpleTxtResponse *txtres; - queryans answer; - int size, qdcount, ancount; - guchar *end, *cp; - gchar name[256]; - guint16 type, dlen, pref, weight, port; - PurpleSrvInternalQuery query; - -#ifdef HAVE_SIGNAL_H - purple_restore_default_signal_handlers(); -#endif - - read_from_parent(in, out, &query, sizeof(query)); - - size = res_query( query.query, C_IN, query.type, (u_char*)&answer, sizeof( answer)); - if (size == -1) { - write_to_parent(in, out, &(query.type), sizeof(query.type)); - write_to_parent(in, out, &size, sizeof(size)); - close(out); - close(in); - _exit(0); - } - - qdcount = ntohs(answer.hdr.qdcount); - ancount = ntohs(answer.hdr.ancount); - cp = (guchar*)&answer + sizeof(HEADER); - end = (guchar*)&answer + size; - - /* skip over unwanted stuff */ - while (qdcount-- > 0 && cp < end) { - size = dn_expand( (unsigned char*)&answer, end, cp, name, 256); - if(size < 0) goto end; - cp += size + QFIXEDSZ; - } - - while (ancount-- > 0 && cp < end) { - size = dn_expand((unsigned char*)&answer, end, cp, name, 256); - if(size < 0) - goto end; - cp += size; - GETSHORT(type,cp); - - /* skip ttl and class since we already know it */ - cp += 6; - - GETSHORT(dlen,cp); - if (query.type == T_SRV) { - GETSHORT(pref,cp); - - GETSHORT(weight,cp); - - GETSHORT(port,cp); - - size = dn_expand( (unsigned char*)&answer, end, cp, name, 256); - if(size < 0 ) - goto end; - - cp += size; - - srvres = g_new0(PurpleSrvResponse, 1); - strcpy(srvres->hostname, name); - srvres->pref = pref; - srvres->port = port; - srvres->weight = weight; - - ret = g_list_prepend(ret, srvres); - } else if (query.type == T_TXT) { - txtres = g_new0(PurpleTxtResponse, 1); - txtres->content = g_strndup((gchar*)(++cp), dlen-1); - ret = g_list_append(ret, txtres); - cp += dlen - 1; - } else { - cp += dlen; - } - } - -end: - size = g_list_length(ret); - - if (query.type == T_SRV) - ret = purple_srv_sort(ret); - - write_to_parent(in, out, &(query.type), sizeof(query.type)); - write_to_parent(in, out, &size, sizeof(size)); - while (ret != NULL) - { - if (query.type == T_SRV) - write_to_parent(in, out, ret->data, sizeof(PurpleSrvResponse)); - if (query.type == T_TXT) { - PurpleTxtResponse *response = ret->data; - gsize l = strlen(response->content) + 1 /* null byte */; - write_to_parent(in, out, &l, sizeof(l)); - write_to_parent(in, out, response->content, l); - } - - g_free(ret->data); - ret = g_list_remove(ret, ret->data); - } - - close(out); - close(in); - - _exit(0); -} - -static void -resolved(gpointer data, gint source, PurpleInputCondition cond) -{ - int size; - int type; - PurpleSrvQueryData *query_data = (PurpleSrvQueryData*)data; - int i; - int status; - - if (read(source, &type, sizeof(type)) == sizeof(type)) { - if (read(source, &size, sizeof(size)) == sizeof(size)) { - if (size == -1 || size == 0) { - if (size == -1) { - purple_debug_warning("dnssrv", "res_query returned an error\n"); - /* Re-read resolv.conf and friends in case DNS servers have changed */ - res_init(); - } else - purple_debug_info("dnssrv", "Found 0 entries, errno is %i\n", errno); - - if (type == T_SRV) { - PurpleSrvCallback cb = query_data->cb.srv; - cb(NULL, 0, query_data->extradata); - } else if (type == T_TXT) { - PurpleTxtCallback cb = query_data->cb.txt; - cb(NULL, query_data->extradata); - } else { - purple_debug_error("dnssrv", "type unknown of DNS result entry; errno is %i\n", errno); - } - - } else if (size) { - if (type == T_SRV) { - PurpleSrvResponse *res; - PurpleSrvResponse *tmp; - PurpleSrvCallback cb = query_data->cb.srv; - ssize_t red; - purple_debug_info("dnssrv","found %d SRV entries\n", size); - tmp = res = g_new0(PurpleSrvResponse, size); - for (i = 0; i < size; i++) { - red = read(source, tmp++, sizeof(PurpleSrvResponse)); - if (red != sizeof(PurpleSrvResponse)) { - purple_debug_error("dnssrv","unable to read srv " - "response: %s\n", g_strerror(errno)); - size = 0; - g_free(res); - res = NULL; - } - } - - cb(res, size, query_data->extradata); - } else if (type == T_TXT) { - GList *responses = NULL; - PurpleTxtResponse *res; - PurpleTxtCallback cb = query_data->cb.txt; - ssize_t red; - purple_debug_info("dnssrv","found %d TXT entries\n", size); - for (i = 0; i < size; i++) { - gsize len; - - red = read(source, &len, sizeof(len)); - if (red != sizeof(len)) { - purple_debug_error("dnssrv","unable to read txt " - "response length: %s\n", g_strerror(errno)); - size = 0; - g_list_foreach(responses, (GFunc)purple_txt_response_destroy, NULL); - g_list_free(responses); - responses = NULL; - break; - } - - res = g_new0(PurpleTxtResponse, 1); - res->content = g_new0(gchar, len); - - red = read(source, res->content, len); - if (red != len) { - purple_debug_error("dnssrv","unable to read txt " - "response: %s\n", g_strerror(errno)); - size = 0; - purple_txt_response_destroy(res); - g_list_foreach(responses, (GFunc)purple_txt_response_destroy, NULL); - g_list_free(responses); - responses = NULL; - break; - } - responses = g_list_prepend(responses, res); - } - - responses = g_list_reverse(responses); - cb(responses, query_data->extradata); - } else { - purple_debug_error("dnssrv", "type unknown of DNS result entry; errno is %i\n", errno); - } - } - } - } - - waitpid(query_data->pid, &status, 0); - purple_srv_cancel(query_data); -} - -#else /* _WIN32 */ - -/** The Jabber Server code was inspiration for parts of this. */ - -static gboolean -res_main_thread_cb(gpointer data) -{ - PurpleSrvResponse *srvres = NULL; - PurpleSrvQueryData *query_data = data; - if(query_data->error_message != NULL) { - purple_debug_error("dnssrv", query_data->error_message); - if (query_data->type == DNS_TYPE_SRV) { - if (query_data->cb.srv) - query_data->cb.srv(srvres, 0, query_data->extradata); - } else if (query_data->type == DNS_TYPE_TXT) { - if (query_data->cb.txt) - query_data->cb.txt(NULL, query_data->extradata); - } - } else { - if (query_data->type == DNS_TYPE_SRV) { - PurpleSrvResponse *srvres_tmp = NULL; - GList *lst = query_data->results; - int size = g_list_length(lst); - - if(query_data->cb.srv && size > 0) - srvres_tmp = srvres = g_new0(PurpleSrvResponse, size); - while (lst) { - PurpleSrvResponse *lstdata = lst->data; - lst = g_list_delete_link(lst, lst); - - if(query_data->cb.srv) - memcpy(srvres_tmp++, lstdata, sizeof(PurpleSrvResponse)); - g_free(lstdata); - } - - query_data->results = NULL; - - purple_debug_info("dnssrv", "found %d SRV entries\n", size); - - if(query_data->cb.srv) query_data->cb.srv(srvres, size, query_data->extradata); - } else if (query_data->type == DNS_TYPE_TXT) { - GList *lst = query_data->results; - - purple_debug_info("dnssrv", "found %d TXT entries\n", g_list_length(lst)); - - if (query_data->cb.txt) { - query_data->results = NULL; - query_data->cb.txt(lst, query_data->extradata); - } - } else { - purple_debug_error("dnssrv", "unknown query type"); - } - } - - query_data->resolver = NULL; - query_data->handle = 0; - - purple_srv_cancel(query_data); - - return FALSE; -} - -static gpointer -res_thread(gpointer data) -{ - PDNS_RECORD dr = NULL; - int type; - DNS_STATUS ds; - PurpleSrvQueryData *query_data = data; - type = query_data->type; - ds = MyDnsQuery_UTF8(query_data->query, type, DNS_QUERY_STANDARD, NULL, &dr, NULL); - if (ds != ERROR_SUCCESS) { - gchar *msg = g_win32_error_message(ds); - if (type == DNS_TYPE_SRV) { - query_data->error_message = g_strdup_printf("Couldn't look up SRV record. %s (%lu).\n", msg, ds); - } else if (type == DNS_TYPE_TXT) { - query_data->error_message = g_strdup_printf("Couldn't look up TXT record. %s (%lu).\n", msg, ds); - } - g_free(msg); - } else { - if (type == DNS_TYPE_SRV) { - PDNS_RECORD dr_tmp; - GList *lst = NULL; - DNS_SRV_DATA *srv_data; - PurpleSrvResponse *srvres; - - for (dr_tmp = dr; dr_tmp != NULL; dr_tmp = dr_tmp->pNext) { - /* Discard any incorrect entries. I'm not sure if this is necessary */ - if (dr_tmp->wType != type || strcmp(dr_tmp->pName, query_data->query) != 0) { - continue; - } - - srv_data = &dr_tmp->Data.SRV; - srvres = g_new0(PurpleSrvResponse, 1); - strncpy(srvres->hostname, srv_data->pNameTarget, 255); - srvres->hostname[255] = '\0'; - srvres->pref = srv_data->wPriority; - srvres->port = srv_data->wPort; - srvres->weight = srv_data->wWeight; - - lst = g_list_prepend(lst, srvres); - } - - MyDnsRecordListFree(dr, DnsFreeRecordList); - query_data->results = purple_srv_sort(lst); - } else if (type == DNS_TYPE_TXT) { - PDNS_RECORD dr_tmp; - GList *lst = NULL; - DNS_TXT_DATA *txt_data; - PurpleTxtResponse *txtres; - - for (dr_tmp = dr; dr_tmp != NULL; dr_tmp = dr_tmp->pNext) { - GString *s; - int i; - - /* Discard any incorrect entries. I'm not sure if this is necessary */ - if (dr_tmp->wType != type || strcmp(dr_tmp->pName, query_data->query) != 0) { - continue; - } - - txt_data = &dr_tmp->Data.TXT; - txtres = g_new0(PurpleTxtResponse, 1); - - s = g_string_new(""); - for (i = 0; i < txt_data->dwStringCount; ++i) - s = g_string_append(s, txt_data->pStringArray[i]); - txtres->content = g_string_free(s, FALSE); - - lst = g_list_append(lst, txtres); - } - - MyDnsRecordListFree(dr, DnsFreeRecordList); - query_data->results = lst; - } else { - - } - } - - /* back to main thread */ - /* Note: this should *not* be attached to query_data->handle - it will cause leakage */ - purple_timeout_add(0, res_main_thread_cb, query_data); - - g_thread_exit(NULL); - return NULL; -} - -#endif - -PurpleSrvQueryData * -purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata) -{ - char *query; - char *hostname; - PurpleSrvQueryData *query_data; -#ifndef _WIN32 - PurpleSrvInternalQuery internal_query; - int in[2], out[2]; - int pid; -#else - GError* err = NULL; - static gboolean initialized = FALSE; -#endif - - if (!protocol || !*protocol || !transport || !*transport || !domain || !*domain) { - purple_debug_error("dnssrv", "Wrong arguments\n"); - cb(NULL, 0, extradata); - g_return_val_if_reached(NULL); - } - -#ifdef USE_IDN - if (!dns_str_is_ascii(domain)) { - int ret = purple_network_convert_idn_to_ascii(domain, &hostname); - if (ret != 0) { - purple_debug_error("dnssrv", "IDNA ToASCII failed\n"); - cb(NULL, 0, extradata); - return NULL; - } - } else /* Fallthru is intentional */ -#endif - hostname = g_strdup(domain); - - query = g_strdup_printf("_%s._%s.%s", protocol, transport, hostname); - purple_debug_info("dnssrv","querying SRV record for %s: %s\n", domain, - query); - g_free(hostname); - -#ifndef _WIN32 - if(pipe(in) || pipe(out)) { - purple_debug_error("dnssrv", "Could not create pipe\n"); - g_free(query); - cb(NULL, 0, extradata); - return NULL; - } - - pid = fork(); - if (pid == -1) { - purple_debug_error("dnssrv", "Could not create process!\n"); - cb(NULL, 0, extradata); - g_free(query); - return NULL; - } - - /* Child */ - if (pid == 0) - { - g_free(query); - - close(out[0]); - close(in[1]); - resolve(in[0], out[1]); - /* resolve() does not return */ - } - - close(out[1]); - close(in[0]); - - internal_query.type = T_SRV; - strncpy(internal_query.query, query, 255); - internal_query.query[255] = '\0'; - - if (write(in[1], &internal_query, sizeof(internal_query)) < 0) - purple_debug_error("dnssrv", "Could not write to SRV resolver\n"); - - query_data = g_new0(PurpleSrvQueryData, 1); - query_data->type = T_SRV; - query_data->cb.srv = cb; - query_data->extradata = extradata; - query_data->pid = pid; - query_data->fd_out = out[0]; - query_data->fd_in = in[1]; - query_data->handle = purple_input_add(out[0], PURPLE_INPUT_READ, resolved, query_data); - - g_free(query); - - return query_data; -#else - if (!initialized) { - MyDnsQuery_UTF8 = (void*) wpurple_find_and_loadproc("dnsapi.dll", "DnsQuery_UTF8"); - MyDnsRecordListFree = (void*) wpurple_find_and_loadproc( - "dnsapi.dll", "DnsRecordListFree"); - initialized = TRUE; - } - - query_data = g_new0(PurpleSrvQueryData, 1); - query_data->type = DNS_TYPE_SRV; - query_data->cb.srv = cb; - query_data->query = query; - query_data->extradata = extradata; - - if (!MyDnsQuery_UTF8 || !MyDnsRecordListFree) - query_data->error_message = g_strdup("System missing DNS API (Requires W2K+)\n"); - else { - query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err); - if (query_data->resolver == NULL) { - query_data->error_message = g_strdup_printf("SRV thread create failure: %s\n", (err && err->message) ? err->message : ""); - g_error_free(err); - } - } - - /* The query isn't going to happen, so finish the SRV lookup now. - * Asynchronously call the callback since stuff may not expect - * the callback to be called before this returns */ - if (query_data->error_message != NULL) - query_data->handle = purple_timeout_add(0, res_main_thread_cb, query_data); - - return query_data; -#endif -} - -PurpleSrvQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata) -{ - char *query; - char *hostname; - PurpleSrvQueryData *query_data; -#ifndef _WIN32 - PurpleSrvInternalQuery internal_query; - int in[2], out[2]; - int pid; -#else - GError* err = NULL; - static gboolean initialized = FALSE; -#endif - -#ifdef USE_IDN - if (!dns_str_is_ascii(domain)) { - int ret = purple_network_convert_idn_to_ascii(domain, &hostname); - if (ret != 0) { - purple_debug_error("dnssrv", "IDNA ToASCII failed\n"); - cb(NULL, extradata); - return NULL; - } - } else /* fallthru is intentional */ -#endif - hostname = g_strdup(domain); - - query = g_strdup_printf("%s.%s", owner, hostname); - purple_debug_info("dnssrv","querying TXT record for %s: %s\n", domain, - query); - g_free(hostname); - -#ifndef _WIN32 - if(pipe(in) || pipe(out)) { - purple_debug_error("dnssrv", "Could not create pipe\n"); - g_free(query); - cb(NULL, extradata); - return NULL; - } - - pid = fork(); - if (pid == -1) { - purple_debug_error("dnssrv", "Could not create process!\n"); - cb(NULL, extradata); - g_free(query); - return NULL; - } - - /* Child */ - if (pid == 0) - { - g_free(query); - - close(out[0]); - close(in[1]); - resolve(in[0], out[1]); - /* resolve() does not return */ - } - - close(out[1]); - close(in[0]); - - internal_query.type = T_TXT; - strncpy(internal_query.query, query, 255); - internal_query.query[255] = '\0'; - - if (write(in[1], &internal_query, sizeof(internal_query)) < 0) - purple_debug_error("dnssrv", "Could not write to TXT resolver\n"); - - query_data = g_new0(PurpleSrvQueryData, 1); - query_data->type = T_TXT; - query_data->cb.txt = cb; - query_data->extradata = extradata; - query_data->pid = pid; - query_data->fd_out = out[0]; - query_data->fd_in = in[1]; - query_data->handle = purple_input_add(out[0], PURPLE_INPUT_READ, resolved, query_data); - - g_free(query); - - return query_data; -#else - if (!initialized) { - MyDnsQuery_UTF8 = (void*) wpurple_find_and_loadproc("dnsapi.dll", "DnsQuery_UTF8"); - MyDnsRecordListFree = (void*) wpurple_find_and_loadproc( - "dnsapi.dll", "DnsRecordListFree"); - initialized = TRUE; - } - - query_data = g_new0(PurpleSrvQueryData, 1); - query_data->type = DNS_TYPE_TXT; - query_data->cb.txt = cb; - query_data->query = query; - query_data->extradata = extradata; - - if (!MyDnsQuery_UTF8 || !MyDnsRecordListFree) - query_data->error_message = g_strdup("System missing DNS API (Requires W2K+)\n"); - else { - query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err); - if (query_data->resolver == NULL) { - query_data->error_message = g_strdup_printf("TXT thread create failure: %s\n", (err && err->message) ? err->message : ""); - g_error_free(err); - } - } - - /* The query isn't going to happen, so finish the TXT lookup now. - * Asynchronously call the callback since stuff may not expect - * the callback to be called before this returns */ - if (query_data->error_message != NULL) - query_data->handle = purple_timeout_add(0, res_main_thread_cb, query_data); - - return query_data; -#endif -} - -void -purple_srv_cancel(PurpleSrvQueryData *query_data) -{ - if (query_data->handle > 0) - purple_input_remove(query_data->handle); -#ifdef _WIN32 - if (query_data->resolver != NULL) - { - /* - * It's not really possible to kill a thread. So instead we - * just set the callback to NULL and let the DNS lookup - * finish. - */ - query_data->cb.srv = NULL; - return; - } - g_free(query_data->query); - g_free(query_data->error_message); -#else - close(query_data->fd_out); - close(query_data->fd_in); -#endif - g_free(query_data); -} - -void -purple_txt_cancel(PurpleSrvQueryData *query_data) -{ - purple_srv_cancel(query_data); -} - -const gchar * -purple_txt_response_get_content(PurpleTxtResponse *resp) -{ - g_return_val_if_fail(resp != NULL, NULL); - - return resp->content; -} - -void purple_txt_response_destroy(PurpleTxtResponse *resp) -{ - g_return_if_fail(resp != NULL); - - g_free(resp->content); - g_free(resp); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/dnssrv.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file dnssrv.h - */ - -/* purple - * - * Copyright (C) 2005, Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_DNSSRV_H -#define _PURPLE_DNSSRV_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _PurpleSrvQueryData PurpleSrvQueryData; -typedef struct _PurpleSrvResponse PurpleSrvResponse; -typedef struct _PurpleTxtResponse PurpleTxtResponse; - -#include - -struct _PurpleSrvResponse { - char hostname[256]; - int port; - int weight; - int pref; -}; - -/** - * @param resp An array of PurpleSrvResponse of size results. The array - * is sorted based on the order described in the DNS SRV RFC. - * Users of this API should try each record in resp in order, - * starting at the beginning. - */ -typedef void (*PurpleSrvCallback)(PurpleSrvResponse *resp, int results, gpointer data); - -/** - * Callback that returns the data retrieved from a DNS TXT lookup. - * - * @param responses A GList of PurpleTxtResponse objects. - * @param data The extra data passed to purple_txt_resolve. - */ -typedef void (*PurpleTxtCallback)(GList *responses, gpointer data); - -/** - * Queries an SRV record. - * - * @param protocol Name of the protocol (e.g. "sip") - * @param transport Name of the transport ("tcp" or "udp") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - */ -PurpleSrvQueryData *purple_srv_resolve(const char *protocol, const char *transport, const char *domain, PurpleSrvCallback cb, gpointer extradata); - -/** - * Cancel an SRV DNS query. - * - * @param query_data The request to cancel. - */ -void purple_srv_cancel(PurpleSrvQueryData *query_data); - -/** - * Queries an TXT record. - * - * @param owner Name of the protocol (e.g. "_xmppconnect") - * @param domain Domain name to query (e.g. "blubb.com") - * @param cb A callback which will be called with the results - * @param extradata Extra data to be passed to the callback - * - * @since 2.6.0 - */ -PurpleSrvQueryData *purple_txt_resolve(const char *owner, const char *domain, PurpleTxtCallback cb, gpointer extradata); - -/** - * Cancel an TXT DNS query. - * - * @param query_data The request to cancel. - * @since 2.6.0 - */ -void purple_txt_cancel(PurpleSrvQueryData *query_data); - -/** - * Get the value of the current TXT record. - * - * @param response The TXT response record - * @returns The value of the current TXT record. - * @since 2.6.0 - */ -const gchar *purple_txt_response_get_content(PurpleTxtResponse *response); - -/** - * Destroy a TXT DNS response object. - * - * @param response The PurpleTxtResponse to destroy. - * @since 2.6.0 - */ -void purple_txt_response_destroy(PurpleTxtResponse *response); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_DNSSRV_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/** - * @file eventloop.c Purple Event Loop API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "eventloop.h" - -static PurpleEventLoopUiOps *eventloop_ui_ops = NULL; - -guint -purple_timeout_add(guint interval, GSourceFunc function, gpointer data) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - return ops->timeout_add(interval, function, data); -} - -guint -purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - if (ops->timeout_add_seconds) - return ops->timeout_add_seconds(interval, function, data); - else - return ops->timeout_add(1000 * interval, function, data); -} - -gboolean -purple_timeout_remove(guint tag) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - return ops->timeout_remove(tag); -} - -guint -purple_input_add(int source, PurpleInputCondition condition, PurpleInputFunction func, gpointer user_data) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - return ops->input_add(source, condition, func, user_data); -} - -gboolean -purple_input_remove(guint tag) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - return ops->input_remove(tag); -} - -int -purple_input_get_error(int fd, int *error) -{ - PurpleEventLoopUiOps *ops = purple_eventloop_get_ui_ops(); - - if (ops->input_get_error) - { - int ret = ops->input_get_error(fd, error); - errno = *error; - return ret; - } - else - { - socklen_t len; - len = sizeof(*error); - - return getsockopt(fd, SOL_SOCKET, SO_ERROR, error, &len); - } -} - -void -purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops) -{ - eventloop_ui_ops = ops; -} - -PurpleEventLoopUiOps * -purple_eventloop_get_ui_ops(void) -{ - g_return_val_if_fail(eventloop_ui_ops != NULL, NULL); - - return eventloop_ui_ops; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/eventloop.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,276 +0,0 @@ -/** - * @file eventloop.h Purple Event Loop API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_EVENTLOOP_H_ -#define _PURPLE_EVENTLOOP_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * An input condition. - */ -typedef enum -{ - PURPLE_INPUT_READ = 1 << 0, /**< A read condition. */ - PURPLE_INPUT_WRITE = 1 << 1 /**< A write condition. */ - -} PurpleInputCondition; - -/** The type of callbacks to handle events on file descriptors, as passed to - * purple_input_add(). The callback will receive the @c user_data passed to - * purple_input_add(), the file descriptor on which the event occurred, and the - * condition that was satisfied to cause the callback to be invoked. - */ -typedef void (*PurpleInputFunction)(gpointer, gint, PurpleInputCondition); - -/** @copydoc _PurpleEventLoopUiOps */ -typedef struct _PurpleEventLoopUiOps PurpleEventLoopUiOps; - -/** An abstraction of an application's mainloop; libpurple will use this to - * watch file descriptors and schedule timed callbacks. If your application - * uses the glib mainloop, there is an implementation of this struct in - * libpurple/example/nullclient.c which you can use verbatim. - */ -struct _PurpleEventLoopUiOps -{ - /** - * Should create a callback timer with an interval measured in - * milliseconds. The supplied @a function should be called every @a - * interval seconds until it returns @c FALSE, after which it should not - * be called again. - * - * Analogous to g_timeout_add in glib. - * - * Note: On Win32, this function may be called from a thread other than - * the libpurple thread. You should make sure to detect this situation - * and to only call "function" from the libpurple thread. - * - * @param interval the interval in milliseconds between calls - * to @a function. - * @param data arbitrary data to be passed to @a function at each - * call. - * @todo Who is responsible for freeing @a data? - * - * @return a handle for the timeout, which can be passed to - * #timeout_remove. - * - * @see purple_timeout_add - **/ - guint (*timeout_add)(guint interval, GSourceFunc function, gpointer data); - - /** - * Should remove a callback timer. Analogous to g_source_remove in glib. - * @param handle an identifier for a timeout, as returned by - * #timeout_add. - * @return @c TRUE if the timeout identified by @a handle was - * found and removed. - * @see purple_timeout_remove - */ - gboolean (*timeout_remove)(guint handle); - - /** - * Should add an input handler. Analogous to g_io_add_watch_full in - * glib. - * - * @param fd a file descriptor to watch for events - * @param cond a bitwise OR of events on @a fd for which @a func - * should be called. - * @param func a callback to fire whenever a relevant event on @a - * fd occurs. - * @param user_data arbitrary data to pass to @a fd. - * @return an identifier for this input handler, which can be - * passed to #input_remove. - * - * @see purple_input_add - */ - guint (*input_add)(int fd, PurpleInputCondition cond, - PurpleInputFunction func, gpointer user_data); - - /** - * Should remove an input handler. Analogous to g_source_remove in glib. - * @param handle an identifier, as returned by #input_add. - * @return @c TRUE if the input handler was found and removed. - * @see purple_input_remove - */ - gboolean (*input_remove)(guint handle); - - - /** - * If implemented, should get the current error status for an input. - * - * Implementation of this UI op is optional. Implement it if the UI's - * sockets or event loop needs to customize determination of socket - * error status. If unimplemented, getsockopt(2) will be used - * instead. - * - * @see purple_input_get_error - */ - int (*input_get_error)(int fd, int *error); - - /** - * If implemented, should create a callback timer with an interval - * measured in seconds. Analogous to g_timeout_add_seconds in glib. - * - * This allows UIs to group timers for better power efficiency. For - * this reason, @a interval may be rounded by up to a second. - * - * Implementation of this UI op is optional. If it's not implemented, - * calls to purple_timeout_add_seconds() will be serviced by - * #timeout_add. - * - * @see purple_timeout_add_seconds() - * @since 2.1.0 - **/ - guint (*timeout_add_seconds)(guint interval, GSourceFunc function, - gpointer data); - - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/**************************************************************************/ -/** @name Event Loop API */ -/**************************************************************************/ -/*@{*/ -/** - * Creates a callback timer. - * - * The timer will repeat until the function returns @c FALSE. The - * first call will be at the end of the first interval. - * - * If the timer is in a multiple of seconds, use purple_timeout_add_seconds() - * instead as it allows UIs to group timers for power efficiency. - * - * @param interval The time between calls of the function, in - * milliseconds. - * @param function The function to call. - * @param data data to pass to @a function. - * @return A handle to the timer which can be passed to - * purple_timeout_remove() to remove the timer. - */ -guint purple_timeout_add(guint interval, GSourceFunc function, gpointer data); - -/** - * Creates a callback timer. - * - * The timer will repeat until the function returns @c FALSE. The - * first call will be at the end of the first interval. - * - * This function allows UIs to group timers for better power efficiency. For - * this reason, @a interval may be rounded by up to a second. - * - * @param interval The time between calls of the function, in - * seconds. - * @param function The function to call. - * @param data data to pass to @a function. - * @return A handle to the timer which can be passed to - * purple_timeout_remove() to remove the timer. - * - * @since 2.1.0 - */ -guint purple_timeout_add_seconds(guint interval, GSourceFunc function, gpointer data); - -/** - * Removes a timeout handler. - * - * @param handle The handle, as returned by purple_timeout_add(). - * - * @return @c TRUE if the handler was successfully removed. - */ -gboolean purple_timeout_remove(guint handle); - -/** - * Adds an input handler. - * - * @param fd The input file descriptor. - * @param cond The condition type. - * @param func The callback function for data. - * @param user_data User-specified data. - * - * @return The resulting handle (will be greater than 0). - * @see g_io_add_watch_full - */ -guint purple_input_add(int fd, PurpleInputCondition cond, - PurpleInputFunction func, gpointer user_data); - -/** - * Removes an input handler. - * - * @param handle The handle of the input handler. Note that this is the return - * value from purple_input_add(), not the file descriptor. - */ -gboolean purple_input_remove(guint handle); - -/** - * Get the current error status for an input. - * - * The return value and error follow getsockopt() with a level of SOL_SOCKET and an - * option name of SO_ERROR, and this is how the error is determined if the UI does not - * implement the input_get_error UI op. - * - * @param fd The input file descriptor. - * @param error A pointer to an @c int which on return will have the error, or - * @c 0 if no error. - * - * @return @c 0 if there is no error; @c -1 if there is an error, in which case - * @a errno will be set. - */ -int -purple_input_get_error(int fd, int *error); - - -/*@}*/ - - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ -/** - * Sets the UI operations structure to be used for accounts. - * - * @param ops The UI operations structure. - */ -void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops); - -/** - * Returns the UI operations structure used for accounts. - * - * @return The UI operations structure in use. - */ -PurpleEventLoopUiOps *purple_eventloop_get_ui_ops(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_EVENTLOOP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/defines.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/defines.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/defines.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/defines.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -#define CUSTOM_USER_DIRECTORY "/dev/null" -#define CUSTOM_PLUGIN_PATH "" -#define PLUGIN_SAVE_PREF "/purple/nullclient/plugins/saved" -#define UI_ID "nullclient" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -noinst_PROGRAMS = nullclient - -nullclient_SOURCES = defines.h nullclient.c -nullclient_DEPENDENCIES = -nullclient_LDFLAGS = -export-dynamic -nullclient_LDADD = \ - $(DBUS_LIBS) \ - $(INTLLIBS) \ - $(GLIB_LIBS) \ - $(LIBXML_LIBS) \ - $(top_builddir)/libpurple/libpurple.la - -AM_CPPFLAGS = \ - -DSTANDALONE \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/\" \ - -DLOCALEDIR=\"$(datadir)/locale\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/libpurple \ - -I$(top_srcdir) \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(LIBXML_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,686 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -noinst_PROGRAMS = nullclient$(EXEEXT) -subdir = libpurple/example -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_nullclient_OBJECTS = nullclient.$(OBJEXT) -nullclient_OBJECTS = $(am_nullclient_OBJECTS) -am__DEPENDENCIES_1 = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(nullclient_SOURCES) -DIST_SOURCES = $(nullclient_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -nullclient_SOURCES = defines.h nullclient.c -nullclient_DEPENDENCIES = -nullclient_LDFLAGS = -export-dynamic -nullclient_LDADD = \ - $(DBUS_LIBS) \ - $(INTLLIBS) \ - $(GLIB_LIBS) \ - $(LIBXML_LIBS) \ - $(top_builddir)/libpurple/libpurple.la - -AM_CPPFLAGS = \ - -DSTANDALONE \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/\" \ - -DLOCALEDIR=\"$(datadir)/locale\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/libpurple \ - -I$(top_srcdir) \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(LIBXML_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/example/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/example/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -nullclient$(EXEEXT): $(nullclient_OBJECTS) $(nullclient_DEPENDENCIES) - @rm -f nullclient$(EXEEXT) - $(LINK) $(nullclient_LDFLAGS) $(nullclient_OBJECTS) $(nullclient_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nullclient.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/nullclient.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/nullclient.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/nullclient.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/example/nullclient.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,313 +0,0 @@ -/* - * pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "purple.h" - -#include - -#include -#include -#include - -#include "defines.h" - -/** - * The following eventloop functions are used in both pidgin and purple-text. If your - * application uses glib mainloop, you can safely use this verbatim. - */ -#define PURPLE_GLIB_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) -#define PURPLE_GLIB_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) - -typedef struct _PurpleGLibIOClosure { - PurpleInputFunction function; - guint result; - gpointer data; -} PurpleGLibIOClosure; - -static void purple_glib_io_destroy(gpointer data) -{ - g_free(data); -} - -static gboolean purple_glib_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) -{ - PurpleGLibIOClosure *closure = data; - PurpleInputCondition purple_cond = 0; - - if (condition & PURPLE_GLIB_READ_COND) - purple_cond |= PURPLE_INPUT_READ; - if (condition & PURPLE_GLIB_WRITE_COND) - purple_cond |= PURPLE_INPUT_WRITE; - - closure->function(closure->data, g_io_channel_unix_get_fd(source), - purple_cond); - - return TRUE; -} - -static guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, - gpointer data) -{ - PurpleGLibIOClosure *closure = g_new0(PurpleGLibIOClosure, 1); - GIOChannel *channel; - GIOCondition cond = 0; - - closure->function = function; - closure->data = data; - - if (condition & PURPLE_INPUT_READ) - cond |= PURPLE_GLIB_READ_COND; - if (condition & PURPLE_INPUT_WRITE) - cond |= PURPLE_GLIB_WRITE_COND; - - channel = g_io_channel_unix_new(fd); - closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, - purple_glib_io_invoke, closure, purple_glib_io_destroy); - - g_io_channel_unref(channel); - return closure->result; -} - -static PurpleEventLoopUiOps glib_eventloops = -{ - g_timeout_add, - g_source_remove, - glib_input_add, - g_source_remove, - NULL, -#if GLIB_CHECK_VERSION(2,14,0) - g_timeout_add_seconds, -#else - NULL, -#endif - - /* padding */ - NULL, - NULL, - NULL -}; -/*** End of the eventloop functions. ***/ - -/*** Conversation uiops ***/ -static void -null_write_conv(PurpleConversation *conv, const char *who, const char *alias, - const char *message, PurpleMessageFlags flags, time_t mtime) -{ - const char *name; - if (alias && *alias) - name = alias; - else if (who && *who) - name = who; - else - name = NULL; - - printf("(%s) %s %s: %s\n", purple_conversation_get_name(conv), - purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)), - name, message); -} - -static PurpleConversationUiOps null_conv_uiops = -{ - NULL, /* create_conversation */ - NULL, /* destroy_conversation */ - NULL, /* write_chat */ - NULL, /* write_im */ - null_write_conv, /* write_conv */ - NULL, /* chat_add_users */ - NULL, /* chat_rename_user */ - NULL, /* chat_remove_users */ - NULL, /* chat_update_user */ - NULL, /* present */ - NULL, /* has_focus */ - NULL, /* custom_smiley_add */ - NULL, /* custom_smiley_write */ - NULL, /* custom_smiley_close */ - NULL, /* send_confirm */ - NULL, - NULL, - NULL, - NULL -}; - -static void -null_ui_init(void) -{ - /** - * This should initialize the UI components for all the modules. Here we - * just initialize the UI for conversations. - */ - purple_conversations_set_ui_ops(&null_conv_uiops); -} - -static PurpleCoreUiOps null_core_uiops = -{ - NULL, - NULL, - null_ui_init, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_libpurple(void) -{ - /* Set a custom user directory (optional) */ - purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); - - /* We do not want any debugging for now to keep the noise to a minimum. */ - purple_debug_set_enabled(FALSE); - - /* Set the core-uiops, which is used to - * - initialize the ui specific preferences. - * - initialize the debug ui. - * - initialize the ui components for all the modules. - * - uninitialize the ui components for all the modules when the core terminates. - */ - purple_core_set_ui_ops(&null_core_uiops); - - /* Set the uiops for the eventloop. If your client is glib-based, you can safely - * copy this verbatim. */ - purple_eventloop_set_ui_ops(&glib_eventloops); - - /* Set path to search for plugins. The core (libpurple) takes care of loading the - * core-plugins, which includes the protocol-plugins. So it is not essential to add - * any path here, but it might be desired, especially for ui-specific plugins. */ - purple_plugins_add_search_path(CUSTOM_PLUGIN_PATH); - - /* Now that all the essential stuff has been set, let's try to init the core. It's - * necessary to provide a non-NULL name for the current ui to the core. This name - * is used by stuff that depends on this ui, for example the ui-specific plugins. */ - if (!purple_core_init(UI_ID)) { - /* Initializing the core failed. Terminate. */ - fprintf(stderr, - "libpurple initialization failed. Dumping core.\n" - "Please report this!\n"); - abort(); - } - - /* Create and load the buddylist. */ - purple_set_blist(purple_blist_new()); - purple_blist_load(); - - /* Load the preferences. */ - purple_prefs_load(); - - /* Load the desired plugins. The client should save the list of loaded plugins in - * the preferences using purple_plugins_save_loaded(PLUGIN_SAVE_PREF) */ - purple_plugins_load_saved(PLUGIN_SAVE_PREF); - - /* Load the pounces. */ - purple_pounces_load(); -} - -static void -signed_on(PurpleConnection *gc, gpointer null) -{ - PurpleAccount *account = purple_connection_get_account(gc); - printf("Account connected: %s %s\n", account->username, account->protocol_id); -} - -static void -connect_to_signals_for_demonstration_purposes_only(void) -{ - static int handle; - purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, - PURPLE_CALLBACK(signed_on), NULL); -} - -int main(int argc, char *argv[]) -{ - GList *iter; - int i, num; - GList *names = NULL; - const char *prpl; - char name[128]; - char *password; - GMainLoop *loop = g_main_loop_new(NULL, FALSE); - PurpleAccount *account; - PurpleSavedStatus *status; - char *res; - - /* libpurple's built-in DNS resolution forks processes to perform - * blocking lookups without blocking the main process. It does not - * handle SIGCHLD itself, so if the UI does not you quickly get an army - * of zombie subprocesses marching around. - */ - signal(SIGCHLD, SIG_IGN); - - init_libpurple(); - - printf("libpurple initialized.\n"); - - iter = purple_plugins_get_protocols(); - for (i = 0; iter; iter = iter->next) { - PurplePlugin *plugin = iter->data; - PurplePluginInfo *info = plugin->info; - if (info && info->name) { - printf("\t%d: %s\n", i++, info->name); - names = g_list_append(names, info->id); - } - } - printf("Select the protocol [0-%d]: ", i-1); - res = fgets(name, sizeof(name), stdin); - if (!res) { - fprintf(stderr, "Failed to gets protocol selection."); - abort(); - } - sscanf(name, "%d", &num); - prpl = g_list_nth_data(names, num); - - printf("Username: "); - res = fgets(name, sizeof(name), stdin); - if (!res) { - fprintf(stderr, "Failed to read user name."); - abort(); - } - name[strlen(name) - 1] = 0; /* strip the \n at the end */ - - /* Create the account */ - account = purple_account_new(name, prpl); - - /* Get the password for the account */ - password = getpass("Password: "); - purple_account_set_password(account, password); - - /* It's necessary to enable the account first. */ - purple_account_set_enabled(account, UI_ID, TRUE); - - /* Now, to connect the account(s), create a status and activate it. */ - status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); - purple_savedstatus_activate(status); - - connect_to_signals_for_demonstration_purposes_only(); - - g_main_loop_run(loop); - - return 0; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1539 +0,0 @@ -/** - * @file ft.c File Transfer API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "dbus-maybe.h" -#include "ft.h" -#include "network.h" -#include "notify.h" -#include "prefs.h" -#include "proxy.h" -#include "request.h" -#include "util.h" -#include "debug.h" - -#define FT_INITIAL_BUFFER_SIZE 4096 -#define FT_MAX_BUFFER_SIZE 65535 - -static PurpleXferUiOps *xfer_ui_ops = NULL; -static GList *xfers; - -/* - * A hack to store more data since we can't extend the size of PurpleXfer - * easily. - */ -static GHashTable *xfers_data = NULL; - -typedef struct _PurpleXferPrivData { - /* - * Used to moderate the file transfer when either the read/write ui_ops are - * set or fd is not set. In those cases, the UI/prpl call the respective - * function, which is somewhat akin to a fd watch being triggered. - */ - enum { - PURPLE_XFER_READY_NONE = 0x0, - PURPLE_XFER_READY_UI = 0x1, - PURPLE_XFER_READY_PRPL = 0x2, - } ready; -} PurpleXferPrivData; - -static int purple_xfer_choose_file(PurpleXfer *xfer); - -static void -purple_xfer_priv_data_destroy(gpointer data) -{ - PurpleXferPrivData *priv = data; - - g_free(priv); -} - -GList * -purple_xfers_get_all() -{ - return xfers; -} - -PurpleXfer * -purple_xfer_new(PurpleAccount *account, PurpleXferType type, const char *who) -{ - PurpleXfer *xfer; - PurpleXferUiOps *ui_ops; - PurpleXferPrivData *priv; - - g_return_val_if_fail(type != PURPLE_XFER_UNKNOWN, NULL); - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(who != NULL, NULL); - - xfer = g_new0(PurpleXfer, 1); - PURPLE_DBUS_REGISTER_POINTER(xfer, PurpleXfer); - - xfer->ref = 1; - xfer->type = type; - xfer->account = account; - xfer->who = g_strdup(who); - xfer->ui_ops = purple_xfers_get_ui_ops(); - xfer->message = NULL; - xfer->current_buffer_size = FT_INITIAL_BUFFER_SIZE; - xfer->fd = -1; - - priv = g_new0(PurpleXferPrivData, 1); - priv->ready = PURPLE_XFER_READY_NONE; - - g_hash_table_insert(xfers_data, xfer, priv); - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops != NULL && ui_ops->new_xfer != NULL) - ui_ops->new_xfer(xfer); - - xfers = g_list_prepend(xfers, xfer); - return xfer; -} - -static void -purple_xfer_destroy(PurpleXfer *xfer) -{ - PurpleXferUiOps *ui_ops; - - g_return_if_fail(xfer != NULL); - - /* Close the file browser, if it's open */ - purple_request_close_with_handle(xfer); - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_STARTED) - purple_xfer_cancel_local(xfer); - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops != NULL && ui_ops->destroy != NULL) - ui_ops->destroy(xfer); - - g_free(xfer->who); - g_free(xfer->filename); - g_free(xfer->remote_ip); - g_free(xfer->local_filename); - - g_hash_table_remove(xfers_data, xfer); - - PURPLE_DBUS_UNREGISTER_POINTER(xfer); - xfers = g_list_remove(xfers, xfer); - g_free(xfer); -} - -void -purple_xfer_ref(PurpleXfer *xfer) -{ - g_return_if_fail(xfer != NULL); - - xfer->ref++; -} - -void -purple_xfer_unref(PurpleXfer *xfer) -{ - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->ref > 0); - - xfer->ref--; - - if (xfer->ref == 0) - purple_xfer_destroy(xfer); -} - -static void -purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status) -{ - g_return_if_fail(xfer != NULL); - - if (xfer->status == status) - return; - - xfer->status = status; - - if(xfer->type == PURPLE_XFER_SEND) { - switch(status) { - case PURPLE_XFER_STATUS_ACCEPTED: - purple_signal_emit(purple_xfers_get_handle(), "file-send-accept", xfer); - break; - case PURPLE_XFER_STATUS_STARTED: - purple_signal_emit(purple_xfers_get_handle(), "file-send-start", xfer); - break; - case PURPLE_XFER_STATUS_DONE: - purple_signal_emit(purple_xfers_get_handle(), "file-send-complete", xfer); - break; - case PURPLE_XFER_STATUS_CANCEL_LOCAL: - case PURPLE_XFER_STATUS_CANCEL_REMOTE: - purple_signal_emit(purple_xfers_get_handle(), "file-send-cancel", xfer); - break; - default: - break; - } - } else if(xfer->type == PURPLE_XFER_RECEIVE) { - switch(status) { - case PURPLE_XFER_STATUS_ACCEPTED: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-accept", xfer); - break; - case PURPLE_XFER_STATUS_STARTED: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-start", xfer); - break; - case PURPLE_XFER_STATUS_DONE: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-complete", xfer); - break; - case PURPLE_XFER_STATUS_CANCEL_LOCAL: - case PURPLE_XFER_STATUS_CANCEL_REMOTE: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-cancel", xfer); - break; - default: - break; - } - } -} - -void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error) -{ - PurpleConversation *conv = NULL; - PurpleMessageFlags flags = PURPLE_MESSAGE_SYSTEM; - char *escaped; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(message != NULL); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, - purple_xfer_get_account(xfer)); - - if (conv == NULL) - return; - - escaped = g_markup_escape_text(message, -1); - - if (is_error) - flags |= PURPLE_MESSAGE_ERROR; - - purple_conversation_write(conv, NULL, escaped, flags, time(NULL)); - g_free(escaped); -} - -static void purple_xfer_show_file_error(PurpleXfer *xfer, const char *filename) -{ - int err = errno; - gchar *msg = NULL, *utf8; - PurpleXferType xfer_type = purple_xfer_get_type(xfer); - PurpleAccount *account = purple_xfer_get_account(xfer); - - utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); - switch(xfer_type) { - case PURPLE_XFER_SEND: - msg = g_strdup_printf(_("Error reading %s: \n%s.\n"), - utf8, g_strerror(err)); - break; - case PURPLE_XFER_RECEIVE: - msg = g_strdup_printf(_("Error writing %s: \n%s.\n"), - utf8, g_strerror(err)); - break; - default: - msg = g_strdup_printf(_("Error accessing %s: \n%s.\n"), - utf8, g_strerror(err)); - break; - } - g_free(utf8); - - purple_xfer_conversation_write(xfer, msg, TRUE); - purple_xfer_error(xfer_type, account, xfer->who, msg); - g_free(msg); -} - -static void -purple_xfer_choose_file_ok_cb(void *user_data, const char *filename) -{ - PurpleXfer *xfer; - struct stat st; - gchar *dir; - - xfer = (PurpleXfer *)user_data; - - if (g_stat(filename, &st) != 0) { - /* File not found. */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) { -#ifndef _WIN32 - int mode = W_OK; -#else - int mode = F_OK; -#endif - dir = g_path_get_dirname(filename); - - if (g_access(dir, mode) == 0) { - purple_xfer_request_accepted(xfer, filename); - } else { - purple_xfer_ref(xfer); - purple_notify_message( - NULL, PURPLE_NOTIFY_MSG_ERROR, NULL, - _("Directory is not writable."), NULL, - (PurpleNotifyCloseCallback)purple_xfer_choose_file, xfer); - } - - g_free(dir); - } - else { - purple_xfer_show_file_error(xfer, filename); - purple_xfer_request_denied(xfer); - } - } - else if ((purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) && - (st.st_size == 0)) { - - purple_notify_error(NULL, NULL, - _("Cannot send a file of 0 bytes."), NULL); - - purple_xfer_request_denied(xfer); - } - else if ((purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) && - S_ISDIR(st.st_mode)) { - /* - * XXX - Sending a directory should be valid for some protocols. - */ - purple_notify_error(NULL, NULL, - _("Cannot send a directory."), NULL); - - purple_xfer_request_denied(xfer); - } - else if ((purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) && - S_ISDIR(st.st_mode)) { - char *msg, *utf8; - utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); - msg = g_strdup_printf( - _("%s is not a regular file. Cowardly refusing to overwrite it.\n"), utf8); - g_free(utf8); - purple_notify_error(NULL, NULL, msg, NULL); - g_free(msg); - purple_xfer_request_denied(xfer); - } - else { - purple_xfer_request_accepted(xfer, filename); - } - - purple_xfer_unref(xfer); -} - -static void -purple_xfer_choose_file_cancel_cb(void *user_data, const char *filename) -{ - PurpleXfer *xfer = (PurpleXfer *)user_data; - - purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); - purple_xfer_request_denied(xfer); -} - -static int -purple_xfer_choose_file(PurpleXfer *xfer) -{ - purple_request_file(xfer, NULL, purple_xfer_get_filename(xfer), - (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE), - G_CALLBACK(purple_xfer_choose_file_ok_cb), - G_CALLBACK(purple_xfer_choose_file_cancel_cb), - purple_xfer_get_account(xfer), xfer->who, NULL, - xfer); - - return 0; -} - -static int -cancel_recv_cb(PurpleXfer *xfer) -{ - purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); - purple_xfer_request_denied(xfer); - purple_xfer_unref(xfer); - - return 0; -} - -static void -purple_xfer_ask_recv(PurpleXfer *xfer) -{ - char *buf, *size_buf; - size_t size; - - /* If we have already accepted the request, ask the destination file - name directly */ - if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_ACCEPTED) { - PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who); - - if (purple_xfer_get_filename(xfer) != NULL) - { - size = purple_xfer_get_size(xfer); - size_buf = purple_str_size_to_units(size); - buf = g_strdup_printf(_("%s wants to send you %s (%s)"), - buddy ? purple_buddy_get_alias(buddy) : xfer->who, - purple_xfer_get_filename(xfer), size_buf); - g_free(size_buf); - } - else - { - buf = g_strdup_printf(_("%s wants to send you a file"), - buddy ? purple_buddy_get_alias(buddy) : xfer->who); - } - - if (xfer->message != NULL) - serv_got_im(purple_account_get_connection(xfer->account), - xfer->who, xfer->message, 0, time(NULL)); - - purple_request_accept_cancel(xfer, NULL, buf, NULL, - PURPLE_DEFAULT_ACTION_NONE, - xfer->account, xfer->who, NULL, - xfer, - G_CALLBACK(purple_xfer_choose_file), - G_CALLBACK(cancel_recv_cb)); - - g_free(buf); - } else - purple_xfer_choose_file(xfer); -} - -static int -ask_accept_ok(PurpleXfer *xfer) -{ - purple_xfer_request_accepted(xfer, NULL); - - return 0; -} - -static int -ask_accept_cancel(PurpleXfer *xfer) -{ - purple_xfer_request_denied(xfer); - purple_xfer_unref(xfer); - - return 0; -} - -static void -purple_xfer_ask_accept(PurpleXfer *xfer) -{ - char *buf, *buf2 = NULL; - PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who); - - buf = g_strdup_printf(_("Accept file transfer request from %s?"), - buddy ? purple_buddy_get_alias(buddy) : xfer->who); - if (purple_xfer_get_remote_ip(xfer) && - purple_xfer_get_remote_port(xfer)) - buf2 = g_strdup_printf(_("A file is available for download from:\n" - "Remote host: %s\nRemote port: %d"), - purple_xfer_get_remote_ip(xfer), - purple_xfer_get_remote_port(xfer)); - purple_request_accept_cancel(xfer, NULL, buf, buf2, - PURPLE_DEFAULT_ACTION_NONE, - xfer->account, xfer->who, NULL, - xfer, - G_CALLBACK(ask_accept_ok), - G_CALLBACK(ask_accept_cancel)); - g_free(buf); - g_free(buf2); -} - -void -purple_xfer_request(PurpleXfer *xfer) -{ - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->ops.init != NULL); - - purple_xfer_ref(xfer); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) - { - purple_signal_emit(purple_xfers_get_handle(), "file-recv-request", xfer); - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) - { - /* The file-transfer was cancelled by a plugin */ - purple_xfer_cancel_local(xfer); - } - else if (purple_xfer_get_filename(xfer) || - purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_ACCEPTED) - { - gchar* message = NULL; - PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who); - message = g_strdup_printf(_("%s is offering to send file %s"), - buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer)); - purple_xfer_conversation_write(xfer, message, FALSE); - g_free(message); - /* Ask for a filename to save to if it's not already given by a plugin */ - if (xfer->local_filename == NULL) - purple_xfer_ask_recv(xfer); - } - else - { - purple_xfer_ask_accept(xfer); - } - } - else - { - purple_xfer_choose_file(xfer); - } -} - -void -purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename) -{ - PurpleXferType type; - struct stat st; - char *msg, *utf8, *base; - PurpleAccount *account; - PurpleBuddy *buddy; - - if (xfer == NULL) - return; - - type = purple_xfer_get_type(xfer); - account = purple_xfer_get_account(xfer); - - if (!filename && type == PURPLE_XFER_RECEIVE) { - xfer->status = PURPLE_XFER_STATUS_ACCEPTED; - xfer->ops.init(xfer); - return; - } - - buddy = purple_find_buddy(account, xfer->who); - - if (type == PURPLE_XFER_SEND) { - /* Sending a file */ - /* Check the filename. */ - PurpleXferUiOps *ui_ops; - ui_ops = purple_xfer_get_ui_ops(xfer); - -#ifdef _WIN32 - if (g_strrstr(filename, "../") || g_strrstr(filename, "..\\")) -#else - if (g_strrstr(filename, "../")) -#endif - { - utf8 = g_filename_to_utf8(filename, -1, NULL, NULL, NULL); - - msg = g_strdup_printf(_("%s is not a valid filename.\n"), utf8); - purple_xfer_error(type, account, xfer->who, msg); - g_free(utf8); - g_free(msg); - - purple_xfer_unref(xfer); - return; - } - - if (ui_ops == NULL || (ui_ops->ui_read == NULL && ui_ops->ui_write == NULL)) { - if (g_stat(filename, &st) == -1) { - purple_xfer_show_file_error(xfer, filename); - purple_xfer_unref(xfer); - return; - } - - purple_xfer_set_local_filename(xfer, filename); - purple_xfer_set_size(xfer, st.st_size); - } else { - utf8 = g_strdup(filename); - purple_xfer_set_local_filename(xfer, filename); - } - - base = g_path_get_basename(filename); - utf8 = g_filename_to_utf8(base, -1, NULL, NULL, NULL); - g_free(base); - purple_xfer_set_filename(xfer, utf8); - - msg = g_strdup_printf(_("Offering to send %s to %s"), - utf8, buddy ? purple_buddy_get_alias(buddy) : xfer->who); - g_free(utf8); - purple_xfer_conversation_write(xfer, msg, FALSE); - g_free(msg); - } - else { - /* Receiving a file */ - xfer->status = PURPLE_XFER_STATUS_ACCEPTED; - purple_xfer_set_local_filename(xfer, filename); - - msg = g_strdup_printf(_("Starting transfer of %s from %s"), - xfer->filename, buddy ? purple_buddy_get_alias(buddy) : xfer->who); - purple_xfer_conversation_write(xfer, msg, FALSE); - g_free(msg); - } - - purple_xfer_add(xfer); - xfer->ops.init(xfer); - -} - -void -purple_xfer_request_denied(PurpleXfer *xfer) -{ - g_return_if_fail(xfer != NULL); - - if (xfer->ops.request_denied != NULL) - xfer->ops.request_denied(xfer); - - purple_xfer_unref(xfer); -} - -PurpleXferType -purple_xfer_get_type(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, PURPLE_XFER_UNKNOWN); - - return xfer->type; -} - -PurpleAccount * -purple_xfer_get_account(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, NULL); - - return xfer->account; -} - -const char * -purple_xfer_get_remote_user(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, NULL); - return xfer->who; -} - -PurpleXferStatusType -purple_xfer_get_status(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, PURPLE_XFER_STATUS_UNKNOWN); - - return xfer->status; -} - -gboolean -purple_xfer_is_canceled(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, TRUE); - - if ((purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) || - (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE)) - return TRUE; - else - return FALSE; -} - -gboolean -purple_xfer_is_completed(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, TRUE); - - return (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_DONE); -} - -const char * -purple_xfer_get_filename(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, NULL); - - return xfer->filename; -} - -const char * -purple_xfer_get_local_filename(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, NULL); - - return xfer->local_filename; -} - -size_t -purple_xfer_get_bytes_sent(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, 0); - - return xfer->bytes_sent; -} - -size_t -purple_xfer_get_bytes_remaining(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, 0); - - return xfer->bytes_remaining; -} - -size_t -purple_xfer_get_size(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, 0); - - return xfer->size; -} - -double -purple_xfer_get_progress(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, 0.0); - - if (purple_xfer_get_size(xfer) == 0) - return 0.0; - - return ((double)purple_xfer_get_bytes_sent(xfer) / - (double)purple_xfer_get_size(xfer)); -} - -unsigned int -purple_xfer_get_local_port(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, -1); - - return xfer->local_port; -} - -const char * -purple_xfer_get_remote_ip(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, NULL); - - return xfer->remote_ip; -} - -unsigned int -purple_xfer_get_remote_port(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, -1); - - return xfer->remote_port; -} - -time_t -purple_xfer_get_start_time(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, 0); - - return xfer->start_time; -} - -time_t -purple_xfer_get_end_time(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, 0); - - return xfer->end_time; -} - -void -purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed) -{ - PurpleXferUiOps *ui_ops; - - g_return_if_fail(xfer != NULL); - - if (completed == TRUE) { - char *msg = NULL; - PurpleConversation *conv; - - purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_DONE); - - if (purple_xfer_get_filename(xfer) != NULL) - { - char *filename = g_markup_escape_text(purple_xfer_get_filename(xfer), -1); - if (purple_xfer_get_local_filename(xfer) - && purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) - { - char *local = g_markup_escape_text(purple_xfer_get_local_filename(xfer), -1); - msg = g_strdup_printf(_("Transfer of file %s complete"), - local, filename); - g_free(local); - } - else - msg = g_strdup_printf(_("Transfer of file %s complete"), - filename); - g_free(filename); - } - else - msg = g_strdup(_("File transfer complete")); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, - purple_xfer_get_account(xfer)); - - if (conv != NULL) - purple_conversation_write(conv, NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops != NULL && ui_ops->update_progress != NULL) - ui_ops->update_progress(xfer, purple_xfer_get_progress(xfer)); -} - -void -purple_xfer_set_message(PurpleXfer *xfer, const char *message) -{ - g_return_if_fail(xfer != NULL); - - g_free(xfer->message); - xfer->message = g_strdup(message); -} - -void -purple_xfer_set_filename(PurpleXfer *xfer, const char *filename) -{ - g_return_if_fail(xfer != NULL); - - g_free(xfer->filename); - xfer->filename = g_strdup(filename); -} - -void -purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename) -{ - g_return_if_fail(xfer != NULL); - - g_free(xfer->local_filename); - xfer->local_filename = g_strdup(filename); -} - -void -purple_xfer_set_size(PurpleXfer *xfer, size_t size) -{ - g_return_if_fail(xfer != NULL); - - xfer->size = size; - xfer->bytes_remaining = xfer->size - purple_xfer_get_bytes_sent(xfer); -} - -void -purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent) -{ - g_return_if_fail(xfer != NULL); - - xfer->bytes_sent = bytes_sent; - xfer->bytes_remaining = purple_xfer_get_size(xfer) - bytes_sent; -} - -PurpleXferUiOps * -purple_xfer_get_ui_ops(const PurpleXfer *xfer) -{ - g_return_val_if_fail(xfer != NULL, NULL); - - return xfer->ui_ops; -} - -void -purple_xfer_set_init_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.init = fnc; -} - -void purple_xfer_set_request_denied_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.request_denied = fnc; -} - -void -purple_xfer_set_read_fnc(PurpleXfer *xfer, gssize (*fnc)(guchar **, PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.read = fnc; -} - -void -purple_xfer_set_write_fnc(PurpleXfer *xfer, - gssize (*fnc)(const guchar *, size_t, PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.write = fnc; -} - -void -purple_xfer_set_ack_fnc(PurpleXfer *xfer, - void (*fnc)(PurpleXfer *, const guchar *, size_t)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.ack = fnc; -} - -void -purple_xfer_set_start_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.start = fnc; -} - -void -purple_xfer_set_end_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.end = fnc; -} - -void -purple_xfer_set_cancel_send_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.cancel_send = fnc; -} - -void -purple_xfer_set_cancel_recv_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)) -{ - g_return_if_fail(xfer != NULL); - - xfer->ops.cancel_recv = fnc; -} - -static void -purple_xfer_increase_buffer_size(PurpleXfer *xfer) -{ - xfer->current_buffer_size = MIN(xfer->current_buffer_size * 1.5, - FT_MAX_BUFFER_SIZE); -} - -gssize -purple_xfer_read(PurpleXfer *xfer, guchar **buffer) -{ - gssize s, r; - - g_return_val_if_fail(xfer != NULL, 0); - g_return_val_if_fail(buffer != NULL, 0); - - if (purple_xfer_get_size(xfer) == 0) - s = xfer->current_buffer_size; - else - s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size); - - if (xfer->ops.read != NULL) { - r = (xfer->ops.read)(buffer, xfer); - } - else { - *buffer = g_malloc0(s); - - r = read(xfer->fd, *buffer, s); - if (r < 0 && errno == EAGAIN) - r = 0; - else if (r < 0) - r = -1; - else if (r == 0) - r = -1; - } - - if (r == xfer->current_buffer_size) - /* - * We managed to read the entire buffer. This means our this - * network is fast and our buffer is too small, so make it - * bigger. - */ - purple_xfer_increase_buffer_size(xfer); - - return r; -} - -gssize -purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size) -{ - gssize r, s; - - g_return_val_if_fail(xfer != NULL, 0); - g_return_val_if_fail(buffer != NULL, 0); - g_return_val_if_fail(size != 0, 0); - - s = MIN(purple_xfer_get_bytes_remaining(xfer), size); - - if (xfer->ops.write != NULL) { - r = (xfer->ops.write)(buffer, s, xfer); - } else { - r = write(xfer->fd, buffer, s); - if (r < 0 && errno == EAGAIN) - r = 0; - if ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer)) - purple_xfer_set_completed(xfer, TRUE); - } - - return r; -} - -static void -do_transfer(PurpleXfer *xfer) -{ - PurpleXferUiOps *ui_ops; - guchar *buffer = NULL; - gssize r = 0; - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (xfer->type == PURPLE_XFER_RECEIVE) { - r = purple_xfer_read(xfer, &buffer); - if (r > 0) { - size_t wc; - if (ui_ops && ui_ops->ui_write) - wc = ui_ops->ui_write(xfer, buffer, r); - else - wc = fwrite(buffer, 1, r, xfer->dest_fp); - - if (wc != r) { - purple_debug_error("filetransfer", "Unable to write whole buffer.\n"); - purple_xfer_cancel_local(xfer); - g_free(buffer); - return; - } - - if ((purple_xfer_get_size(xfer) > 0) && - ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer))) - purple_xfer_set_completed(xfer, TRUE); - } else if(r < 0) { - purple_xfer_cancel_remote(xfer); - g_free(buffer); - return; - } - } else if (xfer->type == PURPLE_XFER_SEND) { - size_t result; - size_t s = MIN(purple_xfer_get_bytes_remaining(xfer), xfer->current_buffer_size); - - /* this is so the prpl can keep the connection open - if it needs to for some odd reason. */ - if (s == 0) { - if (xfer->watcher) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - return; - } - - if (ui_ops && ui_ops->ui_read) { - gssize tmp = ui_ops->ui_read(xfer, &buffer, s); - if (tmp == 0) { - /* - * UI isn't ready to send data. It will call - * purple_xfer_ui_ready when ready, which sets back up this - * watcher. - */ - if (xfer->watcher != 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - - return; - } else if (tmp < 0) { - purple_debug_error("filetransfer", "Unable to read whole buffer.\n"); - purple_xfer_cancel_local(xfer); - return; - } - - result = tmp; - } else { - buffer = g_malloc0(s); - result = fread(buffer, 1, s, xfer->dest_fp); - if (result != s) { - purple_debug_error("filetransfer", "Unable to read whole buffer.\n"); - purple_xfer_cancel_local(xfer); - g_free(buffer); - return; - } - } - - /* Write as much as we're allowed to. */ - r = purple_xfer_write(xfer, buffer, result); - - if (r == -1) { - purple_xfer_cancel_remote(xfer); - g_free(buffer); - return; - } else if (r < result) { - if (ui_ops == NULL || (ui_ops->ui_read == NULL && ui_ops->ui_write == NULL)) { - /* We have to seek back in the file now. */ - fseek(xfer->dest_fp, r - s, SEEK_CUR); - } - else { - ui_ops->data_not_sent(xfer, buffer + r, result - r); - } - } else { - /* - * We managed to write the entire buffer. This means our - * network is fast and our buffer is too small, so make it - * bigger. - */ - purple_xfer_increase_buffer_size(xfer); - } - } - - if (r > 0) { - if (purple_xfer_get_size(xfer) > 0) - xfer->bytes_remaining -= r; - - xfer->bytes_sent += r; - - if (xfer->ops.ack != NULL) - xfer->ops.ack(xfer, buffer, r); - - g_free(buffer); - - if (ui_ops != NULL && ui_ops->update_progress != NULL) - ui_ops->update_progress(xfer, - purple_xfer_get_progress(xfer)); - } - - if (purple_xfer_is_completed(xfer)) - purple_xfer_end(xfer); -} - -static void -transfer_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer = data; - - if (xfer->dest_fp == NULL) { - /* The UI is moderating its side manually */ - PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer); - if (0 == (priv->ready & PURPLE_XFER_READY_UI)) { - priv->ready |= PURPLE_XFER_READY_PRPL; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - return; - } - } - - do_transfer(xfer); -} - -static void -begin_transfer(PurpleXfer *xfer, PurpleInputCondition cond) -{ - PurpleXferType type = purple_xfer_get_type(xfer); - PurpleXferUiOps *ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops == NULL || (ui_ops->ui_read == NULL && ui_ops->ui_write == NULL)) { - xfer->dest_fp = g_fopen(purple_xfer_get_local_filename(xfer), - type == PURPLE_XFER_RECEIVE ? "wb" : "rb"); - - if (xfer->dest_fp == NULL) { - purple_xfer_show_file_error(xfer, purple_xfer_get_local_filename(xfer)); - purple_xfer_cancel_local(xfer); - return; - } - - fseek(xfer->dest_fp, xfer->bytes_sent, SEEK_SET); - } - - if (xfer->fd != -1) - xfer->watcher = purple_input_add(xfer->fd, cond, transfer_cb, xfer); - - xfer->start_time = time(NULL); - - if (xfer->ops.start != NULL) - xfer->ops.start(xfer); -} - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer = (PurpleXfer *)data; - - if (source < 0) { - purple_xfer_cancel_local(xfer); - return; - } - - xfer->fd = source; - - begin_transfer(xfer, PURPLE_INPUT_READ); -} - -void -purple_xfer_ui_ready(PurpleXfer *xfer) -{ - PurpleInputCondition cond; - PurpleXferType type; - PurpleXferPrivData *priv; - - g_return_if_fail(xfer != NULL); - - priv = g_hash_table_lookup(xfers_data, xfer); - priv->ready |= PURPLE_XFER_READY_UI; - - if (0 == (priv->ready & PURPLE_XFER_READY_PRPL)) - return; - - type = purple_xfer_get_type(xfer); - if (type == PURPLE_XFER_SEND) - cond = PURPLE_INPUT_WRITE; - else /* if (type == PURPLE_XFER_RECEIVE) */ - cond = PURPLE_INPUT_READ; - - if (xfer->watcher == 0 && xfer->fd != -1) - xfer->watcher = purple_input_add(xfer->fd, cond, transfer_cb, xfer); - - priv->ready = PURPLE_XFER_READY_NONE; - - do_transfer(xfer); -} - -void -purple_xfer_prpl_ready(PurpleXfer *xfer) -{ - PurpleXferPrivData *priv; - - g_return_if_fail(xfer != NULL); - - priv = g_hash_table_lookup(xfers_data, xfer); - priv->ready |= PURPLE_XFER_READY_PRPL; - - /* I don't think fwrite/fread are ever *not* ready */ - if (xfer->dest_fp == NULL && 0 == (priv->ready & PURPLE_XFER_READY_UI)) - return; - - priv->ready = PURPLE_XFER_READY_NONE; - - do_transfer(xfer); -} - -void -purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, - unsigned int port) -{ - PurpleInputCondition cond; - PurpleXferType type; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(purple_xfer_get_type(xfer) != PURPLE_XFER_UNKNOWN); - - type = purple_xfer_get_type(xfer); - - purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_STARTED); - - /* - * FIXME 3.0.0 -- there's too much broken code depending on fd == 0 - * meaning "don't use a real fd" - */ - if (fd == 0) - fd = -1; - - if (type == PURPLE_XFER_RECEIVE) { - cond = PURPLE_INPUT_READ; - - if (ip != NULL) { - xfer->remote_ip = g_strdup(ip); - xfer->remote_port = port; - - /* Establish a file descriptor. */ - purple_proxy_connect(NULL, xfer->account, xfer->remote_ip, - xfer->remote_port, connect_cb, xfer); - - return; - } - else { - xfer->fd = fd; - } - } - else { - cond = PURPLE_INPUT_WRITE; - - xfer->fd = fd; - } - - begin_transfer(xfer, cond); -} - -void -purple_xfer_end(PurpleXfer *xfer) -{ - g_return_if_fail(xfer != NULL); - - /* See if we are actually trying to cancel this. */ - if (!purple_xfer_is_completed(xfer)) { - purple_xfer_cancel_local(xfer); - return; - } - - xfer->end_time = time(NULL); - if (xfer->ops.end != NULL) - xfer->ops.end(xfer); - - if (xfer->watcher != 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - - if (xfer->fd != -1) - close(xfer->fd); - - if (xfer->dest_fp != NULL) { - fclose(xfer->dest_fp); - xfer->dest_fp = NULL; - } - - purple_xfer_unref(xfer); -} - -void -purple_xfer_add(PurpleXfer *xfer) -{ - PurpleXferUiOps *ui_ops; - - g_return_if_fail(xfer != NULL); - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops != NULL && ui_ops->add_xfer != NULL) - ui_ops->add_xfer(xfer); -} - -void -purple_xfer_cancel_local(PurpleXfer *xfer) -{ - PurpleXferUiOps *ui_ops; - char *msg = NULL; - - g_return_if_fail(xfer != NULL); - - purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); - xfer->end_time = time(NULL); - - if (purple_xfer_get_filename(xfer) != NULL) - { - msg = g_strdup_printf(_("You cancelled the transfer of %s"), - purple_xfer_get_filename(xfer)); - } - else - { - msg = g_strdup(_("File transfer cancelled")); - } - purple_xfer_conversation_write(xfer, msg, FALSE); - g_free(msg); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) - { - if (xfer->ops.cancel_send != NULL) - xfer->ops.cancel_send(xfer); - } - else - { - if (xfer->ops.cancel_recv != NULL) - xfer->ops.cancel_recv(xfer); - } - - if (xfer->watcher != 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - - if (xfer->fd != -1) - close(xfer->fd); - - if (xfer->dest_fp != NULL) { - fclose(xfer->dest_fp); - xfer->dest_fp = NULL; - } - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops != NULL && ui_ops->cancel_local != NULL) - ui_ops->cancel_local(xfer); - - xfer->bytes_remaining = 0; - - purple_xfer_unref(xfer); -} - -void -purple_xfer_cancel_remote(PurpleXfer *xfer) -{ - PurpleXferUiOps *ui_ops; - gchar *msg; - PurpleAccount *account; - PurpleBuddy *buddy; - - g_return_if_fail(xfer != NULL); - - purple_request_close_with_handle(xfer); - purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); - xfer->end_time = time(NULL); - - account = purple_xfer_get_account(xfer); - buddy = purple_find_buddy(account, xfer->who); - - if (purple_xfer_get_filename(xfer) != NULL) - { - msg = g_strdup_printf(_("%s cancelled the transfer of %s"), - buddy ? purple_buddy_get_alias(buddy) : xfer->who, purple_xfer_get_filename(xfer)); - } - else - { - msg = g_strdup_printf(_("%s cancelled the file transfer"), - buddy ? purple_buddy_get_alias(buddy) : xfer->who); - } - purple_xfer_conversation_write(xfer, msg, TRUE); - purple_xfer_error(purple_xfer_get_type(xfer), account, xfer->who, msg); - g_free(msg); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) - { - if (xfer->ops.cancel_send != NULL) - xfer->ops.cancel_send(xfer); - } - else - { - if (xfer->ops.cancel_recv != NULL) - xfer->ops.cancel_recv(xfer); - } - - if (xfer->watcher != 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - - if (xfer->fd != -1) - close(xfer->fd); - - if (xfer->dest_fp != NULL) { - fclose(xfer->dest_fp); - xfer->dest_fp = NULL; - } - - ui_ops = purple_xfer_get_ui_ops(xfer); - - if (ui_ops != NULL && ui_ops->cancel_remote != NULL) - ui_ops->cancel_remote(xfer); - - xfer->bytes_remaining = 0; - - purple_xfer_unref(xfer); -} - -void -purple_xfer_error(PurpleXferType type, PurpleAccount *account, const char *who, const char *msg) -{ - char *title; - - g_return_if_fail(msg != NULL); - g_return_if_fail(type != PURPLE_XFER_UNKNOWN); - - if (account) { - PurpleBuddy *buddy; - buddy = purple_find_buddy(account, who); - if (buddy) - who = purple_buddy_get_alias(buddy); - } - - if (type == PURPLE_XFER_SEND) - title = g_strdup_printf(_("File transfer to %s failed."), who); - else - title = g_strdup_printf(_("File transfer from %s failed."), who); - - purple_notify_error(NULL, NULL, title, msg); - - g_free(title); -} - -void -purple_xfer_update_progress(PurpleXfer *xfer) -{ - PurpleXferUiOps *ui_ops; - - g_return_if_fail(xfer != NULL); - - ui_ops = purple_xfer_get_ui_ops(xfer); - if (ui_ops != NULL && ui_ops->update_progress != NULL) - ui_ops->update_progress(xfer, purple_xfer_get_progress(xfer)); -} - - -/************************************************************************** - * File Transfer Subsystem API - **************************************************************************/ -void * -purple_xfers_get_handle(void) { - static int handle = 0; - - return &handle; -} - -void -purple_xfers_init(void) { - void *handle = purple_xfers_get_handle(); - - xfers_data = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, purple_xfer_priv_data_destroy); - - /* register signals */ - purple_signal_register(handle, "file-recv-accept", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-send-accept", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-recv-start", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-send-start", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-send-cancel", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-recv-cancel", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-send-complete", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-recv-complete", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); - purple_signal_register(handle, "file-recv-request", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_XFER)); -} - -void -purple_xfers_uninit(void) -{ - void *handle = purple_xfers_get_handle(); - - purple_signals_disconnect_by_handle(handle); - purple_signals_unregister_by_instance(handle); - - g_hash_table_destroy(xfers_data); - xfers_data = NULL; -} - -void -purple_xfers_set_ui_ops(PurpleXferUiOps *ops) { - xfer_ui_ops = ops; -} - -PurpleXferUiOps * -purple_xfers_get_ui_ops(void) { - return xfer_ui_ops; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ft.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,734 +0,0 @@ -/** - * @file ft.h File Transfer API - * @ingroup core - * @see @ref xfer-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_FT_H_ -#define _PURPLE_FT_H_ - -/**************************************************************************/ -/** Data Structures */ -/**************************************************************************/ -typedef struct _PurpleXfer PurpleXfer; - -#include -#include - -#include "account.h" - -/** - * Types of file transfers. - */ -typedef enum -{ - PURPLE_XFER_UNKNOWN = 0, /**< Unknown file transfer type. */ - PURPLE_XFER_SEND, /**< File sending. */ - PURPLE_XFER_RECEIVE /**< File receiving. */ - -} PurpleXferType; - -/** - * The different states of the xfer. - */ -typedef enum -{ - PURPLE_XFER_STATUS_UNKNOWN = 0, /**< Unknown, the xfer may be null. */ - PURPLE_XFER_STATUS_NOT_STARTED, /**< It hasn't started yet. */ - PURPLE_XFER_STATUS_ACCEPTED, /**< Receive accepted, but destination file not selected yet */ - PURPLE_XFER_STATUS_STARTED, /**< purple_xfer_start has been called. */ - PURPLE_XFER_STATUS_DONE, /**< The xfer completed successfully. */ - PURPLE_XFER_STATUS_CANCEL_LOCAL, /**< The xfer was canceled by us. */ - PURPLE_XFER_STATUS_CANCEL_REMOTE /**< The xfer was canceled by the other end, or we couldn't connect. */ -} PurpleXferStatusType; - -/** - * File transfer UI operations. - * - * Any UI representing a file transfer must assign a filled-out - * PurpleXferUiOps structure to the purple_xfer. - */ -typedef struct -{ - void (*new_xfer)(PurpleXfer *xfer); - void (*destroy)(PurpleXfer *xfer); - void (*add_xfer)(PurpleXfer *xfer); - void (*update_progress)(PurpleXfer *xfer, double percent); - void (*cancel_local)(PurpleXfer *xfer); - void (*cancel_remote)(PurpleXfer *xfer); - - /** - * UI op to write data received from the prpl. The UI must deal with the - * entire buffer and return size, or it is treated as an error. - * - * @param xfer The file transfer structure - * @param buffer The buffer to write - * @param size The size of the buffer - * - * @return size if the write was successful, or a value between 0 and - * size on error. - * @since 2.6.0 - */ - gssize (*ui_write)(PurpleXfer *xfer, const guchar *buffer, gssize size); - - /** - * UI op to read data to send to the prpl for a file transfer. - * - * @param xfer The file transfer structure - * @param buffer A pointer to a buffer. The UI must allocate this buffer. - * libpurple will free the data. - * @param size The maximum amount of data to put in the buffer. - * - * @returns The amount of data in the buffer, 0 if nothing is available, - * and a negative value if an error occurred and the transfer - * should be cancelled (libpurple will cancel). - * @since 2.6.0 - */ - gssize (*ui_read)(PurpleXfer *xfer, guchar **buffer, gssize size); - - /** - * Op to notify the UI that not all the data read in was written. The UI - * should re-enqueue this data and return it the next time read is called. - * - * This MUST be implemented if read and write are implemented. - * - * @param xfer The file transfer structure - * @param buffer A pointer to the beginning of the unwritten data. - * @param size The amount of unwritten data. - * - * @since 2.6.0 - */ - void (*data_not_sent)(PurpleXfer *xfer, const guchar *buffer, gsize size); - - void (*_purple_reserved1)(void); -} PurpleXferUiOps; - -/** - * A core representation of a file transfer. - */ -struct _PurpleXfer -{ - guint ref; /**< The reference count. */ - PurpleXferType type; /**< The type of transfer. */ - - PurpleAccount *account; /**< The account. */ - - char *who; /**< The person on the other end of the - transfer. */ - - char *message; /**< A message sent with the request */ - char *filename; /**< The name sent over the network. */ - char *local_filename; /**< The name on the local hard drive. */ - size_t size; /**< The size of the file. */ - - FILE *dest_fp; /**< The destination file pointer. */ - - char *remote_ip; /**< The remote IP address. */ - int local_port; /**< The local port. */ - int remote_port; /**< The remote port. */ - - int fd; /**< The socket file descriptor. */ - int watcher; /**< Watcher. */ - - size_t bytes_sent; /**< The number of bytes sent. */ - size_t bytes_remaining; /**< The number of bytes remaining. */ - time_t start_time; /**< When the transfer of data began. */ - time_t end_time; /**< When the transfer of data ended. */ - - size_t current_buffer_size; /**< This gradually increases for fast - network connections. */ - - PurpleXferStatusType status; /**< File Transfer's status. */ - - /** I/O operations, which should be set by the prpl using - * purple_xfer_set_init_fnc() and friends. Setting #init is - * mandatory; all others are optional. - */ - struct - { - void (*init)(PurpleXfer *xfer); - void (*request_denied)(PurpleXfer *xfer); - void (*start)(PurpleXfer *xfer); - void (*end)(PurpleXfer *xfer); - void (*cancel_send)(PurpleXfer *xfer); - void (*cancel_recv)(PurpleXfer *xfer); - gssize (*read)(guchar **buffer, PurpleXfer *xfer); - gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer); - void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size); - } ops; - - PurpleXferUiOps *ui_ops; /**< UI-specific operations. */ - void *ui_data; /**< UI-specific data. */ - - void *data; /**< prpl-specific data. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name File Transfer API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new file transfer handle. - * This is called by prpls. - * The handle starts with a ref count of 1, and this reference - * is owned by the core. The prpl normally does not need to - * purple_xfer_ref or unref. - * - * @param account The account sending or receiving the file. - * @param type The type of file transfer. - * @param who The name of the remote user. - * - * @return A file transfer handle. - */ -PurpleXfer *purple_xfer_new(PurpleAccount *account, - PurpleXferType type, const char *who); - -/** - * Returns all xfers - * - * @return all current xfers with refs - */ -GList *purple_xfers_get_all(void); - -/** - * Increases the reference count on a PurpleXfer. - * Please call purple_xfer_unref later. - * - * @param xfer A file transfer handle. - */ -void purple_xfer_ref(PurpleXfer *xfer); - -/** - * Decreases the reference count on a PurpleXfer. - * If the reference reaches 0, purple_xfer_destroy (an internal function) - * will destroy the xfer. It calls the ui destroy cb first. - * Since the core keeps a ref on the xfer, only an erroneous call to - * this function will destroy the xfer while still in use. - * - * @param xfer A file transfer handle. - */ -void purple_xfer_unref(PurpleXfer *xfer); - -/** - * Requests confirmation for a file transfer from the user. If receiving - * a file which is known at this point, this requests user to accept and - * save the file. If the filename is unknown (not set) this only requests user - * to accept the file transfer. In this case protocol must call this function - * again once the filename is available. - * - * @param xfer The file transfer to request confirmation on. - */ -void purple_xfer_request(PurpleXfer *xfer); - -/** - * Called if the user accepts the file transfer request. - * - * @param xfer The file transfer. - * @param filename The filename. - */ -void purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename); - -/** - * Called if the user rejects the file transfer request. - * - * @param xfer The file transfer. - */ -void purple_xfer_request_denied(PurpleXfer *xfer); - -/** - * Returns the type of file transfer. - * - * @param xfer The file transfer. - * - * @return The type of the file transfer. - */ -PurpleXferType purple_xfer_get_type(const PurpleXfer *xfer); - -/** - * Returns the account the file transfer is using. - * - * @param xfer The file transfer. - * - * @return The account. - */ -PurpleAccount *purple_xfer_get_account(const PurpleXfer *xfer); - -/** - * Returns the name of the remote user. - * - * @param xfer The file transfer. - * - * @return The name of the remote user. - * - * @since 2.1.0 - */ -const char *purple_xfer_get_remote_user(const PurpleXfer *xfer); - -/** - * Returns the status of the xfer. - * - * @param xfer The file transfer. - * - * @return The status. - */ -PurpleXferStatusType purple_xfer_get_status(const PurpleXfer *xfer); - -/** - * Returns true if the file transfer was canceled. - * - * @param xfer The file transfer. - * - * @return Whether or not the transfer was canceled. - */ -gboolean purple_xfer_is_canceled(const PurpleXfer *xfer); - -/** - * Returns the completed state for a file transfer. - * - * @param xfer The file transfer. - * - * @return The completed state. - */ -gboolean purple_xfer_is_completed(const PurpleXfer *xfer); - -/** - * Returns the name of the file being sent or received. - * - * @param xfer The file transfer. - * - * @return The filename. - */ -const char *purple_xfer_get_filename(const PurpleXfer *xfer); - -/** - * Returns the file's destination filename, - * - * @param xfer The file transfer. - * - * @return The destination filename. - */ -const char *purple_xfer_get_local_filename(const PurpleXfer *xfer); - -/** - * Returns the number of bytes sent (or received) so far. - * - * @param xfer The file transfer. - * - * @return The number of bytes sent. - */ -size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer); - -/** - * Returns the number of bytes remaining to send or receive. - * - * @param xfer The file transfer. - * - * @return The number of bytes remaining. - */ -size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer); - -/** - * Returns the size of the file being sent or received. - * - * @param xfer The file transfer. - * - * @return The total size of the file. - */ -size_t purple_xfer_get_size(const PurpleXfer *xfer); - -/** - * Returns the current percentage of progress of the transfer. - * - * This is a number between 0 (0%) and 1 (100%). - * - * @param xfer The file transfer. - * - * @return The percentage complete. - */ -double purple_xfer_get_progress(const PurpleXfer *xfer); - -/** - * Returns the local port number in the file transfer. - * - * @param xfer The file transfer. - * - * @return The port number on this end. - */ -unsigned int purple_xfer_get_local_port(const PurpleXfer *xfer); - -/** - * Returns the remote IP address in the file transfer. - * - * @param xfer The file transfer. - * - * @return The IP address on the other end. - */ -const char *purple_xfer_get_remote_ip(const PurpleXfer *xfer); - -/** - * Returns the remote port number in the file transfer. - * - * @param xfer The file transfer. - * - * @return The port number on the other end. - */ -unsigned int purple_xfer_get_remote_port(const PurpleXfer *xfer); - -/** - * Returns the time the transfer of a file started. - * - * @param xfer The file transfer. - * - * @return The time when the transfer started. - * @since 2.4.0 - */ -time_t purple_xfer_get_start_time(const PurpleXfer *xfer); - -/** - * Returns the time the transfer of a file ended. - * - * @param xfer The file transfer. - * - * @return The time when the transfer ended. - * @since 2.4.0 - */ -time_t purple_xfer_get_end_time(const PurpleXfer *xfer); - -/** - * Sets the completed state for the file transfer. - * - * @param xfer The file transfer. - * @param completed The completed state. - */ -void purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed); - -/** - * Sets the filename for the file transfer. - * - * @param xfer The file transfer. - * @param message The message. - */ -void purple_xfer_set_message(PurpleXfer *xfer, const char *message); - -/** - * Sets the filename for the file transfer. - * - * @param xfer The file transfer. - * @param filename The filename. - */ -void purple_xfer_set_filename(PurpleXfer *xfer, const char *filename); - -/** - * Sets the local filename for the file transfer. - * - * @param xfer The file transfer. - * @param filename The filename - */ -void purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename); - -/** - * Sets the size of the file in a file transfer. - * - * @param xfer The file transfer. - * @param size The size of the file. - */ -void purple_xfer_set_size(PurpleXfer *xfer, size_t size); - -/** - * Sets the current working position in the active file transfer. This - * can be used to jump backward in the file if the protocol detects - * that some bit of data needs to be resent or has been sent twice. - * - * It's used for pausing and resuming an oscar file transfer. - * - * @param xfer The file transfer. - * @param bytes_sent The new current position in the file. If we're - * sending a file then this is the byte that we will - * send. If we're receiving a file, this is the - * next byte that we expect to receive. - */ -void purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent); - -/** - * Returns the UI operations structure for a file transfer. - * - * @param xfer The file transfer. - * - * @return The UI operations structure. - */ -PurpleXferUiOps *purple_xfer_get_ui_ops(const PurpleXfer *xfer); - -/** - * Sets the read function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The read function. - */ -void purple_xfer_set_read_fnc(PurpleXfer *xfer, - gssize (*fnc)(guchar **, PurpleXfer *)); - -/** - * Sets the write function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The write function. - */ -void purple_xfer_set_write_fnc(PurpleXfer *xfer, - gssize (*fnc)(const guchar *, size_t, PurpleXfer *)); - -/** - * Sets the acknowledge function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The acknowledge function. - */ -void purple_xfer_set_ack_fnc(PurpleXfer *xfer, - void (*fnc)(PurpleXfer *, const guchar *, size_t)); - -/** - * Sets the function to be called if the request is denied. - * - * @param xfer The file transfer. - * @param fnc The request denied prpl callback. - */ -void purple_xfer_set_request_denied_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)); - -/** - * Sets the transfer initialization function for the file transfer. - * - * This function is required, and must call purple_xfer_start() with - * the necessary parameters. This will be called if the file transfer - * is accepted by the user. - * - * @param xfer The file transfer. - * @param fnc The transfer initialization function. - */ -void purple_xfer_set_init_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)); - -/** - * Sets the start transfer function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The start transfer function. - */ -void purple_xfer_set_start_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)); - -/** - * Sets the end transfer function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The end transfer function. - */ -void purple_xfer_set_end_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)); - -/** - * Sets the cancel send function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The cancel send function. - */ -void purple_xfer_set_cancel_send_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)); - -/** - * Sets the cancel receive function for the file transfer. - * - * @param xfer The file transfer. - * @param fnc The cancel receive function. - */ -void purple_xfer_set_cancel_recv_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *)); - -/** - * Reads in data from a file transfer stream. - * - * @param xfer The file transfer. - * @param buffer The buffer that will be created to contain the data. - * - * @return The number of bytes read, or -1. - */ -gssize purple_xfer_read(PurpleXfer *xfer, guchar **buffer); - -/** - * Writes data to a file transfer stream. - * - * @param xfer The file transfer. - * @param buffer The buffer to read the data from. - * @param size The number of bytes to write. - * - * @return The number of bytes written, or -1. - */ -gssize purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size); - -/** - * Starts a file transfer. - * - * Either @a fd must be specified or @a ip and @a port on a - * file receive transfer. On send, @a fd must be specified, and - * @a ip and @a port are ignored. - * - * Prior to libpurple 2.6.0, passing '0' to @a fd was special-cased to - * allow the protocol plugin to facilitate the file transfer itself. As of - * 2.6.0, this is supported (for backward compatibility), but will be - * removed in libpurple 3.0.0. If a prpl detects that the running libpurple - * is running 2.6.0 or higher, it should use the invalid fd '-1'. - * - * @param xfer The file transfer. - * @param fd The file descriptor for the socket. - * @param ip The IP address to connect to. - * @param port The port to connect to. - */ -void purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip, - unsigned int port); - -/** - * Ends a file transfer. - * - * @param xfer The file transfer. - */ -void purple_xfer_end(PurpleXfer *xfer); - -/** - * Adds a new file transfer to the list of file transfers. Call this only - * if you are not using purple_xfer_start. - * - * @param xfer The file transfer. - */ -void purple_xfer_add(PurpleXfer *xfer); - -/** - * Cancels a file transfer on the local end. - * - * @param xfer The file transfer. - */ -void purple_xfer_cancel_local(PurpleXfer *xfer); - -/** - * Cancels a file transfer from the remote end. - * - * @param xfer The file transfer. - */ -void purple_xfer_cancel_remote(PurpleXfer *xfer); - -/** - * Displays a file transfer-related error message. - * - * This is a wrapper around purple_notify_error(), which automatically - * specifies a title ("File transfer to user failed" or - * "File Transfer from user failed"). - * - * @param type The type of file transfer. - * @param account The account sending or receiving the file. - * @param who The user on the other end of the transfer. - * @param msg The message to display. - */ -void purple_xfer_error(PurpleXferType type, PurpleAccount *account, const char *who, const char *msg); - -/** - * Updates file transfer progress. - * - * @param xfer The file transfer. - */ -void purple_xfer_update_progress(PurpleXfer *xfer); - -/** - * Displays a file transfer-related message in the conversation window - * - * This is a wrapper around purple_conversation_write - * - * @param xfer The file transfer to which this message relates. - * @param message The message to display. - * @param is_error Is this an error message?. - */ -void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error); - -/** - * Allows the UI to signal it's ready to send/receive data (depending on - * the direction of the file transfer. Used when the UI is providing - * read/write/data_not_sent UI ops. - * - * @param xfer The file transfer which is ready. - * - * @since 2.6.0 - */ -void purple_xfer_ui_ready(PurpleXfer *xfer); - -/** - * Allows the prpl to signal it's ready to send/receive data (depending on - * the direction of the file transfer. Used when the prpl provides read/write - * ops and cannot/does not provide a raw fd to the core. - * - * @param xfer The file transfer which is ready. - * - * @since 2.6.0 - */ -void purple_xfer_prpl_ready(PurpleXfer *xfer); - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the handle to the file transfer subsystem - * - * @return The handle - */ -void *purple_xfers_get_handle(void); - -/** - * Initializes the file transfer subsystem - */ -void purple_xfers_init(void); - -/** - * Uninitializes the file transfer subsystem - */ -void purple_xfers_uninit(void); - -/** - * Sets the UI operations structure to be used in all purple file transfers. - * - * @param ops The UI operations structure. - */ -void purple_xfers_set_ui_ops(PurpleXferUiOps *ops); - -/** - * Returns the UI operations structure to be used in all purple file transfers. - * - * @return The UI operations structure. - */ -PurpleXferUiOps *purple_xfers_get_ui_ops(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_FT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gaim-compat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gaim-compat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gaim-compat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gaim-compat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,2317 +0,0 @@ -/** - * @file gaim-compat.h Gaim Compat macros - * @ingroup core - */ - -/* pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _GAIM_COMPAT_H_ -#define _GAIM_COMPAT_H_ - -#include - -/* from account.h */ -#define GaimAccountUiOps PurpleAccountUiOps -#define GaimAccount PurpleAccount - -#define GaimFilterAccountFunc PurpleFilterAccountFunc -#define GaimAccountRequestAuthorizationCb PurpleAccountRequestAuthorizationCb - -#define gaim_account_new purple_account_new -#define gaim_account_destroy purple_account_destroy -#define gaim_account_connect purple_account_connect -#define gaim_account_register purple_account_register -#define gaim_account_disconnect purple_account_disconnect -#define gaim_account_notify_added purple_account_notify_added -#define gaim_account_request_add purple_account_request_add -#define gaim_account_request_close purple_account_request_close - -#define gaim_account_request_authorization purple_account_request_authorization -#define gaim_account_request_change_password purple_account_request_change_password -#define gaim_account_request_change_user_info purple_account_request_change_user_info - -#define gaim_account_set_username purple_account_set_username -#define gaim_account_set_password purple_account_set_password -#define gaim_account_set_alias purple_account_set_alias -#define gaim_account_set_user_info purple_account_set_user_info -#define gaim_account_set_buddy_icon_path purple_account_set_buddy_icon_path -#define gaim_account_set_protocol_id purple_account_set_protocol_id -#define gaim_account_set_connection purple_account_set_connection -#define gaim_account_set_remember_password purple_account_set_remember_password -#define gaim_account_set_check_mail purple_account_set_check_mail -#define gaim_account_set_enabled purple_account_set_enabled -#define gaim_account_set_proxy_info purple_account_set_proxy_info -#define gaim_account_set_status_types purple_account_set_status_types -#define gaim_account_set_status purple_account_set_status -#define gaim_account_set_status_list purple_account_set_status_list - -#define gaim_account_clear_settings purple_account_clear_settings - -#define gaim_account_set_int purple_account_set_int -#define gaim_account_set_string purple_account_set_string -#define gaim_account_set_bool purple_account_set_bool - -#define gaim_account_set_ui_int purple_account_set_ui_int -#define gaim_account_set_ui_string purple_account_set_ui_string -#define gaim_account_set_ui_bool purple_account_set_ui_bool - -#define gaim_account_is_connected purple_account_is_connected -#define gaim_account_is_connecting purple_account_is_connecting -#define gaim_account_is_disconnected purple_account_is_disconnected - -#define gaim_account_get_username purple_account_get_username -#define gaim_account_get_password purple_account_get_password -#define gaim_account_get_alias purple_account_get_alias -#define gaim_account_get_user_info purple_account_get_user_info -#define gaim_account_get_buddy_icon_path purple_account_get_buddy_icon_path -#define gaim_account_get_protocol_id purple_account_get_protocol_id -#define gaim_account_get_protocol_name purple_account_get_protocol_name -#define gaim_account_get_connection purple_account_get_connection -#define gaim_account_get_remember_password purple_account_get_remember_password -#define gaim_account_get_check_mail purple_account_get_check_mail -#define gaim_account_get_enabled purple_account_get_enabled -#define gaim_account_get_proxy_info purple_account_get_proxy_info -#define gaim_account_get_active_status purple_account_get_active_status -#define gaim_account_get_status purple_account_get_status -#define gaim_account_get_status_type purple_account_get_status_type -#define gaim_account_get_status_type_with_primitive \ - purple_account_get_status_type_with_primitive - -#define gaim_account_get_presence purple_account_get_presence -#define gaim_account_is_status_active purple_account_is_status_active -#define gaim_account_get_status_types purple_account_get_status_types - -#define gaim_account_get_int purple_account_get_int -#define gaim_account_get_string purple_account_get_string -#define gaim_account_get_bool purple_account_get_bool - -#define gaim_account_get_ui_int purple_account_get_ui_int -#define gaim_account_get_ui_string purple_account_get_ui_string -#define gaim_account_get_ui_bool purple_account_get_ui_bool - - -#define gaim_account_get_log purple_account_get_log -#define gaim_account_destroy_log purple_account_destroy_log - -#define gaim_account_add_buddy purple_account_add_buddy -#define gaim_account_add_buddies purple_account_add_buddies -#define gaim_account_remove_buddy purple_account_remove_buddy -#define gaim_account_remove_buddies purple_account_remove_buddies - -#define gaim_account_remove_group purple_account_remove_group - -#define gaim_account_change_password purple_account_change_password - -#define gaim_account_supports_offline_message purple_account_supports_offline_message - -#define gaim_accounts_add purple_accounts_add -#define gaim_accounts_remove purple_accounts_remove -#define gaim_accounts_delete purple_accounts_delete -#define gaim_accounts_reorder purple_accounts_reorder - -#define gaim_accounts_get_all purple_accounts_get_all -#define gaim_accounts_get_all_active purple_accounts_get_all_active - -#define gaim_accounts_find purple_accounts_find - -#define gaim_accounts_restore_current_statuses purple_accounts_restore_current_statuses - -#define gaim_accounts_set_ui_ops purple_accounts_set_ui_ops -#define gaim_accounts_get_ui_ops purple_accounts_get_ui_ops - -#define gaim_accounts_get_handle purple_accounts_get_handle - -#define gaim_accounts_init purple_accounts_init -#define gaim_accounts_uninit purple_accounts_uninit - -/* from accountopt.h */ - -#define GaimAccountOption PurpleAccountOption -#define GaimAccountUserSplit PurpleAccountUserSplit - -#define gaim_account_option_new purple_account_option_new -#define gaim_account_option_bool_new purple_account_option_bool_new -#define gaim_account_option_int_new purple_account_option_int_new -#define gaim_account_option_string_new purple_account_option_string_new -#define gaim_account_option_list_new purple_account_option_list_new - -#define gaim_account_option_destroy purple_account_option_destroy - -#define gaim_account_option_set_default_bool purple_account_option_set_default_bool -#define gaim_account_option_set_default_int purple_account_option_set_default_int -#define gaim_account_option_set_default_string purple_account_option_set_default_string - -#define gaim_account_option_set_masked purple_account_option_set_masked - -#define gaim_account_option_set_list purple_account_option_set_list - -#define gaim_account_option_add_list_item purple_account_option_add_list_item - -#define gaim_account_option_get_type purple_account_option_get_type -#define gaim_account_option_get_text purple_account_option_get_text -#define gaim_account_option_get_setting purple_account_option_get_setting - -#define gaim_account_option_get_default_bool purple_account_option_get_default_bool -#define gaim_account_option_get_default_int purple_account_option_get_default_int -#define gaim_account_option_get_default_string purple_account_option_get_default_string -#define gaim_account_option_get_default_list_value purple_account_option_get_default_list_value - -#define gaim_account_option_get_masked purple_account_option_get_masked -#define gaim_account_option_get_list purple_account_option_get_list - -#define gaim_account_user_split_new purple_account_user_split_new -#define gaim_account_user_split_destroy purple_account_user_split_destroy - -#define gaim_account_user_split_get_text purple_account_user_split_get_text -#define gaim_account_user_split_get_default_value purple_account_user_split_get_default_value -#define gaim_account_user_split_get_separator purple_account_user_split_get_separator - -/* from blist.h */ - -#define GaimBuddyList PurpleBuddyList -#define GaimBlistUiOps PurpleBlistUiOps -#define GaimBlistNode PurpleBlistNode - -#define GaimChat PurpleChat -#define GaimGroup PurpleGroup -#define GaimContact PurpleContact -#define GaimBuddy PurpleBuddy - -#define GAIM_BLIST_GROUP_NODE PURPLE_BLIST_GROUP_NODE -#define GAIM_BLIST_CONTACT_NODE PURPLE_BLIST_CONTACT_NODE -#define GAIM_BLIST_BUDDY_NODE PURPLE_BLIST_BUDDY_NODE -#define GAIM_BLIST_CHAT_NODE PURPLE_BLIST_CHAT_NODE -#define GAIM_BLIST_OTHER_NODE PURPLE_BLIST_OTHER_NODE -#define GaimBlistNodeType PurpleBlistNodeType - -#define GAIM_BLIST_NODE_IS_CHAT PURPLE_BLIST_NODE_IS_CHAT -#define GAIM_BLIST_NODE_IS_BUDDY PURPLE_BLIST_NODE_IS_BUDDY -#define GAIM_BLIST_NODE_IS_CONTACT PURPLE_BLIST_NODE_IS_CONTACT -#define GAIM_BLIST_NODE_IS_GROUP PURPLE_BLIST_NODE_IS_GROUP - -#define GAIM_BUDDY_IS_ONLINE PURPLE_BUDDY_IS_ONLINE - -#define GAIM_BLIST_NODE_FLAG_NO_SAVE PURPLE_BLIST_NODE_FLAG_NO_SAVE -#define GaimBlistNodeFlags PurpleBlistNodeFlags - -#define GAIM_BLIST_NODE_HAS_FLAG PURPLE_BLIST_NODE_HAS_FLAG -#define GAIM_BLIST_NODE_SHOULD_SAVE PURPLE_BLIST_NODE_SHOULD_SAVE - -#define GAIM_BLIST_NODE_NAME PURPLE_BLIST_NODE_NAME - - -#define gaim_blist_new purple_blist_new -#define gaim_set_blist purple_set_blist -#define gaim_get_blist purple_get_blist - -#define gaim_blist_get_root purple_blist_get_root -#define gaim_blist_node_next purple_blist_node_next - -#define gaim_blist_show purple_blist_show - -#define gaim_blist_destroy purple_blist_destroy - -#define gaim_blist_set_visible purple_blist_set_visible - -#define gaim_blist_update_buddy_status purple_blist_update_buddy_status -#define gaim_blist_update_buddy_icon purple_blist_update_buddy_icon - - -#define gaim_blist_alias_contact purple_blist_alias_contact -#define gaim_blist_alias_buddy purple_blist_alias_buddy -#define gaim_blist_server_alias_buddy purple_blist_server_alias_buddy -#define gaim_blist_alias_chat purple_blist_alias_chat - -#define gaim_blist_rename_buddy purple_blist_rename_buddy -#define gaim_blist_rename_group purple_blist_rename_group - -#define gaim_chat_new purple_chat_new -#define gaim_blist_add_chat purple_blist_add_chat - -#define gaim_buddy_new purple_buddy_new -#define gaim_buddy_set_icon purple_buddy_set_icon -#define gaim_buddy_get_account purple_buddy_get_account -#define gaim_buddy_get_name purple_buddy_get_name -#define gaim_buddy_get_icon purple_buddy_get_icon -#define gaim_buddy_get_contact purple_buddy_get_contact -#define gaim_buddy_get_presence purple_buddy_get_presence - -#define gaim_blist_add_buddy purple_blist_add_buddy - -#define gaim_group_new purple_group_new - -#define gaim_blist_add_group purple_blist_add_group - -#define gaim_contact_new purple_contact_new - -#define gaim_blist_add_contact purple_blist_add_contact -#define gaim_blist_merge_contact purple_blist_merge_contact - -#define gaim_contact_get_priority_buddy purple_contact_get_priority_buddy -#define gaim_contact_set_alias purple_contact_set_alias -#define gaim_contact_get_alias purple_contact_get_alias -#define gaim_contact_on_account purple_contact_on_account - -#define gaim_contact_invalidate_priority_buddy purple_contact_invalidate_priority_buddy - -#define gaim_blist_remove_buddy purple_blist_remove_buddy -#define gaim_blist_remove_contact purple_blist_remove_contact -#define gaim_blist_remove_chat purple_blist_remove_chat -#define gaim_blist_remove_group purple_blist_remove_group - -#define gaim_buddy_get_alias_only purple_buddy_get_alias_only -#define gaim_buddy_get_server_alias purple_buddy_get_server_alias -#define gaim_buddy_get_contact_alias purple_buddy_get_contact_alias -#define gaim_buddy_get_local_alias purple_buddy_get_local_alias -#define gaim_buddy_get_alias purple_buddy_get_alias - -#define gaim_chat_get_name purple_chat_get_name - -#define gaim_find_buddy purple_find_buddy -#define gaim_find_buddy_in_group purple_find_buddy_in_group -#define gaim_find_buddies purple_find_buddies - -#define gaim_find_group purple_find_group - -#define gaim_blist_find_chat purple_blist_find_chat - -#define gaim_chat_get_group purple_chat_get_group -#define gaim_buddy_get_group purple_buddy_get_group - -#define gaim_group_get_accounts purple_group_get_accounts -#define gaim_group_on_account purple_group_on_account - -#define gaim_blist_add_account purple_blist_add_account -#define gaim_blist_remove_account purple_blist_remove_account - -#define gaim_blist_get_group_size purple_blist_get_group_size -#define gaim_blist_get_group_online_count purple_blist_get_group_online_count - -#define gaim_blist_load purple_blist_load -#define gaim_blist_schedule_save purple_blist_schedule_save - -#define gaim_blist_request_add_buddy purple_blist_request_add_buddy -#define gaim_blist_request_add_chat purple_blist_request_add_chat -#define gaim_blist_request_add_group purple_blist_request_add_group - -#define gaim_blist_node_set_bool purple_blist_node_set_bool -#define gaim_blist_node_get_bool purple_blist_node_get_bool -#define gaim_blist_node_set_int purple_blist_node_set_int -#define gaim_blist_node_get_int purple_blist_node_get_int -#define gaim_blist_node_set_string purple_blist_node_set_string -#define gaim_blist_node_get_string purple_blist_node_get_string - -#define gaim_blist_node_remove_setting purple_blist_node_remove_setting - -#define gaim_blist_node_set_flags purple_blist_node_set_flags -#define gaim_blist_node_get_flags purple_blist_node_get_flags - -#define gaim_blist_node_get_extended_menu purple_blist_node_get_extended_menu - -#define gaim_blist_set_ui_ops purple_blist_set_ui_ops -#define gaim_blist_get_ui_ops purple_blist_get_ui_ops - -#define gaim_blist_get_handle purple_blist_get_handle - -#define gaim_blist_init purple_blist_init -#define gaim_blist_uninit purple_blist_uninit - - -#define GaimBuddyIcon PurpleBuddyIcon - -#define gaim_buddy_icon_new(account, username, icon_data, icon_len)\ - purple_buddy_icon_new(account, username, g_memdup(icon_data, icon_len), icon_len) -#define gaim_buddy_icon_ref purple_buddy_icon_ref -#define gaim_buddy_icon_unref purple_buddy_icon_unref -#define gaim_buddy_icon_update purple_buddy_icon_update - -#define gaim_buddy_icon_set_data(icon, data, len) \ - purple_buddy_icon_set_data(icon, g_memdup(data, len), len, NULL); - -#define gaim_buddy_icon_get_account purple_buddy_icon_get_account -#define gaim_buddy_icon_get_username purple_buddy_icon_get_username -#define gaim_buddy_icon_get_data purple_buddy_icon_get_data -#define gaim_buddy_icon_get_type purple_buddy_icon_get_extension - -#define gaim_buddy_icons_set_for_user(icon, data, len) \ - purple_buddy_icons_set_for_user(icon, g_memdup(data, len), len, NULL) -#define gaim_buddy_icons_set_caching purple_buddy_icons_set_caching -#define gaim_buddy_icons_is_caching purple_buddy_icons_is_caching -#define gaim_buddy_icons_set_cache_dir purple_buddy_icons_set_cache_dir -#define gaim_buddy_icons_get_cache_dir purple_buddy_icons_get_cache_dir -#define gaim_buddy_icons_get_handle purple_buddy_icons_get_handle - -#define gaim_buddy_icons_init purple_buddy_icons_init -#define gaim_buddy_icons_uninit purple_buddy_icons_uninit - -#define gaim_buddy_icon_get_scale_size purple_buddy_icon_get_scale_size - -/* from cipher.h */ - -#define GAIM_CIPHER PURPLE_CIPHER -#define GAIM_CIPHER_OPS PURPLE_CIPHER_OPS -#define GAIM_CIPHER_CONTEXT PURPLE_CIPHER_CONTEXT - -#define GaimCipher PurpleCipher -#define GaimCipherOps PurpleCipherOps -#define GaimCipherContext PurpleCipherContext - -#define GAIM_CIPHER_CAPS_SET_OPT PURPLE_CIPHER_CAPS_SET_OPT -#define GAIM_CIPHER_CAPS_GET_OPT PURPLE_CIPHER_CAPS_GET_OPT -#define GAIM_CIPHER_CAPS_INIT PURPLE_CIPHER_CAPS_INIT -#define GAIM_CIPHER_CAPS_RESET PURPLE_CIPHER_CAPS_RESET -#define GAIM_CIPHER_CAPS_UNINIT PURPLE_CIPHER_CAPS_UNINIT -#define GAIM_CIPHER_CAPS_SET_IV PURPLE_CIPHER_CAPS_SET_IV -#define GAIM_CIPHER_CAPS_APPEND PURPLE_CIPHER_CAPS_APPEND -#define GAIM_CIPHER_CAPS_DIGEST PURPLE_CIPHER_CAPS_DIGEST -#define GAIM_CIPHER_CAPS_ENCRYPT PURPLE_CIPHER_CAPS_ENCRYPT -#define GAIM_CIPHER_CAPS_DECRYPT PURPLE_CIPHER_CAPS_DECRYPT -#define GAIM_CIPHER_CAPS_SET_SALT PURPLE_CIPHER_CAPS_SET_SALT -#define GAIM_CIPHER_CAPS_GET_SALT_SIZE PURPLE_CIPHER_CAPS_GET_SALT_SIZE -#define GAIM_CIPHER_CAPS_SET_KEY PURPLE_CIPHER_CAPS_SET_KEY -#define GAIM_CIPHER_CAPS_GET_KEY_SIZE PURPLE_CIPHER_CAPS_GET_KEY_SIZE -#define GAIM_CIPHER_CAPS_UNKNOWN PURPLE_CIPHER_CAPS_UNKNOWN - -#define gaim_cipher_get_name purple_cipher_get_name -#define gaim_cipher_get_capabilities purple_cipher_get_capabilities -#define gaim_cipher_digest_region purple_cipher_digest_region - -#define gaim_ciphers_find_cipher purple_ciphers_find_cipher -#define gaim_ciphers_register_cipher purple_ciphers_register_cipher -#define gaim_ciphers_unregister_cipher purple_ciphers_unregister_cipher -#define gaim_ciphers_get_ciphers purple_ciphers_get_ciphers - -#define gaim_ciphers_get_handle purple_ciphers_get_handle -#define gaim_ciphers_init purple_ciphers_init -#define gaim_ciphers_uninit purple_ciphers_uninit - -#define gaim_cipher_context_set_option purple_cipher_context_set_option -#define gaim_cipher_context_get_option purple_cipher_context_get_option - -#define gaim_cipher_context_new purple_cipher_context_new -#define gaim_cipher_context_new_by_name purple_cipher_context_new_by_name -#define gaim_cipher_context_reset purple_cipher_context_reset -#define gaim_cipher_context_destroy purple_cipher_context_destroy -#define gaim_cipher_context_set_iv purple_cipher_context_set_iv -#define gaim_cipher_context_append purple_cipher_context_append -#define gaim_cipher_context_digest purple_cipher_context_digest -#define gaim_cipher_context_digest_to_str purple_cipher_context_digest_to_str -#define gaim_cipher_context_encrypt purple_cipher_context_encrypt -#define gaim_cipher_context_decrypt purple_cipher_context_decrypt -#define gaim_cipher_context_set_salt purple_cipher_context_set_salt -#define gaim_cipher_context_get_salt_size purple_cipher_context_get_salt_size -#define gaim_cipher_context_set_key purple_cipher_context_set_key -#define gaim_cipher_context_get_key_size purple_cipher_context_get_key_size -#define gaim_cipher_context_set_data purple_cipher_context_set_data -#define gaim_cipher_context_get_data purple_cipher_context_get_data - -#define gaim_cipher_http_digest_calculate_session_key \ - purple_cipher_http_digest_calculate_session_key - -#define gaim_cipher_http_digest_calculate_response \ - purple_cipher_http_digest_calculate_response - -/* from circbuffer.h */ - -#define GaimCircBuffer PurpleCircBuffer - -#define gaim_circ_buffer_new purple_circ_buffer_new -#define gaim_circ_buffer_destroy purple_circ_buffer_destroy -#define gaim_circ_buffer_append purple_circ_buffer_append -#define gaim_circ_buffer_get_max_read purple_circ_buffer_get_max_read -#define gaim_circ_buffer_mark_read purple_circ_buffer_mark_read - -/* from cmds.h */ - -#define GaimCmdPriority PurpleCmdPriority -#define GaimCmdFlag PurpleCmdFlag -#define GaimCmdStatus PurpleCmdStatus -#define GaimCmdRet PurpleCmdRet - -#define GAIM_CMD_STATUS_OK PURPLE_CMD_STATUS_OK -#define GAIM_CMD_STATUS_FAILED PURPLE_CMD_STATUS_FAILED -#define GAIM_CMD_STATUS_NOT_FOUND PURPLE_CMD_STATUS_NOT_FOUND -#define GAIM_CMD_STATUS_WRONG_ARGS PURPLE_CMD_STATUS_WRONG_ARGS -#define GAIM_CMD_STATUS_WRONG_PRPL PURPLE_CMD_STATUS_WRONG_PRPL -#define GAIM_CMD_STATUS_WRONG_TYPE PURPLE_CMD_STATUS_WRONG_TYPE - -#define GAIM_CMD_FUNC PURPLE_CMD_FUNC - -#define GAIM_CMD_RET_OK PURPLE_CMD_RET_OK -#define GAIM_CMD_RET_FAILED PURPLE_CMD_RET_FAILED -#define GAIM_CMD_RET_CONTINUE PURPLE_CMD_RET_CONTINUE - -#define GAIM_CMD_P_VERY_LOW PURPLE_CMD_P_VERY_LOW -#define GAIM_CMD_P_LOW PURPLE_CMD_P_LOW -#define GAIM_CMD_P_DEFAULT PURPLE_CMD_P_DEFAULT -#define GAIM_CMD_P_PRPL PURPLE_CMD_P_PRPL -#define GAIM_CMD_P_PLUGIN PURPLE_CMD_P_PLUGIN -#define GAIM_CMD_P_ALIAS PURPLE_CMD_P_ALIAS -#define GAIM_CMD_P_HIGH PURPLE_CMD_P_HIGH -#define GAIM_CMD_P_VERY_HIGH PURPLE_CMD_P_VERY_HIGH - -#define GAIM_CMD_FLAG_IM PURPLE_CMD_FLAG_IM -#define GAIM_CMD_FLAG_CHAT PURPLE_CMD_FLAG_CHAT -#define GAIM_CMD_FLAG_PRPL_ONLY PURPLE_CMD_FLAG_PRPL_ONLY -#define GAIM_CMD_FLAG_ALLOW_WRONG_ARGS PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS - - -#define GaimCmdFunc PurpleCmdFunc - -#define GaimCmdId PurpleCmdId - -#define gaim_cmd_register purple_cmd_register -#define gaim_cmd_unregister purple_cmd_unregister -#define gaim_cmd_do_command purple_cmd_do_command -#define gaim_cmd_list purple_cmd_list -#define gaim_cmd_help purple_cmd_help - -/* from connection.h */ - -#define GaimConnection PurpleConnection - -#define GAIM_CONNECTION_HTML PURPLE_CONNECTION_HTML -#define GAIM_CONNECTION_NO_BGCOLOR PURPLE_CONNECTION_NO_BGCOLOR -#define GAIM_CONNECTION_AUTO_RESP PURPLE_CONNECTION_AUTO_RESP -#define GAIM_CONNECTION_FORMATTING_WBFO PURPLE_CONNECTION_FORMATTING_WBFO -#define GAIM_CONNECTION_NO_NEWLINES PURPLE_CONNECTION_NO_NEWLINES -#define GAIM_CONNECTION_NO_FONTSIZE PURPLE_CONNECTION_NO_FONTSIZE -#define GAIM_CONNECTION_NO_URLDESC PURPLE_CONNECTION_NO_URLDESC -#define GAIM_CONNECTION_NO_IMAGES PURPLE_CONNECTION_NO_IMAGES - -#define GaimConnectionFlags PurpleConnectionFlags - -#define GAIM_DISCONNECTED PURPLE_DISCONNECTED -#define GAIM_CONNECTED PURPLE_CONNECTED -#define GAIM_CONNECTING PURPLE_CONNECTING - -#define GaimConnectionState PurpleConnectionState - -#define GaimConnectionUiOps PurpleConnectionUiOps - -#define gaim_connection_new purple_connection_new -#define gaim_connection_destroy purple_connection_destroy - -#define gaim_connection_set_state purple_connection_set_state -#define gaim_connection_set_account purple_connection_set_account -#define gaim_connection_set_display_name purple_connection_set_display_name -#define gaim_connection_get_state purple_connection_get_state - -#define GAIM_CONNECTION_IS_CONNECTED PURPLE_CONNECTION_IS_CONNECTED - -#define gaim_connection_get_account purple_connection_get_account -#define gaim_connection_get_password purple_connection_get_password -#define gaim_connection_get_display_name purple_connection_get_display_name - -#define gaim_connection_update_progress purple_connection_update_progress - -#define gaim_connection_notice purple_connection_notice -#define gaim_connection_error purple_connection_error - -#define gaim_connections_disconnect_all purple_connections_disconnect_all - -#define gaim_connections_get_all purple_connections_get_all -#define gaim_connections_get_connecting purple_connections_get_connecting - -#define GAIM_CONNECTION_IS_VALID PURPLE_CONNECTION_IS_VALID - -#define gaim_connections_set_ui_ops purple_connections_set_ui_ops -#define gaim_connections_get_ui_ops purple_connections_get_ui_ops - -#define gaim_connections_init purple_connections_init -#define gaim_connections_uninit purple_connections_uninit -#define gaim_connections_get_handle purple_connections_get_handle - - -/* from conversation.h */ - -#define GaimConversationUiOps PurpleConversationUiOps -#define GaimConversation PurpleConversation -#define GaimConvIm PurpleConvIm -#define GaimConvChat PurpleConvChat -#define GaimConvChatBuddy PurpleConvChatBuddy - -#define GAIM_CONV_TYPE_UNKNOWN PURPLE_CONV_TYPE_UNKNOWN -#define GAIM_CONV_TYPE_IM PURPLE_CONV_TYPE_IM -#define GAIM_CONV_TYPE_CHAT PURPLE_CONV_TYPE_CHAT -#define GAIM_CONV_TYPE_MISC PURPLE_CONV_TYPE_MISC -#define GAIM_CONV_TYPE_ANY PURPLE_CONV_TYPE_ANY - -#define GaimConversationType PurpleConversationType - -#define GAIM_CONV_UPDATE_ADD PURPLE_CONV_UPDATE_ADD -#define GAIM_CONV_UPDATE_REMOVE PURPLE_CONV_UPDATE_REMOVE -#define GAIM_CONV_UPDATE_ACCOUNT PURPLE_CONV_UPDATE_ACCOUNT -#define GAIM_CONV_UPDATE_TYPING PURPLE_CONV_UPDATE_TYPING -#define GAIM_CONV_UPDATE_UNSEEN PURPLE_CONV_UPDATE_UNSEEN -#define GAIM_CONV_UPDATE_LOGGING PURPLE_CONV_UPDATE_LOGGING -#define GAIM_CONV_UPDATE_TOPIC PURPLE_CONV_UPDATE_TOPIC -#define GAIM_CONV_ACCOUNT_ONLINE PURPLE_CONV_ACCOUNT_ONLINE -#define GAIM_CONV_ACCOUNT_OFFLINE PURPLE_CONV_ACCOUNT_OFFLINE -#define GAIM_CONV_UPDATE_AWAY PURPLE_CONV_UPDATE_AWAY -#define GAIM_CONV_UPDATE_ICON PURPLE_CONV_UPDATE_ICON -#define GAIM_CONV_UPDATE_TITLE PURPLE_CONV_UPDATE_TITLE -#define GAIM_CONV_UPDATE_CHATLEFT PURPLE_CONV_UPDATE_CHATLEFT -#define GAIM_CONV_UPDATE_FEATURES PURPLE_CONV_UPDATE_FEATURES - -#define GaimConvUpdateType PurpleConvUpdateType - -#define GAIM_NOT_TYPING PURPLE_NOT_TYPING -#define GAIM_TYPING PURPLE_TYPING -#define GAIM_TYPED PURPLE_TYPED - -#define GaimTypingState PurpleTypingState - -#define GAIM_MESSAGE_SEND PURPLE_MESSAGE_SEND -#define GAIM_MESSAGE_RECV PURPLE_MESSAGE_RECV -#define GAIM_MESSAGE_SYSTEM PURPLE_MESSAGE_SYSTEM -#define GAIM_MESSAGE_AUTO_RESP PURPLE_MESSAGE_AUTO_RESP -#define GAIM_MESSAGE_ACTIVE_ONLY PURPLE_MESSAGE_ACTIVE_ONLY -#define GAIM_MESSAGE_NICK PURPLE_MESSAGE_NICK -#define GAIM_MESSAGE_NO_LOG PURPLE_MESSAGE_NO_LOG -#define GAIM_MESSAGE_WHISPER PURPLE_MESSAGE_WHISPER -#define GAIM_MESSAGE_ERROR PURPLE_MESSAGE_ERROR -#define GAIM_MESSAGE_DELAYED PURPLE_MESSAGE_DELAYED -#define GAIM_MESSAGE_RAW PURPLE_MESSAGE_RAW -#define GAIM_MESSAGE_IMAGES PURPLE_MESSAGE_IMAGES - -#define GaimMessageFlags PurpleMessageFlags - -#define GAIM_CBFLAGS_NONE PURPLE_CBFLAGS_NONE -#define GAIM_CBFLAGS_VOICE PURPLE_CBFLAGS_VOICE -#define GAIM_CBFLAGS_HALFOP PURPLE_CBFLAGS_HALFOP -#define GAIM_CBFLAGS_OP PURPLE_CBFLAGS_OP -#define GAIM_CBFLAGS_FOUNDER PURPLE_CBFLAGS_FOUNDER -#define GAIM_CBFLAGS_TYPING PURPLE_CBFLAGS_TYPING - -#define GaimConvChatBuddyFlags PurpleConvChatBuddyFlags - -#define gaim_conversations_set_ui_ops purple_conversations_set_ui_ops - -#define gaim_conversation_new purple_conversation_new -#define gaim_conversation_destroy purple_conversation_destroy -#define gaim_conversation_present purple_conversation_present -#define gaim_conversation_get_type purple_conversation_get_type -#define gaim_conversation_set_ui_ops purple_conversation_set_ui_ops -#define gaim_conversation_get_ui_ops purple_conversation_get_ui_ops -#define gaim_conversation_set_account purple_conversation_set_account -#define gaim_conversation_get_account purple_conversation_get_account -#define gaim_conversation_get_gc purple_conversation_get_gc -#define gaim_conversation_set_title purple_conversation_set_title -#define gaim_conversation_get_title purple_conversation_get_title -#define gaim_conversation_autoset_title purple_conversation_autoset_title -#define gaim_conversation_set_name purple_conversation_set_name -#define gaim_conversation_get_name purple_conversation_get_name -#define gaim_conversation_set_logging purple_conversation_set_logging -#define gaim_conversation_is_logging purple_conversation_is_logging -#define gaim_conversation_close_logs purple_conversation_close_logs -#define gaim_conversation_get_im_data purple_conversation_get_im_data - -#define GAIM_CONV_IM PURPLE_CONV_IM - -#define gaim_conversation_get_chat_data purple_conversation_get_chat_data - -#define GAIM_CONV_CHAT PURPLE_CONV_CHAT - -#define gaim_conversation_set_data purple_conversation_set_data -#define gaim_conversation_get_data purple_conversation_get_data - -#define gaim_get_conversations purple_get_conversations -#define gaim_get_ims purple_get_ims -#define gaim_get_chats purple_get_chats - -#define gaim_find_conversation_with_account \ - purple_find_conversation_with_account - -#define gaim_conversation_write purple_conversation_write -#define gaim_conversation_set_features purple_conversation_set_features -#define gaim_conversation_get_features purple_conversation_get_features -#define gaim_conversation_has_focus purple_conversation_has_focus -#define gaim_conversation_update purple_conversation_update -#define gaim_conversation_foreach purple_conversation_foreach - -#define gaim_conv_im_get_conversation purple_conv_im_get_conversation -#define gaim_conv_im_set_icon purple_conv_im_set_icon -#define gaim_conv_im_get_icon purple_conv_im_get_icon -#define gaim_conv_im_set_typing_state purple_conv_im_set_typing_state -#define gaim_conv_im_get_typing_state purple_conv_im_get_typing_state - -#define gaim_conv_im_start_typing_timeout purple_conv_im_start_typing_timeout -#define gaim_conv_im_stop_typing_timeout purple_conv_im_stop_typing_timeout -#define gaim_conv_im_get_typing_timeout purple_conv_im_get_typing_timeout -#define gaim_conv_im_set_type_again purple_conv_im_set_type_again -#define gaim_conv_im_get_type_again purple_conv_im_get_type_again - -#define gaim_conv_im_start_send_typed_timeout \ - purple_conv_im_start_send_typed_timeout - -#define gaim_conv_im_stop_send_typed_timeout \ - purple_conv_im_stop_send_typed_timeout - -#define gaim_conv_im_get_send_typed_timeout \ - purple_conv_im_get_send_typed_timeout - -#define gaim_conv_present_error purple_conv_present_error -#define gaim_conv_send_confirm purple_conv_send_confirm - -#define gaim_conv_im_update_typing purple_conv_im_update_typing -#define gaim_conv_im_write purple_conv_im_write -#define gaim_conv_im_send purple_conv_im_send -#define gaim_conv_im_send_with_flags purple_conv_im_send_with_flags - -#define gaim_conv_custom_smiley_add purple_conv_custom_smiley_add -#define gaim_conv_custom_smiley_write purple_conv_custom_smiley_write -#define gaim_conv_custom_smiley_close purple_conv_custom_smiley_close - -#define gaim_conv_chat_get_conversation purple_conv_chat_get_conversation -#define gaim_conv_chat_set_users purple_conv_chat_set_users -#define gaim_conv_chat_get_users purple_conv_chat_get_users -#define gaim_conv_chat_ignore purple_conv_chat_ignore -#define gaim_conv_chat_unignore purple_conv_chat_unignore -#define gaim_conv_chat_set_ignored purple_conv_chat_set_ignored -#define gaim_conv_chat_get_ignored purple_conv_chat_get_ignored -#define gaim_conv_chat_get_ignored_user purple_conv_chat_get_ignored_user -#define gaim_conv_chat_is_user_ignored purple_conv_chat_is_user_ignored -#define gaim_conv_chat_set_topic purple_conv_chat_set_topic -#define gaim_conv_chat_get_topic purple_conv_chat_get_topic -#define gaim_conv_chat_set_id purple_conv_chat_set_id -#define gaim_conv_chat_get_id purple_conv_chat_get_id -#define gaim_conv_chat_write purple_conv_chat_write -#define gaim_conv_chat_send purple_conv_chat_send -#define gaim_conv_chat_send_with_flags purple_conv_chat_send_with_flags -#define gaim_conv_chat_add_user purple_conv_chat_add_user -#define gaim_conv_chat_add_users purple_conv_chat_add_users -#define gaim_conv_chat_rename_user purple_conv_chat_rename_user -#define gaim_conv_chat_remove_user purple_conv_chat_remove_user -#define gaim_conv_chat_remove_users purple_conv_chat_remove_users -#define gaim_conv_chat_find_user purple_conv_chat_find_user -#define gaim_conv_chat_user_set_flags purple_conv_chat_user_set_flags -#define gaim_conv_chat_user_get_flags purple_conv_chat_user_get_flags -#define gaim_conv_chat_clear_users purple_conv_chat_clear_users -#define gaim_conv_chat_set_nick purple_conv_chat_set_nick -#define gaim_conv_chat_get_nick purple_conv_chat_get_nick -#define gaim_conv_chat_left purple_conv_chat_left -#define gaim_conv_chat_has_left purple_conv_chat_has_left - -#define gaim_find_chat purple_find_chat - -#define gaim_conv_chat_cb_new purple_conv_chat_cb_new -#define gaim_conv_chat_cb_find purple_conv_chat_cb_find -#define gaim_conv_chat_cb_get_name purple_conv_chat_cb_get_name -#define gaim_conv_chat_cb_destroy purple_conv_chat_cb_destroy - -#define gaim_conversations_get_handle purple_conversations_get_handle -#define gaim_conversations_init purple_conversations_init -#define gaim_conversations_uninit purple_conversations_uninit - -/* from core.h */ - -#define GaimCore PurpleCore - -#define GaimCoreUiOps PurpleCoreUiOps - -#define gaim_core_init purple_core_init -#define gaim_core_quit purple_core_quit - -#define gaim_core_quit_cb purple_core_quit_cb -#define gaim_core_get_version purple_core_get_version -#define gaim_core_get_ui purple_core_get_ui -#define gaim_get_core purple_get_core -#define gaim_core_set_ui_ops purple_core_set_ui_ops -#define gaim_core_get_ui_ops purple_core_get_ui_ops - -/* from debug.h */ - -#define GAIM_DEBUG_ALL PURPLE_DEBUG_ALL -#define GAIM_DEBUG_MISC PURPLE_DEBUG_MISC -#define GAIM_DEBUG_INFO PURPLE_DEBUG_INFO -#define GAIM_DEBUG_WARNING PURPLE_DEBUG_WARNING -#define GAIM_DEBUG_ERROR PURPLE_DEBUG_ERROR -#define GAIM_DEBUG_FATAL PURPLE_DEBUG_FATAL - -#define GaimDebugLevel PurpleDebugLevel - -#define GaimDebugUiOps PurpleDebugUiOps - - -#define gaim_debug purple_debug -#define gaim_debug_misc purple_debug_misc -#define gaim_debug_info purple_debug_info -#define gaim_debug_warning purple_debug_warning -#define gaim_debug_error purple_debug_error -#define gaim_debug_fatal purple_debug_fatal - -#define gaim_debug_set_enabled purple_debug_set_enabled -#define gaim_debug_is_enabled purple_debug_is_enabled - -#define gaim_debug_set_ui_ops purple_debug_set_ui_ops -#define gaim_debug_get_ui_ops purple_debug_get_ui_ops - -#define gaim_debug_init purple_debug_init - -/* from desktopitem.h */ - -#define GAIM_DESKTOP_ITEM_TYPE_NULL PURPLE_DESKTOP_ITEM_TYPE_NULL -#define GAIM_DESKTOP_ITEM_TYPE_OTHER PURPLE_DESKTOP_ITEM_TYPE_OTHER -#define GAIM_DESKTOP_ITEM_TYPE_APPLICATION PURPLE_DESKTOP_ITEM_TYPE_APPLICATION -#define GAIM_DESKTOP_ITEM_TYPE_LINK PURPLE_DESKTOP_ITEM_TYPE_LINK -#define GAIM_DESKTOP_ITEM_TYPE_FSDEVICE PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE -#define GAIM_DESKTOP_ITEM_TYPE_MIME_TYPE PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE -#define GAIM_DESKTOP_ITEM_TYPE_DIRECTORY PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY -#define GAIM_DESKTOP_ITEM_TYPE_SERVICE PURPLE_DESKTOP_ITEM_TYPE_SERVICE -#define GAIM_DESKTOP_ITEM_TYPE_SERVICE_TYPE PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE - -#define GaimDesktopItemType PurpleDesktopItemType - -#define GaimDesktopItem PurpleDesktopItem - -#define GAIM_TYPE_DESKTOP_ITEM PURPLE_TYPE_DESKTOP_ITEM -#define gaim_desktop_item_get_type purple_desktop_item_get_type - -/* standard */ -/* ugh, i'm just copying these as strings, rather than pidginifying them */ -#define GAIM_DESKTOP_ITEM_ENCODING "Encoding" /* string */ -#define GAIM_DESKTOP_ITEM_VERSION "Version" /* numeric */ -#define GAIM_DESKTOP_ITEM_NAME "Name" /* localestring */ -#define GAIM_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */ -#define GAIM_DESKTOP_ITEM_TYPE "Type" /* string */ -#define GAIM_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_TRY_EXEC "TryExec" /* string */ -#define GAIM_DESKTOP_ITEM_NO_DISPLAY "NoDisplay" /* boolean */ -#define GAIM_DESKTOP_ITEM_COMMENT "Comment" /* localestring */ -#define GAIM_DESKTOP_ITEM_EXEC "Exec" /* string */ -#define GAIM_DESKTOP_ITEM_ACTIONS "Actions" /* strings */ -#define GAIM_DESKTOP_ITEM_ICON "Icon" /* string */ -#define GAIM_DESKTOP_ITEM_MINI_ICON "MiniIcon" /* string */ -#define GAIM_DESKTOP_ITEM_HIDDEN "Hidden" /* boolean */ -#define GAIM_DESKTOP_ITEM_PATH "Path" /* string */ -#define GAIM_DESKTOP_ITEM_TERMINAL "Terminal" /* boolean */ -#define GAIM_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */ -#define GAIM_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */ -#define GAIM_DESKTOP_ITEM_SWALLOW_EXEC "SwallowExec" /* string */ -#define GAIM_DESKTOP_ITEM_MIME_TYPE "MimeType" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_PATTERNS "Patterns" /* regexp(s) */ -#define GAIM_DESKTOP_ITEM_DEFAULT_APP "DefaultApp" /* string */ -#define GAIM_DESKTOP_ITEM_DEV "Dev" /* string */ -#define GAIM_DESKTOP_ITEM_FS_TYPE "FSType" /* string */ -#define GAIM_DESKTOP_ITEM_MOUNT_POINT "MountPoint" /* string */ -#define GAIM_DESKTOP_ITEM_READ_ONLY "ReadOnly" /* boolean */ -#define GAIM_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */ -#define GAIM_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */ -#define GAIM_DESKTOP_ITEM_URL "URL" /* string */ -#define GAIM_DESKTOP_ITEM_DOC_PATH "X-GNOME-DocPath" /* string */ - -#define gaim_desktop_item_new_from_file purple_desktop_item_new_from_file -#define gaim_desktop_item_get_entry_type purple_desktop_item_get_entry_type -#define gaim_desktop_item_get_string purple_desktop_item_get_string -#define gaim_desktop_item_copy purple_desktop_item_copy -#define gaim_desktop_item_unref purple_desktop_item_unref - -/* from dnsquery.h */ - -#define GaimDnsQueryData PurpleDnsQueryData -#define GaimDnsQueryConnectFunction PurpleDnsQueryConnectFunction - -#define gaim_dnsquery_a purple_dnsquery_a -#define gaim_dnsquery_destroy purple_dnsquery_destroy -#define gaim_dnsquery_init purple_dnsquery_init -#define gaim_dnsquery_uninit purple_dnsquery_uninit -#define gaim_dnsquery_set_ui_ops purple_dnsquery_set_ui_ops -#define gaim_dnsquery_get_host purple_dnsquery_get_host -#define gaim_dnsquery_get_port purple_dnsquery_get_port - -/* from dnssrv.h */ - -#define GaimSrvResponse PurpleSrvResponse -#define GaimSrvQueryData PurpleSrvQueryData -#define GaimSrvCallback PurpleSrvCallback - -#define gaim_srv_resolve purple_srv_resolve -#define gaim_srv_cancel purple_srv_cancel - -/* from eventloop.h */ - -#define GAIM_INPUT_READ PURPLE_INPUT_READ -#define GAIM_INPUT_WRITE PURPLE_INPUT_WRITE - -#define GaimInputCondition PurpleInputCondition -#define GaimInputFunction PurpleInputFunction -#define GaimEventLoopUiOps PurpleEventLoopUiOps - -#define gaim_timeout_add purple_timeout_add -#define gaim_timeout_remove purple_timeout_remove -#define gaim_input_add purple_input_add -#define gaim_input_remove purple_input_remove - -#define gaim_eventloop_set_ui_ops purple_eventloop_set_ui_ops -#define gaim_eventloop_get_ui_ops purple_eventloop_get_ui_ops - -/* from ft.h */ - -#define GaimXfer PurpleXfer - -#define GAIM_XFER_UNKNOWN PURPLE_XFER_UNKNOWN -#define GAIM_XFER_SEND PURPLE_XFER_SEND -#define GAIM_XFER_RECEIVE PURPLE_XFER_RECEIVE - -#define GaimXferType PurpleXferType - -#define GAIM_XFER_STATUS_UNKNOWN PURPLE_XFER_STATUS_UNKNOWN -#define GAIM_XFER_STATUS_NOT_STARTED PURPLE_XFER_STATUS_NOT_STARTED -#define GAIM_XFER_STATUS_ACCEPTED PURPLE_XFER_STATUS_ACCEPTED -#define GAIM_XFER_STATUS_STARTED PURPLE_XFER_STATUS_STARTED -#define GAIM_XFER_STATUS_DONE PURPLE_XFER_STATUS_DONE -#define GAIM_XFER_STATUS_CANCEL_LOCAL PURPLE_XFER_STATUS_CANCEL_LOCAL -#define GAIM_XFER_STATUS_CANCEL_REMOTE PURPLE_XFER_STATUS_CANCEL_REMOTE - -#define GaimXferStatusType PurpleXferStatusType - -#define GaimXferUiOps PurpleXferUiOps - -#define gaim_xfer_new purple_xfer_new -#define gaim_xfer_ref purple_xfer_ref -#define gaim_xfer_unref purple_xfer_unref -#define gaim_xfer_request purple_xfer_request -#define gaim_xfer_request_accepted purple_xfer_request_accepted -#define gaim_xfer_request_denied purple_xfer_request_denied -#define gaim_xfer_get_type purple_xfer_get_type -#define gaim_xfer_get_account purple_xfer_get_account -#define gaim_xfer_get_status purple_xfer_get_status -#define gaim_xfer_is_canceled purple_xfer_is_canceled -#define gaim_xfer_is_completed purple_xfer_is_completed -#define gaim_xfer_get_filename purple_xfer_get_filename -#define gaim_xfer_get_local_filename purple_xfer_get_local_filename -#define gaim_xfer_get_bytes_sent purple_xfer_get_bytes_sent -#define gaim_xfer_get_bytes_remaining purple_xfer_get_bytes_remaining -#define gaim_xfer_get_size purple_xfer_get_size -#define gaim_xfer_get_progress purple_xfer_get_progress -#define gaim_xfer_get_local_port purple_xfer_get_local_port -#define gaim_xfer_get_remote_ip purple_xfer_get_remote_ip -#define gaim_xfer_get_remote_port purple_xfer_get_remote_port -#define gaim_xfer_set_completed purple_xfer_set_completed -#define gaim_xfer_set_message purple_xfer_set_message -#define gaim_xfer_set_filename purple_xfer_set_filename -#define gaim_xfer_set_local_filename purple_xfer_set_local_filename -#define gaim_xfer_set_size purple_xfer_set_size -#define gaim_xfer_set_bytes_sent purple_xfer_set_bytes_sent -#define gaim_xfer_get_ui_ops purple_xfer_get_ui_ops -#define gaim_xfer_set_read_fnc purple_xfer_set_read_fnc -#define gaim_xfer_set_write_fnc purple_xfer_set_write_fnc -#define gaim_xfer_set_ack_fnc purple_xfer_set_ack_fnc -#define gaim_xfer_set_request_denied_fnc purple_xfer_set_request_denied_fnc -#define gaim_xfer_set_init_fnc purple_xfer_set_init_fnc -#define gaim_xfer_set_start_fnc purple_xfer_set_start_fnc -#define gaim_xfer_set_end_fnc purple_xfer_set_end_fnc -#define gaim_xfer_set_cancel_send_fnc purple_xfer_set_cancel_send_fnc -#define gaim_xfer_set_cancel_recv_fnc purple_xfer_set_cancel_recv_fnc - -#define gaim_xfer_read purple_xfer_read -#define gaim_xfer_write purple_xfer_write -#define gaim_xfer_start purple_xfer_start -#define gaim_xfer_end purple_xfer_end -#define gaim_xfer_add purple_xfer_add -#define gaim_xfer_cancel_local purple_xfer_cancel_local -#define gaim_xfer_cancel_remote purple_xfer_cancel_remote -#define gaim_xfer_error purple_xfer_error -#define gaim_xfer_update_progress purple_xfer_update_progress -#define gaim_xfer_conversation_write purple_xfer_conversation_write - -#define gaim_xfers_get_handle purple_xfers_get_handle -#define gaim_xfers_init purple_xfers_init -#define gaim_xfers_uninit purple_xfers_uninit -#define gaim_xfers_set_ui_ops purple_xfers_set_ui_ops -#define gaim_xfers_get_ui_ops purple_xfers_get_ui_ops - -/* from gaim-client.h */ - -#define gaim_init purple_init - -/* from idle.h */ - -#define GaimIdleUiOps PurpleIdleUiOps - -#define gaim_idle_touch purple_idle_touch -#define gaim_idle_set purple_idle_set -#define gaim_idle_set_ui_ops purple_idle_set_ui_ops -#define gaim_idle_get_ui_ops purple_idle_get_ui_ops -#define gaim_idle_init purple_idle_init -#define gaim_idle_uninit purple_idle_uninit - -/* from imgstore.h */ - -#define GaimStoredImage PurpleStoredImage - -#define gaim_imgstore_add(data, size, filename) \ - purple_imgstore_add_with_id(g_memdup(data, size), size, filename) -#define gaim_imgstore_get purple_imgstore_find_by_id -#define gaim_imgstore_get_data purple_imgstore_get_data -#define gaim_imgstore_get_size purple_imgstore_get_size -#define gaim_imgstore_get_filename purple_imgstore_get_filename -#define gaim_imgstore_ref purple_imgstore_ref_by_id -#define gaim_imgstore_unref purple_imgstore_unref_by_id - - -/* from log.h */ - -#define GaimLog PurpleLog -#define GaimLogLogger PurpleLogLogger -#define GaimLogCommonLoggerData PurpleLogCommonLoggerData -#define GaimLogSet PurpleLogSet - -#define GAIM_LOG_IM PURPLE_LOG_IM -#define GAIM_LOG_CHAT PURPLE_LOG_CHAT -#define GAIM_LOG_SYSTEM PURPLE_LOG_SYSTEM - -#define GaimLogType PurpleLogType - -#define GAIM_LOG_READ_NO_NEWLINE PURPLE_LOG_READ_NO_NEWLINE - -#define GaimLogReadFlags PurpleLogReadFlags - -#define GaimLogSetCallback PurpleLogSetCallback - -#define gaim_log_new purple_log_new -#define gaim_log_free purple_log_free -#define gaim_log_write purple_log_write -#define gaim_log_read purple_log_read - -#define gaim_log_get_logs purple_log_get_logs -#define gaim_log_get_log_sets purple_log_get_log_sets -#define gaim_log_get_system_logs purple_log_get_system_logs -#define gaim_log_get_size purple_log_get_size -#define gaim_log_get_total_size purple_log_get_total_size -#define gaim_log_get_log_dir purple_log_get_log_dir -#define gaim_log_compare purple_log_compare -#define gaim_log_set_compare purple_log_set_compare -#define gaim_log_set_free purple_log_set_free - -#define gaim_log_common_writer purple_log_common_writer -#define gaim_log_common_lister purple_log_common_lister -#define gaim_log_common_total_sizer purple_log_common_total_sizer -#define gaim_log_common_sizer purple_log_common_sizer - -#define gaim_log_logger_new purple_log_logger_new -#define gaim_log_logger_free purple_log_logger_free -#define gaim_log_logger_add purple_log_logger_add -#define gaim_log_logger_remove purple_log_logger_remove -#define gaim_log_logger_set purple_log_logger_set -#define gaim_log_logger_get purple_log_logger_get - -#define gaim_log_logger_get_options purple_log_logger_get_options - -#define gaim_log_init purple_log_init -#define gaim_log_get_handle purple_log_get_handle -#define gaim_log_uninit purple_log_uninit - -/* from mime.h */ - -#define GaimMimeDocument PurpleMimeDocument -#define GaimMimePart PurpleMimePart - -#define gaim_mime_document_new purple_mime_document_new -#define gaim_mime_document_free purple_mime_document_free -#define gaim_mime_document_parse purple_mime_document_parse -#define gaim_mime_document_parsen purple_mime_document_parsen -#define gaim_mime_document_write purple_mime_document_write -#define gaim_mime_document_get_fields purple_mime_document_get_fields -#define gaim_mime_document_get_field purple_mime_document_get_field -#define gaim_mime_document_set_field purple_mime_document_set_field -#define gaim_mime_document_get_parts purple_mime_document_get_parts - -#define gaim_mime_part_new purple_mime_part_new -#define gaim_mime_part_get_fields purple_mime_part_get_fields -#define gaim_mime_part_get_field purple_mime_part_get_field -#define gaim_mime_part_get_field_decoded purple_mime_part_get_field_decoded -#define gaim_mime_part_set_field purple_mime_part_set_field -#define gaim_mime_part_get_data purple_mime_part_get_data -#define gaim_mime_part_get_data_decoded purple_mime_part_get_data_decoded -#define gaim_mime_part_get_length purple_mime_part_get_length -#define gaim_mime_part_set_data purple_mime_part_set_data - - -/* from network.h */ - -#define GaimNetworkListenData PurpleNetworkListenData - -#define GaimNetworkListenCallback PurpleNetworkListenCallback - -#define gaim_network_ip_atoi purple_network_ip_atoi -#define gaim_network_set_public_ip purple_network_set_public_ip -#define gaim_network_get_public_ip purple_network_get_public_ip -#define gaim_network_get_local_system_ip purple_network_get_local_system_ip -#define gaim_network_get_my_ip purple_network_get_my_ip - -#define gaim_network_listen purple_network_listen -#define gaim_network_listen_range purple_network_listen_range -#define gaim_network_listen_cancel purple_network_listen_cancel -#define gaim_network_get_port_from_fd purple_network_get_port_from_fd - -#define gaim_network_is_available purple_network_is_available - -#define gaim_network_init purple_network_init -#define gaim_network_uninit purple_network_uninit - -/* from notify.h */ - - -#define GaimNotifyUserInfoEntry PurpleNotifyUserInfoEntry -#define GaimNotifyUserInfo PurpleNotifyUserInfo - -#define GaimNotifyCloseCallback PurpleNotifyCloseCallback - -#define GAIM_NOTIFY_MESSAGE PURPLE_NOTIFY_MESSAGE -#define GAIM_NOTIFY_EMAIL PURPLE_NOTIFY_EMAIL -#define GAIM_NOTIFY_EMAILS PURPLE_NOTIFY_EMAILS -#define GAIM_NOTIFY_FORMATTED PURPLE_NOTIFY_FORMATTED -#define GAIM_NOTIFY_SEARCHRESULTS PURPLE_NOTIFY_SEARCHRESULTS -#define GAIM_NOTIFY_USERINFO PURPLE_NOTIFY_USERINFO -#define GAIM_NOTIFY_URI PURPLE_NOTIFY_URI - -#define GaimNotifyType PurpleNotifyType - -#define GAIM_NOTIFY_MSG_ERROR PURPLE_NOTIFY_MSG_ERROR -#define GAIM_NOTIFY_MSG_WARNING PURPLE_NOTIFY_MSG_WARNING -#define GAIM_NOTIFY_MSG_INFO PURPLE_NOTIFY_MSG_INFO - -#define GaimNotifyMsgType PurpleNotifyMsgType - -#define GAIM_NOTIFY_BUTTON_LABELED PURPLE_NOTIFY_BUTTON_LABELED -#define GAIM_NOTIFY_BUTTON_CONTINUE PURPLE_NOTIFY_BUTTON_CONTINUE -#define GAIM_NOTIFY_BUTTON_ADD PURPLE_NOTIFY_BUTTON_ADD -#define GAIM_NOTIFY_BUTTON_INFO PURPLE_NOTIFY_BUTTON_INFO -#define GAIM_NOTIFY_BUTTON_IM PURPLE_NOTIFY_BUTTON_IM -#define GAIM_NOTIFY_BUTTON_JOIN PURPLE_NOTIFY_BUTTON_JOIN -#define GAIM_NOTIFY_BUTTON_INVITE PURPLE_NOTIFY_BUTTON_INVITE - -#define GaimNotifySearchButtonType PurpleNotifySearchButtonType - -#define GaimNotifySearchResults PurpleNotifySearchResults - -#define GAIM_NOTIFY_USER_INFO_ENTRY_PAIR PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR -#define GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK -#define GAIM_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER - -#define GaimNotifyUserInfoEntryType PurpleNotifyUserInfoEntryType - -#define GaimNotifySearchColumn PurpleNotifySearchColumn -#define GaimNotifySearchResultsCallback PurpleNotifySearchResultsCallback -#define GaimNotifySearchButton PurpleNotifySearchButton - -#define GaimNotifyUiOps PurpleNotifyUiOps - -#define gaim_notify_searchresults purple_notify_searchresults -#define gaim_notify_searchresults_free purple_notify_searchresults_free -#define gaim_notify_searchresults_new_rows purple_notify_searchresults_new_rows -#define gaim_notify_searchresults_button_add purple_notify_searchresults_button_add -#define gaim_notify_searchresults_button_add_labeled purple_notify_searchresults_button_add_labeled -#define gaim_notify_searchresults_new purple_notify_searchresults_new -#define gaim_notify_searchresults_column_new purple_notify_searchresults_column_new -#define gaim_notify_searchresults_column_add purple_notify_searchresults_column_add -#define gaim_notify_searchresults_row_add purple_notify_searchresults_row_add -#define gaim_notify_searchresults_get_rows_count purple_notify_searchresults_get_rows_count -#define gaim_notify_searchresults_get_columns_count purple_notify_searchresults_get_columns_count -#define gaim_notify_searchresults_row_get purple_notify_searchresults_row_get -#define gaim_notify_searchresults_column_get_title purple_notify_searchresults_column_get_title - -#define gaim_notify_message purple_notify_message -#define gaim_notify_email purple_notify_email -#define gaim_notify_emails purple_notify_emails -#define gaim_notify_formatted purple_notify_formatted -#define gaim_notify_userinfo purple_notify_userinfo - -#define gaim_notify_user_info_new purple_notify_user_info_new -#define gaim_notify_user_info_destroy purple_notify_user_info_destroy -#define gaim_notify_user_info_get_entries purple_notify_user_info_get_entries -#define gaim_notify_user_info_get_text_with_newline purple_notify_user_info_get_text_with_newline -#define gaim_notify_user_info_add_pair purple_notify_user_info_add_pair -#define gaim_notify_user_info_prepend_pair purple_notify_user_info_prepend_pair -#define gaim_notify_user_info_remove_entry purple_notify_user_info_remove_entry -#define gaim_notify_user_info_entry_new purple_notify_user_info_entry_new -#define gaim_notify_user_info_add_section_break purple_notify_user_info_add_section_break -#define gaim_notify_user_info_add_section_header purple_notify_user_info_add_section_header -#define gaim_notify_user_info_remove_last_item purple_notify_user_info_remove_last_item -#define gaim_notify_user_info_entry_get_label purple_notify_user_info_entry_get_label -#define gaim_notify_user_info_entry_set_label purple_notify_user_info_entry_set_label -#define gaim_notify_user_info_entry_get_value purple_notify_user_info_entry_get_value -#define gaim_notify_user_info_entry_set_value purple_notify_user_info_entry_set_value -#define gaim_notify_user_info_entry_get_type purple_notify_user_info_entry_get_type -#define gaim_notify_user_info_entry_set_type purple_notify_user_info_entry_set_type - -#define gaim_notify_uri purple_notify_uri -#define gaim_notify_close purple_notify_close -#define gaim_notify_close_with_handle purple_notify_close_with_handle - -#define gaim_notify_info purple_notify_info -#define gaim_notify_warning purple_notify_warning -#define gaim_notify_error purple_notify_error - -#define gaim_notify_set_ui_ops purple_notify_set_ui_ops -#define gaim_notify_get_ui_ops purple_notify_get_ui_ops - -#define gaim_notify_get_handle purple_notify_get_handle - -#define gaim_notify_init purple_notify_init -#define gaim_notify_uninit purple_notify_uninit - -/* from ntlm.h */ - -#define gaim_ntlm_gen_type1 purple_ntlm_gen_type1 -#define gaim_ntlm_parse_type2 purple_ntlm_parse_type2 -#define gaim_ntlm_gen_type3 purple_ntlm_gen_type3 - -/* from plugin.h */ - -#ifdef GAIM_PLUGINS -#ifndef PURPLE_PLUGINS -#define PURPLE_PLUGINS -#endif -#endif - -#define GaimPlugin PurplePlugin -#define GaimPluginInfo PurplePluginInfo -#define GaimPluginUiInfo PurplePluginUiInfo -#define GaimPluginLoaderInfo PurplePluginLoaderInfo -#define GaimPluginAction PurplePluginAction -#define GaimPluginPriority PurplePluginPriority - -#define GAIM_PLUGIN_UNKNOWN PURPLE_PLUGIN_UNKNOWN -#define GAIM_PLUGIN_STANDARD PURPLE_PLUGIN_STANDARD -#define GAIM_PLUGIN_LOADER PURPLE_PLUGIN_LOADER -#define GAIM_PLUGIN_PROTOCOL PURPLE_PLUGIN_PROTOCOL - -#define GaimPluginType PurplePluginType - -#define GAIM_PRIORITY_DEFAULT PURPLE_PRIORITY_DEFAULT -#define GAIM_PRIORITY_HIGHEST PURPLE_PRIORITY_HIGHEST -#define GAIM_PRIORITY_LOWEST PURPLE_PRIORITY_LOWEST - -#define GAIM_PLUGIN_FLAG_INVISIBLE PURPLE_PLUGIN_FLAG_INVISIBLE - -#define GAIM_PLUGIN_MAGIC PURPLE_PLUGIN_MAGIC - -#define GAIM_PLUGIN_LOADER_INFO PURPLE_PLUGIN_LOADER_INFO -#define GAIM_PLUGIN_HAS_PREF_FRAME PURPLE_PLUGIN_HAS_PREF_FRAME -#define GAIM_PLUGIN_UI_INFO PURPLE_PLUGIN_UI_INFO - -#define GAIM_PLUGIN_HAS_ACTIONS PURPLE_PLUGIN_HAS_ACTIONS -#define GAIM_PLUGIN_ACTIONS PURPLE_PLUGIN_ACTIONS - -#define GAIM_INIT_PLUGIN PURPLE_INIT_PLUGIN - -#define gaim_plugin_new purple_plugin_new -#define gaim_plugin_probe purple_plugin_probe -#define gaim_plugin_register purple_plugin_register -#define gaim_plugin_load purple_plugin_load -#define gaim_plugin_unload purple_plugin_unload -#define gaim_plugin_reload purple_plugin_reload -#define gaim_plugin_destroy purple_plugin_destroy -#define gaim_plugin_is_loaded purple_plugin_is_loaded -#define gaim_plugin_is_unloadable purple_plugin_is_unloadable -#define gaim_plugin_get_id purple_plugin_get_id -#define gaim_plugin_get_name purple_plugin_get_name -#define gaim_plugin_get_version purple_plugin_get_version -#define gaim_plugin_get_summary purple_plugin_get_summary -#define gaim_plugin_get_description purple_plugin_get_description -#define gaim_plugin_get_author purple_plugin_get_author -#define gaim_plugin_get_homepage purple_plugin_get_homepage - -#define gaim_plugin_ipc_register purple_plugin_ipc_register -#define gaim_plugin_ipc_unregister purple_plugin_ipc_unregister -#define gaim_plugin_ipc_unregister_all purple_plugin_ipc_unregister_all -#define gaim_plugin_ipc_get_params purple_plugin_ipc_get_params -#define gaim_plugin_ipc_call purple_plugin_ipc_call - -#define gaim_plugins_add_search_path purple_plugins_add_search_path -#define gaim_plugins_unload_all purple_plugins_unload_all -#define gaim_plugins_destroy_all purple_plugins_destroy_all -#define gaim_plugins_save_loaded purple_plugins_save_loaded -#define gaim_plugins_load_saved purple_plugins_load_saved -#define gaim_plugins_probe purple_plugins_probe -#define gaim_plugins_enabled purple_plugins_enabled - -#define gaim_plugins_register_probe_notify_cb purple_plugins_register_probe_notify_cb -#define gaim_plugins_unregister_probe_notify_cb purple_plugins_unregister_probe_notify_cb -#define gaim_plugins_register_load_notify_cb purple_plugins_register_load_notify_cb -#define gaim_plugins_unregister_load_notify_cb purple_plugins_unregister_load_notify_cb -#define gaim_plugins_register_unload_notify_cb purple_plugins_register_unload_notify_cb -#define gaim_plugins_unregister_unload_notify_cb purple_plugins_unregister_unload_notify_cb - -#define gaim_plugins_find_with_name purple_plugins_find_with_name -#define gaim_plugins_find_with_filename purple_plugins_find_with_filename -#define gaim_plugins_find_with_basename purple_plugins_find_with_basename -#define gaim_plugins_find_with_id purple_plugins_find_with_id - -#define gaim_plugins_get_loaded purple_plugins_get_loaded -#define gaim_plugins_get_protocols purple_plugins_get_protocols -#define gaim_plugins_get_all purple_plugins_get_all - -#define gaim_plugins_get_handle purple_plugins_get_handle -#define gaim_plugins_init purple_plugins_init -#define gaim_plugins_uninit purple_plugins_uninit - -#define gaim_plugin_action_new purple_plugin_action_new -#define gaim_plugin_action_free purple_plugin_action_free - -/* pluginpref.h */ - -#define GaimPluginPrefFrame PurplePluginPrefFrame -#define GaimPluginPref PurplePluginPref - -#define GAIM_STRING_FORMAT_TYPE_NONE PURPLE_STRING_FORMAT_TYPE_NONE -#define GAIM_STRING_FORMAT_TYPE_MULTILINE PURPLE_STRING_FORMAT_TYPE_MULTILINE -#define GAIM_STRING_FORMAT_TYPE_HTML PURPLE_STRING_FORMAT_TYPE_HTML - -#define GaimStringFormatType PurpleStringFormatType - -#define GAIM_PLUGIN_PREF_NONE PURPLE_PLUGIN_PREF_NONE -#define GAIM_PLUGIN_PREF_CHOICE PURPLE_PLUGIN_PREF_CHOICE -#define GAIM_PLUGIN_PREF_INFO PURPLE_PLUGIN_PREF_INFO -#define GAIM_PLUGIN_PREF_STRING_FORMAT PURPLE_PLUGIN_PREF_STRING_FORMAT - -#define GaimPluginPrefType PurplePluginPrefType - -#define gaim_plugin_pref_frame_new purple_plugin_pref_frame_new -#define gaim_plugin_pref_frame_destroy purple_plugin_pref_frame_destroy -#define gaim_plugin_pref_frame_add purple_plugin_pref_frame_add -#define gaim_plugin_pref_frame_get_prefs purple_plugin_pref_frame_get_prefs - -#define gaim_plugin_pref_new purple_plugin_pref_new -#define gaim_plugin_pref_new_with_name purple_plugin_pref_new_with_name -#define gaim_plugin_pref_new_with_label purple_plugin_pref_new_with_label -#define gaim_plugin_pref_new_with_name_and_label purple_plugin_pref_new_with_name_and_label -#define gaim_plugin_pref_destroy purple_plugin_pref_destroy -#define gaim_plugin_pref_set_name purple_plugin_pref_set_name -#define gaim_plugin_pref_get_name purple_plugin_pref_get_name -#define gaim_plugin_pref_set_label purple_plugin_pref_set_label -#define gaim_plugin_pref_get_label purple_plugin_pref_get_label -#define gaim_plugin_pref_set_bounds purple_plugin_pref_set_bounds -#define gaim_plugin_pref_get_bounds purple_plugin_pref_get_bounds -#define gaim_plugin_pref_set_type purple_plugin_pref_set_type -#define gaim_plugin_pref_get_type purple_plugin_pref_get_type -#define gaim_plugin_pref_add_choice purple_plugin_pref_add_choice -#define gaim_plugin_pref_get_choices purple_plugin_pref_get_choices -#define gaim_plugin_pref_set_max_length purple_plugin_pref_set_max_length -#define gaim_plugin_pref_get_max_length purple_plugin_pref_get_max_length -#define gaim_plugin_pref_set_masked purple_plugin_pref_set_masked -#define gaim_plugin_pref_get_masked purple_plugin_pref_get_masked -#define gaim_plugin_pref_set_format_type purple_plugin_pref_set_format_type -#define gaim_plugin_pref_get_format_type purple_plugin_pref_get_format_type - -/* from pounce.h */ - -#define GaimPounce PurplePounce - -#define GAIM_POUNCE_NONE PURPLE_POUNCE_NONE -#define GAIM_POUNCE_SIGNON PURPLE_POUNCE_SIGNON -#define GAIM_POUNCE_SIGNOFF PURPLE_POUNCE_SIGNOFF -#define GAIM_POUNCE_AWAY PURPLE_POUNCE_AWAY -#define GAIM_POUNCE_AWAY_RETURN PURPLE_POUNCE_AWAY_RETURN -#define GAIM_POUNCE_IDLE PURPLE_POUNCE_IDLE -#define GAIM_POUNCE_IDLE_RETURN PURPLE_POUNCE_IDLE_RETURN -#define GAIM_POUNCE_TYPING PURPLE_POUNCE_TYPING -#define GAIM_POUNCE_TYPED PURPLE_POUNCE_TYPED -#define GAIM_POUNCE_TYPING_STOPPED PURPLE_POUNCE_TYPING_STOPPED -#define GAIM_POUNCE_MESSAGE_RECEIVED PURPLE_POUNCE_MESSAGE_RECEIVED -#define GaimPounceEvent PurplePounceEvent - -#define GAIM_POUNCE_OPTION_NONE PURPLE_POUNCE_OPTION_NONE -#define GAIM_POUNCE_OPTION_AWAY PURPLE_POUNCE_OPTION_AWAY -#define GaimPounceOption PurplePounceOption - -#define GaimPounceCb PurplePounceCb - -#define gaim_pounce_new purple_pounce_new -#define gaim_pounce_destroy purple_pounce_destroy -#define gaim_pounce_destroy_all_by_account purple_pounce_destroy_all_by_account -#define gaim_pounce_set_events purple_pounce_set_events -#define gaim_pounce_set_options purple_pounce_set_options -#define gaim_pounce_set_pouncer purple_pounce_set_pouncer -#define gaim_pounce_set_pouncee purple_pounce_set_pouncee -#define gaim_pounce_set_save purple_pounce_set_save -#define gaim_pounce_action_register purple_pounce_action_register -#define gaim_pounce_action_set_enabled purple_pounce_action_set_enabled -#define gaim_pounce_action_set_attribute purple_pounce_action_set_attribute -#define gaim_pounce_set_data purple_pounce_set_data -#define gaim_pounce_get_events purple_pounce_get_events -#define gaim_pounce_get_options purple_pounce_get_options -#define gaim_pounce_get_pouncer purple_pounce_get_pouncer -#define gaim_pounce_get_pouncee purple_pounce_get_pouncee -#define gaim_pounce_get_save purple_pounce_get_save -#define gaim_pounce_action_is_enabled purple_pounce_action_is_enabled -#define gaim_pounce_action_get_attribute purple_pounce_action_get_attribute -#define gaim_pounce_get_data purple_pounce_get_data -#define gaim_pounce_execute purple_pounce_execute - -#define gaim_find_pounce purple_find_pounce -#define gaim_pounces_load purple_pounces_load -#define gaim_pounces_register_handler purple_pounces_register_handler -#define gaim_pounces_unregister_handler purple_pounces_unregister_handler -#define gaim_pounces_get_all purple_pounces_get_all -#define gaim_pounces_get_handle purple_pounces_get_handle -#define gaim_pounces_init purple_pounces_init -#define gaim_pounces_uninit purple_pounces_uninit - -/* from prefs.h */ - - -#define GAIM_PREF_NONE PURPLE_PREF_NONE -#define GAIM_PREF_BOOLEAN PURPLE_PREF_BOOLEAN -#define GAIM_PREF_INT PURPLE_PREF_INT -#define GAIM_PREF_STRING PURPLE_PREF_STRING -#define GAIM_PREF_STRING_LIST PURPLE_PREF_STRING_LIST -#define GAIM_PREF_PATH PURPLE_PREF_PATH -#define GAIM_PREF_PATH_LIST PURPLE_PREF_PATH_LIST -#define GaimPrefType PurplePrefType - -#define GaimPrefCallback PurplePrefCallback - -#define gaim_prefs_get_handle purple_prefs_get_handle -#define gaim_prefs_init purple_prefs_init -#define gaim_prefs_uninit purple_prefs_uninit -#define gaim_prefs_add_none purple_prefs_add_none -#define gaim_prefs_add_bool purple_prefs_add_bool -#define gaim_prefs_add_int purple_prefs_add_int -#define gaim_prefs_add_string purple_prefs_add_string -#define gaim_prefs_add_string_list purple_prefs_add_string_list -#define gaim_prefs_add_path purple_prefs_add_path -#define gaim_prefs_add_path_list purple_prefs_add_path_list -#define gaim_prefs_remove purple_prefs_remove -#define gaim_prefs_rename purple_prefs_rename -#define gaim_prefs_rename_boolean_toggle purple_prefs_rename_boolean_toggle -#define gaim_prefs_destroy purple_prefs_destroy -#define gaim_prefs_set_generic purple_prefs_set_generic -#define gaim_prefs_set_bool purple_prefs_set_bool -#define gaim_prefs_set_int purple_prefs_set_int -#define gaim_prefs_set_string purple_prefs_set_string -#define gaim_prefs_set_string_list purple_prefs_set_string_list -#define gaim_prefs_set_path purple_prefs_set_path -#define gaim_prefs_set_path_list purple_prefs_set_path_list -#define gaim_prefs_exists purple_prefs_exists -#define gaim_prefs_get_type purple_prefs_get_type -#define gaim_prefs_get_bool purple_prefs_get_bool -#define gaim_prefs_get_int purple_prefs_get_int -#define gaim_prefs_get_string purple_prefs_get_string -#define gaim_prefs_get_string_list purple_prefs_get_string_list -#define gaim_prefs_get_path purple_prefs_get_path -#define gaim_prefs_get_path_list purple_prefs_get_path_list -#define gaim_prefs_connect_callback purple_prefs_connect_callback -#define gaim_prefs_disconnect_callback purple_prefs_disconnect_callback -#define gaim_prefs_disconnect_by_handle purple_prefs_disconnect_by_handle -#define gaim_prefs_trigger_callback purple_prefs_trigger_callback -#define gaim_prefs_load purple_prefs_load -#define gaim_prefs_update_old purple_prefs_update_old - -/* from privacy.h */ - -#define GAIM_PRIVACY_ALLOW_ALL PURPLE_PRIVACY_ALLOW_ALL -#define GAIM_PRIVACY_DENY_ALL PURPLE_PRIVACY_DENY_ALL -#define GAIM_PRIVACY_ALLOW_USERS PURPLE_PRIVACY_ALLOW_USERS -#define GAIM_PRIVACY_DENY_USERS PURPLE_PRIVACY_DENY_USERS -#define GAIM_PRIVACY_ALLOW_BUDDYLIST PURPLE_PRIVACY_ALLOW_BUDDYLIST -#define GaimPrivacyType PurplePrivacyType - -#define GaimPrivacyUiOps PurplePrivacyUiOps - -#define gaim_privacy_permit_add purple_privacy_permit_add -#define gaim_privacy_permit_remove purple_privacy_permit_remove -#define gaim_privacy_deny_add purple_privacy_deny_add -#define gaim_privacy_deny_remove purple_privacy_deny_remove -#define gaim_privacy_allow purple_privacy_allow -#define gaim_privacy_deny purple_privacy_deny -#define gaim_privacy_check purple_privacy_check -#define gaim_privacy_set_ui_ops purple_privacy_set_ui_ops -#define gaim_privacy_get_ui_ops purple_privacy_get_ui_ops -#define gaim_privacy_init purple_privacy_init - -/* from proxy.h */ - -#define GAIM_PROXY_USE_GLOBAL PURPLE_PROXY_USE_GLOBAL -#define GAIM_PROXY_NONE PURPLE_PROXY_NONE -#define GAIM_PROXY_HTTP PURPLE_PROXY_HTTP -#define GAIM_PROXY_SOCKS4 PURPLE_PROXY_SOCKS4 -#define GAIM_PROXY_SOCKS5 PURPLE_PROXY_SOCKS5 -#define GAIM_PROXY_USE_ENVVAR PURPLE_PROXY_USE_ENVVAR -#define GaimProxyType PurpleProxyType - -#define GaimProxyInfo PurpleProxyInfo - -#define GaimProxyConnectData PurpleProxyConnectData -#define GaimProxyConnectFunction PurpleProxyConnectFunction - -#define gaim_proxy_info_new purple_proxy_info_new -#define gaim_proxy_info_destroy purple_proxy_info_destroy -#define gaim_proxy_info_set_type purple_proxy_info_set_type -#define gaim_proxy_info_set_host purple_proxy_info_set_host -#define gaim_proxy_info_set_port purple_proxy_info_set_port -#define gaim_proxy_info_set_username purple_proxy_info_set_username -#define gaim_proxy_info_set_password purple_proxy_info_set_password -#define gaim_proxy_info_get_type purple_proxy_info_get_type -#define gaim_proxy_info_get_host purple_proxy_info_get_host -#define gaim_proxy_info_get_port purple_proxy_info_get_port -#define gaim_proxy_info_get_username purple_proxy_info_get_username -#define gaim_proxy_info_get_password purple_proxy_info_get_password - -#define gaim_global_proxy_get_info purple_global_proxy_get_info -#define gaim_proxy_get_handle purple_proxy_get_handle -#define gaim_proxy_init purple_proxy_init -#define gaim_proxy_uninit purple_proxy_uninit -#define gaim_proxy_get_setup purple_proxy_get_setup - -#define gaim_proxy_connect purple_proxy_connect -#define gaim_proxy_connect_socks5 purple_proxy_connect_socks5 -#define gaim_proxy_connect_cancel purple_proxy_connect_cancel -#define gaim_proxy_connect_cancel_with_handle purple_proxy_connect_cancel_with_handle - -/* from prpl.h */ - -#define GaimPluginProtocolInfo PurplePluginProtocolInfo - -#define GAIM_ICON_SCALE_DISPLAY PURPLE_ICON_SCALE_DISPLAY -#define GAIM_ICON_SCALE_SEND PURPLE_ICON_SCALE_SEND -#define GaimIconScaleRules PurpleIconScaleRules - -#define GaimBuddyIconSpec PurpleBuddyIconSpec - -#define GaimProtocolOptions PurpleProtocolOptions - -#define GAIM_IS_PROTOCOL_PLUGIN PURPLE_IS_PROTOCOL_PLUGIN - -#define GAIM_PLUGIN_PROTOCOL_INFO PURPLE_PLUGIN_PROTOCOL_INFO - -#define gaim_prpl_got_account_idle purple_prpl_got_account_idle -#define gaim_prpl_got_account_login_time purple_prpl_got_account_login_time -#define gaim_prpl_got_account_status purple_prpl_got_account_status -#define gaim_prpl_got_user_idle purple_prpl_got_user_idle -#define gaim_prpl_got_user_login_time purple_prpl_got_user_login_time -#define gaim_prpl_got_user_status purple_prpl_got_user_status -#define gaim_prpl_change_account_status purple_prpl_change_account_status -#define gaim_prpl_get_statuses purple_prpl_get_statuses - -#define gaim_find_prpl purple_find_prpl - -/* from request.h */ - -#define GAIM_DEFAULT_ACTION_NONE PURPLE_DEFAULT_ACTION_NONE - -#define GAIM_REQUEST_INPUT PURPLE_REQUEST_INPUT -#define GAIM_REQUEST_CHOICE PURPLE_REQUEST_CHOICE -#define GAIM_REQUEST_ACTION PURPLE_REQUEST_ACTION -#define GAIM_REQUEST_FIELDS PURPLE_REQUEST_FIELDS -#define GAIM_REQUEST_FILE PURPLE_REQUEST_FILE -#define GAIM_REQUEST_FOLDER PURPLE_REQUEST_FOLDER -#define GaimRequestType PurpleRequestType - -#define GAIM_REQUEST_FIELD_NONE PURPLE_REQUEST_FIELD_NONE -#define GAIM_REQUEST_FIELD_STRING PURPLE_REQUEST_FIELD_STRING -#define GAIM_REQUEST_FIELD_INTEGER PURPLE_REQUEST_FIELD_INTEGER -#define GAIM_REQUEST_FIELD_BOOLEAN PURPLE_REQUEST_FIELD_BOOLEAN -#define GAIM_REQUEST_FIELD_CHOICE PURPLE_REQUEST_FIELD_CHOICE -#define GAIM_REQUEST_FIELD_LIST PURPLE_REQUEST_FIELD_LIST -#define GAIM_REQUEST_FIELD_LABEL PURPLE_REQUEST_FIELD_LABEL -#define GAIM_REQUEST_FIELD_IMAGE PURPLE_REQUEST_FIELD_IMAGE -#define GAIM_REQUEST_FIELD_ACCOUNT PURPLE_REQUEST_FIELD_ACCOUNT -#define GaimRequestFieldType PurpleRequestFieldType - -#define GaimRequestFields PurpleRequestFields - -#define GaimRequestFieldGroup PurpleRequestFieldGroup - -#define GaimRequestField PurpleRequestField - -#define GaimRequestUiOps PurpleRequestUiOps - -#define GaimRequestInputCb PurpleRequestInputCb -#define GaimRequestActionCb PurpleRequestActionCb -#define GaimRequestChoiceCb PurpleRequestChoiceCb -#define GaimRequestFieldsCb PurpleRequestFieldsCb -#define GaimRequestFileCb PurpleRequestFileCb - -#define gaim_request_fields_new purple_request_fields_new -#define gaim_request_fields_destroy purple_request_fields_destroy -#define gaim_request_fields_add_group purple_request_fields_add_group -#define gaim_request_fields_get_groups purple_request_fields_get_groups -#define gaim_request_fields_exists purple_request_fields_exists -#define gaim_request_fields_get_required purple_request_fields_get_required -#define gaim_request_fields_is_field_required purple_request_fields_is_field_required -#define gaim_request_fields_all_required_filled purple_request_fields_all_required_filled -#define gaim_request_fields_get_field purple_request_fields_get_field -#define gaim_request_fields_get_string purple_request_fields_get_string -#define gaim_request_fields_get_integer purple_request_fields_get_integer -#define gaim_request_fields_get_bool purple_request_fields_get_bool -#define gaim_request_fields_get_choice purple_request_fields_get_choice -#define gaim_request_fields_get_account purple_request_fields_get_account - -#define gaim_request_field_group_new purple_request_field_group_new -#define gaim_request_field_group_destroy purple_request_field_group_destroy -#define gaim_request_field_group_add_field purple_request_field_group_add_field -#define gaim_request_field_group_get_title purple_request_field_group_get_title -#define gaim_request_field_group_get_fields purple_request_field_group_get_fields - -#define gaim_request_field_new purple_request_field_new -#define gaim_request_field_destroy purple_request_field_destroy -#define gaim_request_field_set_label purple_request_field_set_label -#define gaim_request_field_set_visible purple_request_field_set_visible -#define gaim_request_field_set_type_hint purple_request_field_set_type_hint -#define gaim_request_field_set_required purple_request_field_set_required -#define gaim_request_field_get_type purple_request_field_get_type -#define gaim_request_field_get_id purple_request_field_get_id -#define gaim_request_field_get_label purple_request_field_get_label -#define gaim_request_field_is_visible purple_request_field_is_visible -#define gaim_request_field_get_type_hint purple_request_field_get_type_hint -#define gaim_request_field_is_required purple_request_field_is_required - -#define gaim_request_field_string_new purple_request_field_string_new -#define gaim_request_field_string_set_default_value \ - purple_request_field_string_set_default_value -#define gaim_request_field_string_set_value purple_request_field_string_set_value -#define gaim_request_field_string_set_masked purple_request_field_string_set_masked -#define gaim_request_field_string_set_editable purple_request_field_string_set_editable -#define gaim_request_field_string_get_default_value \ - purple_request_field_string_get_default_value -#define gaim_request_field_string_get_value purple_request_field_string_get_value -#define gaim_request_field_string_is_multiline purple_request_field_string_is_multiline -#define gaim_request_field_string_is_masked purple_request_field_string_is_masked -#define gaim_request_field_string_is_editable purple_request_field_string_is_editable - -#define gaim_request_field_int_new purple_request_field_int_new -#define gaim_request_field_int_set_default_value \ - purple_request_field_int_set_default_value -#define gaim_request_field_int_set_value purple_request_field_int_set_value -#define gaim_request_field_int_get_default_value \ - purple_request_field_int_get_default_value -#define gaim_request_field_int_get_value purple_request_field_int_get_value - -#define gaim_request_field_bool_new purple_request_field_bool_new -#define gaim_request_field_bool_set_default_value \ - purple_request_field_book_set_default_value -#define gaim_request_field_bool_set_value purple_request_field_bool_set_value -#define gaim_request_field_bool_get_default_value \ - purple_request_field_bool_get_default_value -#define gaim_request_field_bool_get_value purple_request_field_bool_get_value - -#define gaim_request_field_choice_new purple_request_field_choice_new -#define gaim_request_field_choice_add purple_request_field_choice_add -#define gaim_request_field_choice_set_default_value \ - purple_request_field_choice_set_default_value -#define gaim_request_field_choice_set_value purple_request_field_choice_set_value -#define gaim_request_field_choice_get_default_value \ - purple_request_field_choice_get_default_value -#define gaim_request_field_choice_get_value purple_request_field_choice_get_value -#define gaim_request_field_choice_get_labels purple_request_field_choice_get_labels - -#define gaim_request_field_list_new purple_request_field_list_new -#define gaim_request_field_list_set_multi_select purple_request_field_list_set_multi_select -#define gaim_request_field_list_get_multi_select purple_request_field_list_get_multi_select -#define gaim_request_field_list_get_data purple_request_field_list_get_data -#define gaim_request_field_list_add purple_request_field_list_add -#define gaim_request_field_list_add_selected purple_request_field_list_add_selected -#define gaim_request_field_list_clear_selected purple_request_field_list_clear_selected -#define gaim_request_field_list_set_selected purple_request_field_list_set_selected -#define gaim_request_field_list_is_selected purple_request_field_list_is_selected -#define gaim_request_field_list_get_selected purple_request_field_list_get_selected -#define gaim_request_field_list_get_items purple_request_field_list_get_items - -#define gaim_request_field_label_new purple_request_field_label_new - -#define gaim_request_field_image_new purple_request_field_image_new -#define gaim_request_field_image_set_scale purple_request_field_image_set_scale -#define gaim_request_field_image_get_buffer purple_request_field_image_get_buffer -#define gaim_request_field_image_get_size purple_request_field_image_get_size -#define gaim_request_field_image_get_scale_x purple_request_field_image_get_scale_x -#define gaim_request_field_image_get_scale_y purple_request_field_image_get_scale_y - -#define gaim_request_field_account_new purple_request_field_account_new -#define gaim_request_field_account_set_default_value purple_request_field_account_set_default_value -#define gaim_request_field_account_set_value purple_request_field_account_set_value -#define gaim_request_field_account_set_show_all purple_request_field_account_set_show_all -#define gaim_request_field_account_set_filter purple_request_field_account_set_filter -#define gaim_request_field_account_get_default_value purple_request_field_account_get_default_value -#define gaim_request_field_account_get_value purple_request_field_account_get_value -#define gaim_request_field_account_get_show_all purple_request_field_account_get_show_all -#define gaim_request_field_account_get_filter purple_request_field_account_get_filter - -#define gaim_request_input purple_request_input -#define gaim_request_choice purple_request_choice -#define gaim_request_choice_varg purple_request_choice_varg -#define gaim_request_action purple_request_action -#define gaim_request_action_varg purple_request_action_varg -#define gaim_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb, user_data) purple_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb, NULL, NULL, NULL, user_data) -#define gaim_request_close purple_request_close -#define gaim_request_close_with_handle purple_request_close_with_handle - -#define gaim_request_yes_no purple_request_yes_no -#define gaim_request_ok_cancel purple_request_ok_cancel -#define gaim_request_accept_cancel purple_request_accept_cancel - -#define gaim_request_file purple_request_file -#define gaim_request_folder purple_request_folder - -#define gaim_request_set_ui_ops purple_request_set_ui_ops -#define gaim_request_get_ui_ops purple_request_get_ui_ops - -/* from roomlist.h */ - -#define GaimRoomlist PurpleRoomlist -#define GaimRoomlistRoom PurpleRoomlistRoom -#define GaimRoomlistField PurpleRoomlistField -#define GaimRoomlistUiOps PurpleRoomlistUiOps - -#define GAIM_ROOMLIST_ROOMTYPE_CATEGORY PURPLE_ROOMLIST_ROOMTYPE_CATEGORY -#define GAIM_ROOMLIST_ROOMTYPE_ROOM PURPLE_ROOMLIST_ROOMTYPE_ROOM -#define GaimRoomlistRoomType PurpleRoomlistRoomType - -#define GAIM_ROOMLIST_FIELD_BOOL PURPLE_ROOMLIST_BOOL -#define GAIM_ROOMLIST_FIELD_INT PURPLE_ROOMLIST_INT -#define GAIM_ROOMLIST_FIELD_STRING PURPLE_ROOMLIST_STRING -#define GaimRoomlistFieldType PurpleRoomlistFieldType - -#define gaim_roomlist_show_with_account purple_roomlist_show_with_account -#define gaim_roomlist_new purple_roomlist_new -#define gaim_roomlist_ref purple_roomlist_ref -#define gaim_roomlist_unref purple_roomlist_unref -#define gaim_roomlist_set_fields purple_roomlist_set_fields -#define gaim_roomlist_set_in_progress purple_roomlist_set_in_progress -#define gaim_roomlist_get_in_progress purple_roomlist_get_in_progress -#define gaim_roomlist_room_add purple_roomlist_room_add - -#define gaim_roomlist_get_list purple_roomlist_get_list -#define gaim_roomlist_cancel_get_list purple_roomlist_cancel_get_list -#define gaim_roomlist_expand_category purple_roomlist_expand_category - -#define gaim_roomlist_room_new purple_roomlist_room_new -#define gaim_roomlist_room_add_field purple_roomlist_room_add_field -#define gaim_roomlist_room_join purple_roomlist_room_join -#define gaim_roomlist_field_new purple_roomlist_field_new - -#define gaim_roomlist_set_ui_ops purple_roomlist_set_ui_ops -#define gaim_roomlist_get_ui_ops purple_roomlist_get_ui_ops - -/* from savedstatuses.h */ - -#define GaimSavedStatus PurpleSavedStatus -#define GaimSavedStatusSub PurpleSavedStatusSub - -#define gaim_savedstatus_new purple_savedstatus_new -#define gaim_savedstatus_set_title purple_savedstatus_set_title -#define gaim_savedstatus_set_type purple_savedstatus_set_type -#define gaim_savedstatus_set_message purple_savedstatus_set_message -#define gaim_savedstatus_set_substatus purple_savedstatus_set_substatus -#define gaim_savedstatus_unset_substatus purple_savedstatus_unset_substatus -#define gaim_savedstatus_delete purple_savedstatus_delete - -#define gaim_savedstatuses_get_all purple_savedstatuses_get_all -#define gaim_savedstatuses_get_popular purple_savedstatuses_get_popular -#define gaim_savedstatus_get_current purple_savedstatus_get_current -#define gaim_savedstatus_get_default purple_savedstatus_get_default -#define gaim_savedstatus_get_idleaway purple_savedstatus_get_idleaway -#define gaim_savedstatus_is_idleaway purple_savedstatus_is_idleaway -#define gaim_savedstatus_set_idleaway purple_savedstatus_set_idleaway -#define gaim_savedstatus_get_startup purple_savedstatus_get_startup -#define gaim_savedstatus_find purple_savedstatus_find -#define gaim_savedstatus_find_by_creation_time purple_savedstatus_find_by_creation_time -#define gaim_savedstatus_find_transient_by_type_and_message \ - purple_savedstatus_find_transient_by_type_and_message - -#define gaim_savedstatus_is_transient purple_savedstatus_is_transient -#define gaim_savedstatus_get_title purple_savedstatus_get_title -#define gaim_savedstatus_get_type purple_savedstatus_get_type -#define gaim_savedstatus_get_message purple_savedstatus_get_message -#define gaim_savedstatus_get_creation_time purple_savedstatus_get_creation_time -#define gaim_savedstatus_has_substatuses purple_savedstatus_has_substatuses -#define gaim_savedstatus_get_substatus purple_savedstatus_get_substatus -#define gaim_savedstatus_substatus_get_type purple_savedstatus_substatus_get_type -#define gaim_savedstatus_substatus_get_message purple_savedstatus_substatus_get_message -#define gaim_savedstatus_activate purple_savedstatus_activate -#define gaim_savedstatus_activate_for_account purple_savedstatus_activate_for_account - -#define gaim_savedstatuses_get_handle purple_savedstatuses_get_handle -#define gaim_savedstatuses_init purple_savedstatuses_init -#define gaim_savedstatuses_uninit purple_savedstatuses_uninit - -/* from signals.h */ - -#define GAIM_CALLBACK PURPLE_CALLBACK - -#define GaimCallback PurpleCallback -#define GaimSignalMarshalFunc PurpleSignalMarshalFunc - -#define GAIM_SIGNAL_PRIORITY_DEFAULT PURPLE_SIGNAL_PRIORITY_DEFAULT -#define GAIM_SIGNAL_PRIORITY_HIGHEST PURPLE_SIGNAL_PRIORITY_HIGHEST -#define GAIM_SIGNAL_PRIORITY_LOWEST PURPLE_SIGNAL_PRIORITY_LOWEST - -#define gaim_signal_register purple_signal_register -#define gaim_signal_unregister purple_signal_unregister - -#define gaim_signals_unregister_by_instance purple_signals_unregister_by_instance - -#define gaim_signal_get_values purple_signal_get_values -#define gaim_signal_connect_priority purple_signal_connect_priority -#define gaim_signal_connect purple_signal_connect -#define gaim_signal_connect_priority_vargs purple_signal_connect_priority_vargs -#define gaim_signal_connect_vargs purple_signal_connect_vargs -#define gaim_signal_disconnect purple_signal_disconnect - -#define gaim_signals_disconnect_by_handle purple_signals_disconnect_by_handle - -#define gaim_signal_emit purple_signal_emit -#define gaim_signal_emit_vargs purple_signal_emit_vargs -#define gaim_signal_emit_return_1 purple_signal_emit_vargs -#define gaim_signal_emit_vargs_return_1 purple_signal_emit_vargs_return_1 - -#define gaim_signals_init purple_signals_init -#define gaim_signals_uninit purple_signals_uninit - -#define gaim_marshal_VOID \ - purple_marshal_VOID -#define gaim_marshal_VOID__INT \ - purple_marshal_VOID__INT -#define gaim_marshal_VOID__INT_INT \ - purple_marshal_VOID_INT_INT -#define gaim_marshal_VOID__POINTER \ - purple_marshal_VOID__POINTER -#define gaim_marshal_VOID__POINTER_UINT \ - purple_marshal_VOID__POINTER_UINT -#define gaim_marshal_VOID__POINTER_INT_INT \ - purple_marshal_VOID__POINTER_INT_INT -#define gaim_marshal_VOID__POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_UINT_UINT \ - purple_marshal_VOID__POINTER_POINTER_UINT_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT -#define gaim_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT \ - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT - -#define gaim_marshal_INT__INT \ - purple_marshal_INT__INT -#define gaim_marshal_INT__INT_INT \ - purple_marshal_INT__INT_INT -#define gaim_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER - -#define gaim_marshal_BOOLEAN__POINTER \ - purple_marshal_BOOLEAN__POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_UINT \ - purple_marshal_BOOLEAN__POINTER_POINTER_UINT -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER -#define gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER \ - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER - -#define gaim_marshal_BOOLEAN__INT_POINTER \ - purple_marshal_BOOLEAN__INT_POINTER - -#define gaim_marshal_POINTER__POINTER_INT \ - purple_marshal_POINTER__POINTER_INT -#define gaim_marshal_POINTER__POINTER_INT64 \ - purple_marshal_POINTER__POINTER_INT64 -#define gaim_marshal_POINTER__POINTER_INT_BOOLEAN \ - purple_marshal_POINTER__POINTER_INT_BOOLEAN -#define gaim_marshal_POINTER__POINTER_INT64_BOOLEAN \ - purple_marshal_POINTER__POINTER_INT64_BOOLEAN -#define gaim_marshal_POINTER__POINTER_POINTER \ - purple_marshal_POINTER__POINTER_POINTER - -/* from sound.h */ - -#define GAIM_SOUND_BUDDY_ARRIVE PURPLE_SOUND_BUDDY_ARRIVE -#define GAIM_SOUND_BUDDY_LEAVE PURPLE_SOUND_BUDDY_LEAVE -#define GAIM_SOUND_RECEIVE PURPLE_SOUND_RECEIVE -#define GAIM_SOUND_FIRST_RECEIVE PURPLE_SOUND_FIRST_RECEIVE -#define GAIM_SOUND_SEND PURPLE_SOUND_SEND -#define GAIM_SOUND_CHAT_JOIN PURPLE_SOUND_CHAT_JOIN -#define GAIM_SOUND_CHAT_LEAVE PURPLE_SOUND_CHAT_LEAVE -#define GAIM_SOUND_CHAT_YOU_SAY PURPLE_SOUND_CHAT_YOU_SAY -#define GAIM_SOUND_CHAT_SAY PURPLE_SOUND_CHAT_SAY -#define GAIM_SOUND_POUNCE_DEFAULT PURPLE_SOUND_POUNCE_DEFAULT -#define GAIM_SOUND_CHAT_NICK PURPLE_SOUND_CHAT_NICK -#define GAIM_NUM_SOUNDS PURPLE_NUM_SOUNDS -#define GaimSoundEventID PurpleSoundEventID - -#define GaimSoundUiOps PurpleSoundUiOps - -#define gaim_sound_play_file purple_sound_play_file -#define gaim_sound_play_event purple_sound_play_event -#define gaim_sound_set_ui_ops purple_sound_set_ui_ops -#define gaim_sound_get_ui_ops purple_sound_get_ui_ops -#define gaim_sound_init purple_sound_init -#define gaim_sound_uninit purple_sound_uninit - -#define gaim_sounds_get_handle purple_sounds_get_handle - -/* from sslconn.h */ - -#define GAIM_SSL_DEFAULT_PORT PURPLE_SSL_DEFAULT_PORT - -#define GAIM_SSL_HANDSHAKE_FAILED PURPLE_SSL_HANDSHAKE_FAILED -#define GAIM_SSL_CONNECT_FAILED PURPLE_SSL_CONNECT_FAILED -#define GaimSslErrorType PurpleSslErrorType - -#define GaimSslConnection PurpleSslConnection - -#define GaimSslInputFunction PurpleSslInputFunction -#define GaimSslErrorFunction PurpleSslErrorFunction - -#define GaimSslOps PurpleSslOps - -#define gaim_ssl_is_supported purple_ssl_is_supported -#define gaim_ssl_connect purple_ssl_connect -#define gaim_ssl_connect_fd purple_ssl_connect_fd -#define gaim_ssl_input_add purple_ssl_input_add -#define gaim_ssl_close purple_ssl_close -#define gaim_ssl_read purple_ssl_read -#define gaim_ssl_write purple_ssl_write - -#define gaim_ssl_set_ops purple_ssl_set_ops -#define gaim_ssl_get_ops purple_ssl_get_ops -#define gaim_ssl_init purple_ssl_init -#define gaim_ssl_uninit purple_ssl_uninit - -/* from status.h */ - -#define GaimStatusType PurpleStatusType -#define GaimStatusAttr PurpleStatusAttr -#define GaimPresence PurplePresence -#define GaimStatus PurpleStatus - -#define GAIM_PRESENCE_CONTEXT_UNSET PURPLE_PRESENCE_CONTEXT_UNSET -#define GAIM_PRESENCE_CONTEXT_ACCOUNT PURPLE_PRESENCE_CONTEXT_ACCOUNT -#define GAIM_PRESENCE_CONTEXT_CONV PURPLE_PRESENCE_CONTEXT_CONV -#define GAIM_PRESENCE_CONTEXT_BUDDY PURPLE_PRESENCE_CONTEXT_BUDDY -#define GaimPresenceContext PurplePresenceContext - -#define GAIM_STATUS_UNSET PURPLE_STATUS_UNSET -#define GAIM_STATUS_OFFLINE PURPLE_STATUS_OFFLINE -#define GAIM_STATUS_AVAILABLE PURPLE_STATUS_AVAILABLE -#define GAIM_STATUS_UNAVAILABLE PURPLE_STATUS_UNAVAILABLE -#define GAIM_STATUS_INVISIBLE PURPLE_STATUS_INVISIBLE -#define GAIM_STATUS_AWAY PURPLE_STATUS_AWAY -#define GAIM_STATUS_EXTENDED_AWAY PURPLE_STATUS_EXTENDED_AWAY -#define GAIM_STATUS_MOBILE PURPLE_STATUS_MOBILE -#define GAIM_STATUS_NUM_PRIMITIVES PURPLE_STATUS_NUM_PRIMITIVES -#define GaimStatusPrimitive PurpleStatusPrimitive - -#define gaim_primitive_get_id_from_type purple_primitive_get_id_from_type -#define gaim_primitive_get_name_from_type purple_primitive_get_name_from_type -#define gaim_primitive_get_type_from_id purple_primitive_get_type_from_id - -#define gaim_status_type_new_full purple_status_type_new_full -#define gaim_status_type_new purple_status_type_new -#define gaim_status_type_new_with_attrs purple_status_type_new_with_attrs -#define gaim_status_type_destroy purple_status_type_destroy -#define gaim_status_type_set_primary_attr purple_status_type_set_primary_attr -#define gaim_status_type_add_attr purple_status_type_add_attr -#define gaim_status_type_add_attrs purple_status_type_add_attrs -#define gaim_status_type_add_attrs_vargs purple_status_type_add_attrs_vargs -#define gaim_status_type_get_primitive purple_status_type_get_primitive -#define gaim_status_type_get_id purple_status_type_get_id -#define gaim_status_type_get_name purple_status_type_get_name -#define gaim_status_type_is_saveable purple_status_type_is_saveable -#define gaim_status_type_is_user_settable purple_status_type_is_user_settable -#define gaim_status_type_is_independent purple_status_type_is_independent -#define gaim_status_type_is_exclusive purple_status_type_is_exclusive -#define gaim_status_type_is_available purple_status_type_is_available -#define gaim_status_type_get_primary_attr purple_status_type_get_primary_attr -#define gaim_status_type_get_attr purple_status_type_get_attr -#define gaim_status_type_get_attrs purple_status_type_get_attrs -#define gaim_status_type_find_with_id purple_status_type_find_with_id - -#define gaim_status_attr_new purple_status_attr_new -#define gaim_status_attr_destroy purple_status_attr_destroy -#define gaim_status_attr_get_id purple_status_attr_get_id -#define gaim_status_attr_get_name purple_status_attr_get_name -#define gaim_status_attr_get_value purple_status_attr_get_value - -#define gaim_status_new purple_status_new -#define gaim_status_destroy purple_status_destroy -#define gaim_status_set_active purple_status_set_active -#define gaim_status_set_active_with_attrs purple_status_set_active_with_attrs -#define gaim_status_set_active_with_attrs_list purple_status_set_active_with_attrs_list -#define gaim_status_set_attr_boolean purple_status_set_attr_boolean -#define gaim_status_set_attr_int purple_status_set_attr_int -#define gaim_status_set_attr_string purple_status_set_attr_string -#define gaim_status_get_type purple_status_get_type -#define gaim_status_get_presence purple_status_get_presence -#define gaim_status_get_id purple_status_get_id -#define gaim_status_get_name purple_status_get_name -#define gaim_status_is_independent purple_status_is_independent -#define gaim_status_is_exclusive purple_status_is_exclusive -#define gaim_status_is_available purple_status_is_available -#define gaim_status_is_active purple_status_is_active -#define gaim_status_is_online purple_status_is_online -#define gaim_status_get_attr_value purple_status_get_attr_value -#define gaim_status_get_attr_boolean purple_status_get_attr_boolean -#define gaim_status_get_attr_int purple_status_get_attr_int -#define gaim_status_get_attr_string purple_status_get_attr_string -#define gaim_status_compare purple_status_compare - -#define gaim_presence_new purple_presence_new -#define gaim_presence_new_for_account purple_presence_new_for_account -#define gaim_presence_new_for_conv purple_presence_new_for_conv -#define gaim_presence_new_for_buddy purple_presence_new_for_buddy -#define gaim_presence_destroy purple_presence_destroy -#define gaim_presence_add_status purple_presence_add_status -#define gaim_presence_add_list purple_presence_add_list -#define gaim_presence_set_status_active purple_presence_set_status_active -#define gaim_presence_switch_status purple_presence_switch_status -#define gaim_presence_set_idle purple_presence_set_idle -#define gaim_presence_set_login_time purple_presence_set_login_time -#define gaim_presence_get_context purple_presence_get_context -#define gaim_presence_get_account purple_presence_get_account -#define gaim_presence_get_conversation purple_presence_get_conversation -#define gaim_presence_get_chat_user purple_presence_get_chat_user -#define gaim_presence_get_statuses purple_presence_get_statuses -#define gaim_presence_get_status purple_presence_get_status -#define gaim_presence_get_active_status purple_presence_get_active_status -#define gaim_presence_is_available purple_presence_is_available -#define gaim_presence_is_online purple_presence_is_online -#define gaim_presence_is_status_active purple_presence_is_status_active -#define gaim_presence_is_status_primitive_active \ - purple_presence_is_status_primitive_active -#define gaim_presence_is_idle purple_presence_is_idle -#define gaim_presence_get_idle_time purple_presence_get_idle_time -#define gaim_presence_get_login_time purple_presence_get_login_time -#define gaim_presence_compare purple_presence_compare - -#define gaim_status_get_handle purple_status_get_handle -#define gaim_status_init purple_status_init -#define gaim_status_uninit purple_status_uninit - -/* from stringref.h */ - -#define GaimStringref PurpleStringref - -#define gaim_stringref_new purple_stringref_new -#define gaim_stringref_new_noref purple_stringref_new_noref -#define gaim_stringref_printf purple_stringref_printf -#define gaim_stringref_ref purple_stringref_ref -#define gaim_stringref_unref purple_stringref_unref -#define gaim_stringref_value purple_stringref_value -#define gaim_stringref_cmp purple_stringref_cmp -#define gaim_stringref_len purple_stringref_len - -/* from stun.h */ - -#define GaimStunNatDiscovery PurpleStunNatDiscovery - -#define GAIM_STUN_STATUS_UNDISCOVERED PURPLE_STUN_STATUS_UNDISCOVERED -#define GAIM_STUN_STATUS_UNKNOWN PURPLE_STUN_STATUS_UNKNOWN -#define GAIM_STUN_STATUS_DISCOVERING PURPLE_STUN_STATUS_DISCOVERING -#define GAIM_STUN_STATUS_DISCOVERED PURPLE_STUN_STATUS_DISCOVERED -#define GaimStunStatus PurpleStunStatus - -#define GAIM_STUN_NAT_TYPE_PUBLIC_IP PURPLE_STUN_NAT_TYPE_PUBLIC_IP -#define GAIM_STUN_NAT_TYPE_UNKNOWN_NAT PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT -#define GAIM_STUN_NAT_TYPE_FULL_CONE PURPLE_STUN_NAT_TYPE_FULL_CONE -#define GAIM_STUN_NAT_TYPE_RESTRICTED_CONE PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE -#define GAIM_STUN_NAT_TYPE_PORT_RESTRICTED_CONE PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE -#define GAIM_STUN_NAT_TYPE_SYMMETRIC PURPLE_STUN_NAT_TYPE_SYMMETRIC -#define GaimStunNatType PurpleStunNatType - -/* why didn't this have a Gaim prefix before? */ -#define StunCallback PurpleStunCallback - -#define gaim_stun_discover purple_stun_discover -#define gaim_stun_init purple_stun_init - -/* from upnp.h */ - -/* suggested rename: PurpleUPnpMappingHandle */ -#define UPnPMappingAddRemove PurpleUPnPMappingAddRemove - -#define GaimUPnPCallback PurpleUPnPCallback - -#define gaim_upnp_discover purple_upnp_discover -#define gaim_upnp_get_public_ip purple_upnp_get_public_ip -#define gaim_upnp_cancel_port_mapping purple_upnp_cancel_port_mapping -#define gaim_upnp_set_port_mapping purple_upnp_set_port_mapping - -#define gaim_upnp_remove_port_mapping purple_upnp_remove_port_mapping - -/* from util.h */ - -#define GaimUtilFetchUrlData PurpleUtilFetchUrlData -#define GaimMenuAction PurpleMenuAction - -#define GaimInfoFieldFormatCallback PurpleIntoFieldFormatCallback - -#define GaimKeyValuePair PurpleKeyValuePair - -#define gaim_menu_action_new purple_menu_action_new -#define gaim_menu_action_free purple_menu_action_free - -#define gaim_base16_encode purple_base16_encode -#define gaim_base16_decode purple_base16_decode -#define gaim_base64_encode purple_base64_encode -#define gaim_base64_decode purple_base64_decode -#define gaim_quotedp_decode purple_quotedp_decode - -#define gaim_mime_decode_field purple_mime_deco_field - -#define gaim_utf8_strftime purple_utf8_strftime -#define gaim_date_format_short purple_date_format_short -#define gaim_date_format_long purple_date_format_long -#define gaim_date_format_full purple_date_format_full -#define gaim_time_format purple_time_format -#define gaim_time_build purple_time_build - -#define GAIM_NO_TZ_OFF PURPLE_NO_TZ_OFF - -#define gaim_str_to_time purple_str_to_time - -#define gaim_markup_find_tag purple_markup_find_tag -#define gaim_markup_extract_info_field purple_markup_extract_info_field -#define gaim_markup_html_to_xhtml purple_markup_html_to_xhtml -#define gaim_markup_strip_html purple_markup_strip_html -#define gaim_markup_linkify purple_markup_linkify -#define gaim_markup_slice purple_markup_slice -#define gaim_markup_get_tag_name purple_markup_get_tag_name -#define gaim_unescape_html purple_unescape_html - -#define gaim_home_dir purple_home_dir -#define gaim_user_dir purple_user_dir - -#define gaim_util_set_user_dir purple_util_set_user_dir - -#define gaim_build_dir purple_build_dir - -#define gaim_util_write_data_to_file purple_util_write_data_to_file - -#define gaim_util_read_xml_from_file purple_util_read_xml_from_file - -#define gaim_mkstemp purple_mkstemp - -#define gaim_program_is_valid purple_program_is_valid - -#define gaim_running_gnome purple_running_gnome -#define gaim_running_kde purple_running_kde -#define gaim_running_osx purple_running_osx - -#define gaim_fd_get_ip purple_fd_get_ip - -#define gaim_normalize purple_normalize -#define gaim_normalize_nocase purple_normalize_nocase - -#define gaim_strdup_withhtml purple_strdup_withhtml - -#define gaim_str_has_prefix purple_str_has_prefix -#define gaim_str_has_suffix purple_str_has_suffix -#define gaim_str_add_cr purple_str_add_cr -#define gaim_str_strip_char purple_str_strip_char - -#define gaim_util_chrreplace purple_util_chrreplace - -#define gaim_strreplace purple_strreplace - -#define gaim_utf8_ncr_encode purple_utf8_ncr_encode -#define gaim_utf8_ncr_decode purple_utf8_ncr_decode - -#define gaim_strcasereplace purple_strcasereplace -#define gaim_strcasestr purple_strcasestr - -#define gaim_str_size_to_units purple_str_size_to_units -#define gaim_str_seconds_to_string purple_str_seconds_to_string -#define gaim_str_binary_to_ascii purple_str_binary_to_ascii - - -#define gaim_got_protocol_handler_uri purple_got_protocol_handler_uri - -#define gaim_url_parse purple_url_parse - -#define GaimUtilFetchUrlCallback PurpleUtilFetchUrlCallback -#define gaim_util_fetch_url purple_util_fetch_url -#define gaim_util_fetch_url_request purple_util_fetch_url_request -#define gaim_util_fetch_url_cancel purple_util_fetch_url_cancel - -#define gaim_url_decode purple_url_decode -#define gaim_url_encode purple_url_encode - -#define gaim_email_is_valid purple_email_is_valid - -#define gaim_uri_list_extract_uris purple_uri_list_extract_uris -#define gaim_uri_list_extract_filenames purple_uri_list_extract_filenames - -#define gaim_utf8_try_convert purple_utf8_try_convert -#define gaim_utf8_salvage purple_utf8_salvage -#define gaim_utf8_strcasecmp purple_utf8_strcasecmp -#define gaim_utf8_has_word purple_utf8_has_word - -#define gaim_print_utf8_to_console purple_print_utf8_to_console - -#define gaim_message_meify purple_message_meify - -#define gaim_text_strip_mnemonic purple_text_strip_mnemonic - -#define gaim_unescape_filename purple_unescape_filename -#define gaim_escape_filename purple_escape_filename - -/* from value.h */ - -#define GAIM_TYPE_UNKNOWN PURPLE_TYPE_UNKNOWN -#define GAIM_TYPE_SUBTYPE PURPLE_TYPE_SUBTYPE -#define GAIM_TYPE_CHAR PURPLE_TYPE_CHAR -#define GAIM_TYPE_UCHAR PURPLE_TYPE_UCHAR -#define GAIM_TYPE_BOOLEAN PURPLE_TYPE_BOOLEAN -#define GAIM_TYPE_SHORT PURPLE_TYPE_SHORT -#define GAIM_TYPE_USHORT PURPLE_TYPE_USHORT -#define GAIM_TYPE_INT PURPLE_TYPE_INT -#define GAIM_TYPE_UINT PURPLE_TYPE_UINT -#define GAIM_TYPE_LONG PURPLE_TYPE_LONG -#define GAIM_TYPE_ULONG PURPLE_TYPE_ULONG -#define GAIM_TYPE_INT64 PURPLE_TYPE_INT64 -#define GAIM_TYPE_UINT64 PURPLE_TYPE_UINT64 -#define GAIM_TYPE_STRING PURPLE_TYPE_STRING -#define GAIM_TYPE_OBJECT PURPLE_TYPE_OBJECT -#define GAIM_TYPE_POINTER PURPLE_TYPE_POINTER -#define GAIM_TYPE_ENUM PURPLE_TYPE_ENUM -#define GAIM_TYPE_BOXED PURPLE_TYPE_BOXED -#define GaimType PurpleType - - -#define GAIM_SUBTYPE_UNKNOWN PURPLE_SUBTYPE_UNKNOWN -#define GAIM_SUBTYPE_ACCOUNT PURPLE_SUBTYPE_ACCOUNT -#define GAIM_SUBTYPE_BLIST PURPLE_SUBTYPE_BLIST -#define GAIM_SUBTYPE_BLIST_BUDDY PURPLE_SUBTYPE_BLIST_BUDDY -#define GAIM_SUBTYPE_BLIST_GROUP PURPLE_SUBTYPE_BLIST_GROUP -#define GAIM_SUBTYPE_BLIST_CHAT PURPLE_SUBTYPE_BLIST_CHAT -#define GAIM_SUBTYPE_BUDDY_ICON PURPLE_SUBTYPE_BUDDY_ICON -#define GAIM_SUBTYPE_CONNECTION PURPLE_SUBTYPE_CONNECTION -#define GAIM_SUBTYPE_CONVERSATION PURPLE_SUBTYPE_CONVERSATION -#define GAIM_SUBTYPE_PLUGIN PURPLE_SUBTYPE_PLUGIN -#define GAIM_SUBTYPE_BLIST_NODE PURPLE_SUBTYPE_BLIST_NODE -#define GAIM_SUBTYPE_CIPHER PURPLE_SUBTYPE_CIPHER -#define GAIM_SUBTYPE_STATUS PURPLE_SUBTYPE_STATUS -#define GAIM_SUBTYPE_LOG PURPLE_SUBTYPE_LOG -#define GAIM_SUBTYPE_XFER PURPLE_SUBTYPE_XFER -#define GAIM_SUBTYPE_SAVEDSTATUS PURPLE_SUBTYPE_SAVEDSTATUS -#define GAIM_SUBTYPE_XMLNODE PURPLE_SUBTYPE_XMLNODE -#define GAIM_SUBTYPE_USERINFO PURPLE_SUBTYPE_USERINFO -#define GaimSubType PurpleSubType - -#define GaimValue PurpleValue - -#define gaim_value_new purple_value_new -#define gaim_value_new_outgoing purple_value_new_outgoing -#define gaim_value_destroy purple_value_destroy -#define gaim_value_dup purple_value_dup -#define gaim_value_purple_buddy_icon_get_extensionget_type purple_value_get_type -#define gaim_value_get_subtype purple_value_get_subtype -#define gaim_value_get_specific_type purple_value_get_specific_type -#define gaim_value_is_outgoing purple_value_is_outgoing -#define gaim_value_set_char purple_value_set_char -#define gaim_value_set_uchar purple_value_set_uchar -#define gaim_value_set_boolean purple_value_set_boolean -#define gaim_value_set_short purple_value_set_short -#define gaim_value_set_ushort purple_value_set_ushort -#define gaim_value_set_int purple_value_set_int -#define gaim_value_set_uint purple_value_set_uint -#define gaim_value_set_long purple_value_set_long -#define gaim_value_set_ulong purple_value_set_ulong -#define gaim_value_set_int64 purple_value_set_int64 -#define gaim_value_set_uint64 purple_value_set_uint64 -#define gaim_value_set_string purple_value_set_string -#define gaim_value_set_object purple_value_set_object -#define gaim_value_set_pointer purple_value_set_pointer -#define gaim_value_set_enum purple_value_set_enum -#define gaim_value_set_boxed purple_value_set_boxed -#define gaim_value_get_char purple_value_get_char -#define gaim_value_get_uchar purple_value_get_uchar -#define gaim_value_get_boolean purple_value_get_boolean -#define gaim_value_get_short purple_value_get_short -#define gaim_value_get_ushort purple_value_get_ushort -#define gaim_value_get_int purple_value_get_int -#define gaim_value_get_uint purple_value_get_uint -#define gaim_value_get_long purple_value_get_long -#define gaim_value_get_ulong purple_value_get_ulong -#define gaim_value_get_int64 purple_value_get_int64 -#define gaim_value_get_uint64 purple_value_get_uint64 -#define gaim_value_get_string purple_value_get_string -#define gaim_value_get_object purple_value_get_object -#define gaim_value_get_pointer purple_value_get_pointer -#define gaim_value_get_enum purple_value_get_enum -#define gaim_value_get_boxed purple_value_get_boxed - -/* from version.h */ - -#define GAIM_MAJOR_VERSION PURPLE_MAJOR_VERSION -#define GAIM_MINOR_VERSION PURPLE_MINOR_VERSION -#define GAIM_MICRO_VERSION PURPLE_MICRO_VERSION - -#define GAIM_VERSION_CHECK PURPLE_VERSION_CHECK - -/* from whiteboard.h */ - -#define GaimWhiteboardPrplOps PurpleWhiteboardPrplOps -#define GaimWhiteboard PurpleWhiteboard -#define GaimWhiteboardUiOps PurpleWhiteboardUiOps - -#define gaim_whiteboard_set_ui_ops purple_whiteboard_set_ui_ops -#define gaim_whiteboard_set_prpl_ops purple_whiteboard_set_prpl_ops - -#define gaim_whiteboard_create purple_whiteboard_create -#define gaim_whiteboard_destroy purple_whiteboard_destroy -#define gaim_whiteboard_start purple_whiteboard_start -#define gaim_whiteboard_get_session purple_whiteboard_get_session -#define gaim_whiteboard_draw_list_destroy purple_whiteboard_draw_list_destroy -#define gaim_whiteboard_get_dimensions purple_whiteboard_get_dimensions -#define gaim_whiteboard_set_dimensions purple_whiteboard_set_dimensions -#define gaim_whiteboard_draw_point purple_whiteboard_draw_point -#define gaim_whiteboard_send_draw_list purple_whiteboard_send_draw_list -#define gaim_whiteboard_draw_line purple_whiteboard_draw_line -#define gaim_whiteboard_clear purple_whiteboard_clear -#define gaim_whiteboard_send_clear purple_whiteboard_send_clear -#define gaim_whiteboard_send_brush purple_whiteboard_send_brush -#define gaim_whiteboard_get_brush purple_whiteboard_get_brush -#define gaim_whiteboard_set_brush purple_whiteboard_set_brush - -/* for static plugins */ -#define gaim_init_ssl_plugin purple_init_ssl_plugin -#define gaim_init_ssl_openssl_plugin purple_init_ssl_openssl_plugin -#define gaim_init_ssl_gnutls_plugin purple_init_ssl_gnutls_plugin -#define gaim_init_gg_plugin purple_init_gg_plugin -#define gaim_init_jabber_plugin purple_init_jabber_plugin -#define gaim_init_sametime_plugin purple_init_sametime_plugin -#define gaim_init_msn_plugin purple_init_msn_plugin -#define gaim_init_novell_plugin purple_init_novell_plugin -#define gaim_init_qq_plugin purple_init_qq_plugin -#define gaim_init_simple_plugin purple_init_simple_plugin -#define gaim_init_yahoo_plugin purple_init_yahoo_plugin -#define gaim_init_zephyr_plugin purple_init_zephyr_plugin -#define gaim_init_aim_plugin purple_init_aim_plugin -#define gaim_init_icq_plugin purple_init_icq_plugin - -#endif /* _GAIM_COMPAT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -schemadir = @GCONF_SCHEMA_FILE_DIR@ - -EXTRA_DIST = purple.schemas.in - -schema_in_files = purple.schemas.in -schema_DATA = $(schema_in_files:.schemas.in=.schemas) -@INTLTOOL_SCHEMAS_RULE@ - -if GCONF_SCHEMAS_INSTALL -install-data-local: - GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schema_DATA) 2>&1 | \ - grep -v "^WARNING: failed to install schema" | grep -v "^Attached schema" 1>&2 -else -install-data-local: -endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,595 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/gconf -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(schemadir)" -schemaDATA_INSTALL = $(INSTALL_DATA) -DATA = $(schema_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -schemadir = @GCONF_SCHEMA_FILE_DIR@ -EXTRA_DIST = purple.schemas.in -schema_in_files = purple.schemas.in -schema_DATA = $(schema_in_files:.schemas.in=.schemas) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/gconf/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/gconf/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-schemaDATA: $(schema_DATA) - @$(NORMAL_INSTALL) - test -z "$(schemadir)" || $(mkdir_p) "$(DESTDIR)$(schemadir)" - @list='$(schema_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(schemaDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(schemadir)/$$f'"; \ - $(schemaDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(schemadir)/$$f"; \ - done - -uninstall-schemaDATA: - @$(NORMAL_UNINSTALL) - @list='$(schema_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(schemadir)/$$f'"; \ - rm -f "$(DESTDIR)$(schemadir)/$$f"; \ - done -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(schemadir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-data-local install-schemaDATA - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-schemaDATA - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-data-local install-exec \ - install-exec-am install-info install-info-am install-man \ - install-schemaDATA install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am uninstall-info-am \ - uninstall-schemaDATA - -@INTLTOOL_SCHEMAS_RULE@ - -@GCONF_SCHEMAS_INSTALL_TRUE@install-data-local: -@GCONF_SCHEMAS_INSTALL_TRUE@ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schema_DATA) 2>&1 | \ -@GCONF_SCHEMAS_INSTALL_TRUE@ grep -v "^WARNING: failed to install schema" | grep -v "^Attached schema" 1>&2 -@GCONF_SCHEMAS_INSTALL_FALSE@install-data-local: -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/purple.schemas.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/purple.schemas.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/purple.schemas.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/gconf/purple.schemas.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,276 +0,0 @@ - - - - - /schemas/desktop/gnome/url-handlers/aim/enabled - /desktop/gnome/url-handlers/aim/enabled - purple - bool - true - - Whether the specified command should handle "aim" URLs - True if the command specified in the "command" key should handle "aim" URLs. - - - - /schemas/desktop/gnome/url-handlers/aim/command - /desktop/gnome/url-handlers/aim/command - purple - string - purple-url-handler "%s" - - The handler for "aim" URLs - The command used to handle "aim" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/aim/needs_terminal - /desktop/gnome/url-handlers/aim/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/gg/enabled - /desktop/gnome/url-handlers/gg/enabled - purple - bool - true - - Whether the specified command should handle "gg" URLs - True if the command specified in the "command" key should handle "gg" URLs. - - - - /schemas/desktop/gnome/url-handlers/gg/command - /desktop/gnome/url-handlers/gg/command - purple - string - purple-url-handler "%s" - - The handler for "gg" URLs - The command used to handle "gg" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/gg/needs_terminal - /desktop/gnome/url-handlers/gg/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/icq/enabled - /desktop/gnome/url-handlers/icq/enabled - purple - bool - true - - Whether the specified command should handle "icq" URLs - True if the command specified in the "command" key should handle "icq" URLs. - - - - /schemas/desktop/gnome/url-handlers/icq/command - /desktop/gnome/url-handlers/icq/command - purple - string - purple-url-handler "%s" - - The handler for "icq" URLs - The command used to handle "icq" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/icq/needs_terminal - /desktop/gnome/url-handlers/icq/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/irc/enabled - /desktop/gnome/url-handlers/irc/enabled - purple - bool - true - - Whether the specified command should handle "irc" URLs - True if the command specified in the "command" key should handle "irc" URLs. - - - - /schemas/desktop/gnome/url-handlers/irc/command - /desktop/gnome/url-handlers/irc/command - purple - string - purple-url-handler "%s" - - The handler for "irc" URLs - The command used to handle "irc" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/irc/needs_terminal - /desktop/gnome/url-handlers/irc/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/msnim/enabled - /desktop/gnome/url-handlers/msnim/enabled - purple - bool - true - - Whether the specified command should handle "msnim" URLs - True if the command specified in the "command" key should handle "msnim" URLs. - - - - /schemas/desktop/gnome/url-handlers/msnim/command - /desktop/gnome/url-handlers/msnim/command - purple - string - purple-url-handler "%s" - - The handler for "msnim" URLs - The command used to handle "msnim" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/msnim/needs_terminal - /desktop/gnome/url-handlers/msnim/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/sip/enabled - /desktop/gnome/url-handlers/sip/enabled - purple - bool - true - - Whether the specified command should handle "sip" URLs - True if the command specified in the "command" key should handle "sip" URLs. - - - - /schemas/desktop/gnome/url-handlers/sip/command - /desktop/gnome/url-handlers/sip/command - purple - string - purple-url-handler "%s" - - The handler for "sip" URLs - The command used to handle "sip" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/sip/needs_terminal - /desktop/gnome/url-handlers/sip/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/xmpp/enabled - /desktop/gnome/url-handlers/xmpp/enabled - purple - bool - true - - Whether the specified command should handle "xmpp" URLs - True if the command specified in the "command" key should handle "xmpp" URLs. - - - - /schemas/desktop/gnome/url-handlers/xmpp/command - /desktop/gnome/url-handlers/xmpp/command - purple - string - purple-url-handler "%s" - - The handler for "xmpp" URLs - The command used to handle "xmpp" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/xmpp/needs_terminal - /desktop/gnome/url-handlers/xmpp/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - - /schemas/desktop/gnome/url-handlers/ymsgr/enabled - /desktop/gnome/url-handlers/ymsgr/enabled - purple - bool - true - - Whether the specified command should handle "ymsgr" URLs - True if the command specified in the "command" key should handle "ymsgr" URLs. - - - - /schemas/desktop/gnome/url-handlers/ymsgr/command - /desktop/gnome/url-handlers/ymsgr/command - purple - string - purple-url-handler "%s" - - The handler for "ymsgr" URLs - The command used to handle "ymsgr" URLs, if enabled. - - - - /schemas/desktop/gnome/url-handlers/ymsgr/needs_terminal - /desktop/gnome/url-handlers/ymsgr/needs_terminal - purple - bool - false - - Run the command in a terminal - True if the command used to handle this type of URL should be run in a terminal. - - - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,350 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "connection.h" -#include "debug.h" -#include "eventloop.h" -#include "idle.h" -#include "log.h" -#include "prefs.h" -#include "savedstatuses.h" -#include "signals.h" - -typedef enum -{ - PURPLE_IDLE_NOT_AWAY = 0, - PURPLE_IDLE_AUTO_AWAY, - PURPLE_IDLE_AWAY_BUT_NOT_AUTO_AWAY - -} PurpleAutoAwayState; - -static PurpleIdleUiOps *idle_ui_ops = NULL; - -/** - * This is needed for the I'dle Mak'er plugin to work correctly. We - * use it to determine if we're the ones who set our accounts idle - * or if someone else did it (the I'dle Mak'er plugin, for example). - * Basically we just keep track of which accounts were set idle by us, - * and then we'll only set these specific accounts unidle when the - * user returns. - */ -static GList *idled_accts = NULL; - -static guint idle_timer = 0; - -static time_t last_active_time = 0; - -static void -set_account_idle(PurpleAccount *account, int time_idle) -{ - PurplePresence *presence; - - presence = purple_account_get_presence(account); - - if (purple_presence_is_idle(presence)) - /* This account is already idle! */ - return; - - purple_debug_info("idle", "Setting %s idle %d seconds\n", - purple_account_get_username(account), time_idle); - purple_presence_set_idle(presence, TRUE, time(NULL) - time_idle); - idled_accts = g_list_prepend(idled_accts, account); -} - -static void -set_account_unidle(PurpleAccount *account) -{ - PurplePresence *presence; - - presence = purple_account_get_presence(account); - - idled_accts = g_list_remove(idled_accts, account); - - if (!purple_presence_is_idle(presence)) - /* This account is already unidle! */ - return; - - purple_debug_info("idle", "Setting %s unidle\n", - purple_account_get_username(account)); - purple_presence_set_idle(presence, FALSE, 0); -} - - -static gboolean no_away = FALSE; -static gint time_until_next_idle_event; -/* - * This function should be called when you think your idle state - * may have changed. Maybe you're over the 10-minute mark and - * Purple should start reporting idle time to the server. Maybe - * you've returned from being idle. Maybe your auto-away message - * should be set. - * - * There is no harm to calling this many many times, other than - * it will be kinda slow. This is called by a timer set when - * Purple starts. It is also called when you send an IM, a chat, etc. - * - * This function has 3 sections. - * 1. Get your idle time. It will query XScreenSaver or Windows - * or use the Purple idle time. Whatever. - * 2. Set or unset your auto-away message. - * 3. Report your current idle time to the IM server. - */ - -static void -check_idleness(void) -{ - time_t time_idle; - gboolean auto_away; - const gchar *idle_reporting; - gboolean report_idle = TRUE; - gint away_seconds = 0; - gint idle_recheck_interval = 0; - gint idle_poll_seconds = purple_prefs_get_int("/purple/away/mins_before_away") * 60; - purple_signal_emit(purple_blist_get_handle(), "update-idle"); - - idle_reporting = purple_prefs_get_string("/purple/away/idle_reporting"); - auto_away = purple_prefs_get_bool("/purple/away/away_when_idle"); - - if (purple_strequal(idle_reporting, "system") && - (idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL)) - { - /* Use system idle time (mouse or keyboard movement, etc.) */ - time_idle = idle_ui_ops->get_time_idle(); - idle_recheck_interval = 1; - } - else if (purple_strequal(idle_reporting, "purple")) - { - /* Use 'Purple idle' */ - time_idle = time(NULL) - last_active_time; - idle_recheck_interval = 0; - } - else - { - /* Don't report idle time */ - time_idle = 0; - report_idle = FALSE; - - /* If we're not reporting idle, we can still do auto-away. - * First try "system" and if that isn't possible, use "purple" */ - if (auto_away) - { - if ((idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL)) - { - time_idle = idle_ui_ops->get_time_idle(); - idle_recheck_interval = 1; - } - else - { - time_idle = time(NULL) - last_active_time; - idle_recheck_interval = 0; - } - } - else - { - if (!no_away) - { - no_away = TRUE; - purple_savedstatus_set_idleaway(FALSE); - } - time_until_next_idle_event = 0; - return; - } - } - - time_until_next_idle_event = idle_poll_seconds - time_idle; - if (time_until_next_idle_event < 0) - { - /* If we're already idle, check again as appropriate. */ - time_until_next_idle_event = idle_recheck_interval; - } - - if (auto_away || !no_away) - away_seconds = 60 * purple_prefs_get_int("/purple/away/mins_before_away"); - - if (auto_away && time_idle > away_seconds) - { - purple_savedstatus_set_idleaway(TRUE); - no_away = FALSE; - } - else if (purple_savedstatus_is_idleaway() && time_idle < away_seconds) - { - purple_savedstatus_set_idleaway(FALSE); - if (time_until_next_idle_event == 0 || (away_seconds - time_idle) < time_until_next_idle_event) - time_until_next_idle_event = away_seconds - time_idle; - } - - /* Idle reporting stuff */ - if (report_idle && (time_idle >= idle_poll_seconds)) - { - GList *l; - for (l = purple_connections_get_all(); l != NULL; l = l->next) - { - PurpleConnection *gc = l->data; - set_account_idle(purple_connection_get_account(gc), time_idle); - } - } - else if (!report_idle || (time_idle < idle_poll_seconds )) - { - while (idled_accts != NULL) - set_account_unidle(idled_accts->data); - } -} - - -/* - * Check idle and set the timer to fire at the next idle-worth event - */ -static gboolean -check_idleness_timer(void) -{ - check_idleness(); - if (time_until_next_idle_event == 0) - idle_timer = 0; - else - { - /* +1 for the boundary, - * +1 more for g_timeout_add_seconds rounding. */ - idle_timer = purple_timeout_add_seconds(time_until_next_idle_event + 2, (GSourceFunc)check_idleness_timer, NULL); - } - return FALSE; -} - -static void -im_msg_sent_cb(PurpleAccount *account, const char *receiver, - const char *message, void *data) -{ - /* Check our idle time after an IM is sent */ - check_idleness(); -} - -static void -signing_on_cb(PurpleConnection *gc, void *data) -{ - /* When signing on a new account, check if the account should be idle */ - check_idleness(); -} - -static void -signing_off_cb(PurpleConnection *gc, void *data) -{ - PurpleAccount *account; - - account = purple_connection_get_account(gc); - set_account_unidle(account); -} - -static void -idle_reporting_cb(const char *name, PurplePrefType type, gconstpointer val, gpointer data) -{ - if (idle_timer) - purple_timeout_remove(idle_timer); - idle_timer = 0; - check_idleness_timer(); -} - -void -purple_idle_touch() -{ - time(&last_active_time); - if (!no_away) - { - if (idle_timer) - purple_timeout_remove(idle_timer); - idle_timer = 0; - check_idleness_timer(); - } -} - -void -purple_idle_set(time_t time) -{ - last_active_time = time; -} - -void -purple_idle_set_ui_ops(PurpleIdleUiOps *ops) -{ - idle_ui_ops = ops; -} - -PurpleIdleUiOps * -purple_idle_get_ui_ops(void) -{ - return idle_ui_ops; -} - -static void * -purple_idle_get_handle(void) -{ - static int handle; - - return &handle; -} - -static gboolean _do_purple_idle_touch_cb(gpointer data) -{ - int idle_poll_minutes = purple_prefs_get_int("/purple/away/mins_before_away"); - - /* +1 more for g_timeout_add_seconds rounding. */ - idle_timer = purple_timeout_add_seconds((idle_poll_minutes * 60) + 2, (GSourceFunc)check_idleness_timer, NULL); - - purple_idle_touch(); - - return FALSE; -} - - -void -purple_idle_init() -{ - purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", - purple_idle_get_handle(), - PURPLE_CALLBACK(im_msg_sent_cb), NULL); - purple_signal_connect(purple_connections_get_handle(), "signing-on", - purple_idle_get_handle(), - PURPLE_CALLBACK(signing_on_cb), NULL); - purple_signal_connect(purple_connections_get_handle(), "signing-off", - purple_idle_get_handle(), - PURPLE_CALLBACK(signing_off_cb), NULL); - - purple_prefs_connect_callback(purple_idle_get_handle(), "/purple/away/idle_reporting", - idle_reporting_cb, NULL); - - /* Initialize the idleness asynchronously so it doesn't check idleness, - * and potentially try to change the status before the UI is initialized */ - purple_timeout_add(0, _do_purple_idle_touch_cb, NULL); - -} - -void -purple_idle_uninit() -{ - purple_signals_disconnect_by_handle(purple_idle_get_handle()); - purple_prefs_disconnect_by_handle(purple_idle_get_handle()); - - /* Remove the idle timer */ - if (idle_timer > 0) - purple_timeout_remove(idle_timer); - idle_timer = 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/idle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/** - * @file idle.h Idle API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_IDLE_H_ -#define _PURPLE_IDLE_H_ - -#include - -/** - * Idle UI operations. - */ -typedef struct -{ - time_t (*get_time_idle)(void); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleIdleUiOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Idle API */ -/**************************************************************************/ -/*@{*/ - -/** - * Touch our idle tracker. This signifies that the user is - * 'active'. The conversation code calls this when the - * user sends an IM, for example. - */ -void purple_idle_touch(void); - -/** - * Fake our idle time by setting the time at which our - * accounts purportedly became idle. This is used by - * the I'dle Mak'er plugin. - */ -void purple_idle_set(time_t time); - -/*@}*/ - -/**************************************************************************/ -/** @name Idle Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used for idle reporting. - * - * @param ops The UI operations structure. - */ -void purple_idle_set_ui_ops(PurpleIdleUiOps *ops); - -/** - * Returns the UI operations structure used for idle reporting. - * - * @return The UI operations structure in use. - */ -PurpleIdleUiOps *purple_idle_get_ui_ops(void); - -/** - * Initializes the idle system. - */ -void purple_idle_init(void); - -/** - * Uninitializes the idle system. - */ -void purple_idle_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_IDLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,227 +0,0 @@ -/** - * @file imgstore.c IM Image Store API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * -*/ - -#include "internal.h" - -#include "dbus-maybe.h" -#include "debug.h" -#include "imgstore.h" -#include "util.h" - -static GHashTable *imgstore; -static unsigned int nextid = 0; - -/* - * NOTE: purple_imgstore_add() creates these without zeroing the memory, so - * NOTE: make sure to update that function when adding members. - */ -struct _PurpleStoredImage -{ - int id; - guint8 refcount; - size_t size; /**< The image data's size. */ - char *filename; /**< The filename (for the UI) */ - gpointer data; /**< The image data. */ -}; - -PurpleStoredImage * -purple_imgstore_add(gpointer data, size_t size, const char *filename) -{ - PurpleStoredImage *img; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(size > 0, NULL); - - img = g_new(PurpleStoredImage, 1); - PURPLE_DBUS_REGISTER_POINTER(img, PurpleStoredImage); - img->data = data; - img->size = size; - img->filename = g_strdup(filename); - img->refcount = 1; - img->id = 0; - - return img; -} - -PurpleStoredImage * -purple_imgstore_new_from_file(const char *path) -{ - gchar *data = NULL; - size_t len; - GError *err = NULL; - - g_return_val_if_fail(path != NULL && *path != '\0', NULL); - - if (!g_file_get_contents(path, &data, &len, &err)) { - purple_debug_error("imgstore", "Error reading %s: %s\n", - path, err->message); - g_error_free(err); - return NULL; - } - return purple_imgstore_add(data, len, path); -} - -int -purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename) -{ - PurpleStoredImage *img = purple_imgstore_add(data, size, filename); - if (img) { - /* - * Use the next unused id number. We do it in a loop on the - * off chance that nextid wraps back around to 0 and the hash - * table still contains entries from the first time around. - */ - do { - img->id = ++nextid; - } while (img->id == 0 || g_hash_table_lookup(imgstore, &(img->id)) != NULL); - - g_hash_table_insert(imgstore, &(img->id), img); - } - - return (img ? img->id : 0); -} - -PurpleStoredImage *purple_imgstore_find_by_id(int id) { - PurpleStoredImage *img = g_hash_table_lookup(imgstore, &id); - - if (img != NULL) - purple_debug_misc("imgstore", "retrieved image id %d\n", img->id); - - return img; -} - -gconstpointer purple_imgstore_get_data(PurpleStoredImage *img) { - g_return_val_if_fail(img != NULL, NULL); - - return img->data; -} - -size_t purple_imgstore_get_size(PurpleStoredImage *img) -{ - g_return_val_if_fail(img != NULL, 0); - - return img->size; -} - -const char *purple_imgstore_get_filename(const PurpleStoredImage *img) -{ - g_return_val_if_fail(img != NULL, NULL); - - return img->filename; -} - -const char *purple_imgstore_get_extension(PurpleStoredImage *img) -{ - g_return_val_if_fail(img != NULL, NULL); - - return purple_util_get_image_extension(img->data, img->size); -} - -void purple_imgstore_ref_by_id(int id) -{ - PurpleStoredImage *img = purple_imgstore_find_by_id(id); - - g_return_if_fail(img != NULL); - - purple_imgstore_ref(img); -} - -void purple_imgstore_unref_by_id(int id) -{ - PurpleStoredImage *img = purple_imgstore_find_by_id(id); - - g_return_if_fail(img != NULL); - - purple_imgstore_unref(img); -} - -PurpleStoredImage * -purple_imgstore_ref(PurpleStoredImage *img) -{ - g_return_val_if_fail(img != NULL, NULL); - - img->refcount++; - - return img; -} - -PurpleStoredImage * -purple_imgstore_unref(PurpleStoredImage *img) -{ - if (img == NULL) - return NULL; - - g_return_val_if_fail(img->refcount > 0, NULL); - - img->refcount--; - - if (img->refcount == 0) - { - purple_signal_emit(purple_imgstore_get_handle(), - "image-deleting", img); - if (img->id) - g_hash_table_remove(imgstore, &img->id); - - g_free(img->data); - g_free(img->filename); - PURPLE_DBUS_UNREGISTER_POINTER(img); - g_free(img); - img = NULL; - } - - return img; -} - -void * -purple_imgstore_get_handle() -{ - static int handle; - - return &handle; -} - -void -purple_imgstore_init() -{ - void *handle = purple_imgstore_get_handle(); - - purple_signal_register(handle, "image-deleting", - purple_marshal_VOID__POINTER, NULL, - 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_STORED_IMAGE)); - - imgstore = g_hash_table_new(g_int_hash, g_int_equal); -} - -void -purple_imgstore_uninit() -{ - g_hash_table_destroy(imgstore); - - purple_signals_unregister_by_instance(purple_imgstore_get_handle()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/imgstore.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -/** - * @file imgstore.h IM Image Store API - * @ingroup core - * @see @ref imgstore-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_IMGSTORE_H_ -#define _PURPLE_IMGSTORE_H_ - -#include - -/** A reference-counted immutable wrapper around an image's data and its - * filename. - */ -typedef struct _PurpleStoredImage PurpleStoredImage; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Add an image to the store. - * - * The caller owns a reference to the image in the store, and must dereference - * the image with purple_imgstore_unref() for it to be freed. - * - * No ID is allocated when using this function. If you need to reference the - * image by an ID, use purple_imgstore_add_with_id() instead. - * - * @param data Pointer to the image data, which the imgstore will take - * ownership of and free as appropriate. If you want a - * copy of the data, make it before calling this function. - * @param size Image data's size. - * @param filename Filename associated with image. This is for your - * convenience. It could be the full path to the - * image or, more commonly, the filename of the image - * without any directory information. It can also be - * NULL, if you don't need to keep track of a filename. - * - * @return The stored image. - */ -PurpleStoredImage * -purple_imgstore_add(gpointer data, size_t size, const char *filename); - -/** - * Create an image and add it to the store. - * - * @param path The path to the image. - * - * @return The stored image. - * @since 2.X.X - */ -PurpleStoredImage * -purple_imgstore_new_from_file(const char *path); - -/** - * Add an image to the store, allocating an ID. - * - * The caller owns a reference to the image in the store, and must dereference - * the image with purple_imgstore_unref_by_id() or purple_imgstore_unref() - * for it to be freed. - * - * @param data Pointer to the image data, which the imgstore will take - * ownership of and free as appropriate. If you want a - * copy of the data, make it before calling this function. - * @param size Image data's size. - * @param filename Filename associated with image. This is for your - * convenience. It could be the full path to the - * image or, more commonly, the filename of the image - * without any directory information. It can also be - * NULL, if you don't need to keep track of a filename. - - * @return ID for the image. This is a unique number that can be used - * within libpurple to reference the image. - */ -int purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename); - -/** - * Retrieve an image from the store. The caller does not own a - * reference to the image. - * - * @param id The ID for the image. - * - * @return A pointer to the requested image, or NULL if it was not found. - */ -PurpleStoredImage *purple_imgstore_find_by_id(int id); - -/** - * Retrieves a pointer to the image's data. - * - * @param img The Image - * - * @return A pointer to the data, which must not - * be freed or modified. - */ -gconstpointer purple_imgstore_get_data(PurpleStoredImage *img); - -/** - * Retrieves the length of the image's data. - * - * @param img The Image - * - * @return The size of the data that the pointer returned by - * purple_imgstore_get_data points to. - */ -size_t purple_imgstore_get_size(PurpleStoredImage *img); - -/** - * Retrieves a pointer to the image's filename. - * - * @param img The image - * - * @return A pointer to the filename, which must not - * be freed or modified. - */ -const char *purple_imgstore_get_filename(const PurpleStoredImage *img); - -/** - * Looks at the magic numbers of the image data (the first few bytes) - * and returns an extension corresponding to the image's file type. - * - * @param img The image. - * - * @return The image's extension (for example "png") or "icon" - * if unknown. - */ -const char *purple_imgstore_get_extension(PurpleStoredImage *img); - -/** - * Increment the reference count. - * - * @param img The image. - * - * @return @a img - */ -PurpleStoredImage * -purple_imgstore_ref(PurpleStoredImage *img); - -/** - * Decrement the reference count. - * - * If the reference count reaches zero, the image will be freed. - * - * @param img The image. - * - * @return @a img or @c NULL if the reference count reached zero. - */ -PurpleStoredImage * -purple_imgstore_unref(PurpleStoredImage *img); - -/** - * Increment the reference count using an ID. - * - * This is a convience wrapper for purple_imgstore_find_by_id() and - * purple_imgstore_ref(), so if you have a PurpleStoredImage, it'll - * be more efficient to call purple_imgstore_ref() directly. - * - * @param id The ID for the image. - */ -void purple_imgstore_ref_by_id(int id); - -/** - * Decrement the reference count using an ID. - * - * This is a convience wrapper for purple_imgstore_find_by_id() and - * purple_imgstore_unref(), so if you have a PurpleStoredImage, it'll - * be more efficient to call purple_imgstore_unref() directly. - * - * @param id The ID for the image. - */ -void purple_imgstore_unref_by_id(int id); - -/** - * Returns the image store subsystem handle. - * - * @return The subsystem handle. - */ -void *purple_imgstore_get_handle(void); - -/** - * Initializes the image store subsystem. - */ -void purple_imgstore_init(void); - -/** - * Uninitializes the image store subsystem. - */ -void purple_imgstore_uninit(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_IMGSTORE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,352 +0,0 @@ -/** - * @file internal.h Internal definitions and includes - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_INTERNAL_H_ -#define _PURPLE_INTERNAL_H_ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* for SIOCGIFCONF in SKYOS */ -#ifdef SKYOS -#include -#endif -/* - * If we're using NLS, make sure gettext works. If not, then define - * dummy macros in place of the normal gettext macros. - * - * Also, the perl XS config.h file sometimes defines _ So we need to - * make sure _ isn't already defined before trying to define it. - * - * The Singular/Plural/Number ngettext dummy definition below was - * taken from an email to the texinfo mailing list by Manuel Guerrero. - * Thank you Manuel, and thank you Alex's good friend Google. - */ -#ifdef ENABLE_NLS -# include -# include -# define _(String) ((const char *)dgettext(PACKAGE, String)) -# ifdef gettext_noop -# define N_(String) gettext_noop (String) -# else -# define N_(String) (String) -# endif -#else -# include -# define N_(String) (String) -# ifndef _ -# define _(String) ((const char *)String) -# endif -# define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural)) -# define dngettext(Domain, Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural)) -#endif - -#ifdef HAVE_ENDIAN_H -# include -#endif - -#define MSG_LEN 2048 -/* The above should normally be the same as BUF_LEN, - * but just so we're explicitly asking for the max message - * length. */ -#define BUF_LEN MSG_LEN -#define BUF_LONG BUF_LEN * 2 - -#include -#include -#ifndef _WIN32 -#include -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_ICONV -#include -#endif - -#ifdef HAVE_LANGINFO_CODESET -#include -#endif - -#include - -#ifdef PURPLE_PLUGINS -# ifdef HAVE_DLFCN_H -# include -# endif -#endif - -#ifndef _WIN32 -# include -# include -# include -# include -# include -# include -# include -# include -#endif - -/* MAXPATHLEN should only be used with readlink() on glib < 2.4.0. For - * anything else, use g_file_read_link() or other dynamic functions. This is - * important because Hurd has no hard limits on path length. */ -#if !GLIB_CHECK_VERSION(2,4,0) -# ifndef MAXPATHLEN -# ifdef PATH_MAX -# define MAXPATHLEN PATH_MAX -# else -# define MAXPATHLEN 1024 -# endif -# endif -#endif - -#ifndef HOST_NAME_MAX -# define HOST_NAME_MAX 255 -#endif - -#include -#if !GLIB_CHECK_VERSION(2,4,0) -# define G_MAXUINT32 ((guint32) 0xffffffff) -#endif - -#ifndef G_MAXSIZE -# if GLIB_SIZEOF_LONG == 8 -# define G_MAXSIZE ((gsize) 0xffffffffffffffff) -# else -# define G_MAXSIZE ((gsize) 0xffffffff) -# endif -#endif - -#ifndef G_MAXSSIZE -# if GLIB_SIZEOF_LONG == 8 -# define G_MAXSSIZE ((gssize) 0x7fffffffffffffff) -# else -# define G_MAXSSIZE ((gssize) 0x7fffffff) -# endif -#endif - -#if GLIB_CHECK_VERSION(2,6,0) -# include -#endif - -#if !GLIB_CHECK_VERSION(2,6,0) -# define g_freopen freopen -# define g_fopen fopen -# define g_rmdir rmdir -# define g_remove remove -# define g_unlink unlink -# define g_lstat lstat -# define g_stat stat -# define g_mkdir mkdir -# define g_rename rename -# define g_open open -#endif - -#if !GLIB_CHECK_VERSION(2,8,0) && !defined _WIN32 -# define g_access access -#endif - -#if !GLIB_CHECK_VERSION(2,10,0) -# define g_slice_new(type) g_new(type, 1) -# define g_slice_new0(type) g_new0(type, 1) -# define g_slice_free(type, mem) g_free(mem) -#endif - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* ugly ugly ugly */ -/* This is a workaround for the fact that G_GINT64_MODIFIER and G_GSIZE_FORMAT - * are only defined in Glib >= 2.4 */ -#ifndef G_GINT64_MODIFIER -# if GLIB_SIZEOF_LONG == 8 -# define G_GINT64_MODIFIER "l" -# else -# define G_GINT64_MODIFIER "ll" -# endif -#endif - -#ifndef G_GSIZE_MODIFIER -# if GLIB_SIZEOF_LONG == 8 -# define G_GSIZE_MODIFIER "l" -# else -# define G_GSIZE_MODIFIER "" -# endif -#endif - -#ifndef G_GSIZE_FORMAT -# if GLIB_SIZEOF_LONG == 8 -# define G_GSIZE_FORMAT "lu" -# else -# define G_GSIZE_FORMAT "u" -# endif -#endif - -#ifndef G_GSSIZE_FORMAT -# if GLIB_SIZEOF_LONG == 8 -# define G_GSSIZE_FORMAT "li" -# else -# define G_GSSIZE_FORMAT "i" -# endif -#endif - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -#ifdef HAVE_CONFIG_H -#if SIZEOF_TIME_T == 4 -# define PURPLE_TIME_T_MODIFIER "lu" -#elif SIZEOF_TIME_T == 8 -# define PURPLE_TIME_T_MODIFIER "zu" -#else -#error Unknown size of time_t -#endif -#endif - -#include - -#ifndef G_DEFINE_TYPE -#define G_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \ -\ -static void type_name##_init (TypeName *self); \ -static void type_name##_class_init (TypeName##Class *klass); \ -static gpointer type_name##_parent_class = NULL; \ -static void type_name##_class_intern_init (gpointer klass) \ -{ \ - type_name##_parent_class = g_type_class_peek_parent (klass); \ - type_name##_class_init ((TypeName##Class*) klass); \ -} \ -\ -GType \ -type_name##_get_type (void) \ -{ \ - static GType g_define_type_id = 0; \ - if (G_UNLIKELY (g_define_type_id == 0)) \ - { \ - g_define_type_id = \ - g_type_register_static_simple (TYPE_PARENT, \ - g_intern_static_string (#TypeName), \ - sizeof (TypeName##Class), \ - (GClassInitFunc)type_name##_class_intern_init, \ - sizeof (TypeName), \ - (GInstanceInitFunc)type_name##_init, \ - (GTypeFlags) 0); \ - } \ - return g_define_type_id; \ -} /* closes type_name##_get_type() */ - -#endif - -/* Safer ways to work with static buffers. When using non-static - * buffers, either use g_strdup_* functions (preferred) or use - * g_strlcpy/g_strlcpy directly. */ -#define purple_strlcpy(dest, src) g_strlcpy(dest, src, sizeof(dest)) -#define purple_strlcat(dest, src) g_strlcat(dest, src, sizeof(dest)) - -#define PURPLE_WEBSITE "http://pidgin.im/" -#define PURPLE_DEVEL_WEBSITE "http://developer.pidgin.im/" - - -/* INTERNAL FUNCTIONS */ - -#include "account.h" -#include "connection.h" - -/* This is for the accounts code to notify the buddy icon code that - * it's done loading. We may want to replace this with a signal. */ -void -_purple_buddy_icons_account_loaded_cb(void); - -/* This is for the buddy list to notify the buddy icon code that - * it's done loading. We may want to replace this with a signal. */ -void -_purple_buddy_icons_blist_loaded_cb(void); - -/* This is for the purple_core_migrate() code to tell the buddy - * icon subsystem about the old icons directory so it can - * migrate any icons in use. */ -void -_purple_buddy_icon_set_old_icons_dir(const char *dirname); - -/** - * Creates a connection to the specified account and either connects - * or attempts to register a new account. If you are logging in, - * the connection uses the current active status for this account. - * So if you want to sign on as "away," for example, you need to - * have called purple_account_set_status(account, "away"). - * (And this will call purple_account_connect() automatically). - * - * @note This function should only be called by purple_account_connect() - * in account.c. If you're trying to sign on an account, use that - * function instead. - * - * @param account The account the connection should be connecting to. - * @param regist Whether we are registering a new account or just - * trying to do a normal signon. - * @param password The password to use. - */ -void _purple_connection_new(PurpleAccount *account, gboolean regist, - const char *password); -/** - * Tries to unregister the account on the server. If the account is not - * connected, also creates a new connection. - * - * @note This function should only be called by purple_account_unregister() - * in account.c. - * - * @param account The account to unregister - * @param password The password to use. - * @param cb Optional callback to be called when unregistration is complete - * @param user_data user data to pass to the callback - */ -void _purple_connection_new_unregister(PurpleAccount *account, const char *password, - PurpleAccountUnregistrationCb cb, void *user_data); -/** - * Disconnects and destroys a PurpleConnection. - * - * @note This function should only be called by purple_account_disconnect() - * in account.c. If you're trying to sign off an account, use that - * function instead. - * - * @param gc The purple connection to destroy. - */ -void _purple_connection_destroy(PurpleConnection *gc); - -#endif /* _PURPLE_INTERNAL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/libpurple.def qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/libpurple.def --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/libpurple.def 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/libpurple.def 1970-01-01 00:00:00.000000000 +0000 @@ -1,1460 +0,0 @@ -EXPORTS - _purple_buddy_icon_set_old_icons_dir @1 - _purple_buddy_icons_account_loaded_cb @2 - _purple_buddy_icons_blist_loaded_cb @3 - _purple_oscar_convert @4 - purple_account_add_buddies @5 - purple_account_add_buddy @6 - purple_account_change_password @7 - purple_account_clear_current_error @8 - purple_account_clear_settings @9 - purple_account_connect @10 - purple_account_destroy @11 - purple_account_destroy_log @12 - purple_account_disconnect @13 - purple_account_get_active_status @14 - purple_account_get_alias @15 - purple_account_get_bool @16 - purple_account_get_buddy_icon_path @17 - purple_account_get_check_mail @18 - purple_account_get_connection @19 - purple_account_get_current_error @20 - purple_account_get_enabled @21 - purple_account_get_int @22 - purple_account_get_log @23 - purple_account_get_password @24 - purple_account_get_presence @25 - purple_account_get_protocol_id @26 - purple_account_get_protocol_name @27 - purple_account_get_proxy_info @28 - purple_account_get_remember_password @29 - purple_account_get_status @30 - purple_account_get_status_type @31 - purple_account_get_status_type_with_primitive @32 - purple_account_get_status_types @33 - purple_account_get_string @34 - purple_account_get_ui_bool @35 - purple_account_get_ui_int @36 - purple_account_get_ui_string @37 - purple_account_get_user_info @38 - purple_account_get_username @39 - purple_account_is_connected @40 - purple_account_is_connecting @41 - purple_account_is_disconnected @42 - purple_account_is_status_active @43 - purple_account_new @44 - purple_account_notify_added @45 - purple_account_option_add_list_item @46 - purple_account_option_bool_new @47 - purple_account_option_destroy @48 - purple_account_option_get_default_bool @49 - purple_account_option_get_default_int @50 - purple_account_option_get_default_list_value @51 - purple_account_option_get_default_string @52 - purple_account_option_get_list @53 - purple_account_option_get_masked @54 - purple_account_option_get_setting @55 - purple_account_option_get_text @56 - purple_account_option_get_type @57 - purple_account_option_int_new @58 - purple_account_option_list_new @59 - purple_account_option_new @60 - purple_account_option_set_default_bool @61 - purple_account_option_set_default_int @62 - purple_account_option_set_default_string @63 - purple_account_option_set_list @64 - purple_account_option_set_masked @65 - purple_account_option_string_new @66 - purple_account_register @67 - purple_account_remove_buddies @68 - purple_account_remove_buddy @69 - purple_account_remove_group @70 - purple_account_request_add @71 - purple_account_request_authorization @72 - purple_account_request_change_password @73 - purple_account_request_change_user_info @74 - purple_account_request_close @75 - purple_account_request_close_with_account @76 - purple_account_request_password @77 - purple_account_set_alias @78 - purple_account_set_bool @79 - purple_account_set_buddy_icon_path @80 - purple_account_set_check_mail @81 - purple_account_set_connection @82 - purple_account_set_enabled @83 - purple_account_set_int @84 - purple_account_set_password @85 - purple_account_set_protocol_id @86 - purple_account_set_proxy_info @87 - purple_account_set_register_callback @88 - purple_account_set_remember_password @89 - purple_account_set_status @90 - purple_account_set_status_list @91 - purple_account_set_status_types @92 - purple_account_set_string @93 - purple_account_set_ui_bool @94 - purple_account_set_ui_int @95 - purple_account_set_ui_string @96 - purple_account_set_user_info @97 - purple_account_set_username @98 - purple_account_supports_offline_message @99 - purple_account_unregister @100 - purple_account_user_split_destroy @101 - purple_account_user_split_get_default_value @102 - purple_account_user_split_get_reverse @103 - purple_account_user_split_get_separator @104 - purple_account_user_split_get_text @105 - purple_account_user_split_new @106 - purple_account_user_split_set_reverse @107 - purple_accounts_add @108 - purple_accounts_delete @109 - purple_accounts_find @110 - purple_accounts_get_all @111 - purple_accounts_get_all_active @112 - purple_accounts_get_handle @113 - purple_accounts_get_ui_ops @114 - purple_accounts_init @115 - purple_accounts_remove @116 - purple_accounts_reorder @117 - purple_accounts_restore_current_statuses @118 - purple_accounts_set_ui_ops @119 - purple_accounts_uninit @120 - purple_attention_type_get_icon_name @121 - purple_attention_type_get_incoming_desc @122 - purple_attention_type_get_name @123 - purple_attention_type_get_outgoing_desc @124 - purple_attention_type_get_unlocalized_name @125 - purple_attention_type_new @126 - purple_attention_type_set_icon_name @127 - purple_attention_type_set_incoming_desc @128 - purple_attention_type_set_name @129 - purple_attention_type_set_outgoing_desc @130 - purple_attention_type_set_unlocalized_name @131 - purple_base16_decode @132 - purple_base16_encode @133 - purple_base16_encode_chunked @134 - purple_base64_decode @135 - purple_base64_encode @136 - purple_blist_add_account @137 - purple_blist_add_buddy @138 - purple_blist_add_chat @139 - purple_blist_add_contact @140 - purple_blist_add_group @141 - purple_blist_alias_buddy @142 - purple_blist_alias_chat @143 - purple_blist_alias_contact @144 - purple_blist_destroy @145 - purple_blist_find_chat @146 - purple_blist_get_group_online_count @147 - purple_blist_get_group_size @148 - purple_blist_get_handle @149 - purple_blist_get_root @150 - purple_blist_get_ui_ops @151 - purple_blist_init @152 - purple_blist_load @153 - purple_blist_merge_contact @154 - purple_blist_new @155 - purple_blist_node_get_bool @156 - purple_blist_node_get_extended_menu @157 - purple_blist_node_get_first_child @158 - purple_blist_node_get_flags @159 - purple_blist_node_get_int @160 - purple_blist_node_get_parent @161 - purple_blist_node_get_sibling_next @162 - purple_blist_node_get_sibling_prev @163 - purple_blist_node_get_string @164 - purple_blist_node_get_type @165 - purple_blist_node_next @166 - purple_blist_node_remove_setting @167 - purple_blist_node_set_bool @168 - purple_blist_node_set_flags @169 - purple_blist_node_set_int @170 - purple_blist_node_set_string @171 - purple_blist_remove_account @172 - purple_blist_remove_buddy @173 - purple_blist_remove_chat @174 - purple_blist_remove_contact @175 - purple_blist_remove_group @176 - purple_blist_rename_buddy @177 - purple_blist_rename_group @178 - purple_blist_request_add_buddy @179 - purple_blist_request_add_chat @180 - purple_blist_request_add_group @181 - purple_blist_schedule_save @182 - purple_blist_server_alias_buddy @183 - purple_blist_set_ui_ops @184 - purple_blist_set_visible @185 - purple_blist_show @186 - purple_blist_uninit @187 - purple_blist_update_buddy_icon @188 - purple_blist_update_buddy_status @189 - purple_blist_update_node_icon @190 - purple_buddy_get_account @191 - purple_buddy_get_alias @192 - purple_buddy_get_alias_only @193 - purple_buddy_get_contact @194 - purple_buddy_get_contact_alias @195 - purple_buddy_get_group @196 - purple_buddy_get_icon @197 - purple_buddy_get_local_alias @198 - purple_buddy_get_name @199 - purple_buddy_get_presence @200 - purple_buddy_get_server_alias @201 - purple_buddy_icon_get_account @202 - purple_buddy_icon_get_checksum @203 - purple_buddy_icon_get_data @204 - purple_buddy_icon_get_extension @205 - purple_buddy_icon_get_full_path @206 - purple_buddy_icon_get_scale_size @207 - purple_buddy_icon_get_username @208 - purple_buddy_icon_new @209 - purple_buddy_icon_ref @210 - purple_buddy_icon_set_data @211 - purple_buddy_icon_unref @212 - purple_buddy_icon_update @213 - purple_buddy_icons_find @214 - purple_buddy_icons_find_account_icon @215 - purple_buddy_icons_find_custom_icon @216 - purple_buddy_icons_get_account_icon_timestamp @217 - purple_buddy_icons_get_cache_dir @218 - purple_buddy_icons_get_checksum_for_user @219 - purple_buddy_icons_get_handle @220 - purple_buddy_icons_has_custom_icon @221 - purple_buddy_icons_init @222 - purple_buddy_icons_is_caching @223 - purple_buddy_icons_node_find_custom_icon @224 - purple_buddy_icons_node_has_custom_icon @225 - purple_buddy_icons_node_set_custom_icon @226 - purple_buddy_icons_node_set_custom_icon_from_file @227 - purple_buddy_icons_set_account_icon @228 - purple_buddy_icons_set_cache_dir @229 - purple_buddy_icons_set_caching @230 - purple_buddy_icons_set_custom_icon @231 - purple_buddy_icons_set_for_user @232 - purple_buddy_icons_uninit @233 - purple_buddy_new @234 - purple_buddy_set_icon @235 - purple_build_dir @236 - purple_certificate_add_ca_search_path @237 - purple_certificate_check_signature_chain @238 - purple_certificate_check_subject_name @239 - purple_certificate_copy @240 - purple_certificate_copy_list @241 - purple_certificate_destroy @242 - purple_certificate_destroy_list @243 - purple_certificate_display_x509 @244 - purple_certificate_export @245 - purple_certificate_find_pool @246 - purple_certificate_find_scheme @247 - purple_certificate_find_verifier @248 - purple_certificate_get_fingerprint_sha1 @249 - purple_certificate_get_handle @250 - purple_certificate_get_issuer_unique_id @251 - purple_certificate_get_pools @252 - purple_certificate_get_schemes @253 - purple_certificate_get_subject_name @254 - purple_certificate_get_times @255 - purple_certificate_get_unique_id @256 - purple_certificate_get_verifiers @257 - purple_certificate_import @258 - purple_certificate_init @259 - purple_certificate_pool_contains @260 - purple_certificate_pool_delete @261 - purple_certificate_pool_destroy_idlist @262 - purple_certificate_pool_get_idlist @263 - purple_certificate_pool_get_scheme @264 - purple_certificate_pool_mkpath @265 - purple_certificate_pool_retrieve @266 - purple_certificate_pool_store @267 - purple_certificate_pool_usable @268 - purple_certificate_register_pool @269 - purple_certificate_register_scheme @270 - purple_certificate_register_verifier @271 - purple_certificate_signed_by @272 - purple_certificate_uninit @273 - purple_certificate_unregister_pool @274 - purple_certificate_unregister_scheme @275 - purple_certificate_unregister_verifier @276 - purple_certificate_verify @277 - purple_certificate_verify_complete @278 - purple_chat_get_account @279 - purple_chat_get_components @280 - purple_chat_get_group @281 - purple_chat_get_name @282 - purple_chat_new @283 - purple_cipher_context_append @284 - purple_cipher_context_decrypt @285 - purple_cipher_context_destroy @286 - purple_cipher_context_digest @287 - purple_cipher_context_digest_to_str @288 - purple_cipher_context_encrypt @289 - purple_cipher_context_get_batch_mode @290 - purple_cipher_context_get_block_size @291 - purple_cipher_context_get_data @292 - purple_cipher_context_get_key_size @293 - purple_cipher_context_get_option @294 - purple_cipher_context_get_salt_size @295 - purple_cipher_context_new @296 - purple_cipher_context_new_by_name @297 - purple_cipher_context_reset @298 - purple_cipher_context_set_batch_mode @299 - purple_cipher_context_set_data @300 - purple_cipher_context_set_iv @301 - purple_cipher_context_set_key @302 - purple_cipher_context_set_key_with_len @303 - purple_cipher_context_set_option @304 - purple_cipher_context_set_salt @305 - purple_cipher_digest_region @306 - purple_cipher_get_capabilities @307 - purple_cipher_get_name @308 - purple_cipher_http_digest_calculate_response @309 - purple_cipher_http_digest_calculate_session_key @310 - purple_ciphers_find_cipher @311 - purple_ciphers_get_ciphers @312 - purple_ciphers_get_handle @313 - purple_ciphers_init @314 - purple_ciphers_register_cipher @315 - purple_ciphers_uninit @316 - purple_ciphers_unregister_cipher @317 - purple_circ_buffer_append @318 - purple_circ_buffer_destroy @319 - purple_circ_buffer_get_max_read @320 - purple_circ_buffer_mark_read @321 - purple_circ_buffer_new @322 - purple_cmd_do_command @323 - purple_cmd_help @324 - purple_cmd_list @325 - purple_cmd_register @326 - purple_cmd_unregister @327 - purple_cmds_get_handle @328 - purple_cmds_init @329 - purple_cmds_uninit @330 - purple_connection_destroy @331 - purple_connection_error @332 - purple_connection_error_is_fatal @333 - purple_connection_error_reason @334 - purple_connection_get_account @335 - purple_connection_get_display_name @336 - purple_connection_get_password @337 - purple_connection_get_prpl @338 - purple_connection_get_state @339 - purple_connection_new @340 - purple_connection_new_unregister @341 - purple_connection_notice @342 - purple_connection_set_account @343 - purple_connection_set_display_name @344 - purple_connection_set_state @345 - purple_connection_ssl_error @346 - purple_connection_update_progress @347 - purple_connections_disconnect_all @348 - purple_connections_get_all @349 - purple_connections_get_connecting @350 - purple_connections_get_handle @351 - purple_connections_get_ui_ops @352 - purple_connections_init @353 - purple_connections_set_ui_ops @354 - purple_connections_uninit @355 - purple_contact_get_alias @356 - purple_contact_get_priority_buddy @357 - purple_contact_invalidate_priority_buddy @358 - purple_contact_new @359 - purple_contact_on_account @360 - purple_contact_set_alias @361 - purple_conv_chat_add_user @362 - purple_conv_chat_add_users @363 - purple_conv_chat_cb_destroy @364 - purple_conv_chat_cb_find @365 - purple_conv_chat_cb_get_name @366 - purple_conv_chat_cb_new @367 - purple_conv_chat_clear_users @368 - purple_conv_chat_find_user @369 - purple_conv_chat_get_conversation @370 - purple_conv_chat_get_id @371 - purple_conv_chat_get_ignored @372 - purple_conv_chat_get_ignored_user @373 - purple_conv_chat_get_nick @374 - purple_conv_chat_get_topic @375 - purple_conv_chat_get_users @376 - purple_conv_chat_has_left @377 - purple_conv_chat_ignore @378 - purple_conv_chat_is_user_ignored @379 - purple_conv_chat_left @380 - purple_conv_chat_remove_user @381 - purple_conv_chat_remove_users @382 - purple_conv_chat_rename_user @383 - purple_conv_chat_send @384 - purple_conv_chat_send_with_flags @385 - purple_conv_chat_set_id @386 - purple_conv_chat_set_ignored @387 - purple_conv_chat_set_nick @388 - purple_conv_chat_set_topic @389 - purple_conv_chat_set_users @390 - purple_conv_chat_unignore @391 - purple_conv_chat_user_get_flags @392 - purple_conv_chat_user_set_flags @393 - purple_conv_chat_write @394 - purple_conv_custom_smiley_add @395 - purple_conv_custom_smiley_close @396 - purple_conv_custom_smiley_write @397 - purple_conv_im_get_conversation @398 - purple_conv_im_get_icon @399 - purple_conv_im_get_send_typed_timeout @400 - purple_conv_im_get_type_again @401 - purple_conv_im_get_typing_state @402 - purple_conv_im_get_typing_timeout @403 - purple_conv_im_send @404 - purple_conv_im_send_with_flags @405 - purple_conv_im_set_icon @406 - purple_conv_im_set_type_again @407 - purple_conv_im_set_typing_state @408 - purple_conv_im_start_send_typed_timeout @409 - purple_conv_im_start_typing_timeout @410 - purple_conv_im_stop_send_typed_timeout @411 - purple_conv_im_stop_typing_timeout @412 - purple_conv_im_update_typing @413 - purple_conv_im_write @414 - purple_conv_present_error @415 - purple_conv_send_confirm @416 - purple_conversation_autoset_title @417 - purple_conversation_clear_message_history @418 - purple_conversation_close_logs @419 - purple_conversation_destroy @420 - purple_conversation_do_command @421 - purple_conversation_foreach @422 - purple_conversation_get_account @423 - purple_conversation_get_chat_data @424 - purple_conversation_get_data @425 - purple_conversation_get_extended_menu @426 - purple_conversation_get_features @427 - purple_conversation_get_gc @428 - purple_conversation_get_im_data @429 - purple_conversation_get_message_history @430 - purple_conversation_get_name @431 - purple_conversation_get_title @432 - purple_conversation_get_type @433 - purple_conversation_get_ui_ops @434 - purple_conversation_has_focus @435 - purple_conversation_is_logging @436 - purple_conversation_message_get_flags @437 - purple_conversation_message_get_message @438 - purple_conversation_message_get_sender @439 - purple_conversation_message_get_timestamp @440 - purple_conversation_new @441 - purple_conversation_present @442 - purple_conversation_set_account @443 - purple_conversation_set_data @444 - purple_conversation_set_features @445 - purple_conversation_set_logging @446 - purple_conversation_set_name @447 - purple_conversation_set_title @448 - purple_conversation_set_ui_ops @449 - purple_conversation_update @450 - purple_conversation_write @451 - purple_conversations_get_handle @452 - purple_conversations_init @453 - purple_conversations_set_ui_ops @454 - purple_conversations_uninit @455 - purple_core_ensure_single_instance @456 - purple_core_get_ui @457 - purple_core_get_ui_info @458 - purple_core_get_ui_ops @459 - purple_core_get_version @460 - purple_core_init @461 - purple_core_migrate @462 - purple_core_quit @463 - purple_core_quit_cb @464 - purple_core_set_ui_ops @465 - purple_date_format_full @466 - purple_date_format_long @467 - purple_date_format_short @468 - purple_debug @469 - purple_debug_error @470 - purple_debug_fatal @471 - purple_debug_get_ui_ops @472 - purple_debug_info @473 - purple_debug_init @474 - purple_debug_is_enabled @475 - purple_debug_misc @476 - purple_debug_set_enabled @477 - purple_debug_set_ui_ops @478 - purple_debug_warning @479 - purple_dnsquery_a @480 - purple_dnsquery_destroy @481 - purple_dnsquery_get_host @482 - purple_dnsquery_get_port @483 - purple_dnsquery_get_ui_ops @484 - purple_dnsquery_init @485 - purple_dnsquery_set_ui_ops @486 - purple_dnsquery_uninit @487 - purple_email_is_valid @488 - purple_escape_filename @489 - purple_eventloop_get_ui_ops @490 - purple_eventloop_set_ui_ops @491 - purple_fd_get_ip @492 - purple_find_buddies @493 - purple_find_buddy @494 - purple_find_buddy_in_group @495 - purple_find_chat @496 - purple_find_conversation_with_account @497 - purple_find_group @498 - purple_find_pounce @499 - purple_find_prpl @500 - purple_gai_strerror @501 - purple_get_attention_type_from_code @502 - purple_get_blist @503 - purple_get_chats @504 - purple_get_conversations @505 - purple_get_core @506 - purple_get_host_name @507 - purple_get_ims @508 - purple_get_tzoff_str @509 - purple_global_proxy_get_info @510 - purple_got_protocol_handler_uri @511 - purple_group_get_accounts @512 - purple_group_get_name @513 - purple_group_new @514 - purple_group_on_account @515 - purple_home_dir @516 - purple_idle_get_ui_ops @517 - purple_idle_init @518 - purple_idle_set @519 - purple_idle_set_ui_ops @520 - purple_idle_touch @521 - purple_idle_uninit @522 - purple_imgstore_add @523 - purple_imgstore_add_with_id @524 - purple_imgstore_find_by_id @525 - purple_imgstore_get_data @526 - purple_imgstore_get_extension @527 - purple_imgstore_get_filename @528 - purple_imgstore_get_handle @529 - purple_imgstore_get_size @530 - purple_imgstore_init @531 - purple_imgstore_new_from_file @532 - purple_imgstore_ref @533 - purple_imgstore_ref_by_id @534 - purple_imgstore_uninit @535 - purple_imgstore_unref @536 - purple_imgstore_unref_by_id @537 - purple_input_add @538 - purple_input_get_error @539 - purple_input_remove @540 - purple_ip_address_is_valid @541 - purple_log_common_deleter @542 - purple_log_common_is_deletable @543 - purple_log_common_lister @544 - purple_log_common_sizer @545 - purple_log_common_total_sizer @546 - purple_log_common_writer @547 - purple_log_compare @548 - purple_log_delete @549 - purple_log_free @550 - purple_log_get_handle @551 - purple_log_get_log_dir @552 - purple_log_get_log_sets @553 - purple_log_get_logs @554 - purple_log_get_size @555 - purple_log_get_system_logs @556 - purple_log_get_total_size @557 - purple_log_init @558 - purple_log_is_deletable @559 - purple_log_logger_add @560 - purple_log_logger_free @561 - purple_log_logger_get @562 - purple_log_logger_get_options @563 - purple_log_logger_new @564 - purple_log_logger_remove @565 - purple_log_logger_set @566 - purple_log_new @567 - purple_log_read @568 - purple_log_set_compare @569 - purple_log_set_free @570 - purple_log_uninit @571 - purple_log_write @572 - purple_major_version @573 DATA - purple_markup_extract_info_field @574 - purple_markup_find_tag @575 - purple_markup_get_css_property @576 - purple_markup_get_tag_name @577 - purple_markup_html_to_xhtml @578 - purple_markup_linkify @579 - purple_markup_slice @580 - purple_markup_strip_html @581 - purple_markup_unescape_entity @582 - purple_marshal_BOOLEAN__INT_POINTER @583 - purple_marshal_BOOLEAN__POINTER @584 - purple_marshal_BOOLEAN__POINTER_POINTER @585 - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER @586 - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER @587 - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER @588 - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT @589 - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT @590 - purple_marshal_BOOLEAN__POINTER_POINTER_UINT @591 - purple_marshal_INT__INT @592 - purple_marshal_INT__INT_INT @593 - purple_marshal_INT__POINTER_POINTER @594 - purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER @595 - purple_marshal_POINTER__POINTER_INT @596 - purple_marshal_POINTER__POINTER_INT64 @597 - purple_marshal_POINTER__POINTER_INT64_BOOLEAN @598 - purple_marshal_POINTER__POINTER_INT_BOOLEAN @599 - purple_marshal_POINTER__POINTER_POINTER @600 - purple_marshal_VOID @601 - purple_marshal_VOID__INT @602 - purple_marshal_VOID__INT_INT @603 - purple_marshal_VOID__POINTER @604 - purple_marshal_VOID__POINTER_INT_INT @605 - purple_marshal_VOID__POINTER_INT_POINTER @606 - purple_marshal_VOID__POINTER_POINTER @607 - purple_marshal_VOID__POINTER_POINTER_POINTER @608 - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER @609 - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER @610 - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT @611 - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT @612 - purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT @613 - purple_marshal_VOID__POINTER_POINTER_UINT @614 - purple_marshal_VOID__POINTER_POINTER_UINT_UINT @615 - purple_marshal_VOID__POINTER_UINT @616 - purple_menu_action_free @617 - purple_menu_action_new @618 - purple_message_meify @619 - purple_micro_version @620 DATA - purple_mime_decode_field @621 - purple_mime_document_free @622 - purple_mime_document_get_field @623 - purple_mime_document_get_fields @624 - purple_mime_document_get_parts @625 - purple_mime_document_new @626 - purple_mime_document_parse @627 - purple_mime_document_parsen @628 - purple_mime_document_set_field @629 - purple_mime_document_write @630 - purple_mime_part_get_data @631 - purple_mime_part_get_data_decoded @632 - purple_mime_part_get_field @633 - purple_mime_part_get_field_decoded @634 - purple_mime_part_get_fields @635 - purple_mime_part_get_length @636 - purple_mime_part_new @637 - purple_mime_part_set_data @638 - purple_mime_part_set_field @639 - purple_minor_version @640 DATA - purple_mkstemp @641 - purple_network_get_handle @642 - purple_network_get_local_system_ip @643 - purple_network_get_my_ip @644 - purple_network_get_port_from_fd @645 - purple_network_get_public_ip @646 - purple_network_init @647 - purple_network_ip_atoi @648 - purple_network_is_available @649 - purple_network_listen @650 - purple_network_listen_cancel @651 - purple_network_listen_map_external @652 - purple_network_listen_range @653 - purple_network_set_public_ip @654 - purple_network_uninit @655 - purple_normalize @656 - purple_normalize_nocase @657 - purple_notify_close @658 - purple_notify_close_with_handle @659 - purple_notify_email @660 - purple_notify_emails @661 - purple_notify_formatted @662 - purple_notify_get_handle @663 - purple_notify_get_ui_ops @664 - purple_notify_init @665 - purple_notify_message @666 - purple_notify_searchresults @667 - purple_notify_searchresults_button_add @668 - purple_notify_searchresults_button_add_labeled @669 - purple_notify_searchresults_column_add @670 - purple_notify_searchresults_column_get_title @671 - purple_notify_searchresults_column_new @672 - purple_notify_searchresults_free @673 - purple_notify_searchresults_get_columns_count @674 - purple_notify_searchresults_get_rows_count @675 - purple_notify_searchresults_new @676 - purple_notify_searchresults_new_rows @677 - purple_notify_searchresults_row_add @678 - purple_notify_searchresults_row_get @679 - purple_notify_set_ui_ops @680 - purple_notify_uninit @681 - purple_notify_uri @682 - purple_notify_user_info_add_pair @683 - purple_notify_user_info_add_section_break @684 - purple_notify_user_info_add_section_header @685 - purple_notify_user_info_destroy @686 - purple_notify_user_info_entry_get_label @687 - purple_notify_user_info_entry_get_type @688 - purple_notify_user_info_entry_get_value @689 - purple_notify_user_info_entry_new @690 - purple_notify_user_info_entry_set_label @691 - purple_notify_user_info_entry_set_type @692 - purple_notify_user_info_entry_set_value @693 - purple_notify_user_info_get_entries @694 - purple_notify_user_info_get_text_with_newline @695 - purple_notify_user_info_new @696 - purple_notify_user_info_prepend_pair @697 - purple_notify_user_info_prepend_section_break @698 - purple_notify_user_info_prepend_section_header @699 - purple_notify_user_info_remove_entry @700 - purple_notify_user_info_remove_last_item @701 - purple_notify_userinfo @702 - purple_ntlm_gen_type1 @703 - purple_ntlm_gen_type3 @704 - purple_ntlm_parse_type2 @705 - purple_plugin_action_free @706 - purple_plugin_action_new @707 - purple_plugin_destroy @708 - purple_plugin_disable @709 - purple_plugin_get_author @710 - purple_plugin_get_description @711 - purple_plugin_get_homepage @712 - purple_plugin_get_id @713 - purple_plugin_get_name @714 - purple_plugin_get_summary @715 - purple_plugin_get_version @716 - purple_plugin_ipc_call @717 - purple_plugin_ipc_get_params @718 - purple_plugin_ipc_register @719 - purple_plugin_ipc_unregister @720 - purple_plugin_ipc_unregister_all @721 - purple_plugin_is_loaded @722 - purple_plugin_is_unloadable @723 - purple_plugin_load @724 - purple_plugin_new @725 - purple_plugin_pref_add_choice @726 - purple_plugin_pref_destroy @727 - purple_plugin_pref_frame_add @728 - purple_plugin_pref_frame_destroy @729 - purple_plugin_pref_frame_get_prefs @730 - purple_plugin_pref_frame_new @731 - purple_plugin_pref_get_bounds @732 - purple_plugin_pref_get_choices @733 - purple_plugin_pref_get_format_type @734 - purple_plugin_pref_get_label @735 - purple_plugin_pref_get_masked @736 - purple_plugin_pref_get_max_length @737 - purple_plugin_pref_get_name @738 - purple_plugin_pref_get_type @739 - purple_plugin_pref_new @740 - purple_plugin_pref_new_with_label @741 - purple_plugin_pref_new_with_name @742 - purple_plugin_pref_new_with_name_and_label @743 - purple_plugin_pref_set_bounds @744 - purple_plugin_pref_set_format_type @745 - purple_plugin_pref_set_label @746 - purple_plugin_pref_set_masked @747 - purple_plugin_pref_set_max_length @748 - purple_plugin_pref_set_name @749 - purple_plugin_pref_set_type @750 - purple_plugin_probe @751 - purple_plugin_register @752 - purple_plugin_reload @753 - purple_plugin_unload @754 - purple_plugins_add_search_path @755 - purple_plugins_destroy_all @756 - purple_plugins_enabled @757 - purple_plugins_find_with_basename @758 - purple_plugins_find_with_filename @759 - purple_plugins_find_with_id @760 - purple_plugins_find_with_name @761 - purple_plugins_get_all @762 - purple_plugins_get_handle @763 - purple_plugins_get_loaded @764 - purple_plugins_get_protocols @765 - purple_plugins_init @766 - purple_plugins_load_saved @767 - purple_plugins_probe @768 - purple_plugins_register_load_notify_cb @769 - purple_plugins_register_probe_notify_cb @770 - purple_plugins_register_unload_notify_cb @771 - purple_plugins_save_loaded @772 - purple_plugins_uninit @773 - purple_plugins_unload_all @774 - purple_plugins_unregister_load_notify_cb @775 - purple_plugins_unregister_probe_notify_cb @776 - purple_plugins_unregister_unload_notify_cb @777 - purple_pmp_create_map @778 - purple_pmp_destroy_map @779 - purple_pmp_get_public_ip @780 - purple_pmp_init @781 - purple_pounce_action_get_attribute @782 - purple_pounce_action_is_enabled @783 - purple_pounce_action_register @784 - purple_pounce_action_set_attribute @785 - purple_pounce_action_set_enabled @786 - purple_pounce_destroy @787 - purple_pounce_destroy_all_by_account @788 - purple_pounce_execute @789 - purple_pounce_get_data @790 - purple_pounce_get_events @791 - purple_pounce_get_options @792 - purple_pounce_get_pouncee @793 - purple_pounce_get_pouncer @794 - purple_pounce_get_save @795 - purple_pounce_new @796 - purple_pounce_set_data @797 - purple_pounce_set_events @798 - purple_pounce_set_options @799 - purple_pounce_set_pouncee @800 - purple_pounce_set_pouncer @801 - purple_pounce_set_save @802 - purple_pounces_get_all @803 - purple_pounces_get_all_for_ui @804 - purple_pounces_get_handle @805 - purple_pounces_init @806 - purple_pounces_load @807 - purple_pounces_register_handler @808 - purple_pounces_uninit @809 - purple_pounces_unregister_handler @810 - purple_prefs_add_bool @811 - purple_prefs_add_int @812 - purple_prefs_add_none @813 - purple_prefs_add_path @814 - purple_prefs_add_path_list @815 - purple_prefs_add_string @816 - purple_prefs_add_string_list @817 - purple_prefs_connect_callback @818 - purple_prefs_destroy @819 - purple_prefs_disconnect_by_handle @820 - purple_prefs_disconnect_callback @821 - purple_prefs_exists @822 - purple_prefs_get_bool @823 - purple_prefs_get_children_names @824 - purple_prefs_get_handle @825 - purple_prefs_get_int @826 - purple_prefs_get_path @827 - purple_prefs_get_path_list @828 - purple_prefs_get_string @829 - purple_prefs_get_string_list @830 - purple_prefs_get_type @831 - purple_prefs_init @832 - purple_prefs_load @833 - purple_prefs_remove @834 - purple_prefs_rename @835 - purple_prefs_rename_boolean_toggle @836 - purple_prefs_set_bool @837 - purple_prefs_set_generic @838 - purple_prefs_set_int @839 - purple_prefs_set_path @840 - purple_prefs_set_path_list @841 - purple_prefs_set_string @842 - purple_prefs_set_string_list @843 - purple_prefs_trigger_callback @844 - purple_prefs_uninit @845 - purple_prefs_update_old @846 - purple_presence_add_list @847 - purple_presence_add_status @848 - purple_presence_compare @849 - purple_presence_destroy @850 - purple_presence_get_account @851 - purple_presence_get_active_status @852 - purple_presence_get_buddy @853 - purple_presence_get_chat_user @854 - purple_presence_get_context @855 - purple_presence_get_conversation @856 - purple_presence_get_idle_time @857 - purple_presence_get_login_time @858 - purple_presence_get_status @859 - purple_presence_get_statuses @860 - purple_presence_is_available @861 - purple_presence_is_idle @862 - purple_presence_is_online @863 - purple_presence_is_status_active @864 - purple_presence_is_status_primitive_active @865 - purple_presence_new @866 - purple_presence_new_for_account @867 - purple_presence_new_for_buddy @868 - purple_presence_new_for_conv @869 - purple_presence_set_idle @870 - purple_presence_set_login_time @871 - purple_presence_set_status_active @872 - purple_presence_switch_status @873 - purple_primitive_get_id_from_type @874 - purple_primitive_get_name_from_type @875 - purple_primitive_get_type_from_id @876 - purple_print_utf8_to_console @877 - purple_privacy_allow @878 - purple_privacy_check @879 - purple_privacy_deny @880 - purple_privacy_deny_add @881 - purple_privacy_deny_remove @882 - purple_privacy_get_ui_ops @883 - purple_privacy_init @884 - purple_privacy_permit_add @885 - purple_privacy_permit_remove @886 - purple_privacy_set_ui_ops @887 - purple_program_is_valid @888 - purple_proxy_connect @889 - purple_proxy_connect_cancel @890 - purple_proxy_connect_cancel_with_handle @891 - purple_proxy_connect_socks5 @892 - purple_proxy_get_handle @893 - purple_proxy_get_setup @894 - purple_proxy_info_destroy @895 - purple_proxy_info_get_host @896 - purple_proxy_info_get_password @897 - purple_proxy_info_get_port @898 - purple_proxy_info_get_type @899 - purple_proxy_info_get_username @900 - purple_proxy_info_new @901 - purple_proxy_info_set_host @902 - purple_proxy_info_set_password @903 - purple_proxy_info_set_port @904 - purple_proxy_info_set_type @905 - purple_proxy_info_set_username @906 - purple_proxy_init @907 - purple_proxy_uninit @908 - purple_prpl_change_account_status @909 - purple_prpl_get_statuses @910 - purple_prpl_got_account_idle @911 - purple_prpl_got_account_login_time @912 - purple_prpl_got_account_status @913 - purple_prpl_got_attention @914 - purple_prpl_got_attention_in_chat @915 - purple_prpl_got_user_idle @916 - purple_prpl_got_user_login_time @917 - purple_prpl_got_user_status @918 - purple_prpl_got_user_status_deactive @919 - purple_prpl_send_attention @920 - purple_quotedp_decode @921 - purple_request_action @922 - purple_request_action_varg @923 - purple_request_choice @924 - purple_request_choice_varg @925 - purple_request_close @926 - purple_request_close_with_handle @927 - purple_request_field_account_get_default_value @928 - purple_request_field_account_get_filter @929 - purple_request_field_account_get_show_all @930 - purple_request_field_account_get_value @931 - purple_request_field_account_new @932 - purple_request_field_account_set_default_value @933 - purple_request_field_account_set_filter @934 - purple_request_field_account_set_show_all @935 - purple_request_field_account_set_value @936 - purple_request_field_bool_get_default_value @937 - purple_request_field_bool_get_value @938 - purple_request_field_bool_new @939 - purple_request_field_bool_set_default_value @940 - purple_request_field_bool_set_value @941 - purple_request_field_choice_add @942 - purple_request_field_choice_get_default_value @943 - purple_request_field_choice_get_labels @944 - purple_request_field_choice_get_value @945 - purple_request_field_choice_new @946 - purple_request_field_choice_set_default_value @947 - purple_request_field_choice_set_value @948 - purple_request_field_destroy @949 - purple_request_field_get_id @950 - purple_request_field_get_label @951 - purple_request_field_get_type @952 - purple_request_field_get_type_hint @953 - purple_request_field_group_add_field @954 - purple_request_field_group_destroy @955 - purple_request_field_group_get_fields @956 - purple_request_field_group_get_title @957 - purple_request_field_group_new @958 - purple_request_field_image_get_buffer @959 - purple_request_field_image_get_scale_x @960 - purple_request_field_image_get_scale_y @961 - purple_request_field_image_get_size @962 - purple_request_field_image_new @963 - purple_request_field_image_set_scale @964 - purple_request_field_int_get_default_value @965 - purple_request_field_int_get_value @966 - purple_request_field_int_new @967 - purple_request_field_int_set_default_value @968 - purple_request_field_int_set_value @969 - purple_request_field_is_required @970 - purple_request_field_is_visible @971 - purple_request_field_label_new @972 - purple_request_field_list_add @973 - purple_request_field_list_add_selected @974 - purple_request_field_list_clear_selected @975 - purple_request_field_list_get_data @976 - purple_request_field_list_get_items @977 - purple_request_field_list_get_multi_select @978 - purple_request_field_list_get_selected @979 - purple_request_field_list_is_selected @980 - purple_request_field_list_new @981 - purple_request_field_list_set_multi_select @982 - purple_request_field_list_set_selected @983 - purple_request_field_new @984 - purple_request_field_set_label @985 - purple_request_field_set_required @986 - purple_request_field_set_type_hint @987 - purple_request_field_set_visible @988 - purple_request_field_string_get_default_value @989 - purple_request_field_string_get_value @990 - purple_request_field_string_is_editable @991 - purple_request_field_string_is_masked @992 - purple_request_field_string_is_multiline @993 - purple_request_field_string_new @994 - purple_request_field_string_set_default_value @995 - purple_request_field_string_set_editable @996 - purple_request_field_string_set_masked @997 - purple_request_field_string_set_value @998 - purple_request_fields @999 - purple_request_fields_add_group @1000 - purple_request_fields_all_required_filled @1001 - purple_request_fields_destroy @1002 - purple_request_fields_exists @1003 - purple_request_fields_get_account @1004 - purple_request_fields_get_bool @1005 - purple_request_fields_get_choice @1006 - purple_request_fields_get_field @1007 - purple_request_fields_get_groups @1008 - purple_request_fields_get_integer @1009 - purple_request_fields_get_required @1010 - purple_request_fields_get_string @1011 - purple_request_fields_is_field_required @1012 - purple_request_fields_new @1013 - purple_request_file @1014 - purple_request_folder @1015 - purple_request_get_ui_ops @1016 - purple_request_input @1017 - purple_request_set_ui_ops @1018 - purple_restore_default_signal_handlers @1019 - purple_roomlist_cancel_get_list @1020 - purple_roomlist_expand_category @1021 - purple_roomlist_field_get_hidden @1022 - purple_roomlist_field_get_label @1023 - purple_roomlist_field_get_type @1024 - purple_roomlist_field_new @1025 - purple_roomlist_get_fields @1026 - purple_roomlist_get_in_progress @1027 - purple_roomlist_get_list @1028 - purple_roomlist_get_ui_ops @1029 - purple_roomlist_new @1030 - purple_roomlist_ref @1031 - purple_roomlist_room_add @1032 - purple_roomlist_room_add_field @1033 - purple_roomlist_room_get_fields @1034 - purple_roomlist_room_get_name @1035 - purple_roomlist_room_get_parent @1036 - purple_roomlist_room_get_type @1037 - purple_roomlist_room_join @1038 - purple_roomlist_room_new @1039 - purple_roomlist_set_fields @1040 - purple_roomlist_set_in_progress @1041 - purple_roomlist_set_ui_ops @1042 - purple_roomlist_show_with_account @1043 - purple_roomlist_unref @1044 - purple_running_gnome @1045 - purple_running_kde @1046 - purple_running_osx @1047 - purple_savedstatus_activate @1048 - purple_savedstatus_activate_for_account @1049 - purple_savedstatus_delete @1050 - purple_savedstatus_delete_by_status @1051 - purple_savedstatus_find @1052 - purple_savedstatus_find_by_creation_time @1053 - purple_savedstatus_find_transient_by_type_and_message @1054 - purple_savedstatus_get_creation_time @1055 - purple_savedstatus_get_current @1056 - purple_savedstatus_get_default @1057 - purple_savedstatus_get_idleaway @1058 - purple_savedstatus_get_message @1059 - purple_savedstatus_get_startup @1060 - purple_savedstatus_get_substatus @1061 - purple_savedstatus_get_title @1062 - purple_savedstatus_get_type @1063 - purple_savedstatus_has_substatuses @1064 - purple_savedstatus_is_idleaway @1065 - purple_savedstatus_is_transient @1066 - purple_savedstatus_new @1067 - purple_savedstatus_set_idleaway @1068 - purple_savedstatus_set_message @1069 - purple_savedstatus_set_substatus @1070 - purple_savedstatus_set_title @1071 - purple_savedstatus_set_type @1072 - purple_savedstatus_substatus_get_message @1073 - purple_savedstatus_substatus_get_type @1074 - purple_savedstatus_unset_substatus @1075 - purple_savedstatuses_get_all @1076 - purple_savedstatuses_get_handle @1077 - purple_savedstatuses_get_popular @1078 - purple_savedstatuses_init @1079 - purple_savedstatuses_uninit @1080 - purple_serv_got_join_chat_failed @1081 - purple_serv_got_private_alias @1082 - purple_set_blist @1083 - purple_signal_connect @1084 - purple_signal_connect_priority @1085 - purple_signal_connect_priority_vargs @1086 - purple_signal_connect_vargs @1087 - purple_signal_disconnect @1088 - purple_signal_emit @1089 - purple_signal_emit_return_1 @1090 - purple_signal_emit_vargs @1091 - purple_signal_emit_vargs_return_1 @1092 - purple_signal_get_values @1093 - purple_signal_register @1094 - purple_signal_unregister @1095 - purple_signals_disconnect_by_handle @1096 - purple_signals_init @1097 - purple_signals_uninit @1098 - purple_signals_unregister_by_instance @1099 - purple_smiley_delete @1100 - purple_smiley_get_checksum @1101 - purple_smiley_get_data @1102 - purple_smiley_get_extension @1103 - purple_smiley_get_full_path @1104 - purple_smiley_get_shortcut @1105 - purple_smiley_get_stored_image @1106 - purple_smiley_get_type @1107 - purple_smiley_new @1108 - purple_smiley_new_from_file @1109 - purple_smiley_set_data @1110 - purple_smiley_set_shortcut @1111 - purple_smileys_find_by_checksum @1112 - purple_smileys_find_by_shortcut @1113 - purple_smileys_get_all @1114 - purple_smileys_get_storing_dir @1115 - purple_smileys_init @1116 - purple_smileys_uninit @1117 - purple_sound_get_ui_ops @1118 - purple_sound_init @1119 - purple_sound_play_event @1120 - purple_sound_play_file @1121 - purple_sound_set_ui_ops @1122 - purple_sound_uninit @1123 - purple_sounds_get_handle @1124 - purple_srv_cancel @1125 - purple_srv_resolve @1126 - purple_ssl_close @1127 - purple_ssl_connect @1128 - purple_ssl_connect_fd @1129 - purple_ssl_connect_with_host_fd @1130 - purple_ssl_get_ops @1131 - purple_ssl_get_peer_certificates @1132 - purple_ssl_init @1133 - purple_ssl_input_add @1134 - purple_ssl_is_supported @1135 - purple_ssl_read @1136 - purple_ssl_set_ops @1137 - purple_ssl_strerror @1138 - purple_ssl_uninit @1139 - purple_ssl_write @1140 - purple_status_attr_destroy @1141 - purple_status_attr_get_id @1142 - purple_status_attr_get_name @1143 - purple_status_attr_get_value @1144 - purple_status_attr_new @1145 - purple_status_compare @1146 - purple_status_destroy @1147 - purple_status_get_attr_boolean @1148 - purple_status_get_attr_int @1149 - purple_status_get_attr_string @1150 - purple_status_get_attr_value @1151 - purple_status_get_handle @1152 - purple_status_get_id @1153 - purple_status_get_name @1154 - purple_status_get_presence @1155 - purple_status_get_type @1156 - purple_status_init @1157 - purple_status_is_active @1158 - purple_status_is_available @1159 - purple_status_is_exclusive @1160 - purple_status_is_independent @1161 - purple_status_is_online @1162 - purple_status_new @1163 - purple_status_set_active @1164 - purple_status_set_active_with_attrs @1165 - purple_status_set_active_with_attrs_list @1166 - purple_status_set_attr_boolean @1167 - purple_status_set_attr_int @1168 - purple_status_set_attr_string @1169 - purple_status_type_add_attr @1170 - purple_status_type_add_attrs @1171 - purple_status_type_add_attrs_vargs @1172 - purple_status_type_destroy @1173 - purple_status_type_find_with_id @1174 - purple_status_type_get_attr @1175 - purple_status_type_get_attrs @1176 - purple_status_type_get_id @1177 - purple_status_type_get_name @1178 - purple_status_type_get_primary_attr @1179 - purple_status_type_get_primitive @1180 - purple_status_type_is_available @1181 - purple_status_type_is_exclusive @1182 - purple_status_type_is_independent @1183 - purple_status_type_is_saveable @1184 - purple_status_type_is_user_settable @1185 - purple_status_type_new @1186 - purple_status_type_new_full @1187 - purple_status_type_new_with_attrs @1188 - purple_status_type_set_primary_attr @1189 - purple_status_uninit @1190 - purple_str_add_cr @1191 - purple_str_binary_to_ascii @1192 - purple_str_has_prefix @1193 - purple_str_has_suffix @1194 - purple_str_seconds_to_string @1195 - purple_str_size_to_units @1196 - purple_str_strip_char @1197 - purple_str_to_time @1198 - purple_strcasereplace @1199 - purple_strcasestr @1200 - purple_strdup_withhtml @1201 - purple_stringref_cmp @1202 - purple_stringref_len @1203 - purple_stringref_new @1204 - purple_stringref_new_noref @1205 - purple_stringref_printf @1206 - purple_stringref_ref @1207 - purple_stringref_unref @1208 - purple_stringref_value @1209 - purple_strreplace @1210 - purple_stun_discover @1211 - purple_stun_init @1212 - purple_text_strip_mnemonic @1213 - purple_time_build @1214 - purple_time_format @1215 - purple_timeout_add @1216 - purple_timeout_add_seconds @1217 - purple_timeout_remove @1218 - purple_unescape_filename @1219 - purple_unescape_html @1220 - purple_upnp_cancel_port_mapping @1221 - purple_upnp_discover @1222 - purple_upnp_get_public_ip @1223 - purple_upnp_init @1224 - purple_upnp_remove_port_mapping @1225 - purple_upnp_set_port_mapping @1226 - purple_uri_list_extract_filenames @1227 - purple_uri_list_extract_uris @1228 - purple_url_decode @1229 - purple_url_encode @1230 - purple_url_parse @1231 - purple_user_dir @1232 - purple_utf8_has_word @1233 - purple_utf8_ncr_decode @1234 - purple_utf8_ncr_encode @1235 - purple_utf8_salvage @1236 - purple_utf8_strcasecmp @1237 - purple_utf8_strftime @1238 - purple_utf8_try_convert @1239 - purple_util_chrreplace @1240 - purple_util_fetch_url_cancel @1241 - purple_util_fetch_url_request @1242 - purple_util_fetch_url_request_len @1243 - purple_util_format_song_info @1244 - purple_util_get_image_checksum @1245 - purple_util_get_image_extension @1246 - purple_util_get_image_filename @1247 - purple_util_init @1248 - purple_util_read_xml_from_file @1249 - purple_util_set_current_song @1250 - purple_util_set_user_dir @1251 - purple_util_uninit @1252 - purple_util_write_data_to_file @1253 - purple_util_write_data_to_file_absolute @1254 - purple_value_destroy @1255 - purple_value_dup @1256 - purple_value_get_boolean @1257 - purple_value_get_boxed @1258 - purple_value_get_char @1259 - purple_value_get_enum @1260 - purple_value_get_int @1261 - purple_value_get_int64 @1262 - purple_value_get_long @1263 - purple_value_get_object @1264 - purple_value_get_pointer @1265 - purple_value_get_short @1266 - purple_value_get_specific_type @1267 - purple_value_get_string @1268 - purple_value_get_subtype @1269 - purple_value_get_type @1270 - purple_value_get_uchar @1271 - purple_value_get_uint @1272 - purple_value_get_uint64 @1273 - purple_value_get_ulong @1274 - purple_value_get_ushort @1275 - purple_value_is_outgoing @1276 - purple_value_new @1277 - purple_value_new_outgoing @1278 - purple_value_set_boolean @1279 - purple_value_set_boxed @1280 - purple_value_set_char @1281 - purple_value_set_enum @1282 - purple_value_set_int @1283 - purple_value_set_int64 @1284 - purple_value_set_long @1285 - purple_value_set_object @1286 - purple_value_set_pointer @1287 - purple_value_set_short @1288 - purple_value_set_string @1289 - purple_value_set_uchar @1290 - purple_value_set_uint @1291 - purple_value_set_uint64 @1292 - purple_value_set_ulong @1293 - purple_value_set_ushort @1294 - purple_version_check @1295 - purple_whiteboard_clear @1296 - purple_whiteboard_create @1297 - purple_whiteboard_destroy @1298 - purple_whiteboard_draw_line @1299 - purple_whiteboard_draw_list_destroy @1300 - purple_whiteboard_draw_point @1301 - purple_whiteboard_get_brush @1302 - purple_whiteboard_get_dimensions @1303 - purple_whiteboard_get_session @1304 - purple_whiteboard_send_brush @1305 - purple_whiteboard_send_clear @1306 - purple_whiteboard_send_draw_list @1307 - purple_whiteboard_set_brush @1308 - purple_whiteboard_set_dimensions @1309 - purple_whiteboard_set_prpl_ops @1310 - purple_whiteboard_set_ui_ops @1311 - purple_whiteboard_start @1312 - purple_xfer_add @1313 - purple_xfer_cancel_local @1314 - purple_xfer_cancel_remote @1315 - purple_xfer_conversation_write @1316 - purple_xfer_end @1317 - purple_xfer_error @1318 - purple_xfer_get_account @1319 - purple_xfer_get_bytes_remaining @1320 - purple_xfer_get_bytes_sent @1321 - purple_xfer_get_end_time @1322 - purple_xfer_get_filename @1323 - purple_xfer_get_local_filename @1324 - purple_xfer_get_local_port @1325 - purple_xfer_get_progress @1326 - purple_xfer_get_remote_ip @1327 - purple_xfer_get_remote_port @1328 - purple_xfer_get_remote_user @1329 - purple_xfer_get_size @1330 - purple_xfer_get_start_time @1331 - purple_xfer_get_status @1332 - purple_xfer_get_type @1333 - purple_xfer_get_ui_ops @1334 - purple_xfer_is_canceled @1335 - purple_xfer_is_completed @1336 - purple_xfer_new @1337 - purple_xfer_read @1338 - purple_xfer_ref @1339 - purple_xfer_request @1340 - purple_xfer_request_accepted @1341 - purple_xfer_request_denied @1342 - purple_xfer_set_ack_fnc @1343 - purple_xfer_set_bytes_sent @1344 - purple_xfer_set_cancel_recv_fnc @1345 - purple_xfer_set_cancel_send_fnc @1346 - purple_xfer_set_completed @1347 - purple_xfer_set_end_fnc @1348 - purple_xfer_set_filename @1349 - purple_xfer_set_init_fnc @1350 - purple_xfer_set_local_filename @1351 - purple_xfer_set_message @1352 - purple_xfer_set_read_fnc @1353 - purple_xfer_set_request_denied_fnc @1354 - purple_xfer_set_size @1355 - purple_xfer_set_start_fnc @1356 - purple_xfer_set_write_fnc @1357 - purple_xfer_start @1358 - purple_xfer_unref @1359 - purple_xfer_update_progress @1360 - purple_xfer_write @1361 - purple_xfers_get_all @1362 - purple_xfers_get_handle @1363 - purple_xfers_get_ui_ops @1364 - purple_xfers_init @1365 - purple_xfers_set_ui_ops @1366 - purple_xfers_uninit @1367 - serv_add_deny @1368 - serv_add_permit @1369 - serv_alias_buddy @1370 - serv_chat_invite @1371 - serv_chat_leave @1372 - serv_chat_send @1373 - serv_chat_whisper @1374 - serv_get_info @1375 - serv_got_alias @1376 - serv_got_attention @1377 - serv_got_chat_in @1378 - serv_got_chat_invite @1379 - serv_got_chat_left @1380 - serv_got_im @1381 - serv_got_joined_chat @1382 - serv_got_typing @1383 - serv_got_typing_stopped @1384 - serv_join_chat @1385 - serv_move_buddy @1386 - serv_reject_chat @1387 - serv_rem_deny @1388 - serv_rem_permit @1389 - serv_send_attention @1390 - serv_send_file @1391 - serv_send_im @1392 - serv_send_typing @1393 - serv_set_info @1394 - serv_set_permit_deny @1395 - wpurple_bind @1396 - wpurple_cleanup @1397 - wpurple_close @1398 - wpurple_connect @1399 - wpurple_data_dir @1400 - wpurple_escape_dirsep @1401 - wpurple_fcntl @1402 - wpurple_find_and_loadproc @1403 - wpurple_g_access @1404 - wpurple_g_io_channel_win32_new_socket @1405 - wpurple_get_special_folder @1406 - wpurple_get_timezone_abbreviation @1407 - wpurple_get_tz_offset @1408 - wpurple_gethostbyname @1409 - wpurple_gethostname @1410 - wpurple_getsockname @1411 - wpurple_getsockopt @1412 - wpurple_gettimeofday @1413 - wpurple_inet_aton @1414 - wpurple_inet_ntop @1415 - wpurple_init @1416 - wpurple_install_dir @1417 - wpurple_ioctl @1418 - wpurple_lib_dir @1419 - wpurple_listen @1420 - wpurple_locale_dir @1421 - wpurple_localtime_r @1422 - wpurple_read @1423 - wpurple_read_reg_dword @1424 - wpurple_read_reg_string @1425 - wpurple_recv @1426 - wpurple_rename @1427 - wpurple_send @1428 - wpurple_sendto @1429 - wpurple_setsockopt @1430 - wpurple_socket @1431 - wpurple_strerror @1432 - wpurple_write @1433 - wpurple_write_reg_string @1434 - xmlnode_copy @1435 - xmlnode_free @1436 - xmlnode_from_str @1437 - xmlnode_get_attrib @1438 - xmlnode_get_attrib_with_namespace @1439 - xmlnode_get_child @1440 - xmlnode_get_child_with_namespace @1441 - xmlnode_get_data @1442 - xmlnode_get_data_unescaped @1443 - xmlnode_get_namespace @1444 - xmlnode_get_next_twin @1445 - xmlnode_get_prefix @1446 - xmlnode_insert_child @1447 - xmlnode_insert_data @1448 - xmlnode_new @1449 - xmlnode_new_child @1450 - xmlnode_remove_attrib @1451 - xmlnode_remove_attrib_with_namespace @1452 - xmlnode_set_attrib @1453 - xmlnode_set_attrib_with_namespace @1454 - xmlnode_set_attrib_with_prefix @1455 - xmlnode_set_namespace @1456 - xmlnode_set_prefix @1457 - xmlnode_to_formatted_str @1458 - xmlnode_to_str @1459 \ No newline at end of file diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2068 +0,0 @@ -/** - * @file log.c Logging API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "account.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "internal.h" -#include "log.h" -#include "prefs.h" -#include "util.h" -#include "stringref.h" -#include "imgstore.h" -#include "time.h" - -static GSList *loggers = NULL; - -static PurpleLogLogger *html_logger; -static PurpleLogLogger *txt_logger; -static PurpleLogLogger *old_logger; - -struct _purple_logsize_user { - char *name; - PurpleAccount *account; -}; -static GHashTable *logsize_users = NULL; -static GHashTable *logsize_users_decayed = NULL; - -static void log_get_log_sets_common(GHashTable *sets); - -static gsize html_logger_write(PurpleLog *log, PurpleMessageFlags type, - const char *from, time_t time, const char *message); -static void html_logger_finalize(PurpleLog *log); -static GList *html_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account); -static GList *html_logger_list_syslog(PurpleAccount *account); -static char *html_logger_read(PurpleLog *log, PurpleLogReadFlags *flags); -static int html_logger_total_size(PurpleLogType type, const char *name, PurpleAccount *account); - -static GList *old_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account); -static int old_logger_total_size(PurpleLogType type, const char *name, PurpleAccount *account); -static char * old_logger_read (PurpleLog *log, PurpleLogReadFlags *flags); -static int old_logger_size (PurpleLog *log); -static void old_logger_get_log_sets(PurpleLogSetCallback cb, GHashTable *sets); -static void old_logger_finalize(PurpleLog *log); - -static gsize txt_logger_write(PurpleLog *log, - PurpleMessageFlags type, - const char *from, time_t time, const char *message); -static void txt_logger_finalize(PurpleLog *log); -static GList *txt_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account); -static GList *txt_logger_list_syslog(PurpleAccount *account); -static char *txt_logger_read(PurpleLog *log, PurpleLogReadFlags *flags); -static int txt_logger_total_size(PurpleLogType type, const char *name, PurpleAccount *account); - -/************************************************************************** - * PUBLIC LOGGING FUNCTIONS *********************************************** - **************************************************************************/ - -PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, - PurpleConversation *conv, time_t time, const struct tm *tm) -{ - PurpleLog *log; - - /* IMPORTANT: Make sure to initialize all the members of PurpleLog */ - log = g_slice_new(PurpleLog); - PURPLE_DBUS_REGISTER_POINTER(log, PurpleLog); - - log->type = type; - log->name = g_strdup(purple_normalize(account, name)); - log->account = account; - log->conv = conv; - log->time = time; - log->logger = purple_log_logger_get(); - log->logger_data = NULL; - - if (tm == NULL) - log->tm = NULL; - else - { - /* There's no need to zero this as we immediately do a direct copy. */ - log->tm = g_slice_new(struct tm); - - *(log->tm) = *tm; - -#ifdef HAVE_STRUCT_TM_TM_ZONE - /* XXX: This is so wrong... */ - if (log->tm->tm_zone != NULL) - { - char *tmp = g_locale_from_utf8(log->tm->tm_zone, -1, NULL, NULL, NULL); - if (tmp != NULL) - log->tm->tm_zone = tmp; - else - /* Just shove the UTF-8 bytes in and hope... */ - log->tm->tm_zone = g_strdup(log->tm->tm_zone); - } -#endif - } - - if (log->logger && log->logger->create) - log->logger->create(log); - return log; -} - -void purple_log_free(PurpleLog *log) -{ - g_return_if_fail(log); - if (log->logger && log->logger->finalize) - log->logger->finalize(log); - g_free(log->name); - - if (log->tm != NULL) - { -#ifdef HAVE_STRUCT_TM_TM_ZONE - /* XXX: This is so wrong... */ - g_free((char *)log->tm->tm_zone); -#endif - g_slice_free(struct tm, log->tm); - } - - PURPLE_DBUS_UNREGISTER_POINTER(log); - g_slice_free(PurpleLog, log); -} - -void purple_log_write(PurpleLog *log, PurpleMessageFlags type, - const char *from, time_t time, const char *message) -{ - struct _purple_logsize_user *lu; - gsize written, total = 0; - gpointer ptrsize; - - g_return_if_fail(log); - g_return_if_fail(log->logger); - g_return_if_fail(log->logger->write); - - written = (log->logger->write)(log, type, from, time, message); - - lu = g_new(struct _purple_logsize_user, 1); - - lu->name = g_strdup(purple_normalize(log->account, log->name)); - lu->account = log->account; - - if(g_hash_table_lookup_extended(logsize_users, lu, NULL, &ptrsize)) { - char *tmp = lu->name; - - total = GPOINTER_TO_INT(ptrsize); - total += written; - g_hash_table_replace(logsize_users, lu, GINT_TO_POINTER(total)); - - /* The hash table takes ownership of lu, so create a new one - * for the logsize_users_decayed check below. */ - lu = g_new(struct _purple_logsize_user, 1); - lu->name = g_strdup(tmp); - lu->account = log->account; - } - - if(g_hash_table_lookup_extended(logsize_users_decayed, lu, NULL, &ptrsize)) { - total = GPOINTER_TO_INT(ptrsize); - total += written; - g_hash_table_replace(logsize_users_decayed, lu, GINT_TO_POINTER(total)); - } else { - g_free(lu->name); - g_free(lu); - } -} - -char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - PurpleLogReadFlags mflags; - g_return_val_if_fail(log && log->logger, NULL); - if (log->logger->read) { - char *ret = (log->logger->read)(log, flags ? flags : &mflags); - purple_str_strip_char(ret, '\r'); - return ret; - } - return g_strdup(_("The logger has no read function")); -} - -int purple_log_get_size(PurpleLog *log) -{ - g_return_val_if_fail(log && log->logger, 0); - - if (log->logger->size) - return log->logger->size(log); - return 0; -} - -static guint _purple_logsize_user_hash(struct _purple_logsize_user *lu) -{ - return g_str_hash(lu->name); -} - -static guint _purple_logsize_user_equal(struct _purple_logsize_user *lu1, - struct _purple_logsize_user *lu2) -{ - return (lu1->account == lu2->account && purple_strequal(lu1->name, lu2->name)); -} - -static void _purple_logsize_user_free_key(struct _purple_logsize_user *lu) -{ - g_free(lu->name); - g_free(lu); -} - -int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account) -{ - gpointer ptrsize; - int size = 0; - GSList *n; - struct _purple_logsize_user *lu; - - lu = g_new(struct _purple_logsize_user, 1); - lu->name = g_strdup(purple_normalize(account, name)); - lu->account = account; - - if(g_hash_table_lookup_extended(logsize_users, lu, NULL, &ptrsize)) { - size = GPOINTER_TO_INT(ptrsize); - g_free(lu->name); - g_free(lu); - } else { - for (n = loggers; n; n = n->next) { - PurpleLogLogger *logger = n->data; - - if(logger->total_size){ - size += (logger->total_size)(type, name, account); - } else if(logger->list) { - GList *logs = (logger->list)(type, name, account); - int this_size = 0; - - while (logs) { - PurpleLog *log = (PurpleLog*)(logs->data); - this_size += purple_log_get_size(log); - purple_log_free(log); - logs = g_list_delete_link(logs, logs); - } - - size += this_size; - } - } - - g_hash_table_replace(logsize_users, lu, GINT_TO_POINTER(size)); - } - return size; -} - -gint purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account) -{ - gpointer ptrscore; - int score; - GSList *n; - struct _purple_logsize_user *lu; - time_t now; - time(&now); - - lu = g_new(struct _purple_logsize_user, 1); - lu->name = g_strdup(purple_normalize(account, name)); - lu->account = account; - - if(g_hash_table_lookup_extended(logsize_users_decayed, lu, NULL, &ptrscore)) { - score = GPOINTER_TO_INT(ptrscore); - g_free(lu->name); - g_free(lu); - } else { - double score_double = 0.0; - for (n = loggers; n; n = n->next) { - PurpleLogLogger *logger = n->data; - - if(logger->list) { - GList *logs = (logger->list)(type, name, account); - - while (logs) { - PurpleLog *log = (PurpleLog*)(logs->data); - /* Activity score counts bytes in the log, exponentially - decayed with a half-life of 14 days. */ - score_double += purple_log_get_size(log) * - pow(0.5, difftime(now, log->time)/1209600.0); - purple_log_free(log); - logs = g_list_delete_link(logs, logs); - } - } - } - - score = (gint)score_double; - g_hash_table_replace(logsize_users_decayed, lu, GINT_TO_POINTER(score)); - } - return score; -} - -gboolean purple_log_is_deletable(PurpleLog *log) -{ - g_return_val_if_fail(log != NULL, FALSE); - g_return_val_if_fail(log->logger != NULL, FALSE); - - if (log->logger->remove == NULL) - return FALSE; - - if (log->logger->is_deletable != NULL) - return log->logger->is_deletable(log); - - return TRUE; -} - -gboolean purple_log_delete(PurpleLog *log) -{ - g_return_val_if_fail(log != NULL, FALSE); - g_return_val_if_fail(log->logger != NULL, FALSE); - - if (log->logger->remove != NULL) - return log->logger->remove(log); - - return FALSE; -} - -char * -purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - const char *prpl_name; - char *acct_name; - const char *target; - char *dir; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!prpl) - return NULL; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - prpl_name = prpl_info->list_icon(account, NULL); - - acct_name = g_strdup(purple_escape_filename(purple_normalize(account, - purple_account_get_username(account)))); - - if (type == PURPLE_LOG_CHAT) { - char *temp = g_strdup_printf("%s.chat", purple_normalize(account, name)); - target = purple_escape_filename(temp); - g_free(temp); - } else if(type == PURPLE_LOG_SYSTEM) { - target = ".system"; - } else { - target = purple_escape_filename(purple_normalize(account, name)); - } - - dir = g_build_filename(purple_user_dir(), "logs", prpl_name, acct_name, target, NULL); - - g_free(acct_name); - - return dir; -} - -/**************************************************************************** - * LOGGER FUNCTIONS ********************************************************* - ****************************************************************************/ - -static PurpleLogLogger *current_logger = NULL; - -static void logger_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleLogLogger *logger; - GSList *l = loggers; - while (l) { - logger = l->data; - if (purple_strequal(logger->id, value)) { - purple_log_logger_set(logger); - return; - } - l = l->next; - } - purple_log_logger_set(txt_logger); -} - - -PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...) -{ -#if 0 - void(*create)(PurpleLog *), - gsize(*write)(PurpleLog *, PurpleMessageFlags, const char *, time_t, const char *), - void(*finalize)(PurpleLog *), - GList*(*list)(PurpleLogType type, const char*, PurpleAccount*), - char*(*read)(PurpleLog*, PurpleLogReadFlags*), - int(*size)(PurpleLog*), - int(*total_size)(PurpleLogType type, const char *name, PurpleAccount *account), - GList*(*list_syslog)(PurpleAccount *account), - void(*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets), - gboolean(*remove)(PurpleLog *log), - gboolean(*is_deletable)(PurpleLog *log)) -#endif - PurpleLogLogger *logger; - va_list args; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(functions >= 1, NULL); - - logger = g_new0(PurpleLogLogger, 1); - logger->id = g_strdup(id); - logger->name = g_strdup(name); - - va_start(args, functions); - - if (functions >= 1) - logger->create = va_arg(args, void *); - if (functions >= 2) - logger->write = va_arg(args, void *); - if (functions >= 3) - logger->finalize = va_arg(args, void *); - if (functions >= 4) - logger->list = va_arg(args, void *); - if (functions >= 5) - logger->read = va_arg(args, void *); - if (functions >= 6) - logger->size = va_arg(args, void *); - if (functions >= 7) - logger->total_size = va_arg(args, void *); - if (functions >= 8) - logger->list_syslog = va_arg(args, void *); - if (functions >= 9) - logger->get_log_sets = va_arg(args, void *); - if (functions >= 10) - logger->remove = va_arg(args, void *); - if (functions >= 11) - logger->is_deletable = va_arg(args, void *); - - if (functions >= 12) - purple_debug_info("log", "Dropping new functions for logger: %s (%s)\n", name, id); - - va_end(args); - - return logger; -} - -void purple_log_logger_free(PurpleLogLogger *logger) -{ - g_free(logger->name); - g_free(logger->id); - g_free(logger); -} - -void purple_log_logger_add (PurpleLogLogger *logger) -{ - g_return_if_fail(logger); - if (g_slist_find(loggers, logger)) - return; - loggers = g_slist_append(loggers, logger); - if (purple_strequal(purple_prefs_get_string("/purple/logging/format"), logger->id)) { - purple_prefs_trigger_callback("/purple/logging/format"); - } -} - -void purple_log_logger_remove (PurpleLogLogger *logger) -{ - g_return_if_fail(logger); - loggers = g_slist_remove(loggers, logger); -} - -void purple_log_logger_set (PurpleLogLogger *logger) -{ - g_return_if_fail(logger); - current_logger = logger; -} - -PurpleLogLogger *purple_log_logger_get() -{ - return current_logger; -} - -GList *purple_log_logger_get_options(void) -{ - GSList *n; - GList *list = NULL; - PurpleLogLogger *data; - - for (n = loggers; n; n = n->next) { - data = n->data; - if (!data->write) - continue; - list = g_list_append(list, data->name); - list = g_list_append(list, data->id); - } - - return list; -} - -gint purple_log_compare(gconstpointer y, gconstpointer z) -{ - const PurpleLog *a = y; - const PurpleLog *b = z; - - return b->time - a->time; -} - -GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account) -{ - GList *logs = NULL; - GSList *n; - for (n = loggers; n; n = n->next) { - PurpleLogLogger *logger = n->data; - if (!logger->list) - continue; - logs = g_list_concat(logger->list(type, name, account), logs); - } - - return g_list_sort(logs, purple_log_compare); -} - -gint purple_log_set_compare(gconstpointer y, gconstpointer z) -{ - const PurpleLogSet *a = y; - const PurpleLogSet *b = z; - gint ret = 0; - - /* This logic seems weird at first... - * If either account is NULL, we pretend the accounts are - * equal. This allows us to detect duplicates that will - * exist if one logger knows the account and another - * doesn't. */ - if (a->account != NULL && b->account != NULL) { - ret = strcmp(purple_account_get_username(a->account), purple_account_get_username(b->account)); - if (ret != 0) - return ret; - } - - ret = strcmp(a->normalized_name, b->normalized_name); - if (ret != 0) - return ret; - - return (gint)b->type - (gint)a->type; -} - -static guint -log_set_hash(gconstpointer key) -{ - const PurpleLogSet *set = key; - - /* The account isn't hashed because we need PurpleLogSets with NULL accounts - * to be found when we search by a PurpleLogSet that has a non-NULL account - * but the same type and name. */ - return g_int_hash(&set->type) + g_str_hash(set->name); -} - -static gboolean -log_set_equal(gconstpointer a, gconstpointer b) -{ - /* I realize that the choices made for GList and GHashTable - * make sense for those data types, but I wish the comparison - * functions were compatible. */ - return !purple_log_set_compare(a, b); -} - -static void -log_add_log_set_to_hash(GHashTable *sets, PurpleLogSet *set) -{ - PurpleLogSet *existing_set = g_hash_table_lookup(sets, set); - - if (existing_set == NULL) - g_hash_table_insert(sets, set, set); - else if (existing_set->account == NULL && set->account != NULL) - g_hash_table_replace(sets, set, set); - else - purple_log_set_free(set); -} - -GHashTable *purple_log_get_log_sets(void) -{ - GSList *n; - GHashTable *sets = g_hash_table_new_full(log_set_hash, log_set_equal, - (GDestroyNotify)purple_log_set_free, NULL); - - /* Get the log sets from all the loggers. */ - for (n = loggers; n; n = n->next) { - PurpleLogLogger *logger = n->data; - - if (!logger->get_log_sets) - continue; - - logger->get_log_sets(log_add_log_set_to_hash, sets); - } - - log_get_log_sets_common(sets); - - /* Return the GHashTable of unique PurpleLogSets. */ - return sets; -} - -void purple_log_set_free(PurpleLogSet *set) -{ - g_return_if_fail(set != NULL); - - g_free(set->name); - if (set->normalized_name != set->name) - g_free(set->normalized_name); - - g_slice_free(PurpleLogSet, set); -} - -GList *purple_log_get_system_logs(PurpleAccount *account) -{ - GList *logs = NULL; - GSList *n; - for (n = loggers; n; n = n->next) { - PurpleLogLogger *logger = n->data; - if (!logger->list_syslog) - continue; - logs = g_list_concat(logger->list_syslog(account), logs); - } - - return g_list_sort(logs, purple_log_compare); -} - -/**************************************************************************** - * LOG SUBSYSTEM ************************************************************ - ****************************************************************************/ - -void * -purple_log_get_handle(void) -{ - static int handle; - - return &handle; -} - -void purple_log_init(void) -{ - void *handle = purple_log_get_handle(); - - purple_prefs_add_none("/purple/logging"); - purple_prefs_add_bool("/purple/logging/log_ims", TRUE); - purple_prefs_add_bool("/purple/logging/log_chats", TRUE); - purple_prefs_add_bool("/purple/logging/log_system", FALSE); - - purple_prefs_add_string("/purple/logging/format", "html"); - - html_logger = purple_log_logger_new("html", _("HTML"), 11, - NULL, - html_logger_write, - html_logger_finalize, - html_logger_list, - html_logger_read, - purple_log_common_sizer, - html_logger_total_size, - html_logger_list_syslog, - NULL, - purple_log_common_deleter, - purple_log_common_is_deletable); - purple_log_logger_add(html_logger); - - txt_logger = purple_log_logger_new("txt", _("Plain text"), 11, - NULL, - txt_logger_write, - txt_logger_finalize, - txt_logger_list, - txt_logger_read, - purple_log_common_sizer, - txt_logger_total_size, - txt_logger_list_syslog, - NULL, - purple_log_common_deleter, - purple_log_common_is_deletable); - purple_log_logger_add(txt_logger); - - old_logger = purple_log_logger_new("old", _("Old flat format"), 9, - NULL, - NULL, - old_logger_finalize, - old_logger_list, - old_logger_read, - old_logger_size, - old_logger_total_size, - NULL, - old_logger_get_log_sets); - purple_log_logger_add(old_logger); - - purple_signal_register(handle, "log-timestamp", -#if SIZEOF_TIME_T == 4 - purple_marshal_POINTER__POINTER_INT_BOOLEAN, -#elif SIZEOF_TIME_T == 8 - purple_marshal_POINTER__POINTER_INT64_BOOLEAN, -#else -#error Unknown size of time_t -#endif - purple_value_new(PURPLE_TYPE_STRING), 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_LOG), -#if SIZEOF_TIME_T == 4 - purple_value_new(PURPLE_TYPE_INT), -#elif SIZEOF_TIME_T == 8 - purple_value_new(PURPLE_TYPE_INT64), -#else -# error Unknown size of time_t -#endif - purple_value_new(PURPLE_TYPE_BOOLEAN)); - - purple_prefs_connect_callback(NULL, "/purple/logging/format", - logger_pref_cb, NULL); - purple_prefs_trigger_callback("/purple/logging/format"); - - logsize_users = g_hash_table_new_full((GHashFunc)_purple_logsize_user_hash, - (GEqualFunc)_purple_logsize_user_equal, - (GDestroyNotify)_purple_logsize_user_free_key, NULL); - logsize_users_decayed = g_hash_table_new_full((GHashFunc)_purple_logsize_user_hash, - (GEqualFunc)_purple_logsize_user_equal, - (GDestroyNotify)_purple_logsize_user_free_key, NULL); -} - -void -purple_log_uninit(void) -{ - purple_signals_unregister_by_instance(purple_log_get_handle()); - - purple_log_logger_remove(html_logger); - purple_log_logger_free(html_logger); - html_logger = NULL; - - purple_log_logger_remove(txt_logger); - purple_log_logger_free(txt_logger); - txt_logger = NULL; - - purple_log_logger_remove(old_logger); - purple_log_logger_free(old_logger); - old_logger = NULL; - - g_hash_table_destroy(logsize_users); - g_hash_table_destroy(logsize_users_decayed); -} - -/**************************************************************************** - * LOGGERS ****************************************************************** - ****************************************************************************/ - -static char *log_get_timestamp(PurpleLog *log, time_t when) -{ - gboolean show_date; - char *date; - struct tm tm; - - show_date = (log->type == PURPLE_LOG_SYSTEM) || (time(NULL) > when + 20*60); - - date = purple_signal_emit_return_1(purple_log_get_handle(), - "log-timestamp", - log, when, show_date); - if (date != NULL) - return date; - - tm = *(localtime(&when)); - if (show_date) - return g_strdup(purple_date_format_long(&tm)); - else - return g_strdup(purple_time_format(&tm)); -} - -/* NOTE: This can return msg (which you may or may not want to g_free()) - * NOTE: or a newly allocated string which you MUST g_free(). */ -static char * -convert_image_tags(const PurpleLog *log, const char *msg) -{ - const char *tmp; - const char *start; - const char *end; - GData *attributes; - GString *newmsg = NULL; - - tmp = msg; - - while (purple_markup_find_tag("img", tmp, &start, &end, &attributes)) { - int imgid = 0; - char *idstr = NULL; - - if (newmsg == NULL) - newmsg = g_string_new(""); - - /* copy any text before the img tag */ - if (tmp < start) - g_string_append_len(newmsg, tmp, start - tmp); - - if ((idstr = g_datalist_get_data(&attributes, "id")) != NULL) - imgid = atoi(idstr); - - if (imgid != 0) - { - FILE *image_file; - char *dir; - PurpleStoredImage *image; - gconstpointer image_data; - char *new_filename = NULL; - char *path = NULL; - size_t image_byte_count; - - image = purple_imgstore_find_by_id(imgid); - if (image == NULL) - { - /* This should never happen. */ - /* This *does* happen for failed Direct-IMs -DAA */ - g_string_free(newmsg, TRUE); - g_return_val_if_reached((char *)msg); - } - - image_data = purple_imgstore_get_data(image); - image_byte_count = purple_imgstore_get_size(image); - dir = purple_log_get_log_dir(log->type, log->name, log->account); - new_filename = purple_util_get_image_filename(image_data, image_byte_count); - - path = g_build_filename(dir, new_filename, NULL); - - /* Only save unique files. */ - if (!g_file_test(path, G_FILE_TEST_EXISTS)) - { - if ((image_file = g_fopen(path, "wb")) != NULL) - { - if (!fwrite(image_data, image_byte_count, 1, image_file)) - { - purple_debug_error("log", "Error writing %s: %s\n", - path, g_strerror(errno)); - fclose(image_file); - - /* Attempt to not leave half-written files around. */ - unlink(path); - } - else - { - purple_debug_info("log", "Wrote image file: %s\n", path); - fclose(image_file); - } - } - else - { - purple_debug_error("log", "Unable to create file %s: %s\n", - path, g_strerror(errno)); - } - } - - /* Write the new image tag */ - g_string_append_printf(newmsg, "", new_filename); - g_free(new_filename); - g_free(path); - } - - /* Continue from the end of the tag */ - tmp = end + 1; - } - - if (newmsg == NULL) - { - /* No images were found to change. */ - return (char *)msg; - } - - /* Append any remaining message data */ - g_string_append(newmsg, tmp); - - return g_string_free(newmsg, FALSE); -} - -void purple_log_common_writer(PurpleLog *log, const char *ext) -{ - PurpleLogCommonLoggerData *data = log->logger_data; - - if (data == NULL) - { - /* This log is new */ - char *dir; - struct tm *tm; - const char *tz; - const char *date; - char *filename; - char *path; - - dir = purple_log_get_log_dir(log->type, log->name, log->account); - if (dir == NULL) - return; - - purple_build_dir (dir, S_IRUSR | S_IWUSR | S_IXUSR); - - tm = localtime(&log->time); - tz = purple_escape_filename(purple_utf8_strftime("%Z", tm)); - date = purple_utf8_strftime("%Y-%m-%d.%H%M%S%z", tm); - - filename = g_strdup_printf("%s%s%s", date, tz, ext ? ext : ""); - - path = g_build_filename(dir, filename, NULL); - g_free(dir); - g_free(filename); - - log->logger_data = data = g_slice_new0(PurpleLogCommonLoggerData); - - data->file = g_fopen(path, "a"); - if (data->file == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "log", - "Could not create log file %s\n", path); - - if (log->conv != NULL) - purple_conversation_write(log->conv, NULL, _("Logging of this conversation failed."), - PURPLE_MESSAGE_ERROR, time(NULL)); - - g_free(path); - return; - } - g_free(path); - } -} - -GList *purple_log_common_lister(PurpleLogType type, const char *name, PurpleAccount *account, const char *ext, PurpleLogLogger *logger) -{ - GDir *dir; - GList *list = NULL; - const char *filename; - char *path; - - if(!account) - return NULL; - - path = purple_log_get_log_dir(type, name, account); - if (path == NULL) - return NULL; - - if (!(dir = g_dir_open(path, 0, NULL))) - { - g_free(path); - return NULL; - } - - while ((filename = g_dir_read_name(dir))) - { - if (purple_str_has_suffix(filename, ext) && - strlen(filename) >= (17 + strlen(ext))) - { - PurpleLog *log; - PurpleLogCommonLoggerData *data; - struct tm tm; -#if defined (HAVE_TM_GMTOFF) && defined (HAVE_STRUCT_TM_TM_ZONE) - long tz_off; - const char *rest, *end; - time_t stamp = purple_str_to_time(purple_unescape_filename(filename), FALSE, &tm, &tz_off, &rest); - - /* As zero is a valid offset, PURPLE_NO_TZ_OFF means no offset was - * provided. See util.h. Yes, it's kinda ugly. */ - if (tz_off != PURPLE_NO_TZ_OFF) - tm.tm_gmtoff = tz_off - tm.tm_gmtoff; - - if (stamp == 0 || rest == NULL || (end = strchr(rest, '.')) == NULL || strchr(rest, ' ') != NULL) - { - log = purple_log_new(type, name, account, NULL, stamp, NULL); - } - else - { - char *tmp = g_strndup(rest, end - rest); - tm.tm_zone = tmp; - log = purple_log_new(type, name, account, NULL, stamp, &tm); - g_free(tmp); - } -#else - time_t stamp = purple_str_to_time(filename, FALSE, &tm, NULL, NULL); - - log = purple_log_new(type, name, account, NULL, stamp, (stamp != 0) ? &tm : NULL); -#endif - - log->logger = logger; - log->logger_data = data = g_slice_new0(PurpleLogCommonLoggerData); - - data->path = g_build_filename(path, filename, NULL); - list = g_list_prepend(list, log); - } - } - g_dir_close(dir); - g_free(path); - return list; -} - -int purple_log_common_total_sizer(PurpleLogType type, const char *name, PurpleAccount *account, const char *ext) -{ - GDir *dir; - int size = 0; - const char *filename; - char *path; - - if(!account) - return 0; - - path = purple_log_get_log_dir(type, name, account); - if (path == NULL) - return 0; - - if (!(dir = g_dir_open(path, 0, NULL))) - { - g_free(path); - return 0; - } - - while ((filename = g_dir_read_name(dir))) - { - if (purple_str_has_suffix(filename, ext) && - strlen(filename) >= (17 + strlen(ext))) - { - char *tmp = g_build_filename(path, filename, NULL); - struct stat st; - if (g_stat(tmp, &st)) - { - purple_debug_error("log", "Error stating log file: %s\n", tmp); - g_free(tmp); - continue; - } - g_free(tmp); - size += st.st_size; - } - } - g_dir_close(dir); - g_free(path); - return size; -} - -int purple_log_common_sizer(PurpleLog *log) -{ - struct stat st; - PurpleLogCommonLoggerData *data = log->logger_data; - - g_return_val_if_fail(data != NULL, 0); - - if (!data->path || g_stat(data->path, &st)) - st.st_size = 0; - - return st.st_size; -} - -/* This will build log sets for all loggers that use the common logger - * functions because they use the same directory structure. */ -static void log_get_log_sets_common(GHashTable *sets) -{ - gchar *log_path = g_build_filename(purple_user_dir(), "logs", NULL); - GDir *log_dir = g_dir_open(log_path, 0, NULL); - const gchar *protocol; - - if (log_dir == NULL) { - g_free(log_path); - return; - } - - while ((protocol = g_dir_read_name(log_dir)) != NULL) { - gchar *protocol_path = g_build_filename(log_path, protocol, NULL); - GDir *protocol_dir; - const gchar *username; - gchar *protocol_unescaped; - GList *account_iter; - GList *accounts = NULL; - - if ((protocol_dir = g_dir_open(protocol_path, 0, NULL)) == NULL) { - g_free(protocol_path); - continue; - } - - /* Using g_strdup() to cover the one-in-a-million chance that a - * prpl's list_icon function uses purple_unescape_filename(). */ - protocol_unescaped = g_strdup(purple_unescape_filename(protocol)); - - /* Find all the accounts for protocol. */ - for (account_iter = purple_accounts_get_all() ; account_iter != NULL ; account_iter = account_iter->next) { - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - prpl = purple_find_prpl(purple_account_get_protocol_id((PurpleAccount *)account_iter->data)); - if (!prpl) - continue; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (purple_strequal(protocol_unescaped, prpl_info->list_icon((PurpleAccount *)account_iter->data, NULL))) - accounts = g_list_prepend(accounts, account_iter->data); - } - g_free(protocol_unescaped); - - while ((username = g_dir_read_name(protocol_dir)) != NULL) { - gchar *username_path = g_build_filename(protocol_path, username, NULL); - GDir *username_dir; - const gchar *username_unescaped; - PurpleAccount *account = NULL; - gchar *name; - - if ((username_dir = g_dir_open(username_path, 0, NULL)) == NULL) { - g_free(username_path); - continue; - } - - /* Find the account for username in the list of accounts for protocol. */ - username_unescaped = purple_unescape_filename(username); - for (account_iter = g_list_first(accounts) ; account_iter != NULL ; account_iter = account_iter->next) { - if (purple_strequal(((PurpleAccount *)account_iter->data)->username, username_unescaped)) { - account = account_iter->data; - break; - } - } - - /* Don't worry about the cast, name will point to dynamically allocated memory shortly. */ - while ((name = (gchar *)g_dir_read_name(username_dir)) != NULL) { - size_t len; - PurpleLogSet *set; - - /* IMPORTANT: Always initialize all members of PurpleLogSet */ - set = g_slice_new(PurpleLogSet); - - /* Unescape the filename. */ - name = g_strdup(purple_unescape_filename(name)); - - /* Get the (possibly new) length of name. */ - len = strlen(name); - - set->type = PURPLE_LOG_IM; - set->name = name; - set->account = account; - /* set->buddy is always set below */ - set->normalized_name = g_strdup(purple_normalize(account, name)); - - /* Check for .chat or .system at the end of the name to determine the type. */ - if (len >= 7) { - gchar *tmp = &name[len - 7]; - if (purple_strequal(tmp, ".system")) { - set->type = PURPLE_LOG_SYSTEM; - *tmp = '\0'; - } - } - if (len > 5) { - gchar *tmp = &name[len - 5]; - if (purple_strequal(tmp, ".chat")) { - set->type = PURPLE_LOG_CHAT; - *tmp = '\0'; - } - } - - /* Determine if this (account, name) combination exists as a buddy. */ - if (account != NULL && name != NULL && *name != '\0') - set->buddy = (purple_find_buddy(account, name) != NULL); - else - set->buddy = FALSE; - - log_add_log_set_to_hash(sets, set); - } - g_free(username_path); - g_dir_close(username_dir); - } - g_free(protocol_path); - g_dir_close(protocol_dir); - } - g_free(log_path); - g_dir_close(log_dir); -} - -gboolean purple_log_common_deleter(PurpleLog *log) -{ - PurpleLogCommonLoggerData *data; - int ret; - - g_return_val_if_fail(log != NULL, FALSE); - - data = log->logger_data; - if (data == NULL) - return FALSE; - - if (data->path == NULL) - return FALSE; - - ret = g_unlink(data->path); - if (ret == 0) - return TRUE; - else if (ret == -1) - { - purple_debug_error("log", "Failed to delete: %s - %s\n", data->path, g_strerror(errno)); - } - else - { - /* I'm not sure that g_unlink() will ever return - * something other than 0 or -1. -- rlaager */ - purple_debug_error("log", "Failed to delete: %s\n", data->path); - } - - return FALSE; -} - -gboolean purple_log_common_is_deletable(PurpleLog *log) -{ - PurpleLogCommonLoggerData *data; -#ifndef _WIN32 - gchar *dirname; -#endif - - g_return_val_if_fail(log != NULL, FALSE); - - data = log->logger_data; - if (data == NULL) - return FALSE; - - if (data->path == NULL) - return FALSE; - -#ifndef _WIN32 - dirname = g_path_get_dirname(data->path); - if (g_access(dirname, W_OK) == 0) - { - g_free(dirname); - return TRUE; - } - purple_debug_info("log", "access(%s) failed: %s\n", dirname, g_strerror(errno)); - g_free(dirname); -#else - /* Unless and until someone writes equivalent win32 code, - * we'll assume the file is deletable. */ - return TRUE; -#endif - - return FALSE; -} - -static char *process_txt_log(char *txt, char *to_free) -{ - char *tmp; - - /* The to_free argument allows us to save a - * g_strdup() in some cases. */ - - if (to_free == NULL) - to_free = txt; - - /* g_markup_escape_text requires valid UTF-8 */ - if (!g_utf8_validate(txt, -1, NULL)) - { - tmp = purple_utf8_salvage(txt); - g_free(to_free); - to_free = txt = tmp; - } - - tmp = g_markup_escape_text(txt, -1); - g_free(to_free); - txt = purple_markup_linkify(tmp); - g_free(tmp); - - return txt; -} - -#if 0 /* Maybe some other time. */ -/**************** - ** XML LOGGER ** - ****************/ - -static const char *str_from_msg_type (PurpleMessageFlags type) -{ - - return ""; - -} - -static void xml_logger_write(PurpleLog *log, - PurpleMessageFlags type, - const char *from, time_t time, const char *message) -{ - char *xhtml = NULL; - - if (!log->logger_data) { - /* This log is new. We could use the loggers 'new' function, but - * creating a new file there would result in empty files in the case - * that you open a convo with someone, but don't say anything. - */ - struct tm *tm; - const char *tz; - const char *date; - char *dir = purple_log_get_log_dir(log->type, log->name, log->account); - char *name; - char *filename; - - if (dir == NULL) - return; - - tm = localtime(&log->time); - tz = purple_escape_filename(purple_utf8_strftime("%Z", tm); - date = purple_utf8_strftime("%Y-%m-%d.%H%M%S%z", tm); - - name = g_strdup_printf("%s%s%s", date, tz, ext ? ext : ""); - - purple_build_dir (dir, S_IRUSR | S_IWUSR | S_IXUSR); - - filename = g_build_filename(dir, name, NULL); - g_free(dir); - g_free(name); - - log->logger_data = g_fopen(filename, "a"); - if (!log->logger_data) { - purple_debug(PURPLE_DEBUG_ERROR, "log", "Could not create log file %s\n", filename); - g_free(filename); - return; - } - g_free(filename); - fprintf(log->logger_data, "\n" - "\n"); - - date = purple_utf8_strftime("%Y-%m-%d %H:%M:%S", localtime(&log->time)); - fprintf(log->logger_data, "\n", - date, log->name, prpl); - } - - /* if we can't write to the file, give up before we hurt ourselves */ - if(!data->file) - return; - - date = log_get_timestamp(log, time); - - purple_markup_html_to_xhtml(message, &xhtml, NULL); - if (from) - fprintf(log->logger_data, "%s\n", - str_from_msg_type(type), - type & PURPLE_MESSAGE_SEND ? "direction='sent'" : - type & PURPLE_MESSAGE_RECV ? "direction='received'" : "", - from, date, xhtml); - else - fprintf(log->logger_data, "%s\n", - str_from_msg_type(type), - type & PURPLE_MESSAGE_SEND ? "direction='sent'" : - type & PURPLE_MESSAGE_RECV ? "direction='received'" : "", - date, xhtml): - fflush(log->logger_data); - g_free(date); - g_free(xhtml); -} - - static void xml_logger_finalize(PurpleLog *log) -{ - if (log->logger_data) { - fprintf(log->logger_data, "\n"); - fclose(log->logger_data); - log->logger_data = NULL; - } -} - -static GList *xml_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - return purple_log_common_lister(type, sn, account, ".xml", &xml_logger); -} - -static PurpleLogLogger xml_logger = { - N_("XML"), "xml", - NULL, - xml_logger_write, - xml_logger_finalize, - xml_logger_list, - NULL, - NULL, - NULL -}; -#endif - -/**************************** - ** HTML LOGGER ************* - ****************************/ - -static gsize html_logger_write(PurpleLog *log, PurpleMessageFlags type, - const char *from, time_t time, const char *message) -{ - char *msg_fixed; - char *image_corrected_msg; - char *date; - char *header; - char *escaped_from; - PurplePlugin *plugin = purple_find_prpl(purple_account_get_protocol_id(log->account)); - PurpleLogCommonLoggerData *data = log->logger_data; - gsize written = 0; - return 0; - if(!data) { - const char *prpl = - PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL); - const char *date; - purple_log_common_writer(log, ".html"); - - data = log->logger_data; - - /* if we can't write to the file, give up before we hurt ourselves */ - if(!data->file) - return 0; - - date = purple_date_format_full(localtime(&log->time)); - - written += fprintf(data->file, ""); - written += fprintf(data->file, ""); - written += fprintf(data->file, ""); - if (log->type == PURPLE_LOG_SYSTEM) - header = g_strdup_printf("System log for account %s (%s) connected at %s", - purple_account_get_username(log->account), prpl, date); - else - header = g_strdup_printf("Conversation with %s at %s on %s (%s)", - log->name, date, purple_account_get_username(log->account), prpl); - - written += fprintf(data->file, "%s", header); - written += fprintf(data->file, ""); - written += fprintf(data->file, "

%s

\n", header); - g_free(header); - } - - /* if we can't write to the file, give up before we hurt ourselves */ - if(!data->file) - return 0; - - escaped_from = g_markup_escape_text(from, -1); - - image_corrected_msg = convert_image_tags(log, message); - purple_markup_html_to_xhtml(image_corrected_msg, &msg_fixed, NULL); - - /* Yes, this breaks encapsulation. But it's a static function and - * this saves a needless strdup(). */ - if (image_corrected_msg != message) - g_free(image_corrected_msg); - - date = log_get_timestamp(log, time); - - if(log->type == PURPLE_LOG_SYSTEM){ - written += fprintf(data->file, "---- %s @ %s ----
\n", msg_fixed, date); - } else { - if (type & PURPLE_MESSAGE_SYSTEM) - written += fprintf(data->file, "(%s) %s
\n", date, msg_fixed); - else if (type & PURPLE_MESSAGE_RAW) - written += fprintf(data->file, "(%s) %s
\n", date, msg_fixed); - else if (type & PURPLE_MESSAGE_ERROR) - written += fprintf(data->file, "(%s) %s
\n", date, msg_fixed); - else if (type & PURPLE_MESSAGE_WHISPER) - written += fprintf(data->file, "(%s) %s: %s
\n", - date, escaped_from, msg_fixed); - else if (type & PURPLE_MESSAGE_AUTO_RESP) { - if (type & PURPLE_MESSAGE_SEND) - written += fprintf(data->file, _("(%s) %s <AUTO-REPLY>: %s
\n"), date, escaped_from, msg_fixed); - else if (type & PURPLE_MESSAGE_RECV) - written += fprintf(data->file, _("(%s) %s <AUTO-REPLY>: %s
\n"), date, escaped_from, msg_fixed); - } else if (type & PURPLE_MESSAGE_RECV) { - if(purple_message_meify(msg_fixed, -1)) - written += fprintf(data->file, "(%s) ***%s %s
\n", - date, escaped_from, msg_fixed); - else - written += fprintf(data->file, "(%s) %s: %s
\n", - date, escaped_from, msg_fixed); - } else if (type & PURPLE_MESSAGE_SEND) { - if(purple_message_meify(msg_fixed, -1)) - written += fprintf(data->file, "(%s) ***%s %s
\n", - date, escaped_from, msg_fixed); - else - written += fprintf(data->file, "(%s) %s: %s
\n", - date, escaped_from, msg_fixed); - } else { - purple_debug_error("log", "Unhandled message type.\n"); - written += fprintf(data->file, "(%s) %s: %s
\n", - date, escaped_from, msg_fixed); - } - } - g_free(date); - g_free(msg_fixed); - g_free(escaped_from); - fflush(data->file); - - return written; -} - -static void html_logger_finalize(PurpleLog *log) -{ - PurpleLogCommonLoggerData *data = log->logger_data; - if (data) { - if(data->file) { - fprintf(data->file, "\n"); - fclose(data->file); - } - g_free(data->path); - - g_slice_free(PurpleLogCommonLoggerData, data); - } -} - -static GList *html_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - return purple_log_common_lister(type, sn, account, ".html", html_logger); -} - -static GList *html_logger_list_syslog(PurpleAccount *account) -{ - return purple_log_common_lister(PURPLE_LOG_SYSTEM, ".system", account, ".html", html_logger); -} - -static char *html_logger_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - char *read; - PurpleLogCommonLoggerData *data = log->logger_data; - *flags = PURPLE_LOG_READ_NO_NEWLINE; - if (!data || !data->path) - return g_strdup(_("Unable to find log path!")); - if (g_file_get_contents(data->path, &read, NULL, NULL)) { - char *minus_header = strchr(read, '\n'); - - if (!minus_header) - return read; - - minus_header = g_strdup(minus_header + 1); - g_free(read); - - return minus_header; - } - return g_strdup_printf(_("Could not read file: %s"), data->path); -} - -static int html_logger_total_size(PurpleLogType type, const char *name, PurpleAccount *account) -{ - return purple_log_common_total_sizer(type, name, account, ".html"); -} - - -/**************************** - ** PLAIN TEXT LOGGER ******* - ****************************/ - -static gsize txt_logger_write(PurpleLog *log, - PurpleMessageFlags type, - const char *from, time_t time, const char *message) -{ - char *date; - PurplePlugin *plugin = purple_find_prpl(purple_account_get_protocol_id(log->account)); - PurpleLogCommonLoggerData *data = log->logger_data; - char *stripped = NULL; - - gsize written = 0; - - if (data == NULL) { - /* This log is new. We could use the loggers 'new' function, but - * creating a new file there would result in empty files in the case - * that you open a convo with someone, but don't say anything. - */ - const char *prpl = - PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL); - purple_log_common_writer(log, ".txt"); - - data = log->logger_data; - - /* if we can't write to the file, give up before we hurt ourselves */ - if(!data->file) - return 0; - - if (log->type == PURPLE_LOG_SYSTEM) - written += fprintf(data->file, "System log for account %s (%s) connected at %s\n", - purple_account_get_username(log->account), prpl, - purple_date_format_full(localtime(&log->time))); - else - written += fprintf(data->file, "Conversation with %s at %s on %s (%s)\n", - log->name, purple_date_format_full(localtime(&log->time)), - purple_account_get_username(log->account), prpl); - } - - /* if we can't write to the file, give up before we hurt ourselves */ - if(!data->file) - return 0; - - stripped = purple_markup_strip_html(message); - date = log_get_timestamp(log, time); - - if(log->type == PURPLE_LOG_SYSTEM){ - written += fprintf(data->file, "---- %s @ %s ----\n", stripped, date); - } else { - if (type & PURPLE_MESSAGE_SEND || - type & PURPLE_MESSAGE_RECV) { - if (type & PURPLE_MESSAGE_AUTO_RESP) { - written += fprintf(data->file, _("(%s) %s : %s\n"), date, - from, stripped); - } else { - if(purple_message_meify(stripped, -1)) - written += fprintf(data->file, "(%s) ***%s %s\n", date, from, - stripped); - else - written += fprintf(data->file, "(%s) %s: %s\n", date, from, - stripped); - } - } else if (type & PURPLE_MESSAGE_SYSTEM || - type & PURPLE_MESSAGE_ERROR || - type & PURPLE_MESSAGE_RAW) - written += fprintf(data->file, "(%s) %s\n", date, stripped); - else if (type & PURPLE_MESSAGE_NO_LOG) { - /* This shouldn't happen */ - g_free(stripped); - return written; - } else if (type & PURPLE_MESSAGE_WHISPER) - written += fprintf(data->file, "(%s) *%s* %s", date, from, stripped); - else - written += fprintf(data->file, "(%s) %s%s %s\n", date, from ? from : "", - from ? ":" : "", stripped); - } - g_free(date); - g_free(stripped); - fflush(data->file); - - return written; -} - -static void txt_logger_finalize(PurpleLog *log) -{ - PurpleLogCommonLoggerData *data = log->logger_data; - if (data) { - if(data->file) - fclose(data->file); - g_free(data->path); - - g_slice_free(PurpleLogCommonLoggerData, data); - } -} - -static GList *txt_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - return purple_log_common_lister(type, sn, account, ".txt", txt_logger); -} - -static GList *txt_logger_list_syslog(PurpleAccount *account) -{ - return purple_log_common_lister(PURPLE_LOG_SYSTEM, ".system", account, ".txt", txt_logger); -} - -static char *txt_logger_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - char *read, *minus_header; - PurpleLogCommonLoggerData *data = log->logger_data; - *flags = 0; - if (!data || !data->path) - return g_strdup(_("Unable to find log path!")); - if (g_file_get_contents(data->path, &read, NULL, NULL)) { - minus_header = strchr(read, '\n'); - - if (minus_header) - return process_txt_log(minus_header + 1, read); - else - return process_txt_log(read, NULL); - } - return g_strdup_printf(_("Could not read file: %s"), data->path); -} - -static int txt_logger_total_size(PurpleLogType type, const char *name, PurpleAccount *account) -{ - return purple_log_common_total_sizer(type, name, account, ".txt"); -} - - -/**************** - * OLD LOGGER *** - ****************/ - -/* The old logger doesn't write logs, only reads them. This is to include - * old logs in the log viewer transparently. - */ - -struct old_logger_data { - PurpleStringref *pathref; - int offset; - int length; -}; - -static GList *old_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - char *logfile = g_strdup_printf("%s.log", purple_normalize(account, sn)); - char *pathstr = g_build_filename(purple_user_dir(), "logs", logfile, NULL); - PurpleStringref *pathref = purple_stringref_new(pathstr); - struct stat st; - time_t log_last_modified; - FILE *index; - FILE *file; - int index_fd; - char *index_tmp; - char buf[BUF_LONG]; - struct tm tm; - char month[4]; - struct old_logger_data *data = NULL; - char *newlog; - int logfound = 0; - int lastoff = 0; - int newlen; - time_t lasttime = 0; - - PurpleLog *log = NULL; - GList *list = NULL; - - g_free(logfile); - - if (g_stat(purple_stringref_value(pathref), &st)) - { - purple_stringref_unref(pathref); - g_free(pathstr); - return NULL; - } - else - log_last_modified = st.st_mtime; - - /* Change the .log extension to .idx */ - strcpy(pathstr + strlen(pathstr) - 3, "idx"); - - if (g_stat(pathstr, &st) == 0) - { - if (st.st_mtime < log_last_modified) - { - purple_debug_warning("log", "Index \"%s\" exists, but is older than the log.\n", pathstr); - } - else - { - /* The index file exists and is at least as new as the log, so open it. */ - if (!(index = g_fopen(pathstr, "rb"))) - { - purple_debug_error("log", "Failed to open index file \"%s\" for reading: %s\n", - pathstr, g_strerror(errno)); - - /* Fall through so that we'll parse the log file. */ - } - else - { - purple_debug_info("log", "Using index: %s\n", pathstr); - g_free(pathstr); - while (fgets(buf, BUF_LONG, index)) - { - unsigned long idx_time; - if (sscanf(buf, "%d\t%d\t%lu", &lastoff, &newlen, &idx_time) == 3) - { - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, -1, NULL); - log->logger = old_logger; - log->time = (time_t)idx_time; - - /* IMPORTANT: Always set all members of struct old_logger_data */ - data = g_slice_new(struct old_logger_data); - - data->pathref = purple_stringref_ref(pathref); - data->offset = lastoff; - data->length = newlen; - - log->logger_data = data; - list = g_list_prepend(list, log); - } - } - fclose(index); - purple_stringref_unref(pathref); - - return list; - } - } - } - - if (!(file = g_fopen(purple_stringref_value(pathref), "rb"))) { - purple_debug_error("log", "Failed to open log file \"%s\" for reading: %s\n", - purple_stringref_value(pathref), g_strerror(errno)); - purple_stringref_unref(pathref); - g_free(pathstr); - return NULL; - } - - index_tmp = g_strdup_printf("%s.XXXXXX", pathstr); - if ((index_fd = g_mkstemp(index_tmp)) == -1) { - purple_debug_error("log", "Failed to open index temp file: %s\n", - g_strerror(errno)); - g_free(pathstr); - g_free(index_tmp); - index = NULL; - } else { - if ((index = fdopen(index_fd, "wb")) == NULL) - { - purple_debug_error("log", "Failed to fdopen() index temp file: %s\n", - g_strerror(errno)); - close(index_fd); - if (index_tmp != NULL) - { - g_unlink(index_tmp); - g_free(index_tmp); - } - g_free(pathstr); - } - } - - while (fgets(buf, BUF_LONG, file)) { - if ((newlog = strstr(buf, "---- New C"))) { - int length; - int offset; - char convostart[32]; - char *temp = strchr(buf, '@'); - - if (temp == NULL || strlen(temp) < 2) - continue; - - temp++; - length = strcspn(temp, "-"); - if (length > 31) length = 31; - - offset = ftell(file); - - if (logfound) { - newlen = offset - lastoff - length; - if(strstr(buf, "----
")) { - newlen -= - sizeof("

---- New Conversation @ ") + - sizeof("----


") - 2; - } else { - newlen -= - sizeof("---- New Conversation @ ") + sizeof("----") - 2; - } - - if(strchr(buf, '\r')) - newlen--; - - if (newlen != 0) { - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, -1, NULL); - log->logger = old_logger; - log->time = lasttime; - - /* IMPORTANT: Always set all members of struct old_logger_data */ - data = g_slice_new(struct old_logger_data); - - data->pathref = purple_stringref_ref(pathref); - data->offset = lastoff; - data->length = newlen; - - log->logger_data = data; - list = g_list_prepend(list, log); - - /* XXX: There is apparently Is there a proper way to print a time_t? */ - if (index != NULL) - fprintf(index, "%d\t%d\t%lu\n", data->offset, data->length, (unsigned long)log->time); - } - } - - logfound = 1; - lastoff = offset; - - g_snprintf(convostart, length, "%s", temp); - memset(&tm, 0, sizeof(tm)); - sscanf(convostart, "%*s %s %d %d:%d:%d %d", - month, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &tm.tm_year); - /* Ugly hack, in case current locale is not English */ - if (purple_strequal(month, "Jan")) { - tm.tm_mon= 0; - } else if (purple_strequal(month, "Feb")) { - tm.tm_mon = 1; - } else if (purple_strequal(month, "Mar")) { - tm.tm_mon = 2; - } else if (purple_strequal(month, "Apr")) { - tm.tm_mon = 3; - } else if (purple_strequal(month, "May")) { - tm.tm_mon = 4; - } else if (purple_strequal(month, "Jun")) { - tm.tm_mon = 5; - } else if (purple_strequal(month, "Jul")) { - tm.tm_mon = 6; - } else if (purple_strequal(month, "Aug")) { - tm.tm_mon = 7; - } else if (purple_strequal(month, "Sep")) { - tm.tm_mon = 8; - } else if (purple_strequal(month, "Oct")) { - tm.tm_mon = 9; - } else if (purple_strequal(month, "Nov")) { - tm.tm_mon = 10; - } else if (purple_strequal(month, "Dec")) { - tm.tm_mon = 11; - } - tm.tm_year -= 1900; - lasttime = mktime(&tm); - } - } - - if (logfound) { - if ((newlen = ftell(file) - lastoff) != 0) { - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, -1, NULL); - log->logger = old_logger; - log->time = lasttime; - - /* IMPORTANT: Always set all members of struct old_logger_data */ - data = g_slice_new(struct old_logger_data); - - data->pathref = purple_stringref_ref(pathref); - data->offset = lastoff; - data->length = newlen; - - log->logger_data = data; - list = g_list_prepend(list, log); - - /* XXX: Is there a proper way to print a time_t? */ - if (index != NULL) - fprintf(index, "%d\t%d\t%d\n", data->offset, data->length, (int)log->time); - } - } - - purple_stringref_unref(pathref); - fclose(file); - if (index != NULL) - { - fclose(index); - - if (index_tmp == NULL) - { - g_free(pathstr); - g_return_val_if_reached(list); - } - - if (g_rename(index_tmp, pathstr)) - { - purple_debug_warning("log", "Failed to rename index temp file \"%s\" to \"%s\": %s\n", - index_tmp, pathstr, g_strerror(errno)); - g_unlink(index_tmp); - } - else - purple_debug_info("log", "Built index: %s\n", pathstr); - - g_free(index_tmp); - g_free(pathstr); - } - return list; -} - -static int old_logger_total_size(PurpleLogType type, const char *name, PurpleAccount *account) -{ - char *logfile = g_strdup_printf("%s.log", purple_normalize(account, name)); - char *pathstr = g_build_filename(purple_user_dir(), "logs", logfile, NULL); - int size; - struct stat st; - - if (g_stat(pathstr, &st)) - size = 0; - else - size = st.st_size; - - g_free(logfile); - g_free(pathstr); - - return size; -} - -static char * old_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - size_t result; - struct old_logger_data *data = log->logger_data; - const char *path = purple_stringref_value(data->pathref); - FILE *file = g_fopen(path, "rb"); - char *read = g_malloc(data->length + 1); - fseek(file, data->offset, SEEK_SET); - result = fread(read, data->length, 1, file); - if (result != 1) - purple_debug_error("log", "Unable to read from log file: %s\n", path); - fclose(file); - read[data->length] = '\0'; - *flags = 0; - if (strstr(read, "
")) - { - *flags |= PURPLE_LOG_READ_NO_NEWLINE; - return read; - } - - return process_txt_log(read, NULL); -} - -static int old_logger_size (PurpleLog *log) -{ - struct old_logger_data *data = log->logger_data; - return data ? data->length : 0; -} - -static void old_logger_get_log_sets(PurpleLogSetCallback cb, GHashTable *sets) -{ - char *log_path = g_build_filename(purple_user_dir(), "logs", NULL); - GDir *log_dir = g_dir_open(log_path, 0, NULL); - gchar *name; - PurpleBlistNode *gnode, *cnode, *bnode; - - g_free(log_path); - if (log_dir == NULL) - return; - - /* Don't worry about the cast, name will be filled with a dynamically allocated data shortly. */ - while ((name = (gchar *)g_dir_read_name(log_dir)) != NULL) { - size_t len; - gchar *ext; - PurpleLogSet *set; - gboolean found = FALSE; - - /* Unescape the filename. */ - name = g_strdup(purple_unescape_filename(name)); - - /* Get the (possibly new) length of name. */ - len = strlen(name); - - if (len < 5) { - g_free(name); - continue; - } - - /* Make sure we're dealing with a log file. */ - ext = &name[len - 4]; - if (!purple_strequal(ext, ".log")) { - g_free(name); - continue; - } - - /* IMPORTANT: Always set all members of PurpleLogSet */ - set = g_slice_new(PurpleLogSet); - - /* Chat for .chat at the end of the name to determine the type. */ - *ext = '\0'; - set->type = PURPLE_LOG_IM; - if (len > 9) { - char *tmp = &name[len - 9]; - if (purple_strequal(tmp, ".chat")) { - set->type = PURPLE_LOG_CHAT; - *tmp = '\0'; - } - } - - set->name = set->normalized_name = name; - - /* Search the buddy list to find the account and to determine if this is a buddy. */ - for (gnode = purple_blist_get_root(); - !found && gnode != NULL; - gnode = purple_blist_node_get_sibling_next(gnode)) - { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - - for (cnode = purple_blist_node_get_first_child(gnode); - !found && cnode != NULL; - cnode = purple_blist_node_get_sibling_next(cnode)) - { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - - for (bnode = purple_blist_node_get_first_child(cnode); - !found && bnode != NULL; - bnode = purple_blist_node_get_sibling_next(bnode)) - { - PurpleBuddy *buddy = (PurpleBuddy *)bnode; - - if (purple_strequal(purple_buddy_get_name(buddy), name)) { - set->account = purple_buddy_get_account(buddy); - set->buddy = TRUE; - found = TRUE; - } - } - } - } - - if (!found) - { - set->account = NULL; - set->buddy = FALSE; - } - - cb(sets, set); - } - g_dir_close(log_dir); -} - -static void old_logger_finalize(PurpleLog *log) -{ - struct old_logger_data *data = log->logger_data; - purple_stringref_unref(data->pathref); - g_slice_free(struct old_logger_data, data); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/log.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,583 +0,0 @@ -/** - * @file log.h Logging API - * @ingroup core - * @see @ref log-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_LOG_H_ -#define _PURPLE_LOG_H_ - -#include - - -/******************************************************** - * DATA STRUCTURES ************************************** - ********************************************************/ - -typedef struct _PurpleLog PurpleLog; -typedef struct _PurpleLogLogger PurpleLogLogger; -typedef struct _PurpleLogCommonLoggerData PurpleLogCommonLoggerData; -typedef struct _PurpleLogSet PurpleLogSet; - -typedef enum { - PURPLE_LOG_IM, - PURPLE_LOG_CHAT, - PURPLE_LOG_SYSTEM -} PurpleLogType; - -typedef enum { - PURPLE_LOG_READ_NO_NEWLINE = 1 -} PurpleLogReadFlags; - -#include "account.h" -#include "conversation.h" - -typedef void (*PurpleLogSetCallback) (GHashTable *sets, PurpleLogSet *set); - -/** - * A log logger. - * - * This struct gets filled out and is included in the PurpleLog. It contains everything - * needed to write and read from logs. - */ -struct _PurpleLogLogger { - char *name; /**< The logger's name */ - char *id; /**< an identifier to refer to this logger */ - - /** This gets called when the log is first created. - I don't think this is actually needed. */ - void (*create)(PurpleLog *log); - - /** This is used to write to the log file */ - gsize (*write)(PurpleLog *log, - PurpleMessageFlags type, - const char *from, - time_t time, - const char *message); - - /** Called when the log is destroyed */ - void (*finalize)(PurpleLog *log); - - /** This function returns a sorted GList of available PurpleLogs */ - GList *(*list)(PurpleLogType type, const char *name, PurpleAccount *account); - - /** Given one of the logs returned by the logger's list function, - * this returns the contents of the log in GtkIMHtml markup */ - char *(*read)(PurpleLog *log, PurpleLogReadFlags *flags); - - /** Given one of the logs returned by the logger's list function, - * this returns the size of the log in bytes */ - int (*size)(PurpleLog *log); - - /** Returns the total size of all the logs. If this is undefined a default - * implementation is used */ - int (*total_size)(PurpleLogType type, const char *name, PurpleAccount *account); - - /** This function returns a sorted GList of available system PurpleLogs */ - GList *(*list_syslog)(PurpleAccount *account); - - /** Adds PurpleLogSets to a GHashTable. By passing the data in the PurpleLogSets - * to list, the caller can get every available PurpleLog from the logger. - * Loggers using purple_log_common_writer() (or otherwise storing their - * logs in the same directory structure as the stock loggers) do not - * need to implement this function. - * - * Loggers which implement this function must create a PurpleLogSet, - * then call @a cb with @a sets and the newly created PurpleLogSet. */ - void (*get_log_sets)(PurpleLogSetCallback cb, GHashTable *sets); - - /* Attempts to delete the specified log, indicating success or failure */ - gboolean (*remove)(PurpleLog *log); - - /* Tests whether a log is deletable */ - gboolean (*is_deletable)(PurpleLog *log); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** - * A log. Not the wooden type. - */ -struct _PurpleLog { - PurpleLogType type; /**< The type of log this is */ - char *name; /**< The name of this log */ - PurpleAccount *account; /**< The account this log is taking - place on */ - PurpleConversation *conv; /**< The conversation being logged */ - time_t time; /**< The time this conversation - started, converted to the local timezone */ - - PurpleLogLogger *logger; /**< The logging mechanism this log - is to use */ - void *logger_data; /**< Data used by the log logger */ - struct tm *tm; /**< The time this conversation - started, saved with original - timezone data, if available and - if struct tm has the BSD - timezone fields, else @c NULL. - Do NOT modify anything in this struct.*/ - - /* IMPORTANT: Some code in log.c allocates these without zeroing them. - * IMPORTANT: Update that code if you add members here. */ -}; - -/** - * A common logger_data struct containing a file handle and path, as well - * as a pointer to something else for additional data. - */ -struct _PurpleLogCommonLoggerData { - char *path; - FILE *file; - void *extra_data; -}; - -/** - * Describes available logs. - * - * By passing the elements of this struct to purple_log_get_logs(), the caller - * can get all available PurpleLogs. - */ -struct _PurpleLogSet { - PurpleLogType type; /**< The type of logs available */ - char *name; /**< The name of the logs available */ - PurpleAccount *account; /**< The account the available logs - took place on. This will be - @c NULL if the account no longer - exists. (Depending on a - logger's implementation of - list, it may not be possible - to load such logs.) */ - gboolean buddy; /**< Is this (account, name) a buddy - on the buddy list? */ - char *normalized_name; /**< The normalized version of - @a name. It must be set, and - may be set to the same pointer - value as @a name. */ - - /* IMPORTANT: Some code in log.c allocates these without zeroing them. - * IMPORTANT: Update that code if you add members here. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************/ -/** @name Log Functions */ -/***************************************/ -/*@{*/ - -/** - * Creates a new log - * - * @param type The type of log this is. - * @param name The name of this conversation (buddy name, chat name, - * etc.) - * @param account The account the conversation is occurring on - * @param conv The conversation being logged - * @param time The time this conversation started - * @param tm The time this conversation started, with timezone data, - * if available and if struct tm has the BSD timezone fields. - * @return The new log - */ -PurpleLog *purple_log_new(PurpleLogType type, const char *name, PurpleAccount *account, - PurpleConversation *conv, time_t time, const struct tm *tm); - -/** - * Frees a log - * - * @param log The log to destroy - */ -void purple_log_free(PurpleLog *log); - -/** - * Writes to a log file. Assumes you have checked preferences already. - * - * @param log The log to write to - * @param type The type of message being logged - * @param from Whom this message is coming from, or @c NULL for - * system messages - * @param time A timestamp in UNIX time - * @param message The message to log - */ -void purple_log_write(PurpleLog *log, - PurpleMessageFlags type, - const char *from, - time_t time, - const char *message); - -/** - * Reads from a log - * - * @param log The log to read from - * @param flags The returned logging flags. - * - * @return The contents of this log in Purple Markup. - */ -char *purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags); - -/** - * Returns a list of all available logs - * - * @param type The type of the log - * @param name The name of the log - * @param account The account - * @return A sorted list of PurpleLogs - */ -GList *purple_log_get_logs(PurpleLogType type, const char *name, PurpleAccount *account); - -/** - * Returns a GHashTable of PurpleLogSets. - * - * A "log set" here means the information necessary to gather the - * PurpleLogs for a given buddy/chat. This information would be passed - * to purple_log_list to get a list of PurpleLogs. - * - * The primary use of this function is to get a list of everyone the - * user has ever talked to (assuming he or she uses logging). - * - * The GHashTable that's returned will free all log sets in it when - * destroyed. If a PurpleLogSet is removed from the GHashTable, it - * must be freed with purple_log_set_free(). - * - * @return A GHashTable of all available unique PurpleLogSets - */ -GHashTable *purple_log_get_log_sets(void); - -/** - * Returns a list of all available system logs - * - * @param account The account - * @return A sorted list of PurpleLogs - */ -GList *purple_log_get_system_logs(PurpleAccount *account); - -/** - * Returns the size of a log - * - * @param log The log - * @return The size of the log, in bytes - */ -int purple_log_get_size(PurpleLog *log); - -/** - * Returns the size, in bytes, of all available logs in this conversation - * - * @param type The type of the log - * @param name The name of the log - * @param account The account - * @return The size in bytes - */ -int purple_log_get_total_size(PurpleLogType type, const char *name, PurpleAccount *account); - -/** - * Returns the activity score of a log, based on total size in bytes, - * which is then decayed based on age - * - * @param type The type of the log - * @param name The name of the log - * @param account The account - * @return The activity score - * - * @since 2.6.0 - */ -int purple_log_get_activity_score(PurpleLogType type, const char *name, PurpleAccount *account); - -/** - * Tests whether a log is deletable - * - * A return value of @c FALSE indicates that purple_log_delete() will fail on this - * log, unless something changes between the two calls. A return value of @c TRUE, - * however, does not guarantee the log can be deleted. - * - * @param log The log - * @return A boolean indicating if the log is deletable - */ -gboolean purple_log_is_deletable(PurpleLog *log); - -/** - * Deletes a log - * - * @param log The log - * @return A boolean indicating success or failure - */ -gboolean purple_log_delete(PurpleLog *log); - -/** - * Returns the default logger directory Purple uses for a given account - * and username. This would be where Purple stores logs created by - * the built-in text or HTML loggers. - * - * @param type The type of the log. - * @param name The name of the log. - * @param account The account. - * @return The default logger directory for Purple. - */ -char *purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account); - -/** - * Implements GCompareFunc for PurpleLogs - * - * @param y A PurpleLog - * @param z Another PurpleLog - * @return A value as specified by GCompareFunc - */ -gint purple_log_compare(gconstpointer y, gconstpointer z); - -/** - * Implements GCompareFunc for PurpleLogSets - * - * @param y A PurpleLogSet - * @param z Another PurpleLogSet - * @return A value as specified by GCompareFunc - */ -gint purple_log_set_compare(gconstpointer y, gconstpointer z); - -/** - * Frees a log set - * - * @param set The log set to destroy - */ -void purple_log_set_free(PurpleLogSet *set); - -/*@}*/ - -/******************************************/ -/** @name Common Logger Functions */ -/******************************************/ -/*@{*/ - -/** - * Opens a new log file in the standard Purple log location - * with the given file extension, named for the current time, - * for writing. If a log file is already open, the existing - * file handle is retained. The log's logger_data value is - * set to a PurpleLogCommonLoggerData struct containing the log - * file handle and log path. - * - * This function is intended to be used as a "common" - * implementation of a logger's @c write function. - * It should only be passed to purple_log_logger_new() and never - * called directly. - * - * @param log The log to write to. - * @param ext The file extension to give to this log file. - */ -void purple_log_common_writer(PurpleLog *log, const char *ext); - -/** - * Returns a sorted GList of PurpleLogs of the requested type. - * - * This function should only be used with logs that are written - * with purple_log_common_writer(). It's intended to be used as - * a "common" implementation of a logger's @c list function. - * It should only be passed to purple_log_logger_new() and never - * called directly. - * - * @param type The type of the logs being listed. - * @param name The name of the log. - * @param account The account of the log. - * @param ext The file extension this log format uses. - * @param logger A reference to the logger struct for this log. - * - * @return A sorted GList of PurpleLogs matching the parameters. - */ -GList *purple_log_common_lister(PurpleLogType type, const char *name, - PurpleAccount *account, const char *ext, - PurpleLogLogger *logger); - -/** - * Returns the total size of all the logs for a given user, with - * a given extension. - * - * This function should only be used with logs that are written - * with purple_log_common_writer(). It's intended to be used as - * a "common" implementation of a logger's @c total_size function. - * It should only be passed to purple_log_logger_new() and never - * called directly. - * - * @param type The type of the logs being sized. - * @param name The name of the logs to size - * (e.g. the username or chat name). - * @param account The account of the log. - * @param ext The file extension this log format uses. - * - * @return The size of all the logs with the specified extension - * for the specified user. - */ -int purple_log_common_total_sizer(PurpleLogType type, const char *name, - PurpleAccount *account, const char *ext); - -/** - * Returns the size of a given PurpleLog. - * - * This function should only be used with logs that are written - * with purple_log_common_writer(). It's intended to be used as - * a "common" implementation of a logger's @c size function. - * It should only be passed to purple_log_logger_new() and never - * called directly. - * - * @param log The PurpleLog to size. - * - * @return An integer indicating the size of the log in bytes. - */ -int purple_log_common_sizer(PurpleLog *log); - -/** - * Deletes a log - * - * This function should only be used with logs that are written - * with purple_log_common_writer(). It's intended to be used as - * a "common" implementation of a logger's @c delete function. - * It should only be passed to purple_log_logger_new() and never - * called directly. - * - * @param log The PurpleLog to delete. - * - * @return A boolean indicating success or failure. - */ -gboolean purple_log_common_deleter(PurpleLog *log); - -/** - * Checks to see if a log is deletable - * - * This function should only be used with logs that are written - * with purple_log_common_writer(). It's intended to be used as - * a "common" implementation of a logger's @c is_deletable function. - * It should only be passed to purple_log_logger_new() and never - * called directly. - * - * @param log The PurpleLog to check. - * - * @return A boolean indicating if the log is deletable. - */ -gboolean purple_log_common_is_deletable(PurpleLog *log); - -/*@}*/ - -/******************************************/ -/** @name Logger Functions */ -/******************************************/ -/*@{*/ - -/** - * Creates a new logger - * - * @param id The logger's id. - * @param name The logger's name. - * @param functions The number of functions being passed. The following - * functions are currently available (in order): @c create, - * @c write, @c finalize, @c list, @c read, @c size, - * @c total_size, @c list_syslog, @c get_log_sets, - * @c remove, @c is_deletable. - * For details on these functions, see PurpleLogLogger. - * Functions may not be skipped. For example, passing - * @c create and @c write is acceptable (for a total of - * two functions). Passing @c create and @c finalize, - * however, is not. To accomplish that, the caller must - * pass @c create, @c NULL (a placeholder for @c write), - * and @c finalize (for a total of 3 functions). - * - * @return The new logger - */ -PurpleLogLogger *purple_log_logger_new(const char *id, const char *name, int functions, ...); - -/** - * Frees a logger - * - * @param logger The logger to free - */ -void purple_log_logger_free(PurpleLogLogger *logger); - -/** - * Adds a new logger - * - * @param logger The new logger to add - */ -void purple_log_logger_add (PurpleLogLogger *logger); - -/** - * - * Removes a logger - * - * @param logger The logger to remove - */ -void purple_log_logger_remove (PurpleLogLogger *logger); - -/** - * - * Sets the current logger - * - * @param logger The logger to set - */ -void purple_log_logger_set (PurpleLogLogger *logger); - -/** - * - * Returns the current logger - * - * @return logger The current logger - */ -PurpleLogLogger *purple_log_logger_get (void); - -/** - * Returns a GList containing the IDs and names of the registered - * loggers. - * - * @return The list of IDs and names. - */ -GList *purple_log_logger_get_options(void); - -/**************************************************************************/ -/** @name Log Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Initializes the log subsystem. - */ -void purple_log_init(void); - -/** - * Returns the log subsystem handle. - * - * @return The log subsystem handle. - */ -void *purple_log_get_handle(void); - -/** - * Uninitializes the log subsystem. - */ -void purple_log_uninit(void); - -/*@}*/ - - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_LOG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,320 +0,0 @@ -EXTRA_DIST = \ - dbus-analyze-functions.py \ - dbus-analyze-signals.py \ - dbus-analyze-types.py \ - marshallers.list \ - purple-notifications-example \ - purple-remote \ - purple-send \ - purple-send-async \ - purple-url-handler \ - purple.h.in \ - purple.pc.in \ - purple-uninstalled.pc.in \ - version.h.in \ - Makefile.mingw \ - win32/global.mak \ - win32/libc_interface.c \ - win32/libc_interface.h \ - win32/libc_internal.h \ - win32/libpurplerc.rc.in \ - win32/rules.mak \ - win32/targets.mak \ - win32/wpurpleerror.h \ - win32/win32dep.c \ - win32/giowin32.c \ - win32/win32dep.h - -if USE_GCONFTOOL -GCONF_DIR=gconf -endif - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = purple.pc - -SUBDIRS = $(GCONF_DIR) plugins protocols . tests example - -purple_coresources = \ - account.c \ - accountopt.c \ - blist.c \ - buddyicon.c \ - certificate.c \ - cipher.c \ - circbuffer.c \ - cmds.c \ - connection.c \ - conversation.c \ - core.c \ - debug.c \ - desktopitem.c \ - eventloop.c \ - ft.c \ - idle.c \ - imgstore.c \ - log.c \ - media.c \ - mediamanager.c \ - mime.c \ - nat-pmp.c \ - network.c \ - ntlm.c \ - notify.c \ - plugin.c \ - pluginpref.c \ - pounce.c \ - prefs.c \ - privacy.c \ - proxy.c \ - prpl.c \ - request.c \ - roomlist.c \ - savedstatuses.c \ - server.c \ - signals.c \ - smiley.c \ - dnsquery.c \ - dnssrv.c\ - status.c \ - stringref.c \ - stun.c \ - sound.c \ - sound-theme.c \ - sound-theme-loader.c \ - sslconn.c \ - theme.c \ - theme-loader.c \ - theme-manager.c \ - upnp.c \ - util.c \ - value.c \ - version.c \ - xmlnode.c \ - whiteboard.c - -purple_builtsources = \ - marshallers.c - -purple_coreheaders = \ - account.h \ - accountopt.h \ - blist.h \ - buddyicon.h \ - certificate.h \ - cipher.h \ - circbuffer.h \ - cmds.h \ - connection.h \ - conversation.h \ - core.h \ - dbus-maybe.h \ - debug.h \ - desktopitem.h \ - eventloop.h \ - ft.h \ - gaim-compat.h \ - idle.h \ - imgstore.h \ - log.h \ - media.h \ - media-gst.h \ - mediamanager.h \ - mime.h \ - nat-pmp.h \ - network.h \ - notify.h \ - ntlm.h \ - plugin.h \ - pluginpref.h \ - pounce.h \ - prefs.h \ - privacy.h \ - proxy.h \ - prpl.h \ - request.h \ - roomlist.h \ - savedstatuses.h \ - server.h \ - signals.h \ - smiley.h \ - dnsquery.h \ - dnssrv.h \ - status.h \ - stringref.h \ - stun.h \ - sound.h \ - sound-theme.h \ - sound-theme-loader.h \ - sslconn.h \ - theme.h \ - theme-loader.h \ - theme-manager.h \ - upnp.h \ - util.h \ - valgrind.h \ - value.h \ - xmlnode.h \ - whiteboard.h - -purple_builtheaders = purple.h version.h marshallers.h - -marshallers.h: marshallers.list - @echo "Generating marshallers.h" - $(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --header > marshallers.h - -marshallers.c: marshallers.list marshallers.h - @echo "Generating marshallers.c" - echo "#include \"marshallers.h\"" > marshallers.c - $(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --body >> marshallers.c - -if ENABLE_DBUS - -CLEANFILES = \ - dbus-bindings.c \ - dbus-client-binding.c \ - dbus-client-binding.h \ - dbus-signals.c \ - dbus-types.c \ - dbus-types.h \ - marshallers.c \ - marshallers.h \ - purple-client-bindings.c \ - purple-client-bindings.h \ - purple.service - -# purple dbus server - -dbus_sources = dbus-server.c dbus-useful.c -dbus_headers = dbus-bindings.h dbus-purple.h dbus-server.h dbus-useful.h dbus-define-api.h dbus-types.h - -dbus_exported = dbus-useful.h dbus-define-api.h account.h blist.h buddyicon.h \ - connection.h conversation.h core.h ft.h log.h notify.h prefs.h roomlist.h \ - savedstatuses.h smiley.h status.h server.h util.h xmlnode.h prpl.h - -purple_build_coreheaders = $(addprefix $(srcdir)/, $(purple_coreheaders)) \ - $(purple_builtheaders) -dbus_build_exported = $(addprefix $(srcdir)/, $(dbus_exported)) -# We should probably make this better -dbus_signals = $(addprefix $(srcdir)/, $(purple_coresources)) \ - $(srcdir)/protocols/irc/irc.c \ - $(srcdir)/protocols/jabber/libxmpp.c - -dbus-types.c: dbus-analyze-types.py $(purple_build_coreheaders) - cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=PURPLE_DBUS_DEFINE_TYPE\(%s\) > $@ - -dbus-types.h: dbus-analyze-types.py $(purple_build_coreheaders) - cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=PURPLE_DBUS_DECLARE_TYPE\(%s\) > $@ - -dbus-bindings.c: dbus-analyze-functions.py $(dbus_exported) - cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py > $@ - -dbus-signals.c: dbus-analyze-signals.py $(dbus_signals) - cat $(dbus_signals) | $(PYTHON) $(srcdir)/dbus-analyze-signals.py > $@ - -dbus-server.$(OBJEXT): dbus-bindings.c dbus-signals.c dbus-types.c dbus-types.h -dbus-server.lo: dbus-bindings.c dbus-signals.c dbus-types.c dbus-types.h -$(libpurple_la_OBJECTS): dbus-types.h - -# libpurple-client - -libpurple_client_lib = libpurple-client.la - -libpurple_client_la_SOURCES = purple-client.c purple-client.h -libpurple_client_la_LDFLAGS = -version-info $(PURPLE_LT_VERSION_INFO) -no-undefined -libpurple_client_la_LIBADD = $(DBUS_LIBS) - -purple-client-bindings.c: dbus-analyze-functions.py $(dbus_exported) - cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py --client > $@ - -purple-client-bindings.h: dbus-analyze-types.py dbus-analyze-functions.py $(purple_coreheaders) $(purple_builtheaders) $(dbus_exported) - cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --keyword=enum --verbatim > $@ - cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py --client --headers >> $@ - -$(libpurple_client_la_OBJECTS): purple-client-bindings.h purple-client-bindings.c - -# purple-client-example - -purple_client_example_SOURCES = purple-client-example.c - -purple_client_example_DEPENDENCIES = libpurple-client.la - -purple_client_example_LDADD = \ - libpurple-client.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) - -bin_PROGRAMS = purple-client-example - -purple-client-example.$(OBJEXT): purple-client-bindings.h - -# scripts - -bin_SCRIPTS = purple-remote purple-send purple-send-async purple-url-handler - -BUILT_SOURCES = $(purple_builtheaders) \ - $(purple_builtsources) \ - dbus-bindings.c \ - dbus-signals.c \ - dbus-types.c \ - dbus-types.h \ - purple-client-bindings.c \ - purple-client-bindings.h - -else - -BUILT_SOURCES = $(purple_builtheaders) $(purple_builtsources) - -endif - -lib_LTLIBRARIES = libpurple.la $(libpurple_client_lib) - -libpurple_la_SOURCES = \ - $(purple_coresources) \ - $(purple_builtsources) \ - $(dbus_sources) - -noinst_HEADERS= \ - internal.h \ - valgrind.h - -libpurpleincludedir=$(includedir)/libpurple -libpurpleinclude_HEADERS = \ - $(purple_coreheaders) \ - $(purple_builtheaders) \ - $(dbus_headers) - -libpurple_la_DEPENDENCIES = $(STATIC_LINK_LIBS) -libpurple_la_LDFLAGS = -export-dynamic -version-info $(PURPLE_LT_VERSION_INFO) -no-undefined -libpurple_la_LIBADD = \ - $(STATIC_LINK_LIBS) \ - $(DBUS_LIBS) \ - $(GLIB_LIBS) \ - $(LIBXML_LIBS) \ - $(NETWORKMANAGER_LIBS) \ - $(INTLLIBS) \ - $(FARSIGHT_LIBS) \ - $(GSTREAMER_LIBS) \ - $(GSTINTERFACES_LIBS) \ - $(IDN_LIBS) \ - -lm - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/\" \ - -DLOCALEDIR=\"$(datadir)/locale\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(LIBXML_CFLAGS) \ - $(FARSIGHT_CFLAGS) \ - $(GSTREAMER_CFLAGS) \ - $(GSTINTERFACES_CFLAGS) \ - $(IDN_CFLAGS) \ - $(NETWORKMANAGER_CFLAGS) - -# INSTALL_SSL_CERTIFICATES is true when SSL_CERTIFICATES_DIR is empty. -# We want to use SSL_CERTIFICATES_DIR when it's not empty. -if ! INSTALL_SSL_CERTIFICATES -AM_CPPFLAGS += -DSSL_CERTIFICATES_DIR=\"$(SSL_CERTIFICATES_DIR)\" -endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1335 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - - - - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@ENABLE_DBUS_TRUE@bin_PROGRAMS = purple-client-example$(EXEEXT) - -# INSTALL_SSL_CERTIFICATES is true when SSL_CERTIFICATES_DIR is empty. -# We want to use SSL_CERTIFICATES_DIR when it's not empty. -@INSTALL_SSL_CERTIFICATES_FALSE@am__append_1 = -DSSL_CERTIFICATES_DIR=\"$(SSL_CERTIFICATES_DIR)\" -subdir = libpurple -DIST_COMMON = $(am__libpurpleinclude_HEADERS_DIST) $(noinst_HEADERS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/purple-uninstalled.pc.in $(srcdir)/purple.h.in \ - $(srcdir)/purple.pc.in $(srcdir)/version.h.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = purple.pc purple-uninstalled.pc purple.h \ - version.h -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" \ - "$(DESTDIR)$(libpurpleincludedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -@ENABLE_DBUS_TRUE@libpurple_client_la_DEPENDENCIES = \ -@ENABLE_DBUS_TRUE@ $(am__DEPENDENCIES_1) -am__libpurple_client_la_SOURCES_DIST = purple-client.c purple-client.h -@ENABLE_DBUS_TRUE@am_libpurple_client_la_OBJECTS = purple-client.lo -libpurple_client_la_OBJECTS = $(am_libpurple_client_la_OBJECTS) -@ENABLE_DBUS_TRUE@am_libpurple_client_la_rpath = -rpath $(libdir) -am__libpurple_la_SOURCES_DIST = account.c accountopt.c blist.c \ - buddyicon.c certificate.c cipher.c circbuffer.c cmds.c \ - connection.c conversation.c core.c debug.c desktopitem.c \ - eventloop.c ft.c idle.c imgstore.c log.c media.c \ - mediamanager.c mime.c nat-pmp.c network.c ntlm.c notify.c \ - plugin.c pluginpref.c pounce.c prefs.c privacy.c proxy.c \ - prpl.c request.c roomlist.c savedstatuses.c server.c signals.c \ - smiley.c dnsquery.c dnssrv.c status.c stringref.c stun.c \ - sound.c sound-theme.c sound-theme-loader.c sslconn.c theme.c \ - theme-loader.c theme-manager.c upnp.c util.c value.c version.c \ - xmlnode.c whiteboard.c marshallers.c dbus-server.c \ - dbus-useful.c -am__objects_1 = account.lo accountopt.lo blist.lo buddyicon.lo \ - certificate.lo cipher.lo circbuffer.lo cmds.lo connection.lo \ - conversation.lo core.lo debug.lo desktopitem.lo eventloop.lo \ - ft.lo idle.lo imgstore.lo log.lo media.lo mediamanager.lo \ - mime.lo nat-pmp.lo network.lo ntlm.lo notify.lo plugin.lo \ - pluginpref.lo pounce.lo prefs.lo privacy.lo proxy.lo prpl.lo \ - request.lo roomlist.lo savedstatuses.lo server.lo signals.lo \ - smiley.lo dnsquery.lo dnssrv.lo status.lo stringref.lo stun.lo \ - sound.lo sound-theme.lo sound-theme-loader.lo sslconn.lo \ - theme.lo theme-loader.lo theme-manager.lo upnp.lo util.lo \ - value.lo version.lo xmlnode.lo whiteboard.lo -am__objects_2 = marshallers.lo -@ENABLE_DBUS_TRUE@am__objects_3 = dbus-server.lo dbus-useful.lo -am_libpurple_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ - $(am__objects_3) -libpurple_la_OBJECTS = $(am_libpurple_la_OBJECTS) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am__purple_client_example_SOURCES_DIST = purple-client-example.c -@ENABLE_DBUS_TRUE@am_purple_client_example_OBJECTS = \ -@ENABLE_DBUS_TRUE@ purple-client-example.$(OBJEXT) -purple_client_example_OBJECTS = $(am_purple_client_example_OBJECTS) -binSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(bin_SCRIPTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libpurple_client_la_SOURCES) $(libpurple_la_SOURCES) \ - $(purple_client_example_SOURCES) -DIST_SOURCES = $(am__libpurple_client_la_SOURCES_DIST) \ - $(am__libpurple_la_SOURCES_DIST) \ - $(am__purple_client_example_SOURCES_DIST) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -pkgconfigDATA_INSTALL = $(INSTALL_DATA) -DATA = $(pkgconfig_DATA) -am__libpurpleinclude_HEADERS_DIST = account.h accountopt.h blist.h \ - buddyicon.h certificate.h cipher.h circbuffer.h cmds.h \ - connection.h conversation.h core.h dbus-maybe.h debug.h \ - desktopitem.h eventloop.h ft.h gaim-compat.h idle.h imgstore.h \ - log.h media.h media-gst.h mediamanager.h mime.h nat-pmp.h \ - network.h notify.h ntlm.h plugin.h pluginpref.h pounce.h \ - prefs.h privacy.h proxy.h prpl.h request.h roomlist.h \ - savedstatuses.h server.h signals.h smiley.h dnsquery.h \ - dnssrv.h status.h stringref.h stun.h sound.h sound-theme.h \ - sound-theme-loader.h sslconn.h theme.h theme-loader.h \ - theme-manager.h upnp.h util.h valgrind.h value.h xmlnode.h \ - whiteboard.h purple.h version.h marshallers.h dbus-bindings.h \ - dbus-purple.h dbus-server.h dbus-useful.h dbus-define-api.h \ - dbus-types.h -libpurpleincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(libpurpleinclude_HEADERS) $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = gconf plugins protocols . tests example -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - dbus-analyze-functions.py \ - dbus-analyze-signals.py \ - dbus-analyze-types.py \ - marshallers.list \ - purple-notifications-example \ - purple-remote \ - purple-send \ - purple-send-async \ - purple-url-handler \ - purple.h.in \ - purple.pc.in \ - purple-uninstalled.pc.in \ - version.h.in \ - Makefile.mingw \ - win32/global.mak \ - win32/libc_interface.c \ - win32/libc_interface.h \ - win32/libc_internal.h \ - win32/libpurplerc.rc.in \ - win32/rules.mak \ - win32/targets.mak \ - win32/wpurpleerror.h \ - win32/win32dep.c \ - win32/giowin32.c \ - win32/win32dep.h - -@USE_GCONFTOOL_TRUE@GCONF_DIR = gconf -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = purple.pc -SUBDIRS = $(GCONF_DIR) plugins protocols . tests example -purple_coresources = \ - account.c \ - accountopt.c \ - blist.c \ - buddyicon.c \ - certificate.c \ - cipher.c \ - circbuffer.c \ - cmds.c \ - connection.c \ - conversation.c \ - core.c \ - debug.c \ - desktopitem.c \ - eventloop.c \ - ft.c \ - idle.c \ - imgstore.c \ - log.c \ - media.c \ - mediamanager.c \ - mime.c \ - nat-pmp.c \ - network.c \ - ntlm.c \ - notify.c \ - plugin.c \ - pluginpref.c \ - pounce.c \ - prefs.c \ - privacy.c \ - proxy.c \ - prpl.c \ - request.c \ - roomlist.c \ - savedstatuses.c \ - server.c \ - signals.c \ - smiley.c \ - dnsquery.c \ - dnssrv.c\ - status.c \ - stringref.c \ - stun.c \ - sound.c \ - sound-theme.c \ - sound-theme-loader.c \ - sslconn.c \ - theme.c \ - theme-loader.c \ - theme-manager.c \ - upnp.c \ - util.c \ - value.c \ - version.c \ - xmlnode.c \ - whiteboard.c - -purple_builtsources = \ - marshallers.c - -purple_coreheaders = \ - account.h \ - accountopt.h \ - blist.h \ - buddyicon.h \ - certificate.h \ - cipher.h \ - circbuffer.h \ - cmds.h \ - connection.h \ - conversation.h \ - core.h \ - dbus-maybe.h \ - debug.h \ - desktopitem.h \ - eventloop.h \ - ft.h \ - gaim-compat.h \ - idle.h \ - imgstore.h \ - log.h \ - media.h \ - media-gst.h \ - mediamanager.h \ - mime.h \ - nat-pmp.h \ - network.h \ - notify.h \ - ntlm.h \ - plugin.h \ - pluginpref.h \ - pounce.h \ - prefs.h \ - privacy.h \ - proxy.h \ - prpl.h \ - request.h \ - roomlist.h \ - savedstatuses.h \ - server.h \ - signals.h \ - smiley.h \ - dnsquery.h \ - dnssrv.h \ - status.h \ - stringref.h \ - stun.h \ - sound.h \ - sound-theme.h \ - sound-theme-loader.h \ - sslconn.h \ - theme.h \ - theme-loader.h \ - theme-manager.h \ - upnp.h \ - util.h \ - valgrind.h \ - value.h \ - xmlnode.h \ - whiteboard.h - -purple_builtheaders = purple.h version.h marshallers.h -@ENABLE_DBUS_TRUE@CLEANFILES = \ -@ENABLE_DBUS_TRUE@ dbus-bindings.c \ -@ENABLE_DBUS_TRUE@ dbus-client-binding.c \ -@ENABLE_DBUS_TRUE@ dbus-client-binding.h \ -@ENABLE_DBUS_TRUE@ dbus-signals.c \ -@ENABLE_DBUS_TRUE@ dbus-types.c \ -@ENABLE_DBUS_TRUE@ dbus-types.h \ -@ENABLE_DBUS_TRUE@ marshallers.c \ -@ENABLE_DBUS_TRUE@ marshallers.h \ -@ENABLE_DBUS_TRUE@ purple-client-bindings.c \ -@ENABLE_DBUS_TRUE@ purple-client-bindings.h \ -@ENABLE_DBUS_TRUE@ purple.service - - -# purple dbus server -@ENABLE_DBUS_TRUE@dbus_sources = dbus-server.c dbus-useful.c -@ENABLE_DBUS_TRUE@dbus_headers = dbus-bindings.h dbus-purple.h dbus-server.h dbus-useful.h dbus-define-api.h dbus-types.h -@ENABLE_DBUS_TRUE@dbus_exported = dbus-useful.h dbus-define-api.h account.h blist.h buddyicon.h \ -@ENABLE_DBUS_TRUE@ connection.h conversation.h core.h ft.h log.h notify.h prefs.h roomlist.h \ -@ENABLE_DBUS_TRUE@ savedstatuses.h smiley.h status.h server.h util.h xmlnode.h prpl.h - -@ENABLE_DBUS_TRUE@purple_build_coreheaders = $(addprefix $(srcdir)/, $(purple_coreheaders)) \ -@ENABLE_DBUS_TRUE@ $(purple_builtheaders) - -@ENABLE_DBUS_TRUE@dbus_build_exported = $(addprefix $(srcdir)/, $(dbus_exported)) -# We should probably make this better -@ENABLE_DBUS_TRUE@dbus_signals = $(addprefix $(srcdir)/, $(purple_coresources)) \ -@ENABLE_DBUS_TRUE@ $(srcdir)/protocols/irc/irc.c \ -@ENABLE_DBUS_TRUE@ $(srcdir)/protocols/jabber/libxmpp.c - - -# libpurple-client -@ENABLE_DBUS_TRUE@libpurple_client_lib = libpurple-client.la -@ENABLE_DBUS_TRUE@libpurple_client_la_SOURCES = purple-client.c purple-client.h -@ENABLE_DBUS_TRUE@libpurple_client_la_LDFLAGS = -version-info $(PURPLE_LT_VERSION_INFO) -no-undefined -@ENABLE_DBUS_TRUE@libpurple_client_la_LIBADD = $(DBUS_LIBS) - -# purple-client-example -@ENABLE_DBUS_TRUE@purple_client_example_SOURCES = purple-client-example.c -@ENABLE_DBUS_TRUE@purple_client_example_DEPENDENCIES = libpurple-client.la -@ENABLE_DBUS_TRUE@purple_client_example_LDADD = \ -@ENABLE_DBUS_TRUE@ libpurple-client.la \ -@ENABLE_DBUS_TRUE@ $(GLIB_LIBS) \ -@ENABLE_DBUS_TRUE@ $(DBUS_LIBS) - - -# scripts -@ENABLE_DBUS_TRUE@bin_SCRIPTS = purple-remote purple-send purple-send-async purple-url-handler -@ENABLE_DBUS_FALSE@BUILT_SOURCES = $(purple_builtheaders) $(purple_builtsources) -@ENABLE_DBUS_TRUE@BUILT_SOURCES = $(purple_builtheaders) \ -@ENABLE_DBUS_TRUE@ $(purple_builtsources) \ -@ENABLE_DBUS_TRUE@ dbus-bindings.c \ -@ENABLE_DBUS_TRUE@ dbus-signals.c \ -@ENABLE_DBUS_TRUE@ dbus-types.c \ -@ENABLE_DBUS_TRUE@ dbus-types.h \ -@ENABLE_DBUS_TRUE@ purple-client-bindings.c \ -@ENABLE_DBUS_TRUE@ purple-client-bindings.h - -lib_LTLIBRARIES = libpurple.la $(libpurple_client_lib) -libpurple_la_SOURCES = \ - $(purple_coresources) \ - $(purple_builtsources) \ - $(dbus_sources) - -noinst_HEADERS = \ - internal.h \ - valgrind.h - -libpurpleincludedir = $(includedir)/libpurple -libpurpleinclude_HEADERS = \ - $(purple_coreheaders) \ - $(purple_builtheaders) \ - $(dbus_headers) - -libpurple_la_DEPENDENCIES = $(STATIC_LINK_LIBS) -libpurple_la_LDFLAGS = -export-dynamic -version-info $(PURPLE_LT_VERSION_INFO) -no-undefined -libpurple_la_LIBADD = \ - $(STATIC_LINK_LIBS) \ - $(DBUS_LIBS) \ - $(GLIB_LIBS) \ - $(LIBXML_LIBS) \ - $(NETWORKMANAGER_LIBS) \ - $(INTLLIBS) \ - $(FARSIGHT_LIBS) \ - $(GSTREAMER_LIBS) \ - $(GSTINTERFACES_LIBS) \ - $(IDN_LIBS) \ - -lm - -AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/\" \ - -DLOCALEDIR=\"$(datadir)/locale\" \ - -DSYSCONFDIR=\"$(sysconfdir)\" $(GLIB_CFLAGS) $(DEBUG_CFLAGS) \ - $(DBUS_CFLAGS) $(LIBXML_CFLAGS) $(FARSIGHT_CFLAGS) \ - $(GSTREAMER_CFLAGS) $(GSTINTERFACES_CFLAGS) $(IDN_CFLAGS) \ - $(NETWORKMANAGER_CFLAGS) $(am__append_1) -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -purple.pc: $(top_builddir)/config.status $(srcdir)/purple.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -purple-uninstalled.pc: $(top_builddir)/config.status $(srcdir)/purple-uninstalled.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -purple.h: $(top_builddir)/config.status $(srcdir)/purple.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -version.h: $(top_builddir)/config.status $(srcdir)/version.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libpurple-client.la: $(libpurple_client_la_OBJECTS) $(libpurple_client_la_DEPENDENCIES) - $(LINK) $(am_libpurple_client_la_rpath) $(libpurple_client_la_LDFLAGS) $(libpurple_client_la_OBJECTS) $(libpurple_client_la_LIBADD) $(LIBS) -libpurple.la: $(libpurple_la_OBJECTS) $(libpurple_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libpurple_la_LDFLAGS) $(libpurple_la_OBJECTS) $(libpurple_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -purple-client-example$(EXEEXT): $(purple_client_example_OBJECTS) $(purple_client_example_DEPENDENCIES) - @rm -f purple-client-example$(EXEEXT) - $(LINK) $(purple_client_example_LDFLAGS) $(purple_client_example_OBJECTS) $(purple_client_example_LDADD) $(LIBS) -install-binSCRIPTS: $(bin_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ - else :; fi; \ - done - -uninstall-binSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(bin_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/account.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/accountopt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddyicon.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/certificate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cipher.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/circbuffer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversation.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-server.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-useful.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desktopitem.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnsquery.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnssrv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventloop.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imgstore.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/marshallers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/media.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mediamanager.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mime.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nat-pmp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notify.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntlm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pluginpref.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pounce.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/privacy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prpl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/purple-client-example.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/purple-client.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/request.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/roomlist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/savedstatuses.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signals.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smiley.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound-theme-loader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound-theme.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sslconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stringref.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stun.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theme-loader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theme-manager.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theme.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upnp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/value.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/whiteboard.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlnode.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)" - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ - $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ - done -install-libpurpleincludeHEADERS: $(libpurpleinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(libpurpleincludedir)" || $(mkdir_p) "$(DESTDIR)$(libpurpleincludedir)" - @list='$(libpurpleinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(libpurpleincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(libpurpleincludedir)/$$f'"; \ - $(libpurpleincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(libpurpleincludedir)/$$f"; \ - done - -uninstall-libpurpleincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(libpurpleinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(libpurpleincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(libpurpleincludedir)/$$f"; \ - done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/win32 - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ - $(HEADERS) -install-binPROGRAMS: install-libLTLIBRARIES - -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(libpurpleincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-recursive - -clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-libpurpleincludeHEADERS install-pkgconfigDATA - -install-exec-am: install-binPROGRAMS install-binSCRIPTS \ - install-libLTLIBRARIES - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ - uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-libpurpleincludeHEADERS uninstall-pkgconfigDATA - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool clean-recursive ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-binSCRIPTS install-data install-data-am install-exec \ - install-exec-am install-info install-info-am \ - install-libLTLIBRARIES install-libpurpleincludeHEADERS \ - install-man install-pkgconfigDATA install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-libpurpleincludeHEADERS \ - uninstall-pkgconfigDATA - - -marshallers.h: marshallers.list - @echo "Generating marshallers.h" - $(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --header > marshallers.h - -marshallers.c: marshallers.list marshallers.h - @echo "Generating marshallers.c" - echo "#include \"marshallers.h\"" > marshallers.c - $(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --body >> marshallers.c - -@ENABLE_DBUS_TRUE@dbus-types.c: dbus-analyze-types.py $(purple_build_coreheaders) -@ENABLE_DBUS_TRUE@ cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=PURPLE_DBUS_DEFINE_TYPE\(%s\) > $@ - -@ENABLE_DBUS_TRUE@dbus-types.h: dbus-analyze-types.py $(purple_build_coreheaders) -@ENABLE_DBUS_TRUE@ cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --pattern=PURPLE_DBUS_DECLARE_TYPE\(%s\) > $@ - -@ENABLE_DBUS_TRUE@dbus-bindings.c: dbus-analyze-functions.py $(dbus_exported) -@ENABLE_DBUS_TRUE@ cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py > $@ - -@ENABLE_DBUS_TRUE@dbus-signals.c: dbus-analyze-signals.py $(dbus_signals) -@ENABLE_DBUS_TRUE@ cat $(dbus_signals) | $(PYTHON) $(srcdir)/dbus-analyze-signals.py > $@ - -@ENABLE_DBUS_TRUE@dbus-server.$(OBJEXT): dbus-bindings.c dbus-signals.c dbus-types.c dbus-types.h -@ENABLE_DBUS_TRUE@dbus-server.lo: dbus-bindings.c dbus-signals.c dbus-types.c dbus-types.h -@ENABLE_DBUS_TRUE@$(libpurple_la_OBJECTS): dbus-types.h - -@ENABLE_DBUS_TRUE@purple-client-bindings.c: dbus-analyze-functions.py $(dbus_exported) -@ENABLE_DBUS_TRUE@ cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py --client > $@ - -@ENABLE_DBUS_TRUE@purple-client-bindings.h: dbus-analyze-types.py dbus-analyze-functions.py $(purple_coreheaders) $(purple_builtheaders) $(dbus_exported) -@ENABLE_DBUS_TRUE@ cat $(purple_build_coreheaders) | $(PYTHON) $(srcdir)/dbus-analyze-types.py --keyword=enum --verbatim > $@ -@ENABLE_DBUS_TRUE@ cat $(dbus_build_exported) | $(PYTHON) $(srcdir)/dbus-analyze-functions.py --client --headers >> $@ - -@ENABLE_DBUS_TRUE@$(libpurple_client_la_OBJECTS): purple-client-bindings.h purple-client-bindings.c - -@ENABLE_DBUS_TRUE@purple-client-example.$(OBJEXT): purple-client-bindings.h -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libpurple -# - -PIDGIN_TREE_TOP := .. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libpurple -NEEDED_DLLS = $(LIBXML2_TOP)/bin/libxml2.dll - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(LIBXML2_TOP)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(LIBXML2_TOP)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = \ - account.c \ - accountopt.c \ - blist.c \ - buddyicon.c \ - certificate.c \ - cipher.c \ - circbuffer.c \ - cmds.c \ - connection.c \ - conversation.c \ - core.c \ - debug.c \ - dnsquery.c \ - dnssrv.c \ - eventloop.c \ - ft.c \ - idle.c \ - imgstore.c \ - log.c \ - media.c \ - mediamanager.c \ - mime.c \ - nat-pmp.c \ - network.c \ - notify.c \ - ntlm.c \ - plugin.c \ - pluginpref.c \ - pounce.c \ - prefs.c \ - privacy.c \ - proxy.c \ - prpl.c \ - request.c \ - roomlist.c \ - savedstatuses.c \ - server.c \ - signals.c \ - smiley.c \ - sound-theme-loader.c \ - sound-theme.c \ - sound.c \ - sslconn.c \ - status.c \ - stringref.c \ - stun.c \ - theme-loader.c \ - theme-manager.c \ - theme.c \ - upnp.c \ - util.c \ - value.c \ - version.c \ - whiteboard.c \ - xmlnode.c \ - win32/giowin32.c \ - win32/libc_interface.c \ - win32/win32dep.c - -RC_SRC = win32/libpurplerc.rc - -OBJECTS = $(C_SRC:%.c=%.o) $(RC_SRC:%.rc=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgthread-2.0 \ - -lgobject-2.0 \ - -lgmodule-2.0 \ - -lintl \ - -lws2_32 \ - -lxml2 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install install_shallow clean - -all: $(TARGET).dll - $(MAKE) -C $(PURPLE_PROTOS_TOP) -f $(MINGW_MAKEFILE) - $(MAKE) -C $(PURPLE_PLUGINS_TOP) -f $(MINGW_MAKEFILE) - -install_shallow: $(PURPLE_INSTALL_DIR) $(TARGET).dll - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -install: install_shallow all - $(MAKE) -C $(PURPLE_PROTOS_TOP) -f $(MINGW_MAKEFILE) install - $(MAKE) -C $(PURPLE_PLUGINS_TOP) -f $(MINGW_MAKEFILE) install - -./win32/libpurplerc.rc: ./win32/libpurplerc.rc.in $(PIDGIN_TREE_TOP)/VERSION - sed -e 's/@PURPLE_VERSION@/$(PURPLE_VERSION)/g' \ - $@.in > $@ - -$(OBJECTS): $(PURPLE_CONFIG_H) $(PURPLE_VERSION_H) $(PURPLE_PURPLE_H) - -$(TARGET).dll $(TARGET).dll.a: $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--output-def,$(TARGET).def,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(RC_SRC) $(PURPLE_VERSION_H) $(PURPLE_PURPLE_H) - rm -f $(TARGET).dll $(TARGET).dll.a $(TARGET).def - $(MAKE) -C $(PURPLE_PROTOS_TOP) -f $(MINGW_MAKEFILE) clean - $(MAKE) -C $(PURPLE_PLUGINS_TOP) -f $(MINGW_MAKEFILE) clean - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,288 +0,0 @@ -#include "marshallers.h" - -#include - - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_char (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_long -#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* VOID:POINTER,POINTER,OBJECT (./marshallers.list:1) */ -void -purple_smarshal_VOID__POINTER_POINTER_OBJECT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__POINTER_POINTER_OBJECT) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_VOID__POINTER_POINTER_OBJECT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__POINTER_POINTER_OBJECT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_pointer (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - g_marshal_value_peek_object (param_values + 3), - data2); -} - -/* BOOLEAN:OBJECT,POINTER,STRING (./marshallers.list:2) */ -void -purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef gboolean (*GMarshalFunc_BOOLEAN__OBJECT_POINTER_STRING) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_BOOLEAN__OBJECT_POINTER_STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__OBJECT_POINTER_STRING) (marshal_data ? marshal_data : cc->callback); - - v_return = callback (data1, - g_marshal_value_peek_object (param_values + 1), - g_marshal_value_peek_pointer (param_values + 2), - g_marshal_value_peek_string (param_values + 3), - data2); - - g_value_set_boolean (return_value, v_return); -} - -/* VOID:STRING,STRING (./marshallers.list:3) */ -void -purple_smarshal_VOID__STRING_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_VOID__STRING_STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_string (param_values + 1), - g_marshal_value_peek_string (param_values + 2), - data2); -} - -/* VOID:STRING,STRING,DOUBLE (./marshallers.list:4) */ -void -purple_smarshal_VOID__STRING_STRING_DOUBLE (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__STRING_STRING_DOUBLE) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gdouble arg_3, - gpointer data2); - register GMarshalFunc_VOID__STRING_STRING_DOUBLE callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_STRING_DOUBLE) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_string (param_values + 1), - g_marshal_value_peek_string (param_values + 2), - g_marshal_value_peek_double (param_values + 3), - data2); -} - -/* VOID:ENUM,STRING,STRING (./marshallers.list:5) */ -void -purple_smarshal_VOID__ENUM_STRING_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__ENUM_STRING_STRING) (gpointer data1, - gint arg_1, - gpointer arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_VOID__ENUM_STRING_STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__ENUM_STRING_STRING) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_enum (param_values + 1), - g_marshal_value_peek_string (param_values + 2), - g_marshal_value_peek_string (param_values + 3), - data2); -} - -/* VOID:ENUM,STRING,STRING,BOOLEAN (./marshallers.list:6) */ -void -purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__ENUM_STRING_STRING_BOOLEAN) (gpointer data1, - gint arg_1, - gpointer arg_2, - gpointer arg_3, - gboolean arg_4, - gpointer data2); - register GMarshalFunc_VOID__ENUM_STRING_STRING_BOOLEAN callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 5); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__ENUM_STRING_STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_enum (param_values + 1), - g_marshal_value_peek_string (param_values + 2), - g_marshal_value_peek_string (param_values + 3), - g_marshal_value_peek_boolean (param_values + 4), - data2); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ - -#ifndef __purple_smarshal_MARSHAL_H__ -#define __purple_smarshal_MARSHAL_H__ - -#include - -G_BEGIN_DECLS - -/* VOID:POINTER,POINTER,OBJECT (./marshallers.list:1) */ -extern void purple_smarshal_VOID__POINTER_POINTER_OBJECT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* BOOLEAN:OBJECT,POINTER,STRING (./marshallers.list:2) */ -extern void purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:STRING,STRING (./marshallers.list:3) */ -extern void purple_smarshal_VOID__STRING_STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:STRING,STRING,DOUBLE (./marshallers.list:4) */ -extern void purple_smarshal_VOID__STRING_STRING_DOUBLE (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:ENUM,STRING,STRING (./marshallers.list:5) */ -extern void purple_smarshal_VOID__ENUM_STRING_STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:ENUM,STRING,STRING,BOOLEAN (./marshallers.list:6) */ -extern void purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -G_END_DECLS - -#endif /* __purple_smarshal_MARSHAL_H__ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.list qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.list --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.list 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/marshallers.list 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -VOID:POINTER,POINTER,OBJECT -BOOLEAN:OBJECT,POINTER,STRING -VOID:STRING,STRING -VOID:STRING,STRING,DOUBLE -VOID:ENUM,STRING,STRING -VOID:ENUM,STRING,STRING,BOOLEAN diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3322 +0,0 @@ -/** - * @file media.c Media API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "account.h" -#include "media.h" -#include "mediamanager.h" -#include "network.h" - -#include "debug.h" - -#ifdef USE_GSTREAMER -#include "marshallers.h" -#include "media-gst.h" -#endif - -#ifdef USE_VV - -#include -#include - -/** @copydoc _PurpleMediaSession */ -typedef struct _PurpleMediaSession PurpleMediaSession; -/** @copydoc _PurpleMediaStream */ -typedef struct _PurpleMediaStream PurpleMediaStream; -/** @copydoc _PurpleMediaClass */ -typedef struct _PurpleMediaClass PurpleMediaClass; -/** @copydoc _PurpleMediaPrivate */ -typedef struct _PurpleMediaPrivate PurpleMediaPrivate; -/** @copydoc _PurpleMediaCandidateClass */ -typedef struct _PurpleMediaCandidateClass PurpleMediaCandidateClass; -/** @copydoc _PurpleMediaCandidatePrivate */ -typedef struct _PurpleMediaCandidatePrivate PurpleMediaCandidatePrivate; -/** @copydoc _PurpleMediaCodecClass */ -typedef struct _PurpleMediaCodecClass PurpleMediaCodecClass; -/** @copydoc _PurpleMediaCodecPrivate */ -typedef struct _PurpleMediaCodecPrivate PurpleMediaCodecPrivate; - -/** The media class */ -struct _PurpleMediaClass -{ - GObjectClass parent_class; /**< The parent class. */ -}; - -/** The media class's private data */ -struct _PurpleMedia -{ - GObject parent; /**< The parent of this object. */ - PurpleMediaPrivate *priv; /**< The private data of this object. */ -}; - -struct _PurpleMediaSession -{ - gchar *id; - PurpleMedia *media; - GstElement *src; - GstElement *tee; - FsSession *session; - - PurpleMediaSessionType type; - gboolean initiator; -}; - -struct _PurpleMediaStream -{ - PurpleMediaSession *session; - gchar *participant; - FsStream *stream; - GstElement *src; - GstElement *tee; - GstElement *volume; - GstElement *level; - - GList *local_candidates; - GList *remote_candidates; - - gboolean initiator; - gboolean accepted; - gboolean candidates_prepared; - gboolean held; - gboolean paused; - - GList *active_local_candidates; - GList *active_remote_candidates; - - guint connected_cb_id; -}; -#endif - -struct _PurpleMediaPrivate -{ -#ifdef USE_VV - PurpleMediaManager *manager; - PurpleAccount *account; - FsConference *conference; - gboolean initiator; - gpointer prpl_data; - - GHashTable *sessions; /* PurpleMediaSession table */ - GHashTable *participants; /* FsParticipant table */ - - GList *streams; /* PurpleMediaStream table */ - - GstElement *confbin; -#else - gpointer dummy; -#endif -}; - -#ifdef USE_VV -#define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate)) -#define PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidatePrivate)) -#define PURPLE_MEDIA_CODEC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodecPrivate)) - -static void purple_media_class_init (PurpleMediaClass *klass); -static void purple_media_init (PurpleMedia *media); -static void purple_media_dispose (GObject *object); -static void purple_media_finalize (GObject *object); -static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); - -static void purple_media_new_local_candidate_cb(FsStream *stream, - FsCandidate *local_candidate, PurpleMediaSession *session); -static void purple_media_candidates_prepared_cb(FsStream *stream, - PurpleMediaSession *session); -static void purple_media_candidate_pair_established_cb(FsStream *stream, - FsCandidate *native_candidate, FsCandidate *remote_candidate, - PurpleMediaSession *session); -static gboolean media_bus_call(GstBus *bus, - GstMessage *msg, PurpleMedia *media); - -static GObjectClass *parent_class = NULL; - - - -enum { - S_ERROR, - CANDIDATES_PREPARED, - CODECS_CHANGED, - LEVEL, - NEW_CANDIDATE, - STATE_CHANGED, - STREAM_INFO, - LAST_SIGNAL -}; -static guint purple_media_signals[LAST_SIGNAL] = {0}; - -enum { - PROP_0, - PROP_MANAGER, - PROP_ACCOUNT, - PROP_CONFERENCE, - PROP_INITIATOR, - PROP_PRPL_DATA, -}; -#endif - - -/* - * PurpleMediaElementType - */ - -GType -purple_media_session_type_get_type() -{ - static GType type = 0; - if (type == 0) { - static const GFlagsValue values[] = { - { PURPLE_MEDIA_NONE, - "PURPLE_MEDIA_NONE", "none" }, - { PURPLE_MEDIA_RECV_AUDIO, - "PURPLE_MEDIA_RECV_AUDIO", "recv-audio" }, - { PURPLE_MEDIA_SEND_AUDIO, - "PURPLE_MEDIA_SEND_AUDIO", "send-audio" }, - { PURPLE_MEDIA_RECV_VIDEO, - "PURPLE_MEDIA_RECV_VIDEO", "recv-video" }, - { PURPLE_MEDIA_SEND_VIDEO, - "PURPLE_MEDIA_SEND_VIDEO", "send-audio" }, - { PURPLE_MEDIA_AUDIO, - "PURPLE_MEDIA_AUDIO", "audio" }, - { PURPLE_MEDIA_VIDEO, - "PURPLE_MEDIA_VIDEO", "video" }, - { 0, NULL, NULL } - }; - type = g_flags_register_static( - "PurpleMediaSessionType", values); - } - return type; -} - -GType -purple_media_get_type() -{ -#ifdef USE_VV - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleMediaClass), - NULL, - NULL, - (GClassInitFunc) purple_media_class_init, - NULL, - NULL, - sizeof(PurpleMedia), - 0, - (GInstanceInitFunc) purple_media_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0); - } - return type; -#else - return G_TYPE_NONE; -#endif -} - -GType -purple_media_state_changed_get_type() -{ - static GType type = 0; - if (type == 0) { - static const GEnumValue values[] = { - { PURPLE_MEDIA_STATE_NEW, - "PURPLE_MEDIA_STATE_NEW", "new" }, - { PURPLE_MEDIA_STATE_CONNECTED, - "PURPLE_MEDIA_STATE_CONNECTED", "connected" }, - { PURPLE_MEDIA_STATE_END, - "PURPLE_MEDIA_STATE_END", "end" }, - { 0, NULL, NULL } - }; - type = g_enum_register_static("PurpleMediaState", values); - } - return type; -} - -GType -purple_media_info_type_get_type() -{ - static GType type = 0; - if (type == 0) { - static const GEnumValue values[] = { - { PURPLE_MEDIA_INFO_HANGUP, - "PURPLE_MEDIA_INFO_HANGUP", "hangup" }, - { PURPLE_MEDIA_INFO_ACCEPT, - "PURPLE_MEDIA_INFO_ACCEPT", "accept" }, - { PURPLE_MEDIA_INFO_REJECT, - "PURPLE_MEDIA_INFO_REJECT", "reject" }, - { PURPLE_MEDIA_INFO_MUTE, - "PURPLE_MEDIA_INFO_MUTE", "mute" }, - { PURPLE_MEDIA_INFO_UNMUTE, - "PURPLE_MEDIA_INFO_UNMUTE", "unmute" }, - { PURPLE_MEDIA_INFO_PAUSE, - "PURPLE_MEDIA_INFO_PAUSE", "pause" }, - { PURPLE_MEDIA_INFO_UNPAUSE, - "PURPLE_MEDIA_INFO_UNPAUSE", "unpause" }, - { PURPLE_MEDIA_INFO_HOLD, - "PURPLE_MEDIA_INFO_HOLD", "hold" }, - { PURPLE_MEDIA_INFO_UNHOLD, - "PURPLE_MEDIA_INFO_UNHOLD", "unhold" }, - { 0, NULL, NULL } - }; - type = g_enum_register_static("PurpleMediaInfoType", values); - } - return type; -} - -#ifdef USE_VV -static void -purple_media_class_init (PurpleMediaClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->dispose = purple_media_dispose; - gobject_class->finalize = purple_media_finalize; - gobject_class->set_property = purple_media_set_property; - gobject_class->get_property = purple_media_get_property; - - g_object_class_install_property(gobject_class, PROP_MANAGER, - g_param_spec_object("manager", - "Purple Media Manager", - "The media manager that contains this media session.", - PURPLE_TYPE_MEDIA_MANAGER, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_ACCOUNT, - g_param_spec_pointer("account", - "PurpleAccount", - "The account this media session is on.", - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_CONFERENCE, - g_param_spec_object("conference", - "Farsight conference", - "The FsConference associated with this media.", - FS_TYPE_CONFERENCE, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)); - - g_object_class_install_property(gobject_class, PROP_INITIATOR, - g_param_spec_boolean("initiator", - "initiator", - "If the local user initiated the conference.", - FALSE, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PRPL_DATA, - g_param_spec_pointer("prpl-data", - "gpointer", - "Data the prpl plugin set on the media session.", - G_PARAM_READWRITE)); - - purple_media_signals[S_ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - purple_smarshal_VOID__STRING_STRING, - G_TYPE_NONE, 2, G_TYPE_STRING, - G_TYPE_STRING); - purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - purple_media_signals[LEVEL] = g_signal_new("level", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - purple_smarshal_VOID__STRING_STRING_DOUBLE, - G_TYPE_NONE, 3, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_DOUBLE); - purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - purple_smarshal_VOID__POINTER_POINTER_OBJECT, - G_TYPE_NONE, 3, G_TYPE_POINTER, - G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE); - purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - purple_smarshal_VOID__ENUM_STRING_STRING, - G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE, - G_TYPE_STRING, G_TYPE_STRING); - purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, 0, NULL, NULL, - purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN, - G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); - g_type_class_add_private(klass, sizeof(PurpleMediaPrivate)); -} - - -static void -purple_media_init (PurpleMedia *media) -{ - media->priv = PURPLE_MEDIA_GET_PRIVATE(media); - memset(media->priv, 0, sizeof(*media->priv)); -} - -static void -purple_media_stream_free(PurpleMediaStream *stream) -{ - if (stream == NULL) - return; - - /* Remove the connected_cb timeout */ - if (stream->connected_cb_id != 0) - purple_timeout_remove(stream->connected_cb_id); - - g_free(stream->participant); - - if (stream->local_candidates) - fs_candidate_list_destroy(stream->local_candidates); - if (stream->remote_candidates) - fs_candidate_list_destroy(stream->remote_candidates); - - if (stream->active_local_candidates) - fs_candidate_list_destroy(stream->active_local_candidates); - if (stream->active_remote_candidates) - fs_candidate_list_destroy(stream->active_remote_candidates); - - g_free(stream); -} - -static void -purple_media_session_free(PurpleMediaSession *session) -{ - if (session == NULL) - return; - - g_free(session->id); - g_free(session); -} - -static void -purple_media_dispose(GObject *media) -{ - PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media); - GList *iter = NULL; - - purple_debug_info("media","purple_media_dispose\n"); - - purple_media_manager_remove_media(priv->manager, PURPLE_MEDIA(media)); - - if (priv->confbin) { - gst_element_set_locked_state(priv->confbin, TRUE); - gst_element_set_state(GST_ELEMENT(priv->confbin), - GST_STATE_NULL); - gst_bin_remove(GST_BIN(purple_media_manager_get_pipeline( - priv->manager)), priv->confbin); - priv->confbin = NULL; - priv->conference = NULL; - } - - for (iter = priv->streams; iter; iter = g_list_next(iter)) { - PurpleMediaStream *stream = iter->data; - if (stream->stream) { - g_object_unref(stream->stream); - stream->stream = NULL; - } - } - - if (priv->sessions) { - GList *sessions = g_hash_table_get_values(priv->sessions); - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - PurpleMediaSession *session = sessions->data; - if (session->session) { - g_object_unref(session->session); - session->session = NULL; - } - } - } - - if (priv->participants) { - GList *participants = g_hash_table_get_values(priv->participants); - for (; participants; participants = g_list_delete_link(participants, participants)) - g_object_unref(participants->data); - } - - if (priv->manager) { - GstElement *pipeline = purple_media_manager_get_pipeline( - priv->manager); - GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); - g_signal_handlers_disconnect_matched(G_OBJECT(bus), - G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, - 0, 0, 0, media_bus_call, media); - gst_object_unref(bus); - - g_object_unref(priv->manager); - priv->manager = NULL; - } - - G_OBJECT_CLASS(parent_class)->dispose(media); -} - -static void -purple_media_finalize(GObject *media) -{ - PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media); - purple_debug_info("media","purple_media_finalize\n"); - - for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams)) - purple_media_stream_free(priv->streams->data); - - if (priv->sessions) { - GList *sessions = g_hash_table_get_values(priv->sessions); - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - purple_media_session_free(sessions->data); - } - g_hash_table_destroy(priv->sessions); - } - - G_OBJECT_CLASS(parent_class)->finalize(media); -} - -static void -purple_media_setup_pipeline(PurpleMedia *media) -{ - GstBus *bus; - gchar *name; - GstElement *pipeline; - - if (media->priv->conference == NULL || media->priv->manager == NULL) - return; - - pipeline = purple_media_manager_get_pipeline(media->priv->manager); - - name = g_strdup_printf("conf_%p", - media->priv->conference); - media->priv->confbin = gst_bin_new(name); - g_free(name); - - bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); - g_signal_connect(G_OBJECT(bus), "message", - G_CALLBACK(media_bus_call), media); - gst_object_unref(bus); - - gst_bin_add(GST_BIN(pipeline), - media->priv->confbin); - gst_bin_add(GST_BIN(media->priv->confbin), - GST_ELEMENT(media->priv->conference)); - gst_element_set_state(GST_ELEMENT(media->priv->confbin), - GST_STATE_PLAYING); -} - -static void -purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - PurpleMedia *media; - g_return_if_fail(PURPLE_IS_MEDIA(object)); - - media = PURPLE_MEDIA(object); - - switch (prop_id) { - case PROP_MANAGER: - media->priv->manager = g_value_get_object(value); - g_object_ref(media->priv->manager); - - purple_media_setup_pipeline(media); - break; - case PROP_ACCOUNT: - media->priv->account = g_value_get_pointer(value); - break; - case PROP_CONFERENCE: { - if (media->priv->conference) - gst_object_unref(media->priv->conference); - media->priv->conference = g_value_get_object(value); - gst_object_ref(media->priv->conference); - - purple_media_setup_pipeline(media); - break; - } - case PROP_INITIATOR: - media->priv->initiator = g_value_get_boolean(value); - break; - case PROP_PRPL_DATA: - media->priv->prpl_data = g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - PurpleMedia *media; - g_return_if_fail(PURPLE_IS_MEDIA(object)); - - media = PURPLE_MEDIA(object); - - switch (prop_id) { - case PROP_MANAGER: - g_value_set_object(value, media->priv->manager); - break; - case PROP_ACCOUNT: - g_value_set_pointer(value, media->priv->account); - break; - case PROP_CONFERENCE: - g_value_set_object(value, media->priv->conference); - break; - case PROP_INITIATOR: - g_value_set_boolean(value, media->priv->initiator); - break; - case PROP_PRPL_DATA: - g_value_set_pointer(value, media->priv->prpl_data); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } - -} -#endif - -/* - * PurpleMediaCandidateType - */ - -GType -purple_media_candidate_type_get_type() -{ - static GType type = 0; - if (type == 0) { - static const GEnumValue values[] = { - { PURPLE_MEDIA_CANDIDATE_TYPE_HOST, - "PURPLE_MEDIA_CANDIDATE_TYPE_HOST", - "host" }, - { PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, - "PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX", - "srflx" }, - { PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX, - "PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX", - "prflx" }, - { PURPLE_MEDIA_CANDIDATE_TYPE_RELAY, - "PPURPLE_MEDIA_CANDIDATE_TYPE_RELAY", - "relay" }, - { PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST, - "PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST", - "multicast" }, - { 0, NULL, NULL } - }; - type = g_enum_register_static("PurpleMediaCandidateType", - values); - } - return type; -} - -/* - * PurpleMediaNetworkProtocol - */ - -GType -purple_media_network_protocol_get_type() -{ - static GType type = 0; - if (type == 0) { - static const GEnumValue values[] = { - { PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - "PURPLE_MEDIA_NETWORK_PROTOCOL_UDP", - "udp" }, - { PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, - "PURPLE_MEDIA_NETWORK_PROTOCOL_TCP", - "tcp" }, - { 0, NULL, NULL } - }; - type = g_enum_register_static("PurpleMediaNetworkProtocol", - values); - } - return type; -} - -/* - * PurpleMediaCandidate - */ - -struct _PurpleMediaCandidateClass -{ - GObjectClass parent_class; -}; - -struct _PurpleMediaCandidate -{ - GObject parent; -}; - -#ifdef USE_VV -struct _PurpleMediaCandidatePrivate -{ - gchar *foundation; - guint component_id; - gchar *ip; - guint16 port; - gchar *base_ip; - guint16 base_port; - PurpleMediaNetworkProtocol proto; - guint32 priority; - PurpleMediaCandidateType type; - gchar *username; - gchar *password; - guint ttl; -}; - -enum { - PROP_CANDIDATE_0, - PROP_FOUNDATION, - PROP_COMPONENT_ID, - PROP_IP, - PROP_PORT, - PROP_BASE_IP, - PROP_BASE_PORT, - PROP_PROTOCOL, - PROP_PRIORITY, - PROP_TYPE, - PROP_USERNAME, - PROP_PASSWORD, - PROP_TTL, -}; - -static void -purple_media_candidate_init(PurpleMediaCandidate *info) -{ - PurpleMediaCandidatePrivate *priv = - PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(info); - priv->foundation = NULL; - priv->component_id = 0; - priv->ip = NULL; - priv->port = 0; - priv->base_ip = NULL; - priv->proto = PURPLE_MEDIA_NETWORK_PROTOCOL_UDP; - priv->priority = 0; - priv->type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST; - priv->username = NULL; - priv->password = NULL; - priv->ttl = 0; -} - -static void -purple_media_candidate_finalize(GObject *info) -{ - PurpleMediaCandidatePrivate *priv = - PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(info); - - g_free(priv->foundation); - g_free(priv->ip); - g_free(priv->base_ip); - g_free(priv->username); - g_free(priv->password); -} - -static void -purple_media_candidate_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - PurpleMediaCandidatePrivate *priv; - g_return_if_fail(PURPLE_IS_MEDIA_CANDIDATE(object)); - - priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_FOUNDATION: - g_free(priv->foundation); - priv->foundation = g_value_dup_string(value); - break; - case PROP_COMPONENT_ID: - priv->component_id = g_value_get_uint(value); - break; - case PROP_IP: - g_free(priv->ip); - priv->ip = g_value_dup_string(value); - break; - case PROP_PORT: - priv->port = g_value_get_uint(value); - break; - case PROP_BASE_IP: - g_free(priv->base_ip); - priv->base_ip = g_value_dup_string(value); - break; - case PROP_BASE_PORT: - priv->base_port = g_value_get_uint(value); - break; - case PROP_PROTOCOL: - priv->proto = g_value_get_enum(value); - break; - case PROP_PRIORITY: - priv->priority = g_value_get_uint(value); - break; - case PROP_TYPE: - priv->type = g_value_get_enum(value); - break; - case PROP_USERNAME: - g_free(priv->username); - priv->username = g_value_dup_string(value); - break; - case PROP_PASSWORD: - g_free(priv->password); - priv->password = g_value_dup_string(value); - break; - case PROP_TTL: - priv->ttl = g_value_get_uint(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID( - object, prop_id, pspec); - break; - } -} - -static void -purple_media_candidate_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - PurpleMediaCandidatePrivate *priv; - g_return_if_fail(PURPLE_IS_MEDIA_CANDIDATE(object)); - - priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_FOUNDATION: - g_value_set_string(value, priv->foundation); - break; - case PROP_COMPONENT_ID: - g_value_set_uint(value, priv->component_id); - break; - case PROP_IP: - g_value_set_string(value, priv->ip); - break; - case PROP_PORT: - g_value_set_uint(value, priv->port); - break; - case PROP_BASE_IP: - g_value_set_string(value, priv->base_ip); - break; - case PROP_BASE_PORT: - g_value_set_uint(value, priv->base_port); - break; - case PROP_PROTOCOL: - g_value_set_enum(value, priv->proto); - break; - case PROP_PRIORITY: - g_value_set_uint(value, priv->priority); - break; - case PROP_TYPE: - g_value_set_enum(value, priv->type); - break; - case PROP_USERNAME: - g_value_set_string(value, priv->username); - break; - case PROP_PASSWORD: - g_value_set_string(value, priv->password); - break; - case PROP_TTL: - g_value_set_uint(value, priv->ttl); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID( - object, prop_id, pspec); - break; - } -} - -static void -purple_media_candidate_class_init(PurpleMediaCandidateClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - - gobject_class->finalize = purple_media_candidate_finalize; - gobject_class->set_property = purple_media_candidate_set_property; - gobject_class->get_property = purple_media_candidate_get_property; - - g_object_class_install_property(gobject_class, PROP_FOUNDATION, - g_param_spec_string("foundation", - "Foundation", - "The foundation of the candidate.", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_COMPONENT_ID, - g_param_spec_uint("component-id", - "Component ID", - "The component id of the candidate.", - 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_IP, - g_param_spec_string("ip", - "IP Address", - "The IP address of the candidate.", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PORT, - g_param_spec_uint("port", - "Port", - "The port of the candidate.", - 0, G_MAXUINT16, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_BASE_IP, - g_param_spec_string("base-ip", - "Base IP", - "The internal IP address of the candidate.", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_BASE_PORT, - g_param_spec_uint("base-port", - "Base Port", - "The internal port of the candidate.", - 0, G_MAXUINT16, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PROTOCOL, - g_param_spec_enum("protocol", - "Protocol", - "The protocol of the candidate.", - PURPLE_TYPE_MEDIA_NETWORK_PROTOCOL, - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PRIORITY, - g_param_spec_uint("priority", - "Priority", - "The priority of the candidate.", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_TYPE, - g_param_spec_enum("type", - "Type", - "The type of the candidate.", - PURPLE_TYPE_MEDIA_CANDIDATE_TYPE, - PURPLE_MEDIA_CANDIDATE_TYPE_HOST, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_USERNAME, - g_param_spec_string("username", - "Username", - "The username used to connect to the candidate.", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PASSWORD, - g_param_spec_string("password", - "Password", - "The password use to connect to the candidate.", - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_TTL, - g_param_spec_uint("ttl", - "TTL", - "The TTL of the candidate.", - 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(PurpleMediaCandidatePrivate)); -} - -G_DEFINE_TYPE(PurpleMediaCandidate, - purple_media_candidate, G_TYPE_OBJECT); -#else -GType -purple_media_candidate_get_type() -{ - return G_TYPE_NONE; -} -#endif - -PurpleMediaCandidate * -purple_media_candidate_new(const gchar *foundation, guint component_id, - PurpleMediaCandidateType type, - PurpleMediaNetworkProtocol proto, - const gchar *ip, guint port) -{ - return g_object_new(PURPLE_TYPE_MEDIA_CANDIDATE, - "foundation", foundation, - "component-id", component_id, - "type", type, - "protocol", proto, - "ip", ip, - "port", port, NULL); -} - -static PurpleMediaCandidate * -purple_media_candidate_copy(PurpleMediaCandidate *candidate) -{ -#ifdef USE_VV - PurpleMediaCandidatePrivate *priv; - PurpleMediaCandidate *new_candidate; - - if (candidate == NULL) - return NULL; - - priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(candidate); - - new_candidate = purple_media_candidate_new(priv->foundation, - priv->component_id, priv->type, priv->proto, - priv->ip, priv->port); - g_object_set(new_candidate, - "base-ip", priv->base_ip, - "base-port", priv->base_port, - "priority", priv->priority, - "username", priv->username, - "password", priv->password, - "ttl", priv->ttl, NULL); - return new_candidate; -#else - return NULL; -#endif -} - -#ifdef USE_VV -static FsCandidate * -purple_media_candidate_to_fs(PurpleMediaCandidate *candidate) -{ - PurpleMediaCandidatePrivate *priv; - FsCandidate *fscandidate; - - if (candidate == NULL) - return NULL; - - priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(candidate); - - fscandidate = fs_candidate_new(priv->foundation, - priv->component_id, priv->type, - priv->proto, priv->ip, priv->port); - - fscandidate->base_ip = g_strdup(priv->base_ip); - fscandidate->base_port = priv->base_port; - fscandidate->priority = priv->priority; - fscandidate->username = g_strdup(priv->username); - fscandidate->password = g_strdup(priv->password); - fscandidate->ttl = priv->ttl; - return fscandidate; -} - -static PurpleMediaCandidate * -purple_media_candidate_from_fs(FsCandidate *fscandidate) -{ - PurpleMediaCandidate *candidate; - - if (fscandidate == NULL) - return NULL; - - candidate = purple_media_candidate_new(fscandidate->foundation, - fscandidate->component_id, fscandidate->type, - fscandidate->proto, fscandidate->ip, fscandidate->port); - g_object_set(candidate, - "base-ip", fscandidate->base_ip, - "base-port", fscandidate->base_port, - "priority", fscandidate->priority, - "username", fscandidate->username, - "password", fscandidate->password, - "ttl", fscandidate->ttl, NULL); - return candidate; -} - -static GList * -purple_media_candidate_list_from_fs(GList *candidates) -{ - GList *new_list = NULL; - - for (; candidates; candidates = g_list_next(candidates)) { - new_list = g_list_prepend(new_list, - purple_media_candidate_from_fs( - candidates->data)); - } - - new_list = g_list_reverse(new_list); - return new_list; -} - -static GList * -purple_media_candidate_list_to_fs(GList *candidates) -{ - GList *new_list = NULL; - - for (; candidates; candidates = g_list_next(candidates)) { - new_list = g_list_prepend(new_list, - purple_media_candidate_to_fs( - candidates->data)); - } - - new_list = g_list_reverse(new_list); - return new_list; -} -#endif - -GList * -purple_media_candidate_list_copy(GList *candidates) -{ - GList *new_list = NULL; - - for (; candidates; candidates = g_list_next(candidates)) { - new_list = g_list_prepend(new_list, - purple_media_candidate_copy(candidates->data)); - } - - new_list = g_list_reverse(new_list); - return new_list; -} - -void -purple_media_candidate_list_free(GList *candidates) -{ - for (; candidates; candidates = - g_list_delete_link(candidates, candidates)) { - g_object_unref(candidates->data); - } -} - -gchar * -purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate) -{ - gchar *foundation; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL); - g_object_get(candidate, "foundation", &foundation, NULL); - return foundation; -} - -guint -purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate) -{ - guint component_id; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0); - g_object_get(candidate, "component-id", &component_id, NULL); - return component_id; -} - -gchar * -purple_media_candidate_get_ip(PurpleMediaCandidate *candidate) -{ - gchar *ip; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL); - g_object_get(candidate, "ip", &ip, NULL); - return ip; -} - -guint16 -purple_media_candidate_get_port(PurpleMediaCandidate *candidate) -{ - guint port; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0); - g_object_get(candidate, "port", &port, NULL); - return port; -} - -gchar * -purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate) -{ - gchar *base_ip; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL); - g_object_get(candidate, "base-ip", &base_ip, NULL); - return base_ip; -} - -guint16 -purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate) -{ - guint base_port; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0); - g_object_get(candidate, "base_port", &base_port, NULL); - return base_port; -} - -PurpleMediaNetworkProtocol -purple_media_candidate_get_protocol(PurpleMediaCandidate *candidate) -{ - PurpleMediaNetworkProtocol protocol; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP); - g_object_get(candidate, "protocol", &protocol, NULL); - return protocol; -} - -guint32 -purple_media_candidate_get_priority(PurpleMediaCandidate *candidate) -{ - guint priority; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0); - g_object_get(candidate, "priority", &priority, NULL); - return priority; -} - -PurpleMediaCandidateType -purple_media_candidate_get_candidate_type(PurpleMediaCandidate *candidate) -{ - PurpleMediaCandidateType type; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), - PURPLE_MEDIA_CANDIDATE_TYPE_HOST); - g_object_get(candidate, "type", &type, NULL); - return type; -} - -gchar * -purple_media_candidate_get_username(PurpleMediaCandidate *candidate) -{ - gchar *username; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL); - g_object_get(candidate, "username", &username, NULL); - return username; -} - -gchar * -purple_media_candidate_get_password(PurpleMediaCandidate *candidate) -{ - gchar *password; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL); - g_object_get(candidate, "password", &password, NULL); - return password; -} - -guint -purple_media_candidate_get_ttl(PurpleMediaCandidate *candidate) -{ - guint ttl; - g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0); - g_object_get(candidate, "ttl", &ttl, NULL); - return ttl; -} - -#ifdef USE_VV -static FsMediaType -purple_media_to_fs_media_type(PurpleMediaSessionType type) -{ - if (type & PURPLE_MEDIA_AUDIO) - return FS_MEDIA_TYPE_AUDIO; - else if (type & PURPLE_MEDIA_VIDEO) - return FS_MEDIA_TYPE_VIDEO; - else - return 0; -} - -static FsStreamDirection -purple_media_to_fs_stream_direction(PurpleMediaSessionType type) -{ - if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO || - (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO) - return FS_DIRECTION_BOTH; - else if ((type & PURPLE_MEDIA_SEND_AUDIO) || - (type & PURPLE_MEDIA_SEND_VIDEO)) - return FS_DIRECTION_SEND; - else if ((type & PURPLE_MEDIA_RECV_AUDIO) || - (type & PURPLE_MEDIA_RECV_VIDEO)) - return FS_DIRECTION_RECV; - else - return FS_DIRECTION_NONE; -} - -static PurpleMediaSessionType -purple_media_from_fs(FsMediaType type, FsStreamDirection direction) -{ - PurpleMediaSessionType result = PURPLE_MEDIA_NONE; - if (type == FS_MEDIA_TYPE_AUDIO) { - if (direction & FS_DIRECTION_SEND) - result |= PURPLE_MEDIA_SEND_AUDIO; - if (direction & FS_DIRECTION_RECV) - result |= PURPLE_MEDIA_RECV_AUDIO; - } else if (type == FS_MEDIA_TYPE_VIDEO) { - if (direction & FS_DIRECTION_SEND) - result |= PURPLE_MEDIA_SEND_VIDEO; - if (direction & FS_DIRECTION_RECV) - result |= PURPLE_MEDIA_RECV_VIDEO; - } - return result; -} -#endif - -/* - * PurpleMediaCodec - */ - -struct _PurpleMediaCodecClass -{ - GObjectClass parent_class; -}; - -struct _PurpleMediaCodec -{ - GObject parent; -}; - -#ifdef USE_VV -struct _PurpleMediaCodecPrivate -{ - gint id; - char *encoding_name; - PurpleMediaSessionType media_type; - guint clock_rate; - guint channels; - GList *optional_params; -}; - -enum { - PROP_CODEC_0, - PROP_ID, - PROP_ENCODING_NAME, - PROP_MEDIA_TYPE, - PROP_CLOCK_RATE, - PROP_CHANNELS, - PROP_OPTIONAL_PARAMS, -}; - -static void -purple_media_codec_init(PurpleMediaCodec *info) -{ - PurpleMediaCodecPrivate *priv = - PURPLE_MEDIA_CODEC_GET_PRIVATE(info); - priv->encoding_name = NULL; - priv->optional_params = NULL; -} - -static void -purple_media_codec_finalize(GObject *info) -{ - PurpleMediaCodecPrivate *priv = - PURPLE_MEDIA_CODEC_GET_PRIVATE(info); - g_free(priv->encoding_name); - for (; priv->optional_params; priv->optional_params = - g_list_delete_link(priv->optional_params, - priv->optional_params)) { - g_free(priv->optional_params->data); - } -} - -static void -purple_media_codec_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - PurpleMediaCodecPrivate *priv; - g_return_if_fail(PURPLE_IS_MEDIA_CODEC(object)); - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_ID: - priv->id = g_value_get_uint(value); - break; - case PROP_ENCODING_NAME: - g_free(priv->encoding_name); - priv->encoding_name = g_value_dup_string(value); - break; - case PROP_MEDIA_TYPE: - priv->media_type = g_value_get_flags(value); - break; - case PROP_CLOCK_RATE: - priv->clock_rate = g_value_get_uint(value); - break; - case PROP_CHANNELS: - priv->channels = g_value_get_uint(value); - break; - case PROP_OPTIONAL_PARAMS: - priv->optional_params = g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID( - object, prop_id, pspec); - break; - } -} - -static void -purple_media_codec_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - PurpleMediaCodecPrivate *priv; - g_return_if_fail(PURPLE_IS_MEDIA_CODEC(object)); - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_ID: - g_value_set_uint(value, priv->id); - break; - case PROP_ENCODING_NAME: - g_value_set_string(value, priv->encoding_name); - break; - case PROP_MEDIA_TYPE: - g_value_set_flags(value, priv->media_type); - break; - case PROP_CLOCK_RATE: - g_value_set_uint(value, priv->clock_rate); - break; - case PROP_CHANNELS: - g_value_set_uint(value, priv->channels); - break; - case PROP_OPTIONAL_PARAMS: - g_value_set_pointer(value, priv->optional_params); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID( - object, prop_id, pspec); - break; - } -} - -static void -purple_media_codec_class_init(PurpleMediaCodecClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - - gobject_class->finalize = purple_media_codec_finalize; - gobject_class->set_property = purple_media_codec_set_property; - gobject_class->get_property = purple_media_codec_get_property; - - g_object_class_install_property(gobject_class, PROP_ID, - g_param_spec_uint("id", - "ID", - "The numeric identifier of the codec.", - 0, G_MAXUINT, 0, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_ENCODING_NAME, - g_param_spec_string("encoding-name", - "Encoding Name", - "The name of the codec.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, - g_param_spec_flags("media-type", - "Media Type", - "Whether this is an audio of video codec.", - PURPLE_TYPE_MEDIA_SESSION_TYPE, - PURPLE_MEDIA_NONE, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_CLOCK_RATE, - g_param_spec_uint("clock-rate", - "Create Callback", - "The function called to create this element.", - 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_CHANNELS, - g_param_spec_uint("channels", - "Channels", - "The number of channels in this codec.", - 0, G_MAXUINT, 0, - G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, PROP_OPTIONAL_PARAMS, - g_param_spec_pointer("optional-params", - "Optional Params", - "A list of optional parameters for the codec.", - G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(PurpleMediaCodecPrivate)); -} - -G_DEFINE_TYPE(PurpleMediaCodec, - purple_media_codec, G_TYPE_OBJECT); -#else -GType -purple_media_codec_get_type() -{ - return G_TYPE_NONE; -} -#endif - -guint -purple_media_codec_get_id(PurpleMediaCodec *codec) -{ - guint id; - g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), 0); - g_object_get(codec, "id", &id, NULL); - return id; -} - -gchar * -purple_media_codec_get_encoding_name(PurpleMediaCodec *codec) -{ - gchar *name; - g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), NULL); - g_object_get(codec, "encoding-name", &name, NULL); - return name; -} - -guint -purple_media_codec_get_clock_rate(PurpleMediaCodec *codec) -{ - guint clock_rate; - g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), 0); - g_object_get(codec, "clock-rate", &clock_rate, NULL); - return clock_rate; -} - -guint -purple_media_codec_get_channels(PurpleMediaCodec *codec) -{ - guint channels; - g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), 0); - g_object_get(codec, "channels", &channels, NULL); - return channels; -} - -GList * -purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec) -{ - GList *optional_params; - g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), NULL); - g_object_get(codec, "optional-params", &optional_params, NULL); - return optional_params; -} - -void -purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, - const gchar *name, const gchar *value) -{ -#ifdef USE_VV - PurpleMediaCodecPrivate *priv; - PurpleKeyValuePair *new_param; - - g_return_if_fail(codec != NULL); - g_return_if_fail(name != NULL && value != NULL); - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec); - - new_param = g_new0(PurpleKeyValuePair, 1); - new_param->key = g_strdup(name); - new_param->value = g_strdup(value); - priv->optional_params = g_list_append( - priv->optional_params, new_param); -#endif -} - -void -purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, - PurpleKeyValuePair *param) -{ -#ifdef USE_VV - PurpleMediaCodecPrivate *priv; - - g_return_if_fail(codec != NULL && param != NULL); - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec); - - g_free(param->key); - g_free(param->value); - g_free(param); - - priv->optional_params = - g_list_remove(priv->optional_params, param); -#endif -} - -PurpleKeyValuePair * -purple_media_codec_get_optional_parameter(PurpleMediaCodec *codec, - const gchar *name, const gchar *value) -{ -#ifdef USE_VV - PurpleMediaCodecPrivate *priv; - GList *iter; - - g_return_val_if_fail(codec != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec); - - for (iter = priv->optional_params; iter; iter = g_list_next(iter)) { - PurpleKeyValuePair *param = iter->data; - if (!g_ascii_strcasecmp(param->key, name) && - (value == NULL || - !g_ascii_strcasecmp(param->value, value))) - return param; - } -#endif - - return NULL; -} - -PurpleMediaCodec * -purple_media_codec_new(int id, const char *encoding_name, - PurpleMediaSessionType media_type, guint clock_rate) -{ - PurpleMediaCodec *codec = - g_object_new(PURPLE_TYPE_MEDIA_CODEC, - "id", id, - "encoding_name", encoding_name, - "media_type", media_type, - "clock-rate", clock_rate, NULL); - return codec; -} - -static PurpleMediaCodec * -purple_media_codec_copy(PurpleMediaCodec *codec) -{ -#ifdef USE_VV - PurpleMediaCodecPrivate *priv; - PurpleMediaCodec *new_codec; - GList *iter; - - if (codec == NULL) - return NULL; - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec); - - new_codec = purple_media_codec_new(priv->id, priv->encoding_name, - priv->media_type, priv->clock_rate); - g_object_set(codec, "channels", priv->channels, NULL); - - for (iter = priv->optional_params; iter; iter = g_list_next(iter)) { - PurpleKeyValuePair *param = - (PurpleKeyValuePair*)iter->data; - purple_media_codec_add_optional_parameter(new_codec, - param->key, param->value); - } - - return new_codec; -#else - return NULL; -#endif -} - -#ifdef USE_VV -static FsCodec * -purple_media_codec_to_fs(const PurpleMediaCodec *codec) -{ - PurpleMediaCodecPrivate *priv; - FsCodec *new_codec; - GList *iter; - - if (codec == NULL) - return NULL; - - priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec); - - new_codec = fs_codec_new(priv->id, priv->encoding_name, - purple_media_to_fs_media_type(priv->media_type), - priv->clock_rate); - new_codec->channels = priv->channels; - - for (iter = priv->optional_params; iter; iter = g_list_next(iter)) { - PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data; - fs_codec_add_optional_parameter(new_codec, - param->key, param->value); - } - - return new_codec; -} - -static PurpleMediaCodec * -purple_media_codec_from_fs(const FsCodec *codec) -{ - PurpleMediaCodec *new_codec; - GList *iter; - - if (codec == NULL) - return NULL; - - new_codec = purple_media_codec_new(codec->id, codec->encoding_name, - purple_media_from_fs(codec->media_type, - FS_DIRECTION_BOTH), codec->clock_rate); - g_object_set(new_codec, "channels", codec->channels, NULL); - - for (iter = codec->optional_params; iter; iter = g_list_next(iter)) { - FsCodecParameter *param = (FsCodecParameter*)iter->data; - purple_media_codec_add_optional_parameter(new_codec, - param->name, param->value); - } - - return new_codec; -} -#endif - -gchar * -purple_media_codec_to_string(const PurpleMediaCodec *codec) -{ -#ifdef USE_VV - FsCodec *fscodec = purple_media_codec_to_fs(codec); - gchar *str = fs_codec_to_string(fscodec); - fs_codec_destroy(fscodec); - return str; -#else - return g_strdup(""); -#endif -} - -#ifdef USE_VV -static GList * -purple_media_codec_list_from_fs(GList *codecs) -{ - GList *new_list = NULL; - - for (; codecs; codecs = g_list_next(codecs)) { - new_list = g_list_prepend(new_list, - purple_media_codec_from_fs( - codecs->data)); - } - - new_list = g_list_reverse(new_list); - return new_list; -} - -static GList * -purple_media_codec_list_to_fs(GList *codecs) -{ - GList *new_list = NULL; - - for (; codecs; codecs = g_list_next(codecs)) { - new_list = g_list_prepend(new_list, - purple_media_codec_to_fs( - codecs->data)); - } - - new_list = g_list_reverse(new_list); - return new_list; -} -#endif - -GList * -purple_media_codec_list_copy(GList *codecs) -{ - GList *new_list = NULL; - - for (; codecs; codecs = g_list_next(codecs)) { - new_list = g_list_prepend(new_list, - purple_media_codec_copy(codecs->data)); - } - - new_list = g_list_reverse(new_list); - return new_list; -} - -void -purple_media_codec_list_free(GList *codecs) -{ - for (; codecs; codecs = - g_list_delete_link(codecs, codecs)) { - g_object_unref(codecs->data); - } -} - -#ifdef USE_VV -static PurpleMediaSession* -purple_media_get_session(PurpleMedia *media, const gchar *sess_id) -{ - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - return (PurpleMediaSession*) (media->priv->sessions) ? - g_hash_table_lookup(media->priv->sessions, sess_id) : NULL; -} - -static FsParticipant* -purple_media_get_participant(PurpleMedia *media, const gchar *name) -{ - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - return (FsParticipant*) (media->priv->participants) ? - g_hash_table_lookup(media->priv->participants, name) : NULL; -} - -static PurpleMediaStream* -purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant) -{ - GList *streams; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - - streams = media->priv->streams; - - for (; streams; streams = g_list_next(streams)) { - PurpleMediaStream *stream = streams->data; - if (!strcmp(stream->session->id, session) && - !strcmp(stream->participant, participant)) - return stream; - } - - return NULL; -} - -static GList * -purple_media_get_streams(PurpleMedia *media, const gchar *session, - const gchar *participant) -{ - GList *streams; - GList *ret = NULL; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - - streams = media->priv->streams; - - for (; streams; streams = g_list_next(streams)) { - PurpleMediaStream *stream = streams->data; - if ((session == NULL || - !strcmp(stream->session->id, session)) && - (participant == NULL || - !strcmp(stream->participant, participant))) - ret = g_list_append(ret, stream); - } - - return ret; -} - -static void -purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session) -{ - g_return_if_fail(PURPLE_IS_MEDIA(media)); - g_return_if_fail(session != NULL); - - if (!media->priv->sessions) { - purple_debug_info("media", "Creating hash table for sessions\n"); - media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal); - } - g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session); -} - -static gboolean -purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session) -{ - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - return g_hash_table_remove(media->priv->sessions, session->id); -} - -static FsParticipant * -purple_media_add_participant(PurpleMedia *media, const gchar *name) -{ - FsParticipant *participant; - GError *err = NULL; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - - participant = purple_media_get_participant(media, name); - - if (participant) - return participant; - - participant = fs_conference_new_participant(media->priv->conference, - (gchar*)name, &err); - - if (err) { - purple_debug_error("media", "Error creating participant: %s\n", - err->message); - g_error_free(err); - return NULL; - } - - if (!media->priv->participants) { - purple_debug_info("media", "Creating hash table for participants\n"); - media->priv->participants = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, NULL); - } - - g_hash_table_insert(media->priv->participants, g_strdup(name), participant); - - return participant; -} - -static PurpleMediaStream * -purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream) -{ - PurpleMediaStream *media_stream; - - g_return_val_if_fail(session != NULL, NULL); - - media_stream = g_new0(PurpleMediaStream, 1); - media_stream->stream = stream; - media_stream->participant = g_strdup(name); - media_stream->session = session; - - session->media->priv->streams = - g_list_append(session->media->priv->streams, media_stream); - - return media_stream; -} - -static void -purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name, - FsCandidate *candidate) -{ - PurpleMediaStream *stream; - - g_return_if_fail(session != NULL); - - stream = purple_media_get_stream(session->media, session->id, name); - stream->local_candidates = g_list_append(stream->local_candidates, candidate); -} -#endif - -GList * -purple_media_get_session_ids(PurpleMedia *media) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - return media->priv->sessions != NULL ? - g_hash_table_get_keys(media->priv->sessions) : NULL; -#else - return NULL; -#endif -} - -#ifdef USE_VV -static void -purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src) -{ - PurpleMediaSession *session; - GstPad *sinkpad; - GstPad *srcpad; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - g_return_if_fail(GST_IS_ELEMENT(src)); - - session = purple_media_get_session(media, sess_id); - - if (session == NULL) { - purple_debug_warning("media", "purple_media_set_src: trying" - " to set src on non-existent session\n"); - return; - } - - if (session->src) - gst_object_unref(session->src); - session->src = src; - gst_element_set_locked_state(session->src, TRUE); - - session->tee = gst_element_factory_make("tee", NULL); - gst_bin_add(GST_BIN(session->media->priv->confbin), session->tee); - - /* This supposedly isn't necessary, but it silences some warnings */ - if (GST_ELEMENT_PARENT(session->media->priv->confbin) - == GST_ELEMENT_PARENT(session->src)) { - GstPad *pad = gst_element_get_static_pad(session->tee, "sink"); - GstPad *ghost = gst_ghost_pad_new(NULL, pad); - gst_object_unref(pad); - gst_pad_set_active(ghost, TRUE); - gst_element_add_pad(session->media->priv->confbin, ghost); - } - - gst_element_set_state(session->tee, GST_STATE_PLAYING); - gst_element_link(session->src, session->media->priv->confbin); - - g_object_get(session->session, "sink-pad", &sinkpad, NULL); - if (session->type & PURPLE_MEDIA_SEND_AUDIO) { - gchar *name = g_strdup_printf("volume_%s", session->id); - GstElement *level; - GstElement *volume = gst_element_factory_make("volume", name); - double input_volume = purple_prefs_get_int( - "/purple/media/audio/volume/input")/10.0; - g_free(name); - name = g_strdup_printf("sendlevel_%s", session->id); - level = gst_element_factory_make("level", name); - g_free(name); - gst_bin_add(GST_BIN(session->media->priv->confbin), volume); - gst_bin_add(GST_BIN(session->media->priv->confbin), level); - gst_element_set_state(level, GST_STATE_PLAYING); - gst_element_set_state(volume, GST_STATE_PLAYING); - gst_element_link(volume, level); - gst_element_link(session->tee, volume); - srcpad = gst_element_get_static_pad(level, "src"); - g_object_set(volume, "volume", input_volume, NULL); - } else { - srcpad = gst_element_get_request_pad(session->tee, "src%d"); - } - purple_debug_info("media", "connecting pad: %s\n", - gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK - ? "success" : "failure"); - gst_element_set_locked_state(session->src, FALSE); - gst_object_unref(session->src); -} -#endif - -#ifdef USE_GSTREAMER -GstElement * -purple_media_get_src(PurpleMedia *media, const gchar *sess_id) -{ -#ifdef USE_VV - PurpleMediaSession *session; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - session = purple_media_get_session(media, sess_id); - return (session != NULL) ? session->src : NULL; -#else - return NULL; -#endif -} -#endif /* USE_GSTREAMER */ - -#ifdef USE_VV -static PurpleMediaSession * -purple_media_session_from_fs_stream(PurpleMedia *media, FsStream *stream) -{ - FsSession *fssession; - GList *values; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - g_return_val_if_fail(FS_IS_STREAM(stream), NULL); - - g_object_get(stream, "session", &fssession, NULL); - - values = g_hash_table_get_values(media->priv->sessions); - - for (; values; values = g_list_delete_link(values, values)) { - PurpleMediaSession *session = values->data; - - if (session->session == fssession) { - g_list_free(values); - g_object_unref(fssession); - return session; - } - } - - g_object_unref(fssession); - return NULL; -} - -static gboolean -media_bus_call(GstBus *bus, GstMessage *msg, PurpleMedia *media) -{ - switch(GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_ELEMENT: { - if (g_signal_has_handler_pending(media, - purple_media_signals[LEVEL], 0, FALSE) - && gst_structure_has_name( - gst_message_get_structure(msg), "level")) { - GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg)); - gchar *name; - gchar *participant = NULL; - PurpleMediaSession *session = NULL; - gdouble rms_db; - gdouble percent; - const GValue *list; - const GValue *value; - - if (!PURPLE_IS_MEDIA(media) || - GST_ELEMENT_PARENT(src) != - media->priv->confbin) - break; - - name = gst_element_get_name(src); - if (!strncmp(name, "sendlevel_", 10)) { - session = purple_media_get_session( - media, name+10); - } else { - GList *iter = media->priv->streams; - for (; iter; iter = g_list_next(iter)) { - PurpleMediaStream *stream = iter->data; - if (stream->level == src) { - session = stream->session; - participant = stream->participant; - break; - } - } - } - g_free(name); - if (!session) - break; - - list = gst_structure_get_value( - gst_message_get_structure(msg), "rms"); - value = gst_value_list_get_value(list, 0); - rms_db = g_value_get_double(value); - percent = pow(10, rms_db / 20) * 5; - if(percent > 1.0) - percent = 1.0; - - g_signal_emit(media, purple_media_signals[LEVEL], - 0, session->id, participant, percent); - break; - } - if (!FS_IS_CONFERENCE(GST_MESSAGE_SRC(msg)) || - !PURPLE_IS_MEDIA(media) || - media->priv->conference != - FS_CONFERENCE(GST_MESSAGE_SRC(msg))) - break; - - if (gst_structure_has_name(msg->structure, "farsight-error")) { - FsError error_no; - gst_structure_get_enum(msg->structure, "error-no", - FS_TYPE_ERROR, (gint*)&error_no); - switch (error_no) { - case FS_ERROR_NO_CODECS: - purple_media_error(media, _("No codecs found. Install some GStreamer codecs found in GStreamer plugins packages.")); - purple_media_end(media, NULL, NULL); - break; - case FS_ERROR_NO_CODECS_LEFT: - purple_media_error(media, _("No codecs left. Your codec preferences in fs-codecs.conf are too strict.")); - purple_media_end(media, NULL, NULL); - break; - case FS_ERROR_UNKNOWN_CNAME: - /* - * Unknown CName is only a problem for the - * multicast transmitter which isn't used. - * It is also deprecated. - */ - break; - default: - purple_debug_error("media", "farsight-error: %i: %s\n", error_no, - gst_structure_get_string(msg->structure, "error-msg")); - break; - } - - if (FS_ERROR_IS_FATAL(error_no)) { - purple_media_error(media, _("A non-recoverable Farsight2 error has occurred.")); - purple_media_end(media, NULL, NULL); - } - } else if (gst_structure_has_name(msg->structure, - "farsight-new-local-candidate")) { - FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream")); - FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "candidate")); - PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream); - purple_media_new_local_candidate_cb(stream, local_candidate, session); - } else if (gst_structure_has_name(msg->structure, - "farsight-local-candidates-prepared")) { - FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream")); - PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream); - purple_media_candidates_prepared_cb(stream, session); - } else if (gst_structure_has_name(msg->structure, - "farsight-new-active-candidate-pair")) { - FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream")); - FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "local-candidate")); - FsCandidate *remote_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "remote-candidate")); - PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream); - purple_media_candidate_pair_established_cb(stream, local_candidate, remote_candidate, session); - } else if (gst_structure_has_name(msg->structure, - "farsight-recv-codecs-changed")) { - GList *codecs = g_value_get_boxed(gst_structure_get_value(msg->structure, "codecs")); - FsCodec *codec = codecs->data; - purple_debug_info("media", "farsight-recv-codecs-changed: %s\n", codec->encoding_name); - - } else if (gst_structure_has_name(msg->structure, - "farsight-component-state-changed")) { - FsStreamState fsstate = g_value_get_enum(gst_structure_get_value(msg->structure, "state")); - guint component = g_value_get_uint(gst_structure_get_value(msg->structure, "component")); - const gchar *state; - switch (fsstate) { - case FS_STREAM_STATE_FAILED: - state = "FAILED"; - break; - case FS_STREAM_STATE_DISCONNECTED: - state = "DISCONNECTED"; - break; - case FS_STREAM_STATE_GATHERING: - state = "GATHERING"; - break; - case FS_STREAM_STATE_CONNECTING: - state = "CONNECTING"; - break; - case FS_STREAM_STATE_CONNECTED: - state = "CONNECTED"; - break; - case FS_STREAM_STATE_READY: - state = "READY"; - break; - default: - state = "UNKNOWN"; - break; - } - purple_debug_info("media", "farsight-component-state-changed: component: %u state: %s\n", component, state); - } else if (gst_structure_has_name(msg->structure, - "farsight-send-codec-changed")) { - FsCodec *codec = g_value_get_boxed(gst_structure_get_value(msg->structure, "codec")); - gchar *codec_str = fs_codec_to_string(codec); - purple_debug_info("media", "farsight-send-codec-changed: codec: %s\n", codec_str); - g_free(codec_str); - } else if (gst_structure_has_name(msg->structure, - "farsight-codecs-changed")) { - GList *sessions = g_hash_table_get_values(PURPLE_MEDIA(media)->priv->sessions); - FsSession *fssession = g_value_get_object(gst_structure_get_value(msg->structure, "session")); - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - PurpleMediaSession *session = sessions->data; - if (session->session == fssession) { - gchar *session_id = g_strdup(session->id); - g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, session_id); - g_free(session_id); - g_list_free(sessions); - break; - } - } - } - break; - } - case GST_MESSAGE_ERROR: { - GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg)); - GstElement *lastElement = NULL; - while (!GST_IS_PIPELINE(element)) { - if (element == media->priv->confbin) { - purple_media_error(media, _("Conference error")); - purple_media_end(media, NULL, NULL); - break; - } - lastElement = element; - element = GST_ELEMENT_PARENT(element); - } - if (GST_IS_PIPELINE(element)) { - GList *sessions = g_hash_table_get_values(media->priv->sessions); - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - PurpleMediaSession *session = sessions->data; - - if (session->src == lastElement) { - if (session->type & PURPLE_MEDIA_AUDIO) - purple_media_error(media, _("Error with your microphone")); - else - purple_media_error(media, _("Error with your webcam")); - purple_media_end(media, NULL, NULL); - break; - } - } - g_list_free(sessions); - } - } - default: - break; - } - - return TRUE; -} -#endif - -PurpleAccount * -purple_media_get_account(PurpleMedia *media) -{ -#ifdef USE_VV - PurpleAccount *account; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - g_object_get(G_OBJECT(media), "account", &account, NULL); - return account; -#else - return NULL; -#endif -} - -gpointer -purple_media_get_prpl_data(PurpleMedia *media) -{ -#ifdef USE_VV - gpointer prpl_data; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL); - return prpl_data; -#else - return NULL; -#endif -} - -void -purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data) -{ -#ifdef USE_VV - g_return_if_fail(PURPLE_IS_MEDIA(media)); - g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL); -#endif -} - -void -purple_media_error(PurpleMedia *media, const gchar *error, ...) -{ -#ifdef USE_VV - va_list args; - gchar *message; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - va_start(args, error); - message = g_strdup_vprintf(error, args); - va_end(args); - - purple_debug_error("media", "%s\n", message); - g_signal_emit(media, purple_media_signals[S_ERROR], 0, message); - - g_free(message); -#endif -} - -void -purple_media_end(PurpleMedia *media, - const gchar *session_id, const gchar *participant) -{ -#ifdef USE_VV - g_return_if_fail(PURPLE_IS_MEDIA(media)); - if (session_id == NULL && participant == NULL) { - g_signal_emit(media, purple_media_signals[STATE_CHANGED], - 0, PURPLE_MEDIA_STATE_END, - NULL, NULL); - g_object_unref(media); - } -#endif -} - -void -purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, - const gchar *session_id, const gchar *participant, - gboolean local) -{ -#ifdef USE_VV - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - if (type == PURPLE_MEDIA_INFO_ACCEPT) { - GList *streams; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - streams = purple_media_get_streams(media, - session_id, participant); - - for (; streams; streams = - g_list_delete_link(streams, streams)) { - PurpleMediaStream *stream = streams->data; - g_object_set(G_OBJECT(stream->stream), "direction", - purple_media_to_fs_stream_direction( - stream->session->type), NULL); - stream->accepted = TRUE; - - if (stream->remote_candidates != NULL && - stream->initiator == FALSE) { - GError *err = NULL; - fs_stream_set_remote_candidates(stream->stream, - stream->remote_candidates, &err); - - if (err) { - purple_debug_error("media", "Error adding remote" - " candidates: %s\n", err->message); - g_error_free(err); - } - } - } - } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE || - type == PURPLE_MEDIA_INFO_UNMUTE)) { - GList *sessions; - gboolean active = (type == PURPLE_MEDIA_INFO_MUTE); - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - if (session_id == NULL) - sessions = g_hash_table_get_values( - media->priv->sessions); - else - sessions = g_list_prepend(NULL, - purple_media_get_session( - media, session_id)); - - purple_debug_info("media", "Turning mute %s\n", - active ? "on" : "off"); - - for (; sessions; sessions = g_list_delete_link( - sessions, sessions)) { - PurpleMediaSession *session = sessions->data; - if (session->type & PURPLE_MEDIA_SEND_AUDIO) { - gchar *name = g_strdup_printf("volume_%s", - session->id); - GstElement *volume = gst_bin_get_by_name( - GST_BIN(session->media-> - priv->confbin), name); - g_free(name); - g_object_set(volume, "mute", active, NULL); - } - } - } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE || - type == PURPLE_MEDIA_INFO_UNPAUSE)) { - gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE); - GList *streams = purple_media_get_streams(media, - session_id, participant); - for (; streams; streams = g_list_delete_link(streams, streams)) { - PurpleMediaStream *stream = streams->data; - if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) { - stream->paused = active; - - if (!stream->held) - g_object_set(stream->stream, "direction", - purple_media_to_fs_stream_direction( - stream->session->type & ((active) ? - ~PURPLE_MEDIA_SEND_VIDEO : - PURPLE_MEDIA_VIDEO)), NULL); - } - } - } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD || - type == PURPLE_MEDIA_INFO_UNHOLD)) { - GList *streams; - gboolean active = (type == PURPLE_MEDIA_INFO_HOLD); - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - streams = purple_media_get_streams(media, - session_id, participant); - for (; streams; streams = g_list_delete_link(streams, streams)) { - PurpleMediaStream *stream = streams->data; - stream->held = active; - if (stream->session->type & PURPLE_MEDIA_VIDEO) { - FsStreamDirection direction; - - direction = ((active) ? - ~PURPLE_MEDIA_VIDEO : - PURPLE_MEDIA_VIDEO); - if (!active && stream->paused) - direction &= ~PURPLE_MEDIA_SEND_VIDEO; - - g_object_set(stream->stream, "direction", - purple_media_to_fs_stream_direction( - stream->session->type & direction), NULL); - } else if (stream->session->type & PURPLE_MEDIA_AUDIO) { - g_object_set(stream->stream, "direction", - purple_media_to_fs_stream_direction( - stream->session->type & ((active) ? - ~PURPLE_MEDIA_AUDIO : - PURPLE_MEDIA_AUDIO)), NULL); - } - } - } - - g_signal_emit(media, purple_media_signals[STREAM_INFO], - 0, type, session_id, participant, local); - - if (type == PURPLE_MEDIA_INFO_HANGUP || - type == PURPLE_MEDIA_INFO_REJECT) { - purple_media_end(media, session_id, participant); - } -#endif -} - -#ifdef USE_VV -static void -purple_media_new_local_candidate_cb(FsStream *stream, - FsCandidate *local_candidate, - PurpleMediaSession *session) -{ - gchar *name; - FsParticipant *participant; - PurpleMediaCandidate *candidate; - - g_return_if_fail(FS_IS_STREAM(stream)); - g_return_if_fail(session != NULL); - - purple_debug_info("media", "got new local candidate: %s\n", local_candidate->foundation); - g_object_get(stream, "participant", &participant, NULL); - g_object_get(participant, "cname", &name, NULL); - g_object_unref(participant); - - purple_media_insert_local_candidate(session, name, fs_candidate_copy(local_candidate)); - - candidate = purple_media_candidate_from_fs(local_candidate); - g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE], - 0, session->id, name, candidate); - g_object_unref(candidate); - - g_free(name); -} - -static void -purple_media_candidates_prepared_cb(FsStream *stream, PurpleMediaSession *session) -{ - gchar *name; - FsParticipant *participant; - PurpleMediaStream *stream_data; - - g_return_if_fail(FS_IS_STREAM(stream)); - g_return_if_fail(session != NULL); - - g_object_get(stream, "participant", &participant, NULL); - g_object_get(participant, "cname", &name, NULL); - g_object_unref(participant); - - stream_data = purple_media_get_stream(session->media, session->id, name); - stream_data->candidates_prepared = TRUE; - - g_signal_emit(session->media, - purple_media_signals[CANDIDATES_PREPARED], - 0, session->id, name); - - g_free(name); -} - -/* callback called when a pair of transport candidates (local and remote) - * has been established */ -static void -purple_media_candidate_pair_established_cb(FsStream *fsstream, - FsCandidate *native_candidate, - FsCandidate *remote_candidate, - PurpleMediaSession *session) -{ - gchar *name; - FsParticipant *participant; - PurpleMediaStream *stream; - GList *iter; - - g_return_if_fail(FS_IS_STREAM(fsstream)); - g_return_if_fail(session != NULL); - - g_object_get(fsstream, "participant", &participant, NULL); - g_object_get(participant, "cname", &name, NULL); - g_object_unref(participant); - - stream = purple_media_get_stream(session->media, session->id, name); - - iter = stream->active_local_candidates; - for(; iter; iter = g_list_next(iter)) { - FsCandidate *c = iter->data; - if (native_candidate->component_id == c->component_id) { - fs_candidate_destroy(c); - stream->active_local_candidates = - g_list_delete_link(iter, iter); - stream->active_local_candidates = g_list_prepend( - stream->active_local_candidates, - fs_candidate_copy(native_candidate)); - break; - } - } - if (iter == NULL) - stream->active_local_candidates = g_list_prepend( - stream->active_local_candidates, - fs_candidate_copy(native_candidate)); - - iter = stream->active_remote_candidates; - for(; iter; iter = g_list_next(iter)) { - FsCandidate *c = iter->data; - if (native_candidate->component_id == c->component_id) { - fs_candidate_destroy(c); - stream->active_remote_candidates = - g_list_delete_link(iter, iter); - stream->active_remote_candidates = g_list_prepend( - stream->active_remote_candidates, - fs_candidate_copy(remote_candidate)); - break; - } - } - if (iter == NULL) - stream->active_remote_candidates = g_list_prepend( - stream->active_remote_candidates, - fs_candidate_copy(remote_candidate)); - - purple_debug_info("media", "candidate pair established\n"); -} - -static gboolean -purple_media_connected_cb(PurpleMediaStream *stream) -{ - g_return_val_if_fail(stream != NULL, FALSE); - - stream->connected_cb_id = 0; - - purple_media_manager_create_output_window( - stream->session->media->priv->manager, - stream->session->media, - stream->session->id, stream->participant); - - g_signal_emit(stream->session->media, - purple_media_signals[STATE_CHANGED], - 0, PURPLE_MEDIA_STATE_CONNECTED, - stream->session->id, stream->participant); - return FALSE; -} - -static void -purple_media_src_pad_added_cb(FsStream *fsstream, GstPad *srcpad, - FsCodec *codec, PurpleMediaStream *stream) -{ - PurpleMediaPrivate *priv; - GstPad *sinkpad; - - g_return_if_fail(FS_IS_STREAM(fsstream)); - g_return_if_fail(stream != NULL); - - priv = stream->session->media->priv; - - if (stream->src == NULL) { - GstElement *sink = NULL; - - if (codec->media_type == FS_MEDIA_TYPE_AUDIO) { - GstElement *queue = NULL; - double output_volume = purple_prefs_get_int( - "/purple/media/audio/volume/output")/10.0; - /* - * Should this instead be: - * audioconvert ! audioresample ! liveadder ! - * audioresample ! audioconvert ! realsink - */ - queue = gst_element_factory_make("queue", NULL); - stream->volume = gst_element_factory_make( - "volume", NULL); - g_object_set(stream->volume, "volume", - output_volume, NULL); - stream->level = gst_element_factory_make( - "level", NULL); - stream->src = gst_element_factory_make( - "liveadder", NULL); - sink = purple_media_manager_get_element(priv->manager, - PURPLE_MEDIA_RECV_AUDIO, - stream->session->media, - stream->session->id, - stream->participant); - gst_bin_add(GST_BIN(priv->confbin), queue); - gst_bin_add(GST_BIN(priv->confbin), stream->volume); - gst_bin_add(GST_BIN(priv->confbin), stream->level); - gst_bin_add(GST_BIN(priv->confbin), sink); - gst_element_set_state(sink, GST_STATE_PLAYING); - gst_element_set_state(stream->level, GST_STATE_PLAYING); - gst_element_set_state(stream->volume, GST_STATE_PLAYING); - gst_element_set_state(queue, GST_STATE_PLAYING); - gst_element_link(stream->level, sink); - gst_element_link(stream->volume, stream->level); - gst_element_link(queue, stream->volume); - sink = queue; - } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) { - stream->src = gst_element_factory_make( - "fsfunnel", NULL); - sink = gst_element_factory_make( - "fakesink", NULL); - g_object_set(G_OBJECT(sink), "async", FALSE, NULL); - gst_bin_add(GST_BIN(priv->confbin), sink); - gst_element_set_state(sink, GST_STATE_PLAYING); - } - stream->tee = gst_element_factory_make("tee", NULL); - gst_bin_add_many(GST_BIN(priv->confbin), - stream->src, stream->tee, NULL); - gst_element_set_state(stream->tee, GST_STATE_PLAYING); - gst_element_set_state(stream->src, GST_STATE_PLAYING); - gst_element_link_many(stream->src, stream->tee, sink, NULL); - } - - sinkpad = gst_element_get_request_pad(stream->src, "sink%d"); - gst_pad_link(srcpad, sinkpad); - gst_object_unref(sinkpad); - - stream->connected_cb_id = purple_timeout_add(0, - (GSourceFunc)purple_media_connected_cb, stream); -} - -static void -purple_media_element_added_cb(FsElementAddedNotifier *self, - GstBin *bin, GstElement *element, gpointer user_data) -{ - /* - * Hack to make H264 work with Gmail video. - */ - if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) { - g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL); - } -} -#endif /* USE_VV */ - -gboolean -purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, - const gchar *who, PurpleMediaSessionType type, - gboolean initiator, const gchar *transmitter, - guint num_params, GParameter *params) -{ -#ifdef USE_VV - PurpleMediaSession *session; - FsParticipant *participant = NULL; - PurpleMediaStream *stream = NULL; - FsMediaType media_type = purple_media_to_fs_media_type(type); - FsStreamDirection type_direction = - purple_media_to_fs_stream_direction(type); - gboolean is_nice = !strcmp(transmitter, "nice"); - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - session = purple_media_get_session(media, sess_id); - - if (!session) { - GError *err = NULL; - GList *codec_conf = NULL, *iter = NULL; - gchar *filename = NULL; - PurpleMediaSessionType session_type; - GstElement *src = NULL; - - session = g_new0(PurpleMediaSession, 1); - - session->session = fs_conference_new_session( - media->priv->conference, media_type, &err); - - if (err != NULL) { - purple_media_error(media, _("Error creating session: %s"), err->message); - g_error_free(err); - g_free(session); - return FALSE; - } - - filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL); - codec_conf = fs_codec_list_from_keyfile(filename, &err); - g_free(filename); - - if (err != NULL) { - if (err->code == 4) - purple_debug_info("media", "Couldn't read " - "fs-codec.conf: %s\n", - err->message); - else - purple_debug_error("media", "Error reading " - "fs-codec.conf: %s\n", - err->message); - g_error_free(err); - } - - /* - * Add SPEEX if the configuration file doesn't exist or - * there isn't a speex entry. - */ - for (iter = codec_conf; iter; iter = g_list_next(iter)) { - FsCodec *codec = iter->data; - if (!g_ascii_strcasecmp(codec->encoding_name, "speex")) - break; - } - - if (iter == NULL) { - codec_conf = g_list_prepend(codec_conf, - fs_codec_new(FS_CODEC_ID_ANY, - "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000)); - codec_conf = g_list_prepend(codec_conf, - fs_codec_new(FS_CODEC_ID_ANY, - "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000)); - } - - fs_session_set_codec_preferences(session->session, codec_conf, NULL); - - /* - * Removes a 5-7 second delay before - * receiving the src-pad-added signal. - * Only works for non-multicast FsRtpSessions. - */ - if (is_nice || !strcmp(transmitter, "rawudp")) - g_object_set(G_OBJECT(session->session), - "no-rtcp-timeout", 0, NULL); - - /* - * Hack to make x264 work with Gmail video. - */ - if (is_nice && !strcmp(sess_id, "google-video")) { - FsElementAddedNotifier *notifier = - fs_element_added_notifier_new(); - g_signal_connect(G_OBJECT(notifier), "element-added", - G_CALLBACK(purple_media_element_added_cb), - stream); - fs_element_added_notifier_add(notifier, - GST_BIN(media->priv->conference)); - } - - fs_codec_list_destroy(codec_conf); - - session->id = g_strdup(sess_id); - session->media = media; - session->type = type; - session->initiator = initiator; - - purple_media_add_session(media, session); - g_signal_emit(media, purple_media_signals[STATE_CHANGED], - 0, PURPLE_MEDIA_STATE_NEW, - session->id, NULL); - - if (type_direction & FS_DIRECTION_SEND) { - session_type = purple_media_from_fs(media_type, - FS_DIRECTION_SEND); - src = purple_media_manager_get_element( - media->priv->manager, session_type, - media, session->id, who); - if (!GST_IS_ELEMENT(src)) { - purple_debug_error("media", - "Error creating src for session %s\n", - session->id); - purple_media_end(media, session->id, NULL); - return FALSE; - } - - purple_media_set_src(media, session->id, src); - gst_element_set_state(session->src, GST_STATE_PLAYING); - purple_media_manager_create_output_window( - media->priv->manager, - session->media, - session->id, NULL); - } - } - - if (!(participant = purple_media_add_participant(media, who))) { - purple_media_remove_session(media, session); - g_free(session); - return FALSE; - } else { - g_signal_emit(media, purple_media_signals[STATE_CHANGED], - 0, PURPLE_MEDIA_STATE_NEW, - NULL, who); - } - - stream = purple_media_get_stream(media, sess_id, who); - - if (!stream) { - GError *err = NULL; - FsStream *fsstream = NULL; - const gchar *stun_ip = purple_network_get_stun_ip(); - const gchar *turn_ip = purple_network_get_turn_ip(); - - if (stun_ip || turn_ip) { - guint new_num_params = - (stun_ip && is_nice) && turn_ip ? - num_params + 2 : num_params + 1; - guint next_param_index = num_params; - GParameter *param = g_new0(GParameter, new_num_params); - memcpy(param, params, sizeof(GParameter) * num_params); - - if (stun_ip) { - purple_debug_info("media", - "setting property stun-ip on new stream: %s\n", stun_ip); - - param[next_param_index].name = "stun-ip"; - g_value_init(¶m[next_param_index].value, G_TYPE_STRING); - g_value_set_string(¶m[next_param_index].value, stun_ip); - next_param_index++; - } - - if (turn_ip && is_nice) { - GValueArray *relay_info = g_value_array_new(0); - GValue value; - gint turn_port = - purple_prefs_get_int("/purple/network/turn_port"); - const gchar *username = - purple_prefs_get_string("/purple/network/turn_username"); - const gchar *password = - purple_prefs_get_string("/purple/network/turn_password"); - GstStructure *turn_setup = gst_structure_new("relay-info", - "ip", G_TYPE_STRING, turn_ip, - "port", G_TYPE_UINT, turn_port, - "username", G_TYPE_STRING, username, - "password", G_TYPE_STRING, password, - NULL); - - if (turn_setup) { - memset(&value, 0, sizeof(GValue)); - g_value_init(&value, GST_TYPE_STRUCTURE); - gst_value_set_structure(&value, turn_setup); - relay_info = g_value_array_append(relay_info, &value); - gst_structure_free(turn_setup); - - purple_debug_info("media", - "setting property relay-info on new stream\n"); - param[next_param_index].name = "relay-info"; - g_value_init(¶m[next_param_index].value, - G_TYPE_VALUE_ARRAY); - g_value_set_boxed(¶m[next_param_index].value, - relay_info); - g_value_array_free(relay_info); - } else { - purple_debug_error("media", "Error relay info"); - g_object_unref(participant); - g_hash_table_remove(media->priv->participants, who); - purple_media_remove_session(media, session); - g_free(session); - return FALSE; - } - } - - fsstream = fs_session_new_stream(session->session, - participant, initiator == TRUE ? - type_direction : (type_direction & - FS_DIRECTION_RECV), transmitter, - new_num_params, param, &err); - g_free(param); - } else { - fsstream = fs_session_new_stream(session->session, - participant, initiator == TRUE ? - type_direction : (type_direction & - FS_DIRECTION_RECV), transmitter, - num_params, params, &err); - } - - if (fsstream == NULL) { - purple_debug_error("media", - "Error creating stream: %s\n", - err && err->message ? - err->message : "NULL"); - if (err) - g_error_free(err); - g_object_unref(participant); - g_hash_table_remove(media->priv->participants, who); - purple_media_remove_session(media, session); - g_free(session); - return FALSE; - } - - stream = purple_media_insert_stream(session, who, fsstream); - stream->initiator = initiator; - - /* callback for source pad added (new stream source ready) */ - g_signal_connect(G_OBJECT(fsstream), - "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), stream); - - g_signal_emit(media, purple_media_signals[STATE_CHANGED], - 0, PURPLE_MEDIA_STATE_NEW, - session->id, who); - } else { - if (purple_media_to_fs_stream_direction(stream->session->type) - != type_direction) { - /* change direction */ - g_object_set(stream->stream, "direction", - type_direction, NULL); - } - } - - return TRUE; -#else - return FALSE; -#endif /* USE_VV */ -} - -PurpleMediaManager * -purple_media_get_manager(PurpleMedia *media) -{ - PurpleMediaManager *ret; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - g_object_get(media, "manager", &ret, NULL); - return ret; -} - -PurpleMediaSessionType -purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id) -{ -#ifdef USE_VV - PurpleMediaSession *session; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE); - session = purple_media_get_session(media, sess_id); - return session->type; -#else - return PURPLE_MEDIA_NONE; -#endif -} -/* XXX: Should wait until codecs-ready is TRUE before using this function */ -GList * -purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id) -{ -#ifdef USE_VV - GList *fscodecs; - GList *codecs; - PurpleMediaSession *session; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - - session = purple_media_get_session(media, sess_id); - - if (session == NULL) - return NULL; - - g_object_get(G_OBJECT(session->session), - "codecs", &fscodecs, NULL); - codecs = purple_media_codec_list_from_fs(fscodecs); - fs_codec_list_destroy(fscodecs); - return codecs; -#else - return NULL; -#endif -} - -GList * -purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, - const gchar *participant) -{ -#ifdef USE_VV - PurpleMediaStream *stream; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - stream = purple_media_get_stream(media, sess_id, participant); - return stream ? purple_media_candidate_list_from_fs( - stream->local_candidates) : NULL; -#else - return NULL; -#endif -} - -void -purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, - const gchar *participant, - GList *remote_candidates) -{ -#ifdef USE_VV - PurpleMediaStream *stream; - GError *err = NULL; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - stream = purple_media_get_stream(media, sess_id, participant); - - if (stream == NULL) { - purple_debug_error("media", - "purple_media_add_remote_candidates: " - "couldn't find stream %s %s.\n", - sess_id ? sess_id : "(null)", - participant ? participant : "(null)"); - return; - } - - stream->remote_candidates = g_list_concat(stream->remote_candidates, - purple_media_candidate_list_to_fs(remote_candidates)); - - if (stream->initiator == TRUE || stream->accepted == TRUE) { - fs_stream_set_remote_candidates(stream->stream, - stream->remote_candidates, &err); - - if (err) { - purple_debug_error("media", "Error adding remote" - " candidates: %s\n", err->message); - g_error_free(err); - } - } -#endif -} - -#if 0 -/* - * These two functions aren't being used and I'd rather not lock in the API - * until they are needed. If they ever are. - */ - -GList * -purple_media_get_active_local_candidates(PurpleMedia *media, - const gchar *sess_id, const gchar *participant) -{ -#ifdef USE_VV - PurpleMediaStream *stream; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - stream = purple_media_get_stream(media, sess_id, participant); - return purple_media_candidate_list_from_fs( - stream->active_local_candidates); -#else - return NULL; -#endif -} - -GList * -purple_media_get_active_remote_candidates(PurpleMedia *media, - const gchar *sess_id, const gchar *participant) -{ -#ifdef USE_VV - PurpleMediaStream *stream; - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - stream = purple_media_get_stream(media, sess_id, participant); - return purple_media_candidate_list_from_fs( - stream->active_remote_candidates); -#else - return NULL; -#endif -} -#endif - -gboolean -purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, - const gchar *participant, GList *codecs) -{ -#ifdef USE_VV - PurpleMediaStream *stream; - FsStream *fsstream; - GList *fscodecs; - GError *err = NULL; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - stream = purple_media_get_stream(media, sess_id, participant); - - if (stream == NULL) - return FALSE; - - fsstream = stream->stream; - fscodecs = purple_media_codec_list_to_fs(codecs); - fs_stream_set_remote_codecs(fsstream, fscodecs, &err); - fs_codec_list_destroy(fscodecs); - - if (err) { - purple_debug_error("media", "Error setting remote codecs: %s\n", - err->message); - g_error_free(err); - return FALSE; - } - return TRUE; -#else - return FALSE; -#endif -} - -gboolean -purple_media_candidates_prepared(PurpleMedia *media, - const gchar *session_id, const gchar *participant) -{ -#ifdef USE_VV - GList *streams; - gboolean prepared = TRUE; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - streams = purple_media_get_streams(media, session_id, participant); - - for (; streams; streams = g_list_delete_link(streams, streams)) { - PurpleMediaStream *stream = streams->data; - if (stream->candidates_prepared == FALSE) { - g_list_free(streams); - prepared = FALSE; - break; - } - } - - return prepared; -#else - return FALSE; -#endif -} - -gboolean -purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec) -{ -#ifdef USE_VV - PurpleMediaSession *session; - FsCodec *fscodec; - GError *err = NULL; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - session = purple_media_get_session(media, sess_id); - - if (session != NULL) - return FALSE; - - fscodec = purple_media_codec_to_fs(codec); - fs_session_set_send_codec(session->session, fscodec, &err); - fs_codec_destroy(fscodec); - - if (err) { - purple_debug_error("media", "Error setting send codec\n"); - g_error_free(err); - return FALSE; - } - return TRUE; -#else - return FALSE; -#endif -} - -gboolean -purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) -{ -#ifdef USE_VV - gboolean ret; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - if (sess_id != NULL) { - PurpleMediaSession *session; - session = purple_media_get_session(media, sess_id); - - if (session == NULL) - return FALSE; - if (session->type & (PURPLE_MEDIA_SEND_AUDIO | - PURPLE_MEDIA_SEND_VIDEO)) - g_object_get(session->session, - "codecs-ready", &ret, NULL); - else - ret = TRUE; - } else { - GList *values = g_hash_table_get_values(media->priv->sessions); - for (; values; values = g_list_delete_link(values, values)) { - PurpleMediaSession *session = values->data; - if (session->type & (PURPLE_MEDIA_SEND_AUDIO | - PURPLE_MEDIA_SEND_VIDEO)) - g_object_get(session->session, - "codecs-ready", &ret, NULL); - else - ret = TRUE; - - if (ret == FALSE) - break; - } - if (values != NULL) - g_list_free(values); - } - return ret; -#else - return FALSE; -#endif -} - -gboolean -purple_media_is_initiator(PurpleMedia *media, - const gchar *sess_id, const gchar *participant) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - if (sess_id == NULL && participant == NULL) - return media->priv->initiator; - else if (sess_id != NULL && participant == NULL) { - PurpleMediaSession *session = - purple_media_get_session(media, sess_id); - return session != NULL ? session->initiator : FALSE; - } else if (sess_id != NULL && participant != NULL) { - PurpleMediaStream *stream = purple_media_get_stream( - media, sess_id, participant); - return stream != NULL ? stream->initiator : FALSE; - } -#endif - return FALSE; -} - -gboolean -purple_media_accepted(PurpleMedia *media, const gchar *sess_id, - const gchar *participant) -{ -#ifdef USE_VV - gboolean accepted = TRUE; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - if (sess_id == NULL && participant == NULL) { - GList *streams = media->priv->streams; - - for (; streams; streams = g_list_next(streams)) { - PurpleMediaStream *stream = streams->data; - if (stream->accepted == FALSE) { - accepted = FALSE; - break; - } - } - } else if (sess_id != NULL && participant == NULL) { - GList *streams = purple_media_get_streams( - media, sess_id, NULL); - for (; streams; streams = - g_list_delete_link(streams, streams)) { - PurpleMediaStream *stream = streams->data; - if (stream->accepted == FALSE) { - g_list_free(streams); - accepted = FALSE; - break; - } - } - } else if (sess_id != NULL && participant != NULL) { - PurpleMediaStream *stream = purple_media_get_stream( - media, sess_id, participant); - if (stream == NULL || stream->accepted == FALSE) - accepted = FALSE; - } - - return accepted; -#else - return FALSE; -#endif -} - -void purple_media_set_input_volume(PurpleMedia *media, - const gchar *session_id, double level) -{ -#ifdef USE_VV - GList *sessions; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - purple_prefs_set_int("/purple/media/audio/volume/input", level); - - if (session_id == NULL) - sessions = g_hash_table_get_values(media->priv->sessions); - else - sessions = g_list_append(NULL, - purple_media_get_session(media, session_id)); - - for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { - PurpleMediaSession *session = sessions->data; - - if (session->type & PURPLE_MEDIA_SEND_AUDIO) { - gchar *name = g_strdup_printf("volume_%s", - session->id); - GstElement *volume = gst_bin_get_by_name( - GST_BIN(session->media->priv->confbin), - name); - g_free(name); - g_object_set(volume, "volume", level/10.0, NULL); - } - } -#endif -} - -void purple_media_set_output_volume(PurpleMedia *media, - const gchar *session_id, const gchar *participant, - double level) -{ -#ifdef USE_VV - GList *streams; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - purple_prefs_set_int("/purple/media/audio/volume/output", level); - - streams = purple_media_get_streams(media, - session_id, participant); - - for (; streams; streams = g_list_delete_link(streams, streams)) { - PurpleMediaStream *stream = streams->data; - - if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO - && GST_IS_ELEMENT(stream->volume)) { - g_object_set(stream->volume, "volume", level/10.0, NULL); - } - } -#endif -} - -gulong -purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, - const gchar *participant, gulong window_id) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - return purple_media_manager_set_output_window(media->priv->manager, - media, session_id, participant, window_id); -#else - return 0; -#endif -} - -void -purple_media_remove_output_windows(PurpleMedia *media) -{ -#ifdef USE_VV - GList *iter = media->priv->streams; - for (; iter; iter = g_list_next(iter)) { - PurpleMediaStream *stream = iter->data; - purple_media_manager_remove_output_windows( - media->priv->manager, media, - stream->session->id, stream->participant); - } - - iter = purple_media_get_session_ids(media); - for (; iter; iter = g_list_delete_link(iter, iter)) { - gchar *session_name = iter->data; - purple_media_manager_remove_output_windows( - media->priv->manager, media, - session_name, NULL); - } -#endif -} - -#ifdef USE_GSTREAMER -GstElement * -purple_media_get_tee(PurpleMedia *media, - const gchar *session_id, const gchar *participant) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); - - if (session_id != NULL && participant == NULL) { - PurpleMediaSession *session = - purple_media_get_session(media, session_id); - return (session != NULL) ? session->tee : NULL; - } else if (session_id != NULL && participant != NULL) { - PurpleMediaStream *stream = - purple_media_get_stream(media, - session_id, participant); - return (stream != NULL) ? stream->tee : NULL; - } - g_return_val_if_reached(NULL); -#else - return NULL; -#endif -} -#endif /* USE_GSTREAMER */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media-gst.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media-gst.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media-gst.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media-gst.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -/** - * @file media-gst.h Media API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_MEDIA_GST_H_ -#define _PURPLE_MEDIA_GST_H_ - -#include "media.h" -#include "mediamanager.h" - -#include - -G_BEGIN_DECLS - -#define PURPLE_TYPE_MEDIA_ELEMENT_TYPE (purple_media_element_type_get_type()) -#define PURPLE_TYPE_MEDIA_ELEMENT_INFO (purple_media_element_info_get_type()) -#define PURPLE_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) -#define PURPLE_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) -#define PURPLE_IS_MEDIA_ELEMENT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO)) -#define PURPLE_IS_MEDIA_ELEMENT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO)) -#define PURPLE_MEDIA_ELEMENT_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo)) - -/** An opaque structure representing an audio/video source/sink. */ -typedef struct _PurpleMediaElementInfo PurpleMediaElementInfo; -typedef struct _PurpleMediaElementInfoClass PurpleMediaElementInfoClass; -typedef GstElement *(*PurpleMediaElementCreateCallback)(PurpleMedia *media, - const gchar *session_id, const gchar *participant); - -typedef enum { - PURPLE_MEDIA_ELEMENT_NONE = 0, /** empty element */ - PURPLE_MEDIA_ELEMENT_AUDIO = 1, /** supports audio */ - PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1, /** supports video */ - PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO - | PURPLE_MEDIA_ELEMENT_VIDEO, /** supports audio and video */ - - PURPLE_MEDIA_ELEMENT_NO_SRCS = 0, /** has no src pads */ - PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2, /** has one src pad */ - PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, /** has multiple src pads */ - PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, /** src pads must be requested */ - - PURPLE_MEDIA_ELEMENT_NO_SINKS = 0, /** has no sink pads */ - PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, /** has one sink pad */ - PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, /** has multiple sink pads */ - PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, /** sink pads must be requested */ - - PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8, /** This element is unique and - only one instance of it should - be created at a time */ - - PURPLE_MEDIA_ELEMENT_SRC = 1 << 9, /** can be set as an active src */ - PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /** can be set as an active sink */ -} PurpleMediaElementType; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the element type's GType. - * - * @return The element type's GType. - * - * @since 2.6.0 - */ -GType purple_media_element_type_get_type(void); - -/** - * Gets the element info's GType. - * - * @return The element info's GType. - * - * @since 2.6.0 - */ -GType purple_media_element_info_get_type(void); - -/** - * Gets the source from a session - * - * @param media The media object the session is in. - * @param sess_id The session id of the session to get the source from. - * - * @return The source retrieved. - * - * @since 2.6.0 - */ -GstElement *purple_media_get_src(PurpleMedia *media, const gchar *sess_id); - -/** - * Gets the tee from a given session/stream. - * - * @param media The instance to get the tee from. - * @param session_id The id of the session to get the tee from. - * @param participant Optionally, the participant of the stream to get the tee from. - * - * @return The GstTee element from the chosen session/stream. - * - * @since 2.6.0 - */ -GstElement *purple_media_get_tee(PurpleMedia *media, - const gchar *session_id, const gchar *participant); - - -/** - * Gets the pipeline from the media manager. - * - * @param manager The media manager to get the pipeline from. - * - * @return The pipeline. - * - * @since 2.6.0 - */ -GstElement *purple_media_manager_get_pipeline(PurpleMediaManager *manager); - -/** - * Returns a GStreamer source or sink for audio or video. - * - * @param manager The media manager to use to obtain the source/sink. - * @param type The type of source/sink to get. - * @param media The media call this element is requested for. - * @param session_id The id of the session this element is requested for or NULL. - * @param participant The remote user this element is requested for or NULL. - * - * @since 2.6.0 - */ -GstElement *purple_media_manager_get_element(PurpleMediaManager *manager, - PurpleMediaSessionType type, PurpleMedia *media, - const gchar *session_id, const gchar *participant); - -PurpleMediaElementInfo *purple_media_manager_get_element_info( - PurpleMediaManager *manager, const gchar *name); -gboolean purple_media_manager_register_element(PurpleMediaManager *manager, - PurpleMediaElementInfo *info); -gboolean purple_media_manager_unregister_element(PurpleMediaManager *manager, - const gchar *name); -gboolean purple_media_manager_set_active_element(PurpleMediaManager *manager, - PurpleMediaElementInfo *info); -PurpleMediaElementInfo *purple_media_manager_get_active_element( - PurpleMediaManager *manager, PurpleMediaElementType type); - -gchar *purple_media_element_info_get_id(PurpleMediaElementInfo *info); -gchar *purple_media_element_info_get_name(PurpleMediaElementInfo *info); -PurpleMediaElementType purple_media_element_info_get_element_type( - PurpleMediaElementInfo *info); -GstElement *purple_media_element_info_call_create( - PurpleMediaElementInfo *info, PurpleMedia *media, - const gchar *session_id, const gchar *participant); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* _PURPLE_MEDIA_GST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/media.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,693 +0,0 @@ -/** - * @file media.h Media API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_MEDIA_H_ -#define _PURPLE_MEDIA_H_ - -#include -#include - -G_BEGIN_DECLS - -#define PURPLE_TYPE_MEDIA_CANDIDATE (purple_media_candidate_get_type()) -#define PURPLE_MEDIA_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate)) -#define PURPLE_MEDIA_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate)) -#define PURPLE_IS_MEDIA_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_CANDIDATE)) -#define PURPLE_IS_MEDIA_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_CANDIDATE)) -#define PURPLE_MEDIA_CANDIDATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate)) - -#define PURPLE_TYPE_MEDIA_CODEC (purple_media_codec_get_type()) -#define PURPLE_MEDIA_CODEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) -#define PURPLE_MEDIA_CODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) -#define PURPLE_IS_MEDIA_CODEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_CODEC)) -#define PURPLE_IS_MEDIA_CODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_CODEC)) -#define PURPLE_MEDIA_CODEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodec)) - -#define PURPLE_TYPE_MEDIA_SESSION_TYPE (purple_media_session_type_get_type()) -#define PURPLE_TYPE_MEDIA (purple_media_get_type()) -#define PURPLE_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA, PurpleMedia)) -#define PURPLE_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA, PurpleMediaClass)) -#define PURPLE_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA)) -#define PURPLE_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA)) -#define PURPLE_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA, PurpleMediaClass)) - -#define PURPLE_TYPE_MEDIA_CANDIDATE_TYPE (purple_media_candidate_type_get_type()) -#define PURPLE_TYPE_MEDIA_NETWORK_PROTOCOL (purple_media_network_protocol_get_type()) -#define PURPLE_MEDIA_TYPE_STATE (purple_media_state_changed_get_type()) -#define PURPLE_MEDIA_TYPE_INFO_TYPE (purple_media_info_type_get_type()) - -/** An opaque structure representing a media call. */ -typedef struct _PurpleMedia PurpleMedia; -/** An opaque structure representing a network candidate (IP Address and port pair). */ -typedef struct _PurpleMediaCandidate PurpleMediaCandidate; -/** An opaque structure representing an audio or video codec. */ -typedef struct _PurpleMediaCodec PurpleMediaCodec; - -/** Media caps */ -typedef enum { - PURPLE_MEDIA_CAPS_NONE = 0, - PURPLE_MEDIA_CAPS_AUDIO = 1, - PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION = 1 << 1, - PURPLE_MEDIA_CAPS_VIDEO = 1 << 2, - PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION = 1 << 3, - PURPLE_MEDIA_CAPS_AUDIO_VIDEO = 1 << 4, - PURPLE_MEDIA_CAPS_MODIFY_SESSION = 1 << 5, - PURPLE_MEDIA_CAPS_CHANGE_DIRECTION = 1 << 6, -} PurpleMediaCaps; - -/** Media session types */ -typedef enum { - PURPLE_MEDIA_NONE = 0, - PURPLE_MEDIA_RECV_AUDIO = 1 << 0, - PURPLE_MEDIA_SEND_AUDIO = 1 << 1, - PURPLE_MEDIA_RECV_VIDEO = 1 << 2, - PURPLE_MEDIA_SEND_VIDEO = 1 << 3, - PURPLE_MEDIA_AUDIO = PURPLE_MEDIA_RECV_AUDIO | PURPLE_MEDIA_SEND_AUDIO, - PURPLE_MEDIA_VIDEO = PURPLE_MEDIA_RECV_VIDEO | PURPLE_MEDIA_SEND_VIDEO -} PurpleMediaSessionType; - -/** Media state-changed types */ -typedef enum { - PURPLE_MEDIA_STATE_NEW = 0, - PURPLE_MEDIA_STATE_CONNECTED, - PURPLE_MEDIA_STATE_END, -} PurpleMediaState; - -/** Media info types */ -typedef enum { - PURPLE_MEDIA_INFO_HANGUP = 0, - PURPLE_MEDIA_INFO_ACCEPT, - PURPLE_MEDIA_INFO_REJECT, - PURPLE_MEDIA_INFO_MUTE, - PURPLE_MEDIA_INFO_UNMUTE, - PURPLE_MEDIA_INFO_PAUSE, - PURPLE_MEDIA_INFO_UNPAUSE, - PURPLE_MEDIA_INFO_HOLD, - PURPLE_MEDIA_INFO_UNHOLD, -} PurpleMediaInfoType; - -typedef enum { - PURPLE_MEDIA_CANDIDATE_TYPE_HOST, - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, - PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX, - PURPLE_MEDIA_CANDIDATE_TYPE_RELAY, - PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST, -} PurpleMediaCandidateType; - -typedef enum { - PURPLE_MEDIA_COMPONENT_NONE = 0, - PURPLE_MEDIA_COMPONENT_RTP = 1, - PURPLE_MEDIA_COMPONENT_RTCP = 2, -} PurpleMediaComponentType; - -typedef enum { - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, -} PurpleMediaNetworkProtocol; - -#include "signals.h" -#include "util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the media session type's GType - * - * @return The media session type's GType. - * - * @since 2.6.0 - */ -GType purple_media_session_type_get_type(void); - -/** - * Gets the media candidate type's GType - * - * @return The media candidate type's GType. - * - * @since 2.6.0 - */ -GType purple_media_candidate_type_get_type(void); - -/** - * Gets the media network protocol's GType - * - * @return The media network protocol's GType. - * - * @since 2.6.0 - */ -GType purple_media_network_protocol_get_type(void); - -/** - * Gets the media class's GType - * - * @return The media class's GType. - * - * @since 2.6.0 - */ -GType purple_media_get_type(void); - -/** - * Gets the type of the state-changed enum - * - * @return The state-changed enum's GType - * - * @since 2.6.0 - */ -GType purple_media_state_changed_get_type(void); - -/** - * Gets the type of the info type enum - * - * @return The info type enum's GType - * - * @since 2.6.0 - */ -GType purple_media_info_type_get_type(void); - -/** - * Gets the type of the media candidate structure. - * - * @return The media canditate's GType - * - * @since 2.6.0 - */ -GType purple_media_candidate_get_type(void); - -/** - * Creates a PurpleMediaCandidate instance. - * - * @param foundation The foundation of the candidate. - * @param component_id The component this candidate is for. - * @param type The type of candidate. - * @param proto The protocol this component is for. - * @param ip The IP address of this component. - * @param port The network port. - * - * @return The newly created PurpleMediaCandidate instance. - * - * @since 2.6.0 - */ -PurpleMediaCandidate *purple_media_candidate_new( - const gchar *foundation, guint component_id, - PurpleMediaCandidateType type, - PurpleMediaNetworkProtocol proto, - const gchar *ip, guint port); - -/** - * Copies a GList of PurpleMediaCandidate and its contents. - * - * @param candidates The list of candidates to be copied. - * - * @return The copy of the GList. - * - * @since 2.6.0 - */ -GList *purple_media_candidate_list_copy(GList *candidates); - -/** - * Frees a GList of PurpleMediaCandidate and its contents. - * - * @param candidates The list of candidates to be freed. - * - * @since 2.6.0 - */ -void purple_media_candidate_list_free(GList *candidates); - -gchar *purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate); -guint purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate); -gchar *purple_media_candidate_get_ip(PurpleMediaCandidate *candidate); -guint16 purple_media_candidate_get_port(PurpleMediaCandidate *candidate); -gchar *purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate); -guint16 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate); -PurpleMediaNetworkProtocol purple_media_candidate_get_protocol( - PurpleMediaCandidate *candidate); -guint32 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate); -PurpleMediaCandidateType purple_media_candidate_get_candidate_type( - PurpleMediaCandidate *candidate); -gchar *purple_media_candidate_get_username(PurpleMediaCandidate *candidate); -gchar *purple_media_candidate_get_password(PurpleMediaCandidate *candidate); -guint purple_media_candidate_get_ttl(PurpleMediaCandidate *candidate); - -/** - * Gets the type of the media codec structure. - * - * @return The media codec's GType - * - * @since 2.6.0 - */ -GType purple_media_codec_get_type(void); - -/** - * Creates a new PurpleMediaCodec instance. - * - * @param id Codec identifier. - * @param encoding_name Name of the media type this encodes. - * @param media_type PurpleMediaSessionType of this codec. - * @param clock_rate The clock rate this codec encodes at, if applicable. - * - * @return The newly created PurpleMediaCodec. - * - * @since 2.6.0 - */ -PurpleMediaCodec *purple_media_codec_new(int id, const char *encoding_name, - PurpleMediaSessionType media_type, guint clock_rate); - -guint purple_media_codec_get_id(PurpleMediaCodec *codec); -gchar *purple_media_codec_get_encoding_name(PurpleMediaCodec *codec); -guint purple_media_codec_get_clock_rate(PurpleMediaCodec *codec); -guint purple_media_codec_get_channels(PurpleMediaCodec *codec); -GList *purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec); - -/** - * Creates a string representation of the codec. - * - * @param codec The codec to create the string of. - * - * @return The new string representation. - * - * @since 2.6.0 - */ -gchar *purple_media_codec_to_string(const PurpleMediaCodec *codec); - -/** - * Adds an optional parameter to the codec. - * - * @param codec The codec to add the parameter to. - * @param name The name of the parameter to add. - * @param value The value of the parameter to add. - * - * @since 2.6.0 - */ -void purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, - const gchar *name, const gchar *value); - -/** - * Removes an optional parameter from the codec. - * - * @param codec The codec to remove the parameter from. - * @param param A pointer to the parameter to remove. - * - * @since 2.6.0 - */ -void purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec, - PurpleKeyValuePair *param); - -/** - * Gets an optional parameter based on the values given. - * - * @param codec The codec to find the parameter in. - * @param name The name of the parameter to search for. - * @param value The value to search for or NULL. - * - * @return The value found or NULL. - * - * @since 2.6.0 - */ -PurpleKeyValuePair *purple_media_codec_get_optional_parameter( - PurpleMediaCodec *codec, const gchar *name, - const gchar *value); - -/** - * Copies a GList of PurpleMediaCodec and its contents. - * - * @param codecs The list of codecs to be copied. - * - * @return The copy of the GList. - * - * @since 2.6.0 - */ -GList *purple_media_codec_list_copy(GList *codecs); - -/** - * Frees a GList of PurpleMediaCodec and its contents. - * - * @param codecs The list of codecs to be freed. - * - * @since 2.6.0 - */ -void purple_media_codec_list_free(GList *codecs); - -/** - * Gets a list of session IDs. - * - * @param media The media session from which to retrieve session IDs. - * - * @return GList of session IDs. The caller must free the list. - * - * @since 2.6.0 - */ -GList *purple_media_get_session_ids(PurpleMedia *media); - -/** - * Gets the PurpleAccount this media session is on. - * - * @param media The media session to retrieve the account from. - * - * @return The account retrieved. - * - * @since 2.6.0 - */ -PurpleAccount *purple_media_get_account(PurpleMedia *media); - -/** - * Gets the prpl data from the media session. - * - * @param media The media session to retrieve the prpl data from. - * - * @return The prpl data retrieved. - * - * @since 2.6.0 - */ -gpointer purple_media_get_prpl_data(PurpleMedia *media); - -/** - * Sets the prpl data on the media session. - * - * @param media The media session to set the prpl data on. - * @param prpl_data The data to set on the media session. - * - * @since 2.6.0 - */ -void purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data); - -/** - * Signals an error in the media session. - * - * @param media The media object to set the state on. - * @param error The format of the error message to send in the signal. - * @param ... The arguments to plug into the format. - * - * @since 2.6.0 - */ -void purple_media_error(PurpleMedia *media, const gchar *error, ...); - -/** - * Ends all streams that match the given parameters - * - * @param media The media object with which to end streams. - * @param session_id The session to end streams on. - * @param participant The participant to end streams with. - * - * @since 2.6.0 - */ -void purple_media_end(PurpleMedia *media, const gchar *session_id, - const gchar *participant); - -/** - * Signals different information about the given stream. - * - * @param media The media instance to containing the stream to signal. - * @param type The type of info being signaled. - * @param session_id The id of the session of the stream being signaled. - * @param participant The participant of the stream being signaled. - * @param local TRUE if the info originated locally, FALSE if on the remote end. - * - * @since 2.6.0 - */ -void purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, - const gchar *session_id, const gchar *participant, - gboolean local); - -/** - * Adds a stream to a session. - * - * It only adds a stream to one audio session or video session as - * the @c sess_id must be unique between sessions. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to add the stream to. - * @param who The name of the remote user to add the stream for. - * @param type The type of stream to create. - * @param initiator Whether or not the local user initiated the stream. - * @param transmitter The transmitter to use for the stream. - * @param num_params The number of parameters to pass to Farsight. - * @param params The parameters to pass to Farsight. - * - * @return @c TRUE The stream was added successfully, @c FALSE otherwise. - * - * @since 2.6.0 - */ -gboolean purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, - const gchar *who, PurpleMediaSessionType type, - gboolean initiator, const gchar *transmitter, - guint num_params, GParameter *params); - -/** - * Gets the session type from a session - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to get the type from. - * - * @return The retreived session type. - * - * @since 2.6.0 - */ -PurpleMediaSessionType purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id); - -/** - * Gets the PurpleMediaManager this media session is a part of. - * - * @param media The media object to get the manager instance from. - * - * @return The PurpleMediaManager instance retrieved. - * - * @since 2.6.0 - */ -struct _PurpleMediaManager *purple_media_get_manager(PurpleMedia *media); - -/** - * Gets the codecs from a session. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to get the codecs from. - * - * @return The retreieved codecs. - * - * @since 2.6.0 - */ -GList *purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id); - -/** - * Adds remote candidates to the stream. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session find the stream in. - * @param participant The name of the remote user to add the candidates for. - * @param remote_candidates The remote candidates to add. - * - * @since 2.6.0 - */ -void purple_media_add_remote_candidates(PurpleMedia *media, - const gchar *sess_id, - const gchar *participant, - GList *remote_candidates); - -/** - * Gets the local candidates from a stream. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to find the stream in. - * @param participant The name of the remote user to get the candidates from. - * - * @since 2.6.0 - */ -GList *purple_media_get_local_candidates(PurpleMedia *media, - const gchar *sess_id, - const gchar *participant); - -#if 0 -/* - * These two functions aren't being used and I'd rather not lock in the API - * until they are needed. If they ever are. - */ - -/** - * Gets the active local candidates for the stream. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to find the stream in. - * @param participant The name of the remote user to get the active candidate - * from. - * - * @return The active candidates retrieved. - */ -GList *purple_media_get_active_local_candidates(PurpleMedia *media, - const gchar *sess_id, const gchar *participant); - -/** - * Gets the active remote candidates for the stream. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to find the stream in. - * @param participant The name of the remote user to get the remote candidate - * from. - * - * @return The remote candidates retrieved. - */ -GList *purple_media_get_active_remote_candidates(PurpleMedia *media, - const gchar *sess_id, const gchar *participant); -#endif - -/** - * Sets remote candidates from the stream. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session find the stream in. - * @param participant The name of the remote user to set the candidates from. - * @param codecs The list of remote codecs to set. - * - * @return @c TRUE The codecs were set successfully, or @c FALSE otherwise. - * - * @since 2.6.0 - */ -gboolean purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, - const gchar *participant, GList *codecs); - -/** - * Returns whether or not the candidates for set of streams are prepared - * - * @param media The media object to find the remote user in. - * @param session_id The session id of the session to check. - * @param participant The remote user to check for. - * - * @return @c TRUE All streams for the given session_id/participant combination have candidates prepared, @c FALSE otherwise. - * - * @since 2.6.0 - */ -gboolean purple_media_candidates_prepared(PurpleMedia *media, - const gchar *session_id, const gchar *participant); - -/** - * Sets the send codec for the a session. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to set the codec for. - * @param codec The codec to set the session to stream. - * - * @return @c TRUE The codec was successfully changed, or @c FALSE otherwise. - * - * @since 2.6.0 - */ -gboolean purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec); - -/** - * Gets whether a session's codecs are ready to be used. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to check. - * - * @return @c TRUE The codecs are ready, or @c FALSE otherwise. - * - * @since 2.6.0 - */ -gboolean purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id); - -/** - * Gets whether the local user is the conference/session/stream's initiator. - * - * @param media The media instance to find the session in. - * @param sess_id The session id of the session to check. - * @param participant The participant of the stream to check. - * - * @return TRUE if the local user is the stream's initator, else FALSE. - * - * @since 2.6.0 - */ -gboolean purple_media_is_initiator(PurpleMedia *media, - const gchar *sess_id, const gchar *participant); - -/** - * Gets whether a streams selected have been accepted. - * - * @param media The media object to find the session in. - * @param sess_id The session id of the session to check. - * @param participant The participant to check. - * - * @return @c TRUE The selected streams have been accepted, or @c FALSE otherwise. - * - * @since 2.6.0 - */ -gboolean purple_media_accepted(PurpleMedia *media, const gchar *sess_id, - const gchar *participant); - -/** - * Sets the input volume of all the selected sessions. - * - * @param media The media object the sessions are in. - * @param session_id The session to select (if any). - * @param level The level to set the volume to. - * - * @since 2.6.0 - */ -void purple_media_set_input_volume(PurpleMedia *media, const gchar *session_id, double level); - -/** - * Sets the output volume of all the selected streams. - * - * @param media The media object the streams are in. - * @param session_id The session to limit the streams to (if any). - * @param participant The participant to limit the streams to (if any). - * @param level The level to set the volume to. - * - * @since 2.6.0 - */ -void purple_media_set_output_volume(PurpleMedia *media, const gchar *session_id, - const gchar *participant, double level); - -/** - * Sets a video output window for the given session/stream. - * - * @param media The media instance to set the output window on. - * @param session_id The session to set the output window on. - * @param participant Optionally, the participant to set the output window on. - * @param window_id The window id use for embedding the video in. - * - * @return An id to reference the output window. - * - * @since 2.6.0 - */ -gulong purple_media_set_output_window(PurpleMedia *media, - const gchar *session_id, const gchar *participant, - gulong window_id); - -/** - * Removes all output windows from a given media session. - * - * @param media The instance to remove all output windows from. - * - * @since 2.6.0 - */ -void purple_media_remove_output_windows(PurpleMedia *media); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* _PURPLE_MEDIA_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1187 +0,0 @@ -/** - * @file mediamanager.c Media Manager API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "account.h" -#include "debug.h" -#include "media.h" -#include "mediamanager.h" - -#ifdef USE_GSTREAMER -#include "marshallers.h" -#include "media-gst.h" -#endif - -#ifdef USE_VV - -#include -#include -#include - -/** @copydoc _PurpleMediaManagerPrivate */ -typedef struct _PurpleMediaManagerPrivate PurpleMediaManagerPrivate; -/** @copydoc _PurpleMediaOutputWindow */ -typedef struct _PurpleMediaOutputWindow PurpleMediaOutputWindow; -/** @copydoc _PurpleMediaManagerPrivate */ -typedef struct _PurpleMediaElementInfoPrivate PurpleMediaElementInfoPrivate; - -/** The media manager class. */ -struct _PurpleMediaManagerClass -{ - GObjectClass parent_class; /**< The parent class. */ -}; - -/** The media manager's data. */ -struct _PurpleMediaManager -{ - GObject parent; /**< The parent of this manager. */ - PurpleMediaManagerPrivate *priv; /**< Private data for the manager. */ -}; - -struct _PurpleMediaOutputWindow -{ - gulong id; - PurpleMedia *media; - gchar *session_id; - gchar *participant; - gulong window_id; - GstElement *sink; -}; - -struct _PurpleMediaManagerPrivate -{ - GstElement *pipeline; - PurpleMediaCaps ui_caps; - GList *medias; - GList *elements; - GList *output_windows; - gulong next_output_window_id; - - PurpleMediaElementInfo *video_src; - PurpleMediaElementInfo *video_sink; - PurpleMediaElementInfo *audio_src; - PurpleMediaElementInfo *audio_sink; -}; - -#define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate)) -#define PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfoPrivate)) - -static void purple_media_manager_class_init (PurpleMediaManagerClass *klass); -static void purple_media_manager_init (PurpleMediaManager *media); -static void purple_media_manager_finalize (GObject *object); - -static GObjectClass *parent_class = NULL; - - - -enum { - INIT_MEDIA, - LAST_SIGNAL -}; -static guint purple_media_manager_signals[LAST_SIGNAL] = {0}; -#endif - -GType -purple_media_manager_get_type() -{ -#ifdef USE_VV - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleMediaManagerClass), - NULL, - NULL, - (GClassInitFunc) purple_media_manager_class_init, - NULL, - NULL, - sizeof(PurpleMediaManager), - 0, - (GInstanceInitFunc) purple_media_manager_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0); - } - return type; -#else - return G_TYPE_NONE; -#endif -} - -#ifdef USE_VV -static void -purple_media_manager_class_init (PurpleMediaManagerClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = purple_media_manager_finalize; - - purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING, - G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA, - G_TYPE_POINTER, G_TYPE_STRING); - g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate)); -} - -static void -purple_media_manager_init (PurpleMediaManager *media) -{ - media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); - media->priv->medias = NULL; - media->priv->next_output_window_id = 1; - - purple_prefs_add_none("/purple/media"); - purple_prefs_add_none("/purple/media/audio"); - purple_prefs_add_none("/purple/media/audio/volume"); - purple_prefs_add_int("/purple/media/audio/volume/input", 10); - purple_prefs_add_int("/purple/media/audio/volume/output", 10); -} - -static void -purple_media_manager_finalize (GObject *media) -{ - PurpleMediaManagerPrivate *priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); - for (; priv->medias; priv->medias = - g_list_delete_link(priv->medias, priv->medias)) { - g_object_unref(priv->medias->data); - } - for (; priv->elements; priv->elements = - g_list_delete_link(priv->elements, priv->elements)) { - g_object_unref(priv->elements->data); - } - parent_class->finalize(media); -} -#endif - -PurpleMediaManager * -purple_media_manager_get() -{ -#ifdef USE_VV - static PurpleMediaManager *manager = NULL; - - if (manager == NULL) - manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); - return manager; -#else - return NULL; -#endif -} - -#ifdef USE_VV -static gboolean -pipeline_bus_call(GstBus *bus, GstMessage *msg, PurpleMediaManager *manager) -{ - switch(GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_EOS: - purple_debug_info("mediamanager", "End of Stream\n"); - break; - case GST_MESSAGE_ERROR: { - gchar *debug = NULL; - GError *err = NULL; - - gst_message_parse_error(msg, &err, &debug); - - purple_debug_error("mediamanager", - "gst pipeline error: %s\n", - err->message); - g_error_free(err); - - if (debug) { - purple_debug_error("mediamanager", - "Debug details: %s\n", debug); - g_free (debug); - } - break; - } - default: - break; - } - return TRUE; -} -#endif - -#ifdef USE_GSTREAMER -GstElement * -purple_media_manager_get_pipeline(PurpleMediaManager *manager) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); - - if (manager->priv->pipeline == NULL) { - FsElementAddedNotifier *notifier; - gchar *filename; - GError *err = NULL; - GKeyFile *keyfile; - GstBus *bus; - manager->priv->pipeline = gst_pipeline_new(NULL); - - bus = gst_pipeline_get_bus( - GST_PIPELINE(manager->priv->pipeline)); - gst_bus_add_signal_watch(GST_BUS(bus)); - g_signal_connect(G_OBJECT(bus), "message", - G_CALLBACK(pipeline_bus_call), manager); - gst_bus_set_sync_handler(bus, - gst_bus_sync_signal_handler, NULL); - gst_object_unref(bus); - - filename = g_build_filename(purple_user_dir(), - "fs-element.conf", NULL); - keyfile = g_key_file_new(); - if (!g_key_file_load_from_file(keyfile, filename, - G_KEY_FILE_NONE, &err)) { - if (err->code == 4) - purple_debug_info("mediamanager", - "Couldn't read " - "fs-element.conf: %s\n", - err->message); - else - purple_debug_error("mediamanager", - "Error reading " - "fs-element.conf: %s\n", - err->message); - g_error_free(err); - } - g_free(filename); - - /* Hack to make alsasrc stop messing up audio timestamps */ - if (!g_key_file_has_key(keyfile, - "alsasrc", "slave-method", NULL)) { - g_key_file_set_integer(keyfile, - "alsasrc", "slave-method", 2); - } - - notifier = fs_element_added_notifier_new(); - fs_element_added_notifier_add(notifier, - GST_BIN(manager->priv->pipeline)); - fs_element_added_notifier_set_properties_from_keyfile( - notifier, keyfile); - - gst_element_set_state(manager->priv->pipeline, - GST_STATE_PLAYING); - } - - return manager->priv->pipeline; -#else - return NULL; -#endif -} -#endif /* USE_GSTREAMER */ - -PurpleMedia * -purple_media_manager_create_media(PurpleMediaManager *manager, - PurpleAccount *account, - const char *conference_type, - const char *remote_user, - gboolean initiator) -{ -#ifdef USE_VV - PurpleMedia *media; - FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL)); - GstStateChangeReturn ret; - gboolean signal_ret; - - if (conference == NULL) { - purple_conv_present_error(remote_user, account, - _("Error creating conference.")); - purple_debug_error("media", "Conference == NULL\n"); - return NULL; - } - - media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), - "manager", manager, - "account", account, - "conference", conference, - "initiator", initiator, - NULL)); - - ret = gst_element_set_state(GST_ELEMENT(conference), GST_STATE_PLAYING); - - if (ret == GST_STATE_CHANGE_FAILURE) { - purple_conv_present_error(remote_user, account, - _("Error creating conference.")); - purple_debug_error("media", "Failed to start conference.\n"); - g_object_unref(media); - return NULL; - } - - g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, - media, account, remote_user, &signal_ret); - - if (signal_ret == FALSE) { - g_object_unref(media); - return NULL; - } - - manager->priv->medias = g_list_append(manager->priv->medias, media); - return media; -#else - return NULL; -#endif -} - -GList * -purple_media_manager_get_media(PurpleMediaManager *manager) -{ -#ifdef USE_VV - return manager->priv->medias; -#else - return NULL; -#endif -} - -GList * -purple_media_manager_get_media_by_account(PurpleMediaManager *manager, - PurpleAccount *account) -{ -#ifdef USE_VV - GList *media = NULL; - GList *iter; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); - - iter = manager->priv->medias; - for (; iter; iter = g_list_next(iter)) { - if (purple_media_get_account(iter->data) == account) { - media = g_list_prepend(media, iter->data); - } - } - - return media; -#else - return NULL; -#endif -} - -void -purple_media_manager_remove_media(PurpleMediaManager *manager, - PurpleMedia *media) -{ -#ifdef USE_VV - GList *list = g_list_find(manager->priv->medias, media); - if (list) - manager->priv->medias = - g_list_delete_link(manager->priv->medias, list); -#endif -} - -#ifdef USE_VV -static void -request_pad_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data) -{ - GstElement *parent = GST_ELEMENT_PARENT(pad); - GstIterator *iter; - GstPad *remaining_pad; - GstIteratorResult result; - - gst_element_release_request_pad(GST_ELEMENT_PARENT(pad), pad); - iter = gst_element_iterate_src_pads(parent); - - result = gst_iterator_next(iter, (gpointer)&remaining_pad); - - if (result == GST_ITERATOR_DONE) { - gst_element_set_locked_state(parent, TRUE); - gst_element_set_state(parent, GST_STATE_NULL); - gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent); - } else if (result == GST_ITERATOR_OK) { - gst_object_unref(remaining_pad); - } - - gst_iterator_free(iter); -} -#endif - -#ifdef USE_GSTREAMER -GstElement * -purple_media_manager_get_element(PurpleMediaManager *manager, - PurpleMediaSessionType type, PurpleMedia *media, - const gchar *session_id, const gchar *participant) -{ -#ifdef USE_VV - GstElement *ret = NULL; - PurpleMediaElementInfo *info = NULL; - PurpleMediaElementType element_type; - - if (type & PURPLE_MEDIA_SEND_AUDIO) - info = manager->priv->audio_src; - else if (type & PURPLE_MEDIA_RECV_AUDIO) - info = manager->priv->audio_sink; - else if (type & PURPLE_MEDIA_SEND_VIDEO) - info = manager->priv->video_src; - else if (type & PURPLE_MEDIA_RECV_VIDEO) - info = manager->priv->video_sink; - - if (info == NULL) - return NULL; - - element_type = purple_media_element_info_get_element_type(info); - - if (element_type & PURPLE_MEDIA_ELEMENT_UNIQUE && - element_type & PURPLE_MEDIA_ELEMENT_SRC) { - GstElement *tee; - GstPad *pad; - GstPad *ghost; - gchar *id = purple_media_element_info_get_id(info); - - ret = gst_bin_get_by_name(GST_BIN( - purple_media_manager_get_pipeline( - manager)), id); - - if (ret == NULL) { - GstElement *bin, *fakesink; - ret = purple_media_element_info_call_create(info, - media, session_id, participant); - bin = gst_bin_new(id); - tee = gst_element_factory_make("tee", "tee"); - gst_bin_add_many(GST_BIN(bin), ret, tee, NULL); - gst_element_link(ret, tee); - - /* - * This shouldn't be necessary, but it stops it from - * giving a not-linked error upon destruction - */ - fakesink = gst_element_factory_make("fakesink", NULL); - g_object_set(fakesink, "sync", FALSE, NULL); - gst_bin_add(GST_BIN(bin), fakesink); - gst_element_link(tee, fakesink); - - ret = bin; - gst_object_ref(ret); - gst_bin_add(GST_BIN(purple_media_manager_get_pipeline( - manager)), ret); - } - g_free(id); - - tee = gst_bin_get_by_name(GST_BIN(ret), "tee"); - pad = gst_element_get_request_pad(tee, "src%d"); - gst_object_unref(tee); - ghost = gst_ghost_pad_new(NULL, pad); - gst_object_unref(pad); - g_signal_connect(GST_PAD(ghost), "unlinked", - G_CALLBACK(request_pad_unlinked_cb), NULL); - gst_pad_set_active(ghost, TRUE); - gst_element_add_pad(ret, ghost); - } else { - ret = purple_media_element_info_call_create(info, - media, session_id, participant); - } - - if (ret == NULL) - purple_debug_error("media", "Error creating source or sink\n"); - - return ret; -#else - return NULL; -#endif -} - -PurpleMediaElementInfo * -purple_media_manager_get_element_info(PurpleMediaManager *manager, - const gchar *id) -{ -#ifdef USE_VV - GList *iter; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); - - iter = manager->priv->elements; - - for (; iter; iter = g_list_next(iter)) { - gchar *element_id = - purple_media_element_info_get_id(iter->data); - if (!strcmp(element_id, id)) { - g_free(element_id); - g_object_ref(iter->data); - return iter->data; - } - g_free(element_id); - } -#endif - - return NULL; -} - -gboolean -purple_media_manager_register_element(PurpleMediaManager *manager, - PurpleMediaElementInfo *info) -{ -#ifdef USE_VV - PurpleMediaElementInfo *info2; - gchar *id; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); - g_return_val_if_fail(info != NULL, FALSE); - - id = purple_media_element_info_get_id(info); - info2 = purple_media_manager_get_element_info(manager, id); - g_free(id); - - if (info2 != NULL) { - g_object_unref(info2); - return FALSE; - } - - manager->priv->elements = - g_list_prepend(manager->priv->elements, info); - return TRUE; -#else - return FALSE; -#endif -} - -gboolean -purple_media_manager_unregister_element(PurpleMediaManager *manager, - const gchar *id) -{ -#ifdef USE_VV - PurpleMediaElementInfo *info; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); - - info = purple_media_manager_get_element_info(manager, id); - - if (info == NULL) { - g_object_unref(info); - return FALSE; - } - - if (manager->priv->audio_src == info) - manager->priv->audio_src = NULL; - if (manager->priv->audio_sink == info) - manager->priv->audio_sink = NULL; - if (manager->priv->video_src == info) - manager->priv->video_src = NULL; - if (manager->priv->video_sink == info) - manager->priv->video_sink = NULL; - - manager->priv->elements = g_list_remove( - manager->priv->elements, info); - g_object_unref(info); - return TRUE; -#else - return FALSE; -#endif -} - -gboolean -purple_media_manager_set_active_element(PurpleMediaManager *manager, - PurpleMediaElementInfo *info) -{ -#ifdef USE_VV - PurpleMediaElementInfo *info2; - PurpleMediaElementType type; - gboolean ret = FALSE; - gchar *id; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); - g_return_val_if_fail(info != NULL, FALSE); - - id = purple_media_element_info_get_id(info); - info2 = purple_media_manager_get_element_info(manager, id); - g_free(id); - - if (info2 == NULL) - purple_media_manager_register_element(manager, info); - else - g_object_unref(info2); - - type = purple_media_element_info_get_element_type(info); - - if (type & PURPLE_MEDIA_ELEMENT_SRC) { - if (type & PURPLE_MEDIA_ELEMENT_AUDIO) { - manager->priv->audio_src = info; - ret = TRUE; - } - if (type & PURPLE_MEDIA_ELEMENT_VIDEO) { - manager->priv->video_src = info; - ret = TRUE; - } - } - if (type & PURPLE_MEDIA_ELEMENT_SINK) { - if (type & PURPLE_MEDIA_ELEMENT_AUDIO) { - manager->priv->audio_sink = info; - ret = TRUE; - } - if (type & PURPLE_MEDIA_ELEMENT_VIDEO) { - manager->priv->video_sink = info; - ret = TRUE; - } - } - - return ret; -#else - return FALSE; -#endif -} - -PurpleMediaElementInfo * -purple_media_manager_get_active_element(PurpleMediaManager *manager, - PurpleMediaElementType type) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); - - if (type & PURPLE_MEDIA_ELEMENT_SRC) { - if (type & PURPLE_MEDIA_ELEMENT_AUDIO) - return manager->priv->audio_src; - else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) - return manager->priv->video_src; - } else if (type & PURPLE_MEDIA_ELEMENT_SINK) { - if (type & PURPLE_MEDIA_ELEMENT_AUDIO) - return manager->priv->audio_sink; - else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) - return manager->priv->video_sink; - } -#endif - - return NULL; -} -#endif /* USE_GSTREAMER */ - -#ifdef USE_VV -static void -window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) -{ - GstElement *sink; - - if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT || - !gst_structure_has_name(msg->structure, - "prepare-xwindow-id")) - return; - - sink = GST_ELEMENT(GST_MESSAGE_SRC(msg)); - while (sink != ow->sink) { - if (sink == NULL) - return; - sink = GST_ELEMENT_PARENT(sink); - } - - g_signal_handlers_disconnect_matched(bus, G_SIGNAL_MATCH_FUNC - | G_SIGNAL_MATCH_DATA, 0, 0, NULL, - window_id_cb, ow); - - gst_x_overlay_set_xwindow_id(GST_X_OVERLAY( - GST_MESSAGE_SRC(msg)), ow->window_id); -} -#endif - -gboolean -purple_media_manager_create_output_window(PurpleMediaManager *manager, - PurpleMedia *media, const gchar *session_id, - const gchar *participant) -{ -#ifdef USE_VV - GList *iter; - - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - iter = manager->priv->output_windows; - for(; iter; iter = g_list_next(iter)) { - PurpleMediaOutputWindow *ow = iter->data; - - if (ow->sink == NULL && ow->media == media && - ((participant != NULL && - ow->participant != NULL && - !strcmp(participant, ow->participant)) || - (participant == ow->participant)) && - !strcmp(session_id, ow->session_id)) { - GstBus *bus; - GstElement *queue, *colorspace; - GstElement *tee = purple_media_get_tee(media, - session_id, participant); - - if (tee == NULL) - continue; - - queue = gst_element_factory_make( - "queue", NULL); - colorspace = gst_element_factory_make( - "ffmpegcolorspace", NULL); - ow->sink = purple_media_manager_get_element( - manager, PURPLE_MEDIA_RECV_VIDEO, - ow->media, ow->session_id, - ow->participant); - - if (participant == NULL) { - /* aka this is a preview sink */ - GObjectClass *klass = - G_OBJECT_GET_CLASS(ow->sink); - if (g_object_class_find_property(klass, - "sync")) - g_object_set(G_OBJECT(ow->sink), - "sync", "FALSE", NULL); - if (g_object_class_find_property(klass, - "async")) - g_object_set(G_OBJECT(ow->sink), - "async", FALSE, NULL); - } - - gst_bin_add_many(GST_BIN(GST_ELEMENT_PARENT(tee)), - queue, colorspace, ow->sink, NULL); - - bus = gst_pipeline_get_bus(GST_PIPELINE( - manager->priv->pipeline)); - g_signal_connect(bus, "sync-message::element", - G_CALLBACK(window_id_cb), ow); - gst_object_unref(bus); - - gst_element_set_state(ow->sink, GST_STATE_PLAYING); - gst_element_set_state(colorspace, GST_STATE_PLAYING); - gst_element_set_state(queue, GST_STATE_PLAYING); - gst_element_link(colorspace, ow->sink); - gst_element_link(queue, colorspace); - gst_element_link(tee, queue); - } - } - return TRUE; -#else - return FALSE; -#endif -} - -gulong -purple_media_manager_set_output_window(PurpleMediaManager *manager, - PurpleMedia *media, const gchar *session_id, - const gchar *participant, gulong window_id) -{ -#ifdef USE_VV - PurpleMediaOutputWindow *output_window; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); - g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); - - output_window = g_new0(PurpleMediaOutputWindow, 1); - output_window->id = manager->priv->next_output_window_id++; - output_window->media = media; - output_window->session_id = g_strdup(session_id); - output_window->participant = g_strdup(participant); - output_window->window_id = window_id; - - manager->priv->output_windows = g_list_prepend( - manager->priv->output_windows, output_window); - - if (purple_media_get_tee(media, session_id, participant) != NULL) - purple_media_manager_create_output_window(manager, - media, session_id, participant); - - return output_window->id; -#else - return 0; -#endif -} - -gboolean -purple_media_manager_remove_output_window(PurpleMediaManager *manager, - gulong output_window_id) -{ -#ifdef USE_VV - PurpleMediaOutputWindow *output_window = NULL; - GList *iter; - - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); - - iter = manager->priv->output_windows; - for (; iter; iter = g_list_next(iter)) { - PurpleMediaOutputWindow *ow = iter->data; - if (ow->id == output_window_id) { - manager->priv->output_windows = g_list_delete_link( - manager->priv->output_windows, iter); - output_window = ow; - break; - } - } - - if (output_window == NULL) - return FALSE; - - if (output_window->sink != NULL) { - GstPad *pad = gst_element_get_static_pad( - output_window->sink, "sink"); - GstPad *peer = gst_pad_get_peer(pad); - GstElement *colorspace = GST_ELEMENT_PARENT(peer), *queue; - gst_object_unref(pad); - gst_object_unref(peer); - pad = gst_element_get_static_pad(colorspace, "sink"); - peer = gst_pad_get_peer(pad); - queue = GST_ELEMENT_PARENT(peer); - gst_object_unref(pad); - gst_object_unref(peer); - pad = gst_element_get_static_pad(queue, "sink"); - peer = gst_pad_get_peer(pad); - gst_object_unref(pad); - if (peer != NULL) - gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer); - gst_element_set_locked_state(queue, TRUE); - gst_element_set_state(queue, GST_STATE_NULL); - gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(queue)), queue); - gst_element_set_locked_state(colorspace, TRUE); - gst_element_set_state(colorspace, GST_STATE_NULL); - gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(colorspace)), colorspace); - gst_element_set_locked_state(output_window->sink, TRUE); - gst_element_set_state(output_window->sink, GST_STATE_NULL); - gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(output_window->sink)), - output_window->sink); - } - - g_free(output_window->session_id); - g_free(output_window->participant); - g_free(output_window); - - return TRUE; -#else - return FALSE; -#endif -} - -void -purple_media_manager_remove_output_windows(PurpleMediaManager *manager, - PurpleMedia *media, const gchar *session_id, - const gchar *participant) -{ -#ifdef USE_VV - GList *iter; - - g_return_if_fail(PURPLE_IS_MEDIA(media)); - - iter = manager->priv->output_windows; - - for (; iter;) { - PurpleMediaOutputWindow *ow = iter->data; - iter = g_list_next(iter); - - if (media == ow->media && - ((session_id != NULL && ow->session_id != NULL && - !strcmp(session_id, ow->session_id)) || - (session_id == ow->session_id)) && - ((participant != NULL && ow->participant != NULL && - !strcmp(participant, ow->participant)) || - (participant == ow->participant))) - purple_media_manager_remove_output_window( - manager, ow->id); - } -#endif -} - -void -purple_media_manager_set_ui_caps(PurpleMediaManager *manager, - PurpleMediaCaps caps) -{ -#ifdef USE_VV - g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager)); - manager->priv->ui_caps = caps; -#endif -} - -PurpleMediaCaps -purple_media_manager_get_ui_caps(PurpleMediaManager *manager) -{ -#ifdef USE_VV - g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), - PURPLE_MEDIA_CAPS_NONE); - return manager->priv->ui_caps; -#else - return PURPLE_MEDIA_CAPS_NONE; -#endif -} - -#ifdef USE_GSTREAMER - -/* - * PurpleMediaElementType - */ - -GType -purple_media_element_type_get_type() -{ - static GType type = 0; - if (type == 0) { - static const GFlagsValue values[] = { - { PURPLE_MEDIA_ELEMENT_NONE, - "PURPLE_MEDIA_ELEMENT_NONE", "none" }, - { PURPLE_MEDIA_ELEMENT_AUDIO, - "PURPLE_MEDIA_ELEMENT_AUDIO", "audio" }, - { PURPLE_MEDIA_ELEMENT_VIDEO, - "PURPLE_MEDIA_ELEMENT_VIDEO", "video" }, - { PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO, - "PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO", - "audio-video" }, - { PURPLE_MEDIA_ELEMENT_NO_SRCS, - "PURPLE_MEDIA_ELEMENT_NO_SRCS", "no-srcs" }, - { PURPLE_MEDIA_ELEMENT_ONE_SRC, - "PURPLE_MEDIA_ELEMENT_ONE_SRC", "one-src" }, - { PURPLE_MEDIA_ELEMENT_MULTI_SRC, - "PURPLE_MEDIA_ELEMENT_MULTI_SRC", - "multi-src" }, - { PURPLE_MEDIA_ELEMENT_REQUEST_SRC, - "PURPLE_MEDIA_ELEMENT_REQUEST_SRC", - "request-src" }, - { PURPLE_MEDIA_ELEMENT_NO_SINKS, - "PURPLE_MEDIA_ELEMENT_NO_SINKS", "no-sinks" }, - { PURPLE_MEDIA_ELEMENT_ONE_SINK, - "PURPLE_MEDIA_ELEMENT_ONE_SINK", "one-sink" }, - { PURPLE_MEDIA_ELEMENT_MULTI_SINK, - "PURPLE_MEDIA_ELEMENT_MULTI_SINK", - "multi-sink" }, - { PURPLE_MEDIA_ELEMENT_REQUEST_SINK, - "PURPLE_MEDIA_ELEMENT_REQUEST_SINK", - "request-sink" }, - { PURPLE_MEDIA_ELEMENT_UNIQUE, - "PURPLE_MEDIA_ELEMENT_UNIQUE", "unique" }, - { PURPLE_MEDIA_ELEMENT_SRC, - "PURPLE_MEDIA_ELEMENT_SRC", "src" }, - { PURPLE_MEDIA_ELEMENT_SINK, - "PURPLE_MEDIA_ELEMENT_SINK", "sink" }, - { 0, NULL, NULL } - }; - type = g_flags_register_static( - "PurpleMediaElementType", values); - } - return type; -} - -/* - * PurpleMediaElementInfo - */ - -struct _PurpleMediaElementInfoClass -{ - GObjectClass parent_class; -}; - -struct _PurpleMediaElementInfo -{ - GObject parent; -}; - -#ifdef USE_VV -struct _PurpleMediaElementInfoPrivate -{ - gchar *id; - gchar *name; - PurpleMediaElementType type; - PurpleMediaElementCreateCallback create; -}; - -enum { - PROP_0, - PROP_ID, - PROP_NAME, - PROP_TYPE, - PROP_CREATE_CB, -}; - -static void -purple_media_element_info_init(PurpleMediaElementInfo *info) -{ - PurpleMediaElementInfoPrivate *priv = - PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info); - priv->id = NULL; - priv->name = NULL; - priv->type = PURPLE_MEDIA_ELEMENT_NONE; - priv->create = NULL; -} - -static void -purple_media_element_info_finalize(GObject *info) -{ - PurpleMediaElementInfoPrivate *priv = - PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(info); - g_free(priv->id); - g_free(priv->name); -} - -static void -purple_media_element_info_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - PurpleMediaElementInfoPrivate *priv; - g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object)); - - priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_ID: - g_free(priv->id); - priv->id = g_value_dup_string(value); - break; - case PROP_NAME: - g_free(priv->name); - priv->name = g_value_dup_string(value); - break; - case PROP_TYPE: { - priv->type = g_value_get_flags(value); - break; - } - case PROP_CREATE_CB: - priv->create = g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID( - object, prop_id, pspec); - break; - } -} - -static void -purple_media_element_info_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - PurpleMediaElementInfoPrivate *priv; - g_return_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(object)); - - priv = PURPLE_MEDIA_ELEMENT_INFO_GET_PRIVATE(object); - - switch (prop_id) { - case PROP_ID: - g_value_set_string(value, priv->id); - break; - case PROP_NAME: - g_value_set_string(value, priv->name); - break; - case PROP_TYPE: - g_value_set_flags(value, priv->type); - break; - case PROP_CREATE_CB: - g_value_set_pointer(value, priv->create); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID( - object, prop_id, pspec); - break; - } -} - -static void -purple_media_element_info_class_init(PurpleMediaElementInfoClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - - gobject_class->finalize = purple_media_element_info_finalize; - gobject_class->set_property = purple_media_element_info_set_property; - gobject_class->get_property = purple_media_element_info_get_property; - - g_object_class_install_property(gobject_class, PROP_ID, - g_param_spec_string("id", - "ID", - "The unique identifier of the element.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_NAME, - g_param_spec_string("name", - "Name", - "The friendly/display name of this element.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_TYPE, - g_param_spec_flags("type", - "Element Type", - "The type of element this is.", - PURPLE_TYPE_MEDIA_ELEMENT_TYPE, - PURPLE_MEDIA_ELEMENT_NONE, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_CREATE_CB, - g_param_spec_pointer("create-cb", - "Create Callback", - "The function called to create this element.", - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(PurpleMediaElementInfoPrivate)); -} - -G_DEFINE_TYPE(PurpleMediaElementInfo, - purple_media_element_info, G_TYPE_OBJECT); -#else -GType -purple_media_element_info_get_type() -{ - return G_TYPE_NONE; -} -#endif - -gchar * -purple_media_element_info_get_id(PurpleMediaElementInfo *info) -{ -#ifdef USE_VV - gchar *id; - g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL); - g_object_get(info, "id", &id, NULL); - return id; -#else - return NULL; -#endif -} - -gchar * -purple_media_element_info_get_name(PurpleMediaElementInfo *info) -{ -#ifdef USE_VV - gchar *name; - g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL); - g_object_get(info, "name", &name, NULL); - return name; -#else - return NULL; -#endif -} - -PurpleMediaElementType -purple_media_element_info_get_element_type(PurpleMediaElementInfo *info) -{ -#ifdef USE_VV - PurpleMediaElementType type; - g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), - PURPLE_MEDIA_ELEMENT_NONE); - g_object_get(info, "type", &type, NULL); - return type; -#else - return PURPLE_MEDIA_ELEMENT_NONE; -#endif -} - -GstElement * -purple_media_element_info_call_create(PurpleMediaElementInfo *info, - PurpleMedia *media, const gchar *session_id, - const gchar *participant) -{ -#ifdef USE_VV - PurpleMediaElementCreateCallback create; - g_return_val_if_fail(PURPLE_IS_MEDIA_ELEMENT_INFO(info), NULL); - g_object_get(info, "create-cb", &create, NULL); - if (create) - return create(media, session_id, participant); -#endif - return NULL; -} - -#endif /* USE_GSTREAMER */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mediamanager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,224 +0,0 @@ -/** - * @file mediamanager.h Media Manager API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_MEDIA_MANAGER_H_ -#define _PURPLE_MEDIA_MANAGER_H_ - -#include -#include - -/** An opaque structure representing a group of (usually all) media calls. */ -typedef struct _PurpleMediaManager PurpleMediaManager; -/** The GObject class structure of the PurpleMediaManager object. */ -typedef struct _PurpleMediaManagerClass PurpleMediaManagerClass; - -#include "account.h" -#include "media.h" - -G_BEGIN_DECLS - -#define PURPLE_TYPE_MEDIA_MANAGER (purple_media_manager_get_type()) -#define PURPLE_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManager)) -#define PURPLE_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerClass)) -#define PURPLE_IS_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_MANAGER)) -#define PURPLE_IS_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_MANAGER)) -#define PURPLE_MEDIA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerClass)) - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Media Manager API */ -/**************************************************************************/ -/*@{*/ - -/** - * Gets the media manager's GType. - * - * @return The media manager's GType. - * - * @since 2.6.0 - */ -GType purple_media_manager_get_type(void); - -/** - * Gets the "global" media manager object. It's created if it doesn't already exist. - * - * @return The "global" instance of the media manager object. - * - * @since 2.6.0 - */ -PurpleMediaManager *purple_media_manager_get(void); - -/** - * Creates a media session. - * - * @param manager The media manager to create the session under. - * @param account The account to create the session on. - * @param conference_type The conference type to feed into Farsight2. - * @param remote_user The remote user to initiate the session with. - * @param initiator TRUE if the local user is the initiator of this media call, FALSE otherwise. - * - * @return A newly created media session. - * - * @since 2.6.0 - */ -PurpleMedia *purple_media_manager_create_media(PurpleMediaManager *manager, - PurpleAccount *account, - const char *conference_type, - const char *remote_user, - gboolean initiator); - -/** - * Gets all of the media sessions. - * - * @param manager The media manager to get all of the sessions from. - * - * @return A list of all the media sessions. - * - * @since 2.6.0 - */ -GList *purple_media_manager_get_media(PurpleMediaManager *manager); - -/** - * Gets all of the media sessions for a given account. - * - * @param manager The media manager to get the sessions from. - * @param account The account the sessions are on. - * - * @return A list of the media sessions on the given account. - * - * @since 2.6.0 - */ -GList *purple_media_manager_get_media_by_account( - PurpleMediaManager *manager, PurpleAccount *account); - -/** - * Removes a media session from the media manager. - * - * @param manager The media manager to remove the media session from. - * @param media The media session to remove. - * - * @since 2.6.0 - */ -void -purple_media_manager_remove_media(PurpleMediaManager *manager, - PurpleMedia *media); - -/** - * Signals that output windows should be created for the chosen stream. - * - * This shouldn't be called outside of mediamanager.c and media.c - * - * @param manager Manager the output windows are registered with. - * @param media Media session the output windows are registered for. - * @param session_id The session the output windows are registered with. - * @param participant The participant the output windows are registered with. - * - * @return TRUE if it succeeded, FALSE if it failed. - * - * @since 2.6.0 - */ -gboolean purple_media_manager_create_output_window( - PurpleMediaManager *manager, PurpleMedia *media, - const gchar *session_id, const gchar *participant); - -/** - * Registers a video output window to be created for a given stream. - * - * @param manager The manager to register the output window with. - * @param media The media instance to find the stream in. - * @param session_id The session the stream is associated with. - * @param participant The participant the stream is associated with. - * @param window_id The window ID to embed the video in. - * - * @return A unique ID to the registered output window, 0 if it failed. - * - * @since 2.6.0 - */ -gulong purple_media_manager_set_output_window(PurpleMediaManager *manager, - PurpleMedia *media, const gchar *session_id, - const gchar *participant, gulong window_id); - -/** - * Remove a previously registerd output window. - * - * @param manager The manager the output window was registered with. - * @param output_window_id The ID of the output window. - * - * @return TRUE if it found the output window and was successful, else FALSE. - * - * @since 2.6.0 - */ -gboolean purple_media_manager_remove_output_window( - PurpleMediaManager *manager, gulong output_window_id); - -/** - * Remove all output windows for a given conference/session/participant/stream. - * - * @param manager The manager the output windows were registered with. - * @param media The media instance the output windows were registered for. - * @param session_id The session the output windows were registered for. - * @param participant The participant the output windows were registered for. - * - * @since 2.6.0 - */ -void purple_media_manager_remove_output_windows( - PurpleMediaManager *manager, PurpleMedia *media, - const gchar *session_id, const gchar *participant); - -/** - * Sets which media caps the UI supports. - * - * @param manager The manager to set the caps on. - * @param caps The caps to set. - * - * @since 2.6.0 - */ -void purple_media_manager_set_ui_caps(PurpleMediaManager *manager, - PurpleMediaCaps caps); - -/** - * Gets which media caps the UI supports. - * - * @param manager The manager to get caps from. - * - * @return caps The caps retrieved. - * - * @since 2.6.0 - */ -PurpleMediaCaps purple_media_manager_get_ui_caps(PurpleMediaManager *manager); - -/*}@*/ - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* _PURPLE_MEDIA_MANAGER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,559 +0,0 @@ -/* - * Purple - * - * Purple is the legal property of its developers, whose names are too - * numerous to list here. Please refer to the COPYRIGHT file distributed - * with this source distribution - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "internal.h" - -/* this should become "util.h" if we ever get this into purple proper */ -#include "debug.h" -#include "mime.h" -#include "util.h" - -/** - * @struct mime_fields - * - * Utility structure used in both MIME document and parts, which maps - * field names to their values, and keeps an easily accessible list of - * keys. - */ -struct mime_fields { - GHashTable *map; - GList *keys; -}; - -struct _PurpleMimeDocument { - struct mime_fields fields; - GList *parts; -}; - -struct _PurpleMimePart { - struct mime_fields fields; - struct _PurpleMimeDocument *doc; - GString *data; -}; - -static void -fields_set(struct mime_fields *mf, const char *key, const char *val) -{ - char *k, *v; - - g_return_if_fail(mf != NULL); - g_return_if_fail(mf->map != NULL); - - k = g_ascii_strdown(key, -1); - v = g_strdup(val); - - /* append to the keys list only if it's not already there */ - if(! g_hash_table_lookup(mf->map, k)) { - mf->keys = g_list_append(mf->keys, k); - } - - /* important to use insert. If the key is already in the table, then - it's already in the keys list. Insert will free the new instance - of the key rather than the old instance. */ - g_hash_table_insert(mf->map, k, v); -} - - -static const char * -fields_get(struct mime_fields *mf, const char *key) -{ - char *kdown; - const char *ret; - - g_return_val_if_fail(mf != NULL, NULL); - g_return_val_if_fail(mf->map != NULL, NULL); - - kdown = g_ascii_strdown(key, -1); - ret = g_hash_table_lookup(mf->map, kdown); - g_free(kdown); - - return ret; -} - - -static void -fields_init(struct mime_fields *mf) -{ - g_return_if_fail(mf != NULL); - - mf->map = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); -} - - -static void -fields_loadline(struct mime_fields *mf, const char *line, gsize len) -{ - /* split the line into key: value */ - char *key, *newkey, *val; - char **tokens; - - /* feh, need it to be NUL terminated */ - key = g_strndup(line, len); - - /* split */ - val = strchr(key, ':'); - if(! val) { - g_free(key); - return; - } - *val++ = '\0'; - - /* normalize whitespace (sorta) and trim on key and value */ - tokens = g_strsplit(key, "\t\r\n", 0); - newkey = g_strjoinv("", tokens); - g_strstrip(newkey); - g_strfreev(tokens); - - tokens = g_strsplit(val, "\t\r\n", 0); - val = g_strjoinv("", tokens); - g_strstrip(val); - g_strfreev(tokens); - - fields_set(mf, newkey, val); - - g_free(newkey); - g_free(key); - g_free(val); -} - - -static void -fields_load(struct mime_fields *mf, char **buf, gsize *len) -{ - char *tail; - - while ((tail = g_strstr_len(*buf, *len, "\r\n"))) - { - char *line; - gsize ln; - - /* determine the current line */ - line = *buf; - ln = tail - line; - - /* advance our search space past the CRLF */ - *buf = tail + 2; - *len -= (ln + 2); - - /* empty line, end of headers */ - if(! ln) return; - - /* look out for line continuations */ - if(line[ln-1] == ';') { - tail = g_strstr_len(*buf, *len, "\r\n"); - if(tail) { - gsize cln; - - cln = tail - *buf; - ln = tail - line; - - /* advance our search space past the CRLF (again) */ - *buf = tail + 2; - *len -= (cln + 2); - } - } - - /* process our super-cool line */ - fields_loadline(mf, line, ln); - } -} - - -static void -field_write(const char *key, const char *val, GString *str) -{ - g_string_append_printf(str, "%s: %s\r\n", key, val); -} - - -static void -fields_write(struct mime_fields *mf, GString *str) -{ - g_return_if_fail(mf != NULL); - - g_hash_table_foreach(mf->map, (GHFunc) field_write, str); - g_string_append(str, "\r\n"); -} - - -static void -fields_destroy(struct mime_fields *mf) -{ - g_return_if_fail(mf != NULL); - - g_hash_table_destroy(mf->map); - g_list_free(mf->keys); - - mf->map = NULL; - mf->keys = NULL; -} - - -static PurpleMimePart * -part_new(PurpleMimeDocument *doc) -{ - PurpleMimePart *part; - - part = g_new0(PurpleMimePart, 1); - fields_init(&part->fields); - part->doc = doc; - part->data = g_string_new(NULL); - - doc->parts = g_list_prepend(doc->parts, part); - - return part; -} - - -static void -part_load(PurpleMimePart *part, const char *buf, gsize len) -{ - - char *b = (char *) buf; - gsize n = len; - - fields_load(&part->fields, &b, &n); - - /* the remainder will have a blank line, if there's anything at all, - so check if there's anything then trim off the trailing four - bytes, \r\n\r\n */ - if(n > 4) n -= 4; - g_string_append_len(part->data, b, n); -} - - -static void -part_write(PurpleMimePart *part, GString *str) -{ - fields_write(&part->fields, str); - g_string_append_printf(str, "%s\r\n\r\n", part->data->str); -} - - -static void -part_free(PurpleMimePart *part) -{ - - fields_destroy(&part->fields); - - g_string_free(part->data, TRUE); - part->data = NULL; - - g_free(part); -} - - -PurpleMimePart * -purple_mime_part_new(PurpleMimeDocument *doc) -{ - g_return_val_if_fail(doc != NULL, NULL); - return part_new(doc); -} - - -GList * -purple_mime_part_get_fields(PurpleMimePart *part) -{ - g_return_val_if_fail(part != NULL, NULL); - return part->fields.keys; -} - - -const char * -purple_mime_part_get_field(PurpleMimePart *part, const char *field) -{ - g_return_val_if_fail(part != NULL, NULL); - return fields_get(&part->fields, field); -} - - -char * -purple_mime_part_get_field_decoded(PurpleMimePart *part, const char *field) -{ - const char *f; - - g_return_val_if_fail(part != NULL, NULL); - - f = fields_get(&part->fields, field); - return purple_mime_decode_field(f); -} - - -void -purple_mime_part_set_field(PurpleMimePart *part, const char *field, const char *value) -{ - g_return_if_fail(part != NULL); - fields_set(&part->fields, field, value); -} - - -const char * -purple_mime_part_get_data(PurpleMimePart *part) -{ - g_return_val_if_fail(part != NULL, NULL); - g_return_val_if_fail(part->data != NULL, NULL); - - return part->data->str; -} - - -void -purple_mime_part_get_data_decoded(PurpleMimePart *part, guchar **data, gsize *len) -{ - const char *enc; - - g_return_if_fail(part != NULL); - g_return_if_fail(data != NULL); - g_return_if_fail(len != NULL); - - g_return_if_fail(part->data != NULL); - - enc = purple_mime_part_get_field(part, "content-transfer-encoding"); - - if(! enc) { - *data = (guchar *)g_strdup(part->data->str); - *len = part->data->len; - - } else if(! g_ascii_strcasecmp(enc, "7bit")) { - *data = (guchar *)g_strdup(part->data->str); - *len = part->data->len; - - } else if(! g_ascii_strcasecmp(enc, "8bit")) { - *data = (guchar *)g_strdup(part->data->str); - *len = part->data->len; - - } else if(! g_ascii_strcasecmp(enc, "base16")) { - *data = purple_base16_decode(part->data->str, len); - - } else if(! g_ascii_strcasecmp(enc, "base64")) { - *data = purple_base64_decode(part->data->str, len); - - } else if(! g_ascii_strcasecmp(enc, "quoted-printable")) { - *data = purple_quotedp_decode(part->data->str, len); - - } else { - purple_debug_warning("mime", "purple_mime_part_get_data_decoded:" - " unknown encoding '%s'\n", enc); - *data = NULL; - *len = 0; - } -} - - -gsize -purple_mime_part_get_length(PurpleMimePart *part) -{ - g_return_val_if_fail(part != NULL, 0); - g_return_val_if_fail(part->data != NULL, 0); - - return part->data->len; -} - - -void -purple_mime_part_set_data(PurpleMimePart *part, const char *data) -{ - g_return_if_fail(part != NULL); - g_string_free(part->data, TRUE); - part->data = g_string_new(data); -} - - -PurpleMimeDocument * -purple_mime_document_new() -{ - PurpleMimeDocument *doc; - - doc = g_new0(PurpleMimeDocument, 1); - fields_init(&doc->fields); - - return doc; -} - - -static void -doc_parts_load(PurpleMimeDocument *doc, const char *boundary, const char *buf, gsize len) -{ - char *b = (char *) buf; - gsize n = len; - - char *bnd; - gsize bl; - - bnd = g_strdup_printf("--%s", boundary); - bl = strlen(bnd); - - for(b = g_strstr_len(b, n, bnd); b; ) { - char *tail; - - /* skip the boundary */ - b += bl; - n -= bl; - - /* skip the trailing \r\n or -- as well */ - if(n >= 2) { - b += 2; - n -= 2; - } - - /* find the next boundary */ - tail = g_strstr_len(b, n, bnd); - - if(tail) { - gsize sl; - - sl = tail - b; - if(sl) { - PurpleMimePart *part = part_new(doc); - part_load(part, b, sl); - } - } - - b = tail; - } - - g_free(bnd); -} - - -PurpleMimeDocument * -purple_mime_document_parsen(const char *buf, gsize len) -{ - PurpleMimeDocument *doc; - - char *b = (char *) buf; - gsize n = len; - - g_return_val_if_fail(buf != NULL, NULL); - - doc = purple_mime_document_new(); - - if (!len) - return doc; - - fields_load(&doc->fields, &b, &n); - - { - const char *ct = fields_get(&doc->fields, "content-type"); - if(ct && purple_str_has_prefix(ct, "multipart")) { - char *bd = strrchr(ct, '='); - if(bd++) { - doc_parts_load(doc, bd, b, n); - } - } - } - - return doc; -} - - -PurpleMimeDocument * -purple_mime_document_parse(const char *buf) -{ - g_return_val_if_fail(buf != NULL, NULL); - return purple_mime_document_parsen(buf, strlen(buf)); -} - - -void -purple_mime_document_write(PurpleMimeDocument *doc, GString *str) -{ - const char *bd = NULL; - - g_return_if_fail(doc != NULL); - g_return_if_fail(str != NULL); - - { - const char *ct = fields_get(&doc->fields, "content-type"); - if(ct && purple_str_has_prefix(ct, "multipart")) { - char *b = strrchr(ct, '='); - if(b++) bd = b; - } - } - - fields_write(&doc->fields, str); - - if(bd) { - GList *l; - - for(l = doc->parts; l; l = l->next) { - g_string_append_printf(str, "--%s\r\n", bd); - - part_write(l->data, str); - - if(! l->next) { - g_string_append_printf(str, "--%s--\r\n", bd); - } - } - } -} - - -GList * -purple_mime_document_get_fields(PurpleMimeDocument *doc) -{ - g_return_val_if_fail(doc != NULL, NULL); - return doc->fields.keys; -} - - -const char * -purple_mime_document_get_field(PurpleMimeDocument *doc, const char *field) -{ - g_return_val_if_fail(doc != NULL, NULL); - return fields_get(&doc->fields, field); -} - - -void -purple_mime_document_set_field(PurpleMimeDocument *doc, const char *field, const char *value) -{ - g_return_if_fail(doc != NULL); - fields_set(&doc->fields, field, value); -} - - -GList * -purple_mime_document_get_parts(PurpleMimeDocument *doc) -{ - g_return_val_if_fail(doc != NULL, NULL); - return doc->parts; -} - - -void -purple_mime_document_free(PurpleMimeDocument *doc) -{ - if (!doc) - return; - - fields_destroy(&doc->fields); - - while(doc->parts) { - part_free(doc->parts->data); - doc->parts = g_list_delete_link(doc->parts, doc->parts); - } - - g_free(doc); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/mime.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -/* - * Purple - * - * Purple is the legal property of its developers, whose names are too - * numerous to list here. Please refer to the COPYRIGHT file distributed - * with this source distribution - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#ifndef _PURPLE_MIME_H -#define _PURPLE_MIME_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file mime.h - * @ingroup core - * - * Rudimentary parsing of multi-part MIME messages into more - * accessible structures. - */ - -/** - * A MIME document. - */ -typedef struct _PurpleMimeDocument PurpleMimeDocument; - -/** - * A part of a multipart MIME document. - */ -typedef struct _PurpleMimePart PurpleMimePart; - -/** - * Allocate an empty MIME document. - */ -PurpleMimeDocument *purple_mime_document_new(void); - -/** - * Frees memory used in a MIME document and all of its parts and fields - * - * @param doc The MIME document to free. - */ -void purple_mime_document_free(PurpleMimeDocument *doc); - -/** - * Parse a MIME document from a NUL-terminated string. - * - * @param buf The NULL-terminated string containing the MIME-encoded data. - * - * @returns A MIME document. - */ -PurpleMimeDocument *purple_mime_document_parse(const char *buf); - -/** - * Parse a MIME document from a string - * - * @param buf The string containing the MIME-encoded data. - * @param len Length of buf. - * - * @returns A MIME document. - */ -PurpleMimeDocument *purple_mime_document_parsen(const char *buf, gsize len); - -/** - * Write (append) a MIME document onto a GString. - */ -void purple_mime_document_write(PurpleMimeDocument *doc, GString *str); - -/** - * The list of fields in the header of a document - * - * @param doc The MIME document. - * - * @constreturn A list of strings indicating the fields (but not the values - * of the fields) in the header of doc. - */ -GList *purple_mime_document_get_fields(PurpleMimeDocument *doc); - -/** - * Get the value of a specific field in the header of a document. - * - * @param doc The MIME document. - * @param field Case-insensitive field name. - * - * @returns Value associated with the indicated header field, or - * NULL if the field doesn't exist. - */ -const char *purple_mime_document_get_field(PurpleMimeDocument *doc, - const char *field); - -/** - * Set or replace the value of a specific field in the header of a - * document. - * - * @param doc The MIME document. - * @param field Case-insensitive field name. - * @param value Value to associate with the indicated header field, - * of NULL to remove the field. - */ -void purple_mime_document_set_field(PurpleMimeDocument *doc, - const char *field, - const char *value); - -/** - * The list of parts in a multipart document. - * - * @param doc The MIME document. - * - * @constreturn List of PurpleMimePart contained within doc. - */ -GList *purple_mime_document_get_parts(PurpleMimeDocument *doc); - -/** - * Create and insert a new part into a MIME document. - * - * @param doc The new part's parent MIME document. - */ -PurpleMimePart *purple_mime_part_new(PurpleMimeDocument *doc); - - -/** - * The list of fields in the header of a document part. - * - * @param part The MIME document part. - * - * @constreturn List of strings indicating the fields (but not the values - * of the fields) in the header of part. - */ -GList *purple_mime_part_get_fields(PurpleMimePart *part); - - -/** - * Get the value of a specific field in the header of a document part. - * - * @param part The MIME document part. - * @param field Case-insensitive name of the header field. - * - * @returns Value of the specified header field, or NULL if the - * field doesn't exist. - */ -const char *purple_mime_part_get_field(PurpleMimePart *part, - const char *field); - -/** - * Get the decoded value of a specific field in the header of a - * document part. - */ -char *purple_mime_part_get_field_decoded(PurpleMimePart *part, - const char *field); - -/** - * Set or replace the value of a specific field in the header of a - * document. - * - * @param part The part of the MIME document. - * @param field Case-insensitive field name - * @param value Value to associate with the indicated header field, - * of NULL to remove the field. - */ -void purple_mime_part_set_field(PurpleMimePart *part, - const char *field, - const char *value); - -/** - * Get the (possibly encoded) data portion of a MIME document part. - * - * @param part The MIME document part. - * - * @returns NULL-terminated data found in the document part - */ -const char *purple_mime_part_get_data(PurpleMimePart *part); - -/** - * Get the data portion of a MIME document part, after attempting to - * decode it according to the content-transfer-encoding field. If the - * specified encoding method is not supported, this function will - * return NULL. - * - * @param part The MIME documemt part. - * @param data Buffer for the data. - * @param len The length of the buffer. - */ -void purple_mime_part_get_data_decoded(PurpleMimePart *part, - guchar **data, gsize *len); - -/** - * Get the length of the data portion of a MIME document part. - * - * @param part The MIME document part. - * @returns Length of the data in the document part. - */ -gsize purple_mime_part_get_length(PurpleMimePart *part); - -void purple_mime_part_set_data(PurpleMimePart *part, const char *data); - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,567 +0,0 @@ -/** - * @file nat-pmp.c NAT-PMP Implementation - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Most code in nat-pmp.c copyright (C) 2007, R. Tyler Ballance, bleep, LLC. - * This file is distributed under the 3-clause (modified) BSD license: - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of conditions and - * the following disclaimer. - * Neither the name of the bleep. LLC nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - */ - -#include "internal.h" -#include "nat-pmp.h" -#include "debug.h" -#include "signals.h" -#include "network.h" - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -#ifdef HAVE_SYS_SYSCTL_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -/* We will need sysctl() and NET_RT_DUMP, both of which are not present - * on all platforms, to continue. */ -#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP) - -#include -#include - -#define PMP_DEBUG 1 - -typedef struct { - guint8 version; - guint8 opcode; -} PurplePmpIpRequest; - -typedef struct { - guint8 version; - guint8 opcode; /* 128 + n */ - guint16 resultcode; - guint32 epoch; - guint32 address; -} PurplePmpIpResponse; - -typedef struct { - guint8 version; - guint8 opcode; - char reserved[2]; - guint16 privateport; - guint16 publicport; - guint32 lifetime; -} PurplePmpMapRequest; - -struct _PurplePmpMapResponse { - guint8 version; - guint8 opcode; - guint16 resultcode; - guint32 epoch; - guint16 privateport; - guint16 publicport; - guint32 lifetime; -}; - -typedef struct _PurplePmpMapResponse PurplePmpMapResponse; - -typedef enum { - PURPLE_PMP_STATUS_UNDISCOVERED = -1, - PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER, - PURPLE_PMP_STATUS_DISCOVERING, - PURPLE_PMP_STATUS_DISCOVERED -} PurpleUPnPStatus; - -typedef struct { - PurpleUPnPStatus status; - gchar *publicip; -} PurplePmpInfo; - -static PurplePmpInfo pmp_info = {PURPLE_PMP_STATUS_UNDISCOVERED, NULL}; - -/* - * Thanks to R. Matthew Emerson for the fixes on this - */ - -#define PMP_MAP_OPCODE_UDP 1 -#define PMP_MAP_OPCODE_TCP 2 - -#define PMP_VERSION 0 -#define PMP_PORT 5351 -#define PMP_TIMEOUT 250000 /* 250000 useconds */ - -/* alignment constraint for routing socket */ -#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) -#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) - -static void -get_rtaddrs(int bitmask, struct sockaddr *sa, struct sockaddr *addrs[]) -{ - int i; - - for (i = 0; i < RTAX_MAX; i++) - { - if (bitmask & (1 << i)) - { - addrs[i] = sa; -#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa); -#else - if (sa->sa_family == AF_INET) - sa = (struct sockaddr*)(sizeof(struct sockaddr_in) + (char *)sa); -#ifdef AF_INET6 - else if (sa->sa_family == AF_INET6) - sa = (struct sockaddr*)(sizeof(struct sockaddr_in6) + (char *)sa); -#endif -#endif - } - else - { - addrs[i] = NULL; - } - } -} - -static int -is_default_route(struct sockaddr *sa, struct sockaddr *mask) -{ - struct sockaddr_in *sin; - - if (sa->sa_family != AF_INET) - return 0; - - sin = (struct sockaddr_in *)sa; - if ((sin->sin_addr.s_addr == INADDR_ANY) && - mask && - (ntohl(((struct sockaddr_in *)mask)->sin_addr.s_addr) == 0L || -#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN - mask->sa_len == 0 -#else - 0 -#endif - )) - return 1; - else - return 0; -} - -/*! - * The return sockaddr_in must be g_free()'d when no longer needed - */ -static struct sockaddr_in * -default_gw() -{ - int mib[6]; - size_t needed; - char *buf, *next, *lim; - struct rt_msghdr *rtm; - struct sockaddr *sa; - struct sockaddr_in *sin = NULL; - gboolean found = FALSE; - - mib[0] = CTL_NET; - mib[1] = PF_ROUTE; /* entire routing table or a subset of it */ - mib[2] = 0; /* protocol number - always 0 */ - mib[3] = 0; /* address family - 0 for all addres families */ - mib[4] = NET_RT_DUMP; - mib[5] = 0; - - /* Determine the buffer side needed to get the full routing table */ - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) - { - purple_debug_warning("nat-pmp", "sysctl: net.route.0.0.dump estimate\n"); - return NULL; - } - - if (!(buf = malloc(needed))) - { - purple_debug_warning("nat-pmp", "Failed to malloc %" G_GSIZE_FORMAT "\n", needed); - return NULL; - } - - /* Read the routing table into buf */ - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) - { - purple_debug_warning("nat-pmp", "sysctl: net.route.0.0.dump\n"); - return NULL; - } - - lim = buf + needed; - - for (next = buf; next < lim; next += rtm->rtm_msglen) - { - rtm = (struct rt_msghdr *)next; - sa = (struct sockaddr *)(rtm + 1); - - if (sa->sa_family == AF_INET) - { - sin = (struct sockaddr_in*) sa; - - if ((rtm->rtm_flags & RTF_GATEWAY) && sin->sin_addr.s_addr == INADDR_ANY) - { - /* We found the default route. Now get the destination address and netmask. */ - struct sockaddr *rti_info[RTAX_MAX]; - struct sockaddr addr, mask; - - get_rtaddrs(rtm->rtm_addrs, sa, rti_info); - memset(&addr, 0, sizeof(addr)); - - if (rtm->rtm_addrs & RTA_DST) - memcpy(&addr, rti_info[RTAX_DST], sizeof(addr)); - - memset(&mask, 0, sizeof(mask)); - - if (rtm->rtm_addrs & RTA_NETMASK) - memcpy(&mask, rti_info[RTAX_NETMASK], sizeof(mask)); - - if (rtm->rtm_addrs & RTA_GATEWAY && - is_default_route(&addr, &mask)) - { - if (rti_info[RTAX_GATEWAY]) { - struct sockaddr_in *rti_sin = (struct sockaddr_in *)rti_info[RTAX_GATEWAY]; - sin = g_new0(struct sockaddr_in, 1); - sin->sin_family = rti_sin->sin_family; - sin->sin_port = rti_sin->sin_port; - sin->sin_addr.s_addr = rti_sin->sin_addr.s_addr; - memcpy(sin, rti_info[RTAX_GATEWAY], sizeof(struct sockaddr_in)); - - purple_debug_info("nat-pmp", "Found a default gateway\n"); - found = TRUE; - break; - } - } - } - } - } - - return (found ? sin : NULL); -} - -/*! - * purple_pmp_get_public_ip() will return the publicly facing IP address of the - * default NAT gateway. The function will return NULL if: - * - The gateway doesn't support NAT-PMP - * - The gateway errors in some other spectacular fashion - */ -char * -purple_pmp_get_public_ip() -{ - struct sockaddr_in addr, *gateway, *publicsockaddr = NULL; - struct timeval req_timeout; - socklen_t len; - - PurplePmpIpRequest req; - PurplePmpIpResponse resp; - int sendfd; - - if (pmp_info.status == PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER) - return NULL; - - if ((pmp_info.status == PURPLE_PMP_STATUS_DISCOVERED) && (pmp_info.publicip != NULL)) - { -#ifdef PMP_DEBUG - purple_debug_info("nat-pmp", "Returning cached publicip %s\n",pmp_info.publicip); -#endif - return pmp_info.publicip; - } - - gateway = default_gw(); - - if (!gateway) - { - purple_debug_info("nat-pmp", "Cannot request public IP from a NULL gateway!\n"); - /* If we get a NULL gateway, don't try again next time */ - pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; - return NULL; - } - - /* Default port for NAT-PMP is 5351 */ - if (gateway->sin_port != PMP_PORT) - gateway->sin_port = htons(PMP_PORT); - - req_timeout.tv_sec = 0; - req_timeout.tv_usec = PMP_TIMEOUT; - - sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - - /* Clean out both req and resp structures */ - memset(&req, 0, sizeof(PurplePmpIpRequest)); - memset(&resp, 0, sizeof(PurplePmpIpResponse)); - req.version = 0; - req.opcode = 0; - - /* The NAT-PMP spec says we should attempt to contact the gateway 9 times, doubling the time we wait each time. - * Even starting with a timeout of 0.1 seconds, that means that we have a total waiting of 204.6 seconds. - * With the recommended timeout of 0.25 seconds, we're talking 511.5 seconds (8.5 minutes). - * - * This seems really silly... if this were nonblocking, a couple retries might be in order, but it's not at present. - */ -#ifdef PMP_DEBUG - purple_debug_info("nat-pmp", "Attempting to retrieve the public ip address for the NAT device at: %s\n", inet_ntoa(gateway->sin_addr)); - purple_debug_info("nat-pmp", "\tTimeout: %ds %dus\n", req_timeout.tv_sec, req_timeout.tv_usec); -#endif - - /* TODO: Non-blocking! */ - - if (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) < 0) - { - purple_debug_info("nat-pmp", "There was an error sending the NAT-PMP public IP request! (%s)\n", g_strerror(errno)); - g_free(gateway); - pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; - return NULL; - } - - if (setsockopt(sendfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) < 0) - { - purple_debug_info("nat-pmp", "There was an error setting the socket's options! (%s)\n", g_strerror(errno)); - g_free(gateway); - pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; - return NULL; - } - - /* TODO: Non-blocking! */ - len = sizeof(struct sockaddr_in); - if (recvfrom(sendfd, &resp, sizeof(PurplePmpIpResponse), 0, (struct sockaddr *)(&addr), &len) < 0) - { - if (errno != EAGAIN) - { - purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", g_strerror(errno)); - g_free(gateway); - pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; - return NULL; - } - } - - if (addr.sin_addr.s_addr == gateway->sin_addr.s_addr) - publicsockaddr = &addr; - else - { - purple_debug_info("nat-pmp", "Response was not received from our gateway! Instead from: %s\n", inet_ntoa(addr.sin_addr)); - g_free(gateway); - - pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; - return NULL; - } - - if (!publicsockaddr) { - g_free(gateway); - - pmp_info.status = PURPLE_PMP_STATUS_UNABLE_TO_DISCOVER; - return NULL; - } - -#ifdef PMP_DEBUG - purple_debug_info("nat-pmp", "Response received from NAT-PMP device:\n"); - purple_debug_info("nat-pmp", "version: %d\n", resp.version); - purple_debug_info("nat-pmp", "opcode: %d\n", resp.opcode); - purple_debug_info("nat-pmp", "resultcode: %d\n", ntohs(resp.resultcode)); - purple_debug_info("nat-pmp", "epoch: %d\n", ntohl(resp.epoch)); - struct in_addr in; - in.s_addr = resp.address; - purple_debug_info("nat-pmp", "address: %s\n", inet_ntoa(in)); -#endif - - publicsockaddr->sin_addr.s_addr = resp.address; - - g_free(gateway); - - g_free(pmp_info.publicip); - pmp_info.publicip = g_strdup(inet_ntoa(publicsockaddr->sin_addr)); - pmp_info.status = PURPLE_PMP_STATUS_DISCOVERED; - - return inet_ntoa(publicsockaddr->sin_addr); -} - -gboolean -purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime) -{ - struct sockaddr_in *gateway; - gboolean success = TRUE; - int sendfd; - struct timeval req_timeout; - PurplePmpMapRequest req; - PurplePmpMapResponse *resp; - - gateway = default_gw(); - - if (!gateway) - { - purple_debug_info("nat-pmp", "Cannot create mapping on a NULL gateway!\n"); - return FALSE; - } - - /* Default port for NAT-PMP is 5351 */ - if (gateway->sin_port != PMP_PORT) - gateway->sin_port = htons(PMP_PORT); - - resp = g_new0(PurplePmpMapResponse, 1); - - req_timeout.tv_sec = 0; - req_timeout.tv_usec = PMP_TIMEOUT; - - sendfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - - /* Set up the req */ - memset(&req, 0, sizeof(PurplePmpMapRequest)); - req.version = 0; - req.opcode = ((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP); - req.privateport = htons(privateport); /* What a difference byte ordering makes...d'oh! */ - req.publicport = htons(publicport); - req.lifetime = htonl(lifetime); - - /* The NAT-PMP spec says we should attempt to contact the gateway 9 times, doubling the time we wait each time. - * Even starting with a timeout of 0.1 seconds, that means that we have a total waiting of 204.6 seconds. - * With the recommended timeout of 0.25 seconds, we're talking 511.5 seconds (8.5 minutes). - * - * This seems really silly... if this were nonblocking, a couple retries might be in order, but it's not at present. - * XXX Make this nonblocking. - * XXX This code looks like the pmp_get_public_ip() code. Can it be consolidated? - */ -#ifdef PMP_DEBUG - purple_debug_info("nat-pmp", "Attempting to create a NAT-PMP mapping the private port %d, and the public port %d\n", privateport, publicport); - purple_debug_info("nat-pmp", "\tTimeout: %ds %dus\n", req_timeout.tv_sec, req_timeout.tv_usec); -#endif - - /* TODO: Non-blocking! */ - success = (sendto(sendfd, &req, sizeof(req), 0, (struct sockaddr *)(gateway), sizeof(struct sockaddr)) >= 0); - if (!success) - purple_debug_info("nat-pmp", "There was an error sending the NAT-PMP mapping request! (%s)\n", g_strerror(errno)); - - if (success) - { - success = (setsockopt(sendfd, SOL_SOCKET, SO_RCVTIMEO, &req_timeout, sizeof(req_timeout)) >= 0); - if (!success) - purple_debug_info("nat-pmp", "There was an error setting the socket's options! (%s)\n", g_strerror(errno)); - } - - if (success) - { - /* The original code treats EAGAIN as a reason to iterate.. but I've removed iteration. This may be a problem */ - /* TODO: Non-blocking! */ - success = ((recvfrom(sendfd, resp, sizeof(PurplePmpMapResponse), 0, NULL, NULL) >= 0) || - (errno == EAGAIN)); - if (!success) - purple_debug_info("nat-pmp", "There was an error receiving the response from the NAT-PMP device! (%s)\n", g_strerror(errno)); - } - - if (success) - { - success = (resp->opcode == (req.opcode + 128)); - if (!success) - purple_debug_info("nat-pmp", "The opcode for the response from the NAT device (%i) does not match the request opcode (%i + 128 = %i)!\n", - resp->opcode, req.opcode, req.opcode + 128); - } - -#ifdef PMP_DEBUG - if (success) - { - purple_debug_info("nat-pmp", "Response received from NAT-PMP device:\n"); - purple_debug_info("nat-pmp", "version: %d\n", resp->version); - purple_debug_info("nat-pmp", "opcode: %d\n", resp->opcode); - purple_debug_info("nat-pmp", "resultcode: %d\n", ntohs(resp->resultcode)); - purple_debug_info("nat-pmp", "epoch: %d\n", ntohl(resp->epoch)); - purple_debug_info("nat-pmp", "privateport: %d\n", ntohs(resp->privateport)); - purple_debug_info("nat-pmp", "publicport: %d\n", ntohs(resp->publicport)); - purple_debug_info("nat-pmp", "lifetime: %d\n", ntohl(resp->lifetime)); - } -#endif - - g_free(resp); - g_free(gateway); - - /* XXX The private port may actually differ from the one we requested, according to the spec. - * We don't handle that situation at present. - * - * TODO: Look at the result and verify it matches what we wanted; either return a failure if it doesn't, - * or change network.c to know what to do if the desired private port shifts as a result of the nat-pmp operation. - */ - return success; -} - -gboolean -purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport) -{ - gboolean success; - - success = purple_pmp_create_map(((type == PURPLE_PMP_TYPE_UDP) ? PMP_MAP_OPCODE_UDP : PMP_MAP_OPCODE_TCP), - privateport, 0, 0); - if (!success) - purple_debug_warning("nat-pmp", "Failed to properly destroy mapping for %s port %d!\n", - ((type == PURPLE_PMP_TYPE_UDP) ? "UDP" : "TCP"), privateport); - - return success; -} - -static void -purple_pmp_network_config_changed_cb(void *data) -{ - pmp_info.status = PURPLE_PMP_STATUS_UNDISCOVERED; - g_free(pmp_info.publicip); - pmp_info.publicip = NULL; -} - -static void* -purple_pmp_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_pmp_init() -{ - purple_signal_connect(purple_network_get_handle(), "network-configuration-changed", - purple_pmp_get_handle(), PURPLE_CALLBACK(purple_pmp_network_config_changed_cb), - GINT_TO_POINTER(0)); -} -#else /* #ifdef NET_RT_DUMP */ -char * -purple_pmp_get_public_ip() -{ - return NULL; -} - -gboolean -purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime) -{ - return FALSE; -} - -gboolean -purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport) -{ - return FALSE; -} - -void -purple_pmp_init() -{ - -} -#endif /* #if !(defined(HAVE_SYS_SYCTL_H) && defined(NET_RT_DUMP)) */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/nat-pmp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/** - * @file nat-pmp.h NAT-PMP Implementation - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Most code in nat-pmp.h copyright (C) 2007, R. Tyler Ballance, bleep, LLC. - * This file is distributed under the 3-clause (modified) BSD license: - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of conditions and - * the following disclaimer. - * Neither the name of the bleep. LLC nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - */ - -#ifndef _PURPLE_NAT_PMP_H -#define _PURPLE_NAT_PMP_H - -#include - -#define PURPLE_PMP_LIFETIME 3600 /* 3600 seconds */ - -typedef enum { - PURPLE_PMP_TYPE_UDP, - PURPLE_PMP_TYPE_TCP -} PurplePmpType; - -/** - * Initialize nat-pmp - */ -void purple_pmp_init(void); - -/** - * - */ -char *purple_pmp_get_public_ip(void); - -/** - * Remove the NAT-PMP mapping for a specified type on a specified port - * - * @param type The PurplePmpType - * @param privateport The private port on which we are listening locally - * @param publicport The public port on which we are expecting a response - * @param lifetime The lifetime of the mapping. It is recommended that this be PURPLE_PMP_LIFETIME. - * - * @returns TRUE if succesful; FALSE if unsuccessful - */ -gboolean purple_pmp_create_map(PurplePmpType type, unsigned short privateport, unsigned short publicport, int lifetime); - -/** - * Remove the NAT-PMP mapping for a specified type on a specified port - * - * @param type The PurplePmpType - * @param privateport The private port on which the mapping was previously made - * - * @returns TRUE if succesful; FALSE if unsuccessful - */ -gboolean purple_pmp_destroy_map(PurplePmpType type, unsigned short privateport); - -#endif - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1129 +0,0 @@ -/** - * @file network.c Network Implementation - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#else -#include -#endif - -/* Solaris */ -#if defined (__SVR4) && defined (__sun) -#include -#endif - -#include "debug.h" -#include "account.h" -#include "nat-pmp.h" -#include "network.h" -#include "prefs.h" -#include "stun.h" -#include "upnp.h" -#include "dnsquery.h" - -#ifdef USE_IDN -#include -#endif - -/* - * Calling sizeof(struct ifreq) isn't always correct on - * Mac OS X (and maybe others). - */ -#ifdef _SIZEOF_ADDR_IFREQ -# define HX_SIZE_OF_IFREQ(a) _SIZEOF_ADDR_IFREQ(a) -#else -# define HX_SIZE_OF_IFREQ(a) sizeof(a) -#endif - -#ifdef HAVE_NETWORKMANAGER -#include -#include - -static DBusGConnection *nm_conn = NULL; -static DBusGProxy *nm_proxy = NULL; -static DBusGProxy *dbus_proxy = NULL; -static NMState nm_state = NM_STATE_UNKNOWN; -static gboolean have_nm_state = FALSE; - -#elif defined _WIN32 -static int current_network_count; - -/* Mutex for the other global vars */ -static GStaticMutex mutex = G_STATIC_MUTEX_INIT; -static gboolean network_initialized = FALSE; -static HANDLE network_change_handle = NULL; -static int (WSAAPI *MyWSANSPIoctl) ( - HANDLE hLookup, DWORD dwControlCode, LPVOID lpvInBuffer, - DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, - LPDWORD lpcbBytesReturned, LPWSACOMPLETION lpCompletion) = NULL; -#endif - -struct _PurpleNetworkListenData { - int listenfd; - int socket_type; - gboolean retry; - gboolean adding; - PurpleNetworkListenCallback cb; - gpointer cb_data; - UPnPMappingAddRemove *mapping_data; -}; - -#ifdef HAVE_NETWORKMANAGER -static NMState nm_get_network_state(void); -#endif - -#if defined(HAVE_NETWORKMANAGER) || defined(_WIN32) -static gboolean force_online; -#endif - -/* Cached IP addresses for STUN and TURN servers (set globally in prefs) */ -static gchar *stun_ip = NULL; -static gchar *turn_ip = NULL; - -/* Keep track of port mappings done with UPnP and NAT-PMP */ -static GHashTable *upnp_port_mappings = NULL; -static GHashTable *nat_pmp_port_mappings = NULL; - -const unsigned char * -purple_network_ip_atoi(const char *ip) -{ - static unsigned char ret[4]; - gchar *delimiter = "."; - gchar **split; - int i; - - g_return_val_if_fail(ip != NULL, NULL); - - split = g_strsplit(ip, delimiter, 4); - for (i = 0; split[i] != NULL; i++) - ret[i] = atoi(split[i]); - g_strfreev(split); - - /* i should always be 4 */ - if (i != 4) - return NULL; - - return ret; -} - -void -purple_network_set_public_ip(const char *ip) -{ - g_return_if_fail(ip != NULL); - - /* XXX - Ensure the IP address is valid */ - - purple_prefs_set_string("/purple/network/public_ip", ip); -} - -const char * -purple_network_get_public_ip(void) -{ - return purple_prefs_get_string("/purple/network/public_ip"); -} - -const char * -purple_network_get_local_system_ip(int fd) -{ - char buffer[1024]; - static char ip[16]; - char *tmp; - struct ifconf ifc; - struct ifreq *ifr; - struct sockaddr_in *sinptr; - guint32 lhost = htonl(127 * 256 * 256 * 256 + 1); - long unsigned int add; - int source = fd; - - if (fd < 0) - source = socket(PF_INET,SOCK_STREAM, 0); - - ifc.ifc_len = sizeof(buffer); - ifc.ifc_req = (struct ifreq *)buffer; - ioctl(source, SIOCGIFCONF, &ifc); - - if (fd < 0) - close(source); - - tmp = buffer; - while (tmp < buffer + ifc.ifc_len) - { - ifr = (struct ifreq *)tmp; - tmp += HX_SIZE_OF_IFREQ(*ifr); - - if (ifr->ifr_addr.sa_family == AF_INET) - { - sinptr = (struct sockaddr_in *)&ifr->ifr_addr; - if (sinptr->sin_addr.s_addr != lhost) - { - add = ntohl(sinptr->sin_addr.s_addr); - g_snprintf(ip, 16, "%lu.%lu.%lu.%lu", - ((add >> 24) & 255), - ((add >> 16) & 255), - ((add >> 8) & 255), - add & 255); - - return ip; - } - } - } - - return "0.0.0.0"; -} - -const char * -purple_network_get_my_ip(int fd) -{ - const char *ip = NULL; - PurpleStunNatDiscovery *stun; - - /* Check if the user specified an IP manually */ - if (!purple_prefs_get_bool("/purple/network/auto_ip")) { - ip = purple_network_get_public_ip(); - /* Make sure the IP address entered by the user is valid */ - if ((ip != NULL) && (purple_network_ip_atoi(ip) != NULL)) - return ip; - } else { - /* Check if STUN discovery was already done */ - stun = purple_stun_discover(NULL); - if ((stun != NULL) && (stun->status == PURPLE_STUN_STATUS_DISCOVERED)) - return stun->publicip; - - /* Attempt to get the IP from a NAT device using UPnP */ - ip = purple_upnp_get_public_ip(); - if (ip != NULL) - return ip; - - /* Attempt to get the IP from a NAT device using NAT-PMP */ - ip = purple_pmp_get_public_ip(); - if (ip != NULL) - return ip; - } - - /* Just fetch the IP of the local system */ - return purple_network_get_local_system_ip(fd); -} - - -static void -purple_network_set_upnp_port_mapping_cb(gboolean success, gpointer data) -{ - PurpleNetworkListenData *listen_data; - - listen_data = data; - /* TODO: Once we're keeping track of upnp requests... */ - /* listen_data->pnp_data = NULL; */ - - if (!success) { - purple_debug_warning("network", "Couldn't create UPnP mapping\n"); - if (listen_data->retry) { - listen_data->retry = FALSE; - listen_data->adding = FALSE; - listen_data->mapping_data = purple_upnp_remove_port_mapping( - purple_network_get_port_from_fd(listen_data->listenfd), - (listen_data->socket_type == SOCK_STREAM) ? "TCP" : "UDP", - purple_network_set_upnp_port_mapping_cb, listen_data); - return; - } - } else if (!listen_data->adding) { - /* We've tried successfully to remove the port mapping. - * Try to add it again */ - listen_data->adding = TRUE; - listen_data->mapping_data = purple_upnp_set_port_mapping( - purple_network_get_port_from_fd(listen_data->listenfd), - (listen_data->socket_type == SOCK_STREAM) ? "TCP" : "UDP", - purple_network_set_upnp_port_mapping_cb, listen_data); - return; - } - - if (success) { - /* add port mapping to hash table */ - gint *key = g_new(gint, 1); - gint *value = g_new(gint, 1); - *key = purple_network_get_port_from_fd(listen_data->listenfd); - *value = listen_data->socket_type; - g_hash_table_insert(upnp_port_mappings, key, value); - } - - if (listen_data->cb) - listen_data->cb(listen_data->listenfd, listen_data->cb_data); - - /* Clear the UPnP mapping data, since it's complete and purple_netweork_listen_cancel() will try to cancel - * it otherwise. */ - listen_data->mapping_data = NULL; - purple_network_listen_cancel(listen_data); -} - -static gboolean -purple_network_finish_pmp_map_cb(gpointer data) -{ - PurpleNetworkListenData *listen_data; - gint *key = g_new(gint, 1); - gint *value = g_new(gint, 1); - - listen_data = data; - - /* add port mapping to hash table */ - *key = purple_network_get_port_from_fd(listen_data->listenfd); - *value = listen_data->socket_type; - g_hash_table_insert(nat_pmp_port_mappings, key, value); - - if (listen_data->cb) - listen_data->cb(listen_data->listenfd, listen_data->cb_data); - - purple_network_listen_cancel(listen_data); - - return FALSE; -} - -static gboolean listen_map_external = TRUE; -void purple_network_listen_map_external(gboolean map_external) -{ - listen_map_external = map_external; -} - -static PurpleNetworkListenData * -purple_network_do_listen(unsigned short port, int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) -{ - int listenfd = -1; - int flags; - const int on = 1; - PurpleNetworkListenData *listen_data; - unsigned short actual_port; -#ifdef HAVE_GETADDRINFO - int errnum; - struct addrinfo hints, *res, *next; - char serv[6]; - - /* - * Get a list of addresses on this machine. - */ - g_snprintf(serv, sizeof(serv), "%hu", port); - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = socket_type; - errnum = getaddrinfo(NULL /* any IP */, serv, &hints, &res); - if (errnum != 0) { -#ifndef _WIN32 - purple_debug_warning("network", "getaddrinfo: %s\n", purple_gai_strerror(errnum)); - if (errnum == EAI_SYSTEM) - purple_debug_warning("network", "getaddrinfo: system error: %s\n", g_strerror(errno)); -#else - purple_debug_warning("network", "getaddrinfo: Error Code = %d\n", errnum); -#endif - return NULL; - } - - /* - * Go through the list of addresses and attempt to listen on - * one of them. - * XXX - Try IPv6 addresses first? - */ - for (next = res; next != NULL; next = next->ai_next) { - listenfd = socket(next->ai_family, next->ai_socktype, next->ai_protocol); - if (listenfd < 0) - continue; - if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) - purple_debug_warning("network", "setsockopt: %s\n", g_strerror(errno)); - if (bind(listenfd, next->ai_addr, next->ai_addrlen) == 0) - break; /* success */ - /* XXX - It is unclear to me (datallah) whether we need to be - using a new socket each time */ - close(listenfd); - } - - freeaddrinfo(res); - - if (next == NULL) - return NULL; -#else - struct sockaddr_in sockin; - - if ((listenfd = socket(AF_INET, socket_type, 0)) < 0) { - purple_debug_warning("network", "socket: %s\n", g_strerror(errno)); - return NULL; - } - - if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) - purple_debug_warning("network", "setsockopt: %s\n", g_strerror(errno)); - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = PF_INET; - sockin.sin_port = htons(port); - - if (bind(listenfd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) { - purple_debug_warning("network", "bind: %s\n", g_strerror(errno)); - close(listenfd); - return NULL; - } -#endif - - if (socket_type == SOCK_STREAM && listen(listenfd, 4) != 0) { - purple_debug_warning("network", "listen: %s\n", g_strerror(errno)); - close(listenfd); - return NULL; - } - flags = fcntl(listenfd, F_GETFL); - fcntl(listenfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(listenfd, F_SETFD, FD_CLOEXEC); -#endif - actual_port = purple_network_get_port_from_fd(listenfd); - - purple_debug_info("network", "Listening on port: %hu\n", actual_port); - - listen_data = g_new0(PurpleNetworkListenData, 1); - listen_data->listenfd = listenfd; - listen_data->adding = TRUE; - listen_data->retry = TRUE; - listen_data->cb = cb; - listen_data->cb_data = cb_data; - listen_data->socket_type = socket_type; - - if (!listen_map_external || !purple_prefs_get_bool("/purple/network/map_ports")) - { - purple_debug_info("network", "Skipping external port mapping.\n"); - /* The pmp_map_cb does what we want to do */ - purple_timeout_add(0, purple_network_finish_pmp_map_cb, listen_data); - } - /* Attempt a NAT-PMP Mapping, which will return immediately */ - else if (purple_pmp_create_map(((socket_type == SOCK_STREAM) ? PURPLE_PMP_TYPE_TCP : PURPLE_PMP_TYPE_UDP), - actual_port, actual_port, PURPLE_PMP_LIFETIME)) - { - purple_debug_info("network", "Created NAT-PMP mapping on port %i\n", actual_port); - /* We want to return listen_data now, and on the next run loop trigger the cb and destroy listen_data */ - purple_timeout_add(0, purple_network_finish_pmp_map_cb, listen_data); - } - else - { - /* Attempt a UPnP Mapping */ - listen_data->mapping_data = purple_upnp_set_port_mapping( - actual_port, - (socket_type == SOCK_STREAM) ? "TCP" : "UDP", - purple_network_set_upnp_port_mapping_cb, listen_data); - } - - return listen_data; -} - -PurpleNetworkListenData * -purple_network_listen(unsigned short port, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data) -{ - g_return_val_if_fail(port != 0, NULL); - - return purple_network_do_listen(port, socket_type, cb, cb_data); -} - -PurpleNetworkListenData * -purple_network_listen_range(unsigned short start, unsigned short end, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data) -{ - PurpleNetworkListenData *ret = NULL; - - if (purple_prefs_get_bool("/purple/network/ports_range_use")) { - start = purple_prefs_get_int("/purple/network/ports_range_start"); - end = purple_prefs_get_int("/purple/network/ports_range_end"); - } else { - if (end < start) - end = start; - } - - for (; start <= end; start++) { - ret = purple_network_do_listen(start, socket_type, cb, cb_data); - if (ret != NULL) - break; - } - - return ret; -} - -void purple_network_listen_cancel(PurpleNetworkListenData *listen_data) -{ - if (listen_data->mapping_data != NULL) - purple_upnp_cancel_port_mapping(listen_data->mapping_data); - - g_free(listen_data); -} - -unsigned short -purple_network_get_port_from_fd(int fd) -{ - struct sockaddr_in addr; - socklen_t len; - - g_return_val_if_fail(fd >= 0, 0); - - len = sizeof(addr); - if (getsockname(fd, (struct sockaddr *) &addr, &len) == -1) { - purple_debug_warning("network", "getsockname: %s\n", g_strerror(errno)); - return 0; - } - - return ntohs(addr.sin_port); -} - -#ifdef _WIN32 -#ifndef NS_NLA -#define NS_NLA 15 -#endif -static gint -wpurple_get_connected_network_count(void) -{ - gint net_cnt = 0; - - WSAQUERYSET qs; - HANDLE h; - gint retval; - int errorid; - - memset(&qs, 0, sizeof(WSAQUERYSET)); - qs.dwSize = sizeof(WSAQUERYSET); - qs.dwNameSpace = NS_NLA; - - retval = WSALookupServiceBegin(&qs, LUP_RETURN_ALL, &h); - if (retval != ERROR_SUCCESS) { - gchar *msg; - errorid = WSAGetLastError(); - msg = g_win32_error_message(errorid); - purple_debug_warning("network", "Couldn't retrieve NLA SP lookup handle. " - "NLA service is probably not running. Message: %s (%d).\n", - msg, errorid); - g_free(msg); - - return -1; - } else { - char buf[4096]; - WSAQUERYSET *res = (LPWSAQUERYSET) buf; - DWORD size = sizeof(buf); - while ((retval = WSALookupServiceNext(h, 0, &size, res)) == ERROR_SUCCESS) { - net_cnt++; - purple_debug_info("network", "found network '%s'\n", - res->lpszServiceInstanceName ? res->lpszServiceInstanceName : "(NULL)"); - size = sizeof(buf); - } - - errorid = WSAGetLastError(); - if (!(errorid == WSA_E_NO_MORE || errorid == WSAENOMORE)) { - gchar *msg = g_win32_error_message(errorid); - purple_debug_error("network", "got unexpected NLA response %s (%d)\n", msg, errorid); - g_free(msg); - - net_cnt = -1; - } - - retval = WSALookupServiceEnd(h); - } - - return net_cnt; - -} - -static gboolean wpurple_network_change_thread_cb(gpointer data) -{ - gint new_count; - PurpleConnectionUiOps *ui_ops = purple_connections_get_ui_ops(); - - new_count = wpurple_get_connected_network_count(); - - if (new_count < 0) - return FALSE; - - purple_debug_info("network", "Received Network Change Notification. Current network count is %d, previous count was %d.\n", new_count, current_network_count); - - purple_signal_emit(purple_network_get_handle(), "network-configuration-changed", NULL); - - if (new_count > 0 && ui_ops != NULL && ui_ops->network_connected != NULL) { - ui_ops->network_connected(); - } else if (new_count == 0 && current_network_count > 0 && - ui_ops != NULL && ui_ops->network_disconnected != NULL) { - ui_ops->network_disconnected(); - } - - current_network_count = new_count; - - return FALSE; -} - -static gboolean _print_debug_msg(gpointer data) { - gchar *msg = data; - purple_debug_warning("network", msg); - g_free(msg); - return FALSE; -} - -static gpointer wpurple_network_change_thread(gpointer data) -{ - WSAQUERYSET qs; - WSAEVENT *nla_event; - time_t last_trigger = time(NULL) - 31; - char buf[4096]; - WSAQUERYSET *res = (LPWSAQUERYSET) buf; - DWORD size; - - if ((nla_event = WSACreateEvent()) == WSA_INVALID_EVENT) { - int errorid = WSAGetLastError(); - gchar *msg = g_win32_error_message(errorid); - purple_timeout_add(0, _print_debug_msg, - g_strdup_printf("Couldn't create WSA event. " - "Message: %s (%d).\n", msg, errorid)); - g_free(msg); - g_thread_exit(NULL); - return NULL; - } - - while (TRUE) { - int retval; - DWORD retLen = 0; - WSACOMPLETION completion; - WSAOVERLAPPED overlapped; - - g_static_mutex_lock(&mutex); - if (network_initialized == FALSE) { - /* purple_network_uninit has been called */ - WSACloseEvent(nla_event); - g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); - return NULL; - } - - if (network_change_handle == NULL) { - memset(&qs, 0, sizeof(WSAQUERYSET)); - qs.dwSize = sizeof(WSAQUERYSET); - qs.dwNameSpace = NS_NLA; - if (WSALookupServiceBegin(&qs, 0, &network_change_handle) == SOCKET_ERROR) { - int errorid = WSAGetLastError(); - gchar *msg = g_win32_error_message(errorid); - purple_timeout_add(0, _print_debug_msg, - g_strdup_printf("Couldn't retrieve NLA SP lookup handle. " - "NLA service is probably not running. Message: %s (%d).\n", - msg, errorid)); - g_free(msg); - WSACloseEvent(nla_event); - g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); - return NULL; - } - } - g_static_mutex_unlock(&mutex); - - memset(&completion, 0, sizeof(WSACOMPLETION)); - completion.Type = NSP_NOTIFY_EVENT; - overlapped.hEvent = nla_event; - completion.Parameters.Event.lpOverlapped = &overlapped; - - if (MyWSANSPIoctl(network_change_handle, SIO_NSP_NOTIFY_CHANGE, NULL, 0, NULL, 0, &retLen, &completion) == SOCKET_ERROR) { - int errorid = WSAGetLastError(); - if (errorid == WSA_INVALID_HANDLE) { - purple_timeout_add(0, _print_debug_msg, - g_strdup("Invalid NLA handle; resetting.\n")); - g_static_mutex_lock(&mutex); - retval = WSALookupServiceEnd(network_change_handle); - network_change_handle = NULL; - g_static_mutex_unlock(&mutex); - continue; - /* WSA_IO_PENDING indicates successful async notification will happen */ - } else if (errorid != WSA_IO_PENDING) { - gchar *msg = g_win32_error_message(errorid); - purple_timeout_add(0, _print_debug_msg, - g_strdup_printf("Unable to wait for changes. Message: %s (%d).\n", - msg, errorid)); - g_free(msg); - } - } - - /* Make sure at least 30 seconds have elapsed since the last - * notification so we don't peg the cpu if this keeps changing. */ - if ((time(NULL) - last_trigger) < 30) - Sleep(30000); - - /* This will block until NLA notifies us */ - retval = WaitForSingleObjectEx(nla_event, WSA_INFINITE, TRUE); - - last_trigger = time(NULL); - - g_static_mutex_lock(&mutex); - if (network_initialized == FALSE) { - /* Time to die */ - WSACloseEvent(nla_event); - g_static_mutex_unlock(&mutex); - g_thread_exit(NULL); - return NULL; - } - - size = sizeof(buf); - while ((retval = WSALookupServiceNext(network_change_handle, 0, &size, res)) == ERROR_SUCCESS) { - /*purple_timeout_add(0, _print_debug_msg, - g_strdup_printf("thread found network '%s'\n", - res->lpszServiceInstanceName ? res->lpszServiceInstanceName : "(NULL)"));*/ - size = sizeof(buf); - } - - WSAResetEvent(nla_event); - g_static_mutex_unlock(&mutex); - - purple_timeout_add(0, wpurple_network_change_thread_cb, NULL); - } - - g_thread_exit(NULL); - return NULL; -} -#endif - -gboolean -purple_network_is_available(void) -{ -#ifdef HAVE_NETWORKMANAGER - if (force_online) - return TRUE; - - if (!have_nm_state) - { - have_nm_state = TRUE; - nm_state = nm_get_network_state(); - if (nm_state == NM_STATE_UNKNOWN) - purple_debug_warning("network", "NetworkManager not active. Assuming connection exists.\n"); - } - - if (nm_state == NM_STATE_UNKNOWN || nm_state == NM_STATE_CONNECTED) - return TRUE; - - return FALSE; - -#elif defined _WIN32 - return (current_network_count > 0 || force_online); -#else - return TRUE; -#endif -} - -void -purple_network_force_online() -{ -#if defined(HAVE_NETWORKMANAGER) || defined(_WIN32) - force_online = TRUE; -#endif -} - -#ifdef HAVE_NETWORKMANAGER -static void -nm_update_state(NMState state) -{ - NMState prev = nm_state; - PurpleConnectionUiOps *ui_ops = purple_connections_get_ui_ops(); - - have_nm_state = TRUE; - nm_state = state; - - purple_signal_emit(purple_network_get_handle(), "network-configuration-changed", NULL); - - switch(state) - { - case NM_STATE_CONNECTED: - /* Call res_init in case DNS servers have changed */ - res_init(); - /* update STUN IP in case we it changed (theoretically we could - have gone from IPv4 to IPv6, f.ex. or we were previously - offline */ - purple_network_set_stun_server( - purple_prefs_get_string("/purple/network/stun_server")); - purple_network_set_turn_server( - purple_prefs_get_string("/purple/network/turn_server")); - - if (ui_ops != NULL && ui_ops->network_connected != NULL) - ui_ops->network_connected(); - break; - case NM_STATE_ASLEEP: - case NM_STATE_CONNECTING: - case NM_STATE_DISCONNECTED: - if (prev != NM_STATE_CONNECTED && prev != NM_STATE_UNKNOWN) - break; - if (ui_ops != NULL && ui_ops->network_disconnected != NULL) - ui_ops->network_disconnected(); - break; - case NM_STATE_UNKNOWN: - default: - break; - } -} - -static void -nm_state_change_cb(DBusGProxy *proxy, NMState state, gpointer user_data) -{ - purple_debug_info("network", "Got StateChange from NetworkManager: %d.\n", state); - nm_update_state(state); -} - -static NMState -nm_get_network_state(void) -{ - GError *err = NULL; - NMState state = NM_STATE_UNKNOWN; - - if (!nm_proxy) - return NM_STATE_UNKNOWN; - - if (!dbus_g_proxy_call(nm_proxy, "state", &err, G_TYPE_INVALID, G_TYPE_UINT, &state, G_TYPE_INVALID)) { - g_error_free(err); - return NM_STATE_UNKNOWN; - } - - return state; -} - -static void -nm_dbus_name_owner_changed_cb(DBusGProxy *proxy, char *service, char *old_owner, char *new_owner, gpointer user_data) -{ - if (g_str_equal(service, NM_DBUS_SERVICE)) { - gboolean old_owner_good = old_owner && (old_owner[0] != '\0'); - gboolean new_owner_good = new_owner && (new_owner[0] != '\0'); - - purple_debug_info("network", "Got NameOwnerChanged signal, service = '%s', old_owner = '%s', new_owner = '%s'\n", service, old_owner, new_owner); - if (!old_owner_good && new_owner_good) { /* Equivalent to old ServiceCreated signal */ - purple_debug_info("network", "NetworkManager has started.\n"); - nm_update_state(nm_get_network_state()); - } else if (old_owner_good && !new_owner_good) { /* Equivalent to old ServiceDeleted signal */ - purple_debug_info("network", "NetworkManager has gone away.\n"); - nm_update_state(NM_STATE_UNKNOWN); - } - } -} - -#endif - -static void -purple_network_ip_lookup_cb(GSList *hosts, gpointer data, - const char *error_message) -{ - const gchar **ip = (const gchar **) data; - - if (error_message) { - purple_debug_error("network", "lookup of IP address failed: %s\n", - error_message); - g_slist_free(hosts); - return; - } - - if (hosts && g_slist_next(hosts)) { - struct sockaddr *addr = g_slist_next(hosts)->data; - char dst[INET6_ADDRSTRLEN]; - - if (addr->sa_family == AF_INET6) { - inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, - dst, sizeof(dst)); - } else { - inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, - dst, sizeof(dst)); - } - - *ip = g_strdup(dst); - purple_debug_info("network", "set IP address: %s\n", *ip); - } - - while (hosts != NULL) { - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } -} - -void -purple_network_set_stun_server(const gchar *stun_server) -{ - if (stun_server && stun_server[0] != '\0') { - if (purple_network_is_available()) { - purple_debug_info("network", "running DNS query for STUN server\n"); - purple_dnsquery_a(stun_server, 3478, purple_network_ip_lookup_cb, - &stun_ip); - } else { - purple_debug_info("network", - "network is unavailable, don't try to update STUN IP"); - } - } else if (stun_ip) { - g_free(stun_ip); - stun_ip = NULL; - } -} - -void -purple_network_set_turn_server(const gchar *turn_server) -{ - if (turn_server && turn_server[0] != '\0') { - if (purple_network_is_available()) { - purple_debug_info("network", "running DNS query for TURN server\n"); - purple_dnsquery_a(turn_server, - purple_prefs_get_int("/purple/network/turn_port"), - purple_network_ip_lookup_cb, &turn_ip); - } else { - purple_debug_info("network", - "network is unavailable, don't try to update TURN IP"); - } - } else if (turn_ip) { - g_free(turn_ip); - turn_ip = NULL; - } -} - - -const gchar * -purple_network_get_stun_ip(void) -{ - return stun_ip; -} - -const gchar * -purple_network_get_turn_ip(void) -{ - return turn_ip; -} - -void * -purple_network_get_handle(void) -{ - static int handle; - - return &handle; -} - -static void -purple_network_upnp_mapping_remove_cb(gboolean sucess, gpointer data) -{ - purple_debug_info("network", "done removing UPnP port mapping\n"); -} - -/* the reason for these functions to have these signatures is to be able to - use them for g_hash_table_foreach to clean remaining port mappings, which is - not yet done */ -static void -purple_network_upnp_mapping_remove(gpointer key, gpointer value, - gpointer user_data) -{ - gint port = (gint) *((gint *) key); - gint protocol = (gint) *((gint *) value); - purple_debug_info("network", "removing UPnP port mapping for port %d\n", - port); - purple_upnp_remove_port_mapping(port, - protocol == SOCK_STREAM ? "TCP" : "UDP", - purple_network_upnp_mapping_remove_cb, NULL); - g_hash_table_remove(upnp_port_mappings, key); -} - -static void -purple_network_nat_pmp_mapping_remove(gpointer key, gpointer value, - gpointer user_data) -{ - gint port = (gint) *((gint *) key); - gint protocol = (gint) *((gint *) value); - purple_debug_info("network", "removing NAT-PMP port mapping for port %d\n", - port); - purple_pmp_destroy_map( - protocol == SOCK_STREAM ? PURPLE_PMP_TYPE_TCP : PURPLE_PMP_TYPE_UDP, - port); - g_hash_table_remove(nat_pmp_port_mappings, key); -} - -void -purple_network_remove_port_mapping(gint fd) -{ - int port = purple_network_get_port_from_fd(fd); - gint *protocol = g_hash_table_lookup(upnp_port_mappings, &port); - - if (protocol) { - purple_network_upnp_mapping_remove(&port, protocol, NULL); - g_hash_table_remove(upnp_port_mappings, protocol); - } else { - protocol = g_hash_table_lookup(nat_pmp_port_mappings, &port); - if (protocol) { - purple_network_nat_pmp_mapping_remove(&port, protocol, NULL); - g_hash_table_remove(nat_pmp_port_mappings, protocol); - } - } -} - -int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out) -{ -#ifdef USE_IDN - char *tmp; - int ret; - - g_return_val_if_fail(out != NULL, -1); - - ret = idna_to_ascii_8z(in, &tmp, IDNA_USE_STD3_ASCII_RULES); - if (ret != IDNA_SUCCESS) { - *out = NULL; - return ret; - } - - *out = g_strdup(tmp); - /* This *MUST* be freed with free, not g_free */ - free(tmp); - return 0; -#else - g_return_val_if_fail(out != NULL, -1); - - *out = g_strdup(in); - return 0; -#endif -} - -void -purple_network_init(void) -{ -#ifdef HAVE_NETWORKMANAGER - GError *error = NULL; -#endif -#ifdef _WIN32 - GError *err = NULL; - gint cnt = wpurple_get_connected_network_count(); - - network_initialized = TRUE; - if (cnt < 0) /* Assume there is a network */ - current_network_count = 1; - /* Don't listen for network changes if we can't tell anyway */ - else { - current_network_count = cnt; - if ((MyWSANSPIoctl = (void*) wpurple_find_and_loadproc("ws2_32.dll", "WSANSPIoctl"))) { - if (!g_thread_create(wpurple_network_change_thread, NULL, FALSE, &err)) - purple_debug_error("network", "Couldn't create Network Monitor thread: %s\n", err ? err->message : ""); - } - } -#endif - - purple_prefs_add_none ("/purple/network"); - purple_prefs_add_string("/purple/network/stun_server", ""); - purple_prefs_add_string("/purple/network/turn_server", ""); - purple_prefs_add_int ("/purple/network/turn_port", 3478); - purple_prefs_add_string("/purple/network/turn_username", ""); - purple_prefs_add_string("/purple/network/turn_password", ""); - purple_prefs_add_bool ("/purple/network/auto_ip", TRUE); - purple_prefs_add_string("/purple/network/public_ip", ""); - purple_prefs_add_bool ("/purple/network/map_ports", TRUE); - purple_prefs_add_bool ("/purple/network/ports_range_use", FALSE); - purple_prefs_add_int ("/purple/network/ports_range_start", 1024); - purple_prefs_add_int ("/purple/network/ports_range_end", 2048); - - if(purple_prefs_get_bool("/purple/network/map_ports") || purple_prefs_get_bool("/purple/network/auto_ip")) - purple_upnp_discover(NULL, NULL); - -#ifdef HAVE_NETWORKMANAGER - nm_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error); - if (!nm_conn) { - purple_debug_warning("network", "Error connecting to DBus System service: %s.\n", error->message); - } else { - nm_proxy = dbus_g_proxy_new_for_name(nm_conn, - NM_DBUS_SERVICE, - NM_DBUS_PATH, - NM_DBUS_INTERFACE); - dbus_g_proxy_add_signal(nm_proxy, "StateChange", G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(nm_proxy, "StateChange", - G_CALLBACK(nm_state_change_cb), NULL, NULL); - - dbus_proxy = dbus_g_proxy_new_for_name(nm_conn, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS); - dbus_g_proxy_add_signal(dbus_proxy, "NameOwnerChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(dbus_proxy, "NameOwnerChanged", - G_CALLBACK(nm_dbus_name_owner_changed_cb), NULL, NULL); - } -#endif - - purple_signal_register(purple_network_get_handle(), "network-configuration-changed", - purple_marshal_VOID, NULL, 0); - - purple_pmp_init(); - purple_upnp_init(); - - purple_network_set_stun_server( - purple_prefs_get_string("/purple/network/stun_server")); - purple_network_set_turn_server( - purple_prefs_get_string("/purple/network/turn_server")); - - upnp_port_mappings = - g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); - nat_pmp_port_mappings = - g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); -} - - - -void -purple_network_uninit(void) -{ -#ifdef HAVE_NETWORKMANAGER - if (nm_proxy) { - dbus_g_proxy_disconnect_signal(nm_proxy, "StateChange", G_CALLBACK(nm_state_change_cb), NULL); - g_object_unref(G_OBJECT(nm_proxy)); - } - if (dbus_proxy) { - dbus_g_proxy_disconnect_signal(dbus_proxy, "NameOwnerChanged", G_CALLBACK(nm_dbus_name_owner_changed_cb), NULL); - g_object_unref(G_OBJECT(dbus_proxy)); - } - if (nm_conn) - dbus_g_connection_unref(nm_conn); -#endif - -#ifdef _WIN32 - g_static_mutex_lock(&mutex); - network_initialized = FALSE; - if (network_change_handle != NULL) { - int retval; - /* Trigger the NLA thread to stop waiting for network changes. Not - * doing this can cause hangs on WSACleanup. */ - purple_debug_warning("network", "Terminating the NLA thread\n"); - if ((retval = WSALookupServiceEnd(network_change_handle)) == SOCKET_ERROR) { - int errorid = WSAGetLastError(); - gchar *msg = g_win32_error_message(errorid); - purple_debug_warning("network", "Unable to kill NLA thread. Message: %s (%d).\n", - msg, errorid); - g_free(msg); - } - network_change_handle = NULL; - - } - g_static_mutex_unlock(&mutex); - -#endif - purple_signal_unregister(purple_network_get_handle(), - "network-configuration-changed"); - - if (stun_ip) - g_free(stun_ip); - - g_hash_table_destroy(upnp_port_mappings); - g_hash_table_destroy(nat_pmp_port_mappings); - - /* TODO: clean up remaining port mappings, note calling - purple_upnp_remove_port_mapping from here doesn't quite work... */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/network.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,305 +0,0 @@ -/** - * @file network.h Network API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_NETWORK_H_ -#define _PURPLE_NETWORK_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Network API */ -/**************************************************************************/ -/*@{*/ - -typedef struct _PurpleNetworkListenData PurpleNetworkListenData; - -typedef void (*PurpleNetworkListenCallback) (int listenfd, gpointer data); - -/** - * Converts a dot-decimal IP address to an array of unsigned - * chars. For example, converts 192.168.0.1 to a 4 byte - * array containing 192, 168, 0 and 1. - * - * @param ip An IP address in dot-decimal notiation. - * @return An array of 4 bytes containing an IP addresses - * equivalent to the given parameter, or NULL if - * the given IP address is invalid. This value - * is statically allocated and should not be - * freed. - */ -const unsigned char *purple_network_ip_atoi(const char *ip); - -/** - * Sets the IP address of the local system in preferences. This - * is the IP address that should be used for incoming connections - * (file transfer, direct IM, etc.) and should therefore be - * publicly accessible. - * - * @param ip The local IP address. - */ -void purple_network_set_public_ip(const char *ip); - -/** - * Returns the IP address of the local system set in preferences. - * - * This returns the value set via purple_network_set_public_ip(). - * You probably want to use purple_network_get_my_ip() instead. - * - * @return The local IP address set in preferences. - */ -const char *purple_network_get_public_ip(void); - -/** - * Returns the IP address of the local system. - * - * You probably want to use purple_network_get_my_ip() instead. - * - * @note The returned string is a pointer to a static buffer. If this - * function is called twice, it may be important to make a copy - * of the returned string. - * - * @param fd The fd to use to help figure out the IP, or else -1. - * @return The local IP address. - */ -const char *purple_network_get_local_system_ip(int fd); - -/** - * Returns the IP address that should be used anywhere a - * public IP addresses is needed (listening for an incoming - * file transfer, etc). - * - * If the user has manually specified an IP address via - * preferences, then this IP is returned. Otherwise the - * IP address returned by purple_network_get_local_system_ip() - * is returned. - * - * @note The returned string is a pointer to a static buffer. If this - * function is called twice, it may be important to make a copy - * of the returned string. - * - * @param fd The fd to use to help figure out the IP, or -1. - * @return The local IP address to be used. - */ -const char *purple_network_get_my_ip(int fd); - -/** - * Should calls to purple_network_listen() and purple_network_listen_range() - * map the port externally using NAT-PMP or UPnP? - * The default value is TRUE - * - * @param map_external Should the open port be mapped externally? - * @deprecated In 3.0.0 a boolean will be added to the above functions to - * perform the same function. - * @since 2.3.0 - */ -void purple_network_listen_map_external(gboolean map_external); - -/** - * Attempts to open a listening port ONLY on the specified port number. - * You probably want to use purple_network_listen_range() instead of this. - * This function is useful, for example, if you wanted to write a telnet - * server as a Purple plugin, and you HAD to listen on port 23. Why anyone - * would want to do that is beyond me. - * - * This opens a listening port. The caller will want to set up a watcher - * of type PURPLE_INPUT_READ on the fd returned in cb. It will probably call - * accept in the watcher callback, and then possibly remove the watcher and close - * the listening socket, and add a new watcher on the new socket accept - * returned. - * - * @param port The port number to bind to. Must be greater than 0. - * @param socket_type The type of socket to open for listening. - * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. - * @param cb The callback to be invoked when the port to listen on is available. - * The file descriptor of the listening socket will be specified in - * this callback, or -1 if no socket could be established. - * @param cb_data extra data to be returned when cb is called - * - * @return A pointer to a data structure that can be used to cancel - * the pending listener, or NULL if unable to obtain a local - * socket to listen on. - */ -PurpleNetworkListenData *purple_network_listen(unsigned short port, - int socket_type, PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * Opens a listening port selected from a range of ports. The range of - * ports used is chosen in the following manner: - * If a range is specified in preferences, these values are used. - * If a non-0 values are passed to the function as parameters, these - * values are used. - * Otherwise a port is chosen at random by the operating system. - * - * This opens a listening port. The caller will want to set up a watcher - * of type PURPLE_INPUT_READ on the fd returned in cb. It will probably call - * accept in the watcher callback, and then possibly remove the watcher and close - * the listening socket, and add a new watcher on the new socket accept - * returned. - * - * @param start The port number to bind to, or 0 to pick a random port. - * Users are allowed to override this arg in prefs. - * @param end The highest possible port in the range of ports to listen on, - * or 0 to pick a random port. Users are allowed to override this - * arg in prefs. - * @param socket_type The type of socket to open for listening. - * This will be either SOCK_STREAM for TCP or SOCK_DGRAM for UDP. - * @param cb The callback to be invoked when the port to listen on is available. - * The file descriptor of the listening socket will be specified in - * this callback, or -1 if no socket could be established. - * @param cb_data extra data to be returned when cb is called - * - * @return A pointer to a data structure that can be used to cancel - * the pending listener, or NULL if unable to obtain a local - * socket to listen on. - */ -PurpleNetworkListenData *purple_network_listen_range(unsigned short start, - unsigned short end, int socket_type, - PurpleNetworkListenCallback cb, gpointer cb_data); - -/** - * This can be used to cancel any in-progress listener connection - * by passing in the return value from either purple_network_listen() - * or purple_network_listen_range(). - * - * @param listen_data This listener attempt will be canceled and - * the struct will be freed. - */ -void purple_network_listen_cancel(PurpleNetworkListenData *listen_data); - -/** - * Gets a port number from a file descriptor. - * - * @param fd The file descriptor. This should be a tcp socket. The current - * implementation probably dies on anything but IPv4. Perhaps this - * possible bug will inspire new and valuable contributors to Purple. - * @return The port number, in host byte order. - */ -unsigned short purple_network_get_port_from_fd(int fd); - -/** - * Detects if there is an available network connection. - * - * @return TRUE if the network is available - */ -gboolean purple_network_is_available(void); - -/** - * Makes purple_network_is_available() always return @c TRUE. - * - * This is what backs the --force-online command line argument in Pidgin, - * for example. This is useful for offline testing, especially when - * combined with nullprpl. - * - * @since 2.6.0 - */ -void purple_network_force_online(void); - -/** - * Get the handle for the network system - * - * @return the handle to the network system - */ -void *purple_network_get_handle(void); - -/** - * Update the STUN server IP given the host name - * Will result in a DNS query being executed asynchronous - * - * @param stun_server The host name of the STUN server to set - * @since 2.6.0 - */ -void purple_network_set_stun_server(const gchar *stun_server); - -/** - * Get the IP address of the STUN server as a string representation - * - * @return the IP address - * @since 2.6.0 - */ -const gchar *purple_network_get_stun_ip(void); - -/** - * Update the TURN server IP given the host name - * Will result in a DNS query being executed asynchronous - * - * @param turn_server The host name of the TURN server to set - * @since 2.6.0 - */ -void purple_network_set_turn_server(const gchar *turn_server); - -/** - * Get the IP address of the STUN server as a string representation - * - * @return the IP address - * @since 2.6.0 - */ -const gchar *purple_network_get_turn_ip(void); - -/** - * Remove a port mapping (UPnP or NAT-PMP) associated with listening socket - * - * @param fd Socket to remove the port mapping for - * @since 2.6.0 - */ -void purple_network_remove_port_mapping(gint fd); - -/** - * Convert a UTF-8 domain name to ASCII in accordance with the IDNA - * specification. If libpurple is compiled without IDN support, this function - * copies the input into the output buffer. - * - * Because this function is used by DNS resolver child/threads, it uses no - * other libpurple API and is threadsafe. - * - * In general, a buffer of about 512 bytes is the appropriate size to use. - * - * @param in The hostname to be converted. - * @param out The output buffer where an allocated string will be returned. - * The caller is responsible for freeing this. - * @returns 0 on success, -1 if the out is NULL, or an error code - * that currently corresponds to the Idna_rc enum in libidn. - * @since 2.6.0 - */ -int purple_network_convert_idn_to_ascii(const gchar *in, gchar **out); - -/** - * Initializes the network subsystem. - */ -void purple_network_init(void); - -/** - * Shuts down the network subsystem. - */ -void purple_network_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_NETWORK_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,815 +0,0 @@ -/** - * @file notify.c Notification API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_NOTIFY_C_ - -#include "internal.h" -#include "dbus-maybe.h" -#include "notify.h" - -static PurpleNotifyUiOps *notify_ui_ops = NULL; -static GList *handles = NULL; - -typedef struct -{ - PurpleNotifyType type; - void *handle; - void *ui_handle; - PurpleNotifyCloseCallback cb; - gpointer cb_user_data; -} PurpleNotifyInfo; - -/** - * Definition of a user info entry - */ -struct _PurpleNotifyUserInfoEntry -{ - char *label; - char *value; - PurpleNotifyUserInfoEntryType type; -}; - -struct _PurpleNotifyUserInfo -{ - GList *user_info_entries; -}; - -void * -purple_notify_message(void *handle, PurpleNotifyMsgType type, - const char *title, const char *primary, - const char *secondary, PurpleNotifyCloseCallback cb, gpointer user_data) -{ - PurpleNotifyUiOps *ops; - - g_return_val_if_fail(primary != NULL, NULL); - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_message != NULL) { - void *ui_handle = ops->notify_message(type, title, primary, - secondary); - if (ui_handle != NULL) { - - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_MESSAGE; - info->handle = handle; - info->ui_handle = ui_handle; - info->cb = cb; - info->cb_user_data = user_data; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - } - - if (cb != NULL) - cb(user_data); - - return NULL; -} - -void * -purple_notify_email(void *handle, const char *subject, const char *from, - const char *to, const char *url, PurpleNotifyCloseCallback cb, - gpointer user_data) -{ - PurpleNotifyUiOps *ops; - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_email != NULL) { - void *ui_handle; - - purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification", - subject, from, to, url); - - ui_handle = ops->notify_email(handle, subject, from, to, url); - - if (ui_handle != NULL) { - - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_EMAIL; - info->handle = handle; - info->ui_handle = ui_handle; - info->cb = cb; - info->cb_user_data = user_data; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - } - - if (cb != NULL) - cb(user_data); - - return NULL; -} - -void * -purple_notify_emails(void *handle, size_t count, gboolean detailed, - const char **subjects, const char **froms, - const char **tos, const char **urls, - PurpleNotifyCloseCallback cb, gpointer user_data) -{ - PurpleNotifyUiOps *ops; - - if (count == 1) { - return purple_notify_email(handle, - (subjects == NULL ? NULL : *subjects), - (froms == NULL ? NULL : *froms), - (tos == NULL ? NULL : *tos), - (urls == NULL ? NULL : *urls), - cb, user_data); - } - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_emails != NULL) { - void *ui_handle; - - purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification", - subjects, froms, tos, urls, count); - - ui_handle = ops->notify_emails(handle, count, detailed, subjects, - froms, tos, urls); - - if (ui_handle != NULL) { - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_EMAILS; - info->handle = handle; - info->ui_handle = ui_handle; - info->cb = cb; - info->cb_user_data = user_data; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - } - - if (cb != NULL) - cb(user_data); - - return NULL; -} - -void * -purple_notify_formatted(void *handle, const char *title, const char *primary, - const char *secondary, const char *text, - PurpleNotifyCloseCallback cb, gpointer user_data) -{ - PurpleNotifyUiOps *ops; - - g_return_val_if_fail(primary != NULL, NULL); - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_formatted != NULL) { - void *ui_handle = ops->notify_formatted(title, primary, secondary, text); - - if (ui_handle != NULL) { - - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_FORMATTED; - info->handle = handle; - info->ui_handle = ui_handle; - info->cb = cb; - info->cb_user_data = user_data; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - } - - if (cb != NULL) - cb(user_data); - return NULL; -} - -void * -purple_notify_searchresults(PurpleConnection *gc, const char *title, - const char *primary, const char *secondary, - PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb, - gpointer user_data) -{ - PurpleNotifyUiOps *ops; - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_searchresults != NULL) { - void *ui_handle = ops->notify_searchresults(gc, title, primary, - secondary, results, user_data); - if (ui_handle != NULL) { - - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_SEARCHRESULTS; - info->handle = gc; - info->ui_handle = ui_handle; - info->cb = cb; - info->cb_user_data = user_data; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - } - - if (cb != NULL) - cb(user_data); - - return NULL; -} - -void -purple_notify_searchresults_free(PurpleNotifySearchResults *results) -{ - GList *l; - - g_return_if_fail(results != NULL); - - for (l = results->buttons; l; l = g_list_delete_link(l, l)) { - PurpleNotifySearchButton *button = l->data; - g_free(button->label); - g_free(button); - } - - for (l = results->rows; l; l = g_list_delete_link(l, l)) { - GList *row = l->data; - g_list_foreach(row, (GFunc)g_free, NULL); - g_list_free(row); - } - - for (l = results->columns; l; l = g_list_delete_link(l, l)) { - PurpleNotifySearchColumn *column = l->data; - g_free(column->title); - g_free(column); - } - - g_free(results); -} - -void -purple_notify_searchresults_new_rows(PurpleConnection *gc, - PurpleNotifySearchResults *results, - void *data) -{ - PurpleNotifyUiOps *ops; - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_searchresults != NULL) { - ops->notify_searchresults_new_rows(gc, results, data); - } -} - -void -purple_notify_searchresults_button_add(PurpleNotifySearchResults *results, - PurpleNotifySearchButtonType type, - PurpleNotifySearchResultsCallback cb) -{ - PurpleNotifySearchButton *button; - - g_return_if_fail(results != NULL); - g_return_if_fail(cb != NULL); - - button = g_new0(PurpleNotifySearchButton, 1); - button->callback = cb; - button->type = type; - - results->buttons = g_list_append(results->buttons, button); -} - - -void -purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results, - const char *label, - PurpleNotifySearchResultsCallback cb) { - PurpleNotifySearchButton *button; - - g_return_if_fail(results != NULL); - g_return_if_fail(cb != NULL); - g_return_if_fail(label != NULL); - g_return_if_fail(*label != '\0'); - - button = g_new0(PurpleNotifySearchButton, 1); - button->callback = cb; - button->type = PURPLE_NOTIFY_BUTTON_LABELED; - button->label = g_strdup(label); - - results->buttons = g_list_append(results->buttons, button); -} - - -PurpleNotifySearchResults * -purple_notify_searchresults_new() -{ - PurpleNotifySearchResults *rs = g_new0(PurpleNotifySearchResults, 1); - - return rs; -} - -void -purple_notify_searchresults_column_add(PurpleNotifySearchResults *results, - PurpleNotifySearchColumn *column) -{ - g_return_if_fail(results != NULL); - g_return_if_fail(column != NULL); - - results->columns = g_list_append(results->columns, column); -} - -void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, - GList *row) -{ - g_return_if_fail(results != NULL); - g_return_if_fail(row != NULL); - - results->rows = g_list_append(results->rows, row); -} - -PurpleNotifySearchColumn * -purple_notify_searchresults_column_new(const char *title) -{ - PurpleNotifySearchColumn *sc; - - g_return_val_if_fail(title != NULL, NULL); - - sc = g_new0(PurpleNotifySearchColumn, 1); - sc->title = g_strdup(title); - - return sc; -} - -guint -purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results) -{ - g_return_val_if_fail(results != NULL, 0); - - return g_list_length(results->columns); -} - -guint -purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results) -{ - g_return_val_if_fail(results != NULL, 0); - - return g_list_length(results->rows); -} - -char * -purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, - unsigned int column_id) -{ - g_return_val_if_fail(results != NULL, NULL); - - return ((PurpleNotifySearchColumn *)g_list_nth_data(results->columns, column_id))->title; -} - -GList * -purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, - unsigned int row_id) -{ - g_return_val_if_fail(results != NULL, NULL); - - return g_list_nth_data(results->rows, row_id); -} - -void * -purple_notify_userinfo(PurpleConnection *gc, const char *who, - PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb, gpointer user_data) -{ - PurpleNotifyUiOps *ops; - - g_return_val_if_fail(who != NULL, NULL); - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_userinfo != NULL) { - void *ui_handle; - - purple_signal_emit(purple_notify_get_handle(), "displaying-userinfo", - purple_connection_get_account(gc), who, user_info); - - ui_handle = ops->notify_userinfo(gc, who, user_info); - - if (ui_handle != NULL) { - - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_USERINFO; - info->handle = gc; - info->ui_handle = ui_handle; - info->cb = cb; - info->cb_user_data = user_data; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - } - - if (cb != NULL) - cb(user_data); - - return NULL; -} - -PurpleNotifyUserInfoEntry * -purple_notify_user_info_entry_new(const char *label, const char *value) -{ - PurpleNotifyUserInfoEntry *user_info_entry; - - user_info_entry = g_new0(PurpleNotifyUserInfoEntry, 1); - PURPLE_DBUS_REGISTER_POINTER(user_info_entry, PurpleNotifyUserInfoEntry); - user_info_entry->label = g_strdup(label); - user_info_entry->value = g_strdup(value); - user_info_entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR; - - return user_info_entry; -} - -static void -purple_notify_user_info_entry_destroy(PurpleNotifyUserInfoEntry *user_info_entry) -{ - g_return_if_fail(user_info_entry != NULL); - - g_free(user_info_entry->label); - g_free(user_info_entry->value); - PURPLE_DBUS_UNREGISTER_POINTER(user_info_entry); - g_free(user_info_entry); -} - -PurpleNotifyUserInfo * -purple_notify_user_info_new() -{ - PurpleNotifyUserInfo *user_info; - - user_info = g_new0(PurpleNotifyUserInfo, 1); - PURPLE_DBUS_REGISTER_POINTER(user_info, PurpleNotifyUserInfo); - user_info->user_info_entries = NULL; - - return user_info; -} - -void -purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info) -{ - GList *l; - - for (l = user_info->user_info_entries; l != NULL; l = l->next) { - PurpleNotifyUserInfoEntry *user_info_entry = l->data; - - purple_notify_user_info_entry_destroy(user_info_entry); - } - - g_list_free(user_info->user_info_entries); - PURPLE_DBUS_UNREGISTER_POINTER(user_info); - g_free(user_info); -} - -GList * -purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info) -{ - g_return_val_if_fail(user_info != NULL, NULL); - - return user_info->user_info_entries; -} - -char * -purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline) -{ - GList *l; - GString *text; - - text = g_string_new(""); - - for (l = user_info->user_info_entries; l != NULL; l = l->next) { - PurpleNotifyUserInfoEntry *user_info_entry = l->data; - /* Add a newline before a section header */ - if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) - g_string_append(text, newline); - - /* Handle the label/value pair itself */ - /* XXX Todo: Use a larger size for a section header? */ - if (user_info_entry->label) - g_string_append_printf(text, "%s", user_info_entry->label); - if (user_info_entry->label && user_info_entry->value) - g_string_append(text, ": "); - if (user_info_entry->value) - g_string_append(text, user_info_entry->value); - - /* Display a section break as a horizontal line */ - if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) - g_string_append(text, "
"); - - /* Don't insert a new line before or after a section break;
does that for us */ - if ((user_info_entry->type != PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK) && - (l->next && ((((PurpleNotifyUserInfoEntry *)(l->next->data))->type != PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK)))) - g_string_append(text, newline); - - /* Add an extra newline after a section header */ - if (user_info_entry->type == PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER) - g_string_append(text, newline); - } - - return g_string_free(text, FALSE); -} - - -const gchar * -purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry) -{ - g_return_val_if_fail(user_info_entry != NULL, NULL); - - return user_info_entry->label; -} - -void -purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label) -{ - g_return_if_fail(user_info_entry != NULL); - - g_free(user_info_entry->label); - user_info_entry->label = g_strdup(label); -} - -const gchar * -purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry) -{ - g_return_val_if_fail(user_info_entry != NULL, NULL); - - return user_info_entry->value; -} - -void -purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value) -{ - g_return_if_fail(user_info_entry != NULL); - - g_free(user_info_entry->value); - user_info_entry->value = g_strdup(value); -} - -PurpleNotifyUserInfoEntryType -purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry) -{ - g_return_val_if_fail(user_info_entry != NULL, PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR); - - return user_info_entry->type; -} - -void -purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry, PurpleNotifyUserInfoEntryType type) -{ - g_return_if_fail(user_info_entry != NULL); - - user_info_entry->type = type; -} - -void -purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) -{ - PurpleNotifyUserInfoEntry *entry; - - entry = purple_notify_user_info_entry_new(label, value); - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value) -{ - PurpleNotifyUserInfoEntry *entry; - - entry = purple_notify_user_info_entry_new(label, value); - user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *entry) -{ - g_return_if_fail(user_info != NULL); - g_return_if_fail(entry != NULL); - - user_info->user_info_entries = g_list_remove(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label) -{ - PurpleNotifyUserInfoEntry *entry; - - entry = purple_notify_user_info_entry_new(label, NULL); - entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; - - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label) -{ - PurpleNotifyUserInfoEntry *entry; - - entry = purple_notify_user_info_entry_new(label, NULL); - entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER; - - user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info) -{ - PurpleNotifyUserInfoEntry *entry; - - entry = purple_notify_user_info_entry_new(NULL, NULL); - entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; - - user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info) -{ - PurpleNotifyUserInfoEntry *entry; - - entry = purple_notify_user_info_entry_new(NULL, NULL); - entry->type = PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK; - - user_info->user_info_entries = g_list_prepend(user_info->user_info_entries, entry); -} - -void -purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info) -{ - GList *last = g_list_last(user_info->user_info_entries); - if (last) { - purple_notify_user_info_entry_destroy(last->data); - user_info->user_info_entries = g_list_delete_link(user_info->user_info_entries, last); - } -} - -void * -purple_notify_uri(void *handle, const char *uri) -{ - PurpleNotifyUiOps *ops; - - g_return_val_if_fail(uri != NULL, NULL); - - ops = purple_notify_get_ui_ops(); - - if (ops != NULL && ops->notify_uri != NULL) { - - void *ui_handle = ops->notify_uri(uri); - - if (ui_handle != NULL) { - - PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1); - info->type = PURPLE_NOTIFY_URI; - info->handle = handle; - info->ui_handle = ui_handle; - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - } - - return NULL; -} - -void -purple_notify_close(PurpleNotifyType type, void *ui_handle) -{ - GList *l; - PurpleNotifyUiOps *ops; - - g_return_if_fail(ui_handle != NULL); - - ops = purple_notify_get_ui_ops(); - - for (l = handles; l != NULL; l = l->next) { - PurpleNotifyInfo *info = l->data; - - if (info->ui_handle == ui_handle) { - handles = g_list_remove(handles, info); - - if (ops != NULL && ops->close_notify != NULL) - ops->close_notify(info->type, ui_handle); - - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); - - break; - } - } -} - -void -purple_notify_close_with_handle(void *handle) -{ - GList *l, *prev = NULL; - PurpleNotifyUiOps *ops; - - g_return_if_fail(handle != NULL); - - ops = purple_notify_get_ui_ops(); - - for (l = handles; l != NULL; l = prev ? prev->next : handles) { - PurpleNotifyInfo *info = l->data; - - if (info->handle == handle) { - handles = g_list_remove(handles, info); - - if (ops != NULL && ops->close_notify != NULL) - ops->close_notify(info->type, info->ui_handle); - - if (info->cb != NULL) - info->cb(info->cb_user_data); - - g_free(info); - } else - prev = l; - } -} - -void -purple_notify_set_ui_ops(PurpleNotifyUiOps *ops) -{ - notify_ui_ops = ops; -} - -PurpleNotifyUiOps * -purple_notify_get_ui_ops(void) -{ - return notify_ui_ops; -} - -void * -purple_notify_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_notify_init(void) -{ - gpointer handle = purple_notify_get_handle(); - - purple_signal_register(handle, "displaying-email-notification", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER, NULL, 4, - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_signal_register(handle, "displaying-emails-notification", - purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, NULL, 5, - purple_value_new(PURPLE_TYPE_POINTER), - purple_value_new(PURPLE_TYPE_POINTER), - purple_value_new(PURPLE_TYPE_POINTER), - purple_value_new(PURPLE_TYPE_POINTER), - purple_value_new(PURPLE_TYPE_UINT)); - - purple_signal_register(handle, "displaying-userinfo", - purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_USERINFO)); -} - -void -purple_notify_uninit(void) -{ - purple_signals_unregister_by_instance(purple_notify_get_handle()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/notify.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,799 +0,0 @@ -/** - * @file notify.h Notification API - * @ingroup core - * @see @ref notify-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_NOTIFY_H_ -#define _PURPLE_NOTIFY_H_ - -#include -#include -#include - -typedef struct _PurpleNotifyUserInfoEntry PurpleNotifyUserInfoEntry; -typedef struct _PurpleNotifyUserInfo PurpleNotifyUserInfo; - -#include "connection.h" - -/** - * Notification close callbacks. - */ -typedef void (*PurpleNotifyCloseCallback) (gpointer user_data); - - -/** - * Notification types. - */ -typedef enum -{ - PURPLE_NOTIFY_MESSAGE = 0, /**< Message notification. */ - PURPLE_NOTIFY_EMAIL, /**< Single email notification. */ - PURPLE_NOTIFY_EMAILS, /**< Multiple email notification. */ - PURPLE_NOTIFY_FORMATTED, /**< Formatted text. */ - PURPLE_NOTIFY_SEARCHRESULTS, /**< Buddy search results. */ - PURPLE_NOTIFY_USERINFO, /**< Formatted userinfo text. */ - PURPLE_NOTIFY_URI /**< URI notification or display. */ - -} PurpleNotifyType; - - -/** - * Notification message types. - */ -typedef enum -{ - PURPLE_NOTIFY_MSG_ERROR = 0, /**< Error notification. */ - PURPLE_NOTIFY_MSG_WARNING, /**< Warning notification. */ - PURPLE_NOTIFY_MSG_INFO /**< Information notification. */ - -} PurpleNotifyMsgType; - - -/** - * The types of buttons - */ -typedef enum -{ - PURPLE_NOTIFY_BUTTON_LABELED = 0, /**< special use, see _button_add_labeled */ - PURPLE_NOTIFY_BUTTON_CONTINUE = 1, - PURPLE_NOTIFY_BUTTON_ADD, - PURPLE_NOTIFY_BUTTON_INFO, - PURPLE_NOTIFY_BUTTON_IM, - PURPLE_NOTIFY_BUTTON_JOIN, - PURPLE_NOTIFY_BUTTON_INVITE -} PurpleNotifySearchButtonType; - - -/** - * Search results object. - */ -typedef struct -{ - GList *columns; /**< List of the search column objects. */ - GList *rows; /**< List of rows in the result. */ - GList *buttons; /**< List of buttons to display. */ - -} PurpleNotifySearchResults; - -/** - * Types of PurpleNotifyUserInfoEntry objects - */ -typedef enum -{ - PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR = 0, - PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK, - PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER -} PurpleNotifyUserInfoEntryType; - -/** - * Single column of a search result. - */ -typedef struct -{ - char *title; /**< Title of the column. */ - -} PurpleNotifySearchColumn; - - -/** - * Callback for a button in a search result. - * - * @param c the PurpleConnection passed to purple_notify_searchresults - * @param row the contents of the selected row - * @param user_data User defined data. - */ -typedef void (*PurpleNotifySearchResultsCallback)(PurpleConnection *c, GList *row, - gpointer user_data); - - -/** - * Definition of a button. - */ -typedef struct -{ - PurpleNotifySearchButtonType type; - PurpleNotifySearchResultsCallback callback; /**< Function to be called when clicked. */ - char *label; /**< only for PURPLE_NOTIFY_BUTTON_LABELED */ -} PurpleNotifySearchButton; - - -/** - * Notification UI operations. - */ -typedef struct -{ - void *(*notify_message)(PurpleNotifyMsgType type, const char *title, - const char *primary, const char *secondary); - - void *(*notify_email)(PurpleConnection *gc, - const char *subject, const char *from, - const char *to, const char *url); - - void *(*notify_emails)(PurpleConnection *gc, - size_t count, gboolean detailed, - const char **subjects, const char **froms, - const char **tos, const char **urls); - - void *(*notify_formatted)(const char *title, const char *primary, - const char *secondary, const char *text); - - void *(*notify_searchresults)(PurpleConnection *gc, const char *title, - const char *primary, const char *secondary, - PurpleNotifySearchResults *results, gpointer user_data); - - void (*notify_searchresults_new_rows)(PurpleConnection *gc, - PurpleNotifySearchResults *results, - void *data); - - void *(*notify_userinfo)(PurpleConnection *gc, const char *who, - PurpleNotifyUserInfo *user_info); - - void *(*notify_uri)(const char *uri); - - void (*close_notify)(PurpleNotifyType type, void *ui_handle); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleNotifyUiOps; - - -#ifdef __cplusplus -extern "C" { -#endif - - -/**************************************************************************/ -/** Search results notification API */ -/**************************************************************************/ -/*@{*/ - -/** - * Displays results from a buddy search. This can be, for example, - * a window with a list of all found buddies, where you are given the - * option of adding buddies to your buddy list. - * - * @param gc The PurpleConnection handle associated with the information. - * @param title The title of the message. If this is NULL, the title - * will be "Search Results." - * @param primary The main point of the message. - * @param secondary The secondary information. - * @param results The PurpleNotifySearchResults instance. - * @param cb The callback to call when the user closes - * the notification. - * @param user_data The data to pass to the close callback and any other - * callback associated with a button. - * - * @return A UI-specific handle. - */ -void *purple_notify_searchresults(PurpleConnection *gc, const char *title, - const char *primary, const char *secondary, - PurpleNotifySearchResults *results, PurpleNotifyCloseCallback cb, - gpointer user_data); - -/** - * Frees a PurpleNotifySearchResults object. - * - * @param results The PurpleNotifySearchResults to free. - */ -void purple_notify_searchresults_free(PurpleNotifySearchResults *results); - -/** - * Replace old rows with the new. Reuse an existing window. - * - * @param gc The PurpleConnection structure. - * @param results The PurpleNotifySearchResults structure. - * @param data Data returned by the purple_notify_searchresults(). - */ -void purple_notify_searchresults_new_rows(PurpleConnection *gc, - PurpleNotifySearchResults *results, - void *data); - - -/** - * Adds a stock button that will be displayed in the search results dialog. - * - * @param results The search results object. - * @param type Type of the button. (TODO: Only one button of a given type - * can be displayed.) - * @param cb Function that will be called on the click event. - */ -void purple_notify_searchresults_button_add(PurpleNotifySearchResults *results, - PurpleNotifySearchButtonType type, - PurpleNotifySearchResultsCallback cb); - - -/** - * Adds a plain labelled button that will be displayed in the search results - * dialog. - * - * @param results The search results object - * @param label The label to display - * @param cb Function that will be called on the click event - */ -void purple_notify_searchresults_button_add_labeled(PurpleNotifySearchResults *results, - const char *label, - PurpleNotifySearchResultsCallback cb); - - -/** - * Returns a newly created search results object. - * - * @return The new search results object. - */ -PurpleNotifySearchResults *purple_notify_searchresults_new(void); - -/** - * Returns a newly created search result column object. - * - * @param title Title of the column. NOTE: Title will get g_strdup()ed. - * - * @return The new search column object. - */ -PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title); - -/** - * Adds a new column to the search result object. - * - * @param results The result object to which the column will be added. - * @param column The column that will be added to the result object. - */ -void purple_notify_searchresults_column_add(PurpleNotifySearchResults *results, - PurpleNotifySearchColumn *column); - -/** - * Adds a new row of the results to the search results object. - * - * @param results The search results object. - * @param row The row of the results. - */ -void purple_notify_searchresults_row_add(PurpleNotifySearchResults *results, - GList *row); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a number of the rows in the search results object. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the results - * inefficiently. Instead of using this function you - * should iterate through the results using a loop - * similar to this: - * for (l = results->rows; l != NULL; l = l->next) - * If you really need to get the number of rows you - * can use g_list_length(results->rows). - * - * @param results The search results object. - * - * @return Number of the result rows. - */ -guint purple_notify_searchresults_get_rows_count(PurpleNotifySearchResults *results); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a number of the columns in the search results object. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the columns - * inefficiently. Instead of using this function you - * should iterate through the columns using a loop - * similar to this: - * for (l = results->columns; l != NULL; l = l->next) - * If you really need to get the number of columns you - * can use g_list_length(results->columns). - * - * @param results The search results object. - * - * @return Number of the columns. - */ -guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a row of the results from the search results object. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the results - * inefficiently. Instead of using this function you - * should iterate through the results using a loop - * similar to this: - * for (l = results->rows; l != NULL; l = l->next) - * If you really need to get the data for a particular - * row you can use g_list_nth_data(results->rows, row_id). - * - * @param results The search results object. - * @param row_id Index of the row to be returned. - * - * @return Row of the results. - */ -GList *purple_notify_searchresults_row_get(PurpleNotifySearchResults *results, - unsigned int row_id); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Returns a title of the search results object's column. - * - * @deprecated This function will be removed in Pidgin 3.0.0 unless - * there is sufficient demand to keep it. Using this - * function encourages looping through the columns - * inefficiently. Instead of using this function you - * should iterate through the name of a particular - * column you can use - * g_list_nth_data(results->columns, row_id). - * - * @param results The search results object. - * @param column_id Index of the column. - * - * @return Title of the column. - */ -char *purple_notify_searchresults_column_get_title(PurpleNotifySearchResults *results, - unsigned int column_id); -#endif - -/*@}*/ - -/**************************************************************************/ -/** @name Notification API */ -/**************************************************************************/ -/*@{*/ - -/** - * Displays a notification message to the user. - * - * @param handle The plugin or connection handle. - * @param type The notification type. - * @param title The title of the message. - * @param primary The main point of the message. - * @param secondary The secondary information. - * @param cb The callback to call when the user closes - * the notification. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_notify_message(void *handle, PurpleNotifyMsgType type, - const char *title, const char *primary, - const char *secondary, PurpleNotifyCloseCallback cb, - gpointer user_data); - -/** - * Displays a single email notification to the user. - * - * @param handle The plugin or connection handle. - * @param subject The subject of the email. - * @param from The from address. - * @param to The destination address. - * @param url The URL where the message can be read. - * @param cb The callback to call when the user closes - * the notification. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_notify_email(void *handle, const char *subject, - const char *from, const char *to, - const char *url, PurpleNotifyCloseCallback cb, - gpointer user_data); - -/** - * Displays a notification for multiple emails to the user. - * - * @param handle The plugin or connection handle. - * @param count The number of emails. '0' can be used to signify that - * the user has no unread emails and the UI should remove - * the mail notification. - * @param detailed @c TRUE if there is information for each email in the - * arrays. - * @param subjects The array of subjects. - * @param froms The array of from addresses. - * @param tos The array of destination addresses. - * @param urls The URLs where the messages can be read. - * @param cb The callback to call when the user closes - * the notification. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_notify_emails(void *handle, size_t count, gboolean detailed, - const char **subjects, const char **froms, - const char **tos, const char **urls, - PurpleNotifyCloseCallback cb, gpointer user_data); - -/** - * Displays a notification with formatted text. - * - * The text is essentially a stripped-down format of HTML, the same that - * IMs may send. - * - * @param handle The plugin or connection handle. - * @param title The title of the message. - * @param primary The main point of the message. - * @param secondary The secondary information. - * @param text The formatted text. - * @param cb The callback to call when the user closes - * the notification. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_notify_formatted(void *handle, const char *title, - const char *primary, const char *secondary, - const char *text, PurpleNotifyCloseCallback cb, gpointer user_data); - -/** - * Displays user information with formatted text, passing information giving - * the connection and username from which the user information came. - * - * The text is essentially a stripped-down format of HTML, the same that - * IMs may send. - * - * @param gc The PurpleConnection handle associated with the information. - * @param who The username associated with the information. - * @param user_info The PurpleNotifyUserInfo which contains the information - * @param cb The callback to call when the user closes the notification. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_notify_userinfo(PurpleConnection *gc, const char *who, - PurpleNotifyUserInfo *user_info, PurpleNotifyCloseCallback cb, - gpointer user_data); - -/** - * Create a new PurpleNotifyUserInfo which is suitable for passing to - * purple_notify_userinfo() - * - * @return A new PurpleNotifyUserInfo, which the caller must destroy when done - */ -PurpleNotifyUserInfo *purple_notify_user_info_new(void); - -/** - * Destroy a PurpleNotifyUserInfo - * - * @param user_info The PurpleNotifyUserInfo - */ -void purple_notify_user_info_destroy(PurpleNotifyUserInfo *user_info); - -/** - * Retrieve the array of PurpleNotifyUserInfoEntry objects from a - * PurpleNotifyUserInfo - * - * This GList may be manipulated directly with normal GList functions such - * as g_list_insert(). Only PurpleNotifyUserInfoEntry are allowed in the - * list. If a PurpleNotifyUserInfoEntry item is added to the list, it - * should not be g_free()'d by the caller; PurpleNotifyUserInfo will g_free - * it when destroyed. - * - * To remove a PurpleNotifyUserInfoEntry, use - * purple_notify_user_info_remove_entry(). Do not use the GList directly. - * - * @param user_info The PurpleNotifyUserInfo - * - * @constreturn A GList of PurpleNotifyUserInfoEntry objects - */ -GList *purple_notify_user_info_get_entries(PurpleNotifyUserInfo *user_info); - -/** - * Create a textual representation of a PurpleNotifyUserInfo, separating - * entries with newline - * - * @param user_info The PurpleNotifyUserInfo - * @param newline The separation character - */ -char *purple_notify_user_info_get_text_with_newline(PurpleNotifyUserInfo *user_info, const char *newline); - -/** - * Add a label/value pair to a PurpleNotifyUserInfo object. - * PurpleNotifyUserInfo keeps track of the order in which pairs are added. - * - * @param user_info The PurpleNotifyUserInfo - * @param label A label, which for example might be displayed by a - * UI with a colon after it ("Status:"). Do not include - * a colon. If NULL, value will be displayed without a - * label. - * @param value The value, which might be displayed by a UI after - * the label. If NULL, label will still be displayed; - * the UI should then treat label as independent and not - * include a colon if it would otherwise. - */ -void purple_notify_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value); - -/** - * Prepend a label/value pair to a PurpleNotifyUserInfo object - * - * @param user_info The PurpleNotifyUserInfo - * @param label A label, which for example might be displayed by a - * UI with a colon after it ("Status:"). Do not include - * a colon. If NULL, value will be displayed without a - * label. - * @param value The value, which might be displayed by a UI after - * the label. If NULL, label will still be displayed; - * the UI should then treat label as independent and not - * include a colon if it would otherwise. - */ -void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_) -/** - * Remove a PurpleNotifyUserInfoEntry from a PurpleNotifyUserInfo object - * without freeing the entry. - * - * @param user_info The PurpleNotifyUserInfo - * @param user_info_entry The PurpleNotifyUserInfoEntry - * - * @deprecated Nothing is using this function and it should be removed - * in 3.0.0. Or, if we decide we want to keep it in 3.0.0 - * then we should make purple_notify_user_info_entry_destroy - * public so that entries can be free'd after they're removed. - */ -void purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *user_info_entry); -#endif - -/** - * Create a new PurpleNotifyUserInfoEntry - * - * If added to a PurpleNotifyUserInfo object, this should not be free()'d, - * as PurpleNotifyUserInfo will do so when destroyed. - * purple_notify_user_info_add_pair() and - * purple_notify_user_info_prepend_pair() are convenience methods for - * creating entries and adding them to a PurpleNotifyUserInfo. - * - * @param label A label, which for example might be displayed by a UI - * with a colon after it ("Status:"). Do not include a - * colon. If NULL, value will be displayed without a label. - * @param value The value, which might be displayed by a UI after the - * label. If NULL, label will still be displayed; the UI - * should then treat label as independent and not include a - * colon if it would otherwise. - * - * @result A new PurpleNotifyUserInfoEntry - */ -PurpleNotifyUserInfoEntry *purple_notify_user_info_entry_new(const char *label, const char *value); - -/** - * Add a section break. A UI might display this as a horizontal line. - * - * @param user_info The PurpleNotifyUserInfo - */ -void purple_notify_user_info_add_section_break(PurpleNotifyUserInfo *user_info); - -/** - * Prepend a section break. A UI might display this as a horizontal line. - * - * @param user_info The PurpleNotifyUserInfo - * @since 2.5.0 - */ -void purple_notify_user_info_prepend_section_break(PurpleNotifyUserInfo *user_info); - -/** - * Add a section header. A UI might display this in a different font - * from other text. - * - * @param user_info The PurpleNotifyUserInfo - * @param label The name of the section - */ -void purple_notify_user_info_add_section_header(PurpleNotifyUserInfo *user_info, const char *label); - -/** - * Prepend a section header. A UI might display this in a different font - * from other text. - * - * @param user_info The PurpleNotifyUserInfo - * @param label The name of the section - * @since 2.5.0 - */ -void purple_notify_user_info_prepend_section_header(PurpleNotifyUserInfo *user_info, const char *label); - -/** - * Remove the last item which was added to a PurpleNotifyUserInfo. This - * could be used to remove a section header which is not needed. - */ -void purple_notify_user_info_remove_last_item(PurpleNotifyUserInfo *user_info); - -/** - * Get the label for a PurpleNotifyUserInfoEntry - * - * @param user_info_entry The PurpleNotifyUserInfoEntry - * - * @return The label - */ -const gchar *purple_notify_user_info_entry_get_label(PurpleNotifyUserInfoEntry *user_info_entry); - -/** - * Set the label for a PurpleNotifyUserInfoEntry - * - * @param user_info_entry The PurpleNotifyUserInfoEntry - * @param label The label - */ -void purple_notify_user_info_entry_set_label(PurpleNotifyUserInfoEntry *user_info_entry, const char *label); - -/** - * Get the value for a PurpleNotifyUserInfoEntry - * - * @param user_info_entry The PurpleNotifyUserInfoEntry - * - * @result The value - */ -const gchar *purple_notify_user_info_entry_get_value(PurpleNotifyUserInfoEntry *user_info_entry); - -/** - * Set the value for a PurpleNotifyUserInfoEntry - * - * @param user_info_entry The PurpleNotifyUserInfoEntry - * @param value The value - */ -void purple_notify_user_info_entry_set_value(PurpleNotifyUserInfoEntry *user_info_entry, const char *value); - - -/** - * Get the type of a PurpleNotifyUserInfoEntry - * - * @param user_info_entry The PurpleNotifyUserInfoEntry - * - * @return The PurpleNotifyUserInfoEntryType - */ -PurpleNotifyUserInfoEntryType purple_notify_user_info_entry_get_type(PurpleNotifyUserInfoEntry *user_info_entry); - -/** - * Set the type of a PurpleNotifyUserInfoEntry - * - * @param user_info_entry The PurpleNotifyUserInfoEntry - * @param type The PurpleNotifyUserInfoEntryType - */ -void purple_notify_user_info_entry_set_type(PurpleNotifyUserInfoEntry *user_info_entry, - PurpleNotifyUserInfoEntryType type); - -/** - * Opens a URI or somehow presents it to the user. - * - * @param handle The plugin or connection handle. - * @param uri The URI to display or go to. - * - * @return A UI-specific handle, if any. This may only be presented if - * the UI code displays a dialog instead of a webpage, or something - * similar. - */ -void *purple_notify_uri(void *handle, const char *uri); - -/** - * Closes a notification. - * - * This should be used only by the UI operation functions and part of the - * core. - * - * @param type The notification type. - * @param ui_handle The notification UI handle. - */ -void purple_notify_close(PurpleNotifyType type, void *ui_handle); - -/** - * Closes all notifications registered with the specified handle. - * - * @param handle The handle. - */ -void purple_notify_close_with_handle(void *handle); - -/** - * A wrapper for purple_notify_message that displays an information message. - */ -#define purple_notify_info(handle, title, primary, secondary) \ - purple_notify_message((handle), PURPLE_NOTIFY_MSG_INFO, (title), \ - (primary), (secondary), NULL, NULL) - -/** - * A wrapper for purple_notify_message that displays a warning message. - */ -#define purple_notify_warning(handle, title, primary, secondary) \ - purple_notify_message((handle), PURPLE_NOTIFY_MSG_WARNING, (title), \ - (primary), (secondary), NULL, NULL) - -/** - * A wrapper for purple_notify_message that displays an error message. - */ -#define purple_notify_error(handle, title, primary, secondary) \ - purple_notify_message((handle), PURPLE_NOTIFY_MSG_ERROR, (title), \ - (primary), (secondary), NULL, NULL) - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used when displaying a - * notification. - * - * @param ops The UI operations structure. - */ -void purple_notify_set_ui_ops(PurpleNotifyUiOps *ops); - -/** - * Returns the UI operations structure to be used when displaying a - * notification. - * - * @return The UI operations structure. - */ -PurpleNotifyUiOps *purple_notify_get_ui_ops(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Notify Subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the notify subsystem handle. - * - * @return The notify subsystem handle. - */ -void *purple_notify_get_handle(void); - -/** - * Initializes the notify subsystem. - */ -void purple_notify_init(void); - -/** - * Uninitializes the notify subsystem. - */ -void purple_notify_uninit(void); - -/*@}*/ - - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_NOTIFY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,373 +0,0 @@ -/** - * @file ntlm.c - */ - -/* purple - * - * Copyright (C) 2005 Thomas Butter - * - * hashing done according to description of NTLM on - * http://www.innovation.ch/java/ntlm.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "util.h" -#include "ntlm.h" -#include "cipher.h" -#include "debug.h" -#include - -#define NTLM_NEGOTIATE_NTLM2_KEY 0x00080000 - -struct type1_message { - guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' */ - guint32 type; /* 0x00000001 */ - guint32 flags; /* 0x0000b203 */ - - guint16 dom_len1; /* domain string length */ - guint16 dom_len2; /* domain string length */ - guint32 dom_off; /* domain string offset */ - - guint16 host_len1; /* host string length */ - guint16 host_len2; /* host string length */ - guint32 host_off; /* host string offset (always 0x00000020) */ - -#if 0 - guint8 host[*]; /* host string (ASCII) */ - guint8 dom[*]; /* domain string (ASCII) */ -#endif -}; - -struct type2_message { - guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0'*/ - guint32 type; /* 0x00000002 */ - - guint32 zero; - guint16 msg_len1; /* target name length */ - guint16 msg_len2; /* target name length */ - - guint32 flags; /* 0x00008201 */ - - guint8 nonce[8]; /* nonce */ - guint8 context[8]; -}; - -struct type3_message { - guint8 protocol[8]; /* 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0'*/ - guint32 type; /* 0x00000003 */ - - guint16 lm_resp_len1; /* LanManager response length (always 0x18)*/ - guint16 lm_resp_len2; /* LanManager response length (always 0x18)*/ - guint32 lm_resp_off; /* LanManager response offset */ - - guint16 nt_resp_len1; /* NT response length (always 0x18) */ - guint16 nt_resp_len2; /* NT response length (always 0x18) */ - guint32 nt_resp_off; /* NT response offset */ - - guint16 dom_len1; /* domain string length */ - guint16 dom_len2; /* domain string length */ - guint32 dom_off; /* domain string offset (always 0x00000040) */ - - guint16 user_len1; /* username string length */ - guint16 user_len2; /* username string length */ - guint32 user_off; /* username string offset */ - - guint16 host_len1; /* host string length */ - guint16 host_len2; /* host string length */ - guint32 host_off; /* host string offset */ - - guint16 sess_len1; - guint16 sess_len2; - guint32 sess_off; /* message length */ - - guint32 flags; /* 0x00008201 */ - /* guint32 flags2; */ /* unknown, used in windows messenger */ - /* guint32 flags3; */ - -#if 0 - guint8 dom[*]; /* domain string (unicode UTF-16LE) */ - guint8 user[*]; /* username string (unicode UTF-16LE) */ - guint8 host[*]; /* host string (unicode UTF-16LE) */ - guint8 lm_resp[*]; /* LanManager response */ - guint8 nt_resp[*]; /* NT response */ -#endif -}; - -gchar * -purple_ntlm_gen_type1(const gchar *hostname, const gchar *domain) -{ - int hostnamelen; - int domainlen; - unsigned char *msg; - struct type1_message *tmsg; - gchar *tmp; - - hostnamelen = strlen(hostname); - domainlen = strlen(domain); - msg = g_malloc0(sizeof(struct type1_message) + hostnamelen + domainlen); - tmsg = (struct type1_message*)msg; - tmsg->protocol[0] = 'N'; - tmsg->protocol[1] = 'T'; - tmsg->protocol[2] = 'L'; - tmsg->protocol[3] = 'M'; - tmsg->protocol[4] = 'S'; - tmsg->protocol[5] = 'S'; - tmsg->protocol[6] = 'P'; - tmsg->protocol[7] = '\0'; - tmsg->type = GUINT32_TO_LE(0x00000001); - tmsg->flags = GUINT32_TO_LE(0x0000b203); - tmsg->dom_len1 = tmsg->dom_len2 = GUINT16_TO_LE(domainlen); - tmsg->dom_off = GUINT32_TO_LE(sizeof(struct type1_message) + hostnamelen); - tmsg->host_len1 = tmsg->host_len2 = GUINT16_TO_LE(hostnamelen); - tmsg->host_off = GUINT32_TO_LE(sizeof(struct type1_message)); - memcpy(msg + tmsg->host_off, hostname, hostnamelen); - memcpy(msg + tmsg->dom_off, domain, domainlen); - - tmp = purple_base64_encode(msg, sizeof(struct type1_message) + hostnamelen + domainlen); - g_free(msg); - - return tmp; -} - -guint8 * -purple_ntlm_parse_type2(const gchar *type2, guint32 *flags) -{ - gsize retlen; - struct type2_message *tmsg; - static guint8 nonce[8]; - - tmsg = (struct type2_message*)purple_base64_decode(type2, &retlen); - memcpy(nonce, tmsg->nonce, 8); - if (flags != NULL) - *flags = GUINT16_FROM_LE(tmsg->flags); - g_free(tmsg); - - return nonce; -} - -/** - * Create a 64bit DES key by taking a 56bit key and adding - * a parity bit after every 7th bit. - */ -static void -setup_des_key(const guint8 key_56[], guint8 *key) -{ - key[0] = key_56[0]; - key[1] = ((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1); - key[2] = ((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2); - key[3] = ((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3); - key[4] = ((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4); - key[5] = ((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5); - key[6] = ((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6); - key[7] = (key_56[6] << 1) & 0xFF; -} - -/* - * helper function for purple cipher.c - */ -static void -des_ecb_encrypt(const guint8 *plaintext, guint8 *result, const guint8 *key) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - size_t outlen; - - cipher = purple_ciphers_find_cipher("des"); - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_set_key(context, key); - purple_cipher_context_encrypt(context, plaintext, 8, result, &outlen); - purple_cipher_context_destroy(context); -} - -/* - * takes a 21 byte array and treats it as 3 56-bit DES keys. The - * 8 byte plaintext is encrypted with each key and the resulting 24 - * bytes are stored in the results array. - */ -static void -calc_resp(guint8 *keys, const guint8 *plaintext, unsigned char *results) -{ - guint8 key[8]; - setup_des_key(keys, key); - des_ecb_encrypt(plaintext, results, key); - - setup_des_key(keys + 7, key); - des_ecb_encrypt(plaintext, results + 8, key); - - setup_des_key(keys + 14, key); - des_ecb_encrypt(plaintext, results + 16, key); -} - -static void -gensesskey(char *buffer, const char *oldkey) -{ - int i = 0; - if(oldkey == NULL) { - for(i=0; i<16; i++) { - buffer[i] = (char)(rand() & 0xff); - } - } else { - memcpy(buffer, oldkey, 16); - } -} - -gchar * -purple_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *hostname, const gchar *domain, const guint8 *nonce, guint32 *flags) -{ - char lm_pw[14]; - unsigned char lm_hpw[21]; - char sesskey[16]; - guint8 key[8]; - int domainlen; - int usernamelen; - int hostnamelen; - int msglen; - struct type3_message *tmsg; - int passwlen, lennt; - unsigned char lm_resp[24], nt_resp[24]; - unsigned char magic[] = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 }; - unsigned char nt_hpw[21]; - char nt_pw[128]; - PurpleCipher *cipher; - PurpleCipherContext *context; - char *tmp; - int idx; - gchar *ucs2le; - - domainlen = strlen(domain) * 2; - usernamelen = strlen(username) * 2; - hostnamelen = strlen(hostname) * 2; - msglen = sizeof(struct type3_message) + domainlen + - usernamelen + hostnamelen + 0x18 + 0x18 + ((flags) ? 0x10 : 0); - tmsg = g_malloc0(msglen); - passwlen = strlen(passw); - - /* type3 message initialization */ - tmsg->protocol[0] = 'N'; - tmsg->protocol[1] = 'T'; - tmsg->protocol[2] = 'L'; - tmsg->protocol[3] = 'M'; - tmsg->protocol[4] = 'S'; - tmsg->protocol[5] = 'S'; - tmsg->protocol[6] = 'P'; - tmsg->type = GUINT32_TO_LE(0x00000003); - tmsg->lm_resp_len1 = tmsg->lm_resp_len2 = GUINT16_TO_LE(0x18); - tmsg->lm_resp_off = GUINT32_TO_LE(sizeof(struct type3_message) + domainlen + usernamelen + hostnamelen); - tmsg->nt_resp_len1 = tmsg->nt_resp_len2 = GUINT16_TO_LE(0x18); - tmsg->nt_resp_off = GUINT32_TO_LE(sizeof(struct type3_message) + domainlen + usernamelen + hostnamelen + 0x18); - - tmsg->dom_len1 = tmsg->dom_len2 = GUINT16_TO_LE(domainlen); - tmsg->dom_off = GUINT32_TO_LE(sizeof(struct type3_message)); - - tmsg->user_len1 = tmsg->user_len2 = GUINT16_TO_LE(usernamelen); - tmsg->user_off = GUINT32_TO_LE(sizeof(struct type3_message) + domainlen); - - tmsg->host_len1 = tmsg->host_len2 = GUINT16_TO_LE(hostnamelen); - tmsg->host_off = GUINT32_TO_LE(sizeof(struct type3_message) + domainlen + usernamelen); - - if(flags) { - tmsg->sess_off = GUINT32_TO_LE(sizeof(struct type3_message) + domainlen + usernamelen + hostnamelen + 0x18 + 0x18); - tmsg->sess_len1 = tmsg->sess_len2 = GUINT16_TO_LE(0x0010); - } - - tmsg->flags = GUINT32_TO_LE(0x00008201); - - tmp = (char *)tmsg + sizeof(struct type3_message); - - ucs2le = g_convert(domain, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL); - if (ucs2le != NULL) { - memcpy(tmp, ucs2le, domainlen); - g_free(ucs2le); - tmp += domainlen; - } else { - purple_debug_info("ntlm", "Unable to encode domain in UTF-16LE.\n"); - } - - ucs2le = g_convert(username, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL); - if (ucs2le != NULL) { - memcpy(tmp, ucs2le, usernamelen); - g_free(ucs2le); - tmp += usernamelen; - } else { - purple_debug_info("ntlm", "Unable to encode username in UTF-16LE.\n"); - } - - ucs2le = g_convert(hostname, -1, "UTF-16LE", "UTF-8", NULL, NULL, NULL); - if (ucs2le != NULL) { - memcpy(tmp, ucs2le, hostnamelen); - g_free(ucs2le); - tmp += hostnamelen; - } else { - purple_debug_info("ntlm", "Unable to encode hostname in UTF-16LE.\n"); - } - - /* LM */ - if (passwlen > 14) - passwlen = 14; - - for (idx = 0; idx < passwlen; idx++) - lm_pw[idx] = g_ascii_toupper(passw[idx]); - for (; idx < 14; idx++) - lm_pw[idx] = 0; - - setup_des_key((unsigned char*)lm_pw, key); - des_ecb_encrypt(magic, lm_hpw, key); - - setup_des_key((unsigned char*)(lm_pw + 7), key); - des_ecb_encrypt(magic, lm_hpw + 8, key); - - memset(lm_hpw + 16, 0, 5); - calc_resp(lm_hpw, nonce, lm_resp); - memcpy(tmp, lm_resp, 0x18); - tmp += 0x18; - - /* NTLM */ - /* Convert the password to UTF-16LE */ - lennt = strlen(passw); - for (idx = 0; idx < lennt; idx++) - { - nt_pw[2 * idx] = passw[idx]; - nt_pw[2 * idx + 1] = 0; - } - - cipher = purple_ciphers_find_cipher("md4"); - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (guint8 *)nt_pw, 2 * lennt); - purple_cipher_context_digest(context, 21, nt_hpw, NULL); - purple_cipher_context_destroy(context); - - memset(nt_hpw + 16, 0, 5); - calc_resp(nt_hpw, nonce, nt_resp); - memcpy(tmp, nt_resp, 0x18); - tmp += 0x18; - - /* LCS Stuff */ - if (flags) { - tmsg->flags = GUINT32_TO_LE(0x409082d4); - gensesskey(sesskey, NULL); - memcpy(tmp, sesskey, 0x10); - } - - /*tmsg->flags2 = 0x0a280105; - tmsg->flags3 = 0x0f000000;*/ - - tmp = purple_base64_encode((guchar *)tmsg, msglen); - g_free(tmsg); - - return tmp; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/ntlm.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/** - * @file ntlm.h - */ - -/* purple - * - * Copyright (C) 2005, Thomas Butter - * - * ntlm structs are taken from NTLM description on - * http://www.innovation.ch/java/ntlm.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_NTLM_H -#define _PURPLE_NTLM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Generates the base64 encoded type 1 message needed for NTLM authentication - * - * @param hostname Your hostname - * @param domain The domain to authenticate to - * @return base64 encoded string to send to the server. This should - * be g_free'd by the caller. - */ -gchar *purple_ntlm_gen_type1(const gchar *hostname, const gchar *domain); - -/** - * Parses the ntlm type 2 message - * - * @param type2 String containing the base64 encoded type2 message - * @param flags If not @c NULL, this will store the flags for the message - * - * @return The nonce for use in message type3. This is a statically - * allocated 8 byte binary string. - */ -guint8 *purple_ntlm_parse_type2(const gchar *type2, guint32 *flags); - -/** - * Generates a type3 message - * - * @param username The username - * @param passw The password - * @param hostname The hostname - * @param domain The domain to authenticate against - * @param nonce The nonce returned by purple_ntlm_parse_type2 - * @param flags Pointer to the flags returned by purple_ntlm_parse_type2 - * @return A base64 encoded type3 message. This should be g_free'd by - * the caller. - */ -gchar *purple_ntlm_gen_type3(const gchar *username, const gchar *passw, const gchar *hostname, const gchar *domain, const guint8 *nonce, guint32 *flags); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_NTLM_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1686 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_PLUGIN_C_ - -#include "internal.h" - -#include "accountopt.h" -#include "core.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "prpl.h" -#include "request.h" -#include "signals.h" -#include "util.h" -#include "valgrind.h" -#include "version.h" - -typedef struct -{ - GHashTable *commands; - size_t command_count; - -} PurplePluginIpcInfo; - -typedef struct -{ - PurpleCallback func; - PurpleSignalMarshalFunc marshal; - - int num_params; - PurpleValue **params; - PurpleValue *ret_value; - -} PurplePluginIpcCommand; - -static GList *search_paths = NULL; -static GList *plugins = NULL; -static GList *loaded_plugins = NULL; -static GList *protocol_plugins = NULL; -#ifdef PURPLE_PLUGINS -static GList *load_queue = NULL; -static GList *plugin_loaders = NULL; -static GList *plugins_to_disable = NULL; -#endif - -static void (*probe_cb)(void *) = NULL; -static void *probe_cb_data = NULL; -static void (*load_cb)(PurplePlugin *, void *) = NULL; -static void *load_cb_data = NULL; -static void (*unload_cb)(PurplePlugin *, void *) = NULL; -static void *unload_cb_data = NULL; - -#ifdef PURPLE_PLUGINS - -static gboolean -has_file_extension(const char *filename, const char *ext) -{ - int len, extlen; - - if (filename == NULL || *filename == '\0' || ext == NULL) - return 0; - - extlen = strlen(ext); - len = strlen(filename) - extlen; - - if (len < 0) - return 0; - - return (strncmp(filename + len, ext, extlen) == 0); -} - -static gboolean -is_native(const char *filename) -{ - const char *last_period; - - last_period = strrchr(filename, '.'); - if (last_period == NULL) - return FALSE; - - return !(strcmp(last_period, ".dll") & - strcmp(last_period, ".sl") & - strcmp(last_period, ".so")); -} - -static char * -purple_plugin_get_basename(const char *filename) -{ - const char *basename; - const char *last_period; - - basename = strrchr(filename, G_DIR_SEPARATOR); - if (basename != NULL) - basename++; - else - basename = filename; - - if (is_native(basename) && - ((last_period = strrchr(basename, '.')) != NULL)) - return g_strndup(basename, (last_period - basename)); - - return g_strdup(basename); -} - -static gboolean -loader_supports_file(PurplePlugin *loader, const char *filename) -{ - GList *exts; - - for (exts = PURPLE_PLUGIN_LOADER_INFO(loader)->exts; exts != NULL; exts = exts->next) { - if (has_file_extension(filename, (char *)exts->data)) { - return TRUE; - } - } - - return FALSE; -} - -static PurplePlugin * -find_loader_for_plugin(const PurplePlugin *plugin) -{ - PurplePlugin *loader; - GList *l; - - if (plugin->path == NULL) - return NULL; - - for (l = purple_plugins_get_loaded(); l != NULL; l = l->next) { - loader = l->data; - - if (loader->info->type == PURPLE_PLUGIN_LOADER && - loader_supports_file(loader, plugin->path)) { - - return loader; - } - - loader = NULL; - } - - return NULL; -} - -#endif /* PURPLE_PLUGINS */ - -/** - * Negative if a before b, 0 if equal, positive if a after b. - */ -static gint -compare_prpl(PurplePlugin *a, PurplePlugin *b) -{ - if(PURPLE_IS_PROTOCOL_PLUGIN(a)) { - if(PURPLE_IS_PROTOCOL_PLUGIN(b)) - return strcmp(a->info->name, b->info->name); - else - return -1; - } else { - if(PURPLE_IS_PROTOCOL_PLUGIN(b)) - return 1; - else - return 0; - } -} - -PurplePlugin * -purple_plugin_new(gboolean native, const char *path) -{ - PurplePlugin *plugin; - - plugin = g_new0(PurplePlugin, 1); - - plugin->native_plugin = native; - plugin->path = g_strdup(path); - - PURPLE_DBUS_REGISTER_POINTER(plugin, PurplePlugin); - - return plugin; -} - -PurplePlugin * -purple_plugin_probe(const char *filename) -{ -#ifdef PURPLE_PLUGINS - PurplePlugin *plugin = NULL; - PurplePlugin *loader; - gpointer unpunned; - gchar *basename = NULL; - gboolean (*purple_init_plugin)(PurplePlugin *); - - purple_debug_misc("plugins", "probing %s\n", filename); - g_return_val_if_fail(filename != NULL, NULL); - - if (!g_file_test(filename, G_FILE_TEST_EXISTS)) - return NULL; - - /* If this plugin has already been probed then exit */ - basename = purple_plugin_get_basename(filename); - plugin = purple_plugins_find_with_basename(basename); - g_free(basename); - if (plugin != NULL) - { - if (purple_strequal(filename, plugin->path)) - return plugin; - else if (!purple_plugin_is_unloadable(plugin)) - { - purple_debug_warning("plugins", "Not loading %s. " - "Another plugin with the same name (%s) has already been loaded.\n", - filename, plugin->path); - return plugin; - } - else - { - /* The old plugin was a different file and it was unloadable. - * There's no guarantee that this new file with the same name - * will be loadable, but unless it fails in one of the silent - * ways and the first one didn't, it's not any worse. The user - * will still see a greyed-out plugin, which is what we want. */ - purple_plugin_destroy(plugin); - } - } - - plugin = purple_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename); - - if (plugin->native_plugin) { - const char *error; -#ifdef _WIN32 - /* Suppress error popups for failing to load plugins */ - UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); -#endif - - /* - * We pass G_MODULE_BIND_LOCAL here to prevent symbols from - * plugins being added to the global name space. - * - * G_MODULE_BIND_LOCAL was added in glib 2.3.3. - */ -#if GLIB_CHECK_VERSION(2,3,3) - plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL); -#else - plugin->handle = g_module_open(filename, 0); -#endif - - if (plugin->handle == NULL) - { - const char *error = g_module_error(); - if (error != NULL && purple_str_has_prefix(error, filename)) - { - error = error + strlen(filename); - - /* These are just so we don't crash. If we - * got this far, they should always be true. */ - if (*error == ':') - error++; - if (*error == ' ') - error++; - } - - if (error == NULL || !*error) - { - plugin->error = g_strdup(_("Unknown error")); - purple_debug_error("plugins", "%s is not loadable: Unknown error\n", - plugin->path); - } - else - { - plugin->error = g_strdup(error); - purple_debug_error("plugins", "%s is not loadable: %s\n", - plugin->path, plugin->error); - } -#if GLIB_CHECK_VERSION(2,3,3) - plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); -#else - plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY); -#endif - - if (plugin->handle == NULL) - { -#ifdef _WIN32 - /* Restore the original error mode */ - SetErrorMode(old_error_mode); -#endif - purple_plugin_destroy(plugin); - return NULL; - } - else - { - /* We were able to load the plugin with lazy symbol binding. - * This means we're missing some symbol. Mark it as - * unloadable and keep going so we get the info to display - * to the user so they know to rebuild this plugin. */ - plugin->unloadable = TRUE; - } - } - - if (!g_module_symbol(plugin->handle, "purple_init_plugin", - &unpunned)) - { - purple_debug_error("plugins", "%s is not usable because the " - "'purple_init_plugin' symbol could not be " - "found. Does the plugin call the " - "PURPLE_INIT_PLUGIN() macro?\n", plugin->path); - - g_module_close(plugin->handle); - error = g_module_error(); - if (error != NULL) - purple_debug_error("plugins", "Error closing module %s: %s\n", - plugin->path, error); - plugin->handle = NULL; - -#ifdef _WIN32 - /* Restore the original error mode */ - SetErrorMode(old_error_mode); -#endif - purple_plugin_destroy(plugin); - return NULL; - } - purple_init_plugin = unpunned; - -#ifdef _WIN32 - /* Restore the original error mode */ - SetErrorMode(old_error_mode); -#endif - } - else { - loader = find_loader_for_plugin(plugin); - - if (loader == NULL) { - purple_plugin_destroy(plugin); - return NULL; - } - - purple_init_plugin = PURPLE_PLUGIN_LOADER_INFO(loader)->probe; - } - - if (!purple_init_plugin(plugin) || plugin->info == NULL) - { - purple_plugin_destroy(plugin); - return NULL; - } - else if (plugin->info->ui_requirement && - !purple_strequal(plugin->info->ui_requirement, purple_core_get_ui())) - { - plugin->error = g_strdup_printf(_("You are using %s, but this plugin requires %s."), - purple_core_get_ui(), plugin->info->ui_requirement); - purple_debug_error("plugins", "%s is not loadable: The UI requirement is not met. (%s)\n", plugin->path, plugin->error); - plugin->unloadable = TRUE; - return plugin; - } - - /* - * Check to make sure a plugin has defined an id. - * Not having this check caused purple_plugin_unload to - * enter an infinite loop in certain situations by passing - * purple_find_plugin_by_id a NULL value. -- ecoffey - */ - if (plugin->info->id == NULL || *plugin->info->id == '\0') - { - plugin->error = g_strdup(_("This plugin has not defined an ID.")); - purple_debug_error("plugins", "%s is not loadable: info->id is not defined.\n", plugin->path); - plugin->unloadable = TRUE; - return plugin; - } - - /* Really old plugins. */ - if (plugin->info->magic != PURPLE_PLUGIN_MAGIC) - { - if (plugin->info->magic >= 2 && plugin->info->magic <= 4) - { - struct _PurplePluginInfo2 - { - unsigned int api_version; - PurplePluginType type; - char *ui_requirement; - unsigned long flags; - GList *dependencies; - PurplePluginPriority priority; - - char *id; - char *name; - char *version; - char *summary; - char *description; - char *author; - char *homepage; - - gboolean (*load)(PurplePlugin *plugin); - gboolean (*unload)(PurplePlugin *plugin); - void (*destroy)(PurplePlugin *plugin); - - void *ui_info; - void *extra_info; - PurplePluginUiInfo *prefs_info; - GList *(*actions)(PurplePlugin *plugin, gpointer context); - } *info2 = (struct _PurplePluginInfo2 *)plugin->info; - - /* This leaks... but only for ancient plugins, so deal with it. */ - plugin->info = g_new0(PurplePluginInfo, 1); - - /* We don't really need all these to display the plugin info, but - * I'm copying them all for good measure. */ - plugin->info->magic = info2->api_version; - plugin->info->type = info2->type; - plugin->info->ui_requirement = info2->ui_requirement; - plugin->info->flags = info2->flags; - plugin->info->dependencies = info2->dependencies; - plugin->info->id = info2->id; - plugin->info->name = info2->name; - plugin->info->version = info2->version; - plugin->info->summary = info2->summary; - plugin->info->description = info2->description; - plugin->info->author = info2->author; - plugin->info->homepage = info2->homepage; - plugin->info->load = info2->load; - plugin->info->unload = info2->unload; - plugin->info->destroy = info2->destroy; - plugin->info->ui_info = info2->ui_info; - plugin->info->extra_info = info2->extra_info; - - if (info2->api_version >= 3) - plugin->info->prefs_info = info2->prefs_info; - - if (info2->api_version >= 4) - plugin->info->actions = info2->actions; - - - plugin->error = g_strdup_printf(_("Plugin magic mismatch %d (need %d)"), - plugin->info->magic, PURPLE_PLUGIN_MAGIC); - purple_debug_error("plugins", "%s is not loadable: Plugin magic mismatch %d (need %d)\n", - plugin->path, plugin->info->magic, PURPLE_PLUGIN_MAGIC); - plugin->unloadable = TRUE; - return plugin; - } - - purple_debug_error("plugins", "%s is not loadable: Plugin magic mismatch %d (need %d)\n", - plugin->path, plugin->info->magic, PURPLE_PLUGIN_MAGIC); - purple_plugin_destroy(plugin); - return NULL; - } - - if (plugin->info->major_version != PURPLE_MAJOR_VERSION || - plugin->info->minor_version > PURPLE_MINOR_VERSION) - { - plugin->error = g_strdup_printf(_("ABI version mismatch %d.%d.x (need %d.%d.x)"), - plugin->info->major_version, plugin->info->minor_version, - PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION); - purple_debug_error("plugins", "%s is not loadable: ABI version mismatch %d.%d.x (need %d.%d.x)\n", - plugin->path, plugin->info->major_version, plugin->info->minor_version, - PURPLE_MAJOR_VERSION, PURPLE_MINOR_VERSION); - plugin->unloadable = TRUE; - return plugin; - } - - if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) - { - /* If plugin is a PRPL, make sure it implements the required functions */ - if ((PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->list_icon == NULL) || - (PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->login == NULL) || - (PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->close == NULL)) - { - plugin->error = g_strdup(_("Plugin does not implement all required functions (list_icon, login and close)")); - purple_debug_error("plugins", "%s is not loadable: %s\n", - plugin->path, plugin->error); - plugin->unloadable = TRUE; - return plugin; - } - - /* For debugging, let's warn about prpl prefs. */ - if (plugin->info->prefs_info != NULL) - { - purple_debug_error("plugins", "%s has a prefs_info, but is a prpl. This is no longer supported.\n", - plugin->path); - } - } - - return plugin; -#else - return NULL; -#endif /* !PURPLE_PLUGINS */ -} - -#ifdef PURPLE_PLUGINS -static gint -compare_plugins(gconstpointer a, gconstpointer b) -{ - const PurplePlugin *plugina = a; - const PurplePlugin *pluginb = b; - - return strcmp(plugina->info->name, pluginb->info->name); -} -#endif /* PURPLE_PLUGINS */ - -gboolean -purple_plugin_load(PurplePlugin *plugin) -{ -#ifdef PURPLE_PLUGINS - GList *dep_list = NULL; - GList *l; - - g_return_val_if_fail(plugin != NULL, FALSE); - - if (purple_plugin_is_loaded(plugin)) - return TRUE; - - if (purple_plugin_is_unloadable(plugin)) - return FALSE; - - g_return_val_if_fail(plugin->error == NULL, FALSE); - - /* - * Go through the list of the plugin's dependencies. - * - * First pass: Make sure all the plugins needed are probed. - */ - for (l = plugin->info->dependencies; l != NULL; l = l->next) - { - const char *dep_name = (const char *)l->data; - PurplePlugin *dep_plugin; - - dep_plugin = purple_plugins_find_with_id(dep_name); - - if (dep_plugin == NULL) - { - char *tmp; - - tmp = g_strdup_printf(_("The required plugin %s was not found. " - "Please install this plugin and try again."), - dep_name); - - purple_notify_error(NULL, NULL, - _("Unable to load the plugin"), tmp); - g_free(tmp); - - g_list_free(dep_list); - - return FALSE; - } - - dep_list = g_list_append(dep_list, dep_plugin); - } - - /* Second pass: load all the required plugins. */ - for (l = dep_list; l != NULL; l = l->next) - { - PurplePlugin *dep_plugin = (PurplePlugin *)l->data; - - if (!purple_plugin_is_loaded(dep_plugin)) - { - if (!purple_plugin_load(dep_plugin)) - { - char *tmp; - - tmp = g_strdup_printf(_("The required plugin %s was unable to load."), - plugin->info->name); - - purple_notify_error(NULL, NULL, - _("Unable to load your plugin."), tmp); - g_free(tmp); - - g_list_free(dep_list); - - return FALSE; - } - } - } - - /* Third pass: note that other plugins are dependencies of this plugin. - * This is done separately in case we had to bail out earlier. */ - for (l = dep_list; l != NULL; l = l->next) - { - PurplePlugin *dep_plugin = (PurplePlugin *)l->data; - dep_plugin->dependent_plugins = g_list_prepend(dep_plugin->dependent_plugins, plugin->info->id); - } - - g_list_free(dep_list); - - if (plugin->native_plugin) - { - if (plugin->info != NULL && plugin->info->load != NULL) - { - if (!plugin->info->load(plugin)) - return FALSE; - } - } - else { - PurplePlugin *loader; - PurplePluginLoaderInfo *loader_info; - - loader = find_loader_for_plugin(plugin); - - if (loader == NULL) - return FALSE; - - loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); - - if (loader_info->load != NULL) - { - if (!loader_info->load(plugin)) - return FALSE; - } - } - - loaded_plugins = g_list_insert_sorted(loaded_plugins, plugin, compare_plugins); - - plugin->loaded = TRUE; - - if (load_cb != NULL) - load_cb(plugin, load_cb_data); - - purple_signal_emit(purple_plugins_get_handle(), "plugin-load", plugin); - - return TRUE; - -#else - return TRUE; -#endif /* !PURPLE_PLUGINS */ -} - -gboolean -purple_plugin_unload(PurplePlugin *plugin) -{ -#ifdef PURPLE_PLUGINS - GList *l; - GList *ll; - - g_return_val_if_fail(plugin != NULL, FALSE); - g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE); - - purple_debug_info("plugins", "Unloading plugin %s\n", plugin->info->name); - - /* Unload all plugins that depend on this plugin. */ - for (l = plugin->dependent_plugins; l != NULL; l = ll) { - const char * dep_name = (const char *)l->data; - PurplePlugin *dep_plugin; - - /* Store a pointer to the next element in the list. - * This is because we'll be modifying this list in the loop. */ - ll = l->next; - - dep_plugin = purple_plugins_find_with_id(dep_name); - - if (dep_plugin != NULL && purple_plugin_is_loaded(dep_plugin)) - { - if (!purple_plugin_unload(dep_plugin)) - { - g_free(plugin->error); - plugin->error = g_strdup_printf(_("%s requires %s, but it failed to unload."), - _(plugin->info->name), - _(dep_plugin->info->name)); - return FALSE; - } - else - { -#if 0 - /* This isn't necessary. This has already been done when unloading dep_plugin. */ - plugin->dependent_plugins = g_list_delete_link(plugin->dependent_plugins, l); -#endif - } - } - } - - /* Remove this plugin from each dependency's dependent_plugins list. */ - for (l = plugin->info->dependencies; l != NULL; l = l->next) - { - const char *dep_name = (const char *)l->data; - PurplePlugin *dependency; - - dependency = purple_plugins_find_with_id(dep_name); - - if (dependency != NULL) - dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id); - else - purple_debug_error("plugins", "Unable to remove from dependency list for %s\n", dep_name); - } - - if (plugin->native_plugin) { - if (plugin->info->unload && !plugin->info->unload(plugin)) - return FALSE; - - if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) { - PurplePluginProtocolInfo *prpl_info; - GList *l; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - - for (l = prpl_info->user_splits; l != NULL; l = l->next) - purple_account_user_split_destroy(l->data); - - for (l = prpl_info->protocol_options; l != NULL; l = l->next) - purple_account_option_destroy(l->data); - - if (prpl_info->user_splits != NULL) { - g_list_free(prpl_info->user_splits); - prpl_info->user_splits = NULL; - } - - if (prpl_info->protocol_options != NULL) { - g_list_free(prpl_info->protocol_options); - prpl_info->protocol_options = NULL; - } - } - } else { - PurplePlugin *loader; - PurplePluginLoaderInfo *loader_info; - - loader = find_loader_for_plugin(plugin); - - if (loader == NULL) - return FALSE; - - loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); - - if (loader_info->unload && !loader_info->unload(plugin)) - return FALSE; - } - - /* cancel any pending dialogs the plugin has */ - purple_request_close_with_handle(plugin); - purple_notify_close_with_handle(plugin); - - purple_signals_disconnect_by_handle(plugin); - purple_plugin_ipc_unregister_all(plugin); - - loaded_plugins = g_list_remove(loaded_plugins, plugin); - if ((plugin->info != NULL) && PURPLE_IS_PROTOCOL_PLUGIN(plugin)) - protocol_plugins = g_list_remove(protocol_plugins, plugin); - plugins_to_disable = g_list_remove(plugins_to_disable, plugin); - plugin->loaded = FALSE; - - /* We wouldn't be anywhere near here if the plugin wasn't loaded, so - * if plugin->error is set at all, it had to be from a previous - * unload failure. It's obviously okay now. - */ - g_free(plugin->error); - plugin->error = NULL; - - if (unload_cb != NULL) - unload_cb(plugin, unload_cb_data); - - purple_signal_emit(purple_plugins_get_handle(), "plugin-unload", plugin); - - purple_prefs_disconnect_by_handle(plugin); - - return TRUE; -#else - return TRUE; -#endif /* PURPLE_PLUGINS */ -} - -void -purple_plugin_disable(PurplePlugin *plugin) -{ -#ifdef PURPLE_PLUGINS - g_return_if_fail(plugin != NULL); - - if (!g_list_find(plugins_to_disable, plugin)) - plugins_to_disable = g_list_prepend(plugins_to_disable, plugin); -#endif -} - -gboolean -purple_plugin_reload(PurplePlugin *plugin) -{ -#ifdef PURPLE_PLUGINS - g_return_val_if_fail(plugin != NULL, FALSE); - g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE); - - if (!purple_plugin_unload(plugin)) - return FALSE; - - if (!purple_plugin_load(plugin)) - return FALSE; - - return TRUE; -#else - return TRUE; -#endif /* !PURPLE_PLUGINS */ -} - -void -purple_plugin_destroy(PurplePlugin *plugin) -{ -#ifdef PURPLE_PLUGINS - g_return_if_fail(plugin != NULL); - - if (purple_plugin_is_loaded(plugin)) - purple_plugin_unload(plugin); - - plugins = g_list_remove(plugins, plugin); - - if (load_queue != NULL) - load_queue = g_list_remove(load_queue, plugin); - - /* true, this may leak a little memory if there is a major version - * mismatch, but it's a lot better than trying to free something - * we shouldn't, and crashing while trying to load an old plugin */ - if(plugin->info == NULL || plugin->info->magic != PURPLE_PLUGIN_MAGIC || - plugin->info->major_version != PURPLE_MAJOR_VERSION) - { - if(plugin->handle) - g_module_close(plugin->handle); - - g_free(plugin->path); - g_free(plugin->error); - - PURPLE_DBUS_UNREGISTER_POINTER(plugin); - - g_free(plugin); - return; - } - - if (plugin->info != NULL) - g_list_free(plugin->info->dependencies); - - if (plugin->native_plugin) - { - if (plugin->info != NULL && plugin->info->type == PURPLE_PLUGIN_LOADER) - { - PurplePluginLoaderInfo *loader_info; - GList *exts, *l, *next_l; - PurplePlugin *p2; - - loader_info = PURPLE_PLUGIN_LOADER_INFO(plugin); - - if (loader_info != NULL && loader_info->exts != NULL) - { - for (exts = PURPLE_PLUGIN_LOADER_INFO(plugin)->exts; - exts != NULL; - exts = exts->next) { - - for (l = purple_plugins_get_all(); l != NULL; l = next_l) - { - next_l = l->next; - - p2 = l->data; - - if (p2->path != NULL && - has_file_extension(p2->path, exts->data)) - { - purple_plugin_destroy(p2); - } - } - } - - g_list_free(loader_info->exts); - loader_info->exts = NULL; - } - - plugin_loaders = g_list_remove(plugin_loaders, plugin); - } - - if (plugin->info != NULL && plugin->info->destroy != NULL) - plugin->info->destroy(plugin); - - /* - * I find it extremely useful to do this when using valgrind, as - * it keeps all the plugins open, meaning that valgrind is able to - * resolve symbol names in leak traces from plugins. - */ - if (!g_getenv("PURPLE_LEAKCHECK_HELP") && !RUNNING_ON_VALGRIND) - { - if (plugin->handle != NULL) - g_module_close(plugin->handle); - } - } - else - { - PurplePlugin *loader; - PurplePluginLoaderInfo *loader_info; - - loader = find_loader_for_plugin(plugin); - - if (loader != NULL) - { - loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); - - if (loader_info->destroy != NULL) - loader_info->destroy(plugin); - } - } - - g_free(plugin->path); - g_free(plugin->error); - - PURPLE_DBUS_UNREGISTER_POINTER(plugin); - - g_free(plugin); -#endif /* !PURPLE_PLUGINS */ -} - -gboolean -purple_plugin_is_loaded(const PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - return plugin->loaded; -} - -gboolean -purple_plugin_is_unloadable(const PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - return plugin->unloadable; -} - -const gchar * -purple_plugin_get_id(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return plugin->info->id; -} - -const gchar * -purple_plugin_get_name(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return _(plugin->info->name); -} - -const gchar * -purple_plugin_get_version(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return plugin->info->version; -} - -const gchar * -purple_plugin_get_summary(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return _(plugin->info->summary); -} - -const gchar * -purple_plugin_get_description(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return _(plugin->info->description); -} - -const gchar * -purple_plugin_get_author(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return _(plugin->info->author); -} - -const gchar * -purple_plugin_get_homepage(const PurplePlugin *plugin) { - g_return_val_if_fail(plugin, NULL); - g_return_val_if_fail(plugin->info, NULL); - - return plugin->info->homepage; -} - -/************************************************************************** - * Plugin IPC - **************************************************************************/ -static void -destroy_ipc_info(void *data) -{ - PurplePluginIpcCommand *ipc_command = (PurplePluginIpcCommand *)data; - int i; - - if (ipc_command->params != NULL) - { - for (i = 0; i < ipc_command->num_params; i++) - purple_value_destroy(ipc_command->params[i]); - - g_free(ipc_command->params); - } - - if (ipc_command->ret_value != NULL) - purple_value_destroy(ipc_command->ret_value); - - g_free(ipc_command); -} - -gboolean -purple_plugin_ipc_register(PurplePlugin *plugin, const char *command, - PurpleCallback func, PurpleSignalMarshalFunc marshal, - PurpleValue *ret_value, int num_params, ...) -{ - PurplePluginIpcInfo *ipc_info; - PurplePluginIpcCommand *ipc_command; - - g_return_val_if_fail(plugin != NULL, FALSE); - g_return_val_if_fail(command != NULL, FALSE); - g_return_val_if_fail(func != NULL, FALSE); - g_return_val_if_fail(marshal != NULL, FALSE); - - if (plugin->ipc_data == NULL) - { - ipc_info = plugin->ipc_data = g_new0(PurplePluginIpcInfo, 1); - ipc_info->commands = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, destroy_ipc_info); - } - else - ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; - - ipc_command = g_new0(PurplePluginIpcCommand, 1); - ipc_command->func = func; - ipc_command->marshal = marshal; - ipc_command->num_params = num_params; - ipc_command->ret_value = ret_value; - - if (num_params > 0) - { - va_list args; - int i; - - ipc_command->params = g_new0(PurpleValue *, num_params); - - va_start(args, num_params); - - for (i = 0; i < num_params; i++) - ipc_command->params[i] = va_arg(args, PurpleValue *); - - va_end(args); - } - - g_hash_table_replace(ipc_info->commands, g_strdup(command), ipc_command); - - ipc_info->command_count++; - - return TRUE; -} - -void -purple_plugin_ipc_unregister(PurplePlugin *plugin, const char *command) -{ - PurplePluginIpcInfo *ipc_info; - - g_return_if_fail(plugin != NULL); - g_return_if_fail(command != NULL); - - ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; - - if (ipc_info == NULL || - g_hash_table_lookup(ipc_info->commands, command) == NULL) - { - purple_debug_error("plugins", - "IPC command '%s' was not registered for plugin %s\n", - command, plugin->info->name); - return; - } - - g_hash_table_remove(ipc_info->commands, command); - - ipc_info->command_count--; - - if (ipc_info->command_count == 0) - { - g_hash_table_destroy(ipc_info->commands); - g_free(ipc_info); - - plugin->ipc_data = NULL; - } -} - -void -purple_plugin_ipc_unregister_all(PurplePlugin *plugin) -{ - PurplePluginIpcInfo *ipc_info; - - g_return_if_fail(plugin != NULL); - - if (plugin->ipc_data == NULL) - return; /* Silently ignore it. */ - - ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; - - g_hash_table_destroy(ipc_info->commands); - g_free(ipc_info); - - plugin->ipc_data = NULL; -} - -gboolean -purple_plugin_ipc_get_params(PurplePlugin *plugin, const char *command, - PurpleValue **ret_value, int *num_params, - PurpleValue ***params) -{ - PurplePluginIpcInfo *ipc_info; - PurplePluginIpcCommand *ipc_command; - - g_return_val_if_fail(plugin != NULL, FALSE); - g_return_val_if_fail(command != NULL, FALSE); - - ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; - - if (ipc_info == NULL || - (ipc_command = g_hash_table_lookup(ipc_info->commands, - command)) == NULL) - { - purple_debug_error("plugins", - "IPC command '%s' was not registered for plugin %s\n", - command, plugin->info->name); - - return FALSE; - } - - if (num_params != NULL) - *num_params = ipc_command->num_params; - - if (params != NULL) - *params = ipc_command->params; - - if (ret_value != NULL) - *ret_value = ipc_command->ret_value; - - return TRUE; -} - -void * -purple_plugin_ipc_call(PurplePlugin *plugin, const char *command, - gboolean *ok, ...) -{ - PurplePluginIpcInfo *ipc_info; - PurplePluginIpcCommand *ipc_command; - va_list args; - void *ret_value; - - if (ok != NULL) - *ok = FALSE; - - g_return_val_if_fail(plugin != NULL, NULL); - g_return_val_if_fail(command != NULL, NULL); - - ipc_info = (PurplePluginIpcInfo *)plugin->ipc_data; - - if (ipc_info == NULL || - (ipc_command = g_hash_table_lookup(ipc_info->commands, - command)) == NULL) - { - purple_debug_error("plugins", - "IPC command '%s' was not registered for plugin %s\n", - command, plugin->info->name); - - return NULL; - } - - va_start(args, ok); - ipc_command->marshal(ipc_command->func, args, NULL, &ret_value); - va_end(args); - - if (ok != NULL) - *ok = TRUE; - - return ret_value; -} - -/************************************************************************** - * Plugins subsystem - **************************************************************************/ -void * -purple_plugins_get_handle(void) { - static int handle; - - return &handle; -} - -void -purple_plugins_init(void) { - void *handle = purple_plugins_get_handle(); - - purple_plugins_add_search_path(LIBDIR); - - purple_signal_register(handle, "plugin-load", - purple_marshal_VOID__POINTER, - NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_PLUGIN)); - purple_signal_register(handle, "plugin-unload", - purple_marshal_VOID__POINTER, - NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_PLUGIN)); -} - -void -purple_plugins_uninit(void) -{ - void *handle = purple_plugins_get_handle(); - - purple_signals_disconnect_by_handle(handle); - purple_signals_unregister_by_instance(handle); - - while (search_paths) { - g_free(search_paths->data); - search_paths = g_list_delete_link(search_paths, search_paths); - } -} - -/************************************************************************** - * Plugins API - **************************************************************************/ -void -purple_plugins_add_search_path(const char *path) -{ - g_return_if_fail(path != NULL); - - if (g_list_find_custom(search_paths, path, (GCompareFunc)strcmp)) - return; - - search_paths = g_list_append(search_paths, g_strdup(path)); -} - -GList * -purple_plugins_get_search_paths() -{ - return search_paths; -} - -void -purple_plugins_unload_all(void) -{ -#ifdef PURPLE_PLUGINS - - while (loaded_plugins != NULL) - purple_plugin_unload(loaded_plugins->data); - -#endif /* PURPLE_PLUGINS */ -} - -void -purple_plugins_unload(PurplePluginType type) -{ -#ifdef PURPLE_PLUGINS - GList *l; - - for (l = plugins; l; l = l->next) { - PurplePlugin *plugin = l->data; - if (plugin->info->type == type && purple_plugin_is_loaded(plugin)) - purple_plugin_unload(plugin); - } - -#endif /* PURPLE_PLUGINS */ -} - -void -purple_plugins_destroy_all(void) -{ -#ifdef PURPLE_PLUGINS - - while (plugins != NULL) - purple_plugin_destroy(plugins->data); - -#endif /* PURPLE_PLUGINS */ -} - -void -purple_plugins_save_loaded(const char *key) -{ -#ifdef PURPLE_PLUGINS - GList *pl; - GList *files = NULL; - - for (pl = purple_plugins_get_loaded(); pl != NULL; pl = pl->next) { - PurplePlugin *plugin = pl->data; - - if (plugin->info->type != PURPLE_PLUGIN_PROTOCOL && - plugin->info->type != PURPLE_PLUGIN_LOADER && - !g_list_find(plugins_to_disable, plugin)) { - files = g_list_append(files, plugin->path); - } - } - - purple_prefs_set_path_list(key, files); - g_list_free(files); -#endif -} - -void -purple_plugins_load_saved(const char *key) -{ -#ifdef PURPLE_PLUGINS - GList *f, *files; - - g_return_if_fail(key != NULL); - - files = purple_prefs_get_path_list(key); - - for (f = files; f; f = f->next) - { - char *filename; - char *basename; - PurplePlugin *plugin; - - if (f->data == NULL) - continue; - - filename = f->data; - - /* - * We don't know if the filename uses Windows or Unix path - * separators (because people might be sharing a prefs.xml - * file across systems), so we find the last occurrence - * of either. - */ - basename = strrchr(filename, '/'); - if ((basename == NULL) || (basename < strrchr(filename, '\\'))) - basename = strrchr(filename, '\\'); - if (basename != NULL) - basename++; - - /* Strip the extension */ - if (basename) - basename = purple_plugin_get_basename(basename); - - if (((plugin = purple_plugins_find_with_filename(filename)) != NULL) || - (basename && (plugin = purple_plugins_find_with_basename(basename)) != NULL) || - ((plugin = purple_plugin_probe(filename)) != NULL)) - { - purple_debug_info("plugins", "Loading saved plugin %s\n", - plugin->path); - purple_plugin_load(plugin); - } - else - { - purple_debug_error("plugins", "Unable to find saved plugin %s\n", - filename); - } - - g_free(basename); - - g_free(f->data); - } - - g_list_free(files); -#endif /* PURPLE_PLUGINS */ -} - - -void -purple_plugins_probe(const char *ext) -{ -#ifdef PURPLE_PLUGINS - GDir *dir; - const gchar *file; - gchar *path; - PurplePlugin *plugin; - GList *cur; - const char *search_path; - - if (!g_module_supported()) - return; - - /* Probe plugins */ - for (cur = search_paths; cur != NULL; cur = cur->next) - { - search_path = cur->data; - - dir = g_dir_open(search_path, 0, NULL); - - if (dir != NULL) - { - while ((file = g_dir_read_name(dir)) != NULL) - { - path = g_build_filename(search_path, file, NULL); - - if (ext == NULL || has_file_extension(file, ext)) - plugin = purple_plugin_probe(path); - - g_free(path); - } - - g_dir_close(dir); - } - } - - /* See if we have any plugins waiting to load */ - while (load_queue != NULL) - { - plugin = (PurplePlugin *)load_queue->data; - - load_queue = g_list_remove(load_queue, plugin); - - if (plugin == NULL || plugin->info == NULL) - continue; - - if (plugin->info->type == PURPLE_PLUGIN_LOADER) - { - /* We'll just load this right now. */ - if (!purple_plugin_load(plugin)) - { - purple_plugin_destroy(plugin); - - continue; - } - - plugin_loaders = g_list_append(plugin_loaders, plugin); - - for (cur = PURPLE_PLUGIN_LOADER_INFO(plugin)->exts; - cur != NULL; - cur = cur->next) - { - purple_plugins_probe(cur->data); - } - } - else if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) - { - /* We'll just load this right now. */ - if (!purple_plugin_load(plugin)) - { - purple_plugin_destroy(plugin); - - continue; - } - - /* Make sure we don't load two PRPLs with the same name? */ - if (purple_find_prpl(plugin->info->id)) - { - /* Nothing to see here--move along, move along */ - purple_plugin_destroy(plugin); - - continue; - } - - protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin, - (GCompareFunc)compare_prpl); - } - } - - if (probe_cb != NULL) - probe_cb(probe_cb_data); - -#endif /* PURPLE_PLUGINS */ -} - -gboolean -purple_plugin_register(PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - /* If this plugin has been registered already then exit */ - if (g_list_find(plugins, plugin)) - return TRUE; - - /* Ensure the plugin has the requisite information */ - if (plugin->info->type == PURPLE_PLUGIN_LOADER) - { - PurplePluginLoaderInfo *loader_info; - - loader_info = PURPLE_PLUGIN_LOADER_INFO(plugin); - - if (loader_info == NULL) - { - purple_debug_error("plugins", "%s is not loadable, loader plugin missing loader_info\n", - plugin->path); - return FALSE; - } - } - else if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) - { - PurplePluginProtocolInfo *prpl_info; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - - if (prpl_info == NULL) - { - purple_debug_error("plugins", "%s is not loadable, protocol plugin missing prpl_info\n", - plugin->path); - return FALSE; - } - } - -#ifdef PURPLE_PLUGINS - /* This plugin should be probed and maybe loaded--add it to the queue */ - load_queue = g_list_append(load_queue, plugin); -#else - if (plugin->info != NULL) - { - if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) - protocol_plugins = g_list_insert_sorted(protocol_plugins, plugin, - (GCompareFunc)compare_prpl); - if (plugin->info->load != NULL) - if (!plugin->info->load(plugin)) - return FALSE; - } -#endif - - plugins = g_list_append(plugins, plugin); - - return TRUE; -} - -gboolean -purple_plugins_enabled(void) -{ -#ifdef PURPLE_PLUGINS - return TRUE; -#else - return FALSE; -#endif -} - -void -purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data) -{ - probe_cb = func; - probe_cb_data = data; -} - -void -purple_plugins_unregister_probe_notify_cb(void (*func)(void *)) -{ - probe_cb = NULL; - probe_cb_data = NULL; -} - -void -purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), - void *data) -{ - load_cb = func; - load_cb_data = data; -} - -void -purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)) -{ - load_cb = NULL; - load_cb_data = NULL; -} - -void -purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), - void *data) -{ - unload_cb = func; - unload_cb_data = data; -} - -void -purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, void *)) -{ - unload_cb = NULL; - unload_cb_data = NULL; -} - -PurplePlugin * -purple_plugins_find_with_name(const char *name) -{ - PurplePlugin *plugin; - GList *l; - - for (l = plugins; l != NULL; l = l->next) { - plugin = l->data; - - if (purple_strequal(plugin->info->name, name)) - return plugin; - } - - return NULL; -} - -PurplePlugin * -purple_plugins_find_with_filename(const char *filename) -{ - PurplePlugin *plugin; - GList *l; - - for (l = plugins; l != NULL; l = l->next) { - plugin = l->data; - - if (purple_strequal(plugin->path, filename)) - return plugin; - } - - return NULL; -} - -PurplePlugin * -purple_plugins_find_with_basename(const char *basename) -{ -#ifdef PURPLE_PLUGINS - PurplePlugin *plugin; - GList *l; - char *tmp; - - g_return_val_if_fail(basename != NULL, NULL); - - for (l = plugins; l != NULL; l = l->next) - { - plugin = (PurplePlugin *)l->data; - - if (plugin->path != NULL) { - tmp = purple_plugin_get_basename(plugin->path); - if (purple_strequal(tmp, basename)) - { - g_free(tmp); - return plugin; - } - g_free(tmp); - } - } - -#endif /* PURPLE_PLUGINS */ - - return NULL; -} - -PurplePlugin * -purple_plugins_find_with_id(const char *id) -{ - PurplePlugin *plugin; - GList *l; - - g_return_val_if_fail(id != NULL, NULL); - - for (l = plugins; l != NULL; l = l->next) - { - plugin = l->data; - - if (purple_strequal(plugin->info->id, id)) - return plugin; - } - - return NULL; -} - -GList * -purple_plugins_get_loaded(void) -{ - return loaded_plugins; -} - -GList * -purple_plugins_get_protocols(void) -{ - return protocol_plugins; -} - -GList * -purple_plugins_get_all(void) -{ - return plugins; -} - - -PurplePluginAction * -purple_plugin_action_new(const char* label, void (*callback)(PurplePluginAction *)) -{ - PurplePluginAction *act = g_new0(PurplePluginAction, 1); - - act->label = g_strdup(label); - act->callback = callback; - - return act; -} - -void -purple_plugin_action_free(PurplePluginAction *action) -{ - g_return_if_fail(action != NULL); - - g_free(action->label); - g_free(action); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugin.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,740 +0,0 @@ -/** - * @file plugin.h Plugin API - * @ingroup core - * @see @ref plugin-signals - * @see @ref plugin-ids - * @see @ref plugin-i18n - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_PLUGIN_H_ -#define _PURPLE_PLUGIN_H_ - -#include -#include -#include "signals.h" -#include "value.h" - -/** @copydoc _PurplePlugin */ -typedef struct _PurplePlugin PurplePlugin; -/** @copydoc _PurplePluginInfo */ -typedef struct _PurplePluginInfo PurplePluginInfo; -/** @copydoc _PurplePluginUiInfo */ -typedef struct _PurplePluginUiInfo PurplePluginUiInfo; -/** @copydoc _PurplePluginLoaderInfo */ -typedef struct _PurplePluginLoaderInfo PurplePluginLoaderInfo; - -/** @copydoc _PurplePluginAction */ -typedef struct _PurplePluginAction PurplePluginAction; - -typedef int PurplePluginPriority; /**< Plugin priority. */ - -#include "pluginpref.h" - -/** - * Plugin types. - */ -typedef enum -{ - PURPLE_PLUGIN_UNKNOWN = -1, /**< Unknown type. */ - PURPLE_PLUGIN_STANDARD = 0, /**< Standard plugin. */ - PURPLE_PLUGIN_LOADER, /**< Loader plugin. */ - PURPLE_PLUGIN_PROTOCOL /**< Protocol plugin. */ - -} PurplePluginType; - -#define PURPLE_PRIORITY_DEFAULT 0 -#define PURPLE_PRIORITY_HIGHEST 9999 -#define PURPLE_PRIORITY_LOWEST -9999 - -#define PURPLE_PLUGIN_FLAG_INVISIBLE 0x01 - -#define PURPLE_PLUGIN_MAGIC 5 /* once we hit 6.0.0 I think we can remove this */ - -/** - * Detailed information about a plugin. - * - * This is used in the version 2.0 API and up. - */ -struct _PurplePluginInfo -{ - unsigned int magic; - unsigned int major_version; - unsigned int minor_version; - PurplePluginType type; - char *ui_requirement; - unsigned long flags; - GList *dependencies; - PurplePluginPriority priority; - - char *id; - char *name; - char *version; - char *summary; - char *description; - char *author; - char *homepage; - - /** - * If a plugin defines a 'load' function, and it returns FALSE, - * then the plugin will not be loaded. - */ - gboolean (*load)(PurplePlugin *plugin); - gboolean (*unload)(PurplePlugin *plugin); - void (*destroy)(PurplePlugin *plugin); - - void *ui_info; /**< Used only by UI-specific plugins to build a preference screen with a custom UI */ - void *extra_info; - PurplePluginUiInfo *prefs_info; /**< Used by any plugin to display preferences. If #ui_info has been specified, this will be ignored. */ - - /** - * This callback has a different use depending on whether this - * plugin type is PURPLE_PLUGIN_STANDARD or PURPLE_PLUGIN_PROTOCOL. - * - * If PURPLE_PLUGIN_STANDARD then the list of actions will show up - * in the Tools menu, under a submenu with the name of the plugin. - * context will be NULL. - * - * If PURPLE_PLUGIN_PROTOCOL then the list of actions will show up - * in the Accounts menu, under a submenu with the name of the - * account. context will be set to the PurpleConnection for that - * account. This callback will only be called for online accounts. - */ - GList *(*actions)(PurplePlugin *plugin, gpointer context); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** - * Extra information for loader plugins. - */ -struct _PurplePluginLoaderInfo -{ - GList *exts; - - gboolean (*probe)(PurplePlugin *plugin); - gboolean (*load)(PurplePlugin *plugin); - gboolean (*unload)(PurplePlugin *plugin); - void (*destroy)(PurplePlugin *plugin); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -/** - * A plugin handle. - */ -struct _PurplePlugin -{ - gboolean native_plugin; /**< Native C plugin. */ - gboolean loaded; /**< The loaded state. */ - void *handle; /**< The module handle. */ - char *path; /**< The path to the plugin. */ - PurplePluginInfo *info; /**< The plugin information. */ - char *error; - void *ipc_data; /**< IPC data. */ - void *extra; /**< Plugin-specific data. */ - gboolean unloadable; /**< Unloadable */ - GList *dependent_plugins; /**< Plugins depending on this */ - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -#define PURPLE_PLUGIN_LOADER_INFO(plugin) \ - ((PurplePluginLoaderInfo *)(plugin)->info->extra_info) - -struct _PurplePluginUiInfo { - PurplePluginPrefFrame *(*get_plugin_pref_frame)(PurplePlugin *plugin); - - int page_num; /**< Reserved */ - PurplePluginPrefFrame *frame; /**< Reserved */ - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - -#define PURPLE_PLUGIN_HAS_PREF_FRAME(plugin) \ - ((plugin)->info != NULL && (plugin)->info->prefs_info != NULL) - -#define PURPLE_PLUGIN_UI_INFO(plugin) \ - ((PurplePluginUiInfo*)(plugin)->info->prefs_info) - - -/** - * The structure used in the actions member of PurplePluginInfo - */ -struct _PurplePluginAction { - char *label; - void (*callback)(PurplePluginAction *); - - /** set to the owning plugin */ - PurplePlugin *plugin; - - /** NULL for plugin actions menu, set to the PurpleConnection for - account actions menu */ - gpointer context; - - gpointer user_data; -}; - -#define PURPLE_PLUGIN_HAS_ACTIONS(plugin) \ - ((plugin)->info != NULL && (plugin)->info->actions != NULL) - -#define PURPLE_PLUGIN_ACTIONS(plugin, context) \ - (PURPLE_PLUGIN_HAS_ACTIONS(plugin)? \ - (plugin)->info->actions(plugin, context): NULL) - - -/** - * Handles the initialization of modules. - */ -#if !defined(PURPLE_PLUGINS) || defined(PURPLE_STATIC_PRPL) -# define _FUNC_NAME(x) purple_init_##x##_plugin -# define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ - gboolean _FUNC_NAME(pluginname)(void);\ - gboolean _FUNC_NAME(pluginname)(void) { \ - PurplePlugin *plugin = purple_plugin_new(TRUE, NULL); \ - plugin->info = &(plugininfo); \ - initfunc((plugin)); \ - purple_plugin_load((plugin)); \ - return purple_plugin_register(plugin); \ - } -#else /* PURPLE_PLUGINS && !PURPLE_STATIC_PRPL */ -# define PURPLE_INIT_PLUGIN(pluginname, initfunc, plugininfo) \ - G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin); \ - G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin) { \ - plugin->info = &(plugininfo); \ - initfunc((plugin)); \ - return purple_plugin_register(plugin); \ - } -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Plugin API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new plugin structure. - * - * @param native Whether or not the plugin is native. - * @param path The path to the plugin, or @c NULL if statically compiled. - * - * @return A new PurplePlugin structure. - */ -PurplePlugin *purple_plugin_new(gboolean native, const char *path); - -/** - * Probes a plugin, retrieving the information on it and adding it to the - * list of available plugins. - * - * @param filename The plugin's filename. - * - * @return The plugin handle. - * - * @see purple_plugin_load() - * @see purple_plugin_destroy() - */ -PurplePlugin *purple_plugin_probe(const char *filename); - -/** - * Registers a plugin and prepares it for loading. - * - * This shouldn't be called by anything but the internal module code. - * Plugins should use the PURPLE_INIT_PLUGIN() macro to register themselves - * with the core. - * - * @param plugin The plugin to register. - * - * @return @c TRUE if the plugin was registered successfully. Otherwise - * @c FALSE is returned (this happens if the plugin does not contain - * the necessary information). - */ -gboolean purple_plugin_register(PurplePlugin *plugin); - -/** - * Attempts to load a previously probed plugin. - * - * @param plugin The plugin to load. - * - * @return @c TRUE if successful, or @c FALSE otherwise. - * - * @see purple_plugin_reload() - * @see purple_plugin_unload() - */ -gboolean purple_plugin_load(PurplePlugin *plugin); - -/** - * Unloads the specified plugin. - * - * @param plugin The plugin handle. - * - * @return @c TRUE if successful, or @c FALSE otherwise. - * - * @see purple_plugin_load() - * @see purple_plugin_reload() - */ -gboolean purple_plugin_unload(PurplePlugin *plugin); - -/** - * Disable a plugin. - * - * This function adds the plugin to a list of plugins to "disable at the next - * startup" by excluding said plugins from the list of plugins to save. The - * UI needs to call purple_plugins_save_loaded() after calling this for it - * to have any effect. - * - * @since 2.3.0 - */ -void purple_plugin_disable(PurplePlugin *plugin); - -/** - * Reloads a plugin. - * - * @param plugin The old plugin handle. - * - * @return @c TRUE if successful, or @c FALSE otherwise. - * - * @see purple_plugin_load() - * @see purple_plugin_unload() - */ -gboolean purple_plugin_reload(PurplePlugin *plugin); - -/** - * Unloads a plugin and destroys the structure from memory. - * - * @param plugin The plugin handle. - */ -void purple_plugin_destroy(PurplePlugin *plugin); - -/** - * Returns whether or not a plugin is currently loaded. - * - * @param plugin The plugin. - * - * @return @c TRUE if loaded, or @c FALSE otherwise. - */ -gboolean purple_plugin_is_loaded(const PurplePlugin *plugin); - -/** - * Returns whether or not a plugin is unloadable. - * - * If this returns @c TRUE, the plugin is guaranteed to not - * be loadable. However, a return value of @c FALSE does not - * guarantee the plugin is loadable. - * - * @param plugin The plugin. - * - * @return @c TRUE if the plugin is known to be unloadable,\ - * @c FALSE otherwise - */ -gboolean purple_plugin_is_unloadable(const PurplePlugin *plugin); - -/** - * Returns a plugin's id. - * - * @param plugin The plugin. - * - * @return The plugin's id. - */ -const gchar *purple_plugin_get_id(const PurplePlugin *plugin); - -/** - * Returns a plugin's name. - * - * @param plugin The plugin. - * - * @return THe name of the plugin, or @c NULL. - */ -const gchar *purple_plugin_get_name(const PurplePlugin *plugin); - -/** - * Returns a plugin's version. - * - * @param plugin The plugin. - * - * @return The plugin's version or @c NULL. - */ -const gchar *purple_plugin_get_version(const PurplePlugin *plugin); - -/** - * Returns a plugin's summary. - * - * @param plugin The plugin. - * - * @return The plugin's summary. - */ -const gchar *purple_plugin_get_summary(const PurplePlugin *plugin); - -/** - * Returns a plugin's description. - * - * @param plugin The plugin. - * - * @return The plugin's description. - */ -const gchar *purple_plugin_get_description(const PurplePlugin *plugin); - -/** - * Returns a plugin's author. - * - * @param plugin The plugin. - * - * @return The plugin's author. - */ -const gchar *purple_plugin_get_author(const PurplePlugin *plugin); - -/** - * Returns a plugin's homepage. - * - * @param plugin The plugin. - * - * @return The plugin's homepage. - */ -const gchar *purple_plugin_get_homepage(const PurplePlugin *plugin); - -/*@}*/ - -/**************************************************************************/ -/** @name Plugin IPC API */ -/**************************************************************************/ -/*@{*/ - -/** - * Registers an IPC command in a plugin. - * - * @param plugin The plugin to register the command with. - * @param command The name of the command. - * @param func The function to execute. - * @param marshal The marshalling function. - * @param ret_value The return value type. - * @param num_params The number of parameters. - * @param ... The parameter types. - * - * @return TRUE if the function was registered successfully, or - * FALSE otherwise. - */ -gboolean purple_plugin_ipc_register(PurplePlugin *plugin, const char *command, - PurpleCallback func, - PurpleSignalMarshalFunc marshal, - PurpleValue *ret_value, int num_params, ...); - -/** - * Unregisters an IPC command in a plugin. - * - * @param plugin The plugin to unregister the command from. - * @param command The name of the command. - */ -void purple_plugin_ipc_unregister(PurplePlugin *plugin, const char *command); - -/** - * Unregisters all IPC commands in a plugin. - * - * @param plugin The plugin to unregister the commands from. - */ -void purple_plugin_ipc_unregister_all(PurplePlugin *plugin); - -/** - * Returns a list of value types used for an IPC command. - * - * @param plugin The plugin. - * @param command The name of the command. - * @param ret_value The returned return value. - * @param num_params The returned number of parameters. - * @param params The returned list of parameters. - * - * @return TRUE if the command was found, or FALSE otherwise. - */ -gboolean purple_plugin_ipc_get_params(PurplePlugin *plugin, const char *command, - PurpleValue **ret_value, int *num_params, - PurpleValue ***params); - -/** - * Executes an IPC command. - * - * @param plugin The plugin to execute the command on. - * @param command The name of the command. - * @param ok TRUE if the call was successful, or FALSE otherwise. - * @param ... The parameters to pass. - * - * @return The return value, which will be NULL if the command doesn't - * return a value. - */ -void *purple_plugin_ipc_call(PurplePlugin *plugin, const char *command, - gboolean *ok, ...); - -/*@}*/ - -/**************************************************************************/ -/** @name Plugins API */ -/**************************************************************************/ -/*@{*/ - -/** - * Add a new directory to search for plugins - * - * @param path The new search path. - */ -void purple_plugins_add_search_path(const char *path); - -/** - * Returns a list of plugin search paths. - * - * @constreturn A list of searched paths. - * - * @since 2.6.0 - */ -GList *purple_plugins_get_search_paths(void); - -/** - * Unloads all loaded plugins. - */ -void purple_plugins_unload_all(void); - -/** - * Unloads all plugins of a specific type. - */ -void purple_plugins_unload(PurplePluginType type); - -/** - * Destroys all registered plugins. - */ -void purple_plugins_destroy_all(void); - -/** - * Saves the list of loaded plugins to the specified preference key - * - * @param key The preference key to save the list of plugins to. - */ -void purple_plugins_save_loaded(const char *key); - -/** - * Attempts to load all the plugins in the specified preference key - * that were loaded when purple last quit. - * - * @param key The preference key containing the list of plugins. - */ -void purple_plugins_load_saved(const char *key); - -/** - * Probes for plugins in the registered module paths. - * - * @param ext The extension type to probe for, or @c NULL for all. - * - * @see purple_plugin_set_probe_path() - */ -void purple_plugins_probe(const char *ext); - -/** - * Returns whether or not plugin support is enabled. - * - * @return TRUE if plugin support is enabled, or FALSE otherwise. - */ -gboolean purple_plugins_enabled(void); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when probing is finished. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated If you need this, ask for a plugin-probe signal to be added. - */ -void purple_plugins_register_probe_notify_cb(void (*func)(void *), void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when probing is finished. - * - * @param func The callback function. - * @deprecated If you need this, ask for a plugin-probe signal to be added. - */ -void purple_plugins_unregister_probe_notify_cb(void (*func)(void *)); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when a plugin is loaded. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated Use the plugin-load signal instead. - */ -void purple_plugins_register_load_notify_cb(void (*func)(PurplePlugin *, void *), - void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when a plugin is loaded. - * - * @param func The callback function. - * @deprecated Use the plugin-load signal instead. - */ -void purple_plugins_unregister_load_notify_cb(void (*func)(PurplePlugin *, void *)); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Registers a function that will be called when a plugin is unloaded. - * - * @param func The callback function. - * @param data Data to pass to the callback. - * @deprecated Use the plugin-unload signal instead. - */ -void purple_plugins_register_unload_notify_cb(void (*func)(PurplePlugin *, void *), - void *data); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PLUGIN_C_) -/** - * Unregisters a function that would be called when a plugin is unloaded. - * - * @param func The callback function. - * @deprecated Use the plugin-unload signal instead. - */ -void purple_plugins_unregister_unload_notify_cb(void (*func)(PurplePlugin *, - void *)); -#endif - -/** - * Finds a plugin with the specified name. - * - * @param name The plugin name. - * - * @return The plugin if found, or @c NULL if not found. - */ -PurplePlugin *purple_plugins_find_with_name(const char *name); - -/** - * Finds a plugin with the specified filename (filename with a path). - * - * @param filename The plugin filename. - * - * @return The plugin if found, or @c NULL if not found. - */ -PurplePlugin *purple_plugins_find_with_filename(const char *filename); - -/** - * Finds a plugin with the specified basename (filename without a path). - * - * @param basename The plugin basename. - * - * @return The plugin if found, or @c NULL if not found. - */ -PurplePlugin *purple_plugins_find_with_basename(const char *basename); - -/** - * Finds a plugin with the specified plugin ID. - * - * @param id The plugin ID. - * - * @return The plugin if found, or @c NULL if not found. - */ -PurplePlugin *purple_plugins_find_with_id(const char *id); - -/** - * Returns a list of all loaded plugins. - * - * @constreturn A list of all loaded plugins. - */ -GList *purple_plugins_get_loaded(void); - -/** - * Returns a list of all valid protocol plugins. A protocol - * plugin is considered invalid if it does not contain the call - * to the PURPLE_INIT_PLUGIN() macro, or if it was compiled - * against an incompatable API version. - * - * @constreturn A list of all protocol plugins. - */ -GList *purple_plugins_get_protocols(void); - -/** - * Returns a list of all plugins, whether loaded or not. - * - * @constreturn A list of all plugins. - */ -GList *purple_plugins_get_all(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Plugins SubSytem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the plugin subsystem handle. - * - * @return The plugin sybsystem handle. - */ -void *purple_plugins_get_handle(void); - -/** - * Initializes the plugin subsystem - */ -void purple_plugins_init(void); - -/** - * Uninitializes the plugin subsystem - */ -void purple_plugins_uninit(void); - -/*@}*/ - -/** - * Allocates and returns a new PurplePluginAction. - * - * @param label The description of the action to show to the user. - * @param callback The callback to call when the user selects this action. - */ -PurplePluginAction *purple_plugin_action_new(const char* label, void (*callback)(PurplePluginAction *)); - -/** - * Frees a PurplePluginAction - * - * @param action The PurplePluginAction to free. - */ -void purple_plugin_action_free(PurplePluginAction *action); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PLUGIN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,319 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "debug.h" -#include "internal.h" -#include "pluginpref.h" -#include "prefs.h" - -struct _PurplePluginPrefFrame -{ - GList *prefs; -}; - -struct _PurplePluginPref -{ - char *name; - char *label; - - PurplePluginPrefType type; - - int min; - int max; - GList *choices; - unsigned int max_length; - gboolean masked; - PurpleStringFormatType format; -}; - -PurplePluginPrefFrame * -purple_plugin_pref_frame_new() -{ - PurplePluginPrefFrame *frame; - - frame = g_new0(PurplePluginPrefFrame, 1); - - return frame; -} - -void -purple_plugin_pref_frame_destroy(PurplePluginPrefFrame *frame) -{ - g_return_if_fail(frame != NULL); - - g_list_foreach(frame->prefs, (GFunc)purple_plugin_pref_destroy, NULL); - g_list_free(frame->prefs); - g_free(frame); -} - -void -purple_plugin_pref_frame_add(PurplePluginPrefFrame *frame, PurplePluginPref *pref) -{ - g_return_if_fail(frame != NULL); - g_return_if_fail(pref != NULL); - - frame->prefs = g_list_append(frame->prefs, pref); -} - -GList * -purple_plugin_pref_frame_get_prefs(PurplePluginPrefFrame *frame) -{ - g_return_val_if_fail(frame != NULL, NULL); - g_return_val_if_fail(frame->prefs != NULL, NULL); - - return frame->prefs; -} - -PurplePluginPref * -purple_plugin_pref_new() -{ - PurplePluginPref *pref; - - pref = g_new0(PurplePluginPref, 1); - - return pref; -} - -PurplePluginPref * -purple_plugin_pref_new_with_name(const char *name) -{ - PurplePluginPref *pref; - - g_return_val_if_fail(name != NULL, NULL); - - pref = g_new0(PurplePluginPref, 1); - pref->name = g_strdup(name); - - return pref; -} - -PurplePluginPref * -purple_plugin_pref_new_with_label(const char *label) -{ - PurplePluginPref *pref; - - g_return_val_if_fail(label != NULL, NULL); - - pref = g_new0(PurplePluginPref, 1); - pref->label = g_strdup(label); - - return pref; -} - -PurplePluginPref * -purple_plugin_pref_new_with_name_and_label(const char *name, const char *label) -{ - PurplePluginPref *pref; - - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(label != NULL, NULL); - - pref = g_new0(PurplePluginPref, 1); - pref->name = g_strdup(name); - pref->label = g_strdup(label); - - return pref; -} - -void -purple_plugin_pref_destroy(PurplePluginPref *pref) -{ - g_return_if_fail(pref != NULL); - - g_free(pref->name); - g_free(pref->label); - g_list_free(pref->choices); - g_free(pref); -} - -void -purple_plugin_pref_set_name(PurplePluginPref *pref, const char *name) -{ - g_return_if_fail(pref != NULL); - g_return_if_fail(name != NULL); - - g_free(pref->name); - pref->name = g_strdup(name); -} - -const char * -purple_plugin_pref_get_name(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, NULL); - - return pref->name; -} - -void -purple_plugin_pref_set_label(PurplePluginPref *pref, const char *label) -{ - g_return_if_fail(pref != NULL); - g_return_if_fail(label != NULL); - - g_free(pref->label); - pref->label = g_strdup(label); -} - -const char * -purple_plugin_pref_get_label(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, NULL); - - return pref->label; -} - -void -purple_plugin_pref_set_bounds(PurplePluginPref *pref, int min, int max) -{ - int tmp; - - g_return_if_fail(pref != NULL); - g_return_if_fail(pref->name != NULL); - - if (purple_prefs_get_type(pref->name) != PURPLE_PREF_INT) - { - purple_debug_warning("pluginpref", - "purple_plugin_pref_set_bounds: %s is not an integer pref\n", - pref->name); - return; - } - - if (min > max) - { - tmp = min; - min = max; - max = tmp; - } - - pref->min = min; - pref->max = max; -} - -void purple_plugin_pref_get_bounds(PurplePluginPref *pref, int *min, int *max) -{ - g_return_if_fail(pref != NULL); - g_return_if_fail(pref->name != NULL); - - if (purple_prefs_get_type(pref->name) != PURPLE_PREF_INT) - { - purple_debug_warning("pluginpref", - "purple_plugin_pref_get_bounds: %s is not an integer pref\n", - pref->name); - return; - } - - *min = pref->min; - *max = pref->max; -} - -void -purple_plugin_pref_set_type(PurplePluginPref *pref, PurplePluginPrefType type) -{ - g_return_if_fail(pref != NULL); - - pref->type = type; -} - -PurplePluginPrefType -purple_plugin_pref_get_type(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, PURPLE_PLUGIN_PREF_NONE); - - return pref->type; -} - -void -purple_plugin_pref_add_choice(PurplePluginPref *pref, const char *label, gpointer choice) -{ - g_return_if_fail(pref != NULL); - g_return_if_fail(label != NULL); - g_return_if_fail(choice || purple_prefs_get_type(pref->name) == PURPLE_PREF_INT); - - pref->choices = g_list_append(pref->choices, (gpointer)label); - pref->choices = g_list_append(pref->choices, choice); -} - -GList * -purple_plugin_pref_get_choices(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, NULL); - - return pref->choices; -} - -void -purple_plugin_pref_set_max_length(PurplePluginPref *pref, unsigned int max_length) -{ - g_return_if_fail(pref != NULL); - - pref->max_length = max_length; -} - -unsigned int -purple_plugin_pref_get_max_length(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, 0); - - return pref->max_length; -} - -void -purple_plugin_pref_set_masked(PurplePluginPref *pref, gboolean masked) -{ - g_return_if_fail(pref != NULL); - - pref->masked = masked; -} - -gboolean -purple_plugin_pref_get_masked(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, FALSE); - - return pref->masked; -} - -void -purple_plugin_pref_set_format_type(PurplePluginPref *pref, PurpleStringFormatType format) -{ - g_return_if_fail(pref != NULL); - g_return_if_fail(pref->type == PURPLE_PLUGIN_PREF_STRING_FORMAT); - - pref->format = format; -} - -PurpleStringFormatType -purple_plugin_pref_get_format_type(PurplePluginPref *pref) -{ - g_return_val_if_fail(pref != NULL, 0); - - if (pref->type != PURPLE_PLUGIN_PREF_STRING_FORMAT) - return PURPLE_STRING_FORMAT_TYPE_NONE; - - return pref->format; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pluginpref.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/** - * @file pluginpref.h Plugin Preferences API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _PURPLE_PLUGINPREF_H_ -#define _PURPLE_PLUGINPREF_H_ - -typedef struct _PurplePluginPrefFrame PurplePluginPrefFrame; -typedef struct _PurplePluginPref PurplePluginPref; - -/** - * String format for preferences. - */ -typedef enum -{ - PURPLE_STRING_FORMAT_TYPE_NONE = 0, /**< The string is plain text. */ - PURPLE_STRING_FORMAT_TYPE_MULTILINE = 1 << 0, /**< The string can have newlines. */ - PURPLE_STRING_FORMAT_TYPE_HTML = 1 << 1 /**< The string can be in HTML. */ -} PurpleStringFormatType; - -typedef enum { - PURPLE_PLUGIN_PREF_NONE, - PURPLE_PLUGIN_PREF_CHOICE, - PURPLE_PLUGIN_PREF_INFO, /**< no-value label */ - PURPLE_PLUGIN_PREF_STRING_FORMAT /**< The preference has a string value. */ -} PurplePluginPrefType; - -#include -#include "prefs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Plugin Preference API */ -/**************************************************************************/ -/*@{*/ - -/** - * Create a new plugin preference frame - * - * @return a new PurplePluginPrefFrame - */ -PurplePluginPrefFrame *purple_plugin_pref_frame_new(void); - -/** - * Destroy a plugin preference frame - * - * @param frame The plugin frame to destroy - */ -void purple_plugin_pref_frame_destroy(PurplePluginPrefFrame *frame); - -/** - * Adds a plugin preference to a plugin preference frame - * - * @param frame The plugin frame to add the preference to - * @param pref The preference to add to the frame - */ -void purple_plugin_pref_frame_add(PurplePluginPrefFrame *frame, PurplePluginPref *pref); - -/** - * Get the plugin preferences from a plugin preference frame - * - * @param frame The plugin frame to get the plugin preferences from - * @constreturn a GList of plugin preferences - */ -GList *purple_plugin_pref_frame_get_prefs(PurplePluginPrefFrame *frame); - -/** - * Create a new plugin preference - * - * @return a new PurplePluginPref - */ -PurplePluginPref *purple_plugin_pref_new(void); - -/** - * Create a new plugin preference with name - * - * @param name The name of the pref - * @return a new PurplePluginPref - */ -PurplePluginPref *purple_plugin_pref_new_with_name(const char *name); - -/** - * Create a new plugin preference with label - * - * @param label The label to be displayed - * @return a new PurplePluginPref - */ -PurplePluginPref *purple_plugin_pref_new_with_label(const char *label); - -/** - * Create a new plugin preference with name and label - * - * @param name The name of the pref - * @param label The label to be displayed - * @return a new PurplePluginPref - */ -PurplePluginPref *purple_plugin_pref_new_with_name_and_label(const char *name, const char *label); - -/** - * Destroy a plugin preference - * - * @param pref The preference to destroy - */ -void purple_plugin_pref_destroy(PurplePluginPref *pref); - -/** - * Set a plugin pref name - * - * @param pref The plugin pref - * @param name The name of the pref - */ -void purple_plugin_pref_set_name(PurplePluginPref *pref, const char *name); - -/** - * Get a plugin pref name - * - * @param pref The plugin pref - * @return The name of the pref - */ -const char *purple_plugin_pref_get_name(PurplePluginPref *pref); - -/** - * Set a plugin pref label - * - * @param pref The plugin pref - * @param label The label for the plugin pref - */ -void purple_plugin_pref_set_label(PurplePluginPref *pref, const char *label); - -/** - * Get a plugin pref label - * - * @param pref The plugin pref - * @return The label for the plugin pref - */ -const char *purple_plugin_pref_get_label(PurplePluginPref *pref); - -/** - * Set the bounds for an integer pref - * - * @param pref The plugin pref - * @param min The min value - * @param max The max value - */ -void purple_plugin_pref_set_bounds(PurplePluginPref *pref, int min, int max); - -/** - * Get the bounds for an integer pref - * - * @param pref The plugin pref - * @param min The min value - * @param max The max value - */ -void purple_plugin_pref_get_bounds(PurplePluginPref *pref, int *min, int *max); - -/** - * Set the type of a plugin pref - * - * @param pref The plugin pref - * @param type The type - */ -void purple_plugin_pref_set_type(PurplePluginPref *pref, PurplePluginPrefType type); - -/** - * Get the type of a plugin pref - * - * @param pref The plugin pref - * @return The type - */ -PurplePluginPrefType purple_plugin_pref_get_type(PurplePluginPref *pref); - -/** - * Set the choices for a choices plugin pref - * - * @param pref The plugin pref - * @param label The label for the choice - * @param choice A gpointer of the choice - */ -void purple_plugin_pref_add_choice(PurplePluginPref *pref, const char *label, gpointer choice); - -/** - * Get the choices for a choices plugin pref - * - * @param pref The plugin pref - * @constreturn GList of the choices - */ -GList *purple_plugin_pref_get_choices(PurplePluginPref *pref); - -/** - * Set the max length for a string plugin pref - * - * @param pref The plugin pref - * @param max_length The max length of the string - */ -void purple_plugin_pref_set_max_length(PurplePluginPref *pref, unsigned int max_length); - -/** - * Get the max length for a string plugin pref - * - * @param pref The plugin pref - * @return the max length - */ -unsigned int purple_plugin_pref_get_max_length(PurplePluginPref *pref); - -/** - * Sets the masking of a string plugin pref - * - * @param pref The plugin pref - * @param mask The value to set - */ -void purple_plugin_pref_set_masked(PurplePluginPref *pref, gboolean mask); - -/** - * Gets the masking of a string plugin pref - * - * @param pref The plugin pref - * @return The masking - */ -gboolean purple_plugin_pref_get_masked(PurplePluginPref *pref); - -/** - * Sets the format type for a formattable-string plugin pref. You need to set the - * pref type to PURPLE_PLUGIN_PREF_STRING_FORMAT first before setting the format. - * - * @param pref The plugin pref - * @param format The format of the string - */ -void purple_plugin_pref_set_format_type(PurplePluginPref *pref, PurpleStringFormatType format); - -/** - * Gets the format type of the formattable-string plugin pref. - * - * @param pref The plugin pref - * @return The format of the pref - */ -PurpleStringFormatType purple_plugin_pref_get_format_type(PurplePluginPref *pref); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PLUGINPREF_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/autoaccept.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/autoaccept.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/autoaccept.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/autoaccept.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,330 +0,0 @@ -/* - * Autoaccept - Auto-accept file transfers from selected users - * Copyright (C) 2006 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" - -#define PLUGIN_ID "core-plugin_pack-autoaccept" -#define PLUGIN_NAME N_("Autoaccept") -#define PLUGIN_STATIC_NAME Autoaccept -#define PLUGIN_SUMMARY N_("Auto-accept file transfer requests from selected users.") -#define PLUGIN_DESCRIPTION N_("Auto-accept file transfer requests from selected users.") -#define PLUGIN_AUTHOR "Sadrul H Chowdhury " - -/* System headers */ -#include -#if GLIB_CHECK_VERSION(2,6,0) -# include -#else -# include -# include -# define g_mkdir mkdir -#endif - -/* Purple headers */ -#include -#include - -#include -#include -#include -#include -#include -#include - -#define PREF_PREFIX "/plugins/core/" PLUGIN_ID -#define PREF_PATH PREF_PREFIX "/path" -#define PREF_STRANGER PREF_PREFIX "/reject_stranger" -#define PREF_NOTIFY PREF_PREFIX "/notify" -#define PREF_NEWDIR PREF_PREFIX "/newdir" - -typedef enum -{ - FT_ASK, - FT_ACCEPT, - FT_REJECT -} AutoAcceptSetting; - -static gboolean -ensure_path_exists(const char *dir) -{ - if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) - { - if (purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR)) - return FALSE; - } - - return TRUE; -} - -static void -auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my) -{ - if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) && - !purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, xfer->who, xfer->account)) - { - char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."), - xfer->filename, xfer->who); - purple_notify_info(NULL, _("Autoaccept complete"), message, NULL); - g_free(message); - } -} - -static void -file_recv_request_cb(PurpleXfer *xfer, gpointer handle) -{ - PurpleAccount *account; - PurpleBlistNode *node; - const char *pref; - char *filename; - char *dirname; - - account = xfer->account; - node = PURPLE_BLIST_NODE(purple_find_buddy(account, xfer->who)); - - if (!node) - { - if (purple_prefs_get_bool(PREF_STRANGER)) - xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - return; - } - - node = purple_blist_node_get_parent(node); - g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); - - pref = purple_prefs_get_string(PREF_PATH); - switch (purple_blist_node_get_int(node, "autoaccept")) - { - case FT_ASK: - break; - case FT_ACCEPT: - if (ensure_path_exists(pref)) - { - int count = 1; - const char *escape; - gchar **name_and_ext; - const gchar *name; - gchar *ext; - - if (purple_prefs_get_bool(PREF_NEWDIR)) - dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL); - else - dirname = g_build_filename(pref, NULL); - - if (!ensure_path_exists(dirname)) - { - g_free(dirname); - break; - } - - escape = purple_escape_filename(xfer->filename); - filename = g_build_filename(dirname, escape, NULL); - - /* Split at the first dot, to avoid uniquifying "foo.tar.gz" to "foo.tar-2.gz" */ - name_and_ext = g_strsplit(escape, ".", 2); - name = name_and_ext[0]; - g_return_if_fail(name != NULL); - if (name_and_ext[1] != NULL) { - /* g_strsplit does not include the separator in each chunk. */ - ext = g_strdup_printf(".%s", name_and_ext[1]); - } else { - ext = g_strdup(""); - } - - /* Make sure the file doesn't exist. Do we want some better checking than this? */ - /* FIXME: There is a race here: if the newly uniquified file name gets created between - * this g_file_test and the transfer starting, the file created in the meantime - * will be clobbered. But it's not at all straightforward to fix. - */ - while (g_file_test(filename, G_FILE_TEST_EXISTS)) { - char *file = g_strdup_printf("%s-%d%s", name, count++, ext); - g_free(filename); - filename = g_build_filename(dirname, file, NULL); - g_free(file); - } - - purple_xfer_request_accepted(xfer, filename); - - g_strfreev(name_and_ext); - g_free(ext); - g_free(dirname); - g_free(filename); - } - - purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle, - PURPLE_CALLBACK(auto_accept_complete_cb), xfer); - break; - case FT_REJECT: - xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - break; - } -} - -static void -save_cb(PurpleBlistNode *node, int choice) -{ - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) - node = purple_blist_node_get_parent(node); - g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); - purple_blist_node_set_int(node, "autoaccept", choice); -} - -static void -set_auto_accept_settings(PurpleBlistNode *node, gpointer plugin) -{ - char *message; - - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) - node = purple_blist_node_get_parent(node); - g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node)); - - message = g_strdup_printf(_("When a file-transfer request arrives from %s"), - purple_contact_get_alias((PurpleContact *)node)); - purple_request_choice(plugin, _("Set Autoaccept Setting"), message, - NULL, purple_blist_node_get_int(node, "autoaccept"), - _("_Save"), G_CALLBACK(save_cb), - _("_Cancel"), NULL, - NULL, NULL, NULL, - node, - _("Ask"), FT_ASK, - _("Auto Accept"), FT_ACCEPT, - _("Auto Reject"), FT_REJECT, - NULL, purple_contact_get_alias((PurpleContact *)node), NULL, - NULL); - g_free(message); -} - -static void -context_menu(PurpleBlistNode *node, GList **menu, gpointer plugin) -{ - PurpleMenuAction *action; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node) && !PURPLE_BLIST_NODE_IS_CONTACT(node) && - !(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) - return; - - action = purple_menu_action_new(_("Autoaccept File Transfers..."), - PURPLE_CALLBACK(set_auto_accept_settings), plugin, NULL); - (*menu) = g_list_prepend(*menu, action); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, - PURPLE_CALLBACK(file_recv_request_cb), plugin); - purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, - PURPLE_CALLBACK(context_menu), plugin); - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - /* XXX: Is there a better way than this? There really should be. */ - pref = purple_plugin_pref_new_with_name_and_label(PREF_PATH, _("Path to save the files in\n" - "(Please provide the full path)")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name_and_label(PREF_STRANGER, - _("Automatically reject from users not in buddy list")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name_and_label(PREF_NOTIFY, - _("Notify with a popup when an autoaccepted file transfer is complete\n" - "(only when there's no conversation with the sender)")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name_and_label(PREF_NEWDIR, - _("Create a new directory for each user")); - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, /* Magic */ - PURPLE_MAJOR_VERSION, /* Purple Major Version */ - PURPLE_MINOR_VERSION, /* Purple Minor Version */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - NULL, /* ui requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* plugin id */ - PLUGIN_NAME, /* name */ - DISPLAY_VERSION, /* version */ - PLUGIN_SUMMARY, /* summary */ - PLUGIN_DESCRIPTION, /* description */ - PLUGIN_AUTHOR, /* author */ - PURPLE_WEBSITE, /* website */ - - plugin_load, /* load */ - plugin_unload, /* unload */ - NULL, /* destroy */ - - NULL, /* ui_info */ - NULL, /* extra_info */ - &prefs_info, /* prefs_info */ - NULL, /* actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) { - char *dirname; - - dirname = g_build_filename(purple_user_dir(), "autoaccept", NULL); - purple_prefs_add_none(PREF_PREFIX); - purple_prefs_add_string(PREF_PATH, dirname); - purple_prefs_add_bool(PREF_STRANGER, TRUE); - purple_prefs_add_bool(PREF_NOTIFY, TRUE); - purple_prefs_add_bool(PREF_NEWDIR, TRUE); - g_free(dirname); -} - -PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/buddynote.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/buddynote.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/buddynote.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/buddynote.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * BuddyNote - Store notes on particular buddies - * Copyright (C) 2004 Stu Tomlinson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ -#include "internal.h" - -#include -#include -#include -#include -#include -#include - -static void -dont_do_it_cb(PurpleBlistNode *node, const char *note) -{ -} - -static void -do_it_cb(PurpleBlistNode *node, const char *note) -{ - purple_blist_node_set_string(node, "notes", note); -} - -static void -buddynote_edit_cb(PurpleBlistNode *node, gpointer data) -{ - const char *note; - - note = purple_blist_node_get_string(node, "notes"); - - purple_request_input(node, _("Notes"), - _("Enter your notes below..."), - NULL, - note, TRUE, FALSE, "html", - _("Save"), G_CALLBACK(do_it_cb), - _("Cancel"), G_CALLBACK(dont_do_it_cb), - NULL, NULL, NULL, - node); -} - -static void -buddynote_extended_menu_cb(PurpleBlistNode *node, GList **m) -{ - PurpleMenuAction *bna = NULL; - - if (purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE) - return; - - *m = g_list_append(*m, bna); - bna = purple_menu_action_new(_("Edit Notes..."), PURPLE_CALLBACK(buddynote_edit_cb), NULL, NULL); - *m = g_list_append(*m, bna); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - - purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", - plugin, PURPLE_CALLBACK(buddynote_extended_menu_cb), NULL); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, /**< major version */ - PURPLE_MINOR_VERSION, /**< minor version */ - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "core-plugin_pack-buddynote", /**< id */ - N_("Buddy Notes"), /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Store notes on particular buddies."), /**< summary */ - N_("Adds the option to store notes for buddies " - "on your buddy list."), /**< description */ - "Stu Tomlinson ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void -init_plugin(PurplePlugin *plugin) { -} - -PURPLE_INIT_PLUGIN(buddynote, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ciphertest.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ciphertest.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ciphertest.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ciphertest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,292 +0,0 @@ -/* - * A plugin to test the ciphers that ship with purple - * - * Copyright (C) 2004, Gary Kramlich - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifndef PURPLE_PLUGINS -#define PURPLE_PLUGINS -#endif - -#include "internal.h" - -#include -#include - -#include "cipher.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -struct test { - const gchar *question; - const gchar *answer; -}; - -/************************************************************************** - * MD5 Stuff - **************************************************************************/ -struct test md5_tests[8] = { - { "", "d41d8cd98f00b204e9800998ecf8427e"}, - { "a", "0cc175b9c0f1b6a831c399e269772661"}, - { "abc", "900150983cd24fb0d6963f7d28e17f72"}, - { "message digest", "f96b697d7cb7938d525a2f31aaf161d0"}, - { "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b"}, - { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789", "d174ab98d277d9f5a5611c2c9f419d9f"}, - {"123456789012345678901234567" - "890123456789012345678901234" - "56789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a"}, - { NULL, NULL } -}; - -static void -cipher_test_md5(void) { - PurpleCipher *cipher; - PurpleCipherContext *context; - gchar digest[33]; - gboolean ret; - gint i = 0; - - cipher = purple_ciphers_find_cipher("md5"); - if(!cipher) { - purple_debug_info("cipher-test", - "could not find md5 cipher, not testing\n"); - return; - } - - purple_debug_info("cipher-test", "Running md5 tests\n"); - - context = purple_cipher_context_new(cipher, NULL); - - while(md5_tests[i].answer) { - purple_debug_info("cipher-test", "Test %02d:\n", i); - purple_debug_info("cipher-test", "Testing '%s'\n", md5_tests[i].question); - - purple_cipher_context_append(context, (guchar *)md5_tests[i].question, - strlen(md5_tests[i].question)); - - ret = purple_cipher_context_digest_to_str(context, sizeof(digest), - digest, NULL); - - if(!ret) { - purple_debug_info("cipher-test", "failed\n"); - } else { - purple_debug_info("cipher-test", "\tGot: %s\n", digest); - purple_debug_info("cipher-test", "\tWanted: %s\n", - md5_tests[i].answer); - } - - purple_cipher_context_reset(context, NULL); - i++; - } - - purple_cipher_context_destroy(context); - - purple_debug_info("cipher-test", "md5 tests completed\n\n"); -} - -/************************************************************************** - * SHA-1 stuff - **************************************************************************/ -struct test sha1_tests[5] = { - {"a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"}, - {"abc", "a9993e364706816aba3e25717850c26c9cd0d89d"} , - {"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "84983e441c3bd26ebaae4aa1f95129e5e54670f1"} , - {NULL, "34aa973cd4c4daa4f61eeb2bdbad27316534016f"}, - {NULL, NULL} -}; - -static void -cipher_test_sha1(void) { - PurpleCipher *cipher; - PurpleCipherContext *context; - gchar digest[41]; - gint i = 0; - gboolean ret; - - cipher = purple_ciphers_find_cipher("sha1"); - if(!cipher) { - purple_debug_info("cipher-test", - "could not find sha1 cipher, not testing\n"); - return; - } - - purple_debug_info("cipher-test", "Running sha1 tests\n"); - - context = purple_cipher_context_new(cipher, NULL); - - while(sha1_tests[i].answer) { - purple_debug_info("cipher-test", "Test %02d:\n", i); - purple_debug_info("cipher-test", "Testing '%s'\n", - (sha1_tests[i].question != NULL) ? - sha1_tests[i].question : "'a'x1000, 1000 times"); - - if(sha1_tests[i].question) { - purple_cipher_context_append(context, (guchar *)sha1_tests[i].question, - strlen(sha1_tests[i].question)); - } else { - gint j; - guchar buff[1000]; - - memset(buff, 'a', 1000); - - for(j = 0; j < 1000; j++) - purple_cipher_context_append(context, buff, 1000); - } - - ret = purple_cipher_context_digest_to_str(context, sizeof(digest), - digest, NULL); - - if(!ret) { - purple_debug_info("cipher-test", "failed\n"); - } else { - purple_debug_info("cipher-test", "\tGot: %s\n", digest); - purple_debug_info("cipher-test", "\tWanted: %s\n", - sha1_tests[i].answer); - } - - purple_cipher_context_reset(context, NULL); - i++; - } - - purple_cipher_context_destroy(context); - - purple_debug_info("cipher-test", "sha1 tests completed\n\n"); -} - -static void -cipher_test_digest(void) -{ - const gchar *nonce = "dcd98b7102dd2f0e8b11d0f600bfb0c093"; - const gchar *client_nonce = "0a4f113b"; - const gchar *username = "Mufasa"; - const gchar *realm = "testrealm@host.com"; - const gchar *password = "Circle Of Life"; - const gchar *algorithm = "md5"; - const gchar *nonce_count = "00000001"; - const gchar *method = "GET"; - const gchar *qop = "auth"; - const gchar *digest_uri = "/dir/index.html"; - const gchar *entity = NULL; - - gchar *session_key; - - purple_debug_info("cipher-test", "Running HTTP Digest tests\n"); - - session_key = purple_cipher_http_digest_calculate_session_key( - algorithm, username, realm, password, - nonce, client_nonce); - - if (session_key == NULL) - { - purple_debug_info("cipher-test", - "purple_cipher_http_digest_calculate_session_key failed.\n"); - } - else - { - gchar *response; - - purple_debug_info("cipher-test", "\tsession_key: Got: %s\n", session_key); - purple_debug_info("cipher-test", "\tsession_key: Wanted: %s\n", "939e7578ed9e3c518a452acee763bce9"); - - response = purple_cipher_http_digest_calculate_response( - algorithm, method, digest_uri, qop, entity, - nonce, nonce_count, client_nonce, session_key); - - g_free(session_key); - - if (response == NULL) - { - purple_debug_info("cipher-test", - "purple_cipher_http_digest_calculate_session_key failed.\n"); - } - else - { - purple_debug_info("cipher-test", "\tresponse: Got: %s\n", response); - purple_debug_info("cipher-test", "\tresponse: Wanted: %s\n", "6629fae49393a05397450978507c4ef1"); - g_free(response); - } - } - - purple_debug_info("cipher-test", "HTTP Digest tests completed\n\n"); -} - -/************************************************************************** - * Plugin stuff - **************************************************************************/ -static gboolean -plugin_load(PurplePlugin *plugin) { - cipher_test_md5(); - cipher_test_sha1(); - cipher_test_digest(); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) { - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "core-cipher-test", /**< id */ - N_("Cipher Test"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Tests the ciphers that ship with libpurple."), - /** description */ - N_("Tests the ciphers that ship with libpurple."), - "Gary Kramlich ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) { -} - -PURPLE_INIT_PLUGIN(cipher_test, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/codeinline.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/codeinline.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/codeinline.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/codeinline.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "plugin.h" -#include "notify.h" -#include "util.h" -#include "version.h" - -PurplePlugin *plugin_handle = NULL; - -static gboolean outgoing_msg_cb(PurpleAccount *account, const char *who, char **message, - PurpleConversation *conv, PurpleMessageFlags flags, gpointer null) -{ - char *m; - char **ms = g_strsplit(*message, "", -1); - m = g_strjoinv("", ms); - g_strfreev(ms); - - ms = g_strsplit(m, "", -1); - g_free(m); - m = g_strjoinv("", ms); - g_free(*message); - *message = m; - return FALSE; -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *handle = purple_conversations_get_handle(); - plugin_handle = plugin; - purple_signal_connect(handle, "writing-im-msg", plugin, - PURPLE_CALLBACK(outgoing_msg_cb), NULL); - purple_signal_connect(handle, "sending-im-msg", plugin, - PURPLE_CALLBACK(outgoing_msg_cb), NULL); - - return TRUE; -} - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - "codeinline", - "Code Inline", - "1.0", - "Formats text as code", - "Changes the formatting of any outgoing text such that " - "anything underlined will be received green and monospace.", - "Sean Egan ", - PURPLE_WEBSITE, - plugin_load, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - static void - init_plugin(PurplePlugin *plugin) - { - } - -PURPLE_INIT_PLUGIN(codeinline, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-buddyicons-example.py qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-buddyicons-example.py --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-buddyicons-example.py 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-buddyicons-example.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -#!/usr/bin/env python -# -# Print the aliases of buddies who have a buddy-icon set. -# -# Purple is the legal property of its developers, whose names are too numerous -# to list here. Please refer to the COPYRIGHT file distributed with this -# source distribution. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -# - -import dbus - -bus = dbus.SessionBus() -obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") -purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - -node = purple.PurpleBlistGetRoot() -while node != 0: - if purple.PurpleBlistNodeIsBuddy(node): - icon = purple.PurpleBuddyGetIcon(node) - if icon != 0: - print purple.PurpleBuddyGetAlias(node) - node = purple.PurpleBlistNodeNext(node, 0) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/dbus-example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* - * This is an example of a purple dbus plugin. After enabling this - * plugin, the following commands should work from the command line: - * - * prompt$ purple-send DbusExampleGetHelloObject - * - * returns, say: int32 74 - * - * prompt$ purple-send DbusExampleGetText int32:74 - * - * returns: string "Hello." - * - * prompt$ purple-send DbusExampleSetText int32:74 string:Bye! - * - * prompt$ purple-send DbusExampleGetText int32:74 - * - * returns: string "Bye!" - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "blist.h" -#include "notify.h" -#include "plugin.h" -#include "version.h" - -#include -#include -#include - -#define DBUS_API_SUBJECT_TO_CHANGE -#include "dbus-maybe.h" -#include "dbus-bindings.h" - -typedef struct { - char *text; -} PurpleText; - -/* This makes the structure PurpleText visible to the purple-dbus type - system. It defines PurpleText as a type with no parent. From now - on, we will be able to register pointers to structures of this - type. You to dbus-define types you want to be directly accessible - by external applications. */ -PURPLE_DBUS_DEFINE_TYPE(PurpleText) - -/* Here we make four functions accessible to other applications by - DBus. These functions can access types defined in purple proper - (PurpleBuddy) as well as the types defined in the plugin (PurpleText). */ -DBUS_EXPORT PurpleText* dbus_example_get_hello_object(void); -DBUS_EXPORT void dbus_example_set_text(PurpleText *obj, const char *text); -DBUS_EXPORT const char *dbus_example_get_text(PurpleText *obj); -DBUS_EXPORT const char *dbus_example_get_buddy_name(PurpleBuddy *buddy); - -/* This file has been generated by the #dbus-analize-functions.py - script. It contains dbus wrappers for the four functions declared - above. */ -#include "dbus-example-bindings.c" - -/* This is the PurpleText object we want to make publicly visible. */ -static PurpleText hello; - -/* Here come the definitions of the four exported functions. */ -PurpleText* dbus_example_get_hello_object(void) -{ - return &hello; -} - -void dbus_example_set_text(PurpleText *obj, const char *text) -{ - if (obj != NULL) { - g_free(obj->text); - obj->text = g_strdup(text); - } -} - -const char *dbus_example_get_text(PurpleText *obj) -{ - if (obj != NULL) - return obj->text; - else - return NULL; -} - -const char *dbus_example_get_buddy_name(PurpleBuddy *buddy) -{ - return purple_buddy_get_name(buddy); -} - -/* And now standard plugin stuff */ - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin); - - /* First, we have to register our four exported functions with the - main purple dbus loop. Without this statement, the purple dbus - code wouldn't know about our functions. */ - PURPLE_DBUS_REGISTER_BINDINGS(plugin); - - /* Then, we register the hello object of type PurpleText. Note that - pointer registrations / unregistrations are completely dynamic; - they don't have to be made when the plugin is loaded / - unloaded. Without this statement the dbus purple code wouldn't - know about the hello object. */ - PURPLE_DBUS_REGISTER_POINTER(&hello, PurpleText); - - hello.text = g_strdup("Hello."); - - return TRUE; -} - - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - g_free(hello.text); - - /* It is necessary to unregister all pointers registered by the module. */ - PURPLE_DBUS_UNREGISTER_POINTER(&hello); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "dbus-example", /**< id */ - N_("DBus Example"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("DBus Plugin Example"), - /** description */ - N_("DBus Plugin Example"), - "Piotr Zielinski (http://cl.cam.ac.uk/~pz215)", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(dbus_example, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/debug_example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/debug_example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/debug_example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/debug_example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/* - * Debug Example Plugin - * - * Copyright (C) 2007, John Bailey - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* We're including glib.h again for the gboolean type. */ -#include - -/* This will prevent compiler errors in some instances and is better explained in the - * how-to documents on the wiki */ -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -/* This is the required definition of PURPLE_PLUGINS as required for a plugin, - * but we protect it with an #ifndef because config.h may define it for us - * already and this would cause an unneeded compiler warning. */ -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -/* Here we're including the necessary libpurple headers for this plugin. Note - * that we're including them in alphabetical order. This isn't necessary but - * we do this throughout our source for consistency. */ -#include "debug.h" -#include "plugin.h" -#include "version.h" - -/* It's more convenient to type PLUGIN_ID all the time than it is to type - * "core-debugexample", so define this convenience macro. */ -#define PLUGIN_ID "core-debugexample" - -/* Common practice in third-party plugins is to define convenience macros for - * many of the fields of the plugin info struct, so we'll do that for the - * purposes of demonstration. */ -#define PLUGIN_AUTHOR "John Bailey " - -/* As we've covered before, libpurple calls this function, if present, when it - * loads the plugin. Here we're using it to show off the capabilities of the - * debug API and just blindly returning TRUE to tell libpurple it's safe to - * continue loading. */ -static gboolean -plugin_load(PurplePlugin *plugin) -{ - /* Define these for convenience--we're just using them to show the - * similarities of the debug functions to the standard printf(). */ - gint i = 256; - gfloat f = 512.1024; - const gchar *s = "example string"; - - /* Introductory message */ - purple_debug_info(PLUGIN_ID, - "Called plugin_load. Beginning debug demonstration\n"); - - /* Show off the debug API a bit */ - purple_debug_misc(PLUGIN_ID, - "MISC level debug message. i = %d, f = %f, s = %s\n", i, f, s); - - purple_debug_info(PLUGIN_ID, - "INFO level debug message. i = %d, f = %f, s = %s\n", i, f, s); - - purple_debug_warning(PLUGIN_ID, - "WARNING level debug message. i = %d, f = %f, s = %s\n", i, f, s); - - purple_debug_error(PLUGIN_ID, - "ERROR level debug message. i = %d, f = %f, s = %s\n", i, f, s); - - purple_debug_fatal(PLUGIN_ID, - "FATAL level debug message. i = %d, f = %f, s = %s\n", i, f, s); - - /* Now just return TRUE to tell libpurple to finish loading. */ - return TRUE; -} - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, /* magic number */ - PURPLE_MAJOR_VERSION, /* purple major */ - PURPLE_MINOR_VERSION, /* purple minor */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - NULL, /* UI requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* id */ - "Debug API Example", /* name */ - DISPLAY_VERSION, /* version */ - "Debug API Example", /* summary */ - "Debug API Example", /* description */ - PLUGIN_AUTHOR, /* author */ - "http://pidgin.im", /* homepage */ - - plugin_load, /* load */ - NULL, /* unload */ - NULL, /* destroy */ - - NULL, /* ui info */ - NULL, /* extra info */ - NULL, /* prefs info */ - NULL, /* actions */ - NULL, /* reserved */ - NULL, /* reserved */ - NULL, /* reserved */ - NULL /* reserved */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(debugexample, init_plugin, info) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/filectl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/filectl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/filectl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/filectl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,270 +0,0 @@ -/** - * Send commands to Purple via ~/.purple/control - * - * Originally by Eric Warmenhoven - * Compile fixes/mini hacks Alex Bennee - * and Brian Tarricone - */ - -/* system includes */ -#include -#include -#include -#include -#include -#include -#include - -#include "account.h" -#include "config.h" -#include "core.h" -#include "conversation.h" -#include "debug.h" -#include "eventloop.h" -#include "internal.h" -#include "util.h" -#include "version.h" - -#define FILECTL_PLUGIN_ID "core-filectl" -static int check; -static time_t mtime; - -static void init_file(void); -static gboolean check_file(void); - -/* parse char * as if were word array */ -char *getarg(char *, int, int); - -/* go through file and run any commands */ -void -run_commands() -{ - struct stat finfo; - char filename[256]; - char buffer[1024]; - char *command, *arg1, *arg2; - FILE *file; - - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); - - file = g_fopen(filename, "r+"); - while (fgets(buffer, sizeof(buffer), file)) { - - /* Read the next command */ - if (buffer[strlen(buffer) - 1] == '\n') - buffer[strlen(buffer) - 1] = 0; - purple_debug_misc("filectl", "read: %s\n", buffer); - command = getarg(buffer, 0, 0); - - if (!g_ascii_strncasecmp(command, "login", 6)) { - PurpleAccount *account; - - arg1 = getarg(buffer, 1, 0); - arg2 = getarg(buffer, 2, 1); - - account = purple_accounts_find(arg1, arg2); - if (account != NULL) /* username found */ - purple_account_connect(account); - - free(arg1); - free(arg2); - - } else if (!g_ascii_strncasecmp(command, "logout", 7)) { - PurpleAccount *account; - - arg1 = getarg(buffer, 1, 1); - arg2 = getarg(buffer, 2, 1); - - account = purple_accounts_find(arg1, arg2); - if (account != NULL) - { - purple_account_disconnect(account); - } - else if (arg1 == NULL) - purple_connections_disconnect_all(); - - free(arg1); - free(arg2); - -/* purple_find_conversation() is gone in 2.0.0. */ -#if 0 - } else if (!g_ascii_strncasecmp(command, "send", 4)) { - PurpleConversation *conv; - - arg1 = getarg(buffer, 1, 0); - arg2 = getarg(buffer, 2, 1); - - conv = purple_find_conversation(PURPLE_CONV_TYPE_ANY, arg1); - if (conv != NULL) - { - /* - purple_conversation_write(conv, arg2, WFLAG_SEND, NULL, time(NULL), -1); - serv_send_im(conv->gc, arg1, arg2, 0); - */ - } - - free(arg1); - free(arg2); -#endif - - } else if (!g_ascii_strncasecmp(command, "away", 4)) { - arg1 = getarg(buffer, 1, 1); - /* serv_set_away_all(arg1); */ - free(arg1); - - } else if (!g_ascii_strncasecmp(command, "hide", 4)) { - purple_blist_set_visible(FALSE); - - } else if (!g_ascii_strncasecmp(command, "unhide", 6)) { - purple_blist_set_visible(TRUE); - - } else if (!g_ascii_strncasecmp(command, "back", 4)) { - /* do_im_back(); */ - - } else if (!g_ascii_strncasecmp(command, "quit", 4)) { - purple_core_quit(); - - } - - free(command); - } - - fclose(file); - - if (g_stat(filename, &finfo) != 0) - return; - mtime = finfo.st_mtime; -} - -/** - * Check to see if the size of the file is > 0. if so, run commands. - */ -void -init_file() -{ - /* most of this was taken from Bash v2.04 by the FSF */ - struct stat finfo; - char filename[256]; - - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); - - if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0)) - run_commands(); -} - -/** - * Check to see if we need to run commands from the file. - */ -gboolean -check_file() -{ - /* most of this was taken from Bash v2.04 by the FSF */ - struct stat finfo; - char filename[256]; - - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); - - if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0)) - { - if (mtime != finfo.st_mtime) { - purple_debug_info("filectl", "control changed, checking\n"); - run_commands(); - } - } - - return TRUE; -} - -char * -getarg(char *line, int which, int remain) -{ - char *arr; - char *val; - int count = -1; - int i; - int state = 0; - - for (i = 0; i < strlen(line) && count < which; i++) { - switch (state) { - case 0: /* in whitespace, expecting word */ - if (isalnum(line[i])) { - count++; - state = 1; - } - break; - case 1: /* inside word, waiting for whitespace */ - if (isspace(line[i])) { - state = 0; - } - break; - } - } - - arr = strdup(&line[i - 1]); - if (remain) - return arr; - - for (i = 0; i < strlen(arr) && isalnum(arr[i]); i++); - arr[i] = 0; - val = strdup(arr); - arr[i] = ' '; - free(arr); - return val; -} - -/* - * EXPORTED FUNCTIONS - */ - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - init_file(); - check = purple_timeout_add_seconds(5, (GSourceFunc)check_file, NULL); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - purple_timeout_remove(check); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - FILECTL_PLUGIN_ID, /**< id */ - N_("File Control"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Allows control by entering commands in a file."), - /** description */ - N_("Allows control by entering commands in a file."), - "Eric Warmenhoven ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL /**< extra_info */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(filectl, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/fortuneprofile.pl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/fortuneprofile.pl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/fortuneprofile.pl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/fortuneprofile.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -# FORTUNE PROFILE -# -# Sets your AIM profile to a fortune (with a header and footer of your -# choice). -# - -# By Sean Egan -# seanegan@gmail.com -# AIM: SeanEgn -# -# Updated by Nathan Conrad, 31 January 2002 -# Changes: -# * Fortunes have HTML tabs and newlines -# AIM: t98502 -# ICQ: 16106363 -# -# Updated by Mark Doliner, 15 October 2002 -# Changes: -# * Modified to work with the changed perl interface of gaim 0.60 -# * Fixed a bug where your info would be set to nothing if you had -# no pre and no post message -# AIM: lbdash -# -# Updated by Christian Hammond, 20 August 2003 -# Changes: -# * Modified to work with the changed perl interface of gaim 0.68 -# AIM: ChipX86 - -# Copyright (C) 2001 Sean Egan - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -use Gaim; - -%PLUGIN_INFO = ( - perl_api_version => 2, - name => "Fortune Profile", - version => "3.4", - summary => "Sets your AIM profile to a fortune (with a header and footer of your choice).", - description => "Sets your AIM profile to a fortune (with a header and footer of your choice).", - author => "Sean Egan ", - url => "http://gaim.sf.net/", - - load => "plugin_load" -); - -sub plugin_init { - return %PLUGIN_INFO; -} - -sub plugin_load { - $plugin = shift; - - $tab = " "; - $tab = $tab . $tab . $tab . $tab; - $nl = "
"; - - $seconds = 30; # Delay before updating away messages. - $max = 1020; # Max length of an profile. It should be - # 1024, but I am being safe - $pre_message = ""; # This gets added before the fortune - - $post_message =""; - - $len = 0; - if ($pre_message ne "") { - $len += length( $pre_message . "---$nl" ); - } - if ($post_message ne "") { - $len += length("---$nl" . $post_message); - } - - # Command to get dynamic message from - $command = "fortune -sn " . ($max - $len); - - # output the first message and start the timers... - # This is done as a timeout to prevent attempts to set the - # profile before logging in. - Gaim::timeout_add($plugin, $seconds, \&update_away, 0); -} - -sub update_away { - # The fortunes are expanded into HTML (the tabs and newlines) which - # causes the -s option of fortune to be a little bit meaningless. This - # will loop until it gets a fortune of a good size (after expansion). - - do { - do { #It's a while loop because it doesn't always work for some reason - $fortune = `$command`; - if ($? == -1) { - return; - } - } while ($fortune eq ""); - $fortune =~ s/\n/$nl/g; - $fortune =~ s/\t/$tab/g; - } while ((length($fortune) + $len ) > $max); - - $message = $fortune; - if ($pre_message ne "") { - $message = $pre_message . "---$nl" . $message; - } - if ($post_message ne "") { - $message = $message . "---$nl" . $post_message ; - } - - foreach $account (Gaim::accounts()) { - if ($account->is_connected()) { - $account->set_user_info($message); - } - } - - Gaim::timeout_add($plugin, $seconds, \&update_away, 0); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/helloworld.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/helloworld.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/helloworld.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/helloworld.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/* - * Hello World Plugin - * - * Copyright (C) 2004, Gary Kramlich , - * 2007, John Bailey - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* config.h may define PURPLE_PLUGINS; protect the definition here so that we - * don't get complaints about redefinition when it's not necessary. */ -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#include - -/* This will prevent compiler errors in some instances and is better explained in the - * how-to documents on the wiki */ -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -#include -#include -#include - -/* we're adding this here and assigning it in plugin_load because we need - * a valid plugin handle for our call to purple_notify_message() in the - * plugin_action_test_cb() callback function */ -PurplePlugin *helloworld_plugin = NULL; - -/* This function is the callback for the plugin action we added. All we're - * doing here is displaying a message. When the user selects the plugin - * action, this function is called. */ -static void -plugin_action_test_cb (PurplePluginAction * action) -{ - purple_notify_message (helloworld_plugin, PURPLE_NOTIFY_MSG_INFO, - "Plugin Actions Test", "This is a plugin actions test :)", NULL, NULL, - NULL); -} - -/* we tell libpurple in the PurplePluginInfo struct to call this function to - * get a list of plugin actions to use for the plugin. This function gives - * libpurple that list of actions. */ -static GList * -plugin_actions (PurplePlugin * plugin, gpointer context) -{ - /* some C89 (a.k.a. ANSI C) compilers will warn if any variable declaration - * includes an initilization that calls a function. To avoid that, we - * generally initialize our variables first with constant values like NULL - * or 0 and assign to them with function calls later */ - GList *list = NULL; - PurplePluginAction *action = NULL; - - /* The action gets created by specifying a name to show in the UI and a - * callback function to call. */ - action = purple_plugin_action_new ("Plugin Action Test", plugin_action_test_cb); - - /* libpurple requires a GList of plugin actions, even if there is only one - * action in the list. We append the action to a GList here. */ - list = g_list_append (list, action); - - /* Once the list is complete, we send it to libpurple. */ - return list; -} - -static gboolean -plugin_load (PurplePlugin * plugin) -{ - purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!", - "This is the Hello World! plugin :)", NULL, NULL, - NULL); - - helloworld_plugin = plugin; /* assign this here so we have a valid handle later */ - - return TRUE; -} - -/* For specific notes on the meanings of each of these members, consult the C Plugin Howto - * on the website. */ -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - - "core-hello_world", - "Hello World!", - DISPLAY_VERSION, /* This constant is defined in config.h, but you shouldn't use it for - your own plugins. We use it here because it's our plugin. And we're lazy. */ - - "Hello World Plugin", - "Hello World Plugin", - "John Bailey ", /* correct author */ - "http://helloworld.tld", - - - plugin_load, - NULL, - NULL, - - NULL, - NULL, - NULL, - plugin_actions, /* this tells libpurple the address of the function to call - to get the list of plugin actions. */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin (PurplePlugin * plugin) -{ -} - -PURPLE_INIT_PLUGIN (hello_world, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/idle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/idle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/idle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/idle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,346 +0,0 @@ -/* - * idle.c - I'dle Mak'er plugin for Purple - * - * This file is part of Purple. - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "plugin.h" -#include "request.h" -#include "server.h" -#include "status.h" -#include "version.h" - -/* This plugin no longer depends on gtk */ -#define IDLE_PLUGIN_ID "core-idle" - -static GList *idled_accts = NULL; - -static gboolean -unidle_filter(PurpleAccount *acct) -{ - if (g_list_find(idled_accts, acct)) - return TRUE; - - return FALSE; -} - -static gboolean -idleable_filter(PurpleAccount *account) -{ - PurplePlugin *prpl; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - g_return_val_if_fail(prpl != NULL, FALSE); - - return (PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->set_idle != NULL); -} - -static void -set_idle_time(PurpleAccount *acct, int mins_idle) -{ - time_t t; - PurpleConnection *gc = purple_account_get_connection(acct); - PurplePresence *presence = purple_account_get_presence(acct); - - if (!gc) - return; - - purple_debug_info("idle", - "setting idle time for %s to %d\n", - purple_account_get_username(acct), mins_idle); - - if (mins_idle) - t = time(NULL) - (60 * mins_idle); /* subtract seconds idle from current time */ - else - t = 0; /* time idle is irrelevant */ - - purple_presence_set_idle(presence, mins_idle ? TRUE : FALSE, t); -} - -static void -idle_action_ok(void *ignored, PurpleRequestFields *fields) -{ - int tm = purple_request_fields_get_integer(fields, "mins"); - PurpleAccount *acct = purple_request_fields_get_account(fields, "acct"); - - /* only add the account to the GList if it's not already been idled */ - if (!unidle_filter(acct)) - { - purple_debug_misc("idle", - "%s hasn't been idled yet; adding to list.\n", - purple_account_get_username(acct)); - idled_accts = g_list_append(idled_accts, acct); - } - - set_idle_time(acct, tm); -} - -static void -idle_all_action_ok(void *ignored, PurpleRequestFields *fields) -{ - PurpleAccount *acct = NULL; - GList *list, *iter; - int tm = purple_request_fields_get_integer(fields, "mins"); - const char *prpl_id = NULL; - - list = purple_accounts_get_all_active(); - for(iter = list; iter; iter = iter->next) { - acct = (PurpleAccount *)(iter->data); - - if(acct) - prpl_id = purple_account_get_protocol_id(acct); - - if(acct && idleable_filter(acct)) { - purple_debug_misc("idle", "Idling %s.\n", - purple_account_get_username(acct)); - - set_idle_time(acct, tm); - - if(!g_list_find(idled_accts, acct)) - idled_accts = g_list_append(idled_accts, acct); - } - } - - g_list_free(list); -} - -static void -unidle_action_ok(void *ignored, PurpleRequestFields *fields) -{ - PurpleAccount *acct = purple_request_fields_get_account(fields, "acct"); - - set_idle_time(acct, 0); /* unidle the account */ - - /* once the account has been unidled it shouldn't be in the list */ - idled_accts = g_list_remove(idled_accts, acct); -} - - -static void -idle_action(PurplePluginAction *action) -{ - /* Use the super fancy request API */ - - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_account_new("acct", _("Account"), NULL); - purple_request_field_account_set_filter(field, idleable_filter); - purple_request_field_account_set_show_all(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_int_new("mins", _("Minutes"), 10); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - N_("I'dle Mak'er"), - _("Set Account Idle Time"), - NULL, - request, - _("_Set"), G_CALLBACK(idle_action_ok), - _("_Cancel"), NULL, - NULL, NULL, NULL, - NULL); -} - -static void -unidle_action(PurplePluginAction *action) -{ - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - if (idled_accts == NULL) - { - purple_notify_info(NULL, NULL, _("None of your accounts are idle."), NULL); - return; - } - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_account_new("acct", _("Account"), NULL); - purple_request_field_account_set_filter(field, unidle_filter); - purple_request_field_account_set_show_all(field, FALSE); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - N_("I'dle Mak'er"), - _("Unset Account Idle Time"), - NULL, - request, - _("_Unset"), G_CALLBACK(unidle_action_ok), - _("_Cancel"), NULL, - NULL, NULL, NULL, - NULL); -} - -static void -idle_all_action(PurplePluginAction *action) -{ - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_int_new("mins", _("Minutes"), 10); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - N_("I'dle Mak'er"), - _("Set Idle Time for All Accounts"), - NULL, - request, - _("_Set"), G_CALLBACK(idle_all_action_ok), - _("_Cancel"), NULL, - NULL, NULL, NULL, - NULL); -} - -static void -unidle_all_action(PurplePluginAction *action) -{ - GList *l; - - /* freeing the list here will cause segfaults if the user idles an account - * after the list is freed */ - for (l = idled_accts; l; l = l->next) - { - PurpleAccount *account = l->data; - set_idle_time(account, 0); - } - - g_list_free(idled_accts); - idled_accts = NULL; -} - -static GList * -actions(PurplePlugin *plugin, gpointer context) -{ - GList *l = NULL; - PurplePluginAction *act = NULL; - - act = purple_plugin_action_new(_("Set Account Idle Time"), - idle_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Unset Account Idle Time"), - unidle_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Set Idle Time for All Accounts"), - idle_all_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new( - _("Unset Idle Time for All Idled Accounts"), unidle_all_action); - l = g_list_append(l, act); - - return l; -} - -static void -signing_off_cb(PurpleConnection *gc, void *data) -{ - PurpleAccount *account; - - account = purple_connection_get_account(gc); - idled_accts = g_list_remove(idled_accts, account); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_signal_connect(purple_connections_get_handle(), "signing-off", - plugin, - PURPLE_CALLBACK(signing_off_cb), NULL); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - unidle_all_action(NULL); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - IDLE_PLUGIN_ID, - - /* This is a cultural reference. Dy'er Mak'er is a song by Led Zeppelin. - If that doesn't translate well into your language, drop the 's before translating. */ - N_("I'dle Mak'er"), - DISPLAY_VERSION, - N_("Allows you to hand-configure how long you've been idle"), - N_("Allows you to hand-configure how long you've been idle"), - "Eric Warmenhoven ", - PURPLE_WEBSITE, - plugin_load, - plugin_unload, - NULL, - NULL, - NULL, - NULL, - actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - - -PURPLE_INIT_PLUGIN(idle, init_plugin, info) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-client.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-client.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-client.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-client.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -/* - * IPC test client plugin. - * - * Copyright (C) 2003 Christian Hammond. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -#define IPC_TEST_CLIENT_PLUGIN_ID "core-ipc-test-client" - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - PurplePlugin *server_plugin; - gboolean ok; - int result; - - server_plugin = purple_plugins_find_with_id("core-ipc-test-server"); - - if (server_plugin == NULL) - { - purple_debug_error("ipc-test-client", - "Unable to locate plugin core-ipc-test-server, " - "needed for IPC.\n"); - - return TRUE; - } - - result = (int)purple_plugin_ipc_call(server_plugin, "add", &ok, 36, 6); - - if (!ok) - { - purple_debug_error("ipc-test-client", - "Unable to call IPC function 'add' in " - "core-ipc-test-server plugin."); - - return TRUE; - } - - purple_debug_info("ipc-test-client", "36 + 6 = %d\n", result); - - result = (int)purple_plugin_ipc_call(server_plugin, "sub", &ok, 50, 8); - - if (!ok) - { - purple_debug_error("ipc-test-client", - "Unable to call IPC function 'sub' in " - "core-ipc-test-server plugin."); - - return TRUE; - } - - purple_debug_info("ipc-test-client", "50 - 8 = %d\n", result); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - IPC_TEST_CLIENT_PLUGIN_ID, /**< id */ - N_("IPC Test Client"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Test plugin IPC support, as a client."), - /** description */ - N_("Test plugin IPC support, as a client. This locates the server " - "plugin and calls the commands registered."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - info.dependencies = g_list_append(info.dependencies, - "core-ipc-test-server"); -} - -PURPLE_INIT_PLUGIN(ipctestclient, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-server.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-server.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-server.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ipc-test-server.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* - * IPC test server plugin. - * - * Copyright (C) 2003 Christian Hammond. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#define IPC_TEST_SERVER_PLUGIN_ID "core-ipc-test-server" - -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -static int -add_func(int i1, int i2) -{ - purple_debug_misc("ipc-test-server", "Got %d, %d, returning %d\n", - i1, i2, i1 + i2); - return i1 + i2; -} - -static int -sub_func(int i1, int i2) -{ - purple_debug_misc("ipc-test-server", "Got %d, %d, returning %d\n", - i1, i2, i1 - i2); - return i1 - i2; -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_plugin_ipc_register(plugin, "add", PURPLE_CALLBACK(add_func), - purple_marshal_INT__INT_INT, - purple_value_new(PURPLE_TYPE_INT), 2, - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_INT)); - - purple_plugin_ipc_register(plugin, "sub", PURPLE_CALLBACK(sub_func), - purple_marshal_INT__INT_INT, - purple_value_new(PURPLE_TYPE_INT), 2, - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_INT)); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - IPC_TEST_SERVER_PLUGIN_ID, /**< id */ - N_("IPC Test Server"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Test plugin IPC support, as a server."), - /** description */ - N_("Test plugin IPC support, as a server. This registers the IPC " - "commands."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ipctestserver, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/joinpart.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/joinpart.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/joinpart.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/joinpart.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,314 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "conversation.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -#define JOINPART_PLUGIN_ID "core-rlaager-joinpart" - - -/* Preferences */ - -/* The number of minutes before a person is considered - * to have stopped being part of active conversation. */ -#define DELAY_PREF "/plugins/core/joinpart/delay" -#define DELAY_DEFAULT 10 - -/* The number of people that must be in a room for this - * plugin to have any effect */ -#define THRESHOLD_PREF "/plugins/core/joinpart/threshold" -#define THRESHOLD_DEFAULT 20 - -/* Hide buddies */ -#define HIDE_BUDDIES_PREF "/plugins/core/joinpart/hide_buddies" -#define HIDE_BUDDIES_DEFAULT FALSE - -struct joinpart_key -{ - PurpleConversation *conv; - char *user; -}; - -static guint joinpart_key_hash(const struct joinpart_key *key) -{ - g_return_val_if_fail(key != NULL, 0); - - return g_direct_hash(key->conv) + g_str_hash(key->user); -} - -static gboolean joinpart_key_equal(const struct joinpart_key *a, const struct joinpart_key *b) -{ - if (a == NULL) - return (b == NULL); - else if (b == NULL) - return FALSE; - - return (a->conv == b->conv) && !strcmp(a->user, b->user); -} - -static void joinpart_key_destroy(struct joinpart_key *key) -{ - g_return_if_fail(key != NULL); - - g_free(key->user); - g_free(key); -} - -static gboolean should_hide_notice(PurpleConversation *conv, const char *name, - GHashTable *users) -{ - PurpleConvChat *chat; - int threshold; - struct joinpart_key key; - time_t *last_said; - - g_return_val_if_fail(conv != NULL, FALSE); - g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE); - - /* If the room is small, don't bother. */ - chat = PURPLE_CONV_CHAT(conv); - threshold = purple_prefs_get_int(THRESHOLD_PREF); - if (g_list_length(purple_conv_chat_get_users(chat)) < threshold) - return FALSE; - - if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) && - purple_find_buddy(purple_conversation_get_account(conv), name)) - return FALSE; - - /* Only show the notice if the user has spoken recently. */ - key.conv = conv; - key.user = (gchar *)name; - last_said = g_hash_table_lookup(users, &key); - if (last_said != NULL) - { - int delay = purple_prefs_get_int(DELAY_PREF); - if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL)) - return FALSE; - } - - return TRUE; -} - -static gboolean chat_buddy_leaving_cb(PurpleConversation *conv, const char *name, - const char *reason, GHashTable *users) -{ - return should_hide_notice(conv, name, users); -} - -static gboolean chat_buddy_joining_cb(PurpleConversation *conv, const char *name, - PurpleConvChatBuddyFlags flags, - GHashTable *users) -{ - return should_hide_notice(conv, name, users); -} - -static void received_chat_msg_cb(PurpleAccount *account, char *sender, - char *message, PurpleConversation *conv, - PurpleMessageFlags flags, GHashTable *users) -{ - struct joinpart_key key; - time_t *last_said; - - /* Most of the time, we'll already have tracked the user, - * so we avoid memory allocation here. */ - key.conv = conv; - key.user = sender; - last_said = g_hash_table_lookup(users, &key); - if (last_said != NULL) - { - /* They just said something, so update the time. */ - time(last_said); - } - else - { - struct joinpart_key *key2; - - key2 = g_new(struct joinpart_key, 1); - key2->conv = conv; - key2->user = g_strdup(sender); - - last_said = g_new(time_t, 1); - time(last_said); - - g_hash_table_insert(users, key2, last_said); - } -} - -static gboolean check_expire_time(struct joinpart_key *key, - time_t *last_said, time_t *limit) -{ - purple_debug_info("joinpart", "Removing key for %s\n", key->user); - return (*last_said < *limit); -} - -static gboolean clean_users_hash(GHashTable *users) -{ - int delay = purple_prefs_get_int(DELAY_PREF); - time_t limit = time(NULL) - (60 * delay); - - g_hash_table_foreach_remove(users, (GHRFunc)check_expire_time, &limit); - - return TRUE; -} - -static gboolean plugin_load(PurplePlugin *plugin) -{ - void *conv_handle; - GHashTable *users; - guint id; - gpointer *data; - - users = g_hash_table_new_full((GHashFunc)joinpart_key_hash, - (GEqualFunc)joinpart_key_equal, - (GDestroyNotify)joinpart_key_destroy, - g_free); - - conv_handle = purple_conversations_get_handle(); - purple_signal_connect(conv_handle, "chat-buddy-joining", plugin, - PURPLE_CALLBACK(chat_buddy_joining_cb), users); - purple_signal_connect(conv_handle, "chat-buddy-leaving", plugin, - PURPLE_CALLBACK(chat_buddy_leaving_cb), users); - purple_signal_connect(conv_handle, "received-chat-msg", plugin, - PURPLE_CALLBACK(received_chat_msg_cb), users); - - /* Cleanup every 5 minutes */ - id = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, users); - - data = g_new(gpointer, 2); - data[0] = users; - data[1] = GUINT_TO_POINTER(id); - plugin->extra = data; - - return TRUE; -} - -static gboolean plugin_unload(PurplePlugin *plugin) -{ - gpointer *data = plugin->extra; - - /* Destroy the hash table. The core plugin code will - * disconnect the signals, and since Purple is single-threaded, - * we don't have to worry one will be called after this. */ - g_hash_table_destroy((GHashTable *)data[0]); - - purple_timeout_remove(GPOINTER_TO_UINT(data[1])); - g_free(data); - - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - g_return_val_if_fail(plugin != NULL, FALSE); - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_label(_("Hide Joins/Parts")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label(THRESHOLD_PREF, - /* Translators: Followed by an input request a number of people */ - _("For rooms with more than this many people")); - purple_plugin_pref_set_bounds(ppref, 0, 1000); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label(DELAY_PREF, - _("If user has not spoken in this many minutes")); - purple_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */ - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label(HIDE_BUDDIES_PREF, - _("Apply hiding rules to buddies")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (reserved) */ - NULL, /* frame (reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - JOINPART_PLUGIN_ID, /**< id */ - N_("Join/Part Hiding"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Hides extraneous join/part messages."), - /** description */ - N_("This plugin hides join/part messages in large " - "rooms, except for those users actively taking " - "part in a conversation."), - "Richard Laager ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none("/plugins/core/joinpart"); - - purple_prefs_add_int(DELAY_PREF, DELAY_DEFAULT); - purple_prefs_add_int(THRESHOLD_PREF, THRESHOLD_DEFAULT); - purple_prefs_add_bool(HIDE_BUDDIES_PREF, HIDE_BUDDIES_DEFAULT); -} - -PURPLE_INIT_PLUGIN(joinpart, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/log_reader.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/log_reader.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/log_reader.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/log_reader.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2966 +0,0 @@ -#include "internal.h" - -#include - -#include "debug.h" -#include "log.h" -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" -#include "stringref.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -/* This must be the last Purple header included. */ -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* Where is the Windows partition mounted? */ -#ifndef PURPLE_LOG_READER_WINDOWS_MOUNT_POINT -#define PURPLE_LOG_READER_WINDOWS_MOUNT_POINT "/mnt/windows" -#endif - -enum name_guesses { - NAME_GUESS_UNKNOWN, - NAME_GUESS_ME, - NAME_GUESS_THEM -}; - -/* Some common functions. */ -static int get_month(const char *month) -{ - int iter; - const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL}; - for (iter = 0; months[iter]; iter++) { - if (strcmp(month, months[iter]) == 0) - break; - } - return iter; -} - - -/***************************************************************************** - * Adium Logger * - *****************************************************************************/ - -/* The adium logger doesn't write logs, only reads them. This is to include - * Adium logs in the log viewer transparently. - */ - -static PurpleLogLogger *adium_logger; - -enum adium_log_type { - ADIUM_HTML, - ADIUM_TEXT, -}; - -struct adium_logger_data { - char *path; - enum adium_log_type type; -}; - -static GList *adium_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - PurplePlugin *plugin; - PurplePluginProtocolInfo *prpl_info; - char *prpl_name; - char *temp; - char *path; - GDir *dir; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - logdir = purple_prefs_get_string("/plugins/core/log_reader/adium/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - plugin = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - - temp = g_strdup_printf("%s.%s", prpl_name, account->username); - path = g_build_filename(logdir, temp, sn, NULL); - g_free(temp); - - dir = g_dir_open(path, 0, NULL); - if (dir) { - const gchar *file; - - while ((file = g_dir_read_name(dir))) { - if (!purple_str_has_prefix(file, sn)) - continue; - if (purple_str_has_suffix(file, ".html") || purple_str_has_suffix(file, ".AdiumHTMLLog")) { - struct tm tm; - const char *date = file; - - date += strlen(sn) + 2; - if (sscanf(date, "%u|%u|%u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) { - - purple_debug_error("Adium log parse", - "Filename timestamp parsing error\n"); - } else { - char *filename = g_build_filename(path, file, NULL); - FILE *handle = g_fopen(filename, "rb"); - char contents[57]; /* XXX: This is really inflexible. */ - char *contents2; - struct adium_logger_data *data; - size_t rd; - PurpleLog *log; - - if (!handle) { - g_free(filename); - continue; - } - - rd = fread(contents, 1, 56, handle) == 0; - fclose(handle); - contents[rd] = '\0'; - - /* XXX: This is fairly inflexible. */ - contents2 = contents; - while (*contents2 && *contents2 != '>') - contents2++; - if (*contents2) - contents2++; - while (*contents2 && *contents2 != '>') - contents2++; - if (*contents2) - contents2++; - - if (sscanf(contents2, "%u.%u.%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) { - - purple_debug_error("Adium log parse", - "Contents timestamp parsing error\n"); - g_free(filename); - continue; - } - - data = g_new0(struct adium_logger_data, 1); - data->path = filename; - data->type = ADIUM_HTML; - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = adium_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - } else if (purple_str_has_suffix(file, ".adiumLog")) { - struct tm tm; - const char *date = file; - - date += strlen(sn) + 2; - if (sscanf(date, "%u|%u|%u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) { - - purple_debug_error("Adium log parse", - "Filename timestamp parsing error\n"); - } else { - char *filename = g_build_filename(path, file, NULL); - FILE *handle = g_fopen(filename, "rb"); - char contents[14]; /* XXX: This is really inflexible. */ - char *contents2; - struct adium_logger_data *data; - PurpleLog *log; - size_t rd; - - if (!handle) { - g_free(filename); - continue; - } - - rd = fread(contents, 1, 13, handle); - fclose(handle); - contents[rd] = '\0'; - - contents2 = contents; - while (*contents2 && *contents2 != '(') - contents2++; - if (*contents2) - contents2++; - - if (sscanf(contents2, "%u.%u.%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) { - - purple_debug_error("Adium log parse", - "Contents timestamp parsing error\n"); - g_free(filename); - continue; - } - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - - data = g_new0(struct adium_logger_data, 1); - data->path = filename; - data->type = ADIUM_TEXT; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = adium_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - } - } - g_dir_close(dir); - } - - g_free(prpl_name); - g_free(path); - - return list; -} - -static char *adium_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct adium_logger_data *data; - GError *error = NULL; - gchar *read = NULL; - - /* XXX: TODO: We probably want to set PURPLE_LOG_READ_NO_NEWLINE - * XXX: TODO: for HTML logs. */ - if (flags != NULL) - *flags = 0; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - - purple_debug_info("Adium log read", "Reading %s\n", data->path); - if (!g_file_get_contents(data->path, &read, NULL, &error)) { - purple_debug_error("Adium log read", "Error reading log: %s\n", - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - return g_strdup(""); - } - - if (data->type != ADIUM_HTML) { - char *escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - } - -#ifdef WIN32 - /* This problem only seems to show up on Windows. - * The BOM is displaying as a space at the beginning of the log. - */ - if (purple_str_has_prefix(read, "\xef\xbb\xbf")) - { - /* FIXME: This feels so wrong... */ - char *temp = g_strdup(&(read[3])); - g_free(read); - read = temp; - } -#endif - - /* TODO: Apply formatting. - * Replace the above hack with something better, since we'll - * be looping over the entire log file contents anyway. - */ - - return read; -} - -static int adium_logger_size (PurpleLog *log) -{ - struct adium_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - struct stat st; - - if (!data->path || stat(data->path, &st)) - st.st_size = 0; - - return st.st_size; - } - - text = adium_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void adium_logger_finalize(PurpleLog *log) -{ - struct adium_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data); -} - - -/***************************************************************************** - * Fire Logger * - *****************************************************************************/ - -#if 0 -/* The fire logger doesn't write logs, only reads them. This is to include - * Fire logs in the log viewer transparently. - */ - -static PurpleLogLogger *fire_logger; - -struct fire_logger_data { -}; - -static GList *fire_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - /* TODO: Do something here. */ - return NULL; -} - -static char * fire_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct fire_logger_data *data; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - /* TODO: Do something here. */ - return g_strdup(""); -} - -static int fire_logger_size (PurpleLog *log) -{ - g_return_val_if_fail(log != NULL, 0); - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - /* TODO: Do something here. */ - return 0; -} - -static void fire_logger_finalize(PurpleLog *log) -{ - g_return_if_fail(log != NULL); - - /* TODO: Do something here. */ -} -#endif - - -/***************************************************************************** - * Messenger Plus! Logger * - *****************************************************************************/ - -#if 0 -/* The messenger_plus logger doesn't write logs, only reads them. This is to include - * Messenger Plus! logs in the log viewer transparently. - */ - -static PurpleLogLogger *messenger_plus_logger; - -struct messenger_plus_logger_data { -}; - -static GList *messenger_plus_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - /* TODO: Do something here. */ - return NULL; -} - -static char * messenger_plus_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct messenger_plus_logger_data *data = log->logger_data; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - /* TODO: Do something here. */ - return g_strdup(""); -} - -static int messenger_plus_logger_size (PurpleLog *log) -{ - g_return_val_if_fail(log != NULL, 0); - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - /* TODO: Do something here. */ - return 0; -} - -static void messenger_plus_logger_finalize(PurpleLog *log) -{ - g_return_if_fail(log != NULL); - - /* TODO: Do something here. */ -} -#endif - - -/***************************************************************************** - * MSN Messenger Logger * - *****************************************************************************/ - -/* The msn logger doesn't write logs, only reads them. This is to include - * MSN Messenger message histories in the log viewer transparently. - */ - -static PurpleLogLogger *msn_logger; - -struct msn_logger_data { - xmlnode *root; - xmlnode *message; - const char *session_id; - int last_log; - GString *text; -}; - -/* This function is really confusing. It makes baby rlaager cry... - In other news: "You lost a lot of blood but we found most of it." - */ -static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out) -{ - const char *datetime; - static struct tm tm2; - time_t stamp; - const char *date; - const char *time; - int month; - int day; - int year; - int hour; - int min; - int sec; - char am_pm; - char *str; - static struct tm tm; - time_t t; - time_t diff; - -#ifndef G_DISABLE_CHECKS - if (message != NULL) - { - *tm_out = NULL; - - /* Trigger the usual warning. */ - g_return_val_if_fail(message != NULL, (time_t)0); - } -#endif - - datetime = xmlnode_get_attrib(message, "DateTime"); - if (!(datetime && *datetime)) - { - purple_debug_error("MSN log timestamp parse", - "Attribute missing: %s\n", "DateTime"); - return (time_t)0; - } - - stamp = purple_str_to_time(datetime, TRUE, &tm2, NULL, NULL); -#ifdef HAVE_TM_GMTOFF - tm2.tm_gmtoff = 0; -#endif -#ifdef HAVE_STRUCT_TM_TM_ZONE - /* This is used in the place of a timezone abbreviation if the - * offset is way off. The user should never really see it, but - * it's here just in case. The parens are to make it clear it's - * not a real timezone. */ - tm2.tm_zone = _("(UTC)"); -#endif - - - date = xmlnode_get_attrib(message, "Date"); - if (!(date && *date)) - { - purple_debug_error("MSN log timestamp parse", - "Attribute missing: %s\n", "Date"); - *tm_out = &tm2; - return stamp; - } - - time = xmlnode_get_attrib(message, "Time"); - if (!(time && *time)) - { - purple_debug_error("MSN log timestamp parse", - "Attribute missing: %s\n", "Time"); - *tm_out = &tm2; - return stamp; - } - - if (sscanf(date, "%u/%u/%u", &month, &day, &year) != 3) - { - purple_debug_error("MSN log timestamp parse", - "%s parsing error\n", "Date"); - *tm_out = &tm2; - return stamp; - } - else - { - if (month > 12) - { - int tmp = day; - day = month; - month = tmp; - } - } - - if (sscanf(time, "%u:%u:%u %c", &hour, &min, &sec, &am_pm) != 4) - { - purple_debug_error("MSN log timestamp parse", - "%s parsing error\n", "Time"); - *tm_out = &tm2; - return stamp; - } - - if (am_pm == 'P') { - hour += 12; - } else if (hour == 12) { - /* 12 AM = 00 hr */ - hour = 0; - } - - str = g_strdup_printf("%04i-%02i-%02iT%02i:%02i:%02i", year, month, day, hour, min, sec); - t = purple_str_to_time(str, TRUE, &tm, NULL, NULL); - - - if (stamp > t) - diff = stamp - t; - else - diff = t - stamp; - - if (diff > (14 * 60 * 60)) - { - if (day <= 12) - { - /* Swap day & month variables, to see if it's a non-US date. */ - g_free(str); - str = g_strdup_printf("%04i-%02i-%02iT%02i:%02i:%02i", year, month, day, hour, min, sec); - t = purple_str_to_time(str, TRUE, &tm, NULL, NULL); - - if (stamp > t) - diff = stamp - t; - else - diff = t - stamp; - - if (diff > (14 * 60 * 60)) - { - /* We got a time, it's not impossible, but - * the diff is too large. Display the UTC time. */ - g_free(str); - *tm_out = &tm2; - return stamp; - } - else - { - /* Legal time */ - /* Fall out */ - } - } - else - { - /* We got a time, it's not impossible, but - * the diff is too large. Display the UTC time. */ - g_free(str); - *tm_out = &tm2; - return stamp; - } - } - - /* If we got here, the time is legal with a reasonable offset. - * Let's find out if it's in our TZ. */ - if (purple_str_to_time(str, FALSE, &tm, NULL, NULL) == stamp) - { - g_free(str); - *tm_out = &tm; - return stamp; - } - g_free(str); - - /* The time isn't in our TZ, but it's reasonable. */ -#ifdef HAVE_STRUCT_TM_TM_ZONE - tm.tm_zone = " "; -#endif - *tm_out = &tm; - return stamp; -} - -static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - char *username; - PurpleBuddy *buddy; - const char *logdir; - const char *savedfilename = NULL; - char *logfile; - char *path; - GError *error = NULL; - gchar *contents = NULL; - gsize length; - xmlnode *root; - xmlnode *message; - const char *old_session_id = ""; - struct msn_logger_data *data = NULL; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - if (strcmp(account->protocol_id, "prpl-msn")) - return NULL; - - logdir = purple_prefs_get_string("/plugins/core/log_reader/msn/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - buddy = purple_find_buddy(account, sn); - - if ((username = g_strdup(purple_account_get_string( - account, "log_reader_msn_log_folder", NULL)))) { - /* As a special case, we allow the null string to kill the parsing - * straight away. This would allow the user to deal with the case - * when two account have the same username at different domains and - * only one has logs stored. - */ - if (!*username) { - g_free(username); - return list; - } - } else { - username = g_strdup(purple_normalize(account, account->username)); - } - - if (buddy) { - savedfilename = purple_blist_node_get_string((PurpleBlistNode *)buddy, - "log_reader_msn_log_filename"); - } - - if (savedfilename) { - /* As a special case, we allow the null string to kill the parsing - * straight away. This would allow the user to deal with the case - * when two buddies have the same username at different domains and - * only one has logs stored. - */ - if (!*savedfilename) { - g_free(username); - return list; - } - - logfile = g_strdup(savedfilename); - } else { - logfile = g_strdup_printf("%s.xml", purple_normalize(account, sn)); - } - - path = g_build_filename(logdir, username, "History", logfile, NULL); - - if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - gboolean found = FALSE; - char *at_sign; - GDir *dir; - - g_free(path); - - if (savedfilename) { - /* We had a saved filename, but it doesn't exist. - * Returning now is the right course of action because we don't - * want to detect another file incorrectly. - */ - g_free(username); - g_free(logfile); - return list; - } - - /* Perhaps we're using a new version of MSN with the weird numbered folders. - * I don't know how the numbers are calculated, so I'm going to attempt to - * find logs by pattern matching... - */ - - at_sign = g_strrstr(username, "@"); - if (at_sign) - *at_sign = '\0'; - - dir = g_dir_open(logdir, 0, NULL); - if (dir) { - const gchar *name; - - while ((name = g_dir_read_name(dir))) { - const char *c = name; - - if (!purple_str_has_prefix(c, username)) - continue; - - c += strlen(username); - while (*c) { - if (!g_ascii_isdigit(*c)) - break; - - c++; - } - - path = g_build_filename(logdir, name, NULL); - /* The !c makes sure we got to the end of the while loop above. */ - if (!*c && g_file_test(path, G_FILE_TEST_IS_DIR)) { - char *history_path = g_build_filename( - path, "History", NULL); - if (g_file_test(history_path, G_FILE_TEST_IS_DIR)) { - purple_account_set_string(account, - "log_reader_msn_log_folder", name); - g_free(path); - path = history_path; - found = TRUE; - break; - } - g_free(path); - g_free(history_path); - } - else - g_free(path); - } - g_dir_close(dir); - } - g_free(username); - - if (!found) { - g_free(logfile); - return list; - } - - /* If we've reached this point, we've found a History folder. */ - - username = g_strdup(purple_normalize(account, sn)); - at_sign = g_strrstr(username, "@"); - if (at_sign) - *at_sign = '\0'; - - found = FALSE; - dir = g_dir_open(path, 0, NULL); - if (dir) { - const gchar *name; - - while ((name = g_dir_read_name(dir))) { - const char *c = name; - - if (!purple_str_has_prefix(c, username)) - continue; - - c += strlen(username); - while (*c) { - if (!g_ascii_isdigit(*c)) - break; - - c++; - } - - path = g_build_filename(path, name, NULL); - if (!strcmp(c, ".xml") && - g_file_test(path, G_FILE_TEST_EXISTS)) { - found = TRUE; - g_free(logfile); - logfile = g_strdup(name); - break; - } - else - g_free(path); - } - g_dir_close(dir); - } - g_free(username); - - if (!found) { - g_free(logfile); - return list; - } - } else { - g_free(username); - g_free(logfile); - logfile = NULL; /* No sense saving the obvious buddy@domain.com. */ - } - - purple_debug_info("MSN log read", "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - g_free(path); - purple_debug_error("MSN log read", "Error reading log\n"); - if (error) - g_error_free(error); - return list; - } - g_free(path); - - /* Reading the file was successful... - * Save its name if it involves the crazy numbers. The idea here is that you could - * then tweak the blist.xml file by hand if need be. This would be the case if two - * buddies have the same username at different domains. One set of logs would get - * detected for both buddies. - */ - if (buddy && logfile) { - PurpleBlistNode *node = (PurpleBlistNode *)buddy; - purple_blist_node_set_string(node, "log_reader_msn_log_filename", logfile); - g_free(logfile); - } - - root = xmlnode_from_str(contents, length); - g_free(contents); - if (!root) - return list; - - for (message = xmlnode_get_child(root, "Message"); message; - message = xmlnode_get_next_twin(message)) { - const char *session_id; - - session_id = xmlnode_get_attrib(message, "SessionID"); - if (!session_id) { - purple_debug_error("MSN log parse", - "Error parsing message: %s\n", "SessionID missing"); - continue; - } - - if (strcmp(session_id, old_session_id)) { - /* - * The session ID differs from the last message. - * Thus, this is the start of a new conversation. - */ - struct tm *tm; - time_t stamp; - PurpleLog *log; - - data = g_new0(struct msn_logger_data, 1); - data->root = root; - data->message = message; - data->session_id = session_id; - data->text = NULL; - data->last_log = FALSE; - - stamp = msn_logger_parse_timestamp(message, &tm); - - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, stamp, tm); - log->logger = msn_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - old_session_id = session_id; - } - - if (data) - data->last_log = TRUE; - - return g_list_reverse(list); -} - -static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct msn_logger_data *data; - GString *text = NULL; - xmlnode *message; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - if (data->text) { - /* The GTK code which displays the logs g_free()s whatever is - * returned from this function. Thus, we can't reuse the str - * part of the GString. The only solution is to free it and - * start over. - */ - g_string_free(data->text, FALSE); - } - - text = g_string_new(""); - - if (!data->root || !data->message || !data->session_id) { - /* Something isn't allocated correctly. */ - purple_debug_error("MSN log parse", - "Error parsing message: %s\n", "Internal variables inconsistent"); - data->text = text; - - return text->str; - } - - for (message = data->message; message; - message = xmlnode_get_next_twin(message)) { - - const char *new_session_id; - xmlnode *text_node; - const char *from_name = NULL; - const char *to_name = NULL; - xmlnode *from; - xmlnode *to; - enum name_guesses name_guessed = NAME_GUESS_UNKNOWN; - const char *their_name; - time_t time_unix; - struct tm *tm; - char *timestamp; - char *tmp; - const char *style; - - new_session_id = xmlnode_get_attrib(message, "SessionID"); - - /* If this triggers, something is wrong with the XML. */ - if (!new_session_id) { - purple_debug_error("MSN log parse", - "Error parsing message: %s\n", "New SessionID missing"); - break; - } - - if (strcmp(new_session_id, data->session_id)) { - /* The session ID differs from the first message. - * Thus, this is the start of a new conversation. - */ - break; - } - - text_node = xmlnode_get_child(message, "Text"); - if (!text_node) - continue; - - from = xmlnode_get_child(message, "From"); - if (from) { - xmlnode *user = xmlnode_get_child(from, "User"); - - if (user) { - from_name = xmlnode_get_attrib(user, "FriendlyName"); - - /* This saves a check later. */ - if (!*from_name) - from_name = NULL; - } - } - - to = xmlnode_get_child(message, "To"); - if (to) { - xmlnode *user = xmlnode_get_child(to, "User"); - if (user) { - to_name = xmlnode_get_attrib(user, "FriendlyName"); - - /* This saves a check later. */ - if (!*to_name) - to_name = NULL; - } - } - - their_name = from_name; - if (from_name && purple_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) { - const char *friendly_name = purple_connection_get_display_name(log->account->gc); - - if (friendly_name != NULL) { - int friendly_name_length = strlen(friendly_name); - const char *alias; - int alias_length; - PurpleBuddy *buddy = purple_find_buddy(log->account, log->name); - gboolean from_name_matches; - gboolean to_name_matches; - - if (buddy) - their_name = purple_buddy_get_alias(buddy); - - if (log->account->alias) - { - alias = log->account->alias; - alias_length = strlen(alias); - } - else - { - alias = ""; - alias_length = 0; - } - - /* Try to guess which user is me. - * The first step is to determine if either of the names matches either my - * friendly name or alias. For this test, "match" is defined as: - * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (purple_str_has_prefix(from_name, friendly_name) && - !isalnum(*(from_name + friendly_name_length))) || - (purple_str_has_prefix(from_name, alias) && - !isalnum(*(from_name + alias_length))); - - to_name_matches = to_name != NULL && ( - (purple_str_has_prefix(to_name, friendly_name) && - !isalnum(*(to_name + friendly_name_length))) || - (purple_str_has_prefix(to_name, alias) && - !isalnum(*(to_name + alias_length)))); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_ME; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } else { - if (buddy) { - const char *server_alias = NULL; - char *alias = g_strdup(purple_buddy_get_alias(buddy)); - char *temp; - - /* "Truncate" the string at the first non-alphanumeric - * character. The idea is to relax the comparison. - */ - for (temp = alias; *temp ; temp++) { - if (!isalnum(*temp)) { - *temp = '\0'; - break; - } - } - alias_length = strlen(alias); - - /* Try to guess which user is them. - * The first step is to determine if either of the names - * matches their alias. For this test, "match" is - * defined as: ^alias([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (purple_str_has_prefix( - from_name, alias) && - !isalnum(*(from_name + - alias_length))); - - to_name_matches = to_name && (purple_str_has_prefix( - to_name, alias) && - !isalnum(*(to_name + - alias_length))); - - g_free(alias); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_ME; - } else if ((server_alias = purple_buddy_get_server_alias(buddy))) { - friendly_name_length = - strlen(server_alias); - - /* Try to guess which user is them. - * The first step is to determine if either of - * the names matches their friendly name. For - * this test, "match" is defined as: - * ^friendly_name([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (purple_str_has_prefix( - from_name, - server_alias) && - !isalnum(*(from_name + - friendly_name_length))); - - to_name_matches = to_name && ( - (purple_str_has_prefix( - to_name, server_alias) && - !isalnum(*(to_name + - friendly_name_length)))); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_ME; - } - } - } - } - } - } - - if (name_guessed != NAME_GUESS_UNKNOWN) { - text = g_string_append(text, ""); - } - - time_unix = msn_logger_parse_timestamp(message, &tm); - - timestamp = g_strdup_printf("(%02u:%02u:%02u) ", - tm->tm_hour, tm->tm_min, tm->tm_sec); - text = g_string_append(text, timestamp); - g_free(timestamp); - - if (from_name) { - text = g_string_append(text, ""); - - if (name_guessed == NAME_GUESS_ME) { - if (log->account->alias) - text = g_string_append(text, log->account->alias); - else - text = g_string_append(text, log->account->username); - } - else if (name_guessed == NAME_GUESS_THEM) - text = g_string_append(text, their_name); - else - text = g_string_append(text, from_name); - - text = g_string_append(text, ": "); - } - - if (name_guessed != NAME_GUESS_UNKNOWN) - text = g_string_append(text, ""); - - style = xmlnode_get_attrib(text_node, "Style"); - - tmp = xmlnode_get_data(text_node); - if (style && *style) { - text = g_string_append(text, ""); - text = g_string_append(text, tmp); - text = g_string_append(text, "
"); - } else { - text = g_string_append(text, tmp); - text = g_string_append(text, "
"); - } - g_free(tmp); - } - - data->text = text; - - return text->str; -} - -static int msn_logger_size (PurpleLog *log) -{ - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - text = msn_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void msn_logger_finalize(PurpleLog *log) -{ - struct msn_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - if (data->last_log) - xmlnode_free(data->root); - - if (data->text) - g_string_free(data->text, FALSE); - - g_free(data); -} - - -/***************************************************************************** - * Trillian Logger * - *****************************************************************************/ - -/* The trillian logger doesn't write logs, only reads them. This is to include - * Trillian logs in the log viewer transparently. - */ - -static PurpleLogLogger *trillian_logger; -static void trillian_logger_finalize(PurpleLog *log); - -struct trillian_logger_data { - char *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list */ - int offset; - int length; - char *their_nickname; -}; - -static GList *trillian_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - PurplePlugin *plugin; - PurplePluginProtocolInfo *prpl_info; - char *prpl_name; - const char *buddy_name; - char *filename; - char *path; - GError *error = NULL; - gchar *contents = NULL; - gsize length; - gchar *line; - gchar *c; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - logdir = purple_prefs_get_string("/plugins/core/log_reader/trillian/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - plugin = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - - buddy_name = purple_normalize(account, sn); - - filename = g_strdup_printf("%s.log", buddy_name); - path = g_build_filename( - logdir, prpl_name, filename, NULL); - - purple_debug_info("Trillian log list", "Reading %s\n", path); - /* FIXME: There's really no need to read the entire file at once. - * See src/log.c:old_logger_list for a better approach. - */ - if (!g_file_get_contents(path, &contents, &length, &error)) { - if (error) { - g_error_free(error); - error = NULL; - } - g_free(path); - - path = g_build_filename( - logdir, prpl_name, "Query", filename, NULL); - purple_debug_info("Trillian log list", "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - if (error) - g_error_free(error); - } - } - g_free(filename); - - if (contents) { - struct trillian_logger_data *data = NULL; - int offset = 0; - int last_line_offset = 0; - - line = contents; - c = contents; - while (*c) { - offset++; - - if (*c != '\n') { - c++; - continue; - } - - *c = '\0'; - if (purple_str_has_prefix(line, "Session Close ")) { - if (data && !data->length) { - if (!(data->length = last_line_offset - data->offset)) { - /* This log had no data, so we remove it. */ - GList *last = g_list_last(list); - - purple_debug_info("Trillian log list", - "Empty log. Offset %i\n", data->offset); - - trillian_logger_finalize((PurpleLog *)last->data); - list = g_list_delete_link(list, last); - } - } - } else if (line[0] && line[1] && line[2] && - purple_str_has_prefix(&line[3], "sion Start ")) { - /* The conditional is to make sure we're not reading off - * the end of the string. We don't want strlen(), as that'd - * have to count the whole string needlessly. - * - * The odd check here is because a Session Start at the - * beginning of the file can be overwritten with a UTF-8 - * byte order mark. Yes, it's weird. - */ - char *their_nickname = line; - char *timestamp; - - if (data && !data->length) - data->length = last_line_offset - data->offset; - - while (*their_nickname && (*their_nickname != ':')) - their_nickname++; - their_nickname++; - - /* This code actually has nothing to do with - * the timestamp YET. I'm simply using this - * variable for now to NUL-terminate the - * their_nickname string. - */ - timestamp = their_nickname; - while (*timestamp && *timestamp != ')') - timestamp++; - - if (*timestamp == ')') { - char *month; - struct tm tm; - - *timestamp = '\0'; - if (line[0] && line[1] && line[2]) - timestamp += 3; - - /* Now we start dealing with the timestamp. */ - - /* Skip over the day name. */ - while (*timestamp && (*timestamp != ' ')) - timestamp++; - *timestamp = '\0'; - timestamp++; - - /* Parse out the month. */ - month = timestamp; - while (*timestamp && (*timestamp != ' ')) - timestamp++; - *timestamp = '\0'; - timestamp++; - - /* Parse the day, time, and year. */ - if (sscanf(timestamp, "%u %u:%u:%u %u", - &tm.tm_mday, &tm.tm_hour, - &tm.tm_min, &tm.tm_sec, - &tm.tm_year) != 5) { - - purple_debug_error("Trillian log timestamp parse", - "Session Start parsing error\n"); - } else { - PurpleLog *log; - - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. - */ - tm.tm_isdst = -1; - tm.tm_mon = get_month(month); - - data = g_new0( - struct trillian_logger_data, 1); - data->path = g_strdup(path); - data->offset = offset; - data->length = 0; - data->their_nickname = - g_strdup(their_nickname); - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, - sn, account, NULL, mktime(&tm), NULL); - log->logger = trillian_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - } - } - c++; - line = c; - last_line_offset = offset; - } - - g_free(contents); - } - g_free(path); - - g_free(prpl_name); - - return g_list_reverse(list); -} - -static char * trillian_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct trillian_logger_data *data; - char *read; - FILE *file; - PurpleBuddy *buddy; - char *escaped; - GString *formatted; - char *c; - const char *line; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - g_return_val_if_fail(data->their_nickname != NULL, g_strdup("")); - - purple_debug_info("Trillian log read", "Reading %s\n", data->path); - - read = g_malloc(data->length + 2); - - file = g_fopen(data->path, "rb"); - fseek(file, data->offset, SEEK_SET); - data->length = fread(read, 1, data->length, file); - fclose(file); - - if (read[data->length-1] == '\n') { - read[data->length] = '\0'; - } else { - read[data->length] = '\n'; - read[data->length+1] = '\0'; - } - - /* Load miscellaneous data. */ - buddy = purple_find_buddy(log->account, log->name); - - escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - - /* Apply formatting... */ - formatted = g_string_sized_new(strlen(read)); - c = read; - line = read; - while (c) - { - const char *link; - const char *footer = NULL; - GString *temp = NULL; - - if ((c = strstr(c, "\n"))) - { - *c = '\0'; - c++; - } - - /* Convert links. - * - * The format is (Link: URL)URL - * So, I want to find each occurance of "(Link: " and replace that chunk with: - * - * Then, replace the next " " (or add this if the end-of-line is reached) with: - * - * - * As implemented, this isn't perfect, but it should cover common cases. - */ - while (line && (link = strstr(line, "(Link: "))) - { - const char *tmp = link; - - link += 7; - if (*link) - { - char *end_paren; - char *space; - - if (!(end_paren = strstr(link, ")"))) - { - /* Something is not as we expect. Bail out. */ - break; - } - - if (!temp) - temp = g_string_sized_new(c ? (c - 1 - line) : strlen(line)); - - g_string_append_len(temp, line, (tmp - line)); - - /* Start an tag. */ - g_string_append(temp, " tag. */ - g_string_append(temp, "\">"); - - /* The \r is a bit of a hack to keep there from being a \r in - * the link text, which may not matter. */ - if ((space = strstr(end_paren, " ")) || (space = strstr(end_paren, "\r"))) - { - g_string_append_len(temp, end_paren + 1, space - end_paren - 1); - - /* Close the tag. */ - g_string_append(temp, ""); - - space++; - } - else - { - /* There is no space before the end of the line. */ - g_string_append(temp, end_paren + 1); - /* Close the tag. */ - g_string_append(temp, ""); - } - line = space; - } - else - { - /* Something is not as we expect. Bail out. */ - break; - } - } - - if (temp) - { - if (line) - g_string_append(temp, line); - line = temp->str; - } - - if (*line == '[') { - const char *timestamp; - - if ((timestamp = strstr(line, "]"))) { - line++; - /* TODO: Parse the timestamp and convert it to Purple's format. */ - g_string_append(formatted, "("); - g_string_append_len(formatted, line, (timestamp - line)); - g_string_append(formatted,") "); - line = timestamp + 1; - if (line[0] && line[1]) - line++; - } - - if (purple_str_has_prefix(line, "*** ")) { - line += (sizeof("*** ") - 1); - g_string_append(formatted, ""); - footer = ""; - if (purple_str_has_prefix(line, "NOTE: This user is offline.")) { - line = _("User is offline."); - } else if (purple_str_has_prefix(line, - "NOTE: Your status is currently set to ")) { - - line += (sizeof("NOTE: ") - 1); - } else if (purple_str_has_prefix(line, "Auto-response sent to ")) { - g_string_append(formatted, _("Auto-response sent:")); - while (*line && *line != ':') - line++; - if (*line) - line++; - g_string_append(formatted, ""); - footer = NULL; - } else if (strstr(line, " signed off ")) { - const char *alias = NULL; - - if (buddy != NULL) - alias = purple_buddy_get_alias(buddy); - - if (alias != NULL) { - g_string_append_printf(formatted, - _("%s has signed off."), alias); - } else { - g_string_append_printf(formatted, - _("%s has signed off."), log->name); - } - line = ""; - } else if (strstr(line, " signed on ")) { - const char *alias = NULL; - - if (buddy != NULL) - alias = purple_buddy_get_alias(buddy); - - if (alias != NULL) - g_string_append(formatted, alias); - else - g_string_append(formatted, log->name); - - line = " logged in."; - } else if (purple_str_has_prefix(line, - "One or more messages may have been undeliverable.")) { - - g_string_append(formatted, - ""); - g_string_append(formatted, - _("One or more messages may have been " - "undeliverable.")); - line = ""; - footer = ""; - } else if (purple_str_has_prefix(line, - "You have been disconnected.")) { - - g_string_append(formatted, - ""); - g_string_append(formatted, - _("You were disconnected from the server.")); - line = ""; - footer = ""; - } else if (purple_str_has_prefix(line, - "You are currently disconnected.")) { - - g_string_append(formatted, - ""); - line = _("You are currently disconnected. Messages " - "will not be received unless you are " - "logged in."); - footer = ""; - } else if (purple_str_has_prefix(line, - "Your previous message has not been sent.")) { - - g_string_append(formatted, - ""); - - if (purple_str_has_prefix(line, - "Your previous message has not been sent. " - "Reason: Maximum length exceeded.")) { - - g_string_append(formatted, - _("Message could not be sent because " - "the maximum length was exceeded.")); - line = ""; - } else { - g_string_append(formatted, - _("Message could not be sent.")); - line += (sizeof( - "Your previous message " - "has not been sent. ") - 1); - } - - footer = ""; - } - } else if (purple_str_has_prefix(line, data->their_nickname)) { - if (buddy != NULL) { - const char *alias = purple_buddy_get_alias(buddy); - - if (alias != NULL) { - line += strlen(data->their_nickname) + 2; - g_string_append_printf(formatted, - "" - "%s: ", alias); - } - } - } else { - const char *line2 = strstr(line, ":"); - if (line2) { - const char *acct_name; - line2++; - line = line2; - acct_name = purple_account_get_alias(log->account); - if (!acct_name) - acct_name = purple_account_get_username(log->account); - - g_string_append_printf(formatted, - "" - "%s:", acct_name); - } - } - } - - g_string_append(formatted, line); - - line = c; - if (temp) - g_string_free(temp, TRUE); - - if (footer) - g_string_append(formatted, footer); - - g_string_append(formatted, "
"); - } - - g_free(read); - - /* XXX: TODO: What can we do about removing \r characters? - * XXX: TODO: and will that allow us to avoid this - * XXX: TODO: g_strchomp(), or is that unrelated? */ - /* XXX: TODO: Avoid this g_strchomp() */ - return g_strchomp(g_string_free(formatted, FALSE)); -} - -static int trillian_logger_size (PurpleLog *log) -{ - struct trillian_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = trillian_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void trillian_logger_finalize(PurpleLog *log) -{ - struct trillian_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data->their_nickname); - g_free(data); -} - -/***************************************************************************** - * QIP Logger * - *****************************************************************************/ - -/* The QIP logger doesn't write logs, only reads them. This is to include - * QIP logs in the log viewer transparently. - */ -#define QIP_LOG_DELIMITER "--------------------------------------" -#define QIP_LOG_IN_MESSAGE (QIP_LOG_DELIMITER "<-") -#define QIP_LOG_OUT_MESSAGE (QIP_LOG_DELIMITER ">-") -#define QIP_LOG_IN_MESSAGE_ESC (QIP_LOG_DELIMITER "<-") -#define QIP_LOG_OUT_MESSAGE_ESC (QIP_LOG_DELIMITER ">-") -#define QIP_LOG_TIMEOUT (60*60) - -static PurpleLogLogger *qip_logger; - -struct qip_logger_data { - - char *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list */ - int offset; - int length; -}; - -static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - PurplePlugin *plugin; - PurplePluginProtocolInfo *prpl_info; - char *username; - char *filename; - char *path; - char *contents; - struct qip_logger_data *data = NULL; - struct tm prev_tm; - struct tm tm; - gboolean prev_tm_init = FALSE; - gboolean main_cycle = TRUE; - char *c; - char *start_log; - char *new_line = NULL; - int offset = 0; - GError *error; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - /* QIP only supports ICQ. */ - if (strcmp(account->protocol_id, "prpl-icq")) - return NULL; - - logdir = purple_prefs_get_string("/plugins/core/log_reader/qip/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - plugin = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - username = g_strdup(purple_normalize(account, account->username)); - filename = g_strdup_printf("%s.txt", purple_normalize(account, sn)); - path = g_build_filename(logdir, username, "History", filename, NULL); - g_free(username); - g_free(filename); - - purple_debug_info("QIP logger", "Reading %s\n", path); - - error = NULL; - if (!g_file_get_contents(path, &contents, NULL, &error)) { - purple_debug_error("QIP logger", - "Couldn't read file %s: %s \n", path, - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - g_free(path); - return list; - } - - c = contents; - start_log = contents; - while (main_cycle) { - - gboolean add_new_log = FALSE; - - if (*c) { - if (purple_str_has_prefix(c, QIP_LOG_IN_MESSAGE) || - purple_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) { - - char *tmp; - - new_line = c; - - /* find EOL */ - c = strstr(c, "\n"); - c++; - - /* Find the last '(' character. */ - if ((tmp = strstr(c, "\n")) != NULL) { - while (*tmp && *tmp != '(') --tmp; - c = tmp; - } else { - while (*c) - c++; - c--; - c = g_strrstr(c, "("); - } - - if (c != NULL) { - const char *timestamp = ++c; - - /* Parse the time, day, month and year */ - if (sscanf(timestamp, "%u:%u:%u %u/%u/%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec, - &tm.tm_mday, &tm.tm_mon, &tm.tm_year) != 6) { - - purple_debug_error("QIP logger list", - "Parsing timestamp error\n"); - } else { - tm.tm_mon -= 1; - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. */ - tm.tm_isdst = -1; - - if (!prev_tm_init) { - prev_tm = tm; - prev_tm_init = TRUE; - } else { - add_new_log = difftime(mktime(&tm), mktime(&prev_tm)) > QIP_LOG_TIMEOUT; - } - } - } - } - } else { - add_new_log = TRUE; - main_cycle = FALSE; - new_line = c; - } - - /* adding log */ - if (add_new_log && prev_tm_init) { - PurpleLog *log; - - /* filling data */ - data = g_new0(struct qip_logger_data, 1); - data->path = g_strdup(path); - data->length = new_line - start_log; - data->offset = offset; - offset += data->length; - purple_debug_info("QIP logger list", - "Creating log: path = (%s); length = (%d); offset = (%d)\n", - data->path, data->length, data->offset); - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, sn, account, - NULL, mktime(&prev_tm), NULL); - - log->logger = qip_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - - prev_tm = tm; - start_log = new_line; - } - - if (*c) { - /* find EOF */ - c = strstr(c, "\n"); - c++; - } - } - - g_free(contents); - g_free(path); - return g_list_reverse(list); -} - -static char *qip_logger_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct qip_logger_data *data; - PurpleBuddy *buddy; - GString *formatted; - char *c; - const char *line; - gchar *contents; - GError *error; - char *utf8_string; - FILE *file; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - - file = g_fopen(data->path, "rb"); - g_return_val_if_fail(file != NULL, g_strdup("")); - - contents = g_malloc(data->length + 2); - - fseek(file, data->offset, SEEK_SET); - data->length = fread(contents, 1, data->length, file); - fclose(file); - - contents[data->length] = '\n'; - contents[data->length + 1] = '\0'; - - /* Convert file contents from Cp1251 to UTF-8 codeset */ - error = NULL; - if (!(utf8_string = g_convert(contents, -1, "UTF-8", "Cp1251", NULL, NULL, &error))) { - purple_debug_error("QIP logger", - "Couldn't convert file %s to UTF-8: %s\n", data->path, - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - g_free(contents); - return g_strdup(""); - } - - g_free(contents); - contents = g_markup_escape_text(utf8_string, -1); - g_free(utf8_string); - - buddy = purple_find_buddy(log->account, log->name); - - /* Apply formatting... */ - formatted = g_string_sized_new(data->length + 2); - c = contents; - line = contents; - - while (c && *c) { - gboolean is_in_message = FALSE; - - if (purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC) || - purple_str_has_prefix(line, QIP_LOG_OUT_MESSAGE_ESC)) { - - char *tmp; - const char *buddy_name; - - is_in_message = purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC); - - /* find EOL */ - c = strstr(c, "\n"); - - /* XXX: Do we need buddy_name when we have buddy->alias? */ - buddy_name = ++c; - - /* Find the last '(' character. */ - if ((tmp = strstr(c, "\n")) != NULL) { - while (*tmp && *tmp != '(') --tmp; - c = tmp; - } else { - while (*c) - c++; - c--; - c = g_strrstr(c, "("); - } - - if (c != NULL) { - const char *timestamp = c; - int hour; - int min; - int sec; - - timestamp++; - - /* Parse the time, day, month and year */ - if (sscanf(timestamp, "%u:%u:%u", - &hour, &min, &sec) != 3) { - purple_debug_error("QIP logger read", - "Parsing timestamp error\n"); - } else { - g_string_append(formatted, ""); - /* TODO: Figure out if we can do anything more locale-independent. */ - g_string_append_printf(formatted, - "(%u:%02u:%02u) %cM ", hour % 12, - min, sec, (hour >= 12) ? 'P': 'A'); - g_string_append(formatted, " "); - - if (is_in_message) { - const char *alias = NULL; - - if (buddy_name != NULL && buddy != NULL && - (alias = purple_buddy_get_alias(buddy))) - { - g_string_append_printf(formatted, - "" - "%s: ", alias); - } - } else { - const char *acct_name; - acct_name = purple_account_get_alias(log->account); - if (!acct_name) - acct_name = purple_account_get_username(log->account); - - g_string_append_printf(formatted, - "" - "%s: ", acct_name); - } - - /* find EOF */ - c = strstr(c, "\n"); - line = ++c; - } - } - } else { - if ((c = strstr(c, "\n"))) - *c = '\0'; - - if (line[0] != '\n' && line[0] != '\r') { - - g_string_append(formatted, line); - g_string_append(formatted, "
"); - } - - if (c) - line = ++c; - } - } - g_free(contents); - - /* XXX: TODO: Avoid this g_strchomp() */ - return g_strchomp(g_string_free(formatted, FALSE)); -} - -static int qip_logger_size (PurpleLog *log) -{ - struct qip_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = qip_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void qip_logger_finalize(PurpleLog *log) -{ - struct qip_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data); -} - -/************************************************************************* - * aMSN Logger * - *************************************************************************/ - -/* The aMSN logger doesn't write logs, only reads them. This is to include - * aMSN logs in the log viewer transparently. - */ - -static PurpleLogLogger *amsn_logger; - -struct amsn_logger_data { - char *path; - int offset; - int length; -}; - -#define AMSN_LOG_CONV_START "|\"LRED[Conversation started on " -#define AMSN_LOG_CONV_END "|\"LRED[You have closed the window on " -#define AMSN_LOG_CONV_EXTRA "01 Aug 2001 00:00:00]" - -static GList *amsn_logger_parse_file(char *filename, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - GError *error; - char *contents; - struct amsn_logger_data *data; - PurpleLog *log; - - purple_debug_info("aMSN logger", "Reading %s\n", filename); - error = NULL; - if (!g_file_get_contents(filename, &contents, NULL, &error)) { - purple_debug_error("aMSN logger", - "Couldn't read file %s: %s \n", filename, - (error && error->message) ? - error->message : "Unknown error"); - if (error) - g_error_free(error); - } else { - char *c = contents; - gboolean found_start = FALSE; - char *start_log = c; - int offset = 0; - struct tm tm; - while (c && *c) { - if (purple_str_has_prefix(c, AMSN_LOG_CONV_START)) { - char month[4]; - if (sscanf(c + strlen(AMSN_LOG_CONV_START), - "%u %3s %u %u:%u:%u", - &tm.tm_mday, (char*)&month, &tm.tm_year, - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { - found_start = FALSE; - purple_debug_error("aMSN logger", - "Error parsing start date for %s\n", - filename); - } else { - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. - */ - tm.tm_isdst = -1; - tm.tm_mon = get_month(month); - - found_start = TRUE; - offset = c - contents; - start_log = c; - } - } else if (purple_str_has_prefix(c, AMSN_LOG_CONV_END) && found_start) { - data = g_new0(struct amsn_logger_data, 1); - data->path = g_strdup(filename); - data->offset = offset; - data->length = c - start_log - + strlen(AMSN_LOG_CONV_END) - + strlen(AMSN_LOG_CONV_EXTRA); - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = amsn_logger; - log->logger_data = data; - list = g_list_prepend(list, log); - found_start = FALSE; - - purple_debug_info("aMSN logger", - "Found log for %s:" - " path = (%s)," - " offset = (%d)," - " length = (%d)\n", - sn, data->path, data->offset, data->length); - } - c = strstr(c, "\n"); - c++; - } - - /* I've seen the file end without the AMSN_LOG_CONV_END bit */ - if (found_start) { - data = g_new0(struct amsn_logger_data, 1); - data->path = g_strdup(filename); - data->offset = offset; - data->length = c - start_log - + strlen(AMSN_LOG_CONV_END) - + strlen(AMSN_LOG_CONV_EXTRA); - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = amsn_logger; - log->logger_data = data; - list = g_list_prepend(list, log); - found_start = FALSE; - - purple_debug_info("aMSN logger", - "Found log for %s:" - " path = (%s)," - " offset = (%d)," - " length = (%d)\n", - sn, data->path, data->offset, data->length); - } - g_free(contents); - } - - return list; -} - -/* `log_dir`/username@hotmail.com/logs/buddyname@hotmail.com.log */ -/* `log_dir`/username@hotmail.com/logs/Month Year/buddyname@hotmail.com.log */ -static GList *amsn_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - char *username; - char *log_path; - char *buddy_log; - char *filename; - GDir *dir; - const char *name; - - logdir = purple_prefs_get_string("/plugins/core/log_reader/amsn/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - /* aMSN only works with MSN/WLM */ - if (strcmp(account->protocol_id, "prpl-msn")) - return NULL; - - username = g_strdup(purple_normalize(account, account->username)); - buddy_log = g_strdup_printf("%s.log", purple_normalize(account, sn)); - log_path = g_build_filename(logdir, username, "logs", NULL); - - /* First check in the top-level */ - filename = g_build_filename(log_path, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = amsn_logger_parse_file(filename, sn, account); - else - g_free(filename); - - /* Check in previous months */ - dir = g_dir_open(log_path, 0, NULL); - if (dir) { - while ((name = g_dir_read_name(dir)) != NULL) { - filename = g_build_filename(log_path, name, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = g_list_concat(list, amsn_logger_parse_file(filename, sn, account)); - g_free(filename); - } - g_dir_close(dir); - } - - g_free(log_path); - - /* New versions use 'friendlier' directory names */ - purple_util_chrreplace(username, '@', '_'); - purple_util_chrreplace(username, '.', '_'); - - log_path = g_build_filename(logdir, username, "logs", NULL); - - /* First check in the top-level */ - filename = g_build_filename(log_path, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = g_list_concat(list, amsn_logger_parse_file(filename, sn, account)); - g_free(filename); - - /* Check in previous months */ - dir = g_dir_open(log_path, 0, NULL); - if (dir) { - while ((name = g_dir_read_name(dir)) != NULL) { - filename = g_build_filename(log_path, name, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = g_list_concat(list, amsn_logger_parse_file(filename, sn, account)); - g_free(filename); - } - g_dir_close(dir); - } - - g_free(log_path); - g_free(username); - g_free(buddy_log); - - return list; -} - -/* Really it's |"L, but the string's been escaped */ -#define AMSN_LOG_FORMAT_TAG "|"L" - -static char *amsn_logger_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct amsn_logger_data *data; - FILE *file; - char *contents; - char *escaped; - GString *formatted; - char *start; - gboolean in_span = FALSE; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - - contents = g_malloc(data->length + 2); - - file = g_fopen(data->path, "rb"); - g_return_val_if_fail(file != NULL, g_strdup("")); - - fseek(file, data->offset, SEEK_SET); - data->length = fread(contents, 1, data->length, file); - fclose(file); - - contents[data->length] = '\n'; - contents[data->length + 1] = '\0'; - - escaped = g_markup_escape_text(contents, -1); - g_free(contents); - contents = escaped; - - formatted = g_string_sized_new(data->length + 2); - - start = contents; - while (start && *start) { - char *end; - char *old_tag; - char *tag; - end = strstr(start, "\n"); - if (!end) - break; - *end = '\0'; - if (purple_str_has_prefix(start, AMSN_LOG_FORMAT_TAG) && in_span) { - /* New format for this line */ - g_string_append(formatted, "
"); - in_span = FALSE; - } else if (start != contents) { - /* Continue format from previous line */ - g_string_append(formatted, "
"); - } - old_tag = start; - tag = strstr(start, AMSN_LOG_FORMAT_TAG); - while (tag) { - g_string_append_len(formatted, old_tag, tag - old_tag); - tag += strlen(AMSN_LOG_FORMAT_TAG); - if (in_span) { - g_string_append(formatted, ""); - in_span = FALSE; - } - if (*tag == 'C') { - /* |"LCxxxxxx is a hex colour */ - char colour[7]; - strncpy(colour, tag + 1, 6); - colour[6] = '\0'; - g_string_append_printf(formatted, "", colour); - /* This doesn't appear to work? */ - /* g_string_append_printf(formatted, "", tag + 1); */ - in_span = TRUE; - old_tag = tag + 7; /* C + xxxxxx */ - } else { - /* |"Lxxx is a 3-digit colour code */ - if (purple_str_has_prefix(tag, "RED")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "GRA")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "NOR")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "ITA")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "GRE")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else { - purple_debug_info("aMSN logger", "Unknown colour format: %3s\n", tag); - } - old_tag = tag + 3; - } - tag = strstr(tag, AMSN_LOG_FORMAT_TAG); - } - g_string_append(formatted, old_tag); - start = end + 1; - } - if (in_span) - g_string_append(formatted, ""); - - g_free(contents); - - return g_string_free(formatted, FALSE); -} - -static int amsn_logger_size(PurpleLog *log) -{ - struct amsn_logger_data *data; - char *text; - int size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = amsn_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void amsn_logger_finalize(PurpleLog *log) -{ - struct amsn_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - g_free(data->path); - g_free(data); -} - -/***************************************************************************** - * Plugin Code * - *****************************************************************************/ - -static void -init_plugin(PurplePlugin *plugin) -{ - -} - -static void log_reader_init_prefs(void) { - char *path; -#ifdef _WIN32 - char *folder; - gboolean found = FALSE; -#endif - - purple_prefs_add_none("/plugins/core/log_reader"); - - - /* Add general preferences. */ - - purple_prefs_add_bool("/plugins/core/log_reader/fast_sizes", FALSE); - purple_prefs_add_bool("/plugins/core/log_reader/use_name_heuristics", TRUE); - - - /* Add Adium log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/adium"); - - /* Calculate default Adium log directory. */ -#ifdef _WIN32 - purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", ""); -#else - path = g_build_filename(purple_home_dir(), "Library", "Application Support", - "Adium 2.0", "Users", "Default", "Logs", NULL); - purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", path); - g_free(path); -#endif - - - /* Add Fire log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/fire"); - - /* Calculate default Fire log directory. */ -#ifdef _WIN32 - purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", ""); -#else - path = g_build_filename(purple_home_dir(), "Library", "Application Support", - "Fire", "Sessions", NULL); - purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", path); - g_free(path); -#endif - - - /* Add Messenger Plus! log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/messenger_plus"); - - /* Calculate default Messenger Plus! log directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PERSONAL); - if (folder) { - path = g_build_filename(folder, "My Chat Logs", NULL); - g_free(folder); - } -#else - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Documents and Settings", g_get_user_name(), - "My Documents", "My Chat Logs", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path ? path : ""); - g_free(path); - - - /* Add MSN Messenger log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/msn"); - - /* Calculate default MSN message history directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PERSONAL); - if (folder) { - path = g_build_filename(folder, "My Received Files", NULL); - g_free(folder); - } -#else - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Documents and Settings", g_get_user_name(), - "My Documents", "My Received Files", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path ? path : ""); - g_free(path); - - - /* Add Trillian log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/trillian"); - -#ifdef _WIN32 - /* XXX: While a major hack, this is the most reliable way I could - * think of to determine the Trillian installation directory. - */ - - path = NULL; - if ((folder = wpurple_read_reg_string(HKEY_CLASSES_ROOT, "Trillian.SkinZip\\shell\\Add\\command\\", NULL))) { - char *value = folder; - char *temp; - - /* Break apart buffer. */ - if (*value == '"') { - value++; - temp = value; - while (*temp && *temp != '"') - temp++; - } else { - temp = value; - while (*temp && *temp != ' ') - temp++; - } - *temp = '\0'; - - /* Set path. */ - if (purple_str_has_suffix(value, "trillian.exe")) { - value[strlen(value) - (sizeof("trillian.exe") - 1)] = '\0'; - path = g_build_filename(value, "users", "default", "talk.ini", NULL); - } - g_free(folder); - } - - if (!path) { - char *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "Trillian", - "users", "default", "talk.ini", NULL); - g_free(folder); - } - } - - if (path) { - /* Read talk.ini file to find the log directory. */ - GError *error = NULL; - -#if 0 && GLIB_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ - GKeyFile *key_file; - - purple_debug_info("Trillian talk.ini read", "Reading %s\n", path); - - error = NULL; - if (!g_key_file_load_from_file(key_file, path, G_KEY_FILE_NONE, GError &error)) { - purple_debug_error("Trillian talk.ini read", - "Error reading talk.ini\n"); - if (error) - g_error_free(error); - } else { - char *logdir = g_key_file_get_string(key_file, "Logging", "Directory", &error); - if (error) { - purple_debug_error("Trillian talk.ini read", - "Error reading Directory value from Logging section\n"); - g_error_free(error); - } - - if (logdir) { - g_strchomp(logdir); - purple_prefs_add_string("/plugins/core/log_reader/trillian/log_directory", logdir); - found = TRUE; - } - - g_key_file_free(key_file); - } -#else /* !GLIB_CHECK_VERSION(2,6,0) */ - gchar *contents = NULL; - - purple_debug_info("Trillian talk.ini read", - "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, NULL, &error)) { - purple_debug_error("Trillian talk.ini read", - "Error reading talk.ini: %s\n", - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - } else { - char *cursor, *line; - line = cursor = contents; - while (*cursor) { - if (*cursor == '\n') { - *cursor = '\0'; - - /* XXX: This assumes the first Directory key is under [Logging]. */ - if (purple_str_has_prefix(line, "Directory=")) { - line += (sizeof("Directory=") - 1); - g_strchomp(line); - purple_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", - line); - found = TRUE; - } - - cursor++; - line = cursor; - } else - cursor++; - } - g_free(contents); - } - g_free(path); -#endif /* !GTK_CHECK_VERSION(2,6,0) */ - } /* path */ - - if (!found) { - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "Trillian", "users", - "default", "logs", NULL); - g_free(folder); - } - - purple_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", path ? path : ""); - g_free(path); - } -#else /* !defined(_WIN32) */ - /* TODO: At some point, this could attempt to parse talk.ini - * TODO: from the default Trillian install directory on the - * TODO: Windows mount point. */ - - /* Calculate default Trillian log directory. */ - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Program Files", "Trillian", "users", - "default", "logs", NULL); - purple_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", path); - g_free(path); -#endif - - /* Add QIP log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/qip"); - - /* Calculate default QIP log directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "QIP", "Users", NULL); - g_free(folder); - } -#else - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Program Files", "QIP", "Users", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path ? path : ""); - g_free(path); - - /* Add aMSN Messenger log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/amsn"); - - /* Calculate default aMSN log directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PROFILE); /* Silly aMSN, not using CSIDL_APPDATA */ - if (folder) { - path = g_build_filename(folder, "amsn", NULL); - g_free(folder); - } -#else - path = g_build_filename(purple_home_dir(), ".amsn", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/amsn/log_directory", path ? path : ""); - g_free(path); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - log_reader_init_prefs(); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - adium_logger = purple_log_logger_new("adium", _("Adium"), 6, - NULL, - NULL, - adium_logger_finalize, - adium_logger_list, - adium_logger_read, - adium_logger_size); - purple_log_logger_add(adium_logger); - -#if 0 - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - fire_logger = purple_log_logger_new("fire", _("Fire"), 6, - NULL, - NULL, - fire_logger_finalize, - fire_logger_list, - fire_logger_read, - fire_logger_size); - purple_log_logger_add(fire_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - messenger_plus_logger = purple_log_logger_new("messenger_plus", _("Messenger Plus!"), 6, - NULL, - NULL, - messenger_plus_logger_finalize, - messenger_plus_logger_list, - messenger_plus_logger_read, - messenger_plus_logger_size); - purple_log_logger_add(messenger_plus_logger); - -#endif - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - qip_logger = purple_log_logger_new("qip", _("QIP"), 6, - NULL, - NULL, - qip_logger_finalize, - qip_logger_list, - qip_logger_read, - qip_logger_size); - purple_log_logger_add(qip_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - msn_logger = purple_log_logger_new("msn", _("MSN Messenger"), 6, - NULL, - NULL, - msn_logger_finalize, - msn_logger_list, - msn_logger_read, - msn_logger_size); - purple_log_logger_add(msn_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - trillian_logger = purple_log_logger_new("trillian", _("Trillian"), 6, - NULL, - NULL, - trillian_logger_finalize, - trillian_logger_list, - trillian_logger_read, - trillian_logger_size); - purple_log_logger_add(trillian_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - amsn_logger = purple_log_logger_new("amsn", _("aMSN"), 6, - NULL, - NULL, - amsn_logger_finalize, - amsn_logger_list, - amsn_logger_read, - amsn_logger_size); - purple_log_logger_add(amsn_logger); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - purple_log_logger_remove(adium_logger); - purple_log_logger_free(adium_logger); - adium_logger = NULL; - -#if 0 - purple_log_logger_remove(fire_logger); - purple_log_logger_free(fire_logger); - fire_logger = NULL; - - purple_log_logger_remove(messenger_plus_logger); - purple_log_logger_free(messenger_plus_logger); - messenger_plus_logger = NULL; -#endif - - purple_log_logger_remove(msn_logger); - purple_log_logger_free(msn_logger); - msn_logger = NULL; - - purple_log_logger_remove(trillian_logger); - purple_log_logger_free(trillian_logger); - trillian_logger = NULL; - - purple_log_logger_remove(qip_logger); - purple_log_logger_free(qip_logger); - qip_logger = NULL; - - purple_log_logger_remove(amsn_logger); - purple_log_logger_free(amsn_logger); - amsn_logger = NULL; - - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - g_return_val_if_fail(plugin != NULL, FALSE); - - frame = purple_plugin_pref_frame_new(); - - - /* Add general preferences. */ - - ppref = purple_plugin_pref_new_with_label(_("General Log Reading Configuration")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/fast_sizes", _("Fast size calculations")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/use_name_heuristics", _("Use name heuristics")); - purple_plugin_pref_frame_add(frame, ppref); - - - /* Add Log Directory preferences. */ - - ppref = purple_plugin_pref_new_with_label(_("Log Directory")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/adium/log_directory", _("Adium")); - purple_plugin_pref_frame_add(frame, ppref); - -#if 0 - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/fire/log_directory", _("Fire")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/messenger_plus/log_directory", _("Messenger Plus!")); - purple_plugin_pref_frame_add(frame, ppref); -#endif - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/qip/log_directory", _("QIP")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/msn/log_directory", _("MSN Messenger")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/trillian/log_directory", _("Trillian")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/amsn/log_directory", _("aMSN")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (reserved) */ - NULL, /* frame (reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "core-log_reader", /**< id */ - N_("Log Reader"), /**< name */ - DISPLAY_VERSION, /**< version */ - - /** summary */ - N_("Includes other IM clients' logs in the " - "log viewer."), - - /** description */ - N_("When viewing logs, this plugin will include " - "logs from other IM clients. Currently, this " - "includes Adium, MSN Messenger, aMSN, and " - "Trillian.\n\n" - "WARNING: This plugin is still alpha code and " - "may crash frequently. Use it at your own risk!"), - - "Richard Laager ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -PURPLE_INIT_PLUGIN(log_reader, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -DIST_SUBDIRS = mono perl ssl tcl - -if USE_PERL -PERL_DIR = perl -endif - -if USE_TCL -TCL_DIR = tcl -endif - -if ENABLE_DBUS -DBUS_LTLIB = dbus-example.la -endif - -if USE_MONO -MONO_DIR = mono -endif - -SUBDIRS = \ - $(MONO_DIR) \ - $(PERL_DIR) \ - ssl \ - $(TCL_DIR) - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -autoaccept_la_LDFLAGS = -module -avoid-version -buddynote_la_LDFLAGS = -module -avoid-version -ciphertest_la_LDFLAGS = -module -avoid-version -codeinline_la_LDFLAGS = -module -avoid-version -debug_example_la_LDFLAGS = -module -avoid-version -helloworld_la_LDFLAGS = -module -avoid-version -idle_la_LDFLAGS = -module -avoid-version -joinpart_la_LDFLAGS = -module -avoid-version -log_reader_la_LDFLAGS = -module -avoid-version -newline_la_LDFLAGS = -module -avoid-version -notify_example_la_LDFLAGS = -module -avoid-version -offlinemsg_la_LDFLAGS = -module -avoid-version -one_time_password_la_LDFLAGS = -module -avoid-version -pluginpref_example_la_LDFLAGS = -module -avoid-version -psychic_la_LDFLAGS = -module -avoid-version -signals_test_la_LDFLAGS = -module -avoid-version -simple_la_LDFLAGS = -module -avoid-version -statenotify_la_LDFLAGS = -module -avoid-version - -# this can't be in a conditional otherwise automake 1.4 yells -dbus_example_la_LDFLAGS = -module -avoid-version - -if PLUGINS - -plugin_LTLIBRARIES = \ - autoaccept.la \ - buddynote.la \ - idle.la \ - joinpart.la \ - log_reader.la \ - newline.la \ - offlinemsg.la \ - psychic.la \ - statenotify.la \ - $(DBUS_LTLIB) - -noinst_LTLIBRARIES = \ - ciphertest.la \ - codeinline.la \ - debug_example.la \ - helloworld.la \ - notify_example.la \ - one_time_password.la \ - pluginpref_example.la \ - signals_test.la \ - simple.la - -autoaccept_la_SOURCES = autoaccept.c -buddynote_la_SOURCES = buddynote.c -ciphertest_la_SOURCES = ciphertest.c -codeinline_la_SOURCES = codeinline.c -debug_example_la_SOURCES = debug_example.c -helloworld_la_SOURCES = helloworld.c -idle_la_SOURCES = idle.c -joinpart_la_SOURCES = joinpart.c -log_reader_la_SOURCES = log_reader.c -newline_la_SOURCES = newline.c -notify_example_la_SOURCES = notify_example.c -offlinemsg_la_SOURCES = offlinemsg.c -one_time_password_la_SOURCES = one_time_password.c -pluginpref_example_la_SOURCES = pluginpref_example.c -psychic_la_SOURCES = psychic.c -signals_test_la_SOURCES = signals-test.c -simple_la_SOURCES = simple.c -statenotify_la_SOURCES = statenotify.c - -autoaccept_la_LIBADD = $(GLIB_LIBS) -buddynote_la_LIBADD = $(GLIB_LIBS) -ciphertest_la_LIBADD = $(GLIB_LIBS) -codeinline_la_LIBADD = $(GLIB_LIBS) -idle_la_LIBADD = $(GLIB_LIBS) -joinpart_la_LIBADD = $(GLIB_LIBS) -log_reader_la_LIBADD = $(GLIB_LIBS) -newline_la_LIBADD = $(GLIB_LIBS) -notify_example_la_LIBADD = $(GLIB_LIBS) -offlinemsg_la_LIBADD = $(GLIB_LIBS) -one_time_password_la_LIBADD = $(GLIB_LIBS) -pluginpref_example_la_LIBADD = $(GLIB_LIBS) -psychic_la_LIBADD = $(GLIB_LIBS) -signals_test_la_LIBADD = $(GLIB_LIBS) -simple_la_LIBADD = $(GLIB_LIBS) -statenotify_la_LIBADD = $(GLIB_LIBS) - -if ENABLE_DBUS - -CLEANFILES = dbus-example-bindings.c -dbus_example_la_SOURCES = dbus-example.c - -dbus_example_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) - -.PHONY: always - -$(top_builddir)/libpurple/dbus-types.h: always - cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -dbus-example-bindings.c: $(top_srcdir)/libpurple/dbus-analyze-functions.py $(dbus_example_la_SOURCES) - cat $(srcdir)/$(dbus_example_la_SOURCES) | \ - $(PYTHON) $(top_srcdir)/libpurple/dbus-analyze-functions.py --export-only > $@ - -$(dbus_example_la_OBJECTS) dbus-example.so: dbus-example-bindings.c $(top_builddir)/libpurple/dbus-types.h - - -endif # ENABLE_DBUS - -endif # PLUGINS - -EXTRA_DIST = \ - Makefile.mingw \ - dbus-buddyicons-example.py \ - filectl.c \ - fortuneprofile.pl \ - ipc-test-client.c \ - ipc-test-server.c \ - startup.py - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(DBUS_CFLAGS) - -# -# This part allows people to build their own plugins in here. -# Yes, it's a mess. -# -SUFFIXES = .c .so -.c.so: - $(LIBTOOL) --mode=compile $(CC) -DHAVE_CONFIG_H -I$(top_builddir) $(AM_CPPFLAGS) $(CFLAGS) -c $< -o tmp$@.lo $(PLUGIN_CFLAGS) - $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o libtmp$@.la -rpath $(plugindir) tmp$@.lo $(LIBS) $(LDFLAGS) -module -avoid-version $(PLUGIN_LIBS) - @rm -f tmp$@.lo tmp$@.o libtmp$@.la - @cp .libs/libtmp$@*.so $@ - @rm -rf .libs/libtmp$@.* diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1127 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -@PLUGINS_TRUE@autoaccept_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__autoaccept_la_SOURCES_DIST = autoaccept.c -@PLUGINS_TRUE@am_autoaccept_la_OBJECTS = autoaccept.lo -autoaccept_la_OBJECTS = $(am_autoaccept_la_OBJECTS) -@PLUGINS_TRUE@am_autoaccept_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@buddynote_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__buddynote_la_SOURCES_DIST = buddynote.c -@PLUGINS_TRUE@am_buddynote_la_OBJECTS = buddynote.lo -buddynote_la_OBJECTS = $(am_buddynote_la_OBJECTS) -@PLUGINS_TRUE@am_buddynote_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@ciphertest_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__ciphertest_la_SOURCES_DIST = ciphertest.c -@PLUGINS_TRUE@am_ciphertest_la_OBJECTS = ciphertest.lo -ciphertest_la_OBJECTS = $(am_ciphertest_la_OBJECTS) -@PLUGINS_TRUE@am_ciphertest_la_rpath = -@PLUGINS_TRUE@codeinline_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__codeinline_la_SOURCES_DIST = codeinline.c -@PLUGINS_TRUE@am_codeinline_la_OBJECTS = codeinline.lo -codeinline_la_OBJECTS = $(am_codeinline_la_OBJECTS) -@PLUGINS_TRUE@am_codeinline_la_rpath = -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus_example_la_DEPENDENCIES = \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__dbus_example_la_SOURCES_DIST = dbus-example.c -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@am_dbus_example_la_OBJECTS = \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ dbus-example.lo -dbus_example_la_OBJECTS = $(am_dbus_example_la_OBJECTS) -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@am_dbus_example_la_rpath = -rpath \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(plugindir) -debug_example_la_LIBADD = -am__debug_example_la_SOURCES_DIST = debug_example.c -@PLUGINS_TRUE@am_debug_example_la_OBJECTS = debug_example.lo -debug_example_la_OBJECTS = $(am_debug_example_la_OBJECTS) -@PLUGINS_TRUE@am_debug_example_la_rpath = -helloworld_la_LIBADD = -am__helloworld_la_SOURCES_DIST = helloworld.c -@PLUGINS_TRUE@am_helloworld_la_OBJECTS = helloworld.lo -helloworld_la_OBJECTS = $(am_helloworld_la_OBJECTS) -@PLUGINS_TRUE@am_helloworld_la_rpath = -@PLUGINS_TRUE@idle_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__idle_la_SOURCES_DIST = idle.c -@PLUGINS_TRUE@am_idle_la_OBJECTS = idle.lo -idle_la_OBJECTS = $(am_idle_la_OBJECTS) -@PLUGINS_TRUE@am_idle_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@joinpart_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__joinpart_la_SOURCES_DIST = joinpart.c -@PLUGINS_TRUE@am_joinpart_la_OBJECTS = joinpart.lo -joinpart_la_OBJECTS = $(am_joinpart_la_OBJECTS) -@PLUGINS_TRUE@am_joinpart_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@log_reader_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__log_reader_la_SOURCES_DIST = log_reader.c -@PLUGINS_TRUE@am_log_reader_la_OBJECTS = log_reader.lo -log_reader_la_OBJECTS = $(am_log_reader_la_OBJECTS) -@PLUGINS_TRUE@am_log_reader_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@newline_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__newline_la_SOURCES_DIST = newline.c -@PLUGINS_TRUE@am_newline_la_OBJECTS = newline.lo -newline_la_OBJECTS = $(am_newline_la_OBJECTS) -@PLUGINS_TRUE@am_newline_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@notify_example_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__notify_example_la_SOURCES_DIST = notify_example.c -@PLUGINS_TRUE@am_notify_example_la_OBJECTS = notify_example.lo -notify_example_la_OBJECTS = $(am_notify_example_la_OBJECTS) -@PLUGINS_TRUE@am_notify_example_la_rpath = -@PLUGINS_TRUE@offlinemsg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__offlinemsg_la_SOURCES_DIST = offlinemsg.c -@PLUGINS_TRUE@am_offlinemsg_la_OBJECTS = offlinemsg.lo -offlinemsg_la_OBJECTS = $(am_offlinemsg_la_OBJECTS) -@PLUGINS_TRUE@am_offlinemsg_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@one_time_password_la_DEPENDENCIES = \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__one_time_password_la_SOURCES_DIST = one_time_password.c -@PLUGINS_TRUE@am_one_time_password_la_OBJECTS = one_time_password.lo -one_time_password_la_OBJECTS = $(am_one_time_password_la_OBJECTS) -@PLUGINS_TRUE@am_one_time_password_la_rpath = -@PLUGINS_TRUE@pluginpref_example_la_DEPENDENCIES = \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__pluginpref_example_la_SOURCES_DIST = pluginpref_example.c -@PLUGINS_TRUE@am_pluginpref_example_la_OBJECTS = \ -@PLUGINS_TRUE@ pluginpref_example.lo -pluginpref_example_la_OBJECTS = $(am_pluginpref_example_la_OBJECTS) -@PLUGINS_TRUE@am_pluginpref_example_la_rpath = -@PLUGINS_TRUE@psychic_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__psychic_la_SOURCES_DIST = psychic.c -@PLUGINS_TRUE@am_psychic_la_OBJECTS = psychic.lo -psychic_la_OBJECTS = $(am_psychic_la_OBJECTS) -@PLUGINS_TRUE@am_psychic_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@signals_test_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__signals_test_la_SOURCES_DIST = signals-test.c -@PLUGINS_TRUE@am_signals_test_la_OBJECTS = signals-test.lo -signals_test_la_OBJECTS = $(am_signals_test_la_OBJECTS) -@PLUGINS_TRUE@am_signals_test_la_rpath = -@PLUGINS_TRUE@simple_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__simple_la_SOURCES_DIST = simple.c -@PLUGINS_TRUE@am_simple_la_OBJECTS = simple.lo -simple_la_OBJECTS = $(am_simple_la_OBJECTS) -@PLUGINS_TRUE@am_simple_la_rpath = -@PLUGINS_TRUE@statenotify_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__statenotify_la_SOURCES_DIST = statenotify.c -@PLUGINS_TRUE@am_statenotify_la_OBJECTS = statenotify.lo -statenotify_la_OBJECTS = $(am_statenotify_la_OBJECTS) -@PLUGINS_TRUE@am_statenotify_la_rpath = -rpath $(plugindir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(autoaccept_la_SOURCES) $(buddynote_la_SOURCES) \ - $(ciphertest_la_SOURCES) $(codeinline_la_SOURCES) \ - $(dbus_example_la_SOURCES) $(debug_example_la_SOURCES) \ - $(helloworld_la_SOURCES) $(idle_la_SOURCES) \ - $(joinpart_la_SOURCES) $(log_reader_la_SOURCES) \ - $(newline_la_SOURCES) $(notify_example_la_SOURCES) \ - $(offlinemsg_la_SOURCES) $(one_time_password_la_SOURCES) \ - $(pluginpref_example_la_SOURCES) $(psychic_la_SOURCES) \ - $(signals_test_la_SOURCES) $(simple_la_SOURCES) \ - $(statenotify_la_SOURCES) -DIST_SOURCES = $(am__autoaccept_la_SOURCES_DIST) \ - $(am__buddynote_la_SOURCES_DIST) \ - $(am__ciphertest_la_SOURCES_DIST) \ - $(am__codeinline_la_SOURCES_DIST) \ - $(am__dbus_example_la_SOURCES_DIST) \ - $(am__debug_example_la_SOURCES_DIST) \ - $(am__helloworld_la_SOURCES_DIST) $(am__idle_la_SOURCES_DIST) \ - $(am__joinpart_la_SOURCES_DIST) \ - $(am__log_reader_la_SOURCES_DIST) \ - $(am__newline_la_SOURCES_DIST) \ - $(am__notify_example_la_SOURCES_DIST) \ - $(am__offlinemsg_la_SOURCES_DIST) \ - $(am__one_time_password_la_SOURCES_DIST) \ - $(am__pluginpref_example_la_SOURCES_DIST) \ - $(am__psychic_la_SOURCES_DIST) \ - $(am__signals_test_la_SOURCES_DIST) \ - $(am__simple_la_SOURCES_DIST) \ - $(am__statenotify_la_SOURCES_DIST) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -DIST_SUBDIRS = mono perl ssl tcl -@USE_PERL_TRUE@PERL_DIR = perl -@USE_TCL_TRUE@TCL_DIR = tcl -@ENABLE_DBUS_TRUE@DBUS_LTLIB = dbus-example.la -@USE_MONO_TRUE@MONO_DIR = mono -SUBDIRS = \ - $(MONO_DIR) \ - $(PERL_DIR) \ - ssl \ - $(TCL_DIR) - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -autoaccept_la_LDFLAGS = -module -avoid-version -buddynote_la_LDFLAGS = -module -avoid-version -ciphertest_la_LDFLAGS = -module -avoid-version -codeinline_la_LDFLAGS = -module -avoid-version -debug_example_la_LDFLAGS = -module -avoid-version -helloworld_la_LDFLAGS = -module -avoid-version -idle_la_LDFLAGS = -module -avoid-version -joinpart_la_LDFLAGS = -module -avoid-version -log_reader_la_LDFLAGS = -module -avoid-version -newline_la_LDFLAGS = -module -avoid-version -notify_example_la_LDFLAGS = -module -avoid-version -offlinemsg_la_LDFLAGS = -module -avoid-version -one_time_password_la_LDFLAGS = -module -avoid-version -pluginpref_example_la_LDFLAGS = -module -avoid-version -psychic_la_LDFLAGS = -module -avoid-version -signals_test_la_LDFLAGS = -module -avoid-version -simple_la_LDFLAGS = -module -avoid-version -statenotify_la_LDFLAGS = -module -avoid-version - -# this can't be in a conditional otherwise automake 1.4 yells -dbus_example_la_LDFLAGS = -module -avoid-version -@PLUGINS_TRUE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@ autoaccept.la \ -@PLUGINS_TRUE@ buddynote.la \ -@PLUGINS_TRUE@ idle.la \ -@PLUGINS_TRUE@ joinpart.la \ -@PLUGINS_TRUE@ log_reader.la \ -@PLUGINS_TRUE@ newline.la \ -@PLUGINS_TRUE@ offlinemsg.la \ -@PLUGINS_TRUE@ psychic.la \ -@PLUGINS_TRUE@ statenotify.la \ -@PLUGINS_TRUE@ $(DBUS_LTLIB) - -@PLUGINS_TRUE@noinst_LTLIBRARIES = \ -@PLUGINS_TRUE@ ciphertest.la \ -@PLUGINS_TRUE@ codeinline.la \ -@PLUGINS_TRUE@ debug_example.la \ -@PLUGINS_TRUE@ helloworld.la \ -@PLUGINS_TRUE@ notify_example.la \ -@PLUGINS_TRUE@ one_time_password.la \ -@PLUGINS_TRUE@ pluginpref_example.la \ -@PLUGINS_TRUE@ signals_test.la \ -@PLUGINS_TRUE@ simple.la - -@PLUGINS_TRUE@autoaccept_la_SOURCES = autoaccept.c -@PLUGINS_TRUE@buddynote_la_SOURCES = buddynote.c -@PLUGINS_TRUE@ciphertest_la_SOURCES = ciphertest.c -@PLUGINS_TRUE@codeinline_la_SOURCES = codeinline.c -@PLUGINS_TRUE@debug_example_la_SOURCES = debug_example.c -@PLUGINS_TRUE@helloworld_la_SOURCES = helloworld.c -@PLUGINS_TRUE@idle_la_SOURCES = idle.c -@PLUGINS_TRUE@joinpart_la_SOURCES = joinpart.c -@PLUGINS_TRUE@log_reader_la_SOURCES = log_reader.c -@PLUGINS_TRUE@newline_la_SOURCES = newline.c -@PLUGINS_TRUE@notify_example_la_SOURCES = notify_example.c -@PLUGINS_TRUE@offlinemsg_la_SOURCES = offlinemsg.c -@PLUGINS_TRUE@one_time_password_la_SOURCES = one_time_password.c -@PLUGINS_TRUE@pluginpref_example_la_SOURCES = pluginpref_example.c -@PLUGINS_TRUE@psychic_la_SOURCES = psychic.c -@PLUGINS_TRUE@signals_test_la_SOURCES = signals-test.c -@PLUGINS_TRUE@simple_la_SOURCES = simple.c -@PLUGINS_TRUE@statenotify_la_SOURCES = statenotify.c -@PLUGINS_TRUE@autoaccept_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@buddynote_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@ciphertest_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@codeinline_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@idle_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@joinpart_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@log_reader_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@newline_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@notify_example_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@offlinemsg_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@one_time_password_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@pluginpref_example_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@psychic_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@signals_test_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@simple_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@statenotify_la_LIBADD = $(GLIB_LIBS) -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@CLEANFILES = dbus-example-bindings.c -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus_example_la_SOURCES = dbus-example.c -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus_example_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) -EXTRA_DIST = \ - Makefile.mingw \ - dbus-buddyicons-example.py \ - filectl.c \ - fortuneprofile.pl \ - ipc-test-client.c \ - ipc-test-server.c \ - startup.py - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(DBUS_CFLAGS) - - -# -# This part allows people to build their own plugins in here. -# Yes, it's a mess. -# -SUFFIXES = .c .so -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .so .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -autoaccept.la: $(autoaccept_la_OBJECTS) $(autoaccept_la_DEPENDENCIES) - $(LINK) $(am_autoaccept_la_rpath) $(autoaccept_la_LDFLAGS) $(autoaccept_la_OBJECTS) $(autoaccept_la_LIBADD) $(LIBS) -buddynote.la: $(buddynote_la_OBJECTS) $(buddynote_la_DEPENDENCIES) - $(LINK) $(am_buddynote_la_rpath) $(buddynote_la_LDFLAGS) $(buddynote_la_OBJECTS) $(buddynote_la_LIBADD) $(LIBS) -ciphertest.la: $(ciphertest_la_OBJECTS) $(ciphertest_la_DEPENDENCIES) - $(LINK) $(am_ciphertest_la_rpath) $(ciphertest_la_LDFLAGS) $(ciphertest_la_OBJECTS) $(ciphertest_la_LIBADD) $(LIBS) -codeinline.la: $(codeinline_la_OBJECTS) $(codeinline_la_DEPENDENCIES) - $(LINK) $(am_codeinline_la_rpath) $(codeinline_la_LDFLAGS) $(codeinline_la_OBJECTS) $(codeinline_la_LIBADD) $(LIBS) -dbus-example.la: $(dbus_example_la_OBJECTS) $(dbus_example_la_DEPENDENCIES) - $(LINK) $(am_dbus_example_la_rpath) $(dbus_example_la_LDFLAGS) $(dbus_example_la_OBJECTS) $(dbus_example_la_LIBADD) $(LIBS) -debug_example.la: $(debug_example_la_OBJECTS) $(debug_example_la_DEPENDENCIES) - $(LINK) $(am_debug_example_la_rpath) $(debug_example_la_LDFLAGS) $(debug_example_la_OBJECTS) $(debug_example_la_LIBADD) $(LIBS) -helloworld.la: $(helloworld_la_OBJECTS) $(helloworld_la_DEPENDENCIES) - $(LINK) $(am_helloworld_la_rpath) $(helloworld_la_LDFLAGS) $(helloworld_la_OBJECTS) $(helloworld_la_LIBADD) $(LIBS) -idle.la: $(idle_la_OBJECTS) $(idle_la_DEPENDENCIES) - $(LINK) $(am_idle_la_rpath) $(idle_la_LDFLAGS) $(idle_la_OBJECTS) $(idle_la_LIBADD) $(LIBS) -joinpart.la: $(joinpart_la_OBJECTS) $(joinpart_la_DEPENDENCIES) - $(LINK) $(am_joinpart_la_rpath) $(joinpart_la_LDFLAGS) $(joinpart_la_OBJECTS) $(joinpart_la_LIBADD) $(LIBS) -log_reader.la: $(log_reader_la_OBJECTS) $(log_reader_la_DEPENDENCIES) - $(LINK) $(am_log_reader_la_rpath) $(log_reader_la_LDFLAGS) $(log_reader_la_OBJECTS) $(log_reader_la_LIBADD) $(LIBS) -newline.la: $(newline_la_OBJECTS) $(newline_la_DEPENDENCIES) - $(LINK) $(am_newline_la_rpath) $(newline_la_LDFLAGS) $(newline_la_OBJECTS) $(newline_la_LIBADD) $(LIBS) -notify_example.la: $(notify_example_la_OBJECTS) $(notify_example_la_DEPENDENCIES) - $(LINK) $(am_notify_example_la_rpath) $(notify_example_la_LDFLAGS) $(notify_example_la_OBJECTS) $(notify_example_la_LIBADD) $(LIBS) -offlinemsg.la: $(offlinemsg_la_OBJECTS) $(offlinemsg_la_DEPENDENCIES) - $(LINK) $(am_offlinemsg_la_rpath) $(offlinemsg_la_LDFLAGS) $(offlinemsg_la_OBJECTS) $(offlinemsg_la_LIBADD) $(LIBS) -one_time_password.la: $(one_time_password_la_OBJECTS) $(one_time_password_la_DEPENDENCIES) - $(LINK) $(am_one_time_password_la_rpath) $(one_time_password_la_LDFLAGS) $(one_time_password_la_OBJECTS) $(one_time_password_la_LIBADD) $(LIBS) -pluginpref_example.la: $(pluginpref_example_la_OBJECTS) $(pluginpref_example_la_DEPENDENCIES) - $(LINK) $(am_pluginpref_example_la_rpath) $(pluginpref_example_la_LDFLAGS) $(pluginpref_example_la_OBJECTS) $(pluginpref_example_la_LIBADD) $(LIBS) -psychic.la: $(psychic_la_OBJECTS) $(psychic_la_DEPENDENCIES) - $(LINK) $(am_psychic_la_rpath) $(psychic_la_LDFLAGS) $(psychic_la_OBJECTS) $(psychic_la_LIBADD) $(LIBS) -signals_test.la: $(signals_test_la_OBJECTS) $(signals_test_la_DEPENDENCIES) - $(LINK) $(am_signals_test_la_rpath) $(signals_test_la_LDFLAGS) $(signals_test_la_OBJECTS) $(signals_test_la_LIBADD) $(LIBS) -simple.la: $(simple_la_OBJECTS) $(simple_la_DEPENDENCIES) - $(LINK) $(am_simple_la_rpath) $(simple_la_LDFLAGS) $(simple_la_OBJECTS) $(simple_la_LIBADD) $(LIBS) -statenotify.la: $(statenotify_la_OBJECTS) $(statenotify_la_DEPENDENCIES) - $(LINK) $(am_statenotify_la_rpath) $(statenotify_la_LDFLAGS) $(statenotify_la_OBJECTS) $(statenotify_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/autoaccept.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddynote.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ciphertest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codeinline.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/joinpart.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_reader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newline.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notify_example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offlinemsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/one_time_password.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pluginpref_example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psychic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signals-test.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statenotify.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pluginLTLIBRARIES mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pluginLTLIBRARIES clean-recursive ctags ctags-recursive \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-recursive distclean-tags distdir \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@.PHONY: always - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@$(top_builddir)/libpurple/dbus-types.h: always -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus-example-bindings.c: $(top_srcdir)/libpurple/dbus-analyze-functions.py $(dbus_example_la_SOURCES) -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ cat $(srcdir)/$(dbus_example_la_SOURCES) | \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(PYTHON) $(top_srcdir)/libpurple/dbus-analyze-functions.py --export-only > $@ - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@$(dbus_example_la_OBJECTS) dbus-example.so: dbus-example-bindings.c $(top_builddir)/libpurple/dbus-types.h -.c.so: - $(LIBTOOL) --mode=compile $(CC) -DHAVE_CONFIG_H -I$(top_builddir) $(AM_CPPFLAGS) $(CFLAGS) -c $< -o tmp$@.lo $(PLUGIN_CFLAGS) - $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o libtmp$@.la -rpath $(plugindir) tmp$@.lo $(LIBS) $(LDFLAGS) -module -avoid-version $(PLUGIN_LIBS) - @rm -f tmp$@.lo tmp$@.o libtmp$@.la - @cp .libs/libtmp$@*.so $@ - @rm -rf .libs/libtmp$@.* -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libpurple Plugins -# - -PIDGIN_TREE_TOP := ../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -PERL_PLUGIN := ./perl -TCL_PLUGIN := ./tcl -SSL_PLUGIN := ./ssl - -.SUFFIXES: -.SUFFIXES: .c .dll - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgobject-2.0 \ - -lgmodule-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -## -## TARGET DEFINITIONS -## -.PHONY: all clean plugins install - -all: $(PURPLE_DLL).a plugins - $(MAKE) -C $(PERL_PLUGIN) -f $(MINGW_MAKEFILE) - $(MAKE) -C $(TCL_PLUGIN) -f $(MINGW_MAKEFILE) - $(MAKE) -C $(SSL_PLUGIN) -f $(MINGW_MAKEFILE) - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) - $(MAKE) -C $(PERL_PLUGIN) -f $(MINGW_MAKEFILE) install - $(MAKE) -C $(TCL_PLUGIN) -f $(MINGW_MAKEFILE) install - $(MAKE) -C $(SSL_PLUGIN) -f $(MINGW_MAKEFILE) install - cp *.dll $(PURPLE_INSTALL_PLUGINS_DIR) - -.c.dll: - $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@.o -c $< - $(CC) -shared $@.o $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@ - -plugins: \ - autoaccept.dll \ - buddynote.dll \ - idle.dll \ - joinpart.dll \ - log_reader.dll \ - newline.dll \ - offlinemsg.dll \ - psychic.dll \ - statenotify.dll - -## -## CLEAN RULES -## -clean: - rm -f *.o *.dll - $(MAKE) -C $(PERL_PLUGIN) -f $(MINGW_MAKEFILE) clean - $(MAKE) -C $(TCL_PLUGIN) -f $(MINGW_MAKEFILE) clean - $(MAKE) -C $(SSL_PLUGIN) -f $(MINGW_MAKEFILE) clean - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BlistNode.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BlistNode.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BlistNode.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BlistNode.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -namespace Purple { - public abstract class BlistNode { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Buddy.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Buddy.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Buddy.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Buddy.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -namespace Purple { - public class Buddy : BlistNode { - private string name; - private string alias; - - public string Name { get { return name; } set { name = value; } } - public string Alias { get { return alias; } set { alias = value; } } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BuddyList.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BuddyList.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BuddyList.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/BuddyList.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -namespace Purple { - using System; - using System.Runtime.CompilerServices; - - public class BuddyList { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private static IntPtr _get_handle(); - - private static IntPtr handle = _get_handle(); - - public static Event OnBuddyStatusChanged = - new Event(handle, "buddy-status-changed"); - - public static IntPtr GetHandle() - { - return _get_handle(); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Contact.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Contact.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Contact.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Contact.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -namespace Purple { - public class Contact : BlistNode { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Debug.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Debug.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Debug.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Debug.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace Purple -{ - public class Debug - { - public static int ALL = 0; - public static int MISC = 1; - public static int INFO = 2; - public static int WARNING = 3; - public static int ERROR = 4; - public static int FATAL = 5; - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private static void _debug(int type, string cat, string str); - - public static void debug(int type, string cat, string format) - { - _debug(type, cat, format); - } - - public static void debug(int type, string cat, string format, params object[] args) - { - _debug(type, cat, String.Format(format, args)); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Event.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Event.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Event.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Event.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -using System; - -namespace Purple -{ - public class Event - { - private IntPtr handle; - private string signal; - - public Event(IntPtr h, string s) - { - handle = h; - signal = s; - } - - public void connect(object plugin, Signal.Handler handler) - { - Signal.connect(handle, plugin, signal, handler); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Group.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Group.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Group.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Group.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -namespace Purple { - public class Group : BlistNode { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -monodir=$(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -mono_sources = \ - BlistNode.cs \ - BuddyList.cs \ - Buddy.cs \ - Contact.cs \ - Debug.cs \ - Event.cs \ - PurplePlugin.cs \ - Group.cs \ - Signal.cs \ - Status.cs - -EXTRA_DIST = $(mono_sources) - -mono_SCRIPTS = PurpleAPI.dll - -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) - -all: $(mono_SCRIPTS) - -$(mono_SCRIPTS): $(mono_build_sources) - mcs -t:library -out:$(mono_SCRIPTS) $(mono_build_sources) - -clean-local: - rm -rf $(mono_SCRIPTS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,605 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/mono/api -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(monodir)" -monoSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(mono_SCRIPTS) -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -mono_sources = \ - BlistNode.cs \ - BuddyList.cs \ - Buddy.cs \ - Contact.cs \ - Debug.cs \ - Event.cs \ - PurplePlugin.cs \ - Group.cs \ - Signal.cs \ - Status.cs - -EXTRA_DIST = $(mono_sources) -mono_SCRIPTS = PurpleAPI.dll -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/mono/api/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/mono/api/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-monoSCRIPTS: $(mono_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(monodir)" || $(mkdir_p) "$(DESTDIR)$(monodir)" - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(monoSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(monodir)/$$f'"; \ - $(monoSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(monodir)/$$f"; \ - else :; fi; \ - done - -uninstall-monoSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(monodir)/$$f'"; \ - rm -f "$(DESTDIR)$(monodir)/$$f"; \ - done - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(monodir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-monoSCRIPTS - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-monoSCRIPTS - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local distclean distclean-generic distclean-libtool \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-monoSCRIPTS install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am uninstall-info-am \ - uninstall-monoSCRIPTS - - -all: $(mono_SCRIPTS) - -$(mono_SCRIPTS): $(mono_build_sources) - mcs -t:library -out:$(mono_SCRIPTS) $(mono_build_sources) - -clean-local: - rm -rf $(mono_SCRIPTS) -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/PurplePlugin.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/PurplePlugin.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/PurplePlugin.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/PurplePlugin.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -namespace Purple { - public class PluginInfo { - private string id; - private string name; - private string version; - private string summary; - private string description; - private string author; - private string homepage; - - public PluginInfo(string id, string name, string version, string summary, - string description, string author, string homepage) - { - this.id = id; - this.name = name; - this.version = version; - this.summary = summary; - this.description = description; - this.author = author; - this.homepage = homepage; - } - - public string Id { - get { return id; } - } - - public string Name { - get { return name; } - } - - public string Version { - get { return version; } - } - - public string Summary { - get { return summary; } - } - - public string Description { - get { return description; } - } - - public string Author { - get { return author; } - } - - public string Homepage { - get { return homepage; } - } - } - - abstract public class Plugin { - private PluginInfo info; - - public Plugin(PluginInfo info) { - this.info = info; - } - - public abstract void Load(); - public abstract void Unload(); - public abstract void Destroy(); - - public PluginInfo Info { - get { return info; } - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Signal.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Signal.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Signal.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Signal.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace Purple -{ - public class Signal - { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private static int _connect(IntPtr handle, object plugin, string signal, object evnt); - - public delegate void Handler(object[] args); - - public static int connect(IntPtr handle, object plugin, string signal, object evnt) - { - return _connect(handle, plugin, signal, evnt); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Status.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Status.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Status.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/api/Status.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -namespace Purple -{ - public class Status - { - private string id; - - public string Id { get { return id; } set { id = value; } } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/GetBuddyBack.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/GetBuddyBack.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/GetBuddyBack.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/GetBuddyBack.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -using Purple; - -public class GetBuddyBack : Plugin -{ - private static PluginInfo info = new PluginInfo("mono-buddyback", "C# Get Buddy Back", "0.1", "Prints when a Buddy returns", "Longer Description", "Eoin Coffey", "urled"); - - public GetBuddyBack() - : base (info) - { - } - - public void HandleSig(object[] args) - { - Buddy buddy = (Buddy)args[0]; - - Debug.debug(Debug.INFO, "buddyback", "buddy " + buddy.Name + " is back!\n"); - } - - public override void Load() - { - Debug.debug(Debug.INFO, "buddyback", "loading...\n"); - - /*Signal.connect(BuddyList.GetHandle(), this, "buddy-back", new Signal.Handler(HandleSig));*/ - BuddyList.OnBuddyStatusChanged.connect(this, new Signal.Handler(HandleSig)); - } - - public override void Unload() - { - } - - public override void Destroy() - { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/blist-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/blist-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/blist-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/blist-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -#include -#include "blist.h" -#include "mono-helper.h" -#include "mono-glue.h" - -MonoObject* purple_blist_get_handle_glue(void) -{ - void *handle = purple_blist_get_handle(); - - return mono_value_box(ml_get_domain(), mono_get_intptr_class(), &handle); -} - -MonoObject* purple_blist_build_buddy_object(void* data) -{ - MonoObject *obj = NULL; - - PurpleBuddy *buddy = (PurpleBuddy*)data; - - obj = ml_create_api_object("Buddy"); - g_return_val_if_fail(obj != NULL, NULL); - - ml_set_prop_string(obj, "Name", (char*)purple_buddy_get_name(buddy)); - ml_set_prop_string(obj, "Alias", (char*)purple_buddy_get_alias(buddy)); - - return obj; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/debug-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/debug-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/debug-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/debug-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#include "mono-glue.h" -#include "debug.h" - -void purple_debug_glue(int type, MonoString *cat, MonoString *str) -{ - char *ccat; - char *cstr; - - ccat = mono_string_to_utf8(cat); - cstr = mono_string_to_utf8(str); - - purple_debug(type, ccat, "%s", cstr); - - g_free(ccat); - g_free(cstr); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -plugin_LTLIBRARIES = mono.la - -mono_la_SOURCES = \ - mono.c \ - mono-glue.h \ - mono-helper.c \ - mono-helper.h \ - debug-glue.c \ - signal-glue.c \ - blist-glue.c \ - status-glue.c - -mono_la_LDFLAGS = -module -avoid-version - -mono_la_LIBADD = $(MONO_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(MONO_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,720 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/mono/loader -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -mono_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_mono_la_OBJECTS = mono.lo mono-helper.lo debug-glue.lo \ - signal-glue.lo blist-glue.lo status-glue.lo -mono_la_OBJECTS = $(am_mono_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(mono_la_SOURCES) -DIST_SOURCES = $(mono_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -plugin_LTLIBRARIES = mono.la -mono_la_SOURCES = \ - mono.c \ - mono-glue.h \ - mono-helper.c \ - mono-helper.h \ - debug-glue.c \ - signal-glue.c \ - blist-glue.c \ - status-glue.c - -mono_la_LDFLAGS = -module -avoid-version -mono_la_LIBADD = $(MONO_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(MONO_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/mono/loader/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/mono/loader/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -mono.la: $(mono_la_OBJECTS) $(mono_la_DEPENDENCIES) - $(LINK) -rpath $(plugindir) $(mono_la_LDFLAGS) $(mono_la_OBJECTS) $(mono_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blist-glue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug-glue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-helper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal-glue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status-glue.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Mono Plugin Loader - * - * -- Thanks to the perl plugin loader for all the great tips ;-) - * - * Eoin Coffey - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" -#include "mono-helper.h" - -#define MONO_PLUGIN_ID "core-mono" - -/****************************************************************************** - * Loader Stuff - *****************************************************************************/ -/* probes the given plugin to determine if its a plugin */ -static gboolean probe_mono_plugin(PurplePlugin *plugin) -{ - MonoAssembly *assm; - MonoMethod *m = NULL; - MonoObject *plugin_info; - gboolean found_load = FALSE, found_unload = FALSE, found_destroy = FALSE; - gpointer iter = NULL; - - PurplePluginInfo *info; - PurpleMonoPlugin *mplug; - - char *file = plugin->path; - - assm = mono_domain_assembly_open(ml_get_domain(), file); - - if (!assm) { - return FALSE; - } - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Probing plugin\n"); - - if (ml_is_api_dll(mono_assembly_get_image(assm))) { - purple_debug_info("mono", "Found our PurpleAPI.dll\n"); - mono_assembly_close(assm); - return FALSE; - } - - mplug = g_new0(PurpleMonoPlugin, 1); - - mplug->signal_data = NULL; - - mplug->assm = assm; - - mplug->klass = ml_find_plugin_class(mono_assembly_get_image(mplug->assm)); - if (!mplug->klass) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "no plugin class in \'%s\'\n", file); - mono_assembly_close(assm); - g_free(mplug); - return FALSE; - } - - mplug->obj = mono_object_new(ml_get_domain(), mplug->klass); - if (!mplug->obj) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "obj not valid\n"); - mono_assembly_close(assm); - g_free(mplug); - return FALSE; - } - - mono_runtime_object_init(mplug->obj); - - while ((m = mono_class_get_methods(mplug->klass, &iter))) { - purple_debug_info("mono", "plugin method: %s\n", mono_method_get_name(m)); - if (strcmp(mono_method_get_name(m), "Load") == 0) { - mplug->load = m; - found_load = TRUE; - } else if (strcmp(mono_method_get_name(m), "Unload") == 0) { - mplug->unload = m; - found_unload = TRUE; - } else if (strcmp(mono_method_get_name(m), "Destroy") == 0) { - mplug->destroy = m; - found_destroy = TRUE; - } - } - - if (!(found_load && found_unload && found_destroy)) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "did not find the required methods\n"); - mono_assembly_close(assm); - g_free(mplug); - return FALSE; - } - - plugin_info = ml_get_info_prop(mplug->obj); - - /* now that the methods are filled out we can populate - the info struct with all the needed info */ - - info = g_new0(PurplePluginInfo, 1); - info->id = ml_get_prop_string(plugin_info, "Id"); - info->name = ml_get_prop_string(plugin_info, "Name"); - info->version = ml_get_prop_string(plugin_info, "Version"); - info->summary = ml_get_prop_string(plugin_info, "Summary"); - info->description = ml_get_prop_string(plugin_info, "Description"); - info->author = ml_get_prop_string(plugin_info, "Author"); - info->homepage = ml_get_prop_string(plugin_info, "Homepage"); - - info->magic = PURPLE_PLUGIN_MAGIC; - info->major_version = PURPLE_MAJOR_VERSION; - info->minor_version = PURPLE_MINOR_VERSION; - info->type = PURPLE_PLUGIN_STANDARD; - - /* this plugin depends on us; duh */ - info->dependencies = g_list_append(info->dependencies, MONO_PLUGIN_ID); - mplug->plugin = plugin; - - plugin->info = info; - info->extra_info = mplug; - - ml_add_plugin(mplug); - - return purple_plugin_register(plugin); -} - -/* Loads a Mono Plugin by calling 'load' in the class */ -static gboolean load_mono_plugin(PurplePlugin *plugin) -{ - PurpleMonoPlugin *mplug; - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Loading plugin\n"); - - mplug = (PurpleMonoPlugin*)plugin->info->extra_info; - - ml_invoke(mplug->load, mplug->obj, NULL); - - return TRUE; -} - -/* Unloads a Mono Plugin by calling 'unload' in the class */ -static gboolean unload_mono_plugin(PurplePlugin *plugin) -{ - PurpleMonoPlugin *mplug; - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Unloading plugin\n"); - - mplug = (PurpleMonoPlugin*)plugin->info->extra_info; - - purple_signals_disconnect_by_handle((gpointer)mplug->klass); - g_list_foreach(mplug->signal_data, (GFunc)g_free, NULL); - g_list_free(mplug->signal_data); - mplug->signal_data = NULL; - - ml_invoke(mplug->unload, mplug->obj, NULL); - - return TRUE; -} - -static void destroy_mono_plugin(PurplePlugin *plugin) -{ - PurpleMonoPlugin *mplug; - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Destroying plugin\n"); - - mplug = (PurpleMonoPlugin*)plugin->info->extra_info; - - ml_invoke(mplug->destroy, mplug->obj, NULL); - - if (plugin->info) { - g_free(plugin->info->name); - g_free(plugin->info->version); - g_free(plugin->info->summary); - g_free(plugin->info->description); - g_free(plugin->info->author); - g_free(plugin->info->homepage); - } - - if (mplug) { - if (mplug->assm) { - mono_assembly_close(mplug->assm); - } - - g_free(mplug); - mplug = NULL; - } -} - -/****************************************************************************** - * Plugin Stuff - *****************************************************************************/ -static void plugin_destroy(PurplePlugin *plugin) -{ - ml_uninit(); -} - -static PurplePluginLoaderInfo loader_info = -{ - NULL, - probe_mono_plugin, - load_mono_plugin, - unload_mono_plugin, - destroy_mono_plugin, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_LOADER, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - MONO_PLUGIN_ID, - N_("Mono Plugin Loader"), - DISPLAY_VERSION, - N_("Loads .NET plugins with Mono."), - N_("Loads .NET plugins with Mono."), - "Eoin Coffey ", - PURPLE_WEBSITE, - NULL, - NULL, - plugin_destroy, - NULL, - &loader_info, - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void init_plugin(PurplePlugin *plugin) -{ - ml_init(); - - loader_info.exts = g_list_append(loader_info.exts, "dll"); -} - -PURPLE_INIT_PLUGIN(mono, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-glue.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-glue.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-glue.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-glue.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#ifndef _PURPLE_MONO_LOADER_GLUE_H_ -#define _PURPLE_MONO_LOADER_GLUE_H_ - -#include -#include -#include -#include - -void purple_debug_glue(int type, MonoString *cat, MonoString *str); - -int purple_signal_connect_glue(MonoObject *h, MonoObject *plugin, MonoString *signal, MonoObject *func); - -MonoObject* purple_blist_get_handle_glue(void); - -MonoObject* purple_blist_build_buddy_object(void* buddy); - -MonoObject* purple_status_build_status_object(void* data); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/* - * Mono Plugin Loader - * - * -- Thanks to the perl plugin loader for all the great tips ;-) - * - * Eoin Coffey - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include "mono-helper.h" -#include "mono-glue.h" -#include "value.h" -#include "debug.h" - -static gboolean _runtime_active = FALSE; - -gboolean ml_init() -{ - MonoDomain *d; - - g_return_val_if_fail(_runtime_active == FALSE, TRUE); - - d = mono_jit_init("purple"); - - if (!d) { - ml_set_domain(NULL); - return FALSE; - } - - ml_set_domain(d); - - ml_init_internal_calls(); - - _runtime_active = TRUE; - - return TRUE; -} - -void ml_uninit() -{ - g_return_if_fail(_runtime_active == TRUE); - - mono_jit_cleanup(ml_get_domain()); - - ml_set_domain(NULL); - - _runtime_active = FALSE; -} - -MonoObject* ml_delegate_invoke(MonoObject *method, void **params) -{ - MonoObject *ret, *exception; - - ret = mono_runtime_delegate_invoke(method, params, &exception); - if (exception) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "caught exception: %s\n", mono_class_get_name(mono_object_get_class(exception))); - } - - return ret; -} - -MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params) -{ - MonoObject *ret, *exception; - - ret = mono_runtime_invoke(method, obj, params, &exception); - if (exception) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "caught exception: %s\n", mono_class_get_name(mono_object_get_class(exception))); - } - - return ret; -} - -MonoClass* ml_find_plugin_class(MonoImage *image) -{ - MonoClass *klass, *pklass = NULL; - int i, total; - - total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); - for (i = 1; i <= total; ++i) { - klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i); - - pklass = mono_class_get_parent(klass); - if (pklass) { - - if (strcmp("Plugin", mono_class_get_name(pklass)) == 0) - return klass; - } - } - - return NULL; -} - -void ml_set_prop_string(MonoObject *obj, char *field, char *data) -{ - MonoClass *klass; - MonoProperty *prop; - MonoString *str; - gpointer args[1]; - - klass = mono_object_get_class(obj); - - prop = mono_class_get_property_from_name(klass, field); - - str = mono_string_new(ml_get_domain(), data); - - args[0] = str; - - mono_property_set_value(prop, obj, args, NULL); -} - -gchar* ml_get_prop_string(MonoObject *obj, char *field) -{ - MonoClass *klass; - MonoProperty *prop; - MonoString *str; - - klass = mono_object_get_class(obj); - - prop = mono_class_get_property_from_name(klass, field); - - str = (MonoString*)mono_property_get_value(prop, obj, NULL, NULL); - - return mono_string_to_utf8(str); -} - -MonoObject* ml_get_info_prop(MonoObject *obj) -{ - MonoClass *klass; - MonoProperty *prop; - - klass = mono_class_get_parent(mono_object_get_class(obj)); - - prop = mono_class_get_property_from_name(klass, "Info"); - - return mono_property_get_value(prop, obj, NULL, NULL); -} - -gboolean ml_is_api_dll(MonoImage *image) -{ - MonoClass *klass; - int i, total; - - total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); - for (i = 1; i <= total; ++i) { - klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i); - if (strcmp(mono_class_get_name(klass), "Debug") == 0) - if (strcmp(mono_class_get_namespace(klass), "Purple") == 0) { - ml_set_api_image(image); - return TRUE; - } - } - - return FALSE; -} - -MonoObject* ml_object_from_purple_type(PurpleType type, gpointer data) -{ - return NULL; -} - -MonoObject* ml_object_from_purple_subtype(PurpleSubType type, gpointer data) -{ - MonoObject *obj = NULL; - - switch (type) { - case PURPLE_SUBTYPE_BLIST_BUDDY: - obj = purple_blist_build_buddy_object(data); - break; - case PURPLE_SUBTYPE_STATUS: - obj = purple_status_build_status_object(data); - break; - default: - break; - } - - return obj; -} - -MonoObject* ml_create_api_object(char *class_name) -{ - MonoObject *obj = NULL; - MonoClass *klass = NULL; - - klass = mono_class_from_name(ml_get_api_image(), "Purple", class_name); - if (!klass) { - purple_debug(PURPLE_DEBUG_FATAL, "mono", "couldn't find the '%s' class\n", class_name); - return NULL; - } - - obj = mono_object_new(ml_get_domain(), klass); - if (!obj) { - purple_debug(PURPLE_DEBUG_FATAL, "mono", "couldn't create the object from class '%s'\n", class_name); - return NULL; - } - - mono_runtime_object_init(obj); - - return obj; -} - -static MonoDomain *_domain = NULL; - -MonoDomain* ml_get_domain(void) -{ - return _domain; -} - -void ml_set_domain(MonoDomain *d) -{ - _domain = d; -} - -static MonoImage *_api_image = NULL; - -void ml_set_api_image(MonoImage *image) -{ - _api_image = image; -} - -MonoImage* ml_get_api_image() -{ - return _api_image; -} - -void ml_init_internal_calls(void) -{ - mono_add_internal_call("Purple.Debug::_debug", purple_debug_glue); - mono_add_internal_call("Purple.Signal::_connect", purple_signal_connect_glue); - mono_add_internal_call("Purple.BuddyList::_get_handle", purple_blist_get_handle_glue); -} - -static GHashTable *plugins_hash = NULL; - -void ml_add_plugin(PurpleMonoPlugin *plugin) -{ - if (!plugins_hash) - plugins_hash = g_hash_table_new(NULL, NULL); - - g_hash_table_insert(plugins_hash, plugin->klass, plugin); -} - -gboolean ml_remove_plugin(PurpleMonoPlugin *plugin) -{ - return g_hash_table_remove(plugins_hash, plugin->klass); -} - -gpointer ml_find_plugin(PurpleMonoPlugin *plugin) -{ - return g_hash_table_lookup(plugins_hash, plugin->klass); -} - -gpointer ml_find_plugin_by_class(MonoClass *klass) -{ - return g_hash_table_lookup(plugins_hash, klass); -} - -GHashTable* ml_get_plugin_hash() -{ - return plugins_hash; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/mono-helper.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -#ifndef _PURPLE_MONO_LOADER_MONO_HELPER_H_ -#define _PURPLE_MONO_LOADER_MONO_HELPER_H_ - -#include -#include -#include -#include -#include -#include -#include "plugin.h" -#include "value.h" -#include "debug.h" - -typedef struct { - PurplePlugin *plugin; - - MonoAssembly *assm; - MonoClass *klass; - MonoObject *obj; - - MonoMethod *init; - MonoMethod *load; - MonoMethod *unload; - MonoMethod *destroy; - - GList *signal_data; -} PurpleMonoPlugin; - -gboolean ml_init(void); - -void ml_uninit(void); - -MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params); - -MonoObject* ml_delegate_invoke(MonoObject *method, void **params); - -MonoClass* ml_find_plugin_class(MonoImage *image); - -gchar* ml_get_prop_string(MonoObject *obj, char *field); - -void ml_set_prop_string(MonoObject *obj, char *field, char *data); - -MonoObject* ml_get_info_prop(MonoObject *obj); - -gboolean ml_is_api_dll(MonoImage *image); - -MonoDomain* ml_get_domain(void); - -void ml_set_domain(MonoDomain *d); - -void ml_init_internal_calls(void); - -MonoObject* ml_object_from_purple_type(PurpleType type, gpointer data); - -MonoObject* ml_object_from_purple_subtype(PurpleSubType type, gpointer data); - -MonoObject* ml_create_api_object(char *class_name); - -void ml_set_api_image(MonoImage *image); - -MonoImage* ml_get_api_image(void); - -/* hash table stuff; probably don't need it anymore */ - -void ml_add_plugin(PurpleMonoPlugin *plugin); - -gboolean ml_remove_plugin(PurpleMonoPlugin *plugin); - -gpointer ml_find_plugin(PurpleMonoPlugin *plugin); - -gpointer ml_find_plugin_by_class(MonoClass *klass); - -GHashTable* ml_get_plugin_hash(void); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/signal-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/signal-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/signal-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/signal-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -#include "mono-glue.h" -#include "mono-helper.h" -#include "debug.h" -#include "blist.h" -#include "signals.h" -#include "value.h" - -typedef struct { - MonoObject *func; - char *signal; - PurpleValue **values; - PurpleValue *ret_value; - int num_vals; -} SignalData; - -static PurpleCallback get_callback(SignalData *sig_data); - -static gpointer dispatch_callback(SignalData *sig_data, int num_vals, ...) -{ - MonoArray *array; - MonoObject *obj; - int i; - gpointer meth_args[1]; - gpointer purple_obj; - - va_list args; - - va_start(args, num_vals); - - array = mono_array_new(ml_get_domain(), mono_get_object_class(), num_vals); - - for (i = 0; i < num_vals; i++) { - if (purple_value_get_type(sig_data->values[i]) == PURPLE_TYPE_SUBTYPE) { - purple_obj = va_arg(args, gpointer); - obj = ml_object_from_purple_subtype(purple_value_get_subtype(sig_data->values[i]), purple_obj); - mono_array_set(array, MonoObject*, i, obj); - } else { - purple_obj = va_arg(args, gpointer); - obj = ml_object_from_purple_type(purple_value_get_type(sig_data->values[i]), purple_obj); - mono_array_set(array, MonoObject*, i, obj); - } - } - - va_end(args); - - meth_args[0] = array; - - return ml_delegate_invoke(sig_data->func, meth_args); -} - -static void cb_void__pointer(void *arg1, void *data) -{ - dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1); -} - -static void cb_void__pointer_pointer_pointer(void *arg1, void *arg2, void *arg3, void *data) -{ - dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1, arg2, arg3); -} - - -int purple_signal_connect_glue(MonoObject* h, MonoObject *plugin, MonoString *signal, MonoObject *func) -{ - char *sig; - void **instance = NULL; - SignalData *sig_data; - PurpleMonoPlugin *mplug; - MonoClass *klass; - - sig = mono_string_to_utf8(signal); - purple_debug(PURPLE_DEBUG_INFO, "mono", "connecting signal: %s\n", sig); - - instance = (void*)mono_object_unbox(h); - - sig_data = g_new0(SignalData, 1); - - sig_data->func = func; - sig_data->signal = sig; - - purple_signal_get_values(*instance, sig, &sig_data->ret_value, &sig_data->num_vals, &sig_data->values); - - klass = mono_object_get_class(plugin); - - mplug = ml_find_plugin_by_class(klass); - - mplug->signal_data = g_list_append(mplug->signal_data, (gpointer)sig_data); - - return purple_signal_connect(*instance, sig, (gpointer)klass, get_callback(sig_data), (gpointer)sig_data); -} - -static int determine_index(PurpleType type) -{ - switch (type) { - case PURPLE_TYPE_SUBTYPE: - case PURPLE_TYPE_STRING: - case PURPLE_TYPE_OBJECT: - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_BOXED: - return 1; - break; - default: - return type; - break; - } -} - -static gpointer callbacks[]= { - NULL, - cb_void__pointer, - NULL, - cb_void__pointer_pointer_pointer - }; - -static int callbacks_array_size = sizeof(callbacks) / sizeof(PurpleCallback); - - -static PurpleCallback get_callback(SignalData *sig_data) -{ - int i, index = 0; - - if (sig_data->ret_value == NULL) - index = 0; - else - index = determine_index(purple_value_get_type(sig_data->ret_value)); - - for (i = 0; i < sig_data->num_vals; i++) { - index += determine_index(purple_value_get_type(sig_data->values[i])); - } - - purple_debug(PURPLE_DEBUG_INFO, "mono", "get_callback index = %d\n", index); - - if (index >= callbacks_array_size || callbacks[index] == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "couldn't find a callback function for signal: %s\n", sig_data->signal); - return NULL; - } - - purple_debug(PURPLE_DEBUG_MISC, "mono", "using callback at index: %d\n", index); - return PURPLE_CALLBACK(callbacks[index]); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/status-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/status-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/status-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/loader/status-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#include "status.h" -#include "mono-helper.h" -#include "mono-glue.h" - -MonoObject* purple_status_build_status_object(void* data) -{ - MonoObject *obj = NULL; - PurpleStatus *status = (PurpleStatus*)data; - - obj = ml_create_api_object("Status"); - g_return_val_if_fail(obj != NULL, NULL); - - ml_set_prop_string(obj, "Id", (char*)purple_status_get_id(status)); - - return obj; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -SUBDIRS = api loader - -mono_sources = GetBuddyBack.cs \ - MPlugin.cs - -EXTRA_DIST = $(mono_sources) - -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -mono_SCRIPTS = MPlugin.dll GetBuddyBack.dll -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) - -all: $(mono_SCRIPTS) - -SUFFIXES = .cs .dll -.cs.dll: api/PurpleAPI.dll $(mono_build_sources) - mcs -t:library -lib:./api -out:$@ -r:PurpleAPI.dll $< - -clean-local: - rm -f $(mono_SCRIPTS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,755 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/mono -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(monodir)" -monoSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(mono_SCRIPTS) -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -SUBDIRS = api loader -mono_sources = GetBuddyBack.cs \ - MPlugin.cs - -EXTRA_DIST = $(mono_sources) -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -mono_SCRIPTS = MPlugin.dll GetBuddyBack.dll -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) -SUFFIXES = .cs .dll -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .cs .dll -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/mono/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/mono/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-monoSCRIPTS: $(mono_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(monodir)" || $(mkdir_p) "$(DESTDIR)$(monodir)" - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(monoSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(monodir)/$$f'"; \ - $(monoSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(monodir)/$$f"; \ - else :; fi; \ - done - -uninstall-monoSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(monodir)/$$f'"; \ - rm -f "$(DESTDIR)$(monodir)/$$f"; \ - done - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(SCRIPTS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(monodir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-monoSCRIPTS - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am uninstall-monoSCRIPTS - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-local clean-recursive \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-recursive distclean-tags distdir \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-monoSCRIPTS \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-monoSCRIPTS - - -all: $(mono_SCRIPTS) -.cs.dll: api/PurpleAPI.dll $(mono_build_sources) - mcs -t:library -lib:./api -out:$@ -r:PurpleAPI.dll $< - -clean-local: - rm -f $(mono_SCRIPTS) -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/MPlugin.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/MPlugin.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/MPlugin.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/mono/MPlugin.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -using Purple; - -public class MPlugin : Plugin -{ - private static PluginInfo info = new PluginInfo("mono-mplugin", "C# Plugin", "0.1", "Test C# Plugin", "Longer Description", "Eoin Coffey", "urled"); - - public MPlugin() - : base(info) - { - } - - public void HandleSig(object[] args) - { - Buddy buddy = (Buddy)args[0]; - Status old_status = (Status)args[1]; - Status status = (Status)args[2]; - - Debug.debug(Debug.INFO, "mplug", "buddy " + buddy.Name + " went from " + old_status.Id + " to " + status.Id + "\n"); - } - - public override void Load() - { - Debug.debug(Debug.INFO, "mplug", "loading...\n"); - - /*Signal.connect(BuddyList.GetHandle(), this, "buddy-away", new Signal.Handler(HandleSig));*/ - BuddyList.OnBuddyStatusChanged.connect(this, new Signal.Handler(HandleSig)); - } - - public override void Unload() - { - Debug.debug(Debug.INFO, "mplug", "unloading...\n"); - } - - public override void Destroy() - { - Debug.debug(Debug.INFO, "mplug", "destroying...\n"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/newline.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/newline.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/newline.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/newline.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -/* - * Displays messages on a new line, below the nick - * Copyright (C) 2004 Stu Tomlinson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ -#include "internal.h" - -#include - -#include -#include -#include -#include -#include -#include - -static gboolean -addnewline_msg_cb(PurpleAccount *account, char *sender, char **message, - PurpleConversation *conv, int *flags, void *data) -{ - if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && - !purple_prefs_get_bool("/plugins/core/newline/im")) || - ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && - !purple_prefs_get_bool("/plugins/core/newline/chat"))) - return FALSE; - - if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) { - char *tmp = g_strdup_printf("
%s", *message); - g_free(*message); - *message = tmp; - } - - return FALSE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) { - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/newline/im", _("Add new line in IMs")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/newline/chat", _("Add new line in Chats")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *conversation = purple_conversations_get_handle(); - - purple_signal_connect(conversation, "writing-im-msg", - plugin, PURPLE_CALLBACK(addnewline_msg_cb), NULL); - purple_signal_connect(conversation, "writing-chat-msg", - plugin, PURPLE_CALLBACK(addnewline_msg_cb), NULL); - - return TRUE; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /**< magic */ - PURPLE_MAJOR_VERSION, /**< major version */ - PURPLE_MINOR_VERSION, /**< minor version */ - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "core-plugin_pack-newline", /**< id */ - N_("New Line"), /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Prepends a newline to displayed message."), /**< summary */ - N_("Prepends a newline to messages so that the " - "rest of the message appears below the " - "username in the conversation window."), /**< description */ - "Stu Tomlinson ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) { - purple_prefs_add_none("/plugins/core/newline"); - purple_prefs_add_bool("/plugins/core/newline/im", TRUE); - purple_prefs_add_bool("/plugins/core/newline/chat", TRUE); -} - -PURPLE_INIT_PLUGIN(newline, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/notify_example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/notify_example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/notify_example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/notify_example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * Notify API Example Plugin - * - * Copyright (C) 2007, John Bailey - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -/* This will prevent compiler errors in some instances and is better explained in the - * how-to documents on the wiki */ -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -/* This is the required definition of PURPLE_PLUGINS as required for a plugin, - * but we protect it with an #ifndef because config.h may define it for us - * already and this would cause an unneeded compiler warning. */ -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#define PLUGIN_ID "core-notifyexample" -#define PLUGIN_AUTHOR "John Bailey " - -#include -#include -#include - -static PurplePlugin *notify_example = NULL; - -/* The next four functions and the calls within them should cause dialog boxes to appear - * when you select the plugin action from the Tools->Notify Example menu */ -static void -notify_error_cb(PurplePluginAction *action) -{ - purple_notify_error(notify_example, "Test Notification", "Test Notification", - "This is a test error notification"); -} - -static void -notify_info_cb(PurplePluginAction *action) -{ - purple_notify_info(notify_example, "Test Notification", "Test Notification", - "This is a test informative notification"); -} - -static void -notify_warn_cb(PurplePluginAction *action) -{ - purple_notify_warning(notify_example, "Test Notification", "Test Notification", - "This is a test warning notification"); -} - -static void -notify_format_cb(PurplePluginAction *action) -{ - purple_notify_formatted(notify_example, "Test Notification", "Test Notification", - "Test Notification", - "This is a test notification with formatted text.", NULL, NULL); -} - -static void -notify_uri_cb(PurplePluginAction *action) -{ - /* This one should open your web browser of choice. */ - purple_notify_uri(notify_example, "http://www.pidgin.im/"); -} - -static GList * -plugin_actions(PurplePlugin *plugin, gpointer context) -{ - GList *actions = NULL; - - /* Here we take advantage of return values to avoid the need for a temp variable */ - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Error Notification", notify_error_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Info Notification", notify_info_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Warning Notification", notify_warn_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Formatted Notification", notify_format_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show URI Notification", notify_uri_cb)); - - return g_list_reverse(actions); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - /* we need a handle for all the notify calls */ - notify_example = plugin; - - return TRUE; -} - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, /* magic number */ - PURPLE_MAJOR_VERSION, /* purple major */ - PURPLE_MINOR_VERSION, /* purple minor */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - NULL, /* UI requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* id */ - "Notify API Example", /* name */ - DISPLAY_VERSION, /* version */ - "Notify API Example", /* summary */ - "Notify API Example", /* description */ - PLUGIN_AUTHOR, /* author */ - "http://pidgin.im", /* homepage */ - - plugin_load, /* load */ - NULL, /* unload */ - NULL, /* destroy */ - - NULL, /* ui info */ - NULL, /* extra info */ - NULL, /* prefs info */ - plugin_actions, /* actions */ - NULL, /* reserved */ - NULL, /* reserved */ - NULL, /* reserved */ - NULL /* reserved */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(notifyexample, init_plugin, info) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/offlinemsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/offlinemsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/offlinemsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/offlinemsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,257 +0,0 @@ -/* - * Offline Message Emulation - Save messages sent to an offline user as pounce - * Copyright (C) 2004 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" - -#define PLUGIN_ID "core-plugin_pack-offlinemsg" -#define PLUGIN_NAME N_("Offline Message Emulation") -#define PLUGIN_STATIC_NAME offlinemsg -#define PLUGIN_SUMMARY N_("Save messages sent to an offline user as pounce.") -#define PLUGIN_DESCRIPTION N_("Save messages sent to an offline user as pounce.") -#define PLUGIN_AUTHOR "Sadrul H Chowdhury " - -/* Purple headers */ -#include - -#include -#include -#include -#include -#include -#include - -#define PREF_PREFIX "/plugins/core/" PLUGIN_ID -#define PREF_ALWAYS PREF_PREFIX "/always" - -typedef struct _OfflineMsg OfflineMsg; - -typedef enum -{ - OFFLINE_MSG_NONE, - OFFLINE_MSG_YES, - OFFLINE_MSG_NO -} OfflineMessageSetting; - -struct _OfflineMsg -{ - PurpleAccount *account; - PurpleConversation *conv; - char *who; - char *message; -}; - -static void -discard_data(OfflineMsg *offline) -{ - g_free(offline->who); - g_free(offline->message); - g_free(offline); -} - -static void -cancel_poune(OfflineMsg *offline) -{ - purple_conversation_set_data(offline->conv, "plugin_pack:offlinemsg", - GINT_TO_POINTER(OFFLINE_MSG_NO)); - purple_conv_im_send_with_flags(PURPLE_CONV_IM(offline->conv), offline->message, 0); - discard_data(offline); -} - -static void -record_pounce(OfflineMsg *offline) -{ - PurplePounce *pounce; - PurplePounceEvent event; - PurplePounceOption option; - PurpleConversation *conv; - - event = PURPLE_POUNCE_SIGNON; - option = PURPLE_POUNCE_OPTION_NONE; - - pounce = purple_pounce_new(purple_core_get_ui(), offline->account, offline->who, - event, option); - - purple_pounce_action_set_enabled(pounce, "send-message", TRUE); - purple_pounce_action_set_attribute(pounce, "send-message", "message", offline->message); - - conv = offline->conv; - if (!purple_conversation_get_data(conv, "plugin_pack:offlinemsg")) - purple_conversation_write(conv, NULL, _("The rest of the messages will be saved " - "as pounces. You can edit/delete the pounce from the `Buddy " - "Pounce' dialog."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conversation_set_data(conv, "plugin_pack:offlinemsg", - GINT_TO_POINTER(OFFLINE_MSG_YES)); - - purple_conv_im_write(PURPLE_CONV_IM(conv), offline->who, offline->message, - PURPLE_MESSAGE_SEND, time(NULL)); - - discard_data(offline); -} - -static void -sending_msg_cb(PurpleAccount *account, const char *who, char **message, gpointer handle) -{ - PurpleBuddy *buddy; - OfflineMsg *offline; - PurpleConversation *conv; - OfflineMessageSetting setting; - - if (message == NULL || *message == NULL || - **message == '\0') - return; - - buddy = purple_find_buddy(account, who); - if (!buddy) - return; - - if (purple_presence_is_online(purple_buddy_get_presence(buddy))) - return; - - if (purple_account_supports_offline_message(account, buddy)) - { - purple_debug_info("offlinemsg", "Account \"%s\" supports offline messages.\n", - purple_account_get_username(account)); - return; - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - who, account); - - if (!conv) - return; - - setting = GPOINTER_TO_INT(purple_conversation_get_data(conv, "plugin_pack:offlinemsg")); - if (setting == OFFLINE_MSG_NO) - return; - - offline = g_new0(OfflineMsg, 1); - offline->conv = conv; - offline->account = account; - offline->who = g_strdup(who); - offline->message = *message; - *message = NULL; - - if (purple_prefs_get_bool(PREF_ALWAYS) || setting == OFFLINE_MSG_YES) - record_pounce(offline); - else if (setting == OFFLINE_MSG_NONE) - { - char *ask; - ask = g_strdup_printf(_("\"%s\" is currently offline. Do you want to save the " - "rest of the messages in a pounce and automatically send them " - "when \"%s\" logs back in?"), who, who); - - purple_request_action(handle, _("Offline Message"), ask, - _("You can edit/delete the pounce from the `Buddy Pounces' dialog"), - 0, - offline->account, offline->who, offline->conv, - offline, 2, - _("Yes"), record_pounce, - _("No"), cancel_poune); - g_free(ask); - } -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_signal_connect_priority(purple_conversations_get_handle(), "sending-im-msg", - plugin, PURPLE_CALLBACK(sending_msg_cb), plugin, PURPLE_SIGNAL_PRIORITY_HIGHEST); - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - pref = purple_plugin_pref_new_with_label(_("Save offline messages in pounce")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name_and_label(PREF_ALWAYS, - _("Do not ask. Always save in pounce.")); - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /* Magic */ - PURPLE_MAJOR_VERSION, /* Purple Major Version */ - PURPLE_MINOR_VERSION, /* Purple Minor Version */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - NULL, /* ui requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* plugin id */ - PLUGIN_NAME, /* name */ - DISPLAY_VERSION, /* version */ - PLUGIN_SUMMARY, /* summary */ - PLUGIN_DESCRIPTION, /* description */ - PLUGIN_AUTHOR, /* author */ - PURPLE_WEBSITE, /* website */ - - plugin_load, /* load */ - plugin_unload, /* unload */ - NULL, /* destroy */ - - NULL, /* ui_info */ - NULL, /* extra_info */ - &prefs_info, /* prefs_info */ - NULL, /* actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none(PREF_PREFIX); - purple_prefs_add_bool(PREF_ALWAYS, FALSE); -} - -PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/one_time_password.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/one_time_password.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/one_time_password.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/one_time_password.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -/* - * One Time Password support plugin for libpurple - * - * Copyright (C) 2009, Daniel Atallah - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" -#include "account.h" -#include "accountopt.h" - -#define PLUGIN_ID "core-one_time_password" -#define PREF_NAME PLUGIN_ID "_enabled" - -static void -signed_on_cb(PurpleConnection *conn, void *data) -{ - PurpleAccount *account = purple_connection_get_account(conn); - - if (purple_account_get_bool(account, PREF_NAME, FALSE)) { - if(purple_account_get_remember_password(account)) - purple_debug_error("One Time Password", - "Unable to enforce one time password for account %s (%s).\n" - "Account is set to remember the password.\n", - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - else { - - purple_debug_info("One Time Password", "Clearing password for account %s (%s).\n", - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - purple_account_set_password(account, NULL); - /* TODO: Do we need to somehow clear conn->password ? */ - } - } -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - PurpleAccountOption *option; - GList *l; - - /* Register protocol preference. */ - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - prpl = (PurplePlugin *)l->data; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info != NULL && !(prpl_info->options & OPT_PROTO_NO_PASSWORD)) { - option = purple_account_option_bool_new(_("One Time Password"), - PREF_NAME, FALSE); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - } - } - - /* Register callback. */ - purple_signal_connect(purple_connections_get_handle(), "signed-on", - plugin, PURPLE_CALLBACK(signed_on_cb), NULL); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - PurpleAccountOption *option; - GList *l, *options; - - /* Remove protocol preference. */ - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - prpl = (PurplePlugin *)l->data; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info != NULL && !(prpl_info->options & OPT_PROTO_NO_PASSWORD)) { - options = prpl_info->protocol_options; - while (options != NULL) { - option = (PurpleAccountOption *) options->data; - if (strcmp(PREF_NAME, purple_account_option_get_setting(option)) == 0) { - prpl_info->protocol_options = g_list_delete_link(prpl_info->protocol_options, options); - purple_account_option_destroy(option); - break; - } - options = options->next; - } - } - } - - /* Callback will be automagically unregistered */ - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - PLUGIN_ID, /**< id */ - N_("One Time Password Support"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Enforce that passwords are used only once."), - /** description */ - N_("Allows you to enforce on a per-account basis that passwords not " - "being saved are only used in a single successful connection.\n" - "Note: The account password must not be saved for this to work."), - "Daniel Atallah ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - NULL, /**< reserved 1 */ - NULL, /**< reserved 2 */ - NULL, /**< reserved 3 */ - NULL /**< reserved 4 */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(one_time_password, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/AccountOpts.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/AccountOpts.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/AccountOpts.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/AccountOpts.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -#include "module.h" - -MODULE = Purple::Account::Option PACKAGE = Purple::Account::Option PREFIX = purple_account_option_ -PROTOTYPES: ENABLE - -void -purple_account_option_destroy(option) - Purple::Account::Option option - -const char * -purple_account_option_get_default_string(option) - Purple::Account::Option option - -void -purple_account_option_add_list_item(option, key, value) - Purple::Account::Option option - const char * key - const char * value - -void -purple_account_option_set_default_string(option, value); - Purple::Account::Option option - const char * value - -void -purple_account_option_set_default_int(option, value); - Purple::Account::Option option - int value - -void -purple_account_option_set_default_bool(option, value); - Purple::Account::Option option - gboolean value - -Purple::Account::Option -purple_account_option_list_new(class, text, pref_name, values) - const char * text - const char * pref_name - SV * values -PREINIT: - GList *t_GL; - int i, t_len; -CODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(values)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0))); - - RETVAL = purple_account_option_list_new(text, pref_name, t_GL); -OUTPUT: - RETVAL - -Purple::Account::Option -purple_account_option_string_new(class, text, pref_name, default_value) - const char * text - const char * pref_name - const char * default_value - C_ARGS: - text, pref_name, default_value - -Purple::Account::Option -purple_account_option_int_new(class, text, pref_name, default_value) - const char * text - const char * pref_name - gboolean default_value - C_ARGS: - text, pref_name, default_value - -Purple::Account::Option -purple_account_option_bool_new(class, text, pref_name, default_value) - const char * text - const char * pref_name - gboolean default_value - C_ARGS: - text, pref_name, default_value - -Purple::Account::Option -purple_account_option_new(class, type, text, pref_name) - Purple::PrefType type - const char * text - const char * pref_name - C_ARGS: - type, text, pref_name - -void -purple_account_option_get_list(option) - Purple::Account::Option option -PREINIT: - GList *l; -PPCODE: - for (l = purple_account_option_get_list(option); l != NULL; l = l->next) { - /* XXX These are actually PurpleKeyValuePairs but we don't have a - * type for that and even if we did I don't think there's - * anything perl could do with them, so I'm just going to - * leave this as a Purple::ListEntry for now. */ - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -Purple::PrefType -purple_account_option_get_type(option) - Purple::Account::Option option - -gboolean -purple_account_option_get_masked(option) - Purple::Account::Option option - -int -purple_account_option_get_default_int(option) - Purple::Account::Option option; - -gboolean -purple_account_option_get_default_bool(option) - Purple::Account::Option option; - -const char * -purple_account_option_get_setting(option) - Purple::Account::Option option - -const char * -purple_account_option_get_text(option) - Purple::Account::Option option - -void -purple_account_option_set_list(option, values) - Purple::Account::Option option - SV * values -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(values)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0))); - - purple_account_option_set_list(option, t_GL); - -void -purple_account_option_set_masked(option, masked) - Purple::Account::Option option - gboolean masked - -MODULE = Purple::Account::Option PACKAGE = Purple::Account::UserSplit PREFIX = purple_account_user_split_ -PROTOTYPES: ENABLE - -Purple::Account::UserSplit -purple_account_user_split_new(class, text, default_value, sep) - const char * text - const char * default_value - char sep - C_ARGS: - text, default_value, sep - -char -purple_account_user_split_get_separator(split) - Purple::Account::UserSplit split - -const char * -purple_account_user_split_get_text(split) - Purple::Account::UserSplit split - -void -purple_account_user_split_destroy(split) - Purple::Account::UserSplit split diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Account.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Account.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Account.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Account.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,314 +0,0 @@ -#include "module.h" - -MODULE = Purple::Account PACKAGE = Purple::Account PREFIX = purple_account_ -PROTOTYPES: ENABLE - -Purple::Presence -purple_account_get_presence(account) - Purple::Account account - -Purple::Account -purple_account_new(class, username, protocol_id) - const char * username - const char * protocol_id - C_ARGS: - username, protocol_id - -void -purple_account_destroy(account) - Purple::Account account - -void -purple_account_connect(account) - Purple::Account account - -void -purple_account_register(account) - Purple::Account account - -void -purple_account_disconnect(account) - Purple::Account account - -void -purple_account_request_change_password(account) - Purple::Account account - -void -purple_account_request_change_user_info(account) - Purple::Account account - -void -purple_account_set_username(account, username) - Purple::Account account - const char * username - -void -purple_account_set_password(account, password) - Purple::Account account - const char * password - -void -purple_account_set_alias(account, alias) - Purple::Account account - const char * alias - -void -purple_account_set_user_info(account, user_info) - Purple::Account account - const char *user_info - -void -purple_account_set_buddy_icon_path(account, icon) - Purple::Account account - const char *icon - -void -purple_account_set_connection(account, gc) - Purple::Account account - Purple::Connection gc - -void -purple_account_set_remember_password(account, value) - Purple::Account account - gboolean value - -void -purple_account_set_check_mail(account, value) - Purple::Account account - gboolean value - -void purple_account_set_enabled(account, ui, value) - Purple::Account account - const char *ui - gboolean value - -void -purple_account_set_proxy_info(account, info) - Purple::Account account - Purple::ProxyInfo info - -void -purple_account_set_status(account, status_id, active) - Purple::Account account - const char *status_id - gboolean active -CODE: - purple_account_set_status(account, status_id, active, NULL); - -void -purple_account_set_status_types(account, status_types) - Purple::Account account - SV * status_types -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(status_types)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); - - purple_account_set_status_types(account, t_GL); - -void -purple_account_clear_settings(account) - Purple::Account account - -void -purple_account_set_int(account, name, value) - Purple::Account account - const char *name - int value - -gboolean -purple_account_is_connected(account) - Purple::Account account - -const char * -purple_account_get_username(account) - Purple::Account account - -const char * -purple_account_get_password(account) - Purple::Account account - -const char * -purple_account_get_alias(account) - Purple::Account account - -const char * -purple_account_get_user_info(account) - Purple::Account account - -const char * -purple_account_get_buddy_icon_path(account) - Purple::Account account - -const char * -purple_account_get_protocol_id(account) - Purple::Account account - -const char * -purple_account_get_protocol_name(account) - Purple::Account account - -Purple::Connection -purple_account_get_connection(account) - Purple::Account account - -gboolean -purple_account_get_remember_password(account) - Purple::Account account - -gboolean -purple_account_get_check_mail(account) - Purple::Account account - -gboolean -purple_account_get_enabled(account, ui) - Purple::Account account - const char *ui - -Purple::ProxyInfo -purple_account_get_proxy_info(account) - Purple::Account account - -Purple::Status -purple_account_get_active_status(account) - Purple::Account account - -void -purple_account_get_status_types(account) - Purple::Account account -PREINIT: - GList *l; -PPCODE: - for (l = purple_account_get_status_types(account); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusType"))); - } - -Purple::Log -purple_account_get_log(account, create) - Purple::Account account - gboolean create - -void -purple_account_destroy_log(account) - Purple::Account account - -void -purple_account_add_buddies(account, list) - Purple::Account account - SV * list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(list)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(list), i, 0))); - - purple_account_add_buddies(account, t_GL); - g_list_free(t_GL); - -void -purple_account_add_buddy(account, buddy) - Purple::Account account - Purple::BuddyList::Buddy buddy - -void -purple_account_change_password(account, a, b) - Purple::Account account - const char * a - const char * b - -void -purple_account_remove_buddies(account, A, B) - Purple::Account account - SV * A - SV * B -PREINIT: - GList *t_GL1, *t_GL2; - int i, t_len; -PPCODE: - t_GL1 = NULL; - t_len = av_len((AV *)SvRV(A)); - - for (i = 0; i <= t_len; i++) - t_GL1 = g_list_append(t_GL1, SvPVutf8_nolen(*av_fetch((AV *)SvRV(A), i, 0))); - - t_GL2 = NULL; - t_len = av_len((AV *)SvRV(B)); - - for (i = 0; i <= t_len; i++) - t_GL2 = g_list_append(t_GL2, SvPVutf8_nolen(*av_fetch((AV *)SvRV(B), i, 0))); - - purple_account_remove_buddies(account, t_GL1, t_GL2); - g_list_free(t_GL1); - g_list_free(t_GL2); - -void -purple_account_remove_buddy(account, buddy, group) - Purple::Account account - Purple::BuddyList::Buddy buddy - Purple::BuddyList::Group group - -void -purple_account_remove_group(account, group) - Purple::Account account - Purple::BuddyList::Group group - -MODULE = Purple::Account PACKAGE = Purple::Accounts PREFIX = purple_accounts_ -PROTOTYPES: ENABLE - -void -purple_accounts_add(account) - Purple::Account account - -void -purple_accounts_remove(account) - Purple::Account account - -void -purple_accounts_delete(account) - Purple::Account account - -void -purple_accounts_reorder(account, new_index) - Purple::Account account - size_t new_index - -void -purple_accounts_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_accounts_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account"))); - } - -void -purple_accounts_get_all_active() -PREINIT: - GList *list, *iter; -PPCODE: - list = purple_accounts_get_all_active(); - for (iter = list; iter != NULL; iter = iter->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(iter->data, "Purple::Account"))); - } - g_list_free(list); - -void -purple_accounts_restore_current_statuses() - -Purple::Account -purple_accounts_find(name, protocol) - const char * name - const char * protocol - -Purple::Handle -purple_accounts_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyIcon.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyIcon.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyIcon.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyIcon.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#include "module.h" - -MODULE = Purple::Buddy::Icon PACKAGE = Purple::Buddy::Icon PREFIX = purple_buddy_icon_ -PROTOTYPES: ENABLE - -Purple::Buddy::Icon -purple_buddy_icon_ref(icon) - Purple::Buddy::Icon icon - -Purple::Buddy::Icon -purple_buddy_icon_unref(icon) - Purple::Buddy::Icon icon - -void -purple_buddy_icon_update(icon) - Purple::Buddy::Icon icon - -void -purple_buddy_icon_set_data(icon, data, len, checksum) - Purple::Buddy::Icon icon - void * data - size_t len - char *checksum - -Purple::Account -purple_buddy_icon_get_account(icon) - Purple::Buddy::Icon icon - -const char * -purple_buddy_icon_get_username(icon) - Purple::Buddy::Icon icon - -const void * -purple_buddy_icon_get_data(icon, len) - Purple::Buddy::Icon icon - size_t &len - -const char * -purple_buddy_icon_get_extension(icon) - Purple::Buddy::Icon icon - -void -purple_buddy_icon_get_scale_size(spec, width, height) - Purple::Buddy::Icon::Spec spec - int *width - int *height - -gchar_own * -purple_buddy_icon_get_full_path(icon); - Purple::Buddy::Icon icon - -MODULE = Purple::Buddy::Icon PACKAGE = Purple::Buddy::Icons PREFIX = purple_buddy_icons_ -PROTOTYPES: ENABLE - -void -purple_buddy_icons_set_caching(caching) - gboolean caching - -gboolean -purple_buddy_icons_is_caching() - -void -purple_buddy_icons_set_cache_dir(cache_dir) - const char *cache_dir - -const char * -purple_buddy_icons_get_cache_dir(); - -Purple::Handle -purple_buddy_icons_get_handle(); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyList.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyList.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyList.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/BuddyList.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,418 +0,0 @@ -#undef PURPLE_DISABLE_DEPRECATED -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::BuddyList PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::BuddyList::Node", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_BLIST_##name##_NODE} - const_iv(GROUP), - const_iv(CONTACT), - const_iv(BUDDY), - const_iv(CHAT), - const_iv(OTHER), -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_BLIST_NODE_FLAG_##name} - const_iv(NO_SAVE), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::BuddyList -purple_get_blist() - -void -purple_set_blist(blist) - Purple::BuddyList blist - -MODULE = Purple::BuddyList PACKAGE = Purple::Find PREFIX = purple_find_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Buddy -purple_find_buddy(account, name) - Purple::Account account - const char * name - -void -purple_find_buddies(account, name) - Purple::Account account - const char * name -PREINIT: - GSList *l, *ll; -PPCODE: - ll = purple_find_buddies(account, name); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::BuddyList::Buddy"))); - } - g_slist_free(ll); - -Purple::BuddyList::Group -purple_find_group(name) - const char *name - -MODULE = Purple::BuddyList PACKAGE = Purple::Find PREFIX = purple_ -PROTOTYPES: ENABLE - -gboolean -purple_group_on_account(group, account) - Purple::BuddyList::Group group - Purple::Account account - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Contact PREFIX = purple_contact_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Contact -purple_contact_new(); - -Purple::BuddyList::Buddy -purple_contact_get_priority_buddy(contact) - Purple::BuddyList::Contact contact - -void -purple_contact_set_alias(contact, alias) - Purple::BuddyList::Contact contact - const char * alias - -const char * -purple_contact_get_alias(contact) - Purple::BuddyList::Contact contact - -gboolean -purple_contact_on_account(contact, account) - Purple::BuddyList::Contact contact - Purple::Account account - -void -purple_contact_invalidate_priority_buddy(contact) - Purple::BuddyList::Contact contact - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Group PREFIX = purple_group_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Group -purple_group_new(name) - const char *name - -void -purple_group_get_accounts(group) - Purple::BuddyList::Group group -PREINIT: - GSList *l, *ll; -PPCODE: - ll = purple_group_get_accounts(group); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account"))); - } - g_slist_free(ll); - -gboolean -purple_group_on_account(group, account) - Purple::BuddyList::Group group - Purple::Account account - -const char * -purple_group_get_name(group) - Purple::BuddyList::Group group - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList PREFIX = purple_blist_ -PROTOTYPES: ENABLE - -void -purple_blist_add_contact(contact, group, node) - Purple::BuddyList::Contact contact - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -void -purple_blist_merge_contact(source, node) - Purple::BuddyList::Contact source - Purple::BuddyList::Node node - -void -purple_blist_add_group(group, node) - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -void -purple_blist_add_buddy(buddy, contact, group, node) - Purple::BuddyList::Buddy buddy - Purple::BuddyList::Contact contact - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -void -purple_blist_remove_buddy(buddy) - Purple::BuddyList::Buddy buddy - -void -purple_blist_remove_contact(contact) - Purple::BuddyList::Contact contact - -void -purple_blist_remove_chat(chat) - Purple::BuddyList::Chat chat - -void -purple_blist_remove_group(group) - Purple::BuddyList::Group group - -Purple::BuddyList::Chat -purple_blist_find_chat(account, name) - Purple::Account account - const char *name - -void -purple_blist_add_chat(chat, group, node) - Purple::BuddyList::Chat chat - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -Purple::BuddyList -purple_blist_new() - -void -purple_blist_show() - -void -purple_blist_destroy(); - -void -purple_blist_set_visible(show) - gboolean show - -void -purple_blist_update_buddy_status(buddy, old_status) - Purple::BuddyList::Buddy buddy - Purple::Status old_status - -void -purple_blist_update_buddy_icon(buddy) - Purple::BuddyList::Buddy buddy - -void -purple_blist_rename_buddy(buddy, name) - Purple::BuddyList::Buddy buddy - const char * name - -void -purple_blist_alias_buddy(buddy, alias) - Purple::BuddyList::Buddy buddy - const char * alias - -void -purple_blist_server_alias_buddy(buddy, alias) - Purple::BuddyList::Buddy buddy - const char * alias - -void -purple_blist_alias_chat(chat, alias) - Purple::BuddyList::Chat chat - const char * alias - -void -purple_blist_rename_group(group, name) - Purple::BuddyList::Group group - const char * name - -void -purple_blist_add_account(account) - Purple::Account account - -void -purple_blist_remove_account(account) - Purple::Account account - -int -purple_blist_get_group_size(group, offline) - Purple::BuddyList::Group group - gboolean offline - -int -purple_blist_get_group_online_count(group) - Purple::BuddyList::Group group - -void -purple_blist_load() - -void -purple_blist_schedule_save() - -void -purple_blist_request_add_group() - -Purple::Handle -purple_blist_get_handle() - -Purple::BuddyList::Node -purple_blist_get_root() - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Node PREFIX = purple_blist_node_ -PROTOTYPES: ENABLE - -void -purple_blist_node_get_extended_menu(node) - Purple::BuddyList::Node node -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_blist_node_get_extended_menu(node); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action"))); - } - /* We can free the list here but the script needs to free the - * Purple::Menu::Action 'objects' itself. */ - g_list_free(ll); - -void -purple_blist_node_set_bool(node, key, value) - Purple::BuddyList::Node node - const char * key - gboolean value - -gboolean -purple_blist_node_get_bool(node, key) - Purple::BuddyList::Node node - const char * key - -void -purple_blist_node_set_int(node, key, value) - Purple::BuddyList::Node node - const char * key - int value - -int -purple_blist_node_get_int(node, key) - Purple::BuddyList::Node node - const char * key - -const char * -purple_blist_node_get_string(node, key) - Purple::BuddyList::Node node - const char * key - -void -purple_blist_node_remove_setting(node, key) - Purple::BuddyList::Node node - const char * key - -void -purple_blist_node_set_flags(node, flags) - Purple::BuddyList::Node node - Purple::BuddyList::NodeFlags flags - -Purple::BuddyList::NodeFlags -purple_blist_node_get_flags(node) - Purple::BuddyList::Node node - -Purple::BuddyList::NodeType -purple_blist_node_get_type(node) - Purple::BuddyList::Node node - -Purple::BuddyList::Node -purple_blist_node_next(node, offline) - Purple::BuddyList::Node node - gboolean offline - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Chat PREFIX = purple_chat_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Group -purple_chat_get_group(chat) - Purple::BuddyList::Chat chat - -const char * -purple_chat_get_name(chat) - Purple::BuddyList::Chat chat - -Purple::BuddyList::Chat -purple_chat_new(account, alias, components) - Purple::Account account - const char * alias - SV * components -INIT: - HV * t_HV; - HE * t_HE; - SV * t_SV; - GHashTable * t_GHash; - I32 len; - char *t_key, *t_value; -CODE: - t_HV = (HV *)SvRV(components); - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - - RETVAL = purple_chat_new(account, alias, t_GHash); -OUTPUT: - RETVAL - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Buddy PREFIX = purple_buddy_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Buddy -purple_buddy_new(account, name, alias) - Purple::Account account - const char *name - const char *alias - -const char * -purple_buddy_get_server_alias(buddy) - Purple::BuddyList::Buddy buddy - -void -purple_buddy_set_icon(buddy, icon) - Purple::BuddyList::Buddy buddy - Purple::Buddy::Icon icon - -Purple::Account -purple_buddy_get_account(buddy) - Purple::BuddyList::Buddy buddy - -Purple::BuddyList::Group -purple_buddy_get_group(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_name(buddy) - Purple::BuddyList::Buddy buddy - -Purple::Buddy::Icon -purple_buddy_get_icon(buddy) - Purple::BuddyList::Buddy buddy - -Purple::BuddyList::Contact -purple_buddy_get_contact(buddy) - Purple::BuddyList::Buddy buddy - -Purple::Presence -purple_buddy_get_presence(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_alias_only(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_contact_alias(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_local_alias(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_alias(buddy) - Purple::BuddyList::Buddy buddy diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Certificate.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Certificate.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Certificate.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Certificate.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ -#include "module.h" - -struct cb_data { - SV *cb; - SV *user_data; -}; - -static void cb_cert_verify(PurpleCertificateVerificationStatus st, struct cb_data *d) { - dSP; - - ENTER; - SAVETMPS; - - PUSHMARK(SP); - - XPUSHs(sv_2mortal(newSViv(st))); - XPUSHs(d->user_data); - - PUTBACK; - - call_sv(d->cb, G_VOID | G_EVAL); - - if(SvTRUE(ERRSV)) { - STRLEN l_a; - purple_debug_warning("perl", "Failed to run 'certificate verify' callback: %s\n", SvPV(ERRSV, l_a)); - } - - FREETMPS; - LEAVE; - - SvREFCNT_dec(d->cb); - SvREFCNT_dec(d->user_data); - - g_free(d); -} - -MODULE = Purple::Certificate PACKAGE = Purple::Certificate PREFIX = purple_certificate_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Certificate", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CERTIFICATE_##name} - const_iv(INVALID), - const_iv(VALID), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_certificate_add_ca_search_path(path) - const char* path - -gboolean -purple_certificate_check_subject_name(crt, name) - Purple::Certificate crt - const gchar* name - -Purple::Certificate -purple_certificate_copy(crt) - Purple::Certificate crt - -void -purple_certificate_destroy(crt) - Purple::Certificate crt - -void -purple_certificate_display_x509(crt) - Purple::Certificate crt - -## changed order of arguments, so that $cert->export($file) could be used -gboolean -purple_certificate_export(crt, filename) - const gchar* filename - Purple::Certificate crt - C_ARGS: - filename, crt - -Purple::Certificate::Pool -purple_certificate_find_pool(scheme_name, pool_name) - const gchar* scheme_name - const gchar* pool_name - -Purple::Certificate::Scheme -purple_certificate_find_scheme(name) - const gchar* name - -Purple::Certificate::Verifier -purple_certificate_find_verifier(scheme_name, ver_name) - const gchar* scheme_name - const gchar* ver_name - -Purple::Handle -purple_certificate_get_handle() - -gchar_own* -purple_certificate_get_issuer_unique_id(crt) - Purple::Certificate crt - -gchar_own* -purple_certificate_get_subject_name(crt) - Purple::Certificate crt - -gchar_own* -purple_certificate_get_unique_id(crt) - Purple::Certificate crt - -Purple::Certificate -purple_certificate_import(scheme, filename) - Purple::Certificate::Scheme scheme - const gchar* filename - -gboolean -purple_certificate_register_pool(pool) - Purple::Certificate::Pool pool - -gboolean -purple_certificate_register_scheme(scheme) - Purple::Certificate::Scheme scheme - -gboolean -purple_certificate_register_verifier(vr) - Purple::Certificate::Verifier vr - -gboolean -purple_certificate_signed_by(crt, issuer) - Purple::Certificate crt - Purple::Certificate issuer - -gboolean -purple_certificate_unregister_pool(pool) - Purple::Certificate::Pool pool - -gboolean -purple_certificate_unregister_scheme(scheme) - Purple::Certificate::Scheme scheme - -gboolean -purple_certificate_unregister_verifier(vr) - Purple::Certificate::Verifier vr - -void -purple_certificate_verify_complete(vrq, st) - Purple::Certificate::VerificationRequest vrq - Purple::Certificate::VerificationStatus st - -gboolean -purple_certificate_get_times(crt, OUTLIST time_t activation, OUTLIST time_t expiration) - Purple::Certificate crt - PROTOTYPE: $ - -void -purple_certificate_destroy_list(...) - PREINIT: - GList* l = NULL; - int i = 0; - CODE: - for(i = 0; i < items; i++) { /* PurpleCertificate */ - l = g_list_prepend(l, purple_perl_ref_object(ST(i))); - } - purple_certificate_destroy_list(l); - -void -purple_certificate_get_pools() - PREINIT: - GList *l; - PPCODE: - for(l = purple_certificate_get_pools(); l; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Pool"))); - } - -void -purple_certificate_get_schemes() - PREINIT: - GList *l; - PPCODE: - for(l = purple_certificate_get_schemes(); l; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Scheme"))); - } - -void -purple_certificate_get_verifiers() - PREINIT: - GList *l; - PPCODE: - for(l = purple_certificate_get_verifiers(); l; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Verifier"))); - } - -void -purple_certificate_check_signature_chain(...) - PREINIT: - GList *l = NULL; - gboolean ret; - int i; - PPCODE: - for(i = 0; i < items; i++) { /* PurpleCertificate */ - l = g_list_prepend(l, purple_perl_ref_object(ST(i))); - } - l = g_list_reverse(l); - ret = purple_certificate_check_signature_chain(l); - g_list_free(l); - if(ret) XSRETURN_YES; - XSRETURN_NO; - -SV* -purple_certificate_get_fingerprint_sha1(crt) - Purple::Certificate crt - PREINIT: - GByteArray *gba = NULL; - CODE: - gba = purple_certificate_get_fingerprint_sha1(crt); - RETVAL = newSVpv((gchar *)gba->data, gba->len); - g_byte_array_free(gba, TRUE); - OUTPUT: - RETVAL - -void -purple_certificate_verify(verifier, subject_name, cert_chain, cb, cb_data) - Purple::Certificate::Verifier verifier - const gchar* subject_name - AV* cert_chain - CV *cb - SV *cb_data - PREINIT: - GList *l = NULL; - int len = 0, i = 0; - struct cb_data *d = NULL; - PPCODE: - len = av_len(cert_chain); - for(i = 0; i <= len; i++) { - SV **sv = av_fetch(cert_chain, i, 0); - if(!sv || !purple_perl_is_ref_object(*sv)) { - g_list_free(l); - warn("Purple::Certificate::verify: cert_chain: non-purple object in array..."); - XSRETURN_UNDEF; - } - l = g_list_prepend(l, purple_perl_ref_object(*sv)); - } - l = g_list_reverse(l); - - d = g_new0(struct cb_data, 1); - d->cb = newSVsv(ST(3)); - d->user_data = newSVsv(cb_data); - - purple_certificate_verify(verifier, subject_name, l, (PurpleCertificateVerifiedCallback) cb_cert_verify, d); - - g_list_free(l); - -MODULE = Purple::Certificate PACKAGE = Purple::Certificate::Pool PREFIX = purple_certificate_pool_ -PROTOTYPES: ENABLE - -void -purple_certificate_pool_get_idlist(pool) - Purple::Certificate::Pool pool - PREINIT: - GList *l, *b; - PPCODE: - b = purple_certificate_pool_get_idlist(pool); - for(l = b; l; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - purple_certificate_pool_destroy_idlist(b); - -gboolean -purple_certificate_pool_contains(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -gboolean -purple_certificate_pool_delete(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -Purple::Certificate::Scheme -purple_certificate_pool_get_scheme(pool) - Purple::Certificate::Pool pool - -gchar_own* -purple_certificate_pool_mkpath(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -Purple::Certificate -purple_certificate_pool_retrieve(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -gboolean -purple_certificate_pool_store(pool, id, crt) - Purple::Certificate::Pool pool - const gchar* id - Purple::Certificate crt - -gboolean -purple_certificate_pool_usable(pool) - Purple::Certificate::Pool pool - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cipher.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cipher.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cipher.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cipher.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,308 +0,0 @@ -#include "module.h" - -MODULE = Purple::Cipher PACKAGE = Purple::Cipher PREFIX = purple_cipher_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Cipher::BatchMode", 1); - HV *cipher_caps = gv_stashpv("Purple::Cipher::Caps", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CIPHER_BATCH_MODE_##name} - const_iv(ECB), - const_iv(CBC), -#undef const_iv - }; - - static const constiv bm_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CIPHER_CAPS_##name} - const_iv(SET_OPT), - const_iv(GET_OPT), - const_iv(INIT), - const_iv(RESET), - const_iv(UNINIT), - const_iv(SET_IV), - const_iv(APPEND), - const_iv(DIGEST), - const_iv(ENCRYPT), - const_iv(DECRYPT), - const_iv(SET_SALT), - const_iv(GET_SALT_SIZE), - const_iv(SET_KEY), - const_iv(GET_KEY_SIZE), - const_iv(SET_BATCH_MODE), - const_iv(GET_BATCH_MODE), - const_iv(GET_BLOCK_SIZE), - const_iv(SET_KEY_WITH_LEN), - const_iv(UNKNOWN), -#undef const_iv - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = bm_const_iv + sizeof(bm_const_iv) / sizeof(bm_const_iv[0]); civ-- > bm_const_iv; ) - newCONSTSUB(cipher_caps, (char *)civ->name, newSViv(civ->iv)); -} - -const gchar * -purple_cipher_get_name(cipher) - Purple::Cipher cipher - -guint -purple_cipher_get_capabilities(cipher) - Purple::Cipher cipher - -size_t -purple_cipher_digest_region(name, data_sv, in_len, digest) - const gchar *name - SV *data_sv - size_t in_len - SV *digest - PREINIT: - gboolean ret; - guchar *buff = NULL; - guchar *data = NULL; - size_t data_len; - CODE: - data = (guchar *)SvPV(data_sv, data_len); - SvUPGRADE(digest, SVt_PV); - buff = (guchar *)SvGROW(digest, in_len); - ret = purple_cipher_digest_region(name, data, data_len, in_len, buff, &RETVAL); - if(!ret) { - SvSetSV_nosteal(digest, &PL_sv_undef); - XSRETURN_UNDEF; - } - SvCUR_set(digest, RETVAL); - SvPOK_only(digest); - OUTPUT: - RETVAL - -gchar_own* -purple_cipher_http_digest_calculate_response(algorithm, method, digest_uri, qop, entity, nonce, nonce_count, client_nonce, session_key) - const gchar* algorithm - const gchar* method - const gchar* digest_uri - const gchar* qop - const gchar* entity - const gchar* nonce - const gchar* nonce_count - const gchar* client_nonce - const gchar* session_key - -gchar_own* -purple_cipher_http_digest_calculate_session_key(algorithm, username, realm, password, nonce, client_nonce) - const gchar* algorithm - const gchar* username - const gchar* realm - const gchar* password - const gchar* nonce - const gchar* client_nonce - -MODULE = Purple::Cipher PACKAGE = Purple::Ciphers PREFIX = purple_ciphers_ -PROTOTYPES: ENABLE - -Purple::Cipher -purple_ciphers_find_cipher(name) - gchar * name - -Purple::Cipher -purple_ciphers_register_cipher(name, ops) - gchar * name - Purple::Cipher::Ops ops - -gboolean -purple_ciphers_unregister_cipher(cipher) - Purple::Cipher cipher - -void -purple_ciphers_get_ciphers() -PREINIT: - GList *l; -PPCODE: - for (l = purple_ciphers_get_ciphers(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Cipher"))); - } - -Purple::Handle -purple_ciphers_get_handle() - -MODULE = Purple::Cipher PACKAGE = Purple::Cipher::Context PREFIX = purple_cipher_context_ -PROTOTYPES: ENABLE - -void -purple_cipher_context_set_option(context, name, value) - Purple::Cipher::Context context - gchar *name - gpointer value - -gpointer -purple_cipher_context_get_option(context, name) - Purple::Cipher::Context context - gchar *name - -Purple::Cipher::Context -purple_cipher_context_new(klass, cipher, extra = NULL) - Purple::Cipher cipher - void *extra - C_ARGS: cipher, extra - -Purple::Cipher::Context -purple_cipher_context_new_by_name(klass, name, extra = NULL) - gchar *name - void *extra - C_ARGS: name, extra - -void -purple_cipher_context_reset(context, extra = NULL) - Purple::Cipher::Context context - gpointer extra - -void -purple_cipher_context_destroy(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_iv(Purple::Cipher::Context context, guchar *iv, size_t length(iv)) - PROTOTYPE: $$ - -void -purple_cipher_context_append(Purple::Cipher::Context context, guchar *data, size_t length(data)) - PROTOTYPE: $$ - -size_t -purple_cipher_context_digest(context, in_len, digest) - Purple::Cipher::Context context - size_t in_len - SV *digest - PREINIT: - gboolean ret; - guchar *buff = NULL; - CODE: - SvUPGRADE(digest, SVt_PV); - buff = (guchar *)SvGROW(digest, in_len); - ret = purple_cipher_context_digest(context, in_len, buff, &RETVAL); - if(!ret) { - SvSetSV_nosteal(digest, &PL_sv_undef); - XSRETURN_UNDEF; - } - SvCUR_set(digest, RETVAL); - SvPOK_only(digest); - OUTPUT: - RETVAL - -size_t -purple_cipher_context_digest_to_str(context, in_len, digest_s) - Purple::Cipher::Context context - size_t in_len - SV *digest_s - PREINIT: - gboolean ret; - gchar *buff = NULL; - CODE: - in_len += 1; /* perl shouldn't need to care about '\0' at the end */ - SvUPGRADE(digest_s, SVt_PV); - buff = SvGROW(digest_s, in_len); - ret = purple_cipher_context_digest_to_str(context, in_len, buff, &RETVAL); - if(!ret) { - SvSetSV_nosteal(digest_s, &PL_sv_undef); - XSRETURN_UNDEF; - } - SvCUR_set(digest_s, RETVAL); - SvPOK_only(digest_s); - OUTPUT: - RETVAL - -gint -purple_cipher_context_encrypt(context, data_sv, output, OUTLIST size_t outlen) - Purple::Cipher::Context context - SV *data_sv - SV *output - PROTOTYPE: $$$ - PREINIT: - size_t datalen; - guchar *buff = NULL; - guchar *data = NULL; - CODE: - data = (guchar *)SvPV(data_sv, datalen); - SvUPGRADE(output, SVt_PV); - buff = (guchar *)SvGROW(output, datalen); - RETVAL = purple_cipher_context_encrypt(context, data, datalen, buff, &outlen); - if(outlen != 0) { - SvPOK_only(output); - SvCUR_set(output, outlen); - } else { - SvSetSV_nosteal(output, &PL_sv_undef); - } - OUTPUT: - RETVAL - -gint -purple_cipher_context_decrypt(context, data_sv, output, OUTLIST size_t outlen) - Purple::Cipher::Context context - SV *data_sv - SV *output - PROTOTYPE: $$$ - PREINIT: - size_t datalen; - guchar *buff = NULL; - guchar *data = NULL; - CODE: - data = (guchar *)SvPV(data_sv, datalen); - SvUPGRADE(output, SVt_PV); - buff = (guchar *)SvGROW(output, datalen); - RETVAL = purple_cipher_context_decrypt(context, data, datalen, buff, &outlen); - if(outlen != 0) { - SvPOK_only(output); - SvCUR_set(output, outlen); - } else { - SvSetSV_nosteal(output, &PL_sv_undef); - } - OUTPUT: - RETVAL - -void -purple_cipher_context_set_salt(context, salt) - Purple::Cipher::Context context - guchar *salt - -size_t -purple_cipher_context_get_salt_size(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_key(context, key) - Purple::Cipher::Context context - guchar *key - -size_t -purple_cipher_context_get_key_size(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_data(context, data) - Purple::Cipher::Context context - gpointer data - -gpointer -purple_cipher_context_get_data(context) - Purple::Cipher::Context context - -Purple::Cipher::BatchMode -purple_cipher_context_get_batch_mode(context) - Purple::Cipher::Context context - -size_t -purple_cipher_context_get_block_size(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_batch_mode(context, mode) - Purple::Cipher::Context context - Purple::Cipher::BatchMode mode - -void -purple_cipher_context_set_key_with_len(Purple::Cipher::Context context, guchar *key, size_t length(key)) - PROTOTYPE: $$ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cmds.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cmds.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cmds.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Cmds.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::Cmd PACKAGE = Purple::Cmd PREFIX = purple_cmd_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *status_stash = gv_stashpv("Purple::Cmd::Status", 1); - HV *ret_stash = gv_stashpv("Purple::Cmd::Return", 1); - HV *p_stash = gv_stashpv("Purple::Cmd::Priority", 1); - HV *flag_stash = gv_stashpv("Purple::Cmd::Flag", 1); - - static const constiv *civ, status_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CMD_STATUS_##name} - const_iv(OK), - const_iv(FAILED), - const_iv(NOT_FOUND), - const_iv(WRONG_ARGS), - const_iv(WRONG_PRPL), - const_iv(WRONG_TYPE), - }; - static const constiv ret_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CMD_RET_##name} - const_iv(OK), - const_iv(FAILED), - const_iv(CONTINUE), - }; - static const constiv p_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CMD_P_##name} - const_iv(VERY_LOW), - const_iv(LOW), - const_iv(DEFAULT), - const_iv(PRPL), - const_iv(PLUGIN), - const_iv(ALIAS), - const_iv(HIGH), - const_iv(VERY_HIGH), - }; - static const constiv flag_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CMD_FLAG_##name} - const_iv(IM), - const_iv(CHAT), - const_iv(PRPL_ONLY), - const_iv(ALLOW_WRONG_ARGS), - }; - - for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_const_iv;) - newCONSTSUB(status_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = ret_const_iv + sizeof(ret_const_iv) / sizeof(ret_const_iv[0]); civ-- > ret_const_iv;) - newCONSTSUB(ret_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = p_const_iv + sizeof(p_const_iv) / sizeof(p_const_iv[0]); civ-- > p_const_iv;) - newCONSTSUB(p_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = flag_const_iv + sizeof(flag_const_iv) / sizeof(flag_const_iv[0]); civ-- > flag_const_iv;) - newCONSTSUB(flag_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_cmd_help(conv, command) - Purple::Conversation conv - const gchar *command -PREINIT: - GList *l, *ll; -PPCODE: - for (l = ll = purple_cmd_help(conv, command); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - g_list_free(ll); - -void -purple_cmd_list(conv) - Purple::Conversation conv -PREINIT: - GList *l, *ll; -PPCODE: - for (l = ll = purple_cmd_list(conv); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - g_list_free(ll); - -Purple::Cmd::Id -purple_cmd_register(plugin, command, args, priority, flag, prpl_id, func, helpstr, data = 0) - Purple::Plugin plugin - const gchar *command - const gchar *args - Purple::Cmd::Priority priority - Purple::Cmd::Flag flag - const gchar *prpl_id - SV *func - const gchar *helpstr - SV *data -CODE: - RETVAL = purple_perl_cmd_register(plugin, command, args, priority, flag, - prpl_id, func, helpstr, data); -OUTPUT: - RETVAL - -void -purple_cmd_unregister(id) - Purple::Cmd::Id id -CODE: - purple_perl_cmd_unregister(id); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Connection.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Connection.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Connection.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Connection.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -#include "module.h" - -MODULE = Purple::Connection PACKAGE = Purple::Connection PREFIX = purple_connection_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Connection::State", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_##name} - const_iv(DISCONNECTED), - const_iv(CONNECTED), - const_iv(CONNECTING), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Account -purple_connection_get_account(gc) - Purple::Connection gc - -const char * -purple_connection_get_password(gc) - Purple::Connection gc - -const char * -purple_connection_get_display_name(gc) - Purple::Connection gc - -void -purple_connection_notice(gc, text) - Purple::Connection gc - const char *text - -void -purple_connection_error(gc, reason) - Purple::Connection gc - const char *reason - -void -purple_connection_destroy(gc) - Purple::Connection gc - -void -purple_connection_set_state(gc, state) - Purple::Connection gc - Purple::ConnectionState state - -void -purple_connection_set_account(gc, account) - Purple::Connection gc - Purple::Account account - -void -purple_connection_set_display_name(gc, name) - Purple::Connection gc - const char *name - -Purple::ConnectionState -purple_connection_get_state(gc) - Purple::Connection gc - -MODULE = Purple::Connection PACKAGE = Purple::Connections PREFIX = purple_connections_ -PROTOTYPES: ENABLE - -void -purple_connections_disconnect_all() - -void -purple_connections_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_connections_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Connection"))); - } - -void -purple_connections_get_connecting() -PREINIT: - GList *l; -PPCODE: - for (l = purple_connections_get_connecting(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Connection"))); - } - -Purple::Handle -purple_connections_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Conversation.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Conversation.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Conversation.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Conversation.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,493 +0,0 @@ -#include "module.h" - -MODULE = Purple::Conversation PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Conversation::Type", 1); - HV *update_stash = gv_stashpv("Purple::Conversation::Update::Type", 1); - HV *typing_stash = gv_stashpv("Purple::Conversation::TypingState", 1); - HV *flags_stash = gv_stashpv("Purple::Conversation::Flags", 1); - HV *cbflags_stash = gv_stashpv("Purple::Conversation::ChatBuddy::Flags", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CONV_TYPE_##name} - const_iv(UNKNOWN), - const_iv(IM), - const_iv(CHAT), - const_iv(MISC), - const_iv(ANY), - }; - static const constiv update_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CONV_UPDATE_##name} - const_iv(ADD), - const_iv(REMOVE), - const_iv(ACCOUNT), - const_iv(TYPING), - const_iv(UNSEEN), - const_iv(LOGGING), - const_iv(TOPIC), -/* - const_iv(ONLINE), - const_iv(OFFLINE), -*/ - const_iv(AWAY), - const_iv(ICON), - const_iv(TITLE), - const_iv(CHATLEFT), - const_iv(FEATURES), - }; - static const constiv typing_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_##name} - const_iv(NOT_TYPING), - const_iv(TYPING), - const_iv(TYPED), - }; - static const constiv flags_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_MESSAGE_##name} - const_iv(SEND), - const_iv(RECV), - const_iv(SYSTEM), - const_iv(AUTO_RESP), - const_iv(ACTIVE_ONLY), - const_iv(NICK), - const_iv(NO_LOG), - const_iv(WHISPER), - const_iv(ERROR), - const_iv(DELAYED), - const_iv(RAW), - const_iv(IMAGES), - const_iv(NOTIFY), - const_iv(NO_LINKIFY), - }; - static const constiv cbflags_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CBFLAGS_##name} - const_iv(NONE), - const_iv(VOICE), - const_iv(HALFOP), - const_iv(OP), - const_iv(FOUNDER), - const_iv(TYPING), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = update_const_iv + sizeof(update_const_iv) / sizeof(update_const_iv[0]); civ-- > update_const_iv; ) - newCONSTSUB(update_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = typing_const_iv + sizeof(typing_const_iv) / sizeof(typing_const_iv[0]); civ-- > typing_const_iv; ) - newCONSTSUB(typing_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; ) - newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = cbflags_const_iv + sizeof(cbflags_const_iv) / sizeof(cbflags_const_iv[0]); civ-- > cbflags_const_iv; ) - newCONSTSUB(cbflags_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_get_ims() -PREINIT: - GList *l; -PPCODE: - for (l = purple_get_ims(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); - } - -void -purple_get_conversations() -PREINIT: - GList *l; -PPCODE: - for (l = purple_get_conversations(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); - } - -void -purple_get_chats() -PREINIT: - GList *l; -PPCODE: - for (l = purple_get_chats(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); - } - -MODULE = Purple::Conversation PACKAGE = Purple::Conversations PREFIX = purple_conversations_ -PROTOTYPES: ENABLE - -Purple::Handle -purple_conversations_get_handle() - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation PREFIX = purple_conversation_ -PROTOTYPES: ENABLE - -void -purple_conversation_destroy(conv) - Purple::Conversation conv - -Purple::ConversationType -purple_conversation_get_type(conv) - Purple::Conversation conv - -Purple::Account -purple_conversation_get_account(conv) - Purple::Conversation conv - -Purple::Connection -purple_conversation_get_gc(conv) - Purple::Conversation conv - -void -purple_conversation_set_title(conv, title); - Purple::Conversation conv - const char * title - -const char * -purple_conversation_get_title(conv) - Purple::Conversation conv - -void -purple_conversation_autoset_title(conv) - Purple::Conversation conv - -void -purple_conversation_set_name(conv, name) - Purple::Conversation conv - const char *name - -const char * -purple_conversation_get_name(conv) - Purple::Conversation conv - -void -purple_conversation_set_logging(conv, log) - Purple::Conversation conv - gboolean log - -gboolean -purple_conversation_is_logging(conv) - Purple::Conversation conv - -Purple::Conversation::IM -purple_conversation_get_im_data(conv) - Purple::Conversation conv - -Purple::Conversation::Chat -purple_conversation_get_chat_data(conv) - Purple::Conversation conv - -gpointer -purple_conversation_get_data(conv, key) - Purple::Conversation conv - const char * key - -Purple::ConnectionFlags -purple_conversation_get_features(conv) - Purple::Conversation conv - -gboolean -purple_conversation_has_focus(conv) - Purple::Conversation conv - -void -purple_conversation_update(conv, type) - Purple::Conversation conv - Purple::ConvUpdateType type - -Purple::Conversation -purple_conversation_new(class, type, account, name) - Purple::ConversationType type - Purple::Account account - const char *name - C_ARGS: - type, account, name - -void -purple_conversation_set_account(conv, account); - Purple::Conversation conv - Purple::Account account - -void -purple_conversation_write(conv, who, message, flags, mtime) - Purple::Conversation conv - const char *who - const char *message - Purple::MessageFlags flags - time_t mtime - -gboolean -purple_conversation_do_command(conv, cmdline, markup, error) - Purple::Conversation conv - const char *cmdline - const char *markup - char **error - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation::IM PREFIX = purple_conv_im_ -PROTOTYPES: ENABLE - -Purple::Conversation -purple_conv_im_get_conversation(im) - Purple::Conversation::IM im - -void -purple_conv_im_set_icon(im, icon) - Purple::Conversation::IM im - Purple::Buddy::Icon icon - -Purple::Buddy::Icon -purple_conv_im_get_icon(im) - Purple::Conversation::IM im - -void -purple_conv_im_set_typing_state(im, state) - Purple::Conversation::IM im - Purple::TypingState state - -Purple::TypingState -purple_conv_im_get_typing_state(im) - Purple::Conversation::IM im - -void -purple_conv_im_start_typing_timeout(im, timeout) - Purple::Conversation::IM im - int timeout - -void -purple_conv_im_stop_typing_timeout(im) - Purple::Conversation::IM im - -guint -purple_conv_im_get_typing_timeout(im) - Purple::Conversation::IM im - -void -purple_conv_im_set_type_again(im, val) - Purple::Conversation::IM im - time_t val - -time_t -purple_conv_im_get_type_again(im) - Purple::Conversation::IM im - -void -purple_conv_im_start_send_typed_timeout(im) - Purple::Conversation::IM im - -void -purple_conv_im_stop_send_typed_timeout(im) - Purple::Conversation::IM im - -guint -purple_conv_im_get_send_typed_timeout(im) - Purple::Conversation::IM im - -void -purple_conv_im_update_typing(im) - Purple::Conversation::IM im - -void -purple_conv_im_send(im, message) - Purple::Conversation::IM im - const char *message - -void -purple_conv_im_write(im, who, message, flags, mtime) - Purple::Conversation::IM im - const char *who - const char *message - Purple::MessageFlags flags - time_t mtime - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation PREFIX = purple_conv_ -PROTOTYPES: ENABLE - -gboolean -purple_conv_present_error(who, account, what) - const char *who - Purple::Account account - const char *what - -void -purple_conv_custom_smiley_close(conv, smile) - Purple::Conversation conv - const char *smile - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation::Chat PREFIX = purple_conv_chat_ -PROTOTYPES: ENABLE - -Purple::Conversation -purple_conv_chat_get_conversation(chat) - Purple::Conversation::Chat chat - -void -purple_conv_chat_set_users(chat, users) - Purple::Conversation::Chat chat - SV * users -PREINIT: - GList *l, *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(users)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); - - for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -void -purple_conv_chat_get_users(chat) - Purple::Conversation::Chat chat -PREINIT: - GList *l; -PPCODE: - for (l = purple_conv_chat_get_users(chat); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -void -purple_conv_chat_ignore(chat, name) - Purple::Conversation::Chat chat - const char *name - -void -purple_conv_chat_unignore(chat, name) - Purple::Conversation::Chat chat - const char *name - -void -purple_conv_chat_set_ignored(chat, ignored) - Purple::Conversation::Chat chat - SV * ignored -PREINIT: - GList *l, *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(ignored)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0))); - - for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -void -purple_conv_chat_get_ignored(chat) - Purple::Conversation::Chat chat -PREINIT: - GList *l; -PPCODE: - for (l = purple_conv_chat_get_ignored(chat); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -const char * -purple_conv_chat_get_topic(chat) - Purple::Conversation::Chat chat - -void -purple_conv_chat_set_id(chat, id) - Purple::Conversation::Chat chat - int id - -int -purple_conv_chat_get_id(chat) - Purple::Conversation::Chat chat - -void -purple_conv_chat_send(chat, message) - Purple::Conversation::Chat chat - const char * message - -void -purple_conv_chat_write(chat, who, message, flags, mtime) - Purple::Conversation::Chat chat - const char *who - const char *message - Purple::MessageFlags flags - time_t mtime - -void -purple_conv_chat_add_users(chat, users, extra_msgs, flags, new_arrivals) - Purple::Conversation::Chat chat - SV * users - SV * extra_msgs - SV * flags - gboolean new_arrivals -PREINIT: - GList *t_GL_users, *t_GL_extra_msgs, *t_GL_flags; - int i, t_len; -PPCODE: - t_GL_users = NULL; - t_len = av_len((AV *)SvRV(users)); - - for (i = 0; i <= t_len; i++) - t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); - - t_GL_flags = NULL; - t_len = av_len((AV *)SvRV(flags)); - - for (i = 0; i <= t_len; i++) - t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0))); - - t_GL_extra_msgs = NULL; - t_len = av_len((AV *)SvRV(extra_msgs)); - - for (i = 0; i <= t_len; i++) - t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0))); - - purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals); - - g_list_free(t_GL_users); - g_list_free(t_GL_extra_msgs); - g_list_free(t_GL_flags); - -gboolean -purple_conv_chat_find_user(chat, user) - Purple::Conversation::Chat chat - const char * user - -void purple_conv_chat_clear_users(chat) - Purple::Conversation::Chat chat - -void purple_conv_chat_set_nick(chat, nick) - Purple::Conversation::Chat chat - const char * nick - -const char * -purple_conv_chat_get_nick(chat) - Purple::Conversation::Chat chat - -Purple::Conversation -purple_find_chat(gc, id) - Purple::Connection gc - int id - -void purple_conv_chat_left(chat) - Purple::Conversation::Chat chat - -gboolean purple_conv_chat_has_left(chat) - Purple::Conversation::Chat chat - -Purple::Conversation::ChatBuddy -purple_conv_chat_cb_find(chat, name) - Purple::Conversation::Chat chat - const char *name - -const char * -purple_conv_chat_cb_get_name(cb) - Purple::Conversation::ChatBuddy cb - -void -purple_conv_chat_cb_destroy(cb); - Purple::Conversation::ChatBuddy cb diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Core.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Core.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Core.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Core.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -#include "module.h" - -MODULE = Purple::Core PACKAGE = Purple::Core PREFIX = purple_core_ -PROTOTYPES: ENABLE - -gboolean -purple_core_quit_cb() -PPCODE: - /* The argument to purple_core_quit_cb is not used, - * so there's little point in requiring it on the - * Perl side. */ - RETVAL = purple_core_quit_cb(NULL); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - -const char * -purple_core_get_version() - -const char * -purple_core_get_ui() - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Debug.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Debug.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Debug.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Debug.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -#include "module.h" - -MODULE = Purple::Debug PACKAGE = Purple::Debug PREFIX = purple_debug_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Debug", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_DEBUG_##name} - const_iv(ALL), - const_iv(MISC), - const_iv(INFO), - const_iv(WARNING), - const_iv(ERROR), - const_iv(FATAL), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_debug(level, category, string) - Purple::DebugLevel level - const char *category - const char *string -CODE: - purple_debug(level, category, "%s", string); - -void -purple_debug_misc(category, string) - const char *category - const char *string -CODE: - purple_debug_misc(category, "%s", string); - -void -purple_debug_info(category, string) - const char *category - const char *string -CODE: - purple_debug_info(category, "%s", string); - -void -purple_debug_warning(category, string) - const char *category - const char *string -CODE: - purple_debug_warning(category, "%s", string); - -void -purple_debug_error(category, string) - const char *category - const char *string -CODE: - purple_debug_error(category, "%s", string); - -void -purple_debug_fatal(category, string) - const char *category - const char *string -CODE: - purple_debug_fatal(category, "%s", string); - -void -purple_debug_set_enabled(enabled) - gboolean enabled - -gboolean -purple_debug_is_enabled() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/FT.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/FT.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/FT.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/FT.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -#include "module.h" - -MODULE = Purple::Xfer PACKAGE = Purple::Xfer PREFIX = purple_xfer_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Xfer::Type", 1); - HV *status_stash = gv_stashpv("Purple::Xfer::Status", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_XFER_##name} - const_iv(UNKNOWN), - const_iv(SEND), - const_iv(RECEIVE), - }; - static const constiv status_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_XFER_STATUS_##name} - const_iv(UNKNOWN), - const_iv(NOT_STARTED), - const_iv(ACCEPTED), - const_iv(STARTED), - const_iv(DONE), - const_iv(CANCEL_LOCAL), - const_iv(CANCEL_REMOTE), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_const_iv; ) - newCONSTSUB(status_stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Xfer -purple_xfer_new(class, account, type, who) - Purple::Account account - Purple::XferType type - const char *who - C_ARGS: - account, type, who - -void -purple_xfer_add(xfer) - Purple::Xfer xfer - -void -purple_xfer_cancel_local(xfer) - Purple::Xfer xfer - -void -purple_xfer_cancel_remote(xfer) - Purple::Xfer xfer - -void -purple_xfer_end(xfer) - Purple::Xfer xfer - -void -purple_xfer_error(type, account, who, msg) - Purple::XferType type - Purple::Account account - const char *who - const char *msg - -Purple::Account -purple_xfer_get_account(xfer) - Purple::Xfer xfer - -size_t -purple_xfer_get_bytes_remaining(xfer) - Purple::Xfer xfer - -size_t -purple_xfer_get_bytes_sent(xfer) - Purple::Xfer xfer - -const char * -purple_xfer_get_filename(xfer) - Purple::Xfer xfer - -const char * -purple_xfer_get_local_filename(xfer) - Purple::Xfer xfer - -unsigned int -purple_xfer_get_local_port(xfer) - Purple::Xfer xfer - -double -purple_xfer_get_progress(xfer) - Purple::Xfer xfer - -const char * -purple_xfer_get_remote_ip(xfer) - Purple::Xfer xfer - -unsigned int -purple_xfer_get_remote_port(xfer) - Purple::Xfer xfer - -size_t -purple_xfer_get_size(xfer) - Purple::Xfer xfer - -Purple::XferStatusType -purple_xfer_get_status(xfer) - Purple::Xfer xfer - -Purple::XferType -purple_xfer_get_type(xfer) - Purple::Xfer xfer - -gboolean -purple_xfer_is_canceled(xfer) - Purple::Xfer xfer - -gboolean -purple_xfer_is_completed(xfer) - Purple::Xfer xfer - -ssize_t -purple_xfer_read(xfer, buffer) - Purple::Xfer xfer - guchar **buffer - -void -purple_xfer_ref(xfer) - Purple::Xfer xfer - -void -purple_xfer_request(xfer) - Purple::Xfer xfer - -void -purple_xfer_request_accepted(xfer, filename) - Purple::Xfer xfer - const char *filename - -void -purple_xfer_request_denied(xfer) - Purple::Xfer xfer - -void -purple_xfer_set_completed(xfer, completed) - Purple::Xfer xfer - gboolean completed - -void -purple_xfer_set_filename(xfer, filename) - Purple::Xfer xfer - const char *filename - -void -purple_xfer_set_local_filename(xfer, filename) - Purple::Xfer xfer - const char *filename - -void -purple_xfer_set_message(xfer, message) - Purple::Xfer xfer - const char *message - -void -purple_xfer_set_size(xfer, size) - Purple::Xfer xfer - size_t size - -void -purple_xfer_unref(xfer) - Purple::Xfer xfer - -void -purple_xfer_update_progress(xfer) - Purple::Xfer xfer - -ssize_t -purple_xfer_write(xfer, buffer, size) - Purple::Xfer xfer - const guchar *buffer - size_t size - -MODULE = Purple::Xfer PACKAGE = Purple::Xfers PREFIX = purple_xfers_ -PROTOTYPES: ENABLE - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Idle.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Idle.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Idle.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Idle.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -#include "module.h" - -MODULE = Purple::Idle PACKAGE = Purple::Idle PREFIX = purple_idle_ -PROTOTYPES: ENABLE - -void -purple_idle_touch() - -void -purple_idle_set(time) - time_t time - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/ImgStore.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/ImgStore.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/ImgStore.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/ImgStore.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -#include "module.h" - -MODULE = Purple::ImgStore PACKAGE = Purple::ImgStore PREFIX = purple_imgstore_ -PROTOTYPES: ENABLE - -Purple::StoredImage -purple_imgstore_add(data, size, filename) - void *data - size_t size - const char *filename - -int -purple_imgstore_add_with_id(data, size, filename) - void *data - size_t size - const char *filename - -Purple::StoredImage -purple_imgstore_find_by_id(id) - int id - -gconstpointer -purple_imgstore_get_data(i) - Purple::StoredImage i - -const char * -purple_imgstore_get_filename(i) - Purple::StoredImage i - -size_t -purple_imgstore_get_size(i) - Purple::StoredImage i - -const char * -purple_imgstore_get_extension(i) - Purple::StoredImage i - -Purple::StoredImage -purple_imgstore_ref(id) - Purple::StoredImage id - -Purple::StoredImage -purple_imgstore_unref(id) - Purple::StoredImage id - -void -purple_imgstore_ref_by_id(id) - int id - -void -purple_imgstore_unref_by_id(id) - int id - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Log.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Log.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Log.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Log.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -#include "module.h" - -MODULE = Purple::Log PACKAGE = Purple::Log PREFIX = purple_log_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Log::Type", 1); - HV *flags_stash = gv_stashpv("Purple::Log:ReadFlags::", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_LOG_##name} - const_iv(IM), - const_iv(CHAT), - const_iv(SYSTEM), - }; - static const constiv flags_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_LOG_READ_##name} - const_iv(NO_NEWLINE), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; ) - newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv)); -} - -int -purple_log_common_sizer(log) - Purple::Log log - -void -purple_log_common_writer(log, ext) - Purple::Log log - const char *ext - -gint -purple_log_compare(y, z) - gconstpointer y - gconstpointer z - -void -purple_log_free(log) - Purple::Log log - -gchar_own * -purple_log_get_log_dir(type, name, account) - Purple::LogType type - const char *name - Purple::Account account - -void -purple_log_get_log_sets() -PREINIT: - GHashTable *l; -PPCODE: - l = purple_log_get_log_sets(); - XPUSHs(sv_2mortal(purple_perl_bless_object(l, "GHashTable"))); - -void -purple_log_get_logs(type, name, account) - Purple::LogType type - const char *name - Purple::Account account -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_log_get_logs(type, name, account); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log"))); - } - /* We can free the list here but the script needs to free the - * Purple::Log 'objects' itself. */ - g_list_free(ll); - -int -purple_log_get_size(log) - Purple::Log log - -void -purple_log_get_system_logs(account) - Purple::Account account -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_log_get_system_logs(account); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log"))); - } - /* We can free the list here but the script needs to free the - * Purple::Log 'objects' itself. */ - g_list_free(ll); - -int -purple_log_get_total_size(type, name, account) - Purple::LogType type - const char *name - Purple::Account account - -void -purple_log_logger_free(logger) - Purple::Log::Logger logger - -void -purple_log_logger_get_options() -PREINIT: - GList *l, *ll; -PPCODE: - /* This might want to be massaged to a hash, since that's essentially - * what the key/value list is emulating. */ - for (l = ll = purple_log_logger_get_options(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - g_list_free(ll); - -gchar_own * -purple_log_read(log, flags) - Purple::Log log - Purple::Log::ReadFlags flags - -gint -purple_log_set_compare(y, z) - gconstpointer y - gconstpointer z diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for Purple perl module. -# - -PIDGIN_TREE_TOP := ../../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -GCCWARNINGS += -Wno-comment -Wno-unused -Wno-nested-externs - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = Purple -AUTOSPLIT = lib/auto/Purple/autosplit.ix -EXTUTILS ?= C:/perl/lib/ExtUtils -PERL_PLUGIN_TOP := .. - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PERL_LIB_TOP)/CORE - -LIB_PATHS += -L$(PERL_LIB_TOP) \ - -L$(PERL_PLUGIN_TOP) \ - -L$(PURPLE_TOP) \ - -L$(GTK_TOP)/lib - -## -## SOURCES, OBJECTS -## -XS_FILES = Account.xs \ - AccountOpts.xs \ - BuddyIcon.xs \ - BuddyList.xs \ - Cipher.xs \ - Cmds.xs \ - Certificate.xs \ - Connection.xs \ - Conversation.xs \ - Core.xs \ - Debug.xs \ - FT.xs \ - Idle.xs \ - Purple.xs \ - ImgStore.xs \ - Log.xs \ - Network.xs \ - Notify.xs \ - Plugin.xs \ - PluginPref.xs \ - Pounce.xs \ - Prefs.xs \ - Privacy.xs \ - Proxy.xs \ - Prpl.xs \ - Request.xs \ - Roomlist.xs \ - SSLConn.xs \ - SavedStatuses.xs \ - Server.xs \ - Signal.xs \ - Smiley.xs \ - Sound.xs \ - Status.xs \ - Stringref.xs \ - Util.xs \ - Whiteboard.xs \ - XMLNode.xs - -#FALLBACKS = const-c.inc const-xs.inc -C_FILES = $(XS_FILES:%.xs=%.c) -OBJECTS = $(C_FILES:%.c=%.o) - -## -## LIBRARIES -## -LIBS = -lperl510 \ - -lperl \ - -lpurple \ - -lglib-2.0 - -include $(PIDGIN_COMMON_RULES) - -%.inc: - cp fallback/$@ ./ - -## -## TARGETS -## -.PHONY: all install clean - -all: $(TARGET).dll $(AUTOSPLIT) - -install: all - rm -rf $(PURPLE_INSTALL_PERL_DIR) - mkdir -p $(PURPLE_INSTALL_PERL_DIR) - cp -R lib/* $(PURPLE_INSTALL_PERL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PERL_DIR)/auto/Purple - -$(C_FILES): $(PURPLE_CONFIG_H) - -$(AUTOSPLIT): - mkdir -p ./lib/auto - cp Purple.pm ./lib - $(PERL) -MAutoSplit -e 'autosplit("lib/Purple.pm")' - -$(TARGET).dll: $(PURPLE_DLL).a $(PURPLE_PERL_DLL).a $(FALLBACKS) $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) -o $(TARGET).dll - -## -## CLEAN -## -clean: - rm -rf $(TARGET).dll $(FALLBACKS) lib - rm -f *.o $(C_FILES) - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.PL.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.PL.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.PL.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Makefile.PL.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -use 5.006; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence the contents -# of the Makefile that is written. -WriteMakefile( - 'NAME' => 'Purple', - 'VERSION_FROM' => '@srcdir@/Purple.pm', # finds $VERSION - 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => '@srcdir@/Purple.pm', # finds $ABSTRACT - AUTHOR => 'Purple ') : ()), - 'DEFINE' => '@DEBUG_CFLAGS@', - 'INC' => '-I. -I@srcdir@ -I@top_srcdir@ -I@top_srcdir@/libpurple @GLIB_CFLAGS@', - 'OBJECT' => '$(O_FILES)', # link all the C files too -# 'OPTIMIZE' => '-g', # For debugging - 'INSTALLDIRS' => 'vendor', - 'INSTALL_BASE' => '$(prefix)', - 'INSTALLVENDORARCH' => '$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/perl', - 'INSTALLVENDORMAN3DIR' => '$(mandir)/man3', - 'macro' => { - 'prefix' => '@prefix@', - 'exec_prefix' => '@exec_prefix@', - 'libdir' => '@libdir@', - 'mandir' => '@mandir@', - 'datarootdir' => '@datarootdir@', - 'PURPLE_MAJOR_VERSION' => '@PURPLE_MAJOR_VERSION@', - }, -); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/module.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/module.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/module.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/module.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ -/* Allow the Perl code to see deprecated functions, so we can continue to - * export them to Perl plugins. */ -#undef PURPLE_DISABLE_DEPRECATED - -typedef struct group *Purple__Group; - -#define group perl_group - -#include -#ifdef _WIN32 -#undef pipe -#endif -#include -#include -#include - -#undef group - -#include "../perl-common.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "buddyicon.h" -#include "certificate.h" -#include "cipher.h" -#include "cmds.h" -#include "connection.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "desktopitem.h" -#include "eventloop.h" -#include "ft.h" -#ifdef PURPLE_GTKPERL -#include "gtkaccount.h" -#include "gtkblist.h" -#include "gtkconn.h" -#include "gtkconv.h" -#include "gtkutils.h" -#endif -#include "idle.h" -#include "imgstore.h" -#include "network.h" -#include "notify.h" -#include "plugin.h" -#include "pluginpref.h" -#include "pounce.h" -#include "prefs.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "roomlist.h" -#include "savedstatuses.h" -#include "server.h" -#include "signals.h" -#include "smiley.h" -#include "sound.h" -#include "sslconn.h" -#include "status.h" -#include "stringref.h" -/* Ewww. perl has it's own util.h which is in the include path :( */ -#include "libpurple/util.h" -#include "value.h" -#include "whiteboard.h" -#include "xmlnode.h" - -/* account.h */ -typedef PurpleAccount * Purple__Account; -typedef PurpleAccountOption * Purple__Account__Option; -typedef PurpleAccountUserSplit * Purple__Account__UserSplit; - -/* blist.h */ -typedef PurpleBlistNode * Purple__BuddyList__Node; -typedef PurpleBlistNodeFlags Purple__BuddyList__NodeFlags; -typedef PurpleBlistNodeType Purple__BuddyList__NodeType; -typedef PurpleBuddyList * Purple__BuddyList; -typedef PurpleBuddy * Purple__BuddyList__Buddy; -typedef PurpleChat * Purple__BuddyList__Chat; -typedef PurpleContact * Purple__BuddyList__Contact; -typedef PurpleGroup * Purple__BuddyList__Group; - -/* buddyicon.h */ -typedef PurpleBuddyIcon * Purple__Buddy__Icon; - -/* certificate.h */ -typedef PurpleCertificate * Purple__Certificate; -typedef PurpleCertificatePool * Purple__Certificate__Pool; -typedef PurpleCertificateScheme * Purple__Certificate__Scheme; -typedef PurpleCertificateVerifier * Purple__Certificate__Verifier; -typedef PurpleCertificateVerificationRequest * Purple__Certificate__VerificationRequest; -typedef PurpleCertificateVerificationStatus Purple__Certificate__VerificationStatus; - -/* cipher.h */ -typedef PurpleCipher * Purple__Cipher; -typedef PurpleCipherCaps Purple__CipherCaps; -typedef PurpleCipherContext * Purple__Cipher__Context; -typedef PurpleCipherOps * Purple__Cipher__Ops; -typedef PurpleCipherBatchMode Purple__Cipher__BatchMode; - -/* cmds.h */ -typedef PurpleCmdFlag Purple__Cmd__Flag; -typedef PurpleCmdId Purple__Cmd__Id; -typedef PurpleCmdPriority Purple__Cmd__Priority; -typedef PurpleCmdRet Purple__Cmd__Ret; - -/* connection.h */ -typedef PurpleConnection * Purple__Connection; -typedef PurpleConnectionFlags Purple__ConnectionFlags; -typedef PurpleConnectionState Purple__ConnectionState; - -/* conversation.h */ -typedef PurpleConversationType Purple__ConversationType; -typedef PurpleConvUpdateType Purple__ConvUpdateType; -typedef PurpleTypingState Purple__TypingState; -typedef PurpleMessageFlags Purple__MessageFlags; -typedef PurpleConvChatBuddyFlags Purple__ConvChatBuddyFlags; -typedef PurpleConversation * Purple__Conversation; -typedef PurpleConvIm * Purple__Conversation__IM; -typedef PurpleConvChat * Purple__Conversation__Chat; -typedef PurpleConvChatBuddy * Purple__Conversation__ChatBuddy; - -/* core.h */ - -typedef PurpleCore * Purple__Core; - -/* debug.h */ -typedef PurpleDebugLevel Purple__DebugLevel; - -/* desktopitem.h */ -typedef PurpleDesktopItem * Purple__DesktopItem; -typedef PurpleDesktopItemType Purple__DesktopItemType; - -/* eventloop.h */ -typedef PurpleInputCondition * Purple__InputCondition; - -/* ft.h */ -typedef PurpleXfer * Purple__Xfer; -typedef PurpleXferType Purple__XferType; -typedef PurpleXferStatusType Purple__XferStatusType; - - -#ifdef PURPLE_GTKPERL -/* gtkblish.h */ -typedef PurpleGtkBuddyList * Purple__GTK__BuddyList; -typedef PurpleStatusIconSize Purple__StatusIconSize; - -/* gtkutils.h */ -typedef PurpleButtonOrientation Purple__ButtonOrientation; -typedef PurpleButtonStyle Purple__ButtonStyle; -#ifndef _WIN32 -typedef PurpleBrowserPlace Purple__BrowserPlace; -#endif /* _WIN32 */ - -/* gtkconv.h */ -typedef PurpleUnseenState Purple__UnseenState; -typedef PurpleGtkConversation * Purple__GTK__Conversation; -typedef GdkPixbuf * Purple__GDK__Pixbuf; -typedef GtkWidget * Purple__GTK__Widget; - -/* gtkutils.h */ -typedef GtkFileSelection * Purple__GTK__FileSelection; -typedef GtkSelectionData * Purple__GTK__SelectionData; -typedef GtkTextView * Purple__GTK__TextView; - -/* gtkconn.h */ -#endif - -/* imgstore.h */ -typedef PurpleStoredImage * Purple__StoredImage; - -/* log.h */ -typedef PurpleLog * Purple__Log; -typedef PurpleLogCommonLoggerData * Purple__LogCommonLoggerData; -typedef PurpleLogLogger * Purple__Log__Logger; -typedef PurpleLogReadFlags * Purple__Log__ReadFlags; -typedef PurpleLogSet * Purple__LogSet; -typedef PurpleLogType Purple__LogType; - -/* network.h */ -typedef PurpleNetworkListenData * Purple__NetworkListenData; -typedef PurpleNetworkListenCallback Purple__NetworkListenCallback; - -/* notify.h */ -typedef PurpleNotifyCloseCallback Purple__NotifyCloseCallback; -typedef PurpleNotifyMsgType Purple__NotifyMsgType; -typedef PurpleNotifySearchButtonType Purple__NotifySearchButtonType; -typedef PurpleNotifySearchResults * Purple__NotifySearchResults; -typedef PurpleNotifySearchColumn * Purple__NotifySearchColumn; -typedef PurpleNotifySearchButton * Purple__NotifySearchButton; -typedef PurpleNotifyType Purple__NotifyType; -typedef PurpleNotifyUserInfo * Purple__NotifyUserInfo; -typedef PurpleNotifyUserInfoEntry * Purple__NotifyUserInfoEntry; - -/* plugin.h */ -typedef PurplePlugin * Purple__Plugin; -typedef PurplePluginAction * Purple__Plugin__Action; -typedef PurplePluginInfo * Purple__PluginInfo; -typedef PurplePluginLoaderInfo * Purple__PluginLoaderInfo; -typedef PurplePluginType Purple__PluginType; -typedef PurplePluginUiInfo * Purple__PluginUiInfo; - -/* pluginpref.h */ -typedef PurplePluginPref * Purple__PluginPref; -typedef PurplePluginPrefFrame * Purple__PluginPref__Frame; -typedef PurplePluginPrefType Purple__PluginPrefType; -typedef PurpleStringFormatType Purple__String__Format__Type; - -/* pounce.h */ -typedef PurplePounce * Purple__Pounce; -typedef PurplePounceEvent Purple__PounceEvent; - -/* prefs.h */ -typedef PurplePrefType Purple__PrefType; - -/* privacy.h */ -typedef PurplePrivacyType Purple__PrivacyType; - -/* proxy.h */ -typedef PurpleProxyInfo * Purple__ProxyInfo; -typedef PurpleProxyType Purple__ProxyType; - -/* prpl.h */ -typedef PurpleBuddyIconSpec * Purple__Buddy__Icon__Spec; -typedef PurpleIconScaleRules Purple__IconScaleRules; -typedef PurplePluginProtocolInfo * Purple__PluginProtocolInfo; -typedef PurpleProtocolOptions Purple__ProtocolOptions; - -/* request.h */ -typedef PurpleRequestField * Purple__Request__Field; -typedef PurpleRequestFields * Purple__Request__Fields; -typedef PurpleRequestFieldGroup * Purple__Request__Field__Group; -typedef PurpleRequestFieldType Purple__RequestFieldType; -typedef PurpleRequestType Purple__RequestType; - -/* roomlist.h */ -typedef PurpleRoomlist * Purple__Roomlist; -typedef PurpleRoomlistField * Purple__Roomlist__Field; -typedef PurpleRoomlistFieldType Purple__RoomlistFieldType; -typedef PurpleRoomlistRoom * Purple__Roomlist__Room; -typedef PurpleRoomlistRoomType Purple__RoomlistRoomType; - -/* savedstatuses.h */ -typedef PurpleSavedStatus * Purple__SavedStatus; -typedef PurpleSavedStatusSub * Purple__SavedStatus__Sub; - -/* smiley.h */ -typedef PurpleSmiley * Purple__Smiley; - -/* sound.h */ -typedef PurpleSoundEventID Purple__SoundEventID; - -/* sslconn.h */ -typedef PurpleInputCondition * Purple__Input__Condition; -typedef PurpleSslConnection * Purple__Ssl__Connection; -typedef PurpleSslErrorType Purple__SslErrorType; -typedef PurpleSslOps * Purple__Ssl__Ops; - -/* status.h */ -typedef PurplePresence * Purple__Presence; -typedef PurplePresenceContext Purple__PresenceContext; -typedef PurpleStatus * Purple__Status; -typedef PurpleStatusAttr * Purple__StatusAttr; -typedef PurpleStatusPrimitive Purple__StatusPrimitive; -typedef PurpleStatusType * Purple__StatusType; - -/* stringref.h */ -typedef PurpleStringref * Purple__Stringref; - -/* util.h */ -typedef PurpleInfoFieldFormatCallback Purple__Util__InfoFieldFormatCallback; -typedef PurpleUtilFetchUrlData Purple__Util__FetchUrlData; -typedef PurpleMenuAction * Purple__Menu__Action; - -/* value.h */ -typedef PurpleValue * Purple__Value; - -/* whiteboard.h */ -typedef PurpleWhiteboard * Purple__Whiteboard; - -/* xmlnode.h */ -typedef xmlnode * Purple__XMLNode; -typedef XMLNodeType XMLNode__Type; - -/* other */ -typedef void * Purple__Handle; - -typedef gchar gchar_own; - -typedef struct _constiv { - const char *name; - IV iv; -} constiv; - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Network.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Network.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Network.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Network.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#include "module.h" - -MODULE = Purple::Network PACKAGE = Purple::Network PREFIX = purple_network_ -PROTOTYPES: ENABLE - -const char * -purple_network_get_local_system_ip(fd) - int fd - -const char * -purple_network_get_my_ip(fd) - int fd - -unsigned short -purple_network_get_port_from_fd(fd) - int fd - -const char * -purple_network_get_public_ip() - -const unsigned char * -purple_network_ip_atoi(ip) - const char *ip - -Purple::NetworkListenData -purple_network_listen(port, socket_type, cb, cb_data) - unsigned short port - int socket_type - Purple::NetworkListenCallback cb - gpointer cb_data - -Purple::NetworkListenData -purple_network_listen_range(start, end, socket_type, cb, cb_data) - unsigned short start - unsigned short end - int socket_type - Purple::NetworkListenCallback cb - gpointer cb_data - -void -purple_network_set_public_ip(ip) - const char *ip diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Notify.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Notify.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Notify.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Notify.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,174 +0,0 @@ -#include "module.h" - -MODULE = Purple::Notify PACKAGE = Purple::Notify PREFIX = purple_notify_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Notify::Type", 1); - HV *msg_type_stash = gv_stashpv("Purple::Notify::Msg", 1); - HV *user_info_stash = gv_stashpv("Purple::NotifyUserInfo::Type", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_##name} - const_iv(MESSAGE), - const_iv(EMAIL), - const_iv(EMAILS), - const_iv(FORMATTED), - const_iv(SEARCHRESULTS), - const_iv(USERINFO), - const_iv(URI), - }; - static const constiv msg_type_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_MSG_##name} - const_iv(ERROR), - const_iv(WARNING), - const_iv(INFO), - }; - static const constiv user_info_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_USER_INFO_ENTRY_##name} - const_iv(PAIR), - const_iv(SECTION_BREAK), - const_iv(SECTION_HEADER), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = msg_type_const_iv + sizeof(msg_type_const_iv) / sizeof(msg_type_const_iv[0]); civ-- > msg_type_const_iv; ) - newCONSTSUB(msg_type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = user_info_const_iv + sizeof(user_info_const_iv) / sizeof(user_info_const_iv[0]); civ-- > user_info_const_iv; ) - newCONSTSUB(user_info_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_notify_close(type, ui_handle) - Purple::NotifyType type - void * ui_handle - -void -purple_notify_close_with_handle(handle) - void * handle - -void * -purple_notify_email(handle, subject, from, to, url, cb, user_data) - void * handle - const char *subject - const char *from - const char *to - const char *url - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_emails(handle, count, detailed, subjects, froms, tos, urls, cb, user_data) - void * handle - size_t count - gboolean detailed - const char **subjects - const char **froms - const char **tos - const char **urls - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_formatted(handle, title, primary, secondary, text, cb, user_data) - void * handle - const char *title - const char *primary - const char *secondary - const char *text - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_userinfo(gc, who, user_info, cb, user_data) - Purple::Connection gc - const char *who - Purple::NotifyUserInfo user_info - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_message(handle, type, title, primary, secondary, cb, user_data) - void * handle - Purple::NotifyMsgType type - const char *title - const char *primary - const char *secondary - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_searchresults(gc, title, primary, secondary, results, cb, user_data) - Purple::Connection gc - const char *title - const char *primary - const char *secondary - Purple::NotifySearchResults results - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_uri(handle, uri) - void * handle - const char *uri - -MODULE = Purple::Notify PACKAGE = Purple::NotifyUserInfo PREFIX = purple_notify_user_info_ -PROTOTYPES: ENABLE - -Purple::NotifyUserInfo -purple_notify_user_info_new(class) - C_ARGS: /* void */ - -void -purple_notify_user_info_destroy(user_info) - Purple::NotifyUserInfo user_info - -void -purple_notify_user_info_get_entries(user_info) - Purple::NotifyUserInfo user_info -PREINIT: - GList *l; -PPCODE: - l = purple_notify_user_info_get_entries(user_info); - for (; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::NotifyUserInfoEntry"))); - } - -gchar_own * -purple_notify_user_info_get_text_with_newline(user_info, newline) - Purple::NotifyUserInfo user_info - const char *newline - -void purple_notify_user_info_add_pair(user_info, label, value) - Purple::NotifyUserInfo user_info - const char *label - const char *value - -void purple_notify_user_info_prepend_pair(user_info, label, value) - Purple::NotifyUserInfo user_info - const char *label - const char *value - -void purple_notify_user_info_add_section_break(user_info) - Purple::NotifyUserInfo user_info - -void purple_notify_user_info_add_section_header(user_info, label) - Purple::NotifyUserInfo user_info - const char *label - -void purple_notify_user_info_remove_last_item(user_info) - Purple::NotifyUserInfo user_info - -const gchar * -purple_notify_user_info_entry_get_label(user_info_entry) - Purple::NotifyUserInfoEntry user_info_entry - -const gchar * -purple_notify_user_info_entry_get_value(user_info_entry) - Purple::NotifyUserInfoEntry user_info_entry diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/PluginPref.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/PluginPref.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/PluginPref.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/PluginPref.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -#include "module.h" - -MODULE = Purple::PluginPref PACKAGE = Purple::PluginPref::Frame PREFIX = purple_plugin_pref_frame_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *string_format_stash = gv_stashpv("Purple::String::Format::Type", 1); - HV *plugin_pref_stash = gv_stashpv("Purple::PluginPref::Type", 1); - - static const constiv *civ, string_format_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_STRING_FORMAT_TYPE_##name} - const_iv(NONE), - const_iv(MULTILINE), - const_iv(HTML), - }; - static const constiv plugin_pref_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_PLUGIN_PREF_##name} - const_iv(NONE), - const_iv(CHOICE), - const_iv(INFO), - const_iv(STRING_FORMAT), - }; - - for (civ = string_format_const_iv + sizeof(string_format_const_iv) / sizeof(string_format_const_iv[0]); civ-- > string_format_const_iv; ) - newCONSTSUB(string_format_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = plugin_pref_const_iv + sizeof(plugin_pref_const_iv) / sizeof(plugin_pref_const_iv[0]); civ-- > plugin_pref_const_iv; ) - newCONSTSUB(plugin_pref_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_plugin_pref_frame_add(frame, pref) - Purple::PluginPref::Frame frame - Purple::PluginPref pref - -void -purple_plugin_pref_frame_destroy(frame) - Purple::PluginPref::Frame frame - -void -purple_plugin_pref_frame_get_prefs(frame) - Purple::PluginPref::Frame frame -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugin_pref_frame_get_prefs(frame); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::PluginPref"))); - } - -Purple::PluginPref::Frame -purple_plugin_pref_frame_new(class) - C_ARGS: /* void */ - -MODULE = Purple::PluginPref PACKAGE = Purple::PluginPref PREFIX = purple_plugin_pref_ -PROTOTYPES: ENABLE - -void -purple_plugin_pref_add_choice(pref, label, choice) - Purple::PluginPref pref - const char *label -# Do the appropriate conversion based on the perl type specified. -# Currently only Strings and Ints will work. - gpointer choice = (SvPOKp($arg) ? SvPVutf8_nolen($arg) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL)); - -void -purple_plugin_pref_destroy(pref) - Purple::PluginPref pref - - -void -purple_plugin_pref_get_bounds(pref, OUTLIST int min, OUTLIST int max) - Purple::PluginPref pref - # According to the perlxs manual page we shouldn't need to specify a - # prototype here because "[p]arameters preceded by OUTLIST keyword do - # not appear in the usage signature of the generated Perl function." - # however that appears to only work for the usage error message and - # not for the call to newXSproto. Since I can't find any documentation - # for newXSproto at the moment I have no idea if that matters so - # override the prototype here. - PROTOTYPE: $ - -void -purple_plugin_pref_get_choices(pref) - Purple::PluginPref pref -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugin_pref_get_choices(pref); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListItem"))); - } - -const char * -purple_plugin_pref_get_label(pref) - Purple::PluginPref pref - -gboolean -purple_plugin_pref_get_masked(pref) - Purple::PluginPref pref - -Purple::String::Format::Type -purple_plugin_pref_get_format_type(pref) - Purple::PluginPref pref - -unsigned int -purple_plugin_pref_get_max_length(pref) - Purple::PluginPref pref - -const char * -purple_plugin_pref_get_name(pref) - Purple::PluginPref pref - -Purple::PluginPrefType -purple_plugin_pref_get_type(pref) - Purple::PluginPref pref - -Purple::PluginPref -purple_plugin_pref_new(class) - C_ARGS: /* void */ - -Purple::PluginPref -purple_plugin_pref_new_with_label(class, label) - const char *label - C_ARGS: - label - -Purple::PluginPref -purple_plugin_pref_new_with_name(class, name) - const char *name - C_ARGS: - name - -Purple::PluginPref -purple_plugin_pref_new_with_name_and_label(class, name, label) - const char *name - const char *label - C_ARGS: - name, label - -void -purple_plugin_pref_set_bounds(pref, min, max) - Purple::PluginPref pref - int min - int max - -void -purple_plugin_pref_set_label(pref, label) - Purple::PluginPref pref - const char *label - -void -purple_plugin_pref_set_masked(pref, mask) - Purple::PluginPref pref - gboolean mask - -void -purple_plugin_pref_set_format_type(pref, format) - Purple::PluginPref pref - Purple::String::Format::Type format - -void -purple_plugin_pref_set_max_length(pref, max_length) - Purple::PluginPref pref - unsigned int max_length - -void -purple_plugin_pref_set_name(pref, name) - Purple::PluginPref pref - const char *name - -void -purple_plugin_pref_set_type(pref, type) - Purple::PluginPref pref - Purple::PluginPrefType type -PREINIT: - PurplePluginPrefType gpp_type; -CODE: - gpp_type = PURPLE_PLUGIN_PREF_NONE; - - if (type == 1) { - gpp_type = PURPLE_PLUGIN_PREF_CHOICE; - } else if (type == 2) { - gpp_type = PURPLE_PLUGIN_PREF_INFO; - } else if (type == 3) { - gpp_type = PURPLE_PLUGIN_PREF_STRING_FORMAT; - } - purple_plugin_pref_set_type(pref, gpp_type); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Plugin.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Plugin.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Plugin.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Plugin.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -#include "module.h" - -MODULE = Purple::Plugin PACKAGE = Purple::Plugin PREFIX = purple_plugin_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Plugin::Type", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PLUGIN_##name} - const_iv(UNKNOWN), - const_iv(STANDARD), - const_iv(LOADER), - const_iv(PROTOCOL), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Plugin -purple_plugin_new(native, path) - gboolean native - const char *path - -Purple::Plugin -purple_plugin_probe(filename) - const char *filename - -gboolean -purple_plugin_register(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_load(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_unload(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_reload(plugin) - Purple::Plugin plugin - -void -purple_plugin_destroy(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_is_loaded(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_is_unloadable(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_id(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_name(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_version(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_summary(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_description(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_author(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_homepage(plugin) - Purple::Plugin plugin - -MODULE = Purple::Plugin PACKAGE = Purple::Plugin::IPC PREFIX = purple_plugin_ipc_ - -void -purple_plugin_ipc_unregister(plugin, command) - Purple::Plugin plugin - const char *command - -void -purple_plugin_ipc_unregister_all(plugin) - Purple::Plugin plugin - -MODULE = Purple::Plugin PACKAGE = Purple::Plugins PREFIX = purple_plugins_ -PROTOTYPES: ENABLE - -void -purple_plugins_add_search_path(path) - const char *path - -void -purple_plugins_unload_all() - -void -purple_plugins_destroy_all() - -void -purple_plugins_load_saved(key) - const char *key - -void -purple_plugins_probe(ext) - const char *ext - -gboolean -purple_plugins_enabled() - -Purple::Plugin -purple_plugins_find_with_name(name) - const char *name - -Purple::Plugin -purple_plugins_find_with_filename(filename) - const char *filename - -Purple::Plugin -purple_plugins_find_with_basename(basename) - const char *basename - -Purple::Plugin -purple_plugins_find_with_id(id) - const char *id - -void -purple_plugins_get_loaded() -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugins_get_loaded(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Plugin"))); - } - -void -purple_plugins_get_protocols() -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Plugin"))); - } - -void -purple_plugins_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugins_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Plugin"))); - } - -Purple::Handle -purple_plugins_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Pounce.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Pounce.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Pounce.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Pounce.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -#include "module.h" - -MODULE = Purple::Pounce PACKAGE = Purple::Pounce PREFIX = purple_pounce_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *event_stash = gv_stashpv("Purple::Pounce::Event", 1); - HV *option_stash = gv_stashpv("Purple::Pounce::Option", 1); - - static const constiv *civ, event_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_POUNCE_##name} - const_iv(NONE), - const_iv(SIGNON), - const_iv(SIGNOFF), - const_iv(AWAY), - const_iv(AWAY_RETURN), - const_iv(IDLE), - const_iv(IDLE_RETURN), - const_iv(TYPING), - const_iv(TYPED), - const_iv(TYPING_STOPPED), - const_iv(MESSAGE_RECEIVED), - }; - static const constiv option_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_POUNCE_OPTION_##name} - const_iv(NONE), - const_iv(AWAY), - }; - - for (civ = event_const_iv + sizeof(event_const_iv) / sizeof(event_const_iv[0]); civ-- > event_const_iv; ) - newCONSTSUB(event_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = option_const_iv + sizeof(option_const_iv) / sizeof(option_const_iv[0]); civ-- > option_const_iv; ) - newCONSTSUB(option_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_pounce_action_register(pounce, name) - Purple::Pounce pounce - const char *name - -void -purple_pounce_destroy(pounce) - Purple::Pounce pounce - -void -purple_pounce_destroy_all_by_account(account) - Purple::Account account - -void * -purple_pounce_get_data(pounce) - Purple::Pounce pounce - -Purple::PounceEvent -purple_pounce_get_events(pounce) - Purple::Pounce pounce - -const char * -purple_pounce_get_pouncee(pounce) - Purple::Pounce pounce - -Purple::Account -purple_pounce_get_pouncer(pounce) - Purple::Pounce pounce - -gboolean -purple_pounce_get_save(pounce) - Purple::Pounce pounce - -void -purple_pounce_set_data(pounce, data) - Purple::Pounce pounce - void * data - -void -purple_pounce_set_events(pounce, events) - Purple::Pounce pounce - Purple::PounceEvent events - -void -purple_pounce_set_pouncee(pounce, pouncee) - Purple::Pounce pounce - const char *pouncee - -void -purple_pounce_set_pouncer(pounce, pouncer) - Purple::Pounce pounce - Purple::Account pouncer - -void -purple_pounce_set_save(pounce, save) - Purple::Pounce pounce - gboolean save - -MODULE = Purple::Pounce PACKAGE = Purple::Pounces PREFIX = purple_pounces_ -PROTOTYPES: ENABLE - -void -purple_pounces_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_pounces_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce"))); - } - -void -purple_pounces_get_all_for_ui(ui) - const char *ui -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_pounces_get_all_for_ui(ui); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce"))); - } - g_list_free(ll); - -Purple::Handle -purple_pounces_get_handle() - -gboolean -purple_pounces_load() - -void -purple_pounces_unregister_handler(ui) - const char *ui diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prefs.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prefs.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prefs.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prefs.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::Prefs PACKAGE = Purple::Prefs PREFIX = purple_prefs_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Pref::Type", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PREF_##name} - const_iv(NONE), - const_iv(BOOLEAN), - const_iv(INT), - const_iv(STRING), - const_iv(STRING_LIST), - const_iv(PATH), - const_iv(PATH_LIST), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_prefs_add_bool(name, value) - const char *name - gboolean value - -void -purple_prefs_add_int(name, value) - const char *name - int value - -void -purple_prefs_add_none(name) - const char *name - -void -purple_prefs_add_string(name, value) - const char *name - const char *value - -void -purple_prefs_add_string_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_add_string_list(name, t_GL); - g_list_free(t_GL); - -void -purple_prefs_add_path(name, value) - const char *name - const char *value - -void -purple_prefs_add_path_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_add_path_list(name, t_GL); - g_list_free(t_GL); - -void -purple_prefs_destroy() - -guint -purple_prefs_connect_callback(plugin, name, callback, data = 0); - Purple::Plugin plugin - const char *name - SV *callback - SV *data -CODE: - RETVAL = purple_perl_prefs_connect_callback(plugin, name, callback, data); -OUTPUT: - RETVAL - -void -purple_prefs_disconnect_by_handle(plugin) - Purple::Plugin plugin -CODE: - purple_perl_pref_cb_clear_for_plugin(plugin); - -void -purple_prefs_disconnect_callback(callback_id) - guint callback_id -CODE: - purple_perl_prefs_disconnect_callback(callback_id); - -gboolean -purple_prefs_exists(name) - const char *name - -const char * -purple_prefs_get_path(name) - const char *name - -void -purple_prefs_get_path_list(name) - const char *name -PREINIT: - GList *l; -PPCODE: - for (l = purple_prefs_get_path_list(name); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - -gboolean -purple_prefs_get_bool(name) - const char *name - -Purple::Handle -purple_prefs_get_handle() - -int -purple_prefs_get_int(name) - const char *name - -const char * -purple_prefs_get_string(name) - const char *name - -void -purple_prefs_get_string_list(name) - const char *name -PREINIT: - GList *l; -PPCODE: - for (l = purple_prefs_get_string_list(name); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - -Purple::PrefType -purple_prefs_get_type(name) - const char *name - -gboolean -purple_prefs_load() - -void -purple_prefs_remove(name) - const char *name - -void -purple_prefs_rename(oldname, newname) - const char *oldname - const char *newname - -void -purple_prefs_rename_boolean_toggle(oldname, newname) - const char *oldname - const char *newname - -void -purple_prefs_set_bool(name, value) - const char *name - gboolean value - -void -purple_prefs_set_generic(name, value) - const char *name - gpointer value - -void -purple_prefs_set_int(name, value) - const char *name - int value - -void -purple_prefs_set_string(name, value) - const char *name - const char *value - -void -purple_prefs_set_string_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_set_string_list(name, t_GL); - g_list_free(t_GL); - -void -purple_prefs_set_path(name, value) - const char *name - const char *value - -void -purple_prefs_set_path_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_set_path_list(name, t_GL); - g_list_free(t_GL); - - -void -purple_prefs_trigger_callback(name) - const char *name - -void -purple_prefs_get_children_names(name) - const char *name -PREINIT: - GList *l; -PPCODE: - for (l = purple_prefs_get_children_names(name); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - -void -purple_prefs_update_old() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Privacy.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Privacy.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Privacy.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Privacy.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -#include "module.h" - -MODULE = Purple::Privacy PACKAGE = Purple::Privacy PREFIX = purple_privacy_ -PROTOTYPES: ENABLE - -gboolean -purple_privacy_permit_add(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_permit_remove(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_deny_add(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_deny_remove(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_check(account, who) - Purple::Account account - const char * who diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Proxy.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Proxy.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Proxy.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Proxy.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -#include "module.h" - -MODULE = Purple::Proxy PACKAGE = Purple::Proxy PREFIX = purple_proxy_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::ProxyType::", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PROXY_##name} - const_iv(USE_GLOBAL), - const_iv(NONE), - const_iv(HTTP), - const_iv(SOCKS4), - const_iv(SOCKS5), - const_iv(USE_ENVVAR), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Handle -purple_proxy_get_handle() - -MODULE = Purple::Proxy PACKAGE = Purple::ProxyInfo PREFIX = purple_proxy_info_ -PROTOTYPES: ENABLE - -void -purple_proxy_info_destroy(info) - Purple::ProxyInfo info - -const char * -purple_proxy_info_get_host(info) - Purple::ProxyInfo info - -const char * -purple_proxy_info_get_password(info) - Purple::ProxyInfo info - -int -purple_proxy_info_get_port(info) - Purple::ProxyInfo info - -Purple::ProxyType -purple_proxy_info_get_type(info) - Purple::ProxyInfo info - -const char * -purple_proxy_info_get_username(info) - Purple::ProxyInfo info - -Purple::ProxyInfo -purple_proxy_info_new() - -void -purple_proxy_info_set_host(info, host) - Purple::ProxyInfo info - const char *host - -void -purple_proxy_info_set_password(info, password) - Purple::ProxyInfo info - const char *password - -void -purple_proxy_info_set_port(info, port) - Purple::ProxyInfo info - int port - -void -purple_proxy_info_set_type(info, type) - Purple::ProxyInfo info - Purple::ProxyType type - -void -purple_proxy_info_set_username(info, username) - Purple::ProxyInfo info - const char *username - -MODULE = Purple::Proxy PACKAGE = Purple::Proxy PREFIX = purple_ -PROTOTYPES: ENABLE - -Purple::ProxyInfo -purple_global_proxy_get_info() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prpl.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prpl.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prpl.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Prpl.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -#include "module.h" - -MODULE = Purple::Prpl PACKAGE = Purple::Find PREFIX = purple_find_ -PROTOTYPES: ENABLE - -Purple::Plugin -purple_find_prpl(id) - const char *id - -MODULE = Purple::Prpl PACKAGE = Purple::Prpl PREFIX = purple_prpl_ -PROTOTYPES: ENABLE - -void -purple_prpl_change_account_status(account, old_status, new_status) - Purple::Account account - Purple::Status old_status - Purple::Status new_status - -void -purple_prpl_get_statuses(account, presence) - Purple::Account account - Purple::Presence presence -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_prpl_get_statuses(account,presence); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status"))); - } - /* We can free the list here but the script needs to free the - * Purple::Status 'objects' itself. */ - g_list_free(ll); - -void -purple_prpl_got_account_idle(account, idle, idle_time) - Purple::Account account - gboolean idle - time_t idle_time - -void -purple_prpl_got_account_login_time(account, login_time) - Purple::Account account - time_t login_time - -void -purple_prpl_got_user_idle(account, name, idle, idle_time) - Purple::Account account - const char *name - gboolean idle - time_t idle_time - -void -purple_prpl_got_user_login_time(account, name, login_time) - Purple::Account account - const char *name - time_t login_time - -int -purple_prpl_send_raw(gc, str) - Purple::Connection gc - const char *str -PREINIT: - PurplePluginProtocolInfo *prpl_info; -CODE: - if (!gc) - RETVAL = 0; - else { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (prpl_info && prpl_info->send_raw != NULL) { - RETVAL = prpl_info->send_raw(gc, str, strlen(str)); - } else { - RETVAL = 0; - } - } -OUTPUT: - RETVAL - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.pm qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.pm --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.pm 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.pm 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -package Purple; - -use 5.008; -use strict; -use warnings; -use Carp; - -require Exporter; -use AutoLoader; - -our @ISA = qw(Exporter); - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. - -# This allows declaration use Purple ':all'; -# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK -# will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw( - -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - -); - -our $VERSION = '0.01'; - -sub AUTOLOAD { - # This AUTOLOAD is used to 'autoload' constants from the constant() - # XS function. - - my $constname; - our $AUTOLOAD; - ($constname = $AUTOLOAD) =~ s/.*:://; - croak "&Purple::constant not defined" if $constname eq 'constant'; - my ($error, $val) = constant($constname); - if ($error) { croak $error; } - { - no strict 'refs'; - - *$AUTOLOAD = sub { $val }; - } - - goto &$AUTOLOAD; -} - -require XSLoader; -XSLoader::load('Purple', $VERSION); - -# Preloaded methods go here. - -1; -__END__ - -=head1 NAME - -Purple - Perl extension to the libpurple instant messenger library. - -=head1 SYNOPSIS - - use Purple; - -=head1 ABSTRACT - - This module provides the interface for using perl scripts as plugins - in libpurple. - -=head1 DESCRIPTION - -This module provides the interface for using perl scripts as plugins -in Purple. With this, developers can write perl scripts that can be -loaded in Purple as plugins. The scripts can interact with IMs, chats, -accounts, the buddy list, libpurple signals, and more. - -The API for the perl interface is very similar to that of the Purple C -API, which can be viewed at http://developer.pidgin.im/doxygen/ or in -the header files in the Purple source tree. - -=head1 FUNCTIONS - -=over - -=item @accounts = Purple::accounts - -Returns a list of all accounts, online or offline. - -=item @chats = Purple::chats - -Returns a list of all chats currently open. - -=item @connections = Purple::connections - -Returns a list of all active connections. - -=item @conversations = Purple::conversations - -Returns a list of all conversations, both IM and chat, currently open. - -=item @conv_windows = Purple::conv_windows - -Returns a list of all conversation windows currently open. - -=item @ims = Purple::ims - -Returns a list of all instant messages currently open. - -=back - -=head1 SEE ALSO - -Purple C API documentation - http://developer.pidgin.im/doxygen/ - -Purple website - http://pidgin.im/ - -=head1 AUTHOR - -Christian Hammond, Echipx86@gnupdate.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright 2003 by Christian Hammond - -This library is free software; you can redistribute it and/or modify -it under the terms of the General Public License (GPL). For -more information, see http://www.fsf.org/licenses/gpl.txt - -=cut diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Purple.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -/* Prototypes for the BOOT section below. */ -PURPLE_PERL_BOOT_PROTO(Account); -PURPLE_PERL_BOOT_PROTO(Account__Option); -PURPLE_PERL_BOOT_PROTO(Buddy__Icon); -PURPLE_PERL_BOOT_PROTO(BuddyList); -PURPLE_PERL_BOOT_PROTO(Certificate); -PURPLE_PERL_BOOT_PROTO(Cipher); -PURPLE_PERL_BOOT_PROTO(Cmd); -PURPLE_PERL_BOOT_PROTO(Connection); -PURPLE_PERL_BOOT_PROTO(Conversation); -PURPLE_PERL_BOOT_PROTO(Core); -PURPLE_PERL_BOOT_PROTO(Debug); -PURPLE_PERL_BOOT_PROTO(Xfer); -PURPLE_PERL_BOOT_PROTO(Idle); -PURPLE_PERL_BOOT_PROTO(ImgStore); -PURPLE_PERL_BOOT_PROTO(Log); -PURPLE_PERL_BOOT_PROTO(Network); -PURPLE_PERL_BOOT_PROTO(Notify); -PURPLE_PERL_BOOT_PROTO(Plugin); -PURPLE_PERL_BOOT_PROTO(PluginPref); -PURPLE_PERL_BOOT_PROTO(Pounce); -PURPLE_PERL_BOOT_PROTO(Prefs); -PURPLE_PERL_BOOT_PROTO(Privacy); -PURPLE_PERL_BOOT_PROTO(Proxy); -PURPLE_PERL_BOOT_PROTO(Prpl); -PURPLE_PERL_BOOT_PROTO(Request); -PURPLE_PERL_BOOT_PROTO(Roomlist); -PURPLE_PERL_BOOT_PROTO(SSL); -PURPLE_PERL_BOOT_PROTO(SavedStatus); -PURPLE_PERL_BOOT_PROTO(Serv); -PURPLE_PERL_BOOT_PROTO(Signal); -PURPLE_PERL_BOOT_PROTO(Smiley); -PURPLE_PERL_BOOT_PROTO(Sound); -PURPLE_PERL_BOOT_PROTO(Status); -PURPLE_PERL_BOOT_PROTO(Stringref); -PURPLE_PERL_BOOT_PROTO(Util); -PURPLE_PERL_BOOT_PROTO(Whiteboard); -PURPLE_PERL_BOOT_PROTO(XMLNode); - -MODULE = Purple PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -BOOT: - PURPLE_PERL_BOOT(Account); - PURPLE_PERL_BOOT(Account__Option); - PURPLE_PERL_BOOT(Buddy__Icon); - PURPLE_PERL_BOOT(BuddyList); - PURPLE_PERL_BOOT(Certificate); - PURPLE_PERL_BOOT(Cipher); - PURPLE_PERL_BOOT(Cmd); - PURPLE_PERL_BOOT(Connection); - PURPLE_PERL_BOOT(Conversation); - PURPLE_PERL_BOOT(Core); - PURPLE_PERL_BOOT(Debug); - PURPLE_PERL_BOOT(Xfer); - PURPLE_PERL_BOOT(Idle); - PURPLE_PERL_BOOT(ImgStore); - PURPLE_PERL_BOOT(Log); - PURPLE_PERL_BOOT(Network); - PURPLE_PERL_BOOT(Notify); - PURPLE_PERL_BOOT(Plugin); - PURPLE_PERL_BOOT(PluginPref); - PURPLE_PERL_BOOT(Pounce); - PURPLE_PERL_BOOT(Prefs); - PURPLE_PERL_BOOT(Privacy); - PURPLE_PERL_BOOT(Proxy); - PURPLE_PERL_BOOT(Prpl); - PURPLE_PERL_BOOT(Request); - PURPLE_PERL_BOOT(Roomlist); - PURPLE_PERL_BOOT(SSL); - PURPLE_PERL_BOOT(SavedStatus); - PURPLE_PERL_BOOT(Serv); - PURPLE_PERL_BOOT(Signal); - PURPLE_PERL_BOOT(Smiley); - PURPLE_PERL_BOOT(Sound); - PURPLE_PERL_BOOT(Status); - PURPLE_PERL_BOOT(Stringref); - PURPLE_PERL_BOOT(Util); - PURPLE_PERL_BOOT(Whiteboard); - PURPLE_PERL_BOOT(XMLNode); - -guint -timeout_add(plugin, seconds, callback, data = 0) - Purple::Plugin plugin - int seconds - SV *callback - SV *data -CODE: - RETVAL = purple_perl_timeout_add(plugin, seconds, callback, data); -OUTPUT: - RETVAL - -gboolean -timeout_remove(handle) - guint handle -CODE: - RETVAL = purple_perl_timeout_remove(handle); -OUTPUT: - RETVAL - -void -deinit() -CODE: - purple_perl_timeout_clear(); - - -MODULE = Purple PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -Purple::Core -purple_get_core() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Request.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Request.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Request.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Request.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,647 +0,0 @@ -#include "module.h" - -/* This breaks on faceprint's amd64 box -void * -purple_request_action_varg(handle, title, primary, secondary, default_action, user_data, action_count, actions) - void * handle - const char *title - const char *primary - const char *secondary - unsigned int default_action - void *user_data - size_t action_count - va_list actions - */ - - -typedef struct { - SV *ok_fun; - SV *cancel_fun; -} PurplePerlRequestData; - -static void -purple_perl_request_data_free(PurplePerlRequestData *ppr) -{ - if (ppr->ok_fun) - SvREFCNT_dec(ppr->ok_fun); - if (ppr->cancel_fun) - SvREFCNT_dec(ppr->cancel_fun); - g_free(ppr); -} - -/********************************************************/ -/* */ -/* Callback function that calls a perl subroutine */ -/* */ -/* The void * field data is being used as a way to hide */ -/* the perl sub's name in a PurplePerlRequestData */ -/* */ -/********************************************************/ -static void -purple_perl_request_ok_cb(void * data, PurpleRequestFields *fields) -{ - PurplePerlRequestData *gpr = (PurplePerlRequestData *)data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - XPUSHs(sv_2mortal(purple_perl_bless_object(fields, "Purple::Request::Fields"))); - PUTBACK; - call_sv(gpr->ok_fun, G_EVAL | G_SCALAR); - SPAGAIN; - - PUTBACK; - FREETMPS; - LEAVE; - - purple_perl_request_data_free(gpr); -} - -static void -purple_perl_request_cancel_cb(void * data, PurpleRequestFields *fields) -{ - PurplePerlRequestData *gpr = (PurplePerlRequestData *)data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - XPUSHs(sv_2mortal(purple_perl_bless_object(fields, "Purple::Request::Fields"))); - PUTBACK; - call_sv(gpr->cancel_fun, G_EVAL | G_SCALAR); - SPAGAIN; - - PUTBACK; - FREETMPS; - LEAVE; - - purple_perl_request_data_free(gpr); -} - -MODULE = Purple::Request PACKAGE = Purple::Request PREFIX = purple_request_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *request_stash = gv_stashpv("Purple::RequestType", 1); - HV *request_field_stash = gv_stashpv("Purple::RequestFieldType", 1); - - static const constiv *civ, request_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_REQUEST_##name} - const_iv(INPUT), - const_iv(CHOICE), - const_iv(ACTION), - const_iv(FIELDS), - const_iv(FILE), - const_iv(FOLDER), - }; - static const constiv request_field_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_REQUEST_FIELD_##name} - const_iv(NONE), - const_iv(STRING), - const_iv(INTEGER), - const_iv(BOOLEAN), - const_iv(CHOICE), - const_iv(LIST), - const_iv(LABEL), - const_iv(IMAGE), - const_iv(ACCOUNT), - }; - - for (civ = request_const_iv + sizeof(request_const_iv) / sizeof(request_const_iv[0]); civ-- > request_const_iv; ) - newCONSTSUB(request_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = request_field_const_iv + sizeof(request_field_const_iv) / sizeof(request_field_const_iv[0]); civ-- > request_field_const_iv; ) - newCONSTSUB(request_field_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void * -purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb) - Purple::Plugin handle - const char * title - const char * primary - const char * secondary - const char * default_value - gboolean multiline - gboolean masked - gchar * hint - const char * ok_text - SV * ok_cb - const char * cancel_text - SV * cancel_cb -CODE: - PurplePerlRequestData *gpr; - char *basename; - - basename = g_path_get_basename(handle->path); - purple_perl_normalize_script_name(basename); - gpr = g_new(PurplePerlRequestData, 1); - gpr->ok_fun = purple_perl_sv_from_fun(handle, ok_cb); - gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb); - g_free(basename); - - RETVAL = purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr); -OUTPUT: - RETVAL - -void * -purple_request_file(handle, title, filename, savedialog, ok_cb, cancel_cb) - Purple::Plugin handle - const char * title - const char * filename - gboolean savedialog - SV * ok_cb - SV * cancel_cb -CODE: - PurplePerlRequestData *gpr; - char *basename; - - basename = g_path_get_basename(handle->path); - purple_perl_normalize_script_name(basename); - gpr = g_new(PurplePerlRequestData, 1); - gpr->ok_fun = purple_perl_sv_from_fun(handle, ok_cb); - gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb); - g_free(basename); - - RETVAL = purple_request_file(handle, title, filename, savedialog, G_CALLBACK(purple_perl_request_ok_cb), G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr); -OUTPUT: - RETVAL - -void * -purple_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb) - Purple::Plugin handle - const char * title - const char * primary - const char * secondary - Purple::Request::Fields fields - const char * ok_text - SV * ok_cb - const char * cancel_text - SV * cancel_cb -CODE: - PurplePerlRequestData *gpr; - char *basename; - - basename = g_path_get_basename(handle->path); - purple_perl_normalize_script_name(basename); - gpr = g_new(PurplePerlRequestData, 1); - gpr->ok_fun = purple_perl_sv_from_fun(handle, ok_cb); - gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb); - g_free(basename); - - RETVAL = purple_request_fields(handle, title, primary, secondary, fields, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr); -OUTPUT: - RETVAL - -void -purple_request_close(type, uihandle) - Purple::RequestType type - void * uihandle - -void -purple_request_close_with_handle(handle) - void * handle - - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_account_new(class, id, text, account = NULL) - const char *id - const char *text - Purple::Account account - C_ARGS: id, text, account - -Purple::Account -purple_request_field_account_get_default_value(field) - Purple::Request::Field field - -IV -purple_request_field_account_get_filter(field) - Purple::Request::Field field -CODE: - RETVAL = PTR2IV(purple_request_field_account_get_filter(field)); -OUTPUT: - RETVAL - -gboolean -purple_request_field_account_get_show_all(field) - Purple::Request::Field field - -Purple::Account -purple_request_field_account_get_value(field) - Purple::Request::Field field - -void -purple_request_field_account_set_default_value(field, default_value) - Purple::Request::Field field - Purple::Account default_value - -void -purple_request_field_account_set_show_all(field, show_all) - Purple::Request::Field field - gboolean show_all - -void -purple_request_field_account_set_value(field, value) - Purple::Request::Field field - Purple::Account value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_bool_new(class, id, text, default_value = TRUE) - const char *id - const char *text - gboolean default_value - C_ARGS: id, text, default_value - -gboolean -purple_request_field_bool_get_default_value(field) - Purple::Request::Field field - -gboolean -purple_request_field_bool_get_value(field) - Purple::Request::Field field - -void -purple_request_field_bool_set_default_value(field, default_value) - Purple::Request::Field field - gboolean default_value - -void -purple_request_field_bool_set_value(field, value) - Purple::Request::Field field - gboolean value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_choice_new(class, id, text, default_value = 0) - const char *id - const char *text - int default_value - C_ARGS: id, text, default_value - -void -purple_request_field_choice_add(field, label) - Purple::Request::Field field - const char *label - -int -purple_request_field_choice_get_default_value(field) - Purple::Request::Field field - -void -purple_request_field_choice_get_labels(field) - Purple::Request::Field field -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_choice_get_labels(field); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - -int -purple_request_field_choice_get_value(field) - Purple::Request::Field field - -void -purple_request_field_choice_set_default_value(field, default_value) - Purple::Request::Field field - int default_value - -void -purple_request_field_choice_set_value(field, value) - Purple::Request::Field field - int value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_int_new(clas, id, text, default_value = 0) - const char *id - const char *text - int default_value - C_ARGS: id, text, default_value - -int -purple_request_field_int_get_default_value(field) - Purple::Request::Field field - -int -purple_request_field_int_get_value(field) - Purple::Request::Field field - -void -purple_request_field_int_set_default_value(field, default_value) - Purple::Request::Field field - int default_value - -void -purple_request_field_int_set_value(field, value) - Purple::Request::Field field - int value - -gboolean -purple_request_field_is_required(field) - Purple::Request::Field field - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_label_new(class, id, text) - const char *id - const char *text - C_ARGS: id, text - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_list_new(class, id, text) - const char *id - const char *text - C_ARGS: id, text - -void -purple_request_field_list_add(field, item, data) - Purple::Request::Field field - const char *item - void * data - -void -purple_request_field_list_add_selected(field, item) - Purple::Request::Field field - const char *item - -void -purple_request_field_list_clear_selected(field) - Purple::Request::Field field - -void * -purple_request_field_list_get_data(field, text) - Purple::Request::Field field - const char *text - -void -purple_request_field_list_get_items(field) - Purple::Request::Field field -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_list_get_items(field); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - -gboolean -purple_request_field_list_get_multi_select(field) - Purple::Request::Field field - -void -purple_request_field_list_get_selected(field) - Purple::Request::Field field -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_list_get_selected(field); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - -gboolean -purple_request_field_list_is_selected(field, item) - Purple::Request::Field field - const char *item - -void -purple_request_field_list_set_multi_select(field, multi_select) - Purple::Request::Field field - gboolean multi_select - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_new(class, id, text, type) - const char *id - const char *text - Purple::RequestFieldType type - C_ARGS: id, text, type - -void -purple_request_field_set_label(field, label) - Purple::Request::Field field - const char *label - -void -purple_request_field_set_required(field, required) - Purple::Request::Field field - gboolean required - -void -purple_request_field_set_type_hint(field, type_hint) - Purple::Request::Field field - const char *type_hint - -void -purple_request_field_set_visible(field, visible) - Purple::Request::Field field - gboolean visible - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_string_new(class, id, text, default_value, multiline) - const char *id - const char *text - const char *default_value - gboolean multiline - C_ARGS: id, text, default_value, multiline - -const char * -purple_request_field_string_get_default_value(field) - Purple::Request::Field field - -const char * -purple_request_field_string_get_value(field) - Purple::Request::Field field - -gboolean -purple_request_field_string_is_editable(field) - Purple::Request::Field field - -gboolean -purple_request_field_string_is_masked(field) - Purple::Request::Field field - -gboolean -purple_request_field_string_is_multiline(field) - Purple::Request::Field field - -void -purple_request_field_string_set_default_value(field, default_value) - Purple::Request::Field field - const char *default_value - -void -purple_request_field_string_set_editable(field, editable) - Purple::Request::Field field - gboolean editable - -void -purple_request_field_string_set_masked(field, masked) - Purple::Request::Field field - gboolean masked - -void -purple_request_field_string_set_value(field, value) - Purple::Request::Field field - const char *value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field::Group PREFIX = purple_request_field_group_ -PROTOTYPES: ENABLE - -void -purple_request_field_group_add_field(group, field) - Purple::Request::Field::Group group - Purple::Request::Field field - -void -purple_request_field_group_destroy(group) - Purple::Request::Field::Group group - -void -purple_request_field_group_get_fields(group) - Purple::Request::Field::Group group -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_group_get_fields(group); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Request::Field"))); - } - -const char * -purple_request_field_group_get_title(group) - Purple::Request::Field::Group group - -Purple::Request::Field::Group -purple_request_field_group_new(class, title) - const char *title - C_ARGS: title - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -void -purple_request_field_destroy(field) - Purple::Request::Field field - -const char * -purple_request_field_get_id(field) - Purple::Request::Field field - -const char * -purple_request_field_get_label(field) - Purple::Request::Field field - -Purple::RequestFieldType -purple_request_field_get_type(field) - Purple::Request::Field field - -const char * -purple_request_field_get_type_hint(field) - Purple::Request::Field field - -gboolean -purple_request_field_is_visible(field) - Purple::Request::Field field - -MODULE = Purple::Request PACKAGE = Purple::Request::Fields PREFIX = purple_request_fields_ -PROTOTYPES: ENABLE - -Purple::Request::Fields -purple_request_fields_new(class) - C_ARGS: /* void */ - -void -purple_request_fields_add_group(fields, group) - Purple::Request::Fields fields - Purple::Request::Field::Group group - -gboolean -purple_request_fields_all_required_filled(fields) - Purple::Request::Fields fields - -void -purple_request_fields_destroy(fields) - Purple::Request::Fields fields - -gboolean -purple_request_fields_exists(fields, id) - Purple::Request::Fields fields - const char *id - -Purple::Account -purple_request_fields_get_account(fields, id) - Purple::Request::Fields fields - const char *id - -gboolean -purple_request_fields_get_bool(fields, id) - Purple::Request::Fields fields - const char *id - -int -purple_request_fields_get_choice(fields, id) - Purple::Request::Fields fields - const char *id - -Purple::Request::Field -purple_request_fields_get_field(fields, id) - Purple::Request::Fields fields - const char *id - -void -purple_request_fields_get_groups(fields) - Purple::Request::Fields fields -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_fields_get_groups(fields); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Request::Field::Group"))); - } - -int -purple_request_fields_get_integer(fields, id) - Purple::Request::Fields fields - const char *id - -void -purple_request_fields_get_required(fields) - Purple::Request::Fields fields -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_fields_get_required(fields); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Request::Field"))); - } - -const char * -purple_request_fields_get_string(fields, id) - Purple::Request::Fields fields - const char *id - -gboolean -purple_request_fields_is_field_required(fields, id) - Purple::Request::Fields fields - const char *id diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Roomlist.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Roomlist.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Roomlist.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Roomlist.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -#include "module.h" - -MODULE = Purple::Roomlist PACKAGE = Purple::Roomlist PREFIX = purple_roomlist_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *room_stash = gv_stashpv("Purple::Roomlist::Room::Type", 1); - HV *field_stash = gv_stashpv("Purple::Roomlist::Field::Type", 1); - - static const constiv *civ, room_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_ROOMTYPE_##name} - const_iv(CATEGORY), - const_iv(ROOM), - }; - static const constiv field_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_FIELD_##name} - const_iv(BOOL), - const_iv(INT), - const_iv(STRING), - }; - - for (civ = room_const_iv + sizeof(room_const_iv) / sizeof(room_const_iv[0]); civ-- > room_const_iv; ) - newCONSTSUB(room_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = field_const_iv + sizeof(field_const_iv) / sizeof(field_const_iv[0]); civ-- > field_const_iv; ) - newCONSTSUB(field_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_roomlist_cancel_get_list(list) - Purple::Roomlist list - -void -purple_roomlist_expand_category(list, category) - Purple::Roomlist list - Purple::Roomlist::Room category - -gboolean -purple_roomlist_get_in_progress(list) - Purple::Roomlist list - -Purple::Roomlist -purple_roomlist_get_list(gc) - Purple::Connection gc - -Purple::Roomlist -purple_roomlist_new(account) - Purple::Account account - -void -purple_roomlist_ref(list) - Purple::Roomlist list - -void -purple_roomlist_room_add(list, room) - Purple::Roomlist list - Purple::Roomlist::Room room - -void -purple_roomlist_room_add_field(list, room, field) - Purple::Roomlist list - Purple::Roomlist::Room room - gconstpointer field - -void -purple_roomlist_room_join(list, room) - Purple::Roomlist list - Purple::Roomlist::Room room - -void -purple_roomlist_set_fields(list, fields) - Purple::Roomlist list - SV *fields -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(fields)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(fields), i, 0))); - - purple_roomlist_set_fields(list, t_GL); - -void -purple_roomlist_set_in_progress(list, in_progress) - Purple::Roomlist list - gboolean in_progress - -void -purple_roomlist_show_with_account(account) - Purple::Account account - -void -purple_roomlist_unref(list) - Purple::Roomlist list - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SavedStatuses.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SavedStatuses.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SavedStatuses.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SavedStatuses.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -#include "module.h" - -/* I can't get this to work, both with and without the const on the return - * type I get errors from gcc. One way about ignoring types in a cast, and the - * other about assigning to read-only variables. -const Purple::StatusType -purple_savedstatus_substatus_get_type(substatus) - const Purple::SavedStatus::Sub substatus -*/ - -MODULE = Purple::SavedStatus PACKAGE = Purple::SavedStatus PREFIX = purple_savedstatus_ -PROTOTYPES: ENABLE - -Purple::SavedStatus -purple_savedstatus_new(title, type) - const char *title - Purple::StatusPrimitive type - -void -purple_savedstatus_set_title(status, title) - Purple::SavedStatus status - const char *title - -void -purple_savedstatus_set_type(status, type) - Purple::SavedStatus status - Purple::StatusPrimitive type - -void -purple_savedstatus_set_message(status, message) - Purple::SavedStatus status - const char *message - -void -purple_savedstatus_set_substatus(status, account, type, message) - Purple::SavedStatus status - Purple::Account account - Purple::StatusType type - const char *message - -void -purple_savedstatus_unset_substatus(status, account) - Purple::SavedStatus status - Purple::Account account - -gboolean -purple_savedstatus_delete(title) - const char *title - -Purple::SavedStatus -purple_savedstatus_get_current() - -Purple::SavedStatus -purple_savedstatus_get_default() - -Purple::SavedStatus -purple_savedstatus_get_idleaway() - -gboolean -purple_savedstatus_is_idleaway() - -void -purple_savedstatus_set_idleaway(idleaway) - gboolean idleaway - -Purple::SavedStatus -purple_savedstatus_get_startup() - -Purple::SavedStatus -purple_savedstatus_find(title) - const char *title - -Purple::SavedStatus -purple_savedstatus_find_by_creation_time(creation_time) - time_t creation_time - -Purple::SavedStatus -purple_savedstatus_find_transient_by_type_and_message(type, message) - Purple::StatusPrimitive type - const char *message - -gboolean -purple_savedstatus_is_transient(saved_status) - const Purple::SavedStatus saved_status - -const char * -purple_savedstatus_get_title(saved_status) - const Purple::SavedStatus saved_status - -Purple::StatusPrimitive -purple_savedstatus_get_type(saved_status) - const Purple::SavedStatus saved_status - -const char * -purple_savedstatus_get_message(saved_status) - const Purple::SavedStatus saved_status - -time_t -purple_savedstatus_get_creation_time(saved_status) - const Purple::SavedStatus saved_status - -gboolean -purple_savedstatus_has_substatuses(saved_status) - const Purple::SavedStatus saved_status - -Purple::SavedStatus::Sub -purple_savedstatus_get_substatus(saved_status, account) - Purple::SavedStatus saved_status - Purple::Account account - -void -purple_savedstatus_activate(saved_status) - Purple::SavedStatus saved_status - -void -purple_savedstatus_activate_for_account(saved_status, account) - const Purple::SavedStatus saved_status - Purple::Account account - -MODULE = Purple::SavedStatus::Sub PACKAGE = Purple::SavedStatus::Sub PREFIX = purple_savedstatus_substatus_ -PROTOTYPES: ENABLE - -const char * -purple_savedstatus_substatus_get_message(substatus) - const Purple::SavedStatus::Sub substatus - -MODULE = Purple::SavedStatus PACKAGE = Purple::SavedStatuses PREFIX = purple_savedstatuses_ -PROTOTYPES: ENABLE - -void -purple_savedstatuses_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_savedstatuses_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus"))); - } - -void -purple_savedstatuses_get_popular(how_many) - unsigned int how_many -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_savedstatuses_get_popular(how_many); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus"))); - } - g_list_free(ll); - -Purple::Handle -purple_savedstatuses_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Server.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Server.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Server.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Server.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -#include "module.h" - -MODULE = Purple::Serv PACKAGE = Purple::Serv PREFIX = serv_ -PROTOTYPES: ENABLE - - -void -serv_add_deny(con, a) - Purple::Connection con - const char * a - -void -serv_add_permit(a, b) - Purple::Connection a - const char * b - -void -serv_alias_buddy(buddy) - Purple::BuddyList::Buddy buddy - -void -serv_chat_invite(con, a, b, c) - Purple::Connection con - int a - const char * b - const char * c - -void -serv_chat_leave(a, b) - Purple::Connection a - int b - -int -serv_chat_send(con, a, b, flags) - Purple::Connection con - int a - const char * b - Purple::MessageFlags flags - -void -serv_chat_whisper(con, a, b, c) - Purple::Connection con - int a - const char * b - const char * c - -void -serv_get_info(con, a) - Purple::Connection con - const char * a - -void -serv_got_alias(gc, who, alias) - Purple::Connection gc - const char *who - const char *alias - -void -serv_got_chat_in(g, id, who, chatflags, message, mtime) - Purple::Connection g - int id - const char *who - Purple::MessageFlags chatflags - const char *message - time_t mtime - -void -serv_got_chat_invite(gc, name, who, message, components) - Purple::Connection gc - const char *name - const char *who - const char *message - SV * components -INIT: - HV * t_HV; - HE * t_HE; - SV * t_SV; - GHashTable * t_GHash; - I32 len; - char *t_key, *t_value; -CODE: - t_HV = (HV *)SvRV(components); - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - serv_got_chat_invite(gc, name, who, message, t_GHash); - -void -serv_got_chat_left(g, id) - Purple::Connection g - int id - -void -serv_got_im(gc, who, msg, imflags, mtime) - Purple::Connection gc - const char *who - const char *msg - Purple::MessageFlags imflags - time_t mtime - -Purple::Conversation -serv_got_joined_chat(gc, id, name) - Purple::Connection gc - int id - const char *name - -void -serv_got_typing(gc, name, timeout, state) - Purple::Connection gc - const char *name - int timeout - Purple::TypingState state - -void -serv_got_typing_stopped(gc, name) - Purple::Connection gc - const char *name - -void -serv_join_chat(conn, components) - Purple::Connection conn - HV * components -PREINIT: - HE *t_HE; - SV *t_SV; - I32 len; - GHashTable *t_GHash; - char *t_key, *t_value; -CODE: - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(components); t_HE != NULL; - t_HE = hv_iternext(components)) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(components, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - serv_join_chat(conn, t_GHash); - -void -serv_move_buddy(buddy, group1, group2) - Purple::BuddyList::Buddy buddy - Purple::BuddyList::Group group1 - Purple::BuddyList::Group group2 - -void -serv_reject_chat(con, components) - Purple::Connection con - SV * components -INIT: - HV * t_HV; - HE * t_HE; - SV * t_SV; - GHashTable * t_GHash; - I32 len; - char *t_key, *t_value; -CODE: - t_HV = (HV *)SvRV(components); - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - serv_reject_chat(con, t_GHash); - -void -serv_rem_deny(con, a) - Purple::Connection con - const char * a - -void -serv_rem_permit(con, a) - Purple::Connection con - const char * a - -void -serv_send_file(gc, who, file) - Purple::Connection gc - const char *who - const char *file - -int -serv_send_im(con, a, b, flags ) - Purple::Connection con - const char * a - const char * b - Purple::MessageFlags flags - -int -serv_send_typing(con, a, state) - Purple::Connection con - const char * a - Purple::TypingState state - -void -serv_set_info(con, a) - Purple::Connection con - const char * a - -void -serv_set_permit_deny(con) - Purple::Connection con - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Signal.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Signal.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Signal.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Signal.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::Signal PACKAGE = Purple::Signal PREFIX = purple_signal_ -PROTOTYPES: ENABLE - -void -purple_signal_connect_priority(instance, signal, plugin, callback, priority, data = 0) - Purple::Handle instance - const char *signal - Purple::Plugin plugin - SV *callback - int priority - SV *data -CODE: - purple_perl_signal_connect(plugin, instance, signal, callback, data, priority); - -void -purple_signal_connect(instance, signal, plugin, callback, data = 0) - Purple::Handle instance - const char *signal - Purple::Plugin plugin - SV *callback - SV *data -CODE: - purple_perl_signal_connect(plugin, instance, signal, callback, data, PURPLE_SIGNAL_PRIORITY_DEFAULT); - -void -purple_signal_disconnect(instance, signal, plugin) - Purple::Handle instance - const char *signal - Purple::Plugin plugin -CODE: - purple_perl_signal_disconnect(plugin, instance, signal); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Smiley.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Smiley.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Smiley.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Smiley.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -#include "module.h" - -MODULE = Purple::Smiley PACKAGE = Purple::Smiley PREFIX = purple_smiley_ -PROTOTYPES: ENABLE - -Purple::Smiley -purple_smiley_new(img, shortcut) - Purple::StoredImage img - const char * shortcut - -Purple::Smiley -purple_smiley_new_from_file(shortcut, filepath) - const char * shortcut - const char * filepath - -void -purple_smiley_delete(smiley) - Purple::Smiley smiley - -gboolean -purple_smiley_set_shortcut(smiley, shortcut) - Purple::Smiley smiley - const char * shortcut - -void -purple_smiley_set_data(smiley, data, data_len) - Purple::Smiley smiley - guchar * data - size_t data_len - -const char * -purple_smiley_get_shortcut(smiley) - Purple::Smiley smiley - -const char * -purple_smiley_get_checksum(smiley) - Purple::Smiley smiley - -Purple::StoredImage -purple_smiley_get_stored_image(smiley) - Purple::Smiley smiley - -gconstpointer -purple_smiley_get_data(smiley, len) - Purple::Smiley smiley - size_t * len - -const char * -purple_smiley_get_extension(smiley) - Purple::Smiley smiley - - -gchar_own * -purple_smiley_get_full_path(smiley) - Purple::Smiley smiley - - -MODULE = Purple::Smiley PACKAGE = Purple::Smileys PREFIX = purple_smileys_ -PROTOTYPES: ENABLE - -void -purple_smileys_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_smileys_get_all(); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Smiley"))); - } - -Purple::Smiley -purple_smileys_find_by_shortcut(shortcut) - const char * shortcut - -Purple::Smiley -purple_smileys_find_by_checksum(checksum) - const char * checksum - -const char * -purple_smileys_get_storing_dir() - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Sound.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Sound.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Sound.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Sound.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#include "module.h" - -MODULE = Purple::Sound PACKAGE = Purple::Sound PREFIX = purple_sound_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::SoundEventID", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_SOUND_##name} - const_iv(BUDDY_ARRIVE), - const_iv(BUDDY_LEAVE), - const_iv(RECEIVE), - const_iv(FIRST_RECEIVE), - const_iv(SEND), - const_iv(CHAT_JOIN), - const_iv(CHAT_LEAVE), - const_iv(CHAT_YOU_SAY), - const_iv(CHAT_SAY), - const_iv(POUNCE_DEFAULT), - const_iv(CHAT_NICK), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_sound_play_event(event, account) - Purple::SoundEventID event - Purple::Account account - -void -purple_sound_play_file(filename, account) - const char *filename - Purple::Account account diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SSLConn.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SSLConn.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SSLConn.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/SSLConn.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -#include "module.h" - -/* TODO - - -Purple::Ssl::Connection -purple_ssl_connect(account, host, port, func, error_func, data) - Purple::Account account - const char *host - int port - PurpleSslInputFunction func - PurpleSslErrorFunction error_func - -void -purple_ssl_input_add(gsc, func, data) - Purple::Ssl::Connection gsc - Purple::SslInputFunction func - -Purple::Ssl::Connection -purple_ssl_connect_fd(account, fd, func, error_func, data) - Purple::Account account - int fd - PurpleSslInputFunction func - PurpleSslErrorFunction error_func - -*/ - -MODULE = Purple::SSL PACKAGE = Purple::SSL PREFIX = purple_ssl_ -PROTOTYPES: ENABLE - -void -purple_ssl_close(gsc) - Purple::Ssl::Connection gsc - -Purple::Ssl::Ops -purple_ssl_get_ops() - -gboolean -purple_ssl_is_supported() - -size_t -purple_ssl_read(gsc, buffer, len) - Purple::Ssl::Connection gsc - void * buffer - size_t len - -void -purple_ssl_set_ops(ops) - Purple::Ssl::Ops ops - -size_t -purple_ssl_write(gsc, buffer, len) - Purple::Ssl::Connection gsc - void * buffer - size_t len diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Status.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Status.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Status.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Status.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,447 +0,0 @@ -#include "module.h" - -/* TODO - -void -purple_status_type_add_attrs(status_type, id, name, value, purple_status_type_add_attrs) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - ... - -Purple::StatusType -purple_status_type_new_with_attrs(primitive, id, name, saveable, user_settable, independent, attr_id, attr_name, attr_value, purple_status_type_new_with_attrs) - Purple::StatusPrimitive primitive - const char *id - const char *name - gboolean saveable - gboolean user_settable - gboolean independent - const char *attr_id - const char *attr_name - Purple::Value attr_value - ... - -*/ - -/* These break on faceprint's amd64 box -void -purple_status_type_add_attrs_vargs(status_type, args) - Purple::StatusType status_type - va_list args - -void -purple_status_set_active_with_attrs(status, active, args) - Purple::Status status - gboolean active - va_list args - - */ - -MODULE = Purple::Status PACKAGE = Purple::Presence PREFIX = purple_presence_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *context_stash = gv_stashpv("Purple::Presence::Context", 1); - HV *primitive_stash = gv_stashpv("Purple::Status::Primitive", 1); - - static const constiv *civ, context_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PRESENCE_CONTEXT_##name} - const_iv(UNSET), - const_iv(ACCOUNT), - const_iv(CONV), - const_iv(BUDDY), - }; - static const constiv primitive_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_STATUS_##name} - const_iv(UNSET), - const_iv(OFFLINE), - const_iv(AVAILABLE), - const_iv(UNAVAILABLE), - const_iv(INVISIBLE), - const_iv(AWAY), - const_iv(EXTENDED_AWAY), - const_iv(MOBILE), - }; - - for (civ = context_const_iv + sizeof(context_const_iv) / sizeof(context_const_iv[0]); civ-- > context_const_iv; ) - newCONSTSUB(context_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = primitive_const_iv + sizeof(primitive_const_iv) / sizeof(primitive_const_iv[0]); civ-- > primitive_const_iv; ) - newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_presence_add_list(presence, source_list) - Purple::Presence presence - SV *source_list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(source_list)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); - } - purple_presence_add_list(presence, t_GL); - g_list_free(t_GL); - -void -purple_presence_add_status(presence, status) - Purple::Presence presence - Purple::Status status - -gint -purple_presence_compare(presence1, presence2) - Purple::Presence presence1 - Purple::Presence presence2 - -void -purple_presence_destroy(presence) - Purple::Presence presence - -Purple::Account -purple_presence_get_account(presence) - Purple::Presence presence - -Purple::Status -purple_presence_get_active_status(presence) - Purple::Presence presence - -const char * -purple_presence_get_chat_user(presence) - Purple::Presence presence - -Purple::PresenceContext -purple_presence_get_context(presence) - Purple::Presence presence - -Purple::Conversation -purple_presence_get_conversation(presence) - Purple::Presence presence - -time_t -purple_presence_get_idle_time(presence) - Purple::Presence presence - -time_t -purple_presence_get_login_time(presence) - Purple::Presence presence - -Purple::Status -purple_presence_get_status(presence, status_id) - Purple::Presence presence - const char *status_id - -void -purple_presence_get_statuses(presence) - Purple::Presence presence -PREINIT: - GList *l; -PPCODE: - for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status"))); - } - -gboolean -purple_presence_is_available(presence) - Purple::Presence presence - -gboolean -purple_presence_is_idle(presence) - Purple::Presence presence - -gboolean -purple_presence_is_online(presence) - Purple::Presence presence - -gboolean -purple_presence_is_status_active(presence, status_id) - Purple::Presence presence - const char *status_id - -gboolean -purple_presence_is_status_primitive_active(presence, primitive) - Purple::Presence presence - Purple::StatusPrimitive primitive - -Purple::Presence -purple_presence_new(context) - Purple::PresenceContext context - -Purple::Presence -purple_presence_new_for_account(account) - Purple::Account account - -Purple::Presence -purple_presence_new_for_buddy(buddy) - Purple::BuddyList::Buddy buddy - -Purple::Presence -purple_presence_new_for_conv(conv) - Purple::Conversation conv - -void -purple_presence_set_idle(presence, idle, idle_time) - Purple::Presence presence - gboolean idle - time_t idle_time - -void -purple_presence_set_login_time(presence, login_time) - Purple::Presence presence - time_t login_time - -void -purple_presence_set_status_active(presence, status_id, active) - Purple::Presence presence - const char *status_id - gboolean active - -void -purple_presence_switch_status(presence, status_id) - Purple::Presence presence - const char *status_id - -MODULE = Purple::Status PACKAGE = Purple::Primitive PREFIX = purple_primitive_ -PROTOTYPES: ENABLE - -const char * -purple_primitive_get_id_from_type(type) - Purple::StatusPrimitive type - -const char * -purple_primitive_get_name_from_type(type) - Purple::StatusPrimitive type - -Purple::StatusPrimitive -purple_primitive_get_type_from_id(id) - const char *id - -MODULE = Purple::Status PACKAGE = Purple::StatusAttr PREFIX = purple_status_attr_ -PROTOTYPES: ENABLE - -void -purple_status_attr_destroy(attr) - Purple::StatusAttr attr - -const char * -purple_status_attr_get_id(attr) - Purple::StatusAttr attr - -const char * -purple_status_attr_get_name(attr) - Purple::StatusAttr attr - -Purple::Value -purple_status_attr_get_value(attr) - Purple::StatusAttr attr - -Purple::StatusAttr -purple_status_attr_new(id, name, value_type) - const char *id - const char *name - Purple::Value value_type - -MODULE = Purple::Status PACKAGE = Purple::Status PREFIX = purple_status_ -PROTOTYPES: ENABLE - -gint -purple_status_compare(status1, status2) - Purple::Status status1 - Purple::Status status2 - -void -purple_status_destroy(status) - Purple::Status status - -gboolean -purple_status_get_attr_boolean(status, id) - Purple::Status status - const char *id - -int -purple_status_get_attr_int(status, id) - Purple::Status status - const char *id - -const char * -purple_status_get_attr_string(status, id) - Purple::Status status - const char *id - -Purple::Value -purple_status_get_attr_value(status, id) - Purple::Status status - const char *id - -Purple::Handle -purple_status_get_handle() - -const char * -purple_status_get_id(status) - Purple::Status status - -const char * -purple_status_get_name(status) - Purple::Status status - -Purple::Presence -purple_status_get_presence(status) - Purple::Status status - -Purple::StatusType -purple_status_get_type(status) - Purple::Status status - -gboolean -purple_status_is_active(status) - Purple::Status status - -gboolean -purple_status_is_available(status) - Purple::Status status - -gboolean -purple_status_is_exclusive(status) - Purple::Status status - -gboolean -purple_status_is_independent(status) - Purple::Status status - -gboolean -purple_status_is_online(status) - Purple::Status status - -Purple::Status -purple_status_new(status_type, presence) - Purple::StatusType status_type - Purple::Presence presence - -void -purple_status_set_active(status, active) - Purple::Status status - gboolean active - -void -purple_status_set_attr_boolean(status, id, value) - Purple::Status status - const char *id - gboolean value - -void -purple_status_set_attr_string(status, id, value) - Purple::Status status - const char *id - const char *value - -MODULE = Purple::Status PACKAGE = Purple::StatusType PREFIX = purple_status_type_ -PROTOTYPES: ENABLE - -void -purple_status_type_add_attr(status_type, id, name, value) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - -void -purple_status_type_destroy(status_type) - Purple::StatusType status_type - -Purple::StatusAttr -purple_status_type_get_attr(status_type, id) - Purple::StatusType status_type - const char *id - -void -purple_status_type_get_attrs(status_type) - Purple::StatusType status_type -PREINIT: - GList *l; -PPCODE: - for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusAttr"))); - } - -Purple::StatusType -purple_status_type_find_with_id(status_types, id) - SV *status_types - const char *id -PREINIT: - GList *t_GL; - int i, t_len; -CODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(status_types)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); - } - RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id); - g_list_free(t_GL); -OUTPUT: - RETVAL - -const char * -purple_status_type_get_id(status_type) - Purple::StatusType status_type - -const char * -purple_status_type_get_name(status_type) - Purple::StatusType status_type - -const char * -purple_status_type_get_primary_attr(status_type) - Purple::StatusType status_type - -Purple::StatusPrimitive -purple_status_type_get_primitive(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_available(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_exclusive(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_independent(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_saveable(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_user_settable(status_type) - Purple::StatusType status_type - -Purple::StatusType -purple_status_type_new(primitive, id, name, user_settable) - Purple::StatusPrimitive primitive - const char *id - const char *name - gboolean user_settable - -Purple::StatusType -purple_status_type_new_full(primitive, id, name, saveable, user_settable, independent) - Purple::StatusPrimitive primitive - const char *id - const char *name - gboolean saveable - gboolean user_settable - gboolean independent - -void -purple_status_type_set_primary_attr(status_type, attr_id) - Purple::StatusType status_type - const char *attr_id diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Stringref.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Stringref.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Stringref.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Stringref.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#include "module.h" - -MODULE = Purple::Stringref PACKAGE = Purple::Stringref PREFIX = purple_stringref_ -PROTOTYPES: ENABLE - -int -purple_stringref_cmp(s1, s2) - Purple::Stringref s1 - Purple::Stringref s2 - -size_t -purple_stringref_len(stringref) - Purple::Stringref stringref - -Purple::Stringref -purple_stringref_new(class, value) - const char *value - C_ARGS: - value - -Purple::Stringref -purple_stringref_new_noref(class, value) - const char *value - C_ARGS: - value - -Purple::Stringref -purple_stringref_ref(stringref) - Purple::Stringref stringref - -void -purple_stringref_unref(stringref) - Purple::Stringref stringref - -const char * -purple_stringref_value(stringref) - Purple::Stringref stringref diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/typemap qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/typemap --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/typemap 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/typemap 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -TYPEMAP -guint T_IV -gint T_IV -const gint * T_PTR -const guint * T_PTR -const guint8 * T_PTR -guint8 T_IV -guint8 * T_PTR -time_t T_IV -gboolean T_BOOL -gpointer T_PurpleObj -gconstpointer T_PTR -const gchar * T_PV -const char * T_PV -const char ** T_PTR -char ** T_PTR -gchar T_IV -gchar * T_PV -gchar_own * T_GCHAR_OWN -guchar T_IV -guchar * T_PV -guchar ** T_PTR -const guchar * T_PV -char * T_PV -int * T_PTR -long * T_PTR -size_t * T_PTR -GCallback T_PTR -va_list T_PTR -GString * T_PTR -GData * T_PTR -GData ** T_PTR -const unsigned char * T_PV -struct tm * T_PTR -const struct tm * T_PTR -xmlnode * T_PTR -const xmlnode * T_PTR -gssize T_IV -const void * T_PTR - -Purple::Account T_PurpleObj -Purple::Account::Option T_PurpleObj -Purple::Account::UserSplit T_PurpleObj - -Purple::Buddy::Icon T_PurpleObj -Purple::Buddy::Icon::Spec T_PurpleObj -Purple::BuddyList T_PurpleObj -Purple::BuddyList::Buddy T_PurpleObj -Purple::BuddyList::Chat T_PurpleObj -Purple::BuddyList::Contact T_PurpleObj -Purple::BuddyList::Group T_PurpleObj -Purple::BuddyList::Node T_PurpleObj -Purple::BuddyList::NodeFlags T_IV -Purple::BuddyList::NodeType T_IV - -Purple::Cipher T_PurpleObj -Purple::CipherCaps T_IV -Purple::Cipher::Ops T_PurpleObj -Purple::Cipher::Context T_PurpleObj -Purple::Cmd::Flag T_IV -Purple::Cmd::Id T_IV -Purple::Cmd::Priority T_IV -Purple::Cmd::Ret T_IV -Purple::Connection T_PurpleObj -Purple::Conversation T_PurpleObj -Purple::Conversation::Chat T_PurpleObj -Purple::Conversation::ChatBuddy T_PurpleObj -Purple::Conversation::IM T_PurpleObj -Purple::Core T_PurpleObj - -Purple::Desktop::Item T_PurpleObj -Purple::DesktopItemType T_IV - -Purple::Handle T_PurpleObj - -Purple::IconScaleRules T_IV - -Purple::Log T_PurpleObj -Purple::LogType T_IV -Purple::Log::CommonLoggerData T_PurpleObj -Purple::Log::Logger T_PurpleObj -Purple::Log::ReadFlags T_PurpleObj -Purple::Log::Set T_PurpleObj - -Purple::Menu::Action T_PurpleObj - -Purple::NetworkListenData T_PurpleObj -Purple::NetworkListenCallback T_PTR - -Purple::NotifyCloseCallback T_PTR -Purple::NotifyMsgType T_IV -Purple::NotifySearchButtonType T_IV -Purple::NotifySearchResults T_PurpleObj -Purple::NotifySearchColumn T_PurpleObj -Purple::NotifySearchButton T_PurpleObj -Purple::NotifyType T_IV -Purple::NotifyUserInfo T_PurpleObj -Purple::NotifyUserInfoEntry T_PurpleObj - -Purple::Plugin T_PurpleObj -Purple::PluginType T_IV -Purple::PluginUiInfo T_PurpleObj -Purple::Plugin::Action T_PurpleObj -Purple::Plugin::Info T_PurpleObj -Purple::Plugin::Loader::Info T_PurpleObj -Purple::Plugin::Protocol::Info T_PurpleObj -Purple::PrefType T_IV -Purple::PluginPref T_PurpleObj -Purple::PluginPrefType T_IV -Purple::PluginPref::Frame T_PurpleObj -Purple::Pounce T_PurpleObj -Purple::PounceEvent T_IV -Purple::Presence T_PurpleObj -Purple::PrivacyType T_IV -Purple::ProtocolOptions T_IV -Purple::ProxyInfo T_PurpleObj -Purple::ProxyType T_IV - -Purple::RequestFieldType T_IV -Purple::RequestType T_IV -Purple::Request::Field T_PurpleObj -Purple::Request::Fields T_PurpleObj -Purple::Request::Field::Group T_PurpleObj - -Purple::Roomlist T_PurpleObj -Purple::Roomlist::Room T_PurpleObj -Purple::Roomlist::Field T_PurpleObj -Purple::RoomlistFieldType T_IV -Purple::RoomlistRoomType T_IV - -Purple::SavedStatus T_PurpleObj -const Purple::SavedStatus T_PurpleObj -Purple::SavedStatus::Sub T_PurpleObj -const Purple::SavedStatus::Sub T_PurpleObj -Purple::SoundEventID T_IV - -Purple::Input::Condition T_PurpleObj -Purple::SslErrorType T_IV -Purple::Ssl::Connection T_PurpleObj -Purple::Ssl::Ops T_PurpleObj - -Purple::Presence T_PurpleObj -Purple::PresenceContext T_IV -Purple::Smiley T_PurpleObj -Purple::Status T_PurpleObj -Purple::StatusAttr T_PurpleObj -Purple::StatusPrimitive T_IV -Purple::StatusType T_PurpleObj -const Purple::StatusType T_PurpleObj - -Purple::StoredImage T_PurpleObj -Purple::String::Format::Type T_IV -Purple::Stringref T_PurpleObj -Purple::Util::FetchUrlData T_PTR -Purple::Util::InfoFieldFormatCallback T_PTR -Purple::Value T_PurpleObj - -Purple::Xfer T_PurpleObj -Purple::XferType T_IV -Purple::XferStatusType T_IV - -Purple::XMLNode T_PurpleObj -XMLNode::Type T_IV - -/* enums */ - -/* certificate.h */ -Purple::Certificate T_PurpleObj -Purple::Certificate::Pool T_PurpleObj -Purple::Certificate::Scheme T_PurpleObj -Purple::Certificate::Verifier T_PurpleObj -Purple::Certificate::VerificationRequest T_PurpleObj -Purple::Certificate::VerificationStatus T_IV - -/* cipher.h */ -Purple::Cipher::BatchMode T_IV - -/* blist.h */ - -/* debug.h */ -Purple::DebugLevel T_IV - -/* conversation.h */ -Purple::ConvChatBuddyFlags T_IV -Purple::ConvUpdateType T_IV -Purple::ConversationType T_IV -Purple::MessageFlags T_IV -Purple::TypingState T_IV -Purple::UnseenState T_IV - -/* connection.h */ -Purple::ConnectionFlags T_IV -Purple::ConnectionState T_IV - -/* whiteboard.h */ -Purple::Whiteboard T_PurpleObj - -INPUT - -T_PurpleObj - $var = purple_perl_ref_object($arg) - -OUTPUT - -T_PurpleObj - $arg = purple_perl_bless_object($var, \"$type\"); - -T_GCHAR_OWN - /* used when we can directly own the returned string. */ - /* we have to copy in the case when perl's malloc != gtk's malloc, - * so best copy all the time. */ - sv_setpv ((SV*)$arg, $var); - SvUTF8_on ($arg); - g_free ($var); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Util.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Util.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Util.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Util.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,518 +0,0 @@ -#include "module.h" - -static void -purple_perl_util_url_cb(PurpleUtilFetchUrlData *url_data, void *user_data, - const gchar *url_text, size_t size, - const gchar *error_message) -{ - SV *sv = (SV *)user_data; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - - XPUSHs(sv_2mortal(newSVpvn(url_text, size))); - PUTBACK; - - call_sv(sv, G_EVAL | G_SCALAR); - SPAGAIN; - - /* XXX Make sure this destroys it correctly and that we don't want - * something like sv_2mortal(sv) or something else here instead. */ - SvREFCNT_dec(sv); - - PUTBACK; - FREETMPS; - LEAVE; -} - -static void markup_find_tag_foreach(GQuark key_id, char *data, HV *hv) { - const char *key = NULL; - key = g_quark_to_string(key_id); - hv_store(hv, key, strlen(key), newSVpv(data, 0), 0); -} - -MODULE = Purple::Util PACKAGE = Purple::Util PREFIX = purple_ -PROTOTYPES: ENABLE - -gboolean -purple_running_gnome() - -gboolean -purple_running_kde() - -gboolean -purple_running_osx() - -int -purple_build_dir(path, mode) - const char *path - int mode - -gboolean -purple_email_is_valid(address) - const char *address - -const char * -purple_escape_filename(str) - const char *str - -gchar_own * -purple_fd_get_ip(fd) - int fd - -const gchar * -purple_home_dir() - -gchar_own* -purple_message_meify(SV *msg) - PREINIT: - char *message = NULL; - gboolean ret; - gsize len; - CODE: - message = SvPV(msg, len); - message = g_strndup(message, len); - ret = purple_message_meify(message, len); - if(ret) { - /* message will get g_free()'d later on, since RETVAL is gchar_own* */ - RETVAL = message; - } else { - RETVAL = NULL; - g_free(message); - } - OUTPUT: - RETVAL - -FILE * -purple_mkstemp(OUTLIST gchar_own *path, binary) - gboolean binary - PROTOTYPE: $ - -const char * -purple_normalize(account, str) - Purple::Account account - const char *str - -gboolean -purple_program_is_valid(program) - const char *program - -gchar_own * -purple_strdup_withhtml(src) - const gchar *src - -gchar_own * -purple_text_strip_mnemonic(in) - const char *in - -time_t -purple_time_build(year, month, day, hour, min, sec) - int year - int month - int day - int hour - int min - int sec - -const char * -purple_time_format(tm) - const struct tm *tm - -const char * -purple_unescape_filename(str) - const char *str - -gchar_own * -purple_unescape_html(html) - const char *html - -const char * -purple_url_decode(str) - const char *str - -const char * -purple_url_encode(str) - const char *str - - # XXX: this made perl assert()... - # - #gboolean - #purple_url_parse(url, OUTLIST gchar_own *ret_host, OUTLIST int ret_port, OUTLIST gchar_own *ret_path, OUTLIST gchar_own *ret_user, OUTLIST gchar_own *ret_passwd) - # const char *url - # PROTOTYPE: $ - -void -purple_url_parse(url) - const char *url - PREINIT: - char *ret_host; - int ret_port; - char *ret_path; - char *ret_user; - char *ret_passwd; - gboolean ret; - PPCODE: - ret = purple_url_parse(url, &ret_host, &ret_port, &ret_path, &ret_user, &ret_passwd); - XPUSHs(sv_2mortal(newSViv(ret))); - XPUSHs(ret_host ? sv_2mortal(newSVpv(ret_host, 0)) : sv_2mortal(newSV(0))); - XPUSHs(sv_2mortal(newSViv(ret_port))); - XPUSHs(ret_path ? sv_2mortal(newSVpv(ret_path, 0)) : sv_2mortal(newSV(0))); - XPUSHs(ret_user ? sv_2mortal(newSVpv(ret_user, 0)) : sv_2mortal(newSV(0))); - XPUSHs(ret_passwd ? sv_2mortal(newSVpv(ret_passwd, 0)) : sv_2mortal(newSV(0))); - g_free(ret_host); - g_free(ret_path); - g_free(ret_user); - g_free(ret_passwd); - - -const char * -purple_user_dir() - -const char * -purple_utf8_strftime(const char *format, const struct tm *tm); - -gboolean -purple_utf8_has_word(haystack, needle) - const char* haystack - const char* needle - -gchar_own* -purple_utf8_ncr_decode(in) - const char* in - -gchar_own* -purple_utf8_ncr_encode(in) - const char* in - -gchar_own* -purple_utf8_salvage(str) - const char* str - -int -purple_utf8_strcasecmp(a, b) - const char* a - const char* b - -gchar_own* -purple_utf8_try_convert(str) - const char* str - -gboolean -purple_ip_address_is_valid(ip) - const char* ip - -const char* -purple_normalize_nocase(account, str) - Purple::Account account - const char* str - -const gchar* -purple_gai_strerror(errnum) - gint errnum - -void -purple_got_protocol_handler_uri(uri) - const char* uri - -gchar_own* -purple_base16_encode(const guchar *data, gsize length(data)) - PROTOTYPE: $ - -gchar_own* -purple_base16_encode_chunked(const guchar *data, gsize length(data)) - PROTOTYPE: $ - -gchar_own* -purple_base64_encode(const guchar *data, gsize length(data)) - PROTOTYPE: $ - -void -purple_restore_default_signal_handlers() - -SV * -purple_base16_decode(str) - const char* str - PREINIT: - gsize len; - guchar *ret; - CODE: - ret = purple_base16_decode(str, &len); - if(len) { - RETVAL = newSVpv((gchar *)ret, len); - } else { - g_free(ret); - XSRETURN_UNDEF; - } - g_free(ret); - OUTPUT: - RETVAL - -SV* -purple_base64_decode(str) - const char* str - PREINIT: - gsize len; - guchar *ret; - CODE: - ret = purple_base64_decode(str, &len); - if(len) { - RETVAL = newSVpv((gchar *)ret, len); - } else { - g_free(ret); - XSRETURN_UNDEF; - } - g_free(ret); - OUTPUT: - RETVAL - -SV* -purple_quotedp_decode(str) - const char* str - PREINIT: - gsize len; - guchar *ret; - CODE: - ret = purple_quotedp_decode(str, &len); - if(len) { - RETVAL = newSVpv((gchar *)ret, len); - } else { - g_free(ret); - XSRETURN_UNDEF; - } - g_free(ret); - OUTPUT: - RETVAL - -void -purple_uri_list_extract_uris(uri_list) - const gchar* uri_list - PREINIT: - GList *l = NULL, *gl = NULL; - PPCODE: - gl = purple_uri_list_extract_uris(uri_list); - for(l = gl; l; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - g_list_free(gl); - -void -purple_uri_list_extract_filenames(uri_list) - const gchar* uri_list - PREINIT: - GList *l = NULL, *gl = NULL; - PPCODE: - gl = purple_uri_list_extract_filenames(uri_list); - for(l = gl; l; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - g_list_free(gl); - -MODULE = Purple::Util PACKAGE = Purple::Util::Str PREFIX = purple_str_ -PROTOTYPES: ENABLE - -gchar_own * -purple_str_add_cr(str) - const char *str - -gchar_own * -purple_str_binary_to_ascii(const unsigned char *binary, guint length(binary)) - PROTOTYPE: $ - -gboolean -purple_str_has_prefix(s, p) - const char *s - const char *p - -gboolean -purple_str_has_suffix(s, x) - const char *s - const char *x - -gchar_own * -purple_str_seconds_to_string(sec) - guint sec - -gchar_own * -purple_str_size_to_units(size) - size_t size - -time_t -purple_str_to_time(timestamp, utc = FALSE, tm = NULL, OUTLIST long tz_off, OUTLIST const char *rest) - const char *timestamp - gboolean utc - struct tm *tm - PROTOTYPE: $;$$ - -MODULE = Purple::Util PACKAGE = Purple::Util::Date PREFIX = purple_date_ -PROTOTYPES: ENABLE - -const char * -purple_date_format_full(tm) - const struct tm *tm - -const char * -purple_date_format_long(tm) - const struct tm *tm - -const char * -purple_date_format_short(tm) - const struct tm *tm - -MODULE = Purple::Util PACKAGE = Purple::Util::Markup PREFIX = purple_markup_ -PROTOTYPES: ENABLE - -gboolean -purple_markup_extract_info_field(str, len, user_info, start_token, skip, end_token, check_value, no_value_token, display_name, is_link, link_prefix, format_cb) - const char *str - int len - Purple::NotifyUserInfo user_info - const char *start_token - int skip - const char *end_token - char check_value - const char *no_value_token - const char *display_name - gboolean is_link - const char *link_prefix - Purple::Util::InfoFieldFormatCallback format_cb - - # XXX: returning start/end to perl doesn't make a lot of sense... - # XXX: the actual tag data can be gotten with $start =~ s/$end//g; -void -purple_markup_find_tag(needle, haystack) - const char *needle - const char *haystack - PREINIT: - const char *start = NULL; - const char *end = NULL; - GData *attributes; - gboolean ret; - HV *hv = NULL; - PPCODE: - ret = purple_markup_find_tag(needle, haystack, &start, &end, &attributes); - if(!ret) XSRETURN_UNDEF; - - hv = newHV(); - g_datalist_foreach(&attributes, (GDataForeachFunc) markup_find_tag_foreach, hv); - g_datalist_clear(&attributes); - - XPUSHs(sv_2mortal(newSVpv(start, 0))); - XPUSHs(sv_2mortal(newSVpv(end, 0))); - XPUSHs(sv_2mortal(newRV_noinc((SV *) hv))); - -gchar_own * -purple_markup_get_tag_name(tag) - const char *tag - -void -purple_markup_html_to_xhtml(html, OUTLIST gchar_own *dest_xhtml, OUTLIST gchar_own *dest_plain) - const char *html - PROTOTYPE: $ - -gchar_own * -purple_markup_linkify(str) - const char *str - -gchar_own * -purple_markup_slice(str, x, y) - const char *str - guint x - guint y - -gchar_own * -purple_markup_strip_html(str) - const char *str - -gchar_own * -purple_markup_get_css_property(style, opt) - const gchar* style - const gchar* opt - -SV* -purple_markup_unescape_entity(text) - const char* text - PREINIT: - int length; - CODE: - { - const char *str = purple_markup_unescape_entity(text, &length); - if(length) { - RETVAL = newSVpv(str, length); - } else { - XSRETURN_UNDEF; - } - } - OUTPUT: - RETVAL - - -MODULE = Purple::Util PACKAGE = Purple::Util PREFIX = purple_util_ -PROTOTYPES: ENABLE - - #XXX: expand... -void -purple_util_fetch_url(plugin, url, full, user_agent, http11, cb) - Purple::Plugin plugin - const char *url - gboolean full - const char *user_agent - gboolean http11 - SV * cb -PREINIT: - PurpleUtilFetchUrlData *data; -PPCODE: - /* XXX: i don't like this... only plugins can use it... */ - SV *sv = purple_perl_sv_from_fun(plugin, cb); - - if (sv != NULL) { - data = purple_util_fetch_url(url, full, user_agent, http11, - purple_perl_util_url_cb, sv); - XPUSHs(sv_2mortal(purple_perl_bless_object(data, "Purple::Util::FetchUrlData"))); - } else { - purple_debug_warning("perl", "Callback not a valid type, only strings and coderefs allowed in purple_util_fetch_url.\n"); - XSRETURN_UNDEF; - } - -void -purple_util_set_user_dir(dir) - const char *dir - -gboolean -purple_util_write_data_to_file(filename, const char *data, size_t length(data)) - const char *filename - PROTOTYPE: $$ - -void -purple_util_set_current_song(title, artist, album) - const char *title - const char *artist - const char *album - -gchar_own* -purple_util_format_song_info(title, artist, album, unused) - const char* title - const char* artist - const char* album - gpointer unused - -const char* -purple_util_get_image_extension(const char *data, size_t length(data)) - PROTOTYPE: $ - -gchar_own* -purple_util_get_image_filename(const char *image_data, size_t length(image_data)) - PROTOTYPE: $ - -Purple::XMLNode -purple_util_read_xml_from_file(filename, description) - const char* filename - const char* description - -gboolean -purple_util_write_data_to_file_absolute(filename_full, char *data, gssize length(data)) - const char* filename_full - PROTOTYPE: $$ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Whiteboard.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Whiteboard.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Whiteboard.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/Whiteboard.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -#include "module.h" - -MODULE = Purple::Whiteboard PACKAGE = Purple::Whiteboard PREFIX = purple_whiteboard_ -PROTOTYPES: ENABLE - -void -purple_whiteboard_clear(wb) - Purple::Whiteboard wb - -Purple::Whiteboard -purple_whiteboard_create(account, who, state) - Purple::Account account - const char* who - int state - -void -purple_whiteboard_destroy(wb) - Purple::Whiteboard wb - -void -purple_whiteboard_draw_line(wb, x1, y1, x2, y2, color, size) - Purple::Whiteboard wb - int x1 - int y1 - int x2 - int y2 - int color - int size - -void -purple_whiteboard_draw_point(wb, x, y, color, size) - Purple::Whiteboard wb - int x - int y - int color - int size - -Purple::Whiteboard -purple_whiteboard_get_session(account, who) - Purple::Account account - const char* who - -void -purple_whiteboard_send_brush(wb, size, color) - Purple::Whiteboard wb - int size - int color - -void -purple_whiteboard_send_clear(wb) - Purple::Whiteboard wb - -void -purple_whiteboard_set_brush(wb, size, color) - Purple::Whiteboard wb - int size - int color - -void -purple_whiteboard_set_dimensions(wb, width, height) - Purple::Whiteboard wb - int width - int height - -gboolean -purple_whiteboard_get_brush(wb, OUTLIST int size, OUTLIST int color) - Purple::Whiteboard wb - PROTOTYPE: $ - -gboolean -purple_whiteboard_get_dimensions(wb, OUTLIST int width, OUTLIST int height) - Purple::Whiteboard wb - PROTOTYPE: $ - -void -purple_whiteboard_start(wb) - Purple::Whiteboard wb - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/XMLNode.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/XMLNode.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/XMLNode.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/common/XMLNode.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -#include "module.h" - -MODULE = Purple::XMLNode PACKAGE = Purple::XMLNode PREFIX = xmlnode_ -PROTOTYPES: ENABLE - -Purple::XMLNode -xmlnode_copy(src) - Purple::XMLNode src - -void -xmlnode_free(node) - Purple::XMLNode node - -Purple::XMLNode -xmlnode_from_str(const char *str, gssize length(str)) - PROTOTYPE: $ - -const char * -xmlnode_get_name(node) - Purple::XMLNode node - CODE: - RETVAL = node->name; - OUTPUT: - RETVAL - -const char * -xmlnode_get_attrib(node, attr) - Purple::XMLNode node - const char *attr - -Purple::XMLNode -xmlnode_get_child(parent, name) - Purple::XMLNode parent - const char *name -PREINIT: - xmlnode *tmp; -CODE: - if (!name || *name == '\0') { - tmp = parent->child; - while (tmp && tmp->type != XMLNODE_TYPE_TAG) - tmp = tmp->next; - RETVAL = tmp; - } else - RETVAL = xmlnode_get_child(parent, name); -OUTPUT: - RETVAL - -Purple::XMLNode -xmlnode_get_child_with_namespace(parent, name, xmlns) - Purple::XMLNode parent - const char *name - const char *xmlns - -gchar_own * -xmlnode_get_data(node) - Purple::XMLNode node - -Purple::XMLNode -xmlnode_get_next(node) - Purple::XMLNode node -PREINIT: - xmlnode *tmp; -CODE: - tmp = node->next; - while (tmp && tmp->type != XMLNODE_TYPE_TAG) - tmp = tmp->next; - RETVAL = tmp; -OUTPUT: - RETVAL - -Purple::XMLNode -xmlnode_get_next_twin(node) - Purple::XMLNode node - -void -xmlnode_insert_child(parent, child) - Purple::XMLNode parent - Purple::XMLNode child - -void -xmlnode_insert_data(node, data, size) - Purple::XMLNode node - const char *data - gssize size - -Purple::XMLNode -xmlnode_new(class, name) - const char *name - C_ARGS: - name - -Purple::XMLNode -xmlnode_new_child(parent, name) - Purple::XMLNode parent - const char *name - -void -xmlnode_remove_attrib(node, attr) - Purple::XMLNode node - const char *attr - -void -xmlnode_set_attrib(node, attr, value) - Purple::XMLNode node - const char *attr - const char *value - -gchar_own * -xmlnode_to_formatted_str(node) - Purple::XMLNode node - CODE: - RETVAL = xmlnode_to_formatted_str(node, NULL); - OUTPUT: - RETVAL - -gchar_own * -xmlnode_to_str(node) - Purple::XMLNode node - CODE: - RETVAL = xmlnode_to_str(node, NULL); - OUTPUT: - RETVAL diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -perl_dirs = common - -plugin_LTLIBRARIES = perl.la - -perl_la_LDFLAGS = -module -avoid-version -perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS) -perl_la_SOURCES = \ - perl.c \ - perl-common.c \ - perl-common.h \ - perl-handlers.c \ - perl-handlers.h - -perl_la_DEPENDENCIES = \ - .libs/libperl_orig.a \ - .libs/DynaLoader.a - -.libs/libperl_orig.a: - @mkdir -p .libs - @rm -f .libs/libperl_orig.a - @if [ x$(LIBPERL_A) = x ]; then \ - touch .libs/libperl_orig.a; \ - else \ - $(LN_S) $(LIBPERL_A) .libs/libperl_orig.a; \ - fi - -.libs/DynaLoader.a: - @mkdir -p .libs - @rm -f .libs/DynaLoader.a - @if [ x$(DYNALOADER_A) = x ]; then \ - touch .libs/DynaLoader.a; \ - else \ - $(LN_S) $(DYNALOADER_A) .libs/DynaLoader.a; \ - fi - -common_sources = \ - common/Account.xs \ - common/AccountOpts.xs \ - common/BuddyIcon.xs \ - common/BuddyList.xs \ - common/Certificate.xs \ - common/Cipher.xs \ - common/Cmds.xs \ - common/Core.xs \ - common/Connection.xs \ - common/Conversation.xs \ - common/Debug.xs \ - common/FT.xs \ - common/Idle.xs \ - common/ImgStore.xs \ - common/Log.xs \ - common/Makefile.PL.in \ - common/Network.xs \ - common/Notify.xs \ - common/Plugin.xs \ - common/PluginPref.xs \ - common/Pounce.xs \ - common/Prefs.xs \ - common/Privacy.xs \ - common/Proxy.xs \ - common/Prpl.xs \ - common/Purple.pm \ - common/Purple.xs \ - common/Request.xs \ - common/Roomlist.xs \ - common/SSLConn.xs \ - common/SavedStatuses.xs \ - common/Server.xs \ - common/Signal.xs \ - common/Smiley.xs \ - common/Sound.xs \ - common/Status.xs \ - common/Stringref.xs \ - common/Util.xs \ - common/Whiteboard.xs \ - common/XMLNode.xs \ - common/module.h \ - common/typemap -# common/fallback/const-c.inc \ -# common/fallback/const-xs.inc - -perl_scripts = \ - scripts/function_list.pl \ - scripts/signals-test.pl - -EXTRA_DIST = \ - Makefile.mingw \ - common/Makefile.mingw \ - $(common_sources) \ - $(perl_scripts) - -common/Makefile: common/Makefile.PL - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi - @cd common && $(perlpath) Makefile.PL - -common/Makefile.PL: common/Makefile.PL.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -all-local: common/Makefile - @for dir in $(perl_dirs); do \ - cd $$dir && \ - if [ ! -f Makefile ]; then \ - $(perlpath) Makefile.PL; \ - fi && \ - ($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \ - $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \ - cd ..; \ - done - -install-exec-local: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) install; \ - cd ..; \ - done - -# Evil Hack (TM) -# ... which doesn't work with DESTDIR installs. FIXME? -uninstall-local: - @for dir in $(perl_dirs); do \ - cd $$dir && \ - `$(MAKE) uninstall | grep unlink | sed -e 's#/usr#${prefix}#' -e 's#unlink#rm -f#'` && \ - cd ..; \ - done - -clean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) clean; \ - cd ..; \ - done - rm -f *.so - -distclean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) realclean; \ - rm -f Makefile.PL; \ - rm -f Makefile.old; \ - rm -f Makefile; \ - cd ..; \ - done - - @rm -f Makefile -# @rm -f common/const-c.inc common/const-xs.inc - - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(PERL_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,861 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/perl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -am_perl_la_OBJECTS = perl.lo perl-common.lo perl-handlers.lo -perl_la_OBJECTS = $(am_perl_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(perl_la_SOURCES) -DIST_SOURCES = $(perl_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -perl_dirs = common -plugin_LTLIBRARIES = perl.la -perl_la_LDFLAGS = -module -avoid-version -perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS) -perl_la_SOURCES = \ - perl.c \ - perl-common.c \ - perl-common.h \ - perl-handlers.c \ - perl-handlers.h - -perl_la_DEPENDENCIES = \ - .libs/libperl_orig.a \ - .libs/DynaLoader.a - -common_sources = \ - common/Account.xs \ - common/AccountOpts.xs \ - common/BuddyIcon.xs \ - common/BuddyList.xs \ - common/Certificate.xs \ - common/Cipher.xs \ - common/Cmds.xs \ - common/Core.xs \ - common/Connection.xs \ - common/Conversation.xs \ - common/Debug.xs \ - common/FT.xs \ - common/Idle.xs \ - common/ImgStore.xs \ - common/Log.xs \ - common/Makefile.PL.in \ - common/Network.xs \ - common/Notify.xs \ - common/Plugin.xs \ - common/PluginPref.xs \ - common/Pounce.xs \ - common/Prefs.xs \ - common/Privacy.xs \ - common/Proxy.xs \ - common/Prpl.xs \ - common/Purple.pm \ - common/Purple.xs \ - common/Request.xs \ - common/Roomlist.xs \ - common/SSLConn.xs \ - common/SavedStatuses.xs \ - common/Server.xs \ - common/Signal.xs \ - common/Smiley.xs \ - common/Sound.xs \ - common/Status.xs \ - common/Stringref.xs \ - common/Util.xs \ - common/Whiteboard.xs \ - common/XMLNode.xs \ - common/module.h \ - common/typemap - -# common/fallback/const-c.inc \ -# common/fallback/const-xs.inc -perl_scripts = \ - scripts/function_list.pl \ - scripts/signals-test.pl - -EXTRA_DIST = \ - Makefile.mingw \ - common/Makefile.mingw \ - $(common_sources) \ - $(perl_scripts) - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(PERL_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/perl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/perl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -perl.la: $(perl_la_OBJECTS) $(perl_la_DEPENDENCIES) - $(LINK) -rpath $(plugindir) $(perl_la_LDFLAGS) $(perl_la_OBJECTS) $(perl_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl-common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl-handlers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/common $(distdir)/scripts - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) all-local -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: install-exec-local - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-local \ - uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ - clean-generic clean-libtool clean-pluginLTLIBRARIES ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am \ - install-exec-local install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am uninstall-local \ - uninstall-pluginLTLIBRARIES - - -.libs/libperl_orig.a: - @mkdir -p .libs - @rm -f .libs/libperl_orig.a - @if [ x$(LIBPERL_A) = x ]; then \ - touch .libs/libperl_orig.a; \ - else \ - $(LN_S) $(LIBPERL_A) .libs/libperl_orig.a; \ - fi - -.libs/DynaLoader.a: - @mkdir -p .libs - @rm -f .libs/DynaLoader.a - @if [ x$(DYNALOADER_A) = x ]; then \ - touch .libs/DynaLoader.a; \ - else \ - $(LN_S) $(DYNALOADER_A) .libs/DynaLoader.a; \ - fi - -common/Makefile: common/Makefile.PL - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi - @cd common && $(perlpath) Makefile.PL - -common/Makefile.PL: common/Makefile.PL.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -all-local: common/Makefile - @for dir in $(perl_dirs); do \ - cd $$dir && \ - if [ ! -f Makefile ]; then \ - $(perlpath) Makefile.PL; \ - fi && \ - ($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \ - $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \ - cd ..; \ - done - -install-exec-local: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) install; \ - cd ..; \ - done - -# Evil Hack (TM) -# ... which doesn't work with DESTDIR installs. FIXME? -uninstall-local: - @for dir in $(perl_dirs); do \ - cd $$dir && \ - `$(MAKE) uninstall | grep unlink | sed -e 's#/usr#${prefix}#' -e 's#unlink#rm -f#'` && \ - cd ..; \ - done - -clean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) clean; \ - cd ..; \ - done - rm -f *.so - -distclean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) realclean; \ - rm -f Makefile.PL; \ - rm -f Makefile.old; \ - rm -f Makefile; \ - cd ..; \ - done - - @rm -f Makefile -# @rm -f common/const-c.inc common/const-xs.inc - - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for perl plugin loader plugin. -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = perl - -# Perl headers with /* /* */ type comments.. Turn off warnings. -GCCWARNINGS += -Wno-comment - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PERL_LIB_TOP)/CORE - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(PERL_LIB_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = perl.c \ - perl-common.c \ - perl-handlers.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgmodule-2.0 \ - -lgobject-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lperl510 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - $(MAKE) -C ./common -f $(MINGW_MAKEFILE) - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PLUGINS_DIR) - $(MAKE) -C ./common -f $(MINGW_MAKEFILE) install - -$(OBJECTS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll $(TARGET).dll.a: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--export-all-symbols -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -rf $(OBJECTS) - rm -rf $(TARGET).dll $(TARGET).dll.a - $(MAKE) -C ./common -f $(MINGW_MAKEFILE) clean - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,719 +0,0 @@ -/* - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifdef HAVE_CONFIG_H -#include -# ifdef HAVE_LIMITS_H -# include -# ifndef NAME_MAX -# define NAME_MAX _POSIX_NAME_MAX -# endif -# endif -#endif - -#ifdef DEBUG -# undef DEBUG -#endif - -#undef PACKAGE - -#define group perl_group - -#ifdef _WIN32 -/* This took me an age to figure out.. without this __declspec(dllimport) - * will be ignored. - */ -# define HASATTRIBUTE -#endif - -#include - -#ifndef _SEM_SEMUN_UNDEFINED -# define HAS_UNION_SEMUN -#endif - -#include -#include - -#ifndef _WIN32 -# include -#endif - -#undef PACKAGE - -#ifndef _WIN32 -# include -#else - /* We're using perl's win32 port of this */ -# define dirent direct -#endif - -#undef group - -/* perl module support */ -#ifdef _WIN32 -EXTERN_C void boot_Win32CORE (pTHX_ CV* cv); -#endif - -#ifdef OLD_PERL -extern void boot_DynaLoader _((CV * cv)); -#else -extern void boot_DynaLoader _((pTHX_ CV * cv)); /* perl is so wacky */ -#endif - -#undef _ -#ifdef DEBUG -# undef DEBUG -#endif -#ifdef _WIN32 -# undef pipe -#endif - -#ifdef _WIN32 -#define _WIN32DEP_H_ -#endif -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "signals.h" -#include "version.h" - -#include "perl-common.h" -#include "perl-handlers.h" - -#include - -#define PERL_PLUGIN_ID "core-perl" - -PerlInterpreter *my_perl = NULL; - -static PurplePluginUiInfo ui_info = -{ - purple_perl_get_plugin_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -#ifdef PURPLE_GTKPERL -static PurpleGtkPluginUiInfo gtk_ui_info = -{ - purple_perl_gtk_get_plugin_frame, - 0 /* page_num (Reserved) */ -}; -#endif - -static void -#ifdef OLD_PERL -xs_init() -#else -xs_init(pTHX) -#endif -{ - char *file = __FILE__; - GList *search_paths = purple_plugins_get_search_paths(); - dXSUB_SYS; - - /* This one allows dynamic loading of perl modules in perl scripts by - * the 'use perlmod;' construction */ - newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); -#ifdef _WIN32 - newXS("Win32CORE::bootstrap", boot_Win32CORE, file); -#endif - - while (search_paths != NULL) { - gchar *uselib; - const gchar *search_path = search_paths->data; - search_paths = g_list_next(search_paths); - - uselib = g_strdup_printf("unshift @INC, q(%s%sperl);", - search_path, G_DIR_SEPARATOR_S); - eval_pv(uselib, TRUE); - g_free(uselib); - } -} - -static void -perl_init(void) -{ - /* changed the name of the variable from load_file to perl_definitions - * since now it does much more than defining the load_file sub. - * Moreover, deplaced the initialisation to the xs_init function. - * (TheHobbit) */ - char *perl_args[] = { "", "-e", "0", "-w" }; - char perl_definitions[] = - { - /* We use to function one to load a file the other to execute - * the string obtained from the first and holding the file - * contents. This allows to have a really local $/ without - * introducing temp variables to hold the old value. Just a - * question of style:) */ - "package Purple::PerlLoader;" - "use Symbol;" - - "sub load_file {" - "my $f_name=shift;" - "local $/=undef;" - "open FH,$f_name or return \"__FAILED__\";" - "$_=;" - "close FH;" - "return $_;" - "}" - - "sub destroy_package {" - "eval { $_[0]->UNLOAD() if $_[0]->can('UNLOAD'); };" - "Symbol::delete_package($_[0]);" - "}" - - "sub load_n_eval {" - "my ($f_name, $package) = @_;" - "destroy_package($package);" - "my $strin=load_file($f_name);" - "return 2 if($strin eq \"__FAILED__\");" - "my $eval = qq{package $package; $strin;};" - - "{" - " eval $eval;" - "}" - - "if($@) {" - /*" #something went wrong\n"*/ - "die(\"Errors loading file $f_name: $@\");" - "}" - - "return 0;" - "}" - }; - - my_perl = perl_alloc(); - PERL_SET_CONTEXT(my_perl); - PL_perl_destruct_level = 1; - perl_construct(my_perl); -#ifdef DEBUG - perl_parse(my_perl, xs_init, 4, perl_args, NULL); -#else - perl_parse(my_perl, xs_init, 3, perl_args, NULL); -#endif -#ifdef HAVE_PERL_EVAL_PV - eval_pv(perl_definitions, TRUE); -#else - perl_eval_pv(perl_definitions, TRUE); /* deprecated */ -#endif - perl_run(my_perl); -} - -static void -perl_end(void) -{ - if (my_perl == NULL) - return; - - PL_perl_destruct_level = 1; - PERL_SET_CONTEXT(my_perl); - perl_eval_pv( - "foreach my $lib (@DynaLoader::dl_modules) {" - "if ($lib =~ /^Purple\\b/) {" - "$lib .= '::deinit();';" - "eval $lib;" - "}" - "}", - TRUE); - - PL_perl_destruct_level = 1; - PERL_SET_CONTEXT(my_perl); - perl_destruct(my_perl); - perl_free(my_perl); - my_perl = NULL; -} - -void -purple_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark) -{ - dSP; - - PUSHMARK(mark); - (*subaddr)(aTHX_ cv); - - PUTBACK; -} - -static gboolean -probe_perl_plugin(PurplePlugin *plugin) -{ - - char *args[] = {"", plugin->path }; - char **argv = args; - int argc = 2, ret; - PerlInterpreter *prober; - gboolean status = TRUE; - HV *plugin_info; - - PERL_SYS_INIT(&argc, &argv); - - /* XXX This would be much faster if we didn't create a new - * PerlInterpreter every time we probe a plugin */ - prober = perl_alloc(); - - PERL_SET_CONTEXT(prober); - - PL_perl_destruct_level = 1; - perl_construct(prober); - -/* Fix IO redirection to match where pidgin's is going. - * Without this, we lose stdout/stderr unless we redirect to a file */ -#ifdef _WIN32 -{ - PerlIO* newprlIO = PerlIO_open("CONOUT$", "w"); - if (newprlIO) { - int stdout_fd = PerlIO_fileno(PerlIO_stdout()); - int stderr_fd = PerlIO_fileno(PerlIO_stderr()); - PerlIO_close(PerlIO_stdout()); - PerlIO_close(PerlIO_stderr()); - PerlLIO_dup2(PerlIO_fileno(newprlIO), stdout_fd); - PerlLIO_dup2(PerlIO_fileno(newprlIO), stderr_fd); - - PerlIO_close(newprlIO); - } -} -#endif - - ret = perl_parse(prober, xs_init, argc, argv, NULL); - - if (ret != 0) { - const char * errmsg = "Unknown error"; - if (SvTRUE(ERRSV)) - errmsg = SvPVutf8_nolen(ERRSV); - purple_debug_error("perl", "Unable to parse plugin %s (%d:%s)\n", - plugin->path, ret, errmsg); - status = FALSE; - goto cleanup; - } - - ret = perl_run(prober); - - if (ret != 0) { - const char * errmsg = "Unknown error"; - if (SvTRUE(ERRSV)) - errmsg = SvPVutf8_nolen(ERRSV); - purple_debug_error("perl", "Unable to run perl interpreter on plugin %s (%d:%s)\n", - plugin->path, ret, errmsg); - status = FALSE; - goto cleanup; - } - - plugin_info = perl_get_hv("PLUGIN_INFO", FALSE); - - if (plugin_info == NULL) - status = FALSE; - else if (!hv_exists(plugin_info, "perl_api_version", - strlen("perl_api_version")) || - !hv_exists(plugin_info, "name", strlen("name")) || - !hv_exists(plugin_info, "load", strlen("load"))) { - /* Not a valid plugin. */ - - status = FALSE; - } else { - SV **key; - int perl_api_ver; - - key = hv_fetch(plugin_info, "perl_api_version", - strlen("perl_api_version"), 0); - - perl_api_ver = SvIV(*key); - - if (perl_api_ver != 2) - status = FALSE; - else { - PurplePluginInfo *info; - PurplePerlScript *gps; - char *basename; - - info = g_new0(PurplePluginInfo, 1); - gps = g_new0(PurplePerlScript, 1); - - info->magic = PURPLE_PLUGIN_MAGIC; - info->major_version = PURPLE_MAJOR_VERSION; - info->minor_version = PURPLE_MINOR_VERSION; - info->type = PURPLE_PLUGIN_STANDARD; - - info->dependencies = g_list_append(info->dependencies, - PERL_PLUGIN_ID); - - gps->plugin = plugin; - - basename = g_path_get_basename(plugin->path); - purple_perl_normalize_script_name(basename); - gps->package = g_strdup_printf("Purple::Script::%s", - basename); - g_free(basename); - - /* We know this one exists. */ - key = hv_fetch(plugin_info, "name", strlen("name"), 0); - info->name = g_strdup(SvPVutf8_nolen(*key)); - /* Set id here in case we don't find one later. */ - info->id = g_strdup(info->name); - -#ifdef PURPLE_GTKPERL - if ((key = hv_fetch(plugin_info, "GTK_UI", - strlen("GTK_UI"), 0))) - info->ui_requirement = PURPLE_GTK_PLUGIN_TYPE; -#endif - - if ((key = hv_fetch(plugin_info, "url", - strlen("url"), 0))) - info->homepage = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "author", - strlen("author"), 0))) - info->author = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "summary", - strlen("summary"), 0))) - info->summary = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "description", - strlen("description"), 0))) - info->description = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "version", - strlen("version"), 0))) - info->version = g_strdup(SvPVutf8_nolen(*key)); - - /* We know this one exists. */ - key = hv_fetch(plugin_info, "load", strlen("load"), 0); - gps->load_sub = g_strdup_printf("%s::%s", gps->package, - SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "unload", - strlen("unload"), 0))) - gps->unload_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "id", - strlen("id"), 0))) { - g_free(info->id); - info->id = g_strdup_printf("perl-%s", - SvPVutf8_nolen(*key)); - } - - /********************************************************/ - /* Only one of the next two options should be present */ - /* */ - /* prefs_info - Uses non-GUI (read GTK) purple API calls */ - /* and creates a PurplePluginPrefInfo type. */ - /* */ - /* gtk_prefs_info - Requires gtk2-perl be installed by */ - /* the user and he must create a */ - /* GtkWidget the user and he must */ - /* create a GtkWidget representing the */ - /* plugin preferences page. */ - /********************************************************/ - if ((key = hv_fetch(plugin_info, "prefs_info", - strlen("prefs_info"), 0))) { - /* key now is the name of the Perl sub that - * will create a frame for us */ - gps->prefs_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - info->prefs_info = &ui_info; - } - -#ifdef PURPLE_GTKPERL - if ((key = hv_fetch(plugin_info, "gtk_prefs_info", - strlen("gtk_prefs_info"), 0))) { - /* key now is the name of the Perl sub that - * will create a frame for us */ - gps->gtk_prefs_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - info->ui_info = >k_ui_info; - } -#endif - - if ((key = hv_fetch(plugin_info, "plugin_action_sub", - strlen("plugin_action_sub"), 0))) { - gps->plugin_action_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - info->actions = purple_perl_plugin_actions; - } - - plugin->info = info; - info->extra_info = gps; - - status = purple_plugin_register(plugin); - } - } - - cleanup: - PL_perl_destruct_level = 1; - PERL_SET_CONTEXT(prober); - perl_destruct(prober); - perl_free(prober); - return status; -} - -static gboolean -load_perl_plugin(PurplePlugin *plugin) -{ - PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info; - gboolean loaded = TRUE; - char *atmp[3] = { plugin->path, NULL, NULL }; - - if (gps == NULL || gps->load_sub == NULL) - return FALSE; - - purple_debug(PURPLE_DEBUG_INFO, "perl", "Loading perl script\n"); - - if (my_perl == NULL) - perl_init(); - - plugin->handle = gps; - - atmp[1] = gps->package; - - PERL_SET_CONTEXT(my_perl); - execute_perl("Purple::PerlLoader::load_n_eval", 2, atmp); - - { - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, - "Purple::Plugin"))); - PUTBACK; - - perl_call_pv(gps->load_sub, G_EVAL | G_SCALAR); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl function %s exited abnormally: %s\n", - gps->load_sub, SvPVutf8_nolen(ERRSV)); - loaded = FALSE; - } - - PUTBACK; - FREETMPS; - LEAVE; - } - - return loaded; -} - -static void -destroy_package(const char *package) -{ - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - - ENTER; - SAVETMPS; - - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVpv(package, 0))); - PUTBACK; - - perl_call_pv("Purple::PerlLoader::destroy_package", - G_VOID | G_EVAL | G_DISCARD); - - SPAGAIN; - - PUTBACK; - FREETMPS; - LEAVE; -} - -static gboolean -unload_perl_plugin(PurplePlugin *plugin) -{ - PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info; - - if (gps == NULL) - return FALSE; - - purple_debug(PURPLE_DEBUG_INFO, "perl", "Unloading perl script\n"); - - if (gps->unload_sub != NULL) { - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, - "Purple::Plugin"))); - PUTBACK; - - perl_call_pv(gps->unload_sub, G_EVAL | G_SCALAR); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl function %s exited abnormally: %s\n", - gps->unload_sub, SvPVutf8_nolen(ERRSV)); - } - - PUTBACK; - FREETMPS; - LEAVE; - } - - purple_perl_cmd_clear_for_plugin(plugin); - purple_perl_signal_clear_for_plugin(plugin); - purple_perl_timeout_clear_for_plugin(plugin); - purple_perl_pref_cb_clear_for_plugin(plugin); - - destroy_package(gps->package); - - return TRUE; -} - -static void -destroy_perl_plugin(PurplePlugin *plugin) -{ - if (plugin->info != NULL) { - PurplePerlScript *gps; - - g_free(plugin->info->name); - g_free(plugin->info->id); - g_free(plugin->info->homepage); - g_free(plugin->info->author); - g_free(plugin->info->summary); - g_free(plugin->info->description); - g_free(plugin->info->version); - - gps = (PurplePerlScript *)plugin->info->extra_info; - if (gps != NULL) { - g_free(gps->package); - g_free(gps->load_sub); - g_free(gps->unload_sub); - g_free(gps->prefs_sub); -#ifdef PURPLE_GTKPERL - g_free(gps->gtk_prefs_sub); -#endif - g_free(gps->plugin_action_sub); - g_free(gps); - plugin->info->extra_info = NULL; - } - - g_free(plugin->info); - plugin->info = NULL; - } -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - perl_end(); - - return TRUE; -} - -static PurplePluginLoaderInfo loader_info = -{ - NULL, /**< exts */ - probe_perl_plugin, /**< probe */ - load_perl_plugin, /**< load */ - unload_perl_plugin, /**< unload */ - destroy_perl_plugin, /**< destroy */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_LOADER, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - PERL_PLUGIN_ID, /**< id */ - N_("Perl Plugin Loader"), /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Provides support for loading perl plugins."), /**< summary */ - N_("Provides support for loading perl plugins."), /**< description */ - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &loader_info, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - loader_info.exts = g_list_append(loader_info.exts, "pl"); -} - -#ifdef __SUNPRO_C -#pragma init (my_init) -#else -void __attribute__ ((constructor)) my_init(void); -#endif - -void -my_init(void) -{ - /* Mostly evil hack... puts perl.so's symbols in the global table but - * does not create a circular dependency because g_module_open will - * only open the library once. */ - /* Do we need to keep track of the returned GModule here so that we - * can g_module_close it when this plugin gets unloaded? - * At the moment I don't think this plugin can ever get unloaded but - * in case that becomes possible this wants to get noted. */ - g_module_open("perl.so", 0); -} - -PURPLE_INIT_PLUGIN(perl, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,654 +0,0 @@ -#include "debug.h" -#include "value.h" - -#include "perl-common.h" - -extern PerlInterpreter *my_perl; - -static GHashTable *object_stashes = NULL; - -void purple_perl_normalize_script_name(char *name) -{ - char *c; - - c = strrchr(name, '.'); - - if (c != NULL) - *c = '\0'; - - for (c = name; *c != '\0'; c++) { - if (*c != '_' && !g_ascii_isalnum(*c)) - *c = '_'; - } -} - -static int -magic_free_object(pTHX_ SV *sv, MAGIC *mg) -{ - sv_setiv(sv, 0); - - return 0; -} - -static MGVTBL vtbl_free_object = -{ - 0, 0, 0, 0, magic_free_object, 0, 0 -#if PERL_API_REVISION > 5 || (PERL_API_REVISION == 5 && PERL_API_VERSION >= 10) - , 0 -#endif -}; - -static SV * -create_sv_ptr(void *object) -{ - SV *sv; - - sv = newSViv((IV)object); - - sv_magic(sv, NULL, '~', NULL, 0); - - SvMAGIC(sv)->mg_private = 0x1551; /* HF */ - SvMAGIC(sv)->mg_virtual = &vtbl_free_object; - - return sv; -} - -SV * -newSVGChar(const char *str) -{ - SV *sv; - - if (str == NULL) - return &PL_sv_undef; - - sv = newSVpv(str, 0); - SvUTF8_on(sv); - - return sv; -} - -SV * -purple_perl_bless_object(void *object, const char *stash_name) -{ - HV *stash; - HV *hv; - - if (object == NULL) - return NULL; - - if (object_stashes == NULL) { - object_stashes = g_hash_table_new(g_direct_hash, g_direct_equal); - } - - stash = gv_stashpv(stash_name, 1); - - hv = newHV(); - hv_store(hv, "_purple", 7, create_sv_ptr(object), 0); - - return sv_bless(newRV_noinc((SV *)hv), stash); -} - -gboolean -purple_perl_is_ref_object(SV *o) -{ - SV **sv; - HV *hv; - - hv = hvref(o); - - if (hv != NULL) { - sv = hv_fetch(hv, "_purple", 7, 0); - - if (sv != NULL) - return TRUE; - } - - return FALSE; -} - -void * -purple_perl_ref_object(SV *o) -{ - SV **sv; - HV *hv; - void *p; - - if (o == NULL) - return NULL; - - hv = hvref(o); - - if (hv == NULL) - return NULL; - - sv = hv_fetch(hv, "_purple", 7, 0); - - if (sv == NULL) - croak("variable is damaged"); - - p = GINT_TO_POINTER(SvIV(*sv)); - - return p; -} - -/* - 2003/02/06: execute_perl modified by Mark Doliner - Pass parameters by pushing them onto the stack rather than - passing an array of strings. This way, perl scripts can - modify the parameters and we can get the changed values - and then shoot ourselves. I mean, uh, use them. - - 2001/06/14: execute_perl replaced by Martin Persson - previous use of perl_eval leaked memory, replaced with - a version that uses perl_call instead - - 30/11/2002: execute_perl modified by Eric Timme - args changed to char** so that we can have preparsed - arguments again, and many headaches ensued! This essentially - means we replaced one hacked method with a messier hacked - method out of perceived necessity. Formerly execute_perl - required a single char_ptr, and it would insert it into an - array of character pointers and NULL terminate the new array. - Now we have to pass in pre-terminated character pointer arrays - to accomodate functions that want to pass in multiple arguments. - - Previously arguments were preparsed because an argument list - was constructed in the form 'arg one','arg two' and was - executed via a call like &funcname(arglist) (see .59.x), so - the arglist was magically pre-parsed because of the method. - With Martin Persson's change to perl_call we now need to - use a null terminated list of character pointers for arguments - if we wish them to be parsed. Lacking a better way to allow - for both single arguments and many I created a NULL terminated - array in every function that called execute_perl and passed - that list into the function. In the former version a single - character pointer was passed in, and was placed into an array - of character pointers with two elements, with a NULL element - tacked onto the back, but this method no longer seemed prudent. - - Enhancements in the future might be to get rid of pre-declaring - the array sizes? I am not comfortable enough with this - subject to attempt it myself and hope it to stand the test - of time. -*/ -int -execute_perl(const char *function, int argc, char **args) -{ - int count = 0, i, ret_value = 1; - SV *sv_args[argc]; - dSP; - PERL_SET_CONTEXT(my_perl); - /* - * Set up the perl environment, push arguments onto the - * perl stack, then call the given function - */ - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - for (i = 0; i < argc; i++) { - if (args[i]) { - sv_args[i] = sv_2mortal(newSVpv(args[i], 0)); - XPUSHs(sv_args[i]); - } - } - - PUTBACK; - PERL_SET_CONTEXT(my_perl); - count = call_pv(function, G_EVAL | G_SCALAR); - SPAGAIN; - - /* - * Check for "die," make sure we have 1 argument, and set our - * return value. - */ - if (SvTRUE(ERRSV)) { - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl function %s exited abnormally: %s\n", - function, SvPVutf8_nolen(ERRSV)); - (void)POPs; - } else if (count != 1) { - /* - * This should NEVER happen. G_SCALAR ensures that we WILL - * have 1 parameter. - */ - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl error from %s: expected 1 return value, " - "but got %d\n", function, count); - } else - ret_value = POPi; - - /* Check for changed arguments */ - for (i = 0; i < argc; i++) { - if (args[i] && strcmp(args[i], SvPVX(sv_args[i]))) { - /* - * Shizzel. So the perl script changed one of the parameters, - * and we want this change to affect the original parameters. - * args[i] is just a temporary little list of pointers. We don't - * want to free args[i] here because the new parameter doesn't - * overwrite the data that args[i] points to. That is done by - * the function that called execute_perl. I'm not explaining this - * very well. See, it's aggregate... Oh, but if 2 perl scripts - * both modify the data, _that's_ a memleak. This is really kind - * of hackish. I should fix it. Look how long this comment is. - * Holy crap. - */ - args[i] = g_strdup(SvPVutf8_nolen(sv_args[i])); - } - } - - PUTBACK; - FREETMPS; - LEAVE; - - return ret_value; -} - -#if 0 -gboolean -purple_perl_value_from_sv(PurpleValue *value, SV *sv) -{ - switch (purple_value_get_type(value)) - { - case PURPLE_TYPE_CHAR: - if ((tmp = SvGChar(sv)) != NULL) - purple_value_set_char(value, tmp[0]); - else - return FALSE; - break; - - case PURPLE_TYPE_UCHAR: - if ((tmp = SvPV_nolen(sv)) != NULL) - purple_value_set_uchar(value, tmp[0]); - else - return FALSE; - break; - - case PURPLE_TYPE_BOOLEAN: - purple_value_set_boolean(value, SvTRUE(sv)); - break; - - case PURPLE_TYPE_INT: - purple_value_set_int(value, SvIV(sv)); - break; - - case PURPLE_TYPE_UINT: - purple_value_set_uint(value, SvIV(sv)); - break; - - case PURPLE_TYPE_LONG: - purple_value_set_long(value, SvIV(sv)); - break; - - case PURPLE_TYPE_ULONG: - purple_value_set_ulong(value, SvIV(sv)); - break; - - case PURPLE_TYPE_INT64: - purple_value_set_int64(value, SvIV(sv)); - break; - - case PURPLE_TYPE_UINT64: - purple_value_set_uint64(value, SvIV(sv)); - break; - - case PURPLE_TYPE_STRING: - purple_value_set_string(value, SvGChar(sv)); - break; - - case PURPLE_TYPE_POINTER: - purple_value_set_pointer(value, (void *)SvIV(sv)); - break; - - case PURPLE_TYPE_BOXED: - if (!strcmp(purple_value_get_specific_type(value), "SV")) - purple_value_set_boxed(value, (sv == &PL_sv_undef ? NULL : sv)); - else - purple_value_set_boxed(value, sv); - break; - - default: - return FALSE; - } - - return TRUE; -} - -SV * -purple_perl_sv_from_value(const PurpleValue *value, va_list list) -{ - switch (purple_value_get_type(value)) - { - case PURPLE_TYPE_BOOLEAN: - return newSViv(purple_value_get_boolean(value)); - break; - - case PURPLE_TYPE_INT: - return newSViv(purple_value_get_int(value)); - break; - - case PURPLE_TYPE_UINT: - return newSVuv(purple_value_get_uint(value)); - break; - - case PURPLE_TYPE_LONG: - return newSViv(purple_value_get_long(value)); - break; - - case PURPLE_TYPE_ULONG: - return newSVuv(purple_value_get_ulong(value)); - break; - - case PURPLE_TYPE_INT64: - return newSViv(purple_value_get_int64(value)); - break; - - case PURPLE_TYPE_UINT64: - return newSVuv(purple_value_get_int64(value)); - break; - - case PURPLE_TYPE_STRING: - return newSVGChar(purple_value_get_string(value)); - break; - - case PURPLE_TYPE_POINTER: - return newSViv((IV)purple_value_get_pointer(value)); - break; - - case PURPLE_TYPE_BOXED: - if (!strcmp(purple_value_get_specific_type(value), "SV")) - { - SV *sv = (SV *)purple_perl_get_boxed(value); - - return (sv == NULL ? &PL_sv_undef : sv); - } - - /* Uh.. I dunno. Try this? */ - return sv_2mortal(purple_perl_bless_object( - purple_perl_get_boxed(value), - purple_value_get_specific_type(value))); - - default: - return FALSE; - } - - return TRUE; -} -#endif - -void * -purple_perl_data_from_sv(PurpleValue *value, SV *sv) -{ - - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: return (void *)SvIV(sv); - case PURPLE_TYPE_INT: return (void *)SvIV(sv); - case PURPLE_TYPE_UINT: return (void *)SvUV(sv); - case PURPLE_TYPE_LONG: return (void *)SvIV(sv); - case PURPLE_TYPE_ULONG: return (void *)SvUV(sv); - case PURPLE_TYPE_INT64: return (void *)SvIV(sv); - case PURPLE_TYPE_UINT64: return (void *)SvUV(sv); - case PURPLE_TYPE_STRING: return g_strdup(SvPVutf8_nolen(sv)); - case PURPLE_TYPE_POINTER: return (void *)SvIV(sv); - case PURPLE_TYPE_BOXED: return (void *)SvIV(sv); - - default: - return NULL; - } - - return NULL; -} - -static SV * -purple_perl_sv_from_subtype(const PurpleValue *value, void *arg) -{ - const char *stash = "Purple"; /* ? */ - - switch (purple_value_get_subtype(value)) { - case PURPLE_SUBTYPE_ACCOUNT: - stash = "Purple::Account"; - break; - case PURPLE_SUBTYPE_BLIST: - stash = "Purple::BuddyList"; - break; - case PURPLE_SUBTYPE_BLIST_BUDDY: - stash = "Purple::BuddyList::Buddy"; - break; - case PURPLE_SUBTYPE_BLIST_GROUP: - stash = "Purple::BuddyList::Group"; - break; - case PURPLE_SUBTYPE_BLIST_CHAT: - stash = "Purple::BuddyList::Chat"; - break; - case PURPLE_SUBTYPE_BUDDY_ICON: - stash = "Purple::Buddy::Icon"; - break; - case PURPLE_SUBTYPE_CONNECTION: - stash = "Purple::Connection"; - break; - case PURPLE_SUBTYPE_CONVERSATION: - stash = "Purple::Conversation"; - break; - case PURPLE_SUBTYPE_PLUGIN: - stash = "Purple::Plugin"; - break; - case PURPLE_SUBTYPE_BLIST_NODE: - stash = "Purple::BuddyList::Node"; - break; - case PURPLE_SUBTYPE_CIPHER: - stash = "Purple::Cipher"; - break; - case PURPLE_SUBTYPE_STATUS: - stash = "Purple::Status"; - break; - case PURPLE_SUBTYPE_SAVEDSTATUS: - stash = "Purple::SavedStatus"; - break; - case PURPLE_SUBTYPE_LOG: - stash = "Purple::Log"; - break; - case PURPLE_SUBTYPE_XFER: - stash = "Purple::Xfer"; - break; - case PURPLE_SUBTYPE_XMLNODE: - stash = "Purple::XMLNode"; - break; - case PURPLE_SUBTYPE_USERINFO: - stash = "Purple::NotifyUserInfo"; - break; - case PURPLE_SUBTYPE_STORED_IMAGE: - stash = "Purple::StoredImage"; - break; - case PURPLE_SUBTYPE_CERTIFICATEPOOL: - stash = "Purple::Certificate::Pool"; - break; - case PURPLE_SUBTYPE_UNKNOWN: - stash = "Purple::Unknown"; - break; - } - - return sv_2mortal(purple_perl_bless_object(arg, stash)); -} - -SV * -purple_perl_sv_from_vargs(const PurpleValue *value, va_list *args, void ***copy_arg) -{ - if (purple_value_is_outgoing(value)) { - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_SUBTYPE: - if ((*copy_arg = va_arg(*args, void **)) == NULL) - return &PL_sv_undef; - - return purple_perl_sv_from_subtype(value, *(void **)*copy_arg); - - case PURPLE_TYPE_BOOLEAN: - if ((*copy_arg = (void *)va_arg(*args, gboolean *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(gboolean *)*copy_arg); - - case PURPLE_TYPE_INT: - if ((*copy_arg = (void *)va_arg(*args, int *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(int *)*copy_arg); - - case PURPLE_TYPE_UINT: - if ((*copy_arg = (void *)va_arg(*args, unsigned int *)) == NULL) - return &PL_sv_undef; - - return newSVuv(*(unsigned int *)*copy_arg); - - case PURPLE_TYPE_LONG: - if ((*copy_arg = (void *)va_arg(*args, long *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(long *)*copy_arg); - - case PURPLE_TYPE_ULONG: - if ((*copy_arg = (void *)va_arg(*args, - unsigned long *)) == NULL) - return &PL_sv_undef; - - return newSVuv(*(unsigned long *)*copy_arg); - - case PURPLE_TYPE_INT64: - if ((*copy_arg = (void *)va_arg(*args, gint64 *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(gint64 *)*copy_arg); - - case PURPLE_TYPE_UINT64: - if ((*copy_arg = (void *)va_arg(*args, guint64 *)) == NULL) - return &PL_sv_undef; - - return newSVuv(*(guint64 *)*copy_arg); - - case PURPLE_TYPE_STRING: - if ((*copy_arg = (void *)va_arg(*args, char **)) == NULL) - return &PL_sv_undef; - - return newSVGChar(*(char **)*copy_arg); - - case PURPLE_TYPE_POINTER: - if ((*copy_arg = va_arg(*args, void **)) == NULL) - return &PL_sv_undef; - - return newSViv((IV)*(void **)*copy_arg); - - case PURPLE_TYPE_BOXED: - /* Uh.. I dunno. Try this? */ - if ((*copy_arg = va_arg(*args, void **)) == NULL) - return &PL_sv_undef; - - return sv_2mortal(purple_perl_bless_object( - *(void **)*copy_arg, - purple_value_get_specific_type(value))); - - default: - /* If this happens, things are going to get screwed up... */ - return NULL; - } - } else { - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_SUBTYPE: - if ((*copy_arg = va_arg(*args, void *)) == NULL) - return &PL_sv_undef; - - return purple_perl_sv_from_subtype(value, *copy_arg); - - case PURPLE_TYPE_BOOLEAN: - *copy_arg = GINT_TO_POINTER( va_arg(*args, gboolean) ); - - return newSViv((gboolean)GPOINTER_TO_INT(*copy_arg)); - - case PURPLE_TYPE_INT: - *copy_arg = GINT_TO_POINTER( va_arg(*args, int) ); - - return newSViv(GPOINTER_TO_INT(*copy_arg)); - - case PURPLE_TYPE_UINT: - *copy_arg = GUINT_TO_POINTER(va_arg(*args, unsigned int)); - - return newSVuv(GPOINTER_TO_UINT(*copy_arg)); - - case PURPLE_TYPE_LONG: - *copy_arg = (void *)va_arg(*args, long); - - return newSViv((long)*copy_arg); - - case PURPLE_TYPE_ULONG: - *copy_arg = (void *)va_arg(*args, unsigned long); - - return newSVuv((unsigned long)*copy_arg); - - case PURPLE_TYPE_INT64: -#if 0 - /* XXX This yells and complains. */ - *copy_arg = va_arg(*args, gint64); - - return newSViv(*copy_arg); -#endif - break; - - case PURPLE_TYPE_UINT64: - /* XXX This also yells and complains. */ -#if 0 - *copy_arg = (void *)va_arg(*args, guint64); - - return newSVuv(*copy_arg); -#endif - break; - - case PURPLE_TYPE_STRING: - if ((*copy_arg = (void *)va_arg(*args, char *)) == NULL) - return &PL_sv_undef; - - return newSVGChar((char *)*copy_arg); - - case PURPLE_TYPE_POINTER: - if ((*copy_arg = (void *)va_arg(*args, void *)) == NULL) - return &PL_sv_undef; - - return newSViv((IV)*copy_arg); - - case PURPLE_TYPE_BOXED: - /* Uh.. I dunno. Try this? */ - if ((*copy_arg = (void *)va_arg(*args, void *)) == NULL) - return &PL_sv_undef; - - return sv_2mortal(purple_perl_bless_object(*copy_arg, - purple_value_get_specific_type(value))); - - default: - /* If this happens, things are going to get screwed up... */ - return NULL; - } - } - - return NULL; -} - -SV *purple_perl_sv_from_fun(PurplePlugin *plugin, SV *callback) -{ - SV *sv = NULL; - - if (SvTYPE(callback) == SVt_RV) { - SV *cbsv = SvRV(callback); - - if (SvTYPE(cbsv) == SVt_PVCV) { - sv = newSVsv(callback); - } - } else if (SvTYPE(callback) == SVt_PV) { - PurplePerlScript *gps; - - gps = (PurplePerlScript *)PURPLE_PLUGIN_LOADER_INFO(plugin); - sv = newSVpvf("%s::%s", gps->package, SvPV_nolen(callback)); - } else { - purple_debug_warning("perl", "Callback not a valid type, only strings and coderefs allowed.\n"); - } - - return sv; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#ifndef _PURPLE_PERL_COMMON_H_ -#define _PURPLE_PERL_COMMON_H_ - -#include -#ifdef _WIN32 -#undef pipe -#endif -#include -#include -#include - -/* XXX: perl defines it's own _ but I think it's safe to undef it */ -#undef _ -/* Dirty hack to prevent the win32 libc compat stuff from interfering with the Perl internal stuff */ -#ifdef _WIN32 -#define _WIN32DEP_H_ -#endif -#include "internal.h" -#ifdef _WIN32 -#undef _WIN32DEP_H_ -#endif -#include "plugin.h" -#include "value.h" - -#define is_hvref(o) \ - ((o) && SvROK(o) && SvRV(o) && (SvTYPE(SvRV(o)) == SVt_PVHV)) - -#define hvref(o) \ - (is_hvref(o) ? (HV *)SvRV(o) : NULL); - -#define PURPLE_PERL_BOOT_PROTO(x) \ - void boot_Purple__##x(pTHX_ CV *cv); - -#define PURPLE_PERL_BOOT(x) \ - purple_perl_callXS(boot_Purple__##x, cv, mark) - -typedef struct -{ - PurplePlugin *plugin; - char *package; - char *load_sub; - char *unload_sub; - char *prefs_sub; -#ifdef PURPLE_GTKPERL - char *gtk_prefs_sub; -#endif - char *plugin_action_sub; -} PurplePerlScript; - -void purple_perl_normalize_script_name(char *name); - -SV *newSVGChar(const char *str); - -void purple_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark); -void purple_perl_bless_plain(const char *stash, void *object); -SV *purple_perl_bless_object(void *object, const char *stash); -gboolean purple_perl_is_ref_object(SV *o); -void *purple_perl_ref_object(SV *o); - -int execute_perl(const char *function, int argc, char **args); - -#if 0 -gboolean purple_perl_value_from_sv(PurpleValue *value, SV *sv); -SV *purple_perl_sv_from_value(const PurpleValue *value); -#endif - -void *purple_perl_data_from_sv(PurpleValue *value, SV *sv); -SV *purple_perl_sv_from_vargs(const PurpleValue *value, va_list *args, - void ***copy_arg); -SV *purple_perl_sv_from_fun(PurplePlugin *plugin, SV *callback); -#endif /* _PURPLE_PERL_COMMON_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,847 +0,0 @@ -#include "perl-common.h" -#include "perl-handlers.h" - -#include "debug.h" -#include "signals.h" - -extern PerlInterpreter *my_perl; -static GSList *cmd_handlers = NULL; -static GSList *signal_handlers = NULL; -static GSList *timeout_handlers = NULL; -static GSList *pref_handlers = NULL; - -/* perl < 5.8.0 doesn't define PERL_MAGIC_ext */ -#ifndef PERL_MAGIC_ext -#define PERL_MAGIC_ext '~' -#endif - -void -purple_perl_plugin_action_cb(PurplePluginAction *action) -{ - SV **callback; - HV *hv = NULL; - gchar *hvname; - PurplePlugin *plugin; - PurplePerlScript *gps; - dSP; - - plugin = action->plugin; - gps = (PurplePerlScript *)plugin->info->extra_info; - hvname = g_strdup_printf("%s::plugin_actions", gps->package); - hv = get_hv(hvname, FALSE); - g_free(hvname); - - if (hv == NULL) - croak("No plugin_actions hash found in \"%s\" plugin.", purple_plugin_get_name(plugin)); - - ENTER; - SAVETMPS; - - callback = hv_fetch(hv, action->label, strlen(action->label), 0); - - if (callback == NULL || *callback == NULL) - croak("No plugin_action function named \"%s\" in \"%s\" plugin.", action->label, purple_plugin_get_name(plugin)); - - PUSHMARK(sp); - XPUSHs(purple_perl_bless_object(gps->plugin, "Purple::Plugin")); - PUTBACK; - - call_sv(*callback, G_EVAL | G_VOID | G_DISCARD); - - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin action function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - PUTBACK; - FREETMPS; - LEAVE; -} - -GList * -purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context) -{ - GList *l = NULL; - PurplePerlScript *gps; - int i = 0, count = 0; - dSP; - - gps = plugin->info->extra_info; - - ENTER; - SAVETMPS; - - PUSHMARK(SP); - XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, "Purple::Plugin"))); - /* XXX This *will* cease working correctly if context gets changed to - * ever be able to hold anything other than a PurpleConnection */ - if (context != NULL) - XPUSHs(sv_2mortal(purple_perl_bless_object(context, - "Purple::Connection"))); - else - XPUSHs(&PL_sv_undef); - PUTBACK; - - count = call_pv(gps->plugin_action_sub, G_EVAL | G_ARRAY); - - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin actions lookup exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - if (count == 0) - croak("The plugin_actions sub didn't return anything.\n"); - - for (i = 0; i < count; i++) { - SV *sv; - PurplePluginAction *act; - - sv = POPs; - act = purple_plugin_action_new(SvPVutf8_nolen(sv), purple_perl_plugin_action_cb); - l = g_list_prepend(l, act); - } - - PUTBACK; - FREETMPS; - LEAVE; - - return l; -} - -#ifdef PURPLE_GTKPERL -GtkWidget * -purple_perl_gtk_get_plugin_frame(PurplePlugin *plugin) -{ - SV * sv; - int count; - MAGIC *mg; - GtkWidget *ret; - PurplePerlScript *gps; - dSP; - - gps = plugin->info->extra_info; - - ENTER; - SAVETMPS; - - count = call_pv(gps->gtk_prefs_sub, G_EVAL | G_SCALAR | G_NOARGS); - if (count != 1) - croak("call_pv: Did not return the correct number of values.\n"); - - /* the frame was created in a perl sub and is returned */ - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl gtk plugin frame init exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - /* We have a Gtk2::Frame on top of the stack */ - sv = POPs; - - /* The magic field hides the pointer to the actual GtkWidget */ - mg = mg_find(SvRV(sv), PERL_MAGIC_ext); - ret = (GtkWidget *)mg->mg_ptr; - - PUTBACK; - FREETMPS; - LEAVE; - - return ret; -} -#endif - -PurplePluginPrefFrame * -purple_perl_get_plugin_frame(PurplePlugin *plugin) -{ - /* Sets up the Perl Stack for our call back into the script to run the - * plugin_pref... sub */ - int count; - PurplePerlScript *gps; - PurplePluginPrefFrame *ret_frame; - dSP; - - gps = (PurplePerlScript *)plugin->info->extra_info; - - ENTER; - SAVETMPS; - /* Some perl magic to run perl_plugin_pref_frame_SV perl sub and - * return the frame */ - PUSHMARK(SP); - PUTBACK; - - count = call_pv(gps->prefs_sub, G_EVAL | G_SCALAR | G_NOARGS); - - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin prefs frame init exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - if (count != 1) - croak("call_pv: Did not return the correct number of values.\n"); - /* the frame was created in a perl sub and is returned */ - ret_frame = (PurplePluginPrefFrame *)purple_perl_ref_object(POPs); - - /* Tidy up the Perl stack */ - PUTBACK; - FREETMPS; - LEAVE; - - return ret_frame; -} - -static gboolean -destroy_timeout_handler(PurplePerlTimeoutHandler *handler) -{ - gboolean ret = FALSE; - - timeout_handlers = g_slist_remove(timeout_handlers, handler); - - if (handler->iotag > 0) - ret = purple_timeout_remove(handler->iotag); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler); - - return ret; -} - -static void -destroy_signal_handler(PurplePerlSignalHandler *handler) -{ - signal_handlers = g_slist_remove(signal_handlers, handler); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler->signal); - g_free(handler); -} - -static gboolean -perl_timeout_cb(gpointer data) -{ - PurplePerlTimeoutHandler *handler = data; - gboolean ret = FALSE; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs((SV *)handler->data); - PUTBACK; - call_sv(handler->callback, G_EVAL | G_SCALAR); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl timeout function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - ret = POPi; - - PUTBACK; - FREETMPS; - LEAVE; - - if (ret == FALSE) - destroy_timeout_handler(handler); - - return ret; -} - -typedef void *DATATYPE; - -static void * -perl_signal_cb(va_list args, void *data) -{ - PurplePerlSignalHandler *handler = data; - void *ret_val = NULL; - int i; - int count; - int value_count; - PurpleValue *ret_value, **values; - SV **sv_args; - DATATYPE **copy_args; - - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - purple_signal_get_values(handler->instance, handler->signal, - &ret_value, &value_count, &values); - - sv_args = g_new(SV *, value_count); - copy_args = g_new(void **, value_count); - - for (i = 0; i < value_count; i++) { - sv_args[i] = purple_perl_sv_from_vargs(values[i], -#ifdef VA_COPY_AS_ARRAY - args, -#else - (va_list*)&args, -#endif - ©_args[i]); - - XPUSHs(sv_args[i]); - } - - XPUSHs((SV *)handler->data); - - PUTBACK; - - if (ret_value != NULL) { - count = call_sv(handler->callback, G_EVAL | G_SCALAR); - - SPAGAIN; - - if (count != 1) - croak("Uh oh! call_sv returned %i != 1", i); - else - ret_val = purple_perl_data_from_sv(ret_value, POPs); - } else { - call_sv(handler->callback, G_EVAL | G_SCALAR); - - SPAGAIN; - } - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - /* See if any parameters changed. */ - for (i = 0; i < value_count; i++) { - if (purple_value_is_outgoing(values[i])) { - switch (purple_value_get_type(values[i])) { - case PURPLE_TYPE_BOOLEAN: - *((gboolean *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_INT: - *((int *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_UINT: - *((unsigned int *)copy_args[i]) = SvUV(sv_args[i]); - break; - - case PURPLE_TYPE_LONG: - *((long *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_ULONG: - *((unsigned long *)copy_args[i]) = SvUV(sv_args[i]); - break; - - case PURPLE_TYPE_INT64: - *((gint64 *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_UINT64: - *((guint64 *)copy_args[i]) = SvUV(sv_args[i]); - break; - - case PURPLE_TYPE_STRING: - if (!*((char **)copy_args[i]) || !SvPVX(sv_args[i]) || - strcmp(*((char **)copy_args[i]), SvPVX(sv_args[i]))) { - g_free(*((char **)copy_args[i])); - *((char **)copy_args[i]) = - g_strdup(SvPVutf8_nolen(sv_args[i])); - } - /* Clean up sv_args[i] - we're done with it */ - sv_2mortal(sv_args[i]); - break; - - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_BOXED: - *((void **)copy_args[i]) = (void *)SvIV(sv_args[i]); - break; - case PURPLE_TYPE_SUBTYPE: - *((void **)copy_args[i]) = purple_perl_ref_object(sv_args[i]); - break; - - default: - break; - } - - -#if 0 - *((void **)copy_args[i]) = purple_perl_data_from_sv(values[i], - sv_args[i]); -#endif - } - } - - PUTBACK; - FREETMPS; - LEAVE; - - g_free(sv_args); - g_free(copy_args); - - purple_debug_misc("perl", "ret_val = %p\n", ret_val); - - return ret_val; -} - -static PurplePerlSignalHandler * -find_signal_handler(PurplePlugin *plugin, void *instance, const char *signal) -{ - PurplePerlSignalHandler *handler; - GSList *l; - - for (l = signal_handlers; l != NULL; l = l->next) { - handler = l->data; - - if (handler->plugin == plugin && - handler->instance == instance && - !strcmp(handler->signal, signal)) { - return handler; - } - } - - return NULL; -} - -guint -purple_perl_timeout_add(PurplePlugin *plugin, int seconds, SV *callback, SV *data) -{ - PurplePerlTimeoutHandler *handler; - - if (plugin == NULL) { - croak("Invalid handle in adding perl timeout handler.\n"); - return 0; - } - - handler = g_new0(PurplePerlTimeoutHandler, 1); - - handler->plugin = plugin; - handler->callback = (callback != NULL && callback != &PL_sv_undef - ? newSVsv(callback) : NULL); - handler->data = (data != NULL && data != &PL_sv_undef - ? newSVsv(data) : NULL); - - timeout_handlers = g_slist_append(timeout_handlers, handler); - - handler->iotag = purple_timeout_add_seconds(seconds, perl_timeout_cb, handler); - - return handler->iotag; -} - -gboolean -purple_perl_timeout_remove(guint handle) -{ - PurplePerlTimeoutHandler *handler; - GSList *l, *l_next; - - for (l = timeout_handlers; l != NULL; l = l_next) { - handler = l->data; - l_next = l->next; - - if (handler->iotag == handle) - return destroy_timeout_handler(handler); - } - - purple_debug_info("perl", "No timeout handler found with handle %u.\n", - handle); - return FALSE; -} - -void -purple_perl_timeout_clear_for_plugin(PurplePlugin *plugin) -{ - PurplePerlTimeoutHandler *handler; - GSList *l, *l_next; - - for (l = timeout_handlers; l != NULL; l = l_next) { - handler = l->data; - l_next = l->next; - - if (handler->plugin == plugin) - destroy_timeout_handler(handler); - } -} - -void -purple_perl_timeout_clear(void) -{ - while (timeout_handlers != NULL) - destroy_timeout_handler(timeout_handlers->data); -} - -void -purple_perl_signal_connect(PurplePlugin *plugin, void *instance, - const char *signal, SV *callback, SV *data, - int priority) -{ - PurplePerlSignalHandler *handler; - - handler = g_new0(PurplePerlSignalHandler, 1); - handler->plugin = plugin; - handler->instance = instance; - handler->signal = g_strdup(signal); - handler->callback = (callback != NULL && - callback != &PL_sv_undef ? newSVsv(callback) - : NULL); - handler->data = (data != NULL && - data != &PL_sv_undef ? newSVsv(data) : NULL); - - signal_handlers = g_slist_append(signal_handlers, handler); - - purple_signal_connect_priority_vargs(instance, signal, plugin, - PURPLE_CALLBACK(perl_signal_cb), - handler, priority); -} - -void -purple_perl_signal_disconnect(PurplePlugin *plugin, void *instance, - const char *signal) -{ - PurplePerlSignalHandler *handler; - - handler = find_signal_handler(plugin, instance, signal); - - if (handler == NULL) { - croak("Invalid signal handler information in " - "disconnecting a perl signal handler.\n"); - return; - } - - destroy_signal_handler(handler); -} - -void -purple_perl_signal_clear_for_plugin(PurplePlugin *plugin) -{ - PurplePerlSignalHandler *handler; - GSList *l, *l_next; - - for (l = signal_handlers; l != NULL; l = l_next) { - l_next = l->next; - handler = l->data; - - if (handler->plugin == plugin) - destroy_signal_handler(handler); - } -} - -void -purple_perl_signal_clear(void) -{ - while (signal_handlers != NULL) - destroy_signal_handler(signal_handlers->data); -} - -static PurpleCmdRet -perl_cmd_cb(PurpleConversation *conv, const gchar *command, - gchar **args, gchar **error, void *data) -{ - int i = 0, count, ret_value = PURPLE_CMD_RET_OK; - SV *cmdSV, *tmpSV, *convSV; - PurplePerlCmdHandler *handler = data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - - /* Push the conversation onto the perl stack */ - convSV = sv_2mortal(purple_perl_bless_object(conv, "Purple::Conversation")); - XPUSHs(convSV); - - /* Push the command string onto the perl stack */ - cmdSV = newSVpv(command, 0); - cmdSV = sv_2mortal(cmdSV); - XPUSHs(cmdSV); - - /* Push the data onto the perl stack */ - XPUSHs((SV *)handler->data); - - /* Push any arguments we may have */ - for (i = 0; args[i] != NULL; i++) { - /* XXX The mortality of these created SV's should prevent - * memory issues, if I read/understood everything correctly... - */ - tmpSV = newSVpv(args[i], 0); - tmpSV = sv_2mortal(tmpSV); - XPUSHs(tmpSV); - } - - PUTBACK; - count = call_sv(handler->callback, G_EVAL | G_SCALAR); - - if (count != 1) - croak("call_sv: Did not return the correct number of values.\n"); - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin command function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - SPAGAIN; - - ret_value = POPi; - - PUTBACK; - FREETMPS; - LEAVE; - - return ret_value; -} - -PurpleCmdId -purple_perl_cmd_register(PurplePlugin *plugin, const gchar *command, - const gchar *args, PurpleCmdPriority priority, - PurpleCmdFlag flag, const gchar *prpl_id, SV *callback, - const gchar *helpstr, SV *data) -{ - PurplePerlCmdHandler *handler; - - handler = g_new0(PurplePerlCmdHandler, 1); - handler->plugin = plugin; - handler->cmd = g_strdup(command); - handler->prpl_id = g_strdup(prpl_id); - - if (callback != NULL && callback != &PL_sv_undef) - handler->callback = newSVsv(callback); - else - handler->callback = NULL; - - if (data != NULL && data != &PL_sv_undef) - handler->data = newSVsv(data); - else - handler->data = NULL; - - cmd_handlers = g_slist_append(cmd_handlers, handler); - - handler->id = purple_cmd_register(command, args, priority, flag, prpl_id, - PURPLE_CMD_FUNC(perl_cmd_cb), helpstr, - handler); - - return handler->id; -} - -static void -destroy_cmd_handler(PurplePerlCmdHandler *handler) -{ - purple_cmd_unregister(handler->id); - cmd_handlers = g_slist_remove(cmd_handlers, handler); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler->cmd); - g_free(handler->prpl_id); - g_free(handler); -} - -void -purple_perl_cmd_clear_for_plugin(PurplePlugin *plugin) -{ - PurplePerlCmdHandler *handler; - GSList *l, *l_next; - - for (l = cmd_handlers; l != NULL; l = l_next) { - handler = l->data; - l_next = l->next; - - if (handler->plugin == plugin) - destroy_cmd_handler(handler); - } -} - -static PurplePerlCmdHandler * -find_cmd_handler(PurpleCmdId id) -{ - PurplePerlCmdHandler *handler; - GSList *l; - - for (l = cmd_handlers; l != NULL; l = l->next) { - handler = (PurplePerlCmdHandler *)l->data; - - if (handler->id == id) - return handler; - } - - return NULL; -} - -void -purple_perl_cmd_unregister(PurpleCmdId id) -{ - PurplePerlCmdHandler *handler; - - handler = find_cmd_handler(id); - - if (handler == NULL) { - croak("Invalid command id in removing a perl command handler.\n"); - return; - } - - destroy_cmd_handler(handler); -} - -static void -perl_pref_cb(const char *name, PurplePrefType type, gconstpointer value, - gpointer data) -{ - PurplePerlPrefsHandler *handler = data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(newSVpv(name, 0))); - - XPUSHs(sv_2mortal(newSViv(type))); - - switch(type) { - case PURPLE_PREF_INT: - XPUSHs(sv_2mortal(newSViv(GPOINTER_TO_INT(value)))); - break; - case PURPLE_PREF_BOOLEAN: - XPUSHs((GPOINTER_TO_INT(value) == FALSE) ? &PL_sv_no : &PL_sv_yes); - break; - case PURPLE_PREF_STRING: - case PURPLE_PREF_PATH: - XPUSHs(sv_2mortal(newSVGChar(value))); - break; - case PURPLE_PREF_STRING_LIST: - case PURPLE_PREF_PATH_LIST: - { - AV* av = newAV(); - const GList *l = value; - - /* Append stuff backward to preserve order */ - while (l && l->next) l = l->next; - while (l) { - av_push(av, sv_2mortal(newSVGChar(l->data))); - l = l->prev; - } - XPUSHs(sv_2mortal(newRV_noinc((SV *) av))); - } break; - default: - case PURPLE_PREF_NONE: - XPUSHs(&PL_sv_undef); - break; - } - - XPUSHs((SV *)handler->data); - PUTBACK; - call_sv(handler->callback, G_EVAL | G_VOID | G_DISCARD); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl prefs callback function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - PUTBACK; - FREETMPS; - LEAVE; -} - -guint -purple_perl_prefs_connect_callback(PurplePlugin *plugin, const char *name, - SV *callback, SV *data) -{ - PurplePerlPrefsHandler *handler; - - if (plugin == NULL) { - croak("Invalid handle in adding perl prefs handler.\n"); - return 0; - } - - handler = g_new0(PurplePerlPrefsHandler, 1); - - handler->plugin = plugin; - handler->callback = (callback != NULL && callback != &PL_sv_undef - ? newSVsv(callback) : NULL); - handler->data = (data != NULL && data != &PL_sv_undef - ? newSVsv(data) : NULL); - - pref_handlers = g_slist_prepend(pref_handlers, handler); - - handler->iotag = purple_prefs_connect_callback(plugin, name, perl_pref_cb, handler); - - return handler->iotag; -} - -static void -destroy_prefs_handler(PurplePerlPrefsHandler *handler) -{ - pref_handlers = g_slist_remove(pref_handlers, handler); - - if (handler->iotag > 0) - purple_prefs_disconnect_callback(handler->iotag); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler); -} - -void purple_perl_prefs_disconnect_callback(guint callback_id) -{ - GSList *l, *l_next; - PurplePerlPrefsHandler *handler; - - for (l = pref_handlers; l != NULL; l = l_next) { - l_next = l->next; - handler = l->data; - - if (handler->iotag == callback_id) { - destroy_prefs_handler(handler); - return; - } - } - - purple_debug_info("perl", "No prefs handler found with handle %u.\n", - callback_id); -} - -void purple_perl_pref_cb_clear_for_plugin(PurplePlugin *plugin) -{ - GSList *l, *l_next; - PurplePerlPrefsHandler *handler; - - for (l = pref_handlers; l != NULL; l = l_next) { - l_next = l->next; - handler = l->data; - - if (handler->plugin == plugin) - destroy_prefs_handler(handler); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/perl-handlers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -#ifndef _PURPLE_PERL_HANDLERS_H_ -#define _PURPLE_PERL_HANDLERS_H_ - -#include "cmds.h" -#include "plugin.h" -#include "prefs.h" -#include "pluginpref.h" -#ifdef PURPLE_GTKPERL -#include "gtkplugin.h" -#include "gtkutils.h" -#endif - -typedef struct -{ - PurpleCmdId id; - SV *callback; - SV *data; - gchar *prpl_id; - gchar *cmd; - PurplePlugin *plugin; -} PurplePerlCmdHandler; - -typedef struct -{ - SV *callback; - SV *data; - PurplePlugin *plugin; - int iotag; - -} PurplePerlTimeoutHandler; - -typedef struct -{ - gchar *signal; - SV *callback; - SV *data; - void *instance; - PurplePlugin *plugin; - -} PurplePerlSignalHandler; - -typedef struct -{ - SV *callback; - SV *data; - PurplePlugin *plugin; - int iotag; - -} PurplePerlPrefsHandler; - -void purple_perl_plugin_action_cb(PurplePluginAction * gpa); -GList *purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context); - -PurplePluginPrefFrame *purple_perl_get_plugin_frame(PurplePlugin *plugin); - -#ifdef PURPLE_GTKPERL -GtkWidget *purple_perl_gtk_get_plugin_frame(PurplePlugin *plugin); -#endif - -guint purple_perl_timeout_add(PurplePlugin *plugin, int seconds, SV *callback, - SV *data); -gboolean purple_perl_timeout_remove(guint handle); -void purple_perl_timeout_clear_for_plugin(PurplePlugin *plugin); -void purple_perl_timeout_clear(void); - -void purple_perl_signal_connect(PurplePlugin *plugin, void *instance, - const char *signal, SV *callback, - SV *data, int priority); -void purple_perl_signal_disconnect(PurplePlugin *plugin, void *instance, - const char *signal); -void purple_perl_signal_clear_for_plugin(PurplePlugin *plugin); -void purple_perl_signal_clear(void); - -PurpleCmdId purple_perl_cmd_register(PurplePlugin *plugin, const gchar *cmd, - const gchar *args, PurpleCmdPriority priority, - PurpleCmdFlag flag, const gchar *prpl_id, - SV *callback, const gchar *helpstr, SV *data); -void purple_perl_cmd_unregister(PurpleCmdId id); -void purple_perl_cmd_clear_for_plugin(PurplePlugin *plugin); - -guint purple_perl_prefs_connect_callback(PurplePlugin *plugin, const char *name, SV *callback, SV *data); -void purple_perl_prefs_disconnect_callback(guint callback_id); -void purple_perl_pref_cb_clear_for_plugin(PurplePlugin *plugin); - -#endif /* _PURPLE_PERL_HANDLERS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/function_list.pl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/function_list.pl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/function_list.pl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/function_list.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -$MODULE_NAME = "List all Purple:: (and Pidgin::) functions"; -use Purple; -# Uncomment this to print the Pidgin:: functions as well. -#use Pidgin; - -# All the information Purple gets about our nifty plugin -%PLUGIN_INFO = ( - perl_api_version => 2, - name => "Perl: $MODULE_NAME", - version => "0.1", - summary => "Print to standard output all the functions under the Purple:: (and Pidgin::) packages", - description => "Print to standard output all the functions under the Purple:: (and Pidgin::) packages", - author => "Etan Reisner ", - url => "http://sourceforge.net/users/deryni9/", - id => "functionlist", - - load => "plugin_load", - unload => "plugin_unload" -); - -sub plugin_init { - return %PLUGIN_INFO; -} - -sub print_array { - my $array = shift; - - my @arr = sort @$array; - foreach $mod (@arr) { - my @sub; - - foreach $key (sort keys %{$mod}) { - if ($key =~ /::$/) { - push @sub, "$mod$key"; - } else { - print "$mod$key\n"; - } - } - print_array(\@sub); - } -} - -sub plugin_load { - my $plugin = shift; - my @purplearray; - my @pidginarray; - - foreach $key (sort keys %Purple::) { - if ($key =~ /::$/) { - push @purplearray, "Purple::$key"; - } else { - print "Purple::$key\n"; - } - } - print_array(\@purplearray); - - foreach $key (sort keys %Pidgin::) { - if ($key =~ /::$/) { - push @pidginarray, "Pidgin::$key"; - } else { - print "Pidgin::$key\n"; - } - } - print_array(\@pidginarray); -} - -sub plugin_unload { - my $plugin = shift; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/signals-test.pl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/signals-test.pl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/signals-test.pl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/perl/scripts/signals-test.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -$MODULE_NAME = "Signals Test Script in Perl"; - -use Purple; - -%PLUGIN_INFO = ( - perl_api_version => 2, - name => "Perl: $MODULE_NAME", - version => "0.1", - summary => "Signals Test plugin for the Perl interpreter.", - description => "Demonstrate the use of purple signals from " . - "a perl plugin.", - author => "Sadrul Habib Chowdhury ", - url => "http://developer.pidgin.im/wiki/sadrul/", - - load => "plugin_load", - unload => "plugin_unload" -); - -# Accounts -sub account_connecting_cb -{ - my $account = shift; - Purple::Debug::misc("signals test in perl", "account-connecting (" . $account->get_username() . ")\n"); -} - -# Buddylist -sub buddy_signed_on -{ - my $buddy = shift; - Purple::Debug::misc("signals test in perl", "buddy-signed-on (" . $buddy->get_name() . ")\n"); -} - -# Connections -sub signed_on -{ - my $conn = shift; - Purple::Debug::misc("signals test in perl", "signed-on (" . $conn->get_account()->get_username() . ")\n"); -} - -# Conversations -sub conv_received_msg -{ - my ($account, $sender, $message, $conv, $flags, $data) = @_; - Purple::Debug::misc("signals test in perl", "$data (" . $account->get_username() . ", $sender, $message, $flags)\n"); -} - -sub plugin_load -{ - my $plugin = shift; - - # Hook to the signals - - # Accounts - $act_handle = Purple::Accounts::get_handle(); - Purple::Signal::connect($act_handle, "account-connecting", $plugin, - \&account_connecting_cb, 0); - - # Buddy List - $blist = Purple::BuddyList::get_handle(); - Purple::Signal::connect($blist, "buddy-signed-on", $plugin, - \&buddy_signed_on, 0); - - # Connections - $conn = Purple::Connections::get_handle(); - Purple::Signal::connect($conn, "signed-on", $plugin, - \&signed_on, 0); - - # Conversations - $conv = Purple::Conversations::get_handle(); - Purple::Signal::connect($conv, "received-im-msg", $plugin, - \&conv_received_msg, "received im message"); - Purple::Signal::connect($conv, "received-chat-msg", $plugin, - \&conv_received_msg, "received chat message"); -} - -sub plugin_unload -{ - # Nothing to do here for this plugin. -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/pluginpref_example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/pluginpref_example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/pluginpref_example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/pluginpref_example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -/* - * PluginPref Example Plugin - * - * Copyright (C) 2004, Gary Kramlich - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#include "internal.h" - -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" -#include "version.h" - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) { - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_label("boolean"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/bool", - "boolean pref"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_label("integer"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/int", - "integer pref"); - purple_plugin_pref_set_bounds(ppref, 0, 255); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/int_choice", - "integer choice"); - purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); - purple_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1)); - purple_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2)); - purple_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4)); - purple_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8)); - purple_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16)); - purple_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32)); - purple_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64)); - purple_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128)); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_label("string"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/string", - "string pref"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/masked_string", - "masked string"); - purple_plugin_pref_set_masked(ppref, TRUE); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/max_string", - "string pref\n(max length of 16)"); - purple_plugin_pref_set_max_length(ppref, 16); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/string_choice", - "string choice"); - purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); - purple_plugin_pref_add_choice(ppref, "red", "red"); - purple_plugin_pref_add_choice(ppref, "orange", "orange"); - purple_plugin_pref_add_choice(ppref, "yellow", "yellow"); - purple_plugin_pref_add_choice(ppref, "green", "green"); - purple_plugin_pref_add_choice(ppref, "blue", "blue"); - purple_plugin_pref_add_choice(ppref, "purple", "purple"); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "core-pluginpref_example", /**< id */ - "Pluginpref Example", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - "An example of how to use pluginprefs", - /** description */ - "An example of how to use pluginprefs", - "Gary Kramlich ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none("/plugins/core/pluginpref_example"); - purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); - purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0); - purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); - purple_prefs_add_string("/plugins/core/pluginpref_example/string", - "string"); - purple_prefs_add_string("/plugins/core/pluginpref_example/max_string", - "max length string"); - purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); - purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); -} - -PURPLE_INIT_PLUGIN(ppexample, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/psychic.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/psychic.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/psychic.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/psychic.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,183 +0,0 @@ - - -#include "internal.h" - -#include "account.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "signals.h" -#include "status.h" -#include "version.h" -#include "privacy.h" - -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" - - -#define PLUGIN_ID "core-psychic" -#define PLUGIN_NAME N_("Psychic Mode") -#define PLUGIN_SUMMARY N_("Psychic mode for incoming conversation") -#define PLUGIN_DESC N_("Causes conversation windows to appear as other" \ - " users begin to message you. This works for" \ - " AIM, ICQ, XMPP, Sametime, and Yahoo!") -#define PLUGIN_AUTHOR "Christopher O'Brien " - - -#define PREFS_BASE "/plugins/core/psychic" -#define PREF_BUDDIES PREFS_BASE "/buddies_only" -#define PREF_NOTICE PREFS_BASE "/show_notice" -#define PREF_STATUS PREFS_BASE "/activate_online" -#define PREF_RAISE PREFS_BASE "/raise_conv" - - -static void -buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) { - PurpleConversation *gconv; - - if(purple_prefs_get_bool(PREF_STATUS) && - ! purple_status_is_available(purple_account_get_active_status(acct))) { - purple_debug_info("psychic", "not available, doing nothing\n"); - return; - } - - if(purple_prefs_get_bool(PREF_BUDDIES) && - ! purple_find_buddy(acct, name)) { - purple_debug_info("psychic", "not in blist, doing nothing\n"); - return; - } - - if(FALSE == purple_privacy_check(acct, name)) { - purple_debug_info("psychic", "user %s is blocked\n", name); - return; - } - - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, acct); - if(! gconv) { - purple_debug_info("psychic", "no previous conversation exists\n"); - gconv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, name); - - if(purple_prefs_get_bool(PREF_RAISE)) { - purple_conversation_present(gconv); - } - - if(purple_prefs_get_bool(PREF_NOTICE)) { - - /* This is a quote from Star Wars. You should probably not - translate it literally. If you can't find a fitting cultural - reference in your language, consider translating something - like this instead: "You feel a new message coming." */ - purple_conversation_write(gconv, NULL, - _("You feel a disturbance in the force..."), - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY, - time(NULL)); - } - - /* Necessary because we may be creating a new conversation window. */ - purple_conv_im_set_typing_state(PURPLE_CONV_IM(gconv), PURPLE_TYPING); - } -} - - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) { - - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - pref = purple_plugin_pref_new_with_name(PREF_BUDDIES); - purple_plugin_pref_set_label(pref, _("Only enable for users on" - " the buddy list")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name(PREF_STATUS); - purple_plugin_pref_set_label(pref, _("Disable when away")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name(PREF_NOTICE); - purple_plugin_pref_set_label(pref, _("Display notification message in" - " conversations")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name(PREF_RAISE); - purple_plugin_pref_set_label(pref, _("Raise psychic conversations")); - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - - -static gboolean -plugin_load(PurplePlugin *plugin) { - - void *convs_handle; - convs_handle = purple_conversations_get_handle(); - - purple_signal_connect(convs_handle, "buddy-typing", plugin, - PURPLE_CALLBACK(buddy_typing_cb), NULL); - - return TRUE; -} - - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - PLUGIN_ID, /**< id */ - PLUGIN_NAME, /**< name */ - DISPLAY_VERSION, /**< version */ - PLUGIN_SUMMARY, /**< summary */ - PLUGIN_DESC, /**< description */ - PLUGIN_AUTHOR, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void -init_plugin(PurplePlugin *plugin) { - purple_prefs_add_none(PREFS_BASE); - purple_prefs_add_bool(PREF_BUDDIES, FALSE); - purple_prefs_add_bool(PREF_NOTICE, TRUE); - purple_prefs_add_bool(PREF_STATUS, TRUE); -} - - -PURPLE_INIT_PLUGIN(psychic, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/signals-test.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/signals-test.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/signals-test.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/signals-test.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,935 +0,0 @@ -/* - * Signals test plugin. - * - * Copyright (C) 2003 Christian Hammond. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#define SIGNAL_TEST_PLUGIN_ID "core-signals-test" - -#include "internal.h" - -#include - -#include "cipher.h" -#include "connection.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "ft.h" -#include "signals.h" -#include "version.h" -#include "status.h" -#include "sound.h" - -/************************************************************************** - * Account subsystem signal callbacks - **************************************************************************/ -static void -account_connecting_cb(PurpleAccount *account, void *data) -{ - purple_debug_misc("signals test", "account-connecting (%s)\n", - purple_account_get_username(account)); -} - -static void -account_setting_info_cb(PurpleAccount *account, const char *info, void *data) -{ - purple_debug_misc("signals test", "account-setting-info (%s, %s)\n", - purple_account_get_username(account), info); -} - -static void -account_set_info_cb(PurpleAccount *account, const char *info, void *data) -{ - purple_debug_misc("signals test", "account-set-info (%s, %s)\n", - purple_account_get_username(account), info); -} - -static void -account_status_changed(PurpleAccount *account, PurpleStatus *old, PurpleStatus *new, - gpointer data) -{ - purple_debug_misc("signals test", "account-status-changed (%s, %s, %s)\n", - purple_account_get_username(account), - purple_status_get_name(old), - purple_status_get_name(new)); -} - -static void -account_alias_changed(PurpleAccount *account, const char *old, gpointer data) -{ - purple_debug_misc("signals test", "account-alias-changed (%s, %s, %s)\n", - purple_account_get_username(account), - old, purple_account_get_alias(account)); -} - -static int -account_authorization_requested_cb(PurpleAccount *account, const char *user, gpointer data) -{ - purple_debug_misc("signals test", "account-authorization-requested (%s, %s)\n", - purple_account_get_username(account), user); - return 0; -} - -static void -account_authorization_granted_cb(PurpleAccount *account, const char *user, gpointer data) -{ - purple_debug_misc("signals test", "account-authorization-granted (%s, %s)\n", - purple_account_get_username(account), user); -} - -static void -account_authorization_denied_cb(PurpleAccount *account, const char *user, gpointer data) -{ - purple_debug_misc("signals test", "account-authorization-denied (%s, %s)\n", - purple_account_get_username(account), user); -} - -/************************************************************************** - * Buddy Icons signal callbacks - **************************************************************************/ -static void -buddy_icon_changed_cb(PurpleBuddy *buddy) -{ - purple_debug_misc("signals test", "buddy icon changed (%s)\n", - purple_buddy_get_name(buddy)); -} - -/************************************************************************** - * Buddy List subsystem signal callbacks - **************************************************************************/ -static void -buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, - PurpleStatus *status, void *data) -{ - purple_debug_misc("signals test", "buddy-status-changed (%s %s to %s)\n", - purple_buddy_get_name(buddy), - purple_status_get_id(old_status), - purple_status_get_id(status)); -} - -static void -buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, - void *data) -{ - purple_debug_misc("signals test", "buddy-idle-changed (%s %s)\n", - purple_buddy_get_name(buddy), - old_idle ? "unidled" : "idled"); -} - -static void -buddy_signed_on_cb(PurpleBuddy *buddy, void *data) -{ - purple_debug_misc("signals test", "buddy-signed-on (%s)\n", - purple_buddy_get_name(buddy)); -} - -static void -buddy_signed_off_cb(PurpleBuddy *buddy, void *data) -{ - purple_debug_misc("signals test", "buddy-signed-off (%s)\n", - purple_buddy_get_name(buddy)); -} - -static void -blist_node_added_cb(PurpleBlistNode *bnode, void *data) -{ - const char *name; - if (PURPLE_BLIST_NODE_IS_GROUP(bnode)) - name = purple_group_get_name(PURPLE_GROUP(bnode)); - else if (PURPLE_BLIST_NODE_IS_CONTACT(bnode)) - /* Close enough */ - name = purple_contact_get_alias(PURPLE_CONTACT(bnode)); - else if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - name = purple_buddy_get_name(PURPLE_BUDDY(bnode)); - else - name = "(unknown)"; - - purple_debug_misc("signals test", "blist_node_added_cb (%s)\n", - name ? name : "(null)"); -} - -static void -blist_node_removed_cb(PurpleBlistNode *bnode, void *data) -{ - const char *name; - if (PURPLE_BLIST_NODE_IS_GROUP(bnode)) - name = purple_group_get_name(PURPLE_GROUP(bnode)); - else if (PURPLE_BLIST_NODE_IS_CONTACT(bnode)) - /* Close enough */ - name = purple_contact_get_alias(PURPLE_CONTACT(bnode)); - else if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - name = purple_buddy_get_name(PURPLE_BUDDY(bnode)); - else - name = "(unknown)"; - - purple_debug_misc("signals test", "blist_node_removed_cb (%s)\n", - name ? name : "(null)"); -} - -static void -blist_node_aliased(PurpleBlistNode *node, const char *old_alias) -{ - PurpleContact *p = (PurpleContact *)node; - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleChat *c = (PurpleChat *)node; - PurpleGroup *g = (PurpleGroup *)node; - - if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Contact: %s, %s)\n", - purple_contact_get_alias(p), old_alias); - } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Buddy: %s, %s)\n", - purple_buddy_get_name(b), old_alias); - } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Chat: %s, %s)\n", - purple_chat_get_name(c), old_alias); - } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Group: %s, %s)\n", - purple_group_get_name(g), old_alias); - } else { - purple_debug_misc("signals test", - "blist-node-aliased (UNKNOWN: %d, %s)\n", - purple_blist_node_get_type(node), old_alias); - } -} - -static void -blist_node_extended_menu_cb(PurpleBlistNode *node, void *data) -{ - PurpleContact *p = (PurpleContact *)node; - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleChat *c = (PurpleChat *)node; - PurpleGroup *g = (PurpleGroup *)node; - - if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Contact: %s)\n", - purple_contact_get_alias(p)); - } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Buddy: %s)\n", - purple_buddy_get_name(b)); - } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Chat: %s)\n", - purple_chat_get_name(c)); - } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Group: %s)\n", - purple_group_get_name(g)); - } else { - purple_debug_misc("signals test", - "blist-node-extended-menu (UNKNOWN: %d)\n", - purple_blist_node_get_type(node)); - } -} - - -/************************************************************************** - * Connection subsystem signal callbacks - **************************************************************************/ -static void -signing_on_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signing-on (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -signed_on_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signed-on (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -signing_off_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signing-off (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -signed_off_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signed-off (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -connection_error_cb(PurpleConnection *gc, - PurpleConnectionError err, - const gchar *desc, - void *data) -{ - const gchar *username = - purple_account_get_username(purple_connection_get_account(gc)); - purple_debug_misc("signals test", "connection-error (%s, %u, %s)\n", - username, err, desc); -} - -/************************************************************************** - * Conversation subsystem signal callbacks - **************************************************************************/ -static gboolean -writing_im_msg_cb(PurpleAccount *account, const char *who, char **buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "writing-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), purple_conversation_get_name(conv), *buffer); - - return FALSE; - -} - -static void -wrote_im_msg_cb(PurpleAccount *account, const char *who, const char *buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "wrote-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), purple_conversation_get_name(conv), buffer); -} - -static void -sending_im_msg_cb(PurpleAccount *account, char *recipient, char **buffer, void *data) -{ - purple_debug_misc("signals test", "sending-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), recipient, *buffer); - -} - -static void -sent_im_msg_cb(PurpleAccount *account, const char *recipient, const char *buffer, void *data) -{ - purple_debug_misc("signals test", "sent-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), recipient, buffer); -} - -static gboolean -receiving_im_msg_cb(PurpleAccount *account, char **sender, char **buffer, - PurpleConversation *conv, PurpleMessageFlags *flags, void *data) -{ - purple_debug_misc("signals test", "receiving-im-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), *sender, *buffer, - (conv != NULL) ? purple_conversation_get_name(conv) : "(null)", *flags); - - return FALSE; -} - -static void -received_im_msg_cb(PurpleAccount *account, char *sender, char *buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "received-im-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), sender, buffer, - (conv != NULL) ? purple_conversation_get_name(conv) : "(null)", flags); -} - -static gboolean -writing_chat_msg_cb(PurpleAccount *account, const char *who, char **buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "writing-chat-msg (%s, %s)\n", - purple_conversation_get_name(conv), *buffer); - - return FALSE; -} - -static void -wrote_chat_msg_cb(PurpleAccount *account, const char *who, const char *buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "wrote-chat-msg (%s, %s)\n", - purple_conversation_get_name(conv), buffer); -} - -static gboolean -sending_chat_msg_cb(PurpleAccount *account, char **buffer, int id, void *data) -{ - purple_debug_misc("signals test", "sending-chat-msg (%s, %s, %d)\n", - purple_account_get_username(account), *buffer, id); - - return FALSE; -} - -static void -sent_chat_msg_cb(PurpleAccount *account, const char *buffer, int id, void *data) -{ - purple_debug_misc("signals test", "sent-chat-msg (%s, %s, %d)\n", - purple_account_get_username(account), buffer, id); -} - -static gboolean -receiving_chat_msg_cb(PurpleAccount *account, char **sender, char **buffer, - PurpleConversation *chat, PurpleMessageFlags *flags, void *data) -{ - purple_debug_misc("signals test", - "receiving-chat-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), *sender, *buffer, - purple_conversation_get_name(chat), *flags); - - return FALSE; -} - -static void -received_chat_msg_cb(PurpleAccount *account, char *sender, char *buffer, - PurpleConversation *chat, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", - "received-chat-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), sender, buffer, - purple_conversation_get_name(chat), flags); -} - -static void -conversation_created_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "conversation-created (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -deleting_conversation_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "deleting-conversation (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -buddy_typing_cb(PurpleAccount *account, const char *name, void *data) -{ - purple_debug_misc("signals test", "buddy-typing (%s, %s)\n", - purple_account_get_username(account), name); -} - -static void -buddy_typing_stopped_cb(PurpleAccount *account, const char *name, void *data) -{ - purple_debug_misc("signals test", "buddy-typing-stopped (%s, %s)\n", - purple_account_get_username(account), name); -} - -static gboolean -chat_buddy_joining_cb(PurpleConversation *conv, const char *user, - PurpleConvChatBuddyFlags flags, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-joining (%s, %s, %d)\n", - purple_conversation_get_name(conv), user, flags); - - return FALSE; -} - -static void -chat_buddy_joined_cb(PurpleConversation *conv, const char *user, - PurpleConvChatBuddyFlags flags, gboolean new_arrival, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-joined (%s, %s, %d, %d)\n", - purple_conversation_get_name(conv), user, flags, new_arrival); -} - -static void -chat_buddy_flags_cb(PurpleConversation *conv, const char *user, - PurpleConvChatBuddyFlags oldflags, PurpleConvChatBuddyFlags newflags, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-flags (%s, %s, %d, %d)\n", - purple_conversation_get_name(conv), user, oldflags, newflags); -} - -static gboolean -chat_buddy_leaving_cb(PurpleConversation *conv, const char *user, - const char *reason, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-leaving (%s, %s, %s)\n", - purple_conversation_get_name(conv), user, reason); - - return FALSE; -} - -static void -chat_buddy_left_cb(PurpleConversation *conv, const char *user, - const char *reason, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-left (%s, %s, %s)\n", - purple_conversation_get_name(conv), user, reason); -} - -static void -chat_inviting_user_cb(PurpleConversation *conv, const char *name, - char **reason, void *data) -{ - purple_debug_misc("signals test", "chat-inviting-user (%s, %s, %s)\n", - purple_conversation_get_name(conv), name, *reason); -} - -static void -chat_invited_user_cb(PurpleConversation *conv, const char *name, - const char *reason, void *data) -{ - purple_debug_misc("signals test", "chat-invited-user (%s, %s, %s)\n", - purple_conversation_get_name(conv), name, reason); -} - -static gint -chat_invited_cb(PurpleAccount *account, const char *inviter, - const char *room_name, const char *message, - const GHashTable *components, void *data) -{ - purple_debug_misc("signals test", "chat-invited (%s, %s, %s, %s)\n", - purple_account_get_username(account), inviter, - room_name, message); - - return 0; -} - -static void -chat_joined_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "chat-joined (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -chat_left_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "chat-left (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -chat_topic_changed_cb(PurpleConversation *conv, const char *who, - const char *topic, void *data) -{ - purple_debug_misc("signals test", - "chat-topic-changed (%s topic changed to: \"%s\" by %s)\n", - purple_conversation_get_name(conv), topic, - (who) ? who : "unknown"); -} -/************************************************************************** - * Ciphers signal callbacks - **************************************************************************/ -static void -cipher_added_cb(PurpleCipher *cipher, void *data) { - purple_debug_misc("signals test", "cipher %s added\n", - purple_cipher_get_name(cipher)); -} - -static void -cipher_removed_cb(PurpleCipher *cipher, void *data) { - purple_debug_misc("signals test", "cipher %s removed\n", - purple_cipher_get_name(cipher)); -} - -/************************************************************************** - * Core signal callbacks - **************************************************************************/ -static void -quitting_cb(void *data) -{ - purple_debug_misc("signals test", "quitting ()\n"); -} - -/************************************************************************** - * File transfer signal callbacks - **************************************************************************/ -static void -ft_recv_accept_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive accepted\n"); -} - -static void -ft_send_accept_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send accepted\n"); -} - -static void -ft_recv_start_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive started\n"); -} - -static void -ft_send_start_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send started\n"); -} - -static void -ft_recv_cancel_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive canceled\n"); -} - -static void -ft_send_cancel_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send canceled\n"); -} - -static void -ft_recv_complete_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive completed\n"); -} - -static void -ft_send_complete_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send completed\n"); -} - -/************************************************************************** - * Sound signal callbacks - **************************************************************************/ -static int -sound_playing_event_cb(PurpleSoundEventID event, const PurpleAccount *account) { - if (account != NULL) - purple_debug_misc("signals test", "sound playing event: %d for account: %s\n", - event, purple_account_get_username(account)); - else - purple_debug_misc("signals test", "sound playing event: %d\n", event); - - return 0; -} - -/************************************************************************** - * Notify signals callbacks - **************************************************************************/ -static void -notify_email_cb(char *subject, char *from, char *to, char *url) { - purple_debug_misc("signals test", "notify email: subject=%s, from=%s, to=%s, url=%s\n", - subject, from, to, url); -} - -static void -notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint count) { - int i; - purple_debug_misc("signals test", "notify emails: count=%d\n", count); - for(i=0; iname, - xmlnode_get_namespace(child)); - - if (g_str_equal(type, "get") || g_str_equal(type, "set")) { - /* Send the requisite reply */ - xmlnode *iq = xmlnode_new("iq"); - xmlnode_set_attrib(iq, "to", from); - xmlnode_set_attrib(iq, "id", id); - xmlnode_set_attrib(iq, "type", "result"); - - purple_signal_emit(purple_connection_get_prpl(pc), - "jabber-sending-xmlnode", pc, &iq); - if (iq != NULL) - xmlnode_free(iq); - } - - /* Cookie monster eats IQ stanzas; the prpl shouldn't keep processing */ - return TRUE; -} - -/************************************************************************** - * Plugin stuff - **************************************************************************/ -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *core_handle = purple_get_core(); - void *blist_handle = purple_blist_get_handle(); - void *conn_handle = purple_connections_get_handle(); - void *conv_handle = purple_conversations_get_handle(); - void *accounts_handle = purple_accounts_get_handle(); - void *ciphers_handle = purple_ciphers_get_handle(); - void *ft_handle = purple_xfers_get_handle(); - void *sound_handle = purple_sounds_get_handle(); - void *notify_handle = purple_notify_get_handle(); - void *jabber_handle = purple_plugins_find_with_id("prpl-jabber"); - - /* Accounts subsystem signals */ - purple_signal_connect(accounts_handle, "account-connecting", - plugin, PURPLE_CALLBACK(account_connecting_cb), NULL); - purple_signal_connect(accounts_handle, "account-setting-info", - plugin, PURPLE_CALLBACK(account_setting_info_cb), NULL); - purple_signal_connect(accounts_handle, "account-set-info", - plugin, PURPLE_CALLBACK(account_set_info_cb), NULL); - purple_signal_connect(accounts_handle, "account-status-changed", - plugin, PURPLE_CALLBACK(account_status_changed), NULL); - purple_signal_connect(accounts_handle, "account-alias-changed", - plugin, PURPLE_CALLBACK(account_alias_changed), NULL); - purple_signal_connect(accounts_handle, "account-authorization-requested", - plugin, PURPLE_CALLBACK(account_authorization_requested_cb), NULL); - purple_signal_connect(accounts_handle, "account-authorization-denied", - plugin, PURPLE_CALLBACK(account_authorization_denied_cb), NULL); - purple_signal_connect(accounts_handle, "account-authorization-granted", - plugin, PURPLE_CALLBACK(account_authorization_granted_cb), NULL); - - /* Buddy List subsystem signals */ - purple_signal_connect(blist_handle, "buddy-status-changed", - plugin, PURPLE_CALLBACK(buddy_status_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-idle-changed", - plugin, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-on", - plugin, PURPLE_CALLBACK(buddy_signed_on_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-off", - plugin, PURPLE_CALLBACK(buddy_signed_off_cb), NULL); - purple_signal_connect(blist_handle, "blist-node-added", - plugin, PURPLE_CALLBACK(blist_node_added_cb), NULL); - purple_signal_connect(blist_handle, "blist-node-removed", - plugin, PURPLE_CALLBACK(blist_node_removed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-icon-changed", - plugin, PURPLE_CALLBACK(buddy_icon_changed_cb), NULL); - purple_signal_connect(blist_handle, "blist-node-aliased", - plugin, PURPLE_CALLBACK(blist_node_aliased), NULL); - purple_signal_connect(blist_handle, "blist-node-extended-menu", - plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL); - - /* Connection subsystem signals */ - purple_signal_connect(conn_handle, "signing-on", - plugin, PURPLE_CALLBACK(signing_on_cb), NULL); - purple_signal_connect(conn_handle, "signed-on", - plugin, PURPLE_CALLBACK(signed_on_cb), NULL); - purple_signal_connect(conn_handle, "signing-off", - plugin, PURPLE_CALLBACK(signing_off_cb), NULL); - purple_signal_connect(conn_handle, "signed-off", - plugin, PURPLE_CALLBACK(signed_off_cb), NULL); - purple_signal_connect(conn_handle, "connection-error", - plugin, PURPLE_CALLBACK(connection_error_cb), NULL); - - /* Conversations subsystem signals */ - purple_signal_connect(conv_handle, "writing-im-msg", - plugin, PURPLE_CALLBACK(writing_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "wrote-im-msg", - plugin, PURPLE_CALLBACK(wrote_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "sending-im-msg", - plugin, PURPLE_CALLBACK(sending_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "sent-im-msg", - plugin, PURPLE_CALLBACK(sent_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "receiving-im-msg", - plugin, PURPLE_CALLBACK(receiving_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "received-im-msg", - plugin, PURPLE_CALLBACK(received_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "writing-chat-msg", - plugin, PURPLE_CALLBACK(writing_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "wrote-chat-msg", - plugin, PURPLE_CALLBACK(wrote_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "sending-chat-msg", - plugin, PURPLE_CALLBACK(sending_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "sent-chat-msg", - plugin, PURPLE_CALLBACK(sent_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "receiving-chat-msg", - plugin, PURPLE_CALLBACK(receiving_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "received-chat-msg", - plugin, PURPLE_CALLBACK(received_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "conversation-created", - plugin, PURPLE_CALLBACK(conversation_created_cb), NULL); - purple_signal_connect(conv_handle, "deleting-conversation", - plugin, PURPLE_CALLBACK(deleting_conversation_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typing", - plugin, PURPLE_CALLBACK(buddy_typing_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typing-stopped", - plugin, PURPLE_CALLBACK(buddy_typing_stopped_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-joining", - plugin, PURPLE_CALLBACK(chat_buddy_joining_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-joined", - plugin, PURPLE_CALLBACK(chat_buddy_joined_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-flags", - plugin, PURPLE_CALLBACK(chat_buddy_flags_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-leaving", - plugin, PURPLE_CALLBACK(chat_buddy_leaving_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-left", - plugin, PURPLE_CALLBACK(chat_buddy_left_cb), NULL); - purple_signal_connect(conv_handle, "chat-inviting-user", - plugin, PURPLE_CALLBACK(chat_inviting_user_cb), NULL); - purple_signal_connect(conv_handle, "chat-invited-user", - plugin, PURPLE_CALLBACK(chat_invited_user_cb), NULL); - purple_signal_connect(conv_handle, "chat-invited", - plugin, PURPLE_CALLBACK(chat_invited_cb), NULL); - purple_signal_connect(conv_handle, "chat-joined", - plugin, PURPLE_CALLBACK(chat_joined_cb), NULL); - purple_signal_connect(conv_handle, "chat-left", - plugin, PURPLE_CALLBACK(chat_left_cb), NULL); - purple_signal_connect(conv_handle, "chat-topic-changed", - plugin, PURPLE_CALLBACK(chat_topic_changed_cb), NULL); - - /* Ciphers signals */ - purple_signal_connect(ciphers_handle, "cipher-added", - plugin, PURPLE_CALLBACK(cipher_added_cb), NULL); - purple_signal_connect(ciphers_handle, "cipher-removed", - plugin, PURPLE_CALLBACK(cipher_removed_cb), NULL); - - /* Core signals */ - purple_signal_connect(core_handle, "quitting", - plugin, PURPLE_CALLBACK(quitting_cb), NULL); - - /* File transfer signals */ - purple_signal_connect(ft_handle, "file-recv-accept", - plugin, PURPLE_CALLBACK(ft_recv_accept_cb), NULL); - purple_signal_connect(ft_handle, "file-recv-start", - plugin, PURPLE_CALLBACK(ft_recv_start_cb), NULL); - purple_signal_connect(ft_handle, "file-recv-cancel", - plugin, PURPLE_CALLBACK(ft_recv_cancel_cb), NULL); - purple_signal_connect(ft_handle, "file-recv-complete", - plugin, PURPLE_CALLBACK(ft_recv_complete_cb), NULL); - purple_signal_connect(ft_handle, "file-send-accept", - plugin, PURPLE_CALLBACK(ft_send_accept_cb), NULL); - purple_signal_connect(ft_handle, "file-send-start", - plugin, PURPLE_CALLBACK(ft_send_start_cb), NULL); - purple_signal_connect(ft_handle, "file-send-cancel", - plugin, PURPLE_CALLBACK(ft_send_cancel_cb), NULL); - purple_signal_connect(ft_handle, "file-send-complete", - plugin, PURPLE_CALLBACK(ft_send_complete_cb), NULL); - - /* Sound signals */ - purple_signal_connect(sound_handle, "playing-sound-event", plugin, - PURPLE_CALLBACK(sound_playing_event_cb), NULL); - - /* Notify signals */ - purple_signal_connect(notify_handle, "displaying-email-notification", - plugin, PURPLE_CALLBACK(notify_email_cb), NULL); - purple_signal_connect(notify_handle, "displaying-emails-notification", - plugin, PURPLE_CALLBACK(notify_emails_cb), NULL); - - /* Jabber signals */ - if (jabber_handle) { - purple_signal_connect(jabber_handle, "jabber-receiving-iq", plugin, - PURPLE_CALLBACK(jabber_iq_received), NULL); - purple_signal_connect(jabber_handle, "jabber-receiving-message", plugin, - PURPLE_CALLBACK(jabber_message_received), NULL); - purple_signal_connect(jabber_handle, "jabber-receiving-presence", plugin, - PURPLE_CALLBACK(jabber_presence_received), NULL); - - /* IQ namespace signals */ - purple_signal_emit(jabber_handle, "jabber-register-namespace-watcher", - "bogus_node", "super-duper-namespace"); - /* The above is equivalent to doing: - int result = GPOINTER_TO_INT(purple_plugin_ipc_call(jabber_handle, "register_namespace_watcher", &ok, "bogus_node", "super-duper-namespace")); - */ - - purple_signal_connect(jabber_handle, "jabber-watched-iq", plugin, - PURPLE_CALLBACK(jabber_watched_iq), NULL); - } - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - void *jabber_handle = purple_plugins_find_with_id("prpl-jabber"); - - purple_signals_disconnect_by_handle(plugin); - - if (jabber_handle) { - /* Unregister watched namespaces */ - purple_signal_emit(jabber_handle, "jabber-unregister-namespace-watcher", - "bogus_node", "super-duper-namespace"); - /* The above is equivalent to doing: - int result = GPOINTER_TO_INT(purple_plugin_ipc_call(jabber_handle, "unregister_namespace_watcher", &ok, "bogus_node", "super-duper-namespace")); - */ - } - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SIGNAL_TEST_PLUGIN_ID, /**< id */ - N_("Signals Test"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Test to see that all signals are working properly."), - /** description */ - N_("Test to see that all signals are working properly."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(signalstest, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/simple.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/simple.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/simple.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/simple.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -/** Plugin id : type-author-name (to guarantee uniqueness) */ -#define SIMPLE_PLUGIN_ID "core-ewarmenhoven-simple" - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n"); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin unloaded.\n"); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SIMPLE_PLUGIN_ID, /**< id */ - N_("Simple Plugin"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Tests to see that most things are working."), - /** description */ - N_("Tests to see that most things are working."), - "Eric Warmenhoven ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(simple, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -ssl_la_LDFLAGS = -module -avoid-version -ssl_gnutls_la_LDFLAGS = -module -avoid-version -ssl_nss_la_LDFLAGS = -module -avoid-version - -if PLUGINS - -# I'm sorry to report that Automake Conditionals don't support -# if USE_GNUTLS && USE_NSS -# but only support testing a single variable. Hence: - -if USE_GNUTLS -if USE_NSS -plugin_LTLIBRARIES = \ - ssl.la \ - ssl-gnutls.la \ - ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la \ - ssl-gnutls.la -endif -else -if USE_NSS -plugin_LTLIBRARIES = \ - ssl.la \ - ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la -endif -endif - -ssl_la_SOURCES = ssl.c -ssl_gnutls_la_SOURCES = ssl-gnutls.c -ssl_nss_la_SOURCES = ssl-nss.c - -ssl_la_LIBADD = $(GLIB_LIBS) -ssl_gnutls_la_LIBADD = $(GLIB_LIBS) $(GNUTLS_LIBS) -ssl_nss_la_LIBADD = $(GLIB_LIBS) $(NSS_LIBS) - -endif # PLUGINS - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/libpurple\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) - -ssl_gnutls_la_CFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -ssl_nss_la_CFLAGS = $(AM_CPPFLAGS) $(NSS_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,793 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/ssl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -@PLUGINS_TRUE@ssl_gnutls_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__ssl_gnutls_la_SOURCES_DIST = ssl-gnutls.c -@PLUGINS_TRUE@am_ssl_gnutls_la_OBJECTS = ssl_gnutls_la-ssl-gnutls.lo -ssl_gnutls_la_OBJECTS = $(am_ssl_gnutls_la_OBJECTS) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@am_ssl_gnutls_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@am_ssl_gnutls_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@ssl_nss_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__ssl_nss_la_SOURCES_DIST = ssl-nss.c -@PLUGINS_TRUE@am_ssl_nss_la_OBJECTS = ssl_nss_la-ssl-nss.lo -ssl_nss_la_OBJECTS = $(am_ssl_nss_la_OBJECTS) -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@am_ssl_nss_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@am_ssl_nss_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@ssl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__ssl_la_SOURCES_DIST = ssl.c -@PLUGINS_TRUE@am_ssl_la_OBJECTS = ssl.lo -ssl_la_OBJECTS = $(am_ssl_la_OBJECTS) -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@am_ssl_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@am_ssl_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@am_ssl_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@am_ssl_la_rpath = -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ $(plugindir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(ssl_gnutls_la_SOURCES) $(ssl_nss_la_SOURCES) \ - $(ssl_la_SOURCES) -DIST_SOURCES = $(am__ssl_gnutls_la_SOURCES_DIST) \ - $(am__ssl_nss_la_SOURCES_DIST) $(am__ssl_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -ssl_la_LDFLAGS = -module -avoid-version -ssl_gnutls_la_LDFLAGS = -module -avoid-version -ssl_nss_la_LDFLAGS = -module -avoid-version -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@ ssl.la - -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ ssl.la \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ ssl-nss.la - -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ ssl.la \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ ssl-gnutls.la - - -# I'm sorry to report that Automake Conditionals don't support -# if USE_GNUTLS && USE_NSS -# but only support testing a single variable. Hence: -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ ssl.la \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ ssl-gnutls.la \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ ssl-nss.la - -@PLUGINS_TRUE@ssl_la_SOURCES = ssl.c -@PLUGINS_TRUE@ssl_gnutls_la_SOURCES = ssl-gnutls.c -@PLUGINS_TRUE@ssl_nss_la_SOURCES = ssl-nss.c -@PLUGINS_TRUE@ssl_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@ssl_gnutls_la_LIBADD = $(GLIB_LIBS) $(GNUTLS_LIBS) -@PLUGINS_TRUE@ssl_nss_la_LIBADD = $(GLIB_LIBS) $(NSS_LIBS) -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/libpurple\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) - -ssl_gnutls_la_CFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -ssl_nss_la_CFLAGS = $(AM_CPPFLAGS) $(NSS_CFLAGS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/ssl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/ssl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -ssl-gnutls.la: $(ssl_gnutls_la_OBJECTS) $(ssl_gnutls_la_DEPENDENCIES) - $(LINK) $(am_ssl_gnutls_la_rpath) $(ssl_gnutls_la_LDFLAGS) $(ssl_gnutls_la_OBJECTS) $(ssl_gnutls_la_LIBADD) $(LIBS) -ssl-nss.la: $(ssl_nss_la_OBJECTS) $(ssl_nss_la_DEPENDENCIES) - $(LINK) $(am_ssl_nss_la_rpath) $(ssl_nss_la_LDFLAGS) $(ssl_nss_la_OBJECTS) $(ssl_nss_la_LIBADD) $(LIBS) -ssl.la: $(ssl_la_OBJECTS) $(ssl_la_DEPENDENCIES) - $(LINK) $(am_ssl_la_rpath) $(ssl_la_LDFLAGS) $(ssl_la_OBJECTS) $(ssl_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_nss_la-ssl-nss.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -ssl_gnutls_la-ssl-gnutls.lo: ssl-gnutls.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_gnutls_la_CFLAGS) $(CFLAGS) -MT ssl_gnutls_la-ssl-gnutls.lo -MD -MP -MF "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Tpo" -c -o ssl_gnutls_la-ssl-gnutls.lo `test -f 'ssl-gnutls.c' || echo '$(srcdir)/'`ssl-gnutls.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Tpo" "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Plo"; else rm -f "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssl-gnutls.c' object='ssl_gnutls_la-ssl-gnutls.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_gnutls_la_CFLAGS) $(CFLAGS) -c -o ssl_gnutls_la-ssl-gnutls.lo `test -f 'ssl-gnutls.c' || echo '$(srcdir)/'`ssl-gnutls.c - -ssl_nss_la-ssl-nss.lo: ssl-nss.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_nss_la_CFLAGS) $(CFLAGS) -MT ssl_nss_la-ssl-nss.lo -MD -MP -MF "$(DEPDIR)/ssl_nss_la-ssl-nss.Tpo" -c -o ssl_nss_la-ssl-nss.lo `test -f 'ssl-nss.c' || echo '$(srcdir)/'`ssl-nss.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ssl_nss_la-ssl-nss.Tpo" "$(DEPDIR)/ssl_nss_la-ssl-nss.Plo"; else rm -f "$(DEPDIR)/ssl_nss_la-ssl-nss.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssl-nss.c' object='ssl_nss_la-ssl-nss.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_nss_la_CFLAGS) $(CFLAGS) -c -o ssl_nss_la-ssl-nss.lo `test -f 'ssl-nss.c' || echo '$(srcdir)/'`ssl-nss.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for ssl plugin. -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -## -## VARIABLE DEFINITIONS -## -TARGET = ssl -TARGET_NSS = ssl-nss - -NEEDED_DLLS = \ - $(NSS_TOP)/lib/freebl3.dll \ - $(NSS_TOP)/lib/nss3.dll \ - $(NSS_TOP)/lib/nssckbi.dll \ - $(NSS_TOP)/lib/softokn3.dll \ - $(NSS_TOP)/lib/smime3.dll \ - $(NSS_TOP)/lib/ssl3.dll \ - $(NSPR_TOP)/lib/nspr4.dll \ - $(NSPR_TOP)/lib/plc4.dll \ - $(NSPR_TOP)/lib/plds4.dll - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(NSS_TOP)/include \ - -I$(NSPR_TOP)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(NSS_TOP)/lib \ - -L$(NSPR_TOP)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = ssl.c -C_SRC_NSS = ssl-nss.c -OBJECTS = $(C_SRC:%.c=%.o) -OBJECTS_NSS = $(C_SRC_NSS:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lnss3 \ - -lnspr4 \ - -lssl3 \ - -lsmime3 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll $(TARGET_NSS).dll - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(TARGET_NSS).dll $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS) $(OBJECTS_NSS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -$(TARGET_NSS).dll: $(PURPLE_DLL) $(OBJECTS_NSS) - $(CC) -shared $(OBJECTS_NSS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET_NSS).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(OBJECTS_NSS) $(TARGET).dll $(TARGET_NSS).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -/** - * @file ssl.c Main SSL plugin - * - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "sslconn.h" -#include "version.h" - -#define SSL_PLUGIN_ID "core-ssl" - -static PurplePlugin *ssl_plugin = NULL; - -static gboolean -probe_ssl_plugins(PurplePlugin *my_plugin) -{ - PurplePlugin *plugin; - GList *l; - - ssl_plugin = NULL; - - for (l = purple_plugins_get_all(); l != NULL; l = l->next) - { - plugin = (PurplePlugin *)l->data; - - if (plugin == my_plugin) - continue; - - if (plugin->info != NULL && plugin->info->id != NULL && - strncmp(plugin->info->id, "ssl-", 4) == 0) - { - if (purple_plugin_is_loaded(plugin) || purple_plugin_load(plugin)) - { - ssl_plugin = plugin; - - break; - } - } - } - - return (ssl_plugin != NULL); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - return probe_ssl_plugins(plugin); -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - if (ssl_plugin != NULL && - g_list_find(purple_plugins_get_loaded(), ssl_plugin) != NULL) - { - purple_plugin_unload(ssl_plugin); - } - - ssl_plugin = NULL; - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SSL_PLUGIN_ID, /**< id */ - N_("SSL"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Provides a wrapper around SSL support libraries."), - /** description */ - N_("Provides a wrapper around SSL support libraries."), - "Christian Hammond ", - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ssl, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-gnutls.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-gnutls.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-gnutls.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-gnutls.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1061 +0,0 @@ -/** - * @file ssl-gnutls.c GNUTLS SSL plugin. - * - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "certificate.h" -#include "plugin.h" -#include "sslconn.h" -#include "version.h" -#include "util.h" - -#define SSL_GNUTLS_PLUGIN_ID "ssl-gnutls" - -#include -#include - -typedef struct -{ - gnutls_session session; - guint handshake_handler; -} PurpleSslGnutlsData; - -#define PURPLE_SSL_GNUTLS_DATA(gsc) ((PurpleSslGnutlsData *)gsc->private_data) - -static gnutls_certificate_client_credentials xcred; - -static void -ssl_gnutls_log(int level, const char *str) -{ - /* GnuTLS log messages include the '\n' */ - purple_debug_misc("gnutls", "lvl %d: %s", level, str); -} - -static void -ssl_gnutls_init_gnutls(void) -{ - const char *debug_level; - - /* Configure GnuTLS to use glib memory management */ - /* I expect that this isn't really necessary, but it may prevent - some bugs */ - /* TODO: It may be necessary to wrap this allocators for GnuTLS. - If there are strange bugs, perhaps look here (yes, I am a - hypocrite) */ - gnutls_global_set_mem_functions( - (gnutls_alloc_function) g_malloc, /* malloc */ - (gnutls_alloc_function) g_malloc, /* secure malloc */ - NULL, /* mem_is_secure */ - (gnutls_realloc_function) g_realloc, /* realloc */ - (gnutls_free_function) g_free /* free */ - ); - - debug_level = g_getenv("PURPLE_GNUTLS_DEBUG"); - if (debug_level) { - int level = atoi(debug_level); - if (level < 0) { - purple_debug_warning("gnutls", "Assuming log level 0 instead of %d\n", - level); - level = 0; - } - - /* "The level is an integer between 0 and 9. Higher values mean more verbosity." */ - gnutls_global_set_log_level(level); - gnutls_global_set_log_function(ssl_gnutls_log); - } - - gnutls_global_init(); - - gnutls_certificate_allocate_credentials(&xcred); - - /* TODO: I can likely remove this */ - gnutls_certificate_set_x509_trust_file(xcred, "ca.pem", - GNUTLS_X509_FMT_PEM); -} - -static gboolean -ssl_gnutls_init(void) -{ - return TRUE; -} - -static void -ssl_gnutls_uninit(void) -{ - gnutls_global_deinit(); - - gnutls_certificate_free_credentials(xcred); -} - -static void -ssl_gnutls_verified_cb(PurpleCertificateVerificationStatus st, - gpointer userdata) -{ - PurpleSslConnection *gsc = (PurpleSslConnection *) userdata; - - if (st == PURPLE_CERTIFICATE_VALID) { - /* Certificate valid? Good! Do the connection! */ - gsc->connect_cb(gsc->connect_cb_data, gsc, PURPLE_INPUT_READ); - } else { - /* Otherwise, signal an error */ - if(gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CERTIFICATE_INVALID, - gsc->connect_cb_data); - purple_ssl_close(gsc); - } -} - - - -static void ssl_gnutls_handshake_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleSslConnection *gsc = data; - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - ssize_t ret; - - /*purple_debug_info("gnutls", "Handshaking with %s\n", gsc->host);*/ - ret = gnutls_handshake(gnutls_data->session); - - if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) - return; - - purple_input_remove(gnutls_data->handshake_handler); - gnutls_data->handshake_handler = 0; - - if(ret != 0) { - purple_debug_error("gnutls", "Handshake failed. Error %s\n", - gnutls_strerror(ret)); - - if(gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_HANDSHAKE_FAILED, - gsc->connect_cb_data); - - purple_ssl_close(gsc); - } else { - /* Now we are cooking with gas! */ - PurpleSslOps *ops = purple_ssl_get_ops(); - GList * peers = ops->get_peer_certificates(gsc); - - PurpleCertificateScheme *x509 = - purple_certificate_find_scheme("x509"); - - GList * l; - - /* TODO: Remove all this debugging babble */ - purple_debug_info("gnutls", "Handshake complete\n"); - - for (l=peers; l; l = l->next) { - PurpleCertificate *crt = l->data; - GByteArray *z = - x509->get_fingerprint_sha1(crt); - gchar * fpr = - purple_base16_encode_chunked(z->data, - z->len); - - purple_debug_info("gnutls/x509", - "Key print: %s\n", - fpr); - - /* Kill the cert! */ - x509->destroy_certificate(crt); - - g_free(fpr); - g_byte_array_free(z, TRUE); - } - g_list_free(peers); - - { - const gnutls_datum *cert_list; - unsigned int cert_list_size = 0; - gnutls_session session=gnutls_data->session; - int i; - - cert_list = - gnutls_certificate_get_peers(session, &cert_list_size); - - purple_debug_info("gnutls", - "Peer provided %d certs\n", - cert_list_size); - for (i=0; iverifier) { - GList *peers; - /* First, get the peer cert chain */ - peers = purple_ssl_get_peer_certificates(gsc); - - /* Now kick off the verification process */ - purple_certificate_verify(gsc->verifier, - gsc->host, - peers, - ssl_gnutls_verified_cb, - gsc); - - purple_certificate_destroy_list(peers); - } else { - /* Otherwise, just call the "connection complete" - callback */ - gsc->connect_cb(gsc->connect_cb_data, gsc, cond); - } - } - -} - - -static void -ssl_gnutls_connect(PurpleSslConnection *gsc) -{ - PurpleSslGnutlsData *gnutls_data; - static const int cert_type_priority[2] = { GNUTLS_CRT_X509, 0 }; - - gnutls_data = g_new0(PurpleSslGnutlsData, 1); - gsc->private_data = gnutls_data; - - gnutls_init(&gnutls_data->session, GNUTLS_CLIENT); -#ifdef HAVE_GNUTLS_PRIORITY_FUNCS - if (gnutls_priority_set_direct(gnutls_data->session, - "NORMAL:%SSL3_RECORD_VERSION", NULL)) - gnutls_priority_set_direct(gnutls_data->session, "NORMAL", NULL); -#else - gnutls_set_default_priority(gnutls_data->session); -#endif - - gnutls_certificate_type_set_priority(gnutls_data->session, - cert_type_priority); - - gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE, - xcred); - - gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(gsc->fd)); - - gnutls_data->handshake_handler = purple_input_add(gsc->fd, - PURPLE_INPUT_READ, ssl_gnutls_handshake_cb, gsc); - - purple_debug_info("gnutls", "Starting handshake with %s\n", gsc->host); - - /* Orborde asks: Why are we configuring a callback, then - immediately calling it? - - Answer: gnutls_handshake (up in handshake_cb) needs to be called - once in order to get the ball rolling on the SSL connection. - Once it has done so, only then will the server reply, triggering - the callback. - - Since the logic driving gnutls_handshake is the same with the first - and subsequent calls, we'll just fire the callback immediately to - accomplish this. - */ - ssl_gnutls_handshake_cb(gsc, gsc->fd, PURPLE_INPUT_READ); -} - -static void -ssl_gnutls_close(PurpleSslConnection *gsc) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - - if(!gnutls_data) - return; - - if(gnutls_data->handshake_handler) - purple_input_remove(gnutls_data->handshake_handler); - - gnutls_bye(gnutls_data->session, GNUTLS_SHUT_RDWR); - - gnutls_deinit(gnutls_data->session); - - g_free(gnutls_data); - gsc->private_data = NULL; -} - -static size_t -ssl_gnutls_read(PurpleSslConnection *gsc, void *data, size_t len) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - ssize_t s; - - s = gnutls_record_recv(gnutls_data->session, data, len); - - if(s == GNUTLS_E_AGAIN || s == GNUTLS_E_INTERRUPTED) { - s = -1; - errno = EAGAIN; - } else if(s < 0) { - purple_debug_error("gnutls", "receive failed: %s\n", - gnutls_strerror(s)); - s = -1; - /* - * TODO: Set errno to something more appropriate. Or even - * better: allow ssl plugins to keep track of their - * own error message, then add a new ssl_ops function - * that returns the error message. - */ - errno = EIO; - } - - return s; -} - -static size_t -ssl_gnutls_write(PurpleSslConnection *gsc, const void *data, size_t len) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - ssize_t s = 0; - - /* XXX: when will gnutls_data be NULL? */ - if(gnutls_data) - s = gnutls_record_send(gnutls_data->session, data, len); - - if(s == GNUTLS_E_AGAIN || s == GNUTLS_E_INTERRUPTED) { - s = -1; - errno = EAGAIN; - } else if(s < 0) { - purple_debug_error("gnutls", "send failed: %s\n", - gnutls_strerror(s)); - s = -1; - /* - * TODO: Set errno to something more appropriate. Or even - * better: allow ssl plugins to keep track of their - * own error message, then add a new ssl_ops function - * that returns the error message. - */ - errno = EIO; - } - - return s; -} - -/* Forward declarations are fun! */ -static PurpleCertificate * -x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode); - -static GList * -ssl_gnutls_get_peer_certificates(PurpleSslConnection * gsc) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - - /* List of Certificate instances to return */ - GList * peer_certs = NULL; - - /* List of raw certificates as given by GnuTLS */ - const gnutls_datum *cert_list; - unsigned int cert_list_size = 0; - - unsigned int i; - - /* This should never, ever happen. */ - g_return_val_if_fail( gnutls_certificate_type_get (gnutls_data->session) == GNUTLS_CRT_X509, NULL); - - /* Get the certificate list from GnuTLS */ - /* TODO: I am _pretty sure_ this doesn't block or do other exciting things */ - cert_list = gnutls_certificate_get_peers(gnutls_data->session, - &cert_list_size); - - /* Convert each certificate to a Certificate and append it to the list */ - for (i = 0; i < cert_list_size; i++) { - PurpleCertificate * newcrt = x509_import_from_datum(cert_list[i], - GNUTLS_X509_FMT_DER); - /* Append is somewhat inefficient on linked lists, but is easy - to read. If someone complains, I'll change it. - TODO: Is anyone complaining? (Maybe elb?) */ - peer_certs = g_list_append(peer_certs, newcrt); - } - - /* cert_list doesn't need free()-ing */ - - return peer_certs; -} - -/************************************************************************/ -/* X.509 functionality */ -/************************************************************************/ -const gchar * SCHEME_NAME = "x509"; - -static PurpleCertificateScheme x509_gnutls; - -/** Refcounted GnuTLS certificate data instance */ -typedef struct { - gint refcount; - gnutls_x509_crt crt; -} x509_crtdata_t; - -/** Helper functions for reference counting */ -static x509_crtdata_t * -x509_crtdata_addref(x509_crtdata_t *cd) -{ - (cd->refcount)++; - return cd; -} - -static void -x509_crtdata_delref(x509_crtdata_t *cd) -{ - (cd->refcount)--; - - if (cd->refcount < 0) - g_critical("Refcount of x509_crtdata_t is %d, which is less " - "than zero!\n", cd->refcount); - - /* If the refcount reaches zero, kill the structure */ - if (cd->refcount <= 0) { - /* Kill the internal data */ - gnutls_x509_crt_deinit( cd->crt ); - /* And kill the struct */ - g_free( cd ); - } -} - -/** Helper macro to retrieve the GnuTLS crt_t from a PurpleCertificate */ -#define X509_GET_GNUTLS_DATA(pcrt) ( ((x509_crtdata_t *) (pcrt->data))->crt) - -/** Transforms a gnutls_datum containing an X.509 certificate into a Certificate instance under the x509_gnutls scheme - * - * @param dt Datum to transform - * @param mode GnuTLS certificate format specifier (GNUTLS_X509_FMT_PEM for - * reading from files, and GNUTLS_X509_FMT_DER for converting - * "over the wire" certs for SSL) - * - * @return A newly allocated Certificate structure of the x509_gnutls scheme - */ -static PurpleCertificate * -x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode) -{ - /* Internal certificate data structure */ - x509_crtdata_t *certdat; - /* New certificate to return */ - PurpleCertificate * crt; - - /* Allocate and prepare the internal certificate data */ - certdat = g_new0(x509_crtdata_t, 1); - gnutls_x509_crt_init(&(certdat->crt)); - certdat->refcount = 0; - - /* Perform the actual certificate parse */ - /* Yes, certdat->crt should be passed as-is */ - gnutls_x509_crt_import(certdat->crt, &dt, mode); - - /* Allocate the certificate and load it with data */ - crt = g_new0(PurpleCertificate, 1); - crt->scheme = &x509_gnutls; - crt->data = x509_crtdata_addref(certdat); - - return crt; -} - -/** Imports a PEM-formatted X.509 certificate from the specified file. - * @param filename Filename to import from. Format is PEM - * - * @return A newly allocated Certificate structure of the x509_gnutls scheme - */ -static PurpleCertificate * -x509_import_from_file(const gchar * filename) -{ - PurpleCertificate *crt; /* Certificate being constructed */ - gchar *buf; /* Used to load the raw file data */ - gsize buf_sz; /* Size of the above */ - gnutls_datum dt; /* Struct to pass down to GnuTLS */ - - purple_debug_info("gnutls", - "Attempting to load X.509 certificate from %s\n", - filename); - - /* Next, we'll simply yank the entire contents of the file - into memory */ - /* TODO: Should I worry about very large files here? */ - g_return_val_if_fail( - g_file_get_contents(filename, - &buf, - &buf_sz, - NULL /* No error checking for now */ - ), - NULL); - - /* Load the datum struct */ - dt.data = (unsigned char *) buf; - dt.size = buf_sz; - - /* Perform the conversion; files should be in PEM format */ - crt = x509_import_from_datum(dt, GNUTLS_X509_FMT_PEM); - - /* Cleanup */ - g_free(buf); - - return crt; -} - -/** - * Exports a PEM-formatted X.509 certificate to the specified file. - * @param filename Filename to export to. Format will be PEM - * @param crt Certificate to export - * - * @return TRUE if success, otherwise FALSE - */ -static gboolean -x509_export_certificate(const gchar *filename, PurpleCertificate *crt) -{ - gnutls_x509_crt crt_dat; /* GnuTLS cert struct */ - int ret; - gchar * out_buf; /* Data to output */ - size_t out_size; /* Output size */ - gboolean success = FALSE; - - /* Paranoia paranoia paranoia! */ - g_return_val_if_fail(filename, FALSE); - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - g_return_val_if_fail(crt->data, FALSE); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - /* Obtain the output size required */ - out_size = 0; - ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, - NULL, /* Provide no buffer yet */ - &out_size /* Put size here */ - ); - g_return_val_if_fail(ret == GNUTLS_E_SHORT_MEMORY_BUFFER, FALSE); - - /* Now allocate a buffer and *really* export it */ - out_buf = g_new0(gchar, out_size); - ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, - out_buf, /* Export to our new buffer */ - &out_size /* Put size here */ - ); - if (ret != 0) { - purple_debug_error("gnutls/x509", - "Failed to export cert to buffer with code %d\n", - ret); - g_free(out_buf); - return FALSE; - } - - /* Write it out to an actual file */ - success = purple_util_write_data_to_file_absolute(filename, - out_buf, out_size); - - g_free(out_buf); - return success; -} - -static PurpleCertificate * -x509_copy_certificate(PurpleCertificate *crt) -{ - x509_crtdata_t *crtdat; - PurpleCertificate *newcrt; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - crtdat = (x509_crtdata_t *) crt->data; - - newcrt = g_new0(PurpleCertificate, 1); - newcrt->scheme = &x509_gnutls; - newcrt->data = x509_crtdata_addref(crtdat); - - return newcrt; -} -/** Frees a Certificate - * - * Destroys a Certificate's internal data structures and frees the pointer - * given. - * @param crt Certificate instance to be destroyed. It WILL NOT be destroyed - * if it is not of the correct CertificateScheme. Can be NULL - * - */ -static void -x509_destroy_certificate(PurpleCertificate * crt) -{ - if (NULL == crt) return; - - /* Check that the scheme is x509_gnutls */ - if ( crt->scheme != &x509_gnutls ) { - purple_debug_error("gnutls", - "destroy_certificate attempted on certificate of wrong scheme (scheme was %s, expected %s)\n", - crt->scheme->name, - SCHEME_NAME); - return; - } - - g_return_if_fail(crt->data != NULL); - g_return_if_fail(crt->scheme != NULL); - - /* Use the reference counting system to free (or not) the - underlying data */ - x509_crtdata_delref((x509_crtdata_t *)crt->data); - - /* Kill the structure itself */ - g_free(crt); -} - -/** Determines whether one certificate has been issued and signed by another - * - * @param crt Certificate to check the signature of - * @param issuer Issuer's certificate - * - * @return TRUE if crt was signed and issued by issuer, otherwise FALSE - * @TODO Modify this function to return a reason for invalidity? - */ -static gboolean -x509_certificate_signed_by(PurpleCertificate * crt, - PurpleCertificate * issuer) -{ - gnutls_x509_crt crt_dat; - gnutls_x509_crt issuer_dat; - unsigned int verify; /* used to store result from GnuTLS verifier */ - int ret; - gchar *crt_id = NULL; - gchar *issuer_id = NULL; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(issuer, FALSE); - - /* Verify that both certs are the correct scheme */ - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - g_return_val_if_fail(issuer->scheme == &x509_gnutls, FALSE); - - /* TODO: check for more nullness? */ - - crt_dat = X509_GET_GNUTLS_DATA(crt); - issuer_dat = X509_GET_GNUTLS_DATA(issuer); - - /* First, let's check that crt.issuer is actually issuer */ - ret = gnutls_x509_crt_check_issuer(crt_dat, issuer_dat); - if (ret <= 0) { - - if (ret < 0) { - purple_debug_error("gnutls/x509", - "GnuTLS error %d while checking certificate issuer match.", - ret); - } else { - gchar *crt_id, *issuer_id, *crt_issuer_id; - crt_id = purple_certificate_get_unique_id(crt); - issuer_id = purple_certificate_get_unique_id(issuer); - crt_issuer_id = - purple_certificate_get_issuer_unique_id(crt); - purple_debug_info("gnutls/x509", - "Certificate %s is issued by " - "%s, which does not match %s.\n", - crt_id ? crt_id : "(null)", - crt_issuer_id ? crt_issuer_id : "(null)", - issuer_id ? issuer_id : "(null)"); - g_free(crt_id); - g_free(issuer_id); - g_free(crt_issuer_id); - } - - /* The issuer is not correct, or there were errors */ - return FALSE; - } - - /* Now, check the signature */ - /* The second argument is a ptr to an array of "trusted" issuer certs, - but we're only using one trusted one */ - ret = gnutls_x509_crt_verify(crt_dat, &issuer_dat, 1, - /* Permit signings by X.509v1 certs - (Verisign and possibly others have - root certificates that predate the - current standard) */ - GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT, - &verify); - - if (ret != 0) { - purple_debug_error("gnutls/x509", - "Attempted certificate verification caused a GnuTLS error code %d. I will just say the signature is bad, but you should look into this.\n", ret); - return FALSE; - } - -#ifdef HAVE_GNUTLS_CERT_INSECURE_ALGORITHM - if (verify & GNUTLS_CERT_INSECURE_ALGORITHM) { - /* - * A certificate in the chain is signed with an insecure - * algorithm. Put a warning into the log to make this error - * perfectly clear as soon as someone looks at the debug log is - * generated. - */ - crt_id = purple_certificate_get_unique_id(crt); - issuer_id = purple_certificate_get_issuer_unique_id(crt); - purple_debug_warning("gnutls/x509", - "Insecure hash algorithm used by %s to sign %s\n", - issuer_id, crt_id); - } -#endif - - if (verify & GNUTLS_CERT_INVALID) { - /* Signature didn't check out, but at least - there were no errors*/ - if (!crt_id) - crt_id = purple_certificate_get_unique_id(crt); - if (!issuer_id) - issuer_id = purple_certificate_get_issuer_unique_id(crt); - purple_debug_error("gnutls/x509", - "Bad signature from %s on %s\n", - issuer_id, crt_id); - g_free(crt_id); - g_free(issuer_id); - - return FALSE; - } /* if (ret, etc.) */ - - /* If we got here, the signature is good */ - return TRUE; -} - -static GByteArray * -x509_sha1sum(PurpleCertificate *crt) -{ - size_t hashlen = 20; /* SHA1 hashes are 20 bytes */ - size_t tmpsz = hashlen; /* Throw-away variable for GnuTLS to stomp on*/ - gnutls_x509_crt crt_dat; - GByteArray *hash; /**< Final hash container */ - guchar hashbuf[20]; /**< Temporary buffer to contain hash */ - - g_return_val_if_fail(crt, NULL); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - /* Extract the fingerprint */ - g_return_val_if_fail( - 0 == gnutls_x509_crt_get_fingerprint(crt_dat, GNUTLS_MAC_SHA, - hashbuf, &tmpsz), - NULL); - - /* This shouldn't happen */ - g_return_val_if_fail(tmpsz == hashlen, NULL); - - /* Okay, now create and fill hash array */ - hash = g_byte_array_new(); - g_byte_array_append(hash, hashbuf, hashlen); - - return hash; -} - -static gchar * -x509_cert_dn (PurpleCertificate *crt) -{ - gnutls_x509_crt cert_dat; - gchar *dn = NULL; - size_t dn_size; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - cert_dat = X509_GET_GNUTLS_DATA(crt); - - /* Figure out the length of the Distinguished Name */ - /* Claim that the buffer is size 0 so GnuTLS just tells us how much - space it needs */ - dn_size = 0; - gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size); - - /* Now allocate and get the Distinguished Name */ - /* Old versions of GnuTLS have an off-by-one error in reporting - the size of the needed buffer in some functions, so allocate - an extra byte */ - dn = g_new0(gchar, ++dn_size); - if (0 != gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size)) { - purple_debug_error("gnutls/x509", - "Failed to get Distinguished Name\n"); - g_free(dn); - return NULL; - } - - return dn; -} - -static gchar * -x509_issuer_dn (PurpleCertificate *crt) -{ - gnutls_x509_crt cert_dat; - gchar *dn = NULL; - size_t dn_size; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - cert_dat = X509_GET_GNUTLS_DATA(crt); - - /* Figure out the length of the Distinguished Name */ - /* Claim that the buffer is size 0 so GnuTLS just tells us how much - space it needs */ - dn_size = 0; - gnutls_x509_crt_get_issuer_dn(cert_dat, dn, &dn_size); - - /* Now allocate and get the Distinguished Name */ - /* Old versions of GnuTLS have an off-by-one error in reporting - the size of the needed buffer in some functions, so allocate - an extra byte */ - dn = g_new0(gchar, ++dn_size); - if (0 != gnutls_x509_crt_get_issuer_dn(cert_dat, dn, &dn_size)) { - purple_debug_error("gnutls/x509", - "Failed to get issuer's Distinguished " - "Name\n"); - g_free(dn); - return NULL; - } - - return dn; -} - -static gchar * -x509_common_name (PurpleCertificate *crt) -{ - gnutls_x509_crt cert_dat; - gchar *cn = NULL; - size_t cn_size; - int ret; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - cert_dat = X509_GET_GNUTLS_DATA(crt); - - /* Figure out the length of the Common Name */ - /* Claim that the buffer is size 0 so GnuTLS just tells us how much - space it needs */ - cn_size = 0; - gnutls_x509_crt_get_dn_by_oid(cert_dat, - GNUTLS_OID_X520_COMMON_NAME, - 0, /* First CN found, please */ - 0, /* Not in raw mode */ - cn, &cn_size); - - /* Now allocate and get the Common Name */ - /* Old versions of GnuTLS have an off-by-one error in reporting - the size of the needed buffer in some functions, so allocate - an extra byte */ - cn = g_new0(gchar, ++cn_size); - ret = gnutls_x509_crt_get_dn_by_oid(cert_dat, - GNUTLS_OID_X520_COMMON_NAME, - 0, /* First CN found, please */ - 0, /* Not in raw mode */ - cn, &cn_size); - if (ret != 0) { - purple_debug_error("gnutls/x509", - "Failed to get Common Name\n"); - g_free(cn); - return NULL; - } - - return cn; -} - -static gboolean -x509_check_name (PurpleCertificate *crt, const gchar *name) -{ - gnutls_x509_crt crt_dat; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - g_return_val_if_fail(name, FALSE); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - if (gnutls_x509_crt_check_hostname(crt_dat, name)) { - return TRUE; - } else { - return FALSE; - } -} - -static gboolean -x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) -{ - gnutls_x509_crt crt_dat; - /* GnuTLS time functions return this on error */ - const time_t errval = (time_t) (-1); - gboolean success = TRUE; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - if (activation) { - *activation = gnutls_x509_crt_get_activation_time(crt_dat); - if (*activation == errval) - success = FALSE; - } - if (expiration) { - *expiration = gnutls_x509_crt_get_expiration_time(crt_dat); - if (*expiration == errval) - success = FALSE; - } - - return success; -} - -/* X.509 certificate operations provided by this plugin */ -static PurpleCertificateScheme x509_gnutls = { - "x509", /* Scheme name */ - N_("X.509 Certificates"), /* User-visible scheme name */ - x509_import_from_file, /* Certificate import function */ - x509_export_certificate, /* Certificate export function */ - x509_copy_certificate, /* Copy */ - x509_destroy_certificate, /* Destroy cert */ - x509_certificate_signed_by, /* Signature checker */ - x509_sha1sum, /* SHA1 fingerprint */ - x509_cert_dn, /* Unique ID */ - x509_issuer_dn, /* Issuer Unique ID */ - x509_common_name, /* Subject name */ - x509_check_name, /* Check subject name */ - x509_times, /* Activation/Expiration time */ - - NULL, - NULL, - NULL, - NULL - -}; - -static PurpleSslOps ssl_ops = -{ - ssl_gnutls_init, - ssl_gnutls_uninit, - ssl_gnutls_connect, - ssl_gnutls_close, - ssl_gnutls_read, - ssl_gnutls_write, - ssl_gnutls_get_peer_certificates, - - /* padding */ - NULL, - NULL, - NULL -}; - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - if(!purple_ssl_get_ops()) { - purple_ssl_set_ops(&ssl_ops); - } - - /* Init GNUTLS now so others can use it even if sslconn never does */ - ssl_gnutls_init_gnutls(); - - /* Register that we're providing an X.509 CertScheme */ - purple_certificate_register_scheme( &x509_gnutls ); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - if(purple_ssl_get_ops() == &ssl_ops) { - purple_ssl_set_ops(NULL); - } - - purple_certificate_unregister_scheme( &x509_gnutls ); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SSL_GNUTLS_PLUGIN_ID, /**< id */ - N_("GNUTLS"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Provides SSL support through GNUTLS."), - /** description */ - N_("Provides SSL support through GNUTLS."), - "Christian Hammond ", - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ssl_gnutls, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-nss.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-nss.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-nss.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/ssl/ssl-nss.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,972 +0,0 @@ -/** - * @file ssl-nss.c Mozilla NSS SSL plugin. - * - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "certificate.h" -#include "plugin.h" -#include "sslconn.h" -#include "util.h" -#include "version.h" - -#define SSL_NSS_PLUGIN_ID "ssl-nss" - -#undef HAVE_LONG_LONG /* Make Mozilla less angry. If angry, Mozilla SMASH! */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* This is defined in NSPR's , but to avoid including a - * private header we duplicate the prototype here */ -NSPR_API(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd); - -typedef struct -{ - PRFileDesc *fd; - PRFileDesc *in; - guint handshake_handler; - -} PurpleSslNssData; - -#define PURPLE_SSL_NSS_DATA(gsc) ((PurpleSslNssData *)gsc->private_data) - -static const PRIOMethods *_nss_methods = NULL; -static PRDescIdentity _identity; -static PurpleCertificateScheme x509_nss; - -/* Thank you, Evolution */ -static void -set_errno(int code) -{ - /* FIXME: this should handle more. */ - switch (code) { - case PR_INVALID_ARGUMENT_ERROR: - errno = EINVAL; - break; - case PR_PENDING_INTERRUPT_ERROR: - errno = EINTR; - break; - case PR_IO_PENDING_ERROR: - errno = EAGAIN; - break; - case PR_WOULD_BLOCK_ERROR: - errno = EAGAIN; - /*errno = EWOULDBLOCK; */ - break; - case PR_IN_PROGRESS_ERROR: - errno = EINPROGRESS; - break; - case PR_ALREADY_INITIATED_ERROR: - errno = EALREADY; - break; - case PR_NETWORK_UNREACHABLE_ERROR: - errno = EHOSTUNREACH; - break; - case PR_CONNECT_REFUSED_ERROR: - errno = ECONNREFUSED; - break; - case PR_CONNECT_TIMEOUT_ERROR: - case PR_IO_TIMEOUT_ERROR: - errno = ETIMEDOUT; - break; - case PR_NOT_CONNECTED_ERROR: - errno = ENOTCONN; - break; - case PR_CONNECT_RESET_ERROR: - errno = ECONNRESET; - break; - case PR_IO_ERROR: - default: - errno = EIO; - break; - } -} - -static gchar *get_error_text(void) -{ - PRInt32 len = PR_GetErrorTextLength(); - gchar *ret = NULL; - - if (len > 0) { - ret = g_malloc(len + 1); - len = PR_GetErrorText(ret); - ret[len] = '\0'; - } - - return ret; -} - -static void -ssl_nss_init_nss(void) -{ - char *lib; - PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); - NSS_NoDB_Init("."); - - /* TODO: Fix this so autoconf does the work trying to find this lib. */ -#ifndef _WIN32 - lib = g_strdup(LIBDIR "/libnssckbi.so"); -#else - lib = g_strdup("nssckbi.dll"); -#endif - SECMOD_AddNewModule("Builtins", lib, 0, 0); - g_free(lib); - NSS_SetDomesticPolicy(); - - SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_256_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_256_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_RC4_128_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_RSA_WITH_RC4_128_SHA, 1); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_128_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_DES_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_DES_CBC_SHA, 1); - - _identity = PR_GetUniqueIdentity("Purple"); - _nss_methods = PR_GetDefaultIOMethods(); -} - -static SECStatus -ssl_auth_cert(void *arg, PRFileDesc *socket, PRBool checksig, - PRBool is_server) -{ - return SECSuccess; - -#if 0 - CERTCertificate *cert; - void *pinArg; - SECStatus status; - - cert = SSL_PeerCertificate(socket); - pinArg = SSL_RevealPinArg(socket); - - status = CERT_VerifyCertNow((CERTCertDBHandle *)arg, cert, checksig, - certUsageSSLClient, pinArg); - - if (status != SECSuccess) { - purple_debug_error("nss", "CERT_VerifyCertNow failed\n"); - CERT_DestroyCertificate(cert); - return status; - } - - CERT_DestroyCertificate(cert); - return SECSuccess; -#endif -} - -#if 0 -static SECStatus -ssl_bad_cert(void *arg, PRFileDesc *socket) -{ - SECStatus status = SECFailure; - PRErrorCode err; - - if (arg == NULL) - return status; - - *(PRErrorCode *)arg = err = PORT_GetError(); - - switch (err) - { - case SEC_ERROR_INVALID_AVA: - case SEC_ERROR_INVALID_TIME: - case SEC_ERROR_BAD_SIGNATURE: - case SEC_ERROR_EXPIRED_CERTIFICATE: - case SEC_ERROR_UNKNOWN_ISSUER: - case SEC_ERROR_UNTRUSTED_CERT: - case SEC_ERROR_CERT_VALID: - case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE: - case SEC_ERROR_CRL_EXPIRED: - case SEC_ERROR_CRL_BAD_SIGNATURE: - case SEC_ERROR_EXTENSION_VALUE_INVALID: - case SEC_ERROR_CA_CERT_INVALID: - case SEC_ERROR_CERT_USAGES_INVALID: - case SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION: - status = SECSuccess; - break; - - default: - status = SECFailure; - break; - } - - purple_debug_error("nss", "Bad certificate: %d\n", err); - - return status; -} -#endif - -static gboolean -ssl_nss_init(void) -{ - return TRUE; -} - -static void -ssl_nss_uninit(void) -{ - PR_Cleanup(); - - _nss_methods = NULL; -} - -static void -ssl_nss_verified_cb(PurpleCertificateVerificationStatus st, - gpointer userdata) -{ - PurpleSslConnection *gsc = (PurpleSslConnection *) userdata; - - if (st == PURPLE_CERTIFICATE_VALID) { - /* Certificate valid? Good! Do the connection! */ - gsc->connect_cb(gsc->connect_cb_data, gsc, PURPLE_INPUT_READ); - } else { - /* Otherwise, signal an error */ - if(gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CERTIFICATE_INVALID, - gsc->connect_cb_data); - purple_ssl_close(gsc); - } -} - -/** Transforms an NSS containing an X.509 certificate into a Certificate instance - * - * @param cert Certificate to transform - * @return A newly allocated Certificate - */ -static PurpleCertificate * -x509_import_from_nss(CERTCertificate* cert) -{ - /* New certificate to return */ - PurpleCertificate * crt; - - /* Allocate the certificate and load it with data */ - crt = g_new0(PurpleCertificate, 1); - crt->scheme = &x509_nss; - crt->data = CERT_DupCertificate(cert); - - return crt; -} - -static GList * -ssl_nss_get_peer_certificates(PRFileDesc *socket, PurpleSslConnection * gsc) -{ - CERTCertificate *curcert; - CERTCertificate *issuerCert; - PurpleCertificate * newcrt; - - /* List of Certificate instances to return */ - GList * peer_certs = NULL; - int count; - int64 now = PR_Now(); - - curcert = SSL_PeerCertificate(socket); - if (curcert == NULL) { - purple_debug_error("nss", "could not DupCertificate\n"); - return NULL; - } - - for (count = 0 ; count < CERT_MAX_CERT_CHAIN ; count++) { - purple_debug_info("nss", "subject=%s issuer=%s\n", curcert->subjectName, - curcert->issuerName ? curcert->issuerName : "(null)"); - newcrt = x509_import_from_nss(curcert); - peer_certs = g_list_append(peer_certs, newcrt); - - if (curcert->isRoot) { - break; - } - issuerCert = CERT_FindCertIssuer(curcert, now, certUsageSSLServer); - if (!issuerCert) { - purple_debug_error("nss", "partial certificate chain\n"); - break; - } - CERT_DestroyCertificate(curcert); - curcert = issuerCert; - } - CERT_DestroyCertificate(curcert); - - return peer_certs; -} - -static void -ssl_nss_handshake_cb(gpointer data, int fd, PurpleInputCondition cond) -{ - PurpleSslConnection *gsc = (PurpleSslConnection *)data; - PurpleSslNssData *nss_data = gsc->private_data; - - /* I don't think this the best way to do this... - * It seems to work because it'll eventually use the cached value - */ - if(SSL_ForceHandshake(nss_data->in) != SECSuccess) { - gchar *error_txt; - set_errno(PR_GetError()); - if (errno == EAGAIN || errno == EWOULDBLOCK) - return; - - error_txt = get_error_text(); - purple_debug_error("nss", "Handshake failed %s (%d)\n", error_txt ? error_txt : "", PR_GetError()); - g_free(error_txt); - - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data); - - purple_ssl_close(gsc); - - return; - } - - purple_input_remove(nss_data->handshake_handler); - nss_data->handshake_handler = 0; - - /* If a Verifier was given, hand control over to it */ - if (gsc->verifier) { - GList *peers; - /* First, get the peer cert chain */ - peers = ssl_nss_get_peer_certificates(nss_data->in, gsc); - - /* Now kick off the verification process */ - purple_certificate_verify(gsc->verifier, - gsc->host, - peers, - ssl_nss_verified_cb, - gsc); - - purple_certificate_destroy_list(peers); - } else { - /* Otherwise, just call the "connection complete" - callback */ - gsc->connect_cb(gsc->connect_cb_data, gsc, cond); - } -} - -static void -ssl_nss_connect(PurpleSslConnection *gsc) -{ - PurpleSslNssData *nss_data = g_new0(PurpleSslNssData, 1); - PRSocketOptionData socket_opt; - - gsc->private_data = nss_data; - - nss_data->fd = PR_ImportTCPSocket(gsc->fd); - - if (nss_data->fd == NULL) - { - purple_debug_error("nss", "nss_data->fd == NULL!\n"); - - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); - - purple_ssl_close((PurpleSslConnection *)gsc); - - return; - } - - socket_opt.option = PR_SockOpt_Nonblocking; - socket_opt.value.non_blocking = PR_TRUE; - - if (PR_SetSocketOption(nss_data->fd, &socket_opt) != PR_SUCCESS) { - gchar *error_txt = get_error_text(); - purple_debug_warning("nss", "unable to set socket into non-blocking mode: %s (%d)\n", error_txt ? error_txt : "", PR_GetError()); - g_free(error_txt); - } - - nss_data->in = SSL_ImportFD(NULL, nss_data->fd); - - if (nss_data->in == NULL) - { - purple_debug_error("nss", "nss_data->in == NUL!\n"); - - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); - - purple_ssl_close((PurpleSslConnection *)gsc); - - return; - } - - SSL_OptionSet(nss_data->in, SSL_SECURITY, PR_TRUE); - SSL_OptionSet(nss_data->in, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE); - - SSL_AuthCertificateHook(nss_data->in, - (SSLAuthCertificate)ssl_auth_cert, - (void *)CERT_GetDefaultCertDB()); -#if 0 - /* No point in hooking BadCert, since ssl_auth_cert always succeeds */ - SSL_BadCertHook(nss_data->in, (SSLBadCertHandler)ssl_bad_cert, NULL); -#endif - - if(gsc->host) - SSL_SetURL(nss_data->in, gsc->host); - -#if 0 - /* This seems like it'd the be the correct way to implement the - nonblocking stuff, but it doesn't seem to work */ - SSL_HandshakeCallback(nss_data->in, - (SSLHandshakeCallback) ssl_nss_handshake_cb, gsc); -#endif - SSL_ResetHandshake(nss_data->in, PR_FALSE); - - nss_data->handshake_handler = purple_input_add(gsc->fd, - PURPLE_INPUT_READ, ssl_nss_handshake_cb, gsc); - - ssl_nss_handshake_cb(gsc, gsc->fd, PURPLE_INPUT_READ); -} - -static void -ssl_nss_close(PurpleSslConnection *gsc) -{ - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - - if(!nss_data) - return; - - if (nss_data->in) { - PR_Close(nss_data->in); - gsc->fd = -1; - } else if (nss_data->fd) { - PR_Close(nss_data->fd); - gsc->fd = -1; - } - - if (nss_data->handshake_handler) - purple_input_remove(nss_data->handshake_handler); - - g_free(nss_data); - gsc->private_data = NULL; -} - -static size_t -ssl_nss_read(PurpleSslConnection *gsc, void *data, size_t len) -{ - ssize_t ret; - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - - ret = PR_Read(nss_data->in, data, len); - - if (ret == -1) - set_errno(PR_GetError()); - - return ret; -} - -static size_t -ssl_nss_write(PurpleSslConnection *gsc, const void *data, size_t len) -{ - ssize_t ret; - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - - if(!nss_data) - return 0; - - ret = PR_Write(nss_data->in, data, len); - - if (ret == -1) - set_errno(PR_GetError()); - - return ret; -} - -static GList * -ssl_nss_peer_certs(PurpleSslConnection *gsc) -{ -#if 0 - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - CERTCertificate *cert; -/* - GList *chain = NULL; - void *pinArg; - SECStatus status; -*/ - - /* TODO: this is a blind guess */ - cert = SSL_PeerCertificate(nss_data->fd); - - if (cert) - CERT_DestroyCertificate(cert); -#endif - - - - return NULL; -} - -/************************************************************************/ -/* X.509 functionality */ -/************************************************************************/ -static PurpleCertificateScheme x509_nss; - -/** Helpr macro to retrieve the NSS certdata from a PurpleCertificate */ -#define X509_NSS_DATA(pcrt) ( (CERTCertificate * ) (pcrt->data) ) - -/** Imports a PEM-formatted X.509 certificate from the specified file. - * @param filename Filename to import from. Format is PEM - * - * @return A newly allocated Certificate structure of the x509_gnutls scheme - */ -static PurpleCertificate * -x509_import_from_file(const gchar *filename) -{ - gchar *rawcert; - gsize len = 0; - CERTCertificate *crt_dat; - PurpleCertificate *crt; - - g_return_val_if_fail(filename != NULL, NULL); - - purple_debug_info("nss/x509", - "Loading certificate from %s\n", - filename); - - /* Load the raw data up */ - if (!g_file_get_contents(filename, - &rawcert, &len, - NULL)) { - purple_debug_error("nss/x509", "Unable to read certificate file.\n"); - return NULL; - } - - if (len == 0) { - purple_debug_error("nss/x509", - "Certificate file has no contents!\n"); - if (rawcert) - g_free(rawcert); - return NULL; - } - - /* Decode the certificate */ - crt_dat = CERT_DecodeCertFromPackage(rawcert, len); - g_free(rawcert); - - g_return_val_if_fail(crt_dat != NULL, NULL); - - crt = g_new0(PurpleCertificate, 1); - crt->scheme = &x509_nss; - crt->data = crt_dat; - - return crt; -} - -/** - * Exports a PEM-formatted X.509 certificate to the specified file. - * @param filename Filename to export to. Format will be PEM - * @param crt Certificate to export - * - * @return TRUE if success, otherwise FALSE - */ -/* This function should not be so complicated, but NSS doesn't seem to have a - "convert yon certificate to PEM format" function. */ -static gboolean -x509_export_certificate(const gchar *filename, PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - SECItem *dercrt; - gchar *b64crt; - gchar *pemcrt; - gboolean ret = FALSE; - - g_return_val_if_fail(filename, FALSE); - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_nss, FALSE); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, FALSE); - - purple_debug_info("nss/x509", - "Exporting certificate to %s\n", filename); - - /* First, use NSS voodoo to create a DER-formatted certificate */ - dercrt = SEC_ASN1EncodeItem(NULL, NULL, crt_dat, - SEC_ASN1_GET(SEC_SignedCertificateTemplate)); - g_return_val_if_fail(dercrt != NULL, FALSE); - - /* Now encode it to b64 */ - b64crt = NSSBase64_EncodeItem(NULL, NULL, 0, dercrt); - SECITEM_FreeItem(dercrt, PR_TRUE); - g_return_val_if_fail(b64crt, FALSE); - - /* Wrap it in nice PEM header things */ - pemcrt = g_strdup_printf("-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n", b64crt); - PORT_Free(b64crt); /* Notice that b64crt was allocated by an NSS - function; hence, we'll let NSPR free it. */ - - /* Finally, dump the silly thing to a file. */ - ret = purple_util_write_data_to_file_absolute(filename, pemcrt, -1); - - g_free(pemcrt); - - return ret; -} - -static PurpleCertificate * -x509_copy_certificate(PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - PurpleCertificate *newcrt; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - /* Create the certificate copy */ - newcrt = g_new0(PurpleCertificate, 1); - newcrt->scheme = &x509_nss; - /* NSS does refcounting automatically */ - newcrt->data = CERT_DupCertificate(crt_dat); - - return newcrt; -} - -/** Frees a Certificate - * - * Destroys a Certificate's internal data structures and frees the pointer - * given. - * @param crt Certificate instance to be destroyed. It WILL NOT be destroyed - * if it is not of the correct CertificateScheme. Can be NULL - * - */ -static void -x509_destroy_certificate(PurpleCertificate * crt) -{ - CERTCertificate *crt_dat; - - g_return_if_fail(crt); - g_return_if_fail(crt->scheme == &x509_nss); - - crt_dat = X509_NSS_DATA(crt); - g_return_if_fail(crt_dat); - - /* Finally we have the certificate. So let's kill it */ - /* NSS does refcounting automatically */ - CERT_DestroyCertificate(crt_dat); - - /* Delete the PurpleCertificate as well */ - g_free(crt); -} - -/** Determines whether one certificate has been issued and signed by another - * - * @param crt Certificate to check the signature of - * @param issuer Issuer's certificate - * - * @return TRUE if crt was signed and issued by issuer, otherwise FALSE - * @TODO Modify this function to return a reason for invalidity? - */ -static gboolean -x509_signed_by(PurpleCertificate * crt, - PurpleCertificate * issuer) -{ - CERTCertificate *subjectCert; - CERTCertificate *issuerCert; - SECStatus st; - - issuerCert = X509_NSS_DATA(issuer); - g_return_val_if_fail(issuerCert, FALSE); - - subjectCert = X509_NSS_DATA(crt); - g_return_val_if_fail(subjectCert, FALSE); - - if (subjectCert->issuerName == NULL - || PORT_Strcmp(subjectCert->issuerName, issuerCert->subjectName) != 0) - return FALSE; - st = CERT_VerifySignedData(&subjectCert->signatureWrap, issuerCert, PR_Now(), NULL); - return st == SECSuccess; -} - -static GByteArray * -x509_sha1sum(PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - size_t hashlen = 20; /* Size of an sha1sum */ - GByteArray *sha1sum; - SECItem *derCert; /* DER representation of the cert */ - SECStatus st; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - /* Get the certificate DER representation */ - derCert = &(crt_dat->derCert); - - /* Make a hash! */ - sha1sum = g_byte_array_sized_new(hashlen); - /* glib leaves the size as 0 by default */ - sha1sum->len = hashlen; - - st = PK11_HashBuf(SEC_OID_SHA1, sha1sum->data, - derCert->data, derCert->len); - - /* Check for errors */ - if (st != SECSuccess) { - g_byte_array_free(sha1sum, TRUE); - purple_debug_error("nss/x509", - "Error: hashing failed!\n"); - return NULL; - } - - return sha1sum; -} - -static gchar * -x509_dn (PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - return g_strdup(crt_dat->subjectName); -} - -static gchar * -x509_issuer_dn (PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - return g_strdup(crt_dat->issuerName); -} - -static gchar * -x509_common_name (PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - char *nss_cn; - gchar *ret_cn; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - /* Q: - Why get a newly allocated string out of NSS, strdup it, and then - return the new copy? - - A: - The NSS LXR docs state that I should use the NSPR free functions on - the strings that the NSS cert functions return. Since the libpurple - API expects a g_free()-able string, we make our own copy and return - that. - - NSPR is something of a prima donna. */ - - nss_cn = CERT_GetCommonName( &(crt_dat->subject) ); - ret_cn = g_strdup(nss_cn); - PORT_Free(nss_cn); - - return ret_cn; -} - -static gboolean -x509_check_name (PurpleCertificate *crt, const gchar *name) -{ - CERTCertificate *crt_dat; - SECStatus st; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_nss, FALSE); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, FALSE); - - st = CERT_VerifyCertName(crt_dat, name); - - if (st == SECSuccess) { - return TRUE; - } - else if (st == SECFailure) { - return FALSE; - } - - /* If we get here...bad things! */ - purple_debug_error("nss/x509", - "x509_check_name fell through where it shouldn't " - "have.\n"); - return FALSE; -} - -static gboolean -x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) -{ - CERTCertificate *crt_dat; - PRTime nss_activ, nss_expir; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_nss, FALSE); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, FALSE); - - /* Extract the times into ugly PRTime thingies */ - /* TODO: Maybe this shouldn't throw an error? */ - g_return_val_if_fail( - SECSuccess == CERT_GetCertTimes(crt_dat, - &nss_activ, &nss_expir), - FALSE); - - /* NSS's native PRTime type *almost* corresponds to time_t; however, - it measures *microseconds* since the epoch, not seconds. Hence - the funny conversion. */ - if (activation) { - *activation = nss_activ / 1000000; - } - if (expiration) { - *expiration = nss_expir / 1000000; - } - - return TRUE; -} - -static PurpleCertificateScheme x509_nss = { - "x509", /* Scheme name */ - N_("X.509 Certificates"), /* User-visible scheme name */ - x509_import_from_file, /* Certificate import function */ - x509_export_certificate, /* Certificate export function */ - x509_copy_certificate, /* Copy */ - x509_destroy_certificate, /* Destroy cert */ - x509_signed_by, /* Signed-by */ - x509_sha1sum, /* SHA1 fingerprint */ - x509_dn, /* Unique ID */ - x509_issuer_dn, /* Issuer Unique ID */ - x509_common_name, /* Subject name */ - x509_check_name, /* Check subject name */ - x509_times, /* Activation/Expiration time */ - - NULL, - NULL, - NULL, - NULL -}; - -static PurpleSslOps ssl_ops = -{ - ssl_nss_init, - ssl_nss_uninit, - ssl_nss_connect, - ssl_nss_close, - ssl_nss_read, - ssl_nss_write, - ssl_nss_peer_certs, - - /* padding */ - NULL, - NULL, - NULL -}; - - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - if (!purple_ssl_get_ops()) { - purple_ssl_set_ops(&ssl_ops); - } - - /* Init NSS now, so others can use it even if sslconn never does */ - ssl_nss_init_nss(); - - /* Register the X.509 functions we provide */ - purple_certificate_register_scheme(&x509_nss); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - if (purple_ssl_get_ops() == &ssl_ops) { - purple_ssl_set_ops(NULL); - } - - /* Unregister our X.509 functions */ - purple_certificate_unregister_scheme(&x509_nss); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SSL_NSS_PLUGIN_ID, /**< id */ - N_("NSS"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Provides SSL support through Mozilla NSS."), - /** description */ - N_("Provides SSL support through Mozilla NSS."), - "Christian Hammond ", - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ssl_nss, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/startup.py qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/startup.py --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/startup.py 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/startup.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -#!/usr/bin/env python -# -# Makes sure only one purple instance is running -# -# Purple is the legal property of its developers, whose names are too numerous -# to list here. Please refer to the COPYRIGHT file distributed with this -# source distribution. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -# - -import sys -import dbus -import os - -if len(sys.argv) == 1: - print "Usage:", sys.argv[0], """ [arguments] - -Example: - """, sys.argv[0], "pidgin -d -c /my/home" - sys.exit(1) - -home = os.path.expanduser('~/.purple/') -for arg in range(1, len(sys.argv[1:])): - if sys.argv[arg] == "-c": - home = os.path.expanduser(sys.argv[arg + 1]) - break - -bus = dbus.SessionBus() - -try: - obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") - purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - userdir = purple.PurpleUserDir() - if not os.path.isabs(userdir): - userdir = os.path.join(purple.PurpleHomeDir(), userdir) - if home == userdir: - print "Already running." - purple.PurpleBlistShow() - else: - print "Starting client from a different home directory." - raise -except: - os.execlp(sys.argv[1], " ".join(sys.argv[2:])) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/statenotify.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/statenotify.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/statenotify.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/statenotify.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,197 +0,0 @@ -#include "internal.h" - -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "signals.h" -#include "version.h" - -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" - -#define STATENOTIFY_PLUGIN_ID "core-statenotify" - -static void -write_status(PurpleBuddy *buddy, const char *message) -{ - PurpleAccount *account = NULL; - PurpleConversation *conv; - const char *who; - char buf[256]; - char *escaped; - const gchar *buddy_name = NULL; - - account = purple_buddy_get_account(buddy); - buddy_name = purple_buddy_get_name(buddy); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - buddy_name, account); - - if (conv == NULL) - return; - g_return_if_fail(conv->type == PURPLE_CONV_TYPE_IM); - - /* Prevent duplicate notifications for buddies in multiple groups */ - if (buddy != purple_find_buddy(account, buddy_name)) - return; - - who = purple_buddy_get_alias(buddy); - escaped = g_markup_escape_text(who, -1); - - g_snprintf(buf, sizeof(buf), message, escaped); - g_free(escaped); - - purple_conv_im_write(conv->u.im, NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); -} - -static void -buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, - PurpleStatus *status, void *data) -{ - gboolean available, old_available; - - if (!purple_status_is_exclusive(status) || - !purple_status_is_exclusive(old_status)) - return; - - available = purple_status_is_available(status); - old_available = purple_status_is_available(old_status); - - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_away")) { - if (available && !old_available) - write_status(buddy, _("%s is no longer away.")); - else if (!available && old_available) - write_status(buddy, _("%s has gone away.")); - } -} - -static void -buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, - void *data) -{ - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_idle")) { - if (idle && !old_idle) { - write_status(buddy, _("%s has become idle.")); - } else if (!idle && old_idle) { - write_status(buddy, _("%s is no longer idle.")); - } - } -} - -static void -buddy_signon_cb(PurpleBuddy *buddy, void *data) -{ - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_signon")) - write_status(buddy, _("%s has signed on.")); -} - -static void -buddy_signoff_cb(PurpleBuddy *buddy, void *data) -{ - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_signon")) - write_status(buddy, _("%s has signed off.")); -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_label(_("Notify When")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_away", _("Buddy Goes _Away")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_signon", _("Buddy _Signs On/Off")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *blist_handle = purple_blist_get_handle(); - - purple_signal_connect(blist_handle, "buddy-status-changed", plugin, - PURPLE_CALLBACK(buddy_status_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-idle-changed", plugin, - PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-on", plugin, - PURPLE_CALLBACK(buddy_signon_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-off", plugin, - PURPLE_CALLBACK(buddy_signoff_cb), NULL); - - return TRUE; -} - -static PurplePluginUiInfo prefs_info = -{ - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - STATENOTIFY_PLUGIN_ID, /**< id */ - N_("Buddy State Notification"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Notifies in a conversation window when a buddy goes or returns from " - "away or idle."), - /** description */ - N_("Notifies in a conversation window when a buddy goes or returns from " - "away or idle."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none("/plugins/core/statenotify"); - purple_prefs_add_bool("/plugins/core/statenotify/notify_away", TRUE); - purple_prefs_add_bool("/plugins/core/statenotify/notify_idle", TRUE); - purple_prefs_add_bool("/plugins/core/statenotify/notify_signon", TRUE); -} - -PURPLE_INIT_PLUGIN(statenotify, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -tcl_la_LDFLAGS = -module -avoid-version - -plugin_LTLIBRARIES = tcl.la - -tcl_la_SOURCES = tcl.c tcl_glib.c tcl_glib.h tcl_cmds.c tcl_signals.c tcl_purple.h \ - tcl_ref.c tcl_cmd.c - -tcl_la_LIBADD = $(GLIB_LIBS) $(TCL_LIBS) $(TK_LIBS) - -EXTRA_DIST = signal-test.tcl Makefile.mingw - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(TK_CFLAGS) \ - $(TCL_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,718 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/tcl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -tcl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am_tcl_la_OBJECTS = tcl.lo tcl_glib.lo tcl_cmds.lo tcl_signals.lo \ - tcl_ref.lo tcl_cmd.lo -tcl_la_OBJECTS = $(am_tcl_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(tcl_la_SOURCES) -DIST_SOURCES = $(tcl_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -tcl_la_LDFLAGS = -module -avoid-version -plugin_LTLIBRARIES = tcl.la -tcl_la_SOURCES = tcl.c tcl_glib.c tcl_glib.h tcl_cmds.c tcl_signals.c tcl_purple.h \ - tcl_ref.c tcl_cmd.c - -tcl_la_LIBADD = $(GLIB_LIBS) $(TCL_LIBS) $(TK_LIBS) -EXTRA_DIST = signal-test.tcl Makefile.mingw -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(TK_CFLAGS) \ - $(TCL_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/tcl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/tcl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -tcl.la: $(tcl_la_OBJECTS) $(tcl_la_DEPENDENCIES) - $(LINK) -rpath $(plugindir) $(tcl_la_LDFLAGS) $(tcl_la_OBJECTS) $(tcl_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_cmd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_cmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_glib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_ref.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_signals.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for tcl plugin loader plugin. -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = tcl -TCL_INC_DIR := $(TCL_LIB_TOP)/include -DEFINES += -DHAVE_TK -DUSE_TCL_STUBS -DUSE_TK_STUBS - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(TCL_INC_DIR) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(TCL_LIB_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = tcl.c \ - tcl_cmd.c \ - tcl_cmds.c \ - tcl_glib.c \ - tcl_ref.c \ - tcl_signals.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -ltclstub84 \ - -ltkstub84 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PLUGINS_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -rf $(OBJECTS) - rm -rf $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/signal-test.tcl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/signal-test.tcl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/signal-test.tcl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/signal-test.tcl 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -purple::signal connect [purple::account handle] account-away { account state message } { - purple::debug -info "tcl signal" "account-away [purple::account username $account] \"$state\" \"$message\"" -} - -purple::signal connect [purple::account handle] account-connecting { account } { - purple::debug -info "tcl signal" "account-connecting [purple::account username $account]" -} - -purple::signal connect [purple::account handle] account-set-info { account info } { - purple::debug -info "tcl signal" "account-set-info [purple::account username $account] $info" -} - -purple::signal connect [purple::account handle] account-setting-info { account info } { - purple::debug -info "tcl signal" "account-set-info [purple::account username $account] $info" -} - -purple::signal connect [purple::buddy handle] buddy-away { buddy } { - purple::debug -info "tcl signal" "buddy-away [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-back { buddy } { - purple::debug -info "tcl signal" "buddy-back [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-idle { buddy } { - purple::debug -info "tcl signal" "buddy-idle [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-unidle { buddy } { - purple::debug -info "tcl signal" "buddy-unidle [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-signed-on { buddy } { - purple::debug -info "tcl signal" "buddy-signed-on [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-signed-off { buddy } { - purple::debug -info "tcl signal" "buddy-signed-off [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::core handle] quitting {} { - purple::debug -info "tcl signal" "quitting" -} - -purple::signal connect [purple::conversation handle] receiving-chat-msg { account who what id flags } { - purple::debug -info "tcl signal" "receiving-chat-msg [purple::account username $account] $id $flags $who \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] receiving-im-msg { account who what id flags } { - purple::debug -info "tcl signal" "receiving-im-msg [purple::account username $account] $id $flags $who \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] received-chat-msg { account who what id flags } { - purple::debug -info "tcl signal" "received-chat-msg [purple::account username $account] $id $flags $who \"$what\"" -} - -purple::signal connect [purple::conversation handle] received-im-msg { account who what id flags } { - purple::debug -info "tcl signal" "received-im-msg [purple::account username $account] $id $flags $who \"$what\"" -} - -purple::signal connect [purple::conversation handle] sending-chat-msg { account what id } { - purple::debug -info "tcl signal" "sending-chat-msg [purple::account username $account] $id \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] sending-im-msg { account who what } { - purple::debug -info "tcl signal" "sending-im-msg [purple::account username $account] $who \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] sent-chat-msg { account id what } { - purple::debug -info "tcl signal" "sent-chat-msg [purple::account username $account] $id \"$what\"" -} - -purple::signal connect [purple::conversation handle] sent-im-msg { account who what } { - purple::debug -info "tcl signal" "sent-im-msg [purple::account username $account] $who \"$what\"" -} - -purple::signal connect [purple::connection handle] signed-on { gc } { - purple::debug -info "tcl signal" "signed-on [purple::account username [purple::connection account $gc]]" -} - -purple::signal connect [purple::connection handle] signed-off { gc } { - purple::debug -info "tcl signal" "signed-off [purple::account username [purple::connection account $gc]]" -} - -purple::signal connect [purple::connection handle] signing-on { gc } { - purple::debug -info "tcl signal" "signing-on [purple::account username [purple::connection account $gc]]" -} - -if { 0 } { -purple::signal connect signing-off { - purple::debug -info "tcl signal" "signing-off [purple::account username [purple::connection account $event::gc]]" -} - -purple::signal connect update-idle { - purple::debug -info "tcl signal" "update-idle" -} -} - -purple::signal connect [purple::plugins handle] plugin-load args { - purple::debug -info "tcl signal" "plugin-load [list $args]" -} - -purple::signal connect [purple::plugins handle] plugin-unload args { - purple::debug -info "tcl signal" "plugin-unload [list $args]" -} - -purple::signal connect [purple::savedstatuses handle] savedstatus-changed args { - purple::debug -info "tcl signal" "savedstatus-changed [list $args]" - purple::debug -info "tcl signal" "purple::savedstatus current = [purple::savedstatus current]" -} - -proc plugin_init { } { - list "Tcl Signal Test" \ - "$purple::version" \ - "Tests Tcl signal handlers" \ - "Debugs a ridiculous amount of signal information." \ - "Ethan Blanton " \ - "http://www.pidgin.im/" -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,555 +0,0 @@ -/** - * @file tcl.c Purple Tcl plugin bindings - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "config.h" - -#include - -#ifdef HAVE_TK -#include -#endif - -#include -#include -#include -#include -#include - -#include "tcl_glib.h" -#include "tcl_purple.h" - -#include "internal.h" -#include "connection.h" -#include "plugin.h" -#include "signals.h" -#include "debug.h" -#include "util.h" -#include "version.h" - -struct tcl_plugin_data { - PurplePlugin *plugin; - Tcl_Interp *interp; -}; - -PurpleStringref *PurpleTclRefAccount; -PurpleStringref *PurpleTclRefConnection; -PurpleStringref *PurpleTclRefConversation; -PurpleStringref *PurpleTclRefPointer; -PurpleStringref *PurpleTclRefPlugin; -PurpleStringref *PurpleTclRefPresence; -PurpleStringref *PurpleTclRefStatus; -PurpleStringref *PurpleTclRefStatusAttr; -PurpleStringref *PurpleTclRefStatusType; -PurpleStringref *PurpleTclRefXfer; -PurpleStringref *PurpleTclRefHandle; - -static GHashTable *tcl_plugins = NULL; - -PurplePlugin *_tcl_plugin; - -static gboolean tcl_loaded = FALSE; - -PurplePlugin *tcl_interp_get_plugin(Tcl_Interp *interp) -{ - struct tcl_plugin_data *data; - - if (tcl_plugins == NULL) - return NULL; - - data = g_hash_table_lookup(tcl_plugins, (gpointer)interp); - return data != NULL ? data->plugin : NULL; -} - -static int tcl_init_interp(Tcl_Interp *interp) -{ - char *rcfile; - char init[] = - "namespace eval ::purple {\n" - " namespace export account buddy connection conversation\n" - " namespace export core debug notify prefs send_im\n" - " namespace export signal unload\n" - " namespace eval _callback { }\n" - "\n" - " proc conv_send { account who text } {\n" - " set gc [purple::account connection $account]\n" - " set convo [purple::conversation new $account $who]\n" - " set myalias [purple::account alias $account]\n" - "\n" - " if {![string length $myalias]} {\n" - " set myalias [purple::account username $account]\n" - " }\n" - "\n" - " purple::send_im $gc $who $text\n" - " purple::conversation write $convo send $myalias $text\n" - " }\n" - "}\n" - "\n" - "proc bgerror { message } {\n" - " global errorInfo\n" - " purple::notify -error \"Tcl Error\" \"Tcl Error: $message\" \"$errorInfo\"\n" - "}\n"; - - if (Tcl_EvalEx(interp, init, -1, TCL_EVAL_GLOBAL) != TCL_OK) { - return 1; - } - - Tcl_SetVar(interp, "argc", "0", TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "argv0", "purple", TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); - rcfile = g_strdup_printf("%s" G_DIR_SEPARATOR_S "tclrc", purple_user_dir()); - Tcl_SetVar(interp, "tcl_rcFileName", rcfile, TCL_GLOBAL_ONLY); - g_free(rcfile); - - Tcl_SetVar(interp, "::purple::version", VERSION, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "::purple::user_dir", purple_user_dir(), TCL_GLOBAL_ONLY); -#ifdef HAVE_TK - Tcl_SetVar(interp, "::purple::tk_available", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar(interp, "::purple::tk_available", "0", TCL_GLOBAL_ONLY); -#endif /* HAVE_TK */ - - Tcl_CreateObjCommand(interp, "::purple::account", tcl_cmd_account, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::buddy", tcl_cmd_buddy, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::cmd", tcl_cmd_cmd, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::connection", tcl_cmd_connection, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::conversation", tcl_cmd_conversation, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::core", tcl_cmd_core, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::debug", tcl_cmd_debug, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::notify", tcl_cmd_notify, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::plugins", tcl_cmd_plugins, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::prefs", tcl_cmd_prefs, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::presence", tcl_cmd_presence, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::send_im", tcl_cmd_send_im, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::savedstatus", tcl_cmd_savedstatus, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::signal", tcl_cmd_signal, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::status", tcl_cmd_status, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::status_attr", tcl_cmd_status_attr, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::status_type", tcl_cmd_status_type, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::unload", tcl_cmd_unload, (ClientData)NULL, NULL); - - return 0; -} - -static Tcl_Interp *tcl_create_interp(void) -{ - Tcl_Interp *interp; - - interp = Tcl_CreateInterp(); - if (Tcl_Init(interp) == TCL_ERROR) { - Tcl_DeleteInterp(interp); - return NULL; - } - - if (tcl_init_interp(interp)) { - Tcl_DeleteInterp(interp); - return NULL; - } - Tcl_StaticPackage(interp, "purple", tcl_init_interp, NULL); - - return interp; -} - -static gboolean tcl_probe_plugin(PurplePlugin *plugin) -{ - PurplePluginInfo *info; - Tcl_Interp *interp; - Tcl_Parse parse; - Tcl_Obj *result, **listitems; - struct stat st; - FILE *fp; - char *buf, *cur; - const char *next; - int len, found = 0, err = 0, nelems; - gboolean status = FALSE; - if ((fp = g_fopen(plugin->path, "r")) == NULL) - return FALSE; - if (fstat(fileno(fp), &st)) { - fclose(fp); - return FALSE; - } - len = st.st_size; - - buf = g_malloc(len + 1); - - cur = buf; - while (fgets(cur, GPOINTER_TO_INT(buf) - (buf - cur), fp)) { - cur += strlen(cur); - if (feof(fp)) - break; - } - - if (ferror(fp)) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error reading %s (%s)\n", plugin->path, g_strerror(errno)); - g_free(buf); - fclose(fp); - return FALSE; - } - - fclose(fp); - - if ((interp = tcl_create_interp()) == NULL) { - return FALSE; - } - - next = buf; - do { - if (Tcl_ParseCommand(interp, next, len, 0, &parse) == TCL_ERROR) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "parse error in %s: %s\n", plugin->path, - Tcl_GetString(Tcl_GetObjResult(interp))); - err = 1; - break; - } - if (parse.tokenPtr[0].type == TCL_TOKEN_SIMPLE_WORD - && !strncmp(parse.tokenPtr[0].start, "proc", parse.tokenPtr[0].size)) { - if (!strncmp(parse.tokenPtr[2].start, "plugin_init", parse.tokenPtr[2].size)) { - if (Tcl_EvalEx(interp, parse.commandStart, parse.commandSize, TCL_EVAL_GLOBAL) != TCL_OK) { - Tcl_FreeParse(&parse); - break; - } - found = 1; - /* We'll continue parsing the file, just in case */ - } - } - len -= (parse.commandStart + parse.commandSize) - next; - next = parse.commandStart + parse.commandSize; - Tcl_FreeParse(&parse); - } while (len); - - if (found && !err) { - if (Tcl_EvalEx(interp, "plugin_init", -1, TCL_EVAL_GLOBAL) == TCL_OK) { - result = Tcl_GetObjResult(interp); - if (Tcl_ListObjGetElements(interp, result, &nelems, &listitems) == TCL_OK) { - if ((nelems == 6) || (nelems == 7)) { - info = g_new0(PurplePluginInfo, 1); - - info->magic = PURPLE_PLUGIN_MAGIC; - info->major_version = PURPLE_MAJOR_VERSION; - info->minor_version = PURPLE_MINOR_VERSION; - info->type = PURPLE_PLUGIN_STANDARD; - info->dependencies = g_list_append(info->dependencies, "core-tcl"); - - info->name = g_strdup(Tcl_GetString(listitems[0])); - info->version = g_strdup(Tcl_GetString(listitems[1])); - info->summary = g_strdup(Tcl_GetString(listitems[2])); - info->description = g_strdup(Tcl_GetString(listitems[3])); - info->author = g_strdup(Tcl_GetString(listitems[4])); - info->homepage = g_strdup(Tcl_GetString(listitems[5])); - - if (nelems == 6) - info->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[0])); - else if (nelems == 7) - info->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[6])); - - plugin->info = info; - - if (purple_plugin_register(plugin)) - status = TRUE; - } - } - } - } - - Tcl_DeleteInterp(interp); - g_free(buf); - return status; -} - -static gboolean tcl_load_plugin(PurplePlugin *plugin) -{ - struct tcl_plugin_data *data; - Tcl_Interp *interp; - Tcl_Obj *result; - - plugin->extra = NULL; - - if ((interp = tcl_create_interp()) == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Could not initialize Tcl interpreter\n"); - return FALSE; - } - - Tcl_SourceRCFile(interp); - - if (Tcl_EvalFile(interp, plugin->path) != TCL_OK) { - result = Tcl_GetObjResult(interp); - purple_debug(PURPLE_DEBUG_ERROR, "tcl", - "Error evaluating %s: %s\n", plugin->path, - Tcl_GetString(result)); - Tcl_DeleteInterp(interp); - return FALSE; - } - - Tcl_Preserve((ClientData)interp); - - data = g_new0(struct tcl_plugin_data, 1); - data->plugin = plugin; - data->interp = interp; - plugin->extra = data; - - g_hash_table_insert(tcl_plugins, (gpointer)interp, (gpointer)data); - - return TRUE; -} - -static gboolean tcl_unload_plugin(PurplePlugin *plugin) -{ - struct tcl_plugin_data *data; - - if (plugin == NULL) - return TRUE; - - data = plugin->extra; - - if (data != NULL) { - g_hash_table_remove(tcl_plugins, (gpointer)(data->interp)); - purple_signals_disconnect_by_handle(data->interp); - tcl_cmd_cleanup(data->interp); - tcl_signal_cleanup(data->interp); - Tcl_Release((ClientData)data->interp); - Tcl_DeleteInterp(data->interp); - g_free(data); - } - - return TRUE; -} - -static void tcl_destroy_plugin(PurplePlugin *plugin) -{ - if (plugin->info != NULL) { - g_free(plugin->info->id); - g_free(plugin->info->name); - g_free(plugin->info->version); - g_free(plugin->info->description); - g_free(plugin->info->author); - g_free(plugin->info->homepage); - } - - return; -} - -static gboolean tcl_load(PurplePlugin *plugin) -{ - if(!tcl_loaded) - return FALSE; - tcl_glib_init(); - tcl_cmd_init(); - tcl_signal_init(); - purple_tcl_ref_init(); - - PurpleTclRefAccount = purple_stringref_new("Account"); - PurpleTclRefConnection = purple_stringref_new("Connection"); - PurpleTclRefConversation = purple_stringref_new("Conversation"); - PurpleTclRefPointer = purple_stringref_new("Pointer"); - PurpleTclRefPlugin = purple_stringref_new("Plugin"); - PurpleTclRefPresence = purple_stringref_new("Presence"); - PurpleTclRefStatus = purple_stringref_new("Status"); - PurpleTclRefStatusAttr = purple_stringref_new("StatusAttr"); - PurpleTclRefStatusType = purple_stringref_new("StatusType"); - PurpleTclRefXfer = purple_stringref_new("Xfer"); - PurpleTclRefHandle = purple_stringref_new("Handle"); - - tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); - -#ifdef HAVE_TK - Tcl_StaticPackage(NULL, "Tk", Tk_Init, Tk_SafeInit); -#endif /* HAVE_TK */ - - return TRUE; -} - -static gboolean tcl_unload(PurplePlugin *plugin) -{ - g_hash_table_destroy(tcl_plugins); - tcl_plugins = NULL; - - purple_stringref_unref(PurpleTclRefAccount); - purple_stringref_unref(PurpleTclRefConnection); - purple_stringref_unref(PurpleTclRefConversation); - purple_stringref_unref(PurpleTclRefPointer); - purple_stringref_unref(PurpleTclRefPlugin); - purple_stringref_unref(PurpleTclRefPresence); - purple_stringref_unref(PurpleTclRefStatus); - purple_stringref_unref(PurpleTclRefStatusAttr); - purple_stringref_unref(PurpleTclRefStatusType); - purple_stringref_unref(PurpleTclRefXfer); - - return TRUE; -} - -static PurplePluginLoaderInfo tcl_loader_info = -{ - NULL, - tcl_probe_plugin, - tcl_load_plugin, - tcl_unload_plugin, - tcl_destroy_plugin, - - /* pidgin */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo tcl_info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_LOADER, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - "core-tcl", - N_("Tcl Plugin Loader"), - DISPLAY_VERSION, - N_("Provides support for loading Tcl plugins"), - N_("Provides support for loading Tcl plugins"), - "Ethan Blanton ", - PURPLE_WEBSITE, - tcl_load, - tcl_unload, - NULL, - NULL, - &tcl_loader_info, - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -#ifdef _WIN32 -typedef Tcl_Interp* (CALLBACK* LPFNTCLCREATEINTERP)(void); -typedef void (CALLBACK* LPFNTKINIT)(Tcl_Interp*); - -LPFNTCLCREATEINTERP wtcl_CreateInterp = NULL; -LPFNTKINIT wtk_Init = NULL; -#undef Tcl_CreateInterp -#define Tcl_CreateInterp wtcl_CreateInterp -#undef Tk_Init -#define Tk_Init wtk_Init - -static gboolean tcl_win32_init() { - const char regkey[] = "SOFTWARE\\ActiveState\\ActiveTcl\\"; - char *version = NULL; - gboolean retval = FALSE; - - if ((version = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, regkey, "CurrentVersion")) - || (version = wpurple_read_reg_string(HKEY_CURRENT_USER, regkey, "CurrentVersion"))) { - char *path = NULL; - char *regkey2; - char **tokens; - int major = 0, minor = 0, micro = 0; - - tokens = g_strsplit(version, ".", 0); - if (tokens[0] && tokens[1] && tokens[2]) { - major = atoi(tokens[0]); - minor = atoi(tokens[1]); - micro = atoi(tokens[2]); - } - g_strfreev(tokens); - - regkey2 = g_strdup_printf("%s%s\\", regkey, version); - if (!(major == 8 && minor == 4 && micro >= 5)) - purple_debug(PURPLE_DEBUG_INFO, "tcl", "Unsupported ActiveTCL version %s found.\n", version); - else if ((path = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, regkey2, NULL)) || (path = wpurple_read_reg_string(HKEY_CURRENT_USER, regkey2, NULL))) { - char *tclpath; - char *tkpath; - - purple_debug(PURPLE_DEBUG_INFO, "tcl", "Loading ActiveTCL version %s from \"%s\"\n", version, path); - - tclpath = g_build_filename(path, "bin", "tcl84.dll", NULL); - tkpath = g_build_filename(path, "bin", "tk84.dll", NULL); - - if(!(wtcl_CreateInterp = (LPFNTCLCREATEINTERP) wpurple_find_and_loadproc(tclpath, "Tcl_CreateInterp"))) { - purple_debug(PURPLE_DEBUG_INFO, "tcl", "tcl_win32_init error loading Tcl_CreateInterp\n"); - } else { - if(!(wtk_Init = (LPFNTKINIT) wpurple_find_and_loadproc(tkpath, "Tk_Init"))) { - HMODULE mod; - purple_debug(PURPLE_DEBUG_INFO, "tcl", "tcl_win32_init error loading Tk_Init\n"); - if((mod = GetModuleHandle("tcl84.dll"))) - FreeLibrary(mod); - } else { - retval = TRUE; - } - } - g_free(tclpath); - g_free(tkpath); - } - g_free(path); - g_free(regkey2); - } - - g_free(version); - - if (!retval) - purple_debug(PURPLE_DEBUG_INFO, "tcl", _("Unable to detect ActiveTCL installation. If you wish to use TCL plugins, install ActiveTCL from http://www.activestate.com\n")); - - return retval; -} - -#endif /* _WIN32 */ - -static void tcl_init_plugin(PurplePlugin *plugin) -{ -#ifdef USE_TCL_STUBS - Tcl_Interp *interp = NULL; -#endif - _tcl_plugin = plugin; - -#ifdef USE_TCL_STUBS -#ifdef _WIN32 - if(!tcl_win32_init()) - return; -#endif - if(!(interp = Tcl_CreateInterp())) - return; - - if(!Tcl_InitStubs(interp, TCL_VERSION, 0)) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Tcl_InitStubs: %s\n", interp->result); - return; - } -#endif - - Tcl_FindExecutable("purple"); - -#if defined(USE_TK_STUBS) && defined(HAVE_TK) - Tk_Init(interp); - - if(!Tk_InitStubs(interp, TK_VERSION, 0)) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error Tk_InitStubs: %s\n", interp->result); - Tcl_DeleteInterp(interp); - return; - } -#endif - tcl_loaded = TRUE; -#ifdef USE_TCL_STUBS - Tcl_DeleteInterp(interp); -#endif - tcl_loader_info.exts = g_list_append(tcl_loader_info.exts, "tcl"); -} - -PURPLE_INIT_PLUGIN(tcl, tcl_init_plugin, tcl_info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmd.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmd.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmd.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmd.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/** - * @file tcl_cmd.c Purple Tcl cmd API - * - * purple - * - * Copyright (C) 2006 Etan Reisner - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include - -#include "tcl_purple.h" - -#include "internal.h" -#include "cmds.h" -#include "debug.h" - -static GList *tcl_cmd_callbacks; - -static PurpleCmdRet tcl_cmd_callback(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **errors, - struct tcl_cmd_handler *handler); -static Tcl_Obj *new_cmd_cb_namespace(void); - -void tcl_cmd_init() -{ - tcl_cmd_callbacks = NULL; -} - -void tcl_cmd_handler_free(struct tcl_cmd_handler *handler) -{ - if (handler == NULL) - return; - - Tcl_DecrRefCount(handler->namespace); - g_free(handler); -} - -void tcl_cmd_cleanup(Tcl_Interp *interp) -{ - GList *cur; - struct tcl_cmd_handler *handler; - - for (cur = tcl_cmd_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp) { - purple_cmd_unregister(handler->id); - tcl_cmd_handler_free(handler); - cur->data = NULL; - } - } - tcl_cmd_callbacks = g_list_remove_all(tcl_cmd_callbacks, NULL); -} - -PurpleCmdId tcl_cmd_register(struct tcl_cmd_handler *handler) -{ - int id; - GString *proc; - - if ((id = purple_cmd_register(Tcl_GetString(handler->cmd), - handler->args, handler->priority, - handler->flags, handler->prpl_id, - PURPLE_CMD_FUNC(tcl_cmd_callback), - handler->helpstr, (void *)handler)) == 0) - return 0; - - handler->namespace = new_cmd_cb_namespace (); - Tcl_IncrRefCount(handler->namespace); - proc = g_string_new(""); - g_string_append_printf(proc, "namespace eval %s { proc cb { conv cmd arglist } { %s } }", - Tcl_GetString(handler->namespace), - Tcl_GetString(handler->proc)); - if (Tcl_Eval(handler->interp, proc->str) != TCL_OK) { - Tcl_DecrRefCount(handler->namespace); - g_string_free(proc, TRUE); - return 0; - } - g_string_free(proc, TRUE); - - tcl_cmd_callbacks = g_list_append(tcl_cmd_callbacks, (gpointer)handler); - - return id; -} - -void tcl_cmd_unregister(PurpleCmdId id, Tcl_Interp *interp) -{ - GList *cur; - GString *cmd; - gboolean found = FALSE; - struct tcl_cmd_handler *handler; - - for (cur = tcl_cmd_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp && handler->id == id) { - purple_cmd_unregister(id); - cmd = g_string_sized_new(64); - g_string_printf(cmd, "namespace delete %s", - Tcl_GetString(handler->namespace)); - Tcl_EvalEx(interp, cmd->str, -1, TCL_EVAL_GLOBAL); - tcl_cmd_handler_free(handler); - g_string_free(cmd, TRUE); - cur->data = NULL; - found = TRUE; - break; - } - } - - if (found) - tcl_cmd_callbacks = g_list_remove_all(tcl_cmd_callbacks, NULL); -} - -static PurpleCmdRet tcl_cmd_callback(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **errors, - struct tcl_cmd_handler *handler) -{ - int retval, error, i; - Tcl_Obj *command, *arg, *tclargs, *result; - - command = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(command); - - /* The callback */ - arg = Tcl_DuplicateObj(handler->namespace); - Tcl_AppendStringsToObj(arg, "::cb", NULL); - Tcl_ListObjAppendElement(handler->interp, command, arg); - - /* The conversation */ - arg = purple_tcl_ref_new(PurpleTclRefConversation, conv); - Tcl_ListObjAppendElement(handler->interp, command, arg); - - /* The command */ - arg = Tcl_NewStringObj(cmd, -1); - Tcl_ListObjAppendElement(handler->interp, command, arg); - - /* The args list */ - tclargs = Tcl_NewListObj(0, NULL); - for (i = 0; i < handler->nargs; i++) { - arg = Tcl_NewStringObj(args[i], -1); - - Tcl_ListObjAppendElement(handler->interp, tclargs, arg); - } - Tcl_ListObjAppendElement(handler->interp, command, tclargs); - - if ((error = Tcl_EvalObjEx(handler->interp, command, - TCL_EVAL_GLOBAL)) != TCL_OK) { - gchar *errorstr; - - errorstr = g_strdup_printf("error evaluating callback: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "%s", errorstr); - *errors = errorstr; - retval = PURPLE_CMD_RET_FAILED; - } else { - result = Tcl_GetObjResult(handler->interp); - if ((error = Tcl_GetIntFromObj(handler->interp, result, - &retval)) != TCL_OK) { - gchar *errorstr; - - errorstr = g_strdup_printf("Error retreiving procedure result: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "%s", errorstr); - *errors = errorstr; - retval = PURPLE_CMD_RET_FAILED; - } - } - - return retval; -} - -static Tcl_Obj *new_cmd_cb_namespace() -{ - char name[32]; - static int cbnum; - - g_snprintf(name, sizeof(name), "::purple::_cmd_callback::cb_%d", - cbnum++); - return Tcl_NewStringObj(name, -1); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_cmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1817 +0,0 @@ -/** - * @file tcl_cmds.c Commands for the Purple Tcl plugin bindings - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include - -#include "internal.h" -#include "conversation.h" -#include "connection.h" -#include "eventloop.h" -#include "account.h" -#include "server.h" -#include "notify.h" -#include "blist.h" -#include "savedstatuses.h" -#include "debug.h" -#include "prefs.h" -#include "core.h" - -#include "tcl_purple.h" - -static PurpleAccount *tcl_validate_account(Tcl_Obj *obj, Tcl_Interp *interp); -static PurpleConversation *tcl_validate_conversation(Tcl_Obj *obj, Tcl_Interp *interp); -static PurpleConnection *tcl_validate_gc(Tcl_Obj *obj, Tcl_Interp *interp); - -static PurpleAccount *tcl_validate_account(Tcl_Obj *obj, Tcl_Interp *interp) -{ - PurpleAccount *account; - GList *cur; - - account = purple_tcl_ref_get(interp, obj, PurpleTclRefAccount); - - if (account == NULL) - return NULL; - - for (cur = purple_accounts_get_all(); cur != NULL; cur = g_list_next(cur)) { - if (account == cur->data) - return account; - } - if (interp != NULL) - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid account", -1)); - return NULL; -} - -static PurpleConversation *tcl_validate_conversation(Tcl_Obj *obj, Tcl_Interp *interp) -{ - PurpleConversation *convo; - GList *cur; - - convo = purple_tcl_ref_get(interp, obj, PurpleTclRefConversation); - - if (convo == NULL) - return NULL; - - for (cur = purple_get_conversations(); cur != NULL; cur = g_list_next(cur)) { - if (convo == cur->data) - return convo; - } - if (interp != NULL) - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid conversation", -1)); - return NULL; -} - -static PurpleConnection *tcl_validate_gc(Tcl_Obj *obj, Tcl_Interp *interp) -{ - PurpleConnection *gc; - GList *cur; - - gc = purple_tcl_ref_get(interp, obj, PurpleTclRefConnection); - - if (gc == NULL) - return NULL; - - for (cur = purple_connections_get_all(); cur != NULL; cur = g_list_next(cur)) { - if (gc == cur->data) - return gc; - } - return NULL; -} - -int tcl_cmd_account(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *result, *list, *elem; - const char *cmds[] = { "alias", "connect", "connection", "disconnect", - "enabled", "find", "handle", "isconnected", - "list", "presence", "protocol", "status", - "status_type", "status_types", "username", - NULL }; - enum { CMD_ACCOUNT_ALIAS, - CMD_ACCOUNT_CONNECT, CMD_ACCOUNT_CONNECTION, - CMD_ACCOUNT_DISCONNECT, CMD_ACCOUNT_ENABLED, CMD_ACCOUNT_FIND, - CMD_ACCOUNT_HANDLE, CMD_ACCOUNT_ISCONNECTED, CMD_ACCOUNT_LIST, - CMD_ACCOUNT_PRESENCE, CMD_ACCOUNT_PROTOCOL, CMD_ACCOUNT_STATUS, - CMD_ACCOUNT_STATUS_TYPE, CMD_ACCOUNT_STATUS_TYPES, - CMD_ACCOUNT_USERNAME } cmd; - const char *listopts[] = { "-all", "-online", NULL }; - enum { CMD_ACCOUNTLIST_ALL, CMD_ACCOUNTLIST_ONLINE } listopt; - const char *alias; - GList *cur; - PurpleAccount *account; - PurpleStatus *status; - PurpleStatusType *status_type; - PurpleValue *value; - char *attr_id; - int error; - int b, i; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_ACCOUNT_ALIAS: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - alias = purple_account_get_alias(account); - Tcl_SetObjResult(interp, Tcl_NewStringObj(alias ? (char *)alias : "", -1)); - break; - case CMD_ACCOUNT_CONNECT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (!purple_account_is_connected(account)) - purple_account_connect(account); - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefConnection, - purple_account_get_connection(account))); - break; - case CMD_ACCOUNT_CONNECTION: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefConnection, - purple_account_get_connection(account))); - break; - case CMD_ACCOUNT_DISCONNECT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - purple_account_disconnect(account); - break; - case CMD_ACCOUNT_ENABLED: - if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "account ?enabled?"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_account_get_enabled(account, - purple_core_get_ui()))); - } else { - if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &b)) != TCL_OK) - return TCL_ERROR; - purple_account_set_enabled(account, purple_core_get_ui(), b); - } - break; - case CMD_ACCOUNT_FIND: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "username protocol"); - return TCL_ERROR; - } - account = purple_accounts_find(Tcl_GetString(objv[2]), - Tcl_GetString(objv[3])); - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefAccount, account)); - break; - case CMD_ACCOUNT_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_accounts_get_handle())); - break; - case CMD_ACCOUNT_ISCONNECTED: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_account_is_connected(account))); - break; - case CMD_ACCOUNT_LIST: - listopt = CMD_ACCOUNTLIST_ALL; - if (objc > 3) { - Tcl_WrongNumArgs(interp, 2, objv, "?option?"); - return TCL_ERROR; - } - if (objc == 3) { - if ((error = Tcl_GetIndexFromObj(interp, objv[2], listopts, "option", 0, (int *)&listopt)) != TCL_OK) - return error; - } - list = Tcl_NewListObj(0, NULL); - for (cur = purple_accounts_get_all(); cur != NULL; cur = g_list_next(cur)) { - account = cur->data; - if (listopt == CMD_ACCOUNTLIST_ONLINE && !purple_account_is_connected(account)) - continue; - elem = purple_tcl_ref_new(PurpleTclRefAccount, account); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_ACCOUNT_PRESENCE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefPresence, - purple_account_get_presence(account))); - break; - case CMD_ACCOUNT_PROTOCOL: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_NewStringObj((char *)purple_account_get_protocol_id(account), -1)); - break; - case CMD_ACCOUNT_STATUS: - if (objc < 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account ?status_id name value ...?"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatus, - purple_account_get_active_status(account))); - } else { - GList *l = NULL; - if (objc % 2) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("name without value setting status", -1)); - return TCL_ERROR; - } - status = purple_account_get_status(account, Tcl_GetString(objv[3])); - if (status == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid status for account", -1)); - return TCL_ERROR; - } - for (i = 4; i < objc; i += 2) { - attr_id = Tcl_GetString(objv[i]); - value = purple_status_get_attr_value(status, attr_id); - if (value == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid attribute for account", -1)); - return TCL_ERROR; - } - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: - error = Tcl_GetBooleanFromObj(interp, objv[i + 1], &b); - if (error != TCL_OK) - return error; - l = g_list_append(l, attr_id); - l = g_list_append(l, GINT_TO_POINTER(b)); - break; - case PURPLE_TYPE_INT: - error = Tcl_GetIntFromObj(interp, objv[i + 1], &b); - if (error != TCL_OK) - return error; - l = g_list_append(l, attr_id); - l = g_list_append(l, GINT_TO_POINTER(b)); - break; - case PURPLE_TYPE_STRING: - l = g_list_append(l, attr_id); - l = g_list_append(l, Tcl_GetString(objv[i + 1])); - break; - default: - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown PurpleValue type", -1)); - return TCL_ERROR; - } - } - purple_account_set_status_list(account, Tcl_GetString(objv[3]), TRUE, l); - g_list_free(l); - } - break; - case CMD_ACCOUNT_STATUS_TYPE: - if (objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "account ?statustype? ?-primitive primitive?"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (objc == 4) { - status_type = purple_account_get_status_type(account, - Tcl_GetString(objv[3])); - } else { - PurpleStatusPrimitive primitive; - if (strcmp(Tcl_GetString(objv[3]), "-primitive")) { - result = Tcl_NewStringObj("bad option \"", -1); - Tcl_AppendObjToObj(result, objv[3]); - Tcl_AppendToObj(result, "\": should be -primitive", -1); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - primitive = purple_primitive_get_type_from_id(Tcl_GetString(objv[4])); - status_type = purple_account_get_status_type_with_primitive(account, - primitive); - } - if (status_type == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("status type not found", -1)); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatusType, - status_type)); - break; - case CMD_ACCOUNT_STATUS_TYPES: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - list = Tcl_NewListObj(0, NULL); - for (cur = purple_account_get_status_types(account); cur != NULL; - cur = g_list_next(cur)) { - Tcl_ListObjAppendElement(interp, list, - purple_tcl_ref_new(PurpleTclRefStatusType, - cur->data)); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_ACCOUNT_USERNAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_account_get_username(account), -1)); - break; - } - - return TCL_OK; -} - -static PurpleBlistNode *tcl_list_to_buddy(Tcl_Interp *interp, int count, Tcl_Obj **elems) -{ - PurpleBlistNode *node = NULL; - PurpleAccount *account; - char *name; - char *type; - - if (count < 3) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list too short", -1)); - return NULL; - } - - type = Tcl_GetString(elems[0]); - name = Tcl_GetString(elems[1]); - if ((account = tcl_validate_account(elems[2], interp)) == NULL) - return NULL; - - if (!strcmp(type, "buddy")) { - node = PURPLE_BLIST_NODE(purple_find_buddy(account, name)); - } else if (!strcmp(type, "group")) { - node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, name)); - } - - return node; -} - -int tcl_cmd_buddy(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *tclgroup, *tclgrouplist, *tclcontact, *tclcontactlist, *tclbud, **elems, *result; - const char *cmds[] = { "alias", "handle", "info", "list", NULL }; - enum { CMD_BUDDY_ALIAS, CMD_BUDDY_HANDLE, CMD_BUDDY_INFO, CMD_BUDDY_LIST } cmd; - PurpleBlistNodeType type; - PurpleBlistNode *node, *gnode, *bnode; - PurpleAccount *account; - PurpleBuddy *bud; - PurpleChat *cnode; - int error, all = 0, count; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_BUDDY_ALIAS: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "buddy"); - return TCL_ERROR; - } - if ((error = Tcl_ListObjGetElements(interp, objv[2], &count, &elems)) != TCL_OK) - return error; - if ((node = tcl_list_to_buddy(interp, count, elems)) == NULL) - return TCL_ERROR; - type = purple_blist_node_get_type(node); - if (type == PURPLE_BLIST_CHAT_NODE) - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); - else if (type == PURPLE_BLIST_BUDDY_NODE) - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1)); - return TCL_OK; - break; - case CMD_BUDDY_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_blist_get_handle())); - break; - case CMD_BUDDY_INFO: - if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "( buddy | account username )"); - return TCL_ERROR; - } - if (objc == 3) { - if ((error = Tcl_ListObjGetElements(interp, objv[2], &count, &elems)) != TCL_OK) - return error; - if (count < 3) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("buddy too short", -1)); - return TCL_ERROR; - } - if (strcmp("buddy", Tcl_GetString(elems[0]))) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid buddy", -1)); - return TCL_ERROR; - } - if ((account = tcl_validate_account(elems[2], interp)) == NULL) - return TCL_ERROR; - serv_get_info(purple_account_get_connection(account), Tcl_GetString(elems[1])); - } else { - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - serv_get_info(purple_account_get_connection(account), Tcl_GetString(objv[3])); - } - break; - case CMD_BUDDY_LIST: - if (objc == 3) { - if (!strcmp("-all", Tcl_GetString(objv[2]))) { - all = 1; - } else { - result = Tcl_NewStringObj("",-1); - Tcl_AppendStringsToObj(result, "unknown option: ", Tcl_GetString(objv[2]), NULL); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - } - list = Tcl_NewListObj(0, NULL); - for (gnode = purple_blist_get_root(); gnode != NULL; gnode = purple_blist_node_get_sibling_next(gnode)) { - tclgroup = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, tclgroup, Tcl_NewStringObj("group", -1)); - Tcl_ListObjAppendElement(interp, tclgroup, - Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)gnode), -1)); - tclgrouplist = Tcl_NewListObj(0, NULL); - for (node = purple_blist_node_get_first_child(gnode); node != NULL; node = purple_blist_node_get_sibling_next(node)) { - PurpleAccount *account; - - type = purple_blist_node_get_type(node); - switch (type) { - case PURPLE_BLIST_CONTACT_NODE: - tclcontact = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(tclcontact); - Tcl_ListObjAppendElement(interp, tclcontact, Tcl_NewStringObj("contact", -1)); - tclcontactlist = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(tclcontactlist); - count = 0; - for (bnode = purple_blist_node_get_first_child(node); bnode != NULL; bnode = purple_blist_node_get_sibling_next(bnode)) { - if (purple_blist_node_get_type(bnode) != PURPLE_BLIST_BUDDY_NODE) - continue; - bud = (PurpleBuddy *)bnode; - account = purple_buddy_get_account(bud); - if (!all && !purple_account_is_connected(account)) - continue; - count++; - tclbud = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("buddy", -1)); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_buddy_get_name(bud), -1)); - Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); - Tcl_ListObjAppendElement(interp, tclcontactlist, tclbud); - } - if (count) { - Tcl_ListObjAppendElement(interp, tclcontact, tclcontactlist); - Tcl_ListObjAppendElement(interp, tclgrouplist, tclcontact); - } - Tcl_DecrRefCount(tclcontact); - Tcl_DecrRefCount(tclcontactlist); - break; - case PURPLE_BLIST_CHAT_NODE: - cnode = (PurpleChat *)node; - account = purple_chat_get_account(cnode); - if (!all && !purple_account_is_connected(account)) - continue; - tclbud = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("chat", -1)); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_chat_get_name(cnode), -1)); - Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); - Tcl_ListObjAppendElement(interp, tclgrouplist, tclbud); - break; - default: - purple_debug(PURPLE_DEBUG_WARNING, "tcl", "Unexpected buddy type %d", type); - continue; - } - } - Tcl_ListObjAppendElement(interp, tclgroup, tclgrouplist); - Tcl_ListObjAppendElement(interp, list, tclgroup); - } - Tcl_SetObjResult(interp, list); - break; - } - - return TCL_OK; -} - -int tcl_cmd_cmd(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "do", "help", "list", "register", "unregister", NULL }; - enum { CMD_CMD_DO, CMD_CMD_HELP, CMD_CMD_LIST, CMD_CMD_REGISTER, CMD_CMD_UNREGISTER } cmd; - struct tcl_cmd_handler *handler; - Tcl_Obj *list, *elem; - PurpleConversation *convo; - PurpleCmdId id; - PurpleCmdStatus status; - int error; - GList *l, *cur; - gchar *escaped, *errstr = NULL; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CMD_DO: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation command"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - escaped = g_markup_escape_text(Tcl_GetString(objv[3]), -1); - status = purple_cmd_do_command(convo, Tcl_GetString(objv[3]), - escaped, &errstr); - g_free(escaped); - Tcl_SetObjResult(interp, - Tcl_NewStringObj(errstr ? (char *)errstr : "", -1)); - g_free(errstr); - if (status != PURPLE_CMD_STATUS_OK) { - return TCL_ERROR; - } - break; - case CMD_CMD_HELP: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation name"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - l = cur = purple_cmd_help(convo, Tcl_GetString(objv[3])); - list = Tcl_NewListObj(0, NULL); - while (cur != NULL) { - elem = Tcl_NewStringObj((char *)cur->data, -1); - Tcl_ListObjAppendElement(interp, list, elem); - cur = g_list_next(cur); - } - g_list_free(l); - Tcl_SetObjResult(interp, list); - break; - case CMD_CMD_LIST: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - l = cur = purple_cmd_list(convo); - list = Tcl_NewListObj(0, NULL); - while (cur != NULL) { - elem = Tcl_NewStringObj((char *)cur->data, -1); - Tcl_ListObjAppendElement(interp, list, elem); - cur = g_list_next(cur); - } - g_list_free(l); - Tcl_SetObjResult(interp, list); - break; - case CMD_CMD_REGISTER: - if (objc != 9) { - Tcl_WrongNumArgs(interp, 2, objv, "cmd arglist priority flags prpl_id proc helpstr"); - return TCL_ERROR; - } - handler = g_new0(struct tcl_cmd_handler, 1); - handler->cmd = objv[2]; - handler->args = Tcl_GetString(objv[3]); - handler->nargs = strlen(handler->args); - if ((error = Tcl_GetIntFromObj(interp, objv[4], - &handler->priority)) != TCL_OK) { - g_free(handler); - return error; - } - if ((error = Tcl_GetIntFromObj(interp, objv[5], - &handler->flags)) != TCL_OK) { - g_free(handler); - return error; - } - handler->prpl_id = Tcl_GetString(objv[6]); - handler->proc = objv[7]; - handler->helpstr = Tcl_GetString(objv[8]); - handler->interp = interp; - if ((id = tcl_cmd_register(handler)) == 0) { - tcl_cmd_handler_free(handler); - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); - } else { - handler->id = id; - Tcl_SetObjResult(interp, Tcl_NewIntObj(id)); - } - break; - case CMD_CMD_UNREGISTER: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "id"); - return TCL_ERROR; - } - if ((error = Tcl_GetIntFromObj(interp, objv[2], - (int *)&id)) != TCL_OK) - return error; - tcl_cmd_unregister(id, interp); - break; - } - - return TCL_OK; -} - -int tcl_cmd_connection(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *elem; - const char *cmds[] = { "account", "displayname", "handle", "list", "state", NULL }; - enum { CMD_CONN_ACCOUNT, CMD_CONN_DISPLAYNAME, CMD_CONN_HANDLE, - CMD_CONN_LIST, CMD_CONN_STATE } cmd; - int error; - GList *cur; - PurpleConnection *gc; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CONN_ACCOUNT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "gc"); - return TCL_ERROR; - } - if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefAccount, - purple_connection_get_account(gc))); - break; - case CMD_CONN_DISPLAYNAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "gc"); - return TCL_ERROR; - } - if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_connection_get_display_name(gc), -1)); - break; - case CMD_CONN_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefHandle, - purple_connections_get_handle())); - break; - case CMD_CONN_LIST: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - list = Tcl_NewListObj(0, NULL); - for (cur = purple_connections_get_all(); cur != NULL; cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefConnection, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_CONN_STATE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "gc"); - return TCL_ERROR; - } - if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) - return TCL_ERROR; - switch (purple_connection_get_state(gc)) { - case PURPLE_DISCONNECTED: - Tcl_SetObjResult(interp, Tcl_NewStringObj("disconnected", -1)); - break; - case PURPLE_CONNECTED: - Tcl_SetObjResult(interp, Tcl_NewStringObj("connected", -1)); - break; - case PURPLE_CONNECTING: - Tcl_SetObjResult(interp, Tcl_NewStringObj("connecting", -1)); - break; - } - break; - } - - return TCL_OK; -} - -int tcl_cmd_conversation(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *elem; - const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", "send", NULL }; - enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE, CMD_CONV_SEND } cmd; - const char *styles[] = { "send", "recv", "system", NULL }; - enum { CMD_CONV_WRITE_SEND, CMD_CONV_WRITE_RECV, CMD_CONV_WRITE_SYSTEM } style; - const char *newopts[] = { "-chat", "-im" }; - enum { CMD_CONV_NEW_CHAT, CMD_CONV_NEW_IM } newopt; - PurpleConversation *convo; - PurpleAccount *account; - PurpleConversationType type; - GList *cur; - char *opt, *from, *what; - int error, argsused, flags = 0; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CONV_FIND: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "account name"); - return TCL_ERROR; - } - account = NULL; - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - Tcl_GetString(objv[3]), - account); - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, convo)); - break; - case CMD_CONV_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_conversations_get_handle())); - break; - case CMD_CONV_LIST: - list = Tcl_NewListObj(0, NULL); - for (cur = purple_get_conversations(); cur != NULL; cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefConversation, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_CONV_NEW: - if (objc < 4) { - Tcl_WrongNumArgs(interp, 2, objv, "?options? account name"); - return TCL_ERROR; - } - argsused = 2; - type = PURPLE_CONV_TYPE_IM; - while (argsused < objc) { - opt = Tcl_GetString(objv[argsused]); - if (*opt == '-') { - if ((error = Tcl_GetIndexFromObj(interp, objv[argsused], newopts, - "option", 0, (int *)&newopt)) != TCL_OK) - return error; - argsused++; - switch (newopt) { - case CMD_CONV_NEW_CHAT: - type = PURPLE_CONV_TYPE_CHAT; - break; - case CMD_CONV_NEW_IM: - type = PURPLE_CONV_TYPE_IM; - break; - } - } else { - break; - } - } - if (objc - argsused != 2) { - Tcl_WrongNumArgs(interp, 2, objv, "?options? account name"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[argsused++], interp)) == NULL) - return TCL_ERROR; - convo = purple_conversation_new(type, account, Tcl_GetString(objv[argsused])); - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, convo)); - break; - case CMD_CONV_WRITE: - if (objc != 6) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation style from what"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - if ((error = Tcl_GetIndexFromObj(interp, objv[3], styles, "style", 0, (int *)&style)) != TCL_OK) - return error; - from = Tcl_GetString(objv[4]); - what = Tcl_GetString(objv[5]); - - switch (style) { - case CMD_CONV_WRITE_SEND: - flags = PURPLE_MESSAGE_SEND; - break; - case CMD_CONV_WRITE_RECV: - flags = PURPLE_MESSAGE_RECV; - break; - case CMD_CONV_WRITE_SYSTEM: - flags = PURPLE_MESSAGE_SYSTEM; - break; - } - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, what, flags, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), from, what, flags, time(NULL)); - break; - case CMD_CONV_NAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation"); - return TCL_ERROR; - } - - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_conversation_get_name(convo), -1)); - break; - case CMD_CONV_TITLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation"); - return TCL_ERROR; - } - - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_conversation_get_title(convo), -1)); - break; - case CMD_CONV_SEND: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation message"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - what = Tcl_GetString(objv[3]); - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_send(PURPLE_CONV_CHAT(convo), what); - else - purple_conv_im_send(PURPLE_CONV_IM(convo), what); - break; - } - - return TCL_OK; -} - -int tcl_cmd_core(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "handle", "quit", NULL }; - enum { CMD_CORE_HANDLE, CMD_CORE_QUIT } cmd; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CORE_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_get_core())); - break; - case CMD_CORE_QUIT: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - purple_core_quit(); - break; - } - - return TCL_OK; -} - -int tcl_cmd_debug(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - char *category, *message; - int lev; - const char *levels[] = { "-misc", "-info", "-warning", "-error", NULL }; - PurpleDebugLevel levelind[] = { PURPLE_DEBUG_MISC, PURPLE_DEBUG_INFO, PURPLE_DEBUG_WARNING, PURPLE_DEBUG_ERROR }; - int error; - - if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "level category message"); - return TCL_ERROR; - } - - error = Tcl_GetIndexFromObj(interp, objv[1], levels, "debug level", 0, &lev); - if (error != TCL_OK) - return error; - - category = Tcl_GetString(objv[2]); - message = Tcl_GetString(objv[3]); - - purple_debug(levelind[lev], category, "%s\n", message); - - return TCL_OK; -} - -int tcl_cmd_notify(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - int error, type; - const char *opts[] = { "-error", "-warning", "-info", NULL }; - PurpleNotifyMsgType optind[] = { PURPLE_NOTIFY_MSG_ERROR, PURPLE_NOTIFY_MSG_WARNING, PURPLE_NOTIFY_MSG_INFO }; - char *title, *msg1, *msg2; - - if (objc < 4 || objc > 5) { - Tcl_WrongNumArgs(interp, 1, objv, "?type? title primary secondary"); - return TCL_ERROR; - } - - if (objc == 4) { - type = 1; /* Default to warning */ - title = Tcl_GetString(objv[1]); - msg1 = Tcl_GetString(objv[2]); - msg2 = Tcl_GetString(objv[3]); - } else { - error = Tcl_GetIndexFromObj(interp, objv[1], opts, "message type", 0, &type); - if (error != TCL_OK) - return error; - title = Tcl_GetString(objv[2]); - msg1 = Tcl_GetString(objv[3]); - msg2 = Tcl_GetString(objv[4]); - } - - purple_notify_message(_tcl_plugin, optind[type], title, msg1, msg2, NULL, NULL); - - return TCL_OK; -} - -int tcl_cmd_plugins(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "handle", NULL }; - enum { CMD_PLUGINS_HANDLE } cmd; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_PLUGINS_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_plugins_get_handle())); - break; - } - - return TCL_OK; -} - -int tcl_cmd_prefs(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *elem, **elems; - const char *cmds[] = { "get", "set", "type", NULL }; - enum { CMD_PREFS_GET, CMD_PREFS_SET, CMD_PREFS_TYPE } cmd; - /* char *types[] = { "none", "boolean", "int", "string", "stringlist", NULL }; */ - /* enum { TCL_PREFS_NONE, TCL_PREFS_BOOL, TCL_PREFS_INT, TCL_PREFS_STRING, TCL_PREFS_STRINGLIST } type; */ - PurplePrefType preftype; - GList *cur; - int error, intval, nelem, i; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_PREFS_GET: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "path"); - return TCL_ERROR; - } - preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); - switch (preftype) { - case PURPLE_PREF_NONE: - Tcl_SetObjResult(interp, - Tcl_NewStringObj("pref type none", -1)); - return TCL_ERROR; - break; - case PURPLE_PREF_BOOLEAN: - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_prefs_get_bool(Tcl_GetString(objv[2])))); - break; - case PURPLE_PREF_INT: - Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_prefs_get_int(Tcl_GetString(objv[2])))); - break; - case PURPLE_PREF_STRING: - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_prefs_get_string(Tcl_GetString(objv[2])), -1)); - break; - case PURPLE_PREF_STRING_LIST: - cur = purple_prefs_get_string_list(Tcl_GetString(objv[2])); - list = Tcl_NewListObj(0, NULL); - while (cur != NULL) { - elem = Tcl_NewStringObj((char *)cur->data, -1); - Tcl_ListObjAppendElement(interp, list, elem); - cur = g_list_next(cur); - } - Tcl_SetObjResult(interp, list); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); - Tcl_SetObjResult(interp, - Tcl_NewStringObj("unknown pref type", -1)); - return TCL_ERROR; - } - break; - case CMD_PREFS_SET: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "path value"); - return TCL_ERROR; - } - preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); - switch (preftype) { - case PURPLE_PREF_NONE: - Tcl_SetObjResult(interp, - Tcl_NewStringObj("bad path or pref type none", -1)); - return TCL_ERROR; - break; - case PURPLE_PREF_BOOLEAN: - if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &intval)) != TCL_OK) - return error; - purple_prefs_set_bool(Tcl_GetString(objv[2]), intval); - break; - case PURPLE_PREF_INT: - if ((error = Tcl_GetIntFromObj(interp, objv[3], &intval)) != TCL_OK) - return error; - purple_prefs_set_int(Tcl_GetString(objv[2]), intval); - break; - case PURPLE_PREF_STRING: - purple_prefs_set_string(Tcl_GetString(objv[2]), Tcl_GetString(objv[3])); - break; - case PURPLE_PREF_STRING_LIST: - if ((error = Tcl_ListObjGetElements(interp, objv[3], &nelem, &elems)) != TCL_OK) - return error; - cur = NULL; - for (i = 0; i < nelem; i++) { - cur = g_list_append(cur, (gpointer)Tcl_GetString(elems[i])); - } - purple_prefs_set_string_list(Tcl_GetString(objv[2]), cur); - g_list_free(cur); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); - return TCL_ERROR; - } - break; - case CMD_PREFS_TYPE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "path"); - return TCL_ERROR; - } - preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); - switch (preftype) { - case PURPLE_PREF_NONE: - Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); - break; - case PURPLE_PREF_BOOLEAN: - Tcl_SetObjResult(interp, Tcl_NewStringObj("boolean", -1)); - break; - case PURPLE_PREF_INT: - Tcl_SetObjResult(interp, Tcl_NewStringObj("int", -1)); - break; - case PURPLE_PREF_STRING: - Tcl_SetObjResult(interp, Tcl_NewStringObj("string", -1)); - break; - case PURPLE_PREF_STRING_LIST: - Tcl_SetObjResult(interp, Tcl_NewStringObj("stringlist", -1)); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", -1)); - } - break; - } - - return TCL_OK; -} - -int tcl_cmd_presence(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "account", "active_status", "available", - "chat_user", "context", "conversation", "idle", - "login", "online", "status", "statuses", NULL }; - enum { CMD_PRESENCE_ACCOUNT, CMD_PRESENCE_ACTIVE_STATUS, - CMD_PRESENCE_AVAILABLE, CMD_PRESENCE_CHAT_USER, - CMD_PRESENCE_CONTEXT, CMD_PRESENCE_CONVERSATION, - CMD_PRESENCE_IDLE, CMD_PRESENCE_LOGIN, CMD_PRESENCE_ONLINE, - CMD_PRESENCE_STATUS, CMD_PRESENCE_STATUSES } cmd; - Tcl_Obj *result; - Tcl_Obj *list, *elem; - PurplePresence *presence; - GList *cur; - int error, idle, idle_time, login_time; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_PRESENCE_ACCOUNT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefAccount, - purple_presence_get_account(presence))); - break; - case CMD_PRESENCE_ACTIVE_STATUS: - if (objc != 3 && objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "presence [?status_id? | ?-primitive primitive?]"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatus, - purple_presence_get_active_status(presence))); - } else if (objc == 4) { - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_presence_is_status_active(presence, - Tcl_GetString(objv[3])))); - } else { - PurpleStatusPrimitive primitive; - if (strcmp(Tcl_GetString(objv[3]), "-primitive")) { - result = Tcl_NewStringObj("bad option \"", -1); - Tcl_AppendObjToObj(result, objv[3]); - Tcl_AppendToObj(result, - "\": should be -primitive", -1); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - primitive = purple_primitive_get_type_from_id(Tcl_GetString(objv[4])); - if (primitive == PURPLE_STATUS_UNSET) { - result = Tcl_NewStringObj("invalid primitive ", -1); - Tcl_AppendObjToObj(result, objv[4]); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_presence_is_status_primitive_active(presence, primitive))); - break; - } - break; - case CMD_PRESENCE_AVAILABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_presence_is_available(presence))); - break; - case CMD_PRESENCE_CHAT_USER: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_presence_get_chat_user(presence), -1)); - break; - case CMD_PRESENCE_CONTEXT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - switch (purple_presence_get_context(presence)) { - case PURPLE_PRESENCE_CONTEXT_UNSET: - Tcl_SetObjResult(interp, Tcl_NewStringObj("unset", -1)); - break; - case PURPLE_PRESENCE_CONTEXT_ACCOUNT: - Tcl_SetObjResult(interp, Tcl_NewStringObj("account", -1)); - break; - case PURPLE_PRESENCE_CONTEXT_CONV: - Tcl_SetObjResult(interp, Tcl_NewStringObj("conversation", -1)); - break; - case PURPLE_PRESENCE_CONTEXT_BUDDY: - Tcl_SetObjResult(interp, Tcl_NewStringObj("buddy", -1)); - break; - } - break; - case CMD_PRESENCE_CONVERSATION: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, - purple_presence_get_conversation(presence))); - break; - case CMD_PRESENCE_IDLE: - if (objc < 3 || objc > 5) { - Tcl_WrongNumArgs(interp, 2, objv, "presence ?idle? ?time?"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - if (objc == 3) { - if (purple_presence_is_idle(presence)) { - idle_time = purple_presence_get_idle_time (presence); - Tcl_SetObjResult(interp, Tcl_NewIntObj(idle_time)); - } else { - result = Tcl_NewListObj(0, NULL); - Tcl_SetObjResult(interp, result); - } - break; - } - if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &idle)) != TCL_OK) - return TCL_ERROR; - if (objc == 4) { - purple_presence_set_idle(presence, idle, time(NULL)); - } else if (objc == 5) { - if ((error = Tcl_GetIntFromObj(interp, - objv[4], - &idle_time)) != TCL_OK) - return TCL_ERROR; - purple_presence_set_idle(presence, idle, idle_time); - } - break; - case CMD_PRESENCE_LOGIN: - if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "presence ?time?"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_presence_get_login_time(presence))); - } else { - if ((error == Tcl_GetIntFromObj(interp, - objv[3], - &login_time)) != TCL_OK) - return TCL_ERROR; - purple_presence_set_login_time(presence, login_time); - } - break; - case CMD_PRESENCE_ONLINE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_presence_is_online(presence))); - break; - case CMD_PRESENCE_STATUS: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "presence status_id"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatus, - purple_presence_get_status(presence, - Tcl_GetString(objv[3])))); - break; - case CMD_PRESENCE_STATUSES: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - list = Tcl_NewListObj(0, NULL); - for (cur = purple_presence_get_statuses(presence); cur != NULL; - cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefStatus, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - } - - return TCL_OK; -} - -int tcl_cmd_savedstatus(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *result; - const char *cmds[] = { "current", "handle", NULL }; - enum { CMD_SAVEDSTATUS_CURRENT, CMD_SAVEDSTATUS_HANDLE } cmd; - int error; - PurpleSavedStatus *saved_status; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_SAVEDSTATUS_CURRENT: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - if ((saved_status = purple_savedstatus_get_current()) == NULL) - return TCL_ERROR; - result = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(purple_savedstatus_get_title(saved_status), -1)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(purple_savedstatus_get_type(saved_status))); - Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(purple_savedstatus_get_message(saved_status), -1)); - Tcl_SetObjResult(interp,result); - break; - case CMD_SAVEDSTATUS_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_savedstatuses_get_handle())); - break; - } - - return TCL_OK; -} - -int tcl_cmd_send_im(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - PurpleConnection *gc; - char *who, *text; - - if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "gc who text"); - return TCL_ERROR; - } - - if ((gc = tcl_validate_gc(objv[1], interp)) == NULL) - return TCL_ERROR; - - who = Tcl_GetString(objv[2]); - text = Tcl_GetString(objv[3]); - - serv_send_im(gc, who, text, 0); - - return TCL_OK; -} - -int tcl_cmd_signal(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "connect", "disconnect", NULL }; - enum { CMD_SIGNAL_CONNECT, CMD_SIGNAL_DISCONNECT } cmd; - struct tcl_signal_handler *handler; - void *instance; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_SIGNAL_CONNECT: - if (objc != 6) { - Tcl_WrongNumArgs(interp, 2, objv, "instance signal args proc"); - return TCL_ERROR; - } - handler = g_new0(struct tcl_signal_handler, 1); - if ((handler->instance = purple_tcl_ref_get(interp, objv[2],PurpleTclRefHandle)) == NULL) { - g_free(handler); - return error; - } - handler->signal = objv[3]; - Tcl_IncrRefCount(handler->signal); - handler->args = objv[4]; - handler->proc = objv[5]; - handler->interp = interp; - if (!tcl_signal_connect(handler)) { - tcl_signal_handler_free(handler); - Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); - } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); - } - break; - case CMD_SIGNAL_DISCONNECT: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "instance signal"); - return TCL_ERROR; - } - if ((instance = purple_tcl_ref_get(interp, objv[2],PurpleTclRefHandle)) == NULL) - return error; - tcl_signal_disconnect(instance, Tcl_GetString(objv[3]), interp); - break; - } - - return TCL_OK; -} - -int tcl_cmd_status(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "attr", "type", NULL }; - enum { CMD_STATUS_ATTR, CMD_STATUS_TYPE } cmd; - PurpleStatus *status; - PurpleStatusType *status_type; - int error; -#if !(defined PURPLE_DISABLE_DEPRECATED) - PurpleValue *value; - const char *attr; - int v; -#endif - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_STATUS_ATTR: -#if !(defined PURPLE_DISABLE_DEPRECATED) - if (objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "status attr_id ?value?"); - return TCL_ERROR; - } - if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL) - return TCL_ERROR; - attr = Tcl_GetString(objv[3]); - value = purple_status_get_attr_value(status, attr); - if (value == NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("no such attribute", -1)); - return TCL_ERROR; - } - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: - if (objc == 4) { - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_value_get_boolean(value))); - } else { - if ((error = Tcl_GetBooleanFromObj(interp, objv[4], &v)) != TCL_OK) - return error; - purple_status_set_attr_boolean(status, attr, v); - } - break; - case PURPLE_TYPE_INT: - if (objc == 4) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_value_get_int(value))); - } else { - if ((error = Tcl_GetIntFromObj(interp, objv[4], &v)) != TCL_OK) - return error; - purple_status_set_attr_int(status, attr, v ); - } - break; - case PURPLE_TYPE_STRING: - if (objc == 4) - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_value_get_string(value), -1)); - else - purple_status_set_attr_string(status, attr, Tcl_GetString(objv[4])); - break; - default: - Tcl_SetObjResult(interp, - Tcl_NewStringObj("attribute has unknown type", -1)); - return TCL_ERROR; - } -#endif - break; - case CMD_STATUS_TYPE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "status"); - return TCL_ERROR; - } - if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL) - return TCL_ERROR; - status_type = purple_status_get_type(status); - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefStatusType, - status_type)); - break; - } - - return TCL_OK; -} - -int tcl_cmd_status_attr(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "id", "name", NULL }; - enum { CMD_STATUS_ATTR_ID, CMD_STATUS_ATTR_NAME } cmd; - PurpleStatusAttr *attr; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_STATUS_ATTR_ID: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "attr"); - return TCL_ERROR; - } - if ((attr = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusAttr)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_attr_get_id(attr), -1)); - break; - case CMD_STATUS_ATTR_NAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "attr"); - return TCL_ERROR; - } - if ((attr = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusAttr)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_attr_get_name(attr), -1)); - break; - } - - return TCL_OK; -} - -int tcl_cmd_status_type(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "attr", "attrs", "available", "exclusive", "id", - "independent", "name", "primary_attr", - "primitive", "saveable", "user_settable", - NULL }; - enum { CMD_STATUS_TYPE_ATTR, CMD_STATUS_TYPE_ATTRS, - CMD_STATUS_TYPE_AVAILABLE, CMD_STATUS_TYPE_EXCLUSIVE, - CMD_STATUS_TYPE_ID, CMD_STATUS_TYPE_INDEPENDENT, - CMD_STATUS_TYPE_NAME, CMD_STATUS_TYPE_PRIMARY_ATTR, - CMD_STATUS_TYPE_PRIMITIVE, CMD_STATUS_TYPE_SAVEABLE, - CMD_STATUS_TYPE_USER_SETTABLE } cmd; - PurpleStatusType *status_type; - Tcl_Obj *list, *elem; - GList *cur; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_STATUS_TYPE_AVAILABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_status_type_is_available(status_type))); - break; - case CMD_STATUS_TYPE_ATTR: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype attr"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatusAttr, - purple_status_type_get_attr(status_type, - Tcl_GetStringFromObj(objv[3], NULL)))); - break; - case CMD_STATUS_TYPE_ATTRS: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - list = Tcl_NewListObj(0, NULL); - for (cur = purple_status_type_get_attrs(status_type); - cur != NULL; cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefStatusAttr, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_STATUS_TYPE_EXCLUSIVE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_status_type_is_exclusive(status_type))); - break; - case CMD_STATUS_TYPE_ID: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_id(status_type), -1)); - break; - case CMD_STATUS_TYPE_INDEPENDENT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_status_type_is_independent(status_type))); - break; - case CMD_STATUS_TYPE_NAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_name(status_type), -1)); - break; - case CMD_STATUS_TYPE_PRIMITIVE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_primitive_get_id_from_type - (purple_status_type_get_primitive(status_type)), -1)); - break; - case CMD_STATUS_TYPE_PRIMARY_ATTR: -#if !(defined PURPLE_DISABLE_DEPRECATED) - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_primary_attr(status_type), -1)); -#endif - break; - case CMD_STATUS_TYPE_SAVEABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_status_type_is_saveable(status_type))); - break; - case CMD_STATUS_TYPE_USER_SETTABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_status_type_is_user_settable(status_type))); - break; - } - - return TCL_OK; -} - -static gboolean unload_self(gpointer data) -{ - PurplePlugin *plugin = data; - purple_plugin_unload(plugin); - return FALSE; -} - -int tcl_cmd_unload(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - PurplePlugin *plugin; - if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, ""); - return TCL_ERROR; - } - - if ((plugin = tcl_interp_get_plugin(interp)) == NULL) { - /* This isn't exactly OK, but heh. What do you do? */ - return TCL_OK; - } - /* We can't unload immediately, but we can unload at the first - * known safe opportunity. */ - purple_timeout_add(0, unload_self, (gpointer)plugin); - - return TCL_OK; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -/* - * Tcl/Glib glue - * - * Copyright (C) 2003, 2004, 2006 Ethan Blanton - * - * This file is dual-licensed under the two sets of terms below. You may - * use, redistribute, or modify it pursuant to either the set of conditions - * under "TERMS 1" or "TERMS 2", at your discretion. The DISCLAIMER - * applies to both sets of terms. - * - * TERMS 1 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - * TERMS 2 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must contain the above copyright - * notice and this comment block in their entirety. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice and the text of this comment block in their entirety in - * the documentation and/or other materials provided with the - * distribution. - * - * DISCLAIMER - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* - * NOTES - * - * This file was developed for the Purple project. It inserts the Tcl - * event loop into the glib2 event loop for the purposes of providing - * Tcl bindings in a glib2 (e.g. Gtk2) program. To use it, simply - * link it into your executable, include tcl_glib.h, and call the - * function tcl_glib_init() before creating or using any Tcl - * interpreters. Then go ahead and use Tcl, Tk, whatever to your - * heart's content. - * - * BUGS - * - * tcl_wait_for_event seems to have a bug that makes vwait not work so - * well... I'm not sure why, yet, but I haven't put much time into - * it. Hopefully I will figure it out soon. In the meantime, this - * means that Tk's bgerror function (which is called when there is an - * error in a callback function) causes some Bad Mojo -- you should - * override it with a function that does not use Tk - */ - -#include -#include -#include - -#include "tcl_glib.h" - -struct tcl_file_handler { - int source; - int fd; - int mask; - int pending; - Tcl_FileProc *proc; - ClientData data; -}; - -struct tcl_file_event { - Tcl_Event header; - int fd; -}; - -static guint tcl_timer; -static gboolean tcl_timer_pending; -static GHashTable *tcl_file_handlers; - -static void tcl_set_timer(Tcl_Time *timePtr); -static int tcl_wait_for_event(Tcl_Time *timePtr); -static void tcl_create_file_handler(int fd, int mask, Tcl_FileProc *proc, ClientData data); -static void tcl_delete_file_handler(int fd); - -static gboolean tcl_kick(gpointer data); -static gboolean tcl_file_callback(GIOChannel *source, GIOCondition condition, gpointer data); -static int tcl_file_event_callback(Tcl_Event *event, int flags); - -#undef Tcl_InitNotifier - -ClientData Tcl_InitNotifier() -{ - return NULL; -} - -void tcl_glib_init () -{ - Tcl_NotifierProcs notifier; - - memset(¬ifier, 0, sizeof(notifier)); - - notifier.createFileHandlerProc = tcl_create_file_handler; - notifier.deleteFileHandlerProc = tcl_delete_file_handler; - notifier.setTimerProc = tcl_set_timer; - notifier.waitForEventProc = tcl_wait_for_event; - - Tcl_SetNotifier(¬ifier); - Tcl_SetServiceMode(TCL_SERVICE_ALL); - - tcl_timer_pending = FALSE; - tcl_file_handlers = g_hash_table_new(g_direct_hash, g_direct_equal); -} - -static void tcl_set_timer(Tcl_Time *timePtr) -{ - guint interval; - - if (tcl_timer_pending) - g_source_remove(tcl_timer); - - if (timePtr == NULL) { - tcl_timer_pending = FALSE; - return; - } - - interval = timePtr->sec * 1000 + (timePtr->usec ? timePtr->usec / 1000 : 0); - tcl_timer = g_timeout_add(interval, tcl_kick, NULL); - tcl_timer_pending = TRUE; -} - -static int tcl_wait_for_event(Tcl_Time *timePtr) -{ - if (!timePtr || (timePtr->sec == 0 && timePtr->usec == 0)) { - g_main_context_iteration(NULL, FALSE); - return 1; - } else { - tcl_set_timer(timePtr); - } - - g_main_context_iteration(NULL, TRUE); - - return 1; -} - -static void tcl_create_file_handler(int fd, int mask, Tcl_FileProc *proc, ClientData data) -{ - struct tcl_file_handler *tfh = g_new0(struct tcl_file_handler, 1); - GIOChannel *channel; - GIOCondition cond = 0; - - if (g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fd))) - tcl_delete_file_handler(fd); - - if (mask & TCL_READABLE) - cond |= G_IO_IN; - if (mask & TCL_WRITABLE) - cond |= G_IO_OUT; - if (mask & TCL_EXCEPTION) - cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL; - - tfh->fd = fd; - tfh->mask = mask; - tfh->proc = proc; - tfh->data = data; - - channel = g_io_channel_unix_new(fd); - tfh->source = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, tcl_file_callback, tfh, g_free); - g_io_channel_unref(channel); - - g_hash_table_insert(tcl_file_handlers, GINT_TO_POINTER(fd), tfh); - - Tcl_ServiceAll(); -} - -static void tcl_delete_file_handler(int fd) -{ - struct tcl_file_handler *tfh = g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fd)); - - if (tfh == NULL) - return; - - g_source_remove(tfh->source); - g_hash_table_remove(tcl_file_handlers, GINT_TO_POINTER(fd)); - - Tcl_ServiceAll(); -} - -static gboolean tcl_kick(gpointer data) -{ - tcl_timer_pending = FALSE; - - Tcl_ServiceAll(); - - return FALSE; -} - -static gboolean tcl_file_callback(GIOChannel *source, GIOCondition condition, gpointer data) -{ - struct tcl_file_handler *tfh = data; - struct tcl_file_event *fev; - int mask = 0; - - if (condition & G_IO_IN) - mask |= TCL_READABLE; - if (condition & G_IO_OUT) - mask |= TCL_WRITABLE; - if (condition & (G_IO_ERR|G_IO_HUP|G_IO_NVAL)) - mask |= TCL_EXCEPTION; - - if (!(tfh->mask & (mask & ~tfh->pending))) - return TRUE; - - tfh->pending |= mask; - fev = (struct tcl_file_event *)ckalloc(sizeof(struct tcl_file_event)); - memset(fev, 0, sizeof(struct tcl_file_event)); - fev->header.proc = tcl_file_event_callback; - fev->fd = tfh->fd; - Tcl_QueueEvent((Tcl_Event *)fev, TCL_QUEUE_TAIL); - - Tcl_ServiceAll(); - - return TRUE; -} - -int tcl_file_event_callback(Tcl_Event *event, int flags) -{ - struct tcl_file_handler *tfh; - struct tcl_file_event *fev = (struct tcl_file_event *)event; - int mask; - - if (!(flags & TCL_FILE_EVENTS)) { - return 0; - } - - tfh = g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fev->fd)); - if (tfh == NULL) - return 1; - - mask = tfh->mask & tfh->pending; - if (mask) - (*tfh->proc)(tfh->data, mask); - tfh->pending = 0; - - return 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_glib.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* - * Tcl/Glib glue - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_TCL_GLIB_H_ -#define _PURPLE_TCL_GLIB_H_ - -#include -#include - -void tcl_glib_init(void); - -#endif /* _PURPLE_TCL_GLIB_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_purple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_purple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_purple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_purple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file tcl_purple.h Purple Tcl definitions - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_TCL_PURPLE_H_ -#define _PURPLE_TCL_PURPLE_H_ - -#include - -#include "internal.h" -#include "cmds.h" -#include "plugin.h" -#include "value.h" -#include "stringref.h" - -struct tcl_signal_handler { - Tcl_Obj *signal; - Tcl_Interp *interp; - - void *instance; - Tcl_Obj *namespace; - /* These following two are temporary during setup */ - Tcl_Obj *args; - Tcl_Obj *proc; - - PurpleValue *returntype; - int nargs; - PurpleValue **argtypes; -}; - -struct tcl_cmd_handler { - int id; - Tcl_Obj *cmd; - Tcl_Interp *interp; - - Tcl_Obj *namespace; - /* These are temporary during setup */ - const char *args; - int priority; - int flags; - const char *prpl_id; - Tcl_Obj *proc; - const char *helpstr; - - int nargs; -}; - -extern PurplePlugin *_tcl_plugin; - -/* Capitalized this way because these are "types" */ -extern PurpleStringref *PurpleTclRefAccount; -extern PurpleStringref *PurpleTclRefConnection; -extern PurpleStringref *PurpleTclRefConversation; -extern PurpleStringref *PurpleTclRefPointer; -extern PurpleStringref *PurpleTclRefPlugin; -extern PurpleStringref *PurpleTclRefPresence; -extern PurpleStringref *PurpleTclRefStatus; -extern PurpleStringref *PurpleTclRefStatusAttr; -extern PurpleStringref *PurpleTclRefStatusType; -extern PurpleStringref *PurpleTclRefXfer; -extern PurpleStringref *PurpleTclRefHandle; - -PurplePlugin *tcl_interp_get_plugin(Tcl_Interp *interp); - -void tcl_signal_init(void); -void tcl_signal_handler_free(struct tcl_signal_handler *handler); -void tcl_signal_cleanup(Tcl_Interp *interp); -gboolean tcl_signal_connect(struct tcl_signal_handler *handler); -void tcl_signal_disconnect(void *instance, const char *signal, Tcl_Interp *interp); - -void tcl_cmd_init(void); -void tcl_cmd_handler_free(struct tcl_cmd_handler *handler); -void tcl_cmd_cleanup(Tcl_Interp *interp); -PurpleCmdId tcl_cmd_register(struct tcl_cmd_handler *handler); -void tcl_cmd_unregister(PurpleCmdId id, Tcl_Interp *interp); - -void purple_tcl_ref_init(void); -void *purple_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, PurpleStringref *type); -Tcl_Obj *purple_tcl_ref_new(PurpleStringref *type, void *value); - -Tcl_ObjCmdProc tcl_cmd_account; -Tcl_ObjCmdProc tcl_cmd_signal_connect; -Tcl_ObjCmdProc tcl_cmd_buddy; -Tcl_ObjCmdProc tcl_cmd_cmd; -Tcl_ObjCmdProc tcl_cmd_connection; -Tcl_ObjCmdProc tcl_cmd_conversation; -Tcl_ObjCmdProc tcl_cmd_core; -Tcl_ObjCmdProc tcl_cmd_debug; -Tcl_ObjCmdProc tcl_cmd_notify; -Tcl_ObjCmdProc tcl_cmd_plugins; -Tcl_ObjCmdProc tcl_cmd_prefs; -Tcl_ObjCmdProc tcl_cmd_presence; -Tcl_ObjCmdProc tcl_cmd_savedstatus; -Tcl_ObjCmdProc tcl_cmd_send_im; -Tcl_ObjCmdProc tcl_cmd_signal; -Tcl_ObjCmdProc tcl_cmd_status; -Tcl_ObjCmdProc tcl_cmd_status_attr; -Tcl_ObjCmdProc tcl_cmd_status_type; -Tcl_ObjCmdProc tcl_cmd_unload; - -#endif /* _PURPLE_TCL_PURPLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_ref.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_ref.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_ref.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_ref.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/** - * @file tcl_ref.c Purple Tcl typed references API - * - * purple - * - * Copyright (C) 2006 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include - -#include "tcl_purple.h" -#include "stringref.h" - -/* Instead of all that internal representation mumbo jumbo, use these - * macros to access the internal representation of a PurpleTclRef */ -#define OBJ_REF_TYPE(obj) (obj->internalRep.twoPtrValue.ptr1) -#define OBJ_REF_VALUE(obj) (obj->internalRep.twoPtrValue.ptr2) - -static Tcl_FreeInternalRepProc purple_tcl_ref_free; -static Tcl_DupInternalRepProc purple_tcl_ref_dup; -static Tcl_UpdateStringProc purple_tcl_ref_update; -static Tcl_SetFromAnyProc purple_tcl_ref_set; - -static Tcl_ObjType purple_tcl_ref = { - "PurpleTclRef", - purple_tcl_ref_free, - purple_tcl_ref_dup, - purple_tcl_ref_update, - purple_tcl_ref_set -}; - -void purple_tcl_ref_init() -{ - Tcl_RegisterObjType(&purple_tcl_ref); -} - -void *purple_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, PurpleStringref *type) -{ - if (obj->typePtr != &purple_tcl_ref) { - if (Tcl_ConvertToType(interp, obj, &purple_tcl_ref) != TCL_OK) - return NULL; - } - if (strcmp(purple_stringref_value(OBJ_REF_TYPE(obj)), - purple_stringref_value(type))) { - if (interp) { - Tcl_Obj *error = Tcl_NewStringObj("Bad Purple reference type: expected ", -1); - Tcl_AppendToObj(error, purple_stringref_value(type), -1); - Tcl_AppendToObj(error, " but got ", -1); - Tcl_AppendToObj(error, purple_stringref_value(OBJ_REF_TYPE(obj)), -1); - Tcl_SetObjResult(interp, error); - } - return NULL; - } - return OBJ_REF_VALUE(obj); -} - -Tcl_Obj *purple_tcl_ref_new(PurpleStringref *type, void *value) -{ - Tcl_Obj *obj = Tcl_NewObj(); - obj->typePtr = &purple_tcl_ref; - OBJ_REF_TYPE(obj) = purple_stringref_ref(type); - OBJ_REF_VALUE(obj) = value; - Tcl_InvalidateStringRep(obj); - return obj; -} - -static void purple_tcl_ref_free(Tcl_Obj *obj) -{ - purple_stringref_unref(OBJ_REF_TYPE(obj)); -} - -static void purple_tcl_ref_dup(Tcl_Obj *obj1, Tcl_Obj *obj2) -{ - OBJ_REF_TYPE(obj2) = purple_stringref_ref(OBJ_REF_TYPE(obj1)); - OBJ_REF_VALUE(obj2) = OBJ_REF_VALUE(obj1); -} - -static void purple_tcl_ref_update(Tcl_Obj *obj) -{ - /* This is ugly on memory, but we pretty much have to either - * do this or guesstimate lengths or introduce a varargs - * function in here ... ugh. */ - char *bytes = g_strdup_printf("purple-%s:%p", - purple_stringref_value(OBJ_REF_TYPE(obj)), - OBJ_REF_VALUE(obj)); - - obj->length = strlen(bytes); - obj->bytes = ckalloc(obj->length + 1); - strcpy(obj->bytes, bytes); - g_free(bytes); -} - -/* This isn't as memory-efficient as setting could be, because we - * essentially have to synthesize the Stringref here, where we would - * really rather dup it. Oh, well. */ -static int purple_tcl_ref_set(Tcl_Interp *interp, Tcl_Obj *obj) -{ - char *bytes = Tcl_GetStringFromObj(obj, NULL); - char *ptr; - PurpleStringref *type; - void *value; - static const char prefix[] = "purple-"; - static const int prefixlen = sizeof(prefix) - 1; - - if (strlen(bytes) < prefixlen - || strncmp(bytes, prefix, prefixlen) - || (ptr = strchr(bytes, ':')) == NULL - || (ptr - bytes) == prefixlen) - goto badobject; - - /* Bad Ethan */ - *ptr = '\0'; - type = purple_stringref_new(bytes + prefixlen); - *ptr = ':'; - ptr++; - - if (sscanf(ptr, "%p", &value) == 0) { - purple_stringref_unref(type); - goto badobject; - } - - /* At this point we know we have a good object; free the old and - * install our internal representation. */ - if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL) - obj->typePtr->freeIntRepProc(obj); - - obj->typePtr = &purple_tcl_ref; - OBJ_REF_TYPE(obj) = type; - OBJ_REF_VALUE(obj) = value; - - return TCL_OK; - -badobject: - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid PurpleTclRef representation", -1)); - } - return TCL_ERROR; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_signals.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_signals.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_signals.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/plugins/tcl/tcl_signals.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ -/** - * @file tcl_signals.c Purple Tcl signal API - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include -#include - -#include "tcl_purple.h" - -#include "internal.h" -#include "connection.h" -#include "conversation.h" -#include "signals.h" -#include "debug.h" -#include "value.h" -#include "core.h" - -static GList *tcl_callbacks; - -static void *tcl_signal_callback(va_list args, struct tcl_signal_handler *handler); -static Tcl_Obj *new_cb_namespace (void); - -void tcl_signal_init() -{ - tcl_callbacks = NULL; -} - -void tcl_signal_handler_free(struct tcl_signal_handler *handler) -{ - if (handler == NULL) - return; - - Tcl_DecrRefCount(handler->signal); - if (handler->namespace) - { - Tcl_DecrRefCount(handler->namespace); - } - g_free(handler); -} - -void tcl_signal_cleanup(Tcl_Interp *interp) -{ - GList *cur; - struct tcl_signal_handler *handler; - - for (cur = tcl_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp) { - tcl_signal_handler_free(handler); - cur->data = NULL; - } - } - tcl_callbacks = g_list_remove_all(tcl_callbacks, NULL); -} - -gboolean tcl_signal_connect(struct tcl_signal_handler *handler) -{ - GString *proc; - - purple_signal_get_values(handler->instance, - Tcl_GetString(handler->signal), - &handler->returntype, &handler->nargs, - &handler->argtypes); - - tcl_signal_disconnect(handler->interp, Tcl_GetString(handler->signal), - handler->interp); - - if (!purple_signal_connect_vargs(handler->instance, - Tcl_GetString(handler->signal), - (void *)handler->interp, - PURPLE_CALLBACK(tcl_signal_callback), - (void *)handler)) - return FALSE; - - handler->namespace = new_cb_namespace (); - Tcl_IncrRefCount(handler->namespace); - proc = g_string_new(""); - g_string_append_printf(proc, "namespace eval %s { proc cb { %s } { %s } }", - Tcl_GetString(handler->namespace), - Tcl_GetString(handler->args), - Tcl_GetString(handler->proc)); - if (Tcl_Eval(handler->interp, proc->str) != TCL_OK) { - Tcl_DecrRefCount(handler->namespace); - g_string_free(proc, TRUE); - return FALSE; - } - g_string_free(proc, TRUE); - - tcl_callbacks = g_list_append(tcl_callbacks, (gpointer)handler); - - return TRUE; -} - -void tcl_signal_disconnect(void *instance, const char *signal, Tcl_Interp *interp) -{ - GList *cur; - struct tcl_signal_handler *handler; - gboolean found = FALSE; - GString *cmd; - - for (cur = tcl_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp && handler->instance == instance - && !strcmp(signal, Tcl_GetString(handler->signal))) { - purple_signal_disconnect(instance, signal, handler->interp, - PURPLE_CALLBACK(tcl_signal_callback)); - cmd = g_string_sized_new(64); - g_string_printf(cmd, "namespace delete %s", - Tcl_GetString(handler->namespace)); - Tcl_EvalEx(interp, cmd->str, -1, TCL_EVAL_GLOBAL); - tcl_signal_handler_free(handler); - g_string_free(cmd, TRUE); - cur->data = NULL; - found = TRUE; - break; - } - } - if (found) - tcl_callbacks = g_list_remove_all(tcl_callbacks, NULL); -} - -static PurpleStringref *ref_type(PurpleSubType type) -{ - switch (type) { - case PURPLE_SUBTYPE_ACCOUNT: - return PurpleTclRefAccount; - case PURPLE_SUBTYPE_CONNECTION: - return PurpleTclRefConnection; - case PURPLE_SUBTYPE_CONVERSATION: - return PurpleTclRefConversation; - case PURPLE_SUBTYPE_PLUGIN: - return PurpleTclRefPlugin; - case PURPLE_SUBTYPE_STATUS: - return PurpleTclRefStatus; - case PURPLE_SUBTYPE_XFER: - return PurpleTclRefXfer; - default: - return NULL; - } -} - -static void *tcl_signal_callback(va_list args, struct tcl_signal_handler *handler) -{ - GString *name, *val; - PurpleBlistNode *node; - int error, i; - void *retval = NULL; - Tcl_Obj *cmd, *arg, *result; - void **vals; /* Used for inout parameters */ - char ***strs; - - vals = g_new0(void *, handler->nargs); - strs = g_new0(char **, handler->nargs); - name = g_string_sized_new(32); - val = g_string_sized_new(32); - - cmd = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(cmd); - - arg = Tcl_DuplicateObj(handler->namespace); - Tcl_AppendStringsToObj(arg, "::cb", NULL); - Tcl_ListObjAppendElement(handler->interp, cmd, arg); - - for (i = 0; i < handler->nargs; i++) { - if (purple_value_is_outgoing(handler->argtypes[i])) - g_string_printf(name, "%s::arg%d", - Tcl_GetString(handler->namespace), i); - - switch(purple_value_get_type(handler->argtypes[i])) { - case PURPLE_TYPE_UNKNOWN: /* What? I guess just pass the word ... */ - /* treat this as a pointer, but complain first */ - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "unknown PurpleValue type %d\n", - purple_value_get_type(handler->argtypes[i])); - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_OBJECT: - case PURPLE_TYPE_BOXED: - /* These are all "pointer" types to us */ - if (purple_value_is_outgoing(handler->argtypes[i])) - purple_debug_error("tcl", "pointer types do not currently support outgoing arguments\n"); - arg = purple_tcl_ref_new(PurpleTclRefPointer, va_arg(args, void *)); - break; - case PURPLE_TYPE_BOOLEAN: - if (purple_value_is_outgoing(handler->argtypes[i])) { - vals[i] = va_arg(args, gboolean *); - Tcl_LinkVar(handler->interp, name->str, - (char *)&vals[i], TCL_LINK_BOOLEAN); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewBooleanObj(va_arg(args, gboolean)); - } - break; - case PURPLE_TYPE_CHAR: - case PURPLE_TYPE_UCHAR: - case PURPLE_TYPE_SHORT: - case PURPLE_TYPE_USHORT: - case PURPLE_TYPE_INT: - case PURPLE_TYPE_UINT: - case PURPLE_TYPE_LONG: - case PURPLE_TYPE_ULONG: - case PURPLE_TYPE_ENUM: - /* I should really cast these individually to - * preserve as much information as possible ... - * but heh */ - if (purple_value_is_outgoing(handler->argtypes[i])) { - vals[i] = va_arg(args, int *); - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_INT); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewIntObj(va_arg(args, int)); - } - break; - case PURPLE_TYPE_INT64: - case PURPLE_TYPE_UINT64: - /* Tcl < 8.4 doesn't have wide ints, so we have ugly - * ifdefs in here */ - if (purple_value_is_outgoing(handler->argtypes[i])) { - vals[i] = (void *)va_arg(args, gint64 *); - #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 4) - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_WIDE_INT); - #else - /* This is going to cause weirdness at best, - * but what do you want ... we're losing - * precision */ - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_INT); - #endif /* Tcl >= 8.4 */ - arg = Tcl_NewStringObj(name->str, -1); - } else { - #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 4) - arg = Tcl_NewWideIntObj(va_arg(args, gint64)); - #else - arg = Tcl_NewIntObj((int)va_arg(args, int)); - #endif /* Tcl >= 8.4 */ - } - break; - case PURPLE_TYPE_STRING: - if (purple_value_is_outgoing(handler->argtypes[i])) { - strs[i] = va_arg(args, char **); - if (strs[i] == NULL || *strs[i] == NULL) { - vals[i] = ckalloc(1); - *(char *)vals[i] = '\0'; - } else { - vals[i] = ckalloc(strlen(*strs[i]) + 1); - strcpy(vals[i], *strs[i]); - } - Tcl_LinkVar(handler->interp, name->str, - (char *)&vals[i], TCL_LINK_STRING); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewStringObj(va_arg(args, char *), -1); - } - break; - case PURPLE_TYPE_SUBTYPE: - switch (purple_value_get_subtype(handler->argtypes[i])) { - case PURPLE_SUBTYPE_UNKNOWN: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "subtype unknown\n"); - case PURPLE_SUBTYPE_ACCOUNT: - case PURPLE_SUBTYPE_CONNECTION: - case PURPLE_SUBTYPE_CONVERSATION: - case PURPLE_SUBTYPE_STATUS: - case PURPLE_SUBTYPE_PLUGIN: - case PURPLE_SUBTYPE_XFER: - if (purple_value_is_outgoing(handler->argtypes[i])) - purple_debug_error("tcl", "pointer subtypes do not currently support outgoing arguments\n"); - arg = purple_tcl_ref_new(ref_type(purple_value_get_subtype(handler->argtypes[i])), va_arg(args, void *)); - break; - case PURPLE_SUBTYPE_BLIST: - case PURPLE_SUBTYPE_BLIST_BUDDY: - case PURPLE_SUBTYPE_BLIST_GROUP: - case PURPLE_SUBTYPE_BLIST_CHAT: - /* We're going to switch again for code-deduping */ - if (purple_value_is_outgoing(handler->argtypes[i])) - node = *va_arg(args, PurpleBlistNode **); - else - node = va_arg(args, PurpleBlistNode *); - switch (purple_blist_node_get_type(node)) { - case PURPLE_BLIST_GROUP_NODE: - arg = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj("group", -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)node), -1)); - break; - case PURPLE_BLIST_CONTACT_NODE: - /* g_string_printf(val, "contact {%s}", Contact Name? ); */ - arg = Tcl_NewStringObj("contact", -1); - break; - case PURPLE_BLIST_BUDDY_NODE: - arg = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj("buddy", -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(purple_buddy_get_name((PurpleBuddy *)node), -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - purple_tcl_ref_new(PurpleTclRefAccount, - purple_buddy_get_account((PurpleBuddy *)node))); - break; - case PURPLE_BLIST_CHAT_NODE: - arg = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj("chat", -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - purple_tcl_ref_new(PurpleTclRefAccount, - purple_chat_get_account((PurpleChat *)node))); - break; - case PURPLE_BLIST_OTHER_NODE: - arg = Tcl_NewStringObj("other", -1); - break; - } - break; - } - } - Tcl_ListObjAppendElement(handler->interp, cmd, arg); - } - - /* Call the friggin' procedure already */ - if ((error = Tcl_EvalObjEx(handler->interp, cmd, TCL_EVAL_GLOBAL)) != TCL_OK) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error evaluating callback: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - } else { - result = Tcl_GetObjResult(handler->interp); - /* handle return values -- strings and words only */ - if (handler->returntype) { - if (purple_value_get_type(handler->returntype) == PURPLE_TYPE_STRING) { - retval = (void *)g_strdup(Tcl_GetString(result)); - } else { - if ((error = Tcl_GetIntFromObj(handler->interp, result, (int *)&retval)) != TCL_OK) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error retrieving procedure result: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - retval = NULL; - } - } - } - } - - /* And finally clean up */ - for (i = 0; i < handler->nargs; i++) { - g_string_printf(name, "%s::arg%d", - Tcl_GetString(handler->namespace), i); - if (purple_value_is_outgoing(handler->argtypes[i]) - && purple_value_get_type(handler->argtypes[i]) != PURPLE_TYPE_SUBTYPE) - Tcl_UnlinkVar(handler->interp, name->str); - - /* We basically only have to deal with strings on the - * way out */ - switch (purple_value_get_type(handler->argtypes[i])) { - case PURPLE_TYPE_STRING: - if (purple_value_is_outgoing(handler->argtypes[i])) { - if (vals[i] != NULL && *(char **)vals[i] != NULL) { - g_free(*strs[i]); - *strs[i] = g_strdup(vals[i]); - } - ckfree(vals[i]); - } - break; - default: - /* nothing */ - ; - } - } - - g_string_free(name, TRUE); - g_string_free(val, TRUE); - g_free(vals); - g_free(strs); - - return retval; -} - -static Tcl_Obj *new_cb_namespace () -{ - static int cbnum; - char name[32]; - - g_snprintf (name, sizeof(name), "::purple::_callback::cb_%d", cbnum++); - return Tcl_NewStringObj (name, -1); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1163 +0,0 @@ -/** - * @file pounce.c Buddy Pounce API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "conversation.h" -#include "debug.h" -#include "pounce.h" - -#include "debug.h" -#include "pounce.h" -#include "util.h" - -typedef struct -{ - GString *buffer; - - PurplePounce *pounce; - PurplePounceEvent events; - PurplePounceOption options; - - char *ui_name; - char *pouncee; - char *protocol_id; - char *event_type; - char *option_type; - char *action_name; - char *param_name; - char *account_name; - -} PounceParserData; - -typedef struct -{ - char *name; - - gboolean enabled; - - GHashTable *atts; - -} PurplePounceActionData; - -typedef struct -{ - char *ui; - PurplePounceCb cb; - void (*new_pounce)(PurplePounce *); - void (*free_pounce)(PurplePounce *); - -} PurplePounceHandler; - - -static GHashTable *pounce_handlers = NULL; -static GList *pounces = NULL; -static guint save_timer = 0; -static gboolean pounces_loaded = FALSE; - - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static PurplePounceActionData * -find_action_data(const PurplePounce *pounce, const char *name) -{ - PurplePounceActionData *action; - - g_return_val_if_fail(pounce != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - action = g_hash_table_lookup(pounce->actions, name); - - return action; -} - -static void -free_action_data(gpointer data) -{ - PurplePounceActionData *action_data = data; - - g_free(action_data->name); - - g_hash_table_destroy(action_data->atts); - - g_free(action_data); -} - - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static void -action_parameter_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *name, *param_value; - xmlnode *node, *child; - - name = (const char *)key; - param_value = (const char *)value; - node = (xmlnode *)user_data; - - child = xmlnode_new_child(node, "param"); - xmlnode_set_attrib(child, "name", name); - xmlnode_insert_data(child, param_value, -1); -} - -static void -action_parameter_list_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *action; - PurplePounceActionData *action_data; - xmlnode *node, *child; - - action = (const char *)key; - action_data = (PurplePounceActionData *)value; - node = (xmlnode *)user_data; - - if (!action_data->enabled) - return; - - child = xmlnode_new_child(node, "action"); - xmlnode_set_attrib(child, "type", action); - - g_hash_table_foreach(action_data->atts, action_parameter_to_xmlnode, child); -} - -static void -add_event_to_xmlnode(xmlnode *node, const char *type) -{ - xmlnode *child; - - child = xmlnode_new_child(node, "event"); - xmlnode_set_attrib(child, "type", type); -} - -static void -add_option_to_xmlnode(xmlnode *node, const char *type) -{ - xmlnode *child; - - child = xmlnode_new_child(node, "option"); - xmlnode_set_attrib(child, "type", type); -} - -static xmlnode * -pounce_to_xmlnode(PurplePounce *pounce) -{ - xmlnode *node, *child; - PurpleAccount *pouncer; - PurplePounceEvent events; - PurplePounceOption options; - - pouncer = purple_pounce_get_pouncer(pounce); - events = purple_pounce_get_events(pounce); - options = purple_pounce_get_options(pounce); - - node = xmlnode_new("pounce"); - xmlnode_set_attrib(node, "ui", pounce->ui_type); - - child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", pouncer->protocol_id); - xmlnode_insert_data(child, - purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); - - child = xmlnode_new_child(node, "pouncee"); - xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); - - /* Write pounce options */ - child = xmlnode_new_child(node, "options"); - if (options & PURPLE_POUNCE_OPTION_AWAY) - add_option_to_xmlnode(child, "on-away"); - - /* Write pounce events */ - child = xmlnode_new_child(node, "events"); - if (events & PURPLE_POUNCE_SIGNON) - add_event_to_xmlnode(child, "sign-on"); - if (events & PURPLE_POUNCE_SIGNOFF) - add_event_to_xmlnode(child, "sign-off"); - if (events & PURPLE_POUNCE_AWAY) - add_event_to_xmlnode(child, "away"); - if (events & PURPLE_POUNCE_AWAY_RETURN) - add_event_to_xmlnode(child, "return-from-away"); - if (events & PURPLE_POUNCE_IDLE) - add_event_to_xmlnode(child, "idle"); - if (events & PURPLE_POUNCE_IDLE_RETURN) - add_event_to_xmlnode(child, "return-from-idle"); - if (events & PURPLE_POUNCE_TYPING) - add_event_to_xmlnode(child, "start-typing"); - if (events & PURPLE_POUNCE_TYPED) - add_event_to_xmlnode(child, "typed"); - if (events & PURPLE_POUNCE_TYPING_STOPPED) - add_event_to_xmlnode(child, "stop-typing"); - if (events & PURPLE_POUNCE_MESSAGE_RECEIVED) - add_event_to_xmlnode(child, "message-received"); - - /* Write pounce actions */ - child = xmlnode_new_child(node, "actions"); - g_hash_table_foreach(pounce->actions, action_parameter_list_to_xmlnode, child); - - if (purple_pounce_get_save(pounce)) - child = xmlnode_new_child(node, "save"); - - return node; -} - -static xmlnode * -pounces_to_xmlnode(void) -{ - xmlnode *node, *child; - GList *cur; - - node = xmlnode_new("pounces"); - xmlnode_set_attrib(node, "version", "1.0"); - - for (cur = purple_pounces_get_all(); cur != NULL; cur = cur->next) - { - child = pounce_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static void -sync_pounces(void) -{ - xmlnode *node; - char *data; - - if (!pounces_loaded) - { - purple_debug_error("pounce", "Attempted to save buddy pounces before " - "they were read!\n"); - return; - } - - node = pounces_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("pounces.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_pounces(); - save_timer = 0; - return FALSE; -} - -static void -schedule_pounces_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static void -free_parser_data(gpointer user_data) -{ - PounceParserData *data = user_data; - - if (data->buffer != NULL) - g_string_free(data->buffer, TRUE); - - g_free(data->ui_name); - g_free(data->pouncee); - g_free(data->protocol_id); - g_free(data->event_type); - g_free(data->option_type); - g_free(data->action_name); - g_free(data->param_name); - g_free(data->account_name); - - g_free(data); -} - -static void -start_element_handler(GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, GError **error) -{ - PounceParserData *data = user_data; - GHashTable *atts; - int i; - - atts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - for (i = 0; attribute_names[i] != NULL; i++) { - g_hash_table_insert(atts, g_strdup(attribute_names[i]), - g_strdup(attribute_values[i])); - } - - if (data->buffer != NULL) { - g_string_free(data->buffer, TRUE); - data->buffer = NULL; - } - - if (purple_strequal(element_name, "pounce")) { - const char *ui = g_hash_table_lookup(atts, "ui"); - - if (ui == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'ui' parameter for pounce!\n"); - } - else - data->ui_name = g_strdup(ui); - - data->events = 0; - } - else if (purple_strequal(element_name, "account")) { - const char *protocol_id = g_hash_table_lookup(atts, "protocol"); - - if (protocol_id == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'protocol' parameter for account!\n"); - } - else - data->protocol_id = g_strdup(protocol_id); - } - else if (purple_strequal(element_name, "option")) { - const char *type = g_hash_table_lookup(atts, "type"); - - if (type == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'type' parameter for option!\n"); - } - else - data->option_type = g_strdup(type); - } - else if (purple_strequal(element_name, "event")) { - const char *type = g_hash_table_lookup(atts, "type"); - - if (type == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'type' parameter for event!\n"); - } - else - data->event_type = g_strdup(type); - } - else if (purple_strequal(element_name, "action")) { - const char *type = g_hash_table_lookup(atts, "type"); - - if (type == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'type' parameter for action!\n"); - } - else - data->action_name = g_strdup(type); - } - else if (purple_strequal(element_name, "param")) { - const char *param_name = g_hash_table_lookup(atts, "name"); - - if (param_name == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'name' parameter for param!\n"); - } - else - data->param_name = g_strdup(param_name); - } - - g_hash_table_destroy(atts); -} - -static void -end_element_handler(GMarkupParseContext *context, const gchar *element_name, - gpointer user_data, GError **error) -{ - PounceParserData *data = user_data; - gchar *buffer = NULL; - - if (data->buffer != NULL) { - buffer = g_string_free(data->buffer, FALSE); - data->buffer = NULL; - } - - if (purple_strequal(element_name, "account")) { - char *tmp; - g_free(data->account_name); - data->account_name = g_strdup(buffer); - tmp = data->protocol_id; - data->protocol_id = g_strdup(_purple_oscar_convert(buffer, tmp)); - g_free(tmp); - } - else if (purple_strequal(element_name, "pouncee")) { - g_free(data->pouncee); - data->pouncee = g_strdup(buffer); - } - else if (purple_strequal(element_name, "option")) { - if (purple_strequal(data->option_type, "on-away")) - data->options |= PURPLE_POUNCE_OPTION_AWAY; - - g_free(data->option_type); - data->option_type = NULL; - } - else if (purple_strequal(element_name, "event")) { - if (purple_strequal(data->event_type, "sign-on")) - data->events |= PURPLE_POUNCE_SIGNON; - else if (purple_strequal(data->event_type, "sign-off")) - data->events |= PURPLE_POUNCE_SIGNOFF; - else if (purple_strequal(data->event_type, "away")) - data->events |= PURPLE_POUNCE_AWAY; - else if (purple_strequal(data->event_type, "return-from-away")) - data->events |= PURPLE_POUNCE_AWAY_RETURN; - else if (purple_strequal(data->event_type, "idle")) - data->events |= PURPLE_POUNCE_IDLE; - else if (purple_strequal(data->event_type, "return-from-idle")) - data->events |= PURPLE_POUNCE_IDLE_RETURN; - else if (purple_strequal(data->event_type, "start-typing")) - data->events |= PURPLE_POUNCE_TYPING; - else if (purple_strequal(data->event_type, "typed")) - data->events |= PURPLE_POUNCE_TYPED; - else if (purple_strequal(data->event_type, "stop-typing")) - data->events |= PURPLE_POUNCE_TYPING_STOPPED; - else if (purple_strequal(data->event_type, "message-received")) - data->events |= PURPLE_POUNCE_MESSAGE_RECEIVED; - - g_free(data->event_type); - data->event_type = NULL; - } - else if (purple_strequal(element_name, "action")) { - if (data->pounce != NULL) { - purple_pounce_action_register(data->pounce, data->action_name); - purple_pounce_action_set_enabled(data->pounce, data->action_name, TRUE); - } - - g_free(data->action_name); - data->action_name = NULL; - } - else if (purple_strequal(element_name, "param")) { - if (data->pounce != NULL) { - purple_pounce_action_set_attribute(data->pounce, data->action_name, - data->param_name, buffer); - } - - g_free(data->param_name); - data->param_name = NULL; - } - else if (purple_strequal(element_name, "events")) { - PurpleAccount *account; - - account = purple_accounts_find(data->account_name, data->protocol_id); - - g_free(data->account_name); - g_free(data->protocol_id); - - data->account_name = NULL; - data->protocol_id = NULL; - - if (account == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Account for pounce not found!\n"); - /* - * This pounce has effectively been removed, so make - * sure that we save the changes to pounces.xml - */ - schedule_pounces_save(); - } - else { - purple_debug(PURPLE_DEBUG_INFO, "pounce", - "Creating pounce: %s, %s\n", data->ui_name, - data->pouncee); - - data->pounce = purple_pounce_new(data->ui_name, account, - data->pouncee, data->events, - data->options); - } - - g_free(data->pouncee); - data->pouncee = NULL; - } - else if (purple_strequal(element_name, "save")) { - if (data->pounce != NULL) - purple_pounce_set_save(data->pounce, TRUE); - } - else if (purple_strequal(element_name, "pounce")) { - data->pounce = NULL; - data->events = 0; - data->options = 0; - - g_free(data->ui_name); - g_free(data->pouncee); - g_free(data->protocol_id); - g_free(data->event_type); - g_free(data->option_type); - g_free(data->action_name); - g_free(data->param_name); - g_free(data->account_name); - - data->ui_name = NULL; - data->pounce = NULL; - data->protocol_id = NULL; - data->event_type = NULL; - data->option_type = NULL; - data->action_name = NULL; - data->param_name = NULL; - data->account_name = NULL; - } - - g_free(buffer); -} - -static void -text_handler(GMarkupParseContext *context, const gchar *text, - gsize text_len, gpointer user_data, GError **error) -{ - PounceParserData *data = user_data; - - if (data->buffer == NULL) - data->buffer = g_string_new_len(text, text_len); - else - g_string_append_len(data->buffer, text, text_len); -} - -static GMarkupParser pounces_parser = -{ - start_element_handler, - end_element_handler, - text_handler, - NULL, - NULL -}; - -gboolean -purple_pounces_load(void) -{ - gchar *filename = g_build_filename(purple_user_dir(), "pounces.xml", NULL); - gchar *contents = NULL; - gsize length; - GMarkupParseContext *context; - GError *error = NULL; - PounceParserData *parser_data; - - if (filename == NULL) { - pounces_loaded = TRUE; - return FALSE; - } - - if (!g_file_get_contents(filename, &contents, &length, &error)) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Error reading pounces: %s\n", error->message); - - g_free(filename); - g_error_free(error); - - pounces_loaded = TRUE; - return FALSE; - } - - parser_data = g_new0(PounceParserData, 1); - - context = g_markup_parse_context_new(&pounces_parser, 0, - parser_data, free_parser_data); - - if (!g_markup_parse_context_parse(context, contents, length, NULL)) { - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - - pounces_loaded = TRUE; - - return FALSE; - } - - if (!g_markup_parse_context_end_parse(context, NULL)) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", "Error parsing %s\n", - filename); - - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - pounces_loaded = TRUE; - - return FALSE; - } - - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - - pounces_loaded = TRUE; - - return TRUE; -} - - -PurplePounce * -purple_pounce_new(const char *ui_type, PurpleAccount *pouncer, - const char *pouncee, PurplePounceEvent event, - PurplePounceOption option) -{ - PurplePounce *pounce; - PurplePounceHandler *handler; - - g_return_val_if_fail(ui_type != NULL, NULL); - g_return_val_if_fail(pouncer != NULL, NULL); - g_return_val_if_fail(pouncee != NULL, NULL); - g_return_val_if_fail(event != 0, NULL); - - pounce = g_new0(PurplePounce, 1); - - pounce->ui_type = g_strdup(ui_type); - pounce->pouncer = pouncer; - pounce->pouncee = g_strdup(pouncee); - pounce->events = event; - pounce->options = option; - - pounce->actions = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, free_action_data); - - handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); - - if (handler != NULL && handler->new_pounce != NULL) - handler->new_pounce(pounce); - - pounces = g_list_append(pounces, pounce); - - schedule_pounces_save(); - - return pounce; -} - -void -purple_pounce_destroy(PurplePounce *pounce) -{ - PurplePounceHandler *handler; - - g_return_if_fail(pounce != NULL); - - handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); - - pounces = g_list_remove(pounces, pounce); - - g_free(pounce->ui_type); - g_free(pounce->pouncee); - - g_hash_table_destroy(pounce->actions); - - if (handler != NULL && handler->free_pounce != NULL) - handler->free_pounce(pounce); - - g_free(pounce); - - schedule_pounces_save(); -} - -void -purple_pounce_destroy_all_by_account(PurpleAccount *account) -{ - PurpleAccount *pouncer; - PurplePounce *pounce; - GList *l, *l_next; - - g_return_if_fail(account != NULL); - - for (l = purple_pounces_get_all(); l != NULL; l = l_next) - { - pounce = (PurplePounce *)l->data; - l_next = l->next; - - pouncer = purple_pounce_get_pouncer(pounce); - if (pouncer == account) - purple_pounce_destroy(pounce); - } -} - -void -purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events) -{ - g_return_if_fail(pounce != NULL); - g_return_if_fail(events != PURPLE_POUNCE_NONE); - - pounce->events = events; - - schedule_pounces_save(); -} - -void -purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options) -{ - g_return_if_fail(pounce != NULL); - - pounce->options = options; - - schedule_pounces_save(); -} - -void -purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer) -{ - g_return_if_fail(pounce != NULL); - g_return_if_fail(pouncer != NULL); - - pounce->pouncer = pouncer; - - schedule_pounces_save(); -} - -void -purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee) -{ - g_return_if_fail(pounce != NULL); - g_return_if_fail(pouncee != NULL); - - g_free(pounce->pouncee); - pounce->pouncee = g_strdup(pouncee); - - schedule_pounces_save(); -} - -void -purple_pounce_set_save(PurplePounce *pounce, gboolean save) -{ - g_return_if_fail(pounce != NULL); - - pounce->save = save; - - schedule_pounces_save(); -} - -void -purple_pounce_action_register(PurplePounce *pounce, const char *name) -{ - PurplePounceActionData *action_data; - - g_return_if_fail(pounce != NULL); - g_return_if_fail(name != NULL); - - if (g_hash_table_lookup(pounce->actions, name) != NULL) - return; - - action_data = g_new0(PurplePounceActionData, 1); - - action_data->name = g_strdup(name); - action_data->enabled = FALSE; - action_data->atts = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - g_hash_table_insert(pounce->actions, g_strdup(name), action_data); - - schedule_pounces_save(); -} - -void -purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action, - gboolean enabled) -{ - PurplePounceActionData *action_data; - - g_return_if_fail(pounce != NULL); - g_return_if_fail(action != NULL); - - action_data = find_action_data(pounce, action); - - g_return_if_fail(action_data != NULL); - - action_data->enabled = enabled; - - schedule_pounces_save(); -} - -void -purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action, - const char *attr, const char *value) -{ - PurplePounceActionData *action_data; - - g_return_if_fail(pounce != NULL); - g_return_if_fail(action != NULL); - g_return_if_fail(attr != NULL); - - action_data = find_action_data(pounce, action); - - g_return_if_fail(action_data != NULL); - - if (value == NULL) - g_hash_table_remove(action_data->atts, attr); - else - g_hash_table_insert(action_data->atts, g_strdup(attr), - g_strdup(value)); - - schedule_pounces_save(); -} - -void -purple_pounce_set_data(PurplePounce *pounce, void *data) -{ - g_return_if_fail(pounce != NULL); - - pounce->data = data; - - schedule_pounces_save(); -} - -PurplePounceEvent -purple_pounce_get_events(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, PURPLE_POUNCE_NONE); - - return pounce->events; -} - -PurplePounceOption -purple_pounce_get_options(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, PURPLE_POUNCE_OPTION_NONE); - - return pounce->options; -} - -PurpleAccount * -purple_pounce_get_pouncer(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, NULL); - - return pounce->pouncer; -} - -const char * -purple_pounce_get_pouncee(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, NULL); - - return pounce->pouncee; -} - -gboolean -purple_pounce_get_save(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, FALSE); - - return pounce->save; -} - -gboolean -purple_pounce_action_is_enabled(const PurplePounce *pounce, const char *action) -{ - PurplePounceActionData *action_data; - - g_return_val_if_fail(pounce != NULL, FALSE); - g_return_val_if_fail(action != NULL, FALSE); - - action_data = find_action_data(pounce, action); - - g_return_val_if_fail(action_data != NULL, FALSE); - - return action_data->enabled; -} - -const char * -purple_pounce_action_get_attribute(const PurplePounce *pounce, - const char *action, const char *attr) -{ - PurplePounceActionData *action_data; - - g_return_val_if_fail(pounce != NULL, NULL); - g_return_val_if_fail(action != NULL, NULL); - g_return_val_if_fail(attr != NULL, NULL); - - action_data = find_action_data(pounce, action); - - g_return_val_if_fail(action_data != NULL, NULL); - - return g_hash_table_lookup(action_data->atts, attr); -} - -void * -purple_pounce_get_data(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, NULL); - - return pounce->data; -} - -void -purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee, - PurplePounceEvent events) -{ - PurplePounce *pounce; - PurplePounceHandler *handler; - PurplePresence *presence; - GList *l, *l_next; - char *norm_pouncee; - - g_return_if_fail(pouncer != NULL); - g_return_if_fail(pouncee != NULL); - g_return_if_fail(events != PURPLE_POUNCE_NONE); - - norm_pouncee = g_strdup(purple_normalize(pouncer, pouncee)); - - for (l = purple_pounces_get_all(); l != NULL; l = l_next) - { - pounce = (PurplePounce *)l->data; - l_next = l->next; - - presence = purple_account_get_presence(pouncer); - - if ((purple_pounce_get_events(pounce) & events) && - (purple_pounce_get_pouncer(pounce) == pouncer) && - !purple_utf8_strcasecmp(purple_normalize(pouncer, purple_pounce_get_pouncee(pounce)), - norm_pouncee) && - (pounce->options == PURPLE_POUNCE_OPTION_NONE || - (pounce->options & PURPLE_POUNCE_OPTION_AWAY && - !purple_presence_is_available(presence)))) - { - handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); - - if (handler != NULL && handler->cb != NULL) - { - handler->cb(pounce, events, purple_pounce_get_data(pounce)); - - if (!purple_pounce_get_save(pounce)) - purple_pounce_destroy(pounce); - } - } - } - - g_free(norm_pouncee); -} - -PurplePounce * -purple_find_pounce(const PurpleAccount *pouncer, const char *pouncee, - PurplePounceEvent events) -{ - PurplePounce *pounce = NULL; - GList *l; - char *norm_pouncee; - - g_return_val_if_fail(pouncer != NULL, NULL); - g_return_val_if_fail(pouncee != NULL, NULL); - g_return_val_if_fail(events != PURPLE_POUNCE_NONE, NULL); - - norm_pouncee = g_strdup(purple_normalize(pouncer, pouncee)); - - for (l = purple_pounces_get_all(); l != NULL; l = l->next) - { - pounce = (PurplePounce *)l->data; - - if ((purple_pounce_get_events(pounce) & events) && - (purple_pounce_get_pouncer(pounce) == pouncer) && - !purple_utf8_strcasecmp(purple_normalize(pouncer, purple_pounce_get_pouncee(pounce)), - norm_pouncee)) - { - break; - } - - pounce = NULL; - } - - g_free(norm_pouncee); - - return pounce; -} - -void -purple_pounces_register_handler(const char *ui, PurplePounceCb cb, - void (*new_pounce)(PurplePounce *pounce), - void (*free_pounce)(PurplePounce *pounce)) -{ - PurplePounceHandler *handler; - - g_return_if_fail(ui != NULL); - g_return_if_fail(cb != NULL); - - handler = g_new0(PurplePounceHandler, 1); - - handler->ui = g_strdup(ui); - handler->cb = cb; - handler->new_pounce = new_pounce; - handler->free_pounce = free_pounce; - - g_hash_table_insert(pounce_handlers, g_strdup(ui), handler); -} - -void -purple_pounces_unregister_handler(const char *ui) -{ - g_return_if_fail(ui != NULL); - - g_hash_table_remove(pounce_handlers, ui); -} - -GList * -purple_pounces_get_all(void) -{ - return pounces; -} - -GList *purple_pounces_get_all_for_ui(const char *ui) -{ - GList *list = NULL, *iter; - g_return_val_if_fail(ui != NULL, NULL); - - for (iter = pounces; iter; iter = iter->next) { - PurplePounce *pounce = iter->data; - if (purple_strequal(pounce->ui_type, ui)) - list = g_list_prepend(list, pounce); - } - list = g_list_reverse(list); - return list; -} - -static void -free_pounce_handler(gpointer user_data) -{ - PurplePounceHandler *handler = (PurplePounceHandler *)user_data; - - g_free(handler->ui); - g_free(handler); -} - -static void -buddy_state_cb(PurpleBuddy *buddy, PurplePounceEvent event) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - const gchar *name = purple_buddy_get_name(buddy); - - purple_pounce_execute(account, name, event); -} - -static void -buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, - PurpleStatus *status) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - const gchar *name = purple_buddy_get_name(buddy); - gboolean old_available, available; - - available = purple_status_is_available(status); - old_available = purple_status_is_available(old_status); - - if (available && !old_available) - purple_pounce_execute(account, name, PURPLE_POUNCE_AWAY_RETURN); - else if (!available && old_available) - purple_pounce_execute(account, name, PURPLE_POUNCE_AWAY); -} - -static void -buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - const gchar *name = purple_buddy_get_name(buddy); - - if (idle && !old_idle) - purple_pounce_execute(account, name, PURPLE_POUNCE_IDLE); - else if (!idle && old_idle) - purple_pounce_execute(account, name, PURPLE_POUNCE_IDLE_RETURN); -} - -static void -buddy_typing_cb(PurpleAccount *account, const char *name, void *data) -{ - PurpleConversation *conv; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); - if (conv != NULL) - { - PurpleTypingState state; - PurplePounceEvent event; - - state = purple_conv_im_get_typing_state(PURPLE_CONV_IM(conv)); - if (state == PURPLE_TYPED) - event = PURPLE_POUNCE_TYPED; - else if (state == PURPLE_NOT_TYPING) - event = PURPLE_POUNCE_TYPING_STOPPED; - else - event = PURPLE_POUNCE_TYPING; - - purple_pounce_execute(account, name, event); - } -} - -static void -received_message_cb(PurpleAccount *account, const char *name, void *data) -{ - purple_pounce_execute(account, name, PURPLE_POUNCE_MESSAGE_RECEIVED); -} - -void * -purple_pounces_get_handle(void) -{ - static int pounce_handle; - - return &pounce_handle; -} - -void -purple_pounces_init(void) -{ - void *handle = purple_pounces_get_handle(); - void *blist_handle = purple_blist_get_handle(); - void *conv_handle = purple_conversations_get_handle(); - - pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, free_pounce_handler); - - purple_signal_connect(blist_handle, "buddy-idle-changed", - handle, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-status-changed", - handle, PURPLE_CALLBACK(buddy_status_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-on", - handle, PURPLE_CALLBACK(buddy_state_cb), - GINT_TO_POINTER(PURPLE_POUNCE_SIGNON)); - purple_signal_connect(blist_handle, "buddy-signed-off", - handle, PURPLE_CALLBACK(buddy_state_cb), - GINT_TO_POINTER(PURPLE_POUNCE_SIGNOFF)); - - purple_signal_connect(conv_handle, "buddy-typing", - handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typed", - handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typing-stopped", - handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); - - purple_signal_connect(conv_handle, "received-im-msg", - handle, PURPLE_CALLBACK(received_message_cb), NULL); -} - -void -purple_pounces_uninit() -{ - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_pounces(); - } - - purple_signals_disconnect_by_handle(purple_pounces_get_handle()); - - g_hash_table_destroy(pounce_handlers); - pounce_handlers = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/pounce.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,380 +0,0 @@ -/** - * @file pounce.h Buddy Pounce API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_POUNCE_H_ -#define _PURPLE_POUNCE_H_ - -typedef struct _PurplePounce PurplePounce; - -#include -#include "account.h" - -/** - * Events that trigger buddy pounces. - */ -typedef enum -{ - PURPLE_POUNCE_NONE = 0x000, /**< No events. */ - PURPLE_POUNCE_SIGNON = 0x001, /**< The buddy signed on. */ - PURPLE_POUNCE_SIGNOFF = 0x002, /**< The buddy signed off. */ - PURPLE_POUNCE_AWAY = 0x004, /**< The buddy went away. */ - PURPLE_POUNCE_AWAY_RETURN = 0x008, /**< The buddy returned from away. */ - PURPLE_POUNCE_IDLE = 0x010, /**< The buddy became idle. */ - PURPLE_POUNCE_IDLE_RETURN = 0x020, /**< The buddy is no longer idle. */ - PURPLE_POUNCE_TYPING = 0x040, /**< The buddy started typing. */ - PURPLE_POUNCE_TYPED = 0x080, /**< The buddy has entered text. */ - PURPLE_POUNCE_TYPING_STOPPED = 0x100, /**< The buddy stopped typing. */ - PURPLE_POUNCE_MESSAGE_RECEIVED = 0x200 /**< The buddy sent a message */ - -} PurplePounceEvent; - -typedef enum -{ - PURPLE_POUNCE_OPTION_NONE = 0x00, /**< No Option */ - PURPLE_POUNCE_OPTION_AWAY = 0x01 /**< Pounce only when away */ -} PurplePounceOption; - -/** A pounce callback. */ -typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *); - -/** - * A buddy pounce structure. - * - * Buddy pounces are actions triggered by a buddy-related event. For - * example, a sound can be played or an IM window opened when a buddy - * signs on or returns from away. Such responses are handled in the - * UI. The events themselves are done in the core. - */ -struct _PurplePounce -{ - char *ui_type; /**< The type of UI. */ - - PurplePounceEvent events; /**< The event(s) to pounce on. */ - PurplePounceOption options; /**< The pounce options */ - PurpleAccount *pouncer; /**< The user who is pouncing. */ - - char *pouncee; /**< The buddy to pounce on. */ - - GHashTable *actions; /**< The registered actions. */ - - gboolean save; /**< Whether or not the pounce should - be saved after activation. */ - void *data; /**< Pounce-specific data. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Buddy Pounce API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new buddy pounce. - * - * @param ui_type The type of UI the pounce is for. - * @param pouncer The account that will pounce. - * @param pouncee The buddy to pounce on. - * @param event The event(s) to pounce on. - * @param option Pounce options. - * - * @return The new buddy pounce structure. - */ -PurplePounce *purple_pounce_new(const char *ui_type, PurpleAccount *pouncer, - const char *pouncee, PurplePounceEvent event, - PurplePounceOption option); - -/** - * Destroys a buddy pounce. - * - * @param pounce The buddy pounce. - */ -void purple_pounce_destroy(PurplePounce *pounce); - -/** - * Destroys all buddy pounces for the account - * - * @param account The account to remove all pounces from. - */ -void purple_pounce_destroy_all_by_account(PurpleAccount *account); - -/** - * Sets the events a pounce should watch for. - * - * @param pounce The buddy pounce. - * @param events The events to watch for. - */ -void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events); - -/** - * Sets the options for a pounce. - * - * @param pounce The buddy pounce. - * @param options The options for the pounce. - */ -void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options); - -/** - * Sets the account that will do the pouncing. - * - * @param pounce The buddy pounce. - * @param pouncer The account that will pounce. - */ -void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer); - -/** - * Sets the buddy a pounce should pounce on. - * - * @param pounce The buddy pounce. - * @param pouncee The buddy to pounce on. - */ -void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee); - -/** - * Sets whether or not the pounce should be saved after execution. - * - * @param pounce The buddy pounce. - * @param save @c TRUE if the pounce should be saved, or @c FALSE otherwise. - */ -void purple_pounce_set_save(PurplePounce *pounce, gboolean save); - -/** - * Registers an action type for the pounce. - * - * @param pounce The buddy pounce. - * @param name The action name. - */ -void purple_pounce_action_register(PurplePounce *pounce, const char *name); - -/** - * Enables or disables an action for a pounce. - * - * @param pounce The buddy pounce. - * @param action The name of the action. - * @param enabled The enabled state. - */ -void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action, - gboolean enabled); - -/** - * Sets a value for an attribute in an action. - * - * If @a value is @c NULL, the value will be unset. - * - * @param pounce The buddy pounce. - * @param action The action name. - * @param attr The attribute name. - * @param value The value. - */ -void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action, - const char *attr, const char *value); - -/** - * Sets the pounce-specific data. - * - * @param pounce The buddy pounce. - * @param data Data specific to the pounce. - */ -void purple_pounce_set_data(PurplePounce *pounce, void *data); - -/** - * Returns the events a pounce should watch for. - * - * @param pounce The buddy pounce. - * - * @return The events the pounce is watching for. - */ -PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce); - -/** - * Returns the options for a pounce. - * - * @param pounce The buddy pounce. - * - * @return The options for the pounce. - */ -PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce); - -/** - * Returns the account that will do the pouncing. - * - * @param pounce The buddy pounce. - * - * @return The account that will pounce. - */ -PurpleAccount *purple_pounce_get_pouncer(const PurplePounce *pounce); - -/** - * Returns the buddy a pounce should pounce on. - * - * @param pounce The buddy pounce. - * - * @return The buddy to pounce on. - */ -const char *purple_pounce_get_pouncee(const PurplePounce *pounce); - -/** - * Returns whether or not the pounce should save after execution. - * - * @param pounce The buddy pounce. - * - * @return @c TRUE if the pounce should be saved after execution, or - * @c FALSE otherwise. - */ -gboolean purple_pounce_get_save(const PurplePounce *pounce); - -/** - * Returns whether or not an action is enabled. - * - * @param pounce The buddy pounce. - * @param action The action name. - * - * @return @c TRUE if the action is enabled, or @c FALSE otherwise. - */ -gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce, - const char *action); - -/** - * Returns the value for an attribute in an action. - * - * @param pounce The buddy pounce. - * @param action The action name. - * @param attr The attribute name. - * - * @return The attribute value, if it exists, or @c NULL. - */ -const char *purple_pounce_action_get_attribute(const PurplePounce *pounce, - const char *action, - const char *attr); - -/** - * Returns the pounce-specific data. - * - * @param pounce The buddy pounce. - * - * @return The data specific to a buddy pounce. - */ -void *purple_pounce_get_data(const PurplePounce *pounce); - -/** - * Executes a pounce with the specified pouncer, pouncee, and event type. - * - * @param pouncer The account that will do the pouncing. - * @param pouncee The buddy that is being pounced. - * @param events The events that triggered the pounce. - */ -void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee, - PurplePounceEvent events); - -/*@}*/ - -/**************************************************************************/ -/** @name Buddy Pounce Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Finds a pounce with the specified event(s) and buddy. - * - * @param pouncer The account to match against. - * @param pouncee The buddy to match against. - * @param events The event(s) to match against. - * - * @return The pounce if found, or @c NULL otherwise. - */ -PurplePounce *purple_find_pounce(const PurpleAccount *pouncer, - const char *pouncee, PurplePounceEvent events); - - -/** - * Loads the pounces. - * - * @return @c TRUE if the pounces could be loaded. - */ -gboolean purple_pounces_load(void); - -/** - * Registers a pounce handler for a UI. - * - * @param ui The UI name. - * @param cb The callback function. - * @param new_pounce The function called when a pounce is created. - * @param free_pounce The function called when a pounce is freed. - */ -void purple_pounces_register_handler(const char *ui, PurplePounceCb cb, - void (*new_pounce)(PurplePounce *pounce), - void (*free_pounce)(PurplePounce *pounce)); - -/** - * Unregisters a pounce handle for a UI. - * - * @param ui The UI name. - */ -void purple_pounces_unregister_handler(const char *ui); - -/** - * Returns a list of all registered buddy pounces. - * - * @constreturn The list of buddy pounces. - */ -GList *purple_pounces_get_all(void); - -/** - * Returns a list of registered buddy pounces for the ui-type. - * - * @param ui The ID of the UI using the core. - * - * @return The list of buddy pounces. The list should be freed by - * the caller when it's no longer used. - * @since 2.1.0 - */ -GList *purple_pounces_get_all_for_ui(const char *ui); - -/** - * Returns the buddy pounce subsystem handle. - * - * @return The subsystem handle. - */ -void *purple_pounces_get_handle(void); - -/** - * Initializes the pounces subsystem. - */ -void purple_pounces_init(void); - -/** - * Uninitializes the pounces subsystem. - */ -void purple_pounces_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_POUNCE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1460 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include "internal.h" -#include "prefs.h" -#include "debug.h" -#include "util.h" - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -struct pref_cb { - PurplePrefCallback func; - gpointer data; - guint id; - void *handle; -}; - -/* TODO: This should use PurpleValues? */ -struct purple_pref { - PurplePrefType type; - char *name; - union { - gpointer generic; - gboolean boolean; - int integer; - char *string; - GList *stringlist; - } value; - GSList *callbacks; - struct purple_pref *parent; - struct purple_pref *sibling; - struct purple_pref *first_child; -}; - - -static struct purple_pref prefs = { - PURPLE_PREF_NONE, - NULL, - { NULL }, - NULL, - NULL, - NULL, - NULL -}; - -static GHashTable *prefs_hash = NULL; -static guint save_timer = 0; -static gboolean prefs_loaded = FALSE; - - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static struct -purple_pref *find_pref(const char *name) -{ - g_return_val_if_fail(name != NULL && name[0] == '/', NULL); - - if (name[1] == '\0') - return &prefs; - else - { - /* When we're initializing, the debug system is - * initialized before the prefs system, but debug - * calls will end up calling prefs functions, so we - * need to deal cleanly here. */ - if (prefs_hash) - return g_hash_table_lookup(prefs_hash, name); - else - return NULL; - } -} - - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -/* - * This function recursively creates the xmlnode tree from the prefs - * tree structure. Yay recursion! - */ -static void -pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref) -{ - xmlnode *node, *childnode; - struct purple_pref *child; - char buf[21]; - GList *cur; - - /* Create a new node */ - node = xmlnode_new_child(parent, "pref"); - xmlnode_set_attrib(node, "name", pref->name); - - /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */ - if (pref->type == PURPLE_PREF_INT) { - xmlnode_set_attrib(node, "type", "int"); - g_snprintf(buf, sizeof(buf), "%d", pref->value.integer); - xmlnode_set_attrib(node, "value", buf); - } - else if (pref->type == PURPLE_PREF_STRING) { - xmlnode_set_attrib(node, "type", "string"); - xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : ""); - } - else if (pref->type == PURPLE_PREF_STRING_LIST) { - xmlnode_set_attrib(node, "type", "stringlist"); - for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) - { - childnode = xmlnode_new_child(node, "item"); - xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : ""); - } - } - else if (pref->type == PURPLE_PREF_PATH) { - char *encoded = g_filename_to_utf8(pref->value.string ? pref->value.string : "", -1, NULL, NULL, NULL); - xmlnode_set_attrib(node, "type", "path"); - xmlnode_set_attrib(node, "value", encoded); - g_free(encoded); - } - else if (pref->type == PURPLE_PREF_PATH_LIST) { - xmlnode_set_attrib(node, "type", "pathlist"); - for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) - { - char *encoded = g_filename_to_utf8(cur->data ? cur->data : "", -1, NULL, NULL, NULL); - childnode = xmlnode_new_child(node, "item"); - xmlnode_set_attrib(childnode, "value", encoded); - g_free(encoded); - } - } - else if (pref->type == PURPLE_PREF_BOOLEAN) { - xmlnode_set_attrib(node, "type", "bool"); - g_snprintf(buf, sizeof(buf), "%d", pref->value.boolean); - xmlnode_set_attrib(node, "value", buf); - } - - /* All My Children */ - for (child = pref->first_child; child != NULL; child = child->sibling) - pref_to_xmlnode(node, child); -} - -static xmlnode * -prefs_to_xmlnode(void) -{ - xmlnode *node; - struct purple_pref *pref, *child; - - pref = &prefs; - - /* Create the root preference node */ - node = xmlnode_new("pref"); - xmlnode_set_attrib(node, "version", "1"); - xmlnode_set_attrib(node, "name", "/"); - - /* All My Children */ - for (child = pref->first_child; child != NULL; child = child->sibling) - pref_to_xmlnode(node, child); - - return node; -} - -static void -sync_prefs(void) -{ - xmlnode *node; - char *data; - - if (!prefs_loaded) - { - /* - * TODO: Call schedule_prefs_save()? Ideally we wouldn't need to. - * (prefs.xml should be loaded when purple_prefs_init is called) - */ - purple_debug_error("prefs", "Attempted to save prefs before " - "they were read!\n"); - return; - } - - node = prefs_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("prefs.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_prefs(); - save_timer = 0; - return FALSE; -} - -static void -schedule_prefs_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static GList *prefs_stack = NULL; - -static void -prefs_start_element_handler (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) -{ - PurplePrefType pref_type = PURPLE_PREF_NONE; - int i; - const char *pref_name = NULL, *pref_value = NULL; - GString *pref_name_full; - GList *tmp; - - if(!purple_strequal(element_name, "pref") && - !purple_strequal(element_name, "item")) - return; - - for(i = 0; attribute_names[i]; i++) { - if(purple_strequal(attribute_names[i], "name")) { - pref_name = attribute_values[i]; - } else if(purple_strequal(attribute_names[i], "type")) { - if(purple_strequal(attribute_values[i], "bool")) - pref_type = PURPLE_PREF_BOOLEAN; - else if(purple_strequal(attribute_values[i], "int")) - pref_type = PURPLE_PREF_INT; - else if(purple_strequal(attribute_values[i], "string")) - pref_type = PURPLE_PREF_STRING; - else if(purple_strequal(attribute_values[i], "stringlist")) - pref_type = PURPLE_PREF_STRING_LIST; - else if(purple_strequal(attribute_values[i], "path")) - pref_type = PURPLE_PREF_PATH; - else if(purple_strequal(attribute_values[i], "pathlist")) - pref_type = PURPLE_PREF_PATH_LIST; - else - return; - } else if(purple_strequal(attribute_names[i], "value")) { - pref_value = attribute_values[i]; - } - } - - if(purple_strequal(element_name, "item")) { - struct purple_pref *pref; - - pref_name_full = g_string_new(""); - - for(tmp = prefs_stack; tmp; tmp = tmp->next) { - pref_name_full = g_string_prepend(pref_name_full, tmp->data); - pref_name_full = g_string_prepend_c(pref_name_full, '/'); - } - - pref = find_pref(pref_name_full->str); - - if(pref) { - if(pref->type == PURPLE_PREF_STRING_LIST) { - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_strdup(pref_value)); - } else if(pref->type == PURPLE_PREF_PATH_LIST) { - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_filename_from_utf8(pref_value, -1, NULL, NULL, NULL)); - } - } - g_string_free(pref_name_full, TRUE); - } else { - char *decoded; - - if(!pref_name || purple_strequal(pref_name, "/")) - return; - - pref_name_full = g_string_new(pref_name); - - for(tmp = prefs_stack; tmp; tmp = tmp->next) { - pref_name_full = g_string_prepend_c(pref_name_full, '/'); - pref_name_full = g_string_prepend(pref_name_full, tmp->data); - } - - pref_name_full = g_string_prepend_c(pref_name_full, '/'); - - switch(pref_type) { - case PURPLE_PREF_NONE: - purple_prefs_add_none(pref_name_full->str); - break; - case PURPLE_PREF_BOOLEAN: - purple_prefs_set_bool(pref_name_full->str, atoi(pref_value)); - break; - case PURPLE_PREF_INT: - purple_prefs_set_int(pref_name_full->str, atoi(pref_value)); - break; - case PURPLE_PREF_STRING: - purple_prefs_set_string(pref_name_full->str, pref_value); - break; - case PURPLE_PREF_STRING_LIST: - purple_prefs_set_string_list(pref_name_full->str, NULL); - break; - case PURPLE_PREF_PATH: - if (pref_value) { - decoded = g_filename_from_utf8(pref_value, -1, NULL, NULL, NULL); - purple_prefs_set_path(pref_name_full->str, decoded); - g_free(decoded); - } else { - purple_prefs_set_path(pref_name_full->str, NULL); - } - break; - case PURPLE_PREF_PATH_LIST: - purple_prefs_set_path_list(pref_name_full->str, NULL); - break; - } - prefs_stack = g_list_prepend(prefs_stack, g_strdup(pref_name)); - g_string_free(pref_name_full, TRUE); - } -} - -static void -prefs_end_element_handler(GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, GError **error) -{ - if(prefs_stack && purple_strequal(element_name, "pref")) { - g_free(prefs_stack->data); - prefs_stack = g_list_delete_link(prefs_stack, prefs_stack); - } -} - -static GMarkupParser prefs_parser = { - prefs_start_element_handler, - prefs_end_element_handler, - NULL, - NULL, - NULL -}; - -gboolean -purple_prefs_load() -{ - gchar *filename = g_build_filename(purple_user_dir(), "prefs.xml", NULL); - gchar *contents = NULL; - gsize length; - GMarkupParseContext *context; - GError *error = NULL; - - if (!filename) { - prefs_loaded = TRUE; - return FALSE; - } - - purple_debug_info("prefs", "Reading %s\n", filename); - - if(!g_file_get_contents(filename, &contents, &length, &error)) { -#ifdef _WIN32 - gchar *common_appdata = wpurple_get_special_folder(CSIDL_COMMON_APPDATA); -#endif - g_free(filename); - g_error_free(error); - - error = NULL; - -#ifdef _WIN32 - filename = g_build_filename(common_appdata ? common_appdata : "", "purple", "prefs.xml", NULL); - g_free(common_appdata); -#else - filename = g_build_filename(SYSCONFDIR, "purple", "prefs.xml", NULL); -#endif - - purple_debug_info("prefs", "Reading %s\n", filename); - - if (!g_file_get_contents(filename, &contents, &length, &error)) { - purple_debug_error("prefs", "Error reading prefs: %s\n", - error->message); - g_error_free(error); - g_free(filename); - prefs_loaded = TRUE; - - return FALSE; - } - } - - context = g_markup_parse_context_new(&prefs_parser, 0, NULL, NULL); - - if(!g_markup_parse_context_parse(context, contents, length, NULL)) { - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - prefs_loaded = TRUE; - - return FALSE; - } - - if(!g_markup_parse_context_end_parse(context, NULL)) { - purple_debug_error("prefs", "Error parsing %s\n", filename); - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - prefs_loaded = TRUE; - - return FALSE; - } - - purple_debug_info("prefs", "Finished reading %s\n", filename); - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - prefs_loaded = TRUE; - - return TRUE; -} - - - -static void -prefs_save_cb(const char *name, PurplePrefType type, gconstpointer val, - gpointer user_data) -{ - - if(!prefs_loaded) - return; - - purple_debug_misc("prefs", "%s changed, scheduling save.\n", name); - - schedule_prefs_save(); -} - -static char * -get_path_dirname(const char *name) -{ - char *c, *str; - - str = g_strdup(name); - - if ((c = strrchr(str, '/')) != NULL) { - *c = '\0'; - - if (*str == '\0') { - g_free(str); - - str = g_strdup("/"); - } - } - else { - g_free(str); - - str = g_strdup("."); - } - - return str; -} - -static char * -get_path_basename(const char *name) -{ - const char *c; - - if ((c = strrchr(name, '/')) != NULL) - return g_strdup(c + 1); - - return g_strdup(name); -} - -static char * -pref_full_name(struct purple_pref *pref) -{ - GString *name; - struct purple_pref *parent; - - if(!pref) - return NULL; - - if(pref == &prefs) - return g_strdup("/"); - - name = g_string_new(pref->name); - parent = pref->parent; - - for(parent = pref->parent; parent && parent->name; parent = parent->parent) { - name = g_string_prepend_c(name, '/'); - name = g_string_prepend(name, parent->name); - } - name = g_string_prepend_c(name, '/'); - return g_string_free(name, FALSE); -} - -static struct purple_pref * -find_pref_parent(const char *name) -{ - char *parent_name = get_path_dirname(name); - struct purple_pref *ret = &prefs; - - if(!purple_strequal(parent_name, "/")) { - ret = find_pref(parent_name); - } - - g_free(parent_name); - return ret; -} - -static void -free_pref_value(struct purple_pref *pref) -{ - switch(pref->type) { - case PURPLE_PREF_BOOLEAN: - pref->value.boolean = FALSE; - break; - case PURPLE_PREF_INT: - pref->value.integer = 0; - break; - case PURPLE_PREF_STRING: - case PURPLE_PREF_PATH: - g_free(pref->value.string); - pref->value.string = NULL; - break; - case PURPLE_PREF_STRING_LIST: - case PURPLE_PREF_PATH_LIST: - { - g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); - g_list_free(pref->value.stringlist); - } break; - case PURPLE_PREF_NONE: - break; - } -} - -static struct purple_pref * -add_pref(PurplePrefType type, const char *name) -{ - struct purple_pref *parent; - struct purple_pref *me; - struct purple_pref *sibling; - char *my_name; - - parent = find_pref_parent(name); - - if(!parent) - return NULL; - - my_name = get_path_basename(name); - - for(sibling = parent->first_child; sibling; sibling = sibling->sibling) { - if(purple_strequal(sibling->name, my_name)) { - g_free(my_name); - return NULL; - } - } - - me = g_new0(struct purple_pref, 1); - me->type = type; - me->name = my_name; - - me->parent = parent; - if(parent->first_child) { - /* blatant abuse of a for loop */ - for(sibling = parent->first_child; sibling->sibling; - sibling = sibling->sibling); - sibling->sibling = me; - } else { - parent->first_child = me; - } - - g_hash_table_insert(prefs_hash, g_strdup(name), (gpointer)me); - - return me; -} - -void -purple_prefs_add_none(const char *name) -{ - add_pref(PURPLE_PREF_NONE, name); -} - -void -purple_prefs_add_bool(const char *name, gboolean value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_BOOLEAN, name); - - if(!pref) - return; - - pref->value.boolean = value; -} - -void -purple_prefs_add_int(const char *name, int value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_INT, name); - - if(!pref) - return; - - pref->value.integer = value; -} - -void -purple_prefs_add_string(const char *name, const char *value) -{ - struct purple_pref *pref; - - if(value != NULL && !g_utf8_validate(value, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_add_string: Cannot store invalid UTF8 for string pref %s\n", name); - return; - } - - pref = add_pref(PURPLE_PREF_STRING, name); - - if(!pref) - return; - - pref->value.string = g_strdup(value); -} - -void -purple_prefs_add_string_list(const char *name, GList *value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_STRING_LIST, name); - GList *tmp; - - if(!pref) - return; - - for(tmp = value; tmp; tmp = tmp->next) { - if(tmp->data != NULL && !g_utf8_validate(tmp->data, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_add_string_list: Skipping invalid UTF8 for string list pref %s\n", name); - continue; - } - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_strdup(tmp->data)); - } -} - -void -purple_prefs_add_path(const char *name, const char *value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_PATH, name); - - if(!pref) - return; - - pref->value.string = g_strdup(value); -} - -void -purple_prefs_add_path_list(const char *name, GList *value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_PATH_LIST, name); - GList *tmp; - - if(!pref) - return; - - for(tmp = value; tmp; tmp = tmp->next) - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_strdup(tmp->data)); -} - - -static void -remove_pref(struct purple_pref *pref) -{ - char *name; - GSList *l; - - if(!pref) - return; - - while(pref->first_child) - remove_pref(pref->first_child); - - if(pref == &prefs) - return; - - if(pref->parent->first_child == pref) { - pref->parent->first_child = pref->sibling; - } else { - struct purple_pref *sib = pref->parent->first_child; - while(sib && sib->sibling != pref) - sib = sib->sibling; - if(sib) - sib->sibling = pref->sibling; - } - - name = pref_full_name(pref); - - if (prefs_loaded) - purple_debug_info("prefs", "removing pref %s\n", name); - - g_hash_table_remove(prefs_hash, name); - g_free(name); - - free_pref_value(pref); - - while((l = pref->callbacks) != NULL) { - pref->callbacks = pref->callbacks->next; - g_free(l->data); - g_slist_free_1(l); - } - g_free(pref->name); - g_free(pref); -} - -void -purple_prefs_remove(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) - return; - - remove_pref(pref); -} - -void -purple_prefs_destroy() -{ - purple_prefs_remove("/"); -} - -static void -do_callbacks(const char* name, struct purple_pref *pref) -{ - GSList *cbs; - struct purple_pref *cb_pref; - for(cb_pref = pref; cb_pref; cb_pref = cb_pref->parent) { - for(cbs = cb_pref->callbacks; cbs; cbs = cbs->next) { - struct pref_cb *cb = cbs->data; - cb->func(name, pref->type, pref->value.generic, cb->data); - } - } -} - -void -purple_prefs_trigger_callback(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_trigger_callback: Unknown pref %s\n", name); - return; - } - - do_callbacks(name, pref); -} - -void -purple_prefs_set_generic(const char *name, gpointer value) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_set_generic: Unknown pref %s\n", name); - return; - } - - pref->value.generic = value; - do_callbacks(name, pref); -} - -void -purple_prefs_set_bool(const char *name, gboolean value) -{ - struct purple_pref *pref = find_pref(name); - - if(pref) { - if(pref->type != PURPLE_PREF_BOOLEAN) { - purple_debug_error("prefs", - "purple_prefs_set_bool: %s not a boolean pref\n", name); - return; - } - - if(pref->value.boolean != value) { - pref->value.boolean = value; - do_callbacks(name, pref); - } - } else { - purple_prefs_add_bool(name, value); - } -} - -void -purple_prefs_set_int(const char *name, int value) -{ - struct purple_pref *pref = find_pref(name); - - if(pref) { - if(pref->type != PURPLE_PREF_INT) { - purple_debug_error("prefs", - "purple_prefs_set_int: %s not an integer pref\n", name); - return; - } - - if(pref->value.integer != value) { - pref->value.integer = value; - do_callbacks(name, pref); - } - } else { - purple_prefs_add_int(name, value); - } -} - -void -purple_prefs_set_string(const char *name, const char *value) -{ - struct purple_pref *pref = find_pref(name); - - if(value != NULL && !g_utf8_validate(value, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_set_string: Cannot store invalid UTF8 for string pref %s\n", name); - return; - } - - if(pref) { - if(pref->type != PURPLE_PREF_STRING && pref->type != PURPLE_PREF_PATH) { - purple_debug_error("prefs", - "purple_prefs_set_string: %s not a string pref\n", name); - return; - } - - if (!purple_strequal(pref->value.string, value)) { - g_free(pref->value.string); - pref->value.string = g_strdup(value); - do_callbacks(name, pref); - } - } else { - purple_prefs_add_string(name, value); - } -} - -void -purple_prefs_set_string_list(const char *name, GList *value) -{ - struct purple_pref *pref = find_pref(name); - if(pref) { - GList *tmp; - - if(pref->type != PURPLE_PREF_STRING_LIST) { - purple_debug_error("prefs", - "purple_prefs_set_string_list: %s not a string list pref\n", - name); - return; - } - - g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); - g_list_free(pref->value.stringlist); - pref->value.stringlist = NULL; - - for(tmp = value; tmp; tmp = tmp->next) { - if(tmp->data != NULL && !g_utf8_validate(tmp->data, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_set_string_list: Skipping invalid UTF8 for string list pref %s\n", name); - continue; - } - pref->value.stringlist = g_list_prepend(pref->value.stringlist, - g_strdup(tmp->data)); - } - pref->value.stringlist = g_list_reverse(pref->value.stringlist); - - do_callbacks(name, pref); - - } else { - purple_prefs_add_string_list(name, value); - } -} - -void -purple_prefs_set_path(const char *name, const char *value) -{ - struct purple_pref *pref = find_pref(name); - - if(pref) { - if(pref->type != PURPLE_PREF_PATH) { - purple_debug_error("prefs", - "purple_prefs_set_path: %s not a path pref\n", name); - return; - } - - if (!purple_strequal(pref->value.string, value)) { - g_free(pref->value.string); - pref->value.string = g_strdup(value); - do_callbacks(name, pref); - } - } else { - purple_prefs_add_path(name, value); - } -} - -void -purple_prefs_set_path_list(const char *name, GList *value) -{ - struct purple_pref *pref = find_pref(name); - if(pref) { - GList *tmp; - - if(pref->type != PURPLE_PREF_PATH_LIST) { - purple_debug_error("prefs", - "purple_prefs_set_path_list: %s not a path list pref\n", - name); - return; - } - - g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); - g_list_free(pref->value.stringlist); - pref->value.stringlist = NULL; - - for(tmp = value; tmp; tmp = tmp->next) - pref->value.stringlist = g_list_prepend(pref->value.stringlist, - g_strdup(tmp->data)); - pref->value.stringlist = g_list_reverse(pref->value.stringlist); - - do_callbacks(name, pref); - - } else { - purple_prefs_add_path_list(name, value); - } -} - - -gboolean -purple_prefs_exists(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if (pref != NULL) - return TRUE; - - return FALSE; -} - -PurplePrefType -purple_prefs_get_type(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if (pref == NULL) - return PURPLE_PREF_NONE; - - return (pref->type); -} - -gboolean -purple_prefs_get_bool(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_bool: Unknown pref %s\n", name); - return FALSE; - } else if(pref->type != PURPLE_PREF_BOOLEAN) { - purple_debug_error("prefs", - "purple_prefs_get_bool: %s not a boolean pref\n", name); - return FALSE; - } - - return pref->value.boolean; -} - -int -purple_prefs_get_int(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_int: Unknown pref %s\n", name); - return 0; - } else if(pref->type != PURPLE_PREF_INT) { - purple_debug_error("prefs", - "purple_prefs_get_int: %s not an integer pref\n", name); - return 0; - } - - return pref->value.integer; -} - -const char * -purple_prefs_get_string(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_string: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_STRING) { - purple_debug_error("prefs", - "purple_prefs_get_string: %s not a string pref\n", name); - return NULL; - } - - return pref->value.string; -} - -GList * -purple_prefs_get_string_list(const char *name) -{ - struct purple_pref *pref = find_pref(name); - GList *ret = NULL, *tmp; - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_string_list: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_STRING_LIST) { - purple_debug_error("prefs", - "purple_prefs_get_string_list: %s not a string list pref\n", name); - return NULL; - } - - for(tmp = pref->value.stringlist; tmp; tmp = tmp->next) - ret = g_list_prepend(ret, g_strdup(tmp->data)); - ret = g_list_reverse(ret); - - return ret; -} - -const char * -purple_prefs_get_path(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_path: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_PATH) { - purple_debug_error("prefs", - "purple_prefs_get_path: %s not a path pref\n", name); - return NULL; - } - - return pref->value.string; -} - -GList * -purple_prefs_get_path_list(const char *name) -{ - struct purple_pref *pref = find_pref(name); - GList *ret = NULL, *tmp; - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_path_list: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_PATH_LIST) { - purple_debug_error("prefs", - "purple_prefs_get_path_list: %s not a path list pref\n", name); - return NULL; - } - - for(tmp = pref->value.stringlist; tmp; tmp = tmp->next) - ret = g_list_prepend(ret, g_strdup(tmp->data)); - ret = g_list_reverse(ret); - - return ret; -} - -static void -purple_prefs_rename_node(struct purple_pref *oldpref, struct purple_pref *newpref) -{ - struct purple_pref *child, *next; - char *oldname, *newname; - - /* if we're a parent, rename the kids first */ - for(child = oldpref->first_child; child != NULL; child = next) - { - struct purple_pref *newchild; - next = child->sibling; - for(newchild = newpref->first_child; newchild != NULL; newchild = newchild->sibling) - { - if(purple_strequal(child->name, newchild->name)) - { - purple_prefs_rename_node(child, newchild); - break; - } - } - if(newchild == NULL) { - /* no rename happened, we weren't able to find the new pref */ - char *tmpname = pref_full_name(child); - purple_debug_error("prefs", "Unable to find rename pref for %s\n", tmpname); - g_free(tmpname); - } - } - - oldname = pref_full_name(oldpref); - newname = pref_full_name(newpref); - - if (oldpref->type != newpref->type) - { - purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); - g_free(oldname); - g_free(newname); - return; - } - - purple_debug_info("prefs", "Renaming %s to %s\n", oldname, newname); - g_free(oldname); - - switch(oldpref->type) { - case PURPLE_PREF_NONE: - break; - case PURPLE_PREF_BOOLEAN: - purple_prefs_set_bool(newname, oldpref->value.boolean); - break; - case PURPLE_PREF_INT: - purple_prefs_set_int(newname, oldpref->value.integer); - break; - case PURPLE_PREF_STRING: - purple_prefs_set_string(newname, oldpref->value.string); - break; - case PURPLE_PREF_STRING_LIST: - purple_prefs_set_string_list(newname, oldpref->value.stringlist); - break; - case PURPLE_PREF_PATH: - purple_prefs_set_path(newname, oldpref->value.string); - break; - case PURPLE_PREF_PATH_LIST: - purple_prefs_set_path_list(newname, oldpref->value.stringlist); - break; - } - g_free(newname); - - remove_pref(oldpref); -} - -void -purple_prefs_rename(const char *oldname, const char *newname) -{ - struct purple_pref *oldpref, *newpref; - - oldpref = find_pref(oldname); - - /* it's already been renamed, call off the dogs */ - if(!oldpref) - return; - - newpref = find_pref(newname); - - if (newpref == NULL) - { - purple_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); - return; - } - - purple_prefs_rename_node(oldpref, newpref); -} - -void -purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname) -{ - struct purple_pref *oldpref, *newpref; - - oldpref = find_pref(oldname); - - /* it's already been renamed, call off the cats */ - if(!oldpref) - return; - - if (oldpref->type != PURPLE_PREF_BOOLEAN) - { - purple_debug_error("prefs", "Unable to rename %s to %s: old pref not a boolean\n", oldname, newname); - return; - } - - if (oldpref->first_child != NULL) /* can't rename parents */ - { - purple_debug_error("prefs", "Unable to rename %s to %s: can't rename parents\n", oldname, newname); - return; - } - - - newpref = find_pref(newname); - - if (newpref == NULL) - { - purple_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); - return; - } - - if (oldpref->type != newpref->type) - { - purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); - return; - } - - purple_debug_info("prefs", "Renaming and toggling %s to %s\n", oldname, newname); - purple_prefs_set_bool(newname, !(oldpref->value.boolean)); - - remove_pref(oldpref); -} - -guint -purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback func, gpointer data) -{ - struct purple_pref *pref; - struct pref_cb *cb; - static guint cb_id = 0; - - g_return_val_if_fail(name != NULL, 0); - g_return_val_if_fail(func != NULL, 0); - - pref = find_pref(name); - if (pref == NULL) { - purple_debug_error("prefs", "purple_prefs_connect_callback: Unknown pref %s\n", name); - return 0; - } - - cb = g_new0(struct pref_cb, 1); - - cb->func = func; - cb->data = data; - cb->id = ++cb_id; - cb->handle = handle; - - pref->callbacks = g_slist_append(pref->callbacks, cb); - - return cb->id; -} - -static gboolean -disco_callback_helper(struct purple_pref *pref, guint callback_id) -{ - GSList *cbs; - struct purple_pref *child; - - if(!pref) - return FALSE; - - for(cbs = pref->callbacks; cbs; cbs = cbs->next) { - struct pref_cb *cb = cbs->data; - if(cb->id == callback_id) { - pref->callbacks = g_slist_delete_link(pref->callbacks, cbs); - g_free(cb); - return TRUE; - } - } - - for(child = pref->first_child; child; child = child->sibling) { - if(disco_callback_helper(child, callback_id)) - return TRUE; - } - - return FALSE; -} - -void -purple_prefs_disconnect_callback(guint callback_id) -{ - disco_callback_helper(&prefs, callback_id); -} - -static void -disco_callback_helper_handle(struct purple_pref *pref, void *handle) -{ - GSList *cbs; - struct purple_pref *child; - - if(!pref) - return; - - cbs = pref->callbacks; - while (cbs != NULL) { - struct pref_cb *cb = cbs->data; - if(cb->handle == handle) { - pref->callbacks = g_slist_delete_link(pref->callbacks, cbs); - g_free(cb); - cbs = pref->callbacks; - } else - cbs = cbs->next; - } - - for(child = pref->first_child; child; child = child->sibling) - disco_callback_helper_handle(child, handle); -} - -void -purple_prefs_disconnect_by_handle(void *handle) -{ - g_return_if_fail(handle != NULL); - - disco_callback_helper_handle(&prefs, handle); -} - -GList * -purple_prefs_get_children_names(const char *name) -{ - GList * list = NULL; - struct purple_pref *pref = find_pref(name), *child; - char sep[2] = "\0\0";; - - if (pref == NULL) - return NULL; - - if (name[strlen(name) - 1] != '/') - sep[0] = '/'; - for (child = pref->first_child; child; child = child->sibling) { - list = g_list_append(list, g_strdup_printf("%s%s%s", name, sep, child->name)); - } - return list; -} - -void -purple_prefs_update_old() -{ - purple_prefs_rename("/core", "/purple"); - - /* Remove some no-longer-used prefs */ - purple_prefs_remove("/purple/away/auto_response/enabled"); - purple_prefs_remove("/purple/away/auto_response/idle_only"); - purple_prefs_remove("/purple/away/auto_response/in_active_conv"); - purple_prefs_remove("/purple/away/auto_response/sec_before_resend"); - purple_prefs_remove("/purple/away/auto_response"); - purple_prefs_remove("/purple/away/default_message"); - purple_prefs_remove("/purple/buddies/use_server_alias"); - purple_prefs_remove("/purple/conversations/away_back_on_send"); - purple_prefs_remove("/purple/conversations/send_urls_as_links"); - purple_prefs_remove("/purple/conversations/im/show_login"); - purple_prefs_remove("/purple/conversations/chat/show_join"); - purple_prefs_remove("/purple/conversations/chat/show_leave"); - purple_prefs_remove("/purple/conversations/combine_chat_im"); - purple_prefs_remove("/purple/conversations/use_alias_for_title"); - purple_prefs_remove("/purple/logging/log_signon_signoff"); - purple_prefs_remove("/purple/logging/log_idle_state"); - purple_prefs_remove("/purple/logging/log_away_state"); - purple_prefs_remove("/purple/logging/log_own_states"); - purple_prefs_remove("/purple/status/scores/hidden"); - purple_prefs_remove("/plugins/core/autorecon/hide_connected_error"); - purple_prefs_remove("/plugins/core/autorecon/hide_connecting_error"); - purple_prefs_remove("/plugins/core/autorecon/hide_reconnecting_dialog"); - purple_prefs_remove("/plugins/core/autorecon/restore_state"); - purple_prefs_remove("/plugins/core/autorecon"); - - /* Convert old sounds while_away pref to new 3-way pref. */ - if (purple_prefs_exists("/purple/sound/while_away") && - purple_prefs_get_bool("/purple/sound/while_away")) - { - purple_prefs_set_int("/purple/sound/while_status", 3); - } - purple_prefs_remove("/purple/sound/while_away"); -} - -void * -purple_prefs_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_prefs_init(void) -{ - void *handle = purple_prefs_get_handle(); - - prefs_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - purple_prefs_connect_callback(handle, "/", prefs_save_cb, NULL); - - purple_prefs_add_none("/purple"); - purple_prefs_add_none("/plugins"); - purple_prefs_add_none("/plugins/core"); - purple_prefs_add_none("/plugins/lopl"); - purple_prefs_add_none("/plugins/prpl"); - - /* Away */ - purple_prefs_add_none("/purple/away"); - purple_prefs_add_string("/purple/away/idle_reporting", "system"); - purple_prefs_add_bool("/purple/away/away_when_idle", TRUE); - purple_prefs_add_int("/purple/away/mins_before_away", 5); - - /* Away -> Auto-Reply */ - if (!purple_prefs_exists("/purple/away/auto_response/enabled") || - !purple_prefs_exists("/purple/away/auto_response/idle_only")) - { - purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); - } - else - { - if (!purple_prefs_get_bool("/purple/away/auto_response/enabled")) - { - purple_prefs_add_string("/purple/away/auto_reply", "never"); - } - else - { - if (purple_prefs_get_bool("/purple/away/auto_response/idle_only")) - { - purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); - } - else - { - purple_prefs_add_string("/purple/away/auto_reply", "away"); - } - } - } - - /* Buddies */ - purple_prefs_add_none("/purple/buddies"); - - /* Contact Priority Settings */ - purple_prefs_add_none("/purple/contact"); - purple_prefs_add_bool("/purple/contact/last_match", FALSE); - purple_prefs_remove("/purple/contact/offline_score"); - purple_prefs_remove("/purple/contact/away_score"); - purple_prefs_remove("/purple/contact/idle_score"); - - purple_prefs_load(); - purple_prefs_update_old(); -} - -void -purple_prefs_uninit() -{ - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_prefs(); - } - - purple_prefs_disconnect_by_handle(purple_prefs_get_handle()); - - prefs_loaded = FALSE; - purple_prefs_destroy(); - g_hash_table_destroy(prefs_hash); - prefs_hash = NULL; - -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prefs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,362 +0,0 @@ -/** - * @file prefs.h Prefs API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _PURPLE_PREFS_H_ -#define _PURPLE_PREFS_H_ - -#include - -/** - * Preference data types. - */ -typedef enum _PurplePrefType -{ - PURPLE_PREF_NONE, /**< No type. */ - PURPLE_PREF_BOOLEAN, /**< Boolean. */ - PURPLE_PREF_INT, /**< Integer. */ - PURPLE_PREF_STRING, /**< String. */ - PURPLE_PREF_STRING_LIST, /**< List of strings. */ - PURPLE_PREF_PATH, /**< Path. */ - PURPLE_PREF_PATH_LIST /**< List of paths. */ - -} PurplePrefType; - -/** - * The type of callbacks for preference changes. - * - * @param name the name of the preference which has changed. - * @param type the type of the preferenced named @a name - * @param val the new value of the preferencs; should be cast to the correct - * type. For instance, to recover the value of a #PURPLE_PREF_INT - * preference, use GPOINTER_TO_INT(val). Alternatively, - * just call purple_prefs_get_int(), purple_prefs_get_string_list() - * etc. - * @param data Arbitrary data specified when the callback was connected with - * purple_prefs_connect_callback(). - * - * @see purple_prefs_connect_callback() - */ -typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type, - gconstpointer val, gpointer data); - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Prefs API - Preferences are named according to a directory-like structure. - Example: "/plugins/core/potato/is_from_idaho" (probably a boolean) */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the prefs subsystem handle. - * - * @return The prefs subsystem handle. - */ -void *purple_prefs_get_handle(void); - -/** - * Initialize core prefs - */ -void purple_prefs_init(void); - -/** - * Uninitializes the prefs subsystem. - */ -void purple_prefs_uninit(void); - -/** - * Add a new typeless pref. - * - * @param name The name of the pref - */ -void purple_prefs_add_none(const char *name); - -/** - * Add a new boolean pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_bool(const char *name, gboolean value); - -/** - * Add a new integer pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_int(const char *name, int value); - -/** - * Add a new string pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_string(const char *name, const char *value); - -/** - * Add a new string list pref. - * - * @param name The name of the pref - * @param value The initial value to set - * @note This function takes a copy of the strings in the value list. The list - * itself and original copies of the strings are up to the caller to - * free. - */ -void purple_prefs_add_string_list(const char *name, GList *value); - -/** - * Add a new path pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_path(const char *name, const char *value); - -/** - * Add a new path list pref. - * - * @param name The name of the pref - * @param value The initial value to set - * @note This function takes a copy of the strings in the value list. The list - * itself and original copies of the strings are up to the caller to - * free. - */ -void purple_prefs_add_path_list(const char *name, GList *value); - - -/** - * Remove a pref. - * - * @param name The name of the pref - */ -void purple_prefs_remove(const char *name); - -/** - * Rename a pref - * - * @param oldname The old name of the pref - * @param newname The new name for the pref - */ -void purple_prefs_rename(const char *oldname, const char *newname); - -/** - * Rename a boolean pref, toggling it's value - * - * @param oldname The old name of the pref - * @param newname The new name for the pref - */ -void purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname); - -/** - * Remove all prefs. - */ -void purple_prefs_destroy(void); - -/** - * Set raw pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_generic(const char *name, gpointer value); - -/** - * Set boolean pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_bool(const char *name, gboolean value); - -/** - * Set integer pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_int(const char *name, int value); - -/** - * Set string pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_string(const char *name, const char *value); - -/** - * Set string list pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_string_list(const char *name, GList *value); - -/** - * Set path pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_path(const char *name, const char *value); - -/** - * Set path list pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_path_list(const char *name, GList *value); - - -/** - * Check if a pref exists - * - * @param name The name of the pref - * @return TRUE if the pref exists. Otherwise FALSE. - */ -gboolean purple_prefs_exists(const char *name); - -/** - * Get pref type - * - * @param name The name of the pref - * @return The type of the pref - */ -PurplePrefType purple_prefs_get_type(const char *name); - -/** - * Get boolean pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -gboolean purple_prefs_get_bool(const char *name); - -/** - * Get integer pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -int purple_prefs_get_int(const char *name); - -/** - * Get string pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -const char *purple_prefs_get_string(const char *name); - -/** - * Get string list pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -GList *purple_prefs_get_string_list(const char *name); - -/** - * Get path pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -const char *purple_prefs_get_path(const char *name); - -/** - * Get path list pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -GList *purple_prefs_get_path_list(const char *name); - -/** - * Returns a list of children for a pref - * - * @param name The parent pref - * @return A list of newly allocated strings denoting the names of the children. - * Returns @c NULL if there are no children or if pref doesn't exist. - * The caller must free all the strings and the list. - * - * @since 2.1.0 - */ -GList *purple_prefs_get_children_names(const char *name); - -/** - * Add a callback to a pref (and its children) - * - * @param handle The handle of the receiver. - * @param name The name of the preference - * @param cb The callback function - * @param data The data to pass to the callback function. - * - * @return An id to disconnect the callback - * - * @see purple_prefs_disconnect_callback - */ -guint purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback cb, - gpointer data); - -/** - * Remove a callback to a pref - */ -void purple_prefs_disconnect_callback(guint callback_id); - -/** - * Remove all pref callbacks by handle - */ -void purple_prefs_disconnect_by_handle(void *handle); - -/** - * Trigger callbacks as if the pref changed - */ -void purple_prefs_trigger_callback(const char *name); - -/** - * Read preferences - */ -gboolean purple_prefs_load(void); - -/** - * Rename legacy prefs and delete some that no longer exist. - */ -void purple_prefs_update_old(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PREFS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,411 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "account.h" -#include "privacy.h" -#include "server.h" -#include "util.h" - -static PurplePrivacyUiOps *privacy_ops = NULL; - -gboolean -purple_privacy_permit_add(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - char *name; - PurpleBuddy *buddy; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - name = g_strdup(purple_normalize(account, who)); - - for (l = account->permit; l != NULL; l = l->next) { - if (g_str_equal(name, l->data)) - /* This buddy already exists */ - break; - } - - if (l != NULL) - { - /* This buddy already exists, so bail out */ - g_free(name); - return FALSE; - } - - account->permit = g_slist_append(account->permit, name); - - if (!local_only && purple_account_is_connected(account)) - serv_add_permit(purple_account_get_connection(account), who); - - if (privacy_ops != NULL && privacy_ops->permit_added != NULL) - privacy_ops->permit_added(account, who); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - /* This lets the UI know a buddy has had its privacy setting changed */ - buddy = purple_find_buddy(account, name); - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - return TRUE; -} - -gboolean -purple_privacy_permit_remove(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - const char *name; - PurpleBuddy *buddy; - char *del; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - name = purple_normalize(account, who); - - for (l = account->permit; l != NULL; l = l->next) { - if (g_str_equal(name, l->data)) - /* We found the buddy we were looking for */ - break; - } - - if (l == NULL) - /* We didn't find the buddy we were looking for, so bail out */ - return FALSE; - - /* We should not free l->data just yet. There can be occasions where - * l->data == who. In such cases, freeing l->data here can cause crashes - * later when who is used. */ - del = l->data; - account->permit = g_slist_delete_link(account->permit, l); - - if (!local_only && purple_account_is_connected(account)) - serv_rem_permit(purple_account_get_connection(account), who); - - if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) - privacy_ops->permit_removed(account, who); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - buddy = purple_find_buddy(account, name); - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - g_free(del); - return TRUE; -} - -gboolean -purple_privacy_deny_add(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - char *name; - PurpleBuddy *buddy; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - name = g_strdup(purple_normalize(account, who)); - - for (l = account->deny; l != NULL; l = l->next) { - if (g_str_equal(name, l->data)) - /* This buddy already exists */ - break; - } - - if (l != NULL) - { - /* This buddy already exists, so bail out */ - g_free(name); - return FALSE; - } - - account->deny = g_slist_append(account->deny, name); - - if (!local_only && purple_account_is_connected(account)) - serv_add_deny(purple_account_get_connection(account), who); - - if (privacy_ops != NULL && privacy_ops->deny_added != NULL) - privacy_ops->deny_added(account, who); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - buddy = purple_find_buddy(account, name); - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - return TRUE; -} - -gboolean -purple_privacy_deny_remove(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - const char *normalized; - char *name; - PurpleBuddy *buddy; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - normalized = purple_normalize(account, who); - - for (l = account->deny; l != NULL; l = l->next) { - if (g_str_equal(normalized, l->data)) - /* We found the buddy we were looking for */ - break; - } - - if (l == NULL) - /* We didn't find the buddy we were looking for, so bail out */ - return FALSE; - - buddy = purple_find_buddy(account, normalized); - - name = l->data; - account->deny = g_slist_delete_link(account->deny, l); - - if (!local_only && purple_account_is_connected(account)) - serv_rem_deny(purple_account_get_connection(account), name); - - if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) - privacy_ops->deny_removed(account, who); - - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - - g_free(name); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - return TRUE; -} - -/** - * This makes sure your permit list contains all buddies from your - * buddy list and ONLY buddies from your buddy list. - */ -static void -add_all_buddies_to_permit_list(PurpleAccount *account, gboolean local) -{ - GSList *list; - - /* Remove anyone in the permit list who is not in the buddylist */ - for (list = account->permit; list != NULL; ) { - char *person = list->data; - list = list->next; - if (!purple_find_buddy(account, person)) - purple_privacy_permit_remove(account, person, local); - } - - /* Now make sure everyone in the buddylist is in the permit list */ - list = purple_find_buddies(account, NULL); - while (list != NULL) - { - PurpleBuddy *buddy = list->data; - const gchar *name = purple_buddy_get_name(buddy); - - if (!g_slist_find_custom(account->permit, name, (GCompareFunc)g_utf8_collate)) - purple_privacy_permit_add(account, name, local); - list = g_slist_delete_link(list, list); - } -} - -/* - * TODO: All callers of this function pass in FALSE for local and - * restore and I don't understand when you would ever want to - * use TRUE for either of them. I think both parameters could - * safely be removed in the next major version bump. - */ -void -purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, - gboolean restore) -{ - GSList *list; - PurplePrivacyType type = account->perm_deny; - - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - return; - case PURPLE_PRIVACY_ALLOW_USERS: - purple_privacy_permit_add(account, who, local); - break; - case PURPLE_PRIVACY_DENY_USERS: - purple_privacy_deny_remove(account, who, local); - break; - case PURPLE_PRIVACY_DENY_ALL: - if (!restore) { - /* Empty the allow-list. */ - const char *norm = purple_normalize(account, who); - for (list = account->permit; list != NULL;) { - char *person = list->data; - list = list->next; - if (!purple_strequal(norm, person)) - purple_privacy_permit_remove(account, person, local); - } - } - purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - if (!purple_find_buddy(account, who)) { - add_all_buddies_to_permit_list(account, local); - purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } - break; - default: - g_return_if_reached(); - } - - /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) - serv_set_permit_deny(purple_account_get_connection(account)); -} - -/* - * TODO: All callers of this function pass in FALSE for local and - * restore and I don't understand when you would ever want to - * use TRUE for either of them. I think both parameters could - * safely be removed in the next major version bump. - */ -void -purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, - gboolean restore) -{ - GSList *list; - PurplePrivacyType type = account->perm_deny; - - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - if (!restore) { - /* Empty the deny-list. */ - const char *norm = purple_normalize(account, who); - for (list = account->deny; list != NULL; ) { - char *person = list->data; - list = list->next; - if (!purple_strequal(norm, person)) - purple_privacy_deny_remove(account, person, local); - } - } - purple_privacy_deny_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - break; - case PURPLE_PRIVACY_ALLOW_USERS: - purple_privacy_permit_remove(account, who, local); - break; - case PURPLE_PRIVACY_DENY_USERS: - purple_privacy_deny_add(account, who, local); - break; - case PURPLE_PRIVACY_DENY_ALL: - break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - if (purple_find_buddy(account, who)) { - add_all_buddies_to_permit_list(account, local); - purple_privacy_permit_remove(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } - break; - default: - g_return_if_reached(); - } - - /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) - serv_set_permit_deny(purple_account_get_connection(account)); -} - -gboolean -purple_privacy_check(PurpleAccount *account, const char *who) -{ - GSList *list; - - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - return TRUE; - - case PURPLE_PRIVACY_DENY_ALL: - return FALSE; - - case PURPLE_PRIVACY_ALLOW_USERS: - who = purple_normalize(account, who); - for (list=account->permit; list!=NULL; list=list->next) { - if (g_str_equal(who, list->data)) - return TRUE; - } - return FALSE; - - case PURPLE_PRIVACY_DENY_USERS: - who = purple_normalize(account, who); - for (list=account->deny; list!=NULL; list=list->next) { - if (g_str_equal(who, list->data)) - return FALSE; - } - return TRUE; - - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - return (purple_find_buddy(account, who) != NULL); - - default: - g_return_val_if_reached(TRUE); - } -} - -void -purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops) -{ - privacy_ops = ops; -} - -PurplePrivacyUiOps * -purple_privacy_get_ui_ops(void) -{ - return privacy_ops; -} - -void -purple_privacy_init(void) -{ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/privacy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/** - * @file privacy.h Privacy API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_PRIVACY_H_ -#define _PURPLE_PRIVACY_H_ - -/** - * Privacy data types. - */ -typedef enum _PurplePrivacyType -{ - PURPLE_PRIVACY_ALLOW_ALL = 1, - PURPLE_PRIVACY_DENY_ALL, - PURPLE_PRIVACY_ALLOW_USERS, - PURPLE_PRIVACY_DENY_USERS, - PURPLE_PRIVACY_ALLOW_BUDDYLIST -} PurplePrivacyType; - -#include "account.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Privacy core/UI operations. - */ -typedef struct -{ - void (*permit_added)(PurpleAccount *account, const char *name); - void (*permit_removed)(PurpleAccount *account, const char *name); - void (*deny_added)(PurpleAccount *account, const char *name); - void (*deny_removed)(PurpleAccount *account, const char *name); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurplePrivacyUiOps; - -/** - * Adds a user to the account's permit list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was added successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_permit_add(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Removes a user from the account's permit list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was removed successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_permit_remove(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Adds a user to the account's deny list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was added successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_deny_add(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Removes a user from the account's deny list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was removed successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_deny_remove(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Allow a user to send messages. If current privacy setting for the account is: - * PURPLE_PRIVACY_ALLOW_USERS: The user is added to the allow-list. - * PURPLE_PRIVACY_DENY_USERS : The user is removed from the deny-list. - * PURPLE_PRIVACY_ALLOW_ALL : No changes made. - * PURPLE_PRIVACY_DENY_ALL : The privacy setting is changed to - * PURPLE_PRIVACY_ALLOW_USERS and the user - * is added to the allow-list. - * PURPLE_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is already in - * the buddy-list. Otherwise the setting is - * changed to PURPLE_PRIVACY_ALLOW_USERS, all the - * buddies are added to the allow-list, and the - * user is also added to the allow-list. - * - * @param account The account. - * @param who The name of the user. - * @param local Whether the change is local-only. - * @param restore Should the previous allow/deny list be restored if the - * privacy setting is changed. - */ -void purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, - gboolean restore); - -/** - * Block messages from a user. If current privacy setting for the account is: - * PURPLE_PRIVACY_ALLOW_USERS: The user is removed from the allow-list. - * PURPLE_PRIVACY_DENY_USERS : The user is added to the deny-list. - * PURPLE_PRIVACY_DENY_ALL : No changes made. - * PURPLE_PRIVACY_ALLOW_ALL : The privacy setting is changed to - * PURPLE_PRIVACY_DENY_USERS and the user is - * added to the deny-list. - * PURPLE_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the buddy-list, - * then no changes made. Otherwise, the setting - * is changed to PURPLE_PRIVACY_ALLOW_USERS, all - * the buddies are added to the allow-list, and - * this user is removed from the list. - * - * @param account The account. - * @param who The name of the user. - * @param local Whether the change is local-only. - * @param restore Should the previous allow/deny list be restored if the - * privacy setting is changed. - */ -void purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, - gboolean restore); - -/** - * Check the privacy-setting for a user. - * - * @param account The account. - * @param who The name of the user. - * - * @return @c FALSE if the specified account's privacy settings block the user or @c TRUE otherwise. The meaning of "block" is protocol-dependent and generally relates to status and/or sending of messages. - */ -gboolean purple_privacy_check(PurpleAccount *account, const char *who); - -/** - * Sets the UI operations structure for the privacy subsystem. - * - * @param ops The UI operations structure. - */ -void purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops); - -/** - * Returns the UI operations structure for the privacy subsystem. - * - * @return The UI operations structure. - */ -PurplePrivacyUiOps *purple_privacy_get_ui_ops(void); - -/** - * Initializes the privacy subsystem. - */ -void purple_privacy_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PRIVACY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,728 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include -#ifndef _WIN32 -#include -#else -#define UNICODE -#include -#include -#include -#include "dns_sd_proxy.h" -#endif - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "debug.h" -#include "util.h" -#include "version.h" - -#include "bonjour.h" -#include "mdns_common.h" -#include "jabber.h" -#include "buddy.h" -#include "bonjour_ft.h" - -static char *default_firstname; -static char *default_lastname; -static char *default_hostname; - -static void -bonjour_removeallfromlocal(PurpleConnection *conn, PurpleGroup *bonjour_group) -{ - PurpleAccount *account = purple_connection_get_account(conn); - PurpleBlistNode *cnode, *cnodenext, *bnode, *bnodenext; - PurpleBuddy *buddy; - - if (bonjour_group == NULL) - return; - - /* Go through and remove all buddies that belong to this account */ - for (cnode = purple_blist_node_get_first_child((PurpleBlistNode *) bonjour_group); cnode; cnode = cnodenext) { - cnodenext = purple_blist_node_get_sibling_next(cnode); - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = bnodenext) { - bnodenext = purple_blist_node_get_sibling_next(bnode); - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *) bnode; - if (purple_buddy_get_account(buddy) != account) - continue; - purple_prpl_got_user_status(account, purple_buddy_get_name(buddy), "offline", NULL); - purple_account_remove_buddy(account, buddy, NULL); - purple_blist_remove_buddy(buddy); - } - } - -} - -static void -bonjour_login(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - BonjourData *bd; - PurpleStatus *status; - PurplePresence *presence; - -#ifdef _WIN32 - if (!dns_sd_available()) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to find Apple's \"Bonjour for Windows\" toolkit, see " - "http://d.pidgin.im/BonjourWindows for more information.")); - return; - } -#endif /* _WIN32 */ - - gc->flags |= PURPLE_CONNECTION_HTML; - gc->proto_data = bd = g_new0(BonjourData, 1); - - /* Start waiting for jabber connections (iChat style) */ - bd->jabber_data = g_new0(BonjourJabber, 1); - bd->jabber_data->port = purple_account_get_int(account, "port", BONJOUR_DEFAULT_PORT); - bd->jabber_data->account = account; - - if (bonjour_jabber_start(bd->jabber_data) == -1) { - /* Send a message about the connection error */ - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to listen for incoming IM connections")); - return; - } - - /* Connect to the mDNS daemon looking for buddies in the LAN */ - bd->dns_sd_data = bonjour_dns_sd_new(); - bd->dns_sd_data->first = g_strdup(purple_account_get_string(account, "first", default_firstname)); - bd->dns_sd_data->last = g_strdup(purple_account_get_string(account, "last", default_lastname)); - bd->dns_sd_data->port_p2pj = bd->jabber_data->port; - /* Not engaged in AV conference */ - bd->dns_sd_data->vc = g_strdup("!"); - - status = purple_account_get_active_status(account); - presence = purple_account_get_presence(account); - if (purple_presence_is_available(presence)) - bd->dns_sd_data->status = g_strdup("avail"); - else if (purple_presence_is_idle(presence)) - bd->dns_sd_data->status = g_strdup("away"); - else - bd->dns_sd_data->status = g_strdup("dnd"); - bd->dns_sd_data->msg = g_strdup(purple_status_get_attr_string(status, "message")); - - bd->dns_sd_data->account = account; - if (!bonjour_dns_sd_start(bd->dns_sd_data)) - { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to establish connection with the local mDNS server. Is it running?")); - return; - } - - bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); - - /* Show the buddy list by telling Purple we have already connected */ - purple_connection_set_state(gc, PURPLE_CONNECTED); -} - -static void -bonjour_close(PurpleConnection *connection) -{ - PurpleGroup *bonjour_group; - BonjourData *bd = connection->proto_data; - - bonjour_group = purple_find_group(BONJOUR_GROUP_NAME); - - /* Remove all the bonjour buddies */ - bonjour_removeallfromlocal(connection, bonjour_group); - - /* Stop looking for buddies in the LAN */ - if (bd != NULL && bd->dns_sd_data != NULL) - { - bonjour_dns_sd_stop(bd->dns_sd_data); - bonjour_dns_sd_free(bd->dns_sd_data); - } - - if (bd != NULL && bd->jabber_data != NULL) - { - /* Stop waiting for conversations */ - bonjour_jabber_stop(bd->jabber_data); - g_free(bd->jabber_data); - } - - /* Delete the bonjour group */ - if (bonjour_group != NULL) - purple_blist_remove_group(bonjour_group); - - /* Cancel any file transfers */ - while (bd != NULL && bd->xfer_lists) { - purple_xfer_cancel_local(bd->xfer_lists->data); - } - - g_free(bd); - connection->proto_data = NULL; -} - -static const char * -bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy) -{ - return BONJOUR_ICON_NAME; -} - -static int -bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags) -{ - if(!to || !msg) - return 0; - - return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg); -} - -static void -bonjour_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - BonjourData *bd; - gboolean disconnected; - PurpleStatusType *type; - int primitive; - PurplePresence *presence; - const char *message, *bonjour_status; - gchar *stripped; - - gc = purple_account_get_connection(account); - bd = gc->proto_data; - disconnected = purple_account_is_disconnected(account); - type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(type); - presence = purple_account_get_presence(account); - - message = purple_status_get_attr_string(status, "message"); - if (message == NULL) - message = ""; - stripped = purple_markup_strip_html(message); - - /* - * The three possible status for Bonjour are - * -available ("avail") - * -idle ("away") - * -away ("dnd") - * Each of them can have an optional message. - */ - if (purple_presence_is_available(presence)) - bonjour_status = "avail"; - else if (purple_presence_is_idle(presence)) - bonjour_status = "away"; - else - bonjour_status = "dnd"; - - bonjour_dns_sd_send_status(bd->dns_sd_data, bonjour_status, stripped); - g_free(stripped); -} - -/* - * The add_buddy callback removes the buddy from the local list. - * Bonjour manages buddies for you, and adding someone locally by - * hand is stupid. Perhaps we should change libpurple not to allow adding - * if there is no add_buddy callback. - */ -static void -bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { - purple_debug_error("bonjour", "Buddy '%s' manually added; removing. " - "Bonjour buddies must be discovered and not manually added.\n", - purple_buddy_get_name(buddy)); - - /* I suppose we could alert the user here, but it seems unnecessary. */ - - /* If this causes problems, it can be moved to an idle callback */ - purple_blist_remove_buddy(buddy); -} - - -static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy); - if (bb) { - bonjour_buddy_delete(bb); - purple_buddy_set_protocol_data(buddy, NULL); - } -} - -static GList * -bonjour_status_types(PurpleAccount *account) -{ - GList *status_types = NULL; - PurpleStatusType *type; - - g_return_val_if_fail(account != NULL, NULL); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - BONJOUR_STATUS_ID_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - BONJOUR_STATUS_ID_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - BONJOUR_STATUS_ID_OFFLINE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - return status_types; -} - -static void -bonjour_convo_closed(PurpleConnection *connection, const char *who) -{ - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); - BonjourBuddy *bb; - - if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) - { - /* - * This buddy is not in our buddy list, and therefore does not really - * exist, so we won't have any data about them. - */ - return; - } - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; -} - -static -void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img) -{ - BonjourData *bd = conn->proto_data; - bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); -} - - -static char * -bonjour_status_text(PurpleBuddy *buddy) -{ - const PurplePresence *presence; - const PurpleStatus *status; - const char *message; - gchar *ret = NULL; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - message = purple_status_get_attr_string(status, "message"); - - if (message != NULL) { - ret = g_markup_escape_text(message, -1); - purple_util_chrreplace(ret, '\n', ' '); - } - - return ret; -} - -static void -bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurplePresence *presence; - PurpleStatus *status; - BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy); - const char *status_description; - const char *message; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - message = purple_status_get_attr_string(status, "message"); - - if (purple_presence_is_available(presence)) - status_description = purple_status_get_name(status); - else if (purple_presence_is_idle(presence)) - status_description = _("Idle"); - else - status_description = purple_status_get_name(status); - - purple_notify_user_info_add_pair(user_info, _("Status"), status_description); - if (message != NULL) - purple_notify_user_info_add_pair(user_info, _("Message"), message); - - if (bb == NULL) { - purple_debug_error("bonjour", "Got tooltip request for a buddy without protocol data.\n"); - return; - } - - /* Only show first/last name if there is a nickname set (to avoid duplication) */ - if (bb->nick != NULL && *bb->nick != '\0') { - if (bb->first != NULL && *bb->first != '\0') - purple_notify_user_info_add_pair(user_info, _("First name"), bb->first); - if (bb->last != NULL && *bb->last != '\0') - purple_notify_user_info_add_pair(user_info, _("Last name"), bb->last); - } - - if (bb->email != NULL && *bb->email != '\0') - purple_notify_user_info_add_pair(user_info, _("Email"), bb->email); - - if (bb->AIM != NULL && *bb->AIM != '\0') - purple_notify_user_info_add_pair(user_info, _("AIM Account"), bb->AIM); - - if (bb->jid != NULL && *bb->jid != '\0') - purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid); -} - -static void -bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group) -{ - PurpleBlistNodeFlags oldflags; - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); - - if (buddy == NULL) - return; - - oldflags = purple_blist_node_get_flags((PurpleBlistNode *)buddy); - - /* If we're moving them out of the bonjour group, make them persistent */ - if (strcmp(new_group, BONJOUR_GROUP_NAME) == 0) - purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags | PURPLE_BLIST_NODE_FLAG_NO_SAVE); - else - purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags ^ PURPLE_BLIST_NODE_FLAG_NO_SAVE); - -} - -static gboolean -bonjour_can_receive_file(PurpleConnection *connection, const char *who) -{ - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); - - return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL); -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - /* These shouldn't happen here because they are allocated in _init() */ - - g_free(default_firstname); - g_free(default_lastname); - g_free(default_hostname); - - return TRUE; -} - -static PurplePlugin *my_protocol = NULL; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_NO_PASSWORD, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - bonjour_list_icon, /* list_icon */ - NULL, /* list_emblem */ - bonjour_status_text, /* status_text */ - bonjour_tooltip_text, /* tooltip_text */ - bonjour_status_types, /* status_types */ - NULL, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - bonjour_login, /* login */ - bonjour_close, /* close */ - bonjour_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - NULL, /* get_info */ - bonjour_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - bonjour_fake_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - bonjour_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - bonjour_group_buddy, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - bonjour_convo_closed, /* convo_closed */ - NULL, /* normalize */ - bonjour_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - bonjour_can_receive_file, /* can_receive_file */ - bonjour_send_file, /* send_file */ - bonjour_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-bonjour", /**< id */ - "Bonjour", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Bonjour Protocol Plugin"), - /** description */ - N_("Bonjour Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -#ifdef WIN32 -static gboolean _set_default_name_cb(gpointer data) { - gchar *fullname = data; - const char *splitpoint; - GList *tmp = prpl_info.protocol_options; - PurpleAccountOption *option; - - if (!fullname) { - purple_debug_info("bonjour", "Unable to look up First and Last name or Username from system; using defaults.\n"); - return FALSE; - } - - g_free(default_firstname); - g_free(default_lastname); - - /* Split the real name into a first and last name */ - splitpoint = strchr(fullname, ' '); - if (splitpoint != NULL) { - default_firstname = g_strndup(fullname, splitpoint - fullname); - default_lastname = g_strdup(&splitpoint[1]); - } else { - default_firstname = g_strdup(fullname); - default_lastname = g_strdup(""); - } - g_free(fullname); - - - for(; tmp != NULL; tmp = tmp->next) { - option = tmp->data; - if (strcmp("first", purple_account_option_get_setting(option)) == 0) - purple_account_option_set_default_string(option, default_firstname); - else if (strcmp("last", purple_account_option_get_setting(option)) == 0) - purple_account_option_set_default_string(option, default_lastname); - } - - return FALSE; -} - -static gpointer _win32_name_lookup_thread(gpointer data) { - gchar *fullname = NULL; - wchar_t username[UNLEN + 1]; - DWORD dwLenUsername = UNLEN + 1; - - GetUserNameW((LPWSTR) &username, &dwLenUsername); - - if (username != NULL && *username != '\0') { - LPBYTE servername = NULL; - LPBYTE info = NULL; - - NetGetDCName(NULL, NULL, &servername); - - /* purple_debug_info("bonjour", "Looking up the full name from the %s.\n", (servername ? "domain controller" : "local machine")); */ - - if (NetUserGetInfo((LPCWSTR) servername, username, 10, &info) == NERR_Success - && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL - && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') { - fullname = g_utf16_to_utf8( - ((LPUSER_INFO_10) info)->usri10_full_name, - -1, NULL, NULL, NULL); - } - /* Fall back to the local machine if we didn't get the full name from the domain controller */ - else if (servername != NULL) { - /* purple_debug_info("bonjour", "Looking up the full name from the local machine"); */ - - if (info != NULL) NetApiBufferFree(info); - info = NULL; - - if (NetUserGetInfo(NULL, username, 10, &info) == NERR_Success - && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL - && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') { - fullname = g_utf16_to_utf8( - ((LPUSER_INFO_10) info)->usri10_full_name, - -1, NULL, NULL, NULL); - } - } - - if (info != NULL) NetApiBufferFree(info); - if (servername != NULL) NetApiBufferFree(servername); - - if (!fullname) - fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL); - } - - purple_timeout_add(0, _set_default_name_cb, fullname); - - return NULL; -} -#endif - -static void -initialize_default_account_values(void) -{ -#ifndef _WIN32 - struct passwd *info; -#endif - const char *fullname = NULL, *splitpoint, *tmp; - gchar *conv = NULL; - -#ifndef _WIN32 - /* Try to figure out the user's real name */ - info = getpwuid(getuid()); - if ((info != NULL) && (info->pw_gecos != NULL) && (info->pw_gecos[0] != '\0')) - fullname = info->pw_gecos; - else if ((info != NULL) && (info->pw_name != NULL) && (info->pw_name[0] != '\0')) - fullname = info->pw_name; - else if (((fullname = getlogin()) != NULL) && (fullname[0] == '\0')) - fullname = NULL; -#else - /* The Win32 username lookup functions are synchronous so we do it in a thread */ - g_thread_create(_win32_name_lookup_thread, NULL, FALSE, NULL); -#endif - - /* Make sure fullname is valid UTF-8. If not, try to convert it. */ - if (fullname != NULL && !g_utf8_validate(fullname, -1, NULL)) { - fullname = conv = g_locale_to_utf8(fullname, -1, NULL, NULL, NULL); - if (conv == NULL || *conv == '\0') - fullname = NULL; - } - - if (fullname == NULL) - fullname = _("Purple Person"); - - /* Split the real name into a first and last name */ - splitpoint = strchr(fullname, ' '); - if (splitpoint != NULL) { - default_firstname = g_strndup(fullname, splitpoint - fullname); - tmp = &splitpoint[1]; - - /* The last name may be followed by a comma and additional data. - * Only use the last name itself. - */ - splitpoint = strchr(tmp, ','); - if (splitpoint != NULL) - default_lastname = g_strndup(tmp, splitpoint - tmp); - else - default_lastname = g_strdup(tmp); - } else { - default_firstname = g_strdup(fullname); - default_lastname = g_strdup(""); - } - - g_free(conv); - - /* Try to figure out a good host name to use */ - /* TODO: Avoid 'localhost,' if possible */ - default_hostname = g_strdup(purple_get_host_name()); -} - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - initialize_default_account_values(); - - /* Creating the user splits */ - split = purple_account_user_split_new(_("Hostname"), default_hostname, '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Creating the options for the protocol */ - option = purple_account_option_int_new(_("Local Port"), "port", BONJOUR_DEFAULT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("First name"), "first", default_firstname); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Last name"), "last", default_lastname); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Email"), "email", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("AIM Account"), "AIM", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("XMPP Account"), "jid", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - my_protocol = plugin; -} - -PURPLE_INIT_PLUGIN(bonjour, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,897 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#include "internal.h" -#include "util.h" -#include "debug.h" -#include "notify.h" -#include "proxy.h" -#include "ft.h" -#include "buddy.h" -#include "bonjour.h" -#include "bonjour_ft.h" -#include "cipher.h" - -static void -bonjour_bytestreams_init(PurpleXfer *xfer); -static void -bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb); -static void -bonjour_xfer_init(PurpleXfer *xfer); -static void -bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option); -static void bonjour_free_xfer(PurpleXfer *xfer); - -/* Look for specific xfer handle */ -static unsigned int next_id = 0; - -static void -xep_ft_si_reject(BonjourData *bd, const char *id, const char *to, const char *error_code, const char *error_type) -{ - xmlnode *error_node; - XepIq *iq; - - g_return_if_fail(error_code != NULL); - g_return_if_fail(error_type != NULL); - - if(!to || !id) - return; - - purple_debug_info("bonjour", "xep file transfer stream initialization error.\n"); - iq = xep_iq_new(bd, XEP_IQ_ERROR, to, purple_account_get_username(bd->jabber_data->account), id); - if(iq == NULL) - return; - - error_node = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error_node, "code", error_code); - xmlnode_set_attrib(error_node, "type", error_type); - - /* TODO: Make this better */ - if (!strcmp(error_code, "403")) { - xmlnode *tmp_node = xmlnode_new_child(error_node, "forbidden"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - - tmp_node = xmlnode_new_child(error_node, "text"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - xmlnode_insert_data(tmp_node, "Offer Declined", -1); - } else if (!strcmp(error_code, "404")) { - xmlnode *tmp_node = xmlnode_new_child(error_node, "item-not-found"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - } - - xep_iq_send_and_free(iq); -} - -static void bonjour_xfer_cancel_send(PurpleXfer *xfer) -{ - purple_debug_info("bonjour", "Bonjour-xfer-cancel-send.\n"); - bonjour_free_xfer(xfer); -} - -static void bonjour_xfer_request_denied(PurpleXfer *xfer) -{ - XepXfer *xf = xfer->data; - - purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n"); - - if(xf) - xep_ft_si_reject(xf->data, xf->sid, xfer->who, "403", "cancel"); - - bonjour_free_xfer(xfer); -} - -static void bonjour_xfer_cancel_recv(PurpleXfer *xfer) -{ - purple_debug_info("bonjour", "Bonjour-xfer-cancel-recv.\n"); - bonjour_free_xfer(xfer); -} - -struct socket_cleanup { - int fd; - guint handle; -}; - -static void -_wait_for_socket_close(gpointer data, gint source, PurpleInputCondition cond) -{ - struct socket_cleanup *sc = data; - char buf[1]; - int ret; - - ret = recv(source, buf, 1, 0); - - if (ret == 0 || (ret == -1 && !(errno == EAGAIN || errno == EWOULDBLOCK))) { - purple_debug_info("bonjour", "Client completed recieving; closing server socket.\n"); - purple_input_remove(sc->handle); - close(sc->fd); - g_free(sc); - } -} - -static void bonjour_xfer_end(PurpleXfer *xfer) -{ - purple_debug_info("bonjour", "Bonjour-xfer-end.\n"); - - /* We can't allow the server side to close the connection until the client is complete, - * otherwise there is a RST resulting in an error on the client side */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_is_completed(xfer)) { - struct socket_cleanup *sc = g_new0(struct socket_cleanup, 1); - sc->fd = xfer->fd; - xfer->fd = -1; - sc->handle = purple_input_add(sc->fd, PURPLE_INPUT_READ, - _wait_for_socket_close, sc); - } - - bonjour_free_xfer(xfer); -} - -static PurpleXfer* -bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) -{ - GSList *xfers; - PurpleXfer *xfer; - XepXfer *xf; - - if(!sid || !from || !bd) - return NULL; - - purple_debug_info("bonjour", "Look for sid=%s from=%s xferlists.\n", - sid, from); - - for(xfers = bd->xfer_lists; xfers; xfers = xfers->next) { - xfer = xfers->data; - if(xfer == NULL) - break; - xf = xfer->data; - if(xf == NULL) - break; - if(xf->sid && xfer->who && !strcmp(xf->sid, sid) && - !strcmp(xfer->who, from)) - return xfer; - } - - purple_debug_info("bonjour", "Look for xfer list fail\n"); - - return NULL; -} - -static void -xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) -{ - xmlnode *si_node, *feature, *field, *file, *x; - XepIq *iq; - XepXfer *xf = xfer->data; - BonjourData *bd = NULL; - char buf[32]; - - if(!xf) - return; - - bd = xf->data; - if(!bd) - return; - - purple_debug_info("bonjour", "xep file transfer stream initialization offer-id=%d.\n", next_id); - - /* Assign stream id. */ - g_free(xf->iq_id); - xf->iq_id = g_strdup_printf("%u", next_id++); - iq = xep_iq_new(xf->data, XEP_IQ_SET, to, purple_account_get_username(bd->jabber_data->account), xf->iq_id); - if(iq == NULL) - return; - - /*Construct Stream initialization offer message.*/ - si_node = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); - xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer"); - g_free(xf->sid); - xf->sid = g_strdup(xf->iq_id); - xmlnode_set_attrib(si_node, "id", xf->sid); - - file = xmlnode_new_child(si_node, "file"); - xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); - xmlnode_set_attrib(file, "size", buf); - - feature = xmlnode_new_child(si_node, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "form"); - - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - xmlnode_set_attrib(field, "type", "list-single"); - - if (xf->mode & XEP_BYTESTREAMS) { - xmlnode *option = xmlnode_new_child(field, "option"); - xmlnode *value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); - } - if (xf->mode & XEP_IBB) { - xmlnode *option = xmlnode_new_child(field, "option"); - xmlnode *value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); - } - - xep_iq_send_and_free(iq); -} - -static void -xep_ft_si_result(PurpleXfer *xfer, char *to) -{ - xmlnode *si_node, *feature, *field, *value, *x; - XepIq *iq; - XepXfer *xf; - BonjourData *bd; - - if(!to || !xfer) - return; - xf = xfer->data; - if(!xf) - return; - - bd = xf->data; - - purple_debug_info("bonjour", "xep file transfer stream initialization result.\n"); - iq = xep_iq_new(bd, XEP_IQ_RESULT, to, purple_account_get_username(bd->jabber_data->account), xf->iq_id); - if(iq == NULL) - return; - - si_node = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); - /*xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer");*/ - - feature = xmlnode_new_child(si_node, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); - - xep_iq_send_and_free(iq); -} - -static void -bonjour_free_xfer(PurpleXfer *xfer) -{ - XepXfer *xf; - - if(xfer == NULL) { - purple_debug_info("bonjour", "bonjour-free-xfer-null.\n"); - return; - } - - purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer); - - xf = (XepXfer*)xfer->data; - if(xf != NULL) { - BonjourData *bd = (BonjourData*)xf->data; - if(bd != NULL) { - bd->xfer_lists = g_slist_remove(bd->xfer_lists, xfer); - purple_debug_info("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); - } - if (xf->proxy_connection != NULL) - purple_proxy_connect_cancel(xf->proxy_connection); - if (xf->proxy_info != NULL) - purple_proxy_info_destroy(xf->proxy_info); - if (xf->listen_data != NULL) - purple_network_listen_cancel(xf->listen_data); - g_free(xf->iq_id); - g_free(xf->jid); - g_free(xf->proxy_host); - g_free(xf->buddy_ip); - g_free(xf->sid); - g_free(xf); - xfer->data = NULL; - } - - purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd); -} - -PurpleXfer * -bonjour_new_xfer(PurpleConnection *gc, const char *who) -{ - PurpleXfer *xfer; - XepXfer *xep_xfer; - BonjourData *bd; - - if(who == NULL || gc == NULL) - return NULL; - - purple_debug_info("bonjour", "Bonjour-new-xfer to %s.\n", who); - bd = (BonjourData*) gc->proto_data; - if(bd == NULL) - return NULL; - - /* Build the file transfer handle */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - xfer->data = xep_xfer = g_new0(XepXfer, 1); - xep_xfer->data = bd; - - purple_debug_info("bonjour", "Bonjour-new-xfer bd=%p data=%p.\n", bd, xep_xfer->data); - - /* We don't support IBB yet */ - /*xep_xfer->mode = XEP_BYTESTREAMS | XEP_IBB;*/ - xep_xfer->mode = XEP_BYTESTREAMS; - xep_xfer->sid = NULL; - - purple_xfer_set_init_fnc(xfer, bonjour_xfer_init); - purple_xfer_set_cancel_send_fnc(xfer, bonjour_xfer_cancel_send); - purple_xfer_set_end_fnc(xfer, bonjour_xfer_end); - - bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer); - - return xfer; -} - -void -bonjour_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer; - - g_return_if_fail(gc != NULL); - g_return_if_fail(who != NULL); - - purple_debug_info("bonjour", "Bonjour-send-file to=%s.\n", who); - - xfer = bonjour_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); - -} - -static void -bonjour_xfer_init(PurpleXfer *xfer) -{ - PurpleBuddy *buddy; - BonjourBuddy *bb; - XepXfer *xf; - - xf = (XepXfer*)xfer->data; - if(xf == NULL) - return; - - purple_debug_info("bonjour", "Bonjour-xfer-init.\n"); - - buddy = purple_find_buddy(xfer->account, xfer->who); - /* this buddy is offline. */ - if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) - return; - - /* Assume it is the first IP. We could do something like keep track of which one is in use or something. */ - if (bb->ips) - xf->buddy_ip = g_strdup(bb->ips->data); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - /* initiate file transfer, send SI offer. */ - purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_SEND.\n"); - xep_ft_si_offer(xfer, xfer->who); - } else { - /* accept file transfer request, send SI result. */ - xep_ft_si_result(xfer, xfer->who); - purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_RECEIVE.\n"); - } -} - -void -xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) -{ - const char *type, *id; - BonjourData *bd; - PurpleXfer *xfer; - const gchar *name = NULL; - - g_return_if_fail(pc != NULL); - g_return_if_fail(packet != NULL); - g_return_if_fail(pb != NULL); - - bd = (BonjourData*) pc->proto_data; - if(bd == NULL) - return; - - purple_debug_info("bonjour", "xep-si-parse.\n"); - - name = purple_buddy_get_name(pb); - - type = xmlnode_get_attrib(packet, "type"); - id = xmlnode_get_attrib(packet, "id"); - if(type) { - if(!strcmp(type, "set")) { - const char *profile; - xmlnode *si; - gboolean parsed_receive = FALSE; - - si = xmlnode_get_child(packet, "si"); - - purple_debug_info("bonjour", "si offer Message type - SET.\n"); - if (si && (profile = xmlnode_get_attrib(si, "profile")) - && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { - const char *filename = NULL, *filesize_str = NULL; - int filesize = 0; - xmlnode *file; - - const char *sid = xmlnode_get_attrib(si, "id"); - - if ((file = xmlnode_get_child(si, "file"))) { - filename = xmlnode_get_attrib(file, "name"); - if((filesize_str = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_str); - } - - /* TODO: Make sure that it is advertising a bytestreams transfer */ - - if (filename) { - bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); - - parsed_receive = TRUE; - } - } - - if (!parsed_receive) { - BonjourData *bd = purple_connection_get_protocol_data(pc); - - purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n"); - xep_ft_si_reject(bd, id, name, "403", "cancel"); - /*TODO: Send Cancel (501) */ - } - } else if(!strcmp(type, "result")) { - purple_debug_info("bonjour", "si offer Message type - RESULT.\n"); - - xfer = bonjour_si_xfer_find(bd, id, name); - - if(xfer == NULL) { - BonjourData *bd = purple_connection_get_protocol_data(pc); - purple_debug_info("bonjour", "xfer find fail.\n"); - xep_ft_si_reject(bd, id, name, "403", "cancel"); - } else - bonjour_bytestreams_init(xfer); - - } else if(!strcmp(type, "error")) { - purple_debug_info("bonjour", "si offer Message type - ERROR.\n"); - - xfer = bonjour_si_xfer_find(bd, id, name); - - if(xfer == NULL) - purple_debug_info("bonjour", "xfer find fail.\n"); - else - purple_xfer_cancel_remote(xfer); - } else - purple_debug_info("bonjour", "si offer Message type - Unknown-%s.\n", type); - } -} - -void -xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) -{ - const char *type, *from; - xmlnode *query; - BonjourData *bd; - - g_return_if_fail(pc != NULL); - g_return_if_fail(packet != NULL); - g_return_if_fail(pb != NULL); - - bd = (BonjourData*) pc->proto_data; - if(bd == NULL) - return; - - purple_debug_info("bonjour", "xep-bytestreams-parse.\n"); - - type = xmlnode_get_attrib(packet, "type"); - from = purple_buddy_get_name(pb); - query = xmlnode_get_child(packet,"query"); - if(type) { - if(!strcmp(type, "set")) { - const char *iq_id, *sid; - gboolean found = FALSE; - PurpleXfer *xfer; - - purple_debug_info("bonjour", "bytestream offer Message type - SET.\n"); - - iq_id = xmlnode_get_attrib(packet, "id"); - - sid = xmlnode_get_attrib(query, "sid"); - xfer = bonjour_si_xfer_find(bd, sid, from); - - if(xfer) { - const char *jid, *host, *port; - xmlnode *streamhost; - int portnum; - XepXfer *xf = NULL; - - xf = (XepXfer*)xfer->data; - for(streamhost = xmlnode_get_child(query, "streamhost"); - streamhost; - streamhost = xmlnode_get_next_twin(streamhost)) { - - if((jid = xmlnode_get_attrib(streamhost, "jid")) && - (host = xmlnode_get_attrib(streamhost, "host")) && - (port = xmlnode_get_attrib(streamhost, "port")) && - (portnum = atoi(port))) { - - if(!strcmp(host, xf->buddy_ip)) { - g_free(xf->iq_id); - xf->iq_id = g_strdup(iq_id); - xf->jid = g_strdup(jid); - xf->proxy_host = g_strdup(host); - xf->proxy_port = portnum; - purple_debug_info("bonjour", "bytestream offer parse" - "jid=%s host=%s port=%d.\n", jid, host, portnum); - bonjour_bytestreams_connect(xfer, pb); - found = TRUE; - break; - } - } else { - purple_debug_info("bonjour", "bytestream offer Message parse error.\n"); - } - } - } else { - - } - - if (!found) { - purple_debug_error("bonjour", "Didn't find an acceptable streamhost.\n"); - - if (iq_id && xfer != NULL) - xep_ft_si_reject(bd, iq_id, xfer->who, "404", "cancel"); - } - - } else { - purple_debug_info("bonjour", "bytestream offer Message type - Unknown-%s.\n", type); - } - } -} - -static void -bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option) -{ - PurpleXfer *xfer; - XepXfer *xf; - BonjourData *bd; - - if(pc == NULL || id == NULL || from == NULL) - return; - - bd = (BonjourData*) pc->proto_data; - if(bd == NULL) - return; - - purple_debug_info("bonjour", "bonjour-xfer-receive.\n"); - - /* Build the file transfer handle */ - xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); - xfer->data = xf = g_new0(XepXfer, 1); - xf->data = bd; - purple_xfer_set_filename(xfer, filename); - xf->iq_id = g_strdup(id); - xf->sid = g_strdup(sid); - - if(filesize > 0) - purple_xfer_set_size(xfer, filesize); - purple_xfer_set_init_fnc(xfer, bonjour_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, bonjour_xfer_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer, bonjour_xfer_cancel_recv); - purple_xfer_set_end_fnc(xfer, bonjour_xfer_end); - - bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer); - - purple_xfer_request(xfer); -} - -static void -bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; - int acceptfd; - int len = 0; - - if(xf == NULL) - return; - - purple_debug_info("bonjour", "bonjour_sock5_request_cb - req_state = 0x%x\n", xf->sock5_req_state); - - switch(xf->sock5_req_state){ - case 0x00: - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { - - } else if(acceptfd == -1) { - /* This should cancel the ft */ - purple_debug_error("bonjour", "Error accepting incoming SOCKS5 connection. (%d)\n", errno); - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - int flags; - - purple_debug_info("bonjour", "Accepted SOCKS5 ft connection - fd=%d\n", acceptfd); - - flags = fcntl(acceptfd, F_GETFL); - fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(acceptfd, F_SETFD, FD_CLOEXEC); -#endif - - purple_input_remove(xfer->watcher); - close(source); - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - } - break; - case 0x01: - xfer->fd = source; - len = read(source, xf->rx_buf + xf->rxlen, 3); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0){ - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); - } - break; - case 0x02: - xf->tx_buf[0] = 0x05; - xf->tx_buf[1] = 0x00; - len = write(source, xf->tx_buf, 2); - if (len < 0 && errno == EAGAIN) - return; - else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - } - break; - case 0x03: - len = read(source, xf->rx_buf + xf->rxlen, 20); - if(len<=0){ - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); - } - break; - case 0x04: - xf->tx_buf[0] = 0x05; - xf->tx_buf[1] = 0x00; - xf->tx_buf[2] = 0x00; - xf->tx_buf[3] = 0x03; - xf->tx_buf[4] = strlen(xf->buddy_ip); - memcpy(xf->tx_buf + 5, xf->buddy_ip, strlen(xf->buddy_ip)); - xf->tx_buf[5+strlen(xf->buddy_ip)] = 0x00; - xf->tx_buf[6+strlen(xf->buddy_ip)] = 0x00; - len = write(source, xf->tx_buf, 7 + strlen(xf->buddy_ip)); - if (len < 0 && errno == EAGAIN) { - return; - } else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - xf->rxlen = 0; - /*close(source);*/ - purple_xfer_start(xfer, source, NULL, -1); - } - break; - default: - break; - } - return; -} - -static void -bonjour_bytestreams_listen(int sock, gpointer data) -{ - PurpleXfer *xfer = data; - XepXfer *xf; - XepIq *iq; - xmlnode *query, *streamhost; - gchar *port; - const char *next_ip, *local_ip; - const char token [] = ";"; - BonjourData *bd; - - purple_debug_info("bonjour", "Bonjour-bytestreams-listen. sock=%d.\n", sock); - if (sock < 0 || xfer == NULL) { - /*purple_xfer_cancel_local(xfer);*/ - return; - } - - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf = (XepXfer*)xfer->data; - xf->listen_data = NULL; - - bd = xf->data; - - iq = xep_iq_new(bd, XEP_IQ_SET, xfer->who, purple_account_get_username(bd->jabber_data->account), xf->sid); - - query = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); - xmlnode_set_attrib(query, "sid", xf->sid); - xmlnode_set_attrib(query, "mode", "tcp"); - - xfer->local_port = purple_network_get_port_from_fd(sock); - - local_ip = purple_network_get_my_ip_ext2(sock); - /* cheat a little here - the intent of the "const" attribute is to make it clear that the string doesn't need to be freed */ - next_ip = strtok((char *)local_ip, token); - - port = g_strdup_printf("%hu", xfer->local_port); - while(next_ip != NULL) { - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", xf->sid); - xmlnode_set_attrib(streamhost, "host", next_ip); - xmlnode_set_attrib(streamhost, "port", port); - next_ip = strtok(NULL, token); - } - g_free(port); - - xep_iq_send_and_free(iq); -} - -static void -bonjour_bytestreams_init(PurpleXfer *xfer) -{ - XepXfer *xf; - if(xfer == NULL) - return; - purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); - xf = xfer->data; - purple_network_listen_map_external(FALSE); - xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, - bonjour_bytestreams_listen, xfer); - purple_network_listen_map_external(TRUE); - if (xf->listen_data == NULL) { - purple_xfer_cancel_local(xfer); - } - return; -} - -static void -bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; - XepIq *iq; - xmlnode *q_node, *tmp_node; - BonjourData *bd; - - xf->proxy_connection = NULL; - - if(source < 0) { - purple_debug_error("bonjour", "Error connecting via SOCKS5 - %s\n", - error_message ? error_message : "(null)"); - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); - /* Cancel the connection */ - purple_xfer_cancel_local(xfer); - return; - } - - purple_debug_info("bonjour", "Connected successfully via SOCKS5, starting transfer.\n"); - - bd = xf->data; - - /* Here, start the file transfer.*/ - - /* Notify Initiator of Connection */ - iq = xep_iq_new(bd, XEP_IQ_RESULT, xfer->who, purple_account_get_username(bd->jabber_data->account), xf->iq_id); - q_node = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); - tmp_node = xmlnode_new_child(q_node, "streamhost-used"); - xmlnode_set_attrib(tmp_node, "jid", xf->jid); - xep_iq_send_and_free(iq); - - purple_xfer_start(xfer, source, NULL, -1); -} - -static void -bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) -{ - PurpleAccount *account = NULL; - XepXfer *xf; - char dstaddr[41]; - const gchar *name = NULL; - unsigned char hashval[20]; - char *p; - int i; - - if(xfer == NULL) - return; - - purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n"); - - xf = (XepXfer*)xfer->data; - if(!xf) - return; - - name = purple_buddy_get_name(pb); - account = purple_buddy_get_account(pb); - - p = g_strdup_printf("%s%s%s", xf->sid, name, purple_account_get_username(account)); - purple_cipher_digest_region("sha1", (guchar *)p, strlen(p), - sizeof(hashval), hashval, NULL); - g_free(p); - - memset(dstaddr, 0, 41); - p = dstaddr; - for(i = 0; i < 20; i++, p += 2) - snprintf(p, 3, "%02x", hashval[i]); - - xf->proxy_info = purple_proxy_info_new(); - purple_proxy_info_set_type(xf->proxy_info, PURPLE_PROXY_SOCKS5); - purple_proxy_info_set_host(xf->proxy_info, xf->proxy_host); - purple_proxy_info_set_port(xf->proxy_info, xf->proxy_port); - xf->proxy_connection = purple_proxy_connect_socks5( - purple_account_get_connection(account), - xf->proxy_info, - dstaddr, 0, - bonjour_bytestreams_connect_cb, xfer); - - if(xf->proxy_connection == NULL) { - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); - /* Cancel the connection */ - purple_xfer_cancel_local(xfer); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour_ft.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef _BONJOUR_FT_H_ -#define _BONJOUR_FT_H_ -#include "network.h" -#include "proxy.h" -typedef struct _XepXfer XepXfer; -typedef enum { - XEP_BYTESTREAMS = 1, - XEP_IBB = 2, - XEP_UNKNOWN = 4 -} XepSiMode; - -struct _XepXfer -{ - void *data; - char *filename; - int filesize; - char *iq_id; - char *sid; - char *recv_id; - char *buddy_ip; - int mode; - PurpleNetworkListenData *listen_data; - int sock5_req_state; - int rxlen; - char rx_buf[0x500]; - char tx_buf[0x500]; - PurpleProxyInfo *proxy_info; - PurpleProxyConnectData *proxy_connection; - char *jid; - char *proxy_host; - int proxy_port; -}; - -/** - * Create a new PurpleXfer - * - * @param gc The PurpleConnection handle. - * @param who Who will we be sending it to? - */ -PurpleXfer *bonjour_new_xfer(PurpleConnection *gc, const char *who); - -/** - * Send a file. - * - * @param gc The PurpleConnection handle. - * @param who Who are we sending it to? - * @param file What file? If NULL, user will choose after this call. - */ -void bonjour_send_file(PurpleConnection *gc, const char *who, const char *file); - -void xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb); -void -xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/bonjour.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file bonjour.h The Purple interface to mDNS and peer to peer Jabber. - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _BONJOUR_H_ -#define _BONJOUR_H_ - -#include "mdns_common.h" -#include "internal.h" -#include "jabber.h" - -#define BONJOUR_GROUP_NAME _("Bonjour") -#define BONJOUR_PROTOCOL_NAME "bonjour" -#define BONJOUR_ICON_NAME "bonjour" - -#define BONJOUR_STATUS_ID_OFFLINE "offline" -#define BONJOUR_STATUS_ID_AVAILABLE "available" -#define BONJOUR_STATUS_ID_AWAY "away" - -#define BONJOUR_DEFAULT_PORT 5298 - -typedef struct _BonjourData -{ - BonjourDnsSd *dns_sd_data; - BonjourJabber *jabber_data; - GSList *xfer_lists; -} BonjourData; - -#endif /* _BONJOUR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,283 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include -#include - -#include "internal.h" -#include "buddy.h" -#include "account.h" -#include "blist.h" -#include "bonjour.h" -#include "mdns_interface.h" -#include "debug.h" - -/** - * Creates a new buddy. - */ -BonjourBuddy * -bonjour_buddy_new(const gchar *name, PurpleAccount* account) -{ - BonjourBuddy *buddy = g_new0(BonjourBuddy, 1); - - buddy->account = account; - buddy->name = g_strdup(name); - - _mdns_init_buddy(buddy); - - return buddy; -} - -#define _B_CLR(x) g_free(x); x = NULL; - -void clear_bonjour_buddy_values(BonjourBuddy *buddy) { - - _B_CLR(buddy->first) - _B_CLR(buddy->email); - _B_CLR(buddy->ext); - _B_CLR(buddy->jid); - _B_CLR(buddy->last); - _B_CLR(buddy->msg); - _B_CLR(buddy->nick); - _B_CLR(buddy->node); - _B_CLR(buddy->phsh); - _B_CLR(buddy->status); - _B_CLR(buddy->vc); - _B_CLR(buddy->ver); - _B_CLR(buddy->AIM); - -} - -void -set_bonjour_buddy_value(BonjourBuddy* buddy, const char *record_key, const char *value, guint32 len){ - gchar **fld = NULL; - - g_return_if_fail(record_key != NULL); - - if (!strcmp(record_key, "1st")) - fld = &buddy->first; - else if(!strcmp(record_key, "email")) - fld = &buddy->email; - else if(!strcmp(record_key, "ext")) - fld = &buddy->ext; - else if(!strcmp(record_key, "jid")) - fld = &buddy->jid; - else if(!strcmp(record_key, "last")) - fld = &buddy->last; - else if(!strcmp(record_key, "msg")) - fld = &buddy->msg; - else if(!strcmp(record_key, "nick")) - fld = &buddy->nick; - else if(!strcmp(record_key, "node")) - fld = &buddy->node; - else if(!strcmp(record_key, "phsh")) - fld = &buddy->phsh; - else if(!strcmp(record_key, "status")) - fld = &buddy->status; - else if(!strcmp(record_key, "vc")) - fld = &buddy->vc; - else if(!strcmp(record_key, "ver")) - fld = &buddy->ver; - else if(!strcmp(record_key, "AIM")) - fld = &buddy->AIM; - - if(fld == NULL) - return; - - g_free(*fld); - *fld = NULL; - *fld = g_strndup(value, len); -} - -/** - * Check if all the compulsory buddy data is present. - */ -gboolean -bonjour_buddy_check(BonjourBuddy *buddy) -{ - if (buddy->account == NULL) - return FALSE; - - if (buddy->name == NULL) - return FALSE; - - return TRUE; -} - -/** - * If the buddy does not yet exist, then create it and add it to - * our buddy list. In either case we set the correct status for - * the buddy. - */ -void -bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy, PurpleBuddy *buddy) -{ - PurpleGroup *group; - PurpleAccount *account = bonjour_buddy->account; - const char *status_id, *old_hash, *new_hash, *name; - - /* Translate between the Bonjour status and the Purple status */ - if (bonjour_buddy->status != NULL && g_ascii_strcasecmp("dnd", bonjour_buddy->status) == 0) - status_id = BONJOUR_STATUS_ID_AWAY; - else - status_id = BONJOUR_STATUS_ID_AVAILABLE; - - /* - * TODO: Figure out the idle time by getting the "away" - * field from the DNS SD. - */ - - /* Make sure the Bonjour group exists in our buddy list */ - group = purple_find_group(BONJOUR_GROUP_NAME); /* Use the buddy's domain, instead? */ - if (group == NULL) { - group = purple_group_new(BONJOUR_GROUP_NAME); - purple_blist_add_group(group, NULL); - } - - /* Make sure the buddy exists in our buddy list */ - if (buddy == NULL) - buddy = purple_find_buddy(account, bonjour_buddy->name); - - if (buddy == NULL) { - buddy = purple_buddy_new(account, bonjour_buddy->name, NULL); - purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); - purple_blist_add_buddy(buddy, NULL, group, NULL); - } - - name = purple_buddy_get_name(buddy); - purple_buddy_set_protocol_data(buddy, bonjour_buddy); - - /* Create the alias for the buddy using the first and the last name */ - if (bonjour_buddy->nick && *bonjour_buddy->nick) - serv_got_alias(purple_account_get_connection(account), name, bonjour_buddy->nick); - else { - gchar *alias = NULL; - const char *first, *last; - first = bonjour_buddy->first; - last = bonjour_buddy->last; - if ((first && *first) || (last && *last)) - alias = g_strdup_printf("%s%s%s", - (first && *first ? first : ""), - (first && *first && last && *last ? " " : ""), - (last && *last ? last : "")); - serv_got_alias(purple_account_get_connection(account), name, alias); - g_free(alias); - } - - /* Set the user's status */ - if (bonjour_buddy->msg != NULL) - purple_prpl_got_user_status(account, name, status_id, - "message", bonjour_buddy->msg, NULL); - else - purple_prpl_got_user_status(account, name, status_id, NULL); - - purple_prpl_got_user_idle(account, name, FALSE, 0); - - /* TODO: Because we don't save Bonjour buddies in blist.xml, - * we will always have to look up the buddy icon at login time. - * I think we should figure out a way to do something about this. */ - - /* Deal with the buddy icon */ - old_hash = purple_buddy_icons_get_checksum_for_user(buddy); - new_hash = (bonjour_buddy->phsh && *(bonjour_buddy->phsh)) ? bonjour_buddy->phsh : NULL; - if (new_hash && (!old_hash || strcmp(old_hash, new_hash) != 0)) { - /* Look up the new icon data */ - /* TODO: Make sure the hash assigned to the retrieved buddy icon is the same - * as what we looked up. */ - bonjour_dns_sd_retrieve_buddy_icon(bonjour_buddy); - } else if (!new_hash) - purple_buddy_icons_set_for_user(account, name, NULL, 0, NULL); -} - -/** - * The buddy has signed off Bonjour. - * If the buddy is being saved, mark as offline, otherwise delete - */ -void bonjour_buddy_signed_off(PurpleBuddy *pb) { - if (PURPLE_BLIST_NODE_SHOULD_SAVE(pb)) { - purple_prpl_got_user_status(purple_buddy_get_account(pb), - purple_buddy_get_name(pb), "offline", NULL); - bonjour_buddy_delete(purple_buddy_get_protocol_data(pb)); - purple_buddy_set_protocol_data(pb, NULL); - } else { - purple_account_remove_buddy(purple_buddy_get_account(pb), pb, NULL); - purple_blist_remove_buddy(pb); - } -} - -/** - * We got the buddy icon data; deal with it - */ -void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len) { - /* Recalculate the hash instead of using the current phsh to make sure it is accurate for the icon. */ - char *p, *hash; - - if (data == NULL || len == 0) - return; - - /* Take advantage of the fact that we use a SHA-1 hash of the data as the filename. */ - hash = purple_util_get_image_filename(data, len); - - /* Get rid of the extension */ - if (!(p = strchr(hash, '.'))) { - g_free(hash); - return; - } - - *p = '\0'; - - purple_debug_info("bonjour", "Got buddy icon for %s icon hash='%s' phsh='%s'.\n", buddy->name, - hash, buddy->phsh ? buddy->phsh : "(null)"); - - purple_buddy_icons_set_for_user(buddy->account, buddy->name, - g_memdup(data, len), len, hash); - - g_free(hash); -} - -/** - * Deletes a buddy from memory. - */ -void -bonjour_buddy_delete(BonjourBuddy *buddy) -{ - g_free(buddy->name); - while (buddy->ips != NULL) { - g_free(buddy->ips->data); - buddy->ips = g_slist_delete_link(buddy->ips, buddy->ips); - } - g_free(buddy->first); - g_free(buddy->phsh); - g_free(buddy->status); - g_free(buddy->email); - g_free(buddy->last); - g_free(buddy->jid); - g_free(buddy->AIM); - g_free(buddy->vc); - g_free(buddy->msg); - g_free(buddy->ext); - g_free(buddy->nick); - g_free(buddy->node); - g_free(buddy->ver); - - bonjour_jabber_close_conversation(buddy->conversation); - buddy->conversation = NULL; - - /* Clean up any mdns implementation data */ - _mdns_delete_buddy(buddy); - - g_free(buddy); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/buddy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_BUDDY -#define _BONJOUR_BUDDY - -#include - -#include "account.h" -#include "jabber.h" - -typedef struct _BonjourBuddy -{ - PurpleAccount *account; - - gchar *name; - GSList *ips; - gint port_p2pj; - - gchar *first; - gchar *phsh; - gchar *status; - gchar *email; - gchar *last; - gchar *jid; - gchar *AIM; - gchar *vc; - gchar *msg; - gchar *ext; - gchar *nick; - gchar *node; - gchar *ver; - - BonjourJabberConversation *conversation; - - gpointer mdns_impl_data; -} BonjourBuddy; - -static const char *const buddy_TXT_records[] = { - "1st", - "email", - "ext", - "jid", - "last", - "msg", - "nick", - "node", - "phsh", -/* "port.p2pj", Deprecated - MUST ignore */ - "status", -/* "txtvers", Deprecated - hardcoded to 1 */ - "vc", - "ver", - "AIM", /* non standard */ - NULL -}; - -/** - * Creates a new buddy. - */ -BonjourBuddy *bonjour_buddy_new(const gchar *name, PurpleAccount *account); - -/** - * Clear any existing values from the buddy. - * This is called before updating so that we can notice removals - */ -void clear_bonjour_buddy_values(BonjourBuddy *buddy); - -/** - * Sets a value in the BonjourBuddy struct, destroying the old value - */ -void set_bonjour_buddy_value(BonjourBuddy *buddy, const char *record_key, const char *value, guint32 len); - -/** - * Check if all the compulsory buddy data is present. - */ -gboolean bonjour_buddy_check(BonjourBuddy *buddy); - -/** - * If the buddy doesn't previously exists, it is created. Else, its data is changed (???) - * purple_buddy is optional; it saves an additional lookup if we already have it - */ -void bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy, PurpleBuddy *purple_buddy); - -/** - * The buddy has signed off Bonjour. - * If the buddy is being saved, mark as offline, otherwise delete - */ -void bonjour_buddy_signed_off(PurpleBuddy *purple_buddy); - -/** - * We got the buddy icon data; deal with it - */ -void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len); - -/** - * Deletes a buddy from memory. - */ -void bonjour_buddy_delete(BonjourBuddy *buddy); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/* - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include "win32dep.h" -#include "dns_sd_proxy.h" - -#ifndef LINK_DNS_SD_DIRECTLY -static DNSServiceErrorType (DNSSD_API* _DNSServiceAddRecord)(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags, - uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl); -static DNSServiceErrorType (DNSSD_API* _DNSServiceBrowse)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *regtype, const char *domain, DNSServiceBrowseReply callBack, void *context); -static int (DNSSD_API* _DNSServiceConstructFullName)(char *fullName, const char *service, const char *regtype, const char *domain); -static DNSServiceErrorType (DNSSD_API* _DNSServiceProcessResult)(DNSServiceRef sdRef); -static DNSServiceErrorType (DNSSD_API* _DNSServiceQueryRecord)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context); -static void (DNSSD_API* _DNSServiceRefDeallocate)(DNSServiceRef sdRef); -static int (DNSSD_API* _DNSServiceRefSockFD)(DNSServiceRef sdRef); -static DNSServiceErrorType (DNSSD_API* _DNSServiceRegister)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *name, const char *regtype, const char *domain, const char *host, uint16_t port, uint16_t txtLen, - const void *txtRecord, DNSServiceRegisterReply callBack, void *context); -static DNSServiceErrorType (DNSSD_API* _DNSServiceResolve)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, - const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context); -static DNSServiceErrorType (DNSSD_API* _DNSServiceRemoveRecord)(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags); -static DNSServiceErrorType (DNSSD_API* _DNSServiceUpdateRecord)(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, - uint16_t rdlen, const void *rdata, uint32_t ttl); -static void (DNSSD_API* _TXTRecordCreate)(TXTRecordRef *txtRecord, uint16_t bufferLen, void *buffer); -static void (DNSSD_API* _TXTRecordDeallocate)(TXTRecordRef *txtRecord); -static const void * (DNSSD_API* _TXTRecordGetBytesPtr)(const TXTRecordRef *txtRecord); -static int16_t (DNSSD_API* _TXTRecordGetLength)(const TXTRecordRef *txtRecord); -static const void * (DNSSD_API* _TXTRecordGetValuePtr)(uint16_t txtLen, const void *txtRecord, const char *key, uint8_t *valueLen); -static DNSServiceErrorType (DNSSD_API* _TXTRecordSetValue)(TXTRecordRef *txtRecord, const char *key, uint8_t valueSize, const void *value); -#endif - -gboolean dns_sd_available(void) { -#ifndef LINK_DNS_SD_DIRECTLY - static gboolean initialized = FALSE; - static gboolean loaded = FALSE; - - if (!initialized) { - initialized = TRUE; - if ((_DNSServiceAddRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceAddRecord")) - && (_DNSServiceBrowse = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceBrowse")) - && (_DNSServiceConstructFullName = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceConstructFullName")) - && (_DNSServiceProcessResult = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceProcessResult")) - && (_DNSServiceQueryRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceQueryRecord")) - && (_DNSServiceRefDeallocate = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRefDeallocate")) - && (_DNSServiceRefSockFD = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRefSockFD")) - && (_DNSServiceRegister = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRegister")) - && (_DNSServiceResolve = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceResolve")) - && (_DNSServiceRemoveRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRemoveRecord")) - && (_DNSServiceUpdateRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceUpdateRecord")) - && (_TXTRecordCreate = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordCreate")) - && (_TXTRecordDeallocate = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordDeallocate")) - && (_TXTRecordGetBytesPtr = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordGetBytesPtr")) - && (_TXTRecordGetLength = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordGetLength")) - && (_TXTRecordGetValuePtr = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordGetValuePtr")) - && (_TXTRecordSetValue = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordSetValue"))) { - loaded = TRUE; - } - } - return loaded; -#else - return TRUE; -#endif -} - -#ifndef LINK_DNS_SD_DIRECTLY - -DNSServiceErrorType _wpurple_DNSServiceAddRecord(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags, - uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl) { - g_return_val_if_fail(_DNSServiceAddRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceAddRecord)(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl); -} - -DNSServiceErrorType _wpurple_DNSServiceBrowse(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *regtype, const char *domain, DNSServiceBrowseReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceBrowse != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceBrowse)(sdRef, flags, interfaceIndex, regtype, domain, callBack, context); -} - -int _wpurple_DNSServiceConstructFullName(char *fullName, const char *service, const char *regtype, const char *domain) { - g_return_val_if_fail(_DNSServiceConstructFullName != NULL, 0); - return (_DNSServiceConstructFullName)(fullName, service, regtype, domain); -} - -DNSServiceErrorType _wpurple_DNSServiceProcessResult(DNSServiceRef sdRef) { - g_return_val_if_fail(_DNSServiceProcessResult != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceProcessResult)(sdRef); -} - - -DNSServiceErrorType _wpurple_DNSServiceQueryRecord(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceQueryRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceQueryRecord)(sdRef, flags, interfaceIndex, fullname, rrtype, rrclass, callBack, context); -} - -void _wpurple_DNSServiceRefDeallocate(DNSServiceRef sdRef) { - g_return_if_fail(_DNSServiceRefDeallocate != NULL); - (_DNSServiceRefDeallocate)(sdRef); -} - -int _wpurple_DNSServiceRefSockFD(DNSServiceRef sdRef) { - g_return_val_if_fail(_DNSServiceRefSockFD != NULL, -1); - return (_DNSServiceRefSockFD)(sdRef); -} - -DNSServiceErrorType _wpurple_DNSServiceRegister(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *name, const char *regtype, const char *domain, const char *host, uint16_t port, uint16_t txtLen, - const void *txtRecord, DNSServiceRegisterReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceRegister != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceRegister)(sdRef, flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, callBack, context); -} - -DNSServiceErrorType _wpurple_DNSServiceResolve(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, - const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceResolve != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceResolve)(sdRef, flags, interfaceIndex, name, regtype, domain, callBack, context); -} - -DNSServiceErrorType _wpurple_DNSServiceRemoveRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags) { - g_return_val_if_fail(_DNSServiceRemoveRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceRemoveRecord)(sdRef, RecordRef, flags); -} - -DNSServiceErrorType _wpurple_DNSServiceUpdateRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, - uint16_t rdlen, const void *rdata, uint32_t ttl) { - g_return_val_if_fail(_DNSServiceUpdateRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceUpdateRecord)(sdRef, RecordRef, flags, rdlen, rdata, ttl); -} - -void _wpurple_TXTRecordCreate(TXTRecordRef *txtRecord, uint16_t bufferLen, void *buffer) { - g_return_if_fail(_TXTRecordCreate != NULL); - (_TXTRecordCreate)(txtRecord, bufferLen, buffer); -} - -void _wpurple_TXTRecordDeallocate(TXTRecordRef *txtRecord) { - g_return_if_fail(_TXTRecordDeallocate != NULL); - (_TXTRecordDeallocate)(txtRecord); -} - -const void * _wpurple_TXTRecordGetBytesPtr(const TXTRecordRef *txtRecord) { - g_return_val_if_fail(_TXTRecordGetBytesPtr != NULL, NULL); - return (_TXTRecordGetBytesPtr)(txtRecord); -} - -uint16_t _wpurple_TXTRecordGetLength(const TXTRecordRef *txtRecord) { - g_return_val_if_fail(_TXTRecordGetLength != NULL, 0); - return (_TXTRecordGetLength)(txtRecord); -} - -const void * _wpurple_TXTRecordGetValuePtr(uint16_t txtLen, const void *txtRecord, const char *key, uint8_t *valueLen) { - g_return_val_if_fail(_TXTRecordGetValuePtr != NULL, NULL); - return (_TXTRecordGetValuePtr)(txtLen, txtRecord, key, valueLen); -} - -DNSServiceErrorType _wpurple_TXTRecordSetValue(TXTRecordRef *txtRecord, const char *key, uint8_t valueSize, const void *value) { - g_return_val_if_fail(_TXTRecordSetValue != NULL, kDNSServiceErr_Unknown); - return (_TXTRecordSetValue)(txtRecord, key, valueSize, value); -} - -#endif /*LINK_DNS_SD_DIRECTLY*/ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/dns_sd_proxy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ -#ifndef _DNS_SD_PROXY -#define _DNS_SD_PROXY - - -#ifndef _MSC_VER -#include -#endif - -/* fixup to make pidgin compile against win32 bonjour */ -#if defined(_WIN32) && !defined(_MSC_VER) -#define _MSL_STDINT_H -#endif - -#include - -gboolean dns_sd_available(void); - -#ifndef LINK_DNS_SD_DIRECTLY - -DNSServiceErrorType _wpurple_DNSServiceAddRecord(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags, - uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl); -#define DNSServiceAddRecord(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl) \ - _wpurple_DNSServiceAddRecord(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl) - -DNSServiceErrorType _wpurple_DNSServiceBrowse(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *regtype, const char *domain, DNSServiceBrowseReply callBack, void *context); -#define DNSServiceBrowse(sdRef, flags, interfaceIndex, regtype, domain, callBack, context) \ - _wpurple_DNSServiceBrowse(sdRef, flags, interfaceIndex, regtype, domain, callBack, context) - -int _wpurple_DNSServiceConstructFullName(char *fullName, const char *service, const char *regtype, const char *domain); -#define DNSServiceConstructFullName(fullName, service, regtype, domain) \ - _wpurple_DNSServiceConstructFullName(fullName, service, regtype, domain) - -DNSServiceErrorType _wpurple_DNSServiceProcessResult(DNSServiceRef sdRef); -#define DNSServiceProcessResult(sdRef) \ - _wpurple_DNSServiceProcessResult(sdRef); - -DNSServiceErrorType _wpurple_DNSServiceQueryRecord(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context); -#define DNSServiceQueryRecord(sdRef, flags, interfaceIndex, fullname, rrtype, rrclass, callBack, context) \ - _wpurple_DNSServiceQueryRecord(sdRef, flags, interfaceIndex, fullname, rrtype, rrclass, callBack, context) - -void _wpurple_DNSServiceRefDeallocate(DNSServiceRef sdRef); -#define DNSServiceRefDeallocate(sdRef) \ - _wpurple_DNSServiceRefDeallocate(sdRef) - -int _wpurple_DNSServiceRefSockFD(DNSServiceRef sdRef); -#define DNSServiceRefSockFD(sdRef) \ - _wpurple_DNSServiceRefSockFD(sdRef) - -DNSServiceErrorType _wpurple_DNSServiceRegister(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *name, const char *regtype, const char *domain, const char *host, uint16_t port, uint16_t txtLen, - const void *txtRecord, DNSServiceRegisterReply callBack, void *context); -#define DNSServiceRegister(sdRef, flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, callBack, context) \ - _wpurple_DNSServiceRegister(sdRef, flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, callBack, context) - -DNSServiceErrorType _wpurple_DNSServiceResolve(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, - const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context); -#define DNSServiceResolve(sdRef, flags, interfaceIndex, name, regtype, domain, callBack, context) \ - _wpurple_DNSServiceResolve(sdRef, flags, interfaceIndex, name, regtype, domain, callBack, context) - -DNSServiceErrorType _wpurple_DNSServiceRemoveRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags); -#define DNSServiceRemoveRecord(sdRef, RecordRef, flags) \ - _wpurple_DNSServiceRemoveRecord(sdRef, RecordRef, flags) - -DNSServiceErrorType _wpurple_DNSServiceUpdateRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, - uint16_t rdlen, const void *rdata, uint32_t ttl); -#define DNSServiceUpdateRecord(sdRef, RecordRef, flags, rdlen, rdata, ttl) \ - _wpurple_DNSServiceUpdateRecord(sdRef, RecordRef, flags, rdlen, rdata, ttl) - -void _wpurple_TXTRecordCreate(TXTRecordRef *txtRecord, uint16_t bufferLen, void *buffer); -#define TXTRecordCreate(txtRecord, bufferLen, buffer) \ - _wpurple_TXTRecordCreate(txtRecord, bufferLen, buffer) - -void _wpurple_TXTRecordDeallocate(TXTRecordRef *txtRecord); -#define TXTRecordDeallocate(txtRecord) \ - _wpurple_TXTRecordDeallocate(txtRecord) - -const void * _wpurple_TXTRecordGetBytesPtr(const TXTRecordRef *txtRecord); -#define TXTRecordGetBytesPtr(txtRecord) \ - _wpurple_TXTRecordGetBytesPtr(txtRecord) - -uint16_t _wpurple_TXTRecordGetLength(const TXTRecordRef *txtRecord); -#define TXTRecordGetLength(txtRecord) \ - _wpurple_TXTRecordGetLength(txtRecord) - -const void * _wpurple_TXTRecordGetValuePtr(uint16_t txtLen, const void *txtRecord, const char *key, uint8_t *valueLen); -#define TXTRecordGetValuePtr(txtLen, txtRecord, key, valueLen) \ - _wpurple_TXTRecordGetValuePtr(txtLen, txtRecord, key, valueLen) - -DNSServiceErrorType _wpurple_TXTRecordSetValue(TXTRecordRef *txtRecord, const char *key, uint8_t valueSize, const void *value); -#define TXTRecordSetValue(txtRecord, key, valueSize, value) \ - _wpurple_TXTRecordSetValue(txtRecord, key, valueSize, value) - -#endif /*LINK_DNS_SD_DIRECTLY*/ - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1291 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#else -#include "libc_interface.h" -#endif -#include - -/* Solaris */ -#if defined (__SVR4) && defined (__sun) -#include -#endif - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -#include "network.h" -#include "eventloop.h" -#include "connection.h" -#include "blist.h" -#include "xmlnode.h" -#include "debug.h" -#include "notify.h" -#include "util.h" - -#include "jabber.h" -#include "parser.h" -#include "bonjour.h" -#include "buddy.h" -#include "bonjour_ft.h" - -#ifdef _SIZEOF_ADDR_IFREQ -# define HX_SIZE_OF_IFREQ(a) _SIZEOF_ADDR_IFREQ(a) -#else -# define HX_SIZE_OF_IFREQ(a) sizeof(a) -#endif - -#define STREAM_END "" -/* TODO: specify version='1.0' and send stream features */ -#define DOCTYPE "\n" \ - "" - -enum sent_stream_start_types { - NOT_SENT = 0, - PARTIALLY_SENT = 1, - FULLY_SENT = 2 -}; - -static void -xep_iq_parse(xmlnode *packet, PurpleBuddy *pb); - -static BonjourJabberConversation * -bonjour_jabber_conv_new(PurpleBuddy *pb, PurpleAccount *account, const char *ip) { - - BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); - bconv->socket = -1; - bconv->tx_buf = purple_circ_buffer_new(512); - bconv->tx_handler = 0; - bconv->rx_handler = 0; - bconv->pb = pb; - bconv->account = account; - bconv->ip = g_strdup(ip); - - bonjour_parser_setup(bconv); - - return bconv; -} - -static const char * -_font_size_ichat_to_purple(int size) -{ - if (size > 24) { - return "7"; - } else if (size >= 21) { - return "6"; - } else if (size >= 17) { - return "5"; - } else if (size >= 14) { - return "4"; - } else if (size >= 12) { - return "3"; - } else if (size >= 10) { - return "2"; - } - - return "1"; -} - -static gchar * -get_xmlnode_contents(xmlnode *node) -{ - gchar *contents; - - contents = xmlnode_to_str(node, NULL); - - /* we just want the stuff inside - * There isn't stuff exposed in xmlnode.c to do this more cleanly. */ - - if (contents) { - char *bodystart = strchr(contents, '>'); - char *bodyend = bodystart ? strrchr(bodystart, '<') : NULL; - if (bodystart && bodyend && (bodystart + 1) != bodyend) { - *bodyend = '\0'; - memmove(contents, bodystart + 1, (bodyend - bodystart)); - } - } - - return contents; -} - -static void -_jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) -{ - xmlnode *body_node, *html_node, *events_node; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(pb)); - gchar *body = NULL; - gboolean composing_event = FALSE; - - body_node = xmlnode_get_child(message_node, "body"); - html_node = xmlnode_get_child(message_node, "html"); - - if (body_node == NULL && html_node == NULL) { - purple_debug_error("bonjour", "No body or html node found, discarding message.\n"); - return; - } - - events_node = xmlnode_get_child_with_namespace(message_node, "x", "jabber:x:event"); - if (events_node != NULL) { - if (xmlnode_get_child(events_node, "composing") != NULL) - composing_event = TRUE; - if (xmlnode_get_child(events_node, "id") != NULL) { - /* The user is just typing */ - /* TODO: Deal with typing notification */ - return; - } - } - - if (html_node != NULL) { - xmlnode *html_body_node; - - html_body_node = xmlnode_get_child(html_node, "body"); - if (html_body_node != NULL) { - xmlnode *html_body_font_node; - - html_body_font_node = xmlnode_get_child(html_body_node, "font"); - /* Types of messages sent by iChat */ - if (html_body_font_node != NULL) { - gchar *html_body; - const char *font_face, *font_size, *font_color, - *ichat_balloon_color, *ichat_text_color; - - font_face = xmlnode_get_attrib(html_body_font_node, "face"); - /* The absolute iChat font sizes should be converted to 1..7 range */ - font_size = xmlnode_get_attrib(html_body_font_node, "ABSZ"); - if (font_size != NULL) - font_size = _font_size_ichat_to_purple(atoi(font_size)); - font_color = xmlnode_get_attrib(html_body_font_node, "color"); - ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor"); - ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor"); - - html_body = get_xmlnode_contents(html_body_font_node); - - if (html_body == NULL) - /* This is the kind of formatted messages that Purple creates */ - html_body = xmlnode_to_str(html_body_font_node, NULL); - - if (html_body != NULL) { - GString *str = g_string_new("%s", html_body); - - body = g_string_free(str, FALSE); - - g_free(html_body); - } - } - } - } - - /* Compose the message */ - if (body == NULL && body_node != NULL) - body = xmlnode_get_data(body_node); - - if (body == NULL) { - purple_debug_error("bonjour", "No html body or regular body found.\n"); - return; - } - - /* Send the message to the UI */ - serv_got_im(gc, purple_buddy_get_name(pb), body, 0, time(NULL)); - - g_free(body); -} - -struct _match_buddies_by_address_t { - const char *address; - GSList *matched_buddies; -}; - -static void -_match_buddies_by_address(gpointer value, gpointer data) -{ - PurpleBuddy *pb = value; - BonjourBuddy *bb = NULL; - struct _match_buddies_by_address_t *mbba = data; - - bb = purple_buddy_get_protocol_data(pb); - - /* - * If the current PurpleBuddy's data is not null, then continue to determine - * whether one of the buddies IPs matches the target IP. - */ - if (bb != NULL) - { - const char *ip; - GSList *tmp = bb->ips; - - while(tmp) { - ip = tmp->data; - if (ip != NULL && g_ascii_strcasecmp(ip, mbba->address) == 0) { - mbba->matched_buddies = g_slist_prepend(mbba->matched_buddies, pb); - break; - } - tmp = tmp->next; - } - } -} - -static void -_send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleBuddy *pb = data; - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - BonjourJabberConversation *bconv = bb->conversation; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(bconv->tx_buf); - - if (writelen == 0) { - purple_input_remove(bconv->tx_handler); - bconv->tx_handler = 0; - return; - } - - ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - const char *error = g_strerror(errno); - - purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", - purple_buddy_get_name(pb), error ? error : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send message."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return; - } - - purple_circ_buffer_mark_read(bconv->tx_buf, ret); -} - -static gint -_send_data(PurpleBuddy *pb, char *message) -{ - gint ret; - int len = strlen(message); - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - BonjourJabberConversation *bconv = bb->conversation; - - /* If we're not ready to actually send, append it to the buffer */ - if (bconv->tx_handler != 0 - || bconv->connect_data != NULL - || bconv->sent_stream_start != FULLY_SENT - || !bconv->recv_stream_start - || purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { - ret = -1; - errno = EAGAIN; - } else { - ret = send(bconv->socket, message, len, 0); - } - - if (ret == -1 && errno == EAGAIN) - ret = 0; - else if (ret <= 0) { - PurpleConversation *conv; - PurpleAccount *account; - const char *error = g_strerror(errno); - - purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", - purple_buddy_get_name(pb), error ? error : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send message."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return -1; - } - - if (ret < len) { - /* Don't interfere with the stream starting */ - if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start && bconv->tx_handler == 0) - bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, - _send_data_write_cb, pb); - purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret); - } - - return ret; -} - -void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { - - g_return_if_fail(packet != NULL); - g_return_if_fail(pb != NULL); - - if (!strcmp(packet->name, "message")) - _jabber_parse_and_write_message_to_ui(packet, pb); - else if(!strcmp(packet->name, "iq")) - xep_iq_parse(packet, pb); - else - purple_debug_warning("bonjour", "Unknown packet: %s\n", packet->name ? packet->name : "(null)"); -} - -static void bonjour_jabber_stream_ended(BonjourJabberConversation *bconv) { - - /* Inform the user that the conversation has been closed */ - BonjourBuddy *bb = NULL; - const gchar *name = bconv->pb ? purple_buddy_get_name(bconv->pb) : "(unknown)"; - - purple_debug_info("bonjour", "Recieved conversation close notification from %s.\n", name); - - if(bconv->pb != NULL) - bb = purple_buddy_get_protocol_data(bconv->pb); -#if 0 - if(bconv->pb != NULL) { - PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bconv->pb->name, bconv->pb->account); - if (conv != NULL) { - char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - } -#endif - /* Close the socket, clear the watcher and free memory */ - bonjour_jabber_close_conversation(bconv); - if(bb) - bb->conversation = NULL; -} - -static void -_client_socket_handler(gpointer data, gint socket, PurpleInputCondition condition) -{ - BonjourJabberConversation *bconv = data; - gint len, message_length; - static char message[4096]; - - /* Read the data from the socket */ - if ((len = recv(socket, message, sizeof(message) - 1, 0)) == -1) { - /* There have been an error reading from the socket */ - if (errno != EAGAIN) { - const char *err = g_strerror(errno); - - purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); - - bonjour_jabber_close_conversation(bconv); - if (bconv->pb != NULL) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(bconv->pb); - - if(bb != NULL) - bb->conversation = NULL; - } - - /* I guess we really don't need to notify the user. - * If they try to send another message it'll reconnect */ - } - return; - } else if (len == 0) { /* The other end has closed the socket */ - const gchar *name = purple_buddy_get_name(bconv->pb); - purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", (name) ? name : "(unknown)"); - bonjour_jabber_stream_ended(bconv); - return; - } else { - message_length = len; - message[message_length] = '\0'; - - while (message_length > 0 && g_ascii_iscntrl(message[message_length - 1])) { - message[message_length - 1] = '\0'; - message_length--; - } - } - - purple_debug_info("bonjour", "Receive: -%s- %d bytes\n", message, len); - - bonjour_parser_process(bconv, message, message_length); -} - -struct _stream_start_data { - char *msg; -}; - - -static void -_start_stream(gpointer data, gint source, PurpleInputCondition condition) -{ - BonjourJabberConversation *bconv = data; - struct _stream_start_data *ss = bconv->stream_data; - int len, ret; - - len = strlen(ss->msg); - - /* Start Stream */ - ret = send(source, ss->msg, len, 0); - - if (ret == -1 && errno == EAGAIN) - return; - else if (ret <= 0) { - const char *err = g_strerror(errno); - PurpleConversation *conv; - const char *bname = bconv->buddy_name; - BonjourBuddy *bb = NULL; - - if(bconv->pb) { - bb = purple_buddy_get_protocol_data(bconv->pb); - bname = purple_buddy_get_name(bconv->pb); - } - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", - bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bconv); - if(bb != NULL) - bb->conversation = NULL; - - return; - } - - /* This is EXTREMELY unlikely to happen */ - if (ret < len) { - char *tmp = g_strdup(ss->msg + ret); - g_free(ss->msg); - ss->msg = tmp; - return; - } - - g_free(ss->msg); - g_free(ss); - bconv->stream_data = NULL; - - /* Stream started; process the send buffer if there is one */ - purple_input_remove(bconv->tx_handler); - bconv->tx_handler = 0; - bconv->sent_stream_start = FULLY_SENT; - - bonjour_jabber_stream_started(bconv); -} - -static gboolean bonjour_jabber_send_stream_init(BonjourJabberConversation *bconv, int client_socket) -{ - int ret, len; - char *stream_start; - const char *bname = bconv->buddy_name; - - if (bconv->pb != NULL) - bname = purple_buddy_get_name(bconv->pb); - - /* If we have no idea who "to" is, use an empty string. - * If we don't know now, it is because the other side isn't playing nice, so they can't complain. */ - if (bname == NULL) - bname = ""; - - stream_start = g_strdup_printf(DOCTYPE, purple_account_get_username(bconv->account), bname); - len = strlen(stream_start); - - bconv->sent_stream_start = PARTIALLY_SENT; - - /* Start the stream */ - ret = send(client_socket, stream_start, len, 0); - - if (ret == -1 && errno == EAGAIN) - ret = 0; - else if (ret <= 0) { - const char *err = g_strerror(errno); - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", - (*bname) ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - - if (bconv->pb) { - PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - close(client_socket); - g_free(stream_start); - - return FALSE; - } - - /* This is unlikely to happen */ - if (ret < len) { - struct _stream_start_data *ss = g_new(struct _stream_start_data, 1); - ss->msg = g_strdup(stream_start + ret); - bconv->stream_data = ss; - /* Finish sending the stream start */ - bconv->tx_handler = purple_input_add(client_socket, - PURPLE_INPUT_WRITE, _start_stream, bconv); - } else - bconv->sent_stream_start = FULLY_SENT; - - g_free(stream_start); - - return TRUE; -} - -/* This gets called when we've successfully sent our - * AND when we've recieved a */ -void bonjour_jabber_stream_started(BonjourJabberConversation *bconv) { - - if (bconv->sent_stream_start == NOT_SENT && !bonjour_jabber_send_stream_init(bconv, bconv->socket)) { - const char *err = g_strerror(errno); - const char *bname = bconv->buddy_name; - - if (bconv->pb) - bname = purple_buddy_get_name(bconv->pb); - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", - bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - - if (bconv->pb) { - PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - /* We don't want to recieve anything else */ - close(bconv->socket); - bconv->socket = -1; - - /* This must be asynchronous because it destroys the parser and we - * may be in the middle of parsing. - */ - async_bonjour_jabber_close_conversation(bconv); - return; - } - - /* If the stream has been completely started and we know who we're talking to, we can start doing stuff. */ - /* I don't think the circ_buffer can actually contain anything without a buddy being associated, but lets be explicit. */ - if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start - && bconv->pb && purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { - /* Watch for when we can write the buffered messages */ - bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, - _send_data_write_cb, bconv->pb); - /* We can probably write the data right now. */ - _send_data_write_cb(bconv->pb, bconv->socket, PURPLE_INPUT_WRITE); - } - -} - -static void -_server_socket_handler(gpointer data, int server_socket, PurpleInputCondition condition) -{ - BonjourJabber *jdata = data; - struct sockaddr_in their_addr; /* connector's address information */ - socklen_t sin_size = sizeof(struct sockaddr); - int client_socket; - int flags; - char *address_text = NULL; - struct _match_buddies_by_address_t *mbba; - BonjourJabberConversation *bconv; - GSList *buddies; - - /* Check that it is a read condition */ - if (condition != PURPLE_INPUT_READ) - return; - - if ((client_socket = accept(server_socket, (struct sockaddr *)&their_addr, &sin_size)) == -1) - return; - - flags = fcntl(client_socket, F_GETFL); - fcntl(client_socket, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(client_socket, F_SETFD, FD_CLOEXEC); -#endif - - /* Look for the buddy that has opened the conversation and fill information */ - address_text = inet_ntoa(their_addr.sin_addr); - purple_debug_info("bonjour", "Received incoming connection from %s.\n", address_text); - mbba = g_new0(struct _match_buddies_by_address_t, 1); - mbba->address = address_text; - - buddies = purple_find_buddies(jdata->account, NULL); - g_slist_foreach(buddies, _match_buddies_by_address, mbba); - g_slist_free(buddies); - - if (mbba->matched_buddies == NULL) { - purple_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); - g_free(mbba); - close(client_socket); - return; - } - - g_slist_free(mbba->matched_buddies); - g_free(mbba); - - /* We've established that this *could* be from one of our buddies. - * Wait for the stream open to see if that matches too before assigning it. - */ - bconv = bonjour_jabber_conv_new(NULL, jdata->account, address_text); - - /* We wait for the stream start before doing anything else */ - bconv->socket = client_socket; - bconv->rx_handler = purple_input_add(client_socket, PURPLE_INPUT_READ, _client_socket_handler, bconv); - -} - -gint -bonjour_jabber_start(BonjourJabber *jdata) -{ - struct sockaddr_in my_addr; - - /* Open a listening socket for incoming conversations */ - jdata->socket = socket(PF_INET, SOCK_STREAM, 0); - if (jdata->socket < 0) { - gchar *buf = g_strdup_printf(_("Unable to create socket: %s"), - g_strerror(errno)); - purple_connection_error_reason(jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, buf); - g_free(buf); - return -1; - } - - memset(&my_addr, 0, sizeof(struct sockaddr_in)); - my_addr.sin_family = AF_INET; - - /* Try to use the specified port - if it isn't available, use a random port */ - my_addr.sin_port = htons(jdata->port); - if (bind(jdata->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0) - { - purple_debug_info("bonjour", "Unable to bind to specified " - "port %i: %s\n", jdata->port, g_strerror(errno)); - my_addr.sin_port = 0; - if (bind(jdata->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0) - { - gchar *buf = g_strdup_printf(_("Unable to bind socket " - "to port: %s"), g_strerror(errno)); - purple_connection_error_reason(jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, buf); - g_free(buf); - return -1; - } - jdata->port = purple_network_get_port_from_fd(jdata->socket); - } - - /* Attempt to listen on the bound socket */ - if (listen(jdata->socket, 10) != 0) - { - gchar *buf = g_strdup_printf(_("Unable to listen on socket: %s"), - g_strerror(errno)); - purple_connection_error_reason(jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, buf); - g_free(buf); - return -1; - } - -#if 0 - /* TODO: Why isn't this being used? */ - data->socket = purple_network_listen(jdata->port, SOCK_STREAM); - - if (jdata->socket == -1) - { - purple_debug_error("bonjour", "No se ha podido crear el socket\n"); - } -#endif - - /* Open a watcher in the socket we have just opened */ - jdata->watcher_id = purple_input_add(jdata->socket, PURPLE_INPUT_READ, _server_socket_handler, jdata); - - return jdata->port; -} - -static void -_connected_to_buddy(gpointer data, gint source, const gchar *error) -{ - PurpleBuddy *pb = data; - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - - bb->conversation->connect_data = NULL; - - if (source < 0) { - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - - purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", - purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error ? error : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return; - } - - if (!bonjour_jabber_send_stream_init(bb->conversation, source)) { - const char *err = g_strerror(errno); - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n", - purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, err ? err : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - close(source); - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return; - } - - /* Start listening for the stream acknowledgement */ - bb->conversation->socket = source; - bb->conversation->rx_handler = purple_input_add(source, - PURPLE_INPUT_READ, _client_socket_handler, bb->conversation); -} - -void -bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { - PurpleBuddy *pb = NULL; - BonjourBuddy *bb = NULL; - - g_return_if_fail(bconv->ip != NULL); - g_return_if_fail(bconv->pb == NULL); - - pb = purple_find_buddy(bconv->account, bconv->buddy_name); - if (pb && (bb = purple_buddy_get_protocol_data(pb))) { - const char *ip; - GSList *tmp = bb->ips; - - purple_debug_info("bonjour", "Found buddy %s for incoming conversation \"from\" attrib.\n", - purple_buddy_get_name(pb)); - - /* Check that one of the buddy's IPs matches */ - while(tmp) { - ip = tmp->data; - if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; - - purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n", - purple_buddy_get_name(pb), bconv->ip); - - /* Attach conv. to buddy and remove from pending list */ - jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); - - /* Check if the buddy already has a conversation and, if so, replace it */ - if(bb->conversation != NULL && bb->conversation != bconv) - bonjour_jabber_close_conversation(bb->conversation); - - bconv->pb = pb; - bb->conversation = bconv; - - break; - } - tmp = tmp->next; - } - } - - /* We've failed to match a buddy - give up */ - if (bconv->pb == NULL) { - /* This must be asynchronous because it destroys the parser and we - * may be in the middle of parsing. - */ - async_bonjour_jabber_close_conversation(bconv); - } -} - - -void -bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; - struct _match_buddies_by_address_t *mbba; - GSList *buddies; - - mbba = g_new0(struct _match_buddies_by_address_t, 1); - mbba->address = bconv->ip; - - buddies = purple_find_buddies(jdata->account, NULL); - g_slist_foreach(buddies, _match_buddies_by_address, mbba); - g_slist_free(buddies); - - /* If there is exactly one match, use it */ - if(mbba->matched_buddies != NULL) { - if(mbba->matched_buddies->next != NULL) - purple_debug_error("bonjour", "More than one buddy matched for ip %s.\n", bconv->ip); - else { - PurpleBuddy *pb = mbba->matched_buddies->data; - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - - purple_debug_info("bonjour", "Matched buddy %s to incoming conversation using IP (%s)\n", - purple_buddy_get_name(pb), bconv->ip); - - /* Attach conv. to buddy and remove from pending list */ - jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); - - /* Check if the buddy already has a conversation and, if so, replace it */ - if (bb->conversation != NULL && bb->conversation != bconv) - bonjour_jabber_close_conversation(bb->conversation); - - bconv->pb = pb; - bb->conversation = bconv; - } - } else - purple_debug_error("bonjour", "No buddies matched for ip %s.\n", bconv->ip); - - /* We've failed to match a buddy - give up */ - if (bconv->pb == NULL) { - /* This must be asynchronous because it destroys the parser and we - * may be in the middle of parsing. - */ - async_bonjour_jabber_close_conversation(bconv); - } - - g_slist_free(mbba->matched_buddies); - g_free(mbba); -} - -static PurpleBuddy * -_find_or_start_conversation(BonjourJabber *jdata, const gchar *to) -{ - PurpleBuddy *pb = NULL; - BonjourBuddy *bb = NULL; - - g_return_val_if_fail(jdata != NULL, NULL); - g_return_val_if_fail(to != NULL, NULL); - - pb = purple_find_buddy(jdata->account, to); - if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) - /* You can not send a message to an offline buddy */ - return NULL; - - /* Check if there is a previously open conversation */ - if (bb->conversation == NULL) - { - PurpleProxyConnectData *connect_data; - PurpleProxyInfo *proxy_info; - /* For better or worse, use the first IP*/ - const char *ip = bb->ips->data; - - purple_debug_info("bonjour", "Starting conversation with %s\n", to); - - /* Make sure that the account always has a proxy of "none". - * This is kind of dirty, but proxy_connect_none() isn't exposed. */ - proxy_info = purple_account_get_proxy_info(jdata->account); - if (proxy_info == NULL) { - proxy_info = purple_proxy_info_new(); - purple_account_set_proxy_info(jdata->account, proxy_info); - } - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE); - - connect_data = purple_proxy_connect( - purple_account_get_connection(jdata->account), - jdata->account, - ip, bb->port_p2pj, _connected_to_buddy, pb); - - if (connect_data == NULL) { - purple_debug_error("bonjour", "Unable to connect to buddy (%s).\n", to); - return NULL; - } - - bb->conversation = bonjour_jabber_conv_new(pb, jdata->account, ip); - bb->conversation->connect_data = connect_data; - /* We don't want _send_data() to register the tx_handler; - * that neeeds to wait until we're actually connected. */ - bb->conversation->tx_handler = 0; - } - return pb; -} - -int -bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar *body) -{ - xmlnode *message_node, *node, *node2; - gchar *message, *xhtml; - PurpleBuddy *pb; - BonjourBuddy *bb; - int ret; - - pb = _find_or_start_conversation(jdata, to); - if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) { - purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to); - /* You can not send a message to an offline buddy */ - return -10000; - } - - purple_markup_html_to_xhtml(body, &xhtml, &message); - - message_node = xmlnode_new("message"); - xmlnode_set_attrib(message_node, "to", bb->name); - xmlnode_set_attrib(message_node, "from", purple_account_get_username(jdata->account)); - xmlnode_set_attrib(message_node, "type", "chat"); - - /* Enclose the message from the UI within a "font" node */ - node = xmlnode_new_child(message_node, "body"); - xmlnode_insert_data(node, message, strlen(message)); - g_free(message); - - node = xmlnode_new_child(message_node, "html"); - xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml"); - - node = xmlnode_new_child(node, "body"); - message = g_strdup_printf("%s", xhtml); - node2 = xmlnode_from_str(message, strlen(message)); - g_free(xhtml); - g_free(message); - xmlnode_insert_child(node, node2); - - node = xmlnode_new_child(message_node, "x"); - xmlnode_set_namespace(node, "jabber:x:event"); - xmlnode_insert_child(node, xmlnode_new("composing")); - - message = xmlnode_to_str(message_node, NULL); - xmlnode_free(message_node); - - ret = _send_data(pb, message) >= 0; - - g_free(message); - - return ret; -} - -static gboolean -_async_bonjour_jabber_close_conversation_cb(gpointer data) { - BonjourJabberConversation *bconv = data; - bonjour_jabber_close_conversation(bconv); - return FALSE; -} - -void -async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; - - jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); - - /* Disconnect this conv. from the buddy here so it can't be disposed of twice.*/ - if(bconv->pb != NULL) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(bconv->pb); - if (bb->conversation == bconv) - bb->conversation = NULL; - } - - bconv->close_timeout = purple_timeout_add(0, _async_bonjour_jabber_close_conversation_cb, bconv); -} - -void -bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) -{ - if (bconv != NULL) { - BonjourData *bd = NULL; - - if(PURPLE_CONNECTION_IS_VALID(bconv->account->gc)) { - bd = bconv->account->gc->proto_data; - bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv); - } - - /* Cancel any file transfers that are waiting to begin */ - /* There wont be any transfers if it hasn't been attached to a buddy */ - if (bconv->pb != NULL && bd != NULL) { - GSList *xfers, *tmp_next; - xfers = bd->xfer_lists; - while(xfers != NULL) { - PurpleXfer *xfer = xfers->data; - tmp_next = xfers->next; - /* We only need to cancel this if it hasn't actually started transferring. */ - /* This will change if we ever support IBB transfers. */ - if (strcmp(xfer->who, purple_buddy_get_name(bconv->pb)) == 0 - && (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_NOT_STARTED - || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_UNKNOWN)) { - purple_xfer_cancel_remote(xfer); - } - xfers = tmp_next; - } - } - - /* Close the socket and remove the watcher */ - if (bconv->socket >= 0) { - /* Send the end of the stream to the other end of the conversation */ - if (bconv->sent_stream_start == FULLY_SENT) - send(bconv->socket, STREAM_END, strlen(STREAM_END), 0); - /* TODO: We're really supposed to wait for "" before closing the socket */ - close(bconv->socket); - } - if (bconv->rx_handler != 0) - purple_input_remove(bconv->rx_handler); - if (bconv->tx_handler > 0) - purple_input_remove(bconv->tx_handler); - - /* Free all the data related to the conversation */ - purple_circ_buffer_destroy(bconv->tx_buf); - if (bconv->connect_data != NULL) - purple_proxy_connect_cancel(bconv->connect_data); - if (bconv->stream_data != NULL) { - struct _stream_start_data *ss = bconv->stream_data; - g_free(ss->msg); - g_free(ss); - } - - if (bconv->context != NULL) - bonjour_parser_setup(bconv); - - if (bconv->close_timeout != 0) - purple_timeout_remove(bconv->close_timeout); - - g_free(bconv->buddy_name); - g_free(bconv->ip); - g_free(bconv); - } -} - -void -bonjour_jabber_stop(BonjourJabber *jdata) -{ - /* Close the server socket and remove the watcher */ - if (jdata->socket >= 0) - close(jdata->socket); - if (jdata->watcher_id > 0) - purple_input_remove(jdata->watcher_id); - - /* Close all the conversation sockets and remove all the watchers after sending end streams */ - if (jdata->account->gc != NULL) { - GSList *buddies, *l; - - buddies = purple_find_buddies(jdata->account, NULL); - for (l = buddies; l; l = l->next) { - BonjourBuddy *bb = purple_buddy_get_protocol_data((PurpleBuddy*) l->data); - if (bb != NULL) { - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - } - } - - g_slist_free(buddies); - } - - while (jdata->pending_conversations != NULL) { - bonjour_jabber_close_conversation(jdata->pending_conversations->data); - jdata->pending_conversations = g_slist_delete_link(jdata->pending_conversations, jdata->pending_conversations); - } -} - -XepIq * -xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id) -{ - xmlnode *iq_node = NULL; - XepIq *iq = NULL; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(to != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - iq_node = xmlnode_new("iq"); - - xmlnode_set_attrib(iq_node, "to", to); - xmlnode_set_attrib(iq_node, "from", from); - xmlnode_set_attrib(iq_node, "id", id); - switch (type) { - case XEP_IQ_SET: - xmlnode_set_attrib(iq_node, "type", "set"); - break; - case XEP_IQ_GET: - xmlnode_set_attrib(iq_node, "type", "get"); - break; - case XEP_IQ_RESULT: - xmlnode_set_attrib(iq_node, "type", "result"); - break; - case XEP_IQ_ERROR: - xmlnode_set_attrib(iq_node, "type", "error"); - break; - case XEP_IQ_NONE: - default: - xmlnode_set_attrib(iq_node, "type", "none"); - break; - } - - iq = g_new0(XepIq, 1); - iq->node = iq_node; - iq->type = type; - iq->data = ((BonjourData*)data)->jabber_data; - iq->to = (char*)to; - - return iq; -} - -static gboolean -check_if_blocked(PurpleBuddy *pb) -{ - gboolean blocked = FALSE; - GSList *l = NULL; - PurpleAccount *acc = purple_buddy_get_account(pb); - - if(acc == NULL) - return FALSE; - - acc = purple_buddy_get_account(pb); - - for(l = acc->deny; l != NULL; l = l->next) { - const gchar *name = purple_buddy_get_name(pb); - const gchar *username = purple_account_get_username(acc); - - if(!purple_utf8_strcasecmp(name, (char *)l->data)) { - purple_debug_info("bonjour", "%s has been blocked by %s.\n", name, username); - blocked = TRUE; - break; - } - } - return blocked; -} - -static void -xep_iq_parse(xmlnode *packet, PurpleBuddy *pb) -{ - xmlnode *child; - PurpleAccount *account; - PurpleConnection *gc; - - if(check_if_blocked(pb)) - return; - - account = purple_buddy_get_account(pb); - gc = purple_account_get_connection(account); - - if ((child = xmlnode_get_child(packet, "si")) || (child = xmlnode_get_child(packet, "error"))) - xep_si_parse(gc, packet, pb); - else - xep_bytestreams_parse(gc, packet, pb); -} - -int -xep_iq_send_and_free(XepIq *iq) -{ - int ret = -1; - PurpleBuddy *pb = NULL; - - /* start the talk, reuse the message socket */ - pb = _find_or_start_conversation((BonjourJabber*) iq->data, iq->to); - /* Send the message */ - if (pb != NULL) { - /* Convert xml node into stream */ - gchar *msg = xmlnode_to_str(iq->node, NULL); - ret = _send_data(pb, msg); - g_free(msg); - } - - xmlnode_free(iq->node); - iq->node = NULL; - g_free(iq); - - return (ret >= 0) ? 0 : -1; -} - -/* This returns a ';' delimited string containing all non-localhost IPs */ -const char * -purple_network_get_my_ip_ext2(int fd) -{ - char buffer[1024]; - static char ip_ext[17 * 10]; - char *tmp; - char *tip; - struct ifconf ifc; - struct ifreq *ifr; - struct sockaddr_in *sinptr; - guint32 lhost = htonl(127 * 256 * 256 * 256 + 1); - long unsigned int add; - int source = fd; - int len, count = 0; - - if (fd < 0) - source = socket(PF_INET, SOCK_STREAM, 0); - - ifc.ifc_len = sizeof(buffer); - ifc.ifc_req = (struct ifreq *)buffer; - ioctl(source, SIOCGIFCONF, &ifc); - - if (fd < 0) - close(source); - - memset(ip_ext, 0, sizeof(ip_ext)); - memcpy(ip_ext, "0.0.0.0", 7); - tmp = buffer; - tip = ip_ext; - while (tmp < buffer + ifc.ifc_len && count < 10) - { - ifr = (struct ifreq *)tmp; - tmp += HX_SIZE_OF_IFREQ(*ifr); - - if (ifr->ifr_addr.sa_family == AF_INET) - { - sinptr = (struct sockaddr_in *)&ifr->ifr_addr; - if (sinptr->sin_addr.s_addr != lhost) - { - add = ntohl(sinptr->sin_addr.s_addr); - len = g_snprintf(tip, 17, "%lu.%lu.%lu.%lu;", - ((add >> 24) & 255), - ((add >> 16) & 255), - ((add >> 8) & 255), - add & 255); - tip = &tip[len]; - count++; - continue; - } - } - } - - return ip_ext; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/jabber.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/** - * @file jabber.h The Purple interface to mDNS and peer to peer Jabber. - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _BONJOUR_JABBER_H_ -#define _BONJOUR_JABBER_H_ - -#include - -#include "xmlnode.h" - -#include "account.h" -#include "circbuffer.h" - -typedef struct _BonjourJabber -{ - gint port; - gint socket; - gint watcher_id; - PurpleAccount *account; - GSList *pending_conversations; -} BonjourJabber; - -typedef struct _BonjourJabberConversation -{ - gint socket; - guint rx_handler; - guint tx_handler; - guint close_timeout; - PurpleCircBuffer *tx_buf; - int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */ - gboolean recv_stream_start; - PurpleProxyConnectData *connect_data; - gpointer stream_data; - xmlParserCtxt *context; - xmlnode *current; - PurpleBuddy *pb; - PurpleAccount *account; - - /* The following are only needed before attaching to a PurpleBuddy */ - gchar *buddy_name; - gchar *ip; -} BonjourJabberConversation; - -/** - * Start listening for jabber connections. - * - * @return -1 if there was a problem, else returns the listening - * port number. - */ -gint bonjour_jabber_start(BonjourJabber *data); - -int bonjour_jabber_send_message(BonjourJabber *data, const char *to, const char *body); - -void bonjour_jabber_close_conversation(BonjourJabberConversation *bconv); - -void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv); - -void bonjour_jabber_stream_started(BonjourJabberConversation *bconv); - -void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet); - -void bonjour_jabber_stop(BonjourJabber *data); - -void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv); - -void bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv); - -typedef enum { - XEP_IQ_SET, - XEP_IQ_GET, - XEP_IQ_RESULT, - XEP_IQ_ERROR, - XEP_IQ_NONE -} XepIqType; - -typedef struct _XepIq { - XepIqType type; - char *id; - xmlnode *node; - char *to; - void *data; -} XepIq; - -XepIq *xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id); -int xep_iq_send_and_free(XepIq *iq); -const char *purple_network_get_my_ip_ext2(int fd); - -#endif /* _BONJOUR_JABBER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -EXTRA_DIST = \ - mdns_win32.c \ - dns_sd_proxy.c \ - dns_sd_proxy.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -BONJOURSOURCES = \ - bonjour.c \ - bonjour.h \ - buddy.c \ - buddy.h \ - jabber.c \ - jabber.h \ - mdns_avahi.c \ - mdns_common.c \ - mdns_common.h \ - mdns_interface.h \ - mdns_types.h \ - parser.c \ - parser.h \ - bonjour_ft.c \ - bonjour_ft.h - -AM_CFLAGS = $(st) - -libbonjour_la_LDFLAGS = -module -avoid-version - -if STATIC_BONJOUR - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libbonjour.la -libbonjour_la_SOURCES = $(BONJOURSOURCES) -libbonjour_la_CFLAGS = $(AM_CFLAGS) -libbonjour_la_LIBADD = $(AVAHI_LIBS) - -else - -st = -pkg_LTLIBRARIES = libbonjour.la -libbonjour_la_SOURCES = $(BONJOURSOURCES) -libbonjour_la_LIBADD = $(GLIB_LIBS) $(LIBXML_LIBS) $(AVAHI_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(LIBXML_CFLAGS) \ - $(AVAHI_CFLAGS) \ No newline at end of file diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,816 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/bonjour -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_BONJOUR_FALSE@libbonjour_la_DEPENDENCIES = \ -@STATIC_BONJOUR_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_BONJOUR_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_BONJOUR_FALSE@ $(am__DEPENDENCIES_1) -@STATIC_BONJOUR_TRUE@libbonjour_la_DEPENDENCIES = \ -@STATIC_BONJOUR_TRUE@ $(am__DEPENDENCIES_1) -am__libbonjour_la_SOURCES_DIST = bonjour.c bonjour.h buddy.c buddy.h \ - jabber.c jabber.h mdns_avahi.c mdns_common.c mdns_common.h \ - mdns_interface.h mdns_types.h parser.c parser.h bonjour_ft.c \ - bonjour_ft.h -am__objects_1 = libbonjour_la-bonjour.lo libbonjour_la-buddy.lo \ - libbonjour_la-jabber.lo libbonjour_la-mdns_avahi.lo \ - libbonjour_la-mdns_common.lo libbonjour_la-parser.lo \ - libbonjour_la-bonjour_ft.lo -@STATIC_BONJOUR_FALSE@am_libbonjour_la_OBJECTS = $(am__objects_1) -@STATIC_BONJOUR_TRUE@am_libbonjour_la_OBJECTS = $(am__objects_1) -libbonjour_la_OBJECTS = $(am_libbonjour_la_OBJECTS) -@STATIC_BONJOUR_FALSE@am_libbonjour_la_rpath = -rpath $(pkgdir) -@STATIC_BONJOUR_TRUE@am_libbonjour_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libbonjour_la_SOURCES) -DIST_SOURCES = $(am__libbonjour_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - mdns_win32.c \ - dns_sd_proxy.c \ - dns_sd_proxy.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -BONJOURSOURCES = \ - bonjour.c \ - bonjour.h \ - buddy.c \ - buddy.h \ - jabber.c \ - jabber.h \ - mdns_avahi.c \ - mdns_common.c \ - mdns_common.h \ - mdns_interface.h \ - mdns_types.h \ - parser.c \ - parser.h \ - bonjour_ft.c \ - bonjour_ft.h - -AM_CFLAGS = $(st) -libbonjour_la_LDFLAGS = -module -avoid-version -@STATIC_BONJOUR_FALSE@st = -@STATIC_BONJOUR_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_BONJOUR_TRUE@noinst_LTLIBRARIES = libbonjour.la -@STATIC_BONJOUR_FALSE@libbonjour_la_SOURCES = $(BONJOURSOURCES) -@STATIC_BONJOUR_TRUE@libbonjour_la_SOURCES = $(BONJOURSOURCES) -@STATIC_BONJOUR_TRUE@libbonjour_la_CFLAGS = $(AM_CFLAGS) -@STATIC_BONJOUR_FALSE@libbonjour_la_LIBADD = $(GLIB_LIBS) $(LIBXML_LIBS) $(AVAHI_LIBS) -@STATIC_BONJOUR_TRUE@libbonjour_la_LIBADD = $(AVAHI_LIBS) -@STATIC_BONJOUR_FALSE@pkg_LTLIBRARIES = libbonjour.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(LIBXML_CFLAGS) \ - $(AVAHI_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/bonjour/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/bonjour/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libbonjour.la: $(libbonjour_la_OBJECTS) $(libbonjour_la_DEPENDENCIES) - $(LINK) $(am_libbonjour_la_rpath) $(libbonjour_la_LDFLAGS) $(libbonjour_la_OBJECTS) $(libbonjour_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-bonjour.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-bonjour_ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-jabber.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-mdns_avahi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-mdns_common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-parser.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libbonjour_la-bonjour.lo: bonjour.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-bonjour.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-bonjour.Tpo" -c -o libbonjour_la-bonjour.lo `test -f 'bonjour.c' || echo '$(srcdir)/'`bonjour.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-bonjour.Tpo" "$(DEPDIR)/libbonjour_la-bonjour.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-bonjour.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bonjour.c' object='libbonjour_la-bonjour.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-bonjour.lo `test -f 'bonjour.c' || echo '$(srcdir)/'`bonjour.c - -libbonjour_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-buddy.Tpo" -c -o libbonjour_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-buddy.Tpo" "$(DEPDIR)/libbonjour_la-buddy.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libbonjour_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libbonjour_la-jabber.lo: jabber.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-jabber.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-jabber.Tpo" -c -o libbonjour_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-jabber.Tpo" "$(DEPDIR)/libbonjour_la-jabber.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-jabber.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jabber.c' object='libbonjour_la-jabber.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c - -libbonjour_la-mdns_avahi.lo: mdns_avahi.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-mdns_avahi.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-mdns_avahi.Tpo" -c -o libbonjour_la-mdns_avahi.lo `test -f 'mdns_avahi.c' || echo '$(srcdir)/'`mdns_avahi.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-mdns_avahi.Tpo" "$(DEPDIR)/libbonjour_la-mdns_avahi.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-mdns_avahi.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mdns_avahi.c' object='libbonjour_la-mdns_avahi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-mdns_avahi.lo `test -f 'mdns_avahi.c' || echo '$(srcdir)/'`mdns_avahi.c - -libbonjour_la-mdns_common.lo: mdns_common.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-mdns_common.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-mdns_common.Tpo" -c -o libbonjour_la-mdns_common.lo `test -f 'mdns_common.c' || echo '$(srcdir)/'`mdns_common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-mdns_common.Tpo" "$(DEPDIR)/libbonjour_la-mdns_common.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-mdns_common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mdns_common.c' object='libbonjour_la-mdns_common.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-mdns_common.lo `test -f 'mdns_common.c' || echo '$(srcdir)/'`mdns_common.c - -libbonjour_la-parser.lo: parser.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-parser.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-parser.Tpo" -c -o libbonjour_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-parser.Tpo" "$(DEPDIR)/libbonjour_la-parser.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-parser.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parser.c' object='libbonjour_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c - -libbonjour_la-bonjour_ft.lo: bonjour_ft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-bonjour_ft.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-bonjour_ft.Tpo" -c -o libbonjour_la-bonjour_ft.lo `test -f 'bonjour_ft.c' || echo '$(srcdir)/'`bonjour_ft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-bonjour_ft.Tpo" "$(DEPDIR)/libbonjour_la-bonjour_ft.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-bonjour_ft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bonjour_ft.c' object='libbonjour_la-bonjour_ft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-bonjour_ft.lo `test -f 'bonjour_ft.c' || echo '$(srcdir)/'`bonjour_ft.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libbonjour -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libbonjour -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -CFLAGS += -DUSE_BONJOUR_APPLE - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(BONJOUR_TOP)/Include \ - -I$(LIBXML2_TOP)/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(LIBXML2_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = bonjour.c \ - bonjour_ft.c \ - buddy.c \ - dns_sd_proxy.c \ - jabber.c \ - mdns_common.c \ - mdns_win32.c \ - parser.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lnetapi32 \ - -lxml2 \ - -lpurple - -ifeq ($(LINK_DNS_SD_DIRECTLY), 1) - CFLAGS += -DLINK_DNS_SD_DIRECTLY - LIB_PATHS += -L$(BONJOUR_TOP)/lib/win32 -L$(BONJOUR_TOP)/lib - LIBS += -ldnssd -endif - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_avahi.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_avahi.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_avahi.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_avahi.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,636 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include "internal.h" - -#include "mdns_interface.h" -#include "debug.h" -#include "buddy.h" -#include "bonjour.h" - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -/* Avahi only defines the types that it actually uses (which at this time doesn't include NULL) */ -#ifndef AVAHI_DNS_TYPE_NULL -#define AVAHI_DNS_TYPE_NULL 0x0A -#endif - -/* data used by avahi bonjour implementation */ -typedef struct _avahi_session_impl_data { - AvahiClient *client; - AvahiGLibPoll *glib_poll; - AvahiServiceBrowser *sb; - AvahiEntryGroup *group; - AvahiEntryGroup *buddy_icon_group; -} AvahiSessionImplData; - -typedef struct _avahi_buddy_service_resolver_data { - AvahiServiceResolver *resolver; - AvahiIfIndex interface; - AvahiProtocol protocol; - gchar *name; - gchar *type; - gchar *domain; - /* This is a reference to the entry in BonjourBuddy->ips */ - const char *ip; -} AvahiSvcResolverData; - -typedef struct _avahi_buddy_impl_data { - GSList *resolvers; - AvahiRecordBrowser *buddy_icon_rec_browser; -} AvahiBuddyImplData; - -static gint -_find_resolver_data(gconstpointer a, gconstpointer b) { - const AvahiSvcResolverData *rd_a = a; - const AvahiSvcResolverData *rd_b = b; - gint ret = 1; - - if(rd_a->interface == rd_b->interface - && rd_a->protocol == rd_b->protocol - && !strcmp(rd_a->name, rd_b->name) - && !strcmp(rd_a->type, rd_b->type) - && !strcmp(rd_a->domain, rd_b->domain)) { - ret = 0; - } - - return ret; -} - -static gint -_find_resolver_data_by_resolver(gconstpointer a, gconstpointer b) { - const AvahiSvcResolverData *rd_a = a; - const AvahiServiceResolver *resolver = b; - gint ret = 1; - - if(rd_a->resolver == resolver) - ret = 0; - - return ret; -} - -static void -_cleanup_resolver_data(AvahiSvcResolverData *rd) { - if (rd->resolver) - avahi_service_resolver_free(rd->resolver); - g_free(rd->name); - g_free(rd->type); - g_free(rd->domain); - g_free(rd); -} - - -static void -_resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, - AvahiResolverEvent event, const char *name, const char *type, const char *domain, - const char *host_name, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, - AvahiLookupResultFlags flags, void *userdata) { - - PurpleBuddy *pb; - BonjourBuddy *bb; - PurpleAccount *account = userdata; - AvahiStringList *l; - size_t size; - char *key, *value; - int ret; - char ip[AVAHI_ADDRESS_STR_MAX]; - AvahiBuddyImplData *b_impl; - AvahiSvcResolverData *rd; - GSList *res; - - g_return_if_fail(r != NULL); - - pb = purple_find_buddy(account, name); - bb = (pb != NULL) ? purple_buddy_get_protocol_data(pb) : NULL; - - switch (event) { - case AVAHI_RESOLVER_FAILURE: - purple_debug_error("bonjour", "_resolve_callback - Failure: %s\n", - avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r)))); - - avahi_service_resolver_free(r); - if (bb != NULL) { - b_impl = bb->mdns_impl_data; - res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver); - if (res != NULL) { - rd = res->data; - b_impl->resolvers = g_slist_remove_link(b_impl->resolvers, res); - - /* We've already freed the resolver */ - rd->resolver = NULL; - _cleanup_resolver_data(rd); - - /* If this was the last resolver, remove the buddy */ - if (b_impl->resolvers == NULL) - bonjour_buddy_signed_off(pb); - } - } - break; - case AVAHI_RESOLVER_FOUND: - - purple_debug_info("bonjour", "_resolve_callback - name:%s account:%p bb:%p\n", - name, account, bb); - - /* create a buddy record */ - if (bb == NULL) - bb = bonjour_buddy_new(name, account); - b_impl = bb->mdns_impl_data; - - /* If we're reusing an existing buddy, it may be a new resolver or an existing one. */ - res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver); - if (res != NULL) - rd = res->data; - else { - rd = g_new0(AvahiSvcResolverData, 1); - rd->resolver = r; - rd->interface = interface; - rd->protocol = protocol; - rd->name = g_strdup(name); - rd->type = g_strdup(type); - rd->domain = g_strdup(domain); - - b_impl->resolvers = g_slist_prepend(b_impl->resolvers, rd); - } - - - /* Get the ip as a string */ - ip[0] = '\0'; - avahi_address_snprint(ip, AVAHI_ADDRESS_STR_MAX, a); - - purple_debug_info("bonjour", "_resolve_callback - name:%s ip:%s prev_ip:%s\n", - name, ip, rd->ip); - - if (rd->ip == NULL || strcmp(rd->ip, ip) != 0) { - /* We store duplicates in bb->ips, so we always remove the one */ - if (rd->ip != NULL) { - bb->ips = g_slist_remove(bb->ips, rd->ip); - g_free((gchar *) rd->ip); - } - bb->ips = g_slist_prepend(bb->ips, g_strdup(ip)); - rd->ip = bb->ips->data; - } - - bb->port_p2pj = port; - - /* Obtain the parameters from the text_record */ - clear_bonjour_buddy_values(bb); - for(l = txt; l != NULL; l = l->next) { - if ((ret = avahi_string_list_get_pair(l, &key, &value, &size)) < 0) - continue; - set_bonjour_buddy_value(bb, key, value, size); - /* TODO: Since we're using the glib allocator, I think we - * can use the values instead of re-copying them */ - avahi_free(key); - avahi_free(value); - } - - if (!bonjour_buddy_check(bb)) { - b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd); - _cleanup_resolver_data(rd); - /* If this was the last resolver, remove the buddy */ - if (b_impl->resolvers == NULL) { - if (pb != NULL) - bonjour_buddy_signed_off(pb); - else - bonjour_buddy_delete(bb); - } - } else - /* Add or update the buddy in our buddy list */ - bonjour_buddy_add_to_purple(bb, pb); - - break; - default: - purple_debug_info("bonjour", "Unrecognized Service Resolver event: %d.\n", event); - } - -} - -static void -_browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, - AvahiProtocol protocol, AvahiBrowserEvent event, - const char *name, const char *type, const char *domain, - AvahiLookupResultFlags flags, void *userdata) { - - PurpleAccount *account = userdata; - PurpleBuddy *pb = NULL; - - switch (event) { - case AVAHI_BROWSER_FAILURE: - purple_debug_error("bonjour", "_browser_callback - Failure: %s\n", - avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); - /* TODO: This is an error that should be handled. */ - break; - case AVAHI_BROWSER_NEW: - /* A new peer has joined the network and uses iChat bonjour */ - purple_debug_info("bonjour", "_browser_callback - new service\n"); - /* Make sure it isn't us */ - if (purple_utf8_strcasecmp(name, account->username) != 0) { - if (!avahi_service_resolver_new(avahi_service_browser_get_client(b), - interface, protocol, name, type, domain, AVAHI_PROTO_INET, - 0, _resolver_callback, account)) { - purple_debug_warning("bonjour", "_browser_callback -- Error initiating resolver: %s\n", - avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); - } - } - break; - case AVAHI_BROWSER_REMOVE: - purple_debug_info("bonjour", "_browser_callback - Remove service\n"); - pb = purple_find_buddy(account, name); - if (pb != NULL) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - AvahiBuddyImplData *b_impl; - GSList *l; - AvahiSvcResolverData *rd_search; - - g_return_if_fail(bb != NULL); - - b_impl = bb->mdns_impl_data; - - /* There may be multiple presences, we should only get rid of this one */ - - rd_search = g_new0(AvahiSvcResolverData, 1); - rd_search->interface = interface; - rd_search->protocol = protocol; - rd_search->name = (gchar *) name; - rd_search->type = (gchar *) type; - rd_search->domain = (gchar *) domain; - - l = g_slist_find_custom(b_impl->resolvers, rd_search, _find_resolver_data); - - g_free(rd_search); - - if (l != NULL) { - AvahiSvcResolverData *rd = l->data; - b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd); - /* This IP is no longer available */ - if (rd->ip != NULL) { - bb->ips = g_slist_remove(bb->ips, rd->ip); - g_free((gchar *) rd->ip); - } - _cleanup_resolver_data(rd); - - /* If this was the last resolver, remove the buddy */ - if (b_impl->resolvers == NULL) - bonjour_buddy_signed_off(pb); - } - } - break; - case AVAHI_BROWSER_ALL_FOR_NOW: - case AVAHI_BROWSER_CACHE_EXHAUSTED: - break; - default: - purple_debug_info("bonjour", "Unrecognized Service browser event: %d.\n", event); - } -} - -static void -_buddy_icon_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { - BonjourDnsSd *data = userdata; - AvahiSessionImplData *idata = data->mdns_impl_data; - - g_return_if_fail(g == idata->buddy_icon_group || idata->buddy_icon_group == NULL); - - switch(state) { - case AVAHI_ENTRY_GROUP_ESTABLISHED: - purple_debug_info("bonjour", "Successfully registered buddy icon data.\n"); - break; - case AVAHI_ENTRY_GROUP_COLLISION: - purple_debug_error("bonjour", "Collision registering buddy icon data.\n"); - break; - case AVAHI_ENTRY_GROUP_FAILURE: - purple_debug_error("bonjour", "Error registering buddy icon data: %s.\n", - avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); - break; - case AVAHI_ENTRY_GROUP_UNCOMMITED: - case AVAHI_ENTRY_GROUP_REGISTERING: - break; - } - -} - -static void -_entry_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { - AvahiSessionImplData *idata = userdata; - - g_return_if_fail(g == idata->group || idata->group == NULL); - - switch(state) { - case AVAHI_ENTRY_GROUP_ESTABLISHED: - purple_debug_info("bonjour", "Successfully registered service.\n"); - break; - case AVAHI_ENTRY_GROUP_COLLISION: - purple_debug_error("bonjour", "Collision registering entry group.\n"); - /* TODO: Handle error - this should log out the account. (Possibly with "wants to die")*/ - break; - case AVAHI_ENTRY_GROUP_FAILURE: - purple_debug_error("bonjour", "Error registering entry group: %s\n.", - avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); - /* TODO: Handle error - this should log out the account.*/ - break; - case AVAHI_ENTRY_GROUP_UNCOMMITED: - case AVAHI_ENTRY_GROUP_REGISTERING: - break; - } - -} - -static void -_buddy_icon_record_cb(AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, - AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type, - const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata) { - BonjourBuddy *buddy = userdata; - AvahiBuddyImplData *idata = buddy->mdns_impl_data; - - switch (event) { - case AVAHI_BROWSER_CACHE_EXHAUSTED: - case AVAHI_BROWSER_ALL_FOR_NOW: - /* Ignore these "meta" informational events */ - return; - case AVAHI_BROWSER_NEW: - bonjour_buddy_got_buddy_icon(buddy, rdata, size); - break; - case AVAHI_BROWSER_REMOVE: - case AVAHI_BROWSER_FAILURE: - purple_debug_error("bonjour", "Error retrieving buddy icon record: %s\n", - avahi_strerror(avahi_client_errno(avahi_record_browser_get_client(b)))); - break; - } - - /* Stop listening */ - avahi_record_browser_free(b); - if (idata->buddy_icon_rec_browser == b) { - idata->buddy_icon_rec_browser = NULL; - } -} - -/**************************** - * mdns_interface functions * - ****************************/ - -gboolean _mdns_init_session(BonjourDnsSd *data) { - AvahiSessionImplData *idata = g_new0(AvahiSessionImplData, 1); - const AvahiPoll *poll_api; - int error; - - /* Tell avahi to use g_malloc and g_free */ - avahi_set_allocator (avahi_glib_allocator ()); - - /* This currently depends on the glib mainloop, - * we should make it use the libpurple abstraction */ - - idata->glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT); - - poll_api = avahi_glib_poll_get(idata->glib_poll); - - idata->client = avahi_client_new(poll_api, 0, NULL, data, &error); - - if (idata->client == NULL) { - purple_debug_error("bonjour", "Error initializing Avahi: %s\n", avahi_strerror(error)); - avahi_glib_poll_free(idata->glib_poll); - g_free(idata); - return FALSE; - } - - data->mdns_impl_data = idata; - - return TRUE; -} - -gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records) { - int publish_result = 0; - AvahiSessionImplData *idata = data->mdns_impl_data; - AvahiStringList *lst = NULL; - - g_return_val_if_fail(idata != NULL, FALSE); - - if (!idata->group) { - idata->group = avahi_entry_group_new(idata->client, - _entry_group_cb, idata); - if (!idata->group) { - purple_debug_error("bonjour", - "Unable to initialize the data for the mDNS (%s).\n", - avahi_strerror(avahi_client_errno(idata->client))); - return FALSE; - } - } - - while (records) { - PurpleKeyValuePair *kvp = records->data; - lst = avahi_string_list_add_pair(lst, kvp->key, kvp->value); - records = records->next; - } - - /* Publish the service */ - switch (type) { - case PUBLISH_START: - publish_result = avahi_entry_group_add_service_strlst( - idata->group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, 0, - purple_account_get_username(data->account), - LINK_LOCAL_RECORD_NAME, NULL, NULL, data->port_p2pj, lst); - break; - case PUBLISH_UPDATE: - publish_result = avahi_entry_group_update_service_txt_strlst( - idata->group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, 0, - purple_account_get_username(data->account), - LINK_LOCAL_RECORD_NAME, NULL, lst); - break; - } - - /* Free the memory used by temp data */ - avahi_string_list_free(lst); - - if (publish_result < 0) { - purple_debug_error("bonjour", - "Failed to add the " LINK_LOCAL_RECORD_NAME " service. Error: %s\n", - avahi_strerror(publish_result)); - return FALSE; - } - - if (type == PUBLISH_START - && (publish_result = avahi_entry_group_commit(idata->group)) < 0) { - purple_debug_error("bonjour", - "Failed to commit " LINK_LOCAL_RECORD_NAME " service. Error: %s\n", - avahi_strerror(publish_result)); - return FALSE; - } - - return TRUE; -} - -gboolean _mdns_browse(BonjourDnsSd *data) { - AvahiSessionImplData *idata = data->mdns_impl_data; - - g_return_val_if_fail(idata != NULL, FALSE); - - idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, LINK_LOCAL_RECORD_NAME, NULL, 0, _browser_callback, data->account); - if (!idata->sb) { - - purple_debug_error("bonjour", - "Unable to initialize service browser. Error: %s.\n", - avahi_strerror(avahi_client_errno(idata->client))); - return FALSE; - } - - return TRUE; -} - -gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) { - AvahiSessionImplData *idata = data->mdns_impl_data; - - if (idata == NULL || idata->client == NULL) - return FALSE; - - if (avatar_data != NULL) { - gboolean new_group = FALSE; - gchar *svc_name; - int ret; - AvahiPublishFlags flags = 0; - - if (idata->buddy_icon_group == NULL) { - purple_debug_info("bonjour", "Setting new buddy icon.\n"); - new_group = TRUE; - - idata->buddy_icon_group = avahi_entry_group_new(idata->client, - _buddy_icon_group_cb, data); - } else { - purple_debug_info("bonjour", "Updating existing buddy icon.\n"); - flags |= AVAHI_PUBLISH_UPDATE; - } - - if (idata->buddy_icon_group == NULL) { - purple_debug_error("bonjour", - "Unable to initialize the buddy icon group (%s).\n", - avahi_strerror(avahi_client_errno(idata->client))); - return FALSE; - } - - svc_name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", - purple_account_get_username(data->account)); - - ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, flags, svc_name, - AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len); - - g_free(svc_name); - - if (ret < 0) { - purple_debug_error("bonjour", - "Failed to register buddy icon. Error: %s\n", avahi_strerror(ret)); - if (new_group) { - avahi_entry_group_free(idata->buddy_icon_group); - idata->buddy_icon_group = NULL; - } - return FALSE; - } - - if (new_group && (ret = avahi_entry_group_commit(idata->buddy_icon_group)) < 0) { - purple_debug_error("bonjour", - "Failed to commit buddy icon group. Error: %s\n", avahi_strerror(ret)); - if (new_group) { - avahi_entry_group_free(idata->buddy_icon_group); - idata->buddy_icon_group = NULL; - } - return FALSE; - } - } else if (idata->buddy_icon_group != NULL) { - purple_debug_info("bonjour", "Removing existing buddy icon.\n"); - avahi_entry_group_free(idata->buddy_icon_group); - idata->buddy_icon_group = NULL; - } - - return TRUE; -} - -void _mdns_stop(BonjourDnsSd *data) { - AvahiSessionImplData *idata = data->mdns_impl_data; - - if (idata == NULL || idata->client == NULL) - return; - - if (idata->sb != NULL) - avahi_service_browser_free(idata->sb); - - avahi_client_free(idata->client); - avahi_glib_poll_free(idata->glib_poll); - - g_free(idata); - - data->mdns_impl_data = NULL; -} - -void _mdns_init_buddy(BonjourBuddy *buddy) { - buddy->mdns_impl_data = g_new0(AvahiBuddyImplData, 1); -} - -void _mdns_delete_buddy(BonjourBuddy *buddy) { - AvahiBuddyImplData *idata = buddy->mdns_impl_data; - - g_return_if_fail(idata != NULL); - - if (idata->buddy_icon_rec_browser != NULL) - avahi_record_browser_free(idata->buddy_icon_rec_browser); - - while(idata->resolvers != NULL) { - AvahiSvcResolverData *rd = idata->resolvers->data; - _cleanup_resolver_data(rd); - idata->resolvers = g_slist_delete_link(idata->resolvers, idata->resolvers); - } - - g_free(idata); - - buddy->mdns_impl_data = NULL; -} - -void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { - PurpleConnection *conn = purple_account_get_connection(buddy->account); - BonjourData *bd = conn->proto_data; - AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; - AvahiBuddyImplData *idata = buddy->mdns_impl_data; - gchar *name; - - g_return_if_fail(idata != NULL); - - if (idata->buddy_icon_rec_browser != NULL) - avahi_record_browser_free(idata->buddy_icon_rec_browser); - - purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name); - - name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", buddy->name); - idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, - _buddy_icon_record_cb, buddy); - g_free(name); - - if (!idata->buddy_icon_rec_browser) { - purple_debug_error("bonjour", - "Unable to initialize buddy icon record browser. Error: %s.\n", - avahi_strerror(avahi_client_errno(session_idata->client))); - } - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include - -#include "internal.h" -#include "debug.h" - -#include "mdns_common.h" -#include "mdns_interface.h" -#include "bonjour.h" -#include "buddy.h" - - -/** - * Allocate space for the dns-sd data. - */ -BonjourDnsSd * bonjour_dns_sd_new() { - BonjourDnsSd *data = g_new0(BonjourDnsSd, 1); - return data; -} - -/** - * Deallocate the space of the dns-sd data. - */ -void bonjour_dns_sd_free(BonjourDnsSd *data) { - g_free(data->first); - g_free(data->last); - g_free(data->phsh); - g_free(data->status); - g_free(data->vc); - g_free(data->msg); - g_free(data); -} - -#define MAX_TXT_CONSTITUENT_LEN 255 - -/* Make sure that the value isn't longer than it is supposed to be */ -static const char* -get_max_txt_record_value(const char *key, const char *value) -{ - /* "each constituent string of a DNS TXT record is limited to 255 bytes" - * This includes the key and the '=' - */ - static char buffer[MAX_TXT_CONSTITUENT_LEN + 1]; - gchar *end_valid = NULL; - int len = MIN(strlen(value), MAX_TXT_CONSTITUENT_LEN - (strlen(key) + 2)); - - strncpy(buffer, value, len); - - buffer[len] = '\0'; - - /* If we've cut part of a utf-8 character, kill it */ - if (!g_utf8_validate(buffer, -1, (const gchar **)&end_valid)) - *end_valid = '\0'; - - return buffer; -} - -static GSList *generate_presence_txt_records(BonjourDnsSd *data) { - GSList *ret = NULL; - PurpleKeyValuePair *kvp; - char portstring[6]; - const char *jid, *aim, *email; - - /* Convert the port to a string */ - snprintf(portstring, sizeof(portstring), "%d", data->port_p2pj); - - jid = purple_account_get_string(data->account, "jid", NULL); - aim = purple_account_get_string(data->account, "AIM", NULL); - email = purple_account_get_string(data->account, "email", NULL); - -#define _M_ADD_R(k, v) \ - kvp = g_new0(PurpleKeyValuePair, 1); \ - kvp->key = g_strdup(k); \ - kvp->value = g_strdup(get_max_txt_record_value(k, v)); \ - ret = g_slist_prepend(ret, kvp); \ - - /* We should try to follow XEP-0174, but some clients have "issues", so we humor them. - * See http://telepathy.freedesktop.org/wiki/SalutInteroperability - */ - - /* Large TXT records are problematic. - * While it is technically possible for this to exceed a standard 512-byte - * DNS message, it shouldn't happen unless we get wacky data entered for - * some of the freeform fields. It is even less likely to exceed the - * recommended maximum of 1300 bytes. - */ - - /* Needed by iChat */ - _M_ADD_R("txtvers", "1") - /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ - _M_ADD_R("1st", data->first) - /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ - _M_ADD_R("last", data->last) - /* Needed by Adium */ - _M_ADD_R("port.p2pj", portstring) - /* Needed by iChat, Gaim/Pidgin <= 2.0.1 */ - _M_ADD_R("status", data->status) - _M_ADD_R("node", "libpurple") - _M_ADD_R("ver", VERSION) - /* Currently always set to "!" since we don't support AV and wont ever be in a conference */ - _M_ADD_R("vc", data->vc) - if (email != NULL && *email != '\0') { - _M_ADD_R("email", email) - } - if (jid != NULL && *jid != '\0') { - _M_ADD_R("jid", jid) - } - /* Nonstandard, but used by iChat */ - if (aim != NULL && *aim != '\0') { - _M_ADD_R("AIM", aim) - } - if (data->msg != NULL && *data->msg != '\0') { - _M_ADD_R("msg", data->msg) - } - if (data->phsh != NULL && *data->phsh != '\0') { - _M_ADD_R("phsh", data->phsh) - } - - /* TODO: ext, nick */ - return ret; -} - -static void free_presence_txt_records(GSList *lst) { - PurpleKeyValuePair *kvp; - while(lst) { - kvp = lst->data; - g_free(kvp->key); - g_free(kvp->value); - g_free(kvp); - lst = g_slist_remove(lst, lst->data); - } -} - -static gboolean publish_presence(BonjourDnsSd *data, PublishType type) { - GSList *txt_records; - gboolean ret; - - txt_records = generate_presence_txt_records(data); - ret = _mdns_publish(data, type, txt_records); - free_presence_txt_records(txt_records); - - return ret; -} - -/** - * Send a new dns-sd packet updating our status. - */ -void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message) { - g_free(data->status); - g_free(data->msg); - - data->status = g_strdup(status); - data->msg = g_strdup(status_message); - - /* Update our text record with the new status */ - publish_presence(data, PUBLISH_UPDATE); -} - -/** - * Retrieve the buddy icon blob - */ -void bonjour_dns_sd_retrieve_buddy_icon(BonjourBuddy* buddy) { - _mdns_retrieve_buddy_icon(buddy); -} - -void bonjour_dns_sd_update_buddy_icon(BonjourDnsSd *data) { - PurpleStoredImage *img; - - if ((img = purple_buddy_icons_find_account_icon(data->account))) { - gconstpointer avatar_data; - gsize avatar_len; - - avatar_data = purple_imgstore_get_data(img); - avatar_len = purple_imgstore_get_size(img); - - if (_mdns_set_buddy_icon_data(data, avatar_data, avatar_len)) { - /* The filename is a SHA-1 hash of the data (conveniently what we need) */ - const char *p, *filename = purple_imgstore_get_filename(img); - - g_free(data->phsh); - data->phsh = NULL; - - /* Get rid of the extension */ - p = strchr(filename, '.'); - if (p) - data->phsh = g_strndup(filename, p - filename); - else - purple_debug_error("bonjour", "account buddy icon returned unexpected filename (%s)" - "; unable to extract hash. Clearing buddy icon\n", filename); - - /* Update our TXT record */ - publish_presence(data, PUBLISH_UPDATE); - } - - purple_imgstore_unref(img); - } else { - /* We need to do this regardless of whether data->phsh is set so that we - * cancel any icons that are currently in the process of being set */ - _mdns_set_buddy_icon_data(data, NULL, 0); - if (data->phsh != NULL) { - /* Clear the buddy icon */ - g_free(data->phsh); - data->phsh = NULL; - /* Update our TXT record */ - publish_presence(data, PUBLISH_UPDATE); - } - } -} - -/** - * Advertise our presence within the dns-sd daemon and start browsing - * for other bonjour peers. - */ -gboolean bonjour_dns_sd_start(BonjourDnsSd *data) { - - /* Initialize the dns-sd data and session */ - if (!_mdns_init_session(data)) - return FALSE; - - /* Publish our bonjour IM client at the mDNS daemon */ - if (!publish_presence(data, PUBLISH_START)) - return FALSE; - - /* Advise the daemon that we are waiting for connections */ - if (!_mdns_browse(data)) { - purple_debug_error("bonjour", "Unable to get service.\n"); - return FALSE; - } - - return TRUE; -} - -/** - * Unregister the "_presence._tcp" service at the mDNS daemon. - */ - -void bonjour_dns_sd_stop(BonjourDnsSd *data) { - _mdns_stop(data); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_MDNS_COMMON -#define _BONJOUR_MDNS_COMMON - -#include "mdns_types.h" - -#include "buddy.h" - -/** - * Allocate space for the dns-sd data. - */ -BonjourDnsSd *bonjour_dns_sd_new(void); - -/** - * Deallocate the space of the dns-sd data. - */ -void bonjour_dns_sd_free(BonjourDnsSd *data); - -/** - * Send a new dns-sd packet updating our status. - */ -void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message); - -/** - * Retrieve the buddy icon blob - */ -void bonjour_dns_sd_retrieve_buddy_icon(BonjourBuddy* buddy); - -/** - * Deal with a buddy icon update - */ -void bonjour_dns_sd_update_buddy_icon(BonjourDnsSd *data); - -/** - * Advertise our presence within the dns-sd daemon and start - * browsing for other bonjour peers. - */ -gboolean bonjour_dns_sd_start(BonjourDnsSd *data); - -/** - * Unregister the "_presence._tcp" service at the mDNS daemon. - */ -void bonjour_dns_sd_stop(BonjourDnsSd *data); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_interface.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_interface.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_interface.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_interface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_MDNS_INTERFACE -#define _BONJOUR_MDNS_INTERFACE - -#include "mdns_types.h" -#include "buddy.h" - -gboolean _mdns_init_session(BonjourDnsSd *data); - -gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records); - -gboolean _mdns_browse(BonjourDnsSd *data); - -void _mdns_stop(BonjourDnsSd *data); - -gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len); - -void _mdns_init_buddy(BonjourBuddy *buddy); - -void _mdns_delete_buddy(BonjourBuddy *buddy); - -void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_types.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_types.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_types.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_types.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_MDNS_TYPES -#define _BONJOUR_MDNS_TYPES - -#include -#include "account.h" - -#define LINK_LOCAL_RECORD_NAME "_presence._tcp." - -/** - * Data to be used by the dns-sd connection. - */ -typedef struct _BonjourDnsSd { - gpointer mdns_impl_data; - PurpleAccount *account; - gchar *first; - gchar *last; - gint port_p2pj; - gchar *phsh; - gchar *status; - gchar *vc; - gchar *msg; -} BonjourDnsSd; - -typedef enum _PublishType { - PUBLISH_START, - PUBLISH_UPDATE -} PublishType; - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_win32.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_win32.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_win32.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/mdns_win32.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,653 +0,0 @@ -/* - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include "internal.h" -#include "debug.h" - -#include "buddy.h" -#include "mdns_interface.h" -#include "dns_sd_proxy.h" -#include "dnsquery.h" -#include "mdns_common.h" - -static GSList *pending_buddies = NULL; - -typedef struct _dnssd_service_ref_handler { - DNSServiceRef sdRef; - PurpleAccount *account; - guint input_handler; -} DnsSDServiceRefHandlerData; - -/* data used by win32 bonjour implementation */ -typedef struct _win32_session_impl_data { - DnsSDServiceRefHandlerData *presence_query; - DnsSDServiceRefHandlerData *browser_query; - DNSRecordRef buddy_icon_rec; -} Win32SessionImplData; - -typedef struct _win32_buddy_service_resolver_data { - DnsSDServiceRefHandlerData *txt_query; - uint32_t if_idx; - gchar *name; - gchar *type; - gchar *domain; - /* This is a reference to the entry in BonjourBuddy->ips */ - const char *ip; -} Win32SvcResolverData; - -typedef struct _win32_buddy_impl_data { - GSList *resolvers; - DnsSDServiceRefHandlerData *null_query; -} Win32BuddyImplData; - -/* data structure for the resolve callback */ -typedef struct _ResolveCallbackArgs { - DnsSDServiceRefHandlerData *resolver_query; - PurpleAccount *account; - BonjourBuddy *bb; - Win32SvcResolverData *res_data; - gchar *full_service_name; - PurpleDnsQueryData *dns_query; -} ResolveCallbackArgs; - - -static gint -_find_resolver_data(gconstpointer a, gconstpointer b) { - const Win32SvcResolverData *rd_a = a; - const Win32SvcResolverData *rd_b = b; - gint ret = 1; - - if(rd_a->if_idx == rd_b->if_idx - && !strcmp(rd_a->name, rd_b->name) - && !strcmp(rd_a->type, rd_b->type) - && !strcmp(rd_a->domain, rd_b->domain)) { - ret = 0; - } - - return ret; -} - -static void -_cleanup_resolver_data(Win32SvcResolverData *rd) { - if (rd->txt_query != NULL) { - purple_input_remove(rd->txt_query->input_handler); - DNSServiceRefDeallocate(rd->txt_query->sdRef); - g_free(rd->txt_query); - } - g_free(rd->name); - g_free(rd->type); - g_free(rd->domain); - g_free(rd); -} - -static void -_mdns_handle_event(gpointer data, gint source, PurpleInputCondition condition) { - DnsSDServiceRefHandlerData *srh = data; - DNSServiceErrorType errorCode = DNSServiceProcessResult(srh->sdRef); - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Error (%d) handling mDNS response.\n", errorCode); - /* This happens when the mDNSResponder goes down, I haven't seen it happen any other time (in my limited testing) */ - if (errorCode == kDNSServiceErr_Unknown) { - purple_connection_error_reason(srh->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error communicating with local mDNSResponder.")); - } - } -} - -static void -_mdns_parse_text_record(BonjourBuddy *buddy, const char *record, uint16_t record_len) -{ - const char *txt_entry; - uint8_t txt_len; - int i; - - clear_bonjour_buddy_values(buddy); - for (i = 0; buddy_TXT_records[i] != NULL; i++) { - txt_entry = TXTRecordGetValuePtr(record_len, record, buddy_TXT_records[i], &txt_len); - if (txt_entry != NULL) - set_bonjour_buddy_value(buddy, buddy_TXT_records[i], txt_entry, txt_len); - } -} - -static void DNSSD_API -_mdns_record_query_callback(DNSServiceRef DNSServiceRef, DNSServiceFlags flags, - uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, - uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, - uint32_t ttl, void *context) -{ - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "record query - callback error.\n"); - /* TODO: Probably should remove the buddy when this happens */ - } else if (flags & kDNSServiceFlagsAdd) { - if (rrtype == kDNSServiceType_TXT) { - /* New Buddy */ - BonjourBuddy *bb = (BonjourBuddy*) context; - _mdns_parse_text_record(bb, rdata, rdlen); - bonjour_buddy_add_to_purple(bb, NULL); - } else if (rrtype == kDNSServiceType_NULL) { - /* Buddy Icon response */ - BonjourBuddy *bb = (BonjourBuddy*) context; - Win32BuddyImplData *idata = bb->mdns_impl_data; - - g_return_if_fail(idata != NULL); - - bonjour_buddy_got_buddy_icon(bb, rdata, rdlen); - - /* We've got what we need; stop listening */ - purple_input_remove(idata->null_query->input_handler); - DNSServiceRefDeallocate(idata->null_query->sdRef); - g_free(idata->null_query); - idata->null_query = NULL; - } - } -} - -static void -_mdns_resolve_host_callback(GSList *hosts, gpointer data, const char *error_message) -{ - ResolveCallbackArgs *args = (ResolveCallbackArgs*) data; - Win32BuddyImplData *idata = args->bb->mdns_impl_data; - gboolean delete_buddy = FALSE; - PurpleBuddy *pb = NULL; - - if ((pb = purple_find_buddy(args->account, args->res_data->name))) { - if (pb->proto_data != args->bb) { - purple_debug_error("bonjour", "Found purple buddy for %s not matching bonjour buddy record.", - args->res_data->name); - goto cleanup; - } - /* Make sure that the BonjourBuddy associated with this request is still around */ - } else if (g_slist_find(pending_buddies, args->bb) == NULL) { - purple_debug_error("bonjour", "host resolution - complete, but buddy no longer pending.\n"); - goto cleanup; - } - - if (!hosts || !hosts->data) { - purple_debug_error("bonjour", "host resolution - callback error.\n"); - delete_buddy = TRUE; - } else { - struct sockaddr_in *addr = g_slist_nth_data(hosts, 1); - DNSServiceErrorType errorCode; - DNSServiceRef txt_query_sr; - - /* finally, set up the continuous txt record watcher, and add the buddy to purple */ - errorCode = DNSServiceQueryRecord(&txt_query_sr, kDNSServiceFlagsLongLivedQuery, - kDNSServiceInterfaceIndexAny, args->full_service_name, kDNSServiceType_TXT, - kDNSServiceClass_IN, _mdns_record_query_callback, args->bb); - if (errorCode == kDNSServiceErr_NoError) { - const char *ip = inet_ntoa(addr->sin_addr); - - purple_debug_info("bonjour", "Found buddy %s at %s:%d\n", args->bb->name, ip, args->bb->port_p2pj); - - args->bb->ips = g_slist_prepend(args->bb->ips, g_strdup(ip)); - args->res_data->ip = args->bb->ips->data; - - args->res_data->txt_query = g_new(DnsSDServiceRefHandlerData, 1); - args->res_data->txt_query->sdRef = txt_query_sr; - args->res_data->txt_query->account = args->account; - - args->res_data->txt_query->input_handler = purple_input_add(DNSServiceRefSockFD(txt_query_sr), - PURPLE_INPUT_READ, _mdns_handle_event, args->res_data->txt_query); - - bonjour_buddy_add_to_purple(args->bb, NULL); - } else { - purple_debug_error("bonjour", "Unable to set up record watcher for buddy %s (%d)\n", args->bb->name, errorCode); - delete_buddy = TRUE; - } - - } - - cleanup: - - /* free the hosts list*/ - while (hosts != NULL) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - if (delete_buddy) { - idata->resolvers = g_slist_remove(idata->resolvers, args->res_data); - _cleanup_resolver_data(args->res_data); - - /* If this was the last resolver, remove the buddy */ - if (idata->resolvers == NULL) { - if (pb) - bonjour_buddy_signed_off(pb); - else - bonjour_buddy_delete(args->bb); - - /* Remove from the pending list */ - pending_buddies = g_slist_remove(pending_buddies, args->bb); - } - } else { - /* Remove from the pending list */ - pending_buddies = g_slist_remove(pending_buddies, args->bb); - } - - /* free the remaining args memory */ - g_free(args->full_service_name); - g_free(args); -} - -static void DNSSD_API -_mdns_service_resolve_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, - const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const char *txtRecord, void *context) -{ - ResolveCallbackArgs *args = (ResolveCallbackArgs*) context; - Win32BuddyImplData *idata = args->bb->mdns_impl_data; - - /* remove the input fd and destroy the service ref */ - purple_input_remove(args->resolver_query->input_handler); - DNSServiceRefDeallocate(args->resolver_query->sdRef); - g_free(args->resolver_query); - args->resolver_query = NULL; - - if (errorCode != kDNSServiceErr_NoError) - purple_debug_error("bonjour", "service resolver - callback error.\n"); - else { - /* set more arguments, and start the host resolver */ - - if ((args->dns_query = - purple_dnsquery_a(hosttarget, port, _mdns_resolve_host_callback, args)) != NULL) { - - args->full_service_name = g_strdup(fullname); - - /* TODO: Should this be per resolver? */ - args->bb->port_p2pj = ntohs(port); - - /* We don't want to hit the cleanup code */ - return; - } else - purple_debug_error("bonjour", "service resolver - host resolution failed.\n"); - } - - /* If we get this far, clean up */ - - idata->resolvers = g_slist_remove(idata->resolvers, args->res_data); - _cleanup_resolver_data(args->res_data); - - /* If this was the last resolver, remove the buddy */ - if (idata->resolvers == NULL) { - PurpleBuddy *pb; - /* See if this is now attached to a PurpleBuddy */ - if ((pb = purple_find_buddy(args->account, args->bb->name))) - bonjour_buddy_signed_off(pb); - else { - /* Remove from the pending list */ - pending_buddies = g_slist_remove(pending_buddies, args->bb); - bonjour_buddy_delete(args->bb); - } - } - - g_free(args); - -} - -static void DNSSD_API -_mdns_service_register_callback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, - const char *name, const char *regtype, const char *domain, void *context) { - - /* TODO: deal with collision */ - if (errorCode != kDNSServiceErr_NoError) - purple_debug_error("bonjour", "service advertisement - callback error (%d).\n", errorCode); - else - purple_debug_info("bonjour", "service advertisement - callback.\n"); -} - -static void DNSSD_API -_mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) -{ - PurpleAccount *account = (PurpleAccount*)context; - - if (errorCode != kDNSServiceErr_NoError) - purple_debug_error("bonjour", "service browser - callback error (%d)\n", errorCode); - else if (flags & kDNSServiceFlagsAdd) { - /* A presence service instance has been discovered... check it isn't us! */ - if (purple_utf8_strcasecmp(serviceName, account->username) != 0) { - DNSServiceErrorType resErrorCode; - /* OK, lets go ahead and resolve it to add to the buddy list */ - ResolveCallbackArgs *args = g_new0(ResolveCallbackArgs, 1); - DNSServiceRef resolver_sr; - - purple_debug_info("bonjour", "Received new record for '%s' on iface %u (%s, %s)\n", - serviceName, interfaceIndex, regtype ? regtype : "", - replyDomain ? replyDomain : ""); - - resErrorCode = DNSServiceResolve(&resolver_sr, 0, 0, serviceName, regtype, - replyDomain, _mdns_service_resolve_callback, args); - if (resErrorCode == kDNSServiceErr_NoError) { - GSList *tmp = pending_buddies; - PurpleBuddy *pb; - BonjourBuddy* bb = NULL; - Win32SvcResolverData *rd; - Win32BuddyImplData *idata; - - /* Is there an existing buddy? */ - if ((pb = purple_find_buddy(account, serviceName))) - bb = pb->proto_data; - /* Is there a pending buddy? */ - else { - while (tmp) { - BonjourBuddy *bb_tmp = tmp->data; - if (!strcmp(bb_tmp->name, serviceName)) { - bb = bb_tmp; - break; - } - tmp = tmp->next; - } - } - - if (bb == NULL) { - bb = bonjour_buddy_new(serviceName, account); - - /* This is only necessary for the wacky case where someone previously manually added a buddy. */ - if (pb == NULL) - pending_buddies = g_slist_prepend(pending_buddies, bb); - else - pb->proto_data = bb; - } - - rd = g_new0(Win32SvcResolverData, 1); - rd->if_idx = interfaceIndex; - rd->name = g_strdup(serviceName); - rd->type = g_strdup(regtype); - rd->domain = g_strdup(replyDomain); - - idata = bb->mdns_impl_data; - idata->resolvers = g_slist_prepend(idata->resolvers, rd); - - args->bb = bb; - args->res_data = rd; - args->account = account; - - args->resolver_query = g_new(DnsSDServiceRefHandlerData, 1); - args->resolver_query->sdRef = resolver_sr; - args->resolver_query->account = account; - /* get a file descriptor for this service ref, and add it to the input list */ - args->resolver_query->input_handler = purple_input_add(DNSServiceRefSockFD(resolver_sr), - PURPLE_INPUT_READ, _mdns_handle_event, args->resolver_query); - } else { - purple_debug_error("bonjour", "service browser - failed to resolve service. (%d)\n", resErrorCode); - g_free(args); - } - } - } else { - PurpleBuddy *pb = NULL; - - /* A peer has sent a goodbye packet, remove them from the buddy list */ - purple_debug_info("bonjour", "Received remove notification for '%s' on iface %u (%s, %s)\n", - serviceName, interfaceIndex, regtype ? regtype : "", - replyDomain ? replyDomain : ""); - - pb = purple_find_buddy(account, serviceName); - if (pb != NULL) { - GSList *l; - /* There may be multiple presences, we should only get rid of this one */ - Win32SvcResolverData *rd_search; - BonjourBuddy *bb = pb->proto_data; - Win32BuddyImplData *idata; - - g_return_if_fail(bb != NULL); - - idata = bb->mdns_impl_data; - - rd_search = g_new0(Win32SvcResolverData, 1); - rd_search->if_idx = interfaceIndex; - rd_search->name = (gchar *) serviceName; - rd_search->type = (gchar *) regtype; - rd_search->domain = (gchar *) replyDomain; - - l = g_slist_find_custom(idata->resolvers, rd_search, _find_resolver_data); - - g_free(rd_search); - - if (l != NULL) { - Win32SvcResolverData *rd = l->data; - idata->resolvers = g_slist_delete_link(idata->resolvers, l); - /* This IP is no longer available */ - if (rd->ip != NULL) { - bb->ips = g_slist_remove(bb->ips, rd->ip); - g_free((gchar *) rd->ip); - } - _cleanup_resolver_data(rd); - - /* If this was the last resolver, remove the buddy */ - if (idata->resolvers == NULL) { - purple_debug_info("bonjour", "Removed last presence for buddy '%s'; signing off buddy.\n", - serviceName); - bonjour_buddy_signed_off(pb); - } - } - } else { - purple_debug_warning("bonjour", "Unable to find buddy (%s) to remove\n", serviceName ? serviceName : "(null)"); - /* TODO: Should we look in the pending buddies list? */ - } - } -} - -/**************************** - * mdns_interface functions * - ****************************/ - -gboolean _mdns_init_session(BonjourDnsSd *data) { - data->mdns_impl_data = g_new0(Win32SessionImplData, 1); - return TRUE; -} - -gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records) { - TXTRecordRef dns_data; - gboolean ret = TRUE; - DNSServiceErrorType errorCode = kDNSServiceErr_NoError; - Win32SessionImplData *idata = data->mdns_impl_data; - - g_return_val_if_fail(idata != NULL, FALSE); - - TXTRecordCreate(&dns_data, 256, NULL); - - while (records) { - PurpleKeyValuePair *kvp = records->data; - errorCode = TXTRecordSetValue(&dns_data, kvp->key, strlen(kvp->value), kvp->value); - if (errorCode != kDNSServiceErr_NoError) - break; - records = records->next; - } - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Unable to allocate memory for text record.(%d)\n", errorCode); - ret = FALSE; - } else { - /* OK, we're done constructing the text record, (re)publish the service */ - DNSServiceRef presence_sr; - - switch (type) { - case PUBLISH_START: - purple_debug_info("bonjour", "Registering presence on port %d\n", data->port_p2pj); - errorCode = DNSServiceRegister(&presence_sr, 0, 0, purple_account_get_username(data->account), LINK_LOCAL_RECORD_NAME, - NULL, NULL, htons(data->port_p2pj), TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), - _mdns_service_register_callback, NULL); - break; - - case PUBLISH_UPDATE: - purple_debug_info("bonjour", "Updating presence.\n"); - errorCode = DNSServiceUpdateRecord(idata->presence_query->sdRef, NULL, 0, TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), 0); - break; - } - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Failed to publish presence service.(%d)\n", errorCode); - ret = FALSE; - } else if (type == PUBLISH_START) { - /* We need to do this because according to the Apple docs: - * "the client is responsible for ensuring that DNSServiceProcessResult() is called - * whenever there is a reply from the daemon - the daemon may terminate its connection - * with a client that does not process the daemon's responses */ - idata->presence_query = g_new(DnsSDServiceRefHandlerData, 1); - idata->presence_query->sdRef = presence_sr; - idata->presence_query->account = data->account; - idata->presence_query->input_handler = purple_input_add(DNSServiceRefSockFD(presence_sr), - PURPLE_INPUT_READ, _mdns_handle_event, idata->presence_query); - } - } - - /* Free the memory used by temp data */ - TXTRecordDeallocate(&dns_data); - return ret; -} - -gboolean _mdns_browse(BonjourDnsSd *data) { - DNSServiceErrorType errorCode; - Win32SessionImplData *idata = data->mdns_impl_data; - DNSServiceRef browser_sr; - - g_return_val_if_fail(idata != NULL, FALSE); - - errorCode = DNSServiceBrowse(&browser_sr, 0, 0, LINK_LOCAL_RECORD_NAME, NULL, - _mdns_service_browse_callback, data->account); - if (errorCode == kDNSServiceErr_NoError) { - idata->browser_query = g_new(DnsSDServiceRefHandlerData, 1); - idata->browser_query->sdRef = browser_sr; - idata->browser_query->account = data->account; - idata->browser_query->input_handler = purple_input_add(DNSServiceRefSockFD(browser_sr), - PURPLE_INPUT_READ, _mdns_handle_event, idata->browser_query); - return TRUE; - } else - purple_debug_error("bonjour", "Error registering Local Link presence browser. (%d)\n", errorCode); - - - return FALSE; -} - -void _mdns_stop(BonjourDnsSd *data) { - Win32SessionImplData *idata = data->mdns_impl_data; - - if (idata == NULL) - return; - - if (idata->presence_query != NULL) { - purple_input_remove(idata->presence_query->input_handler); - DNSServiceRefDeallocate(idata->presence_query->sdRef); - g_free(idata->presence_query); - } - - if (idata->browser_query != NULL) { - purple_input_remove(idata->browser_query->input_handler); - DNSServiceRefDeallocate(idata->browser_query->sdRef); - g_free(idata->browser_query); - } - - g_free(idata); - - data->mdns_impl_data = NULL; -} - -gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) { - Win32SessionImplData *idata = data->mdns_impl_data; - DNSServiceErrorType errorCode = kDNSServiceErr_NoError; - - g_return_val_if_fail(idata != NULL, FALSE); - - if (avatar_data != NULL && idata->buddy_icon_rec == NULL) { - purple_debug_info("bonjour", "Setting new buddy icon.\n"); - errorCode = DNSServiceAddRecord(idata->presence_query->sdRef, &idata->buddy_icon_rec, - 0, kDNSServiceType_NULL, avatar_len, avatar_data, 0); - } else if (avatar_data != NULL) { - purple_debug_info("bonjour", "Updating existing buddy icon.\n"); - errorCode = DNSServiceUpdateRecord(idata->presence_query->sdRef, idata->buddy_icon_rec, - 0, avatar_len, avatar_data, 0); - } else if (idata->buddy_icon_rec != NULL) { - purple_debug_info("bonjour", "Removing existing buddy icon.\n"); - errorCode = DNSServiceRemoveRecord(idata->presence_query->sdRef, idata->buddy_icon_rec, 0); - idata->buddy_icon_rec = NULL; - } - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Error (%d) setting buddy icon record.\n", errorCode); - return FALSE; - } - - return TRUE; -} - -void _mdns_init_buddy(BonjourBuddy *buddy) { - buddy->mdns_impl_data = g_new0(Win32BuddyImplData, 1); -} - -void _mdns_delete_buddy(BonjourBuddy *buddy) { - Win32BuddyImplData *idata = buddy->mdns_impl_data; - - g_return_if_fail(idata != NULL); - - while (idata->resolvers) { - Win32SvcResolverData *rd = idata->resolvers->data; - _cleanup_resolver_data(rd); - idata->resolvers = g_slist_delete_link(idata->resolvers, idata->resolvers); - } - - if (idata->null_query != NULL) { - purple_input_remove(idata->null_query->input_handler); - DNSServiceRefDeallocate(idata->null_query->sdRef); - g_free(idata->null_query); - } - - g_free(idata); - - buddy->mdns_impl_data = NULL; -} - -void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { - Win32BuddyImplData *idata = buddy->mdns_impl_data; - char svc_name[kDNSServiceMaxDomainName]; - - g_return_if_fail(idata != NULL); - - /* Cancel any existing query */ - if (idata->null_query != NULL) { - purple_input_remove(idata->null_query->input_handler); - DNSServiceRefDeallocate(idata->null_query->sdRef); - g_free(idata->null_query); - idata->null_query = NULL; - } - - if (DNSServiceConstructFullName(svc_name, buddy->name, LINK_LOCAL_RECORD_NAME, "local") != 0) - purple_debug_error("bonjour", "Unable to construct full name to retrieve buddy icon for %s.\n", buddy->name); - else { - DNSServiceRef null_query_sr; - - DNSServiceErrorType errorCode = DNSServiceQueryRecord(&null_query_sr, 0, kDNSServiceInterfaceIndexAny, - svc_name, kDNSServiceType_NULL, kDNSServiceClass_IN, _mdns_record_query_callback, buddy); - - if (errorCode == kDNSServiceErr_NoError) { - idata->null_query = g_new(DnsSDServiceRefHandlerData, 1); - - idata->null_query->sdRef = null_query_sr; - idata->null_query->account = buddy->account; - - idata->null_query->input_handler = purple_input_add(DNSServiceRefSockFD(null_query_sr), - PURPLE_INPUT_READ, _mdns_handle_event, idata->null_query); - } else - purple_debug_error("bonjour", "Unable to query buddy icon record for %s. (%d)\n", buddy->name, errorCode); - } - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -/* - * purple - Bonjour Jabber XML parser stuff - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include - -#include "connection.h" -#include "debug.h" -#include "jabber.h" -#include "parser.h" -#include "util.h" -#include "xmlnode.h" - -static gboolean -parse_from_attrib_and_find_buddy(BonjourJabberConversation *bconv, int nb_attributes, const xmlChar **attributes) { - int i; - - /* If the "from" attribute is specified, attach it to the conversation. */ - for(i=0; i < nb_attributes * 5; i+=5) { - if(!xmlStrcmp(attributes[i], (xmlChar*) "from")) { - int len = attributes[i+4] - attributes[i+3]; - bconv->buddy_name = g_strndup((char *)attributes[i+3], len); - bonjour_jabber_conv_match_by_name(bconv); - - return (bconv->pb != NULL); - } - } - - return FALSE; -} - -static void -bonjour_parser_element_start_libxml(void *user_data, - const xmlChar *element_name, const xmlChar *prefix, const xmlChar *namespace, - int nb_namespaces, const xmlChar **namespaces, - int nb_attributes, int nb_defaulted, const xmlChar **attributes) -{ - BonjourJabberConversation *bconv = user_data; - - xmlnode *node; - int i; - - g_return_if_fail(element_name != NULL); - - if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { - if(!bconv->recv_stream_start) { - bconv->recv_stream_start = TRUE; - - if (bconv->pb == NULL) - parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes); - - bonjour_jabber_stream_started(bconv); - } - } else { - - /* If we haven't yet attached a buddy and this isn't "", - * try to get a "from" attribute as a last resort to match our buddy. */ - if(bconv->pb == NULL - && !(prefix && !xmlStrcmp(prefix, (xmlChar*) "stream") - && !xmlStrcmp(element_name, (xmlChar*) "features")) - && !parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes)) - /* We've run out of options for finding who the conversation is from - using explicitly specified stuff; see if we can make a good match - by using the IP */ - bonjour_jabber_conv_match_by_ip(bconv); - - if(bconv->current) - node = xmlnode_new_child(bconv->current, (const char*) element_name); - else - node = xmlnode_new((const char*) element_name); - xmlnode_set_namespace(node, (const char*) namespace); - - for(i=0; i < nb_attributes * 5; i+=5) { - const char *name = (const char *)attributes[i]; - const char *prefix = (const char *)attributes[i+1]; - const char *attrib_ns = (const char *)attributes[i+2]; - char *txt; - int attrib_len = attributes[i+4] - attributes[i+3]; - char *attrib = g_malloc(attrib_len + 1); - - memcpy(attrib, attributes[i+3], attrib_len); - attrib[attrib_len] = '\0'; - - txt = attrib; - attrib = purple_unescape_html(txt); - g_free(txt); - xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); - g_free(attrib); - } - - bconv->current = node; - } -} - -static void -bonjour_parser_element_end_libxml(void *user_data, const xmlChar *element_name, - const xmlChar *prefix, const xmlChar *namespace) -{ - BonjourJabberConversation *bconv = user_data; - - if(!bconv->current) { - /* We don't keep a reference to the start stream xmlnode, - * so we have to check for it here to close the conversation */ - if(!xmlStrcmp(element_name, (xmlChar*) "stream")) - /* Asynchronously close the conversation to prevent bonjour_parser_setup() - * being called from within this context */ - async_bonjour_jabber_close_conversation(bconv); - return; - } - - if(bconv->current->parent) { - if(!xmlStrcmp((xmlChar*) bconv->current->name, element_name)) - bconv->current = bconv->current->parent; - } else { - xmlnode *packet = bconv->current; - bconv->current = NULL; - bonjour_jabber_process_packet(bconv->pb, packet); - xmlnode_free(packet); - } -} - -static void -bonjour_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) -{ - BonjourJabberConversation *bconv = user_data; - - if(!bconv->current) - return; - - if(!text || !text_len) - return; - - xmlnode_insert_data(bconv->current, (const char*) text, text_len); -} - -static void -bonjour_parser_structured_error_handler(void *user_data, xmlErrorPtr error) -{ - BonjourJabberConversation *bconv = user_data; - - purple_debug_error("jabber", "XML parser error for BonjourJabberConversation %p: " - "Domain %i, code %i, level %i: %s", - bconv, - error->domain, error->code, error->level, - (error->message ? error->message : "(null)\n")); -} - -static xmlSAXHandler bonjour_parser_libxml = { - NULL, /*internalSubset*/ - NULL, /*isStandalone*/ - NULL, /*hasInternalSubset*/ - NULL, /*hasExternalSubset*/ - NULL, /*resolveEntity*/ - NULL, /*getEntity*/ - NULL, /*entityDecl*/ - NULL, /*notationDecl*/ - NULL, /*attributeDecl*/ - NULL, /*elementDecl*/ - NULL, /*unparsedEntityDecl*/ - NULL, /*setDocumentLocator*/ - NULL, /*startDocument*/ - NULL, /*endDocument*/ - NULL, /*startElement*/ - NULL, /*endElement*/ - NULL, /*reference*/ - bonjour_parser_element_text_libxml, /*characters*/ - NULL, /*ignorableWhitespace*/ - NULL, /*processingInstruction*/ - NULL, /*comment*/ - NULL, /*warning*/ - NULL, /*error*/ - NULL, /*fatalError*/ - NULL, /*getParameterEntity*/ - NULL, /*cdataBlock*/ - NULL, /*externalSubset*/ - XML_SAX2_MAGIC, /*initialized*/ - NULL, /*_private*/ - bonjour_parser_element_start_libxml, /*startElementNs*/ - bonjour_parser_element_end_libxml, /*endElementNs*/ - bonjour_parser_structured_error_handler /*serror*/ -}; - -void -bonjour_parser_setup(BonjourJabberConversation *bconv) -{ - - /* This seems backwards, but it makes sense. The libxml code creates - * the parser context when you try to use it (this way, it can figure - * out the encoding at creation time. So, setting up the parser is - * just a matter of destroying any current parser. */ - if (bconv->context) { - xmlParseChunk(bconv->context, NULL,0,1); - xmlFreeParserCtxt(bconv->context); - bconv->context = NULL; - } -} - - -void bonjour_parser_process(BonjourJabberConversation *bconv, const char *buf, int len) -{ - - if (bconv->context == NULL) { - /* libxml inconsistently starts parsing on creating the - * parser, so do a ParseChunk right afterwards to force it. */ - bconv->context = xmlCreatePushParserCtxt(&bonjour_parser_libxml, bconv, buf, len, NULL); - xmlParseChunk(bconv->context, "", 0, 0); - } else if (xmlParseChunk(bconv->context, buf, len, 0) < 0) - /* TODO: What should we do here - I assume we should display an error or something (maybe just print something to the conv?) */ - purple_debug_error("bonjour", "Error parsing xml.\n"); - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/bonjour/parser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/** - * @file parser.h Bonjour Jabber XML parser functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_BONJOUR_PARSER_H_ -#define _PURPLE_BONJOUR_PARSER_H_ - -#include "buddy.h" -#include "jabber.h" - -void bonjour_parser_setup(BonjourJabberConversation *bconv); -void bonjour_parser_process(BonjourJabberConversation *bconv, const char *buf, int len); - -#endif /* _PURPLE_BONJOUR_PARSER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -/** - * @file buddylist.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include - -#include "gg.h" -#include "gg-utils.h" -#include "buddylist.h" - -#define F_FIRSTNAME 0 -#define F_LASTNAME 1 -/* #define F_ 2 */ -#define F_NICKNAME 3 -#define F_PHONE 4 -#define F_GROUP 5 -#define F_UIN 6 - -/* void ggp_buddylist_send(PurpleConnection *gc) {{{ */ -void ggp_buddylist_send(PurpleConnection *gc) -{ - GGPInfo *info = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - GSList *buddies; - uin_t *userlist; - gchar *types; - int i = 0, ret = 0; - int size; - - buddies = purple_find_buddies(account, NULL); - - size = g_slist_length(buddies); - userlist = g_new(uin_t, size); - types = g_new(gchar, size); - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies), ++i) - { - PurpleBuddy *buddy = buddies->data; - const gchar *name = purple_buddy_get_name(buddy); - - userlist[i] = ggp_str_to_uin(name); - types[i] = GG_USER_NORMAL; - purple_debug_info("gg", "ggp_buddylist_send: adding %d\n", - userlist[i]); - } - - ret = gg_notify_ex(info->session, userlist, types, size); - purple_debug_info("gg", "send: ret=%d; size=%d\n", ret, size); - - if (userlist) { - g_free(userlist); - g_free(types); - } -} -/* }}} */ - -/* void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) {{{ */ -void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) -{ - PurpleBuddy *buddy; - PurpleGroup *group; - gchar **users_tbl; - int i; - char *utf8buddylist = charset_convert(buddylist, "CP1250", "UTF-8"); - - /* Don't limit the number of records in a buddylist. */ - users_tbl = g_strsplit(utf8buddylist, "\r\n", -1); - - for (i = 0; users_tbl[i] != NULL; i++) { - gchar **data_tbl; - gchar *name, *show, *g; - - if (strlen(users_tbl[i]) == 0) - continue; - - data_tbl = g_strsplit(users_tbl[i], ";", 8); - if (ggp_array_size(data_tbl) < 8) { - purple_debug_warning("gg", - "Something is wrong on line %d of the buddylist. Skipping.\n", - i + 1); - continue; - } - - show = data_tbl[F_NICKNAME]; - name = data_tbl[F_UIN]; - if ('\0' == *name || !atol(name)) { - purple_debug_warning("gg", - "Identifier on line %d of the buddylist is not a number. Skipping.\n", - i + 1); - continue; - } - - if ('\0' == *show) { - show = name; - } - - purple_debug_info("gg", "got buddy: name=%s; show=%s\n", name, show); - - if (purple_find_buddy(purple_connection_get_account(gc), name)) { - g_strfreev(data_tbl); - continue; - } - - g = g_strdup("Gadu-Gadu"); - - if ('\0' != data_tbl[F_GROUP]) { - /* XXX: Probably buddy should be added to all the groups. */ - /* Hard limit to at most 50 groups */ - gchar **group_tbl = g_strsplit(data_tbl[F_GROUP], ",", 50); - if (ggp_array_size(group_tbl) > 0) { - g_free(g); - g = g_strdup(group_tbl[0]); - } - g_strfreev(group_tbl); - } - - buddy = purple_buddy_new(purple_connection_get_account(gc), name, - strlen(show) ? show : NULL); - - if (!(group = purple_find_group(g))) { - group = purple_group_new(g); - purple_blist_add_group(group, NULL); - } - - purple_blist_add_buddy(buddy, NULL, group, NULL); - g_free(g); - - g_strfreev(data_tbl); - } - g_strfreev(users_tbl); - g_free(utf8buddylist); - - ggp_buddylist_send(gc); -} -/* }}} */ - -/* char *ggp_buddylist_dump(PurpleAccount *account) {{{ */ -char *ggp_buddylist_dump(PurpleAccount *account) -{ - GSList *buddies; - GString *buddylist = g_string_sized_new(1024); - char *ptr; - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *buddy = buddies->data; - PurpleGroup *group = purple_buddy_get_group(buddy); - const char *bname = purple_buddy_get_name(buddy); - const char *gname = purple_group_get_name(group); - const char *alias = purple_buddy_get_alias(buddy); - - if (alias == NULL) - alias = bname; - - g_string_append_printf(buddylist, - "%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", - alias, alias, alias, alias, - "", gname, bname, "", ""); - } - - ptr = charset_convert(buddylist->str, "UTF-8", "CP1250"); - g_string_free(buddylist, TRUE); - return ptr; -} -/* }}} */ - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/buddylist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file buddylist.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_BUDDYLIST_H -#define _PURPLE_GG_BUDDYLIST_H - -#include "connection.h" -#include "account.h" - -void -ggp_buddylist_send(PurpleConnection *gc); - -/** - * Load buddylist from server into the roster. - * - * @param gc PurpleConnection - * @param buddylist Pointer to the buddylist that will be loaded. - */ -/* void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) {{{ */ -void -ggp_buddylist_load(PurpleConnection *gc, char *buddylist); - -/** - * Get all the buddies in the current account. - * - * @param account Current account. - * - * @return List of buddies. - */ -char * -ggp_buddylist_dump(PurpleAccount *account); - - -#endif /* _PURPLE_GG_BUDDYLIST_H */ - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -/** - * @file confer.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include -#include "gg.h" -#include "gg-utils.h" -#include "confer.h" - -/* PurpleConversation *ggp_confer_find_by_name(PurpleConnection *gc, const gchar *name) {{{ */ -PurpleConversation *ggp_confer_find_by_name(PurpleConnection *gc, const gchar *name) -{ - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - return purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name, - purple_connection_get_account(gc)); -} -/* }}} */ - -/* void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_name, const uin_t uin) {{{ */ -void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_name, - const uin_t uin) -{ - PurpleConversation *conv; - GGPInfo *info = gc->proto_data; - GGPChat *chat; - GList *l; - gchar *str_uin; - - for (l = info->chats; l != NULL; l = l->next) { - chat = l->data; - - if (g_utf8_collate(chat->name, chat_name) != 0) - continue; - - if (g_list_find(chat->participants, GINT_TO_POINTER(uin)) == NULL) { - chat->participants = g_list_append( - chat->participants, GINT_TO_POINTER(uin)); - - str_uin = g_strdup_printf("%lu", (unsigned long int)uin); - conv = ggp_confer_find_by_name(gc, chat_name); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), str_uin, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - - g_free(str_uin); - } - break; - } -} -/* }}} */ - -/* void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, const uin_t *recipients, int count) {{{ */ -void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, - const uin_t *recipients, int count) -{ - GGPInfo *info = gc->proto_data; - GList *l; - gchar *str_uin; - - for (l = info->chats; l != NULL; l = l->next) { - GGPChat *chat = l->data; - int i; - - if (g_utf8_collate(chat->name, chat_name) != 0) - continue; - - for (i = 0; i < count; i++) { - PurpleConversation *conv; - - if (g_list_find(chat->participants, - GINT_TO_POINTER(recipients[i])) != NULL) { - continue; - } - - chat->participants = g_list_append(chat->participants, - GINT_TO_POINTER(recipients[i])); - - str_uin = g_strdup_printf("%lu", (unsigned long int)recipients[i]); - conv = ggp_confer_find_by_name(gc, chat_name); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), - str_uin, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - g_free(str_uin); - } - break; - } -} -/* }}} */ - -/* const char *ggp_confer_find_by_participants(PurpleConnection *gc, const uin_t *recipients, int count) {{{ */ -const char *ggp_confer_find_by_participants(PurpleConnection *gc, - const uin_t *recipients, int count) -{ - GGPInfo *info = gc->proto_data; - GGPChat *chat = NULL; - GList *l; - int matches; - - g_return_val_if_fail(info->chats != NULL, NULL); - - for (l = info->chats; l != NULL; l = l->next) { - GList *m; - - chat = l->data; - matches = 0; - - for (m = chat->participants; m != NULL; m = m->next) { - uin_t uin = GPOINTER_TO_INT(m->data); - int i; - - for (i = 0; i < count; i++) - if (uin == recipients[i]) - matches++; - } - - if (matches == count) - break; - - chat = NULL; - } - - if (chat == NULL) - return NULL; - else - return chat->name; -} -/* }}} */ - -/* const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) {{{ */ -const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) -{ - GGPInfo *info = gc->proto_data; - GGPChat *chat; - - chat = g_new0(GGPChat, 1); - - if (name == NULL) - chat->name = g_strdup_printf("conf#%d", info->chats_count++); - else - chat->name = g_strdup(name); - - chat->participants = NULL; - - info->chats = g_list_append(info->chats, chat); - - return chat->name; -} -/* }}} */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/confer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file confer.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_CONFER_H -#define _PURPLE_GG_CONFER_H - -#include "gg.h" - -/** - * Finds a CHAT conversation for the current account with the specified name. - * - * @param gc PurpleConnection instance. - * @param name Name of the conversation. - * - * @return PurpleConversation or NULL if not found. - */ -PurpleConversation * -ggp_confer_find_by_name(PurpleConnection *gc, const gchar *name); - -/** - * Adds the specified UIN to the specified conversation. - * - * @param gc PurpleConnection. - * @param chat_name Name of the conversation. - */ -void -ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_name, - const uin_t uin); - -/** - * Add the specified UINs to the specified conversation. - * - * @param gc PurpleConnection. - * @param chat_name Name of the conversation. - * @param recipients List of the UINs. - * @param count Number of the UINs. - */ -void -ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, - const uin_t *recipients, int count); - -/** - * Finds a conversation in which all the specified recipients participate. - * - * TODO: This function should be rewritten to better handle situations when - * somebody adds more people to the converation. - * - * @param gc PurpleConnection. - * @param recipients List of the people in the conversation. - * @param count Number of people. - * - * @return Name of the conversation. - */ -const char* -ggp_confer_find_by_participants(PurpleConnection *gc, const uin_t *recipients, - int count); - -/** - * Adds a new conversation to the internal list of conversations. - * If name is NULL then it will be automagically generated. - * - * @param gc PurpleConnection. - * @param name Name of the conversation. - * - * @return Name of the conversation. - */ -const char* -ggp_confer_add_new(PurpleConnection *gc, const char *name); - - -#endif /* _PURPLE_GG_CONFER_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2550 +0,0 @@ -/** - * @file gg.c Gadu-Gadu protocol plugin - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * Some parts of the code are adapted or taken from the previous implementation - * of this plugin written by Arkadiusz Miskiewicz - * Some parts Copyright (C) 2009 Krzysztof Klinikowski - * - * Thanks to Google's Summer of Code Program. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "plugin.h" -#include "version.h" -#include "notify.h" -#include "status.h" -#include "blist.h" -#include "accountopt.h" -#include "debug.h" -#include "util.h" -#include "request.h" -#include "xmlnode.h" - -#include - -#include "gg.h" -#include "confer.h" -#include "search.h" -#include "buddylist.h" -#include "gg-utils.h" - -static PurplePlugin *my_protocol = NULL; - -/* ---------------------------------------------------------------------- */ -/* ----- EXTERNAL CALLBACKS --------------------------------------------- */ -/* ---------------------------------------------------------------------- */ - - -/* ----- HELPERS -------------------------------------------------------- */ - -/** - * Set up libgadu's proxy. - * - * @param account Account for which to set up the proxy. - * - * @return Zero if proxy setup is valid, otherwise -1. - */ -static int ggp_setup_proxy(PurpleAccount *account) -{ - PurpleProxyInfo *gpi; - - gpi = purple_proxy_get_setup(account); - - if ((purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) && - (purple_proxy_info_get_host(gpi) == NULL || - purple_proxy_info_get_port(gpi) <= 0)) { - - gg_proxy_enabled = 0; - purple_notify_error(NULL, NULL, _("Invalid proxy settings"), - _("Either the host name or port number specified for your given proxy type is invalid.")); - return -1; - } else if (purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) { - gg_proxy_enabled = 1; - gg_proxy_host = g_strdup(purple_proxy_info_get_host(gpi)); - gg_proxy_port = purple_proxy_info_get_port(gpi); - gg_proxy_username = g_strdup(purple_proxy_info_get_username(gpi)); - gg_proxy_password = g_strdup(purple_proxy_info_get_password(gpi)); - } else { - gg_proxy_enabled = 0; - } - - return 0; -} - -static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) -{ - PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - GGPTokenCallback cb; - - struct gg_token *t = NULL; - - purple_debug_info("gg", "token_handler: token->req: check = %d; state = %d;\n", - token->req->check, token->req->state); - - if (gg_token_watch_fd(token->req) == -1 || token->req->state == GG_STATE_ERROR) { - purple_debug_error("gg", "token error (1): %d\n", token->req->error); - purple_input_remove(token->inpa); - gg_token_free(token->req); - token->req = NULL; - - purple_notify_error(purple_connection_get_account(gc), - _("Token Error"), - _("Unable to fetch the token.\n"), NULL); - return; - } - - if (token->req->state != GG_STATE_DONE) { - purple_input_remove(token->inpa); - token->inpa = purple_input_add(token->req->fd, - (token->req->check == 1) - ? PURPLE_INPUT_WRITE - : PURPLE_INPUT_READ, - ggp_async_token_handler, gc); - return; - } - - if (!(t = token->req->data) || !token->req->body) { - purple_debug_error("gg", "token error (2): %d\n", token->req->error); - purple_input_remove(token->inpa); - gg_token_free(token->req); - token->req = NULL; - - purple_notify_error(purple_connection_get_account(gc), - _("Token Error"), - _("Unable to fetch the token.\n"), NULL); - return; - } - - purple_input_remove(token->inpa); - - token->id = g_strdup(t->tokenid); - token->size = token->req->body_size; - token->data = g_new0(char, token->size); - memcpy(token->data, token->req->body, token->size); - - purple_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n", - token->id, token->size); - - gg_token_free(token->req); - token->req = NULL; - token->inpa = 0; - - cb = token->cb; - token->cb = NULL; - cb(gc); -} - -static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) -{ - PurpleAccount *account; - struct gg_http *req; - GGPInfo *info; - - account = purple_connection_get_account(gc); - - if (ggp_setup_proxy(account) == -1) - return; - - info = gc->proto_data; - - if ((req = gg_token(1)) == NULL) { - purple_notify_error(account, - _("Token Error"), - _("Unable to fetch the token.\n"), NULL); - return; - } - - info->token = g_new(GGPToken, 1); - info->token->cb = cb; - - info->token->req = req; - info->token->inpa = purple_input_add(req->fd, PURPLE_INPUT_READ, - ggp_async_token_handler, gc); -} -/* }}} */ - -/* ---------------------------------------------------------------------- */ - -/** - * Request buddylist from the server. - * Buddylist is received in the ggp_callback_recv(). - * - * @param Current action handler. - */ -static void ggp_action_buddylist_get(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; - - purple_debug_info("gg", "Downloading...\n"); - - gg_userlist_request(info->session, GG_USERLIST_GET, NULL); -} - -/** - * Upload the buddylist to the server. - * - * @param action Current action handler. - */ -static void ggp_action_buddylist_put(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; - - char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc)); - - purple_debug_info("gg", "Uploading...\n"); - - if (buddylist == NULL) - return; - - gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist); - g_free(buddylist); -} - -/** - * Delete buddylist from the server. - * - * @param action Current action handler. - */ -static void ggp_action_buddylist_delete(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; - - purple_debug_info("gg", "Deleting...\n"); - - gg_userlist_request(info->session, GG_USERLIST_PUT, NULL); -} - -static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename) -{ - PurpleAccount *account = purple_connection_get_account(gc); - - char *buddylist = ggp_buddylist_dump(account); - - purple_debug_info("gg", "Saving...\n"); - purple_debug_info("gg", "file = %s\n", filename); - - if (buddylist == NULL) { - purple_notify_info(account, _("Save Buddylist..."), - _("Your buddylist is empty, nothing was written to the file."), - NULL); - return; - } - - if(purple_util_write_data_to_file_absolute(filename, buddylist, -1)) { - purple_notify_info(account, _("Save Buddylist..."), - _("Buddylist saved successfully!"), NULL); - } else { - gchar *primary = g_strdup_printf( - _("Couldn't write buddy list for %s to %s"), - purple_account_get_username(account), filename); - purple_notify_error(account, _("Save Buddylist..."), - primary, NULL); - g_free(primary); - } - - g_free(buddylist); -} - -static void ggp_callback_buddylist_load_ok(PurpleConnection *gc, gchar *file) -{ - PurpleAccount *account = purple_connection_get_account(gc); - GError *error = NULL; - char *buddylist = NULL; - gsize length; - - purple_debug_info("gg", "file_name = %s\n", file); - - if (!g_file_get_contents(file, &buddylist, &length, &error)) { - purple_notify_error(account, - _("Couldn't load buddylist"), - _("Couldn't load buddylist"), - error->message); - - purple_debug_error("gg", - "Couldn't load buddylist. file = %s; error = %s\n", - file, error->message); - - g_error_free(error); - - return; - } - - ggp_buddylist_load(gc, buddylist); - g_free(buddylist); - - purple_notify_info(account, - _("Load Buddylist..."), - _("Buddylist loaded successfully!"), NULL); -} -/* }}} */ - -/* - */ -/* static void ggp_action_buddylist_save(PurplePluginAction *action) {{{ */ -static void ggp_action_buddylist_save(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - purple_request_file(action, _("Save buddylist..."), NULL, TRUE, - G_CALLBACK(ggp_callback_buddylist_save_ok), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void ggp_action_buddylist_load(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - purple_request_file(action, _("Load buddylist from file..."), NULL, - FALSE, - G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void ggp_callback_register_account_ok(PurpleConnection *gc, - PurpleRequestFields *fields) -{ - PurpleAccount *account; - GGPInfo *info = gc->proto_data; - struct gg_http *h = NULL; - struct gg_pubdir *s; - uin_t uin; - gchar *email, *p1, *p2, *t; - GGPToken *token = info->token; - - email = charset_convert(purple_request_fields_get_string(fields, "email"), - "UTF-8", "CP1250"); - p1 = charset_convert(purple_request_fields_get_string(fields, "password1"), - "UTF-8", "CP1250"); - p2 = charset_convert(purple_request_fields_get_string(fields, "password2"), - "UTF-8", "CP1250"); - t = charset_convert(purple_request_fields_get_string(fields, "token"), - "UTF-8", "CP1250"); - - account = purple_connection_get_account(gc); - - if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || - *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("You must fill in all registration fields")); - goto exit_err; - } - - if (g_utf8_collate(p1, p2) != 0) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Passwords do not match")); - goto exit_err; - } - - purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n", - token->id, t); - h = gg_register3(email, p1, token->id, t, 0); - if (h == NULL || !(s = h->data) || !s->success) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to register new account. An unknown error occurred.")); - goto exit_err; - } - - uin = s->uin; - purple_debug_info("gg", "registered uin: %d\n", uin); - - g_free(t); - t = g_strdup_printf("%u", uin); - purple_account_set_username(account, t); - /* Save the password if remembering passwords for the account */ - purple_account_set_password(account, p1); - - purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"), - _("Registration completed successfully!"), NULL); - - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - /* TODO: the currently open Accounts Window will not be updated withthe - * new username and etc, we need to somehow have it refresh at this - * point - */ - - /* Need to disconnect or actually log in. For now, we disconnect. */ - purple_account_disconnect(account); - -exit_err: - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - - gg_register_free(h); - g_free(email); - g_free(p1); - g_free(p2); - g_free(t); - g_free(token->id); - g_free(token); -} - -static void ggp_callback_register_account_cancel(PurpleConnection *gc, - PurpleRequestFields *fields) -{ - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - - purple_account_disconnect(gc->account); - - g_free(token->id); - g_free(token->data); - g_free(token); - -} - -static void ggp_register_user_dialog(PurpleConnection *gc) -{ - PurpleAccount *account; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - - - account = purple_connection_get_account(gc); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("email", - _("Email"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password1", - _("Password"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password2", - _("Password (again)"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("token", - _("Enter captcha text"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - /* original size: 60x24 */ - field = purple_request_field_image_new("token_img", - _("Captcha"), token->data, token->size); - purple_request_field_group_add_field(group, field); - - purple_request_fields(account, - _("Register New Gadu-Gadu Account"), - _("Register New Gadu-Gadu Account"), - _("Please, fill in the following fields"), - fields, - _("OK"), G_CALLBACK(ggp_callback_register_account_ok), - _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel), - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -/* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */ - -static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form = user_data; - guint32 seq; - - g_free(form->offset); - form->offset = g_strdup(form->last_uin); - - ggp_search_remove(info->searches, form->seq); - purple_debug_info("gg", "ggp_callback_show_next(): Removed seq %u", form->seq); - - seq = ggp_search_start(gc, form); - ggp_search_add(info->searches, seq, form); - purple_debug_info("gg", "ggp_callback_show_next(): Added seq %u", seq); -} - -static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data) -{ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 0), NULL, NULL); -} - -static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data) -{ - PurpleAccount *account; - PurpleConversation *conv; - char *name; - - account = purple_connection_get_account(gc); - - name = g_list_nth_data(row, 0); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); - purple_conversation_present(conv); -} - -static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form; - guint32 seq; - - form = ggp_search_form_new(GGP_SEARCH_TYPE_FULL); - - form->user_data = info; - form->lastname = charset_convert( - purple_request_fields_get_string(fields, "lastname"), - "UTF-8", "CP1250"); - form->firstname = charset_convert( - purple_request_fields_get_string(fields, "firstname"), - "UTF-8", "CP1250"); - form->nickname = charset_convert( - purple_request_fields_get_string(fields, "nickname"), - "UTF-8", "CP1250"); - form->city = charset_convert( - purple_request_fields_get_string(fields, "city"), - "UTF-8", "CP1250"); - form->birthyear = charset_convert( - purple_request_fields_get_string(fields, "year"), - "UTF-8", "CP1250"); - - switch (purple_request_fields_get_choice(fields, "gender")) { - case 1: - form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE); - break; - case 2: - form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE); - break; - default: - form->gender = NULL; - break; - } - - form->active = purple_request_fields_get_bool(fields, "active") - ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL; - - form->offset = g_strdup("0"); - - seq = ggp_search_start(gc, form); - ggp_search_add(info->searches, seq, form); - purple_debug_info("gg", "ggp_callback_find_buddies(): Added seq %u", seq); -} - -static void ggp_find_buddies(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("lastname", - _("Last name"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("firstname", - _("First name"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("nickname", - _("Nickname"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("city", - _("City"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("year", - _("Year of birth"), NULL, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_choice_new("gender", _("Gender"), 0); - purple_request_field_choice_add(field, _("Male or female")); - purple_request_field_choice_add(field, _("Male")); - purple_request_field_choice_add(field, _("Female")); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_bool_new("active", - _("Only online"), FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(gc, - _("Find buddies"), - _("Find buddies"), - _("Please, enter your search criteria below"), - fields, - _("OK"), G_CALLBACK(ggp_callback_find_buddies), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -/* ----- CHANGE PASSWORD ------------------------------------------------ */ - -static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *account; - GGPInfo *info = gc->proto_data; - struct gg_http *h; - gchar *cur, *p1, *p2, *t; - - cur = charset_convert( - purple_request_fields_get_string(fields, "password_cur"), - "UTF-8", "CP1250"); - p1 = charset_convert( - purple_request_fields_get_string(fields, "password1"), - "UTF-8", "CP1250"); - p2 = charset_convert( - purple_request_fields_get_string(fields, "password2"), - "UTF-8", "CP1250"); - t = charset_convert( - purple_request_fields_get_string(fields, "token"), - "UTF-8", "CP1250"); - - account = purple_connection_get_account(gc); - - if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || - *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_notify_error(account, NULL, _("Fill in the fields."), NULL); - goto exit_err; - } - - if (g_utf8_collate(p1, p2) != 0) { - purple_notify_error(account, NULL, - _("New passwords do not match."), NULL); - goto exit_err; - } - - if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { - purple_notify_error(account, NULL, - _("Your current password is different from the one that you specified."), - NULL); - goto exit_err; - } - - purple_debug_info("gg", "Changing password\n"); - - /* XXX: this email should be a pref... */ - h = gg_change_passwd4(ggp_get_uin(account), - "user@example.net", purple_account_get_password(account), - p1, info->token->id, t, 0); - - if (h == NULL) { - purple_notify_error(account, NULL, - _("Unable to change password. Error occurred.\n"), - NULL); - goto exit_err; - } - - purple_account_set_password(account, p1); - - gg_change_passwd_free(h); - - purple_notify_info(account, _("Change password for the Gadu-Gadu account"), - _("Password was changed successfully!"), NULL); - -exit_err: - g_free(cur); - g_free(p1); - g_free(p2); - g_free(t); - g_free(info->token->id); - g_free(info->token->data); - g_free(info->token); -} - -static void ggp_change_passwd_dialog(PurpleConnection *gc) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - - char *msg; - - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("password_cur", - _("Current password"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password1", - _("Password"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password2", - _("Password (retype)"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("token", - _("Enter current token"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - /* original size: 60x24 */ - field = purple_request_field_image_new("token_img", - _("Current token"), token->data, token->size); - purple_request_field_group_add_field(group, field); - - msg = g_strdup_printf("%s %d", - _("Please, enter your current password and your new password for UIN: "), - ggp_get_uin(purple_connection_get_account(gc))); - - purple_request_fields(gc, - _("Change Gadu-Gadu Password"), - _("Change Gadu-Gadu Password"), - msg, - fields, _("OK"), G_CALLBACK(ggp_callback_change_passwd_ok), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - - g_free(msg); -} - -static void ggp_change_passwd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - ggp_token_request(gc, ggp_change_passwd_dialog); -} - -/* ----- CONFERENCES ---------------------------------------------------- */ - -static void ggp_callback_add_to_chat_ok(PurpleBuddy *buddy, PurpleRequestFields *fields) -{ - GGPInfo *info; - PurpleConnection *conn; - PurpleRequestField *field; - GList *sel; - - conn = purple_account_get_connection(purple_buddy_get_account(buddy)); - - g_return_if_fail(conn != NULL); - - info = conn->proto_data; - - field = purple_request_fields_get_field(fields, "name"); - sel = purple_request_field_list_get_selected(field); - - if (sel == NULL) { - purple_debug_error("gg", "No chat selected\n"); - return; - } - - ggp_confer_participants_add_uin(conn, sel->data, - ggp_str_to_uin(purple_buddy_get_name(buddy))); -} - -static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - GGPInfo *info; - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - GList *l; - gchar *msg; - - buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - info = gc->proto_data; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_list_new("name", "Chat name"); - for (l = info->chats; l != NULL; l = l->next) { - GGPChat *chat = l->data; - purple_request_field_list_add(field, chat->name, chat->name); - } - purple_request_field_group_add_field(group, field); - - msg = g_strdup_printf(_("Select a chat for buddy: %s"), - purple_buddy_get_alias(buddy)); - purple_request_fields(gc, - _("Add to chat..."), - _("Add to chat..."), - msg, - fields, - _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - buddy); - g_free(msg); -} - -/* ----- BLOCK BUDDIES -------------------------------------------------- */ - -static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) -{ - PurpleConnection *gc; - PurpleBuddy *buddy; - GGPInfo *info; - uin_t uin; - - buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - info = gc->proto_data; - - uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); - - if (purple_blist_node_get_bool(node, "blocked")) { - purple_blist_node_set_bool(node, "blocked", FALSE); - gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); - gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); - purple_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); - } else { - purple_blist_node_set_bool(node, "blocked", TRUE); - gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); - gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); - purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); - } -} - -/* ---------------------------------------------------------------------- */ -/* ----- INTERNAL CALLBACKS --------------------------------------------- */ -/* ---------------------------------------------------------------------- */ - -/* Prototypes */ -static void ggp_set_status(PurpleAccount *account, PurpleStatus *status); -static int ggp_to_gg_status(PurpleStatus *status, char **msg); - -struct gg_fetch_avatar_data -{ - PurpleConnection *gc; - gchar *uin; - gchar *avatar_url; -}; - - -static void gg_fetch_avatar_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *data, size_t len, const gchar *error_message) { - struct gg_fetch_avatar_data *d = user_data; - PurpleAccount *account; - PurpleBuddy *buddy; - gpointer buddy_icon_data; - - /* FIXME: This shouldn't be necessary */ - if (!PURPLE_CONNECTION_IS_VALID(d->gc)) { - g_free(d->uin); - g_free(d->avatar_url); - g_free(d); - g_return_if_reached(); - } - - account = purple_connection_get_account(d->gc); - buddy = purple_find_buddy(account, d->uin); - - if (buddy == NULL) - goto out; - - buddy_icon_data = g_memdup(data, len); - - purple_buddy_icons_set_for_user(account, purple_buddy_get_name(buddy), - buddy_icon_data, len, d->avatar_url); - purple_debug_info("gg", "UIN: %s should have avatar now\n", d->uin); - -out: - g_free(d->uin); - g_free(d->avatar_url); - g_free(d); -} - -static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) { - struct gg_fetch_avatar_data *data; - PurpleConnection *gc = user_data; - PurpleAccount *account; - PurpleBuddy *buddy; - const char *uin; - const char *is_blank; - const char *checksum; - - gchar *bigavatar = NULL; - xmlnode *xml = NULL; - xmlnode *xmlnode_users; - xmlnode *xmlnode_user; - xmlnode *xmlnode_avatars; - xmlnode *xmlnode_avatar; - xmlnode *xmlnode_bigavatar; - - g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - account = purple_connection_get_account(gc); - - if (error_message != NULL) - purple_debug_error("gg", "gg_get_avatars_cb error: %s\n", error_message); - else if (len > 0 && url_text && *url_text) { - xml = xmlnode_from_str(url_text, -1); - if (xml == NULL) - goto out; - - xmlnode_users = xmlnode_get_child(xml, "users"); - if (xmlnode_users == NULL) - goto out; - - xmlnode_user = xmlnode_get_child(xmlnode_users, "user"); - if (xmlnode_user == NULL) - goto out; - - uin = xmlnode_get_attrib(xmlnode_user, "uin"); - - xmlnode_avatars = xmlnode_get_child(xmlnode_user, "avatars"); - if (xmlnode_avatars == NULL) - goto out; - - xmlnode_avatar = xmlnode_get_child(xmlnode_avatars, "avatar"); - if (xmlnode_avatar == NULL) - goto out; - - xmlnode_bigavatar = xmlnode_get_child(xmlnode_avatar, "bigAvatar"); - if (xmlnode_bigavatar == NULL) - goto out; - - is_blank = xmlnode_get_attrib(xmlnode_avatar, "blank"); - bigavatar = xmlnode_get_data(xmlnode_bigavatar); - - purple_debug_info("gg", "gg_get_avatar_url_cb: UIN %s, IS_BLANK %s, " - "URL %s\n", - uin ? uin : "(null)", is_blank ? is_blank : "(null)", - bigavatar ? bigavatar : "(null)"); - - if (uin != NULL && bigavatar != NULL) { - buddy = purple_find_buddy(account, uin); - if (buddy == NULL) - goto out; - - checksum = purple_buddy_icons_get_checksum_for_user(buddy); - - if (purple_strequal(is_blank, "1")) { - purple_buddy_icons_set_for_user(account, - purple_buddy_get_name(buddy), NULL, 0, NULL); - } else if (!purple_strequal(checksum, bigavatar)) { - data = g_new0(struct gg_fetch_avatar_data, 1); - data->gc = gc; - data->uin = g_strdup(uin); - data->avatar_url = g_strdup(bigavatar); - - url_data = purple_util_fetch_url_request_len_with_account(account, - bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", - FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); - } - } - } - -out: - if (xml) - xmlnode_free(xml); - g_free(bigavatar); -} - -/** - * Handle change of the status of the buddy. - * - * @param gc PurpleConnection - * @param uin UIN of the buddy. - * @param status ID of the status. - * @param descr Description. - */ -static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, - int status, const char *descr) -{ - gchar *from; - const char *st; - gchar *msg; - gchar *avatarurl; - PurpleUtilFetchUrlData *url_data; - - from = g_strdup_printf("%u", uin); - avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%s/0.xml", from); - - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), avatarurl, TRUE, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, - gg_get_avatar_url_cb, gc); - - g_free(avatarurl); - - switch (status) { - case GG_STATUS_NOT_AVAIL: - case GG_STATUS_NOT_AVAIL_DESCR: - st = "offline"; - break; - case GG_STATUS_AVAIL: - case GG_STATUS_AVAIL_DESCR: - st = "available"; - break; - case GG_STATUS_BUSY: - case GG_STATUS_BUSY_DESCR: - st = "away"; - break; - case GG_STATUS_BLOCKED: - /* user is blocking us.... */ - st = "blocked"; - break; - default: - st = "available"; - purple_debug_info("gg", - "GG_EVENT_NOTIFY: Unknown status: %d\n", status); - break; - } - - purple_debug_info("gg", "st = %s\n", st); - msg = charset_convert(descr, "CP1250", "UTF-8"); - purple_prpl_got_user_status(purple_connection_get_account(gc), - from, st, "message", msg, NULL); - g_free(from); - g_free(msg); -} - -static void ggp_sr_close_cb(gpointer user_data) -{ - GGPSearchForm *form = user_data; - GGPInfo *info = form->user_data; - - ggp_search_remove(info->searches, form->seq); - purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u", form->seq); - ggp_search_form_destroy(form); -} - -/** - * Translate a status' ID to a more user-friendly name. - * - * @param id The ID of the status. - * - * @return The user-friendly name of the status. - */ -static const char *ggp_status_by_id(unsigned int id) -{ - const char *st; - - purple_debug_info("gg", "ggp_status_by_id: %d\n", id); - switch (id) { - case GG_STATUS_NOT_AVAIL: - case GG_STATUS_NOT_AVAIL_DESCR: - st = _("Offline"); - break; - case GG_STATUS_AVAIL: - case GG_STATUS_AVAIL_DESCR: - st = _("Available"); - break; - case GG_STATUS_BUSY: - case GG_STATUS_BUSY_DESCR: - st = _("Away"); - break; - default: - st = _("Unknown"); - break; - } - - return st; -} - -static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, - GGPSearchForm *form) -{ - PurpleNotifyUserInfo *user_info; - PurpleBuddy *buddy; - char *val, *who; - - user_info = purple_notify_user_info_new(); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS); - /* XXX: Use of ggp_str_to_uin() is an ugly hack! */ - purple_notify_user_info_add_pair(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); - g_free(val); - - who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); - purple_notify_user_info_add_pair(user_info, _("UIN"), who); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); - purple_notify_user_info_add_pair(user_info, _("First Name"), val); - g_free(val); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); - purple_notify_user_info_add_pair(user_info, _("Nickname"), val); - g_free(val); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); - purple_notify_user_info_add_pair(user_info, _("City"), val); - g_free(val); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); - if (strncmp(val, "0", 1)) { - purple_notify_user_info_add_pair(user_info, _("Birth Year"), val); - } - g_free(val); - - /* - * Include a status message, if exists and buddy is in the blist. - */ - buddy = purple_find_buddy(purple_connection_get_account(gc), who); - if (NULL != buddy) { - PurpleStatus *status; - const char *msg; - char *text; - - status = purple_presence_get_active_status(purple_buddy_get_presence(buddy)); - msg = purple_status_get_attr_string(status, "message"); - - if (msg != NULL) { - text = g_markup_escape_text(msg, -1); - purple_notify_user_info_add_pair(user_info, _("Message"), text); - g_free(text); - } - } - - purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form); - g_free(who); - purple_notify_user_info_destroy(user_info); -} - -static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, - GGPSearchForm *form) -{ - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - int res_count; - int start; - int i; - - g_return_if_fail(form != NULL); - - res_count = gg_pubdir50_count(req); - res_count = (res_count > PUBDIR_RESULTS_MAX) ? PUBDIR_RESULTS_MAX : res_count; - - results = purple_notify_searchresults_new(); - - if (results == NULL) { - purple_debug_error("gg", "ggp_pubdir_reply_handler: " - "Unable to display the search results.\n"); - purple_notify_error(gc, NULL, - _("Unable to display the search results."), - NULL); - ggp_sr_close_cb(form); - return; - } - - column = purple_notify_searchresults_column_new(_("UIN")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("First Name")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("Nickname")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("City")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("Birth Year")); - purple_notify_searchresults_column_add(results, column); - - purple_debug_info("gg", "Going with %d entries\n", res_count); - - start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START)); - purple_debug_info("gg", "start = %d\n", start); - - for (i = 0; i < res_count; i++) { - GList *row = NULL; - char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR); - - /* TODO: Status will be displayed as an icon. */ - /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */ - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_UIN)); - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_FIRSTNAME)); - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_NICKNAME)); - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_CITY)); - row = g_list_append(row, - (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-")); - - purple_notify_searchresults_row_add(results, row); - - if (i == res_count - 1) { - g_free(form->last_uin); - form->last_uin = ggp_search_get_result(req, i, GG_PUBDIR50_UIN); - } - } - - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_CONTINUE, - ggp_callback_show_next); - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - ggp_callback_add_buddy); - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_IM, - ggp_callback_im); - - if (form->window == NULL) { - void *h = purple_notify_searchresults(gc, - _("Gadu-Gadu Public Directory"), - _("Search results"), NULL, results, - (PurpleNotifyCloseCallback)ggp_sr_close_cb, - form); - - if (h == NULL) { - purple_debug_error("gg", "ggp_pubdir_reply_handler: " - "Unable to display the search results.\n"); - purple_notify_error(gc, NULL, - _("Unable to display the search results."), - NULL); - return; - } - - form->window = h; - } else { - purple_notify_searchresults_new_rows(gc, results, form->window); - } -} - -static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form; - int res_count; - guint32 seq; - - seq = gg_pubdir50_seq(req); - form = ggp_search_get(info->searches, seq); - purple_debug_info("gg", "ggp_pubdir_reply_handler(): seq %u --> form %p", seq, form); - /* - * this can happen when user will request more results - * and close the results window before they arrive. - */ - g_return_if_fail(form != NULL); - - res_count = gg_pubdir50_count(req); - if (res_count < 1) { - purple_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n"); - purple_notify_error(gc, NULL, - _("No matching users found"), - _("There are no users matching your search criteria.")); - ggp_sr_close_cb(form); - return; - } - - switch (form->search_type) { - case GGP_SEARCH_TYPE_INFO: - ggp_pubdir_handle_info(gc, req, form); - break; - case GGP_SEARCH_TYPE_FULL: - ggp_pubdir_handle_full(gc, req, form); - break; - default: - purple_debug_warning("gg", "Unknown search_type!\n"); - break; - } -} - -static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) -{ - gint imgid = 0; - GGPInfo *info = gc->proto_data; - GList *entry = g_list_first(info->pending_richtext_messages); - gchar *handlerid = g_strdup_printf("IMGID_HANDLER-%i", ev->event.image_reply.crc32); - - imgid = purple_imgstore_add_with_id( - g_memdup(ev->event.image_reply.image, ev->event.image_reply.size), - ev->event.image_reply.size, - ev->event.image_reply.filename); - - purple_debug_info("gg", "ggp_recv_image_handler: got image with crc32: %u\n", ev->event.image_reply.crc32); - - while(entry) { - if (strstr((gchar *)entry->data, handlerid) != NULL) { - gchar **split = g_strsplit((gchar *)entry->data, handlerid, 3); - gchar *text = g_strdup_printf("%s%i%s", split[0], imgid, split[1]); - purple_debug_info("gg", "ggp_recv_image_handler: found message matching crc32: %s\n", (gchar *)entry->data); - g_strfreev(split); - info->pending_richtext_messages = g_list_remove(info->pending_richtext_messages, entry->data); - /* We don't have any more images to download */ - if (strstr(text, "event.msg.sender); - serv_got_im(gc, buf, text, PURPLE_MESSAGE_IMAGES, ev->event.msg.time); - g_free(buf); - purple_debug_info("gg", "ggp_recv_image_handler: richtext message: %s\n", text); - g_free(text); - break; - } - info->pending_richtext_messages = g_list_append(info->pending_richtext_messages, text); - break; - } - entry = g_list_next(entry); - } - g_free(handlerid); - - return; -} - - -/** - * Dispatch a message received from a buddy. - * - * @param gc PurpleConnection. - * @param ev Gadu-Gadu event structure. - * - * Image receiving, some code borrowed from Kadu http://www.kadu.net - */ -static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) -{ - GGPInfo *info = gc->proto_data; - PurpleConversation *conv; - gchar *from; - gchar *msg; - gchar *tmp; - - from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); - - tmp = charset_convert((const char *)ev->event.msg.message, - "CP1250", "UTF-8"); - purple_str_strip_char(tmp, '\r'); - msg = g_markup_escape_text(tmp, -1); - g_free(tmp); - - /* We got richtext message */ - if (ev->event.msg.formats_length) - { - gboolean got_image = FALSE, bold = FALSE, italic = FALSE, under = FALSE; - char *cformats = (char *)ev->event.msg.formats; - char *cformats_end = cformats + ev->event.msg.formats_length; - gint increased_len = 0; - struct gg_msg_richtext_format *actformat; - struct gg_msg_richtext_image *actimage; - GString *message = g_string_new(msg); - gchar *handlerid; - - purple_debug_info("gg", "ggp_recv_message_handler: richtext msg from (%s): %s %i formats\n", from, msg, ev->event.msg.formats_length); - - while (cformats < cformats_end) - { - gint byteoffset; - actformat = (struct gg_msg_richtext_format *)cformats; - cformats += sizeof(struct gg_msg_richtext_format); - byteoffset = g_utf8_offset_to_pointer(message->str, actformat->position + increased_len) - message->str; - - if(actformat->position == 0 && actformat->font == 0) { - purple_debug_warning("gg", "ggp_recv_message_handler: bogus formatting (inc: %i)\n", increased_len); - continue; - } - purple_debug_info("gg", "ggp_recv_message_handler: format at pos: %i, image:%i, bold:%i, italic: %i, under:%i (inc: %i)\n", - actformat->position, - (actformat->font & GG_FONT_IMAGE) != 0, - (actformat->font & GG_FONT_BOLD) != 0, - (actformat->font & GG_FONT_ITALIC) != 0, - (actformat->font & GG_FONT_UNDERLINE) != 0, - increased_len); - - if (actformat->font & GG_FONT_IMAGE) { - got_image = TRUE; - actimage = (struct gg_msg_richtext_image*)(cformats); - cformats += sizeof(struct gg_msg_richtext_image); - purple_debug_info("gg", "ggp_recv_message_handler: image received, size: %d, crc32: %i\n", actimage->size, actimage->crc32); - - /* Checking for errors, image size shouldn't be - * larger than 255.000 bytes */ - if (actimage->size > 255000) { - purple_debug_warning("gg", "ggp_recv_message_handler: received image large than 255 kb\n"); - continue; - } - - gg_image_request(info->session, ev->event.msg.sender, - actimage->size, actimage->crc32); - - handlerid = g_strdup_printf("", actimage->crc32); - g_string_insert(message, byteoffset, handlerid); - increased_len += strlen(handlerid); - g_free(handlerid); - continue; - } - - if (actformat->font & GG_FONT_BOLD) { - if (bold == FALSE) { - g_string_insert(message, byteoffset, ""); - increased_len += 3; - bold = TRUE; - } - } else if (bold) { - g_string_insert(message, byteoffset, ""); - increased_len += 4; - bold = FALSE; - } - - if (actformat->font & GG_FONT_ITALIC) { - if (italic == FALSE) { - g_string_insert(message, byteoffset, ""); - increased_len += 3; - italic = TRUE; - } - } else if (italic) { - g_string_insert(message, byteoffset, ""); - increased_len += 4; - italic = FALSE; - } - - if (actformat->font & GG_FONT_UNDERLINE) { - if (under == FALSE) { - g_string_insert(message, byteoffset, ""); - increased_len += 3; - under = TRUE; - } - } else if (under) { - g_string_insert(message, byteoffset, ""); - increased_len += 4; - under = FALSE; - } - } - - msg = message->str; - g_string_free(message, FALSE); - - if (got_image) { - info->pending_richtext_messages = g_list_append(info->pending_richtext_messages, msg); - return; - } - } - - purple_debug_info("gg", "ggp_recv_message_handler: msg from (%s): %s (class = %d; rcpt_count = %d)\n", - from, msg, ev->event.msg.msgclass, - ev->event.msg.recipients_count); - - if (ev->event.msg.recipients_count == 0) { - serv_got_im(gc, from, msg, 0, ev->event.msg.time); - } else { - const char *chat_name; - int chat_id; - char *buddy_name; - - chat_name = ggp_confer_find_by_participants(gc, - ev->event.msg.recipients, - ev->event.msg.recipients_count); - - if (chat_name == NULL) { - chat_name = ggp_confer_add_new(gc, NULL); - serv_got_joined_chat(gc, info->chats_count, chat_name); - - ggp_confer_participants_add_uin(gc, chat_name, - ev->event.msg.sender); - - ggp_confer_participants_add(gc, chat_name, - ev->event.msg.recipients, - ev->event.msg.recipients_count); - } - conv = ggp_confer_find_by_name(gc, chat_name); - chat_id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); - serv_got_chat_in(gc, chat_id, buddy_name, - PURPLE_MESSAGE_RECV, msg, ev->event.msg.time); - g_free(buddy_name); - } - g_free(msg); - g_free(from); -} - -static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) -{ - GGPInfo *info = gc->proto_data; - PurpleStoredImage *image; - gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, &ev->event.image_request.crc32)); - - purple_debug_info("gg", "ggp_send_image_handler: image request received, crc32: %u\n", ev->event.image_request.crc32); - - if(imgid) - { - if((image = purple_imgstore_find_by_id(imgid))) { - gint image_size = purple_imgstore_get_size(image); - gconstpointer image_bin = purple_imgstore_get_data(image); - const char *image_filename = purple_imgstore_get_filename(image); - - purple_debug_info("gg", "ggp_send_image_handler: sending image imgid: %i, crc: %u\n", imgid, ev->event.image_request.crc32); - gg_image_reply(info->session, (unsigned long int)ev->event.image_request.sender, image_filename, image_bin, image_size); - purple_imgstore_unref(image); - } else { - purple_debug_error("gg", "ggp_send_image_handler: image imgid: %i, crc: %u in hash but not found in imgstore!\n", imgid, ev->event.image_request.crc32); - } - g_hash_table_remove(info->pending_images, &ev->event.image_request.crc32); - } -} - -static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) -{ - PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; - struct gg_event *ev; - int i; - - if (!(ev = gg_watch_fd(info->session))) { - purple_debug_error("gg", - "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to read from socket")); - return; - } - gc->last_received = time(NULL); - switch (ev->type) { - case GG_EVENT_NONE: - /* Nothing happened. */ - break; - case GG_EVENT_MSG: - ggp_recv_message_handler(gc, ev); - break; - case GG_EVENT_ACK: - /* Changing %u to %i fixes compiler warning */ - purple_debug_info("gg", - "ggp_callback_recv: message sent to: %i, delivery status=%d, seq=%d\n", - ev->event.ack.recipient, ev->event.ack.status, - ev->event.ack.seq); - break; - case GG_EVENT_IMAGE_REPLY: - ggp_recv_image_handler(gc, ev); - break; - case GG_EVENT_IMAGE_REQUEST: - ggp_send_image_handler(gc, ev); - break; - case GG_EVENT_NOTIFY: - case GG_EVENT_NOTIFY_DESCR: - { - struct gg_notify_reply *n; - char *descr; - - purple_debug_info("gg", "notify_pre: (%d) status: %d\n", - ev->event.notify->uin, - ev->event.notify->status); - - n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify - : ev->event.notify_descr.notify; - - for (; n->uin; n++) { - descr = (ev->type == GG_EVENT_NOTIFY) ? NULL - : ev->event.notify_descr.descr; - - purple_debug_info("gg", - "notify: (%d) status: %d; descr: %s\n", - n->uin, n->status, descr ? descr : "(null)"); - - ggp_generic_status_handler(gc, - n->uin, n->status, descr); - } - } - break; - case GG_EVENT_NOTIFY60: - purple_debug_info("gg", - "notify60_pre: (%d) status=%d; version=%d; descr=%s\n", - ev->event.notify60->uin, ev->event.notify60->status, - ev->event.notify60->version, - ev->event.notify60->descr ? ev->event.notify60->descr : "(null)"); - - for (i = 0; ev->event.notify60[i].uin; i++) { - purple_debug_info("gg", - "notify60: (%d) status=%d; version=%d; descr=%s\n", - ev->event.notify60[i].uin, - ev->event.notify60[i].status, - ev->event.notify60[i].version, - ev->event.notify60[i].descr ? ev->event.notify60[i].descr : "(null)"); - - ggp_generic_status_handler(gc, ev->event.notify60[i].uin, - ev->event.notify60[i].status, - ev->event.notify60[i].descr); - } - break; - case GG_EVENT_STATUS: - purple_debug_info("gg", "status: (%d) status=%d; descr=%s\n", - ev->event.status.uin, ev->event.status.status, - ev->event.status.descr ? ev->event.status.descr : "(null)"); - - ggp_generic_status_handler(gc, ev->event.status.uin, - ev->event.status.status, ev->event.status.descr); - break; - case GG_EVENT_STATUS60: - purple_debug_info("gg", - "status60: (%d) status=%d; version=%d; descr=%s\n", - ev->event.status60.uin, ev->event.status60.status, - ev->event.status60.version, - ev->event.status60.descr ? ev->event.status60.descr : "(null)"); - - ggp_generic_status_handler(gc, ev->event.status60.uin, - ev->event.status60.status, ev->event.status60.descr); - break; - case GG_EVENT_USERLIST: - if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) { - purple_debug_info("gg", "GG_USERLIST_GET_REPLY\n"); - purple_notify_info(gc, NULL, - _("Buddy list downloaded"), - _("Your buddy list was downloaded from the server.")); - if (ev->event.userlist.reply != NULL) { - ggp_buddylist_load(gc, ev->event.userlist.reply); - } - } else { - purple_debug_info("gg", "GG_USERLIST_PUT_REPLY\n"); - purple_notify_info(gc, NULL, - _("Buddy list uploaded"), - _("Your buddy list was stored on the server.")); - } - break; - case GG_EVENT_PUBDIR50_SEARCH_REPLY: - ggp_pubdir_reply_handler(gc, ev->event.pubdir50); - break; - default: - purple_debug_error("gg", - "unsupported event type=%d\n", ev->type); - break; - } - - gg_free_event(ev); -} - -static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) -{ - PurpleConnection *gc = _gc; - GGPInfo *info; - struct gg_event *ev; - - g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - - info = gc->proto_data; - - purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", - info->session->check, info->session->state); - - switch (info->session->state) { - case GG_STATE_RESOLVING: - purple_debug_info("gg", "GG_STATE_RESOLVING\n"); - break; - case GG_STATE_CONNECTING_HUB: - purple_debug_info("gg", "GG_STATE_CONNECTING_HUB\n"); - break; - case GG_STATE_READING_DATA: - purple_debug_info("gg", "GG_STATE_READING_DATA\n"); - break; - case GG_STATE_CONNECTING_GG: - purple_debug_info("gg", "GG_STATE_CONNECTING_GG\n"); - break; - case GG_STATE_READING_KEY: - purple_debug_info("gg", "GG_STATE_READING_KEY\n"); - break; - case GG_STATE_READING_REPLY: - purple_debug_info("gg", "GG_STATE_READING_REPLY\n"); - break; - default: - purple_debug_error("gg", "unknown state = %d\n", - info->session->state); - break; - } - - if (!(ev = gg_watch_fd(info->session))) { - purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to read from socket")); - return; - } - purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); - purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", - info->session->check, info->session->state); - - purple_input_remove(gc->inpa); - - /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ - gc->inpa = purple_input_add(info->session->fd, - (info->session->check == 1) ? PURPLE_INPUT_WRITE - : PURPLE_INPUT_READ, - ggp_async_login_handler, gc); - - switch (ev->type) { - case GG_EVENT_NONE: - /* Nothing happened. */ - purple_debug_info("gg", "GG_EVENT_NONE\n"); - break; - case GG_EVENT_CONN_SUCCESS: - { - purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(info->session->fd, - PURPLE_INPUT_READ, - ggp_callback_recv, gc); - - ggp_buddylist_send(gc); - purple_connection_update_progress(gc, _("Connected"), 2, 2); - purple_connection_set_state(gc, PURPLE_CONNECTED); - } - break; - case GG_EVENT_CONN_FAILED: - purple_input_remove(gc->inpa); - gc->inpa = 0; - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - break; - default: - purple_debug_error("gg", "strange event: %d\n", ev->type); - break; - } - - gg_free_event(ev); -} - -/* ---------------------------------------------------------------------- */ -/* ----- PurplePluginProtocolInfo ----------------------------------------- */ -/* ---------------------------------------------------------------------- */ - -static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) -{ - return "gadu-gadu"; -} - -static char *ggp_status_text(PurpleBuddy *b) -{ - PurpleStatus *status; - const char *msg; - char *text; - char *tmp; - - status = purple_presence_get_active_status(purple_buddy_get_presence(b)); - - msg = purple_status_get_attr_string(status, "message"); - - if (msg != NULL) { - tmp = purple_markup_strip_html(msg); - text = g_markup_escape_text(tmp, -1); - g_free(tmp); - - return text; - } else { - tmp = purple_utf8_salvage(purple_status_get_name(status)); - text = g_markup_escape_text(tmp, -1); - g_free(tmp); - - return text; - } -} - -static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurpleStatus *status; - char *text, *tmp; - const char *msg, *name, *alias; - - g_return_if_fail(b != NULL); - - status = purple_presence_get_active_status(purple_buddy_get_presence(b)); - msg = purple_status_get_attr_string(status, "message"); - name = purple_status_get_name(status); - alias = purple_buddy_get_alias(b); - - purple_notify_user_info_add_pair (user_info, _("Alias"), alias); - - if (msg != NULL) { - text = g_markup_escape_text(msg, -1); - if (PURPLE_BUDDY_IS_ONLINE(b)) { - tmp = g_strdup_printf("%s: %s", name, text); - purple_notify_user_info_add_pair(user_info, _("Status"), tmp); - g_free(tmp); - } else { - purple_notify_user_info_add_pair(user_info, _("Message"), text); - } - g_free(text); - /* We don't want to duplicate 'Status: Offline'. */ - } else if (PURPLE_BUDDY_IS_ONLINE(b)) { - purple_notify_user_info_add_pair(user_info, _("Status"), name); - } -} - -static GList *ggp_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - /* - * Without this selecting Invisible as own status doesn't - * work. It's not used and not needed to show status of buddies. - */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - /* - * This status is necessary to display guys who are blocking *us*. - */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - return types; -} - -static GList *ggp_blist_node_menu(PurpleBlistNode *node) -{ - PurpleMenuAction *act; - GList *m = NULL; - PurpleAccount *account; - GGPInfo *info; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) - return NULL; - - account = purple_buddy_get_account((PurpleBuddy *) node); - info = purple_account_get_connection(account)->proto_data; - if (info->chats) { - act = purple_menu_action_new(_("Add to chat"), - PURPLE_CALLBACK(ggp_bmenu_add_to_chat), - NULL, NULL); - m = g_list_append(m, act); - } - - /* Using a blist node boolean here is also wrong. - * Once the Block and Unblock actions are added to the core, - * this will have to go. -- rlaager */ - if (purple_blist_node_get_bool(node, "blocked")) { - act = purple_menu_action_new(_("Unblock"), - PURPLE_CALLBACK(ggp_bmenu_block), - NULL, NULL); - } else { - act = purple_menu_action_new(_("Block"), - PURPLE_CALLBACK(ggp_bmenu_block), - NULL, NULL); - } - m = g_list_append(m, act); - - return m; -} - -static GList *ggp_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Chat _name:"); - pce->identifier = "name"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - -static void ggp_login(PurpleAccount *account) -{ - PurpleConnection *gc; - PurplePresence *presence; - PurpleStatus *status; - struct gg_login_params *glp; - GGPInfo *info; - const char *address; - - if (ggp_setup_proxy(account) == -1) - return; - - gc = purple_account_get_connection(account); - glp = g_new0(struct gg_login_params, 1); - info = g_new0(GGPInfo, 1); - - /* Probably this should be moved to *_new() function. */ - info->session = NULL; - info->chats = NULL; - info->chats_count = 0; - info->token = NULL; - info->searches = ggp_search_new(); - info->pending_richtext_messages = NULL; - info->pending_images = g_hash_table_new(g_int_hash, g_int_equal); - - gc->proto_data = info; - - glp->uin = ggp_get_uin(account); - glp->password = (char *)purple_account_get_password(account); - glp->image_size = 255; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - - glp->async = 1; - glp->status = ggp_to_gg_status(status, &glp->status_descr); - glp->tls = 0; - - address = purple_account_get_string(account, "gg_server", ""); - if (address && *address) { - /* TODO: Make this non-blocking */ - struct in_addr *addr = gg_gethostbyname(address); - - purple_debug_info("gg", "Using gg server given by user (%s)\n", address); - - if (addr == NULL) { - gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"), - address, g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */ - tmp); - g_free(tmp); - return; - } - - glp->server_addr = inet_addr(inet_ntoa(*addr)); - glp->server_port = 8074; - } else - purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n"); - - info->session = gg_login(glp); - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - if (info->session == NULL) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - g_free(glp); - return; - } - gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, - ggp_async_login_handler, gc); -} - -static void ggp_close(PurpleConnection *gc) -{ - - if (gc == NULL) { - purple_debug_info("gg", "gc == NULL\n"); - return; - } - - if (gc->proto_data) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStatus *status; - GGPInfo *info = gc->proto_data; - - status = purple_account_get_active_status(account); - - if (info->session != NULL) { - ggp_set_status(account, status); - gg_logoff(info->session); - gg_free_session(info->session); - } - - /* Immediately close any notifications on this handle since that process depends - * upon the contents of info->searches, which we are about to destroy. - */ - purple_notify_close_with_handle(gc); - - ggp_search_destroy(info->searches); - g_list_free(info->pending_richtext_messages); - g_hash_table_destroy(info->pending_images); - g_free(info); - gc->proto_data = NULL; - } - - if (gc->inpa > 0) - purple_input_remove(gc->inpa); - - purple_debug_info("gg", "Connection closed.\n"); -} - -static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags) -{ - GGPInfo *info = gc->proto_data; - char *tmp, *plain; - int ret = 1; - unsigned char format[1024]; - unsigned int format_length = sizeof(struct gg_msg_richtext); - gint pos = 0; - GData *attribs; - const char *start, *end = NULL, *last; - - if (msg == NULL || *msg == '\0') { - return 0; - } - - last = msg; - - /* Check if the message is richtext */ - /* TODO: Check formatting, too */ - if(purple_markup_find_tag("img", last, &start, &end, &attribs)) { - - GString *string_buffer = g_string_new(NULL); - struct gg_msg_richtext fmt; - - do { - PurpleStoredImage *image; - const char *id; - - /* Add text before the image */ - if(start - last) { - pos = pos + g_utf8_strlen(last, start - last); - g_string_append_len(string_buffer, last, start - last); - } - - if((id = g_datalist_get_data(&attribs, "id")) && (image = purple_imgstore_find_by_id(atoi(id)))) { - struct gg_msg_richtext_format actformat; - struct gg_msg_richtext_image actimage; - gint image_size = purple_imgstore_get_size(image); - gconstpointer image_bin = purple_imgstore_get_data(image); - const char *image_filename = purple_imgstore_get_filename(image); - uint32_t crc32 = gg_crc32(0, image_bin, image_size); - - g_hash_table_insert(info->pending_images, &crc32, GINT_TO_POINTER(atoi(id))); - purple_imgstore_ref(image); - purple_debug_info("gg", "ggp_send_im_richtext: got crc: %i for imgid: %i\n", crc32, atoi(id)); - - actformat.font = GG_FONT_IMAGE; - actformat.position = pos; - - actimage.unknown1 = 0x0109; - actimage.size = gg_fix32(image_size); - actimage.crc32 = gg_fix32(crc32); - - if (actimage.size > 255000) { - purple_debug_warning("gg", "ggp_send_im_richtext: image over 255kb!\n"); - continue; - } - - purple_debug_info("gg", "ggp_send_im_richtext: adding images to richtext, size: %i, crc32: %u, name: %s\n", actimage.size, actimage.crc32, image_filename); - - memcpy(format + format_length, &actformat, sizeof(actformat)); - format_length += sizeof(actformat); - memcpy(format + format_length, &actimage, sizeof(actimage)); - format_length += sizeof(actimage); - } else { - purple_debug_error("gg", "ggp_send_im_richtext: image not found in the image store!"); - } - - last = end + 1; - g_datalist_clear(&attribs); - - } while(purple_markup_find_tag("img", last, &start, &end, &attribs)); - - /* Add text after the images */ - if(last && *last) { - pos = pos + g_utf8_strlen(last, -1); - g_string_append(string_buffer, last); - } - - fmt.flag = 2; - fmt.length = format_length - sizeof(fmt); - memcpy(format, &fmt, sizeof(fmt)); - - purple_debug_info("gg", "ggp_send_im: richtext msg = %s\n", string_buffer->str); - plain = purple_unescape_html(string_buffer->str); - g_string_free(string_buffer, TRUE); - } else { - purple_debug_info("gg", "ggp_send_im: msg = %s\n", msg); - plain = purple_unescape_html(msg); - } - - tmp = charset_convert(plain, "UTF-8", "CP1250"); - - if (tmp && (format_length - sizeof(struct gg_msg_richtext))) { - if(gg_send_message_richtext(info->session, GG_CLASS_CHAT, ggp_str_to_uin(who), (unsigned char *)tmp, format, format_length) < 0) { - ret = -1; - } else { - ret = 1; - } - } else if (NULL == tmp || *tmp == 0) { - ret = 0; - } else if (strlen(tmp) > GG_MSG_MAXSIZE) { - ret = -E2BIG; - } else if (gg_send_message(info->session, GG_CLASS_CHAT, - ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { - ret = -1; - } else { - ret = 1; - } - - g_free(plain); - g_free(tmp); - - return ret; -} - -static void ggp_get_info(PurpleConnection *gc, const char *name) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form; - guint32 seq; - - form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO); - - form->user_data = info; - form->uin = g_strdup(name); - form->offset = g_strdup("0"); - form->last_uin = g_strdup("0"); - - seq = ggp_search_start(gc, form); - ggp_search_add(info->searches, seq, form); - purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq); -} - -static int ggp_to_gg_status(PurpleStatus *status, char **msg) -{ - const char *status_id = purple_status_get_id(status); - int new_status, new_status_descr; - const char *new_msg; - - g_return_val_if_fail(msg != NULL, 0); - - purple_debug_info("gg", "ggp_to_gg_status: Requested status = %s\n", - status_id); - - if (strcmp(status_id, "available") == 0) { - new_status = GG_STATUS_AVAIL; - new_status_descr = GG_STATUS_AVAIL_DESCR; - } else if (strcmp(status_id, "away") == 0) { - new_status = GG_STATUS_BUSY; - new_status_descr = GG_STATUS_BUSY_DESCR; - } else if (strcmp(status_id, "invisible") == 0) { - new_status = GG_STATUS_INVISIBLE; - new_status_descr = GG_STATUS_INVISIBLE_DESCR; - } else if (strcmp(status_id, "offline") == 0) { - new_status = GG_STATUS_NOT_AVAIL; - new_status_descr = GG_STATUS_NOT_AVAIL_DESCR; - } else { - new_status = GG_STATUS_AVAIL; - new_status_descr = GG_STATUS_AVAIL_DESCR; - purple_debug_info("gg", - "ggp_set_status: unknown status requested (status_id=%s)\n", - status_id); - } - - new_msg = purple_status_get_attr_string(status, "message"); - - if(new_msg) { - char *tmp = purple_markup_strip_html(new_msg); - *msg = charset_convert(tmp, "UTF-8", "CP1250"); - g_free(tmp); - - return new_status_descr; - } else { - *msg = NULL; - return new_status; - } -} - -static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - GGPInfo *info; - int new_status; - char *new_msg = NULL; - - if (!purple_status_is_active(status)) - return; - - gc = purple_account_get_connection(account); - info = gc->proto_data; - - new_status = ggp_to_gg_status(status, &new_msg); - - if (new_msg == NULL) { - gg_change_status(info->session, new_status); - } else { - gg_change_status_descr(info->session, new_status, new_msg); - g_free(new_msg); - } - - ggp_status_fake_to_self(account); - -} - -static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - PurpleAccount *account; - GGPInfo *info = gc->proto_data; - const gchar *name = purple_buddy_get_name(buddy); - - gg_add_notify(info->session, ggp_str_to_uin(name)); - - account = purple_connection_get_account(gc); - if (strcmp(purple_account_get_username(account), name) == 0) { - ggp_status_fake_to_self(account); - } -} - -static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - GGPInfo *info = gc->proto_data; - - gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); -} - -static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) -{ - GGPInfo *info = gc->proto_data; - GGPChat *chat; - char *chat_name; - GList *l; - PurpleConversation *conv; - PurpleAccount *account = purple_connection_get_account(gc); - - chat_name = g_hash_table_lookup(data, "name"); - - if (chat_name == NULL) - return; - - purple_debug_info("gg", "joined %s chat\n", chat_name); - - for (l = info->chats; l != NULL; l = l->next) { - chat = l->data; - - if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) { - purple_notify_error(gc, _("Chat error"), - _("This chat name is already in use"), NULL); - return; - } - } - - ggp_confer_add_new(gc, chat_name); - conv = serv_got_joined_chat(gc, info->chats_count, chat_name); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), - purple_account_get_username(account), NULL, - PURPLE_CBFLAGS_NONE, TRUE); -} - -static char *ggp_get_chat_name(GHashTable *data) { - return g_strdup(g_hash_table_lookup(data, "name")); -} - -static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurpleConversation *conv; - GGPInfo *info = gc->proto_data; - GGPChat *chat = NULL; - GList *l; - char *msg, *plain; - uin_t *uins; - int count = 0; - - if ((conv = purple_find_chat(gc, id)) == NULL) - return -EINVAL; - - for (l = info->chats; l != NULL; l = l->next) { - chat = l->data; - - if (g_utf8_collate(chat->name, conv->name) == 0) { - break; - } - - chat = NULL; - } - - if (chat == NULL) { - purple_debug_error("gg", - "ggp_chat_send: Hm... that's strange. No such chat?\n"); - return -EINVAL; - } - - uins = g_new0(uin_t, g_list_length(chat->participants)); - - for (l = chat->participants; l != NULL; l = l->next) { - uin_t uin = GPOINTER_TO_INT(l->data); - - uins[count++] = uin; - } - - plain = purple_unescape_html(message); - msg = charset_convert(plain, "UTF-8", "CP1250"); - g_free(plain); - gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, - (unsigned char *)msg); - g_free(msg); - g_free(uins); - - serv_got_chat_in(gc, id, - purple_account_get_username(purple_connection_get_account(gc)), - flags, message, time(NULL)); - - return 0; -} - -static void ggp_keepalive(PurpleConnection *gc) -{ - GGPInfo *info = gc->proto_data; - - /* purple_debug_info("gg", "Keeping connection alive....\n"); */ - - if (gg_ping(info->session) < 0) { - purple_debug_info("gg", "Not connected to the server " - "or gg_session is not correct\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Not connected to the server")); - } -} - -static void ggp_register_user(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - GGPInfo *info; - - info = gc->proto_data = g_new0(GGPInfo, 1); - - ggp_token_request(gc, ggp_register_user_dialog); -} - -static GList *ggp_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Find buddies..."), - ggp_find_buddies); - m = g_list_append(m, act); - - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Change password..."), - ggp_change_passwd); - m = g_list_append(m, act); - - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Upload buddylist to Server"), - ggp_action_buddylist_put); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Download buddylist from Server"), - ggp_action_buddylist_get); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Delete buddylist from Server"), - ggp_action_buddylist_delete); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Save buddylist to file..."), - ggp_action_buddylist_save); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Load buddylist from file..."), - ggp_action_buddylist_load); - m = g_list_append(m, act); - - return m; -} - -static gboolean ggp_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - ggp_list_icon, /* list_icon */ - NULL, /* list_emblem */ - ggp_status_text, /* status_text */ - ggp_tooltip_text, /* tooltip_text */ - ggp_status_types, /* status_types */ - ggp_blist_node_menu, /* blist_node_menu */ - ggp_chat_info, /* chat_info */ - NULL, /* chat_info_defaults */ - ggp_login, /* login */ - ggp_close, /* close */ - ggp_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - ggp_get_info, /* get_info */ - ggp_set_status, /* set_away */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - ggp_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - ggp_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - ggp_join_chat, /* join_chat */ - NULL, /* reject_chat */ - ggp_get_chat_name, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - ggp_chat_send, /* chat_send */ - ggp_keepalive, /* keepalive */ - ggp_register_user, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - ggp_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, /* magic */ - PURPLE_MAJOR_VERSION, /* major_version */ - PURPLE_MINOR_VERSION, /* minor_version */ - PURPLE_PLUGIN_PROTOCOL, /* plugin type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - "prpl-gg", /* id */ - "Gadu-Gadu", /* name */ - DISPLAY_VERSION, /* version */ - - N_("Gadu-Gadu Protocol Plugin"), /* summary */ - N_("Polish popular IM"), /* description */ - "boler@sourceforge.net", /* author */ - PURPLE_WEBSITE, /* homepage */ - - NULL, /* load */ - NULL, /* unload */ - NULL, /* destroy */ - - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - ggp_actions, /* actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void purple_gg_debug_handler(int level, const char * format, va_list args) { - PurpleDebugLevel purple_level; - char *msg = g_strdup_vprintf(format, args); - - /* This is pretty pointless since the GG_DEBUG levels don't correspond to - * the purple ones */ - switch (level) { - case GG_DEBUG_FUNCTION: - purple_level = PURPLE_DEBUG_INFO; - break; - case GG_DEBUG_MISC: - case GG_DEBUG_NET: - case GG_DEBUG_DUMP: - case GG_DEBUG_TRAFFIC: - default: - purple_level = PURPLE_DEBUG_MISC; - break; - } - - purple_debug(purple_level, "gg", "%s", msg); - g_free(msg); -} - -static void init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Nickname"), - "nick", _("Gadu-Gadu User")); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("GG server"), - "gg_server", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - my_protocol = plugin; - - gg_debug_handler = purple_gg_debug_handler; -} - -PURPLE_INIT_PLUGIN(gg, init_plugin, info); - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/** - * @file gg.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_H -#define _PURPLE_GG_H - -#include -#include "internal.h" -#include "search.h" -#include "connection.h" - - -#define PUBDIR_RESULTS_MAX 20 - - -typedef struct -{ - char *name; - GList *participants; - -} GGPChat; - -typedef void (*GGPTokenCallback)(PurpleConnection *); - -typedef struct -{ - char *id; - char *data; - unsigned int size; - - struct gg_http *req; - guint inpa; - - GGPTokenCallback cb; - -} GGPToken; - -typedef struct { - - struct gg_session *session; - GGPToken *token; - GList *chats; - GGPSearches *searches; - int chats_count; - GList *pending_richtext_messages; - GHashTable *pending_images; -} GGPInfo; - -#endif /* _PURPLE_GG_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/** - * @file gg-utils.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include "gg-utils.h" - - -/* uin_t ggp_str_to_uin(const char *str) {{{ */ -uin_t ggp_str_to_uin(const char *str) -{ - char *tmp; - long num; - - if (!str) - return 0; - - errno = 0; - num = strtol(str, &tmp, 10); - - if (*str == '\0' || *tmp != '\0') - return 0; - - if ((errno == ERANGE || (num == LONG_MAX || num == LONG_MIN)) -#if (LONG_MAX > UINT_MAX) - || num > (long)UINT_MAX -#endif - || num < 0) - return 0; - - return (uin_t) num; -} -/* }}} */ - -/* unsigned int ggp_array_size(char **array) {{{ */ -unsigned int ggp_array_size(char **array) -{ - unsigned int i; - - for (i = 0; array[i] != NULL && i < UINT_MAX; i++) - {} - - return i; -} -/* }}} */ - -/* char *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) {{{ */ -char *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) -{ - gchar *msg; - GError *err = NULL; - - if (locstr == NULL) - return NULL; - - msg = g_convert_with_fallback(locstr, strlen(locstr), encdst, encsrc, - "?", NULL, NULL, &err); - if (err != NULL) { - purple_debug_error("gg", "Error converting from %s to %s: %s\n", - encsrc, encdst, err->message); - g_error_free(err); - } - - /* Just in case? */ - if (msg == NULL) - msg = g_strdup(locstr); - - return msg; -} -/* }}} */ - -/* ggp_get_uin(PurpleAccount *account) {{{ */ -uin_t ggp_get_uin(PurpleAccount *account) -{ - return ggp_str_to_uin(purple_account_get_username(account)); -} -/* }}} */ - -/* char *ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin) {{{ */ -char *ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin) -{ - PurpleBuddy *buddy; - gchar *str_uin; - - str_uin = g_strdup_printf("%lu", (unsigned long int)uin); - - buddy = purple_find_buddy(purple_connection_get_account(gc), str_uin); - if (buddy != NULL) { - g_free(str_uin); - return g_strdup(purple_buddy_get_alias(buddy)); - } else { - return str_uin; - } -} -/* }}} */ - -void ggp_status_fake_to_self(PurpleAccount *account) -{ - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - const char *msg; - - if (! purple_find_buddy(account, purple_account_get_username(account))) - return; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - msg = purple_status_get_attr_string(status, "message"); - if (msg && !*msg) - msg = NULL; - - status_id = purple_status_get_id(status); - if (strcmp(status_id, "invisible") == 0) { - status_id = "offline"; - } - - if (msg) { - if (strlen(msg) > GG_STATUS_DESCR_MAXSIZE) { - msg = purple_markup_slice(msg, 0, GG_STATUS_DESCR_MAXSIZE); - } - } - purple_prpl_got_user_status(account, purple_account_get_username(account), - status_id, - msg ? "message" : NULL, msg, NULL); -} - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/gg-utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/** - * @file gg-utils.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_GG_UTILS_H -#define _PURPLE_GG_UTILS_H - -#include "internal.h" - -#include "plugin.h" -#include "version.h" -#include "notify.h" -#include "status.h" -#include "blist.h" -#include "accountopt.h" -#include "debug.h" -#include "util.h" -#include "request.h" - -#include "gg.h" - - -/** - * Convert a base 10 string to a UIN. - * - * @param str The string to convert - * - * @return UIN or 0 if an error occurred. - */ -uin_t -ggp_str_to_uin(const char *str); - -/** - * Calculate size of a NULL-terminated array. - * - * @param array The array. - * - * @return Size of the array. - */ -unsigned int -ggp_array_size(char **array); - -/** - * Convert enconding of a given string. - * - * @param locstr Input string. - * @param encsrc Current encoding of the string. - * @param encdst Target encoding of the string. - * - * @return Converted string (it must be g_free()ed when not used. Or NULL if - * locstr is NULL. - */ -char * -charset_convert(const gchar *locstr, const char *encsrc, const char *encdst); - -/** - * Get UIN of a given account. - * - * @param account Current account. - * - * @return UIN of an account. - */ -uin_t -ggp_get_uin(PurpleAccount *account); - -/** - * Returns the best name of a buddy from the buddylist. - * - * @param gc PurpleConnection instance. - * @param uin UIN of the buddy. - * - * @return Name of the buddy, or UIN converted to string. - */ -char * -ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin); - -/** - * Manages the display of account's status in the buddylist. - * - * @param account Current account. - */ -void -ggp_status_fake_to_self(PurpleAccount *account); - - -#endif /* _PURPLE_GG_UTILS_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/common.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/common.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/common.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,826 +0,0 @@ -/* $Id: common.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Robert J. Wony - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#ifdef sun -# include -#endif -#endif - -#include -#include -#ifndef _WIN32 -#include -#endif -#include -#include -#include -#include -#include - -#include "libgadu.h" - -FILE *gg_debug_file = NULL; - -#ifndef GG_DEBUG_DISABLE - -/* - * gg_debug() // funkcja wewntrzna - * - * wywietla komunikat o danym poziomie, o ile uytkownik sobie tego yczy. - * - * - level - poziom wiadomoci - * - format... - tre wiadomoci (kompatybilna z printf()) - */ -void gg_debug(int level, const char *format, ...) -{ - va_list ap; - int old_errno = errno; - - if (gg_debug_handler) { - va_start(ap, format); - (*gg_debug_handler)(level, format, ap); - va_end(ap); - - goto cleanup; - } - - if ((gg_debug_level & level)) { - va_start(ap, format); - vfprintf((gg_debug_file) ? gg_debug_file : stderr, format, ap); - va_end(ap); - } - -cleanup: - errno = old_errno; -} - -#endif - -/* - * gg_vsaprintf() // funkcja pomocnicza - * - * robi dokadnie to samo, co vsprintf(), tyle e alokuje sobie wczeniej - * miejsce na dane. powinno dziaa na tych maszynach, ktre maj funkcj - * vsnprintf() zgodn z C99, jak i na wczeniejszych. - * - * - format - opis wywietlanego tekstu jak dla printf() - * - ap - lista argumentw dla printf() - * - * zaalokowany bufor, ktry naley pniej zwolni, lub NULL - * jeli nie udao si wykona zadania. - */ -char *gg_vsaprintf(const char *format, va_list ap) -{ - int size = 0; - const char *start; - char *buf = NULL; - -#ifdef __GG_LIBGADU_HAVE_VA_COPY - va_list aq; - - va_copy(aq, ap); -#else -# ifdef __GG_LIBGADU_HAVE___VA_COPY - va_list aq; - - __va_copy(aq, ap); -# endif -#endif - - start = format; - -#ifndef __GG_LIBGADU_HAVE_C99_VSNPRINTF - { - int res; - char *tmp; - - size = 128; - do { - size *= 2; - if (!(tmp = realloc(buf, size))) { - free(buf); - return NULL; - } - buf = tmp; - res = vsnprintf(buf, size, format, ap); - } while (res == size - 1 || res == -1); - } -#else - { - char tmp[2]; - - /* libce Solarisa przy buforze NULL zawsze zwracaj -1, wic - * musimy poda co istniejcego jako cel printf()owania. */ - size = vsnprintf(tmp, sizeof(tmp), format, ap); - if (!(buf = malloc(size + 1))) - return NULL; - } -#endif - - format = start; - -#ifdef __GG_LIBGADU_HAVE_VA_COPY - vsnprintf(buf, size + 1, format, aq); - va_end(aq); -#else -# ifdef __GG_LIBGADU_HAVE___VA_COPY - vsnprintf(buf, size + 1, format, aq); - va_end(aq); -# else - vsnprintf(buf, size + 1, format, ap); -# endif -#endif - - return buf; -} - -/* - * gg_saprintf() // funkcja pomocnicza - * - * robi dokadnie to samo, co sprintf(), tyle e alokuje sobie wczeniej - * miejsce na dane. powinno dziaa na tych maszynach, ktre maj funkcj - * vsnprintf() zgodn z C99, jak i na wczeniejszych. - * - * - format... - tre taka sama jak w funkcji printf() - * - * zaalokowany bufor, ktry naley pniej zwolni, lub NULL - * jeli nie udao si wykona zadania. - */ -char *gg_saprintf(const char *format, ...) -{ - va_list ap; - char *res; - - va_start(ap, format); - res = gg_vsaprintf(format, ap); - va_end(ap); - - return res; -} - -/* - * gg_get_line() // funkcja pomocnicza - * - * podaje kolejn lini z bufora tekstowego. niszczy go bezpowrotnie, dzielc - * na kolejne stringi. zdarza si, nie ma potrzeby pisania funkcji dublujcej - * bufor eby tylko mie nieruszone dane wejciowe, skoro i tak nie bd nam - * poniej potrzebne. obcina `\r\n'. - * - * - ptr - wskanik do zmiennej, ktra przechowuje aktualn pozycj - * w przemiatanym buforze - * - * wskanik do kolejnej linii tekstu lub NULL, jeli to ju koniec bufora. - */ -char *gg_get_line(char **ptr) -{ - char *foo, *res; - - if (!ptr || !*ptr || !strcmp(*ptr, "")) - return NULL; - - res = *ptr; - - if (!(foo = strchr(*ptr, '\n'))) - *ptr += strlen(*ptr); - else { - *ptr = foo + 1; - *foo = 0; - if (strlen(res) > 1 && res[strlen(res) - 1] == '\r') - res[strlen(res) - 1] = 0; - } - - return res; -} - -/* - * gg_connect() // funkcja pomocnicza - * - * czy si z serwerem. pierwszy argument jest typu (void *), eby nie - * musie niczego inkludowa w libgadu.h i nie psu jaki gupich zalenoci - * na dziwnych systemach. - * - * - addr - adres serwera (struct in_addr *) - * - port - port serwera - * - async - asynchroniczne poczenie - * - * deskryptor gniazda lub -1 w przypadku bdu (kod bdu w zmiennej errno). - */ -int gg_connect(void *addr, int port, int async) -{ - int sock, one = 1, errno2; - struct sockaddr_in sin; - struct in_addr *a = addr; - struct sockaddr_in myaddr; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_connect(%s, %d, %d);\n", inet_ntoa(*a), port, async); - - if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_connect() socket() failed (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - - memset(&myaddr, 0, sizeof(myaddr)); - myaddr.sin_family = AF_INET; - - myaddr.sin_addr.s_addr = gg_local_ip; - - if (bind(sock, (struct sockaddr *) &myaddr, sizeof(myaddr)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_connect() bind() failed (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - -#ifdef ASSIGN_SOCKETS_TO_THREADS - gg_win32_thread_socket(0, sock); -#endif - - if (async) { -#ifdef FIONBIO - if (ioctl(sock, FIONBIO, &one) == -1) { -#else - if (fcntl(sock, F_SETFL, O_NONBLOCK) == -1) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_connect() ioctl() failed (errno=%d, %s)\n", errno, strerror(errno)); - errno2 = errno; - close(sock); - errno = errno2; - return -1; - } - } - - sin.sin_port = htons(port); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = a->s_addr; - - if (connect(sock, (struct sockaddr*) &sin, sizeof(sin)) == -1) { - if (errno && (!async || errno != EINPROGRESS)) { - gg_debug(GG_DEBUG_MISC, "// gg_connect() connect() failed (errno=%d, %s)\n", errno, strerror(errno)); - errno2 = errno; - close(sock); - errno = errno2; - return -1; - } - gg_debug(GG_DEBUG_MISC, "// gg_connect() connect() in progress\n"); - } - - return sock; -} - -/* - * gg_read_line() // funkcja pomocnicza - * - * czyta jedn lini tekstu z gniazda. - * - * - sock - deskryptor gniazda - * - buf - wskanik do bufora - * - length - dugo bufora - * - * jeli trafi na bd odczytu lub podano nieprawidowe parametry, zwraca NULL. - * inaczej zwraca buf. - */ -char *gg_read_line(int sock, char *buf, int length) -{ - int ret; - - if (!buf || length < 0) - return NULL; - - for (; length > 1; buf++, length--) { - do { - if ((ret = read(sock, buf, 1)) == -1 && errno != EINTR) { - gg_debug(GG_DEBUG_MISC, "// gg_read_line() error on read (errno=%d, %s)\n", errno, strerror(errno)); - *buf = 0; - return NULL; - } else if (ret == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_read_line() eof reached\n"); - *buf = 0; - return NULL; - } - } while (ret == -1 && errno == EINTR); - - if (*buf == '\n') { - buf++; - break; - } - } - - *buf = 0; - return buf; -} - -/* - * gg_chomp() // funkcja pomocnicza - * - * ucina "\r\n" lub "\n" z koca linii. - * - * - line - linia do przycicia - */ -void gg_chomp(char *line) -{ - int len; - - if (!line) - return; - - len = strlen(line); - - if (len > 0 && line[len - 1] == '\n') - line[--len] = 0; - if (len > 0 && line[len - 1] == '\r') - line[--len] = 0; -} - -/* - * gg_urlencode() // funkcja wewntrzna - * - * zamienia podany tekst na cig znakw do formularza http. przydaje si - * przy rnych usugach katalogu publicznego. - * - * - str - cig znakw do zakodowania - * - * zaalokowany bufor, ktry naley pniej zwolni albo NULL - * w przypadku bdu. - */ -char *gg_urlencode(const char *str) -{ - char *q, *buf, hex[] = "0123456789abcdef"; - const char *p; - unsigned int size = 0; - - if (!str) - str = ""; - - for (p = str; *p; p++, size++) { - if (!((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') || *p == ' ') || (*p == '@') || (*p == '.') || (*p == '-')) - size += 2; - } - - if (!(buf = malloc(size + 1))) - return NULL; - - for (p = str, q = buf; *p; p++, q++) { - if ((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') || (*p == '@') || (*p == '.') || (*p == '-')) - *q = *p; - else { - if (*p == ' ') - *q = '+'; - else { - *q++ = '%'; - *q++ = hex[*p >> 4 & 15]; - *q = hex[*p & 15]; - } - } - } - - *q = 0; - - return buf; -} - -/* - * gg_http_hash() // funkcja wewntrzna - * - * funkcja liczca hash dla adresu e-mail, hasa i paru innych. - * - * - format... - format kolejnych parametrw ('s' jeli dany parametr jest - * cigiem znakw lub 'u' jeli numerem GG) - * - * hash wykorzystywany przy rejestracji i wszelkich manipulacjach wasnego - * wpisu w katalogu publicznym. - */ -int gg_http_hash(const char *format, ...) -{ - unsigned int a, c, i, j; - va_list ap; - int b = -1; - - va_start(ap, format); - - for (j = 0; j < strlen(format); j++) { - char *arg, buf[16]; - - if (format[j] == 'u') { - snprintf(buf, sizeof(buf), "%d", va_arg(ap, uin_t)); - arg = buf; - } else { - if (!(arg = va_arg(ap, char*))) - arg = ""; - } - - i = 0; - while ((c = (unsigned char) arg[i++]) != 0) { - a = (c ^ b) + (c << 8); - b = (a >> 24) | (a << 8); - } - } - - va_end(ap); - - return (b < 0 ? -b : b); -} - -/* - * gg_gethostbyname() // funkcja pomocnicza - * - * odpowiednik gethostbyname() troszczcy si o wspbieno, gdy mamy do - * dyspozycji funkcj gethostbyname_r(). - * - * - hostname - nazwa serwera - * - * zwraca wskanik na struktur in_addr, ktr naley zwolni. - */ -struct in_addr *gg_gethostbyname(const char *hostname) -{ - struct in_addr *addr = NULL; - -#ifdef HAVE_GETHOSTBYNAME_R - char *tmpbuf = NULL, *buf = NULL; - struct hostent *hp = NULL, *hp2 = NULL; - int h_errnop, ret; - size_t buflen = 1024; - int new_errno; - - new_errno = ENOMEM; - - if (!(addr = malloc(sizeof(struct in_addr)))) - goto cleanup; - - if (!(hp = calloc(1, sizeof(*hp)))) - goto cleanup; - - if (!(buf = malloc(buflen))) - goto cleanup; - - tmpbuf = buf; - - while ((ret = gethostbyname_r(hostname, hp, buf, buflen, &hp2, &h_errnop)) == ERANGE) { - buflen *= 2; - - if (!(tmpbuf = realloc(buf, buflen))) - break; - - buf = tmpbuf; - } - - if (ret) - new_errno = h_errnop; - - if (ret || !hp2 || !tmpbuf) - goto cleanup; - - memcpy(addr, hp->h_addr, sizeof(struct in_addr)); - - free(buf); - free(hp); - - return addr; - -cleanup: - errno = new_errno; - - if (addr) - free(addr); - if (hp) - free(hp); - if (buf) - free(buf); - - return NULL; -#else - struct hostent *hp; - - if (!(addr = malloc(sizeof(struct in_addr)))) { - goto cleanup; - } - - if (!(hp = gethostbyname(hostname))) - goto cleanup; - - memcpy(addr, hp->h_addr, sizeof(struct in_addr)); - - return addr; - -cleanup: - if (addr) - free(addr); - - return NULL; -#endif -} - -#ifdef ASSIGN_SOCKETS_TO_THREADS - -typedef struct gg_win32_thread { - int id; - int socket; - struct gg_win32_thread *next; -} gg_win32_thread; - -struct gg_win32_thread *gg_win32_threads = 0; - -/* - * gg_win32_thread_socket() // funkcja pomocnicza, tylko dla win32 - * - * zwraca deskryptor gniazda, ktre byo ostatnio tworzone dla wtku - * o podanym identyfikatorze. - * - * jeli na win32 przy poczeniach synchronicznych zapamitamy w jakim - * wtku uruchomilimy funkcj, ktra si z czymkolwiek czy, to z osobnego - * wtku moemy anulowa poczenie poprzez gg_win32_thread_socket(watek, -1); - * - * - thread_id - id wtku. jeli jest rwne 0, brany jest aktualny wtek, - * jeli rwne -1, usuwa wpis o podanym sockecie. - * - socket - deskryptor gniazda. jeli rwne 0, zwraca deskryptor gniazda - * dla podanego wtku, jeli rwne -1, usuwa wpis, jeli co - * innego, ustawia dla podanego wtku dany numer deskryptora. - * - * jeli socket jest rwne 0, zwraca deskryptor gniazda dla podanego wtku. - */ -int gg_win32_thread_socket(int thread_id, int socket) -{ - char close = (thread_id == -1) || socket == -1; - gg_win32_thread *wsk = gg_win32_threads; - gg_win32_thread **p_wsk = &gg_win32_threads; - - if (!thread_id) - thread_id = GetCurrentThreadId(); - - while (wsk) { - if ((thread_id == -1 && wsk->socket == socket) || wsk->id == thread_id) { - if (close) { - /* socket zostaje usuniety */ - closesocket(wsk->socket); - *p_wsk = wsk->next; - free(wsk); - return 1; - } else if (!socket) { - /* socket zostaje zwrocony */ - return wsk->socket; - } else { - /* socket zostaje ustawiony */ - wsk->socket = socket; - return socket; - } - } - p_wsk = &(wsk->next); - wsk = wsk->next; - } - - if (close && socket != -1) - closesocket(socket); - if (close || !socket) - return 0; - - /* Dodaje nowy element */ - wsk = malloc(sizeof(gg_win32_thread)); - wsk->id = thread_id; - wsk->socket = socket; - wsk->next = 0; - *p_wsk = wsk; - - return socket; -} - -#endif /* ASSIGN_SOCKETS_TO_THREADS */ - -static char gg_base64_charset[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -/* - * gg_base64_encode() - * - * zapisuje cig znakw w base64. - * - * - buf - cig znakw. - * - * zaalokowany bufor. - */ -char *gg_base64_encode(const char *buf) -{ - char *out, *res; - unsigned int i = 0, j = 0, k = 0, len = strlen(buf); - - res = out = malloc((len / 3 + 1) * 4 + 2); - - if (!res) - return NULL; - - while (j <= len) { - switch (i % 4) { - case 0: - k = (buf[j] & 252) >> 2; - break; - case 1: - if (j < len) - k = ((buf[j] & 3) << 4) | ((buf[j + 1] & 240) >> 4); - else - k = (buf[j] & 3) << 4; - - j++; - break; - case 2: - if (j < len) - k = ((buf[j] & 15) << 2) | ((buf[j + 1] & 192) >> 6); - else - k = (buf[j] & 15) << 2; - - j++; - break; - case 3: - k = buf[j++] & 63; - break; - } - *out++ = gg_base64_charset[k]; - i++; - } - - if (i % 4) - for (j = 0; j < 4 - (i % 4); j++, out++) - *out = '='; - - *out = 0; - - return res; -} - -/* - * gg_base64_decode() - * - * dekoduje cig znakw z base64. - * - * - buf - cig znakw. - * - * zaalokowany bufor. - */ -char *gg_base64_decode(const char *buf) -{ - char *res, *save, *foo, val; - const char *end; - unsigned int index = 0; - - if (!buf) - return NULL; - - save = res = calloc(1, (strlen(buf) / 4 + 1) * 3 + 2); - - if (!save) - return NULL; - - end = buf + strlen(buf); - - while (*buf && buf < end) { - if (*buf == '\r' || *buf == '\n') { - buf++; - continue; - } - if (!(foo = strchr(gg_base64_charset, *buf))) - foo = gg_base64_charset; - val = (int)(foo - gg_base64_charset); - buf++; - switch (index) { - case 0: - *res |= val << 2; - break; - case 1: - *res++ |= val >> 4; - *res |= val << 4; - break; - case 2: - *res++ |= val >> 2; - *res |= val << 6; - break; - case 3: - *res++ |= val; - break; - } - index++; - index %= 4; - } - *res = 0; - - return save; -} - -/* - * gg_proxy_auth() // funkcja wewntrzna - * - * tworzy nagwek autoryzacji dla proxy. - * - * zaalokowany tekst lub NULL, jeli proxy nie jest wczone lub nie wymaga - * autoryzacji. - */ -char *gg_proxy_auth() -{ - char *tmp, *enc, *out; - unsigned int tmp_size; - - if (!gg_proxy_enabled || !gg_proxy_username || !gg_proxy_password) - return NULL; - - if (!(tmp = malloc((tmp_size = strlen(gg_proxy_username) + strlen(gg_proxy_password) + 2)))) - return NULL; - - snprintf(tmp, tmp_size, "%s:%s", gg_proxy_username, gg_proxy_password); - - if (!(enc = gg_base64_encode(tmp))) { - free(tmp); - return NULL; - } - - free(tmp); - - if (!(out = malloc(strlen(enc) + 40))) { - free(enc); - return NULL; - } - - snprintf(out, strlen(enc) + 40, "Proxy-Authorization: Basic %s\r\n", enc); - - free(enc); - - return out; -} - -static uint32_t gg_crc32_table[256]; -static int gg_crc32_initialized = 0; - -/* - * gg_crc32_make_table() // funkcja wewntrzna - */ -static void gg_crc32_make_table() -{ - uint32_t h = 1; - unsigned int i, j; - - memset(gg_crc32_table, 0, sizeof(gg_crc32_table)); - - for (i = 128; i; i >>= 1) { - h = (h >> 1) ^ ((h & 1) ? 0xedb88320L : 0); - - for (j = 0; j < 256; j += 2 * i) - gg_crc32_table[i + j] = gg_crc32_table[j] ^ h; - } - - gg_crc32_initialized = 1; -} - -/* - * gg_crc32() - * - * wyznacza sum kontroln CRC32 danego bloku danych. - * - * - crc - suma kontrola poprzedniego bloku danych lub 0 jeli pierwszy - * - buf - bufor danych - * - size - ilo danych - * - * suma kontrolna CRC32. - */ -uint32_t gg_crc32(uint32_t crc, const unsigned char *buf, int len) -{ - if (!gg_crc32_initialized) - gg_crc32_make_table(); - - if (!buf || len < 0) - return crc; - - crc ^= 0xffffffffL; - - while (len--) - crc = (crc >> 8) ^ gg_crc32_table[(crc ^ *buf++) & 0xff]; - - return crc ^ 0xffffffffL; -} - - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/compat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/compat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/compat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/compat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* $Id: compat.h 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Robert J. Wony - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#ifndef __COMPAT_H -#define __COMPAT_H - -#ifdef sun -# define INADDR_NONE ((in_addr_t) 0xffffffff) -#endif - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/COPYING qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/COPYING --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/COPYING 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/dcc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/dcc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/dcc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/dcc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1301 +0,0 @@ -/* $Id: dcc.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Tomasz Chiliski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include -#include -#ifndef _WIN32 -#include -#include -#include -#include -#ifdef sun -# include -#endif -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "compat.h" -#include "libgadu.h" - -#ifndef GG_DEBUG_DISABLE -/* - * gg_dcc_debug_data() // funkcja wewntrzna - * - * wywietla zrzut pakietu w hexie. - * - * - prefix - prefiks zrzutu pakietu - * - fd - deskryptor gniazda - * - buf - bufor z danymi - * - size - rozmiar danych - */ -static void gg_dcc_debug_data(const char *prefix, int fd, const void *buf, unsigned int size) -{ - unsigned int i; - - gg_debug(GG_DEBUG_MISC, "++ gg_dcc %s (fd=%d,len=%d)", prefix, fd, size); - - for (i = 0; i < size; i++) - gg_debug(GG_DEBUG_MISC, " %.2x", ((unsigned char*) buf)[i]); - - gg_debug(GG_DEBUG_MISC, "\n"); -} -#else -#define gg_dcc_debug_data(a,b,c,d) do { } while (0) -#endif - -/* - * gg_dcc_request() - * - * wysya informacj o tym, e dany klient powinien si z nami poczy. - * wykorzystywane, kiedy druga strona, ktrej chcemy co wysa jest za - * maskarad. - * - * - sess - struktura opisujca sesj GG - * - uin - numerek odbiorcy - * - * patrz gg_send_message_ctcp(). - */ -int gg_dcc_request(struct gg_session *sess, uin_t uin) -{ - return gg_send_message_ctcp(sess, GG_CLASS_CTCP, uin, (const unsigned char *)"\002", 1); -} - -/* - * gg_dcc_fill_filetime() // funkcja wewntrzna - * - * zamienia czas w postaci unixowej na windowsowy. - * - * - unix - czas w postaci unixowej - * - filetime - czas w postaci windowsowej - */ -static void gg_dcc_fill_filetime(uint32_t ut, uint32_t *ft) -{ -#ifdef __GG_LIBGADU_HAVE_LONG_LONG - unsigned long long tmp; - - tmp = ut; - tmp += 11644473600LL; - tmp *= 10000000LL; - -#ifndef __GG_LIBGADU_BIGENDIAN - ft[0] = (uint32_t) tmp; - ft[1] = (uint32_t) (tmp >> 32); -#else - ft[0] = gg_fix32((uint32_t) (tmp >> 32)); - ft[1] = gg_fix32((uint32_t) tmp); -#endif - -#endif -} - -/* - * gg_dcc_fill_file_info() - * - * wypenia pola struct gg_dcc niezbdne do wysania pliku. - * - * - d - struktura opisujca poczenie DCC - * - filename - nazwa pliku - * - * 0, -1. - */ -int gg_dcc_fill_file_info(struct gg_dcc *d, const char *filename) -{ - return gg_dcc_fill_file_info2(d, filename, filename); -} - -/* - * gg_dcc_fill_file_info2() - * - * wypenia pola struct gg_dcc niezbdne do wysania pliku. - * - * - d - struktura opisujca poczenie DCC - * - filename - nazwa pliku - * - local_filename - nazwa na lokalnym systemie plikw - * - * 0, -1. - */ -int gg_dcc_fill_file_info2(struct gg_dcc *d, const char *filename, const char *local_filename) -{ - struct stat st; - const char *name, *ext, *p; - unsigned char *q; - int i, j; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_fill_file_info2(%p, \"%s\", \"%s\");\n", d, filename, local_filename); - - if (!d || d->type != GG_SESSION_DCC_SEND) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() invalid arguments\n"); - errno = EINVAL; - return -1; - } - - if (stat(local_filename, &st) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() stat() failed (%s)\n", strerror(errno)); - return -1; - } - - if ((st.st_mode & S_IFDIR)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() that's a directory\n"); - errno = EINVAL; - return -1; - } - - if ((d->file_fd = open(local_filename, O_RDONLY)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() open() failed (%s)\n", strerror(errno)); - return -1; - } - - memset(&d->file_info, 0, sizeof(d->file_info)); - - if (!(st.st_mode & S_IWUSR)) - d->file_info.mode |= gg_fix32(GG_DCC_FILEATTR_READONLY); - - gg_dcc_fill_filetime(st.st_atime, d->file_info.atime); - gg_dcc_fill_filetime(st.st_mtime, d->file_info.mtime); - gg_dcc_fill_filetime(st.st_ctime, d->file_info.ctime); - - d->file_info.size = gg_fix32(st.st_size); - d->file_info.mode = gg_fix32(0x20); /* FILE_ATTRIBUTE_ARCHIVE */ - - if (!(name = strrchr(filename, '/'))) - name = filename; - else - name++; - - if (!(ext = strrchr(name, '.'))) - ext = name + strlen(name); - - for (i = 0, p = name; i < 8 && p < ext; i++, p++) - d->file_info.short_filename[i] = toupper(name[i]); - - if (i == 8 && p < ext) { - d->file_info.short_filename[6] = '~'; - d->file_info.short_filename[7] = '1'; - } - - if (strlen(ext) > 0) { - for (j = 0; *ext && j < 4; j++, p++) - d->file_info.short_filename[i + j] = toupper(ext[j]); - } - - for (q = d->file_info.short_filename; *q; q++) { - if (*q == 185) { - *q = 165; - } else if (*q == 230) { - *q = 198; - } else if (*q == 234) { - *q = 202; - } else if (*q == 179) { - *q = 163; - } else if (*q == 241) { - *q = 209; - } else if (*q == 243) { - *q = 211; - } else if (*q == 156) { - *q = 140; - } else if (*q == 159) { - *q = 143; - } else if (*q == 191) { - *q = 175; - } - } - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() short name \"%s\", dos name \"%s\"\n", name, d->file_info.short_filename); - strncpy((char *)d->file_info.filename, name, sizeof(d->file_info.filename) - 1); - - return 0; -} - -/* - * gg_dcc_transfer() // funkcja wewntrzna - * - * inicjuje proces wymiany pliku z danym klientem. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - type - rodzaj wymiany (GG_SESSION_DCC_SEND lub GG_SESSION_DCC_GET) - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -static struct gg_dcc *gg_dcc_transfer(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin, int type) -{ - struct gg_dcc *d = NULL; - struct in_addr addr; - - addr.s_addr = ip; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_transfer(%s, %d, %ld, %ld, %s);\n", inet_ntoa(addr), port, my_uin, peer_uin, (type == GG_SESSION_DCC_SEND) ? "SEND" : "GET"); - - if (!ip || ip == INADDR_NONE || !port || !my_uin || !peer_uin) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() invalid arguments\n"); - errno = EINVAL; - return NULL; - } - - if (!(d = (void*) calloc(1, sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() not enough memory\n"); - return NULL; - } - - d->check = GG_CHECK_WRITE; - d->state = GG_STATE_CONNECTING; - d->type = type; - d->timeout = GG_DEFAULT_TIMEOUT; - d->file_fd = -1; - d->active = 1; - d->fd = -1; - d->uin = my_uin; - d->peer_uin = peer_uin; - - if ((d->fd = gg_connect(&addr, port, 1)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() connection failed\n"); - free(d); - return NULL; - } - - return d; -} - -/* - * gg_dcc_get_file() - * - * inicjuje proces odbierania pliku od danego klienta, gdy ten wysa do - * nas danie poczenia. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_get_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin) -{ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_get_file() handing over to gg_dcc_transfer()\n"); - - return gg_dcc_transfer(ip, port, my_uin, peer_uin, GG_SESSION_DCC_GET); -} - -/* - * gg_dcc_send_file() - * - * inicjuje proces wysyania pliku do danego klienta. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_send_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin) -{ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_send_file() handing over to gg_dcc_transfer()\n"); - - return gg_dcc_transfer(ip, port, my_uin, peer_uin, GG_SESSION_DCC_SEND); -} - -/* - * gg_dcc_voice_chat() - * - * prbuje nawiza poczenie gosowe. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_voice_chat(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin) -{ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_chat() handing over to gg_dcc_transfer()\n"); - - return gg_dcc_transfer(ip, port, my_uin, peer_uin, GG_SESSION_DCC_VOICE); -} - -/* - * gg_dcc_set_type() - * - * po zdarzeniu GG_EVENT_DCC_CALLBACK naley ustawi typ poczenia za - * pomoc tej funkcji. - * - * - d - struktura opisujca poczenie - * - type - typ poczenia (GG_SESSION_DCC_SEND lub GG_SESSION_DCC_VOICE) - */ -void gg_dcc_set_type(struct gg_dcc *d, int type) -{ - d->type = type; - d->state = (type == GG_SESSION_DCC_SEND) ? GG_STATE_SENDING_FILE_INFO : GG_STATE_SENDING_VOICE_REQUEST; -} - -/* - * gg_dcc_callback() // funkcja wewntrzna - * - * wywoywana z struct gg_dcc->callback, odpala gg_dcc_watch_fd i umieszcza - * rezultat w struct gg_dcc->event. - * - * - d - structura opisujca poczenie - * - * 0, -1. - */ -static int gg_dcc_callback(struct gg_dcc *d) -{ - struct gg_event *e = gg_dcc_watch_fd(d); - - d->event = e; - - return (e != NULL) ? 0 : -1; -} - -/* - * gg_dcc_socket_create() - * - * tworzy gniazdo dla bezporedniej komunikacji midzy klientami. - * - * - uin - wasny numer - * - port - preferowany port, jeli rwny 0 lub -1, prbuje domylnego - * - * zaalokowana struct gg_dcc, ktr poniej naley zwolni funkcj - * gg_dcc_free(), albo NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_socket_create(uin_t uin, uint16_t port) -{ - struct gg_dcc *c; - struct sockaddr_in sin; - int sock, bound = 0, errno2; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_create_dcc_socket(%d, %d);\n", uin, port); - - if (!uin) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() invalid arguments\n"); - errno = EINVAL; - return NULL; - } - - if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() can't create socket (%s)\n", strerror(errno)); - return NULL; - } - - if (!port) - port = GG_DEFAULT_DCC_PORT; - - while (!bound) { - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; - sin.sin_port = htons(port); - - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() trying port %d\n", port); - if (!bind(sock, (struct sockaddr*) &sin, sizeof(sin))) - bound = 1; - else { - if (++port == 65535) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() no free port found\n"); - close(sock); - return NULL; - } - } - } - - if (listen(sock, 10)) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() unable to listen (%s)\n", strerror(errno)); - errno2 = errno; - close(sock); - errno = errno2; - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() bound to port %d\n", port); - - if (!(c = malloc(sizeof(*c)))) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() not enough memory for struct\n"); - close(sock); - return NULL; - } - memset(c, 0, sizeof(*c)); - - c->port = c->id = port; - c->fd = sock; - c->type = GG_SESSION_DCC_SOCKET; - c->uin = uin; - c->timeout = -1; - c->state = GG_STATE_LISTENING; - c->check = GG_CHECK_READ; - c->callback = gg_dcc_callback; - c->destroy = gg_dcc_free; - - return c; -} - -/* - * gg_dcc_voice_send() - * - * wysya ramk danych dla rozmowy gosowej. - * - * - d - struktura opisujca poczenie dcc - * - buf - bufor z danymi - * - length - rozmiar ramki - * - * 0, -1. - */ -int gg_dcc_voice_send(struct gg_dcc *d, char *buf, int length) -{ - struct packet_s { - uint8_t type; - uint32_t length; - } GG_PACKED; - struct packet_s packet; - - gg_debug(GG_DEBUG_FUNCTION, "++ gg_dcc_voice_send(%p, %p, %d);\n", d, buf, length); - if (!d || !buf || length < 0 || d->type != GG_SESSION_DCC_VOICE) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() invalid argument\n"); - errno = EINVAL; - return -1; - } - - packet.type = 0x03; /* XXX */ - packet.length = gg_fix32(length); - - if (write(d->fd, &packet, sizeof(packet)) < (signed)sizeof(packet)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() write() failed\n"); - return -1; - } - gg_dcc_debug_data("write", d->fd, &packet, sizeof(packet)); - - if (write(d->fd, buf, length) < length) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() write() failed\n"); - return -1; - } - gg_dcc_debug_data("write", d->fd, buf, length); - - return 0; -} - -#define gg_read(fd, buf, size) \ -{ \ - int tmp = read(fd, buf, size); \ - \ - if (tmp < (int) size) { \ - if (tmp == -1) { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed (errno=%d, %s)\n", errno, strerror(errno)); \ - } else if (tmp == 0) { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed, connection broken\n"); \ - } else { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed (%d bytes, %d needed)\n", tmp, size); \ - } \ - e->type = GG_EVENT_DCC_ERROR; \ - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; \ - return e; \ - } \ - gg_dcc_debug_data("read", fd, buf, size); \ -} - -#define gg_write(fd, buf, size) \ -{ \ - int tmp; \ - gg_dcc_debug_data("write", fd, buf, size); \ - tmp = write(fd, buf, size); \ - if (tmp < (int) size) { \ - if (tmp == -1) { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (errno=%d, %s)\n", errno, strerror(errno)); \ - } else { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (%d needed, %d done)\n", size, tmp); \ - } \ - e->type = GG_EVENT_DCC_ERROR; \ - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; \ - return e; \ - } \ -} - -/* - * gg_dcc_watch_fd() - * - * funkcja, ktr naley wywoa, gdy co si zmieni na gg_dcc->fd. - * - * - h - struktura zwrcona przez gg_create_dcc_socket() - * - * zaalokowana struct gg_event lub NULL, jeli zabrako pamici na ni. - */ -struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) -{ - struct gg_event *e; - int foo; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_watch_fd(%p);\n", h); - - if (!h || (h->type != GG_SESSION_DCC && h->type != GG_SESSION_DCC_SOCKET && h->type != GG_SESSION_DCC_SEND && h->type != GG_SESSION_DCC_GET && h->type != GG_SESSION_DCC_VOICE)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() invalid argument\n"); - errno = EINVAL; - return NULL; - } - - if (!(e = (void*) calloc(1, sizeof(*e)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory\n"); - return NULL; - } - - e->type = GG_EVENT_NONE; - - if (h->type == GG_SESSION_DCC_SOCKET) { - struct sockaddr_in sin; - struct gg_dcc *c; - int fd; - socklen_t sin_len = sizeof(sin); - int one = 1; - - if ((fd = accept(h->fd, (struct sockaddr*) &sin, &sin_len)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't accept() new connection (errno=%d, %s)\n", errno, strerror(errno)); - return e; - } - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() new direct connection from %s:%d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port)); - -#ifdef FIONBIO - if (ioctl(fd, FIONBIO, &one) == -1) { -#else - if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't set nonblocking (errno=%d, %s)\n", errno, strerror(errno)); - close(fd); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - return e; - } - - if (!(c = (void*) calloc(1, sizeof(*c)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory for client data\n"); - - free(e); - close(fd); - return NULL; - } - - c->fd = fd; - c->check = GG_CHECK_READ; - c->state = GG_STATE_READING_UIN_1; - c->type = GG_SESSION_DCC; - c->timeout = GG_DEFAULT_TIMEOUT; - c->file_fd = -1; - c->remote_addr = sin.sin_addr.s_addr; - c->remote_port = ntohs(sin.sin_port); - - e->type = GG_EVENT_DCC_NEW; - e->event.dcc_new = c; - - return e; - } else { - struct gg_dcc_tiny_packet tiny; - struct gg_dcc_small_packet small; - struct gg_dcc_big_packet big; - int size, tmp, res; - socklen_t res_size = sizeof(res); - unsigned int utmp; - char buf[1024], ack[] = "UDAG"; - - struct gg_dcc_file_info_packet { - struct gg_dcc_big_packet big; - struct gg_file_info file_info; - } GG_PACKED; - struct gg_dcc_file_info_packet file_info_packet; - - switch (h->state) { - case GG_STATE_READING_UIN_1: - case GG_STATE_READING_UIN_2: - { - uin_t uin; - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_READING_UIN_%d\n", (h->state == GG_STATE_READING_UIN_1) ? 1 : 2); - - gg_read(h->fd, &uin, sizeof(uin)); - - if (h->state == GG_STATE_READING_UIN_1) { - h->state = GG_STATE_READING_UIN_2; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->peer_uin = gg_fix32(uin); - } else { - h->state = GG_STATE_SENDING_ACK; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - h->uin = gg_fix32(uin); - e->type = GG_EVENT_DCC_CLIENT_ACCEPT; - } - - return e; - } - - case GG_STATE_SENDING_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_SENDING_ACK\n"); - - gg_write(h->fd, ack, 4); - - h->state = GG_STATE_READING_TYPE; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_READING_TYPE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_TYPE\n"); - - gg_read(h->fd, &small, sizeof(small)); - - small.type = gg_fix32(small.type); - - switch (small.type) { - case 0x0003: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() callback\n"); - h->type = GG_SESSION_DCC_SEND; - h->state = GG_STATE_SENDING_FILE_INFO; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - e->type = GG_EVENT_DCC_CALLBACK; - - break; - - case 0x0002: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() dialin\n"); - h->type = GG_SESSION_DCC_GET; - h->state = GG_STATE_READING_REQUEST; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->incoming = 1; - - break; - - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() unknown dcc type (%.4x) from %ld\n", small.type, h->peer_uin); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - } - - return e; - - case GG_STATE_READING_REQUEST: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_REQUEST\n"); - - gg_read(h->fd, &small, sizeof(small)); - - small.type = gg_fix32(small.type); - - switch (small.type) { - case 0x0001: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() file transfer request\n"); - h->state = GG_STATE_READING_FILE_INFO; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - break; - - case 0x0003: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() voice chat request\n"); - h->state = GG_STATE_SENDING_VOICE_ACK; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DCC_TIMEOUT_VOICE_ACK; - h->type = GG_SESSION_DCC_VOICE; - e->type = GG_EVENT_DCC_NEED_VOICE_ACK; - - break; - - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() unknown dcc request (%.4x) from %ld\n", small.type, h->peer_uin); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - } - - return e; - - case GG_STATE_READING_FILE_INFO: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_FILE_INFO\n"); - - gg_read(h->fd, &file_info_packet, sizeof(file_info_packet)); - - memcpy(&h->file_info, &file_info_packet.file_info, sizeof(h->file_info)); - - h->file_info.mode = gg_fix32(h->file_info.mode); - h->file_info.size = gg_fix32(h->file_info.size); - - h->state = GG_STATE_SENDING_FILE_ACK; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DCC_TIMEOUT_FILE_ACK; - - e->type = GG_EVENT_DCC_NEED_FILE_ACK; - - return e; - - case GG_STATE_SENDING_FILE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE_ACK\n"); - - big.type = gg_fix32(0x0006); /* XXX */ - big.dunno1 = gg_fix32(h->offset); - big.dunno2 = 0; - - gg_write(h->fd, &big, sizeof(big)); - - h->state = GG_STATE_READING_FILE_HEADER; - h->chunk_size = sizeof(big); - h->chunk_offset = 0; - if (!(h->chunk_buf = malloc(sizeof(big)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n"); - free(e); - return NULL; - } - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_SENDING_VOICE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_VOICE_ACK\n"); - - tiny.type = 0x01; /* XXX */ - - gg_write(h->fd, &tiny, sizeof(tiny)); - - h->state = GG_STATE_READING_VOICE_HEADER; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - h->offset = 0; - - return e; - - case GG_STATE_READING_FILE_HEADER: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_FILE_HEADER\n"); - - tmp = read(h->fd, h->chunk_buf + h->chunk_offset, h->chunk_size - h->chunk_offset); - - if (tmp == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() read() failed (errno=%d, %s)\n", errno, strerror(errno)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - gg_dcc_debug_data("read", h->fd, h->chunk_buf + h->chunk_offset, h->chunk_size - h->chunk_offset); - - h->chunk_offset += tmp; - - if (h->chunk_offset < h->chunk_size) - return e; - - memcpy(&big, h->chunk_buf, sizeof(big)); - free(h->chunk_buf); - h->chunk_buf = NULL; - - big.type = gg_fix32(big.type); - h->chunk_size = gg_fix32(big.dunno1); - h->chunk_offset = 0; - - if (big.type == 0x0005) { /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() transfer refused\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_REFUSED; - return e; - } - - if (h->chunk_size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() empty chunk, EOF\n"); - e->type = GG_EVENT_DCC_DONE; - return e; - } - - h->state = GG_STATE_GETTING_FILE; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->established = 1; - - return e; - - case GG_STATE_READING_VOICE_HEADER: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_HEADER\n"); - - gg_read(h->fd, &tiny, sizeof(tiny)); - - switch (tiny.type) { - case 0x03: /* XXX */ - h->state = GG_STATE_READING_VOICE_SIZE; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->established = 1; - break; - case 0x04: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() peer breaking connection\n"); - /* XXX zwraca odpowiedni event */ - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() unknown request (%.2x)\n", tiny.type); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - } - - return e; - - case GG_STATE_READING_VOICE_SIZE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_SIZE\n"); - - gg_read(h->fd, &small, sizeof(small)); - - small.type = gg_fix32(small.type); - - if (small.type < 16 || small.type > sizeof(buf)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() invalid voice frame size (%d)\n", small.type); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - - return e; - } - - h->chunk_size = small.type; - h->chunk_offset = 0; - - if (!(h->voice_buf = malloc(h->chunk_size))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory for voice frame\n"); - return NULL; - } - - h->state = GG_STATE_READING_VOICE_DATA; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_READING_VOICE_DATA: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_DATA\n"); - - tmp = read(h->fd, h->voice_buf + h->chunk_offset, h->chunk_size - h->chunk_offset); - if (tmp < 1) { - if (tmp == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed (errno=%d, %s)\n", errno, strerror(errno)); - } else { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed, connection broken\n"); - } - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - gg_dcc_debug_data("read", h->fd, h->voice_buf + h->chunk_offset, tmp); - - h->chunk_offset += tmp; - - if (h->chunk_offset >= h->chunk_size) { - e->type = GG_EVENT_DCC_VOICE_DATA; - e->event.dcc_voice_data.data = h->voice_buf; - e->event.dcc_voice_data.length = h->chunk_size; - h->state = GG_STATE_READING_VOICE_HEADER; - h->voice_buf = NULL; - } - - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_CONNECTING: - { - uin_t uins[2]; - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_CONNECTING\n"); - - res = 0; - if ((foo = getsockopt(h->fd, SOL_SOCKET, SO_ERROR, &res, &res_size)) || res) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() connection failed (fd=%d,errno=%d(%s),foo=%d,res=%d(%s))\n", h->fd, errno, strerror(errno), foo, res, strerror(res)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - return e; - } - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() connected, sending uins\n"); - - uins[0] = gg_fix32(h->uin); - uins[1] = gg_fix32(h->peer_uin); - - gg_write(h->fd, uins, sizeof(uins)); - - h->state = GG_STATE_READING_ACK; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - } - - case GG_STATE_READING_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_ACK\n"); - - gg_read(h->fd, buf, 4); - - if (strncmp(buf, ack, 4)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() did't get ack\n"); - - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - return e; - } - - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - h->state = GG_STATE_SENDING_REQUEST; - - return e; - - case GG_STATE_SENDING_VOICE_REQUEST: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_VOICE_REQUEST\n"); - - small.type = gg_fix32(0x0003); - - gg_write(h->fd, &small, sizeof(small)); - - h->state = GG_STATE_READING_VOICE_ACK; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_SENDING_REQUEST: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_REQUEST\n"); - - small.type = (h->type == GG_SESSION_DCC_GET) ? gg_fix32(0x0003) : gg_fix32(0x0002); /* XXX */ - - gg_write(h->fd, &small, sizeof(small)); - - switch (h->type) { - case GG_SESSION_DCC_GET: - h->state = GG_STATE_READING_REQUEST; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - break; - - case GG_SESSION_DCC_SEND: - h->state = GG_STATE_SENDING_FILE_INFO; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - if (h->file_fd == -1) - e->type = GG_EVENT_DCC_NEED_FILE_INFO; - break; - - case GG_SESSION_DCC_VOICE: - h->state = GG_STATE_SENDING_VOICE_REQUEST; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - return e; - - case GG_STATE_SENDING_FILE_INFO: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE_INFO\n"); - - if (h->file_fd == -1) { - e->type = GG_EVENT_DCC_NEED_FILE_INFO; - return e; - } - - small.type = gg_fix32(0x0001); /* XXX */ - - gg_write(h->fd, &small, sizeof(small)); - - file_info_packet.big.type = gg_fix32(0x0003); /* XXX */ - file_info_packet.big.dunno1 = 0; - file_info_packet.big.dunno2 = 0; - - memcpy(&file_info_packet.file_info, &h->file_info, sizeof(h->file_info)); - - /* zostaj teraz u nas, wic odwracamy z powrotem */ - h->file_info.size = gg_fix32(h->file_info.size); - h->file_info.mode = gg_fix32(h->file_info.mode); - - gg_write(h->fd, &file_info_packet, sizeof(file_info_packet)); - - h->state = GG_STATE_READING_FILE_ACK; - h->check = GG_CHECK_READ; - h->timeout = GG_DCC_TIMEOUT_FILE_ACK; - - return e; - - case GG_STATE_READING_FILE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_FILE_ACK\n"); - - gg_read(h->fd, &big, sizeof(big)); - - /* XXX sprawdza wynik */ - h->offset = gg_fix32(big.dunno1); - - h->state = GG_STATE_SENDING_FILE_HEADER; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - e->type = GG_EVENT_DCC_ACK; - - return e; - - case GG_STATE_READING_VOICE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_ACK\n"); - - gg_read(h->fd, &tiny, sizeof(tiny)); - - if (tiny.type != 0x01) { - gg_debug(GG_DEBUG_MISC, "// invalid reply (%.2x), connection refused\n", tiny.type); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_REFUSED; - return e; - } - - h->state = GG_STATE_READING_VOICE_HEADER; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - e->type = GG_EVENT_DCC_ACK; - - return e; - - case GG_STATE_SENDING_FILE_HEADER: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE_HEADER\n"); - - h->chunk_offset = 0; - - if ((h->chunk_size = h->file_info.size - h->offset) > 4096) { - h->chunk_size = 4096; - big.type = gg_fix32(0x0003); /* XXX */ - } else - big.type = gg_fix32(0x0002); /* XXX */ - - big.dunno1 = gg_fix32(h->chunk_size); - big.dunno2 = 0; - - gg_write(h->fd, &big, sizeof(big)); - - h->state = GG_STATE_SENDING_FILE; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - h->established = 1; - - return e; - - case GG_STATE_SENDING_FILE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE\n"); - - if ((utmp = h->chunk_size - h->chunk_offset) > sizeof(buf)) - utmp = sizeof(buf); - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() offset=%d, size=%d\n", h->offset, h->file_info.size); - - /* koniec pliku? */ - if (h->file_info.size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof on empty file\n"); - e->type = GG_EVENT_DCC_DONE; - - return e; - } - - lseek(h->file_fd, h->offset, SEEK_SET); - - size = read(h->file_fd, buf, utmp); - - /* bd */ - if (size == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed. (errno=%d, %s)\n", errno, strerror(errno)); - - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_FILE; - - return e; - } - - /* koniec pliku? */ - if (size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_EOF; - - return e; - } - - /* jeli wczytalimy wicej, utnijmy. */ - if (h->offset + size > h->file_info.size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() too much (read=%d, ofs=%d, size=%d)\n", size, h->offset, h->file_info.size); - size = h->file_info.size - h->offset; - - if (size < 1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() reached EOF after cutting\n"); - e->type = GG_EVENT_DCC_DONE; - return e; - } - } - - tmp = write(h->fd, buf, size); - - if (tmp == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (%s)\n", strerror(errno)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - h->offset += size; - - if (h->offset >= h->file_info.size) { - e->type = GG_EVENT_DCC_DONE; - return e; - } - - h->chunk_offset += size; - - if (h->chunk_offset >= h->chunk_size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() chunk finished\n"); - h->state = GG_STATE_SENDING_FILE_HEADER; - h->timeout = GG_DEFAULT_TIMEOUT; - } else { - h->state = GG_STATE_SENDING_FILE; - h->timeout = GG_DCC_TIMEOUT_SEND; - } - - h->check = GG_CHECK_WRITE; - - return e; - - case GG_STATE_GETTING_FILE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_GETTING_FILE\n"); - - if ((utmp = h->chunk_size - h->chunk_offset) > sizeof(buf)) - utmp = sizeof(buf); - - size = read(h->fd, buf, utmp); - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() ofs=%d, size=%d, read()=%d\n", h->offset, h->file_info.size, size); - - /* bd */ - if (size == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed. (errno=%d, %s)\n", errno, strerror(errno)); - - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - - return e; - } - - /* koniec? */ - if (size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_EOF; - - return e; - } - - tmp = write(h->file_fd, buf, size); - - if (tmp == -1 || tmp < size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (%d:fd=%d:res=%d:%s)\n", tmp, h->file_fd, size, strerror(errno)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - h->offset += size; - - if (h->offset >= h->file_info.size) { - e->type = GG_EVENT_DCC_DONE; - return e; - } - - h->chunk_offset += size; - - if (h->chunk_offset >= h->chunk_size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() chunk finished\n"); - h->state = GG_STATE_READING_FILE_HEADER; - h->timeout = GG_DEFAULT_TIMEOUT; - h->chunk_offset = 0; - h->chunk_size = sizeof(big); - if (!(h->chunk_buf = malloc(sizeof(big)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n"); - free(e); - return NULL; - } - } else { - h->state = GG_STATE_GETTING_FILE; - h->timeout = GG_DCC_TIMEOUT_GET; - } - - h->check = GG_CHECK_READ; - - return e; - - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_???\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - - return e; - } - } - - return e; -} - -#undef gg_read -#undef gg_write - -/* - * gg_dcc_free() - * - * zwalnia pami po strukturze poczenia dcc. - * - * - d - zwalniana struktura - */ -void gg_dcc_free(struct gg_dcc *d) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_free(%p);\n", d); - - if (!d) - return; - - if (d->fd != -1) - close(d->fd); - - if (d->chunk_buf) { - free(d->chunk_buf); - d->chunk_buf = NULL; - } - - free(d); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/events.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/events.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/events.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/events.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1577 +0,0 @@ -/* $Id: events.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * Robert J. Wony - * Arkadiusz Mikiewicz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include -#ifndef _WIN32 -#include -#include -#include -#include -#include -#endif - -#include "libgadu-config.h" - -#include -#ifdef __GG_LIBGADU_HAVE_PTHREAD -# include -#endif -#include -#include -#include -#include -#include -#ifdef __GG_LIBGADU_HAVE_OPENSSL -# include -# include -#endif - -#include "compat.h" -#include "libgadu.h" - -/* - * gg_event_free() - * - * zwalnia pami zajmowan przez informacj o zdarzeniu. - * - * - e - wskanik do informacji o zdarzeniu - */ -void gg_event_free(struct gg_event *e) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_event_free(%p);\n", e); - - if (!e) - return; - - switch (e->type) { - case GG_EVENT_MSG: - free(e->event.msg.message); - free(e->event.msg.formats); - free(e->event.msg.recipients); - break; - - case GG_EVENT_NOTIFY: - free(e->event.notify); - break; - - case GG_EVENT_NOTIFY60: - { - int i; - - for (i = 0; e->event.notify60[i].uin; i++) - free(e->event.notify60[i].descr); - - free(e->event.notify60); - - break; - } - - case GG_EVENT_STATUS60: - free(e->event.status60.descr); - break; - - case GG_EVENT_STATUS: - free(e->event.status.descr); - break; - - case GG_EVENT_NOTIFY_DESCR: - free(e->event.notify_descr.notify); - free(e->event.notify_descr.descr); - break; - - case GG_EVENT_DCC_VOICE_DATA: - free(e->event.dcc_voice_data.data); - break; - - case GG_EVENT_PUBDIR50_SEARCH_REPLY: - case GG_EVENT_PUBDIR50_READ: - case GG_EVENT_PUBDIR50_WRITE: - gg_pubdir50_free(e->event.pubdir50); - break; - - case GG_EVENT_USERLIST: - free(e->event.userlist.reply); - break; - - case GG_EVENT_IMAGE_REPLY: - free(e->event.image_reply.filename); - free(e->event.image_reply.image); - break; - } - - free(e); -} - -/* - * gg_image_queue_remove() - * - * usuwa z kolejki dany wpis. - * - * - s - sesja - * - q - kolejka - * - freeq - czy zwolni kolejk - * - * 0/-1 - */ -int gg_image_queue_remove(struct gg_session *s, struct gg_image_queue *q, int freeq) -{ - if (!s || !q) { - errno = EFAULT; - return -1; - } - - if (s->images == q) - s->images = q->next; - else { - struct gg_image_queue *qq; - - for (qq = s->images; qq; qq = qq->next) { - if (qq->next == q) { - qq->next = q->next; - break; - } - } - } - - if (freeq) { - free(q->image); - free(q->filename); - free(q); - } - - return 0; -} - -/* - * gg_image_queue_parse() // funkcja wewntrzna - * - * parsuje przychodzcy pakiet z obrazkiem. - * - * - e - opis zdarzenia - * - - */ -static void gg_image_queue_parse(struct gg_event *e, char *p, unsigned int len, struct gg_session *sess, uin_t sender) -{ - struct gg_msg_image_reply *i = (void*) p; - struct gg_image_queue *q, *qq; - - if (!p || !sess || !e) { - errno = EFAULT; - return; - } - - /* znajd dany obrazek w kolejce danej sesji */ - - for (qq = sess->images, q = NULL; qq; qq = qq->next) { - if (sender == qq->sender && i->size == qq->size && i->crc32 == qq->crc32) { - q = qq; - break; - } - } - - if (!q) { - gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() unknown image from %d, size=%d, crc32=%.8x\n", sender, i->size, i->crc32); - return; - } - - if (p[0] == 0x05) { - unsigned int i, ok = 0; - - q->done = 0; - - len -= sizeof(struct gg_msg_image_reply); - p += sizeof(struct gg_msg_image_reply); - - /* sprawd, czy mamy tekst zakoczony \0 */ - - for (i = 0; i < len; i++) { - if (!p[i]) { - ok = 1; - break; - } - } - - if (!ok) { - gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() malformed packet from %d, unlimited filename\n", sender); - return; - } - - if (!(q->filename = strdup(p))) { - gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() not enough memory for filename\n"); - return; - } - - len -= strlen(p) + 1; - p += strlen(p) + 1; - } else { - len -= sizeof(struct gg_msg_image_reply); - p += sizeof(struct gg_msg_image_reply); - } - - if (q->done + len > q->size) - len = q->size - q->done; - - memcpy(q->image + q->done, p, len); - q->done += len; - - /* jeli skoczono odbiera obrazek, wygeneruj zdarzenie */ - - if (q->done >= q->size) { - e->type = GG_EVENT_IMAGE_REPLY; - e->event.image_reply.sender = sender; - e->event.image_reply.size = q->size; - e->event.image_reply.crc32 = q->crc32; - e->event.image_reply.filename = q->filename; - e->event.image_reply.image = q->image; - - gg_image_queue_remove(sess, q, 0); - - free(q); - } -} - -/* - * gg_handle_recv_msg() // funkcja wewntrzna - * - * obsuguje pakiet z przychodzc wiadomoci, rozbijajc go na dodatkowe - * struktury (konferencje, kolorki) w razie potrzeby. - * - * - h - nagwek pakietu - * - e - opis zdarzenia - * - * 0, -1. - */ -static int gg_handle_recv_msg(struct gg_header *h, struct gg_event *e, struct gg_session *sess) -{ - struct gg_recv_msg *r = (struct gg_recv_msg*) ((char*) h + sizeof(struct gg_header)); - char *p, *packet_end = (char*) r + h->length; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_handle_recv_msg(%p, %p);\n", h, e); - - if (!r->seq && !r->msgclass) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() oops, silently ignoring the bait\n"); - e->type = GG_EVENT_NONE; - return 0; - } - - for (p = (char*) r + sizeof(*r); *p; p++) { - if (*p == 0x02 && p == packet_end - 1) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() received ctcp packet\n"); - break; - } - if (p >= packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() malformed packet, message out of bounds (0)\n"); - goto malformed; - } - } - - p++; - - /* przeanalizuj dodatkowe opcje */ - while (p < packet_end) { - switch (*p) { - case 0x01: /* konferencja */ - { - struct gg_msg_recipients *m = (void*) p; - uint32_t i, count; - - p += sizeof(*m); - - if (p > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (1)\n"); - goto malformed; - } - - count = gg_fix32(m->count); - - if (p + count * sizeof(uin_t) > packet_end || p + count * sizeof(uin_t) < p || count > 0xffff) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (1.5)\n"); - goto malformed; - } - - if (!(e->event.msg.recipients = (void*) malloc(count * sizeof(uin_t)))) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() not enough memory for recipients data\n"); - goto fail; - } - - for (i = 0; i < count; i++, p += sizeof(uint32_t)) { - uint32_t u; - memcpy(&u, p, sizeof(uint32_t)); - e->event.msg.recipients[i] = gg_fix32(u); - } - - e->event.msg.recipients_count = count; - - break; - } - - case 0x02: /* richtext */ - { - uint16_t len; - char *buf; - - if (p + 3 > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (2)\n"); - goto malformed; - } - - memcpy(&len, p + 1, sizeof(uint16_t)); - len = gg_fix16(len); - - if (!(buf = malloc(len))) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() not enough memory for richtext data\n"); - goto fail; - } - - p += 3; - - if (p + len > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (3)\n"); - free(buf); - goto malformed; - } - - memcpy(buf, p, len); - - e->event.msg.formats = buf; - e->event.msg.formats_length = len; - - p += len; - - break; - } - - case 0x04: /* image_request */ - { - struct gg_msg_image_request *i = (void*) p; - - if (p + sizeof(*i) > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (3)\n"); - goto malformed; - } - - e->event.image_request.sender = gg_fix32(r->sender); - e->event.image_request.size = gg_fix32(i->size); - e->event.image_request.crc32 = gg_fix32(i->crc32); - - e->type = GG_EVENT_IMAGE_REQUEST; - - return 0; - } - - case 0x05: /* image_reply */ - case 0x06: - { - struct gg_msg_image_reply *rep = (void*) p; - - if (p + sizeof(struct gg_msg_image_reply) == packet_end) { - - /* pusta odpowied - klient po drugiej stronie nie ma danego obrazka */ - - e->type = GG_EVENT_IMAGE_REPLY; - e->event.image_reply.sender = gg_fix32(r->sender); - e->event.image_reply.size = 0; - e->event.image_reply.crc32 = gg_fix32(rep->crc32); - e->event.image_reply.filename = NULL; - e->event.image_reply.image = NULL; - return 0; - - } else if (p + sizeof(struct gg_msg_image_reply) + 1 > packet_end) { - - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (4)\n"); - goto malformed; - } - - rep->size = gg_fix32(rep->size); - rep->crc32 = gg_fix32(rep->crc32); - gg_image_queue_parse(e, p, (unsigned int)(packet_end - p), sess, gg_fix32(r->sender)); - - return 0; - } - - default: - { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() unknown payload 0x%.2x\n", *p); - p = packet_end; - } - } - } - - e->type = GG_EVENT_MSG; - e->event.msg.msgclass = gg_fix32(r->msgclass); - e->event.msg.sender = gg_fix32(r->sender); - e->event.msg.time = gg_fix32(r->time); - e->event.msg.message = (unsigned char *)strdup((char*) r + sizeof(*r)); - - return 0; - -malformed: - e->type = GG_EVENT_NONE; - - free(e->event.msg.recipients); - free(e->event.msg.formats); - - return 0; - -fail: - free(e->event.msg.recipients); - free(e->event.msg.formats); - return -1; -} - -/* - * gg_watch_fd_connected() // funkcja wewntrzna - * - * patrzy na gniazdo, odbiera pakiet i wypenia struktur zdarzenia. - * - * - sess - struktura opisujca sesj - * - e - opis zdarzenia - * - * 0, -1. - */ -static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e) -{ - struct gg_header *h = NULL; - char *p; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_watch_fd_connected(%p, %p);\n", sess, e); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (!(h = gg_recv_packet(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() gg_recv_packet failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - - p = (char*) h + sizeof(struct gg_header); - - switch (h->type) { - case GG_RECV_MSG: - { - if (h->length >= sizeof(struct gg_recv_msg)) - if (gg_handle_recv_msg(h, e, sess)) - goto fail; - - break; - } - - case GG_NOTIFY_REPLY: - { - struct gg_notify_reply *n = (void*) p; - unsigned int count, i; - char *tmp; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n"); - - if (h->length < sizeof(*n)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() incomplete packet\n"); - errno = EINVAL; - goto fail; - } - - if (gg_fix32(n->status) == GG_STATUS_BUSY_DESCR || gg_fix32(n->status) == GG_STATUS_NOT_AVAIL_DESCR || gg_fix32(n->status) == GG_STATUS_AVAIL_DESCR) { - e->type = GG_EVENT_NOTIFY_DESCR; - - if (!(e->event.notify_descr.notify = (void*) malloc(sizeof(*n) * 2))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - e->event.notify_descr.notify[1].uin = 0; - memcpy(e->event.notify_descr.notify, p, sizeof(*n)); - e->event.notify_descr.notify[0].uin = gg_fix32(e->event.notify_descr.notify[0].uin); - e->event.notify_descr.notify[0].status = gg_fix32(e->event.notify_descr.notify[0].status); - e->event.notify_descr.notify[0].remote_ip = e->event.notify_descr.notify[0].remote_ip; - e->event.notify_descr.notify[0].remote_port = gg_fix16(e->event.notify_descr.notify[0].remote_port); - - count = h->length - sizeof(*n); - if (!(tmp = malloc(count + 1))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - memcpy(tmp, p + sizeof(*n), count); - tmp[count] = 0; - e->event.notify_descr.descr = tmp; - - } else { - e->type = GG_EVENT_NOTIFY; - - if (!(e->event.notify = (void*) malloc(h->length + 2 * sizeof(*n)))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - - memcpy(e->event.notify, p, h->length); - count = h->length / sizeof(*n); - e->event.notify[count].uin = 0; - - for (i = 0; i < count; i++) { - e->event.notify[i].uin = gg_fix32(e->event.notify[i].uin); - e->event.notify[i].status = gg_fix32(e->event.notify[i].status); - e->event.notify[i].remote_ip = e->event.notify[i].remote_ip; - e->event.notify[i].remote_port = gg_fix16(e->event.notify[i].remote_port); - } - } - - break; - } - - case GG_STATUS: - { - struct gg_status *s = (void*) p; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n"); - - if (h->length >= sizeof(*s)) { - e->type = GG_EVENT_STATUS; - memcpy(&e->event.status, p, sizeof(*s)); - e->event.status.uin = gg_fix32(e->event.status.uin); - e->event.status.status = gg_fix32(e->event.status.status); - if (h->length > sizeof(*s)) { - int len = h->length - sizeof(*s); - char *buf = malloc(len + 1); - if (buf) { - memcpy(buf, p + sizeof(*s), len); - buf[len] = 0; - } - e->event.status.descr = buf; - } else - e->event.status.descr = NULL; - } - - break; - } - - case GG_NOTIFY_REPLY60: - { - struct gg_notify_reply60 *n = (void*) p; - unsigned int length = h->length, i = 0; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n"); - - e->type = GG_EVENT_NOTIFY60; - e->event.notify60 = malloc(sizeof(*e->event.notify60)); - - if (!e->event.notify60) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - - e->event.notify60[0].uin = 0; - - while (length >= sizeof(struct gg_notify_reply60)) { - uin_t uin = gg_fix32(n->uin); - char *tmp; - - e->event.notify60[i].uin = uin & 0x00ffffff; - e->event.notify60[i].status = n->status; - e->event.notify60[i].remote_ip = n->remote_ip; - e->event.notify60[i].remote_port = gg_fix16(n->remote_port); - e->event.notify60[i].version = n->version; - e->event.notify60[i].image_size = n->image_size; - e->event.notify60[i].descr = NULL; - e->event.notify60[i].time = 0; - - if (uin & 0x40000000) - e->event.notify60[i].version |= GG_HAS_AUDIO_MASK; - if (uin & 0x08000000) - e->event.notify60[i].version |= GG_ERA_OMNIX_MASK; - - if (GG_S_D(n->status)) { - unsigned char descr_len = *((char*) n + sizeof(struct gg_notify_reply60)); - - if (descr_len < length) { - if (!(e->event.notify60[i].descr = malloc(descr_len + 1))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - - memcpy(e->event.notify60[i].descr, (char*) n + sizeof(struct gg_notify_reply60) + 1, descr_len); - e->event.notify60[i].descr[descr_len] = 0; - - /* XXX czas */ - } - - length -= sizeof(struct gg_notify_reply60) + descr_len + 1; - n = (void*) ((char*) n + sizeof(struct gg_notify_reply60) + descr_len + 1); - } else { - length -= sizeof(struct gg_notify_reply60); - n = (void*) ((char*) n + sizeof(struct gg_notify_reply60)); - } - - if (!(tmp = realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - free(e->event.notify60); - goto fail; - } - - e->event.notify60 = (void*) tmp; - e->event.notify60[++i].uin = 0; - } - - break; - } - - case GG_STATUS60: - { - struct gg_status60 *s = (void*) p; - uint32_t uin; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n"); - - if (h->length < sizeof(*s)) - break; - - uin = gg_fix32(s->uin); - - e->type = GG_EVENT_STATUS60; - e->event.status60.uin = uin & 0x00ffffff; - e->event.status60.status = s->status; - e->event.status60.remote_ip = s->remote_ip; - e->event.status60.remote_port = gg_fix16(s->remote_port); - e->event.status60.version = s->version; - e->event.status60.image_size = s->image_size; - e->event.status60.descr = NULL; - e->event.status60.time = 0; - - if (uin & 0x40000000) - e->event.status60.version |= GG_HAS_AUDIO_MASK; - if (uin & 0x08000000) - e->event.status60.version |= GG_ERA_OMNIX_MASK; - - if (h->length > sizeof(*s)) { - int len = h->length - sizeof(*s); - char *buf = malloc(len + 1); - - if (buf) { - memcpy(buf, (char*) p + sizeof(*s), len); - buf[len] = 0; - } - - e->event.status60.descr = buf; - - if (len > 4 && p[h->length - 5] == 0) { - uint32_t t; - memcpy(&t, p + h->length - 4, sizeof(uint32_t)); - e->event.status60.time = gg_fix32(t); - } - } - - break; - } - - case GG_SEND_MSG_ACK: - { - struct gg_send_msg_ack *s = (void*) p; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a message ack\n"); - - if (h->length < sizeof(*s)) - break; - - e->type = GG_EVENT_ACK; - e->event.ack.status = gg_fix32(s->status); - e->event.ack.recipient = gg_fix32(s->recipient); - e->event.ack.seq = gg_fix32(s->seq); - - break; - } - - case GG_PONG: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a pong\n"); - - e->type = GG_EVENT_PONG; - sess->last_pong = time(NULL); - - break; - } - - case GG_DISCONNECTING: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received disconnection warning\n"); - e->type = GG_EVENT_DISCONNECT; - break; - } - - case GG_PUBDIR50_REPLY: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received pubdir/search reply\n"); - if (gg_pubdir50_handle_reply(e, p, h->length) == -1) - goto fail; - break; - } - - case GG_USERLIST_REPLY: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received userlist reply\n"); - - if (h->length < 1) - break; - - /* jeli odpowied na eksport, wywoaj zdarzenie tylko - * gdy otrzymano wszystkie odpowiedzi */ - if (p[0] == GG_USERLIST_PUT_REPLY || p[0] == GG_USERLIST_PUT_MORE_REPLY) { - if (--sess->userlist_blocks) - break; - - p[0] = GG_USERLIST_PUT_REPLY; - } - - if (h->length > 1) { - char *tmp; - unsigned int len = (sess->userlist_reply) ? strlen(sess->userlist_reply) : 0; - - gg_debug(GG_DEBUG_MISC, "userlist_reply=%p, len=%d\n", sess->userlist_reply, len); - - if (!(tmp = realloc(sess->userlist_reply, len + h->length))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for userlist reply\n"); - free(sess->userlist_reply); - sess->userlist_reply = NULL; - goto fail; - } - - sess->userlist_reply = tmp; - sess->userlist_reply[len + h->length - 1] = 0; - memcpy(sess->userlist_reply + len, p + 1, h->length - 1); - } - - if (p[0] == GG_USERLIST_GET_MORE_REPLY) - break; - - e->type = GG_EVENT_USERLIST; - e->event.userlist.type = p[0]; - e->event.userlist.reply = sess->userlist_reply; - sess->userlist_reply = NULL; - - break; - } - - default: - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received unknown packet 0x%.2x\n", h->type); - } - - free(h); - return 0; - -fail: - free(h); - return -1; -} - -/* - * gg_watch_fd() - * - * funkcja, ktr naley wywoa, gdy co si stanie z obserwowanym - * deskryptorem. zwraca klientowi informacj o tym, co si dzieje. - * - * - sess - opis sesji - * - * wskanik do struktury gg_event, ktr trzeba zwolni pniej - * za pomoc gg_event_free(). jesli rodzaj zdarzenia jest rwny - * GG_EVENT_NONE, naley je zignorowa. jeli zwrcio NULL, - * stao si co niedobrego -- albo zabrako pamici albo zerwao - * poczenie. - */ -struct gg_event *gg_watch_fd(struct gg_session *sess) -{ - struct gg_event *e; - int res = 0; - int port = 0; - int errno2 = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_watch_fd(%p);\n", sess); - - if (!sess) { - errno = EFAULT; - return NULL; - } - - if (!(e = (void*) calloc(1, sizeof(*e)))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() not enough memory for event data\n"); - return NULL; - } - - e->type = GG_EVENT_NONE; - - switch (sess->state) { - case GG_STATE_RESOLVING: - { - struct in_addr addr; - int failed = 0; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_RESOLVING\n"); - - if (read(sess->fd, &addr, sizeof(addr)) < (signed)sizeof(addr) || addr.s_addr == INADDR_NONE) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() resolving failed\n"); - failed = 1; - errno2 = errno; - } - - close(sess->fd); - sess->fd = -1; - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (sess->resolver) { - pthread_cancel(*((pthread_t*) sess->resolver)); - free(sess->resolver); - sess->resolver = NULL; - } -#elif defined _WIN32 - if (sess->resolver) { - HANDLE h = sess->resolver; - TerminateThread(h, 0); - CloseHandle(h); - sess->resolver = NULL; - } -#else - waitpid(sess->pid, NULL, 0); - sess->pid = -1; -#endif - - if (failed) { - errno = errno2; - goto fail_resolving; - } - - /* jeli jestemy w resolverze i mamy ustawiony port - * proxy, znaczy, e resolvowalimy proxy. zatem - * wpiszmy jego adres. */ - if (sess->proxy_port) - sess->proxy_addr = addr.s_addr; - - /* zapiszmy sobie adres huba i adres serwera (do - * bezporedniego poczenia, jeli hub ley) - * z resolvera. */ - if (sess->proxy_addr && sess->proxy_port) - port = sess->proxy_port; - else { - sess->server_addr = sess->hub_addr = addr.s_addr; - port = GG_APPMSG_PORT; - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() resolved, connecting to %s:%d\n", inet_ntoa(addr), port); - - /* czymy si albo z hubem, albo z proxy, zalenie - * od tego, co resolvowalimy. */ - if ((sess->fd = gg_connect(&addr, port, sess->async)) == -1) { - /* jeli w trybie asynchronicznym gg_connect() - * zwrci bd, nie ma sensu prbowa dalej. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), critical\n", errno, strerror(errno)); - goto fail_connecting; - } - - /* jeli podano serwer i czmy si przez proxy, - * jest to bezporednie poczenie, inaczej jest - * do huba. */ - sess->state = (sess->proxy_addr && sess->proxy_port && sess->server_addr) ? GG_STATE_CONNECTING_GG : GG_STATE_CONNECTING_HUB; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - - case GG_STATE_CONNECTING_HUB: - { - char buf[1024], *client, *auth; - int res = 0; - socklen_t res_size = sizeof(res); - const char *host, *appmsg; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n"); - - /* jeli asynchroniczne, sprawdzamy, czy nie wystpi - * przypadkiem jaki bd. */ - if (sess->async && (getsockopt(sess->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { - /* no tak, nie udao si poczy z proxy. nawet - * nie prbujemy dalej. */ - if (sess->proxy_addr && sess->proxy_port) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", res, strerror(res)); - goto fail_connecting; - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to hub failed (errno=%d, %s), trying direct connection\n", res, strerror(res)); - close(sess->fd); - - if ((sess->fd = gg_connect(&sess->hub_addr, GG_DEFAULT_PORT, sess->async)) == -1) { - /* przy asynchronicznych, gg_connect() - * zwraca -1 przy bdach socket(), - * ioctl(), braku routingu itd. dlatego - * nawet nie prbujemy dalej. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() direct connection failed (errno=%d, %s), critical\n", errno, strerror(errno)); - goto fail_connecting; - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connected to hub, sending query\n"); - - if (!(client = gg_urlencode((sess->client_version) ? sess->client_version : GG_DEFAULT_CLIENT_VERSION))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() out of memory for client version\n"); - goto fail_connecting; - } - - if (!gg_proxy_http_only && sess->proxy_addr && sess->proxy_port) - host = "http://" GG_APPMSG_HOST; - else - host = ""; - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) - appmsg = "appmsg3.asp"; - else -#endif - appmsg = "appmsg2.asp"; - - auth = gg_proxy_auth(); - - snprintf(buf, sizeof(buf) - 1, - "GET %s/appsvc/%s?fmnumber=%u&version=%s&lastmsg=%d HTTP/1.0\r\n" - "Host: " GG_APPMSG_HOST "\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Pragma: no-cache\r\n" - "%s" - "\r\n", host, appmsg, sess->uin, client, sess->last_sysmsg, (auth) ? auth : ""); - - if (auth) - free(auth); - - free(client); - - /* zwolnij pami po wersji klienta. */ - if (sess->client_version) { - free(sess->client_version); - sess->client_version = NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-QUERY-----\n%s\n=> -----END-HTTP-QUERY-----\n", buf); - - /* zapytanie jest krtkie, wic zawsze zmieci si - * do bufora gniazda. jeli write() zwrci mniej, - * stao si co zego. */ - if (write(sess->fd, buf, strlen(buf)) < (signed)strlen(buf)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() sending query failed\n"); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_WRITING; - sess->state = GG_STATE_IDLE; - close(sess->fd); - sess->fd = -1; - break; - } - - sess->state = GG_STATE_READING_DATA; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - - case GG_STATE_READING_DATA: - { - char buf[1024], *tmp, *host; - int port = GG_DEFAULT_PORT; - struct in_addr addr; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_DATA\n"); - - /* czytamy lini z gniazda i obcinamy \r\n. */ - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() received http header (%s)\n", buf); - - /* sprawdzamy, czy wszystko w porzdku. */ - if (strncmp(buf, "HTTP/1.", 7) || strncmp(buf + 9, "200", 3)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() that's not what we've expected, trying direct connection\n"); - - close(sess->fd); - - /* jeli otrzymalimy jakie dziwne informacje, - * prbujemy si czy z pominiciem huba. */ - if (sess->proxy_addr && sess->proxy_port) { - if ((sess->fd = gg_connect(&sess->proxy_addr, sess->proxy_port, sess->async)) == -1) { - /* trudno. nie wyszo. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - sess->port = GG_DEFAULT_PORT; - - /* czymy si na port 8074 huba. */ - if ((sess->fd = gg_connect(&sess->hub_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), trying https\n", errno, strerror(errno)); - - sess->port = GG_HTTPS_PORT; - - /* czymy si na port 443. */ - if ((sess->fd = gg_connect(&sess->hub_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - /* ignorujemy reszt nagwka. */ - while (strcmp(buf, "\r\n") && strcmp(buf, "")) - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - - /* czytamy pierwsz lini danych. */ - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - - /* jeli pierwsza liczba w linii nie jest rwna zeru, - * oznacza to, e mamy wiadomo systemow. */ - if (atoi(buf)) { - char tmp[1024], *foo, *sysmsg_buf = NULL; - int len = 0; - - while (gg_read_line(sess->fd, tmp, sizeof(tmp) - 1)) { - if (!(foo = realloc(sysmsg_buf, len + strlen(tmp) + 2))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() out of memory for system message, ignoring\n"); - break; - } - - sysmsg_buf = foo; - - if (!len) - strcpy(sysmsg_buf, tmp); - else - strcat(sysmsg_buf, tmp); - - len += strlen(tmp); - } - - e->type = GG_EVENT_MSG; - e->event.msg.msgclass = atoi(buf); - e->event.msg.sender = 0; - e->event.msg.message = (unsigned char *)sysmsg_buf; - } - - close(sess->fd); - - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() received http data (%s)\n", buf); - - /* analizujemy otrzymane dane. */ - tmp = buf; - - while (*tmp && *tmp != ' ') - tmp++; - while (*tmp && *tmp == ' ') - tmp++; - host = tmp; - while (*tmp && *tmp != ' ') - tmp++; - *tmp = 0; - - if ((tmp = strchr(host, ':'))) { - *tmp = 0; - port = atoi(tmp + 1); - } - - addr.s_addr = inet_addr(host); - sess->server_addr = addr.s_addr; - - if (!gg_proxy_http_only && sess->proxy_addr && sess->proxy_port) { - /* jeli mamy proxy, czymy si z nim. */ - if ((sess->fd = gg_connect(&sess->proxy_addr, sess->proxy_port, sess->async)) == -1) { - /* nie wyszo? trudno. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - sess->port = port; - - /* czymy si z waciwym serwerem. */ - if ((sess->fd = gg_connect(&addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), trying https\n", errno, strerror(errno)); - - sess->port = GG_HTTPS_PORT; - - /* nie wyszo? prbujemy portu 443. */ - if ((sess->fd = gg_connect(&addr, GG_HTTPS_PORT, sess->async)) == -1) { - /* ostatnia deska ratunku zawioda? - * w takim razie zwijamy manatki. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - - case GG_STATE_CONNECTING_GG: - { - int res = 0; - socklen_t res_size = sizeof(res); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n"); - - /* jeli wystpi bd podczas czenia si... */ - if (sess->async && (sess->timeout == 0 || getsockopt(sess->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { - /* jeli nie udao si poczenie z proxy, - * nie mamy czego prbowa wicej. */ - if (sess->proxy_addr && sess->proxy_port) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", res, strerror(res)); - goto fail_connecting; - } - - close(sess->fd); - sess->fd = -1; - -#ifdef ETIMEDOUT - if (sess->timeout == 0) - errno = ETIMEDOUT; -#endif - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - /* jeli logujemy si po TLS, nie prbujemy - * si czy ju z niczym innym w przypadku - * bdu. nie do, e nie ma sensu, to i - * trzeba by si bawi w tworzenie na nowo - * SSL i SSL_CTX. */ - - if (sess->ssl) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", res, strerror(res)); - goto fail_connecting; - } -#endif - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), trying https\n", res, strerror(res)); - - sess->port = GG_HTTPS_PORT; - - /* prbujemy na port 443. */ - if ((sess->fd = gg_connect(&sess->server_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connected\n"); - - if (gg_proxy_http_only) - sess->proxy_port = 0; - - /* jeli mamy proxy, wylijmy zapytanie. */ - if (sess->proxy_addr && sess->proxy_port) { - char buf[100], *auth = gg_proxy_auth(); - struct in_addr addr; - - if (sess->server_addr) - addr.s_addr = sess->server_addr; - else - addr.s_addr = sess->hub_addr; - - snprintf(buf, sizeof(buf), "CONNECT %s:%d HTTP/1.0\r\n", inet_ntoa(addr), sess->port); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() proxy request:\n// %s", buf); - - /* wysyamy zapytanie. jest ono na tyle krtkie, - * e musi si zmieci w buforze gniazda. jeli - * write() zawiedzie, stao si co zego. */ - if (write(sess->fd, buf, strlen(buf)) < (signed)strlen(buf)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() can't send proxy request\n"); - goto fail_connecting; - } - - if (auth) { - gg_debug(GG_DEBUG_MISC, "// %s", auth); - if (write(sess->fd, auth, strlen(auth)) < (signed)strlen(auth)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() can't send proxy request\n"); - goto fail_connecting; - } - - free(auth); - } - - if (write(sess->fd, "\r\n", 2) < 2) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() can't send proxy request\n"); - goto fail_connecting; - } - } - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) { - SSL_set_fd(sess->ssl, sess->fd); - - sess->state = GG_STATE_TLS_NEGOTIATION; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } -#endif - - sess->state = GG_STATE_READING_KEY; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - case GG_STATE_TLS_NEGOTIATION: - { - int res; - X509 *peer; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_TLS_NEGOTIATION\n"); - - if ((res = SSL_connect(sess->ssl)) <= 0) { - int err = SSL_get_error(sess->ssl, res); - - if (res == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() disconnected during TLS negotiation\n"); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_TLS; - sess->state = GG_STATE_IDLE; - close(sess->fd); - sess->fd = -1; - break; - } - - if (err == SSL_ERROR_WANT_READ) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() SSL_connect() wants to read\n"); - - sess->state = GG_STATE_TLS_NEGOTIATION; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } else if (err == SSL_ERROR_WANT_WRITE) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() SSL_connect() wants to write\n"); - - sess->state = GG_STATE_TLS_NEGOTIATION; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } else { - char buf[1024]; - - ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() SSL_connect() bailed out: %s\n", buf); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_TLS; - sess->state = GG_STATE_IDLE; - close(sess->fd); - sess->fd = -1; - break; - } - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() TLS negotiation succeded:\n// cipher: %s\n", SSL_get_cipher_name(sess->ssl)); - - peer = SSL_get_peer_certificate(sess->ssl); - - if (!peer) - gg_debug(GG_DEBUG_MISC, "// WARNING! unable to get peer certificate!\n"); - else { - char buf[1024]; - - X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// cert subject: %s\n", buf); - - X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// cert issuer: %s\n", buf); - } - - sess->state = GG_STATE_READING_KEY; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } -#endif - - case GG_STATE_READING_KEY: - { - struct gg_header *h; - struct gg_welcome *w; - struct gg_login60 l; - unsigned int hash; - char *password = sess->password; - int ret; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_KEY\n"); - - memset(&l, 0, sizeof(l)); - l.dunno2 = 0xbe; - - /* XXX bardzo, bardzo, bardzo gupi pomys na pozbycie - * si tekstu wrzucanego przez proxy. */ - if (sess->proxy_addr && sess->proxy_port) { - char buf[100]; - - strcpy(buf, ""); - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() proxy response:\n// %s\n", buf); - - while (strcmp(buf, "")) { - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - if (strcmp(buf, "")) - gg_debug(GG_DEBUG_MISC, "// %s\n", buf); - } - - /* XXX niech czeka jeszcze raz w tej samej - * fazie. gupio, ale dziaa. */ - sess->proxy_port = 0; - - break; - } - - /* czytaj pierwszy pakiet. */ - if (!(h = gg_recv_packet(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() didn't receive packet (errno=%d, %s)\n", errno, strerror(errno)); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_READING; - sess->state = GG_STATE_IDLE; - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - break; - } - - if (h->type != GG_WELCOME) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() invalid packet received\n"); - free(h); - close(sess->fd); - sess->fd = -1; - errno = EINVAL; - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_INVALID; - sess->state = GG_STATE_IDLE; - break; - } - - w = (struct gg_welcome*) ((char*) h + sizeof(struct gg_header)); - w->key = gg_fix32(w->key); - - hash = gg_login_hash((unsigned char *)password, w->key); - - gg_debug(GG_DEBUG_DUMP, "// gg_watch_fd() challenge %.4x --> hash %.8x\n", w->key, hash); - - free(h); - - free(sess->password); - sess->password = NULL; - - { - struct in_addr dcc_ip; - dcc_ip.s_addr = gg_dcc_ip; - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() gg_dcc_ip = %s\n", inet_ntoa(dcc_ip)); - } - - if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) { - struct sockaddr_in sin; - socklen_t sin_len = sizeof(sin); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n"); - - if (!getsockname(sess->fd, (struct sockaddr*) &sin, &sin_len)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detected address to %s\n", inet_ntoa(sin.sin_addr)); - l.local_ip = sin.sin_addr.s_addr; - } else { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() unable to detect address\n"); - l.local_ip = 0; - } - } else - l.local_ip = gg_dcc_ip; - - l.uin = gg_fix32(sess->uin); - l.hash = gg_fix32(hash); - l.status = gg_fix32(sess->initial_status ? sess->initial_status : GG_STATUS_AVAIL); - l.version = gg_fix32(sess->protocol_version); - l.local_port = gg_fix16(gg_dcc_port); - l.image_size = sess->image_size; - - if (sess->external_addr && sess->external_port > 1023) { - l.external_ip = sess->external_addr; - l.external_port = gg_fix16(sess->external_port); - } - - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() sending GG_LOGIN60 packet\n"); - ret = gg_send_packet(sess, GG_LOGIN60, &l, sizeof(l), sess->initial_descr, (sess->initial_descr) ? strlen(sess->initial_descr) : 0, NULL); - - free(sess->initial_descr); - sess->initial_descr = NULL; - - if (ret == -1) { - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() sending packet failed. (errno=%d, %s)\n", errno, strerror(errno)); - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_WRITING; - sess->state = GG_STATE_IDLE; - break; - } - - sess->state = GG_STATE_READING_REPLY; - - break; - } - - case GG_STATE_READING_REPLY: - { - struct gg_header *h; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_REPLY\n"); - - if (!(h = gg_recv_packet(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() didn't receive packet (errno=%d, %s)\n", errno, strerror(errno)); - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_READING; - sess->state = GG_STATE_IDLE; - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - break; - } - - if (h->type == GG_LOGIN_OK) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() login succeded\n"); - e->type = GG_EVENT_CONN_SUCCESS; - sess->state = GG_STATE_CONNECTED; - sess->timeout = -1; - sess->status = (sess->initial_status) ? sess->initial_status : GG_STATUS_AVAIL; - free(h); - break; - } - - if (h->type == GG_LOGIN_FAILED) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() login failed\n"); - e->event.failure = GG_FAILURE_PASSWORD; - errno = EACCES; - } else if (h->type == GG_NEED_EMAIL) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() email change needed\n"); - e->event.failure = GG_FAILURE_NEED_EMAIL; - errno = EACCES; - } else { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() invalid packet\n"); - e->event.failure = GG_FAILURE_INVALID; - errno = EINVAL; - } - - e->type = GG_EVENT_CONN_FAILED; - sess->state = GG_STATE_IDLE; - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - free(h); - - break; - } - - case GG_STATE_CONNECTED: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTED\n"); - - sess->last_event = time(NULL); - - if ((res = gg_watch_fd_connected(sess, e)) == -1) { - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() watch_fd_connected failed (errno=%d, %s)\n", errno, strerror(errno)); - - if (errno == EAGAIN) { - e->type = GG_EVENT_NONE; - res = 0; - } else - res = -1; - } - break; - } - } - -done: - if (res == -1) { - free(e); - e = NULL; - } - - return e; - -fail_connecting: - if (sess->fd != -1) { - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - } - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_CONNECTING; - sess->state = GG_STATE_IDLE; - goto done; - -fail_resolving: - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_RESOLVING; - sess->state = GG_STATE_IDLE; - goto done; -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/http.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/http.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/http.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/http.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,535 +0,0 @@ -/* $Id: http.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include -#ifndef _WIN32 -#include -#include -#include -#include -#endif - -#include "libgadu-config.h" - -#include -#include -#ifndef _WIN32 -#include -#endif -#ifdef __GG_LIBGADU_HAVE_PTHREAD -# include -#endif -#include -#include -#include -#include -#include - -#include "compat.h" -#include "libgadu.h" - -/* - * gg_http_connect() // funkcja pomocnicza - * - * rozpoczyna poczenie po http. - * - * - hostname - adres serwera - * - port - port serwera - * - async - asynchroniczne poczenie - * - method - metoda http (GET, POST, cokolwiek) - * - path - cieka do zasobu (musi by poprzedzona ,,/'') - * - header - nagwek zapytania plus ewentualne dane dla POST - * - * zaalokowana struct gg_http, ktr poniej naley - * zwolni funkcj gg_http_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_http_connect(const char *hostname, int port, int async, const char *method, const char *path, const char *header) -{ - struct gg_http *h; - - if (!hostname || !port || !method || !path || !header) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() invalid arguments\n"); - errno = EFAULT; - return NULL; - } - - if (!(h = malloc(sizeof(*h)))) - return NULL; - memset(h, 0, sizeof(*h)); - - h->async = async; - h->port = port; - h->fd = -1; - h->type = GG_SESSION_HTTP; - - if (gg_proxy_enabled) { - char *auth = gg_proxy_auth(); - - h->query = gg_saprintf("%s http://%s:%d%s HTTP/1.0\r\n%s%s", - method, hostname, port, path, (auth) ? auth : - "", header); - hostname = gg_proxy_host; - h->port = port = gg_proxy_port; - - if (auth) - free(auth); - } else { - h->query = gg_saprintf("%s %s HTTP/1.0\r\n%s", - method, path, header); - } - - if (!h->query) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() not enough memory for query\n"); - free(h); - errno = ENOMEM; - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-QUERY-----\n%s\n=> -----END-HTTP-QUERY-----\n", h->query); - - if (async) { -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (gg_resolve_pthread(&h->fd, &h->resolver, hostname)) { -#elif defined _WIN32 - if (gg_resolve_win32thread(&h->fd, &h->resolver, hostname)) { -#else - if (gg_resolve(&h->fd, &h->pid, hostname)) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() resolver failed\n"); - gg_http_free(h); - errno = ENOENT; - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() resolver = %p\n", h->resolver); - - h->state = GG_STATE_RESOLVING; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - } else { - struct in_addr *hn, a; - - if (!(hn = gg_gethostbyname(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() host not found\n"); - gg_http_free(h); - errno = ENOENT; - return NULL; - } else { - a.s_addr = hn->s_addr; - free(hn); - } - - if (!(h->fd = gg_connect(&a, port, 0)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - gg_http_free(h); - return NULL; - } - - h->state = GG_STATE_CONNECTING; - - while (h->state != GG_STATE_ERROR && h->state != GG_STATE_PARSING) { - if (gg_http_watch_fd(h) == -1) - break; - } - - if (h->state != GG_STATE_PARSING) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() some strange error\n"); - gg_http_free(h); - return NULL; - } - } - - h->callback = gg_http_watch_fd; - h->destroy = gg_http_free; - - return h; -} - -#define gg_http_error(x) \ - close(h->fd); \ - h->fd = -1; \ - h->state = GG_STATE_ERROR; \ - h->error = x; \ - return 0; - -/* - * gg_http_watch_fd() - * - * przy asynchronicznej obsudze HTTP funkcj t naley wywoa, jeli - * zmienio si co na obserwowanym deskryptorze. - * - * - h - struktura opisujca poczenie - * - * jeli wszystko poszo dobrze to 0, inaczej -1. poczenie bdzie - * zakoczone, jeli h->state == GG_STATE_PARSING. jeli wystpi jaki - * bd, to bdzie tam GG_STATE_ERROR i odpowiedni kod bdu w h->error. - */ -int gg_http_watch_fd(struct gg_http *h) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_http_watch_fd(%p);\n", h); - - if (!h) { - gg_debug(GG_DEBUG_MISC, "// gg_http_watch_fd() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (h->state == GG_STATE_RESOLVING) { - struct in_addr a; - - gg_debug(GG_DEBUG_MISC, "=> http, resolving done\n"); - - if (read(h->fd, &a, sizeof(a)) < (signed)sizeof(a) || a.s_addr == INADDR_NONE) { - gg_debug(GG_DEBUG_MISC, "=> http, resolver thread failed\n"); - gg_http_error(GG_ERROR_RESOLVING); - } - - close(h->fd); - h->fd = -1; - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (h->resolver) { - pthread_cancel(*((pthread_t *) h->resolver)); - free(h->resolver); - h->resolver = NULL; - } -#elif defined _WIN32 - if (h->resolver) { - HANDLE hnd = h->resolver; - TerminateThread(hnd, 0); - CloseHandle(hnd); - h->resolver = NULL; - } -#else - waitpid(h->pid, NULL, 0); -#endif - - gg_debug(GG_DEBUG_MISC, "=> http, connecting to %s:%d\n", inet_ntoa(a), h->port); - - if ((h->fd = gg_connect(&a, h->port, h->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "=> http, connection failed (errno=%d, %s)\n", errno, strerror(errno)); - gg_http_error(GG_ERROR_CONNECTING); - } - - h->state = GG_STATE_CONNECTING; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - return 0; - } - - if (h->state == GG_STATE_CONNECTING) { - int res = 0; - socklen_t res_size = sizeof(res); - - if (h->async && (getsockopt(h->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { - gg_debug(GG_DEBUG_MISC, "=> http, async connection failed (errno=%d, %s)\n", (res) ? res : errno , strerror((res) ? res : errno)); - close(h->fd); - h->fd = -1; - h->state = GG_STATE_ERROR; - h->error = GG_ERROR_CONNECTING; - if (res) - errno = res; - return 0; - } - - gg_debug(GG_DEBUG_MISC, "=> http, connected, sending request\n"); - - h->state = GG_STATE_SENDING_QUERY; - } - - if (h->state == GG_STATE_SENDING_QUERY) { - ssize_t res; - - if ((res = write(h->fd, h->query, strlen(h->query))) < 1) { - gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno); - gg_http_error(GG_ERROR_WRITING); - } - - if (res < 0 || (size_t)res < strlen(h->query)) { - gg_debug(GG_DEBUG_MISC, "=> http, partial header sent (led=%d, sent=%d)\n", strlen(h->query), res); - - memmove(h->query, h->query + res, strlen(h->query) - res + 1); - h->state = GG_STATE_SENDING_QUERY; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - } else { - gg_debug(GG_DEBUG_MISC, "=> http, request sent (len=%d)\n", strlen(h->query)); - free(h->query); - h->query = NULL; - - h->state = GG_STATE_READING_HEADER; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - } - - return 0; - } - - if (h->state == GG_STATE_READING_HEADER) { - char buf[1024], *tmp; - int res; - - if ((res = read(h->fd, buf, sizeof(buf))) == -1) { - gg_debug(GG_DEBUG_MISC, "=> http, reading header failed (errno=%d)\n", errno); - if (h->header) { - free(h->header); - h->header = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - if (!res) { - gg_debug(GG_DEBUG_MISC, "=> http, connection reset by peer\n"); - if (h->header) { - free(h->header); - h->header = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - gg_debug(GG_DEBUG_MISC, "=> http, read %d bytes of header\n", res); - - if (!(tmp = realloc(h->header, h->header_size + res + 1))) { - gg_debug(GG_DEBUG_MISC, "=> http, not enough memory for header\n"); - free(h->header); - h->header = NULL; - gg_http_error(GG_ERROR_READING); - } - - h->header = tmp; - - memcpy(h->header + h->header_size, buf, res); - h->header_size += res; - - gg_debug(GG_DEBUG_MISC, "=> http, header_buf=%p, header_size=%d\n", h->header, h->header_size); - - h->header[h->header_size] = 0; - - if ((tmp = strstr(h->header, "\r\n\r\n")) || (tmp = strstr(h->header, "\n\n"))) { - int sep_len = (*tmp == '\r') ? 4 : 2; - unsigned int left; - char *line; - - left = h->header_size - ((long)(tmp) - (long)(h->header) + sep_len); - - gg_debug(GG_DEBUG_MISC, "=> http, got all header (%d bytes, %d left)\n", h->header_size - left, left); - - /* HTTP/1.1 200 OK */ - if (strlen(h->header) < 16 || strncmp(h->header + 9, "200", 3)) { - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-HEADER-----\n%s\n=> -----END-HTTP-HEADER-----\n", h->header); - - gg_debug(GG_DEBUG_MISC, "=> http, didn't get 200 OK -- no results\n"); - free(h->header); - h->header = NULL; - gg_http_error(GG_ERROR_CONNECTING); - } - - h->body_size = 0; - line = h->header; - *tmp = 0; - - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-HEADER-----\n%s\n=> -----END-HTTP-HEADER-----\n", h->header); - - while (line) { - if (!strncasecmp(line, "Content-length: ", 16)) { - h->body_size = atoi(line + 16); - } - line = strchr(line, '\n'); - if (line) - line++; - } - - if (h->body_size <= 0) { - gg_debug(GG_DEBUG_MISC, "=> http, content-length not found\n"); - h->body_size = left; - } - - if (left > h->body_size) { - gg_debug(GG_DEBUG_MISC, "=> http, oversized reply (%d bytes needed, %d bytes left)\n", h->body_size, left); - h->body_size = left; - } - - gg_debug(GG_DEBUG_MISC, "=> http, body_size=%d\n", h->body_size); - - if (!(h->body = malloc(h->body_size + 1))) { - gg_debug(GG_DEBUG_MISC, "=> http, not enough memory (%d bytes for body_buf)\n", h->body_size + 1); - free(h->header); - h->header = NULL; - gg_http_error(GG_ERROR_READING); - } - - if (left) { - memcpy(h->body, tmp + sep_len, left); - h->body_done = left; - } - - h->body[left] = 0; - - h->state = GG_STATE_READING_DATA; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - } - - return 0; - } - - if (h->state == GG_STATE_READING_DATA) { - char buf[1024]; - int res; - - if ((res = read(h->fd, buf, sizeof(buf))) == -1) { - gg_debug(GG_DEBUG_MISC, "=> http, reading body failed (errno=%d)\n", errno); - if (h->body) { - free(h->body); - h->body = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - if (!res) { - if (h->body_done >= h->body_size) { - gg_debug(GG_DEBUG_MISC, "=> http, we're done, closing socket\n"); - h->state = GG_STATE_PARSING; - close(h->fd); - h->fd = -1; - } else { - gg_debug(GG_DEBUG_MISC, "=> http, connection closed while reading (have %d, need %d)\n", h->body_done, h->body_size); - if (h->body) { - free(h->body); - h->body = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - return 0; - } - - gg_debug(GG_DEBUG_MISC, "=> http, read %d bytes of body\n", res); - - if (h->body_done + res > h->body_size) { - char *tmp; - - gg_debug(GG_DEBUG_MISC, "=> http, too much data (%d bytes, %d needed), enlarging buffer\n", h->body_done + res, h->body_size); - - if (!(tmp = realloc(h->body, h->body_done + res + 1))) { - gg_debug(GG_DEBUG_MISC, "=> http, not enough memory for data (%d needed)\n", h->body_done + res + 1); - free(h->body); - h->body = NULL; - gg_http_error(GG_ERROR_READING); - } - - h->body = tmp; - h->body_size = h->body_done + res; - } - - h->body[h->body_done + res] = 0; - memcpy(h->body + h->body_done, buf, res); - h->body_done += res; - - gg_debug(GG_DEBUG_MISC, "=> body_done=%d, body_size=%d\n", h->body_done, h->body_size); - - return 0; - } - - if (h->fd != -1) - close(h->fd); - - h->fd = -1; - h->state = GG_STATE_ERROR; - h->error = 0; - - return -1; -} - -#undef gg_http_error - -/* - * gg_http_stop() - * - * jeli poczenie jest w trakcie, przerywa je. nie zwalnia h->data. - * - * - h - struktura opisujca poczenie - */ -void gg_http_stop(struct gg_http *h) -{ - if (!h) - return; - - if (h->state == GG_STATE_ERROR || h->state == GG_STATE_DONE) - return; - - if (h->fd != -1) - close(h->fd); - h->fd = -1; -} - -/* - * gg_http_free_fields() // funkcja wewntrzna - * - * zwalnia pola struct gg_http, ale nie zwalnia samej struktury. - */ -void gg_http_free_fields(struct gg_http *h) -{ - if (!h) - return; - - if (h->body) { - free(h->body); - h->body = NULL; - } - - if (h->query) { - free(h->query); - h->query = NULL; - } - - if (h->header) { - free(h->header); - h->header = NULL; - } -} - -/* - * gg_http_free() - * - * prbuje zamkn poczenie i zwalnia pami po nim. - * - * - h - struktura, ktr naley zlikwidowa - */ -void gg_http_free(struct gg_http *h) -{ - if (!h) - return; - - gg_http_stop(h); - gg_http_free_fields(h); - free(h); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2063 +0,0 @@ -/* $Id: libgadu.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * Robert J. Wony - * Arkadiusz Mikiewicz - * Tomasz Chiliski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include -#ifndef _WIN32 -#include -#include -#include -#include -#ifdef sun -# include -#endif -#else -#include -#include -#include -#define SHUT_RDWR SD_BOTH -#endif - -#include "libgadu-config.h" - -#include -#ifndef _WIN32 -#include -#endif -#ifdef __GG_LIBGADU_HAVE_PTHREAD -# include -#endif -#include -#include -#include -#include -#include -#ifdef __GG_LIBGADU_HAVE_OPENSSL -# include -# include -#endif - -#include "compat.h" -#include "libgadu.h" - -int gg_debug_level = 0; -void (*gg_debug_handler)(int level, const char *format, va_list ap) = NULL; - -int gg_dcc_port = 0; -unsigned long gg_dcc_ip = 0; - -unsigned long gg_local_ip = 0; -/* - * zmienne opisujce parametry proxy http. - */ -char *gg_proxy_host = NULL; -int gg_proxy_port = 0; -int gg_proxy_enabled = 0; -int gg_proxy_http_only = 0; -char *gg_proxy_username = NULL; -char *gg_proxy_password = NULL; - -#ifndef lint -static char rcsid[] -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -= "$Id: libgadu.c 16856 2006-08-19 01:13:25Z evands $"; -#endif - -#ifdef _WIN32 -/** - * Deal with the fact that you can't select() on a win32 file fd. - * This makes it practically impossible to tie into purple's event loop. - * - * -This is thanks to Tor Lillqvist. - * XXX - Move this to where the rest of the the win32 compatiblity stuff goes when we push the changes back to libgadu. - */ -static int -socket_pipe (int *fds) -{ - SOCKET temp, socket1 = -1, socket2 = -1; - struct sockaddr_in saddr; - int len; - u_long arg; - fd_set read_set, write_set; - struct timeval tv; - - temp = socket(AF_INET, SOCK_STREAM, 0); - - if (temp == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(temp, FIONBIO, &arg) == SOCKET_ERROR) { - goto out0; - } - - memset(&saddr, 0, sizeof(saddr)); - saddr.sin_family = AF_INET; - saddr.sin_port = 0; - saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (bind(temp, (struct sockaddr *)&saddr, sizeof (saddr))) { - goto out0; - } - - if (listen(temp, 1) == SOCKET_ERROR) { - goto out0; - } - - len = sizeof(saddr); - if (getsockname(temp, (struct sockaddr *)&saddr, &len)) { - goto out0; - } - - socket1 = socket(AF_INET, SOCK_STREAM, 0); - - if (socket1 == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out1; - } - - if (connect(socket1, (struct sockaddr *)&saddr, len) != SOCKET_ERROR || - WSAGetLastError() != WSAEWOULDBLOCK) { - goto out1; - } - - FD_ZERO(&read_set); - FD_SET(temp, &read_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, &read_set, NULL, NULL, NULL) == SOCKET_ERROR) { - goto out1; - } - - if (!FD_ISSET(temp, &read_set)) { - goto out1; - } - - socket2 = accept(temp, (struct sockaddr *) &saddr, &len); - if (socket2 == INVALID_SOCKET) { - goto out1; - } - - FD_ZERO(&write_set); - FD_SET(socket1, &write_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, NULL, &write_set, NULL, NULL) == SOCKET_ERROR) { - goto out2; - } - - if (!FD_ISSET(socket1, &write_set)) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket2, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - fds[0] = socket1; - fds[1] = socket2; - - closesocket (temp); - - return 0; - -out2: - closesocket (socket2); -out1: - closesocket (socket1); -out0: - closesocket (temp); - errno = EIO; /* XXX */ - - return -1; -} -#endif - -/* - * gg_libgadu_version() - * - * zwraca wersj libgadu. - * - * - brak - * - * wersja libgadu. - */ -const char *gg_libgadu_version() -{ - return GG_LIBGADU_VERSION; -} - -/* - * gg_fix32() - * - * zamienia kolejno bajtw w liczbie 32-bitowej tak, by odpowiadaa - * kolejnoci bajtw w protokole GG. ze wzgldu na LE-owo serwera, - * zamienia tylko na maszynach BE-wych. - * - * - x - liczba do zamiany - * - * liczba z odpowiedni kolejnoci bajtw. - */ -uint32_t gg_fix32(uint32_t x) -{ -#ifndef __GG_LIBGADU_BIGENDIAN - return x; -#else - return (uint32_t) - (((x & (uint32_t) 0x000000ffU) << 24) | - ((x & (uint32_t) 0x0000ff00U) << 8) | - ((x & (uint32_t) 0x00ff0000U) >> 8) | - ((x & (uint32_t) 0xff000000U) >> 24)); -#endif -} - -/* - * gg_fix16() - * - * zamienia kolejno bajtw w liczbie 16-bitowej tak, by odpowiadaa - * kolejnoci bajtw w protokole GG. ze wzgldu na LE-owo serwera, - * zamienia tylko na maszynach BE-wych. - * - * - x - liczba do zamiany - * - * liczba z odpowiedni kolejnoci bajtw. - */ -uint16_t gg_fix16(uint16_t x) -{ -#ifndef __GG_LIBGADU_BIGENDIAN - return x; -#else - return (uint16_t) - (((x & (uint16_t) 0x00ffU) << 8) | - ((x & (uint16_t) 0xff00U) >> 8)); -#endif -} - -/* - * gg_login_hash() // funkcja wewntrzna - * - * liczy hash z hasa i danego seeda. - * - * - password - haso do hashowania - * - seed - warto podana przez serwer - * - * hash. - */ -unsigned int gg_login_hash(const unsigned char *password, unsigned int seed) -{ - unsigned int x, y, z; - - y = seed; - - for (x = 0; *password; password++) { - x = (x & 0xffffff00) | *password; - y ^= x; - y += x; - x <<= 8; - y ^= x; - x <<= 8; - y -= x; - x <<= 8; - y ^= x; - - z = y & 0x1F; - y = (y << z) | (y >> (32 - z)); - } - - return y; -} - -#ifndef _WIN32 - -/* - * gg_resolve() // funkcja wewntrzna - * - * tworzy potok, forkuje si i w drugim procesie zaczyna resolvowa - * podanego hosta. zapisuje w sesji deskryptor potoku. jeli co tam - * bdzie gotowego, znaczy, e mona wczyta struct in_addr. jeli - * nie znajdzie, zwraca INADDR_NONE. - * - * - fd - wskanik gdzie wrzuci deskryptor - * - pid - gdzie wrzuci pid procesu potomnego - * - hostname - nazwa hosta do zresolvowania - * - * 0, -1. - */ -int gg_resolve(int *fd, int *pid, const char *hostname) -{ - int pipes[2], res; - struct in_addr a; - int errno2; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve(%p, %p, \"%s\");\n", fd, pid, hostname); - - if (!fd || !pid) { - errno = EFAULT; - return -1; - } - - if (pipe(pipes) == -1) - return -1; - - if ((res = fork()) == -1) { - errno2 = errno; - close(pipes[0]); - close(pipes[1]); - errno = errno2; - return -1; - } - - if (!res) { - if ((a.s_addr = inet_addr(hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(hostname))) - a.s_addr = INADDR_NONE; - else { - a.s_addr = hn->s_addr; - free(hn); - } - } - - write(pipes[1], &a, sizeof(a)); - - _exit(0); - } - - close(pipes[1]); - - *fd = pipes[0]; - *pid = res; - - return 0; -} -#endif - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - -struct gg_resolve_pthread_data { - char *hostname; - int fd; -}; - -static void *gg_resolve_pthread_thread(void *arg) -{ - struct gg_resolve_pthread_data *d = arg; - struct in_addr a; - - pthread_detach(pthread_self()); - - if ((a.s_addr = inet_addr(d->hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(d->hostname))) - a.s_addr = INADDR_NONE; - else { - a.s_addr = hn->s_addr; - free(hn); - } - } - - write(d->fd, &a, sizeof(a)); - close(d->fd); - - free(d->hostname); - d->hostname = NULL; - - free(d); - - pthread_exit(NULL); - - return NULL; /* eby kompilator nie marudzi */ -} - -/* - * gg_resolve_pthread() // funkcja wewntrzna - * - * tworzy potok, nowy wtek i w nim zaczyna resolvowa podanego hosta. - * zapisuje w sesji deskryptor potoku. jeli co tam bdzie gotowego, - * znaczy, e mona wczyta struct in_addr. jeli nie znajdzie, zwraca - * INADDR_NONE. - * - * - fd - wskanik do zmiennej przechowujcej desktyptor resolvera - * - resolver - wskanik do wskanika resolvera - * - hostname - nazwa hosta do zresolvowania - * - * 0, -1. - */ -int gg_resolve_pthread(int *fd, void **resolver, const char *hostname) -{ - struct gg_resolve_pthread_data *d = NULL; - pthread_t *tmp; - int pipes[2], new_errno; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_pthread(%p, %p, \"%s\");\n", fd, resolver, hostname); - - if (!resolver || !fd || !hostname) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (!(tmp = malloc(sizeof(pthread_t)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory for pthread id\n"); - return -1; - } - - if (pipe(pipes) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); - free(tmp); - return -1; - } - - if (!(d = malloc(sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->hostname = NULL; - - if (!(d->hostname = strdup(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->fd = pipes[1]; - - if (pthread_create(tmp, NULL, gg_resolve_pthread_thread, d)) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_phread() unable to create thread\n"); - new_errno = errno; - goto cleanup; - } - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() %p\n", tmp); - - *resolver = tmp; - - *fd = pipes[0]; - - return 0; - -cleanup: - if (d) { - free(d->hostname); - free(d); - } - - close(pipes[0]); - close(pipes[1]); - - free(tmp); - - errno = new_errno; - - return -1; -} - -#elif defined _WIN32 - -struct gg_resolve_win32thread_data { - char *hostname; - int fd; -}; - -static DWORD WINAPI gg_resolve_win32thread_thread(LPVOID arg) -{ - struct gg_resolve_win32thread_data *d = arg; - struct in_addr a; - - if ((a.s_addr = inet_addr(d->hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(d->hostname))) - a.s_addr = INADDR_NONE; - else { - a.s_addr = hn->s_addr; - free(hn); - } - } - - write(d->fd, &a, sizeof(a)); - close(d->fd); - - free(d->hostname); - d->hostname = NULL; - - free(d); - - return 0; -} - - -int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname) -{ - struct gg_resolve_win32thread_data *d = NULL; - HANDLE h; - DWORD dwTId; - int pipes[2], new_errno; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_win32thread(%p, %p, \"%s\");\n", fd, resolver, hostname); - - if (!resolver || !fd || !hostname) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (socket_pipe(pipes) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - - if (!(d = malloc(sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = GetLastError(); - goto cleanup; - } - - d->hostname = NULL; - - if (!(d->hostname = strdup(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = GetLastError(); - goto cleanup; - } - - d->fd = pipes[1]; - - h = CreateThread(NULL, 0, gg_resolve_win32thread_thread, - d, 0, &dwTId); - - if (h == NULL) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create thread\n"); - new_errno = GetLastError(); - goto cleanup; - } - - *resolver = h; - *fd = pipes[0]; - - return 0; - -cleanup: - if (d) { - free(d->hostname); - free(d); - } - - close(pipes[0]); - close(pipes[1]); - - errno = new_errno; - - return -1; - -} -#endif - -/* - * gg_read() // funkcja pomocnicza - * - * czyta z gniazda okrelon ilo bajtw. bierze pod uwag, czy mamy - * poczenie zwyke czy TLS. - * - * - sess - sesja, - * - buf - bufor, - * - length - ilo bajtw, - * - * takie same wartoci jak read(). - */ -int gg_read(struct gg_session *sess, char *buf, int length) -{ - int res; - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) { - int err; - - res = SSL_read(sess->ssl, buf, length); - - if (res < 0) { - err = SSL_get_error(sess->ssl, res); - - if (err == SSL_ERROR_WANT_READ) - errno = EAGAIN; - - return -1; - } - } else -#endif - res = read(sess->fd, buf, length); - - return res; -} - -/* - * gg_write() // funkcja pomocnicza - * - * zapisuje do gniazda okrelon ilo bajtw. bierze pod uwag, czy mamy - * poczenie zwyke czy TLS. - * - * - sess - sesja, - * - buf - bufor, - * - length - ilo bajtw, - * - * takie same wartoci jak write(). - */ -int gg_write(struct gg_session *sess, const char *buf, int length) -{ - int res = 0; - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) { - int err; - - res = SSL_write(sess->ssl, buf, length); - - if (res < 0) { - err = SSL_get_error(sess->ssl, res); - - if (err == SSL_ERROR_WANT_WRITE) - errno = EAGAIN; - - return -1; - } - } else -#endif - { - int written = 0; - - while (written < length) { - res = write(sess->fd, buf + written, length - written); - - if (res == -1) { - if (errno == EAGAIN) - continue; - else - break; - } else { - written += res; - res = written; - } - } - } - - return res; -} - -/* - * gg_recv_packet() // funkcja wewntrzna - * - * odbiera jeden pakiet i zwraca wskanik do niego. pami po nim - * naley zwolni za pomoc free(). - * - * - sess - opis sesji - * - * w przypadku bdu NULL, kod bdu w errno. naley zwrci uwag, e gdy - * poczenie jest nieblokujce, a kod bdu wynosi EAGAIN, nie udao si - * odczyta caego pakietu i nie naley tego traktowa jako bd. - */ -void *gg_recv_packet(struct gg_session *sess) -{ - struct gg_header h; - char *buf = NULL; - int ret = 0, offset, size = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_recv_packet(%p);\n", sess); - - if (!sess) { - errno = EFAULT; - return NULL; - } - - if (sess->recv_left < 1) { - if (sess->header_buf) { - memcpy(&h, sess->header_buf, sess->header_done); - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv: resuming last read (%d bytes left)\n", sizeof(h) - sess->header_done); - free(sess->header_buf); - sess->header_buf = NULL; - } else - sess->header_done = 0; - - while (sess->header_done < sizeof(h)) { - ret = gg_read(sess, (char*) &h + sess->header_done, sizeof(h) - sess->header_done); - - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv(%d,%p,%d) = %d\n", sess->fd, &h + sess->header_done, sizeof(h) - sess->header_done, ret); - - if (!ret) { - errno = ECONNRESET; - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() failed: connection broken\n"); - return NULL; - } - - if (ret == -1) { - if (errno == EINTR) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() interrupted system call, resuming\n"); - continue; - } - - if (errno == EAGAIN) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() incomplete header received\n"); - - if (!(sess->header_buf = malloc(sess->header_done))) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() not enough memory\n"); - return NULL; - } - - memcpy(sess->header_buf, &h, sess->header_done); - - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() failed: errno=%d, %s\n", errno, strerror(errno)); - - return NULL; - } - - sess->header_done += ret; - - } - - h.type = gg_fix32(h.type); - h.length = gg_fix32(h.length); - } else - memcpy(&h, sess->recv_buf, sizeof(h)); - - /* jakie sensowne limity na rozmiar pakietu */ - if (h.length > 65535) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() invalid packet length (%d)\n", h.length); - errno = ERANGE; - return NULL; - } - - if (sess->recv_left > 0) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() resuming last gg_recv_packet()\n"); - size = sess->recv_left; - offset = sess->recv_done; - buf = sess->recv_buf; - } else { - if (!(buf = malloc(sizeof(h) + h.length + 1))) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() not enough memory for packet data\n"); - return NULL; - } - - memcpy(buf, &h, sizeof(h)); - - offset = 0; - size = h.length; - } - - while (size > 0) { - ret = gg_read(sess, buf + sizeof(h) + offset, size); - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv(%d,%p,%d) = %d\n", sess->fd, buf + sizeof(h) + offset, size, ret); - if (!ret) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv() failed: connection broken\n"); - free(buf); - errno = ECONNRESET; - return NULL; - } - if (ret > -1 && ret <= size) { - offset += ret; - size -= ret; - } else if (ret == -1) { - int errno2 = errno; - - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv() failed (errno=%d, %s)\n", errno, strerror(errno)); - errno = errno2; - - if (errno == EAGAIN) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() %d bytes received, %d left\n", offset, size); - sess->recv_buf = buf; - sess->recv_left = size; - sess->recv_done = offset; - return NULL; - } - if (errno != EINTR) { - free(buf); - return NULL; - } - } - } - - sess->recv_left = 0; - - if ((gg_debug_level & GG_DEBUG_DUMP)) { - unsigned int i; - - gg_debug(GG_DEBUG_DUMP, "// gg_recv_packet(%.2x)", h.type); - for (i = 0; i < sizeof(h) + h.length; i++) - gg_debug(GG_DEBUG_DUMP, " %.2x", (unsigned char) buf[i]); - gg_debug(GG_DEBUG_DUMP, "\n"); - } - - return buf; -} - -/* - * gg_send_packet() // funkcja wewntrzna - * - * konstruuje pakiet i wysya go do serwera. - * - * - sock - deskryptor gniazda - * - type - typ pakietu - * - payload_1 - pierwsza cz pakietu - * - payload_length_1 - dugo pierwszej czci - * - payload_2 - druga cz pakietu - * - payload_length_2 - dugo drugiej czci - * - ... - kolejne czci pakietu i ich dugoci - * - NULL - kocowym parametr (konieczny!) - * - * jeli si powiodo, zwraca 0, w przypadku bdu -1. jeli errno == ENOMEM, - * zabrako pamici. inaczej by bd przy wysyaniu pakietu. dla errno == 0 - * nie wysano caego pakietu. - */ -int gg_send_packet(struct gg_session *sess, int type, ...) -{ - struct gg_header *h; - char *tmp; - int tmp_length; - void *payload; - unsigned int payload_length; - va_list ap; - int res; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_packet(%p, 0x%.2x, ...)\n", sess, type); - - tmp_length = sizeof(struct gg_header); - - if (!(tmp = malloc(tmp_length))) { - gg_debug(GG_DEBUG_MISC, "// gg_send_packet() not enough memory for packet header\n"); - return -1; - } - - va_start(ap, type); - - payload = va_arg(ap, void *); - - while (payload) { - char *tmp2; - - payload_length = va_arg(ap, unsigned int); - - if (!(tmp2 = realloc(tmp, tmp_length + payload_length))) { - gg_debug(GG_DEBUG_MISC, "// gg_send_packet() not enough memory for payload\n"); - free(tmp); - va_end(ap); - return -1; - } - - tmp = tmp2; - - memcpy(tmp + tmp_length, payload, payload_length); - tmp_length += payload_length; - - payload = va_arg(ap, void *); - } - - va_end(ap); - - h = (struct gg_header*) tmp; - h->type = gg_fix32(type); - h->length = gg_fix32(tmp_length - sizeof(struct gg_header)); - - if ((gg_debug_level & GG_DEBUG_DUMP)) { - int i; - - gg_debug(GG_DEBUG_DUMP, "// gg_send_packet(0x%.2x)", gg_fix32(h->type)); - for (i = 0; i < tmp_length; ++i) - gg_debug(GG_DEBUG_DUMP, " %.2x", (unsigned char) tmp[i]); - gg_debug(GG_DEBUG_DUMP, "\n"); - } - - if ((res = gg_write(sess, tmp, tmp_length)) < tmp_length) { - gg_debug(GG_DEBUG_MISC, "// gg_send_packet() write() failed. res = %d, errno = %d (%s)\n", res, errno, strerror(errno)); - free(tmp); - return -1; - } - - free(tmp); - return 0; -} - -/* - * gg_session_callback() // funkcja wewntrzna - * - * wywoywany z gg_session->callback, wykonuje gg_watch_fd() i pakuje - * do gg_session->event jego wynik. - */ -static int gg_session_callback(struct gg_session *s) -{ - if (!s) { - errno = EFAULT; - return -1; - } - - return ((s->event = gg_watch_fd(s)) != NULL) ? 0 : -1; -} - -/* - * gg_login() - * - * rozpoczyna procedur czenia si z serwerem. reszt obsuguje si przez - * gg_watch_fd(). - * - * UWAGA! program musi obsuy SIGCHLD, jeli czy si asynchronicznie, - * eby poprawnie zamkn proces resolvera. - * - * - p - struktura opisujca pocztkowy stan. wymagane pola: uin, - * password - * - * w przypadku bdu NULL, jeli idzie dobrze (async) albo poszo - * dobrze (sync), zwrci wskanik do zaalokowanej struct gg_session. - */ -struct gg_session *gg_login(const struct gg_login_params *p) -{ - struct gg_session *sess = NULL; - char *hostname; - int port; - - if (!p) { - gg_debug(GG_DEBUG_FUNCTION, "** gg_login(%p);\n", p); - errno = EFAULT; - return NULL; - } - - gg_debug(GG_DEBUG_FUNCTION, "** gg_login(%p: [uin=%u, async=%d, ...]);\n", p, p->uin, p->async); - - if (!(sess = malloc(sizeof(struct gg_session)))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for session data\n"); - goto fail; - } - - memset(sess, 0, sizeof(struct gg_session)); - - if (!p->password || !p->uin) { - gg_debug(GG_DEBUG_MISC, "// gg_login() invalid arguments. uin and password needed\n"); - errno = EFAULT; - goto fail; - } - - if (!(sess->password = strdup(p->password))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for password\n"); - goto fail; - } - - if (p->status_descr && !(sess->initial_descr = strdup(p->status_descr))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for status\n"); - goto fail; - } - - sess->uin = p->uin; - sess->state = GG_STATE_RESOLVING; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - sess->async = p->async; - sess->type = GG_SESSION_GG; - sess->initial_status = p->status; - sess->callback = gg_session_callback; - sess->destroy = gg_free_session; - sess->port = (p->server_port) ? p->server_port : ((gg_proxy_enabled) ? GG_HTTPS_PORT : GG_DEFAULT_PORT); - sess->server_addr = p->server_addr; - sess->external_port = p->external_port; - sess->external_addr = p->external_addr; - sess->protocol_version = (p->protocol_version) ? p->protocol_version : GG_DEFAULT_PROTOCOL_VERSION; - if (p->era_omnix) - sess->protocol_version |= GG_ERA_OMNIX_MASK; - if (p->has_audio) - sess->protocol_version |= GG_HAS_AUDIO_MASK; - sess->client_version = (p->client_version) ? strdup(p->client_version) : NULL; - sess->last_sysmsg = p->last_sysmsg; - sess->image_size = p->image_size; - sess->pid = -1; - - if (p->tls == 1) { -#ifdef __GG_LIBGADU_HAVE_OPENSSL - char buf[1024]; - - OpenSSL_add_ssl_algorithms(); - - if (!RAND_status()) { - char rdata[1024]; - struct { - time_t time; - void *ptr; - } rstruct; - - time(&rstruct.time); - rstruct.ptr = (void *) &rstruct; - - RAND_seed((void *) rdata, sizeof(rdata)); - RAND_seed((void *) &rstruct, sizeof(rstruct)); - } - - sess->ssl_ctx = SSL_CTX_new(TLSv1_client_method()); - - if (!sess->ssl_ctx) { - ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// gg_login() SSL_CTX_new() failed: %s\n", buf); - goto fail; - } - - SSL_CTX_set_verify(sess->ssl_ctx, SSL_VERIFY_NONE, NULL); - - sess->ssl = SSL_new(sess->ssl_ctx); - - if (!sess->ssl) { - ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// gg_login() SSL_new() failed: %s\n", buf); - goto fail; - } -#else - gg_debug(GG_DEBUG_MISC, "// gg_login() client requested TLS but no support compiled in\n"); -#endif - } - - if (gg_proxy_enabled) { - hostname = gg_proxy_host; - sess->proxy_port = port = gg_proxy_port; - } else { - hostname = GG_APPMSG_HOST; - port = GG_APPMSG_PORT; - } - - if (!p->async) { - struct in_addr a; - - if (!p->server_addr || !p->server_port) { - if ((a.s_addr = inet_addr(hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() host \"%s\" not found\n", hostname); - goto fail; - } else { - a.s_addr = hn->s_addr; - free(hn); - } - } - } else { - a.s_addr = p->server_addr; - port = p->server_port; - } - - sess->hub_addr = a.s_addr; - - if (gg_proxy_enabled) - sess->proxy_addr = a.s_addr; - - if ((sess->fd = gg_connect(&a, port, 0)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_login() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - - if (p->server_addr && p->server_port) - sess->state = GG_STATE_CONNECTING_GG; - else - sess->state = GG_STATE_CONNECTING_HUB; - - while (sess->state != GG_STATE_CONNECTED) { - struct gg_event *e; - - if (!(e = gg_watch_fd(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() critical error in gg_watch_fd()\n"); - goto fail; - } - - if (e->type == GG_EVENT_CONN_FAILED) { - errno = EACCES; - gg_debug(GG_DEBUG_MISC, "// gg_login() could not login\n"); - gg_event_free(e); - goto fail; - } - - gg_event_free(e); - } - - return sess; - } - - if (!sess->server_addr || gg_proxy_enabled) { -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (gg_resolve_pthread(&sess->fd, &sess->resolver, hostname)) { -#elif defined _WIN32 - if (gg_resolve_win32thread(&sess->fd, &sess->resolver, hostname)) { -#else - if (gg_resolve(&sess->fd, &sess->pid, hostname)) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_login() resolving failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - } else { - if ((sess->fd = gg_connect(&sess->server_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_login() direct connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - } - - return sess; - -fail: - if (sess) { - if (sess->password) - free(sess->password); - if (sess->initial_descr) - free(sess->initial_descr); - free(sess); - } - - return NULL; -} - -/* - * gg_free_session() - * - * prbuje zamkn poczenia i zwalnia pami zajmowan przez sesj. - * - * - sess - opis sesji - */ -void gg_free_session(struct gg_session *sess) -{ - if (!sess) - return; - - /* XXX dopisa zwalnianie i zamykanie wszystkiego, co mogo zosta */ - - if (sess->password) - free(sess->password); - - if (sess->initial_descr) - free(sess->initial_descr); - - if (sess->client_version) - free(sess->client_version); - - if (sess->header_buf) - free(sess->header_buf); - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) - SSL_free(sess->ssl); - - if (sess->ssl_ctx) - SSL_CTX_free(sess->ssl_ctx); -#endif - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (sess->resolver) { - pthread_cancel(*((pthread_t*) sess->resolver)); - free(sess->resolver); - sess->resolver = NULL; - } -#elif defined _WIN32 - if (sess->resolver) { - HANDLE h = sess->resolver; - TerminateThread(h, 0); - CloseHandle(h); - sess->resolver = NULL; - } -#else - if (sess->pid != -1) - waitpid(sess->pid, NULL, WNOHANG); -#endif - - if (sess->fd != -1) - close(sess->fd); - - while (sess->images) - gg_image_queue_remove(sess, sess->images, 1); - - free(sess); -} - -/* - * gg_change_status() - * - * zmienia status uytkownika. przydatne do /away i /busy oraz /quit. - * - * - sess - opis sesji - * - status - nowy status uytkownika - * - * 0, -1. - */ -int gg_change_status(struct gg_session *sess, int status) -{ - struct gg_new_status p; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_change_status(%p, %d);\n", sess, status); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - p.status = gg_fix32(status); - - sess->status = status; - - return gg_send_packet(sess, GG_NEW_STATUS, &p, sizeof(p), NULL); -} - -/* - * gg_change_status_descr() - * - * zmienia status uytkownika na opisowy. - * - * - sess - opis sesji - * - status - nowy status uytkownika - * - descr - opis statusu - * - * 0, -1. - */ -int gg_change_status_descr(struct gg_session *sess, int status, const char *descr) -{ - struct gg_new_status p; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_change_status_descr(%p, %d, \"%s\");\n", sess, status, descr); - - if (!sess || !descr) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - p.status = gg_fix32(status); - - sess->status = status; - - return gg_send_packet(sess, GG_NEW_STATUS, &p, sizeof(p), descr, (strlen(descr) > GG_STATUS_DESCR_MAXSIZE) ? GG_STATUS_DESCR_MAXSIZE : strlen(descr), NULL); -} - -/* - * gg_change_status_descr_time() - * - * zmienia status uytkownika na opisowy z godzin powrotu. - * - * - sess - opis sesji - * - status - nowy status uytkownika - * - descr - opis statusu - * - time - czas w formacie uniksowym - * - * 0, -1. - */ -int gg_change_status_descr_time(struct gg_session *sess, int status, const char *descr, int time) -{ - struct gg_new_status p; - uint32_t newtime; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_change_status_descr_time(%p, %d, \"%s\", %d);\n", sess, status, descr, time); - - if (!sess || !descr || !time) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - p.status = gg_fix32(status); - - sess->status = status; - - newtime = gg_fix32(time); - - return gg_send_packet(sess, GG_NEW_STATUS, &p, sizeof(p), descr, (strlen(descr) > GG_STATUS_DESCR_MAXSIZE) ? GG_STATUS_DESCR_MAXSIZE : strlen(descr), &newtime, sizeof(newtime), NULL); -} - -/* - * gg_logoff() - * - * wylogowuje uytkownika i zamyka poczenie, ale nie zwalnia pamici. - * - * - sess - opis sesji - */ -void gg_logoff(struct gg_session *sess) -{ - if (!sess) - return; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_logoff(%p);\n", sess); - - if (GG_S_NA(sess->status & ~GG_STATUS_FRIENDS_MASK)) - gg_change_status(sess, GG_STATUS_NOT_AVAIL); - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) - SSL_shutdown(sess->ssl); -#endif - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (sess->resolver) { - pthread_cancel(*((pthread_t*) sess->resolver)); - free(sess->resolver); - sess->resolver = NULL; - } -#elif defined _WIN32 - if (sess->resolver) { - HANDLE h = sess->resolver; - TerminateThread(h, 0); - CloseHandle(h); - sess->resolver = NULL; - } -#else - if (sess->pid != -1) { - waitpid(sess->pid, NULL, WNOHANG); - sess->pid = -1; - } -#endif - - if (sess->fd != -1) { - shutdown(sess->fd, SHUT_RDWR); - close(sess->fd); - sess->fd = -1; - } -} - -/* - * gg_image_request() - * - * wysya danie wysania obrazka o podanych parametrach. - * - * - sess - opis sesji - * - recipient - numer adresata - * - size - rozmiar obrazka - * - crc32 - suma kontrolna obrazka - * - * 0/-1 - */ -int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_t crc32) -{ - struct gg_send_msg s; - struct gg_msg_image_request r; - char dummy = 0; - int res; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_image_request(%p, %d, %u, 0x%.4x);\n", sess, recipient, size, crc32); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (size < 0) { - errno = EINVAL; - return -1; - } - - s.recipient = gg_fix32(recipient); - s.seq = gg_fix32(0); - s.msgclass = gg_fix32(GG_CLASS_MSG); - - r.flag = 0x04; - r.size = gg_fix32(size); - r.crc32 = gg_fix32(crc32); - - res = gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), &dummy, 1, &r, sizeof(r), NULL); - - if (!res) { - struct gg_image_queue *q = malloc(sizeof(*q)); - char *buf; - - if (!q) { - gg_debug(GG_DEBUG_MISC, "// gg_image_request() not enough memory for image queue\n"); - return -1; - } - - buf = malloc(size); - if (size && !buf) - { - gg_debug(GG_DEBUG_MISC, "// gg_image_request() not enough memory for image\n"); - free(q); - return -1; - } - - memset(q, 0, sizeof(*q)); - - q->sender = recipient; - q->size = size; - q->crc32 = crc32; - q->image = buf; - - if (!sess->images) - sess->images = q; - else { - struct gg_image_queue *qq; - - for (qq = sess->images; qq->next; qq = qq->next) - ; - - qq->next = q; - } - } - - return res; -} - -/* - * gg_image_reply() - * - * wysya dany obrazek. - * - * - sess - opis sesji - * - recipient - numer adresata - * - filename - nazwa pliku - * - image - bufor z obrazkiem - * - size - rozmiar obrazka - * - * 0/-1 - */ -int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size) -{ - struct gg_msg_image_reply *r; - struct gg_send_msg s; - const char *tmp; - char buf[1910]; - int res = -1; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_image_reply(%p, %d, \"%s\", %p, %d);\n", sess, recipient, filename, image, size); - - if (!sess || !filename || !image) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (size < 0) { - errno = EINVAL; - return -1; - } - - /* wytnij cieki, zostaw tylko nazw pliku */ - while ((tmp = strrchr(filename, '/')) || (tmp = strrchr(filename, '\\'))) - filename = tmp + 1; - - if (strlen(filename) < 1 || strlen(filename) > 1024) { - errno = EINVAL; - return -1; - } - - s.recipient = gg_fix32(recipient); - s.seq = gg_fix32(0); - s.msgclass = gg_fix32(GG_CLASS_MSG); - - buf[0] = 0; - r = (void*) &buf[1]; - - r->flag = 0x05; - r->size = gg_fix32(size); - r->crc32 = gg_fix32(gg_crc32(0, image, size)); - - while (size > 0) { - size_t buflen, chunklen; - - /* \0 + struct gg_msg_image_reply */ - buflen = sizeof(struct gg_msg_image_reply) + 1; - - /* w pierwszym kawaku jest nazwa pliku */ - if (r->flag == 0x05) { - strcpy(buf + buflen, filename); - buflen += strlen(filename) + 1; - } - - chunklen = ((size_t)size >= sizeof(buf) - buflen) ? (sizeof(buf) - buflen) : (size_t)size; - - memcpy(buf + buflen, image, chunklen); - size -= chunklen; - image += chunklen; - - res = gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), buf, buflen + chunklen, NULL); - - if (res == -1) - break; - - r->flag = 0x06; - } - - return res; -} - -/* - * gg_send_message_ctcp() - * - * wysya wiadomo do innego uytkownika. zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipient - numer adresata - * - message - tre wiadomoci - * - message_len - dugo - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_ctcp(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, int message_len) -{ - struct gg_send_msg s; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_ctcp(%p, %d, %u, ...);\n", sess, msgclass, recipient); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - s.recipient = gg_fix32(recipient); - s.seq = gg_fix32(0); - s.msgclass = gg_fix32(msgclass); - - return gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, message_len, NULL); -} - -/* - * gg_send_message() - * - * wysya wiadomo do innego uytkownika. zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipient - numer adresata - * - message - tre wiadomoci - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message(%p, %d, %u, %p)\n", sess, msgclass, recipient, message); - - return gg_send_message_richtext(sess, msgclass, recipient, message, NULL, 0); -} - -/* - * gg_send_message_richtext() - * - * wysya kolorow wiadomo do innego uytkownika. zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipient - numer adresata - * - message - tre wiadomoci - * - format - informacje o formatowaniu - * - formatlen - dugo informacji o formatowaniu - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_richtext(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, const unsigned char *format, int formatlen) -{ - struct gg_send_msg s; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_richtext(%p, %d, %u, %p, %p, %d);\n", sess, msgclass, recipient, message, format, formatlen); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!message) { - errno = EFAULT; - return -1; - } - - s.recipient = gg_fix32(recipient); - if (!sess->seq) - sess->seq = 0x01740000 | (rand() & 0xffff); - s.seq = gg_fix32(sess->seq); - s.msgclass = gg_fix32(msgclass); - sess->seq += (rand() % 0x300) + 0x300; - - if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen((const char *)message) + 1, format, formatlen, NULL) == -1) - return -1; - - return gg_fix32(s.seq); -} - -/* - * gg_send_message_confer() - * - * wysya wiadomo do kilku uytkownikow (konferencja). zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipients_count - ilo adresatw - * - recipients - numerki adresatw - * - message - tre wiadomoci - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_confer(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_confer(%p, %d, %d, %p, %p);\n", sess, msgclass, recipients_count, recipients, message); - - return gg_send_message_confer_richtext(sess, msgclass, recipients_count, recipients, message, NULL, 0); -} - -/* - * gg_send_message_confer_richtext() - * - * wysya kolorow wiadomo do kilku uytkownikow (konferencja). zwraca - * losowy numer sekwencyjny, ktry mona zignorowa albo wykorzysta do - * potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipients_count - ilo adresatw - * - recipients - numerki adresatw - * - message - tre wiadomoci - * - format - informacje o formatowaniu - * - formatlen - dugo informacji o formatowaniu - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message, const unsigned char *format, int formatlen) -{ - struct gg_send_msg s; - struct gg_msg_recipients r; - int i, j, k; - uin_t *recps; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_confer_richtext(%p, %d, %d, %p, %p, %p, %d);\n", sess, msgclass, recipients_count, recipients, message, format, formatlen); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!message || recipients_count <= 0 || recipients_count > 0xffff || !recipients) { - errno = EINVAL; - return -1; - } - - r.flag = 0x01; - r.count = gg_fix32(recipients_count - 1); - - if (!sess->seq) - sess->seq = 0x01740000 | (rand() & 0xffff); - s.seq = gg_fix32(sess->seq); - s.msgclass = gg_fix32(msgclass); - - recps = malloc(sizeof(uin_t) * recipients_count); - if (!recps) - return -1; - - for (i = 0; i < recipients_count; i++) { - - s.recipient = gg_fix32(recipients[i]); - - for (j = 0, k = 0; j < recipients_count; j++) - if (recipients[j] != recipients[i]) { - recps[k] = gg_fix32(recipients[j]); - k++; - } - - if (!i) - sess->seq += (rand() % 0x300) + 0x300; - - if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen((const char *)message) + 1, &r, sizeof(r), recps, (recipients_count - 1) * sizeof(uin_t), format, formatlen, NULL) == -1) { - free(recps); - return -1; - } - } - - free(recps); - - return gg_fix32(s.seq); -} - -/* - * gg_ping() - * - * wysya do serwera pakiet ping. - * - * - sess - opis sesji - * - * 0, -1. - */ -int gg_ping(struct gg_session *sess) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_ping(%p);\n", sess); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - return gg_send_packet(sess, GG_PING, NULL); -} - -/* - * gg_notify_ex() - * - * wysya serwerowi list kontaktw (wraz z odpowiadajcymi im typami userw), - * dziki czemu wie, czyj stan nas interesuje. - * - * - sess - opis sesji - * - userlist - wskanik do tablicy numerw - * - types - wskanik do tablicy typw uytkownikw - * - count - ilo numerkw - * - * 0, -1. - */ -int gg_notify_ex(struct gg_session *sess, uin_t *userlist, char *types, int count) -{ - struct gg_notify *n; - uin_t *u; - char *t; - int i, res = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_notify_ex(%p, %p, %p, %d);\n", sess, userlist, types, count); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!userlist || !count) - return gg_send_packet(sess, GG_LIST_EMPTY, NULL); - - while (count > 0) { - int part_count, packet_type; - - if (count > 400) { - part_count = 400; - packet_type = GG_NOTIFY_FIRST; - } else { - part_count = count; - packet_type = GG_NOTIFY_LAST; - } - - if (!(n = (struct gg_notify*) malloc(sizeof(*n) * part_count))) - return -1; - - for (u = userlist, t = types, i = 0; i < part_count; u++, t++, i++) { - n[i].uin = gg_fix32(*u); - n[i].dunno1 = *t; - } - - if (gg_send_packet(sess, packet_type, n, sizeof(*n) * part_count, NULL) == -1) { - free(n); - res = -1; - break; - } - - count -= part_count; - userlist += part_count; - types += part_count; - - free(n); - } - - return res; -} - -/* - * gg_notify() - * - * wysya serwerowi list kontaktw, dziki czemu wie, czyj stan nas - * interesuje. - * - * - sess - opis sesji - * - userlist - wskanik do tablicy numerw - * - count - ilo numerkw - * - * 0, -1. - */ -int gg_notify(struct gg_session *sess, uin_t *userlist, int count) -{ - struct gg_notify *n; - uin_t *u; - int i, res = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_notify(%p, %p, %d);\n", sess, userlist, count); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!userlist || !count) - return gg_send_packet(sess, GG_LIST_EMPTY, NULL); - - while (count > 0) { - int part_count, packet_type; - - if (count > 400) { - part_count = 400; - packet_type = GG_NOTIFY_FIRST; - } else { - part_count = count; - packet_type = GG_NOTIFY_LAST; - } - - if (!(n = (struct gg_notify*) malloc(sizeof(*n) * part_count))) - return -1; - - for (u = userlist, i = 0; i < part_count; u++, i++) { - n[i].uin = gg_fix32(*u); - n[i].dunno1 = GG_USER_NORMAL; - } - - if (gg_send_packet(sess, packet_type, n, sizeof(*n) * part_count, NULL) == -1) { - res = -1; - free(n); - break; - } - - free(n); - - userlist += part_count; - count -= part_count; - } - - return res; -} - -/* - * gg_add_notify_ex() - * - * dodaje do listy kontaktw dany numer w trakcie poczenia. - * dodawanemu uytkownikowi okrelamy jego typ (patrz protocol.html) - * - * - sess - opis sesji - * - uin - numer - * - type - typ - * - * 0, -1. - */ -int gg_add_notify_ex(struct gg_session *sess, uin_t uin, char type) -{ - struct gg_add_remove a; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_add_notify_ex(%p, %u, %d);\n", sess, uin, type); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - a.uin = gg_fix32(uin); - a.dunno1 = type; - - return gg_send_packet(sess, GG_ADD_NOTIFY, &a, sizeof(a), NULL); -} - -/* - * gg_add_notify() - * - * dodaje do listy kontaktw dany numer w trakcie poczenia. - * - * - sess - opis sesji - * - uin - numer - * - * 0, -1. - */ -int gg_add_notify(struct gg_session *sess, uin_t uin) -{ - return gg_add_notify_ex(sess, uin, GG_USER_NORMAL); -} - -/* - * gg_remove_notify_ex() - * - * usuwa z listy kontaktw w trakcie poczenia. - * usuwanemu uytkownikowi okrelamy jego typ (patrz protocol.html) - * - * - sess - opis sesji - * - uin - numer - * - type - typ - * - * 0, -1. - */ -int gg_remove_notify_ex(struct gg_session *sess, uin_t uin, char type) -{ - struct gg_add_remove a; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_remove_notify_ex(%p, %u, %d);\n", sess, uin, type); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - a.uin = gg_fix32(uin); - a.dunno1 = type; - - return gg_send_packet(sess, GG_REMOVE_NOTIFY, &a, sizeof(a), NULL); -} - -/* - * gg_remove_notify() - * - * usuwa z listy kontaktw w trakcie poczenia. - * - * - sess - opis sesji - * - uin - numer - * - * 0, -1. - */ -int gg_remove_notify(struct gg_session *sess, uin_t uin) -{ - return gg_remove_notify_ex(sess, uin, GG_USER_NORMAL); -} - -/* - * gg_userlist_request() - * - * wysya danie/zapytanie listy kontaktw na serwerze. - * - * - sess - opis sesji - * - type - rodzaj zapytania/dania - * - request - tre zapytania/dania (moe by NULL) - * - * 0, -1 - */ -int gg_userlist_request(struct gg_session *sess, char type, const char *request) -{ - int len; - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!request) { - sess->userlist_blocks = 1; - return gg_send_packet(sess, GG_USERLIST_REQUEST, &type, sizeof(type), NULL); - } - - len = strlen(request); - - sess->userlist_blocks = 0; - - while (len > 2047) { - sess->userlist_blocks++; - - if (gg_send_packet(sess, GG_USERLIST_REQUEST, &type, sizeof(type), request, 2047, NULL) == -1) - return -1; - - if (type == GG_USERLIST_PUT) - type = GG_USERLIST_PUT_MORE; - - request += 2047; - len -= 2047; - } - - sess->userlist_blocks++; - - return gg_send_packet(sess, GG_USERLIST_REQUEST, &type, sizeof(type), request, len, NULL); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu-config.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu-config.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu-config.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu-config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* Local libgadu configuration. */ - -#include "config.h" - -#ifndef __GG_LIBGADU_CONFIG_H -#define __GG_LIBGADU_CONFIG_H - -/* Defined if libgadu was compiled for bigendian machine. */ -#undef __GG_LIBGADU_BIGENDIAN -#ifdef WORDS_BIGENDIAN -#define __GG_LIBGADU_BIGENDIAN -#endif /* WORDS_BIGENDIAN */ - -/* Defined if this machine has va_copy(). */ -#define __GG_LIBGADU_HAVE_VA_COPY - -/* Defined if this machine has __va_copy(). */ -#define __GG_LIBGADU_HAVE___VA_COPY - -/* Defined if this machine supports long long. */ -#undef __GG_LIBGADU_HAVE_LONG_LONG -#ifdef HAVE_LONG_LONG -#define __GG_LIBGADU_HAVE_LONG_LONG -#endif /* HAVE_LONG_LONG */ - -/* Defined if libgadu was compiled and linked with pthread support. */ -/* We don't like pthreads. */ -#undef __GG_LIBGADU_HAVE_PTHREAD - -/* Defined if libgadu was compiled and linked with TLS support. */ -/* Always undefined in Purple. */ -#undef __GG_LIBGADU_HAVE_OPENSSL - -/* Include file containing uintXX_t declarations. */ -#if HAVE_STDINT_H -#include -#endif - -/* Defined if this machine has C99-compiliant vsnprintf(). */ -#ifndef _WIN32 -#define __GG_LIBGADU_HAVE_C99_VSNPRINTF -#else -#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF -#endif - -#define vnsprintf g_vnsprintf - -#ifdef _WIN32 -#define random (long) rand -#endif - -#endif /* __GG_LIBGADU_CONFIG_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/libgadu.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1310 +0,0 @@ -/* $Id: libgadu.h 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * Robert J. Wony - * Arkadiusz Mikiewicz - * Tomasz Chiliski - * Piotr Wysocki - * Dawid Jarosz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#ifndef __GG_LIBGADU_H -#define __GG_LIBGADU_H - -#ifdef __cplusplus -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif -extern "C" { -#endif - -#include -#include -#include -#include - -#ifdef __GG_LIBGADU_HAVE_OPENSSL -#include -#endif - -/* - * typedef uin_t - * - * typ reprezentujcy numer osoby. - */ -typedef uint32_t uin_t; - -/* - * oglna struktura opisujca rne sesje. przydatna w klientach. - */ -#define gg_common_head(x) \ - int fd; /* podgldany deskryptor */ \ - int check; /* sprawdzamy zapis czy odczyt */ \ - int state; /* aktualny stan maszynki */ \ - int error; /* kod bdu dla GG_STATE_ERROR */ \ - int type; /* rodzaj sesji */ \ - int id; /* identyfikator */ \ - int timeout; /* sugerowany timeout w sekundach */ \ - int (*callback)(x*); /* callback przy zmianach */ \ - void (*destroy)(x*); /* funkcja niszczenia */ - -struct gg_common { - gg_common_head(struct gg_common) -}; - -struct gg_image_queue; - -/* - * struct gg_session - * - * struktura opisujca dan sesj. tworzona przez gg_login(), zwalniana - * przez gg_free_session(). - */ -struct gg_session { - gg_common_head(struct gg_session) - - int async; /* czy poczenie jest asynchroniczne */ - int pid; /* pid procesu resolvera */ - int port; /* port, z ktrym si czymy */ - int seq; /* numer sekwencyjny ostatniej wiadomoci */ - int last_pong; /* czas otrzymania ostatniego ping/pong */ - int last_event; /* czas otrzymania ostatniego pakietu */ - - struct gg_event *event; /* zdarzenie po ->callback() */ - - uint32_t proxy_addr; /* adres proxy, keszowany */ - uint16_t proxy_port; /* port proxy */ - - uint32_t hub_addr; /* adres huba po resolvniciu */ - uint32_t server_addr; /* adres serwera, od huba */ - - uint32_t client_addr; /* adres klienta */ - uint16_t client_port; /* port, na ktrym klient sucha */ - - uint32_t external_addr; /* adres zewnetrzny klienta */ - uint16_t external_port; /* port zewnetrzny klienta */ - - uin_t uin; /* numerek klienta */ - char *password; /* i jego haso. zwalniane automagicznie */ - - int initial_status; /* pocztkowy stan klienta */ - int status; /* aktualny stan klienta */ - - char *recv_buf; /* bufor na otrzymywane pakiety */ - int recv_done; /* ile ju wczytano do bufora */ - int recv_left; /* i ile jeszcze trzeba wczyta */ - - int protocol_version; /* wersja uywanego protokou */ - char *client_version; /* wersja uywanego klienta */ - int last_sysmsg; /* ostatnia wiadomo systemowa */ - - char *initial_descr; /* pocztkowy opis stanu klienta */ - - void *resolver; /* wskanik na informacje resolvera */ - - char *header_buf; /* bufor na pocztek nagwka */ - unsigned int header_done;/* ile ju mamy */ - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - SSL *ssl; /* sesja TLS */ - SSL_CTX *ssl_ctx; /* kontekst sesji? */ -#else - void *ssl; /* zachowujemy ABI */ - void *ssl_ctx; -#endif - - int image_size; /* maksymalny rozmiar obrazkw w KiB */ - - char *userlist_reply; /* fragment odpowiedzi listy kontaktw */ - - int userlist_blocks; /* na ile kawakw podzielono list kontaktw */ - - struct gg_image_queue *images; /* aktualnie wczytywane obrazki */ -}; - -/* - * struct gg_http - * - * oglna struktura opisujca stan wszystkich operacji HTTP. tworzona - * przez gg_http_connect(), zwalniana przez gg_http_free(). - */ -struct gg_http { - gg_common_head(struct gg_http) - - int async; /* czy poczenie asynchroniczne */ - int pid; /* pid procesu resolvera */ - int port; /* port, z ktrym si czymy */ - - char *query; /* bufor zapytania http */ - char *header; /* bufor nagwka */ - int header_size; /* rozmiar wczytanego nagwka */ - char *body; /* bufor otrzymanych informacji */ - unsigned int body_size; /* oczekiwana ilo informacji */ - - void *data; /* dane danej operacji http */ - - char *user_data; /* dane uytkownika, nie s zwalniane przez gg_http_free() */ - - void *resolver; /* wskanik na informacje resolvera */ - - unsigned int body_done; /* ile ju treci odebrano? */ -}; - -#ifdef __GNUC__ -#define GG_PACKED __attribute__ ((packed)) -#else -#define GG_PACKED -#endif - -#define GG_MAX_PATH 276 - -/* - * struct gg_file_info - * - * odpowiednik windowsowej struktury WIN32_FIND_DATA niezbdnej przy - * wysyaniu plikw. - */ -struct gg_file_info { - uint32_t mode; /* dwFileAttributes */ - uint32_t ctime[2]; /* ftCreationTime */ - uint32_t atime[2]; /* ftLastAccessTime */ - uint32_t mtime[2]; /* ftLastWriteTime */ - uint32_t size_hi; /* nFileSizeHigh */ - uint32_t size; /* nFileSizeLow */ - uint32_t reserved0; /* dwReserved0 */ - uint32_t reserved1; /* dwReserved1 */ - unsigned char filename[GG_MAX_PATH - 14]; /* cFileName */ - unsigned char short_filename[14]; /* cAlternateFileName */ -} GG_PACKED; - -/* - * struct gg_dcc - * - * struktura opisujca nasuchujce gniazdo pocze midzy klientami. - * tworzona przez gg_dcc_socket_create(), zwalniana przez gg_dcc_free(). - */ -struct gg_dcc { - gg_common_head(struct gg_dcc) - - struct gg_event *event; /* opis zdarzenia */ - - int active; /* czy to my si czymy? */ - int port; /* port, na ktrym siedzi */ - uin_t uin; /* uin klienta */ - uin_t peer_uin; /* uin drugiej strony */ - int file_fd; /* deskryptor pliku */ - unsigned int offset; /* offset w pliku */ - unsigned int chunk_size;/* rozmiar kawaka */ - unsigned int chunk_offset;/* offset w aktualnym kawaku */ - struct gg_file_info file_info; - /* informacje o pliku */ - int established; /* poczenie ustanowione */ - uint8_t *voice_buf; /* bufor na pakiet poczenia gosowego */ - int incoming; /* poczenie przychodzce */ - char *chunk_buf; /* bufor na kawaek danych */ - uint32_t remote_addr; /* adres drugiej strony */ - uint16_t remote_port; /* port drugiej strony */ -}; - -/* - * enum gg_session_t - * - * rodzaje sesji. - */ -enum gg_session_t { - GG_SESSION_GG = 1, /* poczenie z serwerem gg */ - GG_SESSION_HTTP, /* oglna sesja http */ - GG_SESSION_SEARCH, /* szukanie */ - GG_SESSION_REGISTER, /* rejestrowanie */ - GG_SESSION_REMIND, /* przypominanie hasa */ - GG_SESSION_PASSWD, /* zmiana hasa */ - GG_SESSION_CHANGE, /* zmiana informacji o sobie */ - GG_SESSION_DCC, /* oglne poczenie DCC */ - GG_SESSION_DCC_SOCKET, /* nasuchujcy socket */ - GG_SESSION_DCC_SEND, /* wysyanie pliku */ - GG_SESSION_DCC_GET, /* odbieranie pliku */ - GG_SESSION_DCC_VOICE, /* rozmowa gosowa */ - GG_SESSION_USERLIST_GET, /* pobieranie userlisty */ - GG_SESSION_USERLIST_PUT, /* wysyanie userlisty */ - GG_SESSION_UNREGISTER, /* usuwanie konta */ - GG_SESSION_USERLIST_REMOVE, /* usuwanie userlisty */ - GG_SESSION_TOKEN, /* pobieranie tokenu */ - - GG_SESSION_USER0 = 256, /* zdefiniowana dla uytkownika */ - GG_SESSION_USER1, /* j.w. */ - GG_SESSION_USER2, /* j.w. */ - GG_SESSION_USER3, /* j.w. */ - GG_SESSION_USER4, /* j.w. */ - GG_SESSION_USER5, /* j.w. */ - GG_SESSION_USER6, /* j.w. */ - GG_SESSION_USER7 /* j.w. */ -}; - -/* - * enum gg_state_t - * - * opisuje stan asynchronicznej maszyny. - */ -enum gg_state_t { - /* wsplne */ - GG_STATE_IDLE = 0, /* nie powinno wystpi. */ - GG_STATE_RESOLVING, /* wywoa gethostbyname() */ - GG_STATE_CONNECTING, /* wywoa connect() */ - GG_STATE_READING_DATA, /* czeka na dane http */ - GG_STATE_ERROR, /* wystpi bd. kod w x->error */ - - /* gg_session */ - GG_STATE_CONNECTING_HUB, /* wywoa connect() na huba */ - GG_STATE_CONNECTING_GG, /* wywoa connect() na serwer */ - GG_STATE_READING_KEY, /* czeka na klucz */ - GG_STATE_READING_REPLY, /* czeka na odpowied */ - GG_STATE_CONNECTED, /* poczy si */ - - /* gg_http */ - GG_STATE_SENDING_QUERY, /* wysya zapytanie http */ - GG_STATE_READING_HEADER, /* czeka na nagwek http */ - GG_STATE_PARSING, /* przetwarza dane */ - GG_STATE_DONE, /* skoczy */ - - /* gg_dcc */ - GG_STATE_LISTENING, /* czeka na poczenia */ - GG_STATE_READING_UIN_1, /* czeka na uin peera */ - GG_STATE_READING_UIN_2, /* czeka na swj uin */ - GG_STATE_SENDING_ACK, /* wysya potwierdzenie dcc */ - GG_STATE_READING_ACK, /* czeka na potwierdzenie dcc */ - GG_STATE_READING_REQUEST, /* czeka na komend */ - GG_STATE_SENDING_REQUEST, /* wysya komend */ - GG_STATE_SENDING_FILE_INFO, /* wysya informacje o pliku */ - GG_STATE_READING_PRE_FILE_INFO, /* czeka na pakiet przed file_info */ - GG_STATE_READING_FILE_INFO, /* czeka na informacje o pliku */ - GG_STATE_SENDING_FILE_ACK, /* wysya potwierdzenie pliku */ - GG_STATE_READING_FILE_ACK, /* czeka na potwierdzenie pliku */ - GG_STATE_SENDING_FILE_HEADER, /* wysya nagwek pliku */ - GG_STATE_READING_FILE_HEADER, /* czeka na nagwek */ - GG_STATE_GETTING_FILE, /* odbiera plik */ - GG_STATE_SENDING_FILE, /* wysya plik */ - GG_STATE_READING_VOICE_ACK, /* czeka na potwierdzenie voip */ - GG_STATE_READING_VOICE_HEADER, /* czeka na rodzaj bloku voip */ - GG_STATE_READING_VOICE_SIZE, /* czeka na rozmiar bloku voip */ - GG_STATE_READING_VOICE_DATA, /* czeka na dane voip */ - GG_STATE_SENDING_VOICE_ACK, /* wysya potwierdzenie voip */ - GG_STATE_SENDING_VOICE_REQUEST, /* wysya danie voip */ - GG_STATE_READING_TYPE, /* czeka na typ poczenia */ - - /* nowe. bez sensu jest to API. */ - GG_STATE_TLS_NEGOTIATION /* negocjuje poczenie TLS */ -}; - -/* - * enum gg_check_t - * - * informuje, co proces klienta powinien sprawdzi na deskryptorze danego - * poczenia. - */ -enum gg_check_t { - GG_CHECK_NONE = 0, /* nic. nie powinno wystpi */ - GG_CHECK_WRITE = 1, /* sprawdzamy moliwo zapisu */ - GG_CHECK_READ = 2 /* sprawdzamy moliwo odczytu */ -}; - -/* - * struct gg_login_params - * - * parametry gg_login(). przeniesiono do struktury, eby unikn problemw - * z cigymi zmianami API, gdy dodano co nowego do protokou. - */ -struct gg_login_params { - uin_t uin; /* numerek */ - char *password; /* haso */ - int async; /* asynchroniczne sockety? */ - int status; /* pocztkowy status klienta */ - char *status_descr; /* opis statusu */ - uint32_t server_addr; /* adres serwera gg */ - uint16_t server_port; /* port serwera gg */ - uint32_t client_addr; /* adres dcc klienta */ - uint16_t client_port; /* port dcc klienta */ - int protocol_version; /* wersja protokou */ - char *client_version; /* wersja klienta */ - int has_audio; /* czy ma dwik? */ - int last_sysmsg; /* ostatnia wiadomo systemowa */ - uint32_t external_addr; /* adres widziany na zewnatrz */ - uint16_t external_port; /* port widziany na zewnatrz */ - int tls; /* czy czymy po TLS? */ - int image_size; /* maksymalny rozmiar obrazka w KiB */ - int era_omnix; /* czy udawa klienta era omnix? */ - - char dummy[6 * sizeof(int)]; /* miejsce na kolejnych 6 zmiennych, - * eby z dodaniem parametru nie - * zmienia si rozmiar struktury */ -}; - -struct gg_session *gg_login(const struct gg_login_params *p); -void gg_free_session(struct gg_session *sess); -void gg_logoff(struct gg_session *sess); -int gg_change_status(struct gg_session *sess, int status); -int gg_change_status_descr(struct gg_session *sess, int status, const char *descr); -int gg_change_status_descr_time(struct gg_session *sess, int status, const char *descr, int time); -int gg_send_message(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message); -int gg_send_message_richtext(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, const unsigned char *format, int formatlen); -int gg_send_message_confer(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message); -int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message, const unsigned char *format, int formatlen); -int gg_send_message_ctcp(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, int message_len); -int gg_ping(struct gg_session *sess); -int gg_userlist_request(struct gg_session *sess, char type, const char *request); -int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_t crc32); -int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size); - -uint32_t gg_crc32(uint32_t crc, const unsigned char *buf, int len); - -struct gg_image_queue { - uin_t sender; /* nadawca obrazka */ - uint32_t size; /* rozmiar */ - uint32_t crc32; /* suma kontrolna */ - char *filename; /* nazwa pliku */ - char *image; /* bufor z obrazem */ - uint32_t done; /* ile ju wczytano */ - - struct gg_image_queue *next; /* nastpny na licie */ -}; - -/* - * enum gg_event_t - * - * rodzaje zdarze. - */ -enum gg_event_t { - GG_EVENT_NONE = 0, /* nic si nie wydarzyo */ - GG_EVENT_MSG, /* otrzymano wiadomo */ - GG_EVENT_NOTIFY, /* kto si pojawi */ - GG_EVENT_NOTIFY_DESCR, /* kto si pojawi z opisem */ - GG_EVENT_STATUS, /* kto zmieni stan */ - GG_EVENT_ACK, /* potwierdzenie wysania wiadomoci */ - GG_EVENT_PONG, /* pakiet pong */ - GG_EVENT_CONN_FAILED, /* poczenie si nie udao */ - GG_EVENT_CONN_SUCCESS, /* poczenie si powiodo */ - GG_EVENT_DISCONNECT, /* serwer zrywa poczenie */ - - GG_EVENT_DCC_NEW, /* nowe poczenie midzy klientami */ - GG_EVENT_DCC_ERROR, /* bd poczenia midzy klientami */ - GG_EVENT_DCC_DONE, /* zakoczono poczenie */ - GG_EVENT_DCC_CLIENT_ACCEPT, /* moment akceptacji klienta */ - GG_EVENT_DCC_CALLBACK, /* klient si poczy na danie */ - GG_EVENT_DCC_NEED_FILE_INFO, /* naley wypeni file_info */ - GG_EVENT_DCC_NEED_FILE_ACK, /* czeka na potwierdzenie pliku */ - GG_EVENT_DCC_NEED_VOICE_ACK, /* czeka na potwierdzenie rozmowy */ - GG_EVENT_DCC_VOICE_DATA, /* ramka danych rozmowy gosowej */ - - GG_EVENT_PUBDIR50_SEARCH_REPLY, /* odpowiedz wyszukiwania */ - GG_EVENT_PUBDIR50_READ, /* odczytano wasne dane z katalogu */ - GG_EVENT_PUBDIR50_WRITE, /* wpisano wasne dane do katalogu */ - - GG_EVENT_STATUS60, /* kto zmieni stan w GG 6.0 */ - GG_EVENT_NOTIFY60, /* kto si pojawi w GG 6.0 */ - GG_EVENT_USERLIST, /* odpowied listy kontaktw w GG 6.0 */ - GG_EVENT_IMAGE_REQUEST, /* proba o wysanie obrazka GG 6.0 */ - GG_EVENT_IMAGE_REPLY, /* podesany obrazek GG 6.0 */ - GG_EVENT_DCC_ACK /* potwierdzenie transmisji */ -}; - -#define GG_EVENT_SEARCH50_REPLY GG_EVENT_PUBDIR50_SEARCH_REPLY - -/* - * enum gg_failure_t - * - * okrela powd nieudanego poczenia. - */ -enum gg_failure_t { - GG_FAILURE_RESOLVING = 1, /* nie znaleziono serwera */ - GG_FAILURE_CONNECTING, /* nie mona si poczy */ - GG_FAILURE_INVALID, /* serwer zwrci nieprawidowe dane */ - GG_FAILURE_READING, /* zerwano poczenie podczas odczytu */ - GG_FAILURE_WRITING, /* zerwano poczenie podczas zapisu */ - GG_FAILURE_PASSWORD, /* nieprawidowe haso */ - GG_FAILURE_404, /* XXX nieuywane */ - GG_FAILURE_TLS, /* bd negocjacji TLS */ - GG_FAILURE_NEED_EMAIL /* serwer rozczy nas z prob o zmian emaila */ -}; - -/* - * enum gg_error_t - * - * okrela rodzaj bdu wywoanego przez dan operacj. nie zawiera - * przesadnie szczegowych informacji o powodzie bdu, by nie komplikowa - * obsugi bdw. jeli wymagana jest wiksza dokadno, naley sprawdzi - * zawarto zmiennej errno. - */ -enum gg_error_t { - GG_ERROR_RESOLVING = 1, /* bd znajdowania hosta */ - GG_ERROR_CONNECTING, /* bd aczenia si */ - GG_ERROR_READING, /* bd odczytu */ - GG_ERROR_WRITING, /* bd wysyania */ - - GG_ERROR_DCC_HANDSHAKE, /* bd negocjacji */ - GG_ERROR_DCC_FILE, /* bd odczytu/zapisu pliku */ - GG_ERROR_DCC_EOF, /* plik si skoczy? */ - GG_ERROR_DCC_NET, /* bd wysyania/odbierania */ - GG_ERROR_DCC_REFUSED /* poczenie odrzucone przez usera */ -}; - -/* - * struktury dotyczce wyszukiwania w GG 5.0. NIE NALEY SI DO NICH - * ODWOYWA BEZPOREDNIO! do dostpu do nich su funkcje gg_pubdir50_*() - */ -struct gg_pubdir50_entry { - int num; - char *field; - char *value; -}; - -struct gg_pubdir50_s { - int count; - uin_t next; - int type; - uint32_t seq; - struct gg_pubdir50_entry *entries; - int entries_count; -}; - -/* - * typedef gg_pubdir_50_t - * - * typ opisujcy zapytanie lub wynik zapytania katalogu publicznego - * z protokou GG 5.0. nie naley si odwoywa bezporednio do jego - * pl -- su do tego funkcje gg_pubdir50_*() - */ -typedef struct gg_pubdir50_s *gg_pubdir50_t; - -/* - * struct gg_event - * - * struktura opisujca rodzaj zdarzenia. wychodzi z gg_watch_fd() lub - * z gg_dcc_watch_fd() - */ -struct gg_event { - int type; /* rodzaj zdarzenia -- gg_event_t */ - union { /* @event */ - struct gg_notify_reply *notify; /* informacje o licie kontaktw -- GG_EVENT_NOTIFY */ - - enum gg_failure_t failure; /* bd poczenia -- GG_EVENT_FAILURE */ - - struct gg_dcc *dcc_new; /* nowe poczenie bezporednie -- GG_EVENT_DCC_NEW */ - - int dcc_error; /* bd poczenia bezporedniego -- GG_EVENT_DCC_ERROR */ - - gg_pubdir50_t pubdir50; /* wynik operacji zwizanej z katalogiem publicznym -- GG_EVENT_PUBDIR50_* */ - - struct { /* @msg odebrano wiadomo -- GG_EVENT_MSG */ - uin_t sender; /* numer nadawcy */ - int msgclass; /* klasa wiadomoci */ - time_t time; /* czas nadania */ - unsigned char *message; /* tre wiadomoci */ - - int recipients_count; /* ilo odbiorcw konferencji */ - uin_t *recipients; /* odbiorcy konferencji */ - - int formats_length; /* dugo informacji o formatowaniu tekstu */ - void *formats; /* informacje o formatowaniu tekstu */ - } msg; - - struct { /* @notify_descr informacje o licie kontaktw z opisami stanu -- GG_EVENT_NOTIFY_DESCR */ - struct gg_notify_reply *notify; /* informacje o licie kontaktw */ - char *descr; /* opis stanu */ - } notify_descr; - - struct { /* @status zmiana stanu -- GG_EVENT_STATUS */ - uin_t uin; /* numer */ - uint32_t status; /* nowy stan */ - char *descr; /* opis stanu */ - } status; - - struct { /* @status60 zmiana stanu -- GG_EVENT_STATUS60 */ - uin_t uin; /* numer */ - int status; /* nowy stan */ - uint32_t remote_ip; /* adres ip */ - uint16_t remote_port; /* port */ - int version; /* wersja klienta */ - int image_size; /* maksymalny rozmiar grafiki w KiB */ - char *descr; /* opis stanu */ - time_t time; /* czas powrotu */ - } status60; - - struct { /* @notify60 informacja o licie kontaktw -- GG_EVENT_NOTIFY60 */ - uin_t uin; /* numer */ - int status; /* stan */ - uint32_t remote_ip; /* adres ip */ - uint16_t remote_port; /* port */ - int version; /* wersja klienta */ - int image_size; /* maksymalny rozmiar grafiki w KiB */ - char *descr; /* opis stanu */ - time_t time; /* czas powrotu */ - } *notify60; - - struct { /* @ack potwierdzenie wiadomoci -- GG_EVENT_ACK */ - uin_t recipient; /* numer odbiorcy */ - int status; /* stan dorczenia wiadomoci */ - int seq; /* numer sekwencyjny wiadomoci */ - } ack; - - struct { /* @dcc_voice_data otrzymano dane dwikowe -- GG_EVENT_DCC_VOICE_DATA */ - uint8_t *data; /* dane dwikowe */ - int length; /* ilo danych dwikowych */ - } dcc_voice_data; - - struct { /* @userlist odpowied listy kontaktw serwera */ - char type; /* rodzaj odpowiedzi */ - char *reply; /* tre odpowiedzi */ - } userlist; - - struct { /* @image_request proba o obrazek */ - uin_t sender; /* nadawca proby */ - uint32_t size; /* rozmiar obrazka */ - uint32_t crc32; /* suma kontrolna */ - } image_request; - - struct { /* @image_reply odpowied z obrazkiem */ - uin_t sender; /* nadawca odpowiedzi */ - uint32_t size; /* rozmiar obrazka */ - uint32_t crc32; /* suma kontrolna */ - char *filename; /* nazwa pliku */ - char *image; /* bufor z obrazkiem */ - } image_reply; - } event; -}; - -struct gg_event *gg_watch_fd(struct gg_session *sess); -void gg_event_free(struct gg_event *e); -#define gg_free_event gg_event_free - -/* - * funkcje obsugi listy kontaktw. - */ -int gg_notify_ex(struct gg_session *sess, uin_t *userlist, char *types, int count); -int gg_notify(struct gg_session *sess, uin_t *userlist, int count); -int gg_add_notify_ex(struct gg_session *sess, uin_t uin, char type); -int gg_add_notify(struct gg_session *sess, uin_t uin); -int gg_remove_notify_ex(struct gg_session *sess, uin_t uin, char type); -int gg_remove_notify(struct gg_session *sess, uin_t uin); - -/* - * funkcje obsugi http. - */ -struct gg_http *gg_http_connect(const char *hostname, int port, int async, const char *method, const char *path, const char *header); -int gg_http_watch_fd(struct gg_http *h); -void gg_http_stop(struct gg_http *h); -void gg_http_free(struct gg_http *h); -void gg_http_free_fields(struct gg_http *h); -#define gg_free_http gg_http_free - -/* - * struktury opisujca kryteria wyszukiwania dla gg_search(). nieaktualne, - * zastpione przez gg_pubdir50_t. pozostawiono je dla zachowania ABI. - */ -struct gg_search_request { - int active; - unsigned int start; - char *nickname; - char *first_name; - char *last_name; - char *city; - int gender; - int min_birth; - int max_birth; - char *email; - char *phone; - uin_t uin; -}; - -struct gg_search { - int count; - struct gg_search_result *results; -}; - -struct gg_search_result { - uin_t uin; - char *first_name; - char *last_name; - char *nickname; - int born; - int gender; - char *city; - int active; -}; - -#define GG_GENDER_NONE 0 -#define GG_GENDER_FEMALE 1 -#define GG_GENDER_MALE 2 - -/* - * funkcje wyszukiwania. - */ -struct gg_http *gg_search(const struct gg_search_request *r, int async); -int gg_search_watch_fd(struct gg_http *f); -void gg_free_search(struct gg_http *f); -#define gg_search_free gg_free_search - -const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start); -const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start); -const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start); -const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start); -void gg_search_request_free(struct gg_search_request *r); - -/* - * funkcje obsugi katalogu publicznego zgodne z GG 5.0. tym razem funkcje - * zachowuj pewien poziom abstrakcji, eby unikn zmian ABI przy zmianach - * w protokole. - * - * NIE NALEY SI ODWOYWA DO PL gg_pubdir50_t BEZPOREDNIO! - */ -uint32_t gg_pubdir50(struct gg_session *sess, gg_pubdir50_t req); -gg_pubdir50_t gg_pubdir50_new(int type); -int gg_pubdir50_add(gg_pubdir50_t req, const char *field, const char *value); -int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq); -const char *gg_pubdir50_get(gg_pubdir50_t res, int num, const char *field); -int gg_pubdir50_type(gg_pubdir50_t res); -int gg_pubdir50_count(gg_pubdir50_t res); -uin_t gg_pubdir50_next(gg_pubdir50_t res); -uint32_t gg_pubdir50_seq(gg_pubdir50_t res); -void gg_pubdir50_free(gg_pubdir50_t res); - -#define GG_PUBDIR50_UIN "FmNumber" -#define GG_PUBDIR50_STATUS "FmStatus" -#define GG_PUBDIR50_FIRSTNAME "firstname" -#define GG_PUBDIR50_LASTNAME "lastname" -#define GG_PUBDIR50_NICKNAME "nickname" -#define GG_PUBDIR50_BIRTHYEAR "birthyear" -#define GG_PUBDIR50_CITY "city" -#define GG_PUBDIR50_GENDER "gender" -#define GG_PUBDIR50_GENDER_FEMALE "1" -#define GG_PUBDIR50_GENDER_MALE "2" -#define GG_PUBDIR50_GENDER_SET_FEMALE "2" -#define GG_PUBDIR50_GENDER_SET_MALE "1" -#define GG_PUBDIR50_ACTIVE "ActiveOnly" -#define GG_PUBDIR50_ACTIVE_TRUE "1" -#define GG_PUBDIR50_START "fmstart" -#define GG_PUBDIR50_FAMILYNAME "familyname" -#define GG_PUBDIR50_FAMILYCITY "familycity" - -int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length); - -/* - * struct gg_pubdir - * - * operacje na katalogu publicznym. - */ -struct gg_pubdir { - int success; /* czy si udao */ - uin_t uin; /* otrzymany numerek. 0 jeli bd */ -}; - -/* oglne funkcje, nie powinny by uywane */ -int gg_pubdir_watch_fd(struct gg_http *f); -void gg_pubdir_free(struct gg_http *f); -#define gg_free_pubdir gg_pubdir_free - -struct gg_token { - int width; /* szeroko obrazka */ - int height; /* wysoko obrazka */ - int length; /* ilo znakw w tokenie */ - char *tokenid; /* id tokenu */ -}; - -/* funkcje dotyczce tokenw */ -struct gg_http *gg_token(int async); -int gg_token_watch_fd(struct gg_http *h); -void gg_token_free(struct gg_http *h); - -/* rejestracja nowego numerka */ -struct gg_http *gg_register(const char *email, const char *password, int async); -struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async); -struct gg_http *gg_register3(const char *email, const char *password, const char *tokenid, const char *tokenval, int async); -#define gg_register_watch_fd gg_pubdir_watch_fd -#define gg_register_free gg_pubdir_free -#define gg_free_register gg_pubdir_free - -struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async); -struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async); -struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *tokenid, const char *tokenval, int async); -#define gg_unregister_watch_fd gg_pubdir_watch_fd -#define gg_unregister_free gg_pubdir_free - -/* przypomnienie hasa e-mailem */ -struct gg_http *gg_remind_passwd(uin_t uin, int async); -struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async); -struct gg_http *gg_remind_passwd3(uin_t uin, const char *email, const char *tokenid, const char *tokenval, int async); -#define gg_remind_passwd_watch_fd gg_pubdir_watch_fd -#define gg_remind_passwd_free gg_pubdir_free -#define gg_free_remind_passwd gg_pubdir_free - -/* zmiana hasa */ -struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async); -struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async); -struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async); -struct gg_http *gg_change_passwd4(uin_t uin, const char *email, const char *passwd, const char *newpasswd, const char *tokenid, const char *tokenval, int async); -#define gg_change_passwd_free gg_pubdir_free -#define gg_free_change_passwd gg_pubdir_free - -/* - * struct gg_change_info_request - * - * opis dania zmiany informacji w katalogu publicznym. - */ -struct gg_change_info_request { - char *first_name; /* imi */ - char *last_name; /* nazwisko */ - char *nickname; /* pseudonim */ - char *email; /* email */ - int born; /* rok urodzenia */ - int gender; /* pe */ - char *city; /* miasto */ -}; - -struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city); -void gg_change_info_request_free(struct gg_change_info_request *r); - -struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async); -#define gg_change_pubdir_watch_fd gg_pubdir_watch_fd -#define gg_change_pubdir_free gg_pubdir_free -#define gg_free_change_pubdir gg_pubdir_free - -/* - * funkcje dotyczce listy kontaktw na serwerze. - */ -struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async); -int gg_userlist_get_watch_fd(struct gg_http *f); -void gg_userlist_get_free(struct gg_http *f); - -struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async); -int gg_userlist_put_watch_fd(struct gg_http *f); -void gg_userlist_put_free(struct gg_http *f); - -struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async); -int gg_userlist_remove_watch_fd(struct gg_http *f); -void gg_userlist_remove_free(struct gg_http *f); - - - -/* - * funkcje dotyczce komunikacji midzy klientami. - */ -extern int gg_dcc_port; /* port, na ktrym nasuchuje klient */ -extern unsigned long gg_dcc_ip; /* adres, na ktrym nasuchuje klient */ - -int gg_dcc_request(struct gg_session *sess, uin_t uin); - -struct gg_dcc *gg_dcc_send_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); -struct gg_dcc *gg_dcc_get_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); -struct gg_dcc *gg_dcc_voice_chat(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); -void gg_dcc_set_type(struct gg_dcc *d, int type); -int gg_dcc_fill_file_info(struct gg_dcc *d, const char *filename); -int gg_dcc_fill_file_info2(struct gg_dcc *d, const char *filename, const char *local_filename); -int gg_dcc_voice_send(struct gg_dcc *d, char *buf, int length); - -#define GG_DCC_VOICE_FRAME_LENGTH 195 -#define GG_DCC_VOICE_FRAME_LENGTH_505 326 - -struct gg_dcc *gg_dcc_socket_create(uin_t uin, uint16_t port); -#define gg_dcc_socket_free gg_free_dcc -#define gg_dcc_socket_watch_fd gg_dcc_watch_fd - -struct gg_event *gg_dcc_watch_fd(struct gg_dcc *d); - -void gg_dcc_free(struct gg_dcc *c); -#define gg_free_dcc gg_dcc_free - -/* - * jeli chcemy sobie podebugowa, wystarczy ustawi `gg_debug_level'. - * niestety w miar przybywania wpisw `gg_debug(...)' nie chciao mi - * si ustawia odpowiednich leveli, wic wikszo sza do _MISC. - */ -extern int gg_debug_level; /* poziom debugowania. mapa bitowa staych GG_DEBUG_* */ - -/* - * mona poda wskanik do funkcji obsugujcej wywoania gg_debug(). - * nieoficjalne, nieudokumentowane, moe si zmieni. jeli kto jest - * zainteresowany, niech da zna na ekg-devel. - */ -extern void (*gg_debug_handler)(int level, const char *format, va_list ap); - -/* - * mona poda plik, do ktrego bd zapisywane teksty z gg_debug(). - */ -extern FILE *gg_debug_file; - -#define GG_DEBUG_NET 1 -#define GG_DEBUG_TRAFFIC 2 -#define GG_DEBUG_DUMP 4 -#define GG_DEBUG_FUNCTION 8 -#define GG_DEBUG_MISC 16 - -#ifdef GG_DEBUG_DISABLE -#define gg_debug(x, y...) do { } while(0) -#else -void gg_debug(int level, const char *format, ...); -#endif - -const char *gg_libgadu_version(void); - -/* - * konfiguracja http proxy. - */ -extern int gg_proxy_enabled; /* wcza obsug proxy */ -extern char *gg_proxy_host; /* okrela adres serwera proxy */ -extern int gg_proxy_port; /* okrela port serwera proxy */ -extern char *gg_proxy_username; /* okrela nazw uytkownika przy autoryzacji serwera proxy */ -extern char *gg_proxy_password; /* okrela haso uytkownika przy autoryzacji serwera proxy */ -extern int gg_proxy_http_only; /* wcza obsug proxy wycznie dla usug HTTP */ - - -/* - * adres, z ktrego lemy pakiety (np czymy si z serwerem) - * uywany przy gg_connect() - */ -extern unsigned long gg_local_ip; -/* - * ------------------------------------------------------------------------- - * poniej znajduj si wewntrzne sprawy biblioteki. zwyky klient nie - * powinien ich w ogle rusza, bo i nie ma po co. wszystko mona zaatwi - * procedurami wyszego poziomu, ktrych definicje znajduj si na pocztku - * tego pliku. - * ------------------------------------------------------------------------- - */ - -#ifdef __GG_LIBGADU_HAVE_PTHREAD -int gg_resolve_pthread(int *fd, void **resolver, const char *hostname); -#elif defined _WIN32 -int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname); -#endif - -#ifdef _WIN32 -int gg_thread_socket(int thread_id, int socket); -#endif - -int gg_resolve(int *fd, int *pid, const char *hostname); - -#if defined __GNUC__ && !defined _WIN32 -char *gg_saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); -#else -char *gg_saprintf(const char *format, ...); -#endif - -char *gg_vsaprintf(const char *format, va_list ap); - -#define gg_alloc_sprintf gg_saprintf - -char *gg_get_line(char **ptr); - -int gg_connect(void *addr, int port, int async); -struct in_addr *gg_gethostbyname(const char *hostname); -char *gg_read_line(int sock, char *buf, int length); -void gg_chomp(char *line); -char *gg_urlencode(const char *str); -int gg_http_hash(const char *format, ...); -int gg_read(struct gg_session *sess, char *buf, int length); -int gg_write(struct gg_session *sess, const char *buf, int length); -void *gg_recv_packet(struct gg_session *sess); -int gg_send_packet(struct gg_session *sess, int type, ...); -unsigned int gg_login_hash(const unsigned char *password, unsigned int seed); -uint32_t gg_fix32(uint32_t x); -uint16_t gg_fix16(uint16_t x); -#define fix16 gg_fix16 -#define fix32 gg_fix32 -char *gg_proxy_auth(void); -char *gg_base64_encode(const char *buf); -char *gg_base64_decode(const char *buf); -int gg_image_queue_remove(struct gg_session *s, struct gg_image_queue *q, int freeq); - -#define GG_APPMSG_HOST "appmsg.gadu-gadu.pl" -#define GG_APPMSG_PORT 80 -#define GG_PUBDIR_HOST "pubdir.gadu-gadu.pl" -#define GG_PUBDIR_PORT 80 -#define GG_REGISTER_HOST "register.gadu-gadu.pl" -#define GG_REGISTER_PORT 80 -#define GG_REMIND_HOST "retr.gadu-gadu.pl" -#define GG_REMIND_PORT 80 - -#define GG_DEFAULT_PORT 8074 -#define GG_HTTPS_PORT 443 -#define GG_HTTP_USERAGENT "Mozilla/4.7 [en] (Win98; I)" - -#define GG_DEFAULT_CLIENT_VERSION "6, 1, 0, 158" -#define GG_DEFAULT_PROTOCOL_VERSION 0x24 -#define GG_DEFAULT_TIMEOUT 30 -#define GG_HAS_AUDIO_MASK 0x40000000 -#define GG_ERA_OMNIX_MASK 0x04000000 -#define GG_LIBGADU_VERSION "1.5.20050718" - -#define GG_DEFAULT_DCC_PORT 1550 - -struct gg_header { - uint32_t type; /* typ pakietu */ - uint32_t length; /* dugo reszty pakietu */ -} GG_PACKED; - -#define GG_WELCOME 0x0001 -#define GG_NEED_EMAIL 0x0014 - -struct gg_welcome { - uint32_t key; /* klucz szyfrowania hasa */ -} GG_PACKED; - -#define GG_LOGIN 0x000c - -struct gg_login { - uint32_t uin; /* mj numerek */ - uint32_t hash; /* hash hasa */ - uint32_t status; /* status na dzie dobry */ - uint32_t version; /* moja wersja klienta */ - uint32_t local_ip; /* mj adres ip */ - uint16_t local_port; /* port, na ktrym sucham */ -} GG_PACKED; - -#define GG_LOGIN_EXT 0x0013 - -struct gg_login_ext { - uint32_t uin; /* mj numerek */ - uint32_t hash; /* hash hasa */ - uint32_t status; /* status na dzie dobry */ - uint32_t version; /* moja wersja klienta */ - uint32_t local_ip; /* mj adres ip */ - uint16_t local_port; /* port, na ktrym sucham */ - uint32_t external_ip; /* zewntrzny adres ip */ - uint16_t external_port; /* zewntrzny port */ -} GG_PACKED; - -#define GG_LOGIN60 0x0015 - -struct gg_login60 { - uint32_t uin; /* mj numerek */ - uint32_t hash; /* hash hasa */ - uint32_t status; /* status na dzie dobry */ - uint32_t version; /* moja wersja klienta */ - uint8_t dunno1; /* 0x00 */ - uint32_t local_ip; /* mj adres ip */ - uint16_t local_port; /* port, na ktrym sucham */ - uint32_t external_ip; /* zewntrzny adres ip */ - uint16_t external_port; /* zewntrzny port */ - uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ - uint8_t dunno2; /* 0xbe */ -} GG_PACKED; - -#define GG_LOGIN_OK 0x0003 - -#define GG_LOGIN_FAILED 0x0009 - -#define GG_PUBDIR50_REQUEST 0x0014 - -#define GG_PUBDIR50_WRITE 0x01 -#define GG_PUBDIR50_READ 0x02 -#define GG_PUBDIR50_SEARCH 0x03 -#define GG_PUBDIR50_SEARCH_REQUEST GG_PUBDIR50_SEARCH -#define GG_PUBDIR50_SEARCH_REPLY 0x05 - -struct gg_pubdir50_request { - uint8_t type; /* GG_PUBDIR50_* */ - uint32_t seq; /* czas wysania zapytania */ -} GG_PACKED; - -#define GG_PUBDIR50_REPLY 0x000e - -struct gg_pubdir50_reply { - uint8_t type; /* GG_PUBDIR50_* */ - uint32_t seq; /* czas wysania zapytania */ -} GG_PACKED; - -#define GG_NEW_STATUS 0x0002 - -#define GG_STATUS_NOT_AVAIL 0x0001 /* niedostpny */ -#define GG_STATUS_NOT_AVAIL_DESCR 0x0015 /* niedostpny z opisem (4.8) */ -#define GG_STATUS_AVAIL 0x0002 /* dostpny */ -#define GG_STATUS_AVAIL_DESCR 0x0004 /* dostpny z opisem (4.9) */ -#define GG_STATUS_BUSY 0x0003 /* zajty */ -#define GG_STATUS_BUSY_DESCR 0x0005 /* zajty z opisem (4.8) */ -#define GG_STATUS_INVISIBLE 0x0014 /* niewidoczny (4.6) */ -#define GG_STATUS_INVISIBLE_DESCR 0x0016 /* niewidoczny z opisem (4.9) */ -#define GG_STATUS_BLOCKED 0x0006 /* zablokowany */ - -#define GG_STATUS_FRIENDS_MASK 0x8000 /* tylko dla znajomych (4.6) */ - -#define GG_STATUS_DESCR_MAXSIZE 70 - -/* - * makra do atwego i szybkiego sprawdzania stanu. - */ - -/* GG_S_F() tryb tylko dla znajomych */ -#define GG_S_F(x) (((x) & GG_STATUS_FRIENDS_MASK) != 0) - -/* GG_S() stan bez uwzgldnienia trybu tylko dla znajomych */ -#define GG_S(x) ((x) & ~GG_STATUS_FRIENDS_MASK) - -/* GG_S_A() dostpny */ -#define GG_S_A(x) (GG_S(x) == GG_STATUS_AVAIL || GG_S(x) == GG_STATUS_AVAIL_DESCR) - -/* GG_S_NA() niedostpny */ -#define GG_S_NA(x) (GG_S(x) == GG_STATUS_NOT_AVAIL || GG_S(x) == GG_STATUS_NOT_AVAIL_DESCR) - -/* GG_S_B() zajty */ -#define GG_S_B(x) (GG_S(x) == GG_STATUS_BUSY || GG_S(x) == GG_STATUS_BUSY_DESCR) - -/* GG_S_I() niewidoczny */ -#define GG_S_I(x) (GG_S(x) == GG_STATUS_INVISIBLE || GG_S(x) == GG_STATUS_INVISIBLE_DESCR) - -/* GG_S_D() stan opisowy */ -#define GG_S_D(x) (GG_S(x) == GG_STATUS_NOT_AVAIL_DESCR || GG_S(x) == GG_STATUS_AVAIL_DESCR || GG_S(x) == GG_STATUS_BUSY_DESCR || GG_S(x) == GG_STATUS_INVISIBLE_DESCR) - -/* GG_S_BL() blokowany lub blokujcy */ -#define GG_S_BL(x) (GG_S(x) == GG_STATUS_BLOCKED) - -struct gg_new_status { - uint32_t status; /* na jaki zmieni? */ -} GG_PACKED; - -#define GG_NOTIFY_FIRST 0x000f -#define GG_NOTIFY_LAST 0x0010 - -#define GG_NOTIFY 0x0010 - -struct gg_notify { - uint32_t uin; /* numerek danej osoby */ - uint8_t dunno1; /* rodzaj wpisu w licie */ -} GG_PACKED; - -#define GG_USER_OFFLINE 0x01 /* bdziemy niewidoczni dla uytkownika */ -#define GG_USER_NORMAL 0x03 /* zwyky uytkownik */ -#define GG_USER_BLOCKED 0x04 /* zablokowany uytkownik */ - -#define GG_LIST_EMPTY 0x0012 - -#define GG_NOTIFY_REPLY 0x000c /* tak, to samo co GG_LOGIN */ - -struct gg_notify_reply { - uint32_t uin; /* numerek */ - uint32_t status; /* status danej osoby */ - uint32_t remote_ip; /* adres ip delikwenta */ - uint16_t remote_port; /* port, na ktrym sucha klient */ - uint32_t version; /* wersja klienta */ - uint16_t dunno2; /* znowu port? */ -} GG_PACKED; - -#define GG_NOTIFY_REPLY60 0x0011 - -struct gg_notify_reply60 { - uint32_t uin; /* numerek plus flagi w MSB */ - uint8_t status; /* status danej osoby */ - uint32_t remote_ip; /* adres ip delikwenta */ - uint16_t remote_port; /* port, na ktrym sucha klient */ - uint8_t version; /* wersja klienta */ - uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ - uint8_t dunno1; /* 0x00 */ -} GG_PACKED; - -#define GG_STATUS60 0x000f - -struct gg_status60 { - uint32_t uin; /* numerek plus flagi w MSB */ - uint8_t status; /* status danej osoby */ - uint32_t remote_ip; /* adres ip delikwenta */ - uint16_t remote_port; /* port, na ktrym sucha klient */ - uint8_t version; /* wersja klienta */ - uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ - uint8_t dunno1; /* 0x00 */ -} GG_PACKED; - -#define GG_ADD_NOTIFY 0x000d -#define GG_REMOVE_NOTIFY 0x000e - -struct gg_add_remove { - uint32_t uin; /* numerek */ - uint8_t dunno1; /* bitmapa */ -} GG_PACKED; - -#define GG_STATUS 0x0002 - -struct gg_status { - uint32_t uin; /* numerek */ - uint32_t status; /* nowy stan */ -} GG_PACKED; - -#define GG_SEND_MSG 0x000b - -#define GG_CLASS_QUEUED 0x0001 -#define GG_CLASS_OFFLINE GG_CLASS_QUEUED -#define GG_CLASS_MSG 0x0004 -#define GG_CLASS_CHAT 0x0008 -#define GG_CLASS_CTCP 0x0010 -#define GG_CLASS_ACK 0x0020 -#define GG_CLASS_EXT GG_CLASS_ACK /* kompatybilno wstecz */ - -#define GG_MSG_MAXSIZE 2000 - -struct gg_send_msg { - uint32_t recipient; - uint32_t seq; - uint32_t msgclass; -} GG_PACKED; - -struct gg_msg_richtext { - uint8_t flag; - uint16_t length; -} GG_PACKED; - -struct gg_msg_richtext_format { - uint16_t position; - uint8_t font; -} GG_PACKED; - -struct gg_msg_richtext_image { - uint16_t unknown1; - uint32_t size; - uint32_t crc32; -} GG_PACKED; - -#define GG_FONT_BOLD 0x01 -#define GG_FONT_ITALIC 0x02 -#define GG_FONT_UNDERLINE 0x04 -#define GG_FONT_COLOR 0x08 -#define GG_FONT_IMAGE 0x80 - -struct gg_msg_richtext_color { - uint8_t red; - uint8_t green; - uint8_t blue; -} GG_PACKED; - -struct gg_msg_recipients { - uint8_t flag; - uint32_t count; -} GG_PACKED; - -struct gg_msg_image_request { - uint8_t flag; - uint32_t size; - uint32_t crc32; -} GG_PACKED; - -struct gg_msg_image_reply { - uint8_t flag; - uint32_t size; - uint32_t crc32; - /* char filename[]; */ - /* char image[]; */ -} GG_PACKED; - -#define GG_SEND_MSG_ACK 0x0005 - -#define GG_ACK_BLOCKED 0x0001 -#define GG_ACK_DELIVERED 0x0002 -#define GG_ACK_QUEUED 0x0003 -#define GG_ACK_MBOXFULL 0x0004 -#define GG_ACK_NOT_DELIVERED 0x0006 - -struct gg_send_msg_ack { - uint32_t status; - uint32_t recipient; - uint32_t seq; -} GG_PACKED; - -#define GG_RECV_MSG 0x000a - -struct gg_recv_msg { - uint32_t sender; - uint32_t seq; - uint32_t time; - uint32_t msgclass; -} GG_PACKED; - -#define GG_PING 0x0008 - -#define GG_PONG 0x0007 - -#define GG_DISCONNECTING 0x000b - -#define GG_USERLIST_REQUEST 0x0016 - -#define GG_USERLIST_PUT 0x00 -#define GG_USERLIST_PUT_MORE 0x01 -#define GG_USERLIST_GET 0x02 - -struct gg_userlist_request { - uint8_t type; -} GG_PACKED; - -#define GG_USERLIST_REPLY 0x0010 - -#define GG_USERLIST_PUT_REPLY 0x00 -#define GG_USERLIST_PUT_MORE_REPLY 0x02 -#define GG_USERLIST_GET_REPLY 0x06 -#define GG_USERLIST_GET_MORE_REPLY 0x04 - -struct gg_userlist_reply { - uint8_t type; -} GG_PACKED; - -/* - * pakiety, stae, struktury dla DCC - */ - -struct gg_dcc_tiny_packet { - uint8_t type; /* rodzaj pakietu */ -} GG_PACKED; - -struct gg_dcc_small_packet { - uint32_t type; /* rodzaj pakietu */ -} GG_PACKED; - -struct gg_dcc_big_packet { - uint32_t type; /* rodzaj pakietu */ - uint32_t dunno1; /* niewiadoma */ - uint32_t dunno2; /* niewiadoma */ -} GG_PACKED; - -/* - * pki co, nie znamy dokadnie protokou. nie wiemy, co czemu odpowiada. - * nazwy s niepowane i tymczasowe. - */ -#define GG_DCC_WANT_FILE 0x0003 /* peer chce plik */ -#define GG_DCC_HAVE_FILE 0x0001 /* wic mu damy */ -#define GG_DCC_HAVE_FILEINFO 0x0003 /* niech ma informacje o pliku */ -#define GG_DCC_GIMME_FILE 0x0006 /* peer jest pewny */ -#define GG_DCC_CATCH_FILE 0x0002 /* wysyamy plik */ - -#define GG_DCC_FILEATTR_READONLY 0x0020 - -#define GG_DCC_TIMEOUT_SEND 1800 /* 30 minut */ -#define GG_DCC_TIMEOUT_GET 1800 /* 30 minut */ -#define GG_DCC_TIMEOUT_FILE_ACK 300 /* 5 minut */ -#define GG_DCC_TIMEOUT_VOICE_ACK 300 /* 5 minut */ - -#ifdef __cplusplus -#ifdef _MSC_VER -#pragma pack(pop) -#endif -} -#endif - -#endif /* __GG_LIBGADU_H */ - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/obsolete.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/obsolete.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/obsolete.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/obsolete.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -/* $Id: obsolete.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -/* - * Plik zawiera deklaracje funkcji, ktre s ju nieaktualne ze wzgldu - * na zmiany w protokole, ale s wymagane przez aplikacje linkowane ze - * starszymi wersjami bibliotek. - */ - -#include - -#include "libgadu.h" - -struct gg_http *gg_userlist_get(uin_t uin, const char *passwd, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_userlist_get() is obsolete. use gg_userlist_request() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_userlist_get_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_userlist_get_free(struct gg_http *h) -{ - -} - -struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_userlist_put() is obsolete. use gg_userlist_request() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_userlist_put_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_userlist_put_free(struct gg_http *h) -{ - -} - -struct gg_http *gg_userlist_remove(uin_t uin, const char *passwd, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_userlist_remove() is obsolete. use gg_userlist_request() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_userlist_remove_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_userlist_remove_free(struct gg_http *h) -{ - -} - -struct gg_http *gg_search(const struct gg_search_request *r, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_search() is obsolete. use gg_search50() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_search_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_search_free(struct gg_http *h) -{ - -} - -const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start) -{ - return NULL; -} - -const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start) -{ - return NULL; -} - -const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start) -{ - return NULL; -} - -const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start) -{ - return NULL; -} - -void gg_search_request_free(struct gg_search_request *r) -{ - -} - -struct gg_http *gg_register(const char *email, const char *password, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_register() is obsolete. use gg_register3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_register2() is obsolete. use gg_register3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_unregister() is obsolete. use gg_unregister3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_unregister2() is obsolete. use gg_unregister3() instead!\n"); - errno = EINVAL; - return NULL; -} - - -struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_passwd() is obsolete. use gg_change_passwd4() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_passwd2() is obsolete. use gg_change_passwd4() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_passwd3() is obsolete. use gg_change_passwd4() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_remind_passwd(uin_t uin, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_remind_passwd() is obsolete. use gg_remind_passwd3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_remind_passwd2() is obsolete. use gg_remind_passwd3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_info() is obsolete. use gg_pubdir50() instead\n"); - errno = EINVAL; - return NULL; -} - -struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city) -{ - return NULL; -} - -void gg_change_info_request_free(struct gg_change_info_request *r) -{ - -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir50.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir50.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir50.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir50.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,467 +0,0 @@ -/* $Id: pubdir50.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2003 Wojtek Kaniewski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include -#include -#include -#include - -#include "libgadu.h" - -/* - * gg_pubdir50_new() - * - * tworzy now zmienn typu gg_pubdir50_t. - * - * zaalokowana zmienna lub NULL w przypadku braku pamici. - */ -gg_pubdir50_t gg_pubdir50_new(int type) -{ - gg_pubdir50_t res = malloc(sizeof(struct gg_pubdir50_s)); - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_new(%d);\n", type); - - if (!res) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_new() out of memory\n"); - return NULL; - } - - memset(res, 0, sizeof(struct gg_pubdir50_s)); - - res->type = type; - - return res; -} - -/* - * gg_pubdir50_add_n() // funkcja wewntrzna - * - * funkcja dodaje lub zastpuje istniejce pole do zapytania lub odpowiedzi. - * - * - req - wskanik opisu zapytania, - * - num - numer wyniku (0 dla zapytania), - * - field - nazwa pola, - * - value - warto pola, - * - * 0/-1 - */ -static int gg_pubdir50_add_n(gg_pubdir50_t req, int num, const char *field, const char *value) -{ - struct gg_pubdir50_entry *tmp = NULL, *entry; - char *dupfield, *dupvalue; - int i; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_add_n(%p, %d, \"%s\", \"%s\");\n", req, num, field, value); - - if (!(dupvalue = strdup(value))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); - return -1; - } - - for (i = 0; i < req->entries_count; i++) { - if (req->entries[i].num != num || strcmp(req->entries[i].field, field)) - continue; - - free(req->entries[i].value); - req->entries[i].value = dupvalue; - - return 0; - } - - if (!(dupfield = strdup(field))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); - free(dupvalue); - return -1; - } - - if (!(tmp = realloc(req->entries, sizeof(struct gg_pubdir50_entry) * (req->entries_count + 1)))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); - free(dupfield); - free(dupvalue); - return -1; - } - - req->entries = tmp; - - entry = &req->entries[req->entries_count]; - entry->num = num; - entry->field = dupfield; - entry->value = dupvalue; - - req->entries_count++; - - return 0; -} - -/* - * gg_pubdir50_add() - * - * funkcja dodaje pole do zapytania. - * - * - req - wskanik opisu zapytania, - * - field - nazwa pola, - * - value - warto pola, - * - * 0/-1 - */ -int gg_pubdir50_add(gg_pubdir50_t req, const char *field, const char *value) -{ - return gg_pubdir50_add_n(req, 0, field, value); -} - -/* - * gg_pubdir50_seq_set() - * - * ustawia numer sekwencyjny zapytania. - * - * - req - zapytanie, - * - seq - nowy numer sekwencyjny. - * - * 0/-1. - */ -int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_seq_set(%p, %d);\n", req, seq); - - if (!req) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_seq_set() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - req->seq = seq; - - return 0; -} - -/* - * gg_pubdir50_free() - * - * zwalnia pami po zapytaniu lub rezultacie szukania uytkownika. - * - * - s - zwalniana zmienna, - */ -void gg_pubdir50_free(gg_pubdir50_t s) -{ - int i; - - if (!s) - return; - - for (i = 0; i < s->entries_count; i++) { - free(s->entries[i].field); - free(s->entries[i].value); - } - - free(s->entries); - free(s); -} - -/* - * gg_pubdir50() - * - * wysya zapytanie katalogu publicznego do serwera. - * - * - sess - sesja, - * - req - zapytanie. - * - * numer sekwencyjny wyszukiwania lub 0 w przypadku bdu. - */ -uint32_t gg_pubdir50(struct gg_session *sess, gg_pubdir50_t req) -{ - int i, size = 5; - uint32_t res; - char *buf, *p; - struct gg_pubdir50_request *r; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50(%p, %p);\n", sess, req); - - if (!sess || !req) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50() invalid arguments\n"); - errno = EFAULT; - return 0; - } - - if (sess->state != GG_STATE_CONNECTED) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50() not connected\n"); - errno = ENOTCONN; - return 0; - } - - for (i = 0; i < req->entries_count; i++) { - /* wyszukiwanie bierze tylko pierwszy wpis */ - if (req->entries[i].num) - continue; - - size += strlen(req->entries[i].field) + 1; - size += strlen(req->entries[i].value) + 1; - } - - if (!(buf = malloc(size))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50() out of memory (%d bytes)\n", size); - return 0; - } - - r = (struct gg_pubdir50_request*) buf; - res = time(NULL); - r->type = req->type; - r->seq = (req->seq) ? gg_fix32(req->seq) : gg_fix32(time(NULL)); - req->seq = gg_fix32(r->seq); - - for (i = 0, p = buf + 5; i < req->entries_count; i++) { - if (req->entries[i].num) - continue; - - strcpy(p, req->entries[i].field); - p += strlen(p) + 1; - - strcpy(p, req->entries[i].value); - p += strlen(p) + 1; - } - - if (gg_send_packet(sess, GG_PUBDIR50_REQUEST, buf, size, NULL, 0) == -1) - res = 0; - - free(buf); - - return res; -} - -/* - * gg_pubdir50_handle_reply() // funkcja wewntrzna - * - * analizuje przychodzcy pakiet odpowiedzi i zapisuje wynik w struct gg_event. - * - * - e - opis zdarzenia - * - packet - zawarto pakietu odpowiedzi - * - length - dugo pakietu odpowiedzi - * - * 0/-1 - */ -int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length) -{ - const char *end = packet + length, *p; - struct gg_pubdir50_reply *r = (struct gg_pubdir50_reply*) packet; - gg_pubdir50_t res; - int num = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_handle_reply(%p, %p, %d);\n", e, packet, length); - - if (!e || !packet) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (length < 5) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() packet too short\n"); - errno = EINVAL; - return -1; - } - - if (!(res = gg_pubdir50_new(r->type))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() unable to allocate reply\n"); - return -1; - } - - e->event.pubdir50 = res; - - res->seq = gg_fix32(r->seq); - - switch (res->type) { - case GG_PUBDIR50_READ: - e->type = GG_EVENT_PUBDIR50_READ; - break; - - case GG_PUBDIR50_WRITE: - e->type = GG_EVENT_PUBDIR50_WRITE; - break; - - default: - e->type = GG_EVENT_PUBDIR50_SEARCH_REPLY; - break; - } - - /* brak wynikw? */ - if (length == 5) - return 0; - - /* pomi pocztek odpowiedzi */ - p = packet + 5; - - while (p < end) { - const char *field, *value; - - field = p; - - /* sprawd, czy nie mamy podziau na kolejne pole */ - if (!*field) { - num++; - field++; - } - - value = NULL; - - for (p = field; p < end; p++) { - /* jeli mamy koniec tekstu... */ - if (!*p) { - /* ...i jeszcze nie mielimy wartoci pola to - * wiemy, e po tym zerze jest warto... */ - if (!value) - value = p + 1; - else - /* ...w przeciwym wypadku koniec - * wartoci i moemy wychodzi - * grzecznie z ptli */ - break; - } - } - - /* sprawdmy, czy pole nie wychodzi poza pakiet, eby nie - * mie segfaultw, jeli serwer przestanie zakacza pakietw - * przez \0 */ - - if (p == end) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() premature end of packet\n"); - goto failure; - } - - p++; - - /* jeli dostalimy namier na nastpne wyniki, to znaczy e - * mamy koniec wynikw i nie jest to kolejna osoba. */ - if (!strcasecmp(field, "nextstart")) { - res->next = atoi(value); - num--; - } else { - if (gg_pubdir50_add_n(res, num, field, value) == -1) - goto failure; - } - } - - res->count = num + 1; - - return 0; - -failure: - gg_pubdir50_free(res); - return -1; -} - -/* - * gg_pubdir50_get() - * - * pobiera informacj z rezultatu wyszukiwania. - * - * - res - rezultat wyszukiwania, - * - num - numer odpowiedzi, - * - field - nazwa pola (wielko liter nie ma znaczenia). - * - * warto pola lub NULL, jeli nie znaleziono. - */ -const char *gg_pubdir50_get(gg_pubdir50_t res, int num, const char *field) -{ - char *value = NULL; - int i; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_get(%p, %d, \"%s\");\n", res, num, field); - - if (!res || num < 0 || !field) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_get() invalid arguments\n"); - errno = EINVAL; - return NULL; - } - - for (i = 0; i < res->entries_count; i++) { - if (res->entries[i].num == num && !strcasecmp(res->entries[i].field, field)) { - value = res->entries[i].value; - break; - } - } - - return value; -} - -/* - * gg_pubdir50_count() - * - * zwraca ilo wynikw danego zapytania. - * - * - res - odpowied - * - * ilo lub -1 w przypadku bdu. - */ -int gg_pubdir50_count(gg_pubdir50_t res) -{ - return (!res) ? -1 : res->count; -} - -/* - * gg_pubdir50_type() - * - * zwraca rodzaj zapytania lub odpowiedzi. - * - * - res - zapytanie lub odpowied - * - * ilo lub -1 w przypadku bdu. - */ -int gg_pubdir50_type(gg_pubdir50_t res) -{ - return (!res) ? -1 : res->type; -} - -/* - * gg_pubdir50_next() - * - * zwraca numer, od ktrego naley rozpocz kolejne wyszukiwanie, jeli - * zaley nam na kolejnych wynikach. - * - * - res - odpowied - * - * numer lub -1 w przypadku bdu. - */ -uin_t gg_pubdir50_next(gg_pubdir50_t res) -{ - return (!res) ? (unsigned) -1 : res->next; -} - -/* - * gg_pubdir50_seq() - * - * zwraca numer sekwencyjny zapytania lub odpowiedzi. - * - * - res - zapytanie lub odpowied - * - * numer lub -1 w przypadku bdu. - */ -uint32_t gg_pubdir50_seq(gg_pubdir50_t res) -{ - return (!res) ? (unsigned) -1 : res->seq; -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/lib/pubdir.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,684 +0,0 @@ -/* $Id: pubdir.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Dawid Jarosz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "libgadu.h" - -/* - * gg_register3() - * - * rozpoczyna rejestracj uytkownika protokoem GG 6.0. wymaga wczeniejszego - * pobrania tokenu za pomoc funkcji gg_token(). - * - * - email - adres e-mail klienta - * - password - haso klienta - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - async - poczenie asynchroniczne - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_register_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_register3(const char *email, const char *password, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *__pwd, *__email, *__tokenid, *__tokenval, *form, *query; - - if (!email || !password || !tokenid || !tokenval) { - gg_debug(GG_DEBUG_MISC, "=> register, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __pwd = gg_urlencode(password); - __email = gg_urlencode(email); - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - - if (!__pwd || !__email || !__tokenid || !__tokenval) { - gg_debug(GG_DEBUG_MISC, "=> register, not enough memory for form fields\n"); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - return NULL; - } - - form = gg_saprintf("pwd=%s&email=%s&tokenid=%s&tokenval=%s&code=%u", - __pwd, __email, __tokenid, __tokenval, - gg_http_hash("ss", email, password)); - - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - - if (!form) { - gg_debug(GG_DEBUG_MISC, "=> register, not enough memory for form query\n"); - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> register, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> register, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/fmregister3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> register, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_REGISTER; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_unregister3() - * - * usuwa konto uytkownika z serwera protokoem GG 6.0 - * - * - uin - numerek GG - * - password - haso klienta - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - async - poczenie asynchroniczne - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_unregister_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *__fmpwd, *__pwd, *__tokenid, *__tokenval, *form, *query; - - if (!password || !tokenid || !tokenval) { - gg_debug(GG_DEBUG_MISC, "=> unregister, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __pwd = gg_saprintf("%ld", random()); - __fmpwd = gg_urlencode(password); - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - - if (!__fmpwd || !__pwd || !__tokenid || !__tokenval) { - gg_debug(GG_DEBUG_MISC, "=> unregister, not enough memory for form fields\n"); - free(__pwd); - free(__fmpwd); - free(__tokenid); - free(__tokenval); - return NULL; - } - - form = gg_saprintf("fmnumber=%d&fmpwd=%s&delete=1&pwd=%s&email=deletedaccount@gadu-gadu.pl&tokenid=%s&tokenval=%s&code=%u", uin, __fmpwd, __pwd, __tokenid, __tokenval, gg_http_hash("ss", "deletedaccount@gadu-gadu.pl", __pwd)); - - free(__fmpwd); - free(__pwd); - free(__tokenid); - free(__tokenval); - - if (!form) { - gg_debug(GG_DEBUG_MISC, "=> unregister, not enough memory for form query\n"); - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> unregister, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> unregister, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/fmregister3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> unregister, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_UNREGISTER; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_change_passwd4() - * - * wysya danie zmiany hasa zgodnie z protokoem GG 6.0. wymaga - * wczeniejszego pobrania tokenu za pomoc funkcji gg_token(). - * - * - uin - numer - * - email - adres e-mail - * - passwd - stare haso - * - newpasswd - nowe haso - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - async - poczenie asynchroniczne - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_change_passwd_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_change_passwd4(uin_t uin, const char *email, const char *passwd, const char *newpasswd, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *form, *query, *__email, *__fmpwd, *__pwd, *__tokenid, *__tokenval; - - if (!uin || !email || !passwd || !newpasswd || !tokenid || !tokenval) { - gg_debug(GG_DEBUG_MISC, "=> change, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __fmpwd = gg_urlencode(passwd); - __pwd = gg_urlencode(newpasswd); - __email = gg_urlencode(email); - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - - if (!__fmpwd || !__pwd || !__email || !__tokenid || !__tokenval) { - gg_debug(GG_DEBUG_MISC, "=> change, not enough memory for form fields\n"); - free(__fmpwd); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - return NULL; - } - - if (!(form = gg_saprintf("fmnumber=%d&fmpwd=%s&pwd=%s&email=%s&tokenid=%s&tokenval=%s&code=%u", uin, __fmpwd, __pwd, __email, __tokenid, __tokenval, gg_http_hash("ss", email, newpasswd)))) { - gg_debug(GG_DEBUG_MISC, "=> change, not enough memory for form fields\n"); - free(__fmpwd); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - - return NULL; - } - - free(__fmpwd); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - - gg_debug(GG_DEBUG_MISC, "=> change, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> change, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/fmregister3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> change, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_PASSWD; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_remind_passwd3() - * - * wysya danie przypomnienia hasa e-mailem. - * - * - uin - numer - * - email - adres e-mail taki, jak ten zapisany na serwerze - * - async - poczenie asynchroniczne - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_remind_passwd_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_remind_passwd3(uin_t uin, const char *email, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *form, *query, *__tokenid, *__tokenval, *__email; - - if (!tokenid || !tokenval || !email) { - gg_debug(GG_DEBUG_MISC, "=> remind, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - __email = gg_urlencode(email); - - if (!__tokenid || !__tokenval || !__email) { - gg_debug(GG_DEBUG_MISC, "=> remind, not enough memory for form fields\n"); - free(__tokenid); - free(__tokenval); - free(__email); - return NULL; - } - - if (!(form = gg_saprintf("userid=%d&code=%u&tokenid=%s&tokenval=%s&email=%s", uin, gg_http_hash("u", uin), __tokenid, __tokenval, __email))) { - gg_debug(GG_DEBUG_MISC, "=> remind, not enough memory for form fields\n"); - free(__tokenid); - free(__tokenval); - free(__email); - return NULL; - } - - free(__tokenid); - free(__tokenval); - free(__email); - - gg_debug(GG_DEBUG_MISC, "=> remind, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REMIND_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> remind, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REMIND_HOST, GG_REMIND_PORT, async, "POST", "/appsvc/fmsendpwd3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> remind, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_REMIND; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_pubdir_watch_fd() - * - * przy asynchronicznych operacjach na katalogu publicznym naley wywoywa - * t funkcj przy zmianach na obserwowanym deskryptorze. - * - * - h - struktura opisujca poczenie - * - * jeli wszystko poszo dobrze to 0, inaczej -1. operacja bdzie - * zakoczona, jeli h->state == GG_STATE_DONE. jeli wystpi jaki - * bd, to bdzie tam GG_STATE_ERROR i odpowiedni kod bdu w h->error. - */ -int gg_pubdir_watch_fd(struct gg_http *h) -{ - struct gg_pubdir *p; - char *tmp; - - if (!h) { - errno = EFAULT; - return -1; - } - - if (h->state == GG_STATE_ERROR) { - gg_debug(GG_DEBUG_MISC, "=> pubdir, watch_fd issued on failed session\n"); - errno = EINVAL; - return -1; - } - - if (h->state != GG_STATE_PARSING) { - if (gg_http_watch_fd(h) == -1) { - gg_debug(GG_DEBUG_MISC, "=> pubdir, http failure\n"); - errno = EINVAL; - return -1; - } - } - - if (h->state != GG_STATE_PARSING) - return 0; - - h->state = GG_STATE_DONE; - - if (!(h->data = p = malloc(sizeof(struct gg_pubdir)))) { - gg_debug(GG_DEBUG_MISC, "=> pubdir, not enough memory for results\n"); - return -1; - } - - p->success = 0; - p->uin = 0; - - gg_debug(GG_DEBUG_MISC, "=> pubdir, let's parse \"%s\"\n", h->body); - - if ((tmp = strstr(h->body, "success")) || (tmp = strstr(h->body, "results"))) { - p->success = 1; - if (tmp[7] == ':') - p->uin = strtol(tmp + 8, NULL, 0); - gg_debug(GG_DEBUG_MISC, "=> pubdir, success (uin=%d)\n", p->uin); - } else - gg_debug(GG_DEBUG_MISC, "=> pubdir, error.\n"); - - return 0; -} - -/* - * gg_pubdir_free() - * - * zwalnia pami po efektach operacji na katalogu publicznym. - * - * - h - zwalniana struktura - */ -void gg_pubdir_free(struct gg_http *h) -{ - if (!h) - return; - - free(h->data); - gg_http_free(h); -} - -/* - * gg_token() - * - * pobiera z serwera token do autoryzacji zakadania konta, usuwania - * konta i zmiany hasa. - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_token_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_token(int async) -{ - struct gg_http *h; - const char *query; - - query = "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: 0\r\n" - "Pragma: no-cache\r\n" - "\r\n"; - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/regtoken.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> token, gg_http_connect() failed mysteriously\n"); - return NULL; - } - - h->type = GG_SESSION_TOKEN; - - h->callback = gg_token_watch_fd; - h->destroy = gg_token_free; - - if (!async) - gg_token_watch_fd(h); - - return h; -} - -/* - * gg_token_watch_fd() - * - * przy asynchronicznych operacjach zwizanych z tokenem naley wywoywa - * t funkcj przy zmianach na obserwowanym deskryptorze. - * - * - h - struktura opisujca poczenie - * - * jeli wszystko poszo dobrze to 0, inaczej -1. operacja bdzie - * zakoczona, jeli h->state == GG_STATE_DONE. jeli wystpi jaki - * bd, to bdzie tam GG_STATE_ERROR i odpowiedni kod bdu w h->error. - */ -int gg_token_watch_fd(struct gg_http *h) -{ - if (!h) { - errno = EFAULT; - return -1; - } - - if (h->state == GG_STATE_ERROR) { - gg_debug(GG_DEBUG_MISC, "=> token, watch_fd issued on failed session\n"); - errno = EINVAL; - return -1; - } - - if (h->state != GG_STATE_PARSING) { - if (gg_http_watch_fd(h) == -1) { - gg_debug(GG_DEBUG_MISC, "=> token, http failure\n"); - errno = EINVAL; - return -1; - } - } - - if (h->state != GG_STATE_PARSING) - return 0; - - /* jeli h->data jest puste, to cigalimy tokenid i url do niego, - * ale jeli co tam jest, to znaczy, e mamy drugi etap polegajcy - * na pobieraniu tokenu. */ - if (!h->data) { - int width, height, length; - char *url = NULL, *tokenid = NULL, *path, *headers; - const char *host; - struct gg_http *h2; - struct gg_token *t; - - gg_debug(GG_DEBUG_MISC, "=> token body \"%s\"\n", h->body); - - if (h->body && (!(url = malloc(strlen(h->body))) || !(tokenid = malloc(strlen(h->body))))) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for results\n"); - free(url); - return -1; - } - - if (!h->body || sscanf(h->body, "%d %d %d\r\n%s\r\n%s", &width, &height, &length, tokenid, url) != 5) { - gg_debug(GG_DEBUG_MISC, "=> token, parsing failed\n"); - free(url); - free(tokenid); - errno = EINVAL; - return -1; - } - - /* dostalimy tokenid i wszystkie niezbdne informacje, - * wic pobierzmy obrazek z tokenem */ - - if (strncmp(url, "http://", 7)) { - path = gg_saprintf("%s?tokenid=%s", url, tokenid); - host = GG_REGISTER_HOST; - } else { - char *slash = strchr(url + 7, '/'); - - if (slash) { - path = gg_saprintf("%s?tokenid=%s", slash, tokenid); - *slash = 0; - host = url + 7; - } else { - gg_debug(GG_DEBUG_MISC, "=> token, url parsing failed\n"); - free(url); - free(tokenid); - errno = EINVAL; - return -1; - } - } - - if (!path) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token url\n"); - free(url); - free(tokenid); - return -1; - } - - if (!(headers = gg_saprintf("Host: %s\r\nUser-Agent: " GG_HTTP_USERAGENT "\r\n\r\n", host))) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token url\n"); - free(path); - free(url); - free(tokenid); - return -1; - } - - if (!(h2 = gg_http_connect(host, GG_REGISTER_PORT, h->async, "GET", path, headers))) { - gg_debug(GG_DEBUG_MISC, "=> token, gg_http_connect() failed mysteriously\n"); - free(headers); - free(url); - free(path); - free(tokenid); - return -1; - } - - free(headers); - free(path); - free(url); - - memcpy(h, h2, sizeof(struct gg_http)); - free(h2); - - h->type = GG_SESSION_TOKEN; - - h->callback = gg_token_watch_fd; - h->destroy = gg_token_free; - - if (!h->async) - gg_token_watch_fd(h); - - if (!(h->data = t = malloc(sizeof(struct gg_token)))) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token data\n"); - free(tokenid); - return -1; - } - - t->width = width; - t->height = height; - t->length = length; - t->tokenid = tokenid; - } else { - /* obrazek mamy w h->body */ - h->state = GG_STATE_DONE; - } - - return 0; -} - -/* - * gg_token_free() - * - * zwalnia pami po efektach pobierania tokenu. - * - * - h - zwalniana struktura - */ -void gg_token_free(struct gg_http *h) -{ - struct gg_token *t; - - if (!h) - return; - - if ((t = h->data)) - free(t->tokenid); - - free(h->data); - gg_http_free(h); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - lib/common.c \ - lib/compat.h \ - lib/COPYING \ - lib/dcc.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/libgadu-config.h \ - lib/libgadu.h \ - lib/obsolete.c \ - lib/pubdir50.c \ - lib/pubdir.c - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -if USE_INTERNAL_LIBGADU -INTGGSOURCES = \ - lib/common.c \ - lib/compat.h \ - lib/dcc.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/libgadu-config.h \ - lib/libgadu.h \ - lib/obsolete.c \ - lib/pubdir50.c \ - lib/pubdir.c - -INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib -endif - -GGSOURCES = \ - $(INTGGSOURCES) \ - gg-utils.h \ - gg-utils.c \ - confer.h \ - confer.c \ - search.h \ - search.c \ - buddylist.h \ - buddylist.c \ - gg.h \ - gg.c - -AM_CFLAGS = $(st) - -libgg_la_LDFLAGS = -module -avoid-version - -if STATIC_GG - -st = -DPURPLE_STATIC_PRPL $(GADU_CFLAGS) -noinst_LTLIBRARIES = libgg.la -libgg_la_SOURCES = $(GGSOURCES) -libgg_la_CFLAGS = $(AM_CFLAGS) -libgg_la_LIBADD = $(GADU_LIBS) - -else - -st = $(GADU_CFLAGS) -pkg_LTLIBRARIES = libgg.la -libgg_la_SOURCES = $(GGSOURCES) -libgg_la_LIBADD = $(GLIB_LIBS) $(GADU_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(INTGG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,887 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/gg -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_GG_FALSE@libgg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@STATIC_GG_FALSE@ $(am__DEPENDENCIES_1) -@STATIC_GG_TRUE@libgg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libgg_la_SOURCES_DIST = lib/common.c lib/compat.h lib/dcc.c \ - lib/events.c lib/http.c lib/libgadu.c lib/libgadu-config.h \ - lib/libgadu.h lib/obsolete.c lib/pubdir50.c lib/pubdir.c \ - gg-utils.h gg-utils.c confer.h confer.c search.h search.c \ - buddylist.h buddylist.c gg.h gg.c -@USE_INTERNAL_LIBGADU_TRUE@am__objects_1 = libgg_la-common.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-dcc.lo libgg_la-events.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-http.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-libgadu.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-obsolete.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-pubdir50.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-pubdir.lo -am__objects_2 = $(am__objects_1) libgg_la-gg-utils.lo \ - libgg_la-confer.lo libgg_la-search.lo libgg_la-buddylist.lo \ - libgg_la-gg.lo -@STATIC_GG_FALSE@am_libgg_la_OBJECTS = $(am__objects_2) -@STATIC_GG_TRUE@am_libgg_la_OBJECTS = $(am__objects_2) -libgg_la_OBJECTS = $(am_libgg_la_OBJECTS) -@STATIC_GG_FALSE@am_libgg_la_rpath = -rpath $(pkgdir) -@STATIC_GG_TRUE@am_libgg_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libgg_la_SOURCES) -DIST_SOURCES = $(am__libgg_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - lib/common.c \ - lib/compat.h \ - lib/COPYING \ - lib/dcc.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/libgadu-config.h \ - lib/libgadu.h \ - lib/obsolete.c \ - lib/pubdir50.c \ - lib/pubdir.c - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -@USE_INTERNAL_LIBGADU_TRUE@INTGGSOURCES = \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/common.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/compat.h \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/dcc.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/events.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/http.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/libgadu.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/libgadu-config.h \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/libgadu.h \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/obsolete.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/pubdir50.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/pubdir.c - -@USE_INTERNAL_LIBGADU_TRUE@INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib -GGSOURCES = \ - $(INTGGSOURCES) \ - gg-utils.h \ - gg-utils.c \ - confer.h \ - confer.c \ - search.h \ - search.c \ - buddylist.h \ - buddylist.c \ - gg.h \ - gg.c - -AM_CFLAGS = $(st) -libgg_la_LDFLAGS = -module -avoid-version -@STATIC_GG_FALSE@st = $(GADU_CFLAGS) -@STATIC_GG_TRUE@st = -DPURPLE_STATIC_PRPL $(GADU_CFLAGS) -@STATIC_GG_TRUE@noinst_LTLIBRARIES = libgg.la -@STATIC_GG_FALSE@libgg_la_SOURCES = $(GGSOURCES) -@STATIC_GG_TRUE@libgg_la_SOURCES = $(GGSOURCES) -@STATIC_GG_TRUE@libgg_la_CFLAGS = $(AM_CFLAGS) -@STATIC_GG_FALSE@libgg_la_LIBADD = $(GLIB_LIBS) $(GADU_LIBS) -@STATIC_GG_TRUE@libgg_la_LIBADD = $(GADU_LIBS) -@STATIC_GG_FALSE@pkg_LTLIBRARIES = libgg.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(INTGG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/gg/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/gg/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libgg.la: $(libgg_la_OBJECTS) $(libgg_la_DEPENDENCIES) - $(LINK) $(am_libgg_la_rpath) $(libgg_la_LDFLAGS) $(libgg_la_OBJECTS) $(libgg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-buddylist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-confer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-dcc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-events.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-gg-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-gg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-http.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-libgadu.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-obsolete.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-pubdir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-pubdir50.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-search.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libgg_la-common.lo: lib/common.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-common.lo -MD -MP -MF "$(DEPDIR)/libgg_la-common.Tpo" -c -o libgg_la-common.lo `test -f 'lib/common.c' || echo '$(srcdir)/'`lib/common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-common.Tpo" "$(DEPDIR)/libgg_la-common.Plo"; else rm -f "$(DEPDIR)/libgg_la-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/common.c' object='libgg_la-common.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-common.lo `test -f 'lib/common.c' || echo '$(srcdir)/'`lib/common.c - -libgg_la-dcc.lo: lib/dcc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-dcc.lo -MD -MP -MF "$(DEPDIR)/libgg_la-dcc.Tpo" -c -o libgg_la-dcc.lo `test -f 'lib/dcc.c' || echo '$(srcdir)/'`lib/dcc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-dcc.Tpo" "$(DEPDIR)/libgg_la-dcc.Plo"; else rm -f "$(DEPDIR)/libgg_la-dcc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/dcc.c' object='libgg_la-dcc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-dcc.lo `test -f 'lib/dcc.c' || echo '$(srcdir)/'`lib/dcc.c - -libgg_la-events.lo: lib/events.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-events.lo -MD -MP -MF "$(DEPDIR)/libgg_la-events.Tpo" -c -o libgg_la-events.lo `test -f 'lib/events.c' || echo '$(srcdir)/'`lib/events.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-events.Tpo" "$(DEPDIR)/libgg_la-events.Plo"; else rm -f "$(DEPDIR)/libgg_la-events.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/events.c' object='libgg_la-events.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-events.lo `test -f 'lib/events.c' || echo '$(srcdir)/'`lib/events.c - -libgg_la-http.lo: lib/http.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-http.lo -MD -MP -MF "$(DEPDIR)/libgg_la-http.Tpo" -c -o libgg_la-http.lo `test -f 'lib/http.c' || echo '$(srcdir)/'`lib/http.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-http.Tpo" "$(DEPDIR)/libgg_la-http.Plo"; else rm -f "$(DEPDIR)/libgg_la-http.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/http.c' object='libgg_la-http.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-http.lo `test -f 'lib/http.c' || echo '$(srcdir)/'`lib/http.c - -libgg_la-libgadu.lo: lib/libgadu.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-libgadu.lo -MD -MP -MF "$(DEPDIR)/libgg_la-libgadu.Tpo" -c -o libgg_la-libgadu.lo `test -f 'lib/libgadu.c' || echo '$(srcdir)/'`lib/libgadu.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-libgadu.Tpo" "$(DEPDIR)/libgg_la-libgadu.Plo"; else rm -f "$(DEPDIR)/libgg_la-libgadu.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/libgadu.c' object='libgg_la-libgadu.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-libgadu.lo `test -f 'lib/libgadu.c' || echo '$(srcdir)/'`lib/libgadu.c - -libgg_la-obsolete.lo: lib/obsolete.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-obsolete.lo -MD -MP -MF "$(DEPDIR)/libgg_la-obsolete.Tpo" -c -o libgg_la-obsolete.lo `test -f 'lib/obsolete.c' || echo '$(srcdir)/'`lib/obsolete.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-obsolete.Tpo" "$(DEPDIR)/libgg_la-obsolete.Plo"; else rm -f "$(DEPDIR)/libgg_la-obsolete.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/obsolete.c' object='libgg_la-obsolete.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-obsolete.lo `test -f 'lib/obsolete.c' || echo '$(srcdir)/'`lib/obsolete.c - -libgg_la-pubdir50.lo: lib/pubdir50.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-pubdir50.lo -MD -MP -MF "$(DEPDIR)/libgg_la-pubdir50.Tpo" -c -o libgg_la-pubdir50.lo `test -f 'lib/pubdir50.c' || echo '$(srcdir)/'`lib/pubdir50.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-pubdir50.Tpo" "$(DEPDIR)/libgg_la-pubdir50.Plo"; else rm -f "$(DEPDIR)/libgg_la-pubdir50.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/pubdir50.c' object='libgg_la-pubdir50.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-pubdir50.lo `test -f 'lib/pubdir50.c' || echo '$(srcdir)/'`lib/pubdir50.c - -libgg_la-pubdir.lo: lib/pubdir.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-pubdir.lo -MD -MP -MF "$(DEPDIR)/libgg_la-pubdir.Tpo" -c -o libgg_la-pubdir.lo `test -f 'lib/pubdir.c' || echo '$(srcdir)/'`lib/pubdir.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-pubdir.Tpo" "$(DEPDIR)/libgg_la-pubdir.Plo"; else rm -f "$(DEPDIR)/libgg_la-pubdir.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/pubdir.c' object='libgg_la-pubdir.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-pubdir.lo `test -f 'lib/pubdir.c' || echo '$(srcdir)/'`lib/pubdir.c - -libgg_la-gg-utils.lo: gg-utils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-gg-utils.lo -MD -MP -MF "$(DEPDIR)/libgg_la-gg-utils.Tpo" -c -o libgg_la-gg-utils.lo `test -f 'gg-utils.c' || echo '$(srcdir)/'`gg-utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-gg-utils.Tpo" "$(DEPDIR)/libgg_la-gg-utils.Plo"; else rm -f "$(DEPDIR)/libgg_la-gg-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gg-utils.c' object='libgg_la-gg-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-gg-utils.lo `test -f 'gg-utils.c' || echo '$(srcdir)/'`gg-utils.c - -libgg_la-confer.lo: confer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-confer.lo -MD -MP -MF "$(DEPDIR)/libgg_la-confer.Tpo" -c -o libgg_la-confer.lo `test -f 'confer.c' || echo '$(srcdir)/'`confer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-confer.Tpo" "$(DEPDIR)/libgg_la-confer.Plo"; else rm -f "$(DEPDIR)/libgg_la-confer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='confer.c' object='libgg_la-confer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-confer.lo `test -f 'confer.c' || echo '$(srcdir)/'`confer.c - -libgg_la-search.lo: search.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-search.lo -MD -MP -MF "$(DEPDIR)/libgg_la-search.Tpo" -c -o libgg_la-search.lo `test -f 'search.c' || echo '$(srcdir)/'`search.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-search.Tpo" "$(DEPDIR)/libgg_la-search.Plo"; else rm -f "$(DEPDIR)/libgg_la-search.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='search.c' object='libgg_la-search.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-search.lo `test -f 'search.c' || echo '$(srcdir)/'`search.c - -libgg_la-buddylist.lo: buddylist.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-buddylist.lo -MD -MP -MF "$(DEPDIR)/libgg_la-buddylist.Tpo" -c -o libgg_la-buddylist.lo `test -f 'buddylist.c' || echo '$(srcdir)/'`buddylist.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-buddylist.Tpo" "$(DEPDIR)/libgg_la-buddylist.Plo"; else rm -f "$(DEPDIR)/libgg_la-buddylist.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddylist.c' object='libgg_la-buddylist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-buddylist.lo `test -f 'buddylist.c' || echo '$(srcdir)/'`buddylist.c - -libgg_la-gg.lo: gg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-gg.lo -MD -MP -MF "$(DEPDIR)/libgg_la-gg.Tpo" -c -o libgg_la-gg.lo `test -f 'gg.c' || echo '$(srcdir)/'`gg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-gg.Tpo" "$(DEPDIR)/libgg_la-gg.Plo"; else rm -f "$(DEPDIR)/libgg_la-gg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gg.c' object='libgg_la-gg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-gg.lo `test -f 'gg.c' || echo '$(srcdir)/'`gg.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/lib - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libgg -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libgg -CFLAGS += -include win32dep.h -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I./lib \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -## -## SOURCES, OBJECTS -## -C_SRC = \ - lib/common.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/obsolete.c \ - lib/pubdir.c \ - lib/pubdir50.c \ - buddylist.c \ - confer.c \ - gg.c \ - search.c \ - gg-utils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lpurple \ - -lws2_32 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,217 +0,0 @@ -/** - * @file search.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include - -#include "gg-utils.h" -#include "search.h" - - -/* GGPSearchForm *ggp_search_form_new() {{{ */ -GGPSearchForm *ggp_search_form_new(GGPSearchType st) -{ - GGPSearchForm *form; - - form = g_new0(GGPSearchForm, 1); - - form->search_type = st; - form->window = NULL; - form->user_data = NULL; - form->seq = 0; - - form->uin = NULL; - form->lastname = NULL; - form->firstname = NULL; - form->nickname = NULL; - form->city = NULL; - form->birthyear = NULL; - form->gender = NULL; - form->active = NULL; - form->offset = NULL; - form->last_uin = NULL; - - return form; -} -/* }}} */ - -/* void ggp_search_form_destroy(GGPSearchForm *form) {{{ */ -void ggp_search_form_destroy(GGPSearchForm *form) -{ - g_return_if_fail(form != NULL); - - form->window = NULL; - form->user_data = NULL; - form->seq = 0; - - g_free(form->uin); - g_free(form->lastname); - g_free(form->firstname); - g_free(form->nickname); - g_free(form->city); - g_free(form->birthyear); - g_free(form->gender); - g_free(form->active); - g_free(form->offset); - g_free(form->last_uin); - g_free(form); -} -/* }}} */ - -/* void ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form) {{{ */ -void ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form) -{ - guint32 *tmp; - - g_return_if_fail(searches != NULL); - g_return_if_fail(form != NULL); - - tmp = g_new0(guint32, 1); - *tmp = seq; - form->seq = seq; - - g_hash_table_insert(searches, tmp, form); -} -/* }}} */ - -/* void ggp_search_remove(GGPSearches *searches, guint32 seq) {{{ */ -void ggp_search_remove(GGPSearches *searches, guint32 seq) -{ - g_return_if_fail(searches != NULL); - - g_hash_table_remove(searches, &seq); -} -/* }}} */ - -/* GGPSearchForm *ggp_search_get(GGPSearches *searches, seq) {{{ */ -GGPSearchForm *ggp_search_get(GGPSearches *searches, guint32 seq) -{ - g_return_val_if_fail(searches != NULL, NULL); - - return g_hash_table_lookup(searches, &seq); -} -/* }}} */ - -/* GGPSearches *ggp_search_new() {{{ */ -GGPSearches *ggp_search_new(void) -{ - GGPSearches *searches; - - searches = g_hash_table_new_full(g_int_hash, g_int_equal, - g_free, NULL); - - return searches; -} -/* }}} */ - -/* void ggp_search_destroy(GGPSearches *searches) {{{ */ -void ggp_search_destroy(GGPSearches *searches) -{ - g_return_if_fail(searches != NULL); - - g_hash_table_destroy(searches); -} -/* }}} */ - -/* guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) {{{ */ -guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) -{ - GGPInfo *info = gc->proto_data; - gg_pubdir50_t req; - guint seq; - - purple_debug_info("gg", "It's time to perform a search...\n"); - - if ((req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)) == NULL) { - purple_debug_error("gg", - "ggp_bmenu_show_details: Unable to create req variable.\n"); - return 0; - } - - if (form->uin != NULL) { - purple_debug_info("gg", " uin: %s\n", form->uin); - gg_pubdir50_add(req, GG_PUBDIR50_UIN, form->uin); - } else { - if (form->lastname != NULL) { - purple_debug_info("gg", " lastname: %s\n", form->lastname); - gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, form->lastname); - } - - if (form->firstname != NULL) { - purple_debug_info("gg", " firstname: %s\n", form->firstname); - gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, form->firstname); - } - - if (form->nickname != NULL) { - purple_debug_info("gg", " nickname: %s\n", form->nickname); - gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, form->nickname); - } - - if (form->city != NULL) { - purple_debug_info("gg", " city: %s\n", form->city); - gg_pubdir50_add(req, GG_PUBDIR50_CITY, form->city); - } - - if (form->birthyear != NULL) { - purple_debug_info("gg", " birthyear: %s\n", form->birthyear); - gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, form->birthyear); - } - - if (form->gender != NULL) { - purple_debug_info("gg", " gender: %s\n", form->gender); - gg_pubdir50_add(req, GG_PUBDIR50_GENDER, form->gender); - } - - if (form->active != NULL) { - purple_debug_info("gg", " active: %s\n", form->active); - gg_pubdir50_add(req, GG_PUBDIR50_ACTIVE, form->active); - } - } - - purple_debug_info("gg", "offset: %s\n", form->offset); - gg_pubdir50_add(req, GG_PUBDIR50_START, g_strdup(form->offset)); - - if ((seq = gg_pubdir50(info->session, req)) == 0) { - purple_debug_warning("gg", "ggp_bmenu_show_details: Search failed.\n"); - return 0; - } - - purple_debug_info("gg", "search sequence number: %d\n", seq); - gg_pubdir50_free(req); - - return seq; -} -/* }}} */ - -/* char *ggp_search_get_result(gg_pubdir50_t res, int num, const char *field) {{{ */ -char *ggp_search_get_result(gg_pubdir50_t res, int num, const char *field) -{ - char *tmp; - - tmp = charset_convert(gg_pubdir50_get(res, num, field), "CP1250", "UTF-8"); - - return (tmp == NULL) ? g_strdup("") : tmp; -} -/* }}} */ - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/gg/search.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,153 +0,0 @@ -/** - * @file search.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_SEARCH_H -#define _PURPLE_GG_SEARCH_H - -#include "connection.h" - -#include -#include "gg.h" - - -typedef enum { - GGP_SEARCH_TYPE_INFO, - GGP_SEARCH_TYPE_FULL - -} GGPSearchType; - -typedef struct { - - char *uin; - char *lastname; - char *firstname; - char *nickname; - char *city; - char *birthyear; - char *gender; - char *active; - char *offset; - - char *last_uin; - - GGPSearchType search_type; - guint32 seq; - - void *user_data; - void *window; -} GGPSearchForm; - -typedef GHashTable GGPSearches; - - -/** - * Create a new GGPSearchForm structure, and set the fields - * to the sane defaults. - * - * @return Newly allocated GGPSearchForm. - */ -GGPSearchForm * -ggp_search_form_new(GGPSearchType st); - -/** - * Destroy a Search Form. - * - * @param form Search Form to destroy. - */ -void -ggp_search_form_destroy(GGPSearchForm *form); - -/** - * Add a search to the list of searches. - * - * @param searches The list of searches. - * @param seq Search (form) ID number. - * @param form The search form to add. - */ -void -ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form); - -/** - * Remove a search from the list. - * - * If you want to destory the search completely also call: - * ggp_search_form_destroy(). - * - * @param searches The list of searches. - * @param seq ID number of the search. - */ -void -ggp_search_remove(GGPSearches *searches, guint32 seq); - -/** - * Return the search with the specified ID. - * - * @param searches The list of searches. - * @param seq ID number of the search. - */ -GGPSearchForm * -ggp_search_get(GGPSearches *searches, guint32 seq); - -/** - * Create a new GGPSearches structure. - * - * @return GGPSearches instance. - */ -GGPSearches * -ggp_search_new(void); - -/** - * Destroy GGPSearches instance. - * - * @param searches GGPSearches instance. - */ -void -ggp_search_destroy(GGPSearches *searches); - -/** - * Initiate a search in the public directory. - * - * @param gc PurpleConnection. - * @param form Filled in GGPSearchForm. - * - * @return Sequence number of a search or 0 if an error occurred. - */ -guint32 -ggp_search_start(PurpleConnection *gc, GGPSearchForm *form); - -/* - * Return converted to the UTF-8 value of the specified field. - * - * @param res Public directory look-up result. - * @param num Id of the record. - * @param fileld Name of the field. - * - * @return UTF-8 encoded value of the field. - */ -char * -ggp_search_get_result(gg_pubdir50_t res, int num, const char *field); - - -#endif /* _PURPLE_GG_SEARCH_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/cmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/cmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/cmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/cmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,642 +0,0 @@ -/** - * @file cmds.c - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "util.h" - -#include "irc.h" - - -static void irc_do_mode(struct irc_conn *irc, const char *target, const char *sign, char **ops); - -int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, target, irc->account); - char *buf; - - if (!convo) - return 1; - - buf = g_strdup_printf(_("Unknown command: %s"), cmd); - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_IM) - purple_conv_im_write(PURPLE_CONV_IM(convo), "", buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - return 1; -} - -int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf, *message; - - if (args[0] && strcmp(cmd, "back")) { - message = purple_markup_strip_html(args[0]); - purple_util_chrreplace(message, '\n', ' '); - buf = irc_format(irc, "v:", "AWAY", message); - g_free(message); - } else { - buf = irc_format(irc, "v", "AWAY"); - } - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_ctcp(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - /* we have defined args as args[0] is target and args[1] is ctcp command */ - char *buf; - GString *string; - - /* check if we have args */ - if (!args || !args[0] || !args[1]) - return 0; - - /* TODO:strip newlines or send each line as separate ctcp or something - * actually, this shouldn't be done here but somewhere else since irc should support escaping newlines */ - - string = g_string_new(args[1]); - g_string_prepend_c (string,'\001'); - g_string_append_c (string,'\001'); - buf = irc_format(irc, "vn:", "PRIVMSG", args[0], string->str); - g_string_free(string,TRUE); - - irc_send(irc, buf); - g_free(buf); - - return 1; -} - -int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *action, *escaped, *dst, **newargs; - const char *src; - PurpleConversation *convo; - - if (!args || !args[0] || !gc) - return 0; - - action = g_malloc(strlen(args[0]) + 10); - - sprintf(action, "\001ACTION "); - - src = args[0]; - dst = action + 8; - while (*src) { - if (*src == '\n') { - if (*(src + 1) == '\0') { - break; - } else { - *dst++ = ' '; - src++; - continue; - } - } - *dst++ = *src++; - } - *dst++ = '\001'; - *dst = '\0'; - - newargs = g_new0(char *, 2); - newargs[0] = g_strdup(target); - newargs[1] = action; - irc_cmd_privmsg(irc, cmd, target, (const char **)newargs); - g_free(newargs[0]); - g_free(newargs[1]); - g_free(newargs); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, target, irc->account); - if (convo) { - escaped = g_markup_escape_text(args[0], -1); - action = g_strdup_printf("/me %s", escaped); - g_free(escaped); - if (action[strlen(action) - 1] == '\n') - action[strlen(action) - 1] = '\0'; - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - purple_connection_get_display_name(gc), - PURPLE_MESSAGE_SEND, action, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - action, PURPLE_MESSAGE_SEND, time(NULL)); - g_free(action); - } - - return 1; -} - -int irc_cmd_ctcp_version(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "vn:", "PRIVMSG", args[0], "\001VERSION\001"); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0] || !(args[1] || target)) - return 0; - - buf = irc_format(irc, "vnc", "INVITE", args[0], args[1] ? args[1] : target); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (args[1]) - buf = irc_format(irc, "vcv", "JOIN", args[0], args[1]); - else - buf = irc_format(irc, "vc", "JOIN", args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - PurpleConversation *convo; - - if (!args || !args[0]) - return 0; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, target, irc->account); - if (!convo) - return 0; - - if (args[1]) - buf = irc_format(irc, "vcn:", "KICK", target, args[0], args[1]); - else - buf = irc_format(irc, "vcn", "KICK", target, args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - purple_roomlist_show_with_account(irc->account); - - return 0; -} - -int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConnection *gc; - char *buf; - - if (!args) - return 0; - - if (!strcmp(cmd, "mode")) { - if (!args[0] && irc_ischannel(target)) - buf = irc_format(irc, "vc", "MODE", target); - else if (args[0] && (*args[0] == '+' || *args[0] == '-')) - buf = irc_format(irc, "vcv", "MODE", target, args[0]); - else if (args[0]) - buf = irc_format(irc, "vv", "MODE", args[0]); - else - return 0; - } else if (!strcmp(cmd, "umode")) { - if (!args[0]) - return 0; - gc = purple_account_get_connection(irc->account); - buf = irc_format(irc, "vnv", "MODE", purple_connection_get_display_name(gc), args[0]); - } else { - return 0; - } - - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || (!args[0] && !irc_ischannel(target))) - return 0; - - buf = irc_format(irc, "vc", "NAMES", args[0] ? args[0] : target); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "v:", "NICK", args[0]); - g_free(irc->reqnick); - irc->reqnick = g_strdup(args[0]); - irc->nickused = FALSE; - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char **nicks, **ops, *sign, *mode; - int i = 0, used = 0; - - if (!args || !args[0] || !*args[0]) - return 0; - - if (!strcmp(cmd, "op")) { - sign = "+"; - mode = "o"; - } else if (!strcmp(cmd, "deop")) { - sign = "-"; - mode = "o"; - } else if (!strcmp(cmd, "voice")) { - sign = "+"; - mode = "v"; - } else if (!strcmp(cmd, "devoice")) { - sign = "-"; - mode = "v"; - } else { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid 'op' command '%s'\n", cmd); - return 0; - } - - nicks = g_strsplit(args[0], " ", -1); - - for (i = 0; nicks[i]; i++) - /* nothing */; - ops = g_new0(char *, i * 2 + 1); - - for (i = 0; nicks[i]; i++) { - if (*nicks[i]) { - ops[used++] = mode; - ops[used++] = nicks[i]; - } - } - - irc_do_mode(irc, target, sign, ops); - g_free(ops); - g_strfreev(nicks); - - return 0; -} - -int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args) - return 0; - - if (args[1]) - buf = irc_format(irc, "vc:", "PART", args[0] ? args[0] : target, args[1]); - else - buf = irc_format(irc, "vc", "PART", args[0] ? args[0] : target); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *stamp; - char *buf; - - if (args && args[0]) { - if (irc_ischannel(args[0])) - return 0; - stamp = g_strdup_printf("\001PING %lu\001", time(NULL)); - buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp); - g_free(stamp); - } else if (target) { - stamp = g_strdup_printf("%s %lu", target, time(NULL)); - buf = irc_format(irc, "v:", "PING", stamp); - g_free(stamp); - } else { - stamp = g_strdup_printf("%lu", time(NULL)); - buf = irc_format(irc, "vv", "PING", stamp); - g_free(stamp); - } - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - const char *cur, *end; - char *msg, *buf; - - if (!args || !args[0] || !args[1]) - return 0; - - cur = args[1]; - end = args[1]; - while (*end && *cur) { - end = strchr(cur, '\n'); - if (!end) - end = cur + strlen(cur); - msg = g_strndup(cur, end - cur); - - if(!strcmp(cmd, "notice")) - buf = irc_format(irc, "vt:", "NOTICE", args[0], msg); - else - buf = irc_format(irc, "vt:", "PRIVMSG", args[0], msg); - - irc_send(irc, buf); - g_free(msg); - g_free(buf); - cur = end + 1; - } - - return 0; -} - -int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!irc->quitting) { - /* - * Use purple_account_get_string(irc->account, "quitmsg", IRC_DEFAULT_QUIT) - * and uncomment the appropriate account preference in irc.c if we - * decide we want custom quit messages. - */ - buf = irc_format(irc, "v:", "QUIT", (args && args[0]) ? args[0] : IRC_DEFAULT_QUIT); - irc_send(irc, buf); - g_free(buf); - - irc->quitting = TRUE; - - if (!irc->account->disconnecting) - purple_account_set_status(irc->account, "offline", TRUE, NULL); - } - - return 0; -} - -int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "v", args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConversation *convo; - PurpleConnection *gc; - - if (!args || !args[0]) - return 0; - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, irc->account, args[0]); - purple_conversation_present(convo); - - if (args[1]) { - gc = purple_account_get_connection(irc->account); - irc_cmd_privmsg(irc, cmd, target, args); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - return 0; -} - -int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (!irc_ischannel(target)) /* not a channel, punt */ - return 0; - - if (args[1]) - buf = irc_format(irc, "vcn:", "REMOVE", target, args[0], args[1]); - else - buf = irc_format(irc, "vcn", "REMOVE", target, args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_service(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *capital_cmd, *buf; - - if (!args || !args[0]) - return 0; - - /* cmd will be one of nickserv, chanserv, memoserv or operserv */ - capital_cmd = g_ascii_strup(cmd, -1); - buf = irc_format(irc, "v:", capital_cmd, args[0]); - irc_send(irc, buf); - g_free(capital_cmd); - g_free(buf); - - return 0; -} - -int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - buf = irc_format(irc, "v", "TIME"); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - const char *topic; - PurpleConversation *convo; - - if (!args) - return 0; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, target, irc->account); - if (!convo) - return 0; - - if (!args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(convo)); - - if (topic) { - char *tmp, *tmp2; - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), target, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - return 0; - } - - buf = irc_format(irc, "vt:", "TOPIC", target, args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (!strcmp(cmd, "wallops")) - buf = irc_format(irc, "v:", "WALLOPS", args[0]); - else if (!strcmp(cmd, "operwall")) - buf = irc_format(irc, "v:", "OPERWALL", args[0]); - else - return 0; - - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (args[1]) { - buf = irc_format(irc, "vvn", "WHOIS", args[0], args[1]); - irc->whois.nick = g_strdup(args[1]); - } else { - buf = irc_format(irc, "vn", "WHOIS", args[0]); - irc->whois.nick = g_strdup(args[0]); - } - - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_whowas(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "vn", "WHOWAS", args[0]); - - irc->whois.nick = g_strdup(args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -static void irc_do_mode(struct irc_conn *irc, const char *target, const char *sign, char **ops) -{ - char *buf, mode[5]; - int i = 0; - - if (!sign) - return; - - while (ops[i]) { - if (ops[i + 2] && ops[i + 4]) { - g_snprintf(mode, sizeof(mode), "%s%s%s%s", sign, - ops[i], ops[i + 2], ops[i + 4]); - buf = irc_format(irc, "vcvnnn", "MODE", target, mode, - ops[i + 1], ops[i + 3], ops[i + 5]); - i += 6; - } else if (ops[i + 2]) { - g_snprintf(mode, sizeof(mode), "%s%s%s", - sign, ops[i], ops[i + 2]); - buf = irc_format(irc, "vcvnn", "MODE", target, mode, - ops[i + 1], ops[i + 3]); - i += 4; - } else { - g_snprintf(mode, sizeof(mode), "%s%s", sign, ops[i]); - buf = irc_format(irc, "vcvn", "MODE", target, mode, ops[i + 1]); - i += 2; - } - irc_send(irc, buf); - g_free(buf); - } - - return; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/dcc_send.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/dcc_send.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/dcc_send.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/dcc_send.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,388 +0,0 @@ -/** - * @file dcc_send.c Functions used in sending files with DCC SEND - * - * purple - * - * Copyright (C) 2004, Timothy T Ringenbach - * Copyright (C) 2003, Robbert Haarman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "irc.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "network.h" - -/*************************************************************************** - * Functions related to receiving files via DCC SEND - ***************************************************************************/ - -struct irc_xfer_rx_data { - gchar *ip; -}; - -static void irc_dccsend_recv_destroy(PurpleXfer *xfer) -{ - struct irc_xfer_rx_data *xd = xfer->data; - - g_free(xd->ip); - g_free(xd); -} - -/* - * This function is called whenever data is received. - * It sends the acknowledgement (in the form of a total byte count as an - * unsigned 4 byte integer in network byte order) - */ -static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t size) { - guint32 l; - size_t result; - - l = htonl(xfer->bytes_sent); - result = write(xfer->fd, &l, sizeof(l)); - if (result != sizeof(l)) { - purple_debug_error("irc", "unable to send acknowledgement: %s\n", g_strerror(errno)); - /* TODO: We should probably close the connection here or something. */ - } -} - -static void irc_dccsend_recv_init(PurpleXfer *xfer) { - struct irc_xfer_rx_data *xd = xfer->data; - - purple_xfer_start(xfer, -1, xd->ip, xfer->remote_port); - g_free(xd->ip); - xd->ip = NULL; -} - -/* This function makes the necessary arrangements for receiving files */ -void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) { - PurpleXfer *xfer; - struct irc_xfer_rx_data *xd; - gchar **token; - struct in_addr addr; - GString *filename; - int i = 0; - guint32 nip; - - token = g_strsplit(msg, " ", 0); - if (!token[0] || !token[1] || !token[2]) { - g_strfreev(token); - return; - } - - filename = g_string_new(""); - if (token[0][0] == '"') { - if (!strchr(&(token[0][1]), '"')) { - g_string_append(filename, &(token[0][1])); - for (i = 1; token[i]; i++) - if (!strchr(token[i], '"')) { - g_string_append_printf(filename, " %s", token[i]); - } else { - g_string_append_len(filename, token[i], strlen(token[i]) - 1); - break; - } - } else { - g_string_append_len(filename, &(token[0][1]), strlen(&(token[0][1])) - 1); - } - } else { - g_string_append(filename, token[0]); - } - - if (!token[i] || !token[i+1] || !token[i+2]) { - g_strfreev(token); - g_string_free(filename, TRUE); - return; - } - i++; - - xfer = purple_xfer_new(irc->account, PURPLE_XFER_RECEIVE, from); - if (xfer) - { - xd = g_new0(struct irc_xfer_rx_data, 1); - xfer->data = xd; - - purple_xfer_set_filename(xfer, filename->str); - xfer->remote_port = atoi(token[i+1]); - - nip = strtoul(token[i], NULL, 10); - if (nip) { - addr.s_addr = htonl(nip); - xd->ip = g_strdup(inet_ntoa(addr)); - } else { - xd->ip = g_strdup(token[i]); - } - purple_debug(PURPLE_DEBUG_INFO, "irc", "Receiving file (%s) from %s\n", - filename->str, xd->ip); - purple_xfer_set_size(xfer, token[i+2] ? atoi(token[i+2]) : 0); - - purple_xfer_set_init_fnc(xfer, irc_dccsend_recv_init); - purple_xfer_set_ack_fnc(xfer, irc_dccsend_recv_ack); - - purple_xfer_set_end_fnc(xfer, irc_dccsend_recv_destroy); - purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_recv_destroy); - purple_xfer_set_cancel_recv_fnc(xfer, irc_dccsend_recv_destroy); - - purple_xfer_request(xfer); - } - g_strfreev(token); - g_string_free(filename, TRUE); -} - -/******************************************************************* - * Functions related to sending files via DCC SEND - *******************************************************************/ - -struct irc_xfer_send_data { - PurpleNetworkListenData *listen_data; - gint inpa; - int fd; - guchar *rxqueue; - guint rxlen; -}; - -static void irc_dccsend_send_destroy(PurpleXfer *xfer) -{ - struct irc_xfer_send_data *xd = xfer->data; - - if (xd == NULL) - return; - - if (xd->listen_data != NULL) - purple_network_listen_cancel(xd->listen_data); - if (xd->inpa > 0) - purple_input_remove(xd->inpa); - if (xd->fd != -1) - close(xd->fd); - - g_free(xd->rxqueue); - - g_free(xd); -} - -/* just in case you were wondering, this is why DCC is gay */ -static void irc_dccsend_send_read(gpointer data, int source, PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - struct irc_xfer_send_data *xd = xfer->data; - char buffer[64]; - int len; - - len = read(source, buffer, sizeof(buffer)); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - /* XXX: Shouldn't this be canceling the transfer? */ - purple_input_remove(xd->inpa); - xd->inpa = 0; - return; - } - - xd->rxqueue = g_realloc(xd->rxqueue, len + xd->rxlen); - memcpy(xd->rxqueue + xd->rxlen, buffer, len); - xd->rxlen += len; - - while (1) { - size_t acked; - - if (xd->rxlen < 4) - break; - - acked = ntohl(*((gint32 *)xd->rxqueue)); - - xd->rxlen -= 4; - if (xd->rxlen) { - unsigned char *tmp = g_memdup(xd->rxqueue + 4, xd->rxlen); - g_free(xd->rxqueue); - xd->rxqueue = tmp; - } else { - g_free(xd->rxqueue); - xd->rxqueue = NULL; - } - - if (acked >= purple_xfer_get_size(xfer)) { - purple_input_remove(xd->inpa); - xd->inpa = 0; - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - return; - } - } -} - -static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, PurpleXfer *xfer) -{ - gssize s; - int ret; - - s = MIN(purple_xfer_get_bytes_remaining(xfer), size); - if (!s) - return 0; - - ret = write(xfer->fd, buffer, s); - - if (ret < 0 && errno == EAGAIN) - ret = 0; - - return ret; -} - -static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCondition cond) { - PurpleXfer *xfer = (PurpleXfer *) data; - struct irc_xfer_send_data *xd = xfer->data; - int conn, flags; - - conn = accept(xd->fd, NULL, 0); - if (conn == -1) { - /* Accepting the connection failed. This could just be related - * to the nonblocking nature of the listening socket, so we'll - * just try again next time */ - /* Let's print an error message anyway */ - purple_debug_warning("irc", "accept: %s\n", g_strerror(errno)); - return; - } - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(xd->fd); - xd->fd = -1; - - flags = fcntl(conn, F_GETFL); - fcntl(conn, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(conn, F_SETFD, FD_CLOEXEC); -#endif - - xd->inpa = purple_input_add(conn, PURPLE_INPUT_READ, irc_dccsend_send_read, xfer); - /* Start the transfer */ - purple_xfer_start(xfer, conn, NULL, 0); -} - -static void -irc_dccsend_network_listen_cb(int sock, gpointer data) -{ - PurpleXfer *xfer = data; - struct irc_xfer_send_data *xd; - PurpleConnection *gc; - struct irc_conn *irc; - const char *arg[2]; - char *tmp; - struct in_addr addr; - unsigned short int port; - - xd = xfer->data; - xd->listen_data = NULL; - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL - || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE) { - purple_xfer_unref(xfer); - return; - } - - xd = xfer->data; - gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - irc = gc->proto_data; - - purple_xfer_unref(xfer); - - if (sock < 0) { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to open a listening port.")); - purple_xfer_cancel_local(xfer); - return; - } - - xd->fd = sock; - - port = purple_network_get_port_from_fd(sock); - purple_debug_misc("irc", "port is %hu\n", port); - /* Monitor the listening socket */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - irc_dccsend_send_connected, xfer); - - /* Send the intended recipient the DCC request */ - arg[0] = xfer->who; - inet_aton(purple_network_get_my_ip(irc->fd), &addr); - arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001", - xfer->filename, ntohl(addr.s_addr), - port, xfer->size); - - irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg); - g_free(tmp); -} - -/* - * This function is called after the user has selected a file to send. - */ -static void irc_dccsend_send_init(PurpleXfer *xfer) { - PurpleConnection *gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - struct irc_xfer_send_data *xd = xfer->data; - - xfer->filename = g_path_get_basename(xfer->local_filename); - - purple_xfer_ref(xfer); - - /* Create a listening socket */ - xd->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, - irc_dccsend_network_listen_cb, xfer); - if (xd->listen_data == NULL) { - purple_xfer_unref(xfer); - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to open a listening port.")); - purple_xfer_cancel_local(xfer); - } - -} - -PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who) { - PurpleXfer *xfer; - struct irc_xfer_send_data *xd; - - /* Build the file transfer handle */ - xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); - if (xfer) - { - xd = g_new0(struct irc_xfer_send_data, 1); - xd->fd = -1; - xfer->data = xd; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, irc_dccsend_send_init); - purple_xfer_set_write_fnc(xfer, irc_dccsend_send_write); - purple_xfer_set_end_fnc(xfer, irc_dccsend_send_destroy); - purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_send_destroy); - purple_xfer_set_cancel_send_fnc(xfer, irc_dccsend_send_destroy); - } - - return xfer; -} - -/** - * Purple calls this function when the user selects Send File from the - * buddy menu - * It sets up the PurpleXfer struct and tells Purple to go ahead - */ -void irc_dccsend_send_file(PurpleConnection *gc, const char *who, const char *file) { - PurpleXfer *xfer = irc_dccsend_new_xfer(gc, who); - - /* Perform the request */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1038 +0,0 @@ -/** - * @file irc.c - * - * purple - * - * Copyright (C) 2003, Robbert Haarman - * Copyright (C) 2003, Ethan Blanton - * Copyright (C) 2000-2003, Rob Flynn - * Copyright (C) 1998-1999, Mark Spencer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "plugin.h" -#include "util.h" -#include "version.h" - -#include "irc.h" - -#define PING_TIMEOUT 60 - -static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string); - -static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b); -static GList *irc_status_types(PurpleAccount *account); -static GList *irc_actions(PurplePlugin *plugin, gpointer context); -/* static GList *irc_chat_info(PurpleConnection *gc); */ -static void irc_login(PurpleAccount *account); -static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); -static void irc_login_cb(gpointer data, gint source, const gchar *error_message); -static void irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, gpointer data); -static void irc_close(PurpleConnection *gc); -static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags); -static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags); -static void irc_chat_join (PurpleConnection *gc, GHashTable *data); -static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond); -static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); - -static guint irc_nick_hash(const char *nick); -static gboolean irc_nick_equal(const char *nick1, const char *nick2); -static void irc_buddy_free(struct irc_buddy *ib); - -PurplePlugin *_irc_plugin = NULL; - -static void irc_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - struct irc_conn *irc; - char *title; - - if (gc == NULL || gc->proto_data == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); - return; - } - irc = gc->proto_data; - if (irc->motd == NULL) { - purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), - _("There is no MOTD associated with this connection.")); - return; - } - title = g_strdup_printf(_("MOTD for %s"), irc->server); - purple_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); - g_free(title); -} - -static int do_send(struct irc_conn *irc, const char *buf, gsize len) -{ - int ret; - - if (irc->gsc) { - ret = purple_ssl_write(irc->gsc, buf, len); - } else { - ret = write(irc->fd, buf, len); - } - - return ret; -} - -static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - struct irc_conn *irc = (struct irc_conn*)gc->proto_data; - return do_send(irc, buf, len); -} - -static void -irc_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - struct irc_conn *irc = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(irc->outbuf); - - if (writelen == 0) { - purple_input_remove(irc->writeh); - irc->writeh = 0; - return; - } - - ret = do_send(irc, irc->outbuf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - PurpleConnection *gc = purple_account_get_connection(irc->account); - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(irc->outbuf, ret); - -#if 0 - /* We *could* try to write more if we wrote it all */ - if (ret == write_len) { - irc_send_cb(data, source, cond); - } -#endif -} - -int irc_send(struct irc_conn *irc, const char *buf) -{ - int ret, buflen; - char *tosend= g_strdup(buf); - - purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); - if (tosend == NULL) - return 0; - - buflen = strlen(tosend); - - - /* If we're not buffering writes, try to send immediately */ - if (!irc->writeh) - ret = do_send(irc, tosend, buflen); - else { - ret = -1; - errno = EAGAIN; - } - - /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s", - irc->gsc ? " (ssl)" : "", tosend); */ - if (ret <= 0 && errno != EAGAIN) { - PurpleConnection *gc = purple_account_get_connection(irc->account); - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } else if (ret < buflen) { - if (ret < 0) - ret = 0; - if (!irc->writeh) - irc->writeh = purple_input_add( - irc->gsc ? irc->gsc->fd : irc->fd, - PURPLE_INPUT_WRITE, irc_send_cb, irc); - purple_circ_buffer_append(irc->outbuf, tosend + ret, - buflen - ret); - } - g_free(tosend); - return ret; -} - -/* XXX I don't like messing directly with these buddies */ -gboolean irc_blist_timeout(struct irc_conn *irc) -{ - GString *string; - char *list, *buf; - - if (irc->ison_outstanding) - return TRUE; - - string = g_string_sized_new(512); - - g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_append, (gpointer)string); - - list = g_string_free(string, FALSE); - if (!list || !strlen(list)) { - g_free(list); - return TRUE; - } - - buf = irc_format(irc, "vn", "ISON", list); - g_free(list); - irc_send(irc, buf); - g_free(buf); - - irc->ison_outstanding = TRUE; - - return TRUE; -} - -static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string) -{ - ib->flag = FALSE; - g_string_append_printf(string, "%s ", name); -} - -static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) -{ - char *buf; - - ib->flag = FALSE; - buf = irc_format(irc, "vn", "ISON", ib->name); - irc_send(irc, buf); - g_free(buf); -} - - -static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "irc"; -} - -static GList *irc_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); - types = g_list_append(types, type); - - return types; -} - -static GList *irc_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act = NULL; - - act = purple_plugin_action_new(_("View MOTD"), irc_view_motd); - list = g_list_append(list, act); - - return list; -} - -static GList *irc_chat_join_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Password:"); - pce->identifier = "password"; - pce->secret = TRUE; - m = g_list_append(m, pce); - - return m; -} - -static GHashTable *irc_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void irc_login(PurpleAccount *account) -{ - PurpleConnection *gc; - struct irc_conn *irc; - char **userparts; - const char *username = purple_account_get_username(account); - - gc = purple_account_get_connection(account); - gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; - - if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("IRC nick and server may not contain whitespace")); - return; - } - - gc->proto_data = irc = g_new0(struct irc_conn, 1); - irc->fd = -1; - irc->account = account; - irc->outbuf = purple_circ_buffer_new(512); - - userparts = g_strsplit(username, "@", 2); - purple_connection_set_display_name(gc, userparts[0]); - irc->server = g_strdup(userparts[1]); - g_strfreev(userparts); - - irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, - NULL, (GDestroyNotify)irc_buddy_free); - irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); - irc_cmd_table_build(irc); - irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); - irc_msg_table_build(irc); - - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - - if (purple_account_get_bool(account, "ssl", FALSE)) { - if (purple_ssl_is_supported()) { - irc->gsc = purple_ssl_connect(account, irc->server, - purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), - irc_login_cb_ssl, irc_ssl_connect_failure, gc); - } else { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - return; - } - } - - if (!irc->gsc) { - - if (purple_proxy_connect(gc, account, irc->server, - purple_account_get_int(account, "port", IRC_DEFAULT_PORT), - irc_login_cb, gc) == NULL) - { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - } -} - -static gboolean do_login(PurpleConnection *gc) { - char *buf, *tmp = NULL; - char *hostname, *server; - const char *hosttmp; - const char *username, *realname; - struct irc_conn *irc = gc->proto_data; - const char *pass = purple_connection_get_password(gc); - - if (pass && *pass) { - buf = irc_format(irc, "vv", "PASS", pass); - if (irc_send(irc, buf) < 0) { - g_free(buf); - return FALSE; - } - g_free(buf); - } - - realname = purple_account_get_string(irc->account, "realname", ""); - username = purple_account_get_string(irc->account, "username", ""); - - if (username == NULL || *username == '\0') { - username = g_get_user_name(); - } - - if (username != NULL && strchr(username, ' ') != NULL) { - tmp = g_strdup(username); - while ((buf = strchr(tmp, ' ')) != NULL) { - *buf = '_'; - } - } - - hosttmp = purple_get_host_name(); - if (*hosttmp == ':') { - /* This is either an IPv6 address, or something which - * doesn't belong here. Either way, we need to escape - * it. */ - hostname = g_strdup_printf("0%s", hosttmp); - } else { - /* Ugly, I know. */ - hostname = g_strdup(hosttmp); - } - - if (*irc->server == ':') { - /* Same as hostname, above. */ - server = g_strdup_printf("0%s", irc->server); - } else { - server = g_strdup(irc->server); - } - - buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, hostname, server, - strlen(realname) ? realname : IRC_DEFAULT_ALIAS); - g_free(tmp); - g_free(hostname); - g_free(server); - if (irc_send(irc, buf) < 0) { - g_free(buf); - return FALSE; - } - g_free(buf); - username = purple_connection_get_display_name(gc); - buf = irc_format(irc, "vn", "NICK", username); - irc->reqnick = g_strdup(username); - irc->nickused = FALSE; - if (irc_send(irc, buf) < 0) { - g_free(buf); - return FALSE; - } - g_free(buf); - - irc->recv_time = time(NULL); - - return TRUE; -} - -static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - - if (do_login(gc)) { - purple_ssl_input_add(gsc, irc_input_cb_ssl, gc); - } -} - -static void irc_login_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - - if (source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - irc->fd = source; - - if (do_login(gc)) { - gc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); - } -} - -static void -irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - - irc->gsc = NULL; - - purple_connection_ssl_error (gc, error); -} - -static void irc_close(PurpleConnection *gc) -{ - struct irc_conn *irc = gc->proto_data; - - if (irc == NULL) - return; - - if (irc->gsc || (irc->fd >= 0)) - irc_cmd_quit(irc, "quit", NULL, NULL); - - if (gc->inpa) - purple_input_remove(gc->inpa); - - g_free(irc->inbuf); - if (irc->gsc) { - purple_ssl_close(irc->gsc); - } else if (irc->fd >= 0) { - close(irc->fd); - } - if (irc->timer) - purple_timeout_remove(irc->timer); - g_hash_table_destroy(irc->cmds); - g_hash_table_destroy(irc->msgs); - g_hash_table_destroy(irc->buddies); - if (irc->motd) - g_string_free(irc->motd, TRUE); - g_free(irc->server); - - if (irc->writeh) - purple_input_remove(irc->writeh); - - purple_circ_buffer_destroy(irc->outbuf); - - g_free(irc->mode_chars); - g_free(irc->reqnick); - - g_free(irc); -} - -static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) -{ - struct irc_conn *irc = gc->proto_data; - char *plain; - const char *args[2]; - - args[0] = irc_nick_skip_mode(irc, who); - - purple_markup_html_to_xhtml(what, NULL, &plain); - args[1] = plain; - - irc_cmd_privmsg(irc, "msg", NULL, args); - g_free(plain); - return 1; -} - -static void irc_get_info(PurpleConnection *gc, const char *who) -{ - struct irc_conn *irc = gc->proto_data; - const char *args[2]; - args[0] = who; - args[1] = NULL; - irc_cmd_whois(irc, "whois", NULL, args); -} - -static void irc_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - struct irc_conn *irc; - const char *args[1]; - const char *status_id = purple_status_get_id(status); - - g_return_if_fail(gc != NULL); - irc = gc->proto_data; - - if (!purple_status_is_active(status)) - return; - - args[0] = NULL; - - if (!strcmp(status_id, "away")) { - args[0] = purple_status_get_attr_string(status, "message"); - if ((args[0] == NULL) || (*args[0] == '\0')) - args[0] = _("Away"); - irc_cmd_away(irc, "away", NULL, args); - } else if (!strcmp(status_id, "available")) { - irc_cmd_away(irc, "back", NULL, args); - } -} - -static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; - struct irc_buddy *ib; - const char *bname = purple_buddy_get_name(buddy); - - ib = g_hash_table_lookup(irc->buddies, bname); - if (ib != NULL) { - ib->ref++; - purple_prpl_got_user_status(irc->account, bname, - ib->online ? "available" : "offline", NULL); - } else { - ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(bname); - ib->ref = 1; - g_hash_table_replace(irc->buddies, ib->name, ib); - } - - /* if the timer isn't set, this is during signon, so we don't want to flood - * ourself off with ISON's, so we don't, but after that we want to know when - * someone's online asap */ - if (irc->timer) - irc_ison_one(irc, ib); -} - -static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; - struct irc_buddy *ib; - - ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); - if (ib && --ib->ref == 0) { - g_hash_table_remove(irc->buddies, purple_buddy_get_name(buddy)); - } -} - -static void read_input(struct irc_conn *irc, int len) -{ - char *cur, *end; - - irc->account->gc->last_received = time(NULL); - irc->inbufused += len; - irc->inbuf[irc->inbufused] = '\0'; - - cur = irc->inbuf; - - /* This is a hack to work around the fact that marv gets messages - * with null bytes in them while using some weird irc server at work - */ - while ((cur < (irc->inbuf + irc->inbufused)) && !*cur) - cur++; - - while (cur < irc->inbuf + irc->inbufused && - ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { - int step = (*end == '\r' ? 2 : 1); - *end = '\0'; - irc_parse_msg(irc, cur); - cur = end + step; - } - if (cur != irc->inbuf + irc->inbufused) { /* leftover */ - irc->inbufused -= (cur - irc->inbuf); - memmove(irc->inbuf, cur, irc->inbufused); - } else { - irc->inbufused = 0; - } -} - -static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - int len; - - if(!g_list_find(purple_connections_get_all(), gc)) { - purple_ssl_close(gsc); - return; - } - - if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { - irc->inbuflen += IRC_INITIAL_BUFSIZE; - irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); - } - - len = purple_ssl_read(gsc, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); - - if (len < 0 && errno == EAGAIN) { - /* Try again later */ - return; - } else if (len < 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - read_input(irc, len); -} - -static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - int len; - - if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { - irc->inbuflen += IRC_INITIAL_BUFSIZE; - irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); - } - - len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); - if (len < 0 && errno == EAGAIN) { - return; - } else if (len < 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - read_input(irc, len); -} - -static void irc_chat_join (PurpleConnection *gc, GHashTable *data) -{ - struct irc_conn *irc = gc->proto_data; - const char *args[2]; - - args[0] = g_hash_table_lookup(data, "channel"); - args[1] = g_hash_table_lookup(data, "password"); - irc_cmd_join(irc, "join", NULL, args); -} - -static char *irc_get_chat_name(GHashTable *data) { - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) -{ - struct irc_conn *irc = gc->proto_data; - PurpleConversation *convo = purple_find_chat(gc, id); - const char *args[2]; - - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); - return; - } - args[0] = name; - args[1] = purple_conversation_get_name(convo); - irc_cmd_invite(irc, "invite", purple_conversation_get_name(convo), args); -} - - -static void irc_chat_leave (PurpleConnection *gc, int id) -{ - struct irc_conn *irc = gc->proto_data; - PurpleConversation *convo = purple_find_chat(gc, id); - const char *args[2]; - - if (!convo) - return; - - args[0] = purple_conversation_get_name(convo); - args[1] = NULL; - irc_cmd_part(irc, "part", purple_conversation_get_name(convo), args); - serv_got_chat_left(gc, id); -} - -static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) -{ - struct irc_conn *irc = gc->proto_data; - PurpleConversation *convo = purple_find_chat(gc, id); - const char *args[2]; - char *tmp; - - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n"); - return -EINVAL; - } -#if 0 - if (*what == '/') { - return irc_parse_cmd(irc, convo->name, what + 1); - } -#endif - purple_markup_html_to_xhtml(what, NULL, &tmp); - args[0] = convo->name; - args[1] = tmp; - - irc_cmd_privmsg(irc, "msg", NULL, args); - - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL)); - g_free(tmp); - return 0; -} - -static guint irc_nick_hash(const char *nick) -{ - char *lc; - guint bucket; - - lc = g_utf8_strdown(nick, -1); - bucket = g_str_hash(lc); - g_free(lc); - - return bucket; -} - -static gboolean irc_nick_equal(const char *nick1, const char *nick2) -{ - return (purple_utf8_strcasecmp(nick1, nick2) == 0); -} - -static void irc_buddy_free(struct irc_buddy *ib) -{ - g_free(ib->name); - g_free(ib); -} - -static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - char *buf; - const char *name = NULL; - struct irc_conn *irc; - - irc = gc->proto_data; - name = purple_conversation_get_name(purple_find_chat(gc, id)); - - if (name == NULL) - return; - - buf = irc_format(irc, "vt:", "TOPIC", name, topic); - irc_send(irc, buf); - g_free(buf); -} - -static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) -{ - struct irc_conn *irc; - GList *fields = NULL; - PurpleRoomlistField *f; - char *buf; - - irc = gc->proto_data; - - if (irc->roomlist) - purple_roomlist_unref(irc->roomlist); - - irc->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - - purple_roomlist_set_fields(irc->roomlist, fields); - - buf = irc_format(irc, "v", "LIST"); - irc_send(irc, buf); - g_free(buf); - - return irc->roomlist; -} - -static void irc_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - struct irc_conn *irc; - - if (gc == NULL) - return; - - irc = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - - if (irc->roomlist == list) { - irc->roomlist = NULL; - purple_roomlist_unref(list); - } -} - -static void irc_keepalive(PurpleConnection *gc) -{ - struct irc_conn *irc = gc->proto_data; - if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) - irc_cmd_ping(irc, NULL, NULL, NULL); -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | - OPT_PROTO_SLASH_COMMANDS_NATIVE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec */ - irc_blist_icon, /* list_icon */ - NULL, /* list_emblems */ - NULL, /* status_text */ - NULL, /* tooltip_text */ - irc_status_types, /* away_states */ - NULL, /* blist_node_menu */ - irc_chat_join_info, /* chat_info */ - irc_chat_info_defaults, /* chat_info_defaults */ - irc_login, /* login */ - irc_close, /* close */ - irc_im_send, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - irc_get_info, /* get_info */ - irc_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - irc_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - irc_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - irc_chat_join, /* join_chat */ - NULL, /* reject_chat */ - irc_get_chat_name, /* get_chat_name */ - irc_chat_invite, /* chat_invite */ - irc_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - irc_chat_send, /* chat_send */ - irc_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - irc_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - irc_roomlist_get_list, /* roomlist_get_list */ - irc_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - irc_dccsend_send_file, /* send_file */ - irc_dccsend_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - irc_send_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static gboolean load_plugin (PurplePlugin *plugin) { - - purple_signal_register(plugin, "irc-sending-text", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - purple_signal_register(plugin, "irc-receiving-text", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - return TRUE; -} - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-irc", /**< id */ - "IRC", /**< name */ - DISPLAY_VERSION, /**< version */ - N_("IRC Protocol Plugin"), /** summary */ - N_("The IRC Protocol Plugin that Sucks Less"), /** description */ - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - load_plugin, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - irc_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void _init_plugin(PurplePlugin *plugin) -{ - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encodings"), "encoding", IRC_DEFAULT_CHARSET); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Auto-detect incoming UTF-8"), "autodetect_utf8", IRC_DEFAULT_AUTODETECT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Username"), "username", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Real name"), "realname", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - /* - option = purple_account_option_string_new(_("Quit message"), "quitmsg", IRC_DEFAULT_QUIT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - */ - - option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - _irc_plugin = plugin; - - purple_prefs_remove("/plugins/prpl/irc/quitmsg"); - purple_prefs_remove("/plugins/prpl/irc"); - - irc_register_commands(); -} - -PURPLE_INIT_PLUGIN(irc, _init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/irc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,199 +0,0 @@ -/** - * @file irc.h - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_IRC_H -#define _PURPLE_IRC_H - -#include - -#include "circbuffer.h" -#include "ft.h" -#include "roomlist.h" -#include "sslconn.h" - -#define IRC_DEFAULT_SERVER "irc.freenode.net" -#define IRC_DEFAULT_PORT 6667 -#define IRC_DEFAULT_SSL_PORT 994 - -#define IRC_DEFAULT_CHARSET "UTF-8" -#define IRC_DEFAULT_AUTODETECT FALSE -#define IRC_DEFAULT_ALIAS "purple" - -#define IRC_DEFAULT_QUIT "Leaving." - -#define IRC_INITIAL_BUFSIZE 1024 - -#define IRC_NAMES_FLAG "irc-namelist" - - -enum { IRC_USEROPT_SERVER, IRC_USEROPT_PORT, IRC_USEROPT_CHARSET }; -enum irc_state { IRC_STATE_NEW, IRC_STATE_ESTABLISHED }; - -struct irc_conn { - PurpleAccount *account; - GHashTable *msgs; - GHashTable *cmds; - char *server; - int fd; - guint timer; - GHashTable *buddies; - - gboolean ison_outstanding; - - char *inbuf; - int inbuflen; - int inbufused; - - GString *motd; - GString *names; - struct _whois { - char *nick; - char *away; - char *userhost; - char *name; - char *server; - char *serverinfo; - GString *channels; - int ircop; - int identified; - int idle; - time_t signon; - } whois; - PurpleRoomlist *roomlist; - PurpleSslConnection *gsc; - - gboolean quitting; - - PurpleCircBuffer *outbuf; - guint writeh; - - time_t recv_time; - - char *mode_chars; - char *reqnick; - gboolean nickused; -}; - -struct irc_buddy { - char *name; - gboolean online; - gboolean flag; - int ref; -}; - -typedef int (*IRCCmdCallback) (struct irc_conn *irc, const char *cmd, const char *target, const char **args); - -int irc_send(struct irc_conn *irc, const char *buf); -gboolean irc_blist_timeout(struct irc_conn *irc); - -char *irc_escape_privmsg(const char *text, gssize length); - -char *irc_mirc2html(const char *string); -char *irc_mirc2txt(const char *string); - -const char *irc_nick_skip_mode(struct irc_conn *irc, const char *string); - -gboolean irc_ischannel(const char *string); - -void irc_register_commands(void); -void irc_msg_table_build(struct irc_conn *irc); -void irc_parse_msg(struct irc_conn *irc, char *input); -char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice); -char *irc_format(struct irc_conn *irc, const char *format, ...); - -void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args); - -void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args); - -void irc_cmd_table_build(struct irc_conn *irc); - -int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ctcp(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ctcp_version(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_service(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_whowas(struct irc_conn *irc, const char *cmd, const char *target, const char **args); - -PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who); -void irc_dccsend_send_file(PurpleConnection *gc, const char *who, const char *file); -void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg); -#endif /* _PURPLE_IRC_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -IRCSOURCES = \ - cmds.c \ - dcc_send.c \ - irc.c \ - irc.h \ - msgs.c \ - parse.c - -AM_CFLAGS = $(st) - -libirc_la_LDFLAGS = -module -avoid-version - -if STATIC_IRC - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libirc.la -libirc_la_SOURCES = $(IRCSOURCES) -libirc_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libirc.la -libirc_la_SOURCES = $(IRCSOURCES) -libirc_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,776 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/irc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_IRC_FALSE@libirc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libirc_la_SOURCES_DIST = cmds.c dcc_send.c irc.c irc.h msgs.c \ - parse.c -am__objects_1 = libirc_la-cmds.lo libirc_la-dcc_send.lo \ - libirc_la-irc.lo libirc_la-msgs.lo libirc_la-parse.lo -@STATIC_IRC_FALSE@am_libirc_la_OBJECTS = $(am__objects_1) -@STATIC_IRC_TRUE@am_libirc_la_OBJECTS = $(am__objects_1) -libirc_la_OBJECTS = $(am_libirc_la_OBJECTS) -@STATIC_IRC_FALSE@am_libirc_la_rpath = -rpath $(pkgdir) -@STATIC_IRC_TRUE@am_libirc_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libirc_la_SOURCES) -DIST_SOURCES = $(am__libirc_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -IRCSOURCES = \ - cmds.c \ - dcc_send.c \ - irc.c \ - irc.h \ - msgs.c \ - parse.c - -AM_CFLAGS = $(st) -libirc_la_LDFLAGS = -module -avoid-version -@STATIC_IRC_FALSE@st = -@STATIC_IRC_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_IRC_TRUE@noinst_LTLIBRARIES = libirc.la -@STATIC_IRC_FALSE@libirc_la_SOURCES = $(IRCSOURCES) -@STATIC_IRC_TRUE@libirc_la_SOURCES = $(IRCSOURCES) -@STATIC_IRC_TRUE@libirc_la_CFLAGS = $(AM_CFLAGS) -@STATIC_IRC_FALSE@pkg_LTLIBRARIES = libirc.la -@STATIC_IRC_FALSE@libirc_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/irc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/irc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libirc.la: $(libirc_la_OBJECTS) $(libirc_la_DEPENDENCIES) - $(LINK) $(am_libirc_la_rpath) $(libirc_la_LDFLAGS) $(libirc_la_OBJECTS) $(libirc_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-cmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-dcc_send.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-irc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-msgs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-parse.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libirc_la-cmds.lo: cmds.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-cmds.lo -MD -MP -MF "$(DEPDIR)/libirc_la-cmds.Tpo" -c -o libirc_la-cmds.lo `test -f 'cmds.c' || echo '$(srcdir)/'`cmds.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-cmds.Tpo" "$(DEPDIR)/libirc_la-cmds.Plo"; else rm -f "$(DEPDIR)/libirc_la-cmds.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmds.c' object='libirc_la-cmds.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-cmds.lo `test -f 'cmds.c' || echo '$(srcdir)/'`cmds.c - -libirc_la-dcc_send.lo: dcc_send.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-dcc_send.lo -MD -MP -MF "$(DEPDIR)/libirc_la-dcc_send.Tpo" -c -o libirc_la-dcc_send.lo `test -f 'dcc_send.c' || echo '$(srcdir)/'`dcc_send.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-dcc_send.Tpo" "$(DEPDIR)/libirc_la-dcc_send.Plo"; else rm -f "$(DEPDIR)/libirc_la-dcc_send.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dcc_send.c' object='libirc_la-dcc_send.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-dcc_send.lo `test -f 'dcc_send.c' || echo '$(srcdir)/'`dcc_send.c - -libirc_la-irc.lo: irc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-irc.lo -MD -MP -MF "$(DEPDIR)/libirc_la-irc.Tpo" -c -o libirc_la-irc.lo `test -f 'irc.c' || echo '$(srcdir)/'`irc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-irc.Tpo" "$(DEPDIR)/libirc_la-irc.Plo"; else rm -f "$(DEPDIR)/libirc_la-irc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='irc.c' object='libirc_la-irc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-irc.lo `test -f 'irc.c' || echo '$(srcdir)/'`irc.c - -libirc_la-msgs.lo: msgs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-msgs.lo -MD -MP -MF "$(DEPDIR)/libirc_la-msgs.Tpo" -c -o libirc_la-msgs.lo `test -f 'msgs.c' || echo '$(srcdir)/'`msgs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-msgs.Tpo" "$(DEPDIR)/libirc_la-msgs.Plo"; else rm -f "$(DEPDIR)/libirc_la-msgs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msgs.c' object='libirc_la-msgs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-msgs.lo `test -f 'msgs.c' || echo '$(srcdir)/'`msgs.c - -libirc_la-parse.lo: parse.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-parse.lo -MD -MP -MF "$(DEPDIR)/libirc_la-parse.Tpo" -c -o libirc_la-parse.lo `test -f 'parse.c' || echo '$(srcdir)/'`parse.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-parse.Tpo" "$(DEPDIR)/libirc_la-parse.Plo"; else rm -f "$(DEPDIR)/libirc_la-parse.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parse.c' object='libirc_la-parse.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-parse.lo `test -f 'parse.c' || echo '$(srcdir)/'`parse.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libirc -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libirc -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = cmds.c \ - dcc_send.c \ - irc.c \ - msgs.c \ - parse.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/msgs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/msgs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/msgs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/msgs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1266 +0,0 @@ -/** - * @file msgs.c - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "blist.h" -#include "notify.h" -#include "util.h" -#include "debug.h" -#include "irc.h" - -#include -#include - -static char *irc_mask_nick(const char *mask); -static char *irc_mask_userhost(const char *mask); -static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]); -static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc); -static void irc_connected(struct irc_conn *irc, const char *nick); - -static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, - const char *from, const char *to, - const char *rawmsg, gboolean notice); - -static char *irc_mask_nick(const char *mask) -{ - char *end, *buf; - - end = strchr(mask, '!'); - if (!end) - buf = g_strdup(mask); - else - buf = g_strndup(mask, end - mask); - - return buf; -} - -static char *irc_mask_userhost(const char *mask) -{ - return g_strdup(strchr(mask, '!') + 1); -} - -static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]) -{ - char *message, *stripped; - - stripped = data[1] ? irc_mirc2txt(data[1]) : NULL; - message = g_strdup_printf("quit: %s", stripped); - g_free(stripped); - - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), data[0])) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), data[0], message); - - g_free(message); -} - -static void irc_connected(struct irc_conn *irc, const char *nick) -{ - PurpleConnection *gc; - PurpleStatus *status; - GSList *buddies; - PurpleAccount *account; - - if ((gc = purple_account_get_connection(irc->account)) == NULL - || PURPLE_CONNECTION_IS_CONNECTED(gc)) - return; - - purple_connection_set_display_name(gc, nick); - purple_connection_set_state(gc, PURPLE_CONNECTED); - account = purple_connection_get_account(gc); - - /* If we're away then set our away message */ - status = purple_account_get_active_status(irc->account); - if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - prpl_info->set_status(irc->account, status); - } - - /* this used to be in the core, but it's not now */ - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) - { - PurpleBuddy *b = buddies->data; - struct irc_buddy *ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(purple_buddy_get_name(b)); - ib->ref = 1; - g_hash_table_replace(irc->buddies, ib->name, ib); - } - - irc_blist_timeout(irc); - if (!irc->timer) - irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); -} - -void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *clean; - /* This, too, should be escaped somehow (smarter) */ - clean = purple_utf8_salvage(args[0]); - purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean); - g_free(clean); -} - -void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - gchar **features; - int i; - - if (!args || !args[0] || !args[1]) - return; - - features = g_strsplit(args[1], " ", -1); - for (i = 0; features[i]; i++) { - char *val; - if (!strncmp(features[i], "PREFIX=", 7)) { - if ((val = strchr(features[i] + 7, ')')) != NULL) - irc->mode_chars = g_strdup(val + 1); - } - } - - g_strfreev(features); -} - -void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!args || !args[0]) - return; - - if (!strcmp(name, "251")) { - /* 251 is required, so we pluck our nick from here and - * finalize connection */ - irc_connected(irc, args[0]); - /* Some IRC servers seem to not send a 255 numeric, so - * I guess we can't require it; 251 will do. */ - /* } else if (!strcmp(name, "255")) { */ - } -} - -void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - char *msg; - - if (!args || !args[1]) - return; - - if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - /* We're doing a whois, show this in the whois dialog */ - irc_msg_whois(irc, name, from, args); - return; - } - - gc = purple_account_get_connection(irc->account); - if (gc) { - msg = g_markup_escape_text(args[2], -1); - serv_got_im(gc, args[1], msg, PURPLE_MESSAGE_AUTO_RESP, time(NULL)); - g_free(msg); - } -} - -void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[1] || !gc) - return; - - purple_notify_error(gc, NULL, _("Bad mode"), args[1]); -} - -void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - - if (!args || !args[0] || !args[1]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - args[1], irc->account); - - if (!strcmp(name, "367")) { - char *msg = NULL; - /* Ban list entry */ - if (!args[2]) - return; - if (args[3] && args[4]) { - /* This is an extended syntax, not in RFC 1459 */ - int t1 = atoi(args[4]); - time_t t2 = time(NULL); - char *time = purple_str_seconds_to_string(t2 - t1); - msg = g_strdup_printf(_("Ban on %s by %s, set %s ago"), - args[2], args[3], time); - g_free(time); - } else { - msg = g_strdup_printf(_("Ban on %s"), args[2]); - } - if (convo) { - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, - time(NULL)); - } else { - purple_debug_info("irc", "%s\n", msg); - } - g_free(msg); - } else if (!strcmp(name, "368")) { - if (!convo) - return; - /* End of ban list */ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", - _("End of ban list"), - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, - time(NULL)); - } -} - -void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *buf; - - if (!args || !args[1] || !gc) - return; - - buf = g_strdup_printf(_("You are banned from %s."), args[1]); - purple_notify_error(gc, _("Banned"), _("Banned"), buf); - g_free(buf); -} - -void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - char *buf, *nick; - - if (!args || !args[0] || !args[1] || !args[2]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (!convo) - return; - - nick = g_markup_escape_text(args[2], -1); - buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick); - g_free(nick); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, - time(NULL)); - g_free(buf); -} - -void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - char *buf, *escaped; - - if (!args || !args[1] || !args[2]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (!convo) /* XXX punt on channels we are not in for now */ - return; - - escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL; - buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(escaped); - g_free(buf); - - return; -} - -void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!irc->whois.nick) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected %s reply for %s\n", !strcmp(name, "314") ? "WHOWAS" : "WHOIS" - , args[1]); - return; - } - - if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Got %s reply for %s while waiting for %s\n", !strcmp(name, "314") ? "WHOWAS" : "WHOIS" - , args[1], irc->whois.nick); - return; - } - - if (!strcmp(name, "301")) { - irc->whois.away = g_strdup(args[2]); - } else if (!strcmp(name, "311") || !strcmp(name, "314")) { - irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]); - irc->whois.name = g_strdup(args[5]); - } else if (!strcmp(name, "312")) { - irc->whois.server = g_strdup(args[2]); - irc->whois.serverinfo = g_strdup(args[3]); - } else if (!strcmp(name, "313")) { - irc->whois.ircop = 1; - } else if (!strcmp(name, "317")) { - irc->whois.idle = atoi(args[2]); - if (args[3]) - irc->whois.signon = (time_t)atoi(args[3]); - } else if (!strcmp(name, "319")) { - if (irc->whois.channels == NULL) { - irc->whois.channels = g_string_new(args[2]); - } else { - irc->whois.channels = g_string_append(irc->whois.channels, args[2]); - } - } else if (!strcmp(name, "320")) { - irc->whois.identified = 1; - } -} - -void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - char *tmp, *tmp2; - PurpleNotifyUserInfo *user_info; - - if (!irc->whois.nick) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected End of %s for %s\n", !strcmp(name, "369") ? "WHOWAS" : "WHOIS" - , args[1]); - return; - } - if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Received end of %s for %s, expecting %s\n", !strcmp(name, "369") ? "WHOWAS" : "WHOIS" - , args[1], irc->whois.nick); - return; - } - - user_info = purple_notify_user_info_new(); - - tmp2 = g_markup_escape_text(args[1], -1); - tmp = g_strdup_printf("%s%s%s", tmp2, - (irc->whois.ircop ? _(" (ircop)") : ""), - (irc->whois.identified ? _(" (identified)") : "")); - purple_notify_user_info_add_pair(user_info, _("Nick"), tmp); - g_free(tmp2); - g_free(tmp); - - if (irc->whois.away) { - tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away)); - g_free(irc->whois.away); - purple_notify_user_info_add_pair(user_info, _("Away"), tmp); - g_free(tmp); - } - if (irc->whois.userhost) { - tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name)); - g_free(irc->whois.name); - purple_notify_user_info_add_pair(user_info, _("Username"), irc->whois.userhost); - purple_notify_user_info_add_pair(user_info, _("Real name"), tmp); - g_free(irc->whois.userhost); - g_free(tmp); - } - if (irc->whois.server) { - tmp = g_strdup_printf("%s (%s)", irc->whois.server, irc->whois.serverinfo); - purple_notify_user_info_add_pair(user_info, _("Server"), tmp); - g_free(tmp); - g_free(irc->whois.server); - g_free(irc->whois.serverinfo); - } - if (irc->whois.channels) { - purple_notify_user_info_add_pair(user_info, _("Currently on"), irc->whois.channels->str); - g_string_free(irc->whois.channels, TRUE); - } - if (irc->whois.idle) { - gchar *timex = purple_str_seconds_to_string(irc->whois.idle); - purple_notify_user_info_add_pair(user_info, _("Idle for"), timex); - g_free(timex); - purple_notify_user_info_add_pair(user_info, - _("Online since"), purple_date_format_full(localtime(&irc->whois.signon))); - } - if (!strcmp(irc->whois.nick, "Paco-Paco")) { - purple_notify_user_info_add_pair(user_info, - _("Defining adjective:"), _("Glorious")); - } - - gc = purple_account_get_connection(irc->account); - - purple_notify_userinfo(gc, irc->whois.nick, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(irc->whois.nick); - memset(&irc->whois, 0, sizeof(irc->whois)); -} - -void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!irc->roomlist) - return; - - if (!strcmp(name, "321")) { - purple_roomlist_set_in_progress(irc->roomlist, TRUE); - return; - } - - if (!strcmp(name, "323")) { - purple_roomlist_set_in_progress(irc->roomlist, FALSE); - purple_roomlist_unref(irc->roomlist); - irc->roomlist = NULL; - return; - } - - if (!strcmp(name, "322")) { - PurpleRoomlistRoom *room; - char *topic; - - if (!args[0] || !args[1] || !args[2] || !args[3]) - return; - - if (!purple_roomlist_get_in_progress(irc->roomlist)) { - purple_debug_warning("irc", "Buggy server didn't send RPL_LISTSTART.\n"); - purple_roomlist_set_in_progress(irc->roomlist, TRUE); - } - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL); - purple_roomlist_room_add_field(irc->roomlist, room, args[1]); - purple_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10))); - topic = irc_mirc2txt(args[3]); - purple_roomlist_room_add_field(irc->roomlist, room, topic); - g_free(topic); - purple_roomlist_room_add(irc->roomlist, room); - } -} - -void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *chan, *topic, *msg, *nick, *tmp, *tmp2; - PurpleConversation *convo; - - if (!strcmp(name, "topic")) { - if (!args[0] || !args[1]) - return; - chan = args[0]; - topic = irc_mirc2txt (args[1]); - } else { - if (!args[0] || !args[1] || !args[2]) - return; - chan = args[1]; - topic = irc_mirc2txt (args[2]); - } - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chan, irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); - g_free(topic); - return; - } - - /* If this is an interactive update, print it out */ - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - g_free(tmp); - if (!strcmp(name, "topic")) { - const char *current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(convo)); - if (!(current_topic != NULL && strcmp(tmp2, current_topic) == 0)) - { - char *nick_esc; - nick = irc_mask_nick(from); - nick_esc = g_markup_escape_text(nick, -1); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), nick, topic); - if (*tmp2) - msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2); - else - msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc); - g_free(nick_esc); - g_free(nick); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - } else { - char *chan_esc = g_markup_escape_text(chan, -1); - msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2); - g_free(chan_esc); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - g_free(tmp2); - g_free(topic); -} - -void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *buf; - - if (!args || !args[1] || !gc) - return; - - buf = g_strdup_printf(_("Unknown message '%s'"), args[1]); - purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server received a message it did not understand.")); - g_free(buf); -} - -void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *names, *cur, *end, *tmp, *msg; - PurpleConversation *convo; - - if (!strcmp(name, "366")) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, args[1], irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[1]); - g_string_free(irc->names, TRUE); - irc->names = NULL; - return; - } - - names = cur = g_string_free(irc->names, FALSE); - irc->names = NULL; - if (purple_conversation_get_data(convo, IRC_NAMES_FLAG)) { - msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : ""); - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), "", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - } else { - GList *users = NULL; - GList *flags = NULL; - - while (*cur) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - end = strchr(cur, ' '); - if (!end) - end = cur + strlen(cur); - if (*cur == '@') { - f = PURPLE_CBFLAGS_OP; - cur++; - } else if (*cur == '%') { - f = PURPLE_CBFLAGS_HALFOP; - cur++; - } else if(*cur == '+') { - f = PURPLE_CBFLAGS_VOICE; - cur++; - } else if(irc->mode_chars - && strchr(irc->mode_chars, *cur)) { - if (*cur == '~') - f = PURPLE_CBFLAGS_FOUNDER; - cur++; - } - tmp = g_strndup(cur, end - cur); - users = g_list_prepend(users, tmp); - flags = g_list_prepend(flags, GINT_TO_POINTER(f)); - cur = end; - if (*cur) - cur++; - } - - if (users != NULL) { - GList *l; - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - - for (l = users; l != NULL; l = l->next) - g_free(l->data); - - g_list_free(users); - g_list_free(flags); - } - - purple_conversation_set_data(convo, IRC_NAMES_FLAG, - GINT_TO_POINTER(TRUE)); - } - g_free(names); - } else { - if (!irc->names) - irc->names = g_string_new(""); - - if (irc->names->len && irc->names->str[irc->names->len - 1] != ' ') - irc->names = g_string_append_c(irc->names, ' '); - irc->names = g_string_append(irc->names, args[3]); - } -} - -void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *escaped; - - if (!args || !args[0]) - return; - - if (!irc->motd) - irc->motd = g_string_new(""); - - if (!strcmp(name, "375")) { - if (irc->motd) - g_string_free(irc->motd, TRUE); - irc->motd = g_string_new(""); - return; - } else if (!strcmp(name, "376")) { - /* dircproxy 1.0.5 does not send 251 on reconnection, so - * finalize the connection here if it is not already done. */ - irc_connected(irc, args[0]); - return; - } - - if (!irc->motd) { - purple_debug_error("irc", "IRC server sent MOTD without STARTMOTD\n"); - return; - } - - if (!args[1]) - return; - - escaped = g_markup_escape_text(args[1], -1); - g_string_append_printf(irc->motd, "%s
", escaped); - g_free(escaped); -} - -void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - - gc = purple_account_get_connection(irc->account); - if (gc == NULL || args == NULL || args[2] == NULL) - return; - - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"), - _("The IRC server's local time is:"), - args[2], NULL, NULL); -} - -void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (gc == NULL || args == NULL || args[1] == NULL) - return; - - purple_notify_error(gc, NULL, _("No such channel"), args[1]); -} - -void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - PurpleConversation *convo; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, args[1], irc->account); - if (convo) { - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) /* does this happen? */ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], _("no such channel"), - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), args[1], _("User is not logged in"), - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } else { - if ((gc = purple_account_get_connection(irc->account)) == NULL) - return; - purple_notify_error(gc, NULL, _("No such nick or channel"), args[1]); - } - - if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - g_free(irc->whois.nick); - irc->whois.nick = NULL; - } -} - -void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - PurpleConversation *convo; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (convo) { - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } else { - if ((gc = purple_account_get_connection(irc->account)) == NULL) - return; - purple_notify_error(gc, NULL, _("Could not send"), args[2]); - } -} - -void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - - purple_debug(PURPLE_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); - if (convo) { - /*g_slist_remove(irc->gc->buddy_chats, convo); - purple_conversation_set_account(convo, NULL);*/ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } -} - -void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - - if (!args || !args[1] || !args[2]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (!convo) - return; - - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", args[2], PURPLE_MESSAGE_SYSTEM, time(NULL)); -} - -void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - GHashTable *components; - gchar *nick; - - if (!args || !args[1] || !gc) - return; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - nick = irc_mask_nick(from); - - g_hash_table_insert(components, g_strdup("channel"), g_strdup(args[1])); - - serv_got_chat_invite(gc, args[1], nick, NULL, components); - g_free(nick); -} - -void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *buf; - - if (!args || !args[1] || !gc) - return; - - buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]); - purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf); - g_free(buf); -} - -void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char **nicks; - struct irc_buddy *ib; - int i; - - if (!args || !args[1]) - return; - - nicks = g_strsplit(args[1], " ", -1); - - for (i = 0; nicks[i]; i++) { - if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) { - continue; - } - ib->flag = TRUE; - } - - g_strfreev(nicks); - - g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc); - irc->ison_outstanding = FALSE; -} - -static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleBuddy *buddy = purple_find_buddy(irc->account, name); - - if (!gc || !buddy) - return; - - if (ib->online && !ib->flag) { - purple_prpl_got_user_status(irc->account, name, "offline", NULL); - ib->online = FALSE; - } else if (!ib->online && ib->flag) { - purple_prpl_got_user_status(irc->account, name, "available", NULL); - ib->online = TRUE; - } -} - -void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *nick = irc_mask_nick(from), *userhost; - struct irc_buddy *ib; - static int id = 1; - - if (!gc) { - g_free(nick); - return; - } - - if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { - /* We are joining a channel for the first time */ - serv_got_joined_chat(gc, id++, args[0]); - g_free(nick); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - args[0], - irc->account); - - if (convo == NULL) { - purple_debug_error("irc", "tried to join %s but couldn't\n", args[0]); - return; - } - purple_conversation_set_data(convo, IRC_NAMES_FLAG, - GINT_TO_POINTER(FALSE)); - /* Until purple_conversation_present does something that - * one would expect in Pidgin, this call produces buggy - * behavior both for the /join and auto-join cases. */ - /* purple_conversation_present(convo); */ - return; - } - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account); - if (convo == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); - g_free(nick); - return; - } - - userhost = irc_mask_userhost(from); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nick, userhost, PURPLE_CBFLAGS_NONE, TRUE); - - if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) { - ib->flag = TRUE; - irc_buddy_status(nick, ib, irc); - } - - g_free(userhost); - g_free(nick); -} - -void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account); - char *nick = irc_mask_nick(from), *buf; - - if (!gc) { - g_free(nick); - return; - } - - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]); - g_free(nick); - return; - } - - if (!purple_utf8_strcasecmp(purple_connection_get_display_name(gc), args[1])) { - buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(buf); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), args[1], buf); - g_free(buf); - } - - g_free(nick); - return; -} - -void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - char *nick = irc_mask_nick(from), *buf; - - if (*args[0] == '#' || *args[0] == '&') { /* Channel */ - char *escaped; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); - g_free(nick); - return; - } - escaped = (args[2] != NULL) ? g_markup_escape_text(args[2], -1) : NULL; - buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], escaped ? escaped : "", nick); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(escaped); - g_free(buf); - if(args[2]) { - PurpleConvChatBuddyFlags newflag, flags; - char *mcur, *cur, *end, *user; - gboolean add = FALSE; - mcur = args[1]; - cur = args[2]; - while (*cur && *mcur) { - if ((*mcur == '+') || (*mcur == '-')) { - add = (*mcur == '+') ? TRUE : FALSE; - mcur++; - continue; - } - end = strchr(cur, ' '); - if (!end) - end = cur + strlen(cur); - user = g_strndup(cur, end - cur); - flags = purple_conv_chat_user_get_flags(PURPLE_CONV_CHAT(convo), user); - newflag = PURPLE_CBFLAGS_NONE; - if (*mcur == 'o') - newflag = PURPLE_CBFLAGS_OP; - else if (*mcur =='h') - newflag = PURPLE_CBFLAGS_HALFOP; - else if (*mcur == 'v') - newflag = PURPLE_CBFLAGS_VOICE; - else if(irc->mode_chars - && strchr(irc->mode_chars, '~') && (*mcur == 'q')) - newflag = PURPLE_CBFLAGS_FOUNDER; - if (newflag) { - if (add) - flags |= newflag; - else - flags &= ~newflag; - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), user, flags); - } - g_free(user); - cur = end; - if (*cur) - cur++; - if (*mcur) - mcur++; - } - } - } else { /* User */ - } - g_free(nick); -} - -void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *conv; - GSList *chats; - char *nick = irc_mask_nick(from); - - irc->nickused = FALSE; - - if (!gc) { - g_free(nick); - return; - } - chats = gc->buddy_chats; - - if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { - purple_connection_set_display_name(gc, args[0]); - } - - while (chats) { - PurpleConvChat *chat = PURPLE_CONV_CHAT(chats->data); - /* This is ugly ... */ - if (purple_conv_chat_find_user(chat, nick)) - purple_conv_chat_rename_user(chat, nick, args[0]); - chats = chats->next; - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, nick, - irc->account); - if (conv != NULL) - purple_conversation_set_name(conv, args[0]); - - g_free(nick); -} - -void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - if (purple_connection_get_state(gc) == PURPLE_CONNECTED) { - purple_notify_error(gc, _("Invalid nickname"), - _("Invalid nickname"), - _("Your selected nickname was rejected by the server. It probably contains invalid characters.")); - - } else { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Your selected account name was rejected by the server. It probably contains invalid characters.")); - } -} - -void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *newnick, *buf, *end; - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[1]) - return; - - if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) { - /* We only want to do the following dance if the connection - has not been successfully completed. If it has, just - notify the user that their /nick command didn't go. */ - buf = g_strdup_printf(_("The nickname \"%s\" is already being used."), - irc->reqnick); - purple_notify_error(gc, _("Nickname in use"), - _("Nickname in use"), buf); - g_free(buf); - g_free(irc->reqnick); - irc->reqnick = NULL; - return; - } - - if (strlen(args[1]) < strlen(irc->reqnick) || irc->nickused) - newnick = g_strdup(args[1]); - else - newnick = g_strdup_printf("%s0", args[1]); - end = newnick + strlen(newnick) - 1; - /* try fallbacks */ - if((*end < '9') && (*end >= '1')) { - *end = *end + 1; - } else *end = '1'; - - g_free(irc->reqnick); - irc->reqnick = newnick; - irc->nickused = TRUE; - - purple_connection_set_display_name( - purple_account_get_connection(irc->account), newnick); - - buf = irc_format(irc, "vn", "NICK", newnick); - irc_send(irc, buf); - g_free(buf); -} - -void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!args || !args[0] || !args[1]) - return; - - irc_msg_handle_privmsg(irc, name, from, args[0], args[1], TRUE); -} - -void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[2] || !gc) - return; - - purple_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]); -} - -void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *nick, *msg, *channel; - - if (!args || !args[0] || !gc) - return; - - /* Undernet likes to :-quote the channel name, for no good reason - * that I can see. This catches that. */ - channel = (args[0][0] == ':') ? &args[0][1] : args[0]; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, channel, irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", channel); - return; - } - - nick = irc_mask_nick(from); - if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { - char *escaped = g_markup_escape_text(args[1], -1); - msg = g_strdup_printf(_("You have parted the channel%s%s"), - (args[1] && *args[1]) ? ": " : "", - (escaped && *escaped) ? escaped : ""); - g_free(escaped); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - msg = args[1] ? irc_mirc2txt(args[1]) : NULL; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nick, msg); - g_free(msg); - } - g_free(nick); -} - -void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *buf; - if (!args || !args[0]) - return; - - buf = irc_format(irc, "v:", "PONG", args[0]); - irc_send(irc, buf); - g_free(buf); -} - -void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - PurpleConnection *gc; - char **parts, *msg; - time_t oldstamp; - - if (!args || !args[1]) - return; - - parts = g_strsplit(args[1], " ", 2); - - if (!parts[0] || !parts[1]) { - g_strfreev(parts); - return; - } - - if (sscanf(parts[1], "%lu", &oldstamp) != 1) { - msg = g_strdup(_("Error: invalid PONG from server")); - } else { - msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); - } - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, parts[0], irc->account); - g_strfreev(parts); - if (convo) { - if (purple_conversation_get_type (convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "PONG", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), "PONG", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } else { - gc = purple_account_get_connection(irc->account); - if (!gc) { - g_free(msg); - return; - } - purple_notify_info(gc, NULL, "PONG", msg); - } - g_free(msg); -} - -void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!args || !args[0] || !args[1]) - return; - - irc_msg_handle_privmsg(irc, name, from, args[0], args[1], FALSE); -} - -static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const char *from, const char *to, const char *rawmsg, gboolean notice) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *tmp; - char *msg; - char *nick; - - if (!gc) - return; - - nick = irc_mask_nick(from); - tmp = irc_parse_ctcp(irc, nick, to, rawmsg, notice); - if (!tmp) { - g_free(nick); - return; - } - - msg = irc_escape_privmsg(tmp, -1); - g_free(tmp); - - tmp = irc_mirc2html(msg); - g_free(msg); - msg = tmp; - if (notice) { - tmp = g_strdup_printf("(notice) %s", msg); - g_free(msg); - msg = tmp; - } - - if (!purple_utf8_strcasecmp(to, purple_connection_get_display_name(gc))) { - serv_got_im(gc, nick, msg, 0, time(NULL)); - } else { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, irc_nick_skip_mode(irc, to), irc->account); - if (convo) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); - else - purple_debug_error("irc", "Got a %s on %s, which does not exist\n", - notice ? "NOTICE" : "PRIVMSG", to); - } - g_free(msg); - g_free(nick); -} - -void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *msg; - - if (!args || !args[1] || !args[2] || !gc) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (convo) { - /* This is a channel we're already in; for some reason, - * freenode feels the need to notify us that in some - * hypothetical other situation this might not have - * succeeded. Suppress that. */ - return; - } - - msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]); - purple_notify_error(gc, _("Cannot join channel"), msg, args[2]); - g_free(msg); -} - -void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - struct irc_buddy *ib; - char *data[2]; - - if (!args || !args[0] || !gc) - return; - - data[0] = irc_mask_nick(from); - data[1] = args[0]; - /* XXX this should have an API, I shouldn't grab this directly */ - g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data); - - if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) { - ib->flag = FALSE; - irc_buddy_status(data[0], ib, irc); - } - g_free(data[0]); - - return; -} - -void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[1]) - return; - - purple_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]); -} - -void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *nick, *msg; - - if (!args || !args[0] || !gc) - return; - - nick = irc_mask_nick(from); - msg = g_strdup_printf (_("Wallops from %s"), nick); - g_free(nick); - purple_notify_info(gc, NULL, msg, args[0]); - g_free(msg); -} - -void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - return; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/parse.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/parse.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/parse.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/irc/parse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,750 +0,0 @@ -/** - * @file parse.c - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "conversation.h" -#include "notify.h" -#include "debug.h" -#include "util.h" -#include "cmds.h" -#include "irc.h" - -#include -#include -#include - -static char *irc_send_convert(struct irc_conn *irc, const char *string); -static char *irc_recv_convert(struct irc_conn *irc, const char *string); - -static void irc_parse_error_cb(struct irc_conn *irc, char *input); - -static char *irc_mirc_colors[16] = { - "white", "black", "blue", "dark green", "red", "brown", "purple", - "orange", "yellow", "green", "teal", "cyan", "light blue", - "pink", "grey", "light grey" }; - -extern PurplePlugin *_irc_plugin; - -/*typedef void (*IRCMsgCallback)(struct irc_conn *irc, char *from, char *name, char **args);*/ -static struct _irc_msg { - char *name; - char *format; - void (*cb)(struct irc_conn *irc, const char *name, const char *from, char **args); -} _irc_msgs[] = { - { "005", "n*", irc_msg_features }, /* Feature list */ - { "251", "n:", irc_msg_luser }, /* Client & Server count */ - { "255", "n:", irc_msg_luser }, /* Client & Server count Mk. II */ - { "301", "nn:", irc_msg_away }, /* User is away */ - { "303", "n:", irc_msg_ison }, /* ISON reply */ - { "311", "nnvvv:", irc_msg_whois }, /* Whois user */ - { "312", "nnv:", irc_msg_whois }, /* Whois server */ - { "313", "nn:", irc_msg_whois }, /* Whois ircop */ - { "317", "nnvv", irc_msg_whois }, /* Whois idle */ - { "318", "nt:", irc_msg_endwhois }, /* End of WHOIS */ - { "319", "nn:", irc_msg_whois }, /* Whois channels */ - { "320", "nn:", irc_msg_whois }, /* Whois (fn ident) */ - { "314", "nnnvv:", irc_msg_whois }, /* Whowas user */ - { "369", "nt:", irc_msg_endwhois }, /* End of WHOWAS */ - { "321", "*", irc_msg_list }, /* Start of list */ - { "322", "ncv:", irc_msg_list }, /* List. */ - { "323", ":", irc_msg_list }, /* End of list. */ - { "324", "ncv:", irc_msg_chanmode }, /* Channel modes */ - { "331", "nc:", irc_msg_topic }, /* No channel topic */ - { "332", "nc:", irc_msg_topic }, /* Channel topic */ - { "333", "*", irc_msg_ignore }, /* Topic setter stuff */ - { "353", "nvc:", irc_msg_names }, /* Names list */ - { "366", "nc:", irc_msg_names }, /* End of names */ - { "367", "ncnnv", irc_msg_ban }, /* Ban list */ - { "368", "nc:", irc_msg_ban }, /* End of ban list */ - { "372", "n:", irc_msg_motd }, /* MOTD */ - { "375", "n:", irc_msg_motd }, /* Start MOTD */ - { "376", "n:", irc_msg_motd }, /* End of MOTD */ - { "391", "nv:", irc_msg_time }, /* Time reply */ - { "401", "nt:", irc_msg_nonick }, /* No such nick/chan */ - { "406", "nt:", irc_msg_nonick }, /* No such nick for WHOWAS */ - { "403", "nc:", irc_msg_nochan }, /* No such channel */ - { "404", "nt:", irc_msg_nosend }, /* Cannot send to chan */ - { "421", "nv:", irc_msg_unknown }, /* Unknown command */ - { "432", "vn:", irc_msg_badnick }, /* Erroneous nickname */ - { "433", "vn:", irc_msg_nickused }, /* Nickname already in use */ - { "437", "nc:", irc_msg_unavailable }, /* Nick/channel is unavailable */ - { "438", "nn:", irc_msg_nochangenick }, /* Nick may not change */ - { "442", "nc:", irc_msg_notinchan }, /* Not in channel */ - { "473", "nc:", irc_msg_inviteonly }, /* Tried to join invite-only */ - { "474", "nc:", irc_msg_banned }, /* Banned from channel */ - { "477", "nc:", irc_msg_regonly }, /* Registration Required */ - { "478", "nct:", irc_msg_banfull }, /* Banlist is full */ - { "482", "nc:", irc_msg_notop }, /* Need to be op to do that */ - { "501", "n:", irc_msg_badmode }, /* Unknown mode flag */ - { "506", "nc:", irc_msg_nosend }, /* Must identify to send */ - { "515", "nc:", irc_msg_regonly }, /* Registration required */ - { "invite", "n:", irc_msg_invite }, /* Invited */ - { "join", ":", irc_msg_join }, /* Joined a channel */ - { "kick", "cn:", irc_msg_kick }, /* KICK */ - { "mode", "tv:", irc_msg_mode }, /* MODE for channel */ - { "nick", ":", irc_msg_nick }, /* Nick change */ - { "notice", "t:", irc_msg_notice }, /* NOTICE recv */ - { "part", "c:", irc_msg_part }, /* Parted a channel */ - { "ping", ":", irc_msg_ping }, /* Received PING from server */ - { "pong", "v:", irc_msg_pong }, /* Received PONG from server */ - { "privmsg", "t:", irc_msg_privmsg }, /* Received private message */ - { "topic", "c:", irc_msg_topic }, /* TOPIC command */ - { "quit", ":", irc_msg_quit }, /* QUIT notice */ - { "wallops", ":", irc_msg_wallops }, /* WALLOPS command */ - { NULL, NULL, NULL } -}; - -static struct _irc_user_cmd { - char *name; - char *format; - IRCCmdCallback cb; - char *help; -} _irc_cmds[] = { - { "action", ":", irc_cmd_ctcp_action, N_("action <action to perform>: Perform an action.") }, - { "away", ":", irc_cmd_away, N_("away [message]: Set an away message, or use no message to return from being away.") }, - { "ctcp", "t:", irc_cmd_ctcp, N_("ctcp : sends ctcp msg to nick.") }, - { "chanserv", ":", irc_cmd_service, N_("chanserv: Send a command to chanserv") }, - { "deop", ":", irc_cmd_op, N_("deop <nick1> [nick2] ...: Remove channel operator status from someone. You must be a channel operator to do this.") }, - { "devoice", ":", irc_cmd_op, N_("devoice <nick1> [nick2] ...: Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this.") }, - { "invite", ":", irc_cmd_invite, N_("invite <nick> [room]: Invite someone to join you in the specified channel, or the current channel.") }, - { "j", "cv", irc_cmd_join, N_("j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed.") }, - { "join", "cv", irc_cmd_join, N_("join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed.") }, - { "kick", "n:", irc_cmd_kick, N_("kick <nick> [message]: Remove someone from a channel. You must be a channel operator to do this.") }, - { "list", ":", irc_cmd_list, N_("list: Display a list of chat rooms on the network. Warning, some servers may disconnect you upon doing this.") }, - { "me", ":", irc_cmd_ctcp_action, N_("me <action to perform>: Perform an action.") }, - { "memoserv", ":", irc_cmd_service, N_("memoserv: Send a command to memoserv") }, - { "mode", ":", irc_cmd_mode, N_("mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel or user mode.") }, - { "msg", "t:", irc_cmd_privmsg, N_("msg <nick> <message>: Send a private message to a user (as opposed to a channel).") }, - { "names", "c", irc_cmd_names, N_("names [channel]: List the users currently in a channel.") }, - { "nick", "n", irc_cmd_nick, N_("nick <new nickname>: Change your nickname.") }, - { "nickserv", ":", irc_cmd_service, N_("nickserv: Send a command to nickserv") }, - { "notice", "t:", irc_cmd_privmsg, N_("notice <target<: Send a notice to a user or channel.") }, - { "op", ":", irc_cmd_op, N_("op <nick1> [nick2] ...: Grant channel operator status to someone. You must be a channel operator to do this.") }, - { "operwall", ":", irc_cmd_wallops, N_("operwall <message>: If you don't know what this is, you probably can't use it.") }, - { "operserv", ":", irc_cmd_service, N_("operserv: Send a command to operserv") }, - { "part", "c:", irc_cmd_part, N_("part [room] [message]: Leave the current channel, or a specified channel, with an optional message.") }, - { "ping", "n", irc_cmd_ping, N_("ping [nick]: Asks how much lag a user (or the server if no user specified) has.") }, - { "query", "n:", irc_cmd_query, N_("query <nick> <message>: Send a private message to a user (as opposed to a channel).") }, - { "quit", ":", irc_cmd_quit, N_("quit [message]: Disconnect from the server, with an optional message.") }, - { "quote", "*", irc_cmd_quote, N_("quote [...]: Send a raw command to the server.") }, - { "remove", "n:", irc_cmd_remove, N_("remove <nick> [message]: Remove someone from a room. You must be a channel operator to do this.") }, - { "time", "", irc_cmd_time, N_("time: Displays the current local time at the IRC server.") }, - { "topic", ":", irc_cmd_topic, N_("topic [new topic]: View or change the channel topic.") }, - { "umode", ":", irc_cmd_mode, N_("umode <+|-><A-Za-z>: Set or unset a user mode.") }, - { "version", ":", irc_cmd_ctcp_version, N_("version [nick]: send CTCP VERSION request to a user") }, - { "voice", ":", irc_cmd_op, N_("voice <nick1> [nick2] ...: Grant channel voice status to someone. You must be a channel operator to do this.") }, - { "wallops", ":", irc_cmd_wallops, N_("wallops <message>: If you don't know what this is, you probably can't use it.") }, - { "whois", "tt", irc_cmd_whois, N_("whois [server] <nick>: Get information on a user.") }, - { "whowas", "t", irc_cmd_whowas, N_("whowas <nick>: Get information on a user that has logged off.") }, - { NULL, NULL, NULL, NULL } -}; - -static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **error, void *data) -{ - PurpleConnection *gc; - struct irc_conn *irc; - struct _irc_user_cmd *cmdent; - - gc = purple_conversation_get_gc(conv); - if (!gc) - return PURPLE_CMD_RET_FAILED; - - irc = gc->proto_data; - - if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL) - return PURPLE_CMD_RET_FAILED; - - (cmdent->cb)(irc, cmd, purple_conversation_get_name(conv), (const char **)args); - - return PURPLE_CMD_RET_OK; -} - -static void irc_register_command(struct _irc_user_cmd *c) -{ - PurpleCmdFlag f; - char args[10]; - char *format; - size_t i; - - f = PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY - | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS; - - format = c->format; - - for (i = 0; (i < (sizeof(args) - 1)) && *format; i++, format++) - switch (*format) { - case 'v': - case 'n': - case 'c': - case 't': - args[i] = 'w'; - break; - case ':': - case '*': - args[i] = 's'; - break; - } - - args[i] = '\0'; - - purple_cmd_register(c->name, args, PURPLE_CMD_P_PRPL, f, "prpl-irc", - irc_parse_purple_cmd, _(c->help), NULL); -} - -void irc_register_commands(void) -{ - struct _irc_user_cmd *c; - - for (c = _irc_cmds; c && c->name; c++) - irc_register_command(c); -} - -static char *irc_send_convert(struct irc_conn *irc, const char *string) -{ - char *utf8; - GError *err = NULL; - gchar **encodings; - const gchar *enclist; - - enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); - encodings = g_strsplit(enclist, ",", 2); - - if (encodings[0] == NULL || !g_ascii_strcasecmp("UTF-8", encodings[0])) { - g_strfreev(encodings); - return NULL; - } - - utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err); - if (err) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message); - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]); - utf8 = g_strdup(string); - g_error_free(err); - } - g_strfreev(encodings); - - return utf8; -} - -static char *irc_recv_convert(struct irc_conn *irc, const char *string) -{ - char *utf8 = NULL; - const gchar *charset, *enclist; - gchar **encodings; - gboolean autodetect; - int i; - - enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); - encodings = g_strsplit(enclist, ",", -1); - - if (encodings[0] == NULL) { - g_strfreev(encodings); - return purple_utf8_salvage(string); - } - - autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); - - if (autodetect && g_utf8_validate(string, -1, NULL)) { - return g_strdup(string); - } - - for (i = 0; encodings[i] != NULL; i++) { - charset = encodings[i]; - while (*charset == ' ') - charset++; - - if (!g_ascii_strcasecmp("UTF-8", charset)) { - if (g_utf8_validate(string, -1, NULL)) - utf8 = g_strdup(string); - } else { - utf8 = g_convert(string, -1, "UTF-8", charset, NULL, NULL, NULL); - } - - if (utf8) { - g_strfreev(encodings); - return utf8; - } - } - g_strfreev(encodings); - - return purple_utf8_salvage(string); -} - -/* This function is shamelessly stolen from glib--it is an old version of the - * private function append_escaped_text, used by g_markup_escape_text, whose - * behavior changed in glib 2.12. */ -static void irc_append_escaped_text(GString *str, const char *text, gssize length) -{ - const char *p = text; - const char *end = text + length; - const char *next = NULL; - - while(p != end) { - next = g_utf8_next_char(p); - - switch(*p) { - case '&': - g_string_append(str, "&"); - break; - case '<': - g_string_append(str, "<"); - break; - case '>': - g_string_append(str, ">"); - break; - case '\'': - g_string_append(str, "'"); - break; - case '"': - g_string_append(str, """); - break; - default: - g_string_append_len(str, p, next - p); - break; - } - - p = next; - } -} - -/* This function is shamelessly stolen from glib--it is an old version of the - * function g_markup_escape_text, whose behavior changed in glib 2.12. */ -char *irc_escape_privmsg(const char *text, gssize length) -{ - GString *str; - - g_return_val_if_fail(text != NULL, NULL); - - if(length < 0) - length = strlen(text); - - str = g_string_sized_new(length); - - irc_append_escaped_text(str, text, length); - - return g_string_free(str, FALSE); -} - -/* XXX tag closings are not necessarily correctly nested here! If we - * get a ^O or reach the end of the string and there are open - * tags, they are closed in a fixed order ... this means, for - * example, you might see some text with - * various attributes (notice that B and FONT overlap - * and are not cleanly nested). This is imminently fixable but - * I am not fixing it right now. - */ -char *irc_mirc2html(const char *string) -{ - const char *cur, *end; - char fg[3] = "\0\0", bg[3] = "\0\0"; - int fgnum, bgnum; - int font = 0, bold = 0, underline = 0, italic = 0; - GString *decoded; - - if (string == NULL) - return NULL; - - decoded = g_string_sized_new(strlen(string)); - - cur = string; - do { - end = strpbrk(cur, "\002\003\007\017\026\037"); - - decoded = g_string_append_len(decoded, cur, end ? end - cur : strlen(cur)); - cur = end ? end : cur + strlen(cur); - - switch (*cur) { - case '\002': - cur++; - if (!bold) { - decoded = g_string_append(decoded, ""); - bold = TRUE; - } else { - decoded = g_string_append(decoded, ""); - bold = FALSE; - } - break; - case '\003': - cur++; - fg[0] = fg[1] = bg[0] = bg[1] = '\0'; - if (isdigit(*cur)) - fg[0] = *cur++; - if (isdigit(*cur)) - fg[1] = *cur++; - if (*cur == ',') { - cur++; - if (isdigit(*cur)) - bg[0] = *cur++; - if (isdigit(*cur)) - bg[1] = *cur++; - } - if (font) { - decoded = g_string_append(decoded, ""); - font = FALSE; - } - - if (fg[0]) { - fgnum = atoi(fg); - if (fgnum < 0 || fgnum > 15) - continue; - font = TRUE; - g_string_append_printf(decoded, "= 0 && bgnum < 16) - g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); - } - decoded = g_string_append_c(decoded, '>'); - } - break; - case '\011': - cur++; - if (!italic) { - decoded = g_string_append(decoded, ""); - italic = TRUE; - } else { - decoded = g_string_append(decoded, ""); - italic = FALSE; - } - break; - case '\037': - cur++; - if (!underline) { - decoded = g_string_append(decoded, ""); - underline = TRUE; - } else { - decoded = g_string_append(decoded, ""); - underline = FALSE; - } - break; - case '\007': - case '\026': - cur++; - break; - case '\017': - cur++; - /* fallthrough */ - case '\000': - if (bold) - decoded = g_string_append(decoded, ""); - if (italic) - decoded = g_string_append(decoded, ""); - if (underline) - decoded = g_string_append(decoded, ""); - if (font) - decoded = g_string_append(decoded, ""); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur); - } - } while (*cur); - - return g_string_free(decoded, FALSE); -} - -char *irc_mirc2txt (const char *string) -{ - char *result; - int i, j; - - if (string == NULL) - return NULL; - - result = g_strdup (string); - - for (i = 0, j = 0; result[i]; i++) { - switch (result[i]) { - case '\002': - case '\003': - /* Foreground color */ - if (isdigit(result[i + 1])) - i++; - if (isdigit(result[i + 1])) - i++; - /* Optional comma and background color */ - if (result[i + 1] == ',') { - i++; - if (isdigit(result[i + 1])) - i++; - if (isdigit(result[i + 1])) - i++; - } - /* Note that i still points to the last character - * of the color selection string. */ - continue; - case '\007': - case '\017': - case '\026': - case '\037': - continue; - default: - result[j++] = result[i]; - } - } - result[j] = '\0'; - return result; -} - -const char *irc_nick_skip_mode(struct irc_conn *irc, const char *nick) -{ - static const char *default_modes = "@+%&"; - const char *mode_chars; - - mode_chars = irc->mode_chars ? irc->mode_chars : default_modes; - - while (strchr(mode_chars, *nick) != NULL) - nick++; - - return nick; -} - -gboolean irc_ischannel(const char *string) -{ - return (string[0] == '#' || string[0] == '&'); -} - -char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice) -{ - PurpleConnection *gc; - const char *cur = msg + 1; - char *buf, *ctcp; - time_t timestamp; - - /* Note that this is NOT correct w.r.t. multiple CTCPs in one - * message and low-level quoting ... but if you want that crap, - * use a real IRC client. */ - - if (msg[0] != '\001' || msg[strlen(msg) - 1] != '\001') - return g_strdup(msg); - - if (!strncmp(cur, "ACTION ", 7)) { - cur += 7; - buf = g_strdup_printf("/me %s", cur); - buf[strlen(buf) - 1] = '\0'; - return buf; - } else if (!strncmp(cur, "PING ", 5)) { - if (notice) { /* reply */ - /* TODO: Should this read in the timestamp as a double? */ - sscanf(cur, "PING %lu", ×tamp); - gc = purple_account_get_connection(irc->account); - if (!gc) - return NULL; - buf = g_strdup_printf(_("Reply time from %s: %lu seconds"), from, time(NULL) - timestamp); - purple_notify_info(gc, _("PONG"), _("CTCP PING reply"), buf); - g_free(buf); - return NULL; - } else { - buf = irc_format(irc, "vt:", "NOTICE", from, msg); - irc_send(irc, buf); - g_free(buf); - } - } else if (!strncmp(cur, "VERSION", 7) && !notice) { - buf = irc_format(irc, "vt:", "NOTICE", from, "\001VERSION Purple IRC\001"); - irc_send(irc, buf); - g_free(buf); - } else if (!strncmp(cur, "DCC SEND ", 9)) { - irc_dccsend_recv(irc, from, msg + 10); - return NULL; - } - - ctcp = g_strdup(msg + 1); - ctcp[strlen(ctcp) - 1] = '\0'; - buf = g_strdup_printf("Received CTCP '%s' (to %s) from %s", ctcp, to, from); - g_free(ctcp); - return buf; -} - -void irc_msg_table_build(struct irc_conn *irc) -{ - int i; - - if (!irc || !irc->msgs) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a message table on a bogus structure\n"); - return; - } - - for (i = 0; _irc_msgs[i].name; i++) { - g_hash_table_insert(irc->msgs, (gpointer)_irc_msgs[i].name, (gpointer)&_irc_msgs[i]); - } -} - -void irc_cmd_table_build(struct irc_conn *irc) -{ - int i; - - if (!irc || !irc->cmds) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a command table on a bogus structure\n"); - return; - } - - for (i = 0; _irc_cmds[i].name ; i++) { - g_hash_table_insert(irc->cmds, (gpointer)_irc_cmds[i].name, (gpointer)&_irc_cmds[i]); - } -} - -char *irc_format(struct irc_conn *irc, const char *format, ...) -{ - GString *string = g_string_new(""); - char *tok, *tmp; - const char *cur; - va_list ap; - - va_start(ap, format); - for (cur = format; *cur; cur++) { - if (cur != format) - g_string_append_c(string, ' '); - - tok = va_arg(ap, char *); - switch (*cur) { - case 'v': - g_string_append(string, tok); - break; - case ':': - g_string_append_c(string, ':'); - /* no break! */ - case 't': - case 'n': - case 'c': - tmp = irc_send_convert(irc, tok); - g_string_append(string, tmp ? tmp : tok); - g_free(tmp); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Invalid format character '%c'\n", *cur); - break; - } - } - va_end(ap); - g_string_append(string, "\r\n"); - return (g_string_free(string, FALSE)); -} - -void irc_parse_msg(struct irc_conn *irc, char *input) -{ - struct _irc_msg *msgent; - char *cur, *end, *tmp, *from, *msgname, *fmt, **args, *msg; - guint i; - PurpleConnection *gc = purple_account_get_connection(irc->account); - - irc->recv_time = time(NULL); - - /* - * The data passed to irc-receiving-text is the raw protocol data. - * TODO: It should be passed as an array of bytes and a length - * instead of a null terminated string. - */ - purple_signal_emit(_irc_plugin, "irc-receiving-text", gc, &input); - - if (!strncmp(input, "PING ", 5)) { - msg = irc_format(irc, "vv", "PONG", input + 5); - irc_send(irc, msg); - g_free(msg); - return; - } else if (!strncmp(input, "ERROR ", 6)) { - if (g_utf8_validate(input, -1, NULL)) { - char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } else - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected.")); - return; - } - - if (input[0] != ':' || (cur = strchr(input, ' ')) == NULL) { - irc_parse_error_cb(irc, input); - return; - } - - from = g_strndup(&input[1], cur - &input[1]); - cur++; - end = strchr(cur, ' '); - if (!end) - end = cur + strlen(cur); - - tmp = g_strndup(cur, end - cur); - msgname = g_ascii_strdown(tmp, -1); - g_free(tmp); - - if ((msgent = g_hash_table_lookup(irc->msgs, msgname)) == NULL) { - irc_msg_default(irc, "", from, &input); - g_free(msgname); - g_free(from); - return; - } - g_free(msgname); - - args = g_new0(char *, strlen(msgent->format)); - for (cur = end, fmt = msgent->format, i = 0; fmt[i] && *cur++; i++) { - switch (fmt[i]) { - case 'v': - if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); - args[i] = g_strndup(cur, end - cur); - cur += end - cur; - break; - case 't': - case 'n': - case 'c': - if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); - tmp = g_strndup(cur, end - cur); - args[i] = irc_recv_convert(irc, tmp); - g_free(tmp); - cur += end - cur; - break; - case ':': - if (*cur == ':') cur++; - args[i] = irc_recv_convert(irc, cur); - cur = cur + strlen(cur); - break; - case '*': - args[i] = g_strdup(cur); - cur = cur + strlen(cur); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid message format character '%c'\n", fmt[i]); - break; - } - } - tmp = irc_recv_convert(irc, from); - (msgent->cb)(irc, msgent->name, tmp, args); - g_free(tmp); - for (i = 0; i < strlen(msgent->format); i++) { - g_free(args[i]); - } - g_free(args); - g_free(from); -} - -static void irc_parse_error_cb(struct irc_conn *irc, char *input) -{ - char *clean; - /* This really should be escaped somehow that you can tell what - * the junk was -- but as it is, it can crash glib. */ - clean = purple_utf8_salvage(input); - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", clean); - g_free(clean); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "adhoccommands.h" -#include -#include "internal.h" -#include "xdata.h" -#include "iq.h" -#include "request.h" - -static void do_adhoc_ignoreme(JabberStream *js, ...) { - /* we don't have to do anything */ -} - -typedef struct _JabberAdHocActionInfo { - char *sessionid; - char *who; - char *node; - GList *actionslist; -} JabberAdHocActionInfo; - -static void -jabber_adhoc_got_buddy_list(JabberStream *js, const char *from, xmlnode *query) -{ - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - xmlnode *item; - - if ((jid = jabber_id_new(from))) { - if (jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(!jbr) - return; - - if(jbr->commands) { - /* since the list we just received is complete, wipe the old one */ - while(jbr->commands) { - JabberAdHocCommands *cmd = jbr->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); - } - } - - for(item = query->child; item; item = item->next) { - JabberAdHocCommands *cmd; - if(item->type != XMLNODE_TYPE_TAG) - continue; - if(strcmp(item->name, "item")) - continue; - cmd = g_new0(JabberAdHocCommands, 1); - - cmd->jid = g_strdup(xmlnode_get_attrib(item,"jid")); - cmd->node = g_strdup(xmlnode_get_attrib(item,"node")); - cmd->name = g_strdup(xmlnode_get_attrib(item,"name")); - - jbr->commands = g_list_append(jbr->commands,cmd); - } -} - -void -jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query; - const char *node; - - if (type == JABBER_IQ_ERROR) - return; - - query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS); - if (!query) - return; - node = xmlnode_get_attrib(query, "node"); - if (!purple_strequal(node, "http://jabber.org/protocol/commands")) - return; - - jabber_adhoc_got_buddy_list(js, from, query); -} - -static void jabber_adhoc_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -static void do_adhoc_action_cb(JabberStream *js, xmlnode *result, const char *actionhandle, gpointer user_data) { - xmlnode *command; - GList *action; - JabberAdHocActionInfo *actionInfo = user_data; - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - jabber_iq_set_callback(iq, jabber_adhoc_parse, NULL); - - xmlnode_set_attrib(iq->node, "to", actionInfo->who); - command = xmlnode_new_child(iq->node,"command"); - xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); - xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid); - xmlnode_set_attrib(command,"node",actionInfo->node); - - /* cancel is handled differently on ad-hoc commands than regular forms */ - if(!strcmp(xmlnode_get_namespace(result),"jabber:x:data") && !strcmp(xmlnode_get_attrib(result, "type"),"cancel")) { - xmlnode_set_attrib(command,"action","cancel"); - } else { - if(actionhandle) - xmlnode_set_attrib(command,"action",actionhandle); - xmlnode_insert_child(command,result); - } - - for(action = actionInfo->actionslist; action; action = g_list_next(action)) { - char *handle = action->data; - g_free(handle); - } - g_list_free(actionInfo->actionslist); - g_free(actionInfo->sessionid); - g_free(actionInfo->who); - g_free(actionInfo->node); - - jabber_iq_send(iq); -} - -static void -jabber_adhoc_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *command = xmlnode_get_child_with_namespace(packet, "command", "http://jabber.org/protocol/commands"); - const char *status = xmlnode_get_attrib(command,"status"); - xmlnode *xdata = xmlnode_get_child_with_namespace(command,"x","jabber:x:data"); - - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - if(!msg) - msg = g_strdup(_("Unknown Error")); - - purple_notify_error(NULL, _("Ad-Hoc Command Failed"), - _("Ad-Hoc Command Failed"), msg); - g_free(msg); - return; - } - - if(!status) - return; - - if(!strcmp(status,"completed")) { - /* display result */ - xmlnode *note = xmlnode_get_child(command,"note"); - - if(note) { - char *data = xmlnode_get_data(note); - purple_notify_info(NULL, from, data, NULL); - g_free(data); - } - - if(xdata) - jabber_x_data_request(js, xdata, (jabber_x_data_cb)do_adhoc_ignoreme, NULL); - return; - } - if(!strcmp(status,"executing")) { - /* this command needs more steps */ - xmlnode *actions, *action; - int actionindex = 0; - GList *actionslist = NULL; - JabberAdHocActionInfo *actionInfo; - if(!xdata) - return; /* shouldn't happen */ - - actions = xmlnode_get_child(command,"actions"); - if(!actions) { - JabberXDataAction *defaultaction = g_new0(JabberXDataAction, 1); - defaultaction->name = g_strdup(_("execute")); - defaultaction->handle = g_strdup("execute"); - actionslist = g_list_append(actionslist, defaultaction); - } else { - const char *defaultactionhandle = xmlnode_get_attrib(actions, "execute"); - int index = 0; - for(action = actions->child; action; action = action->next, ++index) { - if(action->type == XMLNODE_TYPE_TAG) { - JabberXDataAction *newaction = g_new0(JabberXDataAction, 1); - newaction->name = g_strdup(_(action->name)); - newaction->handle = g_strdup(action->name); - actionslist = g_list_append(actionslist, newaction); - if(defaultactionhandle && !strcmp(defaultactionhandle, action->name)) - actionindex = index; - } - } - } - - actionInfo = g_new0(JabberAdHocActionInfo, 1); - actionInfo->sessionid = g_strdup(xmlnode_get_attrib(command,"sessionid")); - actionInfo->who = g_strdup(from); - actionInfo->node = g_strdup(xmlnode_get_attrib(command,"node")); - actionInfo->actionslist = actionslist; - - jabber_x_data_request_with_actions(js,xdata,actionslist,actionindex,do_adhoc_action_cb,actionInfo); - } -} - -void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data) { - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - JabberAdHocCommands *cmd = data; - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleAccount *account = purple_buddy_get_account(buddy); - JabberStream *js = purple_account_get_connection(account)->proto_data; - - jabber_adhoc_execute(js, cmd); - } -} - -static void -jabber_adhoc_got_server_list(JabberStream *js, const char *from, xmlnode *query) -{ - xmlnode *item; - - if(!query) - return; - - /* clean current list (just in case there is one) */ - while(js->commands) { - JabberAdHocCommands *cmd = js->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - js->commands = g_list_delete_link(js->commands, js->commands); - } - - /* re-fill list */ - for(item = query->child; item; item = item->next) { - JabberAdHocCommands *cmd; - if(item->type != XMLNODE_TYPE_TAG) - continue; - if(strcmp(item->name, "item")) - continue; - cmd = g_new0(JabberAdHocCommands, 1); - cmd->jid = g_strdup(xmlnode_get_attrib(item,"jid")); - cmd->node = g_strdup(xmlnode_get_attrib(item,"node")); - cmd->name = g_strdup(xmlnode_get_attrib(item,"name")); - - js->commands = g_list_append(js->commands,cmd); - } - - if (js->state == JABBER_STREAM_CONNECTED) - purple_prpl_got_account_actions(purple_connection_get_account(js->gc)); -} - -static void -jabber_adhoc_server_got_list_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_DISCO_ITEMS); - - jabber_adhoc_got_server_list(js, from, query); - -} - -void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query) -{ - if (purple_strequal(from, js->user->domain)) { - jabber_adhoc_got_server_list(js, from, query); - } else { - jabber_adhoc_got_buddy_list(js, from, query); - } -} - -void jabber_adhoc_server_get_list(JabberStream *js) { - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", - NS_DISCO_ITEMS); - - xmlnode_set_attrib(iq->node,"to",js->user->domain); - xmlnode_set_attrib(query,"node","http://jabber.org/protocol/commands"); - - jabber_iq_set_callback(iq,jabber_adhoc_server_got_list_cb,NULL); - jabber_iq_send(iq); -} - -void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode *command = xmlnode_new_child(iq->node,"command"); - xmlnode_set_attrib(iq->node,"to",cmd->jid); - xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); - xmlnode_set_attrib(command,"node",cmd->node); - xmlnode_set_attrib(command,"action","execute"); - - jabber_iq_set_callback(iq,jabber_adhoc_parse,NULL); - - jabber_iq_send(iq); -} - -static void jabber_adhoc_server_execute(PurplePluginAction *action) { - JabberAdHocCommands *cmd = action->user_data; - if(cmd) { - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; - - jabber_adhoc_execute(js, cmd); - } -} - -void jabber_adhoc_init_server_commands(JabberStream *js, GList **m) { - GList *cmdlst; - JabberBuddy *jb; - - /* also add commands for other clients connected to the same account on another resource */ - char *accountname = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - if((jb = jabber_buddy_find(js, accountname, TRUE))) { - GList *iter; - for(iter = jb->resources; iter; iter = g_list_next(iter)) { - JabberBuddyResource *jbr = iter->data; - GList *riter; - for(riter = jbr->commands; riter; riter = g_list_next(riter)) { - JabberAdHocCommands *cmd = riter->data; - char *cmdname = g_strdup_printf("%s (%s)",cmd->name,jbr->name); - PurplePluginAction *act = purple_plugin_action_new(cmdname, jabber_adhoc_server_execute); - act->user_data = cmd; - *m = g_list_append(*m, act); - g_free(cmdname); - } - } - } - g_free(accountname); - - /* now add server commands */ - for(cmdlst = js->commands; cmdlst; cmdlst = g_list_next(cmdlst)) { - JabberAdHocCommands *cmd = cmdlst->data; - PurplePluginAction *act = purple_plugin_action_new(cmd->name, jabber_adhoc_server_execute); - act->user_data = cmd; - *m = g_list_append(*m, act); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/adhoccommands.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_ADHOCCOMMANDS_H_ -#define PURPLE_JABBER_ADHOCCOMMANDS_H_ - -#include "jabber.h" - -/* Implementation of XEP-0050 */ - -void jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd); - -void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data); - -void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query); - -void jabber_adhoc_server_get_list(JabberStream *js); - -void jabber_adhoc_init_server_commands(JabberStream *js, GList **m); - -#endif /* PURPLE_JABBER_ADHOCCOMMANDS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1130 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "debug.h" -#include "cipher.h" -#include "core.h" -#include "conversation.h" -#include "request.h" -#include "sslconn.h" -#include "util.h" -#include "xmlnode.h" - -#include "auth.h" -#include "disco.h" -#include "jabber.h" -#include "jutil.h" -#include "iq.h" -#include "notify.h" - -static void auth_old_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -gboolean -jabber_process_starttls(JabberStream *js, xmlnode *packet) -{ - xmlnode *starttls; - - if((starttls = xmlnode_get_child(packet, "starttls"))) { - if(purple_ssl_is_supported()) { - jabber_send_raw(js, - "", -1); - return TRUE; - } else if(xmlnode_get_child(starttls, "required")) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Server requires TLS/SSL, but no TLS/SSL support was found.")); - return TRUE; - } else if(purple_account_get_bool(js->gc->account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("You require encryption, but no TLS/SSL support was found.")); - return TRUE; - } - } - - return FALSE; -} - -static void finish_plaintext_authentication(JabberStream *js) -{ - if(js->auth_type == JABBER_AUTH_PLAIN) { - xmlnode *auth; - GString *response; - gchar *enc_out; - - auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl"); - - xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); - xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); - - response = g_string_new(""); - response = g_string_append_len(response, "\0", 1); - response = g_string_append(response, js->user->node); - response = g_string_append_len(response, "\0", 1); - response = g_string_append(response, - purple_connection_get_password(js->gc)); - - enc_out = purple_base64_encode((guchar *)response->str, response->len); - - xmlnode_set_attrib(auth, "mechanism", "PLAIN"); - xmlnode_insert_data(auth, enc_out, -1); - g_free(enc_out); - g_string_free(response, TRUE); - - jabber_send(js, auth); - xmlnode_free(auth); - } else if(js->auth_type == JABBER_AUTH_IQ_AUTH) { - JabberIq *iq; - xmlnode *query, *x; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - x = xmlnode_new_child(query, "password"); - xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1); - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - jabber_iq_send(iq); - } -} - -static void allow_plaintext_auth(PurpleAccount *account) -{ - purple_account_set_bool(account, "auth_plain_in_clear", TRUE); - - finish_plaintext_authentication(account->gc->proto_data); -} - -static void disallow_plaintext_auth(PurpleAccount *account) -{ - purple_connection_error_reason(account->gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Server requires plaintext authentication over an unencrypted stream")); -} - -#ifdef HAVE_CYRUS_SASL - -static void jabber_auth_start_cyrus(JabberStream *); -static void jabber_sasl_build_callbacks(JabberStream *); - -/* Callbacks for Cyrus SASL */ - -static int jabber_sasl_cb_realm(void *ctx, int id, const char **avail, const char **result) -{ - JabberStream *js = (JabberStream *)ctx; - - if (id != SASL_CB_GETREALM || !result) return SASL_BADPARAM; - - *result = js->user->domain; - - return SASL_OK; -} - -static int jabber_sasl_cb_simple(void *ctx, int id, const char **res, unsigned *len) -{ - JabberStream *js = (JabberStream *)ctx; - - switch(id) { - case SASL_CB_AUTHNAME: - *res = js->user->node; - break; - case SASL_CB_USER: - *res = ""; - break; - default: - return SASL_BADPARAM; - } - if (len) *len = strlen((char *)*res); - return SASL_OK; -} - -static int jabber_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret) -{ - JabberStream *js = (JabberStream *)ctx; - const char *pw = purple_account_get_password(js->gc->account); - size_t len; - static sasl_secret_t *x = NULL; - - if (!conn || !secret || id != SASL_CB_PASS) - return SASL_BADPARAM; - - len = strlen(pw); - x = (sasl_secret_t *) realloc(x, sizeof(sasl_secret_t) + len); - - if (!x) - return SASL_NOMEM; - - x->len = len; - strcpy((char*)x->data, pw); - - *secret = x; - return SASL_OK; -} - -static void allow_cyrus_plaintext_auth(PurpleAccount *account) -{ - purple_account_set_bool(account, "auth_plain_in_clear", TRUE); - - jabber_auth_start_cyrus(account->gc->proto_data); -} - -static gboolean auth_pass_generic(JabberStream *js, PurpleRequestFields *fields) -{ - const char *entry; - gboolean remember; - - entry = purple_request_fields_get_string(fields, "password"); - remember = purple_request_fields_get_bool(fields, "remember"); - - if (!entry || !*entry) - { - purple_notify_error(js->gc->account, NULL, _("Password is required to sign on."), NULL); - return FALSE; - } - - if (remember) - purple_account_set_remember_password(js->gc->account, TRUE); - - purple_account_set_password(js->gc->account, entry); - - return TRUE; -} - -static void auth_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields) -{ - JabberStream *js; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(conn)) - return; - - js = conn->proto_data; - - if (!auth_pass_generic(js, fields)) - return; - - /* Rebuild our callbacks as we now have a password to offer */ - jabber_sasl_build_callbacks(js); - - /* Restart our connection */ - jabber_auth_start_cyrus(js); -} - -static void -auth_old_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields) -{ - JabberStream *js; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(conn)) - return; - - js = conn->proto_data; - - if (!auth_pass_generic(js, fields)) - return; - - /* Restart our connection */ - jabber_auth_start_old(js); -} - - -static void -auth_no_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields) -{ - JabberStream *js; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(conn)) - return; - - js = conn->proto_data; - - /* Disable the account as the user has canceled connecting */ - purple_account_set_enabled(conn->account, purple_core_get_ui(), FALSE); -} - -static void jabber_auth_start_cyrus(JabberStream *js) -{ - const char *clientout = NULL; - char *enc_out; - unsigned coutlen = 0; - xmlnode *auth; - sasl_security_properties_t secprops; - gboolean again; - gboolean plaintext = TRUE; - - /* Set up security properties and options */ - secprops.min_ssf = 0; - secprops.security_flags = SASL_SEC_NOANONYMOUS; - - if (!jabber_stream_is_ssl(js)) { - secprops.max_ssf = -1; - secprops.maxbufsize = 4096; - plaintext = purple_account_get_bool(js->gc->account, "auth_plain_in_clear", FALSE); - if (!plaintext) - secprops.security_flags |= SASL_SEC_NOPLAINTEXT; - } else { - secprops.max_ssf = 0; - secprops.maxbufsize = 0; - plaintext = TRUE; - } - secprops.property_names = 0; - secprops.property_values = 0; - - do { - again = FALSE; - - js->sasl_state = sasl_client_new("xmpp", js->serverFQDN, NULL, NULL, js->sasl_cb, 0, &js->sasl); - if (js->sasl_state==SASL_OK) { - sasl_setprop(js->sasl, SASL_SEC_PROPS, &secprops); - purple_debug_info("sasl", "Mechs found: %s\n", js->sasl_mechs->str); - js->sasl_state = sasl_client_start(js->sasl, js->sasl_mechs->str, NULL, &clientout, &coutlen, &js->current_mech); - } - switch (js->sasl_state) { - /* Success */ - case SASL_OK: - case SASL_CONTINUE: - break; - case SASL_NOMECH: - /* No mechanisms have offered to help */ - - /* Firstly, if we don't have a password try - * to get one - */ - - if (!purple_account_get_password(js->gc->account)) { - purple_account_request_password(js->gc->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); - return; - - /* If we've got a password, but aren't sending - * it in plaintext, see if we can turn on - * plaintext auth - */ - } else if (!plaintext) { - char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), - js->gc->account->username); - purple_request_yes_no(js->gc, _("Plaintext Authentication"), - _("Plaintext Authentication"), - msg, - 1, js->gc->account, NULL, NULL, js->gc->account, - allow_cyrus_plaintext_auth, - disallow_plaintext_auth); - g_free(msg); - return; - - } else { - /* We have no mechs which can work. - * Try falling back on the old jabber:iq:auth method. We get here if the server supports - * one or more sasl mechs, we are compiled with cyrus-sasl support, but we support or can connect with none of - * the offerred mechs. jabberd 2.0 w/ SASL and Apple's iChat Server 10.5 both handle and expect - * jabber:iq:auth in this situation. iChat Server in particular offers SASL GSSAPI by default, which is often - * not configured on the client side, and expects a fallback to jabber:iq:auth when it (predictably) fails. - * - * Note: xep-0078 points out that using jabber:iq:auth after a sasl failure is wrong. However, - * I believe this refers to actual authentication failure, not a simple lack of concordant mechanisms. - * Doing otherwise means that simply compiling with SASL support renders the client unable to connect to servers - * which would connect without issue otherwise. -evands - */ - js->auth_type = JABBER_AUTH_IQ_AUTH; - jabber_auth_start_old(js); - return; - } - /* not reached */ - break; - - /* Fatal errors. Give up and go home */ - case SASL_BADPARAM: - case SASL_NOMEM: - break; - - /* For everything else, fail the mechanism and try again */ - default: - purple_debug_info("sasl", "sasl_state is %d, failing the mech and trying again\n", js->sasl_state); - - /* - * DAA: is this right? - * The manpage says that "mech" will contain the chosen mechanism on success. - * Presumably, if we get here that isn't the case and we shouldn't try again? - * I suspect that this never happens. - */ - /* - * SXW: Yes, this is right. What this handles is the situation where a - * mechanism, say GSSAPI, is tried. If that mechanism fails, it may be - * due to mechanism specific issues, so we want to try one of the other - * supported mechanisms. This code handles that case - */ - if (js->current_mech && *js->current_mech) { - char *pos; - if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { - g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); - } - /* Remove space which separated this mech from the next */ - if ((js->sasl_mechs->str)[0] == ' ') { - g_string_erase(js->sasl_mechs, 0, 1); - } - again = TRUE; - } - - sasl_dispose(&js->sasl); - } - } while (again); - - if (js->sasl_state == SASL_CONTINUE || js->sasl_state == SASL_OK) { - auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl"); - xmlnode_set_attrib(auth, "mechanism", js->current_mech); - - xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); - xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); - - if (clientout) { - if (coutlen == 0) { - xmlnode_insert_data(auth, "=", -1); - } else { - enc_out = purple_base64_encode((unsigned char*)clientout, coutlen); - xmlnode_insert_data(auth, enc_out, -1); - g_free(enc_out); - } - } - jabber_send(js, auth); - xmlnode_free(auth); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - _("SASL authentication failed")); - } -} - -static int -jabber_sasl_cb_log(void *context, int level, const char *message) -{ - if(level <= SASL_LOG_TRACE) - purple_debug_info("sasl", "%s\n", message); - - return SASL_OK; -} - -void -jabber_sasl_build_callbacks(JabberStream *js) -{ - int id; - - /* Set up our callbacks structure */ - if (js->sasl_cb == NULL) - js->sasl_cb = g_new0(sasl_callback_t,6); - - id = 0; - js->sasl_cb[id].id = SASL_CB_GETREALM; - js->sasl_cb[id].proc = jabber_sasl_cb_realm; - js->sasl_cb[id].context = (void *)js; - id++; - - js->sasl_cb[id].id = SASL_CB_AUTHNAME; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; - js->sasl_cb[id].context = (void *)js; - id++; - - js->sasl_cb[id].id = SASL_CB_USER; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; - js->sasl_cb[id].context = (void *)js; - id++; - - if (purple_account_get_password(js->gc->account) != NULL ) { - js->sasl_cb[id].id = SASL_CB_PASS; - js->sasl_cb[id].proc = jabber_sasl_cb_secret; - js->sasl_cb[id].context = (void *)js; - id++; - } - - js->sasl_cb[id].id = SASL_CB_LOG; - js->sasl_cb[id].proc = jabber_sasl_cb_log; - js->sasl_cb[id].context = (void*)js; - id++; - - js->sasl_cb[id].id = SASL_CB_LIST_END; -} - -#endif - -void -jabber_auth_start(JabberStream *js, xmlnode *packet) -{ -#ifndef HAVE_CYRUS_SASL - gboolean digest_md5 = FALSE, plain=FALSE; -#endif - - xmlnode *mechs, *mechnode; - - - if(js->registration) { - jabber_register_start(js); - return; - } - - mechs = xmlnode_get_child(packet, "mechanisms"); - - if(!mechs) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - return; - } - -#ifdef HAVE_CYRUS_SASL - js->sasl_mechs = g_string_new(""); -#endif - - for(mechnode = xmlnode_get_child(mechs, "mechanism"); mechnode; - mechnode = xmlnode_get_next_twin(mechnode)) - { - char *mech_name = xmlnode_get_data(mechnode); -#ifdef HAVE_CYRUS_SASL - /* Don't include Google Talk's X-GOOGLE-TOKEN mechanism, as we will not - * support it and including it gives a false fall-back to other mechs offerred, - * leading to incorrect error handling. - */ - if (purple_strequal(mech_name, "X-GOOGLE-TOKEN")) { - g_free(mech_name); - continue; - } - - g_string_append(js->sasl_mechs, mech_name); - g_string_append_c(js->sasl_mechs, ' '); -#else - if (purple_strequal(mech_name, "DIGEST-MD5")) - digest_md5 = TRUE; - else if (purple_strequal(mech_name, "PLAIN")) - plain = TRUE; -#endif - g_free(mech_name); - } - -#ifdef HAVE_CYRUS_SASL - js->auth_type = JABBER_AUTH_CYRUS; - - jabber_sasl_build_callbacks(js); - - jabber_auth_start_cyrus(js); -#else - - if(digest_md5) { - xmlnode *auth; - - js->auth_type = JABBER_AUTH_DIGEST_MD5; - auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl"); - xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); - - jabber_send(js, auth); - xmlnode_free(auth); - } else if(plain) { - js->auth_type = JABBER_AUTH_PLAIN; - - if(!jabber_stream_is_ssl(js) && !purple_account_get_bool(js->gc->account, "auth_plain_in_clear", FALSE)) { - char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), - js->gc->account->username); - purple_request_yes_no(js->gc, _("Plaintext Authentication"), - _("Plaintext Authentication"), - msg, - 1, - purple_connection_get_account(js->gc), NULL, NULL, - purple_connection_get_account(js->gc), allow_plaintext_auth, - disallow_plaintext_auth); - g_free(msg); - return; - } - finish_plaintext_authentication(js); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - _("Server does not use any supported authentication method")); - } -#endif -} - -static void auth_old_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) { - jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); - jabber_disco_items_server(js); - } else { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - xmlnode *error; - const char *err_code; - - /* FIXME: Why is this not in jabber_parse_error? */ - if((error = xmlnode_get_child(packet, "error")) && - (err_code = xmlnode_get_attrib(error, "code")) && - g_str_equal(err_code, "401")) { - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - /* Clear the pasword if it isn't being saved */ - if (!purple_account_get_remember_password(js->gc->account)) - purple_account_set_password(js->gc->account, NULL); - } - - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } -} - -static void auth_old_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberIq *iq; - xmlnode *query, *x; - const char *pw = purple_connection_get_password(js->gc); - - if (type == JABBER_IQ_ERROR) { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } else if (type == JABBER_IQ_RESULT) { - query = xmlnode_get_child(packet, "query"); - if(js->stream_id && xmlnode_get_child(query, "digest")) { - char *s, *hash; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - - x = xmlnode_new_child(query, "digest"); - s = g_strdup_printf("%s%s", js->stream_id, pw); - hash = jabber_calculate_data_sha1sum(s, strlen(s)); - xmlnode_insert_data(x, hash, -1); - g_free(hash); - g_free(s); - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - jabber_iq_send(iq); - - } else if(js->stream_id && (x = xmlnode_get_child(query, "crammd5"))) { - const char *challenge; - gchar digest[33]; - PurpleCipherContext *hmac; - - /* Calculate the MHAC-MD5 digest */ - challenge = xmlnode_get_attrib(x, "challenge"); - hmac = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(hmac, "hash", "md5"); - purple_cipher_context_set_key(hmac, (guchar *)pw); - purple_cipher_context_append(hmac, (guchar *)challenge, strlen(challenge)); - purple_cipher_context_digest_to_str(hmac, 33, digest, NULL); - purple_cipher_context_destroy(hmac); - - /* Create the response query */ - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - - x = xmlnode_new_child(query, "crammd5"); - - xmlnode_insert_data(x, digest, 32); - - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - jabber_iq_send(iq); - - } else if(xmlnode_get_child(query, "password")) { - if(!jabber_stream_is_ssl(js) && !purple_account_get_bool(js->gc->account, - "auth_plain_in_clear", FALSE)) { - char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), - js->gc->account->username); - purple_request_yes_no(js->gc, _("Plaintext Authentication"), - _("Plaintext Authentication"), - msg, - 1, - purple_connection_get_account(js->gc), NULL, NULL, - purple_connection_get_account(js->gc), allow_plaintext_auth, - disallow_plaintext_auth); - g_free(msg); - return; - } - finish_plaintext_authentication(js); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - _("Server does not use any supported authentication method")); - return; - } - } -} - -void jabber_auth_start_old(JabberStream *js) -{ - JabberIq *iq; - xmlnode *query, *username; - - /* - * We can end up here without encryption if the server doesn't support - * and we're not using old-style SSL. If the user - * is requiring SSL/TLS, we need to enforce it. - */ - if (!jabber_stream_is_ssl(js) && - purple_account_get_bool(purple_connection_get_account(js->gc), "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("You require encryption, but it is not available on this server.")); - return; - } - - /* - * IQ Auth doesn't have support for resource binding, so we need to pick a - * default resource so it will work properly. jabberd14 throws an error and - * iChat server just fails silently. - */ - if (!js->user->resource || *js->user->resource == '\0') { - g_free(js->user->resource); - js->user->resource = g_strdup("Home"); - } - -#ifdef HAVE_CYRUS_SASL - /* If we have Cyrus SASL, then passwords will have been set - * to OPTIONAL for this protocol. So, we need to do our own - * password prompting here - */ - - if (!purple_account_get_password(js->gc->account)) { - purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); - return; - } -#endif - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:auth"); - - query = xmlnode_get_child(iq->node, "query"); - username = xmlnode_new_child(query, "username"); - xmlnode_insert_data(username, js->user->node, -1); - - jabber_iq_set_callback(iq, auth_old_cb, NULL); - - jabber_iq_send(iq); -} - -/* Parts of this algorithm are inspired by stuff in libgsasl */ -static GHashTable* parse_challenge(const char *challenge) -{ - const char *token_start, *val_start, *val_end, *cur; - GHashTable *ret = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - cur = challenge; - while(*cur != '\0') { - /* Find the end of the token */ - gboolean in_quotes = FALSE; - char *name, *value = NULL; - token_start = cur; - while(*cur != '\0' && (in_quotes || (!in_quotes && *cur != ','))) { - if (*cur == '"') - in_quotes = !in_quotes; - cur++; - } - - /* Find start of value. */ - val_start = strchr(token_start, '='); - if (val_start == NULL || val_start > cur) - val_start = cur; - - if (token_start != val_start) { - name = g_strndup(token_start, val_start - token_start); - - if (val_start != cur) { - val_start++; - while (val_start != cur && (*val_start == ' ' || *val_start == '\t' - || *val_start == '\r' || *val_start == '\n' - || *val_start == '"')) - val_start++; - - val_end = cur; - while (val_end != val_start && (*val_end == ' ' || *val_end == ',' || *val_end == '\t' - || *val_end == '\r' || *val_end == '\n' - || *val_end == '"' || *val_end == '\0')) - val_end--; - - if (val_start != val_end) - value = g_strndup(val_start, val_end - val_start + 1); - } - - g_hash_table_replace(ret, name, value); - } - - /* Find the start of the next token, if there is one */ - if (*cur != '\0') { - cur++; - while (*cur == ' ' || *cur == ',' || *cur == '\t' - || *cur == '\r' || *cur == '\n') - cur++; - } - } - - return ret; -} - -static char * -generate_response_value(JabberID *jid, const char *passwd, const char *nonce, - const char *cnonce, const char *a2, const char *realm) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar result[16]; - size_t a1len; - - gchar *a1, *convnode=NULL, *convpasswd = NULL, *ha1, *ha2, *kd, *x, *z; - - if((convnode = g_convert(jid->node, -1, "iso-8859-1", "utf-8", - NULL, NULL, NULL)) == NULL) { - convnode = g_strdup(jid->node); - } - if(passwd && ((convpasswd = g_convert(passwd, -1, "iso-8859-1", - "utf-8", NULL, NULL, NULL)) == NULL)) { - convpasswd = g_strdup(passwd); - } - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd ? convpasswd : ""); - purple_cipher_context_append(context, (const guchar *)x, strlen(x)); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - - a1 = g_strdup_printf("xxxxxxxxxxxxxxxx:%s:%s", nonce, cnonce); - a1len = strlen(a1); - g_memmove(a1, result, 16); - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)a1, a1len); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - - ha1 = purple_base16_encode(result, 16); - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)a2, strlen(a2)); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - - ha2 = purple_base16_encode(result, 16); - - kd = g_strdup_printf("%s:%s:00000001:%s:auth:%s", ha1, nonce, cnonce, ha2); - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)kd, strlen(kd)); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - purple_cipher_context_destroy(context); - - z = purple_base16_encode(result, 16); - - g_free(convnode); - g_free(convpasswd); - g_free(x); - g_free(a1); - g_free(ha1); - g_free(ha2); - g_free(kd); - - return z; -} - -void -jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) -{ - - if(js->auth_type == JABBER_AUTH_DIGEST_MD5) { - char *enc_in = xmlnode_get_data(packet); - char *dec_in; - char *enc_out; - GHashTable *parts; - - if(!enc_in) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - return; - } - - dec_in = (char *)purple_base64_decode(enc_in, NULL); - purple_debug_misc("jabber", "decoded challenge (%" - G_GSIZE_FORMAT "): %s\n", strlen(dec_in), dec_in); - - parts = parse_challenge(dec_in); - - - if (g_hash_table_lookup(parts, "rspauth")) { - char *rspauth = g_hash_table_lookup(parts, "rspauth"); - - - if (rspauth && purple_strequal(rspauth, js->expected_rspauth)) { - jabber_send_raw(js, - "", - -1); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid challenge from server")); - } - g_free(js->expected_rspauth); - js->expected_rspauth = NULL; - } else { - /* assemble a response, and send it */ - /* see RFC 2831 */ - char *realm; - char *nonce; - - /* Make sure the auth string contains everything that should be there. - This isn't everything in RFC2831, but it is what we need. */ - - nonce = g_hash_table_lookup(parts, "nonce"); - - /* we're actually supposed to prompt the user for a realm if - * the server doesn't send one, but that really complicates things, - * so i'm not gonna worry about it until is poses a problem to - * someone, or I get really bored */ - realm = g_hash_table_lookup(parts, "realm"); - if(!realm) - realm = js->user->domain; - - if (nonce == NULL || realm == NULL) - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid challenge from server")); - else { - GString *response = g_string_new(""); - char *a2; - char *auth_resp; - char *buf; - char *cnonce; - - cnonce = g_strdup_printf("%x%u%x", g_random_int(), (int)time(NULL), - g_random_int()); - - a2 = g_strdup_printf("AUTHENTICATE:xmpp/%s", realm); - auth_resp = generate_response_value(js->user, - purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); - g_free(a2); - - a2 = g_strdup_printf(":xmpp/%s", realm); - js->expected_rspauth = generate_response_value(js->user, - purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); - g_free(a2); - - g_string_append_printf(response, "username=\"%s\"", js->user->node); - g_string_append_printf(response, ",realm=\"%s\"", realm); - g_string_append_printf(response, ",nonce=\"%s\"", nonce); - g_string_append_printf(response, ",cnonce=\"%s\"", cnonce); - g_string_append_printf(response, ",nc=00000001"); - g_string_append_printf(response, ",qop=auth"); - g_string_append_printf(response, ",digest-uri=\"xmpp/%s\"", realm); - g_string_append_printf(response, ",response=%s", auth_resp); - g_string_append_printf(response, ",charset=utf-8"); - - g_free(auth_resp); - g_free(cnonce); - - enc_out = purple_base64_encode((guchar *)response->str, response->len); - - purple_debug_misc("jabber", "decoded response (%" - G_GSIZE_FORMAT "): %s\n", - response->len, response->str); - - buf = g_strdup_printf("%s", enc_out); - - jabber_send_raw(js, buf, -1); - - g_free(buf); - - g_free(enc_out); - - g_string_free(response, TRUE); - } - } - - g_free(enc_in); - g_free(dec_in); - g_hash_table_destroy(parts); - } -#ifdef HAVE_CYRUS_SASL - else if (js->auth_type == JABBER_AUTH_CYRUS) { - char *enc_in = xmlnode_get_data(packet); - unsigned char *dec_in; - char *enc_out; - const char *c_out; - unsigned int clen; - gsize declen; - xmlnode *response; - - dec_in = purple_base64_decode(enc_in, &declen); - - js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen, - NULL, &c_out, &clen); - g_free(enc_in); - g_free(dec_in); - if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) { - gchar *tmp = g_strdup_printf(_("SASL error: %s"), - sasl_errdetail(js->sasl)); - purple_debug_error("jabber", "Error is %d : %s\n", - js->sasl_state, sasl_errdetail(js->sasl)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else { - response = xmlnode_new("response"); - xmlnode_set_namespace(response, "urn:ietf:params:xml:ns:xmpp-sasl"); - if (clen > 0) { - /* Cyrus SASL 2.1.22 appears to contain code to add the charset - * to the response for DIGEST-MD5 but there is no possibility - * it will be executed. - * - * My reading of the digestmd5 plugin indicates the username and - * realm are always encoded in UTF-8 (they seem to be the values - * we pass in), so we need to ensure charset=utf-8 is set. - */ - if (!purple_strequal(js->current_mech, "DIGEST-MD5") || - strstr(c_out, ",charset=")) - /* If we're not using DIGEST-MD5 or Cyrus SASL is fixed */ - enc_out = purple_base64_encode((unsigned char*)c_out, clen); - else { - char *tmp = g_strdup_printf("%s,charset=utf-8", c_out); - enc_out = purple_base64_encode((unsigned char*)tmp, clen + 14); - g_free(tmp); - } - - xmlnode_insert_data(response, enc_out, -1); - g_free(enc_out); - } - jabber_send(js, response); - xmlnode_free(response); - } - } -#endif -} - -void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) -{ - const char *ns = xmlnode_get_namespace(packet); -#ifdef HAVE_CYRUS_SASL - const void *x; -#endif - - if (!purple_strequal(ns, "urn:ietf:params:xml:ns:xmpp-sasl")) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - return; - } - -#ifdef HAVE_CYRUS_SASL - /* The SASL docs say that if the client hasn't returned OK yet, we - * should try one more round against it - */ - if (js->sasl_state != SASL_OK) { - char *enc_in = xmlnode_get_data(packet); - unsigned char *dec_in = NULL; - const char *c_out; - unsigned int clen; - gsize declen = 0; - - if(enc_in != NULL) - dec_in = purple_base64_decode(enc_in, &declen); - - js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen, NULL, &c_out, &clen); - - g_free(enc_in); - g_free(dec_in); - - if (js->sasl_state != SASL_OK) { - /* This should never happen! */ - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - g_return_if_reached(); - } - } - /* If we've negotiated a security layer, we need to enable it */ - if (js->sasl) { - sasl_getprop(js->sasl, SASL_SSF, &x); - if (*(int *)x > 0) { - sasl_getprop(js->sasl, SASL_MAXOUTBUF, &x); - js->sasl_maxbuf = *(int *)x; - } - } -#endif - - /* - * The stream will be reinitialized later in jabber_recv_cb_ssl() or - * jabber_bosh_connection_send. - */ - js->reinit = TRUE; - jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); -} - -void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) -{ - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg; - -#ifdef HAVE_CYRUS_SASL - if(js->auth_fail_count++ < 5) { - if (js->current_mech && *js->current_mech) { - char *pos; - if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { - g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); - } - /* Remove space which separated this mech from the next */ - if ((js->sasl_mechs->str)[0] == ' ') { - g_string_erase(js->sasl_mechs, 0, 1); - } - } - if (*js->sasl_mechs->str) { - /* If we have remaining mechs to try, do so */ - sasl_dispose(&js->sasl); - - jabber_auth_start_cyrus(js); - return; - } - } -#endif - msg = jabber_parse_error(js, packet, &reason); - if(!msg) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - } else { - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/auth.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/** - * @file auth.h Authentication routines - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_AUTH_H_ -#define PURPLE_JABBER_AUTH_H_ - -#include "jabber.h" -#include "xmlnode.h" - -gboolean jabber_process_starttls(JabberStream *js, xmlnode *packet); -void jabber_auth_start(JabberStream *js, xmlnode *packet); -void jabber_auth_start_old(JabberStream *js); -void jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet); -void jabber_auth_handle_success(JabberStream *js, xmlnode *packet); -void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet); - -#endif /* PURPLE_JABBER_AUTH_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1016 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "circbuffer.h" -#include "core.h" -#include "cipher.h" -#include "debug.h" -#include "prpl.h" -#include "util.h" -#include "xmlnode.h" - -#include "bosh.h" - -/* The number of HTTP connections to use. This MUST be at least 2. */ -#define NUM_HTTP_CONNECTIONS 2 -/* How many failed connection attempts before it becomes a fatal error */ -#define MAX_FAILED_CONNECTIONS 3 -/* How long in seconds to queue up outgoing messages */ -#define BUFFER_SEND_IN_SECS 1 - -typedef struct _PurpleHTTPConnection PurpleHTTPConnection; - -typedef void (*PurpleBOSHConnectionConnectFunction)(PurpleBOSHConnection *conn); -typedef void (*PurpleBOSHConnectionReceiveFunction)(PurpleBOSHConnection *conn, xmlnode *node); - -static char *bosh_useragent = NULL; - -typedef enum { - PACKET_NORMAL, - PACKET_TERMINATE, - PACKET_FLUSH, -} PurpleBOSHPacketType; - -struct _PurpleBOSHConnection { - JabberStream *js; - PurpleHTTPConnection *connections[NUM_HTTP_CONNECTIONS]; - - PurpleCircBuffer *pending; - PurpleBOSHConnectionConnectFunction connect_cb; - PurpleBOSHConnectionReceiveFunction receive_cb; - - /* Must be big enough to hold 2^53 - 1 */ - char *sid; - guint64 rid; - - /* decoded URL */ - char *host; - char *path; - guint16 port; - - gboolean pipelining; - gboolean ssl; - - enum { - BOSH_CONN_OFFLINE, - BOSH_CONN_BOOTING, - BOSH_CONN_ONLINE - } state; - guint8 failed_connections; - - int max_inactivity; - int wait; - - int max_requests; - int requests; - - guint inactivity_timer; - guint send_timer; -}; - -struct _PurpleHTTPConnection { - PurpleBOSHConnection *bosh; - PurpleSslConnection *psc; - - PurpleCircBuffer *write_buf; - GString *read_buf; - - gsize handled_len; - gsize body_len; - - int fd; - guint readh; - guint writeh; - - enum { - HTTP_CONN_OFFLINE, - HTTP_CONN_CONNECTING, - HTTP_CONN_CONNECTED - } state; - int requests; /* number of outstanding HTTP requests */ - - gboolean headers_done; - -}; - -static void http_connection_connect(PurpleHTTPConnection *conn); -static void http_connection_send_request(PurpleHTTPConnection *conn, - const GString *req); -static gboolean send_timer_cb(gpointer data); - -void jabber_bosh_init(void) -{ - GHashTable *ui_info = purple_core_get_ui_info(); - const char *ui_name = NULL; - const char *ui_version = NULL; - - if (ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_version = g_hash_table_lookup(ui_info, "version"); - } - - if (ui_name) - bosh_useragent = g_strdup_printf("%s%s%s (libpurple " VERSION ")", - ui_name, ui_version ? " " : "", - ui_version ? ui_version : ""); - else - bosh_useragent = g_strdup("libpurple " VERSION); -} - -void jabber_bosh_uninit(void) -{ - g_free(bosh_useragent); - bosh_useragent = NULL; -} - -static PurpleHTTPConnection* -jabber_bosh_http_connection_init(PurpleBOSHConnection *bosh) -{ - PurpleHTTPConnection *conn = g_new0(PurpleHTTPConnection, 1); - conn->bosh = bosh; - conn->fd = -1; - conn->state = HTTP_CONN_OFFLINE; - - conn->write_buf = purple_circ_buffer_new(0 /* default grow size */); - - return conn; -} - -static void -jabber_bosh_http_connection_destroy(PurpleHTTPConnection *conn) -{ - if (conn->read_buf) - g_string_free(conn->read_buf, TRUE); - - if (conn->write_buf) - purple_circ_buffer_destroy(conn->write_buf); - if (conn->readh) - purple_input_remove(conn->readh); - if (conn->writeh) - purple_input_remove(conn->writeh); - if (conn->psc) - purple_ssl_close(conn->psc); - if (conn->fd >= 0) - close(conn->fd); - - purple_proxy_connect_cancel_with_handle(conn); - - g_free(conn); -} - -PurpleBOSHConnection* -jabber_bosh_connection_init(JabberStream *js, const char *url) -{ - PurpleBOSHConnection *conn; - char *host, *path, *user, *passwd; - int port; - - if (!purple_url_parse(url, &host, &port, &path, &user, &passwd)) { - purple_debug_info("jabber", "Unable to parse given URL.\n"); - return NULL; - } - - conn = g_new0(PurpleBOSHConnection, 1); - conn->host = host; - conn->port = port; - conn->path = g_strdup_printf("/%s", path); - g_free(path); - conn->pipelining = TRUE; - - if ((user && user[0] != '\0') || (passwd && passwd[0] != '\0')) { - purple_debug_info("jabber", "Ignoring unexpected username and password " - "in BOSH URL.\n"); - } - - g_free(user); - g_free(passwd); - - conn->js = js; - - /* - * Random 64-bit integer masked off by 2^52 - 1. - * - * This should produce a random integer in the range [0, 2^52). It's - * unlikely we'll send enough packets in one session to overflow the rid. - */ - conn->rid = ((guint64)g_random_int() << 32) | g_random_int(); - conn->rid &= 0xFFFFFFFFFFFFFLL; - - conn->pending = purple_circ_buffer_new(0 /* default grow size */); - - conn->state = BOSH_CONN_OFFLINE; - if (purple_strcasestr(url, "https://") != NULL) - conn->ssl = TRUE; - else - conn->ssl = FALSE; - - conn->connections[0] = jabber_bosh_http_connection_init(conn); - - return conn; -} - -void -jabber_bosh_connection_destroy(PurpleBOSHConnection *conn) -{ - int i; - - g_free(conn->host); - g_free(conn->path); - - if (conn->send_timer) - purple_timeout_remove(conn->send_timer); - if (conn->inactivity_timer) - purple_timeout_remove(conn->inactivity_timer); - - purple_circ_buffer_destroy(conn->pending); - - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (conn->connections[i]) - jabber_bosh_http_connection_destroy(conn->connections[i]); - } - - g_free(conn); -} - -gboolean jabber_bosh_connection_is_ssl(PurpleBOSHConnection *conn) -{ - return conn->ssl; -} - -static PurpleHTTPConnection * -find_available_http_connection(PurpleBOSHConnection *conn) -{ - int i; - - if (purple_debug_is_verbose()) { - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - PurpleHTTPConnection *httpconn = conn->connections[i]; - if (httpconn == NULL) - purple_debug_misc("jabber", "BOSH %p->connections[%d] = (nil)\n", - conn, i); - else - purple_debug_misc("jabber", "BOSH %p->connections[%d] = %p, state = %d" - ", requests = %d\n", conn, i, httpconn, - httpconn->state, httpconn->requests); - } - } - - /* Easy solution: Does everyone involved support pipelining? Hooray! Just use - * one TCP connection! */ - if (conn->pipelining) - return conn->connections[0]->state == HTTP_CONN_CONNECTED ? - conn->connections[0] : NULL; - - /* First loop, look for a connection that's ready */ - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (conn->connections[i] && - conn->connections[i]->state == HTTP_CONN_CONNECTED && - conn->connections[i]->requests == 0) - return conn->connections[i]; - } - - /* Second loop, is something currently connecting? If so, just queue up. */ - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (conn->connections[i] && - conn->connections[i]->state == HTTP_CONN_CONNECTING) - return NULL; - } - - /* Third loop, look for one that's NULL and create a new connection */ - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (!conn->connections[i]) { - purple_debug_info("jabber", "bosh: Creating and connecting new httpconn\n"); - conn->connections[i] = jabber_bosh_http_connection_init(conn); - - http_connection_connect(conn->connections[i]); - return NULL; - } - } - - purple_debug_warning("jabber", "Could not find a HTTP connection!\n"); - - /* None available. */ - return NULL; -} - -static void -jabber_bosh_connection_send(PurpleBOSHConnection *conn, - const PurpleBOSHPacketType type, const char *data) -{ - PurpleHTTPConnection *chosen; - GString *packet = NULL; - - if (type != PACKET_FLUSH && type != PACKET_TERMINATE) { - /* - * Unless this is a flush (or session terminate, which needs to be - * sent immediately), queue up the data and start a timer to flush - * the buffer. - */ - if (data) { - int len = data ? strlen(data) : 0; - purple_circ_buffer_append(conn->pending, data, len); - } - - if (purple_debug_is_verbose()) - purple_debug_misc("jabber", "bosh: %p has %" G_GSIZE_FORMAT " bytes in " - "the buffer.\n", conn, conn->pending->bufused); - if (conn->send_timer == 0) - conn->send_timer = purple_timeout_add_seconds(BUFFER_SEND_IN_SECS, - send_timer_cb, conn); - return; - } - - chosen = find_available_http_connection(conn); - - if (!chosen) { - /* - * For non-ordinary traffic, we can't 'buffer' it, so use the - * first connection. - */ - chosen = conn->connections[0]; - - if (chosen->state != HTTP_CONN_CONNECTED) { - purple_debug_warning("jabber", "Unable to find a ready BOSH " - "connection. Ignoring send of type 0x%02x.\n", type); - return; - } - } - - /* We're flushing the send buffer, so remove the send timer */ - if (conn->send_timer != 0) { - purple_timeout_remove(conn->send_timer); - conn->send_timer = 0; - } - - packet = g_string_new(NULL); - - g_string_printf(packet, "rid, - conn->sid, - conn->js->user->domain); - - if (conn->js->reinit) { - packet = g_string_append(packet, " xmpp:restart='true'/>"); - /* TODO: Do we need to wait for a response? */ - conn->js->reinit = FALSE; - } else { - gsize read_amt; - if (type == PACKET_TERMINATE) - packet = g_string_append(packet, " type='terminate'"); - - packet = g_string_append_c(packet, '>'); - - while ((read_amt = purple_circ_buffer_get_max_read(conn->pending)) > 0) { - packet = g_string_append_len(packet, conn->pending->outptr, read_amt); - purple_circ_buffer_mark_read(conn->pending, read_amt); - } - - if (data) - packet = g_string_append(packet, data); - packet = g_string_append(packet, ""); - } - - http_connection_send_request(chosen, packet); -} - -void jabber_bosh_connection_close(PurpleBOSHConnection *conn) -{ - if (conn->state == BOSH_CONN_ONLINE) - jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL); -} - -static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, xmlnode *node) { - const char *type; - - type = xmlnode_get_attrib(node, "type"); - - if (type != NULL && !strcmp(type, "terminate")) { - conn->state = BOSH_CONN_OFFLINE; - purple_connection_error_reason(conn->js->gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("The BOSH connection manager terminated your session.")); - return TRUE; - } - return FALSE; -} - -static gboolean -send_timer_cb(gpointer data) -{ - PurpleBOSHConnection *bosh; - - bosh = data; - bosh->send_timer = 0; - - jabber_bosh_connection_send(bosh, PACKET_FLUSH, NULL); - - return FALSE; -} - -static gboolean -bosh_inactivity_cb(gpointer data) -{ - PurpleBOSHConnection *bosh = data; - bosh->inactivity_timer = 0; - - if (bosh->send_timer != 0) - purple_timeout_remove(bosh->send_timer); - - /* clears bosh->send_timer */ - send_timer_cb(bosh); - - return FALSE; -} - -static void -restart_inactivity_timer(PurpleBOSHConnection *conn) -{ - if (conn->inactivity_timer != 0) { - purple_timeout_remove(conn->inactivity_timer); - conn->inactivity_timer = 0; - } - - if (conn->max_inactivity != 0) { - conn->inactivity_timer = - purple_timeout_add_seconds(conn->max_inactivity - 5 /* rounding */, - bosh_inactivity_cb, conn); - } -} - -static void jabber_bosh_connection_received(PurpleBOSHConnection *conn, xmlnode *node) { - xmlnode *child; - JabberStream *js = conn->js; - - g_return_if_fail(node != NULL); - if (jabber_bosh_connection_error_check(conn, node)) - return; - - child = node->child; - while (child != NULL) { - /* jabber_process_packet might free child */ - xmlnode *next = child->next; - if (child->type == XMLNODE_TYPE_TAG) { - jabber_process_packet(js, &child); - } - - child = next; - } -} - -static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) { - JabberStream *js = conn->js; - const char *sid, *version; - const char *inactivity, *requests; - xmlnode *packet; - - g_return_if_fail(node != NULL); - if (jabber_bosh_connection_error_check(conn, node)) - return; - - sid = xmlnode_get_attrib(node, "sid"); - version = xmlnode_get_attrib(node, "ver"); - - inactivity = xmlnode_get_attrib(node, "inactivity"); - requests = xmlnode_get_attrib(node, "requests"); - - if (sid) { - conn->sid = g_strdup(sid); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("No session ID given")); - return; - } - - if (version) { - const char *dot = strstr(version, "."); - int major, minor = 0; - - purple_debug_info("jabber", "BOSH connection manager version %s\n", version); - - major = atoi(version); - if (dot) - minor = atoi(dot + 1); - - if (major != 1 || minor < 6) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unsupported version of BOSH protocol")); - return; - } - } else { - purple_debug_info("jabber", "Missing version in BOSH initiation\n"); - } - - if (inactivity) { - conn->max_inactivity = atoi(inactivity); - if (conn->max_inactivity <= 5) { - purple_debug_warning("jabber", "Ignoring bogusly small inactivity: %s\n", - inactivity); - conn->max_inactivity = 0; - } else { - /* TODO: Integrate this with jabber.c keepalive checks... */ - /* TODO: Can this check fail? It shouldn't */ - if (conn->inactivity_timer == 0) { - purple_debug_misc("jabber", "Starting BOSH inactivity timer " - "for %d secs (compensating for rounding)\n", - conn->max_inactivity - 5); - restart_inactivity_timer(conn); - } - } - } - - if (requests) - conn->max_requests = atoi(requests); - - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - - /* FIXME: Depending on receiving features might break with some hosts */ - packet = xmlnode_get_child(node, "features"); - conn->state = BOSH_CONN_ONLINE; - conn->receive_cb = jabber_bosh_connection_received; - jabber_stream_features_parse(js, packet); -} - -static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) { - GString *buf = g_string_new(NULL); - - g_string_printf(buf, "", - conn->js->user->domain, - ++conn->rid); - - purple_debug_misc("jabber", "SendBOSH Boot %s(%" G_GSIZE_FORMAT "): %s\n", - conn->ssl ? "(ssl)" : "", buf->len, buf->str); - conn->receive_cb = boot_response_cb; - http_connection_send_request(conn->connections[0], buf); - g_string_free(buf, TRUE); -} - -static void -http_received_cb(const char *data, int len, PurpleBOSHConnection *conn) -{ - if (conn->failed_connections) - /* We've got some data, so reset the number of failed connections */ - conn->failed_connections = 0; - - if (conn->receive_cb) { - xmlnode *node = xmlnode_from_str(data, len); - - purple_debug_info("jabber", "RecvBOSH %s(%d): %s\n", - conn->ssl ? "(ssl)" : "", len, data); - - if (node) { - conn->receive_cb(conn, node); - xmlnode_free(node); - } else { - purple_debug_warning("jabber", "BOSH: Received invalid XML\n"); - } - } else { - g_return_if_reached(); - } -} - -void jabber_bosh_connection_send_raw(PurpleBOSHConnection *conn, - const char *data) -{ - jabber_bosh_connection_send(conn, PACKET_NORMAL, data); -} - -static void -connection_common_established_cb(PurpleHTTPConnection *conn) -{ - /* Indicate we're ready and reset some variables */ - conn->state = HTTP_CONN_CONNECTED; - if (conn->requests != 0) - purple_debug_error("jabber", "bosh: httpconn %p has %d requests, != 0\n", - conn, conn->requests); - - conn->requests = 0; - if (conn->read_buf) { - g_string_free(conn->read_buf, TRUE); - conn->read_buf = NULL; - } - conn->headers_done = FALSE; - conn->handled_len = conn->body_len = 0; - - if (conn->bosh->js->reinit) - jabber_bosh_connection_send(conn->bosh, PACKET_NORMAL, NULL); - else if (conn->bosh->state == BOSH_CONN_ONLINE) { - purple_debug_info("jabber", "BOSH session already exists. Trying to reuse it.\n"); - if (conn->bosh->requests == 0 || conn->bosh->pending->bufused > 0) { - /* Send the pending data */ - jabber_bosh_connection_send(conn->bosh, PACKET_FLUSH, NULL); - } - } else - jabber_bosh_connection_boot(conn->bosh); -} - -static void http_connection_disconnected(PurpleHTTPConnection *conn) -{ - /* - * Well, then. Fine! I never liked you anyway, server! I was cheating on you - * with AIM! - */ - conn->state = HTTP_CONN_OFFLINE; - if (conn->psc) { - purple_ssl_close(conn->psc); - conn->psc = NULL; - } else if (conn->fd >= 0) { - close(conn->fd); - conn->fd = -1; - } - - if (conn->readh) { - purple_input_remove(conn->readh); - conn->readh = 0; - } - - if (conn->writeh) { - purple_input_remove(conn->writeh); - conn->writeh = 0; - } - - if (conn->requests > 0 && conn->read_buf->len == 0) { - purple_debug_error("jabber", "bosh: Adjusting BOSHconn requests (%d) to %d\n", - conn->bosh->requests, conn->bosh->requests - conn->requests); - conn->bosh->requests -= conn->requests; - conn->requests = 0; - } - - if (conn->bosh->pipelining) { - /* Hmmmm, fall back to multiple connections */ - conn->bosh->pipelining = FALSE; - if (conn->bosh->connections[1] == NULL) { - conn->bosh->connections[1] = jabber_bosh_http_connection_init(conn->bosh); - http_connection_connect(conn->bosh->connections[1]); - } - } - - if (++conn->bosh->failed_connections == MAX_FAILED_CONNECTIONS) { - purple_connection_error_reason(conn->bosh->js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to establish a connection with the server")); - } else { - /* No! Please! Take me back. It was me, not you! I was weak! */ - http_connection_connect(conn); - } -} - -void jabber_bosh_connection_connect(PurpleBOSHConnection *bosh) { - PurpleHTTPConnection *conn = bosh->connections[0]; - - g_return_if_fail(bosh->state == BOSH_CONN_OFFLINE); - bosh->state = BOSH_CONN_BOOTING; - - http_connection_connect(conn); -} - -static void -jabber_bosh_http_connection_process(PurpleHTTPConnection *conn) -{ - const char *cursor; - - cursor = conn->read_buf->str + conn->handled_len; - - if (!conn->headers_done) { - const char *content_length = purple_strcasestr(cursor, "\r\nContent-Length"); - const char *end_of_headers = strstr(cursor, "\r\n\r\n"); - - /* Make sure Content-Length is in headers, not body */ - if (content_length && (!end_of_headers || content_length < end_of_headers)) { - const char *sep; - const char *eol; - int len; - - if ((sep = strstr(content_length, ": ")) == NULL || - (eol = strstr(sep, "\r\n")) == NULL) - /* - * The packet ends in the middle of the Content-Length line. - * We'll try again later when we have more. - */ - return; - - len = atoi(sep + 2); - if (len == 0) - purple_debug_warning("jabber", "Found mangled Content-Length header.\n"); - - conn->body_len = len; - } - - if (end_of_headers) { - conn->headers_done = TRUE; - conn->handled_len = end_of_headers - conn->read_buf->str + 4; - cursor = end_of_headers + 4; - } else { - conn->handled_len = conn->read_buf->len; - return; - } - } - - /* Have we handled everything in the buffer? */ - if (conn->handled_len >= conn->read_buf->len) - return; - - /* Have we read all that the Content-Length promised us? */ - if (conn->read_buf->len - conn->handled_len < conn->body_len) - return; - - --conn->requests; - --conn->bosh->requests; - - http_received_cb(conn->read_buf->str + conn->handled_len, conn->body_len, - conn->bosh); - - if (conn->bosh->state == BOSH_CONN_ONLINE && - (conn->bosh->requests == 0 || conn->bosh->pending->bufused > 0)) { - purple_debug_misc("jabber", "BOSH: Sending an empty request\n"); - jabber_bosh_connection_send(conn->bosh, PACKET_NORMAL, NULL); - } - - g_string_free(conn->read_buf, TRUE); - conn->read_buf = NULL; - conn->headers_done = FALSE; - conn->handled_len = conn->body_len = 0; -} - -/* - * Common code for reading, called from http_connection_read_cb_ssl and - * http_connection_read_cb. - */ -static void -http_connection_read(PurpleHTTPConnection *conn) -{ - char buffer[1025]; - int cnt, count = 0; - - if (!conn->read_buf) - conn->read_buf = g_string_new(NULL); - - do { - if (conn->psc) - cnt = purple_ssl_read(conn->psc, buffer, sizeof(buffer)); - else - cnt = read(conn->fd, buffer, sizeof(buffer)); - - if (cnt > 0) { - count += cnt; - g_string_append_len(conn->read_buf, buffer, cnt); - } - } while (cnt > 0); - - if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) { - if (cnt < 0) - purple_debug_info("jabber", "bosh read=%d, errno=%d, error=%s\n", - cnt, errno, g_strerror(errno)); - else - purple_debug_info("jabber", "bosh server closed the connection\n"); - - /* - * If the socket is closed, the processing really needs to know about - * it. Handle that now. - */ - http_connection_disconnected(conn); - - /* Process what we do have */ - } - - if (conn->read_buf->len > 0) - jabber_bosh_http_connection_process(conn); -} - -static void -http_connection_read_cb(gpointer data, gint fd, PurpleInputCondition condition) -{ - PurpleHTTPConnection *conn = data; - - http_connection_read(conn); -} - -static void -http_connection_read_cb_ssl(gpointer data, PurpleSslConnection *psc, - PurpleInputCondition cond) -{ - PurpleHTTPConnection *conn = data; - - http_connection_read(conn); -} - -static void -ssl_connection_established_cb(gpointer data, PurpleSslConnection *psc, - PurpleInputCondition cond) -{ - PurpleHTTPConnection *conn = data; - - purple_ssl_input_add(psc, http_connection_read_cb_ssl, conn); - connection_common_established_cb(conn); -} - -static void -ssl_connection_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - PurpleHTTPConnection *conn = data; - - /* sslconn frees the connection on error */ - conn->psc = NULL; - - purple_connection_ssl_error(conn->bosh->js->gc, error); -} - -static void -connection_established_cb(gpointer data, gint source, const gchar *error) -{ - PurpleHTTPConnection *conn = data; - PurpleConnection *gc = conn->bosh->js->gc; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to establish a connection with the server: %s"), - error); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - conn->fd = source; - conn->readh = purple_input_add(conn->fd, PURPLE_INPUT_READ, - http_connection_read_cb, conn); - connection_common_established_cb(conn); -} - -static void http_connection_connect(PurpleHTTPConnection *conn) -{ - PurpleBOSHConnection *bosh = conn->bosh; - PurpleConnection *gc = bosh->js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - conn->state = HTTP_CONN_CONNECTING; - - if (bosh->ssl) { - if (purple_ssl_is_supported()) { - conn->psc = purple_ssl_connect(account, bosh->host, bosh->port, - ssl_connection_established_cb, - ssl_connection_error_cb, - conn); - if (!conn->psc) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Unable to establish SSL connection")); - } - } else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - } - } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port, - connection_established_cb, conn) == NULL) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } -} - -static int -http_connection_do_send(PurpleHTTPConnection *conn, const char *data, int len) -{ - int ret; - - if (conn->psc) - ret = purple_ssl_write(conn->psc, data, len); - else - ret = write(conn->fd, data, len); - - return ret; -} - -static void -http_connection_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleHTTPConnection *conn = data; - int ret; - int writelen = purple_circ_buffer_get_max_read(conn->write_buf); - - if (writelen == 0) { - purple_input_remove(conn->writeh); - conn->writeh = 0; - return; - } - - ret = http_connection_do_send(conn, conn->write_buf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - /* - * TODO: Handle this better. Probably requires a PurpleBOSHConnection - * buffer that stores what is "being sent" until the - * PurpleHTTPConnection reports it is fully sent. - */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(conn->bosh->js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(conn->write_buf, ret); -} - -static void -http_connection_send_request(PurpleHTTPConnection *conn, const GString *req) -{ - char *data; - int ret; - size_t len; - - /* Sending something to the server, restart the inactivity timer */ - restart_inactivity_timer(conn->bosh); - - data = g_strdup_printf("POST %s HTTP/1.1\r\n" - "Host: %s\r\n" - "User-Agent: %s\r\n" - "Content-Encoding: text/xml; charset=utf-8\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n" - "%s", - conn->bosh->path, conn->bosh->host, bosh_useragent, - req->len, req->str); - - len = strlen(data); - - ++conn->requests; - ++conn->bosh->requests; - - if (purple_debug_is_unsafe() && purple_debug_is_verbose()) - /* Will contain passwords for SASL PLAIN and is verbose */ - purple_debug_misc("jabber", "BOSH: Sending %s\n", data); - - if (conn->writeh == 0) - ret = http_connection_do_send(conn, data, len); - else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno != EAGAIN) { - /* - * TODO: Handle this better. Probably requires a PurpleBOSHConnection - * buffer that stores what is "being sent" until the - * PurpleHTTPConnection reports it is fully sent. - */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(conn->bosh->js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - return; - } else if (ret < len) { - if (ret < 0) - ret = 0; - if (conn->writeh == 0) - conn->writeh = purple_input_add(conn->psc ? conn->psc->fd : conn->fd, - PURPLE_INPUT_WRITE, http_connection_send_cb, conn); - purple_circ_buffer_append(conn->write_buf, data + ret, len - ret); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/bosh.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/** - * @file bosh.h Bidirectional-streams over Synchronous HTTP (BOSH) (XEP-0124 and XEP-0206) - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_BOSH_H_ -#define PURPLE_JABBER_BOSH_H_ - -typedef struct _PurpleBOSHConnection PurpleBOSHConnection; - -#include "jabber.h" - -void jabber_bosh_init(void); -void jabber_bosh_uninit(void); - -PurpleBOSHConnection* jabber_bosh_connection_init(JabberStream *js, const char *url); -void jabber_bosh_connection_destroy(PurpleBOSHConnection *conn); - -gboolean jabber_bosh_connection_is_ssl(PurpleBOSHConnection *conn); - -void jabber_bosh_connection_connect(PurpleBOSHConnection *conn); -void jabber_bosh_connection_close(PurpleBOSHConnection *conn); -void jabber_bosh_connection_send_raw(PurpleBOSHConnection *conn, const char *data); -#endif /* PURPLE_JABBER_BOSH_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2413 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "imgstore.h" -#include "prpl.h" -#include "notify.h" -#include "request.h" -#include "util.h" -#include "xmlnode.h" - -#include "buddy.h" -#include "chat.h" -#include "jabber.h" -#include "iq.h" -#include "presence.h" -#include "useravatar.h" -#include "xdata.h" -#include "pep.h" -#include "adhoccommands.h" -#include "google.h" - -typedef struct { - long idle_seconds; -} JabberBuddyInfoResource; - -typedef struct { - JabberStream *js; - JabberBuddy *jb; - char *jid; - GSList *ids; - GHashTable *resources; - guint timeout_handle; - GSList *vcard_imgids; - PurpleNotifyUserInfo *user_info; - long last_seconds; - gchar *last_message; -} JabberBuddyInfo; - -void jabber_buddy_free(JabberBuddy *jb) -{ - g_return_if_fail(jb != NULL); - - g_free(jb->error_msg); - while(jb->resources) - jabber_buddy_resource_free(jb->resources->data); - - g_free(jb); -} - -JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, - gboolean create) -{ - JabberBuddy *jb; - char *realname; - - if (js->buddies == NULL) - return NULL; - - if(!(realname = jabber_get_bare_jid(name))) - return NULL; - - jb = g_hash_table_lookup(js->buddies, realname); - - if(!jb && create) { - jb = g_new0(JabberBuddy, 1); - g_hash_table_insert(js->buddies, realname, jb); - } else - g_free(realname); - - return jb; -} - -static gint resource_compare_cb(gconstpointer a, gconstpointer b) -{ - const JabberBuddyResource *jbra = a; - const JabberBuddyResource *jbrb = b; - JabberBuddyState state_a, state_b; - - if (jbra->priority != jbrb->priority) - return jbra->priority > jbrb->priority ? 1 : -1; - - /* Fold the states for easier comparison */ - switch (jbra->state) { - case JABBER_BUDDY_STATE_ONLINE: - case JABBER_BUDDY_STATE_CHAT: - state_a = JABBER_BUDDY_STATE_ONLINE; - break; - case JABBER_BUDDY_STATE_AWAY: - case JABBER_BUDDY_STATE_DND: - state_a = JABBER_BUDDY_STATE_AWAY; - break; - case JABBER_BUDDY_STATE_XA: - state_a = JABBER_BUDDY_STATE_XA; - break; - case JABBER_BUDDY_STATE_UNAVAILABLE: - state_a = JABBER_BUDDY_STATE_UNAVAILABLE; - break; - default: - state_a = JABBER_BUDDY_STATE_UNKNOWN; - break; - } - - switch (jbrb->state) { - case JABBER_BUDDY_STATE_ONLINE: - case JABBER_BUDDY_STATE_CHAT: - state_b = JABBER_BUDDY_STATE_ONLINE; - break; - case JABBER_BUDDY_STATE_AWAY: - case JABBER_BUDDY_STATE_DND: - state_b = JABBER_BUDDY_STATE_AWAY; - break; - case JABBER_BUDDY_STATE_XA: - state_b = JABBER_BUDDY_STATE_XA; - break; - case JABBER_BUDDY_STATE_UNAVAILABLE: - state_b = JABBER_BUDDY_STATE_UNAVAILABLE; - break; - default: - state_b = JABBER_BUDDY_STATE_UNKNOWN; - break; - } - - if (state_a == state_b) { - if (jbra->idle == jbrb->idle) - return 0; - else if ((jbra->idle && !jbrb->idle) || - (jbra->idle && jbrb->idle && jbra->idle < jbrb->idle)) - return -1; - else - return 1; - } - - if (state_a == JABBER_BUDDY_STATE_ONLINE) - return 1; - else if (state_a == JABBER_BUDDY_STATE_AWAY && - (state_b == JABBER_BUDDY_STATE_XA || - state_b == JABBER_BUDDY_STATE_UNAVAILABLE || - state_b == JABBER_BUDDY_STATE_UNKNOWN)) - return 1; - else if (state_a == JABBER_BUDDY_STATE_XA && - (state_b == JABBER_BUDDY_STATE_UNAVAILABLE || - state_b == JABBER_BUDDY_STATE_UNKNOWN)) - return 1; - else if (state_a == JABBER_BUDDY_STATE_UNAVAILABLE && - state_b == JABBER_BUDDY_STATE_UNKNOWN) - return 1; - - return -1; -} - -JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, - const char *resource) -{ - JabberBuddyResource *jbr = NULL; - GList *l; - - if(!jb) - return NULL; - - for(l = jb->resources; l; l = l->next) - { - JabberBuddyResource *tmp = (JabberBuddyResource *) l->data; - if (!jbr && !resource) { - jbr = tmp; - } else if (!resource) { - if (resource_compare_cb(tmp, jbr) > 0) - jbr = tmp; - } else if(tmp->name) { - if(!strcmp(tmp->name, resource)) { - jbr = tmp; - break; - } - } - } - - return jbr; -} - -JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, - int priority, JabberBuddyState state, const char *status) -{ - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); - if(!jbr) { - jbr = g_new0(JabberBuddyResource, 1); - jbr->jb = jb; - jbr->name = g_strdup(resource); - jbr->capabilities = JABBER_CAP_NONE; - jbr->tz_off = PURPLE_NO_TZ_OFF; - jb->resources = g_list_append(jb->resources, jbr); - } - jbr->priority = priority; - jbr->state = state; - g_free(jbr->status); - jbr->status = g_strdup(status); - - return jbr; -} - -void jabber_buddy_resource_free(JabberBuddyResource *jbr) -{ - g_return_if_fail(jbr != NULL); - - jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); - - while(jbr->commands) { - JabberAdHocCommands *cmd = jbr->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); - } - - if (jbr->caps.exts) { - g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); - g_list_free(jbr->caps.exts); - } - g_free(jbr->name); - g_free(jbr->status); - g_free(jbr->thread_id); - g_free(jbr->client.name); - g_free(jbr->client.version); - g_free(jbr->client.os); - g_free(jbr); -} - -void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource) -{ - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); - - if(!jbr) - return; - - jabber_buddy_resource_free(jbr); -} - -/******* - * This is the old vCard stuff taken from the old prpl. vCards, by definition - * are a temporary thing until jabber can get its act together and come up - * with a format for user information, hence the namespace of 'vcard-temp' - * - * Since I don't feel like putting that much work into something that's - * _supposed_ to go away, i'm going to just copy the kludgy old code here, - * and make it purdy when jabber comes up with a standards-track JEP to - * replace vcard-temp - * --Nathan - *******/ - -/*---------------------------------------*/ -/* Jabber "set info" (vCard) support */ -/*---------------------------------------*/ - -/* - * V-Card format: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * <ROLE/> - * <DESC/> - * <BDAY/> - * </vCard> - * - * See also: - * - * http://docs.jabber.org/proto/html/vcard-temp.html - * http://www.vcard-xml.org/dtd/vCard-XML-v2-20010520.dtd - */ - -/* - * Cross-reference user-friendly V-Card entry labels to vCard XML tags - * and attributes. - * - * Order is (or should be) unimportant. For example: we have no way of - * knowing in what order real data will arrive. - * - * Format: Label, Pre-set text, "visible" flag, "editable" flag, XML tag - * name, XML tag's parent tag "path" (relative to vCard node). - * - * List is terminated by a NULL label pointer. - * - * Entries with no label text, but with XML tag and parent tag - * entries, are used by V-Card XML construction routines to - * "automagically" construct the appropriate XML node tree. - * - * Thoughts on future direction/expansion - * - * This is a "simple" vCard. - * - * It is possible for nodes other than the "vCard" node to have - * attributes. Should that prove necessary/desirable, add an - * "attributes" pointer to the vcard_template struct, create the - * necessary tag_attr structs, and add 'em to the vcard_dflt_data - * array. - * - * The above changes will (obviously) require changes to the vCard - * construction routines. - */ - -struct vcard_template { - char *label; /* label text pointer */ - char *tag; /* tag text */ - char *ptag; /* parent tag "path" text */ -} const vcard_template_data[] = { - {N_("Full Name"), "FN", NULL}, - {N_("Family Name"), "FAMILY", "N"}, - {N_("Given Name"), "GIVEN", "N"}, - {N_("Nickname"), "NICKNAME", NULL}, - {N_("URL"), "URL", NULL}, - {N_("Street Address"), "STREET", "ADR"}, - {N_("Extended Address"), "EXTADD", "ADR"}, - {N_("Locality"), "LOCALITY", "ADR"}, - {N_("Region"), "REGION", "ADR"}, - {N_("Postal Code"), "PCODE", "ADR"}, - {N_("Country"), "CTRY", "ADR"}, - {N_("Telephone"), "NUMBER", "TEL"}, - {N_("Email"), "USERID", "EMAIL"}, - {N_("Organization Name"), "ORGNAME", "ORG"}, - {N_("Organization Unit"), "ORGUNIT", "ORG"}, - {N_("Title"), "TITLE", NULL}, - {N_("Role"), "ROLE", NULL}, - {N_("Birthday"), "BDAY", NULL}, - {N_("Description"), "DESC", NULL}, - {"", "N", NULL}, - {"", "ADR", NULL}, - {"", "ORG", NULL}, - {NULL, NULL, NULL} -}; - -/* - * The "vCard" tag's attribute list... - */ -struct tag_attr { - char *attr; - char *value; -} const vcard_tag_attr_list[] = { - {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, - {"version", "2.0", }, - {"xmlns", "vcard-temp", }, - {NULL, NULL}, -}; - - -/* - * Insert a tag node into an xmlnode tree, recursively inserting parent tag - * nodes as necessary - * - * Returns pointer to inserted node - * - * Note to hackers: this code is designed to be re-entrant (it's recursive--it - * calls itself), so don't put any "static"s in here! - */ -static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, const char *new_tag) -{ - xmlnode *x = NULL; - - /* - * If the parent tag wasn't specified, see if we can get it - * from the vCard template struct. - */ - if(parent_tag == NULL) { - const struct vcard_template *vc_tp = vcard_template_data; - - while(vc_tp->label != NULL) { - if(strcmp(vc_tp->tag, new_tag) == 0) { - parent_tag = vc_tp->ptag; - break; - } - ++vc_tp; - } - } - - /* - * If we have a parent tag... - */ - if(parent_tag != NULL ) { - /* - * Try to get the parent node for a tag - */ - if((x = xmlnode_get_child(start, parent_tag)) == NULL) { - /* - * Descend? - */ - char *grand_parent = g_strdup(parent_tag); - char *parent; - - if((parent = strrchr(grand_parent, '/')) != NULL) { - *(parent++) = '\0'; - x = insert_tag_to_parent_tag(start, grand_parent, parent); - } else { - x = xmlnode_new_child(start, grand_parent); - } - g_free(grand_parent); - } else { - /* - * We found *something* to be the parent node. - * Note: may be the "root" node! - */ - xmlnode *y; - if((y = xmlnode_get_child(x, new_tag)) != NULL) { - return(y); - } - } - } - - /* - * insert the new tag into its parent node - */ - return(xmlnode_new_child((x == NULL? start : x), new_tag)); -} - -/* - * Send vCard info to Jabber server - */ -void jabber_set_info(PurpleConnection *gc, const char *info) -{ - PurpleStoredImage *img; - JabberIq *iq; - JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *vc_node; - const struct tag_attr *tag_attr; - - /* if we have't grabbed the remote vcard yet, we can't - * assume that what we have here is correct */ - if(!js->vcard_fetched) - return; - - if (js->vcard_timer) { - purple_timeout_remove(js->vcard_timer); - js->vcard_timer = 0; - } - - g_free(js->avatar_hash); - js->avatar_hash = NULL; - - /* - * Send only if there's actually any *information* to send - */ - vc_node = info ? xmlnode_from_str(info, -1) : NULL; - - if (vc_node && (!vc_node->name || - g_ascii_strncasecmp(vc_node->name, "vCard", 5))) { - xmlnode_free(vc_node); - vc_node = NULL; - } - - if ((img = purple_buddy_icons_find_account_icon(gc->account))) { - gconstpointer avatar_data; - gsize avatar_len; - xmlnode *photo, *binval, *type; - gchar *enc; - - if(!vc_node) { - vc_node = xmlnode_new("vCard"); - for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) - xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); - } - - avatar_data = purple_imgstore_get_data(img); - avatar_len = purple_imgstore_get_size(img); - /* Get rid of an old PHOTO if one exists. - * TODO: This may want to be modified to remove all old PHOTO - * children, at the moment some people have managed to get - * multiple PHOTO entries in their vCard. */ - if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { - xmlnode_free(photo); - } - photo = xmlnode_new_child(vc_node, "PHOTO"); - type = xmlnode_new_child(photo, "TYPE"); - xmlnode_insert_data(type, "image/png", -1); - binval = xmlnode_new_child(photo, "BINVAL"); - enc = purple_base64_encode(avatar_data, avatar_len); - - js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len); - - xmlnode_insert_data(binval, enc, -1); - g_free(enc); - purple_imgstore_unref(img); - } else if (vc_node) { - xmlnode *photo; - /* TODO: Remove all PHOTO children? (see above note) */ - if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) { - xmlnode_free(photo); - } - } - - if (vc_node != NULL) { - iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode_insert_child(iq->node, vc_node); - jabber_iq_send(iq); - - /* Send presence to update vcard-temp:x:update */ - jabber_presence_send(js, FALSE); - } -} - -void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - PurpleAccount *account = purple_connection_get_account(gc); - - /* Publish the avatar as specified in XEP-0084 */ - jabber_avatar_set(gc->proto_data, img); - /* Set the image in our vCard */ - jabber_set_info(gc, purple_account_get_user_info(account)); - - /* TODO: Fake image to ourselves, since a number of servers do not echo - * back our presence to us. To do this without uselessly copying the data - * of the image, we need purple_buddy_icons_set_for_user_image (i.e. takes - * an existing icon/stored image). */ -} - -/* - * This is the callback from the "ok clicked" for "set vCard" - * - * Sets the vCard with data from PurpleRequestFields. - */ -static void -jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) -{ - xmlnode *vc_node; - PurpleRequestField *field; - const char *text; - char *p; - const struct vcard_template *vc_tp; - const struct tag_attr *tag_attr; - - vc_node = xmlnode_new("vCard"); - - for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) - xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); - - for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { - if (*vc_tp->label == '\0') - continue; - - field = purple_request_fields_get_field(fields, vc_tp->tag); - text = purple_request_field_string_get_value(field); - - - if (text != NULL && *text != '\0') { - xmlnode *xp; - - purple_debug_info("jabber", "Setting %s to '%s'\n", vc_tp->tag, text); - - if ((xp = insert_tag_to_parent_tag(vc_node, - NULL, vc_tp->tag)) != NULL) { - - xmlnode_insert_data(xp, text, -1); - } - } - } - - p = xmlnode_to_str(vc_node, NULL); - xmlnode_free(vc_node); - - purple_account_set_user_info(purple_connection_get_account(gc), p); - serv_set_info(gc, p); - - g_free(p); -} - -/* - * This gets executed by the proto action - * - * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info - * string (if any) into GSLists for the (multi-entry) edit dialog and - * calls the set_vcard dialog. - */ -void jabber_setup_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - const struct vcard_template *vc_tp; - const char *user_info; - char *cdata = NULL; - xmlnode *x_vc_data = NULL; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - /* - * Get existing, XML-formatted, user info - */ - if((user_info = purple_account_get_user_info(gc->account)) != NULL) - x_vc_data = xmlnode_from_str(user_info, -1); - - /* - * Set up GSLists for edit with labels from "template," data from user info - */ - for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { - xmlnode *data_node; - if((vc_tp->label)[0] == '\0') - continue; - - if (x_vc_data != NULL) { - if(vc_tp->ptag == NULL) { - data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); - } else { - gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); - data_node = xmlnode_get_child(x_vc_data, tag); - g_free(tag); - } - if(data_node) - cdata = xmlnode_get_data(data_node); - } - - if(strcmp(vc_tp->tag, "DESC") == 0) { - field = purple_request_field_string_new(vc_tp->tag, - _(vc_tp->label), cdata, - TRUE); - } else { - field = purple_request_field_string_new(vc_tp->tag, - _(vc_tp->label), cdata, - FALSE); - } - - g_free(cdata); - cdata = NULL; - - purple_request_field_group_add_field(group, field); - } - - if(x_vc_data != NULL) - xmlnode_free(x_vc_data); - - purple_request_fields(gc, _("Edit XMPP vCard"), - _("Edit XMPP vCard"), - _("All items below are optional. Enter only the " - "information with which you feel comfortable."), - fields, - _("Save"), G_CALLBACK(jabber_format_info), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -/*---------------------------------------*/ -/* End Jabber "set info" (vCard) support */ -/*---------------------------------------*/ - -/****** - * end of that ancient crap that needs to die - ******/ - -static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) -{ - /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ - if (jbi->timeout_handle > 0) - purple_timeout_remove(jbi->timeout_handle); - - g_free(jbi->jid); - g_hash_table_destroy(jbi->resources); - g_free(jbi->last_message); - purple_notify_user_info_destroy(jbi->user_info); - g_free(jbi); -} - -static void -add_jbr_info(JabberBuddyInfo *jbi, const char *resource, - JabberBuddyResource *jbr) -{ - JabberBuddyInfoResource *jbir; - PurpleNotifyUserInfo *user_info; - - jbir = g_hash_table_lookup(jbi->resources, resource); - user_info = jbi->user_info; - - if (jbr && jbr->client.name) { - char *tmp = - g_strdup_printf("%s%s%s", jbr->client.name, - (jbr->client.version ? " " : ""), - (jbr->client.version ? jbr->client.version : "")); - purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); - g_free(tmp); - - if (jbr->client.os) - purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); - } - - if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { - time_t now_t; - struct tm *now; - char *timestamp; - time(&now_t); - now_t += jbr->tz_off; - now = gmtime(&now_t); - - timestamp = - g_strdup_printf("%s %c%02d%02d", purple_time_format(now), - jbr->tz_off < 0 ? '-' : '+', - abs(jbr->tz_off / (60*60)), - abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); - g_free(timestamp); - } - - if (jbir && jbir->idle_seconds > 0) { - char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); - g_free(idle); - } - - if (jbr) { - char *purdy = NULL; - char *tmp; - char priority[12]; - const char *status_name = jabber_buddy_state_get_name(jbr->state); - - if (jbr->status) { - tmp = purple_markup_escape_text(jbr->status, -1); - purdy = purple_strdup_withhtml(tmp); - g_free(tmp); - - if (purple_strequal(status_name, purdy)) - status_name = NULL; - } - - tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), - ((status_name && purdy) ? ": " : ""), - (purdy ? purdy : "")); - purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); - - g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); - - g_free(tmp); - g_free(purdy); - } else { - purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); - } -} - -static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) -{ - char *resource_name; - JabberBuddyResource *jbr; - GList *resources; - PurpleNotifyUserInfo *user_info; - - /* not yet */ - if (jbi->ids) - return; - - user_info = jbi->user_info; - resource_name = jabber_get_resource(jbi->jid); - - /* If we have one or more pairs from the vcard, put a section break above it */ - if (purple_notify_user_info_get_entries(user_info)) - purple_notify_user_info_prepend_section_break(user_info); - - /* Add the information about the user's resource(s) */ - if (resource_name) { - jbr = jabber_buddy_find_resource(jbi->jb, resource_name); - add_jbr_info(jbi, resource_name, jbr); - } else { - for (resources = jbi->jb->resources; resources; resources = resources->next) { - jbr = resources->data; - - /* put a section break between resources, this is not needed if - we are at the first, because one was already added for the vcard - section */ - if (resources != jbi->jb->resources) - purple_notify_user_info_prepend_section_break(user_info); - - add_jbr_info(jbi, jbr->name, jbr); - - if (jbr->name) - purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); - } - } - - if (!jbi->jb->resources) { - /* the buddy is offline */ - gchar *status = - g_strdup_printf("%s%s%s", _("Offline"), - jbi->last_message ? ": " : "", - jbi->last_message ? jbi->last_message : ""); - if (jbi->last_seconds > 0) { - char *last = purple_str_seconds_to_string(jbi->last_seconds); - gchar *message = g_strdup_printf(_("%s ago"), last); - purple_notify_user_info_prepend_pair(user_info, - _("Logged Off"), message); - g_free(last); - g_free(message); - } - purple_notify_user_info_prepend_pair(user_info, _("Status"), status); - g_free(status); - } - - g_free(resource_name); - - purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); - - while (jbi->vcard_imgids) { - purple_imgstore_unref_by_id(GPOINTER_TO_INT(jbi->vcard_imgids->data)); - jbi->vcard_imgids = g_slist_delete_link(jbi->vcard_imgids, jbi->vcard_imgids); - } - - jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); - - jabber_buddy_info_destroy(jbi); -} - -static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) -{ - GSList *l = jbi->ids; - char *comp_id; - - if(!id) - return; - - while(l) { - comp_id = l->data; - if(!strcmp(id, comp_id)) { - jbi->ids = g_slist_remove(jbi->ids, comp_id); - g_free(comp_id); - return; - } - l = l->next; - } -} - -static gboolean -set_own_vcard_cb(gpointer data) -{ - JabberStream *js = data; - PurpleAccount *account = purple_connection_get_account(js->gc); - - js->vcard_timer = 0; - - jabber_set_info(js->gc, purple_account_get_user_info(account)); - - return FALSE; -} - -static void jabber_vcard_save_mine(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *vcard, *photo, *binval; - char *txt, *vcard_hash = NULL; - PurpleAccount *account; - - if (type == JABBER_IQ_ERROR) { - xmlnode *error; - purple_debug_warning("jabber", "Server returned error while retrieving vCard\n"); - - error = xmlnode_get_child(packet, "error"); - if (!error || !xmlnode_get_child(error, "item-not-found")) - return; - } - - account = purple_connection_get_account(js->gc); - - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) - { - txt = xmlnode_to_str(vcard, NULL); - purple_account_set_user_info(account, txt); - g_free(txt); - } else { - /* if we have no vCard, then lets not overwrite what we might have locally */ - } - - js->vcard_fetched = TRUE; - - if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && - (binval = xmlnode_get_child(photo, "BINVAL"))) { - gsize size; - char *bintext = xmlnode_get_data(binval); - if (bintext) { - guchar *data = purple_base64_decode(bintext, &size); - g_free(bintext); - - if (data) { - vcard_hash = jabber_calculate_data_sha1sum(data, size); - g_free(data); - } - } - } - - /* Republish our vcard if the photo is different than the server's */ - if (js->initial_avatar_hash && !purple_strequal(vcard_hash, js->initial_avatar_hash)) { - /* - * Google Talk has developed the behavior that it will not accept - * a vcard set in the first 10 seconds (or so) of the connection; - * it returns an error (namespaces trimmed): - * <error code="500" type="wait"><internal-server-error/></error>. - */ - if (js->googletalk) - js->vcard_timer = purple_timeout_add_seconds(10, set_own_vcard_cb, - js); - else - jabber_set_info(js->gc, purple_account_get_user_info(account)); - } else if (vcard_hash) { - /* A photo is in the vCard. Advertise its hash */ - js->avatar_hash = vcard_hash; - vcard_hash = NULL; - - /* Send presence to update vcard-temp:x:update */ - jabber_presence_send(js, FALSE); - } - - g_free(vcard_hash); -} - -void jabber_vcard_fetch_mine(JabberStream *js) -{ - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - - xmlnode *vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); - jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); - - jabber_iq_send(iq); -} - -static void jabber_vcard_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - char *bare_jid; - char *text; - char *serverside_alias = NULL; - xmlnode *vcard; - PurpleBuddy *b; - JabberBuddyInfo *jbi = data; - PurpleNotifyUserInfo *user_info; - - if(!jbi) - return; - - jabber_buddy_info_remove_id(jbi, id); - - if(!from) - return; - - if(!jabber_buddy_find(js, from, FALSE)) - return; - - /* XXX: handle the error case */ - - user_info = jbi->user_info; - bare_jid = jabber_get_bare_jid(from); - - b = purple_find_buddy(js->gc->account, bare_jid); - - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { - xmlnode *child; - for(child = vcard->child; child; child = child->next) - { - xmlnode *child2; - - if(child->type != XMLNODE_TYPE_TAG) - continue; - - text = xmlnode_get_data(child); - if(text && !strcmp(child->name, "FN")) { - if (!serverside_alias) - serverside_alias = g_strdup(text); - - purple_notify_user_info_add_pair(user_info, _("Full Name"), text); - } else if(!strcmp(child->name, "N")) { - for(child2 = child->child; child2; child2 = child2->next) - { - char *text2; - - if(child2->type != XMLNODE_TYPE_TAG) - continue; - - text2 = xmlnode_get_data(child2); - if(text2 && !strcmp(child2->name, "FAMILY")) { - purple_notify_user_info_add_pair(user_info, _("Family Name"), text2); - } else if(text2 && !strcmp(child2->name, "GIVEN")) { - purple_notify_user_info_add_pair(user_info, _("Given Name"), text2); - } else if(text2 && !strcmp(child2->name, "MIDDLE")) { - purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); - } - g_free(text2); - } - } else if(text && !strcmp(child->name, "NICKNAME")) { - /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid. - * Ignore it if it's part of the jid. */ - if (strstr(bare_jid, text) == NULL) { - g_free(serverside_alias); - serverside_alias = g_strdup(text); - - purple_notify_user_info_add_pair(user_info, _("Nickname"), text); - } - } else if(text && !strcmp(child->name, "BDAY")) { - purple_notify_user_info_add_pair(user_info, _("Birthday"), text); - } else if(!strcmp(child->name, "ADR")) { - gboolean address_line_added = FALSE; - - for(child2 = child->child; child2; child2 = child2->next) - { - char *text2; - - if(child2->type != XMLNODE_TYPE_TAG) - continue; - - text2 = xmlnode_get_data(child2); - if (text2 == NULL) - continue; - - /* We do this here so that it's not added if all the child - * elements are empty. */ - if (!address_line_added) - { - purple_notify_user_info_add_section_header(user_info, _("Address")); - address_line_added = TRUE; - } - - if(!strcmp(child2->name, "POBOX")) { - purple_notify_user_info_add_pair(user_info, _("P.O. Box"), text2); - } else if (g_str_equal(child2->name, "EXTADD") || g_str_equal(child2->name, "EXTADR")) { - /* - * EXTADD is correct, EXTADR is generated by other - * clients. The next time someone reads this, remove - * EXTADR. - */ - purple_notify_user_info_add_pair(user_info, _("Extended Address"), text2); - } else if(!strcmp(child2->name, "STREET")) { - purple_notify_user_info_add_pair(user_info, _("Street Address"), text2); - } else if(!strcmp(child2->name, "LOCALITY")) { - purple_notify_user_info_add_pair(user_info, _("Locality"), text2); - } else if(!strcmp(child2->name, "REGION")) { - purple_notify_user_info_add_pair(user_info, _("Region"), text2); - } else if(!strcmp(child2->name, "PCODE")) { - purple_notify_user_info_add_pair(user_info, _("Postal Code"), text2); - } else if(!strcmp(child2->name, "CTRY") - || !strcmp(child2->name, "COUNTRY")) { - purple_notify_user_info_add_pair(user_info, _("Country"), text2); - } - g_free(text2); - } - - if (address_line_added) - purple_notify_user_info_add_section_break(user_info); - - } else if(!strcmp(child->name, "TEL")) { - char *number; - if((child2 = xmlnode_get_child(child, "NUMBER"))) { - /* show what kind of number it is */ - number = xmlnode_get_data(child2); - if(number) { - purple_notify_user_info_add_pair(user_info, _("Telephone"), number); - g_free(number); - } - } else if((number = xmlnode_get_data(child))) { - /* lots of clients (including purple) do this, but it's - * out of spec */ - purple_notify_user_info_add_pair(user_info, _("Telephone"), number); - g_free(number); - } - } else if(!strcmp(child->name, "EMAIL")) { - char *userid, *escaped; - if((child2 = xmlnode_get_child(child, "USERID"))) { - /* show what kind of email it is */ - userid = xmlnode_get_data(child2); - if(userid) { - char *mailto; - escaped = g_markup_escape_text(userid, -1); - mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); - purple_notify_user_info_add_pair(user_info, _("Email"), mailto); - - g_free(mailto); - g_free(escaped); - g_free(userid); - } - } else if((userid = xmlnode_get_data(child))) { - /* lots of clients (including purple) do this, but it's - * out of spec */ - char *mailto; - - escaped = g_markup_escape_text(userid, -1); - mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); - purple_notify_user_info_add_pair(user_info, _("Email"), mailto); - - g_free(mailto); - g_free(escaped); - g_free(userid); - } - } else if(!strcmp(child->name, "ORG")) { - for(child2 = child->child; child2; child2 = child2->next) - { - char *text2; - - if(child2->type != XMLNODE_TYPE_TAG) - continue; - - text2 = xmlnode_get_data(child2); - if(text2 && !strcmp(child2->name, "ORGNAME")) { - purple_notify_user_info_add_pair(user_info, _("Organization Name"), text2); - } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { - purple_notify_user_info_add_pair(user_info, _("Organization Unit"), text2); - } - g_free(text2); - } - } else if(text && !strcmp(child->name, "TITLE")) { - purple_notify_user_info_add_pair(user_info, _("Title"), text); - } else if(text && !strcmp(child->name, "ROLE")) { - purple_notify_user_info_add_pair(user_info, _("Role"), text); - } else if(text && !strcmp(child->name, "DESC")) { - purple_notify_user_info_add_pair(user_info, _("Description"), text); - } else if(!strcmp(child->name, "PHOTO") || - !strcmp(child->name, "LOGO")) { - char *bintext = NULL; - xmlnode *binval; - - if ((binval = xmlnode_get_child(child, "BINVAL")) && - (bintext = xmlnode_get_data(binval))) { - gsize size; - guchar *data; - gboolean photo = (strcmp(child->name, "PHOTO") == 0); - - data = purple_base64_decode(bintext, &size); - if (data) { - char *img_text; - char *hash; - - jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); - img_text = g_strdup_printf("<img id='%d'>", GPOINTER_TO_INT(jbi->vcard_imgids->data)); - - purple_notify_user_info_add_pair(user_info, (photo ? _("Photo") : _("Logo")), img_text); - - hash = jabber_calculate_data_sha1sum(data, size); - purple_buddy_icons_set_for_user(js->gc->account, bare_jid, - data, size, hash); - g_free(hash); - g_free(img_text); - } - g_free(bintext); - } - } - g_free(text); - } - } - - if (serverside_alias) { - /* If we found a serverside alias, set it and tell the core */ - serv_got_alias(js->gc, from, serverside_alias); - if (b) { - purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias); - } - - g_free(serverside_alias); - } - - g_free(bare_jid); - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_buddy_info_resource_free(gpointer data) -{ - JabberBuddyInfoResource *jbri = data; - g_free(jbri); -} - -static guint jbir_hash(gconstpointer v) -{ - if (v) - return g_str_hash(v); - else - return 0; -} - -static gboolean jbir_equal(gconstpointer v1, gconstpointer v2) -{ - const gchar *resource_1 = v1; - const gchar *resource_2 = v2; - - return purple_strequal(resource_1, resource_2); -} - -static void jabber_version_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - xmlnode *query; - char *resource_name; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if(!from) - return; - - resource_name = jabber_get_resource(from); - - if(resource_name) { - if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); - if(jbr) { - xmlnode *node; - if((node = xmlnode_get_child(query, "name"))) { - jbr->client.name = xmlnode_get_data(node); - } - if((node = xmlnode_get_child(query, "version"))) { - jbr->client.version = xmlnode_get_data(node); - } - if((node = xmlnode_get_child(query, "os"))) { - jbr->client.os = xmlnode_get_data(node); - } - } - } - } - g_free(resource_name); - } - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_last_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - xmlnode *query; - char *resource_name; - const char *seconds; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if(!from) - return; - - resource_name = jabber_get_resource(from); - - if(resource_name) { - if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - seconds = xmlnode_get_attrib(query, "seconds"); - if(seconds) { - char *end = NULL; - long sec = strtol(seconds, &end, 10); - JabberBuddy *jb = NULL; - char *resource = NULL; - char *buddy_name = NULL; - JabberBuddyResource *jbr = NULL; - - if(end != seconds) { - JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); - if(jbir) { - jbir->idle_seconds = sec; - } - } - /* Update the idle time of the buddy resource, if we got it. - This will correct the value when a server doesn't mark - delayed presence and we got the presence when signing on */ - jb = jabber_buddy_find(js, from, FALSE); - if (jb) { - resource = jabber_get_resource(from); - buddy_name = jabber_get_bare_jid(from); - /* if the resource already has an idle time set, we - must have gotten it originally from a presence. In - this case we update it. Otherwise don't update it, to - avoid setting an idle and not getting informed about - the resource getting unidle */ - if (resource && buddy_name) { - jbr = jabber_buddy_find_resource(jb, resource); - if (jbr) { - if (jbr->idle) { - if (sec) { - jbr->idle = time(NULL) - sec; - } else { - jbr->idle = 0; - } - - if (jbr == - jabber_buddy_find_resource(jb, NULL)) { - purple_prpl_got_user_idle(js->gc->account, - buddy_name, jbr->idle, jbr->idle); - } - } - } - } - g_free(resource); - g_free(buddy_name); - } - } - } - } - g_free(resource_name); - } - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_last_offline_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - xmlnode *query; - const char *seconds; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if(!from) - return; - - if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - seconds = xmlnode_get_attrib(query, "seconds"); - if(seconds) { - char *end = NULL; - long sec = strtol(seconds, &end, 10); - if(end != seconds) { - jbi->last_seconds = sec; - } - } - jbi->last_message = xmlnode_get_data(query); - } - } - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_time_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - JabberBuddyResource *jbr; - char *resource_name; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if (!from) - return; - - resource_name = jabber_get_resource(from); - jbr = resource_name ? jabber_buddy_find_resource(jbi->jb, resource_name) : NULL; - g_free(resource_name); - if (jbr) { - if (type == JABBER_IQ_RESULT) { - xmlnode *time = xmlnode_get_child(packet, "time"); - xmlnode *tzo = time ? xmlnode_get_child(time, "tzo") : NULL; - char *tzo_data = tzo ? xmlnode_get_data(tzo) : NULL; - if (tzo_data) { - char *c = tzo_data; - int hours, minutes; - if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') { - jbr->tz_off = 0; - } else { - gboolean offset_positive = (tzo_data[0] == '+'); - /* [+-]HH:MM */ - if (((*c == '+' || *c == '-') && (c = c + 1)) && - sscanf(c, "%02d:%02d", &hours, &minutes) == 2) { - jbr->tz_off = 60*60*hours + 60*minutes; - if (!offset_positive) - jbr->tz_off *= -1; - } else { - purple_debug_info("jabber", "Ignoring malformed timezone %s", - tzo_data); - } - } - - g_free(tzo_data); - } - } - } - - jabber_buddy_info_show_if_ready(jbi); -} - -void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) -{ - if (js->pending_buddy_info_requests) - { - JabberBuddyInfo *jbi; - GSList *l = js->pending_buddy_info_requests; - while (l) { - jbi = l->data; - - g_slist_free(jbi->ids); - jabber_buddy_info_destroy(jbi); - - l = l->next; - } - - g_slist_free(js->pending_buddy_info_requests); - js->pending_buddy_info_requests = NULL; - } -} - -static gboolean jabber_buddy_get_info_timeout(gpointer data) -{ - JabberBuddyInfo *jbi = data; - - /* remove the pending callbacks */ - while(jbi->ids) { - char *id = jbi->ids->data; - jabber_iq_remove_callback_by_id(jbi->js, id); - jbi->ids = g_slist_remove(jbi->ids, id); - g_free(id); - } - - jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); - jbi->timeout_handle = 0; - - jabber_buddy_info_show_if_ready(jbi); - - return FALSE; -} - -static gboolean _client_is_blacklisted(JabberBuddyResource *jbr, const char *ns) -{ - /* can't be blacklisted if we don't know what you're running yet */ - if(!jbr->client.name) - return FALSE; - - if(!strcmp(ns, NS_LAST_ACTIVITY)) { - if(!strcmp(jbr->client.name, "Trillian")) { - /* verified by nwalp 2007/05/09 */ - if(!strcmp(jbr->client.version, "3.1.0.121") || - /* verified by nwalp 2007/09/19 */ - !strcmp(jbr->client.version, "3.1.7.0")) { - return TRUE; - } - } - } - - return FALSE; -} - -static void -dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, - gboolean is_bare_jid, const char *jid, - JabberBuddyResource *jbr) -{ - JabberIq *iq; - JabberBuddyInfoResource *jbir; - char *full_jid = NULL; - const char *to; - - if (is_bare_jid && jbr->name) { - full_jid = g_strdup_printf("%s/%s", jid, jbr->name); - to = full_jid; - } else - to = jid; - - jbir = g_new0(JabberBuddyInfoResource, 1); - g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); - - if(!jbr->client.name) { - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); - xmlnode_set_attrib(iq->node, "to", to); - jabber_iq_set_callback(iq, jabber_version_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - /* this is to fix the feeling of irritation I get when trying - * to get info on a friend running Trillian, which doesn't - * respond (with an error or otherwise) to jabber:iq:last - * requests. There are a number of Trillian users in my - * office. */ - if(!_client_is_blacklisted(jbr, NS_LAST_ACTIVITY)) { - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); - xmlnode_set_attrib(iq->node, "to", to); - jabber_iq_set_callback(iq, jabber_last_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - if (jbr->tz_off == PURPLE_NO_TZ_OFF && - (!jbr->caps.info || - jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) { - xmlnode *child; - iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", to); - child = xmlnode_new_child(iq->node, "time"); - xmlnode_set_namespace(child, NS_ENTITY_TIME); - jabber_iq_set_callback(iq, jabber_time_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - g_free(full_jid); -} - -static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) -{ - JabberIq *iq; - xmlnode *vcard; - GList *resources; - JabberBuddy *jb; - JabberBuddyInfo *jbi; - const char *slash; - gboolean is_bare_jid; - - jb = jabber_buddy_find(js, jid, TRUE); - - /* invalid JID */ - if(!jb) - return; - - slash = strchr(jid, '/'); - is_bare_jid = (slash == NULL); - - jbi = g_new0(JabberBuddyInfo, 1); - jbi->jid = g_strdup(jid); - jbi->js = js; - jbi->jb = jb; - jbi->resources = g_hash_table_new_full(jbir_hash, jbir_equal, g_free, jabber_buddy_info_resource_free); - jbi->user_info = purple_notify_user_info_new(); - - iq = jabber_iq_new(js, JABBER_IQ_GET); - - xmlnode_set_attrib(iq->node, "to", jid); - vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); - - jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - - jabber_iq_send(iq); - - if (is_bare_jid) { - for(resources = jb->resources; resources; resources = resources->next) { - JabberBuddyResource *jbr = resources->data; - dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); - } - } else { - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, slash + 1); - if (jbr) - dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); - else - purple_debug_warning("jabber", "jabber_buddy_get_info_for_jid() " - "was passed JID %s, but there is no corresponding " - "JabberBuddyResource!\n", jid); - } - - if (!jb->resources && is_bare_jid) { - /* user is offline, send a jabber:iq:last to find out last time online */ - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); - xmlnode_set_attrib(iq->node, "to", jid); - jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); - jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); -} - -void jabber_buddy_get_info(PurpleConnection *gc, const char *who) -{ - JabberStream *js = purple_connection_get_protocol_data(gc); - JabberID *jid = jabber_id_new(who); - - if (!jid) - return; - - if (jid->node && jabber_chat_find(js, jid->node, jid->domain)) { - /* For a conversation, include the resource (indicates the user). */ - jabber_buddy_get_info_for_jid(js, who); - } else { - char *bare_jid = jabber_get_bare_jid(who); - jabber_buddy_get_info_for_jid(js, bare_jid); - g_free(bare_jid); - } - - jabber_id_free(jid); -} - -static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, - gboolean invisible) -{ - PurplePresence *gpresence; - PurpleAccount *account; - PurpleStatus *status; - JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); - xmlnode *presence; - JabberBuddyState state; - char *msg; - int priority; - - account = purple_connection_get_account(js->gc); - gpresence = purple_account_get_presence(account); - status = purple_presence_get_active_status(gpresence); - - purple_status_to_jabber(status, &state, &msg, &priority); - presence = jabber_presence_create_js(js, state, msg, priority); - - g_free(msg); - - xmlnode_set_attrib(presence, "to", who); - if(invisible) { - xmlnode_set_attrib(presence, "type", "invisible"); - jb->invisible |= JABBER_INVIS_BUDDY; - } else { - jb->invisible &= ~JABBER_INVIS_BUDDY; - } - - jabber_send(js, presence); - xmlnode_free(presence); -} - -static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); -} - -static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); -} - -static void cancel_presence_notification(gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - buddy = data; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); -} - -static void -jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, - gpointer data) -{ - PurpleBuddy *buddy; - PurpleAccount *account; - PurpleConnection *gc; - const gchar *name; - char *msg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - name = purple_buddy_get_name(buddy); - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - - msg = g_strdup_printf(_("%s will no longer be able to see your status " - "updates. Do you want to continue?"), name); - purple_request_yes_no(gc, NULL, _("Cancel Presence Notification"), - msg, 0 /* Yes */, account, name, NULL, buddy, - cancel_presence_notification, NULL /* Do nothing */); - g_free(msg); -} - -static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); -} - - -static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); -} - -static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* simply create a directed presence of the current status */ - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - JabberStream *js = purple_connection_get_protocol_data(gc); - PurpleAccount *account = purple_connection_get_account(gc); - PurplePresence *gpresence = purple_account_get_presence(account); - PurpleStatus *status = purple_presence_get_active_status(gpresence); - xmlnode *presence; - JabberBuddyState state; - char *msg; - int priority; - - purple_status_to_jabber(status, &state, &msg, &priority); - presence = jabber_presence_create_js(js, state, msg, priority); - - g_free(msg); - - xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); - - jabber_send(js, presence); - xmlnode_free(presence); - } -} - -static void jabber_buddy_logout(PurpleBlistNode *node, gpointer data) { - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* simply create a directed unavailable presence */ - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *presence; - - presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); - - xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); - - jabber_send(js, presence); - xmlnode_free(presence); - } -} - -static GList *jabber_buddy_menu(PurpleBuddy *buddy) -{ - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - JabberStream *js = purple_connection_get_protocol_data(gc); - const char *name = purple_buddy_get_name(buddy); - JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); - GList *jbrs; - - GList *m = NULL; - PurpleMenuAction *act; - - if(!jb) - return m; - - if (js->protocol_version == JABBER_PROTO_0_9 && jb != js->user_jb) { - if(jb->invisible & JABBER_INVIS_BUDDY) { - act = purple_menu_action_new(_("Un-hide From"), - PURPLE_CALLBACK(jabber_buddy_make_visible), - NULL, NULL); - } else { - act = purple_menu_action_new(_("Temporarily Hide From"), - PURPLE_CALLBACK(jabber_buddy_make_invisible), - NULL, NULL); - } - m = g_list_append(m, act); - } - - if(jb->subscription & JABBER_SUB_FROM && jb != js->user_jb) { - act = purple_menu_action_new(_("Cancel Presence Notification"), - PURPLE_CALLBACK(jabber_buddy_cancel_presence_notification), - NULL, NULL); - m = g_list_append(m, act); - } - - if(!(jb->subscription & JABBER_SUB_TO)) { - act = purple_menu_action_new(_("(Re-)Request authorization"), - PURPLE_CALLBACK(jabber_buddy_rerequest_auth), - NULL, NULL); - m = g_list_append(m, act); - - } else if (jb != js->user_jb) { - - /* shouldn't this just happen automatically when the buddy is - removed? */ - act = purple_menu_action_new(_("Unsubscribe"), - PURPLE_CALLBACK(jabber_buddy_unsubscribe), - NULL, NULL); - m = g_list_append(m, act); - } - - if (js->googletalk) { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(google_buddy_node_chat), - NULL, NULL); - m = g_list_append(m, act); - } - - /* - * This if-condition implements parts of XEP-0100: Gateway Interaction - * - * According to stpeter, there is no way to know if a jid on the roster is a gateway without sending a disco#info. - * However, since the gateway might appear offline to us, we cannot get that information. Therefore, I just assume - * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since - * people don't tend to have a server or other service there. - */ - if (g_utf8_strchr(name, -1, '@') == NULL) { - act = purple_menu_action_new(_("Log In"), - PURPLE_CALLBACK(jabber_buddy_login), - NULL, NULL); - m = g_list_append(m, act); - act = purple_menu_action_new(_("Log Out"), - PURPLE_CALLBACK(jabber_buddy_logout), - NULL, NULL); - m = g_list_append(m, act); - } - - /* add all ad hoc commands to the action menu */ - for(jbrs = jb->resources; jbrs; jbrs = g_list_next(jbrs)) { - JabberBuddyResource *jbr = jbrs->data; - GList *commands; - if (!jbr->commands) - continue; - for(commands = jbr->commands; commands; commands = g_list_next(commands)) { - JabberAdHocCommands *cmd = commands->data; - act = purple_menu_action_new(cmd->name, PURPLE_CALLBACK(jabber_adhoc_execute_action), cmd, NULL); - m = g_list_append(m, act); - } - } - - return m; -} - -GList * -jabber_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return jabber_buddy_menu((PurpleBuddy *) node); - } else { - return NULL; - } -} - - -const char * -jabber_buddy_state_get_name(JabberBuddyState state) -{ - switch(state) { - case JABBER_BUDDY_STATE_UNKNOWN: - return _("Unknown"); - case JABBER_BUDDY_STATE_ERROR: - return _("Error"); - case JABBER_BUDDY_STATE_UNAVAILABLE: - return _("Offline"); - case JABBER_BUDDY_STATE_ONLINE: - return _("Available"); - case JABBER_BUDDY_STATE_CHAT: - return _("Chatty"); - case JABBER_BUDDY_STATE_AWAY: - return _("Away"); - case JABBER_BUDDY_STATE_XA: - return _("Extended Away"); - case JABBER_BUDDY_STATE_DND: - return _("Do Not Disturb"); - } - - return _("Unknown"); -} - -JabberBuddyState jabber_buddy_status_id_get_state(const char *id) { - if(!id) - return JABBER_BUDDY_STATE_UNKNOWN; - if(!strcmp(id, "available")) - return JABBER_BUDDY_STATE_ONLINE; - if(!strcmp(id, "freeforchat")) - return JABBER_BUDDY_STATE_CHAT; - if(!strcmp(id, "away")) - return JABBER_BUDDY_STATE_AWAY; - if(!strcmp(id, "extended_away")) - return JABBER_BUDDY_STATE_XA; - if(!strcmp(id, "dnd")) - return JABBER_BUDDY_STATE_DND; - if(!strcmp(id, "offline")) - return JABBER_BUDDY_STATE_UNAVAILABLE; - if(!strcmp(id, "error")) - return JABBER_BUDDY_STATE_ERROR; - - return JABBER_BUDDY_STATE_UNKNOWN; -} - -const struct { - const char *name; - JabberBuddyState state; -} show_state_pairs[] = { - { "available", JABBER_BUDDY_STATE_ONLINE }, - { "chat", JABBER_BUDDY_STATE_CHAT }, - { "away", JABBER_BUDDY_STATE_AWAY }, - { "xa", JABBER_BUDDY_STATE_XA }, - { "dnd", JABBER_BUDDY_STATE_DND }, - { "offline", JABBER_BUDDY_STATE_UNAVAILABLE }, - { "error", JABBER_BUDDY_STATE_ERROR }, - { NULL, JABBER_BUDDY_STATE_UNKNOWN } -}; - -JabberBuddyState jabber_buddy_show_get_state(const char *id) -{ - int i; - - g_return_val_if_fail(id != NULL, JABBER_BUDDY_STATE_UNKNOWN); - - for (i = 0; show_state_pairs[i].name; ++i) - if (g_str_equal(id, show_state_pairs[i].name)) - return show_state_pairs[i].state; - - purple_debug_warning("jabber", "Invalid value of presence <show/> " - "attribute: %s\n", id); - return JABBER_BUDDY_STATE_UNKNOWN; -} - -const char * -jabber_buddy_state_get_show(JabberBuddyState state) -{ - int i; - - for (i = 0; show_state_pairs[i].name; ++i) - if (state == show_state_pairs[i].state) - return show_state_pairs[i].name; - -/* purple_debug_warning("jabber", "Unknown buddy state: %d\n", state); */ - return NULL; -} - -const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { - switch(state) { - case JABBER_BUDDY_STATE_CHAT: - return "freeforchat"; - case JABBER_BUDDY_STATE_AWAY: - return "away"; - case JABBER_BUDDY_STATE_XA: - return "extended_away"; - case JABBER_BUDDY_STATE_DND: - return "dnd"; - case JABBER_BUDDY_STATE_ONLINE: - return "available"; - case JABBER_BUDDY_STATE_UNKNOWN: - return "available"; - case JABBER_BUDDY_STATE_ERROR: - return "error"; - case JABBER_BUDDY_STATE_UNAVAILABLE: - return "offline"; - } - return NULL; -} - -static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) -{ - /* XXX find out the jid */ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 0), NULL, NULL); -} - -static void user_search_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - xmlnode *x, *query, *item, *field; - - /* XXX error checking? */ - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - results = purple_notify_searchresults_new(); - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - xmlnode *reported; - GSList *column_vars = NULL; - - purple_debug_info("jabber", "new-skool\n"); - - if((reported = xmlnode_get_child(x, "reported"))) { - xmlnode *field = xmlnode_get_child(reported, "field"); - while(field) { - const char *var = xmlnode_get_attrib(field, "var"); - const char *label = xmlnode_get_attrib(field, "label"); - if(var) { - column = purple_notify_searchresults_column_new(label ? label : var); - purple_notify_searchresults_column_add(results, column); - column_vars = g_slist_append(column_vars, (char *)var); - } - field = xmlnode_get_next_twin(field); - } - } - - item = xmlnode_get_child(x, "item"); - while(item) { - GList *row = NULL; - GSList *l; - xmlnode *valuenode; - const char *var; - - for (l = column_vars; l != NULL; l = l->next) { - /* - * Build a row containing the strings that correspond - * to each column of the search results. - */ - for (field = xmlnode_get_child(item, "field"); - field != NULL; - field = xmlnode_get_next_twin(field)) - { - if ((var = xmlnode_get_attrib(field, "var")) && - !strcmp(var, l->data) && - (valuenode = xmlnode_get_child(field, "value"))) - { - char *value = xmlnode_get_data(valuenode); - row = g_list_append(row, value); - break; - } - } - if (field == NULL) - /* No data for this column */ - row = g_list_append(row, NULL); - } - purple_notify_searchresults_row_add(results, row); - item = xmlnode_get_next_twin(item); - } - - g_slist_free(column_vars); - } else { - /* old skool */ - purple_debug_info("jabber", "old-skool\n"); - - column = purple_notify_searchresults_column_new(_("JID")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("First Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Last Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Nickname")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Email")); - purple_notify_searchresults_column_add(results, column); - - for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) { - const char *jid; - xmlnode *node; - GList *row = NULL; - - if(!(jid = xmlnode_get_attrib(item, "jid"))) - continue; - - row = g_list_append(row, g_strdup(jid)); - node = xmlnode_get_child(item, "first"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "last"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "nick"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "email"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - purple_debug_info("jabber", "row=%p\n", row); - purple_notify_searchresults_row_add(results, row); - } - } - - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - user_search_result_add_buddy_cb); - - purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); -} - -static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - xmlnode *query; - JabberIq *iq; - char *dir_server = data; - const char *type; - - /* if they've cancelled the search, we're - * just going to get an error if we send - * a cancel, so skip it */ - type = xmlnode_get_attrib(result, "type"); - if(type && !strcmp(type, "cancel")) { - g_free(dir_server); - return; - } - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_insert_child(query, result); - - jabber_iq_set_callback(iq, user_search_result_cb, NULL); - xmlnode_set_attrib(iq->node, "to", dir_server); - jabber_iq_send(iq); - g_free(dir_server); -} - -struct user_search_info { - JabberStream *js; - char *directory_server; -}; - -static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) -{ - g_free(usi->directory_server); - g_free(usi); -} - -static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) -{ - JabberStream *js = usi->js; - JabberIq *iq; - xmlnode *query; - GList *groups, *flds; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); - query = xmlnode_get_child(iq->node, "query"); - - for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { - for(flds = purple_request_field_group_get_fields(groups->data); - flds; flds = flds->next) { - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - const char *value = purple_request_field_string_get_value(field); - - if(value && (!strcmp(id, "first") || !strcmp(id, "last") || !strcmp(id, "nick") || !strcmp(id, "email"))) { - xmlnode *y = xmlnode_new_child(query, id); - xmlnode_insert_data(y, value, -1); - } - } - } - - jabber_iq_set_callback(iq, user_search_result_cb, NULL); - xmlnode_set_attrib(iq->node, "to", usi->directory_server); - jabber_iq_send(iq); - - g_free(usi->directory_server); - g_free(usi); -} - -#if 0 -/* This is for gettext only -- it will see this even though there's an #if 0. */ - -/* - * An incomplete list of server generated original language search - * comments for Jabber User Directories - * - * See discussion thread "Search comment for Jabber is not translatable" - * in purple-i18n@lists.sourceforge.net (March 2006) - */ -static const char * jabber_user_dir_comments [] = { - /* current comment from Jabber User Directory users.jabber.org */ - N_("Find a contact by entering the search criteria in the given fields. " - "Note: Each field supports wild card searches (%)"), - NULL -}; -#endif - -static void user_search_fields_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *x; - - if (!from) - return; - - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - if(!msg) - msg = g_strdup(_("Unknown error")); - - purple_notify_error(js->gc, _("Directory Query Failed"), - _("Could not query the directory server."), msg); - g_free(msg); - - return; - } - - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); - return; - } else { - struct user_search_info *usi; - xmlnode *instnode; - char *instructions = NULL; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - /* old skool */ - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - if((instnode = xmlnode_get_child(query, "instructions"))) - { - char *tmp = xmlnode_get_data(instnode); - - if(tmp) - { - /* Try to translate the message (see static message - list in jabber_user_dir_comments[]) */ - instructions = g_strdup_printf(_("Server Instructions: %s"), _(tmp)); - g_free(tmp); - } - } - - if(!instructions) - { - instructions = g_strdup(_("Fill in one or more fields to search " - "for any matching XMPP users.")); - } - - if(xmlnode_get_child(query, "first")) { - field = purple_request_field_string_new("first", _("First Name"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - if(xmlnode_get_child(query, "last")) { - field = purple_request_field_string_new("last", _("Last Name"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - if(xmlnode_get_child(query, "nick")) { - field = purple_request_field_string_new("nick", _("Nickname"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - if(xmlnode_get_child(query, "email")) { - field = purple_request_field_string_new("email", _("Email Address"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - - usi = g_new0(struct user_search_info, 1); - usi->js = js; - usi->directory_server = g_strdup(from); - - purple_request_fields(js->gc, _("Search for XMPP users"), - _("Search for XMPP users"), instructions, fields, - _("Search"), G_CALLBACK(user_search_cb), - _("Cancel"), G_CALLBACK(user_search_cancel_cb), - purple_connection_get_account(js->gc), NULL, NULL, - usi); - - g_free(instructions); - } -} - -void jabber_user_search(JabberStream *js, const char *directory) -{ - JabberIq *iq; - - /* XXX: should probably better validate the directory we're given */ - if(!directory || !*directory) { - purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL); - return; - } - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); - xmlnode_set_attrib(iq->node, "to", directory); - - jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); - - jabber_iq_send(iq); -} - -void jabber_user_search_begin(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = purple_connection_get_protocol_data(gc); - - purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"), - _("Select a user directory to search"), - js->user_directories ? js->user_directories->data : NULL, - FALSE, FALSE, NULL, - _("Search Directory"), PURPLE_CALLBACK(jabber_user_search), - _("Cancel"), NULL, - NULL, NULL, NULL, - js); -} - -gboolean -jabber_resource_know_capabilities(const JabberBuddyResource *jbr) -{ - return jbr->caps.info != NULL; -} - -gboolean -jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap) -{ - const GList *node = NULL; - const JabberCapsNodeExts *exts; - - if (!jbr->caps.info) { - purple_debug_info("jabber", - "Unable to find caps: nothing known about buddy\n"); - return FALSE; - } - - node = g_list_find_custom(jbr->caps.info->features, cap, (GCompareFunc)strcmp); - if (!node && jbr->caps.exts && jbr->caps.info->exts) { - const GList *ext; - exts = jbr->caps.info->exts; - /* Walk through all the enabled caps, checking each list for the cap. - * Don't check it twice, though. */ - for (ext = jbr->caps.exts; ext && !node; ext = ext->next) { - GList *features = g_hash_table_lookup(exts->exts, ext->data); - if (features) - node = g_list_find_custom(features, cap, (GCompareFunc)strcmp); - } - } - - return (node != NULL); -} - -gboolean -jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap) -{ - JabberBuddyResource *jbr = jabber_buddy_find_resource((JabberBuddy*)jb, NULL); - - if (!jbr) { - purple_debug_info("jabber", - "Unable to find caps: buddy might be offline\n"); - return FALSE; - } - - return jabber_resource_has_capability(jbr, cap); -} - -const gchar * -jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr, - const gchar *category) -{ - const GList *iter = NULL; - - if (jbr->caps.info) { - for (iter = jbr->caps.info->identities ; iter ; iter = g_list_next(iter)) { - const JabberIdentity *identity = - (JabberIdentity *) iter->data; - - if (strcmp(identity->category, category) == 0) { - return identity->type; - } - } - } - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/buddy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -/** - * @file buddy.h Buddy handlers - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_BUDDY_H_ -#define PURPLE_JABBER_BUDDY_H_ - -typedef enum { - JABBER_BUDDY_STATE_UNKNOWN = -2, - JABBER_BUDDY_STATE_ERROR = -1, - JABBER_BUDDY_STATE_UNAVAILABLE = 0, - JABBER_BUDDY_STATE_ONLINE, - JABBER_BUDDY_STATE_CHAT, - JABBER_BUDDY_STATE_AWAY, - JABBER_BUDDY_STATE_XA, - JABBER_BUDDY_STATE_DND -} JabberBuddyState; - -typedef struct _JabberBuddy JabberBuddy; - -#include "jabber.h" -#include "caps.h" - -struct _JabberBuddy { - GList *resources; - char *error_msg; - enum { - JABBER_INVISIBLE_NONE = 0, - JABBER_INVISIBLE_SERVER = 1 << 1, - JABBER_INVIS_BUDDY = 1 << 2 - } invisible; - enum { - JABBER_SUB_NONE = 0, - JABBER_SUB_PENDING = 1 << 1, - JABBER_SUB_TO = 1 << 2, - JABBER_SUB_FROM = 1 << 3, - JABBER_SUB_BOTH = (JABBER_SUB_TO | JABBER_SUB_FROM), - JABBER_SUB_REMOVE = 1 << 4 - } subscription; -}; - -typedef struct _JabberAdHocCommands { - char *jid; - char *node; - char *name; -} JabberAdHocCommands; - -typedef struct _JabberBuddyResource { - JabberBuddy *jb; - char *name; - int priority; - JabberBuddyState state; - char *status; - time_t idle; - JabberCapabilities capabilities; - char *thread_id; - enum { - JABBER_CHAT_STATES_UNKNOWN, - JABBER_CHAT_STATES_UNSUPPORTED, - JABBER_CHAT_STATES_SUPPORTED - } chat_states; - struct { - char *version; - char *name; - char *os; - } client; - /* tz_off == PURPLE_NO_TZ_OFF when unset */ - long tz_off; - struct { - JabberCapsClientInfo *info; - GList *exts; - } caps; - GList *commands; - gboolean commands_fetched; -} JabberBuddyResource; - -void jabber_buddy_free(JabberBuddy *jb); -JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, - gboolean create); -JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, - const char *resource); -JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, - int priority, JabberBuddyState state, const char *status); -void jabber_buddy_resource_free(JabberBuddyResource *jbr); -void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource); -void jabber_buddy_get_info(PurpleConnection *gc, const char *who); - -GList *jabber_blist_node_menu(PurpleBlistNode *node); - -void jabber_set_info(PurpleConnection *gc, const char *info); -void jabber_setup_set_info(PurplePluginAction *action); -void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img); - -const char *jabber_buddy_state_get_name(JabberBuddyState state); -const char *jabber_buddy_state_get_status_id(JabberBuddyState state); -const char *jabber_buddy_state_get_show(JabberBuddyState state); -JabberBuddyState jabber_buddy_status_id_get_state(const char *id); -JabberBuddyState jabber_buddy_show_get_state(const char *id); - -void jabber_user_search(JabberStream *js, const char *directory); -void jabber_user_search_begin(PurplePluginAction *); - -void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js); - -void jabber_vcard_fetch_mine(JabberStream *js); - -gboolean jabber_resource_know_capabilities(const JabberBuddyResource *jbr); -gboolean jabber_resource_has_capability(const JabberBuddyResource *jbr, - const gchar *cap); -gboolean jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap); - -const gchar * -jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr, - const gchar *category); - -#endif /* PURPLE_JABBER_BUDDY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1002 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "debug.h" -#include "caps.h" -#include "cipher.h" -#include "iq.h" -#include "presence.h" -#include "util.h" - -#define JABBER_CAPS_FILENAME "xmpp-caps.xml" - -typedef struct _JabberDataFormField { - gchar *var; - GList *values; -} JabberDataFormField; - -static GHashTable *capstable = NULL; /* JabberCapsTuple -> JabberCapsClientInfo */ -static GHashTable *nodetable = NULL; /* char *node -> JabberCapsNodeExts */ -static guint save_timer = 0; - -/** - * Processes a query-node and returns a JabberCapsClientInfo object with all relevant info. - * - * @param query A query object. - * @return A JabberCapsClientInfo object. - */ -static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query); - -/* Free a GList of allocated char* */ -static void -free_string_glist(GList *list) -{ - g_list_foreach(list, (GFunc)g_free, NULL); - g_list_free(list); -} - -static JabberCapsNodeExts* -jabber_caps_node_exts_ref(JabberCapsNodeExts *exts) -{ - g_return_val_if_fail(exts != NULL, NULL); - - ++exts->ref; - return exts; -} - -static void -jabber_caps_node_exts_unref(JabberCapsNodeExts *exts) -{ - if (exts == NULL) - return; - - g_return_if_fail(exts->ref != 0); - - if (--exts->ref != 0) - return; - - g_hash_table_destroy(exts->exts); - g_free(exts); -} - -static guint jabber_caps_hash(gconstpointer data) { - const JabberCapsTuple *key = data; - guint nodehash = g_str_hash(key->node); - guint verhash = g_str_hash(key->ver); - /* - * 'hash' was optional in XEP-0115 v1.4 and g_str_hash crashes on NULL >:O. - * Okay, maybe I've played too much Zelda, but that looks like - * a Deku Shrub... - */ - guint hashhash = (key->hash ? g_str_hash(key->hash) : 0); - return nodehash ^ verhash ^ hashhash; -} - -static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { - const JabberCapsTuple *name1 = v1; - const JabberCapsTuple *name2 = v2; - - return g_str_equal(name1->node, name2->node) && - g_str_equal(name1->ver, name2->ver) && - purple_strequal(name1->hash, name2->hash); -} - -static void -jabber_caps_client_info_destroy(JabberCapsClientInfo *info) -{ - if (info == NULL) - return; - - while(info->identities) { - JabberIdentity *id = info->identities->data; - g_free(id->category); - g_free(id->type); - g_free(id->name); - g_free(id->lang); - g_free(id); - info->identities = g_list_delete_link(info->identities, info->identities); - } - - free_string_glist(info->features); - - while (info->forms) { - xmlnode_free(info->forms->data); - info->forms = g_list_delete_link(info->forms, info->forms); - } - - jabber_caps_node_exts_unref(info->exts); - - g_free((char *)info->tuple.node); - g_free((char *)info->tuple.ver); - g_free((char *)info->tuple.hash); - - g_free(info); -} - -/* NOTE: Takes a reference to the exts, unref it if you don't really want to - * keep it around. */ -static JabberCapsNodeExts* -jabber_caps_find_exts_by_node(const char *node) -{ - JabberCapsNodeExts *exts; - if (NULL == (exts = g_hash_table_lookup(nodetable, node))) { - exts = g_new0(JabberCapsNodeExts, 1); - exts->exts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)free_string_glist); - g_hash_table_insert(nodetable, g_strdup(node), jabber_caps_node_exts_ref(exts)); - } - - return jabber_caps_node_exts_ref(exts); -} - -static void -exts_to_xmlnode(gconstpointer key, gconstpointer value, gpointer user_data) -{ - const char *identifier = key; - const GList *features = value, *node; - xmlnode *client = user_data, *ext, *feature; - - ext = xmlnode_new_child(client, "ext"); - xmlnode_set_attrib(ext, "identifier", identifier); - - for (node = features; node; node = node->next) { - feature = xmlnode_new_child(ext, "feature"); - xmlnode_set_attrib(feature, "var", (const gchar *)node->data); - } -} - -static void jabber_caps_store_client(gpointer key, gpointer value, gpointer user_data) { - const JabberCapsTuple *tuple = key; - const JabberCapsClientInfo *props = value; - xmlnode *root = user_data; - xmlnode *client = xmlnode_new_child(root, "client"); - GList *iter; - - xmlnode_set_attrib(client, "node", tuple->node); - xmlnode_set_attrib(client, "ver", tuple->ver); - if (tuple->hash) - xmlnode_set_attrib(client, "hash", tuple->hash); - for(iter = props->identities; iter; iter = g_list_next(iter)) { - JabberIdentity *id = iter->data; - xmlnode *identity = xmlnode_new_child(client, "identity"); - xmlnode_set_attrib(identity, "category", id->category); - xmlnode_set_attrib(identity, "type", id->type); - if (id->name) - xmlnode_set_attrib(identity, "name", id->name); - if (id->lang) - xmlnode_set_attrib(identity, "lang", id->lang); - } - - for(iter = props->features; iter; iter = g_list_next(iter)) { - const char *feat = iter->data; - xmlnode *feature = xmlnode_new_child(client, "feature"); - xmlnode_set_attrib(feature, "var", feat); - } - - for(iter = props->forms; iter; iter = g_list_next(iter)) { - /* FIXME: See #7814 */ - xmlnode *xdata = iter->data; - xmlnode_insert_child(client, xmlnode_copy(xdata)); - } - - /* TODO: Ideally, only save this once-per-node... */ - if (props->exts) - g_hash_table_foreach(props->exts->exts, (GHFunc)exts_to_xmlnode, client); -} - -static gboolean -do_jabber_caps_store(gpointer data) -{ - char *str; - int length = 0; - xmlnode *root = xmlnode_new("capabilities"); - g_hash_table_foreach(capstable, jabber_caps_store_client, root); - str = xmlnode_to_formatted_str(root, &length); - xmlnode_free(root); - purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length); - g_free(str); - - save_timer = 0; - return FALSE; -} - -static void -schedule_caps_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, do_jabber_caps_store, NULL); -} - -static void -jabber_caps_load(void) -{ - xmlnode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache"); - xmlnode *client; - - if(!capsdata) - return; - - if (strcmp(capsdata->name, "capabilities") != 0) { - xmlnode_free(capsdata); - return; - } - - for(client = capsdata->child; client; client = client->next) { - if(client->type != XMLNODE_TYPE_TAG) - continue; - if(!strcmp(client->name, "client")) { - JabberCapsClientInfo *value = g_new0(JabberCapsClientInfo, 1); - JabberCapsTuple *key = (JabberCapsTuple*)&value->tuple; - xmlnode *child; - JabberCapsNodeExts *exts = NULL; - key->node = g_strdup(xmlnode_get_attrib(client,"node")); - key->ver = g_strdup(xmlnode_get_attrib(client,"ver")); - key->hash = g_strdup(xmlnode_get_attrib(client,"hash")); - - /* v1.3 capabilities */ - if (key->hash == NULL) - exts = jabber_caps_find_exts_by_node(key->node); - - for(child = client->child; child; child = child->next) { - if(child->type != XMLNODE_TYPE_TAG) - continue; - if(!strcmp(child->name,"feature")) { - const char *var = xmlnode_get_attrib(child, "var"); - if(!var) - continue; - value->features = g_list_append(value->features,g_strdup(var)); - } else if(!strcmp(child->name,"identity")) { - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - const char *name = xmlnode_get_attrib(child, "name"); - const char *lang = xmlnode_get_attrib(child, "lang"); - JabberIdentity *id; - - if (!category || !type) - continue; - - id = g_new0(JabberIdentity, 1); - id->category = g_strdup(category); - id->type = g_strdup(type); - id->name = g_strdup(name); - id->lang = g_strdup(lang); - - value->identities = g_list_append(value->identities,id); - } else if(!strcmp(child->name,"x")) { - /* TODO: See #7814 -- this might cause problems if anyone - * ever actually specifies forms. In fact, for this to - * work properly, that bug needs to be fixed in - * xmlnode_from_str, not the output version... */ - value->forms = g_list_append(value->forms, xmlnode_copy(child)); - } else if (!strcmp(child->name, "ext") && key->hash != NULL) { - purple_debug_warning("jabber", "Ignoring exts when reading new-style caps\n"); - } else if (!strcmp(child->name, "ext")) { - /* TODO: Do we care about reading in the identities listed here? */ - const char *identifier = xmlnode_get_attrib(child, "identifier"); - xmlnode *node; - GList *features = NULL; - - if (!identifier) - continue; - - for (node = child->child; node; node = node->next) { - if (node->type != XMLNODE_TYPE_TAG) - continue; - if (!strcmp(node->name, "feature")) { - const char *var = xmlnode_get_attrib(node, "var"); - if (!var) - continue; - features = g_list_prepend(features, g_strdup(var)); - } - } - - if (features) { - g_hash_table_insert(exts->exts, g_strdup(identifier), - features); - } else - purple_debug_warning("jabber", "Caps ext %s had no features.\n", - identifier); - } - } - - value->exts = exts; - g_hash_table_replace(capstable, key, value); - - } - } - xmlnode_free(capsdata); -} - -void jabber_caps_init(void) -{ - nodetable = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)jabber_caps_node_exts_unref); - capstable = g_hash_table_new_full(jabber_caps_hash, jabber_caps_compare, NULL, (GDestroyNotify)jabber_caps_client_info_destroy); - jabber_caps_load(); -} - -void jabber_caps_uninit(void) -{ - if (save_timer != 0) { - purple_timeout_remove(save_timer); - save_timer = 0; - do_jabber_caps_store(NULL); - } - g_hash_table_destroy(capstable); - g_hash_table_destroy(nodetable); - capstable = nodetable = NULL; -} - -gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info, - char **exts) -{ - int i; - g_return_val_if_fail(info != NULL, FALSE); - - if (!exts) - return TRUE; - - for (i = 0; exts[i]; ++i) { - /* Hack since we advertise the ext along with v1.5 caps but don't - * store any exts */ - if (g_str_equal(exts[i], "voice-v1") && !info->exts) - continue; - if (!info->exts || - !g_hash_table_lookup(info->exts->exts, exts[i])) - return FALSE; - } - - return TRUE; -} - -typedef struct _jabber_caps_cbplususerdata { - guint ref; - - jabber_caps_get_info_cb cb; - gpointer cb_data; - - char *who; - char *node; - char *ver; - char *hash; - - JabberCapsClientInfo *info; - - GList *exts; - guint extOutstanding; - JabberCapsNodeExts *node_exts; -} jabber_caps_cbplususerdata; - -static jabber_caps_cbplususerdata* -cbplususerdata_ref(jabber_caps_cbplususerdata *data) -{ - g_return_val_if_fail(data != NULL, NULL); - - ++data->ref; - return data; -} - -static void -cbplususerdata_unref(jabber_caps_cbplususerdata *data) -{ - if (data == NULL) - return; - - g_return_if_fail(data->ref != 0); - - if (--data->ref > 0) - return; - - g_free(data->who); - g_free(data->node); - g_free(data->ver); - g_free(data->hash); - - /* If we have info here, it's already in the capstable, so don't free it */ - if (data->exts) - free_string_glist(data->exts); - if (data->node_exts) - jabber_caps_node_exts_unref(data->node_exts); - g_free(data); -} - -static void -jabber_caps_get_info_complete(jabber_caps_cbplususerdata *userdata) -{ - if (userdata->cb) { - userdata->cb(userdata->info, userdata->exts, userdata->cb_data); - userdata->info = NULL; - userdata->exts = NULL; - } - - if (userdata->ref != 1) - purple_debug_warning("jabber", "Lost a reference to caps cbdata: %d\n", - userdata->ref); -} - -static void -jabber_caps_client_iqcb(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_DISCO_INFO); - jabber_caps_cbplususerdata *userdata = data; - JabberCapsClientInfo *info = NULL, *value; - JabberCapsTuple key; - - if (!query || type == JABBER_IQ_ERROR) { - /* Any outstanding exts will be dealt with via ref-counting */ - userdata->cb(NULL, NULL, userdata->cb_data); - cbplususerdata_unref(userdata); - return; - } - - /* check hash */ - info = jabber_caps_parse_client_info(query); - - /* Only validate if these are v1.5 capabilities */ - if (userdata->hash) { - gchar *hash = NULL; - /* - * TODO: If you add *any* hash here, make sure the checksum buffer - * size in jabber_caps_calculate_hash is large enough. The cipher API - * doesn't seem to offer a "Get the hash size" function(?). - */ - if (!strcmp(userdata->hash, "sha-1")) { - hash = jabber_caps_calculate_hash(info, "sha1"); - } else if (!strcmp(userdata->hash, "md5")) { - hash = jabber_caps_calculate_hash(info, "md5"); - } - - if (!hash || strcmp(hash, userdata->ver)) { - purple_debug_warning("jabber", "Could not validate caps info from " - "%s. Expected %s, got %s\n", - xmlnode_get_attrib(packet, "from"), - userdata->ver, hash ? hash : "(null)"); - - userdata->cb(NULL, NULL, userdata->cb_data); - jabber_caps_client_info_destroy(info); - cbplususerdata_unref(userdata); - g_free(hash); - return; - } - - g_free(hash); - } - - if (!userdata->hash && userdata->node_exts) { - /* If the ClientInfo doesn't have information about the exts, give them - * ours (along with our ref) */ - info->exts = userdata->node_exts; - userdata->node_exts = NULL; - } - - key.node = userdata->node; - key.ver = userdata->ver; - key.hash = userdata->hash; - - /* Use the copy of this data already in the table if it exists or insert - * a new one if we need to */ - if ((value = g_hash_table_lookup(capstable, &key))) { - jabber_caps_client_info_destroy(info); - info = value; - } else { - JabberCapsTuple *n_key = (JabberCapsTuple *)&info->tuple; - n_key->node = userdata->node; - n_key->ver = userdata->ver; - n_key->hash = userdata->hash; - userdata->node = userdata->ver = userdata->hash = NULL; - - /* The capstable gets a reference */ - g_hash_table_insert(capstable, n_key, info); - schedule_caps_save(); - } - - userdata->info = info; - - if (userdata->extOutstanding == 0) - jabber_caps_get_info_complete(userdata); - - cbplususerdata_unref(userdata); -} - -typedef struct { - const char *name; - jabber_caps_cbplususerdata *data; -} ext_iq_data; - -static void -jabber_caps_ext_iqcb(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_DISCO_INFO); - xmlnode *child; - ext_iq_data *userdata = data; - GList *features = NULL; - JabberCapsNodeExts *node_exts; - - if (!query || type == JABBER_IQ_ERROR) { - cbplususerdata_unref(userdata->data); - g_free(userdata); - return; - } - - node_exts = (userdata->data->info ? userdata->data->info->exts : - userdata->data->node_exts); - - /* TODO: I don't see how this can actually happen, but it crashed khc. */ - if (!node_exts) { - purple_debug_error("jabber", "Couldn't find JabberCapsNodeExts. If you " - "see this, please tell darkrain42 and save your debug log.\n" - "JabberCapsClientInfo = %p\n", userdata->data->info); - - - /* Try once more to find the exts and then fail */ - node_exts = jabber_caps_find_exts_by_node(userdata->data->node); - if (node_exts) { - purple_debug_info("jabber", "Found the exts on the second try.\n"); - if (userdata->data->info) - userdata->data->info->exts = node_exts; - else - userdata->data->node_exts = node_exts; - } else { - cbplususerdata_unref(userdata->data); - g_free(userdata); - g_return_if_reached(); - } - } - - /* So, we decrement this after checking for an error, which means that - * if there *is* an error, we'll never call the callback passed to - * jabber_caps_get_info. We will still free all of our data, though. - */ - --userdata->data->extOutstanding; - - for (child = xmlnode_get_child(query, "feature"); child; - child = xmlnode_get_next_twin(child)) { - const char *var = xmlnode_get_attrib(child, "var"); - if (var) - features = g_list_prepend(features, g_strdup(var)); - } - - g_hash_table_insert(node_exts->exts, g_strdup(userdata->name), features); - schedule_caps_save(); - - /* Are we done? */ - if (userdata->data->info && userdata->data->extOutstanding == 0) - jabber_caps_get_info_complete(userdata->data); - - cbplususerdata_unref(userdata->data); - g_free(userdata); -} - -void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, - const char *ver, const char *hash, char **exts, - jabber_caps_get_info_cb cb, gpointer user_data) -{ - JabberCapsClientInfo *info; - JabberCapsTuple key; - jabber_caps_cbplususerdata *userdata; - - if (exts && hash) { - purple_debug_misc("jabber", "Ignoring exts in new-style caps from %s\n", - who); - g_strfreev(exts); - exts = NULL; - } - - /* Using this in a read-only fashion, so the cast is OK */ - key.node = (char *)node; - key.ver = (char *)ver; - key.hash = (char *)hash; - - info = g_hash_table_lookup(capstable, &key); - if (info && hash) { - /* v1.5 - We already have all the information we care about */ - if (cb) - cb(info, NULL, user_data); - return; - } - - userdata = g_new0(jabber_caps_cbplususerdata, 1); - /* We start out with 0 references. Every query takes one */ - userdata->cb = cb; - userdata->cb_data = user_data; - userdata->who = g_strdup(who); - userdata->node = g_strdup(node); - userdata->ver = g_strdup(ver); - userdata->hash = g_strdup(hash); - - if (info) { - userdata->info = info; - } else { - /* If we don't have the basic information about the client, we need - * to fetch it. */ - JabberIq *iq; - xmlnode *query; - char *nodever; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - query = xmlnode_get_child_with_namespace(iq->node, "query", - NS_DISCO_INFO); - nodever = g_strdup_printf("%s#%s", node, ver); - xmlnode_set_attrib(query, "node", nodever); - g_free(nodever); - xmlnode_set_attrib(iq->node, "to", who); - - cbplususerdata_ref(userdata); - - jabber_iq_set_callback(iq, jabber_caps_client_iqcb, userdata); - jabber_iq_send(iq); - } - - /* Are there any exts that we don't recognize? */ - if (exts) { - JabberCapsNodeExts *node_exts; - int i; - - if (info) { - if (info->exts) - node_exts = info->exts; - else - node_exts = info->exts = jabber_caps_find_exts_by_node(node); - } else - /* We'll put it in later once we have the client info */ - node_exts = userdata->node_exts = jabber_caps_find_exts_by_node(node); - - for (i = 0; exts[i]; ++i) { - userdata->exts = g_list_prepend(userdata->exts, exts[i]); - /* Look it up if we don't already know what it means */ - if (!g_hash_table_lookup(node_exts->exts, exts[i])) { - JabberIq *iq; - xmlnode *query; - char *nodeext; - ext_iq_data *cbdata = g_new(ext_iq_data, 1); - - cbdata->name = exts[i]; - cbdata->data = cbplususerdata_ref(userdata); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - query = xmlnode_get_child_with_namespace(iq->node, "query", - NS_DISCO_INFO); - nodeext = g_strdup_printf("%s#%s", node, exts[i]); - xmlnode_set_attrib(query, "node", nodeext); - g_free(nodeext); - xmlnode_set_attrib(iq->node, "to", who); - - jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, cbdata); - jabber_iq_send(iq); - - ++userdata->extOutstanding; - } - exts[i] = NULL; - } - /* All the strings are now part of the GList, so don't need - * g_strfreev. */ - g_free(exts); - } - - if (userdata->info && userdata->extOutstanding == 0) { - /* Start with 1 ref so the below functions are happy */ - userdata->ref = 1; - - /* We have everything we need right now */ - jabber_caps_get_info_complete(userdata); - cbplususerdata_unref(userdata); - } -} - -static gint -jabber_identity_compare(gconstpointer a, gconstpointer b) -{ - const JabberIdentity *ac; - const JabberIdentity *bc; - gint cat_cmp; - gint typ_cmp; - - ac = a; - bc = b; - - if ((cat_cmp = strcmp(ac->category, bc->category)) == 0) { - if ((typ_cmp = strcmp(ac->type, bc->type)) == 0) { - if (!ac->lang && !bc->lang) { - return 0; - } else if (ac->lang && !bc->lang) { - return 1; - } else if (!ac->lang && bc->lang) { - return -1; - } else { - return strcmp(ac->lang, bc->lang); - } - } else { - return typ_cmp; - } - } else { - return cat_cmp; - } -} - -static gchar *jabber_caps_get_formtype(const xmlnode *x) { - xmlnode *formtypefield; - formtypefield = xmlnode_get_child(x, "field"); - while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield); - formtypefield = xmlnode_get_child(formtypefield, "value"); - return xmlnode_get_data(formtypefield);; -} - -static gint -jabber_xdata_compare(gconstpointer a, gconstpointer b) -{ - const xmlnode *aformtypefield = a; - const xmlnode *bformtypefield = b; - char *aformtype; - char *bformtype; - int result; - - aformtype = jabber_caps_get_formtype(aformtypefield); - bformtype = jabber_caps_get_formtype(bformtypefield); - - result = strcmp(aformtype, bformtype); - g_free(aformtype); - g_free(bformtype); - return result; -} - -static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) -{ - xmlnode *child; - JabberCapsClientInfo *info; - - if (!query || strcmp(query->xmlns, NS_DISCO_INFO)) - return 0; - - info = g_new0(JabberCapsClientInfo, 1); - - for(child = query->child; child; child = child->next) { - if (child->type != XMLNODE_TYPE_TAG) - continue; - if (!strcmp(child->name,"identity")) { - /* parse identity */ - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - const char *name = xmlnode_get_attrib(child, "name"); - const char *lang = xmlnode_get_attrib(child, "lang"); - JabberIdentity *id; - - if (!category || !type) - continue; - - id = g_new0(JabberIdentity, 1); - id->category = g_strdup(category); - id->type = g_strdup(type); - id->name = g_strdup(name); - id->lang = g_strdup(lang); - - info->identities = g_list_append(info->identities, id); - } else if (!strcmp(child->name, "feature")) { - /* parse feature */ - const char *var = xmlnode_get_attrib(child, "var"); - if (var) - info->features = g_list_prepend(info->features, g_strdup(var)); - } else if (!strcmp(child->name, "x")) { - if (child->xmlns && !strcmp(child->xmlns, "jabber:x:data")) { - /* x-data form */ - xmlnode *dataform = xmlnode_copy(child); - info->forms = g_list_append(info->forms, dataform); - } - } - } - return info; -} - -static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b) -{ - const JabberDataFormField *ac = a; - const JabberDataFormField *bc = b; - - return strcmp(ac->var, bc->var); -} - -static GList* jabber_caps_xdata_get_fields(const xmlnode *x) -{ - GList *fields = NULL; - xmlnode *field; - - if (!x) - return NULL; - - for (field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - xmlnode *value; - JabberDataFormField *xdatafield = g_new0(JabberDataFormField, 1); - xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var")); - - for (value = xmlnode_get_child(field, "value"); value; value = xmlnode_get_next_twin(value)) { - gchar *val = xmlnode_get_data(value); - xdatafield->values = g_list_append(xdatafield->values, val); - } - - xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp); - fields = g_list_append(fields, xdatafield); - } - - fields = g_list_sort(fields, jabber_caps_xdata_field_compare); - return fields; -} - -static GString* -jabber_caps_verification_append(GString *verification, const gchar *str) -{ - char *tmp = g_markup_escape_text(str, -1); - verification = g_string_append(verification, tmp); - g_free(tmp); - return g_string_append_c(verification, '<'); -} - -gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) -{ - GList *node; - GString *verification; - PurpleCipherContext *context; - guint8 checksum[20]; - gsize checksum_size = 20; - gboolean success; - - if (!info || !(context = purple_cipher_context_new_by_name(hash, NULL))) - return NULL; - - /* sort identities, features and x-data forms */ - info->identities = g_list_sort(info->identities, jabber_identity_compare); - info->features = g_list_sort(info->features, (GCompareFunc)strcmp); - info->forms = g_list_sort(info->forms, jabber_xdata_compare); - - verification = g_string_new(""); - - /* concat identities to the verification string */ - for (node = info->identities; node; node = node->next) { - JabberIdentity *id = (JabberIdentity*)node->data; - char *category = g_markup_escape_text(id->category, -1); - char *type = g_markup_escape_text(id->type, -1); - char *lang = NULL; - char *name = NULL; - - if (id->lang) - lang = g_markup_escape_text(id->lang, -1); - if (id->name) - name = g_markup_escape_text(id->name, -1); - - g_string_append_printf(verification, "%s/%s/%s/%s<", category, - type, lang ? lang : "", name ? name : ""); - - g_free(category); - g_free(type); - g_free(lang); - g_free(name); - } - - /* concat features to the verification string */ - for (node = info->features; node; node = node->next) { - verification = jabber_caps_verification_append(verification, node->data); - } - - /* concat x-data forms to the verification string */ - for(node = info->forms; node; node = node->next) { - xmlnode *data = (xmlnode *)node->data; - gchar *formtype = jabber_caps_get_formtype(data); - GList *fields = jabber_caps_xdata_get_fields(data); - - /* append FORM_TYPE's field value to the verification string */ - verification = jabber_caps_verification_append(verification, formtype); - g_free(formtype); - - while (fields) { - GList *value; - JabberDataFormField *field = (JabberDataFormField*)fields->data; - - if (strcmp(field->var, "FORM_TYPE")) { - /* Append the "var" attribute */ - verification = jabber_caps_verification_append(verification, field->var); - /* Append <value/> elements' cdata */ - for(value = field->values; value; value = value->next) { - verification = jabber_caps_verification_append(verification, value->data); - g_free(value->data); - } - } - - g_free(field->var); - g_list_free(field->values); - - fields = g_list_delete_link(fields, fields); - } - } - - /* generate hash */ - purple_cipher_context_append(context, (guchar*)verification->str, verification->len); - - success = purple_cipher_context_digest(context, verification->len, - checksum, &checksum_size); - - g_string_free(verification, TRUE); - purple_cipher_context_destroy(context); - - return (success ? purple_base64_encode(checksum, checksum_size) : NULL); -} - -void jabber_caps_calculate_own_hash(JabberStream *js) { - JabberCapsClientInfo info; - GList *iter = 0; - GList *features = 0; - - if (!jabber_identities && !jabber_features) { - /* This really shouldn't ever happen */ - purple_debug_warning("jabber", "No features or identities, cannot calculate own caps hash.\n"); - g_free(js->caps_hash); - js->caps_hash = NULL; - return; - } - - /* build the currently-supported list of features */ - if (jabber_features) { - for (iter = jabber_features; iter; iter = iter->next) { - JabberFeature *feat = iter->data; - if(!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { - features = g_list_append(features, feat->namespace); - } - } - } - - info.features = features; - info.identities = g_list_copy(jabber_identities); - info.forms = NULL; - - g_free(js->caps_hash); - js->caps_hash = jabber_caps_calculate_hash(&info, "sha1"); - g_list_free(info.identities); - g_list_free(info.features); -} - -const gchar* jabber_caps_get_own_hash(JabberStream *js) -{ - if (!js->caps_hash) - jabber_caps_calculate_own_hash(js); - - return js->caps_hash; -} - -void jabber_caps_broadcast_change() -{ - GList *node, *accounts = purple_accounts_get_all_active(); - - for (node = accounts; node; node = node->next) { - PurpleAccount *account = node->data; - const char *prpl_id = purple_account_get_protocol_id(account); - if (!strcmp("prpl-jabber", prpl_id) && purple_account_is_connected(account)) { - PurpleConnection *gc = purple_account_get_connection(account); - jabber_presence_send(gc->proto_data, TRUE); - } - } - - g_list_free(accounts); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/caps.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_CAPS_H_ -#define PURPLE_JABBER_CAPS_H_ - -typedef struct _JabberCapsClientInfo JabberCapsClientInfo; - -#include "jabber.h" - -/* Implementation of XEP-0115 - Entity Capabilities */ - -typedef struct _JabberCapsNodeExts JabberCapsNodeExts; - -typedef struct _JabberCapsTuple { - const char *node; - const char *ver; - const char *hash; -} JabberCapsTuple; - -struct _JabberCapsClientInfo { - GList *identities; /* JabberIdentity */ - GList *features; /* char * */ - GList *forms; /* xmlnode * */ - JabberCapsNodeExts *exts; - - const JabberCapsTuple tuple; -}; - -/* - * This stores a set of exts "known" for a specific node (which indicates - * a specific client -- for reference, Pidgin, Finch, Meebo, et al share one - * node.) In XEP-0115 v1.3, exts are used for features that may or may not be - * present at a given time (PEP things, buzz might be disabled, etc). - * - * This structure is shared among all JabberCapsClientInfo instances matching - * a specific node (if the capstable key->hash == NULL, which indicates that - * the ClientInfo is using v1.3 caps as opposed to v1.5 caps). - * - * It's only exposed so that jabber_resource_has_capability can use it. - * Everyone else, STAY AWAY! - */ -struct _JabberCapsNodeExts { - guint ref; - GHashTable *exts; /* char *ext_name -> GList *features */ -}; - -typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, GList *exts, gpointer user_data); - -void jabber_caps_init(void); -void jabber_caps_uninit(void); - -/** - * Check whether all of the exts in a char* array are known to the given info. - */ -gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info, char **exts); - -/** - * Main entity capabilites function to get the capabilities of a contact. - * - * The callback will be called synchronously if we already have the - * capabilities for the specified (node,ver,hash) (and, if exts are specified, - * if we know what each means) - * - * @param exts A g_strsplit'd (NULL-terminated) array of strings. This - * function is responsible for freeing it. - */ -void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, - const char *ver, const char *hash, - char **exts, jabber_caps_get_info_cb cb, - gpointer user_data); - -/** - * Takes a JabberCapsClientInfo pointer and returns the caps hash according to - * XEP-0115 Version 1.5. - * - * @param info A JabberCapsClientInfo pointer. - * @param hash Hash cipher to be used. Either sha-1 or md5. - * @return The base64 encoded SHA-1 hash; must be freed by caller - */ -gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash); - -/** - * Calculate SHA1 hash for own featureset. - */ -void jabber_caps_calculate_own_hash(JabberStream *js); - -/** Get the current caps hash. - * @ret hash -**/ -const gchar* jabber_caps_get_own_hash(JabberStream *js); - -/** - * Broadcast a new calculated hash using a <presence> stanza. - */ -void jabber_caps_broadcast_change(void); - -#endif /* PURPLE_JABBER_CAPS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1289 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "prpl.h" /* for proto_chat_entry */ -#include "notify.h" -#include "request.h" -#include "roomlist.h" -#include "util.h" - -#include "chat.h" -#include "iq.h" -#include "message.h" -#include "presence.h" -#include "xdata.h" -#include "data.h" - -GList *jabber_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Room:"); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Server:"); - pce->identifier = "server"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Handle:"); - pce->identifier = "handle"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Password:"); - pce->identifier = "password"; - pce->secret = TRUE; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - JabberStream *js = gc->proto_data; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - g_hash_table_insert(defaults, "handle", g_strdup(js->user->node)); - - if (js->chat_servers) - g_hash_table_insert(defaults, "server", g_strdup(js->chat_servers->data)); - - if (chat_name != NULL) { - JabberID *jid = jabber_id_new(chat_name); - if(jid) { - g_hash_table_insert(defaults, "room", g_strdup(jid->node)); - if(jid->domain) - g_hash_table_replace(defaults, "server", g_strdup(jid->domain)); - if(jid->resource) - g_hash_table_replace(defaults, "handle", g_strdup(jid->resource)); - jabber_id_free(jid); - } - } - - return defaults; -} - -JabberChat *jabber_chat_find(JabberStream *js, const char *room, - const char *server) -{ - JabberChat *chat = NULL; - - g_return_val_if_fail(room != NULL, NULL); - g_return_val_if_fail(server != NULL, NULL); - - if(NULL != js->chats) - { - char *room_jid = g_strdup_printf("%s@%s", room, server); - - chat = g_hash_table_lookup(js->chats, room_jid); - g_free(room_jid); - } - - return chat; -} - -struct _find_by_id_data { - int id; - JabberChat *chat; -}; - -static void find_by_id_foreach_cb(gpointer key, gpointer value, gpointer user_data) -{ - JabberChat *chat = value; - struct _find_by_id_data *fbid = user_data; - - if(chat->id == fbid->id) - fbid->chat = chat; -} - -JabberChat *jabber_chat_find_by_id(JabberStream *js, int id) -{ - JabberChat *chat; - struct _find_by_id_data *fbid = g_new0(struct _find_by_id_data, 1); - fbid->id = id; - g_hash_table_foreach(js->chats, find_by_id_foreach_cb, fbid); - chat = fbid->chat; - g_free(fbid); - return chat; -} - -JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - int id; - if (!gc) - return NULL; - js = gc->proto_data; - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - return jabber_chat_find_by_id(js, id); -} - -void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat; - xmlnode *message, *body, *x, *invite; - char *room_jid; - - chat = jabber_chat_find_by_id(js, id); - if(!chat) - return; - - message = xmlnode_new("message"); - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - if(chat->muc) { - xmlnode_set_attrib(message, "to", room_jid); - x = xmlnode_new_child(message, "x"); - xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); - invite = xmlnode_new_child(x, "invite"); - xmlnode_set_attrib(invite, "to", name); - body = xmlnode_new_child(invite, "reason"); - xmlnode_insert_data(body, msg, -1); - } else { - xmlnode_set_attrib(message, "to", name); - /* - * Putting the reason into the body was an 'undocumented protocol, - * ...not part of "groupchat 1.0"'. - * http://xmpp.org/extensions/attic/jep-0045-1.16.html#invite - * - * Left here for compatibility. - */ - body = xmlnode_new_child(message, "body"); - xmlnode_insert_data(body, msg, -1); - - x = xmlnode_new_child(message, "x"); - xmlnode_set_attrib(x, "jid", room_jid); - - /* The better place for it! XEP-0249 style. */ - xmlnode_set_attrib(x, "reason", msg); - xmlnode_set_namespace(x, "jabber:x:conference"); - } - - jabber_send(js, message); - xmlnode_free(message); - g_free(room_jid); -} - -void jabber_chat_member_free(JabberChatMember *jcm); - -char *jabber_get_chat_name(GHashTable *data) { - char *room, *server, *chat_name = NULL; - - room = g_hash_table_lookup(data, "room"); - server = g_hash_table_lookup(data, "server"); - - if (room && server) { - chat_name = g_strdup_printf("%s@%s", room, server); - } - return chat_name; -} - -static void insert_in_hash_table(gpointer key, gpointer value, gpointer user_data) -{ - GHashTable *hash_table = (GHashTable *)user_data; - g_hash_table_insert(hash_table, g_strdup(key), g_strdup(value)); -} - -static JabberChat *jabber_chat_new(JabberStream *js, const char *room, - const char *server, const char *handle, - const char *password, GHashTable *data) -{ - JabberChat *chat; - char *jid; - - if (jabber_chat_find(js, room, server) != NULL) - return NULL; - - chat = g_new0(JabberChat, 1); - chat->js = js; - - chat->room = g_strdup(room); - chat->server = g_strdup(server); - chat->handle = g_strdup(handle); - - /* Copy the data hash table to chat->components */ - chat->components = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - if (data == NULL) { - g_hash_table_insert(chat->components, g_strdup("handle"), g_strdup(handle)); - g_hash_table_insert(chat->components, g_strdup("room"), g_strdup(room)); - g_hash_table_insert(chat->components, g_strdup("server"), g_strdup(server)); - /* g_hash_table_insert(chat->components, g_strdup("password"), g_strdup(server)); */ - } else { - g_hash_table_foreach(data, insert_in_hash_table, chat->components); - } - - chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - (GDestroyNotify)jabber_chat_member_free); - - jid = g_strdup_printf("%s@%s", room, server); - g_hash_table_insert(js->chats, jid, chat); - - return chat; -} - -JabberChat *jabber_join_chat(JabberStream *js, const char *room, - const char *server, const char *handle, - const char *password, GHashTable *data) -{ - JabberChat *chat; - - PurpleConnection *gc; - PurpleAccount *account; - PurpleStatus *status; - - xmlnode *presence, *x; - JabberBuddyState state; - char *msg; - int priority; - - char *jid; - - chat = jabber_chat_new(js, room, server, handle, password, data); - if (chat == NULL) - return NULL; - - gc = js->gc; - account = purple_connection_get_account(gc); - status = purple_account_get_active_status(account); - purple_status_to_jabber(status, &state, &msg, &priority); - - presence = jabber_presence_create_js(js, state, msg, priority); - g_free(msg); - - jid = g_strdup_printf("%s@%s/%s", room, server, handle); - xmlnode_set_attrib(presence, "to", jid); - g_free(jid); - - x = xmlnode_new_child(presence, "x"); - xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); - - if (password && *password) { - xmlnode *p = xmlnode_new_child(x, "password"); - xmlnode_insert_data(p, password, -1); - } - - jabber_send(js, presence); - xmlnode_free(presence); - - return chat; -} - -void jabber_chat_join(PurpleConnection *gc, GHashTable *data) -{ - char *room, *server, *handle, *passwd; - JabberID *jid; - JabberStream *js = gc->proto_data; - char *tmp; - - room = g_hash_table_lookup(data, "room"); - server = g_hash_table_lookup(data, "server"); - handle = g_hash_table_lookup(data, "handle"); - passwd = g_hash_table_lookup(data, "password"); - - if(!room || !server) - return; - - if(!handle) - handle = js->user->node; - - if(!jabber_nodeprep_validate(room)) { - char *buf = g_strdup_printf(_("%s is not a valid room name"), room); - purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), - buf); - purple_serv_got_join_chat_failed(gc, data); - g_free(buf); - return; - } else if(!jabber_domain_validate(server)) { - char *buf = g_strdup_printf(_("%s is not a valid server name"), server); - purple_notify_error(gc, _("Invalid Server Name"), - _("Invalid Server Name"), buf); - purple_serv_got_join_chat_failed(gc, data); - g_free(buf); - return; - } else if(!jabber_resourceprep_validate(handle)) { - char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); - purple_notify_error(gc, _("Invalid Room Handle"), - _("Invalid Room Handle"), buf); - purple_serv_got_join_chat_failed(gc, data); - g_free(buf); - return; - } - - /* Normalize the room and server parameters */ - tmp = g_strdup_printf("%s@%s", room, server); - jid = jabber_id_new(tmp); - g_free(tmp); - - if (jid == NULL) { - /* TODO: Error message */ - - g_return_if_reached(); - } - - /* - * Now that we've done all that nice core-interface stuff, let's join - * this room! - */ - jabber_join_chat(js, jid->node, jid->domain, handle, passwd, data); - jabber_id_free(jid); -} - -void jabber_chat_leave(PurpleConnection *gc, int id) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat = jabber_chat_find_by_id(js, id); - - - if(!chat) - return; - - jabber_chat_part(chat, NULL); - - chat->left = TRUE; -} - -void jabber_chat_destroy(JabberChat *chat) -{ - JabberStream *js = chat->js; - char *room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - g_hash_table_remove(js->chats, room_jid); - g_free(room_jid); -} - -void jabber_chat_free(JabberChat *chat) -{ - if(chat->config_dialog_handle) - purple_request_close(chat->config_dialog_type, chat->config_dialog_handle); - - g_free(chat->room); - g_free(chat->server); - g_free(chat->handle); - g_hash_table_destroy(chat->members); - g_hash_table_destroy(chat->components); - g_free(chat); -} - -gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name) -{ - return purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), name); -} - -char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat; - JabberChatMember *jcm; - - chat = jabber_chat_find_by_id(js, id); - - if(!chat) - return NULL; - - jcm = g_hash_table_lookup(chat->members, who); - if (jcm != NULL && jcm->jid) - return g_strdup(jcm->jid); - - - return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); -} - -static void jabber_chat_room_configure_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - JabberChat *chat = data; - xmlnode *query; - JabberIq *iq; - char *to = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_insert_child(query, result); - - jabber_iq_send(iq); -} - -static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *x; - char *msg; - JabberChat *chat; - JabberID *jid; - - if (!from) - return; - - if (type == JABBER_IQ_RESULT) { - jid = jabber_id_new(from); - - if(!jid) - return; - - chat = jabber_chat_find(js, jid->node, jid->domain); - jabber_id_free(jid); - - if(!chat) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { - const char *xmlns; - if(!(xmlns = xmlnode_get_namespace(x))) - continue; - - if(!strcmp(xmlns, "jabber:x:data")) { - chat->config_dialog_type = PURPLE_REQUEST_FIELDS; - chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat); - return; - } - } - } else if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg); - - if(msg) - g_free(msg); - return; - } - - msg = g_strdup_printf("Unable to configure room %s", from); - - purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); - g_free(msg); - -} - -void jabber_chat_request_room_configure(JabberChat *chat) { - JabberIq *iq; - char *room_jid; - - if(!chat) - return; - - chat->config_dialog_handle = NULL; - - if(!chat->muc) { - purple_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"), - _("This room is not capable of being configured")); - return; - } - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, - "http://jabber.org/protocol/muc#owner"); - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - xmlnode_set_attrib(iq->node, "to", room_jid); - - jabber_iq_set_callback(iq, jabber_chat_room_configure_cb, NULL); - - jabber_iq_send(iq); - - g_free(room_jid); -} - -void jabber_chat_create_instant_room(JabberChat *chat) { - JabberIq *iq; - xmlnode *query, *x; - char *room_jid; - - if(!chat) - return; - - chat->config_dialog_handle = NULL; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#owner"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "x"); - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - xmlnode_set_attrib(iq->node, "to", room_jid); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - - jabber_iq_send(iq); - - g_free(room_jid); -} - -static void -jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); - - if(msg) - g_free(msg); - return; - } -} - -static void jabber_chat_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - JabberChat *chat = data; - xmlnode *query; - JabberIq *iq; - char *to = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_insert_child(query, result); - - jabber_iq_set_callback(iq, jabber_chat_register_x_data_result_cb, NULL); - - jabber_iq_send(iq); -} - -static void jabber_chat_register_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *x; - char *msg; - JabberChat *chat; - JabberID *jid; - - if (!from) - return; - - if (type == JABBER_IQ_RESULT) { - jid = jabber_id_new(from); - - if(!jid) - return; - - chat = jabber_chat_find(js, jid->node, jid->domain); - jabber_id_free(jid); - - if(!chat) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { - const char *xmlns; - - if(!(xmlns = xmlnode_get_namespace(x))) - continue; - - if(!strcmp(xmlns, "jabber:x:data")) { - jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat); - return; - } - } - } else if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); - - if(msg) - g_free(msg); - return; - } - - msg = g_strdup_printf("Unable to configure room %s", from); - - purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); - g_free(msg); - -} - -void jabber_chat_register(JabberChat *chat) -{ - JabberIq *iq; - char *room_jid; - - if(!chat) - return; - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", room_jid); - g_free(room_jid); - - jabber_iq_set_callback(iq, jabber_chat_register_cb, NULL); - - jabber_iq_send(iq); -} - -/* merge this with the function below when we get everyone on the same page wrt /commands */ -void jabber_chat_change_topic(JabberChat *chat, const char *topic) -{ - JabberMessage *jm; - - jm = g_new0(JabberMessage, 1); - jm->js = chat->js; - jm->type = JABBER_MESSAGE_GROUPCHAT; - jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); - - if (topic && *topic) - jm->subject = g_strdup(topic); - else - jm->subject = g_strdup(""); - - jabber_message_send(jm); - jabber_message_free(jm); -} - -void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - JabberStream *js = purple_connection_get_protocol_data(gc); - JabberChat *chat = jabber_chat_find_by_id(js, id); - - if(!chat) - return; - - jabber_chat_change_topic(chat, topic); -} - - -gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) -{ - xmlnode *presence; - char *full_jid; - PurpleAccount *account; - PurpleStatus *status; - JabberBuddyState state; - char *msg; - int priority; - - if(!chat->muc) { - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", - _("Nick changing not supported in non-MUC chatrooms"), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - return FALSE; - } - - account = purple_connection_get_account(chat->js->gc); - status = purple_account_get_active_status(account); - - purple_status_to_jabber(status, &state, &msg, &priority); - - presence = jabber_presence_create_js(chat->js, state, msg, priority); - full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); - xmlnode_set_attrib(presence, "to", full_jid); - g_free(full_jid); - g_free(msg); - - jabber_send(chat->js, presence); - xmlnode_free(presence); - - return TRUE; -} - -void jabber_chat_part(JabberChat *chat, const char *msg) -{ - char *room_jid; - xmlnode *presence; - - room_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, - chat->handle); - presence = xmlnode_new("presence"); - xmlnode_set_attrib(presence, "to", room_jid); - xmlnode_set_attrib(presence, "type", "unavailable"); - if(msg) { - xmlnode *status = xmlnode_new_child(presence, "status"); - xmlnode_insert_data(status, msg, -1); - } - jabber_send(chat->js, presence); - - xmlnode_free(presence); - g_free(room_jid); -} - -static void roomlist_disco_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query; - xmlnode *item; - - if(!js->roomlist) - return; - - if (type == JABBER_IQ_ERROR) { - char *err = jabber_parse_error(js, packet, NULL); - purple_notify_error(js->gc, _("Error"), - _("Error retrieving room list"), err); - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; - g_free(err); - return; - } - - if(!(query = xmlnode_get_child(packet, "query"))) { - char *err = jabber_parse_error(js, packet, NULL); - purple_notify_error(js->gc, _("Error"), - _("Error retrieving room list"), err); - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; - g_free(err); - return; - } - - for(item = xmlnode_get_child(query, "item"); item; - item = xmlnode_get_next_twin(item)) { - const char *name; - PurpleRoomlistRoom *room; - JabberID *jid; - - if(!(jid = jabber_id_new(xmlnode_get_attrib(item, "jid")))) - continue; - name = xmlnode_get_attrib(item, "name"); - - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL); - purple_roomlist_room_add_field(js->roomlist, room, jid->node); - purple_roomlist_room_add_field(js->roomlist, room, jid->domain); - purple_roomlist_room_add_field(js->roomlist, room, name ? name : ""); - purple_roomlist_room_add(js->roomlist, room); - - jabber_id_free(jid); - } - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; -} - -static void roomlist_cancel_cb(JabberStream *js, const char *server) { - if(js->roomlist) { - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; - } -} - -static void roomlist_ok_cb(JabberStream *js, const char *server) -{ - JabberIq *iq; - - if(!js->roomlist) - return; - - if(!server || !*server) { - purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL); - purple_roomlist_set_in_progress(js->roomlist, FALSE); - return; - } - - purple_roomlist_set_in_progress(js->roomlist, TRUE); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - - xmlnode_set_attrib(iq->node, "to", server); - - jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL); - - jabber_iq_send(iq); -} - -char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) -{ - - return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data); -} - -PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - GList *fields = NULL; - PurpleRoomlistField *f; - - if(js->roomlist) - purple_roomlist_unref(js->roomlist); - - js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc)); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "server", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE); - fields = g_list_append(fields, f); - - purple_roomlist_set_fields(js->roomlist, fields); - - - purple_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), - _("Select a conference server to query"), - js->chat_servers ? js->chat_servers->data : NULL, - FALSE, FALSE, NULL, - _("Find Rooms"), PURPLE_CALLBACK(roomlist_ok_cb), - _("Cancel"), PURPLE_CALLBACK(roomlist_cancel_cb), - purple_connection_get_account(gc), NULL, NULL, - js); - - return js->roomlist; -} - -void jabber_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc; - JabberStream *js; - - gc = purple_account_get_connection(list->account); - js = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - - if (js->roomlist == list) { - js->roomlist = NULL; - purple_roomlist_unref(list); - } -} - -void jabber_chat_member_free(JabberChatMember *jcm) -{ - g_free(jcm->handle); - g_free(jcm->jid); - g_free(jcm); -} - -void jabber_chat_track_handle(JabberChat *chat, const char *handle, - const char *jid, const char *affiliation, const char *role) -{ - JabberChatMember *jcm = g_new0(JabberChatMember, 1); - - jcm->handle = g_strdup(handle); - jcm->jid = g_strdup(jid); - - g_hash_table_replace(chat->members, jcm->handle, jcm); - - /* XXX: keep track of role and affiliation */ -} - -void jabber_chat_remove_handle(JabberChat *chat, const char *handle) -{ - g_hash_table_remove(chat->members, handle); -} - -gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why) -{ - JabberChatMember *jcm; - const char *jid; - char *to; - JabberIq *iq; - xmlnode *query, *item, *reason; - - jcm = g_hash_table_lookup(chat->members, who); - if (jcm && jcm->jid) - jid = jcm->jid; - else if (g_utf8_strchr(who, -1, '@') != NULL) - jid = who; - else - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jid); - xmlnode_set_attrib(item, "affiliation", "outcast"); - if(why) { - reason = xmlnode_new_child(item, "reason"); - xmlnode_insert_data(reason, why, -1); - } - - jabber_iq_send(iq); - - return TRUE; -} - -gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) -{ - JabberChatMember *jcm; - const char *jid; - char *to; - JabberIq *iq; - xmlnode *query, *item; - - jcm = g_hash_table_lookup(chat->members, who); - if (jcm && jcm->jid) - jid = jcm->jid; - else if (g_utf8_strchr(who, -1, '@') != NULL) - jid = who; - else - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jid); - xmlnode_set_attrib(item, "affiliation", affiliation); - - jabber_iq_send(iq); - - return TRUE; -} - -static void -jabber_chat_affiliation_list_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberChat *chat; - xmlnode *query, *item; - int chat_id = GPOINTER_TO_INT(data); - GString *buf; - - if(!(chat = jabber_chat_find_by_id(js, chat_id))) - return; - - if (type == JABBER_IQ_ERROR) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - buf = g_string_new(_("Affiliations:")); - - item = xmlnode_get_child(query, "item"); - if (item) { - for( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *affiliation = xmlnode_get_attrib(item, "affiliation"); - if (jid && affiliation) - g_string_append_printf(buf, "\n%s %s", jid, affiliation); - } - } else { - buf = g_string_append_c(buf, '\n'); - buf = g_string_append_len(buf, _("No users found"), -1); - } - - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf->str, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - - g_string_free(buf, TRUE); -} - -gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation) -{ - JabberIq *iq; - char *room_jid; - xmlnode *query, *item; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, - "http://jabber.org/protocol/muc#admin"); - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "affiliation", affiliation); - - jabber_iq_set_callback(iq, jabber_chat_affiliation_list_cb, GINT_TO_POINTER(chat->id)); - jabber_iq_send(iq); - - return TRUE; -} - -gboolean jabber_chat_role_user(JabberChat *chat, const char *who, const char *role) -{ - char *to; - JabberIq *iq; - xmlnode *query, *item; - JabberChatMember *jcm; - - jcm = g_hash_table_lookup(chat->members, who); - - if (!jcm || !jcm->handle) - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "nick", jcm->handle); - xmlnode_set_attrib(item, "role", role); - - jabber_iq_send(iq); - - return TRUE; -} - -static void jabber_chat_role_list_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberChat *chat; - xmlnode *query, *item; - int chat_id = GPOINTER_TO_INT(data); - GString *buf; - - if(!(chat = jabber_chat_find_by_id(js, chat_id))) - return; - - if (type == JABBER_IQ_ERROR) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - buf = g_string_new(_("Roles:")); - - item = xmlnode_get_child(query, "item"); - if (item) { - for( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *role = xmlnode_get_attrib(item, "role"); - if (jid && role) - g_string_append_printf(buf, "\n%s %s", jid, role); - } - } else { - buf = g_string_append_c(buf, '\n'); - buf = g_string_append_len(buf, _("No users found"), -1); - } - - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf->str, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - - g_string_free(buf, TRUE); -} - -gboolean jabber_chat_role_list(JabberChat *chat, const char *role) -{ - JabberIq *iq; - char *room_jid; - xmlnode *query, *item; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, - "http://jabber.org/protocol/muc#admin"); - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "role", role); - - jabber_iq_set_callback(iq, jabber_chat_role_list_cb, GINT_TO_POINTER(chat->id)); - jabber_iq_send(iq); - - return TRUE; -} - -gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, const char *why) -{ - JabberIq *iq; - JabberChatMember *jcm = g_hash_table_lookup(chat->members, who); - char *to; - xmlnode *query, *item, *reason; - - if(!jcm || !jcm->jid) - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jcm->jid); - xmlnode_set_attrib(item, "role", "none"); - if(why) { - reason = xmlnode_new_child(item, "reason"); - xmlnode_insert_data(reason, why, -1); - } - - jabber_iq_send(iq); - - return TRUE; -} - -static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberChat *chat; -#if 0 - xmlnode *query, *x; -#endif - int chat_id = GPOINTER_TO_INT(data); - - if(!(chat = jabber_chat_find_by_id(js, chat_id))) - return; - - /* defaults, in case the conference server doesn't - * support this request */ - chat->xhtml = TRUE; - - /* disabling this until more MUC servers support - * announcing this */ -#if 0 - if (type == JABBER_IQ_ERROR) { - return; - } - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - chat->xhtml = FALSE; - - for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) { - const char *var = xmlnode_get_attrib(x, "var"); - - if(var && !strcmp(var, NS_XHTML_IM)) { - chat->xhtml = TRUE; - } - } -#endif -} - -void jabber_chat_disco_traffic(JabberChat *chat) -{ - JabberIq *iq; - xmlnode *query; - char *room_jid; - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO); - - xmlnode_set_attrib(iq->node, "to", room_jid); - - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); - - jabber_iq_set_callback(iq, jabber_chat_disco_traffic_cb, GINT_TO_POINTER(chat->id)); - - jabber_iq_send(iq); - - g_free(room_jid); -} - -typedef struct { - const gchar *cap; - gboolean *all_support; - JabberBuddy *jb; -} JabberChatCapsData; - -static void -jabber_chat_all_participants_have_capability_foreach(gpointer key, - gpointer value, - gpointer user_data) -{ - const gchar *cap = ((JabberChatCapsData *) user_data)->cap; - gboolean *all_support = ((JabberChatCapsData *) user_data)->all_support; - JabberBuddy *jb = ((JabberChatCapsData *) user_data)->jb; - JabberChatMember *member = (JabberChatMember *) value; - const gchar *resource = member->handle; - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); - - if (jbr) { - *all_support &= jabber_resource_has_capability(jbr, cap); - } else { - *all_support = FALSE; - } -} - -gboolean -jabber_chat_all_participants_have_capability(const JabberChat *chat, - const gchar *cap) -{ - gchar *chat_jid = NULL; - JabberBuddy *jb = NULL; - gboolean all_support = TRUE; - JabberChatCapsData data; - - chat_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - jb = jabber_buddy_find(chat->js, chat_jid, FALSE); - - if (jb) { - data.cap = cap; - data.all_support = &all_support; - data.jb = jb; - - g_hash_table_foreach(chat->members, - jabber_chat_all_participants_have_capability_foreach, &data); - } else { - all_support = FALSE; - } - g_free(chat_jid); - return all_support; -} - -guint -jabber_chat_get_num_participants(const JabberChat *chat) -{ - return g_hash_table_size(chat->members); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/chat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file chat.h Chat stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_CHAT_H_ -#define PURPLE_JABBER_CHAT_H_ - -#include "internal.h" -#include "connection.h" -#include "conversation.h" -#include "request.h" -#include "roomlist.h" - -#include "jabber.h" - -typedef struct _JabberChatMember { - char *handle; - char *jid; -} JabberChatMember; - - -typedef struct _JabberChat { - JabberStream *js; - char *room; - char *server; - char *handle; - GHashTable *components; - int id; - PurpleConversation *conv; - gboolean muc; - gboolean xhtml; - PurpleRequestType config_dialog_type; - void *config_dialog_handle; - GHashTable *members; - gboolean left; -} JabberChat; - -GList *jabber_chat_info(PurpleConnection *gc); -GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -char *jabber_get_chat_name(GHashTable *data); - -/** - * in-prpl function for joining a chat room. Doesn't require sticking goop - * into a hash table. - * - * @param room The room to join. This MUST be normalized already. - * @param server The server the room is on. This MUST be normalized already. - * @param password The password (if required) to join the room. May be NULL. - * @param data The chat hash table. May be NULL (it will be generated - * for current core<>prpl API interface.) - */ -JabberChat *jabber_join_chat(JabberStream *js, const char *room, - const char *server, const char *handle, - const char *password, GHashTable *data); - -void jabber_chat_join(PurpleConnection *gc, GHashTable *data); -JabberChat *jabber_chat_find(JabberStream *js, const char *room, - const char *server); -JabberChat *jabber_chat_find_by_id(JabberStream *js, int id); -JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv); -void jabber_chat_destroy(JabberChat *chat); -void jabber_chat_free(JabberChat *chat); -gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name); -void jabber_chat_invite(PurpleConnection *gc, int id, const char *message, - const char *name); -void jabber_chat_leave(PurpleConnection *gc, int id); -char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who); -void jabber_chat_request_room_configure(JabberChat *chat); -void jabber_chat_create_instant_room(JabberChat *chat); -void jabber_chat_register(JabberChat *chat); -void jabber_chat_change_topic(JabberChat *chat, const char *topic); -void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick); -void jabber_chat_part(JabberChat *chat, const char *msg); -void jabber_chat_track_handle(JabberChat *chat, const char *handle, - const char *jid, const char *affiliation, const char *role); -void jabber_chat_remove_handle(JabberChat *chat, const char *handle); -gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, - const char *why); -gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, - const char *affiliation); -gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation); -gboolean jabber_chat_role_user(JabberChat *chat, const char *who, - const char *role); -gboolean jabber_chat_role_list(JabberChat *chat, const char *role); -gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, - const char *why); - -PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc); -void jabber_roomlist_cancel(PurpleRoomlist *list); - -void jabber_chat_disco_traffic(JabberChat *chat); - -char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room); - -gboolean jabber_chat_all_participants_have_capability(const JabberChat *chat, - const gchar *cap); -guint jabber_chat_get_num_participants(const JabberChat *chat); - -#endif /* PURPLE_JABBER_CHAT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include <stdlib.h> -#include <glib.h> -#include <string.h> - -#include "data.h" -#include "debug.h" -#include "xmlnode.h" -#include "util.h" -#include "iq.h" - -static GHashTable *local_data_by_alt = NULL; -static GHashTable *local_data_by_cid = NULL; -static GHashTable *remote_data_by_cid = NULL; - -JabberData * -jabber_data_create_from_data(gconstpointer rawdata, gsize size, const char *type, - JabberStream *js) -{ - JabberData *data = g_new0(JabberData, 1); - gchar *checksum = purple_util_get_image_checksum(rawdata, size); - gchar cid[256]; - - g_snprintf(cid, sizeof(cid), "sha1+%s@bob.xmpp.org", checksum); - g_free(checksum); - - data->cid = g_strdup(cid); - data->type = g_strdup(type); - data->size = size; - - data->data = g_memdup(rawdata, size); - - return data; -} - -JabberData * -jabber_data_create_from_xml(xmlnode *tag) -{ - JabberData *data; - gchar *raw_data = NULL; - const gchar *cid, *type; - - /* check if this is a "data" tag */ - if (strcmp(tag->name, "data") != 0) { - purple_debug_error("jabber", "Invalid data element\n"); - return NULL; - } - - cid = xmlnode_get_attrib(tag, "cid"); - type = xmlnode_get_attrib(tag, "type"); - - if (!cid || !type) { - purple_debug_error("jabber", "cid or type missing\n"); - return NULL; - } - - raw_data = xmlnode_get_data(tag); - - if (raw_data == NULL || *raw_data == '\0') { - purple_debug_error("jabber", "data element was empty"); - g_free(raw_data); - return NULL; - } - - data = g_new0(JabberData, 1); - data->data = purple_base64_decode(raw_data, &data->size); - g_free(raw_data); - - if (data->data == NULL) { - purple_debug_error("jabber", "Malformed base64 data\n"); - g_free(data); - return NULL; - } - - data->cid = g_strdup(cid); - data->type = g_strdup(type); - - return data; -} - - -static void -jabber_data_delete(gpointer cbdata) -{ - JabberData *data = cbdata; - g_free(data->cid); - g_free(data->type); - g_free(data->data); - g_free(data); -} - -const char * -jabber_data_get_cid(const JabberData *data) -{ - return data->cid; -} - - -const char * -jabber_data_get_type(const JabberData *data) -{ - return data->type; -} - -gsize -jabber_data_get_size(const JabberData *data) -{ - return data->size; -} - -gpointer -jabber_data_get_data(const JabberData *data) -{ - return data->data; -} - -xmlnode * -jabber_data_get_xml_definition(const JabberData *data) -{ - xmlnode *tag = xmlnode_new("data"); - char *base64data = purple_base64_encode(data->data, data->size); - - xmlnode_set_namespace(tag, NS_BOB); - xmlnode_set_attrib(tag, "cid", data->cid); - xmlnode_set_attrib(tag, "type", data->type); - - xmlnode_insert_data(tag, base64data, -1); - - g_free(base64data); - - return tag; -} - -xmlnode * -jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt) -{ - xmlnode *img = xmlnode_new("img"); - char src[128]; - - xmlnode_set_attrib(img, "alt", alt); - g_snprintf(src, sizeof(src), "cid:%s", data->cid); - xmlnode_set_attrib(img, "src", src); - - return img; -} - -xmlnode * -jabber_data_get_xml_request(const gchar *cid) -{ - xmlnode *tag = xmlnode_new("data"); - - xmlnode_set_namespace(tag, NS_BOB); - xmlnode_set_attrib(tag, "cid", cid); - - return tag; -} - -const JabberData * -jabber_data_find_local_by_alt(const gchar *alt) -{ - purple_debug_info("jabber", "looking up local smiley with alt = %s\n", alt); - return g_hash_table_lookup(local_data_by_alt, alt); -} - -const JabberData * -jabber_data_find_local_by_cid(const gchar *cid) -{ - purple_debug_info("jabber", "lookup local smiley with cid = %s\n", cid); - return g_hash_table_lookup(local_data_by_cid, cid); -} - -const JabberData * -jabber_data_find_remote_by_cid(const gchar *cid) -{ - purple_debug_info("jabber", "lookup remote smiley with cid = %s\n", cid); - - return g_hash_table_lookup(remote_data_by_cid, cid); -} - -void -jabber_data_associate_local(JabberData *data, const gchar *alt) -{ - purple_debug_info("jabber", "associating local smiley\n alt = %s, cid = %s\n", - alt, jabber_data_get_cid(data)); - g_hash_table_insert(local_data_by_alt, g_strdup(alt), data); - g_hash_table_insert(local_data_by_cid, g_strdup(jabber_data_get_cid(data)), - data); -} - -void -jabber_data_associate_remote(JabberData *data) -{ - purple_debug_info("jabber", "associating remote smiley, cid = %s\n", - jabber_data_get_cid(data)); - g_hash_table_insert(remote_data_by_cid, g_strdup(jabber_data_get_cid(data)), - data); -} - -void -jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *data_node) -{ - JabberIq *result = NULL; - const char *cid = xmlnode_get_attrib(data_node, "cid"); - const JabberData *data = cid ? jabber_data_find_local_by_cid(cid) : NULL; - - if (!data) { - xmlnode *item_not_found = xmlnode_new("item-not-found"); - - result = jabber_iq_new(js, JABBER_IQ_ERROR); - if (who) - xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); - xmlnode_insert_child(result->node, item_not_found); - } else { - result = jabber_iq_new(js, JABBER_IQ_RESULT); - if (who) - xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); - xmlnode_insert_child(result->node, - jabber_data_get_xml_definition(data)); - } - jabber_iq_send(result); -} - -void -jabber_data_init(void) -{ - purple_debug_info("jabber", "creating hash tables for data objects\n"); - local_data_by_alt = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - local_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, jabber_data_delete); - remote_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, jabber_data_delete); - - jabber_iq_register_handler("data", NS_BOB, jabber_data_parse); -} - -void -jabber_data_uninit(void) -{ - purple_debug_info("jabber", "destroying hash tables for data objects\n"); - g_hash_table_destroy(local_data_by_alt); - g_hash_table_destroy(local_data_by_cid); - g_hash_table_destroy(remote_data_by_cid); - local_data_by_alt = local_data_by_cid = remote_data_by_cid = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/data.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_DATA_H -#define PURPLE_JABBER_DATA_H - -#include "xmlnode.h" -#include "jabber.h" - -#include <glib.h> - -typedef struct { - char *cid; - char *type; - gsize size; - gpointer data; -} JabberData; - -/* creates a JabberData instance from raw data */ -JabberData *jabber_data_create_from_data(gconstpointer data, gsize size, - const char *type, JabberStream *js); - -/* create a JabberData instance from an XML "data" element (as defined by - XEP 0231 */ -JabberData *jabber_data_create_from_xml(xmlnode *tag); - -const char *jabber_data_get_cid(const JabberData *data); -const char *jabber_data_get_type(const JabberData *data); - -gsize jabber_data_get_size(const JabberData *data); -gpointer jabber_data_get_data(const JabberData *data); - -/* returns the XML definition for the data element */ -xmlnode *jabber_data_get_xml_definition(const JabberData *data); - -/* returns an XHTML-IM "img" tag given a data instance */ -xmlnode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt); - -/* returns a data request element (to be included in an iq stanza) for requesting - data */ -xmlnode *jabber_data_get_xml_request(const gchar *cid); - -/* lookup functions */ -const JabberData *jabber_data_find_local_by_alt(const gchar *alt); -const JabberData *jabber_data_find_local_by_cid(const gchar *cid); -const JabberData *jabber_data_find_remote_by_cid(const gchar *cid); - -/* store data objects */ -void jabber_data_associate_local(JabberData *data, const gchar *alt); -void jabber_data_associate_remote(JabberData *data); - -/* handles iq requests */ -void jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *data_node); - -void jabber_data_init(void); -void jabber_data_uninit(void); - -#endif /* PURPLE_JABBER_DATA_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,655 +0,0 @@ -/* - * purple - Jabber Service Discovery - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "prefs.h" -#include "debug.h" -#include "request.h" - -#include "adhoccommands.h" -#include "buddy.h" -#include "disco.h" -#include "google.h" -#include "iq.h" -#include "jabber.h" -#include "jingle/jingle.h" -#include "pep.h" -#include "presence.h" -#include "roster.h" -#include "useravatar.h" - -struct _jabber_disco_info_cb_data { - gpointer data; - JabberDiscoInfoCallback *callback; -}; - -struct _jabber_disco_items_cb_data { - gpointer data; - JabberDiscoItemsCallback *callback; -}; - -#define SUPPORT_FEATURE(x) { \ - feature = xmlnode_new_child(query, "feature"); \ - xmlnode_set_attrib(feature, "var", x); \ -} - -static void -jabber_disco_bytestream_server_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBytestreamsStreamhost *sh = data; - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_BYTESTREAMS); - - if (from && !strcmp(from, sh->jid) && query != NULL) { - xmlnode *sh_node = xmlnode_get_child(query, "streamhost"); - if (sh_node) { - const char *jid = xmlnode_get_attrib(sh_node, "jid"); - const char *port = xmlnode_get_attrib(sh_node, "port"); - - - if (jid == NULL || strcmp(jid, from) != 0) - purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n", - jid ? jid : "(null)"); - - sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host")); - sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf")); - if (port != NULL) - sh->port = atoi(port); - } - } - - purple_debug_info("jabber", "Discovered bytestream proxy server: " - "jid='%s' host='%s' port='%d' zeroconf='%s'\n", - from ? from : "", sh->host ? sh->host : "", - sh->port, sh->zeroconf ? sh->zeroconf : ""); - - /* TODO: When we support zeroconf proxies, fix this to handle them */ - if (!(sh->jid && sh->host && sh->port > 0)) { - js->bs_proxies = g_list_remove(js->bs_proxies, sh); - g_free(sh->jid); - g_free(sh->host); - g_free(sh->zeroconf); - g_free(sh); - } -} - - -void jabber_disco_info_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *in_query) -{ - if(type == JABBER_IQ_GET) { - xmlnode *query, *identity, *feature; - JabberIq *iq; - const char *node = xmlnode_get_attrib(in_query, "node"); - char *node_uri = NULL; - - /* create custom caps node URI */ - node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL); - - iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO); - - jabber_iq_set_id(iq, id); - - if (from) - xmlnode_set_attrib(iq->node, "to", from); - query = xmlnode_get_child(iq->node, "query"); - - if(node) - xmlnode_set_attrib(query, "node", node); - - if(!node || g_str_equal(node, node_uri)) { - GList *features, *identities; - for(identities = jabber_identities; identities; identities = identities->next) { - JabberIdentity *ident = (JabberIdentity*)identities->data; - identity = xmlnode_new_child(query, "identity"); - xmlnode_set_attrib(identity, "category", ident->category); - xmlnode_set_attrib(identity, "type", ident->type); - if (ident->lang) - xmlnode_set_attrib(identity, "xml:lang", ident->lang); - if (ident->name) - xmlnode_set_attrib(identity, "name", ident->name); - } - for(features = jabber_features; features; features = features->next) { - JabberFeature *feat = (JabberFeature*)features->data; - if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { - feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", feat->namespace); - } - } -#ifdef USE_VV - } else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) { - /* - * HUGE HACK! We advertise this ext (see jabber_presence_create_js - * where we add <c/> to the <presence/>) for the Google Talk - * clients that don't actually check disco#info features. - * - * This specific feature is redundant but is what - * node='http://mail.google.com/xmpp/client/caps', ver='1.1' - * advertises as 'voice-v1'. - */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_VOICE); - } else if (g_str_equal(node, CAPS0115_NODE "#" "video-v1")) { - /* - * HUGE HACK! We advertise this ext (see jabber_presence_create_js - * where we add <c/> to the <presence/>) for the Google Talk - * clients that don't actually check disco#info features. - * - * This specific feature is redundant but is what - * node='http://mail.google.com/xmpp/client/caps', ver='1.1' - * advertises as 'video-v1'. - */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_VIDEO); - } else if (g_str_equal(node, CAPS0115_NODE "#" "camera-v1")) { - /* - * HUGE HACK! We advertise this ext (see jabber_presence_create_js - * where we add <c/> to the <presence/>) for the Google Talk - * clients that don't actually check disco#info features. - * - * This specific feature is redundant but is what - * node='http://mail.google.com/xmpp/client/caps', ver='1.1' - * advertises as 'camera-v1'. - */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_CAMERA); -#endif - } else { - xmlnode *error, *inf; - - /* XXX: gross hack, implement jabber_iq_set_type or something */ - xmlnode_set_attrib(iq->node, "type", "error"); - iq->type = JABBER_IQ_ERROR; - - error = xmlnode_new_child(query, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, NS_XMPP_STANZAS); - } - g_free(node_uri); - jabber_iq_send(iq); - } else if (type == JABBER_IQ_SET) { - /* wtf? seriously. wtf‽ */ - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode *error, *bad_request; - - /* Free the <query/> */ - xmlnode_free(xmlnode_get_child(iq->node, "query")); - /* Add an error */ - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - bad_request = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS); - - jabber_iq_set_id(iq, id); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - - jabber_iq_send(iq); - } -} - -static void jabber_disco_info_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - struct _jabber_disco_info_cb_data *jdicd = data; - xmlnode *query; - - query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); - - if (type == JABBER_IQ_RESULT && query) { - xmlnode *child; - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - JabberCapabilities capabilities = JABBER_CAP_NONE; - - if((jid = jabber_id_new(from))) { - if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(jbr) - capabilities = jbr->capabilities; - - for(child = query->child; child; child = child->next) { - if(child->type != XMLNODE_TYPE_TAG) - continue; - - if(!strcmp(child->name, "identity")) { - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - if(!category || !type) - continue; - - if(!strcmp(category, "conference") && !strcmp(type, "text")) { - /* we found a groupchat or MUC server, add it to the list */ - /* XXX: actually check for protocol/muc or gc-1.0 support */ - js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from)); - } else if(!strcmp(category, "directory") && !strcmp(type, "user")) { - /* we found a JUD */ - js->user_directories = g_list_prepend(js->user_directories, g_strdup(from)); - } else if(!strcmp(category, "proxy") && !strcmp(type, NS_BYTESTREAMS)) { - /* This is a bytestream proxy */ - JabberIq *iq; - JabberBytestreamsStreamhost *sh; - - purple_debug_info("jabber", "Found bytestream proxy server: %s\n", from); - - sh = g_new0(JabberBytestreamsStreamhost, 1); - sh->jid = g_strdup(from); - js->bs_proxies = g_list_prepend(js->bs_proxies, sh); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, - NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", sh->jid); - jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); - jabber_iq_send(iq); - } - - } else if(!strcmp(child->name, "feature")) { - const char *var = xmlnode_get_attrib(child, "var"); - if(!var) - continue; - - if(!strcmp(var, "http://jabber.org/protocol/si")) - capabilities |= JABBER_CAP_SI; - else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer")) - capabilities |= JABBER_CAP_SI_FILE_XFER; - else if(!strcmp(var, NS_BYTESTREAMS)) - capabilities |= JABBER_CAP_BYTESTREAMS; - else if(!strcmp(var, "jabber:iq:search")) - capabilities |= JABBER_CAP_IQ_SEARCH; - else if(!strcmp(var, "jabber:iq:register")) - capabilities |= JABBER_CAP_IQ_REGISTER; - else if(!strcmp(var, NS_PING)) - capabilities |= JABBER_CAP_PING; - else if(!strcmp(var, NS_DISCO_ITEMS)) - capabilities |= JABBER_CAP_ITEMS; - else if(!strcmp(var, "http://jabber.org/protocol/commands")) { - capabilities |= JABBER_CAP_ADHOC; - } - else if(!strcmp(var, NS_IBB)) { - purple_debug_info("jabber", "remote supports IBB\n"); - capabilities |= JABBER_CAP_IBB; - } - } - } - - js->chat_servers = g_list_reverse(js->chat_servers); - - capabilities |= JABBER_CAP_RETRIEVED; - - if(jbr) - jbr->capabilities = capabilities; - - if (jdicd && jdicd->callback) - jdicd->callback(js, from, capabilities, jdicd->data); - } else { /* type == JABBER_IQ_ERROR or query == NULL */ - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - JabberCapabilities capabilities = JABBER_CAP_NONE; - - if((jid = jabber_id_new(from))) { - if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(jbr) - capabilities = jbr->capabilities; - - if (jdicd && jdicd->callback) - jdicd->callback(js, from, capabilities, jdicd->data); - } - - g_free(jdicd); -} - -void jabber_disco_items_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *query) -{ - if(type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, - NS_DISCO_ITEMS); - - /* preserve node */ - xmlnode *iq_query = xmlnode_get_child(iq->node, "query"); - const char *node = xmlnode_get_attrib(query, "node"); - if(node) - xmlnode_set_attrib(iq_query,"node",node); - - jabber_iq_set_id(iq, id); - - if (from) - xmlnode_set_attrib(iq->node, "to", from); - jabber_iq_send(iq); - } -} - -static void -jabber_disco_finish_server_info_result_cb(JabberStream *js) -{ - const char *ft_proxies; - - /* - * This *should* happen only if the server supports vcard-temp, but there - * are apparently some servers that don't advertise it even though they - * support it. - */ - jabber_vcard_fetch_mine(js); - - if (js->pep) - jabber_avatar_fetch_mine(js); - - if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) { - /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */ - jabber_roster_request(js); - } - - if (js->server_caps & JABBER_CAP_ADHOC) { - /* The server supports ad-hoc commands, so let's request the list */ - jabber_adhoc_server_get_list(js); - } - - /* If the server supports blocking, request the block list */ - if (js->server_caps & JABBER_CAP_BLOCKING) { - jabber_request_block_list(js); - } - - /* If there are manually specified bytestream proxies, query them */ - ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); - if (ft_proxies) { - JabberIq *iq; - JabberBytestreamsStreamhost *sh; - int i; - char *tmp; - gchar **ft_proxy_list = g_strsplit(ft_proxies, ",", 0); - - for(i = 0; ft_proxy_list[i]; i++) { - g_strstrip(ft_proxy_list[i]); - if(!(*ft_proxy_list[i])) - continue; - - /* We used to allow specifying a port directly here; get rid of it */ - if((tmp = strchr(ft_proxy_list[i], ':'))) - *tmp = '\0'; - - sh = g_new0(JabberBytestreamsStreamhost, 1); - sh->jid = g_strdup(ft_proxy_list[i]); - js->bs_proxies = g_list_prepend(js->bs_proxies, sh); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", sh->jid); - jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); - jabber_iq_send(iq); - } - - g_strfreev(ft_proxy_list); - } - -} - -/* should probably share this code with google.c, or maybe from 2.7.0 - introduce an abstracted hostname -> IP function in dns.c */ -static void -jabber_disco_stun_lookup_cb(GSList *hosts, gpointer data, - const char *error_message) -{ - JabberStream *js = (JabberStream *) data; - - if (error_message) { - purple_debug_error("jabber", "STUN lookup failed: %s\n", - error_message); - g_slist_free(hosts); - js->stun_query = NULL; - return; - } - - if (hosts && g_slist_next(hosts)) { - struct sockaddr *addr = g_slist_next(hosts)->data; - char dst[INET6_ADDRSTRLEN]; - int port; - - if (addr->sa_family == AF_INET6) { - inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); - } else { - inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in *) addr)->sin_port); - } - - if (js->stun_ip) - g_free(js->stun_ip); - js->stun_ip = g_strdup(dst); - js->stun_port = port; - - purple_debug_info("jabber", "set STUN IP/port address: " - "%s:%d\n", dst, port); - - /* unmark ongoing query */ - js->stun_query = NULL; - } - - while (hosts != NULL) { - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } -} - - -static void -jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer data) -{ - JabberStream *js = (JabberStream *) data; - - purple_debug_info("jabber", "got %d SRV responses for STUN.\n", results); - js->srv_query_data = NULL; - - if (results > 0) { - purple_debug_info("jabber", "looking up IP for %s:%d\n", - resp[0].hostname, resp[0].port); - js->stun_query = - purple_dnsquery_a(resp[0].hostname, resp[0].port, - jabber_disco_stun_lookup_cb, js); - } -} - - -static void -jabber_disco_server_info_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *child; - - if (!from || strcmp(from, js->user->domain)) { - jabber_disco_finish_server_info_result_cb(js); - return; - } - - if (type == JABBER_IQ_ERROR) { - /* A common way to get here is for the server not to support xmlns http://jabber.org/protocol/disco#info */ - jabber_disco_finish_server_info_result_cb(js); - return; - } - - query = xmlnode_get_child(packet, "query"); - - if (!query) { - jabber_disco_finish_server_info_result_cb(js); - return; - } - - for (child = xmlnode_get_child(query, "identity"); child; - child = xmlnode_get_next_twin(child)) { - const char *category, *type, *name; - category = xmlnode_get_attrib(child, "category"); - type = xmlnode_get_attrib(child, "type"); - if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) - js->pep = TRUE; - if (!category || strcmp(category, "server")) - continue; - if (!type || strcmp(type, "im")) - continue; - - name = xmlnode_get_attrib(child, "name"); - if (!name) - continue; - - g_free(js->server_name); - js->server_name = g_strdup(name); - if (!strcmp(name, "Google Talk")) { - purple_debug_info("jabber", "Google Talk!\n"); - js->googletalk = TRUE; - - /* autodiscover stun and relays */ - jabber_google_send_jingle_info(js); - } else { - js->srv_query_data = - purple_srv_resolve("stun", "udp", js->user->domain, - jabber_disco_stun_srv_resolve_cb, js); - /* TODO: add TURN support later... */ - } - } - - for (child = xmlnode_get_child(query, "feature"); child; - child = xmlnode_get_next_twin(child)) { - const char *var; - var = xmlnode_get_attrib(child, "var"); - if (!var) - continue; - - if (!strcmp(NS_GOOGLE_MAIL_NOTIFY, var)) { - js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; - jabber_gmail_init(js); - } else if (!strcmp("google:roster", var)) { - js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; - jabber_google_roster_init(js); - } else if (!strcmp("http://jabber.org/protocol/commands", var)) { - js->server_caps |= JABBER_CAP_ADHOC; - } else if (!strcmp(NS_SIMPLE_BLOCKING, var)) { - js->server_caps |= JABBER_CAP_BLOCKING; - } - } - - jabber_disco_finish_server_info_result_cb(js); -} - -static void -jabber_disco_server_items_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *child; - - if (!from || strcmp(from, js->user->domain) != 0) - return; - - if (type == JABBER_IQ_ERROR) - return; - - while(js->chat_servers) { - g_free(js->chat_servers->data); - js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); - } - - query = xmlnode_get_child(packet, "query"); - - for(child = xmlnode_get_child(query, "item"); child; - child = xmlnode_get_next_twin(child)) { - JabberIq *iq; - const char *jid, *node; - - if(!(jid = xmlnode_get_attrib(child, "jid"))) - continue; - - /* we don't actually care about the specific nodes, - * so we won't query them */ - if((node = xmlnode_get_attrib(child, "node"))) - continue; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", jid); - jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL); - jabber_iq_send(iq); - } -} - -void jabber_disco_items_server(JabberStream *js) -{ - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - - xmlnode_set_attrib(iq->node, "to", js->user->domain); - - jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); - jabber_iq_send(iq); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", js->user->domain); - jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); - jabber_iq_send(iq); -} - -void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data) -{ - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - struct _jabber_disco_info_cb_data *jdicd; - JabberIq *iq; - - if((jid = jabber_id_new(who))) { - if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { - callback(js, who, jbr->capabilities, data); - return; - } - - jdicd = g_new0(struct _jabber_disco_info_cb_data, 1); - jdicd->data = data; - jdicd->callback = callback; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", who); - - jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd); - jabber_iq_send(iq); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/disco.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/** - * @file disco.h Jabber Service Discovery - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_DISCO_H_ -#define PURPLE_JABBER_DISCO_H_ - -#include "jabber.h" - -typedef struct _JabberDiscoItem { - const char *jid; /* MUST */ - const char *node; /* SHOULD */ - const char *name; /* MAY */ -} JabberDiscoItem; - -typedef void (JabberDiscoInfoCallback)(JabberStream *js, const char *who, - JabberCapabilities capabilities, gpointer data); - -typedef void (JabberDiscoItemsCallback)(JabberStream *js, const char *jid, - const char *node, GSList *items, gpointer data); - -void jabber_disco_info_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *in_query); -void jabber_disco_items_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); - -void jabber_disco_items_server(JabberStream *js); - -void jabber_disco_info_do(JabberStream *js, const char *who, - JabberDiscoInfoCallback *callback, gpointer data); - -#endif /* PURPLE_JABBER_DISCO_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1467 +0,0 @@ -/** - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "mediamanager.h" -#include "util.h" -#include "privacy.h" -#include "dnsquery.h" -#include "network.h" - -#include "buddy.h" -#include "google.h" -#include "jabber.h" -#include "presence.h" -#include "iq.h" -#include "chat.h" - -#include "jingle/jingle.h" - -#ifdef USE_VV - -typedef struct { - char *id; - char *initiator; -} GoogleSessionId; - -typedef enum { - UNINIT, - SENT_INITIATE, - RECEIVED_INITIATE, - IN_PRORESS, - TERMINATED -} GoogleSessionState; - -typedef struct { - GoogleSessionId id; - GoogleSessionState state; - PurpleMedia *media; - JabberStream *js; - char *remote_jid; - gboolean video; -} GoogleSession; - -static gboolean -google_session_id_equal(gconstpointer a, gconstpointer b) -{ - GoogleSessionId *c = (GoogleSessionId*)a; - GoogleSessionId *d = (GoogleSessionId*)b; - - return !strcmp(c->id, d->id) && !strcmp(c->initiator, d->initiator); -} - -static void -google_session_destroy(GoogleSession *session) -{ - g_free(session->id.id); - g_free(session->id.initiator); - g_free(session->remote_jid); - g_free(session); -} - -static xmlnode * -google_session_create_xmlnode(GoogleSession *session, const char *type) -{ - xmlnode *node = xmlnode_new("session"); - xmlnode_set_namespace(node, NS_GOOGLE_SESSION); - xmlnode_set_attrib(node, "id", session->id.id); - xmlnode_set_attrib(node, "initiator", session->id.initiator); - xmlnode_set_attrib(node, "type", type); - return node; -} - -static void -google_session_send_candidates(PurpleMedia *media, gchar *session_id, - gchar *participant, GoogleSession *session) -{ - GList *candidates = purple_media_get_local_candidates( - session->media, session_id, session->remote_jid), *iter; - PurpleMediaCandidate *transport; - gboolean video = FALSE; - - if (!strcmp(session_id, "google-video")) - video = TRUE; - - for (iter = candidates; iter; iter = iter->next) { - JabberIq *iq; - gchar *ip, *port, *username, *password; - gchar pref[16]; - PurpleMediaCandidateType type; - xmlnode *sess; - xmlnode *candidate; - guint component_id; - transport = PURPLE_MEDIA_CANDIDATE(iter->data); - component_id = purple_media_candidate_get_component_id( - transport); - - iq = jabber_iq_new(session->js, JABBER_IQ_SET); - sess = google_session_create_xmlnode(session, "candidates"); - xmlnode_insert_child(iq->node, sess); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - - candidate = xmlnode_new("candidate"); - - ip = purple_media_candidate_get_ip(transport); - port = g_strdup_printf("%d", - purple_media_candidate_get_port(transport)); - g_ascii_dtostr(pref, 16, - purple_media_candidate_get_priority(transport) / 1000.0); - username = purple_media_candidate_get_username(transport); - password = purple_media_candidate_get_password(transport); - type = purple_media_candidate_get_candidate_type(transport); - - xmlnode_set_attrib(candidate, "address", ip); - xmlnode_set_attrib(candidate, "port", port); - xmlnode_set_attrib(candidate, "name", - component_id == PURPLE_MEDIA_COMPONENT_RTP ? - video ? "video_rtp" : "rtp" : - component_id == PURPLE_MEDIA_COMPONENT_RTCP ? - video ? "video_rtcp" : "rtcp" : "none"); - xmlnode_set_attrib(candidate, "username", username); - /* - * As of this writing, Farsight 2 in Google compatibility - * mode doesn't provide a password. The Gmail client - * requires this to be set. - */ - xmlnode_set_attrib(candidate, "password", - password != NULL ? password : ""); - xmlnode_set_attrib(candidate, "preference", pref); - xmlnode_set_attrib(candidate, "protocol", - purple_media_candidate_get_protocol(transport) - == PURPLE_MEDIA_NETWORK_PROTOCOL_UDP ? - "udp" : "tcp"); - xmlnode_set_attrib(candidate, "type", type == - PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "local" : - type == - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "stun" : - type == - PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : - NULL); - xmlnode_set_attrib(candidate, "generation", "0"); - xmlnode_set_attrib(candidate, "network", "0"); - xmlnode_insert_child(sess, candidate); - - g_free(ip); - g_free(port); - g_free(username); - g_free(password); - - jabber_iq_send(iq); - } - purple_media_candidate_list_free(candidates); -} - -static void -google_session_ready(GoogleSession *session) -{ - PurpleMedia *media = session->media; - if (purple_media_codecs_ready(media, NULL) && - purple_media_candidates_prepared(media, NULL, NULL)) { - gchar *me = g_strdup_printf("%s@%s/%s", - session->js->user->node, - session->js->user->domain, - session->js->user->resource); - JabberIq *iq; - xmlnode *sess, *desc, *payload; - GList *codecs, *iter; - gboolean is_initiator = !strcmp(session->id.initiator, me); - - if (!is_initiator && - !purple_media_accepted(media, NULL, NULL)) { - g_free(me); - return; - } - - iq = jabber_iq_new(session->js, JABBER_IQ_SET); - - if (is_initiator) { - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - xmlnode_set_attrib(iq->node, "from", session->id.initiator); - sess = google_session_create_xmlnode(session, "initiate"); - } else { - google_session_send_candidates(session->media, - "google-voice", session->remote_jid, - session); - google_session_send_candidates(session->media, - "google-video", session->remote_jid, - session); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - xmlnode_set_attrib(iq->node, "from", me); - sess = google_session_create_xmlnode(session, "accept"); - } - xmlnode_insert_child(iq->node, sess); - desc = xmlnode_new_child(sess, "description"); - if (session->video) - xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_VIDEO); - else - xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_PHONE); - - codecs = purple_media_get_codecs(media, "google-video"); - - for (iter = codecs; iter; iter = g_list_next(iter)) { - PurpleMediaCodec *codec = (PurpleMediaCodec*)iter->data; - gchar *id = g_strdup_printf("%d", - purple_media_codec_get_id(codec)); - gchar *encoding_name = - purple_media_codec_get_encoding_name(codec); - payload = xmlnode_new_child(desc, "payload-type"); - xmlnode_set_attrib(payload, "id", id); - xmlnode_set_attrib(payload, "name", encoding_name); - xmlnode_set_attrib(payload, "width", "320"); - xmlnode_set_attrib(payload, "height", "200"); - xmlnode_set_attrib(payload, "framerate", "30"); - g_free(encoding_name); - g_free(id); - } - purple_media_codec_list_free(codecs); - - codecs = purple_media_get_codecs(media, "google-voice"); - - for (iter = codecs; iter; iter = g_list_next(iter)) { - PurpleMediaCodec *codec = (PurpleMediaCodec*)iter->data; - gchar *id = g_strdup_printf("%d", - purple_media_codec_get_id(codec)); - gchar *encoding_name = - purple_media_codec_get_encoding_name(codec); - gchar *clock_rate = g_strdup_printf("%d", - purple_media_codec_get_clock_rate(codec)); - payload = xmlnode_new_child(desc, "payload-type"); - if (session->video) - xmlnode_set_namespace(payload, NS_GOOGLE_SESSION_PHONE); - xmlnode_set_attrib(payload, "id", id); - /* - * Hack to make Gmail accept speex as the codec. - * It shouldn't have to be case sensitive. - */ - if (purple_strequal(encoding_name, "SPEEX")) - xmlnode_set_attrib(payload, "name", "speex"); - else - xmlnode_set_attrib(payload, "name", encoding_name); - xmlnode_set_attrib(payload, "clockrate", clock_rate); - g_free(clock_rate); - g_free(encoding_name); - g_free(id); - } - purple_media_codec_list_free(codecs); - - jabber_iq_send(iq); - - if (is_initiator) { - google_session_send_candidates(session->media, - "google-voice", session->remote_jid, - session); - google_session_send_candidates(session->media, - "google-video", session->remote_jid, - session); - } - - g_signal_handlers_disconnect_by_func(G_OBJECT(session->media), - G_CALLBACK(google_session_ready), session); - } -} - -static void -google_session_state_changed_cb(PurpleMedia *media, PurpleMediaState state, - gchar *sid, gchar *name, GoogleSession *session) -{ - if (sid == NULL && name == NULL) { - if (state == PURPLE_MEDIA_STATE_END) { - google_session_destroy(session); - } - } -} - -static void -google_session_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, - gchar *sid, gchar *name, gboolean local, - GoogleSession *session) -{ - if (sid != NULL || name != NULL) - return; - - if (type == PURPLE_MEDIA_INFO_HANGUP) { - xmlnode *sess; - JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET); - - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - sess = google_session_create_xmlnode(session, "terminate"); - xmlnode_insert_child(iq->node, sess); - - jabber_iq_send(iq); - } else if (type == PURPLE_MEDIA_INFO_REJECT) { - xmlnode *sess; - JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET); - - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - sess = google_session_create_xmlnode(session, "reject"); - xmlnode_insert_child(iq->node, sess); - - jabber_iq_send(iq); - } else if (type == PURPLE_MEDIA_INFO_ACCEPT && local == TRUE) { - google_session_ready(session); - } -} - -static GParameter * -jabber_google_session_get_params(JabberStream *js, guint *num) -{ - guint num_params; - GParameter *params = jingle_get_params(js, &num_params); - GParameter *new_params = g_new0(GParameter, num_params + 1); - - memcpy(new_params, params, sizeof(GParameter) * num_params); - - purple_debug_info("jabber", "setting Google jingle compatibility param\n"); - new_params[num_params].name = "compatibility-mode"; - g_value_init(&new_params[num_params].value, G_TYPE_UINT); - g_value_set_uint(&new_params[num_params].value, 1); /* NICE_COMPATIBILITY_GOOGLE */ - - g_free(params); - *num = num_params + 1; - return new_params; -} - - -gboolean -jabber_google_session_initiate(JabberStream *js, const gchar *who, PurpleMediaSessionType type) -{ - GoogleSession *session; - JabberBuddy *jb; - JabberBuddyResource *jbr; - gchar *jid; - GParameter *params; - guint num_params; - - /* construct JID to send to */ - jb = jabber_buddy_find(js, who, FALSE); - if (!jb) { - purple_debug_error("jingle-rtp", - "Could not find Jabber buddy\n"); - return FALSE; - } - jbr = jabber_buddy_find_resource(jb, NULL); - if (!jbr) { - purple_debug_error("jingle-rtp", - "Could not find buddy's resource\n"); - } - - if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { - jid = g_strdup_printf("%s/%s", who, jbr->name); - } else { - jid = g_strdup(who); - } - - session = g_new0(GoogleSession, 1); - session->id.id = jabber_get_next_id(js); - session->id.initiator = g_strdup_printf("%s@%s/%s", js->user->node, - js->user->domain, js->user->resource); - session->state = SENT_INITIATE; - session->js = js; - session->remote_jid = jid; - - if (type & PURPLE_MEDIA_VIDEO) - session->video = TRUE; - - session->media = purple_media_manager_create_media( - purple_media_manager_get(), - purple_connection_get_account(js->gc), - "fsrtpconference", session->remote_jid, TRUE); - - purple_media_set_prpl_data(session->media, session); - - g_signal_connect_swapped(G_OBJECT(session->media), - "candidates-prepared", - G_CALLBACK(google_session_ready), session); - g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed", - G_CALLBACK(google_session_ready), session); - g_signal_connect(G_OBJECT(session->media), "state-changed", - G_CALLBACK(google_session_state_changed_cb), session); - g_signal_connect(G_OBJECT(session->media), "stream-info", - G_CALLBACK(google_session_stream_info_cb), session); - - params = jabber_google_session_get_params(js, &num_params); - - if (purple_media_add_stream(session->media, "google-voice", - session->remote_jid, PURPLE_MEDIA_AUDIO, - TRUE, "nice", num_params, params) == FALSE || - (session->video && purple_media_add_stream( - session->media, "google-video", - session->remote_jid, PURPLE_MEDIA_VIDEO, - TRUE, "nice", num_params, params) == FALSE)) { - purple_media_error(session->media, "Error adding stream."); - purple_media_end(session->media, NULL, NULL); - g_free(params); - return FALSE; - } - - g_free(params); - - return (session->media != NULL) ? TRUE : FALSE; -} - -static gboolean -google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - JabberIq *result; - GList *codecs = NULL, *video_codecs = NULL; - xmlnode *desc_element, *codec_element; - PurpleMediaCodec *codec; - const char *xmlns; - GParameter *params; - guint num_params; - - if (session->state != UNINIT) { - purple_debug_error("jabber", "Received initiate for active session.\n"); - return FALSE; - } - - desc_element = xmlnode_get_child(sess, "description"); - xmlns = xmlnode_get_namespace(desc_element); - - if (purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) - session->video = FALSE; - else if (purple_strequal(xmlns, NS_GOOGLE_SESSION_VIDEO)) - session->video = TRUE; - else { - purple_debug_error("jabber", "Received initiate with " - "invalid namespace %s.\n", xmlns); - return FALSE; - } - - session->media = purple_media_manager_create_media( - purple_media_manager_get(), - purple_connection_get_account(js->gc), - "fsrtpconference", session->remote_jid, FALSE); - - purple_media_set_prpl_data(session->media, session); - - g_signal_connect_swapped(G_OBJECT(session->media), - "candidates-prepared", - G_CALLBACK(google_session_ready), session); - g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed", - G_CALLBACK(google_session_ready), session); - g_signal_connect(G_OBJECT(session->media), "state-changed", - G_CALLBACK(google_session_state_changed_cb), session); - g_signal_connect(G_OBJECT(session->media), "stream-info", - G_CALLBACK(google_session_stream_info_cb), session); - - params = jabber_google_session_get_params(js, &num_params); - - if (purple_media_add_stream(session->media, "google-voice", - session->remote_jid, PURPLE_MEDIA_AUDIO, FALSE, - "nice", num_params, params) == FALSE || - (session->video && purple_media_add_stream( - session->media, "google-video", - session->remote_jid, PURPLE_MEDIA_VIDEO, - FALSE, "nice", num_params, params) == FALSE)) { - purple_media_error(session->media, "Error adding stream."); - purple_media_stream_info(session->media, - PURPLE_MEDIA_INFO_REJECT, NULL, NULL, TRUE); - g_free(params); - return FALSE; - } - - g_free(params); - - for (codec_element = xmlnode_get_child(desc_element, "payload-type"); - codec_element; codec_element = codec_element->next) { - const char *id, *encoding_name, *clock_rate, - *width, *height, *framerate; - gboolean video; - if (codec_element->name && - strcmp(codec_element->name, "payload-type")) - continue; - - xmlns = xmlnode_get_namespace(codec_element); - encoding_name = xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); - - if (!session->video || - (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_PHONE))) { - clock_rate = xmlnode_get_attrib( - codec_element, "clockrate"); - video = FALSE; - } else { - width = xmlnode_get_attrib(codec_element, "width"); - height = xmlnode_get_attrib(codec_element, "height"); - framerate = xmlnode_get_attrib( - codec_element, "framerate"); - clock_rate = "90000"; - video = TRUE; - } - - if (id) { - codec = purple_media_codec_new(atoi(id), encoding_name, - video ? PURPLE_MEDIA_VIDEO : - PURPLE_MEDIA_AUDIO, - clock_rate ? atoi(clock_rate) : 0); - if (video) - video_codecs = g_list_append( - video_codecs, codec); - else - codecs = g_list_append(codecs, codec); - } - } - - if (codecs) - purple_media_set_remote_codecs(session->media, "google-voice", - session->remote_jid, codecs); - if (video_codecs) - purple_media_set_remote_codecs(session->media, "google-video", - session->remote_jid, video_codecs); - - purple_media_codec_list_free(codecs); - purple_media_codec_list_free(video_codecs); - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); - jabber_iq_send(result); - - return TRUE; -} - -static void -google_session_handle_candidates(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - JabberIq *result; - GList *list = NULL, *video_list = NULL; - xmlnode *cand; - static int name = 0; - char n[4]; - - for (cand = xmlnode_get_child(sess, "candidate"); cand; - cand = xmlnode_get_next_twin(cand)) { - PurpleMediaCandidate *info; - const gchar *cname = xmlnode_get_attrib(cand, "name"); - const gchar *type = xmlnode_get_attrib(cand, "type"); - const gchar *protocol = xmlnode_get_attrib(cand, "protocol"); - const gchar *address = xmlnode_get_attrib(cand, "address"); - const gchar *port = xmlnode_get_attrib(cand, "port"); - guint component_id; - - if (cname && type && address && port) { - PurpleMediaCandidateType candidate_type; - - g_snprintf(n, sizeof(n), "S%d", name++); - - if (g_str_equal(type, "local")) - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST; - else if (g_str_equal(type, "stun")) - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX; - else if (g_str_equal(type, "relay")) - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_RELAY; - else - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST; - - if (purple_strequal(cname, "rtcp") || - purple_strequal(cname, "video_rtcp")) - component_id = PURPLE_MEDIA_COMPONENT_RTCP; - else - component_id = PURPLE_MEDIA_COMPONENT_RTP; - - info = purple_media_candidate_new(n, component_id, - candidate_type, - purple_strequal(protocol, "udp") ? - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP : - PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, - address, - atoi(port)); - g_object_set(info, "username", xmlnode_get_attrib(cand, "username"), - "password", xmlnode_get_attrib(cand, "password"), NULL); - if (!strncmp(cname, "video_", 6)) - video_list = g_list_append(video_list, info); - else - list = g_list_append(list, info); - } - } - - if (list) - purple_media_add_remote_candidates( - session->media, "google-voice", - session->remote_jid, list); - if (video_list) - purple_media_add_remote_candidates( - session->media, "google-video", - session->remote_jid, video_list); - purple_media_candidate_list_free(list); - purple_media_candidate_list_free(video_list); - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); - jabber_iq_send(result); -} - -static void -google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - xmlnode *desc_element = xmlnode_get_child(sess, "description"); - xmlnode *codec_element = xmlnode_get_child( - desc_element, "payload-type"); - GList *codecs = NULL, *video_codecs = NULL; - JabberIq *result = NULL; - const gchar *xmlns = xmlnode_get_namespace(desc_element); - gboolean video = (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_VIDEO)); - - for (; codec_element; codec_element = codec_element->next) { - const gchar *xmlns, *encoding_name, *id, - *clock_rate, *width, *height, *framerate; - gboolean video_codec = FALSE; - - if (!purple_strequal(codec_element->name, "payload-type")) - continue; - - xmlns = xmlnode_get_namespace(codec_element); - encoding_name = xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); - - if (!video || purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) - clock_rate = xmlnode_get_attrib( - codec_element, "clockrate"); - else { - clock_rate = "90000"; - width = xmlnode_get_attrib(codec_element, "width"); - height = xmlnode_get_attrib(codec_element, "height"); - framerate = xmlnode_get_attrib( - codec_element, "framerate"); - video_codec = TRUE; - } - - if (id && encoding_name) { - PurpleMediaCodec *codec = purple_media_codec_new( - atoi(id), encoding_name, - video_codec ? PURPLE_MEDIA_VIDEO : - PURPLE_MEDIA_AUDIO, - clock_rate ? atoi(clock_rate) : 0); - if (video_codec) - video_codecs = g_list_append( - video_codecs, codec); - else - codecs = g_list_append(codecs, codec); - } - } - - if (codecs) - purple_media_set_remote_codecs(session->media, "google-voice", - session->remote_jid, codecs); - if (video_codecs) - purple_media_set_remote_codecs(session->media, "google-video", - session->remote_jid, video_codecs); - - purple_media_stream_info(session->media, PURPLE_MEDIA_INFO_ACCEPT, - NULL, NULL, FALSE); - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); - jabber_iq_send(result); -} - -static void -google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode *sess) -{ - purple_media_end(session->media, NULL, NULL); -} - -static void -google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnode *sess) -{ - purple_media_end(session->media, NULL, NULL); -} - -static void -google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - const char *type = xmlnode_get_attrib(sess, "type"); - - if (!strcmp(type, "initiate")) { - google_session_handle_initiate(js, session, sess, iq_id); - } else if (!strcmp(type, "accept")) { - google_session_handle_accept(js, session, sess, iq_id); - } else if (!strcmp(type, "reject")) { - google_session_handle_reject(js, session, sess); - } else if (!strcmp(type, "terminate")) { - google_session_handle_terminate(js, session, sess); - } else if (!strcmp(type, "candidates")) { - google_session_handle_candidates(js, session, sess, iq_id); - } -} - -void -jabber_google_session_parse(JabberStream *js, const char *from, - JabberIqType type, const char *iq_id, - xmlnode *session_node) -{ - GoogleSession *session = NULL; - GoogleSessionId id; - - xmlnode *desc_node; - - GList *iter = NULL; - - if (type != JABBER_IQ_SET) - return; - - id.id = (gchar*)xmlnode_get_attrib(session_node, "id"); - if (!id.id) - return; - - id.initiator = (gchar*)xmlnode_get_attrib(session_node, "initiator"); - if (!id.initiator) - return; - - iter = purple_media_manager_get_media_by_account( - purple_media_manager_get(), - purple_connection_get_account(js->gc)); - for (; iter; iter = g_list_delete_link(iter, iter)) { - GoogleSession *gsession = - purple_media_get_prpl_data(iter->data); - if (google_session_id_equal(&(gsession->id), &id)) { - session = gsession; - break; - } - } - if (iter != NULL) { - g_list_free(iter); - } - - if (session) { - google_session_parse_iq(js, session, session_node, iq_id); - return; - } - - /* If the session doesn't exist, this has to be an initiate message */ - if (strcmp(xmlnode_get_attrib(session_node, "type"), "initiate")) - return; - desc_node = xmlnode_get_child(session_node, "description"); - if (!desc_node) - return; - session = g_new0(GoogleSession, 1); - session->id.id = g_strdup(id.id); - session->id.initiator = g_strdup(id.initiator); - session->state = UNINIT; - session->js = js; - session->remote_jid = g_strdup(session->id.initiator); - - google_session_handle_initiate(js, session, session_node, iq_id); -} -#endif /* USE_VV */ - -static void -jabber_gmail_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer nul) -{ - xmlnode *child; - xmlnode *message; - const char *to, *url; - const char *in_str; - char *to_name; - - int i, count = 1, returned_count; - - const char **tos, **froms, **urls; - char **subjects; - - if (type == JABBER_IQ_ERROR) - return; - - child = xmlnode_get_child(packet, "mailbox"); - if (!child) - return; - - in_str = xmlnode_get_attrib(child, "total-matched"); - if (in_str && *in_str) - count = atoi(in_str); - - /* If Gmail doesn't tell us who the mail is to, let's use our JID */ - to = xmlnode_get_attrib(packet, "to"); - - message = xmlnode_get_child(child, "mail-thread-info"); - - if (count == 0 || !message) { - if (count > 0) { - char *bare_jid = jabber_get_bare_jid(to); - const char *default_tos[2] = { bare_jid }; - - purple_notify_emails(js->gc, count, FALSE, NULL, NULL, default_tos, NULL, NULL, NULL); - g_free(bare_jid); - } else { - purple_notify_emails(js->gc, count, FALSE, NULL, NULL, NULL, NULL, NULL, NULL); - } - - return; - } - - /* Loop once to see how many messages were returned so we can allocate arrays - * accordingly */ - for (returned_count = 0; message; returned_count++, message=xmlnode_get_next_twin(message)); - - froms = g_new0(const char* , returned_count + 1); - tos = g_new0(const char* , returned_count + 1); - subjects = g_new0(char* , returned_count + 1); - urls = g_new0(const char* , returned_count + 1); - - to = xmlnode_get_attrib(packet, "to"); - to_name = jabber_get_bare_jid(to); - url = xmlnode_get_attrib(child, "url"); - if (!url || !*url) - url = "http://www.gmail.com"; - - message= xmlnode_get_child(child, "mail-thread-info"); - for (i=0; message; message = xmlnode_get_next_twin(message), i++) { - xmlnode *sender_node, *subject_node; - const char *from, *tid; - char *subject; - - subject_node = xmlnode_get_child(message, "subject"); - sender_node = xmlnode_get_child(message, "senders"); - sender_node = xmlnode_get_child(sender_node, "sender"); - - while (sender_node && (!xmlnode_get_attrib(sender_node, "unread") || - !strcmp(xmlnode_get_attrib(sender_node, "unread"),"0"))) - sender_node = xmlnode_get_next_twin(sender_node); - - if (!sender_node) { - i--; - continue; - } - - from = xmlnode_get_attrib(sender_node, "name"); - if (!from || !*from) - from = xmlnode_get_attrib(sender_node, "address"); - subject = xmlnode_get_data(subject_node); - /* - * url = xmlnode_get_attrib(message, "url"); - */ - tos[i] = (to_name != NULL ? to_name : ""); - froms[i] = (from != NULL ? from : ""); - subjects[i] = (subject != NULL ? subject : g_strdup("")); - urls[i] = url; - - tid = xmlnode_get_attrib(message, "tid"); - if (tid && - (js->gmail_last_tid == NULL || strcmp(tid, js->gmail_last_tid) > 0)) { - g_free(js->gmail_last_tid); - js->gmail_last_tid = g_strdup(tid); - } - } - - if (i>0) - purple_notify_emails(js->gc, count, count == i, (const char**) subjects, froms, tos, - urls, NULL, NULL); - - g_free(to_name); - g_free(tos); - g_free(froms); - for (i = 0; i < returned_count; i++) - g_free(subjects[i]); - g_free(subjects); - g_free(urls); - - in_str = xmlnode_get_attrib(child, "result-time"); - if (in_str && *in_str) { - g_free(js->gmail_last_time); - js->gmail_last_time = g_strdup(in_str); - } -} - -void -jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *new_mail) -{ - xmlnode *query; - JabberIq *iq; - - /* bail if the user isn't interested */ - if (!purple_account_get_check_mail(js->gc->account)) - return; - - /* Is this an initial incoming mail notification? If so, send a request for more info */ - if (type != JABBER_IQ_SET) - return; - - /* Acknowledge the notification */ - iq = jabber_iq_new(js, JABBER_IQ_RESULT); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_set_attrib(iq->node, "id", id); - jabber_iq_send(iq); - - purple_debug_misc("jabber", - "Got new mail notification. Sending request for more info\n"); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); - jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - query = xmlnode_get_child(iq->node, "query"); - - if (js->gmail_last_time) - xmlnode_set_attrib(query, "newer-than-time", js->gmail_last_time); - if (js->gmail_last_tid) - xmlnode_set_attrib(query, "newer-than-tid", js->gmail_last_tid); - - jabber_iq_send(iq); - return; -} - -void jabber_gmail_init(JabberStream *js) { - JabberIq *iq; - xmlnode *usersetting, *mailnotifications; - - if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) - return; - - /* - * Quoting http://code.google.com/apis/talk/jep_extensions/usersettings.html: - * To ensure better compatibility with other clients, rather than - * setting this value to "false" to turn off notifications, it is - * recommended that a client set this to "true" and filter incoming - * email notifications itself. - */ - iq = jabber_iq_new(js, JABBER_IQ_SET); - usersetting = xmlnode_new_child(iq->node, "usersetting"); - xmlnode_set_namespace(usersetting, "google:setting"); - mailnotifications = xmlnode_new_child(usersetting, "mailnotifications"); - xmlnode_set_attrib(mailnotifications, "value", "true"); - jabber_iq_send(iq); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); - jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - jabber_iq_send(iq); -} - -void jabber_google_roster_init(JabberStream *js) -{ - JabberIq *iq; - xmlnode *query; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster"); - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_set_attrib(query, "xmlns:gr", "google:roster"); - xmlnode_set_attrib(query, "gr:ext", "2"); - - jabber_iq_send(iq); -} - -void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - GSList *list = account->deny; - const char *jid = xmlnode_get_attrib(item, "jid"); - char *jid_norm = (char *)jabber_normalize(account, jid); - - while (list) { - if (!strcmp(jid_norm, (char*)list->data)) { - xmlnode_set_attrib(query, "xmlns:gr", "google:roster"); - xmlnode_set_attrib(query, "gr:ext", "2"); - xmlnode_set_attrib(item, "gr:t", "B"); - return; - } - list = list->next; - } -} - -gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - const char *jid = xmlnode_get_attrib(item, "jid"); - gboolean on_block_list = FALSE; - - char *jid_norm; - - const char *grt = xmlnode_get_attrib_with_namespace(item, "t", "google:roster"); - const char *subscription = xmlnode_get_attrib(item, "subscription"); - const char *ask = xmlnode_get_attrib(item, "ask"); - - if ((!subscription || !strcmp(subscription, "none")) && !ask) { - /* The Google Talk servers will automatically add people from your Gmail address book - * with subscription=none. If we see someone with subscription=none, ignore them. - */ - return FALSE; - } - - jid_norm = g_strdup(jabber_normalize(account, jid)); - - on_block_list = NULL != g_slist_find_custom(account->deny, jid_norm, - (GCompareFunc)strcmp); - - if (grt && (*grt == 'H' || *grt == 'h')) { - /* Hidden; don't show this buddy. */ - GSList *buddies = purple_find_buddies(account, jid_norm); - if (buddies) - purple_debug_info("jabber", "Removing %s from local buddy list\n", - jid_norm); - - for ( ; buddies; buddies = g_slist_delete_link(buddies, buddies)) { - purple_blist_remove_buddy(buddies->data); - } - - g_free(jid_norm); - return FALSE; - } - - if (!on_block_list && (grt && (*grt == 'B' || *grt == 'b'))) { - purple_debug_info("jabber", "Blocking %s\n", jid_norm); - purple_privacy_deny_add(account, jid_norm, TRUE); - } else if (on_block_list && (!grt || (*grt != 'B' && *grt != 'b' ))){ - purple_debug_info("jabber", "Unblocking %s\n", jid_norm); - purple_privacy_deny_remove(account, jid_norm, TRUE); - } - - g_free(jid_norm); - return TRUE; -} - -void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - GSList *buddies; - JabberIq *iq; - xmlnode *query; - xmlnode *item; - xmlnode *group; - PurpleBuddy *b; - JabberBuddy *jb; - const char *balias; - - js = (JabberStream*)(gc->proto_data); - - if (!js || !(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) - return; - - jb = jabber_buddy_find(js, who, TRUE); - - buddies = purple_find_buddies(js->gc->account, who); - if(!buddies) - return; - - b = buddies->data; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - - while(buddies) { - PurpleGroup *g; - - b = buddies->data; - g = purple_buddy_get_group(b); - - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, purple_group_get_name(g), -1); - - buddies = buddies->next; - } - - balias = purple_buddy_get_local_buddy_alias(b); - xmlnode_set_attrib(item, "jid", who); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - xmlnode_set_attrib(item, "gr:t", "B"); - xmlnode_set_attrib(query, "xmlns:gr", "google:roster"); - xmlnode_set_attrib(query, "gr:ext", "2"); - - jabber_iq_send(iq); - - /* Synthesize a sign-off */ - if (jb) { - JabberBuddyResource *jbr; - GList *l = jb->resources; - while (l) { - jbr = l->data; - if (jbr && jbr->name) - { - purple_debug_misc("jabber", "Removing resource %s\n", jbr->name); - jabber_buddy_remove_resource(jb, jbr->name); - } - l = l->next; - } - } - - purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); -} - -void jabber_google_roster_rem_deny(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - GSList *buddies; - JabberIq *iq; - xmlnode *query; - xmlnode *item; - xmlnode *group; - PurpleBuddy *b; - const char *balias; - - g_return_if_fail(gc != NULL); - g_return_if_fail(who != NULL); - - js = (JabberStream*)(gc->proto_data); - - if (!js || !(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) - return; - - buddies = purple_find_buddies(purple_connection_get_account(js->gc), who); - if(!buddies) - return; - - b = buddies->data; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - - while(buddies) { - PurpleGroup *g; - - b = buddies->data; - g = purple_buddy_get_group(b); - - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, purple_group_get_name(g), -1); - - buddies = buddies->next; - } - - balias = purple_buddy_get_local_buddy_alias(b); - xmlnode_set_attrib(item, "jid", who); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - xmlnode_set_attrib(query, "xmlns:gr", "google:roster"); - xmlnode_set_attrib(query, "gr:ext", "2"); - - jabber_iq_send(iq); - - /* See if he's online */ - jabber_presence_subscription_set(js, who, "probe"); -} - -/* This does two passes on the string. The first pass goes through - * and determine if all the structured text is properly balanced, and - * how many instances of each there is. The second pass goes and converts - * everything to HTML, depending on what's figured out by the first pass. - * It will short circuit once it knows it has no more replacements to make - */ -char *jabber_google_format_to_html(const char *text) -{ - const char *p; - - /* The start of the screen may be consdiered a space for this purpose */ - gboolean preceding_space = TRUE; - - gboolean in_bold = FALSE, in_italic = FALSE; - gboolean in_tag = FALSE; - - gint bold_count = 0, italic_count = 0; - - GString *str; - - for (p = text; *p != '\0'; p = g_utf8_next_char(p)) { - gunichar c = g_utf8_get_char(p); - if (c == '*' && !in_tag) { - if (in_bold && (g_unichar_isspace(*(p+1)) || - *(p+1) == '\0' || - *(p+1) == '<')) { - bold_count++; - in_bold = FALSE; - } else if (preceding_space && !in_bold && !g_unichar_isspace(*(p+1))) { - bold_count++; - in_bold = TRUE; - } - preceding_space = TRUE; - } else if (c == '_' && !in_tag) { - if (in_italic && (g_unichar_isspace(*(p+1)) || - *(p+1) == '\0' || - *(p+1) == '<')) { - italic_count++; - in_italic = FALSE; - } else if (preceding_space && !in_italic && !g_unichar_isspace(*(p+1))) { - italic_count++; - in_italic = TRUE; - } - preceding_space = TRUE; - } else if (c == '<' && !in_tag) { - in_tag = TRUE; - } else if (c == '>' && in_tag) { - in_tag = FALSE; - } else if (!in_tag) { - if (g_unichar_isspace(c)) - preceding_space = TRUE; - else - preceding_space = FALSE; - } - } - - str = g_string_new(NULL); - in_bold = in_italic = in_tag = FALSE; - preceding_space = TRUE; - - for (p = text; *p != '\0'; p = g_utf8_next_char(p)) { - gunichar c = g_utf8_get_char(p); - - if (bold_count < 2 && italic_count < 2 && !in_bold && !in_italic) { - g_string_append(str, p); - return g_string_free(str, FALSE); - } - - - if (c == '*' && !in_tag) { - if (in_bold && - (g_unichar_isspace(*(p+1))||*(p+1)=='<')) { /* This is safe in UTF-8 */ - str = g_string_append(str, "</b>"); - in_bold = FALSE; - bold_count--; - } else if (preceding_space && bold_count > 1 && !g_unichar_isspace(*(p+1))) { - str = g_string_append(str, "<b>"); - bold_count--; - in_bold = TRUE; - } else { - str = g_string_append_unichar(str, c); - } - preceding_space = TRUE; - } else if (c == '_' && !in_tag) { - if (in_italic && - (g_unichar_isspace(*(p+1))||*(p+1)=='<')) { - str = g_string_append(str, "</i>"); - italic_count--; - in_italic = FALSE; - } else if (preceding_space && italic_count > 1 && !g_unichar_isspace(*(p+1))) { - str = g_string_append(str, "<i>"); - italic_count--; - in_italic = TRUE; - } else { - str = g_string_append_unichar(str, c); - } - preceding_space = TRUE; - } else if (c == '<' && !in_tag) { - str = g_string_append_unichar(str, c); - in_tag = TRUE; - } else if (c == '>' && in_tag) { - str = g_string_append_unichar(str, c); - in_tag = FALSE; - } else if (!in_tag) { - str = g_string_append_unichar(str, c); - if (g_unichar_isspace(c)) - preceding_space = TRUE; - else - preceding_space = FALSE; - } else { - str = g_string_append_unichar(str, c); - } - } - return g_string_free(str, FALSE); -} - -void jabber_google_presence_incoming(JabberStream *js, const char *user, JabberBuddyResource *jbr) -{ - if (!js->googletalk) - return; - if (jbr->status && purple_str_has_prefix(jbr->status, "♫ ")) { - purple_prpl_got_user_status(js->gc->account, user, "tune", - PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL); - g_free(jbr->status); - jbr->status = NULL; - } else { - purple_prpl_got_user_status_deactive(js->gc->account, user, "tune"); - } -} - -char *jabber_google_presence_outgoing(PurpleStatus *tune) -{ - const char *attr = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - return attr ? g_strdup_printf("♫ %s", attr) : g_strdup(""); -} - -static void -jabber_google_stun_lookup_cb(GSList *hosts, gpointer data, - const char *error_message) -{ - JabberStream *js = (JabberStream *) data; - - if (error_message) { - purple_debug_error("jabber", "Google STUN lookup failed: %s\n", - error_message); - g_slist_free(hosts); - js->stun_query = NULL; - return; - } - - if (hosts && g_slist_next(hosts)) { - struct sockaddr *addr = g_slist_next(hosts)->data; - char dst[INET6_ADDRSTRLEN]; - int port; - - if (addr->sa_family == AF_INET6) { - inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); - } else { - inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in *) addr)->sin_port); - } - - if (js->stun_ip) - g_free(js->stun_ip); - js->stun_ip = g_strdup(dst); - js->stun_port = port; - - purple_debug_info("jabber", "set Google STUN IP/port address: " - "%s:%d\n", dst, port); - - /* unmark ongoing query */ - js->stun_query = NULL; - } - - while (hosts != NULL) { - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } -} - -static void -jabber_google_jingle_info_common(JabberStream *js, const char *from, - JabberIqType type, xmlnode *query) -{ - const xmlnode *stun = xmlnode_get_child(query, "stun"); - gchar *my_bare_jid; - - /* - * Make sure that random people aren't sending us STUN servers. Per - * http://code.google.com/apis/talk/jep_extensions/jingleinfo.html, these - * stanzas are stamped from our bare JID. - */ - if (from) { - my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - if (!purple_strequal(from, my_bare_jid)) { - purple_debug_warning("jabber", "got google:jingleinfo with invalid from (%s)\n", - from); - g_free(my_bare_jid); - return; - } - - g_free(my_bare_jid); - } - - if (type == JABBER_IQ_ERROR || type == JABBER_IQ_GET) - return; - - purple_debug_info("jabber", "got google:jingleinfo\n"); - - if (stun) { - xmlnode *server = xmlnode_get_child(stun, "server"); - - if (server) { - const gchar *host = xmlnode_get_attrib(server, "host"); - const gchar *udp = xmlnode_get_attrib(server, "udp"); - - if (host && udp) { - int port = atoi(udp); - /* if there, would already be an ongoing query, - cancel it */ - if (js->stun_query) - purple_dnsquery_destroy(js->stun_query); - - js->stun_query = purple_dnsquery_a(host, port, - jabber_google_stun_lookup_cb, js); - } - } - } - /* should perhaps handle relays later on, or maybe wait until - Google supports a common standard... */ -} - -static void -jabber_google_jingle_info_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_GOOGLE_JINGLE_INFO); - - if (query) - jabber_google_jingle_info_common(js, from, type, query); - else - purple_debug_warning("jabber", "Got invalid google:jingleinfo\n"); -} - -void -jabber_google_handle_jingle_info(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child) -{ - jabber_google_jingle_info_common(js, from, type, child); -} - -void -jabber_google_send_jingle_info(JabberStream *js) -{ - JabberIq *jingle_info = - jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_JINGLE_INFO); - - jabber_iq_set_callback(jingle_info, jabber_google_jingle_info_cb, - NULL); - purple_debug_info("jabber", "sending google:jingleinfo query\n"); - jabber_iq_send(jingle_info); -} - -void google_buddy_node_chat(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - JabberChat *chat; - gchar *room; - guint32 tmp, a, b; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = PURPLE_BUDDY(node); - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - g_return_if_fail(gc != NULL); - js = purple_connection_get_protocol_data(gc); - - /* Generate a version 4 UUID */ - tmp = g_random_int(); - a = 0x4000 | (tmp & 0xFFF); /* 0x4000 to 0x4FFF */ - tmp >>= 12; - b = ((1 << 3) << 12) | (tmp & 0x3FFF); /* 0x8000 to 0xBFFF */ - - tmp = g_random_int(); - room = g_strdup_printf("private-chat-%08x-%04x-%04x-%04x-%04x%08x", - g_random_int(), - tmp & 0xFFFF, - a, - b, - (tmp >> 16) & 0xFFFF, g_random_int()); - - chat = jabber_join_chat(js, room, GOOGLE_GROUPCHAT_SERVER, js->user->node, - NULL, NULL); - if (chat) { - chat->muc = TRUE; - jabber_chat_invite(gc, chat->id, "", buddy->name); - } - - g_free(room); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/google.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/** - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_GOOGLE_H_ -#define PURPLE_JABBER_GOOGLE_H_ - -/* This is a place for Google Talk-specific XMPP extensions to live - * such that they don't intermingle with code for the XMPP RFCs and XEPs :) */ - -#include "jabber.h" - -#define GOOGLE_GROUPCHAT_SERVER "groupchat.google.com" - -void jabber_gmail_init(JabberStream *js); -void jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *new_mail); - -void jabber_google_roster_init(JabberStream *js); -void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item); - -/* Returns FALSE if this should short-circuit processing of this roster item, or TRUE - * if this roster item should continue to be processed - */ -gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item); - -void jabber_google_presence_incoming(JabberStream *js, const char *who, JabberBuddyResource *jbr); -char *jabber_google_presence_outgoing(PurpleStatus *tune); - -void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who); -void jabber_google_roster_rem_deny(PurpleConnection *gc, const char *who); - -char *jabber_google_format_to_html(const char *text); - -gboolean jabber_google_session_initiate(JabberStream *js, const gchar *who, PurpleMediaSessionType type); -void jabber_google_session_parse(JabberStream *js, const char *from, JabberIqType type, const char *iq, xmlnode *session); - -void jabber_google_handle_jingle_info(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child); -void jabber_google_send_jingle_info(JabberStream *js); - -void google_buddy_node_chat(PurpleBlistNode *node, gpointer data); - -#endif /* PURPLE_JABBER_GOOGLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,524 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "ibb.h" -#include "debug.h" -#include "xmlnode.h" - -#define JABBER_IBB_SESSION_DEFAULT_BLOCK_SIZE 4096 - -static GHashTable *jabber_ibb_sessions = NULL; -static GList *open_handlers = NULL; - -JabberIBBSession * -jabber_ibb_session_create(JabberStream *js, const gchar *sid, const gchar *who, - gpointer user_data) -{ - JabberIBBSession *sess = g_new0(JabberIBBSession, 1); - sess->js = js; - if (sid) { - sess->sid = g_strdup(sid); - } else { - sess->sid = jabber_get_next_id(js); - } - sess->who = g_strdup(who); - sess->block_size = JABBER_IBB_SESSION_DEFAULT_BLOCK_SIZE; - sess->state = JABBER_IBB_SESSION_NOT_OPENED; - sess->user_data = user_data; - - g_hash_table_insert(jabber_ibb_sessions, sess->sid, sess); - - return sess; -} - -JabberIBBSession * -jabber_ibb_session_create_from_xmlnode(JabberStream *js, const char *from, - const char *id, xmlnode *open, gpointer user_data) -{ - JabberIBBSession *sess = NULL; - const gchar *sid = xmlnode_get_attrib(open, "sid"); - const gchar *block_size = xmlnode_get_attrib(open, "block-size"); - - if (!open) { - return NULL; - } - - if (!sid || !block_size) { - purple_debug_error("jabber", - "IBB session open tag requires sid and block-size attributes\n"); - g_free(sess); - return NULL; - } - - sess = jabber_ibb_session_create(js, sid, from, user_data); - sess->id = g_strdup(id); - sess->block_size = atoi(block_size); - /* if we create a session from an incoming <open/> request, it means the - session is immediatly open... */ - sess->state = JABBER_IBB_SESSION_OPENED; - - return sess; -} - -void -jabber_ibb_session_destroy(JabberIBBSession *sess) -{ - purple_debug_info("jabber", "IBB: destroying session %p %s\n", sess, - sess->sid); - - if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_OPENED) { - jabber_ibb_session_close(sess); - } - - if (sess->last_iq_id) { - purple_debug_info("jabber", "IBB: removing callback for <iq/> %s\n", - sess->last_iq_id); - jabber_iq_remove_callback_by_id(jabber_ibb_session_get_js(sess), - sess->last_iq_id); - g_free(sess->last_iq_id); - sess->last_iq_id = NULL; - } - - g_hash_table_remove(jabber_ibb_sessions, sess->sid); - g_free(sess->id); - g_free(sess->sid); - g_free(sess->who); - g_free(sess); -} - -const gchar * -jabber_ibb_session_get_sid(const JabberIBBSession *sess) -{ - return sess->sid; -} - -JabberStream * -jabber_ibb_session_get_js(JabberIBBSession *sess) -{ - return sess->js; -} - -const gchar * -jabber_ibb_session_get_who(const JabberIBBSession *sess) -{ - return sess->who; -} - -guint16 -jabber_ibb_session_get_send_seq(const JabberIBBSession *sess) -{ - return sess->send_seq; -} - -guint16 -jabber_ibb_session_get_recv_seq(const JabberIBBSession *sess) -{ - return sess->recv_seq; -} - -JabberIBBSessionState -jabber_ibb_session_get_state(const JabberIBBSession *sess) -{ - return sess->state; -} - -gsize -jabber_ibb_session_get_block_size(const JabberIBBSession *sess) -{ - return sess->block_size; -} - -void -jabber_ibb_session_set_block_size(JabberIBBSession *sess, gsize size) -{ - if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_NOT_OPENED) { - sess->block_size = size; - } else { - purple_debug_error("jabber", - "Can't set block size on an open IBB session\n"); - } -} - -gpointer -jabber_ibb_session_get_user_data(JabberIBBSession *sess) -{ - return sess->user_data; -} - -void -jabber_ibb_session_set_opened_callback(JabberIBBSession *sess, - JabberIBBOpenedCallback *cb) -{ - sess->opened_cb = cb; -} - -void -jabber_ibb_session_set_data_sent_callback(JabberIBBSession *sess, - JabberIBBSentCallback *cb) -{ - sess->data_sent_cb = cb; -} - -void -jabber_ibb_session_set_closed_callback(JabberIBBSession *sess, - JabberIBBClosedCallback *cb) -{ - sess->closed_cb = cb; -} - -void -jabber_ibb_session_set_data_received_callback(JabberIBBSession *sess, - JabberIBBDataCallback *cb) -{ - sess->data_received_cb = cb; -} - -void -jabber_ibb_session_set_error_callback(JabberIBBSession *sess, - JabberIBBErrorCallback *cb) -{ - sess->error_cb = cb; -} - -static void -jabber_ibb_session_opened_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberIBBSession *sess = (JabberIBBSession *) data; - - if (type == JABBER_IQ_ERROR) { - sess->state = JABBER_IBB_SESSION_ERROR; - } else { - sess->state = JABBER_IBB_SESSION_OPENED; - } - - if (sess->opened_cb) { - sess->opened_cb(sess); - } -} - -void -jabber_ibb_session_open(JabberIBBSession *sess) -{ - if (jabber_ibb_session_get_state(sess) != JABBER_IBB_SESSION_NOT_OPENED) { - purple_debug_error("jabber", - "jabber_ibb_session called on an already open stream\n"); - } else { - JabberIq *set = jabber_iq_new(sess->js, JABBER_IQ_SET); - xmlnode *open = xmlnode_new("open"); - gchar block_size[10]; - - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(open, NS_IBB); - xmlnode_set_attrib(open, "sid", jabber_ibb_session_get_sid(sess)); - g_snprintf(block_size, sizeof(block_size), "%" G_GSIZE_FORMAT, - jabber_ibb_session_get_block_size(sess)); - xmlnode_set_attrib(open, "block-size", block_size); - xmlnode_insert_child(set->node, open); - - jabber_iq_set_callback(set, jabber_ibb_session_opened_cb, sess); - - jabber_iq_send(set); - } -} - -void -jabber_ibb_session_close(JabberIBBSession *sess) -{ - JabberIBBSessionState state = jabber_ibb_session_get_state(sess); - - if (state != JABBER_IBB_SESSION_OPENED && state != JABBER_IBB_SESSION_ERROR) { - purple_debug_error("jabber", - "jabber_ibb_session_close called on a session that has not been" - "opened\n"); - } else { - JabberIq *set = jabber_iq_new(jabber_ibb_session_get_js(sess), - JABBER_IQ_SET); - xmlnode *close = xmlnode_new("close"); - - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(close, NS_IBB); - xmlnode_set_attrib(close, "sid", jabber_ibb_session_get_sid(sess)); - xmlnode_insert_child(set->node, close); - jabber_iq_send(set); - sess->state = JABBER_IBB_SESSION_CLOSED; - } -} - -void -jabber_ibb_session_accept(JabberIBBSession *sess) -{ - JabberIq *result = jabber_iq_new(jabber_ibb_session_get_js(sess), - JABBER_IQ_RESULT); - - xmlnode_set_attrib(result->node, "to", jabber_ibb_session_get_who(sess)); - jabber_iq_set_id(result, sess->id); - jabber_iq_send(result); - sess->state = JABBER_IBB_SESSION_OPENED; -} - -static void -jabber_ibb_session_send_acknowledge_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberIBBSession *sess = (JabberIBBSession *) data; - - if (sess) { - /* reset callback */ - if (sess->last_iq_id) { - g_free(sess->last_iq_id); - sess->last_iq_id = NULL; - } - - if (type == JABBER_IQ_ERROR) { - jabber_ibb_session_close(sess); - sess->state = JABBER_IBB_SESSION_ERROR; - - if (sess->error_cb) { - sess->error_cb(sess); - } - } else { - if (sess->data_sent_cb) { - sess->data_sent_cb(sess); - } - } - } else { - /* the session has gone away, it was probably cancelled */ - purple_debug_info("jabber", - "got response from send data, but IBB session is no longer active\n"); - } -} - -void -jabber_ibb_session_send_data(JabberIBBSession *sess, gconstpointer data, - gsize size) -{ - JabberIBBSessionState state = jabber_ibb_session_get_state(sess); - - purple_debug_info("jabber", "sending data block of %" G_GSIZE_FORMAT " bytes on IBB stream\n", - size); - - if (state != JABBER_IBB_SESSION_OPENED) { - purple_debug_error("jabber", - "trying to send data on a non-open IBB session\n"); - } else if (size > jabber_ibb_session_get_block_size(sess)) { - purple_debug_error("jabber", - "trying to send a too large packet in the IBB session\n"); - } else { - JabberIq *set = jabber_iq_new(jabber_ibb_session_get_js(sess), - JABBER_IQ_SET); - xmlnode *data_element = xmlnode_new("data"); - char *base64 = purple_base64_encode(data, size); - char seq[10]; - g_snprintf(seq, sizeof(seq), "%u", jabber_ibb_session_get_send_seq(sess)); - - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(data_element, NS_IBB); - xmlnode_set_attrib(data_element, "sid", jabber_ibb_session_get_sid(sess)); - xmlnode_set_attrib(data_element, "seq", seq); - xmlnode_insert_data(data_element, base64, -1); - - xmlnode_insert_child(set->node, data_element); - - purple_debug_info("jabber", - "IBB: setting send <iq/> callback for session %p %s\n", sess, - sess->sid); - jabber_iq_set_callback(set, jabber_ibb_session_send_acknowledge_cb, sess); - sess->last_iq_id = g_strdup(xmlnode_get_attrib(set->node, "id")); - purple_debug_info("jabber", "IBB: set sess->last_iq_id: %s\n", - sess->last_iq_id); - jabber_iq_send(set); - - g_free(base64); - (sess->send_seq)++; - } -} - -static void -jabber_ibb_send_error_response(JabberStream *js, const char *to, const char *id) -{ - JabberIq *result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode *error = xmlnode_new("error"); - xmlnode *item_not_found = xmlnode_new("item-not-found"); - - xmlnode_set_namespace(item_not_found, NS_XMPP_STANZAS); - xmlnode_set_attrib(error, "code", "440"); - xmlnode_set_attrib(error, "type", "cancel"); - jabber_iq_set_id(result, id); - xmlnode_set_attrib(result->node, "to", to); - xmlnode_insert_child(error, item_not_found); - xmlnode_insert_child(result->node, error); - - jabber_iq_send(result); -} - -void -jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *child) -{ - const char *name = child->name; - gboolean data = g_str_equal(name, "data"); - gboolean close = g_str_equal(name, "close"); - gboolean open = g_str_equal(name, "open"); - const gchar *sid = (data || close) ? - xmlnode_get_attrib(child, "sid") : NULL; - JabberIBBSession *sess = - sid ? g_hash_table_lookup(jabber_ibb_sessions, sid) : NULL; - - if (sess) { - - if (strcmp(who, jabber_ibb_session_get_who(sess)) != 0) { - /* the iq comes from a different JID than the remote JID of the - session, ignore it */ - purple_debug_error("jabber", - "Got IBB iq from wrong JID, ignoring\n"); - } else if (data) { - const gchar *seq_attr = xmlnode_get_attrib(child, "seq"); - guint16 seq = (seq_attr ? atoi(seq_attr) : 0); - - /* reject the data, and set the session in error if we get an - out-of-order packet */ - if (seq_attr && seq == jabber_ibb_session_get_recv_seq(sess)) { - /* sequence # is the expected... */ - JabberIq *result = jabber_iq_new(js, JABBER_IQ_RESULT); - - jabber_iq_set_id(result, id); - xmlnode_set_attrib(result->node, "to", who); - - if (sess->data_received_cb) { - gchar *base64 = xmlnode_get_data(child); - gsize size; - gpointer rawdata = purple_base64_decode(base64, &size); - - g_free(base64); - - if (rawdata) { - purple_debug_info("jabber", - "got %" G_GSIZE_FORMAT " bytes of data on IBB stream\n", - size); - if (size > jabber_ibb_session_get_block_size(sess)) { - purple_debug_error("jabber", - "IBB: received a too large packet\n"); - if (sess->error_cb) - sess->error_cb(sess); - g_free(rawdata); - return; - } else { - purple_debug_info("jabber", - "calling IBB callback for received data\n"); - sess->data_received_cb(sess, rawdata, size); - } - g_free(rawdata); - } else { - purple_debug_error("jabber", - "IBB: invalid BASE64 data received\n"); - if (sess->error_cb) - sess->error_cb(sess); - return; - - } - } - - (sess->recv_seq)++; - jabber_iq_send(result); - - } else { - purple_debug_error("jabber", - "Received an out-of-order/invalid IBB packet\n"); - sess->state = JABBER_IBB_SESSION_ERROR; - - if (sess->error_cb) { - sess->error_cb(sess); - } - } - } else if (close) { - sess->state = JABBER_IBB_SESSION_CLOSED; - purple_debug_info("jabber", "IBB: received close\n"); - - if (sess->closed_cb) { - purple_debug_info("jabber", "IBB: calling closed handler\n"); - sess->closed_cb(sess); - } - - } else { - /* this should never happen */ - purple_debug_error("jabber", "Received bogus iq for IBB session\n"); - } - } else if (open) { - JabberIq *result; - const GList *iterator; - - /* run all open handlers registered until one returns true */ - for (iterator = open_handlers ; iterator ; - iterator = g_list_next(iterator)) { - JabberIBBOpenHandler *handler = iterator->data; - - if (handler(js, who, id, child)) { - result = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "to", who); - jabber_iq_set_id(result, id); - jabber_iq_send(result); - return; - } - } - /* no open callback returned success, reject */ - jabber_ibb_send_error_response(js, who, id); - } else { - /* send error reply */ - jabber_ibb_send_error_response(js, who, id); - } -} - -void -jabber_ibb_register_open_handler(JabberIBBOpenHandler *cb) -{ - open_handlers = g_list_append(open_handlers, cb); -} - -void -jabber_ibb_unregister_open_handler(JabberIBBOpenHandler *cb) -{ - open_handlers = g_list_remove(open_handlers, cb); -} - -void -jabber_ibb_init(void) -{ - jabber_ibb_sessions = g_hash_table_new(g_str_hash, g_str_equal); - - jabber_add_feature(NS_IBB, NULL); - - jabber_iq_register_handler("close", NS_IBB, jabber_ibb_parse); - jabber_iq_register_handler("data", NS_IBB, jabber_ibb_parse); - jabber_iq_register_handler("open", NS_IBB, jabber_ibb_parse); -} - -void -jabber_ibb_uninit(void) -{ - g_hash_table_destroy(jabber_ibb_sessions); - g_list_free(open_handlers); - jabber_ibb_sessions = NULL; - open_handlers = NULL; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ibb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_IBB_H_ -#define PURPLE_JABBER_IBB_H_ - -#include "jabber.h" -#include "iq.h" - -typedef struct _JabberIBBSession JabberIBBSession; - -typedef void -(JabberIBBDataCallback)(JabberIBBSession *, const gpointer data, gsize size); - -typedef void (JabberIBBOpenedCallback)(JabberIBBSession *); -typedef void (JabberIBBClosedCallback)(JabberIBBSession *); -typedef void (JabberIBBErrorCallback)(JabberIBBSession *); -typedef void (JabberIBBSentCallback)(JabberIBBSession *); - -typedef gboolean (JabberIBBOpenHandler)(JabberStream *js, const char *from, - const char *id, xmlnode *open); - -typedef enum { - JABBER_IBB_SESSION_NOT_OPENED, - JABBER_IBB_SESSION_OPENED, - JABBER_IBB_SESSION_CLOSED, - JABBER_IBB_SESSION_ERROR -} JabberIBBSessionState; - -struct _JabberIBBSession { - JabberStream *js; - gchar *who; - gchar *sid; - gchar *id; - guint16 send_seq; - guint16 recv_seq; - gsize block_size; - - /* session state */ - JabberIBBSessionState state; - - /* user data (f.ex. a handle to a PurpleXfer) */ - gpointer user_data; - - /* callbacks */ - JabberIBBOpenedCallback *opened_cb; - JabberIBBSentCallback *data_sent_cb; - JabberIBBClosedCallback *closed_cb; - /* callback for receiving data */ - JabberIBBDataCallback *data_received_cb; - JabberIBBErrorCallback *error_cb; - - /* store the last sent IQ (to permit cancel of callback) */ - gchar *last_iq_id; -}; - -JabberIBBSession *jabber_ibb_session_create(JabberStream *js, const gchar *sid, - const gchar *who, gpointer user_data); -JabberIBBSession *jabber_ibb_session_create_from_xmlnode(JabberStream *js, - const gchar *from, const gchar *id, xmlnode *open, gpointer user_data); - -void jabber_ibb_session_destroy(JabberIBBSession *sess); - -void jabber_ibb_session_set_opened_callback(JabberIBBSession *sess, - JabberIBBOpenedCallback *cb); -void jabber_ibb_session_set_data_sent_callback(JabberIBBSession *sess, - JabberIBBSentCallback *cb); -void jabber_ibb_session_set_closed_callback(JabberIBBSession *sess, - JabberIBBClosedCallback *cb); -void jabber_ibb_session_set_data_received_callback(JabberIBBSession *sess, - JabberIBBDataCallback *cb); -void jabber_ibb_session_set_error_callback(JabberIBBSession *sess, - JabberIBBErrorCallback *cb); - -void jabber_ibb_session_open(JabberIBBSession *sess); -void jabber_ibb_session_close(JabberIBBSession *sess); -void jabber_ibb_session_accept(JabberIBBSession *sess); -void jabber_ibb_session_send_data(JabberIBBSession *sess, gconstpointer data, - gsize size); - -const gchar *jabber_ibb_session_get_sid(const JabberIBBSession *sess); -JabberStream *jabber_ibb_session_get_js(JabberIBBSession *sess); -const gchar *jabber_ibb_session_get_who(const JabberIBBSession *sess); - -guint16 jabber_ibb_session_get_send_seq(const JabberIBBSession *sess); -guint16 jabber_ibb_session_get_recv_seq(const JabberIBBSession *sess); - -JabberIBBSessionState jabber_ibb_session_get_state(const JabberIBBSession *sess); - -gsize jabber_ibb_session_get_block_size(const JabberIBBSession *sess); -void jabber_ibb_session_set_block_size(JabberIBBSession *sess, gsize size); - -gpointer jabber_ibb_session_get_user_data(JabberIBBSession *sess); - -/* handle incoming packet */ -void jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *child); - -/* add a handler for open session */ -void jabber_ibb_register_open_handler(JabberIBBOpenHandler *cb); -void jabber_ibb_unregister_open_handler(JabberIBBOpenHandler *cb); - -void jabber_ibb_init(void); -void jabber_ibb_uninit(void); - -#endif /* PURPLE_JABBER_IBB_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,495 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "core.h" -#include "debug.h" -#include "prefs.h" -#include "util.h" - -#include "buddy.h" -#include "disco.h" -#include "google.h" -#include "iq.h" -#include "jingle/jingle.h" -#include "oob.h" -#include "roster.h" -#include "si.h" -#include "ping.h" -#include "adhoccommands.h" -#include "data.h" -#include "ibb.h" - -#ifdef _WIN32 -#include "utsname.h" -#endif - -GHashTable *iq_handlers = NULL; -GHashTable *signal_iq_handlers = NULL; - -JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type) -{ - JabberIq *iq; - - iq = g_new0(JabberIq, 1); - - iq->type = type; - - iq->node = xmlnode_new("iq"); - switch(iq->type) { - case JABBER_IQ_SET: - xmlnode_set_attrib(iq->node, "type", "set"); - break; - case JABBER_IQ_GET: - xmlnode_set_attrib(iq->node, "type", "get"); - break; - case JABBER_IQ_ERROR: - xmlnode_set_attrib(iq->node, "type", "error"); - break; - case JABBER_IQ_RESULT: - xmlnode_set_attrib(iq->node, "type", "result"); - break; - case JABBER_IQ_NONE: - /* this shouldn't ever happen */ - break; - } - - iq->js = js; - - if(type == JABBER_IQ_GET || type == JABBER_IQ_SET) { - iq->id = jabber_get_next_id(js); - xmlnode_set_attrib(iq->node, "id", iq->id); - } - - return iq; -} - -JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, - const char *xmlns) -{ - JabberIq *iq = jabber_iq_new(js, type); - xmlnode *query; - - query = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(query, xmlns); - - return iq; -} - -typedef struct _JabberCallbackData { - JabberIqCallback *callback; - gpointer data; -} JabberCallbackData; - -void -jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *callback, gpointer data) -{ - iq->callback = callback; - iq->callback_data = data; -} - -void jabber_iq_set_id(JabberIq *iq, const char *id) -{ - g_free(iq->id); - - if(id) { - xmlnode_set_attrib(iq->node, "id", id); - iq->id = g_strdup(id); - } else { - xmlnode_remove_attrib(iq->node, "id"); - iq->id = NULL; - } -} - -void jabber_iq_send(JabberIq *iq) -{ - JabberCallbackData *jcd; - g_return_if_fail(iq != NULL); - - jabber_send(iq->js, iq->node); - - if(iq->id && iq->callback) { - jcd = g_new0(JabberCallbackData, 1); - jcd->callback = iq->callback; - jcd->data = iq->callback_data; - g_hash_table_insert(iq->js->iq_callbacks, g_strdup(iq->id), jcd); - } - - jabber_iq_free(iq); -} - -void jabber_iq_free(JabberIq *iq) -{ - g_return_if_fail(iq != NULL); - - g_free(iq->id); - xmlnode_free(iq->node); - g_free(iq); -} - -static void jabber_iq_last_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet) -{ - JabberIq *iq; - xmlnode *query; - char *idle_time; - - if(type == JABBER_IQ_GET) { - iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY); - jabber_iq_set_id(iq, id); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - - query = xmlnode_get_child(iq->node, "query"); - - idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); - xmlnode_set_attrib(query, "seconds", idle_time); - g_free(idle_time); - - jabber_iq_send(iq); - } -} - -static void jabber_time_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child) -{ - JabberIq *iq; - time_t now_t; - struct tm *tm; - - time(&now_t); - - if(type == JABBER_IQ_GET) { - xmlnode *tzo, *utc; - const char *date, *tz; - - iq = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(iq, id); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - - child = xmlnode_new_child(iq->node, child->name); - xmlnode_set_namespace(child, NS_ENTITY_TIME); - - /* <tzo>-06:00</tzo> */ - tm = localtime(&now_t); - tz = purple_get_tzoff_str(tm, TRUE); - tzo = xmlnode_new_child(child, "tzo"); - xmlnode_insert_data(tzo, tz, -1); - - /* <utc>2006-12-19T17:58:35Z</utc> */ - tm = gmtime(&now_t); - date = purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm); - utc = xmlnode_new_child(child, "utc"); - xmlnode_insert_data(utc, date, -1); - - jabber_iq_send(iq); - } else { - /* TODO: Errors */ - } -} - -static void jabber_iq_version_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet) -{ - JabberIq *iq; - xmlnode *query; - - if(type == JABBER_IQ_GET) { - GHashTable *ui_info; - const char *ui_name = NULL, *ui_version = NULL; -#if 0 - char *os = NULL; - if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) { - struct utsname osinfo; - - uname(&osinfo); - os = g_strdup_printf("%s %s %s", osinfo.sysname, osinfo.release, - osinfo.machine); - } -#endif - - iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:version"); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - jabber_iq_set_id(iq, id); - - query = xmlnode_get_child(iq->node, "query"); - - ui_info = purple_core_get_ui_info(); - - if(NULL != ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_version = g_hash_table_lookup(ui_info, "version"); - } - - if(NULL != ui_name && NULL != ui_version) { - char *version_complete = g_strdup_printf("%s (libpurple " VERSION ")", ui_version); - xmlnode_insert_data(xmlnode_new_child(query, "name"), ui_name, -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), version_complete, -1); - g_free(version_complete); - } else { - xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); - } - -#if 0 - if(os) { - xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); - g_free(os); - } -#endif - - jabber_iq_send(iq); - } -} - -void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id) -{ - g_hash_table_remove(js->iq_callbacks, id); -} - -void jabber_iq_parse(JabberStream *js, xmlnode *packet) -{ - JabberCallbackData *jcd; - xmlnode *child, *error, *x; - const char *xmlns; - const char *iq_type, *id, *from; - JabberIqType type = JABBER_IQ_NONE; - gboolean signal_return; - - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - iq_type = xmlnode_get_attrib(packet, "type"); - - /* - * child will be either the first tag child or NULL if there is no child. - * Historically, we used just the 'query' subchild, but newer XEPs use - * differently named children. Grabbing the first child is (for the time - * being) sufficient. - */ - for (child = packet->child; child; child = child->next) { - if (child->type == XMLNODE_TYPE_TAG) - break; - } - - if (iq_type) { - if (!strcmp(iq_type, "get")) - type = JABBER_IQ_GET; - else if (!strcmp(iq_type, "set")) - type = JABBER_IQ_SET; - else if (!strcmp(iq_type, "result")) - type = JABBER_IQ_RESULT; - else if (!strcmp(iq_type, "error")) - type = JABBER_IQ_ERROR; - } - - if (type == JABBER_IQ_NONE) { - purple_debug_error("jabber", "IQ with invalid type ('%s') - ignoring.\n", - iq_type ? iq_type : "(null)"); - return; - } - - /* All IQs must have an ID, so send an error for a set/get that doesn't */ - if(!id || !*id) { - - if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - - xmlnode_free(iq->node); - iq->node = xmlnode_copy(packet); - if (from) { - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_remove_attrib(iq->node, "from"); - } - - xmlnode_set_attrib(iq->node, "type", "error"); - /* This id is clearly not useful, but we must put something there for a valid stanza */ - iq->id = jabber_get_next_id(js); - xmlnode_set_attrib(iq->node, "id", iq->id); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - x = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(iq); - } else - purple_debug_error("jabber", "IQ of type '%s' missing id - ignoring.\n", - iq_type); - - return; - } - - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), - "jabber-receiving-iq", js->gc, iq_type, id, from, packet)); - if (signal_return) - return; - - /* First, lets see if a special callback got registered */ - if(type == JABBER_IQ_RESULT || type == JABBER_IQ_ERROR) { - if((jcd = g_hash_table_lookup(js->iq_callbacks, id))) { - jcd->callback(js, from, type, id, packet, jcd->data); - jabber_iq_remove_callback_by_id(js, id); - return; - } - } - - /* - * Apparently not, so let's see if we have a pre-defined handler - * or if an outside plugin is interested. - */ - if(child && (xmlns = xmlnode_get_namespace(child))) { - char *key = g_strdup_printf("%s %s", child->name, xmlns); - JabberIqHandler *jih = g_hash_table_lookup(iq_handlers, key); - int signal_ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); - g_free(key); - - if (signal_ref > 0) { - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), "jabber-watched-iq", - js->gc, iq_type, id, from, child)); - if (signal_return) - return; - } - - if(jih) { - jih(js, from, type, id, child); - return; - } - } - - purple_debug_info("jabber", "jabber_iq_parse\n"); - - /* If we get here, send the default error reply mandated by XMPP-CORE */ - if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - - xmlnode_free(iq->node); - iq->node = xmlnode_copy(packet); - if (from) { - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_remove_attrib(iq->node, "from"); - } - - xmlnode_set_attrib(iq->node, "type", "error"); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - xmlnode_set_attrib(error, "code", "501"); - x = xmlnode_new_child(error, "feature-not-implemented"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(iq); - } -} - -void jabber_iq_register_handler(const char *node, const char *xmlns, JabberIqHandler *handlerfunc) -{ - /* - * This is valid because nodes nor namespaces cannot have spaces in them - * (see http://www.w3.org/TR/2006/REC-xml-20060816/ and - * http://www.w3.org/TR/REC-xml-names/) - */ - char *key = g_strdup_printf("%s %s", node, xmlns); - g_hash_table_replace(iq_handlers, key, handlerfunc); -} - -void jabber_iq_signal_register(const gchar *node, const gchar *xmlns) -{ - gchar *key; - int ref; - - g_return_if_fail(node != NULL && *node != '\0'); - g_return_if_fail(xmlns != NULL && *xmlns != '\0'); - - key = g_strdup_printf("%s %s", node, xmlns); - ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); - if (ref == 0) { - g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(1)); - } else { - g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref + 1)); - g_free(key); - } -} - -void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns) -{ - gchar *key; - int ref; - - g_return_if_fail(node != NULL && *node != '\0'); - g_return_if_fail(xmlns != NULL && *xmlns != '\0'); - - key = g_strdup_printf("%s %s", node, xmlns); - ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); - - if (ref == 1) { - g_hash_table_remove(signal_iq_handlers, key); - } else if (ref > 1) { - g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref - 1)); - } - - g_free(key); -} - -void jabber_iq_init(void) -{ - iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - jabber_iq_register_handler("jingle", JINGLE, jingle_parse); - jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, - jabber_gmail_poke); - jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, - jabber_gmail_poke); - jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse); - jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO, - jabber_google_handle_jingle_info); - jabber_iq_register_handler("query", NS_BYTESTREAMS, - jabber_bytestreams_parse); - jabber_iq_register_handler("query", NS_DISCO_INFO, jabber_disco_info_parse); - jabber_iq_register_handler("query", NS_DISCO_ITEMS, jabber_disco_items_parse); - jabber_iq_register_handler("query", NS_LAST_ACTIVITY, jabber_iq_last_parse); - jabber_iq_register_handler("query", NS_OOB_IQ_DATA, jabber_oob_parse); - jabber_iq_register_handler("query", "jabber:iq:register", - jabber_register_parse); - jabber_iq_register_handler("query", "jabber:iq:roster", - jabber_roster_parse); - jabber_iq_register_handler("query", "jabber:iq:version", - jabber_iq_version_parse); -#ifdef USE_VV - jabber_iq_register_handler("session", NS_GOOGLE_SESSION, - jabber_google_session_parse); -#endif - jabber_iq_register_handler("block", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); - jabber_iq_register_handler("unblock", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); - jabber_iq_register_handler("time", NS_ENTITY_TIME, jabber_time_parse); - -} - -void jabber_iq_uninit(void) -{ - g_hash_table_destroy(iq_handlers); - g_hash_table_destroy(signal_iq_handlers); - iq_handlers = signal_iq_handlers = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/iq.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -/** - * @file iq.h JabberID handlers - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_IQ_H_ -#define PURPLE_JABBER_IQ_H_ - -typedef enum { - JABBER_IQ_SET, - JABBER_IQ_GET, - JABBER_IQ_RESULT, - JABBER_IQ_ERROR, - JABBER_IQ_NONE -} JabberIqType; - -#include "jabber.h" -#include "connection.h" - -typedef struct _JabberIq JabberIq; - -/** - * A JabberIqHandler is called to process an incoming IQ stanza. - * Handlers typically process unsolicited incoming GETs or SETs for their - * registered namespace, but may be called to handle the results of a - * GET or SET that we generated if no JabberIqCallback was generated - * The handler may be called for the results of a GET or SET (RESULT or ERROR) - * that we generated - * if the generating function did not register a JabberIqCallback. - * - * @param js The JabberStream object. - * @param from The remote entity (the from attribute on the <iq/> stanza) - * @param type The IQ type. - * @param id The IQ id (the id attribute on the <iq/> stanza) - * @param child The child element of the <iq/> stanza that matches the name - * and namespace registered with jabber_iq_register_handler. - * - * @see jabber_iq_register_handler() - * @see JabberIqCallback - */ -typedef void (JabberIqHandler)(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child); - -/** - * A JabberIqCallback is called to process the results of a GET or SET that - * we send to a remote entity. The callback is matched based on the id - * of the incoming stanza (which matches the one on the initial stanza). - * - * @param js The JabberStream object. - * @param from The remote entity (the from attribute on the <iq/> stanza) - * @param type The IQ type. The only possible values are JABBER_IQ_RESULT - * and JABBER_IQ_ERROR. - * @param id The IQ id (the id attribute on the <iq/> stanza) - * @param packet The <iq/> stanza - * @param data The callback data passed to jabber_iq_set_callback() - * - * @see jabber_iq_set_callback() - */ -typedef void (JabberIqCallback)(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -struct _JabberIq { - JabberIqType type; - char *id; - xmlnode *node; - - JabberIqCallback *callback; - gpointer callback_data; - - JabberStream *js; -}; - -JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type); -JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, - const char *xmlns); - -void jabber_iq_parse(JabberStream *js, xmlnode *packet); - -void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id); -void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data); -void jabber_iq_set_id(JabberIq *iq, const char *id); - -void jabber_iq_send(JabberIq *iq); -void jabber_iq_free(JabberIq *iq); - -void jabber_iq_init(void); -void jabber_iq_uninit(void); - -void jabber_iq_register_handler(const char *node, const char *xmlns, - JabberIqHandler *func); - -/* Connected to namespace-handler registration signals */ -void jabber_iq_signal_register(const gchar *node, const gchar *xmlns); -void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns); - -#endif /* PURPLE_JABBER_IQ_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3558 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "core.h" -#include "cmds.h" -#include "connection.h" -#include "conversation.h" -#include "debug.h" -#include "dnssrv.h" -#include "imgstore.h" -#include "message.h" -#include "notify.h" -#include "pluginpref.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "server.h" -#include "status.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -#include "auth.h" -#include "buddy.h" -#include "caps.h" -#include "chat.h" -#include "data.h" -#include "disco.h" -#include "google.h" -#include "ibb.h" -#include "iq.h" -#include "jutil.h" -#include "message.h" -#include "parser.h" -#include "presence.h" -#include "jabber.h" -#include "roster.h" -#include "ping.h" -#include "si.h" -#include "xdata.h" -#include "pep.h" -#include "adhoccommands.h" - -#include "jingle/jingle.h" -#include "jingle/rtp.h" - -GList *jabber_features = NULL; -GList *jabber_identities = NULL; -static GSList *jabber_cmds = NULL; - -static void jabber_unregister_account_cb(JabberStream *js); -static void try_srv_connect(JabberStream *js); - -static void jabber_stream_init(JabberStream *js) -{ - char *open_stream; - - open_stream = g_strdup_printf("<stream:stream to='%s' " - "xmlns='" NS_XMPP_CLIENT "' " - "xmlns:stream='" NS_XMPP_STREAMS "' " - "version='1.0'>", - js->user->domain); - /* setup the parser fresh for each stream */ - jabber_parser_setup(js); - jabber_send_raw(js, open_stream, -1); - js->reinit = FALSE; - g_free(open_stream); -} - -static void -jabber_session_initialized_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) { - jabber_disco_items_server(js); - if(js->unregistration) - jabber_unregister_account_cb(js); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - ("Error initializing session")); - } -} - -static void jabber_session_init(JabberStream *js) -{ - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode *session; - - jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); - - session = xmlnode_new_child(iq->node, "session"); - xmlnode_set_namespace(session, NS_XMPP_SESSION); - - jabber_iq_send(iq); -} - -static void jabber_bind_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *bind; - - if (type == JABBER_IQ_RESULT && - (bind = xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) { - xmlnode *jid; - char *full_jid; - if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) { - jabber_id_free(js->user); - - js->user = jabber_id_new(full_jid); - if (js->user == NULL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - g_free(full_jid); - return; - } - - js->user_jb = jabber_buddy_find(js, full_jid, TRUE); - js->user_jb->subscription |= JABBER_SUB_BOTH; - - purple_connection_set_display_name(js->gc, full_jid); - - g_free(full_jid); - } - } else { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } - - jabber_session_init(js); -} - -static char *jabber_prep_resource(char *input) { - char hostname[256], /* current hostname */ - *dot = NULL; - - /* Empty resource == don't send any */ - if (input == NULL || *input == '\0') - return NULL; - - if (strstr(input, "__HOSTNAME__") == NULL) - return g_strdup(input); - - /* Replace __HOSTNAME__ with hostname */ - if (gethostname(hostname, sizeof(hostname) - 1)) { - purple_debug_warning("jabber", "gethostname: %s\n", g_strerror(errno)); - /* according to glibc doc, the only time an error is returned - is if the hostname is longer than the buffer, in which case - glibc 2.2+ would still fill the buffer with partial - hostname, so maybe we want to detect that and use it - instead - */ - strcpy(hostname, "localhost"); - } - hostname[sizeof(hostname) - 1] = '\0'; - - /* We want only the short hostname, not the FQDN - this will prevent the - * resource string from being unreasonably long on systems which stuff the - * whole FQDN in the hostname */ - if((dot = strchr(hostname, '.'))) - dot = '\0'; - - return purple_strreplace(input, "__HOSTNAME__", hostname); -} - -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) -{ - if(xmlnode_get_child(packet, "starttls")) { - if(jabber_process_starttls(js, packet)) { - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); - return; - } - } else if(purple_account_get_bool(js->gc->account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS) && !jabber_stream_is_ssl(js)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("You require encryption, but it is not available on this server.")); - return; - } - - if(js->registration) { - jabber_register_start(js); - } else if(xmlnode_get_child(packet, "mechanisms")) { - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - jabber_auth_start(js, packet); - } else if(xmlnode_get_child(packet, "bind")) { - xmlnode *bind, *resource; - char *requested_resource; - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - bind = xmlnode_new_child(iq->node, "bind"); - xmlnode_set_namespace(bind, NS_XMPP_BIND); - requested_resource = jabber_prep_resource(js->user->resource); - - if (requested_resource != NULL) { - resource = xmlnode_new_child(bind, "resource"); - xmlnode_insert_data(resource, requested_resource, -1); - g_free(requested_resource); - } - - jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); - - jabber_iq_send(iq); - } else /* if(xmlnode_get_child_with_namespace(packet, "auth")) */ { - /* If we get an empty stream:features packet, or we explicitly get - * an auth feature with namespace http://jabber.org/features/iq-auth - * we should revert back to iq:auth authentication, even though we're - * connecting to an XMPP server. */ - js->auth_type = JABBER_AUTH_IQ_AUTH; - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - } -} - -static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) -{ - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - - purple_connection_error_reason(js->gc, reason, msg); - - g_free(msg); -} - -static void tls_init(JabberStream *js); - -void jabber_process_packet(JabberStream *js, xmlnode **packet) -{ - const char *xmlns; - - purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-receiving-xmlnode", js->gc, packet); - - /* if the signal leaves us with a null packet, we're done */ - if(NULL == *packet) - return; - - xmlns = xmlnode_get_namespace(*packet); - - if(!strcmp((*packet)->name, "iq")) { - jabber_iq_parse(js, *packet); - } else if(!strcmp((*packet)->name, "presence")) { - jabber_presence_parse(js, *packet); - } else if(!strcmp((*packet)->name, "message")) { - jabber_message_parse(js, *packet); - } else if(!strcmp((*packet)->name, "stream:features")) { - jabber_stream_features_parse(js, *packet); - } else if (!strcmp((*packet)->name, "features") && xmlns && - !strcmp(xmlns, NS_XMPP_STREAMS)) { - jabber_stream_features_parse(js, *packet); - } else if(!strcmp((*packet)->name, "stream:error") || - (!strcmp((*packet)->name, "error") && xmlns && - !strcmp(xmlns, NS_XMPP_STREAMS))) - { - jabber_stream_handle_error(js, *packet); - } else if(!strcmp((*packet)->name, "challenge")) { - if(js->state == JABBER_STREAM_AUTHENTICATING) - jabber_auth_handle_challenge(js, *packet); - } else if(!strcmp((*packet)->name, "success")) { - if(js->state == JABBER_STREAM_AUTHENTICATING) - jabber_auth_handle_success(js, *packet); - } else if(!strcmp((*packet)->name, "failure")) { - if(js->state == JABBER_STREAM_AUTHENTICATING) - jabber_auth_handle_failure(js, *packet); - } else if(!strcmp((*packet)->name, "proceed")) { - if (js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION && !js->gsc) - tls_init(js); - else - purple_debug_warning("jabber", "Ignoring spurious <proceed/>\n"); - } else { - purple_debug_warning("jabber", "Unknown packet: %s\n", (*packet)->name); - } -} - -static int jabber_do_send(JabberStream *js, const char *data, int len) -{ - int ret; - - if (js->gsc) - ret = purple_ssl_write(js->gsc, data, len); - else - ret = write(js->fd, data, len); - - return ret; -} - -static void jabber_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - JabberStream *js = data; - int ret, writelen; - writelen = purple_circ_buffer_get_max_read(js->write_buffer); - - if (writelen == 0) { - purple_input_remove(js->writeh); - js->writeh = 0; - return; - } - - ret = jabber_do_send(js, js->write_buffer->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(js->write_buffer, ret); -} - -static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) -{ - int ret; - gboolean success = TRUE; - - if (len == -1) - len = strlen(data); - - if (js->writeh == 0) - ret = jabber_do_send(js, data, len); - else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno != EAGAIN) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - success = FALSE; - } else if (ret < len) { - if (ret < 0) - ret = 0; - if (js->writeh == 0) - js->writeh = purple_input_add( - js->gsc ? js->gsc->fd : js->fd, - PURPLE_INPUT_WRITE, jabber_send_cb, js); - purple_circ_buffer_append(js->write_buffer, - data + ret, len - ret); - } - - return success; -} - -void jabber_send_raw(JabberStream *js, const char *data, int len) -{ - /* because printing a tab to debug every minute gets old */ - if(strcmp(data, "\t")) { - const char *username; - char *text = NULL, *last_part = NULL, *tag_start = NULL; - - /* Because debug logs with plaintext passwords make me sad */ - if(js->state != JABBER_STREAM_CONNECTED && - /* Either <auth> or <query><password>... */ - (((tag_start = strstr(data, "<auth ")) && - strstr(data, "xmlns='" NS_XMPP_SASL "'")) || - ((tag_start = strstr(data, "<query ")) && - strstr(data, "xmlns='jabber:iq:auth'>") && - (tag_start = strstr(tag_start, "<password>"))))) { - char *data_start, *tag_end = strchr(tag_start, '>'); - text = g_strdup(data); - - /* Better to print out some wacky debugging than crash - * due to a plugin sending bad xml */ - if (tag_end == NULL) - tag_end = tag_start; - - data_start = text + (tag_end - data) + 1; - - last_part = strchr(data_start, '<'); - *data_start = '\0'; - } - - username = purple_connection_get_display_name(js->gc); - if (!username) - username = purple_account_get_username(purple_connection_get_account(js->gc)); - - purple_debug_misc("jabber", "Sending%s (%s): %s%s%s\n", - jabber_stream_is_ssl(js) ? " (ssl)" : "", username, - text ? text : data, - last_part ? "password removed" : "", - last_part ? last_part : ""); - - g_free(text); - } - - /* If we've got a security layer, we need to encode the data, - * splitting it on the maximum buffer length negotiated */ - - purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-sending-text", js->gc, &data); - if (data == NULL) - return; - -#ifdef HAVE_CYRUS_SASL - if (js->sasl_maxbuf>0) { - int pos = 0; - - if (!js->gsc && js->fd<0) - return; - - if (len == -1) - len = strlen(data); - - while (pos < len) { - int towrite; - const char *out; - unsigned olen; - - towrite = MIN((len - pos), js->sasl_maxbuf); - - sasl_encode(js->sasl, &data[pos], towrite, &out, &olen); - pos += towrite; - - if (!do_jabber_send_raw(js, out, olen)) - break; - } - return; - } -#endif - - if (len == -1) - len = strlen(data); - - if (js->bosh) - jabber_bosh_connection_send_raw(js->bosh, data); - else - do_jabber_send_raw(js, data, len); -} - -int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - JabberStream *js = (JabberStream*)gc->proto_data; - jabber_send_raw(js, buf, len); - return len; -} - -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, - gpointer unused) -{ - JabberStream *js; - char *txt; - int len; - - if (NULL == packet) - return; - - if (!PURPLE_CONNECTION_IS_VALID(pc)) - return; - - js = purple_connection_get_protocol_data(pc); - - if (NULL == js) - return; - - if (js->bosh) - if (g_str_equal((*packet)->name, "message") || - g_str_equal((*packet)->name, "iq") || - g_str_equal((*packet)->name, "presence")) - xmlnode_set_namespace(*packet, NS_XMPP_CLIENT); - txt = xmlnode_to_str(*packet, &len); - jabber_send_raw(js, txt, len); - g_free(txt); -} - -void jabber_send(JabberStream *js, xmlnode *packet) -{ - purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-sending-xmlnode", js->gc, &packet); -} - -static gboolean jabber_keepalive_timeout(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Ping timed out")); - js->keepalive_timeout = 0; - return FALSE; -} - -void jabber_keepalive(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - - if (js->keepalive_timeout == 0) { - jabber_keepalive_ping(js); - js->keepalive_timeout = purple_timeout_add_seconds(120, - (GSourceFunc)(jabber_keepalive_timeout), gc); - } -} - -static void -jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; - int len; - static char buf[4096]; - - /* TODO: It should be possible to make this check unnecessary */ - if(!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_ssl_close(gsc); - return; - } - - while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); - buf[len] = '\0'; - purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); - jabber_parser_process(js, buf, len); - if(js->reinit) - jabber_stream_init(js); - } - - if(len < 0 && errno == EAGAIN) - return; - else { - gchar *tmp; - if (len == 0) - tmp = g_strdup_printf(_("Server closed the connection")); - else - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } -} - -static void -jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; - int len; - static char buf[4096]; - - if(!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); -#ifdef HAVE_CYRUS_SASL - if (js->sasl_maxbuf>0) { - const char *out; - unsigned int olen; - sasl_decode(js->sasl, buf, len, &out, &olen); - if (olen>0) { - purple_debug_info("jabber", "RecvSASL (%u): %s\n", olen, out); - jabber_parser_process(js,out,olen); - if(js->reinit) - jabber_stream_init(js); - } - return; - } -#endif - buf[len] = '\0'; - purple_debug_info("jabber", "Recv (%d): %s\n", len, buf); - jabber_parser_process(js, buf, len); - if(js->reinit) - jabber_stream_init(js); - } else if(len < 0 && errno == EAGAIN) { - return; - } else { - gchar *tmp; - if (len == 0) - tmp = g_strdup_printf(_("Server closed the connection")); - else - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } -} - -static void -jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - JabberStream *js; - - /* TODO: It should be possible to make this check unnecessary */ - if(!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_ssl_close(gsc); - return; - } - - js = gc->proto_data; - - if(js->state == JABBER_STREAM_CONNECTING) - jabber_send_raw(js, "<?xml version='1.0' ?>", -1); - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); - purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); - - /* Tell the app that we're doing encryption */ - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); -} - -static void -txt_resolved_cb(GList *responses, gpointer data) -{ - JabberStream *js = data; - - js->srv_query_data = NULL; - - if (responses == NULL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to find alternative XMPP connection " - "methods after failing to connect directly.")); - return; - } - - while (responses) { - PurpleTxtResponse *resp = responses->data; - gchar **token; - token = g_strsplit(purple_txt_response_get_content(resp), "=", 2); - if (!strcmp(token[0], "_xmpp-client-xbosh")) { - purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]); - js->bosh = jabber_bosh_connection_init(js, token[1]); - g_strfreev(token); - break; - } - g_strfreev(token); - purple_txt_response_destroy(resp); - responses = g_list_delete_link(responses, responses); - } - - if (js->bosh) { - jabber_bosh_connection_connect(js->bosh); - } else { - purple_debug_info("jabber","Didn't find an alternative connection method.\n"); - } - - if (responses) { - g_list_foreach(responses, (GFunc)purple_txt_response_destroy, NULL); - g_list_free(responses); - } -} - -static void -jabber_login_callback(gpointer data, gint source, const gchar *error) -{ - PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; - - if (source < 0) { - if (js->srv_rec != NULL) { - purple_debug_error("jabber", "Unable to connect to server: %s. Trying next SRV record.\n", error); - try_srv_connect(js); - } else { - purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); - js->srv_query_data = purple_txt_resolve("_xmppconnect", - js->user->domain, txt_resolved_cb, js); - } - return; - } - - g_free(js->srv_rec); - js->srv_rec = NULL; - - js->fd = source; - - if(js->state == JABBER_STREAM_CONNECTING) - jabber_send_raw(js, "<?xml version='1.0' ?>", -1); - - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); - gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); -} - -static void -jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - PurpleConnection *gc = data; - JabberStream *js; - - /* If the connection is already disconnected, we don't need to do anything else */ - if(!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - js = gc->proto_data; - js->gsc = NULL; - - purple_connection_ssl_error (gc, error); -} - -static void tls_init(JabberStream *js) -{ - purple_input_remove(js->gc->inpa); - js->gc->inpa = 0; - js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, - jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); - /* The fd is no longer our concern */ - js->fd = -1; -} - -static gboolean jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port, - gboolean fatal_failure) -{ - /* host should be used in preference to domain to - * allow SASL authentication to work with FQDN of the server, - * but we use domain as fallback for when users enter IP address - * in connect server */ - g_free(js->serverFQDN); - if (purple_ip_address_is_valid(host)) - js->serverFQDN = g_strdup(domain); - else - js->serverFQDN = g_strdup(host); - - if (purple_proxy_connect(js->gc, purple_connection_get_account(js->gc), - host, port, jabber_login_callback, js->gc) == NULL) { - if (fatal_failure) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } - - return FALSE; - } - - return TRUE; -} - -static void try_srv_connect(JabberStream *js) -{ - while (js->srv_rec != NULL && js->srv_rec_idx < js->max_srv_rec_idx) { - PurpleSrvResponse *tmp_resp = js->srv_rec + (js->srv_rec_idx++); - if (jabber_login_connect(js, tmp_resp->hostname, tmp_resp->hostname, tmp_resp->port, FALSE)) - return; - } - - g_free(js->srv_rec); - js->srv_rec = NULL; - - /* Fall back to the defaults (I'm not sure if we should actually do this) */ - jabber_login_connect(js, js->user->domain, js->user->domain, - purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), - TRUE); -} - -static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data) -{ - JabberStream *js = data; - js->srv_query_data = NULL; - - if(results) { - js->srv_rec = resp; - js->srv_rec_idx = 0; - js->max_srv_rec_idx = results; - try_srv_connect(js); - } else { - jabber_login_connect(js, js->user->domain, js->user->domain, - purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), - TRUE); - } -} - -static JabberStream * -jabber_stream_new(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - PurplePresence *presence; - gchar *user; - gchar *slash; - - js = gc->proto_data = g_new0(JabberStream, 1); - js->gc = gc; - js->fd = -1; - - user = g_strdup(purple_account_get_username(account)); - /* jabber_id_new doesn't accept "user@domain/" as valid */ - slash = strchr(user, '/'); - if (slash && *(slash + 1) == '\0') - *slash = '\0'; - js->user = jabber_id_new(user); - - if (!js->user) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Invalid XMPP ID")); - /* Destroying the connection will free the JabberStream */ - return NULL; - } - - if (!js->user->domain || *(js->user->domain) == '\0') { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Invalid XMPP ID. Domain must be set.")); - /* Destroying the connection will free the JabberStream */ - return NULL; - } - - js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, (GDestroyNotify)jabber_buddy_free); - - js->user_jb = jabber_buddy_find(js, user, TRUE); - g_free(user); - if (!js->user_jb) { - /* This basically *can't* fail, but for good measure... */ - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Invalid XMPP ID")); - /* Destroying the connection will free the JabberStream */ - g_return_val_if_reached(NULL); - } - - js->user_jb->subscription |= JABBER_SUB_BOTH; - - js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, (GDestroyNotify)jabber_chat_free); - js->next_id = g_random_int(); - js->write_buffer = purple_circ_buffer_new(512); - js->old_length = 0; - js->keepalive_timeout = 0; - /* Set the default protocol version to 1.0. Overridden in parser.c. */ - js->protocol_version = JABBER_PROTO_1_0; - js->sessions = NULL; - js->stun_ip = NULL; - js->stun_port = 0; - js->stun_query = NULL; - - /* if we are idle, set idle-ness on the stream (this could happen if we get - disconnected and the reconnects while being idle. I don't think it makes - sense to do this when registering a new account... */ - presence = purple_account_get_presence(account); - if (purple_presence_is_idle(presence)) - js->idle = purple_presence_get_idle_time(presence); - - return js; -} - -static void -jabber_stream_connect(JabberStream *js) -{ - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - const char *connect_server = purple_account_get_string(account, - "connect_server", ""); - const char *bosh_url = purple_account_get_string(account, - "bosh_url", ""); - - jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); - - /* If both BOSH and a Connect Server are specified, we prefer BOSH. I'm not - * attached to that choice, though. - */ - if (*bosh_url) { - js->bosh = jabber_bosh_connection_init(js, bosh_url); - if (js->bosh) - jabber_bosh_connection_connect(js->bosh); - else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Malformed BOSH URL")); - } - - return; - } - - js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain); - - /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ - if(purple_account_get_bool(account, "old_ssl", FALSE)) { - if(purple_ssl_is_supported()) { - js->gsc = purple_ssl_connect(account, js->certificate_CN, - purple_account_get_int(account, "port", 5223), - jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); - if (!js->gsc) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Unable to establish SSL connection")); - } - } else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - } - - return; - } - - /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll - * invoke the magic of SRV lookups, to figure out host and port */ - if(connect_server[0]) { - jabber_login_connect(js, js->user->domain, connect_server, - purple_account_get_int(account, "port", 5222), TRUE); - } else { - js->srv_query_data = purple_srv_resolve("xmpp-client", - "tcp", js->user->domain, srv_resolved_cb, js); - } -} - -void -jabber_login(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - PurpleStoredImage *image; - - gc->flags |= PURPLE_CONNECTION_HTML | - PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; - js = jabber_stream_new(account); - if (js == NULL) - return; - - /* - * Calculate the avatar hash for our current image so we know (when we - * fetch our vCard and PEP avatar) if we should send our avatar to the - * server. - */ - image = purple_buddy_icons_find_account_icon(account); - if (image != NULL) { - js->initial_avatar_hash = - jabber_calculate_data_sha1sum(purple_imgstore_get_data(image), - purple_imgstore_get_size(image)); - purple_imgstore_unref(image); - } - - jabber_stream_connect(js); -} - - -static gboolean -conn_close_cb(gpointer data) -{ - JabberStream *js = data; - PurpleAccount *account = purple_connection_get_account(js->gc); - - jabber_parser_free(js); - - purple_account_disconnect(account); - - return FALSE; -} - -static void -jabber_connection_schedule_close(JabberStream *js) -{ - purple_timeout_add(0, conn_close_cb, js); -} - -static void -jabber_registration_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - char *buf; - char *to = data; - - if (type == JABBER_IQ_RESULT) { - if(js->registration) { - buf = g_strdup_printf(_("Registration of %s@%s successful"), - js->user->node, js->user->domain); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - } else { - g_return_if_fail(to != NULL); - buf = g_strdup_printf(_("Registration to %s successful"), - to); - } - purple_notify_info(NULL, _("Registration Successful"), - _("Registration Successful"), buf); - g_free(buf); - } else { - char *msg = jabber_parse_error(js, packet, NULL); - - if(!msg) - msg = g_strdup(_("Unknown Error")); - - purple_notify_error(NULL, _("Registration Failed"), - _("Registration Failed"), msg); - g_free(msg); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - } - g_free(to); - if(js->registration) - jabber_connection_schedule_close(js); -} - -static void -jabber_unregistration_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - char *buf; - char *to = data; - - /* This function is never called for unregistering our XMPP account from - * the server, so there should always be a 'to' address. */ - g_return_if_fail(to != NULL); - - if (type == JABBER_IQ_RESULT) { - buf = g_strdup_printf(_("Registration from %s successfully removed"), - to); - purple_notify_info(NULL, _("Unregistration Successful"), - _("Unregistration Successful"), buf); - g_free(buf); - } else { - char *msg = jabber_parse_error(js, packet, NULL); - - if(!msg) - msg = g_strdup(_("Unknown Error")); - - purple_notify_error(NULL, _("Unregistration Failed"), - _("Unregistration Failed"), msg); - g_free(msg); - } - g_free(to); -} - -typedef struct _JabberRegisterCBData { - JabberStream *js; - char *who; -} JabberRegisterCBData; - -static void -jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) -{ - GList *groups, *flds; - xmlnode *query, *y; - JabberIq *iq; - char *username; - - iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); - if (cbdata->who) - xmlnode_set_attrib(iq->node, "to", cbdata->who); - - for(groups = purple_request_fields_get_groups(fields); groups; - groups = groups->next) { - for(flds = purple_request_field_group_get_fields(groups->data); - flds; flds = flds->next) { - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - if(!strcmp(id,"unregister")) { - gboolean value = purple_request_field_bool_get_value(field); - if(value) { - /* unregister from service. this doesn't include any of the fields, so remove them from the stanza by recreating it - (there's no "remove child" function for xmlnode) */ - jabber_iq_free(iq); - iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); - if (cbdata->who) - xmlnode_set_attrib(iq->node,"to",cbdata->who); - xmlnode_new_child(query, "remove"); - - jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); - - jabber_iq_send(iq); - g_free(cbdata); - return; - } - } else { - const char *ids[] = {"username", "password", "name", "email", "nick", "first", - "last", "address", "city", "state", "zip", "phone", "url", "date", - NULL}; - const char *value = purple_request_field_string_get_value(field); - int i; - for (i = 0; ids[i]; i++) { - if (!strcmp(id, ids[i])) - break; - } - - if (!ids[i]) - continue; - y = xmlnode_new_child(query, ids[i]); - xmlnode_insert_data(y, value, -1); - if(cbdata->js->registration && !strcmp(id, "username")) { - g_free(cbdata->js->user->node); - cbdata->js->user->node = g_strdup(value); - } - if(cbdata->js->registration && !strcmp(id, "password")) - purple_account_set_password(cbdata->js->gc->account, value); - } - } - } - - if(cbdata->js->registration) { - username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, - cbdata->js->user->resource ? "/" : "", - cbdata->js->user->resource ? cbdata->js->user->resource : ""); - purple_account_set_username(cbdata->js->gc->account, username); - g_free(username); - } - - jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); - - jabber_iq_send(iq); - g_free(cbdata); -} - -static void -jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) -{ - PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); - if(account && cbdata->js->registration) { - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - jabber_connection_schedule_close(cbdata->js); - } - g_free(cbdata->who); - g_free(cbdata); -} - -static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - xmlnode *query; - JabberIq *iq; - char *to = data; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); - if (to) - xmlnode_set_attrib(iq->node,"to",to); - - xmlnode_insert_child(query, result); - - jabber_iq_set_callback(iq, jabber_registration_result_cb, to); - jabber_iq_send(iq); -} - -static const struct { - const char *name; - const char *label; -} registration_fields[] = { - { "email", N_("Email") }, - { "nick", N_("Nickname") }, - { "first", N_("First name") }, - { "last", N_("Last name") }, - { "address", N_("Address") }, - { "city", N_("City") }, - { "state", N_("State") }, - { "zip", N_("Postal code") }, - { "phone", N_("Phone") }, - { "url", N_("URL") }, - { "date", N_("Date") }, - { NULL, NULL } -}; - -void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *query) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - xmlnode *x, *y, *node; - char *instructions; - JabberRegisterCBData *cbdata; - gboolean registered = FALSE; - int i; - - if (type != JABBER_IQ_RESULT) - return; - - if(js->registration) { - /* get rid of the login thingy */ - purple_connection_set_state(js->gc, PURPLE_CONNECTED); - } - - if(xmlnode_get_child(query, "registered")) { - registered = TRUE; - - if(js->registration) { - purple_notify_error(NULL, _("Already Registered"), - _("Already Registered"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - jabber_connection_schedule_close(js); - return; - } - } - - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); - return; - - } else if((x = xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) { - xmlnode *url; - - if((url = xmlnode_get_child(x, "url"))) { - char *href; - if((href = xmlnode_get_data(url))) { - purple_notify_uri(NULL, href); - g_free(href); - - if(js->registration) { - js->gc->wants_to_die = TRUE; - if(account->registration_cb) /* succeeded, but we have no login info */ - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - jabber_connection_schedule_close(js); - } - return; - } - } - } - - /* as a last resort, use the old jabber:iq:register syntax */ - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - if((node = xmlnode_get_child(query, "username"))) { - char *data = xmlnode_get_data(node); - if(js->registration) - field = purple_request_field_string_new("username", _("Username"), data ? data : js->user->node, FALSE); - else - field = purple_request_field_string_new("username", _("Username"), data, FALSE); - - purple_request_field_group_add_field(group, field); - g_free(data); - } - if((node = xmlnode_get_child(query, "password"))) { - if(js->registration) - field = purple_request_field_string_new("password", _("Password"), - purple_connection_get_password(js->gc), FALSE); - else { - char *data = xmlnode_get_data(node); - field = purple_request_field_string_new("password", _("Password"), data, FALSE); - g_free(data); - } - - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - } - - if((node = xmlnode_get_child(query, "name"))) { - if(js->registration) - field = purple_request_field_string_new("name", _("Name"), - purple_account_get_alias(js->gc->account), FALSE); - else { - char *data = xmlnode_get_data(node); - field = purple_request_field_string_new("name", _("Name"), data, FALSE); - g_free(data); - } - purple_request_field_group_add_field(group, field); - } - - for (i = 0; registration_fields[i].name != NULL; ++i) { - if ((node = xmlnode_get_child(query, registration_fields[i].name))) { - char *data = xmlnode_get_data(node); - field = purple_request_field_string_new(registration_fields[i].name, - _(registration_fields[i].label), - data, FALSE); - purple_request_field_group_add_field(group, field); - g_free(data); - } - } - - if(registered) { - field = purple_request_field_bool_new("unregister", _("Unregister"), FALSE); - purple_request_field_group_add_field(group, field); - } - - if((y = xmlnode_get_child(query, "instructions"))) - instructions = xmlnode_get_data(y); - else if(registered) - instructions = g_strdup(_("Please fill out the information below " - "to change your account registration.")); - else - instructions = g_strdup(_("Please fill out the information below " - "to register your new account.")); - - cbdata = g_new0(JabberRegisterCBData, 1); - cbdata->js = js; - cbdata->who = g_strdup(from); - - if(js->registration) - purple_request_fields(js->gc, _("Register New XMPP Account"), - _("Register New XMPP Account"), instructions, fields, - _("Register"), G_CALLBACK(jabber_register_cb), - _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), - purple_connection_get_account(js->gc), NULL, NULL, - cbdata); - else { - char *title; - g_return_if_fail(from != NULL); - title = registered ? g_strdup_printf(_("Change Account Registration at %s"), from) - :g_strdup_printf(_("Register New Account at %s"), from); - purple_request_fields(js->gc, title, - title, instructions, fields, - (registered ? _("Change Registration") : _("Register")), G_CALLBACK(jabber_register_cb), - _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), - purple_connection_get_account(js->gc), NULL, NULL, - cbdata); - g_free(title); - } - - g_free(instructions); -} - -void jabber_register_start(JabberStream *js) -{ - JabberIq *iq; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); - jabber_iq_send(iq); -} - -void jabber_register_gateway(JabberStream *js, const char *gateway) { - JabberIq *iq; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", gateway); - jabber_iq_send(iq); -} - -void jabber_register_account(PurpleAccount *account) -{ - JabberStream *js; - - js = jabber_stream_new(account); - if (js == NULL) - return; - - js->registration = TRUE; - jabber_stream_connect(js); -} - -static void -jabber_unregister_account_iq_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Error unregistering account"), - _("Error unregistering account"), msg); - g_free(msg); - if(js->unregistration_cb) - js->unregistration_cb(account, FALSE, js->unregistration_user_data); - } else { - purple_notify_info(js->gc, _("Account successfully unregistered"), - _("Account successfully unregistered"), NULL); - if(js->unregistration_cb) - js->unregistration_cb(account, TRUE, js->unregistration_user_data); - } -} - -static void jabber_unregister_account_cb(JabberStream *js) { - JabberIq *iq; - xmlnode *query; - - g_return_if_fail(js->unregistration); - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - - query = xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register"); - - xmlnode_new_child(query, "remove"); - xmlnode_set_attrib(iq->node, "to", js->user->domain); - - jabber_iq_set_callback(iq, jabber_unregister_account_iq_cb, NULL); - jabber_iq_send(iq); -} - -void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - - if(gc->state != PURPLE_CONNECTED) { - if(gc->state != PURPLE_CONNECTING) - jabber_login(account); - js = gc->proto_data; - js->unregistration = TRUE; - js->unregistration_cb = cb; - js->unregistration_user_data = user_data; - return; - } - - js = gc->proto_data; - - if (js->unregistration) { - purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); - return; - } - - js->unregistration = TRUE; - js->unregistration_cb = cb; - js->unregistration_user_data = user_data; - - jabber_unregister_account_cb(js); -} - -/* TODO: As Will pointed out in IRC, after being notified by the core to - * shutdown, we should async. wait for the server to send us the stream - * termination before destorying everything. That seems like it would require - * changing the semantics of prpl->close(), so it's a good idea for 3.0.0. - */ -void jabber_close(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - - /* Close all of the open Jingle sessions on this stream */ - jingle_terminate_sessions(js); - - /* Don't perform any actions on the ssl connection - * if we were forcibly disconnected because it will crash - * on some SSL backends. - */ - if (!gc->disconnect_timeout) { - if (js->bosh) - jabber_bosh_connection_close(js->bosh); - else if ((js->gsc && js->gsc->fd > 0) || js->fd > 0) - jabber_send_raw(js, "</stream:stream>", -1); - } - - if (js->srv_query_data) - purple_srv_cancel(js->srv_query_data); - - if(js->gsc) { -#ifdef HAVE_OPENSSL - if (!gc->disconnect_timeout) -#endif - purple_ssl_close(js->gsc); - } else if (js->fd > 0) { - if(js->gc->inpa) - purple_input_remove(js->gc->inpa); - close(js->fd); - } - - if (js->bosh) - jabber_bosh_connection_destroy(js->bosh); - - jabber_buddy_remove_all_pending_buddy_info_requests(js); - - jabber_parser_free(js); - - if(js->iq_callbacks) - g_hash_table_destroy(js->iq_callbacks); - if(js->buddies) - g_hash_table_destroy(js->buddies); - if(js->chats) - g_hash_table_destroy(js->chats); - - while(js->chat_servers) { - g_free(js->chat_servers->data); - js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); - } - - while(js->user_directories) { - g_free(js->user_directories->data); - js->user_directories = g_list_delete_link(js->user_directories, js->user_directories); - } - - while(js->bs_proxies) { - JabberBytestreamsStreamhost *sh = js->bs_proxies->data; - g_free(sh->jid); - g_free(sh->host); - g_free(sh->zeroconf); - g_free(sh); - js->bs_proxies = g_list_delete_link(js->bs_proxies, js->bs_proxies); - } - - while(js->url_datas) { - purple_util_fetch_url_cancel(js->url_datas->data); - js->url_datas = g_slist_delete_link(js->url_datas, js->url_datas); - } - - g_free(js->stream_id); - if(js->user) - jabber_id_free(js->user); - g_free(js->initial_avatar_hash); - g_free(js->avatar_hash); - g_free(js->caps_hash); - - purple_circ_buffer_destroy(js->write_buffer); - if(js->writeh) - purple_input_remove(js->writeh); -#ifdef HAVE_CYRUS_SASL - if(js->sasl) - sasl_dispose(&js->sasl); - if(js->sasl_mechs) - g_string_free(js->sasl_mechs, TRUE); - g_free(js->sasl_cb); -#endif - g_free(js->serverFQDN); - while(js->commands) { - JabberAdHocCommands *cmd = js->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - js->commands = g_list_delete_link(js->commands, js->commands); - } - g_free(js->server_name); - g_free(js->certificate_CN); - g_free(js->gmail_last_time); - g_free(js->gmail_last_tid); - g_free(js->old_msg); - g_free(js->old_avatarhash); - g_free(js->old_artist); - g_free(js->old_title); - g_free(js->old_source); - g_free(js->old_uri); - g_free(js->old_track); - g_free(js->expected_rspauth); - - if (js->vcard_timer != 0) - purple_timeout_remove(js->vcard_timer); - - if (js->keepalive_timeout != 0) - purple_timeout_remove(js->keepalive_timeout); - - g_free(js->srv_rec); - js->srv_rec = NULL; - - g_free(js->stun_ip); - js->stun_ip = NULL; - - /* cancel DNS query for STUN, if one is ongoing */ - if (js->stun_query) { - purple_dnsquery_destroy(js->stun_query); - js->stun_query = NULL; - } - - g_free(js); - - gc->proto_data = NULL; -} - -void jabber_stream_set_state(JabberStream *js, JabberStreamState state) -{ -#define JABBER_CONNECT_STEPS ((js->gsc || js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION) ? 9 : 5) - - js->state = state; - switch(state) { - case JABBER_STREAM_OFFLINE: - break; - case JABBER_STREAM_CONNECTING: - purple_connection_update_progress(js->gc, _("Connecting"), 1, - JABBER_CONNECT_STEPS); - break; - case JABBER_STREAM_INITIALIZING: - purple_connection_update_progress(js->gc, _("Initializing Stream"), - js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); - jabber_stream_init(js); - break; - case JABBER_STREAM_INITIALIZING_ENCRYPTION: - purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"), - 6, JABBER_CONNECT_STEPS); - break; - case JABBER_STREAM_AUTHENTICATING: - purple_connection_update_progress(js->gc, _("Authenticating"), - js->gsc ? 7 : 3, JABBER_CONNECT_STEPS); - if(js->protocol_version == JABBER_PROTO_0_9 && js->registration) { - jabber_register_start(js); - } else if(js->auth_type == JABBER_AUTH_IQ_AUTH) { - jabber_auth_start_old(js); - } - break; - case JABBER_STREAM_POST_AUTH: - purple_connection_update_progress(js->gc, _("Re-initializing Stream"), - (js->gsc ? 8 : 4), JABBER_CONNECT_STEPS); - - break; - case JABBER_STREAM_CONNECTED: - /* Send initial presence */ - jabber_presence_send(js, TRUE); - purple_connection_set_state(js->gc, PURPLE_CONNECTED); - break; - } - -#undef JABBER_CONNECT_STEPS -} - -char *jabber_get_next_id(JabberStream *js) -{ - return g_strdup_printf("purple%x", js->next_id++); -} - - -void jabber_idle_set(PurpleConnection *gc, int idle) -{ - JabberStream *js = gc->proto_data; - - js->idle = idle ? time(NULL) - idle : idle; - - /* send out an updated prescence */ - purple_debug_info("jabber", "sending updated presence for idle\n"); - jabber_presence_send(js, FALSE); -} - -void jabber_blocklist_parse_push(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child) -{ - JabberIq *result; - xmlnode *item; - PurpleAccount *account; - gboolean is_block; - - if (!jabber_is_own_account(js, from)) { - xmlnode *error, *x; - result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(result->node, "id", id); - if (from) - xmlnode_set_attrib(result->node, "to", from); - - error = xmlnode_new_child(result->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - x = xmlnode_new_child(error, "not-allowed"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(result); - return; - } - - account = purple_connection_get_account(js->gc); - is_block = g_str_equal(child->name, "block"); - - item = xmlnode_get_child(child, "item"); - if (!is_block && item == NULL) { - /* Unblock everyone */ - purple_debug_info("jabber", "Received unblock push. Unblocking everyone.\n"); - - while (account->deny != NULL) { - purple_privacy_deny_remove(account, account->deny->data, TRUE); - } - } else if (item == NULL) { - /* An empty <block/> is bogus */ - xmlnode *error, *x; - result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(result->node, "id", id); - - error = xmlnode_new_child(result->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - x = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(result); - return; - } else { - for ( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - if (jid == NULL || *jid == '\0') - continue; - - if (is_block) - purple_privacy_deny_add(account, jid, TRUE); - else - purple_privacy_deny_remove(account, jid, TRUE); - } - } - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "id", id); - jabber_iq_send(result); -} - -static void jabber_blocklist_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *blocklist, *item; - PurpleAccount *account; - - blocklist = xmlnode_get_child_with_namespace(packet, - "blocklist", NS_SIMPLE_BLOCKING); - account = purple_connection_get_account(js->gc); - - if (type == JABBER_IQ_ERROR || blocklist == NULL) - return; - - /* This is the only privacy method supported by XEP-0191 */ - if (account->perm_deny != PURPLE_PRIVACY_DENY_USERS) - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - - /* - * TODO: When account->deny is something more than a hash table, this can - * be re-written to find the set intersection and difference. - */ - while (account->deny) - purple_privacy_deny_remove(account, account->deny->data, TRUE); - - item = xmlnode_get_child(blocklist, "item"); - while (item != NULL) { - const char *jid = xmlnode_get_attrib(item, "jid"); - purple_privacy_deny_add(account, jid, TRUE); - item = xmlnode_get_next_twin(item); - } -} - -void jabber_request_block_list(JabberStream *js) -{ - JabberIq *iq; - xmlnode *blocklist; - - iq = jabber_iq_new(js, JABBER_IQ_GET); - - blocklist = xmlnode_new_child(iq->node, "blocklist"); - xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING); - - jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL); - - jabber_iq_send(iq); -} - -void jabber_add_deny(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - JabberIq *iq; - xmlnode *block, *item; - - js = gc->proto_data; - if (js == NULL) - return; - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) - { - jabber_google_roster_add_deny(gc, who); - return; - } - - if (!(js->server_caps & JABBER_CAP_BLOCKING)) - { - purple_notify_error(NULL, _("Server doesn't support blocking"), - _("Server doesn't support blocking"), NULL); - return; - } - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - block = xmlnode_new_child(iq->node, "block"); - xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING); - - item = xmlnode_new_child(block, "item"); - xmlnode_set_attrib(item, "jid", who); - - jabber_iq_send(iq); -} - -void jabber_rem_deny(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - JabberIq *iq; - xmlnode *unblock, *item; - - js = gc->proto_data; - if (js == NULL) - return; - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) - { - jabber_google_roster_rem_deny(gc, who); - return; - } - - if (!(js->server_caps & JABBER_CAP_BLOCKING)) - return; - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - unblock = xmlnode_new_child(iq->node, "unblock"); - xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING); - - item = xmlnode_new_child(unblock, "item"); - xmlnode_set_attrib(item, "jid", who); - - jabber_iq_send(iq); -} - -void jabber_add_feature(const char *namespace, JabberFeatureEnabled cb) { - JabberFeature *feat; - - g_return_if_fail(namespace != NULL); - - feat = g_new0(JabberFeature,1); - feat->namespace = g_strdup(namespace); - feat->is_enabled = cb; - - /* try to remove just in case it already exists in the list */ - jabber_remove_feature(namespace); - - jabber_features = g_list_append(jabber_features, feat); -} - -void jabber_remove_feature(const char *namespace) { - GList *feature; - for(feature = jabber_features; feature; feature = feature->next) { - JabberFeature *feat = (JabberFeature*)feature->data; - if(!strcmp(feat->namespace, namespace)) { - g_free(feat->namespace); - g_free(feature->data); - jabber_features = g_list_delete_link(jabber_features, feature); - break; - } - } -} - -static void jabber_features_destroy(void) -{ - while (jabber_features) { - JabberFeature *feature = jabber_features->data; - g_free(feature->namespace); - g_free(feature); - jabber_features = g_list_delete_link(jabber_features, jabber_features); - } -} - -void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name) { - GList *identity; - JabberIdentity *ident; - /* both required according to XEP-0030 */ - g_return_if_fail(category != NULL); - g_return_if_fail(type != NULL); - - for(identity = jabber_identities; identity; identity = identity->next) { - JabberIdentity *ident = (JabberIdentity*)identity->data; - if (!strcmp(ident->category, category) && - !strcmp(ident->type, type) && - ((!ident->lang && !lang) || (ident->lang && lang && !strcmp(ident->lang, lang)))) { - return; - } - } - - ident = g_new0(JabberIdentity, 1); - ident->category = g_strdup(category); - ident->type = g_strdup(type); - ident->lang = g_strdup(lang); - ident->name = g_strdup(name); - jabber_identities = g_list_prepend(jabber_identities, ident); -} - -static void jabber_identities_destroy(void) -{ - while (jabber_identities) { - JabberIdentity *id = jabber_identities->data; - g_free(id->category); - g_free(id->type); - g_free(id->lang); - g_free(id->name); - g_free(id); - jabber_identities = g_list_delete_link(jabber_identities, jabber_identities); - } -} - -gboolean jabber_stream_is_ssl(JabberStream *js) -{ - return (js->bosh && jabber_bosh_connection_is_ssl(js->bosh)) || - (!js->bosh && js->gsc); -} - -const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "jabber"; -} - -const char* jabber_list_emblem(PurpleBuddy *b) -{ - JabberStream *js; - JabberBuddy *jb = NULL; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); - - if(!gc) - return NULL; - - js = gc->proto_data; - if(js) - jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); - - if(!PURPLE_BUDDY_IS_ONLINE(b)) { - if(jb && (jb->subscription & JABBER_SUB_PENDING || - !(jb->subscription & JABBER_SUB_TO))) - return "not-authorized"; - } - - if (jb) { - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); - if (jbr) { - const gchar *client_type = - jabber_resource_get_identity_category_type(jbr, "client"); - - if (client_type) { - if (strcmp(client_type, "phone") == 0) { - return "mobile"; - } else if (strcmp(client_type, "web") == 0) { - return "external"; - } else if (strcmp(client_type, "handheld") == 0) { - return "hiptop"; - } else if (strcmp(client_type, "bot") == 0) { - return "bot"; - } - /* the default value "pc" falls through and has no emblem */ - } - } - } - - return NULL; -} - -char *jabber_status_text(PurpleBuddy *b) -{ - char *ret = NULL; - JabberBuddy *jb = NULL; - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - - if (gc && gc->proto_data) - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); - - if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { - ret = g_strdup(_("Not Authorized")); - } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { - ret = g_strdup(jb->error_msg); - } else { - PurplePresence *presence = purple_buddy_get_presence(b); - PurpleStatus *status = purple_presence_get_active_status(presence); - const char *message; - - if((message = purple_status_get_attr_string(status, "message"))) { - ret = g_markup_escape_text(message, -1); - } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - ret = purple_util_format_song_info(title, artist, album, NULL); - } - } - - return ret; -} - -static void -jabber_tooltip_add_resource_text(JabberBuddyResource *jbr, - PurpleNotifyUserInfo *user_info, gboolean multiple_resources) -{ - char *text = NULL; - char *res = NULL; - char *label, *value; - const char *state; - - if(jbr->status) { - text = g_markup_escape_text(jbr->status, -1); - } - - if(jbr->name) - res = g_strdup_printf(" (%s)", jbr->name); - - state = jabber_buddy_state_get_name(jbr->state); - if (text != NULL && !purple_utf8_strcasecmp(state, text)) { - g_free(text); - text = NULL; - } - - label = g_strdup_printf("%s%s", _("Status"), (res ? res : "")); - value = g_strdup_printf("%s%s%s", state, (text ? ": " : ""), (text ? text : "")); - - purple_notify_user_info_add_pair(user_info, label, value); - g_free(label); - g_free(value); - g_free(text); - - /* if the resource is idle, show that */ - /* only show it if there is more than one resource available for - the buddy, since the "general" idleness will be shown anyway, - this way we can see see the idleness of lower-priority resources */ - if (jbr->idle && multiple_resources) { - gchar *idle_str = - purple_str_seconds_to_string(time(NULL) - jbr->idle); - label = g_strdup_printf("%s%s", _("Idle"), (res ? res : "")); - purple_notify_user_info_add_pair(user_info, label, idle_str); - g_free(idle_str); - g_free(label); - } - g_free(res); -} - -void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - JabberBuddy *jb; - PurpleAccount *account; - PurpleConnection *gc; - - g_return_if_fail(b != NULL); - - account = purple_buddy_get_account(b); - g_return_if_fail(account != NULL); - - gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL); - g_return_if_fail(gc->proto_data != NULL); - - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); - - if(jb) { - JabberBuddyResource *jbr = NULL; - PurplePresence *presence = purple_buddy_get_presence(b); - const char *sub; - GList *l; - const char *mood; - gboolean multiple_resources = - jb->resources && g_list_next(jb->resources); - JabberBuddyResource *top_jbr = jabber_buddy_find_resource(jb, NULL); - - /* resource-specific info for the top resource */ - if (top_jbr) { - jabber_tooltip_add_resource_text(top_jbr, user_info, - multiple_resources); - } - - for(l=jb->resources; l; l = l->next) { - jbr = l->data; - /* the remaining resources */ - if (jbr != top_jbr) { - jabber_tooltip_add_resource_text(jbr, user_info, - multiple_resources); - } - } - - if (full) { - PurpleStatus *status; - - status = purple_presence_get_active_status(presence); - mood = purple_status_get_attr_string(status, "mood"); - if(mood != NULL) { - const char *moodtext; - moodtext = purple_status_get_attr_string(status, "moodtext"); - if(moodtext != NULL) { - char *moodplustext = g_strdup_printf("%s (%s)", mood, moodtext); - - purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext); - g_free(moodplustext); - } else - purple_notify_user_info_add_pair(user_info, _("Mood"), mood); - } - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *tune = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - char *playing = purple_util_format_song_info(title, artist, album, NULL); - if (playing) { - purple_notify_user_info_add_pair(user_info, _("Now Listening"), playing); - g_free(playing); - } - } - - if(jb->subscription & JABBER_SUB_FROM) { - if(jb->subscription & JABBER_SUB_TO) - sub = _("Both"); - else if(jb->subscription & JABBER_SUB_PENDING) - sub = _("From (To pending)"); - else - sub = _("From"); - } else { - if(jb->subscription & JABBER_SUB_TO) - sub = _("To"); - else if(jb->subscription & JABBER_SUB_PENDING) - sub = _("None (To pending)"); - else - sub = _("None"); - } - - purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); - - } - - if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { - purple_notify_user_info_add_pair(user_info, _("Error"), jb->error_msg); - } - } -} - -GList *jabber_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - PurpleValue *priority_value; - PurpleValue *buzz_enabled; - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 1); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE), - NULL, TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 1); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT), - _("Chatty"), TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 0); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY), - NULL, TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 0); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA), - NULL, TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 0); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND), - _("Do Not Disturb"), TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - /* - if(js->protocol_version == JABBER_PROTO_0_9) - m = g_list_append(m, _("Invisible")); - */ - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE), - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, - "tune", NULL, FALSE, TRUE, TRUE, - PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), - PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), - PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - return types; -} - -static void -jabber_password_change_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) { - purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), - _("Your password has been changed.")); - - purple_account_set_password(js->gc->account, (char *)data); - } else { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Error changing password"), - _("Error changing password"), msg); - g_free(msg); - } - - g_free(data); -} - -static void jabber_password_change_cb(JabberStream *js, - PurpleRequestFields *fields) -{ - const char *p1, *p2; - JabberIq *iq; - xmlnode *query, *y; - - p1 = purple_request_fields_get_string(fields, "password1"); - p2 = purple_request_fields_get_string(fields, "password2"); - - if(strcmp(p1, p2)) { - purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL); - return; - } - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - - xmlnode_set_attrib(iq->node, "to", js->user->domain); - - query = xmlnode_get_child(iq->node, "query"); - - y = xmlnode_new_child(query, "username"); - xmlnode_insert_data(y, js->user->node, -1); - y = xmlnode_new_child(query, "password"); - xmlnode_insert_data(y, p1, -1); - - jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1)); - - jabber_iq_send(iq); -} - -static void jabber_password_change(PurplePluginAction *action) -{ - - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("password1", _("Password"), - "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password2", _("Password (again)"), - "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(js->gc, _("Change XMPP Password"), - _("Change XMPP Password"), _("Please enter your new password"), - fields, _("OK"), G_CALLBACK(jabber_password_change_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - js); -} - -GList *jabber_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc = (PurpleConnection *) context; - JabberStream *js = gc->proto_data; - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set User Info..."), - jabber_setup_set_info); - m = g_list_append(m, act); - - /* if (js->protocol_options & CHANGE_PASSWORD) { */ - act = purple_plugin_action_new(_("Change Password..."), - jabber_password_change); - m = g_list_append(m, act); - /* } */ - - act = purple_plugin_action_new(_("Search for Users..."), - jabber_user_search_begin); - m = g_list_append(m, act); - - purple_debug_info("jabber", "jabber_actions: have pep: %s\n", js->pep?"YES":"NO"); - - if(js->pep) - jabber_pep_init_actions(&m); - - if(js->commands) - jabber_adhoc_init_server_commands(js, &m); - - return m; -} - -PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) -{ - PurpleBlistNode *gnode, *cnode; - JabberID *jid; - - if(!(jid = jabber_id_new(name))) - return NULL; - - for(gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - for(cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - PurpleChat *chat = (PurpleChat*)cnode; - const char *room, *server; - GHashTable *components; - if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) - continue; - - if (purple_chat_get_account(chat) != account) - continue; - - components = purple_chat_get_components(chat); - if(!(room = g_hash_table_lookup(components, "room"))) - continue; - if(!(server = g_hash_table_lookup(components, "server"))) - continue; - - if(jid->node && jid->domain && - !g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) { - jabber_id_free(jid); - return chat; - } - } - } - jabber_id_free(jid); - return NULL; -} - -void jabber_convo_closed(PurpleConnection *gc, const char *who) -{ - JabberStream *js = gc->proto_data; - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr; - - if(!(jid = jabber_id_new(who))) - return; - - if((jb = jabber_buddy_find(js, who, TRUE)) && - (jbr = jabber_buddy_find_resource(jb, jid->resource))) { - if(jbr->thread_id) { - g_free(jbr->thread_id); - jbr->thread_id = NULL; - } - } - - jabber_id_free(jid); -} - - -char *jabber_parse_error(JabberStream *js, - xmlnode *packet, - PurpleConnectionError *reason) -{ - xmlnode *error; - const char *code = NULL, *text = NULL; - const char *xmlns = xmlnode_get_namespace(packet); - char *cdata = NULL; - -#define SET_REASON(x) \ - if(reason != NULL) { *reason = x; } - - if((error = xmlnode_get_child(packet, "error"))) { - cdata = xmlnode_get_data(error); - code = xmlnode_get_attrib(error, "code"); - - /* Stanza errors */ - if(xmlnode_get_child(error, "bad-request")) { - text = _("Bad Request"); - } else if(xmlnode_get_child(error, "conflict")) { - text = _("Conflict"); - } else if(xmlnode_get_child(error, "feature-not-implemented")) { - text = _("Feature Not Implemented"); - } else if(xmlnode_get_child(error, "forbidden")) { - text = _("Forbidden"); - } else if(xmlnode_get_child(error, "gone")) { - text = _("Gone"); - } else if(xmlnode_get_child(error, "internal-server-error")) { - text = _("Internal Server Error"); - } else if(xmlnode_get_child(error, "item-not-found")) { - text = _("Item Not Found"); - } else if(xmlnode_get_child(error, "jid-malformed")) { - text = _("Malformed XMPP ID"); - } else if(xmlnode_get_child(error, "not-acceptable")) { - text = _("Not Acceptable"); - } else if(xmlnode_get_child(error, "not-allowed")) { - text = _("Not Allowed"); - } else if(xmlnode_get_child(error, "not-authorized")) { - text = _("Not Authorized"); - } else if(xmlnode_get_child(error, "payment-required")) { - text = _("Payment Required"); - } else if(xmlnode_get_child(error, "recipient-unavailable")) { - text = _("Recipient Unavailable"); - } else if(xmlnode_get_child(error, "redirect")) { - /* XXX */ - } else if(xmlnode_get_child(error, "registration-required")) { - text = _("Registration Required"); - } else if(xmlnode_get_child(error, "remote-server-not-found")) { - text = _("Remote Server Not Found"); - } else if(xmlnode_get_child(error, "remote-server-timeout")) { - text = _("Remote Server Timeout"); - } else if(xmlnode_get_child(error, "resource-constraint")) { - text = _("Server Overloaded"); - } else if(xmlnode_get_child(error, "service-unavailable")) { - text = _("Service Unavailable"); - } else if(xmlnode_get_child(error, "subscription-required")) { - text = _("Subscription Required"); - } else if(xmlnode_get_child(error, "unexpected-request")) { - text = _("Unexpected Request"); - } else if(xmlnode_get_child(error, "undefined-condition")) { - text = _("Unknown Error"); - } - } else if(xmlns && !strcmp(xmlns, NS_XMPP_SASL)) { - /* Most common reason can be the default */ - SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); - if(xmlnode_get_child(packet, "aborted")) { - text = _("Authorization Aborted"); - } else if(xmlnode_get_child(packet, "incorrect-encoding")) { - text = _("Incorrect encoding in authorization"); - } else if(xmlnode_get_child(packet, "invalid-authzid")) { - text = _("Invalid authzid"); - } else if(xmlnode_get_child(packet, "invalid-mechanism")) { - text = _("Invalid Authorization Mechanism"); - } else if(xmlnode_get_child(packet, "mechanism-too-weak")) { - SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); - text = _("Authorization mechanism too weak"); - } else if(xmlnode_get_child(packet, "not-authorized")) { - SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); - /* Clear the pasword if it isn't being saved */ - if (!purple_account_get_remember_password(js->gc->account)) - purple_account_set_password(js->gc->account, NULL); - text = _("Not Authorized"); - } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { - text = _("Temporary Authentication Failure"); - } else { - SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); - text = _("Authentication Failure"); - } - } else if(!strcmp(packet->name, "stream:error") || - (!strcmp(packet->name, "error") && xmlns && - !strcmp(xmlns, NS_XMPP_STREAMS))) { - /* Most common reason as default: */ - SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); - if(xmlnode_get_child(packet, "bad-format")) { - text = _("Bad Format"); - } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { - text = _("Bad Namespace Prefix"); - } else if(xmlnode_get_child(packet, "conflict")) { - SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); - text = _("Resource Conflict"); - } else if(xmlnode_get_child(packet, "connection-timeout")) { - text = _("Connection Timeout"); - } else if(xmlnode_get_child(packet, "host-gone")) { - text = _("Host Gone"); - } else if(xmlnode_get_child(packet, "host-unknown")) { - text = _("Host Unknown"); - } else if(xmlnode_get_child(packet, "improper-addressing")) { - text = _("Improper Addressing"); - } else if(xmlnode_get_child(packet, "internal-server-error")) { - text = _("Internal Server Error"); - } else if(xmlnode_get_child(packet, "invalid-id")) { - text = _("Invalid ID"); - } else if(xmlnode_get_child(packet, "invalid-namespace")) { - text = _("Invalid Namespace"); - } else if(xmlnode_get_child(packet, "invalid-xml")) { - text = _("Invalid XML"); - } else if(xmlnode_get_child(packet, "nonmatching-hosts")) { - text = _("Non-matching Hosts"); - } else if(xmlnode_get_child(packet, "not-authorized")) { - text = _("Not Authorized"); - } else if(xmlnode_get_child(packet, "policy-violation")) { - text = _("Policy Violation"); - } else if(xmlnode_get_child(packet, "remote-connection-failed")) { - text = _("Remote Connection Failed"); - } else if(xmlnode_get_child(packet, "resource-constraint")) { - text = _("Resource Constraint"); - } else if(xmlnode_get_child(packet, "restricted-xml")) { - text = _("Restricted XML"); - } else if(xmlnode_get_child(packet, "see-other-host")) { - text = _("See Other Host"); - } else if(xmlnode_get_child(packet, "system-shutdown")) { - text = _("System Shutdown"); - } else if(xmlnode_get_child(packet, "undefined-condition")) { - text = _("Undefined Condition"); - } else if(xmlnode_get_child(packet, "unsupported-encoding")) { - text = _("Unsupported Encoding"); - } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) { - text = _("Unsupported Stanza Type"); - } else if(xmlnode_get_child(packet, "unsupported-version")) { - text = _("Unsupported Version"); - } else if(xmlnode_get_child(packet, "xml-not-well-formed")) { - text = _("XML Not Well Formed"); - } else { - text = _("Stream Error"); - } - } - -#undef SET_REASON - - if(text || cdata) { - char *ret = g_strdup_printf("%s%s%s", code ? code : "", - code ? ": " : "", text ? text : cdata); - g_free(cdata); - return ret; - } else { - return NULL; - } -} - -static PurpleCmdRet jabber_cmd_chat_config(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_request_room_configure(chat); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_register(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_register(chat); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - if (args && args[0] && *args[0]) - jabber_chat_change_topic(chat, args[0]); - else { - const char *cur = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)); - char *buf, *tmp, *tmp2; - - if (cur) { - tmp = g_markup_escape_text(cur, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", buf, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_nick(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if (!jabber_resourceprep_validate(args[0])) { - *error = g_strdup(_("Invalid nickname")); - return PURPLE_CMD_RET_FAILED; - } - - if (jabber_chat_change_nick(chat, args[0])) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet jabber_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_part(chat, args ? args[0] : NULL); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_ban(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if(!jabber_chat_ban_user(chat, args[0], args[1])) { - *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_affiliate(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if (strcmp(args[0], "owner") != 0 && - strcmp(args[0], "admin") != 0 && - strcmp(args[0], "member") != 0 && - strcmp(args[0], "outcast") != 0 && - strcmp(args[0], "none") != 0) { - *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - if (args[1]) { - int i; - char **nicks = g_strsplit(args[1], " ", -1); - - for (i = 0; nicks[i]; ++i) - if (!jabber_chat_affiliate_user(chat, nicks[i], args[0])) { - *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), nicks[i], args[0]); - g_strfreev(nicks); - return PURPLE_CMD_RET_FAILED; - } - - g_strfreev(nicks); - } else { - jabber_chat_affiliation_list(chat, args[0]); - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_role(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if (strcmp(args[0], "moderator") != 0 && - strcmp(args[0], "participant") != 0 && - strcmp(args[0], "visitor") != 0 && - strcmp(args[0], "none") != 0) { - *error = g_strdup_printf(_("Unknown role: \"%s\""), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - if (args[1]) { - int i; - char **nicks = g_strsplit(args[1], " ", -1); - - for (i = 0; nicks[i]; i++) - if (!jabber_chat_role_user(chat, nicks[i], args[0])) { - *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), - args[0], nicks[i]); - return PURPLE_CMD_RET_FAILED; - } - - g_strfreev(nicks); - } else { - jabber_chat_role_list(chat, args[0]); - } - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_invite(purple_conversation_get_gc(conv), - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", - args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - GHashTable *components; - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(components, "room", args[0]); - g_hash_table_replace(components, "server", chat->server); - g_hash_table_replace(components, "handle", chat->handle); - if(args[1]) - g_hash_table_replace(components, "password", args[1]); - - jabber_chat_join(purple_conversation_get_gc(conv), components); - - g_hash_table_destroy(components); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_kick(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if(!jabber_chat_kick_user(chat, args[0], args[1])) { - *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - char *who; - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); - - jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); - - g_free(who); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_ping(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleAccount *account; - PurpleConnection *pc; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - account = purple_conversation_get_account(conv); - pc = purple_account_get_connection(account); - - if(!jabber_ping_jid(purple_connection_get_protocol_data(pc), args[0])) { - *error = g_strdup_printf(_("Unable to ping user %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - -static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char **error) { - - JabberBuddy *jb; - JabberBuddyResource *jbr; - PurpleConnection *gc = js->gc; - PurpleBuddy *buddy = - purple_find_buddy(purple_connection_get_account(gc), username); - const gchar *alias = - buddy ? purple_buddy_get_contact_alias(buddy) : username; - - if(!username) - return FALSE; - - jb = jabber_buddy_find(js, username, FALSE); - if(!jb) { - *error = g_strdup_printf(_("Unable to buzz, because there is nothing " - "known about %s."), alias); - return FALSE; - } - - jbr = jabber_buddy_find_resource(jb, NULL); - if (!jbr) { - *error = g_strdup_printf(_("Unable to buzz, because %s might be offline."), - alias); - return FALSE; - } - - if (jabber_resource_has_capability(jbr, NS_ATTENTION)) { - xmlnode *buzz, *msg = xmlnode_new("message"); - gchar *to; - - to = g_strdup_printf("%s/%s", username, jbr->name); - xmlnode_set_attrib(msg, "to", to); - g_free(to); - - /* avoid offline storage */ - xmlnode_set_attrib(msg, "type", "headline"); - - buzz = xmlnode_new_child(msg, "attention"); - xmlnode_set_namespace(buzz, NS_ATTENTION); - - jabber_send(js, msg); - xmlnode_free(msg); - - return TRUE; - } else { - *error = g_strdup_printf(_("Unable to buzz, because %s does " - "not support it or does not wish to receive buzzes now."), alias); - return FALSE; - } -} - -static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberStream *js = conv->account->gc->proto_data; - const gchar *who; - - if (!args || !args[0]) { - /* use the buddy from conversation, if it's a one-to-one conversation */ - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - who = purple_conversation_get_name(conv); - } else { - return PURPLE_CMD_RET_FAILED; - } - } else { - who = args[0]; - } - - if (_jabber_send_buzz(js, who, error)) { - const gchar *alias; - gchar *str; - PurpleBuddy *buddy = - purple_find_buddy(purple_connection_get_account(conv->account->gc), - who); - - if (buddy != NULL) - alias = purple_buddy_get_contact_alias(buddy); - else - alias = who; - - str = g_strdup_printf(_("Buzzing %s..."), alias); - purple_conversation_write(conv, NULL, str, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); - g_free(str); - - return PURPLE_CMD_RET_OK; - } else { - return PURPLE_CMD_RET_FAILED; - } -} - -GList *jabber_attention_types(PurpleAccount *account) -{ - static GList *types = NULL; - - if (!types) { - types = g_list_append(types, purple_attention_type_new("Buzz", _("Buzz"), - _("%s has buzzed you!"), _("Buzzing %s..."))); - } - - return types; -} - -gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code) -{ - JabberStream *js = gc->proto_data; - gchar *error = NULL; - - if (!_jabber_send_buzz(js, username, &error)) { - purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)"); - g_free(error); - return FALSE; - } - - return TRUE; -} - - -gboolean jabber_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -#ifdef USE_VV -gboolean -jabber_audio_enabled(JabberStream *js, const char *namespace) -{ - PurpleMediaManager *manager = purple_media_manager_get(); - PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); - - return (caps & (PURPLE_MEDIA_CAPS_AUDIO | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION)); -} - -gboolean -jabber_video_enabled(JabberStream *js, const char *namespace) -{ - PurpleMediaManager *manager = purple_media_manager_get(); - PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); - - return (caps & (PURPLE_MEDIA_CAPS_VIDEO | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION)); -} - -typedef struct { - PurpleAccount *account; - gchar *who; - PurpleMediaSessionType type; - -} JabberMediaRequest; - -static void -jabber_media_cancel_cb(JabberMediaRequest *request, - PurpleRequestFields *fields) -{ - g_free(request->who); - g_free(request); -} - -static void -jabber_media_ok_cb(JabberMediaRequest *request, PurpleRequestFields *fields) -{ - PurpleRequestField *field = - purple_request_fields_get_field(fields, "resource"); - int selected_id = purple_request_field_choice_get_value(field); - GList *labels = purple_request_field_choice_get_labels(field); - gchar *who = g_strdup_printf("%s/%s", request->who, - (gchar*)g_list_nth_data(labels, selected_id)); - jabber_initiate_media(request->account, who, request->type); - - g_free(who); - g_free(request->who); - g_free(request); -} -#endif - -gboolean -jabber_initiate_media(PurpleAccount *account, const char *who, - PurpleMediaSessionType type) -{ -#ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - char *resource; - - if (!js) { - purple_debug_error("jabber", - "jabber_initiate_media: NULL stream\n"); - return FALSE; - } - - - if((resource = jabber_get_resource(who)) != NULL) { - /* they've specified a resource, no need to ask or - * default or anything, just do it */ - - jb = jabber_buddy_find(js, who, FALSE); - jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); - - if (type & PURPLE_MEDIA_AUDIO && - !jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_AUDIO) && - jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) - return jabber_google_session_initiate(js, who, type); - else - return jingle_rtp_initiate_media(js, who, type); - } - - jb = jabber_buddy_find(js, who, FALSE); - - if(!jb || !jb->resources) { - /* no resources online, we're trying to initiate with someone - * whose presence we're not subscribed to, or - * someone who is offline. Let's inform the user */ - char *msg; - - if(!jb) { - msg = g_strdup_printf(_("Unable to initiate media with %s: invalid JID"), who); - } else if(jb->subscription & JABBER_SUB_TO) { - msg = g_strdup_printf(_("Unable to initiate media with %s: user is not online"), who); - } else { - msg = g_strdup_printf(_("Unable to initiate media with %s: not subscribed to user presence"), who); - } - - purple_notify_error(account, _("Media Initiation Failed"), - _("Media Initiation Failed"), msg); - g_free(msg); - return FALSE; - } else if(!jb->resources->next) { - /* only 1 resource online (probably our most common case) - * so no need to ask who to initiate with */ - gchar *name; - gboolean result; - jbr = jb->resources->data; - name = g_strdup_printf("%s/%s", who, jbr->name); - result = jabber_initiate_media(account, name, type); - g_free(name); - return result; - } else { - /* we've got multiple resources, - * we need to pick one to initiate with */ - GList *l; - char *msg; - PurpleRequestFields *fields; - PurpleRequestField *field = purple_request_field_choice_new( - "resource", _("Resource"), 0); - PurpleRequestFieldGroup *group; - JabberMediaRequest *request; - - for(l = jb->resources; l; l = l->next) - { - JabberBuddyResource *ljbr = l->data; - PurpleMediaCaps caps; - gchar *name; - name = g_strdup_printf("%s/%s", who, ljbr->name); - caps = jabber_get_media_caps(account, name); - g_free(name); - - if ((type & PURPLE_MEDIA_AUDIO) && - (type & PURPLE_MEDIA_VIDEO)) { - if (caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO) { - jbr = ljbr; - purple_request_field_choice_add( - field, jbr->name); - } - } else if (type & (PURPLE_MEDIA_AUDIO) && - (caps & PURPLE_MEDIA_CAPS_AUDIO)) { - jbr = ljbr; - purple_request_field_choice_add( - field, jbr->name); - }else if (type & (PURPLE_MEDIA_VIDEO) && - (caps & PURPLE_MEDIA_CAPS_VIDEO)) { - jbr = ljbr; - purple_request_field_choice_add( - field, jbr->name); - } - } - - if (jbr == NULL) { - purple_debug_error("jabber", - "No resources available\n"); - return FALSE; - } - - if (g_list_length(purple_request_field_choice_get_labels( - field)) <= 1) { - gchar *name; - gboolean result; - purple_request_field_destroy(field); - name = g_strdup_printf("%s/%s", who, jbr->name); - result = jabber_initiate_media(account, name, type); - g_free(name); - return result; - } - - msg = g_strdup_printf(_("Please select the resource of %s with which you would like to start a media session."), who); - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - request = g_new0(JabberMediaRequest, 1); - request->account = account; - request->who = g_strdup(who); - request->type = type; - - purple_request_field_group_add_field(group, field); - purple_request_fields_add_group(fields, group); - purple_request_fields(account, _("Select a Resource"), msg, - NULL, fields, _("Initiate Media"), - G_CALLBACK(jabber_media_ok_cb), _("Cancel"), - G_CALLBACK(jabber_media_cancel_cb), - account, who, NULL, request); - - g_free(msg); - return TRUE; - } -#endif - return FALSE; -} - -PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) -{ -#ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; - JabberBuddy *jb; - JabberBuddyResource *jbr; - PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; - gchar *resource; - - if (!js) { - purple_debug_info("jabber", - "jabber_can_do_media: NULL stream\n"); - return FALSE; - } - - if ((resource = jabber_get_resource(who)) != NULL) { - /* they've specified a resource, no need to ask or - * default or anything, just do it */ - - jb = jabber_buddy_find(js, who, FALSE); - jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); - - if (!jbr) { - purple_debug_error("jabber", "jabber_get_media_caps:" - " Can't find resource %s\n", who); - return caps; - } - - if (jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_AUDIO)) - caps |= PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | - PURPLE_MEDIA_CAPS_AUDIO; - if (jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_VIDEO)) - caps |= PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | - PURPLE_MEDIA_CAPS_VIDEO; - if (caps & PURPLE_MEDIA_CAPS_AUDIO && caps & - PURPLE_MEDIA_CAPS_VIDEO) - caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; - if (caps != PURPLE_MEDIA_CAPS_NONE) { - if (!jabber_resource_has_capability(jbr, - JINGLE_TRANSPORT_ICEUDP) && - !jabber_resource_has_capability(jbr, - JINGLE_TRANSPORT_RAWUDP)) { - purple_debug_info("jingle-rtp", "Buddy doesn't " - "support the same transport types\n"); - caps = PURPLE_MEDIA_CAPS_NONE; - } else - caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | - PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; - } - if (jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) { - caps |= PURPLE_MEDIA_CAPS_AUDIO; - if (jabber_resource_has_capability(jbr, NS_GOOGLE_VIDEO)) - caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; - } - return caps; - } - - jb = jabber_buddy_find(js, who, FALSE); - - if(!jb || !jb->resources) { - /* no resources online, we're trying to get caps for someone - * whose presence we're not subscribed to, or - * someone who is offline. */ - return caps; - } else if(!jb->resources->next) { - /* only 1 resource online (probably our most common case) */ - gchar *name; - jbr = jb->resources->data; - name = g_strdup_printf("%s/%s", who, jbr->name); - caps = jabber_get_media_caps(account, name); - g_free(name); - } else { - /* we've got multiple resources, combine their caps */ - GList *l; - - for(l = jb->resources; l; l = l->next) - { - gchar *name; - jbr = l->data; - name = g_strdup_printf("%s/%s", who, jbr->name); - caps |= jabber_get_media_caps(account, name); - g_free(name); - } - } - - return caps; -#else - return PURPLE_MEDIA_CAPS_NONE; -#endif -} - -gboolean jabber_can_receive_file(PurpleConnection *gc, const char *who) -{ - JabberStream *js = gc->proto_data; - - if (js) { - JabberBuddy *jb = jabber_buddy_find(js, who, FALSE); - GList *iter; - gboolean has_resources_without_caps = FALSE; - - /* if we didn't find a JabberBuddy, we don't have presence for this - buddy, let's assume they can receive files, disco should tell us - when actually trying */ - if (jb == NULL) - return TRUE; - - /* find out if there is any resources without caps */ - for (iter = jb->resources; iter ; iter = g_list_next(iter)) { - JabberBuddyResource *jbr = (JabberBuddyResource *) iter->data; - - if (!jabber_resource_know_capabilities(jbr)) { - has_resources_without_caps = TRUE; - } - } - - if (has_resources_without_caps) { - /* there is at least one resource which we don't have caps for, - let's assume they can receive files... */ - return TRUE; - } else { - /* we have caps for all the resources, see if at least one has - right caps */ - for (iter = jb->resources; iter ; iter = g_list_next(iter)) { - JabberBuddyResource *jbr = (JabberBuddyResource *) iter->data; - - if (jabber_resource_has_capability(jbr, - "http://jabber.org/protocol/si/profile/file-transfer") - && (jabber_resource_has_capability(jbr, - NS_BYTESTREAMS) - || jabber_resource_has_capability(jbr, NS_IBB))) { - return TRUE; - } - } - return FALSE; - } - } else { - return TRUE; - } -} - -void jabber_register_commands(void) -{ - PurpleCmdId id; - id = purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_config, - _("config: Configure a chat room."), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_config, - _("configure: Configure a chat room."), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_nick, - _("nick <new nickname>: Change your nickname."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_part, _("part [message]: Leave the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("register", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_register, - _("register: Register with a chat room."), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - /* XXX: there needs to be a core /topic cmd, methinks */ - id = purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_topic, - _("topic [new topic]: View or change the topic."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_ban, - _("ban <user> [reason]: Ban a user from the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_affiliate, - _("affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get the users with an affiliation or set users' affiliation with the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_role, - _("role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the users with a role or set users' role with the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_invite, - _("invite <user> [message]: Invite a user to the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_join, - _("join: <room> [password]: Join a chat on this server."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_kick, - _("kick <user> [reason]: Kick a user from the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_msg, - _("msg <user> <message>: Send a private message to another user."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("ping", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_ping, - _("ping <jid>: Ping a user/component/server."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-jabber", jabber_cmd_buzz, - _("buzz: Buzz a user to get their attention"), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); -} - -void jabber_unregister_commands(void) -{ - while (jabber_cmds != NULL) { - purple_cmd_unregister(GPOINTER_TO_UINT(jabber_cmds->data)); - jabber_cmds = g_slist_delete_link(jabber_cmds, jabber_cmds); - } -} - -/* IPC functions */ - -/** - * IPC function for determining if a contact supports a certain feature. - * - * @param account The PurpleAccount - * @param jid The full JID of the contact. - * @param feature The feature's namespace. - * - * @return TRUE if supports feature; else FALSE. - */ -static gboolean -jabber_ipc_contact_has_feature(PurpleAccount *account, const gchar *jid, - const gchar *feature) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - JabberBuddy *jb; - JabberBuddyResource *jbr; - gchar *resource; - - if (!purple_account_is_connected(account)) - return FALSE; - js = gc->proto_data; - - if (!(resource = jabber_get_resource(jid)) || - !(jb = jabber_buddy_find(js, jid, FALSE)) || - !(jbr = jabber_buddy_find_resource(jb, resource))) { - g_free(resource); - return FALSE; - } - - g_free(resource); - - return jabber_resource_has_capability(jbr, feature); -} - -static void -jabber_ipc_add_feature(const gchar *feature) -{ - if (!feature) - return; - jabber_add_feature(feature, 0); - - /* send presence with new caps info for all connected accounts */ - jabber_caps_broadcast_change(); -} - -void -jabber_init_plugin(PurplePlugin *plugin) -{ - GHashTable *ui_info = purple_core_get_ui_info(); - const gchar *ui_type; - const gchar *type = "pc"; /* default client type, if unknown or - unspecified */ - const gchar *ui_name = NULL; - - ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; - if (ui_type) { - if (strcmp(ui_type, "pc") == 0 || - strcmp(ui_type, "console") == 0 || - strcmp(ui_type, "phone") == 0 || - strcmp(ui_type, "handheld") == 0 || - strcmp(ui_type, "web") == 0 || - strcmp(ui_type, "bot") == 0) { - type = ui_type; - } - } - - if (ui_info) - ui_name = g_hash_table_lookup(ui_info, "name"); - if (ui_name == NULL) - ui_name = PACKAGE; - - jabber_add_identity("client", type, NULL, ui_name); - - /* initialize jabber_features list */ - jabber_add_feature(NS_LAST_ACTIVITY, 0); - jabber_add_feature(NS_OOB_IQ_DATA, 0); - jabber_add_feature(NS_ENTITY_TIME, 0); - jabber_add_feature("jabber:iq:version", 0); - jabber_add_feature("jabber:x:conference", 0); - jabber_add_feature(NS_BYTESTREAMS, 0); - jabber_add_feature("http://jabber.org/protocol/caps", 0); - jabber_add_feature("http://jabber.org/protocol/chatstates", 0); - jabber_add_feature(NS_DISCO_INFO, 0); - jabber_add_feature(NS_DISCO_ITEMS, 0); - jabber_add_feature(NS_IBB, 0); - jabber_add_feature("http://jabber.org/protocol/muc", 0); - jabber_add_feature("http://jabber.org/protocol/muc#user", 0); - jabber_add_feature("http://jabber.org/protocol/si", 0); - jabber_add_feature("http://jabber.org/protocol/si/profile/file-transfer", 0); - jabber_add_feature(NS_XHTML_IM, 0); - jabber_add_feature(NS_PING, 0); - - /* Buzz/Attention */ - jabber_add_feature(NS_ATTENTION, jabber_buzz_isenabled); - - /* Bits Of Binary */ - jabber_add_feature(NS_BOB, 0); - - /* Jingle features! */ - jabber_add_feature(JINGLE, 0); - -#ifdef USE_VV - jabber_add_feature(NS_GOOGLE_PROTOCOL_SESSION, jabber_audio_enabled); - jabber_add_feature(NS_GOOGLE_VOICE, jabber_audio_enabled); - jabber_add_feature(NS_GOOGLE_VIDEO, jabber_video_enabled); - jabber_add_feature(NS_GOOGLE_CAMERA, jabber_video_enabled); - jabber_add_feature(JINGLE_APP_RTP, 0); - jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled); - jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled); - jabber_add_feature(JINGLE_TRANSPORT_RAWUDP, 0); - jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, 0); -#endif - - /* IPC functions */ - purple_plugin_ipc_register(plugin, "contact_has_feature", PURPLE_CALLBACK(jabber_ipc_contact_has_feature), - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_plugin_ipc_register(plugin, "add_feature", PURPLE_CALLBACK(jabber_ipc_add_feature), - purple_marshal_VOID__POINTER, - NULL, 1, - purple_value_new(PURPLE_TYPE_STRING)); - - /* Modifying these? Look at libxmpp.c:load_plugin for the signal versions */ - purple_plugin_ipc_register(plugin, "register_namespace_watcher", - PURPLE_CALLBACK(jabber_iq_signal_register), - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ - - purple_plugin_ipc_register(plugin, "unregister_namespace_watcher", - PURPLE_CALLBACK(jabber_iq_signal_unregister), - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ -} - -void -jabber_uninit_plugin(PurplePlugin *plugin) -{ - purple_plugin_ipc_unregister_all(plugin); - - jabber_features_destroy(); - jabber_identities_destroy(); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jabber.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,381 +0,0 @@ -/** - * @file jabber.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_H_ -#define PURPLE_JABBER_H_ - -typedef enum { - JABBER_CAP_NONE = 0, -/* JABBER_CAP_XHTML = 1 << 0, */ -/* JABBER_CAP_COMPOSING = 1 << 1, */ - JABBER_CAP_SI = 1 << 2, - JABBER_CAP_SI_FILE_XFER = 1 << 3, - JABBER_CAP_BYTESTREAMS = 1 << 4, - JABBER_CAP_IBB = 1 << 5, - JABBER_CAP_CHAT_STATES = 1 << 6, - JABBER_CAP_IQ_SEARCH = 1 << 7, - JABBER_CAP_IQ_REGISTER = 1 << 8, - - /* Google Talk extensions: - * http://code.google.com/apis/talk/jep_extensions/extensions.html - */ - JABBER_CAP_GMAIL_NOTIFY = 1 << 9, - JABBER_CAP_GOOGLE_ROSTER = 1 << 10, - - JABBER_CAP_PING = 1 << 11, - JABBER_CAP_ADHOC = 1 << 12, - JABBER_CAP_BLOCKING = 1 << 13, - - JABBER_CAP_ITEMS = 1 << 14, - - JABBER_CAP_RETRIEVED = 1 << 31 -} JabberCapabilities; - -typedef struct _JabberStream JabberStream; - -#include <libxml/parser.h> -#include <glib.h> -#include "circbuffer.h" -#include "connection.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "media.h" -#include "mediamanager.h" -#include "roomlist.h" -#include "sslconn.h" - -#include "namespaces.h" - -#include "iq.h" -#include "jutil.h" -#include "xmlnode.h" -#include "buddy.h" -#include "bosh.h" - -#ifdef HAVE_CYRUS_SASL -#include <sasl/sasl.h> -#endif - -#define CAPS0115_NODE "http://pidgin.im/" - -#define JABBER_DEFAULT_REQUIRE_TLS TRUE - -/* Index into attention_types list */ -#define JABBER_BUZZ 0 - -typedef enum { - JABBER_STREAM_OFFLINE, - JABBER_STREAM_CONNECTING, - JABBER_STREAM_INITIALIZING, - JABBER_STREAM_INITIALIZING_ENCRYPTION, - JABBER_STREAM_AUTHENTICATING, - JABBER_STREAM_POST_AUTH, - JABBER_STREAM_CONNECTED -} JabberStreamState; - -struct _JabberStream -{ - int fd; - - PurpleSrvQueryData *srv_query_data; - - xmlParserCtxt *context; - xmlnode *current; - - enum { - JABBER_PROTO_0_9, - JABBER_PROTO_1_0 - } protocol_version; - enum { - JABBER_AUTH_UNKNOWN, - JABBER_AUTH_DIGEST_MD5, - JABBER_AUTH_PLAIN, - JABBER_AUTH_IQ_AUTH, - JABBER_AUTH_CYRUS - } auth_type; - char *stream_id; - JabberStreamState state; - - /* SASL authentication */ - char *expected_rspauth; - - GHashTable *buddies; - - /* - * This boolean was added to eliminate a heinous bug where we would - * get into a loop with the server and move a buddy back and forth - * from one group to another. - * - * The sequence goes something like this: - * 1. Our resource and another resource both approve an authorization - * request at the exact same time. We put the buddy in group A and - * the other resource put the buddy in group B. - * 2. The server receives the roster add for group B and sends us a - * roster push. - * 3. We receive this roster push and modify our local blist. This - * triggers us to send a roster add for group B. - * 4. The server recieves our earlier roster add for group A and sends - * us a roster push. - * 5. We receive this roster push and modify our local blist. This - * triggers us to send a roster add for group A. - * 6. The server receives our earlier roster add for group B and sends - * us a roster push. - * (repeat steps 3 through 6 ad infinitum) - * - * This boolean is used to short-circuit the sending of a roster add - * when we receive a roster push. - * - * See these bug reports: - * http://trac.adiumx.com/ticket/8834 - * http://developer.pidgin.im/ticket/5484 - * http://developer.pidgin.im/ticket/6188 - */ - gboolean currently_parsing_roster_push; - - GHashTable *chats; - GList *chat_servers; - PurpleRoomlist *roomlist; - GList *user_directories; - - GHashTable *iq_callbacks; - int next_id; - - GList *bs_proxies; - GList *oob_file_transfers; - GList *file_transfers; - - time_t idle; - time_t old_idle; - - JabberID *user; - JabberBuddy *user_jb; - - PurpleConnection *gc; - PurpleSslConnection *gsc; - - gboolean registration; - - char *initial_avatar_hash; - char *avatar_hash; - GSList *pending_avatar_requests; - - GSList *pending_buddy_info_requests; - - PurpleCircBuffer *write_buffer; - guint writeh; - - gboolean reinit; - - JabberCapabilities server_caps; - gboolean googletalk; - char *server_name; - - char *gmail_last_time; - char *gmail_last_tid; - - char *serverFQDN; - -#ifdef HAVE_CYRUS_SASL - sasl_conn_t *sasl; - sasl_callback_t *sasl_cb; - const char *current_mech; - int auth_fail_count; - - int sasl_state; - int sasl_maxbuf; - GString *sasl_mechs; -#endif - - gboolean unregistration; - PurpleAccountUnregistrationCb unregistration_cb; - void *unregistration_user_data; - - gboolean vcard_fetched; - /* Timer at login to push updated avatar */ - guint vcard_timer; - - /* Entity Capabilities hash */ - char *caps_hash; - - /* does the local server support PEP? */ - gboolean pep; - - /* Is Buzz enabled? */ - gboolean allowBuzz; - - /* A list of JabberAdHocCommands supported by the server */ - GList *commands; - - /* last presence update to check for differences */ - JabberBuddyState old_state; - char *old_msg; - int old_priority; - char *old_avatarhash; - - /* same for user tune */ - char *old_artist; - char *old_title; - char *old_source; - char *old_uri; - int old_length; - char *old_track; - - char *certificate_CN; - - /* A purple timeout tag for the keepalive */ - guint keepalive_timeout; - - PurpleSrvResponse *srv_rec; - guint srv_rec_idx; - guint max_srv_rec_idx; - - /* BOSH stuff */ - PurpleBOSHConnection *bosh; - - /** - * This linked list contains PurpleUtilFetchUrlData structs - * for when we lookup buddy icons from a url - */ - GSList *url_datas; - - /* keep a hash table of JingleSessions */ - GHashTable *sessions; - - /* maybe this should only be present when USE_VV? */ - gchar *stun_ip; - int stun_port; - PurpleDnsQueryData *stun_query; - /* later add stuff to handle TURN relays... */ -}; - -typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *namespace); - -typedef struct _JabberFeature -{ - gchar *namespace; - JabberFeatureEnabled *is_enabled; -} JabberFeature; - -typedef struct _JabberIdentity -{ - gchar *category; - gchar *type; - gchar *name; - gchar *lang; -} JabberIdentity; - -typedef struct _JabberBytestreamsStreamhost { - char *jid; - char *host; - int port; - char *zeroconf; -} JabberBytestreamsStreamhost; - -/* what kind of additional features as returned from disco#info are supported? */ -extern GList *jabber_features; -extern GList *jabber_identities; - -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet); -void jabber_process_packet(JabberStream *js, xmlnode **packet); -void jabber_send(JabberStream *js, xmlnode *data); -void jabber_send_raw(JabberStream *js, const char *data, int len); -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, - gpointer unused); - -void jabber_stream_set_state(JabberStream *js, JabberStreamState state); - -void jabber_register_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); -void jabber_register_start(JabberStream *js); - -char *jabber_get_next_id(JabberStream *js); - -/** Parse an error into a human-readable string and optionally a disconnect - * reason. - * @param js the stream on which the error occurred. - * @param packet the error packet - * @param reason where to store the disconnection reason, or @c NULL if you - * don't care or you don't intend to close the connection. - */ -char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason); - -void jabber_add_feature(const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */ -void jabber_remove_feature(const gchar *namespace); - -/** Adds an identity to this jabber library instance. For list of valid values visit the - * website of the XMPP Registrar ( http://www.xmpp.org/registrar/disco-categories.html#client ). - * @param category the category of the identity. - * @param type the type of the identity. - * @param language the language localization of the name. Can be NULL. - * @param name the name of the identity. - */ -void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name); - -/** - * Returns true if this connection is over a secure (SSL) stream. Use this - * instead of checking js->gsc because BOSH stores its PurpleSslConnection - * members in its own data structure. - */ -gboolean jabber_stream_is_ssl(JabberStream *js); - -/** PRPL functions */ -const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); -const char* jabber_list_emblem(PurpleBuddy *b); -char *jabber_status_text(PurpleBuddy *b); -void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -GList *jabber_status_types(PurpleAccount *account); -void jabber_login(PurpleAccount *account); -void jabber_close(PurpleConnection *gc); -void jabber_idle_set(PurpleConnection *gc, int idle); -void jabber_blocklist_parse_push(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child); -void jabber_request_block_list(JabberStream *js); -void jabber_add_deny(PurpleConnection *gc, const char *who); -void jabber_rem_deny(PurpleConnection *gc, const char *who); -void jabber_keepalive(PurpleConnection *gc); -void jabber_register_gateway(JabberStream *js, const char *gateway); -void jabber_register_account(PurpleAccount *account); -void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data); -gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code); -GList *jabber_attention_types(PurpleAccount *account); -void jabber_convo_closed(PurpleConnection *gc, const char *who); -PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name); -gboolean jabber_offline_message(const PurpleBuddy *buddy); -int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); -GList *jabber_actions(PurplePlugin *plugin, gpointer context); - -gboolean jabber_audio_enabled(JabberStream *js, const char *unused); -gboolean jabber_video_enabled(JabberStream *js, const char *unused); -gboolean jabber_initiate_media(PurpleAccount *account, const char *who, - PurpleMediaSessionType type); -PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who); -gboolean jabber_can_receive_file(PurpleConnection *gc, const gchar *who); - -void jabber_register_commands(void); -void jabber_unregister_commands(void); - -void jabber_init_plugin(PurplePlugin *plugin); -void jabber_uninit_plugin(PurplePlugin *plugin); - -#endif /* PURPLE_JABBER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,465 +0,0 @@ -/** - * @file content.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "content.h" -#include "jingle.h" - -#include <string.h> - -struct _JingleContentPrivate -{ - JingleSession *session; - gchar *description_type; - gchar *creator; - gchar *disposition; - gchar *name; - gchar *senders; - JingleTransport *transport; - JingleTransport *pending_transport; -}; - -#define JINGLE_CONTENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_CONTENT, JingleContentPrivate)) - -static void jingle_content_class_init (JingleContentClass *klass); -static void jingle_content_init (JingleContent *content); -static void jingle_content_finalize (GObject *object); -static void jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static xmlnode *jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); -static JingleContent *jingle_content_parse_internal(xmlnode *content); - -static GObjectClass *parent_class = NULL; - -enum { - PROP_0, - PROP_SESSION, - PROP_CREATOR, - PROP_DISPOSITION, - PROP_NAME, - PROP_SENDERS, - PROP_TRANSPORT, - PROP_PENDING_TRANSPORT, -}; - -GType -jingle_content_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleContentClass), - NULL, - NULL, - (GClassInitFunc) jingle_content_class_init, - NULL, - NULL, - sizeof(JingleContent), - 0, - (GInstanceInitFunc) jingle_content_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "JingleContent", &info, 0); - } - return type; -} - -static void -jingle_content_class_init (JingleContentClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_content_finalize; - gobject_class->set_property = jingle_content_set_property; - gobject_class->get_property = jingle_content_get_property; - klass->to_xml = jingle_content_to_xml_internal; - klass->parse = jingle_content_parse_internal; - - g_object_class_install_property(gobject_class, PROP_SESSION, - g_param_spec_object("session", - "Jingle Session", - "The jingle session parent of this content.", - JINGLE_TYPE_SESSION, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_CREATOR, - g_param_spec_string("creator", - "Creator", - "The participant that created this content.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_DISPOSITION, - g_param_spec_string("disposition", - "Disposition", - "The disposition of the content.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_NAME, - g_param_spec_string("name", - "Name", - "The name of this content.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_SENDERS, - g_param_spec_string("senders", - "Senders", - "The sender of this content.", - NULL, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_TRANSPORT, - g_param_spec_object("transport", - "transport", - "The transport of this content.", - JINGLE_TYPE_TRANSPORT, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT, - g_param_spec_object("pending-transport", - "Pending transport", - "The pending transport contained within this content", - JINGLE_TYPE_TRANSPORT, - G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(JingleContentPrivate)); -} - -static void -jingle_content_init (JingleContent *content) -{ - content->priv = JINGLE_CONTENT_GET_PRIVATE(content); - memset(content->priv, 0, sizeof(*content->priv)); -} - -static void -jingle_content_finalize (GObject *content) -{ - JingleContentPrivate *priv = JINGLE_CONTENT_GET_PRIVATE(content); - purple_debug_info("jingle","jingle_content_finalize\n"); - - g_free(priv->description_type); - g_free(priv->creator); - g_free(priv->disposition); - g_free(priv->name); - g_free(priv->senders); - g_object_unref(priv->transport); - if (priv->pending_transport) - g_object_unref(priv->pending_transport); - - parent_class->finalize(content); -} - -static void -jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleContent *content; - g_return_if_fail(JINGLE_IS_CONTENT(object)); - - content = JINGLE_CONTENT(object); - - switch (prop_id) { - case PROP_SESSION: - content->priv->session = g_value_get_object(value); - break; - case PROP_CREATOR: - g_free(content->priv->creator); - content->priv->creator = g_value_dup_string(value); - break; - case PROP_DISPOSITION: - g_free(content->priv->disposition); - content->priv->disposition = g_value_dup_string(value); - break; - case PROP_NAME: - g_free(content->priv->name); - content->priv->name = g_value_dup_string(value); - break; - case PROP_SENDERS: - g_free(content->priv->senders); - content->priv->senders = g_value_dup_string(value); - break; - case PROP_TRANSPORT: - if (content->priv->transport) - g_object_unref(content->priv->transport); - content->priv->transport = g_value_get_object(value); - break; - case PROP_PENDING_TRANSPORT: - if (content->priv->pending_transport) - g_object_unref(content->priv->pending_transport); - content->priv->pending_transport = g_value_get_object(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleContent *content; - g_return_if_fail(JINGLE_IS_CONTENT(object)); - - content = JINGLE_CONTENT(object); - - switch (prop_id) { - case PROP_SESSION: - g_value_set_object(value, content->priv->session); - break; - case PROP_CREATOR: - g_value_set_string(value, content->priv->creator); - break; - case PROP_DISPOSITION: - g_value_set_string(value, content->priv->disposition); - break; - case PROP_NAME: - g_value_set_string(value, content->priv->name); - break; - case PROP_SENDERS: - g_value_set_string(value, content->priv->senders); - break; - case PROP_TRANSPORT: - g_value_set_object(value, content->priv->transport); - break; - case PROP_PENDING_TRANSPORT: - g_value_set_object(value, content->priv->pending_transport); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -JingleContent * -jingle_content_create(const gchar *type, const gchar *creator, - const gchar *disposition, const gchar *name, - const gchar *senders, JingleTransport *transport) -{ - - - JingleContent *content = g_object_new(jingle_get_type(type), - "creator", creator, - "disposition", disposition != NULL ? disposition : "session", - "name", name, - "senders", senders != NULL ? senders : "both", - "transport", transport, - NULL); - return content; -} - -JingleSession *jingle_content_get_session(JingleContent *content) -{ - JingleSession *session; - g_object_get(content, "session", &session, NULL); - return session; -} - -const gchar * -jingle_content_get_description_type(JingleContent *content) -{ - return JINGLE_CONTENT_GET_CLASS(content)->description_type; -} - -gchar * -jingle_content_get_creator(JingleContent *content) -{ - gchar *creator; - g_object_get(content, "creator", &creator, NULL); - return creator; -} - -gchar * -jingle_content_get_disposition(JingleContent *content) -{ - gchar *disposition; - g_object_get(content, "disposition", &disposition, NULL); - return disposition; -} - -gchar * -jingle_content_get_name(JingleContent *content) -{ - gchar *name; - g_object_get(content, "name", &name, NULL); - return name; -} - -gchar * -jingle_content_get_senders(JingleContent *content) -{ - gchar *senders; - g_object_get(content, "senders", &senders, NULL); - return senders; -} - -JingleTransport * -jingle_content_get_transport(JingleContent *content) -{ - JingleTransport *transport; - g_object_get(content, "transport", &transport, NULL); - return transport; -} - -void -jingle_content_set_session(JingleContent *content, JingleSession *session) -{ - g_return_if_fail(JINGLE_IS_CONTENT(content)); - g_return_if_fail(JINGLE_IS_SESSION(session)); - g_object_set(content, "session", session, NULL); -} - -JingleTransport * -jingle_content_get_pending_transport(JingleContent *content) -{ - JingleTransport *pending_transport; - g_object_get(content, "pending_transport", &pending_transport, NULL); - return pending_transport; -} - -void -jingle_content_set_pending_transport(JingleContent *content, JingleTransport *transport) -{ - g_object_set(content, "pending-transport", transport, NULL); -} - -void -jingle_content_accept_transport(JingleContent *content) -{ - if (content->priv->transport) - g_object_unref(content->priv->transport); - content->priv->transport = content->priv->pending_transport; - content->priv->pending_transport = NULL; -} - -void -jingle_content_remove_pending_transport(JingleContent *content) -{ - if (content->priv->pending_transport) { - g_object_unref(content->priv->pending_transport); - content->priv->pending_transport = NULL; - } -} - -void -jingle_content_modify(JingleContent *content, const gchar *senders) -{ - g_object_set(content, "senders", senders, NULL); -} - -static JingleContent * -jingle_content_parse_internal(xmlnode *content) -{ - xmlnode *description = xmlnode_get_child(content, "description"); - const gchar *type = xmlnode_get_namespace(description); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - const gchar *disposition = xmlnode_get_attrib(content, "disposition"); - const gchar *senders = xmlnode_get_attrib(content, "senders"); - const gchar *name = xmlnode_get_attrib(content, "name"); - JingleTransport *transport = - jingle_transport_parse(xmlnode_get_child(content, "transport")); - - if (senders == NULL) - senders = "both"; - - return jingle_content_create(type, creator, disposition, name, senders, transport); -} - -JingleContent * -jingle_content_parse(xmlnode *content) -{ - const gchar *type = xmlnode_get_namespace(xmlnode_get_child(content, "description")); - GType jingle_type = jingle_get_type(type); - - if (jingle_type != G_TYPE_NONE) { - return JINGLE_CONTENT_CLASS(g_type_class_ref(jingle_type))->parse(content); - } else { - return NULL; - } -} - -static xmlnode * -jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleActionType action) -{ - xmlnode *node = xmlnode_new_child(jingle, "content"); - gchar *creator = jingle_content_get_creator(content); - gchar *name = jingle_content_get_name(content); - gchar *senders = jingle_content_get_senders(content); - gchar *disposition = jingle_content_get_disposition(content); - - xmlnode_set_attrib(node, "creator", creator); - xmlnode_set_attrib(node, "name", name); - xmlnode_set_attrib(node, "senders", senders); - if (strcmp("session", disposition)) - xmlnode_set_attrib(node, "disposition", disposition); - - g_free(disposition); - g_free(senders); - g_free(name); - g_free(creator); - - if (action != JINGLE_CONTENT_REMOVE) { - JingleTransport *transport; - - if (action != JINGLE_TRANSPORT_ACCEPT && - action != JINGLE_TRANSPORT_INFO && - action != JINGLE_TRANSPORT_REJECT && - action != JINGLE_TRANSPORT_REPLACE) { - xmlnode *description = xmlnode_new_child(node, "description"); - - xmlnode_set_namespace(description, - jingle_content_get_description_type(content)); - } - - if (action != JINGLE_TRANSPORT_REJECT && action == JINGLE_TRANSPORT_REPLACE) - transport = jingle_content_get_pending_transport(content); - else - transport = jingle_content_get_transport(content); - - jingle_transport_to_xml(transport, node, action); - g_object_unref(transport); - } - - return node; -} - -xmlnode * -jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action) -{ - g_return_val_if_fail(JINGLE_IS_CONTENT(content), NULL); - return JINGLE_CONTENT_GET_CLASS(content)->to_xml(content, jingle, action); -} - -void -jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) -{ - g_return_if_fail(JINGLE_IS_CONTENT(content)); - JINGLE_CONTENT_GET_CLASS(content)->handle_action(content, xmlcontent, action); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/content.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,121 +0,0 @@ -/** - * @file content.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_CONTENT_H -#define PURPLE_JABBER_JINGLE_CONTENT_H - - -#include "jabber.h" -#include "jingle.h" -#include "session.h" -#include "transport.h" - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define JINGLE_TYPE_CONTENT (jingle_content_get_type()) -#define JINGLE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_CONTENT, JingleContent)) -#define JINGLE_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_CONTENT, JingleContentClass)) -#define JINGLE_IS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_CONTENT)) -#define JINGLE_IS_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_CONTENT)) -#define JINGLE_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_CONTENT, JingleContentClass)) - -/** @copydoc _JingleContent */ -typedef struct _JingleContent JingleContent; -/** @copydoc _JingleContentClass */ -typedef struct _JingleContentClass JingleContentClass; -/** @copydoc _JingleContentPrivate */ -typedef struct _JingleContentPrivate JingleContentPrivate; - -/** The content class */ -struct _JingleContentClass -{ - GObjectClass parent_class; /**< The parent class. */ - - xmlnode *(*to_xml) (JingleContent *content, xmlnode *jingle, JingleActionType action); - JingleContent *(*parse) (xmlnode *content); - void (*handle_action) (JingleContent *content, xmlnode *xmlcontent, JingleActionType action); - const gchar *description_type; -}; - -/** The content class's private data */ -struct _JingleContent -{ - GObject parent; /**< The parent of this object. */ - JingleContentPrivate *priv; /**< The private data of this object. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the content class's GType - * - * @return The content class's GType. - */ -GType jingle_content_get_type(void); - -JingleContent *jingle_content_create(const gchar *type, const gchar *creator, - const gchar *disposition, const gchar *name, - const gchar *senders, JingleTransport *transport); - -JingleSession *jingle_content_get_session(JingleContent *content); -const gchar *jingle_content_get_description_type(JingleContent *content); -gchar *jingle_content_get_creator(JingleContent *content); -gchar *jingle_content_get_disposition(JingleContent *content); -gchar *jingle_content_get_name(JingleContent *content); -gchar *jingle_content_get_senders(JingleContent *content); -JingleTransport *jingle_content_get_transport(JingleContent *content); -JingleTransport *jingle_content_get_pending_transport(JingleContent *content); - -void jingle_content_set_session(JingleContent *content, JingleSession *session); -void jingle_content_set_pending_transport(JingleContent *content, JingleTransport *transport); -void jingle_content_accept_transport(JingleContent *content); -void jingle_content_remove_pending_transport(JingleContent *content); -void jingle_content_modify(JingleContent *content, const gchar *senders); - -#define jingle_content_create_content_accept(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_ACCEPT) -#define jingle_content_create_content_add(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_ADD) -#define jingle_content_create_content_modify(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_MODIFY) -#define jingle_content_create_content_remove(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_REMOVE) - -JingleContent *jingle_content_parse(xmlnode *content); -xmlnode *jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action); -void jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_CONTENT_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,431 +0,0 @@ -/** - * @file iceudp.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "iceudp.h" -#include "jingle.h" -#include "debug.h" - -#include <string.h> - -struct _JingleIceUdpPrivate -{ - GList *local_candidates; - GList *remote_candidates; -}; - -#define JINGLE_ICEUDP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_ICEUDP, JingleIceUdpPrivate)) - -static void jingle_iceudp_class_init (JingleIceUdpClass *klass); -static void jingle_iceudp_init (JingleIceUdp *iceudp); -static void jingle_iceudp_finalize (GObject *object); -static void jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_iceudp_parse_internal(xmlnode *iceudp); -static xmlnode *jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); - -static JingleTransportClass *parent_class = NULL; - -enum { - PROP_0, - PROP_LOCAL_CANDIDATES, - PROP_REMOTE_CANDIDATES, -}; - -static JingleIceUdpCandidate * -jingle_iceudp_candidate_copy(JingleIceUdpCandidate *candidate) -{ - JingleIceUdpCandidate *new_candidate = g_new0(JingleIceUdpCandidate, 1); - new_candidate->component = candidate->component; - new_candidate->foundation = g_strdup(candidate->foundation); - new_candidate->generation = candidate->generation; - new_candidate->id = g_strdup(candidate->id); - new_candidate->ip = g_strdup(candidate->ip); - new_candidate->network = candidate->network; - new_candidate->port = candidate->port; - new_candidate->priority = candidate->priority; - new_candidate->protocol = g_strdup(candidate->protocol); - new_candidate->type = g_strdup(candidate->type); - - new_candidate->username = g_strdup(candidate->username); - new_candidate->password = g_strdup(candidate->password); - - new_candidate->rem_known = candidate->rem_known; - - return new_candidate; -} - -static void -jingle_iceudp_candidate_free(JingleIceUdpCandidate *candidate) -{ - g_free(candidate->foundation); - g_free(candidate->id); - g_free(candidate->ip); - g_free(candidate->protocol); - g_free(candidate->reladdr); - g_free(candidate->type); - - g_free(candidate->username); - g_free(candidate->password); -} - -GType -jingle_iceudp_candidate_get_type() -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static("JingleIceUdpCandidate", - (GBoxedCopyFunc)jingle_iceudp_candidate_copy, - (GBoxedFreeFunc)jingle_iceudp_candidate_free); - } - return type; -} - -JingleIceUdpCandidate * -jingle_iceudp_candidate_new(guint component, const gchar *foundation, - guint generation, const gchar *id, const gchar *ip, - guint network, guint port, guint priority, - const gchar *protocol, const gchar *type, - const gchar *username, const gchar *password) -{ - JingleIceUdpCandidate *candidate = g_new0(JingleIceUdpCandidate, 1); - candidate->component = component; - candidate->foundation = g_strdup(foundation); - candidate->generation = generation; - candidate->id = g_strdup(id); - candidate->ip = g_strdup(ip); - candidate->network = network; - candidate->port = port; - candidate->priority = priority; - candidate->protocol = g_strdup(protocol); - candidate->type = g_strdup(type); - - candidate->username = g_strdup(username); - candidate->password = g_strdup(password); - - candidate->rem_known = FALSE; - return candidate; -} - -GType -jingle_iceudp_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleIceUdpClass), - NULL, - NULL, - (GClassInitFunc) jingle_iceudp_class_init, - NULL, - NULL, - sizeof(JingleIceUdp), - 0, - (GInstanceInitFunc) jingle_iceudp_init, - NULL - }; - type = g_type_register_static(JINGLE_TYPE_TRANSPORT, "JingleIceUdp", &info, 0); - } - return type; -} - -static void -jingle_iceudp_class_init (JingleIceUdpClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_iceudp_finalize; - gobject_class->set_property = jingle_iceudp_set_property; - gobject_class->get_property = jingle_iceudp_get_property; - klass->parent_class.to_xml = jingle_iceudp_to_xml_internal; - klass->parent_class.parse = jingle_iceudp_parse_internal; - klass->parent_class.transport_type = JINGLE_TRANSPORT_ICEUDP; - - g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES, - g_param_spec_pointer("local-candidates", - "Local candidates", - "The local candidates for this transport.", - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES, - g_param_spec_pointer("remote-candidates", - "Remote candidates", - "The remote candidates for this transport.", - G_PARAM_READABLE)); - - g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate)); -} - -static void -jingle_iceudp_init (JingleIceUdp *iceudp) -{ - iceudp->priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); - iceudp->priv->local_candidates = NULL; - iceudp->priv->remote_candidates = NULL; -} - -static void -jingle_iceudp_finalize (GObject *iceudp) -{ -/* JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); */ - purple_debug_info("jingle","jingle_iceudp_finalize\n"); - - G_OBJECT_CLASS(parent_class)->finalize(iceudp); -} - -static void -jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleIceUdp *iceudp; - g_return_if_fail(JINGLE_IS_ICEUDP(object)); - - iceudp = JINGLE_ICEUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - iceudp->priv->local_candidates = - g_value_get_pointer(value); - break; - case PROP_REMOTE_CANDIDATES: - iceudp->priv->remote_candidates = - g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleIceUdp *iceudp; - g_return_if_fail(JINGLE_IS_ICEUDP(object)); - - iceudp = JINGLE_ICEUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - g_value_set_pointer(value, iceudp->priv->local_candidates); - break; - case PROP_REMOTE_CANDIDATES: - g_value_set_pointer(value, iceudp->priv->remote_candidates); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -jingle_iceudp_add_local_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate) -{ - GList *iter = iceudp->priv->local_candidates; - - for (; iter; iter = g_list_next(iter)) { - JingleIceUdpCandidate *c = iter->data; - if (!strcmp(c->id, candidate->id)) { - guint generation = c->generation + 1; - - g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, c); - iceudp->priv->local_candidates = g_list_delete_link( - iceudp->priv->local_candidates, iter); - - candidate->generation = generation; - - iceudp->priv->local_candidates = g_list_append( - iceudp->priv->local_candidates, candidate); - return; - } - } - - iceudp->priv->local_candidates = g_list_append( - iceudp->priv->local_candidates, candidate); -} - -GList * -jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp) -{ - return g_list_copy(iceudp->priv->remote_candidates); -} - -static JingleIceUdpCandidate * -jingle_iceudp_get_remote_candidate_by_id(JingleIceUdp *iceudp, - const gchar *id) -{ - GList *iter = iceudp->priv->remote_candidates; - for (; iter; iter = g_list_next(iter)) { - JingleIceUdpCandidate *candidate = iter->data; - if (!strcmp(candidate->id, id)) { - return candidate; - } - } - return NULL; -} - -static void -jingle_iceudp_add_remote_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate) -{ - JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); - JingleIceUdpCandidate *iceudp_candidate = - jingle_iceudp_get_remote_candidate_by_id(iceudp, - candidate->id); - if (iceudp_candidate != NULL) { - priv->remote_candidates = g_list_remove( - priv->remote_candidates, iceudp_candidate); - g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, iceudp_candidate); - } - priv->remote_candidates = g_list_append(priv->remote_candidates, candidate); -} - -static JingleTransport * -jingle_iceudp_parse_internal(xmlnode *iceudp) -{ - JingleTransport *transport = parent_class->parse(iceudp); - xmlnode *candidate = xmlnode_get_child(iceudp, "candidate"); - JingleIceUdpCandidate *iceudp_candidate = NULL; - - const gchar *username = xmlnode_get_attrib(iceudp, "ufrag"); - const gchar *password = xmlnode_get_attrib(iceudp, "pwd"); - - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *relport = xmlnode_get_attrib(candidate, "rel-port"); - const gchar *component = xmlnode_get_attrib(candidate, "component"); - const gchar *foundation = xmlnode_get_attrib(candidate, "foundation"); - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *id = xmlnode_get_attrib(candidate, "id"); - const gchar *ip = xmlnode_get_attrib(candidate, "ip"); - const gchar *network = xmlnode_get_attrib(candidate, "network"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); - const gchar *priority = xmlnode_get_attrib(candidate, "priority"); - const gchar *protocol = xmlnode_get_attrib(candidate, "protocol"); - const gchar *type = xmlnode_get_attrib(candidate, "type"); - - if (!component || !foundation || !generation || !id || !ip || - !network || !port || !priority || !protocol || !type) - continue; - - iceudp_candidate = jingle_iceudp_candidate_new( - atoi(component), - foundation, - atoi(generation), - id, - ip, - atoi(network), - atoi(port), - atoi(priority), - protocol, - type, - username, password); - iceudp_candidate->reladdr = g_strdup( - xmlnode_get_attrib(candidate, "rel-addr")); - iceudp_candidate->relport = - relport != NULL ? atoi(relport) : 0; - iceudp_candidate->rem_known = TRUE; - jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); - } - - return transport; -} - -static xmlnode * -jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - xmlnode *node = parent_class->to_xml(transport, content, action); - - if (action == JINGLE_SESSION_INITIATE || - action == JINGLE_SESSION_ACCEPT || - action == JINGLE_TRANSPORT_INFO || - action == JINGLE_CONTENT_ADD || - action == JINGLE_TRANSPORT_REPLACE) { - JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(transport); - GList *iter = priv->local_candidates; - gboolean used_candidate = FALSE; - - for (; iter; iter = g_list_next(iter)) { - JingleIceUdpCandidate *candidate = iter->data; - xmlnode *xmltransport; - gchar *component, *generation, *network, - *port, *priority; - - if (candidate->rem_known == TRUE) - continue; - - used_candidate = TRUE; - candidate->rem_known = TRUE; - - xmltransport = xmlnode_new_child(node, "candidate"); - component = g_strdup_printf("%d", candidate->component); - generation = g_strdup_printf("%d", - candidate->generation); - network = g_strdup_printf("%d", candidate->network); - port = g_strdup_printf("%d", candidate->port); - priority = g_strdup_printf("%d", candidate->priority); - - xmlnode_set_attrib(xmltransport, "component", component); - xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation); - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "id", candidate->id); - xmlnode_set_attrib(xmltransport, "ip", candidate->ip); - xmlnode_set_attrib(xmltransport, "network", network); - xmlnode_set_attrib(xmltransport, "port", port); - xmlnode_set_attrib(xmltransport, "priority", priority); - xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); - - if (candidate->reladdr != NULL && - (strcmp(candidate->ip, candidate->reladdr) || - (candidate->port != candidate->relport))) { - gchar *relport = g_strdup_printf("%d", - candidate->relport); - xmlnode_set_attrib(xmltransport, "rel-addr", - candidate->reladdr); - xmlnode_set_attrib(xmltransport, "rel-port", - relport); - g_free(relport); - } - - xmlnode_set_attrib(xmltransport, "type", candidate->type); - - g_free(component); - g_free(generation); - g_free(network); - g_free(port); - g_free(priority); - } - - if (used_candidate == TRUE) { - JingleIceUdpCandidate *candidate = - priv->local_candidates->data; - xmlnode_set_attrib(node, "pwd", candidate->password); - xmlnode_set_attrib(node, "ufrag", candidate->username); - } - } - - return node; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/iceudp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/** - * @file iceudp.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_ICEUDP_H -#define PURPLE_JABBER_JINGLE_ICEUDP_H - -#include <glib.h> -#include <glib-object.h> - -#include "transport.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_ICEUDP (jingle_iceudp_get_type()) -#define JINGLE_TYPE_ICEUDP_CANDIDATE (jingle_iceudp_candidate_get_type()) -#define JINGLE_ICEUDP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_ICEUDP, JingleIceUdp)) -#define JINGLE_ICEUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_ICEUDP, JingleIceUdpClass)) -#define JINGLE_IS_ICEUDP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_ICEUDP)) -#define JINGLE_IS_ICEUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_ICEUDP)) -#define JINGLE_ICEUDP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_ICEUDP, JingleIceUdpClass)) - -/** @copydoc _JingleIceUdp */ -typedef struct _JingleIceUdp JingleIceUdp; -/** @copydoc _JingleIceUdpClass */ -typedef struct _JingleIceUdpClass JingleIceUdpClass; -/** @copydoc _JingleIceUdpPrivate */ -typedef struct _JingleIceUdpPrivate JingleIceUdpPrivate; -/** @copydoc _JingleIceUdpCandidate */ -typedef struct _JingleIceUdpCandidate JingleIceUdpCandidate; - -/** The iceudp class */ -struct _JingleIceUdpClass -{ - JingleTransportClass parent_class; /**< The parent class. */ - - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); -}; - -/** The iceudp class's private data */ -struct _JingleIceUdp -{ - JingleTransport parent; /**< The parent of this object. */ - JingleIceUdpPrivate *priv; /**< The private data of this object. */ -}; - -struct _JingleIceUdpCandidate -{ - guint component; - gchar *foundation; - guint generation; - gchar *id; - gchar *ip; - guint network; - guint port; - guint priority; - gchar *protocol; - gchar *reladdr; - guint relport; - gchar *type; - - gchar *username; - gchar *password; - - gboolean rem_known; /* TRUE if the remote side knows - * about this candidate */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -GType jingle_iceudp_candidate_get_type(void); - -/** - * Gets the iceudp class's GType - * - * @return The iceudp class's GType. - */ -GType jingle_iceudp_get_type(void); - -JingleIceUdpCandidate *jingle_iceudp_candidate_new(guint component, - const gchar *foundation, guint generation, const gchar *id, - const gchar *ip, guint network, guint port, guint priority, - const gchar *protocol, const gchar *type, - const gchar *username, const gchar *password); -void jingle_iceudp_add_local_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate); -GList *jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_ICEUDP_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,461 +0,0 @@ -/* - * @file jingle.c - * - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "network.h" - -#include "content.h" -#include "debug.h" -#include "jingle.h" -#include <string.h> -#include "session.h" -#include "iceudp.h" -#include "rawudp.h" -#include "rtp.h" - -GType -jingle_get_type(const gchar *type) -{ - if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) - return JINGLE_TYPE_RAWUDP; - else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) - return JINGLE_TYPE_ICEUDP; -#if 0 - else if (!strcmp(type, JINGLE_TRANSPORT_SOCKS)) - return JINGLE_TYPE_SOCKS; - else if (!strcmp(type, JINGLE_TRANSPORT_IBB)) - return JINGLE_TYPE_IBB; -#endif -#ifdef USE_VV - else if (!strcmp(type, JINGLE_APP_RTP)) - return JINGLE_TYPE_RTP; -#endif -#if 0 - else if (!strcmp(type, JINGLE_APP_FT)) - return JINGLE_TYPE_FT; - else if (!strcmp(type, JINGLE_APP_XML)) - return JINGLE_TYPE_XML; -#endif - else - return G_TYPE_NONE; -} - -static void -jingle_handle_unknown_type(JingleSession *session, xmlnode *jingle) -{ - /* Send error */ -} - -static void -jingle_handle_content_accept(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - jingle_session_accept_content(session, name, creator); - /* signal here */ - } -} - -static void -jingle_handle_content_add(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - JingleContent *pending_content = - jingle_content_parse(content); - if (pending_content == NULL) { - purple_debug_error("jingle", - "Error parsing \"content-add\" content.\n"); - /* XXX: send error here */ - } else { - jingle_session_add_pending_content(session, - pending_content); - } - } - - /* XXX: signal here */ -} - -static void -jingle_handle_content_modify(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *local_content = jingle_session_find_content(session, name, creator); - - if (local_content != NULL) { - const gchar *senders = xmlnode_get_attrib(content, "senders"); - gchar *local_senders = jingle_content_get_senders(local_content); - if (strcmp(senders, local_senders)) - jingle_content_modify(local_content, senders); - g_free(local_senders); - } else { - purple_debug_error("jingle", "content_modify: unknown content\n"); - /* XXX: send error */ - } - } -} - -static void -jingle_handle_content_reject(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - jingle_session_remove_pending_content(session, name, creator); - /* signal here */ - } -} - -static void -jingle_handle_content_remove(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - jingle_session_remove_content(session, name, creator); - } -} - -static void -jingle_handle_description_info(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - jingle_session_accept_session(session); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *parsed_content = - jingle_session_find_content(session, name, creator); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_content_handle_action(parsed_content, content, - JINGLE_DESCRIPTION_INFO); - } - } -} - -static void -jingle_handle_security_info(JingleSession *session, xmlnode *jingle) -{ - jabber_iq_send(jingle_session_create_ack(session, jingle)); -} - -static void -jingle_handle_session_accept(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - jingle_session_accept_session(session); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *parsed_content = - jingle_session_find_content(session, name, creator); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_content_handle_action(parsed_content, content, - JINGLE_SESSION_ACCEPT); - } - } -} - -static void -jingle_handle_session_info(JingleSession *session, xmlnode *jingle) -{ - jabber_iq_send(jingle_session_create_ack(session, jingle)); - /* XXX: call signal */ -} - -static void -jingle_handle_session_initiate(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - for (; content; content = xmlnode_get_next_twin(content)) { - JingleContent *parsed_content = jingle_content_parse(content); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_session_add_content(session, parsed_content); - jingle_content_handle_action(parsed_content, content, - JINGLE_SESSION_INITIATE); - } - } - - jabber_iq_send(jingle_session_create_ack(session, jingle)); -} - -static void -jingle_handle_session_terminate(JingleSession *session, xmlnode *jingle) -{ - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - jingle_session_handle_action(session, jingle, - JINGLE_SESSION_TERMINATE); - /* display reason? */ - g_object_unref(session); -} - -static void -jingle_handle_transport_accept(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *content = jingle_session_find_content(session, name, creator); - jingle_content_accept_transport(content); - } -} - -static void -jingle_handle_transport_info(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *parsed_content = - jingle_session_find_content(session, name, creator); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_content_handle_action(parsed_content, content, - JINGLE_TRANSPORT_INFO); - } - } -} - -static void -jingle_handle_transport_reject(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *content = jingle_session_find_content(session, name, creator); - jingle_content_remove_pending_transport(content); - } -} - -static void -jingle_handle_transport_replace(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - xmlnode *xmltransport = xmlnode_get_child(content, "transport"); - JingleTransport *transport = jingle_transport_parse(xmltransport); - JingleContent *content = jingle_session_find_content(session, name, creator); - - jingle_content_set_pending_transport(content, transport); - } -} - -typedef struct { - const char *name; - void (*handler)(JingleSession*, xmlnode*); -} JingleAction; - -static const JingleAction jingle_actions[] = { - {"unknown-type", jingle_handle_unknown_type}, - {"content-accept", jingle_handle_content_accept}, - {"content-add", jingle_handle_content_add}, - {"content-modify", jingle_handle_content_modify}, - {"content-reject", jingle_handle_content_reject}, - {"content-remove", jingle_handle_content_remove}, - {"description-info", jingle_handle_description_info}, - {"security-info", jingle_handle_security_info}, - {"session-accept", jingle_handle_session_accept}, - {"session-info", jingle_handle_session_info}, - {"session-initiate", jingle_handle_session_initiate}, - {"session-terminate", jingle_handle_session_terminate}, - {"transport-accept", jingle_handle_transport_accept}, - {"transport-info", jingle_handle_transport_info}, - {"transport-reject", jingle_handle_transport_reject}, - {"transport-replace", jingle_handle_transport_replace}, -}; - -const gchar * -jingle_get_action_name(JingleActionType action) -{ - return jingle_actions[action].name; -} - -JingleActionType -jingle_get_action_type(const gchar *action) -{ - static const int num_actions = - sizeof(jingle_actions)/sizeof(JingleAction); - /* Start at 1 to skip the unknown-action type */ - int i = 1; - for (; i < num_actions; ++i) { - if (!strcmp(action, jingle_actions[i].name)) - return i; - } - return JINGLE_UNKNOWN_TYPE; -} - -void -jingle_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *jingle) -{ - const gchar *action; - const gchar *sid; - JingleActionType action_type; - JingleSession *session; - - if (type != JABBER_IQ_SET) { - /* TODO: send iq error here */ - return; - } - - if (!(action = xmlnode_get_attrib(jingle, "action"))) { - /* TODO: send iq error here */ - return; - } - - action_type = jingle_get_action_type(action); - - purple_debug_info("jabber", "got Jingle package action = %s\n", - action); - - if (!(sid = xmlnode_get_attrib(jingle, "sid"))) { - /* send iq error here */ - return; - } - - if (!(session = jingle_session_find_by_sid(js, sid)) - && strcmp(action, "session-initiate")) { - purple_debug_error("jingle", "jabber_jingle_session_parse couldn't find session\n"); - /* send iq error here */ - return; - } - - if (action_type == JINGLE_SESSION_INITIATE) { - if (session) { - /* This should only happen if you start a session with yourself */ - purple_debug_error("jingle", "Jingle session with " - "id={%s} already exists\n", sid); - /* send iq error */ - return; - } else { - char *own_jid = g_strdup_printf("%s@%s/%s", js->user->node, - js->user->domain, js->user->resource); - session = jingle_session_create(js, sid, own_jid, from, FALSE); - g_free(own_jid); - } - } - - jingle_actions[action_type].handler(session, jingle); -} - -static void -jingle_terminate_sessions_gh(gpointer key, gpointer value, gpointer user_data) -{ - g_object_unref(value); -} - -void -jingle_terminate_sessions(JabberStream *js) -{ - if (js->sessions) - g_hash_table_foreach(js->sessions, - jingle_terminate_sessions_gh, NULL); -} - -GParameter * -jingle_get_params(JabberStream *js, guint *num) -{ - /* don't set a STUN server if one is set globally in prefs, in that case - this will be handled in media.c */ - gboolean has_account_stun = js->stun_ip && !purple_network_get_stun_ip(); - guint num_params = has_account_stun ? 2 : 0; - GParameter *params = NULL; - - if (num_params > 0) { - params = g_new0(GParameter, num_params); - - purple_debug_info("jabber", - "setting param stun-ip for stream using auto-discovered IP: %s\n", - js->stun_ip); - params[0].name = "stun-ip"; - g_value_init(¶ms[0].value, G_TYPE_STRING); - g_value_set_string(¶ms[0].value, js->stun_ip); - purple_debug_info("jabber", - "setting param stun-port for stream using auto-discovered port: %d\n", - js->stun_port); - params[1].name = "stun-port"; - g_value_init(¶ms[1].value, G_TYPE_UINT); - g_value_set_uint(¶ms[1].value, js->stun_port); - } - - *num = num_params; - return params; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/jingle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * @file jingle.h - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA - */ - -#ifndef PURPLE_JABBER_JINGLE_H -#define PURPLE_JABBER_JINGLE_H - -#include "jabber.h" - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#ifdef __cplusplus -extern "C" { -#endif - -#define JINGLE "urn:xmpp:jingle:1" -#define JINGLE_ERROR "urn:xmpp:jingle:errors:0" -#define JINGLE_APP_FT "urn:xmpp:jingle:apps:file-transfer:1" -#define JINGLE_APP_RTP "urn:xmpp:jingle:apps:rtp:1" -#define JINGLE_APP_RTP_ERROR "urn:xmpp:jingle:apps:rtp:errors:1" -#define JINGLE_APP_RTP_INFO "urn:xmpp:jingle:apps:rtp:info:1" -#define JINGLE_APP_RTP_SUPPORT_AUDIO "urn:xmpp:jingle:apps:rtp:audio" -#define JINGLE_APP_RTP_SUPPORT_VIDEO "urn:xmpp:jingle:apps:rtp:video" -#define JINGLE_APP_XML "urn:xmpp:tmp:jingle:apps:xmlstream" -#define JINGLE_DTMF "urn:xmpp:jingle:dtmf:0" -#define JINGLE_TRANSPORT_S5B "urn:xmpp:jingle:transports:s5b:0" -#define JINGLE_TRANSPORT_IBB "urn:xmpp:jingle:transports:ibb:0" -#define JINGLE_TRANSPORT_ICEUDP "urn:xmpp:jingle:transports:ice-udp:1" -#define JINGLE_TRANSPORT_RAWUDP "urn:xmpp:jingle:transports:raw-udp:1" - -typedef enum { - JINGLE_UNKNOWN_TYPE, - JINGLE_CONTENT_ACCEPT, - JINGLE_CONTENT_ADD, - JINGLE_CONTENT_MODIFY, - JINGLE_CONTENT_REJECT, - JINGLE_CONTENT_REMOVE, - JINGLE_DESCRIPTION_INFO, - JINGLE_SECURITY_INFO, - JINGLE_SESSION_ACCEPT, - JINGLE_SESSION_INFO, - JINGLE_SESSION_INITIATE, - JINGLE_SESSION_TERMINATE, - JINGLE_TRANSPORT_ACCEPT, - JINGLE_TRANSPORT_INFO, - JINGLE_TRANSPORT_REJECT, - JINGLE_TRANSPORT_REPLACE, -} JingleActionType; - -const gchar *jingle_get_action_name(JingleActionType action); -JingleActionType jingle_get_action_type(const gchar *action); - -GType jingle_get_type(const gchar *type); - -void jingle_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *child); - -void jingle_terminate_sessions(JabberStream *js); - -/* create a GParam array given autoconfigured STUN (and later perhaps TURN). - if google_talk is TRUE, set compatability mode to GOOGLE_TALK */ -GParameter *jingle_get_params(JabberStream *js, guint *num_params); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,355 +0,0 @@ -/** - * @file rawudp.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "rawudp.h" -#include "jingle.h" -#include "debug.h" - -#include <string.h> - -struct _JingleRawUdpPrivate -{ - GList *local_candidates; - GList *remote_candidates; -}; - -#define JINGLE_RAWUDP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RAWUDP, JingleRawUdpPrivate)) - -static void jingle_rawudp_class_init (JingleRawUdpClass *klass); -static void jingle_rawudp_init (JingleRawUdp *rawudp); -static void jingle_rawudp_finalize (GObject *object); -static void jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_rawudp_parse_internal(xmlnode *rawudp); -static xmlnode *jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); - -static JingleTransportClass *parent_class = NULL; - -enum { - PROP_0, - PROP_LOCAL_CANDIDATES, - PROP_REMOTE_CANDIDATES, -}; - -static JingleRawUdpCandidate * -jingle_rawudp_candidate_copy(JingleRawUdpCandidate *candidate) -{ - JingleRawUdpCandidate *new_candidate = g_new0(JingleRawUdpCandidate, 1); - new_candidate->generation = candidate->generation; - new_candidate->component = candidate->component; - new_candidate->id = g_strdup(candidate->id); - new_candidate->ip = g_strdup(candidate->ip); - new_candidate->port = candidate->port; - - new_candidate->rem_known = candidate->rem_known; - return new_candidate; -} - -static void -jingle_rawudp_candidate_free(JingleRawUdpCandidate *candidate) -{ - g_free(candidate->id); - g_free(candidate->ip); -} - -GType -jingle_rawudp_candidate_get_type() -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static("JingleRawUdpCandidate", - (GBoxedCopyFunc)jingle_rawudp_candidate_copy, - (GBoxedFreeFunc)jingle_rawudp_candidate_free); - } - return type; -} - -JingleRawUdpCandidate * -jingle_rawudp_candidate_new(const gchar *id, guint generation, guint component, const gchar *ip, guint port) -{ - JingleRawUdpCandidate *candidate = g_new0(JingleRawUdpCandidate, 1); - candidate->generation = generation; - candidate->component = component; - candidate->id = g_strdup(id); - candidate->ip = g_strdup(ip); - candidate->port = port; - - candidate->rem_known = FALSE; - return candidate; -} - -GType -jingle_rawudp_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleRawUdpClass), - NULL, - NULL, - (GClassInitFunc) jingle_rawudp_class_init, - NULL, - NULL, - sizeof(JingleRawUdp), - 0, - (GInstanceInitFunc) jingle_rawudp_init, - NULL - }; - type = g_type_register_static(JINGLE_TYPE_TRANSPORT, "JingleRawUdp", &info, 0); - } - return type; -} - -static void -jingle_rawudp_class_init (JingleRawUdpClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_rawudp_finalize; - gobject_class->set_property = jingle_rawudp_set_property; - gobject_class->get_property = jingle_rawudp_get_property; - klass->parent_class.to_xml = jingle_rawudp_to_xml_internal; - klass->parent_class.parse = jingle_rawudp_parse_internal; - klass->parent_class.transport_type = JINGLE_TRANSPORT_RAWUDP; - - g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES, - g_param_spec_pointer("local-candidates", - "Local candidates", - "The local candidates for this transport.", - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES, - g_param_spec_pointer("remote-candidates", - "Remote candidates", - "The remote candidates for this transport.", - G_PARAM_READABLE)); - - g_type_class_add_private(klass, sizeof(JingleRawUdpPrivate)); -} - -static void -jingle_rawudp_init (JingleRawUdp *rawudp) -{ - rawudp->priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); - rawudp->priv->local_candidates = NULL; - rawudp->priv->remote_candidates = NULL; -} - -static void -jingle_rawudp_finalize (GObject *rawudp) -{ -/* JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); */ - purple_debug_info("jingle","jingle_rawudp_finalize\n"); - - G_OBJECT_CLASS(parent_class)->finalize(rawudp); -} - -static void -jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleRawUdp *rawudp; - g_return_if_fail(JINGLE_IS_RAWUDP(object)); - - rawudp = JINGLE_RAWUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - rawudp->priv->local_candidates = - g_value_get_pointer(value); - break; - case PROP_REMOTE_CANDIDATES: - rawudp->priv->remote_candidates = - g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleRawUdp *rawudp; - g_return_if_fail(JINGLE_IS_RAWUDP(object)); - - rawudp = JINGLE_RAWUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - g_value_set_pointer(value, rawudp->priv->local_candidates); - break; - case PROP_REMOTE_CANDIDATES: - g_value_set_pointer(value, rawudp->priv->remote_candidates); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -jingle_rawudp_add_local_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate) -{ - GList *iter = rawudp->priv->local_candidates; - - for (; iter; iter = g_list_next(iter)) { - JingleRawUdpCandidate *c = iter->data; - if (!strcmp(c->id, candidate->id)) { - guint generation = c->generation + 1; - - g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, c); - rawudp->priv->local_candidates = g_list_delete_link( - rawudp->priv->local_candidates, iter); - - candidate->generation = generation; - - rawudp->priv->local_candidates = g_list_append( - rawudp->priv->local_candidates, candidate); - return; - } - } - - rawudp->priv->local_candidates = g_list_append( - rawudp->priv->local_candidates, candidate); -} - -GList * -jingle_rawudp_get_remote_candidates(JingleRawUdp *rawudp) -{ - return g_list_copy(rawudp->priv->remote_candidates); -} - -static JingleRawUdpCandidate * -jingle_rawudp_get_remote_candidate_by_id(JingleRawUdp *rawudp, gchar *id) -{ - GList *iter = rawudp->priv->remote_candidates; - for (; iter; iter = g_list_next(iter)) { - JingleRawUdpCandidate *candidate = iter->data; - if (!strcmp(candidate->id, id)) { - return candidate; - } - } - return NULL; -} - -static void -jingle_rawudp_add_remote_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate) -{ - JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); - JingleRawUdpCandidate *rawudp_candidate = - jingle_rawudp_get_remote_candidate_by_id(rawudp, candidate->id); - if (rawudp_candidate != NULL) { - priv->remote_candidates = g_list_remove( - priv->remote_candidates, rawudp_candidate); - g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate); - } - priv->remote_candidates = g_list_append(priv->remote_candidates, candidate); -} - -static JingleTransport * -jingle_rawudp_parse_internal(xmlnode *rawudp) -{ - JingleTransport *transport = parent_class->parse(rawudp); - JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); - xmlnode *candidate = xmlnode_get_child(rawudp, "candidate"); - JingleRawUdpCandidate *rawudp_candidate = NULL; - - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *id = xmlnode_get_attrib(candidate, "id"); - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *component = xmlnode_get_attrib(candidate, "component"); - const gchar *ip = xmlnode_get_attrib(candidate, "ip"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); - - if (!id || !generation || !component || !ip || !port) - continue; - - rawudp_candidate = jingle_rawudp_candidate_new( - id, - atoi(generation), - atoi(component), - ip, - atoi(port)); - rawudp_candidate->rem_known = TRUE; - jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); - } - - if (rawudp_candidate != NULL && - g_list_length(priv->remote_candidates) == 1) { - /* manufacture rtcp candidate */ - rawudp_candidate = g_boxed_copy(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate); - rawudp_candidate->component = 2; - rawudp_candidate->port = rawudp_candidate->port + 1; - rawudp_candidate->rem_known = TRUE; - jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); - } - - return transport; -} - -static xmlnode * -jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - xmlnode *node = parent_class->to_xml(transport, content, action); - - if (action == JINGLE_SESSION_INITIATE || - action == JINGLE_TRANSPORT_INFO || - action == JINGLE_SESSION_ACCEPT) { - JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); - GList *iter = priv->local_candidates; - - for (; iter; iter = g_list_next(iter)) { - JingleRawUdpCandidate *candidate = iter->data; - xmlnode *xmltransport; - gchar *generation, *component, *port; - - if (candidate->rem_known == TRUE) - continue; - candidate->rem_known = TRUE; - - xmltransport = xmlnode_new_child(node, "candidate"); - generation = g_strdup_printf("%d", candidate->generation); - component = g_strdup_printf("%d", candidate->component); - port = g_strdup_printf("%d", candidate->port); - - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "component", component); - xmlnode_set_attrib(xmltransport, "id", candidate->id); - xmlnode_set_attrib(xmltransport, "ip", candidate->ip); - xmlnode_set_attrib(xmltransport, "port", port); - - g_free(port); - g_free(generation); - } - } - - return node; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rawudp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file rawudp.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_RAWUDP_H -#define PURPLE_JABBER_JINGLE_RAWUDP_H - -#include <glib.h> -#include <glib-object.h> - -#include "transport.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_RAWUDP (jingle_rawudp_get_type()) -#define JINGLE_TYPE_RAWUDP_CANDIDATE (jingle_rawudp_candidate_get_type()) -#define JINGLE_RAWUDP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_RAWUDP, JingleRawUdp)) -#define JINGLE_RAWUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_RAWUDP, JingleRawUdpClass)) -#define JINGLE_IS_RAWUDP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_RAWUDP)) -#define JINGLE_IS_RAWUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_RAWUDP)) -#define JINGLE_RAWUDP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_RAWUDP, JingleRawUdpClass)) - -/** @copydoc _JingleRawUdp */ -typedef struct _JingleRawUdp JingleRawUdp; -/** @copydoc _JingleRawUdpClass */ -typedef struct _JingleRawUdpClass JingleRawUdpClass; -/** @copydoc _JingleRawUdpPrivate */ -typedef struct _JingleRawUdpPrivate JingleRawUdpPrivate; -/** @copydoc _JingleRawUdpCandidate */ -typedef struct _JingleRawUdpCandidate JingleRawUdpCandidate; - -/** The rawudp class */ -struct _JingleRawUdpClass -{ - JingleTransportClass parent_class; /**< The parent class. */ - - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); -}; - -/** The rawudp class's private data */ -struct _JingleRawUdp -{ - JingleTransport parent; /**< The parent of this object. */ - JingleRawUdpPrivate *priv; /**< The private data of this object. */ -}; - -struct _JingleRawUdpCandidate -{ - guint generation; - guint component; - gchar *id; - gchar *ip; - guint port; - - gboolean rem_known; /* TRUE if the remote side knows - * about this candidate */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -GType jingle_rawudp_candidate_get_type(void); - -/** - * Gets the rawudp class's GType - * - * @return The rawudp class's GType. - */ -GType jingle_rawudp_get_type(void); - -JingleRawUdpCandidate *jingle_rawudp_candidate_new(const gchar *id, - guint generation, guint component, const gchar *ip, guint port); -void jingle_rawudp_add_local_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate); -GList *jingle_rawudp_get_remote_candidates(JingleRawUdp *rawudp); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_RAWUDP_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,981 +0,0 @@ -/** - * @file rtp.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "config.h" - -#ifdef USE_VV - -#include "jabber.h" -#include "jingle.h" -#include "media.h" -#include "mediamanager.h" -#include "iceudp.h" -#include "rawudp.h" -#include "rtp.h" -#include "session.h" -#include "debug.h" - -#include <string.h> - -struct _JingleRtpPrivate -{ - gchar *media_type; - gchar *ssrc; -}; - -#define JINGLE_RTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RTP, JingleRtpPrivate)) - -static void jingle_rtp_class_init (JingleRtpClass *klass); -static void jingle_rtp_init (JingleRtp *rtp); -static void jingle_rtp_finalize (GObject *object); -static void jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleContent *jingle_rtp_parse_internal(xmlnode *rtp); -static xmlnode *jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action); -static void jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); - -static PurpleMedia *jingle_rtp_get_media(JingleSession *session); - -static JingleContentClass *parent_class = NULL; -#if 0 -enum { - LAST_SIGNAL -}; -static guint jingle_rtp_signals[LAST_SIGNAL] = {0}; -#endif - -enum { - PROP_0, - PROP_MEDIA_TYPE, - PROP_SSRC, -}; - -GType -jingle_rtp_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleRtpClass), - NULL, - NULL, - (GClassInitFunc) jingle_rtp_class_init, - NULL, - NULL, - sizeof(JingleRtp), - 0, - (GInstanceInitFunc) jingle_rtp_init, - NULL - }; - type = g_type_register_static(JINGLE_TYPE_CONTENT, "JingleRtp", &info, 0); - } - return type; -} - -static void -jingle_rtp_class_init (JingleRtpClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_rtp_finalize; - gobject_class->set_property = jingle_rtp_set_property; - gobject_class->get_property = jingle_rtp_get_property; - klass->parent_class.to_xml = jingle_rtp_to_xml_internal; - klass->parent_class.parse = jingle_rtp_parse_internal; - klass->parent_class.description_type = JINGLE_APP_RTP; - klass->parent_class.handle_action = jingle_rtp_handle_action_internal; - - g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, - g_param_spec_string("media-type", - "Media Type", - "The media type (\"audio\" or \"video\") for this rtp session.", - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, PROP_SSRC, - g_param_spec_string("ssrc", - "ssrc", - "The ssrc for this rtp session.", - NULL, - G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); -} - -static void -jingle_rtp_init (JingleRtp *rtp) -{ - rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp); - memset(rtp->priv, 0, sizeof(*rtp->priv)); -} - -static void -jingle_rtp_finalize (GObject *rtp) -{ - JingleRtpPrivate *priv = JINGLE_RTP_GET_PRIVATE(rtp); - purple_debug_info("jingle-rtp","jingle_rtp_finalize\n"); - - g_free(priv->media_type); - g_free(priv->ssrc); - - G_OBJECT_CLASS(parent_class)->finalize(rtp); -} - -static void -jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleRtp *rtp; - g_return_if_fail(JINGLE_IS_RTP(object)); - - rtp = JINGLE_RTP(object); - - switch (prop_id) { - case PROP_MEDIA_TYPE: - g_free(rtp->priv->media_type); - rtp->priv->media_type = g_value_dup_string(value); - break; - case PROP_SSRC: - g_free(rtp->priv->ssrc); - rtp->priv->ssrc = g_value_dup_string(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleRtp *rtp; - g_return_if_fail(JINGLE_IS_RTP(object)); - - rtp = JINGLE_RTP(object); - - switch (prop_id) { - case PROP_MEDIA_TYPE: - g_value_set_string(value, rtp->priv->media_type); - break; - case PROP_SSRC: - g_value_set_string(value, rtp->priv->ssrc); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -gchar * -jingle_rtp_get_media_type(JingleContent *content) -{ - gchar *media_type; - g_object_get(content, "media-type", &media_type, NULL); - return media_type; -} - -gchar * -jingle_rtp_get_ssrc(JingleContent *content) -{ - gchar *ssrc; - g_object_get(content, "ssrc", &ssrc, NULL); - return ssrc; -} - -static PurpleMedia * -jingle_rtp_get_media(JingleSession *session) -{ - JabberStream *js = jingle_session_get_js(session); - PurpleMedia *media = NULL; - GList *iter = purple_media_manager_get_media_by_account( - purple_media_manager_get(), - purple_connection_get_account(js->gc)); - - for (; iter; iter = g_list_delete_link(iter, iter)) { - JingleSession *media_session = - purple_media_get_prpl_data(iter->data); - if (media_session == session) { - media = iter->data; - break; - } - } - if (iter != NULL) - g_list_free(iter); - - return media; -} - -static JingleRawUdpCandidate * -jingle_rtp_candidate_to_rawudp(JingleSession *session, guint generation, - PurpleMediaCandidate *candidate) -{ - gchar *id = jabber_get_next_id(jingle_session_get_js(session)); - gchar *ip = purple_media_candidate_get_ip(candidate); - JingleRawUdpCandidate *rawudp_candidate = - jingle_rawudp_candidate_new(id, generation, - purple_media_candidate_get_component_id(candidate), - ip, purple_media_candidate_get_port(candidate)); - g_free(ip); - g_free(id); - return rawudp_candidate; -} - -static JingleIceUdpCandidate * -jingle_rtp_candidate_to_iceudp(JingleSession *session, guint generation, - PurpleMediaCandidate *candidate) -{ - gchar *id = jabber_get_next_id(jingle_session_get_js(session)); - gchar *ip = purple_media_candidate_get_ip(candidate); - gchar *username = purple_media_candidate_get_username(candidate); - gchar *password = purple_media_candidate_get_password(candidate); - PurpleMediaCandidateType type = - purple_media_candidate_get_candidate_type(candidate); - - JingleIceUdpCandidate *iceudp_candidate = jingle_iceudp_candidate_new( - purple_media_candidate_get_component_id(candidate), - purple_media_candidate_get_foundation(candidate), - generation, id, ip, 0, - purple_media_candidate_get_port(candidate), - purple_media_candidate_get_priority(candidate), "udp", - type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" : - type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" : - type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" : - type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : - "", username, password); - iceudp_candidate->reladdr = - purple_media_candidate_get_base_ip(candidate); - iceudp_candidate->relport = - purple_media_candidate_get_base_port(candidate); - g_free(password); - g_free(username); - g_free(ip); - g_free(id); - return iceudp_candidate; -} - -static JingleTransport * -jingle_rtp_candidates_to_transport(JingleSession *session, GType type, guint generation, GList *candidates) -{ - if (type == JINGLE_TYPE_RAWUDP) { - JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_RAWUDP); - JingleRawUdpCandidate *rawudp_candidate; - for (; candidates; candidates = g_list_next(candidates)) { - PurpleMediaCandidate *candidate = candidates->data; - rawudp_candidate = jingle_rtp_candidate_to_rawudp( - session, generation, candidate); - jingle_rawudp_add_local_candidate( - JINGLE_RAWUDP(transport), - rawudp_candidate); - } - return transport; - } else if (type == JINGLE_TYPE_ICEUDP) { - JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP); - JingleIceUdpCandidate *iceudp_candidate; - for (; candidates; candidates = g_list_next(candidates)) { - PurpleMediaCandidate *candidate = candidates->data; - iceudp_candidate = jingle_rtp_candidate_to_iceudp( - session, generation, candidate); - jingle_iceudp_add_local_candidate( - JINGLE_ICEUDP(transport), - iceudp_candidate); - } - return transport; - } else { - return NULL; - } -} - -static GList * -jingle_rtp_transport_to_candidates(JingleTransport *transport) -{ - const gchar *type = jingle_transport_get_transport_type(transport); - GList *ret = NULL; - if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) { - GList *candidates = jingle_rawudp_get_remote_candidates(JINGLE_RAWUDP(transport)); - - for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { - JingleRawUdpCandidate *candidate = candidates->data; - ret = g_list_append(ret, purple_media_candidate_new( - "", candidate->component, - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - candidate->ip, candidate->port)); - } - - return ret; - } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) { - GList *candidates = jingle_iceudp_get_remote_candidates(JINGLE_ICEUDP(transport)); - - for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { - JingleIceUdpCandidate *candidate = candidates->data; - PurpleMediaCandidate *new_candidate = purple_media_candidate_new( - candidate->foundation, candidate->component, - !strcmp(candidate->type, "host") ? - PURPLE_MEDIA_CANDIDATE_TYPE_HOST : - !strcmp(candidate->type, "srflx") ? - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX : - !strcmp(candidate->type, "prflx") ? - PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX : - !strcmp(candidate->type, "relay") ? - PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0, - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - candidate->ip, candidate->port); - g_object_set(new_candidate, - "base-ip", candidate->reladdr, - "base-port", candidate->relport, - "username", candidate->username, - "password", candidate->password, - "priority", candidate->priority, NULL); - ret = g_list_append(ret, new_candidate); - } - - return ret; - } else { - return NULL; - } -} - -static void jingle_rtp_ready(JingleSession *session); - -static void -jingle_rtp_candidates_prepared_cb(PurpleMedia *media, - gchar *sid, gchar *name, JingleSession *session) -{ - JingleContent *content = jingle_session_find_content( - session, sid, NULL); - JingleTransport *oldtransport, *transport; - GList *candidates; - - purple_debug_info("jingle-rtp", "jingle_rtp_candidates_prepared_cb\n"); - - if (content == NULL) { - purple_debug_error("jingle-rtp", - "jingle_rtp_candidates_prepared_cb: " - "Can't find session %s\n", sid); - return; - } - - oldtransport = jingle_content_get_transport(content); - candidates = purple_media_get_local_candidates(media, sid, name); - transport = JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport( - session, JINGLE_IS_RAWUDP(oldtransport) ? - JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP, - 0, candidates)); - - g_list_free(candidates); - g_object_unref(oldtransport); - - jingle_content_set_pending_transport(content, transport); - jingle_content_accept_transport(content); - - jingle_rtp_ready(session); -} - -static void -jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, - JingleSession *session) -{ - purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " - "session_id: %s jingle_session: %p\n", sid, session); - jingle_rtp_ready(session); -} - -static void -jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) -{ - JingleContent *content = jingle_session_find_content( - session, sid, NULL); - JingleTransport *transport; - - purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n"); - - if (content == NULL) { - purple_debug_error("jingle-rtp", - "jingle_rtp_new_candidate_cb: " - "Can't find session %s\n", sid); - return; - } - - transport = jingle_content_get_transport(content); - - if (JINGLE_IS_ICEUDP(transport)) - jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), - jingle_rtp_candidate_to_iceudp( - session, 1, candidate)); - else if (JINGLE_IS_RAWUDP(transport)) - jingle_rawudp_add_local_candidate(JINGLE_RAWUDP(transport), - jingle_rtp_candidate_to_rawudp( - session, 1, candidate)); - - g_object_unref(transport); - - jabber_iq_send(jingle_session_to_packet(session, - JINGLE_TRANSPORT_INFO)); -} - -static void -jingle_rtp_initiate_ack_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JingleSession *session = data; - - if (type == JABBER_IQ_ERROR || xmlnode_get_child(packet, "error")) { - purple_media_end(jingle_rtp_get_media(session), NULL, NULL); - g_object_unref(session); - return; - } -} - -static void -jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaState state, - gchar *sid, gchar *name, JingleSession *session) -{ - purple_debug_info("jingle-rtp", "state-changed: state %d " - "id: %s name: %s\n", state, sid ? sid : "(null)", - name ? name : "(null)"); -} - -static void -jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, - gchar *sid, gchar *name, gboolean local, - JingleSession *session) -{ - purple_debug_info("jingle-rtp", "stream-info: type %d " - "id: %s name: %s\n", type, sid ? sid : "(null)", - name ? name : "(null)"); - - g_return_if_fail(JINGLE_IS_SESSION(session)); - - if (type == PURPLE_MEDIA_INFO_HANGUP) { - jabber_iq_send(jingle_session_terminate_packet( - session, "success")); - g_object_unref(session); - } else if (type == PURPLE_MEDIA_INFO_REJECT) { - jabber_iq_send(jingle_session_terminate_packet( - session, "decline")); - g_object_unref(session); - } else if (type == PURPLE_MEDIA_INFO_ACCEPT && - jingle_session_is_initiator(session) == FALSE) { - jingle_rtp_ready(session); - } -} - -static void -jingle_rtp_ready(JingleSession *session) -{ - PurpleMedia *media = jingle_rtp_get_media(session); - - if (purple_media_candidates_prepared(media, NULL, NULL) && - purple_media_codecs_ready(media, NULL) && - (jingle_session_is_initiator(session) == TRUE || - purple_media_accepted(media, NULL, NULL))) { - if (jingle_session_is_initiator(session)) { - JabberIq *iq = jingle_session_to_packet( - session, JINGLE_SESSION_INITIATE); - jabber_iq_set_callback(iq, - jingle_rtp_initiate_ack_cb, session); - jabber_iq_send(iq); - } else { - jabber_iq_send(jingle_session_to_packet(session, - JINGLE_SESSION_ACCEPT)); - } - - g_signal_handlers_disconnect_by_func(G_OBJECT(media), - G_CALLBACK(jingle_rtp_candidates_prepared_cb), - session); - g_signal_handlers_disconnect_by_func(G_OBJECT(media), - G_CALLBACK(jingle_rtp_codecs_changed_cb), - session); - g_signal_connect(G_OBJECT(media), "new-candidate", - G_CALLBACK(jingle_rtp_new_candidate_cb), - session); - } -} - -static PurpleMedia * -jingle_rtp_create_media(JingleContent *content) -{ - JingleSession *session = jingle_content_get_session(content); - JabberStream *js = jingle_session_get_js(session); - gchar *remote_jid = jingle_session_get_remote_jid(session); - - PurpleMedia *media = purple_media_manager_create_media( - purple_media_manager_get(), - purple_connection_get_account(js->gc), - "fsrtpconference", remote_jid, - jingle_session_is_initiator(session)); - g_free(remote_jid); - - if (!media) { - purple_debug_error("jingle-rtp", "Couldn't create media session\n"); - return NULL; - } - - purple_media_set_prpl_data(media, session); - - /* connect callbacks */ - g_signal_connect(G_OBJECT(media), "candidates-prepared", - G_CALLBACK(jingle_rtp_candidates_prepared_cb), session); - g_signal_connect(G_OBJECT(media), "codecs-changed", - G_CALLBACK(jingle_rtp_codecs_changed_cb), session); - g_signal_connect(G_OBJECT(media), "state-changed", - G_CALLBACK(jingle_rtp_state_changed_cb), session); - g_signal_connect(G_OBJECT(media), "stream-info", - G_CALLBACK(jingle_rtp_stream_info_cb), session); - - g_object_unref(session); - return media; -} - -static gboolean -jingle_rtp_init_media(JingleContent *content) -{ - JingleSession *session = jingle_content_get_session(content); - PurpleMedia *media = jingle_rtp_get_media(session); - gchar *creator; - gchar *media_type; - gchar *remote_jid; - gchar *senders; - gchar *name; - const gchar *transmitter; - gboolean is_audio; - gboolean is_creator; - PurpleMediaSessionType type; - JingleTransport *transport; - GParameter *params = NULL; - guint num_params; - - /* maybe this create ought to just be in initiate and handle initiate */ - if (media == NULL) - media = jingle_rtp_create_media(content); - - if (media == NULL) - return FALSE; - - name = jingle_content_get_name(content); - media_type = jingle_rtp_get_media_type(content); - remote_jid = jingle_session_get_remote_jid(session); - senders = jingle_content_get_senders(content); - transport = jingle_content_get_transport(content); - - if (JINGLE_IS_RAWUDP(transport)) - transmitter = "rawudp"; - else if (JINGLE_IS_ICEUDP(transport)) - transmitter = "nice"; - else - transmitter = "notransmitter"; - g_object_unref(transport); - - is_audio = !strcmp(media_type, "audio"); - - if (!strcmp(senders, "both")) - type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO - : PURPLE_MEDIA_VIDEO; - else if ((strcmp(senders, "initiator") == 0) == - jingle_session_is_initiator(session)) - type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO - : PURPLE_MEDIA_SEND_VIDEO; - else - type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO - : PURPLE_MEDIA_RECV_VIDEO; - - params = - jingle_get_params(jingle_session_get_js(session), &num_params); - - creator = jingle_content_get_creator(content); - if (!strcmp(creator, "initiator")) - is_creator = jingle_session_is_initiator(session); - else - is_creator = !jingle_session_is_initiator(session); - g_free(creator); - - if(!purple_media_add_stream(media, name, remote_jid, - type, is_creator, transmitter, num_params, params)) { - purple_media_end(media, NULL, NULL); - return FALSE; - } - - g_free(name); - g_free(media_type); - g_free(remote_jid); - g_free(senders); - g_free(params); - g_object_unref(session); - - return TRUE; -} - -static GList * -jingle_rtp_parse_codecs(xmlnode *description) -{ - GList *codecs = NULL; - xmlnode *codec_element = NULL; - const char *encoding_name,*id, *clock_rate; - PurpleMediaCodec *codec; - const gchar *media = xmlnode_get_attrib(description, "media"); - PurpleMediaSessionType type = - !strcmp(media, "video") ? PURPLE_MEDIA_VIDEO : - !strcmp(media, "audio") ? PURPLE_MEDIA_AUDIO : 0; - - for (codec_element = xmlnode_get_child(description, "payload-type") ; - codec_element ; - codec_element = xmlnode_get_next_twin(codec_element)) { - xmlnode *param; - gchar *codec_str; - encoding_name = xmlnode_get_attrib(codec_element, "name"); - - id = xmlnode_get_attrib(codec_element, "id"); - clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); - - codec = purple_media_codec_new(atoi(id), encoding_name, - type, - clock_rate ? atoi(clock_rate) : 0); - - for (param = xmlnode_get_child(codec_element, "parameter"); - param; param = xmlnode_get_next_twin(param)) { - purple_media_codec_add_optional_parameter(codec, - xmlnode_get_attrib(param, "name"), - xmlnode_get_attrib(param, "value")); - } - - codec_str = purple_media_codec_to_string(codec); - purple_debug_info("jingle-rtp", "received codec: %s\n", codec_str); - g_free(codec_str); - - codecs = g_list_append(codecs, codec); - } - return codecs; -} - -static JingleContent * -jingle_rtp_parse_internal(xmlnode *rtp) -{ - JingleContent *content = parent_class->parse(rtp); - xmlnode *description = xmlnode_get_child(rtp, "description"); - const gchar *media_type = xmlnode_get_attrib(description, "media"); - const gchar *ssrc = xmlnode_get_attrib(description, "ssrc"); - purple_debug_info("jingle-rtp", "rtp parse\n"); - g_object_set(content, "media-type", media_type, NULL); - if (ssrc != NULL) - g_object_set(content, "ssrc", ssrc, NULL); - return content; -} - -static void -jingle_rtp_add_payloads(xmlnode *description, GList *codecs) -{ - for (; codecs ; codecs = codecs->next) { - PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data; - GList *iter = purple_media_codec_get_optional_parameters(codec); - gchar *id, *name, *clockrate, *channels; - gchar *codec_str; - xmlnode *payload = xmlnode_new_child(description, "payload-type"); - - id = g_strdup_printf("%d", - purple_media_codec_get_id(codec)); - name = purple_media_codec_get_encoding_name(codec); - clockrate = g_strdup_printf("%d", - purple_media_codec_get_clock_rate(codec)); - channels = g_strdup_printf("%d", - purple_media_codec_get_channels(codec)); - - xmlnode_set_attrib(payload, "name", name); - xmlnode_set_attrib(payload, "id", id); - xmlnode_set_attrib(payload, "clockrate", clockrate); - xmlnode_set_attrib(payload, "channels", channels); - - g_free(channels); - g_free(clockrate); - g_free(name); - g_free(id); - - for (; iter; iter = g_list_next(iter)) { - PurpleKeyValuePair *mparam = iter->data; - xmlnode *param = xmlnode_new_child(payload, "parameter"); - xmlnode_set_attrib(param, "name", mparam->key); - xmlnode_set_attrib(param, "value", mparam->value); - } - - codec_str = purple_media_codec_to_string(codec); - purple_debug_info("jingle", "adding codec: %s\n", codec_str); - g_free(codec_str); - } -} - -static xmlnode * -jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action) -{ - xmlnode *node = parent_class->to_xml(rtp, content, action); - xmlnode *description = xmlnode_get_child(node, "description"); - if (description != NULL) { - JingleSession *session = jingle_content_get_session(rtp); - PurpleMedia *media = jingle_rtp_get_media(session); - gchar *media_type = jingle_rtp_get_media_type(rtp); - gchar *ssrc = jingle_rtp_get_ssrc(rtp); - gchar *name = jingle_content_get_name(rtp); - GList *codecs = purple_media_get_codecs(media, name); - - xmlnode_set_attrib(description, "media", media_type); - - if (ssrc != NULL) - xmlnode_set_attrib(description, "ssrc", ssrc); - - g_free(media_type); - g_free(name); - g_object_unref(session); - - jingle_rtp_add_payloads(description, codecs); - purple_media_codec_list_free(codecs); - } - return node; -} - -static void -jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) -{ - switch (action) { - case JINGLE_SESSION_ACCEPT: - case JINGLE_SESSION_INITIATE: { - JingleSession *session = jingle_content_get_session(content); - JingleTransport *transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); - xmlnode *description = xmlnode_get_child(xmlcontent, "description"); - GList *candidates = jingle_rtp_transport_to_candidates(transport); - GList *codecs = jingle_rtp_parse_codecs(description); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); - PurpleMedia *media; - - if (action == JINGLE_SESSION_INITIATE && - jingle_rtp_init_media(content) == FALSE) { - /* XXX: send error */ - jabber_iq_send(jingle_session_terminate_packet( - session, "general-error")); - g_object_unref(session); - break; - } - - media = jingle_rtp_get_media(session); - purple_media_set_remote_codecs(media, - name, remote_jid, codecs); - purple_media_add_remote_candidates(media, - name, remote_jid, candidates); - - if (action == JINGLE_SESSION_ACCEPT) - purple_media_stream_info(media, - PURPLE_MEDIA_INFO_ACCEPT, - name, remote_jid, FALSE); - - g_free(remote_jid); - g_free(name); - g_object_unref(session); - break; - } - case JINGLE_SESSION_TERMINATE: { - JingleSession *session = jingle_content_get_session(content); - PurpleMedia *media = jingle_rtp_get_media(session); - - if (media != NULL) { - purple_media_end(media, NULL, NULL); - } - - g_object_unref(session); - break; - } - case JINGLE_TRANSPORT_INFO: { - JingleSession *session = jingle_content_get_session(content); - JingleTransport *transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); - GList *candidates = jingle_rtp_transport_to_candidates(transport); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); - - purple_media_add_remote_candidates( - jingle_rtp_get_media(session), - name, remote_jid, candidates); - - g_free(remote_jid); - g_free(name); - g_object_unref(session); - break; - } - case JINGLE_DESCRIPTION_INFO: { - JingleSession *session = - jingle_content_get_session(content); - xmlnode *description = xmlnode_get_child( - xmlcontent, "description"); - GList *codecs, *iter, *iter2, *remote_codecs = - jingle_rtp_parse_codecs(description); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); - PurpleMedia *media; - - media = jingle_rtp_get_media(session); - - /* - * This may have problems if description-info is - * received without the optional parameters for a - * codec with configuration info (such as THEORA - * or H264). The local configuration info may be - * set for the remote codec. - * - * As of 2.6.3 there's no API to support getting - * the remote codecs specifically, just the - * intersection. Another option may be to cache - * the remote codecs received in initiate/accept. - */ - codecs = purple_media_get_codecs(media, name); - - for (iter = codecs; iter; iter = g_list_next(iter)) { - guint id; - - id = purple_media_codec_get_id(iter->data); - iter2 = remote_codecs; - - for (; iter2; iter2 = g_list_next(iter2)) { - if (purple_media_codec_get_id( - iter2->data) != id) - continue; - - g_object_unref(iter->data); - iter->data = iter2->data; - remote_codecs = g_list_delete_link( - remote_codecs, iter2); - break; - } - } - - codecs = g_list_concat(codecs, remote_codecs); - - purple_media_set_remote_codecs(media, - name, remote_jid, codecs); - - purple_media_codec_list_free (codecs); - g_free(remote_jid); - g_free(name); - g_object_unref(session); - break; - } - default: - break; - } -} - -gboolean -jingle_rtp_initiate_media(JabberStream *js, const gchar *who, - PurpleMediaSessionType type) -{ - /* create content negotiation */ - JingleSession *session; - JingleContent *content; - JingleTransport *transport; - JabberBuddy *jb; - JabberBuddyResource *jbr; - const gchar *transport_type; - - gchar *resource = NULL, *me = NULL, *sid = NULL; - - /* construct JID to send to */ - jb = jabber_buddy_find(js, who, FALSE); - if (!jb) { - purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); - return FALSE; - } - - resource = jabber_get_resource(who); - jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); - - if (!jbr) { - purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); - } - - if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { - transport_type = JINGLE_TRANSPORT_ICEUDP; - } else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_RAWUDP)) { - transport_type = JINGLE_TRANSPORT_RAWUDP; - } else { - purple_debug_error("jingle-rtp", "Resource doesn't support " - "the same transport types\n"); - return FALSE; - } - - /* set ourselves as initiator */ - me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); - - sid = jabber_get_next_id(js); - session = jingle_session_create(js, sid, me, who, TRUE); - g_free(sid); - - - if (type & PURPLE_MEDIA_AUDIO) { - transport = jingle_transport_create(transport_type); - content = jingle_content_create(JINGLE_APP_RTP, "initiator", - "session", "audio-session", "both", transport); - jingle_session_add_content(session, content); - JINGLE_RTP(content)->priv->media_type = g_strdup("audio"); - jingle_rtp_init_media(content); - } - if (type & PURPLE_MEDIA_VIDEO) { - transport = jingle_transport_create(transport_type); - content = jingle_content_create(JINGLE_APP_RTP, "initiator", - "session", "video-session", "both", transport); - jingle_session_add_content(session, content); - JINGLE_RTP(content)->priv->media_type = g_strdup("video"); - jingle_rtp_init_media(content); - } - - g_free(me); - - if (jingle_rtp_get_media(session) == NULL) { - return FALSE; - } - - return TRUE; -} - -void -jingle_rtp_terminate_session(JabberStream *js, const gchar *who) -{ - JingleSession *session; -/* XXX: This may cause file transfers and xml sessions to stop as well */ - session = jingle_session_find_by_jid(js, who); - - if (session) { - PurpleMedia *media = jingle_rtp_get_media(session); - if (media) { - purple_debug_info("jingle-rtp", "hanging up media\n"); - purple_media_stream_info(media, - PURPLE_MEDIA_INFO_HANGUP, - NULL, NULL, TRUE); - } - } -} - -#endif /* USE_VV */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/rtp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/** - * @file rtp.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_RTP_H -#define PURPLE_JABBER_JINGLE_RTP_H - -#include "config.h" - -#ifdef USE_VV - -#include <glib.h> -#include <glib-object.h> - -#include "content.h" -#include "media.h" -#include "xmlnode.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_RTP (jingle_rtp_get_type()) -#define JINGLE_RTP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_RTP, JingleRtp)) -#define JINGLE_RTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_RTP, JingleRtpClass)) -#define JINGLE_IS_RTP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_RTP)) -#define JINGLE_IS_RTP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_RTP)) -#define JINGLE_RTP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_RTP, JingleRtpClass)) - -/** @copydoc _JingleRtp */ -typedef struct _JingleRtp JingleRtp; -/** @copydoc _JingleRtpClass */ -typedef struct _JingleRtpClass JingleRtpClass; -/** @copydoc _JingleRtpPrivate */ -typedef struct _JingleRtpPrivate JingleRtpPrivate; - -/** The rtp class */ -struct _JingleRtpClass -{ - JingleContentClass parent_class; /**< The parent class. */ -}; - -/** The rtp class's private data */ -struct _JingleRtp -{ - JingleContent parent; /**< The parent of this object. */ - JingleRtpPrivate *priv; /**< The private data of this object. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the rtp class's GType - * - * @return The rtp class's GType. - */ -GType jingle_rtp_get_type(void); - -gchar *jingle_rtp_get_media_type(JingleContent *content); -gchar *jingle_rtp_get_ssrc(JingleContent *content); - -gboolean jingle_rtp_initiate_media(JabberStream *js, - const gchar *who, - PurpleMediaSessionType type); -void jingle_rtp_terminate_session(JabberStream *js, const gchar *who); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* USE_VV */ - -#endif /* PURPLE_JABBER_JINGLE_RTP_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,688 +0,0 @@ -/** - * @file session.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "content.h" -#include "debug.h" -#include "session.h" -#include "jingle.h" - -#include <string.h> - -struct _JingleSessionPrivate -{ - gchar *sid; - JabberStream *js; - gchar *remote_jid; - gchar *local_jid; - gboolean is_initiator; - gboolean state; - GList *contents; - GList *pending_contents; -}; - -#define JINGLE_SESSION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_SESSION, JingleSessionPrivate)) - -static void jingle_session_class_init (JingleSessionClass *klass); -static void jingle_session_init (JingleSession *session); -static void jingle_session_finalize (GObject *object); -static void jingle_session_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_session_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); - -static GObjectClass *parent_class = NULL; - -enum { - PROP_0, - PROP_SID, - PROP_JS, - PROP_REMOTE_JID, - PROP_LOCAL_JID, - PROP_IS_INITIATOR, - PROP_STATE, - PROP_CONTENTS, - PROP_PENDING_CONTENTS, -}; - -GType -jingle_session_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleSessionClass), - NULL, - NULL, - (GClassInitFunc) jingle_session_class_init, - NULL, - NULL, - sizeof(JingleSession), - 0, - (GInstanceInitFunc) jingle_session_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "JingleSession", &info, 0); - } - return type; -} - -static void -jingle_session_class_init (JingleSessionClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_session_finalize; - gobject_class->set_property = jingle_session_set_property; - gobject_class->get_property = jingle_session_get_property; - - g_object_class_install_property(gobject_class, PROP_SID, - g_param_spec_string("sid", - "Session ID", - "The unique session ID of the Jingle Session.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_JS, - g_param_spec_pointer("js", - "JabberStream", - "The Jabber stream associated with this session.", - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_REMOTE_JID, - g_param_spec_string("remote-jid", - "Remote JID", - "The JID of the remote participant.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_LOCAL_JID, - g_param_spec_string("local-jid", - "Local JID", - "The JID of the local participant.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_IS_INITIATOR, - g_param_spec_boolean("is-initiator", - "Is Initiator", - "Whether or not the local JID is the initiator of the session.", - FALSE, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_STATE, - g_param_spec_boolean("state", - "State", - "The state of the session (PENDING=FALSE, ACTIVE=TRUE).", - FALSE, - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_CONTENTS, - g_param_spec_pointer("contents", - "Contents", - "The active contents contained within this session", - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_PENDING_CONTENTS, - g_param_spec_pointer("pending-contents", - "Pending contents", - "The pending contents contained within this session", - G_PARAM_READABLE)); - - g_type_class_add_private(klass, sizeof(JingleSessionPrivate)); -} - -static void -jingle_session_init (JingleSession *session) -{ - session->priv = JINGLE_SESSION_GET_PRIVATE(session); - memset(session->priv, 0, sizeof(*session->priv)); -} - -static void -jingle_session_finalize (GObject *session) -{ - JingleSessionPrivate *priv = JINGLE_SESSION_GET_PRIVATE(session); - purple_debug_info("jingle","jingle_session_finalize\n"); - - g_hash_table_remove(priv->js->sessions, priv->sid); - - g_free(priv->sid); - g_free(priv->remote_jid); - g_free(priv->local_jid); - - for (; priv->contents; priv->contents = - g_list_delete_link(priv->contents, priv->contents)) { - g_object_unref(priv->contents->data); - } - for (; priv->pending_contents; priv->pending_contents = - g_list_delete_link(priv->pending_contents, priv->pending_contents)) { - g_object_unref(priv->pending_contents->data); - } - - parent_class->finalize(session); -} - -static void -jingle_session_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleSession *session; - g_return_if_fail(JINGLE_IS_SESSION(object)); - - session = JINGLE_SESSION(object); - - switch (prop_id) { - case PROP_SID: - g_free(session->priv->sid); - session->priv->sid = g_value_dup_string(value); - break; - case PROP_JS: - session->priv->js = g_value_get_pointer(value); - break; - case PROP_REMOTE_JID: - g_free(session->priv->remote_jid); - session->priv->remote_jid = g_value_dup_string(value); - break; - case PROP_LOCAL_JID: - g_free(session->priv->local_jid); - session->priv->local_jid = g_value_dup_string(value); - break; - case PROP_IS_INITIATOR: - session->priv->is_initiator = g_value_get_boolean(value); - break; - case PROP_STATE: - session->priv->state = g_value_get_boolean(value); - break; - case PROP_CONTENTS: - session->priv->contents = g_value_get_pointer(value); - break; - case PROP_PENDING_CONTENTS: - session->priv->pending_contents = g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_session_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleSession *session; - g_return_if_fail(JINGLE_IS_SESSION(object)); - - session = JINGLE_SESSION(object); - - switch (prop_id) { - case PROP_SID: - g_value_set_string(value, session->priv->sid); - break; - case PROP_JS: - g_value_set_pointer(value, session->priv->js); - break; - case PROP_REMOTE_JID: - g_value_set_string(value, session->priv->remote_jid); - break; - case PROP_LOCAL_JID: - g_value_set_string(value, session->priv->local_jid); - break; - case PROP_IS_INITIATOR: - g_value_set_boolean(value, session->priv->is_initiator); - break; - case PROP_STATE: - g_value_set_boolean(value, session->priv->state); - break; - case PROP_CONTENTS: - g_value_set_pointer(value, session->priv->contents); - break; - case PROP_PENDING_CONTENTS: - g_value_set_pointer(value, session->priv->pending_contents); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -JingleSession * -jingle_session_create(JabberStream *js, const gchar *sid, - const gchar *local_jid, const gchar *remote_jid, - gboolean is_initiator) -{ - JingleSession *session = g_object_new(jingle_session_get_type(), - "js", js, - "sid", sid, - "local-jid", local_jid, - "remote-jid", remote_jid, - "is_initiator", is_initiator, - NULL); - - /* insert it into the hash table */ - if (!js->sessions) { - purple_debug_info("jingle", - "Creating hash table for sessions\n"); - js->sessions = g_hash_table_new(g_str_hash, g_str_equal); - } - purple_debug_info("jingle", - "inserting session with key: %s into table\n", sid); - g_hash_table_insert(js->sessions, g_strdup(sid), session); - - return session; -} - -JabberStream * -jingle_session_get_js(JingleSession *session) -{ - JabberStream *js; - g_object_get(session, "js", &js, NULL); - return js; -} - -gchar * -jingle_session_get_sid(JingleSession *session) -{ - gchar *sid; - g_object_get(session, "sid", &sid, NULL); - return sid; -} - -gchar * -jingle_session_get_local_jid(JingleSession *session) -{ - gchar *local_jid; - g_object_get(session, "local-jid", &local_jid, NULL); - return local_jid; -} - -gchar * -jingle_session_get_remote_jid(JingleSession *session) -{ - gchar *remote_jid; - g_object_get(session, "remote-jid", &remote_jid, NULL); - return remote_jid; -} - -gboolean -jingle_session_is_initiator(JingleSession *session) -{ - gboolean is_initiator; - g_object_get(session, "is-initiator", &is_initiator, NULL); - return is_initiator; -} - -gboolean -jingle_session_get_state(JingleSession *session) -{ - gboolean state; - g_object_get(session, "state", &state, NULL); - return state; -} - -GList * -jingle_session_get_contents(JingleSession *session) -{ - GList *contents; - g_object_get(session, "contents", &contents, NULL); - return contents; -} - -GList * -jingle_session_get_pending_contents(JingleSession *session) -{ - GList *pending_contents; - g_object_get(session, "pending-contents", &pending_contents, NULL); - return pending_contents; -} - -JingleSession * -jingle_session_find_by_sid(JabberStream *js, const gchar *sid) -{ - JingleSession *session = NULL; - - if (js->sessions) - session = g_hash_table_lookup(js->sessions, sid); - - purple_debug_info("jingle", "find_by_id %s\n", sid); - purple_debug_info("jingle", "lookup: %p\n", session); - - return session; -} - -#if GLIB_CHECK_VERSION(2,4,0) -static gboolean find_by_jid_ghr(gpointer key, - gpointer value, gpointer user_data) -{ - JingleSession *session = (JingleSession *)value; - const gchar *jid = user_data; - gboolean use_bare = g_utf8_strchr(jid, -1, '/') == NULL; - gchar *remote_jid = jingle_session_get_remote_jid(session); - gchar *cmp_jid = use_bare ? jabber_get_bare_jid(remote_jid) - : g_strdup(remote_jid); - g_free(remote_jid); - if (g_str_equal(jid, cmp_jid)) { - g_free(cmp_jid); - return TRUE; - } - g_free(cmp_jid); - - return FALSE; -} - -#else /* GLIB_CHECK_VERSION 2.4.0 */ - -/* Ugly code; g_hash_table_find version above is much nicer */ -struct session_find_jid -{ - const gchar *jid; - JingleSession *ret; - gboolean use_bare; -}; - -static void find_by_jid_ghr(gpointer key, gpointer value, gpointer user_data) -{ - JingleSession *session = (JingleSession *)value; - struct session_find_jid *data = user_data; - gchar *remote_jid; - gchar *cmp_jid; - - if (data->ret != NULL) - return; - - remote_jid = jingle_session_get_remote_jid(session); - cmp_jid = data->use_bare ? jabber_get_bare_jid(remote_jid) - : g_strdup(remote_jid); - g_free(remote_jid); - - if (g_str_equal(data->jid, cmp_jid)) - data->ret = session; - - g_free(cmp_jid); -} -#endif /* GLIB_CHECK_VERSION 2.4.0 */ - -JingleSession * -jingle_session_find_by_jid(JabberStream *js, const gchar *jid) -{ -#if GLIB_CHECK_VERSION(2,4,0) - return js->sessions != NULL ? - g_hash_table_find(js->sessions, - find_by_jid_ghr, (gpointer)jid) : NULL; -#else - struct session_find_jid data; - - if (js->sessions == NULL) - return NULL; - - data.jid = jid; - data.ret = NULL; - data.use_bare = g_utf8_strchr(jid, -1, '/') == NULL; - - g_hash_table_foreach(js->sessions, find_by_jid_ghr, &data); - return data.ret; -#endif -} - -static xmlnode * -jingle_add_jingle_packet(JingleSession *session, - JabberIq *iq, JingleActionType action) -{ - xmlnode *jingle = iq ? - xmlnode_new_child(iq->node, "jingle") : - xmlnode_new("jingle"); - gchar *local_jid = jingle_session_get_local_jid(session); - gchar *remote_jid = jingle_session_get_remote_jid(session); - - xmlnode_set_namespace(jingle, JINGLE); - xmlnode_set_attrib(jingle, "action", jingle_get_action_name(action)); - - if (jingle_session_is_initiator(session)) { - xmlnode_set_attrib(jingle, "initiator", - jingle_session_get_local_jid(session)); - xmlnode_set_attrib(jingle, "responder", - jingle_session_get_remote_jid(session)); - } else { - xmlnode_set_attrib(jingle, "initiator", - jingle_session_get_remote_jid(session)); - xmlnode_set_attrib(jingle, "responder", - jingle_session_get_local_jid(session)); - } - - g_free(local_jid); - g_free(remote_jid); - - xmlnode_set_attrib(jingle, "sid", jingle_session_get_sid(session)); - - return jingle; -} - -JabberIq * -jingle_session_create_ack(JingleSession *session, const xmlnode *jingle) -{ - JabberIq *result = jabber_iq_new( - jingle_session_get_js(session), - JABBER_IQ_RESULT); - xmlnode *packet = xmlnode_get_parent(jingle); - jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id")); - xmlnode_set_attrib(result->node, "from", xmlnode_get_attrib(packet, "to")); - xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); - return result; -} - -static JabberIq * -jingle_create_iq(JingleSession *session) -{ - JabberStream *js = jingle_session_get_js(session); - JabberIq *result = jabber_iq_new(js, JABBER_IQ_SET); - gchar *from = jingle_session_get_local_jid(session); - gchar *to = jingle_session_get_remote_jid(session); - - xmlnode_set_attrib(result->node, "from", from); - xmlnode_set_attrib(result->node, "to", to); - - g_free(from); - g_free(to); - return result; -} - -xmlnode * -jingle_session_to_xml(JingleSession *session, xmlnode *jingle, JingleActionType action) -{ - if (action != JINGLE_SESSION_INFO && action != JINGLE_SESSION_TERMINATE) { - GList *iter; - if (action == JINGLE_CONTENT_ACCEPT - || action == JINGLE_CONTENT_ADD - || action == JINGLE_CONTENT_REMOVE) - iter = jingle_session_get_pending_contents(session); - else - iter = jingle_session_get_contents(session); - - for (; iter; iter = g_list_next(iter)) { - jingle_content_to_xml(iter->data, jingle, action); - } - } - return jingle; -} - -JabberIq * -jingle_session_to_packet(JingleSession *session, JingleActionType action) -{ - JabberIq *iq = jingle_create_iq(session); - xmlnode *jingle = jingle_add_jingle_packet(session, iq, action); - jingle_session_to_xml(session, jingle, action); - return iq; -} - -void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action) -{ - GList *iter; - if (action == JINGLE_CONTENT_ADD || action == JINGLE_CONTENT_REMOVE) - iter = jingle_session_get_pending_contents(session); - else - iter = jingle_session_get_contents(session); - - for (; iter; iter = g_list_next(iter)) { - jingle_content_handle_action(iter->data, jingle, action); - } -} - -JingleContent * -jingle_session_find_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - GList *iter = session->priv->contents; - for (; iter; iter = g_list_next(iter)) { - JingleContent *content = iter->data; - gchar *cname = jingle_content_get_name(content); - gboolean result = !strcmp(name, cname); - g_free(cname); - - if (creator != NULL) { - gchar *ccreator = jingle_content_get_creator(content); - result = (result && !strcmp(creator, ccreator)); - g_free(ccreator); - } - - if (result == TRUE) - return content; - } - return NULL; -} - -JingleContent * -jingle_session_find_pending_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - GList *iter = session->priv->pending_contents; - for (; iter; iter = g_list_next(iter)) { - JingleContent *content = iter->data; - gchar *cname = jingle_content_get_name(content); - gboolean result = !strcmp(name, cname); - g_free(cname); - - if (creator != NULL) { - gchar *ccreator = jingle_content_get_creator(content); - result = (result && !strcmp(creator, ccreator)); - g_free(ccreator); - } - - if (result == TRUE) - return content; - } - return NULL; -} - -void -jingle_session_add_content(JingleSession *session, JingleContent* content) -{ - session->priv->contents = - g_list_append(session->priv->contents, content); - jingle_content_set_session(content, session); -} - -void -jingle_session_remove_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - JingleContent *content = - jingle_session_find_content(session, name, creator); - - if (content) { - session->priv->contents = - g_list_remove(session->priv->contents, content); - g_object_unref(content); - } -} - -void -jingle_session_add_pending_content(JingleSession *session, JingleContent* content) -{ - session->priv->pending_contents = - g_list_append(session->priv->pending_contents, content); - jingle_content_set_session(content, session); -} - -void -jingle_session_remove_pending_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - JingleContent *content = jingle_session_find_pending_content(session, name, creator); - - if (content) { - session->priv->pending_contents = - g_list_remove(session->priv->pending_contents, content); - g_object_unref(content); - } -} - -void -jingle_session_accept_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - JingleContent *content = jingle_session_find_pending_content(session, name, creator); - - if (content) { - g_object_ref(content); - jingle_session_remove_pending_content(session, name, creator); - jingle_session_add_content(session, content); - } -} - -void -jingle_session_accept_session(JingleSession *session) -{ - session->priv->state = TRUE; -} - -JabberIq * -jingle_session_terminate_packet(JingleSession *session, const gchar *reason) -{ - JabberIq *iq = jingle_session_to_packet(session, - JINGLE_SESSION_TERMINATE); - xmlnode *jingle = xmlnode_get_child(iq->node, "jingle"); - - if (reason != NULL) { - xmlnode *reason_node; - reason_node = xmlnode_new_child(jingle, "reason"); - xmlnode_new_child(reason_node, reason); - } - return iq; -} - -JabberIq * -jingle_session_redirect_packet(JingleSession *session, const gchar *sid) -{ - JabberIq *iq = jingle_session_terminate_packet(session, - "alternative-session"); - xmlnode *alt_session; - - if (sid == NULL) - return iq; - - alt_session = xmlnode_get_child(iq->node, - "jingle/reason/alternative-session"); - - if (alt_session != NULL) { - xmlnode *sid_node = xmlnode_new_child(alt_session, "sid"); - xmlnode_insert_data(sid_node, sid, -1); - } - return iq; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file session.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_SESSION_H -#define PURPLE_JABBER_JINGLE_SESSION_H - -#include "iq.h" -#include "jabber.h" - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define JINGLE_TYPE_SESSION (jingle_session_get_type()) -#define JINGLE_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_SESSION, JingleSession)) -#define JINGLE_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_SESSION, JingleSessionClass)) -#define JINGLE_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_SESSION)) -#define JINGLE_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_SESSION)) -#define JINGLE_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_SESSION, JingleSessionClass)) - -/** @copydoc _JingleSession */ -typedef struct _JingleSession JingleSession; -/** @copydoc _JingleSessionClass */ -typedef struct _JingleSessionClass JingleSessionClass; -/** @copydoc _JingleSessionPrivate */ -typedef struct _JingleSessionPrivate JingleSessionPrivate; - -/** The session class */ -struct _JingleSessionClass -{ - GObjectClass parent_class; /**< The parent class. */ -}; - -/** The session class's private data */ -struct _JingleSession -{ - GObject parent; /**< The parent of this object. */ - JingleSessionPrivate *priv; /**< The private data of this object. */ -}; - -struct _JingleContent; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the session class's GType - * - * @return The session class's GType. - */ -GType jingle_session_get_type(void); - -JingleSession *jingle_session_create(JabberStream *js, const gchar *sid, - const gchar *local_jid, const gchar *remote_jid, - gboolean is_initiator); -JabberStream *jingle_session_get_js(JingleSession *session); -gchar *jingle_session_get_sid(JingleSession *session); -gchar *jingle_session_get_local_jid(JingleSession *session); -gchar *jingle_session_get_remote_jid(JingleSession *session); -gboolean jingle_session_is_initiator(JingleSession *session); -gboolean jingle_session_get_state(JingleSession *session); - -GList *jingle_session_get_contents(JingleSession *session); -GList *jingle_session_get_pending_contents(JingleSession *session); - -JingleSession *jingle_session_find_by_sid(JabberStream *js, const gchar *sid); -JingleSession *jingle_session_find_by_jid(JabberStream *js, const gchar *jid); - -JabberIq *jingle_session_create_ack(JingleSession *session, const xmlnode *jingle); -xmlnode *jingle_session_to_xml(JingleSession *session, xmlnode *parent, JingleActionType action); -JabberIq *jingle_session_to_packet(JingleSession *session, JingleActionType action); - -void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action); - -struct _JingleContent *jingle_session_find_content(JingleSession *session, - const gchar *name, const gchar *creator); -struct _JingleContent *jingle_session_find_pending_content(JingleSession *session, - const gchar *name, const gchar *creator); - -void jingle_session_add_content(JingleSession *session, struct _JingleContent* content); -void jingle_session_remove_content(JingleSession *session, const gchar *name, const gchar *creator); -void jingle_session_add_pending_content(JingleSession *session, struct _JingleContent* content); -void jingle_session_remove_pending_content(JingleSession *session, const gchar *name, const gchar *creator); -void jingle_session_accept_content(JingleSession *session, const gchar *name, const gchar *creator); -void jingle_session_accept_session(JingleSession *session); -JabberIq *jingle_session_terminate_packet(JingleSession *session, const gchar *reason); -JabberIq *jingle_session_redirect_packet(JingleSession *session, const gchar *sid); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_SESSION_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -/** - * @file transport.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "transport.h" -#include "jingle.h" -#include "debug.h" - -#include <string.h> - -struct _JingleTransportPrivate -{ - void *dummy; -}; - -#define JINGLE_TRANSPORT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_TRANSPORT, JingleTransportPrivate)) - -static void jingle_transport_class_init (JingleTransportClass *klass); -static void jingle_transport_init (JingleTransport *transport); -static void jingle_transport_finalize (GObject *object); -static void jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -JingleTransport *jingle_transport_parse_internal(xmlnode *transport); -xmlnode *jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); - -static GObjectClass *parent_class = NULL; - -enum { - PROP_0, -}; - -GType -jingle_transport_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleTransportClass), - NULL, - NULL, - (GClassInitFunc) jingle_transport_class_init, - NULL, - NULL, - sizeof(JingleTransport), - 0, - (GInstanceInitFunc) jingle_transport_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "JingleTransport", &info, 0); - } - return type; -} - -static void -jingle_transport_class_init (JingleTransportClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_transport_finalize; - gobject_class->set_property = jingle_transport_set_property; - gobject_class->get_property = jingle_transport_get_property; - klass->to_xml = jingle_transport_to_xml_internal; - klass->parse = jingle_transport_parse_internal; - - g_type_class_add_private(klass, sizeof(JingleTransportPrivate)); -} - -static void -jingle_transport_init (JingleTransport *transport) -{ - transport->priv = JINGLE_TRANSPORT_GET_PRIVATE(transport); - transport->priv->dummy = NULL; -} - -static void -jingle_transport_finalize (GObject *transport) -{ - /* JingleTransportPrivate *priv = JINGLE_TRANSPORT_GET_PRIVATE(transport); */ - purple_debug_info("jingle","jingle_transport_finalize\n"); - - parent_class->finalize(transport); -} - -static void -jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleTransport *transport; - g_return_if_fail(JINGLE_IS_TRANSPORT(object)); - - transport = JINGLE_TRANSPORT(object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleTransport *transport; - g_return_if_fail(JINGLE_IS_TRANSPORT(object)); - - transport = JINGLE_TRANSPORT(object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -JingleTransport * -jingle_transport_create(const gchar *type) -{ - return g_object_new(jingle_get_type(type), NULL); -} - -const gchar * -jingle_transport_get_transport_type(JingleTransport *transport) -{ - return JINGLE_TRANSPORT_GET_CLASS(transport)->transport_type; -} - -JingleTransport * -jingle_transport_parse_internal(xmlnode *transport) -{ - const gchar *type = xmlnode_get_namespace(transport); - return jingle_transport_create(type); -} - -xmlnode * -jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - xmlnode *node = xmlnode_new_child(content, "transport"); - xmlnode_set_namespace(node, jingle_transport_get_transport_type(transport)); - return node; -} - -JingleTransport * -jingle_transport_parse(xmlnode *transport) -{ - const gchar *type = xmlnode_get_namespace(transport); - return JINGLE_TRANSPORT_CLASS(g_type_class_ref(jingle_get_type(type)))->parse(transport); -} - -xmlnode * -jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - g_return_val_if_fail(JINGLE_IS_TRANSPORT(transport), NULL); - return JINGLE_TRANSPORT_GET_CLASS(transport)->to_xml(transport, content, action); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jingle/transport.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/** - * @file transport.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_TRANSPORT_H -#define PURPLE_JABBER_JINGLE_TRANSPORT_H - -#include <glib.h> -#include <glib-object.h> - -#include "jingle.h" -#include "xmlnode.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_TRANSPORT (jingle_transport_get_type()) -#define JINGLE_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_TRANSPORT, JingleTransport)) -#define JINGLE_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_TRANSPORT, JingleTransportClass)) -#define JINGLE_IS_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_TRANSPORT)) -#define JINGLE_IS_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_TRANSPORT)) -#define JINGLE_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_TRANSPORT, JingleTransportClass)) - -/** @copydoc _JingleTransport */ -typedef struct _JingleTransport JingleTransport; -/** @copydoc _JingleTransportClass */ -typedef struct _JingleTransportClass JingleTransportClass; -/** @copydoc _JingleTransportPrivate */ -typedef struct _JingleTransportPrivate JingleTransportPrivate; - -/** The transport class */ -struct _JingleTransportClass -{ - GObjectClass parent_class; /**< The parent class. */ - - const gchar *transport_type; - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); -}; - -/** The transport class's private data */ -struct _JingleTransport -{ - GObject parent; /**< The parent of this object. */ - JingleTransportPrivate *priv; /**< The private data of this object. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the transport class's GType - * - * @return The transport class's GType. - */ -GType jingle_transport_get_type(void); - -JingleTransport *jingle_transport_create(const gchar *type); -const gchar *jingle_transport_get_transport_type(JingleTransport *transport); -void jingle_transport_add_candidate(); - -JingleTransport *jingle_transport_parse(xmlnode *transport); -xmlnode *jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_TRANSPORT_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,635 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "account.h" -#include "cipher.h" -#include "conversation.h" -#include "debug.h" -#include "server.h" -#include "util.h" -#include "xmlnode.h" - -#include "chat.h" -#include "presence.h" -#include "jutil.h" - -#ifdef USE_IDN -#include <idna.h> -#include <stringprep.h> -static char idn_buffer[1024]; -#endif - -#ifdef USE_IDN -static gboolean jabber_nodeprep(char *str, size_t buflen) -{ - return stringprep_xmpp_nodeprep(str, buflen) == STRINGPREP_OK; -} - -static gboolean jabber_resourceprep(char *str, size_t buflen) -{ - return stringprep_xmpp_resourceprep(str, buflen) == STRINGPREP_OK; -} - -static JabberID* -jabber_idn_validate(const char *str, const char *at, const char *slash, - const char *null) -{ - const char *node = NULL; - const char *domain = NULL; - const char *resource = NULL; - int node_len = 0; - int domain_len = 0; - int resource_len = 0; - char *out; - JabberID *jid; - - /* Ensure no parts are > 1023 bytes */ - if (at) { - node = str; - node_len = at - str; - - domain = at + 1; - if (slash) { - domain_len = slash - (at + 1); - resource = slash + 1; - resource_len = null - (slash + 1); - } else { - domain_len = null - (at + 1); - } - } else { - domain = str; - - if (slash) { - domain_len = slash - str; - resource = slash; - resource_len = null - (slash + 1); - } else { - domain_len = null - (str + 1); - } - } - - if (node && node_len > 1023) - return NULL; - if (domain_len > 1023) - return NULL; - if (resource && resource_len > 1023) - return NULL; - - jid = g_new0(JabberID, 1); - - if (node) { - strncpy(idn_buffer, node, node_len); - idn_buffer[node_len] = '\0'; - - if (!jabber_nodeprep(idn_buffer, sizeof(idn_buffer))) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - - jid->node = g_strdup(idn_buffer); - } - - /* domain *must* be here */ - strncpy(idn_buffer, domain, domain_len); - idn_buffer[domain_len] = '\0'; - if (domain[0] == '[') { /* IPv6 address */ - gboolean valid = FALSE; - - if (idn_buffer[domain_len - 1] == ']') { - idn_buffer[domain_len - 1] = '\0'; - valid = purple_ipv6_address_is_valid(idn_buffer + 1); - } - - if (!valid) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - } else { - /* Apply nameprep */ - if (stringprep_nameprep(idn_buffer, sizeof(idn_buffer)) != STRINGPREP_OK) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - - /* And now ToASCII */ - if (idna_to_ascii_8z(idn_buffer, &out, IDNA_USE_STD3_ASCII_RULES) != IDNA_SUCCESS) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - - /* This *MUST* be freed using 'free', not 'g_free' */ - free(out); - jid->domain = g_strdup(idn_buffer); - } - - if (resource) { - strncpy(idn_buffer, resource, resource_len); - idn_buffer[resource_len] = '\0'; - - if (!jabber_resourceprep(idn_buffer, sizeof(idn_buffer))) { - jabber_id_free(jid); - jid = NULL; - goto out; - } else - jid->resource = g_strdup(idn_buffer); - } - -out: - return jid; -} - -#endif /* USE_IDN */ - -gboolean jabber_nodeprep_validate(const char *str) -{ -#ifdef USE_IDN - gboolean result; -#else - const char *c; -#endif - - if(!str) - return TRUE; - - if(strlen(str) > 1023) - return FALSE; - -#ifdef USE_IDN - strncpy(idn_buffer, str, sizeof(idn_buffer) - 1); - idn_buffer[sizeof(idn_buffer) - 1] = '\0'; - result = jabber_nodeprep(idn_buffer, sizeof(idn_buffer)); - return result; -#else /* USE_IDN */ - c = str; - while(c && *c) { - gunichar ch = g_utf8_get_char(c); - if(ch == '\"' || ch == '&' || ch == '\'' || ch == '/' || ch == ':' || - ch == '<' || ch == '>' || ch == '@' || !g_unichar_isgraph(ch)) { - return FALSE; - } - c = g_utf8_next_char(c); - } - - return TRUE; -#endif /* USE_IDN */ -} - -gboolean jabber_domain_validate(const char *str) -{ - const char *c; - size_t len; - - if(!str) - return TRUE; - - len = strlen(str); - if (len > 1023) - return FALSE; - - c = str; - - if (*c == '[') { - /* Check if str is a valid IPv6 identifier */ - gboolean valid = FALSE; - - if (*(c + len - 1) != ']') - return FALSE; - - /* Ugly, but in-place */ - *(gchar *)(c + len - 1) = '\0'; - valid = purple_ipv6_address_is_valid(c + 1); - *(gchar *)(c + len - 1) = ']'; - - return valid; - } - - while(c && *c) { - gunichar ch = g_utf8_get_char(c); - /* The list of characters allowed in domain names is pretty small */ - if ((ch <= 0x7F && !( (ch >= 'a' && ch <= 'z') - || (ch >= '0' && ch <= '9') - || (ch >= 'A' && ch <= 'Z') - || ch == '.' - || ch == '-' )) || (ch >= 0x80 && !g_unichar_isgraph(ch))) - return FALSE; - - c = g_utf8_next_char(c); - } - - return TRUE; -} - -gboolean jabber_resourceprep_validate(const char *str) -{ -#ifdef USE_IDN - gboolean result; -#else - const char *c; -#endif - - if(!str) - return TRUE; - - if(strlen(str) > 1023) - return FALSE; - -#ifdef USE_IDN - strncpy(idn_buffer, str, sizeof(idn_buffer) - 1); - idn_buffer[sizeof(idn_buffer) - 1] = '\0'; - result = jabber_resourceprep(idn_buffer, sizeof(idn_buffer)); - return result; -#else /* USE_IDN */ - c = str; - while(c && *c) { - gunichar ch = g_utf8_get_char(c); - if(!g_unichar_isgraph(ch) && ch != ' ') - return FALSE; - - c = g_utf8_next_char(c); - } - - return TRUE; -#endif /* USE_IDN */ -} - -static JabberID* -jabber_id_new_internal(const char *str, gboolean allow_terminating_slash) -{ - const char *at = NULL; - const char *slash = NULL; - const char *c; - gboolean needs_validation = FALSE; -#if 0 - gboolean node_is_required = FALSE; -#endif -#ifndef USE_IDN - char *node = NULL; - char *domain; -#endif - JabberID *jid; - - if (!str) - return NULL; - - for (c = str; *c != '\0'; c++) - { - switch (*c) { - case '@': - if (!slash) { - if (at) { - /* Multiple @'s in the node/domain portion, not a valid JID! */ - return NULL; - } - if (c == str) { - /* JIDs cannot start with @ */ - return NULL; - } - if (c[1] == '\0') { - /* JIDs cannot end with @ */ - return NULL; - } - at = c; - } - break; - - case '/': - if (!slash) { - if (c == str) { - /* JIDs cannot start with / */ - return NULL; - } - if (c[1] == '\0' && !allow_terminating_slash) { - /* JIDs cannot end with / */ - return NULL; - } - slash = c; - } - break; - - default: - /* characters allowed everywhere */ - if ((*c >= 'a' && *c <= 'z') - || (*c >= '0' && *c <= '9') - || (*c >= 'A' && *c <= 'Z') - || *c == '.' || *c == '-') - /* We're good */ - break; - -#if 0 - if (slash != NULL) { - /* characters allowed only in the resource */ - if (implement_me) - /* We're good */ - break; - } - - /* characters allowed only in the node */ - if (implement_me) { - /* - * Ok, this character is valid, but only if it's a part - * of the node and not the domain. But we don't know - * if "c" is a part of the node or the domain until after - * we've found the @. So set a flag for now and check - * that we found an @ later. - */ - node_is_required = TRUE; - break; - } -#endif - - /* - * Hmm, this character is a bit more exotic. Better fall - * back to using the more expensive UTF-8 compliant - * stringprep functions. - */ - needs_validation = TRUE; - break; - } - } - -#if 0 - if (node_is_required && at == NULL) - /* Found invalid characters in the domain */ - return NULL; -#endif - - if (!needs_validation) { - /* JID is made of only ASCII characters--just lowercase and return */ - jid = g_new0(JabberID, 1); - - if (at) { - jid->node = g_ascii_strdown(str, at - str); - if (slash) { - jid->domain = g_ascii_strdown(at + 1, slash - (at + 1)); - if (*(slash + 1)) - jid->resource = g_strdup(slash + 1); - } else { - jid->domain = g_ascii_strdown(at + 1, -1); - } - } else { - if (slash) { - jid->domain = g_ascii_strdown(str, slash - str); - if (*(slash + 1)) - jid->resource = g_strdup(slash + 1); - } else { - jid->domain = g_ascii_strdown(str, -1); - } - } - return jid; - } - - /* - * If we get here, there are some non-ASCII chars in the string, so - * we'll need to validate it, normalize, and finally do a full jabber - * nodeprep on the jid. - */ - - if (!g_utf8_validate(str, -1, NULL)) - return NULL; - -#ifdef USE_IDN - return jabber_idn_validate(str, at, slash, c /* points to the null */); -#else /* USE_IDN */ - - jid = g_new0(JabberID, 1); - - /* normalization */ - if(at) { - node = g_utf8_casefold(str, at-str); - if(slash) { - domain = g_utf8_casefold(at+1, slash-(at+1)); - if (*(slash + 1)) - jid->resource = g_utf8_normalize(slash+1, -1, G_NORMALIZE_NFKC); - } else { - domain = g_utf8_casefold(at+1, -1); - } - } else { - if(slash) { - domain = g_utf8_casefold(str, slash-str); - if (*(slash + 1)) - jid->resource = g_utf8_normalize(slash+1, -1, G_NORMALIZE_NFKC); - } else { - domain = g_utf8_casefold(str, -1); - } - } - - if (node) { - jid->node = g_utf8_normalize(node, -1, G_NORMALIZE_NFKC); - g_free(node); - } - - if (domain) { - jid->domain = g_utf8_normalize(domain, -1, G_NORMALIZE_NFKC); - g_free(domain); - } - - /* and finally the jabber nodeprep */ - if(!jabber_nodeprep_validate(jid->node) || - !jabber_domain_validate(jid->domain) || - !jabber_resourceprep_validate(jid->resource)) { - jabber_id_free(jid); - return NULL; - } - - return jid; -#endif /* USE_IDN */ -} - -void -jabber_id_free(JabberID *jid) -{ - if(jid) { - if(jid->node) - g_free(jid->node); - if(jid->domain) - g_free(jid->domain); - if(jid->resource) - g_free(jid->resource); - g_free(jid); - } -} - - -char *jabber_get_resource(const char *in) -{ - JabberID *jid = jabber_id_new(in); - char *out; - - if(!jid) - return NULL; - - out = g_strdup(jid->resource); - jabber_id_free(jid); - - return out; -} - -char * -jabber_get_bare_jid(const char *in) -{ - JabberID *jid = jabber_id_new(in); - char *out; - - if (!jid) - return NULL; - out = jabber_id_get_bare_jid(jid); - jabber_id_free(jid); - - return out; -} - -char * -jabber_id_get_bare_jid(const JabberID *jid) -{ - g_return_val_if_fail(jid != NULL, NULL); - - return g_strconcat(jid->node ? jid->node : "", - jid->node ? "@" : "", - jid->domain, - NULL); -} - -JabberID * -jabber_id_new(const char *str) -{ - return jabber_id_new_internal(str, FALSE); -} - -const char *jabber_normalize(const PurpleAccount *account, const char *in) -{ - PurpleConnection *gc = account ? account->gc : NULL; - JabberStream *js = gc ? gc->proto_data : NULL; - static char buf[3072]; /* maximum legal length of a jabber jid */ - JabberID *jid; - - jid = jabber_id_new_internal(in, TRUE); - if(!jid) - return NULL; - - if(js && jid->node && jid->resource && - jabber_chat_find(js, jid->node, jid->domain)) - g_snprintf(buf, sizeof(buf), "%s@%s/%s", jid->node, jid->domain, - jid->resource); - else - g_snprintf(buf, sizeof(buf), "%s%s%s", jid->node ? jid->node : "", - jid->node ? "@" : "", jid->domain); - - jabber_id_free(jid); - - return buf; -} - -gboolean -jabber_is_own_server(JabberStream *js, const char *str) -{ - JabberID *jid; - gboolean equal; - - if (str == NULL) - return FALSE; - - g_return_val_if_fail(*str != '\0', FALSE); - - jid = jabber_id_new(str); - if (!jid) - return FALSE; - - equal = (jid->node == NULL && - g_str_equal(jid->domain, js->user->domain) && - jid->resource == NULL); - jabber_id_free(jid); - return equal; -} - -gboolean -jabber_is_own_account(JabberStream *js, const char *str) -{ - JabberID *jid; - gboolean equal; - - if (str == NULL) - return TRUE; - - g_return_val_if_fail(*str != '\0', FALSE); - - jid = jabber_id_new(str); - if (!jid) - return FALSE; - - equal = (purple_strequal(jid->node, js->user->node) && - g_str_equal(jid->domain, js->user->domain) && - (jid->resource == NULL || - g_str_equal(jid->resource, js->user->resource))); - jabber_id_free(jid); - return equal; -} - -PurpleConversation * -jabber_find_unnormalized_conv(const char *name, PurpleAccount *account) -{ - PurpleConversation *c = NULL; - GList *cnv; - - g_return_val_if_fail(name != NULL, NULL); - - for(cnv = purple_get_conversations(); cnv; cnv = cnv->next) { - c = (PurpleConversation*)cnv->data; - if(purple_conversation_get_type(c) == PURPLE_CONV_TYPE_IM && - !purple_utf8_strcasecmp(name, purple_conversation_get_name(c)) && - account == purple_conversation_get_account(c)) - return c; - } - - return NULL; -} - -/* The same as purple_util_get_image_checksum, but guaranteed to remain SHA1 */ -char * -jabber_calculate_data_sha1sum(gconstpointer data, size_t len) -{ - PurpleCipherContext *context; - static gchar digest[41]; - - context = purple_cipher_context_new_by_name("sha1", NULL); - if (context == NULL) - { - purple_debug_error("jabber", "Could not find sha1 cipher\n"); - g_return_val_if_reached(NULL); - } - - /* Hash the data */ - purple_cipher_context_append(context, data, len); - if (!purple_cipher_context_digest_to_str(context, sizeof(digest), digest, NULL)) - { - purple_debug_error("jabber", "Failed to get SHA-1 digest.\n"); - g_return_val_if_reached(NULL); - } - purple_cipher_context_destroy(context); - - return g_strdup(digest); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/jutil.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file jutil.h utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_JUTIL_H_ -#define PURPLE_JABBER_JUTIL_H_ - -typedef struct _JabberID { - char *node; - char *domain; - char *resource; -} JabberID; - -#include "jabber.h" - -JabberID* jabber_id_new(const char *str); -void jabber_id_free(JabberID *jid); - -char *jabber_get_resource(const char *jid); -char *jabber_get_bare_jid(const char *jid); -char *jabber_id_get_bare_jid(const JabberID *jid); - -const char *jabber_normalize(const PurpleAccount *account, const char *in); - -/* Returns true if JID is the bare JID of our server. */ -gboolean jabber_is_own_server(JabberStream *js, const char *jid); - -/* Returns true if JID is the bare JID of our account. */ -gboolean jabber_is_own_account(JabberStream *js, const char *jid); - -gboolean jabber_nodeprep_validate(const char *); -gboolean jabber_domain_validate(const char *); -gboolean jabber_resourceprep_validate(const char *); - -PurpleConversation *jabber_find_unnormalized_conv(const char *name, PurpleAccount *account); - -char *jabber_calculate_data_sha1sum(gconstpointer data, size_t len); -#endif /* PURPLE_JABBER_JUTIL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/libxmpp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/libxmpp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/libxmpp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/libxmpp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,443 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* libxmpp is the XMPP protocol plugin. It is linked against libjabbercommon, - * which may be used to support other protocols (Bonjour) which may need to - * share code. - */ - -#include "internal.h" - -#include "accountopt.h" -#include "core.h" -#include "debug.h" -#include "version.h" - -#include "iq.h" -#include "jabber.h" -#include "chat.h" -#include "disco.h" -#include "message.h" -#include "roster.h" -#include "si.h" -#include "message.h" -#include "presence.h" -#include "google.h" -#include "pep.h" -#include "usertune.h" -#include "caps.h" -#include "data.h" -#include "ibb.h" - -static PurplePlugin *my_protocol = NULL; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | -#ifdef HAVE_CYRUS_SASL - OPT_PROTO_PASSWORD_OPTIONAL | -#endif - OPT_PROTO_SLASH_COMMANDS_NATIVE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - jabber_list_icon, /* list_icon */ - jabber_list_emblem, /* list_emblems */ - jabber_status_text, /* status_text */ - jabber_tooltip_text, /* tooltip_text */ - jabber_status_types, /* status_types */ - jabber_blist_node_menu, /* blist_node_menu */ - jabber_chat_info, /* chat_info */ - jabber_chat_info_defaults, /* chat_info_defaults */ - jabber_login, /* login */ - jabber_close, /* close */ - jabber_message_send_im, /* send_im */ - jabber_set_info, /* set_info */ - jabber_send_typing, /* send_typing */ - jabber_buddy_get_info, /* get_info */ - jabber_set_status, /* set_status */ - jabber_idle_set, /* set_idle */ - NULL, /* change_passwd */ - jabber_roster_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - jabber_roster_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - jabber_add_deny, /* add_deny */ - NULL, /* rem_permit */ - jabber_rem_deny, /* rem_deny */ - NULL, /* set_permit_deny */ - jabber_chat_join, /* join_chat */ - NULL, /* reject_chat */ - jabber_get_chat_name, /* get_chat_name */ - jabber_chat_invite, /* chat_invite */ - jabber_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - jabber_message_send_chat, /* chat_send */ - jabber_keepalive, /* keepalive */ - jabber_register_account, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - jabber_roster_alias_change, /* alias_buddy */ - jabber_roster_group_change, /* group_buddy */ - jabber_roster_group_rename, /* rename_group */ - NULL, /* buddy_free */ - jabber_convo_closed, /* convo_closed */ - jabber_normalize, /* normalize */ - jabber_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - jabber_chat_buddy_real_name, /* get_cb_real_name */ - jabber_chat_set_topic, /* set_chat_topic */ - jabber_find_blist_chat, /* find_blist_chat */ - jabber_roomlist_get_list, /* roomlist_get_list */ - jabber_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - jabber_can_receive_file, /* can_receive_file */ - jabber_si_xfer_send, /* send_file */ - jabber_si_new_xfer, /* new_xfer */ - jabber_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - jabber_prpl_send_raw, /* send_raw */ - jabber_roomlist_room_serialize, /* roomlist_room_serialize */ - jabber_unregister_account, /* unregister_user */ - jabber_send_attention, /* send_attention */ - jabber_attention_types, /* attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - jabber_initiate_media, /* initiate_media */ - jabber_get_media_caps, /* get_media_caps */ -}; - -static gboolean load_plugin(PurplePlugin *plugin) -{ - purple_signal_register(plugin, "jabber-receiving-xmlnode", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - purple_signal_register(plugin, "jabber-sending-xmlnode", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - /* - * Do not remove this or the plugin will fail. Completely. You have been - * warned! - */ - purple_signal_connect_priority(plugin, "jabber-sending-xmlnode", - plugin, PURPLE_CALLBACK(jabber_send_signal_cb), - NULL, PURPLE_SIGNAL_PRIORITY_HIGHEST); - - purple_signal_register(plugin, "jabber-sending-text", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - - purple_signal_register(plugin, "jabber-receiving-message", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 6, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* id */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_STRING), /* to */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - purple_signal_register(plugin, "jabber-receiving-iq", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* id */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - purple_signal_register(plugin, "jabber-watched-iq", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* id */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); /* child */ - - /* Modifying these? Look at jabber_init_plugin for the ipc versions */ - purple_signal_register(plugin, "jabber-register-namespace-watcher", - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ - - purple_signal_register(plugin, "jabber-unregister-namespace-watcher", - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ - - purple_signal_connect(plugin, "jabber-register-namespace-watcher", - plugin, PURPLE_CALLBACK(jabber_iq_signal_register), NULL); - purple_signal_connect(plugin, "jabber-unregister-namespace-watcher", - plugin, PURPLE_CALLBACK(jabber_iq_signal_unregister), NULL); - - purple_signal_register(plugin, "jabber-receiving-presence", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 4, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - return TRUE; -} - -static gboolean unload_plugin(PurplePlugin *plugin) -{ - purple_signals_unregister_by_instance(plugin); - - /* reverse order of init_plugin */ - jabber_bosh_uninit(); - jabber_data_uninit(); - jabber_si_uninit(); - jabber_ibb_uninit(); - /* PEP things should be uninit via jabber_pep_uninit, not here */ - jabber_pep_uninit(); - jabber_caps_uninit(); - jabber_iq_uninit(); - - jabber_unregister_commands(); - - /* Stay on target...stay on target... Almost there... */ - jabber_uninit_plugin(plugin); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-jabber", /**< id */ - "XMPP", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("XMPP Protocol Plugin"), - /** description */ - N_("XMPP Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - load_plugin, /**< load */ - unload_plugin, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - jabber_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "xmpp")) - return FALSE; - - acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); - - if (!acct) - return FALSE; - - /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */ - if (g_hash_table_lookup_extended(params, "message", NULL, NULL)) { - char *body = g_hash_table_lookup(params, "body"); - if (user && *user) { - PurpleConversation *conv = - purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, user); - purple_conversation_present(conv); - if (body && *body) - purple_conv_send_confirm(conv, body); - } - } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { - char *name = g_hash_table_lookup(params, "name"); - if (user && *user) - purple_blist_request_add_buddy(acct, user, NULL, name); - } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) { - PurpleConnection *gc = purple_account_get_connection(acct); - if (user && *user) { - GHashTable *params = jabber_chat_info_defaults(gc, user); - jabber_chat_join(gc, params); - } - return TRUE; - } - - return FALSE; -} - - -static void -init_plugin(PurplePlugin *plugin) -{ -#ifdef HAVE_CYRUS_SASL -#ifdef _WIN32 - UINT old_error_mode; - gchar *sasldir; -#endif - int ret; -#endif - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ - split = purple_account_user_split_new(_("Domain"), NULL, '@'); - purple_account_user_split_set_reverse(split, FALSE); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - split = purple_account_user_split_new(_("Resource"), NULL, '/'); - purple_account_user_split_set_reverse(split, FALSE); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_bool_new(_("Require SSL/TLS"), "require_tls", JABBER_DEFAULT_REQUIRE_TLS); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Force old (port 5223) SSL"), "old_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new( - _("Allow plaintext auth over unencrypted streams"), - "auth_plain_in_clear", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_int_new(_("Connect port"), "port", 5222); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("Connect server"), - "connect_server", NULL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("File transfer proxies"), - "ft_proxies", - /* TODO: Is this an acceptable default? - * Also, keep this in sync as they add more servers */ - "proxy.eu.jabber.org"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("BOSH URL"), - "bosh_url", NULL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - /* this should probably be part of global smiley theme settings later on, - shared with MSN */ - option = purple_account_option_bool_new(_("Show Custom Smileys"), - "custom_smileys", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - my_protocol = plugin; - jabber_init_plugin(plugin); - - purple_prefs_remove("/plugins/prpl/jabber"); - - /* XXX - If any other plugin wants SASL this won't be good ... */ -#ifdef HAVE_CYRUS_SASL -#ifdef _WIN32 - sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL); - sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir); - g_free(sasldir); - /* Suppress error popups for failing to load sasl plugins */ - old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); -#endif - if ((ret = sasl_client_init(NULL)) != SASL_OK) { - purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret); - } -#ifdef _WIN32 - /* Restore the original error mode */ - SetErrorMode(old_error_mode); -#endif -#endif - jabber_register_commands(); - - /* reverse order of unload_plugin */ - jabber_iq_init(); - jabber_caps_init(); - /* PEP things should be init via jabber_pep_init, not here */ - jabber_pep_init(); - jabber_data_init(); - jabber_bosh_init(); - - //#warning implement adding and retrieving own features via IPC API - - jabber_ibb_init(); - jabber_si_init(); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(xmpp_uri_handler), NULL); -} - - -PURPLE_INIT_PLUGIN(jabber, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - win32/posix.uname.c \ - win32/utsname.h - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -JABBERSOURCES = \ - adhoccommands.c \ - adhoccommands.h \ - auth.c \ - auth.h \ - buddy.c \ - buddy.h \ - bosh.c \ - bosh.h \ - caps.c \ - caps.h \ - chat.c \ - chat.h \ - data.c \ - data.h \ - disco.c \ - disco.h \ - google.c \ - google.h \ - ibb.c \ - ibb.h \ - iq.c \ - iq.h \ - jabber.c \ - jabber.h \ - jingle/jingle.c \ - jingle/jingle.h \ - jingle/content.c \ - jingle/content.h \ - jingle/iceudp.c \ - jingle/iceudp.h \ - jingle/rawudp.c \ - jingle/rawudp.h \ - jingle/rtp.c \ - jingle/rtp.h \ - jingle/session.c \ - jingle/session.h \ - jingle/transport.c \ - jingle/transport.h \ - jutil.c \ - jutil.h \ - message.c \ - message.h \ - namespaces.h \ - oob.c \ - oob.h \ - parser.c \ - parser.h \ - pep.c \ - pep.h \ - ping.c \ - ping.h \ - presence.c \ - presence.h \ - roster.c \ - roster.h \ - si.c \ - si.h \ - useravatar.c \ - useravatar.h \ - usermood.c \ - usermood.h \ - usernick.c \ - usernick.h \ - usertune.c \ - usertune.h \ - xdata.c \ - xdata.h - -AM_CFLAGS = $(st) - -libxmpp_la_LDFLAGS = -module -avoid-version - -if STATIC_JABBER - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libjabber.la -libjabber_la_SOURCES = $(JABBERSOURCES) libxmpp.c -libjabber_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libjabber.la libxmpp.la -libjabber_la_SOURCES = $(JABBERSOURCES) -libjabber_la_LIBADD = $(GLIB_LIBS) $(SASL_LIBS) $(LIBXML_LIBS) $(IDN_LIBS) - -libxmpp_la_SOURCES = libxmpp.c -libxmpp_la_LIBADD = libjabber.la - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(IDN_CFLAGS) \ - $(LIBXML_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1115 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/jabber -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_JABBER_FALSE@libjabber_la_DEPENDENCIES = \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) -am__libjabber_la_SOURCES_DIST = adhoccommands.c adhoccommands.h auth.c \ - auth.h buddy.c buddy.h bosh.c bosh.h caps.c caps.h chat.c \ - chat.h data.c data.h disco.c disco.h google.c google.h ibb.c \ - ibb.h iq.c iq.h jabber.c jabber.h jingle/jingle.c \ - jingle/jingle.h jingle/content.c jingle/content.h \ - jingle/iceudp.c jingle/iceudp.h jingle/rawudp.c \ - jingle/rawudp.h jingle/rtp.c jingle/rtp.h jingle/session.c \ - jingle/session.h jingle/transport.c jingle/transport.h jutil.c \ - jutil.h message.c message.h namespaces.h oob.c oob.h parser.c \ - parser.h pep.c pep.h ping.c ping.h presence.c presence.h \ - roster.c roster.h si.c si.h useravatar.c useravatar.h \ - usermood.c usermood.h usernick.c usernick.h usertune.c \ - usertune.h xdata.c xdata.h libxmpp.c -am__objects_1 = libjabber_la-adhoccommands.lo libjabber_la-auth.lo \ - libjabber_la-buddy.lo libjabber_la-bosh.lo \ - libjabber_la-caps.lo libjabber_la-chat.lo libjabber_la-data.lo \ - libjabber_la-disco.lo libjabber_la-google.lo \ - libjabber_la-ibb.lo libjabber_la-iq.lo libjabber_la-jabber.lo \ - libjabber_la-jingle.lo libjabber_la-content.lo \ - libjabber_la-iceudp.lo libjabber_la-rawudp.lo \ - libjabber_la-rtp.lo libjabber_la-session.lo \ - libjabber_la-transport.lo libjabber_la-jutil.lo \ - libjabber_la-message.lo libjabber_la-oob.lo \ - libjabber_la-parser.lo libjabber_la-pep.lo \ - libjabber_la-ping.lo libjabber_la-presence.lo \ - libjabber_la-roster.lo libjabber_la-si.lo \ - libjabber_la-useravatar.lo libjabber_la-usermood.lo \ - libjabber_la-usernick.lo libjabber_la-usertune.lo \ - libjabber_la-xdata.lo -@STATIC_JABBER_FALSE@am_libjabber_la_OBJECTS = $(am__objects_1) -@STATIC_JABBER_TRUE@am_libjabber_la_OBJECTS = $(am__objects_1) \ -@STATIC_JABBER_TRUE@ libjabber_la-libxmpp.lo -libjabber_la_OBJECTS = $(am_libjabber_la_OBJECTS) -@STATIC_JABBER_FALSE@am_libjabber_la_rpath = -rpath $(pkgdir) -@STATIC_JABBER_TRUE@am_libjabber_la_rpath = -@STATIC_JABBER_FALSE@libxmpp_la_DEPENDENCIES = libjabber.la -am__libxmpp_la_SOURCES_DIST = libxmpp.c -@STATIC_JABBER_FALSE@am_libxmpp_la_OBJECTS = libxmpp.lo -libxmpp_la_OBJECTS = $(am_libxmpp_la_OBJECTS) -@STATIC_JABBER_FALSE@am_libxmpp_la_rpath = -rpath $(pkgdir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libjabber_la_SOURCES) $(libxmpp_la_SOURCES) -DIST_SOURCES = $(am__libjabber_la_SOURCES_DIST) \ - $(am__libxmpp_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - win32/posix.uname.c \ - win32/utsname.h - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -JABBERSOURCES = \ - adhoccommands.c \ - adhoccommands.h \ - auth.c \ - auth.h \ - buddy.c \ - buddy.h \ - bosh.c \ - bosh.h \ - caps.c \ - caps.h \ - chat.c \ - chat.h \ - data.c \ - data.h \ - disco.c \ - disco.h \ - google.c \ - google.h \ - ibb.c \ - ibb.h \ - iq.c \ - iq.h \ - jabber.c \ - jabber.h \ - jingle/jingle.c \ - jingle/jingle.h \ - jingle/content.c \ - jingle/content.h \ - jingle/iceudp.c \ - jingle/iceudp.h \ - jingle/rawudp.c \ - jingle/rawudp.h \ - jingle/rtp.c \ - jingle/rtp.h \ - jingle/session.c \ - jingle/session.h \ - jingle/transport.c \ - jingle/transport.h \ - jutil.c \ - jutil.h \ - message.c \ - message.h \ - namespaces.h \ - oob.c \ - oob.h \ - parser.c \ - parser.h \ - pep.c \ - pep.h \ - ping.c \ - ping.h \ - presence.c \ - presence.h \ - roster.c \ - roster.h \ - si.c \ - si.h \ - useravatar.c \ - useravatar.h \ - usermood.c \ - usermood.h \ - usernick.c \ - usernick.h \ - usertune.c \ - usertune.h \ - xdata.c \ - xdata.h - -AM_CFLAGS = $(st) -libxmpp_la_LDFLAGS = -module -avoid-version -@STATIC_JABBER_FALSE@st = -@STATIC_JABBER_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_JABBER_TRUE@noinst_LTLIBRARIES = libjabber.la -@STATIC_JABBER_FALSE@libjabber_la_SOURCES = $(JABBERSOURCES) -@STATIC_JABBER_TRUE@libjabber_la_SOURCES = $(JABBERSOURCES) libxmpp.c -@STATIC_JABBER_TRUE@libjabber_la_CFLAGS = $(AM_CFLAGS) -@STATIC_JABBER_FALSE@pkg_LTLIBRARIES = libjabber.la libxmpp.la -@STATIC_JABBER_FALSE@libjabber_la_LIBADD = $(GLIB_LIBS) $(SASL_LIBS) $(LIBXML_LIBS) $(IDN_LIBS) -@STATIC_JABBER_FALSE@libxmpp_la_SOURCES = libxmpp.c -@STATIC_JABBER_FALSE@libxmpp_la_LIBADD = libjabber.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(IDN_CFLAGS) \ - $(LIBXML_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/jabber/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/jabber/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libjabber.la: $(libjabber_la_OBJECTS) $(libjabber_la_DEPENDENCIES) - $(LINK) $(am_libjabber_la_rpath) $(libjabber_la_LDFLAGS) $(libjabber_la_OBJECTS) $(libjabber_la_LIBADD) $(LIBS) -libxmpp.la: $(libxmpp_la_OBJECTS) $(libxmpp_la_DEPENDENCIES) - $(LINK) $(am_libxmpp_la_rpath) $(libxmpp_la_LDFLAGS) $(libxmpp_la_OBJECTS) $(libxmpp_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-adhoccommands.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-auth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-bosh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-caps.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-content.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-data.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-disco.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-google.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-ibb.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-iceudp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-iq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-jabber.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-jingle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-jutil.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-libxmpp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-message.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-oob.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-parser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-pep.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-ping.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-presence.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-rawudp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-roster.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-rtp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-transport.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-useravatar.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-usermood.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-usernick.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-usertune.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-xdata.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxmpp.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libjabber_la-adhoccommands.lo: adhoccommands.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-adhoccommands.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-adhoccommands.Tpo" -c -o libjabber_la-adhoccommands.lo `test -f 'adhoccommands.c' || echo '$(srcdir)/'`adhoccommands.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-adhoccommands.Tpo" "$(DEPDIR)/libjabber_la-adhoccommands.Plo"; else rm -f "$(DEPDIR)/libjabber_la-adhoccommands.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='adhoccommands.c' object='libjabber_la-adhoccommands.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-adhoccommands.lo `test -f 'adhoccommands.c' || echo '$(srcdir)/'`adhoccommands.c - -libjabber_la-auth.lo: auth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-auth.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-auth.Tpo" -c -o libjabber_la-auth.lo `test -f 'auth.c' || echo '$(srcdir)/'`auth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-auth.Tpo" "$(DEPDIR)/libjabber_la-auth.Plo"; else rm -f "$(DEPDIR)/libjabber_la-auth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='auth.c' object='libjabber_la-auth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-auth.lo `test -f 'auth.c' || echo '$(srcdir)/'`auth.c - -libjabber_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-buddy.Tpo" -c -o libjabber_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-buddy.Tpo" "$(DEPDIR)/libjabber_la-buddy.Plo"; else rm -f "$(DEPDIR)/libjabber_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libjabber_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libjabber_la-bosh.lo: bosh.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-bosh.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-bosh.Tpo" -c -o libjabber_la-bosh.lo `test -f 'bosh.c' || echo '$(srcdir)/'`bosh.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-bosh.Tpo" "$(DEPDIR)/libjabber_la-bosh.Plo"; else rm -f "$(DEPDIR)/libjabber_la-bosh.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bosh.c' object='libjabber_la-bosh.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-bosh.lo `test -f 'bosh.c' || echo '$(srcdir)/'`bosh.c - -libjabber_la-caps.lo: caps.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-caps.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-caps.Tpo" -c -o libjabber_la-caps.lo `test -f 'caps.c' || echo '$(srcdir)/'`caps.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-caps.Tpo" "$(DEPDIR)/libjabber_la-caps.Plo"; else rm -f "$(DEPDIR)/libjabber_la-caps.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='caps.c' object='libjabber_la-caps.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-caps.lo `test -f 'caps.c' || echo '$(srcdir)/'`caps.c - -libjabber_la-chat.lo: chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-chat.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-chat.Tpo" -c -o libjabber_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-chat.Tpo" "$(DEPDIR)/libjabber_la-chat.Plo"; else rm -f "$(DEPDIR)/libjabber_la-chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chat.c' object='libjabber_la-chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c - -libjabber_la-data.lo: data.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-data.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-data.Tpo" -c -o libjabber_la-data.lo `test -f 'data.c' || echo '$(srcdir)/'`data.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-data.Tpo" "$(DEPDIR)/libjabber_la-data.Plo"; else rm -f "$(DEPDIR)/libjabber_la-data.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='data.c' object='libjabber_la-data.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-data.lo `test -f 'data.c' || echo '$(srcdir)/'`data.c - -libjabber_la-disco.lo: disco.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-disco.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-disco.Tpo" -c -o libjabber_la-disco.lo `test -f 'disco.c' || echo '$(srcdir)/'`disco.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-disco.Tpo" "$(DEPDIR)/libjabber_la-disco.Plo"; else rm -f "$(DEPDIR)/libjabber_la-disco.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disco.c' object='libjabber_la-disco.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-disco.lo `test -f 'disco.c' || echo '$(srcdir)/'`disco.c - -libjabber_la-google.lo: google.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-google.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-google.Tpo" -c -o libjabber_la-google.lo `test -f 'google.c' || echo '$(srcdir)/'`google.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-google.Tpo" "$(DEPDIR)/libjabber_la-google.Plo"; else rm -f "$(DEPDIR)/libjabber_la-google.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='google.c' object='libjabber_la-google.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-google.lo `test -f 'google.c' || echo '$(srcdir)/'`google.c - -libjabber_la-ibb.lo: ibb.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-ibb.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-ibb.Tpo" -c -o libjabber_la-ibb.lo `test -f 'ibb.c' || echo '$(srcdir)/'`ibb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-ibb.Tpo" "$(DEPDIR)/libjabber_la-ibb.Plo"; else rm -f "$(DEPDIR)/libjabber_la-ibb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ibb.c' object='libjabber_la-ibb.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-ibb.lo `test -f 'ibb.c' || echo '$(srcdir)/'`ibb.c - -libjabber_la-iq.lo: iq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-iq.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-iq.Tpo" -c -o libjabber_la-iq.lo `test -f 'iq.c' || echo '$(srcdir)/'`iq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-iq.Tpo" "$(DEPDIR)/libjabber_la-iq.Plo"; else rm -f "$(DEPDIR)/libjabber_la-iq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='iq.c' object='libjabber_la-iq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-iq.lo `test -f 'iq.c' || echo '$(srcdir)/'`iq.c - -libjabber_la-jabber.lo: jabber.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-jabber.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-jabber.Tpo" -c -o libjabber_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-jabber.Tpo" "$(DEPDIR)/libjabber_la-jabber.Plo"; else rm -f "$(DEPDIR)/libjabber_la-jabber.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jabber.c' object='libjabber_la-jabber.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c - -libjabber_la-jingle.lo: jingle/jingle.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-jingle.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-jingle.Tpo" -c -o libjabber_la-jingle.lo `test -f 'jingle/jingle.c' || echo '$(srcdir)/'`jingle/jingle.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-jingle.Tpo" "$(DEPDIR)/libjabber_la-jingle.Plo"; else rm -f "$(DEPDIR)/libjabber_la-jingle.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/jingle.c' object='libjabber_la-jingle.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-jingle.lo `test -f 'jingle/jingle.c' || echo '$(srcdir)/'`jingle/jingle.c - -libjabber_la-content.lo: jingle/content.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-content.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-content.Tpo" -c -o libjabber_la-content.lo `test -f 'jingle/content.c' || echo '$(srcdir)/'`jingle/content.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-content.Tpo" "$(DEPDIR)/libjabber_la-content.Plo"; else rm -f "$(DEPDIR)/libjabber_la-content.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/content.c' object='libjabber_la-content.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-content.lo `test -f 'jingle/content.c' || echo '$(srcdir)/'`jingle/content.c - -libjabber_la-iceudp.lo: jingle/iceudp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-iceudp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-iceudp.Tpo" -c -o libjabber_la-iceudp.lo `test -f 'jingle/iceudp.c' || echo '$(srcdir)/'`jingle/iceudp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-iceudp.Tpo" "$(DEPDIR)/libjabber_la-iceudp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-iceudp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/iceudp.c' object='libjabber_la-iceudp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-iceudp.lo `test -f 'jingle/iceudp.c' || echo '$(srcdir)/'`jingle/iceudp.c - -libjabber_la-rawudp.lo: jingle/rawudp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-rawudp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-rawudp.Tpo" -c -o libjabber_la-rawudp.lo `test -f 'jingle/rawudp.c' || echo '$(srcdir)/'`jingle/rawudp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-rawudp.Tpo" "$(DEPDIR)/libjabber_la-rawudp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-rawudp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/rawudp.c' object='libjabber_la-rawudp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-rawudp.lo `test -f 'jingle/rawudp.c' || echo '$(srcdir)/'`jingle/rawudp.c - -libjabber_la-rtp.lo: jingle/rtp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-rtp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-rtp.Tpo" -c -o libjabber_la-rtp.lo `test -f 'jingle/rtp.c' || echo '$(srcdir)/'`jingle/rtp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-rtp.Tpo" "$(DEPDIR)/libjabber_la-rtp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-rtp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/rtp.c' object='libjabber_la-rtp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-rtp.lo `test -f 'jingle/rtp.c' || echo '$(srcdir)/'`jingle/rtp.c - -libjabber_la-session.lo: jingle/session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-session.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-session.Tpo" -c -o libjabber_la-session.lo `test -f 'jingle/session.c' || echo '$(srcdir)/'`jingle/session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-session.Tpo" "$(DEPDIR)/libjabber_la-session.Plo"; else rm -f "$(DEPDIR)/libjabber_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/session.c' object='libjabber_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-session.lo `test -f 'jingle/session.c' || echo '$(srcdir)/'`jingle/session.c - -libjabber_la-transport.lo: jingle/transport.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-transport.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-transport.Tpo" -c -o libjabber_la-transport.lo `test -f 'jingle/transport.c' || echo '$(srcdir)/'`jingle/transport.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-transport.Tpo" "$(DEPDIR)/libjabber_la-transport.Plo"; else rm -f "$(DEPDIR)/libjabber_la-transport.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/transport.c' object='libjabber_la-transport.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-transport.lo `test -f 'jingle/transport.c' || echo '$(srcdir)/'`jingle/transport.c - -libjabber_la-jutil.lo: jutil.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-jutil.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-jutil.Tpo" -c -o libjabber_la-jutil.lo `test -f 'jutil.c' || echo '$(srcdir)/'`jutil.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-jutil.Tpo" "$(DEPDIR)/libjabber_la-jutil.Plo"; else rm -f "$(DEPDIR)/libjabber_la-jutil.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jutil.c' object='libjabber_la-jutil.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-jutil.lo `test -f 'jutil.c' || echo '$(srcdir)/'`jutil.c - -libjabber_la-message.lo: message.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-message.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-message.Tpo" -c -o libjabber_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-message.Tpo" "$(DEPDIR)/libjabber_la-message.Plo"; else rm -f "$(DEPDIR)/libjabber_la-message.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='message.c' object='libjabber_la-message.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c - -libjabber_la-oob.lo: oob.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-oob.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-oob.Tpo" -c -o libjabber_la-oob.lo `test -f 'oob.c' || echo '$(srcdir)/'`oob.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-oob.Tpo" "$(DEPDIR)/libjabber_la-oob.Plo"; else rm -f "$(DEPDIR)/libjabber_la-oob.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oob.c' object='libjabber_la-oob.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-oob.lo `test -f 'oob.c' || echo '$(srcdir)/'`oob.c - -libjabber_la-parser.lo: parser.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-parser.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-parser.Tpo" -c -o libjabber_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-parser.Tpo" "$(DEPDIR)/libjabber_la-parser.Plo"; else rm -f "$(DEPDIR)/libjabber_la-parser.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parser.c' object='libjabber_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c - -libjabber_la-pep.lo: pep.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-pep.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-pep.Tpo" -c -o libjabber_la-pep.lo `test -f 'pep.c' || echo '$(srcdir)/'`pep.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-pep.Tpo" "$(DEPDIR)/libjabber_la-pep.Plo"; else rm -f "$(DEPDIR)/libjabber_la-pep.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pep.c' object='libjabber_la-pep.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-pep.lo `test -f 'pep.c' || echo '$(srcdir)/'`pep.c - -libjabber_la-ping.lo: ping.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-ping.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-ping.Tpo" -c -o libjabber_la-ping.lo `test -f 'ping.c' || echo '$(srcdir)/'`ping.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-ping.Tpo" "$(DEPDIR)/libjabber_la-ping.Plo"; else rm -f "$(DEPDIR)/libjabber_la-ping.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ping.c' object='libjabber_la-ping.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-ping.lo `test -f 'ping.c' || echo '$(srcdir)/'`ping.c - -libjabber_la-presence.lo: presence.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-presence.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-presence.Tpo" -c -o libjabber_la-presence.lo `test -f 'presence.c' || echo '$(srcdir)/'`presence.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-presence.Tpo" "$(DEPDIR)/libjabber_la-presence.Plo"; else rm -f "$(DEPDIR)/libjabber_la-presence.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='presence.c' object='libjabber_la-presence.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-presence.lo `test -f 'presence.c' || echo '$(srcdir)/'`presence.c - -libjabber_la-roster.lo: roster.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-roster.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-roster.Tpo" -c -o libjabber_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-roster.Tpo" "$(DEPDIR)/libjabber_la-roster.Plo"; else rm -f "$(DEPDIR)/libjabber_la-roster.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='roster.c' object='libjabber_la-roster.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c - -libjabber_la-si.lo: si.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-si.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-si.Tpo" -c -o libjabber_la-si.lo `test -f 'si.c' || echo '$(srcdir)/'`si.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-si.Tpo" "$(DEPDIR)/libjabber_la-si.Plo"; else rm -f "$(DEPDIR)/libjabber_la-si.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='si.c' object='libjabber_la-si.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-si.lo `test -f 'si.c' || echo '$(srcdir)/'`si.c - -libjabber_la-useravatar.lo: useravatar.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-useravatar.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-useravatar.Tpo" -c -o libjabber_la-useravatar.lo `test -f 'useravatar.c' || echo '$(srcdir)/'`useravatar.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-useravatar.Tpo" "$(DEPDIR)/libjabber_la-useravatar.Plo"; else rm -f "$(DEPDIR)/libjabber_la-useravatar.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='useravatar.c' object='libjabber_la-useravatar.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-useravatar.lo `test -f 'useravatar.c' || echo '$(srcdir)/'`useravatar.c - -libjabber_la-usermood.lo: usermood.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-usermood.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-usermood.Tpo" -c -o libjabber_la-usermood.lo `test -f 'usermood.c' || echo '$(srcdir)/'`usermood.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-usermood.Tpo" "$(DEPDIR)/libjabber_la-usermood.Plo"; else rm -f "$(DEPDIR)/libjabber_la-usermood.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usermood.c' object='libjabber_la-usermood.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-usermood.lo `test -f 'usermood.c' || echo '$(srcdir)/'`usermood.c - -libjabber_la-usernick.lo: usernick.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-usernick.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-usernick.Tpo" -c -o libjabber_la-usernick.lo `test -f 'usernick.c' || echo '$(srcdir)/'`usernick.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-usernick.Tpo" "$(DEPDIR)/libjabber_la-usernick.Plo"; else rm -f "$(DEPDIR)/libjabber_la-usernick.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usernick.c' object='libjabber_la-usernick.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-usernick.lo `test -f 'usernick.c' || echo '$(srcdir)/'`usernick.c - -libjabber_la-usertune.lo: usertune.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-usertune.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-usertune.Tpo" -c -o libjabber_la-usertune.lo `test -f 'usertune.c' || echo '$(srcdir)/'`usertune.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-usertune.Tpo" "$(DEPDIR)/libjabber_la-usertune.Plo"; else rm -f "$(DEPDIR)/libjabber_la-usertune.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usertune.c' object='libjabber_la-usertune.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-usertune.lo `test -f 'usertune.c' || echo '$(srcdir)/'`usertune.c - -libjabber_la-xdata.lo: xdata.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-xdata.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-xdata.Tpo" -c -o libjabber_la-xdata.lo `test -f 'xdata.c' || echo '$(srcdir)/'`xdata.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-xdata.Tpo" "$(DEPDIR)/libjabber_la-xdata.Plo"; else rm -f "$(DEPDIR)/libjabber_la-xdata.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdata.c' object='libjabber_la-xdata.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-xdata.lo `test -f 'xdata.c' || echo '$(srcdir)/'`xdata.c - -libjabber_la-libxmpp.lo: libxmpp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-libxmpp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-libxmpp.Tpo" -c -o libjabber_la-libxmpp.lo `test -f 'libxmpp.c' || echo '$(srcdir)/'`libxmpp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-libxmpp.Tpo" "$(DEPDIR)/libjabber_la-libxmpp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-libxmpp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libxmpp.c' object='libjabber_la-libxmpp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-libxmpp.lo `test -f 'libxmpp.c' || echo '$(srcdir)/'`libxmpp.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/win32 - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libjabber -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libjabber -XMPP_TARGET = libxmpp -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I./win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(LIBXML2_TOP)/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(LIBXML2_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L. - -## -## SOURCES, OBJECTS -## -C_SRC = \ - adhoccommands.c \ - auth.c \ - buddy.c \ - bosh.c \ - caps.c \ - chat.c \ - data.c \ - disco.c \ - google.c \ - ibb.c \ - iq.c \ - jabber.c \ - jingle/jingle.c \ - jingle/content.c \ - jingle/iceudp.c \ - jingle/rawudp.c \ - jingle/rtp.c \ - jingle/session.c \ - jingle/transport.c \ - jutil.c \ - message.c \ - oob.c \ - parser.c \ - pep.c \ - ping.c \ - presence.c \ - roster.c \ - si.c \ - useravatar.c \ - usermood.c \ - usernick.c \ - usertune.c \ - xdata.c \ - win32/posix.uname.c - -OBJECTS = $(C_SRC:%.c=%.o) - -XMPP_C_SRC = libxmpp.c -XMPP_OBJECTS = $(XMPP_C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgobject-2.0 \ - -lxml2 \ - -lws2_32 \ - -lintl \ - -lpurple - -ifeq ($(CYRUS_SASL), 1) -CYRUS_SASL_TOP := $(WIN32_DEV_TOP)/cyrus-sasl-2.1.22-daa1 -INCLUDE_PATHS += -I$(CYRUS_SASL_TOP)/include -LIB_PATHS += -L$(CYRUS_SASL_TOP)/bin -LIBS += -llibsasl -CYRUS_SASL_DLLS = \ - $(CYRUS_SASL_TOP)/bin/libsasl.dll - -CYRUS_SASL_PLUGINS = \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslANONYMOUS.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslCRAMMD5.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslDIGESTMD5.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslGSSAPI.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslLOGIN.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslPLAIN.dll - -endif - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll $(XMPP_TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(XMPP_TARGET).dll $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) -ifeq ($(CYRUS_SASL), 1) - mkdir -p $(PURPLE_INSTALL_DIR)/sasl2 - cp $(CYRUS_SASL_DLLS) $(PURPLE_INSTALL_DIR) - cp $(CYRUS_SASL_PLUGINS) $(PURPLE_INSTALL_DIR)/sasl2 -endif - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll $(TARGET).dll.a: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -$(XMPP_TARGET).dll: $(TARGET).dll.a $(XMPP_OBJECTS) - $(CC) -shared $(XMPP_OBJECTS) $(LIB_PATHS) $(LIBS) -ljabber $(DLL_LD_FLAGS) -o $(XMPP_TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a - rm -f $(XMPP_OBJECTS) $(XMPP_TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1310 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "debug.h" -#include "notify.h" -#include "server.h" -#include "util.h" -#include "adhoccommands.h" -#include "buddy.h" -#include "chat.h" -#include "data.h" -#include "google.h" -#include "message.h" -#include "xmlnode.h" -#include "pep.h" -#include "smiley.h" -#include "iq.h" - -#include <string.h> - -void jabber_message_free(JabberMessage *jm) -{ - g_free(jm->from); - g_free(jm->to); - g_free(jm->id); - g_free(jm->subject); - g_free(jm->body); - g_free(jm->xhtml); - g_free(jm->password); - g_free(jm->error); - g_free(jm->thread_id); - g_list_free(jm->etc); - g_list_free(jm->eventitems); - - g_free(jm); -} - -static void handle_chat(JabberMessage *jm) -{ - JabberID *jid = jabber_id_new(jm->from); - char *from; - - JabberBuddy *jb; - JabberBuddyResource *jbr; - - if(!jid) - return; - - jb = jabber_buddy_find(jm->js, jm->from, TRUE); - jbr = jabber_buddy_find_resource(jb, jid->resource); - - if(jabber_find_unnormalized_conv(jm->from, jm->js->gc->account)) { - from = g_strdup(jm->from); - } else if(jid->node) { - if(jid->resource) { - PurpleConversation *conv; - - from = g_strdup_printf("%s@%s", jid->node, jid->domain); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, jm->js->gc->account); - if(conv) { - purple_conversation_set_name(conv, jm->from); - } - g_free(from); - } - from = g_strdup(jm->from); - } else { - from = g_strdup(jid->domain); - } - - if(!jm->xhtml && !jm->body) { - if (jbr) { - if (jm->chat_state != JM_STATE_NONE) - jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; - else - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; - } - - if(JM_STATE_COMPOSING == jm->chat_state) { - serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPING); - } else if(JM_STATE_PAUSED == jm->chat_state) { - serv_got_typing(jm->js->gc, from, 0, PURPLE_TYPED); - } else if(JM_STATE_GONE == jm->chat_state) { - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - from, jm->js->gc->account); - if (conv && jid->node && jid->domain) { - char buf[256]; - PurpleBuddy *buddy; - - g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain); - - if ((buddy = purple_find_buddy(jm->js->gc->account, buf))) { - const char *who; - char *escaped; - - who = purple_buddy_get_alias(buddy); - escaped = g_markup_escape_text(who, -1); - - g_snprintf(buf, sizeof(buf), - _("%s has left the conversation."), escaped); - g_free(escaped); - - /* At some point when we restructure PurpleConversation, - * this should be able to be implemented by removing the - * user from the conversation like we do with chats now. */ - purple_conversation_write(conv, "", buf, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - } - serv_got_typing_stopped(jm->js->gc, from); - - } else { - serv_got_typing_stopped(jm->js->gc, from); - } - } else { - if(jbr) { - if (jm->chat_state != JM_STATE_NONE) - jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; - else - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; - - if(jbr->thread_id) - g_free(jbr->thread_id); - jbr->thread_id = g_strdup(jbr->thread_id); - } - - if (jm->js->googletalk && jm->xhtml == NULL) { - char *tmp = jm->body; - jm->body = jabber_google_format_to_html(jm->body); - g_free(tmp); - } - serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0, - jm->sent); - } - - - g_free(from); - jabber_id_free(jid); -} - -static void handle_headline(JabberMessage *jm) -{ - char *title; - GString *body; - GList *etc; - - if(!jm->xhtml && !jm->body) - return; /* ignore headlines without any content */ - - body = g_string_new(""); - title = g_strdup_printf(_("Message from %s"), jm->from); - - if(jm->xhtml) - g_string_append(body, jm->xhtml); - else if(jm->body) - g_string_append(body, jm->body); - - for(etc = jm->etc; etc; etc = etc->next) { - xmlnode *x = etc->data; - const char *xmlns = xmlnode_get_namespace(x); - if(xmlns && !strcmp(xmlns, NS_OOB_X_DATA)) { - xmlnode *url, *desc; - char *urltxt, *desctxt; - - url = xmlnode_get_child(x, "url"); - desc = xmlnode_get_child(x, "desc"); - - if(!url || !desc) - continue; - - urltxt = xmlnode_get_data(url); - desctxt = xmlnode_get_data(desc); - - /* I'm all about ugly hacks */ - if(body->len && jm->body && !strcmp(body->str, jm->body)) - g_string_printf(body, "<a href='%s'>%s</a>", - urltxt, desctxt); - else - g_string_append_printf(body, "<br/><a href='%s'>%s</a>", - urltxt, desctxt); - - g_free(urltxt); - g_free(desctxt); - } - } - - purple_notify_formatted(jm->js->gc, title, jm->subject ? jm->subject : title, - NULL, body->str, NULL, NULL); - - g_free(title); - g_string_free(body, TRUE); -} - -static void handle_groupchat(JabberMessage *jm) -{ - JabberID *jid = jabber_id_new(jm->from); - JabberChat *chat; - - if(!jid) - return; - - chat = jabber_chat_find(jm->js, jid->node, jid->domain); - - if(!chat) - return; - - if(jm->subject) { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(chat->conv), jid->resource, - jm->subject); - if(!jm->xhtml && !jm->body) { - char *msg, *tmp, *tmp2; - tmp = g_markup_escape_text(jm->subject, -1); - tmp2 = purple_markup_linkify(tmp); - if(jid->resource) - msg = g_strdup_printf(_("%s has set the topic to: %s"), jid->resource, tmp2); - else - msg = g_strdup_printf(_("The topic is: %s"), tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", msg, PURPLE_MESSAGE_SYSTEM, jm->sent); - g_free(tmp); - g_free(tmp2); - g_free(msg); - } - } - - if(jm->xhtml || jm->body) { - if(jid->resource) - serv_got_chat_in(jm->js->gc, chat->id, jid->resource, - jm->delayed ? PURPLE_MESSAGE_DELAYED : 0, - jm->xhtml ? jm->xhtml : jm->body, jm->sent); - else if(chat->muc) - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", - jm->xhtml ? jm->xhtml : jm->body, - PURPLE_MESSAGE_SYSTEM, jm->sent); - } - - jabber_id_free(jid); -} - -static void handle_groupchat_invite(JabberMessage *jm) -{ - GHashTable *components; - JabberID *jid = jabber_id_new(jm->to); - - if(!jid) - return; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - g_hash_table_replace(components, "room", g_strdup(jid->node)); - g_hash_table_replace(components, "server", g_strdup(jid->domain)); - g_hash_table_replace(components, "handle", g_strdup(jm->js->user->node)); - g_hash_table_replace(components, "password", g_strdup(jm->password)); - - jabber_id_free(jid); - serv_got_chat_invite(jm->js->gc, jm->to, jm->from, jm->body, components); -} - -static void handle_error(JabberMessage *jm) -{ - char *buf; - - if(!jm->body) - return; - - buf = g_strdup_printf(_("Message delivery to %s failed: %s"), - jm->from, jm->error ? jm->error : ""); - - purple_notify_formatted(jm->js->gc, _("XMPP Message Error"), _("XMPP Message Error"), buf, - jm->xhtml ? jm->xhtml : jm->body, NULL, NULL); - - g_free(buf); -} - -static void handle_buzz(JabberMessage *jm) { - PurpleBuddy *buddy; - PurpleAccount *account; - - /* Delayed buzz MUST NOT be accepted */ - if(jm->delayed) - return; - - /* Reject buzz when it's not enabled */ - if(!jm->js->allowBuzz) - return; - - account = purple_connection_get_account(jm->js->gc); - - if ((buddy = purple_find_buddy(account, jm->from)) == NULL) - return; /* Do not accept buzzes from unknown people */ - - /* xmpp only has 1 attention type, so index is 0 */ - purple_prpl_got_attention(jm->js->gc, jm->from, 0); -} - -/* used internally by the functions below */ -typedef struct { - gchar *cid; - gchar *alt; -} JabberSmileyRef; - - -static void -jabber_message_get_refs_from_xmlnode_internal(const xmlnode *message, - GHashTable *table) -{ - xmlnode *child; - - for (child = xmlnode_get_child(message, "img") ; child ; - child = xmlnode_get_next_twin(child)) { - const gchar *src = xmlnode_get_attrib(child, "src"); - - if (g_str_has_prefix(src, "cid:")) { - const gchar *cid = src + 4; - - /* if we haven't "fetched" this yet... */ - if (!g_hash_table_lookup(table, cid)) { - /* take a copy of the cid and let the SmileyRef own it... */ - gchar *temp_cid = g_strdup(cid); - JabberSmileyRef *ref = g_new0(JabberSmileyRef, 1); - const gchar *alt = xmlnode_get_attrib(child, "alt"); - ref->cid = temp_cid; - /* if there is no "alt" string, use the cid... - include the entire src, eg. "cid:.." to avoid linkification */ - if (alt && alt[0] != '\0') { - /* workaround for when "alt" is set to the value of the - CID (which Jabbim seems to do), to avoid it showing up - as an mailto: link */ - if (purple_email_is_valid(alt)) { - ref->alt = g_strdup_printf("smiley:%s", alt); - } else { - ref->alt = g_strdup(alt); - } - } else { - ref->alt = g_strdup(src); - } - g_hash_table_insert(table, temp_cid, ref); - } - } - } - - for (child = message->child ; child ; child = child->next) { - jabber_message_get_refs_from_xmlnode_internal(child, table); - } -} - -static gboolean -jabber_message_get_refs_steal(gpointer key, gpointer value, gpointer user_data) -{ - GList **refs = (GList **) user_data; - JabberSmileyRef *ref = (JabberSmileyRef *) value; - - *refs = g_list_append(*refs, ref); - - return TRUE; -} - -static GList * -jabber_message_get_refs_from_xmlnode(const xmlnode *message) -{ - GList *refs = NULL; - GHashTable *unique_refs = g_hash_table_new(g_str_hash, g_str_equal); - - jabber_message_get_refs_from_xmlnode_internal(message, unique_refs); - (void) g_hash_table_foreach_steal(unique_refs, - jabber_message_get_refs_steal, (gpointer) &refs); - g_hash_table_destroy(unique_refs); - return refs; -} - -static gchar * -jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) -{ - gchar *markup = xmlnode_to_str(xhtml, NULL); - int len = strlen(markup); - int pos = 0; - GString *out = g_string_new(NULL); - - while (pos < len) { - /* this is a bit cludgy, maybe there is a better way to do this... - we need to find all <img> tags within the XHTML and replace those - tags with the value of their "alt" attributes */ - if (g_str_has_prefix(&(markup[pos]), "<img")) { - xmlnode *img = NULL; - int pos2 = pos; - const gchar *src; - - for (; pos2 < len ; pos2++) { - if (g_str_has_prefix(&(markup[pos2]), "/>")) { - pos2 += 2; - break; - } else if (g_str_has_prefix(&(markup[pos2]), "</img>")) { - pos2 += 5; - break; - } - } - - /* note, if the above loop didn't find the end of the <img> tag, - it the parsed string will be until the end of the input string, - in which case xmlnode_from_str will bail out and return NULL, - in this case the "if" statement below doesn't trigger and the - text is copied unchanged */ - img = xmlnode_from_str(&(markup[pos]), pos2 - pos); - src = xmlnode_get_attrib(img, "src"); - - if (g_str_has_prefix(src, "cid:")) { - const gchar *alt = xmlnode_get_attrib(img, "alt"); - /* if the "alt" attribute is empty, put the cid as smiley string */ - if (alt && alt[0] != '\0') { - /* if the "alt" is the same as the CID, as Jabbim does, - this prevents linkification... */ - if (purple_email_is_valid(alt)) { - gchar *safe_alt = g_strdup_printf("smiley:%s", alt); - out = g_string_append(out, safe_alt); - g_free(safe_alt); - } else { - out = g_string_append(out, alt); - } - } else { - out = g_string_append(out, src); - } - pos += pos2 - pos; - } else { - out = g_string_append_c(out, markup[pos]); - pos++; - } - - xmlnode_free(img); - - } else { - out = g_string_append_c(out, markup[pos]); - pos++; - } - } - - g_free(markup); - return g_string_free(out, FALSE); -} - -static void -jabber_message_add_remote_smileys(const xmlnode *message) -{ - xmlnode *data_tag; - for (data_tag = xmlnode_get_child_with_namespace(message, "data", NS_BOB) ; - data_tag ; - data_tag = xmlnode_get_next_twin(data_tag)) { - const gchar *cid = xmlnode_get_attrib(data_tag, "cid"); - const JabberData *data = jabber_data_find_remote_by_cid(cid); - - if (!data && cid != NULL) { - /* we haven't cached this already, let's add it */ - JabberData *new_data = jabber_data_create_from_xml(data_tag); - jabber_data_associate_remote(new_data); - } - } -} - -/* used in the function below to supply a conversation and shortcut for a - smiley */ -typedef struct { - PurpleConversation *conv; - gchar *alt; -} JabberDataRef; - -static void -jabber_message_get_data_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberDataRef *ref = (JabberDataRef *) data; - PurpleConversation *conv = ref->conv; - const gchar *alt = ref->alt; - xmlnode *data_element = xmlnode_get_child(packet, "data"); - xmlnode *item_not_found = xmlnode_get_child(packet, "item-not-found"); - - /* did we get a data element as result? */ - if (data_element && type == JABBER_IQ_RESULT) { - JabberData *data = jabber_data_create_from_xml(data_element); - - if (data) { - jabber_data_associate_remote(data); - purple_conv_custom_smiley_write(conv, alt, - jabber_data_get_data(data), - jabber_data_get_size(data)); - purple_conv_custom_smiley_close(conv, alt); - } - - } else if (item_not_found) { - purple_debug_info("jabber", - "Responder didn't recognize requested data\n"); - } else { - purple_debug_error("jabber", "Unknown response to data request\n"); - } - g_free(ref->alt); - g_free(ref); -} - -static void -jabber_message_send_data_request(JabberStream *js, PurpleConversation *conv, - const gchar *cid, const gchar *who, - const gchar *alt) -{ - JabberIq *request = jabber_iq_new(js, JABBER_IQ_GET); - JabberDataRef *ref = g_new0(JabberDataRef, 1); - xmlnode *data_request = jabber_data_get_xml_request(cid); - - xmlnode_set_attrib(request->node, "to", who); - ref->conv = conv; - ref->alt = g_strdup(alt); - jabber_iq_set_callback(request, jabber_message_get_data_cb, ref); - xmlnode_insert_child(request->node, data_request); - - jabber_iq_send(request); -} - - -void jabber_message_parse(JabberStream *js, xmlnode *packet) -{ - JabberMessage *jm; - const char *id, *from, *to, *type; - xmlnode *child; - gboolean signal_return; - - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - to = xmlnode_get_attrib(packet, "to"); - type = xmlnode_get_attrib(packet, "type"); - - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), - "jabber-receiving-message", js->gc, type, id, from, to, packet)); - if (signal_return) - return; - - jm = g_new0(JabberMessage, 1); - jm->js = js; - jm->sent = time(NULL); - jm->delayed = FALSE; - jm->chat_state = JM_STATE_NONE; - - if(type) { - if(!strcmp(type, "normal")) - jm->type = JABBER_MESSAGE_NORMAL; - else if(!strcmp(type, "chat")) - jm->type = JABBER_MESSAGE_CHAT; - else if(!strcmp(type, "groupchat")) - jm->type = JABBER_MESSAGE_GROUPCHAT; - else if(!strcmp(type, "headline")) - jm->type = JABBER_MESSAGE_HEADLINE; - else if(!strcmp(type, "error")) - jm->type = JABBER_MESSAGE_ERROR; - else - jm->type = JABBER_MESSAGE_OTHER; - } else { - jm->type = JABBER_MESSAGE_NORMAL; - } - - jm->from = g_strdup(from); - jm->to = g_strdup(to); - jm->id = g_strdup(id); - - for(child = packet->child; child; child = child->next) { - const char *xmlns = xmlnode_get_namespace(child); - if(child->type != XMLNODE_TYPE_TAG) - continue; - - if(!strcmp(child->name, "error")) { - const char *code = xmlnode_get_attrib(child, "code"); - char *code_txt = NULL; - char *text = xmlnode_get_data(child); - if (!text) { - xmlnode *enclosed_text_node; - - if ((enclosed_text_node = xmlnode_get_child(child, "text"))) - text = xmlnode_get_data(enclosed_text_node); - } - - if(code) - code_txt = g_strdup_printf(_("(Code %s)"), code); - - if(!jm->error) - jm->error = g_strdup_printf("%s%s%s", - text ? text : "", - text && code_txt ? " " : "", - code_txt ? code_txt : ""); - - g_free(code_txt); - g_free(text); - } else if (xmlns == NULL) { - /* QuLogic: Not certain this is correct, but it would have happened - with the previous code. */ - if(!strcmp(child->name, "x")) - jm->etc = g_list_append(jm->etc, child); - /* The following tests expect xmlns != NULL */ - continue; - } else if(!strcmp(child->name, "subject") && !strcmp(xmlns, NS_XMPP_CLIENT)) { - if(!jm->subject) { - jm->subject = xmlnode_get_data(child); - if(!jm->subject) - jm->subject = g_strdup(""); - } - } else if(!strcmp(child->name, "thread") && !strcmp(xmlns, NS_XMPP_CLIENT)) { - if(!jm->thread_id) - jm->thread_id = xmlnode_get_data(child); - } else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) { - if(!jm->body) { - char *msg = xmlnode_to_str(child, NULL); - jm->body = purple_strdup_withhtml(msg); - g_free(msg); - } - } else if(!strcmp(child->name, "html") && !strcmp(xmlns, NS_XHTML_IM)) { - if(!jm->xhtml && xmlnode_get_child(child, "body")) { - char *c; - - const PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = NULL; - GList *smiley_refs = NULL; - gchar *reformatted_xhtml; - - if (purple_account_get_bool(account, "custom_smileys", TRUE)) { - /* find a list of smileys ("cid" and "alt" text pairs) - occuring in the message */ - smiley_refs = jabber_message_get_refs_from_xmlnode(child); - purple_debug_info("jabber", "found %d smileys\n", - g_list_length(smiley_refs)); - - if (smiley_refs) { - if (jm->type == JABBER_MESSAGE_GROUPCHAT) { - JabberID *jid = jabber_id_new(jm->from); - JabberChat *chat = NULL; - - if (jid) { - chat = jabber_chat_find(js, jid->node, jid->domain); - if (chat) - conv = chat->conv; - jabber_id_free(jid); - } - } else if (jm->type == JABBER_MESSAGE_NORMAL || - jm->type == JABBER_MESSAGE_CHAT) { - conv = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - from, account); - if (!conv) { - /* we need to create the conversation here */ - conv = - purple_conversation_new(PURPLE_CONV_TYPE_IM, - account, from); - } - } - } - - /* process any newly provided smileys */ - jabber_message_add_remote_smileys(packet); - } - - /* reformat xhtml so that img tags with a "cid:" src gets - translated to the bare text of the emoticon (the "alt" attrib) */ - /* this is done also when custom smiley retrieval is turned off, - this way the receiver always sees the shortcut instead */ - reformatted_xhtml = - jabber_message_xml_to_string_strip_img_smileys(child); - - jm->xhtml = reformatted_xhtml; - - /* add known custom emoticons to the conversation */ - /* note: if there were no smileys in the incoming message, or - if receiving custom smileys is turned off, smiley_refs will - be NULL */ - for (; conv && smiley_refs ; smiley_refs = g_list_delete_link(smiley_refs, smiley_refs)) { - JabberSmileyRef *ref = (JabberSmileyRef *) smiley_refs->data; - const gchar *cid = ref->cid; - const gchar *alt = ref->alt; - - purple_debug_info("jabber", - "about to add custom smiley %s to the conv\n", alt); - if (purple_conv_custom_smiley_add(conv, alt, "cid", cid, - TRUE)) { - const JabberData *data = - jabber_data_find_remote_by_cid(cid); - /* if data is already known, we write it immediatly */ - if (data) { - purple_debug_info("jabber", - "data is already known\n"); - purple_conv_custom_smiley_write(conv, alt, - jabber_data_get_data(data), - jabber_data_get_size(data)); - purple_conv_custom_smiley_close(conv, alt); - } else { - /* we need to request the smiley (data) */ - purple_debug_info("jabber", - "data is unknown, need to request it\n"); - jabber_message_send_data_request(js, conv, cid, from, - alt); - } - } - g_free(ref->cid); - g_free(ref->alt); - g_free(ref); - } - - /* Convert all newlines to whitespace. Technically, even regular, non-XML HTML is supposed to ignore newlines, but Pidgin has, as convention - * treated \n as a newline for compatibility with other protocols - */ - for (c = jm->xhtml; *c != '\0'; c++) { - if (*c == '\n') - *c = ' '; - } - } - } else if(!strcmp(child->name, "active") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_ACTIVE; - } else if(!strcmp(child->name, "composing") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_COMPOSING; - } else if(!strcmp(child->name, "paused") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_PAUSED; - } else if(!strcmp(child->name, "inactive") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_INACTIVE; - } else if(!strcmp(child->name, "gone") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_GONE; - } else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) { - xmlnode *items; - jm->type = JABBER_MESSAGE_EVENT; - for(items = xmlnode_get_child(child,"items"); items; items = items->next) - jm->eventitems = g_list_append(jm->eventitems, items); - } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, NS_ATTENTION)) { - jm->hasBuzz = TRUE; - } else if(!strcmp(child->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) { - const char *timestamp = xmlnode_get_attrib(child, "stamp"); - jm->delayed = TRUE; - if(timestamp) - jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); - } else if(!strcmp(child->name, "x")) { - if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) { - const char *timestamp = xmlnode_get_attrib(child, "stamp"); - jm->delayed = TRUE; - if(timestamp) - jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); - } else if(!strcmp(xmlns, "jabber:x:conference") && - jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE && - jm->type != JABBER_MESSAGE_ERROR) { - const char *jid = xmlnode_get_attrib(child, "jid"); - if(jid) { - const char *reason = xmlnode_get_attrib(child, "reason"); - const char *password = xmlnode_get_attrib(child, "password"); - - jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; - g_free(jm->to); - jm->to = g_strdup(jid); - - if (reason) { - g_free(jm->body); - jm->body = g_strdup(reason); - } - - if (password) { - g_free(jm->password); - jm->password = g_strdup(password); - } - } - } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user") && - jm->type != JABBER_MESSAGE_ERROR) { - xmlnode *invite = xmlnode_get_child(child, "invite"); - if(invite) { - xmlnode *reason, *password; - const char *jid = xmlnode_get_attrib(invite, "from"); - g_free(jm->to); - jm->to = jm->from; - jm->from = g_strdup(jid); - if((reason = xmlnode_get_child(invite, "reason"))) { - g_free(jm->body); - jm->body = xmlnode_get_data(reason); - } - if((password = xmlnode_get_child(child, "password"))) { - g_free(jm->password); - jm->password = xmlnode_get_data(password); - } - - jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; - } - } else { - jm->etc = g_list_append(jm->etc, child); - } - } else if (g_str_equal(child->name, "query")) { - const char *node = xmlnode_get_attrib(child, "node"); - if (purple_strequal(xmlns, NS_DISCO_ITEMS) - && purple_strequal(node, "http://jabber.org/protocol/commands")) { - jabber_adhoc_got_list(js, jm->from, child); - } - } - } - - if(jm->hasBuzz) - handle_buzz(jm); - - switch(jm->type) { - case JABBER_MESSAGE_OTHER: - purple_debug_info("jabber", - "Received message of unknown type: %s\n", type); - /* Fall-through is intentional */ - case JABBER_MESSAGE_NORMAL: - case JABBER_MESSAGE_CHAT: - handle_chat(jm); - break; - case JABBER_MESSAGE_HEADLINE: - handle_headline(jm); - break; - case JABBER_MESSAGE_GROUPCHAT: - handle_groupchat(jm); - break; - case JABBER_MESSAGE_GROUPCHAT_INVITE: - handle_groupchat_invite(jm); - break; - case JABBER_MESSAGE_EVENT: - jabber_handle_event(jm); - break; - case JABBER_MESSAGE_ERROR: - handle_error(jm); - break; - } - jabber_message_free(jm); -} - -static const gchar * -jabber_message_get_mimetype_from_ext(const gchar *ext) -{ - if (strcmp(ext, "png") == 0) { - return "image/png"; - } else if (strcmp(ext, "gif") == 0) { - return "image/gif"; - } else if (strcmp(ext, "jpg") == 0) { - return "image/jpeg"; - } else if (strcmp(ext, "tif") == 0) { - return "image/tif"; - } else { - return "image/x-icon"; /* or something... */ - } -} - -static GList * -jabber_message_xhtml_find_smileys(const char *xhtml) -{ - GList *smileys = purple_smileys_get_all(); - GList *found_smileys = NULL; - - for (; smileys ; smileys = g_list_delete_link(smileys, smileys)) { - PurpleSmiley *smiley = (PurpleSmiley *) smileys->data; - const gchar *shortcut = purple_smiley_get_shortcut(smiley); - const gssize len = strlen(shortcut); - - gchar *escaped = g_markup_escape_text(shortcut, len); - const char *pos = strstr(xhtml, escaped); - - if (pos) { - found_smileys = g_list_append(found_smileys, smiley); - } - - g_free(escaped); - } - - return found_smileys; -} - -static gchar * -jabber_message_get_smileyfied_xhtml(const gchar *xhtml, const GList *smileys) -{ - /* create XML element for all smileys (img tags) */ - GString *result = g_string_new(NULL); - int pos = 0; - int length = strlen(xhtml); - - while (pos < length) { - const GList *iterator; - gboolean found_smiley = FALSE; - - for (iterator = smileys ; iterator ; - iterator = g_list_next(iterator)) { - const PurpleSmiley *smiley = (PurpleSmiley *) iterator->data; - const gchar *shortcut = purple_smiley_get_shortcut(smiley); - const gssize len = strlen(shortcut); - gchar *escaped = g_markup_escape_text(shortcut, len); - - if (g_str_has_prefix(&(xhtml[pos]), escaped)) { - /* we found the current smiley at this position */ - const JabberData *data = - jabber_data_find_local_by_alt(shortcut); - xmlnode *img = jabber_data_get_xhtml_im(data, shortcut); - int len; - gchar *img_text = xmlnode_to_str(img, &len); - - found_smiley = TRUE; - result = g_string_append(result, img_text); - g_free(img_text); - pos += strlen(escaped); - g_free(escaped); - xmlnode_free(img); - break; - } else { - /* cleanup from the before the next round... */ - g_free(escaped); - } - } - if (!found_smiley) { - /* there was no smiley here, just copy one byte */ - result = g_string_append_c(result, xhtml[pos]); - pos++; - } - } - - return g_string_free(result, FALSE); -} - -static gboolean -jabber_conv_support_custom_smileys(const PurpleConnection *gc, - PurpleConversation *conv, - const gchar *who) -{ - JabberStream *js = (JabberStream *) gc->proto_data; - JabberBuddy *jb; - JabberChat *chat; - - if (!js) { - purple_debug_error("jabber", - "jabber_conv_support_custom_smileys: could not find stream\n"); - return FALSE; - } - - switch (purple_conversation_get_type(conv)) { - case PURPLE_CONV_TYPE_IM: - jb = jabber_buddy_find(js, who, FALSE); - if (jb) { - return jabber_buddy_has_capability(jb, NS_BOB); - } else { - return FALSE; - } - break; - case PURPLE_CONV_TYPE_CHAT: - chat = jabber_chat_find_by_conv(conv); - if (chat) { - /* do not attempt to send custom smileys in a MUC with more than - 10 people, to avoid getting too many BoB requests */ - return jabber_chat_get_num_participants(chat) <= 10 && - jabber_chat_all_participants_have_capability(chat, - NS_BOB); - } else { - return FALSE; - } - break; - default: - return FALSE; - break; - } -} - -static char * -jabber_message_smileyfy_xhtml(JabberMessage *jm, const char *xhtml) -{ - PurpleAccount *account = purple_connection_get_account(jm->js->gc); - PurpleConversation *conv = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, jm->to, - account); - - if (jabber_conv_support_custom_smileys(jm->js->gc, conv, jm->to)) { - GList *found_smileys = jabber_message_xhtml_find_smileys(xhtml); - - if (found_smileys) { - gchar *smileyfied_xhtml = NULL; - const GList *iterator; - - for (iterator = found_smileys; iterator ; - iterator = g_list_next(iterator)) { - const PurpleSmiley *smiley = - (PurpleSmiley *) iterator->data; - const gchar *shortcut = purple_smiley_get_shortcut(smiley); - const JabberData *data = - jabber_data_find_local_by_alt(shortcut); - - /* the object has not been sent before */ - if (!data) { - PurpleStoredImage *image = - purple_smiley_get_stored_image(smiley); - const gchar *ext = purple_imgstore_get_extension(image); - JabberStream *js = jm->js; - - JabberData *new_data = - jabber_data_create_from_data(purple_imgstore_get_data(image), - purple_imgstore_get_size(image), - jabber_message_get_mimetype_from_ext(ext), js); - purple_debug_info("jabber", - "cache local smiley alt = %s, cid = %s\n", - shortcut, jabber_data_get_cid(new_data)); - jabber_data_associate_local(new_data, shortcut); - } - } - - smileyfied_xhtml = - jabber_message_get_smileyfied_xhtml(xhtml, found_smileys); - g_list_free(found_smileys); - - return smileyfied_xhtml; - } - } - - return NULL; -} - -void jabber_message_send(JabberMessage *jm) -{ - xmlnode *message, *child; - const char *type = NULL; - - message = xmlnode_new("message"); - - switch(jm->type) { - case JABBER_MESSAGE_NORMAL: - type = "normal"; - break; - case JABBER_MESSAGE_CHAT: - case JABBER_MESSAGE_GROUPCHAT_INVITE: - type = "chat"; - break; - case JABBER_MESSAGE_HEADLINE: - type = "headline"; - break; - case JABBER_MESSAGE_GROUPCHAT: - type = "groupchat"; - break; - case JABBER_MESSAGE_ERROR: - type = "error"; - break; - case JABBER_MESSAGE_OTHER: - default: - type = NULL; - break; - } - - if(type) - xmlnode_set_attrib(message, "type", type); - - if (jm->id) - xmlnode_set_attrib(message, "id", jm->id); - - xmlnode_set_attrib(message, "to", jm->to); - - if(jm->thread_id) { - child = xmlnode_new_child(message, "thread"); - xmlnode_insert_data(child, jm->thread_id, -1); - } - - child = NULL; - switch(jm->chat_state) - { - case JM_STATE_ACTIVE: - child = xmlnode_new_child(message, "active"); - break; - case JM_STATE_COMPOSING: - child = xmlnode_new_child(message, "composing"); - break; - case JM_STATE_PAUSED: - child = xmlnode_new_child(message, "paused"); - break; - case JM_STATE_INACTIVE: - child = xmlnode_new_child(message, "inactive"); - break; - case JM_STATE_GONE: - child = xmlnode_new_child(message, "gone"); - break; - case JM_STATE_NONE: - /* yep, nothing */ - break; - } - if(child) - xmlnode_set_namespace(child, "http://jabber.org/protocol/chatstates"); - - if(jm->subject) { - child = xmlnode_new_child(message, "subject"); - xmlnode_insert_data(child, jm->subject, -1); - } - - if(jm->body) { - child = xmlnode_new_child(message, "body"); - xmlnode_insert_data(child, jm->body, -1); - } - - if(jm->xhtml) { - if ((child = xmlnode_from_str(jm->xhtml, -1))) { - xmlnode_insert_child(message, child); - } else { - purple_debug_error("jabber", - "XHTML translation/validation failed, returning: %s\n", - jm->xhtml); - } - } - - jabber_send(jm->js, message); - - xmlnode_free(message); -} - -/* - * Compare the XHTML and plain strings passed in for "equality". Any HTML markup - * other than <br/> (matches a newline) in the XHTML will cause this to return - * FALSE. - */ -static gboolean -jabber_xhtml_plain_equal(const char *xhtml_escaped, - const char *plain) -{ - int i = 0; - int j = 0; - gboolean ret; - char *xhtml = purple_unescape_html(xhtml_escaped); - - while (xhtml[i] && plain[j]) { - if (xhtml[i] == plain[j]) { - i += 1; - j += 1; - continue; - } - - if (plain[j] == '\n' && !strncmp(xhtml+i, "<br/>", 5)) { - i += 5; - j += 1; - continue; - } - - g_free(xhtml); - return FALSE; - } - - /* Are we at the end of both strings? */ - ret = (xhtml[i] == plain[j]) && (xhtml[i] == '\0'); - g_free(xhtml); - return ret; -} - -int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags) -{ - JabberMessage *jm; - JabberBuddy *jb; - JabberBuddyResource *jbr; - char *xhtml; - char *tmp; - char *resource; - - if(!who || !msg) - return 0; - - resource = jabber_get_resource(who); - - jb = jabber_buddy_find(gc->proto_data, who, TRUE); - jbr = jabber_buddy_find_resource(jb, resource); - - g_free(resource); - - jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; - jm->type = JABBER_MESSAGE_CHAT; - jm->chat_state = JM_STATE_ACTIVE; - jm->to = g_strdup(who); - jm->id = jabber_get_next_id(jm->js); - - if(jbr) { - if(jbr->thread_id) - jm->thread_id = jbr->thread_id; - - if (jbr->chat_states == JABBER_CHAT_STATES_UNSUPPORTED) - jm->chat_state = JM_STATE_NONE; - else { - /* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states) - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */ - } - } - - tmp = purple_utf8_strip_unprintables(msg); - purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body); - g_free(tmp); - tmp = jabber_message_smileyfy_xhtml(jm, xhtml); - if (tmp) { - g_free(xhtml); - xhtml = tmp; - } - - /* - * For backward compatibility with user expectations or for those not on - * the user's roster, allow sending XHTML-IM markup. - */ - if (!jbr || !jbr->caps.info || - jabber_resource_has_capability(jbr, NS_XHTML_IM)) { - if (!jabber_xhtml_plain_equal(xhtml, jm->body)) - jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml); - } - - g_free(xhtml); - - jabber_message_send(jm); - jabber_message_free(jm); - return 1; -} - -int jabber_message_send_chat(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags) -{ - JabberChat *chat; - JabberMessage *jm; - JabberStream *js; - char *xhtml; - char *tmp; - - if(!msg || !gc) - return 0; - - js = gc->proto_data; - chat = jabber_chat_find_by_id(js, id); - - if(!chat) - return 0; - - jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; - jm->type = JABBER_MESSAGE_GROUPCHAT; - jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); - jm->id = jabber_get_next_id(jm->js); - - tmp = purple_utf8_strip_unprintables(msg); - purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body); - g_free(tmp); - tmp = jabber_message_smileyfy_xhtml(jm, xhtml); - if (tmp) { - g_free(xhtml); - xhtml = tmp; - } - - if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body)) - jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'>%s</body></html>", xhtml); - - g_free(xhtml); - - jabber_message_send(jm); - jabber_message_free(jm); - - return 1; -} - -unsigned int jabber_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - JabberMessage *jm; - JabberBuddy *jb; - JabberBuddyResource *jbr; - char *resource = jabber_get_resource(who); - - jb = jabber_buddy_find(gc->proto_data, who, TRUE); - jbr = jabber_buddy_find_resource(jb, resource); - - g_free(resource); - - if (!jbr || (jbr->chat_states == JABBER_CHAT_STATES_UNSUPPORTED)) - return 0; - - /* TODO: figure out threading */ - jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; - jm->type = JABBER_MESSAGE_CHAT; - jm->to = g_strdup(who); - jm->id = jabber_get_next_id(jm->js); - - if(PURPLE_TYPING == state) - jm->chat_state = JM_STATE_COMPOSING; - else if(PURPLE_TYPED == state) - jm->chat_state = JM_STATE_PAUSED; - else - jm->chat_state = JM_STATE_ACTIVE; - - /* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states) - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */ - - jabber_message_send(jm); - jabber_message_free(jm); - - return 0; -} - -gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace) { - return js->allowBuzz; -} - -gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *namespace) -{ - const PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - return purple_account_get_bool(account, "custom_smileys", TRUE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/message.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/** - * @file message.h Message handlers - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_MESSAGE_H_ -#define PURPLE_JABBER_MESSAGE_H_ - -#include "buddy.h" -#include "jabber.h" -#include "xmlnode.h" - -typedef struct _JabberMessage { - JabberStream *js; - enum { - JABBER_MESSAGE_NORMAL, - JABBER_MESSAGE_CHAT, - JABBER_MESSAGE_GROUPCHAT, - JABBER_MESSAGE_HEADLINE, - JABBER_MESSAGE_ERROR, - JABBER_MESSAGE_GROUPCHAT_INVITE, - JABBER_MESSAGE_EVENT, - JABBER_MESSAGE_OTHER - } type; - time_t sent; - gboolean delayed; - gboolean hasBuzz; - char *id; - char *from; - char *to; - char *subject; - char *body; - char *xhtml; - char *password; - char *error; - char *thread_id; - enum { - JM_STATE_NONE, - JM_STATE_ACTIVE, - JM_STATE_COMPOSING, - JM_STATE_PAUSED, - JM_STATE_INACTIVE, - JM_STATE_GONE - } chat_state; - GList *etc; - GList *eventitems; -} JabberMessage; - -void jabber_message_free(JabberMessage *jm); - -void jabber_message_send(JabberMessage *jm); - -void jabber_message_parse(JabberStream *js, xmlnode *packet); -int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags); -int jabber_message_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); - -unsigned int jabber_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state); - -gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace); - -gboolean jabber_custom_smileys_isenabled(JabberStream *js, const const gchar *namespace); - -#endif /* PURPLE_JABBER_MESSAGE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/namespaces.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/namespaces.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/namespaces.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/namespaces.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_NAMESPACES_H_ -#define PURPLE_JABBER_NAMESPACES_H_ - -#define NS_XMPP_BIND "urn:ietf:params:xml:ns:xmpp-bind" -#define NS_XMPP_CLIENT "jabber:client" -#define NS_XMPP_SASL "urn:ietf:params:xml:ns:xmpp-sasl" -#define NS_XMPP_SESSION "urn:ietf:params:xml:ns:xmpp-session" -#define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas" -#define NS_XMPP_STREAMS "http://etherx.jabber.org/streams" - -/* XEP-0012 Last Activity (and XEP-0256 Last Activity in Presence) */ -#define NS_LAST_ACTIVITY "jabber:iq:last" - -/* XEP-0030 Service Discovery */ -#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info" -#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" - -/* XEP-0047 IBB (In-band bytestreams) */ -#define NS_IBB "http://jabber.org/protocol/ibb" - -/* XEP-0065 SOCKS5 Bytestreams */ -#define NS_BYTESTREAMS "http://jabber.org/protocol/bytestreams" - -/* XEP-0066 Out of Band Data (OOB) */ -#define NS_OOB_IQ_DATA "jabber:iq:oob" -#define NS_OOB_X_DATA "jabber:x:oob" - -/* XEP-0071 XHTML-IM (rich-text messages) */ -#define NS_XHTML_IM "http://jabber.org/protocol/xhtml-im" -#define NS_XHTML "http://www.w3.org/1999/xhtml" - -/* XEP-0084 v0.12 User Avatar */ -#define NS_AVATAR_0_12_DATA "http://www.xmpp.org/extensions/xep-0084.html#ns-data" -#define NS_AVATAR_0_12_METADATA "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata" - -/* XEP-0084 v1.1 User Avatar */ -#define NS_AVATAR_1_1_DATA "urn:xmpp:avatar:data" -#define NS_AVATAR_1_1_METADATA "urn:xmpp:avatar:metadata" - -/* XEP-0124 Bidirectional-streams Over Synchronous HTTP (BOSH) */ -#define NS_BOSH "http://jabber.org/protocol/httpbind" - -/* XEP-0191 Simple Communications Blocking */ -#define NS_SIMPLE_BLOCKING "urn:xmpp:blocking" - -/* XEP-0199 Ping */ -#define NS_PING "urn:xmpp:ping" - -/* XEP-0202 Entity Time */ -#define NS_ENTITY_TIME "urn:xmpp:time" - -/* XEP-0203 Delayed Delivery (and legacy delayed delivery) */ -#define NS_DELAYED_DELIVERY "urn:xmpp:delay" -#define NS_DELAYED_DELIVERY_LEGACY "jabber:x:delay" - -/* XEP-0206 XMPP over BOSH */ -#define NS_XMPP_BOSH "urn:xmpp:xbosh" - -/* XEP-0224 Attention */ -#define NS_ATTENTION "urn:xmpp:attention:0" - -/* XEP-0231 BoB (Bits of Binary) */ -#define NS_BOB "urn:xmpp:bob" - -/* Google extensions */ -#define NS_GOOGLE_CAMERA "http://www.google.com/xmpp/protocol/camera/v1" -#define NS_GOOGLE_VIDEO "http://www.google.com/xmpp/protocol/video/v1" -#define NS_GOOGLE_VOICE "http://www.google.com/xmpp/protocol/voice/v1" -#define NS_GOOGLE_JINGLE_INFO "google:jingleinfo" - -#define NS_GOOGLE_MAIL_NOTIFY "google:mail:notify" - -#define NS_GOOGLE_PROTOCOL_SESSION "http://www.google.com/xmpp/protocol/session" -#define NS_GOOGLE_SESSION "http://www.google.com/session" -#define NS_GOOGLE_SESSION_PHONE "http://www.google.com/session/phone" -#define NS_GOOGLE_SESSION_VIDEO "http://www.google.com/session/video" - -#endif /* PURPLE_JABBER_NAMESPACES_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "ft.h" -#include "util.h" - -#include "jabber.h" -#include "iq.h" -#include "oob.h" - -typedef struct _JabberOOBXfer { - char *address; - int port; - char *page; - - GString *headers; - - char *iq_id; - - JabberStream *js; - - gchar *write_buffer; - gsize written_len; - guint writeh; - -} JabberOOBXfer; - -static void jabber_oob_xfer_init(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - purple_xfer_start(xfer, -1, jox->address, jox->port); -} - -static void jabber_oob_xfer_free(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - jox->js->oob_file_transfers = g_list_remove(jox->js->oob_file_transfers, - xfer); - - g_string_free(jox->headers, TRUE); - g_free(jox->address); - g_free(jox->page); - g_free(jox->iq_id); - g_free(jox->write_buffer); - if(jox->writeh) - purple_input_remove(jox->writeh); - g_free(jox); - - xfer->data = NULL; -} - -static void jabber_oob_xfer_end(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - JabberIq *iq; - - iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jox->iq_id); - - jabber_iq_send(iq); - - jabber_oob_xfer_free(xfer); -} - -static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInputCondition cond) { - PurpleXfer *xfer = data; - JabberOOBXfer *jox = xfer->data; - int len, total_len = strlen(jox->write_buffer); - - len = write(xfer->fd, jox->write_buffer + jox->written_len, - total_len - jox->written_len); - - if(len < 0 && errno == EAGAIN) - return; - else if(len < 0) { - purple_debug_error("jabber", "Write error on oob xfer!\n"); - purple_input_remove(jox->writeh); - purple_xfer_cancel_local(xfer); - } - jox->written_len += len; - - if(jox->written_len == total_len) { - purple_input_remove(jox->writeh); - g_free(jox->write_buffer); - jox->write_buffer = NULL; - } -} - -static void jabber_oob_xfer_start(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - - if(jox->write_buffer == NULL) { - jox->write_buffer = g_strdup_printf( - "GET /%s HTTP/1.1\r\nHost: %s\r\n\r\n", - jox->page, jox->address); - jox->written_len = 0; - } - - jox->writeh = purple_input_add(xfer->fd, PURPLE_INPUT_WRITE, - jabber_oob_xfer_request_send, xfer); - - jabber_oob_xfer_request_send(xfer, xfer->fd, PURPLE_INPUT_WRITE); -} - -static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; - char test[2048]; - char *tmp, *lenstr; - int len; - - if((len = read(xfer->fd, test, sizeof(test))) > 0) { - jox->headers = g_string_append_len(jox->headers, test, len); - if((tmp = strstr(jox->headers->str, "\r\n\r\n"))) { - *tmp = '\0'; - lenstr = strstr(jox->headers->str, "Content-Length: "); - if(lenstr) { - int size; - sscanf(lenstr, "Content-Length: %d", &size); - purple_xfer_set_size(xfer, size); - } - purple_xfer_set_read_fnc(xfer, NULL); - - tmp += 4; - - *buffer = (unsigned char*) g_strdup(tmp); - return strlen(tmp); - } - return 0; - } else if (errno != EAGAIN) { - purple_debug_error("jabber", "Read error on oob xfer!\n"); - purple_xfer_cancel_local(xfer); - } - - return 0; -} - -static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) { - JabberOOBXfer *jox = xfer->data; - JabberIq *iq; - xmlnode *y, *z; - - iq = jabber_iq_new(jox->js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jox->iq_id); - y = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(y, "code", code); - if(!strcmp(code, "406")) { - z = xmlnode_new_child(y, "not-acceptable"); - xmlnode_set_attrib(y, "type", "modify"); - xmlnode_set_namespace(z, NS_XMPP_STANZAS); - } else if(!strcmp(code, "404")) { - z = xmlnode_new_child(y, "not-found"); - xmlnode_set_attrib(y, "type", "cancel"); - xmlnode_set_namespace(z, NS_XMPP_STANZAS); - } - jabber_iq_send(iq); - - jabber_oob_xfer_free(xfer); -} - -static void jabber_oob_xfer_recv_denied(PurpleXfer *xfer) { - jabber_oob_xfer_recv_error(xfer, "406"); -} - -static void jabber_oob_xfer_recv_canceled(PurpleXfer *xfer) { - jabber_oob_xfer_recv_error(xfer, "404"); -} - -void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *querynode) { - JabberOOBXfer *jox; - PurpleXfer *xfer; - char *filename; - char *url; - xmlnode *urlnode; - - if(type != JABBER_IQ_SET) - return; - - if(!from) - return; - - if(!(urlnode = xmlnode_get_child(querynode, "url"))) - return; - - url = xmlnode_get_data(urlnode); - - jox = g_new0(JabberOOBXfer, 1); - if (!purple_url_parse(url, &jox->address, &jox->port, &jox->page, NULL, NULL)) { - g_free(url); - return; - } - g_free(url); - jox->js = js; - jox->headers = g_string_new(""); - jox->iq_id = g_strdup(id); - - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); - if (xfer) - { - xfer->data = jox; - - if(!(filename = g_strdup(g_strrstr(jox->page, "/")))) - filename = g_strdup(jox->page); - - purple_xfer_set_filename(xfer, filename); - - g_free(filename); - - purple_xfer_set_init_fnc(xfer, jabber_oob_xfer_init); - purple_xfer_set_end_fnc(xfer, jabber_oob_xfer_end); - purple_xfer_set_request_denied_fnc(xfer, jabber_oob_xfer_recv_denied); - purple_xfer_set_cancel_recv_fnc(xfer, jabber_oob_xfer_recv_canceled); - purple_xfer_set_read_fnc(xfer, jabber_oob_xfer_read); - purple_xfer_set_start_fnc(xfer, jabber_oob_xfer_start); - - js->oob_file_transfers = g_list_append(js->oob_file_transfers, xfer); - - purple_xfer_request(xfer); - } -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/oob.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/** - * @file oob.h out-of-band transfer functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_OOB_H_ -#define PURPLE_JABBER_OOB_H_ - -#include "jabber.h" - -void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *querynode); - -#endif /* PURPLE_JABBER_OOB_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,276 +0,0 @@ -/* - * purple - Jabber XML parser stuff - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include <libxml/parser.h> - -#include "connection.h" -#include "debug.h" -#include "jabber.h" -#include "parser.h" -#include "util.h" -#include "xmlnode.h" - -static void -jabber_parser_element_start_libxml(void *user_data, - const xmlChar *element_name, const xmlChar *prefix, const xmlChar *namespace, - int nb_namespaces, const xmlChar **namespaces, - int nb_attributes, int nb_defaulted, const xmlChar **attributes) -{ - JabberStream *js = user_data; - xmlnode *node; - int i, j; - - if(!element_name) { - return; - } else if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { - js->protocol_version = JABBER_PROTO_0_9; - for(i=0; i < nb_attributes * 5; i += 5) { - int attrib_len = attributes[i+4] - attributes[i+3]; - char *attrib = g_malloc(attrib_len + 1); - memcpy(attrib, attributes[i+3], attrib_len); - attrib[attrib_len] = '\0'; - - if(!xmlStrcmp(attributes[i], (xmlChar*) "version") - && !strcmp(attrib, "1.0")) { - js->protocol_version = JABBER_PROTO_1_0; - g_free(attrib); - } else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) { - g_free(js->stream_id); - js->stream_id = attrib; - } else { - g_free(attrib); - } - } - } else { - - if(js->current) - node = xmlnode_new_child(js->current, (const char*) element_name); - else - node = xmlnode_new((const char*) element_name); - xmlnode_set_namespace(node, (const char*) namespace); - xmlnode_set_prefix(node, (const char *)prefix); - - if (nb_namespaces != 0) { - node->namespace_map = g_hash_table_new_full( - g_str_hash, g_str_equal, g_free, g_free); - - for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { - const char *key = (const char *)namespaces[j]; - const char *val = (const char *)namespaces[j + 1]; - g_hash_table_insert(node->namespace_map, - g_strdup(key ? key : ""), g_strdup(val ? val : "")); - } - } - for(i=0; i < nb_attributes * 5; i+=5) { - const char *name = (const char *)attributes[i]; - const char *prefix = (const char *)attributes[i+1]; - const char *attrib_ns = (const char *)attributes[i+2]; - char *txt; - int attrib_len = attributes[i+4] - attributes[i+3]; - char *attrib = g_malloc(attrib_len + 1); - - memcpy(attrib, attributes[i+3], attrib_len); - attrib[attrib_len] = '\0'; - - txt = attrib; - attrib = purple_unescape_html(txt); - g_free(txt); - xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); - g_free(attrib); - } - - js->current = node; - } -} - -static void -jabber_parser_element_end_libxml(void *user_data, const xmlChar *element_name, - const xmlChar *prefix, const xmlChar *namespace) -{ - JabberStream *js = user_data; - - if(!js->current) - return; - - if(js->current->parent) { - if(!xmlStrcmp((xmlChar*) js->current->name, element_name)) - js->current = js->current->parent; - } else { - xmlnode *packet = js->current; - js->current = NULL; - jabber_process_packet(js, &packet); - if (packet != NULL) - xmlnode_free(packet); - } -} - -static void -jabber_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) -{ - JabberStream *js = user_data; - - if(!js->current) - return; - - if(!text || !text_len) - return; - - xmlnode_insert_data(js->current, (const char*) text, text_len); -} - -static void -jabber_parser_structured_error_handler(void *user_data, xmlErrorPtr error) -{ - JabberStream *js = user_data; - - if (error->level == XML_ERR_WARNING && error->message != NULL - && g_str_equal(error->message, "xmlns: URI vcard-temp is not absolute\n")) - /* - * This message happens when parsing vcards, and is normal, so don't - * bother logging it because people scare easily. - */ - return; - - if (error->level == XML_ERR_FATAL && error->message != NULL - && g_str_equal(error->message, "Extra content at the end of the document\n")) - /* - * This is probably more annoying than the vcard-temp error; it occurs - * because we disconnect in most cases without waiting for the receiving - * </stream:stream> (limitations of libpurple) - */ - return; - - purple_debug_error("jabber", "XML parser error for JabberStream %p: " - "Domain %i, code %i, level %i: %s", - js, - error->domain, error->code, error->level, - (error->message ? error->message : "(null)\n")); -} - -static xmlSAXHandler jabber_parser_libxml = { - NULL, /*internalSubset*/ - NULL, /*isStandalone*/ - NULL, /*hasInternalSubset*/ - NULL, /*hasExternalSubset*/ - NULL, /*resolveEntity*/ - NULL, /*getEntity*/ - NULL, /*entityDecl*/ - NULL, /*notationDecl*/ - NULL, /*attributeDecl*/ - NULL, /*elementDecl*/ - NULL, /*unparsedEntityDecl*/ - NULL, /*setDocumentLocator*/ - NULL, /*startDocument*/ - NULL, /*endDocument*/ - NULL, /*startElement*/ - NULL, /*endElement*/ - NULL, /*reference*/ - jabber_parser_element_text_libxml, /*characters*/ - NULL, /*ignorableWhitespace*/ - NULL, /*processingInstruction*/ - NULL, /*comment*/ - NULL, /*warning*/ - NULL, /*error*/ - NULL, /*fatalError*/ - NULL, /*getParameterEntity*/ - NULL, /*cdataBlock*/ - NULL, /*externalSubset*/ - XML_SAX2_MAGIC, /*initialized*/ - NULL, /*_private*/ - jabber_parser_element_start_libxml, /*startElementNs*/ - jabber_parser_element_end_libxml, /*endElementNs*/ - jabber_parser_structured_error_handler /*serror*/ -}; - -void -jabber_parser_setup(JabberStream *js) -{ - /* This seems backwards, but it makes sense. The libxml code creates - * the parser context when you try to use it (this way, it can figure - * out the encoding at creation time. So, setting up the parser is - * just a matter of destroying any current parser. */ - jabber_parser_free(js); -} - -void jabber_parser_free(JabberStream *js) { - if (js->context) { - xmlParseChunk(js->context, NULL,0,1); - xmlFreeParserCtxt(js->context); - js->context = NULL; - } -} - -void jabber_parser_process(JabberStream *js, const char *buf, int len) -{ - int ret; - - if (js->context == NULL) { - /* libxml inconsistently starts parsing on creating the - * parser, so do a ParseChunk right afterwards to force it. */ - js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); - xmlParseChunk(js->context, "", 0, 0); - } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { - xmlError *err = xmlCtxtGetLastError(js->context); - /* - * libxml2 uses a global setting to determine whether or not to store - * warnings. Other libraries may set this, which causes err to be - * NULL. See #8136 for details. - */ - xmlErrorLevel level = XML_ERR_WARNING; - - if (err) - level = err->level; - - switch (level) { - case XML_ERR_NONE: - purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); - break; - case XML_ERR_WARNING: - purple_debug_warning("jabber", "xmlParseChunk returned warning %i\n", ret); - break; - case XML_ERR_ERROR: - purple_debug_error("jabber", "xmlParseChunk returned error %i\n", ret); - break; - case XML_ERR_FATAL: - purple_debug_error("jabber", "xmlParseChunk returned fatal %i\n", ret); - purple_connection_error_reason (js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("XML Parse error")); - break; - } - } - - if (js->protocol_version == JABBER_PROTO_0_9 && !js->gc->disconnect_timeout && - (js->state == JABBER_STREAM_INITIALIZING || - js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)) { - /* - * Legacy servers don't advertise features, so if we've just gotten - * the opening <stream:stream> and there was no version, we need to - * immediately start legacy IQ auth. - */ - js->auth_type = JABBER_AUTH_IQ_AUTH; - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/parser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/** - * @file parser.h XML parser functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_PARSER_H_ -#define PURPLE_JABBER_PARSER_H_ - -#include "jabber.h" - -void jabber_parser_setup(JabberStream *js); -void jabber_parser_free(JabberStream *js); -void jabber_parser_process(JabberStream *js, const char *buf, int len); - -#endif /* PURPLE_JABBER_PARSER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "pep.h" -#include "iq.h" -#include <string.h> -#include "useravatar.h" -#include "usermood.h" -#include "usernick.h" -#include "usertune.h" - -static GHashTable *pep_handlers = NULL; - -void jabber_pep_init(void) { - if(!pep_handlers) { - pep_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - /* register PEP handlers */ - jabber_avatar_init(); - jabber_mood_init(); - jabber_tune_init(); - jabber_nick_init(); - } -} - -void jabber_pep_uninit(void) { - /* any PEP handlers that need to clean things up go here. The standard - * cleanup of removing the handler and feature are handled here and by - * jabber_features_destroy() in jabber.c - */ - g_hash_table_destroy(pep_handlers); - pep_handlers = NULL; -} - -void jabber_pep_init_actions(GList **m) { - /* register the PEP-specific actions */ - jabber_mood_init_action(m); - jabber_nick_init_action(m); -} - -void jabber_pep_register_handler(const char *xmlns, JabberPEPHandler handlerfunc) { - gchar *notifyns = g_strdup_printf("%s+notify", xmlns); - jabber_add_feature(notifyns, NULL); /* receiving PEPs is always supported */ - g_free(notifyns); - g_hash_table_replace(pep_handlers, g_strdup(xmlns), handlerfunc); -} - -static void -do_pep_iq_request_item_callback(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *pubsub; - xmlnode *items = NULL; - JabberPEPHandler *cb = data; - - if (type == JABBER_IQ_RESULT) { - pubsub = xmlnode_get_child_with_namespace(packet, "pubsub", "http://jabber.org/protocol/pubsub"); - if(pubsub) - items = xmlnode_get_child(pubsub, "items"); - } - - cb(js, from, items); -} - -void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode *pubsub, *items; - - xmlnode_set_attrib(iq->node,"to",to); - pubsub = xmlnode_new_child(iq->node,"pubsub"); - - xmlnode_set_namespace(pubsub,"http://jabber.org/protocol/pubsub"); - - items = xmlnode_new_child(pubsub, "items"); - xmlnode_set_attrib(items,"node",node); - - if (id) { - xmlnode *item = xmlnode_new_child(items, "item"); - xmlnode_set_attrib(item, "id", id); - } else - /* Most recent item */ - xmlnode_set_attrib(items, "max_items", "1"); - - jabber_iq_set_callback(iq,do_pep_iq_request_item_callback,(gpointer)cb); - - jabber_iq_send(iq); -} - -gboolean jabber_pep_namespace_only_when_pep_enabled_cb(JabberStream *js, const gchar *namespace) { - return js->pep; -} - -void jabber_handle_event(JabberMessage *jm) { - /* this may be called even when the own server doesn't support pep! */ - JabberPEPHandler *jph; - GList *itemslist; - char *jid; - - if (jm->type != JABBER_MESSAGE_EVENT) - return; - - jid = jabber_get_bare_jid(jm->from); - - for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) { - xmlnode *items = (xmlnode*)itemslist->data; - const char *nodename = xmlnode_get_attrib(items,"node"); - - if(nodename && (jph = g_hash_table_lookup(pep_handlers, nodename))) - jph(jm->js, jid, items); - } - - /* discard items we don't have a handler for */ - g_free(jid); -} - -void jabber_pep_delete_node(JabberStream *js, const gchar *node) -{ - JabberIq *iq; - xmlnode *pubsub, *del; - - g_return_if_fail(node != NULL); - g_return_if_fail(js->pep); - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - pubsub = xmlnode_new_child(iq->node, "pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub#owner"); - - del = xmlnode_new_child(pubsub, "delete"); - xmlnode_set_attrib(del, "node", node); - - jabber_iq_send(iq); -} - -void jabber_pep_publish(JabberStream *js, xmlnode *publish) { - JabberIq *iq; - xmlnode *pubsub; - - if(js->pep != TRUE) { - /* ignore when there's no PEP support on the server */ - xmlnode_free(publish); - return; - } - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - pubsub = xmlnode_new("pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); - - xmlnode_insert_child(pubsub, publish); - - xmlnode_insert_child(iq->node, pubsub); - - jabber_iq_send(iq); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/pep.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_PEP_H_ -#define PURPLE_JABBER_PEP_H_ - -#include "jabber.h" -#include "message.h" -#include "buddy.h" - -void jabber_pep_init(void); -void jabber_pep_uninit(void); - -void jabber_pep_init_actions(GList **m); - -/* - * Callback for receiving PEP events. - * - * @parameter js The JabberStream this item was received on - * @parameter items The <items/>-tag with the <item/>-children - */ -typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items); - -/* - * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info. - * Don't forget to use jabber_add_feature when supporting the sending of PEP events of this type. - * - * @parameter xmlns The namespace for this event - * @parameter handlerfunc The callback to be used when receiving an event with this namespace - */ -void jabber_pep_register_handler(const char *xmlns, JabberPEPHandler handlerfunc); - -/* - * Request a specific item from another PEP node. - * - * @parameter js The JabberStream that should be used - * @parameter to The target PEP node - * @parameter node The node name of the item that is requested - * @parameter id The item id of the requested item (may be NULL) - * @parameter cb The callback to be used when this item is received - * - * The items element passed to the callback will be NULL if any error occurred (like a permission error, node doesn't exist etc.) - */ -void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb); - -/* - * Default callback that can be used for namespaces which should only be enabled when PEP is supported - * - * @parameter js The JabberStream struct for this connection - * @parameter namespace The namespace that's queried, ignored. - * - * @returns TRUE when PEP is enabled, FALSE otherwise - */ -gboolean jabber_pep_namespace_only_when_pep_enabled_cb(JabberStream *js, const gchar *namespace); - -void jabber_handle_event(JabberMessage *jm); - -/** - * Delete the specified PEP node. - */ -void jabber_pep_delete_node(JabberStream *js, const gchar *node); - -/* - * Publishes PEP item(s) - * - * @parameter js The JabberStream associated with the connection this event should be published - * @parameter publish The publish node. This could be for example <publish node='http://jabber.org/protocol/tune'/> with an <item/> as subnode - */ -void jabber_pep_publish(JabberStream *js, xmlnode *publish); - -#endif /* PURPLE_JABBER_PEP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "debug.h" - -#include "jabber.h" -#include "ping.h" -#include "iq.h" - -static void jabber_keepalive_pong_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (js->keepalive_timeout != 0) { - purple_timeout_remove(js->keepalive_timeout); - js->keepalive_timeout = 0; - } -} - -void -jabber_ping_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *ping) -{ - if (type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT); - - if (from) - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_set_attrib(iq->node, "id", id); - - jabber_iq_send(iq); - } else if (type == JABBER_IQ_SET) { - /* XXX: error */ - } -} - -static void jabber_ping_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) - purple_debug_info("jabber", "PONG!\n"); - else - purple_debug_info("jabber", "ping not supported\n"); -} - -void jabber_keepalive_ping(JabberStream *js) -{ - JabberIq *iq; - xmlnode *ping; - - iq = jabber_iq_new(js, JABBER_IQ_GET); - ping = xmlnode_new_child(iq->node, "ping"); - xmlnode_set_namespace(ping, NS_PING); - - jabber_iq_set_callback(iq, jabber_keepalive_pong_cb, NULL); - jabber_iq_send(iq); -} - -gboolean jabber_ping_jid(JabberStream *js, const char *jid) -{ - JabberIq *iq; - xmlnode *ping; - - iq = jabber_iq_new(js, JABBER_IQ_GET); - if (jid) - xmlnode_set_attrib(iq->node, "to", jid); - - ping = xmlnode_new_child(iq->node, "ping"); - xmlnode_set_namespace(ping, NS_PING); - - jabber_iq_set_callback(iq, jabber_ping_result_cb, NULL); - jabber_iq_send(iq); - - return TRUE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/ping.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/** - * @file ping.h ping functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_PING_H_ -#define PURPLE_JABBER_PING_H_ - -#include "jabber.h" -#include "iq.h" -#include "xmlnode.h" - -void jabber_ping_parse(JabberStream *js, const char *from, - JabberIqType, const char *id, xmlnode *child); -gboolean jabber_ping_jid(JabberStream *js, const char *jid); -void jabber_keepalive_ping(JabberStream *js); - -#endif /* PURPLE_JABBER_PING_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1109 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "request.h" -#include "server.h" -#include "status.h" -#include "util.h" -#include "xmlnode.h" - -#include "buddy.h" -#include "chat.h" -#include "google.h" -#include "presence.h" -#include "iq.h" -#include "jutil.h" -#include "adhoccommands.h" - -#include "usertune.h" - - -static void chats_send_presence_foreach(gpointer key, gpointer val, - gpointer user_data) -{ - JabberChat *chat = val; - xmlnode *presence = user_data; - char *chat_full_jid; - - if(!chat->conv || chat->left) - return; - - chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, - chat->handle); - - xmlnode_set_attrib(presence, "to", chat_full_jid); - jabber_send(chat->js, presence); - g_free(chat_full_jid); -} - -void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status) -{ - PurpleAccount *account; - PurplePresence *presence; - const char *username; - - g_return_if_fail(js->user != NULL); - - account = purple_connection_get_account(js->gc); - username = purple_connection_get_display_name(js->gc); - presence = purple_account_get_presence(account); - if (status == NULL) - status = purple_presence_get_active_status(presence); - - if (purple_find_buddy(account, username)) { - JabberBuddy *jb = jabber_buddy_find(js, username, TRUE); - JabberBuddyResource *jbr; - JabberBuddyState state; - char *msg; - int priority; - - g_return_if_fail(jb != NULL); - - purple_status_to_jabber(status, &state, &msg, &priority); - - if (state == JABBER_BUDDY_STATE_UNAVAILABLE || - state == JABBER_BUDDY_STATE_UNKNOWN) { - jabber_buddy_remove_resource(jb, js->user->resource); - } else { - jbr = jabber_buddy_track_resource(jb, js->user->resource, priority, - state, msg); - jbr->idle = purple_presence_is_idle(presence) ? - purple_presence_get_idle_time(presence) : 0; - } - - if ((jbr = jabber_buddy_find_resource(jb, NULL))) { - purple_prpl_got_user_status(account, username, - jabber_buddy_state_get_status_id(jbr->state), - "priority", jbr->priority, - jbr->status ? "message" : NULL, jbr->status, - NULL); - purple_prpl_got_user_idle(account, username, jbr->idle, jbr->idle); - } else { - purple_prpl_got_user_status(account, username, "offline", - msg ? "message" : NULL, msg, - NULL); - } - g_free(msg); - } -} - -void jabber_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - JabberStream *js; - - if (!purple_account_is_connected(account)) - return; - - if (purple_status_is_exclusive(status) && !purple_status_is_active(status)) { - /* An exclusive status can't be deactivated. You should just - * activate some other exclusive status. */ - return; - } - - gc = purple_account_get_connection(account); - js = purple_connection_get_protocol_data(gc); - jabber_presence_send(js, FALSE); -} - -void jabber_presence_send(JabberStream *js, gboolean force) -{ - PurpleAccount *account; - xmlnode *presence, *x, *photo; - char *stripped = NULL; - JabberBuddyState state; - int priority; - const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; - int length = -1; - gboolean allowBuzz; - PurplePresence *p; - PurpleStatus *status, *tune; - - account = purple_connection_get_account(js->gc); - p = purple_account_get_presence(account); - status = purple_presence_get_active_status(p); - - /* we don't want to send presence before we've gotten our roster */ - if (js->state != JABBER_STREAM_CONNECTED) { - purple_debug_info("jabber", "attempt to send presence before roster retrieved\n"); - return; - } - - purple_status_to_jabber(status, &state, &stripped, &priority); - - /* check for buzz support */ - allowBuzz = purple_status_get_attr_boolean(status,"buzz"); - /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */ - - tune = purple_presence_get_status(p, "tune"); - if (js->googletalk && !stripped && purple_status_is_active(tune)) { - stripped = jabber_google_presence_outgoing(tune); - } - -#define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \ - (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) - /* check if there are any differences to the <presence> and send them in that case */ - if (force || allowBuzz != js->allowBuzz || js->old_state != state || - CHANGED(js->old_msg, stripped) || js->old_priority != priority || - CHANGED(js->old_avatarhash, js->avatar_hash) || js->old_idle != js->idle) { - /* Need to update allowBuzz before creating the presence (with caps) */ - js->allowBuzz = allowBuzz; - - presence = jabber_presence_create_js(js, state, stripped, priority); - - /* Per XEP-0153 4.1, we must always send the <x> */ - x = xmlnode_new_child(presence, "x"); - xmlnode_set_namespace(x, "vcard-temp:x:update"); - /* - * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our - * image hash if another resource has logged in and updated the - * vcard avatar. Requires changes in jabber_presence_parse. - */ - if (js->vcard_fetched) { - /* Always publish a <photo>; it's empty if we have no image. */ - photo = xmlnode_new_child(x, "photo"); - if (js->avatar_hash) - xmlnode_insert_data(photo, js->avatar_hash, -1); - } - - jabber_send(js, presence); - - g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence); - xmlnode_free(presence); - - /* update old values */ - - if(js->old_msg) - g_free(js->old_msg); - if(js->old_avatarhash) - g_free(js->old_avatarhash); - js->old_msg = g_strdup(stripped); - js->old_avatarhash = g_strdup(js->avatar_hash); - js->old_state = state; - js->old_priority = priority; - js->old_idle = js->idle; - } - g_free(stripped); - - /* next, check if there are any changes to the tune values */ - if (purple_status_is_active(tune)) { - artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL); - track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK); - length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 : - purple_status_get_attr_int(tune, PURPLE_TUNE_TIME); - } - - if(CHANGED(artist, js->old_artist) || CHANGED(title, js->old_title) || CHANGED(source, js->old_source) || - CHANGED(uri, js->old_uri) || CHANGED(track, js->old_track) || (length != js->old_length)) { - PurpleJabberTuneInfo tuneinfo = { - (char*)artist, - (char*)title, - (char*)source, - (char*)track, - length, - (char*)uri - }; - jabber_tune_set(js->gc, &tuneinfo); - - /* update old values */ - g_free(js->old_artist); - g_free(js->old_title); - g_free(js->old_source); - g_free(js->old_uri); - g_free(js->old_track); - js->old_artist = g_strdup(artist); - js->old_title = g_strdup(title); - js->old_source = g_strdup(source); - js->old_uri = g_strdup(uri); - js->old_length = length; - js->old_track = g_strdup(track); - } - -#undef CHANGED - - jabber_presence_fake_to_self(js, status); -} - -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority) -{ - return jabber_presence_create_js(NULL, state, msg, priority); -} - -xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) -{ - xmlnode *show, *status, *presence, *pri, *c; - const char *show_string = NULL; -#ifdef USE_VV - gboolean audio_enabled, video_enabled; -#endif - - presence = xmlnode_new("presence"); - - if(state == JABBER_BUDDY_STATE_UNAVAILABLE) - xmlnode_set_attrib(presence, "type", "unavailable"); - else if(state != JABBER_BUDDY_STATE_ONLINE && - state != JABBER_BUDDY_STATE_UNKNOWN && - state != JABBER_BUDDY_STATE_ERROR) - show_string = jabber_buddy_state_get_show(state); - - if(show_string) { - show = xmlnode_new_child(presence, "show"); - xmlnode_insert_data(show, show_string, -1); - } - - if(msg) { - status = xmlnode_new_child(presence, "status"); - xmlnode_insert_data(status, msg, -1); - } - - if(priority) { - char *pstr = g_strdup_printf("%d", priority); - pri = xmlnode_new_child(presence, "priority"); - xmlnode_insert_data(pri, pstr, -1); - g_free(pstr); - } - - /* if we are idle and not offline, include idle */ - if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { - xmlnode *query = xmlnode_new_child(presence, "query"); - gchar seconds[10]; - g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); - - xmlnode_set_namespace(query, NS_LAST_ACTIVITY); - xmlnode_set_attrib(query, "seconds", seconds); - } - - /* JEP-0115 */ - /* calculate hash */ - jabber_caps_calculate_own_hash(js); - /* create xml */ - c = xmlnode_new_child(presence, "c"); - xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); - xmlnode_set_attrib(c, "node", CAPS0115_NODE); - xmlnode_set_attrib(c, "hash", "sha-1"); - xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js)); - -#ifdef USE_VV - /* - * MASSIVE HUGE DISGUSTING HACK - * This is a huge hack. As far as I can tell, Google Talk's gmail client - * doesn't bother to check the actual features we advertise; they - * just assume that if we specify a 'voice-v1' ext (ignoring that - * these are to be assigned no semantic value), we support receiving voice - * calls. - * - * Ditto for 'video-v1'. - */ - audio_enabled = jabber_audio_enabled(js, NULL /* unused */); - video_enabled = jabber_video_enabled(js, NULL /* unused */); - - if (audio_enabled && video_enabled) - xmlnode_set_attrib(c, "ext", "voice-v1 camera-v1 video-v1"); - else if (audio_enabled) - xmlnode_set_attrib(c, "ext", "voice-v1"); - else if (video_enabled) - xmlnode_set_attrib(c, "ext", "camera-v1 video-v1"); -#endif - - return presence; -} - -struct _jabber_add_permit { - PurpleConnection *gc; - JabberStream *js; - char *who; -}; - -static void authorize_add_cb(gpointer data) -{ - struct _jabber_add_permit *jap = data; - if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, - jap->who, "subscribed"); - g_free(jap->who); - g_free(jap); -} - -static void deny_add_cb(gpointer data) -{ - struct _jabber_add_permit *jap = data; - if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, - jap->who, "unsubscribed"); - g_free(jap->who); - g_free(jap); -} - -static void -jabber_vcard_parse_avatar(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer blah) -{ - JabberBuddy *jb = NULL; - xmlnode *vcard, *photo, *binval, *fn, *nick; - char *text; - - if(!from) - return; - - jb = jabber_buddy_find(js, from, TRUE); - - js->pending_avatar_requests = g_slist_remove(js->pending_avatar_requests, jb); - - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { - /* The logic here regarding the nickname and full name is copied from - * buddy.c:jabber_vcard_parse. */ - gchar *nickname = NULL; - if ((fn = xmlnode_get_child(vcard, "FN"))) - nickname = xmlnode_get_data(fn); - - if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) { - char *tmp = xmlnode_get_data(nick); - char *bare_jid = jabber_get_bare_jid(from); - if (tmp && strstr(bare_jid, tmp) == NULL) { - g_free(nickname); - nickname = tmp; - } else if (tmp) - g_free(tmp); - - g_free(bare_jid); - } - - if (nickname) { - serv_got_alias(js->gc, from, nickname); - g_free(nickname); - } - - if ((photo = xmlnode_get_child(vcard, "PHOTO")) && - (binval = xmlnode_get_child(photo, "BINVAL")) && - (text = xmlnode_get_data(binval))) { - guchar *data; - gsize size; - - data = purple_base64_decode(text, &size); - if (data) { - gchar *hash = jabber_calculate_data_sha1sum(data, size); - purple_buddy_icons_set_for_user(js->gc->account, from, data, - size, hash); - g_free(hash); - } - - g_free(text); - } - } -} - -typedef struct _JabberPresenceCapabilities { - JabberStream *js; - JabberBuddy *jb; - char *from; -} JabberPresenceCapabilities; - -static void -jabber_presence_set_capabilities(JabberCapsClientInfo *info, GList *exts, - JabberPresenceCapabilities *userdata) -{ - JabberBuddyResource *jbr; - char *resource = g_utf8_strchr(userdata->from, -1, '/'); - - if (resource) - resource += 1; - - jbr = jabber_buddy_find_resource(userdata->jb, resource); - if (!jbr) { - g_free(userdata->from); - g_free(userdata); - if (exts) { - g_list_foreach(exts, (GFunc)g_free, NULL); - g_list_free(exts); - } - return; - } - - /* Any old jbr->caps.info is owned by the caps code */ - if (jbr->caps.exts) { - g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); - g_list_free(jbr->caps.exts); - } - - jbr->caps.info = info; - jbr->caps.exts = exts; - - if (info == NULL) - goto out; - - if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) { - JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS); - xmlnode_set_attrib(iq->node, "to", userdata->from); - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); - jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); - jabber_iq_send(iq); - - jbr->commands_fetched = TRUE; - } - -#if 0 - /* - * Versions of libpurple before 2.6.0 didn't advertise this capability, so - * we can't yet use Entity Capabilities to determine whether or not the - * other client supports Chat States. - */ - if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/chatstates")) - jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; - else - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; -#endif - -out: - g_free(userdata->from); - g_free(userdata); -} - -void jabber_presence_parse(JabberStream *js, xmlnode *packet) -{ - const char *from; - const char *type; - char *status = NULL; - int priority = 0; - JabberID *jid; - JabberChat *chat; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL, *found_jbr = NULL; - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - gboolean delayed = FALSE; - const gchar *stamp = NULL; /* from <delayed/> element */ - PurpleBuddy *b = NULL; - char *buddy_name; - JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN; - xmlnode *y; - char *avatar_hash = NULL; - xmlnode *caps = NULL; - int idle = 0; - gchar *nickname = NULL; - gboolean signal_return; - - from = xmlnode_get_attrib(packet, "from"); - type = xmlnode_get_attrib(packet, "type"); - - jb = jabber_buddy_find(js, from, TRUE); - g_return_if_fail(jb != NULL); - - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), - "jabber-receiving-presence", js->gc, type, from, packet)); - if (signal_return) - return; - - jid = jabber_id_new(from); - if (jid == NULL) { - purple_debug_error("jabber", "Ignoring presence with malformed 'from' " - "JID: %s\n", from); - return; - } - - if(jb->error_msg) { - g_free(jb->error_msg); - jb->error_msg = NULL; - } - - if (type == NULL) { - xmlnode *show; - char *show_data = NULL; - - state = JABBER_BUDDY_STATE_ONLINE; - - show = xmlnode_get_child(packet, "show"); - if (show) { - show_data = xmlnode_get_data(show); - if (show_data) { - state = jabber_buddy_show_get_state(show_data); - g_free(show_data); - } else - purple_debug_warning("jabber", "<show/> present on presence, " - "but no contents!\n"); - } - } else if (g_str_equal(type, "error")) { - char *msg = jabber_parse_error(js, packet, NULL); - - state = JABBER_BUDDY_STATE_ERROR; - jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence")); - } else if (g_str_equal(type, "subscribe")) { - struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1); - gboolean onlist = FALSE; - PurpleAccount *account; - PurpleBuddy *buddy; - JabberBuddy *jb = NULL; - xmlnode *nick; - - account = purple_connection_get_account(js->gc); - buddy = purple_find_buddy(account, from); - nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick"); - if (nick) - nickname = xmlnode_get_data(nick); - - if (buddy) { - jb = jabber_buddy_find(js, from, TRUE); - if ((jb->subscription & (JABBER_SUB_TO | JABBER_SUB_PENDING))) - onlist = TRUE; - } - - jap->gc = js->gc; - jap->who = g_strdup(from); - jap->js = js; - - purple_account_request_authorization(account, from, NULL, nickname, - NULL, onlist, authorize_add_cb, deny_add_cb, jap); - - g_free(nickname); - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "subscribed")) { - /* we've been allowed to see their presence, but we don't care */ - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "unsubscribe")) { - /* XXX I'm not sure this is the right way to handle this, it - * might be better to add "unsubscribe" to the presence status - * if lower down, but I'm not sure. */ - /* they are unsubscribing from our presence, we don't care */ - /* Well, maybe just a little, we might want/need to start - * acknowledging this (and the others) at some point. */ - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "probe")) { - purple_debug_warning("jabber", "Ignoring presence probe\n"); - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "unavailable")) { - state = JABBER_BUDDY_STATE_UNAVAILABLE; - } else if (g_str_equal(type, "unsubscribed")) { - state = JABBER_BUDDY_STATE_UNKNOWN; - } else { - purple_debug_warning("jabber", "Ignoring presence with invalid type " - "'%s'\n", type); - jabber_id_free(jid); - return; - } - - - for(y = packet->child; y; y = y->next) { - const char *xmlns; - if(y->type != XMLNODE_TYPE_TAG) - continue; - xmlns = xmlnode_get_namespace(y); - - if(!strcmp(y->name, "status")) { - g_free(status); - status = xmlnode_get_data(y); - } else if(!strcmp(y->name, "priority")) { - char *p = xmlnode_get_data(y); - if(p) { - priority = atoi(p); - g_free(p); - } - } else if(xmlns == NULL) { - /* The rest of the cases used to check xmlns individually. */ - continue; - } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) { - /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ - delayed = TRUE; - stamp = xmlnode_get_attrib(y, "stamp"); - } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { - caps = y; /* store for later, when creating buddy resource */ - } else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) { - nickname = xmlnode_get_data(y); - } else if(!strcmp(y->name, "x")) { - if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) { - /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ - delayed = TRUE; - stamp = xmlnode_get_attrib(y, "stamp"); - } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { - } else if(!strcmp(xmlns, "vcard-temp:x:update")) { - xmlnode *photo = xmlnode_get_child(y, "photo"); - if(photo) { - g_free(avatar_hash); - avatar_hash = xmlnode_get_data(photo); - } - } - } else if (!strcmp(y->name, "query") && - !strcmp(xmlnode_get_namespace(y), NS_LAST_ACTIVITY)) { - /* resource has specified idle */ - const gchar *seconds = xmlnode_get_attrib(y, "seconds"); - if (seconds) { - /* we may need to take "delayed" into account here */ - idle = atoi(seconds); - } - } - } - - if (idle && delayed && stamp) { - /* if we have a delayed presence, we need to add the delay to the idle - value */ - time_t offset = time(NULL) - purple_str_to_time(stamp, TRUE, NULL, NULL, - NULL); - purple_debug_info("jabber", "got delay %s yielding %ld s offset\n", - stamp, offset); - idle += offset; - } - - if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) { - static int i = 1; - - if(state == JABBER_BUDDY_STATE_ERROR) { - char *title, *msg = jabber_parse_error(js, packet, NULL); - - if (!chat->conv) { - title = g_strdup_printf(_("Error joining chat %s"), from); - purple_serv_got_join_chat_failed(js->gc, chat->components); - } else { - title = g_strdup_printf(_("Error in chat %s"), from); - if (g_hash_table_size(chat->members) == 0) - serv_got_chat_left(js->gc, chat->id); - } - purple_notify_error(js->gc, title, title, msg); - g_free(title); - g_free(msg); - - if (g_hash_table_size(chat->members) == 0) - /* Only destroy the chat if the error happened while joining */ - jabber_chat_destroy(chat); - jabber_id_free(jid); - g_free(status); - g_free(avatar_hash); - g_free(nickname); - return; - } - - if (type == NULL) { - xmlnode *x; - const char *real_jid = NULL; - const char *affiliation = NULL; - const char *role = NULL; - gboolean is_our_resource = FALSE; /* Is the presence about us? */ - - /* - * XEP-0045 mandates the presence to include a resource (which is - * treated as the chat nick). Some non-compliant servers allow - * joining without a nick. - */ - if (!jid->resource) { - jabber_id_free(jid); - g_free(avatar_hash); - g_free(nickname); - g_free(status); - return; - } - - x = xmlnode_get_child_with_namespace(packet, "x", - "http://jabber.org/protocol/muc#user"); - if (x) { - xmlnode *status_node; - xmlnode *item_node; - - for (status_node = xmlnode_get_child(x, "status"); status_node; - status_node = xmlnode_get_next_twin(status_node)) { - const char *code = xmlnode_get_attrib(status_node, "code"); - if (!code) - continue; - - if (g_str_equal(code, "110")) { - is_our_resource = TRUE; - } else if (g_str_equal(code, "201")) { - if ((chat = jabber_chat_find(js, jid->node, jid->domain))) { - chat->config_dialog_type = PURPLE_REQUEST_ACTION; - chat->config_dialog_handle = - purple_request_action(js->gc, - _("Create New Room"), - _("Create New Room"), - _("You are creating a new room. Would" - " you like to configure it, or" - " accept the default settings?"), - /* Default Action */ 1, - purple_connection_get_account(js->gc), NULL, chat->conv, - chat, 2, - _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure), - _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room)); - } - } else if (g_str_equal(code, "210")) { - /* server rewrote room-nick */ - if((chat = jabber_chat_find(js, jid->node, jid->domain))) { - g_free(chat->handle); - chat->handle = g_strdup(jid->resource); - } - } - } - - item_node = xmlnode_get_child(x, "item"); - if (item_node) { - real_jid = xmlnode_get_attrib(item_node, "jid"); - affiliation = xmlnode_get_attrib(item_node, "affiliation"); - role = xmlnode_get_attrib(item_node, "role"); - - if (purple_strequal(affiliation, "owner")) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (role) { - if (g_str_equal(role, "moderator")) - flags |= PURPLE_CBFLAGS_OP; - else if (g_str_equal(role, "participant")) - flags |= PURPLE_CBFLAGS_VOICE; - } - } - } - - if(!chat->conv) { - char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain); - chat->id = i++; - chat->muc = (x != NULL); - chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle); - - jabber_chat_disco_traffic(chat); - g_free(room_jid); - } - - jabber_buddy_track_resource(jb, jid->resource, priority, state, - status); - - jabber_chat_track_handle(chat, jid->resource, real_jid, affiliation, role); - - if(!jabber_chat_find_buddy(chat->conv, jid->resource)) - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, - real_jid, flags, !delayed); - else - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), jid->resource, - flags); - } else if (g_str_equal(type, "unavailable")) { - xmlnode *x; - gboolean nick_change = FALSE; - gboolean kick = FALSE; - gboolean is_our_resource = FALSE; /* Is the presence about us? */ - - /* If the chat nick is invalid, we haven't yet joined, or we've - * already left (it was probably us leaving after we closed the - * chat), we don't care. - */ - if (!jid->resource || !chat->conv || chat->left) { - if (chat->left && - jid->resource && chat->handle && !strcmp(jid->resource, chat->handle)) - jabber_chat_destroy(chat); - jabber_id_free(jid); - g_free(status); - g_free(avatar_hash); - g_free(nickname); - return; - } - - is_our_resource = (0 == g_utf8_collate(jid->resource, chat->handle)); - - jabber_buddy_remove_resource(jb, jid->resource); - - x = xmlnode_get_child_with_namespace(packet, "x", - "http://jabber.org/protocol/muc#user"); - if (chat->muc && x) { - const char *nick; - const char *item_jid = NULL; - const char *to; - xmlnode *stat; - xmlnode *item; - - item = xmlnode_get_child(x, "item"); - if (item) - item_jid = xmlnode_get_attrib(item, "jid"); - - for (stat = xmlnode_get_child(x, "status"); stat; - stat = xmlnode_get_next_twin(stat)) { - const char *code = xmlnode_get_attrib(stat, "code"); - - if (!code) - continue; - - if (g_str_equal(code, "110")) { - is_our_resource = TRUE; - } else if(!strcmp(code, "301")) { - /* XXX: we got banned */ - } else if(!strcmp(code, "303") && item && - (nick = xmlnode_get_attrib(item, "nick"))) { - nick_change = TRUE; - if(!strcmp(jid->resource, chat->handle)) { - g_free(chat->handle); - chat->handle = g_strdup(nick); - } - - /* TODO: This should probably be moved out of the loop */ - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, nick); - jabber_chat_remove_handle(chat, jid->resource); - continue; - } else if(!strcmp(code, "307")) { - /* Someone was kicked from the room */ - xmlnode *reason = NULL, *actor = NULL; - const char *actor_name = NULL; - char *reason_text = NULL; - char *tmp; - - kick = TRUE; - - if (item) { - reason = xmlnode_get_child(item, "reason"); - actor = xmlnode_get_child(item, "actor"); - - if (reason != NULL) - reason_text = xmlnode_get_data(reason); - if (actor != NULL) - actor_name = xmlnode_get_attrib(actor, "jid"); - } - - if (reason_text == NULL) - reason_text = g_strdup(_("No reason")); - - if (is_our_resource) { - if (actor_name != NULL) - tmp = g_strdup_printf(_("You have been kicked by %s: (%s)"), - actor_name, reason_text); - else - tmp = g_strdup_printf(_("You have been kicked: (%s)"), - reason_text); - } else { - if (actor_name != NULL) - tmp = g_strdup_printf(_("Kicked by %s (%s)"), - actor_name, reason_text); - else - tmp = g_strdup_printf(_("Kicked (%s)"), - reason_text); - } - - g_free(reason_text); - g_free(status); - status = tmp; - } else if(!strcmp(code, "321")) { - /* XXX: removed due to an affiliation change */ - } else if(!strcmp(code, "322")) { - /* XXX: removed because room is now members-only */ - } else if(!strcmp(code, "332")) { - /* XXX: removed due to system shutdown */ - } - } - - /* - * Possibly another connected resource of our JID (see XEP-0045 - * v1.24 section 7.1.10) being disconnected. Should be - * distinguished by the item_jid. - * Also possibly works around bits of an Openfire bug. See - * #8319. - */ - to = xmlnode_get_attrib(packet, "to"); - if (is_our_resource && item_jid && !purple_strequal(to, item_jid)) { - /* TODO: When the above is a loop, this needs to still act - * sanely for all cases (this code is a little fragile). */ - if (!kick && !nick_change) - /* Presumably, kicks and nick changes also affect us. */ - is_our_resource = FALSE; - } - } - if(!nick_change) { - if (is_our_resource) { - if (kick) - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), jid->resource, - status, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - serv_got_chat_left(js->gc, chat->id); - jabber_chat_destroy(chat); - } else { - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, - status); - jabber_chat_remove_handle(chat, jid->resource); - } - } - } else { - /* A type that isn't available or unavailable */ - purple_debug_error("jabber", "MUC presence with bad type: %s\n", - type); - - jabber_id_free(jid); - g_free(avatar_hash); - g_free(status); - g_free(nickname); - g_return_if_reached(); - } - } else { - buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "", - jid->node ? "@" : "", jid->domain); - if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) { - if (jb != js->user_jb) { - purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n", - buddy_name, purple_account_get_username(js->gc->account), js->gc->account); - jabber_id_free(jid); - g_free(avatar_hash); - g_free(buddy_name); - g_free(nickname); - g_free(status); - return; - } else { - /* this is a different resource of our own account. Resume even when this account isn't on our blist */ - } - } - - if(b && avatar_hash) { - const char *avatar_hash2 = purple_buddy_icons_get_checksum_for_user(b); - if(!avatar_hash2 || strcmp(avatar_hash, avatar_hash2)) { - JabberIq *iq; - xmlnode *vcard; - - /* XXX this is a crappy way of trying to prevent - * someone from spamming us with presence packets - * and causing us to DoS ourselves...what we really - * need is a queue system that can throttle itself, - * but i'm too tired to write that right now */ - if(!g_slist_find(js->pending_avatar_requests, jb)) { - - js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb); - - iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", buddy_name); - vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); - - jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL); - jabber_iq_send(iq); - } - } - } - - if(state == JABBER_BUDDY_STATE_ERROR || - (type && (g_str_equal(type, "unavailable") || - g_str_equal(type, "unsubscribed")))) { - PurpleConversation *conv; - - jabber_buddy_remove_resource(jb, jid->resource); - if((conv = jabber_find_unnormalized_conv(from, js->gc->account))) - purple_conversation_set_name(conv, buddy_name); - - } else { - jbr = jabber_buddy_track_resource(jb, jid->resource, priority, - state, status); - if (idle) { - jbr->idle = time(NULL) - idle; - } else { - jbr->idle = 0; - } - } - - if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { - jabber_google_presence_incoming(js, buddy_name, found_jbr); - purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL); - purple_prpl_got_user_idle(js->gc->account, buddy_name, found_jbr->idle, found_jbr->idle); - if (nickname) - serv_got_alias(js->gc, buddy_name, nickname); - } else { - purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL); - } - g_free(buddy_name); - } - - if (caps && !type) { - /* handle Entity Capabilities (XEP-0115) */ - const char *node = xmlnode_get_attrib(caps, "node"); - const char *ver = xmlnode_get_attrib(caps, "ver"); - const char *hash = xmlnode_get_attrib(caps, "hash"); - const char *ext = xmlnode_get_attrib(caps, "ext"); - - /* v1.3 uses: node, ver, and optionally ext. - * v1.5 uses: node, ver, and hash. */ - if (node && *node && ver && *ver) { - gchar **exts = ext && *ext ? g_strsplit(ext, " ", -1) : NULL; - jbr = jabber_buddy_find_resource(jb, jid->resource); - - /* Look it up if we don't already have all this information */ - if (!jbr || !jbr->caps.info || - !g_str_equal(node, jbr->caps.info->tuple.node) || - !g_str_equal(ver, jbr->caps.info->tuple.ver) || - !purple_strequal(hash, jbr->caps.info->tuple.hash) || - !jabber_caps_exts_known(jbr->caps.info, (gchar **)exts)) { - JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1); - userdata->js = js; - userdata->jb = jb; - userdata->from = g_strdup(from); - jabber_caps_get_info(js, from, node, ver, hash, exts, - (jabber_caps_get_info_cb)jabber_presence_set_capabilities, - userdata); - } else { - if (exts) - g_strfreev(exts); - } - } - } - - g_free(nickname); - g_free(status); - jabber_id_free(jid); - g_free(avatar_hash); -} - -void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type) -{ - xmlnode *presence = xmlnode_new("presence"); - - xmlnode_set_attrib(presence, "to", who); - xmlnode_set_attrib(presence, "type", type); - - jabber_send(js, presence); - xmlnode_free(presence); -} - -void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority) -{ - const char *status_id = NULL; - const char *formatted_msg = NULL; - - if(state) *state = JABBER_BUDDY_STATE_UNKNOWN; - if(msg) *msg = NULL; - if(priority) *priority = 0; - - if(!status) { - if(state) *state = JABBER_BUDDY_STATE_UNAVAILABLE; - } else { - if(state) { - status_id = purple_status_get_id(status); - *state = jabber_buddy_status_id_get_state(status_id); - } - - if(msg) { - formatted_msg = purple_status_get_attr_string(status, "message"); - - /* if the message is blank, then there really isn't a message */ - if(formatted_msg && *formatted_msg) - *msg = purple_markup_strip_html(formatted_msg); - } - - if(priority) - *priority = purple_status_get_attr_int(status, "priority"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/presence.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file presence.h Presence - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_PRESENCE_H_ -#define PURPLE_JABBER_PRESENCE_H_ - -#include "buddy.h" -#include "jabber.h" -#include "xmlnode.h" - -void jabber_set_status(PurpleAccount *account, PurpleStatus *status); - -/** - * Send a full presence stanza. - * - * @param js A JabberStream object. - * @param force Force sending the presence stanza, irrespective of whether - * the contents seem to have changed. - */ -void jabber_presence_send(JabberStream *js, gboolean force); - -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority); /* DEPRECATED */ -xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); -void jabber_presence_parse(JabberStream *js, xmlnode *packet); -void jabber_presence_subscription_set(JabberStream *js, const char *who, - const char *type); -void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status); -void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority); - -#endif /* PURPLE_JABBER_PRESENCE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,460 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "server.h" -#include "util.h" - -#include "buddy.h" -#include "chat.h" -#include "google.h" -#include "presence.h" -#include "roster.h" -#include "iq.h" - -#include <string.h> - -/* Take a list of strings and join them with a ", " separator */ -static gchar *roster_groups_join(GSList *list) -{ - GString *out = g_string_new(NULL); - for ( ; list; list = list->next) { - out = g_string_append(out, (const char *)list->data); - if (list->next) - out = g_string_append(out, ", "); - } - - return g_string_free(out, FALSE); -} - -void jabber_roster_request(JabberStream *js) -{ - JabberIq *iq; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster"); - - jabber_iq_send(iq); -} - -static void remove_purple_buddies(JabberStream *js, const char *jid) -{ - GSList *buddies, *l; - - buddies = purple_find_buddies(js->gc->account, jid); - - for(l = buddies; l; l = l->next) - purple_blist_remove_buddy(l->data); - - g_slist_free(buddies); -} - -static void add_purple_buddy_to_groups(JabberStream *js, const char *jid, - const char *alias, GSList *groups) -{ - GSList *buddies, *l; - PurpleAccount *account = purple_connection_get_account(js->gc); - - buddies = purple_find_buddies(js->gc->account, jid); - - if(!groups) { - if(!buddies) - groups = g_slist_append(groups, g_strdup(_("Buddies"))); - else { - /* TODO: What should we do here? Removing the local buddies - * is wrong, but so is letting the group state get out of sync with - * the server. - */ - g_slist_free(buddies); - return; - } - } - - while(buddies) { - PurpleBuddy *b = buddies->data; - PurpleGroup *g = purple_buddy_get_group(b); - - buddies = g_slist_delete_link(buddies, buddies); - - /* XMPP groups are case-sensitive, but libpurple groups are - * case-insensitive. We treat a buddy in both "Friends" and "friends" - * as only being in one group, but if we push changes about the buddy - * to the server, the buddy will be dropped from one of the groups. - * Not optimal, but better than the alternative, I think. - */ - if((l = g_slist_find_custom(groups, purple_group_get_name(g), (GCompareFunc)purple_utf8_strcasecmp))) { - /* The buddy is already on the local list. Update info. */ - const char *servernick, *balias; - - /* Previously stored serverside / buddy-supplied alias */ - if((servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"))) - serv_got_alias(js->gc, jid, servernick); - - /* Alias from our roster retrieval */ - balias = purple_buddy_get_local_buddy_alias(b); - if(alias && !purple_strequal(alias, balias)) - purple_serv_got_private_alias(js->gc, jid, alias); - g_free(l->data); - groups = g_slist_delete_link(groups, l); - } else { - /* This buddy isn't in the group on the server anymore */ - purple_debug_info("jabber", "jabber_roster_parse(): Removing %s " - "from group '%s' on the local list\n", - purple_buddy_get_name(b), - purple_group_get_name(g)); - purple_blist_remove_buddy(b); - } - } - - if (groups) { - char *tmp = roster_groups_join(groups); - purple_debug_info("jabber", "jabber_roster_parse(): Adding %s to " - "groups: %s\n", jid, tmp); - g_free(tmp); - } - - while(groups) { - PurpleGroup *g = purple_find_group(groups->data); - PurpleBuddy *b = purple_buddy_new(account, jid, alias); - - if(!g) { - g = purple_group_new(groups->data); - purple_blist_add_group(g, NULL); - } - - purple_blist_add_buddy(b, NULL, g, NULL); - purple_blist_alias_buddy(b, alias); - - g_free(groups->data); - groups = g_slist_delete_link(groups, groups); - } - - g_slist_free(buddies); -} - -void jabber_roster_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query) -{ - xmlnode *item, *group; - - if (!jabber_is_own_account(js, from)) { - purple_debug_warning("jabber", "Received bogon roster push from %s\n", - from); - return; - } - - js->currently_parsing_roster_push = TRUE; - - for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) - { - const char *jid, *name, *subscription, *ask; - JabberBuddy *jb; - - subscription = xmlnode_get_attrib(item, "subscription"); - jid = xmlnode_get_attrib(item, "jid"); - name = xmlnode_get_attrib(item, "name"); - ask = xmlnode_get_attrib(item, "ask"); - - if(!jid) - continue; - - if(!(jb = jabber_buddy_find(js, jid, TRUE))) - continue; - - if(subscription) { - if (jb == js->user_jb) - jb->subscription = JABBER_SUB_BOTH; - else if(!strcmp(subscription, "none")) - jb->subscription = JABBER_SUB_NONE; - else if(!strcmp(subscription, "to")) - jb->subscription = JABBER_SUB_TO; - else if(!strcmp(subscription, "from")) - jb->subscription = JABBER_SUB_FROM; - else if(!strcmp(subscription, "both")) - jb->subscription = JABBER_SUB_BOTH; - else if(!strcmp(subscription, "remove")) - jb->subscription = JABBER_SUB_REMOVE; - } - - if(purple_strequal(ask, "subscribe")) - jb->subscription |= JABBER_SUB_PENDING; - else - jb->subscription &= ~JABBER_SUB_PENDING; - - if(jb->subscription & JABBER_SUB_REMOVE) { - remove_purple_buddies(js, jid); - } else { - GSList *groups = NULL; - gboolean seen_empty = FALSE; - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) - if (!jabber_google_roster_incoming(js, item)) - continue; - - for(group = xmlnode_get_child(item, "group"); group; group = xmlnode_get_next_twin(group)) { - char *group_name = xmlnode_get_data(group); - - if (!group_name && !seen_empty) { - group_name = g_strdup(""); - seen_empty = TRUE; - } - - groups = g_slist_prepend(groups, group_name); - } - - add_purple_buddy_to_groups(js, jid, name, groups); - if (jb == js->user_jb) - jabber_presence_fake_to_self(js, NULL); - } - } - - js->currently_parsing_roster_push = FALSE; - - /* if we're just now parsing the roster for the first time, - * then now would be the time to declare ourselves connected. - */ - if (js->state != JABBER_STREAM_CONNECTED) - jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); -} - -/* jabber_roster_update frees the GSList* passed in */ -static void jabber_roster_update(JabberStream *js, const char *name, - GSList *groups) -{ - PurpleBuddy *b; - PurpleGroup *g; - GSList *l; - JabberIq *iq; - xmlnode *query, *item, *group; - const char *balias; - - if (js->currently_parsing_roster_push) - return; - - if(!(b = purple_find_buddy(js->gc->account, name))) - return; - - if (groups) { - char *tmp = roster_groups_join(groups); - - purple_debug_info("jabber", "jabber_roster_update(%s): [Source: " - "groups]: groups: %s\n", name, tmp); - g_free(tmp); - } else { - GSList *buddies = purple_find_buddies(js->gc->account, name); - char *tmp; - - if(!buddies) - return; - while(buddies) { - b = buddies->data; - g = purple_buddy_get_group(b); - groups = g_slist_append(groups, (char *)purple_group_get_name(g)); - buddies = g_slist_remove(buddies, b); - } - - tmp = roster_groups_join(groups); - purple_debug_info("jabber", "jabber_roster_update(%s): [Source: local blist]: groups: %s\n", - name, tmp); - g_free(tmp); - } - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - - xmlnode_set_attrib(item, "jid", name); - - balias = purple_buddy_get_local_buddy_alias(b); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - - for(l = groups; l; l = l->next) { - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, l->data, -1); - } - - g_slist_free(groups); - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) { - jabber_google_roster_outgoing(js, query, item); - xmlnode_set_attrib(query, "xmlns:gr", "google:roster"); - xmlnode_set_attrib(query, "gr:ext", "2"); - } - jabber_iq_send(iq); -} - -void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - JabberStream *js = gc->proto_data; - char *who; - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr; - const char *name; - - /* If we haven't received the roster yet, ignore any adds */ - if (js->state != JABBER_STREAM_CONNECTED) - return; - - name = purple_buddy_get_name(buddy); - jid = jabber_id_new(name); - if (jid == NULL) { - /* TODO: Remove the buddy from the list? */ - return; - } - - /* Adding a chat room or a chat buddy to the roster is *not* supported. */ - if (jid->node && jabber_chat_find(js, jid->node, jid->domain) != NULL) { - /* - * This is the same thing Bonjour does. If it causes problems, move - * it to an idle callback. - */ - purple_debug_warning("jabber", "Cowardly refusing to add a MUC user " - "to your buddy list and removing the buddy. " - "Buddies can only be added by real (non-MUC) " - "JID\n"); - purple_blist_remove_buddy(buddy); - jabber_id_free(jid); - return; - } - - who = jabber_id_get_bare_jid(jid); - if (jid->resource != NULL) { - /* - * If the buddy name added contains a resource, strip that off and - * rename the buddy. - */ - purple_blist_rename_buddy(buddy, who); - } - - jb = jabber_buddy_find(js, who, FALSE); - - purple_debug_info("jabber", "jabber_roster_add_buddy(): Adding %s\n", who); - - jabber_roster_update(js, who, NULL); - - if (jb == js->user_jb) { - jabber_presence_fake_to_self(js, NULL); - } else if(!jb || !(jb->subscription & JABBER_SUB_TO)) { - jabber_presence_subscription_set(js, who, "subscribe"); - } else if((jbr =jabber_buddy_find_resource(jb, NULL))) { - purple_prpl_got_user_status(gc->account, who, - jabber_buddy_state_get_status_id(jbr->state), - "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL); - } - - g_free(who); -} - -void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias) -{ - PurpleBuddy *b = purple_find_buddy(gc->account, name); - - if(b != NULL) { - purple_blist_alias_buddy(b, alias); - - purple_debug_info("jabber", "jabber_roster_alias_change(): Aliased %s to %s\n", - name, alias ? alias : "(null)"); - - jabber_roster_update(gc->proto_data, name, NULL); - } -} - -void jabber_roster_group_change(PurpleConnection *gc, const char *name, - const char *old_group, const char *new_group) -{ - GSList *buddies, *groups = NULL; - PurpleBuddy *b; - PurpleGroup *g; - const char *gname; - - if(!old_group || !new_group || !strcmp(old_group, new_group)) - return; - - buddies = purple_find_buddies(gc->account, name); - while(buddies) { - b = buddies->data; - g = purple_buddy_get_group(b); - gname = purple_group_get_name(g); - if(!strcmp(gname, old_group)) - groups = g_slist_append(groups, (char*)new_group); /* ick */ - else - groups = g_slist_append(groups, (char*)gname); - buddies = g_slist_remove(buddies, b); - } - - purple_debug_info("jabber", "jabber_roster_group_change(): Moving %s from %s to %s\n", - name, old_group, new_group); - - jabber_roster_update(gc->proto_data, name, groups); -} - -void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - GList *l; - const char *gname = purple_group_get_name(group); - for(l = moved_buddies; l; l = l->next) { - PurpleBuddy *buddy = l->data; - jabber_roster_group_change(gc, purple_buddy_get_name(buddy), old_name, gname); - } -} - -void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) { - const char *name = purple_buddy_get_name(buddy); - GSList *buddies = purple_find_buddies(purple_connection_get_account(gc), name); - - buddies = g_slist_remove(buddies, buddy); - if(buddies != NULL) { - PurpleBuddy *tmpbuddy; - PurpleGroup *tmpgroup; - GSList *groups = NULL; - - while(buddies) { - tmpbuddy = buddies->data; - tmpgroup = purple_buddy_get_group(tmpbuddy); - groups = g_slist_append(groups, (char *)purple_group_get_name(tmpgroup)); - buddies = g_slist_remove(buddies, tmpbuddy); - } - - purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s from %s\n", - purple_buddy_get_name(buddy), purple_group_get_name(group)); - - jabber_roster_update(gc->proto_data, name, groups); - } else { - JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET, - "jabber:iq:roster"); - xmlnode *query = xmlnode_get_child(iq->node, "query"); - xmlnode *item = xmlnode_new_child(query, "item"); - - xmlnode_set_attrib(item, "jid", name); - xmlnode_set_attrib(item, "subscription", "remove"); - - purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s\n", - purple_buddy_get_name(buddy)); - - jabber_iq_send(iq); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/roster.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/** - * @file roster.h Roster manipulation - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_ROSTER_H_ -#define PURPLE_JABBER_ROSTER_H_ - -#include "jabber.h" - -void jabber_roster_request(JabberStream *js); - -void jabber_roster_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); - -void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group); -void jabber_roster_alias_change(PurpleConnection *gc, const char *name, - const char *alias); -void jabber_roster_group_change(PurpleConnection *gc, const char *name, - const char *old_group, const char *new_group); -void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies); -void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group); - -#endif /* PURPLE_JABBER_ROSTER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1742 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "blist.h" -#include "debug.h" -#include "ft.h" -#include "request.h" -#include "network.h" -#include "notify.h" - -#include "buddy.h" -#include "disco.h" -#include "jabber.h" -#include "ibb.h" -#include "iq.h" -#include "si.h" - -#define STREAMHOST_CONNECT_TIMEOUT 15 - -typedef struct _JabberSIXfer { - JabberStream *js; - - PurpleProxyConnectData *connect_data; - PurpleNetworkListenData *listen_data; - guint connect_timeout; - - gboolean accepted; - - char *stream_id; - char *iq_id; - - enum { - STREAM_METHOD_UNKNOWN = 0, - STREAM_METHOD_BYTESTREAMS = 2 << 1, - STREAM_METHOD_IBB = 2 << 2, - STREAM_METHOD_UNSUPPORTED = 2 << 31 - } stream_method; - - GList *streamhosts; - PurpleProxyInfo *gpi; - - char *rxqueue; - size_t rxlen; - gsize rxmaxlen; - int local_streamhost_fd; - - JabberIBBSession *ibb_session; - guint ibb_timeout_handle; - PurpleCircBuffer *ibb_buffer; -} JabberSIXfer; - -/* some forward declarations */ -static void jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer); - -static PurpleXfer* -jabber_si_xfer_find(JabberStream *js, const char *sid, const char *from) -{ - GList *xfers; - - if(!sid || !from) - return NULL; - - for(xfers = js->file_transfers; xfers; xfers = xfers->next) { - PurpleXfer *xfer = xfers->data; - JabberSIXfer *jsx = xfer->data; - if(jsx->stream_id && xfer->who && - !strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from)) - return xfer; - } - - return NULL; -} - -static void -jabber_si_free_streamhost(gpointer data, gpointer user_data) -{ - JabberBytestreamsStreamhost *sh = data; - - if(!data) - return; - - g_free(sh->jid); - g_free(sh->host); - g_free(sh->zeroconf); - g_free(sh); -} - - - -static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer); - -static void -jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - JabberIq *iq; - xmlnode *query, *su; - JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data; - - purple_proxy_info_destroy(jsx->gpi); - jsx->gpi = NULL; - jsx->connect_data = NULL; - - if (jsx->connect_timeout > 0) - purple_timeout_remove(jsx->connect_timeout); - jsx->connect_timeout = 0; - - if(source < 0) { - purple_debug_warning("jabber", - "si connection failed, jid was %s, host was %s, error was %s\n", - streamhost->jid, streamhost->host, - error_message ? error_message : "(null)"); - jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); - jabber_si_free_streamhost(streamhost, NULL); - jabber_si_bytestreams_attempt_connect(xfer); - return; - } - - /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) - { - xmlnode *activate; - iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", streamhost->jid); - query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(query, "sid", jsx->stream_id); - activate = xmlnode_new_child(query, "activate"); - xmlnode_insert_data(activate, xfer->who, -1); - - /* TODO: We need to wait for an activation result before starting */ - } - else - { - iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jsx->iq_id); - query = xmlnode_get_child(iq->node, "query"); - su = xmlnode_new_child(query, "streamhost-used"); - xmlnode_set_attrib(su, "jid", streamhost->jid); - } - - jabber_iq_send(iq); - - purple_xfer_start(xfer, source, NULL, -1); -} - -static gboolean -connect_timeout_cb(gpointer data) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - - purple_debug_info("jabber", "Streamhost connection timeout of %d seconds exceeded.\n", STREAMHOST_CONNECT_TIMEOUT); - - jsx->connect_timeout = 0; - - if (jsx->connect_data != NULL) - purple_proxy_connect_cancel(jsx->connect_data); - jsx->connect_data = NULL; - - /* Trigger the connect error manually */ - jabber_si_bytestreams_connect_cb(xfer, -1, "Timeout Exceeded."); - - return FALSE; -} - -static void -jabber_si_bytestreams_ibb_timeout_remove(JabberSIXfer *jsx) -{ - if (jsx->ibb_timeout_handle) { - purple_timeout_remove(jsx->ibb_timeout_handle); - jsx->ibb_timeout_handle = 0; - } -} - -static gboolean -jabber_si_bytestreams_ibb_timeout_cb(gpointer data) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = xfer->data; - - if (jsx && !jsx->ibb_session) { - purple_debug_info("jabber", - "jabber_si_bytestreams_ibb_timeout called and IBB session not set " - " up yet, cancel transfer"); - jabber_si_bytestreams_ibb_timeout_remove(jsx); - purple_xfer_cancel_local(xfer); - } - - return FALSE; -} - -static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - JabberBytestreamsStreamhost *streamhost; - JabberID *dstjid; - - if(!jsx->streamhosts) { - JabberIq *iq = jabber_iq_new(jsx->js, JABBER_IQ_ERROR); - xmlnode *error, *inf; - - if(jsx->iq_id) - jabber_iq_set_id(iq, jsx->iq_id); - - xmlnode_set_attrib(iq->node, "to", xfer->who); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, NS_XMPP_STANZAS); - - jabber_iq_send(iq); - - /* if IBB is available, revert to that before giving up... */ - if (jsx->stream_method & STREAM_METHOD_IBB) { - /* if we are the initializer, init IBB */ - purple_debug_info("jabber", - "jabber_si_bytestreams_attempt_connect: " - "no streamhosts found, trying IBB\n"); - /* if we are the sender, open an IBB session, but not if we already - did it, since we could have received the error <iq/> from the - receiver already... */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND - && !jsx->ibb_session) { - jabber_si_xfer_ibb_send_init(jsx->js, xfer); - } else { - /* setup a timeout to cancel waiting for IBB open */ - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are the receiver, just wait for IBB open, callback is - already set up... */ - } else { - purple_xfer_cancel_local(xfer); - } - - return; - } - - streamhost = jsx->streamhosts->data; - - jsx->connect_data = NULL; - if (jsx->gpi != NULL) - purple_proxy_info_destroy(jsx->gpi); - jsx->gpi = NULL; - - dstjid = jabber_id_new(xfer->who); - - /* TODO: Deal with zeroconf */ - - if(dstjid != NULL && streamhost->host && streamhost->port > 0) { - char *dstaddr, *hash; - jsx->gpi = purple_proxy_info_new(); - purple_proxy_info_set_type(jsx->gpi, PURPLE_PROXY_SOCKS5); - purple_proxy_info_set_host(jsx->gpi, streamhost->host); - purple_proxy_info_set_port(jsx->gpi, streamhost->port); - - /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) - dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, - jsx->js->user->resource, dstjid->node, dstjid->domain, dstjid->resource); - else - dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, dstjid->node, dstjid->domain, dstjid->resource, - jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource); - - /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ - hash = jabber_calculate_data_sha1sum(dstaddr, strlen(dstaddr)); - - jsx->connect_data = purple_proxy_connect_socks5(NULL, jsx->gpi, - hash, 0, - jabber_si_bytestreams_connect_cb, xfer); - g_free(hash); - g_free(dstaddr); - - /* When selecting a streamhost, timeout after STREAMHOST_CONNECT_TIMEOUT seconds, otherwise it takes forever */ - if (xfer->type != PURPLE_XFER_SEND && jsx->connect_data != NULL) - jsx->connect_timeout = purple_timeout_add_seconds( - STREAMHOST_CONNECT_TIMEOUT, connect_timeout_cb, xfer); - - jabber_id_free(dstjid); - } - - if (jsx->connect_data == NULL) - { - jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); - jabber_si_free_streamhost(streamhost, NULL); - jabber_si_bytestreams_attempt_connect(xfer); - } -} - -void jabber_bytestreams_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query) -{ - PurpleXfer *xfer; - JabberSIXfer *jsx; - xmlnode *streamhost; - const char *sid; - - if(type != JABBER_IQ_SET) - return; - - if(!from) - return; - - if(!(sid = xmlnode_get_attrib(query, "sid"))) - return; - - if(!(xfer = jabber_si_xfer_find(js, sid, from))) - return; - - jsx = xfer->data; - - if(!jsx->accepted) - return; - - if(jsx->iq_id) - g_free(jsx->iq_id); - jsx->iq_id = g_strdup(id); - - for(streamhost = xmlnode_get_child(query, "streamhost"); streamhost; - streamhost = xmlnode_get_next_twin(streamhost)) { - const char *jid, *host = NULL, *port, *zeroconf; - int portnum = 0; - - if((jid = xmlnode_get_attrib(streamhost, "jid")) && - ((zeroconf = xmlnode_get_attrib(streamhost, "zeroconf")) || - ((host = xmlnode_get_attrib(streamhost, "host")) && - (port = xmlnode_get_attrib(streamhost, "port")) && - (portnum = atoi(port))))) { - JabberBytestreamsStreamhost *sh = g_new0(JabberBytestreamsStreamhost, 1); - sh->jid = g_strdup(jid); - sh->host = g_strdup(host); - sh->port = portnum; - sh->zeroconf = g_strdup(zeroconf); - /* If there were a lot of these, it'd be worthwhile to prepend and reverse. */ - jsx->streamhosts = g_list_append(jsx->streamhosts, sh); - } - } - - jabber_si_bytestreams_attempt_connect(xfer); -} - - -static void -jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int len; - - len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); - if (len < 0 && errno == EAGAIN) - return; - else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxlen += len; - - if (jsx->rxlen < jsx->rxmaxlen) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - - /* Before actually starting sending the file, we need to wait until the - * recipient sends the IQ result with <streamhost-used/> - */ - purple_debug_info("jabber", "SOCKS5 connection negotiation completed. " - "Waiting for IQ result to start file transfer.\n"); -} - -static void -jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/ - int len; - char *dstaddr, *hash; - const char *host; - - purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_again_cb\n"); - - if(jsx->rxlen < 5) { - purple_debug_info("jabber", "reading the first 5 bytes\n"); - len = read(source, buffer, 5 - jsx->rxlen); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - return; - } else if(jsx->rxqueue[0] != 0x05 || jsx->rxqueue[1] != 0x01 || - jsx->rxqueue[3] != 0x03 || jsx->rxqueue[4] != 40) { - purple_debug_info("jabber", "Invalid socks5 conn req. header[0x%x,0x%x,0x%x,0x%x,0x%x]\n", - jsx->rxqueue[0], jsx->rxqueue[1], jsx->rxqueue[2], - jsx->rxqueue[3], jsx->rxqueue[4]); - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) { - /* Upper-bound of 257 (jsx->rxlen = 5, jsx->rxqueue[4] = 0xFF) */ - unsigned short to_read = jsx->rxqueue[4] + 2 - (jsx->rxlen - 5); - purple_debug_info("jabber", "reading %u bytes for DST.ADDR + port num (trying to read %hu now)\n", - jsx->rxqueue[4] + 2, to_read); - len = read(source, buffer, to_read); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - } - - /* Have we not read all of DST.ADDR and the following 2-byte port number? */ - if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - - dstaddr = g_strdup_printf("%s%s@%s/%s%s", jsx->stream_id, - jsx->js->user->node, jsx->js->user->domain, - jsx->js->user->resource, xfer->who); - - /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ - hash = jabber_calculate_data_sha1sum(dstaddr, strlen(dstaddr)); - - if(strncmp(hash, jsx->rxqueue + 5, 40) || - jsx->rxqueue[45] != 0x00 || jsx->rxqueue[46] != 0x00) { - if (jsx->rxqueue[45] != 0x00 || jsx->rxqueue[46] != 0x00) - purple_debug_error("jabber", "Got SOCKS5 BS conn with the wrong DST.PORT" - " (must be 0 - got[0x%x,0x%x]).\n", - jsx->rxqueue[45], jsx->rxqueue[46]); - else - purple_debug_error("jabber", "Got SOCKS5 BS conn with the wrong DST.ADDR" - " (expected '%s' - got '%.40s').\n", - hash, jsx->rxqueue + 5); - close(source); - purple_xfer_cancel_remote(xfer); - g_free(hash); - g_free(dstaddr); - return; - } - - g_free(hash); - g_free(dstaddr); - - g_free(jsx->rxqueue); - host = purple_network_get_my_ip(jsx->js->fd); - - jsx->rxmaxlen = 5 + strlen(host) + 2; - jsx->rxqueue = g_malloc(jsx->rxmaxlen); - jsx->rxlen = 0; - - jsx->rxqueue[0] = 0x05; - jsx->rxqueue[1] = 0x00; - jsx->rxqueue[2] = 0x00; - jsx->rxqueue[3] = 0x03; - jsx->rxqueue[4] = strlen(host); - memcpy(jsx->rxqueue + 5, host, strlen(host)); - jsx->rxqueue[5+strlen(host)] = 0x00; - jsx->rxqueue[6+strlen(host)] = 0x00; - - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer); - jabber_si_xfer_bytestreams_send_read_again_resp_cb(xfer, source, - PURPLE_INPUT_WRITE); -} - -static void -jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int len; - - len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); - if (len < 0 && errno == EAGAIN) - return; - else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxlen += len; - - if (jsx->rxlen < jsx->rxmaxlen) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - - /* If we sent a "Success", wait for a response, otherwise give up and cancel */ - if (jsx->rxqueue[1] == 0x00) { - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_again_cb, xfer); - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - jsx->rxlen = 0; - } else { - close(source); - purple_xfer_cancel_remote(xfer); - } -} - -static void -jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int i; - int len; - char buffer[256]; - - purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_cb\n"); - - xfer->fd = source; - - /** Try to read the SOCKS5 header */ - if(jsx->rxlen < 2) { - purple_debug_info("jabber", "reading those first two bytes\n"); - len = read(source, buffer, 2 - jsx->rxlen); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - return; - } else if(jsx->rxlen - 2 < jsx->rxqueue[1]) { - /* Has a maximum value of 255 (jsx->rxlen = 2, jsx->rxqueue[1] = 0xFF) */ - unsigned short to_read = jsx->rxqueue[1] - (jsx->rxlen - 2); - purple_debug_info("jabber", "reading %u bytes for auth methods (trying to read %hu now)\n", - jsx->rxqueue[1], to_read); - len = read(source, buffer, to_read); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - } - - /* Have we not read all the auth. method bytes? */ - if(jsx->rxlen -2 < jsx->rxqueue[1]) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - - purple_debug_info("jabber", "checking to make sure we're socks FIVE\n"); - - if(jsx->rxqueue[0] != 0x05) { - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - - purple_debug_info("jabber", "going to test %hhu different methods\n", jsx->rxqueue[1]); - - for(i=0; i<jsx->rxqueue[1]; i++) { - - purple_debug_info("jabber", "testing %hhu\n", jsx->rxqueue[i+2]); - if(jsx->rxqueue[i+2] == 0x00) { - g_free(jsx->rxqueue); - jsx->rxlen = 0; - jsx->rxmaxlen = 2; - jsx->rxqueue = g_malloc(jsx->rxmaxlen); - jsx->rxqueue[0] = 0x05; - jsx->rxqueue[1] = 0x00; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_response_cb, - xfer); - jabber_si_xfer_bytestreams_send_read_response_cb(xfer, - source, PURPLE_INPUT_WRITE); - jsx->rxqueue = NULL; - jsx->rxlen = 0; - return; - } - } - - g_free(jsx->rxqueue); - jsx->rxlen = 0; - jsx->rxmaxlen = 2; - jsx->rxqueue = g_malloc(jsx->rxmaxlen); - jsx->rxqueue[0] = 0x05; - jsx->rxqueue[1] = 0xFF; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_response_cb, xfer); - jabber_si_xfer_bytestreams_send_read_response_cb(xfer, - source, PURPLE_INPUT_WRITE); -} - -static gint -jabber_si_compare_jid(gconstpointer a, gconstpointer b) -{ - const JabberBytestreamsStreamhost *sh = a; - - if(!a) - return -1; - - return strcmp(sh->jid, (char *)b); -} - -static void -jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int acceptfd, flags; - - purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n"); - - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) - return; - else if(acceptfd == -1) { - purple_debug_warning("jabber", "accept: %s\n", g_strerror(errno)); - /* Don't cancel the ft - allow it to fall to the next streamhost.*/ - return; - } - - purple_input_remove(xfer->watcher); - close(source); - jsx->local_streamhost_fd = -1; - - flags = fcntl(acceptfd, F_GETFL); - fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(acceptfd, F_SETFD, FD_CLOEXEC); -#endif - - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_cb, xfer); -} - -static void -jabber_si_connect_proxy_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx; - xmlnode *query, *streamhost_used; - const char *jid; - GList *matched; - - /* TODO: This need to send errors if we don't see what we're looking for */ - - /* Make sure that the xfer is actually still valid and we're not just receiving an old iq response */ - if (!g_list_find(js->file_transfers, xfer)) { - purple_debug_error("jabber", "Got bytestreams response for no longer existing xfer (%p)\n", xfer); - return; - } - - /* In the case of a direct file transfer, this is expected to return */ - if(!xfer->data) - return; - - jsx = xfer->data; - - if(type != JABBER_IQ_RESULT) { - purple_debug_info("jabber", - "jabber_si_xfer_connect_proxy_cb: type = error\n"); - /* if IBB is available, open IBB session */ - purple_debug_info("jabber", - "jabber_si_xfer_connect_proxy_cb: got error, method: %d\n", - jsx->stream_method); - if (jsx->stream_method & STREAM_METHOD_IBB) { - purple_debug_info("jabber", "IBB is possible, try it\n"); - /* if we are the sender and haven't already opened an IBB - session, do so now (we might already have failed to open - the bytestream proxy ourselves when receiving this <iq/> */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND - && !jsx->ibb_session) { - jabber_si_xfer_ibb_send_init(js, xfer); - } else { - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are receiver, just wait for IBB open stanza, callback - is already set up */ - } else { - purple_xfer_cancel_remote(xfer); - } - return; - } - - if (!from) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - if(!(streamhost_used = xmlnode_get_child(query, "streamhost-used"))) - return; - - if(!(jid = xmlnode_get_attrib(streamhost_used, "jid"))) - return; - - purple_debug_info("jabber", "jabber_si_connect_proxy_cb() will be looking at jsx %p: jsx->streamhosts is %p and jid is %s\n", - jsx, jsx->streamhosts, jid); - - if(!(matched = g_list_find_custom(jsx->streamhosts, jid, jabber_si_compare_jid))) - { - gchar *my_jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, - jsx->js->user->domain, jsx->js->user->resource); - if (!strcmp(jid, my_jid)) { - purple_debug_info("jabber", "Got local SOCKS5 streamhost-used.\n"); - purple_xfer_start(xfer, xfer->fd, NULL, -1); - } else { - /* if available, try to revert to IBB... */ - if (jsx->stream_method & STREAM_METHOD_IBB) { - purple_debug_info("jabber", - "jabber_si_connect_proxy_cb: trying to revert to IBB\n"); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - jabber_si_xfer_ibb_send_init(jsx->js, xfer); - } else { - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are the receiver, we are already set up...*/ - } else { - purple_debug_info("jabber", - "streamhost-used does not match any proxy that was offered to target\n"); - purple_xfer_cancel_local(xfer); - } - } - g_free(my_jid); - return; - } - - /* Clean up the local streamhost - it isn't going to be used.*/ - if (xfer->watcher > 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - if (jsx->local_streamhost_fd >= 0) { - close(jsx->local_streamhost_fd); - jsx->local_streamhost_fd = -1; - } - - jsx->streamhosts = g_list_remove_link(jsx->streamhosts, matched); - g_list_foreach(jsx->streamhosts, jabber_si_free_streamhost, NULL); - g_list_free(jsx->streamhosts); - - jsx->streamhosts = matched; - - jabber_si_bytestreams_attempt_connect(xfer); -} - -static void -jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx; - JabberIq *iq; - xmlnode *query, *streamhost; - char port[6]; - GList *tmp; - JabberBytestreamsStreamhost *sh, *sh2; - int streamhost_count = 0; - - jsx = xfer->data; - jsx->listen_data = NULL; - - /* I'm not sure under which conditions this can happen - * (it seems like it shouldn't be possible */ - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) { - purple_xfer_unref(xfer); - return; - } - - purple_xfer_unref(xfer); - - iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_set_attrib(query, "sid", jsx->stream_id); - - /* If we successfully started listening locally */ - if (sock >= 0) { - gchar *jid; - const char *local_ip, *public_ip; - - jsx->local_streamhost_fd = sock; - - jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, - jsx->js->user->domain, jsx->js->user->resource); - xfer->local_port = purple_network_get_port_from_fd(sock); - g_snprintf(port, sizeof(port), "%hu", xfer->local_port); - - /* Include the localhost's IP (for in-network transfers) */ - local_ip = purple_network_get_local_system_ip(jsx->js->fd); - if (strcmp(local_ip, "0.0.0.0") != 0) { - streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", jid); - xmlnode_set_attrib(streamhost, "host", local_ip); - xmlnode_set_attrib(streamhost, "port", port); - } - - /* Include the public IP (assuming that there is a port mapped somehow) */ - public_ip = purple_network_get_my_ip(jsx->js->fd); - if (strcmp(public_ip, local_ip) != 0 && strcmp(public_ip, "0.0.0.0") != 0) { - streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", jid); - xmlnode_set_attrib(streamhost, "host", public_ip); - xmlnode_set_attrib(streamhost, "port", port); - } - - g_free(jid); - - /* The listener for the local proxy */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_connected_cb, xfer); - } - - for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { - sh = tmp->data; - - /* TODO: deal with zeroconf proxies */ - - if (!(sh->jid && sh->host && sh->port > 0)) - continue; - - purple_debug_info("jabber", "jabber_si_xfer_bytestreams_listen_cb() will be looking at jsx %p: jsx->streamhosts %p and sh->jid %p\n", - jsx, jsx->streamhosts, sh->jid); - if(g_list_find_custom(jsx->streamhosts, sh->jid, jabber_si_compare_jid) != NULL) - continue; - - streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", sh->jid); - xmlnode_set_attrib(streamhost, "host", sh->host); - g_snprintf(port, sizeof(port), "%hu", sh->port); - xmlnode_set_attrib(streamhost, "port", port); - - sh2 = g_new0(JabberBytestreamsStreamhost, 1); - sh2->jid = g_strdup(sh->jid); - sh2->host = g_strdup(sh->host); - /*sh2->zeroconf = g_strdup(sh->zeroconf);*/ - sh2->port = sh->port; - - jsx->streamhosts = g_list_prepend(jsx->streamhosts, sh2); - } - - /* We have no way of transferring, cancel the transfer */ - if (streamhost_count == 0) { - jabber_iq_free(iq); - - /* if available, revert to IBB */ - if (jsx->stream_method & STREAM_METHOD_IBB) { - purple_debug_info("jabber", - "jabber_si_xfer_bytestreams_listen_cb: trying to revert to IBB\n"); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - /* if we are the sender, init the IBB session... */ - jabber_si_xfer_ibb_send_init(jsx->js, xfer); - } else { - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are the receiver, we should just wait... the IBB open - handler has already been set up... */ - } else { - /* We should probably notify the target, - but this really shouldn't ever happen */ - purple_xfer_cancel_local(xfer); - } - - return; - } - - jabber_iq_set_callback(iq, jabber_si_connect_proxy_cb, xfer); - - jabber_iq_send(iq); - -} - -static void -jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) -{ - JabberSIXfer *jsx; - - purple_xfer_ref(xfer); - - jsx = xfer->data; - - /* TODO: Should there be an option to not use the local host as a ft proxy? - * (to prevent revealing IP address, etc.) */ - jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, - jabber_si_xfer_bytestreams_listen_cb, xfer); - if (jsx->listen_data == NULL) { - /* We couldn't open a local port. Perhaps we can use a proxy. */ - jabber_si_xfer_bytestreams_listen_cb(-1, xfer); - } - -} - -static void -jabber_si_xfer_ibb_error_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberStream *js = jabber_ibb_session_get_js(sess); - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - purple_debug_error("jabber", "an error occurred during IBB file transfer\n"); - purple_xfer_error(purple_xfer_get_type(xfer), account, - jabber_ibb_session_get_who(sess), - _("An error occurred on the in-band bytestream transfer\n")); - purple_xfer_cancel_remote(xfer); -} - -static void -jabber_si_xfer_ibb_closed_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberStream *js = jabber_ibb_session_get_js(sess); - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - purple_debug_info("jabber", "the remote user closed the transfer\n"); - if (purple_xfer_get_bytes_remaining(xfer) > 0) { - purple_xfer_error(purple_xfer_get_type(xfer), account, - jabber_ibb_session_get_who(sess), _("Transfer was closed.")); - purple_xfer_cancel_remote(xfer); - } else { - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - } -} - -static void -jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, - gsize size) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - if (size <= purple_xfer_get_bytes_remaining(xfer)) { - purple_debug_info("jabber", "about to write %" G_GSIZE_FORMAT " bytes from IBB stream\n", - size); - purple_circ_buffer_append(jsx->ibb_buffer, data, size); - purple_xfer_prpl_ready(xfer); - } else { - /* trying to write past size of file transfers negotiated size, - reject transfer to protect against malicious behaviour */ - purple_debug_error("jabber", - "IBB file transfer send more data than expected\n"); - purple_xfer_cancel_remote(xfer); - } - -} - -static gssize -jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - guchar *buffer; - gsize size; - gsize tmp; - - size = jsx->ibb_buffer->bufused; - *out_buffer = buffer = g_malloc(size); - while ((tmp = purple_circ_buffer_get_max_read(jsx->ibb_buffer))) { - memcpy(buffer, jsx->ibb_buffer->outptr, tmp); - buffer += tmp; - purple_circ_buffer_mark_read(jsx->ibb_buffer, tmp); - } - - return size; -} - -static gboolean -jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, - xmlnode *open) -{ - const gchar *sid = xmlnode_get_attrib(open, "sid"); - PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who); - if (xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - JabberIBBSession *sess = - jabber_ibb_session_create_from_xmlnode(js, who, id, open, xfer); - - jabber_si_bytestreams_ibb_timeout_remove(jsx); - - if (sess) { - /* setup callbacks here...*/ - jabber_ibb_session_set_data_received_callback(sess, - jabber_si_xfer_ibb_recv_data_cb); - jabber_ibb_session_set_closed_callback(sess, - jabber_si_xfer_ibb_closed_cb); - jabber_ibb_session_set_error_callback(sess, - jabber_si_xfer_ibb_error_cb); - - jsx->ibb_session = sess; - jsx->ibb_buffer = - purple_circ_buffer_new(jabber_ibb_session_get_block_size(sess)); - - /* set up read function */ - purple_xfer_set_read_fnc(xfer, jabber_si_xfer_ibb_read); - - /* start the transfer */ - purple_xfer_start(xfer, -1, NULL, 0); - return TRUE; - } else { - /* failed to create IBB session */ - purple_debug_error("jabber", "failed to create IBB session\n"); - purple_xfer_cancel_remote(xfer); - return FALSE; - } - } else { - /* we got an IBB <open/> for an unknown file transfer, pass along... */ - purple_debug_info("jabber", - "IBB open did not match any SI file transfer\n"); - return FALSE; - } -} - -static gssize -jabber_si_xfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - JabberIBBSession *sess = jsx->ibb_session; - gsize packet_size = len < jabber_ibb_session_get_block_size(sess) ? - len : jabber_ibb_session_get_block_size(sess); - - jabber_ibb_session_send_data(sess, buffer, packet_size); - - return packet_size; -} - -static void -jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - gsize remaining = purple_xfer_get_bytes_remaining(xfer); - - if (remaining == 0) { - /* close the session */ - jabber_ibb_session_close(sess); - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - } else { - /* send more... */ - purple_xfer_prpl_ready(xfer); - } -} - -static void -jabber_si_xfer_ibb_opened_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberStream *js = jabber_ibb_session_get_js(sess); - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_OPENED) { - purple_xfer_start(xfer, -1, NULL, 0); - purple_xfer_prpl_ready(xfer); - } else { - /* error */ - purple_xfer_error(purple_xfer_get_type(xfer), account, - jabber_ibb_session_get_who(sess), - _("Failed to open in-band bytestream")); - purple_xfer_end(xfer); - } -} - -static void -jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - jsx->ibb_session = jabber_ibb_session_create(js, jsx->stream_id, - purple_xfer_get_remote_user(xfer), xfer); - - if (jsx->ibb_session) { - /* should set callbacks here... */ - jabber_ibb_session_set_opened_callback(jsx->ibb_session, - jabber_si_xfer_ibb_opened_cb); - jabber_ibb_session_set_data_sent_callback(jsx->ibb_session, - jabber_si_xfer_ibb_sent_cb); - jabber_ibb_session_set_closed_callback(jsx->ibb_session, - jabber_si_xfer_ibb_closed_cb); - jabber_ibb_session_set_error_callback(jsx->ibb_session, - jabber_si_xfer_ibb_error_cb); - - purple_xfer_set_write_fnc(xfer, jabber_si_xfer_ibb_write); - - jsx->ibb_buffer = - purple_circ_buffer_new(jabber_ibb_session_get_block_size(jsx->ibb_session)); - - /* open the IBB session */ - jabber_ibb_session_open(jsx->ibb_session); - - } else { - /* failed to create IBB session */ - purple_debug_error("jabber", - "failed to initiate IBB session for file transfer\n"); - purple_xfer_cancel_local(xfer); - } -} - -static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleXfer *xfer = data; - xmlnode *si, *feature, *x, *field, *value; - gboolean found_method = FALSE; - - if(!(si = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { - purple_xfer_cancel_remote(xfer); - return; - } - - if(!(feature = xmlnode_get_child_with_namespace(si, "feature", "http://jabber.org/protocol/feature-neg"))) { - purple_xfer_cancel_remote(xfer); - return; - } - - if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) { - purple_xfer_cancel_remote(xfer); - return; - } - - for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - if(var && !strcmp(var, "stream-method")) { - if((value = xmlnode_get_child(field, "value"))) { - char *val = xmlnode_get_data(value); - if(val && !strcmp(val, NS_BYTESTREAMS)) { - jabber_si_xfer_bytestreams_send_init(xfer); - jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; - found_method = TRUE; - } else if (val && !strcmp(val, NS_IBB)) { - jsx->stream_method |= STREAM_METHOD_IBB; - if (!found_method) { - /* we haven't tried to init a bytestream session, yet - start IBB right away... */ - jabber_si_xfer_ibb_send_init(js, xfer); - found_method = TRUE; - } - } - g_free(val); - } - } - } - - if (!found_method) { - purple_xfer_cancel_remote(xfer); - } - -} - -static void jabber_si_xfer_send_request(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - JabberIq *iq; - xmlnode *si, *file, *feature, *x, *field, *option, *value; - char buf[32]; - - xfer->filename = g_path_get_basename(xfer->local_filename); - - iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", xfer->who); - si = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); - jsx->stream_id = jabber_get_next_id(jsx->js); - xmlnode_set_attrib(si, "id", jsx->stream_id); - xmlnode_set_attrib(si, "profile", - "http://jabber.org/protocol/si/profile/file-transfer"); - - file = xmlnode_new_child(si, "file"); - xmlnode_set_namespace(file, - "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); - xmlnode_set_attrib(file, "size", buf); - /* maybe later we'll do hash and date attribs */ - - feature = xmlnode_new_child(si, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "form"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - xmlnode_set_attrib(field, "type", "list-single"); - /* maybe we should add an option to always skip bytestreams for people - behind troublesome firewalls */ - option = xmlnode_new_child(field, "option"); - value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, NS_BYTESTREAMS, -1); - option = xmlnode_new_child(field, "option"); - value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, NS_IBB, -1); - - jabber_iq_set_callback(iq, jabber_si_xfer_send_method_cb, xfer); - - /* Store the IQ id so that we can cancel the callback */ - g_free(jsx->iq_id); - jsx->iq_id = g_strdup(iq->id); - - jabber_iq_send(iq); -} - -static void jabber_si_xfer_free(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - - if (jsx) { - JabberStream *js = jsx->js; - - js->file_transfers = g_list_remove(js->file_transfers, xfer); - - if (jsx->connect_data != NULL) - purple_proxy_connect_cancel(jsx->connect_data); - if (jsx->listen_data != NULL) - purple_network_listen_cancel(jsx->listen_data); - if (jsx->iq_id != NULL) - jabber_iq_remove_callback_by_id(js, jsx->iq_id); - if (jsx->local_streamhost_fd >= 0) - close(jsx->local_streamhost_fd); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && - xfer->fd >= 0) { - purple_debug_info("jabber", "remove port mapping\n"); - purple_network_remove_port_mapping(xfer->fd); - } - if (jsx->connect_timeout > 0) - purple_timeout_remove(jsx->connect_timeout); - if (jsx->ibb_timeout_handle > 0) - purple_timeout_remove(jsx->ibb_timeout_handle); - - if (jsx->streamhosts) { - g_list_foreach(jsx->streamhosts, jabber_si_free_streamhost, NULL); - g_list_free(jsx->streamhosts); - } - - if (jsx->ibb_session) { - purple_debug_info("jabber", - "jabber_si_xfer_free: destroying IBB session\n"); - jabber_ibb_session_destroy(jsx->ibb_session); - } - - if (jsx->ibb_buffer) { - purple_circ_buffer_destroy(jsx->ibb_buffer); - } - - purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx); - - g_free(jsx->stream_id); - g_free(jsx->iq_id); - /* XXX: free other stuff */ - g_free(jsx->rxqueue); - g_free(jsx); - xfer->data = NULL; - } -} - -/* - * These four functions should only be called from the PurpleXfer functions - * (typically purple_xfer_cancel_(remote|local), purple_xfer_end, or - * purple_xfer_request_denied. - */ -static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - /* if there is an IBB session active, send close on that */ - if (jsx->ibb_session) { - jabber_ibb_session_close(jsx->ibb_session); - } - jabber_si_xfer_free(xfer); - purple_debug_info("jabber", "in jabber_si_xfer_cancel_send\n"); -} - - -static void jabber_si_xfer_request_denied(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - JabberStream *js = jsx->js; - - /* - * TODO: It's probably an error if jsx->iq_id == NULL. g_return_if_fail - * might be warranted. - */ - if (jsx->iq_id && !jsx->accepted) { - JabberIq *iq; - xmlnode *error, *child; - iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jsx->iq_id); - - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - child = xmlnode_new_child(error, "forbidden"); - xmlnode_set_namespace(child, NS_XMPP_STANZAS); - child = xmlnode_new_child(error, "text"); - xmlnode_set_namespace(child, NS_XMPP_STANZAS); - xmlnode_insert_data(child, "Offer Declined", -1); - - jabber_iq_send(iq); - } - - jabber_si_xfer_free(xfer); - purple_debug_info("jabber", "in jabber_si_xfer_request_denied\n"); -} - - -static void jabber_si_xfer_cancel_recv(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - /* if there is an IBB session active, send close */ - if (jsx->ibb_session) { - jabber_ibb_session_close(jsx->ibb_session); - } - jabber_si_xfer_free(xfer); - purple_debug_info("jabber", "in jabber_si_xfer_cancel_recv\n"); -} - - -static void jabber_si_xfer_end(PurpleXfer *xfer) -{ - jabber_si_xfer_free(xfer); -} - - -static void jabber_si_xfer_send_disco_cb(JabberStream *js, const char *who, - JabberCapabilities capabilities, gpointer data) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - if (capabilities & JABBER_CAP_IBB) { - purple_debug_info("jabber", - "jabber_si_xfer_send_disco_cb: remote JID supports IBB\n"); - jsx->stream_method |= STREAM_METHOD_IBB; - } - - if (capabilities & JABBER_CAP_SI_FILE_XFER) { - jabber_si_xfer_send_request(xfer); - } else { - char *msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who); - purple_notify_error(js->gc, _("File Send Failed"), - _("File Send Failed"), msg); - g_free(msg); - purple_xfer_cancel_local(xfer); - } -} - -static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fields) -{ - purple_xfer_cancel_local(xfer); -} - -static void do_transfer_send(PurpleXfer *xfer, const char *resource) -{ - JabberSIXfer *jsx = xfer->data; - char **who_v = g_strsplit(xfer->who, "/", 2); - char *who; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - - jb = jabber_buddy_find(jsx->js, who_v[0], FALSE); - if (jb) { - jbr = jabber_buddy_find_resource(jb, resource); - } - - who = g_strdup_printf("%s/%s", who_v[0], resource); - g_strfreev(who_v); - g_free(xfer->who); - xfer->who = who; - - if (jbr && jbr->caps.info) { - char *msg; - - if (jabber_resource_has_capability(jbr, NS_IBB)) - jsx->stream_method |= STREAM_METHOD_IBB; - if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/si/profile/file-transfer")) { - jabber_si_xfer_send_request(xfer); - return; - } - - msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who); - purple_notify_error(jsx->js->gc, _("File Send Failed"), - _("File Send Failed"), msg); - g_free(msg); - purple_xfer_cancel_local(xfer); - } else { - jabber_disco_info_do(jsx->js, who, - jabber_si_xfer_send_disco_cb, xfer); - } -} - -static void resource_select_ok_cb(PurpleXfer *xfer, PurpleRequestFields *fields) -{ - PurpleRequestField *field = purple_request_fields_get_field(fields, "resource"); - int selected_id = purple_request_field_choice_get_value(field); - GList *labels = purple_request_field_choice_get_labels(field); - - const char *selected_label = g_list_nth_data(labels, selected_id); - - do_transfer_send(xfer, selected_label); -} - -static void jabber_si_xfer_init(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - JabberIq *iq; - if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - char *resource; - - if(NULL != (resource = jabber_get_resource(xfer->who))) { - /* they've specified a resource, no need to ask or - * default or anything, just do it */ - - do_transfer_send(xfer, resource); - g_free(resource); - return; - } - - jb = jabber_buddy_find(jsx->js, xfer->who, TRUE); - - if(!jb || !jb->resources) { - /* no resources online, we're trying to send to someone - * whose presence we're not subscribed to, or - * someone who is offline. Let's inform the user */ - char *msg; - - if(!jb) { - msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), xfer->who); - } else if(jb->subscription & JABBER_SUB_TO) { - msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), xfer->who); - } else { - msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who); - } - - purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg); - g_free(msg); - } else if(!jb->resources->next) { - /* only 1 resource online (probably our most common case) - * so no need to ask who to send to */ - jbr = jb->resources->data; - - do_transfer_send(xfer, jbr->name); - - } else { - /* we've got multiple resources, we need to pick one to send to */ - GList *l; - char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), xfer->who); - PurpleRequestFields *fields = purple_request_fields_new(); - PurpleRequestField *field = purple_request_field_choice_new("resource", _("Resource"), 0); - PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); - - for(l = jb->resources; l; l = l->next) - { - jbr = l->data; - - purple_request_field_choice_add(field, jbr->name); - } - - purple_request_field_group_add_field(group, field); - - purple_request_fields_add_group(fields, group); - - purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, - _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), - jsx->js->gc->account, xfer->who, NULL, xfer); - - g_free(msg); - } - } else { - xmlnode *si, *feature, *x, *field, *value; - - iq = jabber_iq_new(jsx->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); - if(jsx->iq_id) - jabber_iq_set_id(iq, jsx->iq_id); - else - purple_debug_error("jabber", "Sending SI result with new IQ id.\n"); - - jsx->accepted = TRUE; - - si = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); - - feature = xmlnode_new_child(si, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - - /* we should maybe "remember" if bytestreams has failed before (in the - same session) with this JID, and only present IBB as an option to - avoid unnessesary timeout */ - /* maybe we should have an account option to always just try IBB - for people who know their firewalls are very restrictive */ - if (jsx->stream_method & STREAM_METHOD_BYTESTREAMS) { - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, NS_BYTESTREAMS, -1); - } else if(jsx->stream_method & STREAM_METHOD_IBB) { - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, NS_IBB, -1); - } - - jabber_iq_send(iq); - } -} - -PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - - PurpleXfer *xfer; - JabberSIXfer *jsx; - - js = gc->proto_data; - - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - if (xfer) - { - xfer->data = jsx = g_new0(JabberSIXfer, 1); - jsx->js = js; - jsx->local_streamhost_fd = -1; - - jsx->ibb_session = NULL; - - purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init); - purple_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send); - purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end); - - js->file_transfers = g_list_append(js->file_transfers, xfer); - } - - return xfer; -} - -void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file) -{ - JabberStream *js; - - PurpleXfer *xfer; - - js = gc->proto_data; - - xfer = jabber_si_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *si) -{ - JabberSIXfer *jsx; - PurpleXfer *xfer; - xmlnode *file, *feature, *x, *field, *option, *value; - const char *stream_id, *filename, *filesize_c, *profile; - size_t filesize = 0; - - if(!(profile = xmlnode_get_attrib(si, "profile")) || - strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) - return; - - if(!(stream_id = xmlnode_get_attrib(si, "id"))) - return; - - if(!(file = xmlnode_get_child(si, "file"))) - return; - - if(!(filename = xmlnode_get_attrib(file, "name"))) - return; - - if((filesize_c = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_c); - - if(!(feature = xmlnode_get_child(si, "feature"))) - return; - - if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) - return; - - if(!from) - return; - - /* if they've already sent us this file transfer with the same damn id - * then we're gonna ignore it, until I think of something better to do - * with it */ - if((xfer = jabber_si_xfer_find(js, stream_id, from))) - return; - - jsx = g_new0(JabberSIXfer, 1); - jsx->local_streamhost_fd = -1; - - jsx->ibb_session = NULL; - - for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); - if(var && !strcmp(var, "stream-method")) { - for(option = xmlnode_get_child(field, "option"); option; - option = xmlnode_get_next_twin(option)) { - if((value = xmlnode_get_child(option, "value"))) { - char *val; - if((val = xmlnode_get_data(value))) { - if(!strcmp(val, NS_BYTESTREAMS)) { - jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; - } else if(!strcmp(val, NS_IBB)) { - jsx->stream_method |= STREAM_METHOD_IBB; - } - g_free(val); - } - } - } - } - } - - if(jsx->stream_method == STREAM_METHOD_UNKNOWN) { - g_free(jsx); - return; - } - - jsx->js = js; - jsx->stream_id = g_strdup(stream_id); - jsx->iq_id = g_strdup(id); - - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); - g_return_if_fail(xfer != NULL); - - xfer->data = jsx; - - purple_xfer_set_filename(xfer, filename); - if(filesize > 0) - purple_xfer_set_size(xfer, filesize); - - purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, jabber_si_xfer_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer, jabber_si_xfer_cancel_recv); - purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end); - - js->file_transfers = g_list_append(js->file_transfers, xfer); - - purple_xfer_request(xfer); -} - -void -jabber_si_init(void) -{ - jabber_iq_register_handler("si", "http://jabber.org/protocol/si", jabber_si_parse); - - jabber_ibb_register_open_handler(jabber_si_xfer_ibb_open_cb); -} - -void -jabber_si_uninit(void) -{ - jabber_ibb_unregister_open_handler(jabber_si_xfer_ibb_open_cb); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/si.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/** - * @file si.h SI transfer functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_SI_H_ -#define PURPLE_JABBER_SI_H_ - -#include "ft.h" - -#include "jabber.h" - -void jabber_bytestreams_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); -void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *si); -PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who); -void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file); -void jabber_si_init(void); -void jabber_si_uninit(void); - -#endif /* PURPLE_JABBER_SI_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,396 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "useravatar.h" -#include "pep.h" -#include "debug.h" - -#define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) - -static void update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items); - -void jabber_avatar_init(void) -{ - jabber_add_feature(NS_AVATAR_1_1_METADATA, - jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_add_feature(NS_AVATAR_1_1_DATA, - jabber_pep_namespace_only_when_pep_enabled_cb); - - jabber_pep_register_handler(NS_AVATAR_1_1_METADATA, - update_buddy_metadata); -} - -static void -remove_avatar_0_12_nodes(JabberStream *js) -{ -#if 0 - /* See note below for why this is #if 0'd */ - - /* Publish an empty avatar according to the XEP-0084 v0.12 semantics */ - xmlnode *publish, *item, *metadata; - /* publish the metadata */ - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_0_12_METADATA); - - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", "stop"); - - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_0_12_METADATA); - - xmlnode_new_child(metadata, "stop"); - - /* publish */ - jabber_pep_publish(js, publish); -#endif - - /* - * This causes ejabberd 2.0.0 to kill the connection unceremoniously. - * See https://support.process-one.net/browse/EJAB-623. When adiumx.com - * was upgraded, the issue went away. - * - * I think it makes a lot of sense to not have an avatar at the old - * node instead of having something interpreted as "no avatar". When - * a contact with an older client logs in, in the latter situation, - * there's a race between interpreting the <presence/> vcard-temp:x:update - * avatar (non-empty) and the XEP-0084 v0.12 avatar (empty, so show no - * avatar for the buddy) which leads to unhappy and confused users. - * - * A deluge of frustrating "Read error" bug reports may change my mind - * about this. - * --darkrain42 - */ - jabber_pep_delete_node(js, NS_AVATAR_0_12_METADATA); - jabber_pep_delete_node(js, NS_AVATAR_0_12_DATA); -} - -void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) -{ - xmlnode *publish, *metadata, *item; - - if (!js->pep) - return; - - /* Hmmm, not sure if this is worth the traffic, but meh */ - remove_avatar_0_12_nodes(js); - - if (!img) { - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); - - item = xmlnode_new_child(publish, "item"); - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); - - /* publish */ - jabber_pep_publish(js, publish); - } else { - /* - * TODO: This is pretty gross. The Jabber PRPL really shouldn't - * do voodoo to try to determine the image type, height - * and width. - */ - /* A PNG header, including the IHDR, but nothing else */ - const struct { - guchar signature[8]; /* must be hex 89 50 4E 47 0D 0A 1A 0A */ - struct { - guint32 length; /* must be 0x0d */ - guchar type[4]; /* must be 'I' 'H' 'D' 'R' */ - guint32 width; - guint32 height; - guchar bitdepth; - guchar colortype; - guchar compression; - guchar filter; - guchar interlace; - } ihdr; - } *png = purple_imgstore_get_data(img); /* ATTN: this is in network byte order! */ - - /* check if the data is a valid png file (well, at least to some extent) */ - if(png->signature[0] == 0x89 && - png->signature[1] == 0x50 && - png->signature[2] == 0x4e && - png->signature[3] == 0x47 && - png->signature[4] == 0x0d && - png->signature[5] == 0x0a && - png->signature[6] == 0x1a && - png->signature[7] == 0x0a && - ntohl(png->ihdr.length) == 0x0d && - png->ihdr.type[0] == 'I' && - png->ihdr.type[1] == 'H' && - png->ihdr.type[2] == 'D' && - png->ihdr.type[3] == 'R') { - /* parse PNG header to get the size of the image (yes, this is required) */ - guint32 width = ntohl(png->ihdr.width); - guint32 height = ntohl(png->ihdr.height); - xmlnode *data, *info; - char *lengthstring, *widthstring, *heightstring; - - /* compute the sha1 hash */ - char *hash = jabber_calculate_data_sha1sum(purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - char *base64avatar = purple_base64_encode(purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_DATA); - - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", hash); - - data = xmlnode_new_child(item, "data"); - xmlnode_set_namespace(data, NS_AVATAR_1_1_DATA); - - xmlnode_insert_data(data, base64avatar, -1); - /* publish the avatar itself */ - jabber_pep_publish(js, publish); - - g_free(base64avatar); - - lengthstring = g_strdup_printf("%" G_GSIZE_FORMAT, - purple_imgstore_get_size(img)); - widthstring = g_strdup_printf("%u", width); - heightstring = g_strdup_printf("%u", height); - - /* publish the metadata */ - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); - - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", hash); - - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); - - info = xmlnode_new_child(metadata, "info"); - xmlnode_set_attrib(info, "id", hash); - xmlnode_set_attrib(info, "type", "image/png"); - xmlnode_set_attrib(info, "bytes", lengthstring); - xmlnode_set_attrib(info, "width", widthstring); - xmlnode_set_attrib(info, "height", heightstring); - - jabber_pep_publish(js, publish); - - g_free(lengthstring); - g_free(widthstring); - g_free(heightstring); - g_free(hash); - } else { - purple_debug_error("jabber", "Cannot set PEP avatar to non-PNG data\n"); - } - } -} - -static void -do_got_own_avatar_0_12_cb(JabberStream *js, const char *from, xmlnode *items) -{ - if (items) - /* It wasn't an error (i.e. 'item-not-found') */ - remove_avatar_0_12_nodes(js); -} - -static void -do_got_own_avatar_cb(JabberStream *js, const char *from, xmlnode *items) -{ - xmlnode *item = NULL, *metadata = NULL, *info = NULL; - PurpleAccount *account = purple_connection_get_account(js->gc); - const char *server_hash = NULL; - - if (items && (item = xmlnode_get_child(items, "item")) && - (metadata = xmlnode_get_child(item, "metadata")) && - (info = xmlnode_get_child(metadata, "info"))) { - server_hash = xmlnode_get_attrib(info, "id"); - } - - /* - * If we have an avatar and the server returned an error/malformed data, - * push our avatar. If the server avatar doesn't match the local one, push - * our avatar. - */ - if ((!items || !metadata) || - !purple_strequal(server_hash, js->initial_avatar_hash)) { - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - jabber_avatar_set(js, img); - purple_imgstore_unref(img); - } -} - -void jabber_avatar_fetch_mine(JabberStream *js) -{ - char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - - if (js->initial_avatar_hash) { - jabber_pep_request_item(js, jid, NS_AVATAR_0_12_METADATA, NULL, - do_got_own_avatar_0_12_cb); - jabber_pep_request_item(js, jid, NS_AVATAR_1_1_METADATA, NULL, - do_got_own_avatar_cb); - } - - g_free(jid); -} - -typedef struct _JabberBuddyAvatarUpdateURLInfo { - JabberStream *js; - char *from; - char *id; -} JabberBuddyAvatarUpdateURLInfo; - -static void -do_buddy_avatar_update_fromurl(PurpleUtilFetchUrlData *url_data, - gpointer user_data, const gchar *url_text, - gsize len, const gchar *error_message) -{ - JabberBuddyAvatarUpdateURLInfo *info = user_data; - gpointer icon_data; - - if(!url_text) { - purple_debug_error("jabber", - "do_buddy_avatar_update_fromurl got error \"%s\"", - error_message); - goto out; - } - - icon_data = g_memdup(url_text, len); - purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, icon_data, len, info->id); - -out: - g_free(info->from); - g_free(info->id); - g_free(info); -} - -static void -do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) -{ - xmlnode *item, *data; - const char *checksum; - char *b64data; - void *img; - size_t size; - if(!items) - return; - - item = xmlnode_get_child(items, "item"); - if(!item) - return; - - data = xmlnode_get_child(item, "data"); - if(!data) - return; - - checksum = xmlnode_get_attrib(item,"id"); - if(!checksum) - return; - - b64data = xmlnode_get_data(data); - if(!b64data) - return; - - img = purple_base64_decode(b64data, &size); - if(!img) { - g_free(b64data); - return; - } - - purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum); - g_free(b64data); -} - -static void -update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items) -{ - PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from); - const char *checksum; - xmlnode *item, *metadata; - if(!buddy) - return; - - if (!items) - return; - - item = xmlnode_get_child(items,"item"); - if (!item) - return; - - metadata = xmlnode_get_child(item, "metadata"); - if(!metadata) - return; - - checksum = purple_buddy_icons_get_checksum_for_user(buddy); - - /* <stop/> was the pre-v1.1 method of publishing an empty avatar */ - if(xmlnode_get_child(metadata, "stop")) { - purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); - } else { - xmlnode *info, *goodinfo = NULL; - gboolean has_children = FALSE; - - /* iterate over all info nodes to get one we can use */ - for(info = metadata->child; info; info = info->next) { - if(info->type == XMLNODE_TYPE_TAG) - has_children = TRUE; - if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { - const char *type = xmlnode_get_attrib(info,"type"); - const char *id = xmlnode_get_attrib(info,"id"); - - if(checksum && id && !strcmp(id, checksum)) { - /* we already have that avatar, so we don't have to do anything */ - goodinfo = NULL; - break; - } - /* We'll only pick the png one for now. It's a very nice image format anyways. */ - if(type && id && !goodinfo && !strcmp(type, "image/png")) - goodinfo = info; - } - } - if(has_children == FALSE) { - purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); - } else if(goodinfo) { - const char *url = xmlnode_get_attrib(goodinfo, "url"); - const char *id = xmlnode_get_attrib(goodinfo,"id"); - - /* the avatar might either be stored in a pep node, or on a HTTP(S) URL */ - if(!url) { - jabber_pep_request_item(js, from, NS_AVATAR_1_1_DATA, id, - do_buddy_avatar_update_data); - } else { - PurpleUtilFetchUrlData *url_data; - JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); - info->js = js; - - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, - MAX_HTTP_BUDDYICON_BYTES, - do_buddy_avatar_update_fromurl, info); - if (url_data) { - info->from = g_strdup(from); - info->id = g_strdup(id); - js->url_datas = g_slist_prepend(js->url_datas, url_data); - } else - g_free(info); - - } - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/useravatar.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _PURPLE_JABBER_USERAVATAR_H_ -#define _PURPLE_JABBER_USERAVATAR_H_ - -#include "jabber.h" -#include "imgstore.h" - -/* Implementation of XEP-0084 */ - -void jabber_avatar_init(void); -void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img); - -void jabber_avatar_fetch_mine(JabberStream *js); - -#endif /* _PURPLE_JABBER_USERAVATAR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "usermood.h" -#include "pep.h" -#include <string.h> -#include "internal.h" -#include "request.h" -#include "debug.h" - -static const char * const moodstrings[] = { - "afraid", - "amazed", - "amorous", - "angry", - "annoyed", - "anxious", - "aroused", - "ashamed", - "bored", - "brave", - "calm", - "cautious", - "cold", - "confident", - "confused", - "contemplative", - "contented", - "cranky", - "crazy", - "creative", - "curious", - "dejected", - "depressed", - "disappointed", - "disgusted", - "dismayed", - "distracted", - "embarrassed", - "envious", - "excited", - "flirtatious", - "frustrated", - "grumpy", - "guilty", - "happy", - "hopeful", - "hot", - "humbled", - "humiliated", - "hungry", - "hurt", - "impressed", - "in_awe", - "in_love", - "indignant", - "interested", - "intoxicated", - "invincible", - "jealous", - "lonely", - "lucky", - "mean", - "moody", - "nervous", - "neutral", - "offended", - "outraged", - "playful", - "proud", - "relaxed", - "relieved", - "remorseful", - "restless", - "sad", - "sarcastic", - "serious", - "shocked", - "shy", - "sick", - "sleepy", - "spontaneous", - "stressed", - "strong", - "surprised", - "thankful", - "thirsty", - "tired", - "weak", - "worried" -}; - -static void -jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) -{ - xmlnode *item; - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - const char *newmood = NULL; - char *moodtext = NULL; - xmlnode *child, *mood; - - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - item = xmlnode_get_child(items, "item"); - - /* ignore the mood of people not on our buddy list */ - if (!buddy || !item) - return; - - mood = xmlnode_get_child_with_namespace(item, "mood", "http://jabber.org/protocol/mood"); - if (!mood) - return; - for (child = mood->child; child; child = child->next) { - if (child->type != XMLNODE_TYPE_TAG) - continue; - - if (g_str_equal("text", child->name) && moodtext == NULL) - moodtext = xmlnode_get_data(child); - else { - int i; - for (i = 0; i < G_N_ELEMENTS(moodstrings); ++i) { - /* verify that the mood is known (valid) */ - if (g_str_equal(child->name, moodstrings[i])) { - newmood = moodstrings[i]; - break; - } - } - } - if (newmood != NULL && moodtext != NULL) - break; - } - if (newmood != NULL) { - PurpleAccount *account; - const char *status_id; - JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL); - if (!resource) { /* huh? */ - g_free(moodtext); - return; - } - status_id = jabber_buddy_state_get_status_id(resource->state); - - account = purple_connection_get_account(js->gc); - purple_prpl_got_user_status(account, from, status_id, "mood", - _(newmood), "moodtext", - moodtext ? moodtext : "", NULL); - } - g_free(moodtext); -} - -void jabber_mood_init(void) { - jabber_add_feature("http://jabber.org/protocol/mood", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/mood", jabber_mood_cb); -} - -static void do_mood_set_from_fields(PurpleConnection *gc, PurpleRequestFields *fields) { - JabberStream *js; - int selected_mood = purple_request_fields_get_choice(fields, "mood"); - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_debug_error("jabber", "Unable to set mood; account offline.\n"); - return; - } - - js = gc->proto_data; - - if (selected_mood < 0 || selected_mood >= G_N_ELEMENTS(moodstrings)) { - purple_debug_error("jabber", "Invalid mood index (%d) selected.\n", selected_mood); - return; - } - - jabber_mood_set(js, moodstrings[selected_mood], purple_request_fields_get_string(fields, "text")); -} - -static void do_mood_set_mood(PurplePluginAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - int i; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_choice_new("mood", - _("Mood"), 0); - - for(i = 0; i < G_N_ELEMENTS(moodstrings); ++i) - purple_request_field_choice_add(field, _(moodstrings[i])); - - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("text", - _("Description"), NULL, - FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(gc, _("Edit User Mood"), - _("Edit User Mood"), - _("Please select your mood from the list."), - fields, - _("Set"), G_CALLBACK(do_mood_set_from_fields), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - -} - -void jabber_mood_init_action(GList **m) { - PurplePluginAction *act = purple_plugin_action_new(_("Set Mood..."), do_mood_set_mood); - *m = g_list_append(*m, act); -} - -void jabber_mood_set(JabberStream *js, const char *mood, const char *text) { - xmlnode *publish, *moodnode; - - g_return_if_fail(mood != NULL); - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); - moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); - xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); - xmlnode_new_child(moodnode, mood); - - if (text && text[0] != '\0') { - xmlnode *textnode = xmlnode_new_child(moodnode, "text"); - xmlnode_insert_data(textnode, text, -1); - } - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usermood.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERMOOD_H_ -#define PURPLE_JABBER_USERMOOD_H_ - -#include "jabber.h" - -/* Implementation of XEP-0107 */ - -void jabber_mood_init(void); - -void jabber_mood_init_action(GList **m); - -void jabber_mood_set(JabberStream *js, - const char *mood, /* must be one of the valid strings defined in the XEP */ - const char *text /* might be NULL */); - -#endif /* PURPLE_JABBER_USERMOOD_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "usernick.h" -#include "pep.h" -#include <string.h> -#include "internal.h" -#include "request.h" -#include "status.h" - -static void jabber_nick_cb(JabberStream *js, const char *from, xmlnode *items) { - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *nick; - char *nickname = NULL; - - /* ignore the nick of people not on our buddy list */ - if (!buddy || !item) - return; - - nick = xmlnode_get_child_with_namespace(item, "nick", "http://jabber.org/protocol/nick"); - if (!nick) - return; - nickname = xmlnode_get_data(nick); - serv_got_alias(js->gc, from, nickname); - g_free(nickname); -} - -static void do_nick_set(JabberStream *js, const char *nick) { - xmlnode *publish, *nicknode; - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/nick"); - nicknode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "nick"); - xmlnode_set_namespace(nicknode, "http://jabber.org/protocol/nick"); - - if(nick && nick[0] != '\0') - xmlnode_insert_data(nicknode, nick, -1); - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} - -static void do_nick_got_own_nick_cb(JabberStream *js, const char *from, xmlnode *items) { - char *oldnickname = NULL; - xmlnode *item = NULL; - - if (items) - item = xmlnode_get_child(items,"item"); - - if(item) { - xmlnode *nick = xmlnode_get_child_with_namespace(item,"nick","http://jabber.org/protocol/nick"); - if(nick) - oldnickname = xmlnode_get_data(nick); - } - - purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."), - _("This information is visible to all contacts on your contact list, so choose something appropriate."), - oldnickname, FALSE, FALSE, NULL, _("Set"), PURPLE_CALLBACK(do_nick_set), _("Cancel"), NULL, - purple_connection_get_account(js->gc), NULL, NULL, js); - g_free(oldnickname); -} - -static void do_nick_set_nick(PurplePluginAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; - char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - - /* since the nickname might have been changed by another resource of this account, we always have to request the old one - from the server to present as the default for the new one */ - jabber_pep_request_item(js, jid, "http://jabber.org/protocol/nick", NULL, do_nick_got_own_nick_cb); - g_free(jid); -} - -void jabber_nick_init(void) { - jabber_add_feature("http://jabber.org/protocol/nick", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/nick", jabber_nick_cb); -} - -void jabber_nick_init_action(GList **m) { - PurplePluginAction *act = purple_plugin_action_new(_("Set Nickname..."), do_nick_set_nick); - *m = g_list_append(*m, act); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usernick.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERNICK_H_ -#define PURPLE_JABBER_USERNICK_H_ - -#include "jabber.h" - -/* Implementation of XEP-0172 */ - -void jabber_nick_init(void); -void jabber_nick_init_action(GList **m); - -#endif /* PURPLE_JABBER_USERNICK_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "usertune.h" -#include "pep.h" -#include <string.h> -#include "internal.h" -#include "request.h" -#include "status.h" - -static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *tuneinfo, *tune; - PurpleJabberTuneInfo tuneinfodata; - JabberBuddyResource *resource; - gboolean valid = FALSE; - - /* ignore the tune of people not on our buddy list */ - if (!buddy || !item) - return; - - tuneinfodata.artist = NULL; - tuneinfodata.title = NULL; - tuneinfodata.album = NULL; - tuneinfodata.track = NULL; - tuneinfodata.time = -1; - tuneinfodata.url = NULL; - - tune = xmlnode_get_child_with_namespace(item, "tune", "http://jabber.org/protocol/tune"); - if (!tune) - return; - resource = jabber_buddy_find_resource(buddy, NULL); - if(!resource) - return; /* huh? */ - for (tuneinfo = tune->child; tuneinfo; tuneinfo = tuneinfo->next) { - if (tuneinfo->type == XMLNODE_TYPE_TAG) { - if (!strcmp(tuneinfo->name, "artist")) { - if (tuneinfodata.artist == NULL) /* only pick the first one */ - tuneinfodata.artist = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "length")) { - if (tuneinfodata.time == -1) { - char *length = xmlnode_get_data(tuneinfo); - if (length) - tuneinfodata.time = strtol(length, NULL, 10); - g_free(length); - if (tuneinfodata.time > 0) - valid = TRUE; - } - } else if (!strcmp(tuneinfo->name, "source")) { - if (tuneinfodata.album == NULL) /* only pick the first one */ - tuneinfodata.album = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "title")) { - if (tuneinfodata.title == NULL) /* only pick the first one */ - tuneinfodata.title = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "track")) { - if (tuneinfodata.track == NULL) /* only pick the first one */ - tuneinfodata.track = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "uri")) { - if (tuneinfodata.url == NULL) /* only pick the first one */ - tuneinfodata.url = xmlnode_get_data(tuneinfo); - valid = TRUE; - } - } - } - - if (valid) { - purple_prpl_got_user_status(js->gc->account, from, "tune", - PURPLE_TUNE_ARTIST, tuneinfodata.artist, - PURPLE_TUNE_TITLE, tuneinfodata.title, - PURPLE_TUNE_ALBUM, tuneinfodata.album, - PURPLE_TUNE_TRACK, tuneinfodata.track, - PURPLE_TUNE_TIME, tuneinfodata.time, - PURPLE_TUNE_URL, tuneinfodata.url, NULL); - } else { - purple_prpl_got_user_status_deactive(js->gc->account, from, "tune"); - } - - g_free(tuneinfodata.artist); - g_free(tuneinfodata.title); - g_free(tuneinfodata.album); - g_free(tuneinfodata.track); - g_free(tuneinfodata.url); -} - -void jabber_tune_init(void) { - jabber_add_feature("http://jabber.org/protocol/tune", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/tune", jabber_tune_cb); -} - -void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) { - xmlnode *publish, *tunenode; - JabberStream *js = gc->proto_data; - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); - tunenode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "tune"); - xmlnode_set_namespace(tunenode, "http://jabber.org/protocol/tune"); - - if(tuneinfo) { - if(tuneinfo->artist && tuneinfo->artist[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "artist"),tuneinfo->artist,-1); - if(tuneinfo->title && tuneinfo->title[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "title"),tuneinfo->title,-1); - if(tuneinfo->album && tuneinfo->album[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "source"),tuneinfo->album,-1); - if(tuneinfo->url && tuneinfo->url[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1); - if(tuneinfo->time > 0) { - char *length = g_strdup_printf("%d", tuneinfo->time); - xmlnode_insert_data(xmlnode_new_child(tunenode, "length"),length,-1); - g_free(length); - } - if(tuneinfo->track && tuneinfo->track[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1); - } - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/usertune.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERTUNE_H_ -#define PURPLE_JABBER_USERTUNE_H_ - -#include "jabber.h" - -/* Implementation of XEP-0118 */ - -typedef struct _PurpleJabberTuneInfo PurpleJabberTuneInfo; -struct _PurpleJabberTuneInfo { - char *artist; - char *title; - char *album; - char *track; /* either the index of the track in the album or the URL for a stream */ - int time; /* in seconds, -1 for unknown */ - char *url; -}; - -void jabber_tune_init(void); - -void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo); - -#endif /* PURPLE_JABBER_USERTUNE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/posix.uname.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/posix.uname.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/posix.uname.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/posix.uname.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/* - posix.uname.c - version 1.1 - Copyright (C) 1999, 2000 - Earnie Boyd and assigns - - Fills the utsname structure with the appropriate values. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICUALR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -/* - Send bug reports to Earnie Boyd <earnie_boyd@yahoo.com> - */ - -#include "utsname.h" -#include <string.h> -#include <stdio.h> - -/* ANONYMOUS unions and structs are used from the windows header definitions. - These need to be defined for them to work correctly with gcc2.95.2-mingw. */ -/*#define _ANONYMOUS_STRUCT*/ -/*#define _ANONYMOUS_UNION*/ -#include <windows.h> -#ifdef __MINGW32__ -#include <_mingw.h> -#endif - -int -jabber_win32_uname( struct utsname *uts ) -{ - DWORD sLength; - OSVERSIONINFO OS_version; - SYSTEM_INFO System_Info; - -/* XXX Should these be in the global runtime */ - enum WinOS {Win95, Win98, WinNT, unknown}; - int MingwOS; - - memset( uts, 0, sizeof ( *uts ) ); - OS_version.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); - - GetVersionEx ( &OS_version ); - GetSystemInfo ( &System_Info ); - - strcpy( uts->sysname, "WIN32_" ); - switch( OS_version.dwPlatformId ) - { - case VER_PLATFORM_WIN32_NT: - strcat( uts->sysname, "WinNT" ); - MingwOS = WinNT; - break; - case VER_PLATFORM_WIN32_WINDOWS: - switch ( OS_version.dwMinorVersion ) - { - case 0: - strcat( uts->sysname, "Win95" ); - MingwOS = Win95; - break; - case 10: - strcat( uts->sysname, "Win98" ); - MingwOS = Win98; - break; - default: - strcat( uts->sysname, "Win??" ); - MingwOS = unknown; - break; - } - break; - default: - strcat( uts->sysname, "Win??" ); - MingwOS = unknown; - break; - } - -#ifdef __MINGW32__ - sprintf( uts->version, "%i", __MINGW32_MAJOR_VERSION ); - sprintf( uts->release, "%i", __MINGW32_MINOR_VERSION ); -#endif - - switch( System_Info.wProcessorArchitecture ) - { - case PROCESSOR_ARCHITECTURE_PPC: - strcpy( uts->machine, "ppc" ); - break; - case PROCESSOR_ARCHITECTURE_ALPHA: - strcpy( uts->machine, "alpha" ); - break; - case PROCESSOR_ARCHITECTURE_MIPS: - strcpy( uts->machine, "mips" ); - break; - case PROCESSOR_ARCHITECTURE_INTEL: - /* dwProcessorType is only valid in Win95 and Win98 - wProcessorLevel is only valid in WinNT */ - switch( MingwOS ) - { - case Win95: - case Win98: - switch( System_Info.dwProcessorType ) - { - case PROCESSOR_INTEL_386: - case PROCESSOR_INTEL_486: - case PROCESSOR_INTEL_PENTIUM: - sprintf( uts->machine, "i%ld", System_Info.dwProcessorType ); - break; - default: - strcpy( uts->machine, "i386" ); - break; - } - break; - case WinNT: - sprintf( uts->machine, "i%d86", System_Info.wProcessorLevel ); - break; - default: - strcpy( uts->machine, "unknown" ); - break; - } - break; - default: - strcpy( uts->machine, "unknown" ); - break; - } - - sLength = sizeof ( uts->nodename ) - 1; - GetComputerNameA( uts->nodename, &sLength ); - return 1; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/utsname.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/utsname.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/utsname.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/win32/utsname.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct utsname -{ - char sysname[20]; - char nodename[20]; - char release[20]; - char version[20]; - char machine[20]; -}; - -int jabber_win32_uname (struct utsname *); -#define uname(utsname) jabber_win32_uname(utsname) - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,414 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "request.h" -#include "server.h" - -#include "xdata.h" - -typedef enum { - JABBER_X_DATA_IGNORE = 0, - JABBER_X_DATA_TEXT_SINGLE, - JABBER_X_DATA_TEXT_MULTI, - JABBER_X_DATA_LIST_SINGLE, - JABBER_X_DATA_LIST_MULTI, - JABBER_X_DATA_BOOLEAN, - JABBER_X_DATA_JID_SINGLE -} jabber_x_data_field_type; - -struct jabber_x_data_data { - GHashTable *fields; - GSList *values; - jabber_x_data_action_cb cb; - gpointer user_data; - JabberStream *js; - GList *actions; - PurpleRequestFieldGroup *actiongroup; -}; - -static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFields *fields) { - xmlnode *result = xmlnode_new("x"); - jabber_x_data_action_cb cb = data->cb; - gpointer user_data = data->user_data; - JabberStream *js = data->js; - GList *groups, *flds; - char *actionhandle = NULL; - gboolean hasActions = (data->actions != NULL); - - xmlnode_set_namespace(result, "jabber:x:data"); - xmlnode_set_attrib(result, "type", "submit"); - - for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { - if(groups->data == data->actiongroup) { - for(flds = purple_request_field_group_get_fields(groups->data); flds; flds = flds->next) { - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - int handleindex; - if(strcmp(id, "libpurple:jabber:xdata:actions")) - continue; - handleindex = purple_request_field_choice_get_value(field); - actionhandle = g_strdup(g_list_nth_data(data->actions, handleindex)); - break; - } - continue; - } - for(flds = purple_request_field_group_get_fields(groups->data); flds; flds = flds->next) { - xmlnode *fieldnode, *valuenode; - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - jabber_x_data_field_type type = GPOINTER_TO_INT(g_hash_table_lookup(data->fields, id)); - - switch(type) { - case JABBER_X_DATA_TEXT_SINGLE: - case JABBER_X_DATA_JID_SINGLE: - { - const char *value = purple_request_field_string_get_value(field); - if (value == NULL) - break; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - valuenode = xmlnode_new_child(fieldnode, "value"); - if(value) - xmlnode_insert_data(valuenode, value, -1); - break; - } - case JABBER_X_DATA_TEXT_MULTI: - { - char **pieces, **p; - const char *value = purple_request_field_string_get_value(field); - if (value == NULL) - break; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - - pieces = g_strsplit(value, "\n", -1); - for(p = pieces; *p != NULL; p++) { - valuenode = xmlnode_new_child(fieldnode, "value"); - xmlnode_insert_data(valuenode, *p, -1); - } - g_strfreev(pieces); - } - break; - case JABBER_X_DATA_LIST_SINGLE: - case JABBER_X_DATA_LIST_MULTI: - { - GList *selected = purple_request_field_list_get_selected(field); - char *value; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - - while(selected) { - value = purple_request_field_list_get_data(field, selected->data); - valuenode = xmlnode_new_child(fieldnode, "value"); - if(value) - xmlnode_insert_data(valuenode, value, -1); - selected = selected->next; - } - } - break; - case JABBER_X_DATA_BOOLEAN: - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - valuenode = xmlnode_new_child(fieldnode, "value"); - if(purple_request_field_bool_get_value(field)) - xmlnode_insert_data(valuenode, "1", -1); - else - xmlnode_insert_data(valuenode, "0", -1); - break; - case JABBER_X_DATA_IGNORE: - break; - } - } - } - - g_hash_table_destroy(data->fields); - while(data->values) { - g_free(data->values->data); - data->values = g_slist_delete_link(data->values, data->values); - } - if (data->actions) { - GList *action; - for(action = data->actions; action; action = g_list_next(action)) { - g_free(action->data); - } - g_list_free(data->actions); - } - g_free(data); - - if (hasActions) - cb(js, result, actionhandle, user_data); - else - ((jabber_x_data_cb)cb)(js, result, user_data); - - g_free(actionhandle); -} - -static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, PurpleRequestFields *fields) { - xmlnode *result = xmlnode_new("x"); - jabber_x_data_action_cb cb = data->cb; - gpointer user_data = data->user_data; - JabberStream *js = data->js; - gboolean hasActions = FALSE; - g_hash_table_destroy(data->fields); - while(data->values) { - g_free(data->values->data); - data->values = g_slist_delete_link(data->values, data->values); - } - if (data->actions) { - GList *action; - hasActions = TRUE; - for(action = data->actions; action; action = g_list_next(action)) { - g_free(action->data); - } - g_list_free(data->actions); - } - g_free(data); - - xmlnode_set_namespace(result, "jabber:x:data"); - xmlnode_set_attrib(result, "type", "cancel"); - - if (hasActions) - cb(js, result, NULL, user_data); - else - ((jabber_x_data_cb)cb)(js, result, user_data); -} - -void *jabber_x_data_request(JabberStream *js, xmlnode *packet, jabber_x_data_cb cb, gpointer user_data) -{ - return jabber_x_data_request_with_actions(js, packet, NULL, 0, (jabber_x_data_action_cb)cb, user_data); -} - -void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data) -{ - void *handle; - xmlnode *fn, *x; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field = NULL; - - char *title = NULL; - char *instructions = NULL; - - struct jabber_x_data_data *data = g_new0(struct jabber_x_data_data, 1); - - data->fields = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - data->user_data = user_data; - data->cb = cb; - data->js = js; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - for(fn = xmlnode_get_child(packet, "field"); fn; fn = xmlnode_get_next_twin(fn)) { - xmlnode *valuenode; - const char *type = xmlnode_get_attrib(fn, "type"); - const char *label = xmlnode_get_attrib(fn, "label"); - const char *var = xmlnode_get_attrib(fn, "var"); - char *value = NULL; - - if(!type) - type = "text-single"; - - if(!var && strcmp(type, "fixed")) - continue; - if(!label) - label = var; - - if(!strcmp(type, "text-private")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - field = purple_request_field_string_new(var, label, - value ? value : "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE)); - - g_free(value); - } else if(!strcmp(type, "text-multi") || !strcmp(type, "jid-multi")) { - GString *str = g_string_new(""); - - for(valuenode = xmlnode_get_child(fn, "value"); valuenode; - valuenode = xmlnode_get_next_twin(valuenode)) { - - if(!(value = xmlnode_get_data(valuenode))) - continue; - - g_string_append_printf(str, "%s\n", value); - g_free(value); - } - - field = purple_request_field_string_new(var, label, - str->str, TRUE); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_MULTI)); - - g_string_free(str, TRUE); - } else if(!strcmp(type, "list-single") || !strcmp(type, "list-multi")) { - xmlnode *optnode; - GList *selected = NULL; - - field = purple_request_field_list_new(var, label); - - if(!strcmp(type, "list-multi")) { - purple_request_field_list_set_multi_select(field, TRUE); - g_hash_table_replace(data->fields, g_strdup(var), - GINT_TO_POINTER(JABBER_X_DATA_LIST_MULTI)); - } else { - g_hash_table_replace(data->fields, g_strdup(var), - GINT_TO_POINTER(JABBER_X_DATA_LIST_SINGLE)); - } - - for(valuenode = xmlnode_get_child(fn, "value"); valuenode; - valuenode = xmlnode_get_next_twin(valuenode)) { - char *data = xmlnode_get_data(valuenode); - if (data != NULL) { - selected = g_list_prepend(selected, data); - } - } - - for(optnode = xmlnode_get_child(fn, "option"); optnode; - optnode = xmlnode_get_next_twin(optnode)) { - const char *lbl; - - if(!(valuenode = xmlnode_get_child(optnode, "value"))) - continue; - - if(!(value = xmlnode_get_data(valuenode))) - continue; - - if(!(lbl = xmlnode_get_attrib(optnode, "label"))) - lbl = value; - - data->values = g_slist_prepend(data->values, value); - - purple_request_field_list_add(field, lbl, value); - if(g_list_find_custom(selected, value, (GCompareFunc)strcmp)) - purple_request_field_list_add_selected(field, lbl); - } - purple_request_field_group_add_field(group, field); - - while(selected) { - g_free(selected->data); - selected = g_list_delete_link(selected, selected); - } - - } else if(!strcmp(type, "boolean")) { - gboolean def = FALSE; - - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - if(value && (!g_ascii_strcasecmp(value, "yes") || - !g_ascii_strcasecmp(value, "true") || !g_ascii_strcasecmp(value, "1"))) - def = TRUE; - - field = purple_request_field_bool_new(var, label, def); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_BOOLEAN)); - - g_free(value); - } else if(!strcmp(type, "fixed")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - if(value != NULL) { - field = purple_request_field_label_new("", value); - purple_request_field_group_add_field(group, field); - - g_free(value); - } - } else if(!strcmp(type, "hidden")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - field = purple_request_field_string_new(var, "", value ? value : "", - FALSE); - purple_request_field_set_visible(field, FALSE); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE)); - - g_free(value); - } else { /* text-single, jid-single, and the default */ - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - field = purple_request_field_string_new(var, label, - value ? value : "", FALSE); - purple_request_field_group_add_field(group, field); - - if(!strcmp(type, "jid-single")) { - purple_request_field_set_type_hint(field, "screenname"); - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_JID_SINGLE)); - } else { - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE)); - } - - g_free(value); - } - - if(field && xmlnode_get_child(fn, "required")) - purple_request_field_set_required(field,TRUE); - } - - if(actions != NULL) { - PurpleRequestField *actionfield; - GList *action; - data->actiongroup = group = purple_request_field_group_new(_("Actions")); - purple_request_fields_add_group(fields, group); - actionfield = purple_request_field_choice_new("libpurple:jabber:xdata:actions", _("Select an action"), defaultaction); - - for(action = actions; action; action = g_list_next(action)) { - JabberXDataAction *a = action->data; - - purple_request_field_choice_add(actionfield, a->name); - data->actions = g_list_append(data->actions, g_strdup(a->handle)); - } - purple_request_field_set_required(actionfield,TRUE); - purple_request_field_group_add_field(group, actionfield); - } - - if((x = xmlnode_get_child(packet, "title"))) - title = xmlnode_get_data(x); - - if((x = xmlnode_get_child(packet, "instructions"))) - instructions = xmlnode_get_data(x); - - handle = purple_request_fields(js->gc, title, title, instructions, fields, - _("OK"), G_CALLBACK(jabber_x_data_ok_cb), - _("Cancel"), G_CALLBACK(jabber_x_data_cancel_cb), - purple_connection_get_account(js->gc), /* XXX Do we have a who here? */ NULL, NULL, - data); - - g_free(title); - g_free(instructions); - - return handle; -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/jabber/xdata.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/** - * @file xdata.h utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_XDATA_H_ -#define PURPLE_JABBER_XDATA_H_ - -#include "jabber.h" -#include "xmlnode.h" - -typedef struct _JabberXDataAction { - char *name; - char *handle; -} JabberXDataAction; - -typedef void (*jabber_x_data_cb)(JabberStream *js, xmlnode *result, gpointer user_data); -typedef void (*jabber_x_data_action_cb)(JabberStream *js, xmlnode *result, const char *actionhandle, gpointer user_data); -void *jabber_x_data_request(JabberStream *js, xmlnode *packet, jabber_x_data_cb cb, gpointer user_data); -void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data); - -#endif /* PURPLE_JABBER_XDATA_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -EXTRA_DIST = Makefile.mingw - -DIST_SUBDIRS = bonjour gg irc jabber msn msnp9 myspace mxit novell null oscar qq sametime silc silc10 simple yahoo zephyr - -SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,713 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = Makefile.mingw -DIST_SUBDIRS = bonjour gg irc jabber msn msnp9 myspace mxit novell null oscar qq sametime silc silc10 simple yahoo zephyr -SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-libtool \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -# Makefile.mingw -# -# Author: hermanator12002@yahoo.com -# Date 9/11/02 -# Description: Protocols Makefile for win32 (mingw) port of libpurple -# - -PIDGIN_TREE_TOP := ../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -SUBDIRS = gg irc jabber msn mxit novell null oscar qq sametime silc simple yahoo bonjour myspace - -.PHONY: all install clean - -all: - for subdir in $(SUBDIRS); do \ - $(MAKE) -C $$subdir -f $(MINGW_MAKEFILE) || exit 1; \ - done; - -install: all - for subdir in $(SUBDIRS); do \ - $(MAKE) -C $$subdir -f $(MINGW_MAKEFILE) install || exit 1; \ - done; - -clean: - for subdir in $(SUBDIRS); do \ - $(MAKE) -C $$subdir -f $(MINGW_MAKEFILE) clean || exit 1; \ - done; - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,384 +0,0 @@ -/** - * @file cmdproc.c MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "cmdproc.h" - -MsnCmdProc * -msn_cmdproc_new(MsnSession *session) -{ - MsnCmdProc *cmdproc; - - cmdproc = g_new0(MsnCmdProc, 1); - - cmdproc->session = session; - cmdproc->txqueue = g_queue_new(); - cmdproc->history = msn_history_new(); - - cmdproc->multiparts = g_hash_table_new_full(g_str_hash, g_str_equal, - NULL, (GDestroyNotify)msn_message_unref); - - return cmdproc; -} - -void -msn_cmdproc_destroy(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(cmdproc->txqueue); - - msn_history_destroy(cmdproc->history); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - g_hash_table_destroy(cmdproc->multiparts); - - g_free(cmdproc); -} - -void -msn_cmdproc_process_queue(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - g_queue_push_tail(cmdproc->txqueue, trans); -} - -static void -show_debug_cmd(MsnCmdProc *cmdproc, gboolean incoming, const char *command) -{ - MsnServConn *servconn; - const char *names[] = { "NS", "SB" }; - char *show; - char tmp; - size_t len; - - servconn = cmdproc->servconn; - len = strlen(command); - show = g_strdup(command); - - tmp = (incoming) ? 'S' : 'C'; - - if ((show[len - 1] == '\n') && (show[len - 2] == '\r')) - { - show[len - 2] = '\0'; - } - - purple_debug_misc("msn", "%c: %s %03d: %s\n", tmp, - names[servconn->type], servconn->num, show); - - g_free(show); -} - -void -msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnServConn *servconn; - char *data; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) { - /* TODO: Need to free trans */ - return; - } - - msn_history_add(cmdproc->history, trans); - - data = msn_transaction_to_string(trans); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - if (trans->callbacks == NULL) - trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds, - trans->command); - - if (trans->payload != NULL) - { - data = g_realloc(data, len + trans->payload_len); - memcpy(data + len, trans->payload, trans->payload_len); - len += trans->payload_len; - - /* - * We're done with trans->payload. Free it so that the memory - * doesn't sit around in cmdproc->history. - */ - g_free(trans->payload); - trans->payload = NULL; - trans->payload_len = 0; - } - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnServConn *servconn; - char *data; - char *params = NULL; - va_list arg; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - if (format != NULL) - { - va_start(arg, format); - params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - if (params != NULL) - data = g_strdup_printf("%s %s\r\n", command, params); - else - data = g_strdup_printf("%s\r\n", command); - - g_free(params); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - if (!cmdproc->servconn->connected) - return; - - trans = g_new0(MsnTransaction, 1); - - trans->cmdproc = cmdproc; - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload, - int payload_len) -{ - MsnCommand *last; - - g_return_if_fail(cmdproc != NULL); - - last = cmdproc->last_cmd; - last->payload = g_memdup(payload, payload_len); - last->payload_len = payload_len; - - if (last->payload_cb != NULL) - last->payload_cb(cmdproc, last, payload, payload_len); -} - -void -msn_cmdproc_process_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnMsgTypeCb cb; - const char *messageId = NULL; - - /* Multi-part messages */ - if ((messageId = msn_message_get_attr(msg, "Message-ID")) != NULL) { - const char *chunk_text = msn_message_get_attr(msg, "Chunks"); - guint chunk; - if (chunk_text != NULL) { - chunk = strtol(chunk_text, NULL, 10); - /* 1024 chunks of ~1300 bytes is ~1MB, which seems OK to prevent - some random client causing pidgin to hog a ton of memory. - Probably should figure out the maximum that the official client - actually supports, though. */ - if (chunk > 0 && chunk < 1024) { - msg->total_chunks = chunk; - msg->received_chunks = 1; - g_hash_table_insert(cmdproc->multiparts, (gpointer)messageId, msn_message_ref(msg)); - purple_debug_info("msn", "Received chunked message, messageId: '%s', total chunks: %d\n", - messageId, chunk); - } else { - purple_debug_error("msn", "MessageId '%s' has too many chunks: %d\n", messageId, chunk); - } - return; - } else { - chunk_text = msn_message_get_attr(msg, "Chunk"); - if (chunk_text != NULL) { - MsnMessage *first = g_hash_table_lookup(cmdproc->multiparts, messageId); - chunk = strtol(chunk_text, NULL, 10); - if (first == NULL) { - purple_debug_error("msn", - "Unable to find first chunk of messageId '%s' to correspond with chunk %d.\n", - messageId, chunk+1); - } else if (first->received_chunks == chunk) { - /* Chunk is from 1 to total-1 (doesn't count first one) */ - purple_debug_info("msn", "Received chunk %d of %d, messageId: '%s'\n", - chunk+1, first->total_chunks, messageId); - first->body = g_realloc(first->body, first->body_len + msg->body_len); - memcpy(first->body + first->body_len, msg->body, msg->body_len); - first->body_len += msg->body_len; - first->received_chunks++; - if (first->received_chunks != first->total_chunks) - return; - else - /* We're done! Send it along... The caller takes care of - freeing the old one. */ - msg = first; - } else { - /* TODO: Can you legitimately receive chunks out of order? */ - g_hash_table_remove(cmdproc->multiparts, messageId); - return; - } - } else { - purple_debug_error("msn", "Received MessageId '%s' with no chunk number!\n", messageId); - } - } - } - - if (msn_message_get_content_type(msg) == NULL) - { - purple_debug_misc("msn", "failed to find message content\n"); - return; - } - - cb = g_hash_table_lookup(cmdproc->cbs_table->msgs, - msn_message_get_content_type(msg)); - - if (cb != NULL) - cb(cmdproc, msg); - else - purple_debug_warning("msn", "Unhandled content-type '%s'\n", - msn_message_get_content_type(msg)); - - if (messageId != NULL) - g_hash_table_remove(cmdproc->multiparts, messageId); -} - -void -msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransCb cb = NULL; - MsnTransaction *trans = NULL; - - if (cmd->trId) - cmd->trans = trans = msn_history_find(cmdproc->history, cmd->trId); - - if (trans != NULL) - if (trans->timer) { - purple_timeout_remove(trans->timer); - trans->timer = 0; - } - - if (g_ascii_isdigit(cmd->command[0]) && trans != NULL) - { - MsnErrorCb error_cb; - int error; - - error = atoi(cmd->command); - - error_cb = trans->error_cb; - if (error_cb == NULL) - error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command); - - if (error_cb != NULL) - error_cb(cmdproc, trans, error); - else - msn_error_handle(cmdproc->session, error); - - return; - } - - cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command); - - if (cb == NULL && trans != NULL && trans->callbacks != NULL) - cb = g_hash_table_lookup(trans->callbacks, cmd->command); - - if (cb == NULL) - cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command); - - if (cb != NULL) - cb(cmdproc, cmd); - else - purple_debug_warning("msn", "Unhandled command '%s'\n", - cmd->command); - - if (trans != NULL && trans->pendent_cmd != NULL) - msn_transaction_unqueue_cmd(trans, cmdproc); -} - -void -msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command) -{ - show_debug_cmd(cmdproc, TRUE, command); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - cmdproc->last_cmd = msn_command_from_string(command); - - msn_cmdproc_process_cmd(cmdproc, cmdproc->last_cmd); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/cmdproc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/** - * @file cmdproc.h MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_CMDPROC_H_ -#define _MSN_CMDPROC_H_ - -typedef struct _MsnCmdProc MsnCmdProc; - -#include "session.h" -#include "servconn.h" -#include "error.h" -#include "command.h" -#include "table.h" -#include "history.h" - -struct _MsnCmdProc -{ - MsnSession *session; - MsnServConn *servconn; - - GQueue *txqueue; - - MsnCommand *last_cmd; - - MsnTable *cbs_table; - - MsnHistory *history; - - GHashTable *multiparts; /**< Multi-part message ID's */ - - void *data; /**< Extra data, like the switchboard. */ -}; - -MsnCmdProc *msn_cmdproc_new(MsnSession *session); -void msn_cmdproc_destroy(MsnCmdProc *cmdproc); - -void msn_cmdproc_process_queue(MsnCmdProc *cmdproc); - -void msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); -void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, - MsnTransaction *trans); -void msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); -void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); - -void msn_cmdproc_process_msg(MsnCmdProc *cmdproc, - MsnMessage *msg); -void msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd); -void msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command); -void msn_cmdproc_process_payload(MsnCmdProc *cmdproc, - char *payload, int payload_len); - -#endif /* _MSN_CMDPROC_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -/** - * @file command.c MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "command.h" - -static gboolean -is_num(const char *str) -{ - const char *c; - for (c = str; *c; c++) { - if (!(g_ascii_isdigit(*c))) - return FALSE; - } - - return TRUE; -} - -MsnCommand * -msn_command_from_string(const char *string) -{ - MsnCommand *cmd; - char *param_start; - - g_return_val_if_fail(string != NULL, NULL); - - cmd = g_new0(MsnCommand, 1); - cmd->command = g_strdup(string); - param_start = strchr(cmd->command, ' '); - - if (param_start) - { - *param_start++ = '\0'; - cmd->params = g_strsplit_set(param_start, " ", 0); - } - - if (cmd->params != NULL) - { - int c; - - for (c = 0; cmd->params[c] && cmd->params[c][0]; c++); - cmd->param_count = c; - - if (cmd->param_count) { - char *param = cmd->params[0]; - cmd->trId = is_num(param) ? atoi(param) : 0; - } else { - cmd->trId = 0; - } - } - else - { - cmd->trId = 0; - } - - msn_command_ref(cmd); - - return cmd; -} - -void -msn_command_destroy(MsnCommand *cmd) -{ - g_return_if_fail(cmd != NULL); - - if (cmd->ref_count > 0) - { - msn_command_unref(cmd); - return; - } - - if (cmd->payload != NULL) - g_free(cmd->payload); - - g_free(cmd->command); - g_strfreev(cmd->params); - g_free(cmd); -} - -MsnCommand * -msn_command_ref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - - cmd->ref_count++; - return cmd; -} - -MsnCommand * -msn_command_unref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - g_return_val_if_fail(cmd->ref_count > 0, NULL); - - cmd->ref_count--; - - if (cmd->ref_count == 0) - { - msn_command_destroy(cmd); - return NULL; - } - - return cmd; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/command.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/** - * @file command.h MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_COMMAND_H -#define _MSN_COMMAND_H - -typedef struct _MsnCommand MsnCommand; - -#include "cmdproc.h" -#include "transaction.h" - -typedef void (*MsnPayloadCb)(MsnCmdProc *cmdproc, MsnCommand *cmd, - char *payload, size_t len); - -/** - * A received command. - */ -struct _MsnCommand -{ - unsigned int trId; - - char *command; - char **params; - int param_count; - - int ref_count; - - MsnTransaction *trans; - - char *payload; - size_t payload_len; - - MsnPayloadCb payload_cb; - void *payload_cbdata; -}; - -MsnCommand *msn_command_from_string(const char *string); -void msn_command_destroy(MsnCommand *cmd); -MsnCommand *msn_command_ref(MsnCommand *cmd); -MsnCommand *msn_command_unref(MsnCommand *cmd); - -#endif /* _MSN_COMMAND_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1911 +0,0 @@ -/** - * @file contact.c - * get MSN contacts via SOAP request - * created by MaYuan<mayuan2006@gmail.com> - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "msn.h" -#include "contact.h" -#include "xmlnode.h" -#include "group.h" -#include "soap.h" -#include "nexus.h" - -const char *MsnSoapPartnerScenarioText[] = -{ - "Initial", - "ContactSave", - "MessengerPendingList", - "ContactMsgrAPI", - "BlockUnblock" -}; - -const char *MsnMemberRole[] = -{ - "Forward", - "Allow", - "Block", - "Reverse", - "Pending" -}; - -typedef struct { - MsnSession *session; - MsnSoapPartnerScenario which; -} GetContactListCbData; - -MsnCallbackState * -msn_callback_state_new(MsnSession *session) -{ - MsnCallbackState *state = g_new0(MsnCallbackState, 1); - - state->session = session; - - return state; -} - -MsnCallbackState * -msn_callback_state_dup(MsnCallbackState *state) -{ - MsnCallbackState *new_state = g_new0(MsnCallbackState, 1); - - new_state->session = state->session; - new_state->who = g_strdup(state->who); - new_state->uid = g_strdup(state->uid); - new_state->old_group_name = g_strdup(state->old_group_name); - new_state->new_group_name = g_strdup(state->new_group_name); - new_state->guid = g_strdup(state->guid); - /* The rest should be made new */ - - return new_state; -} - -void -msn_callback_state_free(MsnCallbackState *state) -{ - if (state == NULL) - return; - - g_free(state->who); - g_free(state->uid); - g_free(state->old_group_name); - g_free(state->new_group_name); - g_free(state->guid); - xmlnode_free(state->body); - - g_free(state); -} - -void -msn_callback_state_set_who(MsnCallbackState *state, const gchar *who) -{ - g_return_if_fail(state != NULL); - - g_free(state->who); - state->who = g_strdup(who); -} - -void -msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid) -{ - g_return_if_fail(state != NULL); - - g_free(state->uid); - state->uid = g_strdup(uid); -} - -void -msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name) -{ - g_return_if_fail(state != NULL); - - g_free(state->old_group_name); - state->old_group_name = g_strdup(old_group_name); -} - -void -msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name) -{ - g_return_if_fail(state != NULL); - - g_free(state->new_group_name); - state->new_group_name = g_strdup(new_group_name); -} - -void -msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid) -{ - g_return_if_fail(state != NULL); - - g_free(state->guid); - state->guid = g_strdup(guid); -} - - -void -msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id) -{ - g_return_if_fail(state != NULL); - - state->list_id = list_id; -} - -void -msn_callback_state_set_action(MsnCallbackState *state, MsnCallbackAction action) -{ - g_return_if_fail(state != NULL); - - state->action |= action; -} - -/*************************************************************** - * General SOAP handling - ***************************************************************/ - -static const char * -msn_contact_operation_str(MsnCallbackAction action) -{ - /* Make sure this is large enough when adding more */ - static char buf[BUF_LEN]; - buf[0] = '\0'; - - if (action & MSN_ADD_BUDDY) - strcat(buf, "Adding Buddy,"); - if (action & MSN_MOVE_BUDDY) - strcat(buf, "Moving Buddy,"); - if (action & MSN_ACCEPTED_BUDDY) - strcat(buf, "Accepted Buddy,"); - if (action & MSN_DENIED_BUDDY) - strcat(buf, "Denied Buddy,"); - if (action & MSN_ADD_GROUP) - strcat(buf, "Adding Group,"); - if (action & MSN_DEL_GROUP) - strcat(buf, "Deleting Group,"); - if (action & MSN_RENAME_GROUP) - strcat(buf, "Renaming Group,"); - if (action & MSN_UPDATE_INFO) - strcat(buf, "Updating Contact Info,"); - - return buf; -} - -static gboolean msn_contact_request(MsnCallbackState *state); - -static void -msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - xmlnode *fault; - char *faultcode_str; - xmlnode *cachekey; - char *changed; - - if (resp == NULL) { - purple_debug_error("msn", - "Operation {%s} failed. No response received from server.\n", - msn_contact_operation_str(state->action)); - msn_session_set_error(state->session, MSN_ERROR_BAD_BLIST, NULL); - msn_callback_state_free(state); - return; - } - - /* Update CacheKey if necessary */ - cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKeyChanged"); - if (cachekey != NULL) { - changed = xmlnode_get_data(cachekey); - if (changed && !strcmp(changed, "true")) { - cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKey"); - g_free(state->session->abch_cachekey); - state->session->abch_cachekey = xmlnode_get_data(cachekey); - purple_debug_info("msn", "Updated CacheKey for %s to '%s'.\n", - purple_account_get_username(state->session->account), - state->session->abch_cachekey); - } - g_free(changed); - } - - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - - if (fault == NULL) { - /* No errors */ - if (state->cb) - state->cb(req, resp, data); - msn_callback_state_free(state); - return; - } - - faultcode_str = xmlnode_get_data(xmlnode_get_child(fault, "faultcode")); - - if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) { - purple_debug_info("msn", - "Contact Operation {%s} failed because of bad token." - " Updating token now and retrying operation.\n", - msn_contact_operation_str(state->action)); - /* Token has expired, so renew it, and try again later */ - msn_nexus_update_token(state->session->nexus, MSN_AUTH_CONTACTS, - (GSourceFunc)msn_contact_request, data); - } - else - { - if (state->cb) { - state->cb(req, resp, data); - } else { - /* We don't know how to respond to this faultcode, so log it */ - char *str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), str); - g_free(str); - } - msn_callback_state_free(state); - } - - g_free(faultcode_str); -} - -static gboolean -msn_contact_request(MsnCallbackState *state) -{ - xmlnode *cachekey = xmlnode_get_child(state->body, - "Header/ABApplicationHeader/CacheKey"); - if (cachekey != NULL) - xmlnode_free(cachekey); - if (state->session->abch_cachekey != NULL) { - cachekey = xmlnode_new_child(xmlnode_get_child(state->body, "Header/ABApplicationHeader"), "CacheKey"); - xmlnode_insert_data(cachekey, state->session->abch_cachekey, -1); - } - if (state->token == NULL) - state->token = xmlnode_get_child(state->body, - "Header/ABAuthHeader/TicketToken"); - /* delete old & replace with new token */ - xmlnode_free(state->token->child); - xmlnode_insert_data(state->token, - msn_nexus_get_token_str(state->session->nexus, MSN_AUTH_CONTACTS), -1); - msn_soap_message_send(state->session, - msn_soap_message_new(state->post_action, xmlnode_copy(state->body)), - MSN_CONTACT_SERVER, state->post_url, FALSE, - msn_contact_request_cb, state); - return FALSE; -} - -/*************************************************************** - * Address Book and Membership List Operations - ***************************************************************/ - -/*get MSN member role utility*/ -static MsnListId -msn_get_memberrole(const char *role) -{ - g_return_val_if_fail(role != NULL, 0); - - if (!strcmp(role,"Allow")) { - return MSN_LIST_AL; - } else if (!strcmp(role,"Block")) { - return MSN_LIST_BL; - } else if (!strcmp(role,"Reverse")) { - return MSN_LIST_RL; - } else if (!strcmp(role,"Pending")) { - return MSN_LIST_PL; - } - return 0; -} - -/* Create the AddressBook in the server, if we don't have one */ -static void -msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnCallbackState *state = data; - if (resp && xmlnode_get_child(resp->xml, "Body/Fault") == NULL) { - purple_debug_info("msn", "Address Book successfully created!\n"); - msn_get_address_book(state->session, MSN_PS_INITIAL, NULL, NULL); - } else { - purple_debug_info("msn", "Address Book creation failed!\n"); - } -} - -static void -msn_create_address_book(MsnSession *session) -{ - gchar *body; - MsnCallbackState *state; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->user != NULL); - g_return_if_fail(session->user->passport != NULL); - - purple_debug_info("msn", "Creating an Address Book.\n"); - - body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE, - session->user->passport); - - state = msn_callback_state_new(session); - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_ADD_ADDRESSBOOK_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_create_address_cb; - msn_contact_request(state); - - g_free(body); -} - -static void -msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node, - MsnListId list) -{ - char *passport; - char *type; - char *member_id; - MsnUser *user; - xmlnode *annotation, *display; - guint nid = MSN_NETWORK_UNKNOWN; - char *invite = NULL; - char *display_text; - - passport = xmlnode_get_data(xmlnode_get_child(member, node)); - if (!msn_email_is_valid(passport)) { - g_free(passport); - return; - } - - type = xmlnode_get_data(xmlnode_get_child(member, "Type")); - member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId")); - if ((display = xmlnode_get_child(member, "DisplayName"))) { - display_text = xmlnode_get_data(display); - } else { - display_text = NULL; - } - - user = msn_userlist_find_add_user(session->userlist, passport, display_text); - - for (annotation = xmlnode_get_child(member, "Annotations/Annotation"); - annotation; - annotation = xmlnode_get_next_twin(annotation)) { - char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); - char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); - if (name && value) { - if (!strcmp(name, "MSN.IM.BuddyType")) { - nid = strtoul(value, NULL, 10); - } - else if (!strcmp(name, "MSN.IM.InviteMessage")) { - invite = value; - value = NULL; - } - } - g_free(name); - g_free(value); - } - - /* For EmailMembers, the network must be found in the annotations, above. - Otherwise, PassportMembers are on the Passport network. */ - if (!strcmp(node, "PassportName")) - nid = MSN_NETWORK_PASSPORT; - - purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n", - node, passport, type, member_id == NULL ? "(null)" : member_id, nid); - - msn_user_set_network(user, nid); - msn_user_set_invite_message(user, invite); - - if (member_id) { - user->membership_id[list] = atoi(member_id); - } - - msn_got_lst_user(session, user, 1 << list, NULL); - - g_free(passport); - g_free(type); - g_free(member_id); - g_free(invite); - g_free(display_text); -} - -static void -msn_parse_each_service(MsnSession *session, xmlnode *service) -{ - xmlnode *type; - - if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) { - char *type_str = xmlnode_get_data(type); - - if (g_str_equal(type_str, "Profile")) { - /* Process Windows Live 'Messenger Roaming Identity' */ - } else if (g_str_equal(type_str, "Messenger")) { - xmlnode *lastchange = xmlnode_get_child(service, "LastChange"); - char *lastchange_str = xmlnode_get_data(lastchange); - xmlnode *membership; - - purple_debug_info("msn", "CL last change: %s\n", lastchange_str); - purple_account_set_string(session->account, "CLLastChange", - lastchange_str); - - for (membership = xmlnode_get_child(service, - "Memberships/Membership"); - membership; membership = xmlnode_get_next_twin(membership)) { - - xmlnode *role = xmlnode_get_child(membership, "MemberRole"); - char *role_str = xmlnode_get_data(role); - MsnListId list = msn_get_memberrole(role_str); - xmlnode *member; - - purple_debug_info("msn", "CL MemberRole role: %s, list: %d\n", - role_str, list); - - for (member = xmlnode_get_child(membership, "Members/Member"); - member; member = xmlnode_get_next_twin(member)) { - const char *member_type = xmlnode_get_attrib(member, "type"); - if (g_str_equal(member_type, "PassportMember")) { - msn_parse_each_member(session, member, "PassportName", - list); - } else if (g_str_equal(member_type, "PhoneMember")) { - - } else if (g_str_equal(member_type, "EmailMember")) { - msn_parse_each_member(session, member, "Email", list); - } - } - - g_free(role_str); - } - - g_free(lastchange_str); - } - - g_free(type_str); - } -} - -/*parse contact list*/ -static void -msn_parse_contact_list(MsnSession *session, xmlnode *node) -{ - xmlnode *fault, *faultnode; - - /* we may get a response if our cache data is too old: - * - * <faultstring>Need to do full sync. Can't sync deltas Client - * has too old a copy for us to do a delta sync</faultstring> - * - * this is not handled yet - */ - if ((fault = xmlnode_get_child(node, "Body/Fault"))) { - if ((faultnode = xmlnode_get_child(fault, "faultstring"))) { - char *faultstring = xmlnode_get_data(faultnode); - purple_debug_info("msn", "Retrieving contact list failed: %s\n", - faultstring); - g_free(faultstring); - } - if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { - char *errorcode = xmlnode_get_data(faultnode); - - if (g_str_equal(errorcode, "ABDoesNotExist")) { - msn_create_address_book(session); - g_free(errorcode); - return; - } - - g_free(errorcode); - } - - msn_get_contact_list(session, MSN_PS_INITIAL, NULL); - } else { - xmlnode *service; - - for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/" - "FindMembershipResult/Services/Service"); - service; service = xmlnode_get_next_twin(service)) { - msn_parse_each_service(session, service); - } - } -} - -static void -msn_get_contact_list_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - - g_return_if_fail(session != NULL); - - if (resp != NULL) { - const char *abLastChange; - const char *dynamicItemLastChange; - - purple_debug_misc("msn", "Got the contact list!\n"); - - msn_parse_contact_list(session, resp->xml); - abLastChange = purple_account_get_string(session->account, - "ablastChange", NULL); - dynamicItemLastChange = purple_account_get_string(session->account, - "dynamicItemLastChange", NULL); - - if (state->partner_scenario == MSN_PS_INITIAL) { -#ifdef MSN_PARTIAL_LISTS - /* XXX: this should be enabled when we can correctly do partial - syncs with the server. Currently we need to retrieve the whole - list to detect sync issues */ - msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange); -#else - msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL); -#endif - } - } -} - -/*SOAP get contact list*/ -void -msn_get_contact_list(MsnSession *session, - const MsnSoapPartnerScenario partner_scenario, const char *update_time) -{ - gchar *body = NULL; - gchar *update_str = NULL; - MsnCallbackState *state; - const gchar *partner_scenario_str = MsnSoapPartnerScenarioText[partner_scenario]; - - purple_debug_misc("msn", "Getting Contact List.\n"); - - if (update_time != NULL) { - purple_debug_info("msn", "CL Last update time: %s\n", update_time); - update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML, update_time); - } - - body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, - update_str ? update_str : ""); - - state = msn_callback_state_new(session); - state->partner_scenario = partner_scenario; - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GET_CONTACT_SOAP_ACTION; - state->post_url = MSN_GET_CONTACT_POST_URL; - state->cb = msn_get_contact_list_cb; - msn_contact_request(state); - - g_free(update_str); - g_free(body); -} - -static void -msn_parse_addressbook_groups(MsnSession *session, xmlnode *node) -{ - xmlnode *group; - - purple_debug_info("msn", "msn_parse_addressbook_groups()\n"); - - for(group = xmlnode_get_child(node, "Group"); group; - group = xmlnode_get_next_twin(group)){ - xmlnode *groupId, *groupInfo, *groupname; - char *group_id = NULL, *group_name = NULL; - - if ((groupId = xmlnode_get_child(group, "groupId"))) - group_id = xmlnode_get_data(groupId); - if ((groupInfo = xmlnode_get_child(group, "groupInfo")) && (groupname = xmlnode_get_child(groupInfo, "name"))) - group_name = xmlnode_get_data(groupname); - - if (group_id == NULL) { - /* Group of ungroupped buddies */ - g_free(group_name); - continue; - } - - msn_group_new(session->userlist, group_id, group_name); - - purple_debug_info("msn", "AB group_id: %s, name: %s\n", group_id, group_name ? group_name : "(null)"); - if ((purple_find_group(group_name)) == NULL) { - PurpleGroup *g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - } - g_free(group_id); - g_free(group_name); - } -} - -static gboolean -msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number) -{ - xmlnode *phones; - char *mobile_number = NULL; - gboolean mobile = FALSE; - - *inout_mobile_number = NULL; - - if ((phones = xmlnode_get_child(contactInfo, "phones"))) { - xmlnode *contact_phone; - char *phone_type = NULL; - - for (contact_phone = xmlnode_get_child(phones, "ContactPhone"); - contact_phone; - contact_phone = xmlnode_get_next_twin(contact_phone)) { - xmlnode *contact_phone_type; - - if (!(contact_phone_type = - xmlnode_get_child(contact_phone, "contactPhoneType"))) - continue; - - phone_type = xmlnode_get_data(contact_phone_type); - - if (phone_type && !strcmp(phone_type, "ContactPhoneMobile")) { - xmlnode *number; - - if ((number = xmlnode_get_child(contact_phone, "number"))) { - xmlnode *messenger_enabled; - char *is_messenger_enabled = NULL; - - g_free(mobile_number); - mobile_number = xmlnode_get_data(number); - - if (mobile_number && - (messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled")) - && (is_messenger_enabled = xmlnode_get_data(messenger_enabled)) - && !strcmp(is_messenger_enabled, "true")) - mobile = TRUE; - - g_free(is_messenger_enabled); - } - } - - g_free(phone_type); - } - } - - *inout_mobile_number = mobile_number; - return mobile; -} - -static void -msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) -{ - xmlnode *contactNode; - char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL, *mobile_number = NULL, *alias = NULL; - gboolean mobile = FALSE; - PurpleConnection *pc = purple_account_get_connection(session->account); - - for(contactNode = xmlnode_get_child(node, "Contact"); contactNode; - contactNode = xmlnode_get_next_twin(contactNode)) { - xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds; - xmlnode *annotation; - MsnUser *user; - - if (!(contactId = xmlnode_get_child(contactNode,"contactId")) - || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo")) - || !(contactType = xmlnode_get_child(contactInfo, "contactType"))) - continue; - - g_free(passport); - g_free(Name); - g_free(alias); - g_free(uid); - g_free(type); - g_free(mobile_number); - passport = Name = uid = type = mobile_number = alias = NULL; - mobile = FALSE; - - uid = xmlnode_get_data(contactId); - type = xmlnode_get_data(contactType); - - /*setup the Display Name*/ - if (type && !strcmp(type, "Me")) { - if (purple_connection_get_display_name(pc) == NULL) { - char *friendly = NULL; - if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) - friendly = xmlnode_get_data(displayName); - purple_connection_set_display_name(pc, - friendly ? purple_url_decode(friendly) : NULL); - g_free(friendly); - } - continue; /* Not adding own account as buddy to buddylist */ - } - - passportName = xmlnode_get_child(contactInfo, "passportName"); - if (passportName == NULL) { - xmlnode *emailsNode, *contactEmailNode, *emailNode; - xmlnode *messengerEnabledNode; - char *msnEnabled; - - /*TODO: add it to the non-instant Messenger group and recognize as email Membership*/ - /* Yahoo/Federated User? */ - emailsNode = xmlnode_get_child(contactInfo, "emails"); - if (emailsNode == NULL) { - /*TODO: need to support the Mobile type*/ - continue; - } - for (contactEmailNode = xmlnode_get_child(emailsNode, "ContactEmail"); - contactEmailNode; - contactEmailNode = xmlnode_get_next_twin(contactEmailNode)) { - if ((messengerEnabledNode = xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) { - - msnEnabled = xmlnode_get_data(messengerEnabledNode); - - if (msnEnabled && !strcmp(msnEnabled, "true")) { - if ((emailNode = xmlnode_get_child(contactEmailNode, "email"))) - passport = xmlnode_get_data(emailNode); - - /* Messenger enabled, Get the Passport*/ - purple_debug_info("msn", "AB Yahoo/Federated User %s\n", passport ? passport : "(null)"); - g_free(msnEnabled); - break; - } - - g_free(msnEnabled); - } - } - } else { - xmlnode *messenger_user; - /* ignore non-messenger contacts */ - if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) { - char *is_messenger_user = xmlnode_get_data(messenger_user); - - if (is_messenger_user && !strcmp(is_messenger_user, "false")) { - g_free(is_messenger_user); - continue; - } - - g_free(is_messenger_user); - } - - passport = xmlnode_get_data(passportName); - } - - /* Couldn't find anything */ - if (passport == NULL) - continue; - - if (!msn_email_is_valid(passport)) - continue; - - if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) - Name = xmlnode_get_data(displayName); - else - Name = g_strdup(passport); - - for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); - annotation; annotation = xmlnode_get_next_twin(annotation)) { - char *name; - name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); - if (!strcmp(name, "AB.NickName")) - alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); - else if (!strcmp(name, "MSN.IM.HasSharedFolder")) - ; /* Do nothing yet... */ - else if (!strcmp(name, "AB.Spouse")) - ; /* Do nothing yet... */ - else if (!strcmp(name, "MSN.Mobile.ContactId")) - ; /* Do nothing yet... */ - else - purple_debug_info("msn", - "Unknown AB contact annotation: %s\n", name); - g_free(name); - } - - mobile = msn_parse_addressbook_mobile(contactInfo, &mobile_number); - - purple_debug_misc("msn", "AB passport:{%s} uid:{%s} display:{%s} alias: {%s} mobile:{%s} mobile number:{%s}\n", - passport, uid ? uid : "(null)", Name ? Name : "(null)", alias ? alias : "(null)", - mobile ? "true" : "false", mobile_number ? mobile_number : "(null)"); - - user = msn_userlist_find_add_user(session->userlist, passport, Name); - msn_user_set_uid(user, uid); - msn_user_set_mobile_phone(user, mobile_number); - - groupIds = xmlnode_get_child(contactInfo, "groupIds"); - if (groupIds) { - for (guid = xmlnode_get_child(groupIds, "guid"); guid; - guid = xmlnode_get_next_twin(guid)) { - char *group_id = xmlnode_get_data(guid); - msn_user_add_group_id(user, group_id); - purple_debug_misc("msn", "AB guid:%s\n", group_id ? group_id : "(null)"); - g_free(group_id); - } - } else { - purple_debug_info("msn", "User not in any groups, adding to default group.\n"); - /*not in any group,Then set default group*/ - msn_user_add_group_id(user, MSN_INDIVIDUALS_GROUP_ID); - } - - msn_got_lst_user(session, user, MSN_LIST_FL_OP, NULL); - - if (mobile && user) - { - user->mobile = TRUE; - purple_prpl_got_user_status(session->account, user->passport, "mobile", NULL); - purple_prpl_got_user_status(session->account, user->passport, "available", NULL); - } - if (alias) - purple_serv_got_private_alias(pc, passport, alias); - } - - g_free(passport); - g_free(Name); - g_free(uid); - g_free(type); - g_free(mobile_number); -} - -static gboolean -msn_parse_addressbook(MsnSession *session, xmlnode *node) -{ - xmlnode *result; - xmlnode *groups; - xmlnode *contacts; - xmlnode *abNode; - xmlnode *fault; - - if ((fault = xmlnode_get_child(node, "Body/Fault"))) { - xmlnode *faultnode; - - if ((faultnode = xmlnode_get_child(fault, "faultstring"))) { - gchar *faultstring = xmlnode_get_data(faultnode); - purple_debug_info("msn", "AB Faultstring: %s\n", faultstring); - g_free(faultstring); - } - - if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { - gchar *errorcode = xmlnode_get_data(faultnode); - - purple_debug_info("msn", "AB Error Code: %s\n", errorcode); - - if (g_str_equal(errorcode, "ABDoesNotExist")) { - g_free(errorcode); - return TRUE; - } - g_free(errorcode); - } - - return FALSE; - } - - result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult"); - if (result == NULL) { - purple_debug_misc("msn", "Received no address book update\n"); - return TRUE; - } - - /* I don't see this "groups" tag documented on msnpiki, need to find out - if they are really there, and update msnpiki */ - /*Process Group List*/ - groups = xmlnode_get_child(result, "groups"); - if (groups != NULL) { - msn_parse_addressbook_groups(session, groups); - } - - /*add a default No group to set up the no group Membership*/ - msn_group_new(session->userlist, MSN_INDIVIDUALS_GROUP_ID, - MSN_INDIVIDUALS_GROUP_NAME); - purple_debug_misc("msn", "AB group_id:%s name:%s\n", - MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME); - if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){ - PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME); - purple_blist_add_group(g, NULL); - } - - /*add a default No group to set up the no group Membership*/ - msn_group_new(session->userlist, MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); - purple_debug_misc("msn", "AB group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); - if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL) { - PurpleGroup *g = purple_group_new(MSN_NON_IM_GROUP_NAME); - purple_blist_add_group(g, NULL); - } - - /*Process contact List*/ - purple_debug_info("msn", "Process contact list...\n"); - contacts = xmlnode_get_child(result, "contacts"); - if (contacts != NULL) { - msn_parse_addressbook_contacts(session, contacts); - } - - abNode = xmlnode_get_child(result, "ab"); - if (abNode != NULL) { - xmlnode *node2; - char *tmp = NULL; - - if ((node2 = xmlnode_get_child(abNode, "lastChange"))) - tmp = xmlnode_get_data(node2); - purple_debug_info("msn", "AB lastchanged Time:{%s}\n", tmp ? tmp : "(null)"); - purple_account_set_string(session->account, "ablastChange", tmp); - - g_free(tmp); tmp = NULL; - if ((node2 = xmlnode_get_child(abNode, "DynamicItemLastChanged"))) - tmp = xmlnode_get_data(node2); - purple_debug_info("msn", "AB DynamicItemLastChanged :{%s}\n", tmp ? tmp : "(null)"); - purple_account_set_string(session->account, "DynamicItemLastChanged", tmp); - g_free(tmp); - } - - return TRUE; -} - -static void -msn_get_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - - g_return_if_fail(session != NULL); - - purple_debug_misc("msn", "Got the Address Book!\n"); - - if (msn_parse_addressbook(session, resp->xml)) { - msn_send_privacy(session->account->gc); - msn_notification_dump_contact(session); - } else { - /* This is making us loop infinitely when we fail to parse the - address book, disable for now (we should re-enable when we - send timestamps) - */ - /* - msn_get_address_book(session, NULL, NULL); - */ - msn_session_set_error(session, MSN_ERROR_BAD_BLIST, NULL); - } -} - -/*get the address book*/ -void -msn_get_address_book(MsnSession *session, - MsnSoapPartnerScenario partner_scenario, const char *LastChanged, - const char *dynamicItemLastChange) -{ - char *body, *update_str = NULL; - MsnCallbackState *state; - - purple_debug_misc("msn", "Getting Address Book\n"); - - /*build SOAP and POST it*/ - if (dynamicItemLastChange != NULL) - update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, dynamicItemLastChange); - else if (LastChanged != NULL) - update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged); - - body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE, - MsnSoapPartnerScenarioText[partner_scenario], - update_str ? update_str : ""); - - state = msn_callback_state_new(session); - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GET_ADDRESS_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_get_address_cb; - msn_contact_request(state); - - g_free(update_str); - g_free(body); -} - -/*************************************************************** - * Contact Operations - ***************************************************************/ - -static void -msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - - MsnUserList *userlist; - MsnUser *user; - xmlnode *guid; - - xmlnode *fault; - - g_return_if_fail(session != NULL); - userlist = session->userlist; - - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); - if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { - /* Do something special! */ - purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); - - } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) { - PurpleBuddy *buddy = purple_find_buddy(session->account, state->who); - char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who); - purple_notify_error(state->session, _("Buddy Add error"), str, - _("The username specified does not exist.")); - g_free(str); - msn_userlist_rem_buddy(userlist, state->who); - if (buddy != NULL) - purple_blist_remove_buddy(buddy); - - } else { - /* We don't know how to respond to this faultcode, so log it */ - char *fault_str = xmlnode_to_str(fault, NULL); - if (fault_str != NULL) { - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - } - } - return; - } - - purple_debug_info("msn", "Contact added successfully\n"); - - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); - - user = msn_userlist_find_add_user(userlist, state->who, state->who); - msn_user_add_group_id(user, state->guid); - - guid = xmlnode_get_child(resp->xml, - "Body/ABContactAddResponse/ABContactAddResult/guid"); - if (guid != NULL) { - char *uid = xmlnode_get_data(guid); - msn_user_set_uid(user, uid); - purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); - g_free(uid); - } -} - -/* add a Contact in MSN_INDIVIDUALS_GROUP */ -void -msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passport) -{ - MsnUser *user; - gchar *body = NULL; - gchar *contact_xml = NULL; - -#if 0 - gchar *escaped_displayname; - - - if (displayname != NULL) { - escaped_displayname = g_markup_decode_text(displayname, -1); - } else { - escaped_displayname = passport; - } - contact_xml = g_strdup_printf(MSN_XML_ADD_CONTACT, escaped_displayname, passport); -#endif - - purple_debug_info("msn", "Adding contact %s to contact list\n", passport); - - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) { - purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); - return; /* guess this never happened! */ - } - - if (user->networkid != MSN_NETWORK_PASSPORT) { - contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, - user->networkid == MSN_NETWORK_YAHOO ? - "Messenger2" : - "Messenger3", - passport, 0); - } else { - contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); - } - body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE, contact_xml); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_CONTACT_ADD_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_add_contact_read_cb; - msn_contact_request(state); - - g_free(contact_xml); - g_free(body); -} - -static void -msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - MsnUserList *userlist; - xmlnode *fault; - - g_return_if_fail(session != NULL); - userlist = session->userlist; - - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); - if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { - /* Do something special! */ - purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); - - } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) { - PurpleBuddy *buddy = purple_find_buddy(session->account, state->who); - char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who); - purple_notify_error(session, _("Buddy Add error"), str, - _("The username specified does not exist.")); - g_free(str); - msn_userlist_rem_buddy(userlist, state->who); - if (buddy != NULL) - purple_blist_remove_buddy(buddy); - - } else { - /* We don't know how to respond to this faultcode, so log it */ - char *fault_str = xmlnode_to_str(fault, NULL); - if (fault_str != NULL) { - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - } - } - return; - } - - if (msn_userlist_add_buddy_to_group(userlist, state->who, - state->new_group_name)) { - purple_debug_info("msn", "Contact %s added to group %s successfully!\n", state->who, state->new_group_name); - } else { - purple_debug_info("msn", "Contact %s added to group %s successfully on server, but failed in the local list\n", state->who, state->new_group_name); - } - - if (state->action & MSN_ADD_BUDDY) { - MsnUser *user = msn_userlist_find_user(userlist, state->who); - xmlnode *guid = xmlnode_get_child(resp->xml, - "Body/ABGroupContactAddResponse/ABGroupContactAddResult/guid"); - - if (guid != NULL) { - char *uid = xmlnode_get_data(guid); - msn_user_set_uid(user, uid); - purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); - g_free(uid); - } - - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); - - if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) { - msn_del_contact_from_list(state->session, NULL, state->who, MSN_LIST_PL); - return; - } - } - - if (state->action & MSN_MOVE_BUDDY) { - msn_del_contact_from_group(state->session, state->who, state->old_group_name); - } -} - -void -msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, - const char *passport, const char *groupId) -{ - MsnUserList *userlist; - MsnUser *user; - gchar *body = NULL, *contact_xml, *invite; - - g_return_if_fail(passport != NULL); - g_return_if_fail(groupId != NULL); - - g_return_if_fail(session != NULL); - - userlist = session->userlist; - - if (!strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) { - - user = msn_userlist_find_add_user(userlist, passport, passport); - - if (state->action & MSN_ADD_BUDDY) { - msn_add_contact(session, state, passport); - return; - } - - if (state->action & MSN_MOVE_BUDDY) { - msn_user_add_group_id(user, groupId); - msn_del_contact_from_group(session, passport, state->old_group_name); - } - - return; - } - - purple_debug_info("msn", "Adding user %s to group %s\n", passport, - msn_userlist_find_group_name(userlist, groupId)); - - user = msn_userlist_find_user(userlist, passport); - if (user == NULL) { - purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); - msn_callback_state_free(state); - return; /* guess this never happened! */ - } - - if (user->uid != NULL) { - contact_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); - } else if (user->networkid != MSN_NETWORK_PASSPORT) { - contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, - user->networkid == MSN_NETWORK_YAHOO ? - "Messenger2" : - "Messenger3", - passport, 0); - } else { - contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); - } - - if (user->invite_message) { - char *tmp; - body = g_markup_escape_text(user->invite_message, -1); - - /* Ignore the cast, we treat it as const anyway. */ - tmp = (char *)purple_connection_get_display_name(session->account->gc); - tmp = tmp ? g_markup_escape_text(tmp, -1) : g_strdup(""); - - invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp); - - g_free(body); - g_free(tmp); - - /* We can free this now */ - g_free(user->invite_message); - user->invite_message = NULL; - - } else { - invite = g_strdup(""); - } - - body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml, invite); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_add_contact_to_group_read_cb; - msn_contact_request(state); - - g_free(invite); - g_free(contact_xml); - g_free(body); -} - -static void -msn_delete_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnUserList *userlist = state->session->userlist; - MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid); - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Delete contact successful\n"); - - if (user != NULL) { - msn_userlist_remove_user(userlist, user); - } -} - -/*delete a Contact*/ -void -msn_delete_contact(MsnSession *session, MsnUser *user) -{ - gchar *body = NULL; - gchar *contact_id_xml = NULL ; - MsnCallbackState *state; - - if (user->uid != NULL) { - contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); - purple_debug_info("msn", "Deleting contact with contactId: %s\n", user->uid); - } else { - purple_debug_info("msn", "Unable to delete contact %s without a ContactId\n", user->passport); - return; - } - - state = msn_callback_state_new(session); - msn_callback_state_set_uid(state, user->uid); - - /* build SOAP request */ - body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_CONTACT_DEL_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_delete_contact_read_cb; - msn_contact_request(state); - - g_free(contact_id_xml); - g_free(body); -} - -static void -msn_del_contact_from_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - if (msn_userlist_rem_buddy_from_group(state->session->userlist, - state->who, state->old_group_name)) { - purple_debug_info("msn", "Contact %s deleted successfully from group %s\n", state->who, state->old_group_name); - } else { - purple_debug_info("msn", "Contact %s deleted successfully from group %s in the server, but failed in the local list\n", state->who, state->old_group_name); - } -} - -void -msn_del_contact_from_group(MsnSession *session, const char *passport, const char *group_name) -{ - MsnUserList * userlist; - MsnUser *user; - MsnCallbackState *state; - gchar *body, *contact_id_xml; - const gchar *groupId; - - g_return_if_fail(passport != NULL); - g_return_if_fail(group_name != NULL); - g_return_if_fail(session != NULL); - - userlist = session->userlist; - - groupId = msn_userlist_find_group_id(userlist, group_name); - if (groupId != NULL) { - purple_debug_info("msn", "Deleting user %s from group %s\n", passport, group_name); - } else { - purple_debug_warning("msn", "Unable to retrieve group id from group %s !\n", group_name); - return; - } - - user = msn_userlist_find_user(userlist, passport); - - if (user == NULL) { - purple_debug_warning("msn", "Unable to retrieve user from passport %s!\n", passport); - return; - } - - if ( !strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) { - msn_user_remove_group_id(user, groupId); - return; - } - - state = msn_callback_state_new(session); - msn_callback_state_set_who(state, passport); - msn_callback_state_set_guid(state, groupId); - msn_callback_state_set_old_group_name(state, group_name); - - if (user->uid != NULL) - contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); - else - contact_id_xml = g_strdup_printf(MSN_CONTACT_XML, passport); - body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE, contact_id_xml, groupId); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_CONTACT_DEL_GROUP_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_del_contact_from_group_read_cb; - msn_contact_request(state); - - g_free(contact_id_xml); - g_free(body); -} - - -static void -msn_update_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = (MsnCallbackState *)data; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Contact updated successfully\n"); -} - -/* Update a contact's info */ -void -msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value) -{ - MsnCallbackState *state; - xmlnode *contact; - xmlnode *contact_info; - xmlnode *changes; - MsnUser *user = NULL; - - purple_debug_info("msn", "Update contact information for %s with new %s: %s\n", - passport ? passport : "(null)", - type == MSN_UPDATE_DISPLAY ? "display name" : "alias", - value ? value : "(null)"); - g_return_if_fail(passport != NULL); - - if (strcmp(passport, "Me") != 0) { - user = msn_userlist_find_user(session->userlist, passport); - if (!user) - return; - } - - contact_info = xmlnode_new("contactInfo"); - changes = xmlnode_new("propertiesChanged"); - - switch (type) { - xmlnode *annotations; - xmlnode *display; - xmlnode *a, *n, *v; - case MSN_UPDATE_DISPLAY: - display = xmlnode_new_child(contact_info, "displayName"); - xmlnode_insert_data(display, value, -1); - xmlnode_insert_data(changes, "DisplayName", -1); - break; - - case MSN_UPDATE_ALIAS: - annotations = xmlnode_new_child(contact_info, "annotations"); - xmlnode_insert_data(changes, "Annotation ", -1); - - a = xmlnode_new_child(annotations, "Annotation"); - n = xmlnode_new_child(a, "Name"); - xmlnode_insert_data(n, "AB.NickName", -1); - v = xmlnode_new_child(a, "Value"); - xmlnode_insert_data(v, value, -1); - break; - - default: - g_return_if_reached(); - } - - state = msn_callback_state_new(session); - - state->body = xmlnode_from_str(MSN_CONTACT_UPDATE_TEMPLATE, -1); - state->action = MSN_UPDATE_INFO; - state->post_action = MSN_CONTACT_UPDATE_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_update_contact_read_cb; - - contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); - xmlnode_insert_child(contact, contact_info); - xmlnode_insert_child(contact, changes); - - if (user) { - xmlnode *contactId = xmlnode_new_child(contact, "contactId"); - msn_callback_state_set_uid(state, user->uid); - xmlnode_insert_data(contactId, state->uid, -1); - } else { - xmlnode *contactType = xmlnode_new_child(contact_info, "contactType"); - xmlnode_insert_data(contactType, "Me", -1); - } - - msn_contact_request(state); -} - -static void -msn_del_contact_from_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Contact %s deleted successfully from %s list on server!\n", state->who, MsnMemberRole[state->list_id]); - - if (state->list_id == MSN_LIST_PL) { - MsnUser *user = msn_userlist_find_user(session->userlist, state->who); - MsnCallbackState *new_state = msn_callback_state_dup(state); - - if (user != NULL) - msn_user_unset_op(user, MSN_LIST_PL_OP); - - msn_add_contact_to_list(session, new_state, state->who, MSN_LIST_RL); - return; - } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_remove(session->account, state->who, TRUE); - msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_BL); - } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_remove(session->account, state->who, TRUE); - msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_AL); - } - -} - -void -msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list) -{ - gchar *body = NULL, *member = NULL; - MsnSoapPartnerScenario partner_scenario; - MsnUser *user; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->userlist != NULL); - g_return_if_fail(passport != NULL); - g_return_if_fail(list < 5); - - purple_debug_info("msn", "Deleting contact %s from %s list\n", passport, MsnMemberRole[list]); - - if (state == NULL) { - state = msn_callback_state_new(session); - } - msn_callback_state_set_list_id(state, list); - msn_callback_state_set_who(state, passport); - - user = msn_userlist_find_user(session->userlist, passport); - - if (list == MSN_LIST_PL) { - partner_scenario = MSN_PS_CONTACT_API; - if (user && user->networkid != MSN_NETWORK_PASSPORT) - member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, - "EmailMember", "Email", - user->membership_id[MSN_LIST_PL]); - else - member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, - "PassportMember", "Passport", - user->membership_id[MSN_LIST_PL]); - } else { - /* list == MSN_LIST_AL || list == MSN_LIST_BL */ - partner_scenario = MSN_PS_BLOCK_UNBLOCK; - if (user && user->networkid != MSN_NETWORK_PASSPORT) - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "EmailMember", "Email", - "Email", passport, "Email"); - else - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "PassportMember", "Passport", - "PassportName", passport, "PassportName"); - } - - body = g_strdup_printf(MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE, - MsnSoapPartnerScenarioText[partner_scenario], - MsnMemberRole[list], member); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION; - state->post_url = MSN_SHARE_POST_URL; - state->cb = msn_del_contact_from_list_read_cb; - msn_contact_request(state); - - g_free(member); - g_free(body); -} - -static void -msn_add_contact_to_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - g_return_if_fail(state->session != NULL); - - purple_debug_info("msn", "Contact %s added successfully to %s list on server!\n", state->who, MsnMemberRole[state->list_id]); - - if (state->list_id == MSN_LIST_RL) { - MsnUser *user = msn_userlist_find_user(state->session->userlist, state->who); - - if (user != NULL) { - msn_user_set_op(user, MSN_LIST_RL_OP); - } - - if (state->action & MSN_DENIED_BUDDY) { - msn_add_contact_to_list(state->session, NULL, state->who, MSN_LIST_BL); - } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_add(state->session->account, state->who, TRUE); - } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_add(state->session->account, state->who, TRUE); - } - } -} - -void -msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list) -{ - gchar *body = NULL, *member = NULL; - MsnSoapPartnerScenario partner_scenario; - MsnUser *user; - - g_return_if_fail(session != NULL); - g_return_if_fail(passport != NULL); - g_return_if_fail(list < 5); - - purple_debug_info("msn", "Adding contact %s to %s list\n", passport, MsnMemberRole[list]); - - if (state == NULL) { - state = msn_callback_state_new(session); - } - msn_callback_state_set_list_id(state, list); - msn_callback_state_set_who(state, passport); - - user = msn_userlist_find_user(session->userlist, passport); - - partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK; - if (user && user->networkid != MSN_NETWORK_PASSPORT) - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "EmailMember", "Email", - "Email", state->who, "Email"); - else - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "PassportMember", "Passport", - "PassportName", state->who, "PassportName"); - - body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE, - MsnSoapPartnerScenarioText[partner_scenario], - MsnMemberRole[list], member); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION; - state->post_url = MSN_SHARE_POST_URL; - state->cb = msn_add_contact_to_list_read_cb; - msn_contact_request(state); - - g_free(member); - g_free(body); -} - -#if 0 -static void -msn_gleams_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - purple_debug_info("msn", "Gleams read done\n"); -} - -/*get the gleams info*/ -void -msn_get_gleams(MsnSession *session) -{ - MsnSoapReq *soap_request; - - purple_debug_info("msn", "msn get gleams info...\n"); - - state = msn_callback_state_new(session); - state->body = xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -1); - state->post_action = MSN_GET_GLEAMS_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_gleams_read_cb; - msn_contact_request(state); -} -#endif - - -/*************************************************************** - * Group Operations - ***************************************************************/ - -static void -msn_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session; - MsnUserList *userlist; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Group request successful.\n"); - - g_return_if_fail(state->session != NULL); - g_return_if_fail(state->session->userlist != NULL); - - session = state->session; - userlist = session->userlist; - - if (state->action & MSN_RENAME_GROUP) { - msn_userlist_rename_group_id(session->userlist, - state->guid, - state->new_group_name); - } - - if (state->action & MSN_ADD_GROUP) { - /* the response is taken from - http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions - should copy it to msnpiki some day */ - xmlnode *guid_node = xmlnode_get_child(resp->xml, - "Body/ABGroupAddResponse/ABGroupAddResult/guid"); - - if (guid_node) { - char *guid = xmlnode_get_data(guid_node); - - /* create and add the new group to the userlist */ - purple_debug_info("msn", "Adding group %s with guid = %s to the userlist\n", state->new_group_name, guid); - msn_group_new(session->userlist, guid, state->new_group_name); - - if (state->action & MSN_ADD_BUDDY) { - msn_userlist_add_buddy(session->userlist, - state->who, - state->new_group_name); - } else if (state->action & MSN_MOVE_BUDDY) { - /* This will be freed when the add contact callback fires */ - MsnCallbackState *new_state = msn_callback_state_dup(state); - msn_add_contact_to_group(session, new_state, state->who, guid); - g_free(guid); - return; - } - g_free(guid); - } else { - purple_debug_info("msn", "Adding group %s failed\n", - state->new_group_name); - } - } - - if (state->action & MSN_DEL_GROUP) { - GList *l; - - msn_userlist_remove_group_id(session->userlist, state->guid); - for (l = userlist->users; l != NULL; l = l->next) { - msn_user_remove_group_id( (MsnUser *)l->data, state->guid); - } - } -} - -/* add group */ -void -msn_add_group(MsnSession *session, MsnCallbackState *state, const char* group_name) -{ - char *body = NULL; - char *escaped_group_name = NULL; - - g_return_if_fail(session != NULL); - g_return_if_fail(group_name != NULL); - - purple_debug_info("msn", "Adding group %s to contact list.\n", group_name); - - if (state == NULL) { - state = msn_callback_state_new(session); - } - - msn_callback_state_set_action(state, MSN_ADD_GROUP); - msn_callback_state_set_new_group_name(state, group_name); - - /* escape group name's html special chars so it can safely be sent - * in a XML SOAP request - */ - escaped_group_name = g_markup_escape_text(group_name, -1); - body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE, escaped_group_name); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GROUP_ADD_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_group_read_cb; - msn_contact_request(state); - - g_free(escaped_group_name); - g_free(body); -} - -/* delete group */ -void -msn_del_group(MsnSession *session, const gchar *group_name) -{ - MsnCallbackState *state; - char *body = NULL; - const gchar *guid; - - g_return_if_fail(session != NULL); - - g_return_if_fail(group_name != NULL); - purple_debug_info("msn", "Deleting group %s from contact list\n", group_name); - - guid = msn_userlist_find_group_id(session->userlist, group_name); - - /* if group uid we need to del is NULL, - * we need to delete nothing - */ - if (guid == NULL) { - purple_debug_info("msn", "Group %s guid not found, returning.\n", group_name); - return; - } - - if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) { - /* XXX add back PurpleGroup since it isn't really removed in the server? */ - return; - } - - state = msn_callback_state_new(session); - msn_callback_state_set_action(state, MSN_DEL_GROUP); - msn_callback_state_set_guid(state, guid); - - body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE, guid); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GROUP_DEL_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_group_read_cb; - msn_contact_request(state); - - g_free(body); -} - -/* rename group */ -void -msn_contact_rename_group(MsnSession *session, const char *old_group_name, const char *new_group_name) -{ - gchar *body = NULL; - const gchar * guid; - MsnCallbackState *state; - char *escaped_group_name; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->userlist != NULL); - g_return_if_fail(old_group_name != NULL); - g_return_if_fail(new_group_name != NULL); - - purple_debug_info("msn", "Renaming group %s to %s.\n", old_group_name, new_group_name); - - guid = msn_userlist_find_group_id(session->userlist, old_group_name); - if (guid == NULL) - return; - - state = msn_callback_state_new(session); - msn_callback_state_set_guid(state, guid); - msn_callback_state_set_new_group_name(state, new_group_name); - - if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) { - MsnCallbackState *new_state = msn_callback_state_dup(state); - msn_add_group(session, new_state, new_group_name); - /* XXX move every buddy there (we probably need to fix concurrent SOAP reqs first) */ - } - - msn_callback_state_set_action(state, MSN_RENAME_GROUP); - - escaped_group_name = g_markup_escape_text(new_group_name, -1); - body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE, guid, escaped_group_name); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GROUP_RENAME_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_group_read_cb; - msn_contact_request(state); - - g_free(escaped_group_name); - g_free(body); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/contact.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,711 +0,0 @@ -/** - * @file contact.h Header file for contact.c - * Author - * MaYuan<mayuan2006@gmail.com> - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef _MSN_CONTACT_H_ -#define _MSN_CONTACT_H_ - -#include "session.h" -#include "soap.h" - -#define MSN_APPLICATION_ID "CFE80F9D-180F-4399-82AB-413F33A1FA11" - -#define MSN_CONTACT_SERVER "omega.contacts.msn.com" - -/* Get Contact List */ - -#define MSN_GET_CONTACT_POST_URL "/abservice/SharingService.asmx" -#define MSN_GET_CONTACT_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership" - -#define MSN_GET_CONTACT_UPDATE_XML \ - "<View>Full</View>"\ - "<deltasOnly>true</deltasOnly>"\ - "<lastChange>%s</lastChange>" - -#define MSN_GET_CONTACT_TEMPLATE "<?xml version='1.0' encoding='utf-8'?>"\ -"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ - "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>"\ - "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ - "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<Types xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType>"\ - "</Types>"\ - "</serviceFilter>"\ - "%s"\ - "</FindMembership>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/************************************************ - * Address Book SOAP - * *********************************************/ - -#define MSN_ADDRESS_BOOK_POST_URL "/abservice/abservice.asmx" - -/* Create AddressBook template */ -#define MSN_ADD_ADDRESSBOOK_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABAdd" - -#define MSN_ADD_ADDRESSBOOK_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Initial</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abInfo>"\ - "<name/>"\ - "<ownerPuid>0</ownerPuid>"\ - "<ownerEmail>%s</ownerEmail>"\ - "<fDefault>true</fDefault>"\ - "</abInfo>"\ - "</ABAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Get AddressBook */ -#define MSN_GET_ADDRESS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" -#define MSN_GET_ADDRESS_FULL_TIME "0001-01-01T00:00:00.0000000-08:00" -#define MSN_GET_ADDRESS_UPDATE_XML \ - "<deltasOnly>true</deltasOnly>"\ - "<lastChange>%s</lastChange>" - -#define MSN_GET_GLEAM_UPDATE_XML \ - "%s"\ - "<dynamicItemView>Gleam</dynamicItemView>"\ - "<dynamicItemLastChange>%s</dynamicItemLastChange>" - -#define MSN_GET_ADDRESS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<abView>Full</abView>"\ - "%s"\ - "</ABFindAll>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - -/*Gleams SOAP request template*/ -#define MSN_GET_GLEAMS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" -#define MSN_GLEAMS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Initial</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<abView>Full</abView>"\ - "<dynamicItemView>Gleam</dynamicItemView>"\ - "<dynamicItemLastChange>0001-01-01T00:00:00.0000000-08:00</dynamicItemLastChange>"\ - "</ABFindAll>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - -/******************************************************* - * Contact Management SOAP actions - *******************************************************/ - -/* Add a new contact */ -#define MSN_CONTACT_ADD_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd" -#define MSN_CONTACT_LIVE_PENDING_XML \ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<contactInfo>"\ - "<contactType>LivePending</contactType>"\ - "<passportName>%s</passportName>"\ - "<isMessengerUser>true</isMessengerUser>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_XML \ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<contactInfo>"\ - "<passportName>%s</passportName>"\ - "<isSmtp>false</isSmtp>"\ - "<isMessengerUser>true</isMessengerUser>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_DISPLAYNAME_XML \ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<contactInfo>"\ - "<displayName>%s</displayName>"\ - "<passportName>%s</passportName>"\ - "<isMessengerUser>true</isMessengerUser>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_ID_XML \ - "<Contact>"\ - "<contactId>%s</contactId>"\ - "</Contact>" - -#define MSN_CONTACT_EMAIL_XML \ - "<Contact>"\ - "<contactInfo>"\ - "<emails>"\ - "<ContactEmail>"\ - "<contactEmailType>%s</contactEmailType>"\ - "<email>%s</email>"\ - "<isMessengerEnabled>true</isMessengerEnabled>"\ - "<Capability>%d</Capability>"\ - "<MessengerEnabledExternally>false</MessengerEnabledExternally>"\ - "<propertiesChanged/>"\ - "</ContactEmail>"\ - "</emails>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_INVITE_MESSAGE_XML \ - "<MessengerMemberInfo>"\ - "<PendingAnnotations>"\ - "<Annotation>"\ - "<Name>MSN.IM.InviteMessage</Name>"\ - "<Value>%s</Value>"\ - "</Annotation>"\ - "</PendingAnnotations>"\ - "<DisplayName>%s</DisplayName>"\ - "</MessengerMemberInfo>" - -#define MSN_ADD_CONTACT_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>ContactSave</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>%s</contacts>"\ - "<options>"\ - "<EnableAllowListManagement>true</EnableAllowListManagement>"\ - "</options>"\ - "</ABContactAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Add a contact to a group */ -#define MSN_ADD_CONTACT_GROUP_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupContactAdd" -#define MSN_ADD_CONTACT_GROUP_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>ContactSave</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groupFilter>"\ - "<groupIds>"\ - "<guid>%s</guid>"\ - "</groupIds>"\ - "</groupFilter>"\ - "<contacts>%s</contacts>"\ - "<groupContactAddOptions>"\ - "<fGenerateMissingQuickName>true</fGenerateMissingQuickName>"\ - "<EnableAllowListManagement>true</EnableAllowListManagement>"\ - "</groupContactAddOptions>"\ - "%s"\ - "</ABGroupContactAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Delete a contact from the Contact List */ -#define MSN_CONTACT_DEL_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete" -#define MSN_DEL_CONTACT_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>%s</contacts>"\ - "</ABContactDelete>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Remove a contact from a group */ -#define MSN_CONTACT_DEL_GROUP_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupContactDelete" -#define MSN_CONTACT_DEL_GROUP_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>%s</contacts>"\ - "<groupFilter>"\ - "<groupIds>"\ - "<guid>%s</guid>"\ - "</groupIds>"\ - "</groupFilter>"\ - "</ABGroupContactDelete>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - -/* Update Contact Information */ -#define MSN_CONTACT_UPDATE_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate" -#define MSN_CONTACT_UPDATE_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>"\ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - ""\ - "</Contact>"\ - "</contacts>"\ - "</ABContactUpdate>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/******************************************************* - * Add/Delete contact from lists SOAP actions - *******************************************************/ - -/* block means delete from allow list and add contact to block list */ -#define MSN_SHARE_POST_URL "/abservice/SharingService.asmx" - -#define MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/AddMember" -#define MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember" - -#define MSN_MEMBER_PASSPORT_XML \ - "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"%s\">"\ - "<Type>%s</Type>"\ - "<State>Accepted</State>"\ - "<%s>%s</%s>"\ - "</Member>" - -#define MSN_MEMBER_MEMBERSHIPID_XML \ - "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"%s\">"\ - "<Type>%s</Type>"\ - "<MembershipId>%u</MembershipId>"\ - "<State>Accepted</State>"\ - "</Member>" - -/* first delete contact from allow list */ - -#define MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<DeleteMember xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<serviceHandle>"\ - "<Id>0</Id>"\ - "<Type>Messenger</Type>"\ - "<ForeignId></ForeignId>"\ - "</serviceHandle>"\ - "<memberships>"\ - "<Membership>"\ - "<MemberRole>%s</MemberRole>"\ - "<Members>"\ - "%s"\ - "</Members>"\ - "</Membership>"\ - "</memberships>"\ - "</DeleteMember>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -#define MSN_CONTACT_ADD_TO_LIST_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<AddMember xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<serviceHandle>"\ - "<Id>0</Id>"\ - "<Type>Messenger</Type>"\ - "<ForeignId></ForeignId>"\ - "</serviceHandle>"\ - "<memberships>"\ - "<Membership>"\ - "<MemberRole>%s</MemberRole>"\ - "<Members>"\ - "%s"\ - "</Members>"\ - "</Membership>"\ - "</memberships>"\ - "</AddMember>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - - -/******************************************************* - * Group management SOAP actions - *******************************************************/ - -/* add a group */ -#define MSN_GROUP_ADD_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupAdd" -#define MSN_GROUP_ADD_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>GroupSave</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groupAddOptions>"\ - "<fRenameOnMsgrConflict>false</fRenameOnMsgrConflict>"\ - "</groupAddOptions>"\ - "<groupInfo>"\ - "<GroupInfo>"\ - "<name>%s</name>"\ - "<groupType>C8529CE2-6EAD-434d-881F-341E17DB3FF8</groupType>"\ - "<fMessenger>false</fMessenger>"\ - "<annotations>"\ - "<Annotation>"\ - "<Name>MSN.IM.Display</Name>"\ - "<Value>1</Value>"\ - "</Annotation>"\ - "</annotations>"\ - "</GroupInfo>"\ - "</groupInfo>"\ - "</ABGroupAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* delete a group */ -#define MSN_GROUP_DEL_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupDelete" -#define MSN_GROUP_DEL_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groupFilter>"\ - "<groupIds>"\ - "<guid>%s</guid>"\ - "</groupIds>"\ - "</groupFilter>"\ - "</ABGroupDelete>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* change a group's name */ -#define MSN_GROUP_RENAME_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupUpdate" -#define MSN_GROUP_RENAME_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groups>"\ - "<Group>"\ - "<groupId>%s</groupId>"\ - "<groupInfo>"\ - "<name>%s</name>"\ - "</groupInfo>"\ - "<propertiesChanged>GroupName </propertiesChanged>"\ - "</Group>"\ - "</groups>"\ - "</ABGroupUpdate>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -typedef enum -{ - MSN_ADD_BUDDY = 0x01, - MSN_MOVE_BUDDY = 0x02, - MSN_ACCEPTED_BUDDY = 0x04, - MSN_DENIED_BUDDY = 0x08, - MSN_ADD_GROUP = 0x10, - MSN_DEL_GROUP = 0x20, - MSN_RENAME_GROUP = 0x40, - MSN_UPDATE_INFO = 0x80 -} MsnCallbackAction; - -typedef enum -{ - MSN_PS_INITIAL, - MSN_PS_SAVE_CONTACT, - MSN_PS_PENDING_LIST, - MSN_PS_CONTACT_API, - MSN_PS_BLOCK_UNBLOCK -} MsnSoapPartnerScenario; - -typedef struct _MsnCallbackState MsnCallbackState; - -struct _MsnCallbackState -{ - gchar * who; - gchar * uid; - gchar * old_group_name; - gchar * new_group_name; - gchar * guid; - MsnListId list_id; - MsnCallbackAction action; - MsnSession *session; - xmlnode *body; - xmlnode *token; - const gchar *post_action; - const gchar *post_url; - MsnSoapCallback cb; - /* For msn_get_contact_list only */ - MsnSoapPartnerScenario partner_scenario; -}; - -typedef enum -{ - MSN_UPDATE_DISPLAY, /* Real display name */ - MSN_UPDATE_ALIAS, /* Aliased display name */ - MSN_UPDATE_COMMENT -} MsnContactUpdateType; - -/************************************************ - * function prototype - ************************************************/ -MsnCallbackState * msn_callback_state_new(MsnSession *session); -MsnCallbackState * msn_callback_state_dup(MsnCallbackState *state); -void msn_callback_state_free(MsnCallbackState *state); -void msn_callback_state_set_who(MsnCallbackState *state, const gchar *who); -void msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid); -void msn_callback_state_set_old_group_name(MsnCallbackState *state, - const gchar *old_group_name); -void msn_callback_state_set_new_group_name(MsnCallbackState *state, - const gchar *new_group_name); -void msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid); -void msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id); -void msn_callback_state_set_action(MsnCallbackState *state, - MsnCallbackAction action); - -void msn_contact_connect(MsnSession *session); -void msn_get_contact_list(MsnSession *session, - const MsnSoapPartnerScenario partner_scenario, - const char *update); -void msn_get_address_book(MsnSession *session, - const MsnSoapPartnerScenario partner_scenario, - const char * update, const char * gupdate); - -/* contact SOAP operations */ -void msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value); - -void msn_add_contact(MsnSession *session, MsnCallbackState *state, - const char *passport); -void msn_delete_contact(MsnSession *session, MsnUser *user); - -void msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, - const char *passport, const char *groupId); -void msn_del_contact_from_group(MsnSession *session, const char *passport, - const char *group_name); -/* group operations */ -void msn_add_group(MsnSession *session, MsnCallbackState *state, - const char* group_name); -void msn_del_group(MsnSession *session, const gchar *group_name); -void msn_contact_rename_group(MsnSession *session, const char *old_group_name, - const char *new_group_name); - -/* lists operations */ -void msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list); -void msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list); - -#endif /* _MSN_CONTACT_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/** - * @file dialog.c Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "msn.h" -#include "dialog.h" - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *group; - gboolean add; - -} MsnAddRemData; - -/* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed. - * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */ -/* Actually with our MSNP14 code that isn't true yet, he won't be added back :( */ -static void -msn_complete_sync_issue(MsnAddRemData *data) -{ - PurpleBuddy *buddy; - PurpleGroup *group = NULL; - - if (data->group != NULL) - group = purple_find_group(data->group); - - if (group != NULL) - buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group); - else - buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who); - - if (buddy != NULL) - purple_blist_remove_buddy(buddy); -} - - -static void -msn_add_cb(MsnAddRemData *data) -{ -#if 0 - /* this *should* be necessary !! */ - msn_complete_sync_issue(data); -#endif - - if (g_list_find(purple_connections_get_all(), data->gc) != NULL) - { - MsnSession *session = data->gc->proto_data; - MsnUserList *userlist = session->userlist; - - msn_userlist_add_buddy(userlist, data->who, data->group); - } - - g_free(data->group); - g_free(data->who); - g_free(data); -} - -static void -msn_rem_cb(MsnAddRemData *data) -{ - msn_complete_sync_issue(data); - - if (g_list_find(purple_connections_get_all(), data->gc) != NULL) - { - MsnSession *session = data->gc->proto_data; - MsnUserList *userlist = session->userlist; - - if (data->group == NULL) { - msn_userlist_rem_buddy_from_list(userlist, data->who, MSN_LIST_FL); - } else { - g_free(data->group); - } - } - - g_free(data->who); - g_free(data); -} - -void -msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name) -{ - PurpleConnection *gc; - PurpleAccount *account; - MsnAddRemData *data; - char *msg, *reason; - - account = session->account; - gc = purple_account_get_connection(account); - - data = g_new0(MsnAddRemData, 1); - data->who = g_strdup(passport); - data->group = g_strdup(group_name); - data->gc = gc; - - msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - if (group_name != NULL) - { - reason = g_strdup_printf(_("%s on the local list is " - "inside the group \"%s\" but not on " - "the server list. " - "Do you want this buddy to be added?"), - passport, group_name); - } - else - { - reason = g_strdup_printf(_("%s is on the local list but " - "not on the server list. " - "Do you want this buddy to be added?"), - passport); - } - - purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), data->who, NULL, - data, 2, - _("Yes"), G_CALLBACK(msn_add_cb), - _("No"), G_CALLBACK(msn_rem_cb)); - - g_free(reason); - g_free(msg); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/dialog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/** - * @file dialog.h Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_DIALOG_H_ -#define _MSN_DIALOG_H_ - -void msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name); - -#endif /* _MSN_DIALOG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,505 +0,0 @@ -/** - * @file directconn.c MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "directconn.h" - -#include "slp.h" -#include "slpmsg.h" - -/************************************************************************** - * Directconn Specific - **************************************************************************/ - -void -msn_directconn_send_handshake(MsnDirectConn *directconn) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - g_return_if_fail(directconn != NULL); - - slplink = directconn->slplink; - - slpmsg = msn_slpmsg_new(slplink); - slpmsg->flags = 0x100; - - if (directconn->nonce != NULL) - { - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - sscanf (directconn->nonce, "%08X-%04hX-%04hX-%04hX-%012" G_GINT64_MODIFIER "X", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - slpmsg->ack_id = t1; - slpmsg->ack_sub_id = t2 | (t3 << 16); - slpmsg->ack_size = t4 | t5; - } - - g_free(directconn->nonce); - - msn_slplink_send_slpmsg(slplink, slpmsg); - - directconn->acked =TRUE; -} - -/************************************************************************** - * Connection Functions - **************************************************************************/ - -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} - -static gssize -msn_directconn_write(MsnDirectConn *directconn, - const char *data, size_t len) -{ - char *buffer, *tmp; - size_t buf_size; - gssize ret; - guint32 sent_len; - - g_return_val_if_fail(directconn != NULL, 0); - - buf_size = len + 4; - buffer = tmp = g_malloc(buf_size); - - sent_len = GUINT32_TO_LE(len); - - memcpy(tmp, &sent_len, 4); - tmp += 4; - memcpy(tmp, data, len); - tmp += len; - - ret = write(directconn->fd, buffer, buf_size); - -#ifdef DEBUG_DC - char *str; - str = g_strdup_printf("%s/msntest/w%.4d.bin", g_get_home_dir(), directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(buffer, 1, buf_size, tf); - fclose(tf); - - g_free(str); -#endif - - g_free(buffer); - - directconn->c++; - - return ret; -} - -#if 0 -void -msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce) -{ - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - g_return_if_fail(directconn != NULL); - g_return_if_fail(nonce != NULL); - - sscanf (nonce, "%08X-%04hX-%04hX-%04hX-%012llX", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - directconn->slpheader = g_new0(MsnSlpHeader, 1); - - directconn->slpheader->ack_id = t1; - directconn->slpheader->ack_sub_id = t2 | (t3 << 16); - directconn->slpheader->ack_size = t4 | t5; -} -#endif - -void -msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - char *body; - size_t body_len; - - body = msn_message_gen_slp_body(msg, &body_len); - - msn_directconn_write(directconn, body, body_len); -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - char *body; - size_t body_len; - gssize len; - - purple_debug_info("msn", "read_cb: %d, %d\n", source, cond); - - directconn = data; - - /* Let's read the length of the data. */ -#error This code is broken. See the note below. - /* - * TODO: This has problems! First of all, sizeof(body_len) will be - * different on 32bit systems and on 64bit systems (4 bytes - * vs. 8 bytes). - * Secondly, we're reading from a TCP stream. There is no - * guarantee that we have received the number of bytes we're - * trying to read. We need to read into a buffer. If read - * returns <0 then we need to check errno. If errno is EAGAIN - * then don't destroy anything, just exit and wait for more - * data. See every other function in libpurple that does this - * correctly for an example. - */ - len = read(directconn->fd, &body_len, sizeof(body_len)); - - if (len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - - msn_directconn_destroy(directconn); - - return; - } - - body_len = GUINT32_FROM_LE(body_len); - - purple_debug_info("msn", "body_len=%" G_GSIZE_FORMAT "\n", body_len); - - if (body_len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - - msn_directconn_destroy(directconn); - - return; - } - - body = g_try_malloc(body_len); - - if (body != NULL) - { - /* Let's read the data. */ - len = read(directconn->fd, body, body_len); - - purple_debug_info("msn", "len=%" G_GSIZE_FORMAT "\n", len); - } - else - { - purple_debug_error("msn", "Failed to allocate memory for read\n"); - len = 0; - } - - if (len > 0) - { - MsnMessage *msg; - -#ifdef DEBUG_DC - str = g_strdup_printf("%s/msntest/r%.4d.bin", g_get_home_dir(), directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(body, 1, len, tf); - fclose(tf); - - g_free(str); -#endif - - directconn->c++; - - msg = msn_message_new_msnslp(); - msn_message_parse_slp_body(msg, body, body_len); - - purple_debug_info("msn", "directconn: process_msg\n"); - msn_slplink_process_msg(directconn->slplink, msg); - } - else - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - - msn_directconn_destroy(directconn); - } - - g_free(body); -} - -static void -connect_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - int fd; - - purple_debug_misc("msn", "directconn: connect_cb: %d, %d.\n", source, cond); - - directconn = data; - directconn->connect_data = NULL; - - if (TRUE) - { - fd = source; - } - else - { - struct sockaddr_in client_addr; - socklen_t client; - fd = accept (source, (struct sockaddr *)&client_addr, &client); - } - - directconn->fd = fd; - - if (fd > 0) - { - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, read_cb, - directconn); - - if (TRUE) - { - /* Send foo. */ - msn_directconn_write(directconn, "foo", strlen("foo") + 1); - - /* Send Handshake */ - msn_directconn_send_handshake(directconn); - } - else - { - } - } - else - { - /* ERROR */ - purple_debug_error("msn", "could not add input\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - } -} - -static void -directconn_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - if (error_message) - purple_debug_error("msn", "Error making direct connection: %s\n", error_message); - - connect_cb(data, source, PURPLE_INPUT_READ); -} - -gboolean -msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) -{ - MsnSession *session; - - g_return_val_if_fail(directconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, TRUE); - g_return_val_if_fail(port > 0, FALSE); - - session = directconn->slplink->session; - -#if 0 - if (session->http_method) - { - servconn->http_data->gateway_host = g_strdup(host); - } -#endif - - directconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, directconn_connect_cb, directconn); - - return (directconn->connect_data != NULL); -} - -void -msn_directconn_listen(MsnDirectConn *directconn) -{ - int port; - int fd; - - port = 7000; - - for (fd = -1; fd < 0;) - fd = create_listener(++port); - - directconn->fd = fd; - - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, connect_cb, - directconn); - - directconn->port = port; - directconn->c = 0; -} - -MsnDirectConn* -msn_directconn_new(MsnSlpLink *slplink) -{ - MsnDirectConn *directconn; - - directconn = g_new0(MsnDirectConn, 1); - - directconn->slplink = slplink; - - if (slplink->directconn != NULL) - purple_debug_info("msn", "got_transresp: LEAK\n"); - - slplink->directconn = directconn; - - return directconn; -} - -void -msn_directconn_destroy(MsnDirectConn *directconn) -{ - if (directconn->connect_data != NULL) - purple_proxy_connect_cancel(directconn->connect_data); - - if (directconn->inpa != 0) - purple_input_remove(directconn->inpa); - - if (directconn->fd >= 0) - close(directconn->fd); - - if (directconn->nonce != NULL) - g_free(directconn->nonce); - - directconn->slplink->directconn = NULL; - - g_free(directconn); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/directconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/** - * @file directconn.h MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_DIRECTCONN_H_ -#define _MSN_DIRECTCONN_H_ - -typedef struct _MsnDirectConn MsnDirectConn; - -#include "slplink.h" -#include "slp.h" -#include "msg.h" - -struct _MsnDirectConn -{ - MsnSlpLink *slplink; - MsnSlpCall *initial_call; - - PurpleProxyConnectData *connect_data; - - gboolean acked; - - char *nonce; - - int fd; - - int port; - int inpa; - - int c; -}; - -MsnDirectConn *msn_directconn_new(MsnSlpLink *slplink); -gboolean msn_directconn_connect(MsnDirectConn *directconn, - const char *host, int port); -void msn_directconn_listen(MsnDirectConn *directconn); -void msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg); -void msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce); -void msn_directconn_destroy(MsnDirectConn *directconn); -void msn_directconn_send_handshake(MsnDirectConn *directconn); - -#endif /* _MSN_DIRECTCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/** - * @file error.c Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "error.h" - -const char * -msn_error_get_text(unsigned int type, gboolean *debug) -{ - static char msg[256]; - const char *result; - *debug = FALSE; - - switch (type) { - case 0: - result = _("Unable to parse message"); - *debug = TRUE; - break; - case 200: - result = _("Syntax Error (probably a client bug)"); - *debug = TRUE; - break; - case 201: - result = _("Invalid email address"); - break; - case 205: - result = _("User does not exist"); - break; - case 206: - result = _("Fully qualified domain name missing"); - break; - case 207: - result = _("Already logged in"); - break; - case 208: - result = _("Invalid username"); - break; - case 209: - result = _("Invalid friendly name"); - break; - case 210: - result = _("List full"); - break; - case 215: - result = _("Already there"); - *debug = TRUE; - break; - case 216: - result = _("Not on list"); - break; - case 217: - result = _("User is offline"); - break; - case 218: - result = _("Already in the mode"); - *debug = TRUE; - break; - case 219: - result = _("Already in opposite list"); - *debug = TRUE; - break; - case 223: - result = _("Too many groups"); - break; - case 224: - result = _("Invalid group"); - break; - case 225: - result = _("User not in group"); - break; - case 229: - result = _("Group name too long"); - break; - case 230: - result = _("Cannot remove group zero"); - *debug = TRUE; - break; - case 231: - result = _("Tried to add a user to a group that doesn't exist"); - break; - case 280: - result = _("Switchboard failed"); - *debug = TRUE; - break; - case 281: - result = _("Notify transfer failed"); - *debug = TRUE; - break; - - case 300: - result = _("Required fields missing"); - *debug = TRUE; - break; - case 301: - result = _("Too many hits to a FND"); - *debug = TRUE; - break; - case 302: - result = _("Not logged in"); - break; - - case 500: - result = _("Service temporarily unavailable"); - break; - case 501: - result = _("Database server error"); - *debug = TRUE; - break; - case 502: - result = _("Command disabled"); - *debug = TRUE; - break; - case 510: - result = _("File operation error"); - *debug = TRUE; - break; - case 520: - result = _("Memory allocation error"); - *debug = TRUE; - break; - case 540: - result = _("Wrong CHL value sent to server"); - *debug = TRUE; - break; - - case 600: - result = _("Server busy"); - break; - case 601: - result = _("Server unavailable"); - break; - case 602: - result = _("Peer notification server down"); - *debug = TRUE; - break; - case 603: - result = _("Database connect error"); - *debug = TRUE; - break; - case 604: - result = _("Server is going down (abandon ship)"); - break; - case 605: - result = _("Server unavailable"); - break; - - case 707: - result = _("Error creating connection"); - *debug = TRUE; - break; - case 710: - result = _("CVR parameters are either unknown or not allowed"); - *debug = TRUE; - break; - case 711: - result = _("Unable to write"); - break; - case 712: - result = _("Session overload"); - *debug = TRUE; - break; - case 713: - result = _("User is too active"); - break; - case 714: - result = _("Too many sessions"); - break; - case 715: - result = _("Passport not verified"); - break; - case 717: - result = _("Bad friend file"); - *debug = TRUE; - break; - case 731: - result = _("Not expected"); - *debug = TRUE; - break; - - case 800: - result = _("Friendly name is changing too rapidly"); - break; - - case 910: - case 912: - case 918: - case 919: - case 921: - case 922: - result = _("Server too busy"); - break; - case 911: - case 917: - result = _("Authentication failed"); - break; - case 913: - result = _("Not allowed when offline"); - break; - case 914: - case 915: - case 916: - result = _("Server unavailable"); - break; - case 920: - result = _("Not accepting new users"); - break; - case 923: - result = _("Kids Passport without parental consent"); - break; - case 924: - result = _("Passport account not yet verified"); - break; - case 927: - result = _("Passport account suspended"); - break; - case 928: - result = _("Bad ticket"); - *debug = TRUE; - break; - - default: - g_snprintf(msg, sizeof(msg), - _("Unknown Error Code %d"), type); - *debug = TRUE; - result = msg; - break; - } - - return result; -} - -void -msn_error_handle(MsnSession *session, unsigned int type) -{ - char *buf; - gboolean debug; - - buf = g_strdup_printf(_("MSN Error: %s\n"), - msn_error_get_text(type, &debug)); - if (debug) - purple_debug_warning("msn", "error %d: %s\n", type, buf); - else - purple_notify_error(session->account->gc, NULL, buf, NULL); - g_free(buf); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/error.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - * @file error.h Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_ERROR_H_ -#define _MSN_ERROR_H_ - -#include "session.h" - -/** - * Returns the string representation of an error type. - * - * @param type The error type. - * @param debug Whether this should be treated as a debug log message or a user-visible error - * - * @return The string representation of the error type. - */ -const char *msn_error_get_text(unsigned int type, gboolean *debug); - -/** - * Handles an error. - * - * @param session The current session. - * @param type The error type. - */ -void msn_error_handle(MsnSession *session, unsigned int type); - -#endif /* _MSN_ERROR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/** - * @file group.c Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "group.h" - -MsnGroup * -msn_group_new(MsnUserList *userlist, const char *id, const char *name) -{ - MsnGroup *group; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - group = g_new0(MsnGroup, 1); - - msn_userlist_add_group(userlist, group); - - group->id = g_strdup(id); - group->name = g_strdup(name); - - return group; -} - -void -msn_group_destroy(MsnGroup *group) -{ - g_return_if_fail(group != NULL); - - g_free(group->id); - g_free(group->name); - g_free(group); -} - -void -msn_group_set_id(MsnGroup *group, const char *id) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(id != NULL); - - g_free(group->id); - group->id = g_strdup(id); -} - -void -msn_group_set_name(MsnGroup *group, const char *name) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(name != NULL); - - g_free(group->name); - group->name = g_strdup(name); -} - -char* -msn_group_get_id(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->id; -} - -const char * -msn_group_get_name(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->name; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/** - * @file group.h Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_GROUP_H_ -#define _MSN_GROUP_H_ - -typedef struct _MsnGroup MsnGroup; - -#include <stdio.h> - -#include "session.h" -#include "user.h" -#include "userlist.h" - -#define MSN_INDIVIDUALS_GROUP_ID "1983" -#define MSN_INDIVIDUALS_GROUP_NAME _("Other Contacts") - -#define MSN_NON_IM_GROUP_ID "email" -#define MSN_NON_IM_GROUP_NAME _("Non-IM Contacts") - -/** - * A group. - */ -struct _MsnGroup -{ - MsnSession *session; /**< The MSN session. */ - - char *id; /**< The group ID. */ - char *name; /**< The name of the group. */ -}; - -/************************************************************************** - ** @name Group API * - **************************************************************************/ -/*@{*/ - -/** - * Creates a new group structure. - * - * @param session The MSN session. - * @param id The group ID. - * @param name The name of the group. - * - * @return A new group structure. - */ -MsnGroup *msn_group_new(MsnUserList *userlist, const char *id, const char *name); - -/** - * Destroys a group structure. - * - * @param group The group to destroy. - */ -void msn_group_destroy(MsnGroup *group); - -/** - * Sets the ID for a group. - * - * @param group The group. - * @param id The ID. - */ -void msn_group_set_id(MsnGroup *group, const char *id); - -/** - * Sets the name for a group. - * - * @param group The group. - * @param name The name. - */ -void msn_group_set_name(MsnGroup *group, const char *name); - -/** - * Returns the ID for a group. - * - * @param group The group. - * - * @return The ID. - */ -char* msn_group_get_id(const MsnGroup *group); - -/** - * Returns the name for a group. - * - * @param group The group. - * - * @return The name. - */ -const char *msn_group_get_name(const MsnGroup *group); - -#endif /* _MSN_GROUP_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file history.c MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "history.h" - -MsnHistory * -msn_history_new(void) -{ - MsnHistory *history = g_new0(MsnHistory, 1); - - history->trId = 1; - - history->queue = g_queue_new(); - - return history; -} - -void -msn_history_destroy(MsnHistory *history) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(history->queue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(history->queue); - g_free(history); -} - -MsnTransaction * -msn_history_find(MsnHistory *history, unsigned int trId) -{ - MsnTransaction *trans; - GList *list; - - for (list = history->queue->head; list != NULL; list = list->next) - { - trans = list->data; - if (trans->trId == trId) - return trans; - } - - return NULL; -} - -void -msn_history_add(MsnHistory *history, MsnTransaction *trans) -{ - GQueue *queue; - int max_elems; - - g_return_if_fail(history != NULL); - g_return_if_fail(trans != NULL); - - queue = history->queue; - - trans->trId = history->trId++; - - g_queue_push_tail(queue, trans); - - if (trans->cmdproc->servconn->type == MSN_SERVCONN_NS) - max_elems = MSN_NS_HIST_ELEMS; - else - max_elems = MSN_SB_HIST_ELEMS; - - if (queue->length > max_elems) - { - trans = g_queue_pop_head(queue); - msn_transaction_destroy(trans); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/history.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file history.h MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_HISTORY_H -#define _MSN_HISTORY_H - -#define MSN_NS_HIST_ELEMS 0x300 -#define MSN_SB_HIST_ELEMS 0x30 - -typedef struct _MsnHistory MsnHistory; - -#include "transaction.h" - -/** - * The history. - */ -struct _MsnHistory -{ - GQueue *queue; - unsigned int trId; -}; - -MsnHistory *msn_history_new(void); -void msn_history_destroy(MsnHistory *history); -MsnTransaction *msn_history_find(MsnHistory *history, unsigned int triId); -void msn_history_add(MsnHistory *history, MsnTransaction *trans); - -#endif /* _MSN_HISTORY_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,737 +0,0 @@ -/** - * @file httpmethod.c HTTP connection method - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "debug.h" -#include "httpconn.h" - -typedef struct -{ - MsnHttpConn *httpconn; - char *body; - size_t body_len; -} MsnHttpQueueData; - -static void -msn_httpconn_process_queue(MsnHttpConn *httpconn) -{ - httpconn->waiting_response = FALSE; - - if (httpconn->queue != NULL) - { - MsnHttpQueueData *queue_data; - - queue_data = (MsnHttpQueueData *)httpconn->queue->data; - - httpconn->queue = g_list_remove(httpconn->queue, queue_data); - - msn_httpconn_write(queue_data->httpconn, - queue_data->body, - queue_data->body_len); - - g_free(queue_data->body); - g_free(queue_data); - } -} - -static gboolean -msn_httpconn_parse_data(MsnHttpConn *httpconn, const char *buf, - size_t size, char **ret_buf, size_t *ret_size, - gboolean *error) -{ - const char *s, *c; - char *header, *body; - const char *body_start; - char *tmp; - size_t body_len = 0; - - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(buf != NULL, FALSE); - g_return_val_if_fail(size > 0, FALSE); - g_return_val_if_fail(ret_buf != NULL, FALSE); - g_return_val_if_fail(ret_size != NULL, FALSE); - g_return_val_if_fail(error != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "HTTP: parsing data {%s}\n", buf); -#endif - - /* Healthy defaults. */ - body = NULL; - - *ret_buf = NULL; - *ret_size = 0; - *error = FALSE; - - /* First, some tests to see if we have a full block of stuff. */ - if (((strncmp(buf, "HTTP/1.1 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) != 0)) && - ((strncmp(buf, "HTTP/1.0 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.0 100 Continue\r\n", 23) != 0))) - { - *error = TRUE; - - return FALSE; - } - - if (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) == 0) - { - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - return FALSE; - - s += 4; - - if (*s == '\0') - { - *ret_buf = g_strdup(""); - *ret_size = 0; - - msn_httpconn_process_queue(httpconn); - - return TRUE; - } - - buf = s; - size -= (s - buf); - } - - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - /* Need to wait for the full HTTP header to arrive */ - return FALSE; - - s += 4; /* Skip \r\n\r\n */ - header = g_strndup(buf, s - buf); - body_start = s; - body_len = size - (body_start - buf); - - if ((s = purple_strcasestr(header, "Content-Length: ")) != NULL) - { - int tmp_len; - - s += strlen("Content-Length: "); - - if ((c = strchr(s, '\r')) == NULL) - { - g_free(header); - - return FALSE; - } - - tmp = g_strndup(s, c - s); - tmp_len = atoi(tmp); - g_free(tmp); - - if (body_len != tmp_len) - { - /* Need to wait for the full packet to arrive */ - - g_free(header); - -#if 0 - purple_debug_warning("msn", - "body length (%d) != content length (%d)\n", - body_len, tmp_len); -#endif - - return FALSE; - } - } - - body = g_malloc(body_len + 1); - memcpy(body, body_start, body_len); - body[body_len] = '\0'; - - if (purple_debug_is_verbose()) - purple_debug_misc("msn", "Incoming HTTP buffer (header): {%s}\n", - header); - - /* Now we should be able to process the data. */ - if ((s = purple_strcasestr(header, "X-MSN-Messenger: ")) != NULL) - { - gchar *full_session_id = NULL, *gw_ip = NULL, *session_action = NULL; - char *t, *session_id; - char **elems, **cur, **tokens; - - full_session_id = gw_ip = session_action = NULL; - - s += strlen("X-MSN-Messenger: "); - - if ((c = strchr(s, '\r')) == NULL) - { - msn_session_set_error(httpconn->session, - MSN_ERROR_HTTP_MALFORMED, NULL); - purple_debug_error("msn", "Malformed X-MSN-Messenger field.\n{%s}\n", - buf); - - g_free(header); - g_free(body); - return FALSE; - } - - tmp = g_strndup(s, c - s); - - elems = g_strsplit(tmp, "; ", 0); - - for (cur = elems; *cur != NULL; cur++) - { - tokens = g_strsplit(*cur, "=", 2); - - if (strcmp(tokens[0], "SessionID") == 0) { - g_free(full_session_id); - full_session_id = tokens[1]; - } else if (strcmp(tokens[0], "GW-IP") == 0) { - g_free(gw_ip); - gw_ip = tokens[1]; - } else if (strcmp(tokens[0], "Session") == 0) { - g_free(session_action); - session_action = tokens[1]; - } else - g_free(tokens[1]); - - g_free(tokens[0]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - g_free(tmp); - - t = strchr(full_session_id, '.'); - if (t != NULL) - session_id = g_strndup(full_session_id, t - full_session_id); - else { - purple_debug_error("msn", "Malformed full_session_id[%s]\n", - full_session_id ? full_session_id : NULL); - session_id = g_strdup(full_session_id); - } - - if (session_action == NULL || strcmp(session_action, "close") != 0) - { - g_free(httpconn->full_session_id); - httpconn->full_session_id = full_session_id; - - g_free(httpconn->session_id); - httpconn->session_id = session_id; - - g_free(httpconn->host); - httpconn->host = gw_ip; - } - else - { - MsnServConn *servconn; - - /* It's going to die. */ - /* poor thing */ - - servconn = httpconn->servconn; - - /* I'll be honest, I don't fully understand all this, but this - * causes crashes, Stu. */ - /* if (servconn != NULL) - servconn->wasted = TRUE; */ - - g_free(full_session_id); - g_free(session_id); - g_free(gw_ip); - } - - g_free(session_action); - } - - g_free(header); - - *ret_buf = body; - *ret_size = body_len; - - msn_httpconn_process_queue(httpconn); - - return TRUE; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - MsnServConn *servconn; - char buf[MSN_BUF_LEN]; - gssize len; - char *result_msg = NULL; - size_t result_len = 0; - gboolean error = FALSE; - - httpconn = data; - servconn = httpconn->servconn; - - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); - - len = read(httpconn->fd, buf, sizeof(buf) - 1); - if (len < 0 && errno == EAGAIN) - return; - if (len <= 0) { - purple_debug_error("msn", "HTTP: servconn %03d read error, " - "len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n", - servconn->num, len, error, g_strerror(errno)); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - buf[len] = '\0'; - - httpconn->rx_buf = g_realloc(httpconn->rx_buf, len + httpconn->rx_len + 1); - memcpy(httpconn->rx_buf + httpconn->rx_len, buf, len + 1); - httpconn->rx_len += len; - - if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len, - &result_msg, &result_len, &error)) - { - /* Either we must wait for more input, or something went wrong */ - if (error) - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - if (error) - { - purple_debug_error("msn", "HTTP: Special error\n"); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - if (result_len == 0) - { - /* Nothing to do here */ -#if 0 - purple_debug_info("msn", "HTTP: nothing to do here\n"); -#endif - g_free(result_msg); - return; - } - - g_free(servconn->rx_buf); - servconn->rx_buf = result_msg; - servconn->rx_len = result_len; - - msn_servconn_process_data(servconn); -} - -static void -httpconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - gssize ret; - int writelen; - - httpconn = data; - writelen = purple_circ_buffer_get_max_read(httpconn->tx_buf); - - if (writelen == 0) - { - purple_input_remove(httpconn->tx_handler); - httpconn->tx_handler = 0; - return; - } - - ret = write(httpconn->fd, httpconn->tx_buf->outptr, writelen); - if (ret <= 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - /* Error! */ - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - return; - } - - purple_circ_buffer_mark_read(httpconn->tx_buf, ret); - - /* TODO: I don't think these 2 lines are needed. Remove them? */ - if (ret == writelen) - httpconn_write_cb(data, source, cond); -} - -static gboolean -write_raw(MsnHttpConn *httpconn, const char *data, size_t data_len) -{ - gssize res; /* result of the write operation */ - - if (httpconn->tx_handler == 0) - res = write(httpconn->fd, data, data_len); - else - { - res = -1; - errno = EAGAIN; - } - - if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) - { - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - return FALSE; - } - - if (res < 0 || res < data_len) - { - if (res < 0) - res = 0; - if (httpconn->tx_handler == 0 && httpconn->fd) - httpconn->tx_handler = purple_input_add(httpconn->fd, - PURPLE_INPUT_WRITE, httpconn_write_cb, httpconn); - purple_circ_buffer_append(httpconn->tx_buf, data + res, - data_len - res); - } - - return TRUE; -} - -static char * -msn_httpconn_proxy_auth(MsnHttpConn *httpconn) -{ - PurpleAccount *account; - PurpleProxyInfo *gpi; - const char *username, *password; - char *auth = NULL; - - account = httpconn->session->account; - - gpi = purple_proxy_get_setup(account); - - if (gpi == NULL || !(purple_proxy_info_get_type(gpi) == PURPLE_PROXY_HTTP || - purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_ENVVAR)) - return NULL; - - username = purple_proxy_info_get_username(gpi); - password = purple_proxy_info_get_password(gpi); - - if (username != NULL) { - char *tmp; - auth = g_strdup_printf("%s:%s", username, password ? password : ""); - tmp = purple_base64_encode((const guchar *)auth, strlen(auth)); - g_free(auth); - auth = g_strdup_printf("Proxy-Authorization: Basic %s\r\n", tmp); - g_free(tmp); - } - - return auth; -} - -static gboolean -msn_httpconn_poll(gpointer data) -{ - MsnHttpConn *httpconn; - char *header; - char *auth; - - httpconn = data; - - g_return_val_if_fail(httpconn != NULL, FALSE); - - if ((httpconn->host == NULL) || (httpconn->full_session_id == NULL)) - { - /* There's no need to poll if the session is not fully established */ - return TRUE; - } - - if (httpconn->waiting_response) - { - /* There's no need to poll if we're already waiting for a response */ - return TRUE; - } - - auth = msn_httpconn_proxy_auth(httpconn); - - header = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?Action=poll&SessionID=%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: 0\r\n\r\n", - httpconn->host, - httpconn->full_session_id, - httpconn->host, - auth ? auth : ""); - - g_free(auth); - - if (write_raw(httpconn, header, strlen(header))) - httpconn->waiting_response = TRUE; - - g_free(header); - - return TRUE; -} - -gssize -msn_httpconn_write(MsnHttpConn *httpconn, const char *body, size_t body_len) -{ - char *params; - char *data; - int header_len; - char *auth; - const char *server_types[] = { "NS", "SB" }; - const char *server_type; - char *host; - MsnServConn *servconn; - - /* TODO: remove http data from servconn */ - - g_return_val_if_fail(httpconn != NULL, 0); - g_return_val_if_fail(body != NULL, 0); - g_return_val_if_fail(body_len > 0, 0); - - servconn = httpconn->servconn; - - if (httpconn->waiting_response) - { - MsnHttpQueueData *queue_data = g_new0(MsnHttpQueueData, 1); - - queue_data->httpconn = httpconn; - queue_data->body = g_memdup(body, body_len); - queue_data->body_len = body_len; - - httpconn->queue = g_list_append(httpconn->queue, queue_data); - - return body_len; - } - - server_type = server_types[servconn->type]; - - if (httpconn->virgin) - { - /* QuLogic: This doesn't look right to me, but it still seems to work */ - host = MSN_HTTPCONN_SERVER; - - /* The first time servconn->host is the host we should connect to. */ - params = g_strdup_printf("Action=open&Server=%s&IP=%s", - server_type, - servconn->host); - httpconn->virgin = FALSE; - } - else - { - /* The rest of the times servconn->host is the gateway host. */ - host = httpconn->host; - - if (host == NULL || httpconn->full_session_id == NULL) - { - purple_debug_warning("msn", "Attempted HTTP write before session is established\n"); - return -1; - } - - params = g_strdup_printf("SessionID=%s", - httpconn->full_session_id); - } - - auth = msn_httpconn_proxy_auth(httpconn); - - data = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: %d\r\n\r\n", - host, - params, - host, - auth ? auth : "", - (int) body_len); - - g_free(params); - - g_free(auth); - - header_len = strlen(data); - data = g_realloc(data, header_len + body_len); - memcpy(data + header_len, body, body_len); - - if (write_raw(httpconn, data, header_len + body_len)) - httpconn->waiting_response = TRUE; - - g_free(data); - - return body_len; -} - -MsnHttpConn * -msn_httpconn_new(MsnServConn *servconn) -{ - MsnHttpConn *httpconn; - - g_return_val_if_fail(servconn != NULL, NULL); - - httpconn = g_new0(MsnHttpConn, 1); - - purple_debug_info("msn", "new httpconn (%p)\n", httpconn); - - /* TODO: Remove this */ - httpconn->session = servconn->session; - - httpconn->servconn = servconn; - - httpconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - httpconn->tx_handler = 0; - - httpconn->fd = -1; - - return httpconn; -} - -void -msn_httpconn_destroy(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - purple_debug_info("msn", "destroy httpconn (%p)\n", httpconn); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - g_free(httpconn->full_session_id); - - g_free(httpconn->session_id); - - g_free(httpconn->host); - - while (httpconn->queue != NULL) { - MsnHttpQueueData *queue_data; - - queue_data = (MsnHttpQueueData *) httpconn->queue->data; - - httpconn->queue = g_list_delete_link(httpconn->queue, httpconn->queue); - - g_free(queue_data->body); - g_free(queue_data); - } - - purple_circ_buffer_destroy(httpconn->tx_buf); - if (httpconn->tx_handler > 0) - purple_input_remove(httpconn->tx_handler); - - g_free(httpconn); -} - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - MsnHttpConn *httpconn; - - httpconn = data; - httpconn->connect_data = NULL; - httpconn->fd = source; - - if (source >= 0) - { - httpconn->inpa = purple_input_add(httpconn->fd, PURPLE_INPUT_READ, - read_cb, data); - - httpconn->timer = purple_timeout_add_seconds(2, msn_httpconn_poll, httpconn); - - msn_httpconn_process_queue(httpconn); - } - else - { - purple_debug_error("msn", "HTTP: Connection error: %s\n", - error_message ? error_message : "(null)"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT, error_message); - } -} - -gboolean -msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port) -{ - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - httpconn->connect_data = purple_proxy_connect(NULL, httpconn->session->account, - host, 80, connect_cb, httpconn); - - if (httpconn->connect_data != NULL) - { - httpconn->waiting_response = TRUE; - httpconn->connected = TRUE; - } - - return httpconn->connected; -} - -void -msn_httpconn_disconnect(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - if (!httpconn->connected) - return; - - if (httpconn->connect_data != NULL) - { - purple_proxy_connect_cancel(httpconn->connect_data); - httpconn->connect_data = NULL; - } - - if (httpconn->timer) - { - purple_timeout_remove(httpconn->timer); - httpconn->timer = 0; - } - - if (httpconn->inpa > 0) - { - purple_input_remove(httpconn->inpa); - httpconn->inpa = 0; - } - - close(httpconn->fd); - httpconn->fd = -1; - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - httpconn->connected = FALSE; - - /* msn_servconn_disconnect(httpconn->servconn); */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/httpconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/** - * @file httpconn.h HTTP connection - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_HTTPCONN_H_ -#define _MSN_HTTPCONN_H_ - -typedef struct _MsnHttpConn MsnHttpConn; - -#include "circbuffer.h" -#include "servconn.h" - -/** - * An HTTP Connection. - */ -struct _MsnHttpConn -{ - MsnSession *session; /**< The MSN Session. */ - MsnServConn *servconn; /**< The connection object. */ - - PurpleProxyConnectData *connect_data; - - char *full_session_id; /**< The full session id. */ - char *session_id; /**< The trimmed session id. */ - - int timer; /**< The timer for polling. */ - - gboolean waiting_response; /**< The flag that states if we are waiting - a response from the server. */ - gboolean connected; /**< The flag that states if the connection is on. */ - gboolean virgin; /**< The flag that states if this connection - should specify the host (not gateway) to - connect to. */ - - char *host; /**< The HTTP gateway host. */ - GList *queue; /**< The queue of data chunks to write. */ - - int fd; /**< The connection's file descriptor. */ - guint inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer length. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; -}; - -/** - * Creates a new HTTP connection object. - * - * @param servconn The connection object. - * - * @return The new object. - */ -MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); - -/** - * Destroys an HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_destroy(MsnHttpConn *httpconn); - -/** - * Writes a chunk of data to the HTTP connection. - * - * @param servconn The server connection. - * @param data The data to write. - * @param data_len The size of the data to write. - * - * @return The number of bytes written. - */ -gssize msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len); - -/** - * Connects the HTTP connection object to a host. - * - * @param httpconn The HTTP connection object. - * @param host The host to connect to. - * @param port The port to connect to. - */ -gboolean msn_httpconn_connect(MsnHttpConn *httpconn, - const char *host, int port); - -/** - * Disconnects the HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_disconnect(MsnHttpConn *httpconn); - -#endif /* _MSN_HTTPCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -EXTRA_DIST = \ - directconn.c \ - directconn.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MSNSOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - contact.c\ - contact.h\ - dialog.c \ - dialog.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - oim.c\ - oim.h\ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - soap.c \ - soap.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msnutils.c \ - msnutils.h - -AM_CFLAGS = $(st) - -libmsn_la_LDFLAGS = -module -avoid-version - -if STATIC_MSN - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNSOURCES) -libmsn_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNSOURCES) -libmsn_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1049 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/msn -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MSN_FALSE@libmsn_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libmsn_la_SOURCES_DIST = cmdproc.c cmdproc.h command.c command.h \ - contact.c contact.h dialog.c dialog.h error.c error.h group.c \ - group.h history.c history.h httpconn.c httpconn.h msg.c msg.h \ - msn.c msn.h nexus.c nexus.h notification.c notification.h \ - object.c object.h oim.c oim.h page.c page.h servconn.c \ - servconn.h session.c session.h slp.c slp.h slpcall.c slpcall.h \ - slplink.c slplink.h slpmsg.c slpmsg.h soap.c soap.h state.c \ - state.h switchboard.c switchboard.h sync.c sync.h table.c \ - table.h transaction.c transaction.h user.c user.h userlist.c \ - userlist.h msnutils.c msnutils.h -am__objects_1 = libmsn_la-cmdproc.lo libmsn_la-command.lo \ - libmsn_la-contact.lo libmsn_la-dialog.lo libmsn_la-error.lo \ - libmsn_la-group.lo libmsn_la-history.lo libmsn_la-httpconn.lo \ - libmsn_la-msg.lo libmsn_la-msn.lo libmsn_la-nexus.lo \ - libmsn_la-notification.lo libmsn_la-object.lo libmsn_la-oim.lo \ - libmsn_la-page.lo libmsn_la-servconn.lo libmsn_la-session.lo \ - libmsn_la-slp.lo libmsn_la-slpcall.lo libmsn_la-slplink.lo \ - libmsn_la-slpmsg.lo libmsn_la-soap.lo libmsn_la-state.lo \ - libmsn_la-switchboard.lo libmsn_la-sync.lo libmsn_la-table.lo \ - libmsn_la-transaction.lo libmsn_la-user.lo \ - libmsn_la-userlist.lo libmsn_la-msnutils.lo -@STATIC_MSN_FALSE@am_libmsn_la_OBJECTS = $(am__objects_1) -@STATIC_MSN_TRUE@am_libmsn_la_OBJECTS = $(am__objects_1) -libmsn_la_OBJECTS = $(am_libmsn_la_OBJECTS) -@STATIC_MSN_FALSE@am_libmsn_la_rpath = -rpath $(pkgdir) -@STATIC_MSN_TRUE@am_libmsn_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmsn_la_SOURCES) -DIST_SOURCES = $(am__libmsn_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - directconn.c \ - directconn.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MSNSOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - contact.c\ - contact.h\ - dialog.c \ - dialog.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - oim.c\ - oim.h\ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - soap.c \ - soap.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msnutils.c \ - msnutils.h - -AM_CFLAGS = $(st) -libmsn_la_LDFLAGS = -module -avoid-version -@STATIC_MSN_FALSE@st = -@STATIC_MSN_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MSN_TRUE@noinst_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_SOURCES = $(MSNSOURCES) -@STATIC_MSN_TRUE@libmsn_la_SOURCES = $(MSNSOURCES) -@STATIC_MSN_TRUE@libmsn_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MSN_FALSE@pkg_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/msn/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/msn/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmsn.la: $(libmsn_la_OBJECTS) $(libmsn_la_DEPENDENCIES) - $(LINK) $(am_libmsn_la_rpath) $(libmsn_la_LDFLAGS) $(libmsn_la_OBJECTS) $(libmsn_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-cmdproc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-command.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-contact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-dialog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-history.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-httpconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msnutils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-nexus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-notification.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-oim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-page.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-servconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpcall.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slplink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpmsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-soap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-state.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-switchboard.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-sync.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-table.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-transaction.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-userlist.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmsn_la-cmdproc.lo: cmdproc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-cmdproc.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-cmdproc.Tpo" -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo" "$(DEPDIR)/libmsn_la-cmdproc.Plo"; else rm -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdproc.c' object='libmsn_la-cmdproc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c - -libmsn_la-command.lo: command.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-command.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-command.Tpo" -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-command.Tpo" "$(DEPDIR)/libmsn_la-command.Plo"; else rm -f "$(DEPDIR)/libmsn_la-command.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='command.c' object='libmsn_la-command.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c - -libmsn_la-contact.lo: contact.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-contact.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-contact.Tpo" -c -o libmsn_la-contact.lo `test -f 'contact.c' || echo '$(srcdir)/'`contact.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-contact.Tpo" "$(DEPDIR)/libmsn_la-contact.Plo"; else rm -f "$(DEPDIR)/libmsn_la-contact.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='contact.c' object='libmsn_la-contact.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-contact.lo `test -f 'contact.c' || echo '$(srcdir)/'`contact.c - -libmsn_la-dialog.lo: dialog.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-dialog.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-dialog.Tpo" -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-dialog.Tpo" "$(DEPDIR)/libmsn_la-dialog.Plo"; else rm -f "$(DEPDIR)/libmsn_la-dialog.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dialog.c' object='libmsn_la-dialog.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c - -libmsn_la-error.lo: error.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-error.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-error.Tpo" -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-error.Tpo" "$(DEPDIR)/libmsn_la-error.Plo"; else rm -f "$(DEPDIR)/libmsn_la-error.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libmsn_la-error.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c - -libmsn_la-group.lo: group.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-group.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-group.Tpo" -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-group.Tpo" "$(DEPDIR)/libmsn_la-group.Plo"; else rm -f "$(DEPDIR)/libmsn_la-group.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group.c' object='libmsn_la-group.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c - -libmsn_la-history.lo: history.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-history.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-history.Tpo" -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-history.Tpo" "$(DEPDIR)/libmsn_la-history.Plo"; else rm -f "$(DEPDIR)/libmsn_la-history.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='history.c' object='libmsn_la-history.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c - -libmsn_la-httpconn.lo: httpconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-httpconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-httpconn.Tpo" -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-httpconn.Tpo" "$(DEPDIR)/libmsn_la-httpconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-httpconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='httpconn.c' object='libmsn_la-httpconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c - -libmsn_la-msg.lo: msg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msg.Tpo" -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msg.Tpo" "$(DEPDIR)/libmsn_la-msg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msg.c' object='libmsn_la-msg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c - -libmsn_la-msn.lo: msn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msn.Tpo" -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msn.Tpo" "$(DEPDIR)/libmsn_la-msn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msn.c' object='libmsn_la-msn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c - -libmsn_la-nexus.lo: nexus.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-nexus.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-nexus.Tpo" -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-nexus.Tpo" "$(DEPDIR)/libmsn_la-nexus.Plo"; else rm -f "$(DEPDIR)/libmsn_la-nexus.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nexus.c' object='libmsn_la-nexus.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c - -libmsn_la-notification.lo: notification.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-notification.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-notification.Tpo" -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-notification.Tpo" "$(DEPDIR)/libmsn_la-notification.Plo"; else rm -f "$(DEPDIR)/libmsn_la-notification.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='notification.c' object='libmsn_la-notification.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c - -libmsn_la-object.lo: object.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-object.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-object.Tpo" -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-object.Tpo" "$(DEPDIR)/libmsn_la-object.Plo"; else rm -f "$(DEPDIR)/libmsn_la-object.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='object.c' object='libmsn_la-object.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c - -libmsn_la-oim.lo: oim.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-oim.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-oim.Tpo" -c -o libmsn_la-oim.lo `test -f 'oim.c' || echo '$(srcdir)/'`oim.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-oim.Tpo" "$(DEPDIR)/libmsn_la-oim.Plo"; else rm -f "$(DEPDIR)/libmsn_la-oim.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oim.c' object='libmsn_la-oim.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-oim.lo `test -f 'oim.c' || echo '$(srcdir)/'`oim.c - -libmsn_la-page.lo: page.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-page.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-page.Tpo" -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-page.Tpo" "$(DEPDIR)/libmsn_la-page.Plo"; else rm -f "$(DEPDIR)/libmsn_la-page.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='page.c' object='libmsn_la-page.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c - -libmsn_la-servconn.lo: servconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-servconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-servconn.Tpo" -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-servconn.Tpo" "$(DEPDIR)/libmsn_la-servconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-servconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='servconn.c' object='libmsn_la-servconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c - -libmsn_la-session.lo: session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-session.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-session.Tpo" -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-session.Tpo" "$(DEPDIR)/libmsn_la-session.Plo"; else rm -f "$(DEPDIR)/libmsn_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='session.c' object='libmsn_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmsn_la-slp.lo: slp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slp.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slp.Tpo" -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slp.Tpo" "$(DEPDIR)/libmsn_la-slp.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slp.c' object='libmsn_la-slp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c - -libmsn_la-slpcall.lo: slpcall.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpcall.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpcall.Tpo" -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpcall.Tpo" "$(DEPDIR)/libmsn_la-slpcall.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpcall.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpcall.c' object='libmsn_la-slpcall.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c - -libmsn_la-slplink.lo: slplink.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slplink.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slplink.Tpo" -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slplink.Tpo" "$(DEPDIR)/libmsn_la-slplink.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slplink.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slplink.c' object='libmsn_la-slplink.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c - -libmsn_la-slpmsg.lo: slpmsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpmsg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpmsg.Tpo" -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo" "$(DEPDIR)/libmsn_la-slpmsg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpmsg.c' object='libmsn_la-slpmsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c - -libmsn_la-soap.lo: soap.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-soap.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-soap.Tpo" -c -o libmsn_la-soap.lo `test -f 'soap.c' || echo '$(srcdir)/'`soap.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-soap.Tpo" "$(DEPDIR)/libmsn_la-soap.Plo"; else rm -f "$(DEPDIR)/libmsn_la-soap.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='soap.c' object='libmsn_la-soap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-soap.lo `test -f 'soap.c' || echo '$(srcdir)/'`soap.c - -libmsn_la-state.lo: state.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-state.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-state.Tpo" -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-state.Tpo" "$(DEPDIR)/libmsn_la-state.Plo"; else rm -f "$(DEPDIR)/libmsn_la-state.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='state.c' object='libmsn_la-state.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c - -libmsn_la-switchboard.lo: switchboard.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-switchboard.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-switchboard.Tpo" -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-switchboard.Tpo" "$(DEPDIR)/libmsn_la-switchboard.Plo"; else rm -f "$(DEPDIR)/libmsn_la-switchboard.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='switchboard.c' object='libmsn_la-switchboard.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c - -libmsn_la-sync.lo: sync.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-sync.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-sync.Tpo" -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-sync.Tpo" "$(DEPDIR)/libmsn_la-sync.Plo"; else rm -f "$(DEPDIR)/libmsn_la-sync.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sync.c' object='libmsn_la-sync.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c - -libmsn_la-table.lo: table.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-table.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-table.Tpo" -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-table.Tpo" "$(DEPDIR)/libmsn_la-table.Plo"; else rm -f "$(DEPDIR)/libmsn_la-table.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='table.c' object='libmsn_la-table.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c - -libmsn_la-transaction.lo: transaction.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-transaction.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-transaction.Tpo" -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-transaction.Tpo" "$(DEPDIR)/libmsn_la-transaction.Plo"; else rm -f "$(DEPDIR)/libmsn_la-transaction.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transaction.c' object='libmsn_la-transaction.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c - -libmsn_la-user.lo: user.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-user.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-user.Tpo" -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-user.Tpo" "$(DEPDIR)/libmsn_la-user.Plo"; else rm -f "$(DEPDIR)/libmsn_la-user.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='user.c' object='libmsn_la-user.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c - -libmsn_la-userlist.lo: userlist.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-userlist.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-userlist.Tpo" -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-userlist.Tpo" "$(DEPDIR)/libmsn_la-userlist.Plo"; else rm -f "$(DEPDIR)/libmsn_la-userlist.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='userlist.c' object='libmsn_la-userlist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c - -libmsn_la-msnutils.lo: msnutils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msnutils.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msnutils.Tpo" -c -o libmsn_la-msnutils.lo `test -f 'msnutils.c' || echo '$(srcdir)/'`msnutils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msnutils.Tpo" "$(DEPDIR)/libmsn_la-msnutils.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msnutils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msnutils.c' object='libmsn_la-msnutils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msnutils.lo `test -f 'msnutils.c' || echo '$(srcdir)/'`msnutils.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmsn -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmsn -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = cmdproc.c \ - command.c \ - contact.c\ - dialog.c \ - error.c \ - group.c \ - history.c \ - httpconn.c \ - msg.c \ - msn.c \ - nexus.c \ - notification.c \ - object.c \ - oim.c\ - page.c \ - servconn.c \ - session.c \ - slp.c \ - slpcall.c \ - slplink.c \ - slpmsg.c \ - soap.c\ - state.c \ - switchboard.c \ - sync.c \ - table.c \ - transaction.c \ - user.c \ - userlist.c \ - msnutils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1204 +0,0 @@ -/** - * @file msg.c Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msg.h" -#include "msnutils.h" - -MsnMessage * -msn_message_new(MsnMsgType type) -{ - MsnMessage *msg; - - msg = g_new0(MsnMessage, 1); - msg->type = type; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); - - msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - msn_message_ref(msg); - - return msg; -} - -void -msn_message_destroy(MsnMessage *msg) -{ - g_return_if_fail(msg != NULL); - - if (msg->ref_count > 0) - { - msn_message_unref(msg); - - return; - } - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message destroy (%p)\n", msg); - - g_free(msg->remote_user); - g_free(msg->body); - g_free(msg->content_type); - g_free(msg->charset); - - g_hash_table_destroy(msg->attr_table); - g_list_free(msg->attr_list); - - g_free(msg); -} - -MsnMessage * -msn_message_ref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - msg->ref_count++; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); - - return msg; -} - -MsnMessage * -msn_message_unref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->ref_count > 0, NULL); - - msg->ref_count--; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); - - if (msg->ref_count == 0) - { - msn_message_destroy(msg); - - return NULL; - } - - return msg; -} - -MsnMessage * -msn_message_new_plain(const char *message) -{ - MsnMessage *msg; - char *message_cr; - - msg = msn_message_new(MSN_MSG_TEXT); - msg->retries = 1; - msn_message_set_attr(msg, "User-Agent", PACKAGE_NAME "/" VERSION); - msn_message_set_content_type(msg, "text/plain"); - msn_message_set_charset(msg, "UTF-8"); - msn_message_set_flag(msg, 'A'); - msn_message_set_attr(msg, "X-MMS-IM-Format", - "FN=Segoe%20UI; EF=; CO=0; CS=1;PF=0"); - - message_cr = purple_str_add_cr(message); - msn_message_set_bin_data(msg, message_cr, strlen(message_cr)); - g_free(message_cr); - - return msg; -} - -MsnMessage * -msn_message_new_msnslp(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_SLP); - - msn_message_set_attr(msg, "User-Agent", NULL); - - msg->msnslp_message = TRUE; - - msn_message_set_flag(msg, 'D'); - msn_message_set_content_type(msg, "application/x-msnmsgrp2p"); - - return msg; -} - -MsnMessage * -msn_message_new_nudge(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_NUDGE); - msn_message_set_content_type(msg, "text/x-msnmsgr-datacast"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, "ID: 1\r\n", 7); - - return msg; -} - -void -msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) -{ - MsnSlpHeader header; - const char *tmp; - int body_len; - - tmp = body; - - if (len < sizeof(header)) { - g_return_if_reached(); - } - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - /* Import the body. */ - body_len = len - (tmp - body); - /* msg->body_len = msg->msnslp_header.length; */ - - if (body_len > 0) { - msg->body_len = len - (tmp - body); - msg->body = g_malloc(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - msg->body[msg->body_len] = '\0'; - tmp += body_len; - } -} - -void -msn_message_parse_payload(MsnMessage *msg, - const char *payload, size_t payload_len, - const char *line_dem,const char *body_dem) -{ - char *tmp_base, *tmp; - const char *content_type; - char *end; - char **elems, **cur, **tokens; - - g_return_if_fail(payload != NULL); - tmp_base = tmp = g_malloc(payload_len + 1); - memcpy(tmp_base, payload, payload_len); - tmp_base[payload_len] = '\0'; - - /* Parse the attributes. */ - end = strstr(tmp, body_dem); - /* TODO? some clients use \r delimiters instead of \r\n, the official client - * doesn't send such messages, but does handle receiving them. We'll just - * avoid crashing for now */ - if (end == NULL) { - g_free(tmp_base); - g_return_if_reached(); - } - *end = '\0'; - - elems = g_strsplit(tmp, line_dem, 0); - - for (cur = elems; *cur != NULL; cur++) - { - const char *key, *value; - - /* If this line starts with whitespace, it's been folded from the - previous line and won't have ':'. */ - if ((**cur == ' ') || (**cur == '\t')) { - tokens = g_strsplit(g_strchug(*cur), "=\"", 2); - key = tokens[0]; - value = tokens[1]; - - /* The only one I care about is 'boundary' (which is folded from - the key 'Content-Type'), so only process that. */ - if (!strcmp(key, "boundary")) { - char *end = strchr(value, '\"'); - *end = '\0'; - msn_message_set_attr(msg, key, value); - } - - g_strfreev(tokens); - continue; - } - - tokens = g_strsplit(*cur, ": ", 2); - - key = tokens[0]; - value = tokens[1]; - - /*if not MIME content ,then return*/ - if (!strcmp(key, "MIME-Version")) - { - g_strfreev(tokens); - continue; - } - - if (!strcmp(key, "Content-Type")) - { - char *charset, *c; - - if ((c = strchr(value, ';')) != NULL) - { - if ((charset = strchr(c, '=')) != NULL) - { - charset++; - msn_message_set_charset(msg, charset); - } - - *c = '\0'; - } - - msn_message_set_content_type(msg, value); - } - else - { - msn_message_set_attr(msg, key, value); - } - - g_strfreev(tokens); - } - - g_strfreev(elems); - - /* Proceed to the end of the "\r\n\r\n" */ - tmp = end + strlen(body_dem); - - /* Now we *should* be at the body. */ - content_type = msn_message_get_content_type(msg); - - if (content_type != NULL && - !strcmp(content_type, "application/x-msnmsgrp2p")) - { - MsnSlpHeader header; - MsnSlpFooter footer; - int body_len; - - if (payload_len - (tmp - tmp_base) < sizeof(header)) { - g_free(tmp_base); - g_return_if_reached(); - } - - msg->msnslp_message = TRUE; - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - body_len = payload_len - (tmp - tmp_base) - sizeof(footer); - - /* Import the body. */ - if (body_len > 0) { - msg->body_len = body_len; - g_free(msg->body); - msg->body = g_malloc(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - msg->body[msg->body_len] = '\0'; - tmp += body_len; - } - - /* Import the footer. */ - if (body_len >= 0) { - memcpy(&footer, tmp, sizeof(footer)); - tmp += sizeof(footer); - msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); - } - } - else - { - if (payload_len - (tmp - tmp_base) > 0) { - msg->body_len = payload_len - (tmp - tmp_base); - g_free(msg->body); - msg->body = g_malloc(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - msg->body[msg->body_len] = '\0'; - } - - if ((!content_type || !strcmp(content_type, "text/plain")) - && msg->charset == NULL) { - char *body = g_convert(msg->body, msg->body_len, "UTF-8", - "ISO-8859-1", NULL, &msg->body_len, NULL); - g_free(msg->body); - msg->body = body; - msg->charset = g_strdup("UTF-8"); - } - } - - g_free(tmp_base); -} - -MsnMessage * -msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd) -{ - MsnMessage *msg; - - g_return_val_if_fail(cmd != NULL, NULL); - - msg = msn_message_new(MSN_MSG_UNKNOWN); - - msg->remote_user = g_strdup(cmd->params[0]); - /* msg->size = atoi(cmd->params[2]); */ - msg->cmd = cmd; - - return msg; -} - -char * -msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) -{ - MsnSlpHeader header; - - char *tmp, *base; - const void *body; - size_t len, body_len; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = tmp = g_malloc(len + 1); - - body = msn_message_get_bin_data(msg, &body_len); - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(tmp, &header, 48); - tmp += 48; - - if (body != NULL) - { - memcpy(tmp, body, body_len); - tmp += body_len; - } - - if (ret_size != NULL) - *ret_size = tmp - base; - - return base; -} - -char * -msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) -{ - GList *l; - char *n, *base, *end; - int len; - size_t body_len = 0; - const void *body; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = n = end = g_malloc(len + 1); - end += len; - - /* Standard header. */ - if (msg->charset == NULL) - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - n += strlen(n); - - for (l = msg->attr_list; l != NULL; l = l->next) - { - const char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_snprintf(n, end - n, "%s: %s\r\n", key, value); - n += strlen(n); - } - - n += g_strlcpy(n, "\r\n", end - n); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - MsnSlpHeader header; - MsnSlpFooter footer; - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(n, &header, 48); - n += 48; - - if (body != NULL) - { - memcpy(n, body, body_len); - - n += body_len; - } - - footer.value = GUINT32_TO_BE(msg->msnslp_footer.value); - - memcpy(n, &footer, 4); - n += 4; - } - else - { - if (body != NULL) - { - memcpy(n, body, body_len); - n += body_len; - *n = '\0'; - } - } - - if (ret_size != NULL) - { - *ret_size = n - base; - - if (*ret_size > 1664) - *ret_size = 1664; - } - - return base; -} - -void -msn_message_set_flag(MsnMessage *msg, char flag) -{ - g_return_if_fail(msg != NULL); - g_return_if_fail(flag != 0); - - msg->flag = flag; -} - -char -msn_message_get_flag(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, 0); - - return msg->flag; -} - -void -msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len) -{ - g_return_if_fail(msg != NULL); - - /* There is no need to waste memory on data we cannot send anyway */ - if (len > 1664) - len = 1664; - - if (msg->body != NULL) - g_free(msg->body); - - if (data != NULL && len > 0) - { - msg->body = g_malloc(len + 1); - memcpy(msg->body, data, len); - msg->body[len] = '\0'; - msg->body_len = len; - } - else - { - msg->body = NULL; - msg->body_len = 0; - } -} - -const void * -msn_message_get_bin_data(const MsnMessage *msg, size_t *len) -{ - g_return_val_if_fail(msg != NULL, NULL); - - if (len) - *len = msg->body_len; - - return msg->body; -} - -void -msn_message_set_content_type(MsnMessage *msg, const char *type) -{ - g_return_if_fail(msg != NULL); - - g_free(msg->content_type); - msg->content_type = g_strdup(type); -} - -const char * -msn_message_get_content_type(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->content_type; -} - -void -msn_message_set_charset(MsnMessage *msg, const char *charset) -{ - g_return_if_fail(msg != NULL); - - g_free(msg->charset); - msg->charset = g_strdup(charset); -} - -const char * -msn_message_get_charset(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->charset; -} - -void -msn_message_set_attr(MsnMessage *msg, const char *attr, const char *value) -{ - const char *temp; - char *new_attr; - - g_return_if_fail(msg != NULL); - g_return_if_fail(attr != NULL); - - temp = msn_message_get_attr(msg, attr); - - if (value == NULL) - { - if (temp != NULL) - { - GList *l; - - for (l = msg->attr_list; l != NULL; l = l->next) - { - if (!g_ascii_strcasecmp(l->data, attr)) - { - msg->attr_list = g_list_remove(msg->attr_list, l->data); - - break; - } - } - - g_hash_table_remove(msg->attr_table, attr); - } - - return; - } - - new_attr = g_strdup(attr); - - g_hash_table_insert(msg->attr_table, new_attr, g_strdup(value)); - - if (temp == NULL) - msg->attr_list = g_list_append(msg->attr_list, new_attr); -} - -const char * -msn_message_get_attr(const MsnMessage *msg, const char *attr) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(attr != NULL, NULL); - - return g_hash_table_lookup(msg->attr_table, attr); -} - -GHashTable * -msn_message_get_hashtable_from_body(const MsnMessage *msg) -{ - GHashTable *table; - size_t body_len; - const char *body; - char **elems, **cur, **tokens, *body_str; - - g_return_val_if_fail(msg != NULL, NULL); - - table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - body = msn_message_get_bin_data(msg, &body_len); - - g_return_val_if_fail(body != NULL, NULL); - - body_str = g_strndup(body, body_len); - elems = g_strsplit(body_str, "\r\n", 0); - g_free(body_str); - - for (cur = elems; *cur != NULL; cur++) - { - if (**cur == '\0') - break; - - tokens = g_strsplit(*cur, ": ", 2); - - if (tokens[0] != NULL && tokens[1] != NULL) { - g_hash_table_insert(table, tokens[0], tokens[1]); - g_free(tokens); - } else - g_strfreev(tokens); - } - - g_strfreev(elems); - - return table; -} - -char * -msn_message_to_string(MsnMessage *msg) -{ - size_t body_len; - const char *body; - - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->type == MSN_MSG_TEXT, NULL); - - body = msn_message_get_bin_data(msg, &body_len); - - return g_strndup(body, body_len); -} - -void -msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body) -{ - GString *str; - size_t body_len; - const char *body; - GList *l; - - g_return_if_fail(msg != NULL); - - str = g_string_new(NULL); - - /* Standard header. */ - if (msg->charset == NULL) - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - for (l = msg->attr_list; l; l = l->next) - { - char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_string_append_printf(str, "%s: %s\r\n", key, value); - } - - g_string_append(str, "\r\n"); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - g_string_append_printf(str, "Session ID: %u\r\n", msg->msnslp_header.session_id); - g_string_append_printf(str, "ID: %u\r\n", msg->msnslp_header.id); - g_string_append_printf(str, "Offset: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.offset); - g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.total_size); - g_string_append_printf(str, "Length: %u\r\n", msg->msnslp_header.length); - g_string_append_printf(str, "Flags: 0x%x\r\n", msg->msnslp_header.flags); - g_string_append_printf(str, "ACK ID: %u\r\n", msg->msnslp_header.ack_id); - g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); - g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.ack_size); - - if (purple_debug_is_verbose() && body != NULL) - { - if (text_body) - { - g_string_append_len(str, body, body_len); - if (body[body_len - 1] == '\0') - { - str->len--; - g_string_append(str, " 0x00"); - } - g_string_append(str, "\r\n"); - } - else - { - int i; - for (i = 0; i < msg->body_len; i++) - { - g_string_append_printf(str, "%.2hhX ", body[i]); - if ((i % 16) == 15) - g_string_append(str, "\r\n"); - } - g_string_append(str, "\r\n"); - } - } - - g_string_append_printf(str, "Footer: %u\r\n", msg->msnslp_footer.value); - } - else - { - if (body != NULL) - { - g_string_append_len(str, body, body_len); - g_string_append(str, "\r\n"); - } - } - - purple_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); - - g_string_free(str, TRUE); -} - -/************************************************************************** - * Message Handlers - **************************************************************************/ -void -msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - const char *body; - char *body_str; - char *body_enc; - char *body_final; - size_t body_len; - const char *passport; - const char *value; - - gc = cmdproc->session->account->gc; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - passport = msg->remote_user; - - if (!strcmp(passport, "messenger@microsoft.com") && - strstr(body, "immediate security update")) - { - return; - } - -#if 0 - if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL) - { - purple_debug_misc("msn", "User-Agent = '%s'\n", value); - } -#endif - - if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) - { - char *pre, *post; - - msn_parse_format(value, &pre, &post); - - body_final = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - - g_free(pre); - g_free(post); - g_free(body_enc); - } - else - { - body_final = body_enc; - } - - if (cmdproc->servconn->type == MSN_SERVCONN_SB) { - MsnSwitchBoard *swboard = cmdproc->data; - - swboard->flag |= MSN_SB_FLAG_IM; - - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* If current_users is always ok as it should then there is no need to - * check if this is a chat. */ - if (swboard->current_users <= 1) - purple_debug_misc("msn", "plain_msg: current_users(%d)\n", - swboard->current_users); - - serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, - time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_chat(gc, swboard->chat_id); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - else - { - serv_got_im(gc, passport, body_final, 0, time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - passport, purple_connection_get_account(gc)); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - - } else { - serv_got_im(gc, passport, body_final, 0, time(NULL)); - } - - g_free(body_final); -} - -void -msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - char *passport; - - gc = cmdproc->session->account->gc; - passport = msg->remote_user; - - if (msn_message_get_attr(msg, "TypingUser") == NULL) - return; - - if (cmdproc->servconn->type == MSN_SERVCONN_SB) { - MsnSwitchBoard *swboard = cmdproc->data; - - if (swboard->current_users == 1) - { - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } - - } else { - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } -} - -static void -datacast_inform_user(MsnSwitchBoard *swboard, const char *who, - const char *msg, const char *filename) -{ - char *username, *str; - PurpleAccount *account; - PurpleBuddy *b; - - account = swboard->session->account; - - if ((b = purple_find_buddy(account, who)) != NULL) - username = g_markup_escape_text(purple_buddy_get_alias(b), -1); - else - username = g_markup_escape_text(who, -1); - str = g_strdup_printf(msg, username, filename); - g_free(username); - - if (swboard->conv == NULL) { - if (swboard->current_users > 1) - swboard->conv = purple_find_chat(account->gc, swboard->chat_id); - else { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - who, account); - if (swboard->conv == NULL) - swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); - } - } - swboard->flag |= MSN_SB_FLAG_IM; - - purple_conversation_write(swboard->conv, NULL, str, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - -} - -/* TODO: Make these not be such duplicates of each other */ -static void -got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) -{ - FILE *f; - char *path = NULL; - const char *who = slpcall->slplink->remote_user; - purple_debug_info("msn", "Received wink from %s\n", who); - - if ((f = purple_mkstemp(&path, TRUE))) { - fwrite(data, size, 1, f); - fclose(f); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"), - path); - } else { - purple_debug_error("msn", "Couldn\'t create temp file to store wink\n"); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a wink, but it could not be saved"), - NULL); - } - g_free(path); -} - -static void -got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) -{ - FILE *f; - char *path = NULL; - const char *who = slpcall->slplink->remote_user; - purple_debug_info("msn", "Received voice clip from %s\n", who); - - if ((f = purple_mkstemp(&path, TRUE))) { - fwrite(data, size, 1, f); - fclose(f); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"), - path); - } else { - purple_debug_error("msn", "Couldn\'t create temp file to store sound\n"); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a voice clip, but it could not be saved"), - NULL); - } - g_free(path); -} - -void -msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *body; - const char *id; - body = msn_message_get_hashtable_from_body(msg); - - id = g_hash_table_lookup(body, "ID"); - - if (!strcmp(id, "1")) { - /* Nudge */ - PurpleAccount *account; - const char *user; - - account = cmdproc->session->account; - user = msg->remote_user; - - if (cmdproc->servconn->type == MSN_SERVCONN_SB) { - MsnSwitchBoard *swboard = cmdproc->data; - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - purple_prpl_got_attention_in_chat(account->gc, swboard->chat_id, user, MSN_NUDGE); - - else - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); - - } else { - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); - } - - } else if (!strcmp(id, "2")) { - /* Wink */ - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *who; - const char *data; - - session = cmdproc->session; - - data = g_hash_table_lookup(body, "Data"); - obj = msn_object_new_from_string(data); - who = msn_object_get_creator(obj); - - slplink = msn_session_get_slplink(session, who); - msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj); - - msn_object_destroy(obj); - - - } else if (!strcmp(id, "3")) { - /* Voiceclip */ - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *who; - const char *data; - - session = cmdproc->session; - - data = g_hash_table_lookup(body, "Data"); - obj = msn_object_new_from_string(data); - who = msn_object_get_creator(obj); - - slplink = msn_session_get_slplink(session, who); - msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj); - - msn_object_destroy(obj); - - } else if (!strcmp(id, "4")) { - /* Action */ - - } else { - purple_debug_warning("msn", "Got unknown datacast with ID %s.\n", id); - } - - g_hash_table_destroy(body); -} - -void -msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *body; - const gchar *guid; - gboolean accepted = FALSE; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(msg != NULL); - - body = msn_message_get_hashtable_from_body(msg); - - if (body == NULL) { - purple_debug_warning("msn", - "Unable to parse invite msg body.\n"); - return; - } - - guid = g_hash_table_lookup(body, "Application-GUID"); - - if (guid == NULL) { - const gchar *cmd = g_hash_table_lookup( - body, "Invitation-Command"); - - if (cmd && !strcmp(cmd, "CANCEL")) { - const gchar *code = g_hash_table_lookup( - body, "Cancel-Code"); - purple_debug_info("msn", - "MSMSGS invitation cancelled: %s.\n", - code ? code : "no reason given"); - } else - purple_debug_warning("msn", "Invite msg missing " - "Application-GUID.\n"); - - accepted = TRUE; - - } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { - purple_debug_info("msn", "Computer call\n"); - - if (cmdproc->session) { - PurpleConversation *conv = NULL; - gchar *from = msg->remote_user; - gchar *buf = NULL; - - if (from) - conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, from, - cmdproc->session->account); - if (conv) - buf = g_strdup_printf( - _("%s sent you a voice chat " - "invite, which is not yet " - "supported."), from); - if (buf) { - purple_conversation_write(conv, NULL, buf, - PURPLE_MESSAGE_SYSTEM | - PURPLE_MESSAGE_NOTIFY, - time(NULL)); - g_free(buf); - } - } - } else { - const gchar *application = g_hash_table_lookup(body, "Application-Name"); - purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n", - guid, application ? application : "(null)"); - } - - if (!accepted) { - const gchar *cookie = g_hash_table_lookup(body, "Invitation-Cookie"); - if (cookie) { - MsnSwitchBoard *swboard = cmdproc->data; - char *text; - MsnMessage *cancel; - - cancel = msn_message_new(MSN_MSG_TEXT); - msn_message_set_content_type(cancel, "text/x-msmsgsinvite"); - msn_message_set_charset(cancel, "UTF-8"); - msn_message_set_flag(cancel, 'U'); - - text = g_strdup_printf("Invitation-Command: CANCEL\r\n" - "Invitation-Cookie: %s\r\n" - "Cancel-Code: REJECT_NOT_INSTALLED\r\n", - cookie); - msn_message_set_bin_data(cancel, text, strlen(text)); - g_free(text); - - msn_switchboard_send_msg(swboard, cancel, TRUE); - msn_message_destroy(cancel); - } - } - - g_hash_table_destroy(body); -} - -/* Only called from chats. Handwritten messages for IMs come as a SLP message */ -void -msn_handwritten_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - const char *body; - size_t body_len; - - body = msn_message_get_bin_data(msg, &body_len); - msn_switchboard_show_ink(cmdproc->data, msg->remote_user, body); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,350 +0,0 @@ -/** - * @file msg.h Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_MSG_H_ -#define _MSN_MSG_H_ - -typedef struct _MsnMessage MsnMessage; - -#include "session.h" -#include "user.h" - -#include "command.h" -#include "transaction.h" - -typedef void (*MsnMsgCb)(MsnMessage *, void *data); - -#define MSG_BODY_DEM "\r\n\r\n" -#define MSG_LINE_DEM "\r\n" - -#define MSG_OIM_BODY_DEM "\n\n" -#define MSG_OIM_LINE_DEM "\n" - -/* -typedef enum -{ - MSN_MSG_NORMAL, - MSN_MSG_SLP_SB, - MSN_MSG_SLP_DC - -} MsnMsgType; -*/ - -typedef enum -{ - MSN_MSG_UNKNOWN, - MSN_MSG_TEXT, - MSN_MSG_TYPING, - MSN_MSG_CAPS, - MSN_MSG_SLP, - MSN_MSG_NUDGE - -} MsnMsgType; - -typedef enum -{ - MSN_MSG_ERROR_NONE, /**< No error. */ - MSN_MSG_ERROR_TIMEOUT, /**< The message timedout. */ - MSN_MSG_ERROR_NAK, /**< The message could not be sent. */ - MSN_MSG_ERROR_SB, /**< The error comes from the switchboard. */ - MSN_MSG_ERROR_UNKNOWN /**< An unknown error occurred. */ - -} MsnMsgErrorType; - -typedef struct -{ - guint32 session_id; - guint32 id; - guint64 offset; - guint64 total_size; - guint32 length; - guint32 flags; - guint32 ack_id; - guint32 ack_sub_id; - guint64 ack_size; - -} MsnSlpHeader; - -typedef struct -{ - guint32 value; - -} MsnSlpFooter; - -/** - * A message. - */ -struct _MsnMessage -{ - size_t ref_count; /**< The reference count. */ - - MsnMsgType type; - - gboolean msnslp_message; - - char *remote_user; - char flag; - - char *content_type; - char *charset; - char *body; - gsize body_len; - guint total_chunks; /**< How many chunks in this multi-part message */ - guint received_chunks; /**< How many chunks we've received so far */ - - MsnSlpHeader msnslp_header; - MsnSlpFooter msnslp_footer; - - GHashTable *attr_table; - GList *attr_list; - - gboolean ack_ref; /**< A flag that states if this message has - been ref'ed for using it in a callback. */ - - MsnCommand *cmd; - MsnTransaction *trans; - - MsnMsgCb ack_cb; /**< The callback to call when we receive an ACK of this - message. */ - MsnMsgCb nak_cb; /**< The callback to call when we receive a NAK of this - message. */ - void *ack_data; /**< The data used by callbacks. */ - - MsnMsgErrorType error; /**< The error of the message. */ - - guint32 retries; -}; - -/** - * Creates a new, empty message. - * - * @return A new message. - */ -MsnMessage *msn_message_new(MsnMsgType type); - -/** - * Creates a new, empty MSNSLP message. - * - * @return A new MSNSLP message. - */ -MsnMessage *msn_message_new_msnslp(void); - -/** - * Creates a new nudge message. - * - * @return A new nudge message. - */ -MsnMessage *msn_message_new_nudge(void); - -/** - * Creates a new plain message. - * - * @return A new plain message. - */ -MsnMessage *msn_message_new_plain(const char *message); - -/** - * Creates a MSNSLP ack message. - * - * @param acked_msg The message to acknowledge. - * - * @return A new MSNSLP ack message. - */ -MsnMessage *msn_message_new_msnslp_ack(MsnMessage *acked_msg); - -/** - * Creates a new message based off a command. - * - * @param session The MSN session. - * @param cmd The command. - * - * @return The new message. - */ -MsnMessage *msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd); - -/** - * Parses the payload of a message. - * - * @param msg The message. - * @param payload The payload. - * @param payload_len The length of the payload. - */ -void msn_message_parse_payload(MsnMessage *msg, const char *payload, - size_t payload_len, - const char *line_dem,const char *body_dem); - -/** - * Destroys a message. - * - * @param msg The message to destroy. - */ -void msn_message_destroy(MsnMessage *msg); - -/** - * Increments the reference count on a message. - * - * @param msg The message. - * - * @return @a msg - */ -MsnMessage *msn_message_ref(MsnMessage *msg); - -/** - * Decrements the reference count on a message. - * - * This will destroy the structure if the count hits 0. - * - * @param msg The message. - * - * @return @a msg, or @c NULL if the new count is 0. - */ -MsnMessage *msn_message_unref(MsnMessage *msg); - -/** - * Generates the payload data of a message. - * - * @param msg The message. - * @param ret_size The returned size of the payload. - * - * @return The payload data of the message. - */ -char *msn_message_gen_payload(MsnMessage *msg, size_t *ret_size); - -/** - * Sets the flag for an outgoing message. - * - * @param msg The message. - * @param flag The flag. - */ -void msn_message_set_flag(MsnMessage *msg, char flag); - -/** - * Returns the flag for an outgoing message. - * - * @param msg The message. - * - * @return The flag. - */ -char msn_message_get_flag(const MsnMessage *msg); - -/** - * Sets the binary content of the message. - * - * @param msg The message. - * @param data The binary data. - * @param len The length of the data. - */ -void msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len); - -/** - * Returns the binary content of the message. - * - * @param msg The message. - * @param len The returned length of the data. - * - * @return The binary data. - */ -const void *msn_message_get_bin_data(const MsnMessage *msg, size_t *len); - -/** - * Sets the content type in a message. - * - * @param msg The message. - * @param type The content-type. - */ -void msn_message_set_content_type(MsnMessage *msg, const char *type); - -/** - * Returns the content type in a message. - * - * @param msg The message. - * - * @return The content-type. - */ -const char *msn_message_get_content_type(const MsnMessage *msg); - -/** - * Sets the charset in a message. - * - * @param msg The message. - * @param charset The charset. - */ -void msn_message_set_charset(MsnMessage *msg, const char *charset); - -/** - * Returns the charset in a message. - * - * @param msg The message. - * - * @return The charset. - */ -const char *msn_message_get_charset(const MsnMessage *msg); - -/** - * Sets an attribute in a message. - * - * @param msg The message. - * @param attr The attribute name. - * @param value The attribute value. - */ -void msn_message_set_attr(MsnMessage *msg, const char *attr, - const char *value); - -/** - * Returns an attribute from a message. - * - * @param msg The message. - * @param attr The attribute. - * - * @return The value, or @c NULL if not found. - */ -const char *msn_message_get_attr(const MsnMessage *msg, const char *attr); - -/** - * Parses the body and returns it in the form of a hashtable. - * - * @param msg The message. - * - * @return The resulting hashtable. - */ -GHashTable *msn_message_get_hashtable_from_body(const MsnMessage *msg); - -void msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body); - -void msn_message_parse_slp_body(MsnMessage *msg, const char *body, - size_t len); - -char *msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size); - -char *msn_message_to_string(MsnMessage *msg); - -void msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -void msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -void msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -void msn_handwritten_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -#endif /* _MSN_MSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2799 +0,0 @@ -/** - * @file msn.c The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define PHOTO_SUPPORT 1 - -#include "msn.h" -#include "accountopt.h" -#include "contact.h" -#include "msg.h" -#include "page.h" -#include "pluginpref.h" -#include "prefs.h" -#include "session.h" -#include "smiley.h" -#include "state.h" -#include "util.h" -#include "cmds.h" -#include "core.h" -#include "prpl.h" -#include "msnutils.h" -#include "version.h" - -#include "msg.h" -#include "switchboard.h" -#include "notification.h" -#include "sync.h" -#include "slplink.h" - -#if PHOTO_SUPPORT -#define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) -#include "imgstore.h" -#endif - -typedef struct -{ - PurpleConnection *gc; - const char *passport; - -} MsnMobileData; - -typedef struct -{ - PurpleConnection *gc; - char *name; - -} MsnGetInfoData; - -typedef struct -{ - MsnGetInfoData *info_data; - char *stripped; - char *url_buffer; - PurpleNotifyUserInfo *user_info; - char *photo_url_text; - -} MsnGetInfoStepTwoData; - -typedef struct -{ - PurpleConnection *gc; - const char *who; - char *msg; - PurpleMessageFlags flags; - time_t when; -} MsnIMData; - -typedef struct -{ - char *smile; - PurpleSmiley *ps; - MsnObject *obj; -} MsnEmoticon; - -typedef struct -{ - PurpleConnection *pc; - PurpleBuddy *buddy; - PurpleGroup *group; -} MsnAddReqData; - -static const char * -msn_normalize(const PurpleAccount *account, const char *str) -{ - static char buf[BUF_LEN]; - char *tmp; - - g_return_val_if_fail(str != NULL, NULL); - - g_snprintf(buf, sizeof(buf), "%s%s", str, - (strchr(str, '@') ? "" : "@hotmail.com")); - - tmp = g_utf8_strdown(buf, -1); - strncpy(buf, tmp, sizeof(buf)); - g_free(tmp); - - return buf; -} - -gboolean -msn_email_is_valid(const char *passport) -{ - if (purple_email_is_valid(passport)) { - /* Special characters aren't allowed in domains, so only go to '@' */ - while (*passport != '@') { - if (*passport == '/') - return FALSE; - else if (*passport == '?') - return FALSE; - else if (*passport == '=') - return FALSE; - /* MSN also doesn't like colons, but that's checked already */ - - passport++; - } - - return TRUE; - } - - return FALSE; -} - -static gboolean -msn_send_attention(PurpleConnection *gc, const char *username, guint type) -{ - MsnMessage *msg; - MsnSession *session; - MsnSwitchBoard *swboard; - - msg = msn_message_new_nudge(); - session = gc->proto_data; - swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); - - return TRUE; -} - -static GList * -msn_attention_types(PurpleAccount *account) -{ - static GList *list = NULL; - - if (!list) { - list = g_list_append(list, purple_attention_type_new("Nudge", _("Nudge"), - _("%s has nudged you!"), _("Nudging %s..."))); - } - - return list; -} - -static GHashTable * -msn_get_account_text_table(PurpleAccount *unused) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} - -static PurpleCmdRet -msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - PurpleConnection *gc = purple_account_get_connection(account); - const gchar *username; - - username = purple_conversation_get_name(conv); - - purple_prpl_send_attention(gc, username, MSN_NUDGE); - - return PURPLE_CMD_RET_OK; -} - -void -msn_act_id(PurpleConnection *gc, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - const char *alias; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - account = purple_connection_get_account(gc); - - if (entry && *entry) - { - char *tmp = g_strdup(entry); - alias = purple_url_encode(g_strstrip(tmp)); - g_free(tmp); - } - else - alias = ""; - - if (strlen(alias) > BUDDY_ALIAS_MAXLEN) - { - purple_notify_error(gc, NULL, - _("Your new MSN friendly name is too long."), NULL); - return; - } - - if (*alias == '\0') { - alias = purple_url_encode(purple_account_get_username(account)); - } - - msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias); -} - -static void -msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (entry == NULL || *entry == '\0') - { - msn_cmdproc_send(cmdproc, "PRP", "%s", type); - } - else - { - msn_cmdproc_send(cmdproc, "PRP", "%s %s", type, - purple_url_encode(entry)); - } -} - -static void -msn_set_home_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHH", entry); -} - -static void -msn_set_work_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHW", entry); -} - -static void -msn_set_mobile_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHM", entry); -} - -static void -enable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "Y"); -} - -static void -disable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "N"); -} - -static void -send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) -{ - MsnTransaction *trans; - MsnSession *session; - MsnCmdProc *cmdproc; - MsnPage *page; - MsnMessage *msg; - MsnUser *user; - char *payload = NULL; - const char *mobile_number = NULL; - gsize payload_len; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - page = msn_page_new(); - msn_page_set_body(page, entry); - - payload = msn_page_gen_payload(page, &payload_len); - - if ((user = msn_userlist_find_user(session->userlist, who)) && - (mobile_number = msn_user_get_mobile_phone(user)) && - mobile_number[0] == '+') { - /* if msn_user_get_mobile_phone() has a + in front, it's a number - that from the buddy's contact card */ - trans = msn_transaction_new(cmdproc, "PGD", "tel:%s 1 %" G_GSIZE_FORMAT, - mobile_number, payload_len); - } else { - /* otherwise we send to whatever phone number the buddy registered - with msn */ - trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %" G_GSIZE_FORMAT, - who, payload_len); - } - - msn_transaction_set_payload(trans, payload, payload_len); - g_free(payload); - - msg = msn_message_new_plain(entry); - msn_transaction_set_data(trans, msg); - - msn_page_destroy(page); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -send_to_mobile_cb(MsnMobileData *data, const char *entry) -{ - send_to_mobile(data->gc, data->passport, entry); - g_free(data); -} - -static void -close_mobile_page_cb(MsnMobileData *data, const char *entry) -{ - g_free(data); -} - -/* -- */ - -static void -msn_show_set_friendly_name(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_input(gc, NULL, _("Set your friendly name."), - _("This is the name that other MSN buddies will " - "see you as."), - purple_connection_get_display_name(gc), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_act_id), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_home_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your home phone number."), NULL, - msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_home_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_work_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your work phone number."), NULL, - msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_work_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, - msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_pages(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_action(gc, NULL, _("Allow MSN Mobile pages?"), - _("Do you want to allow or disallow people on " - "your buddy list to send you MSN Mobile pages " - "to your cell phone or other mobile device?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), NULL, NULL, - gc, 3, - _("Allow"), G_CALLBACK(enable_msn_pages_cb), - _("Disallow"), G_CALLBACK(disable_msn_pages_cb), - _("Cancel"), NULL); -} - -/* QuLogic: Disabled until confirmed correct. */ -#if 0 -static void -msn_show_blocked_text(PurplePluginAction *action) -{ - PurpleConnection *pc = (PurpleConnection *) action->context; - MsnSession *session; - char *title; - - session = pc->proto_data; - - title = g_strdup_printf(_("Blocked Text for %s"), session->account->username); - if (session->blocked_text == NULL) { - purple_notify_formatted(pc, title, title, NULL, _("No text is blocked for this account."), NULL, NULL); - } else { - char *blocked_text; - blocked_text = g_strdup_printf(_("MSN servers are currently blocking the following regular expressions:<br/>%s"), - session->blocked_text); - - purple_notify_formatted(pc, title, title, NULL, blocked_text, NULL, NULL); - g_free(blocked_text); - } - g_free(title); -} -#endif - -static void -msn_show_hotmail_inbox(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - if (!session->passport_info.email_enabled) { - purple_notify_error(gc, NULL, - _("This account does not have email enabled."), NULL); - return; - } - - /** apparently the correct value is 777, use 750 as a failsafe */ - if ((session->passport_info.mail_url == NULL) - || (time (NULL) - session->passport_info.mail_timestamp >= 750)) { - MsnTransaction *trans; - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_set_data(trans, GUINT_TO_POINTER(TRUE)); - - msn_cmdproc_send_trans(cmdproc, trans); - - } else - purple_notify_uri(gc, session->passport_info.mail_url); -} - -static void -show_send_to_mobile_cb(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - MsnSession *session; - MsnMobileData *data; - PurpleAccount *account; - const char *name; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - name = purple_buddy_get_name(buddy); - - session = gc->proto_data; - - data = g_new0(MsnMobileData, 1); - data->gc = gc; - data->passport = name; - - purple_request_input(gc, NULL, _("Send a mobile message."), NULL, - NULL, TRUE, FALSE, NULL, - _("Page"), G_CALLBACK(send_to_mobile_cb), - _("Close"), G_CALLBACK(close_mobile_page_cb), - account, name, NULL, - data); -} - -static gboolean -msn_offline_message(const PurpleBuddy *buddy) { - return TRUE; -} - -void -msn_send_privacy(PurpleConnection *gc) -{ - PurpleAccount *account; - MsnSession *session; - MsnCmdProc *cmdproc; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || - account->perm_deny == PURPLE_PRIVACY_DENY_USERS) - msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); - else - msn_cmdproc_send(cmdproc, "BLP", "%s", "BL"); -} - -static void -initiate_chat_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - PurpleAccount *account; - - MsnSession *session; - MsnSwitchBoard *swboard; - - const char *alias; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - - session = gc->proto_data; - - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, purple_buddy_get_name(buddy)); - - /* TODO: This might move somewhere else, after USR might be */ - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); - swboard->flag = MSN_SB_FLAG_IM; - - /* Local alias > Display name > Username */ - if ((alias = purple_account_get_alias(account)) == NULL) - if ((alias = purple_connection_get_display_name(gc)) == NULL) - alias = purple_account_get_username(account); - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - alias, NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - -static void -t_msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpLink *slplink = xfer->data; - msn_slplink_request_ft(slplink, xfer); -} - -static PurpleXfer* -msn_new_xfer(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - PurpleXfer *xfer; - - session = gc->proto_data; - - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->data = msn_session_get_slplink(session, who); - - purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); - - return xfer; -} - -static void -msn_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer = msn_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -static gboolean -msn_can_receive_file(PurpleConnection *gc, const char *who) -{ - PurpleAccount *account; - gchar *normal; - gboolean ret; - - account = purple_connection_get_account(gc); - - normal = g_strdup(msn_normalize(account, purple_account_get_username(account))); - ret = strcmp(normal, msn_normalize(account, who)); - g_free(normal); - - if (ret) { - MsnSession *session = gc->proto_data; - if (session) { - MsnUser *user = msn_userlist_find_user(session->userlist, who); - if (user) { - /* Include these too: MSN_CLIENT_CAP_MSNMOBILE|MSN_CLIENT_CAP_MSNDIRECT ? */ - if ((user->clientid & MSN_CLIENT_CAP_WEBMSGR) || - user->networkid == MSN_NETWORK_YAHOO) - ret = FALSE; - else - ret = TRUE; - } - } else - ret = FALSE; - } - - return ret; -} - -/************************************************************************** - * Protocol Plugin ops - **************************************************************************/ - -static const char * -msn_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "msn"; -} - -static const char * -msn_list_emblems(PurpleBuddy *b) -{ - MsnUser *user = purple_buddy_get_protocol_data(b); - - if (user != NULL) { - if (user->clientid & MSN_CLIENT_CAP_BOT) - return "bot"; - if (user->clientid & MSN_CLIENT_CAP_WIN_MOBILE) - return "mobile"; -#if 0 - /* XXX: Since we don't support this, there's no point in showing it just yet */ - if (user->clientid & MSN_CLIENT_CAP_SCHANNEL) - return "secure"; -#endif - if (user->clientid & MSN_CLIENT_CAP_WEBMSGR) - return "external"; - if (user->networkid == MSN_NETWORK_YAHOO) - return "yahoo"; - } - - return NULL; -} - -/* - * Set the User status text - */ -static char * -msn_status_text(PurpleBuddy *buddy) -{ - PurplePresence *presence; - PurpleStatus *status; - const char *msg; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - /* Official client says media takes precedence over message */ - /* I say message take precedence over media! Plus prpl-jabber agrees - too */ - msg = purple_status_get_attr_string(status, "message"); - if (msg && *msg) - return g_markup_escape_text(msg, -1); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - const char *title, *game, *office; - char *media, *esc; - status = purple_presence_get_status(presence, "tune"); - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - - game = purple_status_get_attr_string(status, "game"); - office = purple_status_get_attr_string(status, "office"); - - if (title && *title) { - const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - media = purple_util_format_song_info(title, artist, album, NULL); - return media; - } - else if (game && *game) - media = g_strdup_printf("Playing %s", game); - else if (office && *office) - media = g_strdup_printf("Editing %s", office); - else - return NULL; - esc = g_markup_escape_text(media, -1); - g_free(media); - return esc; - } - - return NULL; -} - -static void -msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) -{ - MsnUser *user; - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - - user = purple_buddy_get_protocol_data(buddy); - - if (purple_presence_is_online(presence)) - { - const char *psm, *name; - const char *mediatype = NULL; - char *currentmedia = NULL; - char *tmp; - - psm = purple_status_get_attr_string(status, "message"); - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *tune = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - const char *game = purple_status_get_attr_string(tune, "game"); - const char *office = purple_status_get_attr_string(tune, "office"); - if (title && *title) { - const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - mediatype = _("Now Listening"); - currentmedia = purple_util_format_song_info(title, artist, album, NULL); - } else if (game && *game) { - mediatype = _("Playing a game"); - currentmedia = g_strdup(game); - } else if (office && *office) { - mediatype = _("Working"); - currentmedia = g_strdup(office); - } - } - - if (!purple_status_is_available(status)) { - name = purple_status_get_name(status); - } else { - name = NULL; - } - - if (name != NULL && *name) { - char *tmp2; - - tmp2 = g_markup_escape_text(name, -1); - if (purple_presence_is_idle(presence)) { - char *idle; - char *tmp3; - /* Never know what those translations might end up like... */ - idle = g_markup_escape_text(_("Idle"), -1); - tmp3 = g_strdup_printf("%s/%s", tmp2, idle); - g_free(idle); - g_free(tmp2); - tmp2 = tmp3; - } - - if (psm != NULL && *psm) { - tmp = g_markup_escape_text(psm, -1); - purple_notify_user_info_add_pair(user_info, tmp2, tmp); - g_free(tmp); - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), tmp2); - } - - g_free(tmp2); - } else { - if (psm != NULL && *psm) { - tmp = g_markup_escape_text(psm, -1); - if (purple_presence_is_idle(presence)) { - purple_notify_user_info_add_pair(user_info, _("Idle"), tmp); - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), tmp); - } - g_free(tmp); - } else { - if (purple_presence_is_idle(presence)) { - purple_notify_user_info_add_pair(user_info, _("Status"), - _("Idle")); - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), - purple_status_get_name(status)); - } - } - } - - if (currentmedia) { - purple_notify_user_info_add_pair(user_info, mediatype, currentmedia); - g_free(currentmedia); - } - } - - /* XXX: This is being shown in non-full tooltips because the - * XXX: blocked icon overlay isn't always accurate for MSN. - * XXX: This can die as soon as purple_privacy_check() knows that - * XXX: this prpl always honors both the allow and deny lists. */ - /* While the above comment may be strictly correct (the privacy API needs - * rewriteing), purple_privacy_check() is going to be more accurate at - * indicating whether a particular buddy is going to be able to message - * you, which is the important information that this is trying to convey. - */ - if (full && user) - { - const char *phone; - - purple_notify_user_info_add_pair(user_info, _("Has you"), - ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No"))); - - purple_notify_user_info_add_pair(user_info, _("Blocked"), - ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No"))); - - phone = msn_user_get_home_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone); - - phone = msn_user_get_work_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone); - - phone = msn_user_get_mobile_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone); - } -} - -static GList * -msn_status_types(PurpleAccount *account) -{ - PurpleStatusType *status; - GList *types = NULL; - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, "brb", _("Be Right Back"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_UNAVAILABLE, "busy", _("Busy"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_UNAVAILABLE, "phone", _("On the Phone"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, "lunch", _("Out to Lunch"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - NULL, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - NULL, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, - "mobile", NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, - "tune", NULL, FALSE, TRUE, TRUE, - PURPLE_TUNE_ARTIST, _("Artist"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_ALBUM, _("Album"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Title"), purple_value_new(PURPLE_TYPE_STRING), - "game", _("Game Title"), purple_value_new(PURPLE_TYPE_STRING), - "office", _("Office Title"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - return types; -} - -static GList * -msn_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set Friendly Name..."), - msn_show_set_friendly_name); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Set Home Phone Number..."), - msn_show_set_home_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Work Phone Number..."), - msn_show_set_work_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Mobile Phone Number..."), - msn_show_set_mobile_phone); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - -#if 0 - act = purple_plugin_action_new(_("Enable/Disable Mobile Devices..."), - msn_show_set_mobile_support); - m = g_list_append(m, act); -#endif - - act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."), - msn_show_set_mobile_pages); - m = g_list_append(m, act); - -/* QuLogic: Disabled until confirmed correct. */ -#if 0 - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("View Blocked Text..."), - msn_show_blocked_text); - m = g_list_append(m, act); -#endif - - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Hotmail Inbox"), - msn_show_hotmail_inbox); - m = g_list_append(m, act); - - return m; -} - -static GList * -msn_buddy_menu(PurpleBuddy *buddy) -{ - MsnUser *user; - - GList *m = NULL; - PurpleMenuAction *act; - - g_return_val_if_fail(buddy != NULL, NULL); - - user = purple_buddy_get_protocol_data(buddy); - - if (user != NULL) - { - if (user->mobile) - { - act = purple_menu_action_new(_("Send to Mobile"), - PURPLE_CALLBACK(show_send_to_mobile_cb), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (g_ascii_strcasecmp(purple_buddy_get_name(buddy), - purple_account_get_username(purple_buddy_get_account(buddy)))) - { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(initiate_chat_cb), - NULL, NULL); - m = g_list_append(m, act); - } - - return m; -} - -static GList * -msn_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - return msn_buddy_menu((PurpleBuddy *) node); - } - else - { - return NULL; - } -} - -static void -msn_login(PurpleAccount *account) -{ - PurpleConnection *gc; - MsnSession *session; - const char *username; - const char *host; - gboolean http_method = FALSE; - int port; - - gc = purple_account_get_connection(account); - - if (!purple_ssl_is_supported()) - { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support is needed for MSN. Please install a supported " - "SSL library.")); - return; - } - - http_method = purple_account_get_bool(account, "http_method", FALSE); - - if (http_method) - host = purple_account_get_string(account, "http_method_server", MSN_HTTPCONN_SERVER); - else - host = purple_account_get_string(account, "server", MSN_SERVER); - port = purple_account_get_int(account, "port", MSN_PORT); - - session = msn_session_new(account); - - gc->proto_data = session; - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_START); - - /* Hmm, I don't like this. */ - /* XXX shx: Me neither */ - username = msn_normalize(account, purple_account_get_username(account)); - - if (strcmp(username, purple_account_get_username(account))) - purple_account_set_username(account, username); - - username = purple_account_get_string(account, "display-name", NULL); - purple_connection_set_display_name(gc, username); - - if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); -} - -static void -msn_close(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - g_return_if_fail(session != NULL); - - msn_session_destroy(session); - - gc->proto_data = NULL; -} - -static gboolean -msn_send_me_im(gpointer data) -{ - MsnIMData *imdata = data; - serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when); - g_free(imdata->msg); - g_free(imdata); - return FALSE; -} - -static GString* -msn_msg_emoticon_add(GString *current, MsnEmoticon *emoticon) -{ - MsnObject *obj; - char *strobj; - - if (emoticon == NULL) - return current; - - obj = emoticon->obj; - - if (!obj) - return current; - - strobj = msn_object_to_string(obj); - - if (current) - g_string_append_printf(current, "\t%s\t%s", emoticon->smile, strobj); - else { - current = g_string_new(""); - g_string_printf(current, "%s\t%s", emoticon->smile, strobj); - } - - g_free(strobj); - - return current; -} - -static void -msn_send_emoticons(MsnSwitchBoard *swboard, GString *body) -{ - MsnMessage *msg; - - g_return_if_fail(body != NULL); - - msg = msn_message_new(MSN_MSG_SLP); - msn_message_set_content_type(msg, "text/x-mms-emoticon"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, body->str, body->len); - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); -} - -static void msn_emoticon_destroy(MsnEmoticon *emoticon) -{ - if (emoticon->obj) - msn_object_destroy(emoticon->obj); - g_free(emoticon->smile); - g_free(emoticon); -} - -static GSList* msn_msg_grab_emoticons(const char *msg, const char *username) -{ - GSList *list; - GList *smileys; - PurpleSmiley *smiley; - PurpleStoredImage *img; - char *ptr; - MsnEmoticon *emoticon; - int length; - - list = NULL; - smileys = purple_smileys_get_all(); - length = strlen(msg); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - smiley = smileys->data; - - ptr = g_strstr_len(msg, length, purple_smiley_get_shortcut(smiley)); - - if (!ptr) - continue; - - img = purple_smiley_get_stored_image(smiley); - - emoticon = g_new0(MsnEmoticon, 1); - emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); - emoticon->ps = smiley; - emoticon->obj = msn_object_new_from_image(img, - purple_imgstore_get_filename(img), - username, MSN_OBJECT_EMOTICON); - - purple_imgstore_unref(img); - list = g_slist_prepend(list, emoticon); - } - - return list; -} - -void -msn_send_im_message(MsnSession *session, MsnMessage *msg) -{ - MsnEmoticon *smile; - GSList *smileys; - GString *emoticons = NULL; - const char *username = purple_account_get_username(session->account); - MsnSwitchBoard *swboard = msn_session_get_swboard(session, msg->remote_user, MSN_SB_FLAG_IM); - - smileys = msn_msg_grab_emoticons(msg->body, username); - while (smileys) { - smile = (MsnEmoticon *)smileys->data; - emoticons = msn_msg_emoticon_add(emoticons, smile); - msn_emoticon_destroy(smile); - smileys = g_slist_delete_link(smileys, smileys); - } - - if (emoticons) { - msn_send_emoticons(swboard, emoticons); - g_string_free(emoticons, TRUE); - } - - msn_switchboard_send_msg(swboard, msg, TRUE); -} - -static int -msn_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - PurpleAccount *account; - PurpleBuddy *buddy = purple_find_buddy(gc->account, who); - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - char *msgformat; - char *msgtext; - size_t msglen; - const char *username; - - purple_debug_info("msn", "send IM {%s} to %s\n", message, who); - account = purple_connection_get_account(gc); - username = purple_account_get_username(account); - - session = gc->proto_data; - swboard = msn_session_find_swboard(session, who); - - if (!strncmp("tel:+", who, 5)) { - char *text = purple_markup_strip_html(message); - send_to_mobile(gc, who, text); - g_free(text); - return 1; - } - - if (buddy) { - PurplePresence *p = purple_buddy_get_presence(buddy); - if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) { - char *text = purple_markup_strip_html(message); - send_to_mobile(gc, who, text); - g_free(text); - return 1; - } - } - - msn_import_html(message, &msgformat, &msgtext); - msglen = strlen(msgtext); - if (msglen == 0) { - /* Stuff like <hr> will be ignored. Don't send an empty message - if that's all there is. */ - g_free(msgtext); - g_free(msgformat); - - return 0; - } - - if (msn_user_is_online(account, who) || - msn_user_is_yahoo(account, who) || - swboard != NULL) { - /*User online or have a swboard open because it's invisible - * and sent us a message,then send Online Instant Message*/ - - if (msglen + strlen(msgformat) + strlen(VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msg->remote_user = g_strdup(who); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - - g_free(msgformat); - g_free(msgtext); - - purple_debug_info("msn", "prepare to send online Message\n"); - if (g_ascii_strcasecmp(who, username)) - { - if (flags & PURPLE_MESSAGE_AUTO_RESP) { - msn_message_set_flag(msg, 'U'); - } - if (msn_user_is_yahoo(account, who)) { - /*we send the online and offline Message to Yahoo User via UBM*/ - purple_debug_info("msn", "send to Yahoo User\n"); - uum_send_msg(session, msg); - } else { - purple_debug_info("msn", "send via switchboard\n"); - msn_send_im_message(session, msg); - } - } - else - { - char *body_str, *body_enc, *pre, *post; - const char *format; - MsnIMData *imdata = g_new0(MsnIMData, 1); - /* - * In MSN, you can't send messages to yourself, so - * we'll fake like we received it ;) - */ - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - serv_got_typing_stopped(gc, who); - imdata->gc = gc; - imdata->who = who; - imdata->msg = body_str; - imdata->flags = flags & ~PURPLE_MESSAGE_SEND; - imdata->when = time(NULL); - purple_timeout_add(0, msn_send_me_im, imdata); - } - - msn_message_destroy(msg); - } else { - /*send Offline Instant Message,only to MSN Passport User*/ - char *friendname; - - purple_debug_info("msn", "prepare to send offline Message\n"); - - friendname = msn_encode_mime(account->username); - msn_oim_prep_send_msg_info(session->oim, - purple_account_get_username(account), - friendname, who, msgtext); - msn_oim_send_msg(session->oim); - - g_free(msgformat); - g_free(msgtext); - g_free(friendname); - } - - return 1; -} - -static unsigned int -msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - PurpleAccount *account; - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - - /* - * TODO: I feel like this should be "if (state != PURPLE_TYPING)" - * but this is how it was before, and I don't want to break - * anything. --KingAnt - */ - if (state == PURPLE_NOT_TYPING) - return 0; - - if (!g_ascii_strcasecmp(who, purple_account_get_username(account))) - { - /* We'll just fake it, since we're sending to ourself. */ - serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, PURPLE_TYPING); - - return MSN_TYPING_SEND_TIMEOUT; - } - - swboard = msn_session_find_swboard(session, who); - - if (swboard == NULL || !msn_switchboard_can_send(swboard)) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msg = msn_message_new(MSN_MSG_TYPING); - msn_message_set_content_type(msg, "text/x-msmsgscontrol"); - msn_message_set_flag(msg, 'U'); - msn_message_set_attr(msg, "TypingUser", - purple_account_get_username(account)); - msn_message_set_bin_data(msg, "\r\n", 2); - - msn_switchboard_send_msg(swboard, msg, FALSE); - - msn_message_destroy(msg); - - return MSN_TYPING_SEND_TIMEOUT; -} - -static void -msn_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = purple_account_get_connection(account); - - if (gc != NULL) - { - session = gc->proto_data; - msn_change_status(session); - } -} - -static void -msn_set_idle(PurpleConnection *gc, int idle) -{ - MsnSession *session; - - session = gc->proto_data; - - msn_change_status(session); -} - -/* - * Actually adds a buddy once we have the response from FQY - */ -static void -add_pending_buddy(MsnSession *session, - const char *who, - MsnNetwork network, - MsnUser *user) -{ - char *group; - - g_return_if_fail(user != NULL); - - group = msn_user_remove_pending_group(user); - - if (network != MSN_NETWORK_UNKNOWN) { - MsnUserList *userlist = session->userlist; - MsnUser *user2 = msn_userlist_find_user(userlist, who); - if (user2 != NULL) { - /* User already in userlist, so just update it. */ - msn_user_destroy(user); - user = user2; - } else { - msn_userlist_add_user(userlist, user); - } - - msn_user_set_network(user, network); - msn_userlist_add_buddy(userlist, who, group); - } - else - { - PurpleBuddy * buddy = purple_find_buddy(session->account, who); - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses."), who); - if (!purple_conv_present_error(who, session->account, buf)) - purple_notify_error(purple_account_get_connection(session->account), NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); - msn_user_destroy(user); - } - g_free(group); -} - -static void -finish_auth_request(MsnAddReqData *data, char *msg) -{ - PurpleConnection *pc; - PurpleBuddy *buddy; - PurpleGroup *group; - PurpleAccount *account; - MsnSession *session; - MsnUserList *userlist; - const char *who, *gname; - MsnUser *user; - - pc = data->pc; - buddy = data->buddy; - group = data->group; - g_free(data); - - account = purple_connection_get_account(pc); - session = pc->proto_data; - userlist = session->userlist; - - who = msn_normalize(account, purple_buddy_get_name(buddy)); - gname = group ? purple_group_get_name(group) : NULL; - purple_debug_info("msn", "Add user:%s to group:%s\n", who, gname ? gname : "(null)"); - if (!session->logged_in) - { - purple_debug_error("msn", "msn_add_buddy called before connected\n"); - - return; - } - - /* XXX - Would group ever be NULL here? I don't think so... - * shx: Yes it should; MSN handles non-grouped buddies, and this is only - * internal. */ - user = msn_userlist_find_user(userlist, who); - if ((user != NULL) && (user->networkid != MSN_NETWORK_UNKNOWN)) { - /* We already know this buddy and their network. This function knows - what to do with users already in the list and stuff... */ - msn_user_set_invite_message(user, msg); - msn_userlist_add_buddy(userlist, who, gname); - } else { - char **tokens; - char *fqy; - /* We need to check the network for this buddy first */ - user = msn_user_new(userlist, who, NULL); - msn_user_set_invite_message(user, msg); - msn_user_set_pending_group(user, gname); - msn_user_set_network(user, MSN_NETWORK_UNKNOWN); - tokens = g_strsplit(who, "@", 2); - fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", - tokens[1], - tokens[0]); - msn_notification_send_fqy(session, fqy, strlen(fqy), - (MsnFqyCb)add_pending_buddy, user); - g_free(fqy); - g_strfreev(tokens); - } -} - -static void -cancel_auth_request(MsnAddReqData *data, char *msg) -{ - /* Remove from local list */ - purple_blist_remove_buddy(data->buddy); - - g_free(data); -} - -static void -msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - const char *bname; - MsnAddReqData *data; - - bname = purple_buddy_get_name(buddy); - - if (!msn_email_is_valid(bname)) { - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses."), bname); - if (!purple_conv_present_error(bname, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); - - return; - } - - data = g_new0(MsnAddReqData, 1); - data->pc = gc; - data->buddy = buddy; - data->group = group; - - purple_request_input(gc, NULL, _("Authorization Request Message:"), - NULL, _("Please authorize me!"), TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(finish_auth_request), - _("_Cancel"), G_CALLBACK(cancel_auth_request), - purple_connection_get_account(gc), bname, NULL, - data); -} - -static void -msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, purple_buddy_get_name(buddy)); -} - -static void -msn_add_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_BL_OP) { - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - - /* delete contact from Block list and add it to Allow in the callback */ - msn_del_contact_from_list(session, NULL, who, MSN_LIST_BL); - } else { - /* just add the contact to Allow list */ - msn_add_contact_to_list(session, NULL, who, MSN_LIST_AL); - } - - - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_AL); -} - -static void -msn_add_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_AL_OP) { - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_AL); - - /* delete contact from Allow list and add it to Block in the callback */ - msn_del_contact_from_list(session, NULL, who, MSN_LIST_AL); - } else { - /* just add the contact to Block list */ - msn_add_contact_to_list(session, NULL, who, MSN_LIST_BL); - } - - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_BL); -} - -static void -msn_rem_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_AL); - - msn_del_contact_from_list(session, NULL, who, MSN_LIST_AL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_BL); -} - -static void -msn_rem_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - - msn_del_contact_from_list(session, NULL, who, MSN_LIST_BL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_AL); -} - -static void -msn_set_permit_deny(PurpleConnection *gc) -{ - msn_send_privacy(gc); -} - -static void -msn_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - { - /* if we have no switchboard, everyone else left the chat already */ - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - swboard->chat_id = id; - swboard->conv = purple_find_chat(gc, id); - } - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_switchboard_request_add_user(swboard, who); -} - -static void -msn_chat_leave(PurpleConnection *gc, int id) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - /* if swboard is NULL we were the only person left anyway */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - msn_switchboard_release(swboard, MSN_SB_FLAG_IM); - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static int -msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurpleAccount *account; - MsnSession *session; - const char *username; - MsnSwitchBoard *swboard; - MsnMessage *msg; - char *msgformat; - char *msgtext; - size_t msglen; - MsnEmoticon *smile; - GSList *smileys; - GString *emoticons = NULL; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - username = purple_account_get_username(account); - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - return -EINVAL; - - if (!swboard->ready) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_import_html(message, &msgformat, &msgtext); - msglen = strlen(msgtext); - - if ((msglen == 0) || (msglen + strlen(msgformat) + strlen(VERSION) > 1564)) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - - smileys = msn_msg_grab_emoticons(msg->body, username); - while (smileys) { - smile = (MsnEmoticon *)smileys->data; - emoticons = msn_msg_emoticon_add(emoticons, smile); - if (purple_conv_custom_smiley_add(swboard->conv, smile->smile, - "sha1", purple_smiley_get_checksum(smile->ps), - FALSE)) { - gconstpointer data; - size_t len; - data = purple_smiley_get_data(smile->ps, &len); - purple_conv_custom_smiley_write(swboard->conv, smile->smile, data, len); - purple_conv_custom_smiley_close(swboard->conv, smile->smile); - } - msn_emoticon_destroy(smile); - smileys = g_slist_delete_link(smileys, smileys); - } - - if (emoticons) { - msn_send_emoticons(swboard, emoticons); - g_string_free(emoticons, TRUE); - } - - msn_switchboard_send_msg(swboard, msg, FALSE); - msn_message_destroy(msg); - - g_free(msgformat); - g_free(msgtext); - - serv_got_chat_in(gc, id, purple_account_get_username(account), flags, - message, time(NULL)); - - return 0; -} - -static void -msn_keepalive(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - if (!session->http_method) - { - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL); - } -} - -static void msn_alias_buddy(PurpleConnection *pc, const char *name, const char *alias) -{ - MsnSession *session; - - session = pc->proto_data; - - msn_update_contact(session, name, MSN_UPDATE_ALIAS, alias); -} - -static void -msn_group_buddy(PurpleConnection *gc, const char *who, - const char *old_group_name, const char *new_group_name) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); -} - -static void -msn_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - MsnSession *session; - const char *gname; - - session = gc->proto_data; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->userlist != NULL); - - gname = purple_group_get_name(group); - if (msn_userlist_find_group_with_name(session->userlist, old_name) != NULL) - { - msn_contact_rename_group(session, old_name, gname); - } - else - { - /* not found */ - msn_add_group(session, NULL, gname); - } -} - -static void -msn_convo_closed(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard(session, who); - - /* - * Don't perform an assertion here. If swboard is NULL, then the - * switchboard was either closed by the other party, or the person - * is talking to himself. - */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - /* If we release the switchboard here, it may still have messages - pending ACK which would result in incorrect unsent message errors. - Just let it timeout... This is *so* going to screw with people who - use dumb clients that report "User has closed the conversation window" */ - /* msn_switchboard_release(swboard, MSN_SB_FLAG_IM); */ - swboard->conv = NULL; - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static void -msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - MsnSession *session; - MsnUser *user; - - session = gc->proto_data; - user = session->user; - - msn_user_set_buddy_icon(user, img); - - msn_change_status(session); -} - -static void -msn_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - MsnSession *session; - MsnCmdProc *cmdproc; - const char *gname; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - gname = purple_group_get_name(group); - - purple_debug_info("msn", "Remove group %s\n", gname); - /*we can't delete the default group*/ - if(!strcmp(gname, MSN_INDIVIDUALS_GROUP_NAME)|| - !strcmp(gname, MSN_NON_IM_GROUP_NAME)) - { - purple_debug_info("msn", "This group can't be removed, returning.\n"); - return ; - } - - msn_del_group(session, gname); -} - -/** - * Extract info text from info_data and add it to user_info - */ -static gboolean -msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *info_data) -{ - PurpleBuddy *b; - - b = purple_find_buddy(purple_connection_get_account(info_data->gc), - info_data->name); - - if (b) - { - char *tmp; - const char *alias; - - alias = purple_buddy_get_local_buddy_alias(b); - if (alias && alias[0]) - { - char *aliastext = g_markup_escape_text(alias, -1); - purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); - g_free(aliastext); - } - - if ((alias = purple_buddy_get_server_alias(b)) != NULL) - { - char *nicktext = g_markup_escape_text(alias, -1); - tmp = g_strdup_printf("<font sml=\"msn\">%s</font>", nicktext); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - g_free(nicktext); - } - - /* Add the tooltip information */ - msn_tooltip_text(b, user_info, TRUE); - - return TRUE; - } - - return FALSE; -} - -#if PHOTO_SUPPORT - -static char * -msn_get_photo_url(const char *url_text) -{ - char *p, *q; - - if ((p = strstr(url_text, PHOTO_URL)) != NULL) - { - p += strlen(PHOTO_URL); - } - if (p && (strncmp(p, "http://", strlen("http://")) == 0) && ((q = strchr(p, '"')) != NULL)) - return g_strndup(p, q - p); - - return NULL; -} - -static void msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, gsize len, const gchar *error_message); - -#endif - -#if 0 -static char *msn_info_date_reformat(const char *field, size_t len) -{ - char *tmp = g_strndup(field, len); - time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - - g_free(tmp); - return g_strdup(purple_date_format_short(localtime(&t))); -} -#endif - -#define MSN_GOT_INFO_GET_FIELD(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, NULL); \ - if (found) \ - sect_info = TRUE; - -#define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \ - if (found) \ - sect_info = TRUE; - -static char * -msn_info_strip_search_link(const char *field, size_t len) -{ - const char *c; - if ((c = strstr(field, " (http://")) == NULL) - return g_strndup(field, len); - return g_strndup(field, c - field); -} - -static void -msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - MsnGetInfoData *info_data = (MsnGetInfoData *)data; - PurpleNotifyUserInfo *user_info; - char *stripped, *p, *q, *tmp; - char *user_url = NULL; - gboolean found; - gboolean has_tooltip_text = FALSE; - gboolean has_info = FALSE; - gboolean sect_info = FALSE; - gboolean has_contact_info = FALSE; - char *url_buffer; - int stripped_len; -#if PHOTO_SUPPORT - char *photo_url_text = NULL; - MsnGetInfoStepTwoData *info2_data = NULL; -#endif - - purple_debug_info("msn", "In msn_got_info,url_text:{%s}\n",url_text); - - /* Make sure the connection is still valid */ - /* TODO: Instead of this, we should be canceling this when we disconnect */ - if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n"); - g_free(info_data->name); - g_free(info_data); - return; - } - - user_info = purple_notify_user_info_new(); - has_tooltip_text = msn_tooltip_extract_info_text(user_info, info_data); - - if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) - { - purple_notify_user_info_add_pair(user_info, - _("Error retrieving profile"), NULL); - - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(info_data->name); - g_free(info_data); - return; - } - - url_buffer = g_strdup(url_text); - - /* If they have a homepage link, MSN masks it such that we need to - * fetch the url out before purple_markup_strip_html() nukes it */ - /* I don't think this works with the new spaces profiles - Stu 3/2/06 */ - if ((p = strstr(url_text, - "Take a look at my </font><A class=viewDesc title=\"")) != NULL) - { - p += 50; - - if ((q = strchr(p, '"')) != NULL) - user_url = g_strndup(p, q - p); - } - - /* - * purple_markup_strip_html() doesn't strip out character entities like   - * and · - */ - while ((p = strstr(url_buffer, " ")) != NULL) - { - *p = ' '; /* Turn  's into ordinary blanks */ - p += 1; - memmove(p, p + 5, strlen(p + 5)); - url_buffer[strlen(url_buffer) - 5] = '\0'; - } - - while ((p = strstr(url_buffer, "·")) != NULL) - { - memmove(p, p + 6, strlen(p + 6)); - url_buffer[strlen(url_buffer) - 6] = '\0'; - } - - /* Nuke the nasty \r's that just get in the way */ - purple_str_strip_char(url_buffer, '\r'); - - /* MSN always puts in ' for apostrophes...replace them */ - while ((p = strstr(url_buffer, "'")) != NULL) - { - *p = '\''; - memmove(p + 1, p + 5, strlen(p + 5)); - url_buffer[strlen(url_buffer) - 4] = '\0'; - } - - /* Nuke the html, it's easier than trying to parse the horrid stuff */ - stripped = purple_markup_strip_html(url_buffer); - stripped_len = strlen(stripped); - - purple_debug_misc("msn", "stripped = %p\n", stripped); - purple_debug_misc("msn", "url_buffer = %p\n", url_buffer); - - /* General section header */ - if (has_tooltip_text) - purple_notify_user_info_add_section_break(user_info); - - purple_notify_user_info_add_section_header(user_info, _("General")); - - /* Extract their Name and put it in */ - MSN_GOT_INFO_GET_FIELD("Name", _("Name")); - - /* General */ - MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Age", _("Age")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Gender", _("Gender")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Occupation", _("Occupation")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Location", _("Location")); - - /* Extract their Interests and put it in */ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, - "\nInterests\t", 0, " (/default.aspx?page=searchresults", 0, - "Undisclosed", _("Hobbies and Interests") /* _("Interests") */, - 0, NULL, NULL); - - if (found) - sect_info = TRUE; - - MSN_GOT_INFO_GET_FIELD("More about me", _("A Little About Me")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - if (has_tooltip_text) - purple_notify_user_info_remove_last_item(user_info); - } - - /* Social */ - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_section_header(user_info, _("Social")); - - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Marital status", _("Marital Status")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Interested in", _("Interests")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Pets", _("Pets")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Hometown", _("Hometown")); - MSN_GOT_INFO_GET_FIELD("Places lived", _("Places Lived")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Fashion", _("Fashion")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Humor", _("Humor")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Music", _("Music")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Favorite quote", _("Favorite Quote")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - purple_notify_user_info_remove_last_item(user_info); - } - - /* Contact Info */ - /* Personal */ - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_section_header(user_info, _("Contact Info")); - purple_notify_user_info_add_section_header(user_info, _("Personal")); - - MSN_GOT_INFO_GET_FIELD("Name", _("Name")); - MSN_GOT_INFO_GET_FIELD("Significant other", _("Significant Other")); - MSN_GOT_INFO_GET_FIELD("Home phone", _("Home Phone")); - MSN_GOT_INFO_GET_FIELD("Home phone 2", _("Home Phone 2")); - MSN_GOT_INFO_GET_FIELD("Home address", _("Home Address")); - MSN_GOT_INFO_GET_FIELD("Personal Mobile", _("Personal Mobile")); - MSN_GOT_INFO_GET_FIELD("Home fax", _("Home Fax")); - MSN_GOT_INFO_GET_FIELD("Personal email", _("Personal Email")); - MSN_GOT_INFO_GET_FIELD("Personal IM", _("Personal IM")); - MSN_GOT_INFO_GET_FIELD("Birthday", _("Birthday")); - MSN_GOT_INFO_GET_FIELD("Anniversary", _("Anniversary")); - MSN_GOT_INFO_GET_FIELD("Notes", _("Notes")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - has_contact_info = TRUE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - } - - /* Business */ - purple_notify_user_info_add_section_header(user_info, _("Work")); - MSN_GOT_INFO_GET_FIELD("Name", _("Name")); - MSN_GOT_INFO_GET_FIELD("Job title", _("Job Title")); - MSN_GOT_INFO_GET_FIELD("Company", _("Company")); - MSN_GOT_INFO_GET_FIELD("Department", _("Department")); - MSN_GOT_INFO_GET_FIELD("Profession", _("Profession")); - MSN_GOT_INFO_GET_FIELD("Work phone 1", _("Work Phone")); - MSN_GOT_INFO_GET_FIELD("Work phone 2", _("Work Phone 2")); - MSN_GOT_INFO_GET_FIELD("Work address", _("Work Address")); - MSN_GOT_INFO_GET_FIELD("Work mobile", _("Work Mobile")); - MSN_GOT_INFO_GET_FIELD("Work pager", _("Work Pager")); - MSN_GOT_INFO_GET_FIELD("Work fax", _("Work Fax")); - MSN_GOT_INFO_GET_FIELD("Work email", _("Work Email")); - MSN_GOT_INFO_GET_FIELD("Work IM", _("Work IM")); - MSN_GOT_INFO_GET_FIELD("Start date", _("Start Date")); - MSN_GOT_INFO_GET_FIELD("Notes", _("Notes")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - has_contact_info = TRUE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - } - - if (!has_contact_info) - { - /* Remove the Contact Info section header */ - purple_notify_user_info_remove_last_item(user_info); - } - -#if 0 /* these probably don't show up any more */ - /* - * The fields, 'A Little About Me', 'Favorite Things', 'Hobbies - * and Interests', 'Favorite Quote', and 'My Homepage' may or may - * not appear, in any combination. However, they do appear in - * certain order, so we can successively search to pin down the - * distinct values. - */ - - /* Check if they have A Little About Me */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "Favorite Things", '\n', NULL, - _("A Little About Me"), 0, NULL, NULL); - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "Hobbies and Interests", '\n', - NULL, _("A Little About Me"), 0, NULL, NULL); - } - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "Favorite Quote", '\n', NULL, - _("A Little About Me"), 0, NULL, NULL); - } - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "My Homepage \n\nTake a look", - '\n', - NULL, _("A Little About Me"), 0, NULL, NULL); - } - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "last updated", '\n', NULL, - _("A Little About Me"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Check if they have Favorite Things */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "Hobbies and Interests", '\n', NULL, - _("Favorite Things"), 0, NULL, NULL); - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "Favorite Quote", '\n', NULL, - _("Favorite Things"), 0, NULL, NULL); - } - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "My Homepage \n\nTake a look", '\n', - NULL, _("Favorite Things"), 0, NULL, NULL); - } - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "last updated", '\n', NULL, - _("Favorite Things"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Check if they have Hobbies and Interests */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Hobbies and Interests \n\n", 0, "Favorite Quote", '\n', NULL, - _("Hobbies and Interests"), 0, NULL, NULL); - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Hobbies and Interests \n\n", 0, "My Homepage \n\nTake a look", - '\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL); - } - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - " Hobbies and Interests \n\n", 0, "last updated", '\n', NULL, - _("Hobbies and Interests"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Check if they have Favorite Quote */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - "Favorite Quote \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, - _("Favorite Quote"), 0, NULL, NULL); - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - "Favorite Quote \n\n", 0, "last updated", '\n', NULL, - _("Favorite Quote"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Extract the last updated date and put it in */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " last updated:", 1, "\n", 0, NULL, _("Last Updated"), 0, - NULL, msn_info_date_reformat); - - if (found) - has_info = TRUE; -#endif - - /* If we were able to fetch a homepage url earlier, stick it in there */ - if (user_url != NULL) - { - tmp = g_strdup_printf("<a href=\"%s\">%s</a>", user_url, user_url); - purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp); - g_free(tmp); - g_free(user_url); - - has_info = TRUE; - } - - if (!has_info) - { - /* MSN doesn't actually distinguish between "unknown member" and - * a known member with an empty profile. Try to explain this fact. - * Note that if we have a nonempty tooltip_text, we know the user - * exists. - */ - /* This doesn't work with the new spaces profiles - Stu 3/2/06 - char *p = strstr(url_buffer, "Unknown Member "); - * This might not work for long either ... */ - /* Nope, it failed some time before 5/2/07 :( - char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\""); - * Let's see how long this one holds out for ... */ - char *p = strstr(url_buffer, "
gc), info_data->name); - purple_notify_user_info_add_pair(user_info, - _("Error retrieving profile"), NULL); - purple_notify_user_info_add_pair(user_info, NULL, - ((p && b) ? _("The user has not created a public profile.") : - (p ? _("MSN reported not being able to find the user's profile. " - "This either means that the user does not exist, " - "or that the user exists " - "but has not created a public profile.") : - _("Could not find " /* This should never happen */ - "any information in the user's profile. " - "The user most likely does not exist.")))); - } - - /* put a link to the actual profile URL */ - purple_notify_user_info_add_section_break(user_info); - tmp = g_strdup_printf("%s", - PROFILE_URL, info_data->name, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - -#if PHOTO_SUPPORT - /* Find the URL to the photo; must be before the marshalling [Bug 994207] */ - photo_url_text = msn_get_photo_url(url_text); - purple_debug_info("msn", "photo url:{%s}\n", photo_url_text ? photo_url_text : "(null)"); - - /* Marshall the existing state */ - info2_data = g_new0(MsnGetInfoStepTwoData, 1); - info2_data->info_data = info_data; - info2_data->stripped = stripped; - info2_data->url_buffer = url_buffer; - info2_data->user_info = user_info; - info2_data->photo_url_text = photo_url_text; - - /* Try to put the photo in there too, if there's one */ - if (photo_url_text) - { - purple_util_fetch_url_len(photo_url_text, FALSE, NULL, FALSE, MAX_HTTP_BUDDYICON_BYTES, msn_got_photo, - info2_data); - } - else - { - /* Emulate a callback */ - /* TODO: Huh? */ - msn_got_photo(NULL, info2_data, NULL, 0, NULL); - } -} - -static void -msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, gsize len, const gchar *error_message) -{ - MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data; - int id = -1; - - /* Unmarshall the saved state */ - MsnGetInfoData *info_data = info2_data->info_data; - char *stripped = info2_data->stripped; - char *url_buffer = info2_data->url_buffer; - PurpleNotifyUserInfo *user_info = info2_data->user_info; - char *photo_url_text = info2_data->photo_url_text; - - /* Make sure the connection is still valid if we got here by fetching a photo url */ - /* TODO: Instead of this, we should be canceling this when we disconnect */ - if (url_text && (error_message != NULL || - g_list_find(purple_connections_get_all(), info_data->gc) == NULL)) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); - g_free(photo_url_text); - g_free(info2_data); - - return; - } - - /* Try to put the photo in there too, if there's one and is readable */ - if (user_data && url_text && len != 0) - { - if (strstr(url_text, "400 Bad Request") - || strstr(url_text, "403 Forbidden") - || strstr(url_text, "404 Not Found")) - { - - purple_debug_info("msn", "Error getting %s: %s\n", - photo_url_text, url_text); - } - else - { - char buf[1024]; - purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT " bytes\n", photo_url_text, len); - id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - g_snprintf(buf, sizeof(buf), "
", id); - purple_notify_user_info_prepend_pair(user_info, NULL, buf); - } - } - - /* We continue here from msn_got_info, as if nothing has happened */ -#endif - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); -#if PHOTO_SUPPORT - g_free(photo_url_text); - g_free(info2_data); - if (id != -1) - purple_imgstore_unref_by_id(id); -#endif -} - -static void -msn_get_info(PurpleConnection *gc, const char *name) -{ - MsnGetInfoData *data; - char *url; - - data = g_new0(MsnGetInfoData, 1); - data->gc = gc; - data->name = g_strdup(name); - - url = g_strdup_printf("%s%s", PROFILE_URL, name); - - purple_util_fetch_url(url, FALSE, - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); - - g_free(url); -} - -static gboolean msn_load(PurplePlugin *plugin) -{ - msn_notification_init(); - msn_switchboard_init(); - msn_sync_init(); - - return TRUE; -} - -static gboolean msn_unload(PurplePlugin *plugin) -{ - msn_notification_end(); - msn_switchboard_end(); - msn_sync_end(); - - return TRUE; -} - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "msnim")) - return FALSE; - - acct = find_acct("prpl-msn", acct_id); - - if (!acct) - return FALSE; - - /* msnim:chat?contact=user@domain.tld */ - if (!g_ascii_strcasecmp(cmd, "Chat")) { - char *sname = g_hash_table_lookup(params, "contact"); - if (sname) { - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, sname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); - purple_conversation_present(conv); - } - /*else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im();*/ - - return TRUE; - } - /* msnim:add?contact=user@domain.tld */ - else if (!g_ascii_strcasecmp(cmd, "Add")) { - char *name = g_hash_table_lookup(params, "contact"); - purple_blist_request_add_buddy(acct, name, NULL, NULL); - return TRUE; - } - - return FALSE; -} - - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - msn_list_icon, /* list_icon */ - msn_list_emblems, /* list_emblems */ - msn_status_text, /* status_text */ - msn_tooltip_text, /* tooltip_text */ - msn_status_types, /* away_states */ - msn_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - msn_login, /* login */ - msn_close, /* close */ - msn_send_im, /* send_im */ - NULL, /* set_info */ - msn_send_typing, /* send_typing */ - msn_get_info, /* get_info */ - msn_set_status, /* set_away */ - msn_set_idle, /* set_idle */ - NULL, /* change_passwd */ - msn_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - msn_rem_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - msn_add_permit, /* add_permit */ - msn_add_deny, /* add_deny */ - msn_rem_permit, /* rem_permit */ - msn_rem_deny, /* rem_deny */ - msn_set_permit_deny, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - msn_chat_invite, /* chat_invite */ - msn_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - msn_chat_send, /* chat_send */ - msn_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - msn_alias_buddy, /* alias_buddy */ - msn_group_buddy, /* group_buddy */ - msn_rename_group, /* rename_group */ - NULL, /* buddy_free */ - msn_convo_closed, /* convo_closed */ - msn_normalize, /* normalize */ - msn_set_buddy_icon, /* set_buddy_icon */ - msn_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - msn_can_receive_file, /* can_receive_file */ - msn_send_file, /* send_file */ - msn_new_xfer, /* new_xfer */ - msn_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - msn_send_attention, /* send_attention */ - msn_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - msn_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-msn", /**< id */ - "MSN", /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Windows Live Messenger Protocol Plugin"), /**< summary */ - N_("Windows Live Messenger Protocol Plugin"), /**< description */ - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - msn_load, /**< load */ - msn_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - msn_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Server"), "server", - MSN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_int_new(_("Port"), "port", MSN_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Use HTTP Method"), - "http_method", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("HTTP Method Server"), - "http_method_server", MSN_HTTPCONN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Show custom smileys"), - "custom_smileys", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-msn", msn_cmd_nudge, - _("nudge: nudge a user to get their attention"), NULL); - - purple_prefs_remove("/plugins/prpl/msn"); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(msn_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(msn, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/** - * @file msn.h The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_H_ -#define _MSN_H_ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "connection.h" -#include "conversation.h" -#include "debug.h" -#include "cipher.h" -#include "notify.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "servconn.h" -#include "sslconn.h" -#include "util.h" - -#include "ft.h" - -#include "msg.h" - -#define MSN_BUF_LEN 8192 - -/* Windows Live Messenger Server*/ -#define MSN_SERVER "messenger.hotmail.com" -#define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com" -#define MSN_PORT 1863 -#define WLM_PROT_VER 15 - -#define WLM_MAX_PROTOCOL 15 -#define WLM_MIN_PROTOCOL 15 - -#define MSN_TYPING_RECV_TIMEOUT 6 -#define MSN_TYPING_SEND_TIMEOUT 4 - -#define PROFILE_URL "http://spaces.live.com/profile.aspx?mem=" -#define PHOTO_URL " contactparams:photopreauthurl=\"" - -#define BUDDY_ALIAS_MAXLEN 387 - -#define MSN_CAM_GUID "4BD96FC0-AB17-4425-A14A-439185962DC8" -#define MSN_CAM_REQUEST_GUID "1C9AA97E-9C05-4583-A3BD-908A196F1E92" -#define MSN_FT_GUID "5D3E02AB-6190-11D3-BBBB-00C04F795683" -#define MSN_OBJ_GUID "A4268EEC-FEC5-49E5-95C3-F126696BDBF6" - -#define MSN_CLIENTINFO \ - "Client-Name: Purple/" VERSION "\r\n" \ - "Chat-Logging: Y\r\n" - -/* Index into attention_types */ -#define MSN_NUDGE 0 - -typedef enum -{ - MSN_LIST_FL_OP = 0x01, - MSN_LIST_AL_OP = 0x02, - MSN_LIST_BL_OP = 0x04, - MSN_LIST_RL_OP = 0x08, - MSN_LIST_PL_OP = 0x10 - -} MsnListOp; -#define MSN_LIST_OP_MASK 0x07 - -typedef enum -{ - MSN_CLIENT_CAP_WIN_MOBILE = 0x0000001, - MSN_CLIENT_CAP_INK_GIF = 0x0000004, - MSN_CLIENT_CAP_INK_ISF = 0x0000008, - MSN_CLIENT_CAP_VIDEO_CHAT = 0x0000010, - MSN_CLIENT_CAP_PACKET = 0x0000020, - MSN_CLIENT_CAP_MSNMOBILE = 0x0000040, - MSN_CLIENT_CAP_MSNDIRECT = 0x0000080, - MSN_CLIENT_CAP_WEBMSGR = 0x0000200, - MSN_CLIENT_CAP_TGW = 0x0000800, - MSN_CLIENT_CAP_SPACE = 0x0001000, - MSN_CLIENT_CAP_MCE = 0x0002000, - MSN_CLIENT_CAP_DIRECTIM = 0x0004000, - MSN_CLIENT_CAP_WINKS = 0x0008000, - MSN_CLIENT_CAP_SEARCH = 0x0010000, - MSN_CLIENT_CAP_BOT = 0x0020000, - MSN_CLIENT_CAP_VOICEIM = 0x0040000, - MSN_CLIENT_CAP_SCHANNEL = 0x0080000, - MSN_CLIENT_CAP_SIP_INVITE = 0x0100000, - MSN_CLIENT_CAP_SDRIVE = 0x0400000, - MSN_CLIENT_CAP_ONECARE = 0x1000000, - MSN_CLIENT_CAP_P2P_TURN = 0x2000000, - MSN_CLIENT_CAP_P2P_BOOTSTRAP_VIA_UUN = 0x4000000, - -} MsnClientCaps; - -typedef enum -{ - MSN_CLIENT_EXT_CAP_RTC_VIDEO = 0x10, - MSN_CLIENT_EXT_CAP_P2PV2 = 0x20 -} MsnClientExtCaps; - -typedef enum -{ - MSN_CLIENT_VER_5_0 = 0x00, - MSN_CLIENT_VER_6_0 = 0x10, /* MSNC1 */ - MSN_CLIENT_VER_6_1 = 0x20, /* MSNC2 */ - MSN_CLIENT_VER_6_2 = 0x30, /* MSNC3 */ - MSN_CLIENT_VER_7_0 = 0x40, /* MSNC4 */ - MSN_CLIENT_VER_7_5 = 0x50, /* MSNC5 */ - MSN_CLIENT_VER_8_0 = 0x60, /* MSNC6 */ - MSN_CLIENT_VER_8_1 = 0x70, /* MSNC7 */ - MSN_CLIENT_VER_8_5 = 0x80, /* MSNC8 */ - MSN_CLIENT_VER_9_0 = 0x90, /* MSNC9 */ - MSN_CLIENT_VER_14_0 = 0xA0 /* MSNC10 */ - -} MsnClientVerId; - -#define MSN_CLIENT_ID_VERSION MSN_CLIENT_VER_7_0 -#define MSN_CLIENT_ID_CAPABILITIES (MSN_CLIENT_CAP_PACKET|MSN_CLIENT_CAP_INK_GIF|MSN_CLIENT_CAP_VOICEIM) - -#define MSN_CLIENT_ID \ - ((MSN_CLIENT_ID_VERSION << 24) | \ - (MSN_CLIENT_ID_CAPABILITIES)) - -#define MSN_CLIENT_EXT_ID 0 - -gboolean msn_email_is_valid(const char *passport); -void msn_act_id(PurpleConnection *gc, const char *entry); -void msn_send_privacy(PurpleConnection *gc); -void msn_send_im_message(MsnSession *session, MsnMessage *msg); - -#endif /* _MSN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,582 +0,0 @@ -/** - * @file msnutils.c Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msnutils.h" - -#include "cipher.h" - -char *rand_guid(void); - -/************************************************************************** - * Util - **************************************************************************/ -char * -rand_guid() -{ - return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X", - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111); -} - -void -msn_parse_format(const char *mime, char **pre_ret, char **post_ret) -{ - char *cur; - GString *pre = g_string_new(NULL); - GString *post = g_string_new(NULL); - unsigned int colors[3]; - - if (pre_ret != NULL) *pre_ret = NULL; - if (post_ret != NULL) *post_ret = NULL; - - cur = strstr(mime, "FN="); - - if (cur && (*(cur = cur + 3) != ';')) - { - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - - cur = strstr(mime, "EF="); - - if (cur && (*(cur = cur + 3) != ';')) - { - while (*cur && *cur != ';') - { - pre = g_string_append_c(pre, '<'); - pre = g_string_append_c(pre, *cur); - pre = g_string_append_c(pre, '>'); - post = g_string_prepend_c(post, '>'); - post = g_string_prepend_c(post, *cur); - post = g_string_prepend_c(post, '/'); - post = g_string_prepend_c(post, '<'); - cur++; - } - } - - cur = strstr(mime, "CO="); - - if (cur && (*(cur = cur + 3) != ';')) - { - int i; - - i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); - - if (i > 0) - { - char tag[64]; - - if (i == 1) - { - colors[1] = 0; - colors[2] = 0; - } - else if (i == 2) - { - unsigned int temp = colors[0]; - - colors[0] = colors[1]; - colors[1] = temp; - colors[2] = 0; - } - else if (i == 3) - { - unsigned int temp = colors[2]; - - colors[2] = colors[0]; - colors[0] = temp; - } - - g_snprintf(tag, sizeof(tag), - "", - colors[0], colors[1], colors[2]); - - pre = g_string_append(pre, tag); - post = g_string_prepend(post, ""); - } - } - - cur = strstr(mime, "RL="); - - if (cur && (*(cur = cur + 3) != ';')) - { - if (*cur == '1') - { - /* RTL text was received */ - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - } - - cur = g_strdup(purple_url_decode(pre->str)); - g_string_free(pre, TRUE); - - if (pre_ret != NULL) - *pre_ret = cur; - else - g_free(cur); - - cur = g_strdup(purple_url_decode(post->str)); - g_string_free(post, TRUE); - - if (post_ret != NULL) - *post_ret = cur; - else - g_free(cur); -} - -/*encode the str to RFC2047 style - * Currently only support the UTF-8 and base64 encode - */ -char * -msn_encode_mime(const char *str) -{ - gchar *base64, *retval; - - g_return_val_if_fail(str != NULL, NULL); - - base64 = purple_base64_encode((guchar *)str, strlen(str)); - retval = g_strdup_printf("=?utf-8?B?%s?=", base64); - g_free(base64); - - return retval; -} - -/* - * We need this because we're only supposed to encode spaces in the font - * names. purple_url_encode() isn't acceptable. - */ -static const char * -encode_spaces(const char *str) -{ - static char buf[BUF_LEN]; - const char *c; - char *d; - - g_return_val_if_fail(str != NULL, NULL); - - for (c = str, d = buf; *c != '\0'; c++) - { - if (*c == ' ') - { - *d++ = '%'; - *d++ = '2'; - *d++ = '0'; - } - else - *d++ = *c; - } - *d = '\0'; - - return buf; -} - -/* - * Taken from the zephyr plugin. - * This parses HTML formatting (put out by one of the gtkimhtml widgets - * and converts it to msn formatting. It doesn't deal with the tag closing, - * but gtkimhtml widgets give valid html. - * It currently deals properly with , , , , - * , , . - * It ignores and - */ -void -msn_import_html(const char *html, char **attributes, char **message) -{ - int len, retcount = 0; - const char *c; - char *msg; - char *fontface = NULL; - char fonteffect[5]; - char fontcolor[7]; - char direction = '0'; - - gboolean has_bold = FALSE; - gboolean has_italic = FALSE; - gboolean has_underline = FALSE; - gboolean has_strikethrough = FALSE; - - g_return_if_fail(html != NULL); - g_return_if_fail(attributes != NULL); - g_return_if_fail(message != NULL); - - len = strlen(html); - msg = g_malloc0(len + 1); - - memset(fontcolor, 0, sizeof(fontcolor)); - strcat(fontcolor, "0"); - memset(fonteffect, 0, sizeof(fonteffect)); - - for (c = html; *c != '\0';) - { - if (*c == '<') - { - if (!g_ascii_strncasecmp(c + 1, "br>", 3)) - { - msg[retcount++] = '\r'; - msg[retcount++] = '\n'; - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "i>", 2)) - { - if (!has_italic) - { - strcat(fonteffect, "I"); - has_italic = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "b>", 2)) - { - if (!has_bold) - { - strcat(fonteffect, "B"); - has_bold = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "u>", 2)) - { - if (!has_underline) - { - strcat(fonteffect, "U"); - has_underline = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "s>", 2)) - { - if (!has_strikethrough) - { - strcat(fonteffect, "S"); - has_strikethrough = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "a href=\"", 8)) - { - c += 9; - - if (!g_ascii_strncasecmp(c, "mailto:", 7)) - c += 7; - - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - msg[retcount++] = *c++; - - if (*c != '\0') - c += 2; - - /* ignore descriptive string */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "", 4)) - c++; - - if (*c != '\0') - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "span", 4)) - { - /* Bi-directional text support using CSS properties in span tags */ - c += 5; - - while (*c != '\0' && *c != '>') - { - while (*c == ' ') - c++; - if (!g_ascii_strncasecmp(c, "dir=\"rtl\"", 9)) - { - c += 9; - direction = '1'; - } - else if (!g_ascii_strncasecmp(c, "style=\"", 7)) - { - /* Parse inline CSS attributes */ - char *attributes; - int attr_len = 0; - c += 7; - while (*(c + attr_len) != '\0' && *(c + attr_len) != '"') - attr_len++; - if (*(c + attr_len) == '"') - { - char *attr_dir; - attributes = g_strndup(c, attr_len); - attr_dir = purple_markup_get_css_property(attributes, "direction"); - if (attr_dir && (!g_ascii_strncasecmp(attr_dir, "RTL", 3))) - direction = '1'; - g_free(attr_dir); - g_free(attributes); - } - - } - else - { - c++; - } - } - if (*c == '>') - c++; - } - else if (!g_ascii_strncasecmp(c + 1, "font", 4)) - { - c += 5; - - while ((*c != '\0') && !g_ascii_strncasecmp(c, " ", 1)) - c++; - - if (!g_ascii_strncasecmp(c, "color=\"#", 7)) - { - c += 8; - - fontcolor[0] = *(c + 4); - fontcolor[1] = *(c + 5); - fontcolor[2] = *(c + 2); - fontcolor[3] = *(c + 3); - fontcolor[4] = *c; - fontcolor[5] = *(c + 1); - - c += 8; - } - else if (!g_ascii_strncasecmp(c, "face=\"", 6)) - { - const char *end = NULL; - const char *comma = NULL; - unsigned int namelen = 0; - - c += 6; - end = strchr(c, '\"'); - comma = strchr(c, ','); - - if (comma == NULL || comma > end) - namelen = (unsigned int)(end - c); - else - namelen = (unsigned int)(comma - c); - - fontface = g_strndup(c, namelen); - c = end + 2; - } - else - { - /* Drop all unrecognized/misparsed font tags */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - c++; - - if (*c != '\0') - c += 2; - } - } - else - { - while ((*c != '\0') && (*c != '>')) - c++; - if (*c != '\0') - c++; - } - } - else if (*c == '&') - { - if (!g_ascii_strncasecmp(c, "<", 4)) - { - msg[retcount++] = '<'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, ">", 4)) - { - msg[retcount++] = '>'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, " ", 6)) - { - msg[retcount++] = ' '; - c += 6; - } - else if (!g_ascii_strncasecmp(c, """, 6)) - { - msg[retcount++] = '"'; - c += 6; - } - else if (!g_ascii_strncasecmp(c, "&", 5)) - { - msg[retcount++] = '&'; - c += 5; - } - else if (!g_ascii_strncasecmp(c, "'", 6)) - { - msg[retcount++] = '\''; - c += 6; - } - else - msg[retcount++] = *c++; - } - else - msg[retcount++] = *c++; - } - - if (fontface == NULL) - fontface = g_strdup("Segoe UI"); - - *attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0; RL=%c", - encode_spaces(fontface), - fonteffect, fontcolor, direction); - *message = msg; - - g_free(fontface); -} - -void -msn_parse_socket(const char *str, char **ret_host, int *ret_port) -{ - char *host; - char *c; - int port; - - host = g_strdup(str); - - if ((c = strchr(host, ':')) != NULL) { - *c = '\0'; - port = atoi(c + 1); - } else { - port = 1863; - } - - *ret_host = host; - *ret_port = port; -} - -/*************************************************************************** - * MSN Challenge Computing Function - ***************************************************************************/ - -/* - * Handle MSN Challenge computation - * This algorithm references - * http://imfreedom.org/wiki/index.php/MSN:NS/Challenges - */ -#define BUFSIZE 256 -void -msn_handle_chl(char *input, char *output) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - const guchar productKey[] = MSNP15_WLM_PRODUCT_KEY; - const guchar productID[] = MSNP15_WLM_PRODUCT_ID; - const char hexChars[] = "0123456789abcdef"; - char buf[BUFSIZE]; - unsigned char md5Hash[16]; - unsigned char *newHash; - unsigned int *md5Parts; - unsigned int *chlStringParts; - unsigned int newHashParts[5]; - - long long nHigh = 0, nLow = 0; - - int len; - int i; - - /* Create the MD5 hash by using Purple MD5 algorithm */ - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (guchar *)input, strlen(input)); - purple_cipher_context_append(context, productKey, sizeof(productKey) - 1); - purple_cipher_context_digest(context, sizeof(md5Hash), md5Hash, NULL); - purple_cipher_context_destroy(context); - - /* Split it into four integers */ - md5Parts = (unsigned int *)md5Hash; - for (i = 0; i < 4; i++) { - /* adjust endianess */ - md5Parts[i] = GUINT_TO_LE(md5Parts[i]); - - /* & each integer with 0x7FFFFFFF */ - /* and save one unmodified array for later */ - newHashParts[i] = md5Parts[i]; - md5Parts[i] &= 0x7FFFFFFF; - } - - /* make a new string and pad with '0' to length that's a multiple of 8 */ - snprintf(buf, BUFSIZE - 5, "%s%s", input, productID); - len = strlen(buf); - if ((len % 8) != 0) { - int fix = 8 - (len % 8); - memset(&buf[len], '0', fix); - buf[len + fix] = '\0'; - len += fix; - } - - /* split into integers */ - chlStringParts = (unsigned int *)buf; - - /* this is magic */ - for (i = 0; i < (strlen(buf) / 4); i += 2) { - long long temp; - - chlStringParts[i] = GUINT_TO_LE(chlStringParts[i]); - chlStringParts[i + 1] = GUINT_TO_LE(chlStringParts[i + 1]); - - temp = (0x0E79A9C1 * (long long)chlStringParts[i]) % 0x7FFFFFFF; - temp = (md5Parts[0] * (temp + nLow) + md5Parts[1]) % 0x7FFFFFFF; - nHigh += temp; - - temp = ((long long)chlStringParts[i + 1] + temp) % 0x7FFFFFFF; - nLow = (md5Parts[2] * temp + md5Parts[3]) % 0x7FFFFFFF; - nHigh += nLow; - } - nLow = (nLow + md5Parts[1]) % 0x7FFFFFFF; - nHigh = (nHigh + md5Parts[3]) % 0x7FFFFFFF; - - newHashParts[0] ^= nLow; - newHashParts[1] ^= nHigh; - newHashParts[2] ^= nLow; - newHashParts[3] ^= nHigh; - - /* adjust endianness */ - for(i = 0; i < 4; i++) - newHashParts[i] = GUINT_TO_LE(newHashParts[i]); - - /* make a string of the parts */ - newHash = (unsigned char *)newHashParts; - - /* convert to hexadecimal */ - for (i = 0; i < 16; i++) - { - output[i * 2] = hexChars[(newHash[i] >> 4) & 0xF]; - output[(i * 2) + 1] = hexChars[newHash[i] & 0xF]; - } - - output[32] = '\0'; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/msnutils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/** - * @file msnutils.h Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_UTILS_H_ -#define _MSN_UTILS_H_ - -/*encode the str to RFC2047 style*/ -char * msn_encode_mime(const char *str); - -/** - * Generate the Random GUID - */ -char * rand_guid(void); - -/** - * Parses the MSN message formatting into a format compatible with Purple. - * - * @param mime The mime header with the formatting. - * @param pre_ret The returned prefix string. - * @param post_ret The returned postfix string. - * - * @return The new message. - */ -void msn_parse_format(const char *mime, char **pre_ret, char **post_ret); - -/** - * Parses the Purple message formatting (html) into the MSN format. - * - * @param html The html message to format. - * @param attributes The returned attributes string. - * @param message The returned message string. - * - * @return The new message. - */ -void msn_import_html(const char *html, char **attributes, char **message); - -void msn_parse_socket(const char *str, char **ret_host, int *ret_port); -void msn_handle_chl(char *input, char *output); - -#endif /* _MSN_UTILS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,679 +0,0 @@ -/** - * @file nexus.c MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "soap.h" -#include "nexus.h" -#include "notification.h" - -/************************************************************************** - * Valid Ticket Tokens - **************************************************************************/ - -#define SSO_VALID_TICKET_DOMAIN 0 -#define SSO_VALID_TICKET_POLICY 1 -static char *ticket_domains[][2] = { - /* http://msnpiki.msnfanatic.com/index.php/MSNP15:SSO */ - /* {"Domain", "Policy Ref URI"}, Purpose */ - {"messengerclear.live.com", NULL}, /* Authentication for messenger. */ - {"messenger.msn.com", "?id=507"}, /* Authentication for receiving OIMs. */ - {"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */ - {"messengersecure.live.com", "MBI_SSL"}, /* Authentication for sending OIMs. */ - {"spaces.live.com", "MBI"}, /* Authentication for the Windows Live Spaces */ - {"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */ - {"storage.live.com", "MBI"}, /* Storage REST API */ -}; - -/************************************************************************** - * Main - **************************************************************************/ - -MsnNexus * -msn_nexus_new(MsnSession *session) -{ - MsnNexus *nexus; - int i; - - nexus = g_new0(MsnNexus, 1); - nexus->session = session; - - nexus->token_len = sizeof(ticket_domains) / sizeof(char *[2]); - nexus->tokens = g_new0(MsnTicketToken, nexus->token_len); - - for (i = 0; i < nexus->token_len; i++) - nexus->tokens[i].token = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - return nexus; -} - -void -msn_nexus_destroy(MsnNexus *nexus) -{ - int i; - for (i = 0; i < nexus->token_len; i++) { - g_hash_table_destroy(nexus->tokens[i].token); - g_free(nexus->tokens[i].secret); - g_slist_free(nexus->tokens[i].updates); - } - - g_free(nexus->tokens); - g_free(nexus->policy); - g_free(nexus->nonce); - g_free(nexus->cipher); - g_free(nexus->secret); - g_free(nexus); -} - -/************************************************************************** - * RPS/SSO Authentication - **************************************************************************/ - -static char * -rps_create_key(const char *key, int key_len, const char *data, size_t data_len) -{ - const guchar magic[] = "WS-SecureConversation"; - const int magic_len = sizeof(magic) - 1; - - PurpleCipherContext *hmac; - guchar hash1[20], hash2[20], hash3[20], hash4[20]; - char *result; - - hmac = purple_cipher_context_new_by_name("hmac", NULL); - - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, magic, magic_len); - purple_cipher_context_append(hmac, (guchar *)data, data_len); - purple_cipher_context_digest(hmac, sizeof(hash1), hash1, NULL); - - purple_cipher_context_reset(hmac, NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, hash1, 20); - purple_cipher_context_append(hmac, magic, magic_len); - purple_cipher_context_append(hmac, (guchar *)data, data_len); - purple_cipher_context_digest(hmac, sizeof(hash2), hash2, NULL); - - purple_cipher_context_reset(hmac, NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, hash1, 20); - purple_cipher_context_digest(hmac, sizeof(hash3), hash3, NULL); - - purple_cipher_context_reset(hmac, NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, hash3, sizeof(hash3)); - purple_cipher_context_append(hmac, magic, magic_len); - purple_cipher_context_append(hmac, (guchar *)data, data_len); - purple_cipher_context_digest(hmac, sizeof(hash4), hash4, NULL); - - purple_cipher_context_destroy(hmac); - - result = g_malloc(24); - memcpy(result, hash2, sizeof(hash2)); - memcpy(result + sizeof(hash2), hash4, 4); - - return result; -} - -static char * -des3_cbc(const char *key, const char *iv, const char *data, int len, gboolean decrypt) -{ - PurpleCipherContext *des3; - char *out; - size_t outlen; - - des3 = purple_cipher_context_new_by_name("des3", NULL); - purple_cipher_context_set_key(des3, (guchar *)key); - purple_cipher_context_set_batch_mode(des3, PURPLE_CIPHER_BATCH_MODE_CBC); - purple_cipher_context_set_iv(des3, (guchar *)iv, 8); - - out = g_malloc(len); - if (decrypt) - purple_cipher_context_decrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); - else - purple_cipher_context_encrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); - - purple_cipher_context_destroy(des3); - - return out; -} - -#define CRYPT_MODE_CBC 1 -#define CIPHER_TRIPLE_DES 0x6603 -#define HASH_SHA1 0x8004 -static char * -msn_rps_encrypt(MsnNexus *nexus) -{ - MsnUsrKey *usr_key; - const char magic1[] = "SESSION KEY HASH"; - const char magic2[] = "SESSION KEY ENCRYPTION"; - PurpleCipherContext *hmac; - size_t len; - guchar hash[20]; - char *key1, *key2, *key3; - gsize key1_len; - int *iv; - char *nonce_fixed; - char *cipher; - char *response; - - usr_key = g_malloc(sizeof(MsnUsrKey)); - usr_key->size = GUINT32_TO_LE(28); - usr_key->crypt_mode = GUINT32_TO_LE(CRYPT_MODE_CBC); - usr_key->cipher_type = GUINT32_TO_LE(CIPHER_TRIPLE_DES); - usr_key->hash_type = GUINT32_TO_LE(HASH_SHA1); - usr_key->iv_len = GUINT32_TO_LE(8); - usr_key->hash_len = GUINT32_TO_LE(20); - usr_key->cipher_len = GUINT32_TO_LE(72); - - key1 = (char *)purple_base64_decode((const char *)nexus->tokens[MSN_AUTH_MESSENGER].secret, &key1_len); - key2 = rps_create_key(key1, key1_len, magic1, sizeof(magic1) - 1); - key3 = rps_create_key(key1, key1_len, magic2, sizeof(magic2) - 1); - - iv = (int *)usr_key->iv; - iv[0] = rand(); - iv[1] = rand(); - - len = strlen(nexus->nonce); - hmac = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key2, 24); - purple_cipher_context_append(hmac, (guchar *)nexus->nonce, len); - purple_cipher_context_digest(hmac, 20, hash, NULL); - purple_cipher_context_destroy(hmac); - - /* We need to pad this to 72 bytes, apparently */ - nonce_fixed = g_malloc(len + 8); - memcpy(nonce_fixed, nexus->nonce, len); - memset(nonce_fixed + len, 0x08, 8); - cipher = des3_cbc(key3, usr_key->iv, nonce_fixed, len + 8, FALSE); - g_free(nonce_fixed); - - memcpy(usr_key->hash, hash, 20); - memcpy(usr_key->cipher, cipher, 72); - - g_free(key1); - g_free(key2); - g_free(key3); - g_free(cipher); - - response = purple_base64_encode((guchar *)usr_key, sizeof(MsnUsrKey)); - - g_free(usr_key); - - return response; -} - -/************************************************************************** - * Login - **************************************************************************/ - -/* Used to specify which token to update when only doing single updates */ -typedef struct _MsnNexusUpdateData MsnNexusUpdateData; -struct _MsnNexusUpdateData { - MsnNexus *nexus; - int id; -}; - -typedef struct _MsnNexusUpdateCallback MsnNexusUpdateCallback; -struct _MsnNexusUpdateCallback { - GSourceFunc cb; - gpointer data; -}; - -#if !GLIB_CHECK_VERSION(2, 12, 0) -static gboolean -nexus_remove_all_cb(gpointer key, gpointer val, gpointer data) -{ - return TRUE; -} -#endif - - -static gboolean -nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) -{ - char *token_str, *expiry_str; - const char *id_str; - char **elems, **cur, **tokens; - xmlnode *token = xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken"); - xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); - xmlnode *expires = xmlnode_get_child(node, "LifeTime/Expires"); - - if (!token) - return FALSE; - - /* Use the ID that the server sent us */ - if (id == -1) { - id_str = xmlnode_get_attrib(token, "Id"); - if (id_str == NULL) - return FALSE; - - id = atol(id_str + 7) - 1; /* 'Compact#' or 'PPToken#' */ - if (id >= nexus->token_len) - return FALSE; /* Where did this come from? */ - } - - token_str = xmlnode_get_data(token); - if (token_str == NULL) - return FALSE; - -#if GLIB_CHECK_VERSION(2, 12, 0) - g_hash_table_remove_all(nexus->tokens[id].token); -#else - g_hash_table_foreach_remove(nexus->tokens[id].token, - nexus_remove_all_cb, NULL); -#endif - - elems = g_strsplit(token_str, "&", 0); - - for (cur = elems; *cur != NULL; cur++) { - tokens = g_strsplit(*cur, "=", 2); - g_hash_table_insert(nexus->tokens[id].token, tokens[0], tokens[1]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - g_strfreev(elems); - g_free(token_str); - - if (secret) - nexus->tokens[id].secret = xmlnode_get_data(secret); - else - nexus->tokens[id].secret = NULL; - - /* Yay for MS using ISO-8601 */ - expiry_str = xmlnode_get_data(expires); - nexus->tokens[id].expiry = purple_str_to_time(expiry_str, - FALSE, NULL, NULL, NULL); - g_free(expiry_str); - - purple_debug_info("msn", "Updated ticket for domain '%s', expires at %" G_GINT64_FORMAT ".\n", - ticket_domains[id][SSO_VALID_TICKET_DOMAIN], - (gint64)nexus->tokens[id].expiry); - return TRUE; -} - -static gboolean -nexus_parse_collection(MsnNexus *nexus, int id, xmlnode *collection) -{ - xmlnode *node; - gboolean result; - - node = xmlnode_get_child(collection, "RequestSecurityTokenResponse"); - - if (!node) - return FALSE; - - result = TRUE; - for (; node && result; node = node->next) { - xmlnode *endpoint = xmlnode_get_child(node, "AppliesTo/EndpointReference/Address"); - char *address = xmlnode_get_data(endpoint); - - if (g_str_equal(address, "http://Passport.NET/tb")) { - /* This node contains the stuff for updating tokens. */ - char *data; - xmlnode *cipher = xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue"); - xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); - - g_free(nexus->cipher); - nexus->cipher = xmlnode_get_data(cipher); - data = xmlnode_get_data(secret); - g_free(nexus->secret); - nexus->secret = (char *)purple_base64_decode(data, NULL); - g_free(data); - - } else { - result = nexus_parse_token(nexus, id, node); - } - g_free(address); - } - - return result; -} - -static void -nexus_got_response_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnNexus *nexus = data; - MsnSession *session = nexus->session; - const char *ticket; - char *response; - - if (resp == NULL) { - msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Unable to connect")); - return; - } - - if (!nexus_parse_collection(nexus, -1, - xmlnode_get_child(resp->xml, - "Body/RequestSecurityTokenResponseCollection"))) { - msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Invalid response")); - return; - } - - ticket = msn_nexus_get_token_str(nexus, MSN_AUTH_MESSENGER); - response = msn_rps_encrypt(nexus); - msn_got_login_params(session, ticket, response); - g_free(response); -} - -/*when connect, do the SOAP Style windows Live ID authentication */ -void -msn_nexus_connect(MsnNexus *nexus) -{ - MsnSession *session = nexus->session; - const char *username; - const char *password; - char *password_xml; - GString *domains; - char *request; - int i; - - MsnSoapMessage *soap; - - purple_debug_info("msn", "Starting Windows Live ID authentication\n"); - msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); - - username = purple_account_get_username(session->account); - password = purple_connection_get_password(session->account->gc); - if (g_utf8_strlen(password, -1) > 16) { - /* max byte size for 16 utf8 characters is 64 + 1 for the null */ - gchar truncated[65]; - g_utf8_strncpy(truncated, password, 16); - password_xml = g_markup_escape_text(truncated, -1); - } else { - password_xml = g_markup_escape_text(password, -1); - } - - purple_debug_info("msn", "Logging on %s, with policy '%s', nonce '%s'\n", - username, nexus->policy, nexus->nonce); - - domains = g_string_new(NULL); - for (i = 0; i < nexus->token_len; i++) { - g_string_append_printf(domains, MSN_SSO_RST_TEMPLATE, - i+1, - ticket_domains[i][SSO_VALID_TICKET_DOMAIN], - ticket_domains[i][SSO_VALID_TICKET_POLICY] != NULL ? - ticket_domains[i][SSO_VALID_TICKET_POLICY] : - nexus->policy); - } - - request = g_strdup_printf(MSN_SSO_TEMPLATE, username, password_xml, domains->str); - g_free(password_xml); - g_string_free(domains, TRUE); - - soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); - g_free(request); - msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE, - nexus_got_response_cb, nexus); -} - -static void -nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnNexusUpdateData *ud = data; - MsnNexus *nexus = ud->nexus; - char iv[8] = {0,0,0,0,0,0,0,0}; - xmlnode *enckey; - char *tmp; - char *nonce; - gsize len; - char *key; - GSList *updates; - -#if 0 - char *decrypted_pp; -#endif - char *decrypted_data; - - if (resp == NULL) - return; - - purple_debug_info("msn", "Got Update Response for %s.\n", ticket_domains[ud->id][SSO_VALID_TICKET_DOMAIN]); - - enckey = xmlnode_get_child(resp->xml, "Header/Security/DerivedKeyToken"); - while (enckey) { - if (g_str_equal(xmlnode_get_attrib(enckey, "Id"), "EncKey")) - break; - enckey = xmlnode_get_next_twin(enckey); - } - if (!enckey) { - purple_debug_error("msn", "Invalid response in token update.\n"); - return; - } - - tmp = xmlnode_get_data(xmlnode_get_child(enckey, "Nonce")); - nonce = (char *)purple_base64_decode(tmp, &len); - key = rps_create_key(nexus->secret, 24, nonce, len); - g_free(tmp); - g_free(nonce); - -#if 0 - /* Don't know what this is for yet */ - tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, - "Header/EncryptedPP/EncryptedData/CipherData/CipherValue")); - if (tmp) { - decrypted_pp = des3_cbc(key, iv, tmp, len, TRUE); - g_free(tmp); - purple_debug_info("msn", "Got Response Header EncryptedPP: %s\n", decrypted_pp); - g_free(decrypted_pp); - } -#endif - - tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, - "Body/EncryptedData/CipherData/CipherValue")); - if (tmp) { - char *unescaped; - xmlnode *rstresponse; - - unescaped = (char *)purple_base64_decode(tmp, &len); - g_free(tmp); - - decrypted_data = des3_cbc(key, iv, unescaped, len, TRUE); - g_free(unescaped); - purple_debug_info("msn", "Got Response Body EncryptedData: %s\n", decrypted_data); - - rstresponse = xmlnode_from_str(decrypted_data, -1); - if (g_str_equal(rstresponse->name, "RequestSecurityTokenResponse")) - nexus_parse_token(nexus, ud->id, rstresponse); - else - nexus_parse_collection(nexus, ud->id, rstresponse); - g_free(decrypted_data); - } - - updates = nexus->tokens[ud->id].updates; - nexus->tokens[ud->id].updates = NULL; - while (updates != NULL) { - MsnNexusUpdateCallback *update = updates->data; - if (update->cb) - purple_timeout_add(0, update->cb, update->data); - g_free(update); - updates = g_slist_delete_link(updates, updates); - } - - g_free(ud); - g_free(key); -} - -void -msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data) -{ - MsnSession *session = nexus->session; - MsnNexusUpdateData *ud; - MsnNexusUpdateCallback *update; - PurpleCipherContext *sha1; - PurpleCipherContext *hmac; - - char *key; - - guchar digest[20]; - - struct tm *tm; - time_t now; - char *now_str; - char *timestamp; - char *timestamp_b64; - - char *domain; - char *domain_b64; - - char *signedinfo; - gint32 nonce[6]; - int i; - char *nonce_b64; - char *signature_b64; - guchar signature[20]; - - char *request; - MsnSoapMessage *soap; - - update = g_new0(MsnNexusUpdateCallback, 1); - update->cb = cb; - update->data = data; - - if (nexus->tokens[id].updates != NULL) { - /* Update already in progress. Just add to list and return. */ - purple_debug_info("msn", - "Ticket update for user '%s' on domain '%s' in progress. Adding request to queue.\n", - purple_account_get_username(session->account), - ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); - nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates, - update); - return; - } else { - purple_debug_info("msn", - "Updating ticket for user '%s' on domain '%s'\n", - purple_account_get_username(session->account), - ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); - nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates, - update); - } - - ud = g_new0(MsnNexusUpdateData, 1); - ud->nexus = nexus; - ud->id = id; - - sha1 = purple_cipher_context_new_by_name("sha1", NULL); - - domain = g_strdup_printf(MSN_SSO_RST_TEMPLATE, - id, - ticket_domains[id][SSO_VALID_TICKET_DOMAIN], - ticket_domains[id][SSO_VALID_TICKET_POLICY] != NULL ? - ticket_domains[id][SSO_VALID_TICKET_POLICY] : - nexus->policy); - purple_cipher_context_append(sha1, (guchar *)domain, strlen(domain)); - purple_cipher_context_digest(sha1, 20, digest, NULL); - domain_b64 = purple_base64_encode(digest, 20); - - now = time(NULL); - tm = gmtime(&now); - now_str = g_strdup(purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); - now += 5*60; - tm = gmtime(&now); - timestamp = g_strdup_printf(MSN_SSO_TIMESTAMP_TEMPLATE, - now_str, - purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); - purple_cipher_context_reset(sha1, NULL); - purple_cipher_context_append(sha1, (guchar *)timestamp, strlen(timestamp)); - purple_cipher_context_digest(sha1, 20, digest, NULL); - timestamp_b64 = purple_base64_encode(digest, 20); - g_free(now_str); - - purple_cipher_context_destroy(sha1); - - signedinfo = g_strdup_printf(MSN_SSO_SIGNEDINFO_TEMPLATE, - id, - domain_b64, - timestamp_b64); - - for (i = 0; i < 6; i++) - nonce[i] = rand(); - nonce_b64 = purple_base64_encode((guchar *)&nonce, sizeof(nonce)); - - key = rps_create_key(nexus->secret, 24, (char *)nonce, sizeof(nonce)); - hmac = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, 24); - purple_cipher_context_append(hmac, (guchar *)signedinfo, strlen(signedinfo)); - purple_cipher_context_digest(hmac, 20, signature, NULL); - purple_cipher_context_destroy(hmac); - signature_b64 = purple_base64_encode(signature, 20); - - request = g_strdup_printf(MSN_SSO_TOKEN_UPDATE_TEMPLATE, - nexus->cipher, - nonce_b64, - timestamp, - signedinfo, - signature_b64, - domain); - - g_free(nonce_b64); - g_free(domain_b64); - g_free(timestamp_b64); - g_free(timestamp); - g_free(key); - g_free(signature_b64); - g_free(signedinfo); - g_free(domain); - - soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); - g_free(request); - msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE, - nexus_got_update_cb, ud); -} - -GHashTable * -msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id) -{ - g_return_val_if_fail(nexus != NULL, NULL); - g_return_val_if_fail(id < nexus->token_len, NULL); - - return nexus->tokens[id].token; -} - -const char * -msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id) -{ - static char buf[1024]; - GHashTable *token = msn_nexus_get_token(nexus, id); - const char *msn_t; - const char *msn_p; - gint ret; - - g_return_val_if_fail(token != NULL, NULL); - - msn_t = g_hash_table_lookup(token, "t"); - msn_p = g_hash_table_lookup(token, "p"); - - g_return_val_if_fail(msn_t != NULL, NULL); - g_return_val_if_fail(msn_p != NULL, NULL); - - ret = g_snprintf(buf, sizeof(buf) - 1, "t=%s&p=%s", msn_t, msn_p); - g_return_val_if_fail(ret != -1, NULL); - - return buf; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/nexus.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,234 +0,0 @@ -/** - * @file nexus.h MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_NEXUS_H_ -#define _MSN_NEXUS_H_ - -/* Index into ticket_tokens in nexus.c Keep updated! */ -typedef enum -{ - MSN_AUTH_MESSENGER = 0, - MSN_AUTH_MESSENGER_WEB = 1, - MSN_AUTH_CONTACTS = 2, - MSN_AUTH_LIVE_SECURE = 3, - MSN_AUTH_SPACES = 4, - MSN_AUTH_LIVE_CONTACTS = 5, - MSN_AUTH_STORAGE = 6 -} MsnAuthDomains; - -#define MSN_SSO_SERVER "login.live.com" -#define SSO_POST_URL "/RST.srf" - -#define MSN_SSO_RST_TEMPLATE \ -""\ - "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue"\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ -"" - -#define MSN_SSO_TEMPLATE ""\ -""\ - "
"\ - ""\ - "{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}"\ - "4"\ - "1"\ - ""\ - "AQAAAAIAAABsYwQAAAAxMDMz"\ - ""\ - ""\ - ""\ - "%s"\ - "%s"\ - ""\ - ""\ - "
"\ - ""\ - ""\ - ""\ - "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue"\ - ""\ - ""\ - "http://Passport.NET/tb"\ - ""\ - ""\ - ""\ - "%s" /* Other RSTn tokens */\ - ""\ - ""\ -"
" - -#define MSN_SSO_AUTHINFO_TEMPLATE \ -""\ - "{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}"\ - "4"\ - "1"\ - ""\ - "AQAAAAIAAABsYwQAAAA0MTA1"\ -"" -/* Not sure what's editable here, so I'll just hard-code the SHA1 hash */ -#define MSN_SSO_AUTHINFO_SHA1_BASE64 "d2IeTF4DAkPEa/tVETHznsivEpc=" - -#define MSN_SSO_TIMESTAMP_TEMPLATE \ -""\ - "%s"\ - "%s"\ -"" - -#define MSN_SSO_SIGNEDINFO_TEMPLATE \ -""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "" MSN_SSO_AUTHINFO_SHA1_BASE64 ""\ - ""\ -"" - -#define MSN_SSO_TOKEN_UPDATE_TEMPLATE ""\ -""\ - "
"\ - MSN_SSO_AUTHINFO_TEMPLATE /* ps:AuthInfo */ \ - ""\ - ""\ - ""\ - ""\ - "http://Passport.NET/STS"\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - "%s" /* wsu:Timestamp */\ - ""\ - "%s" /* SignedInfo */\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "
"\ - ""\ - "%s" /* wst:RequestSecurityToken */ \ - ""\ -"" - -typedef struct _MsnUsrKey MsnUsrKey; -struct _MsnUsrKey -{ - int size; /* 28. Does not count data */ - int crypt_mode; /* CRYPT_MODE_CBC (1) */ - int cipher_type; /* TripleDES (0x6603) */ - int hash_type; /* SHA1 (0x8004) */ - int iv_len; /* 8 */ - int hash_len; /* 20 */ - int cipher_len; /* 72 */ - /* Data */ - char iv[8]; - char hash[20]; - char cipher[72]; -}; - -typedef struct _MsnTicketToken MsnTicketToken; -struct _MsnTicketToken { - GHashTable *token; - char *secret; - time_t expiry; - GSList *updates; -}; - -typedef struct _MsnNexus MsnNexus; - -struct _MsnNexus -{ - MsnSession *session; - - /* From server via USR command */ - char *policy; - char *nonce; - - /* From server via SOAP stuff */ - char *cipher; - char *secret; - MsnTicketToken *tokens; - int token_len; -}; - -void msn_nexus_connect(MsnNexus *nexus); -MsnNexus *msn_nexus_new(MsnSession *session); -void msn_nexus_destroy(MsnNexus *nexus); -GHashTable *msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id); -const char *msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id); -void msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data); -#endif /* _MSN_NEXUS_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2182 +0,0 @@ -/** - * @file notification.c Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "notification.h" -#include "contact.h" -#include "state.h" -#include "error.h" -#include "msnutils.h" -#include "page.h" - -#include "userlist.h" -#include "sync.h" -#include "slplink.h" - -static MsnTable *cbs_table; - -/************************************************************************** - * Main - **************************************************************************/ - -static void -destroy_cb(MsnServConn *servconn) -{ - MsnNotification *notification; - - notification = servconn->cmdproc->data; - g_return_if_fail(notification != NULL); - - msn_notification_destroy(notification); -} - -MsnNotification * -msn_notification_new(MsnSession *session) -{ - MsnNotification *notification; - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - notification = g_new0(MsnNotification, 1); - - notification->session = session; - notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS); - msn_servconn_set_destroy_cb(servconn, destroy_cb); - - notification->cmdproc = servconn->cmdproc; - notification->cmdproc->data = notification; - notification->cmdproc->cbs_table = cbs_table; - - return notification; -} - -void -msn_notification_destroy(MsnNotification *notification) -{ - notification->cmdproc->data = NULL; - - msn_servconn_set_destroy_cb(notification->servconn, NULL); - - msn_servconn_destroy(notification->servconn); - - g_free(notification); -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(MsnServConn *servconn) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - GString *vers; - const char *ver_str; - int i; - - g_return_if_fail(servconn != NULL); - - cmdproc = servconn->cmdproc; - session = servconn->session; - account = session->account; - - vers = g_string_new(""); - - for (i = WLM_MAX_PROTOCOL; i >= WLM_MIN_PROTOCOL; i--) - g_string_append_printf(vers, " MSNP%d", i); - - g_string_append(vers, " CVR0"); - - if (session->login_step == MSN_LOGIN_STEP_START) - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); - else - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2); - - /* Skip the initial space */ - ver_str = (vers->str + 1); - msn_cmdproc_send(cmdproc, "VER", "%s", ver_str); - - g_string_free(vers, TRUE); -} - -gboolean -msn_notification_connect(MsnNotification *notification, const char *host, int port) -{ - MsnServConn *servconn; - - g_return_val_if_fail(notification != NULL, FALSE); - - servconn = notification->servconn; - - msn_servconn_set_connect_cb(servconn, connect_cb); - notification->in_use = msn_servconn_connect(servconn, host, port, TRUE); - - return notification->in_use; -} - -void -msn_notification_disconnect(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - g_return_if_fail(notification->in_use); - - msn_servconn_disconnect(notification->servconn); - - notification->in_use = FALSE; -} - -/************************************************************************** - * Login - **************************************************************************/ - -void -msn_got_login_params(MsnSession *session, const char *ticket, const char *response) -{ - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); - - msn_cmdproc_send(cmdproc, "USR", "SSO S %s %s", ticket, response); -} - -static void -cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - - account = cmdproc->session->account; - - msn_cmdproc_send(cmdproc, "USR", "SSO I %s", purple_account_get_username(account)); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - - session = cmdproc->session; - account = session->account; - - if (!g_ascii_strcasecmp(cmd->params[1], "OK")) - { - /* authenticate OK */ - msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); - } - else if (!g_ascii_strcasecmp(cmd->params[1], "SSO")) - { - /* RPS authentication */ - - session->nexus = msn_nexus_new(session); - - session->nexus->policy = g_strdup(cmd->params[3]); - session->nexus->nonce = g_strdup(cmd->params[4]); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); - - msn_nexus_connect(session->nexus); - } -} - -static void -usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnErrorType msnerr = 0; - - switch (error) - { - case 500: - case 601: - case 910: - case 921: - msnerr = MSN_ERROR_SERV_UNAVAILABLE; - break; - case 911: - msnerr = MSN_ERROR_AUTH; - break; - default: - return; - break; - } - - msn_session_set_error(cmdproc->session, msnerr, NULL); -} - -static void -ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - gboolean protocol_supported = FALSE; - char proto_str[8]; - size_t i; - - session = cmdproc->session; - account = session->account; - - g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); - - for (i = 1; i < cmd->param_count; i++) - { - if (!strcmp(cmd->params[i], proto_str)) - { - protocol_supported = TRUE; - break; - } - } - - if (!protocol_supported) - { - msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, - NULL); - return; - } - - /* - * Windows Live Messenger 8.5 - * Notice :CVR String discriminate! - * reference of http://www.microsoft.com/globaldev/reference/oslocversion.mspx - * to see the Local ID - */ - msn_cmdproc_send(cmdproc, "CVR", - "0x0409 winnt 5.1 i386 MSNMSGR 8.5.1302 BC01 %s", - purple_account_get_username(account)); -} - -/************************************************************************** - * Log out - **************************************************************************/ - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - if (cmd->param_count == 0) - msn_session_set_error(cmdproc->session, -1, NULL); - else if (!g_ascii_strcasecmp(cmd->params[0], "OTH")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER, - NULL); - else if (!g_ascii_strcasecmp(cmd->params[0], "SSD")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL); -} - -void -msn_notification_close(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - - if (!notification->in_use) - return; - - msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL); - - msn_notification_disconnect(notification); -} - -/************************************************************************** - * Messages - **************************************************************************/ - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len, MSG_LINE_DEM, MSG_BODY_DEM); - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, "Notification", TRUE); - - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_destroy(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing MSG... \n"); - - /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued - * command and we are processing it */ - if (cmd->payload == NULL) { - cmdproc->last_cmd->payload_cb = msg_cmd_post; - cmd->payload_len = atoi(cmd->params[2]); - } else { - g_return_if_fail(cmd->payload_cb != NULL); - -#if 0 /* glib on win32 doesn't correctly support precision modifiers for a string */ - purple_debug_info("msn", "MSG payload:{%.*s}\n", (guint)cmd->payload_len, cmd->payload); -#endif - cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); - } -} - -/*send Message to Yahoo Messenger*/ -void -uum_send_msg(MsnSession *session,MsnMessage *msg) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - gsize payload_len; - int type; - - cmdproc = session->notification->cmdproc; - g_return_if_fail(msg != NULL); - payload = msn_message_gen_payload(msg, &payload_len); - purple_debug_info("msn", - "send UUM, payload{%s}, strlen:%" G_GSIZE_FORMAT ", len:%" G_GSIZE_FORMAT "\n", - payload, strlen(payload), payload_len); - type = msg->type; - trans = msn_transaction_new(cmdproc, "UUM", "%s 32 %d %" G_GSIZE_FORMAT, - msg->remote_user, type, payload_len); - msn_transaction_set_payload(trans, payload, strlen(payload)); - msn_cmdproc_send_trans(cmdproc, trans); -} - -#if 0 -static void -ubm_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnMessage *msg; - PurpleConnection *gc; - const char *passport; - const char *content_type; - - purple_debug_info("msn", "Process UBM payload:%.*s\n", (guint)len, payload); - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len,MSG_LINE_DEM,MSG_BODY_DEM); - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, "Notification", TRUE); - - gc = cmdproc->session->account->gc; - passport = msg->remote_user; - - content_type = msn_message_get_content_type(msg); - purple_debug_info("msn", "type:%s\n", content_type); - if(!strcmp(content_type,"text/plain")){ - const char *value; - const char *body; - char *body_enc; - char *body_final = NULL; - size_t body_len; - - body = msn_message_get_bin_data(msg, &body_len); - body_enc = g_markup_escape_text(body, body_len); - - if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) { - char *pre, *post; - - msn_parse_format(value, &pre, &post); - body_final = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(pre); - g_free(post); - } - g_free(body_enc); - serv_got_im(gc, passport, body_final, 0, time(NULL)); - g_free(body_final); - } - if(!strcmp(content_type,"text/x-msmsgscontrol")){ - if(msn_message_get_attr(msg, "TypingUser") != NULL){ - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } - } - if(!strcmp(content_type,"text/x-msnmsgr-datacast")){ - char *username, *str; - PurpleAccount *account; - PurpleBuddy *buddy; - const char *user; - - account = cmdproc->session->account; - user = msg->remote_user; - - if ((buddy = purple_find_buddy(account, user)) != NULL){ - username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1); - }else{ - username = g_markup_escape_text(user, -1); - } - - str = g_strdup_printf(_("%s just sent you a Nudge!"), username); - g_free(username); - msn_session_report_user(cmdproc->session,user,str,PURPLE_MESSAGE_SYSTEM); - g_free(str); - } - msn_message_destroy(msg); -} -#endif - -/*Yahoo msg process*/ -static void -ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing UBM... \n"); - - /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued - * command and we are processing it */ - if (cmd->payload == NULL) { - cmdproc->last_cmd->payload_cb = msg_cmd_post; - cmd->payload_len = atoi(cmd->params[3]); - } else { - g_return_if_fail(cmd->payload_cb != NULL); - - purple_debug_info("msn", "UBM payload:{%.*s}\n", (guint)(cmd->payload_len), cmd->payload); - msg_cmd_post(cmdproc, cmd, cmd->payload, cmd->payload_len); - } -} - -/************************************************************************** - * Challenges - * we use MD5 to caculate the Challenges - **************************************************************************/ -static void -chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransaction *trans; - char buf[33]; - - msn_handle_chl(cmd->params[1], buf); - trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP15_WLM_PRODUCT_ID); - - msn_transaction_set_payload(trans, buf, 32); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -/************************************************************************** - * Buddy Lists - **************************************************************************/ - -typedef struct MsnFqyCbData { - MsnFqyCb cb; - gpointer data; -} MsnFqyCbData; - -/* add contact to xmlnode */ -static void -msn_add_contact_xml(MsnSession *session, xmlnode *mlNode,const char *passport, MsnListOp list_op, MsnNetwork networkId) -{ - xmlnode *d_node,*c_node; - char **tokens; - const char *email,*domain; - char fmt_str[3]; - - g_return_if_fail(passport != NULL); - - purple_debug_info("msn", "Passport: %s, type: %d\n", passport, networkId); - tokens = g_strsplit(passport, "@", 2); - email = tokens[0]; - domain = tokens[1]; - - if (email == NULL || domain == NULL) { - purple_debug_error("msn", "Invalid passport (%s) specified to add to contact xml.\n", passport); - g_strfreev(tokens); - g_return_if_reached(); - } - - /*find a domain Node*/ - for (d_node = xmlnode_get_child(mlNode, "d"); d_node; - d_node = xmlnode_get_next_twin(d_node)) { - const char *attr = xmlnode_get_attrib(d_node,"n"); - if (attr == NULL) - continue; - if (!strcmp(attr, domain)) - break; - } - - if (d_node == NULL) { - /*domain not found, create a new domain Node*/ - purple_debug_info("msn", "Didn't find existing domain node, adding one.\n"); - d_node = xmlnode_new("d"); - xmlnode_set_attrib(d_node, "n", domain); - xmlnode_insert_child(mlNode, d_node); - } - - /*create contact node*/ - c_node = xmlnode_new("c"); - xmlnode_set_attrib(c_node, "n", email); - - if (list_op != 0) { - purple_debug_info("msn", "list_op: %d\n", list_op); - g_snprintf(fmt_str, sizeof(fmt_str), "%d", list_op); - xmlnode_set_attrib(c_node, "l", fmt_str); - } - - if (networkId != MSN_NETWORK_UNKNOWN) { - g_snprintf(fmt_str, sizeof(fmt_str), "%d", networkId); - /*mobile*/ - /*type_str = g_strdup_printf("4");*/ - xmlnode_set_attrib(c_node, "t", fmt_str); - } - - xmlnode_insert_child(d_node, c_node); - - g_strfreev(tokens); -} - -static void -msn_notification_post_adl(MsnCmdProc *cmdproc, const char *payload, int payload_len) -{ - MsnTransaction *trans; - purple_debug_info("msn", "Sending ADL with payload: %s\n", payload); - trans = msn_transaction_new(cmdproc, "ADL", "%i", payload_len); - msn_transaction_set_payload(trans, payload, payload_len); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -msn_notification_post_rml(MsnCmdProc *cmdproc, const char *payload, int payload_len) -{ - MsnTransaction *trans; - purple_debug_info("msn", "Sending RML with payload: %s\n", payload); - trans = msn_transaction_new(cmdproc, "RML", "%i", payload_len); - msn_transaction_set_payload(trans, payload, payload_len); - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_notification_send_fqy(MsnSession *session, - const char *payload, int payload_len, - MsnFqyCb cb, - gpointer cb_data) -{ - MsnTransaction *trans; - MsnCmdProc *cmdproc; - MsnFqyCbData *data; - - cmdproc = session->notification->cmdproc; - - data = g_new(MsnFqyCbData, 1); - data->cb = cb; - data->data = cb_data; - - trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len); - msn_transaction_set_payload(trans, payload, payload_len); - msn_transaction_set_data(trans, data); - msn_transaction_set_data_free(trans, g_free); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -update_contact_network(MsnSession *session, const char *passport, MsnNetwork network, gpointer unused) -{ - MsnUser *user; - - if (network == MSN_NETWORK_UNKNOWN) - { - purple_debug_warning("msn", - "Ignoring user %s about which server knows nothing.\n", - passport); - /* Decrement the count for unknown results so that we'll continue login. - Also, need to finish the login process here as well, because ADL OK - will not be called. */ - if (purple_debug_is_verbose()) - purple_debug_info("msn", "ADL/FQY count is %d\n", session->adl_fqy); - if (--session->adl_fqy == 0) - msn_session_finish_login(session); - return; - } - - /* TODO: Also figure out how to update membership lists */ - user = msn_userlist_find_user(session->userlist, passport); - if (user) { - xmlnode *adl_node; - char *payload; - int payload_len; - - msn_user_set_network(user, network); - - adl_node = xmlnode_new("ml"); - xmlnode_set_attrib(adl_node, "l", "1"); - msn_add_contact_xml(session, adl_node, passport, - user->list_op & MSN_LIST_OP_MASK, network); - payload = xmlnode_to_str(adl_node, &payload_len); - msn_notification_post_adl(session->notification->cmdproc, payload, payload_len); - g_free(payload); - } else { - purple_debug_error("msn", - "Got FQY update for unknown user %s on network %d.\n", - passport, network); - } -} - -/*dump contact info to NS*/ -void -msn_notification_dump_contact(MsnSession *session) -{ - MsnUser *user; - GList *l; - xmlnode *adl_node; - xmlnode *fqy_node; - char *payload; - int payload_len; - int adl_count = 0; - int fqy_count = 0; - const char *display_name; - - adl_node = xmlnode_new("ml"); - adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); - fqy_node = xmlnode_new("ml"); - - /*get the userlist*/ - for (l = session->userlist->users; l != NULL; l = l->next) { - user = l->data; - - /* skip RL & PL during initial dump */ - if (!(user->list_op & MSN_LIST_OP_MASK)) - continue; - - if (user->passport && !strcmp(user->passport, "messenger@microsoft.com")) - continue; - - if ((user->list_op & MSN_LIST_OP_MASK & ~MSN_LIST_FL_OP) - == (MSN_LIST_AL_OP | MSN_LIST_BL_OP)) { - /* The server will complain if we send it a user on both the - Allow and Block lists. So assume they're on the Block list - and remove them from the Allow list in the membership lists to - stop this from happening again. */ - purple_debug_warning("msn", - "User %s is on both Allow and Block list; " - "removing from Allow list.\n", - user->passport); - msn_user_unset_op(user, MSN_LIST_AL_OP); - } - - if (user->networkid != MSN_NETWORK_UNKNOWN) { - msn_add_contact_xml(session, adl_node, user->passport, - user->list_op & MSN_LIST_OP_MASK, user->networkid); - - /* each ADL command may contain up to 150 contacts */ - if (++adl_count % 150 == 0) { - payload = xmlnode_to_str(adl_node, &payload_len); - - /* ADL's are returned all-together */ - session->adl_fqy++; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Posting ADL, count is %d\n", - session->adl_fqy); - - msn_notification_post_adl(session->notification->cmdproc, - payload, payload_len); - - g_free(payload); - xmlnode_free(adl_node); - - adl_node = xmlnode_new("ml"); - adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); - } - } else { - /* FQY's are returned one-at-a-time */ - session->adl_fqy++; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Adding FQY address, count is %d\n", - session->adl_fqy); - - msn_add_contact_xml(session, fqy_node, user->passport, - 0, user->networkid); - - /* each FQY command may contain up to 150 contacts, probably */ - if (++fqy_count % 150 == 0) { - payload = xmlnode_to_str(fqy_node, &payload_len); - - msn_notification_send_fqy(session, payload, payload_len, - update_contact_network, NULL); - - g_free(payload); - xmlnode_free(fqy_node); - fqy_node = xmlnode_new("ml"); - } - } - } - - /* Send the rest, or just an empty one to let the server set us online */ - if (adl_count == 0 || adl_count % 150 != 0) { - payload = xmlnode_to_str(adl_node, &payload_len); - - /* ADL's are returned all-together */ - session->adl_fqy++; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Posting ADL, count is %d\n", - session->adl_fqy); - - msn_notification_post_adl(session->notification->cmdproc, payload, payload_len); - - g_free(payload); - } - - if (fqy_count % 150 != 0) { - payload = xmlnode_to_str(fqy_node, &payload_len); - - msn_notification_send_fqy(session, payload, payload_len, - update_contact_network, NULL); - - g_free(payload); - } - - xmlnode_free(adl_node); - xmlnode_free(fqy_node); - - display_name = purple_connection_get_display_name(session->account->gc); - if (display_name - && strcmp(display_name, - purple_account_get_username(session->account))) { - msn_act_id(session->account->gc, display_name); - } - -} - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -} - -static void -adl_cmd_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - xmlnode *root, *domain_node; - - purple_debug_misc("msn", "Parsing received ADL XML data\n"); - - g_return_if_fail(payload != NULL); - - root = xmlnode_from_str(payload, (gssize) len); - - if (root == NULL) { - purple_debug_info("msn", "Invalid XML in ADL!\n"); - return; - } - for (domain_node = xmlnode_get_child(root, "d"); - domain_node; - domain_node = xmlnode_get_next_twin(domain_node)) { - const gchar * domain = NULL; - xmlnode *contact_node = NULL; - - domain = xmlnode_get_attrib(domain_node, "n"); - - for (contact_node = xmlnode_get_child(domain_node, "c"); - contact_node; - contact_node = xmlnode_get_next_twin(contact_node)) { - const gchar *list; - gint list_op = 0; - - list = xmlnode_get_attrib(contact_node, "l"); - if (list != NULL) { - list_op = atoi(list); - } - - if (list_op & MSN_LIST_RL_OP) { - /* someone is adding us */ - msn_get_contact_list(cmdproc->session, MSN_PS_PENDING_LIST, NULL); - } - } - } - - xmlnode_free(root); -} - -static void -adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(cmdproc->session != NULL); - g_return_if_fail(cmdproc->last_cmd != NULL); - g_return_if_fail(cmd != NULL); - - session = cmdproc->session; - - if (!strcmp(cmd->params[1], "OK")) { - /* ADL ack */ - if (purple_debug_is_verbose()) - purple_debug_info("msn", "ADL ACK, count is %d\n", - session->adl_fqy); - if (--session->adl_fqy == 0) - msn_session_finish_login(session); - } else { - cmdproc->last_cmd->payload_cb = adl_cmd_parse; - cmd->payload_len = atoi(cmd->params[1]); - } - - return; -} - -static void -adl_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - int error = GPOINTER_TO_INT(cmd->payload_cbdata); - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - if (error == 241) { - /* khc: some googling suggests that error 241 means the buddy is somehow - in the local list, but not the server list, and that we should add - those buddies to the addressbook. For now I will just notify the user - about the raw payload, because I am lazy */ - xmlnode *adl = xmlnode_from_str(payload, len); - GString *emails = g_string_new(NULL); - - xmlnode *domain = xmlnode_get_child(adl, "d"); - while (domain) { - const char *domain_str = xmlnode_get_attrib(domain, "n"); - xmlnode *contact = xmlnode_get_child(domain, "c"); - while (contact) { - g_string_append_printf(emails, "%s@%s\n", - xmlnode_get_attrib(contact, "n"), domain_str); - contact = xmlnode_get_next_twin(contact); - } - domain = xmlnode_get_next_twin(domain); - } - - purple_notify_error(gc, NULL, - _("The following users are missing from your addressbook"), - emails->str); - g_string_free(emails, TRUE); - xmlnode_free(adl); - } - else - { - char *adl = g_strndup(payload, len); - char *reason = g_strdup_printf(_("Unknown error (%d): %s"), - error, adl); - g_free(adl); - - purple_notify_error(gc, NULL, _("Unable to add user"), reason); - g_free(reason); - } -} - -static void -adl_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnCommand *cmd = cmdproc->last_cmd; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - purple_debug_error("msn", "ADL error\n"); - if (cmd->param_count > 1) { - cmd->payload_cb = adl_error_parse; - cmd->payload_len = atoi(cmd->params[1]); - cmd->payload_cbdata = GINT_TO_POINTER(error); - } else { - char *reason = g_strdup_printf(_("Unknown error (%d)"), error); - purple_notify_error(gc, NULL, _("Unable to add user"), reason); - g_free(reason); - } -} - -static void -rml_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - char *adl, *reason; - int error = GPOINTER_TO_INT(cmd->payload_cbdata); - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - adl = g_strndup(payload, len); - reason = g_strdup_printf(_("Unknown error (%d): %s"), - error, adl); - g_free(adl); - - purple_notify_error(gc, NULL, _("Unable to remove user"), reason); - g_free(reason); -} - -static void -rml_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnCommand *cmd = cmdproc->last_cmd; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - purple_debug_error("msn", "RML error\n"); - if (cmd->param_count > 1) { - cmd->payload_cb = rml_error_parse; - cmd->payload_len = atoi(cmd->params[1]); - cmd->payload_cbdata = GINT_TO_POINTER(error); - } else { - char *reason = g_strdup_printf(_("Unknown error (%d)"), error); - purple_notify_error(gc, NULL, _("Unable to remove user"), reason); - g_free(reason); - } -} - -static void -fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnSession *session; - xmlnode *ml, *d, *c; - const char *domain; - const char *local; - const char *type; - char *passport; - MsnNetwork network = MSN_NETWORK_PASSPORT; - - session = cmdproc->session; - - /* FQY response: - */ - ml = xmlnode_from_str(payload, len); - for (d = xmlnode_get_child(ml, "d"); - d != NULL; - d = xmlnode_get_next_twin(d)) { - domain = xmlnode_get_attrib(d, "n"); - for (c = xmlnode_get_child(d, "c"); - c != NULL; - c = xmlnode_get_next_twin(c)) { - local = xmlnode_get_attrib(c, "n"); - type = xmlnode_get_attrib(c, "t"); - - passport = g_strdup_printf("%s@%s", local, domain); - - if (g_ascii_isdigit(cmd->command[0])) - network = MSN_NETWORK_UNKNOWN; - else if (type != NULL) - network = (MsnNetwork)strtoul(type, NULL, 10); - - purple_debug_info("msn", "FQY response says %s is from network %d\n", - passport, network); - if (cmd->trans->data) { - MsnFqyCbData *fqy_data = cmd->trans->data; - fqy_data->cb(session, passport, network, fqy_data->data); - /* Don't free fqy_data yet since the server responds to FQY multiple times. - It will be freed when cmd->trans is freed. */ - } - - g_free(passport); - } - } - - xmlnode_free(ml); -} - -static void -fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnCommand *cmd = cmdproc->last_cmd; - - purple_debug_warning("msn", "FQY error %d\n", error); - if (cmd->param_count > 1) { - cmd->payload_cb = fqy_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); - cmd->payload_cbdata = GINT_TO_POINTER(error); - } -#if 0 - /* If the server didn't send us a corresponding email address for this - FQY error, it's probably going to disconnect us. So it isn't necessary - to tell the handler about it. */ - else if (trans->data) - ((MsnFqyCb)trans->data)(session, NULL, MSN_NETWORK_UNKNOWN, NULL); -#endif -} - -static void -fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Process FQY\n"); - cmdproc->last_cmd->payload_cb = fqy_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); -} - -static void -rml_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - if (payload != NULL) - purple_debug_info("msn", "Received RML:\n%s\n", payload); -} - -static void -rml_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Process RML\n"); - cmd->payload_len = atoi(cmd->params[1]); - cmdproc->last_cmd->payload_cb = rml_cmd_post; -} - -static void -qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - /* TODO: Call PNG after the timeout specified. */ -} - - -static void -fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSlpLink *slplink; - MsnUser *user; - - /* Tell libpurple that the user has signed off */ - user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]); - msn_user_set_state(user, NULL); - msn_user_update(user); - - /* If we have an open MsnSlpLink with the user then close it */ - slplink = msn_session_find_slplink(cmdproc->session, cmd->params[0]); - if (slplink != NULL) - msn_slplink_destroy(slplink); - -} - -static void -iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj = NULL; - unsigned long clientid; - int networkid = 0; - const char *state, *passport; - char *friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[1]; - passport = cmd->params[2]; - - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) - /* Where'd this come from? */ - return; - - if (cmd->param_count == 8) { - /* Yahoo! Buddy, looks like */ - networkid = atoi(cmd->params[3]); - friendly = g_strdup(purple_url_decode(cmd->params[4])); - clientid = strtoul(cmd->params[5], NULL, 10); - - /* cmd->params[7] seems to be a URL to a Yahoo! icon: - https://sec.yimg.com/i/us/nt/b/purpley.1.0.png - ... and it's purple, HAH! - */ - } else if (cmd->param_count == 7) { - /* MSNP14+ with Display Picture object */ - networkid = atoi(cmd->params[3]); - friendly = g_strdup(purple_url_decode(cmd->params[4])); - clientid = strtoul(cmd->params[5], NULL, 10); - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[6])); - } else if (cmd->param_count == 6) { - /* Yes, this is 5. The friendly name could start with a number, - but the display picture object can't... */ - if (isdigit(cmd->params[5][0])) { - /* MSNP14 without Display Picture object */ - networkid = atoi(cmd->params[3]); - friendly = g_strdup(purple_url_decode(cmd->params[4])); - clientid = strtoul(cmd->params[5], NULL, 10); - } else { - /* MSNP8+ with Display Picture object */ - friendly = g_strdup(purple_url_decode(cmd->params[3])); - clientid = strtoul(cmd->params[4], NULL, 10); - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); - } - } else if (cmd->param_count == 5) { - /* MSNP8+ without Display Picture object */ - friendly = g_strdup(purple_url_decode(cmd->params[3])); - clientid = strtoul(cmd->params[4], NULL, 10); - } else { - purple_debug_warning("msn", "Received ILN with unknown number of parameters.\n"); - return; - } - - if (msn_user_set_friendly_name(user, friendly)) { - msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly); - } - g_free(friendly); - - msn_user_set_object(user, msnobj); - - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone.mobile && user->phone.mobile[0] == '+'); - msn_user_set_clientid(user, clientid); - msn_user_set_network(user, networkid); - - msn_user_set_state(user, state); - msn_user_update(user); -} - -static void -ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - PurpleConnection *gc; - MsnUserList *userlist; - const char *who = NULL; - char *text = NULL; - const char *id = NULL; - xmlnode *payloadNode, *from, *msg, *textNode; - - purple_debug_misc("msn", "Incoming Page: {%s}\n", payload); - - userlist = cmdproc->session->userlist; - gc = purple_account_get_connection(cmdproc->session->account); - - /* payload looks like this: - - - - - - - - - - - - Message was here - - - - */ - - /* This is the payload if your message was too long: - - - - - - - - - - - - - - - */ - - payloadNode = xmlnode_from_str(payload, len); - if (!payloadNode) - return; - - if (!(from = xmlnode_get_child(payloadNode, "FROM")) || - !(msg = xmlnode_get_child(payloadNode, "MSG")) || - !(textNode = xmlnode_get_child(msg, "BODY/TEXT"))) { - xmlnode_free(payloadNode); - return; - } - - who = xmlnode_get_attrib(from, "name"); - if (!who) return; - - text = xmlnode_get_data(textNode); - - /* Match number to user's mobile number, FROM is a phone number if the - other side page you using your phone number */ - if (!strncmp(who, "tel:+", 5)) { - MsnUser *user = - msn_userlist_find_user_with_mobile_phone(userlist, who + 4); - - if (user && user->passport) - who = user->passport; - } - - id = xmlnode_get_attrib(msg, "id"); - - if (id && !strcmp(id, "407")) { - PurpleConversation *conv - = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - who, gc->account); - if (conv != NULL) { - purple_conversation_write(conv, NULL, - _("Mobile message was not sent because it was too long."), - PURPLE_MESSAGE_ERROR, time(NULL)); - - if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) { - unsigned int trId = atol(id); - MsnTransaction *trans; - MsnMessage *msg; - - trans = msn_history_find(cmdproc->history, trId); - msg = (MsnMessage *)trans->data; - - if (msg) { - char *body_str = msn_message_to_string(msg); - char *body_enc = g_markup_escape_text(body_str, -1); - - purple_conversation_write(conv, NULL, body_enc, - PURPLE_MESSAGE_RAW, time(NULL)); - - g_free(body_str); - g_free(body_enc); - msn_message_destroy(msg); - trans->data = NULL; - } - } - } - } else { - serv_got_im(gc, who, text, 0, time(NULL)); - } - - g_free(text); - xmlnode_free(payloadNode); -} - -static void -ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmd->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = ipg_cmd_post; -} - -static void -nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj; - unsigned long clientid; - int networkid; - const char *state, *passport, *friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[0]; - passport = cmd->params[1]; - networkid = atoi(cmd->params[2]); - friendly = purple_url_decode(cmd->params[3]); - - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) return; - - if (msn_user_set_friendly_name(user, friendly)) - { - msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly); - } - - if (cmd->param_count == 6) - { - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); - msn_user_set_object(user, msnobj); - } - else - { - msn_user_set_object(user, NULL); - } - - clientid = strtoul(cmd->params[4], NULL, 10); - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->phone.mobile && user->phone.mobile[0] == '+'); - - msn_user_set_clientid(user, clientid); - msn_user_set_network(user, networkid); - - msn_user_set_state(user, state); - msn_user_update(user); -} - -#if 0 -static void -chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *state = cmd->params[1]; - int state_id = 0; - - if (!strcmp(state, "NLN")) - state_id = MSN_ONLINE; - else if (!strcmp(state, "BSY")) - state_id = MSN_BUSY; - else if (!strcmp(state, "IDL")) - state_id = MSN_IDLE; - else if (!strcmp(state, "BRB")) - state_id = MSN_BRB; - else if (!strcmp(state, "AWY")) - state_id = MSN_AWAY; - else if (!strcmp(state, "PHN")) - state_id = MSN_PHONE; - else if (!strcmp(state, "LUN")) - state_id = MSN_LUNCH; - else if (!strcmp(state, "HDN")) - state_id = MSN_HIDDEN; - - cmdproc->session->state = state_id; -} -#endif - - -static void -not_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ -#if 0 - MSN_SET_PARAMS("NOT %d\r\n%s", cmdproc->servconn->payload, payload); - purple_debug_misc("msn", "Notification: {%s}\n", payload); -#endif -} - -static void -not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmd->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = not_cmd_post; -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value, *friendlyname; - - g_return_if_fail(cmd->param_count >= 3); - - type = cmd->params[2]; - - if (cmd->param_count == 4) - { - value = cmd->params[3]; - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - else { - type = cmd->params[1]; - if (!strcmp(type, "MFN")) { - friendlyname = purple_url_decode(cmd->params[2]); - - msn_update_contact(session, "Me", MSN_UPDATE_DISPLAY, friendlyname); - - purple_connection_set_display_name( - purple_account_get_connection(session->account), - friendlyname); - purple_account_set_string(session->account, "display-name", friendlyname); - } - } - } -} - -/************************************************************************** - * Misc commands - **************************************************************************/ - -static void -url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleConnection *gc; - PurpleAccount *account; - const char *rru; - const char *url; - PurpleCipherContext *cipher; - gchar creds[33]; - char *buf; - - gulong tmp_timestamp; - - session = cmdproc->session; - account = session->account; - gc = account->gc; - - rru = cmd->params[1]; - url = cmd->params[2]; - - session->passport_info.mail_timestamp = time(NULL); - tmp_timestamp = session->passport_info.mail_timestamp - session->passport_info.sl; - - buf = g_strdup_printf("%s%lu%s", - session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS", - tmp_timestamp, - purple_connection_get_password(gc)); - - cipher = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(cipher, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest_to_str(cipher, sizeof(creds), creds, NULL); - purple_cipher_context_destroy(cipher); - g_free(buf); - - g_free(session->passport_info.mail_url); - session->passport_info.mail_url = - g_strdup_printf("%s&auth=%s&creds=%s&sl=%ld&username=%s&mode=ttl&sid=%s&id=2&rru=%s&svc=mail&js=yes", - url, - session->passport_info.mspauth ? purple_url_encode(session->passport_info.mspauth) : "BOGUS", - creds, - tmp_timestamp, - msn_user_get_passport(session->user), - session->passport_info.sid, - rru); - - /* The user wants to check his or her email */ - if (cmd->trans && cmd->trans->data) - purple_notify_uri(purple_account_get_connection(account), session->passport_info.mail_url); -} -/************************************************************************** - * Switchboards - **************************************************************************/ - -static void -rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - const char *session_id; - char *host; - int port; - - session = cmdproc->session; - session_id = cmd->params[0]; - - msn_parse_socket(cmd->params[1], &host, &port); - - if (session->http_method) - port = 80; - - swboard = msn_switchboard_new(session); - - msn_switchboard_set_invited(swboard, TRUE); - msn_switchboard_set_session_id(swboard, cmd->params[0]); - msn_switchboard_set_auth_key(swboard, cmd->params[3]); - swboard->im_user = g_strdup(cmd->params[4]); - /* msn_switchboard_add_user(swboard, cmd->params[4]); */ - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *host; - int port; - - if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS")) - { - /* Maybe we can have a generic bad command error. */ - purple_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]); - return; - } - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!strcmp(cmd->params[1], "SB")) - { - purple_debug_error("msn", "This shouldn't be handled here.\n"); - } - else if (!strcmp(cmd->params[1], "NS")) - { - MsnSession *session; - - session = cmdproc->session; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); - - msn_notification_connect(session->notification, host, port); - } - - g_free(host); -} - -static void -gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ -/* QuLogic: Disabled until confirmed correct. */ -#if 0 - xmlnode *root; - xmlnode *policy; - - g_return_if_fail(cmd->payload != NULL); - - if ( (root = xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL) - { - purple_debug_error("msn", "Unable to parse GCF payload into a XML tree\n"); - return; - } - - - g_free(cmdproc->session->blocked_text); - cmdproc->session->blocked_text = NULL; - - /* We need a get_child with attrib... */ - policy = xmlnode_get_child(root, "Policy"); - while (policy) { - if (g_str_equal(xmlnode_get_attrib(policy, "type"), "SHIELDS")) - break; - policy = xmlnode_get_next_twin(policy); - } - - if (policy) { - GString *blocked = g_string_new(NULL); - xmlnode *imtext = xmlnode_get_child(policy, - "config/block/regexp/imtext"); - while (imtext) { - const char *value = xmlnode_get_attrib(imtext, "value"); - g_string_append_printf(blocked, "%s
\n", - purple_base64_decode(value, NULL)); - imtext = xmlnode_get_next_twin(imtext); - } - - cmdproc->session->blocked_text = g_string_free(blocked, FALSE); - } - - xmlnode_free(root); -#endif -} - -static void -gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing GCF command\n"); - - cmdproc->last_cmd->payload_cb = gcf_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); -} - -static void -sbs_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing SBS... \n"); - /*get the payload content*/ -} - -/* - * Get the UBX's PSM info - * Post it to the User status - * Thanks for Chris 's code - */ -static void -ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnSession *session; - PurpleAccount *account; - MsnUser *user; - const char *passport; - char *psm_str, *str; - CurrentMedia media = {CURRENT_MEDIA_UNKNOWN, NULL, NULL, NULL}; - - session = cmdproc->session; - account = session->account; - - passport = cmd->params[0]; - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) { - char *str = g_strndup(payload, len); - purple_debug_info("msn", "unknown user %s, payload is %s\n", - passport, str); - g_free(str); - return; - } - - if (len != 0) { - psm_str = msn_get_psm(cmd->payload,len); - msn_user_set_statusline(user, psm_str); - g_free(psm_str); - - str = msn_get_currentmedia(cmd->payload, len); - if (msn_parse_currentmedia(str, &media)) - msn_user_set_currentmedia(user, &media); - else - msn_user_set_currentmedia(user, NULL); - g_free(media.title); - g_free(media.album); - g_free(media.artist); - g_free(str); - - } else { - msn_user_set_statusline(user, NULL); - msn_user_set_currentmedia(user, NULL); - } - - msn_user_update(user); -} - -static void -ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_misc("msn", "UBX received.\n"); - cmdproc->last_cmd->payload_cb = ubx_cmd_post; - cmd->payload_len = atoi(cmd->params[2]); -} - -static void -uux_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - /* Do Nothing, right now. */ - if (payload != NULL) - purple_debug_info("msn", "UUX payload:\n%s\n", payload); -} - -static void -uux_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_misc("msn", "UUX received.\n"); - cmdproc->last_cmd->payload_cb = uux_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); -} - -/************************************************************************** - * Message Types - **************************************************************************/ - -static void -profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - const char *value; - const char *clLastChange; - - session = cmdproc->session; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if ((value = msn_message_get_attr(msg, "kv")) != NULL) - { - g_free(session->passport_info.kv); - session->passport_info.kv = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "sid")) != NULL) - { - g_free(session->passport_info.sid); - session->passport_info.sid = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) - { - g_free(session->passport_info.mspauth); - session->passport_info.mspauth = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) - { - g_free(session->passport_info.client_ip); - session->passport_info.client_ip = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) - { - session->passport_info.client_port = ntohs(atoi(value)); - } - - if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) - session->passport_info.sl = atol(value); - - if ((value = msn_message_get_attr(msg, "EmailEnabled")) != NULL) - session->passport_info.email_enabled = (gboolean)atol(value); - - /*starting retrieve the contact list*/ - clLastChange = purple_account_get_string(session->account, "CLLastChange", NULL); -#ifdef MSN_PARTIAL_LISTS - /* msn_userlist_load defeats all attempts at trying to detect blist sync issues */ - msn_userlist_load(session); - msn_get_contact_list(session, MSN_PS_INITIAL, clLastChange); -#else - /* always get the full list? */ - msn_get_contact_list(session, MSN_PS_INITIAL, NULL); -#endif -#if 0 - msn_contact_connect(session); -#endif -} - -static void -initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - const char *unread; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.mail_url == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - unread = g_hash_table_lookup(table, "Inbox-Unread"); - - if (unread != NULL) - { - int count = atoi(unread); - - if (count > 0) - { - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.mail_url }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, - passports, urls, NULL, NULL); - } - } - - g_hash_table_destroy(table); -} - -/*offline Message notification process*/ -static void -initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - const char *mdata, *unread; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - table = msn_message_get_hashtable_from_body(msg); - - mdata = g_hash_table_lookup(table, "Mail-Data"); - - if (mdata != NULL) - msn_parse_oim_msg(session->oim, mdata); - - if (g_hash_table_lookup(table, "Inbox-URL") == NULL) - { - g_hash_table_destroy(table); - return; - } - - if (session->passport_info.mail_url == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - g_hash_table_destroy(table); - return; - } - - if (!purple_account_get_check_mail(session->account)) - { - g_hash_table_destroy(table); - return; - } - - unread = g_hash_table_lookup(table, "Inbox-Unread"); - - if (unread != NULL) - { - int count = atoi(unread); - - if (count > 0) - { - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.mail_url }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, - passports, urls, NULL, NULL); - } - } - - g_hash_table_destroy(table); -} - -/*offline Message Notification*/ -static void -delete_oim_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - purple_debug_misc("msn", "Delete OIM message.\n"); -} - -static void -email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - char *from, *subject, *tmp; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.mail_url == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - from = subject = NULL; - - tmp = g_hash_table_lookup(table, "From"); - if (tmp != NULL) - from = purple_mime_decode_field(tmp); - - tmp = g_hash_table_lookup(table, "Subject"); - if (tmp != NULL) - subject = purple_mime_decode_field(tmp); - - purple_notify_email(gc, - (subject != NULL ? subject : ""), - (from != NULL ? from : ""), - msn_user_get_passport(session->user), - session->passport_info.mail_url, NULL, NULL); - - g_free(from); - g_free(subject); - - g_hash_table_destroy(table); -} - -static void -system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *table; - const char *type_s; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - table = msn_message_get_hashtable_from_body(msg); - - if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) - { - int type = atoi(type_s); - char buf[MSN_BUF_LEN]; - int minutes; - - switch (type) - { - case 1: - minutes = atoi(g_hash_table_lookup(table, "Arg1")); - g_snprintf(buf, sizeof(buf), dngettext(PACKAGE, - "The MSN server will shut down for maintenance " - "in %d minute. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", - "The MSN server will shut down for maintenance " - "in %d minutes. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", minutes), - minutes); - default: - break; - } - - if (*buf != '\0') - purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); - } - - g_hash_table_destroy(table); -} - -/************************************************************************** - * Dispatch server list management - **************************************************************************/ -typedef struct MsnAddRemoveListData { - MsnCmdProc *cmdproc; - MsnUser *user; - MsnListOp list_op; - gboolean add; -} MsnAddRemoveListData; - -static void -modify_unknown_buddy_on_list(MsnSession *session, const char *passport, - MsnNetwork network, gpointer data) -{ - MsnAddRemoveListData *addrem = data; - MsnCmdProc *cmdproc; - xmlnode *node; - char *payload; - int payload_len; - - cmdproc = addrem->cmdproc; - - /* Update user first */ - msn_user_set_network(addrem->user, network); - - node = xmlnode_new("ml"); - node->child = NULL; - - msn_add_contact_xml(session, node, passport, - addrem->list_op, network); - - payload = xmlnode_to_str(node, &payload_len); - xmlnode_free(node); - - if (addrem->add) - msn_notification_post_adl(cmdproc, payload, payload_len); - else - msn_notification_post_rml(cmdproc, payload, payload_len); - - g_free(payload); - g_free(addrem); -} - -void -msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id, - MsnUser *user) -{ - MsnAddRemoveListData *addrem; - MsnCmdProc *cmdproc; - MsnListOp list_op = 1 << list_id; - xmlnode *adl_node; - char *payload; - int payload_len; - - cmdproc = notification->servconn->cmdproc; - - adl_node = xmlnode_new("ml"); - adl_node->child = NULL; - - msn_add_contact_xml(notification->session, adl_node, user->passport, - list_op, user->networkid); - - payload = xmlnode_to_str(adl_node, &payload_len); - xmlnode_free(adl_node); - - if (user->networkid != MSN_NETWORK_UNKNOWN) { - msn_notification_post_adl(cmdproc, payload, payload_len); - - } else { - addrem = g_new(MsnAddRemoveListData, 1); - addrem->cmdproc = cmdproc; - addrem->user = user; - addrem->list_op = list_op; - addrem->add = TRUE; - - msn_notification_send_fqy(notification->session, payload, payload_len, - modify_unknown_buddy_on_list, addrem); - } - - g_free(payload); -} - -void -msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id, - MsnUser *user) -{ - MsnAddRemoveListData *addrem; - MsnCmdProc *cmdproc; - MsnListOp list_op = 1 << list_id; - xmlnode *rml_node; - char *payload; - int payload_len; - - cmdproc = notification->servconn->cmdproc; - - rml_node = xmlnode_new("ml"); - rml_node->child = NULL; - - msn_add_contact_xml(notification->session, rml_node, user->passport, - list_op, user->networkid); - - payload = xmlnode_to_str(rml_node, &payload_len); - xmlnode_free(rml_node); - - if (user->networkid != MSN_NETWORK_UNKNOWN) { - msn_notification_post_rml(cmdproc, payload, payload_len); - - } else { - addrem = g_new(MsnAddRemoveListData, 1); - addrem->cmdproc = cmdproc; - addrem->user = user; - addrem->list_op = list_op; - addrem->add = FALSE; - - msn_notification_send_fqy(notification->session, payload, payload_len, - modify_unknown_buddy_on_list, addrem); - } - - g_free(payload); -} - -/************************************************************************** - * Init - **************************************************************************/ -void -msn_notification_init(void) -{ - cbs_table = msn_table_new(); - - /* Synchronous */ - msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL); - msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "ADL", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); - msn_table_add_cmd(cbs_table, "USR", "GCF", gcf_cmd); - msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); - msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); - msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); - - /* Asynchronous */ - msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "UBM", ubm_cmd); - msn_table_add_cmd(cbs_table, NULL, "GCF", gcf_cmd); - msn_table_add_cmd(cbs_table, NULL, "SBS", sbs_cmd); - msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); - - msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); - msn_table_add_cmd(cbs_table, NULL, "RML", rml_cmd); - msn_table_add_cmd(cbs_table, NULL, "ADL", adl_cmd); - msn_table_add_cmd(cbs_table, NULL, "FQY", fqy_cmd); - - msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); - msn_table_add_cmd(cbs_table, NULL, "QNG", qng_cmd); - msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd); - msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd); - msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); - - msn_table_add_cmd(cbs_table, NULL, "UBX", ubx_cmd); - msn_table_add_cmd(cbs_table, NULL, "UUX", uux_cmd); - - msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); - - msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); - - msn_table_add_error(cbs_table, "ADL", adl_error); - msn_table_add_error(cbs_table, "RML", rml_error); - msn_table_add_error(cbs_table, "FQY", fqy_error); - msn_table_add_error(cbs_table, "USR", usr_error); - - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsprofile", - profile_msg); - /*initial OIM notification*/ - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsinitialmdatanotification", - initial_mdata_msg); - /*OIM notification when user online*/ - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsoimnotification", - initial_mdata_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsinitialemailnotification", - initial_email_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsemailnotification", - email_msg); - /*delete an offline Message notification*/ - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsactivemailnotification", - delete_oim_msg); - msn_table_add_msg_type(cbs_table, - "application/x-msmsgssystemmessage", - system_msg); - /* generic message handlers */ - msn_table_add_msg_type(cbs_table, "text/plain", - msn_plain_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol", - msn_control_msg); - msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", - msn_datacast_msg); -} - -void -msn_notification_end(void) -{ - msn_table_destroy(cbs_table); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/notification.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/** - * @file notification.h Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_NOTIFICATION_H_ -#define _MSN_NOTIFICATION_H_ - -/*MSN protocol challenge info*/ - -/*MSNP15 challenge: WLM 8.5.1288.816*/ -#define MSNP15_WLM_PRODUCT_KEY "ILTXC!4IXB5FB*PX" -#define MSNP15_WLM_PRODUCT_ID "PROD0119GSJUC$18" - -/*MSNP13 challenge*/ -#define MSNP13_WLM_PRODUCT_KEY "O4BG@C7BWLYQX?5G" -#define MSNP13_WLM_PRODUCT_ID "PROD01065C%ZFN6F" - -#define MSNP10_PRODUCT_KEY "VT6PX?UQTM4WM%YR" -#define MSNP10_PRODUCT_ID "PROD0038W!61ZTF9" - -typedef struct _MsnNotification MsnNotification; - -#include "session.h" -#include "servconn.h" -#include "cmdproc.h" -#include "user.h" - -struct _MsnNotification -{ - MsnSession *session; - - /** - * This is a convenience pointer that always points to - * servconn->cmdproc - */ - MsnCmdProc *cmdproc; - MsnServConn *servconn; - - gboolean in_use; -}; - -typedef void (*MsnFqyCb)(MsnSession *session, const char *passport, MsnNetwork network, gpointer data); - -#include "state.h" -void uum_send_msg(MsnSession *session,MsnMessage *msg); - -void msn_notification_end(void); -void msn_notification_init(void); - -void msn_notification_add_buddy_to_list(MsnNotification *notification, - MsnListId list_id, MsnUser *user); -void msn_notification_rem_buddy_from_list(MsnNotification *notification, - MsnListId list_id, MsnUser *user); - -void msn_notification_send_fqy(MsnSession *session, - const char *payload, int payload_len, - MsnFqyCb cb, gpointer cb_data); - -MsnNotification *msn_notification_new(MsnSession *session); -void msn_notification_destroy(MsnNotification *notification); -gboolean msn_notification_connect(MsnNotification *notification, - const char *host, int port); -void msn_notification_disconnect(MsnNotification *notification); -void msn_notification_dump_contact(MsnSession *session); - -/** - * Closes a notification. - * - * It's first closed, and then disconnected. - * - * @param notification The notification object to close. - */ -void msn_notification_close(MsnNotification *notification); - -void msn_got_login_params(MsnSession *session, const char *ticket, const char *response); - -#endif /* _MSN_NOTIFICATION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -/** - * @file object.c MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "msn.h" -#include "object.h" -#include "debug.h" -/* Sha1 stuff */ -#include "cipher.h" -/* Base64 stuff */ -#include "util.h" - -#define GET_STRING_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - if (obj->field != NULL) \ - g_free(obj->field); \ - obj->field = g_strndup(tag, c - tag); \ - } \ - } - -#define GET_INT_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - char buf[16]; \ - size_t offset; \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - memset(buf, 0, sizeof(buf)); \ - offset = c - tag; \ - if (offset >= sizeof(buf)) \ - offset = sizeof(buf) - 1; \ - strncpy(buf, tag, offset); \ - obj->field = atoi(buf); \ - } \ - } - -static GList *local_objs; - -MsnObject * -msn_object_new(void) -{ - MsnObject *obj; - - obj = g_new0(MsnObject, 1); - - msn_object_set_type(obj, MSN_OBJECT_UNKNOWN); - msn_object_set_friendly(obj, "AAA="); - - return obj; -} - -MsnObject * -msn_object_new_from_string(const char *str) -{ - MsnObject *obj; - char *tag, *c; - - g_return_val_if_fail(str != NULL, NULL); - - if (strncmp(str, "creator == NULL || obj->size == 0 || obj->type == 0 - || obj->location == NULL || obj->friendly == NULL - || obj->sha1d == NULL /*|| obj->sha1c == NULL*/) { - purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); - obj = NULL; - } - - return obj; -} - -MsnObject* -msn_object_new_from_image(PurpleStoredImage *img, const char *location, - const char *creator, MsnObjectType type) -{ - MsnObject *msnobj; - - PurpleCipherContext *ctx; - char *buf; - gconstpointer data; - size_t size; - char *base64; - unsigned char digest[20]; - - msnobj = NULL; - - if (img == NULL) - return msnobj; - - size = purple_imgstore_get_size(img); - data = purple_imgstore_get_data(img); - - /* New object */ - msnobj = msn_object_new(); - msn_object_set_local(msnobj); - msn_object_set_type(msnobj, type); - msn_object_set_location(msnobj, location); - msn_object_set_creator(msnobj, creator); - - msn_object_set_image(msnobj, img); - - /* Compute the SHA1D field. */ - memset(digest, 0, sizeof(digest)); - - ctx = purple_cipher_context_new_by_name("sha1", NULL); - purple_cipher_context_append(ctx, data, size); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1d(msnobj, base64); - g_free(base64); - - msn_object_set_size(msnobj, size); - - /* Compute the SHA1C field. */ - buf = g_strdup_printf( - "Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s", - msn_object_get_creator(msnobj), - msn_object_get_size(msnobj), - msn_object_get_type(msnobj), - msn_object_get_location(msnobj), - msn_object_get_friendly(msnobj), - msn_object_get_sha1d(msnobj)); - - memset(digest, 0, sizeof(digest)); - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(ctx); - g_free(buf); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1c(msnobj, base64); - g_free(base64); - - return msnobj; -} - -void -msn_object_destroy(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->creator); - g_free(obj->location); - g_free(obj->friendly); - g_free(obj->sha1d); - g_free(obj->sha1c); - - purple_imgstore_unref(obj->img); - - if (obj->local) - local_objs = g_list_remove(local_objs, obj); - - g_free(obj); -} - -char * -msn_object_to_string(const MsnObject *obj) -{ - char *str; - const char *sha1c; - - g_return_val_if_fail(obj != NULL, NULL); - - sha1c = msn_object_get_sha1c(obj); - - str = g_strdup_printf("", - msn_object_get_creator(obj), - msn_object_get_size(obj), - msn_object_get_type(obj), - msn_object_get_location(obj), - msn_object_get_friendly(obj), - msn_object_get_sha1d(obj), - sha1c ? " SHA1C=\"" : "", - sha1c ? sha1c : "", - sha1c ? "\"" : ""); - - return str; -} - -void -msn_object_set_creator(MsnObject *obj, const char *creator) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->creator); - obj->creator = g_strdup(creator); -} - -void -msn_object_set_size(MsnObject *obj, int size) -{ - g_return_if_fail(obj != NULL); - - obj->size = size; -} - -void -msn_object_set_type(MsnObject *obj, MsnObjectType type) -{ - g_return_if_fail(obj != NULL); - - obj->type = type; -} - -void -msn_object_set_location(MsnObject *obj, const char *location) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->location); - obj->location = g_strdup(location); -} - -void -msn_object_set_friendly(MsnObject *obj, const char *friendly) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->friendly); - obj->friendly = g_strdup(friendly); -} - -void -msn_object_set_sha1d(MsnObject *obj, const char *sha1d) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->sha1d); - obj->sha1d = g_strdup(sha1d); -} - -void -msn_object_set_sha1c(MsnObject *obj, const char *sha1c) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->sha1c); - obj->sha1c = g_strdup(sha1c); -} - -const char * -msn_object_get_creator(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->creator; -} - -int -msn_object_get_size(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, 0); - - return obj->size; -} - -MsnObjectType -msn_object_get_type(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, MSN_OBJECT_UNKNOWN); - - return obj->type; -} - -const char * -msn_object_get_location(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->location; -} - -const char * -msn_object_get_friendly(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->friendly; -} - -const char * -msn_object_get_sha1d(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1d; -} - -const char * -msn_object_get_sha1c(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1c; -} - -const char * -msn_object_get_sha1(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - if(obj->sha1c != NULL) { - return obj->sha1c; - } else { - return obj->sha1d; - } -} - -static MsnObject * -msn_object_find_local(const char *sha1) -{ - GList *l; - - g_return_val_if_fail(sha1 != NULL, NULL); - - for (l = local_objs; l != NULL; l = l->next) - { - MsnObject *local_obj = l->data; - - if (!strcmp(msn_object_get_sha1(local_obj), sha1)) - return local_obj; - } - - return NULL; - -} - -void -msn_object_set_local(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - obj->local = TRUE; - - local_objs = g_list_append(local_objs, obj); -} - -void -msn_object_set_image(MsnObject *obj, PurpleStoredImage *img) -{ - g_return_if_fail(obj != NULL); - g_return_if_fail(img != NULL); - - /* obj->local = TRUE; */ - - purple_imgstore_unref(obj->img); - obj->img = purple_imgstore_ref(img); -} - -PurpleStoredImage * -msn_object_get_image(const MsnObject *obj) -{ - MsnObject *local_obj; - - g_return_val_if_fail(obj != NULL, NULL); - - local_obj = msn_object_find_local(msn_object_get_sha1(obj)); - - if (local_obj != NULL) - return local_obj->img; - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/object.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,242 +0,0 @@ -/** - * @file object.h MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_OBJECT_H_ -#define _MSN_OBJECT_H_ - -#include "imgstore.h" - -#include "internal.h" - -typedef enum -{ - MSN_OBJECT_UNKNOWN = -1, /**< Unknown object */ - MSN_OBJECT_RESERVED1 = 1, /**< Reserved */ - MSN_OBJECT_EMOTICON = 2, /**< Custom Emoticon */ - MSN_OBJECT_USERTILE = 3, /**< UserTile (buddy icon) */ - MSN_OBJECT_RESERVED2 = 4, /**< Reserved */ - MSN_OBJECT_BACKGROUND = 5 /**< Background */ - -} MsnObjectType; - -typedef struct -{ - gboolean local; - - char *creator; - int size; - MsnObjectType type; - PurpleStoredImage *img; - char *location; - char *friendly; - char *sha1d; - char *sha1c; - -} MsnObject; - -/** - * Creates a MsnObject structure. - * - * @return A new MsnObject structure. - */ -MsnObject *msn_object_new(void); - -/** - * Creates a MsnObject structure from a string. - * - * @param str The string. - * - * @return The new MsnObject structure. - */ -MsnObject *msn_object_new_from_string(const char *str); - -/** - * Creates a MsnObject structure from a stored image - * - * @param img The image associated to object - * @param location The object location as stored in MsnObject - * @param creator The creator of the object - * @param type The type of the object - * - * @return A new MsnObject structure - */ -MsnObject *msn_object_new_from_image(PurpleStoredImage *img, - const char *location, const char *creator, MsnObjectType type); - -/** - * Destroys an MsnObject structure. - * - * @param obj The object structure. - */ -void msn_object_destroy(MsnObject *obj); - -/** - * Outputs a string representation of an MsnObject. - * - * @param obj The object. - * - * @return The string representation. This must be freed. - */ -char *msn_object_to_string(const MsnObject *obj); - -/** - * Sets the creator field in a MsnObject. - * - * @param creator The creator value. - */ -void msn_object_set_creator(MsnObject *obj, const char *creator); - -/** - * Sets the size field in a MsnObject. - * - * @param size The size value. - */ -void msn_object_set_size(MsnObject *obj, int size); - -/** - * Sets the type field in a MsnObject. - * - * @param type The type value. - */ -void msn_object_set_type(MsnObject *obj, MsnObjectType type); - -/** - * Sets the location field in a MsnObject. - * - * @param location The location value. - */ -void msn_object_set_location(MsnObject *obj, const char *location); - -/** - * Sets the friendly name field in a MsnObject. - * - * @param friendly The friendly name value. - */ -void msn_object_set_friendly(MsnObject *obj, const char *friendly); - -/** - * Sets the SHA1D field in a MsnObject. - * - * @param sha1d The sha1d value. - */ -void msn_object_set_sha1d(MsnObject *obj, const char *sha1d); - -/** - * Sets the SHA1C field in a MsnObject. - * - * @param sha1c The sha1c value. - */ -void msn_object_set_sha1c(MsnObject *obj, const char *sha1c); - -/** - * Associates an image with a MsnObject. - * - * @param obj The object. - * @param img The image to associate. - */ -void msn_object_set_image(MsnObject *obj, PurpleStoredImage *img); - -/** - * Returns a MsnObject's creator value. - * - * @param obj The object. - * - * @return The creator value. - */ -const char *msn_object_get_creator(const MsnObject *obj); - -/** - * Returns a MsnObject's size value. - * - * @param obj The object. - * - * @return The size value. - */ -int msn_object_get_size(const MsnObject *obj); - -/** - * Returns a MsnObject's type. - * - * @param obj The object. - * - * @return The object type. - */ -MsnObjectType msn_object_get_type(const MsnObject *obj); - -/** - * Returns a MsnObject's location value. - * - * @param obj The object. - * - * @return The location value. - */ -const char *msn_object_get_location(const MsnObject *obj); - -/** - * Returns a MsnObject's friendly name value. - * - * @param obj The object. - * - * @return The friendly name value. - */ -const char *msn_object_get_friendly(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1D value. - * - * @param obj The object. - * - * @return The SHA1D value. - */ -const char *msn_object_get_sha1d(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1c(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value if it exists, otherwise SHA1D. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1(const MsnObject *obj); - -/** - * Returns the image associated with the MsnObject. - * - * @param obj The object. - * - * @return The associated image. - */ -PurpleStoredImage *msn_object_get_image(const MsnObject *obj); - -void msn_object_set_local(MsnObject *obj); - -#endif /* _MSN_OBJECT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,842 +0,0 @@ -/** - * @file oim.c - * get and send MSN offline Instant Message via SOAP request - * Author - * MaYuan - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#include "msn.h" -#include "soap.h" -#include "oim.h" -#include "msnutils.h" - -typedef struct _MsnOimSendReq { - char *from_member; - char *friendname; - char *to_member; - char *oim_msg; -} MsnOimSendReq; - -typedef struct { - MsnOim *oim; - char *msg_id; -} MsnOimRecvData; - -/*Local Function Prototype*/ -static void msn_parse_oim_xml(MsnOim *oim, xmlnode *node); -static void msn_oim_free_send_req(MsnOimSendReq *req); -static void msn_oim_recv_data_free(MsnOimRecvData *data); -static void msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data); - -/*new a OIM object*/ -MsnOim * -msn_oim_new(MsnSession *session) -{ - MsnOim *oim; - - oim = g_new0(MsnOim, 1); - oim->session = session; - oim->oim_list = NULL; - oim->run_id = rand_guid(); - oim->challenge = NULL; - oim->send_queue = g_queue_new(); - oim->send_seq = 1; - return oim; -} - -/*destroy the oim object*/ -void -msn_oim_destroy(MsnOim *oim) -{ - MsnOimSendReq *request; - - purple_debug_info("msn", "destroy the OIM %p\n", oim); - g_free(oim->run_id); - g_free(oim->challenge); - - while ((request = g_queue_pop_head(oim->send_queue)) != NULL) - msn_oim_free_send_req(request); - g_queue_free(oim->send_queue); - - while (oim->oim_list != NULL) - msn_oim_recv_data_free((MsnOimRecvData *)oim->oim_list->data); - - g_free(oim); -} - -static MsnOimSendReq * -msn_oim_new_send_req(const char *from_member, const char*friendname, - const char* to_member, const char *msg) -{ - MsnOimSendReq *request; - - request = g_new0(MsnOimSendReq, 1); - request->from_member = g_strdup(from_member); - request->friendname = g_strdup(friendname); - request->to_member = g_strdup(to_member); - request->oim_msg = g_strdup(msg); - return request; -} - -static void -msn_oim_free_send_req(MsnOimSendReq *req) -{ - g_return_if_fail(req != NULL); - - g_free(req->from_member); - g_free(req->friendname); - g_free(req->to_member); - g_free(req->oim_msg); - - g_free(req); -} - -static MsnOimRecvData * -msn_oim_recv_data_new(MsnOim *oim, char *msg_id) -{ - MsnOimRecvData *data; - - data = g_new0(MsnOimRecvData, 1); - data->oim = oim; - data->msg_id = msg_id; - - oim->oim_list = g_list_append(oim->oim_list, data); - - return data; -} - -/* Probably only good for g_list_find_custom */ -static gint -msn_recv_data_equal(MsnOimRecvData *a, const char *msg_id) -{ - return strcmp(a->msg_id, msg_id); -} - -static void -msn_oim_recv_data_free(MsnOimRecvData *data) -{ - data->oim->oim_list = g_list_remove(data->oim->oim_list, data); - g_free(data->msg_id); - - g_free(data); -} - -/**************************************** - * Manage OIM Tokens - ****************************************/ -typedef struct _MsnOimRequestData { - MsnOim *oim; - gboolean send; - const char *action; - const char *host; - const char *url; - xmlnode *body; - MsnSoapCallback cb; - gpointer cb_data; -} MsnOimRequestData; - -static gboolean msn_oim_request_helper(MsnOimRequestData *data); - -static void -msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer req_data) -{ - MsnOimRequestData *data = (MsnOimRequestData *)req_data; - xmlnode *fault = NULL; - xmlnode *faultcode = NULL; - - if (response == NULL) - return; - - fault = xmlnode_get_child(response->xml, "Body/Fault"); - if (fault) - faultcode = xmlnode_get_child(fault, "faultcode"); - - if (faultcode) { - gchar *faultcode_str = xmlnode_get_data(faultcode); - gboolean need_token_update = FALSE; - - if (faultcode_str) { - if (g_str_equal(faultcode_str, "q0:BadContextToken") || - g_str_equal(faultcode_str, "AuthenticationFailed")) - need_token_update = TRUE; - else if (g_str_equal(faultcode_str, "q0:AuthenticationFailed") && - xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) - need_token_update = TRUE; - } - - if (need_token_update) { - purple_debug_warning("msn", "OIM Request Error, Updating token now.\n"); - msn_nexus_update_token(data->oim->session->nexus, - data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB, - (GSourceFunc)msn_oim_request_helper, data); - g_free(faultcode_str); - return; - - } - - g_free(faultcode_str); - } - - if (data->cb) - data->cb(request, response, data->cb_data); - xmlnode_free(data->body); - g_free(data); -} - -static gboolean -msn_oim_request_helper(MsnOimRequestData *data) -{ - MsnSession *session = data->oim->session; - - if (data->send) { - /* The Sending of OIM's uses a different token for some reason. */ - xmlnode *ticket; - ticket = xmlnode_get_child(data->body, "Header/Ticket"); - xmlnode_set_attrib(ticket, "passport", - msn_nexus_get_token_str(session->nexus, MSN_AUTH_LIVE_SECURE)); - } - else - { - xmlnode *passport; - xmlnode *xml_t; - xmlnode *xml_p; - GHashTable *token; - const char *msn_t; - const char *msn_p; - - token = msn_nexus_get_token(session->nexus, MSN_AUTH_MESSENGER_WEB); - g_return_val_if_fail(token != NULL, FALSE); - - msn_t = g_hash_table_lookup(token, "t"); - msn_p = g_hash_table_lookup(token, "p"); - - g_return_val_if_fail(msn_t != NULL, FALSE); - g_return_val_if_fail(msn_p != NULL, FALSE); - - passport = xmlnode_get_child(data->body, "Header/PassportCookie"); - xml_t = xmlnode_get_child(passport, "t"); - xml_p = xmlnode_get_child(passport, "p"); - - /* frees old token text, or the 'EMPTY' text if first time */ - xmlnode_free(xml_t->child); - xmlnode_free(xml_p->child); - - xmlnode_insert_data(xml_t, msn_t, -1); - xmlnode_insert_data(xml_p, msn_p, -1); - } - - msn_soap_message_send(session, - msn_soap_message_new(data->action, xmlnode_copy(data->body)), - data->host, data->url, FALSE, - msn_oim_request_cb, data); - - return FALSE; -} - - -static void -msn_oim_make_request(MsnOim *oim, gboolean send, const char *action, - const char *host, const char *url, xmlnode *body, MsnSoapCallback cb, - gpointer cb_data) -{ - MsnOimRequestData *data = g_new0(MsnOimRequestData, 1); - data->oim = oim; - data->send = send; - data->action = action; - data->host = host; - data->url = url; - data->body = body; - data->cb = cb; - data->cb_data = cb_data; - - msn_oim_request_helper(data); -} - -/**************************************** - * OIM GetMetadata request - * **************************************/ -static void -msn_oim_get_metadata_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOim *oim = data; - - if (response) { - msn_parse_oim_xml(oim, - xmlnode_get_child(response->xml, "Body/GetMetadataResponse/MD")); - } -} - -/* Post to get the OIM Metadata */ -static void -msn_oim_get_metadata(MsnOim *oim) -{ - msn_oim_make_request(oim, FALSE, MSN_OIM_GET_METADATA_ACTION, - MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL, - xmlnode_from_str(MSN_OIM_GET_METADATA_TEMPLATE, -1), - msn_oim_get_metadata_cb, oim); -} - -/**************************************** - * OIM send SOAP request - * **************************************/ -/*encode the message to OIM Message Format*/ -static gchar * -msn_oim_msg_to_str(MsnOim *oim, const char *body) -{ - GString *oim_body; - char *oim_base64; - char *c; - int len; - size_t base64_len; - - purple_debug_info("msn", "Encoding OIM Message...\n"); - len = strlen(body); - c = oim_base64 = purple_base64_encode((const guchar *)body, len); - base64_len = strlen(oim_base64); - purple_debug_info("msn", "Encoded base64 body:{%s}\n", oim_base64); - - oim_body = g_string_new(NULL); - g_string_printf(oim_body, MSN_OIM_MSG_TEMPLATE, - oim->run_id, oim->send_seq); - -#define OIM_LINE_LEN 76 - while (base64_len > OIM_LINE_LEN) { - g_string_append_len(oim_body, c, OIM_LINE_LEN); - g_string_append_c(oim_body, '\n'); - c += OIM_LINE_LEN; - base64_len -= OIM_LINE_LEN; - } -#undef OIM_LINE_LEN - - g_string_append(oim_body, c); - - g_free(oim_base64); - - return g_string_free(oim_body, FALSE); -} - -/* - * Process the send return SOAP string - * If got SOAP Fault,get the lock key,and resend it. - */ -static void -msn_oim_send_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOim *oim = data; - MsnOimSendReq *msg = g_queue_pop_head(oim->send_queue); - - g_return_if_fail(msg != NULL); - - if (response == NULL) { - purple_debug_info("msn", "cannot send OIM: %s\n", msg->oim_msg); - } else { - xmlnode *faultNode = xmlnode_get_child(response->xml, "Body/Fault"); - - if (faultNode == NULL) { - /*Send OK! return*/ - purple_debug_info("msn", "sent OIM: %s\n", msg->oim_msg); - } else { - xmlnode *faultcode = xmlnode_get_child(faultNode, "faultcode"); - - if (faultcode) { - char *faultcode_str = xmlnode_get_data(faultcode); - - if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) { - xmlnode *challengeNode = xmlnode_get_child(faultNode, - "detail/LockKeyChallenge"); - - if (challengeNode == NULL) { - if (oim->challenge) { - g_free(oim->challenge); - oim->challenge = NULL; - - purple_debug_info("msn", "Resending OIM: %s\n", - msg->oim_msg); - g_queue_push_head(oim->send_queue, msg); - msn_oim_send_msg(oim); - msg = NULL; - } else { - purple_debug_info("msn", - "Can't find lock key for OIM: %s\n", - msg->oim_msg); - } - } else { - char buf[33]; - - char *challenge = xmlnode_get_data(challengeNode); - msn_handle_chl(challenge, buf); - - g_free(oim->challenge); - oim->challenge = g_strndup(buf, sizeof(buf)); - g_free(challenge); - purple_debug_info("msn", "Found lockkey:{%s}\n", oim->challenge); - - /*repost the send*/ - purple_debug_info("msn", "Resending OIM: %s\n", msg->oim_msg); - g_queue_push_head(oim->send_queue, msg); - msn_oim_send_msg(oim); - msg = NULL; - } - } else { - /* Report the error */ - const char *str_reason; - - if (g_str_equal(faultcode_str, "q0:SystemUnavailable")) { - str_reason = _("Message was not sent because the system is " - "unavailable. This normally happens when the " - "user is blocked or does not exist."); - - } else if (g_str_equal(faultcode_str, "q0:SenderThrottleLimitExceeded")) { - str_reason = _("Message was not sent because messages " - "are being sent too quickly."); - - } else if (g_str_equal(faultcode_str, "q0:InvalidContent")) { - str_reason = _("Message was not sent because an unknown " - "encoding error occurred."); - - } else { - str_reason = _("Message was not sent because an unknown " - "error occurred."); - } - - msn_session_report_user(oim->session, msg->to_member, - str_reason, PURPLE_MESSAGE_ERROR); - msn_session_report_user(oim->session, msg->to_member, - msg->oim_msg, PURPLE_MESSAGE_RAW); - } - - g_free(faultcode_str); - } - } - } - - if (msg) - msn_oim_free_send_req(msg); -} - -void -msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername, - const char* friendname, const char *tomember, - const char * msg) -{ - g_return_if_fail(oim != NULL); - - g_queue_push_tail(oim->send_queue, - msn_oim_new_send_req(membername, friendname, tomember, msg)); -} - -/*post send single message request to oim server*/ -void -msn_oim_send_msg(MsnOim *oim) -{ - MsnOimSendReq *oim_request; - char *soap_body; - char *msg_body; - - g_return_if_fail(oim != NULL); - oim_request = g_queue_peek_head(oim->send_queue); - g_return_if_fail(oim_request != NULL); - - purple_debug_info("msn", "Sending OIM: %s\n", oim_request->oim_msg); - - /* if we got the challenge lock key, we compute it - * else we go for the SOAP fault and resend it. - */ - if (oim->challenge == NULL){ - purple_debug_info("msn", "No lock key challenge, waiting for SOAP Fault and Resend\n"); - } - - msg_body = msn_oim_msg_to_str(oim, oim_request->oim_msg); - soap_body = g_strdup_printf(MSN_OIM_SEND_TEMPLATE, - oim_request->from_member, - oim_request->friendname, - oim_request->to_member, - MSNP15_WLM_PRODUCT_ID, - oim->challenge ? oim->challenge : "", - oim->send_seq, - msg_body); - - msn_oim_make_request(oim, TRUE, MSN_OIM_SEND_SOAP_ACTION, MSN_OIM_SEND_HOST, - MSN_OIM_SEND_URL, xmlnode_from_str(soap_body, -1), msn_oim_send_read_cb, - oim); - - /*increase the offline Sequence control*/ - if (oim->challenge != NULL) { - oim->send_seq++; - } - - g_free(msg_body); - g_free(soap_body); -} - -/**************************************** - * OIM delete SOAP request - * **************************************/ -static void -msn_oim_delete_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOimRecvData *rdata = data; - - if (response && xmlnode_get_child(response->xml, "Body/Fault") == NULL) - purple_debug_info("msn", "Delete OIM success\n"); - else - purple_debug_info("msn", "Delete OIM failed\n"); - - msn_oim_recv_data_free(rdata); -} - -/*Post to get the Offline Instant Message*/ -static void -msn_oim_post_delete_msg(MsnOimRecvData *rdata) -{ - MsnOim *oim = rdata->oim; - char *msgid = rdata->msg_id; - char *soap_body; - - purple_debug_info("msn", "Delete single OIM Message {%s}\n",msgid); - - soap_body = g_strdup_printf(MSN_OIM_DEL_TEMPLATE, msgid); - - msn_oim_make_request(oim, FALSE, MSN_OIM_DEL_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, - MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_delete_read_cb, rdata); - - g_free(soap_body); -} - -/**************************************** - * OIM get SOAP request - * **************************************/ -/* like purple_str_to_time, but different. The format of the timestamp - * is like this: 5 Sep 2007 21:42:12 -0700 */ -static time_t -msn_oim_parse_timestamp(const char *timestamp) -{ - char month_str[4], tz_str[6]; - char *tz_ptr = tz_str; - static const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL - }; - time_t tval = 0; - struct tm t; - memset(&t, 0, sizeof(t)); - - time(&tval); - localtime_r(&tval, &t); - - if (sscanf(timestamp, "%02d %03s %04d %02d:%02d:%02d %05s", - &t.tm_mday, month_str, &t.tm_year, - &t.tm_hour, &t.tm_min, &t.tm_sec, tz_str) == 7) { - gboolean offset_positive = TRUE; - int tzhrs; - int tzmins; - - for (t.tm_mon = 0; - months[t.tm_mon] != NULL && - strcmp(months[t.tm_mon], month_str) != 0; t.tm_mon++); - if (months[t.tm_mon] != NULL) { - if (*tz_str == '-') { - offset_positive = FALSE; - tz_ptr++; - } else if (*tz_str == '+') { - tz_ptr++; - } - - if (sscanf(tz_ptr, "%02d%02d", &tzhrs, &tzmins) == 2) { - time_t tzoff = tzhrs * 60 * 60 + tzmins * 60; -#ifdef _WIN32 - long sys_tzoff; -#endif - - if (offset_positive) - tzoff *= -1; - - t.tm_year -= 1900; - -#ifdef _WIN32 - if ((sys_tzoff = wpurple_get_tz_offset()) != -1) - tzoff += sys_tzoff; -#else -#ifdef HAVE_TM_GMTOFF - tzoff += t.tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); /* making sure */ - tzoff -= timezone; -# endif -#endif -#endif /* _WIN32 */ - - return mktime(&t) + tzoff; - } - } - } - - purple_debug_info("msn", "Can't parse timestamp %s\n", timestamp); - return tval; -} - -/*Post the Offline Instant Message to User Conversation*/ -static void -msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) -{ - MsnMessage *message; - const char *date; - const char *from; - const char *boundary; - char *decode_msg = NULL; - gsize body_len; - char **tokens; - char *passport = NULL; - time_t stamp; - - message = msn_message_new(MSN_MSG_UNKNOWN); - - msn_message_parse_payload(message, msg_str, strlen(msg_str), - MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); - purple_debug_info("msn", "oim body:{%s}\n", message->body); - - boundary = msn_message_get_attr(message, "boundary"); - - if (boundary != NULL) { - char *bounds; - char **part; - - bounds = g_strdup_printf("--%s" MSG_OIM_LINE_DEM, boundary); - tokens = g_strsplit(message->body, bounds, 0); - - /* tokens+1 to skip the "This is a multipart message..." text */ - for (part = tokens+1; *part != NULL; part++) { - MsnMessage *multipart; - const char *type; - multipart = msn_message_new(MSN_MSG_UNKNOWN); - msn_message_parse_payload(multipart, *part, strlen(*part), - MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); - - type = msn_message_get_content_type(multipart); - if (type && !strcmp(type, "text/plain")) { - decode_msg = (char *)purple_base64_decode(multipart->body, &body_len); - msn_message_destroy(multipart); - break; - } - msn_message_destroy(multipart); - } - - g_strfreev(tokens); - g_free(bounds); - - if (decode_msg == NULL) { - purple_debug_error("msn", "Couldn't find text/plain OIM message.\n"); - msn_message_destroy(message); - return; - } - } else { - decode_msg = (char *)purple_base64_decode(message->body, &body_len); - } - - from = msn_message_get_attr(message, "X-OIM-originatingSource"); - - /* Match number to user's mobile number, FROM is a phone number - if the other side pages you using your phone number */ - if (from && !strncmp(from, "tel:+", 5)) { - MsnUser *user = msn_userlist_find_user_with_mobile_phone( - rdata->oim->session->userlist, from + 4); - - if (user && user->passport) - passport = g_strdup(user->passport); - } - - if (passport == NULL) { - char *start, *end; - - from = msn_message_get_attr(message, "From"); - - tokens = g_strsplit(from, " ", 2); - if (tokens[1] != NULL) - from = (const char *)tokens[1]; - - start = strchr(from, '<'); - if (start != NULL) { - start++; - end = strchr(from, '>'); - if (end != NULL) - passport = g_strndup(start, end - start); - } - if (passport == NULL) - passport = g_strdup(_("Unknown")); - - g_strfreev(tokens); - } - - date = msn_message_get_attr(message, "Date"); - stamp = msn_oim_parse_timestamp(date); - purple_debug_info("msn", "oim Date:{%s},passport{%s}\n", - date, passport); - - serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0, - stamp); - - /*Now get the oim message ID from the oim_list. - * and append to read list to prepare for deleting the Offline Message when sign out - */ - msn_oim_post_delete_msg(rdata); - - g_free(passport); - g_free(decode_msg); - msn_message_destroy(message); -} - -/* Parse the XML data, - * prepare to report the OIM to user - */ -static void -msn_oim_get_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOimRecvData *rdata = data; - - if (response != NULL) { - xmlnode *msg_node = xmlnode_get_child(response->xml, - "Body/GetMessageResponse/GetMessageResult"); - - if (msg_node) { - char *msg_str = xmlnode_get_data(msg_node); - msn_oim_report_to_user(rdata, msg_str); - g_free(msg_str); - } else { - char *str = xmlnode_to_str(response->xml, NULL); - purple_debug_info("msn", "Unknown OIM response: %s\n", str); - g_free(str); - msn_oim_recv_data_free(rdata); - } - } else { - purple_debug_info("msn", "Failed to get OIM\n"); - msn_oim_recv_data_free(rdata); - } - -} - -/* parse the oim XML data - * and post it to the soap server to get the Offline Message - * */ -void -msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg) -{ - xmlnode *node; - - purple_debug_info("msn", "%s\n", xmlmsg); - - if (!strcmp(xmlmsg, "too-large")) { - /* Too many OIM's to send via NS, so we need to request them via SOAP. */ - msn_oim_get_metadata(oim); - } else { - node = xmlnode_from_str(xmlmsg, -1); - msn_parse_oim_xml(oim, node); - xmlnode_free(node); - } -} - -static void -msn_parse_oim_xml(MsnOim *oim, xmlnode *node) -{ - xmlnode *mNode; - xmlnode *iu_node; - MsnSession *session = oim->session; - - g_return_if_fail(node != NULL); - - if (strcmp(node->name, "MD") != 0) { - char *xmlmsg = xmlnode_to_str(node, NULL); - purple_debug_info("msn", "WTF is this? %s\n", xmlmsg); - g_free(xmlmsg); - return; - } - - iu_node = xmlnode_get_child(node, "E/IU"); - - if (iu_node != NULL && purple_account_get_check_mail(session->account)) - { - char *unread = xmlnode_get_data(iu_node); - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.mail_url }; - int count = atoi(unread); - - /* XXX/khc: pretty sure this is wrong */ - if (count > 0) - purple_notify_emails(session->account->gc, count, FALSE, NULL, - NULL, passports, urls, NULL, NULL); - g_free(unread); - } - - for(mNode = xmlnode_get_child(node, "M"); mNode; - mNode = xmlnode_get_next_twin(mNode)){ - char *passport, *msgid, *nickname, *rtime = NULL; - xmlnode *e_node, *i_node, *n_node, *rt_node; - - e_node = xmlnode_get_child(mNode, "E"); - passport = xmlnode_get_data(e_node); - - i_node = xmlnode_get_child(mNode, "I"); - msgid = xmlnode_get_data(i_node); - - n_node = xmlnode_get_child(mNode, "N"); - nickname = xmlnode_get_data(n_node); - - rt_node = xmlnode_get_child(mNode, "RT"); - if (rt_node != NULL) { - rtime = xmlnode_get_data(rt_node); - } -/* purple_debug_info("msn", "E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */ - - if (!g_list_find_custom(oim->oim_list, msgid, (GCompareFunc)msn_recv_data_equal)) { - MsnOimRecvData *data = msn_oim_recv_data_new(oim, msgid); - msn_oim_post_single_get_msg(oim, data); - msgid = NULL; - } - - g_free(passport); - g_free(msgid); - g_free(rtime); - g_free(nickname); - } -} - -/*Post to get the Offline Instant Message*/ -static void -msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data) -{ - char *soap_body; - - purple_debug_info("msn", "Get single OIM Message\n"); - - soap_body = g_strdup_printf(MSN_OIM_GET_TEMPLATE, data->msg_id); - - msn_oim_make_request(oim, FALSE, MSN_OIM_GET_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, - MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_get_read_cb, - data); - - g_free(soap_body); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/oim.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -/** - * @file oim.h Header file for oim.c - * Author - * MaYuan - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef _MSN_OIM_H_ -#define _MSN_OIM_H_ - -/* OIM Retrieval Info */ -#define MSN_OIM_RETRIEVE_HOST "rsi.hotmail.com" -#define MSN_OIM_RETRIEVE_URL "/rsi/rsi.asmx" - -/* OIM GetMetadata SOAP Template */ -#define MSN_OIM_GET_METADATA_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata" - -#define MSN_OIM_GET_METADATA_TEMPLATE ""\ -""\ - ""\ - ""\ - "EMPTY"\ - "

EMPTY

"\ - "
"\ - "
"\ - ""\ - ""\ - ""\ -"" - -/*OIM GetMessage SOAP Template*/ -#define MSN_OIM_GET_SOAP_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage" - -#define MSN_OIM_GET_TEMPLATE ""\ -""\ - ""\ - ""\ - "EMPTY"\ - "

EMPTY

"\ - "
"\ - "
"\ - ""\ - ""\ - "%s"\ - "false"\ - ""\ - ""\ -"" - -/*OIM DeleteMessages SOAP Template*/ -#define MSN_OIM_DEL_SOAP_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages" - -#define MSN_OIM_DEL_TEMPLATE ""\ -""\ - ""\ - ""\ - "EMPTY"\ - "

EMPTY

"\ - "
"\ - "
"\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ -"" - -/*OIM Send SOAP Template*/ -#define MSN_OIM_MSG_TEMPLATE "MIME-Version: 1.0\n"\ - "Content-Type: text/plain; charset=UTF-8\n"\ - "Content-Transfer-Encoding: base64\n"\ - "X-OIM-Message-Type: OfflineMessage\n"\ - "X-OIM-Run-Id: {%s}\n"\ - "X-OIM-Sequence-Num: %d\n\n" - -#define MSN_OIM_SEND_HOST "ows.messenger.msn.com" -#define MSN_OIM_SEND_URL "/OimWS/oim.asmx" -#define MSN_OIM_SEND_SOAP_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2" -#define MSN_OIM_SEND_TEMPLATE ""\ -""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "http://messenger.msn.com"\ - "%d"\ - ""\ - ""\ - ""\ - "text"\ - "%s"\ - ""\ -"" - -typedef struct _MsnOim MsnOim; - -struct _MsnOim -{ - MsnSession *session; - - GList * oim_list; - - char *challenge; - char *run_id; - gint send_seq; - GQueue *send_queue; -}; - -/**************************************************** - * function prototype - * **************************************************/ -MsnOim * msn_oim_new(MsnSession *session); -void msn_oim_destroy(MsnOim *oim); - -void msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg); - -/*Send OIM Message*/ -void msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername, - const char *friendname, const char *tomember, - const char * msg); - -void msn_oim_send_msg(MsnOim *oim); - -#endif/* _MSN_OIM_H_*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/** - * @file page.c Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "page.h" - -MsnPage * -msn_page_new(void) -{ - MsnPage *page; - - page = g_new0(MsnPage, 1); - - return page; -} - -void -msn_page_destroy(MsnPage *page) -{ - g_return_if_fail(page != NULL); - - g_free(page->body); - g_free(page->from_location); - g_free(page->from_phone); - - g_free(page); -} - -char * -msn_page_gen_payload(const MsnPage *page, size_t *ret_size) -{ - char *str; - char *body; - - g_return_val_if_fail(page != NULL, NULL); - - body = g_markup_escape_text(msn_page_get_body(page), -1); - str = g_strdup_printf( - "%s", - body); - g_free(body); - - if (ret_size != NULL) - *ret_size = strlen(str); - - return str; -} - -void -msn_page_set_body(MsnPage *page, const char *body) -{ - g_return_if_fail(page != NULL); - g_return_if_fail(body != NULL); - - g_free(page->body); - page->body = g_strdup(body); -} - -const char * -msn_page_get_body(const MsnPage *page) -{ - g_return_val_if_fail(page != NULL, NULL); - - return page->body; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/page.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/** - * @file page.h Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_PAGE_H_ -#define _MSN_PAGE_H_ - -typedef struct _MsnPage MsnPage; - -#include "session.h" - -/** - * A page. - */ -struct _MsnPage -{ - char *from_location; - char *from_phone; - - char *body; -}; - -/** - * Creates a new, empty page. - * - * @return A new page. - */ -MsnPage *msn_page_new(void); - -/** - * Destroys a page. - */ -void msn_page_destroy(MsnPage *page); - -/** - * Generates the payload data of a page. - * - * @param page The page. - * @param ret_size The returned size of the payload. - * - * @return The payload data of a page. - */ -char *msn_page_gen_payload(const MsnPage *page, size_t *ret_size); - -/** - * Sets the body of a page. - * - * @param page The page. - * @param body The body of the page. - */ -void msn_page_set_body(MsnPage *page, const char *body); - -/** - * Returns the body of the page. - * - * @param page The page. - * - * @return The body of the page. - */ -const char *msn_page_get_body(const MsnPage *page); - -#endif /* _MSN_PAGE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -MSNP14 Implementation -by Ma Yuan - -1. Introduction -------------- - -MSNP14 Protocol, proposed by Windows Live Messenger, is new, and there is no available implementation except the official one on Windows Platform. - -It has introduced many new features attractable to many users, such as: -* Offline Instant Message - You can send the offline Message to the offline User, - The message will be posted to that user the next time when he is online. - -* Communicate with Yahoo User - U can chat with the Yahoo User in MSN, That's Fantastic! Till now , - you can send text/Nudge to Yahoo User. - -* Windows Live ID authentition - WLM use the Window Live ID Authentication process,Known as Passport 3.0, - The procedure is totally different to the previous Passport 2.0 - -* Video/Audio Conversation - U can communicate with other's via Video/Audio. -(Though very interesting, not implemented in this version) - -2.New Features Added ------------------ - -Till now, This project has implemented the following Feature: -* Windows Live ID authentication. - -* Offline Instant Message -Now can send and receive the Offline Instant Message to MSN user and Yahoo User. - -*contact management -Can add/delete Contact -Can add/delete Group - -* Communicate with Yahoo User -Can send/receive Message/Nudge to Yahoo User. - -*. Changes to made to fit MSNP14 Protocol - -3. Reference -------------- - -The very useful sites of MSN Protocol: -MSNpiki site: -reverse engineer of MSN Protocol.up to dated. -http://msnpiki.msnfanatic.com/index.php/MSN_Protocol_Version_13 - -hypothetic site: -old MSN Protocol Introduction,but very useful for basic idea of MSN protocol -http://www.hypothetic.org/docs/msn/index.php - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,605 +0,0 @@ -/** - * @file servconn.c Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "servconn.h" -#include "error.h" - -static void read_cb(gpointer data, gint source, PurpleInputCondition cond); -static void servconn_timeout_renew(MsnServConn *servconn); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnServConn * -msn_servconn_new(MsnSession *session, MsnServConnType type) -{ - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - servconn = g_new0(MsnServConn, 1); - - servconn->type = type; - - servconn->session = session; - servconn->cmdproc = msn_cmdproc_new(session); - servconn->cmdproc->servconn = servconn; - - servconn->httpconn = msn_httpconn_new(servconn); - - servconn->num = session->servconns_count++; - - servconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - servconn->tx_handler = 0; - servconn->timeout_sec = 0; - servconn->timeout_handle = 0; - - servconn->fd = -1; - - return servconn; -} - -void -msn_servconn_destroy(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->processing) - { - servconn->wasted = TRUE; - return; - } - - msn_servconn_disconnect(servconn); - - if (servconn->destroy_cb) - servconn->destroy_cb(servconn); - - if (servconn->httpconn != NULL) - msn_httpconn_destroy(servconn->httpconn); - - g_free(servconn->host); - - purple_circ_buffer_destroy(servconn->tx_buf); - if (servconn->tx_handler > 0) - purple_input_remove(servconn->tx_handler); - if (servconn->timeout_handle > 0) - purple_timeout_remove(servconn->timeout_handle); - - msn_cmdproc_destroy(servconn->cmdproc); - g_free(servconn); -} - -void -msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - servconn->connect_cb = connect_cb; -} - -void -msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->disconnect_cb = disconnect_cb; -} - -void -msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->destroy_cb = destroy_cb; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -void -msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error, - const char *reason) -{ - MsnSession *session = servconn->session; - MsnServConnType type = servconn->type; - - const char *names[] = { "Notification", "Switchboard" }; - const char *name; - - name = names[type]; - - if (reason == NULL) { - switch (error) - { - case MSN_SERVCONN_ERROR_CONNECT: - reason = _("Unable to connect"); break; - case MSN_SERVCONN_ERROR_WRITE: - reason = _("Writing error"); break; - case MSN_SERVCONN_ERROR_READ: - reason = _("Reading error"); break; - default: - reason = _("Unknown error"); break; - } - } - - purple_debug_error("msn", "Connection error from %s server (%s): %s\n", - name, servconn->host, reason); - - if (type == MSN_SERVCONN_SB) - { - MsnSwitchBoard *swboard; - swboard = servconn->cmdproc->data; - if (swboard != NULL) - swboard->error = MSN_SB_ERROR_CONNECTION; - } - - /* servconn->disconnect_cb may destroy servconn, so don't use it again */ - msn_servconn_disconnect(servconn); - - if (type == MSN_SERVCONN_NS) - { - char *tmp = g_strdup_printf(_("Connection error from %s server:\n%s"), - name, reason); - msn_session_set_error(session, MSN_ERROR_SERVCONN, tmp); - g_free(tmp); - } -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(gpointer data, gint source, const char *error_message) -{ - MsnServConn *servconn; - - servconn = data; - servconn->connect_data = NULL; - - servconn->fd = source; - - if (source >= 0) - { - servconn->connected = TRUE; - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - servconn->inpa = purple_input_add(servconn->fd, PURPLE_INPUT_READ, - read_cb, data); - servconn_timeout_renew(servconn); - } - else - { - purple_debug_error("msn", "Connection error: %s\n", error_message); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT, error_message); - } -} - -gboolean -msn_servconn_connect(MsnServConn *servconn, const char *host, int port, gboolean force) -{ - MsnSession *session; - - g_return_val_if_fail(servconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - session = servconn->session; - - if (servconn->connected) - msn_servconn_disconnect(servconn); - - g_free(servconn->host); - servconn->host = g_strdup(host); - - if (session->http_method) - { - /* HTTP Connection. */ - - if (!servconn->httpconn->connected || force) - if (!msn_httpconn_connect(servconn->httpconn, host, port)) - return FALSE; - - servconn->connected = TRUE; - servconn->httpconn->virgin = TRUE; - servconn_timeout_renew(servconn); - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - - return TRUE; - } - - servconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, connect_cb, servconn); - - return (servconn->connect_data != NULL); -} - -void -msn_servconn_disconnect(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->connect_data != NULL) - { - purple_proxy_connect_cancel(servconn->connect_data); - servconn->connect_data = NULL; - } - - if (!servconn->connected) - { - /* We could not connect. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->session->http_method) - { - /* Fake disconnection. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->inpa > 0) - { - purple_input_remove(servconn->inpa); - servconn->inpa = 0; - } - - if (servconn->timeout_handle > 0) - { - purple_timeout_remove(servconn->timeout_handle); - servconn->timeout_handle = 0; - } - - close(servconn->fd); - - servconn->rx_buf = NULL; - servconn->rx_len = 0; - servconn->payload_len = 0; - - servconn->connected = FALSE; - - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); -} - -static gboolean -servconn_idle_timeout_cb(MsnServConn *servconn) -{ - servconn->timeout_handle = 0; - msn_servconn_disconnect(servconn); - return FALSE; -} - -static void -servconn_timeout_renew(MsnServConn *servconn) -{ - if (servconn->timeout_handle) { - purple_timeout_remove(servconn->timeout_handle); - servconn->timeout_handle = 0; - } - - if (servconn->connected && servconn->timeout_sec) { - servconn->timeout_handle = purple_timeout_add_seconds( - servconn->timeout_sec, (GSourceFunc)servconn_idle_timeout_cb, servconn); - } -} - -void -msn_servconn_set_idle_timeout(MsnServConn *servconn, guint seconds) -{ - servconn->timeout_sec = seconds; - if (servconn->connected) - servconn_timeout_renew(servconn); -} - -static void -servconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn = data; - gssize ret; - int writelen; - - writelen = purple_circ_buffer_get_max_read(servconn->tx_buf); - - if (writelen == 0) { - purple_input_remove(servconn->tx_handler); - servconn->tx_handler = 0; - return; - } - - ret = write(servconn->fd, servconn->tx_buf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - return; - } - - purple_circ_buffer_mark_read(servconn->tx_buf, ret); - servconn_timeout_renew(servconn); -} - -gssize -msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len) -{ - gssize ret = 0; - - g_return_val_if_fail(servconn != NULL, 0); - - if (!servconn->session->http_method) - { - if (servconn->tx_handler == 0) { - switch (servconn->type) - { - case MSN_SERVCONN_NS: - case MSN_SERVCONN_SB: - ret = write(servconn->fd, buf, len); - break; -#if 0 - case MSN_SERVCONN_DC: - ret = write(servconn->fd, &buf, sizeof(len)); - ret = write(servconn->fd, buf, len); - break; -#endif - default: - ret = write(servconn->fd, buf, len); - break; - } - } else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno == EAGAIN) - ret = 0; - if (ret >= 0 && ret < len) { - if (servconn->tx_handler == 0) - servconn->tx_handler = purple_input_add( - servconn->fd, PURPLE_INPUT_WRITE, - servconn_write_cb, servconn); - purple_circ_buffer_append(servconn->tx_buf, buf + ret, - len - ret); - } - } - else - { - ret = msn_httpconn_write(servconn->httpconn, buf, len); - } - - if (ret == -1) - { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - } - - servconn_timeout_renew(servconn); - return ret; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn; - char buf[MSN_BUF_LEN]; - gssize len; - - servconn = data; - - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); - - len = read(servconn->fd, buf, sizeof(buf) - 1); - if (len < 0 && errno == EAGAIN) - return; - if (len <= 0) { - purple_debug_error("msn", "servconn %03d read error, " - "len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n", - servconn->num, len, errno, g_strerror(errno)); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - buf[len] = '\0'; - - servconn->rx_buf = g_realloc(servconn->rx_buf, len + servconn->rx_len + 1); - memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1); - servconn->rx_len += len; - - servconn = msn_servconn_process_data(servconn); - if (servconn) - servconn_timeout_renew(servconn); -} - -MsnServConn *msn_servconn_process_data(MsnServConn *servconn) -{ - char *cur, *end, *old_rx_buf; - int cur_len; - - end = old_rx_buf = servconn->rx_buf; - - servconn->processing = TRUE; - - do - { - cur = end; - - if (servconn->payload_len) - { - if (servconn->payload_len > servconn->rx_len) - /* The payload is still not complete. */ - break; - - cur_len = servconn->payload_len; - end += cur_len; - } - else - { - end = strstr(cur, "\r\n"); - - if (end == NULL) - /* The command is still not complete. */ - break; - - *end = '\0'; - end += 2; - cur_len = end - cur; - } - - servconn->rx_len -= cur_len; - - if (servconn->payload_len) - { - msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len); - servconn->payload_len = 0; - } - else - { - msn_cmdproc_process_cmd_text(servconn->cmdproc, cur); - servconn->payload_len = servconn->cmdproc->last_cmd->payload_len; - } - } while (servconn->connected && !servconn->wasted && servconn->rx_len > 0); - - if (servconn->connected && !servconn->wasted) - { - if (servconn->rx_len > 0) - servconn->rx_buf = g_memdup(cur, servconn->rx_len); - else - servconn->rx_buf = NULL; - } - - servconn->processing = FALSE; - - if (servconn->wasted) { - msn_servconn_destroy(servconn); - servconn = NULL; - } - - g_free(old_rx_buf); - return servconn; -} - -#if 0 -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/servconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/** - * @file servconn.h Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SERVCONN_H_ -#define _MSN_SERVCONN_H_ - -typedef struct _MsnServConn MsnServConn; - -#include "session.h" -#include "cmdproc.h" - -#include "proxy.h" -#include "httpconn.h" - -/** - * Connection error types. - */ -typedef enum -{ - MSN_SERVCONN_ERROR_NONE, - MSN_SERVCONN_ERROR_CONNECT, - MSN_SERVCONN_ERROR_WRITE, - MSN_SERVCONN_ERROR_READ - -} MsnServConnError; - -/** - * Connection types. - */ -typedef enum -{ - MSN_SERVCONN_NS, - MSN_SERVCONN_SB - -} MsnServConnType; - -/** - * A Connection. - */ -struct _MsnServConn -{ - MsnServConnType type; /**< The type of this connection. */ - MsnSession *session; /**< The MSN session of this connection. */ - MsnCmdProc *cmdproc; /**< The command processor of this connection. */ - - PurpleProxyConnectData *connect_data; - - gboolean connected; /**< A flag that states if it's connected. */ - gboolean processing; /**< A flag that states if something is working - with this connection. */ - gboolean wasted; /**< A flag that states if it should be destroyed. */ - - char *host; /**< The host this connection is connected or should be - connected to. */ - int num; /**< A number id of this connection. */ - - MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ - - int fd; /**< The connection's file descriptor. */ - int inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer lenght. */ - - size_t payload_len; /**< The length of the payload. - It's only set when we've received a command that - has a payload. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; - guint timeout_sec; - guint timeout_handle; - - void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ - void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ - void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ -}; - -/** - * Creates a new connection object. - * - * @param session The session. - * @param type The type of the connection. - */ -MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); - -/** - * Destroys a connection object. - * - * @param servconn The connection. - */ -void msn_servconn_destroy(MsnServConn *servconn); - -/** - * Connects to a host. - * - * @param servconn The connection. - * @param host The host. - * @param port The port. - * @param force Force this servconn to connect to a new server. - */ -gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port, - gboolean force); - -/** - * Disconnects. - * - * @param servconn The connection. - */ -void msn_servconn_disconnect(MsnServConn *servconn); - -/** - * Sets the connect callback. - * - * @param servconn The servconn. - * @param connect_cb The connect callback. - */ -void msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)); -/** - * Sets the disconnect callback. - * - * @param servconn The servconn. - * @param disconnect_cb The disconnect callback. - */ -void msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)); -/** - * Sets the destroy callback. - * - * @param servconn The servconn that's being destroyed. - * @param destroy_cb The destroy callback. - */ -void msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)); - -/** - * Writes a chunck of data to the servconn. - * - * @param servconn The servconn. - * @param buf The data to write. - * @param size The size of the data. - */ -gssize msn_servconn_write(MsnServConn *servconn, const char *buf, - size_t size); - -/** - * Function to call whenever an error related to a switchboard occurs. - * - * @param servconn The servconn. - * @param error The error that happened. - */ -void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error, - const char *reason); - -/** - * Process the data in servconn->rx_buf. This is called after reading - * data from the socket. - * - * @param servconn The servconn. - * - * @return @c NULL if servconn was destroyed, 'servconn' otherwise. - */ -MsnServConn *msn_servconn_process_data(MsnServConn *servconn); - -/** - * Set a idle timeout fot this servconn - * - * @param servconn The servconn - * @param seconds The idle timeout in seconds - */ -void msn_servconn_set_idle_timeout(MsnServConn *servconn, guint seconds); - -#endif /* _MSN_SERVCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,453 +0,0 @@ -/** - * @file session.c MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "session.h" -#include "notification.h" -#include "oim.h" - -#include "dialog.h" - -MsnSession * -msn_session_new(PurpleAccount *account) -{ - MsnSession *session; - - g_return_val_if_fail(account != NULL, NULL); - - session = g_new0(MsnSession, 1); - - session->account = account; - session->notification = msn_notification_new(session); - session->userlist = msn_userlist_new(session); - - session->user = msn_user_new(session->userlist, - purple_account_get_username(account), NULL); - session->oim = msn_oim_new(session); - - session->protocol_ver = WLM_PROT_VER; - - return session; -} - -void -msn_session_destroy(MsnSession *session) -{ - g_return_if_fail(session != NULL); - - session->destroying = TRUE; - - if (session->connected) - msn_session_disconnect(session); - - if (session->soap_cleanup_handle) - purple_timeout_remove(session->soap_cleanup_handle); - - if (session->soap_table != NULL) - g_hash_table_destroy(session->soap_table); - - while (session->slplinks != NULL) - msn_slplink_destroy(session->slplinks->data); - - while (session->switches != NULL) - msn_switchboard_destroy(session->switches->data); - - if (session->sync != NULL) - msn_sync_destroy(session->sync); - - if (session->oim != NULL) - msn_oim_destroy(session->oim); - - if (session->nexus != NULL) - msn_nexus_destroy(session->nexus); - - if (session->user != NULL) - msn_user_destroy(session->user); - - if (session->notification != NULL) - msn_notification_destroy(session->notification); - - msn_userlist_destroy(session->userlist); - - g_free(session->psm); - g_free(session->abch_cachekey); -#if 0 - g_free(session->blocked_text); -#endif - - g_free(session->passport_info.kv); - g_free(session->passport_info.sid); - g_free(session->passport_info.mspauth); - g_free(session->passport_info.client_ip); - g_free(session->passport_info.mail_url); - - g_free(session); -} - -gboolean -msn_session_connect(MsnSession *session, const char *host, int port, - gboolean http_method) -{ - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(!session->connected, TRUE); - - session->connected = TRUE; - session->http_method = http_method; - - if (session->notification == NULL) - { - purple_debug_error("msn", "This shouldn't happen\n"); - g_return_val_if_reached(FALSE); - } - - return msn_notification_connect(session->notification, host, port); -} - -void -msn_session_disconnect(MsnSession *session) -{ - g_return_if_fail(session != NULL); - - if (!session->connected) - return; - - session->connected = FALSE; - - while (session->switches != NULL) - msn_switchboard_close(session->switches->data); - - if (session->notification != NULL) - msn_notification_close(session->notification); -} - -/* TODO: This must go away when conversation is redesigned */ -MsnSwitchBoard * -msn_session_find_swboard(MsnSession *session, const char *username) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user)) - return swboard; - } - - return NULL; -} - -static PurpleConversation * -msn_session_get_conv(MsnSession *session,const char *passport) -{ - PurpleAccount *account; - PurpleConversation * conv; - - g_return_val_if_fail(session != NULL, NULL); - account = session->account; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - passport, account); - if(conv == NULL){ - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, passport); - } - return conv; -} - -/* put Message to User Conversation - * - * passport - the one want to talk to you - */ -void -msn_session_report_user(MsnSession *session,const char *passport,const char *msg,PurpleMessageFlags flags) -{ - PurpleConversation * conv; - - if ((conv = msn_session_get_conv(session,passport)) != NULL){ - purple_conversation_write(conv, NULL, msg, flags, time(NULL)); - } -} - -MsnSwitchBoard * -msn_session_find_swboard_with_conv(MsnSession *session, PurpleConversation *conv) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(conv != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->conv == conv) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_find_swboard_with_id(const MsnSession *session, int chat_id) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(chat_id >= 0, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->chat_id == chat_id) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_get_swboard(MsnSession *session, const char *username, - MsnSBFlag flag) -{ - MsnSwitchBoard *swboard; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = msn_session_find_swboard(session, username); - - if (swboard == NULL) - { - swboard = msn_switchboard_new(session); - swboard->im_user = g_strdup(username); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, username); - } - - swboard->flag |= flag; - - return swboard; -} - -static void -msn_session_sync_users(MsnSession *session) -{ - PurpleConnection *gc = purple_account_get_connection(session->account); - GList *to_remove = NULL; - GSList *buddies; - - g_return_if_fail(gc != NULL); - - /* The core used to use msn_add_buddy to add all buddies before - * being logged in. This no longer happens, so we manually iterate - * over the whole buddy list to identify sync issues. - */ - for (buddies = purple_find_buddies(session->account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *buddy = buddies->data; - const gchar *buddy_name = purple_buddy_get_name(buddy); - const gchar *group_name = purple_group_get_name(purple_buddy_get_group(buddy)); - MsnUser *remote_user; - gboolean found = FALSE; - - remote_user = msn_userlist_find_user(session->userlist, buddy_name); - if (remote_user && remote_user->list_op & MSN_LIST_FL_OP) { - GList *l; - for (l = remote_user->group_ids; l; l = l->next) { - const char *name = msn_userlist_find_group_name(remote_user->userlist, l->data); - if (name && !g_ascii_strcasecmp(group_name, name)) { - found = TRUE; - break; - } - } - - /* We don't care if they're in a different group, as long as they're on the - * list somewhere. If we check for the group, we cause pain, agony and - * suffering for people who decide to re-arrange their buddy list elsewhere. - */ - if (!found) { - if ((remote_user == NULL) || !(remote_user->list_op & MSN_LIST_FL_OP)) { - /* The user is not on the server list */ - msn_show_sync_issue(session, buddy_name, group_name); - } else { - /* The user is not in that group on the server list */ - to_remove = g_list_prepend(to_remove, buddy); - } - } - } - } - - if (to_remove != NULL) { - g_list_foreach(to_remove, (GFunc)purple_blist_remove_buddy, NULL); - g_list_free(to_remove); - } -} - -void -msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info) -{ - PurpleConnection *gc; - PurpleConnectionError reason; - char *msg; - - if (session->destroying) - return; - - gc = purple_account_get_connection(session->account); - - switch (error) - { - case MSN_ERROR_SERVCONN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(info); - break; - case MSN_ERROR_UNSUPPORTED_PROTOCOL: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Our protocol is not supported by the " - "server")); - break; - case MSN_ERROR_HTTP_MALFORMED: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Error parsing HTTP")); - break; - case MSN_ERROR_SIGN_OTHER: - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - msg = g_strdup(_("You have signed on from another location")); - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); - break; - case MSN_ERROR_SERV_UNAVAILABLE: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are temporarily " - "unavailable. Please wait and try " - "again.")); - break; - case MSN_ERROR_SERV_DOWN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are going down " - "temporarily")); - break; - case MSN_ERROR_AUTH: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - msg = g_strdup_printf(_("Unable to authenticate: %s"), - (info == NULL ) ? - _("Unknown error") : info); - break; - case MSN_ERROR_BAD_BLIST: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Your MSN buddy list is temporarily " - "unavailable. Please wait and try " - "again.")); - break; - default: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Unknown error")); - break; - } - - msn_session_disconnect(session); - - purple_connection_error_reason(gc, reason, msg); - - g_free(msg); -} - -static const char * -get_login_step_text(MsnSession *session) -{ - const char *steps_text[] = { - _("Connecting"), - _("Handshaking"), - _("Transferring"), - _("Handshaking"), - _("Starting authentication"), - _("Getting cookie"), - _("Authenticating"), - _("Sending cookie"), - _("Retrieving buddy list") - }; - - return steps_text[session->login_step]; -} - -void -msn_session_set_login_step(MsnSession *session, MsnLoginStep step) -{ - PurpleConnection *gc; - - /* Prevent the connection progress going backwards, eg. if we get - * transferred several times during login */ - if (session->login_step > step) - return; - - /* If we're already logged in, we're probably here because of a - * mid-session XFR from the notification server, so we don't want to - * popup the connection progress dialog */ - if (session->logged_in) - return; - - gc = session->account->gc; - - session->login_step = step; - - purple_connection_update_progress(gc, get_login_step_text(session), step, - MSN_LOGIN_STEPS); -} - -void -msn_session_finish_login(MsnSession *session) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurpleStoredImage *img; - - if (!session->logged_in) { - account = session->account; - gc = purple_account_get_connection(account); - - img = purple_buddy_icons_find_account_icon(session->account); - /* TODO: Do we really want to call this if img is NULL? */ - msn_user_set_buddy_icon(session->user, img); - if (img != NULL) - purple_imgstore_unref(img); - - session->logged_in = TRUE; - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Sync users */ - msn_session_sync_users(session); - } - - msn_change_status(session); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,241 +0,0 @@ -/** - * @file session.h MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SESSION_H_ -#define _MSN_SESSION_H_ - -typedef struct _MsnSession MsnSession; - -#include "sslconn.h" - -#include "user.h" -#include "slpcall.h" - -#include "notification.h" -#include "switchboard.h" -#include "group.h" - -#include "nexus.h" -#include "httpconn.h" -#include "oim.h" - -#include "userlist.h" -#include "sync.h" - -/** - * Types of errors. - */ -typedef enum -{ - MSN_ERROR_SERVCONN, - MSN_ERROR_UNSUPPORTED_PROTOCOL, - MSN_ERROR_HTTP_MALFORMED, - MSN_ERROR_AUTH, - MSN_ERROR_BAD_BLIST, - MSN_ERROR_SIGN_OTHER, - MSN_ERROR_SERV_DOWN, - MSN_ERROR_SERV_UNAVAILABLE - -} MsnErrorType; - -/** - * Login steps. - */ -typedef enum -{ - MSN_LOGIN_STEP_START, - MSN_LOGIN_STEP_HANDSHAKE, - MSN_LOGIN_STEP_TRANSFER, - MSN_LOGIN_STEP_HANDSHAKE2, - MSN_LOGIN_STEP_AUTH_START, - MSN_LOGIN_STEP_AUTH, - MSN_LOGIN_STEP_GET_COOKIE, - MSN_LOGIN_STEP_AUTH_END, - MSN_LOGIN_STEP_SYN, - MSN_LOGIN_STEP_END - -} MsnLoginStep; - -#define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END - -struct _MsnSession -{ - PurpleAccount *account; - MsnUser *user; - - guint protocol_ver; - - MsnLoginStep login_step; /**< The current step in the login process. */ - - gboolean connected; - gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ - int adl_fqy; /**< A count of ADL/FQY so status is only changed once. */ - gboolean destroying; /**< A flag that states if the session is being destroyed. */ - gboolean http_method; - - MsnNotification *notification; - MsnNexus *nexus; - MsnOim *oim; - MsnSync *sync; - MsnUserList *userlist; - char *abch_cachekey; - - int servconns_count; /**< The count of server connections. */ - GList *switches; /**< The list of all the switchboards. */ - GList *slplinks; /**< The list of all the slplinks. */ - - /*psm info*/ - char *psm; - -#if 0 - char *blocked_text; -#endif - - struct - { - char *kv; - char *sid; - char *mspauth; - unsigned long sl; - char *client_ip; - int client_port; - char *mail_url; - gulong mail_timestamp; - gboolean email_enabled; - } passport_info; - - GHashTable *soap_table; - guint soap_cleanup_handle; -}; - -/** - * Creates an MSN session. - * - * @param account The account. - * - * @return The new MSN session. - */ -MsnSession *msn_session_new(PurpleAccount *account); - -/** - * Destroys an MSN session. - * - * @param session The MSN session to destroy. - */ -void msn_session_destroy(MsnSession *session); - -/** - * Connects to and initiates an MSN session. - * - * @param session The MSN session. - * @param host The dispatch server host. - * @param port The dispatch server port. - * @param http_method Whether to use or not http_method. - * - * @return @c TRUE on success, @c FALSE on failure. - */ -gboolean msn_session_connect(MsnSession *session, - const char *host, int port, - gboolean http_method); - -/** - * Disconnects from an MSN session. - * - * @param session The MSN session. - */ -void msn_session_disconnect(MsnSession *session); - - /** - * Finds a switchboard with the given username. - * - * @param session The MSN session. - * @param username The username to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, - const char *username); - - /** - * Finds a switchboard with the given conversation. - * - * @param session The MSN session. - * @param conv The conversation to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, - PurpleConversation *conv); -/** - * Finds a switchboard with the given chat ID. - * - * @param session The MSN session. - * @param chat_id The chat ID to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, - int chat_id); - -/** - * Returns a switchboard to communicate with certain username. - * - * @param session The MSN session. - * @param username The username to search for. - * @param flag The flag of the switchboard - * - * @return The switchboard. - */ -MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, - const char *username, MsnSBFlag flag); - -/** - * Sets an error for the MSN session. - * - * @param session The MSN session. - * @param error The error. - * @param info Extra information. - */ -void msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info); - -/** - * Sets the current step in the login proccess. - * - * @param session The MSN session. - * @param step The current step. - */ -void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); - -/** - * Finish the login proccess. - * - * @param session The MSN session. - */ -void msn_session_finish_login(MsnSession *session); - -/*post message to User*/ -void msn_session_report_user(MsnSession *session,const char *passport, - const char *msg,PurpleMessageFlags flags); - -#endif /* _MSN_SESSION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1194 +0,0 @@ -/** - * @file msnslp.c MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slp.h" -#include "slpcall.h" -#include "slpmsg.h" - -#include "object.h" -#include "user.h" -#include "switchboard.h" - -#include "smiley.h" - -/* ms to delay between sending buddy icon requests to the server. */ -#define BUDDY_ICON_DELAY 20 - -static void send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -static void send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -static void request_user_display(MsnUser *user); - -/************************************************************************** - * Util - **************************************************************************/ - -static char * -get_token(const char *str, const char *start, const char *end) -{ - const char *c, *c2; - - if ((c = strstr(str, start)) == NULL) - return NULL; - - c += strlen(start); - - if (end != NULL) - { - if ((c2 = strstr(c, end)) == NULL) - return NULL; - - return g_strndup(c, c2 - c); - } - else - { - /* This has to be changed */ - return g_strdup(c); - } - -} - -/************************************************************************** - * Xfer - **************************************************************************/ - -static void -msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - /* MsnSlpLink *slplink; */ - char *content; - - purple_debug_info("msn", "xfer_init\n"); - - slpcall = xfer->data; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_send_queued_slpmsgs(slpcall->slplink); -} - -void -msn_xfer_cancel(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *content; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - - slpcall = xfer->data; - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) - { - if (slpcall->started) - { - msn_slpcall_close(slpcall); - } - else - { - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_send_queued_slpmsgs(slpcall->slplink); - - msn_slpcall_destroy(slpcall); - } - } -} - -void -msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset) -{ - PurpleXfer *xfer; - - xfer = slpcall->xfer; - - xfer->bytes_sent = (offset + len); - xfer->bytes_remaining = total_length - (offset + len); - - purple_xfer_update_progress(xfer); -} - -void -msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session) -{ - if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL)) - { - purple_xfer_cancel_remote(slpcall->xfer); - } -} - -void -msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body, - gsize size) -{ - PurpleXfer *xfer = slpcall->xfer; - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); -} - -/************************************************************************** - * SLP Control - **************************************************************************/ - -#if 0 -static void -got_transresp(MsnSlpCall *slpcall, const char *nonce, - const char *ips_str, int port) -{ - MsnDirectConn *directconn; - char **ip_addrs, **c; - - directconn = msn_directconn_new(slpcall->slplink); - - directconn->initial_call = slpcall; - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - ip_addrs = g_strsplit(ips_str, " ", -1); - - for (c = ip_addrs; *c != NULL; c++) - { - purple_debug_info("msn", "ip_addr = %s\n", *c); - if (msn_directconn_connect(directconn, *c, port)) - break; - } - - g_strfreev(ip_addrs); -} -#endif - -static void -send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 200 OK */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 200 OK", - branch, type, content); - - slpmsg->info = "SLP 200 OK"; - slpmsg->text_body = TRUE; - - msn_slplink_queue_slpmsg(slplink, slpmsg); - - msn_slpcall_session_init(slpcall); -} - -static void -send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 603 Decline */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 603 Decline", - branch, type, content); - - slpmsg->info = "SLP 603 Decline"; - slpmsg->text_body = TRUE; - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -/* XXX: this could be improved if we tracked custom smileys - * per-protocol, per-account, per-session or (ideally) per-conversation - */ -static PurpleStoredImage * -find_valid_emoticon(PurpleAccount *account, const char *path) -{ - GList *smileys; - - if (!purple_account_get_bool(account, "custom_smileys", TRUE)) - return NULL; - - smileys = purple_smileys_get_all(); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - PurpleSmiley *smiley; - PurpleStoredImage *img; - - smiley = smileys->data; - img = purple_smiley_get_stored_image(smiley); - - if (purple_strequal(path, purple_imgstore_get_filename(img))) { - g_list_free(smileys); - return img; - } - - purple_imgstore_unref(img); - } - - purple_debug_error("msn", "Received illegal request for file %s\n", path); - return NULL; -} - -#define MAX_FILE_NAME_LEN 0x226 - -static void -got_sessionreq(MsnSlpCall *slpcall, const char *branch, - const char *euf_guid, const char *context) -{ - gboolean accepted = FALSE; - - if (!strcmp(euf_guid, MSN_OBJ_GUID)) - { - /* Emoticon or UserDisplay */ - char *content; - gsize len; - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - MsnObject *obj; - char *msnobj_data; - PurpleStoredImage *img = NULL; - int type; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - - slplink = slpcall->slplink; - - msnobj_data = (char *)purple_base64_decode(context, &len); - obj = msn_object_new_from_string(msnobj_data); - type = msn_object_get_type(obj); - g_free(msnobj_data); - - if (type == MSN_OBJECT_EMOTICON) { - img = find_valid_emoticon(slplink->session->account, obj->location); - } else if (type == MSN_OBJECT_USERTILE) { - img = msn_object_get_image(obj); - if (img) - purple_imgstore_ref(img); - } - msn_object_destroy(obj); - - if (img != NULL) { - /* DATA PREP */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->session_id = slpcall->session_id; - msn_slpmsg_set_body(slpmsg, NULL, 4); - slpmsg->info = "SLP DATA PREP"; - msn_slplink_queue_slpmsg(slplink, slpmsg); - - /* DATA */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->flags = 0x20; - slpmsg->info = "SLP DATA"; - msn_slpmsg_set_image(slpmsg, img); - msn_slplink_queue_slpmsg(slplink, slpmsg); - purple_imgstore_unref(img); - - accepted = TRUE; - - } else { - purple_debug_error("msn", "Wrong object.\n"); - } - } - - else if (!strcmp(euf_guid, MSN_FT_GUID)) - { - /* File Transfer */ - PurpleAccount *account; - PurpleXfer *xfer; - char *bin; - gsize bin_len; - guint32 file_size; - char *file_name; - - account = slpcall->slplink->session->account; - - slpcall->cb = msn_xfer_completed_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->progress_cb = msn_xfer_progress_cb; - slpcall->branch = g_strdup(branch); - - slpcall->pending = TRUE; - - xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, - slpcall->slplink->remote_user); - if (xfer) - { - bin = (char *)purple_base64_decode(context, &bin_len); - file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8)); - - file_name = g_convert(bin + 20, MAX_FILE_NAME_LEN, "UTF-8", "UTF-16LE", - NULL, NULL, NULL); - - g_free(bin); - - purple_xfer_set_filename(xfer, file_name ? file_name : ""); - g_free(file_name); - purple_xfer_set_size(xfer, file_size); - purple_xfer_set_init_fnc(xfer, msn_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); - purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); - - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - xfer->data = slpcall; - - purple_xfer_request(xfer); - } - - accepted = TRUE; - - } else if (!strcmp(euf_guid, MSN_CAM_REQUEST_GUID)) { - purple_debug_info("msn", "Cam request.\n"); - if (slpcall && slpcall->slplink && - slpcall->slplink->session) { - PurpleConversation *conv; - gchar *from = slpcall->slplink->remote_user; - conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, from, - slpcall->slplink->session->account); - if (conv) { - char *buf; - buf = g_strdup_printf( - _("%s requests to view your " - "webcam, but this request is " - "not yet supported."), from); - purple_conversation_write(conv, NULL, buf, - PURPLE_MESSAGE_SYSTEM | - PURPLE_MESSAGE_NOTIFY, - time(NULL)); - g_free(buf); - } - } - - } else if (!strcmp(euf_guid, MSN_CAM_GUID)) { - purple_debug_info("msn", "Cam invite.\n"); - if (slpcall && slpcall->slplink && - slpcall->slplink->session) { - PurpleConversation *conv; - gchar *from = slpcall->slplink->remote_user; - conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, from, - slpcall->slplink->session->account); - if (conv) { - char *buf; - buf = g_strdup_printf( - _("%s invited you to view his/her webcam, but " - "this is not yet supported."), from); - purple_conversation_write(conv, NULL, buf, - PURPLE_MESSAGE_SYSTEM | - PURPLE_MESSAGE_NOTIFY, - time(NULL)); - g_free(buf); - } - } - - } else - purple_debug_warning("msn", "SLP SessionReq with unknown EUF-GUID: %s\n", euf_guid); - - if (!accepted) { - char *content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - send_decline(slpcall, branch, "application/x-msnmsgr-sessionreqbody", content); - g_free(content); - } -} - -void -send_bye(MsnSlpCall *slpcall, const char *type) -{ - MsnSlpLink *slplink; - PurpleAccount *account; - MsnSlpMessage *slpmsg; - char *header; - - slplink = slpcall->slplink; - - g_return_if_fail(slplink != NULL); - - account = slplink->session->account; - - header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0", - purple_account_get_username(account)); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, - "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32", - type, - "\r\n"); - g_free(header); - - slpmsg->info = "SLP BYE"; - slpmsg->text_body = TRUE; - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -static void -got_invite(MsnSlpCall *slpcall, - const char *branch, const char *type, const char *content) -{ - MsnSlpLink *slplink; - - slplink = slpcall->slplink; - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { - char *euf_guid, *context; - char *temp; - - euf_guid = get_token(content, "EUF-GUID: {", "}\r\n"); - - temp = get_token(content, "SessionID: ", "\r\n"); - if (temp != NULL) - slpcall->session_id = atoi(temp); - g_free(temp); - - temp = get_token(content, "AppID: ", "\r\n"); - if (temp != NULL) - slpcall->app_id = atoi(temp); - g_free(temp); - - context = get_token(content, "Context: ", "\r\n"); - - if (context != NULL) - got_sessionreq(slpcall, branch, euf_guid, context); - - g_free(context); - g_free(euf_guid); - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* A direct connection? */ - - char *listening, *nonce; - char *content; - - if (FALSE) - { -#if 0 - MsnDirectConn *directconn; - /* const char *ip_addr; */ - char *ip_port; - int port; - - /* ip_addr = purple_prefs_get_string("/purple/ft/public_ip"); */ - ip_port = "5190"; - listening = "true"; - nonce = rand_guid(); - - directconn = msn_directconn_new(slplink); - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - msn_directconn_listen(directconn); - - port = directconn->port; - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "Ipv4Internal-Addrs: 192.168.0.82\r\n" - "Ipv4Internal-Port: %d\r\n" - "\r\n", - listening, - nonce, - port); -#endif - } - else - { - listening = "false"; - nonce = g_strdup("00000000-0000-0000-0000-000000000000"); - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "\r\n", - listening, - nonce); - } - - send_ok(slpcall, branch, - "application/x-msnmsgr-transrespbody", content); - - g_free(content); - g_free(nonce); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - if (ip_addrs == NULL) - return; - - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -static void -got_ok(MsnSlpCall *slpcall, - const char *type, const char *content) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(type != NULL); - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { -#if 0 - if (slpcall->type == MSN_SLPCALL_DC) - { - /* First let's try a DirectConnection. */ - - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - char *branch; - - slplink = slpcall->slplink; - - branch = rand_guid(); - - content = g_strdup_printf( - "Bridges: TRUDPv1 TCPv1\r\n" - "NetID: 0\r\n" - "Conn-Type: Direct-Connect\r\n" - "UPnPNat: false\r\n" - "ICF: false\r\n" - ); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch, - "application/x-msnmsgr-transreqbody", - content); - - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); - - g_free(branch); - } - else - { - msn_slpcall_session_init(slpcall); - } -#else - msn_slpcall_session_init(slpcall); -#endif - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* Do we get this? */ - purple_debug_info("msn", "OK with transreqbody\n"); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - if (ip_addrs == NULL) - return; - - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -MsnSlpCall * -msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) -{ - MsnSlpCall *slpcall; - - if (body == NULL) - { - purple_debug_warning("msn", "received bogus message\n"); - return NULL; - } - - if (!strncmp(body, "INVITE", strlen("INVITE"))) - { - char *branch; - char *content; - char *content_type; - - slpcall = msn_slpcall_new(slplink); - - /* From: */ -#if 0 - slpcall->remote_user = get_token(body, "From: \r\n"); -#endif - - branch = get_token(body, ";branch={", "}"); - - slpcall->id = get_token(body, "Call-ID: {", "}"); - -#if 0 - long content_len = -1; - - temp = get_token(body, "Content-Length: ", "\r\n"); - if (temp != NULL) - content_len = atoi(temp); - g_free(temp); -#endif - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - if (branch && content_type && content) - { - got_invite(slpcall, branch, content_type, content); - } - else - { - msn_slpcall_destroy(slpcall); - slpcall = NULL; - } - - g_free(branch); - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 "))) - { - char *content; - char *content_type; - /* Make sure this is "OK" */ - const char *status = body + strlen("MSNSLP/1.0 "); - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - g_return_val_if_fail(slpcall != NULL, NULL); - - if (strncmp(status, "200 OK", 6)) - { - /* It's not valid. Kill this off. */ - char temp[32]; - const char *c; - - /* Eww */ - if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) || - (c = strchr(status, '\0'))) - { - size_t offset = c - status; - if (offset >= sizeof(temp)) - offset = sizeof(temp) - 1; - - strncpy(temp, status, offset); - temp[offset] = '\0'; - } - - purple_debug_error("msn", "Received non-OK result: %s\n", temp); - - slpcall->wasted = TRUE; - - /* msn_slpcall_destroy(slpcall); */ - return slpcall; - } - - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - got_ok(slpcall, content_type, content); - - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "BYE", strlen("BYE"))) - { - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - if (slpcall != NULL) - slpcall->wasted = TRUE; - - /* msn_slpcall_destroy(slpcall); */ - } - else - slpcall = NULL; - - return slpcall; -} - -/************************************************************************** - * Msg Callbacks - **************************************************************************/ - -void -msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - - session = cmdproc->servconn->session; - slplink = msn_session_get_slplink(session, msg->remote_user); - - if (slplink->swboard == NULL) - { - /* - * We will need swboard in order to change its flags. If its - * NULL, something has probably gone wrong earlier on. I - * didn't want to do this, but MSN 7 is somehow causing us - * to crash here, I couldn't reproduce it to debug more, - * and people are reporting bugs. Hopefully this doesn't - * cause more crashes. Stu. - */ - if (cmdproc->data == NULL) - g_warning("msn_p2p_msg cmdproc->data was NULL\n"); - else { - slplink->swboard = (MsnSwitchBoard *)cmdproc->data; - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - } - - msn_slplink_process_msg(slplink, msg); -} - -static void -got_emoticon(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - PurpleConversation *conv; - MsnSwitchBoard *swboard; - - swboard = slpcall->slplink->swboard; - conv = swboard->conv; - - if (conv) { - /* FIXME: it would be better if we wrote the data as we received it - instead of all at once, calling write multiple times and - close once at the very end - */ - purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); - purple_conv_custom_smiley_close(conv, slpcall->data_info ); - } - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); -} - -void -msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - MsnSwitchBoard *swboard; - MsnObject *obj; - char **tokens; - char *smile, *body_str; - const char *body, *who, *sha1; - guint tok; - size_t body_len; - - PurpleConversation *conv; - - session = cmdproc->servconn->session; - - if (!purple_account_get_bool(session->account, "custom_smileys", TRUE)) - return; - - swboard = cmdproc->data; - conv = swboard->conv; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - - /* MSN Messenger 7 may send more than one MSNObject in a single message... - * Maybe 10 tokens is a reasonable max value. */ - tokens = g_strsplit(body_str, "\t", 10); - - g_free(body_str); - - for (tok = 0; tok < 9; tok += 2) { - if (tokens[tok] == NULL || tokens[tok + 1] == NULL) { - break; - } - - smile = tokens[tok]; - obj = msn_object_new_from_string(purple_url_decode(tokens[tok + 1])); - - if (obj == NULL) - break; - - who = msn_object_get_creator(obj); - sha1 = msn_object_get_sha1(obj); - - slplink = msn_session_get_slplink(session, who); - if (slplink->swboard != swboard) { - if (slplink->swboard != NULL) - /* - * Apparently we're using a different switchboard now or - * something? I don't know if this is normal, but it - * definitely happens. So make sure the old switchboard - * doesn't still have a reference to us. - */ - slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); - slplink->swboard = swboard; - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - - /* If the conversation doesn't exist then this is a custom smiley - * used in the first message in a MSN conversation: we need to create - * the conversation now, otherwise the custom smiley won't be shown. - * This happens because every GtkIMHtml has its own smiley tree: if - * the conversation doesn't exist then we cannot associate the new - * smiley with its GtkIMHtml widget. */ - if (!conv) { - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, who); - } - - if (purple_conv_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) { - msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); - } - - msn_object_destroy(obj); - obj = NULL; - who = NULL; - sha1 = NULL; - } - g_strfreev(tokens); -} - -static gboolean -buddy_icon_cached(PurpleConnection *gc, MsnObject *obj) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - const char *old; - const char *new; - - g_return_val_if_fail(obj != NULL, FALSE); - - account = purple_connection_get_account(gc); - - buddy = purple_find_buddy(account, msn_object_get_creator(obj)); - if (buddy == NULL) - return FALSE; - - old = purple_buddy_icons_get_checksum_for_user(buddy); - new = msn_object_get_sha1(obj); - - if (new == NULL) - return FALSE; - - /* If the old and new checksums are the same, and the file actually exists, - * then return TRUE */ - if (old != NULL && !strcmp(old, new)) - return TRUE; - - return FALSE; -} - -static void -msn_release_buddy_icon_request(MsnUserList *userlist) -{ - MsnUser *user; - - g_return_if_fail(userlist != NULL); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Releasing buddy icon request\n"); - - if (userlist->buddy_icon_window > 0) - { - GQueue *queue; - PurpleAccount *account; - const char *username; - - queue = userlist->buddy_icon_requests; - - if (g_queue_is_empty(userlist->buddy_icon_requests)) - return; - - user = g_queue_pop_head(queue); - - account = userlist->session->account; - username = user->passport; - - userlist->buddy_icon_window--; - request_user_display(user); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", - "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", - userlist->buddy_icon_window); - } -} - -/* - * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next - * buddy icon request if there is one. - */ -static gboolean -msn_release_buddy_icon_request_timeout(gpointer data) -{ - MsnUserList *userlist = (MsnUserList *)data; - - /* Free one window slot */ - userlist->buddy_icon_window++; - - /* Clear the tag for our former request timer */ - userlist->buddy_icon_request_timer = 0; - - msn_release_buddy_icon_request(userlist); - - return FALSE; -} - -void -msn_queue_buddy_icon_request(MsnUser *user) -{ - PurpleAccount *account; - MsnObject *obj; - GQueue *queue; - - g_return_if_fail(user != NULL); - - account = user->userlist->session->account; - - obj = msn_user_get_object(user); - - if (obj == NULL) - { - purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); - return; - } - - if (!buddy_icon_cached(account->gc, obj)) - { - MsnUserList *userlist; - - userlist = user->userlist; - queue = userlist->buddy_icon_requests; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", - user->passport, userlist->buddy_icon_window); - - g_queue_push_tail(queue, user); - - if (userlist->buddy_icon_window > 0) - msn_release_buddy_icon_request(userlist); - } -} - -static void -got_user_display(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - MsnUserList *userlist; - const char *info; - PurpleAccount *account; - - g_return_if_fail(slpcall != NULL); - - info = slpcall->data_info; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); - - userlist = slpcall->slplink->session->userlist; - account = slpcall->slplink->session->account; - - purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, - g_memdup(data, size), size, info); - -#if 0 - /* Free one window slot */ - userlist->buddy_icon_window++; - - purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n", - userlist->buddy_icon_window); - - msn_release_buddy_icon_request(userlist); -#endif -} - -static void -end_user_display(MsnSlpCall *slpcall, MsnSession *session) -{ - MsnUserList *userlist; - - g_return_if_fail(session != NULL); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "End User Display\n"); - - userlist = session->userlist; - - /* If the session is being destroyed we better stop doing anything. */ - if (session->destroying) - return; - - /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. - * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will - * send us an error 800 like so: - * - * C: NS 000: XFR 21 SB - * S: NS 000: 800 21 - */ - if (userlist->buddy_icon_request_timer) { - /* Free the window slot used by this previous request */ - userlist->buddy_icon_window++; - - /* Clear our pending timeout */ - purple_timeout_remove(userlist->buddy_icon_request_timer); - } - - /* Wait BUDDY_ICON_DELAY s before freeing our window slot and requesting the next icon. */ - userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, - msn_release_buddy_icon_request_timeout, userlist); -} - -static void -request_user_display(MsnUser *user) -{ - PurpleAccount *account; - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *info; - - session = user->userlist->session; - account = session->account; - - slplink = msn_session_get_slplink(session, user->passport); - - obj = msn_user_get_object(user); - - info = msn_object_get_sha1(obj); - - if (g_ascii_strcasecmp(user->passport, - purple_account_get_username(account))) - { - msn_slplink_request_object(slplink, info, got_user_display, - end_user_display, obj); - } - else - { - MsnObject *my_obj = NULL; - gconstpointer data = NULL; - size_t len = 0; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Requesting our own user display\n"); - - my_obj = msn_user_get_object(session->user); - - if (my_obj != NULL) - { - PurpleStoredImage *img = msn_object_get_image(my_obj); - data = purple_imgstore_get_data(img); - len = purple_imgstore_get_size(img); - } - - purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info); - - /* Free one window slot */ - session->userlist->buddy_icon_window++; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n", - session->userlist->buddy_icon_window); - - msn_release_buddy_icon_request(session->userlist); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,298 +0,0 @@ -/** - * @file slpcall.c SLP Call Functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msnutils.h" -#include "slpcall.h" - -#include "slp.h" - -/************************************************************************** - * Main - **************************************************************************/ - -static gboolean -msn_slpcall_timeout(gpointer data) -{ - MsnSlpCall *slpcall; - - slpcall = data; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); - - if (!slpcall->pending && !slpcall->progress) - { - msn_slpcall_destroy(slpcall); - return TRUE; - } - - slpcall->progress = FALSE; - - return TRUE; -} - -MsnSlpCall * -msn_slpcall_new(MsnSlpLink *slplink) -{ - MsnSlpCall *slpcall; - - g_return_val_if_fail(slplink != NULL, NULL); - - slpcall = g_new0(MsnSlpCall, 1); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); - - slpcall->slplink = slplink; - - msn_slplink_add_slpcall(slplink, slpcall); - - slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slpcall_timeout, slpcall); - - return slpcall; -} - -void -msn_slpcall_destroy(MsnSlpCall *slpcall) -{ - GList *e; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); - - g_return_if_fail(slpcall != NULL); - - if (slpcall->timer) - purple_timeout_remove(slpcall->timer); - - for (e = slpcall->slplink->slp_msgs; e != NULL; ) - { - MsnSlpMessage *slpmsg = e->data; - e = e->next; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", - slpmsg); - - if (slpmsg->slpcall == slpcall) - { - msn_slpmsg_destroy(slpmsg); - } - } - - if (slpcall->end_cb != NULL) - slpcall->end_cb(slpcall, slpcall->slplink->session); - - if (slpcall->xfer != NULL) { - slpcall->xfer->data = NULL; - purple_xfer_unref(slpcall->xfer); - } - - msn_slplink_remove_slpcall(slpcall->slplink, slpcall); - - g_free(slpcall->id); - g_free(slpcall->branch); - g_free(slpcall->data_info); - - g_free(slpcall); -} - -void -msn_slpcall_init(MsnSlpCall *slpcall, MsnSlpCallType type) -{ - slpcall->session_id = rand() % 0xFFFFFF00 + 4; - slpcall->id = rand_guid(); - slpcall->type = type; -} - -void -msn_slpcall_session_init(MsnSlpCall *slpcall) -{ - if (slpcall->session_init_cb) - slpcall->session_init_cb(slpcall); - - slpcall->started = TRUE; -} - -void -msn_slpcall_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - - g_return_if_fail(slpcall != NULL); - g_return_if_fail(context != NULL); - - slplink = slpcall->slplink; - - slpcall->branch = rand_guid(); - - content = g_strdup_printf( - "EUF-GUID: {%s}\r\n" - "SessionID: %lu\r\n" - "AppID: %d\r\n" - "Context: %s\r\n\r\n", - euf_guid, - slpcall->session_id, - app_id, - context); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, - "application/x-msnmsgr-sessionreqbody", content); - - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; - - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); -} - -void -msn_slpcall_close(MsnSlpCall *slpcall) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(slpcall->slplink != NULL); - - send_bye(slpcall, "application/x-msnmsgr-sessionclosebody"); - msn_slplink_send_queued_slpmsgs(slpcall->slplink); - msn_slpcall_destroy(slpcall); -} - -MsnSlpCall * -msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnSlpCall *slpcall; - const guchar *body; - gsize body_len; - - slpcall = NULL; - body = slpmsg->buffer; - body_len = slpmsg->size; - - if (slpmsg->flags == 0x0 || slpmsg->flags == 0x1000000) - { - char *body_str; - - if (slpmsg->session_id == 64) - { - /* This is for handwritten messages (Ink) */ - GError *error = NULL; - gsize bytes_read, bytes_written; - - body_str = g_convert((const gchar *)body, body_len / 2, - "UTF-8", "UTF-16LE", - &bytes_read, &bytes_written, &error); - body_len -= bytes_read + 2; - body += bytes_read + 2; - if (body_str == NULL - || body_len <= 0 - || strstr(body_str, "image/gif") == NULL) - { - if (error != NULL) { - purple_debug_error("msn", - "Unable to convert Ink header from UTF-16 to UTF-8: %s\n", - error->message); - g_error_free(error); - } - else - purple_debug_error("msn", - "Received Ink in unknown format\n"); - g_free(body_str); - return NULL; - } - g_free(body_str); - - body_str = g_convert((const gchar *)body, body_len / 2, - "UTF-8", "UTF-16LE", - &bytes_read, &bytes_written, &error); - if (!body_str) - { - if (error != NULL) { - purple_debug_error("msn", - "Unable to convert Ink body from UTF-16 to UTF-8: %s\n", - error->message); - g_error_free(error); - } - else - purple_debug_error("msn", - "Received Ink in unknown format\n"); - return NULL; - } - - msn_switchboard_show_ink(slpmsg->slplink->swboard, - slplink->remote_user, - body_str); - } - else - { - body_str = g_strndup((const char *)body, body_len); - slpcall = msn_slp_sip_recv(slplink, body_str); - } - g_free(body_str); - } - else if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) - { - slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpcall != NULL) - { - if (slpcall->timer) { - purple_timeout_remove(slpcall->timer); - slpcall->timer = 0; - } - - slpcall->cb(slpcall, body, body_len); - - slpcall->wasted = TRUE; - } - } -#if 0 - else if (slpmsg->flags == 0x100) - { - slpcall = slplink->directconn->initial_call; - - if (slpcall != NULL) - msn_slpcall_session_init(slpcall); - } -#endif - else if (slpmsg->flags == 0x2) - { - /* Acknowledgement of previous message. Don't do anything currently. */ - } - else - purple_debug_warning("msn", "Unprocessed SLP message with flags 0x%08lx\n", - slpmsg->flags); - - return slpcall; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpcall.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/** - * @file slpcall.h SLP Call functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPCALL_H_ -#define _MSN_SLPCALL_H_ - -#include "internal.h" -#include "ft.h" - -typedef struct _MsnSlpCall MsnSlpCall; - -#include "slplink.h" - -/* The official client seems to timeout slp calls after 5 minutes */ -#define MSN_SLPCALL_TIMEOUT 300 - -typedef enum -{ - MSN_SLPCALL_ANY, - MSN_SLPCALL_DC - -} MsnSlpCallType; - -struct _MsnSlpCall -{ - /* Our parent slplink */ - MsnSlpLink *slplink; - - MsnSlpCallType type; - - /* Call-ID */ - char *id; - char *branch; - - long session_id; - long app_id; - - gboolean pending; /**< A flag that states if we should wait for this - slpcall to start and do not time out. */ - gboolean progress; /**< A flag that states if there has been progress since - the last time out. */ - gboolean wasted; /**< A flag that states if this slpcall is going to be - destroyed. */ - gboolean started; /**< A flag that states if this slpcall's session has - been initiated. */ - - void (*progress_cb)(MsnSlpCall *slpcall, - gsize total_length, gsize len, gsize offset); - void (*session_init_cb)(MsnSlpCall *slpcall); - - /* Can be checksum, or smile */ - char *data_info; - - PurpleXfer *xfer; - - MsnSlpCb cb; - void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session); - - guint timer; -}; - -MsnSlpCall *msn_slpcall_new(MsnSlpLink *slplink); -void msn_slpcall_init(MsnSlpCall *slpcall, MsnSlpCallType type); -void msn_slpcall_session_init(MsnSlpCall *slpcall); -void msn_slpcall_destroy(MsnSlpCall *slpcall); -void msn_slpcall_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context); -void msn_slpcall_close(MsnSlpCall *slpcall); - -#endif /* _MSN_SLPCALL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file slp.h MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLP_H_ -#define _MSN_SLP_H_ - -#include "slpcall.h" -#include "session.h" -#include "internal.h" -#include "ft.h" - -void msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize - len, gsize offset); - -MsnSlpCall * msn_slp_sip_recv(MsnSlpLink *slplink, - const char *body); - -void send_bye(MsnSlpCall *slpcall, const char *type); - -void msn_xfer_completed_cb(MsnSlpCall *slpcall, - const guchar *body, gsize size); - -void msn_xfer_cancel(PurpleXfer *xfer); -void msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session); - -void msn_queue_buddy_icon_request(MsnUser *user); - -#endif /* _MSN_SLP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,781 +0,0 @@ -/** - * @file slplink.c MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slplink.h" - -#include "switchboard.h" -#include "slp.h" - -#ifdef MSN_DEBUG_SLP_FILES -static int m_sc = 0; -static int m_rc = 0; - -static void -debug_msg_to_file(MsnMessage *msg, gboolean send) -{ - char *tmp; - char *dir; - char *pload; - int c; - gsize pload_size; - - dir = send ? "send" : "recv"; - c = send ? m_sc++ : m_rc++; - tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c); - pload = msn_message_gen_payload(msg, &pload_size); - if (!purple_util_write_data_to_file_absolute(tmp, pload, pload_size)) - { - purple_debug_error("msn", "could not save debug file\n"); - } - g_free(tmp); -} -#endif - -/************************************************************************** - * Main - **************************************************************************/ - -static MsnSlpLink * -msn_slplink_new(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - - slplink = g_new0(MsnSlpLink, 1); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); - - slplink->session = session; - slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; - - slplink->remote_user = g_strdup(username); - - slplink->slp_msg_queue = g_queue_new(); - - session->slplinks = - g_list_append(session->slplinks, slplink); - - return slplink; -} - -void -msn_slplink_destroy(MsnSlpLink *slplink) -{ - MsnSession *session; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); - - g_return_if_fail(slplink != NULL); - - if (slplink->swboard != NULL) - slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); - - session = slplink->session; - -#if 0 - if (slplink->directconn != NULL) - msn_directconn_destroy(slplink->directconn); -#endif - - while (slplink->slp_calls != NULL) - msn_slpcall_destroy(slplink->slp_calls->data); - - g_queue_free(slplink->slp_msg_queue); - - session->slplinks = - g_list_remove(session->slplinks, slplink); - - g_free(slplink->remote_user); - - g_free(slplink); -} - -MsnSlpLink * -msn_session_find_slplink(MsnSession *session, const char *who) -{ - GList *l; - - for (l = session->slplinks; l != NULL; l = l->next) - { - MsnSlpLink *slplink; - - slplink = l->data; - - if (!strcmp(slplink->remote_user, who)) - return slplink; - } - - return NULL; -} - -MsnSlpLink * -msn_session_get_slplink(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - slplink = msn_session_find_slplink(session, username); - - if (slplink == NULL) - slplink = msn_slplink_new(session, username); - - return slplink; -} - -void -msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - if (slplink->swboard != NULL) - slplink->swboard->flag |= MSN_SB_FLAG_FT; - - slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); -} - -void -msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall); - - /* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT. - * If nothing else is using it then this might cause swboard to be - * destroyed. */ - if (slplink->slp_calls == NULL && slplink->swboard != NULL) - msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT); -} - -MsnSlpCall * -msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id) -{ - GList *l; - MsnSlpCall *slpcall; - - if (!id) - return NULL; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->id && !strcmp(slpcall->id, id)) - return slpcall; - } - - return NULL; -} - -MsnSlpCall * -msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id) -{ - GList *l; - MsnSlpCall *slpcall; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->session_id == id) - return slpcall; - } - - return NULL; -} - -static void -msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ -#if 0 - if (slplink->directconn != NULL) - { - msn_directconn_send_msg(slplink->directconn, msg); - } - else -#endif - { - if (slplink->swboard == NULL) - { - slplink->swboard = msn_session_get_swboard(slplink->session, - slplink->remote_user, MSN_SB_FLAG_FT); - - g_return_if_fail(slplink->swboard != NULL); - - /* If swboard is destroyed we will be too */ - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - - msn_switchboard_send_msg(slplink->swboard, msg, TRUE); - } -} - -static void -msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - long long real_size; - size_t len = 0; - - /* Maybe we will want to create a new msg for this slpmsg instead of - * reusing the same one all the time. */ - msg = slpmsg->msg; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - if (slpmsg->offset < real_size) - { - if (slpmsg->fp) - { - char data[1202]; - len = fread(data, 1, sizeof(data), slpmsg->fp); - msn_message_set_bin_data(msg, data, len); - } - else - { - len = slpmsg->size - slpmsg->offset; - - if (len > 1202) - len = 1202; - - msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len); - } - - msg->msnslp_header.offset = slpmsg->offset; - msg->msnslp_header.length = len; - } - - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, TRUE); -#endif - - slpmsg->msgs = - g_list_append(slpmsg->msgs, msg); - msn_slplink_send_msg(slplink, msg); - - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, slpmsg->offset); - } - } - - /* slpmsg->offset += len; */ -} - -/* We have received the message ack */ -static void -msg_ack(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - long long real_size; - - slpmsg = data; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - slpmsg->offset += msg->msnslp_header.length; - - if (slpmsg->offset < real_size) - { - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - } - else - { - /* The whole message has been sent */ - if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) - { - if (slpmsg->slpcall != NULL) - { - if (slpmsg->slpcall->cb) - slpmsg->slpcall->cb(slpmsg->slpcall, - NULL, 0); - } - } - } - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -/* We have received the message nak. */ -static void -msg_nak(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - - slpmsg = data; - - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -static void -msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - - slpmsg->msg = msg = msn_message_new_msnslp(); - - if (slpmsg->flags == 0x0) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x2) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - } - else if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) - { - MsnSlpCall *slpcall; - slpcall = slpmsg->slpcall; - - g_return_if_fail(slpcall != NULL); - msg->msnslp_header.session_id = slpcall->session_id; - msg->msnslp_footer.value = slpcall->app_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x100) - { - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - } - - msg->msnslp_header.id = slpmsg->id; - msg->msnslp_header.flags = slpmsg->flags; - - msg->msnslp_header.total_size = slpmsg->size; - - msn_message_set_attr(msg, "P2P-Dest", slplink->remote_user); - - msg->ack_cb = msg_ack; - msg->nak_cb = msg_nak; - msg->ack_data = slpmsg; - - msn_slplink_send_msgpart(slplink, slpmsg); - - msn_message_destroy(msg); -} - -void -msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - g_return_if_fail(slpmsg != NULL); - - slpmsg->id = slplink->slp_seq_id++; - - g_queue_push_tail(slplink->slp_msg_queue, slpmsg); -} - -void -msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - slpmsg->id = slplink->slp_seq_id++; - - msn_slplink_release_slpmsg(slplink, slpmsg); -} - -void -msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - /* Send the queued msgs in the order they were created */ - while ((slpmsg = g_queue_pop_head(slplink->slp_msg_queue)) != NULL) - { - msn_slplink_release_slpmsg(slplink, slpmsg); - } -} - -static void -msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - - slpmsg = msn_slpmsg_new(slplink); - - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = 0x02; - slpmsg->ack_id = msg->msnslp_header.id; - slpmsg->ack_sub_id = msg->msnslp_header.ack_id; - slpmsg->ack_size = msg->msnslp_header.total_size; - slpmsg->info = "SLP ACK"; - - msn_slplink_send_slpmsg(slplink, slpmsg); - msn_slpmsg_destroy(slpmsg); -} - -static void -send_file_cb(MsnSlpCall *slpcall) -{ - MsnSlpMessage *slpmsg; - struct stat st; - PurpleXfer *xfer; - - slpmsg = msn_slpmsg_new(slpcall->slplink); - slpmsg->slpcall = slpcall; - slpmsg->flags = 0x1000030; - slpmsg->info = "SLP FILE"; - - xfer = (PurpleXfer *)slpcall->xfer; - purple_xfer_start(slpcall->xfer, -1, NULL, 0); - slpmsg->fp = xfer->dest_fp; - if (g_stat(purple_xfer_get_local_filename(xfer), &st) == 0) - slpmsg->size = st.st_size; - xfer->dest_fp = NULL; /* Disable double fclose() */ - - msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); -} - -static MsnSlpMessage * -msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) -{ - GList *e; - - for (e = slplink->slp_msgs; e != NULL; e = e->next) - { - MsnSlpMessage *slpmsg = e->data; - - if ((slpmsg->session_id == session_id) && (slpmsg->id == id)) - return slpmsg; - } - - return NULL; -} - -void -msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - const char *data; - guint64 offset; - gsize len; - - if (purple_debug_is_verbose()) - msn_slpmsg_show(msg); - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, FALSE); -#endif - - if (msg->msnslp_header.total_size < msg->msnslp_header.length) - { - purple_debug_error("msn", "This can't be good\n"); - g_return_if_reached(); - } - - data = msn_message_get_bin_data(msg, &len); - - offset = msg->msnslp_header.offset; - - if (offset == 0) - { - slpmsg = msn_slpmsg_new(slplink); - slpmsg->id = msg->msnslp_header.id; - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = msg->msnslp_header.flags; - - if (slpmsg->session_id) - { - if (slpmsg->slpcall == NULL) - slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpmsg->slpcall != NULL) - { - if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) - { - PurpleXfer *xfer; - - xfer = slpmsg->slpcall->xfer; - - if (xfer != NULL) - { - purple_xfer_ref(xfer); - purple_xfer_start(xfer, -1, NULL, 0); - - if (xfer->data == NULL) { - purple_xfer_unref(xfer); - msn_slpmsg_destroy(slpmsg); - g_return_if_reached(); - } else { - purple_xfer_unref(xfer); - slpmsg->fp = xfer->dest_fp; - xfer->dest_fp = NULL; /* Disable double fclose() */ - } - } - } - } - } - if (!slpmsg->fp && slpmsg->size) - { - slpmsg->buffer = g_try_malloc(slpmsg->size); - if (slpmsg->buffer == NULL) - { - purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); - msn_slpmsg_destroy(slpmsg); - return; - } - } - } - else - { - slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.session_id, msg->msnslp_header.id); - if (slpmsg == NULL) - { - /* Probably the transfer was canceled */ - purple_debug_error("msn", "Couldn't find slpmsg\n"); - return; - } - } - - if (slpmsg->fp) - { - /* fseek(slpmsg->fp, offset, SEEK_SET); */ - len = fwrite(data, 1, len, slpmsg->fp); - } - else if (slpmsg->size && slpmsg->buffer) - { - if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size) - { - purple_debug_error("msn", - "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", - slpmsg->size, offset, len); - g_return_if_reached(); - } - else - memcpy(slpmsg->buffer + offset, data, len); - } - - if ((slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, offset); - } - } - -#if 0 - if (slpmsg->buffer == NULL) - return; -#endif - - if (msg->msnslp_header.offset + msg->msnslp_header.length - >= msg->msnslp_header.total_size) - { - /* All the pieces of the slpmsg have been received */ - MsnSlpCall *slpcall; - - slpcall = msn_slp_process_msg(slplink, slpmsg); - - if (slpmsg->flags == 0x100) - { - MsnDirectConn *directconn; - - directconn = slplink->directconn; -#if 0 - if (!directconn->acked) - msn_directconn_send_handshake(directconn); -#endif - } - else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 || - slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) - { - /* Release all the messages and send the ACK */ - - msn_slplink_send_ack(slplink, msg); - msn_slplink_send_queued_slpmsgs(slplink); - } - - msn_slpmsg_destroy(slpmsg); - - if (slpcall != NULL && slpcall->wasted) - msn_slpcall_destroy(slpcall); - } -} - -typedef struct -{ - guint32 length; - guint32 unk1; - guint32 file_size; - guint32 unk2; - guint32 unk3; -} MsnContextHeader; - -#define MAX_FILE_NAME_LEN 0x226 - -static gchar * -gen_context(const char *file_name, const char *file_path) -{ - struct stat st; - gsize size = 0; - MsnContextHeader header; - gchar *u8 = NULL; - guchar *base; - guchar *n; - gchar *ret; - gunichar2 *uni = NULL; - glong currentChar = 0; - glong uni_len = 0; - gsize len; - - if (g_stat(file_path, &st) == 0) - size = st.st_size; - - if(!file_name) { - gchar *basename = g_path_get_basename(file_path); - u8 = purple_utf8_try_convert(basename); - g_free(basename); - file_name = u8; - } - - uni = g_utf8_to_utf16(file_name, -1, NULL, &uni_len, NULL); - - if(u8) { - g_free(u8); - file_name = NULL; - u8 = NULL; - } - - len = sizeof(MsnContextHeader) + MAX_FILE_NAME_LEN + 4; - - header.length = GUINT32_TO_LE(len); - header.unk1 = GUINT32_TO_LE(2); - header.file_size = GUINT32_TO_LE(size); - header.unk2 = GUINT32_TO_LE(0); - header.unk3 = GUINT32_TO_LE(0); - - base = g_malloc(len + 1); - n = base; - - memcpy(n, &header, sizeof(MsnContextHeader)); - n += sizeof(MsnContextHeader); - - memset(n, 0x00, MAX_FILE_NAME_LEN); - for(currentChar = 0; currentChar < uni_len; currentChar++) { - *((gunichar2 *)n + currentChar) = GUINT16_TO_LE(uni[currentChar]); - } - n += MAX_FILE_NAME_LEN; - - memset(n, 0xFF, 4); - n += 4; - - g_free(uni); - ret = purple_base64_encode(base, len); - g_free(base); - return ret; -} - -void -msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *context; - const char *fn; - const char *fp; - - fn = purple_xfer_get_filename(xfer); - fp = purple_xfer_get_local_filename(xfer); - - g_return_if_fail(slplink != NULL); - g_return_if_fail(fp != NULL); - - slpcall = msn_slpcall_new(slplink); - msn_slpcall_init(slpcall, MSN_SLPCALL_DC); - - slpcall->session_init_cb = send_file_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->progress_cb = msn_xfer_progress_cb; - slpcall->cb = msn_xfer_completed_cb; - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - slpcall->pending = TRUE; - - purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); - - xfer->data = slpcall; - - context = gen_context(fn, fp); - - msn_slpcall_invite(slpcall, MSN_FT_GUID, 2, context); - - g_free(context); -} - -void -msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj) -{ - MsnSlpCall *slpcall; - char *msnobj_data; - char *msnobj_base64; - - g_return_if_fail(slplink != NULL); - g_return_if_fail(obj != NULL); - - msnobj_data = msn_object_to_string(obj); - msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); - g_free(msnobj_data); - - slpcall = msn_slpcall_new(slplink); - msn_slpcall_init(slpcall, MSN_SLPCALL_ANY); - - slpcall->data_info = g_strdup(info); - slpcall->cb = cb; - slpcall->end_cb = end_cb; - - msn_slpcall_invite(slpcall, MSN_OBJ_GUID, 1, msnobj_base64); - - g_free(msnobj_base64); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slplink.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -/** - * @file slplink.h MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPLINK_H_ -#define _MSN_SLPLINK_H_ - -typedef struct _MsnSlpLink MsnSlpLink; - -#include "directconn.h" -#include "slpcall.h" -#include "slpmsg.h" - -#include "switchboard.h" - -#include "ft.h" - -#include "session.h" - -typedef void (*MsnSlpCb)(MsnSlpCall *slpcall, - const guchar *data, gsize size); -typedef void (*MsnSlpEndCb)(MsnSlpCall *slpcall, MsnSession *session); - -struct _MsnSlpLink -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - char *remote_user; - - int slp_seq_id; - - MsnDirectConn *directconn; - - GList *slp_calls; - GList *slp_msgs; - - GQueue *slp_msg_queue; -}; - -void msn_slplink_destroy(MsnSlpLink *slplink); - -/** - * @return An MsnSlpLink for the given user, or NULL if there is no - * existing MsnSlpLink. - */ -MsnSlpLink *msn_session_find_slplink(MsnSession *session, - const char *who); - -/** - * @return An MsnSlpLink for the given user. One will be created if - * it does not already exist. - */ -MsnSlpLink *msn_session_get_slplink(MsnSession *session, const char *username); - -void msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -void msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink, - const char *id); -MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id); -void msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); -void msn_slplink_send_slpmsg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink); -void msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg); -void msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer); - -void msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj); - -MsnSlpCall *msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -#endif /* _MSN_SLPLINK_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,211 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slpmsg.h" -#include "slplink.h" - -/************************************************************************** - * SLP Message - **************************************************************************/ - -MsnSlpMessage * -msn_slpmsg_new(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - slpmsg = g_new0(MsnSlpMessage, 1); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); - - slpmsg->slplink = slplink; - - slplink->slp_msgs = - g_list_append(slplink->slp_msgs, slpmsg); - - return slpmsg; -} - -void -msn_slpmsg_destroy(MsnSlpMessage *slpmsg) -{ - MsnSlpLink *slplink; - GList *cur; - - g_return_if_fail(slpmsg != NULL); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); - - slplink = slpmsg->slplink; - - if (slpmsg->fp != NULL) - fclose(slpmsg->fp); - - purple_imgstore_unref(slpmsg->img); - - /* We don't want to free the data of the PurpleStoredImage, - * but to avoid code duplication, it's sharing buffer. */ - if (slpmsg->img == NULL) - g_free(slpmsg->buffer); - - for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) - { - /* Something is pointing to this slpmsg, so we should remove that - * pointer to prevent a crash. */ - /* Ex: a user goes offline and after that we receive an ACK */ - - MsnMessage *msg = cur->data; - - msg->ack_cb = NULL; - msg->nak_cb = NULL; - msg->ack_data = NULL; - } - g_list_free(slpmsg->msgs); - - slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); - - g_free(slpmsg); -} - -void -msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - if (body != NULL) - slpmsg->buffer = g_memdup(body, size); - else - slpmsg->buffer = g_new0(guchar, size); - - slpmsg->size = size; -} - -void -msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - slpmsg->img = purple_imgstore_ref(img); - slpmsg->buffer = (guchar *)purple_imgstore_get_data(img); - slpmsg->size = purple_imgstore_get_size(img); -} - -void -msn_slpmsg_show(MsnMessage *msg) -{ - const char *info; - gboolean text; - guint32 flags; - - text = FALSE; - - flags = GUINT32_TO_LE(msg->msnslp_header.flags); - - switch (flags) - { - case 0x0: - info = "SLP CONTROL"; - text = TRUE; - break; - case 0x2: - info = "SLP ACK"; break; - case 0x20: - case 0x1000030: - info = "SLP DATA"; break; - default: - info = "SLP UNKNOWN"; break; - } - - msn_message_show_readable(msg, info, text); -} - -MsnSlpMessage * -msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, const char *branch, - const char *content_type, const char *content) -{ - MsnSlpLink *slplink; - PurpleAccount *account; - MsnSlpMessage *slpmsg; - char *body; - gsize body_len; - gsize content_len; - - g_return_val_if_fail(slpcall != NULL, NULL); - g_return_val_if_fail(header != NULL, NULL); - - slplink = slpcall->slplink; - account = slplink->session->account; - - /* Let's remember that "content" should end with a 0x00 */ - - content_len = (content != NULL) ? strlen(content) + 1 : 0; - - body = g_strdup_printf( - "%s\r\n" - "To: \r\n" - "From: \r\n" - "Via: MSNSLP/1.0/TLP ;branch={%s}\r\n" - "CSeq: %d\r\n" - "Call-ID: {%s}\r\n" - "Max-Forwards: 0\r\n" - "Content-Type: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "\r\n", - header, - slplink->remote_user, - purple_account_get_username(account), - branch, - cseq, - slpcall->id, - content_type, - content_len); - - body_len = strlen(body); - - if (content_len > 0) - { - body_len += content_len; - body = g_realloc(body, body_len); - g_strlcat(body, content, body_len); - } - - slpmsg = msn_slpmsg_new(slplink); - msn_slpmsg_set_body(slpmsg, body, body_len); - - slpmsg->sip = TRUE; - slpmsg->slpcall = slpcall; - - g_free(body); - - return slpmsg; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/slpmsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPMSG_H_ -#define _MSN_SLPMSG_H_ - -typedef struct _MsnSlpMessage MsnSlpMessage; - -#include "imgstore.h" - -#include "slpcall.h" -#include "slplink.h" -#include "session.h" -#include "msg.h" - -#include "slp.h" - -/** - * A SLP Message This contains everything that we will need to send a SLP - * Message even if has to be sent in several parts. - */ -struct _MsnSlpMessage -{ - MsnSlpCall *slpcall; /**< The slpcall to which this slp message belongs (if applicable). */ - MsnSlpLink *slplink; /**< The slplink through which this slp message is being sent. */ - MsnSession *session; - - long session_id; - long id; - long ack_id; - long ack_sub_id; - long long ack_size; - - gboolean sip; /**< A flag that states if this is a SIP slp message. */ - long flags; - - FILE *fp; - PurpleStoredImage *img; - guchar *buffer; - long long offset; - long long size; - - GList *msgs; /**< The real messages. */ - -#if 1 - MsnMessage *msg; /**< The temporary real message that will be sent. */ -#endif - - const char *info; - gboolean text_body; -}; - -/** - * Creates a new slp message - * - * @param slplink The slplink through which this slp message will be sent. - * @return The created slp message. - */ -MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink); - -/** - * Destroys a slp message - * - * @param slpmsg The slp message to destory. - */ -void msn_slpmsg_destroy(MsnSlpMessage *slpmsg); - -void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size); -void msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img); -void msn_slpmsg_open_file(MsnSlpMessage *slpmsg, - const char *file_name); -MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, - const char *branch, - const char *content_type, - const char *content); - -void msn_slpmsg_show(MsnMessage *msg); - -#endif /* _MSN_SLPMSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,691 +0,0 @@ -/** - * @file soap.c - * Functions relating to SOAP connections. - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "internal.h" - -#include "soap.h" - -#include "session.h" - -#include "debug.h" -#include "xmlnode.h" - -#include -#if !defined(_WIN32) || !defined(_WINERROR_) -#include -#endif - -#define SOAP_TIMEOUT (5 * 60) - -typedef struct _MsnSoapRequest { - char *path; - MsnSoapMessage *message; - gboolean secure; - MsnSoapCallback cb; - gpointer cb_data; -} MsnSoapRequest; - -typedef struct _MsnSoapConnection { - MsnSession *session; - char *host; - - time_t last_used; - PurpleSslConnection *ssl; - gboolean connected; - - guint event_handle; - guint run_timer; - GString *buf; - gsize handled_len; - gsize body_len; - int response_code; - gboolean headers_done; - gboolean close_when_done; - - MsnSoapMessage *message; - - GQueue *queue; - MsnSoapRequest *current_request; - gboolean unsafe_debug; -} MsnSoapConnection; - -static gboolean msn_soap_connection_run(gpointer data); - -static MsnSoapConnection * -msn_soap_connection_new(MsnSession *session, const char *host) -{ - MsnSoapConnection *conn = g_new0(MsnSoapConnection, 1); - conn->session = session; - conn->host = g_strdup(host); - conn->queue = g_queue_new(); - conn->unsafe_debug = purple_debug_is_unsafe(); - return conn; -} - -static void -msn_soap_message_destroy(MsnSoapMessage *message) -{ - g_slist_foreach(message->headers, (GFunc)g_free, NULL); - g_slist_free(message->headers); - g_free(message->action); - if (message->xml) - xmlnode_free(message->xml); - g_free(message); -} - -static void -msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message) -{ - g_free(req->path); - if (!keep_message) - msn_soap_message_destroy(req->message); - g_free(req); -} - -static void -msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect) -{ - if (conn->event_handle) { - purple_input_remove(conn->event_handle); - conn->event_handle = 0; - } - - if (conn->run_timer) { - purple_timeout_remove(conn->run_timer); - conn->run_timer = 0; - } - - if (conn->message) { - msn_soap_message_destroy(conn->message); - conn->message = NULL; - } - - if (conn->buf) { - g_string_free(conn->buf, TRUE); - conn->buf = NULL; - } - - if (conn->ssl && (disconnect || conn->close_when_done)) { - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - } - - if (conn->current_request) { - msn_soap_request_destroy(conn->current_request, FALSE); - conn->current_request = NULL; - } -} - -static void -msn_soap_connection_destroy_foreach_cb(gpointer item, gpointer data) -{ - MsnSoapRequest *req = item; - - if (req->cb) - req->cb(req->message, NULL, req->cb_data); - - msn_soap_request_destroy(req, FALSE); -} - -static void -msn_soap_connection_destroy(MsnSoapConnection *conn) -{ - if (conn->current_request) { - MsnSoapRequest *req = conn->current_request; - conn->current_request = NULL; - msn_soap_connection_destroy_foreach_cb(req, conn); - } - - msn_soap_connection_sanitize(conn, TRUE); - g_queue_foreach(conn->queue, msn_soap_connection_destroy_foreach_cb, conn); - g_queue_free(conn->queue); - - g_free(conn->host); - g_free(conn); -} - -static gboolean -msn_soap_cleanup_each(gpointer key, gpointer value, gpointer data) -{ - MsnSoapConnection *conn = value; - time_t *t = data; - - if ((*t - conn->last_used) > SOAP_TIMEOUT * 2) { - purple_debug_info("soap", "cleaning up soap conn %p\n", conn); - return TRUE; - } - - return FALSE; -} - -static gboolean -msn_soap_cleanup_for_session(gpointer data) -{ - MsnSession *sess = data; - time_t t = time(NULL); - - purple_debug_info("soap", "session cleanup timeout\n"); - - if (sess->soap_table) { - g_hash_table_foreach_remove(sess->soap_table, msn_soap_cleanup_each, - &t); - - if (g_hash_table_size(sess->soap_table) != 0) - return TRUE; - } - - sess->soap_cleanup_handle = 0; - return FALSE; -} - -static MsnSoapConnection * -msn_soap_get_connection(MsnSession *session, const char *host) -{ - MsnSoapConnection *conn = NULL; - - if (session->soap_table) { - conn = g_hash_table_lookup(session->soap_table, host); - } else { - session->soap_table = g_hash_table_new_full(g_str_hash, g_str_equal, - NULL, (GDestroyNotify)msn_soap_connection_destroy); - } - - if (session->soap_cleanup_handle == 0) - session->soap_cleanup_handle = purple_timeout_add_seconds(SOAP_TIMEOUT, - msn_soap_cleanup_for_session, session); - - if (conn == NULL) { - conn = msn_soap_connection_new(session, host); - g_hash_table_insert(session->soap_table, conn->host, conn); - } - - conn->last_used = time(NULL); - - return conn; -} - -static void -msn_soap_connection_handle_next(MsnSoapConnection *conn) -{ - msn_soap_connection_sanitize(conn, FALSE); - - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn); - - if (conn->current_request) { - MsnSoapRequest *req = conn->current_request; - conn->current_request = NULL; - msn_soap_connection_destroy_foreach_cb(req, conn); - } -} - -static void -msn_soap_message_send_internal(MsnSession *session, MsnSoapMessage *message, - const char *host, const char *path, gboolean secure, - MsnSoapCallback cb, gpointer cb_data, gboolean first) -{ - MsnSoapConnection *conn = msn_soap_get_connection(session, host); - MsnSoapRequest *req = g_new0(MsnSoapRequest, 1); - - req->path = g_strdup(path); - req->message = message; - req->secure = secure; - req->cb = cb; - req->cb_data = cb_data; - - if (first) { - g_queue_push_head(conn->queue, req); - } else { - g_queue_push_tail(conn->queue, req); - } - - if (conn->run_timer == 0) - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, - conn); -} - -void -msn_soap_message_send(MsnSession *session, MsnSoapMessage *message, - const char *host, const char *path, gboolean secure, - MsnSoapCallback cb, gpointer cb_data) -{ - g_return_if_fail(message != NULL); - - msn_soap_message_send_internal(session, message, host, path, secure, - cb, cb_data, FALSE); -} - -static gboolean -msn_soap_handle_redirect(MsnSoapConnection *conn, const char *url) -{ - char *host; - char *path; - - if (purple_url_parse(url, &host, NULL, &path, NULL, NULL)) { - msn_soap_message_send_internal(conn->session, conn->current_request->message, - host, path, conn->current_request->secure, - conn->current_request->cb, conn->current_request->cb_data, TRUE); - - msn_soap_request_destroy(conn->current_request, TRUE); - conn->current_request = NULL; - - g_free(host); - g_free(path); - - return TRUE; - } - - return FALSE; -} - -static gboolean -msn_soap_handle_body(MsnSoapConnection *conn, MsnSoapMessage *response) -{ - xmlnode *body = xmlnode_get_child(response->xml, "Body"); - xmlnode *fault = xmlnode_get_child(response->xml, "Fault"); - - if (fault) { - xmlnode *faultcode = xmlnode_get_child(fault, "faultcode"); - - if (faultcode != NULL) { - char *faultdata = xmlnode_get_data(faultcode); - - if (g_str_equal(faultdata, "psf:Redirect")) { - xmlnode *url = xmlnode_get_child(fault, "redirectUrl"); - - if (url) { - char *urldata = xmlnode_get_data(url); - msn_soap_handle_redirect(conn, urldata); - g_free(urldata); - } - - g_free(faultdata); - msn_soap_message_destroy(response); - return TRUE; - } else if (g_str_equal(faultdata, "wsse:FailedAuthentication")) { - xmlnode *reason = xmlnode_get_child(fault, "faultstring"); - char *reasondata = xmlnode_get_data(reason); - - msn_soap_connection_sanitize(conn, TRUE); - msn_session_set_error(conn->session, MSN_ERROR_AUTH, - reasondata); - - g_free(reasondata); - g_free(faultdata); - msn_soap_message_destroy(response); - return FALSE; - } - - g_free(faultdata); - } - } - - if (fault || body) { - if (conn->current_request) { - MsnSoapRequest *request = conn->current_request; - conn->current_request = NULL; - request->cb(request->message, response, - request->cb_data); - msn_soap_request_destroy(request, FALSE); - } - msn_soap_message_destroy(response); - } - - return TRUE; -} - -static void -msn_soap_message_add_header(MsnSoapMessage *message, - const char *name, const char *value) -{ - char *header = g_strdup_printf("%s: %s\r\n", name, value); - - message->headers = g_slist_prepend(message->headers, header); -} - -static void -msn_soap_process(MsnSoapConnection *conn) -{ - gboolean handled = FALSE; - char *cursor; - char *linebreak; - - cursor = conn->buf->str + conn->handled_len; - - if (!conn->headers_done) { - while ((linebreak = strstr(cursor, "\r\n")) != NULL) { - conn->handled_len = linebreak - conn->buf->str + 2; - - if (conn->response_code == 0) { - if (sscanf(cursor, "HTTP/1.1 %d", &conn->response_code) != 1) { - /* something horribly wrong */ - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - msn_soap_connection_handle_next(conn); - handled = TRUE; - break; - } else if (conn->response_code == 503 && conn->session->login_step < MSN_LOGIN_STEP_END) { - msn_soap_connection_sanitize(conn, TRUE); - msn_session_set_error(conn->session, MSN_ERROR_SERV_UNAVAILABLE, NULL); - return; - } - } else if (cursor == linebreak) { - /* blank line */ - conn->headers_done = TRUE; - cursor = conn->buf->str + conn->handled_len; - break; - } else { - char *line = g_strndup(cursor, linebreak - cursor); - char *sep = strstr(line, ": "); - char *key = line; - char *value; - - if (sep == NULL) { - purple_debug_info("soap", "ignoring malformed line: %s\n", line); - g_free(line); - goto loop_end; - } - - value = sep + 2; - *sep = '\0'; - msn_soap_message_add_header(conn->message, key, value); - - if ((conn->response_code == 301 || conn->response_code == 300) - && strcmp(key, "Location") == 0) { - - msn_soap_handle_redirect(conn, value); - - handled = TRUE; - g_free(line); - break; - } else if (conn->response_code == 401 && - strcmp(key, "WWW-Authenticate") == 0) { - char *error = strstr(value, "cbtxt="); - - if (error) { - error += strlen("cbtxt="); - } - - msn_soap_connection_sanitize(conn, TRUE); - msn_session_set_error(conn->session, MSN_ERROR_AUTH, - error ? purple_url_decode(error) : NULL); - - g_free(line); - return; - } else if (strcmp(key, "Content-Length") == 0) { - sscanf(value, "%" G_GSIZE_FORMAT, &(conn->body_len)); - } else if (strcmp(key, "Connection") == 0) { - if (strcmp(value, "close") == 0) { - conn->close_when_done = TRUE; - } - } - g_free(line); - } - - loop_end: - cursor = conn->buf->str + conn->handled_len; - } - } - - if (!handled && conn->headers_done) { - if (conn->buf->len - conn->handled_len >= - conn->body_len) { - xmlnode *node = xmlnode_from_str(cursor, conn->body_len); - - if (node == NULL) { - purple_debug_info("soap", "Malformed SOAP response: %s\n", - cursor); - } else { - MsnSoapMessage *message = conn->message; - conn->message = NULL; - message->xml = node; - - if (!msn_soap_handle_body(conn, message)) { - return; - } - } - - msn_soap_connection_handle_next(conn); - } - - return; - } - - if (handled) { - msn_soap_connection_handle_next(conn); - } -} - -static void -msn_soap_read_cb(gpointer data, gint fd, PurpleInputCondition cond) -{ - MsnSoapConnection *conn = data; - int count = 0, cnt, perrno; - /* This buffer needs to be larger than any packets received from - login.live.com or Adium will fail to receive the packet - (something weird with the login.live.com server). With NSS it works - fine, so I believe it's some bug with OS X */ - char buf[16 * 1024]; - gsize cursor; - - if (conn->message == NULL) { - conn->message = msn_soap_message_new(NULL, NULL); - } - - if (conn->buf == NULL) { - conn->buf = g_string_new_len(buf, 0); - } - - cursor = conn->buf->len; - while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) { - purple_debug_info("soap", "read %d bytes\n", cnt); - count += cnt; - g_string_append_len(conn->buf, buf, cnt); - } - - perrno = errno; - if (cnt < 0 && perrno != EAGAIN) - purple_debug_info("soap", "read: %s\n", g_strerror(perrno)); - - if (conn->current_request && conn->current_request->secure && - !conn->unsafe_debug) - purple_debug_misc("soap", "Received secure request.\n"); - else if (count != 0) - purple_debug_misc("soap", "current %s\n", conn->buf->str + cursor); - - /* && count is necessary for Adium, on OS X the last read always - return an error, so we want to proceed anyway. See #5212 for - discussion on this and the above buffer size issues */ - if(cnt < 0 && errno == EAGAIN && count == 0) - return; - - /* msn_soap_process could alter errno */ - msn_soap_process(conn); - - if ((cnt < 0 && perrno != EAGAIN) || cnt == 0) { - /* It's possible msn_soap_process closed the ssl connection */ - if (conn->ssl) { - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - msn_soap_connection_handle_next(conn); - } - } -} - -static gboolean -msn_soap_write_cb_internal(gpointer data, gint fd, PurpleInputCondition cond, - gboolean initial) -{ - MsnSoapConnection *conn = data; - int written; - - if (cond != PURPLE_INPUT_WRITE) - return TRUE; - - written = purple_ssl_write(conn->ssl, conn->buf->str + conn->handled_len, - conn->buf->len - conn->handled_len); - - if (written < 0 && errno == EAGAIN) - return TRUE; - else if (written <= 0) { - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - if (!initial) - msn_soap_connection_handle_next(conn); - return FALSE; - } - - conn->handled_len += written; - - if (conn->handled_len < conn->buf->len) - return TRUE; - - /* we are done! */ - g_string_free(conn->buf, TRUE); - conn->buf = NULL; - conn->handled_len = 0; - conn->body_len = 0; - conn->response_code = 0; - conn->headers_done = FALSE; - conn->close_when_done = FALSE; - - purple_input_remove(conn->event_handle); - conn->event_handle = purple_input_add(conn->ssl->fd, PURPLE_INPUT_READ, - msn_soap_read_cb, conn); - return TRUE; -} - -static void -msn_soap_write_cb(gpointer data, gint fd, PurpleInputCondition cond) -{ - msn_soap_write_cb_internal(data, fd, cond, FALSE); -} - -static void -msn_soap_error_cb(PurpleSslConnection *ssl, PurpleSslErrorType error, - gpointer data) -{ - MsnSoapConnection *conn = data; - - /* sslconn already frees the connection in case of error */ - conn->ssl = NULL; - - g_hash_table_remove(conn->session->soap_table, conn->host); -} - -static void -msn_soap_connected_cb(gpointer data, PurpleSslConnection *ssl, - PurpleInputCondition cond) -{ - MsnSoapConnection *conn = data; - - conn->connected = TRUE; - - if (conn->run_timer == 0) - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn); -} - -MsnSoapMessage * -msn_soap_message_new(const char *action, xmlnode *xml) -{ - MsnSoapMessage *message = g_new0(MsnSoapMessage, 1); - - message->action = g_strdup(action); - message->xml = xml; - - return message; -} - -static gboolean -msn_soap_connection_run(gpointer data) -{ - MsnSoapConnection *conn = data; - MsnSoapRequest *req = g_queue_peek_head(conn->queue); - - conn->run_timer = 0; - - if (req) { - if (conn->ssl == NULL) { - conn->ssl = purple_ssl_connect(conn->session->account, conn->host, - 443, msn_soap_connected_cb, msn_soap_error_cb, conn); - } else if (conn->connected) { - int len = -1; - char *body = xmlnode_to_str(req->message->xml, &len); - GSList *iter; - - g_queue_pop_head(conn->queue); - - conn->buf = g_string_new(""); - - g_string_append_printf(conn->buf, - "POST /%s HTTP/1.1\r\n" - "SOAPAction: %s\r\n" - "Content-Type:text/xml; charset=utf-8\r\n" - "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" - "Accept: */*\r\n" - "Host: %s\r\n" - "Content-Length: %d\r\n" - "Connection: Keep-Alive\r\n" - "Cache-Control: no-cache\r\n", - req->path, req->message->action ? req->message->action : "", - conn->host, len); - - for (iter = req->message->headers; iter; iter = iter->next) { - g_string_append(conn->buf, (char *)iter->data); - g_string_append(conn->buf, "\r\n"); - } - - g_string_append(conn->buf, "\r\n"); - g_string_append(conn->buf, body); - - if (req->secure && !conn->unsafe_debug) - purple_debug_misc("soap", "Sending secure request.\n"); - else - purple_debug_misc("soap", "%s\n", conn->buf->str); - - conn->handled_len = 0; - conn->current_request = req; - - if (conn->event_handle) - purple_input_remove(conn->event_handle); - conn->event_handle = purple_input_add(conn->ssl->fd, - PURPLE_INPUT_WRITE, msn_soap_write_cb, conn); - if (!msn_soap_write_cb_internal(conn, conn->ssl->fd, PURPLE_INPUT_WRITE, TRUE)) { - /* Not connected => reconnect and retry */ - purple_debug_info("soap", "not connected, reconnecting\n"); - - conn->connected = FALSE; - conn->current_request = NULL; - msn_soap_connection_sanitize(conn, FALSE); - - g_queue_push_head(conn->queue, req); - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn); - } - - g_free(body); - } - } - - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/soap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/** - * @file soap.h - * header file for SOAP connection related process - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef _MSN_SOAP_H -#define _MSN_SOAP_H - -#include "session.h" -#include "sslconn.h" -#include "xmlnode.h" - -#include - -typedef struct _MsnSoapMessage MsnSoapMessage; -typedef void (*MsnSoapCallback)(MsnSoapMessage *request, - MsnSoapMessage *response, gpointer cb_data); - -struct _MsnSoapMessage { - char *action; - xmlnode *xml; - GSList *headers; -}; - -MsnSoapMessage *msn_soap_message_new(const char *action, xmlnode *xml); - -void msn_soap_message_send(MsnSession *session, MsnSoapMessage *message, - const char *host, const char *path, gboolean secure, - MsnSoapCallback cb, gpointer cb_data); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ -/** - * @file state.c State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "core.h" - -#include "msn.h" -#include "state.h" - -static const char *away_text[] = -{ - N_("Available"), - N_("Available"), - N_("Busy"), - N_("Idle"), - N_("Be Right Back"), - N_("Away From Computer"), - N_("On The Phone"), - N_("Out To Lunch"), - N_("Available"), - N_("Available") -}; - -/* Local Function Prototype*/ -static char *msn_build_psm(const char *psmstr,const char *mediastr, - const char *guidstr); - -/* - * WLM media PSM info build prcedure - * - * Result can like: - * \0Music\01\0{0} - {1}\0Song Title\0Song Artist\0Song Album\0\0\ - * \0Games\01\0Playing {0}\0Game Name\0\ - * \0Office\01\0Office Message\0Office App Name\0" - */ -static char * -msn_build_psm(const char *psmstr,const char *mediastr, const char *guidstr) -{ - xmlnode *dataNode,*psmNode,*mediaNode,*guidNode; - char *result; - int length; - - dataNode = xmlnode_new("Data"); - - psmNode = xmlnode_new("PSM"); - if(psmstr != NULL){ - xmlnode_insert_data(psmNode, psmstr, -1); - } - xmlnode_insert_child(dataNode, psmNode); - - mediaNode = xmlnode_new("CurrentMedia"); - if(mediastr != NULL){ - xmlnode_insert_data(mediaNode, mediastr, -1); - } - xmlnode_insert_child(dataNode, mediaNode); - - guidNode = xmlnode_new("MachineGuid"); - if(guidstr != NULL){ - xmlnode_insert_data(guidNode, guidstr, -1); - } - xmlnode_insert_child(dataNode, guidNode); - - result = xmlnode_to_str(dataNode, &length); - xmlnode_free(dataNode); - return result; -} - -/* parse CurrentMedia string */ -gboolean -msn_parse_currentmedia(const char *cmedia, CurrentMedia *media) -{ - char **cmedia_array; - int strings = 0; - gboolean parsed = FALSE; - - if ((cmedia == NULL) || (*cmedia == '\0')) { - purple_debug_info("msn", "No currentmedia string\n"); - return FALSE; - } - - purple_debug_info("msn", "Parsing currentmedia string: \"%s\"\n", cmedia); - - cmedia_array = g_strsplit(cmedia, "\\0", 0); - - /* - * 0: Application - * 1: 'Music'/'Games'/'Office' - * 2: '1' if enabled, '0' if not - * 3: Format (eg. {0} by {1}) - * 4: Title - * If 'Music': - * 5: Artist - * 6: Album - * 7: ? - */ -#if GLIB_CHECK_VERSION(2,6,0) - strings = g_strv_length(cmedia_array); -#else - while (cmedia_array[++strings] != NULL); -#endif - - if (strings >= 4 && !strcmp(cmedia_array[2], "1")) { - parsed = TRUE; - - if (!strcmp(cmedia_array[1], "Music")) - media->type = CURRENT_MEDIA_MUSIC; - else if (!strcmp(cmedia_array[1], "Games")) - media->type = CURRENT_MEDIA_GAMES; - else if (!strcmp(cmedia_array[1], "Office")) - media->type = CURRENT_MEDIA_OFFICE; - else - media->type = CURRENT_MEDIA_UNKNOWN; - - g_free(media->title); - if (strings == 4) { - media->title = g_strdup(cmedia_array[3]); - } else { - media->title = g_strdup(cmedia_array[4]); - } - - g_free(media->artist); - if (strings > 5) - media->artist = g_strdup(cmedia_array[5]); - else - media->artist = NULL; - - g_free(media->album); - if (strings > 6) - media->album = g_strdup(cmedia_array[6]); - else - media->album = NULL; - - } - - g_strfreev(cmedia_array); - - return parsed; -} - -/* get the CurrentMedia info from the XML string */ -char * -msn_get_currentmedia(char *xml_str, gsize len) -{ - xmlnode *payloadNode, *currentmediaNode; - char *currentmedia; - - purple_debug_info("msn", "Get CurrentMedia\n"); - payloadNode = xmlnode_from_str(xml_str, len); - if (!payloadNode) { - purple_debug_error("msn", "PSM XML parse Error!\n"); - return NULL; - } - currentmediaNode = xmlnode_get_child(payloadNode, "CurrentMedia"); - if (currentmediaNode == NULL) { - purple_debug_info("msn", "No CurrentMedia Node\n"); - xmlnode_free(payloadNode); - return NULL; - } - currentmedia = xmlnode_get_data(currentmediaNode); - - xmlnode_free(payloadNode); - - return currentmedia; -} - -/*get the PSM info from the XML string*/ -char * -msn_get_psm(char *xml_str, gsize len) -{ - xmlnode *payloadNode, *psmNode; - char *psm; - - purple_debug_info("msn", "msn get PSM\n"); - payloadNode = xmlnode_from_str(xml_str, len); - if (!payloadNode) { - purple_debug_error("msn", "PSM XML parse Error!\n"); - return NULL; - } - psmNode = xmlnode_get_child(payloadNode, "PSM"); - if (psmNode == NULL) { - purple_debug_info("msn", "No PSM status Node\n"); - xmlnode_free(payloadNode); - return NULL; - } - psm = xmlnode_get_data(psmNode); - - xmlnode_free(payloadNode); - - return psm; -} - -static char * -create_media_string(PurplePresence *presence) -{ - const char *title, *game, *office; - char *ret; - PurpleStatus *status = purple_presence_get_status(presence, "tune"); - if (!status || !purple_status_is_active(status)) - return NULL; - - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - game = purple_status_get_attr_string(status, "game"); - office = purple_status_get_attr_string(status, "office"); - - if (title && *title) { - const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - ret = g_strdup_printf("WMP\\0Music\\01\\0{0}%s%s\\0%s\\0%s\\0%s\\0", - artist ? " - {1}" : "", - album ? " ({2})" : "", - title, - artist ? artist : "", - album ? album : ""); - } - else if (game && *game) - ret = g_strdup_printf("\\0Games\\01\\0Playing {0}\\0%s\\0", game); - else if (office && *office) - ret = g_strdup_printf("\\0Office\\01\\0Editing {0}\\0%s\\0", office); - else - ret = NULL; - - return ret; -} - -/* set the MSN's PSM info,Currently Read from the status Line - * Thanks for Cris Code - */ -void -msn_set_psm(MsnSession *session) -{ - PurpleAccount *account; - PurplePresence *presence; - PurpleStatus *status; - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - const char *statusline; - gchar *statusline_stripped, *media = NULL; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->notification != NULL); - - account = session->account; - cmdproc = session->notification->cmdproc; - - /* Get the PSM string from Purple's Status Line */ - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - statusline = purple_status_get_attr_string(status, "message"); - - /* MSN expects plain text, not HTML */ - statusline_stripped = purple_markup_strip_html(statusline); - media = create_media_string(presence); - g_free(session->psm); - session->psm = msn_build_psm(statusline_stripped, media, NULL); - - payload = session->psm; - purple_debug_misc("msn", "Sending UUX command with payload: %s\n", payload); - trans = msn_transaction_new(cmdproc, "UUX", "%" G_GSIZE_FORMAT, strlen(payload)); - msn_transaction_set_payload(trans, payload, strlen(payload)); - msn_cmdproc_send_trans(cmdproc, trans); - - g_free(statusline_stripped); - g_free(media); -} - -void -msn_change_status(MsnSession *session) -{ - PurpleAccount *account; - MsnCmdProc *cmdproc; - MsnUser *user; - MsnObject *msnobj; - const char *state_text; - GHashTable *ui_info = purple_core_get_ui_info(); - MsnClientCaps caps = MSN_CLIENT_ID; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->notification != NULL); - - /* set client caps based on what the UI tells us it is... */ - if (ui_info) { - const gchar *client_type = g_hash_table_lookup(ui_info, "client_type"); - if (client_type) { - if (strcmp(client_type, "phone") == 0 || - strcmp(client_type, "handheld") == 0) { - caps |= MSN_CLIENT_CAP_WIN_MOBILE; - } else if (strcmp(client_type, "web") == 0) { - caps |= MSN_CLIENT_CAP_WEBMSGR; - } else if (strcmp(client_type, "bot") == 0) { - caps |= MSN_CLIENT_CAP_BOT; - } - /* MSN doesn't a "console" type... - What, they have no ncurses UI? :-) */ - } - } - - account = session->account; - cmdproc = session->notification->cmdproc; - user = session->user; - state_text = msn_state_get_text(msn_state_from_account(account)); - - /* If we're not logged in yet, don't send the status to the server, - * it will be sent when login completes - */ - if (!session->logged_in) - return; - - msnobj = msn_user_get_object(user); - - if (msnobj == NULL) - { - msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, caps); - } - else - { - char *msnobj_str; - - msnobj_str = msn_object_to_string(msnobj); - - msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text, - caps, purple_url_encode(msnobj_str)); - - g_free(msnobj_str); - } - msn_set_psm(session); -} - -const char * -msn_away_get_text(MsnAwayType type) -{ - g_return_val_if_fail(type <= MSN_HIDDEN, NULL); - - return _(away_text[type]); -} - -const char * -msn_state_get_text(MsnAwayType state) -{ - static char *status_text[] = - { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" }; - - return status_text[state]; -} - -MsnAwayType -msn_state_from_account(PurpleAccount *account) -{ - MsnAwayType msnstatus; - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); - - if (!strcmp(status_id, "away")) - msnstatus = MSN_AWAY; - else if (!strcmp(status_id, "brb")) - msnstatus = MSN_BRB; - else if (!strcmp(status_id, "busy")) - msnstatus = MSN_BUSY; - else if (!strcmp(status_id, "phone")) - msnstatus = MSN_PHONE; - else if (!strcmp(status_id, "lunch")) - msnstatus = MSN_LUNCH; - else if (!strcmp(status_id, "invisible")) - msnstatus = MSN_HIDDEN; - else - msnstatus = MSN_ONLINE; - - if ((msnstatus == MSN_ONLINE) && purple_presence_is_idle(presence)) - msnstatus = MSN_IDLE; - - return msnstatus; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/state.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -/** - * @file state.h State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_STATE_H_ -#define _MSN_STATE_H_ - -/** - * Away types. - */ -typedef enum -{ - MSN_ONLINE = 1, - MSN_BUSY = 2, - MSN_IDLE = 3, - MSN_BRB = 4, - MSN_AWAY = 5, - MSN_PHONE = 6, - MSN_LUNCH = 7, - MSN_OFFLINE = 8, - MSN_HIDDEN = 9 - -} MsnAwayType; - -/** - * Changes the status of the user. - * - * @param session The MSN session. - */ -void msn_change_status(MsnSession *session); - -/** - * Returns the string representation of an away type. - * - * @param type The away type. - * - * @return The string representation of the away type. - */ -const char *msn_away_get_text(MsnAwayType type); - -const char *msn_state_get_text(MsnAwayType state); - -void msn_set_psm(MsnSession *session); - -/* Parse CurrentMedia string */ -gboolean msn_parse_currentmedia(const char *cmedia, CurrentMedia *media); - -/* Get the CurrentMedia info from the XML string */ -char * msn_get_currentmedia(char *xml_str,gsize len); - -/*get the PSM info from the XML string*/ -char * msn_get_psm(char *xml_str,gsize len); - -MsnAwayType msn_state_from_account(PurpleAccount *account); - -#endif /* _MSN_STATE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1281 +0,0 @@ -/** - * @file switchboard.c MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "prefs.h" -#include "switchboard.h" -#include "notification.h" -#include "msnutils.h" - -#include "error.h" - -static MsnTable *cbs_table; - -static void msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, - MsnMsgErrorType error); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSwitchBoard * -msn_switchboard_new(MsnSession *session) -{ - MsnSwitchBoard *swboard; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = g_new0(MsnSwitchBoard, 1); - - swboard->session = session; - swboard->servconn = msn_servconn_new(session, MSN_SERVCONN_SB); - msn_servconn_set_idle_timeout(swboard->servconn, 60); - swboard->cmdproc = swboard->servconn->cmdproc; - - swboard->msg_queue = g_queue_new(); - swboard->empty = TRUE; - - swboard->cmdproc->data = swboard; - swboard->cmdproc->cbs_table = cbs_table; - - session->switches = g_list_prepend(session->switches, swboard); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "switchboard new: swboard(%p)\n", swboard); - - return swboard; -} - -void -msn_switchboard_destroy(MsnSwitchBoard *swboard) -{ - MsnSession *session; - MsnMessage *msg; - GList *l; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "switchboard destroy: swboard(%p)\n", swboard); - - g_return_if_fail(swboard != NULL); - - if (swboard->destroying) - return; - - swboard->destroying = TRUE; - - if (swboard->reconn_timeout_h > 0) - purple_timeout_remove(swboard->reconn_timeout_h); - - /* If it linked us is because its looking for trouble */ - while (swboard->slplinks != NULL) - msn_slplink_destroy(swboard->slplinks->data); - - /* Destroy the message queue */ - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - if (swboard->error != MSN_SB_ERROR_NONE) - { - /* The messages could not be sent due to a switchboard error */ - msg_error_helper(swboard->cmdproc, msg, - MSN_MSG_ERROR_SB); - } - msn_message_unref(msg); - } - - g_queue_free(swboard->msg_queue); - - /* msg_error_helper will both remove the msg from ack_list and - unref it, so we don't need to do either here */ - while ((l = swboard->ack_list) != NULL) - msg_error_helper(swboard->cmdproc, l->data, MSN_MSG_ERROR_SB); - - g_free(swboard->im_user); - g_free(swboard->auth_key); - g_free(swboard->session_id); - - for (; swboard->users; swboard->users = g_list_delete_link(swboard->users, swboard->users)) - g_free(swboard->users->data); - - session = swboard->session; - session->switches = g_list_remove(session->switches, swboard); - - for (l = session->slplinks; l; l = l->next) { - MsnSlpLink *slplink = l->data; - if (slplink->swboard == swboard) slplink->swboard = NULL; - } - -#if 0 - /* This should never happen or we are in trouble. */ - if (swboard->servconn != NULL) - msn_servconn_destroy(swboard->servconn); -#endif - - swboard->cmdproc->data = NULL; - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_servconn_destroy(swboard->servconn); - - g_free(swboard); -} - -void -msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(key != NULL); - - swboard->auth_key = g_strdup(key); -} - -const char * -msn_switchboard_get_auth_key(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->auth_key; -} - -void -msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(id != NULL); - - g_free(swboard->session_id); - swboard->session_id = g_strdup(id); -} - -const char * -msn_switchboard_get_session_id(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->session_id; -} - -int -msn_switchboard_get_chat_id(void) -{ - static int chat_id = 1; - - return chat_id++; -} - -void -msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited) -{ - g_return_if_fail(swboard != NULL); - - swboard->invited = invited; -} - -gboolean -msn_switchboard_is_invited(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - return swboard->invited; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -static void -send_clientcaps(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_CAPS); - msn_message_set_content_type(msg, "text/x-clientcaps"); - msn_message_set_flag(msg, 'U'); - msn_message_set_bin_data(msg, MSN_CLIENTINFO, strlen(MSN_CLIENTINFO)); - - msn_switchboard_send_msg(swboard, msg, TRUE); - - msn_message_destroy(msg); -} - -static void -msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnCmdProc *cmdproc; - PurpleAccount *account; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - account = cmdproc->session->account; - - swboard->users = g_list_prepend(swboard->users, g_strdup(user)); - swboard->current_users++; - swboard->empty = FALSE; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "user=[%s], total=%d\n", - user, swboard->current_users); - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - { - /* This is a helper switchboard. */ - purple_debug_error("msn", "switchboard_add_user: conv != NULL\n"); - return; - } - - if ((swboard->conv != NULL) && - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - msn_servconn_set_idle_timeout(swboard->servconn, 0); - } - else if (swboard->current_users > 1 || swboard->total_users > 1) - { - msn_servconn_set_idle_timeout(swboard->servconn, 0); - if (swboard->conv == NULL || - purple_conversation_get_type(swboard->conv) != PURPLE_CONV_TYPE_CHAT) - { - GList *l; - -#if 0 - /* this is bad - it causes msn_switchboard_close to be called on the - * switchboard we're in the middle of using :( */ - if (swboard->conv != NULL) - purple_conversation_destroy(swboard->conv); -#endif - - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->flag |= MSN_SB_FLAG_IM; - swboard->conv = serv_got_joined_chat(account->gc, - swboard->chat_id, - "MSN Chat"); - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *tmp_user; - - tmp_user = l->data; - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - tmp_user, NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - purple_account_get_username(account), - NULL, PURPLE_CBFLAGS_NONE, TRUE); - - g_free(swboard->im_user); - swboard->im_user = NULL; - } - } - else if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - user, account); - } - else - { - purple_debug_warning("msn", "switchboard_add_user: This should not happen!\n"); - } -} - -static PurpleConversation * -msn_switchboard_get_conv(MsnSwitchBoard *swboard) -{ - PurpleAccount *account; - - g_return_val_if_fail(swboard != NULL, NULL); - - if (swboard->conv != NULL) - return swboard->conv; - - purple_debug_error("msn", "Switchboard with unassigned conversation\n"); - - account = swboard->session->account; - - return (swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, - account, swboard->im_user)); -} - -static void -msn_switchboard_report_user(MsnSwitchBoard *swboard, PurpleMessageFlags flags, const char *msg) -{ - PurpleConversation *conv; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - if ((conv = msn_switchboard_get_conv(swboard)) != NULL) - { - purple_conversation_write(conv, NULL, msg, flags, time(NULL)); - } -} - -static void -swboard_error_helper(MsnSwitchBoard *swboard, int reason, const char *passport) -{ - g_return_if_fail(swboard != NULL); - - purple_debug_warning("msn", "Error: Unable to call the user %s for reason %i\n", - passport ? passport : "(null)", reason); - - /* TODO: if current_users > 0, this is probably a chat and an invite failed, - * we should report that in the chat or something */ - if (swboard->current_users == 0) - { - swboard->error = reason; - msn_switchboard_close(swboard); - } -} - -static void -cal_error_helper(MsnTransaction *trans, int reason) -{ - MsnSwitchBoard *swboard; - const char *passport; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - passport = params[0]; - - swboard = trans->data; - - purple_debug_warning("msn", "cal_error_helper: command %s failed for reason %i\n",trans->command,reason); - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static gboolean -msg_resend_cb(gpointer data) -{ - MsnSwitchBoard *swboard = data; - - purple_debug_info("msn", "unqueuing unsent message to %s\n", swboard->im_user); - - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, swboard->im_user); - swboard->reconn_timeout_h = 0; - return FALSE; -} - -static void -msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, MsnMsgErrorType error) -{ - MsnSwitchBoard *swboard; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(msg != NULL); - - if ((error != MSN_MSG_ERROR_SB) && (msg->nak_cb != NULL)) - msg->nak_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - - /* This is not good, and should be fixed somewhere else. */ - g_return_if_fail(swboard != NULL); - - if (msg->type == MSN_MSG_TEXT) - { - const char *format, *str_reason; - char *body_str, *body_enc, *pre, *post; - -#if 0 - if (swboard->conv == NULL) - { - if (msg->ack_ref) - msn_message_unref(msg); - - return; - } -#endif - - if (error == MSN_MSG_ERROR_TIMEOUT) - { - str_reason = _("Message may have not been sent " - "because a timeout occurred:"); - } - else if (error == MSN_MSG_ERROR_SB) - { - MsnSession *session = swboard->session; - - if (!session->destroying && msg->retries && swboard->im_user && - (swboard->error == MSN_SB_ERROR_CONNECTION || - swboard->error == MSN_SB_ERROR_UNKNOWN)) { - MsnSwitchBoard *new_sw = msn_session_find_swboard(session, - swboard->im_user); - - if (new_sw == NULL || new_sw->reconn_timeout_h == 0) { - new_sw = msn_switchboard_new(session); - new_sw->im_user = g_strdup(swboard->im_user); - new_sw->reconn_timeout_h = purple_timeout_add_seconds(3, msg_resend_cb, new_sw); - new_sw->flag |= MSN_SB_FLAG_IM; - } - - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - purple_debug_info("msn", "queuing unsent message to %s: %s\n", - swboard->im_user, body_enc); - g_free(body_enc); - msn_send_im_message(session, msg); - msg->retries--; - - return; - } - - switch (swboard->error) - { - case MSN_SB_ERROR_OFFLINE: - str_reason = _("Message could not be sent, " - "not allowed while invisible:"); - break; - case MSN_SB_ERROR_USER_OFFLINE: - str_reason = _("Message could not be sent " - "because the user is offline:"); - break; - case MSN_SB_ERROR_CONNECTION: - str_reason = _("Message could not be sent " - "because a connection error occurred:"); - break; - case MSN_SB_ERROR_TOO_FAST: - str_reason = _("Message could not be sent " - "because we are sending too quickly:"); - break; - case MSN_SB_ERROR_AUTHFAILED: - str_reason = _("Message could not be sent " - "because we were unable to establish a " - "session with the server. This is " - "likely a server problem, try again in " - "a few minutes:"); - break; - default: - str_reason = _("Message could not be sent " - "because an error with " - "the switchboard occurred:"); - break; - } - } - else - { - str_reason = _("Message may have not been sent " - "because an unknown error occurred:"); - } - - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_ERROR, - str_reason); - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_RAW, - body_str); - - g_free(body_str); - } - - /* If a timeout occures we will want the msg around just in case we - * receive the ACK after the timeout. */ - if (msg->ack_ref && error != MSN_MSG_ERROR_TIMEOUT) - { - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); - } -} - -/************************************************************************** - * Message Stuff - **************************************************************************/ - -/** Called when a message times out. */ -static void -msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnMessage *msg; - - msg = trans->data; - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT); -} - -/** Called when we receive an error of a message. */ -static void -msg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - msg_error_helper(cmdproc, trans->data, MSN_MSG_ERROR_UNKNOWN); -} - -#if 0 -/** Called when we receive an ack of a special message. */ -static void -msg_ack(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg->ack_data); - - msn_message_unref(msg); -} - -/** Called when we receive a nak of a special message. */ -static void -msg_nak(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - msn_message_unref(msg); -} -#endif - -static void -release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - gsize payload_len; - char flag; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - cmdproc = swboard->cmdproc; - - payload = msn_message_gen_payload(msg, &payload_len); - - if (purple_debug_is_verbose()) { - purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}\n", payload_len); - msn_message_show_readable(msg, "SB SEND", FALSE); - } - - flag = msn_message_get_flag(msg); - trans = msn_transaction_new(cmdproc, "MSG", "%c %" G_GSIZE_FORMAT, - flag, payload_len); - - /* Data for callbacks */ - msn_transaction_set_data(trans, msg); - - if (flag != 'U') { - if (msg->type == MSN_MSG_TEXT) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); - } - else if (msg->type == MSN_MSG_SLP) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); -#if 0 - if (msg->ack_cb != NULL) - { - msn_transaction_add_cb(trans, "ACK", msg_ack); - msn_transaction_add_cb(trans, "NAK", msg_nak); - } -#endif - } - } - - trans->payload = payload; - trans->payload_len = payload_len; - - msg->trans = trans; - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - purple_debug_info("msn", "Appending message to queue.\n"); - - g_queue_push_tail(swboard->msg_queue, msg); - - msn_message_ref(msg); -} - -static void -process_queue(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - g_return_if_fail(swboard != NULL); - - purple_debug_info("msn", "Processing queue\n"); - - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - purple_debug_info("msn", "Sending message\n"); - release_msg(swboard, msg); - msn_message_unref(msg); - } -} - -gboolean -msn_switchboard_can_send(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - if (swboard->empty || !g_queue_is_empty(swboard->msg_queue)) - return FALSE; - - return TRUE; -} - -void -msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - purple_debug_info("msn", "switchboard send msg..\n"); - if (msn_switchboard_can_send(swboard)) - release_msg(swboard, msg); - else if (queue) - queue_msg(swboard, msg); -} - -/************************************************************************** - * Switchboard Commands - **************************************************************************/ - -static void -ans_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - swboard->ready = TRUE; -} - -static void -bye_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - user = cmd->params[0]; - - /* cmdproc->data is set to NULL when the switchboard is destroyed; - * we may get a bye shortly thereafter. */ - g_return_if_fail(swboard != NULL); - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - purple_debug_error("msn", "bye_cmd: helper bug\n"); - - if (swboard->conv == NULL) - { - /* This is a helper switchboard */ - msn_switchboard_destroy(swboard); - } - else if ((swboard->current_users > 1) || - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* This is a switchboard used for a chat */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL); - swboard->current_users--; - if (swboard->current_users == 0) - msn_switchboard_destroy(swboard); - } - else - { - /* This is a switchboard used for a im session */ - msn_switchboard_destroy(swboard); - } -} - -static void -iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - account = cmdproc->session->account; - gc = account->gc; - swboard = cmdproc->data; - - swboard->total_users = atoi(cmd->params[2]); - - msn_switchboard_add_user(swboard, cmd->params[3]); -} - -static void -joi_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - const char *passport; - - passport = cmd->params[0]; - - session = cmdproc->session; - account = session->account; - gc = account->gc; - swboard = cmdproc->data; - - msn_switchboard_add_user(swboard, passport); - - process_queue(swboard); - - if (!session->http_method) - send_clientcaps(swboard); - - if (swboard->closed) - msn_switchboard_close(swboard); -} - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len, - MSG_LINE_DEM,MSG_BODY_DEM); - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, "SB RECV", FALSE); - - g_free (msg->remote_user); - msg->remote_user = g_strdup(cmd->params[0]); - - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_unref(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmd->payload_len = atoi(cmd->params[2]); - cmdproc->last_cmd->payload_cb = msg_cmd_post; -} - -static void -ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_misc("msn", "get UBM...\n"); - cmd->payload_len = atoi(cmd->params[3]); - cmdproc->last_cmd->payload_cb = msg_cmd_post; -} - -static void -nak_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - g_return_if_fail(msg != NULL); - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_NAK); -} - -static void -ack_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - if (swboard) - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); -} - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - - if (swboard->current_users > 1) - serv_got_chat_left(gc, swboard->chat_id); - - msn_switchboard_disconnect(swboard); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - -#if 0 - GList *l; - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *user; - user = l->data; - - msn_cmdproc_send(cmdproc, "CAL", "%s", user); - } -#endif - - swboard->ready = TRUE; - msn_cmdproc_process_queue(cmdproc); -} - -/************************************************************************** - * Message Handlers - **************************************************************************/ -static void -clientcaps_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ -#if 0 - MsnSession *session; - MsnSwitchBoard *swboard; - MsnUser *user; - GHashTable *clientcaps; - const char *value; - - char *passport = msg->sender; - - session = cmdproc->session; - swboard = cmdproc->servconn->swboard; - - clientcaps = msn_message_get_hashtable_from_body(msg); -#endif -} - -void -msn_switchboard_show_ink(MsnSwitchBoard *swboard, const char *passport, - const char *data) -{ - PurpleConnection *gc; - guchar *image_data; - size_t image_len; - int imgid; - char *image_msg; - - if (!purple_str_has_prefix(data, "base64:")) - { - purple_debug_error("msn", "Ignoring Ink not in Base64 format.\n"); - return; - } - - gc = purple_account_get_connection(swboard->session->account); - - data += sizeof("base64:") - 1; - image_data = purple_base64_decode(data, &image_len); - if (!image_data || !image_len) - { - purple_debug_error("msn", "Unable to decode Ink from Base64 format.\n"); - return; - } - - imgid = purple_imgstore_add_with_id(image_data, image_len, NULL); - image_msg = g_strdup_printf("", imgid); - - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - serv_got_chat_in(gc, swboard->chat_id, passport, 0, image_msg, - time(NULL)); - else - serv_got_im(gc, passport, image_msg, 0, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - g_free(image_msg); -} - -/************************************************************************** - * Connect stuff - **************************************************************************/ -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error); - -static void -connect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - MsnTransaction *trans; - MsnCmdProc *cmdproc; - PurpleAccount *account; - - cmdproc = servconn->cmdproc; - g_return_if_fail(cmdproc != NULL); - - account = cmdproc->session->account; - swboard = cmdproc->data; - g_return_if_fail(swboard != NULL); - - if (msn_switchboard_is_invited(swboard)) - { - swboard->empty = FALSE; - - trans = msn_transaction_new(cmdproc, "ANS", "%s %s %s", - purple_account_get_username(account), - swboard->auth_key, swboard->session_id); - } - else - { - trans = msn_transaction_new(cmdproc, "USR", "%s %s", - purple_account_get_username(account), - swboard->auth_key); - } - - msn_transaction_set_error_cb(trans, ans_usr_error); - msn_transaction_set_data(trans, swboard); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - char **params; - char *passport; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 911) - { - reason = MSN_SB_ERROR_AUTHFAILED; - } - - purple_debug_warning("msn", "ans_usr_error: command %s gave error %i\n", trans->command, error); - - params = g_strsplit(trans->params, " ", 0); - passport = params[0]; - swboard = trans->data; - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static void -disconnect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - - swboard = servconn->cmdproc->data; - g_return_if_fail(swboard != NULL); - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_switchboard_destroy(swboard); -} - -gboolean -msn_switchboard_connect(MsnSwitchBoard *swboard, const char *host, int port) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - msn_servconn_set_connect_cb(swboard->servconn, connect_cb); - msn_servconn_set_disconnect_cb(swboard->servconn, disconnect_cb); - - return msn_servconn_connect(swboard->servconn, host, port, FALSE); -} - -void -msn_switchboard_disconnect(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - msn_servconn_disconnect(swboard->servconn); -} - -/************************************************************************** - * Call stuff - **************************************************************************/ -static void -got_cal(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -#if 0 - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - - user = cmd->params[0]; - - msn_switchboard_add_user(swboard, user); -#endif -} - -static void -cal_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - purple_debug_warning("msn", "cal_timeout: command %s timed out\n", trans->command); - - cal_error_helper(trans, MSN_SB_ERROR_UNKNOWN); -} - -static void -cal_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int reason = MSN_SB_ERROR_UNKNOWN; - MsnMessage *msg; - MsnSwitchBoard *swboard = trans->data; - - if (error == 215) - { - purple_debug_info("msn", "Invited user already in switchboard\n"); - return; - } - else if (error == 217) - { - reason = MSN_SB_ERROR_USER_OFFLINE; - } - - purple_debug_warning("msn", "cal_error: command %s gave error %i\n", trans->command, error); - - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL){ - purple_debug_warning("msn", "Unable to send msg: {%s}\n", msg->body); - /* The messages could not be sent due to a switchboard error */ - swboard->error = MSN_SB_ERROR_USER_OFFLINE; - msg_error_helper(swboard->cmdproc, msg, - MSN_MSG_ERROR_SB); - } - cal_error_helper(trans, reason); -} - -void -msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnTransaction *trans; - MsnCmdProc *cmdproc; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - - trans = msn_transaction_new(cmdproc, "CAL", "%s", user); - /* this doesn't do anything, but users seem to think that - * 'Unhandled command' is some kind of error, so we don't report it */ - msn_transaction_add_cb(trans, "CAL", got_cal); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_timeout_cb(trans, cal_timeout); - - if (swboard->ready) - msn_cmdproc_send_trans(cmdproc, trans); - else - msn_cmdproc_queue_trans(cmdproc, trans); -} - -/************************************************************************** - * Create & Transfer stuff - **************************************************************************/ - -static void -got_swboard(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - char *host; - int port; - swboard = cmd->trans->data; - - if (g_list_find(cmdproc->session->switches, swboard) == NULL) - /* The conversation window was closed. */ - return; - - purple_debug_info("msn", "Switchboard:auth:{%s} socket:{%s}\n", cmd->params[4], cmd->params[2]); - msn_switchboard_set_auth_key(swboard, cmd->params[4]); - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 913) - reason = MSN_SB_ERROR_OFFLINE; - else if (error == 800) - reason = MSN_SB_ERROR_TOO_FAST; - - swboard = trans->data; - - purple_debug_info("msn", - "xfr_error %i for %s: trans %p, command %s, reason %i\n", - error, (swboard->im_user ? swboard->im_user : "(null)"), trans, - (trans->command ? trans->command : "(null)"), reason); - - swboard_error_helper(swboard, reason, swboard->im_user); -} - -void -msn_switchboard_request(MsnSwitchBoard *swboard) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->session->notification->cmdproc; - - trans = msn_transaction_new(cmdproc, "XFR", "%s", "SB"); - msn_transaction_add_cb(trans, "XFR", got_swboard); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_error_cb(trans, xfr_error); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_switchboard_close(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - if (swboard->error != MSN_SB_ERROR_NONE) - { - msn_switchboard_destroy(swboard); - } - else if (g_queue_is_empty(swboard->msg_queue) || - !swboard->session->connected) - { - MsnCmdProc *cmdproc; - cmdproc = swboard->cmdproc; - msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL); - - msn_switchboard_destroy(swboard); - } - else - { - swboard->closed = TRUE; - } -} - -void -msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag) -{ - g_return_if_fail(swboard != NULL); - - swboard->flag &= ~flag; - - if (flag == MSN_SB_FLAG_IM) - /* Forget any conversation that used to be associated with this - * swboard. */ - swboard->conv = NULL; - - if (swboard->flag == 0) - /* Nothing else is using this switchboard, so close it */ - msn_switchboard_close(swboard); -} - -/************************************************************************** - * Init stuff - **************************************************************************/ - -void -msn_switchboard_init(void) -{ - cbs_table = msn_table_new(); - - msn_table_add_cmd(cbs_table, "ANS", "ANS", ans_cmd); - msn_table_add_cmd(cbs_table, "ANS", "IRO", iro_cmd); - - msn_table_add_cmd(cbs_table, "MSG", "ACK", ack_cmd); - msn_table_add_cmd(cbs_table, "MSG", "NAK", nak_cmd); - - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "UBM", ubm_cmd); - msn_table_add_cmd(cbs_table, NULL, "JOI", joi_cmd); - msn_table_add_cmd(cbs_table, NULL, "BYE", bye_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - -#if 0 - /* They might skip the history */ - msn_table_add_cmd(cbs_table, NULL, "ACK", NULL); -#endif - - msn_table_add_error(cbs_table, "MSG", msg_error); - msn_table_add_error(cbs_table, "CAL", cal_error); - - /* Register the message type callbacks. */ - msn_table_add_msg_type(cbs_table, "text/plain", - msn_plain_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol", - msn_control_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientcaps", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientinfo", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "application/x-msnmsgrp2p", - msn_p2p_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-emoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-animemoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", - msn_datacast_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgsinvite", - msn_invite_msg); - msn_table_add_msg_type(cbs_table, "image/gif", - msn_handwritten_msg); -} - -void -msn_switchboard_end(void) -{ - msn_table_destroy(cbs_table); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/switchboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,293 +0,0 @@ -/** - * @file switchboard.h MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SWITCHBOARD_H_ -#define _MSN_SWITCHBOARD_H_ - -typedef struct _MsnSwitchBoard MsnSwitchBoard; - -#include "conversation.h" - -#include "msg.h" -#include "user.h" - -#include "servconn.h" - -#include "slplink.h" - -/** - * A switchboard error. - */ -typedef enum -{ - MSN_SB_ERROR_NONE, /**< No error. */ - MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */ - MSN_SB_ERROR_OFFLINE, /**< The account is offline. */ - MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */ - MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */ - MSN_SB_ERROR_TOO_FAST, /**< We are sending too fast */ - MSN_SB_ERROR_AUTHFAILED, /**< Authentication failed joining the switchboard session */ - MSN_SB_ERROR_UNKNOWN /**< An unknown error occurred. */ - -} MsnSBErrorType; - -/** - * A switchboard flag. - */ -typedef enum -{ - MSN_SB_FLAG_IM = 0x01, /**< This switchboard is being used for a conversation. */ - MSN_SB_FLAG_FT = 0x02 /**< This switchboard is being used for file transfer. */ - -} MsnSBFlag; - -/** - * A switchboard. - * - * A place where a bunch of users send messages to the rest of the users. - */ -struct _MsnSwitchBoard -{ - MsnSession *session; /**< Our parent session. */ - MsnServConn *servconn; /**< The physical connection for this switchboard. */ - MsnCmdProc *cmdproc; /**< Convenience variable for servconn->cmdproc. */ - char *im_user; - - MsnSBFlag flag; - char *auth_key; - char *session_id; - - PurpleConversation *conv; /**< The conversation that displays the - messages of this switchboard, or @c NULL if - this is a helper switchboard. */ - - gboolean empty; /**< A flag that states if the swithcboard has no - users in it. */ - gboolean invited; /**< A flag that states if we were invited to the - switchboard. */ - gboolean ready; /**< A flag that states if this switchboard is - ready to be used. */ - gboolean closed; /**< A flag that states if the switchboard has - been closed by the user. */ - gboolean destroying; /**< A flag that states if the switchboard is - alredy on the process of destruction. */ - - int current_users; - int total_users; - GList *users; - - int chat_id; - - GQueue *msg_queue; /**< Queue of messages to send. */ - GList *ack_list; /**< List of messages waiting for an ack. */ - - MsnSBErrorType error; /**< The error that occurred in this switchboard - (if applicable). */ - GList *slplinks; /**< The list of slplinks that are using this switchboard. */ - guint reconn_timeout_h; -}; - -/** - * Initialize the variables for switchboard creation. - */ -void msn_switchboard_init(void); - -/** - * Destroy the variables for switchboard creation. - */ -void msn_switchboard_end(void); - -/** - * Creates a new switchboard. - * - * @param session The MSN session. - * - * @return The new switchboard. - */ -MsnSwitchBoard *msn_switchboard_new(MsnSession *session); - -/** - * Destroys a switchboard. - * - * @param swboard The switchboard to destroy. - */ -void msn_switchboard_destroy(MsnSwitchBoard *swboard); - -/** - * Sets the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param key The auth key. - */ -void msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key); - -/** - * Returns the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The auth key. - */ -const char *msn_switchboard_get_auth_key(MsnSwitchBoard *swboard); - -/** - * Sets the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param id The session ID. - */ -void msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id); - -/** - * Returns the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The session ID. - */ -const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard); - -/** - * Returns the next chat ID for use by a switchboard. - * - * @return The chat ID. - */ -int msn_switchboard_get_chat_id(void); - -/** - * Sets whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * @param invite @c TRUE if invited, @c FALSE otherwise. - */ -void msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited); - -/** - * Returns whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if invited, @c FALSE otherwise. - */ -gboolean msn_switchboard_is_invited(MsnSwitchBoard *swboard); - -/** - * Connects to a switchboard. - * - * @param swboard The switchboard. - * @param host The switchboard server host. - * @param port The switcbharod server port. - * - * @return @c TRUE if able to connect, or @c FALSE otherwise. - */ -gboolean msn_switchboard_connect(MsnSwitchBoard *swboard, - const char *host, int port); - -/** - * Disconnects from a switchboard. - * - * @param swboard The switchboard to disconnect from. - */ -void msn_switchboard_disconnect(MsnSwitchBoard *swboard); - -/** - * Closes the switchboard. - * - * Called when a conversation is closed. - * - * @param swboard The switchboard to close. - */ -void msn_switchboard_close(MsnSwitchBoard *swboard); - -/** - * Release a switchboard from a certain function. - * - * @param swboard The switchboard to release. - * @param flag The flag that states the function. - */ -void msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag); - -/** - * Returns whether or not we currently can send a message through this - * switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -gboolean msn_switchboard_can_send(MsnSwitchBoard *swboard); - -/** - * Sends a message through this switchboard. - * - * @param swboard The switchboard. - * @param msg The message. - * @param queue A flag that states if we want this message to be queued (in - * the case it cannot currently be sent). - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue); - -gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard); -gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who); - -void msn_switchboard_request(MsnSwitchBoard *swboard); -void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user); - -/** - * Processes peer to peer messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes emoticon messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes INVITE messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Shows an ink message from this switchboard. - * - * @param swboard The switchboard. - * @param passport The user that sent the ink. - * @param data The ink data. - */ -void msn_switchboard_show_ink(MsnSwitchBoard *swboard, const char *passport, - const char *data); - -#endif /* _MSN_SWITCHBOARD_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,253 +0,0 @@ -/** - * @file sync.c MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "sync.h" -#include "state.h" - -static MsnTable *cbs_table; - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc = cmdproc->session->account->gc; - const char *list_name; - - list_name = cmd->params[0]; - - if (!g_ascii_strcasecmp(list_name, "AL")) - { - /* - * If the current setting is AL, messages from users who - * are not in BL will be delivered. - * - * In other words, deny some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - else - { - /* If the current setting is BL, only messages from people - * who are in the AL will be delivered. - * - * In other words, permit some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - type = cmd->params[0]; - value = cmd->params[1]; - - if (cmd->param_count == 2) - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *name; - const char *group_id; - - group_id = cmd->params[0]; - name = purple_url_decode(cmd->params[1]); - - msn_group_new(session->userlist, group_id, name); - - /* HACK */ - if (group_id == 0) - { - /* Group of ungroupped buddies */ - if (session->sync->total_users == 0) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } - return; - } - - if ((purple_find_group(name)) == NULL) - { - PurpleGroup *g = purple_group_new(name); - purple_blist_add_group(g, NULL); - } -} - -static void -lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - char *passport = NULL; - const char *friend = NULL; - int list_op; - MsnUser *user; - - passport = cmd->params[0]; - friend = purple_url_decode(cmd->params[1]); - list_op = atoi(cmd->params[2]); - - user = msn_user_new(session->userlist, passport, friend); - - msn_userlist_add_user(session->userlist, user); - - session->sync->last_user = user; - - /* TODO: This can be improved */ - - if (list_op & MSN_LIST_FL_OP) - { - char **c; - char **tokens; - const char *group_nums; - GSList *group_ids; - - group_nums = cmd->params[3]; - - group_ids = NULL; - - tokens = g_strsplit(group_nums, ",", -1); - - for (c = tokens; *c != NULL; c++) - { - group_ids = g_slist_append(group_ids, *c); - } - - - msn_got_lst_user(session, user, list_op, group_ids); - - g_strfreev(tokens); - g_slist_free(group_ids); - } - else - { - msn_got_lst_user(session, user, list_op, NULL); - } - - session->sync->num_users++; - - if (session->sync->num_users == session->sync->total_users) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSync *sync = cmdproc->session->sync; - const char *type, *value; - MsnUser *user; - - user = sync->last_user; - - g_return_if_fail(user != NULL); - - type = cmd->params[0]; - value = cmd->params[1]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -void -msn_sync_init(void) -{ - cbs_table = msn_table_new(); - - /* Syncing */ - msn_table_add_cmd(cbs_table, NULL, "GTC", NULL); - msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd); - msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); -} - -void -msn_sync_end(void) -{ - msn_table_destroy(cbs_table); -} - -MsnSync * -msn_sync_new(MsnSession *session) -{ - MsnSync *sync; - - sync = g_new0(MsnSync, 1); - - sync->session = session; - sync->cbs_table = cbs_table; - - return sync; -} - -void -msn_sync_destroy(MsnSync *sync) -{ - g_free(sync); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/sync.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file sync.h MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SYNC_H_ -#define _MSN_SYNC_H_ - -typedef struct _MsnSync MsnSync; - -#include "session.h" -#include "table.h" -#include "user.h" - -struct _MsnSync -{ - MsnSession *session; - MsnTable *cbs_table; - - /* - * TODO: What is the intended purpose of old_cbs_table? Nothing - * sets it and it is only read in two places. - */ - MsnTable *old_cbs_table; - - int num_users; - int total_users; - int num_groups; - int total_groups; - MsnUser *last_user; -}; - -void msn_sync_init(void); -void msn_sync_end(void); - -MsnSync * msn_sync_new(MsnSession *session); -void msn_sync_destroy(MsnSync *sync); - -#endif /* _MSN_SYNC_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file table.c MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "table.h" - -static void -null_cmd_cb(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -} - -static void -null_error_cb(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ -} - -MsnTable * -msn_table_new() -{ - MsnTable *table; - - table = g_new0(MsnTable, 1); - - table->cmds = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_hash_table_destroy); - table->msgs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->errors = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - table->async = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->fallback = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - return table; -} - -void -msn_table_destroy(MsnTable *table) -{ - g_return_if_fail(table != NULL); - - g_hash_table_destroy(table->cmds); - g_hash_table_destroy(table->msgs); - g_hash_table_destroy(table->errors); - - g_hash_table_destroy(table->async); - g_hash_table_destroy(table->fallback); - - g_free(table); -} - -void -msn_table_add_cmd(MsnTable *table, - char *command, char *answer, MsnTransCb cb) -{ - GHashTable *cbs; - - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - cbs = NULL; - - if (command == NULL) - { - cbs = table->async; - } - else if (strcmp(command, "fallback") == 0) - { - cbs = table->fallback; - } - else - { - cbs = g_hash_table_lookup(table->cmds, command); - - if (cbs == NULL) - { - cbs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - g_hash_table_insert(table->cmds, command, cbs); - } - } - - if (cb == NULL) - cb = null_cmd_cb; - - g_hash_table_insert(cbs, answer, cb); -} - -void -msn_table_add_error(MsnTable *table, - char *answer, MsnErrorCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - if (cb == NULL) - cb = null_error_cb; - - g_hash_table_insert(table->errors, answer, cb); -} - -void -msn_table_add_msg_type(MsnTable *table, - char *type, MsnMsgTypeCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(type != NULL); - g_return_if_fail(cb != NULL); - -#if 0 - if (cb == NULL) - cb = null_msg_cb; -#endif - - g_hash_table_insert(table->msgs, type, cb); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/** - * @file table.h MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_TABLE_H_ -#define _MSN_TABLE_H_ - -typedef struct _MsnTable MsnTable; - -#include "cmdproc.h" -#include "transaction.h" -#include "msg.h" - -typedef void (*MsnMsgTypeCb)(MsnCmdProc *cmdproc, MsnMessage *msg); - -struct _MsnTable -{ - GHashTable *cmds; - GHashTable *msgs; - GHashTable *errors; - - GHashTable *async; - GHashTable *fallback; -}; - -MsnTable *msn_table_new(void); -void msn_table_destroy(MsnTable *table); - -void msn_table_add_cmd(MsnTable *table, char *command, char *answer, - MsnTransCb cb); -void msn_table_add_error(MsnTable *table, char *answer, MsnErrorCb cb); -void msn_table_add_msg_type(MsnTable *table, char *type, MsnMsgTypeCb cb); - -#endif /* _MSN_TABLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,231 +0,0 @@ -/** - * @file transaction.c MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "transaction.h" - -MsnTransaction * -msn_transaction_new(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_val_if_fail(command != NULL, NULL); - - trans = g_new0(MsnTransaction, 1); - - trans->cmdproc = cmdproc; - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - /* trans->queue = g_queue_new(); */ - - return trans; -} - -void -msn_transaction_destroy(MsnTransaction *trans) -{ - g_return_if_fail(trans != NULL); - - g_free(trans->command); - g_free(trans->params); - g_free(trans->payload); - - if (trans->data_free) - trans->data_free(trans->data); - -#if 0 - if (trans->pendent_cmd != NULL) - msn_message_unref(trans->pendent_msg); -#endif - -#if 0 - MsnTransaction *elem; - if (trans->queue != NULL) - { - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_transaction_destroy(elem); - - g_queue_free(trans->queue); - } -#endif - - if (trans->callbacks != NULL && trans->has_custom_callbacks) - g_hash_table_destroy(trans->callbacks); - - if (trans->timer) - purple_timeout_remove(trans->timer); - - g_free(trans); -} - -char * -msn_transaction_to_string(MsnTransaction *trans) -{ - char *str; - - g_return_val_if_fail(trans != NULL, FALSE); - - if (trans->params != NULL) - str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params); - else - str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId); - - return str; -} - -void -msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd) -{ - purple_debug_info("msn", "queueing command.\n"); - trans->pendent_cmd = cmd; - msn_command_ref(cmd); -} - -void -msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnCommand *cmd; - - if (!cmdproc->servconn->connected) - return; - - purple_debug_info("msn", "unqueueing command.\n"); - cmd = trans->pendent_cmd; - - g_return_if_fail(cmd != NULL); - - msn_cmdproc_process_cmd(cmdproc, cmd); - msn_command_unref(cmd); - - trans->pendent_cmd = NULL; -} - -#if 0 -void -msn_transaction_queue(MsnTransaction *trans, MsnTransaction *elem) -{ - if (trans->queue == NULL) - trans->queue = g_queue_new(); - - g_queue_push_tail(trans->queue, elem); -} - -void -msn_transaction_unqueue(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnTransaction *elem; - - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_cmdproc_send_trans(cmdproc, elem); -} -#endif - -void -msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(payload != NULL); - - trans->payload = g_strdup(payload); - trans->payload_len = payload_len ? payload_len : strlen(trans->payload); -} - -void -msn_transaction_set_data(MsnTransaction *trans, void *data) -{ - g_return_if_fail(trans != NULL); - - trans->data = data; -} - -void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn) -{ - g_return_if_fail(trans != NULL); - trans->data_free = fn; -} - -void -msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(answer != NULL); - - if (trans->callbacks == NULL) - { - trans->has_custom_callbacks = TRUE; - trans->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - NULL); - } - else if (trans->has_custom_callbacks != TRUE) - g_return_if_reached (); - - g_hash_table_insert(trans->callbacks, answer, cb); -} - -static gboolean -transaction_timeout(gpointer data) -{ - MsnTransaction *trans; - - trans = data; - g_return_val_if_fail(trans != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "timed out: %s %d %s\n", trans->command, trans->trId, trans->params); -#endif - - if (trans->timeout_cb != NULL) - trans->timeout_cb(trans->cmdproc, trans); - - trans->timer = 0; - return FALSE; -} - -void -msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb) -{ - if (trans->timer) - { - purple_debug_error("msn", "This shouldn't be happening\n"); - purple_timeout_remove(trans->timer); - } - trans->timeout_cb = cb; - trans->timer = purple_timeout_add_seconds(60, transaction_timeout, trans); -} - -void -msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb) -{ - trans->error_cb = cb; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/transaction.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/** - * @file transaction.h MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_TRANSACTION_H -#define _MSN_TRANSACTION_H - -typedef struct _MsnTransaction MsnTransaction; - -#include "command.h" -#include "cmdproc.h" - -typedef void (*MsnTransCb)(MsnCmdProc *cmdproc, MsnCommand *cmd); -typedef void (*MsnTimeoutCb)(MsnCmdProc *cmdproc, MsnTransaction *trans); -typedef void (*MsnErrorCb)(MsnCmdProc *cmdproc, MsnTransaction *trans, - int error); - -/** - * A transaction. A sending command that will initiate the transaction. - */ -struct _MsnTransaction -{ - MsnCmdProc *cmdproc; - unsigned int trId; - - char *command; - char *params; - - guint timer; - - void *data; /**< The data to be used on the different callbacks. */ - GDestroyNotify data_free; /**< The function to free 'data', or @c NULL */ - - GHashTable *callbacks; - gboolean has_custom_callbacks; - MsnErrorCb error_cb; - MsnTimeoutCb timeout_cb; - - char *payload; - size_t payload_len; - - GQueue *queue; - MsnCommand *pendent_cmd; /**< The command that is waiting for the result of - this transaction. */ -}; - -MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) G_GNUC_PRINTF(3, 4); -void msn_transaction_destroy(MsnTransaction *trans); - -char *msn_transaction_to_string(MsnTransaction *trans); -void msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd); -void msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc); -void msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len); -void msn_transaction_set_data(MsnTransaction *trans, void *data); -void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn); -void msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb); -void msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb); -void msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb); - -#endif /* _MSN_TRANSACTION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,513 +0,0 @@ -/** - * @file user.c User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "user.h" -#include "slp.h" - -/*new a user object*/ -MsnUser * -msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name) -{ - MsnUser *user; - - user = g_new0(MsnUser, 1); - - user->userlist = userlist; - - msn_user_set_passport(user, passport); - msn_user_set_friendly_name(user, friendly_name); - - return user; -} - -/*destroy a user object*/ -void -msn_user_destroy(MsnUser *user) -{ - g_return_if_fail(user != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - if (user->group_ids != NULL) - { - GList *l; - for (l = user->group_ids; l != NULL; l = l->next) - { - g_free(l->data); - } - g_list_free(user->group_ids); - } - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - g_free(user->passport); - g_free(user->friendly_name); - g_free(user->uid); - g_free(user->phone.home); - g_free(user->phone.work); - g_free(user->phone.mobile); - g_free(user->media.artist); - g_free(user->media.title); - g_free(user->media.album); - g_free(user->statusline); - g_free(user->invite_message); - - g_free(user); -} - -void -msn_user_update(MsnUser *user) -{ - PurpleAccount *account; - gboolean offline; - - g_return_if_fail(user != NULL); - - account = user->userlist->session->account; - - offline = (user->status == NULL); - - if (!offline) { - purple_prpl_got_user_status(account, user->passport, user->status, - "message", user->statusline, NULL); - } else { - if (user->mobile) { - purple_prpl_got_user_status(account, user->passport, "mobile", NULL); - purple_prpl_got_user_status(account, user->passport, "available", NULL); - } else { - purple_prpl_got_user_status(account, user->passport, "offline", NULL); - } - } - - if (!offline || !user->mobile) { - purple_prpl_got_user_status_deactive(account, user->passport, "mobile"); - } - - if (!offline && user->media.type != CURRENT_MEDIA_UNKNOWN) { - if (user->media.type == CURRENT_MEDIA_MUSIC) { - purple_prpl_got_user_status(account, user->passport, "tune", - PURPLE_TUNE_ARTIST, user->media.artist, - PURPLE_TUNE_ALBUM, user->media.album, - PURPLE_TUNE_TITLE, user->media.title, - NULL); - } else if (user->media.type == CURRENT_MEDIA_GAMES) { - purple_prpl_got_user_status(account, user->passport, "tune", - "game", user->media.title, - NULL); - } else if (user->media.type == CURRENT_MEDIA_OFFICE) { - purple_prpl_got_user_status(account, user->passport, "tune", - "office", user->media.title, - NULL); - } else { - purple_debug_warning("msn", "Got CurrentMedia with unknown type %d.\n", - user->media.type); - } - } else { - purple_prpl_got_user_status_deactive(account, user->passport, "tune"); - } - - if (user->idle) - purple_prpl_got_user_idle(account, user->passport, TRUE, -1); - else - purple_prpl_got_user_idle(account, user->passport, FALSE, 0); -} - -void -msn_user_set_state(MsnUser *user, const char *state) -{ - const char *status; - - g_return_if_fail(user != NULL); - - if (state == NULL) { - user->status = NULL; - return; - } - - if (!g_ascii_strcasecmp(state, "BSY")) - status = "busy"; - else if (!g_ascii_strcasecmp(state, "BRB")) - status = "brb"; - else if (!g_ascii_strcasecmp(state, "AWY")) - status = "away"; - else if (!g_ascii_strcasecmp(state, "PHN")) - status = "phone"; - else if (!g_ascii_strcasecmp(state, "LUN")) - status = "lunch"; - else - status = "available"; - - if (!g_ascii_strcasecmp(state, "IDL")) - user->idle = TRUE; - else - user->idle = FALSE; - - user->status = status; -} - -void -msn_user_set_passport(MsnUser *user, const char *passport) -{ - g_return_if_fail(user != NULL); - - g_free(user->passport); - user->passport = g_strdup(passport); -} - -gboolean -msn_user_set_friendly_name(MsnUser *user, const char *name) -{ - g_return_val_if_fail(user != NULL, FALSE); - - if (user->friendly_name && name && (!strcmp(user->friendly_name, name) || - !strcmp(user->passport, name))) - return FALSE; - - g_free(user->friendly_name); - user->friendly_name = g_strdup(name); - - serv_got_alias(purple_account_get_connection(user->userlist->session->account), - user->passport, name); - return TRUE; -} - -void -msn_user_set_statusline(MsnUser *user, const char *statusline) -{ - g_return_if_fail(user != NULL); - - g_free(user->statusline); - user->statusline = g_strdup(statusline); -} - -void -msn_user_set_currentmedia(MsnUser *user, const CurrentMedia *media) -{ - g_return_if_fail(user != NULL); - - g_free(user->media.title); - g_free(user->media.album); - g_free(user->media.artist); - - user->media.type = media ? media->type : CURRENT_MEDIA_UNKNOWN; - user->media.title = media ? g_strdup(media->title) : NULL; - user->media.artist = media ? g_strdup(media->artist) : NULL; - user->media.album = media ? g_strdup(media->album) : NULL; -} - -void -msn_user_set_uid(MsnUser *user, const char *uid) -{ - g_return_if_fail(user != NULL); - - g_free(user->uid); - user->uid = g_strdup(uid); -} - -void -msn_user_set_op(MsnUser *user, int list_op) -{ - g_return_if_fail(user != NULL); - - user->list_op |= list_op; -} - -void -msn_user_unset_op(MsnUser *user, int list_op) -{ - g_return_if_fail(user != NULL); - - user->list_op &= ~list_op; -} - -void -msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img) -{ - MsnObject *msnobj; - - g_return_if_fail(user != NULL); - - msnobj = msn_object_new_from_image(img, "TFR2C2.tmp", - user->passport, MSN_OBJECT_USERTILE); - - if (!msnobj) - purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport); - - msn_user_set_object(user, msnobj); -} - -/*add group id to User object*/ -void -msn_user_add_group_id(MsnUser *user, const char* group_id) -{ - MsnUserList *userlist; - PurpleAccount *account; - PurpleBuddy *b; - PurpleGroup *g; - const char *passport; - const char *group_name; - - g_return_if_fail(user != NULL); - g_return_if_fail(group_id != NULL); - - user->group_ids = g_list_append(user->group_ids, g_strdup(group_id)); - - userlist = user->userlist; - account = userlist->session->account; - passport = msn_user_get_passport(user); - - group_name = msn_userlist_find_group_name(userlist, group_id); - - purple_debug_info("msn", "User: group id:%s,name:%s,user:%s\n", group_id, group_name, passport); - - g = purple_find_group(group_name); - - if ((group_id == NULL) && (g == NULL)) - { - g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - } - - b = purple_find_buddy_in_group(account, passport, g); - if (b == NULL) - { - b = purple_buddy_new(account, passport, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - purple_buddy_set_protocol_data(b, user); - /*Update the blist Node info*/ -} - -/*check if the msn user is online*/ -gboolean -msn_user_is_online(PurpleAccount *account, const char *name) -{ - PurpleBuddy *buddy; - - buddy = purple_find_buddy(account, name); - return PURPLE_BUDDY_IS_ONLINE(buddy); -} - -gboolean -msn_user_is_yahoo(PurpleAccount *account, const char *name) -{ - MsnSession *session = NULL; - MsnUser *user; - PurpleConnection *gc; - - gc = purple_account_get_connection(account); - if (gc != NULL) - session = gc->proto_data; - - if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL) - { - return (user->networkid == MSN_NETWORK_YAHOO); - } - return (strstr(name,"@yahoo.") != NULL); -} - -void -msn_user_remove_group_id(MsnUser *user, const char *id) -{ - GList *l; - - g_return_if_fail(user != NULL); - g_return_if_fail(id != NULL); - - l = g_list_find_custom(user->group_ids, id, (GCompareFunc)strcmp); - - if (l == NULL) - return; - - g_free(l->data); - user->group_ids = g_list_delete_link(user->group_ids, l); -} - -void -msn_user_set_pending_group(MsnUser *user, const char *group) -{ - user->pending_group = g_strdup(group); -} - -char * -msn_user_remove_pending_group(MsnUser *user) -{ - char *group = user->pending_group; - user->pending_group = NULL; - return group; -} - -void -msn_user_set_home_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - g_free(user->phone.home); - user->phone.home = g_strdup(number); -} - -void -msn_user_set_work_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - g_free(user->phone.work); - user->phone.work = g_strdup(number); -} - -void -msn_user_set_mobile_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - g_free(user->phone.mobile); - user->phone.mobile = g_strdup(number); -} - -void -msn_user_set_clientid(MsnUser *user, guint clientid) -{ - g_return_if_fail(user != NULL); - - user->clientid = clientid; -} - -void -msn_user_set_network(MsnUser *user, MsnNetwork network) -{ - g_return_if_fail(user != NULL); - - user->networkid = network; -} - -void -msn_user_set_object(MsnUser *user, MsnObject *obj) -{ - g_return_if_fail(user != NULL); - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - user->msnobj = obj; - - if (user->list_op & MSN_LIST_FL_OP) - msn_queue_buddy_icon_request(user); -} - -void -msn_user_set_client_caps(MsnUser *user, GHashTable *info) -{ - g_return_if_fail(user != NULL); - g_return_if_fail(info != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - user->clientcaps = info; -} - -void -msn_user_set_invite_message(MsnUser *user, const char *message) -{ - g_return_if_fail(user != NULL); - - g_free(user->invite_message); - user->invite_message = g_strdup(message); -} - -const char * -msn_user_get_passport(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->passport; -} - -const char * -msn_user_get_friendly_name(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->friendly_name; -} - -const char * -msn_user_get_home_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.home; -} - -const char * -msn_user_get_work_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.work; -} - -const char * -msn_user_get_mobile_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.mobile; -} - -guint -msn_user_get_clientid(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, 0); - - return user->clientid; -} - -MsnObject * -msn_user_get_object(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->msnobj; -} - -GHashTable * -msn_user_get_client_caps(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->clientcaps; -} - -const char * -msn_user_get_invite_message(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->invite_message; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,412 +0,0 @@ -/** - * @file user.h User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_USER_H_ -#define _MSN_USER_H_ - -typedef struct _MsnUser MsnUser; - -#include "session.h" -#include "object.h" - -#include "userlist.h" - -typedef enum -{ - MSN_NETWORK_UNKNOWN = 0x00, - MSN_NETWORK_PASSPORT = 0x01, - MSN_NETWORK_COMMUNICATOR = 0x02, - MSN_NETWORK_MOBILE = 0x04, - MSN_NETWORK_MNI = 0x08, - MSN_NETWORK_SMTP = 0x10, - MSN_NETWORK_YAHOO = 0x20 -} MsnNetwork; - -/** - * Current media. - */ -typedef enum -{ - CURRENT_MEDIA_UNKNOWN, - CURRENT_MEDIA_MUSIC, - CURRENT_MEDIA_GAMES, - CURRENT_MEDIA_OFFICE -} CurrentMediaType; - -typedef struct _CurrentMedia -{ - CurrentMediaType type; /**< Type. */ - char *title; /**< Title. */ - char *artist; /**< Artist. */ - char *album; /**< Album. */ -} CurrentMedia; - -/** - * A user. - */ -struct _MsnUser -{ - MsnUserList *userlist; - - char *passport; /**< The passport account. */ - char *friendly_name; /**< The friendly name. */ - - char * uid; /*< User Id */ - - const char *status; /**< The state of the user. */ - char *statusline; /**< The state of the user. */ - CurrentMedia media; /**< Current media of the user. */ - - gboolean idle; /**< The idle state of the user. */ - - struct - { - char *home; /**< Home phone number. */ - char *work; /**< Work phone number. */ - char *mobile; /**< Mobile phone number. */ - - } phone; - - gboolean authorized; /**< Authorized to add this user. */ - gboolean mobile; /**< Signed up with MSN Mobile. */ - - GList *group_ids; /**< The group IDs. */ - char *pending_group; /**< A pending group to add. */ - - MsnObject *msnobj; /**< The user's MSN Object. */ - - GHashTable *clientcaps; /**< The client's capabilities. */ - - guint clientid; /**< The client's ID */ - - MsnNetwork networkid; /**< The user's network */ - - int list_op; /**< Which lists the user is in */ - - guint membership_id[5]; /**< The membershipId sent by the contacts server, - indexed by the list it belongs to */ - - char *invite_message; /**< Invite message of user request */ -}; - -/************************************************************************** - ** @name User API * - **************************************************************************/ -/*@{*/ - -/** - * Creates a new user structure. - * - * @param session The MSN session. - * @param passport The initial passport. - * @param stored_name The initial stored name. - * - * @return A new user structure. - */ -MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name); - -/** - * Destroys a user structure. - * - * @param user The user to destroy. - */ -void msn_user_destroy(MsnUser *user); - - -/** - * Updates the user. - * - * Communicates with the core to update the ui, etc. - * - * @param user The user to update. - */ -void msn_user_update(MsnUser *user); - - /** - * Sets the new statusline of user. - * - * @param user The user. - * @param state The statusline string. - */ -void msn_user_set_statusline(MsnUser *user, const char *statusline); - - /** - * Sets the current media of user. - * - * @param user The user. - * @param cmedia Current media. - */ -void msn_user_set_currentmedia(MsnUser *user, const CurrentMedia *cmedia); - -/** - * Sets the new state of user. - * - * @param user The user. - * @param state The state string. - */ -void msn_user_set_state(MsnUser *user, const char *state); - -/** - * Sets the passport account for a user. - * - * @param user The user. - * @param passport The passport account. - */ -void msn_user_set_passport(MsnUser *user, const char *passport); - -/** - * Sets the friendly name for a user. - * - * @param user The user. - * @param name The friendly name. - * - * @returns TRUE is name actually changed, FALSE otherwise. - */ -gboolean msn_user_set_friendly_name(MsnUser *user, const char *name); - -/** - * Sets the buddy icon for a local user. - * - * @param user The user. - * @param img The buddy icon image - */ -void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img); - -/** - * Sets the group ID list for a user. - * - * @param user The user. - * @param ids The group ID list. - */ -void msn_user_set_group_ids(MsnUser *user, GList *ids); - -/** - * Adds the group ID for a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_add_group_id(MsnUser *user, const char * id); - -/** - * Removes the group ID from a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_remove_group_id(MsnUser *user, const char * id); - -/** - * Sets the pending group for a user. - * - * @param user The user. - * @param group The group name. - */ -void msn_user_set_pending_group(MsnUser *user, const char *group); - -/** - * Removes the pending group from a user. - * - * @param user The user. - * - * @return Returns the pending group name. - */ -char *msn_user_remove_pending_group(MsnUser *user); - -/** - * Sets the home phone number for a user. - * - * @param user The user. - * @param number The home phone number. - */ -void msn_user_set_home_phone(MsnUser *user, const char *number); - -/** - * Sets the work phone number for a user. - * - * @param user The user. - * @param number The work phone number. - */ -void msn_user_set_work_phone(MsnUser *user, const char *number); - -void msn_user_set_uid(MsnUser *user, const char *uid); - -/** - * Sets the client id for a user. - * - * @param user The user. - * @param clientid The client id. - */ -void msn_user_set_clientid(MsnUser *user, guint clientid); - -/** - * Sets the network id for a user. - * - * @param user The user. - * @param network The network id. - */ -void msn_user_set_network(MsnUser *user, MsnNetwork network); - -/** - * Sets the mobile phone number for a user. - * - * @param user The user. - * @param number The mobile phone number. - */ -void msn_user_set_mobile_phone(MsnUser *user, const char *number); - -/** - * Sets the MSNObject for a user. - * - * @param user The user. - * @param obj The MSNObject. - */ -void msn_user_set_object(MsnUser *user, MsnObject *obj); - -/** - * Sets the client information for a user. - * - * @param user The user. - * @param info The client information. - */ -void msn_user_set_client_caps(MsnUser *user, GHashTable *info); - -/** - * Sets the invite message for a user. - * - * @param user The user. - * @param message The invite message for a user. - */ -void msn_user_set_invite_message(MsnUser *user, const char *message); - - -/** - * Returns the passport account for a user. - * - * @param user The user. - * - * @return The passport account. - */ -const char *msn_user_get_passport(const MsnUser *user); - -/** - * Returns the friendly name for a user. - * - * @param user The user. - * - * @return The friendly name. - */ -const char *msn_user_get_friendly_name(const MsnUser *user); - -/** - * Returns the home phone number for a user. - * - * @param user The user. - * - * @return The user's home phone number. - */ -const char *msn_user_get_home_phone(const MsnUser *user); - -/** - * Returns the work phone number for a user. - * - * @param user The user. - * - * @return The user's work phone number. - */ -const char *msn_user_get_work_phone(const MsnUser *user); - -/** - * Returns the mobile phone number for a user. - * - * @param user The user. - * - * @return The user's mobile phone number. - */ -const char *msn_user_get_mobile_phone(const MsnUser *user); - -/** - * Returns the client id for a user. - * - * @param user The user. - * - * @return The user's client id. - */ -guint msn_user_get_clientid(const MsnUser *user); - -/** - * Returns the network id for a user. - * - * @param user The user. - * - * @return The user's network id. - */ -MsnNetwork msn_user_get_network(const MsnUser *user); - -/** - * Returns the MSNObject for a user. - * - * @param user The user. - * - * @return The MSNObject. - */ -MsnObject *msn_user_get_object(const MsnUser *user); - -/** - * Returns the client information for a user. - * - * @param user The user. - * - * @return The client information. - */ -GHashTable *msn_user_get_client_caps(const MsnUser *user); - -/** - * Returns the invite message for a user. - * - * @param user The user. - * - * @return The user's invite message. - */ -const char *msn_user_get_invite_message(const MsnUser *user); - -/** - * check to see if user is online - */ -gboolean -msn_user_is_online(PurpleAccount *account, const char *name); - -/** - * check to see if user is Yahoo User - */ -gboolean -msn_user_is_yahoo(PurpleAccount *account ,const char *name); - -void msn_user_set_op(MsnUser *user, int list_op); -void msn_user_unset_op(MsnUser *user, int list_op); - -/*@}*/ - - -#endif /* _MSN_USER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,756 +0,0 @@ -/** - * @file userlist.c MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "userlist.h" - -#include "contact.h" - -const char *lists[] = { "FL", "AL", "BL", "RL" }; - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *friendly; - -} MsnPermitAdd; - -/************************************************************************** - * Callbacks - **************************************************************************/ -static void -msn_accept_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - - purple_debug_misc("msn", "Accepted the new buddy: %s\n", pa->who); - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) - { - MsnSession *session = pa->gc->proto_data; - MsnUserList *userlist = session->userlist; - PurpleAccount *account = purple_connection_get_account(pa->gc); - - msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL); - purple_privacy_deny_remove(account, pa->who, TRUE); - purple_privacy_permit_add(account, pa->who, TRUE); - - msn_del_contact_from_list(session, NULL, pa->who, MSN_LIST_PL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -msn_cancel_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - - purple_debug_misc("msn", "Denied the new buddy: %s\n", pa->who); - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) - { - MsnSession *session = pa->gc->proto_data; - MsnUserList *userlist = session->userlist; - MsnCallbackState *state = msn_callback_state_new(session); - - msn_callback_state_set_action(state, MSN_DENIED_BUDDY); - - msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_BL); - msn_del_contact_from_list(session, state, pa->who, MSN_LIST_PL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -got_new_entry(PurpleConnection *gc, const char *passport, const char *friendly, const char *message) -{ - PurpleAccount *acct; - MsnPermitAdd *pa; - - pa = g_new0(MsnPermitAdd, 1); - pa->who = g_strdup(passport); - pa->friendly = g_strdup(friendly); - pa->gc = gc; - - acct = purple_connection_get_account(gc); - purple_account_request_authorization(acct, passport, NULL, friendly, message, - purple_find_buddy(acct, passport) != NULL, - msn_accept_add_cb, msn_cancel_add_cb, pa); - -} - -/************************************************************************** - * Utility functions - **************************************************************************/ - -gboolean -msn_userlist_user_is_in_group(MsnUser *user, const char * group_id) -{ - if (user == NULL) - return FALSE; - - if (group_id == NULL) - return FALSE; - - if (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) - return TRUE; - - return FALSE; -} - -gboolean -msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id) -{ - int list_op; - - if (user == NULL) - return FALSE; - - list_op = 1 << list_id; - - if (user->list_op & list_op) - return TRUE; - else - return FALSE; -} - -/************************************************************************** - * Server functions - **************************************************************************/ - -void -msn_got_lst_user(MsnSession *session, MsnUser *user, - int list_op, GSList *group_ids) -{ - PurpleConnection *gc; - PurpleAccount *account; - const char *passport; - const char *store; - const char *message; - - account = session->account; - gc = purple_account_get_connection(account); - - passport = msn_user_get_passport(user); - store = msn_user_get_friendly_name(user); - message = msn_user_get_invite_message(user); - - msn_user_set_op(user, list_op); - - if (list_op & MSN_LIST_FL_OP) - { - GSList *c; - for (c = group_ids; c != NULL; c = g_slist_next(c)) - { - char *group_id = c->data; - msn_user_add_group_id(user, group_id); - } - - /* FIXME: It might be a real alias */ - /* Umm, what? This might fix bug #1385130 */ - serv_got_alias(gc, passport, store); - } - - if (list_op & MSN_LIST_AL_OP) - { - /* These are users who are allowed to see our status. */ - purple_privacy_deny_remove(account, passport, TRUE); - purple_privacy_permit_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_BL_OP) - { - /* These are users who are not allowed to see our status. */ - purple_privacy_permit_remove(account, passport, TRUE); - purple_privacy_deny_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_RL_OP) - { - /* These are users who have us on their buddy list. */ - /* - * TODO: What is store name set to when this happens? - * For one of my accounts "something@hotmail.com" - * the store name was "something." Maybe we - * should use the friendly name, instead? --KingAnt - */ - - if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) - { -/* got_new_entry(gc, passport, store, NULL); */ - } - } - - if (list_op & MSN_LIST_PL_OP) - { - got_new_entry(gc, passport, store, message); - } -} - -/************************************************************************** - * UserList functions - **************************************************************************/ - -MsnUserList* -msn_userlist_new(MsnSession *session) -{ - MsnUserList *userlist; - - userlist = g_new0(MsnUserList, 1); - - userlist->session = session; - userlist->buddy_icon_requests = g_queue_new(); - - /* buddy_icon_window is the number of allowed simultaneous buddy icon requests. - * XXX With smarter rate limiting code, we could allow more at once... 5 was the limit set when - * we weren't retrieiving any more than 5 per MSN session. */ - userlist->buddy_icon_window = 1; - - return userlist; -} - -void -msn_userlist_destroy(MsnUserList *userlist) -{ - GList *l; - - /*destroy userlist*/ - for (l = userlist->users; l != NULL; l = l->next) - { - msn_user_destroy(l->data); - } - g_list_free(userlist->users); - - /*destroy group list*/ - for (l = userlist->groups; l != NULL; l = l->next) - { - msn_group_destroy(l->data); - } - g_list_free(userlist->groups); - - g_queue_free(userlist->buddy_icon_requests); - - if (userlist->buddy_icon_request_timer) - purple_timeout_remove(userlist->buddy_icon_request_timer); - - g_free(userlist); -} - -MsnUser * -msn_userlist_find_add_user(MsnUserList *userlist,const char *passport,const char *userName) -{ - MsnUser *user; - - user = msn_userlist_find_user(userlist, passport); - if (user == NULL) - { - user = msn_user_new(userlist, passport, userName); - msn_userlist_add_user(userlist, user); - } else { - msn_user_set_friendly_name(user, userName); - } - return user; -} - -void -msn_userlist_add_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_prepend(userlist->users, user); -} - -void -msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_remove(userlist->users, user); -} - -MsnUser * -msn_userlist_find_user(MsnUserList *userlist, const char *passport) -{ - GList *l; - - g_return_val_if_fail(passport != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) - { - MsnUser *user = (MsnUser *)l->data; - - g_return_val_if_fail(user->passport != NULL, NULL); - - if (!g_ascii_strcasecmp(passport, user->passport)){ - return user; - } - } - - return NULL; -} - -MsnUser * -msn_userlist_find_user_with_id(MsnUserList *userlist, const char *uid) -{ - GList *l; - - g_return_val_if_fail(uid != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) { - MsnUser *user = (MsnUser *)l->data; - - if (user->uid == NULL) { - continue; - } - - if ( !g_ascii_strcasecmp(uid, user->uid) ) { - return user; - } - } - - return NULL; -} - -MsnUser * -msn_userlist_find_user_with_mobile_phone(MsnUserList *userlist, const char *number) -{ - GList *l; - - g_return_val_if_fail(number != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) { - MsnUser *user = (MsnUser *)l->data; - - if (user->phone.mobile == NULL) { - continue; - } - - if (!g_ascii_strcasecmp(number, user->phone.mobile)) { - return user; - } - } - - return NULL; -} - -void -msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_append(userlist->groups, group); -} - -void -msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_remove(userlist->groups, group); -} - -MsnGroup * -msn_userlist_find_group_with_id(MsnUserList *userlist, const char * id) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if (!g_ascii_strcasecmp(group->id,id)) - return group; - } - - return NULL; -} - -MsnGroup * -msn_userlist_find_group_with_name(MsnUserList *userlist, const char *name) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if ((group->name != NULL) && !g_ascii_strcasecmp(name, group->name)) - return group; - } - - return NULL; -} - -const char * -msn_userlist_find_group_id(MsnUserList *userlist, const char *group_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_name(userlist, group_name); - - if (group != NULL) - return msn_group_get_id(group); - else - return NULL; -} - -const char * -msn_userlist_find_group_name(MsnUserList *userlist, const char * group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - return msn_group_get_name(group); - else - return NULL; -} - -void -msn_userlist_rename_group_id(MsnUserList *userlist, const char * group_id, - const char *new_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - msn_group_set_name(group, new_name); -} - -void -msn_userlist_remove_group_id(MsnUserList *userlist, const char * group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - { - msn_userlist_remove_group(userlist, group); - msn_group_destroy(group); - } -} - -typedef struct { - MsnSession *session; - char *uid; -} MsnUserlistABData; - -static void -userlist_ab_delete_cb(void *data, int choice) -{ - MsnUserlistABData *ab = (MsnUserlistABData *)data; - - /* msn_delete_contact(ab->session, ab->uid, (gboolean)choice); */ - - g_free(ab->uid); - g_free(ab); -} - -void -msn_userlist_rem_buddy(MsnUserList *userlist, const char *who) -{ - MsnUser *user = NULL; - - g_return_if_fail(userlist != NULL); - g_return_if_fail(userlist->session != NULL); - g_return_if_fail(who != NULL); - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_FL); - - /* delete the contact from address book via soap action */ - if (user != NULL) { - if (0 /*not ready yet*/ && userlist->session->passport_info.email_enabled) { - MsnUserlistABData *ab = g_new0(MsnUserlistABData, 1); - ab->session = userlist->session; - ab->uid = g_strdup(user->uid); /* Not necessary? */ - purple_request_yes_no(userlist->session->account, - _("Delete Buddy from Address Book?"), - _("Do you want to delete this buddy from your address book as well?"), - user->passport, 0, userlist->session->account, user->passport, - NULL, ab, - G_CALLBACK(userlist_ab_delete_cb), G_CALLBACK(userlist_ab_delete_cb)); - } else - msn_delete_contact(userlist->session, user); - } -} - -void -msn_userlist_rem_buddy_from_list(MsnUserList *userlist, const char *who, - MsnListId list_id) -{ - MsnUser *user; - const gchar *list; - MsnListOp list_op = 1 << list_id; - - user = msn_userlist_find_user(userlist, who); - - g_return_if_fail(user != NULL); - - if ( !msn_userlist_user_is_in_list(user, list_id)) { - list = lists[list_id]; - purple_debug_info("msn", "User %s is not in list %s, not removing.\n", who, list); - return; - } - - msn_user_unset_op(user, list_op); - - msn_notification_rem_buddy_from_list(userlist->session->notification, list_id, user); -} - -/*add buddy*/ -void -msn_userlist_add_buddy(MsnUserList *userlist, const char *who, const char *group_name) -{ - MsnUser *user; - MsnCallbackState *state = NULL; - const char *group_id = NULL, *new_group_name; - - new_group_name = group_name == NULL ? MSN_INDIVIDUALS_GROUP_NAME : group_name; - - g_return_if_fail(userlist != NULL); - g_return_if_fail(userlist->session != NULL); - - purple_debug_info("msn", "Add user: %s to group: %s\n", who, new_group_name); - - if (!msn_email_is_valid(who)) - { - /* only notify the user about problems adding to the friends list - * maybe we should do something else for other lists, but it probably - * won't cause too many problems if we just ignore it */ - - char *str = g_strdup_printf(_("Unable to add \"%s\"."), who); - - purple_notify_error(NULL, NULL, str, - _("The username specified is invalid.")); - g_free(str); - - return; - } - - state = msn_callback_state_new(userlist->session); - msn_callback_state_set_who(state, who); - msn_callback_state_set_new_group_name(state, new_group_name); - - group_id = msn_userlist_find_group_id(userlist, new_group_name); - - if (group_id == NULL) - { - /* Whoa, we must add that group first. */ - purple_debug_info("msn", "Adding user %s to a new group, creating group %s first\n", who, new_group_name); - - msn_callback_state_set_action(state, MSN_ADD_BUDDY); - - msn_add_group(userlist->session, state, new_group_name); - return; - } else { - msn_callback_state_set_guid(state, group_id); - } - - /* XXX: adding user here may not be correct (should add them in the - * ACK to the ADL command), but for now we need to make sure they exist - * early enough that the ILN command doesn't screw us up */ - - user = msn_userlist_find_add_user(userlist, who, who); - - if ( msn_userlist_user_is_in_list(user, MSN_LIST_FL) ) { - - purple_debug_info("msn", "User %s already exists\n", who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - - if (msn_userlist_user_is_in_group(user, group_id)) { - purple_debug_info("msn", "User %s is already in group %s, returning\n", who, new_group_name); - msn_callback_state_free(state); - return; - } - } - - purple_debug_info("msn", "Adding user: %s to group id: %s\n", who, group_id); - - msn_callback_state_set_action(state, MSN_ADD_BUDDY); - - /* Add contact in the Contact server with a SOAP request and if - successful, send ADL with MSN_LIST_AL and MSN_LIST_FL and a FQY */ - msn_add_contact_to_group(userlist->session, state, who, group_id); -} - -void -msn_userlist_add_buddy_to_list(MsnUserList *userlist, const char *who, - MsnListId list_id) -{ - MsnUser *user = NULL; - const gchar *list; - MsnListOp list_op = 1 << list_id; - - g_return_if_fail(userlist != NULL); - - user = msn_userlist_find_add_user(userlist, who, who); - - /* First we're going to check if it's already there. */ - if (msn_userlist_user_is_in_list(user, list_id)) - { - list = lists[list_id]; - purple_debug_info("msn", "User '%s' is already in list: %s\n", who, list); - return; - } - - /* XXX: see XXX above, this should really be done when we get the response from - the server */ - - msn_user_set_op(user, list_op); - - msn_notification_add_buddy_to_list(userlist->session->notification, list_id, user); -} - -gboolean -msn_userlist_add_buddy_to_group(MsnUserList *userlist, const char *who, - const char *group_name) -{ - MsnUser *user; - gchar * group_id; - - g_return_val_if_fail(userlist != NULL, FALSE); - g_return_val_if_fail(group_name != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - purple_debug_info("msn", "Adding buddy with passport %s to group %s\n", who, group_name); - - if ( (group_id = (gchar *)msn_userlist_find_group_id(userlist, group_name)) == NULL) { - purple_debug_error("msn", "Group %s has no guid!\n", group_name); - return FALSE; - } - - if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { - purple_debug_error("msn", "User %s not found!\n", who); - return FALSE; - } - - msn_user_add_group_id(user, group_id); - - return TRUE; -} - - -gboolean -msn_userlist_rem_buddy_from_group(MsnUserList *userlist, const char *who, - const char *group_name) -{ - const gchar * group_id; - MsnUser *user; - - g_return_val_if_fail(userlist != NULL, FALSE); - g_return_val_if_fail(group_name != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - purple_debug_info("msn", "Removing buddy with passport %s from group %s\n", who, group_name); - - if ( (group_id = msn_userlist_find_group_id(userlist, group_name)) == NULL) { - purple_debug_error("msn", "Group %s has no guid!\n", group_name); - return FALSE; - } - - if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { - purple_debug_error("msn", "User %s not found!\n", who); - return FALSE; - } - - msn_user_remove_group_id(user, group_id); - - return TRUE; -} - -void -msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, const char *new_group_name) -{ - const char *new_group_id; - MsnCallbackState *state; - - g_return_if_fail(userlist != NULL); - g_return_if_fail(userlist->session != NULL); - - state = msn_callback_state_new(userlist->session); - msn_callback_state_set_who(state, who); - msn_callback_state_set_action(state, MSN_MOVE_BUDDY); - msn_callback_state_set_old_group_name(state, old_group_name); - msn_callback_state_set_new_group_name(state, new_group_name); - - new_group_id = msn_userlist_find_group_id(userlist, new_group_name); - - if (new_group_id == NULL) - { - msn_add_group(userlist->session, state, new_group_name); - return; - } - - /* add the contact to the new group, and remove it from the old one in - * the callback - */ - msn_add_contact_to_group(userlist->session, state, who, new_group_id); -} - -/*load userlist from the Blist file cache*/ -void -msn_userlist_load(MsnSession *session) -{ - PurpleAccount *account = session->account; - PurpleConnection *gc = purple_account_get_connection(account); - GSList *l; - MsnUser * user; - - g_return_if_fail(gc != NULL); - - for (l = purple_find_buddies(account, NULL); l != NULL; - l = g_slist_delete_link(l, l)) { - PurpleBuddy *buddy = l->data; - - user = msn_userlist_find_add_user(session->userlist, - purple_buddy_get_name(buddy), NULL); - purple_buddy_set_protocol_data(buddy, user); - msn_user_set_op(user, MSN_LIST_FL_OP); - } - for (l = session->account->permit; l != NULL; l = l->next) - { - user = msn_userlist_find_add_user(session->userlist, - (char *)l->data,NULL); - msn_user_set_op(user, MSN_LIST_AL_OP); - } - for (l = session->account->deny; l != NULL; l = l->next) - { - user = msn_userlist_find_add_user(session->userlist, - (char *)l->data,NULL); - msn_user_set_op(user, MSN_LIST_BL_OP); - } - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msn/userlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file userlist.h MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_USERLIST_H_ -#define _MSN_USERLIST_H_ - -typedef struct _MsnUserList MsnUserList; - -#include "user.h" -#include "group.h" - -typedef enum -{ - MSN_LIST_FL, - MSN_LIST_AL, - MSN_LIST_BL, - MSN_LIST_RL, - MSN_LIST_PL - -} MsnListId; - - -struct _MsnUserList -{ - MsnSession *session; - - GList *users; /* Contains MsnUsers */ - GList *groups; /* Contains MsnGroups */ - - GQueue *buddy_icon_requests; - int buddy_icon_window; - guint buddy_icon_request_timer; - -}; - -gboolean msn_userlist_user_is_in_group(MsnUser *user, const char * group_id); -gboolean msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id); - -void msn_got_lst_user(MsnSession *session, MsnUser *user, - int list_op, GSList *group_ids); - -MsnUserList *msn_userlist_new(MsnSession *session); -void msn_userlist_destroy(MsnUserList *userlist); - -void msn_userlist_add_user(MsnUserList *userlist, MsnUser *user); -void msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user); - -MsnUser * msn_userlist_find_user(MsnUserList *userlist, const char *passport); -MsnUser * msn_userlist_find_add_user(MsnUserList *userlist, - const char *passport, const char *userName); -MsnUser * msn_userlist_find_user_with_id(MsnUserList *userlist, const char *uid); -MsnUser * msn_userlist_find_user_with_mobile_phone(MsnUserList *userlist, const char *number); - -void msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group); -void msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group); -MsnGroup *msn_userlist_find_group_with_id(MsnUserList *userlist, const char *id); -MsnGroup *msn_userlist_find_group_with_name(MsnUserList *userlist, const char *name); -const char * msn_userlist_find_group_id(MsnUserList *userlist, - const char *group_name); -const char *msn_userlist_find_group_name(MsnUserList *userlist, const char *group_id); -void msn_userlist_rename_group_id(MsnUserList *userlist, const char *group_id, - const char *new_name); -void msn_userlist_remove_group_id(MsnUserList *userlist, const char *group_id); - -void msn_userlist_rem_buddy(MsnUserList *userlist, const char *who); -void msn_userlist_add_buddy(MsnUserList *userlist, - const char *who, const char *group_name); -void msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, - const char *new_group_name); - -gboolean msn_userlist_add_buddy_to_group(MsnUserList *userlist, const char *who, - const char *group_name); -gboolean msn_userlist_rem_buddy_from_group(MsnUserList *userlist, - const char *who, - const char *group_name); - -void msn_userlist_add_buddy_to_list(MsnUserList *userlist, const char *who, - MsnListId list_id); -void msn_userlist_rem_buddy_from_list(MsnUserList *userlist, const char *who, - MsnListId list_id); - -void msn_userlist_load(MsnSession *session); - -#endif /* _MSN_USERLIST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,344 +0,0 @@ -/** - * @file cmdproc.c MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "cmdproc.h" - -MsnCmdProc * -msn_cmdproc_new(MsnSession *session) -{ - MsnCmdProc *cmdproc; - - cmdproc = g_new0(MsnCmdProc, 1); - - cmdproc->session = session; - cmdproc->txqueue = g_queue_new(); - cmdproc->history = msn_history_new(); - - return cmdproc; -} - -void -msn_cmdproc_destroy(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(cmdproc->txqueue); - - msn_history_destroy(cmdproc->history); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - g_free(cmdproc); -} - -void -msn_cmdproc_process_queue(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - g_queue_push_tail(cmdproc->txqueue, trans); -} - -static void -show_debug_cmd(MsnCmdProc *cmdproc, gboolean incoming, const char *command) -{ - MsnServConn *servconn; - const char *names[] = { "NS", "SB" }; - char *show; - char tmp; - size_t len; - - servconn = cmdproc->servconn; - len = strlen(command); - show = g_strdup(command); - - tmp = (incoming) ? 'S' : 'C'; - - if ((show[len - 1] == '\n') && (show[len - 2] == '\r')) - { - show[len - 2] = '\0'; - } - - purple_debug_misc("msn", "%c: %s %03d: %s\n", tmp, - names[servconn->type], servconn->num, show); - - g_free(show); -} - -void -msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnServConn *servconn; - char *data; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - msn_history_add(cmdproc->history, trans); - - data = msn_transaction_to_string(trans); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - if (trans->callbacks == NULL) - trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds, - trans->command); - - if (trans->payload != NULL) - { - data = g_realloc(data, len + trans->payload_len); - memcpy(data + len, trans->payload, trans->payload_len); - len += trans->payload_len; - - /* - * We're done with trans->payload. Free it so that the memory - * doesn't sit around in cmdproc->history. - */ - g_free(trans->payload); - trans->payload = NULL; - trans->payload_len = 0; - } - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnServConn *servconn; - char *data; - char *params = NULL; - va_list arg; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - if (format != NULL) - { - va_start(arg, format); - params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - if (params != NULL) - data = g_strdup_printf("%s %s\r\n", command, params); - else - data = g_strdup_printf("%s\r\n", command); - - g_free(params); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - if (!cmdproc->servconn->connected) - return; - - trans = g_new0(MsnTransaction, 1); - - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload, - int payload_len) -{ - MsnCommand *last; - - g_return_if_fail(cmdproc != NULL); - - last = cmdproc->last_cmd; - last->payload = g_memdup(payload, payload_len); - last->payload_len = payload_len; - - if (last->payload_cb != NULL) - last->payload_cb(cmdproc, last, payload, payload_len); -} - -void -msn_cmdproc_process_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnMsgTypeCb cb; - - if (msn_message_get_content_type(msg) == NULL) - { - purple_debug_misc("msn", "failed to find message content\n"); - return; - } - - cb = g_hash_table_lookup(cmdproc->cbs_table->msgs, - msn_message_get_content_type(msg)); - - if (cb == NULL) - { - purple_debug_warning("msn", "Unhandled content-type '%s'\n", - msn_message_get_content_type(msg)); - - return; - } - - cb(cmdproc, msg); -} - -void -msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransCb cb = NULL; - MsnTransaction *trans = NULL; - - if (cmd->trId) - trans = msn_history_find(cmdproc->history, cmd->trId); - - if (trans != NULL) - if (trans->timer) - purple_timeout_remove(trans->timer); - - if (g_ascii_isdigit(cmd->command[0])) - { - if (trans != NULL) - { - MsnErrorCb error_cb = NULL; - int error; - - error = atoi(cmd->command); - - if (trans->error_cb != NULL) - error_cb = trans->error_cb; - - if (error_cb == NULL && cmdproc->cbs_table->errors != NULL) - error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command); - - if (error_cb != NULL) - { - error_cb(cmdproc, trans, error); - } - else - { -#if 1 - msn_error_handle(cmdproc->session, error); -#else - purple_debug_warning("msn", "Unhandled error '%s'\n", - cmd->command); -#endif - } - - return; - } - } - - if (cmdproc->cbs_table->async != NULL) - cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command); - - if (cb == NULL && trans != NULL) - { - cmd->trans = trans; - - if (trans->callbacks != NULL) - cb = g_hash_table_lookup(trans->callbacks, cmd->command); - } - - if (cb == NULL && cmdproc->cbs_table->fallback != NULL) - cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command); - - if (cb != NULL) - { - cb(cmdproc, cmd); - } - else - { - purple_debug_warning("msn", "Unhandled command '%s'\n", - cmd->command); - } - - if (trans != NULL && trans->pendent_cmd != NULL) - msn_transaction_unqueue_cmd(trans, cmdproc); -} - -void -msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command) -{ - show_debug_cmd(cmdproc, TRUE, command); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - cmdproc->last_cmd = msn_command_from_string(command); - - msn_cmdproc_process_cmd(cmdproc, cmdproc->last_cmd); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/cmdproc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/** - * @file cmdproc.h MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_CMDPROC_H_ -#define _MSN_CMDPROC_H_ - -typedef struct _MsnCmdProc MsnCmdProc; - -#include "session.h" -#include "servconn.h" -#include "error.h" -#include "command.h" -#include "table.h" -#include "history.h" - -struct _MsnCmdProc -{ - MsnSession *session; - MsnServConn *servconn; - - GQueue *txqueue; - - MsnCommand *last_cmd; - - MsnTable *cbs_table; - - MsnHistory *history; - - void *data; /**< Extra data, like the switchboard. */ -}; - -MsnCmdProc *msn_cmdproc_new(MsnSession *session); -void msn_cmdproc_destroy(MsnCmdProc *cmdproc); - -void msn_cmdproc_process_queue(MsnCmdProc *cmdproc); - -void msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); -void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, - MsnTransaction *trans); -void msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); -void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); - -void msn_cmdproc_process_msg(MsnCmdProc *cmdproc, - MsnMessage *msg); -void msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd); -void msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command); -void msn_cmdproc_process_payload(MsnCmdProc *cmdproc, - char *payload, int payload_len); - -void msn_cmdproc_disconnect(MsnCmdProc *cmdproc); - -#endif /* _MSN_CMDPROC_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -/** - * @file command.c MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "command.h" - -static gboolean -is_num(char *str) -{ - char *c; - for (c = str; *c; c++) { - if (!(g_ascii_isdigit(*c))) - return FALSE; - } - - return TRUE; -} - -MsnCommand * -msn_command_from_string(const char *string) -{ - MsnCommand *cmd; - char *tmp; - char *param_start; - - g_return_val_if_fail(string != NULL, NULL); - - tmp = g_strdup(string); - param_start = strchr(tmp, ' '); - - cmd = g_new0(MsnCommand, 1); - cmd->command = tmp; - - if (param_start) - { - *param_start++ = '\0'; - cmd->params = g_strsplit(param_start, " ", 0); - } - - if (cmd->params != NULL) - { - int c; - - for (c = 0; cmd->params[c]; c++); - cmd->param_count = c; - - if (cmd->param_count) { - char *param = cmd->params[0]; - cmd->trId = is_num(param) ? atoi(param) : 0; - } else { - cmd->trId = 0; - } - } - else - cmd->trId = 0; - - msn_command_ref(cmd); - - return cmd; -} - -void -msn_command_destroy(MsnCommand *cmd) -{ - g_return_if_fail(cmd != NULL); - - if (cmd->ref_count > 0) - { - msn_command_unref(cmd); - return; - } - - if (cmd->payload != NULL) - g_free(cmd->payload); - - g_free(cmd->command); - g_strfreev(cmd->params); - g_free(cmd); -} - -MsnCommand * -msn_command_ref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - - cmd->ref_count++; - return cmd; -} - -MsnCommand * -msn_command_unref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - g_return_val_if_fail(cmd->ref_count > 0, NULL); - - cmd->ref_count--; - - if (cmd->ref_count == 0) - { - msn_command_destroy(cmd); - return NULL; - } - - return cmd; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/command.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/** - * @file command.h MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_COMMAND_H -#define _MSN_COMMAND_H - -typedef struct _MsnCommand MsnCommand; - -#include "cmdproc.h" -#include "transaction.h" - -typedef void (*MsnPayloadCb)(MsnCmdProc *cmdproc, MsnCommand *cmd, - char *payload, size_t len); - -/** - * A received command. - */ -struct _MsnCommand -{ - unsigned int trId; - - char *command; - char **params; - int param_count; - - int ref_count; - - MsnTransaction *trans; - - char *payload; - size_t payload_len; - - MsnPayloadCb payload_cb; -}; - -MsnCommand *msn_command_from_string(const char *string); -void msn_command_destroy(MsnCommand *cmd); -MsnCommand *msn_command_ref(MsnCommand *cmd); -MsnCommand *msn_command_unref(MsnCommand *cmd); - -#endif /* _MSN_COMMAND_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/** - * @file dialog.c Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "msn.h" -#include "dialog.h" - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *group; - gboolean add; - -} MsnAddRemData; - -/* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed. - * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */ -static void -msn_complete_sync_issue(MsnAddRemData *data) -{ - PurpleBuddy *buddy; - PurpleGroup *group = NULL; - - if (data->group != NULL) - group = purple_find_group(data->group); - - if (group != NULL) - buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group); - else - buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who); - - if (buddy != NULL) - purple_blist_remove_buddy(buddy); -} - -static void -msn_add_cb(MsnAddRemData *data) -{ - MsnSession *session; - MsnUserList *userlist; - - msn_complete_sync_issue(data); - - session = data->gc->proto_data; - userlist = session->userlist; - - msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group); - - g_free(data->group); - g_free(data->who); - g_free(data); -} - -static void -msn_rem_cb(MsnAddRemData *data) -{ - MsnSession *session; - MsnUserList *userlist; - - msn_complete_sync_issue(data); - - session = data->gc->proto_data; - userlist = session->userlist; - - msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group); - - g_free(data->group); - g_free(data->who); - g_free(data); -} - -void -msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name) -{ - PurpleConnection *gc; - PurpleAccount *account; - MsnAddRemData *data; - char *msg, *reason; - - account = session->account; - gc = purple_account_get_connection(account); - - data = g_new0(MsnAddRemData, 1); - data->who = g_strdup(passport); - data->group = g_strdup(group_name); - data->gc = gc; - - msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - if (group_name != NULL) - { - reason = g_strdup_printf(_("%s on the local list is " - "inside the group \"%s\" but not on " - "the server list. " - "Do you want this buddy to be added?"), - passport, group_name); - } - else - { - reason = g_strdup_printf(_("%s is on the local list but " - "not on the server list. " - "Do you want this buddy to be added?"), - passport); - } - - purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), data->who, NULL, - data, 2, - _("Yes"), G_CALLBACK(msn_add_cb), - _("No"), G_CALLBACK(msn_rem_cb)); - - g_free(reason); - g_free(msg); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/dialog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/** - * @file dialog.h Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_DIALOG_H_ -#define _MSN_DIALOG_H_ - -void msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name); - -#endif /* _MSN_DIALOG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,505 +0,0 @@ -/** - * @file directconn.c MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "directconn.h" - -#include "slp.h" -#include "slpmsg.h" - -/************************************************************************** - * Directconn Specific - **************************************************************************/ - -void -msn_directconn_send_handshake(MsnDirectConn *directconn) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - g_return_if_fail(directconn != NULL); - - slplink = directconn->slplink; - - slpmsg = msn_slpmsg_new(slplink); - slpmsg->flags = 0x100; - - if (directconn->nonce != NULL) - { - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - sscanf (directconn->nonce, "%08X-%04hX-%04hX-%04hX-%012" G_GINT64_MODIFIER "X", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - slpmsg->ack_id = t1; - slpmsg->ack_sub_id = t2 | (t3 << 16); - slpmsg->ack_size = t4 | t5; - } - - g_free(directconn->nonce); - - msn_slplink_send_slpmsg(slplink, slpmsg); - - directconn->acked =TRUE; -} - -/************************************************************************** - * Connection Functions - **************************************************************************/ - -#if 0 -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} -#endif - -static size_t -msn_directconn_write(MsnDirectConn *directconn, - const char *data, size_t len) -{ - char *buffer, *tmp; - size_t buf_size; - size_t ret; - guint32 sent_len; - - g_return_val_if_fail(directconn != NULL, 0); - - buf_size = len + 4; - buffer = tmp = g_malloc(buf_size); - - sent_len = GUINT32_TO_LE(len); - - memcpy(tmp, &sent_len, 4); - tmp += 4; - memcpy(tmp, data, len); - tmp += len; - - ret = write(directconn->fd, buffer, buf_size); - -#ifdef DEBUG_DC - char *str; - str = g_strdup_printf("%s/msntest/w%.4d.bin", g_get_home_dir(), directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(buffer, 1, buf_size, tf); - fclose(tf); - - g_free(str); -#endif - - g_free(buffer); - -#if 0 - /* Let's write the length of the data. */ - ret = write(directconn->fd, &len, sizeof(len)); - - /* Let's write the data. */ - ret = write(directconn->fd, data, len); - - char *str; - str = g_strdup_printf("/home/revo/msntest/w%.4d.bin", directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(&len, 1, sizeof(len), tf); - fwrite(data, 1, len, tf); - fclose(tf); - - g_free(str); -#endif - - directconn->c++; - - return ret; -} - -#if 0 -void -msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce) -{ - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - g_return_if_fail(directconn != NULL); - g_return_if_fail(nonce != NULL); - - sscanf (nonce, "%08X-%04hX-%04hX-%04hX-%012llX", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - directconn->slpheader = g_new0(MsnSlpHeader, 1); - - directconn->slpheader->ack_id = t1; - directconn->slpheader->ack_sub_id = t2 | (t3 << 16); - directconn->slpheader->ack_size = t4 | t5; -} -#endif - -void -msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - char *body; - size_t body_len; - - body = msn_message_gen_slp_body(msg, &body_len); - - msn_directconn_write(directconn, body, body_len); -} - -static void -msn_directconn_process_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - purple_debug_info("msn", "directconn: process_msg\n"); - - msn_slplink_process_msg(directconn->slplink, msg); -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - char *body; - size_t len, body_len; - - purple_debug_info("msn", "read_cb: %d, %d\n", source, cond); - - directconn = data; - - /* Let's read the length of the data. */ - len = read(directconn->fd, &body_len, sizeof(body_len)); - - if (len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - msn_directconn_destroy(directconn); - - return; - } - - body_len = GUINT32_FROM_LE(body_len); - - purple_debug_info("msn", "body_len=%" G_GSIZE_FORMAT "\n", body_len); - - if (body_len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - msn_directconn_destroy(directconn); - - return; - } - - body = g_try_malloc(body_len); - - if (body != NULL) - { - /* Let's read the data. */ - len = read(directconn->fd, body, body_len); - - purple_debug_info("msn", "len=%" G_GSIZE_FORMAT "\n", len); - } - else - { - purple_debug_error("msn", "Failed to allocate memory for read\n"); - len = 0; - } - - if (len > 0) - { - MsnMessage *msg; - -#ifdef DEBUG_DC - str = g_strdup_printf("/home/revo/msntest/r%.4d.bin", directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(body, 1, len, tf); - fclose(tf); - - g_free(str); -#endif - - directconn->c++; - - msg = msn_message_new_msnslp(); - msn_message_parse_slp_body(msg, body, body_len); - - msn_directconn_process_msg(directconn, msg); - } - else - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - msn_directconn_destroy(directconn); - } - - g_free(body); -} - -static void -connect_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - int fd; - - purple_debug_misc("msn", "directconn: connect_cb: %d\n", source); - - directconn = data; - directconn->connect_data = NULL; - - if (TRUE) - { - fd = source; - } - else - { - struct sockaddr_in client_addr; - socklen_t client; - fd = accept (source, (struct sockaddr *)&client_addr, &client); - } - - directconn->fd = fd; - - if (fd > 0) - { - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, read_cb, - directconn); - - if (TRUE) - { - /* Send foo. */ - msn_directconn_write(directconn, "foo", strlen("foo") + 1); - - /* Send Handshake */ - msn_directconn_send_handshake(directconn); - } - else - { - } - } - else - { - /* ERROR */ - purple_debug_error("msn", "could not add input\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - } -} - -static void -directconn_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - if (error_message) - purple_debug_error("msn", "Error making direct connection: %s\n", error_message); - - connect_cb(data, source, PURPLE_INPUT_READ); -} - -gboolean -msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) -{ - MsnSession *session; - - g_return_val_if_fail(directconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, TRUE); - g_return_val_if_fail(port > 0, FALSE); - - session = directconn->slplink->session; - -#if 0 - if (session->http_method) - { - servconn->http_data->gateway_host = g_strdup(host); - } -#endif - - directconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, directconn_connect_cb, directconn); - - return (directconn->connect_data != NULL); -} - -#if 0 -void -msn_directconn_listen(MsnDirectConn *directconn) -{ - int port; - int fd; - - port = 7000; - - for (fd = -1; fd < 0;) - fd = create_listener(++port); - - directconn->fd = fd; - - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, connect_cb, - directconn); - - directconn->port = port; - directconn->c = 0; -} -#endif - -MsnDirectConn* -msn_directconn_new(MsnSlpLink *slplink) -{ - MsnDirectConn *directconn; - - directconn = g_new0(MsnDirectConn, 1); - - directconn->slplink = slplink; - - if (slplink->directconn != NULL) - purple_debug_info("msn", "got_transresp: LEAK\n"); - - slplink->directconn = directconn; - - return directconn; -} - -void -msn_directconn_destroy(MsnDirectConn *directconn) -{ - if (directconn->connect_data != NULL) - purple_proxy_connect_cancel(directconn->connect_data); - - if (directconn->inpa != 0) - purple_input_remove(directconn->inpa); - - if (directconn->fd >= 0) - close(directconn->fd); - - if (directconn->nonce != NULL) - g_free(directconn->nonce); - - directconn->slplink->directconn = NULL; - - g_free(directconn); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/directconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/** - * @file directconn.h MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_DIRECTCONN_H_ -#define _MSN_DIRECTCONN_H_ - -typedef struct _MsnDirectConn MsnDirectConn; - -#include "slplink.h" -#include "slp.h" -#include "msg.h" - -struct _MsnDirectConn -{ - MsnSlpLink *slplink; - MsnSlpCall *initial_call; - - PurpleProxyConnectData *connect_data; - - gboolean acked; - - char *nonce; - - int fd; - - int port; - int inpa; - - int c; -}; - -MsnDirectConn *msn_directconn_new(MsnSlpLink *slplink); -gboolean msn_directconn_connect(MsnDirectConn *directconn, - const char *host, int port); -#if 0 -void msn_directconn_listen(MsnDirectConn *directconn); -#endif -void msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg); -void msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce); -void msn_directconn_destroy(MsnDirectConn *directconn); -void msn_directconn_send_handshake(MsnDirectConn *directconn); - -#endif /* _MSN_DIRECTCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/** - * @file error.c Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "error.h" - -const char * -msn_error_get_text(unsigned int type, gboolean *debug) -{ - static char msg[MSN_BUF_LEN]; - *debug = FALSE; - - switch (type) { - case 0: - g_snprintf(msg, sizeof(msg), - _("Unable to parse message")); - *debug = TRUE; - break; - case 200: - g_snprintf(msg, sizeof(msg), - _("Syntax Error (probably a client bug)")); - *debug = TRUE; - break; - case 201: - g_snprintf(msg, sizeof(msg), - _("Invalid email address")); - break; - case 205: - g_snprintf(msg, sizeof(msg), _("User does not exist")); - break; - case 206: - g_snprintf(msg, sizeof(msg), - _("Fully qualified domain name missing")); - break; - case 207: - g_snprintf(msg, sizeof(msg), _("Already logged in")); - break; - case 208: - g_snprintf(msg, sizeof(msg), _("Invalid username")); - break; - case 209: - g_snprintf(msg, sizeof(msg), _("Invalid friendly name")); - break; - case 210: - g_snprintf(msg, sizeof(msg), _("List full")); - break; - case 215: - g_snprintf(msg, sizeof(msg), _("Already there")); - *debug = TRUE; - break; - case 216: - g_snprintf(msg, sizeof(msg), _("Not on list")); - break; - case 217: - g_snprintf(msg, sizeof(msg), _("User is offline")); - break; - case 218: - g_snprintf(msg, sizeof(msg), _("Already in the mode")); - *debug = TRUE; - break; - case 219: - g_snprintf(msg, sizeof(msg), _("Already in opposite list")); - *debug = TRUE; - break; - case 223: - g_snprintf(msg, sizeof(msg), _("Too many groups")); - break; - case 224: - g_snprintf(msg, sizeof(msg), _("Invalid group")); - break; - case 225: - g_snprintf(msg, sizeof(msg), _("User not in group")); - break; - case 229: - g_snprintf(msg, sizeof(msg), _("Group name too long")); - break; - case 230: - g_snprintf(msg, sizeof(msg), _("Cannot remove group zero")); - *debug = TRUE; - break; - case 231: - g_snprintf(msg, sizeof(msg), - _("Tried to add a user to a group " - "that doesn't exist")); - break; - case 280: - g_snprintf(msg, sizeof(msg), _("Switchboard failed")); - *debug = TRUE; - break; - case 281: - g_snprintf(msg, sizeof(msg), _("Notify transfer failed")); - *debug = TRUE; - break; - - case 300: - g_snprintf(msg, sizeof(msg), _("Required fields missing")); - *debug = TRUE; - break; - case 301: - g_snprintf(msg, sizeof(msg), _("Too many hits to a FND")); - *debug = TRUE; - break; - case 302: - g_snprintf(msg, sizeof(msg), _("Not logged in")); - break; - - case 500: - g_snprintf(msg, sizeof(msg), _("Service temporarily unavailable")); - break; - case 501: - g_snprintf(msg, sizeof(msg), _("Database server error")); - *debug = TRUE; - break; - case 502: - g_snprintf(msg, sizeof(msg), _("Command disabled")); - *debug = TRUE; - break; - case 510: - g_snprintf(msg, sizeof(msg), _("File operation error")); - *debug = TRUE; - break; - case 520: - g_snprintf(msg, sizeof(msg), _("Memory allocation error")); - *debug = TRUE; - break; - case 540: - g_snprintf(msg, sizeof(msg), _("Wrong CHL value sent to server")); - *debug = TRUE; - break; - - case 600: - g_snprintf(msg, sizeof(msg), _("Server busy")); - break; - case 601: - g_snprintf(msg, sizeof(msg), _("Server unavailable")); - break; - case 602: - g_snprintf(msg, sizeof(msg), _("Peer notification server down")); - *debug = TRUE; - break; - case 603: - g_snprintf(msg, sizeof(msg), _("Database connect error")); - *debug = TRUE; - break; - case 604: - g_snprintf(msg, sizeof(msg), - _("Server is going down (abandon ship)")); - break; - case 605: - g_snprintf(msg, sizeof(msg), _("Server unavailable")); - break; - - case 707: - g_snprintf(msg, sizeof(msg), _("Error creating connection")); - *debug = TRUE; - break; - case 710: - g_snprintf(msg, sizeof(msg), - _("CVR parameters are either unknown or not allowed")); - *debug = TRUE; - break; - case 711: - g_snprintf(msg, sizeof(msg), _("Unable to write")); - break; - case 712: - g_snprintf(msg, sizeof(msg), _("Session overload")); - *debug = TRUE; - break; - case 713: - g_snprintf(msg, sizeof(msg), _("User is too active")); - break; - case 714: - g_snprintf(msg, sizeof(msg), _("Too many sessions")); - break; - case 715: - g_snprintf(msg, sizeof(msg), _("Passport not verified")); - break; - case 717: - g_snprintf(msg, sizeof(msg), _("Bad friend file")); - *debug = TRUE; - break; - case 731: - g_snprintf(msg, sizeof(msg), _("Not expected")); - *debug = TRUE; - break; - - case 800: - g_snprintf(msg, sizeof(msg), - _("Friendly name changes too rapidly")); - break; - - case 910: - case 912: - case 918: - case 919: - case 921: - case 922: - g_snprintf(msg, sizeof(msg), _("Server too busy")); - break; - case 911: - case 917: - g_snprintf(msg, sizeof(msg), _("Authentication failed")); - break; - case 913: - g_snprintf(msg, sizeof(msg), _("Not allowed when offline")); - break; - case 914: - case 915: - case 916: - g_snprintf(msg, sizeof(msg), _("Server unavailable")); - break; - case 920: - g_snprintf(msg, sizeof(msg), _("Not accepting new users")); - break; - case 923: - g_snprintf(msg, sizeof(msg), - _("Kids Passport without parental consent")); - break; - case 924: - g_snprintf(msg, sizeof(msg), - _("Passport account not yet verified")); - break; - case 928: - g_snprintf(msg, sizeof(msg), _("Bad ticket")); - *debug = TRUE; - break; - - default: - g_snprintf(msg, sizeof(msg), _("Unknown Error Code %d"), type); - *debug = TRUE; - break; - } - - return msg; -} - -void -msn_error_handle(MsnSession *session, unsigned int type) -{ - char buf[MSN_BUF_LEN]; - gboolean debug; - - g_snprintf(buf, sizeof(buf), _("MSN Error: %s\n"), - msn_error_get_text(type, &debug)); - if (debug) - purple_debug_warning("msn", "error %d: %s\n", type, buf); - else - purple_notify_error(session->account->gc, NULL, buf, NULL); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/error.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - * @file error.h Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_ERROR_H_ -#define _MSN_ERROR_H_ - -#include "session.h" - -/** - * Returns the string representation of an error type. - * - * @param type The error type. - * @param debug Whether this should be treated as a debug log message or a user-visible error - * - * @return The string representation of the error type. - */ -const char *msn_error_get_text(unsigned int type, gboolean *debug); - -/** - * Handles an error. - * - * @param session The current session. - * @param type The error type. - */ -void msn_error_handle(MsnSession *session, unsigned int type); - -#endif /* _MSN_ERROR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/** - * @file group.c Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "group.h" - -MsnGroup * -msn_group_new(MsnUserList *userlist, int id, const char *name) -{ - MsnGroup *group; - - g_return_val_if_fail(id >= 0, NULL); - g_return_val_if_fail(name != NULL, NULL); - - group = g_new0(MsnGroup, 1); - - msn_userlist_add_group(userlist, group); - - group->id = id; - group->name = g_strdup(name); - - return group; -} - -void -msn_group_destroy(MsnGroup *group) -{ - g_return_if_fail(group != NULL); - - g_free(group->name); - g_free(group); -} - -void -msn_group_set_id(MsnGroup *group, int id) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(id >= 0); - - group->id = id; -} - -void -msn_group_set_name(MsnGroup *group, const char *name) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(name != NULL); - - if (group->name != NULL) - g_free(group->name); - - group->name = g_strdup(name); -} - -int -msn_group_get_id(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, -1); - - return group->id; -} - -const char * -msn_group_get_name(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->name; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/** - * @file group.h Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_GROUP_H_ -#define _MSN_GROUP_H_ - -typedef struct _MsnGroup MsnGroup; - -#include - -#include "session.h" -#include "user.h" - -#include "userlist.h" - -/** - * A group. - */ -struct _MsnGroup -{ - MsnSession *session; /**< The MSN session. */ - - int id; /**< The group ID. */ - char *name; /**< The name of the group. */ -}; - -/**************************************************************************/ -/** @name Group API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new group structure. - * - * @param session The MSN session. - * @param id The group ID. - * @param name The name of the group. - * - * @return A new group structure. - */ -MsnGroup *msn_group_new(MsnUserList *userlist, int id, const char *name); - -/** - * Destroys a group structure. - * - * @param group The group to destroy. - */ -void msn_group_destroy(MsnGroup *group); - -/** - * Sets the ID for a group. - * - * @param group The group. - * @param id The ID. - */ -void msn_group_set_id(MsnGroup *group, int id); - -/** - * Sets the name for a group. - * - * @param group The group. - * @param name The name. - */ -void msn_group_set_name(MsnGroup *group, const char *name); - -/** - * Returns the ID for a group. - * - * @param group The group. - * - * @return The ID. - */ -int msn_group_get_id(const MsnGroup *group); - -/** - * Returns the name for a group. - * - * @param group The group. - * - * @return The name. - */ -const char *msn_group_get_name(const MsnGroup *group); -#endif /* _MSN_GROUP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/** - * @file history.c MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "history.h" - -MsnHistory * -msn_history_new(void) -{ - MsnHistory *history = g_new0(MsnHistory, 1); - - history->trId = 1; - - history->queue = g_queue_new(); - - return history; -} - -void -msn_history_destroy(MsnHistory *history) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(history->queue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(history->queue); - g_free(history); -} - -MsnTransaction * -msn_history_find(MsnHistory *history, unsigned int trId) -{ - MsnTransaction *trans; - GList *list; - - for (list = history->queue->head; list != NULL; list = list->next) - { - trans = list->data; - if (trans->trId == trId) - return trans; - } - - return NULL; -} - -void -msn_history_add(MsnHistory *history, MsnTransaction *trans) -{ - GQueue *queue; - - g_return_if_fail(history != NULL); - g_return_if_fail(trans != NULL); - - queue = history->queue; - - trans->trId = history->trId++; - - g_queue_push_tail(queue, trans); - - if (queue->length > MSN_HIST_ELEMS) - { - trans = g_queue_pop_head(queue); - msn_transaction_destroy(trans); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/history.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - * @file history.h MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_HISTORY_H -#define _MSN_HISTORY_H - -#define MSN_HIST_ELEMS 0x30 - -typedef struct _MsnHistory MsnHistory; - -#include "transaction.h" - -/** - * The history. - */ -struct _MsnHistory -{ - GQueue *queue; - unsigned int trId; -}; - -MsnHistory *msn_history_new(void); -void msn_history_destroy(MsnHistory *history); -MsnTransaction *msn_history_find(MsnHistory *history, unsigned int triId); -void msn_history_add(MsnHistory *history, MsnTransaction *trans); - -#endif /* _MSN_HISTORY_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,775 +0,0 @@ -/** - * @file httpmethod.c HTTP connection method - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "debug.h" -#include "httpconn.h" - -typedef struct -{ - MsnHttpConn *httpconn; - char *body; - size_t body_len; -} MsnHttpQueueData; - -static void -msn_httpconn_process_queue(MsnHttpConn *httpconn) -{ - httpconn->waiting_response = FALSE; - - if (httpconn->queue != NULL) - { - MsnHttpQueueData *queue_data; - - queue_data = (MsnHttpQueueData *)httpconn->queue->data; - - httpconn->queue = g_list_remove(httpconn->queue, queue_data); - - msn_httpconn_write(queue_data->httpconn, - queue_data->body, - queue_data->body_len); - - g_free(queue_data->body); - g_free(queue_data); - } -} - -static gboolean -msn_httpconn_parse_data(MsnHttpConn *httpconn, const char *buf, - size_t size, char **ret_buf, size_t *ret_size, - gboolean *error) -{ - const char *s, *c; - char *header, *body; - const char *body_start; - char *tmp; - size_t body_len = 0; - gboolean wasted = FALSE; - - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(buf != NULL, FALSE); - g_return_val_if_fail(size > 0, FALSE); - g_return_val_if_fail(ret_buf != NULL, FALSE); - g_return_val_if_fail(ret_size != NULL, FALSE); - g_return_val_if_fail(error != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "HTTP: parsing data {%s}\n", buf); -#endif - - /* Healthy defaults. */ - body = NULL; - - *ret_buf = NULL; - *ret_size = 0; - *error = FALSE; - - /* First, some tests to see if we have a full block of stuff. */ - if (((strncmp(buf, "HTTP/1.1 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) != 0)) && - ((strncmp(buf, "HTTP/1.0 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.0 100 Continue\r\n", 23) != 0))) - { - *error = TRUE; - - return FALSE; - } - - if (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) == 0) - { - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - return FALSE; - - s += 4; - - if (*s == '\0') - { - *ret_buf = g_strdup(""); - *ret_size = 0; - - msn_httpconn_process_queue(httpconn); - - return TRUE; - } - - buf = s; - size -= (s - buf); - } - - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - /* Need to wait for the full HTTP header to arrive */ - return FALSE; - - s += 4; /* Skip \r\n */ - header = g_strndup(buf, s - buf); - body_start = s; - body_len = size - (body_start - buf); - - if ((s = purple_strcasestr(header, "Content-Length: ")) != NULL) - { - int tmp_len; - - s += strlen("Content-Length: "); - - if ((c = strchr(s, '\r')) == NULL) - { - g_free(header); - - return FALSE; - } - - tmp = g_strndup(s, c - s); - tmp_len = atoi(tmp); - g_free(tmp); - - if (body_len != tmp_len) - { - /* Need to wait for the full packet to arrive */ - - g_free(header); - -#if 0 - purple_debug_warning("msn", - "body length (%d) != content length (%d)\n", - body_len, tmp_len); -#endif - - return FALSE; - } - } - - body = g_malloc0(body_len + 1); - memcpy(body, body_start, body_len); - -#ifdef MSN_DEBUG_HTTP - purple_debug_misc("msn", "Incoming HTTP buffer (header): {%s\r\n}\n", - header); -#endif - - /* Now we should be able to process the data. */ - if ((s = purple_strcasestr(header, "X-MSN-Messenger: ")) != NULL) - { - char *full_session_id, *gw_ip, *session_action; - char *t, *session_id; - char **elems, **cur, **tokens; - - full_session_id = gw_ip = session_action = NULL; - - s += strlen("X-MSN-Messenger: "); - - if ((c = strchr(s, '\r')) == NULL) - { - msn_session_set_error(httpconn->session, - MSN_ERROR_HTTP_MALFORMED, NULL); - purple_debug_error("msn", "Malformed X-MSN-Messenger field.\n{%s}\n", - buf); - - g_free(body); - return FALSE; - } - - tmp = g_strndup(s, c - s); - - elems = g_strsplit(tmp, "; ", 0); - - for (cur = elems; *cur != NULL; cur++) - { - tokens = g_strsplit(*cur, "=", 2); - - if (strcmp(tokens[0], "SessionID") == 0) - full_session_id = tokens[1]; - else if (strcmp(tokens[0], "GW-IP") == 0) - gw_ip = tokens[1]; - else if (strcmp(tokens[0], "Session") == 0) - session_action = tokens[1]; - else - g_free(tokens[1]); - - g_free(tokens[0]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - g_free(tmp); - - if ((session_action != NULL) && (strcmp(session_action, "close") == 0)) - wasted = TRUE; - - g_free(session_action); - - t = strchr(full_session_id, '.'); - session_id = g_strndup(full_session_id, t - full_session_id); - - if (!wasted) - { - g_free(httpconn->full_session_id); - httpconn->full_session_id = full_session_id; - - g_free(httpconn->session_id); - httpconn->session_id = session_id; - - g_free(httpconn->host); - httpconn->host = gw_ip; - } - else - { - MsnServConn *servconn; - - /* It's going to die. */ - /* poor thing */ - - servconn = httpconn->servconn; - - /* I'll be honest, I don't fully understand all this, but this - * causes crashes, Stu. */ - /* if (servconn != NULL) - servconn->wasted = TRUE; */ - - g_free(full_session_id); - g_free(session_id); - g_free(gw_ip); - } - } - - g_free(header); - - *ret_buf = body; - *ret_size = body_len; - - msn_httpconn_process_queue(httpconn); - - return TRUE; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - MsnServConn *servconn; - MsnSession *session; - char buf[MSN_BUF_LEN]; - char *cur, *end, *old_rx_buf; - int len, cur_len; - char *result_msg = NULL; - size_t result_len = 0; - gboolean error = FALSE; - - httpconn = data; - servconn = NULL; - session = httpconn->session; - - len = read(httpconn->fd, buf, sizeof(buf) - 1); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) - { - purple_debug_error("msn", "HTTP: Read error\n"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - buf[len] = '\0'; - - httpconn->rx_buf = g_realloc(httpconn->rx_buf, len + httpconn->rx_len + 1); - memcpy(httpconn->rx_buf + httpconn->rx_len, buf, len + 1); - httpconn->rx_len += len; - - if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len, - &result_msg, &result_len, &error)) - { - /* Either we must wait for more input, or something went wrong */ - if (error) - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - httpconn->servconn->processing = FALSE; - - servconn = httpconn->servconn; - - if (error) - { - purple_debug_error("msn", "HTTP: Special error\n"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - if (result_len == 0) - { - /* Nothing to do here */ -#if 0 - purple_debug_info("msn", "HTTP: nothing to do here\n"); -#endif - g_free(result_msg); - return; - } - - g_free(servconn->rx_buf); - servconn->rx_buf = result_msg; - servconn->rx_len = result_len; - - end = old_rx_buf = servconn->rx_buf; - - servconn->processing = TRUE; - - do - { - cur = end; - - if (servconn->payload_len) - { - if (servconn->payload_len > servconn->rx_len) - /* The payload is still not complete. */ - break; - - cur_len = servconn->payload_len; - end += cur_len; - } - else - { - end = strstr(cur, "\r\n"); - - if (end == NULL) - /* The command is still not complete. */ - break; - - *end = '\0'; - end += 2; - cur_len = end - cur; - } - - servconn->rx_len -= cur_len; - - if (servconn->payload_len) - { - msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len); - servconn->payload_len = 0; - } - else - { - msn_cmdproc_process_cmd_text(servconn->cmdproc, cur); - } - } while (servconn->connected && servconn->rx_len > 0); - - if (servconn->connected) - { - if (servconn->rx_len > 0) - servconn->rx_buf = g_memdup(cur, servconn->rx_len); - else - servconn->rx_buf = NULL; - } - - servconn->processing = FALSE; - - if (servconn->wasted) - msn_servconn_destroy(servconn); - - g_free(old_rx_buf); -} - -static void -httpconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - int ret, writelen; - - httpconn = data; - writelen = purple_circ_buffer_get_max_read(httpconn->tx_buf); - - if (writelen == 0) - { - purple_input_remove(httpconn->tx_handler); - httpconn->tx_handler = 0; - return; - } - - ret = write(httpconn->fd, httpconn->tx_buf->outptr, writelen); - if (ret <= 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - /* Error! */ - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE); - return; - } - - purple_circ_buffer_mark_read(httpconn->tx_buf, ret); - - /* TODO: I don't think these 2 lines are needed. Remove them? */ - if (ret == writelen) - httpconn_write_cb(data, source, cond); -} - -static gboolean -write_raw(MsnHttpConn *httpconn, const char *data, size_t data_len) -{ - ssize_t res; /* result of the write operation */ - - if (httpconn->tx_handler == 0) - res = write(httpconn->fd, data, data_len); - else - { - res = -1; - errno = EAGAIN; - } - - if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) - { - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE); - return FALSE; - } - - if (res < 0 || res < data_len) - { - if (res < 0) - res = 0; - if (httpconn->tx_handler == 0 && httpconn->fd) - httpconn->tx_handler = purple_input_add(httpconn->fd, - PURPLE_INPUT_WRITE, httpconn_write_cb, httpconn); - purple_circ_buffer_append(httpconn->tx_buf, data + res, - data_len - res); - } - - return TRUE; -} - -static char * -msn_httpconn_proxy_auth(MsnHttpConn *httpconn) -{ - PurpleAccount *account; - PurpleProxyInfo *gpi; - const char *username, *password; - char *auth = NULL; - - account = httpconn->session->account; - - gpi = purple_proxy_get_setup(account); - - if (gpi == NULL || !(purple_proxy_info_get_type(gpi) == PURPLE_PROXY_HTTP || - purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_ENVVAR)) - return NULL; - - username = purple_proxy_info_get_username(gpi); - password = purple_proxy_info_get_password(gpi); - - if (username != NULL) { - char *tmp; - auth = g_strdup_printf("%s:%s", username, password ? password : ""); - tmp = purple_base64_encode((const guchar *)auth, strlen(auth)); - g_free(auth); - auth = g_strdup_printf("Proxy-Authorization: Basic %s\r\n", tmp); - g_free(tmp); - } - - return auth; -} - -static gboolean -msn_httpconn_poll(gpointer data) -{ - MsnHttpConn *httpconn; - char *header; - char *auth; - - httpconn = data; - - g_return_val_if_fail(httpconn != NULL, FALSE); - - if ((httpconn->host == NULL) || (httpconn->full_session_id == NULL)) - { - /* There's no need to poll if the session is not fully established */ - return TRUE; - } - - if (httpconn->waiting_response) - { - /* There's no need to poll if we're already waiting for a response */ - return TRUE; - } - - auth = msn_httpconn_proxy_auth(httpconn); - - header = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?Action=poll&SessionID=%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: 0\r\n\r\n", - httpconn->host, - httpconn->full_session_id, - httpconn->host, - auth ? auth : ""); - - g_free(auth); - - if (write_raw(httpconn, header, strlen(header))) - httpconn->waiting_response = TRUE; - - g_free(header); - - return TRUE; -} - -ssize_t -msn_httpconn_write(MsnHttpConn *httpconn, const char *body, size_t body_len) -{ - char *params; - char *data; - int header_len; - char *auth; - const char *server_types[] = { "NS", "SB" }; - const char *server_type; - char *host; - MsnServConn *servconn; - - /* TODO: remove http data from servconn */ - - g_return_val_if_fail(httpconn != NULL, 0); - g_return_val_if_fail(body != NULL, 0); - g_return_val_if_fail(body_len > 0, 0); - - servconn = httpconn->servconn; - - if (httpconn->waiting_response) - { - MsnHttpQueueData *queue_data = g_new0(MsnHttpQueueData, 1); - - queue_data->httpconn = httpconn; - queue_data->body = g_memdup(body, body_len); - queue_data->body_len = body_len; - - httpconn->queue = g_list_append(httpconn->queue, queue_data); - - return body_len; - } - - server_type = server_types[servconn->type]; - - if (httpconn->virgin) - { - host = "gateway.messenger.hotmail.com"; - - /* The first time servconn->host is the host we should connect to. */ - params = g_strdup_printf("Action=open&Server=%s&IP=%s", - server_type, - servconn->host); - httpconn->virgin = FALSE; - } - else - { - /* The rest of the times servconn->host is the gateway host. */ - host = httpconn->host; - - if (host == NULL || httpconn->full_session_id == NULL) - { - purple_debug_warning("msn", "Attempted HTTP write before session is established\n"); - return -1; - } - - params = g_strdup_printf("SessionID=%s", - httpconn->full_session_id); - } - - auth = msn_httpconn_proxy_auth(httpconn); - - data = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: %d\r\n\r\n", - host, - params, - host, - auth ? auth : "", - (int) body_len); - - g_free(params); - - g_free(auth); - - header_len = strlen(data); - data = g_realloc(data, header_len + body_len); - memcpy(data + header_len, body, body_len); - - if (write_raw(httpconn, data, header_len + body_len)) - httpconn->waiting_response = TRUE; - - g_free(data); - - return body_len; -} - -MsnHttpConn * -msn_httpconn_new(MsnServConn *servconn) -{ - MsnHttpConn *httpconn; - - g_return_val_if_fail(servconn != NULL, NULL); - - httpconn = g_new0(MsnHttpConn, 1); - - purple_debug_info("msn", "new httpconn (%p)\n", httpconn); - - /* TODO: Remove this */ - httpconn->session = servconn->session; - - httpconn->servconn = servconn; - - httpconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - httpconn->tx_handler = 0; - - return httpconn; -} - -void -msn_httpconn_destroy(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - purple_debug_info("msn", "destroy httpconn (%p)\n", httpconn); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - g_free(httpconn->full_session_id); - - g_free(httpconn->session_id); - - g_free(httpconn->host); - - purple_circ_buffer_destroy(httpconn->tx_buf); - if (httpconn->tx_handler > 0) - purple_input_remove(httpconn->tx_handler); - - g_free(httpconn); -} - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - MsnHttpConn *httpconn; - - httpconn = data; - httpconn->connect_data = NULL; - httpconn->fd = source; - - if (source >= 0) - { - httpconn->inpa = purple_input_add(httpconn->fd, PURPLE_INPUT_READ, - read_cb, data); - - httpconn->timer = purple_timeout_add_seconds(3, msn_httpconn_poll, httpconn); - - msn_httpconn_process_queue(httpconn); - } - else - { - purple_debug_error("msn", "HTTP: Connection error\n"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT); - } -} - -gboolean -msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port) -{ - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - httpconn->connect_data = purple_proxy_connect(NULL, httpconn->session->account, - host, 80, connect_cb, httpconn); - - if (httpconn->connect_data != NULL) - { - httpconn->waiting_response = TRUE; - httpconn->connected = TRUE; - } - - return httpconn->connected; -} - -void -msn_httpconn_disconnect(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - if (!httpconn->connected) - return; - - if (httpconn->connect_data != NULL) - { - purple_proxy_connect_cancel(httpconn->connect_data); - httpconn->connect_data = NULL; - } - - if (httpconn->timer) - { - purple_timeout_remove(httpconn->timer); - httpconn->timer = 0; - } - - if (httpconn->inpa > 0) - { - purple_input_remove(httpconn->inpa); - httpconn->inpa = 0; - } - - close(httpconn->fd); - httpconn->fd = -1; - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - httpconn->connected = FALSE; - - /* msn_servconn_disconnect(httpconn->servconn); */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/httpconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/** - * @file httpconn.h HTTP connection - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_HTTPCONN_H_ -#define _MSN_HTTPCONN_H_ - -typedef struct _MsnHttpConn MsnHttpConn; - -#include "circbuffer.h" -#include "servconn.h" - -/** - * An HTTP Connection. - */ -struct _MsnHttpConn -{ - MsnSession *session; /**< The MSN Session. */ - MsnServConn *servconn; /**< The connection object. */ - - PurpleProxyConnectData *connect_data; - - char *full_session_id; /**< The full session id. */ - char *session_id; /**< The trimmed session id. */ - - int timer; /**< The timer for polling. */ - - gboolean waiting_response; /**< The flag that states if we are waiting - a response from the server. */ - gboolean connected; /**< The flag that states if the connection is on. */ - gboolean virgin; /**< The flag that states if this connection - should specify the host (not gateway) to - connect to. */ - - char *host; /**< The HTTP gateway host. */ - GList *queue; /**< The queue of data chunks to write. */ - - int fd; /**< The connection's file descriptor. */ - guint inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer length. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; -}; - -/** - * Creates a new HTTP connection object. - * - * @param servconn The connection object. - * - * @return The new object. - */ -MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); - -/** - * Destroys an HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_destroy(MsnHttpConn *httpconn); - -/** - * Writes a chunk of data to the HTTP connection. - * - * @param servconn The server connection. - * @param data The data to write. - * @param data_len The size of the data to write. - * - * @return The number of bytes written. - */ -ssize_t msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len); - -/** - * Connects the HTTP connection object to a host. - * - * @param httpconn The HTTP connection object. - * @param host The host to connect to. - * @param port The port to connect to. - */ -gboolean msn_httpconn_connect(MsnHttpConn *httpconn, - const char *host, int port); - -/** - * Disconnects the HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_disconnect(MsnHttpConn *httpconn); - -#endif /* _MSN_HTTPCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MSNP9SOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - dialog.c \ - dialog.h \ - directconn.c \ - directconn.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - slpsession.c \ - slpsession.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msn-utils.c \ - msn-utils.h - -AM_CFLAGS = $(st) - -libmsn_la_LDFLAGS = -module -avoid-version - -if STATIC_MSN - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNP9SOURCES) -libmsn_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNP9SOURCES) -libmsn_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1037 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/msnp9 -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MSN_FALSE@libmsn_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libmsn_la_SOURCES_DIST = cmdproc.c cmdproc.h command.c command.h \ - dialog.c dialog.h directconn.c directconn.h error.c error.h \ - group.c group.h history.c history.h httpconn.c httpconn.h \ - msg.c msg.h msn.c msn.h nexus.c nexus.h notification.c \ - notification.h object.c object.h page.c page.h servconn.c \ - servconn.h session.c session.h slp.c slp.h slpcall.c slpcall.h \ - slplink.c slplink.h slpmsg.c slpmsg.h slpsession.c \ - slpsession.h state.c state.h switchboard.c switchboard.h \ - sync.c sync.h table.c table.h transaction.c transaction.h \ - user.c user.h userlist.c userlist.h msn-utils.c msn-utils.h -am__objects_1 = libmsn_la-cmdproc.lo libmsn_la-command.lo \ - libmsn_la-dialog.lo libmsn_la-directconn.lo libmsn_la-error.lo \ - libmsn_la-group.lo libmsn_la-history.lo libmsn_la-httpconn.lo \ - libmsn_la-msg.lo libmsn_la-msn.lo libmsn_la-nexus.lo \ - libmsn_la-notification.lo libmsn_la-object.lo \ - libmsn_la-page.lo libmsn_la-servconn.lo libmsn_la-session.lo \ - libmsn_la-slp.lo libmsn_la-slpcall.lo libmsn_la-slplink.lo \ - libmsn_la-slpmsg.lo libmsn_la-slpsession.lo libmsn_la-state.lo \ - libmsn_la-switchboard.lo libmsn_la-sync.lo libmsn_la-table.lo \ - libmsn_la-transaction.lo libmsn_la-user.lo \ - libmsn_la-userlist.lo libmsn_la-msn-utils.lo -@STATIC_MSN_FALSE@am_libmsn_la_OBJECTS = $(am__objects_1) -@STATIC_MSN_TRUE@am_libmsn_la_OBJECTS = $(am__objects_1) -libmsn_la_OBJECTS = $(am_libmsn_la_OBJECTS) -@STATIC_MSN_FALSE@am_libmsn_la_rpath = -rpath $(pkgdir) -@STATIC_MSN_TRUE@am_libmsn_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmsn_la_SOURCES) -DIST_SOURCES = $(am__libmsn_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MSNP9SOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - dialog.c \ - dialog.h \ - directconn.c \ - directconn.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - slpsession.c \ - slpsession.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msn-utils.c \ - msn-utils.h - -AM_CFLAGS = $(st) -libmsn_la_LDFLAGS = -module -avoid-version -@STATIC_MSN_FALSE@st = -@STATIC_MSN_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MSN_TRUE@noinst_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_SOURCES = $(MSNP9SOURCES) -@STATIC_MSN_TRUE@libmsn_la_SOURCES = $(MSNP9SOURCES) -@STATIC_MSN_TRUE@libmsn_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MSN_FALSE@pkg_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/msnp9/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/msnp9/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmsn.la: $(libmsn_la_OBJECTS) $(libmsn_la_DEPENDENCIES) - $(LINK) $(am_libmsn_la_rpath) $(libmsn_la_LDFLAGS) $(libmsn_la_OBJECTS) $(libmsn_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-cmdproc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-command.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-dialog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-directconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-history.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-httpconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msn-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-nexus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-notification.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-page.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-servconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpcall.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slplink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpmsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpsession.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-state.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-switchboard.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-sync.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-table.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-transaction.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-userlist.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmsn_la-cmdproc.lo: cmdproc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-cmdproc.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-cmdproc.Tpo" -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo" "$(DEPDIR)/libmsn_la-cmdproc.Plo"; else rm -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdproc.c' object='libmsn_la-cmdproc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c - -libmsn_la-command.lo: command.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-command.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-command.Tpo" -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-command.Tpo" "$(DEPDIR)/libmsn_la-command.Plo"; else rm -f "$(DEPDIR)/libmsn_la-command.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='command.c' object='libmsn_la-command.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c - -libmsn_la-dialog.lo: dialog.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-dialog.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-dialog.Tpo" -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-dialog.Tpo" "$(DEPDIR)/libmsn_la-dialog.Plo"; else rm -f "$(DEPDIR)/libmsn_la-dialog.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dialog.c' object='libmsn_la-dialog.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c - -libmsn_la-directconn.lo: directconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-directconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-directconn.Tpo" -c -o libmsn_la-directconn.lo `test -f 'directconn.c' || echo '$(srcdir)/'`directconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-directconn.Tpo" "$(DEPDIR)/libmsn_la-directconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-directconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='directconn.c' object='libmsn_la-directconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-directconn.lo `test -f 'directconn.c' || echo '$(srcdir)/'`directconn.c - -libmsn_la-error.lo: error.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-error.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-error.Tpo" -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-error.Tpo" "$(DEPDIR)/libmsn_la-error.Plo"; else rm -f "$(DEPDIR)/libmsn_la-error.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libmsn_la-error.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c - -libmsn_la-group.lo: group.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-group.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-group.Tpo" -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-group.Tpo" "$(DEPDIR)/libmsn_la-group.Plo"; else rm -f "$(DEPDIR)/libmsn_la-group.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group.c' object='libmsn_la-group.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c - -libmsn_la-history.lo: history.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-history.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-history.Tpo" -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-history.Tpo" "$(DEPDIR)/libmsn_la-history.Plo"; else rm -f "$(DEPDIR)/libmsn_la-history.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='history.c' object='libmsn_la-history.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c - -libmsn_la-httpconn.lo: httpconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-httpconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-httpconn.Tpo" -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-httpconn.Tpo" "$(DEPDIR)/libmsn_la-httpconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-httpconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='httpconn.c' object='libmsn_la-httpconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c - -libmsn_la-msg.lo: msg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msg.Tpo" -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msg.Tpo" "$(DEPDIR)/libmsn_la-msg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msg.c' object='libmsn_la-msg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c - -libmsn_la-msn.lo: msn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msn.Tpo" -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msn.Tpo" "$(DEPDIR)/libmsn_la-msn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msn.c' object='libmsn_la-msn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c - -libmsn_la-nexus.lo: nexus.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-nexus.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-nexus.Tpo" -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-nexus.Tpo" "$(DEPDIR)/libmsn_la-nexus.Plo"; else rm -f "$(DEPDIR)/libmsn_la-nexus.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nexus.c' object='libmsn_la-nexus.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c - -libmsn_la-notification.lo: notification.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-notification.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-notification.Tpo" -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-notification.Tpo" "$(DEPDIR)/libmsn_la-notification.Plo"; else rm -f "$(DEPDIR)/libmsn_la-notification.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='notification.c' object='libmsn_la-notification.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c - -libmsn_la-object.lo: object.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-object.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-object.Tpo" -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-object.Tpo" "$(DEPDIR)/libmsn_la-object.Plo"; else rm -f "$(DEPDIR)/libmsn_la-object.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='object.c' object='libmsn_la-object.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c - -libmsn_la-page.lo: page.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-page.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-page.Tpo" -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-page.Tpo" "$(DEPDIR)/libmsn_la-page.Plo"; else rm -f "$(DEPDIR)/libmsn_la-page.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='page.c' object='libmsn_la-page.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c - -libmsn_la-servconn.lo: servconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-servconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-servconn.Tpo" -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-servconn.Tpo" "$(DEPDIR)/libmsn_la-servconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-servconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='servconn.c' object='libmsn_la-servconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c - -libmsn_la-session.lo: session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-session.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-session.Tpo" -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-session.Tpo" "$(DEPDIR)/libmsn_la-session.Plo"; else rm -f "$(DEPDIR)/libmsn_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='session.c' object='libmsn_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmsn_la-slp.lo: slp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slp.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slp.Tpo" -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slp.Tpo" "$(DEPDIR)/libmsn_la-slp.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slp.c' object='libmsn_la-slp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c - -libmsn_la-slpcall.lo: slpcall.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpcall.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpcall.Tpo" -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpcall.Tpo" "$(DEPDIR)/libmsn_la-slpcall.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpcall.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpcall.c' object='libmsn_la-slpcall.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c - -libmsn_la-slplink.lo: slplink.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slplink.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slplink.Tpo" -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slplink.Tpo" "$(DEPDIR)/libmsn_la-slplink.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slplink.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slplink.c' object='libmsn_la-slplink.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c - -libmsn_la-slpmsg.lo: slpmsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpmsg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpmsg.Tpo" -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo" "$(DEPDIR)/libmsn_la-slpmsg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpmsg.c' object='libmsn_la-slpmsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c - -libmsn_la-slpsession.lo: slpsession.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpsession.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpsession.Tpo" -c -o libmsn_la-slpsession.lo `test -f 'slpsession.c' || echo '$(srcdir)/'`slpsession.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpsession.Tpo" "$(DEPDIR)/libmsn_la-slpsession.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpsession.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpsession.c' object='libmsn_la-slpsession.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpsession.lo `test -f 'slpsession.c' || echo '$(srcdir)/'`slpsession.c - -libmsn_la-state.lo: state.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-state.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-state.Tpo" -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-state.Tpo" "$(DEPDIR)/libmsn_la-state.Plo"; else rm -f "$(DEPDIR)/libmsn_la-state.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='state.c' object='libmsn_la-state.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c - -libmsn_la-switchboard.lo: switchboard.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-switchboard.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-switchboard.Tpo" -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-switchboard.Tpo" "$(DEPDIR)/libmsn_la-switchboard.Plo"; else rm -f "$(DEPDIR)/libmsn_la-switchboard.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='switchboard.c' object='libmsn_la-switchboard.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c - -libmsn_la-sync.lo: sync.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-sync.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-sync.Tpo" -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-sync.Tpo" "$(DEPDIR)/libmsn_la-sync.Plo"; else rm -f "$(DEPDIR)/libmsn_la-sync.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sync.c' object='libmsn_la-sync.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c - -libmsn_la-table.lo: table.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-table.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-table.Tpo" -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-table.Tpo" "$(DEPDIR)/libmsn_la-table.Plo"; else rm -f "$(DEPDIR)/libmsn_la-table.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='table.c' object='libmsn_la-table.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c - -libmsn_la-transaction.lo: transaction.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-transaction.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-transaction.Tpo" -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-transaction.Tpo" "$(DEPDIR)/libmsn_la-transaction.Plo"; else rm -f "$(DEPDIR)/libmsn_la-transaction.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transaction.c' object='libmsn_la-transaction.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c - -libmsn_la-user.lo: user.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-user.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-user.Tpo" -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-user.Tpo" "$(DEPDIR)/libmsn_la-user.Plo"; else rm -f "$(DEPDIR)/libmsn_la-user.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='user.c' object='libmsn_la-user.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c - -libmsn_la-userlist.lo: userlist.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-userlist.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-userlist.Tpo" -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-userlist.Tpo" "$(DEPDIR)/libmsn_la-userlist.Plo"; else rm -f "$(DEPDIR)/libmsn_la-userlist.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='userlist.c' object='libmsn_la-userlist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c - -libmsn_la-msn-utils.lo: msn-utils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msn-utils.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msn-utils.Tpo" -c -o libmsn_la-msn-utils.lo `test -f 'msn-utils.c' || echo '$(srcdir)/'`msn-utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msn-utils.Tpo" "$(DEPDIR)/libmsn_la-msn-utils.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msn-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msn-utils.c' object='libmsn_la-msn-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msn-utils.lo `test -f 'msn-utils.c' || echo '$(srcdir)/'`msn-utils.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmsn -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmsn -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = cmdproc.c \ - command.c \ - dialog.c \ - directconn.c \ - error.c \ - group.c \ - history.c \ - httpconn.c \ - msg.c \ - msn.c \ - nexus.c \ - notification.c \ - object.c \ - page.c \ - servconn.c \ - session.c \ - slp.c \ - slpcall.c \ - slplink.c \ - slpmsg.c \ - slpsession.c \ - state.c \ - switchboard.c \ - sync.c \ - table.c \ - transaction.c \ - user.c \ - userlist.c \ - msn-utils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,787 +0,0 @@ -/** - * @file msg.c Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msg.h" - -MsnMessage * -msn_message_new(MsnMsgType type) -{ - MsnMessage *msg; - - msg = g_new0(MsnMessage, 1); - msg->type = type; - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); -#endif - - msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - msn_message_ref(msg); - - return msg; -} - -void -msn_message_destroy(MsnMessage *msg) -{ - g_return_if_fail(msg != NULL); - - if (msg->ref_count > 0) - { - msn_message_unref(msg); - - return; - } - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message destroy (%p)\n", msg); -#endif - - if (msg->remote_user != NULL) - g_free(msg->remote_user); - - if (msg->body != NULL) - g_free(msg->body); - - if (msg->content_type != NULL) - g_free(msg->content_type); - - if (msg->charset != NULL) - g_free(msg->charset); - - g_hash_table_destroy(msg->attr_table); - g_list_free(msg->attr_list); - - g_free(msg); -} - -MsnMessage * -msn_message_ref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - msg->ref_count++; - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message ref (%p)[%d]\n", msg, msg->ref_count); -#endif - - return msg; -} - -MsnMessage * -msn_message_unref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->ref_count > 0, NULL); - - msg->ref_count--; - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message unref (%p)[%d]\n", msg, msg->ref_count); -#endif - - if (msg->ref_count == 0) - { - msn_message_destroy(msg); - - return NULL; - } - - return msg; -} - -MsnMessage * -msn_message_new_plain(const char *message) -{ - MsnMessage *msg; - char *message_cr; - - msg = msn_message_new(MSN_MSG_TEXT); - msn_message_set_attr(msg, "User-Agent", PACKAGE_NAME "/" DISPLAY_VERSION); - msn_message_set_content_type(msg, "text/plain"); - msn_message_set_charset(msg, "UTF-8"); - msn_message_set_flag(msg, 'A'); - msn_message_set_attr(msg, "X-MMS-IM-Format", - "FN=MS%20Sans%20Serif; EF=; CO=0; PF=0"); - - message_cr = purple_str_add_cr(message); - msn_message_set_bin_data(msg, message_cr, strlen(message_cr)); - g_free(message_cr); - - return msg; -} - -MsnMessage * -msn_message_new_msnslp(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_SLP); - - msn_message_set_attr(msg, "User-Agent", NULL); - - msg->msnslp_message = TRUE; - - msn_message_set_flag(msg, 'D'); - msn_message_set_content_type(msg, "application/x-msnmsgrp2p"); - - return msg; -} - -MsnMessage * -msn_message_new_nudge(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_NUDGE); - msn_message_set_content_type(msg, "text/x-msnmsgr-datacast"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, "ID: 1\r\n", 7); - - return msg; -} - -void -msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) -{ - MsnSlpHeader header; - const char *tmp; - int body_len; - - tmp = body; - - if (len < sizeof(header)) { - g_return_if_reached(); - } - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - /* Import the body. */ - body_len = len - (tmp - body); - /* msg->body_len = msg->msnslp_header.length; */ - - if (body_len > 0) { - msg->body_len = len - (tmp - body); - msg->body = g_malloc0(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - tmp += body_len; - } -} - -void -msn_message_parse_payload(MsnMessage *msg, - const char *payload, size_t payload_len) -{ - char *tmp_base, *tmp; - const char *content_type; - char *end; - char **elems, **cur, **tokens; - - g_return_if_fail(payload != NULL); - - tmp_base = tmp = g_malloc0(payload_len + 1); - memcpy(tmp_base, payload, payload_len); - - /* Parse the attributes. */ - end = strstr(tmp, "\r\n\r\n"); - /* TODO? some clients use \r delimiters instead of \r\n, the official client - * doesn't send such messages, but does handle receiving them. We'll just - * avoid crashing for now */ - if (end == NULL) { - g_free(tmp_base); - g_return_if_reached(); - } - *end = '\0'; - - elems = g_strsplit(tmp, "\r\n", 0); - - for (cur = elems; *cur != NULL; cur++) - { - const char *key, *value; - - tokens = g_strsplit(*cur, ": ", 2); - - key = tokens[0]; - value = tokens[1]; - - if (!strcmp(key, "MIME-Version")) - { - g_strfreev(tokens); - continue; - } - - if (!strcmp(key, "Content-Type")) - { - char *charset, *c; - - if ((c = strchr(value, ';')) != NULL) - { - if ((charset = strchr(c, '=')) != NULL) - { - charset++; - msn_message_set_charset(msg, charset); - } - - *c = '\0'; - } - - msn_message_set_content_type(msg, value); - } - else - { - msn_message_set_attr(msg, key, value); - } - - g_strfreev(tokens); - } - - g_strfreev(elems); - - /* Proceed to the end of the "\r\n\r\n" */ - tmp = end + 4; - - /* Now we *should* be at the body. */ - content_type = msn_message_get_content_type(msg); - - if (content_type != NULL && - !strcmp(content_type, "application/x-msnmsgrp2p")) - { - MsnSlpHeader header; - MsnSlpFooter footer; - int body_len; - - if (payload_len - (tmp - tmp_base) < sizeof(header)) { - g_free(tmp_base); - g_return_if_reached(); - } - - msg->msnslp_message = TRUE; - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - body_len = payload_len - (tmp - tmp_base) - sizeof(footer); - - /* Import the body. */ - if (body_len > 0) { - msg->body_len = body_len; - msg->body = g_malloc0(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - tmp += body_len; - } - - /* Import the footer. */ - if (body_len >= 0) { - memcpy(&footer, tmp, sizeof(footer)); - tmp += sizeof(footer); - msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); - } - } - else - { - if (payload_len - (tmp - tmp_base) > 0) { - msg->body_len = payload_len - (tmp - tmp_base); - msg->body = g_malloc0(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - } - } - - g_free(tmp_base); -} - -MsnMessage * -msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd) -{ - MsnMessage *msg; - - g_return_val_if_fail(cmd != NULL, NULL); - - msg = msn_message_new(MSN_MSG_UNKNOWN); - - msg->remote_user = g_strdup(cmd->params[0]); - /* msg->size = atoi(cmd->params[2]); */ - msg->cmd = cmd; - - return msg; -} - -char * -msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) -{ - MsnSlpHeader header; - - char *tmp, *base; - const void *body; - size_t len, body_len; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = tmp = g_malloc(len + 1); - - body = msn_message_get_bin_data(msg, &body_len); - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(tmp, &header, 48); - tmp += 48; - - if (body != NULL) - { - memcpy(tmp, body, body_len); - tmp += body_len; - } - - if (ret_size != NULL) - *ret_size = tmp - base; - - return base; -} - -char * -msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) -{ - GList *l; - char *n, *base, *end; - int len; - size_t body_len = 0; - const void *body; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = n = end = g_malloc(len + 1); - end += len; - - /* Standard header. */ - if (msg->charset == NULL) - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - n += strlen(n); - - for (l = msg->attr_list; l != NULL; l = l->next) - { - const char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_snprintf(n, end - n, "%s: %s\r\n", key, value); - n += strlen(n); - } - - n += g_strlcpy(n, "\r\n", end - n); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - MsnSlpHeader header; - MsnSlpFooter footer; - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(n, &header, 48); - n += 48; - - if (body != NULL) - { - memcpy(n, body, body_len); - - n += body_len; - } - - footer.value = GUINT32_TO_BE(msg->msnslp_footer.value); - - memcpy(n, &footer, 4); - n += 4; - } - else - { - if (body != NULL) - { - memcpy(n, body, body_len); - n += body_len; - } - } - - if (ret_size != NULL) - { - *ret_size = n - base; - - if (*ret_size > 1664) - *ret_size = 1664; - } - - return base; -} - -void -msn_message_set_flag(MsnMessage *msg, char flag) -{ - g_return_if_fail(msg != NULL); - g_return_if_fail(flag != 0); - - msg->flag = flag; -} - -char -msn_message_get_flag(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, 0); - - return msg->flag; -} - -void -msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len) -{ - g_return_if_fail(msg != NULL); - - /* There is no need to waste memory on data we cannot send anyway */ - if (len > 1664) - len = 1664; - - if (msg->body != NULL) - g_free(msg->body); - - if (data != NULL && len > 0) - { - msg->body = g_malloc0(len + 1); - memcpy(msg->body, data, len); - msg->body_len = len; - } - else - { - msg->body = NULL; - msg->body_len = 0; - } -} - -const void * -msn_message_get_bin_data(const MsnMessage *msg, size_t *len) -{ - g_return_val_if_fail(msg != NULL, NULL); - - if (len) - *len = msg->body_len; - - return msg->body; -} - -void -msn_message_set_content_type(MsnMessage *msg, const char *type) -{ - g_return_if_fail(msg != NULL); - - if (msg->content_type != NULL) - g_free(msg->content_type); - - msg->content_type = (type != NULL) ? g_strdup(type) : NULL; -} - -const char * -msn_message_get_content_type(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->content_type; -} - -void -msn_message_set_charset(MsnMessage *msg, const char *charset) -{ - g_return_if_fail(msg != NULL); - - if (msg->charset != NULL) - g_free(msg->charset); - - msg->charset = (charset != NULL) ? g_strdup(charset) : NULL; -} - -const char * -msn_message_get_charset(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->charset; -} - -void -msn_message_set_attr(MsnMessage *msg, const char *attr, const char *value) -{ - const char *temp; - char *new_attr; - - g_return_if_fail(msg != NULL); - g_return_if_fail(attr != NULL); - - temp = msn_message_get_attr(msg, attr); - - if (value == NULL) - { - if (temp != NULL) - { - GList *l; - - for (l = msg->attr_list; l != NULL; l = l->next) - { - if (!g_ascii_strcasecmp(l->data, attr)) - { - msg->attr_list = g_list_remove(msg->attr_list, l->data); - - break; - } - } - - g_hash_table_remove(msg->attr_table, attr); - } - - return; - } - - new_attr = g_strdup(attr); - - g_hash_table_insert(msg->attr_table, new_attr, g_strdup(value)); - - if (temp == NULL) - msg->attr_list = g_list_append(msg->attr_list, new_attr); -} - -const char * -msn_message_get_attr(const MsnMessage *msg, const char *attr) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(attr != NULL, NULL); - - return g_hash_table_lookup(msg->attr_table, attr); -} - -GHashTable * -msn_message_get_hashtable_from_body(const MsnMessage *msg) -{ - GHashTable *table; - size_t body_len; - const char *body; - char **elems, **cur, **tokens, *body_str; - - g_return_val_if_fail(msg != NULL, NULL); - - table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - body = msn_message_get_bin_data(msg, &body_len); - - g_return_val_if_fail(body != NULL, NULL); - - body_str = g_strndup(body, body_len); - elems = g_strsplit(body_str, "\r\n", 0); - g_free(body_str); - - for (cur = elems; *cur != NULL; cur++) - { - if (**cur == '\0') - break; - - tokens = g_strsplit(*cur, ": ", 2); - - if (tokens[0] != NULL && tokens[1] != NULL) - g_hash_table_insert(table, tokens[0], tokens[1]); - - g_free(tokens); - } - - g_strfreev(elems); - - return table; -} - -char * -msn_message_to_string(MsnMessage *msg) -{ - size_t body_len; - const char *body; - - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->type == MSN_MSG_TEXT, NULL); - - body = msn_message_get_bin_data(msg, &body_len); - - return g_strndup(body, body_len); -} - -void -msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body) -{ - GString *str; - size_t body_len; - const char *body; - GList *l; - - g_return_if_fail(msg != NULL); - - str = g_string_new(NULL); - - /* Standard header. */ - if (msg->charset == NULL) - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - for (l = msg->attr_list; l; l = l->next) - { - char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_string_append_printf(str, "%s: %s\r\n", key, value); - } - - g_string_append(str, "\r\n"); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - g_string_append_printf(str, "Session ID: %u\r\n", msg->msnslp_header.session_id); - g_string_append_printf(str, "ID: %u\r\n", msg->msnslp_header.id); - g_string_append_printf(str, "Offset: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.offset); - g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.total_size); - g_string_append_printf(str, "Length: %u\r\n", msg->msnslp_header.length); - g_string_append_printf(str, "Flags: 0x%x\r\n", msg->msnslp_header.flags); - g_string_append_printf(str, "ACK ID: %u\r\n", msg->msnslp_header.ack_id); - g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); - g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.ack_size); - -#ifdef MSN_DEBUG_SLP_VERBOSE - if (body != NULL) - { - if (text_body) - { - g_string_append_len(str, body, body_len); - if (body[body_len - 1] == '\0') - { - str->len--; - g_string_append(str, " 0x00"); - } - g_string_append(str, "\r\n"); - } - else - { - int i; - for (i = 0; i < msg->body_len; i++) - { - g_string_append_printf(str, "%.2hhX ", body[i]); - if ((i % 16) == 15) - g_string_append(str, "\r\n"); - } - g_string_append(str, "\r\n"); - } - } -#endif - - g_string_append_printf(str, "Footer: %u\r\n", msg->msnslp_footer.value); - } - else - { - if (body != NULL) - { - g_string_append_len(str, body, body_len); - g_string_append(str, "\r\n"); - } - } - - purple_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); - - g_string_free(str, TRUE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,349 +0,0 @@ -/** - * @file msg.h Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_MSG_H_ -#define _MSN_MSG_H_ - -typedef struct _MsnMessage MsnMessage; - -#include "session.h" -#include "user.h" - -#include "command.h" -#include "transaction.h" - -typedef void (*MsnMsgCb)(MsnMessage *, void *data); - -/* -typedef enum -{ - MSN_MSG_NORMAL, - MSN_MSG_SLP_SB, - MSN_MSG_SLP_DC - -} MsnMsgType; -*/ - -typedef enum -{ - MSN_MSG_UNKNOWN, - MSN_MSG_TEXT, - MSN_MSG_TYPING, - MSN_MSG_CAPS, - MSN_MSG_SLP, - MSN_MSG_NUDGE - -} MsnMsgType; - -typedef enum -{ - MSN_MSG_ERROR_NONE, /**< No error. */ - MSN_MSG_ERROR_TIMEOUT, /**< The message timedout. */ - MSN_MSG_ERROR_NAK, /**< The message could not be sent. */ - MSN_MSG_ERROR_SB, /**< The error comes from the switchboard. */ - MSN_MSG_ERROR_UNKNOWN /**< An unknown error occurred. */ - -} MsnMsgErrorType; - -typedef struct -{ - guint32 session_id; - guint32 id; - guint64 offset; - guint64 total_size; - guint32 length; - guint32 flags; - guint32 ack_id; - guint32 ack_sub_id; - guint64 ack_size; - -} MsnSlpHeader; - -typedef struct -{ - guint32 value; - -} MsnSlpFooter; - -/** - * A message. - */ -struct _MsnMessage -{ - size_t ref_count; /**< The reference count. */ - - MsnMsgType type; - - gboolean msnslp_message; - - char *remote_user; - char flag; - - char *content_type; - char *charset; - char *body; - gsize body_len; - - MsnSlpHeader msnslp_header; - MsnSlpFooter msnslp_footer; - - GHashTable *attr_table; - GList *attr_list; - - gboolean ack_ref; /**< A flag that states if this message has - been ref'ed for using it in a callback. */ - - MsnCommand *cmd; - MsnTransaction *trans; - - MsnMsgCb ack_cb; /**< The callback to call when we receive an ACK of this - message. */ - MsnMsgCb nak_cb; /**< The callback to call when we receive a NAK of this - message. */ - void *ack_data; /**< The data used by callbacks. */ - - MsnMsgErrorType error; /**< The error of the message. */ -}; - -/** - * Creates a new, empty message. - * - * @return A new message. - */ -MsnMessage *msn_message_new(MsnMsgType type); - -/** - * Creates a new, empty MSNSLP message. - * - * @return A new MSNSLP message. - */ -MsnMessage *msn_message_new_msnslp(void); - -/** - * Creates a new nudge message. - * - * @return A new nudge message. - */ -MsnMessage *msn_message_new_nudge(void); - -/** - * Creates a new plain message. - * - * @return A new plain message. - */ -MsnMessage *msn_message_new_plain(const char *message); - -/** - * Creates a MSNSLP ack message. - * - * @param acked_msg The message to acknowledge. - * - * @return A new MSNSLP ack message. - */ -MsnMessage *msn_message_new_msnslp_ack(MsnMessage *acked_msg); - -/** - * Creates a new message based off a command. - * - * @param session The MSN session. - * @param cmd The command. - * - * @return The new message. - */ -MsnMessage *msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd); - -/** - * Parses the payload of a message. - * - * @param msg The message. - * @param payload The payload. - * @param payload_len The length of the payload. - */ -void msn_message_parse_payload(MsnMessage *msg, const char *payload, - size_t payload_len); - -/** - * Destroys a message. - * - * @param msg The message to destroy. - */ -void msn_message_destroy(MsnMessage *msg); - -/** - * Increments the reference count on a message. - * - * @param msg The message. - * - * @return @a msg - */ -MsnMessage *msn_message_ref(MsnMessage *msg); - -/** - * Decrements the reference count on a message. - * - * This will destroy the structure if the count hits 0. - * - * @param msg The message. - * - * @return @a msg, or @c NULL if the new count is 0. - */ -MsnMessage *msn_message_unref(MsnMessage *msg); - -/** - * Generates the payload data of a message. - * - * @param msg The message. - * @param ret_size The returned size of the payload. - * - * @return The payload data of the message. - */ -char *msn_message_gen_payload(MsnMessage *msg, size_t *ret_size); - -/** - * Sets the flag for an outgoing message. - * - * @param msg The message. - * @param flag The flag. - */ -void msn_message_set_flag(MsnMessage *msg, char flag); - -/** - * Returns the flag for an outgoing message. - * - * @param msg The message. - * - * @return The flag. - */ -char msn_message_get_flag(const MsnMessage *msg); - -#if 0 -/** - * Sets the body of a message. - * - * @param msg The message. - * @param body The body of the message. - */ -void msn_message_set_body(MsnMessage *msg, const char *body); - -/** - * Returns the body of the message. - * - * @param msg The message. - * - * @return The body of the message. - */ -const char *msn_message_get_body(const MsnMessage *msg); -#endif -/** - * Sets the binary content of the message. - * - * @param msg The message. - * @param data The binary data. - * @param len The length of the data. - */ -void msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len); - -/** - * Returns the binary content of the message. - * - * @param msg The message. - * @param len The returned length of the data. - * - * @return The binary data. - */ -const void *msn_message_get_bin_data(const MsnMessage *msg, size_t *len); - -/** - * Sets the content type in a message. - * - * @param msg The message. - * @param type The content-type. - */ -void msn_message_set_content_type(MsnMessage *msg, const char *type); - -/** - * Returns the content type in a message. - * - * @param msg The message. - * - * @return The content-type. - */ -const char *msn_message_get_content_type(const MsnMessage *msg); - -/** - * Sets the charset in a message. - * - * @param msg The message. - * @param charset The charset. - */ -void msn_message_set_charset(MsnMessage *msg, const char *charset); - -/** - * Returns the charset in a message. - * - * @param msg The message. - * - * @return The charset. - */ -const char *msn_message_get_charset(const MsnMessage *msg); - -/** - * Sets an attribute in a message. - * - * @param msg The message. - * @param attr The attribute name. - * @param value The attribute value. - */ -void msn_message_set_attr(MsnMessage *msg, const char *attr, - const char *value); - -/** - * Returns an attribute from a message. - * - * @param msg The message. - * @param attr The attribute. - * - * @return The value, or @c NULL if not found. - */ -const char *msn_message_get_attr(const MsnMessage *msg, const char *attr); - -/** - * Parses the body and returns it in the form of a hashtable. - * - * @param msg The message. - * - * @return The resulting hashtable. - */ -GHashTable *msn_message_get_hashtable_from_body(const MsnMessage *msg); - -void msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body); - -void msn_message_parse_slp_body(MsnMessage *msg, const char *body, - size_t len); - -char *msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size); - -char *msn_message_to_string(MsnMessage *msg); - -#endif /* _MSN_MSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2362 +0,0 @@ -/** - * @file msn.c The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define PHOTO_SUPPORT 1 - -#include - -#include "msn.h" -#include "accountopt.h" -#include "eventloop.h" -#include "msg.h" -#include "page.h" -#include "pluginpref.h" -#include "prefs.h" -#include "session.h" -#include "smiley.h" -#include "state.h" -#include "util.h" -#include "cmds.h" -#include "core.h" -#include "prpl.h" -#include "msn-utils.h" -#include "version.h" - -#include "switchboard.h" -#include "notification.h" -#include "sync.h" -#include "slplink.h" - -#if PHOTO_SUPPORT -#include "imgstore.h" -#endif - -typedef struct -{ - PurpleConnection *gc; - const char *passport; - -} MsnMobileData; - -typedef struct -{ - PurpleConnection *gc; - char *name; - -} MsnGetInfoData; - -typedef struct -{ - MsnGetInfoData *info_data; - char *stripped; - char *url_buffer; - PurpleNotifyUserInfo *user_info; - char *photo_url_text; - -} MsnGetInfoStepTwoData; - -typedef struct -{ - PurpleConnection *gc; - const char *who; - char *msg; - PurpleMessageFlags flags; - time_t when; -} MsnIMData; - -typedef struct -{ - char *smile; - MsnObject *obj; -} MsnEmoticon; - -static const char * -msn_normalize(const PurpleAccount *account, const char *str) -{ - static char buf[BUF_LEN]; - char *tmp; - - g_return_val_if_fail(str != NULL, NULL); - - g_snprintf(buf, sizeof(buf), "%s%s", str, - (strchr(str, '@') ? "" : "@hotmail.com")); - - tmp = g_utf8_strdown(buf, -1); - strncpy(buf, tmp, sizeof(buf)); - g_free(tmp); - - return buf; -} - -static gboolean -msn_send_attention(PurpleConnection *gc, const char *username, guint type) -{ - MsnMessage *msg; - MsnSession *session; - MsnSwitchBoard *swboard; - - msg = msn_message_new_nudge(); - session = gc->proto_data; - swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); - - if (swboard == NULL) - return FALSE; - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); - - return TRUE; -} - -static GList * -msn_attention_types(PurpleAccount *account) -{ - static GList *list = NULL; - - if (!list) { - list = g_list_append(list, purple_attention_type_new("Nudge", _("Nudge"), - _("%s has nudged you!"), _("Nudging %s..."))); - } - - return list; -} - -static GHashTable * -msn_get_account_text_table(PurpleAccount *unused) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} - -static PurpleCmdRet -msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - PurpleConnection *gc = purple_account_get_connection(account); - const gchar *username; - - username = purple_conversation_get_name(conv); - - purple_prpl_send_attention(gc, username, MSN_NUDGE); - - return PURPLE_CMD_RET_OK; -} - -static void -msn_act_id(PurpleConnection *gc, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - const char *alias; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - account = purple_connection_get_account(gc); - - if(entry && strlen(entry)) - alias = purple_url_encode(entry); - else - alias = ""; - - if (strlen(alias) > BUDDY_ALIAS_MAXLEN) - { - purple_notify_error(gc, NULL, - _("Your new MSN friendly name is too long."), NULL); - return; - } - - msn_cmdproc_send(cmdproc, "REA", "%s %s", - purple_account_get_username(account), - alias); -} - -static void -msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (entry == NULL || *entry == '\0') - { - msn_cmdproc_send(cmdproc, "PRP", "%s", type); - } - else - { - msn_cmdproc_send(cmdproc, "PRP", "%s %s", type, - purple_url_encode(entry)); - } -} - -static void -msn_set_home_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHH", entry); -} - -static void -msn_set_work_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHW", entry); -} - -static void -msn_set_mobile_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHM", entry); -} - -static void -enable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "Y"); -} - -static void -disable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "N"); -} - -static void -send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) -{ - MsnTransaction *trans; - MsnSession *session; - MsnCmdProc *cmdproc; - MsnPage *page; - char *payload; - size_t payload_len; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - page = msn_page_new(); - msn_page_set_body(page, entry); - - payload = msn_page_gen_payload(page, &payload_len); - - trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who, payload_len); - - msn_transaction_set_payload(trans, payload, payload_len); - - msn_page_destroy(page); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -send_to_mobile_cb(MsnMobileData *data, const char *entry) -{ - send_to_mobile(data->gc, data->passport, entry); - g_free(data); -} - -static void -close_mobile_page_cb(MsnMobileData *data, const char *entry) -{ - g_free(data); -} - -/* -- */ - -static void -msn_show_set_friendly_name(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_input(gc, NULL, _("Set your friendly name."), - _("This is the name that other MSN buddies will " - "see you as."), - purple_connection_get_display_name(gc), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_act_id), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_home_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your home phone number."), NULL, - msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_home_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_work_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your work phone number."), NULL, - msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_work_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, - msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_pages(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_action(gc, NULL, _("Allow MSN Mobile pages?"), - _("Do you want to allow or disallow people on " - "your buddy list to send you MSN Mobile pages " - "to your cell phone or other mobile device?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), NULL, NULL, - gc, 3, - _("Allow"), G_CALLBACK(enable_msn_pages_cb), - _("Disallow"), G_CALLBACK(disable_msn_pages_cb), - _("Cancel"), NULL); -} - -static void -msn_show_hotmail_inbox(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - if (session->passport_info.file == NULL) - { - purple_notify_error(gc, NULL, - _("This Hotmail account may not be active."), NULL); - return; - } - - purple_notify_uri(gc, session->passport_info.file); -} - -static void -show_send_to_mobile_cb(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - MsnSession *session; - MsnMobileData *data; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - session = gc->proto_data; - - data = g_new0(MsnMobileData, 1); - data->gc = gc; - data->passport = buddy->name; - - purple_request_input(gc, NULL, _("Send a mobile message."), NULL, - NULL, TRUE, FALSE, NULL, - _("Page"), G_CALLBACK(send_to_mobile_cb), - _("Close"), G_CALLBACK(close_mobile_page_cb), - purple_connection_get_account(gc), purple_buddy_get_name(buddy), NULL, - data); -} - -static gboolean -msn_offline_message(const PurpleBuddy *buddy) { - MsnUser *user; - if (buddy == NULL) - return FALSE; - user = buddy->proto_data; - return user && user->mobile; -} - -static void -initiate_chat_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - MsnSession *session; - MsnSwitchBoard *swboard; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - session = gc->proto_data; - - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, buddy->name); - - /* TODO: This might move somewhere else, after USR might be */ - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); - swboard->flag = MSN_SB_FLAG_IM; - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - purple_account_get_username(buddy->account), NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - -static void -t_msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpLink *slplink = xfer->data; - msn_slplink_request_ft(slplink, xfer); -} - -static PurpleXfer* -msn_new_xfer(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnSlpLink *slplink; - PurpleXfer *xfer; - - session = gc->proto_data; - - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - if (xfer) - { - slplink = msn_session_get_slplink(session, who); - - xfer->data = slplink; - - purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); - } - - return xfer; -} - -static void -msn_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer = msn_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -static gboolean -msn_can_receive_file(PurpleConnection *gc, const char *who) -{ - PurpleAccount *account; - char *normal; - gboolean ret; - - account = purple_connection_get_account(gc); - - normal = g_strdup(msn_normalize(account, purple_account_get_username(account))); - - ret = strcmp(normal, msn_normalize(account, who)); - - g_free(normal); - - return ret; -} - -/************************************************************************** - * Protocol Plugin ops - **************************************************************************/ - -static const char * -msn_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "msn"; -} - -static char * -msn_status_text(PurpleBuddy *buddy) -{ - PurplePresence *presence; - PurpleStatus *status; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - if (!purple_presence_is_available(presence) && !purple_presence_is_idle(presence)) - { - return g_strdup(purple_status_get_name(status)); - } - - return NULL; -} - -static void -msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) -{ - MsnUser *user; - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - - user = buddy->proto_data; - - - if (purple_presence_is_online(presence)) - { - purple_notify_user_info_add_pair(user_info, _("Status"), - (purple_presence_is_idle(presence) ? _("Idle") : purple_status_get_name(status))); - } - - if (full && user) - { - purple_notify_user_info_add_pair(user_info, _("Has you"), - ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No"))); - } - - /* XXX: This is being shown in non-full tooltips because the - * XXX: blocked icon overlay isn't always accurate for MSN. - * XXX: This can die as soon as purple_privacy_check() knows that - * XXX: this prpl always honors both the allow and deny lists. */ - /* While the above comment may be strictly correct (the privacy API needs - * rewriteing), purple_privacy_check() is going to be more accurate at - * indicating whether a particular buddy is going to be able to message - * you, which is the important information that this is trying to convey. */ - if (full && user) - { - const char *phone; - - purple_notify_user_info_add_pair(user_info, _("Blocked"), - ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No"))); - - phone = msn_user_get_home_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone); - - phone = msn_user_get_work_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone); - - phone = msn_user_get_mobile_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone); - } -} - -static GList * -msn_status_types(PurpleAccount *account) -{ - PurpleStatusType *status; - GList *types = NULL; - - status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - "brb", _("Be Right Back"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "busy", _("Busy"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "phone", _("On the Phone"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - "lunch", _("Out to Lunch"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, - "mobile", NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, status); - - return types; -} - -static GList * -msn_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc = (PurpleConnection *)context; - PurpleAccount *account; - const char *user; - - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set Friendly Name..."), - msn_show_set_friendly_name); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Set Home Phone Number..."), - msn_show_set_home_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Work Phone Number..."), - msn_show_set_work_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Mobile Phone Number..."), - msn_show_set_mobile_phone); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - -#if 0 - act = purple_plugin_action_new(_("Enable/Disable Mobile Devices..."), - msn_show_set_mobile_support); - m = g_list_append(m, act); -#endif - - act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."), - msn_show_set_mobile_pages); - m = g_list_append(m, act); - - account = purple_connection_get_account(gc); - user = msn_normalize(account, purple_account_get_username(account)); - - if ((strstr(user, "@hotmail.") != NULL) || - (strstr(user, "@msn.com") != NULL)) - { - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Hotmail Inbox"), - msn_show_hotmail_inbox); - m = g_list_append(m, act); - } - - return m; -} - -static GList * -msn_buddy_menu(PurpleBuddy *buddy) -{ - MsnUser *user; - - GList *m = NULL; - PurpleMenuAction *act; - - g_return_val_if_fail(buddy != NULL, NULL); - - user = buddy->proto_data; - - if (user != NULL) - { - if (user->mobile) - { - act = purple_menu_action_new(_("Send to Mobile"), - PURPLE_CALLBACK(show_send_to_mobile_cb), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (g_ascii_strcasecmp(buddy->name, - purple_account_get_username(buddy->account))) - { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(initiate_chat_cb), - NULL, NULL); - m = g_list_append(m, act); - } - - return m; -} - -static GList * -msn_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - return msn_buddy_menu((PurpleBuddy *) node); - } - else - { - return NULL; - } -} - -static void -msn_login(PurpleAccount *account) -{ - PurpleConnection *gc; - MsnSession *session; - const char *username; - const char *host; - gboolean http_method = FALSE; - int port; - - gc = purple_account_get_connection(account); - - if (!purple_ssl_is_supported()) - { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - - _("SSL support is needed for MSN. Please install a supported " - "SSL library.")); - return; - } - - http_method = purple_account_get_bool(account, "http_method", FALSE); - - if (http_method) - host = purple_account_get_string(account, "http_method_server", MSN_HTTPCONN_SERVER); - else - host = purple_account_get_string(account, "server", MSN_SERVER); - port = purple_account_get_int(account, "port", MSN_PORT); - - session = msn_session_new(account); - - gc->proto_data = session; - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_START); - - /* Hmm, I don't like this. */ - /* XXX shx: Me neither */ - username = msn_normalize(account, purple_account_get_username(account)); - - if (strcmp(username, purple_account_get_username(account))) - purple_account_set_username(account, username); - - if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); -} - -static void -msn_close(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - g_return_if_fail(session != NULL); - - msn_session_destroy(session); - - gc->proto_data = NULL; -} - -static gboolean -msn_send_me_im(gpointer data) -{ - MsnIMData *imdata = data; - serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when); - g_free(imdata->msg); - g_free(imdata); - return FALSE; -} - -static GString* -msn_msg_emoticon_add(GString *current, MsnEmoticon *emoticon) -{ - MsnObject *obj; - char *strobj; - - if (emoticon == NULL) - return current; - - obj = emoticon->obj; - - if (!obj) - return current; - - strobj = msn_object_to_string(obj); - - if (current) - g_string_append_printf(current, "\t%s\t%s", - emoticon->smile, strobj); - else { - current = g_string_new(""); - g_string_printf(current,"%s\t%s", - emoticon->smile, strobj); - } - - g_free(strobj); - - return current; -} - -static void -msn_send_emoticons(MsnSwitchBoard *swboard, GString *body) -{ - MsnMessage *msg; - - g_return_if_fail(body != NULL); - - msg = msn_message_new(MSN_MSG_SLP); - msn_message_set_content_type(msg, "text/x-mms-emoticon"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, body->str, body->len); - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); -} - -static void msn_emoticon_destroy(MsnEmoticon *emoticon) -{ - if (emoticon->obj) - msn_object_destroy(emoticon->obj); - g_free(emoticon->smile); - g_free(emoticon); -} - -static GSList* msn_msg_grab_emoticons(const char *msg, const char *username) -{ - GSList *list; - GList *smileys; - PurpleSmiley *smiley; - PurpleStoredImage *img; - char *ptr; - MsnEmoticon *emoticon; - int length; - - list = NULL; - smileys = purple_smileys_get_all(); - length = strlen(msg); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - smiley = (PurpleSmiley*)smileys->data; - - ptr = g_strstr_len(msg, length, purple_smiley_get_shortcut(smiley)); - - if (!ptr) - continue; - - img = purple_smiley_get_stored_image(smiley); - - emoticon = g_new0(MsnEmoticon, 1); - emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); - emoticon->obj = msn_object_new_from_image(img, - purple_imgstore_get_filename(img), - username, MSN_OBJECT_EMOTICON); - - purple_imgstore_unref(img); - list = g_slist_prepend(list, emoticon); - } - - return list; -} - -static int -msn_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - PurpleAccount *account; - PurpleBuddy *buddy = purple_find_buddy(gc->account, who); - MsnMessage *msg; - char *msgformat; - char *msgtext; - const char *username; - - account = purple_connection_get_account(gc); - username = purple_account_get_username(account); - - if (buddy) { - PurplePresence *p = purple_buddy_get_presence(buddy); - if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) { - char *text = purple_markup_strip_html(message); - send_to_mobile(gc, who, text); - g_free(text); - return 1; - } - } - - msn_import_html(message, &msgformat, &msgtext); - - if (strlen(msgtext) + strlen(msgformat) + strlen(DISPLAY_VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - - g_free(msgformat); - g_free(msgtext); - - if (g_ascii_strcasecmp(who, username)) - { - MsnSession *session; - MsnSwitchBoard *swboard; - MsnEmoticon *smile; - GSList *smileys; - GString *emoticons = NULL; - - session = gc->proto_data; - swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM); - smileys = msn_msg_grab_emoticons(message, username); - - while (smileys) { - smile = (MsnEmoticon*)smileys->data; - emoticons = msn_msg_emoticon_add(emoticons,smile); - msn_emoticon_destroy(smile); - smileys = g_slist_delete_link(smileys, smileys); - } - - if (emoticons) { - msn_send_emoticons(swboard, emoticons); - g_string_free(emoticons, TRUE); - } - - msn_switchboard_send_msg(swboard, msg, TRUE); - } - else - { - char *body_str, *body_enc, *pre, *post; - const char *format; - MsnIMData *imdata = g_new0(MsnIMData, 1); - /* - * In MSN, you can't send messages to yourself, so - * we'll fake like we received it ;) - */ - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - serv_got_typing_stopped(gc, who); - imdata->gc = gc; - imdata->who = who; - imdata->msg = body_str; - imdata->flags = flags; - imdata->when = time(NULL); - purple_timeout_add(0, msn_send_me_im, imdata); - } - - msn_message_destroy(msg); - - return 1; -} - -static unsigned int -msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - PurpleAccount *account; - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - - /* - * TODO: I feel like this should be "if (state != PURPLE_TYPING)" - * but this is how it was before, and I don't want to break - * anything. --KingAnt - */ - if (state == PURPLE_NOT_TYPING) - return 0; - - if (!g_ascii_strcasecmp(who, purple_account_get_username(account))) - { - /* We'll just fake it, since we're sending to ourself. */ - serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, PURPLE_TYPING); - - return MSN_TYPING_SEND_TIMEOUT; - } - - swboard = msn_session_find_swboard(session, who); - - if (swboard == NULL || !msn_switchboard_can_send(swboard)) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msg = msn_message_new(MSN_MSG_TYPING); - msn_message_set_content_type(msg, "text/x-msmsgscontrol"); - msn_message_set_flag(msg, 'U'); - msn_message_set_attr(msg, "TypingUser", - purple_account_get_username(account)); - msn_message_set_bin_data(msg, "\r\n", 2); - - msn_switchboard_send_msg(swboard, msg, FALSE); - - msn_message_destroy(msg); - - return MSN_TYPING_SEND_TIMEOUT; -} - -static void -msn_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = purple_account_get_connection(account); - - if (gc != NULL) - { - session = gc->proto_data; - msn_change_status(session); - } -} - -static void -msn_set_idle(PurpleConnection *gc, int idle) -{ - MsnSession *session; - - session = gc->proto_data; - - msn_change_status(session); -} - -#if 0 -static void -fake_userlist_add_buddy(MsnUserList *userlist, - const char *who, int list_id, - const char *group_name) -{ - MsnUser *user; - static int group_id_c = 1; - int group_id; - - group_id = -1; - - if (group_name != NULL) - { - MsnGroup *group; - group = msn_group_new(userlist, group_id_c, group_name); - group_id = group_id_c++; - } - - user = msn_userlist_find_user(userlist, who); - - if (user == NULL) - { - user = msn_user_new(userlist, who, NULL); - msn_userlist_add_user(userlist, user); - } - else - if (user->list_op & (1 << list_id)) - { - if (list_id == MSN_LIST_FL) - { - if (group_id >= 0) - if (g_list_find(user->group_ids, - GINT_TO_POINTER(group_id))) - return; - } - else - return; - } - - if (group_id >= 0) - { - user->group_ids = g_list_append(user->group_ids, - GINT_TO_POINTER(group_id)); - } - - user->list_op |= (1 << list_id); -} -#endif - -static void -msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsnSession *session; - MsnUserList *userlist; - const char *who; - - session = gc->proto_data; - userlist = session->userlist; - who = msn_normalize(gc->account, buddy->name); - - if (!session->logged_in) - { -#if 0 - fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL, - group ? group->name : NULL); -#else - purple_debug_error("msn", "msn_add_buddy called before connected\n"); -#endif - - return; - } - -#if 0 - if (group != NULL && group->name != NULL) - purple_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); - else - purple_debug_info("msn", "msn_add_buddy: %s\n", who); -#endif - -#if 0 - /* Which is the max? */ - if (session->fl_users_count >= 150) - { - purple_debug_info("msn", "Too many buddies\n"); - /* Buddy list full */ - /* TODO: purple should be notified of this */ - return; - } -#endif - - /* XXX - Would group ever be NULL here? I don't think so... - * shx: Yes it should; MSN handles non-grouped buddies, and this is only - * internal. */ - msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, - group ? group->name : NULL); -} - -static void -msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name); -} - -static void -msn_add_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_BL_OP) - msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); - - msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); -} - -static void -msn_add_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_AL_OP) - msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); - - msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); -} - -static void -msn_rem_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); -} - -static void -msn_rem_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); -} - -static void -msn_set_permit_deny(PurpleConnection *gc) -{ - PurpleAccount *account; - MsnSession *session; - MsnCmdProc *cmdproc; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || - account->perm_deny == PURPLE_PRIVACY_DENY_USERS) - { - msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); - } - else - { - msn_cmdproc_send(cmdproc, "BLP", "%s", "BL"); - } -} - -static void -msn_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - { - /* if we have no switchboard, everyone else left the chat already */ - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - swboard->chat_id = id; - swboard->conv = purple_find_chat(gc, id); - } - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_switchboard_request_add_user(swboard, who); -} - -static void -msn_chat_leave(PurpleConnection *gc, int id) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - /* if swboard is NULL we were the only person left anyway */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - msn_switchboard_release(swboard, MSN_SB_FLAG_IM); - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static int -msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurpleAccount *account; - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - char *msgformat; - char *msgtext; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - return -EINVAL; - - if (!swboard->ready) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_import_html(message, &msgformat, &msgtext); - - if (strlen(msgtext) + strlen(msgformat) + strlen(DISPLAY_VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - msn_switchboard_send_msg(swboard, msg, FALSE); - msn_message_destroy(msg); - - g_free(msgformat); - g_free(msgtext); - - serv_got_chat_in(gc, id, purple_account_get_username(account), flags, - message, time(NULL)); - - return 0; -} - -static void -msn_keepalive(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - if (!session->http_method) - { - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL); - } -} - -static void -msn_group_buddy(PurpleConnection *gc, const char *who, - const char *old_group_name, const char *new_group_name) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); -} - -static void -msn_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - MsnSession *session; - MsnCmdProc *cmdproc; - int old_gid; - const char *enc_new_group_name; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - enc_new_group_name = purple_url_encode(group->name); - - old_gid = msn_userlist_find_group_id(session->userlist, old_name); - - if (old_gid >= 0) - { - msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid, - enc_new_group_name); - } - else - { - msn_cmdproc_send(cmdproc, "ADG", "%s 0", enc_new_group_name); - } -} - -static void -msn_convo_closed(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard(session, who); - - /* - * Don't perform an assertion here. If swboard is NULL, then the - * switchboard was either closed by the other party, or the person - * is talking to himself. - */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - /* If we release the switchboard here, it may still have messages - pending ACK which would result in incorrect unsent message errors. - Just let it timeout... This is *so* going to screw with people who - use dumb clients that report "User has closed the conversation window" */ - /* msn_switchboard_release(swboard, MSN_SB_FLAG_IM); */ - swboard->conv = NULL; - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static void -msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - MsnSession *session; - MsnUser *user; - - session = gc->proto_data; - user = session->user; - - msn_user_set_buddy_icon(user, img); - - msn_change_status(session); -} - -static void -msn_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - MsnSession *session; - MsnCmdProc *cmdproc; - int group_id; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if ((group_id = msn_userlist_find_group_id(session->userlist, group->name)) >= 0) - { - msn_cmdproc_send(cmdproc, "RMG", "%d", group_id); - } -} - -/** - * Extract info text from info_data and add it to user_info - */ -static gboolean -msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *info_data) -{ - PurpleBuddy *b; - - b = purple_find_buddy(purple_connection_get_account(info_data->gc), - info_data->name); - - if (b) - { - char *tmp; - - if (b->alias && b->alias[0]) - { - char *aliastext = g_markup_escape_text(b->alias, -1); - purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); - g_free(aliastext); - } - - if (b->server_alias) - { - char *nicktext = g_markup_escape_text(b->server_alias, -1); - tmp = g_strdup_printf("%s
", nicktext); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - g_free(nicktext); - } - - /* Add the tooltip information */ - msn_tooltip_text(b, user_info, TRUE); - - return TRUE; - } - - return FALSE; -} - -#if PHOTO_SUPPORT - -static char * -msn_get_photo_url(const char *url_text) -{ - char *p, *q; - - if ((p = strstr(url_text, " contactparams:photopreauthurl=\"")) != NULL) - { - p += strlen(" contactparams:photopreauthurl=\""); - } - - if (p && (strncmp(p, "http://", 8) == 0) && ((q = strchr(p, '"')) != NULL)) - return g_strndup(p, q - p); - - return NULL; -} - -static void msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message); - -#endif - -#if 0 -static char *msn_info_date_reformat(const char *field, size_t len) -{ - char *tmp = g_strndup(field, len); - time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - - g_free(tmp); - return g_strdup(purple_date_format_short(localtime(&t))); -} -#endif - -#define MSN_GOT_INFO_GET_FIELD(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, NULL); \ - if (found) \ - sect_info = TRUE; - -#define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \ - if (found) \ - sect_info = TRUE; - -static char * -msn_info_strip_search_link(const char *field, size_t len) -{ - const char *c; - if ((c = strstr(field, " (http://")) == NULL) - return g_strndup(field, len); - return g_strndup(field, c - field); -} - -static void -msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - MsnGetInfoData *info_data = (MsnGetInfoData *)data; - PurpleNotifyUserInfo *user_info; - char *stripped, *p, *q, *tmp; - char *user_url = NULL; - gboolean found; - gboolean has_tooltip_text = FALSE; - gboolean has_info = FALSE; - gboolean sect_info = FALSE; - gboolean has_contact_info = FALSE; - char *url_buffer; - int stripped_len; -#if PHOTO_SUPPORT - char *photo_url_text = NULL; - MsnGetInfoStepTwoData *info2_data = NULL; -#endif - - purple_debug_info("msn", "In msn_got_info\n"); - - /* Make sure the connection is still valid */ - if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n"); - g_free(info_data->name); - g_free(info_data); - return; - } - - user_info = purple_notify_user_info_new(); - has_tooltip_text = msn_tooltip_extract_info_text(user_info, info_data); - - if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) - { - tmp = g_strdup_printf("%s", _("Error retrieving profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(info_data->name); - g_free(info_data); - return; - } - - url_buffer = g_strdup(url_text); - - /* If they have a homepage link, MSN masks it such that we need to - * fetch the url out before purple_markup_strip_html() nukes it */ - /* I don't think this works with the new spaces profiles - Stu 3/2/06 */ - if ((p = strstr(url_text, - "Take a look at my
%s", user_url, user_url); - purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp); - g_free(tmp); - g_free(user_url); - - has_info = TRUE; - } - - if (!has_info) - { - /* MSN doesn't actually distinguish between "unknown member" and - * a known member with an empty profile. Try to explain this fact. - * Note that if we have a nonempty tooltip_text, we know the user - * exists. - */ - /* This doesn't work with the new spaces profiles - Stu 3/2/06 - char *p = strstr(url_buffer, "Unknown Member "); - * This might not work for long either ... */ - /* Nope, it failed some time before 5/2/07 :( - char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\""); - * Let's see how long this one holds out for ... */ - char *p = strstr(url_buffer, "gc), info_data->name); - purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), - ((p && b) ? _("The user has not created a public profile.") : - (p ? _("MSN reported not being able to find the user's profile. " - "This either means that the user does not exist, " - "or that the user exists " - "but has not created a public profile.") : - _("Could not find " /* This should never happen */ - "any information in the user's profile. " - "The user most likely does not exist.")))); - } - - /* put a link to the actual profile URL */ - tmp = g_strdup_printf("%s%s", - PROFILE_URL, info_data->name, PROFILE_URL, info_data->name); - purple_notify_user_info_add_pair(user_info, _("Profile URL"), tmp); - g_free(tmp); - -#if PHOTO_SUPPORT - /* Find the URL to the photo; must be before the marshalling [Bug 994207] */ - photo_url_text = msn_get_photo_url(url_text); - - /* Marshall the existing state */ - info2_data = g_malloc0(sizeof(MsnGetInfoStepTwoData)); - info2_data->info_data = info_data; - info2_data->stripped = stripped; - info2_data->url_buffer = url_buffer; - info2_data->user_info = user_info; - info2_data->photo_url_text = photo_url_text; - - /* Try to put the photo in there too, if there's one */ - if (photo_url_text) - { - purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, - info2_data); - } - else - { - /* Emulate a callback */ - /* TODO: Huh? */ - msn_got_photo(NULL, info2_data, NULL, 0, NULL); - } -} - -static void -msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data; - int id = -1; - - /* Unmarshall the saved state */ - MsnGetInfoData *info_data = info2_data->info_data; - char *stripped = info2_data->stripped; - char *url_buffer = info2_data->url_buffer; - PurpleNotifyUserInfo *user_info = info2_data->user_info; - char *photo_url_text = info2_data->photo_url_text; - - /* Make sure the connection is still valid if we got here by fetching a photo url */ - if (url_text && (error_message != NULL || - g_list_find(purple_connections_get_all(), info_data->gc) == NULL)) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); - g_free(photo_url_text); - g_free(info2_data); - - return; - } - - /* Try to put the photo in there too, if there's one and is readable */ - if (user_data && url_text && len != 0) - { - if (strstr(url_text, "400 Bad Request") - || strstr(url_text, "403 Forbidden") - || strstr(url_text, "404 Not Found")) - { - - purple_debug_info("msn", "Error getting %s: %s\n", - photo_url_text, url_text); - } - else - { - char buf[1024]; - purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT - " bytes\n", photo_url_text, len); - id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - g_snprintf(buf, sizeof(buf), "
", id); - purple_notify_user_info_prepend_pair(user_info, NULL, buf); - } - } - - /* We continue here from msn_got_info, as if nothing has happened */ -#endif - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); -#if PHOTO_SUPPORT - g_free(photo_url_text); - g_free(info2_data); - if (id != -1) - purple_imgstore_unref_by_id(id); -#endif -} - -static void -msn_get_info(PurpleConnection *gc, const char *name) -{ - MsnGetInfoData *data; - char *url; - - data = g_new0(MsnGetInfoData, 1); - data->gc = gc; - data->name = g_strdup(name); - - url = g_strdup_printf("%s%s", PROFILE_URL, name); - - purple_util_fetch_url(url, FALSE, - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); - - g_free(url); -} - -static gboolean msn_load(PurplePlugin *plugin) -{ - msn_notification_init(); - msn_switchboard_init(); - msn_sync_init(); - - return TRUE; -} - -static gboolean msn_unload(PurplePlugin *plugin) -{ - msn_notification_end(); - msn_switchboard_end(); - msn_sync_end(); - - return TRUE; -} - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "msnim")) - return FALSE; - - acct = find_acct("prpl-msn", acct_id); - - if (!acct) - return FALSE; - - /* msnim:chat?contact=user@domain.tld */ - if (!g_ascii_strcasecmp(cmd, "Chat")) { - char *sname = g_hash_table_lookup(params, "contact"); - if (sname) { - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, sname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); - purple_conversation_present(conv); - } - /*else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im();*/ - - return TRUE; - } - /* msnim:add?contact=user@domain.tld */ - else if (!g_ascii_strcasecmp(cmd, "Add")) { - char *name = g_hash_table_lookup(params, "contact"); - purple_blist_request_add_buddy(acct, name, NULL, NULL); - return TRUE; - } - - return FALSE; -} - - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - msn_list_icon, /* list_icon */ - NULL, /* list_emblems */ - msn_status_text, /* status_text */ - msn_tooltip_text, /* tooltip_text */ - msn_status_types, /* away_states */ - msn_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - msn_login, /* login */ - msn_close, /* close */ - msn_send_im, /* send_im */ - NULL, /* set_info */ - msn_send_typing, /* send_typing */ - msn_get_info, /* get_info */ - msn_set_status, /* set_away */ - msn_set_idle, /* set_idle */ - NULL, /* change_passwd */ - msn_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - msn_rem_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - msn_add_permit, /* add_permit */ - msn_add_deny, /* add_deny */ - msn_rem_permit, /* rem_permit */ - msn_rem_deny, /* rem_deny */ - msn_set_permit_deny, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - msn_chat_invite, /* chat_invite */ - msn_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - msn_chat_send, /* chat_send */ - msn_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - msn_group_buddy, /* group_buddy */ - msn_rename_group, /* rename_group */ - NULL, /* buddy_free */ - msn_convo_closed, /* convo_closed */ - msn_normalize, /* normalize */ - msn_set_buddy_icon, /* set_buddy_icon */ - msn_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - msn_can_receive_file, /* can_receive_file */ - msn_send_file, /* send_file */ - msn_new_xfer, /* new_xfer */ - msn_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - msn_send_attention, /* send_attention */ - msn_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - msn_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-msn", /**< id */ - "MSN", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("MSN Protocol Plugin"), - /** description */ - N_("MSN Protocol Plugin"), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - msn_load, /**< load */ - msn_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - msn_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Server"), "server", - MSN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_int_new(_("Port"), "port", 1863); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Use HTTP Method"), - "http_method", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("HTTP Method Server"), - "http_method_server", MSN_HTTPCONN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Show custom smileys"), - "custom_smileys", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-msn", msn_cmd_nudge, - _("nudge: nudge a user to get their attention"), NULL); - - purple_prefs_remove("/plugins/prpl/msn"); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(msn_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(msnp9, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,134 +0,0 @@ -/** - * @file msn.h The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_H_ -#define _MSN_H_ - -/* #define MSN_DEBUG_MSG 1 */ -/* #define MSN_DEBUG_SLPMSG 1 */ -/* #define MSN_DEBUG_HTTP 1 */ - -/* #define MSN_DEBUG_SLP 1 */ -/* #define MSN_DEBUG_SLP_VERBOSE 1 */ -/* #define MSN_DEBUG_SLP_FILES 1 */ - -/* #define MSN_DEBUG_NS 1 */ -/* #define MSN_DEBUG_SB 1 */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "connection.h" -#include "conversation.h" -#include "debug.h" -#include "cipher.h" -#include "notify.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "servconn.h" -#include "sslconn.h" -#include "util.h" - -#include "ft.h" - -#define MSN_BUF_LEN 8192 - -#define USEROPT_MSNSERVER 3 -#define MSN_SERVER "messenger.hotmail.com" -#define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com" -#define USEROPT_MSNPORT 4 -#define MSN_PORT 1863 - -#define MSN_TYPING_RECV_TIMEOUT 6 -#define MSN_TYPING_SEND_TIMEOUT 4 - -#define HOTMAIL_URL "http://www.hotmail.com/cgi-bin/folders" -#define PASSPORT_URL "http://lc1.law13.hotmail.passport.com/cgi-bin/dologin?login=" -#define PROFILE_URL "http://spaces.live.com/profile.aspx?mem=" - -#define USEROPT_HOTMAIL 0 - -#define BUDDY_ALIAS_MAXLEN 387 - -#define MSN_FT_GUID "{5D3E02AB-6190-11d3-BBBB-00C04F795683}" - -#define MSN_CLIENTINFO \ - "Client-Name: Purple/" VERSION "\r\n" \ - "Chat-Logging: Y\r\n" - -/* Index into attention_types */ -#define MSN_NUDGE 0 - -typedef enum -{ - MSN_LIST_FL_OP = 0x01, - MSN_LIST_AL_OP = 0x02, - MSN_LIST_BL_OP = 0x04, - MSN_LIST_RL_OP = 0x08 - -} MsnListOp; - -typedef enum -{ - MSN_CLIENT_CAP_WIN_MOBILE = 0x00001, - MSN_CLIENT_CAP_UNKNOWN_1 = 0x00002, - MSN_CLIENT_CAP_INK_GIF = 0x00004, - MSN_CLIENT_CAP_INK_ISF = 0x00008, - MSN_CLIENT_CAP_VIDEO_CHAT = 0x00010, - MSN_CLIENT_CAP_BASE = 0x00020, - MSN_CLIENT_CAP_MSNMOBILE = 0x00040, - MSN_CLIENT_CAP_MSNDIRECT = 0x00080, - MSN_CLIENT_CAP_WEBMSGR = 0x00100, - MSN_CLIENT_CAP_DIRECTIM = 0x04000, - MSN_CLIENT_CAP_WINKS = 0x08000, - MSN_CLIENT_CAP_SEARCH = 0x10000 - -} MsnClientCaps; - -typedef enum -{ - MSN_CLIENT_VER_5_0 = 0x00, - MSN_CLIENT_VER_6_0 = 0x10, /* MSNC1 */ - MSN_CLIENT_VER_6_1 = 0x20, /* MSNC2 */ - MSN_CLIENT_VER_6_2 = 0x30, /* MSNC3 */ - MSN_CLIENT_VER_7_0 = 0x40, /* MSNC4 */ - MSN_CLIENT_VER_7_5 = 0x50 /* MSNC5 */ - -} MsnClientVerId; - -#define MSN_CLIENT_ID_VERSION MSN_CLIENT_VER_7_0 -#define MSN_CLIENT_ID_RESERVED_1 0x00 -#define MSN_CLIENT_ID_RESERVED_2 0x00 -#define MSN_CLIENT_ID_CAPABILITIES MSN_CLIENT_CAP_BASE - -#define MSN_CLIENT_ID \ - ((MSN_CLIENT_ID_VERSION << 24) | \ - (MSN_CLIENT_ID_RESERVED_1 << 16) | \ - (MSN_CLIENT_ID_RESERVED_2 << 8) | \ - (MSN_CLIENT_ID_CAPABILITIES)) - -#endif /* _MSN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,441 +0,0 @@ -/** - * @file msn-utils.c Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msn-utils.h" - -void -msn_parse_format(const char *mime, char **pre_ret, char **post_ret) -{ - char *cur; - GString *pre = g_string_new(NULL); - GString *post = g_string_new(NULL); - unsigned int colors[3]; - - if (pre_ret != NULL) *pre_ret = NULL; - if (post_ret != NULL) *post_ret = NULL; - - cur = strstr(mime, "FN="); - - if (cur && (*(cur = cur + 3) != ';')) - { - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - - cur = strstr(mime, "EF="); - - if (cur && (*(cur = cur + 3) != ';')) - { - while (*cur && *cur != ';') - { - pre = g_string_append_c(pre, '<'); - pre = g_string_append_c(pre, *cur); - pre = g_string_append_c(pre, '>'); - post = g_string_prepend_c(post, '>'); - post = g_string_prepend_c(post, *cur); - post = g_string_prepend_c(post, '/'); - post = g_string_prepend_c(post, '<'); - cur++; - } - } - - cur = strstr(mime, "CO="); - - if (cur && (*(cur = cur + 3) != ';')) - { - int i; - - i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); - - if (i > 0) - { - char tag[64]; - - if (i == 1) - { - colors[1] = 0; - colors[2] = 0; - } - else if (i == 2) - { - unsigned int temp = colors[0]; - - colors[0] = colors[1]; - colors[1] = temp; - colors[2] = 0; - } - else if (i == 3) - { - unsigned int temp = colors[2]; - - colors[2] = colors[0]; - colors[0] = temp; - } - - g_snprintf(tag, sizeof(tag), - "", - colors[0], colors[1], colors[2]); - - pre = g_string_append(pre, tag); - post = g_string_prepend(post, ""); - } - } - - cur = strstr(mime, "RL="); - - if (cur && (*(cur = cur + 3) != ';')) - { - if (*cur == '1') - { - /* RTL text was received */ - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - } - - cur = g_strdup(purple_url_decode(pre->str)); - g_string_free(pre, TRUE); - - if (pre_ret != NULL) - *pre_ret = cur; - else - g_free(cur); - - cur = g_strdup(purple_url_decode(post->str)); - g_string_free(post, TRUE); - - if (post_ret != NULL) - *post_ret = cur; - else - g_free(cur); -} - -/* - * We need this because we're only supposed to encode spaces in the font - * names. purple_url_encode() isn't acceptable. - */ -static const char * -encode_spaces(const char *str) -{ - static char buf[BUF_LEN]; - const char *c; - char *d; - - g_return_val_if_fail(str != NULL, NULL); - - for (c = str, d = buf; *c != '\0'; c++) - { - if (*c == ' ') - { - *d++ = '%'; - *d++ = '2'; - *d++ = '0'; - } - else - *d++ = *c; - } - *d = '\0'; - - return buf; -} - -/* - * Taken from the zephyr plugin. - * This parses HTML formatting (put out by one of the gtkimhtml widgets - * and converts it to msn formatting. It doesn't deal with the tag closing, - * but gtkimhtml widgets give valid html. - * It currently deals properly with , , , , - * , , . - * It ignores and - */ -void -msn_import_html(const char *html, char **attributes, char **message) -{ - int len, retcount = 0; - const char *c; - char *msg; - char *fontface = NULL; - char fonteffect[4]; - char fontcolor[7]; - char direction = '0'; - - gboolean has_bold = FALSE; - gboolean has_italic = FALSE; - gboolean has_underline = FALSE; - gboolean has_strikethrough = FALSE; - - g_return_if_fail(html != NULL); - g_return_if_fail(attributes != NULL); - g_return_if_fail(message != NULL); - - len = strlen(html); - msg = g_malloc0(len + 1); - - memset(fontcolor, 0, sizeof(fontcolor)); - strcat(fontcolor, "0"); - memset(fonteffect, 0, sizeof(fonteffect)); - - for (c = html; *c != '\0';) - { - if (*c == '<') - { - if (!g_ascii_strncasecmp(c + 1, "br>", 3)) - { - msg[retcount++] = '\r'; - msg[retcount++] = '\n'; - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "i>", 2)) - { - if (!has_italic) - { - strcat(fonteffect, "I"); - has_italic = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "b>", 2)) - { - if (!has_bold) - { - strcat(fonteffect, "B"); - has_bold = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "u>", 2)) - { - if (!has_underline) - { - strcat(fonteffect, "U"); - has_underline = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "s>", 2)) - { - if (!has_strikethrough) - { - strcat(fonteffect, "S"); - has_strikethrough = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "a href=\"", 8)) - { - c += 9; - - if (!g_ascii_strncasecmp(c, "mailto:", 7)) - c += 7; - - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - msg[retcount++] = *c++; - - if (*c != '\0') - c += 2; - - /* ignore descriptive string */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "", 4)) - c++; - - if (*c != '\0') - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "span", 4)) - { - /* Bi-directional text support using CSS properties in span tags */ - c += 5; - - while (*c != '\0' && *c != '>') - { - while (*c == ' ') - c++; - if (!g_ascii_strncasecmp(c, "dir=\"rtl\"", 9)) - { - c += 9; - direction = '1'; - } - else if (!g_ascii_strncasecmp(c, "style=\"", 7)) - { - /* Parse inline CSS attributes */ - char *attributes; - int attr_len = 0; - c += 7; - while (*(c + attr_len) != '\0' && *(c + attr_len) != '"') - attr_len++; - if (*(c + attr_len) == '"') - { - char *attr_dir; - attributes = g_strndup(c, attr_len); - attr_dir = purple_markup_get_css_property(attributes, "direction"); - if (attr_dir && (!g_ascii_strncasecmp(attr_dir, "RTL", 3))) - direction = '1'; - g_free(attr_dir); - g_free(attributes); - } - - } - else - { - c++; - } - } - if (*c == '>') - c++; - } - else if (!g_ascii_strncasecmp(c + 1, "font", 4)) - { - c += 5; - - while ((*c != '\0') && !g_ascii_strncasecmp(c, " ", 1)) - c++; - - if (!g_ascii_strncasecmp(c, "color=\"#", 7)) - { - c += 8; - - fontcolor[0] = *(c + 4); - fontcolor[1] = *(c + 5); - fontcolor[2] = *(c + 2); - fontcolor[3] = *(c + 3); - fontcolor[4] = *c; - fontcolor[5] = *(c + 1); - - c += 8; - } - else if (!g_ascii_strncasecmp(c, "face=\"", 6)) - { - const char *end = NULL; - const char *comma = NULL; - unsigned int namelen = 0; - - c += 6; - end = strchr(c, '\"'); - comma = strchr(c, ','); - - if (comma == NULL || comma > end) - namelen = (unsigned int)(end - c); - else - namelen = (unsigned int)(comma - c); - - fontface = g_strndup(c, namelen); - c = end + 2; - } - else - { - /* Drop all unrecognized/misparsed font tags */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - c++; - - if (*c != '\0') - c += 2; - } - } - else - { - while ((*c != '\0') && (*c != '>')) - c++; - if (*c != '\0') - c++; - } - } - else if (*c == '&') - { - if (!g_ascii_strncasecmp(c, "<", 4)) - { - msg[retcount++] = '<'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, ">", 4)) - { - msg[retcount++] = '>'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, " ", 6)) - { - msg[retcount++] = ' '; - c += 6; - } - else if (!g_ascii_strncasecmp(c, """, 6)) - { - msg[retcount++] = '"'; - c += 6; - } - else if (!g_ascii_strncasecmp(c, "&", 5)) - { - msg[retcount++] = '&'; - c += 5; - } - else if (!g_ascii_strncasecmp(c, "'", 6)) - { - msg[retcount++] = '\''; - c += 6; - } - else - msg[retcount++] = *c++; - } - else - msg[retcount++] = *c++; - } - - if (fontface == NULL) - fontface = g_strdup("MS Sans Serif"); - - *attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0; RL=%c", - encode_spaces(fontface), - fonteffect, fontcolor, direction); - *message = g_strdup(msg); - - g_free(fontface); - g_free(msg); -} - -void -msn_parse_socket(const char *str, char **ret_host, int *ret_port) -{ - char *host; - char *c; - int port; - - host = g_strdup(str); - - if ((c = strchr(host, ':')) != NULL) - { - *c = '\0'; - port = atoi(c + 1); - } - else - port = 1863; - - *ret_host = host; - *ret_port = port; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/msn-utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/** - * @file msn-utils.h Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_UTILS_H_ -#define _MSN_UTILS_H_ - -/** - * Parses the MSN message formatting into a format compatible with Purple. - * - * @param mime The mime header with the formatting. - * @param pre_ret The returned prefix string. - * @param post_ret The returned postfix string. - * - * @return The new message. - */ -void msn_parse_format(const char *mime, char **pre_ret, char **post_ret); - -/** - * Parses the Purple message formatting (html) into the MSN format. - * - * @param html The html message to format. - * @param attributes The returned attributes string. - * @param message The returned message string. - * - * @return The new message. - */ -void msn_import_html(const char *html, char **attributes, char **message); - -void msn_parse_socket(const char *str, char **ret_host, int *ret_port); - -#endif /* _MSN_UTILS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,513 +0,0 @@ -/** - * @file nexus.c MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "nexus.h" -#include "notification.h" - -/************************************************************************** - * Main - **************************************************************************/ - -MsnNexus * -msn_nexus_new(MsnSession *session) -{ - MsnNexus *nexus; - - nexus = g_new0(MsnNexus, 1); - nexus->session = session; - nexus->challenge_data = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_free); - - return nexus; -} - -void -msn_nexus_destroy(MsnNexus *nexus) -{ - if (nexus->gsc) - purple_ssl_close(nexus->gsc); - - g_free(nexus->login_host); - - g_free(nexus->login_path); - - if (nexus->challenge_data != NULL) - g_hash_table_destroy(nexus->challenge_data); - - if (nexus->input_handler > 0) - purple_input_remove(nexus->input_handler); - g_free(nexus->write_buf); - g_free(nexus->read_buf); - - g_free(nexus); -} - -/************************************************************************** - * Util - **************************************************************************/ - -static gssize -msn_ssl_read(MsnNexus *nexus) -{ - gssize len; - char temp_buf[4096]; - - if ((len = purple_ssl_read(nexus->gsc, temp_buf, - sizeof(temp_buf))) > 0) - { - nexus->read_buf = g_realloc(nexus->read_buf, - nexus->read_len + len + 1); - strncpy(nexus->read_buf + nexus->read_len, temp_buf, len); - nexus->read_len += len; - nexus->read_buf[nexus->read_len] = '\0'; - } - - return len; -} - -static void -nexus_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnNexus *nexus = data; - int len, total_len; - - total_len = strlen(nexus->write_buf); - - len = purple_ssl_write(nexus->gsc, - nexus->write_buf + nexus->written_len, - total_len - nexus->written_len); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - /* TODO: notify of the error */ - return; - } - nexus->written_len += len; - - if (nexus->written_len < total_len) - return; - - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - - g_free(nexus->write_buf); - nexus->write_buf = NULL; - nexus->written_len = 0; - - nexus->written_cb(nexus, source, 0); -} - -/************************************************************************** - * Login - **************************************************************************/ - -static void -login_connect_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond); - -static void -login_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, void *data) -{ - MsnNexus *nexus; - MsnSession *session; - - nexus = data; - g_return_if_fail(nexus != NULL); - - nexus->gsc = NULL; - - session = nexus->session; - g_return_if_fail(session != NULL); - - msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Unable to connect")); - /* the above line will result in nexus being destroyed, so we don't want - * to destroy it here, or we'd crash */ -} - -static void -nexus_login_written_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnNexus *nexus = data; - MsnSession *session; - int len; - - session = nexus->session; - g_return_if_fail(session != NULL); - - if (nexus->input_handler == 0) - /* TODO: Use purple_ssl_input_add()? */ - nexus->input_handler = purple_input_add(nexus->gsc->fd, - PURPLE_INPUT_READ, nexus_login_written_cb, nexus); - - - len = msn_ssl_read(nexus); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - /* TODO: error handling */ - return; - } - - if (g_strstr_len(nexus->read_buf, nexus->read_len, - "\r\n\r\n") == NULL) - return; - - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - - purple_ssl_close(nexus->gsc); - nexus->gsc = NULL; - - purple_debug_misc("msn", "ssl buffer: {%s}\n", nexus->read_buf); - - if (strstr(nexus->read_buf, "HTTP/1.1 302") != NULL) - { - /* Redirect. */ - char *location, *c; - - location = strstr(nexus->read_buf, "Location: "); - if (location == NULL) - { - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - - return; - } - location = strchr(location, ' ') + 1; - - if ((c = strchr(location, '\r')) != NULL) - *c = '\0'; - - /* Skip the http:// */ - if ((c = strchr(location, '/')) != NULL) - location = c + 2; - - if ((c = strchr(location, '/')) != NULL) - { - g_free(nexus->login_path); - nexus->login_path = g_strdup(c); - - *c = '\0'; - } - - g_free(nexus->login_host); - nexus->login_host = g_strdup(location); - - nexus->gsc = purple_ssl_connect(session->account, - nexus->login_host, PURPLE_SSL_DEFAULT_PORT, - login_connect_cb, login_error_cb, nexus); - } - else if (strstr(nexus->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) - { - const char *error; - - if ((error = strstr(nexus->read_buf, "WWW-Authenticate")) != NULL) - { - if ((error = strstr(error, "cbtxt=")) != NULL) - { - const char *c; - char *temp; - - error += strlen("cbtxt="); - - if ((c = strchr(error, '\n')) == NULL) - c = error + strlen(error); - - temp = g_strndup(error, c - error); - error = purple_url_decode(temp); - g_free(temp); - if ((temp = strstr(error, " Do one of the following or try again:")) != NULL) - *temp = '\0'; - } - } - - msn_session_set_error(session, MSN_ERROR_AUTH, error); - } - else if (strstr(nexus->read_buf, "HTTP/1.1 503 Service Unavailable")) - { - msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, NULL); - } - else if (strstr(nexus->read_buf, "HTTP/1.1 200 OK")) - { - char *base, *c; - char *login_params; - -#if 0 - /* All your base are belong to us. */ - base = buffer; - - /* For great cookie! */ - while ((base = strstr(base, "Set-Cookie: ")) != NULL) - { - base += strlen("Set-Cookie: "); - - c = strchr(base, ';'); - - session->login_cookies = - g_list_append(session->login_cookies, - g_strndup(base, c - base)); - } -#endif - - base = strstr(nexus->read_buf, "Authentication-Info: "); - - g_return_if_fail(base != NULL); - - base = strstr(base, "from-PP='"); - base += strlen("from-PP='"); - c = strchr(base, '\''); - - login_params = g_strndup(base, c - base); - - msn_got_login_params(session, login_params); - - g_free(login_params); - - msn_nexus_destroy(nexus); - session->nexus = NULL; - return; - } - - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - -} - -/* this guards against missing hash entries */ -static char * -nexus_challenge_data_lookup(GHashTable *challenge_data, const char *key) -{ - char *entry; - - return (entry = (char *)g_hash_table_lookup(challenge_data, key)) ? - entry : "(null)"; -} - -void -login_connect_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - MsnNexus *nexus; - MsnSession *session; - char *username, *password, *encpass; - char *request_str, *head, *tail; - char *buffer = NULL; - guint32 ctint; - - nexus = data; - g_return_if_fail(nexus != NULL); - - session = nexus->session; - g_return_if_fail(session != NULL); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); - - username = - g_strdup(purple_url_encode(purple_account_get_username(session->account))); - - password = g_utf8_strncpy(g_strdup(purple_connection_get_password(session->account->gc)), - purple_connection_get_password(session->account->gc), 16); - encpass = g_strdup(purple_url_encode(password)); - g_free(password); - - ctint = strtoul((char *)g_hash_table_lookup(nexus->challenge_data, "ct"), NULL, 10) + 200; - - head = g_strdup_printf( - "GET %s HTTP/1.1\r\n" - "Authorization: Passport1.4 OrgVerb=GET,OrgURL=%s,sign-in=%s", - nexus->login_path, - (char *)g_hash_table_lookup(nexus->challenge_data, "ru"), - username); - - tail = g_strdup_printf( - "lc=%s,id=%s,tw=%s,fs=%s,ru=%s,ct=%" G_GUINT32_FORMAT ",kpp=%s,kv=%s,ver=%s,tpf=%s\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Connection: Keep-Alive\r\n" - "Cache-Control: no-cache\r\n", - nexus_challenge_data_lookup(nexus->challenge_data, "lc"), - nexus_challenge_data_lookup(nexus->challenge_data, "id"), - nexus_challenge_data_lookup(nexus->challenge_data, "tw"), - nexus_challenge_data_lookup(nexus->challenge_data, "fs"), - nexus_challenge_data_lookup(nexus->challenge_data, "ru"), - ctint, - nexus_challenge_data_lookup(nexus->challenge_data, "kpp"), - nexus_challenge_data_lookup(nexus->challenge_data, "kv"), - nexus_challenge_data_lookup(nexus->challenge_data, "ver"), - nexus_challenge_data_lookup(nexus->challenge_data, "tpf"), - nexus->login_host); - - buffer = g_strdup_printf("%s,pwd=XXXXXXXX,%s\r\n", head, tail); - request_str = g_strdup_printf("%s,pwd=%s,%s\r\n", head, encpass, tail); - - purple_debug_misc("msn", "Sending: {%s}\n", buffer); - - g_free(buffer); - g_free(head); - g_free(tail); - g_free(username); - g_free(encpass); - - nexus->write_buf = request_str; - nexus->written_len = 0; - - nexus->read_len = 0; - - nexus->written_cb = nexus_login_written_cb; - - nexus->input_handler = purple_input_add(gsc->fd, PURPLE_INPUT_WRITE, - nexus_write_cb, nexus); - - nexus_write_cb(nexus, gsc->fd, PURPLE_INPUT_WRITE); - - return; - - -} - -static void -nexus_connect_written_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnNexus *nexus = data; - int len; - char *da_login; - char *base, *c; - - if (nexus->input_handler == 0) - /* TODO: Use purple_ssl_input_add()? */ - nexus->input_handler = purple_input_add(nexus->gsc->fd, - PURPLE_INPUT_READ, nexus_connect_written_cb, nexus); - - /* Get the PassportURLs line. */ - len = msn_ssl_read(nexus); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - /* TODO: error handling */ - return; - } - - if (g_strstr_len(nexus->read_buf, nexus->read_len, - "\r\n\r\n") == NULL) - return; - - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - - base = strstr(nexus->read_buf, "PassportURLs"); - - if (base == NULL) - { - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - return; - } - - if ((da_login = strstr(base, "DALogin=")) != NULL) - { - /* skip over "DALogin=" */ - da_login += 8; - - if ((c = strchr(da_login, ',')) != NULL) - *c = '\0'; - - if ((c = strchr(da_login, '/')) != NULL) - { - nexus->login_path = g_strdup(c); - *c = '\0'; - } - - nexus->login_host = g_strdup(da_login); - } - - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - - purple_ssl_close(nexus->gsc); - - /* Now begin the connection to the login server. */ - nexus->gsc = purple_ssl_connect(nexus->session->account, - nexus->login_host, PURPLE_SSL_DEFAULT_PORT, - login_connect_cb, login_error_cb, nexus); -} - - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -nexus_connect_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - MsnNexus *nexus; - MsnSession *session; - - nexus = data; - g_return_if_fail(nexus != NULL); - - session = nexus->session; - g_return_if_fail(session != NULL); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH); - - nexus->write_buf = g_strdup("GET /rdr/pprdr.asp\r\n\r\n"); - nexus->written_len = 0; - - nexus->read_len = 0; - - nexus->written_cb = nexus_connect_written_cb; - - nexus->input_handler = purple_input_add(gsc->fd, PURPLE_INPUT_WRITE, - nexus_write_cb, nexus); - - nexus_write_cb(nexus, gsc->fd, PURPLE_INPUT_WRITE); -} - -void -msn_nexus_connect(MsnNexus *nexus) -{ - nexus->gsc = purple_ssl_connect(nexus->session->account, - "nexus.passport.com", PURPLE_SSL_DEFAULT_PORT, - nexus_connect_cb, login_error_cb, nexus); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/nexus.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/** - * @file nexus.h MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_NEXUS_H_ -#define _MSN_NEXUS_H_ - -typedef struct _MsnNexus MsnNexus; - -struct _MsnNexus -{ - MsnSession *session; - - char *login_host; - char *login_path; - GHashTable *challenge_data; - PurpleSslConnection *gsc; - - guint input_handler; - - char *write_buf; - gsize written_len; - PurpleInputFunction written_cb; - - char *read_buf; - gsize read_len; -}; - -void msn_nexus_connect(MsnNexus *nexus); -MsnNexus *msn_nexus_new(MsnSession *session); -void msn_nexus_destroy(MsnNexus *nexus); - -#endif /* _MSN_NEXUS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1510 +0,0 @@ -/** - * @file notification.c Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "notification.h" -#include "state.h" -#include "error.h" -#include "msn-utils.h" -#include "page.h" - -#include "userlist.h" -#include "sync.h" -#include "slplink.h" - -static MsnTable *cbs_table; - -/************************************************************************** - * Main - **************************************************************************/ - -static void -destroy_cb(MsnServConn *servconn) -{ - MsnNotification *notification; - - notification = servconn->cmdproc->data; - g_return_if_fail(notification != NULL); - - msn_notification_destroy(notification); -} - -MsnNotification * -msn_notification_new(MsnSession *session) -{ - MsnNotification *notification; - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - notification = g_new0(MsnNotification, 1); - - notification->session = session; - notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS); - msn_servconn_set_destroy_cb(servconn, destroy_cb); - - notification->cmdproc = servconn->cmdproc; - notification->cmdproc->data = notification; - notification->cmdproc->cbs_table = cbs_table; - - return notification; -} - -void -msn_notification_destroy(MsnNotification *notification) -{ - notification->cmdproc->data = NULL; - - msn_servconn_set_destroy_cb(notification->servconn, NULL); - - msn_servconn_destroy(notification->servconn); - - g_free(notification); -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(MsnServConn *servconn) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - char **a, **c, *vers; - int i; - - g_return_if_fail(servconn != NULL); - - cmdproc = servconn->cmdproc; - session = servconn->session; - account = session->account; - - /* Allocate an array for CVR0, NULL, and all the versions */ - a = c = g_new0(char *, session->protocol_ver - 8 + 3); - - for (i = session->protocol_ver; i >= 8; i--) - *c++ = g_strdup_printf("MSNP%d", i); - - *c++ = g_strdup("CVR0"); - - vers = g_strjoinv(" ", a); - - if (session->login_step == MSN_LOGIN_STEP_START) - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); - else - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2); - - msn_cmdproc_send(cmdproc, "VER", "%s", vers); - - g_strfreev(a); - g_free(vers); -} - -gboolean -msn_notification_connect(MsnNotification *notification, const char *host, int port) -{ - MsnServConn *servconn; - - g_return_val_if_fail(notification != NULL, FALSE); - - servconn = notification->servconn; - - msn_servconn_set_connect_cb(servconn, connect_cb); - notification->in_use = msn_servconn_connect(servconn, host, port); - - return notification->in_use; -} - -void -msn_notification_disconnect(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - g_return_if_fail(notification->in_use); - - msn_servconn_disconnect(notification->servconn); - - notification->in_use = FALSE; -} - -/************************************************************************** - * Util - **************************************************************************/ - -static void -group_error_helper(MsnSession *session, const char *msg, int group_id, int error) -{ - PurpleAccount *account; - PurpleConnection *gc; - char *reason = NULL; - char *title = NULL; - - account = session->account; - gc = purple_account_get_connection(account); - - if (error == 224) - { - if (group_id == 0) - { - return; - } - else - { - const char *group_name; - group_name = - msn_userlist_find_group_name(session->userlist, - group_id); - reason = g_strdup_printf(_("%s is not a valid group."), - group_name); - } - } - else - { - reason = g_strdup(_("Unknown error.")); - } - - title = g_strdup_printf(_("%s on %s (%s)"), msg, - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - purple_notify_error(gc, NULL, title, reason); - g_free(title); - g_free(reason); -} - -/************************************************************************** - * Login - **************************************************************************/ - -void -msn_got_login_params(MsnSession *session, const char *login_params) -{ - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); - - msn_cmdproc_send(cmdproc, "USR", "TWN S %s", login_params); -} - -static void -cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - - account = cmdproc->session->account; - - msn_cmdproc_send(cmdproc, "USR", "TWN I %s", - purple_account_get_username(account)); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - if (!g_ascii_strcasecmp(cmd->params[1], "OK")) - { - /* OK */ - const char *friendly = purple_url_decode(cmd->params[3]); - - session->passport_info.verified = atoi(cmd->params[4]); - - purple_connection_set_display_name(gc, friendly); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); - - msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); - } - else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")) - { - /* Passport authentication */ - char **elems, **cur, **tokens; - - session->nexus = msn_nexus_new(session); - - /* Parse the challenge data. */ - - elems = g_strsplit(cmd->params[3], ",", 0); - - for (cur = elems; *cur != NULL; cur++) - { - tokens = g_strsplit(*cur, "=", 2); - g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); - - msn_nexus_connect(session->nexus); - } -} - -static void -usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnErrorType msnerr = 0; - - switch (error) - { - case 500: - case 601: - case 910: - case 921: - msnerr = MSN_ERROR_SERV_UNAVAILABLE; - break; - case 911: - msnerr = MSN_ERROR_AUTH; - break; - default: - return; - break; - } - - msn_session_set_error(cmdproc->session, msnerr, NULL); -} - -static void -ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - gboolean protocol_supported = FALSE; - char proto_str[8]; - size_t i; - - session = cmdproc->session; - account = session->account; - - g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); - - for (i = 1; i < cmd->param_count; i++) - { - if (!strcmp(cmd->params[i], proto_str)) - { - protocol_supported = TRUE; - break; - } - } - - if (!protocol_supported) - { - msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, - NULL); - return; - } - - msn_cmdproc_send(cmdproc, "CVR", - "0x0409 winnt 5.1 i386 MSNMSGR 6.0.0602 MSMSGS %s", - purple_account_get_username(account)); -} - -/************************************************************************** - * Log out - **************************************************************************/ - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - if (!g_ascii_strcasecmp(cmd->params[0], "OTH")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER, - NULL); - else if (!g_ascii_strcasecmp(cmd->params[0], "SSD")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL); -} - -void -msn_notification_close(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - - if (!notification->in_use) - return; - - msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL); - - msn_notification_disconnect(notification); -} - -/************************************************************************** - * Messages - **************************************************************************/ - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len); -#ifdef MSN_DEBUG_NS - msn_message_show_readable(msg, "Notification", TRUE); -#endif - - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_destroy(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued - * command and we are processing it */ - - if (cmd->payload == NULL) - { - cmdproc->last_cmd->payload_cb = msg_cmd_post; - cmdproc->servconn->payload_len = atoi(cmd->params[2]); - } - else - { - g_return_if_fail(cmd->payload_cb != NULL); - - cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); - } -} - -/************************************************************************** - * Challenges - **************************************************************************/ - -static void -chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransaction *trans; - char buf[33]; - const char *challenge_resp; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; - int i; - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)cmd->params[1], - strlen(cmd->params[1])); - - challenge_resp = "VT6PX?UQTM4WM%YR"; - - purple_cipher_context_append(context, (const guchar *)challenge_resp, - strlen(challenge_resp)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - for (i = 0; i < 16; i++) - g_snprintf(buf + (i*2), 3, "%02x", digest[i]); - - trans = msn_transaction_new(cmdproc, "QRY", "%s 32", "PROD0038W!61ZTF9"); - - msn_transaction_set_payload(trans, buf, 32); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -/************************************************************************** - * Buddy Lists - **************************************************************************/ - -static void -add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnUser *user; - const char *list; - const char *passport; - const char *friendly; - MsnListId list_id; - int group_id; - - list = cmd->params[1]; - passport = cmd->params[3]; - friendly = purple_url_decode(cmd->params[4]); - - session = cmdproc->session; - - user = msn_userlist_find_user(session->userlist, passport); - - if (user == NULL) - { - user = msn_user_new(session->userlist, passport, friendly); - msn_userlist_add_user(session->userlist, user); - } - else - msn_user_set_friendly_name(user, friendly); - - list_id = msn_get_list_id(list); - - if (cmd->param_count >= 6) - group_id = atoi(cmd->params[5]); - else - group_id = -1; - - msn_got_add_user(session, user, list_id, group_id); - msn_user_update(user); -} - -static void -add_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - const char *list, *passport; - char *reason = NULL; - char *msg = NULL; - char **params; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - params = g_strsplit(trans->params, " ", 0); - - list = params[0]; - passport = params[1]; - - if (!strcmp(list, "FL")) - msg = g_strdup_printf(_("Unable to add user on %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - else if (!strcmp(list, "BL")) - msg = g_strdup_printf(_("Unable to block user on %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - else if (!strcmp(list, "AL")) - msg = g_strdup_printf(_("Unable to permit user on %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - if (!strcmp(list, "FL")) - { - if (error == 210) - { - reason = g_strdup_printf(_("%s could not be added because " - "your buddy list is full."), passport); - } - } - - if (reason == NULL) - { - if (error == 208) - { - reason = g_strdup_printf(_("%s is not a valid passport account."), - passport); - } - else if (error == 500) - { - reason = g_strdup(_("Service Temporarily Unavailable.")); - } - else - { - reason = g_strdup(_("Unknown error.")); - } - } - - if (msg != NULL) - { - purple_notify_error(gc, NULL, msg, reason); - g_free(msg); - } - - if (!strcmp(list, "FL")) - { - PurpleBuddy *buddy; - - buddy = purple_find_buddy(account, passport); - - if (buddy != NULL) - purple_blist_remove_buddy(buddy); - } - - g_free(reason); - - g_strfreev(params); -} - -static void -adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - gint group_id; - const char *group_name; - - session = cmdproc->session; - - group_id = atoi(cmd->params[3]); - - group_name = purple_url_decode(cmd->params[2]); - - msn_group_new(session->userlist, group_id, group_name); - - /* There is a user that must me moved to this group */ - if (cmd->trans->data) - { - /* msn_userlist_move_buddy(); */ - MsnUserList *userlist = cmdproc->session->userlist; - MsnMoveBuddy *data = cmd->trans->data; - - if (data->old_group_name != NULL) - { - msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->old_group_name); - g_free(data->old_group_name); - } - - msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, group_name); - g_free(data->who); - - } -} - -static void -qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - static int count = 0; - const char *passport; - PurpleAccount *account; - - session = cmdproc->session; - account = session->account; - - if (session->passport_info.file == NULL) - return; - - passport = purple_normalize(account, purple_account_get_username(account)); - - if ((strstr(passport, "@hotmail.") == NULL) && - (strstr(passport, "@live.com") == NULL) && - (strstr(passport, "@msn.com") == NULL)) - return; - - if (count++ < 26) - return; - - count = 0; - msn_cmdproc_send(cmdproc, "URL", "%s", "INBOX"); -} - - -static void -fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSlpLink *slplink; - MsnUser *user; - - user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]); - - user->status = "offline"; - msn_user_update(user); - - slplink = msn_session_find_slplink(cmdproc->session, cmd->params[0]); - - if (slplink != NULL) - msn_slplink_destroy(slplink); - -} - -static void -iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj; - const char *state, *passport, *friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[1]; - passport = cmd->params[2]; - friendly = purple_url_decode(cmd->params[3]); - - user = msn_userlist_find_user(session->userlist, passport); - - serv_got_alias(gc, passport, friendly); - - msn_user_set_friendly_name(user, friendly); - - if (session->protocol_ver >= 9 && cmd->param_count == 6) - { - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); - msn_user_set_object(user, msnobj); - } - - msn_user_set_state(user, state); - msn_user_update(user); -} - -static void -ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ -#if 0 - purple_debug_misc("msn", "Incoming Page: {%s}\n", payload); -#endif -} - -static void -ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmdproc->servconn->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = ipg_cmd_post; -} - -static void -nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj; - int clientid; - const char *state, *passport, *friendly, *old_friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[0]; - passport = cmd->params[1]; - friendly = purple_url_decode(cmd->params[2]); - - user = msn_userlist_find_user(session->userlist, passport); - - old_friendly = msn_user_get_friendly_name(user); - if (!old_friendly || (old_friendly && (!friendly || strcmp(old_friendly, friendly)))) - { - serv_got_alias(gc, passport, friendly); - msn_user_set_friendly_name(user, friendly); - } - - if (session->protocol_ver >= 9) - { - if (cmd->param_count == 5) - { - msnobj = - msn_object_new_from_string(purple_url_decode(cmd->params[4])); - msn_user_set_object(user, msnobj); - } - else - { - msn_user_set_object(user, NULL); - } - } - - clientid = atoi(cmd->params[3]); - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE); - - msn_user_set_state(user, state); - msn_user_update(user); -} - -#if 0 -static void -chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *state = cmd->params[1]; - int state_id = 0; - - if (!strcmp(state, "NLN")) - state_id = MSN_ONLINE; - else if (!strcmp(state, "BSY")) - state_id = MSN_BUSY; - else if (!strcmp(state, "IDL")) - state_id = MSN_IDLE; - else if (!strcmp(state, "BRB")) - state_id = MSN_BRB; - else if (!strcmp(state, "AWY")) - state_id = MSN_AWAY; - else if (!strcmp(state, "PHN")) - state_id = MSN_PHONE; - else if (!strcmp(state, "LUN")) - state_id = MSN_LUNCH; - else if (!strcmp(state, "HDN")) - state_id = MSN_HIDDEN; - - cmdproc->session->state = state_id; -} -#endif - - -static void -not_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ -#if 0 - MSN_SET_PARAMS("NOT %d\r\n%s", cmdproc->servconn->payload, payload); - purple_debug_misc("msn", "Notification: {%s}\n", payload); -#endif -} - -static void -not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmdproc->servconn->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = not_cmd_post; -} - -static void -rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - const char *friendly; - char *username; - - session = cmdproc->session; - account = session->account; - username = g_strdup(purple_normalize(account, - purple_account_get_username(account))); - - /* Only set display name if our *own* friendly name changed! */ - if (strcmp(username, purple_normalize(account, cmd->params[2]))) - { - g_free(username); - return; - } - - g_free(username); - - gc = account->gc; - friendly = purple_url_decode(cmd->params[3]); - - purple_connection_set_display_name(gc, friendly); -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - g_return_if_fail(cmd->param_count >= 3); - - type = cmd->params[2]; - - if (cmd->param_count == 4) - { - value = cmd->params[3]; - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - const char *type, *value, *passport; - MsnUser *user; - - passport = cmd->params[1]; - user = msn_userlist_find_user(cmdproc->session->userlist, passport); - - g_return_if_fail(user != NULL); - - type = cmd->params[2]; - value = cmd->params[3]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - else if (!strcmp(value, "N")) - user->mobile = FALSE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -static void -reg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - int group_id; - const char *group_name; - - session = cmdproc->session; - group_id = atoi(cmd->params[2]); - group_name = purple_url_decode(cmd->params[3]); - - msn_userlist_rename_group_id(session->userlist, group_id, group_name); -} - -static void -reg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int group_id; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - group_id = atoi(params[0]); - - group_error_helper(cmdproc->session, _("Unable to rename group"), group_id, error); - - g_strfreev(params); -} - -static void -rem_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnUser *user; - const char *list; - const char *passport; - MsnListId list_id; - int group_id; - - session = cmdproc->session; - list = cmd->params[1]; - passport = cmd->params[3]; - user = msn_userlist_find_user(session->userlist, passport); - - g_return_if_fail(user != NULL); - - list_id = msn_get_list_id(list); - - if (cmd->param_count == 5) - group_id = atoi(cmd->params[4]); - else - group_id = -1; - - msn_got_rem_user(session, user, list_id, group_id); - msn_user_update(user); -} - -static void -rmg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - int group_id; - - session = cmdproc->session; - group_id = atoi(cmd->params[2]); - - msn_userlist_remove_group_id(session->userlist, group_id); -} - -static void -rmg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int group_id; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - group_id = atoi(params[0]); - - group_error_helper(cmdproc->session, _("Unable to delete group"), group_id, error); - - g_strfreev(params); -} - -static void -syn_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnSync *sync; - int total_users; - - session = cmdproc->session; - - if (cmd->param_count == 2) - { - /* - * This can happen if we sent a SYN with an up-to-date - * buddy list revision, but we send 0 to get a full list. - * So, error out. - */ - - msn_session_set_error(cmdproc->session, MSN_ERROR_BAD_BLIST, NULL); - return; - } - - total_users = atoi(cmd->params[2]); - - sync = msn_sync_new(session); - sync->total_users = total_users; - sync->old_cbs_table = cmdproc->cbs_table; - - session->sync = sync; - cmdproc->cbs_table = sync->cbs_table; -} - -/************************************************************************** - * Misc commands - **************************************************************************/ - -static void -url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - const char *rru; - const char *url; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; - FILE *fd; - char *buf; - char buf2[3]; - char sendbuf[64]; - int i; - - session = cmdproc->session; - account = session->account; - - rru = cmd->params[1]; - url = cmd->params[2]; - - buf = g_strdup_printf("%s%lu%s", - session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS", - time(NULL) - session->passport_info.sl, - purple_connection_get_password(account->gc)); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - g_free(buf); - - memset(sendbuf, 0, sizeof(sendbuf)); - - for (i = 0; i < 16; i++) - { - g_snprintf(buf2, sizeof(buf2), "%02x", digest[i]); - strcat(sendbuf, buf2); - } - - if (session->passport_info.file != NULL) - { - g_unlink(session->passport_info.file); - g_free(session->passport_info.file); - } - - if ((fd = purple_mkstemp(&session->passport_info.file, FALSE)) == NULL) - { - purple_debug_error("msn", - "Error opening temp passport file: %s\n", - g_strerror(errno)); - } - else - { -#ifdef _WIN32 - fputs("\n", fd); -#endif - fputs("\n" - "\n" - "\n" - "\n\n", - fd); - - fprintf(fd, "\n"); - fprintf(fd, "\n\n", - url); - fprintf(fd, "\n"); - fprintf(fd, "\n", - purple_account_get_username(account)); - fprintf(fd, "\n", - purple_account_get_username(account)); - if (session->passport_info.sid != NULL) - fprintf(fd, "\n", - session->passport_info.sid); - if (session->passport_info.kv != NULL) - fprintf(fd, "\n", - session->passport_info.kv); - fprintf(fd, "\n"); - fprintf(fd, "\n", - time(NULL) - session->passport_info.sl); - fprintf(fd, "\n", - rru); - if (session->passport_info.mspauth != NULL) - fprintf(fd, "\n", - session->passport_info.mspauth); - fprintf(fd, "\n", - sendbuf); /* TODO Digest me (huh? -- ChipX86) */ - fprintf(fd, "\n"); - fprintf(fd, "\n"); - fprintf(fd, "\n"); - fprintf(fd, "\n"); - - if (fclose(fd)) - { - purple_debug_error("msn", - "Error closing temp passport file: %s\n", - g_strerror(errno)); - - g_unlink(session->passport_info.file); - g_free(session->passport_info.file); - session->passport_info.file = NULL; - } -#ifdef _WIN32 - else - { - /* - * Renaming file with .html extension, so that the - * win32 open_url will work. - */ - char *tmp; - - if ((tmp = - g_strdup_printf("%s.html", - session->passport_info.file)) != NULL) - { - if (g_rename(session->passport_info.file, - tmp) == 0) - { - g_free(session->passport_info.file); - session->passport_info.file = tmp; - } - else - g_free(tmp); - } - } -#endif - } -} -/************************************************************************** - * Switchboards - **************************************************************************/ - -static void -rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - const char *session_id; - char *host; - int port; - - session = cmdproc->session; - session_id = cmd->params[0]; - - msn_parse_socket(cmd->params[1], &host, &port); - - if (session->http_method) - port = 80; - - swboard = msn_switchboard_new(session); - - msn_switchboard_set_invited(swboard, TRUE); - msn_switchboard_set_session_id(swboard, cmd->params[0]); - msn_switchboard_set_auth_key(swboard, cmd->params[3]); - swboard->im_user = g_strdup(cmd->params[4]); - /* msn_switchboard_add_user(swboard, cmd->params[4]); */ - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *host; - int port; - - if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS")) - { - /* Maybe we can have a generic bad command error. */ - purple_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]); - return; - } - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!strcmp(cmd->params[1], "SB")) - { - purple_debug_error("msn", "This shouldn't be handled here.\n"); - } - else if (!strcmp(cmd->params[1], "NS")) - { - MsnSession *session; - - session = cmdproc->session; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); - - msn_notification_connect(session->notification, host, port); - } - - g_free(host); -} - -/************************************************************************** - * Message Types - **************************************************************************/ - -static void -profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - const char *value; - - session = cmdproc->session; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if ((value = msn_message_get_attr(msg, "kv")) != NULL) - { - g_free(session->passport_info.kv); - session->passport_info.kv = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "sid")) != NULL) - { - g_free(session->passport_info.sid); - session->passport_info.sid = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) - { - g_free(session->passport_info.mspauth); - session->passport_info.mspauth = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) - { - g_free(session->passport_info.client_ip); - session->passport_info.client_ip = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) - session->passport_info.client_port = ntohs(atoi(value)); - - if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) - session->passport_info.sl = atol(value); -} - -static void -initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - const char *unread; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.file == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - unread = g_hash_table_lookup(table, "Inbox-Unread"); - - if (unread != NULL) - { - int count = atoi(unread); - - if (count > 0) - { - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.file }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, - passports, urls, NULL, NULL); - } - } - - g_hash_table_destroy(table); -} - -static void -email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - char *from, *subject, *tmp; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.file == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - from = subject = NULL; - - tmp = g_hash_table_lookup(table, "From"); - if (tmp != NULL) - from = purple_mime_decode_field(tmp); - - tmp = g_hash_table_lookup(table, "Subject"); - if (tmp != NULL) - subject = purple_mime_decode_field(tmp); - - purple_notify_email(gc, - (subject != NULL ? subject : ""), - (from != NULL ? from : ""), - msn_user_get_passport(session->user), - session->passport_info.file, NULL, NULL); - - g_free(from); - g_free(subject); - - g_hash_table_destroy(table); -} - -static void -system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *table; - const char *type_s; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - table = msn_message_get_hashtable_from_body(msg); - - if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) - { - int type = atoi(type_s); - char buf[MSN_BUF_LEN]; - int minutes; - - switch (type) - { - case 1: - minutes = atoi(g_hash_table_lookup(table, "Arg1")); - g_snprintf(buf, sizeof(buf), dngettext(PACKAGE, - "The MSN server will shut down for maintenance " - "in %d minute. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", - "The MSN server will shut down for maintenance " - "in %d minutes. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", minutes), - minutes); - default: - break; - } - - if (*buf != '\0') - purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); - } - - g_hash_table_destroy(table); -} - -void -msn_notification_add_buddy(MsnNotification *notification, const char *list, - const char *who, const char *friendly_name, - int group_id) -{ - MsnCmdProc *cmdproc; - cmdproc = notification->servconn->cmdproc; - - if (group_id < 0 && !strcmp(list, "FL")) - group_id = 0; - - if (group_id >= 0) - { - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d", - list, who, friendly_name, group_id); - } - else - { - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who, friendly_name); - } -} - -void -msn_notification_rem_buddy(MsnNotification *notification, const char *list, - const char *who, int group_id) -{ - MsnCmdProc *cmdproc; - cmdproc = notification->servconn->cmdproc; - - if (group_id >= 0) - { - msn_cmdproc_send(cmdproc, "REM", "%s %s %d", list, who, group_id); - } - else - { - msn_cmdproc_send(cmdproc, "REM", "%s %s", list, who); - } -} - -/************************************************************************** - * Init - **************************************************************************/ - -void -msn_notification_init(void) -{ - /* TODO: check prp, blp */ - - cbs_table = msn_table_new(); - - /* Synchronous */ - msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL); - msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "ADD", "ADD", add_cmd); - msn_table_add_cmd(cbs_table, "ADD", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); - msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd); - msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); - msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); - msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); - msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); - /* msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); */ - msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL); - msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd); - msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd); - msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd); - msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); - - /* Asynchronous */ - msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); - - msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); - msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); - msn_table_add_cmd(cbs_table, NULL, "ADD", add_cmd); - - msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); - msn_table_add_cmd(cbs_table, NULL, "QNG", qng_cmd); - msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd); - msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd); - msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); - - msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); - - msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); - - msn_table_add_error(cbs_table, "ADD", add_error); - msn_table_add_error(cbs_table, "REG", reg_error); - msn_table_add_error(cbs_table, "RMG", rmg_error); - /* msn_table_add_error(cbs_table, "REA", rea_error); */ - msn_table_add_error(cbs_table, "USR", usr_error); - - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsprofile", - profile_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsinitialemailnotification", - initial_email_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsemailnotification", - email_msg); - msn_table_add_msg_type(cbs_table, - "application/x-msmsgssystemmessage", - system_msg); -} - -void -msn_notification_end(void) -{ - msn_table_destroy(cbs_table); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/notification.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/** - * @file notification.h Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_NOTIFICATION_H_ -#define _MSN_NOTIFICATION_H_ - -typedef struct _MsnNotification MsnNotification; - -#include "session.h" -#include "servconn.h" -#include "cmdproc.h" - -struct _MsnNotification -{ - MsnSession *session; - MsnCmdProc *cmdproc; - MsnServConn *servconn; - - gboolean in_use; -}; - -#include "state.h" - -void msn_notification_end(void); -void msn_notification_init(void); - -void msn_notification_add_buddy(MsnNotification *notification, - const char *list, const char *who, - const char *friendly_name, int group_id); -void msn_notification_rem_buddy(MsnNotification *notification, - const char *list, const char *who, - int group_id); -MsnNotification *msn_notification_new(MsnSession *session); -void msn_notification_destroy(MsnNotification *notification); -gboolean msn_notification_connect(MsnNotification *notification, - const char *host, int port); -void msn_notification_disconnect(MsnNotification *notification); - -/** - * Closes a notification. - * - * It's first closed, and then disconnected. - * - * @param notification The notification object to close. - */ -void msn_notification_close(MsnNotification *notification); - -void msn_got_login_params(MsnSession *session, const char *login_params); - -#endif /* _MSN_NOTIFICATION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,417 +0,0 @@ -/** - * @file object.c MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "object.h" -#include "debug.h" -/* Sha1 stuff */ -#include "cipher.h" -/* Base64 stuff */ -#include "util.h" - -#define GET_STRING_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - if (obj->field != NULL) \ - g_free(obj->field); \ - obj->field = g_strndup(tag, c - tag); \ - } \ - } - -#define GET_INT_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - char buf[16]; \ - size_t offset; \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - memset(buf, 0, sizeof(buf)); \ - offset = c - tag; \ - if (offset >= sizeof(buf)) \ - offset = sizeof(buf) - 1; \ - strncpy(buf, tag, offset); \ - obj->field = atoi(buf); \ - } \ - } - -static GList *local_objs; - -MsnObject * -msn_object_new(void) -{ - MsnObject *obj; - - obj = g_new0(MsnObject, 1); - - msn_object_set_type(obj, MSN_OBJECT_UNKNOWN); - msn_object_set_friendly(obj, "AAA="); - - return obj; -} - -MsnObject * -msn_object_new_from_string(const char *str) -{ - MsnObject *obj; - char *tag, *c; - - g_return_val_if_fail(str != NULL, NULL); - - if (strncmp(str, "creator == NULL || obj->size == 0 || obj->type == 0 - || obj->location == NULL || obj->friendly == NULL - || obj->sha1d == NULL /*|| obj->sha1c == NULL*/) { - purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); - obj = NULL; - } - - return obj; -} - -MsnObject* -msn_object_new_from_image(PurpleStoredImage *img, const char *location, - const char *creator, MsnObjectType type) -{ - MsnObject *msnobj; - - PurpleCipherContext *ctx; - char *buf; - gconstpointer data; - size_t size; - char *base64; - unsigned char digest[20]; - - msnobj = NULL; - - if (img == NULL) - return msnobj; - - size = purple_imgstore_get_size(img); - data = purple_imgstore_get_data(img); - - /* New object */ - msnobj = msn_object_new(); - msn_object_set_local(msnobj); - msn_object_set_type(msnobj, type); - msn_object_set_location(msnobj, location); - msn_object_set_creator(msnobj, creator); - - msn_object_set_image(msnobj, img); - - /* Compute the SHA1D field. */ - memset(digest, 0, sizeof(digest)); - - ctx = purple_cipher_context_new_by_name("sha1", NULL); - purple_cipher_context_append(ctx, data, size); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1d(msnobj, base64); - g_free(base64); - - msn_object_set_size(msnobj, size); - - /* Compute the SHA1C field. */ - buf = g_strdup_printf( - "Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s", - msn_object_get_creator(msnobj), - msn_object_get_size(msnobj), - msn_object_get_type(msnobj), - msn_object_get_location(msnobj), - msn_object_get_friendly(msnobj), - msn_object_get_sha1d(msnobj)); - - memset(digest, 0, sizeof(digest)); - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(ctx); - g_free(buf); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1c(msnobj, base64); - g_free(base64); - - return msnobj; -} - -void -msn_object_destroy(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->creator); - g_free(obj->location); - g_free(obj->friendly); - g_free(obj->sha1d); - g_free(obj->sha1c); - - purple_imgstore_unref(obj->img); - - if (obj->local) - local_objs = g_list_remove(local_objs, obj); - - g_free(obj); -} - -char * -msn_object_to_string(const MsnObject *obj) -{ - char *str; - const char *sha1c; - - g_return_val_if_fail(obj != NULL, NULL); - - sha1c = msn_object_get_sha1c(obj); - - str = g_strdup_printf("", - msn_object_get_creator(obj), - msn_object_get_size(obj), - msn_object_get_type(obj), - msn_object_get_location(obj), - msn_object_get_friendly(obj), - msn_object_get_sha1d(obj), - sha1c ? " SHA1C=\"" : "", - sha1c ? sha1c : "", - sha1c ? "\"" : ""); - - return str; -} - -void -msn_object_set_creator(MsnObject *obj, const char *creator) -{ - g_return_if_fail(obj != NULL); - - if (obj->creator != NULL) - g_free(obj->creator); - - obj->creator = (creator == NULL ? NULL : g_strdup(creator)); -} - -void -msn_object_set_size(MsnObject *obj, int size) -{ - g_return_if_fail(obj != NULL); - - obj->size = size; -} - -void -msn_object_set_type(MsnObject *obj, MsnObjectType type) -{ - g_return_if_fail(obj != NULL); - - obj->type = type; -} - -void -msn_object_set_location(MsnObject *obj, const char *location) -{ - g_return_if_fail(obj != NULL); - - if (obj->location != NULL) - g_free(obj->location); - - obj->location = (location == NULL ? NULL : g_strdup(location)); -} - -void -msn_object_set_friendly(MsnObject *obj, const char *friendly) -{ - g_return_if_fail(obj != NULL); - - if (obj->friendly != NULL) - g_free(obj->friendly); - - obj->friendly = (friendly == NULL ? NULL : g_strdup(friendly)); -} - -void -msn_object_set_sha1d(MsnObject *obj, const char *sha1d) -{ - g_return_if_fail(obj != NULL); - - if (obj->sha1d != NULL) - g_free(obj->sha1d); - - obj->sha1d = (sha1d == NULL ? NULL : g_strdup(sha1d)); -} - -void -msn_object_set_sha1c(MsnObject *obj, const char *sha1c) -{ - g_return_if_fail(obj != NULL); - - if (obj->sha1c != NULL) - g_free(obj->sha1c); - - obj->sha1c = (sha1c == NULL ? NULL : g_strdup(sha1c)); -} - -const char * -msn_object_get_creator(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->creator; -} - -int -msn_object_get_size(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, 0); - - return obj->size; -} - -MsnObjectType -msn_object_get_type(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, MSN_OBJECT_UNKNOWN); - - return obj->type; -} - -const char * -msn_object_get_location(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->location; -} - -const char * -msn_object_get_friendly(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->friendly; -} - -const char * -msn_object_get_sha1d(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1d; -} - -const char * -msn_object_get_sha1c(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1c; -} - -const char * -msn_object_get_sha1(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - if(obj->sha1c != NULL) { - return obj->sha1c; - } else { - return obj->sha1d; - } -} - -static MsnObject * -msn_object_find_local(const char *sha1) -{ - GList *l; - - g_return_val_if_fail(sha1 != NULL, NULL); - - for (l = local_objs; l != NULL; l = l->next) - { - MsnObject *local_obj = l->data; - - if (!strcmp(msn_object_get_sha1(local_obj), sha1)) - return local_obj; - } - - return NULL; - -} - -void -msn_object_set_local(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - obj->local = TRUE; - - local_objs = g_list_append(local_objs, obj); -} - -void -msn_object_set_image(MsnObject *obj, PurpleStoredImage *img) -{ - g_return_if_fail(obj != NULL); - g_return_if_fail(img != NULL); - - /* obj->local = TRUE; */ - - purple_imgstore_unref(obj->img); - obj->img = purple_imgstore_ref(img); -} - -PurpleStoredImage * -msn_object_get_image(const MsnObject *obj) -{ - MsnObject *local_obj; - - g_return_val_if_fail(obj != NULL, NULL); - - local_obj = msn_object_find_local(msn_object_get_sha1(obj)); - - if (local_obj != NULL) - return local_obj->img; - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/object.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,242 +0,0 @@ -/** - * @file object.h MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_OBJECT_H_ -#define _MSN_OBJECT_H_ - -#include "imgstore.h" - -#include "internal.h" - -typedef enum -{ - MSN_OBJECT_UNKNOWN = -1, /**< Unknown object */ - MSN_OBJECT_RESERVED1 = 1, /**< Reserved */ - MSN_OBJECT_EMOTICON = 2, /**< Custom Emoticon */ - MSN_OBJECT_USERTILE = 3, /**< UserTile (buddy icon) */ - MSN_OBJECT_RESERVED2 = 4, /**< Reserved */ - MSN_OBJECT_BACKGROUND = 5 /**< Background */ - -} MsnObjectType; - -typedef struct -{ - gboolean local; - - char *creator; - int size; - MsnObjectType type; - PurpleStoredImage *img; - char *location; - char *friendly; - char *sha1d; - char *sha1c; - -} MsnObject; - -/** - * Creates a MsnObject structure. - * - * @return A new MsnObject structure. - */ -MsnObject *msn_object_new(void); - -/** - * Creates a MsnObject structure from a string. - * - * @param str The string. - * - * @return The new MsnObject structure. - */ -MsnObject *msn_object_new_from_string(const char *str); - -/** - * Creates a MsnObject structure from a stored image - * - * @param img The image associated to object - * @param location The object location as stored in MsnObject - * @param creator The creator of the object - * @param type The type of the object - * - * @return A new MsnObject structure - */ -MsnObject *msn_object_new_from_image(PurpleStoredImage *img, - const char *location, const char *creator, MsnObjectType type); - -/** - * Destroys an MsnObject structure. - * - * @param obj The object structure. - */ -void msn_object_destroy(MsnObject *obj); - -/** - * Outputs a string representation of an MsnObject. - * - * @param obj The object. - * - * @return The string representation. This must be freed. - */ -char *msn_object_to_string(const MsnObject *obj); - -/** - * Sets the creator field in a MsnObject. - * - * @param creator The creator value. - */ -void msn_object_set_creator(MsnObject *obj, const char *creator); - -/** - * Sets the size field in a MsnObject. - * - * @param size The size value. - */ -void msn_object_set_size(MsnObject *obj, int size); - -/** - * Sets the type field in a MsnObject. - * - * @param type The type value. - */ -void msn_object_set_type(MsnObject *obj, MsnObjectType type); - -/** - * Sets the location field in a MsnObject. - * - * @param location The location value. - */ -void msn_object_set_location(MsnObject *obj, const char *location); - -/** - * Sets the friendly name field in a MsnObject. - * - * @param friendly The friendly name value. - */ -void msn_object_set_friendly(MsnObject *obj, const char *friendly); - -/** - * Sets the SHA1D field in a MsnObject. - * - * @param sha1d The sha1d value. - */ -void msn_object_set_sha1d(MsnObject *obj, const char *sha1d); - -/** - * Sets the SHA1C field in a MsnObject. - * - * @param sha1c The sha1c value. - */ -void msn_object_set_sha1c(MsnObject *obj, const char *sha1c); - -/** - * Associates an image with a MsnObject. - * - * @param obj The object. - * @param img The image to associate. - */ -void msn_object_set_image(MsnObject *obj, PurpleStoredImage *img); - -/** - * Returns a MsnObject's creator value. - * - * @param obj The object. - * - * @return The creator value. - */ -const char *msn_object_get_creator(const MsnObject *obj); - -/** - * Returns a MsnObject's size value. - * - * @param obj The object. - * - * @return The size value. - */ -int msn_object_get_size(const MsnObject *obj); - -/** - * Returns a MsnObject's type. - * - * @param obj The object. - * - * @return The object type. - */ -MsnObjectType msn_object_get_type(const MsnObject *obj); - -/** - * Returns a MsnObject's location value. - * - * @param obj The object. - * - * @return The location value. - */ -const char *msn_object_get_location(const MsnObject *obj); - -/** - * Returns a MsnObject's friendly name value. - * - * @param obj The object. - * - * @return The friendly name value. - */ -const char *msn_object_get_friendly(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1D value. - * - * @param obj The object. - * - * @return The SHA1D value. - */ -const char *msn_object_get_sha1d(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1c(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value if it exists, otherwise SHA1D. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1(const MsnObject *obj); - -/** - * Returns the image associated with the MsnObject. - * - * @param obj The object. - * - * @return The associated image. - */ -PurpleStoredImage *msn_object_get_image(const MsnObject *obj); - -void msn_object_set_local(MsnObject *obj); - -#endif /* _MSN_OBJECT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/** - * @file page.c Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "page.h" - -MsnPage * -msn_page_new(void) -{ - MsnPage *page; - - page = g_new0(MsnPage, 1); - - return page; -} - -void -msn_page_destroy(MsnPage *page) -{ - g_return_if_fail(page != NULL); - - if (page->body != NULL) - g_free(page->body); - - if (page->from_location != NULL) - g_free(page->from_location); - - if (page->from_phone != NULL) - g_free(page->from_phone); - - g_free(page); -} - -char * -msn_page_gen_payload(const MsnPage *page, size_t *ret_size) -{ - char *str; - - g_return_val_if_fail(page != NULL, NULL); - - str = - g_strdup_printf("%s", - msn_page_get_body(page)); - - if (ret_size != NULL) - *ret_size = strlen(str); - - return str; -} - -void -msn_page_set_body(MsnPage *page, const char *body) -{ - g_return_if_fail(page != NULL); - g_return_if_fail(body != NULL); - - if (page->body != NULL) - g_free(page->body); - - page->body = g_strdup(body); -} - -const char * -msn_page_get_body(const MsnPage *page) -{ - g_return_val_if_fail(page != NULL, NULL); - - return page->body; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/page.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/** - * @file page.h Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_PAGE_H_ -#define _MSN_PAGE_H_ - -typedef struct _MsnPage MsnPage; - -#include "session.h" - -/** - * A page. - */ -struct _MsnPage -{ - char *from_location; - char *from_phone; - - char *body; -}; - -/** - * Creates a new, empty page. - * - * @return A new page. - */ -MsnPage *msn_page_new(void); - -/** - * Destroys a page. - */ -void msn_page_destroy(MsnPage *page); - -/** - * Generates the payload data of a page. - * - * @param page The page. - * @param ret_size The returned size of the payload. - * - * @return The payload data of a page. - */ -char *msn_page_gen_payload(const MsnPage *page, size_t *ret_size); - -/** - * Sets the body of a page. - * - * @param page The page. - * @param body The body of the page. - */ -void msn_page_set_body(MsnPage *page, const char *body); - -/** - * Returns the body of the page. - * - * @param page The page. - * - * @return The body of the page. - */ -const char *msn_page_get_body(const MsnPage *page); - -#endif /* _MSN_PAGE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,556 +0,0 @@ -/** - * @file servconn.c Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "servconn.h" -#include "error.h" - -static void read_cb(gpointer data, gint source, PurpleInputCondition cond); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnServConn * -msn_servconn_new(MsnSession *session, MsnServConnType type) -{ - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - servconn = g_new0(MsnServConn, 1); - - servconn->type = type; - - servconn->session = session; - servconn->cmdproc = msn_cmdproc_new(session); - servconn->cmdproc->servconn = servconn; - - servconn->httpconn = msn_httpconn_new(servconn); - - servconn->num = session->servconns_count++; - - servconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - servconn->tx_handler = 0; - - return servconn; -} - -void -msn_servconn_destroy(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->processing) - { - servconn->wasted = TRUE; - return; - } - - if (servconn->connected) - msn_servconn_disconnect(servconn); - - if (servconn->destroy_cb) - servconn->destroy_cb(servconn); - - if (servconn->httpconn != NULL) - msn_httpconn_destroy(servconn->httpconn); - - g_free(servconn->host); - - purple_circ_buffer_destroy(servconn->tx_buf); - if (servconn->tx_handler > 0) - purple_input_remove(servconn->tx_handler); - - msn_cmdproc_destroy(servconn->cmdproc); - g_free(servconn); -} - -void -msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - servconn->connect_cb = connect_cb; -} - -void -msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->disconnect_cb = disconnect_cb; -} - -void -msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->destroy_cb = destroy_cb; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -void -msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error) -{ - char *tmp; - const char *reason; - - const char *names[] = { "Notification", "Switchboard" }; - const char *name; - - name = names[servconn->type]; - - switch (error) - { - case MSN_SERVCONN_ERROR_CONNECT: - reason = _("Unable to connect"); break; - case MSN_SERVCONN_ERROR_WRITE: - reason = _("Writing error"); break; - case MSN_SERVCONN_ERROR_READ: - reason = _("Reading error"); break; - default: - reason = _("Unknown error"); break; - } - - purple_debug_error("msn", "Connection error from %s server (%s): %s\n", - name, servconn->host, reason); - tmp = g_strdup_printf(_("Connection error from %s server:\n%s"), - name, reason); - - if (servconn->type == MSN_SERVCONN_NS) - { - msn_session_set_error(servconn->session, MSN_ERROR_SERVCONN, tmp); - } - else if (servconn->type == MSN_SERVCONN_SB) - { - MsnSwitchBoard *swboard; - swboard = servconn->cmdproc->data; - if (swboard != NULL) - swboard->error = MSN_SB_ERROR_CONNECTION; - } - - msn_servconn_disconnect(servconn); - - g_free(tmp); -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - MsnServConn *servconn; - - servconn = data; - servconn->connect_data = NULL; - servconn->processing = FALSE; - - if (servconn->wasted) - { - if (source >= 0) - close(source); - msn_servconn_destroy(servconn); - return; - } - - servconn->fd = source; - - if (source >= 0) - { - servconn->connected = TRUE; - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - servconn->inpa = purple_input_add(servconn->fd, PURPLE_INPUT_READ, - read_cb, data); - } - else - { - purple_debug_error("msn", "Connection error: %s\n", error_message); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT); - } -} - -gboolean -msn_servconn_connect(MsnServConn *servconn, const char *host, int port) -{ - MsnSession *session; - - g_return_val_if_fail(servconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - session = servconn->session; - - if (servconn->connected) - msn_servconn_disconnect(servconn); - - g_free(servconn->host); - servconn->host = g_strdup(host); - - if (session->http_method) - { - /* HTTP Connection. */ - - if (!servconn->httpconn->connected) - if (!msn_httpconn_connect(servconn->httpconn, host, port)) - return FALSE; - - servconn->connected = TRUE; - servconn->httpconn->virgin = TRUE; - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - - return TRUE; - } - - servconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, connect_cb, servconn); - - if (servconn->connect_data != NULL) - { - servconn->processing = TRUE; - return TRUE; - } - else - return FALSE; -} - -void -msn_servconn_disconnect(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->connect_data != NULL) - { - purple_proxy_connect_cancel(servconn->connect_data); - servconn->connect_data = NULL; - } - - if (!servconn->connected) - { - /* We could not connect. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->session->http_method) - { - /* Fake disconnection. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->inpa > 0) - { - purple_input_remove(servconn->inpa); - servconn->inpa = 0; - } - - close(servconn->fd); - - servconn->rx_buf = NULL; - servconn->rx_len = 0; - servconn->payload_len = 0; - - servconn->connected = FALSE; - - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); -} - -static void -servconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(servconn->tx_buf); - - if (writelen == 0) { - purple_input_remove(servconn->tx_handler); - servconn->tx_handler = 0; - return; - } - - ret = write(servconn->fd, servconn->tx_buf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE); - return; - } - - purple_circ_buffer_mark_read(servconn->tx_buf, ret); -} - -ssize_t -msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len) -{ - ssize_t ret = 0; - - g_return_val_if_fail(servconn != NULL, 0); - - if (!servconn->session->http_method) - { - if (servconn->tx_handler == 0) { - switch (servconn->type) - { - case MSN_SERVCONN_NS: - case MSN_SERVCONN_SB: - ret = write(servconn->fd, buf, len); - break; -#if 0 - case MSN_SERVCONN_DC: - ret = write(servconn->fd, &buf, sizeof(len)); - ret = write(servconn->fd, buf, len); - break; -#endif - default: - ret = write(servconn->fd, buf, len); - break; - } - } else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno == EAGAIN) - ret = 0; - if (ret >= 0 && ret < len) { - if (servconn->tx_handler == 0) - servconn->tx_handler = purple_input_add( - servconn->fd, PURPLE_INPUT_WRITE, - servconn_write_cb, servconn); - purple_circ_buffer_append(servconn->tx_buf, buf + ret, - len - ret); - } - } - else - { - ret = msn_httpconn_write(servconn->httpconn, buf, len); - } - - if (ret == -1) - { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE); - } - - return ret; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn; - MsnSession *session; - char buf[MSN_BUF_LEN]; - char *cur, *end, *old_rx_buf; - int len, cur_len; - - servconn = data; - session = servconn->session; - - len = read(servconn->fd, buf, sizeof(buf) - 1); - servconn->session->account->gc->last_received = time(NULL); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) - { - purple_debug_error("msn", "servconn read error, len: %d error: %s\n", len, g_strerror(errno)); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - buf[len] = '\0'; - - servconn->rx_buf = g_realloc(servconn->rx_buf, len + servconn->rx_len + 1); - memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1); - servconn->rx_len += len; - - end = old_rx_buf = servconn->rx_buf; - - servconn->processing = TRUE; - - do - { - cur = end; - - if (servconn->payload_len) - { - if (servconn->payload_len > servconn->rx_len) - /* The payload is still not complete. */ - break; - - cur_len = servconn->payload_len; - end += cur_len; - } - else - { - end = strstr(cur, "\r\n"); - - if (end == NULL) - /* The command is still not complete. */ - break; - - *end = '\0'; - end += 2; - cur_len = end - cur; - } - - servconn->rx_len -= cur_len; - - if (servconn->payload_len) - { - msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len); - servconn->payload_len = 0; - } - else - { - msn_cmdproc_process_cmd_text(servconn->cmdproc, cur); - } - } while (servconn->connected && !servconn->wasted && servconn->rx_len > 0); - - if (servconn->connected && !servconn->wasted) - { - if (servconn->rx_len > 0) - servconn->rx_buf = g_memdup(cur, servconn->rx_len); - else - servconn->rx_buf = NULL; - } - - servconn->processing = FALSE; - - if (servconn->wasted) - msn_servconn_destroy(servconn); - - g_free(old_rx_buf); -} - -#if 0 -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/servconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -/** - * @file servconn.h Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SERVCONN_H_ -#define _MSN_SERVCONN_H_ - -typedef struct _MsnServConn MsnServConn; - -#include "session.h" -#include "cmdproc.h" - -#include "proxy.h" -#include "httpconn.h" - -/** - * Connection error types. - */ -typedef enum -{ - MSN_SERVCONN_ERROR_NONE, - MSN_SERVCONN_ERROR_CONNECT, - MSN_SERVCONN_ERROR_WRITE, - MSN_SERVCONN_ERROR_READ, - -} MsnServConnError; - -/** - * Connection types. - */ -typedef enum -{ - MSN_SERVCONN_NS, - MSN_SERVCONN_SB - -} MsnServConnType; - -/** - * A Connection. - */ -struct _MsnServConn -{ - MsnServConnType type; /**< The type of this connection. */ - MsnSession *session; /**< The MSN session of this connection. */ - MsnCmdProc *cmdproc; /**< The command processor of this connection. */ - - PurpleProxyConnectData *connect_data; - - gboolean connected; /**< A flag that states if it's connected. */ - gboolean processing; /**< A flag that states if something is working - with this connection. */ - gboolean wasted; /**< A flag that states if it should be destroyed. */ - - char *host; /**< The host this connection is connected or should be - connected to. */ - int num; /**< A number id of this connection. */ - - MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ - - int fd; /**< The connection's file descriptor. */ - int inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer lenght. */ - - size_t payload_len; /**< The length of the payload. - It's only set when we've received a command that - has a payload. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; - - void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ - void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ - void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ -}; - -/** - * Creates a new connection object. - * - * @param session The session. - * @param type The type of the connection. - */ -MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); - -/** - * Destroys a connection object. - * - * @param servconn The connection. - */ -void msn_servconn_destroy(MsnServConn *servconn); - -/** - * Connects to a host. - * - * @param servconn The connection. - * @param host The host. - * @param port The port. - */ -gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port); - -/** - * Disconnects. - * - * @param servconn The connection. - */ -void msn_servconn_disconnect(MsnServConn *servconn); - -/** - * Sets the connect callback. - * - * @param servconn The servconn. - * @param connect_cb The connect callback. - */ -void msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)); -/** - * Sets the disconnect callback. - * - * @param servconn The servconn. - * @param disconnect_cb The disconnect callback. - */ -void msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)); -/** - * Sets the destroy callback. - * - * @param servconn The servconn that's being destroyed. - * @param destroy_cb The destroy callback. - */ -void msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)); - -/** - * Writes a chunck of data to the servconn. - * - * @param servconn The servconn. - * @param buf The data to write. - * @param size The size of the data. - */ -ssize_t msn_servconn_write(MsnServConn *servconn, const char *buf, - size_t size); - -/** - * Function to call whenever an error related to a switchboard occurs. - * - * @param servconn The servconn. - * @param error The error that happened. - */ -void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error); - -#endif /* _MSN_SERVCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,432 +0,0 @@ -/** - * @file session.c MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "session.h" -#include "notification.h" - -#include "dialog.h" - -MsnSession * -msn_session_new(PurpleAccount *account) -{ - MsnSession *session; - - g_return_val_if_fail(account != NULL, NULL); - - session = g_new0(MsnSession, 1); - - session->account = account; - session->notification = msn_notification_new(session); - session->userlist = msn_userlist_new(session); - - session->user = msn_user_new(session->userlist, - purple_account_get_username(account), NULL); - - session->protocol_ver = 9; - - return session; -} - -void -msn_session_destroy(MsnSession *session) -{ - g_return_if_fail(session != NULL); - - session->destroying = TRUE; - - if (session->connected) - msn_session_disconnect(session); - - if (session->notification != NULL) - msn_notification_destroy(session->notification); - - while (session->switches != NULL) - msn_switchboard_destroy(session->switches->data); - - while (session->slplinks != NULL) - msn_slplink_destroy(session->slplinks->data); - - msn_userlist_destroy(session->userlist); - - g_free(session->passport_info.kv); - g_free(session->passport_info.sid); - g_free(session->passport_info.mspauth); - g_free(session->passport_info.client_ip); - - if (session->passport_info.file != NULL) - { - g_unlink(session->passport_info.file); - g_free(session->passport_info.file); - } - - if (session->sync != NULL) - msn_sync_destroy(session->sync); - - if (session->nexus != NULL) - msn_nexus_destroy(session->nexus); - - if (session->user != NULL) - msn_user_destroy(session->user); - - g_free(session); -} - -gboolean -msn_session_connect(MsnSession *session, const char *host, int port, - gboolean http_method) -{ - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(!session->connected, TRUE); - - session->connected = TRUE; - session->http_method = http_method; - - if (session->notification == NULL) - { - purple_debug_error("msn", "This shouldn't happen\n"); - g_return_val_if_reached(FALSE); - } - - if (msn_notification_connect(session->notification, host, port)) - { - return TRUE; - } - - return FALSE; -} - -void -msn_session_disconnect(MsnSession *session) -{ - g_return_if_fail(session != NULL); - g_return_if_fail(session->connected); - - session->connected = FALSE; - - while (session->switches != NULL) - msn_switchboard_close(session->switches->data); - - if (session->notification != NULL) - msn_notification_close(session->notification); -} - -/* TODO: This must go away when conversation is redesigned */ -MsnSwitchBoard * -msn_session_find_swboard(MsnSession *session, const char *username) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user)) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_find_swboard_with_conv(MsnSession *session, PurpleConversation *conv) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(conv != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->conv == conv) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_find_swboard_with_id(const MsnSession *session, int chat_id) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(chat_id >= 0, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->chat_id == chat_id) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_get_swboard(MsnSession *session, const char *username, - MsnSBFlag flag) -{ - MsnSwitchBoard *swboard; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = msn_session_find_swboard(session, username); - - if (swboard == NULL) - { - swboard = msn_switchboard_new(session); - swboard->im_user = g_strdup(username); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, username); - } - - swboard->flag |= flag; - - return swboard; -} - -static void -msn_session_sync_users(MsnSession *session) -{ - PurpleConnection *gc = purple_account_get_connection(session->account); - GList *to_remove = NULL; - GSList *buddies; - - g_return_if_fail(gc != NULL); - - /* The core used to use msn_add_buddy to add all buddies before - * being logged in. This no longer happens, so we manually iterate - * over the whole buddy list to identify sync issues. */ - for (buddies = purple_find_buddies(session->account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *buddy = buddies->data; - const char *buddy_name = purple_buddy_get_name(buddy); - const char *group_name = purple_group_get_name(purple_buddy_get_group(buddy)); - MsnUser *remote_user; - gboolean found = FALSE; - - remote_user = msn_userlist_find_user(session->userlist, buddy_name); - - if (remote_user && remote_user->list_op & MSN_LIST_FL_OP) { - int group_id; - GList *l; - - group_id = msn_userlist_find_group_id(remote_user->userlist, - group_name); - - for (l = remote_user->group_ids; l; l = l->next) { - if (group_id == GPOINTER_TO_INT(l->data)) { - found = TRUE; - break; - } - } - - /* We don't care if they're in a different group, as long as they're on the - * list somewhere. If we check for the group, we cause pain, agony and - * suffering for people who decide to re-arrange their buddy list elsewhere. - */ - if (!found) - { - if ((remote_user == NULL) || !(remote_user->list_op & MSN_LIST_FL_OP)) { - /* The user is not on the server list */ - msn_show_sync_issue(session, buddy_name, group_name); - } else { - /* The user is not in that group on the server list */ - to_remove = g_list_prepend(to_remove, buddy); - } - } - } - } - - if (to_remove != NULL) { - g_list_foreach(to_remove, (GFunc)purple_blist_remove_buddy, NULL); - g_list_free(to_remove); - } -} - -void -msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info) -{ - PurpleConnection *gc; - PurpleConnectionError reason; - char *msg; - - gc = purple_account_get_connection(session->account); - - switch (error) - { - case MSN_ERROR_SERVCONN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(info); - break; - case MSN_ERROR_UNSUPPORTED_PROTOCOL: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Our protocol is not supported by the " - "server")); - break; - case MSN_ERROR_HTTP_MALFORMED: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Error parsing HTTP")); - break; - case MSN_ERROR_SIGN_OTHER: - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - msg = g_strdup(_("You have signed on from another location")); - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); - break; - case MSN_ERROR_SERV_UNAVAILABLE: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are temporarily " - "unavailable. Please wait and try " - "again.")); - break; - case MSN_ERROR_SERV_DOWN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are going down " - "temporarily")); - break; - case MSN_ERROR_AUTH: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - msg = g_strdup_printf(_("Unable to authenticate: %s"), - (info == NULL ) ? - _("Unknown error") : info); - break; - case MSN_ERROR_BAD_BLIST: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Your MSN buddy list is temporarily " - "unavailable. Please wait and try " - "again.")); - break; - default: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Unknown error")); - break; - } - - msn_session_disconnect(session); - - purple_connection_error_reason(gc, reason, msg); - - g_free(msg); -} - -static const char * -get_login_step_text(MsnSession *session) -{ - const char *steps_text[] = { - _("Connecting"), - _("Handshaking"), - _("Transferring"), - _("Handshaking"), - _("Starting authentication"), - _("Getting cookie"), - _("Authenticating"), - _("Sending cookie"), - _("Retrieving buddy list") - }; - - return steps_text[session->login_step]; -} - -void -msn_session_set_login_step(MsnSession *session, MsnLoginStep step) -{ - PurpleConnection *gc; - - /* Prevent the connection progress going backwards, eg. if we get - * transferred several times during login */ - if (session->login_step > step) - return; - - /* If we're already logged in, we're probably here because of a - * mid-session XFR from the notification server, so we don't want to - * popup the connection progress dialog */ - if (session->logged_in) - return; - - gc = session->account->gc; - - session->login_step = step; - - purple_connection_update_progress(gc, get_login_step_text(session), step, - MSN_LOGIN_STEPS); -} - -void -msn_session_finish_login(MsnSession *session) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurpleStoredImage *img; - const char *passport; - - if (session->logged_in) { - /* We are probably here because of a mid-session notification server XFR - * We must send a CHG now, otherwise the servers default to invisible, - * and prevent things happening, like sending IMs */ - msn_change_status(session); - return; - } - - account = session->account; - gc = purple_account_get_connection(account); - - img = purple_buddy_icons_find_account_icon(session->account); - msn_user_set_buddy_icon(session->user, img); - purple_imgstore_unref(img); - - session->logged_in = TRUE; - - msn_change_status(session); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Sync users */ - msn_session_sync_users(session); - /* It seems that some accounts that haven't accessed hotmail for a while - * and @msn.com accounts don't automatically get the initial email - * notification so we always request it on login - */ - - passport = purple_normalize(account, purple_account_get_username(account)); - - if ((strstr(passport, "@hotmail.") != NULL) || - (strstr(passport, "@msn.com") != NULL)) - { - msn_cmdproc_send(session->notification->cmdproc, "URL", "%s", "INBOX"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -/** - * @file session.h MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SESSION_H_ -#define _MSN_SESSION_H_ - -typedef struct _MsnSession MsnSession; - -#include "sslconn.h" - -#include "user.h" -#include "slpcall.h" - -#include "notification.h" -#include "switchboard.h" -#include "group.h" - -#include "cmdproc.h" -#include "nexus.h" -#include "httpconn.h" - -#include "userlist.h" -#include "sync.h" - -/** - * Types of errors. - */ -typedef enum -{ - MSN_ERROR_SERVCONN, - MSN_ERROR_UNSUPPORTED_PROTOCOL, - MSN_ERROR_HTTP_MALFORMED, - MSN_ERROR_AUTH, - MSN_ERROR_BAD_BLIST, - MSN_ERROR_SIGN_OTHER, - MSN_ERROR_SERV_DOWN, - MSN_ERROR_SERV_UNAVAILABLE - -} MsnErrorType; - -/** - * Login steps. - */ -typedef enum -{ - MSN_LOGIN_STEP_START, - MSN_LOGIN_STEP_HANDSHAKE, - MSN_LOGIN_STEP_TRANSFER, - MSN_LOGIN_STEP_HANDSHAKE2, - MSN_LOGIN_STEP_AUTH_START, - MSN_LOGIN_STEP_AUTH, - MSN_LOGIN_STEP_GET_COOKIE, - MSN_LOGIN_STEP_AUTH_END, - MSN_LOGIN_STEP_SYN, - MSN_LOGIN_STEP_END - -} MsnLoginStep; - -#define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END - -struct _MsnSession -{ - PurpleAccount *account; - MsnUser *user; - - guint protocol_ver; - - MsnLoginStep login_step; /**< The current step in the login process. */ - - gboolean connected; - gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ - gboolean destroying; /**< A flag that states if the session is being destroyed. */ - gboolean http_method; - - MsnNotification *notification; - MsnNexus *nexus; - MsnSync *sync; - - MsnUserList *userlist; - - int servconns_count; /**< The count of server connections. */ - GList *switches; /**< The list of all the switchboards. */ - GList *directconns; /**< The list of all the directconnections. */ - GList *slplinks; /**< The list of all the slplinks. */ - - struct - { - char *kv; - char *sid; - char *mspauth; - unsigned long sl; - char *file; - char *client_ip; - int client_port; - int verified; - } passport_info; -}; - -/** - * Creates an MSN session. - * - * @param account The account. - * - * @return The new MSN session. - */ -MsnSession *msn_session_new(PurpleAccount *account); - -/** - * Destroys an MSN session. - * - * @param session The MSN session to destroy. - */ -void msn_session_destroy(MsnSession *session); - -/** - * Connects to and initiates an MSN session. - * - * @param session The MSN session. - * @param host The dispatch server host. - * @param port The dispatch server port. - * @param http_method Whether to use or not http_method. - * - * @return @c TRUE on success, @c FALSE on failure. - */ -gboolean msn_session_connect(MsnSession *session, - const char *host, int port, - gboolean http_method); - -/** - * Disconnects from an MSN session. - * - * @param session The MSN session. - */ -void msn_session_disconnect(MsnSession *session); - - /** - * Finds a switchboard with the given username. - * - * @param session The MSN session. - * @param username The username to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, - const char *username); - - /** - * Finds a switchboard with the given conversation. - * - * @param session The MSN session. - * @param conv The conversation to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, - PurpleConversation *conv); -/** - * Finds a switchboard with the given chat ID. - * - * @param session The MSN session. - * @param chat_id The chat ID to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, - int chat_id); - -/** - * Returns a switchboard to communicate with certain username. - * - * @param session The MSN session. - * @param username The username to search for. - * @param flag The flag of the switchboard - * - * @return The switchboard. - */ -MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, - const char *username, MsnSBFlag flag); - -/** - * Sets an error for the MSN session. - * - * @param session The MSN session. - * @param error The error. - * @param info Extra information. - */ -void msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info); - -/** - * Sets the current step in the login proccess. - * - * @param session The MSN session. - * @param step The current step. - */ -void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); - -/** - * Finish the login proccess. - * - * @param session The MSN session. - */ -void msn_session_finish_login(MsnSession *session); - -#endif /* _MSN_SESSION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1122 +0,0 @@ -/** - * @file msnslp.c MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slp.h" -#include "slpcall.h" -#include "slpmsg.h" -#include "slpsession.h" - -#include "object.h" -#include "user.h" -#include "switchboard.h" - -#include "smiley.h" - -/* Seconds to delay between sending buddy icon requests to the server. */ -#define BUDDY_ICON_DELAY 20 - -static void send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -static void send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -void msn_request_user_display(MsnUser *user); - -/************************************************************************** - * Util - **************************************************************************/ - -static char * -get_token(const char *str, const char *start, const char *end) -{ - const char *c, *c2; - - if ((c = strstr(str, start)) == NULL) - return NULL; - - c += strlen(start); - - if (end != NULL) - { - if ((c2 = strstr(c, end)) == NULL) - return NULL; - - return g_strndup(c, c2 - c); - } - else - { - /* This has to be changed */ - return g_strdup(c); - } - -} - -/************************************************************************** - * Xfer - **************************************************************************/ - -static void -msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - /* MsnSlpLink *slplink; */ - char *content; - - purple_debug_info("msn", "xfer_init\n"); - - slpcall = xfer->data; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_unleash(slpcall->slplink); -} - -void -msn_xfer_cancel(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *content; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - - slpcall = xfer->data; - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) - { - if (slpcall->started) - { - msn_slp_call_close(slpcall); - } - else - { - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_unleash(slpcall->slplink); - - msn_slp_call_destroy(slpcall); - } - } -} - -void -msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset) -{ - PurpleXfer *xfer; - - xfer = slpcall->xfer; - - xfer->bytes_sent = (offset + len); - xfer->bytes_remaining = total_length - (offset + len); - - purple_xfer_update_progress(xfer); -} - -void -msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session) -{ - if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL)) - { - purple_xfer_cancel_remote(slpcall->xfer); - } -} - -void -msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body, - gsize size) -{ - PurpleXfer *xfer = slpcall->xfer; - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); -} - -/************************************************************************** - * SLP Control - **************************************************************************/ - -#if 0 -static void -got_transresp(MsnSlpCall *slpcall, const char *nonce, - const char *ips_str, int port) -{ - MsnDirectConn *directconn; - char **ip_addrs, **c; - - directconn = msn_directconn_new(slpcall->slplink); - - directconn->initial_call = slpcall; - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - ip_addrs = g_strsplit(ips_str, " ", -1); - - for (c = ip_addrs; *c != NULL; c++) - { - purple_debug_info("msn", "ip_addr = %s\n", *c); - if (msn_directconn_connect(directconn, *c, port)) - break; - } - - g_strfreev(ip_addrs); -} -#endif - -static void -send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 200 OK */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 200 OK", - branch, type, content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP 200 OK"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_queue_slpmsg(slplink, slpmsg); - - msn_slp_call_session_init(slpcall); -} - -static void -send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 603 Decline */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 603 Decline", - branch, type, content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP 603 Decline"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -#define MAX_FILE_NAME_LEN 0x226 - -static void -got_sessionreq(MsnSlpCall *slpcall, const char *branch, - const char *euf_guid, const char *context) -{ - if (!strcmp(euf_guid, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6")) - { - /* Emoticon or UserDisplay */ - char *content; - gsize len; - MsnSlpSession *slpsession; - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - MsnObject *obj; - char *msnobj_data; - PurpleStoredImage *img; - int type; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - - slplink = slpcall->slplink; - - msnobj_data = (char *)purple_base64_decode(context, &len); - obj = msn_object_new_from_string(msnobj_data); - type = msn_object_get_type(obj); - g_free(msnobj_data); - - if ((type != MSN_OBJECT_USERTILE) && (type != MSN_OBJECT_EMOTICON)) - { - purple_debug_error("msn", "Wrong object?\n"); - msn_object_destroy(obj); - g_return_if_reached(); - } - - if (type == MSN_OBJECT_EMOTICON) { - char *path; - path = g_build_filename(purple_smileys_get_storing_dir(), - obj->location, NULL); - img = purple_imgstore_new_from_file(path); - g_free(path); - } else { - img = msn_object_get_image(obj); - if (img) - purple_imgstore_ref(img); - } - msn_object_destroy(obj); - - if (img == NULL) - { - purple_debug_error("msn", "Wrong object.\n"); - g_return_if_reached(); - } - - slpsession = msn_slplink_find_slp_session(slplink, - slpcall->session_id); - - /* DATA PREP */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->slpsession = slpsession; - slpmsg->session_id = slpsession->id; - msn_slpmsg_set_body(slpmsg, NULL, 4); -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP DATA PREP"; -#endif - msn_slplink_queue_slpmsg(slplink, slpmsg); - - /* DATA */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->slpsession = slpsession; - slpmsg->flags = 0x20; -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP DATA"; -#endif - msn_slpmsg_set_image(slpmsg, img); - msn_slplink_queue_slpmsg(slplink, slpmsg); - purple_imgstore_unref(img); - } - else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683")) - { - /* File Transfer */ - PurpleAccount *account; - PurpleXfer *xfer; - char *bin; - gsize bin_len; - guint32 file_size; - gchar *file_name; - gunichar2 *uni_name; - - account = slpcall->slplink->session->account; - - slpcall->cb = msn_xfer_completed_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->progress_cb = msn_xfer_progress_cb; - slpcall->branch = g_strdup(branch); - - slpcall->pending = TRUE; - - xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, - slpcall->slplink->remote_user); - if (xfer) - { - bin = (char *)purple_base64_decode(context, &bin_len); - file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8)); - - uni_name = (gunichar2 *)(bin + 20); - while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) { - *uni_name = GUINT16_FROM_LE(*uni_name); - uni_name++; - } - - file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1, - NULL, NULL, NULL); - - g_free(bin); - - purple_xfer_set_filename(xfer, file_name ? file_name : ""); - g_free(file_name); - purple_xfer_set_size(xfer, file_size); - purple_xfer_set_init_fnc(xfer, msn_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); - purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); - - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - xfer->data = slpcall; - - purple_xfer_request(xfer); - } - } -} - -void -send_bye(MsnSlpCall *slpcall, const char *type) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - - slplink = slpcall->slplink; - - g_return_if_fail(slplink != NULL); - - header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0", - slplink->local_user); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, - "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32", - type, - "\r\n"); - g_free(header); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP BYE"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -static void -got_invite(MsnSlpCall *slpcall, - const char *branch, const char *type, const char *content) -{ - MsnSlpLink *slplink; - - slplink = slpcall->slplink; - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { - char *euf_guid, *context; - char *temp; - - euf_guid = get_token(content, "EUF-GUID: {", "}\r\n"); - - temp = get_token(content, "SessionID: ", "\r\n"); - if (temp != NULL) - slpcall->session_id = atoi(temp); - g_free(temp); - - temp = get_token(content, "AppID: ", "\r\n"); - if (temp != NULL) - slpcall->app_id = atoi(temp); - g_free(temp); - - context = get_token(content, "Context: ", "\r\n"); - - if (context != NULL) - got_sessionreq(slpcall, branch, euf_guid, context); - - g_free(context); - g_free(euf_guid); - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* A direct connection? */ - - char *listening, *nonce; - char *content; - - if (FALSE) - { -#if 0 - MsnDirectConn *directconn; - /* const char *ip_addr; */ - char *ip_port; - int port; - - /* ip_addr = purple_prefs_get_string("/purple/ft/public_ip"); */ - ip_port = "5190"; - listening = "true"; - nonce = rand_guid(); - - directconn = msn_directconn_new(slplink); - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - msn_directconn_listen(directconn); - - port = directconn->port; - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "Ipv4Internal-Addrs: 192.168.0.82\r\n" - "Ipv4Internal-Port: %d\r\n" - "\r\n", - listening, - nonce, - port); -#endif - } - else - { - listening = "false"; - nonce = g_strdup("00000000-0000-0000-0000-000000000000"); - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "\r\n", - listening, - nonce); - } - - send_ok(slpcall, branch, - "application/x-msnmsgr-transrespbody", content); - - g_free(content); - g_free(nonce); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (ip_addrs == NULL) - return; - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -static void -got_ok(MsnSlpCall *slpcall, - const char *type, const char *content) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(type != NULL); - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { -#if 0 - if (slpcall->type == MSN_SLPCALL_DC) - { - /* First let's try a DirectConnection. */ - - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - char *branch; - - slplink = slpcall->slplink; - - branch = rand_guid(); - - content = g_strdup_printf( - "Bridges: TRUDPv1 TCPv1\r\n" - "NetID: 0\r\n" - "Conn-Type: Direct-Connect\r\n" - "UPnPNat: false\r\n" - "ICF: false\r\n" - ); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch, - "application/x-msnmsgr-transreqbody", - content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; -#endif - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); - - g_free(branch); - } - else - { - msn_slp_call_session_init(slpcall); - } -#else - msn_slp_call_session_init(slpcall); -#endif - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* Do we get this? */ - purple_debug_info("msn", "OK with transreqbody\n"); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (ip_addrs == NULL) - return; - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -MsnSlpCall * -msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) -{ - MsnSlpCall *slpcall; - - if (body == NULL) - { - purple_debug_warning("msn", "received bogus message\n"); - return NULL; - } - - if (!strncmp(body, "INVITE", strlen("INVITE"))) - { - char *branch; - char *content; - char *content_type; - - slpcall = msn_slp_call_new(slplink); - - /* From: */ -#if 0 - slpcall->remote_user = get_token(body, "From: \r\n"); -#endif - - branch = get_token(body, ";branch={", "}"); - - slpcall->id = get_token(body, "Call-ID: {", "}"); - -#if 0 - long content_len = -1; - - temp = get_token(body, "Content-Length: ", "\r\n"); - if (temp != NULL) - content_len = atoi(temp); - g_free(temp); -#endif - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - got_invite(slpcall, branch, content_type, content); - - g_free(branch); - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 "))) - { - char *content; - char *content_type; - /* Make sure this is "OK" */ - const char *status = body + strlen("MSNSLP/1.0 "); - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - g_return_val_if_fail(slpcall != NULL, NULL); - - if (strncmp(status, "200 OK", 6)) - { - /* It's not valid. Kill this off. */ - char temp[32]; - const char *c; - - /* Eww */ - if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) || - (c = strchr(status, '\0'))) - { - size_t offset = c - status; - if (offset >= sizeof(temp)) - offset = sizeof(temp) - 1; - - strncpy(temp, status, offset); - temp[offset] = '\0'; - } - - purple_debug_error("msn", "Received non-OK result: %s\n", temp); - - slpcall->wasted = TRUE; - - /* msn_slp_call_destroy(slpcall); */ - return slpcall; - } - - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - got_ok(slpcall, content_type, content); - - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "BYE", strlen("BYE"))) - { - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - if (slpcall != NULL) - slpcall->wasted = TRUE; - - /* msn_slp_call_destroy(slpcall); */ - } - else - slpcall = NULL; - - return slpcall; -} - -/************************************************************************** - * Msg Callbacks - **************************************************************************/ - -void -msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - - session = cmdproc->servconn->session; - slplink = msn_session_get_slplink(session, msg->remote_user); - - if (slplink->swboard == NULL) - { - /* We will need this in order to change its flags. */ - slplink->swboard = (MsnSwitchBoard *)cmdproc->data; - /* If swboard is NULL, something has probably gone wrong earlier on - * I didn't want to do this, but MSN 7 is somehow causing us to crash - * here, I couldn't reproduce it to debug more, and people are - * reporting bugs. Hopefully this doesn't cause more crashes. Stu. - */ - if (slplink->swboard != NULL) - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - else - purple_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n"); - } - - msn_slplink_process_msg(slplink, msg); -} - -static void -got_emoticon(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - - PurpleConversation *conv; - PurpleConnection *gc; - const char *who; - - gc = slpcall->slplink->session->account->gc; - who = slpcall->slplink->remote_user; - - if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, gc->account))) { - - /* FIXME: it would be better if we wrote the data as we received it - instead of all at once, calling write multiple times and - close once at the very end - */ - purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); - purple_conv_custom_smiley_close(conv, slpcall->data_info); - } -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); -#endif -} - -void -msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - char **tokens; - char *smile, *body_str; - const char *body, *who, *sha1; - guint tok; - size_t body_len; - - PurpleConversation *conv; - - session = cmdproc->servconn->session; - - if (!purple_account_get_bool(session->account, "custom_smileys", TRUE)) - return; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - - /* MSN Messenger 7 may send more than one MSNObject in a single message... - * Maybe 10 tokens is a reasonable max value. */ - tokens = g_strsplit(body_str, "\t", 10); - - g_free(body_str); - - for (tok = 0; tok < 9; tok += 2) { - if (tokens[tok] == NULL || tokens[tok + 1] == NULL) { - break; - } - - smile = tokens[tok]; - obj = msn_object_new_from_string(purple_url_decode(tokens[tok + 1])); - - if (obj == NULL) - break; - - who = msn_object_get_creator(obj); - sha1 = msn_object_get_sha1(obj); - - slplink = msn_session_get_slplink(session, who); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, - session->account); - - /* If the conversation doesn't exist then this is a custom smiley - * used in the first message in a MSN conversation: we need to create - * the conversation now, otherwise the custom smiley won't be shown. - * This happens because every GtkIMHtml has its own smiley tree: if - * the conversation doesn't exist then we cannot associate the new - * smiley with its GtkIMHtml widget. */ - if (!conv) { - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, who); - } - - if (purple_conv_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) { - msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); - } - - msn_object_destroy(obj); - obj = NULL; - who = NULL; - sha1 = NULL; - } - g_strfreev(tokens); -} - -static gboolean -buddy_icon_cached(PurpleConnection *gc, MsnObject *obj) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - const char *old; - const char *new; - - g_return_val_if_fail(obj != NULL, FALSE); - - account = purple_connection_get_account(gc); - - buddy = purple_find_buddy(account, msn_object_get_creator(obj)); - if (buddy == NULL) - return FALSE; - - old = purple_buddy_icons_get_checksum_for_user(buddy); - new = msn_object_get_sha1(obj); - - if (new == NULL) - return FALSE; - - /* If the old and new checksums are the same, and the file actually exists, - * then return TRUE */ - if (old != NULL && !strcmp(old, new)) - return TRUE; - - return FALSE; -} - -static void -msn_release_buddy_icon_request(MsnUserList *userlist) -{ - MsnUser *user; - - g_return_if_fail(userlist != NULL); - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Releasing buddy icon request\n"); -#endif - - if (userlist->buddy_icon_window > 0) - { - GQueue *queue; - PurpleAccount *account; - const char *username; - - queue = userlist->buddy_icon_requests; - - if (g_queue_is_empty(userlist->buddy_icon_requests)) - return; - - user = g_queue_pop_head(queue); - - account = userlist->session->account; - username = user->passport; - - userlist->buddy_icon_window--; - msn_request_user_display(user); - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", - userlist->buddy_icon_window); -#endif - } -} - -/* - * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next - * buddy icon request if there is one. - */ -static gboolean -msn_release_buddy_icon_request_timeout(gpointer data) -{ - MsnUserList *userlist = (MsnUserList *)data; - - /* Free one window slot */ - userlist->buddy_icon_window++; - - /* Clear the tag for our former request timer */ - userlist->buddy_icon_request_timer = 0; - - msn_release_buddy_icon_request(userlist); - - return FALSE; -} - -void -msn_queue_buddy_icon_request(MsnUser *user) -{ - PurpleAccount *account; - MsnObject *obj; - GQueue *queue; - - g_return_if_fail(user != NULL); - - account = user->userlist->session->account; - - obj = msn_user_get_object(user); - - if (obj == NULL) - { - purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); - return; - } - - if (!buddy_icon_cached(account->gc, obj)) - { - MsnUserList *userlist; - - userlist = user->userlist; - queue = userlist->buddy_icon_requests; - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", - user->passport, userlist->buddy_icon_window); -#endif - - g_queue_push_tail(queue, user); - - if (userlist->buddy_icon_window > 0) - msn_release_buddy_icon_request(userlist); - } -} - -static void -got_user_display(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - MsnUserList *userlist; - const char *info; - PurpleAccount *account; - - g_return_if_fail(slpcall != NULL); - - info = slpcall->data_info; -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); -#endif - - userlist = slpcall->slplink->session->userlist; - account = slpcall->slplink->session->account; - - purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, - g_memdup(data, size), size, info); - -#if 0 - /* Free one window slot */ - userlist->buddy_icon_window++; - - purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n", - userlist->buddy_icon_window); - - msn_release_buddy_icon_request(userlist); -#endif -} - -static void -end_user_display(MsnSlpCall *slpcall, MsnSession *session) -{ - MsnUserList *userlist; - - g_return_if_fail(session != NULL); - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "End User Display\n"); -#endif - - userlist = session->userlist; - - /* If the session is being destroyed we better stop doing anything. */ - if (session->destroying) - return; - - /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. - * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will - * send us an error 800 like so: - * - * C: NS 000: XFR 21 SB - * S: NS 000: 800 21 - */ - if (userlist->buddy_icon_request_timer) { - /* Free the window slot used by this previous request */ - userlist->buddy_icon_window++; - - /* Clear our pending timeout */ - purple_timeout_remove(userlist->buddy_icon_request_timer); - } - - /* Wait BUDDY_ICON_DELAY_S seconds before freeing our window slot and requesting the next icon. */ - userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, - msn_release_buddy_icon_request_timeout, userlist); -} - -void -msn_request_user_display(MsnUser *user) -{ - PurpleAccount *account; - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *info; - - session = user->userlist->session; - account = session->account; - - slplink = msn_session_get_slplink(session, user->passport); - - obj = msn_user_get_object(user); - - info = msn_object_get_sha1(obj); - - if (g_ascii_strcasecmp(user->passport, - purple_account_get_username(account))) - { - msn_slplink_request_object(slplink, info, got_user_display, - end_user_display, obj); - } - else - { - MsnObject *my_obj = NULL; - gconstpointer data = NULL; - size_t len = 0; - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Requesting our own user display\n"); -#endif - - my_obj = msn_user_get_object(session->user); - - if (my_obj != NULL) - { - PurpleStoredImage *img = msn_object_get_image(my_obj); - data = purple_imgstore_get_data(img); - len = purple_imgstore_get_size(img); - } - - purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info); - - /* Free one window slot */ - session->userlist->buddy_icon_window++; - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "msn_request_user_display(): buddy_icon_window++ yields =%d\n", - session->userlist->buddy_icon_window); -#endif - - msn_release_buddy_icon_request(session->userlist); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ -/** - * @file slpcall.c SLP Call Functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slpcall.h" -#include "slpsession.h" - -#include "slp.h" - -/* #define MSN_DEBUG_SLPCALL */ - -/************************************************************************** - * Util - **************************************************************************/ - -static char * -rand_guid(void) -{ - return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X", - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111); -} - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSlpCall * -msn_slp_call_new(MsnSlpLink *slplink) -{ - MsnSlpCall *slpcall; - - g_return_val_if_fail(slplink != NULL, NULL); - - slpcall = g_new0(MsnSlpCall, 1); - -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); -#endif - - slpcall->slplink = slplink; - - msn_slplink_add_slpcall(slplink, slpcall); - - slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall); - - return slpcall; -} - -void -msn_slp_call_destroy(MsnSlpCall *slpcall) -{ - GList *e; - MsnSession *session; - -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); -#endif - - g_return_if_fail(slpcall != NULL); - - if (slpcall->timer) - purple_timeout_remove(slpcall->timer); - - if (slpcall->id != NULL) - g_free(slpcall->id); - - if (slpcall->branch != NULL) - g_free(slpcall->branch); - - if (slpcall->data_info != NULL) - g_free(slpcall->data_info); - - for (e = slpcall->slplink->slp_msgs; e != NULL; ) - { - MsnSlpMessage *slpmsg = e->data; - e = e->next; - -#ifdef MSN_DEBUG_SLPCALL_VERBOSE - purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", - slpmsg); -#endif - - if (slpmsg->slpcall == slpcall) - { - msn_slpmsg_destroy(slpmsg); - } - } - - session = slpcall->slplink->session; - - msn_slplink_remove_slpcall(slpcall->slplink, slpcall); - - if (slpcall->end_cb != NULL) - slpcall->end_cb(slpcall, session); - - if (slpcall->xfer != NULL) { - slpcall->xfer->data = NULL; - purple_xfer_unref(slpcall->xfer); - } - - g_free(slpcall); -} - -void -msn_slp_call_init(MsnSlpCall *slpcall, MsnSlpCallType type) -{ - slpcall->session_id = rand() % 0xFFFFFF00 + 4; - slpcall->id = rand_guid(); - slpcall->type = type; -} - -void -msn_slp_call_session_init(MsnSlpCall *slpcall) -{ - MsnSlpSession *slpsession; - - slpsession = msn_slp_session_new(slpcall); - - if (slpcall->session_init_cb) - slpcall->session_init_cb(slpsession); - - slpcall->started = TRUE; -} - -void -msn_slp_call_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - - g_return_if_fail(slpcall != NULL); - g_return_if_fail(context != NULL); - - slplink = slpcall->slplink; - - slpcall->branch = rand_guid(); - - content = g_strdup_printf( - "EUF-GUID: {%s}\r\n" - "SessionID: %lu\r\n" - "AppID: %d\r\n" - "Context: %s\r\n\r\n", - euf_guid, - slpcall->session_id, - app_id, - context); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, - "application/x-msnmsgr-sessionreqbody", content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); -} - -void -msn_slp_call_close(MsnSlpCall *slpcall) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(slpcall->slplink != NULL); - - send_bye(slpcall, "application/x-msnmsgr-sessionclosebody"); - msn_slplink_unleash(slpcall->slplink); - msn_slp_call_destroy(slpcall); -} - -gboolean -msn_slp_call_timeout(gpointer data) -{ - MsnSlpCall *slpcall; - - slpcall = data; - -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); -#endif - - if (!slpcall->pending && !slpcall->progress) - { - msn_slp_call_destroy(slpcall); - return FALSE; - } - - slpcall->progress = FALSE; - - return TRUE; -} - -MsnSlpCall * -msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnSlpCall *slpcall; - const guchar *body; - gsize body_len; - - slpcall = NULL; - body = slpmsg->buffer; - body_len = slpmsg->size; - - if (slpmsg->flags == 0x0) - { - char *body_str; - - body_str = g_strndup((const char *)body, body_len); - slpcall = msn_slp_sip_recv(slplink, body_str); - g_free(body_str); - } - else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpcall != NULL) - { - if (slpcall->timer) - purple_timeout_remove(slpcall->timer); - - slpcall->cb(slpcall, body, body_len); - - slpcall->wasted = TRUE; - } - } -#if 0 - else if (slpmsg->flags == 0x100) - { - slpcall = slplink->directconn->initial_call; - - if (slpcall != NULL) - msn_slp_call_session_init(slpcall); - } -#endif - - return slpcall; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpcall.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/** - * @file slpcall.h SLP Call functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPCALL_H_ -#define _MSN_SLPCALL_H_ - -#include "internal.h" -#include "ft.h" - -typedef struct _MsnSlpCall MsnSlpCall; - -#include "slplink.h" -#include "slpsession.h" - -/* The official client seems to timeout slp calls after 5 minutes */ -#define MSN_SLPCALL_TIMEOUT 300 - -typedef enum -{ - MSN_SLPCALL_ANY, - MSN_SLPCALL_DC, - -} MsnSlpCallType; - -struct _MsnSlpCall -{ - /* MsnSession *session; */ - MsnSlpLink *slplink; - - MsnSlpCallType type; - - /* Call-ID */ - char *id; - char *branch; - - long session_id; - long app_id; - - gboolean pending; /**< A flag that states if we should wait for this - slpcall to start and do not time out. */ - gboolean progress; /**< A flag that states if there has been progress since - the last time out. */ - gboolean wasted; /**< A flag that states if this slpcall is going to be - destroyed. */ - gboolean started; /**< A flag that states if this slpcall's session has - been initiated. */ - - void (*progress_cb)(MsnSlpCall *slpcall, - gsize total_length, gsize len, gsize offset); - void (*session_init_cb)(MsnSlpSession *slpsession); - - /* Can be checksum, or smile */ - char *data_info; - - PurpleXfer *xfer; - - MsnSlpCb cb; - void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session); - - int timer; -}; - -MsnSlpCall *msn_slp_call_new(MsnSlpLink *slplink); -void msn_slp_call_init(MsnSlpCall *slpcall, MsnSlpCallType type); -void msn_slp_call_session_init(MsnSlpCall *slpcall); -void msn_slp_call_destroy(MsnSlpCall *slpcall); -void msn_slp_call_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context); -void msn_slp_call_close(MsnSlpCall *slpcall); -gboolean msn_slp_call_timeout(gpointer data); - -#endif /* _MSN_SLPCALL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file slp.h MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLP_H_ -#define _MSN_SLP_H_ - -#include "slpcall.h" -#include "session.h" -#include "internal.h" -#include "ft.h" - -void msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize - len, gsize offset); - -MsnSlpCall * msn_slp_sip_recv(MsnSlpLink *slplink, - const char *body); - -void send_bye(MsnSlpCall *slpcall, const char *type); - -void msn_xfer_completed_cb(MsnSlpCall *slpcall, - const guchar *body, gsize size); - -void msn_xfer_cancel(PurpleXfer *xfer); -void msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session); - -void msn_queue_buddy_icon_request(MsnUser *user); - -#endif /* _MSN_SLP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,822 +0,0 @@ -/** - * @file slplink.c MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slplink.h" - -#include "switchboard.h" -#include "slp.h" - -void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -#ifdef MSN_DEBUG_SLP_FILES -static int m_sc = 0; -static int m_rc = 0; - -static void -debug_msg_to_file(MsnMessage *msg, gboolean send) -{ - char *tmp; - char *dir; - char *pload; - FILE *tf; - int c; - gsize pload_size; - - dir = send ? "send" : "recv"; - c = send ? m_sc++ : m_rc++; - tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c); - tf = g_fopen(tmp, "wb"); - if (tf == NULL) - { - purple_debug_error("msn", "could not open debug file\n"); - return; - } - pload = msn_message_gen_payload(msg, &pload_size); - fwrite(pload, 1, pload_size, tf); - fclose(tf); - g_free(tmp); -} -#endif - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSlpLink * -msn_slplink_new(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - - slplink = g_new0(MsnSlpLink, 1); - -#ifdef MSN_DEBUG_SLPLINK - purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); -#endif - - slplink->session = session; - slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; - - slplink->local_user = g_strdup(msn_user_get_passport(session->user)); - slplink->remote_user = g_strdup(username); - - slplink->slp_msg_queue = g_queue_new(); - - session->slplinks = - g_list_append(session->slplinks, slplink); - - return slplink; -} - -void -msn_slplink_destroy(MsnSlpLink *slplink) -{ - MsnSession *session; - -#ifdef MSN_DEBUG_SLPLINK - purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); -#endif - - g_return_if_fail(slplink != NULL); - - if (slplink->swboard != NULL) - slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); - - session = slplink->session; - - if (slplink->local_user != NULL) - g_free(slplink->local_user); - - if (slplink->remote_user != NULL) - g_free(slplink->remote_user); - - if (slplink->directconn != NULL) - msn_directconn_destroy(slplink->directconn); - - while (slplink->slp_calls != NULL) - msn_slp_call_destroy(slplink->slp_calls->data); - - g_queue_free(slplink->slp_msg_queue); - - session->slplinks = - g_list_remove(session->slplinks, slplink); - - g_free(slplink); -} - -MsnSlpLink * -msn_session_find_slplink(MsnSession *session, const char *who) -{ - GList *l; - - for (l = session->slplinks; l != NULL; l = l->next) - { - MsnSlpLink *slplink; - - slplink = l->data; - - if (!strcmp(slplink->remote_user, who)) - return slplink; - } - - return NULL; -} - -MsnSlpLink * -msn_session_get_slplink(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - slplink = msn_session_find_slplink(session, username); - - if (slplink == NULL) - slplink = msn_slplink_new(session, username); - - return slplink; -} - -MsnSlpSession * -msn_slplink_find_slp_session(MsnSlpLink *slplink, long session_id) -{ - GList *l; - MsnSlpSession *slpsession; - - for (l = slplink->slp_sessions; l != NULL; l = l->next) - { - slpsession = l->data; - - if (slpsession->id == session_id) - return slpsession; - } - - return NULL; -} - -void -msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - if (slplink->swboard != NULL) - slplink->swboard->flag |= MSN_SB_FLAG_FT; - - slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); -} - -void -msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall); - - /* The slplink has no slpcalls in it. If no one is using it, we might - * destroy the switchboard, but we should be careful not to use the slplink - * again. */ - if (slplink->slp_calls == NULL) - { - if (slplink->swboard != NULL) - { - if (msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT)) - /* I'm not sure this is the best thing to do, but it's better - * than nothing. */ - slpcall->slplink = NULL; - } - } -} - -MsnSlpCall * -msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id) -{ - GList *l; - MsnSlpCall *slpcall; - - if (!id) - return NULL; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->id && !strcmp(slpcall->id, id)) - return slpcall; - } - - return NULL; -} - -MsnSlpCall * -msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id) -{ - GList *l; - MsnSlpCall *slpcall; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->session_id == id) - return slpcall; - } - - return NULL; -} - -void -msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ - if (slplink->directconn != NULL) - { - msn_directconn_send_msg(slplink->directconn, msg); - } - else - { - if (slplink->swboard == NULL) - { - slplink->swboard = msn_session_get_swboard(slplink->session, - slplink->remote_user, MSN_SB_FLAG_FT); - - if (slplink->swboard == NULL) - return; - - /* If swboard is destroyed we will be too */ - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - - msn_switchboard_send_msg(slplink->swboard, msg, TRUE); - } -} - -/* We have received the message ack */ -static void -msg_ack(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - long long real_size; - - slpmsg = data; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - slpmsg->offset += msg->msnslp_header.length; - - if (slpmsg->offset < real_size) - { - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - } - else - { - /* The whole message has been sent */ - if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - if (slpmsg->slpcall != NULL) - { - if (slpmsg->slpcall->cb) - slpmsg->slpcall->cb(slpmsg->slpcall, - NULL, 0); - } - } - } - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -/* We have received the message nak. */ -static void -msg_nak(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - - slpmsg = data; - - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -void -msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - long long real_size; - size_t len = 0; - - /* Maybe we will want to create a new msg for this slpmsg instead of - * reusing the same one all the time. */ - msg = slpmsg->msg; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - if (slpmsg->offset < real_size) - { - if (slpmsg->fp) - { - char data[1202]; - len = fread(data, 1, sizeof(data), slpmsg->fp); - msn_message_set_bin_data(msg, data, len); - } - else - { - len = slpmsg->size - slpmsg->offset; - - if (len > 1202) - len = 1202; - - msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len); - } - - msg->msnslp_header.offset = slpmsg->offset; - msg->msnslp_header.length = len; - } - -#ifdef MSN_DEBUG_SLP - msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); -#endif - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, TRUE); -#endif - - slpmsg->msgs = - g_list_append(slpmsg->msgs, msg); - msn_slplink_send_msg(slplink, msg); - - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, slpmsg->offset); - } - } - - /* slpmsg->offset += len; */ -} - -void -msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - - slpmsg->msg = msg = msn_message_new_msnslp(); - - if (slpmsg->flags == 0x0) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x2) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - } - else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - MsnSlpSession *slpsession; - slpsession = slpmsg->slpsession; - - g_return_if_fail(slpsession != NULL); - msg->msnslp_header.session_id = slpsession->id; - msg->msnslp_footer.value = slpsession->app_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x100) - { - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - } - - msg->msnslp_header.id = slpmsg->id; - msg->msnslp_header.flags = slpmsg->flags; - - msg->msnslp_header.total_size = slpmsg->size; - - msn_message_set_attr(msg, "P2P-Dest", slplink->remote_user); - - msg->ack_cb = msg_ack; - msg->nak_cb = msg_nak; - msg->ack_data = slpmsg; - - msn_slplink_send_msgpart(slplink, slpmsg); - - msn_message_destroy(msg); -} - -void -msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - slpmsg->id = slplink->slp_seq_id++; - - g_queue_push_head(slplink->slp_msg_queue, slpmsg); -} - -void -msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - slpmsg->id = slplink->slp_seq_id++; - - msn_slplink_release_slpmsg(slplink, slpmsg); -} - -void -msn_slplink_unleash(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - /* Send the queued msgs in the order they came. */ - - while ((slpmsg = g_queue_pop_tail(slplink->slp_msg_queue)) != NULL) - { - msn_slplink_release_slpmsg(slplink, slpmsg); - } -} - -void -msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - - slpmsg = msn_slpmsg_new(slplink); - - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = 0x02; - slpmsg->ack_id = msg->msnslp_header.id; - slpmsg->ack_sub_id = msg->msnslp_header.ack_id; - slpmsg->ack_size = msg->msnslp_header.total_size; - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP ACK"; -#endif - - msn_slplink_send_slpmsg(slplink, slpmsg); - msn_slpmsg_destroy(slpmsg); -} - -static void -send_file_cb(MsnSlpSession *slpsession) -{ - MsnSlpCall *slpcall; - MsnSlpMessage *slpmsg; - struct stat st; - PurpleXfer *xfer; - - slpcall = slpsession->slpcall; - slpmsg = msn_slpmsg_new(slpcall->slplink); - slpmsg->slpcall = slpcall; - slpmsg->flags = 0x1000030; - slpmsg->slpsession = slpsession; -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP FILE"; -#endif - xfer = (PurpleXfer *)slpcall->xfer; - purple_xfer_start(slpcall->xfer, -1, NULL, 0); - slpmsg->fp = xfer->dest_fp; - if (g_stat(purple_xfer_get_local_filename(xfer), &st) == 0) - slpmsg->size = st.st_size; - xfer->dest_fp = NULL; /* Disable double fclose() */ - - msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); -} - -void -msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - const char *data; - guint64 offset; - gsize len; - -#ifdef MSN_DEBUG_SLP - msn_slpmsg_show(msg); -#endif - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, FALSE); -#endif - - if (msg->msnslp_header.total_size < msg->msnslp_header.length) - { - purple_debug_error("msn", "This can't be good\n"); - g_return_if_reached(); - } - - slpmsg = NULL; - data = msn_message_get_bin_data(msg, &len); - - /* - OVERHEAD! - if (msg->msnslp_header.length < msg->msnslp_header.total_size) - */ - - offset = msg->msnslp_header.offset; - - if (offset == 0) - { - slpmsg = msn_slpmsg_new(slplink); - slpmsg->id = msg->msnslp_header.id; - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = msg->msnslp_header.flags; - - if (slpmsg->session_id) - { - if (slpmsg->slpcall == NULL) - slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpmsg->slpcall != NULL) - { - if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - PurpleXfer *xfer; - - xfer = slpmsg->slpcall->xfer; - - if (xfer != NULL) - { - purple_xfer_ref(xfer); - purple_xfer_start(xfer, -1, NULL, 0); - - if (xfer->data == NULL) { - purple_xfer_unref(xfer); - return; - } else { - purple_xfer_unref(xfer); - slpmsg->fp = xfer->dest_fp; - xfer->dest_fp = NULL; /* Disable double fclose() */ - } - } - } - } - } - if (!slpmsg->fp && slpmsg->size) - { - slpmsg->buffer = g_try_malloc(slpmsg->size); - if (slpmsg->buffer == NULL) - { - purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); - msn_slpmsg_destroy(slpmsg); - return; - } - } - } - else - { - slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.session_id, msg->msnslp_header.id); - } - - if (slpmsg == NULL) - { - /* Probably the transfer was canceled */ - purple_debug_error("msn", "Couldn't find slpmsg\n"); - return; - } - - if (slpmsg->fp) - { - /* fseek(slpmsg->fp, offset, SEEK_SET); */ - len = fwrite(data, 1, len, slpmsg->fp); - } - else if (slpmsg->size && slpmsg->buffer) - { - if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size) - { - purple_debug_error("msn", "Oversized slpmsg\n"); - g_return_if_reached(); - } - else - memcpy(slpmsg->buffer + offset, data, len); - } - - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, offset); - } - } - -#if 0 - if (slpmsg->buffer == NULL) - return; -#endif - - if (msg->msnslp_header.offset + msg->msnslp_header.length - >= msg->msnslp_header.total_size) - { - /* All the pieces of the slpmsg have been received */ - MsnSlpCall *slpcall; - - slpcall = msn_slp_process_msg(slplink, slpmsg); - - if (slpmsg->flags == 0x100) - { - MsnDirectConn *directconn; - - directconn = slplink->directconn; - - if (!directconn->acked) - msn_directconn_send_handshake(directconn); - } - else if (slpmsg->flags == 0x0 || slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000030) - { - /* Release all the messages and send the ACK */ - - msn_slplink_send_ack(slplink, msg); - msn_slplink_unleash(slplink); - } - - msn_slpmsg_destroy(slpmsg); - - if (slpcall != NULL && slpcall->wasted) - msn_slp_call_destroy(slpcall); - } -} - -MsnSlpMessage * -msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) -{ - GList *e; - - for (e = slplink->slp_msgs; e != NULL; e = e->next) - { - MsnSlpMessage *slpmsg = e->data; - - if ((slpmsg->session_id == session_id) && (slpmsg->id == id)) - return slpmsg; - } - - return NULL; -} - -typedef struct -{ - guint32 length; - guint32 unk1; - guint32 file_size; - guint32 unk2; - guint32 unk3; -} MsnContextHeader; - -#define MAX_FILE_NAME_LEN 0x226 - -static gchar * -gen_context(const char *file_name, const char *file_path) -{ - struct stat st; - gsize size = 0; - MsnContextHeader header; - gchar *u8 = NULL; - guchar *base; - guchar *n; - gchar *ret; - gunichar2 *uni = NULL; - glong currentChar = 0; - glong uni_len = 0; - gsize len; - - if (g_stat(file_path, &st) == 0) - size = st.st_size; - - if(!file_name) { - u8 = purple_utf8_try_convert(g_basename(file_path)); - file_name = u8; - } - - uni = g_utf8_to_utf16(file_name, -1, NULL, &uni_len, NULL); - - if(u8) { - g_free(u8); - file_name = NULL; - u8 = NULL; - } - - len = sizeof(MsnContextHeader) + MAX_FILE_NAME_LEN + 4; - - header.length = GUINT32_TO_LE(len); - header.unk1 = GUINT32_TO_LE(2); - header.file_size = GUINT32_TO_LE(size); - header.unk2 = GUINT32_TO_LE(0); - header.unk3 = GUINT32_TO_LE(0); - - base = g_malloc(len + 1); - n = base; - - memcpy(n, &header, sizeof(MsnContextHeader)); - n += sizeof(MsnContextHeader); - - memset(n, 0x00, MAX_FILE_NAME_LEN); - for(currentChar = 0; currentChar < uni_len; currentChar++) { - *((gunichar2 *)n + currentChar) = GUINT16_TO_LE(uni[currentChar]); - } - n += MAX_FILE_NAME_LEN; - - memset(n, 0xFF, 4); - n += 4; - - g_free(uni); - ret = purple_base64_encode(base, len); - g_free(base); - return ret; -} - -void -msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *context; - const char *fn; - const char *fp; - - fn = purple_xfer_get_filename(xfer); - fp = purple_xfer_get_local_filename(xfer); - - g_return_if_fail(slplink != NULL); - g_return_if_fail(fp != NULL); - - slpcall = msn_slp_call_new(slplink); - msn_slp_call_init(slpcall, MSN_SLPCALL_DC); - - slpcall->session_init_cb = send_file_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->progress_cb = msn_xfer_progress_cb; - slpcall->cb = msn_xfer_completed_cb; - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - slpcall->pending = TRUE; - - purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); - - xfer->data = slpcall; - - context = gen_context(fn, fp); - - msn_slp_call_invite(slpcall, "5D3E02AB-6190-11D3-BBBB-00C04F795683", 2, - context); - - g_free(context); -} - -void -msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj) -{ - MsnSlpCall *slpcall; - char *msnobj_data; - char *msnobj_base64; - - g_return_if_fail(slplink != NULL); - g_return_if_fail(obj != NULL); - - msnobj_data = msn_object_to_string(obj); - msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); - g_free(msnobj_data); - - slpcall = msn_slp_call_new(slplink); - msn_slp_call_init(slpcall, MSN_SLPCALL_ANY); - - slpcall->data_info = g_strdup(info); - slpcall->cb = cb; - slpcall->end_cb = end_cb; - - msn_slp_call_invite(slpcall, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6", 1, - msnobj_base64); - - g_free(msnobj_base64); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slplink.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/** - * @file slplink.h MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPLINK_H_ -#define _MSN_SLPLINK_H_ - -typedef struct _MsnSlpLink MsnSlpLink; - -#include "directconn.h" -#include "slpcall.h" -#include "slpmsg.h" - -#include "switchboard.h" - -#include "ft.h" - -#include "session.h" - -typedef void (*MsnSlpCb)(MsnSlpCall *slpcall, - const guchar *data, gsize size); -typedef void (*MsnSlpEndCb)(MsnSlpCall *slpcall, MsnSession *session); - -struct _MsnSlpLink -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - char *local_user; - char *remote_user; - - int slp_seq_id; - - MsnDirectConn *directconn; - - GList *slp_calls; - GList *slp_sessions; - GList *slp_msgs; - - GQueue *slp_msg_queue; -}; - -MsnSlpLink *msn_slplink_new(MsnSession *session, const char *username); -void msn_slplink_destroy(MsnSlpLink *slplink); -MsnSlpLink *msn_session_find_slplink(MsnSession *session, - const char *who); -MsnSlpLink *msn_session_get_slplink(MsnSession *session, const char *username); -MsnSlpSession *msn_slplink_find_slp_session(MsnSlpLink *slplink, - long session_id); -void msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -void msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink, - const char *id); -MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id); -void msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg); -void msn_slplink_release_slpmsg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); -void msn_slplink_send_slpmsg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_unleash(MsnSlpLink *slplink); -void msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg); -void msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg); -MsnSlpMessage *msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id); -void msn_slplink_append_slp_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); -void msn_slplink_remove_slp_msg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer); - -void msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj); - -MsnSlpCall *msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -#endif /* _MSN_SLPLINK_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,239 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slpmsg.h" -#include "slplink.h" - -/************************************************************************** - * SLP Message - **************************************************************************/ - -MsnSlpMessage * -msn_slpmsg_new(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - slpmsg = g_new0(MsnSlpMessage, 1); - -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); -#endif - - slpmsg->slplink = slplink; - - slplink->slp_msgs = - g_list_append(slplink->slp_msgs, slpmsg); - - return slpmsg; -} - -void -msn_slpmsg_destroy(MsnSlpMessage *slpmsg) -{ - MsnSlpLink *slplink; - GList *cur; - - g_return_if_fail(slpmsg != NULL); - -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); -#endif - - slplink = slpmsg->slplink; - - if (slpmsg->fp != NULL) - fclose(slpmsg->fp); - - purple_imgstore_unref(slpmsg->img); - - /* We don't want to free the data of the PurpleStoredImage, - * but to avoid code duplication, it's sharing buffer. */ - if (slpmsg->img == NULL) - g_free(slpmsg->buffer); - -#ifdef MSN_DEBUG_SLP - /* - if (slpmsg->info != NULL) - g_free(slpmsg->info); - */ -#endif - - for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) - { - /* Something is pointing to this slpmsg, so we should remove that - * pointer to prevent a crash. */ - /* Ex: a user goes offline and after that we receive an ACK */ - - MsnMessage *msg = cur->data; - -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "Unlink slpmsg callbacks.\n"); -#endif - - msg->ack_cb = NULL; - msg->nak_cb = NULL; - msg->ack_data = NULL; - } - - slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); - - g_free(slpmsg); -} - -void -msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - if (body != NULL) - slpmsg->buffer = g_memdup(body, size); - else - slpmsg->buffer = g_new0(guchar, size); - - slpmsg->size = size; -} - -void -msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - slpmsg->img = purple_imgstore_ref(img); - slpmsg->buffer = (guchar *)purple_imgstore_get_data(img); - slpmsg->size = purple_imgstore_get_size(img); -} - -void -msn_slpmsg_open_file(MsnSlpMessage *slpmsg, const char *file_name) -{ - struct stat st; - - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - slpmsg->fp = g_fopen(file_name, "rb"); - - if (g_stat(file_name, &st) == 0) - slpmsg->size = st.st_size; -} - -#ifdef MSN_DEBUG_SLP -void -msn_slpmsg_show(MsnMessage *msg) -{ - const char *info; - gboolean text; - guint32 flags; - - text = FALSE; - - flags = GUINT32_TO_LE(msg->msnslp_header.flags); - - switch (flags) - { - case 0x0: - info = "SLP CONTROL"; - text = TRUE; - break; - case 0x2: - info = "SLP ACK"; break; - case 0x20: - case 0x1000030: - info = "SLP DATA"; break; - default: - info = "SLP UNKNOWN"; break; - } - - msn_message_show_readable(msg, info, text); -} -#endif - -MsnSlpMessage * -msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, const char *branch, - const char *content_type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *body; - gsize body_len; - gsize content_len; - - g_return_val_if_fail(slpcall != NULL, NULL); - g_return_val_if_fail(header != NULL, NULL); - - slplink = slpcall->slplink; - - /* Let's remember that "content" should end with a 0x00 */ - - content_len = (content != NULL) ? strlen(content) + 1 : 0; - - body = g_strdup_printf( - "%s\r\n" - "To: \r\n" - "From: \r\n" - "Via: MSNSLP/1.0/TLP ;branch={%s}\r\n" - "CSeq: %d\r\n" - "Call-ID: {%s}\r\n" - "Max-Forwards: 0\r\n" - "Content-Type: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "\r\n", - header, - slplink->remote_user, - slplink->local_user, - branch, - cseq, - slpcall->id, - content_type, - content_len); - - body_len = strlen(body); - - if (content_len > 0) - { - body_len += content_len; - body = g_realloc(body, body_len); - g_strlcat(body, content, body_len); - } - - slpmsg = msn_slpmsg_new(slplink); - msn_slpmsg_set_body(slpmsg, body, body_len); - - slpmsg->sip = TRUE; - slpmsg->slpcall = slpcall; - - g_free(body); - - return slpmsg; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpmsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPMSG_H_ -#define _MSN_SLPMSG_H_ - -typedef struct _MsnSlpMessage MsnSlpMessage; - -#include "imgstore.h" - -#include "slpsession.h" -#include "slpcall.h" -#include "slplink.h" -#include "session.h" -#include "msg.h" - -#include "slp.h" - -/** - * A SLP Message This contains everything that we will need to send a SLP - * Message even if has to be sent in several parts. - */ -struct _MsnSlpMessage -{ - MsnSlpSession *slpsession; - MsnSlpCall *slpcall; /**< The slpcall to which this slp message belongs (if applicable). */ - MsnSlpLink *slplink; /**< The slplink through which this slp message is being sent. */ - MsnSession *session; - - long session_id; - long id; - long ack_id; - long ack_sub_id; - long long ack_size; - long app_id; - - gboolean sip; /**< A flag that states if this is a SIP slp message. */ - int ref_count; /**< The reference count. */ - long flags; - - FILE *fp; - PurpleStoredImage *img; - guchar *buffer; - long long offset; - long long size; - - GList *msgs; /**< The real messages. */ - -#if 1 - MsnMessage *msg; /**< The temporary real message that will be sent. */ -#endif - -#ifdef MSN_DEBUG_SLP - char *info; - gboolean text_body; -#endif -}; - -/** - * Creates a new slp message - * - * @param slplink The slplink through which this slp message will be sent. - * @return The created slp message. - */ -MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink); - -/** - * Destroys a slp message - * - * @param slpmsg The slp message to destory. - */ -void msn_slpmsg_destroy(MsnSlpMessage *slpmsg); - -void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size); -void msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img); -void msn_slpmsg_open_file(MsnSlpMessage *slpmsg, - const char *file_name); -MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, - const char *branch, - const char *content_type, - const char *content); - -#ifdef MSN_DEBUG_SLP -void msn_slpmsg_show(MsnMessage *msg); -#endif - -#endif /* _MSN_SLPMSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/** - * @file slpsession.h SLP Session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "slpsession.h" - -/************************************************************************** - * SLP Session - **************************************************************************/ - -MsnSlpSession * -msn_slp_session_new(MsnSlpCall *slpcall) -{ - MsnSlpSession *slpsession; - - g_return_val_if_fail(slpcall != NULL, NULL); - - slpsession = g_new0(MsnSlpSession, 1); - - slpsession->slpcall = slpcall; - slpsession->id = slpcall->session_id; - slpsession->call_id = slpcall->id; - slpsession->app_id = slpcall->app_id; - - slpcall->slplink->slp_sessions = - g_list_append(slpcall->slplink->slp_sessions, slpsession); - - return slpsession; -} - -void -msn_slp_session_destroy(MsnSlpSession *slpsession) -{ - g_return_if_fail(slpsession != NULL); - - if (slpsession->call_id != NULL) - g_free(slpsession->call_id); - - slpsession->slpcall->slplink->slp_sessions = - g_list_remove(slpsession->slpcall->slplink->slp_sessions, slpsession); - - g_free(slpsession); -} - -#if 0 -static void -msn_slp_session_send_slpmsg(MsnSlpSession *slpsession, MsnSlpMessage *slpmsg) -{ - slpmsg->slpsession = slpsession; - -#if 0 - slpmsg->session_id = slpsession->id; - slpmsg->app_id = slpsession->app_id; -#endif - - msn_slplink_send_slpmsg(slpsession->slpcall->slplink, slpmsg); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/slpsession.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file slpsession.h SLP Session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPSESSION_H_ -#define _MSN_SLPSESSION_H_ - -typedef struct _MsnSlpSession MsnSlpSession; - -#include "slpcall.h" -#include "slpsession.h" -#include "slpmsg.h" - -struct _MsnSlpSession -{ - /* MsnSlpLink *slplink; */ - MsnSlpCall *slpcall; - - long id; - - long app_id; - char *call_id; -}; - -MsnSlpSession *msn_slp_session_new(MsnSlpCall *slpcall); -void msn_slp_session_destroy(MsnSlpSession *slpsession); -void msn_slpsession_send_slpmsg(MsnSlpSession *slpsession, - MsnSlpMessage *slpmsg); -#endif /* _MSN_SLPSESSION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file state.c State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "state.h" - -static const char *away_text[] = -{ - N_("Available"), - N_("Available"), - N_("Busy"), - N_("Idle"), - N_("Be Right Back"), - N_("Away From Computer"), - N_("On The Phone"), - N_("Out To Lunch"), - N_("Available"), - N_("Available") -}; - -void -msn_change_status(MsnSession *session) -{ - PurpleAccount *account; - MsnCmdProc *cmdproc; - MsnUser *user; - MsnObject *msnobj; - const char *state_text; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->notification != NULL); - - account = session->account; - cmdproc = session->notification->cmdproc; - user = session->user; - state_text = msn_state_get_text(msn_state_from_account(account)); - - /* If we're not logged in yet, don't send the status to the server, - * it will be sent when login completes - */ - if (!session->logged_in) - return; - - msnobj = msn_user_get_object(user); - - if (msnobj == NULL) - { - msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, - MSN_CLIENT_ID); - } - else - { - char *msnobj_str; - - msnobj_str = msn_object_to_string(msnobj); - - msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text, - MSN_CLIENT_ID, purple_url_encode(msnobj_str)); - - g_free(msnobj_str); - } -} - -const char * -msn_away_get_text(MsnAwayType type) -{ - g_return_val_if_fail(type <= MSN_HIDDEN, NULL); - - return _(away_text[type]); -} - -const char * -msn_state_get_text(MsnAwayType state) -{ - static char *status_text[] = - { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" }; - - return status_text[state]; -} - -MsnAwayType -msn_state_from_account(PurpleAccount *account) -{ - MsnAwayType msnstatus; - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); - - if (!strcmp(status_id, "away")) - msnstatus = MSN_AWAY; - else if (!strcmp(status_id, "brb")) - msnstatus = MSN_BRB; - else if (!strcmp(status_id, "busy")) - msnstatus = MSN_BUSY; - else if (!strcmp(status_id, "phone")) - msnstatus = MSN_PHONE; - else if (!strcmp(status_id, "lunch")) - msnstatus = MSN_LUNCH; - else if (!strcmp(status_id, "invisible")) - msnstatus = MSN_HIDDEN; - else - msnstatus = MSN_ONLINE; - - if ((msnstatus == MSN_ONLINE) && purple_presence_is_idle(presence)) - msnstatus = MSN_IDLE; - - return msnstatus; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/state.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/** - * @file state.h State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_STATE_H_ -#define _MSN_STATE_H_ - -/** - * Away types. - */ -typedef enum -{ - MSN_ONLINE = 1, - MSN_BUSY = 2, - MSN_IDLE = 3, - MSN_BRB = 4, - MSN_AWAY = 5, - MSN_PHONE = 6, - MSN_LUNCH = 7, - MSN_OFFLINE = 8, - MSN_HIDDEN = 9 - -} MsnAwayType; - -/** - * Changes the status of the user. - * - * @param session The MSN session. - */ -void msn_change_status(MsnSession *session); - -/** - * Returns the string representation of an away type. - * - * @param type The away type. - * - * @return The string representation of the away type. - */ -const char *msn_away_get_text(MsnAwayType type); - -const char *msn_state_get_text(MsnAwayType state); - -MsnAwayType msn_state_from_account(PurpleAccount *account); - -#endif /* _MSN_STATE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1305 +0,0 @@ -/** - * @file switchboard.c MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "prefs.h" -#include "switchboard.h" -#include "notification.h" -#include "msn-utils.h" - -#include "error.h" - -static MsnTable *cbs_table; - -static void msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, - MsnMsgErrorType error); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSwitchBoard * -msn_switchboard_new(MsnSession *session) -{ - MsnSwitchBoard *swboard; - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = g_new0(MsnSwitchBoard, 1); - - swboard->session = session; - swboard->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_SB); - swboard->cmdproc = servconn->cmdproc; - - swboard->msg_queue = g_queue_new(); - swboard->empty = TRUE; - - swboard->cmdproc->data = swboard; - swboard->cmdproc->cbs_table = cbs_table; - - session->switches = g_list_append(session->switches, swboard); - - return swboard; -} - -void -msn_switchboard_destroy(MsnSwitchBoard *swboard) -{ - MsnSession *session; - MsnMessage *msg; - GList *l; - -#ifdef MSN_DEBUG_SB - purple_debug_info("msn", "switchboard_destroy: swboard(%p)\n", swboard); -#endif - - g_return_if_fail(swboard != NULL); - - if (swboard->destroying) - return; - - swboard->destroying = TRUE; - - /* If it linked us is because its looking for trouble */ - while (swboard->slplinks != NULL) - msn_slplink_destroy(swboard->slplinks->data); - - /* Destroy the message queue */ - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - if (swboard->error != MSN_SB_ERROR_NONE) - { - /* The messages could not be sent due to a switchboard error */ - msg_error_helper(swboard->cmdproc, msg, - MSN_MSG_ERROR_SB); - } - msn_message_unref(msg); - } - - g_queue_free(swboard->msg_queue); - - /* msg_error_helper will both remove the msg from ack_list and - unref it, so we don't need to do either here */ - while ((l = swboard->ack_list) != NULL) - msg_error_helper(swboard->cmdproc, l->data, MSN_MSG_ERROR_SB); - - g_free(swboard->im_user); - g_free(swboard->auth_key); - g_free(swboard->session_id); - - for (l = swboard->users; l != NULL; l = l->next) - g_free(l->data); - - if (swboard->users != NULL) - g_list_free(swboard->users); - - session = swboard->session; - session->switches = g_list_remove(session->switches, swboard); - -#if 0 - /* This should never happen or we are in trouble. */ - if (swboard->servconn != NULL) - msn_servconn_destroy(swboard->servconn); -#endif - - swboard->cmdproc->data = NULL; - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_servconn_destroy(swboard->servconn); - - g_free(swboard); -} - -void -msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(key != NULL); - - swboard->auth_key = g_strdup(key); -} - -const char * -msn_switchboard_get_auth_key(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->auth_key; -} - -void -msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(id != NULL); - - if (swboard->session_id != NULL) - g_free(swboard->session_id); - - swboard->session_id = g_strdup(id); -} - -const char * -msn_switchboard_get_session_id(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->session_id; -} - -int -msn_switchboard_get_chat_id(void) -{ - static int chat_id = 1; - - return chat_id++; -} - -void -msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited) -{ - g_return_if_fail(swboard != NULL); - - swboard->invited = invited; -} - -gboolean -msn_switchboard_is_invited(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - return swboard->invited; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -static void -send_clientcaps(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_CAPS); - msn_message_set_content_type(msg, "text/x-clientcaps"); - msn_message_set_flag(msg, 'U'); - msn_message_set_bin_data(msg, MSN_CLIENTINFO, strlen(MSN_CLIENTINFO)); - - msn_switchboard_send_msg(swboard, msg, TRUE); - - msn_message_destroy(msg); -} - -static void -msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnCmdProc *cmdproc; - PurpleAccount *account; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - account = cmdproc->session->account; - - swboard->users = g_list_prepend(swboard->users, g_strdup(user)); - swboard->current_users++; - swboard->empty = FALSE; - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "user=[%s], total=%d\n", user, - swboard->current_users); -#endif - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - { - /* This is a helper switchboard. */ - purple_debug_error("msn", "switchboard_add_user: conv != NULL\n"); - return; - } - - if ((swboard->conv != NULL) && - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - } - else if (swboard->current_users > 1 || swboard->total_users > 1) - { - if (swboard->conv == NULL || - purple_conversation_get_type(swboard->conv) != PURPLE_CONV_TYPE_CHAT) - { - GList *l; - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] Switching to chat.\n"); -#endif - -#if 0 - /* this is bad - it causes msn_switchboard_close to be called on the - * switchboard we're in the middle of using :( */ - if (swboard->conv != NULL) - purple_conversation_destroy(swboard->conv); -#endif - - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->flag |= MSN_SB_FLAG_IM; - swboard->conv = serv_got_joined_chat(account->gc, - swboard->chat_id, - "MSN Chat"); - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *tmp_user; - - tmp_user = l->data; - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] Adding [%s].\n", tmp_user); -#endif - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - tmp_user, NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] We add ourselves.\n"); -#endif - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - purple_account_get_username(account), - NULL, PURPLE_CBFLAGS_NONE, TRUE); - - g_free(swboard->im_user); - swboard->im_user = NULL; - } - } - else if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - user, account); - } - else - { - purple_debug_warning("msn", "switchboard_add_user: This should not happen!\n"); - } -} - -static PurpleConversation * -msn_switchboard_get_conv(MsnSwitchBoard *swboard) -{ - PurpleAccount *account; - - g_return_val_if_fail(swboard != NULL, NULL); - - if (swboard->conv != NULL) - return swboard->conv; - - purple_debug_error("msn", "Switchboard with unassigned conversation\n"); - - account = swboard->session->account; - - return (swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, - account, swboard->im_user)); -} - -static void -msn_switchboard_report_user(MsnSwitchBoard *swboard, PurpleMessageFlags flags, const char *msg) -{ - PurpleConversation *conv; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - if ((conv = msn_switchboard_get_conv(swboard)) != NULL) - { - purple_conversation_write(conv, NULL, msg, flags, time(NULL)); - } -} - -static void -swboard_error_helper(MsnSwitchBoard *swboard, int reason, const char *passport) -{ - g_return_if_fail(swboard != NULL); - - purple_debug_warning("msg", "Error: Unable to call the user %s for reason %i\n", - passport ? passport : "(null)", reason); - - /* TODO: if current_users > 0, this is probably a chat and an invite failed, - * we should report that in the chat or something */ - if (swboard->current_users == 0) - { - swboard->error = reason; - msn_switchboard_close(swboard); - } -} - -static void -cal_error_helper(MsnTransaction *trans, int reason) -{ - MsnSwitchBoard *swboard; - const char *passport; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - passport = params[0]; - - swboard = trans->data; - - purple_debug_warning("msn", "cal_error_helper: command %s failed for reason %i\n",trans->command,reason); - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static void -msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, MsnMsgErrorType error) -{ - MsnSwitchBoard *swboard; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(msg != NULL); - - if ((error != MSN_MSG_ERROR_SB) && (msg->nak_cb != NULL)) - msg->nak_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - - /* This is not good, and should be fixed somewhere else. */ - g_return_if_fail(swboard != NULL); - - if (msg->type == MSN_MSG_TEXT) - { - const char *format, *str_reason; - char *body_str, *body_enc, *pre, *post; - -#if 0 - if (swboard->conv == NULL) - { - if (msg->ack_ref) - msn_message_unref(msg); - - return; - } -#endif - - if (error == MSN_MSG_ERROR_TIMEOUT) - { - str_reason = _("Message may have not been sent " - "because a timeout occurred:"); - } - else if (error == MSN_MSG_ERROR_SB) - { - switch (swboard->error) - { - case MSN_SB_ERROR_OFFLINE: - str_reason = _("Message could not be sent, " - "not allowed while invisible:"); - break; - case MSN_SB_ERROR_USER_OFFLINE: - str_reason = _("Message could not be sent " - "because the user is offline:"); - break; - case MSN_SB_ERROR_CONNECTION: - str_reason = _("Message could not be sent " - "because a connection error occurred:"); - break; - case MSN_SB_ERROR_TOO_FAST: - str_reason = _("Message could not be sent " - "because we are sending too quickly:"); - break; - case MSN_SB_ERROR_AUTHFAILED: - str_reason = _("Message could not be sent " - "because we were unable to establish a " - "session with the server. This is " - "likely a server problem, try again in " - "a few minutes:"); - break; - default: - str_reason = _("Message could not be sent " - "because an error with " - "the switchboard occurred:"); - break; - } - } - else - { - str_reason = _("Message may have not been sent " - "because an unknown error occurred:"); - } - - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_ERROR, - str_reason); - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_RAW, - body_str); - - g_free(body_str); - } - - /* If a timeout occures we will want the msg around just in case we - * receive the ACK after the timeout. */ - if (msg->ack_ref && error != MSN_MSG_ERROR_TIMEOUT) - { - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); - } -} - -/************************************************************************** - * Message Stuff - **************************************************************************/ - -/** Called when a message times out. */ -static void -msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnMessage *msg; - - msg = trans->data; - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT); -} - -/** Called when we receive an error of a message. */ -static void -msg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - msg_error_helper(cmdproc, trans->data, MSN_MSG_ERROR_UNKNOWN); -} - -#if 0 -/** Called when we receive an ack of a special message. */ -static void -msg_ack(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg->ack_data); - - msn_message_unref(msg); -} - -/** Called when we receive a nak of a special message. */ -static void -msg_nak(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - msn_message_unref(msg); -} -#endif - -static void -release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - gsize payload_len; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - cmdproc = swboard->cmdproc; - - payload = msn_message_gen_payload(msg, &payload_len); - -#ifdef MSN_DEBUG_SB - msn_message_show_readable(msg, "SB SEND", FALSE); -#endif - - trans = msn_transaction_new(cmdproc, "MSG", "%c %d", - msn_message_get_flag(msg), payload_len); - - /* Data for callbacks */ - msn_transaction_set_data(trans, msg); - - if (msg->type == MSN_MSG_TEXT) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); - } - else if (msg->type == MSN_MSG_SLP) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); -#if 0 - if (msg->ack_cb != NULL) - { - msn_transaction_add_cb(trans, "ACK", msg_ack); - msn_transaction_add_cb(trans, "NAK", msg_nak); - } -#endif - } - - trans->payload = payload; - trans->payload_len = payload_len; - - msg->trans = trans; - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - purple_debug_info("msn", "Appending message to queue.\n"); - - g_queue_push_tail(swboard->msg_queue, msg); - - msn_message_ref(msg); -} - -static void -process_queue(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - g_return_if_fail(swboard != NULL); - - purple_debug_info("msn", "Processing queue\n"); - - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - purple_debug_info("msn", "Sending message\n"); - release_msg(swboard, msg); - msn_message_unref(msg); - } -} - -gboolean -msn_switchboard_can_send(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - if (swboard->empty || !g_queue_is_empty(swboard->msg_queue)) - return FALSE; - - return TRUE; -} - -void -msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - if (msn_switchboard_can_send(swboard)) - release_msg(swboard, msg); - else if (queue) - queue_msg(swboard, msg); -} - -/************************************************************************** - * Switchboard Commands - **************************************************************************/ - -static void -ans_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - swboard->ready = TRUE; -} - -static void -bye_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - user = cmd->params[0]; - - /* cmdproc->data is set to NULL when the switchboard is destroyed; - * we may get a bye shortly thereafter. */ - g_return_if_fail(swboard != NULL); - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - purple_debug_error("msn_switchboard", "bye_cmd: helper bug\n"); - - if (swboard->conv == NULL) - { - /* This is a helper switchboard */ - msn_switchboard_destroy(swboard); - } - else if ((swboard->current_users > 1) || - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* This is a switchboard used for a chat */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL); - swboard->current_users--; - if (swboard->current_users == 0) - msn_switchboard_destroy(swboard); - } - else - { - /* This is a switchboard used for a im session */ - msn_switchboard_destroy(swboard); - } -} - -static void -iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - account = cmdproc->session->account; - gc = account->gc; - swboard = cmdproc->data; - - swboard->total_users = atoi(cmd->params[2]); - - msn_switchboard_add_user(swboard, cmd->params[3]); -} - -static void -joi_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - const char *passport; - - passport = cmd->params[0]; - - session = cmdproc->session; - account = session->account; - gc = account->gc; - swboard = cmdproc->data; - - msn_switchboard_add_user(swboard, passport); - - process_queue(swboard); - - if (!session->http_method) - send_clientcaps(swboard); - - if (swboard->closed) - msn_switchboard_close(swboard); -} - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len); -#ifdef MSN_DEBUG_SB - msn_message_show_readable(msg, "SB RECV", FALSE); -#endif - - if (msg->remote_user != NULL) - g_free (msg->remote_user); - - msg->remote_user = g_strdup(cmd->params[0]); - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_destroy(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmdproc->servconn->payload_len = atoi(cmd->params[2]); - cmdproc->last_cmd->payload_cb = msg_cmd_post; -} - -static void -nak_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - g_return_if_fail(msg != NULL); - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_NAK); -} - -static void -ack_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - if (swboard) - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); -} - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - - if (swboard->current_users > 1) - serv_got_chat_left(gc, swboard->chat_id); - - msn_switchboard_disconnect(swboard); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - -#if 0 - GList *l; - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *user; - user = l->data; - - msn_cmdproc_send(cmdproc, "CAL", "%s", user); - } -#endif - - swboard->ready = TRUE; - msn_cmdproc_process_queue(cmdproc); -} - -/************************************************************************** - * Message Handlers - **************************************************************************/ -static void -plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - const char *body; - char *body_str; - char *body_enc; - char *body_final; - size_t body_len; - const char *passport; - const char *value; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - passport = msg->remote_user; - - if (!strcmp(passport, "messenger@microsoft.com") && - strstr(body, "immediate security update")) - { - return; - } - -#if 0 - if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL) - { - purple_debug_misc("msn", "User-Agent = '%s'\n", value); - } -#endif - - if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) - { - char *pre, *post; - - msn_parse_format(value, &pre, &post); - - body_final = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - - g_free(pre); - g_free(post); - g_free(body_enc); - } - else - { - body_final = body_enc; - } - - swboard->flag |= MSN_SB_FLAG_IM; - - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* If current_users is always ok as it should then there is no need to - * check if this is a chat. */ - if (swboard->current_users <= 1) - purple_debug_misc("msn", "plain_msg: current_users(%d)\n", - swboard->current_users); - - serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, - time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_chat(gc, swboard->chat_id); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - else - { - serv_got_im(gc, passport, body_final, 0, time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - passport, purple_connection_get_account(gc)); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - - g_free(body_final); -} - -static void -control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - char *passport; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - passport = msg->remote_user; - - if (swboard->current_users == 1 && - msn_message_get_attr(msg, "TypingUser") != NULL) - { - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } -} - -static void -clientcaps_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ -#if 0 - MsnSession *session; - MsnSwitchBoard *swboard; - MsnUser *user; - GHashTable *clientcaps; - const char *value; - - char *passport = msg->sender; - - session = cmdproc->session; - swboard = cmdproc->servconn->swboard; - - clientcaps = msn_message_get_hashtable_from_body(msg); -#endif -} - -static void -nudge_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSwitchBoard *swboard; - PurpleAccount *account; - const char *user; - - swboard = cmdproc->data; - account = cmdproc->session->account; - user = msg->remote_user; - - serv_got_attention(account->gc, user, MSN_NUDGE); -} - -/************************************************************************** - * Connect stuff - **************************************************************************/ -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error); - -static void -connect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - MsnTransaction *trans; - MsnCmdProc *cmdproc; - PurpleAccount *account; - - cmdproc = servconn->cmdproc; - g_return_if_fail(cmdproc != NULL); - - account = cmdproc->session->account; - swboard = cmdproc->data; - g_return_if_fail(swboard != NULL); - - if (msn_switchboard_is_invited(swboard)) - { - swboard->empty = FALSE; - - trans = msn_transaction_new(cmdproc, "ANS", "%s %s %s", - purple_account_get_username(account), - swboard->auth_key, swboard->session_id); - } - else - { - trans = msn_transaction_new(cmdproc, "USR", "%s %s", - purple_account_get_username(account), - swboard->auth_key); - } - - msn_transaction_set_error_cb(trans, ans_usr_error); - msn_transaction_set_data(trans, swboard); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - char **params; - char *passport; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 911) - { - reason = MSN_SB_ERROR_AUTHFAILED; - } - - purple_debug_warning("msn", "ans_usr_error: command %s gave error %i\n", trans->command, error); - - params = g_strsplit(trans->params, " ", 0); - passport = params[0]; - swboard = trans->data; - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static void -disconnect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - - swboard = servconn->cmdproc->data; - g_return_if_fail(swboard != NULL); - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_switchboard_destroy(swboard); -} - -gboolean -msn_switchboard_connect(MsnSwitchBoard *swboard, const char *host, int port) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - msn_servconn_set_connect_cb(swboard->servconn, connect_cb); - msn_servconn_set_disconnect_cb(swboard->servconn, disconnect_cb); - - return msn_servconn_connect(swboard->servconn, host, port); -} - -void -msn_switchboard_disconnect(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - msn_servconn_disconnect(swboard->servconn); -} - -/************************************************************************** - * Call stuff - **************************************************************************/ -static void -got_cal(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -#if 0 - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - - user = cmd->params[0]; - - msn_switchboard_add_user(swboard, user); -#endif -} - -static void -cal_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - purple_debug_warning("msn", "cal_timeout: command %s timed out\n", trans->command); - - cal_error_helper(trans, MSN_SB_ERROR_UNKNOWN); -} - -static void -cal_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 215) - { - purple_debug_info("msn", "Invited user already in switchboard\n"); - return; - } - else if (error == 217) - { - reason = MSN_SB_ERROR_USER_OFFLINE; - } - - purple_debug_warning("msn", "cal_error: command %s gave error %i\n", trans->command, error); - - cal_error_helper(trans, reason); -} - -void -msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnTransaction *trans; - MsnCmdProc *cmdproc; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - - trans = msn_transaction_new(cmdproc, "CAL", "%s", user); - /* this doesn't do anything, but users seem to think that - * 'Unhandled command' is some kind of error, so we don't report it */ - msn_transaction_add_cb(trans, "CAL", got_cal); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_timeout_cb(trans, cal_timeout); - - if (swboard->ready) - msn_cmdproc_send_trans(cmdproc, trans); - else - msn_cmdproc_queue_trans(cmdproc, trans); -} - -/************************************************************************** - * Create & Transfer stuff - **************************************************************************/ - -static void -got_swboard(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - char *host; - int port; - swboard = cmd->trans->data; - - if (g_list_find(cmdproc->session->switches, swboard) == NULL) - /* The conversation window was closed. */ - return; - - msn_switchboard_set_auth_key(swboard, cmd->params[4]); - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 913) - reason = MSN_SB_ERROR_OFFLINE; - else if (error == 800) - reason = MSN_SB_ERROR_TOO_FAST; - - swboard = trans->data; - - purple_debug_info("msn", "xfr_error %i for %s: trans %p, command %s, reason %i\n", - error, (swboard->im_user ? swboard->im_user : "(null)"), trans, - (trans->command ? trans->command : "(null)"), reason); - - swboard_error_helper(swboard, reason, swboard->im_user); -} - -void -msn_switchboard_request(MsnSwitchBoard *swboard) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->session->notification->cmdproc; - - trans = msn_transaction_new(cmdproc, "XFR", "%s", "SB"); - msn_transaction_add_cb(trans, "XFR", got_swboard); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_error_cb(trans, xfr_error); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_switchboard_close(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - if (swboard->error != MSN_SB_ERROR_NONE) - { - msn_switchboard_destroy(swboard); - } - else if (g_queue_is_empty(swboard->msg_queue) || - !swboard->session->connected) - { - MsnCmdProc *cmdproc; - cmdproc = swboard->cmdproc; - msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL); - - msn_switchboard_destroy(swboard); - } - else - { - swboard->closed = TRUE; - } -} - -gboolean -msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - swboard->flag &= ~flag; - - if (flag == MSN_SB_FLAG_IM) - /* Forget any conversation that used to be associated with this - * swboard. */ - swboard->conv = NULL; - - if (swboard->flag == 0) - { - msn_switchboard_close(swboard); - return TRUE; - } - - return FALSE; -} - -/************************************************************************** - * Init stuff - **************************************************************************/ - -void -msn_switchboard_init(void) -{ - cbs_table = msn_table_new(); - - msn_table_add_cmd(cbs_table, "ANS", "ANS", ans_cmd); - msn_table_add_cmd(cbs_table, "ANS", "IRO", iro_cmd); - - msn_table_add_cmd(cbs_table, "MSG", "ACK", ack_cmd); - msn_table_add_cmd(cbs_table, "MSG", "NAK", nak_cmd); - - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "JOI", joi_cmd); - msn_table_add_cmd(cbs_table, NULL, "BYE", bye_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - -#if 0 - /* They might skip the history */ - msn_table_add_cmd(cbs_table, NULL, "ACK", NULL); -#endif - - msn_table_add_error(cbs_table, "MSG", msg_error); - msn_table_add_error(cbs_table, "CAL", cal_error); - - /* Register the message type callbacks. */ - msn_table_add_msg_type(cbs_table, "text/plain", - plain_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol", - control_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientcaps", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientinfo", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "application/x-msnmsgrp2p", - msn_p2p_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-emoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-animemoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", - nudge_msg); -#if 0 - msn_table_add_msg_type(cbs_table, "text/x-msmmsginvite", - msn_invite_msg); -#endif -} - -void -msn_switchboard_end(void) -{ - msn_table_destroy(cbs_table); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/switchboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -/** - * @file switchboard.h MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SWITCHBOARD_H_ -#define _MSN_SWITCHBOARD_H_ - -typedef struct _MsnSwitchBoard MsnSwitchBoard; - -#include "conversation.h" - -#include "msg.h" -#include "user.h" - -#include "servconn.h" - -#include "slplink.h" - -/** - * A switchboard error. - */ -typedef enum -{ - MSN_SB_ERROR_NONE, /**< No error. */ - MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */ - MSN_SB_ERROR_OFFLINE, /**< The account is offline. */ - MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */ - MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */ - MSN_SB_ERROR_TOO_FAST, /**< We are sending too fast */ - MSN_SB_ERROR_AUTHFAILED, /**< Authentication failed joining the switchboard session */ - MSN_SB_ERROR_UNKNOWN /**< An unknown error occurred. */ - -} MsnSBErrorType; - -/** - * A switchboard flag. - */ -typedef enum -{ - MSN_SB_FLAG_IM = 0x01, /**< This switchboard is being used for a conversation. */ - MSN_SB_FLAG_FT = 0x02, /**< This switchboard is being used for file transfer. */ - -} MsnSBFlag; - -/** - * A switchboard. - * - * A place where a bunch of users send messages to the rest of the users. - */ -struct _MsnSwitchBoard -{ - MsnSession *session; - MsnServConn *servconn; - MsnCmdProc *cmdproc; - char *im_user; - - MsnSBFlag flag; - char *auth_key; - char *session_id; - - PurpleConversation *conv; /**< The conversation that displays the - messages of this switchboard, or @c NULL if - this is a helper switchboard. */ - - gboolean empty; /**< A flag that states if the swithcboard has no - users in it. */ - gboolean invited; /**< A flag that states if we were invited to the - switchboard. */ - gboolean ready; /**< A flag that states if this switchboard is - ready to be used. */ - gboolean closed; /**< A flag that states if the switchboard has - been closed by the user. */ - gboolean destroying; /**< A flag that states if the switchboard is - alredy on the process of destruction. */ - - int current_users; - int total_users; - GList *users; - - int chat_id; - - GQueue *msg_queue; /**< Queue of messages to send. */ - GList *ack_list; /**< List of messages waiting for an ack. */ - - MsnSBErrorType error; /**< The error that occurred in this switchboard - (if applicable). */ - GList *slplinks; /**< The list of slplinks that are using this switchboard. */ -}; - -/** - * Initialize the variables for switchboard creation. - */ -void msn_switchboard_init(void); - -/** - * Destroy the variables for switchboard creation. - */ -void msn_switchboard_end(void); - -/** - * Creates a new switchboard. - * - * @param session The MSN session. - * - * @return The new switchboard. - */ -MsnSwitchBoard *msn_switchboard_new(MsnSession *session); - -/** - * Destroys a switchboard. - * - * @param swboard The switchboard to destroy. - */ -void msn_switchboard_destroy(MsnSwitchBoard *swboard); - -/** - * Sets the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param key The auth key. - */ -void msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key); - -/** - * Returns the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The auth key. - */ -const char *msn_switchboard_get_auth_key(MsnSwitchBoard *swboard); - -/** - * Sets the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param id The session ID. - */ -void msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id); - -/** - * Returns the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The session ID. - */ -const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard); - -/** - * Returns the next chat ID for use by a switchboard. - * - * @return The chat ID. - */ -int msn_switchboard_get_chat_id(void); - -/** - * Sets whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * @param invite @c TRUE if invited, @c FALSE otherwise. - */ -void msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited); - -/** - * Returns whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if invited, @c FALSE otherwise. - */ -gboolean msn_switchboard_is_invited(MsnSwitchBoard *swboard); - -/** - * Connects to a switchboard. - * - * @param swboard The switchboard. - * @param host The switchboard server host. - * @param port The switcbharod server port. - * - * @return @c TRUE if able to connect, or @c FALSE otherwise. - */ -gboolean msn_switchboard_connect(MsnSwitchBoard *swboard, - const char *host, int port); - -/** - * Disconnects from a switchboard. - * - * @param swboard The switchboard to disconnect from. - */ -void msn_switchboard_disconnect(MsnSwitchBoard *swboard); - -/** - * Closes the switchboard. - * - * Called when a conversation is closed. - * - * @param swboard The switchboard to close. - */ -void msn_switchboard_close(MsnSwitchBoard *swboard); - -/** - * Release a switchboard from a certain function. - * - * @param swboard The switchboard to release. - * @param flag The flag that states the function. - * - * @return @c TRUE if the switchboard was closed, @c FALSE otherwise. - */ -gboolean msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag); - -/** - * Returns whether or not we currently can send a message through this - * switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -gboolean msn_switchboard_can_send(MsnSwitchBoard *swboard); - -/** - * Sends a message through this switchboard. - * - * @param swboard The switchboard. - * @param msg The message. - * @param queue A flag that states if we want this message to be queued (in - * the case it cannot currently be sent). - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue); - -gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard); -gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who); - -void msn_switchboard_request(MsnSwitchBoard *swboard); -void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user); - -/** - * Processes peer to peer messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes emoticon messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes INVITE messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -#endif /* _MSN_SWITCHBOARD_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,260 +0,0 @@ -/** - * @file sync.c MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "sync.h" -#include "state.h" - -static MsnTable *cbs_table; - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc = cmdproc->session->account->gc; - const char *list_name; - - list_name = cmd->params[0]; - - if (!g_ascii_strcasecmp(list_name, "AL")) - { - /* - * If the current setting is AL, messages from users who - * are not in BL will be delivered. - * - * In other words, deny some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - else - { - /* If the current setting is BL, only messages from people - * who are in the AL will be delivered. - * - * In other words, permit some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - type = cmd->params[0]; - value = cmd->params[1]; - - if (cmd->param_count == 2) - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *name; - int group_id; - - group_id = atoi(cmd->params[0]); - name = purple_url_decode(cmd->params[1]); - - msn_group_new(session->userlist, group_id, name); - - /* HACK */ - if (group_id == 0) - { - /* Group of ungroupped buddies */ - if (session->sync->total_users == 0) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } - return; - } - - if ((purple_find_group(name)) == NULL) - { - PurpleGroup *g = purple_group_new(name); - purple_blist_add_group(g, NULL); - } -} - -static void -lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - char *passport = NULL; - const char *friend = NULL; - int list_op; - MsnUser *user; - - passport = cmd->params[0]; - friend = purple_url_decode(cmd->params[1]); - list_op = atoi(cmd->params[2]); - - user = msn_user_new(session->userlist, passport, friend); - - msn_userlist_add_user(session->userlist, user); - - session->sync->last_user = user; - - /* TODO: This can be improved */ - - if (list_op & MSN_LIST_FL_OP) - { - char **c; - char **tokens; - const char *group_nums; - GSList *group_ids; - - group_nums = cmd->params[3]; - - group_ids = NULL; - - tokens = g_strsplit(group_nums, ",", -1); - - for (c = tokens; *c != NULL; c++) - { - int id; - - id = atoi(*c); - group_ids = g_slist_append(group_ids, GINT_TO_POINTER(id)); - } - - g_strfreev(tokens); - - msn_got_lst_user(session, user, list_op, group_ids); - - g_slist_free(group_ids); - } - else - { - msn_got_lst_user(session, user, list_op, NULL); - } - - session->sync->num_users++; - - if (session->sync->num_users == session->sync->total_users) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSync *sync = cmdproc->session->sync; - const char *type, *value; - MsnUser *user; - - user = sync->last_user; - - g_return_if_fail(user != NULL); - - type = cmd->params[0]; - value = cmd->params[1]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - else if (!strcmp(value, "N")) - user->mobile = FALSE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -void -msn_sync_init(void) -{ - /* TODO: check prp, blp, bpr */ - - cbs_table = msn_table_new(); - - /* Syncing */ - msn_table_add_cmd(cbs_table, NULL, "GTC", NULL); - msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd); - msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); -} - -void -msn_sync_end(void) -{ - msn_table_destroy(cbs_table); -} - -MsnSync * -msn_sync_new(MsnSession *session) -{ - MsnSync *sync; - - sync = g_new0(MsnSync, 1); - - sync->session = session; - sync->cbs_table = cbs_table; - - return sync; -} - -void -msn_sync_destroy(MsnSync *sync) -{ - g_free(sync); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/sync.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/** - * @file sync.h MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SYNC_H_ -#define _MSN_SYNC_H_ - -typedef struct _MsnSync MsnSync; - -#include "session.h" -#include "table.h" -#include "user.h" - -struct _MsnSync -{ - MsnSession *session; - MsnTable *cbs_table; - MsnTable *old_cbs_table; - - int num_users; - int total_users; - int num_groups; - int total_groups; - MsnUser *last_user; -}; - -void msn_sync_init(void); -void msn_sync_end(void); - -MsnSync * msn_sync_new(MsnSession *session); -void msn_sync_destroy(MsnSync *sync); - -#endif /* _MSN_SYNC_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file table.c MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "table.h" - -static void -null_cmd_cb(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -} - -static void -null_error_cb(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ -} - -MsnTable * -msn_table_new() -{ - MsnTable *table; - - table = g_new0(MsnTable, 1); - - table->cmds = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_hash_table_destroy); - table->msgs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->errors = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - table->async = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->fallback = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - return table; -} - -void -msn_table_destroy(MsnTable *table) -{ - g_return_if_fail(table != NULL); - - g_hash_table_destroy(table->cmds); - g_hash_table_destroy(table->msgs); - g_hash_table_destroy(table->errors); - - g_hash_table_destroy(table->async); - g_hash_table_destroy(table->fallback); - - g_free(table); -} - -void -msn_table_add_cmd(MsnTable *table, - char *command, char *answer, MsnTransCb cb) -{ - GHashTable *cbs; - - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - cbs = NULL; - - if (command == NULL) - { - cbs = table->async; - } - else if (strcmp(command, "fallback") == 0) - { - cbs = table->fallback; - } - else - { - cbs = g_hash_table_lookup(table->cmds, command); - - if (cbs == NULL) - { - cbs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - g_hash_table_insert(table->cmds, command, cbs); - } - } - - if (cb == NULL) - cb = null_cmd_cb; - - g_hash_table_insert(cbs, answer, cb); -} - -void -msn_table_add_error(MsnTable *table, - char *answer, MsnErrorCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - if (cb == NULL) - cb = null_error_cb; - - g_hash_table_insert(table->errors, answer, cb); -} - -void -msn_table_add_msg_type(MsnTable *table, - char *type, MsnMsgTypeCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(type != NULL); - g_return_if_fail(cb != NULL); - -#if 0 - if (cb == NULL) - cb = null_msg_cb; -#endif - - g_hash_table_insert(table->msgs, type, cb); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/** - * @file table.h MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_TABLE_H_ -#define _MSN_TABLE_H_ - -typedef struct _MsnTable MsnTable; - -#include "cmdproc.h" -#include "transaction.h" -#include "msg.h" - -typedef void (*MsnMsgTypeCb)(MsnCmdProc *cmdproc, MsnMessage *msg); - -struct _MsnTable -{ - GHashTable *cmds; - GHashTable *msgs; - GHashTable *errors; - - GHashTable *async; - GHashTable *fallback; -}; - -MsnTable *msn_table_new(void); -void msn_table_destroy(MsnTable *table); - -void msn_table_add_cmd(MsnTable *table, char *command, char *answer, - MsnTransCb cb); -void msn_table_add_error(MsnTable *table, char *answer, MsnErrorCb cb); -void msn_table_add_msg_type(MsnTable *table, char *type, MsnMsgTypeCb cb); - -#endif /* _MSN_TABLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ -/** - * @file transaction.c MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "transaction.h" - -MsnTransaction * -msn_transaction_new(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_val_if_fail(command != NULL, NULL); - - trans = g_new0(MsnTransaction, 1); - - trans->cmdproc = cmdproc; - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - /* trans->queue = g_queue_new(); */ - - return trans; -} - -void -msn_transaction_destroy(MsnTransaction *trans) -{ - g_return_if_fail(trans != NULL); - - g_free(trans->command); - g_free(trans->params); - g_free(trans->payload); - -#if 0 - if (trans->pendent_cmd != NULL) - msn_message_unref(trans->pendent_msg); -#endif - -#if 0 - MsnTransaction *elem; - if (trans->queue != NULL) - { - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_transaction_destroy(elem); - - g_queue_free(trans->queue); - } -#endif - - if (trans->callbacks != NULL && trans->has_custom_callbacks) - g_hash_table_destroy(trans->callbacks); - - if (trans->timer) - purple_timeout_remove(trans->timer); - - g_free(trans); -} - -char * -msn_transaction_to_string(MsnTransaction *trans) -{ - char *str; - - g_return_val_if_fail(trans != NULL, FALSE); - - if (trans->params != NULL) - str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params); - else - str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId); - - return str; -} - -void -msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd) -{ - purple_debug_info("msn", "queueing command.\n"); - trans->pendent_cmd = cmd; - msn_command_ref(cmd); -} - -void -msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnCommand *cmd; - - if (!cmdproc->servconn->connected) - return; - - purple_debug_info("msn", "unqueueing command.\n"); - cmd = trans->pendent_cmd; - - g_return_if_fail(cmd != NULL); - - msn_cmdproc_process_cmd(cmdproc, cmd); - msn_command_unref(cmd); - - trans->pendent_cmd = NULL; -} - -#if 0 -void -msn_transaction_queue(MsnTransaction *trans, MsnTransaction *elem) -{ - if (trans->queue == NULL) - trans->queue = g_queue_new(); - - g_queue_push_tail(trans->queue, elem); -} - -void -msn_transaction_unqueue(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnTransaction *elem; - - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_cmdproc_send_trans(cmdproc, elem); -} -#endif - -void -msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(payload != NULL); - - trans->payload = g_strdup(payload); - trans->payload_len = payload_len ? payload_len : strlen(trans->payload); -} - -void -msn_transaction_set_data(MsnTransaction *trans, void *data) -{ - g_return_if_fail(trans != NULL); - - trans->data = data; -} - -void -msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(answer != NULL); - - if (trans->callbacks == NULL) - { - trans->has_custom_callbacks = TRUE; - trans->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - NULL); - } - else if (trans->has_custom_callbacks != TRUE) - g_return_if_reached (); - - g_hash_table_insert(trans->callbacks, answer, cb); -} - -static gboolean -transaction_timeout(gpointer data) -{ - MsnTransaction *trans; - - trans = data; - g_return_val_if_fail(trans != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "timed out: %s %d %s\n", trans->command, trans->trId, trans->params); -#endif - - if (trans->timeout_cb != NULL) - trans->timeout_cb(trans->cmdproc, trans); - - return FALSE; -} - -void -msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb) -{ - if (trans->timer) - { - purple_debug_error("msn", "This shouldn't be happening\n"); - purple_timeout_remove(trans->timer); - } - trans->timeout_cb = cb; - trans->timer = purple_timeout_add_seconds(60, transaction_timeout, trans); -} - -void -msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb) -{ - trans->error_cb = cb; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/transaction.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/** - * @file transaction.h MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_TRANSACTION_H -#define _MSN_TRANSACTION_H - -typedef struct _MsnTransaction MsnTransaction; - -#include "command.h" -#include "cmdproc.h" - -typedef void (*MsnTransCb)(MsnCmdProc *cmdproc, MsnCommand *cmd); -typedef void (*MsnTimeoutCb)(MsnCmdProc *cmdproc, MsnTransaction *trans); -typedef void (*MsnErrorCb)(MsnCmdProc *cmdproc, MsnTransaction *trans, - int error); - -/** - * A transaction. A sending command that will initiate the transaction. - */ -struct _MsnTransaction -{ - MsnCmdProc *cmdproc; - unsigned int trId; - - char *command; - char *params; - - int timer; - - void *data; /**< The data to be used on the different callbacks. */ - GHashTable *callbacks; - gboolean has_custom_callbacks; - MsnErrorCb error_cb; - MsnTimeoutCb timeout_cb; - - char *payload; - size_t payload_len; - - GQueue *queue; - MsnCommand *pendent_cmd; /**< The command that is waiting for the result of - this transaction. */ -}; - -MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc, - const char *command, - const char *format, ...); -void msn_transaction_destroy(MsnTransaction *trans); - -char *msn_transaction_to_string(MsnTransaction *trans); -void msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd); -void msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc); -void msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len); -void msn_transaction_set_data(MsnTransaction *trans, void *data); -void msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb); -void msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb); -void msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb); - -#endif /* _MSN_TRANSACTION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,332 +0,0 @@ -/** - * @file user.c User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "user.h" -#include "slp.h" - -MsnUser * -msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name) -{ - MsnUser *user; - - user = g_new0(MsnUser, 1); - - user->userlist = userlist; - - msn_user_set_passport(user, passport); - if (friendly_name != NULL) - msn_user_set_friendly_name(user, friendly_name); - - return user; -} - -void -msn_user_destroy(MsnUser *user) -{ - g_return_if_fail(user != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - if (user->group_ids != NULL) - g_list_free(user->group_ids); - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - g_free(user->passport); - g_free(user->friendly_name); - g_free(user->phone.home); - g_free(user->phone.work); - g_free(user->phone.mobile); - - g_free(user); -} - -void -msn_user_update(MsnUser *user) -{ - PurpleAccount *account; - - account = user->userlist->session->account; - - if (user->status != NULL) { - if (!strcmp(user->status, "offline") && user->mobile) { - purple_prpl_got_user_status(account, user->passport, "offline", NULL); - purple_prpl_got_user_status(account, user->passport, "mobile", NULL); - } else { - purple_prpl_got_user_status(account, user->passport, user->status, NULL); - purple_prpl_got_user_status_deactive(account, user->passport, "mobile"); - } - } - - if (user->idle) - purple_prpl_got_user_idle(account, user->passport, TRUE, -1); - else - purple_prpl_got_user_idle(account, user->passport, FALSE, 0); -} - -void -msn_user_set_state(MsnUser *user, const char *state) -{ - const char *status; - - if (!g_ascii_strcasecmp(state, "BSY")) - status = "busy"; - else if (!g_ascii_strcasecmp(state, "BRB")) - status = "brb"; - else if (!g_ascii_strcasecmp(state, "AWY")) - status = "away"; - else if (!g_ascii_strcasecmp(state, "PHN")) - status = "phone"; - else if (!g_ascii_strcasecmp(state, "LUN")) - status = "lunch"; - else - status = "available"; - - if (!g_ascii_strcasecmp(state, "IDL")) - user->idle = TRUE; - else - user->idle = FALSE; - - user->status = status; -} - -void -msn_user_set_passport(MsnUser *user, const char *passport) -{ - g_return_if_fail(user != NULL); - - g_free(user->passport); - user->passport = g_strdup(passport); -} - -void -msn_user_set_friendly_name(MsnUser *user, const char *name) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - const char *encoded; - - g_return_if_fail(user != NULL); - - encoded = purple_url_encode(name); - session = user->userlist->session; - - if (user->friendly_name && strcmp(user->friendly_name, name) - && (strlen(encoded) < 387) && session->passport_info.verified && - (user->list_op & MSN_LIST_FL_OP)) { - /* copy the new name to the server list, but only when new */ - /* should we check this more thoroughly? */ - cmdproc = session->notification->cmdproc; - msn_cmdproc_send(cmdproc, "REA", "%s %s", - user->passport, - encoded); - } - - g_free(user->friendly_name); - user->friendly_name = g_strdup(name); -} - -void -msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img) -{ - MsnObject *msnobj = NULL; - - g_return_if_fail(user != NULL); - - msnobj = msn_object_new_from_image(img, "TFR2C2.tmp", - user->passport, MSN_OBJECT_USERTILE); - - if(!msnobj) - purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport); - - msn_user_set_object(user, msnobj); -} - -void -msn_user_add_group_id(MsnUser *user, int id) -{ - MsnUserList *userlist; - PurpleAccount *account; - PurpleBuddy *b; - PurpleGroup *g; - const char *passport; - const char *group_name; - - g_return_if_fail(user != NULL); - g_return_if_fail(id >= 0); - - user->group_ids = g_list_append(user->group_ids, GINT_TO_POINTER(id)); - - userlist = user->userlist; - account = userlist->session->account; - passport = msn_user_get_passport(user); - - group_name = msn_userlist_find_group_name(userlist, id); - - g = purple_find_group(group_name); - - if ((id == 0) && (g == NULL)) - { - g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - } - - b = purple_find_buddy_in_group(account, passport, g); - - if (b == NULL) - { - b = purple_buddy_new(account, passport, NULL); - - purple_blist_add_buddy(b, NULL, g, NULL); - } - - b->proto_data = user; -} - -void -msn_user_remove_group_id(MsnUser *user, int id) -{ - g_return_if_fail(user != NULL); - g_return_if_fail(id >= 0); - - user->group_ids = g_list_remove(user->group_ids, GINT_TO_POINTER(id)); -} - -void -msn_user_set_home_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (user->phone.home != NULL) - g_free(user->phone.home); - - user->phone.home = (number == NULL ? NULL : g_strdup(number)); -} - -void -msn_user_set_work_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (user->phone.work != NULL) - g_free(user->phone.work); - - user->phone.work = (number == NULL ? NULL : g_strdup(number)); -} - -void -msn_user_set_mobile_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (user->phone.mobile != NULL) - g_free(user->phone.mobile); - - user->phone.mobile = (number == NULL ? NULL : g_strdup(number)); -} - -void -msn_user_set_object(MsnUser *user, MsnObject *obj) -{ - g_return_if_fail(user != NULL); - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - user->msnobj = obj; - - if (user->list_op & MSN_LIST_FL_OP) - msn_queue_buddy_icon_request(user); -} - -void -msn_user_set_client_caps(MsnUser *user, GHashTable *info) -{ - g_return_if_fail(user != NULL); - g_return_if_fail(info != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - user->clientcaps = info; -} - -const char * -msn_user_get_passport(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->passport; -} - -const char * -msn_user_get_friendly_name(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->friendly_name; -} - -const char * -msn_user_get_home_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.home; -} - -const char * -msn_user_get_work_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.work; -} - -const char * -msn_user_get_mobile_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.mobile; -} - -MsnObject * -msn_user_get_object(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->msnobj; -} - -GHashTable * -msn_user_get_client_caps(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->clientcaps; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/** - * @file user.h User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_USER_H_ -#define _MSN_USER_H_ - -typedef struct _MsnUser MsnUser; - -#include "session.h" -#include "object.h" - -#include "userlist.h" - -/** - * A user. - */ -struct _MsnUser -{ -#if 0 - MsnSession *session; /**< The MSN session. */ -#endif - MsnUserList *userlist; - - char *passport; /**< The passport account. */ - char *friendly_name; /**< The friendly name. */ - - const char *status; /**< The state of the user. */ - gboolean idle; /**< The idle state of the user. */ - - struct - { - char *home; /**< Home phone number. */ - char *work; /**< Work phone number. */ - char *mobile; /**< Mobile phone number. */ - - } phone; - - gboolean authorized; /**< Authorized to add this user. */ - gboolean mobile; /**< Signed up with MSN Mobile. */ - - GList *group_ids; /**< The group IDs. */ - - MsnObject *msnobj; /**< The user's MSN Object. */ - - GHashTable *clientcaps; /**< The client's capabilities. */ - - int list_op; -}; - -/**************************************************************************/ -/** @name User API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new user structure. - * - * @param session The MSN session. - * @param passport The initial passport. - * @param stored_name The initial stored name. - * - * @return A new user structure. - */ -MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name); - -/** - * Destroys a user structure. - * - * @param user The user to destroy. - */ -void msn_user_destroy(MsnUser *user); - - -/** - * Updates the user. - * - * Communicates with the core to update the ui, etc. - * - * @param user The user to update. - */ -void msn_user_update(MsnUser *user); - -/** - * Sets the new state of user. - * - * @param user The user. - * @param state The state string. - */ -void msn_user_set_state(MsnUser *user, const char *state); - -/** - * Sets the passport account for a user. - * - * @param user The user. - * @param passport The passport account. - */ -void msn_user_set_passport(MsnUser *user, const char *passport); - -/** - * Sets the friendly name for a user. - * - * @param user The user. - * @param name The friendly name. - */ -void msn_user_set_friendly_name(MsnUser *user, const char *name); - -/** - * Sets the buddy icon for a local user. - * - * @param user The user. - * @param img The buddy icon image - */ -void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img); - -/** - * Sets the group ID list for a user. - * - * @param user The user. - * @param ids The group ID list. - */ -void msn_user_set_group_ids(MsnUser *user, GList *ids); - -/** - * Adds the group ID for a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_add_group_id(MsnUser *user, int id); - -/** - * Removes the group ID from a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_remove_group_id(MsnUser *user, int id); - -/** - * Sets the home phone number for a user. - * - * @param user The user. - * @param number The home phone number. - */ -void msn_user_set_home_phone(MsnUser *user, const char *number); - -/** - * Sets the work phone number for a user. - * - * @param user The user. - * @param number The work phone number. - */ -void msn_user_set_work_phone(MsnUser *user, const char *number); - -/** - * Sets the mobile phone number for a user. - * - * @param user The user. - * @param number The mobile phone number. - */ -void msn_user_set_mobile_phone(MsnUser *user, const char *number); - -/** - * Sets the MSNObject for a user. - * - * @param user The user. - * @param obj The MSNObject. - */ -void msn_user_set_object(MsnUser *user, MsnObject *obj); - -/** - * Sets the client information for a user. - * - * @param user The user. - * @param info The client information. - */ -void msn_user_set_client_caps(MsnUser *user, GHashTable *info); - - -/** - * Returns the passport account for a user. - * - * @param user The user. - * - * @return The passport account. - */ -const char *msn_user_get_passport(const MsnUser *user); - -/** - * Returns the friendly name for a user. - * - * @param user The user. - * - * @return The friendly name. - */ -const char *msn_user_get_friendly_name(const MsnUser *user); - -/** - * Returns the home phone number for a user. - * - * @param user The user. - * - * @return The user's home phone number. - */ -const char *msn_user_get_home_phone(const MsnUser *user); - -/** - * Returns the work phone number for a user. - * - * @param user The user. - * - * @return The user's work phone number. - */ -const char *msn_user_get_work_phone(const MsnUser *user); - -/** - * Returns the mobile phone number for a user. - * - * @param user The user. - * - * @return The user's mobile phone number. - */ -const char *msn_user_get_mobile_phone(const MsnUser *user); - -/** - * Returns the MSNObject for a user. - * - * @param user The user. - * - * @return The MSNObject. - */ -MsnObject *msn_user_get_object(const MsnUser *user); - -/** - * Returns the client information for a user. - * - * @param user The user. - * - * @return The client information. - */ -GHashTable *msn_user_get_client_caps(const MsnUser *user); - -/*@}*/ - -#endif /* _MSN_USER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,709 +0,0 @@ -/** - * @file userlist.c MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "userlist.h" - -const char *lists[] = { "FL", "AL", "BL", "RL" }; - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *friendly; - -} MsnPermitAdd; - -/************************************************************************** - * Callbacks - **************************************************************************/ -static void -msn_accept_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - MsnSession *session; - MsnUserList *userlist; - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - session = pa->gc->proto_data; - userlist = session->userlist; - - msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_AL, NULL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -msn_cancel_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - MsnSession *session; - MsnUserList *userlist; - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - session = pa->gc->proto_data; - userlist = session->userlist; - - msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_BL, NULL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -got_new_entry(PurpleConnection *gc, const char *passport, const char *friendly) -{ - MsnPermitAdd *pa; - - pa = g_new0(MsnPermitAdd, 1); - pa->who = g_strdup(passport); - pa->friendly = g_strdup(friendly); - pa->gc = gc; - - purple_account_request_authorization(purple_connection_get_account(gc), passport, NULL, friendly, NULL, - purple_find_buddy(purple_connection_get_account(gc), passport) != NULL, - msn_accept_add_cb, msn_cancel_add_cb, pa); -} - -/************************************************************************** - * Utility functions - **************************************************************************/ - -static gboolean -user_is_in_group(MsnUser *user, int group_id) -{ - if (user == NULL) - return FALSE; - - if (group_id < 0) - return FALSE; - - if (g_list_find(user->group_ids, GINT_TO_POINTER(group_id))) - return TRUE; - - return FALSE; -} - -static gboolean -user_is_there(MsnUser *user, int list_id, int group_id) -{ - int list_op; - - if (user == NULL) - return FALSE; - - list_op = 1 << list_id; - - if (!(user->list_op & list_op)) - return FALSE; - - if (list_id == MSN_LIST_FL) - { - if (group_id >= 0) - return user_is_in_group(user, group_id); - } - - return TRUE; -} - -static const char* -get_friendly_name(MsnUser *user) -{ - const char *friendly_name; - - g_return_val_if_fail(user != NULL, NULL); - - friendly_name = msn_user_get_friendly_name(user); - - if (friendly_name != NULL) - friendly_name = purple_url_encode(friendly_name); - else - friendly_name = msn_user_get_passport(user); - - /* this might be a bit of a hack, but it should prevent notification server - * disconnections for people who have buddies with insane friendly names - * who added you to their buddy list from being disconnected. Stu. */ - /* Shx: What? Isn't the store_name obtained from the server, and hence it's - * below the BUDDY_ALIAS_MAXLEN ? */ - /* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're - * probably decoding the incoming store_name wrong, or something. bleh. */ - - if (strlen(friendly_name) > BUDDY_ALIAS_MAXLEN) - friendly_name = msn_user_get_passport(user); - - return friendly_name; -} - -static void -msn_request_add_group(MsnUserList *userlist, const char *who, - const char *old_group_name, const char *new_group_name) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - MsnMoveBuddy *data; - - cmdproc = userlist->session->notification->cmdproc; - data = g_new0(MsnMoveBuddy, 1); - - data->who = g_strdup(who); - - if (old_group_name) - data->old_group_name = g_strdup(old_group_name); - - trans = msn_transaction_new(cmdproc, "ADG", "%s %d", - purple_url_encode(new_group_name), - 0); - - msn_transaction_set_data(trans, data); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -/************************************************************************** - * Server functions - **************************************************************************/ - -MsnListId -msn_get_list_id(const char *list) -{ - if (list[0] == 'F') - return MSN_LIST_FL; - else if (list[0] == 'A') - return MSN_LIST_AL; - else if (list[0] == 'B') - return MSN_LIST_BL; - else if (list[0] == 'R') - return MSN_LIST_RL; - - return -1; -} - -void -msn_got_add_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id) -{ - PurpleAccount *account; - const char *passport; - const char *friendly; - - account = session->account; - - passport = msn_user_get_passport(user); - friendly = msn_user_get_friendly_name(user); - - if (list_id == MSN_LIST_FL) - { - PurpleConnection *gc; - - gc = purple_account_get_connection(account); - - serv_got_alias(gc, passport, friendly); - - if (group_id >= 0) - { - msn_user_add_group_id(user, group_id); - } - else - { - /* session->sync->fl_users_count++; */ - } - } - else if (list_id == MSN_LIST_AL) - { - purple_privacy_permit_add(account, passport, TRUE); - } - else if (list_id == MSN_LIST_BL) - { - purple_privacy_deny_add(account, passport, TRUE); - } - else if (list_id == MSN_LIST_RL) - { - PurpleConnection *gc; - PurpleConversation *convo; - - gc = purple_account_get_connection(account); - - purple_debug_info("msn", - "%s has added you to his or her buddy list.\n", - passport); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, passport, account); - if (convo) { - PurpleBuddy *buddy; - char *msg; - - buddy = purple_find_buddy(account, passport); - msg = g_strdup_printf( - _("%s has added you to his or her buddy list."), - buddy ? purple_buddy_get_contact_alias(buddy) : passport); - purple_conv_im_write(PURPLE_CONV_IM(convo), passport, msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - - if (!(user->list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) - { - /* - * TODO: The friendly name was NULL for me when I - * looked at this. Maybe we should use the store - * name instead? --KingAnt - */ - got_new_entry(gc, passport, friendly); - } - } - - user->list_op |= (1 << list_id); - /* purple_user_add_list_id (user, list_id); */ -} - -void -msn_got_rem_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id) -{ - PurpleAccount *account; - const char *passport; - - account = session->account; - - passport = msn_user_get_passport(user); - - if (list_id == MSN_LIST_FL) - { - /* TODO: When is the user totally removed? */ - if (group_id >= 0) - { - msn_user_remove_group_id(user, group_id); - return; - } - else - { - /* session->sync->fl_users_count--; */ - } - } - else if (list_id == MSN_LIST_AL) - { - purple_privacy_permit_remove(account, passport, TRUE); - } - else if (list_id == MSN_LIST_BL) - { - purple_privacy_deny_remove(account, passport, TRUE); - } - else if (list_id == MSN_LIST_RL) - { - PurpleConversation *convo; - - purple_debug_info("msn", - "%s has removed you from his or her buddy list.\n", - passport); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, passport, account); - if (convo) { - PurpleBuddy *buddy; - char *msg; - - buddy = purple_find_buddy(account, passport); - msg = g_strdup_printf( - _("%s has removed you from his or her buddy list."), - buddy ? purple_buddy_get_contact_alias(buddy) : passport); - purple_conv_im_write(PURPLE_CONV_IM(convo), passport, msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - } - - user->list_op &= ~(1 << list_id); - /* purple_user_remove_list_id (user, list_id); */ - - if (user->list_op == 0) - { - purple_debug_info("msn", "Buddy '%s' shall be deleted?.\n", - passport); - - } -} - -void -msn_got_lst_user(MsnSession *session, MsnUser *user, - int list_op, GSList *group_ids) -{ - PurpleConnection *gc; - PurpleAccount *account; - const char *passport; - const char *store; - - account = session->account; - gc = purple_account_get_connection(account); - - passport = msn_user_get_passport(user); - store = msn_user_get_friendly_name(user); - - if (list_op & MSN_LIST_AL_OP) - { - /* These are users who are allowed to see our status. */ - purple_privacy_deny_remove(account, passport, TRUE); - purple_privacy_permit_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_BL_OP) - { - /* These are users who are not allowed to see our status. */ - purple_privacy_permit_remove(account, passport, TRUE); - purple_privacy_deny_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_FL_OP) - { - GSList *c; - for (c = group_ids; c != NULL; c = g_slist_next(c)) - { - int group_id; - group_id = GPOINTER_TO_INT(c->data); - msn_user_add_group_id(user, group_id); - } - - /* FIXME: It might be a real alias */ - /* Umm, what? This might fix bug #1385130 */ - serv_got_alias(gc, passport, store); - } - - if (list_op & MSN_LIST_RL_OP) - { - /* These are users who have us on their buddy list. */ - /* - * TODO: What is store name set to when this happens? - * For one of my accounts "something@hotmail.com" - * the store name was "something." Maybe we - * should use the friendly name, instead? --KingAnt - */ - - if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) - { - got_new_entry(gc, passport, store); - } - } - - user->list_op = list_op; -} - -/************************************************************************** - * UserList functions - **************************************************************************/ - -MsnUserList* -msn_userlist_new(MsnSession *session) -{ - MsnUserList *userlist; - - userlist = g_new0(MsnUserList, 1); - - userlist->session = session; - userlist->buddy_icon_requests = g_queue_new(); - - /* buddy_icon_window is the number of allowed simultaneous buddy icon requests. - * XXX With smarter rate limiting code, we could allow more at once... 5 was the limit set when - * we weren't retrieiving any more than 5 per MSN session. */ - userlist->buddy_icon_window = 1; - - return userlist; -} - -void -msn_userlist_destroy(MsnUserList *userlist) -{ - GList *l; - - for (l = userlist->users; l != NULL; l = l->next) - { - msn_user_destroy(l->data); - } - - g_list_free(userlist->users); - - for (l = userlist->groups; l != NULL; l = l->next) - { - msn_group_destroy(l->data); - } - - g_list_free(userlist->groups); - - g_queue_free(userlist->buddy_icon_requests); - - if (userlist->buddy_icon_request_timer) - purple_timeout_remove(userlist->buddy_icon_request_timer); - - g_free(userlist); -} - -void -msn_userlist_add_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_prepend(userlist->users, user); -} - -void -msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_remove(userlist->users, user); -} - -MsnUser * -msn_userlist_find_user(MsnUserList *userlist, const char *passport) -{ - GList *l; - - g_return_val_if_fail(passport != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) - { - MsnUser *user = (MsnUser *)l->data; - - g_return_val_if_fail(user->passport != NULL, NULL); - - if (!strcmp(passport, user->passport)) - return user; - } - - return NULL; -} - -void -msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_append(userlist->groups, group); -} - -void -msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_remove(userlist->groups, group); -} - -MsnGroup * -msn_userlist_find_group_with_id(MsnUserList *userlist, int id) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(id >= 0, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if (group->id == id) - return group; - } - - return NULL; -} - -MsnGroup * -msn_userlist_find_group_with_name(MsnUserList *userlist, const char *name) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if ((group->name != NULL) && !g_ascii_strcasecmp(name, group->name)) - return group; - } - - return NULL; -} - -int -msn_userlist_find_group_id(MsnUserList *userlist, const char *group_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_name(userlist, group_name); - - if (group != NULL) - return msn_group_get_id(group); - else - return -1; -} - -const char * -msn_userlist_find_group_name(MsnUserList *userlist, int group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - return msn_group_get_name(group); - else - return NULL; -} - -void -msn_userlist_rename_group_id(MsnUserList *userlist, int group_id, - const char *new_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - msn_group_set_name(group, new_name); -} - -void -msn_userlist_remove_group_id(MsnUserList *userlist, int group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - { - msn_userlist_remove_group(userlist, group); - msn_group_destroy(group); - } -} - -void -msn_userlist_rem_buddy(MsnUserList *userlist, - const char *who, int list_id, const char *group_name) -{ - MsnUser *user; - int group_id; - const char *list; - - user = msn_userlist_find_user(userlist, who); - group_id = -1; - - if (group_name != NULL) - { - group_id = msn_userlist_find_group_id(userlist, group_name); - - if (group_id < 0) - { - /* Whoa, there is no such group. */ - purple_debug_error("msn", "Group doesn't exist: %s\n", group_name); - return; - } - } - - /* First we're going to check if not there. */ - if (!(user_is_there(user, list_id, group_id))) - { - list = lists[list_id]; - purple_debug_error("msn", "User '%s' is not there: %s\n", - who, list); - return; - } - - /* Then request the rem to the server. */ - list = lists[list_id]; - - msn_notification_rem_buddy(userlist->session->notification, list, who, group_id); -} - -void -msn_userlist_add_buddy(MsnUserList *userlist, - const char *who, int list_id, - const char *group_name) -{ - MsnUser *user; - int group_id; - const char *list; - const char *friendly_name; - - group_id = -1; - - if (!purple_email_is_valid(who)) - { - /* only notify the user about problems adding to the friends list - * maybe we should do something else for other lists, but it probably - * won't cause too many problems if we just ignore it */ - if (list_id == MSN_LIST_FL) - { - char *str = g_strdup_printf(_("Unable to add \"%s\"."), who); - purple_notify_error(NULL, NULL, str, - _("The username specified is invalid.")); - g_free(str); - } - - return; - } - - if (group_name != NULL) - { - group_id = msn_userlist_find_group_id(userlist, group_name); - - if (group_id < 0) - { - /* Whoa, we must add that group first. */ - msn_request_add_group(userlist, who, NULL, group_name); - return; - } - } - - user = msn_userlist_find_user(userlist, who); - - /* First we're going to check if it's already there. */ - if (user_is_there(user, list_id, group_id)) - { - list = lists[list_id]; - purple_debug_error("msn", "User '%s' is already there: %s\n", who, list); - return; - } - - friendly_name = (user != NULL) ? get_friendly_name(user) : who; - - /* Then request the add to the server. */ - list = lists[list_id]; - - msn_notification_add_buddy(userlist->session->notification, list, who, - friendly_name, group_id); -} - -void -msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, const char *new_group_name) -{ - int new_group_id; - - new_group_id = msn_userlist_find_group_id(userlist, new_group_name); - - if (new_group_id < 0) - { - msn_request_add_group(userlist, who, old_group_name, new_group_name); - return; - } - - msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, new_group_name); - msn_userlist_rem_buddy(userlist, who, MSN_LIST_FL, old_group_name); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/msnp9/userlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/** - * @file userlist.h MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_USERLIST_H_ -#define _MSN_USERLIST_H_ - -typedef struct _MsnUserList MsnUserList; - -#include "cmdproc.h" -#include "user.h" -#include "group.h" - -typedef enum -{ - MSN_LIST_FL, - MSN_LIST_AL, - MSN_LIST_BL, - MSN_LIST_RL - -} MsnListId; - -typedef struct -{ - char *who; - char *old_group_name; - -} MsnMoveBuddy; - -struct _MsnUserList -{ - MsnSession *session; - - /* MsnUsers *users; */ - /* MsnGroups *groups; */ - - GList *users; - GList *groups; - - GQueue *buddy_icon_requests; - int buddy_icon_window; - guint buddy_icon_request_timer; - - int fl_users_count; - -}; - -MsnListId msn_get_list_id(const char *list); - -void msn_got_add_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id); -void msn_got_rem_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id); -void msn_got_lst_user(MsnSession *session, MsnUser *user, - int list_op, GSList *group_ids); - -MsnUserList *msn_userlist_new(MsnSession *session); -void msn_userlist_destroy(MsnUserList *userlist); -void msn_userlist_add_user(MsnUserList *userlist, MsnUser *user); -void msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user); -MsnUser *msn_userlist_find_user(MsnUserList *userlist, - const char *passport); -void msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group); -void msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group); -MsnGroup *msn_userlist_find_group_with_id(MsnUserList *userlist, int id); -MsnGroup *msn_userlist_find_group_with_name(MsnUserList *userlist, - const char *name); -int msn_userlist_find_group_id(MsnUserList *userlist, - const char *group_name); -const char *msn_userlist_find_group_name(MsnUserList *userlist, - int group_id); -void msn_userlist_rename_group_id(MsnUserList *userlist, int group_id, - const char *new_name); -void msn_userlist_remove_group_id(MsnUserList *userlist, int group_id); - -void msn_userlist_rem_buddy(MsnUserList *userlist, const char *who, - int list_id, const char *group_name); -void msn_userlist_add_buddy(MsnUserList *userlist, const char *who, - int list_id, const char *group_name); -void msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, - const char *new_group_name); - -#endif /* _MSN_USERLIST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,434 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle MXit plugin actions -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "roster.h" -#include "actions.h" -#include "splashscreen.h" -#include "cipher.h" -#include "profile.h" - - -/* MXit Moods */ -static const char* moods[] = { - /* 0 */ N_("None"), - /* 1 */ N_("Angry"), - /* 2 */ N_("Excited"), - /* 3 */ N_("Grumpy"), - /* 4 */ N_("Happy"), - /* 5 */ N_("In Love"), - /* 6 */ N_("Invincible"), - /* 7 */ N_("Sad"), - /* 8 */ N_("Hot"), - /* 9 */ N_("Sick"), - /* 10 */ N_("Sleepy") -}; - - -/*------------------------------------------------------------------------ - * The user has selected to change their current mood. - * - * @param gc The connection object - * @param fields The fields from the request pop-up - */ -static void mxit_cb_set_mood( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - int mood = purple_request_fields_get_choice( fields, "mood" ); - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_set_mood (%i)\n", mood ); - - if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { - purple_debug_error( MXIT_PLUGIN_ID, "Unable to set mood; account offline.\n" ); - return; - } - - /* Save the new mood in session */ - session->mood = mood; - - /* now send the update to MXit */ - mxit_send_mood( session, mood ); -} - - -/*------------------------------------------------------------------------ - * Create and display the mood selection window to the user. - * - * @param action The action object - */ -static void mxit_cb_action_mood( PurplePluginAction* action ) -{ - PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - PurpleRequestFields* fields = NULL; - PurpleRequestFieldGroup* group = NULL; - PurpleRequestField* field = NULL; - unsigned int i = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_action_mood\n" ); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* show current mood */ - field = purple_request_field_string_new( "current", _( "Current Mood" ), _( moods[session->mood] ), FALSE ); - purple_request_field_string_set_editable( field, FALSE ); /* current mood field is not editable */ - purple_request_field_group_add_field( group, field ); - - /* add all moods to list */ - field = purple_request_field_choice_new( "mood", _( "New Mood" ), 0 ); - for ( i = 0; i < ARRAY_SIZE( moods ); i++ ) { - purple_request_field_choice_add( field, _( moods[i] ) ); - } - purple_request_field_set_required( field, TRUE ); - purple_request_field_choice_set_default_value( field, session->mood ); - purple_request_field_group_add_field( group, field ); - - /* (reference: "libpurple/request.h") */ - purple_request_fields( gc, _( "Mood" ), _( "Change your Mood" ), _( "How do you feel right now?" ), fields, _( "Set" ), - G_CALLBACK( mxit_cb_set_mood ), _( "Cancel" ), NULL, purple_connection_get_account( gc ), NULL, NULL, gc ); -} - - -/*------------------------------------------------------------------------ - * The user has selected to change their profile. - * - * @param gc The connection object - * @param fields The fields from the request pop-up - */ -static void mxit_cb_set_profile( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleRequestField* field = NULL; - const char* pin = NULL; - const char* pin2 = NULL; - const char* name = NULL; - const char* bday = NULL; - const char* err = NULL; - int len; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_set_profile\n" ); - - if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { - purple_debug_error( MXIT_PLUGIN_ID, "Unable to update profile; account offline.\n" ); - return; - } - - /* validate pin */ - pin = purple_request_fields_get_string( fields, "pin" ); - if ( !pin ) { - err = _( "The PIN you entered is invalid." ); - goto out; - } - len = strlen( pin ); - if ( ( len < 4 ) || ( len > 10 ) ) { - err = _( "The PIN you entered has an invalid length [4-10]." ); - goto out; - } - for ( i = 0; i < len; i++ ) { - if ( !g_ascii_isdigit( pin[i] ) ) { - err = _( "The PIN is invalid. It should only consist of digits [0-9]." ); - goto out; - } - } - pin2 = purple_request_fields_get_string( fields, "pin2" ); - if ( ( !pin2 ) || ( strcmp( pin, pin2 ) != 0 ) ) { - err = _( "The two PINs you entered do not match." ); - goto out; - } - - /* validate name */ - name = purple_request_fields_get_string( fields, "name" ); - if ( ( !name ) || ( strlen( name ) < 3 ) ) { - err = _( "The name you entered is invalid." ); - goto out; - } - - /* validate birthdate */ - bday = purple_request_fields_get_string( fields, "bday" ); - if ( ( !bday ) || ( strlen( bday ) < 10 ) || ( !validateDate( bday ) ) ) { - err = _( "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." ); - goto out; - } - -out: - if ( !err ) { - struct MXitProfile* profile = session->profile; - GString* attributes = g_string_sized_new( 128 ); - char attrib[512]; - unsigned int acount = 0; - - /* all good, so we can now update the profile */ - - /* update pin */ - purple_account_set_password( session->acc, pin ); - g_free( session->encpwd ); - session->encpwd = mxit_encrypt_password( session ); - - /* update name */ - g_strlcpy( profile->nickname, name, sizeof( profile->nickname ) ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FULLNAME, CP_PROF_TYPE_UTF8, profile->nickname ); - g_string_append( attributes, attrib ); - acount++; - - /* update hidden */ - field = purple_request_fields_get_field( fields, "hidden" ); - profile->hidden = purple_request_field_bool_get_value( field ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_HIDENUMBER, CP_PROF_TYPE_BOOL, ( profile->hidden ) ? "1" : "0" ); - g_string_append( attributes, attrib ); - acount++; - - /* update birthday */ - strcpy( profile->birthday, bday ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_BIRTHDATE, CP_PROF_TYPE_UTF8, profile->birthday ); - g_string_append( attributes, attrib ); - acount++; - - /* update gender */ - profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_GENDER, CP_PROF_TYPE_BOOL, ( profile->male ) ? "1" : "0" ); - g_string_append( attributes, attrib ); - acount++; - - /* update title */ - name = purple_request_fields_get_string( fields, "title" ); - if ( !name ) - profile->title[0] = '\0'; - else - strcpy( profile->title, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_TITLE, CP_PROF_TYPE_UTF8, profile->title ); - g_string_append( attributes, attrib ); - acount++; - - /* update firstname */ - name = purple_request_fields_get_string( fields, "firstname" ); - if ( !name ) - profile->firstname[0] = '\0'; - else - strcpy( profile->firstname, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FIRSTNAME, CP_PROF_TYPE_UTF8, profile->firstname ); - g_string_append( attributes, attrib ); - acount++; - - /* update lastname */ - name = purple_request_fields_get_string( fields, "lastname" ); - if ( !name ) - profile->lastname[0] = '\0'; - else - strcpy( profile->lastname, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_LASTNAME, CP_PROF_TYPE_UTF8, profile->lastname ); - g_string_append( attributes, attrib ); - acount++; - - /* update email address */ - name = purple_request_fields_get_string( fields, "email" ); - if ( !name ) - profile->email[0] = '\0'; - else - strcpy( profile->email, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_EMAIL, CP_PROF_TYPE_UTF8, profile->email ); - g_string_append( attributes, attrib ); - acount++; - - /* update mobile number */ - name = purple_request_fields_get_string( fields, "mobilenumber" ); - if ( !name ) - profile->mobilenr[0] = '\0'; - else - strcpy( profile->mobilenr, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_MOBILENR, CP_PROF_TYPE_UTF8, profile->mobilenr ); - g_string_append( attributes, attrib ); - acount++; - - /* send the profile update to MXit */ - mxit_send_extprofile_update( session, session->encpwd, acount, attributes->str ); - g_string_free( attributes, TRUE ); - } - else { - /* show error to user */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Profile Update Error" ), err ); - } -} - - -/*------------------------------------------------------------------------ - * Display and update the user's profile. - * - * @param action The action object - */ -static void mxit_cb_action_profile( PurplePluginAction* action ) -{ - PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct MXitProfile* profile = session->profile; - - PurpleRequestFields* fields = NULL; - PurpleRequestFieldGroup* group = NULL; - PurpleRequestField* field = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_action_profile\n" ); - - /* ensure that we actually have the user's profile information */ - if ( !profile ) { - /* no profile information yet, so we cannot update */ - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Profile" ), _( "Your profile information is not yet retrieved. Please try again later." ) ); - return; - } - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* pin */ - field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), session->acc->password, FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - - /* display name */ - field = purple_request_field_string_new( "name", _( "Display Name" ), profile->nickname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* birthday */ - field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* gender */ - field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); - purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ - purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ - purple_request_field_group_add_field( group, field ); - - /* hidden */ - field = purple_request_field_bool_new( "hidden", _( "Hide my number" ), profile->hidden ); - purple_request_field_group_add_field( group, field ); - - /* title */ - field = purple_request_field_string_new( "title", _( "Title" ), profile->title, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* first name */ - field = purple_request_field_string_new( "firstname", _( "First Name" ), profile->firstname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* last name */ - field = purple_request_field_string_new( "lastname", _( "Last Name" ), profile->lastname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* email */ - field = purple_request_field_string_new( "email", _( "Email" ), profile->email, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* mobile number */ - field = purple_request_field_string_new( "mobilenumber", _( "Mobile Number" ), profile->mobilenr, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* (reference: "libpurple/request.h") */ - purple_request_fields( gc, _( "Profile" ), _( "Update your Profile" ), _( "Here you can update your MXit profile" ), fields, _( "Set" ), - G_CALLBACK( mxit_cb_set_profile ), _( "Cancel" ), NULL, purple_connection_get_account( gc ), NULL, NULL, gc ); -} - - -/*------------------------------------------------------------------------ - * Display the current splash-screen, or a notification pop-up if one is not available. - * - * @param action The action object - */ -static void mxit_cb_action_splash( PurplePluginAction* action ) -{ - PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - if ( splash_current( session ) != NULL ) - splash_display( session ); - else - mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "View Splash" ), _( "There is no splash-screen currently available" ) ); -} - - -/*------------------------------------------------------------------------ - * Display info about the plugin. - * - * @param action The action object - */ -static void mxit_cb_action_about( PurplePluginAction* action ) -{ - char version[256]; - - g_snprintf( version, sizeof( version ), "MXit libPurple Plugin v%s\n" - "MXit Client Protocol v%s\n\n" - "Author:\nPieter Loubser\n\n" - "Contributors:\nAndrew Victor\n\n" - "Testers:\nBraeme Le Roux\n\n", - MXIT_PLUGIN_VERSION, MXIT_CP_RELEASE ); - - mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "About" ), version ); -} - - -/*------------------------------------------------------------------------ - * Associate actions with the MXit plugin. - * - * @param plugin The MXit protocol plugin - * @param context The connection context (if available) - * @return The list of plugin actions - */ -GList* mxit_actions( PurplePlugin* plugin, gpointer context ) -{ - PurplePluginAction* action = NULL; - GList* m = NULL; - - /* display / change mood */ - action = purple_plugin_action_new( _( "Change Mood..." ), mxit_cb_action_mood ); - m = g_list_append( m, action ); - - /* display / change profile */ - action = purple_plugin_action_new( _( "Change Profile..." ), mxit_cb_action_profile ); - m = g_list_append( m, action ); - - /* display splash-screen */ - action = purple_plugin_action_new( _( "View Splash..." ), mxit_cb_action_splash ); - m = g_list_append( m, action ); - - /* display plugin version */ - action = purple_plugin_action_new( _( "About..." ), mxit_cb_action_about ); - m = g_list_append( m, action ); - - return m; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/actions.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle MXit plugin actions -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_ACTIONS_H_ -#define _MXIT_ACTIONS_H_ - - -/* callbacks */ -GList* mxit_actions( PurplePlugin* plugin, gpointer context ); - - -#endif /* _MXIT_ACTIONS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,405 +0,0 @@ - -// advanced encryption standard -// author: karl malbrain, malbrain@yahoo.com - -/* -This work, including the source code, documentation -and related data, is placed into the public domain. - -The orginal author is Karl Malbrain. - -THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY -OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF -MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, -ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE -RESULTING FROM THE USE, MODIFICATION, OR -REDISTRIBUTION OF THIS SOFTWARE. -*/ - -#include -#include - -#include "aes.h" - -// AES only supports Nb=4 -#define Nb 4 // number of columns in the state & expanded key - -#define Nk 4 // number of columns in a key -#define Nr 10 // number of rounds in encryption - -static uchar Sbox[256] = { // forward s-box -0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, -0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, -0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, -0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, -0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, -0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, -0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, -0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, -0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, -0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, -0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, -0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, -0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, -0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, -0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, -0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16}; - -static uchar InvSbox[256] = { // inverse s-box -0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, -0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, -0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, -0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, -0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, -0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, -0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, -0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, -0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, -0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, -0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, -0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, -0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, -0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, -0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, -0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d}; - -// combined Xtimes2[Sbox[]] -static uchar Xtime2Sbox[256] = { -0xc6, 0xf8, 0xee, 0xf6, 0xff, 0xd6, 0xde, 0x91, 0x60, 0x02, 0xce, 0x56, 0xe7, 0xb5, 0x4d, 0xec, -0x8f, 0x1f, 0x89, 0xfa, 0xef, 0xb2, 0x8e, 0xfb, 0x41, 0xb3, 0x5f, 0x45, 0x23, 0x53, 0xe4, 0x9b, -0x75, 0xe1, 0x3d, 0x4c, 0x6c, 0x7e, 0xf5, 0x83, 0x68, 0x51, 0xd1, 0xf9, 0xe2, 0xab, 0x62, 0x2a, -0x08, 0x95, 0x46, 0x9d, 0x30, 0x37, 0x0a, 0x2f, 0x0e, 0x24, 0x1b, 0xdf, 0xcd, 0x4e, 0x7f, 0xea, -0x12, 0x1d, 0x58, 0x34, 0x36, 0xdc, 0xb4, 0x5b, 0xa4, 0x76, 0xb7, 0x7d, 0x52, 0xdd, 0x5e, 0x13, -0xa6, 0xb9, 0x00, 0xc1, 0x40, 0xe3, 0x79, 0xb6, 0xd4, 0x8d, 0x67, 0x72, 0x94, 0x98, 0xb0, 0x85, -0xbb, 0xc5, 0x4f, 0xed, 0x86, 0x9a, 0x66, 0x11, 0x8a, 0xe9, 0x04, 0xfe, 0xa0, 0x78, 0x25, 0x4b, -0xa2, 0x5d, 0x80, 0x05, 0x3f, 0x21, 0x70, 0xf1, 0x63, 0x77, 0xaf, 0x42, 0x20, 0xe5, 0xfd, 0xbf, -0x81, 0x18, 0x26, 0xc3, 0xbe, 0x35, 0x88, 0x2e, 0x93, 0x55, 0xfc, 0x7a, 0xc8, 0xba, 0x32, 0xe6, -0xc0, 0x19, 0x9e, 0xa3, 0x44, 0x54, 0x3b, 0x0b, 0x8c, 0xc7, 0x6b, 0x28, 0xa7, 0xbc, 0x16, 0xad, -0xdb, 0x64, 0x74, 0x14, 0x92, 0x0c, 0x48, 0xb8, 0x9f, 0xbd, 0x43, 0xc4, 0x39, 0x31, 0xd3, 0xf2, -0xd5, 0x8b, 0x6e, 0xda, 0x01, 0xb1, 0x9c, 0x49, 0xd8, 0xac, 0xf3, 0xcf, 0xca, 0xf4, 0x47, 0x10, -0x6f, 0xf0, 0x4a, 0x5c, 0x38, 0x57, 0x73, 0x97, 0xcb, 0xa1, 0xe8, 0x3e, 0x96, 0x61, 0x0d, 0x0f, -0xe0, 0x7c, 0x71, 0xcc, 0x90, 0x06, 0xf7, 0x1c, 0xc2, 0x6a, 0xae, 0x69, 0x17, 0x99, 0x3a, 0x27, -0xd9, 0xeb, 0x2b, 0x22, 0xd2, 0xa9, 0x07, 0x33, 0x2d, 0x3c, 0x15, 0xc9, 0x87, 0xaa, 0x50, 0xa5, -0x03, 0x59, 0x09, 0x1a, 0x65, 0xd7, 0x84, 0xd0, 0x82, 0x29, 0x5a, 0x1e, 0x7b, 0xa8, 0x6d, 0x2c -}; - -// combined Xtimes3[Sbox[]] -static uchar Xtime3Sbox[256] = { -0xa5, 0x84, 0x99, 0x8d, 0x0d, 0xbd, 0xb1, 0x54, 0x50, 0x03, 0xa9, 0x7d, 0x19, 0x62, 0xe6, 0x9a, -0x45, 0x9d, 0x40, 0x87, 0x15, 0xeb, 0xc9, 0x0b, 0xec, 0x67, 0xfd, 0xea, 0xbf, 0xf7, 0x96, 0x5b, -0xc2, 0x1c, 0xae, 0x6a, 0x5a, 0x41, 0x02, 0x4f, 0x5c, 0xf4, 0x34, 0x08, 0x93, 0x73, 0x53, 0x3f, -0x0c, 0x52, 0x65, 0x5e, 0x28, 0xa1, 0x0f, 0xb5, 0x09, 0x36, 0x9b, 0x3d, 0x26, 0x69, 0xcd, 0x9f, -0x1b, 0x9e, 0x74, 0x2e, 0x2d, 0xb2, 0xee, 0xfb, 0xf6, 0x4d, 0x61, 0xce, 0x7b, 0x3e, 0x71, 0x97, -0xf5, 0x68, 0x00, 0x2c, 0x60, 0x1f, 0xc8, 0xed, 0xbe, 0x46, 0xd9, 0x4b, 0xde, 0xd4, 0xe8, 0x4a, -0x6b, 0x2a, 0xe5, 0x16, 0xc5, 0xd7, 0x55, 0x94, 0xcf, 0x10, 0x06, 0x81, 0xf0, 0x44, 0xba, 0xe3, -0xf3, 0xfe, 0xc0, 0x8a, 0xad, 0xbc, 0x48, 0x04, 0xdf, 0xc1, 0x75, 0x63, 0x30, 0x1a, 0x0e, 0x6d, -0x4c, 0x14, 0x35, 0x2f, 0xe1, 0xa2, 0xcc, 0x39, 0x57, 0xf2, 0x82, 0x47, 0xac, 0xe7, 0x2b, 0x95, -0xa0, 0x98, 0xd1, 0x7f, 0x66, 0x7e, 0xab, 0x83, 0xca, 0x29, 0xd3, 0x3c, 0x79, 0xe2, 0x1d, 0x76, -0x3b, 0x56, 0x4e, 0x1e, 0xdb, 0x0a, 0x6c, 0xe4, 0x5d, 0x6e, 0xef, 0xa6, 0xa8, 0xa4, 0x37, 0x8b, -0x32, 0x43, 0x59, 0xb7, 0x8c, 0x64, 0xd2, 0xe0, 0xb4, 0xfa, 0x07, 0x25, 0xaf, 0x8e, 0xe9, 0x18, -0xd5, 0x88, 0x6f, 0x72, 0x24, 0xf1, 0xc7, 0x51, 0x23, 0x7c, 0x9c, 0x21, 0xdd, 0xdc, 0x86, 0x85, -0x90, 0x42, 0xc4, 0xaa, 0xd8, 0x05, 0x01, 0x12, 0xa3, 0x5f, 0xf9, 0xd0, 0x91, 0x58, 0x27, 0xb9, -0x38, 0x13, 0xb3, 0x33, 0xbb, 0x70, 0x89, 0xa7, 0xb6, 0x22, 0x92, 0x20, 0x49, 0xff, 0x78, 0x7a, -0x8f, 0xf8, 0x80, 0x17, 0xda, 0x31, 0xc6, 0xb8, 0xc3, 0xb0, 0x77, 0x11, 0xcb, 0xfc, 0xd6, 0x3a -}; - -// modular multiplication tables -// based on: - -// Xtime2[x] = (x & 0x80 ? 0x1b : 0) ^ (x + x) -// Xtime3[x] = x^Xtime2[x]; - -#if 0 -static uchar Xtime2[256] = { -0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, -0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, -0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, -0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, -0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, -0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, -0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, -0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, -0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05, -0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25, -0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, -0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65, -0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85, -0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, -0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5, -0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5}; -#endif - -static uchar Xtime9[256] = { -0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, -0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, -0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, -0xab, 0xa2, 0xb9, 0xb0, 0x8f, 0x86, 0x9d, 0x94, 0xe3, 0xea, 0xf1, 0xf8, 0xc7, 0xce, 0xd5, 0xdc, -0x76, 0x7f, 0x64, 0x6d, 0x52, 0x5b, 0x40, 0x49, 0x3e, 0x37, 0x2c, 0x25, 0x1a, 0x13, 0x08, 0x01, -0xe6, 0xef, 0xf4, 0xfd, 0xc2, 0xcb, 0xd0, 0xd9, 0xae, 0xa7, 0xbc, 0xb5, 0x8a, 0x83, 0x98, 0x91, -0x4d, 0x44, 0x5f, 0x56, 0x69, 0x60, 0x7b, 0x72, 0x05, 0x0c, 0x17, 0x1e, 0x21, 0x28, 0x33, 0x3a, -0xdd, 0xd4, 0xcf, 0xc6, 0xf9, 0xf0, 0xeb, 0xe2, 0x95, 0x9c, 0x87, 0x8e, 0xb1, 0xb8, 0xa3, 0xaa, -0xec, 0xe5, 0xfe, 0xf7, 0xc8, 0xc1, 0xda, 0xd3, 0xa4, 0xad, 0xb6, 0xbf, 0x80, 0x89, 0x92, 0x9b, -0x7c, 0x75, 0x6e, 0x67, 0x58, 0x51, 0x4a, 0x43, 0x34, 0x3d, 0x26, 0x2f, 0x10, 0x19, 0x02, 0x0b, -0xd7, 0xde, 0xc5, 0xcc, 0xf3, 0xfa, 0xe1, 0xe8, 0x9f, 0x96, 0x8d, 0x84, 0xbb, 0xb2, 0xa9, 0xa0, -0x47, 0x4e, 0x55, 0x5c, 0x63, 0x6a, 0x71, 0x78, 0x0f, 0x06, 0x1d, 0x14, 0x2b, 0x22, 0x39, 0x30, -0x9a, 0x93, 0x88, 0x81, 0xbe, 0xb7, 0xac, 0xa5, 0xd2, 0xdb, 0xc0, 0xc9, 0xf6, 0xff, 0xe4, 0xed, -0x0a, 0x03, 0x18, 0x11, 0x2e, 0x27, 0x3c, 0x35, 0x42, 0x4b, 0x50, 0x59, 0x66, 0x6f, 0x74, 0x7d, -0xa1, 0xa8, 0xb3, 0xba, 0x85, 0x8c, 0x97, 0x9e, 0xe9, 0xe0, 0xfb, 0xf2, 0xcd, 0xc4, 0xdf, 0xd6, -0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46}; - -static uchar XtimeB[256] = { -0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, -0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, -0x7b, 0x70, 0x6d, 0x66, 0x57, 0x5c, 0x41, 0x4a, 0x23, 0x28, 0x35, 0x3e, 0x0f, 0x04, 0x19, 0x12, -0xcb, 0xc0, 0xdd, 0xd6, 0xe7, 0xec, 0xf1, 0xfa, 0x93, 0x98, 0x85, 0x8e, 0xbf, 0xb4, 0xa9, 0xa2, -0xf6, 0xfd, 0xe0, 0xeb, 0xda, 0xd1, 0xcc, 0xc7, 0xae, 0xa5, 0xb8, 0xb3, 0x82, 0x89, 0x94, 0x9f, -0x46, 0x4d, 0x50, 0x5b, 0x6a, 0x61, 0x7c, 0x77, 0x1e, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2f, -0x8d, 0x86, 0x9b, 0x90, 0xa1, 0xaa, 0xb7, 0xbc, 0xd5, 0xde, 0xc3, 0xc8, 0xf9, 0xf2, 0xef, 0xe4, -0x3d, 0x36, 0x2b, 0x20, 0x11, 0x1a, 0x07, 0x0c, 0x65, 0x6e, 0x73, 0x78, 0x49, 0x42, 0x5f, 0x54, -0xf7, 0xfc, 0xe1, 0xea, 0xdb, 0xd0, 0xcd, 0xc6, 0xaf, 0xa4, 0xb9, 0xb2, 0x83, 0x88, 0x95, 0x9e, -0x47, 0x4c, 0x51, 0x5a, 0x6b, 0x60, 0x7d, 0x76, 0x1f, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2e, -0x8c, 0x87, 0x9a, 0x91, 0xa0, 0xab, 0xb6, 0xbd, 0xd4, 0xdf, 0xc2, 0xc9, 0xf8, 0xf3, 0xee, 0xe5, -0x3c, 0x37, 0x2a, 0x21, 0x10, 0x1b, 0x06, 0x0d, 0x64, 0x6f, 0x72, 0x79, 0x48, 0x43, 0x5e, 0x55, -0x01, 0x0a, 0x17, 0x1c, 0x2d, 0x26, 0x3b, 0x30, 0x59, 0x52, 0x4f, 0x44, 0x75, 0x7e, 0x63, 0x68, -0xb1, 0xba, 0xa7, 0xac, 0x9d, 0x96, 0x8b, 0x80, 0xe9, 0xe2, 0xff, 0xf4, 0xc5, 0xce, 0xd3, 0xd8, -0x7a, 0x71, 0x6c, 0x67, 0x56, 0x5d, 0x40, 0x4b, 0x22, 0x29, 0x34, 0x3f, 0x0e, 0x05, 0x18, 0x13, -0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3}; - -static uchar XtimeD[256] = { -0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, -0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, -0xbb, 0xb6, 0xa1, 0xac, 0x8f, 0x82, 0x95, 0x98, 0xd3, 0xde, 0xc9, 0xc4, 0xe7, 0xea, 0xfd, 0xf0, -0x6b, 0x66, 0x71, 0x7c, 0x5f, 0x52, 0x45, 0x48, 0x03, 0x0e, 0x19, 0x14, 0x37, 0x3a, 0x2d, 0x20, -0x6d, 0x60, 0x77, 0x7a, 0x59, 0x54, 0x43, 0x4e, 0x05, 0x08, 0x1f, 0x12, 0x31, 0x3c, 0x2b, 0x26, -0xbd, 0xb0, 0xa7, 0xaa, 0x89, 0x84, 0x93, 0x9e, 0xd5, 0xd8, 0xcf, 0xc2, 0xe1, 0xec, 0xfb, 0xf6, -0xd6, 0xdb, 0xcc, 0xc1, 0xe2, 0xef, 0xf8, 0xf5, 0xbe, 0xb3, 0xa4, 0xa9, 0x8a, 0x87, 0x90, 0x9d, -0x06, 0x0b, 0x1c, 0x11, 0x32, 0x3f, 0x28, 0x25, 0x6e, 0x63, 0x74, 0x79, 0x5a, 0x57, 0x40, 0x4d, -0xda, 0xd7, 0xc0, 0xcd, 0xee, 0xe3, 0xf4, 0xf9, 0xb2, 0xbf, 0xa8, 0xa5, 0x86, 0x8b, 0x9c, 0x91, -0x0a, 0x07, 0x10, 0x1d, 0x3e, 0x33, 0x24, 0x29, 0x62, 0x6f, 0x78, 0x75, 0x56, 0x5b, 0x4c, 0x41, -0x61, 0x6c, 0x7b, 0x76, 0x55, 0x58, 0x4f, 0x42, 0x09, 0x04, 0x13, 0x1e, 0x3d, 0x30, 0x27, 0x2a, -0xb1, 0xbc, 0xab, 0xa6, 0x85, 0x88, 0x9f, 0x92, 0xd9, 0xd4, 0xc3, 0xce, 0xed, 0xe0, 0xf7, 0xfa, -0xb7, 0xba, 0xad, 0xa0, 0x83, 0x8e, 0x99, 0x94, 0xdf, 0xd2, 0xc5, 0xc8, 0xeb, 0xe6, 0xf1, 0xfc, -0x67, 0x6a, 0x7d, 0x70, 0x53, 0x5e, 0x49, 0x44, 0x0f, 0x02, 0x15, 0x18, 0x3b, 0x36, 0x21, 0x2c, -0x0c, 0x01, 0x16, 0x1b, 0x38, 0x35, 0x22, 0x2f, 0x64, 0x69, 0x7e, 0x73, 0x50, 0x5d, 0x4a, 0x47, -0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97}; - -static uchar XtimeE[256] = { -0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, -0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, -0xdb, 0xd5, 0xc7, 0xc9, 0xe3, 0xed, 0xff, 0xf1, 0xab, 0xa5, 0xb7, 0xb9, 0x93, 0x9d, 0x8f, 0x81, -0x3b, 0x35, 0x27, 0x29, 0x03, 0x0d, 0x1f, 0x11, 0x4b, 0x45, 0x57, 0x59, 0x73, 0x7d, 0x6f, 0x61, -0xad, 0xa3, 0xb1, 0xbf, 0x95, 0x9b, 0x89, 0x87, 0xdd, 0xd3, 0xc1, 0xcf, 0xe5, 0xeb, 0xf9, 0xf7, -0x4d, 0x43, 0x51, 0x5f, 0x75, 0x7b, 0x69, 0x67, 0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17, -0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c, 0x06, 0x08, 0x1a, 0x14, 0x3e, 0x30, 0x22, 0x2c, -0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc, 0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc, -0x41, 0x4f, 0x5d, 0x53, 0x79, 0x77, 0x65, 0x6b, 0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b, -0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b, 0xd1, 0xdf, 0xcd, 0xc3, 0xe9, 0xe7, 0xf5, 0xfb, -0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0, 0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0, -0x7a, 0x74, 0x66, 0x68, 0x42, 0x4c, 0x5e, 0x50, 0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20, -0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6, 0x9c, 0x92, 0x80, 0x8e, 0xa4, 0xaa, 0xb8, 0xb6, -0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26, 0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, -0x37, 0x39, 0x2b, 0x25, 0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d, -0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d}; - -// exchanges columns in each of 4 rows -// row0 - unchanged, row1- shifted left 1, -// row2 - shifted left 2 and row3 - shifted left 3 -static void ShiftRows (uchar *state) -{ -uchar tmp; - - // just substitute row 0 - state[0] = Sbox[state[0]], state[4] = Sbox[state[4]]; - state[8] = Sbox[state[8]], state[12] = Sbox[state[12]]; - - // rotate row 1 - tmp = Sbox[state[1]], state[1] = Sbox[state[5]]; - state[5] = Sbox[state[9]], state[9] = Sbox[state[13]], state[13] = tmp; - - // rotate row 2 - tmp = Sbox[state[2]], state[2] = Sbox[state[10]], state[10] = tmp; - tmp = Sbox[state[6]], state[6] = Sbox[state[14]], state[14] = tmp; - - // rotate row 3 - tmp = Sbox[state[15]], state[15] = Sbox[state[11]]; - state[11] = Sbox[state[7]], state[7] = Sbox[state[3]], state[3] = tmp; -} - -// restores columns in each of 4 rows -// row0 - unchanged, row1- shifted right 1, -// row2 - shifted right 2 and row3 - shifted right 3 -static void InvShiftRows (uchar *state) -{ -uchar tmp; - - // restore row 0 - state[0] = InvSbox[state[0]], state[4] = InvSbox[state[4]]; - state[8] = InvSbox[state[8]], state[12] = InvSbox[state[12]]; - - // restore row 1 - tmp = InvSbox[state[13]], state[13] = InvSbox[state[9]]; - state[9] = InvSbox[state[5]], state[5] = InvSbox[state[1]], state[1] = tmp; - - // restore row 2 - tmp = InvSbox[state[2]], state[2] = InvSbox[state[10]], state[10] = tmp; - tmp = InvSbox[state[6]], state[6] = InvSbox[state[14]], state[14] = tmp; - - // restore row 3 - tmp = InvSbox[state[3]], state[3] = InvSbox[state[7]]; - state[7] = InvSbox[state[11]], state[11] = InvSbox[state[15]], state[15] = tmp; -} - -// recombine and mix each row in a column -static void MixSubColumns (uchar *state) -{ -uchar tmp[4 * Nb]; - - // mixing column 0 - tmp[0] = Xtime2Sbox[state[0]] ^ Xtime3Sbox[state[5]] ^ Sbox[state[10]] ^ Sbox[state[15]]; - tmp[1] = Sbox[state[0]] ^ Xtime2Sbox[state[5]] ^ Xtime3Sbox[state[10]] ^ Sbox[state[15]]; - tmp[2] = Sbox[state[0]] ^ Sbox[state[5]] ^ Xtime2Sbox[state[10]] ^ Xtime3Sbox[state[15]]; - tmp[3] = Xtime3Sbox[state[0]] ^ Sbox[state[5]] ^ Sbox[state[10]] ^ Xtime2Sbox[state[15]]; - - // mixing column 1 - tmp[4] = Xtime2Sbox[state[4]] ^ Xtime3Sbox[state[9]] ^ Sbox[state[14]] ^ Sbox[state[3]]; - tmp[5] = Sbox[state[4]] ^ Xtime2Sbox[state[9]] ^ Xtime3Sbox[state[14]] ^ Sbox[state[3]]; - tmp[6] = Sbox[state[4]] ^ Sbox[state[9]] ^ Xtime2Sbox[state[14]] ^ Xtime3Sbox[state[3]]; - tmp[7] = Xtime3Sbox[state[4]] ^ Sbox[state[9]] ^ Sbox[state[14]] ^ Xtime2Sbox[state[3]]; - - // mixing column 2 - tmp[8] = Xtime2Sbox[state[8]] ^ Xtime3Sbox[state[13]] ^ Sbox[state[2]] ^ Sbox[state[7]]; - tmp[9] = Sbox[state[8]] ^ Xtime2Sbox[state[13]] ^ Xtime3Sbox[state[2]] ^ Sbox[state[7]]; - tmp[10] = Sbox[state[8]] ^ Sbox[state[13]] ^ Xtime2Sbox[state[2]] ^ Xtime3Sbox[state[7]]; - tmp[11] = Xtime3Sbox[state[8]] ^ Sbox[state[13]] ^ Sbox[state[2]] ^ Xtime2Sbox[state[7]]; - - // mixing column 3 - tmp[12] = Xtime2Sbox[state[12]] ^ Xtime3Sbox[state[1]] ^ Sbox[state[6]] ^ Sbox[state[11]]; - tmp[13] = Sbox[state[12]] ^ Xtime2Sbox[state[1]] ^ Xtime3Sbox[state[6]] ^ Sbox[state[11]]; - tmp[14] = Sbox[state[12]] ^ Sbox[state[1]] ^ Xtime2Sbox[state[6]] ^ Xtime3Sbox[state[11]]; - tmp[15] = Xtime3Sbox[state[12]] ^ Sbox[state[1]] ^ Sbox[state[6]] ^ Xtime2Sbox[state[11]]; - - memcpy (state, tmp, sizeof(tmp)); -} - -// restore and un-mix each row in a column -static void InvMixSubColumns (uchar *state) -{ -uchar tmp[4 * Nb]; -int i; - - // restore column 0 - tmp[0] = XtimeE[state[0]] ^ XtimeB[state[1]] ^ XtimeD[state[2]] ^ Xtime9[state[3]]; - tmp[5] = Xtime9[state[0]] ^ XtimeE[state[1]] ^ XtimeB[state[2]] ^ XtimeD[state[3]]; - tmp[10] = XtimeD[state[0]] ^ Xtime9[state[1]] ^ XtimeE[state[2]] ^ XtimeB[state[3]]; - tmp[15] = XtimeB[state[0]] ^ XtimeD[state[1]] ^ Xtime9[state[2]] ^ XtimeE[state[3]]; - - // restore column 1 - tmp[4] = XtimeE[state[4]] ^ XtimeB[state[5]] ^ XtimeD[state[6]] ^ Xtime9[state[7]]; - tmp[9] = Xtime9[state[4]] ^ XtimeE[state[5]] ^ XtimeB[state[6]] ^ XtimeD[state[7]]; - tmp[14] = XtimeD[state[4]] ^ Xtime9[state[5]] ^ XtimeE[state[6]] ^ XtimeB[state[7]]; - tmp[3] = XtimeB[state[4]] ^ XtimeD[state[5]] ^ Xtime9[state[6]] ^ XtimeE[state[7]]; - - // restore column 2 - tmp[8] = XtimeE[state[8]] ^ XtimeB[state[9]] ^ XtimeD[state[10]] ^ Xtime9[state[11]]; - tmp[13] = Xtime9[state[8]] ^ XtimeE[state[9]] ^ XtimeB[state[10]] ^ XtimeD[state[11]]; - tmp[2] = XtimeD[state[8]] ^ Xtime9[state[9]] ^ XtimeE[state[10]] ^ XtimeB[state[11]]; - tmp[7] = XtimeB[state[8]] ^ XtimeD[state[9]] ^ Xtime9[state[10]] ^ XtimeE[state[11]]; - - // restore column 3 - tmp[12] = XtimeE[state[12]] ^ XtimeB[state[13]] ^ XtimeD[state[14]] ^ Xtime9[state[15]]; - tmp[1] = Xtime9[state[12]] ^ XtimeE[state[13]] ^ XtimeB[state[14]] ^ XtimeD[state[15]]; - tmp[6] = XtimeD[state[12]] ^ Xtime9[state[13]] ^ XtimeE[state[14]] ^ XtimeB[state[15]]; - tmp[11] = XtimeB[state[12]] ^ XtimeD[state[13]] ^ Xtime9[state[14]] ^ XtimeE[state[15]]; - - for( i=0; i < 4 * Nb; i++ ) - state[i] = InvSbox[tmp[i]]; -} - -// encrypt/decrypt columns of the key -// n.b. you can replace this with -// byte-wise xor if you wish. - -static void AddRoundKey (unsigned *state, unsigned *key) -{ -int idx; - - for( idx = 0; idx < 4; idx++ ) - state[idx] ^= key[idx]; -} - -static uchar Rcon[11] = { -0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; - -// produce Nb bytes for each round -void ExpandKey (uchar *key, uchar *expkey) -{ -uchar tmp0, tmp1, tmp2, tmp3, tmp4; -unsigned idx; - - memcpy (expkey, key, Nk * 4); - - for( idx = Nk; idx < Nb * (Nr + 1); idx++ ) { - tmp0 = expkey[4*idx - 4]; - tmp1 = expkey[4*idx - 3]; - tmp2 = expkey[4*idx - 2]; - tmp3 = expkey[4*idx - 1]; - if( !(idx % Nk) ) { - tmp4 = tmp3; - tmp3 = Sbox[tmp0]; - tmp0 = Sbox[tmp1] ^ Rcon[idx/Nk]; - tmp1 = Sbox[tmp2]; - tmp2 = Sbox[tmp4]; - } else if( Nk > 6 && idx % Nk == 4 ) { - tmp0 = Sbox[tmp0]; - tmp1 = Sbox[tmp1]; - tmp2 = Sbox[tmp2]; - tmp3 = Sbox[tmp3]; - } - - expkey[4*idx+0] = expkey[4*idx - 4*Nk + 0] ^ tmp0; - expkey[4*idx+1] = expkey[4*idx - 4*Nk + 1] ^ tmp1; - expkey[4*idx+2] = expkey[4*idx - 4*Nk + 2] ^ tmp2; - expkey[4*idx+3] = expkey[4*idx - 4*Nk + 3] ^ tmp3; - } -} - -// encrypt one 128 bit block -void Encrypt (uchar *in, uchar *expkey, uchar *out) -{ -uchar state[Nb * 4]; -unsigned round; - - memcpy (state, in, Nb * 4); - AddRoundKey ((unsigned *)state, (unsigned *)expkey); - - for( round = 1; round < Nr + 1; round++ ) { - if( round < Nr ) - MixSubColumns (state); - else - ShiftRows (state); - - AddRoundKey ((unsigned *)state, (unsigned *)expkey + round * Nb); - } - - memcpy (out, state, sizeof(state)); -} - -void Decrypt (uchar *in, uchar *expkey, uchar *out) -{ -uchar state[Nb * 4]; -unsigned round; - - memcpy (state, in, sizeof(state)); - - AddRoundKey ((unsigned *)state, (unsigned *)expkey + Nr * Nb); - InvShiftRows(state); - - for( round = Nr; round--; ) - { - AddRoundKey ((unsigned *)state, (unsigned *)expkey + round * Nb); - if( round ) - InvMixSubColumns (state); - } - - memcpy (out, state, sizeof(state)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/aes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -// advanced encryption standard -// author: karl malbrain, malbrain@yahoo.com - -/* -This work, including the source code, documentation -and related data, is placed into the public domain. - -The orginal author is Karl Malbrain. - -THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY -OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF -MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, -ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE -RESULTING FROM THE USE, MODIFICATION, OR -REDISTRIBUTION OF THIS SOFTWARE. -*/ - - -#ifndef AES_MALBRAIN -#define AES_MALBRAIN - - -// AES only supports Nb=4 -#define Nb 4 // number of columns in the state & expanded key - -#define Nk 4 // number of columns in a key -#define Nr 10 // number of rounds in encryption - - -typedef unsigned char uchar; - - -void ExpandKey (uchar *key, uchar *expkey); -void Encrypt (uchar *in, uchar *expkey, uchar *out); -void Decrypt (uchar *in, uchar *expkey, uchar *out); - - -#endif /* AES_MALBRAIN */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,658 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle chunked data (multimedia messages) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" -#include "protocol.h" -#include "mxit.h" -#include "chunk.h" -#include "filexfer.h" - - -/*======================================================================================================================== - * Data-Type encoding - */ - -#if 0 -#include -#if (__BYTE_ORDER == __BIG_ENDIAN) -#define SWAP_64(x) (x) -#else -#define SWAP_64(x) bswap_64(x) -#endif -#endif - -/*------------------------------------------------------------------------ - * Encode a single byte in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The byte - * @return The number of bytes added. - */ -static int add_int8( char* chunkdata, char value ) -{ - *chunkdata = value; - - return sizeof( char ); -} - -/*------------------------------------------------------------------------ - * Encode a 16-bit value in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 16-bit value - * @return The number of bytes added. - */ -static int add_int16( char* chunkdata, short value ) -{ - value = htons( value ); /* network byte-order */ - memcpy( chunkdata, &value, sizeof( short ) ); - - return sizeof( short ); -} - -/*------------------------------------------------------------------------ - * Encode a 32-bit value in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 32-bit value - * @return The number of bytes added. - */ -static int add_int32( char* chunkdata, int value ) -{ - value = htonl( value ); /* network byte-order */ - memcpy( chunkdata, &value, sizeof( int ) ); - - return sizeof( int ); -} - -#if 0 -/*------------------------------------------------------------------------ - * Encode a 64-bit value in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 64-bit value - * @return The number of bytes added. - */ -static int add_int64( char* chunkdata, int64_t value ) -{ - value = SWAP_64( value ); /* network byte-order */ - memcpy( chunkdata, &value, sizeof( int64_t ) ); - - return sizeof( int64_t ); -} -#endif - -/*------------------------------------------------------------------------ - * Encode a block of data in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param data The data to add - * @param datalen The length of the data to add - * @return The number of bytes added. - */ -static int add_data( char* chunkdata, const char* data, int datalen ) -{ - memcpy( chunkdata, data, datalen ); - - return datalen; -} - -/*------------------------------------------------------------------------ - * Encode a string as UTF-8 in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param str The string to encode - * @return The number of bytes in the string - */ -static int add_utf8_string( char* chunkdata, const char* str ) -{ - int pos = 0; - size_t len = strlen( str ); - - /* utf8 string length [2 bytes] */ - pos += add_int16( &chunkdata[pos], len ); - - /* utf8 string */ - pos += add_data( &chunkdata[pos], str, len ); - - return pos; -} - - -/*======================================================================================================================== - * Data-Type decoding - */ - -/*------------------------------------------------------------------------ - * Extract a single byte from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The byte - * @return The number of bytes extracted. - */ -static int get_int8( const char* chunkdata, char* value ) -{ - *value = *chunkdata; - - return sizeof( char ); -} - -/*------------------------------------------------------------------------ - * Extract a 16-bit value from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 16-bit value - * @return The number of bytes extracted - */ -static int get_int16( const char* chunkdata, short* value ) -{ - *value = ntohs( *( (const short*) chunkdata ) ); /* host byte-order */ - - return sizeof( short ); -} - -/*------------------------------------------------------------------------ - * Extract a 32-bit value from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 32-bit value - * @return The number of bytes extracted - */ -static int get_int32( const char* chunkdata, int* value ) -{ - *value = ntohl( *( (const int*) chunkdata ) ); /* host byte-order */ - - return sizeof( int ); -} - -#if 0 -/*------------------------------------------------------------------------ - * Extract a 64-bit value from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 64-bit value - * @return The number of bytes extracted - */ -static int get_int64( const char* chunkdata, int64_t* value ) -{ - *value = SWAP_64( *( (const int64_t*) chunkdata ) ); /* host byte-order */ - - return sizeof( int64_t ); -} -#endif - -/*------------------------------------------------------------------------ - * Copy a block of data from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param dest Where to store the extract data - * @param datalen The length of the data to extract - * @return The number of bytes extracted - */ -static int get_data( const char* chunkdata, char* dest, int datalen ) -{ - memcpy( dest, chunkdata, datalen ); - - return datalen; -} - -/*------------------------------------------------------------------------ - * Extract a UTF-8 encoded string from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param str A pointer to extracted string. Must be g_free()'d. - * @return The number of bytes consumed - */ -static int get_utf8_string( const char* chunkdata, char* str, int maxstrlen ) -{ - int pos = 0; - short len; - int skip = 0; - - /* string length [2 bytes] */ - pos += get_int16( &chunkdata[pos], &len ); - - if ( len > maxstrlen ) { - /* possible buffer overflow */ - purple_debug_error( MXIT_PLUGIN_ID, "Buffer overflow detected (get_utf8_string)\n" ); - skip = len - maxstrlen; - len = maxstrlen; - } - - /* string data */ - pos += get_data( &chunkdata[pos], str, len ); - str[len] = '\0'; /* terminate string */ - - return pos + skip; -} - - -/*======================================================================================================================== - * Chunked Data encoding - */ - -/*------------------------------------------------------------------------ - * Encode a "reject file" chunk. (Chunk type 7) - * - * @param chunkdata Chunked-data buffer - * @param fileid A unique ID that identifies this file - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_reject( char* chunkdata, const char* fileid ) -{ - int pos = 0; - - /* file id [8 bytes] */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* rejection reason [1 byte] */ - pos += add_int8( &chunkdata[pos], REJECT_BY_USER ); - - /* rejection description [UTF-8 (optional)] */ - pos += add_utf8_string( &chunkdata[pos], "" ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "get file" request chunk. (Chunk type 8) - * - * @param chunkdata Chunked-data buffer - * @param fileid A unique ID that identifies this file - * @param filesize The number of bytes to retrieve - * @param offset The start offset in the file - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_get( char* chunkdata, const char* fileid, int filesize, int offset ) -{ - int pos = 0; - - /* file id [8 bytes] */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* offset [4 bytes] */ - pos += add_int32( &chunkdata[pos], offset ); - - /* length [4 bytes] */ - pos += add_int32( &chunkdata[pos], filesize ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "received file" chunk. (Chunk type 9) - * - * @param chunkdata Chunked-data buffer - * @param fileid A unique ID that identifies this file - * @param status The status of the file transfer (see chunk.h) - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status ) -{ - int pos = 0; - - /* file id [8 bytes] */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* status [1 byte] */ - pos += add_int8( &chunkdata[pos], status ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "send file direct" chunk. (Chunk type 10) - * - * @param chunkdata Chunked-data buffer - * @param username The username of the recipient - * @param filename The name of the file being sent - * @param data The file contents - * @param datalen The size of the file contents - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen ) -{ - int pos = 0; - const char* mime = NULL; - - /* data length [4 bytes] */ - pos += add_int32( &chunkdata[pos], datalen ); - - /* number of username(s) [2 bytes] */ - pos += add_int16( &chunkdata[pos], 1 ); - - /* username(s) [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], username ); - - /* filename [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], filename ); - - /* file mime type [UTF-8] */ - mime = file_mime_type( filename, (const char*) data, datalen ); - pos += add_utf8_string( &chunkdata[pos], mime ); - - /* human readable description [UTF-8 (optional)] */ - pos += add_utf8_string( &chunkdata[pos], "" ); - - /* crc [4 bytes] (0 = optional) */ - pos += add_int32( &chunkdata[pos], 0 ); - - /* the actual file data */ - pos += add_data( &chunkdata[pos], (const char *) data, datalen ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "set avatar" chunk. (Chunk type 13) - * - * @param chunkdata Chunked-data buffer - * @param data The avatar data - * @param datalen The size of the avatar data - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen ) -{ - const char fileid[MXIT_CHUNK_FILEID_LEN]; - int pos = 0; - - /* id [8 bytes] */ - memset( &fileid, 0, sizeof( fileid ) ); /* set to 0 for file upload */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* size [4 bytes] */ - pos += add_int32( &chunkdata[pos], datalen ); - - /* crc [4 bytes] (0 = optional) */ - pos += add_int32( &chunkdata[pos], 0 ); - - /* the actual file data */ - pos += add_data( &chunkdata[pos], (const char *) data, datalen ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "get avatar" chunk. (Chunk type 14) - * - * @param chunkdata Chunked-data buffer - * @param mxitId The username who's avatar to download - * @param avatarId The Id of the avatar image (as string) - * @param imgsize The resolution of the avatar image - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId, unsigned int imgsize ) -{ - int pos = 0; - - /* number of avatars [4 bytes] */ - pos += add_int32( &chunkdata[pos], 1 ); - - /* username [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], mxitId ); - - /* avatar id [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], avatarId ); - - /* avatar format [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], MXIT_AVATAR_TYPE ); - - /* avatar bit depth [1 byte] */ - pos += add_int8( &chunkdata[pos], MXIT_AVATAR_BITDEPT ); - - /* number of sizes [2 bytes] */ - pos += add_int16( &chunkdata[pos], 1 ); - - /* image size [4 bytes] */ - pos += add_int32( &chunkdata[pos], imgsize ); - - return pos; -} - - -/*======================================================================================================================== - * Chunked Data decoding - */ - -/*------------------------------------------------------------------------ - * Parse a received "offer file" chunk. (Chunk 6) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param offer Decoded offerfile information - */ -void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer ) -{ - int pos = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_offer (%i bytes)\n", datalen ); - - /* id [8 bytes] */ - pos += get_data( &chunkdata[pos], offer->fileid, 8); - - /* from username [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], offer->username, sizeof( offer->username ) ); - mxit_strip_domain( offer->username ); - - /* file size [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(offer->filesize) ); - - /* filename [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], offer->filename, sizeof( offer->filename) ); - - /* mime type [UTF-8] */ - /* not used by libPurple */ - - /* timestamp [8 bytes] */ - /* not used by libPurple */ - - /* file description [UTF-8] */ - /* not used by libPurple */ - - /* file alternative [UTF-8] */ - /* not used by libPurple */ - - /* flags [4 bytes] */ - /* not used by libPurple */ -} - - -/*------------------------------------------------------------------------ - * Parse a received "get file" response chunk. (Chunk 8) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param offer Decoded getfile information - */ -void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile ) -{ - int pos = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_file (%i bytes)\n", datalen ); - - /* id [8 bytes] */ - pos += get_data( &chunkdata[pos], getfile->fileid, 8 ); - - /* offset [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(getfile->offset) ); - - /* file length [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(getfile->length) ); - - /* crc [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(getfile->crc) ); - - /* file data */ - getfile->data = &chunkdata[pos]; -} - - -/*------------------------------------------------------------------------ - * Parse a received splash screen chunk. (Chunk 2) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param splash Decoded splash image information - */ -static void mxit_chunk_parse_splash( char* chunkdata, int datalen, struct splash_chunk* splash ) -{ - int pos = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_splash (%i bytes)\n", datalen ); - - /* anchor [1 byte] */ - pos += get_int8( &chunkdata[pos], &(splash->anchor) ); - - /* time to show [1 byte] */ - pos += get_int8( &chunkdata[pos], &(splash->showtime) ); - - /* background color [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(splash->bgcolor) ); - - /* file data */ - splash->data = &chunkdata[pos]; - - /* data length */ - splash->datalen = datalen - pos; -} - - -/*------------------------------------------------------------------------ - * Parse a received "custom resource" chunk. (Chunk 1) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param offer Decoded custom resource - */ -void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr ) -{ - int pos = 0; - int chunklen = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_cr (%i bytes)\n", datalen ); - - /* id [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], cr->id, sizeof( cr->id ) ); - - /* handle [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], cr->handle, sizeof( cr->handle ) ); - - /* operation [1 byte] */ - pos += get_int8( &chunkdata[pos], &(cr->operation) ); - - /* chunk size [4 bytes] */ - pos += get_int32( &chunkdata[pos], &chunklen ); - - /* parse the resource chunks */ - while ( chunklen > 0 ) { - gchar* chunk = &chunkdata[pos]; - - /* start of chunk data */ - pos += MXIT_CHUNK_HEADER_SIZE; - - switch ( chunk_type( chunk ) ) { - case CP_CHUNK_SPLASH : /* splash image */ - { - struct splash_chunk* splash = g_new0( struct splash_chunk, 1 ); - - mxit_chunk_parse_splash( &chunkdata[pos], chunk_length( chunk ), splash ); - - cr->resources = g_list_append( cr->resources, splash ); - break; - } - case CP_CHUNK_CLICK : /* splash click */ - { - struct splash_click_chunk* click = g_new0( struct splash_click_chunk, 1 ); - - cr->resources = g_list_append( cr->resources, click ); - break; - } - default: - purple_debug_info( MXIT_PLUGIN_ID, "Unsupported custom resource chunk received (%i)\n", chunk_type( chunk) ); - } - - /* skip over data to next resource chunk */ - pos += chunk_length( chunk ); - chunklen -= ( MXIT_CHUNK_HEADER_SIZE + chunk_length( chunk ) ); - } -} - - -/*------------------------------------------------------------------------ - * Parse a received "get avatar" response chunk. (Chunk 14) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param avatar Decoded avatar information - */ -void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar ) -{ - int pos = 0; - int numfiles = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_get_avatar (%i bytes)\n", datalen ); - - /* number of files [4 bytes] */ - pos += get_int32( &chunkdata[pos], &numfiles ); - - if ( numfiles < 1 ) /* no data */ - return; - - /* mxitId [UTF-8 string] */ - pos += get_utf8_string( &chunkdata[pos], avatar->mxitid, sizeof( avatar->mxitid ) ); - - /* avatar id [UTF-8 string] */ - pos += get_utf8_string( &chunkdata[pos], avatar->avatarid, sizeof( avatar->avatarid ) ); - - /* format [UTF-8 string] */ - pos += get_utf8_string( &chunkdata[pos], avatar->format, sizeof( avatar->format ) ); - - /* bit depth [1 byte] */ - pos += get_int8( &chunkdata[pos], &(avatar->bitdepth) ); - - /* crc [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->crc) ); - - /* width [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->width) ); - - /* height [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->height) ); - - /* file length [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->length) ); - - /* file data */ - avatar->data = &chunkdata[pos]; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/chunk.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle chunked data (multimedia messages) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_CHUNK_H_ -#define _MXIT_CHUNK_H_ - - -#include "roster.h" - - -#define MXIT_CHUNK_FILEID_LEN 8 /* bytes */ -#define MXIT_CHUNK_HEADER_SIZE 5 /* type (1 byte) + length (4 bytes) */ - - -/* Multimedia chunk types */ -#define CP_CHUNK_NONE 0x00 /* (0) no chunk */ -#define CP_CHUNK_CUSTOM 0x01 /* (1) custom resource */ -#define CP_CHUNK_SPLASH 0x02 /* (2) splash image */ -#define CP_CHUNK_CLICK 0x03 /* (3) splash click through */ -#define CP_CHUNK_OFFER 0x06 /* (6) offer file */ -#define CP_CHUNK_REJECT 0x07 /* (7) reject file */ -#define CP_CHUNK_GET 0x08 /* (8) get file */ -#define CP_CHUNK_RECIEVED 0x09 /* (9) received file */ -#define CP_CHUNK_DIRECT_SND 0x0A /* (10) send file direct */ -#define CP_CHUNK_DIRECT_FWD 0x0B /* (11) forward file direct */ -#define CP_CHUNK_SKIN 0x0C /* (12) MXit client skin */ -#define CP_CHUNK_SET_AVATAR 0x0D /* (13) set avatar */ -#define CP_CHUNK_GET_AVATAR 0x0E /* (14) get avatar */ -#define CP_CHUNK_END 0x7E /* (126) end */ -#define CP_CHUNK_EXT 0x7F /* (127) extended type */ - - -/* Custom Resource operations */ -#define CR_OP_UPDATE 0 -#define CR_OP_REMOVE 1 - -/* File Received status */ -#define RECV_STATUS_SUCCESS 0 -#define RECV_STATUS_PARSE_FAIL 1 -#define RECV_STATUS_CANNOT_OPEN 8 -#define RECV_STATUS_BAD_CRC 9 -#define RECV_STATUS_BAD_ID 10 - -/* File Reject status */ -#define REJECT_BY_USER 1 -#define REJECT_FILETYPE 2 -#define REJECT_NO_RESOURCES 3 -#define REJECT_BAD_RECIPIENT 4 - -/* - * Chunk header manipulation functions - */ -static inline guint chunk_type( gchar* chunkheader ) -{ - return *chunkheader; -} - -static inline void set_chunk_type( gchar* chunkheader, guint type ) -{ - *chunkheader = type; -} - -static inline guint32 chunk_length( gchar* chunkheader ) -{ - guint32 length = *( (const guint32*) &chunkheader[1] ); - return htonl( length ); -} - -static inline void set_chunk_length( gchar* chunkheader, guint32 size ) -{ - size = htonl( size ); - memcpy( &chunkheader[1], &size, sizeof( guint32 ) ); -} - -static inline gchar* chunk_data( gchar* chunkheader ) -{ - return &chunkheader[MXIT_CHUNK_HEADER_SIZE]; -} - - -struct offerfile_chunk { - char fileid[MXIT_CHUNK_FILEID_LEN]; - char username[MXIT_CP_MAX_JID_LEN + 1]; - int filesize; - char filename[FILENAME_MAX]; -}; - -struct getfile_chunk { - char fileid[MXIT_CHUNK_FILEID_LEN]; - int offset; - int length; - int crc; - char* data; -}; - -struct cr_chunk { - char id[64]; - char handle[64]; - char operation; - GList* resources; -}; - -struct splash_chunk { - char anchor; - char showtime; - int bgcolor; - char* data; - int datalen; -}; - -struct splash_click_chunk { - char reserved[1]; -}; - -struct getavatar_chunk { - char mxitid[50]; - char avatarid[64]; - char format[16]; - char bitdepth; - int crc; - int width; - int height; - int length; - char* data; -}; - -/* Encode chunk */ -int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen ); -int mxit_chunk_create_reject( char* chunkdata, const char* fileid ); -int mxit_chunk_create_get( char* chunkdata, const char* fileid, int filesize, int offset ); -int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status ); -int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen ); -int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId, unsigned int imgsize ); - -/* Decode chunk */ -void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer ); -void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile ); -void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr ); -void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar ); - -#endif /* _MXIT_CHUNK_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user password encryption -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" - -#include "mxit.h" -#include "cipher.h" -#include "aes.h" - - -/* password encryption */ -#define INITIAL_KEY "6170383452343567" -#define SECRET_HEADER "" - - -/*------------------------------------------------------------------------ - * Pad the secret data using ISO10126 Padding. - * - * @param secret The data to pad (caller must ensure buffer has enough space for padding) - * @return The total number of 128-bit blocks used - */ -static int pad_secret_data( char* secret ) -{ - int blocks = 0; - int passlen; - int padding; - - passlen = strlen( secret ); - blocks = ( passlen / 16 ) + 1; - padding = ( blocks * 16 ) - passlen; - secret[passlen] = 0x50; - secret[(blocks * 16) - 1] = padding; - - return blocks; -} - - -/*------------------------------------------------------------------------ - * Encrypt the user's cleartext password using the AES 128-bit (ECB) - * encryption algorithm. - * - * @param session The MXit session object - * @return The encrypted & encoded password. Must be g_free'd when no longer needed. - */ -char* mxit_encrypt_password( struct MXitSession* session ) -{ - char key[64]; - char exkey[512]; - char pass[64]; - char encrypted[64]; - char* base64; - int blocks; - int size; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_encrypt_password\n" ); - - memset( encrypted, 0x00, sizeof( encrypted ) ); - memset( exkey, 0x00, sizeof( exkey ) ); - memset( pass, 0x58, sizeof( pass ) ); - pass[sizeof( pass ) - 1] = '\0'; - - /* build the custom AES encryption key */ - strcpy( key, INITIAL_KEY ); - memcpy( key, session->clientkey, strlen( session->clientkey ) ); - ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); - - /* build the custom data to be encrypted */ - strcpy( pass, SECRET_HEADER ); - strcat( pass, session->acc->password ); - - /* pad the secret data */ - blocks = pad_secret_data( pass ); - size = blocks * 16; - - /* now encrypt the password. we encrypt each block separately (ECB mode) */ - for ( i = 0; i < size; i += 16 ) - Encrypt( (unsigned char*) pass + i, (unsigned char*) exkey, (unsigned char*) encrypted + i ); - - /* now base64 encode the encrypted password */ - base64 = purple_base64_encode( (unsigned char*) encrypted, size ); - - return base64; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/cipher.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user password encryption -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_CIPHER_H_ -#define _MXIT_CIPHER_H_ - - -struct MXitSession; - - -char* mxit_encrypt_password( struct MXitSession* session ); - - -#endif /* _MXIT_CIPHER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,454 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- file transfers (sending and receiving) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" -#include "protocol.h" -#include "mxit.h" -#include "chunk.h" -#include "filexfer.h" - - -#define MIME_TYPE_OCTETSTREAM "application/octet-stream" - - -/* supported file mime types */ -static struct mime_type { - const char* magic; - const short magic_len; - const char* mime; -} const mime_types[] = { - /* magic length mime */ - /* images */ { "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8, "image/png" }, /* image png */ - { "\xFF\xD8", 2, "image/jpeg" }, /* image jpeg */ - { "\x3C\x3F\x78\x6D\x6C", 5, "image/svg+xml" }, /* image SVGansi */ - { "\xEF\xBB\xBF", 3, "image/svg+xml" }, /* image SVGutf */ - { "\xEF\xBB\xBF", 3, "image/svg+xml" }, /* image SVGZ */ - /* mxit */ { "\x4d\x58\x4d", 3, "application/mxit-msgs" }, /* mxit message */ - { "\x4d\x58\x44\x01", 4, "application/mxit-mood" }, /* mxit mood */ - { "\x4d\x58\x45\x01", 4, "application/mxit-emo" }, /* mxit emoticon */ - { "\x4d\x58\x46\x01", 4, "application/mxit-emof" }, /* mxit emoticon frame */ - { "\x4d\x58\x53\x01", 4, "application/mxit-skin" }, /* mxit skin */ - /* audio */ { "\x4d\x54\x68\x64", 4, "audio/midi" }, /* audio midi */ - { "\x52\x49\x46\x46", 4, "audio/wav" }, /* audio wav */ - { "\xFF\xF1", 2, "audio/aac" }, /* audio aac1 */ - { "\xFF\xF9", 2, "audio/aac" }, /* audio aac2 */ - { "\xFF", 1, "audio/mp3" }, /* audio mp3 */ - { "\x23\x21\x41\x4D\x52\x0A", 6, "audio/amr" }, /* audio AMR */ - { "\x23\x21\x41\x4D\x52\x2D\x57\x42", 8, "audio/amr-wb" }, /* audio AMR WB */ - { "\x00\x00\x00", 3, "audio/mp4" }, /* audio mp4 */ - { "\x2E\x73\x6E\x64", 4, "audio/au" } /* audio AU */ -}; - - -/*------------------------------------------------------------------------ - * Return the MIME type matching the data file. - * - * @param filename The name of file - * @param buf The data - * @param buflen The length of the data - * @return A MIME type string - */ -const char* file_mime_type( const char* filename, const char* buf, int buflen ) -{ - unsigned int i; - - /* check for matching magic headers */ - for ( i = 0; i < ARRAY_SIZE( mime_types ); i++ ) { - - if ( buflen < mime_types[i].magic_len ) /* data is shorter than size of magic */ - continue; - - if ( memcmp( buf, mime_types[i].magic, mime_types[i].magic_len ) == 0 ) - return mime_types[i].mime; - } - - /* we did not find the MIME type, so return the default (application/octet-stream) */ - return MIME_TYPE_OCTETSTREAM; -} - - -/*------------------------------------------------------------------------ - * Cleanup and deallocate a MXit file transfer object - * - * @param xfer The file transfer object - */ -static void mxit_xfer_free( PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data;; - - if ( mx ) { - g_free( mx ); - xfer->data = NULL; - } -} - - -/*======================================================================================================================== - * File Transfer callbacks - */ - -/*------------------------------------------------------------------------ - * Initialise a new file transfer. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_init( PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_init\n" ); - - if ( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) { - /* we are trying to send a file to MXit */ - - if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) { - /* the file is too big */ - purple_xfer_error( xfer->type, xfer->account, xfer->who, _( "The file you are trying to send is too large!" ) ); - purple_xfer_cancel_local( xfer ); - return; - } - - /* start the file transfer */ - purple_xfer_start( xfer, -1, NULL, 0 ); - } - else { - /* - * we have just accepted a file transfer request from MXit. send a confirmation - * to the MXit server so that can send us the file - */ - mxit_send_file_accept( mx->session, mx->fileid, purple_xfer_get_size( xfer ), 0 ); - } -} - - -/*------------------------------------------------------------------------ - * Start the file transfer. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_start( PurpleXfer* xfer ) -{ - unsigned char* buffer; - int size; - int wrote; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_start\n" ); - - if ( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) { - /* - * the user wants to send a file to one of his contacts. we need to create - * a buffer and copy the file data into memory and then we can send it to - * the contact. we will send the whole file with one go. - */ - buffer = g_malloc( xfer->bytes_remaining ); - size = fread( buffer, xfer->bytes_remaining, 1, xfer->dest_fp ); - - wrote = purple_xfer_write( xfer, buffer, xfer->bytes_remaining ); - if ( wrote > 0 ) - purple_xfer_set_bytes_sent( xfer, wrote ); - - /* free the buffer */ - g_free( buffer ); - buffer = NULL; - } -} - - -/*------------------------------------------------------------------------ - * The file transfer has ended. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_end( PurpleXfer* xfer ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_end\n" ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*------------------------------------------------------------------------ - * The file transfer (to a user) has been cancelled. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_cancel_send( PurpleXfer* xfer ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_cancel_send\n" ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*------------------------------------------------------------------------ - * Send the file data. - * - * @param buffer The data to sent - * @param size The length of the data to send - * @param xfer The file transfer object - * @return The amount of data actually sent - */ -static gssize mxit_xfer_write( const guchar* buffer, size_t size, PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_write\n" ); - - if ( !mx ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_xfer_write: invalid internal mxit xfer data\n" ); - return -1; - } - else if ( purple_xfer_get_type( xfer ) != PURPLE_XFER_SEND ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_xfer_write: wrong xfer type received\n" ); - return -1; - } - - /* create and send the packet to MXit */ - mxit_send_file( mx->session, purple_xfer_get_remote_user( xfer ), purple_xfer_get_filename( xfer ), buffer, size ); - - /* the transfer is complete */ - purple_xfer_set_completed( xfer, TRUE ); - - return size; -} - - -/*------------------------------------------------------------------------ - * The user has rejected a file offer from MXit. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_request_denied( PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_request_denied\n" ); - - /* send file reject packet to MXit server */ - mxit_send_file_reject( mx->session, mx->fileid ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*------------------------------------------------------------------------ - * The file transfer (from MXit) has been cancelled. - */ -static void mxit_xfer_cancel_recv( PurpleXfer* xfer ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_cancel_recv\n" ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*======================================================================================================================== - * Callbacks from libPurple - */ - -/*------------------------------------------------------------------------ - * Indicate if file transfers are supported to this contact. - * For MXit file transfers are always supported. - * - * @param gc The connection object - * @param who The username of the contact - * @return TRUE if file transfers are supported - */ -gboolean mxit_xfer_enabled( PurpleConnection* gc, const char* who ) -{ - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Create and initialize a new file transfer to a contact. - * - * @param gc The connection object - * @param who The username of the recipient - */ -PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; - - /* (reference: "libpurple/ft.h") */ - xfer = purple_xfer_new( session->acc, PURPLE_XFER_SEND, who ); - - /* create file info and attach it to the file transfer */ - mx = g_new0( struct mxitxfer, 1 ); - mx->session = session; - xfer->data = mx; - - /* configure callbacks (reference: "libpurple/ft.h") */ - purple_xfer_set_init_fnc( xfer, mxit_xfer_init ); - purple_xfer_set_start_fnc( xfer, mxit_xfer_start ); - purple_xfer_set_end_fnc( xfer, mxit_xfer_end ); - purple_xfer_set_cancel_send_fnc( xfer, mxit_xfer_cancel_send ); - purple_xfer_set_write_fnc( xfer, mxit_xfer_write ); - - return xfer; -} - - -/*------------------------------------------------------------------------ - * The user has initiated a file transfer to a contact. - * - * @param gc The connection object - * @param who The username of the contact - * @param filename The filename (is NULL if request has not been accepted yet) - */ -void mxit_xfer_tx( PurpleConnection* gc, const char* who, const char* filename ) -{ - PurpleXfer *xfer = mxit_xfer_new( gc, who ); - - if ( filename ) - purple_xfer_request_accepted( xfer, filename ); - else - purple_xfer_request( xfer ); -} - - -/*======================================================================================================================== - * Calls from the MXit Protocol layer - */ - -/*------------------------------------------------------------------------ - * A file transfer offer has been received from the MXit server. - * - * @param session The MXit session object - * @param usermame The username of the sender - * @param filename The name of the file being offered - * @param filesize The size of the file being offered - * @param fileid A unique ID that identifies this file - */ -void mxit_xfer_rx_offer( struct MXitSession* session, const char* username, const char* filename, int filesize, const char* fileid ) -{ - PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "File Offer: file=%s, from=%s, size=%i\n", filename, username, filesize ); - - xfer = purple_xfer_new( session->acc, PURPLE_XFER_RECEIVE, username ); - if ( xfer ) { - /* create a new mxit xfer struct for internal use */ - mx = g_new0( struct mxitxfer, 1 ); - mx->session = session; - memcpy( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ); - xfer->data = mx; - - purple_xfer_set_filename( xfer, filename ); - if( filesize > 0 ) - purple_xfer_set_size( xfer, filesize ); - - /* register file transfer callback functions */ - purple_xfer_set_init_fnc( xfer, mxit_xfer_init ); - purple_xfer_set_request_denied_fnc( xfer, mxit_xfer_request_denied ); - purple_xfer_set_cancel_recv_fnc( xfer, mxit_xfer_cancel_recv ); - purple_xfer_set_end_fnc( xfer, mxit_xfer_end ); - - /* give the request to the user to accept/deny */ - purple_xfer_request( xfer ); - } -} - - -/*------------------------------------------------------------------------ - * Return the libPurple file-transfer object associated with a MXit transfer - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - */ -static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* fileid ) -{ - GList* item = NULL; - PurpleXfer* xfer = NULL; - - item = purple_xfers_get_all(); /* list of all active transfers */ - while ( item ) { - xfer = item->data; - - if ( xfer->account == session->acc ) { - /* transfer is associated with this MXit account */ - struct mxitxfer* mx = xfer->data; - - /* does the fileid match? */ - if ( ( mx ) && ( memcmp( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ) == 0 ) ) - break; - } - - item = g_list_next( item ); - } - - if ( item ) - return item->data; - else - return NULL; -} - -/*------------------------------------------------------------------------ - * A file has been received from the MXit server. - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - * @param data The file data - * @param datalen The size of the data - */ -void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const char* data, int datalen ) -{ - PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_rx_file: (size=%i)\n", datalen ); - - /* find the file-transfer object */ - xfer = find_mxit_xfer( session, fileid ); - if ( xfer ) { - mx = xfer->data; - - /* this is the transfer we have been looking for */ - purple_xfer_ref( xfer ); - purple_xfer_start( xfer, -1, NULL, 0 ); - fwrite( data, datalen, 1, xfer->dest_fp ); - purple_xfer_unref( xfer ); - purple_xfer_set_completed( xfer, TRUE ); - purple_xfer_end( xfer ); - - /* inform MXit that file was successfully received */ - mxit_send_file_received( session, fileid, RECV_STATUS_SUCCESS ); - } - else { - /* file transfer not found */ - mxit_send_file_received( session, fileid, RECV_STATUS_BAD_ID ); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/filexfer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- file transfers (sending and receiving) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_FILEXFER_H_ -#define _MXIT_FILEXFER_H_ - - -/* - * a MXit file transfer - */ -struct mxitxfer { - struct MXitSession* session; - char fileid[MXIT_CHUNK_FILEID_LEN]; -}; - -const char* file_mime_type( const char* filename, const char* buf, int buflen ); - -/* libPurple callbacks */ -gboolean mxit_xfer_enabled( PurpleConnection* gc, const char* who ); -void mxit_xfer_tx( PurpleConnection* gc, const char* who, const char* filename ); -PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ); - -/* MXit Protocol callbacks */ -void mxit_xfer_rx_offer( struct MXitSession* session, const char* username, const char* filename, int filesize, const char* fileid ); -void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const char* data, int datalen ); - - -#endif /* _MXIT_FILEXFER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,394 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit Forms & Commands -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "markup.h" -#include "formcmds.h" - -#undef MXIT_DEBUG_COMMANDS - -/* - * the MXit Command identifiers - */ -typedef enum -{ - MXIT_CMD_UNKNOWN = 0, /* Unknown command */ - MXIT_CMD_CLRSCR, /* Clear screen (clrmsgscreen) */ - MXIT_CMD_SENDSMS, /* Send SMS (sendsms) */ - MXIT_CMD_REPLY, /* Reply (reply) */ - MXIT_CMD_PLATREQ, /* Platform Request (platreq) */ - MXIT_CMD_SELECTCONTACT, /* Select Contact (selc) */ - MXIT_CMD_IMAGE /* Inline image (img) */ -} MXitCommandType; - - -/* - * object for an inline image request with an URL - */ -struct ii_url_request -{ - struct RXMsgData* mx; - char* url; -}; - - -/*------------------------------------------------------------------------ - * Callback function invoked when an inline image request to a web site completes. - * - * @param url_data - * @param user_data The Markup message object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message) -{ - struct ii_url_request* iireq = (struct ii_url_request*) user_data; - char* ii_data; - int* intptr = NULL; - int id; - -#ifdef MXIT_DEBUG_COMMANDS - purple_debug_info(MXIT_PLUGIN_ID, "Inline Image returned from %s\n", iireq->url); -#endif - - if (!url_text) { - /* no reply from the WAP site */ - purple_debug_error(MXIT_PLUGIN_ID, "Error downloading Inline Image from %s.\n", iireq->url); - goto done; - } - - /* lets first see if we dont have the inline image already in cache */ - if (g_hash_table_lookup(iireq->mx->session->iimages, iireq->url)) { - /* inline image found in the cache, so we just ignore this reply */ - goto done; - } - - /* make a copy of the data */ - ii_data = g_malloc(len); - memcpy(ii_data, (const char*) url_text, len); - - /* we now have the inline image, store it in the imagestore */ - id = purple_imgstore_add_with_id(ii_data, len, NULL); - - /* map the inline image id to purple image id */ - intptr = g_malloc(sizeof(int)); - *intptr = id; - g_hash_table_insert(iireq->mx->session->iimages, iireq->url, intptr); - - iireq->mx->flags |= PURPLE_MESSAGE_IMAGES; - -done: - iireq->mx->img_count--; - if ((iireq->mx->img_count == 0) && (iireq->mx->converted)) { - /* - * this was the last outstanding emoticon for this message, - * so we can now display it to the user. - */ - mxit_show_message(iireq->mx); - } - - g_free(iireq); -} - - -/*------------------------------------------------------------------------ - * Return the command identifier of this MXit Command. - * - * @param cmd The MXit command map - * @return The MXit command identifier - */ -static MXitCommandType command_type(GHashTable* hash) -{ - char* op; - char* type; - - op = g_hash_table_lookup(hash, "op"); - if (op) { - if ( strcmp(op, "cmd") == 0 ) { - type = g_hash_table_lookup(hash, "type"); - if (type == NULL) /* no command provided */ - return MXIT_CMD_UNKNOWN; - else if (strcmp(type, "clrmsgscreen") == 0) /* clear the screen */ - return MXIT_CMD_CLRSCR; - else if (strcmp(type, "sendsms") == 0) /* send an SMS */ - return MXIT_CMD_SENDSMS; - else if (strcmp(type, "reply") == 0) /* list of options */ - return MXIT_CMD_REPLY; - else if (strcmp(type, "platreq") == 0) /* platform request */ - return MXIT_CMD_PLATREQ; - else if (strcmp(type, "selc") == 0) /* select contact */ - return MXIT_CMD_SELECTCONTACT; - } - else if (strcmp(op, "img") == 0) - return MXIT_CMD_IMAGE; - } - - return MXIT_CMD_UNKNOWN; -} - - -/*------------------------------------------------------------------------ - * Tokenize a MXit Command string into a map. - * - * @param cmd The MXit command string - * @return The hash-map, or NULL on error. - */ -static GHashTable* command_tokenize(char* cmd) -{ - GHashTable* hash = NULL; - gchar** parts; - gchar* part; - int i = 0; - -#ifdef MXIT_DEBUG_COMMANDS - purple_debug_info(MXIT_PLUGIN_ID, "command: '%s'\n", cmd); -#endif - - /* explode the command into parts */ - parts = g_strsplit(cmd, "|", 0); - - hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - /* now break part into a key & value */ - while ((part = parts[i]) != NULL) { - char* value; - - value = strchr(parts[i], '='); /* find start of value */ - if (value != NULL) { - *value = '\0'; - value++; - } - -#ifdef MXIT_DEBUG_COMMANDS - purple_debug_info(MXIT_PLUGIN_ID, " key='%s' value='%s'\n", parts[i], value); -#endif - - g_hash_table_insert(hash, g_strdup(parts[i]), g_strdup(value)); - - i++; - } - - g_strfreev(parts); - - return hash; -} - - -/*------------------------------------------------------------------------ - * Process a ClearScreen MXit command. - * - * @param session The MXit session object - * @param from The sender of the message. - */ -static void command_clearscreen(struct MXitSession* session, const char* from) -{ - PurpleConversation *conv; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, session->acc); - if (conv == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, _( "Conversation with '%s' not found\n" ), from); - return; - } - - purple_conversation_clear_message_history(conv); // TODO: This doesn't actually clear the screen. -} - - -/*------------------------------------------------------------------------ - * Process a Reply MXit command. - * - * @param mx The received message data object - * @param hash The MXit command map - */ -static void command_reply(struct RXMsgData* mx, GHashTable* hash) -{ - char* replymsg; - char* selmsg; - - selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */ - replymsg = g_hash_table_lookup(hash, "replymsg"); /* find the reply message */ - if ((selmsg) && (replymsg)) { - gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1); - - mxit_add_html_link( mx, purple_url_decode(replymsg), seltext ); - - g_free(seltext); - } -} - - -/*------------------------------------------------------------------------ - * Process a PlatformRequest MXit command. - * - * @param hash The MXit command map - * @param msg The message to display (as generated so far) - */ -static void command_platformreq(GHashTable* hash, GString* msg) -{ - gchar* text = NULL; - char* selmsg; - char* dest; - - selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */ - if (selmsg) { - text = g_markup_escape_text(purple_url_decode(selmsg), -1); - } - - dest = g_hash_table_lookup(hash, "dest"); /* find the destination */ - if (dest) { - g_string_append_printf(msg, "%s", purple_url_decode(dest), (text) ? text : _( "Download" )); /* add link to display message */ - } - - if (text) - g_free(text); -} - - -/*------------------------------------------------------------------------ - * Process an inline image MXit command. - * - * @param mx The received message data object - * @param hash The MXit command map - * @param msg The message to display (as generated so far) - */ -static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) -{ - const char* img; - const char* reply; - guchar* rawimg; - char link[256]; - gsize rawimglen; - int imgid; - - img = g_hash_table_lookup(hash, "dat"); - if (img) { - rawimg = purple_base64_decode(img, &rawimglen); - //purple_util_write_data_to_file_absolute("/tmp/mxitinline.png", (char*) rawimg, rawimglen); - imgid = purple_imgstore_add_with_id(rawimg, rawimglen, NULL); - g_snprintf(link, sizeof(link), "", imgid); - g_string_append_printf(msg, "%s", link); - mx->flags |= PURPLE_MESSAGE_IMAGES; - } - else { - img = g_hash_table_lookup(hash, "src"); - if (img) { - struct ii_url_request* iireq; - - iireq = g_new0(struct ii_url_request,1); - iireq->url = g_strdup(purple_url_decode(img)); - iireq->mx = mx; - - g_string_append_printf(msg, "%s%s>", MXIT_II_TAG, iireq->url); - mx->got_img = TRUE; - - /* lets first see if we dont have the inline image already in cache */ - if (g_hash_table_lookup(mx->session->iimages, iireq->url)) { - /* inline image found in the cache, so we do not have to request it from the web */ - g_free(iireq); - } - else { - /* send the request for the inline image */ - purple_debug_info(MXIT_PLUGIN_ID, "sending request for inline image '%s'\n", iireq->url); - - /* request the image (reference: "libpurple/util.h") */ - purple_util_fetch_url_request(iireq->url, TRUE, NULL, TRUE, NULL, FALSE, mxit_cb_ii_returned, iireq); - mx->img_count++; - } - } - } - - /* if this is a clickable image, show a click link */ - reply = g_hash_table_lookup(hash, "replymsg"); - if (reply) { - g_string_append_printf(msg, "\n"); - mxit_add_html_link(mx, reply, _( "click here" )); - } -} - - -/*------------------------------------------------------------------------ - * Process a received MXit Command message. - * - * @param mx The received message data object - * @param message The message text - * @return The length of the command - */ -int mxit_parse_command(struct RXMsgData* mx, char* message) -{ - GHashTable* hash = NULL; - char* start; - char* end; - - /* ensure that this is really a command */ - if ( ( message[0] != ':' ) || ( message[1] != ':' ) ) { - /* this is not a command */ - return 0; - } - - start = message + 2; - end = strstr(start, ":"); - if (end) { - /* end of a command found */ - *end = '\0'; /* terminate command string */ - - hash = command_tokenize(start); /* break into pairs */ - if (hash) { - MXitCommandType type = command_type(hash); - - switch (type) { - case MXIT_CMD_CLRSCR : - command_clearscreen(mx->session, mx->from); - break; - case MXIT_CMD_REPLY : - command_reply(mx, hash); - break; - case MXIT_CMD_PLATREQ : - command_platformreq(hash, mx->msg); - break; - case MXIT_CMD_IMAGE : - command_image(mx, hash, mx->msg); - break; - default : - /* command unknown, or not currently supported */ - break; - } - g_hash_table_destroy(hash); - } - *end = ':'; - - return end - message; - } - else { - return 0; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/formcmds.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit Forms & Commands -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_FORMCMDS_H_ -#define _MXIT_FORMCMDS_H_ - -#include "mxit.h" - - -int mxit_parse_command(struct RXMsgData* mx, char* message); - - -#endif /* _MXIT_FORMCMDS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,331 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include - -#include "purple.h" - -#include "mxit.h" -#include "protocol.h" -#include "http.h" - - -/* HTTP constants */ -#define HTTP_11_200_OK "HTTP/1.1 200 OK\r\n" -#define HTTP_11_100_CONT "HTTP/1.1 100 Continue\r\n" -#define HTTP_11_SEPERATOR "\r\n\r\n" -#define HTTP_CONTENT_LEN "Content-Length: " - - -/* define to enable HTTP debugging */ -#define DEBUG_HTTP - - -/*------------------------------------------------------------------------ - * This will freeup the memory used by a HTTP request structure - * - * @param req The HTTP structure's resources should be freed up - */ -static void free_http_request( struct http_request* req ) -{ - g_free( req->host ); - g_free( req->data ); - g_free( req ); -} - - -/*------------------------------------------------------------------------ - * Write the request to the HTTP server. - * - * @param fd The file descriptor - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static int mxit_http_raw_write( int fd, const char* pktdata, int pktlen ) -{ - int written; - int res; - - written = 0; - while ( written < pktlen ) { - res = write( fd, &pktdata[written], pktlen - written ); - if ( res <= 0 ) { - /* error on socket */ - if ( errno == EAGAIN ) - continue; - - purple_debug_error( MXIT_PLUGIN_ID, "Error while writing packet to HTTP server (%i)\n", res ); - return -1; - } - written += res; - } - - return 0; -} - - -/*------------------------------------------------------------------------ - * Callback when data is received from the HTTP server. - * - * @param user_data The MXit session object - * @param source The file-descriptor on which data was received - * @param cond Condition which caused the callback (PURPLE_INPUT_READ) - */ -static void mxit_cb_http_read( gpointer user_data, gint source, PurpleInputCondition cond ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - char buf[256]; - int buflen; - char* body; - int bodylen; - char* ch; - int len; - char* tmp; - int res; - char* next; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_read\n" ); - - if ( session->rx_state == RX_STATE_RLEN ) { - /* we are reading in the HTTP headers */ - - /* copy partial headers if we have any part saved */ - memcpy( buf, session->rx_dbuf, session->rx_i ); - buflen = session->rx_i; - - /* read bytes from the socket */ - len = read( session->fd, buf + buflen, sizeof( buf ) - buflen ); - if ( len <= 0 ) { - /* connection has been terminated, or error occured */ - goto done; - } - -//nextpacket: - -#ifdef DEBUG_HTTP - purple_debug_info( MXIT_PLUGIN_ID, "HTTP POST READ 1: (%i)\n", len ); - dump_bytes( session, buf + buflen, len ); -#endif - - /* see if we have all the HTTP headers yet */ - ch = strstr( buf, HTTP_11_SEPERATOR ); - if ( !ch ) { - /* we need to wait for more input, so save what we have */ - session->rx_i = buflen + len; - memcpy( session->rx_dbuf, buf, session->rx_i ); - return; - } - buflen += len; - - /* we have the header's end now skip over the http seperator to get the body offset */ - ch += strlen( HTTP_11_SEPERATOR ); - *(ch - 1) = '\0'; - body = ch; - - res = buflen - ( ch - buf ); - if ( res > 0 ) { - /* we read more bytes than just the header so copy it over */ - memcpy( session->rx_dbuf, ch, res ); - session->rx_i = res; - } - else { - session->rx_i = 0; - } - - /* test for a good response */ - if ( ( strncmp( buf, HTTP_11_200_OK, strlen( HTTP_11_200_OK ) ) != 0 ) && ( strncmp( buf, HTTP_11_100_CONT, strlen( HTTP_11_100_CONT ) ) != 0 ) ) { - /* bad result */ - purple_debug_error( MXIT_PLUGIN_ID, "HTTP error: %s\n", ch ); - goto done; - } - - /* find the content-length */ - ch = (char*) purple_strcasestr( buf, HTTP_CONTENT_LEN ); - if ( !ch ) { - /* bad request. it does not contain a content-length header */ - purple_debug_error( MXIT_PLUGIN_ID, "HTTP reply received without content-length header (ignoring packet)\n" ); - goto done; - } - - /* parse the content-length */ - ch += strlen( HTTP_CONTENT_LEN ); - tmp = strchr( ch, '\r' ); - if ( !tmp ) { - purple_debug_error( MXIT_PLUGIN_ID, "Received bad HTTP reply packet (ignoring packet)\n" ); - goto done; - } - tmp = g_strndup( ch, tmp - ch ); - bodylen = atoi( tmp ); - g_free( tmp ); - tmp = NULL; - - if ( buflen > ( ( body - buf ) + bodylen ) ) { - /* we have a second packet here */ - next = body + bodylen; - session->rx_res = 0; - } - else { - session->rx_res = bodylen - session->rx_i; - } - - if ( session->rx_res == 0 ) { - /* we have read all the data */ - session->rx_i = bodylen; - session->rx_state = RX_STATE_PROC; - } - else { - /* there is still some data outstanding */ - session->rx_state = RX_STATE_DATA; - } - } - else if ( session->rx_state == RX_STATE_DATA ) { - /* we are reading the HTTP content (body) */ - - /* read bytes from the socket */ - len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); - if ( len <= 0 ) { - /* connection has been terminated, or error occured */ - goto done; - } - -#ifdef DEBUG_HTTP - purple_debug_info( MXIT_PLUGIN_ID, "HTTP POST READ 2: (%i)\n", len ); - dump_bytes( session, &session->rx_dbuf[session->rx_i], len ); -#endif - session->rx_i += len; - session->rx_res -= len; - - if ( session->rx_res == 0 ) { - /* ok, so now we have read in the whole packet */ - session->rx_state = RX_STATE_PROC; - } - } - - if ( session->rx_state == RX_STATE_PROC ) { - mxit_parse_packet( session ); - -#if 0 - if ( next ) { - /* there is another packet of which we read some data */ - - /* reset input */ - session->rx_state = RX_STATE_RLEN; - session->rx_lbuf[0] = '\0'; - session->rx_i = 0; - session->rx_res = 0; - - /* move read data */ - len = next - buf; - buflen = len; - memcpy( buf, next, len ); - goto nextpacket; - } -#endif - - /* we are done */ - goto done; - } - - return; -done: - close( session->fd ); - purple_input_remove( session->http_handler ); - session->http_handler = 0; -} - - -/*------------------------------------------------------------------------ - * Callback invoked once the connection has been established to the HTTP server, - * or on connection failure. - * - * @param user_data The MXit session object - * @param source The file-descriptor associated with the connection - * @param error_message Message explaining why the connection failed - */ -static void mxit_cb_http_connect( gpointer user_data, gint source, const gchar* error_message ) -{ - struct http_request* req = (struct http_request*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect\n" ); - - /* source is the file descriptor of the new connection */ - if ( source < 0 ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect failed: %s\n", error_message ); - purple_connection_error( req->session->con, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); - return; - } - - /* we now have an open and active TCP connection to the mxit server */ - req->session->fd = source; - - /* reset the receive buffer */ - req->session->rx_state = RX_STATE_RLEN; - req->session->rx_lbuf[0] = '\0'; - req->session->rx_i = 0; - req->session->rx_res = 0; - - /* start listening on the open connection for messages from the server (reference: "libpurple/eventloop.h") */ - req->session->http_handler = purple_input_add( req->session->fd, PURPLE_INPUT_READ, mxit_cb_http_read, req->session ); - - /* actually send the request to the HTTP server */ - mxit_http_raw_write( req->session->fd, req->data, req->datalen ); - - /* free up resources */ - free_http_request( req ); - req = NULL; -} - - -/*------------------------------------------------------------------------ - * Create HTTP connection for sending a HTTP request - * - * @param session The MXit session object - * @param host The server name to connect to - * @param port The port number to connect to - * @param data The HTTP request data (including HTTP headers etc.) - * @param datalen The HTTP request data length - */ -void mxit_http_send_request( struct MXitSession* session, char* host, int port, const char* data, int datalen ) -{ - PurpleProxyConnectData* con = NULL; - struct http_request* req; - - /* build the http request */ - req = g_new0( struct http_request, 1 ); - req->session = session; - req->host = host; - req->port = port; - req->data = g_malloc0( datalen ); - memcpy( req->data, data, datalen ); - req->datalen = datalen; - - /* open connection to the HTTP server */ - con = purple_proxy_connect( NULL, session->acc, host, port, mxit_cb_http_connect, req ); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/http.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _MXIT_HTTP_H_ -#define _MXIT_HTTP_H_ - - - -struct http_request -{ - struct MXitSession* session; - char* host; - int port; - char* data; - int datalen; -}; - - -void mxit_http_send_request( struct MXitSession* session, char* host, int port, const char* data, int datalen ); - - - -#endif /* _MXIT_HTTP_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,788 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit user login functionality -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "cipher.h" -#include "login.h" -#include "profile.h" - -/* requesting captcha size */ -#define MXIT_CAPTCHA_HEIGHT 50 -#define MXIT_CAPTCHA_WIDTH 150 - - -/* prototypes */ -static void mxit_register_view( struct MXitSession* session ); -static void get_clientinfo( struct MXitSession* session ); - - -/*------------------------------------------------------------------------ - * Create a new mxit session object - * - * @return The MXit session object - */ -static struct MXitSession* mxit_create_object( PurpleAccount* account ) -{ - struct MXitSession* session = NULL; - PurpleConnection* con = NULL; - - /* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */ - if ( account->username[0] == '+' ) { - char* fixed; - - /* cut off the '+' */ - fixed = g_strdup( &account->username[1] ); - purple_account_set_username( account, fixed ); - g_free( fixed ); - } - - session = g_new0( struct MXitSession, 1 ); - - /* configure the connection (reference: "libpurple/connection.h") */ - con = purple_account_get_connection( account ); - con->proto_data = session; - con->flags |= PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_HTML; - session->con = con; - - /* add account */ - session->acc = account; - - /* configure the session (reference: "libpurple/account.h") */ - g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) ); - g_strlcpy( session->http_server, purple_account_get_string( account, MXIT_CONFIG_HTTPSERVER, DEFAULT_HTTP_SERVER ), sizeof( session->http_server ) ); - session->port = purple_account_get_int( account, MXIT_CONFIG_SERVER_PORT, DEFAULT_PORT ); - g_strlcpy( session->distcode, purple_account_get_string( account, MXIT_CONFIG_DISTCODE, "" ), sizeof( session->distcode ) ); - g_strlcpy( session->clientkey, purple_account_get_string( account, MXIT_CONFIG_CLIENTKEY, "" ), sizeof( session->clientkey ) ); - g_strlcpy( session->dialcode, purple_account_get_string( account, MXIT_CONFIG_DIALCODE, "" ), sizeof( session->dialcode ) ); - session->http = purple_account_get_bool( account, MXIT_CONFIG_USE_HTTP, FALSE ); - session->iimages = g_hash_table_new( g_str_hash, g_str_equal ); - session->rx_state = RX_STATE_RLEN; - session->http_interval = MXIT_HTTP_POLL_MIN; - session->http_last_poll = time( NULL ); - - return session; -} - - -/*------------------------------------------------------------------------ - * We now have a connection established with MXit, so we can start the - * login procedure - * - * @param session The MXit session object - */ -static void mxit_connected( struct MXitSession* session ) -{ - int state; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_connected\n" ); - - session->flags |= MXIT_FLAG_CONNECTED; - purple_connection_update_progress( session->con, _( "Logging In..." ), 2, 4 ); - - /* create a timer to send a ping packet if the connection is idle */ - session->last_tx = time( NULL ); - - /* encrypt the user password */ - session->encpwd = mxit_encrypt_password( session ); - - state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - if ( state == MXIT_STATE_LOGIN ) { - /* create and send login packet */ - mxit_send_login( session ); - } - else { - if ( !session->profile ) { - /* we have lost the session profile, so ask the user to enter it again */ - mxit_register_view( session ); - } - else { - /* create and send the register packet */ - mxit_send_register( session ); - } - } - - /* enable signals */ - mxit_enable_signals( session ); - -#ifdef MXIT_LINK_CLICK - /* register for uri click notification */ - mxit_register_uri_handler(); -#endif - - /* start the polling if this is a HTTP connection */ - if ( session->http ) { - session->http_timer_id = purple_timeout_add_seconds( 2, mxit_manage_polling, session ); - } - - /* This timer might already exist if we're registering a new account */ - if ( session->q_timer == 0 ) - /* start the tx queue manager timer */ - session->q_timer = purple_timeout_add_seconds( 2, mxit_manage_queue, session ); -} - - -/*------------------------------------------------------------------------ - * Callback invoked once the connection has been established to the MXit server, - * or on connection failure. - * - * @param user_data The MXit session object - * @param source The file-descriptor associated with the connection - * @param error_message Message explaining why the connection failed - */ -static void mxit_cb_connect( gpointer user_data, gint source, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect\n" ); - - /* source is the file descriptor of the new connection */ - if ( source < 0 ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect failed: %s\n", error_message ); - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); - return; - } - - /* we now have an open and active TCP connection to the mxit server */ - session->fd = source; - - /* start listening on the open connection for messages from the server (reference: "libpurple/eventloop.h") */ - session->con->inpa = purple_input_add( session->fd, PURPLE_INPUT_READ, mxit_cb_rx, session ); - - mxit_connected( session ); -} - - -/*------------------------------------------------------------------------ - * Attempt to establish a connection to the MXit server. - * - * @param session The MXit session object - */ -static void mxit_login_connect( struct MXitSession* session ) -{ - PurpleProxyConnectData* data = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_login_connect\n" ); - - purple_connection_update_progress( session->con, _( "Connecting..." ), 1, 4 ); - - /* - * at this stage we have all the user's information we require - * for logging into MXit. we will now create a new connection to - * a MXit server. - */ - - if ( !session->http ) { - /* socket connection */ - data = purple_proxy_connect( session->con, session->acc, session->server, session->port, mxit_cb_connect, session ); - if ( !data ) { - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); - return; - } - } - else { - /* http connection */ - mxit_connected( session ); - } -} - - -/*------------------------------------------------------------------------ - * Register a new account with MXit - * - * @param gc The connection object - * @param fields This is the fields filled-in by the user - */ -static void mxit_cb_register_ok( PurpleConnection *gc, PurpleRequestFields *fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct MXitProfile* profile = session->profile; - const char* str; - const char* pin; - const char* err = NULL; - int len; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_ok\n" ); - - if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { - purple_debug_error( MXIT_PLUGIN_ID, "Unable to register; account offline.\n" ); - return; - } - - /* nickname */ - str = purple_request_fields_get_string( fields, "nickname" ); - if ( ( !str ) || ( strlen( str ) < 3 ) ) { - err = _( "The nick name you entered is invalid." ); - goto out; - } - g_strlcpy( profile->nickname, str, sizeof( profile->nickname ) ); - - /* birthdate */ - str = purple_request_fields_get_string( fields, "bday" ); - if ( ( !str ) || ( strlen( str ) < 10 ) || ( !validateDate( str ) ) ) { - err = _( "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." ); - goto out; - } - g_strlcpy( profile->birthday, str, sizeof( profile->birthday ) ); - - /* gender */ - profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 ); - - /* pin */ - pin = purple_request_fields_get_string( fields, "pin" ); - if ( !pin ) { - err = _( "The PIN you entered is invalid." ); - goto out; - } - len = strlen( pin ); - if ( ( len < 7 ) || ( len > 10 ) ) { - err = _( "The PIN you entered has an invalid length [7-10]." ); - goto out; - } - for ( i = 0; i < len; i++ ) { - if ( !g_ascii_isdigit( pin[i] ) ) { - err = _( "The PIN is invalid. It should only consist of digits [0-9]." ); - goto out; - } - } - str = purple_request_fields_get_string( fields, "pin2" ); - if ( ( !str ) || ( strcmp( pin, str ) != 0 ) ) { - err = _( "The two PINs you entered do not match." ); - goto out; - } - g_strlcpy( profile->pin, pin, sizeof( profile->pin ) ); - -out: - if ( !err ) { - purple_account_set_password( session->acc, session->profile->pin ); - mxit_login_connect( session ); - } - else { - /* show error to user */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Registration Error" ), err ); - mxit_register_view( session ); - } -} - - -/*------------------------------------------------------------------------ - * Register a new account with MXit - * - * @param gc The connection object - * @param fields This is the fields filled-in by the user - */ -static void mxit_cb_register_cancel( PurpleConnection *gc, PurpleRequestFields *fields ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_cancel\n" ); - - /* disconnect */ - purple_account_disconnect( gc->account ); -} - - -/*------------------------------------------------------------------------ - * Show a window to the user so that he can enter his information - * - * @param session The MXit session object - */ -static void mxit_register_view( struct MXitSession* session ) -{ - struct MXitProfile* profile; - PurpleRequestFields* fields; - PurpleRequestFieldGroup* group; - PurpleRequestField* field; - - if ( !session->profile ) { - /* we need to create a profile object here */ - session->profile = g_new0( struct MXitProfile, 1 ); - } - profile = session->profile; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* mxit login name */ - field = purple_request_field_string_new( "loginname", _( "MXit Login Name" ), purple_account_get_username( session->acc ), FALSE ); - purple_request_field_string_set_editable( field, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* nick name */ - field = purple_request_field_string_new( "nickname", _( "Nick Name" ), profile->nickname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* birthday */ - field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); - purple_request_field_string_set_default_value( field, "YYYY-MM-DD" ); - purple_request_field_group_add_field( group, field ); - - /* gender */ - field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); - purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ - purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ - purple_request_field_group_add_field( group, field ); - - /* pin */ - field = purple_request_field_string_new( "pin", _( "PIN" ), profile->pin, FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), "", FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - - /* show the form to the user to complete */ - purple_request_fields( session->con, _( "Register New MXit Account" ), _( "Register New MXit Account" ), _( "Please fill in the following fields:" ), fields, _( "OK" ), G_CALLBACK( mxit_cb_register_ok ), _( "Cancel" ), G_CALLBACK( mxit_cb_register_cancel ), session->acc, NULL, NULL, session->con ); -} - - -/*------------------------------------------------------------------------ - * Callback function invoked once the Authorization information has been submitted - * to the MXit WAP site. - * - * @param url_data libPurple internal object (see purple_util_fetch_url_request) - * @param user_data The MXit session object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - gchar** parts; - gchar** host; - int state; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_clientinfo_cb2\n" ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP RESPONSE: '%s'\n", url_text ); -#endif - - if ( !url_text ) { - /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); - return; - } - - /* explode the response from the WAP site into an array */ - parts = g_strsplit( url_text, ";", 15 ); - - if ( !parts ) { - /* wapserver error */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); - return; - } - - /* check wapsite return code */ - switch ( parts[0][0] ) { - case '0' : - /* valid reply! */ - break; - case '1' : - purple_connection_error( session->con, _( "Wrong security code entered. Please try again later." ) ); - return; - case '2' : - purple_connection_error( session->con, _( "Your session has expired. Please try again later." ) ); - return; - case '5' : - purple_connection_error( session->con, _( "Invalid country selected. Please try again." ) ); - return; - case '6' : - purple_connection_error( session->con, _( "Username is not registered. Please register first." ) ); - return; - case '7' : - purple_connection_error( session->con, _( "Username is already registered. Please choose another username." ) ); - /* this user's account already exists, so we need to change the registration login flag to be login */ - purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - return; - case '3' : - case '4' : - default : - purple_connection_error( session->con, _( "Internal error. Please try again later." ) ); - return; - } - - /* now parse and split the distribution code and the client key */ - g_strlcpy( session->distcode, &parts[1][2], 36 + 1 ); - g_strlcpy( session->clientkey, &parts[1][38], 8 + 1 ); - - /* get the dial code for the client */ - g_strlcpy( session->dialcode, parts[4], sizeof( session->dialcode ) ); - - /* parse the proxy server address and port number */ - host = g_strsplit( parts[2], ":", 4 ); - g_strlcpy( session->server, &host[1][2], sizeof( session->server ) ); - session->port = atoi( &host[2][0] ); - - /* parse the http proxy server address and port number */ - g_strlcpy( session->http_server, parts[3], sizeof( session->http_server ) ); - - purple_debug_info( MXIT_PLUGIN_ID, "distcode='%s', clientkey='%s', dialcode='%s'\n", session->distcode, session->clientkey, session->dialcode ); - purple_debug_info( MXIT_PLUGIN_ID, "sock_server='%s', http_server='%s', port='%i', cc='%s'\n", session->server, session->http_server, session->port, parts[11] ); - - /* save the information (reference: "libpurple/account.h") */ - purple_account_set_string( session->acc, MXIT_CONFIG_DISTCODE, session->distcode ); - purple_account_set_string( session->acc, MXIT_CONFIG_CLIENTKEY, session->clientkey ); - purple_account_set_string( session->acc, MXIT_CONFIG_DIALCODE, session->dialcode ); - purple_account_set_string( session->acc, MXIT_CONFIG_SERVER_ADDR, session->server ); - purple_account_set_int( session->acc, MXIT_CONFIG_SERVER_PORT, session->port ); - purple_account_set_string( session->acc, MXIT_CONFIG_HTTPSERVER, session->http_server ); - - /* update the state */ - state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - if ( state == MXIT_STATE_REGISTER1 ) - purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_REGISTER2 ); - - /* freeup the memory */ - g_strfreev( host ); - g_strfreev( parts ); - - if ( state == MXIT_STATE_LOGIN ) { - /* now we can continue with the login process */ - mxit_login_connect( session ); - } - else { - /* the user is registering so we need to get more information from him/her first to complete the process */ - mxit_register_view( session ); - } -} - - -/*------------------------------------------------------------------------ - * Free up the data associated with the Authorization process. - * - * @param data The data object to free - */ -static void free_logindata( struct login_data* data ) -{ - if ( !data ) - return; - - /* free up the login resources */ - g_free( data->wapserver ); - g_free( data->sessionid ); - g_free( data->captcha ); - g_free( data->cc ); - g_free( data->locale ); - g_free( data ); -} - - -/*------------------------------------------------------------------------ - * This function is called when the user accepts the Authorization form. - * - * @param gc The connection object - * @param fields The list of fields in the accepted form - */ -static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleUtilFetchUrlData* url_data; - PurpleRequestField* field; - const char* captcha_resp; - GList* entries; - GList* entry; - char* url; - int state; - - /* get the captcha response */ - captcha_resp = purple_request_fields_get_string( fields, "code" ); - if ( ( captcha_resp == NULL ) || ( captcha_resp[0] == '\0' ) ) { - /* the user did not fill in the captcha */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Error" ), _( "You did not enter the security code" ) ); - free_logindata( session->logindata ); - purple_account_disconnect( session->acc ); - return; - } - - /* get chosen country */ - field = purple_request_fields_get_field( fields, "country" ); - entries = purple_request_field_list_get_selected( field ); - entry = g_list_first( entries ); - session->logindata->cc = purple_request_field_list_get_data( field, entry->data ); - purple_account_set_string( session->acc, MXIT_CONFIG_COUNTRYCODE, session->logindata->cc ); - - /* get chosen language */ - field = purple_request_fields_get_field( fields, "locale" ); - entries = purple_request_field_list_get_selected( field ); - entry = g_list_first( entries ); - session->logindata->locale = purple_request_field_list_get_data( field, entry->data ); - purple_account_set_string( session->acc, MXIT_CONFIG_LOCALE, session->logindata->locale ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "cc='%s', locale='%s', captcha='%s'\n", session->logindata->cc, session->logindata->locale, captcha_resp ); -#endif - - /* get state */ - state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - - url = g_strdup_printf( "%s?type=getpid&sessionid=%s&login=%s&ver=%s&clientid=%s&cat=%s&chalresp=%s&cc=%s&loc=%s&path=%i&brand=%s&model=%s&h=%i&w=%i&ts=%li", - session->logindata->wapserver, session->logindata->sessionid, purple_url_encode( session->acc->username ), MXIT_CP_RELEASE, MXIT_CLIENT_ID, MXIT_CP_ARCH, - captcha_resp, session->logindata->cc, session->logindata->locale, ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, MXIT_CP_PLATFORM, MXIT_CP_OS, - MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo2, session ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); -#endif - g_free( url ); - - /* free up the login resources */ - free_logindata( session->logindata ); -} - - -/*------------------------------------------------------------------------ - * This function is called when the user cancels the Authorization form. - * - * @param gc The connection object - * @param fields The list of fields in the cancelled form - */ -static void mxit_cb_captcha_cancel( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - /* free up the login resources */ - free_logindata( session->logindata ); - - /* we cannot continue, so we disconnect this account */ - purple_account_disconnect( session->acc ); -} - - -/*------------------------------------------------------------------------ - * Callback function invoked once the client information has been retrieved from - * the MXit WAP site. Display page where user can select their authorization information. - * - * @param url_data libPurple internal object (see purple_util_fetch_url_request) - * @param user_data The MXit session object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - struct login_data* logindata; - PurpleRequestFields* fields; - PurpleRequestFieldGroup* group = NULL; - PurpleRequestField* field = NULL; - gchar** parts; - gchar** countries; - gchar** locales; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_clientinfo_cb1\n" ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "RESPONSE: %s\n", url_text ); -#endif - - if ( !url_text ) { - /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); - return; - } - - /* explode the response from the WAP site into an array */ - parts = g_strsplit( url_text, ";", 15 ); - - if ( ( !parts ) || ( parts[0][0] != '0' ) ) { - /* server could not find the user */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); - return; - } - - /* save received settings */ - logindata = g_new0( struct login_data, 1 ); - logindata->wapserver = g_strdup( parts[1] ); - logindata->sessionid = g_strdup( parts[2] ); - session->logindata = logindata; - - /* now generate the popup requesting the user for action */ - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* add the captcha */ - logindata->captcha = purple_base64_decode( parts[3], &logindata->captcha_size ); - field = purple_request_field_image_new( "capcha", _( "Security Code" ), (gchar*) logindata->captcha, logindata->captcha_size ); - purple_request_field_group_add_field( group, field ); - - /* ask for input */ - field = purple_request_field_string_new( "code", _( "Enter Security Code" ), NULL, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* choose your country, but be careful, we already know your IP! ;-) */ - countries = g_strsplit( parts[4], ",", 500 ); - field = purple_request_field_list_new( "country", _( "Your Country" ) ); - purple_request_field_list_set_multi_select( field, FALSE ); - for ( i = 0; countries[i]; i++ ) { - gchar** country; - - country = g_strsplit( countries[i], "|", 2 ); - if ( !country ) { - /* oops, this is not good, time to bail */ - break; - } - purple_request_field_list_add( field, country[1], g_strdup( country[0] ) ); - if ( strcmp( country[1], parts[6] ) == 0 ) { - /* based on the user's ip, this is his current country code, so we default to it */ - purple_request_field_list_add_selected( field, country[1] ); - } - g_strfreev( country ); - } - purple_request_field_group_add_field( group, field ); - - /* choose your language */ - locales = g_strsplit( parts[5], ",", 200 ); - field = purple_request_field_list_new( "locale", _( "Your Language" ) ); - purple_request_field_list_set_multi_select( field, FALSE ); - for ( i = 0; locales[i]; i++ ) { - gchar** locale; - - locale = g_strsplit( locales[i], "|", 2 ); - if ( !locale ) { - /* oops, this is not good, time to bail */ - break; - } - purple_request_field_list_add( field, locale[1], g_strdup( locale[0] ) ); - g_strfreev( locale ); - } - purple_request_field_list_add_selected( field, "English" ); - purple_request_field_group_add_field( group, field ); - - /* display the form to the user and wait for his/her input */ - purple_request_fields( session->con, "MXit", _( "MXit Authorization" ), _( "MXit account validation" ), fields, - _( "Continue" ), G_CALLBACK( mxit_cb_captcha_ok ), _( "Cancel" ), G_CALLBACK( mxit_cb_captcha_cancel ), session->acc, NULL, NULL, session->con ); - - /* freeup the memory */ - g_strfreev( parts ); -} - - -/*------------------------------------------------------------------------ - * Initiate a request for the client information (distribution code, client key, etc) - * required for logging in from the MXit WAP site. - * - * @param session The MXit session object - */ -static void get_clientinfo( struct MXitSession* session ) -{ - PurpleUtilFetchUrlData* url_data; - const char* wapserver; - char* url; - - purple_debug_info( MXIT_PLUGIN_ID, "get_clientinfo\n" ); - - purple_connection_update_progress( session->con, _( "Retrieving User Information..." ), 0, 4 ); - - /* get the WAP site as was configured by the user in the advanced settings */ - wapserver = purple_account_get_string( session->acc, MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE ); - - /* reference: "libpurple/util.h" */ - url = g_strdup_printf( "%s/res/?type=challenge&getcountries=true&getlanguage=true&getimage=true&h=%i&w=%i&ts=%li", wapserver, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo1, session ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); -#endif - g_free( url ); -} - - -/*------------------------------------------------------------------------ - * Log the user into MXit. - * - * @param account The account object - */ -void mxit_login( PurpleAccount* account ) -{ - struct MXitSession* session = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_login\n" ); - - /* create and save a new mxit session */ - session = mxit_create_object( account ); - - /* - * before we can login we need to have a valid distribution code and client key for authentication. - * if we don't have any info saved from a previous login, we need to get it from the MXit WAP site. - * we do cache it, so this step is only done on the very first login for each account. - */ - if ( ( session->distcode == NULL ) || ( strlen( session->distcode ) == 0 ) ) { - /* this must be the very first login, so we need to retrieve the user information */ - get_clientinfo( session ); - } - else { - /* we can continue with the login */ - mxit_login_connect( session ); - } -} - - -/*------------------------------------------------------------------------ - * Perform a reconnect to the MXit server, and maintain same session object. - * - * @param account The account object - */ -void mxit_reconnect( struct MXitSession* session ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_reconnect\n" ); - - /* close existing connection */ - session->flags &= ~MXIT_FLAG_CONNECTED; - purple_proxy_connect_cancel_with_handle( session->con ); - - /* perform the re-connect */ - mxit_login_connect( session ); -} - - -/*------------------------------------------------------------------------ - * Register a new account with MXit - * - * @param acc The account object - */ -void mxit_register( PurpleAccount* account ) -{ - struct MXitSession* session = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_register\n" ); - - /* create and save a new mxit session */ - session = mxit_create_object( account ); - purple_account_set_int( account, MXIT_CONFIG_STATE, MXIT_STATE_REGISTER1 ); - - get_clientinfo( session ); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/login.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit user login functionality -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_LOGIN_H_ -#define _MXIT_LOGIN_H_ - - -struct login_data { - char* wapserver; /* direct WAP server for postback */ - char* sessionid; /* unique session id */ - guchar* captcha; /* actual captcha (PNG) */ - gsize captcha_size; /* captcha size */ - char* cc; /* country code */ - char* locale; /* locale (language) */ -}; - - -void mxit_login( PurpleAccount* account ); -void mxit_register( PurpleAccount* account ); -void mxit_reconnect( struct MXitSession* session ); - - -#endif /* _MXIT_LOGIN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MXITSOURCES = \ - actions.c \ - actions.h \ - aes.c \ - aes.h \ - chunk.c \ - chunk.h \ - cipher.c \ - cipher.h \ - filexfer.c \ - filexfer.h \ - formcmds.c \ - formcmds.h \ - http.c \ - http.h \ - login.c \ - login.h \ - markup.c \ - markup.h \ - multimx.c \ - multimx.h \ - mxit.c \ - mxit.h \ - profile.c \ - profile.h \ - protocol.c \ - protocol.h \ - roster.c \ - roster.h \ - splashscreen.c \ - splashscreen.h - - -AM_CFLAGS = $(st) - -libmxit_la_LDFLAGS = -module -avoid-version - -if STATIC_MXIT - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmxit.la -libmxit_la_SOURCES = $(MXITSOURCES) -libmxit_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmxit.la -libmxit_la_SOURCES = $(MXITSOURCES) -libmxit_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,889 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/mxit -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MXIT_FALSE@libmxit_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libmxit_la_SOURCES_DIST = actions.c actions.h aes.c aes.h chunk.c \ - chunk.h cipher.c cipher.h filexfer.c filexfer.h formcmds.c \ - formcmds.h http.c http.h login.c login.h markup.c markup.h \ - multimx.c multimx.h mxit.c mxit.h profile.c profile.h \ - protocol.c protocol.h roster.c roster.h splashscreen.c \ - splashscreen.h -am__objects_1 = libmxit_la-actions.lo libmxit_la-aes.lo \ - libmxit_la-chunk.lo libmxit_la-cipher.lo \ - libmxit_la-filexfer.lo libmxit_la-formcmds.lo \ - libmxit_la-http.lo libmxit_la-login.lo libmxit_la-markup.lo \ - libmxit_la-multimx.lo libmxit_la-mxit.lo libmxit_la-profile.lo \ - libmxit_la-protocol.lo libmxit_la-roster.lo \ - libmxit_la-splashscreen.lo -@STATIC_MXIT_FALSE@am_libmxit_la_OBJECTS = $(am__objects_1) -@STATIC_MXIT_TRUE@am_libmxit_la_OBJECTS = $(am__objects_1) -libmxit_la_OBJECTS = $(am_libmxit_la_OBJECTS) -@STATIC_MXIT_FALSE@am_libmxit_la_rpath = -rpath $(pkgdir) -@STATIC_MXIT_TRUE@am_libmxit_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmxit_la_SOURCES) -DIST_SOURCES = $(am__libmxit_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MXITSOURCES = \ - actions.c \ - actions.h \ - aes.c \ - aes.h \ - chunk.c \ - chunk.h \ - cipher.c \ - cipher.h \ - filexfer.c \ - filexfer.h \ - formcmds.c \ - formcmds.h \ - http.c \ - http.h \ - login.c \ - login.h \ - markup.c \ - markup.h \ - multimx.c \ - multimx.h \ - mxit.c \ - mxit.h \ - profile.c \ - profile.h \ - protocol.c \ - protocol.h \ - roster.c \ - roster.h \ - splashscreen.c \ - splashscreen.h - -AM_CFLAGS = $(st) -libmxit_la_LDFLAGS = -module -avoid-version -@STATIC_MXIT_FALSE@st = -@STATIC_MXIT_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MXIT_TRUE@noinst_LTLIBRARIES = libmxit.la -@STATIC_MXIT_FALSE@libmxit_la_SOURCES = $(MXITSOURCES) -@STATIC_MXIT_TRUE@libmxit_la_SOURCES = $(MXITSOURCES) -@STATIC_MXIT_TRUE@libmxit_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MXIT_FALSE@pkg_LTLIBRARIES = libmxit.la -@STATIC_MXIT_FALSE@libmxit_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/mxit/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/mxit/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmxit.la: $(libmxit_la_OBJECTS) $(libmxit_la_DEPENDENCIES) - $(LINK) $(am_libmxit_la_rpath) $(libmxit_la_LDFLAGS) $(libmxit_la_OBJECTS) $(libmxit_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-actions.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-aes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-chunk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-cipher.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-filexfer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-formcmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-http.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-login.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-markup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-multimx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-mxit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-profile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-protocol.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-roster.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-splashscreen.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmxit_la-actions.lo: actions.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-actions.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-actions.Tpo" -c -o libmxit_la-actions.lo `test -f 'actions.c' || echo '$(srcdir)/'`actions.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-actions.Tpo" "$(DEPDIR)/libmxit_la-actions.Plo"; else rm -f "$(DEPDIR)/libmxit_la-actions.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='actions.c' object='libmxit_la-actions.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-actions.lo `test -f 'actions.c' || echo '$(srcdir)/'`actions.c - -libmxit_la-aes.lo: aes.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-aes.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-aes.Tpo" -c -o libmxit_la-aes.lo `test -f 'aes.c' || echo '$(srcdir)/'`aes.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-aes.Tpo" "$(DEPDIR)/libmxit_la-aes.Plo"; else rm -f "$(DEPDIR)/libmxit_la-aes.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aes.c' object='libmxit_la-aes.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-aes.lo `test -f 'aes.c' || echo '$(srcdir)/'`aes.c - -libmxit_la-chunk.lo: chunk.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-chunk.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-chunk.Tpo" -c -o libmxit_la-chunk.lo `test -f 'chunk.c' || echo '$(srcdir)/'`chunk.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-chunk.Tpo" "$(DEPDIR)/libmxit_la-chunk.Plo"; else rm -f "$(DEPDIR)/libmxit_la-chunk.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chunk.c' object='libmxit_la-chunk.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-chunk.lo `test -f 'chunk.c' || echo '$(srcdir)/'`chunk.c - -libmxit_la-cipher.lo: cipher.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-cipher.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-cipher.Tpo" -c -o libmxit_la-cipher.lo `test -f 'cipher.c' || echo '$(srcdir)/'`cipher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-cipher.Tpo" "$(DEPDIR)/libmxit_la-cipher.Plo"; else rm -f "$(DEPDIR)/libmxit_la-cipher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cipher.c' object='libmxit_la-cipher.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-cipher.lo `test -f 'cipher.c' || echo '$(srcdir)/'`cipher.c - -libmxit_la-filexfer.lo: filexfer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-filexfer.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-filexfer.Tpo" -c -o libmxit_la-filexfer.lo `test -f 'filexfer.c' || echo '$(srcdir)/'`filexfer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-filexfer.Tpo" "$(DEPDIR)/libmxit_la-filexfer.Plo"; else rm -f "$(DEPDIR)/libmxit_la-filexfer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='filexfer.c' object='libmxit_la-filexfer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-filexfer.lo `test -f 'filexfer.c' || echo '$(srcdir)/'`filexfer.c - -libmxit_la-formcmds.lo: formcmds.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-formcmds.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-formcmds.Tpo" -c -o libmxit_la-formcmds.lo `test -f 'formcmds.c' || echo '$(srcdir)/'`formcmds.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-formcmds.Tpo" "$(DEPDIR)/libmxit_la-formcmds.Plo"; else rm -f "$(DEPDIR)/libmxit_la-formcmds.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='formcmds.c' object='libmxit_la-formcmds.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-formcmds.lo `test -f 'formcmds.c' || echo '$(srcdir)/'`formcmds.c - -libmxit_la-http.lo: http.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-http.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-http.Tpo" -c -o libmxit_la-http.lo `test -f 'http.c' || echo '$(srcdir)/'`http.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-http.Tpo" "$(DEPDIR)/libmxit_la-http.Plo"; else rm -f "$(DEPDIR)/libmxit_la-http.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='http.c' object='libmxit_la-http.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-http.lo `test -f 'http.c' || echo '$(srcdir)/'`http.c - -libmxit_la-login.lo: login.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-login.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-login.Tpo" -c -o libmxit_la-login.lo `test -f 'login.c' || echo '$(srcdir)/'`login.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-login.Tpo" "$(DEPDIR)/libmxit_la-login.Plo"; else rm -f "$(DEPDIR)/libmxit_la-login.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='login.c' object='libmxit_la-login.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-login.lo `test -f 'login.c' || echo '$(srcdir)/'`login.c - -libmxit_la-markup.lo: markup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-markup.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-markup.Tpo" -c -o libmxit_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-markup.Tpo" "$(DEPDIR)/libmxit_la-markup.Plo"; else rm -f "$(DEPDIR)/libmxit_la-markup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='markup.c' object='libmxit_la-markup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c - -libmxit_la-multimx.lo: multimx.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-multimx.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-multimx.Tpo" -c -o libmxit_la-multimx.lo `test -f 'multimx.c' || echo '$(srcdir)/'`multimx.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-multimx.Tpo" "$(DEPDIR)/libmxit_la-multimx.Plo"; else rm -f "$(DEPDIR)/libmxit_la-multimx.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='multimx.c' object='libmxit_la-multimx.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-multimx.lo `test -f 'multimx.c' || echo '$(srcdir)/'`multimx.c - -libmxit_la-mxit.lo: mxit.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-mxit.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-mxit.Tpo" -c -o libmxit_la-mxit.lo `test -f 'mxit.c' || echo '$(srcdir)/'`mxit.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-mxit.Tpo" "$(DEPDIR)/libmxit_la-mxit.Plo"; else rm -f "$(DEPDIR)/libmxit_la-mxit.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mxit.c' object='libmxit_la-mxit.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-mxit.lo `test -f 'mxit.c' || echo '$(srcdir)/'`mxit.c - -libmxit_la-profile.lo: profile.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-profile.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-profile.Tpo" -c -o libmxit_la-profile.lo `test -f 'profile.c' || echo '$(srcdir)/'`profile.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-profile.Tpo" "$(DEPDIR)/libmxit_la-profile.Plo"; else rm -f "$(DEPDIR)/libmxit_la-profile.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='profile.c' object='libmxit_la-profile.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-profile.lo `test -f 'profile.c' || echo '$(srcdir)/'`profile.c - -libmxit_la-protocol.lo: protocol.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-protocol.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-protocol.Tpo" -c -o libmxit_la-protocol.lo `test -f 'protocol.c' || echo '$(srcdir)/'`protocol.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-protocol.Tpo" "$(DEPDIR)/libmxit_la-protocol.Plo"; else rm -f "$(DEPDIR)/libmxit_la-protocol.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protocol.c' object='libmxit_la-protocol.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-protocol.lo `test -f 'protocol.c' || echo '$(srcdir)/'`protocol.c - -libmxit_la-roster.lo: roster.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-roster.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-roster.Tpo" -c -o libmxit_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-roster.Tpo" "$(DEPDIR)/libmxit_la-roster.Plo"; else rm -f "$(DEPDIR)/libmxit_la-roster.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='roster.c' object='libmxit_la-roster.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c - -libmxit_la-splashscreen.lo: splashscreen.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-splashscreen.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-splashscreen.Tpo" -c -o libmxit_la-splashscreen.lo `test -f 'splashscreen.c' || echo '$(srcdir)/'`splashscreen.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-splashscreen.Tpo" "$(DEPDIR)/libmxit_la-splashscreen.Plo"; else rm -f "$(DEPDIR)/libmxit_la-splashscreen.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='splashscreen.c' object='libmxit_la-splashscreen.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-splashscreen.lo `test -f 'splashscreen.c' || echo '$(srcdir)/'`splashscreen.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmxit -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmxit -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = actions.c \ - aes.c \ - chunk.c \ - cipher.c \ - filexfer.c \ - formcmds.c \ - http.c \ - login.c \ - markup.c \ - multimx.c \ - mxit.c \ - profile.c \ - protocol.c \ - roster.c \ - splashscreen.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1191 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- convert between MXit and libPurple markup -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "markup.h" -#include "chunk.h" -#include "formcmds.h" -#include "roster.h" - - -/* define this to enable emoticon (markup) debugging */ -#undef MXIT_DEBUG_EMO -/* define this to enable markup conversion debugging */ -#undef MXIT_DEBUG_MARKUP - - -#define MXIT_FRAME_MAGIC "MXF\x01" /* mxit emoticon magic number */ -#define MXIT_MAX_EMO_ID 16 /* maximum emoticon ID length */ -#define COLORCODE_LEN 6 /* colour code ID length */ - - -/* HTML tag types */ -#define MXIT_TAG_COLOR 0x01 /* font color tag */ -#define MXIT_TAG_SIZE 0x02 /* font size tag */ -#define MXIT_MAX_MSG_TAGS 90 /* maximum tags per message (pigdin hack work around) */ - -/* - * a HTML tag object - */ -struct tag { - char type; - char* value; -}; - - -#define MXIT_VIBE_MSG_COLOR "#9933FF" - -/* vibes */ -static const char* vibes[] = { - /* 0 */ N_( "Cool Vibrations" ), - /* 1 */ N_( "Purple Rain" ), - /* 2 */ N_( "Polite" ), - /* 3 */ N_( "Rock n Roll" ), - /* 4 */ N_( "Summer Slumber" ), - /* 5 */ N_( "Electric Razor" ), - /* 6 */ N_( "S.O.S" ), - /* 7 */ N_( "Jack Hammer" ), - /* 8 */ N_( "Bumble Bee" ), - /* 9 */ N_( "Ripple" ) -}; - - - -#ifdef MXIT_DEBUG_EMO -/*------------------------------------------------------------------------ - * Dump a byte buffer as hexadecimal to the console for debugging purposes. - * - * @param buf The data to dump - * @param len The length of the data - */ -static void hex_dump( const char* buf, int len ) -{ - char msg[256]; - int pos; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "Dumping data (%i bytes)\n", len ); - - memset( msg, 0x00, sizeof( msg ) ); - pos = 0; - - for ( i = 0; i < len; i++ ) { - - if ( pos == 0 ) - pos += sprintf( &msg[pos], "%04i: ", i ); - - pos += sprintf( &msg[pos], "0x%02X ", (unsigned char) buf[i] ); - - if ( i % 16 == 15 ) { - pos += sprintf( &msg[pos], "\n" ); - purple_debug_info( MXIT_PLUGIN_ID, msg ); - pos = 0; - } - else if ( i % 16 == 7 ) - pos += sprintf( &msg[pos], " " ); - } - - if ( pos > 0 ) { - pos += sprintf( &msg[pos], "\n" ); - purple_debug_info( MXIT_PLUGIN_ID, msg ); - pos = 0; - } -} -#endif - - -/*------------------------------------------------------------------------ - * Adds a link to a message - * - * @param mx The Markup message object - * @param linkname This is the what will be returned when the link gets clicked - * @param displayname This is the name for the link which will be displayed in the UI - */ -void mxit_add_html_link( struct RXMsgData* mx, const char* linkname, const char* displayname ) -{ -#ifdef MXIT_LINK_CLICK - char retstr[256]; - gchar* retstr64; - char link[256]; - int len; - - len = g_snprintf( retstr, sizeof( retstr ), "%s|%s|%s|%s|%s", MXIT_LINK_KEY, purple_account_get_username( mx->session->acc ), - purple_account_get_protocol_id( mx->session->acc ), mx->from, linkname ); - retstr64 = purple_base64_encode( (const unsigned char*) retstr, len ); - g_snprintf( link, sizeof( link ), "%s%s", MXIT_LINK_PREFIX, retstr64 ); - g_free( retstr64 ); - - g_string_append_printf( mx->msg, "%s", link, displayname ); -#else - g_string_append_printf( mx->msg, "%s", linkname ); -#endif -} - - -/*------------------------------------------------------------------------ - * Extract an ASN.1 formatted length field from the data. - * - * @param data The source data - * @param size The extracted length - * @return The number of bytes extracted - */ -static unsigned int asn_getlength( const char* data, int* size ) -{ - unsigned int len = 0; - unsigned char bytes; - unsigned char byte; - int i; - - /* first byte specifies the number of bytes in the length */ - bytes = ( data[0] & ~0x80 ); - if ( bytes > sizeof( unsigned int ) ) { - /* file too big! */ - return -1; - } - data++; - - /* parse out the actual length */ - for ( i = 0; i < bytes; i++ ) { - byte = data[i]; - len <<= 8; - len += byte; - } - - *size = len; - return bytes + 1; -} - - -/*------------------------------------------------------------------------ - * Extract an ASN.1 formatted UTF-8 string field from the data. - * - * @param data The source data - * @param type Expected type of string - * @param utf8 The extracted string. Must be deallocated by caller. - * @return The number of bytes extracted - */ -static int asn_getUtf8( const char* data, char type, char** utf8 ) -{ - int len; - - /* validate the field type [1 byte] */ - if ( data[0] != type ) { - /* this is not a utf-8 string! */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid UTF-8 encoded string in ASN data (0x%02X)\n", (unsigned char) data[0] ); - return -1; - } - - len = data[1]; /* length field [1 bytes] */ - *utf8 = g_malloc( len + 1 ); - memcpy( *utf8, &data[2], len ); /* data field */ - (*utf8)[len] = '\0'; - - return ( len + 2 ); -} - - -/*------------------------------------------------------------------------ - * Free data associated with a Markup message object. - * - * @param mx The Markup message object - */ -static void free_markupdata( struct RXMsgData* mx ) -{ - if ( mx ) { - if ( mx->msg ) - g_string_free( mx->msg, TRUE ); - if ( mx->from ) - g_free( mx->from ); - g_free( mx ); - } -} - - -/*------------------------------------------------------------------------ - * Split the message into smaller messages and send them one at a time - * to pidgin to be displayed on the UI - * - * @param mx The received message object - */ -static void mxit_show_split_message( struct RXMsgData* mx ) -{ - const char* cont = "continuing...\n"; - GString* msg = NULL; - char* ch = NULL; - int pos = 0; - int start = 0; - int l_nl = 0; - int l_sp = 0; - int l_gt = 0; - int stop = 0; - int tags = 0; - int segs = 0; - gboolean intag = FALSE; - - /* - * awful hack to work around the awful hack in pidgin to work around GtkIMHtml's - * inefficient rendering of messages with lots of formatting changes. - * (reference: see the function pidgin_conv_write_conv() in gtkconv.c) the issue - * is that when you have more than 100 '<' characters in the message passed to - * pidgin, none of the markup (including links) are rendered and thus just dump - * all the text as is to the conversation window. this message dump is very - * confusing and makes it totally unusable. to work around this we will count - * the amount of tags and if its more than the pidgin threshold, we will just - * break the message up into smaller parts and send them seperately to pidgin. - * to the user it will look like multiple messages, but at least he will be able - * to use and understand it. - */ - - ch = mx->msg->str; - pos = start; - while ( ch[pos] ) { - - if ( ch[pos] == '<' ) { - tags++; - intag = TRUE; - } - else if ( ch[pos] == '\n' ) { - l_nl = pos; - } - else if ( ch[pos] == '>' ) { - l_gt = pos; - intag = FALSE; - } - else if ( ch[pos] == ' ' ) { - /* ignore spaces inside tags */ - if ( !intag ) - l_sp = pos; - } - else if ( ( ch[pos] == 'w' ) && ( pos + 4 < mx->msg->len ) && ( memcmp( &ch[pos], "www.", 4 ) == 0 ) ) { - tags += 2; - } - else if ( ( ch[pos] == 'h' ) && ( pos + 8 < mx->msg->len ) && ( memcmp( &ch[pos], "http://", 7 ) == 0 ) ) { - tags += 2; - } - - if ( tags > MXIT_MAX_MSG_TAGS ) { - /* we have reached the maximum amount of tags pidgin (gtk) can handle per message. - so its time to send what we have and then start building a new message */ - - /* now find the right place to break the message */ - if ( l_nl > start ) { - /* break at last '\n' char */ - stop = l_nl; - ch[stop] = '\0'; - msg = g_string_new( &ch[start] ); - ch[stop] = '\n'; - } - else if ( l_sp > start ) { - /* break at last ' ' char */ - stop = l_sp; - ch[stop] = '\0'; - msg = g_string_new( &ch[start] ); - ch[stop] = ' '; - } - else { - /* break at the last '>' char */ - char t; - stop = l_gt + 1; - t = ch[stop]; - ch[stop] = '\0'; - msg = g_string_new( &ch[start] ); - ch[stop] = t; - stop--; - } - - /* build the string */ - if ( segs ) - g_string_prepend( msg, cont ); - - /* push message to pidgin */ - serv_got_im( mx->session->con, mx->from, msg->str, mx->flags, mx->timestamp ); - g_string_free( msg, TRUE ); - msg = NULL; - - tags = 0; - segs++; - start = stop + 1; - } - - pos++; - } - - if ( start != pos ) { - /* send the last part of the message */ - - /* build the string */ - ch[pos] = '\0'; - msg = g_string_new( &ch[start] ); - ch[pos] = '\n'; - if ( segs ) - g_string_prepend( msg, cont ); - - /* push message to pidgin */ - serv_got_im( mx->session->con, mx->from, msg->str, mx->flags, mx->timestamp ); - g_string_free( msg, TRUE ); - msg = NULL; - } -} - - -/*------------------------------------------------------------------------ - * Insert custom emoticons and inline images into the message (if there - * are any), then give the message to the UI to display to the user. - * - * @param mx The received message object - */ -void mxit_show_message( struct RXMsgData* mx ) -{ - char* pos; - int start; - unsigned int end; - int emo_ofs; - char ii[128]; - char tag[64]; - int* img_id; - - if ( mx->got_img ) { - /* search and replace all emoticon tags with proper image tags */ - - while ( ( pos = strstr( mx->msg->str, MXIT_II_TAG ) ) != NULL ) { - start = pos - mx->msg->str; /* offset at which MXIT_II_TAG starts */ - emo_ofs = start + strlen( MXIT_II_TAG ); /* offset at which EMO's ID starts */ - end = emo_ofs + 1; /* offset at which MXIT_II_TAG ends */ - - while ( ( end < mx->msg->len ) && ( mx->msg->str[end] != '>' ) ) - end++; - - if ( end == mx->msg->len ) /* end of emoticon tag not found */ - break; - - memset( ii, 0x00, sizeof( ii ) ); - memcpy( ii, &mx->msg->str[emo_ofs], end - emo_ofs ); - - /* remove inline image tag */ - g_string_erase( mx->msg, start, ( end - start ) + 1 ); - - /* find the image entry */ - img_id = (int*) g_hash_table_lookup( mx->session->iimages, ii ); - if ( !img_id ) { - /* inline image not found, so we will just skip it */ - purple_debug_error( MXIT_PLUGIN_ID, "inline image NOT found (%s)\n", ii ); - } - else { - /* insert img tag */ - g_snprintf( tag, sizeof( tag ), "", *img_id ); - g_string_insert( mx->msg, start, tag ); - } - } - } - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup RX (converted): '%s'\n", mx->msg->str ); -#endif - - if ( mx->processed ) { - /* this message has already been taken care of, so just ignore it here */ - } - else if ( mx->chatid < 0 ) { - /* normal chat message */ - mxit_show_split_message( mx ); - } - else { - /* this is a multimx message */ - serv_got_chat_in( mx->session->con, mx->chatid, mx->from, mx->flags, mx->msg->str, mx->timestamp); - } - - /* freeup resource */ - free_markupdata( mx ); -} - - -/*------------------------------------------------------------------------ - * Extract the custom emoticon ID from the message. - * - * @param message The input data - * @param emid The extracted emoticon ID - */ -static void parse_emoticon_str( const char* message, char* emid ) -{ - int i; - - for ( i = 0; ( message[i] != '\0' && message[i] != '}' && i < MXIT_MAX_EMO_ID ); i++ ) { - emid[i] = message[i]; - } - - if ( message[i] == '\0' ) { - /* end of message reached, ignore the tag */ - emid[0] = '\0'; - } - else if ( i == MXIT_MAX_EMO_ID ) { - /* invalid tag length, ignore the tag */ - emid[0] = '\0'; - } - else - emid[i] = '\0'; -} - - -/*------------------------------------------------------------------------ - * Callback function invoked when a custom emoticon request to the WAP site completes. - * - * @param url_data - * @param user_data The Markup message object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void emoticon_returned( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct RXMsgData* mx = (struct RXMsgData*) user_data; - const char* data = url_text; - unsigned int pos = 0; - char emo[16]; - int id; - char* str; - int em_size = 0; - char* em_data = NULL; - char* em_id = NULL; - int* intptr = NULL; - int res; - -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "emoticon_returned\n" ); -#endif - - if ( !url_text ) { - /* no reply from the WAP site */ - purple_debug_error( MXIT_PLUGIN_ID, "Error contacting the MXit WAP site. Please try again later (emoticon).\n" ); - goto done; - } - -#ifdef MXIT_DEBUG_EMO - hex_dump( data, len ); -#endif - - /* parse out the emoticon */ - pos = 0; - - /* validate the binary data received from the wapsite */ - if ( memcmp( MXIT_FRAME_MAGIC, &data[pos], strlen( MXIT_FRAME_MAGIC ) ) != 0 ) { - /* bad data, magic constant is wrong */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad magic)\n" ); - goto done; - } - pos += strlen( MXIT_FRAME_MAGIC ); - - /* validate the image frame desc byte */ - if ( data[pos] != '\x6F' ) { - /* bad frame desc */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad frame desc)\n" ); - goto done; - } - pos++; - - /* get the data length */ - res = asn_getlength( &data[pos], &em_size ); - if ( res <= 0 ) { - /* bad frame length */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad frame length)\n" ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the length '%i'\n", em_size ); -#endif - - /* utf-8 (emoticon name) */ - res = asn_getUtf8( &data[pos], 0x0C, &str ); - if ( res <= 0 ) { - /* bad utf-8 string */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad name string)\n" ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the string '%s'\n", str ); -#endif - g_free( str ); - str = NULL; - - /* utf-8 (emoticon shortcut) */ - res = asn_getUtf8( &data[pos], 0x81, &str ); - if ( res <= 0 ) { - /* bad utf-8 string */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad shortcut string)\n" ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the string '%s'\n", str ); -#endif - em_id = str; - - /* validate the image data type */ - if ( data[pos] != '\x82' ) { - /* bad frame desc */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad data type)\n" ); - g_free( em_id ); - goto done; - } - pos++; - - /* get the data length */ - res = asn_getlength( &data[pos], &em_size ); - if ( res <= 0 ) { - /* bad frame length */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad data length)\n" ); - g_free( em_id ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the length '%i'\n", em_size ); -#endif - - if ( g_hash_table_lookup( mx->session->iimages, em_id ) ) { - /* emoticon found in the table, so ignore this one */ - goto done; - } - - /* make a copy of the data */ - em_data = g_malloc( em_size ); - memcpy( em_data, &data[pos], em_size ); - - /* strip the mxit markup tags from the emoticon id */ - if ( ( em_id[0] == '.' ) && ( em_id[1] == '{' ) ) { - parse_emoticon_str( &em_id[2], emo ); - strcpy( em_id, emo ); - } - - /* we now have the emoticon, store it in the imagestore */ - id = purple_imgstore_add_with_id( em_data, em_size, NULL ); - - /* map the mxit emoticon id to purple image id */ - intptr = g_malloc( sizeof( int ) ); - *intptr = id; - g_hash_table_insert( mx->session->iimages, em_id, intptr ); - - mx->flags |= PURPLE_MESSAGE_IMAGES; -done: - mx->img_count--; - if ( ( mx->img_count == 0 ) && ( mx->converted ) ) { - /* - * this was the last outstanding emoticon for this message, - * so we can now display it to the user. - */ - mxit_show_message( mx ); - } -} - - -/*------------------------------------------------------------------------ - * Send a request to the MXit WAP site to download the specified emoticon. - * - * @param mx The Markup message object - * @param id The ID for the emoticon - */ -static void emoticon_request( struct RXMsgData* mx, const char* id ) -{ - PurpleUtilFetchUrlData* url_data; - const char* wapserver; - char* url; - - purple_debug_info( MXIT_PLUGIN_ID, "sending request for emoticon '%s'\n", id ); - - wapserver = purple_account_get_string( mx->session->acc, MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE ); - - /* reference: "libpurple/util.h" */ - url = g_strdup_printf( "%s/res/?type=emo&mlh=%i&sc=%s&ts=%li", wapserver, MXIT_EMOTICON_SIZE, id, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, NULL, TRUE, NULL, FALSE, emoticon_returned, mx ); - g_free( url ); -} - - -/*------------------------------------------------------------------------ - * Parse a Vibe command. - * - * @param mx The Markup message object - * @param message The message text (which contains the vibe) - * @return id The length of the message to skip - */ -static int mxit_parse_vibe( struct RXMsgData* mx, const char* message ) -{ - int vibeid; - - vibeid = message[2] - '0'; - - purple_debug_info( MXIT_PLUGIN_ID, "Vibe received (%i)\n", vibeid ); - - if ( vibeid > ( ARRAY_SIZE( vibes ) - 1 ) ) { - purple_debug_warning( MXIT_PLUGIN_ID, "Unsupported vibe received (%i)\n", vibeid ); - /* unsupported vibe */ - return 0; - } - - g_string_append_printf( mx->msg, "%s Vibe...", MXIT_VIBE_MSG_COLOR, _( vibes[vibeid] ) ); - return 2; -} - - -/*------------------------------------------------------------------------ - * Extract the nickname from a chatroom message and display it nicely in - * libPurple-style (HTML) markup. - * - * @param mx The received message data object - * @param message The message text - * @return The length of the message to skip - */ -static int mxit_extract_chatroom_nick( struct RXMsgData* mx, char* message, int len ) -{ - int i; - - if ( message[0] == '<' ) { - /* - * The message MIGHT contains an embedded nickname. But we can't - * be sure unless we find the end-of-nickname sequence: (>\n) - * Search for it.... - */ - gboolean found = FALSE; - gchar* nickname; - - for ( i = 1; i < len; i++ ) { - if ( ( message[i] == '\n' ) && ( message[i-1] == '>' ) ) { - found = TRUE; - message[i-1] = '\0'; /* loose the '>' */ - i++; /* and skip the new-line */ - break; - } - } - - if ( found ) { - /* - * The message definitely had an embedded nickname - generate a marked-up - * message to be displayed. - */ - nickname = g_markup_escape_text( &message[1], -1 ); - - /* add nickname within some BOLD markup to the new converted message */ - g_string_append_printf( mx->msg, "%s: ", nickname ); - - /* free up the resources */ - g_free( nickname ); - - return i; - } - } - - return 0; -} - - - -/*------------------------------------------------------------------------ - * Convert a message containing MXit protocol markup to libPurple-style (HTML) markup. - * - * @param mx The received message data object - * @param message The message text - * @param len The length of the message - */ -void mxit_parse_markup( struct RXMsgData* mx, char* message, int len, short msgtype, int msgflags ) -{ - char tmpstr1[128]; - char* ch; - int i = 0; - - /* tags */ - gboolean tag_bold = FALSE; - gboolean tag_under = FALSE; - gboolean tag_italic = FALSE; - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup RX (original): '%s'\n", message ); -#endif - - - /* - * supported MXit markup: - * '*' bold - * '_' underline - * '/' italics - * '$' highlight text - * '.+' inc font size - * '.-' dec font size - * '#XXXXXX' foreground color - * '.{XX}' custom emoticon - * '\' escape the following character - * '::' MXit commands - */ - - - if ( is_mxit_chatroom_contact( mx->session, mx->from ) ) { - /* chatroom message, so we need to extract and skip the sender's nickname - * which is embedded inside the message */ - i = mxit_extract_chatroom_nick( mx, message, len ); - } - - /* run through the message and check for custom emoticons and markup */ - for ( ; i < len; i++ ) { - switch ( message[i] ) { - - - /* mxit markup parsing */ - case '*' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - - /* bold markup */ - if ( !tag_bold ) - g_string_append( mx->msg, "" ); - else - g_string_append( mx->msg, "" ); - tag_bold = !tag_bold; - break; - case '_' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - - /* underscore markup */ - if ( !tag_under ) - g_string_append( mx->msg, "" ); - else - g_string_append( mx->msg, "" ); - tag_under = !tag_under; - break; - case '/' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - - /* italics markup */ - if ( !tag_italic ) - g_string_append( mx->msg, "" ); - else - g_string_append( mx->msg, "" ); - tag_italic = !tag_italic; - break; - case '$' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + 1 >= len ) { - /* message too short for complete link */ - g_string_append_c( mx->msg, '$' ); - break; - } - - /* find the end tag */ - ch = strstr( &message[i + 1], "$" ); - if ( ch ) { - /* end found */ - *ch = '\0'; - mxit_add_html_link( mx, &message[i + 1], &message[i + 1] ); - *ch = '$'; - i += ( ch - &message[i + 1] ) + 1; - } - else { - g_string_append_c( mx->msg, message[i] ); - } - /* highlight text */ - break; - case '#' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + COLORCODE_LEN >= len ) { - /* message too short for complete colour code */ - g_string_append_c( mx->msg, '#' ); - break; - } - - /* foreground (text) color */ - memcpy( tmpstr1, &message[i + 1], COLORCODE_LEN ); - tmpstr1[ COLORCODE_LEN ] = '\0'; /* terminate string */ - if ( strcmp( tmpstr1, "??????" ) == 0 ) { - /* need to reset the font */ - g_string_append( mx->msg, "" ); - i += COLORCODE_LEN; - } - else if ( strspn( tmpstr1, "0123456789abcdefABCDEF") == COLORCODE_LEN ) { - /* definitely a numeric colour code */ - g_string_append_printf( mx->msg, "", tmpstr1 ); - i += COLORCODE_LEN; - } - else { - /* not valid colour markup */ - g_string_append_c( mx->msg, '#' ); - } - break; - case '.' : - if ( !( msgflags & CP_MSG_EMOTICON ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + 1 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, '.' ); - break; - } - - switch ( message[i+1] ) { - case '+' : - /* increment text size */ - g_string_append( mx->msg, "" ); - i++; - break; - case '-' : - /* decrement text size */ - g_string_append( mx->msg, "" ); - i++; - break; - case '{' : - /* custom emoticon */ - if ( i + 2 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, '.' ); - break; - } - - parse_emoticon_str( &message[i+2], tmpstr1 ); - if ( tmpstr1[0] != '\0' ) { - mx->got_img = TRUE; - - if ( g_hash_table_lookup( mx->session->iimages, tmpstr1 ) ) { - /* emoticon found in the cache, so we do not have to request it from the WAPsite */ - } - else { - /* request emoticon from the WAPsite */ - mx->img_count++; - emoticon_request( mx, tmpstr1 ); - } - - g_string_append_printf( mx->msg, MXIT_II_TAG"%s>", tmpstr1 ); - i += strlen( tmpstr1 ) + 2; - } - else - g_string_append_c( mx->msg, '.' ); - - break; - default : - g_string_append_c( mx->msg, '.' ); - break; - } - break; - case '\\' : - if ( i + 1 >= len ) { - /* message too short for an escaped character */ - g_string_append_c( mx->msg, '\\' ); - } - else { - /* ignore the next character, because its been escaped */ - g_string_append_c( mx->msg, message[i + 1] ); - i++; - } - break; - - - /* command parsing */ - case ':' : - if ( i + 1 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, ':' ); - break; - } - - if ( message[i+1] == '@' ) { - /* this is a vibe! */ - int size; - - if ( i + 2 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, message[i] ); - break; - } - - size = mxit_parse_vibe( mx, &message[i] ); - if ( size == 0 ) - g_string_append_c( mx->msg, message[i] ); - else - i += size; - } - else if ( msgtype != CP_MSGTYPE_COMMAND ) { - /* this is not a command message */ - g_string_append_c( mx->msg, message[i] ); - } - else if ( message[i+1] == ':' ) { - /* parse out the command */ - int size; - - size = mxit_parse_command( mx, &message[i] ); - if ( size == 0 ) - g_string_append_c( mx->msg, ':' ); - else - i += size; - } - else { - g_string_append_c( mx->msg, ':' ); - } - break; - - - /* these aren't MXit markup, but are interpreted by libPurple */ - case '<' : - g_string_append( mx->msg, "<" ); - break; - case '>' : - g_string_append( mx->msg, ">" ); - break; - case '&' : - g_string_append( mx->msg, "&" ); - break; - case '"' : - g_string_append( mx->msg, """ ); - break; - - default : - /* text */ - g_string_append_c( mx->msg, message[i] ); - break; - } - } -} - - -/*------------------------------------------------------------------------ - * Insert an inline image command. - * - * @param mx The message text as processed so far. - * @oaram id The imgstore ID of the inline image. - */ -static void inline_image_add( GString* mx, int id ) -{ - PurpleStoredImage *image; - gconstpointer img_data; - gsize img_size; - gchar* enc; - - image = purple_imgstore_find_by_id( id ); - if ( image == NULL ) - return; - - img_data = purple_imgstore_get_data( image ); - img_size = purple_imgstore_get_size( image ); - - enc = purple_base64_encode( img_data, img_size ); - - g_string_append( mx, "::op=img|dat=" ); - g_string_append( mx, enc ); - g_string_append_c( mx, ':' ); - - g_free( enc ); -} - - -/*------------------------------------------------------------------------ - * Convert libpurple (HTML) markup to MXit protocol markup (for sending to MXit). - * Any MXit markup codes in the original message also need to be escaped. - * - * @param message The message text containing libPurple (HTML) markup - * @return The message text containing MXit markup - */ -char* mxit_convert_markup_tx( const char* message, int* msgtype ) -{ - GString* mx; - struct tag* tag; - GList* entry; - GList* tagstack = NULL; - char* reply; - char color[8]; - int len = strlen ( message ); - int i; - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup TX (original): '%s'\n", message ); -#endif - - /* - * libPurple uses the following HTML markup codes: - * Bold: ... - * Italics: ... - * Underline: ... - * Strikethrough: ... (NO MXIT SUPPORT) - * Font size: ... - * Font type: ... (NO MXIT SUPPORT) - * Font colour: ... - * Links: ... - * Newline:
- * Inline image: - * The following characters are also encoded: - * & " < > - */ - - /* new message data */ - mx = g_string_sized_new( len ); - - /* run through the message and check for HTML markup */ - for ( i = 0; i < len; i++ ) { - - switch ( message[i] ) { - case '<' : - if ( purple_str_has_prefix( &message[i], "" ) || purple_str_has_prefix( &message[i], "" ) ) { - /* bold */ - g_string_append_c( mx, '*' ); - } - else if ( purple_str_has_prefix( &message[i], "" ) || purple_str_has_prefix( &message[i], "" ) ) { - /* italics */ - g_string_append_c( mx, '/' ); - } - else if ( purple_str_has_prefix( &message[i], "" ) || purple_str_has_prefix( &message[i], "" ) ) { - /* underline */ - g_string_append_c( mx, '_' ); - } - else if ( purple_str_has_prefix( &message[i], "
" ) ) { - /* newline */ - g_string_append_c( mx, '\n' ); - } - else if ( purple_str_has_prefix( &message[i], "" ) ) { - /* end of font tag */ - entry = g_list_last( tagstack ); - if ( entry ) { - tag = entry->data; - if ( tag->type == MXIT_TAG_COLOR ) { - /* font color reset */ - g_string_append( mx, "#??????" ); - } - else if ( tag->type == MXIT_TAG_SIZE ) { - /* font size */ - // TODO: implement size control - } - tagstack = g_list_remove( tagstack, tag ); - g_free( tag ); - } - } - else if ( purple_str_has_prefix( &message[i], "') */ - for ( i++; ( i < len ) && ( message[i] != '>' ) ; i++ ); - - break; - - case '*' : /* MXit bold */ - case '_' : /* MXit underline */ - case '/' : /* MXit italic */ - case '#' : /* MXit font color */ - case '$' : /* MXit highlight text */ - case '\\' : /* MXit escape backslash */ - g_string_append( mx, "\\" ); /* escape character */ - g_string_append_c( mx, message[i] ); /* character to escape */ - break; - - default: - g_string_append_c( mx, message[i] ); - break; - } - } - - /* unescape HTML entities to their literal characters (reference: "libpurple/utils.h") */ - reply = purple_unescape_html( mx->str ); - - g_string_free( mx, TRUE ); - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup TX (converted): '%s'\n", reply ); -#endif - - return reply; -} - - -/*------------------------------------------------------------------------ - * Free an emoticon entry. - * - * @param key MXit emoticon ID - * @param value Imagestore ID for emoticon - * @param user_data NULL (unused) - * @return TRUE - */ -static gboolean emoticon_entry_free( gpointer key, gpointer value, gpointer user_data ) -{ - int* imgid = value; - - /* key is a string */ - g_free( key ); - - /* value is 'id' in imagestore */ - purple_imgstore_unref_by_id( *imgid ); - g_free( value ); - - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Free all entries in the emoticon cache. - * - * @param session The MXit session object - */ -void mxit_free_emoticon_cache( struct MXitSession* session ) -{ - g_hash_table_foreach_remove( session->iimages, emoticon_entry_free, NULL ); - g_hash_table_destroy ( session->iimages ); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/markup.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- convert between MXit and libPurple markup -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_MARKUP_H_ -#define _MXIT_MARKUP_H_ - -#define MXIT_II_TAG " - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include - -#include "purple.h" -#include "prpl.h" - -#include "protocol.h" -#include "mxit.h" -#include "multimx.h" -#include "markup.h" - - -#if 0 -static void multimx_dump(struct multimx* multimx) -{ - purple_debug_info(MXIT_PLUGIN_ID, "MultiMX:\n"); - purple_debug_info(MXIT_PLUGIN_ID, " Chat ID: %i\n", multimx->chatid); - purple_debug_info(MXIT_PLUGIN_ID, " Username: %s\n", multimx->roomid); - purple_debug_info(MXIT_PLUGIN_ID, " Alias: %s\n", multimx->roomname); - purple_debug_info(MXIT_PLUGIN_ID, " State: %i\n", multimx->state); -} -#endif - - -/*------------------------------------------------------------------------ - * Find a MultiMx session based on libpurple chatID. - * - * @param session The MXit session object - * @param id The libpurple group-chat ID - * @return The MultiMX room object (or NULL if not found) - */ -static struct multimx* find_room_by_id(struct MXitSession* session, int id) -{ - GList* x = session->rooms; - - while (x != NULL) { - struct multimx* multimx = (struct multimx *) x->data; - - if (multimx->chatid == id) - return multimx; - - x = g_list_next(x); - } - - return NULL; -} - - -/*------------------------------------------------------------------------ - * Find a MultiMx session based on Alias - * - * @param session The MXit session object - * @param roomname The UI room-name - * @return The MultiMX room object (or NULL if not found) - */ -static struct multimx* find_room_by_alias(struct MXitSession* session, const char* roomname) -{ - GList* x = session->rooms; - - while (x != NULL) { - struct multimx* multimx = (struct multimx *) x->data; - - if (!strcmp(multimx->roomname, roomname)) - return multimx; - - x = g_list_next(x); - } - - return NULL; -} - - -/*------------------------------------------------------------------------ - * Find a MultiMx session based on Username (MXit RoomId) - * - * @param session The MXit session object - * @param username The MXit RoomID (MultiMX contact username) - * @return The MultiMX room object (or NULL if not found) - */ -static struct multimx* find_room_by_username(struct MXitSession* session, const char* username) -{ - GList* x = session->rooms; - - while (x != NULL) { - struct multimx* multimx = (struct multimx *) x->data; - - if (!strcmp(multimx->roomid, username)) - return multimx; - - x = g_list_next(x); - } - - return NULL; -} - - -/*------------------------------------------------------------------------ - * Create a GroupChat room, and add to list of rooms. - * - * @param session The MXit session object - * @param roomid The MXit RoomID (MultiMX contact username) - * @param roomname The UI room-name - * @param state The initial state of the room (see multimx.h) - * @return The MultiMX room object - */ -static struct multimx* room_create(struct MXitSession* session, const char* roomid, const char* roomname, short state) -{ - struct multimx* multimx = NULL; - static int groupchatID = 1; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat create - roomid='%s' roomname='%s'\n", roomid, roomname); - - /* Create a new GroupChat */ - multimx = g_new0(struct multimx, 1); - - /* Initialize groupchat */ - g_strlcpy(multimx->roomid, roomid, sizeof(multimx->roomid)); - g_strlcpy(multimx->roomname, roomname, sizeof(multimx->roomname)); - multimx->chatid = groupchatID++; - multimx->state = state; - - /* Add to GroupChat list */ - session->rooms = g_list_append(session->rooms, multimx); - - return multimx; -} - - -/*------------------------------------------------------------------------ - * Free the Groupchat room. - * - * @param session The MXit session object - * @param multimx The MultiMX room object to deallocate - */ -static void room_remove(struct MXitSession* session, struct multimx* multimx) -{ - /* Remove from GroupChat list */ - session->rooms = g_list_remove(session->rooms, multimx); - - /* Deallocate it */ - free (multimx); - multimx = NULL; -} - - -/*------------------------------------------------------------------------ - * Another user has join the GroupChat, add them to the member-list. - * - * @param session The MXit session object - * @param multimx The MultiMX room object - * @param nickname The nickname of the user who joined the room - */ -static void member_added(struct MXitSession* session, struct multimx* multimx, const char* nickname) -{ - PurpleConversation *convo; - - purple_debug_info(MXIT_PLUGIN_ID, "member_added: '%s'\n", nickname); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); - if (convo == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); - return; - } - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nickname, NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - - -/*------------------------------------------------------------------------ - * Another user has left the GroupChat, remove them from the member-list. - * - * @param session The MXit session object - * @param multimx The MultiMX room object - * @param nickname The nickname of the user who left the room - */ -static void member_removed(struct MXitSession* session, struct multimx* multimx, const char* nickname) -{ - PurpleConversation *convo; - - purple_debug_info(MXIT_PLUGIN_ID, "member_removed: '%s'\n", nickname); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); - if (convo == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); - return; - } - - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nickname, NULL); -} - - -/*------------------------------------------------------------------------ - * Update the full GroupChat member list. - * - * @param session The MXit session object - * @param multimx The MultiMX room object - * @param data The nicknames of the users in the room (separated by \n) - */ -static void member_update(struct MXitSession* session, struct multimx* multimx, char* data) -{ - PurpleConversation *convo; - gchar** userlist; - int i = 0; - - purple_debug_info(MXIT_PLUGIN_ID, "member_update: '%s'\n", data); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); - if (convo == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); - return; - } - - /* Clear list */ - purple_conv_chat_clear_users(PURPLE_CONV_CHAT(convo)); - - /* Add each member */ - data = g_strstrip(data); /* string leading & trailing whitespace */ - userlist = g_strsplit(data, "\n", 0); /* tokenize string */ - while (userlist[i] != NULL) { - purple_debug_info(MXIT_PLUGIN_ID, "member_update - adding: '%s'\n", userlist[i]); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), userlist[i], NULL, PURPLE_CBFLAGS_NONE, FALSE); - i++; - } - g_strfreev(userlist); -} - - -/* ------------------------------------------------------------------------------------------------- - * Calls from MXit Protocol layer - * ------------------------------------------------------------------------------------------------- */ - -/*------------------------------------------------------------------------ - * Received a Subscription Request to a MultiMX room. - * - * @param session The MXit session object - * @param contact The invited MultiMX room's contact information - * @param creator The nickname of the room's creator / invitor - */ -void multimx_invite(struct MXitSession* session, struct contact* contact, const char* creator) -{ - GHashTable *components; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' by '%s'\n", contact->alias, creator); - - /* Create a new room */ - multimx = room_create(session, contact->username, contact->alias, STATE_INVITED); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, g_strdup("room"), g_strdup(contact->alias)); - - /* Call libpurple - will trigger either 'mxit_chat_join' or 'mxit_chat_reject' */ - serv_got_chat_invite(session->con, contact->alias, creator, NULL, components); -} - - -/*------------------------------------------------------------------------ - * MultiMX room has been added to the roster. - * - * @param session The MXit session object - * @param contact The MultiMX room's contact information - */ -void multimx_created(struct MXitSession* session, struct contact* contact) -{ - PurpleConnection *gc = session->con; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat '%s' created as '%s'\n", contact->alias, contact->username); - - /* Find matching MultiMX group */ - multimx = find_room_by_username(session, contact->username); - if (multimx == NULL) { - multimx = room_create(session, contact->username, contact->alias, TRUE); - } - else if (multimx->state == STATE_INVITED) { - /* After successfully accepting an invitation */ - multimx->state = STATE_JOINED; - } - - /* Call libpurple - will trigger 'mxit_chat_join' */ - serv_got_joined_chat(gc, multimx->chatid, multimx->roomname); - - /* Send ".list" command to GroupChat server to retrieve current member-list */ - mxit_send_message(session, multimx->roomid, ".list", FALSE); -} - - -/*------------------------------------------------------------------------ - * Is this username a MultiMX contact? - * - * @param session The MXit session object - * @param username The username of the contact - * @return TRUE if this contacts matches the RoomID of a MultiMX room. - */ -gboolean is_multimx_contact(struct MXitSession* session, const char* username) -{ - /* Check for username in list of open rooms */ - return (find_room_by_username(session, username) != NULL); -} - - -/*------------------------------------------------------------------------ - * Received a message from a MultiMX room. - * - */ -void multimx_message_received(struct RXMsgData* mx, char* msg, int msglen, short msgtype, int msgflags) -{ - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat message received: %s\n", msg); - - /* Find matching multimx group */ - multimx = find_room_by_username(mx->session, mx->from); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Groupchat '%s' not found\n", mx->from); - return; - } - - /* Determine if system message or a message from a contact */ - if (msg[0] == '<') { - /* Message contains embedded nickname - must be from contact */ - unsigned int i; - - for (i = 1; i < strlen(msg); i++) { /* search for end of nickname */ - if (msg[i] == '>') { - msg[i] = '\0'; - g_free(mx->from); - mx->from = g_strdup(&msg[1]); - msg = &msg[i+2]; /* skip '>' and newline */ - break; - } - } - - /* now do markup processing on the message */ - mx->chatid = multimx->chatid; - mxit_parse_markup(mx, msg, strlen(msg), msgtype, msgflags); - } - else { - /* Must be a service message */ - char* ofs; - - /* Determine if somebody has joined or left - update member-list */ - if ((ofs = strstr(msg, " has joined")) != NULL) { - /* Somebody has joined */ - *ofs = '\0'; - member_added(mx->session, multimx, msg); - mx->processed = TRUE; - } - else if ((ofs = strstr(msg, " has left")) != NULL) { - /* Somebody has left */ - *ofs = '\0'; - member_removed(mx->session, multimx, msg); - mx->processed = TRUE; - } - else if (g_str_has_prefix(msg, "The following users are in this MultiMx:") == TRUE) { - member_update(mx->session, multimx, msg + strlen("The following users are in this MultiMx:") + 1); - mx->processed = TRUE; - } - else { - /* Display server message in chat window */ - serv_got_chat_in(mx->session->con, multimx->chatid, "MXit", PURPLE_MESSAGE_SYSTEM, msg, mx->timestamp); - mx->processed = TRUE; - } - } -} - - - -/* ------------------------------------------------------------------------------------------------- - * Callbacks from libpurple - * ------------------------------------------------------------------------------------------------- */ - -/*------------------------------------------------------------------------ - * User has selected "Add Chat" from the main menu. - * - * @param gc The connection object - * @return A list of chat configuration values - */ -GList* mxit_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - /* Configuration option: Room Name */ - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _( "_Room Name:" ); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - - -/*------------------------------------------------------------------------ - * User has joined a chatroom, either because they are creating it or they - * accepted an invite. - * - * @param gc The connection object - * @param components The list of chat configuration values - */ -void mxit_chat_join(PurpleConnection *gc, GHashTable *components) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* roomname = NULL; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "mxit_chat_join\n"); - - /* Determine if groupchat already exists */ - roomname = g_hash_table_lookup(components, "room"); - multimx = find_room_by_alias(session, roomname); - - if (multimx != NULL) { - /* The room information already exists */ - - if (multimx->state == STATE_INVITED) { - /* Invite is pending */ - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i accept sent\n", multimx->chatid); - - /* Send Subscription Accept to MXit */ - mxit_send_allow_sub(session, multimx->roomid, multimx->roomname); - } - else { - /* Join existing room */ - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i rejoined\n", multimx->chatid); - - serv_got_joined_chat(gc, multimx->chatid, multimx->roomname); - } - } - else { - /* Send Groupchat Create to MXit */ - mxit_send_groupchat_create(session, roomname, 0, NULL); - } -} - - -/*------------------------------------------------------------------------ - * User has rejected an invite to join a MultiMX room. - * - * @param gc The connection object - * @param components The list of chat configuration values - */ -void mxit_chat_reject(PurpleConnection *gc, GHashTable* components) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* roomname = NULL; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "mxit_chat_reject\n"); - - roomname = g_hash_table_lookup(components, "room"); - multimx = find_room_by_alias(session, roomname); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Groupchat '%s' not found\n", roomname); - return; - } - - /* Send Subscription Reject to MXit */ - mxit_send_deny_sub(session, multimx->roomid); - - /* Remove from our list of rooms */ - room_remove(session, multimx); -} - - -/*------------------------------------------------------------------------ - * Return name of chatroom (on mouse hover) - * - * @param components The list of chat configuration values. - * @return The name of the chat room - */ -char* mxit_chat_name(GHashTable *components) -{ - return g_strdup(g_hash_table_lookup(components, "room")); -} - - -/*------------------------------------------------------------------------ - * User has selected to invite somebody to a chatroom. - * - * @param gc The connection object - * @param id The chat room ID - * @param msg The invitation message entered by the user - * @param name The username of the person to invite - */ -void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *username) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s'\n", username); - - /* Find matching MultiMX group */ - multimx = find_room_by_id(session, id); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Could not find groupchat %i\n", id); - return; - } - - /* Send invite to MXit */ - mxit_send_groupchat_invite(session, multimx->roomid, 1, &username); -} - - -/*------------------------------------------------------------------------ - * User as closed the chat window, and the chatroom is not marked as persistent. - * - * @param gc The connection object - * @param id The chat room ID - */ -void mxit_chat_leave(PurpleConnection *gc, int id) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i leave\n", id); - - /* Find matching multimx group */ - multimx = find_room_by_id(session, id); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Could not find groupchat %i\n", id); - return; - } - - /* Send Remove Groupchat to MXit */ - mxit_send_remove(session, multimx->roomid); - - /* Remove from our list of rooms */ - room_remove(session, multimx); -} - - -/*------------------------------------------------------------------------ - * User has entered a message in a chatroom window, send it to the MXit server. - * - * @param gc The connection object - * @param id The chat room ID - * @param message The sent message data - * @param flags The message flags - * @return Indicates success / failure - */ -int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct multimx* multimx = NULL; - const char* nickname; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i message send: '%s'\n", id, message); - - /* Find matching MultiMX group */ - multimx = find_room_by_id(session, id); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Could not find groupchat %i\n", id); - return -1; - } - - /* Send packet to MXit */ - mxit_send_message(session, multimx->roomid, message, TRUE); - - /* Determine our nickname to display */ - if (session->profile && (session->profile->nickname[0] != '\0')) /* default is profile name (since that's what everybody else sees) */ - nickname = session->profile->nickname; - else - nickname = purple_account_get_alias(purple_connection_get_account(gc)); /* local alias */ - - /* Display message in chat window */ - serv_got_chat_in(gc, id, nickname, flags, message, time(NULL)); - - return 0; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/multimx.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/multimx.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/multimx.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/multimx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MultiMx GroupChat -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_MULTIMX_H_ -#define _MXIT_MULTIMX_H_ - -#include "roster.h" - - -/* GroupChat Room state */ -#define STATE_CREATOR 0 -#define STATE_INVITED 1 -#define STATE_JOINED 2 - -/* - * a MultiMX room - */ -struct multimx { - char roomname[MXIT_CP_MAX_ALIAS_LEN]; /* name of the room */ - char roomid[MXIT_CP_MAX_JID_LEN]; /* internal JID for room */ - int chatid; /* libpurple chat ID */ - short state; /* state */ -}; - - -/* - * Received a Subscription Request to a MultiMX room. - */ -void multimx_invite(struct MXitSession* session, struct contact* contact, const char* creator); - -/* - * MultiMX room has been added to the roster. - */ -void multimx_created(struct MXitSession* session, struct contact* contact); - -/* - * Is this username a MultiMX contact? - */ -gboolean is_multimx_contact(struct MXitSession* session, const char* username); - -/* - * Received a message from a MultiMX room. - */ -void multimx_message_received(struct RXMsgData* mx, char* message, int len, short msgtype, int msgflags); - -/* - * User has selected "Add Chat" from the main menu. - */ -GList* mxit_chat_info(PurpleConnection *gc); - -/* - * User has joined a chatroom, either because they are creating it or they accepted an invite. - */ -void mxit_chat_join(PurpleConnection *gc, GHashTable *data); - -/* - * User has rejected an invite to join a MultiMX room. - */ -void mxit_chat_reject(PurpleConnection *gc, GHashTable* components); - -/* - * Return name of chatroom (on mouse hover) - */ -char* mxit_chat_name(GHashTable *data); - -/* - * User has selected to invite somebody to a chatroom. - */ -void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *name); - -/* - * User as closed the chat window, and the chatroom is not marked as persistent. - */ -void mxit_chat_leave(PurpleConnection *gc, int id); - -/* - * User has entered a message in a chatroom window, send it to the MXit server. - */ -int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); - - -#endif /* _MXIT_MULTIMX_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,695 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit libPurple plugin API -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" -#include "notify.h" -#include "plugin.h" -#include "version.h" - -#include "mxit.h" -#include "protocol.h" -#include "login.h" -#include "roster.h" -#include "chunk.h" -#include "filexfer.h" -#include "actions.h" -#include "multimx.h" - - -#ifdef MXIT_LINK_CLICK - - -/* pidgin callback function pointers for URI click interception */ -static void *(*mxit_pidgin_uri_cb)(const char *uri); -static PurpleNotifyUiOps* mxit_nots_override_original; -static PurpleNotifyUiOps mxit_nots_override; -static int not_link_ref_count = 0; - - -/*------------------------------------------------------------------------ - * Handle an URI clicked on the UI - * - * @param link the link name which has been clicked - */ -static void* mxit_link_click( const char* link64 ) -{ - PurpleAccount* account; - PurpleConnection* con; - gchar** parts = NULL; - gchar* link = NULL; - gsize len; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_link_click (%s)\n", link64 ); - - if ( g_ascii_strncasecmp( link64, MXIT_LINK_PREFIX, strlen( MXIT_LINK_PREFIX ) ) != 0 ) { - /* this is not for us */ - goto skip; - } - - /* decode the base64 payload */ - link = (gchar*) purple_base64_decode( link64 + strlen( MXIT_LINK_PREFIX ), &len ); - purple_debug_info( MXIT_PLUGIN_ID, "Clicked Link: '%s'\n", link ); - - parts = g_strsplit( link, "|", 5 ); - - /* check if this is a valid mxit link */ - if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) ) { - /* this is not for us */ - goto skip; - } - else if ( g_ascii_strcasecmp( parts[0], MXIT_LINK_KEY ) != 0 ) { - /* this is not for us */ - goto skip; - } - - /* find the account */ - account = purple_accounts_find( parts[1], parts[2] ); - if ( !account ) - goto skip; - con = purple_account_get_connection( account ); - - /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[4], FALSE ); - - g_free( link ); - link = NULL; - g_strfreev( parts ); - parts = NULL; - - return (void*) link64; - -skip: - /* this is not an internal mxit link */ - - if ( link ) - g_free( link ); - link = NULL; - - if ( parts ) - g_strfreev( parts ); - parts = NULL; - - if ( mxit_pidgin_uri_cb ) - return mxit_pidgin_uri_cb( link64 ); - else - return (void*) link64; -} - - -/*------------------------------------------------------------------------ - * Register MXit to receive URI click notifications from the UI - */ -void mxit_register_uri_handler(void) -{ - not_link_ref_count++; - if ( not_link_ref_count == 1 ) { - /* make copy of notifications */ - mxit_nots_override_original = purple_notify_get_ui_ops(); - memcpy( &mxit_nots_override, mxit_nots_override_original, sizeof( PurpleNotifyUiOps ) ); - - /* save previously configured callback function pointer */ - mxit_pidgin_uri_cb = mxit_nots_override.notify_uri; - - /* override the URI function call with MXit's own one */ - mxit_nots_override.notify_uri = mxit_link_click; - purple_notify_set_ui_ops( &mxit_nots_override ); - } -} - - -/*------------------------------------------------------------------------ - * Unegister MXit from receiving URI click notifications from the UI - */ -static void mxit_unregister_uri_handler() -{ - not_link_ref_count--; - if ( not_link_ref_count == 0 ) { - /* restore the notifications to its original state */ - purple_notify_set_ui_ops( mxit_nots_override_original ); - } -} - -#endif - - -/*------------------------------------------------------------------------ - * This gets called when a new chat conversation is opened by the user - * - * @param conv The conversation object - * @param session The MXit session object - */ -static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* session ) -{ - PurpleConnection* gc; - struct contact* contact; - PurpleBuddy* buddy; - const char* who; - char* tmp; - - gc = purple_conversation_get_gc( conv ); - if ( session->con != gc ) { - /* not our conversation */ - return; - } - else if ( purple_conversation_get_type( conv ) != PURPLE_CONV_TYPE_IM ) { - /* wrong type of conversation */ - return; - } - - /* get the contact name */ - who = purple_conversation_get_name( conv ); - if ( !who ) - return; - - purple_debug_info( MXIT_PLUGIN_ID, "Conversation started with '%s'\n", who ); - - /* find the buddy object */ - buddy = purple_find_buddy( session->acc, who ); - if ( ( !buddy ) || ( !buddy->proto_data ) ) - return; - - /* we ignore all conversations with which we have chatted with in this session */ - if ( find_active_chat( session->active_chats, who ) ) - return; - - /* determite if this buddy is a MXit service */ - contact = buddy->proto_data; - switch ( contact->type ) { - case MXIT_TYPE_BOT : - case MXIT_TYPE_CHATROOM : - case MXIT_TYPE_GALLERY : - case MXIT_TYPE_INFO : - tmp = g_strdup_printf("%s\n", _( "Loading menu..." )); - serv_got_im( session->con, who, tmp, PURPLE_MESSAGE_NOTIFY, time( NULL ) ); - g_free(tmp); - mxit_send_message( session, who, " ", FALSE ); - default : - break; - } -} - - -/*------------------------------------------------------------------------ - * Enable some signals to handled by our plugin - * - * @param session The MXit session object - */ -void mxit_enable_signals( struct MXitSession* session ) -{ - /* enable the signal when a new conversation is opened by the user */ - purple_signal_connect_priority( purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK( mxit_cb_chat_created ), - session, PURPLE_SIGNAL_PRIORITY_HIGHEST ); -} - - -/*------------------------------------------------------------------------ - * Disable some signals handled by our plugin - * - * @param session The MXit session object - */ -static void mxit_disable_signals( struct MXitSession* session ) -{ - /* disable the signal when a new conversation is opened by the user */ - purple_signal_disconnect( purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK( mxit_cb_chat_created ) ); -} - - -/*------------------------------------------------------------------------ - * Return the base icon name. - * - * @param account The MXit account object - * @param buddy The buddy - * @return The icon name (excluding extension) - */ -static const char* mxit_list_icon( PurpleAccount* account, PurpleBuddy* buddy ) -{ - return "mxit"; -} - - -/*------------------------------------------------------------------------ - * Return the emblem icon name. - * - * @param buddy The buddy - * @return The icon name (excluding extension) - */ -static const char* mxit_list_emblem( PurpleBuddy* buddy ) -{ - struct contact* contact = buddy->proto_data; - - if ( !contact ) - return NULL; - - switch ( contact-> type ) { - case MXIT_TYPE_JABBER : /* external contacts via MXit */ - case MXIT_TYPE_MSN : - case MXIT_TYPE_YAHOO : - case MXIT_TYPE_ICQ : - case MXIT_TYPE_AIM : - case MXIT_TYPE_QQ : - case MXIT_TYPE_WV : - return "external"; - - case MXIT_TYPE_BOT : /* MXit services */ - case MXIT_TYPE_GALLERY : - case MXIT_TYPE_INFO : - return "bot"; - - case MXIT_TYPE_CHATROOM : /* MXit group chat services */ - case MXIT_TYPE_MULTIMX : - default: - return NULL; - } -} - - -/*------------------------------------------------------------------------ - * Return short string representing buddy's status for display on buddy list. - * Returns status message (if one is set), or otherwise the mood. - * - * @param buddy The buddy. - * @return The status text - */ -char* mxit_status_text( PurpleBuddy* buddy ) -{ - struct contact* contact = buddy->proto_data; - - if ( !contact ) - return NULL; - - if ( contact->statusMsg ) { - /* status message */ - return g_strdup( contact-> statusMsg ); - } - else { - /* mood */ - return g_strdup( mxit_convert_mood_to_name( contact->mood ) ); - } -} - - -/*------------------------------------------------------------------------ - * Return UI tooltip information for a buddy when hovering in buddy list. - * - * @param buddy The buddy - * @param info The tooltip info being returned - * @param full Return full or summarized information - */ -static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboolean full ) -{ - struct contact* contact = buddy->proto_data; - - if ( !contact ) - return; - - /* status (reference: "libpurple/notify.h") */ - if ( contact->presence != MXIT_PRESENCE_OFFLINE ) - purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); - - /* status message */ - if ( contact->statusMsg ) - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); - - /* mood */ - if ( contact->mood != MXIT_MOOD_NONE ) - purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); - - /* subscription type */ - if ( contact->subtype != 0 ) - purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); - - /* hidden number */ - if ( contact->flags & MXIT_CFLAG_HIDDEN ) - purple_notify_user_info_add_pair( info, _( "Hidden Number" ), _( "Yes" ) ); -} - - -/*------------------------------------------------------------------------ - * Initiate the logout sequence, close the connection and clear the session data. - * - * @param gc The connection object - */ -static void mxit_close( PurpleConnection* gc ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - /* disable signals */ - mxit_disable_signals( session ); - - /* close the connection */ - mxit_close_connection( session ); - -#ifdef MXIT_LINK_CLICK - /* unregister for uri click notification */ - mxit_unregister_uri_handler(); -#endif - - purple_debug_info( MXIT_PLUGIN_ID, "Releasing the session object..\n" ); - - /* free the session memory */ - g_free( session ); - session = NULL; -} - - -/*------------------------------------------------------------------------ - * Send a message to a contact - * - * @param gc The connection object - * @param who The username of the recipient - * @param message The message text - * @param flags Message flags (defined in conversation.h) - * @return Positive value (success, and echo to conversation window) - Zero (success, no echo) - Negative value (error) - */ -static int mxit_send_im( PurpleConnection* gc, const char* who, const char* message, PurpleMessageFlags flags ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who ); - - mxit_send_message( gc->proto_data, who, message, TRUE ); - - return 1; /* echo to conversation window */ -} - - -/*------------------------------------------------------------------------ - * The user changed their current presence state. - * - * @param account The MXit account object - * @param status The new status (libPurple status type) - */ -static void mxit_set_status( PurpleAccount* account, PurpleStatus* status ) -{ - struct MXitSession* session = purple_account_get_connection( account )->proto_data; - const char* statusid; - int presence; - char* statusmsg1; - char* statusmsg2; - - /* get the status id (reference: "libpurple/status.h") */ - statusid = purple_status_get_id( status ); - - /* convert the purple status to a mxit status */ - presence = mxit_convert_presence( statusid ); - if ( presence < 0 ) { - /* error, status not found */ - purple_debug_info( MXIT_PLUGIN_ID, "Presence status NOT found! (id = %s)\n", statusid ); - return; - } - - statusmsg1 = purple_markup_strip_html( purple_status_get_attr_string( status, "message" ) ); - statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG ); - purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_status: '%s'\n", statusmsg2 ); - - /* update presence state */ - mxit_send_presence( session, presence, statusmsg2 ); - - g_free( statusmsg1 ); - g_free( statusmsg2 ); -} - - -/*------------------------------------------------------------------------ - * MXit supports messages to offline contacts. - * - * @param buddy The buddy - */ -static gboolean mxit_offline_message( const PurpleBuddy *buddy ) -{ - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Free the resources used to store a buddy. - * - * @param buddy The buddy - */ -static void mxit_free_buddy( PurpleBuddy* buddy ) -{ - struct contact* contact; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_free_buddy\n" ); - - contact = buddy->proto_data; - if ( contact ) { - if ( contact->statusMsg ) - g_free( contact->statusMsg ); - if ( contact->avatarId ) - g_free( contact->avatarId ); - g_free( contact ); - } - buddy->proto_data = NULL; -} - - -/*------------------------------------------------------------------------ - * Periodic task called every KEEPALIVE_INTERVAL (30 sec) to to maintain - * idle connections, timeouts and the transmission queue to the MXit server. - * - * @param gc The connection object - */ -static void mxit_keepalive( PurpleConnection *gc ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - /* if not logged in, there is nothing to do */ - if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) - return; - - /* pinging is only for socket connections (HTTP does polling) */ - if ( session->http ) - return; - - if ( session->last_tx <= time( NULL ) - MXIT_PING_INTERVAL ) { - /* - * this connection has been idle for too long, better ping - * the server before it kills our connection. - */ - mxit_send_ping( session ); - } -} - - -/*------------------------------------------------------------------------ - * Set or clear our Buddy icon. - * - * @param gc The connection object - * @param img The buddy icon data - */ -static void mxit_set_buddy_icon( PurpleConnection *gc, PurpleStoredImage *img ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - if ( img == NULL ) - mxit_set_avatar( session, NULL, 0 ); - else - mxit_set_avatar( session, purple_imgstore_get_data( img ), purple_imgstore_get_size( img ) ); -} - - -/*------------------------------------------------------------------------ - * Request profile information for another MXit contact. - * - * @param gc The connection object - * @param who The username of the contact. - */ -static void mxit_get_info( PurpleConnection *gc, const char *who ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME, - CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL }; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_info: '%s'\n", who ); - - - /* send profile request */ - mxit_send_extprofile_request( session, who, ARRAY_SIZE( profilelist ), profilelist ); -} - - -/*------------------------------------------------------------------------ - * Return a list of labels to be used by Pidgin for assisting the user. - */ -static GHashTable* mxit_get_text_table( PurpleAccount* acc ) -{ - GHashTable* table; - - table = g_hash_table_new( g_str_hash, g_str_equal ); - - g_hash_table_insert( table, "login_label", (gpointer)_( "Your Mobile Number..." ) ); - - return table; -} - -/*========================================================================================================================*/ - -static PurplePluginProtocolInfo proto_info = { - OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE, /* options */ - NULL, /* user_splits */ - NULL, /* protocol_options */ - { /* icon_spec */ - "png", /* format */ - 32, 32, /* min width & height */ - MXIT_AVATAR_SIZE, /* max width */ - MXIT_AVATAR_SIZE, /* max height */ - 100000, /* max filezize */ - PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY /* scaling rules */ - }, - mxit_list_icon, /* list_icon */ - mxit_list_emblem, /* list_emblem */ - mxit_status_text, /* status_text */ - mxit_tooltip, /* tooltip_text */ - mxit_status_types, /* status types [roster.c] */ - NULL, /* blist_node_menu */ - mxit_chat_info, /* chat_info [multimx.c] */ - NULL, /* chat_info_defaults */ - mxit_login, /* login [login.c] */ - mxit_close, /* close */ - mxit_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - mxit_get_info, /* get_info */ - mxit_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - mxit_add_buddy, /* add_buddy [roster.c] */ - NULL, /* add_buddies */ - mxit_remove_buddy, /* remove_buddy [roster.c] */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - mxit_chat_join, /* join_chat [multimx.c] */ - mxit_chat_reject, /* reject chat invite [multimx.c] */ - mxit_chat_name, /* get_chat_name [multimx.c] */ - mxit_chat_invite, /* chat_invite [multimx.c] */ - mxit_chat_leave, /* chat_leave [multimx.c] */ - NULL, /* chat_whisper */ - mxit_chat_send, /* chat_send [multimx.c] */ - mxit_keepalive, /* keepalive */ - mxit_register, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - mxit_buddy_alias, /* alias_buddy [roster.c] */ - mxit_buddy_group, /* group_buddy [roster.c] */ - mxit_rename_group, /* rename_group [roster.c] */ - mxit_free_buddy, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - mxit_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ // TODO: Add function to move all contacts out of this group (cmd=30 - remove group)? - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - mxit_xfer_enabled, /* can_receive_file [filexfer.c] */ - mxit_xfer_tx, /* send_file [filexfer.c */ - mxit_xfer_new, /* new_xfer [filexfer.c] */ - mxit_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* attention_types */ - sizeof( PurplePluginProtocolInfo ), /* struct_size */ - mxit_get_text_table, /* get_account_text_table */ - NULL, - NULL -}; - - -static PurplePluginInfo plugin_info = { - PURPLE_PLUGIN_MAGIC, /* purple magic, this must always be PURPLE_PLUGIN_MAGIC */ - PURPLE_MAJOR_VERSION, /* libpurple version */ - PURPLE_MINOR_VERSION, /* libpurple version */ - PURPLE_PLUGIN_PROTOCOL, /* plugin type (connecting to another network) */ - NULL, /* UI requirement (NULL for core plugin) */ - 0, /* plugin flags (zero is default) */ - NULL, /* plugin dependencies (set this value to NULL no matter what) */ - PURPLE_PRIORITY_DEFAULT, /* libpurple priority */ - - MXIT_PLUGIN_ID, /* plugin id (must be unique) */ - MXIT_PLUGIN_NAME, /* plugin name (this will be displayed in the UI) */ - MXIT_PLUGIN_VERSION, /* version of the plugin */ - - MXIT_PLUGIN_SUMMARY, /* short summary of the plugin */ - MXIT_PLUGIN_DESC, /* description of the plugin (can be long) */ - MXIT_PLUGIN_EMAIL, /* plugin author name and email address */ - MXIT_PLUGIN_WWW, /* plugin website (to find new versions and reporting of bugs) */ - - NULL, /* function pointer for loading the plugin */ - NULL, /* function pointer for unloading the plugin */ - NULL, /* function pointer for destroying the plugin */ - - NULL, /* pointer to an UI-specific struct */ - &proto_info, /* pointer to either a PurplePluginLoaderInfo or PurplePluginProtocolInfo struct */ - NULL, /* pointer to a PurplePluginUiInfo struct */ - mxit_actions, /* function pointer where you can define plugin-actions */ - - /* padding */ - NULL, /* pointer reserved for future use */ - NULL, /* pointer reserved for future use */ - NULL, /* pointer reserved for future use */ - NULL /* pointer reserved for future use */ -}; - - -/*------------------------------------------------------------------------ - * Initialising the MXit plugin. - * - * @param plugin The plugin object - */ -static void init_plugin( PurplePlugin* plugin ) -{ - PurpleAccountOption* option; - - purple_debug_info( MXIT_PLUGIN_ID, "Loading MXit libPurple plugin...\n" ); - - /* Configuration options */ - - /* WAP server (reference: "libpurple/accountopt.h") */ - option = purple_account_option_string_new( _( "WAP Server" ), MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE ); - proto_info.protocol_options = g_list_append( proto_info.protocol_options, option ); - - option = purple_account_option_bool_new( _( "Connect via HTTP" ), MXIT_CONFIG_USE_HTTP, FALSE ); - proto_info.protocol_options = g_list_append( proto_info.protocol_options, option ); - - option = purple_account_option_bool_new( _( "Enable splash-screen popup" ), MXIT_CONFIG_SPLASHPOPUP, FALSE ); - proto_info.protocol_options = g_list_append( proto_info.protocol_options, option ); -} - -PURPLE_INIT_PLUGIN( mxit, init_plugin, plugin_info ); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/mxit.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit libPurple plugin API -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_H_ -#define _MXIT_H_ - - -#include "internal.h" - - -#if defined( __APPLE__ ) -/* apple architecture */ -#ifndef HOST_NAME_MAX -#define HOST_NAME_MAX 512 -#endif -#elif defined( _WIN32 ) -/* windows architecture */ -#define HOST_NAME_MAX 512 -#include "libc_interface.h" -#elif defined( __linux__ ) -/* linux architecture */ -#include -#include -#include -#include -#include -#else -/* other architecture */ -#ifndef HOST_NAME_MAX -#define HOST_NAME_MAX 512 -#endif -#endif - - -#include "protocol.h" -#include "profile.h" - - -/* Plugin details */ -#define MXIT_PLUGIN_ID "prpl-loubserp-mxit" -#define MXIT_PLUGIN_NAME "MXit" -#define MXIT_PLUGIN_VERSION "2.3.0" -#define MXIT_PLUGIN_EMAIL "Pieter Loubser " -#define MXIT_PLUGIN_WWW "http://www.mxit.com" -#define MXIT_PLUGIN_SUMMARY "MXit Protocol Plugin" -#define MXIT_PLUGIN_DESC "MXit" - -#define MXIT_HTTP_USERAGENT "libpurple-"MXIT_PLUGIN_VERSION - - -/* default connection settings */ -#define DEFAULT_SERVER "stream.mxit.co.za" -#define DEFAULT_PORT 9119 -#define DEFAULT_WAPSITE "http://www.mxit.com" -#define DEFAULT_HTTP_SERVER "http://int.poll.mxit.com:80/mxit" - - -/* Purple account configuration variable names */ -#define MXIT_CONFIG_STATE "state" -#define MXIT_CONFIG_WAPSERVER "wap_server" -#define MXIT_CONFIG_DISTCODE "distcode" -#define MXIT_CONFIG_CLIENTKEY "clientkey" -#define MXIT_CONFIG_DIALCODE "dialcode" -#define MXIT_CONFIG_SERVER_ADDR "server" -#define MXIT_CONFIG_SERVER_PORT "port" -#define MXIT_CONFIG_HTTPSERVER "httpserver" -#define MXIT_CONFIG_SPLASHID "splashid" -#define MXIT_CONFIG_SPLASHCLICK "splashclick" -#define MXIT_CONFIG_SPLASHPOPUP "splashpopup" -#define MXIT_CONFIG_COUNTRYCODE "cc" -#define MXIT_CONFIG_LOCALE "locale" -#define MXIT_CONFIG_USE_HTTP "use_http" - - -/* account states */ -#define MXIT_STATE_LOGIN 0x00 -#define MXIT_STATE_REGISTER1 0x01 -#define MXIT_STATE_REGISTER2 0x02 - - -/* Client session flags */ -#define MXIT_FLAG_CONNECTED 0x01 /* established connection to the server */ -#define MXIT_FLAG_LOGGEDIN 0x02 /* user currently logged in */ -#define MXIT_FLAG_FIRSTROSTER 0x04 /* set to true once the first roster update has been recevied and processed */ - - -/* define this to enable the link clicking support */ -#define MXIT_LINK_CLICK - - -#ifdef MXIT_LINK_CLICK -#define MXIT_LINK_PREFIX "gopher://" -#define MXIT_LINK_KEY "MXIT" -#endif - - -#define ARRAY_SIZE( x ) ( sizeof( x ) / sizeof( x[0] ) ) - - -/* - * data structure containing all MXit session information - */ -struct MXitSession { - /* socket connection */ - char server[HOST_NAME_MAX]; /* MXit server name to connect to */ - int port; /* MXit server port to connect on */ - int fd; /* connection file descriptor */ - - /* http connection */ - gboolean http; /* connect to MXit via HTTP and not by socket */ - char http_server[HOST_NAME_MAX]; /* MXit HTTP server */ - unsigned int http_sesid; /* HTTP session id */ - unsigned int http_seqno; /* HTTP request sequence number */ - guint http_timer_id; /* timer resource id (pidgin) */ - int http_interval; /* poll inverval */ - time_t http_last_poll; /* the last time a poll has been sent */ - guint http_handler; /* HTTP connection handler */ - void* http_out_req; /* HTTP outstanding request */ - - /* client */ - struct login_data* logindata; - char* encpwd; /* encrypted password */ - char distcode[64]; /* distribution code */ - char clientkey[16]; /* client key */ - char dialcode[8]; /* dialing code */ - short flags; /* client session flags (see above) */ - - /* personal (profile) */ - struct MXitProfile* profile; /* user's profile information */ - int mood; /* user's current mood */ - - /* libpurple */ - PurpleAccount* acc; /* pointer to the libpurple internal account struct */ - PurpleConnection* con; /* pointer to the libpurple internal connection struct */ - - /* transmit */ - struct tx_queue queue; /* transmit packet queue (FIFO mode) */ - time_t last_tx; /* timestamp of last packet sent */ - int outack; /* outstanding ack packet */ - guint q_timer; /* timer handler for managing queue */ - - /* receive */ - char rx_lbuf[16]; /* receive byte buffer (socket packet length) */ - char rx_dbuf[CP_MAX_PACKET]; /* receive byte buffer (raw data) */ - unsigned int rx_i; /* receive buffer current index */ - int rx_res; /* amount of bytes still outstanding for the current packet */ - char rx_state; /* current receiver state */ - time_t last_rx; /* timestamp of last packet received */ - GList* active_chats; /* list of all our contacts we received messages from (active chats) */ - - /* groupchat */ - GList* rooms; /* active groupchat rooms */ - - /* inline images */ - GHashTable* iimages; /* table which maps inline images (including emoticons) to purple's imgstore id's */ -}; - - -char* mxit_status_text( PurpleBuddy* buddy ); -void mxit_enable_signals( struct MXitSession* session ); - -#ifdef MXIT_LINK_CLICK -void mxit_register_uri_handler(void); -#endif - - -#endif /* _MXIT_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,160 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user profile's -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include - -#include "purple.h" - -#include "mxit.h" -#include "profile.h" -#include "roster.h" - - -/*------------------------------------------------------------------------ - * Returns true if it is a valid date. - * - * @param bday Date-of-Birth string - * @return TRUE if valid, else FALSE - */ -gboolean validateDate( const char* bday ) -{ - struct tm* tm; - time_t t; - int cur_year; - int max_days[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - char date[16]; - int year; - int month; - int day; - - /* validate length */ - if ( strlen( bday ) != 10 ) { - return FALSE; - } - - /* validate the format */ - if ( ( !isdigit( bday[0] ) ) || ( !isdigit( bday[1] ) ) || ( !isdigit( bday[2] ) ) || ( !isdigit( bday[3] ) ) || /* year */ - ( bday[4] != '-' ) || - ( !isdigit( bday[5] ) ) || ( !isdigit( bday[6] ) ) || /* month */ - ( bday[7] != '-' ) || - ( !isdigit( bday[8] ) ) || ( !isdigit( bday[9] ) ) ) { /* day */ - return FALSE; - } - - /* convert */ - t = time( NULL ); - tm = gmtime( &t ); - cur_year = tm->tm_year + 1900; - memcpy( date, bday, 10 ); - date[4] = '\0'; - date[7] = '\0'; - date[10] = '\0'; - year = atoi( &date[0] ); - month = atoi( &date[5] ); - day = atoi( &date[8] ); - - /* validate month */ - if ( ( month < 1 ) || ( month > 12 ) ) { - return FALSE; - } - - /* validate day */ - if ( ( day < 1 ) || ( day > max_days[month] ) ) { - return FALSE; - } - - /* validate year */ - if ( ( year < ( cur_year - 100 ) ) || ( year >= cur_year ) ) { - /* you are either tooo old or tooo young to join mxit... sorry */ - return FALSE; - } - - /* special case leap-year */ - if ( ( year % 4 != 0 ) && ( month == 2 ) && ( day == 29 ) ) { - /* cannot have 29 days in February in non leap-years! */ - return FALSE; - } - - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Display the profile information. - * - * @param session The MXit session object - * @param username The username who's profile information this is - * @param profile The profile - */ -void mxit_show_profile( struct MXitSession* session, const char* username, struct MXitProfile* profile ) -{ - PurpleNotifyUserInfo* info = purple_notify_user_info_new(); - struct contact* contact = NULL; - PurpleBuddy* buddy; - - buddy = purple_find_buddy( session->acc, username ); - if ( buddy ) { - purple_notify_user_info_add_pair( info, _( "Alias" ), buddy->alias ); - purple_notify_user_info_add_section_break( info ); - contact = buddy->proto_data; - } - - purple_notify_user_info_add_pair( info, _( "Nick Name" ), profile->nickname ); - purple_notify_user_info_add_pair( info, _( "Birthday" ), profile->birthday ); - purple_notify_user_info_add_pair( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); - purple_notify_user_info_add_pair( info, _( "Hidden Number" ), profile->hidden ? _( "Yes" ) : _( "No" ) ); - - purple_notify_user_info_add_section_break( info ); - - /* optional information */ - purple_notify_user_info_add_pair( info, _( "Title" ), profile->title ); - purple_notify_user_info_add_pair( info, _( "First Name" ), profile->firstname ); - purple_notify_user_info_add_pair( info, _( "Last Name" ), profile->lastname ); - purple_notify_user_info_add_pair( info, _( "Email" ), profile->email ); - - purple_notify_user_info_add_section_break( info ); - - if ( contact ) { - /* presence */ - purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); - - /* mood */ - if ( contact->mood != MXIT_MOOD_NONE ) - purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); - else - purple_notify_user_info_add_pair( info, _( "Mood" ), _( "None" ) ); - - /* status message */ - if ( contact->statusMsg ) - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); - - /* subscription type */ - purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); - } - - purple_notify_userinfo( session->con, username, info, NULL, NULL ); - purple_notify_user_info_destroy( info ); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/profile.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user profile's -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_PROFILE_H_ -#define _MXIT_PROFILE_H_ - -#include - - -struct MXitProfile { - /* required */ - char loginname[64]; /* name user uses to log into MXit with (aka 'mxitid') */ - char nickname[64]; /* user's own display name (aka 'nickname', aka 'fullname', aka 'alias') in MXit */ - char birthday[16]; /* user's birthday "YYYY-MM-DD" */ - gboolean male; /* true if the user's gender is male (otherwise female) */ - char pin[16]; /* user's password */ - - /* optional */ - char title[32]; /* user's title */ - char firstname[64]; /* user's first name */ - char lastname[64]; /* user's last name (aka 'surname') */ - char email[64]; /* user's email address */ - char mobilenr[21]; /* user's mobile number */ - - gboolean hidden; /* set if the user's msisdn should remain hidden */ -}; - -struct MXitSession; -void mxit_show_profile( struct MXitSession* session, const char* username, struct MXitProfile* profile ); - -gboolean validateDate( const char* bday ); - - -#endif /* _MXIT_PROFILE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2442 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "roster.h" -#include "chunk.h" -#include "filexfer.h" -#include "markup.h" -#include "multimx.h" -#include "splashscreen.h" -#include "login.h" -#include "formcmds.h" -#include "http.h" - - -#define MXIT_MS_OFFSET 3 - -/* configure the right record terminator char to use */ -#define CP_REC_TERM ( ( session->http ) ? CP_HTTP_REC_TERM : CP_SOCK_REC_TERM ) - - - -/*------------------------------------------------------------------------ - * Display a notification popup message to the user. - * - * @param type The type of notification: - * - info: PURPLE_NOTIFY_MSG_INFO - * - warning: PURPLE_NOTIFY_MSG_WARNING - * - error: PURPLE_NOTIFY_MSG_ERROR - * @param heading Heading text - * @param message Message text - */ -void mxit_popup( int type, const char* heading, const char* message ) -{ - /* (reference: "libpurple/notify.h") */ - purple_notify_message( NULL, type, _( MXIT_POPUP_WIN_NAME ), heading, message, NULL, NULL ); -} - - -/*------------------------------------------------------------------------ - * For compatibility with legacy clients, all usernames are sent from MXit with a domain - * appended. For MXit contacts, this domain is set to "@m". This function strips - * those fake domains. - * - * @param username The username of the contact - */ -void mxit_strip_domain( char* username ) -{ - if ( g_str_has_suffix( username, "@m" ) ) - username[ strlen(username) - 2 ] = '\0'; -} - - -/*------------------------------------------------------------------------ - * Dump a byte buffer to the console for debugging purposes. - * - * @param buf The data - * @param len The data length - */ -void dump_bytes( struct MXitSession* session, const char* buf, int len ) -{ - char msg[( len * 3 ) + 1]; - int i; - - memset( msg, 0x00, sizeof( msg ) ); - - for ( i = 0; i < len; i++ ) { - if ( buf[i] == CP_REC_TERM ) /* record terminator */ - msg[i] = '!'; - else if ( buf[i] == CP_FLD_TERM ) /* field terminator */ - msg[i] = '^'; - else if ( buf[i] == CP_PKT_TERM ) /* packet terminator */ - msg[i] = '@'; - else if ( buf[i] < 0x20 ) - msg[i] = '_'; - else - msg[i] = buf[i]; - - } - - purple_debug_info( MXIT_PLUGIN_ID, "DUMP: '%s'\n", msg ); -} - - -/*------------------------------------------------------------------------ - * Determine if we have an active chat with a specific contact - * - * @param session The MXit session object - * @param who The contact name - * @return Return true if we have an active chat with the contact - */ -gboolean find_active_chat( const GList* chats, const char* who ) -{ - const GList* list = chats; - const char* chat = NULL; - - while ( list ) { - chat = (const char*) list->data; - - if ( strcmp( chat, who ) == 0 ) - return TRUE; - - list = g_list_next( list ); - } - - return FALSE; -} - - -/*======================================================================================================================== - * Low-level Packet transmission - */ - -/*------------------------------------------------------------------------ - * Remove next packet from transmission queue. - * - * @param session The MXit session object - * @return The next packet for transmission (or NULL) - */ -static struct tx_packet* pop_tx_packet( struct MXitSession* session ) -{ - struct tx_packet* packet = NULL; - - if ( session->queue.count > 0 ) { - /* dequeue the next packet */ - packet = session->queue.packets[session->queue.rd_i]; - session->queue.packets[session->queue.rd_i] = NULL; - session->queue.rd_i = ( session->queue.rd_i + 1 ) % MAX_QUEUE_SIZE; - session->queue.count--; - } - - return packet; -} - - -/*------------------------------------------------------------------------ - * Add packet to transmission queue. - * - * @param session The MXit session object - * @param packet The packet to transmit - * @return Return TRUE if packet was enqueue, or FALSE if queue is full. - */ -static gboolean push_tx_packet( struct MXitSession* session, struct tx_packet* packet ) -{ - if ( session->queue.count < MAX_QUEUE_SIZE ) { - /* enqueue packet */ - session->queue.packets[session->queue.wr_i] = packet; - session->queue.wr_i = ( session->queue.wr_i + 1 ) % MAX_QUEUE_SIZE; - session->queue.count++; - return TRUE; - } - else - return FALSE; /* queue is full */ -} - - -/*------------------------------------------------------------------------ - * Deallocate transmission packet. - * - * @param packet The packet to deallocate. - */ -static void free_tx_packet( struct tx_packet* packet ) -{ - g_free( packet->data ); - g_free( packet ); - packet = NULL; -} - - -/*------------------------------------------------------------------------ - * Flush all the packets from the tx queue and release the resources. - * - * @param session The MXit session object - */ -static void flush_queue( struct MXitSession* session ) -{ - struct tx_packet* packet; - - purple_debug_info( MXIT_PLUGIN_ID, "flushing the tx queue\n" ); - - while ( (packet = pop_tx_packet( session ) ) != NULL ) - free_tx_packet( packet ); -} - - -/*------------------------------------------------------------------------ - * TX Step 3: Write the packet data to the TCP connection. - * - * @param fd The file descriptor - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static int mxit_write_sock_packet( int fd, const char* pktdata, int pktlen ) -{ - int written; - int res; - - written = 0; - while ( written < pktlen ) { - res = write( fd, &pktdata[written], pktlen - written ); - if ( res <= 0 ) { - /* error on socket */ - if ( errno == EAGAIN ) - continue; - - purple_debug_error( MXIT_PLUGIN_ID, "Error while writing packet to MXit server (%i)\n", res ); - return -1; - } - written += res; - } - - return 0; -} - - -/*------------------------------------------------------------------------ - * Callback called for handling a HTTP GET response - * - * @param url_data libPurple internal object (see purple_util_fetch_url_request) - * @param user_data The MXit session object - * @param url_text The data returned (could be NULL if error) - * @param len The length of the data returned (0 if error) - * @param error_message Descriptive error message - */ -static void mxit_cb_http_rx( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - - /* clear outstanding request */ - session->http_out_req = NULL; - - if ( ( !url_text ) || ( len == 0 ) ) { - /* error with request */ - purple_debug_error( MXIT_PLUGIN_ID, "HTTP response error (%s)\n", error_message ); - return; - } - - /* convert the HTTP result */ - memcpy( session->rx_dbuf, url_text, len ); - session->rx_i = len; - - mxit_parse_packet( session ); -} - - -/*------------------------------------------------------------------------ - * TX Step 3: Write the packet data to the HTTP connection (GET style). - * - * @param session The MXit session object - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static void mxit_write_http_get( struct MXitSession* session, struct tx_packet* packet ) -{ - char* part = NULL; - char* url = NULL; - - if ( packet->datalen > 0 ) { - char* tmp = NULL; - - tmp = g_strndup( packet->data, packet->datalen ); - part = g_strdup( purple_url_encode( tmp ) ); - g_free( tmp ); - } - - url = g_strdup_printf( "%s?%s%s", session->http_server, purple_url_encode( packet->header ), ( !part ) ? "" : part ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP GET: '%s'\n", url ); -#endif - - /* send the HTTP request */ - session->http_out_req = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_http_rx, session ); - - g_free( url ); - if ( part ) - g_free( part ); -} - - -/*------------------------------------------------------------------------ - * TX Step 3: Write the packet data to the HTTP connection (POST style). - * - * @param session The MXit session object - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static void mxit_write_http_post( struct MXitSession* session, struct tx_packet* packet ) -{ - char request[256 + packet->datalen]; - int reqlen; - char* host_name; - int host_port; - gboolean ok; - - /* extract the HTTP host name and host port number to connect to */ - ok = purple_url_parse( session->http_server, &host_name, &host_port, NULL, NULL, NULL ); - if ( !ok ) { - purple_debug_error( MXIT_PLUGIN_ID, "HTTP POST error: (host name '%s' not valid)\n", session->http_server ); - } - - /* strip off the last '&' from the header */ - packet->header[packet->headerlen - 1] = '\0'; - packet->headerlen--; - - /* build the HTTP request packet */ - reqlen = g_snprintf( request, 256, - "POST %s?%s HTTP/1.1\r\n" - "User-Agent: " MXIT_HTTP_USERAGENT "\r\n" - "Content-Type: application/octet-stream\r\n" - "Host: %s\r\n" - "Content-Length: %d\r\n" - "\r\n", - session->http_server, - purple_url_encode( packet->header ), - host_name, - packet->datalen - MXIT_MS_OFFSET - ); - - /* copy over the packet body data (could be binary) */ - memcpy( request + reqlen, packet->data + MXIT_MS_OFFSET, packet->datalen - MXIT_MS_OFFSET ); - reqlen += packet->datalen; - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP POST:\n" ); - dump_bytes( session, request, reqlen ); -#endif - - /* send the request to the HTTP server */ - mxit_http_send_request( session, host_name, host_port, request, reqlen ); -} - - -/*------------------------------------------------------------------------ - * TX Step 2: Handle the transmission of the packet to the MXit server. - * - * @param session The MXit session object - * @param packet The packet to transmit - */ -static void mxit_send_packet( struct MXitSession* session, struct tx_packet* packet ) -{ - int res; - - if ( !( session->flags & MXIT_FLAG_CONNECTED ) ) { - /* we are not connected so ignore all packets to be send */ - purple_debug_error( MXIT_PLUGIN_ID, "Dropping TX packet (we are not connected)\n" ); - return; - } - - purple_debug_info( MXIT_PLUGIN_ID, "Packet send CMD:%i (%i)\n", packet->cmd, packet->headerlen + packet->datalen ); -#ifdef DEBUG_PROTOCOL - dump_bytes( session, packet->header, packet->headerlen ); - dump_bytes( session, packet->data, packet->datalen ); -#endif - - if ( !session->http ) { - /* socket connection */ - char data[packet->datalen + packet->headerlen]; - int datalen; - - /* create raw data buffer */ - memcpy( data, packet->header, packet->headerlen ); - memcpy( data + packet->headerlen, packet->data, packet->datalen ); - datalen = packet->headerlen + packet->datalen; - - res = mxit_write_sock_packet( session->fd, data, datalen ); - if ( res < 0 ) { - /* we must have lost the connection, so terminate it so that we can reconnect */ - purple_connection_error( session->con, _( "We have lost the connection to MXit. Please reconnect." ) ); - } - } - else { - /* http connection */ - - if ( packet->cmd == CP_CMD_MEDIA ) { - /* multimedia packets must be send with a HTTP POST */ - mxit_write_http_post( session, packet ); - } - else { - mxit_write_http_get( session, packet ); - } - } - - /* update the timestamp of the last-transmitted packet */ - session->last_tx = time( NULL ); - - /* - * we need to remember that we are still waiting for the ACK from - * the server on this request - */ - session->outack = packet->cmd; - - /* free up the packet resources */ - free_tx_packet( packet ); -} - - -/*------------------------------------------------------------------------ - * TX Step 1: Create a new Tx packet and queue it for sending. - * - * @param session The MXit session object - * @param data The packet data (payload) - * @param datalen The length of the packet data - * @param cmd The MXit command for this packet - */ -static void mxit_queue_packet( struct MXitSession* session, const char* data, int datalen, int cmd ) -{ - struct tx_packet* packet; - char header[256]; - int hlen; - - /* create a packet for sending */ - packet = g_new0( struct tx_packet, 1 ); - packet->data = g_malloc0( datalen ); - packet->cmd = cmd; - packet->headerlen = 0; - - /* create generic packet header */ - hlen = sprintf( header, "id=%s%c", session->acc->username, CP_REC_TERM ); /* client msisdn */ - - if ( session->http ) { - /* http connection only */ - hlen += sprintf( header + hlen, "s=" ); - if ( session->http_sesid > 0 ) { - hlen += sprintf( header + hlen, "%u%c", session->http_sesid, CP_FLD_TERM ); /* http session id */ - } - session->http_seqno++; - hlen += sprintf( header + hlen, "%u%c", session->http_seqno, CP_REC_TERM ); /* http request sequence id */ - } - - hlen += sprintf( header + hlen, "cm=%i%c", cmd, CP_REC_TERM ); /* packet command */ - - if ( !session->http ) { - /* socket connection only */ - packet->headerlen += sprintf( packet->header, "ln=%i%c", ( datalen + hlen ), CP_REC_TERM ); /* packet length */ - } - - /* copy the header to packet */ - memcpy( packet->header + packet->headerlen, header, hlen ); - packet->headerlen += hlen; - - /* copy payload to packet */ - if ( datalen > 0 ) - memcpy( packet->data, data, datalen ); - packet->datalen = datalen; - - - /* - * shortcut: first check if there are any commands still outstanding. - * if not, then we might as well just write this packet directly and - * skip the whole queueing thing - */ - if ( session->outack == 0 ) { - /* no outstanding ACKs, so we might as well write it directly */ - mxit_send_packet( session, packet ); - } - else { - /* ACK still outstanding, so we need to queue this request until we have the ACK */ - - if ( ( packet->cmd == CP_CMD_PING ) || ( packet->cmd == CP_CMD_POLL ) ) { - /* we do NOT queue HTTP poll nor socket ping packets */ - free_tx_packet( packet ); - return; - } - - purple_debug_info( MXIT_PLUGIN_ID, "queueing packet for later sending cmd=%i\n", cmd ); - if ( !push_tx_packet( session, packet ) ) { - /* packet could not be queued for transmission */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Message Send Error" ), _( "Unable to process your request at this time" ) ); - free_tx_packet( packet ); - } - } -} - - -/*------------------------------------------------------------------------ - * Callback to manage the packet send queue (send next packet, timeout's, etc). - * - * @param session The MXit session object - */ -gboolean mxit_manage_queue( gpointer user_data ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - struct tx_packet* packet = NULL; - - if ( !( session->flags & MXIT_FLAG_CONNECTED ) ) { - /* we are not connected, so ignore the queue */ - return TRUE; - } - else if ( session->outack > 0 ) { - /* we are still waiting for an outstanding ACK from the MXit server */ - if ( session->last_tx <= time( NULL ) - MXIT_ACK_TIMEOUT ) { - /* ack timeout! so we close the connection here */ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_manage_queue: Timeout awaiting ACK for command '%X'\n", session->outack ); - purple_connection_error( session->con, _( "Timeout while waiting for a response from the MXit server." ) ); - } - return TRUE; - } - - packet = pop_tx_packet( session ); - if ( packet != NULL ) { - /* there was a packet waiting to be sent to the server, now is the time to do something about it */ - - /* send the packet to MXit server */ - mxit_send_packet( session, packet ); - } - - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Callback to manage HTTP server polling (HTTP connections ONLY) - * - * @param session The MXit session object - */ -gboolean mxit_manage_polling( gpointer user_data ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - gboolean poll = FALSE; - time_t now = time( NULL ); - int polldiff; - int rxdiff; - - if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) { - /* we only poll if we are actually logged in */ - return TRUE; - } - - /* calculate the time differences */ - rxdiff = now - session->last_rx; - polldiff = now - session->http_last_poll; - - if ( rxdiff < MXIT_HTTP_POLL_MIN ) { - /* we received some reply a few moments ago, so reset the poll interval */ - session->http_interval = MXIT_HTTP_POLL_MIN; - } - else if ( session->http_last_poll < ( now - session->http_interval ) ) { - /* time to poll again */ - poll = TRUE; - - /* back-off some more with the polling */ - session->http_interval = session->http_interval + ( session->http_interval / 2 ); - if ( session->http_interval > MXIT_HTTP_POLL_MAX ) - session->http_interval = MXIT_HTTP_POLL_MAX; - } - - /* debugging */ - //purple_debug_info( MXIT_PLUGIN_ID, "POLL TIMER: %i (%i,%i)\n", session->http_interval, rxdiff, polldiff ); - - if ( poll ) { - /* send poll request */ - session->http_last_poll = time( NULL ); - mxit_send_poll( session ); - } - - return TRUE; -} - - -/*======================================================================================================================== - * Send MXit operations. - */ - -/*------------------------------------------------------------------------ - * Send a ping/keepalive packet to MXit server. - * - * @param session The MXit session object - */ -void mxit_send_ping( struct MXitSession* session ) -{ - /* queue packet for transmission */ - mxit_queue_packet( session, NULL, 0, CP_CMD_PING ); -} - - -/*------------------------------------------------------------------------ - * Send a poll request to the HTTP server (HTTP connections ONLY). - * - * @param session The MXit session object - */ -void mxit_send_poll( struct MXitSession* session ) -{ - /* queue packet for transmission */ - mxit_queue_packet( session, NULL, 0, CP_CMD_POLL ); -} - - -/*------------------------------------------------------------------------ - * Send a logout packet to the MXit server. - * - * @param session The MXit session object - */ -void mxit_send_logout( struct MXitSession* session ) -{ - /* queue packet for transmission */ - mxit_queue_packet( session, NULL, 0, CP_CMD_LOGOUT ); -} - - -/*------------------------------------------------------------------------ - * Send a register packet to the MXit server. - * - * @param session The MXit session object - */ -void mxit_send_register( struct MXitSession* session ) -{ - struct MXitProfile* profile = session->profile; - const char* locale; - char data[CP_MAX_PACKET]; - int datalen; - - locale = purple_account_get_string( session->acc, MXIT_CONFIG_LOCALE, MXIT_DEFAULT_LOCALE ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%i%c%s%c" /* "ms"=password\1version\1maxreplyLen\1name\1 */ - "%s%c%i%c%s%c%s%c" /* dateOfBirth\1gender\1location\1capabilities\1 */ - "%s%c%i%c%s%c%s", /* dc\1features\1dialingcode\1locale */ - session->encpwd, CP_FLD_TERM, MXIT_CP_VERSION, CP_FLD_TERM, CP_MAX_FILESIZE, CP_FLD_TERM, profile->nickname, CP_FLD_TERM, - profile->birthday, CP_FLD_TERM, ( profile->male ) ? 1 : 0, CP_FLD_TERM, MXIT_DEFAULT_LOC, CP_FLD_TERM, MXIT_CP_CAP, CP_FLD_TERM, - session->distcode, CP_FLD_TERM, MXIT_CP_FEATURES, CP_FLD_TERM, session->dialcode, CP_FLD_TERM, locale - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_REGISTER ); -} - - -/*------------------------------------------------------------------------ - * Send a login packet to the MXit server. - * - * @param session The MXit session object - */ -void mxit_send_login( struct MXitSession* session ) -{ - const char* splashId; - const char* locale; - char data[CP_MAX_PACKET]; - int datalen; - - locale = purple_account_get_string( session->acc, MXIT_CONFIG_LOCALE, MXIT_DEFAULT_LOCALE ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%i%c" /* "ms"=password\1version\1getContacts\1 */ - "%s%c%s%c%i%c" /* capabilities\1dc\1features\1 */ - "%s%c%s", /* dialingcode\1locale */ - session->encpwd, CP_FLD_TERM, MXIT_CP_VERSION, CP_FLD_TERM, 1, CP_FLD_TERM, - MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, MXIT_CP_FEATURES, CP_FLD_TERM, - session->dialcode, CP_FLD_TERM, locale - ); - - /* include "custom resource" information */ - splashId = splash_current( session ); - if ( splashId != NULL ) - datalen += sprintf( data + datalen, "%ccr=%s", CP_REC_TERM, splashId ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_LOGIN ); -} - - -/*------------------------------------------------------------------------ - * Send a chat message packet to the MXit server. - * - * @param session The MXit session object - * @param to The username of the recipient - * @param msg The message text - */ -void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup ) -{ - char data[CP_MAX_PACKET]; - char* markuped_msg; - int datalen; - int msgtype = CP_MSGTYPE_NORMAL; - - /* first we need to convert the markup from libPurple to MXit format */ - if ( parse_markup ) - markuped_msg = mxit_convert_markup_tx( msg, &msgtype ); - else - markuped_msg = g_strdup( msg ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%i%c%i", /* "ms"=jid\1msg\1type\1flags */ - to, CP_FLD_TERM, markuped_msg, CP_FLD_TERM, msgtype, CP_FLD_TERM, CP_MSG_MARKUP | CP_MSG_EMOTICON - ); - - /* free the resources */ - g_free( markuped_msg ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_TX_MSG ); -} - - -/*------------------------------------------------------------------------ - * Send a extended profile request packet to the MXit server. - * - * @param session The MXit session object - * @param username Username who's profile is being requested (NULL = our own) - * @param nr_attribs Number of attributes being requested - * @param attributes The names of the attributes - */ -void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] ) -{ - char data[CP_MAX_PACKET]; - int datalen; - unsigned int i; - - datalen = sprintf( data, "ms=%s%c%i", /* "ms="mxitid\1nr_attributes */ - (username ? username : ""), CP_FLD_TERM, nr_attrib); - - /* add attributes */ - for ( i = 0; i < nr_attrib; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_GET ); -} - - -/*------------------------------------------------------------------------ - * Send an update profile packet to the MXit server. - * - * @param session The MXit session object - * @param password The new password to be used for logging in (optional) - * @param nr_attrib The number of attributes - * @param attributes String containing the attributes and settings seperated by '0x01' - */ -void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes ) -{ - char data[CP_MAX_PACKET]; - gchar** parts; - int datalen; - unsigned int i; - - parts = g_strsplit( attributes, "\01", ( MXIT_MAX_ATTRIBS * 3 ) ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%i", /* "ms"=password\1nr_attibutes */ - ( password ) ? password : "", CP_FLD_TERM, nr_attrib - ); - - /* add attributes */ - for ( i = 1; i < nr_attrib * 3; i+=3 ) - datalen += sprintf( data + datalen, "%c%s%c%s%c%s", /* \1name\1type\1value */ - CP_FLD_TERM, parts[i], CP_FLD_TERM, parts[i + 1], CP_FLD_TERM, parts[i + 2] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_SET ); - - /* freeup the memory */ - g_strfreev( parts ); -} - - -/*------------------------------------------------------------------------ - * Send a presence update packet to the MXit server. - * - * @param session The MXit session object - * @param presence The presence (as per MXit types) - * @param statusmsg The status message (can be NULL) - */ -void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%i%c", /* "ms"=show\1status */ - presence, CP_FLD_TERM - ); - - /* append status message (if one is set) */ - if ( statusmsg ) - datalen += sprintf( data + datalen, "%s", statusmsg ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_STATUS ); -} - - -/*------------------------------------------------------------------------ - * Send a mood update packet to the MXit server. - * - * @param session The MXit session object - * @param mood The mood (as per MXit types) - */ -void mxit_send_mood( struct MXitSession* session, int mood ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%i", /* "ms"=mood */ - mood - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_MOOD ); -} - - -/*------------------------------------------------------------------------ - * Send an invite contact packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being invited - * @param alias Our alias for the contact - * @param groupname Group in which contact should be stored. - */ -void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%s%c%i%c%s", /* "ms"=group\1username\1alias\1type\1msg */ - groupname, CP_FLD_TERM, username, CP_FLD_TERM, alias, - CP_FLD_TERM, MXIT_TYPE_MXIT, CP_FLD_TERM, "" - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_INVITE ); -} - - -/*------------------------------------------------------------------------ - * Send a remove contact packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being removed - */ -void mxit_send_remove( struct MXitSession* session, const char* username ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s", /* "ms"=username */ - username - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_REMOVE ); -} - - -/*------------------------------------------------------------------------ - * Send an accept subscription (invite) packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being accepted - * @param alias Our alias for the contact - */ -void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%s", /* "ms"=username\1group\1alias */ - username, CP_FLD_TERM, "", CP_FLD_TERM, alias - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_ALLOW ); -} - - -/*------------------------------------------------------------------------ - * Send an deny subscription (invite) packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being denied - */ -void mxit_send_deny_sub( struct MXitSession* session, const char* username ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s", /* "ms"=username */ - username - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_DENY ); -} - - -/*------------------------------------------------------------------------ - * Send an update contact packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being denied - * @param alias Our alias for the contact - * @param groupname Group in which contact should be stored. - */ -void mxit_send_update_contact( struct MXitSession* session, const char* username, const char* alias, const char* groupname ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%s", /* "ms"=groupname\1username\1alias */ - groupname, CP_FLD_TERM, username, CP_FLD_TERM, alias - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_UPDATE ); -} - - -/*------------------------------------------------------------------------ - * Send a splash-screen click event packet. - * - * @param session The MXit session object - * @param splashid The identifier of the splash-screen - */ -void mxit_send_splashclick( struct MXitSession* session, const char* splashid ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s", /* "ms"=splashId */ - splashid - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_SPLASHCLICK ); -} - - -/*------------------------------------------------------------------------ - * Send packet to create a MultiMX room. - * - * @param session The MXit session object - * @param groupname Name of the room to create - * @param nr_usernames Number of users in initial invite - * @param usernames The usernames of the users in the initial invite - */ -void mxit_send_groupchat_create( struct MXitSession* session, const char* groupname, int nr_usernames, const char* usernames[] ) -{ - char data[CP_MAX_PACKET]; - int datalen; - int i; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%i", /* "ms"=roomname\1nr_jids\1jid0\1..\1jidN */ - groupname, CP_FLD_TERM, nr_usernames - ); - - /* add usernames */ - for ( i = 0; i < nr_usernames; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_GRPCHAT_CREATE ); -} - - -/*------------------------------------------------------------------------ - * Send packet to invite users to existing MultiMX room. - * - * @param session The MXit session object - * @param roomid The unique RoomID for the MultiMx room. - * @param nr_usernames Number of users being invited - * @param usernames The usernames of the users being invited - */ - -void mxit_send_groupchat_invite( struct MXitSession* session, const char* roomid, int nr_usernames, const char* usernames[] ) -{ - char data[CP_MAX_PACKET]; - int datalen; - int i; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%i", /* "ms"=roomid\1nr_jids\1jid0\1..\1jidN */ - roomid, CP_FLD_TERM, nr_usernames - ); - - /* add usernames */ - for ( i = 0; i < nr_usernames; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_GRPCHAT_INVITE ); -} - - -/*------------------------------------------------------------------------ - * Send a "send file direct" multimedia packet. - * - * @param session The MXit session object - * @param username The username of the recipient - * @param filename The name of the file being sent - * @param buf The content of the file - * @param buflen The length of the file contents - */ -void mxit_send_file( struct MXitSession* session, const char* username, const char* filename, const unsigned char* buf, int buflen ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "SENDING FILE '%s' of %i bytes to user '%s'\n", filename, buflen, username ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_senddirect( chunk_data( chunk ), username, filename, buf, buflen ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating senddirect chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_DIRECT_SND ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "reject file" multimedia packet. - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - */ -void mxit_send_file_reject( struct MXitSession* session, const char* fileid ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_reject\n" ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_reject( chunk_data( chunk ), fileid ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating reject chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_REJECT ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "get file" multimedia packet. - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - * @param filesize The number of bytes to retrieve - * @param offset Offset in file at which to start retrieving - */ -void mxit_send_file_accept( struct MXitSession* session, const char* fileid, int filesize, int offset ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_accept\n" ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_get( chunk_data(chunk), fileid, filesize, offset ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating getfile chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_GET ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "received file" multimedia packet. - * - * @param session The MXit session object - * @param status The status of the file-transfer - */ -void mxit_send_file_received( struct MXitSession* session, const char* fileid, short status ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_received\n" ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_received( chunk_data(chunk), fileid, status ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating received chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_RECIEVED ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "set avatar" multimedia packet. - * - * @param session The MXit session object - * @param data The avatar data - * @param buflen The length of the avatar data - */ -void mxit_set_avatar( struct MXitSession* session, const unsigned char* avatar, int avatarlen ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_avatar: %i bytes\n", avatarlen ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_set_avatar( chunk_data(chunk), avatar, avatarlen ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating set avatar chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_SET_AVATAR ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "get avatar" multimedia packet. - * - * @param session The MXit session object - * @param mxitId The username who's avatar to request - * @param avatarId The id of the avatar image (as string) - * @param data The avatar data - * @param buflen The length of the avatar data - */ -void mxit_get_avatar( struct MXitSession* session, const char* mxitId, const char* avatarId ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_avatar: %s\n", mxitId ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_get_avatar( chunk_data(chunk), mxitId, avatarId, MXIT_AVATAR_SIZE ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating get avatar chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_GET_AVATAR ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Process a login message packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_login( struct MXitSession* session, struct record** records, int rcount ) -{ - PurpleStatus* status; - int presence; - const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME, - CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL, - CP_PROFILE_MOBILENR }; - - purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - - /* we were not yet logged in so we need to complete the login sequence here */ - session->flags |= MXIT_FLAG_LOGGEDIN; - purple_connection_update_progress( session->con, _( "Successfully Logged In..." ), 3, 4 ); - purple_connection_set_state( session->con, PURPLE_CONNECTED ); - - /* display the current splash-screen */ - if ( splash_popup_enabled( session ) ) - splash_display( session ); - - /* update presence status */ - status = purple_account_get_active_status( session->acc ); - presence = mxit_convert_presence( purple_status_get_id( status ) ); - if ( presence != MXIT_PRESENCE_ONLINE ) { - /* when logging into MXit, your default presence is online. but with the UI, one can change - * the presence to whatever. in the case where its changed to a different presence setting - * we need to send an update to the server, otherwise the user's presence will be out of - * sync between the UI and MXit. - */ - mxit_send_presence( session, presence, purple_status_get_attr_string( status, "message" ) ); - } - - /* save extra info if this is a HTTP connection */ - if ( session->http ) { - /* save the http server to use for this session */ - g_strlcpy( session->http_server, records[1]->fields[3]->data, sizeof( session->http_server ) ); - - /* save the session id */ - session->http_sesid = atoi( records[0]->fields[0]->data ); - } - - /* retrieve our MXit profile */ - mxit_send_extprofile_request( session, NULL, ARRAY_SIZE( profilelist ), profilelist ); -} - - -/*------------------------------------------------------------------------ - * Process a received message packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_message( struct MXitSession* session, struct record** records, int rcount ) -{ - struct RXMsgData* mx = NULL; - char* message = NULL; - int msglen = 0; - int msgflags = 0; - int msgtype = 0; - - if ( ( rcount == 1 ) || ( records[0]->fcount < 2 ) || ( records[1]->fcount == 0 ) || ( records[1]->fields[0]->len == 0 ) ) { - /* packet contains no message or an empty message */ - return; - } - - message = records[1]->fields[0]->data; - msglen = strlen( message ); - - /* strip off dummy domain */ - mxit_strip_domain( records[0]->fields[0]->data ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "Message received from '%s'\n", records[0]->fields[0]->data ); -#endif - - /* decode message flags (if any) */ - if ( records[0]->fcount >= 5 ) - msgflags = atoi( records[0]->fields[4]->data ); - msgtype = atoi( records[0]->fields[2]->data ); - - if ( msgflags & CP_MSG_ENCRYPTED ) { - /* this is an encrypted message. we do not currently support those so ignore it */ - PurpleBuddy* buddy; - const char* name; - char msg[128]; - - buddy = purple_find_buddy( session->acc, records[0]->fields[0]->data ); - if ( buddy ) - name = purple_buddy_get_alias( buddy ); - else - name = records[0]->fields[0]->data; - g_snprintf( msg, sizeof( msg ), _( "%s sent you an encrypted message, but it is not supported on this client." ), name ); - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), msg ); - return; - } - - /* create and initialise new markup struct */ - mx = g_new0( struct RXMsgData, 1 ); - mx->msg = g_string_sized_new( msglen ); - mx->session = session; - mx->from = g_strdup( records[0]->fields[0]->data ); - mx->timestamp = atoi( records[0]->fields[1]->data ); - mx->got_img = FALSE; - mx->chatid = -1; - mx->img_count = 0; - - /* update list of active chats */ - if ( !find_active_chat( session->active_chats, mx->from ) ) { - session->active_chats = g_list_append( session->active_chats, g_strdup( mx->from ) ); - } - - if ( is_multimx_contact( session, mx->from ) ) { - /* this is a MultiMx chatroom message */ - multimx_message_received( mx, message, msglen, msgtype, msgflags ); - } - else { - mxit_parse_markup( mx, message, msglen, msgtype, msgflags ); - } - - /* we are now done parsing the message */ - mx->converted = TRUE; - if ( mx->img_count == 0 ) { - /* we have all the data we need for this message to be displayed now. */ - mxit_show_message( mx ); - } - else { - /* this means there are still images outstanding for this message and - * still need to wait for them before we can display the message. - * so the image received callback function will eventually display - * the message. */ - } -} - - -/*------------------------------------------------------------------------ - * Process a received subscription request packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_new_sub( struct MXitSession* session, struct record** records, int rcount ) -{ - struct contact* contact; - struct record* rec; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_new_sub (%i recs)\n", rcount ); - - for ( i = 0; i < rcount; i++ ) { - rec = records[i]; - - if ( rec->fcount < 4 ) { - purple_debug_error( MXIT_PLUGIN_ID, "BAD SUBSCRIPTION RECORD! %i fields\n", rec->fcount ); - break; - } - - /* build up a new contact info struct */ - contact = g_new0( struct contact, 1 ); - - strcpy( contact->username, rec->fields[0]->data ); - mxit_strip_domain( contact->username ); /* remove dummy domain */ - strcpy( contact->alias, rec->fields[1]->data ); - contact->type = atoi( rec->fields[2]->data ); - - if ( rec->fcount >= 5 ) { - /* there is a personal invite message attached */ - contact->msg = strdup( rec->fields[4]->data ); - } - else - contact->msg = NULL; - - /* handle the subscription */ - if ( contact-> type == MXIT_TYPE_MULTIMX ) { /* subscription to a MultiMX room */ - char* creator = NULL; - - if ( rec->fcount >= 6 ) - creator = rec->fields[5]->data; - - multimx_invite( session, contact, creator ); - } - else - mxit_new_subscription( session, contact ); - } -} - - -/*------------------------------------------------------------------------ - * Process a received contact update packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_contact( struct MXitSession* session, struct record** records, int rcount ) -{ - struct contact* contact = NULL; - struct record* rec; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_contact (%i recs)\n", rcount ); - - for ( i = 0; i < rcount; i++ ) { - rec = records[i]; - - if ( rec->fcount < 6 ) { - purple_debug_error( MXIT_PLUGIN_ID, "BAD CONTACT RECORD! %i fields\n", rec->fcount ); - break; - } - - /* build up a new contact info struct */ - contact = g_new0( struct contact, 1 ); - - strcpy( contact->groupname, rec->fields[0]->data ); - strcpy( contact->username, rec->fields[1]->data ); - mxit_strip_domain( contact->username ); /* remove dummy domain */ - strcpy( contact->alias, rec->fields[2]->data ); - - contact->presence = atoi( rec->fields[3]->data ); - contact->type = atoi( rec->fields[4]->data ); - contact->mood = atoi( rec->fields[5]->data ); - - if ( rec->fcount > 6 ) { - /* added in protocol 5.9.0 - flags & subtype */ - contact->flags = atoi( rec->fields[6]->data ); - contact->subtype = rec->fields[7]->data[0]; - } - - /* add the contact to the buddy list */ - if ( contact-> type == MXIT_TYPE_MULTIMX ) /* contact is a MultiMX room */ - multimx_created( session, contact ); - else - mxit_update_contact( session, contact ); - } - - if ( !( session->flags & MXIT_FLAG_FIRSTROSTER ) ) { - session->flags |= MXIT_FLAG_FIRSTROSTER; - mxit_update_blist( session ); - } -} - - -/*------------------------------------------------------------------------ - * Process a received presence update packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_presence( struct MXitSession* session, struct record** records, int rcount ) -{ - struct record* rec; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_presence (%i recs)\n", rcount ); - - for ( i = 0; i < rcount; i++ ) { - rec = records[i]; - - if ( rec->fcount < 6 ) { - purple_debug_error( MXIT_PLUGIN_ID, "BAD PRESENCE RECORD! %i fields\n", rec->fcount ); - break; - } - - /* - * The format of the record is: - * contactAddressN\1presenceN\1\moodN\1customMoodN\1statusMsgN\1avatarIdN - */ - mxit_strip_domain( rec->fields[0]->data ); /* contactAddress */ - - mxit_update_buddy_presence( session, rec->fields[0]->data, atoi( rec->fields[1]->data ), atoi( rec->fields[2]->data ), - rec->fields[3]->data, rec->fields[4]->data, rec->fields[5]->data ); - } -} - - -/*------------------------------------------------------------------------ - * Process a received extended profile packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct record** records, int rcount ) -{ - const char* mxitId = records[0]->fields[0]->data; - struct MXitProfile* profile = NULL; - int count; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_extprofile: profile for '%s'\n", mxitId ); - - profile = g_new0( struct MXitProfile, 1 ); - - /* set the count for attributes */ - count = atoi( records[0]->fields[1]->data ); - - for ( i = 0; i < count; i++ ) { - char* fname; - char* fvalue; - char* fstatus; - int f = ( i * 3 ) + 2; - - fname = records[0]->fields[f]->data; /* field name */ - fvalue = records[0]->fields[f + 1]->data; /* field value */ - fstatus = records[0]->fields[f + 2]->data; /* field status */ - - /* first check the status on the returned attribute */ - if ( fstatus[0] != '0' ) { - /* error: attribute requested was NOT found */ - purple_debug_error( MXIT_PLUGIN_ID, "Bad profile status on attribute '%s' \n", fname ); - continue; - } - - if ( strcmp( CP_PROFILE_BIRTHDATE, fname ) == 0 ) { - /* birthdate */ - if ( records[0]->fields[f + 1]->len > 10 ) { - fvalue[10] = '\0'; - records[0]->fields[f + 1]->len = 10; - } - memcpy( profile->birthday, fvalue, records[0]->fields[f + 1]->len ); - } - else if ( strcmp( CP_PROFILE_GENDER, fname ) == 0 ) { - /* gender */ - profile->male = ( fvalue[0] == '1' ); - } - else if ( strcmp( CP_PROFILE_HIDENUMBER, fname ) == 0 ) { - /* hide number */ - profile->hidden = ( fvalue[0] == '1' ); - } - else if ( strcmp( CP_PROFILE_FULLNAME, fname ) == 0 ) { - /* nickname */ - g_strlcpy( profile->nickname, fvalue, sizeof( profile->nickname ) ); - } - else if ( strcmp( CP_PROFILE_AVATAR, fname ) == 0 ) { - /* avatar id, we just ingore it cause we dont need it */ - } - else if ( strcmp( CP_PROFILE_TITLE, fname ) == 0 ) { - /* title */ - g_strlcpy( profile->title, fvalue, sizeof( profile->title ) ); - } - else if ( strcmp( CP_PROFILE_FIRSTNAME, fname ) == 0 ) { - /* first name */ - g_strlcpy( profile->firstname, fvalue, sizeof( profile->firstname ) ); - } - else if ( strcmp( CP_PROFILE_LASTNAME, fname ) == 0 ) { - /* last name */ - g_strlcpy( profile->lastname, fvalue, sizeof( profile->lastname ) ); - } - else if ( strcmp( CP_PROFILE_EMAIL, fname ) == 0 ) { - /* email address */ - g_strlcpy( profile->email, fvalue, sizeof( profile->email ) ); - } - else if ( strcmp( CP_PROFILE_MOBILENR, fname ) == 0 ) { - /* mobile number */ - g_strlcpy( profile->mobilenr, fvalue, sizeof( profile->mobilenr ) ); - } - else { - /* invalid profile attribute */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid profile attribute received '%s' \n", fname ); - } - } - - if ( records[0]->fields[0]->len == 0 ) { - /* no MXit id provided, so this must be our own profile information */ - if ( session->profile ) - g_free( session->profile ); - session->profile = profile; - } - else { - /* display other user's profile */ - mxit_show_profile( session, mxitId, profile ); - - /* cleanup */ - g_free( profile ); - } -} - - -/*------------------------------------------------------------------------ - * Return the length of a multimedia chunk - * - * @return The actual chunk data length in bytes - */ -static int get_chunk_len( const char* chunkdata ) -{ - int* sizeptr; - - sizeptr = (int*) &chunkdata[1]; /* we skip the first byte (type field) */ - - return ntohl( *sizeptr ); -} - - -/*------------------------------------------------------------------------ - * Process a received multimedia packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_media( struct MXitSession* session, struct record** records, int rcount ) -{ - char type; - int size; - - type = records[0]->fields[0]->data[0]; - size = get_chunk_len( records[0]->fields[0]->data ); - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_media (%i records) (%i bytes)\n", rcount, size ); - - /* supported chunked data types */ - switch ( type ) { - case CP_CHUNK_CUSTOM : /* custom resource */ - { - struct cr_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof( struct cr_chunk ) ); - mxit_chunk_parse_cr( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - purple_debug_info( MXIT_PLUGIN_ID, "chunk info id=%s handle=%s op=%i\n", chunk.id, chunk.handle, chunk.operation ); - - /* this is a splash-screen operation */ - if ( strcmp( chunk.handle, HANDLE_SPLASH2 ) == 0 ) { - if ( chunk.operation == CR_OP_UPDATE ) { /* update the splash-screen */ - struct splash_chunk *splash = chunk.resources->data; // TODO: Fix - assuming 1st resource is splash - gboolean clickable = ( g_list_length( chunk.resources ) > 1 ); // TODO: Fix - if 2 resources, then is clickable - - if ( splash != NULL ) - splash_update( session, chunk.id, splash->data, splash->datalen, clickable ); - } - else if ( chunk.operation == CR_OP_REMOVE ) /* remove the splash-screen */ - splash_remove( session ); - } - - /* cleanup custom resources */ - g_list_foreach( chunk.resources, (GFunc)g_free, NULL ); - - } - break; - - case CP_CHUNK_OFFER : /* file offer */ - { - struct offerfile_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof( struct offerfile_chunk ) ); - mxit_chunk_parse_offer( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - /* process the offer */ - mxit_xfer_rx_offer( session, chunk.username, chunk.filename, chunk.filesize, chunk.fileid ); - } - break; - - case CP_CHUNK_GET : /* get file response */ - { - struct getfile_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof( struct getfile_chunk ) ); - mxit_chunk_parse_get( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - /* process the getfile */ - mxit_xfer_rx_file( session, chunk.fileid, chunk.data, chunk.length ); - } - break; - - case CP_CHUNK_GET_AVATAR : /* get avatars */ - { - struct getavatar_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof ( struct getavatar_chunk ) ); - mxit_chunk_parse_get_avatar( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - /* update avatar image */ - if ( chunk.data ) { - purple_debug_info( MXIT_PLUGIN_ID, "updating avatar for contact '%s'\n", chunk.mxitid ); - purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length), chunk.length, chunk.avatarid ); - } - - } - break; - - case CP_CHUNK_SET_AVATAR : - /* this is a reply packet to a set avatar request. no action is required */ - break; - - case CP_CHUNK_DIRECT_SND : - /* this is a ack for a file send. no action is required */ - break; - - case CP_CHUNK_RECIEVED : - /* this is a ack for a file received. no action is required */ - break; - - default : - purple_debug_error( MXIT_PLUGIN_ID, "Unsupported chunked data packet type received (%i)\n", type ); - break; - } -} - - -/*------------------------------------------------------------------------ - * Handle a redirect sent from the MXit server. - * - * @param session The MXit session object - * @param url The redirect information - */ -static void mxit_perform_redirect( struct MXitSession* session, const char* url ) -{ - gchar** parts; - gchar** host; - int type; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_perform_redirect: %s\n", url ); - - /* tokenize the URL string */ - parts = g_strsplit( url, ";", 0 ); - - /* Part 1: protocol://host:port */ - host = g_strsplit( parts[0], ":", 4 ); - if ( strcmp( host[0], "socket" ) == 0 ) { - /* redirect to a MXit socket proxy */ - g_strlcpy( session->server, &host[1][2], sizeof( session->server ) ); - session->port = atoi( host[2] ); - } - else { - purple_connection_error( session->con, _( "Cannot perform redirect using the specified protocol" ) ); - goto redirect_fail; - } - - /* Part 2: type of redirect */ - type = atoi( parts[1] ); - if ( type == CP_REDIRECT_PERMANENT ) { - /* permanent redirect, so save new MXit server and port */ - purple_account_set_string( session->acc, MXIT_CONFIG_SERVER_ADDR, session->server ); - purple_account_set_int( session->acc, MXIT_CONFIG_SERVER_PORT, session->port ); - } - - /* Part 3: message (optional) */ - if ( parts[2] != NULL ) - purple_connection_notice( session->con, parts[2] ); - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_perform_redirect: %s redirect to %s:%i\n", - ( type == CP_REDIRECT_PERMANENT ) ? "Permanent" : "Temporary", session->server, session->port ); - - /* perform the re-connect to the new MXit server */ - mxit_reconnect( session ); - -redirect_fail: - g_strfreev( parts ); - g_strfreev( host ); -} - - -/*------------------------------------------------------------------------ - * Process a success response received from the MXit server. - * - * @param session The MXit session object - * @param packet The received packet - */ -static int process_success_response( struct MXitSession* session, struct rx_packet* packet ) -{ - /* ignore ping/poll packets */ - if ( ( packet->cmd != CP_CMD_PING ) && ( packet->cmd != CP_CMD_POLL ) ) - session->last_rx = time( NULL ); - - /* - * when we pass the packet records to the next level for parsing - * we minus 3 records because 1) the first record is the packet - * type 2) packet reply status 3) the last record is bogus - */ - - /* packet command */ - switch ( packet->cmd ) { - - case CP_CMD_REGISTER : - /* fall through, when registeration successful, MXit will auto login */ - case CP_CMD_LOGIN : - /* login response */ - if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) { - mxit_parse_cmd_login( session, &packet->records[2], packet->rcount - 3 ); - } - break; - - case CP_CMD_LOGOUT : - /* logout response */ - session->flags &= ~MXIT_FLAG_LOGGEDIN; - purple_account_disconnect( session->acc ); - - /* note: - * we do not prompt the user here for a reconnect, because this could be the user - * logging in with his phone. so we just disconnect the account otherwise - * mxit will start to bounce between the phone and pidgin. also could be a valid - * disconnect selected by the user. - */ - return -1; - - case CP_CMD_CONTACT : - /* contact update */ - mxit_parse_cmd_contact( session, &packet->records[2], packet->rcount - 3 ); - break; - - case CP_CMD_PRESENCE : - /* presence update */ - mxit_parse_cmd_presence(session, &packet->records[2], packet->rcount - 3 ); - break; - - case CP_CMD_RX_MSG : - /* incoming message (no bogus record) */ - mxit_parse_cmd_message( session, &packet->records[2], packet->rcount - 2 ); - break; - - case CP_CMD_NEW_SUB : - /* new subscription request */ - mxit_parse_cmd_new_sub( session, &packet->records[2], packet->rcount - 3 ); - break; - - case CP_CMD_MEDIA : - /* multi-media message */ - mxit_parse_cmd_media( session, &packet->records[2], packet->rcount - 2 ); - break; - - case CP_CMD_EXTPROFILE_GET : - /* profile update */ - mxit_parse_cmd_extprofile( session, &packet->records[2], packet->rcount - 2 ); - break; - - case CP_CMD_MOOD : - /* mood update */ - case CP_CMD_UPDATE : - /* update contact information */ - case CP_CMD_ALLOW : - /* allow subscription ack */ - case CP_CMD_DENY : - /* deny subscription ack */ - case CP_CMD_INVITE : - /* invite contact ack */ - case CP_CMD_REMOVE : - /* remove contact ack */ - case CP_CMD_TX_MSG : - /* outgoing message ack */ - case CP_CMD_STATUS : - /* presence update ack */ - case CP_CMD_GRPCHAT_CREATE : - /* create groupchat */ - case CP_CMD_GRPCHAT_INVITE : - /* groupchat invite */ - case CP_CMD_PING : - /* ping reply */ - case CP_CMD_POLL : - /* HTTP poll reply */ - case CP_CMD_EXTPROFILE_SET : - /* profile update */ - case CP_CMD_SPLASHCLICK : - /* splash-screen clickthrough */ - break; - - default : - /* unknown packet */ - purple_debug_error( MXIT_PLUGIN_ID, "Received unknown client packet (cmd = %i)\n", packet->cmd ); - } - - return 0; -} - - -/*------------------------------------------------------------------------ - * Process an error response received from the MXit server. - * - * @param session The MXit session object - * @param packet The received packet - */ -static int process_error_response( struct MXitSession* session, struct rx_packet* packet ) -{ - char errmsg[256]; - const char* errdesc; - - /* set the error description to be shown to the user */ - if ( packet->errmsg ) - errdesc = packet->errmsg; - else - errdesc = _( "An internal MXit server error occurred." ); - - purple_debug_info( MXIT_PLUGIN_ID, "Error Reply %i:%s\n", packet->errcode, errdesc ); - - if ( packet->errcode == MXIT_ERRCODE_LOGGEDOUT ) { - /* we are not currently logged in, so we need to reconnect */ - purple_connection_error( session->con, _( errdesc ) ); - } - - /* packet command */ - switch ( packet->cmd ) { - - case CP_CMD_REGISTER : - case CP_CMD_LOGIN : - if ( packet->errcode == MXIT_ERRCODE_REDIRECT ) { - mxit_perform_redirect( session, packet->errmsg ); - return 0; - } - else { - sprintf( errmsg, _( "Login error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error( session->con, errmsg ); - return -1; - } - case CP_CMD_LOGOUT : - sprintf( errmsg, _( "Logout error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _( errmsg ) ); - return -1; - case CP_CMD_CONTACT : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Error" ), _( errdesc ) ); - break; - case CP_CMD_RX_MSG : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), _( errdesc ) ); - break; - case CP_CMD_TX_MSG : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Sending Error" ), _( errdesc ) ); - break; - case CP_CMD_STATUS : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Status Error" ), _( errdesc ) ); - break; - case CP_CMD_MOOD : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Mood Error" ), _( errdesc ) ); - break; - case CP_CMD_KICK : - /* - * the MXit server sends this packet if we were idle for too long. - * to stop the server from closing this connection we need to resend - * the login packet. - */ - mxit_send_login( session ); - break; - case CP_CMD_INVITE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Invitation Error" ), _( errdesc ) ); - break; - case CP_CMD_REMOVE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Removal Error" ), _( errdesc ) ); - break; - case CP_CMD_ALLOW : - case CP_CMD_DENY : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Subscription Error" ), _( errdesc ) ); - break; - case CP_CMD_UPDATE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Update Error" ), _( errdesc ) ); - break; - case CP_CMD_MEDIA : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "File Transfer Error" ), _( errdesc ) ); - break; - case CP_CMD_GRPCHAT_CREATE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Cannot create MultiMx room" ), _( errdesc ) ); - break; - case CP_CMD_GRPCHAT_INVITE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "MultiMx Invitation Error" ), _( errdesc ) ); - break; - case CP_CMD_EXTPROFILE_GET : - case CP_CMD_EXTPROFILE_SET : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Profile Error" ), _( errdesc ) ); - break; - case CP_CMD_SPLASHCLICK : - /* ignore error */ - break; - case CP_CMD_PING : - case CP_CMD_POLL : - break; - default : - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Error" ), _( errdesc ) ); - break; - } - - return 0; -} - - -/*======================================================================================================================== - * Low-level Packet receive - */ - -#ifdef DEBUG_PROTOCOL -/*------------------------------------------------------------------------ - * Dump a received packet structure. - * - * @param p The received packet - */ -static void dump_packet( struct rx_packet* p ) -{ - struct record* r = NULL; - struct field* f = NULL; - int i; - int j; - - purple_debug_info( MXIT_PLUGIN_ID, "PACKET DUMP: (%i records)\n", p->rcount ); - - for ( i = 0; i < p->rcount; i++ ) { - r = p->records[i]; - purple_debug_info( MXIT_PLUGIN_ID, "RECORD: (%i fields)\n", r->fcount ); - - for ( j = 0; j < r->fcount; j++ ) { - f = r->fields[j]; - purple_debug_info( MXIT_PLUGIN_ID, "\tFIELD: (len=%i) '%s' \n", f->len, f->data ); - } - } -} -#endif - - -/*------------------------------------------------------------------------ - * Free up memory used by a packet structure. - * - * @param p The received packet - */ -static void free_rx_packet( struct rx_packet* p ) -{ - struct record* r = NULL; - struct field* f = NULL; - int i; - int j; - - for ( i = 0; i < p->rcount; i++ ) { - r = p->records[i]; - - for ( j = 0; j < r->fcount; j++ ) { - g_free( f ); - } - g_free( r->fields ); - g_free( r ); - } - g_free( p->records ); -} - - -/*------------------------------------------------------------------------ - * Add a new field to a record. - * - * @param r Parent record object - * @return The newly created field - */ -static struct field* add_field( struct record* r ) -{ - struct field* field; - - field = g_new0( struct field, 1 ); - - r->fields = realloc( r->fields, sizeof( struct field* ) * ( r->fcount + 1 ) ); - r->fields[r->fcount] = field; - r->fcount++; - - return field; -} - - -/*------------------------------------------------------------------------ - * Add a new record to a packet. - * - * @param p The packet object - * @return The newly created record - */ -static struct record* add_record( struct rx_packet* p ) -{ - struct record* rec; - - rec = g_new0( struct record, 1 ); - - p->records = realloc( p->records, sizeof( struct record* ) * ( p->rcount + 1 ) ); - p->records[p->rcount] = rec; - p->rcount++; - - return rec; -} - - -/*------------------------------------------------------------------------ - * Parse the received byte stream into a proper client protocol packet. - * - * @param session The MXit session object - * @return Success (0) or Failure (!0) - */ -int mxit_parse_packet( struct MXitSession* session ) -{ - struct rx_packet packet; - struct record* rec; - struct field* field; - gboolean pbreak; - unsigned int i; - int res = 0; - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "Received packet (%i bytes)\n", session->rx_i ); - dump_bytes( session, session->rx_dbuf, session->rx_i ); -#endif - - i = 0; - while ( i < session->rx_i ) { - - /* create first record and field */ - rec = NULL; - field = NULL; - memset( &packet, 0x00, sizeof( struct rx_packet ) ); - rec = add_record( &packet ); - pbreak = FALSE; - - /* break up the received packet into fields and records for easy parsing */ - while ( ( i < session->rx_i ) && ( !pbreak ) ) { - - switch ( session->rx_dbuf[i] ) { - case CP_SOCK_REC_TERM : - /* new record */ - if ( packet.rcount == 1 ) { - /* packet command */ - packet.cmd = atoi( packet.records[0]->fields[0]->data ); - } - else if ( packet.rcount == 2 ) { - /* special case: binary multimedia packets should not be parsed here */ - if ( packet.cmd == CP_CMD_MEDIA ) { - /* add the chunked to new record */ - rec = add_record( &packet ); - field = add_field( rec ); - field->data = &session->rx_dbuf[i + 1]; - field->len = session->rx_i - i; - /* now skip the binary data */ - res = get_chunk_len( field->data ); - /* determine if we have more packets */ - if ( res + 6 + i < session->rx_i ) { - /* we have more than one packet in this stream */ - i += res + 6; - pbreak = TRUE; - } - else { - i = session->rx_i; - } - } - } - else if ( !field ) { - field = add_field( rec ); - field->data = &session->rx_dbuf[i]; - } - session->rx_dbuf[i] = '\0'; - rec = add_record( &packet ); - field = NULL; - - break; - case CP_FLD_TERM : - /* new field */ - session->rx_dbuf[i] = '\0'; - if ( !field ) { - field = add_field( rec ); - field->data = &session->rx_dbuf[i]; - } - field = NULL; - break; - case CP_PKT_TERM : - /* packet is done! */ - session->rx_dbuf[i] = '\0'; - pbreak = TRUE; - break; - default : - /* skip non special characters */ - if ( !field ) { - field = add_field( rec ); - field->data = &session->rx_dbuf[i]; - } - field->len++; - break; - } - - i++; - } - - if ( packet.rcount < 2 ) { - /* bad packet */ - purple_connection_error( session->con, _( "Invalid packet received from MXit." ) ); - free_rx_packet( &packet ); - continue; - } - - session->rx_dbuf[session->rx_i] = '\0'; - packet.errcode = atoi( packet.records[1]->fields[0]->data ); - - purple_debug_info( MXIT_PLUGIN_ID, "Packet received CMD:%i (%i)\n", packet.cmd, packet.errcode ); -#ifdef DEBUG_PROTOCOL - /* debug */ - dump_packet( &packet ); -#endif - - /* reset the out ack */ - if ( session->outack == packet.cmd ) { - /* outstanding ack received from mxit server */ - session->outack = 0; - } - - /* check packet status */ - if ( packet.errcode != MXIT_ERRCODE_SUCCESS ) { - /* error reply! */ - if ( ( packet.records[1]->fcount > 1 ) && ( packet.records[1]->fields[1]->data ) ) - packet.errmsg = packet.records[1]->fields[1]->data; - else - packet.errmsg = NULL; - - res = process_error_response( session, &packet ); - } - else { - /* success reply! */ - res = process_success_response( session, &packet ); - } - - /* free up the packet resources */ - free_rx_packet( &packet ); - } - - if ( session->outack == 0 ) - mxit_manage_queue( session ); - - return res; -} - - -/*------------------------------------------------------------------------ - * Callback when data is received from the MXit server. - * - * @param user_data The MXit session object - * @param source The file-descriptor on which data was received - * @param cond Condition which caused the callback (PURPLE_INPUT_READ) - */ -void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - char ch; - int res; - int len; - - if ( session->rx_state == RX_STATE_RLEN ) { - /* we are reading in the packet length */ - len = read( session->fd, &ch, 1 ); - if ( len < 0 ) { - /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); - return; - } - else if ( len == 0 ) { - /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); - return; - } - else { - /* byte read */ - if ( ch == CP_REC_TERM ) { - /* the end of the length record found */ - session->rx_lbuf[session->rx_i] = '\0'; - session->rx_res = atoi( &session->rx_lbuf[3] ); - if ( session->rx_res > CP_MAX_PACKET ) { - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); - } - session->rx_state = RX_STATE_DATA; - session->rx_i = 0; - } - else { - /* still part of the packet length record */ - session->rx_lbuf[session->rx_i] = ch; - session->rx_i++; - if ( session->rx_i >= sizeof( session->rx_lbuf ) ) { - /* malformed packet length record (too long) */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); - return; - } - } - } - } - else if ( session->rx_state == RX_STATE_DATA ) { - /* we are reading in the packet data */ - len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); - if ( len < 0 ) { - /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); - return; - } - else if ( len == 0 ) { - /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); - return; - } - else { - /* data read */ - session->rx_i += len; - session->rx_res -= len; - - if ( session->rx_res == 0 ) { - /* ok, so now we have read in the whole packet */ - session->rx_state = RX_STATE_PROC; - } - } - } - - if ( session->rx_state == RX_STATE_PROC ) { - /* we have a full packet, which we now need to process */ - res = mxit_parse_packet( session ); - - if ( res == 0 ) { - /* we are still logged in */ - session->rx_state = RX_STATE_RLEN; - session->rx_res = 0; - session->rx_i = 0; - } - } -} - - -/*------------------------------------------------------------------------ - * Log the user off MXit and close the connection - * - * @param session The MXit session object - */ -void mxit_close_connection( struct MXitSession* session ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_close_connection\n" ); - - if ( !( session->flags & MXIT_FLAG_CONNECTED ) ) { - /* we are already closed */ - return; - } - else if ( session->flags & MXIT_FLAG_LOGGEDIN ) { - /* we are currently logged in so we need to send a logout packet */ - if ( !session->http ) { - mxit_send_logout( session ); - } - session->flags &= ~MXIT_FLAG_LOGGEDIN; - } - session->flags &= ~MXIT_FLAG_CONNECTED; - - /* cancel outstanding HTTP request */ - if ( ( session->http ) && ( session->http_out_req ) ) { - purple_util_fetch_url_cancel( (PurpleUtilFetchUrlData*) session->http_out_req ); - session->http_out_req = NULL; - } - - /* remove the input cb function */ - if ( session->con->inpa ) { - purple_input_remove( session->con->inpa ); - session->con->inpa = 0; - } - - /* remove HTTP poll timer */ - if ( session->http_timer_id > 0 ) - purple_timeout_remove( session->http_timer_id ); - - /* remove queue manager timer */ - if ( session->q_timer > 0 ) - purple_timeout_remove( session->q_timer ); - - /* remove all groupchat rooms */ - while ( session->rooms != NULL ) { - struct multimx* multimx = (struct multimx *) session->rooms->data; - - session->rooms = g_list_remove( session->rooms, multimx ); - - free( multimx ); - } - g_list_free( session->rooms ); - session->rooms = NULL; - - /* remove all rx chats names */ - while ( session->active_chats != NULL ) { - char* chat = (char*) session->active_chats->data; - - session->active_chats = g_list_remove( session->active_chats, chat ); - - g_free( chat ); - } - g_list_free( session->active_chats ); - session->active_chats = NULL; - - /* free profile information */ - if ( session->profile ) - free( session->profile ); - - /* free custom emoticons */ - mxit_free_emoticon_cache( session ); - - /* free allocated memory */ - g_free( session->encpwd ); - session->encpwd = NULL; - - /* flush all the commands still in the queue */ - flush_queue( session ); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/protocol.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_PROTO_H_ -#define _MXIT_PROTO_H_ - - -/* Client protocol constants */ -#define CP_SOCK_REC_TERM '\x00' /* socket record terminator */ -#define CP_HTTP_REC_TERM '\x26' /* http record terminator '&' */ -#define CP_FLD_TERM '\x01' /* field terminator */ -#define CP_PKT_TERM '\x02' /* packet terminator */ - - -#define CP_MAX_PACKET ( 1024 * 1024 ) /* maximum client protocol packet size (1 MiB) */ -#define CP_MAX_FILESIZE ( 150 * 1000 ) /* maximum client protocol file transfer size (150 KB) */ -#define MXIT_EMOTICON_SIZE 18 /* icon size for custom emoticons */ -#define CP_MAX_STATUS_MSG 250 /* maximum status message length (in characters) */ - -/* Avatars */ -#define MXIT_AVATAR_SIZE 96 /* default avatar image size 96x96 */ -#define MXIT_AVATAR_TYPE "PNG" /* request avatars in this file type (only a suggestion) */ -#define MXIT_AVATAR_BITDEPT 24 /* request avatars with this bit depth (only a suggestion) */ - -/* Protocol error codes */ -#define MXIT_ERRCODE_SUCCESS 0 -#define MXIT_ERRCODE_REDIRECT 16 -#define MXIT_ERRCODE_LOGGEDOUT 42 - -/* MXit client features */ -#define MXIT_CF_NONE 0x000000 -#define MXIT_CF_FORMS 0x000001 -#define MXIT_CF_FILE_TRANSFER 0x000002 -#define MXIT_CF_CAMERA 0x000004 -#define MXIT_CF_COMMANDS 0x000008 -#define MXIT_CF_SMS 0x000010 -#define MXIT_CF_FILE_ACCESS 0x000020 -#define MXIT_CF_MIDP2 0x000040 -#define MXIT_CF_SKINS 0x000080 -#define MXIT_CF_AUDIO 0x000100 -#define MXIT_CF_ENCRYPTION 0x000200 -#define MXIT_CF_VOICE_REC 0x000400 -#define MXIT_CF_VECTOR_GFX 0x000800 -#define MXIT_CF_IMAGES 0x001000 -#define MXIT_CF_MARKUP 0x002000 -#define MXIT_CF_VIBES 0x004000 -#define MXIT_CF_SELECT_CONTACT 0x008000 -#define MXIT_CF_CUSTOM_EMO 0x010000 -#define MXIT_CF_ALERT_PROFILES 0x020000 -#define MXIT_CF_EXT_MARKUP 0x040000 -#define MXIT_CF_PLAIN_PWD 0x080000 -#define MXIT_CF_NO_GATEWAYS 0x100000 - -/* Client features supported by this implementation */ -#define MXIT_CP_FEATURES ( MXIT_CF_FILE_TRANSFER | MXIT_CF_FILE_ACCESS | MXIT_CF_AUDIO | MXIT_CF_MARKUP | MXIT_CF_EXT_MARKUP | MXIT_CF_NO_GATEWAYS | MXIT_CF_IMAGES | MXIT_CF_COMMANDS | MXIT_CF_VIBES | MXIT_CF_MIDP2 ) - - -#define MXIT_PING_INTERVAL ( 5 * 60 ) /* ping the server after X seconds of being idle (5 minutes) */ -#define MXIT_ACK_TIMEOUT ( 30 ) /* timeout after waiting X seconds for an ack from the server (30 seconds) */ - -/* MXit client version */ -#define MXIT_CP_DISTCODE "P" /* client distribution code (magic, do not touch!) */ -#define MXIT_CP_RELEASE "5.9.0" /* client protocol release version supported */ -#define MXIT_CP_ARCH "Y" /* client architecture series (Y not for Yoda but for PC-client) */ -#define MXIT_CLIENT_ID "LP" /* client ID as specified by MXit */ -#define MXIT_CP_PLATFORM "PURPLE" /* client platform */ -#define MXIT_CP_VERSION MXIT_CP_DISTCODE"-"MXIT_CP_RELEASE"-"MXIT_CP_ARCH"-"MXIT_CP_PLATFORM - -/* set operating system name */ -#if defined( __APPLE__ ) -#define MXIT_CP_OS "apple" -#elif defined( _WIN32 ) -#define MXIT_CP_OS "windows" -#elif defined( __linux__ ) -#define MXIT_CP_OS "linux" -#else -#define MXIT_CP_OS "unknown" -#endif - -/* Client capabilities */ -#define MXIT_CP_CAP "utf8=true;cid="MXIT_CLIENT_ID - -/* Client settings */ -#define MAX_QUEUE_SIZE ( 1 << 4 ) /* tx queue size (16 packets) */ -#define MXIT_POPUP_WIN_NAME "MXit Notification" /* popup window name */ -#define MXIT_MAX_ATTRIBS 10 /* maximum profile attributes supported */ -#define MXIT_DEFAULT_LOCALE "en" /* default locale setting */ -#define MXIT_DEFAULT_LOC "planetpurple" /* the default location for registration */ - -/* Client protocol commands */ -#define CP_CMD_LOGIN 0x0001 /* (1) login */ -#define CP_CMD_LOGOUT 0x0002 /* (2) logout */ -#define CP_CMD_CONTACT 0x0003 /* (3) get contacts */ -#define CP_CMD_UPDATE 0x0005 /* (5) update contact information */ -#define CP_CMD_INVITE 0x0006 /* (6) subscribe to new contact */ -#define CP_CMD_PRESENCE 0x0007 /* (7) get presence */ -#define CP_CMD_REMOVE 0x0008 /* (8) remove contact */ -#define CP_CMD_RX_MSG 0x0009 /* (9) get new messages */ -#define CP_CMD_TX_MSG 0x000A /* (10) send new message */ -#define CP_CMD_REGISTER 0x000B /* (11) register */ -//#define CP_CMD_PROFILE_SET 0x000C /* (12) set profile (DEPRECATED see CP_CMD_EXTPROFILE_SET) */ -#define CP_CMD_POLL 0x0011 /* (17) poll the HTTP server for an update */ -//#define CP_CMD_PROFILE_GET 0x001A /* (26) get profile (DEPRECATED see CP_CMD_EXTPROFILE_GET) */ -#define CP_CMD_MEDIA 0x001B /* (27) get multimedia message */ -#define CP_CMD_SPLASHCLICK 0x001F /* (31) splash-screen clickthrough */ -#define CP_CMD_STATUS 0x0020 /* (32) set shown presence & status */ -#define CP_CMD_MOOD 0x0029 /* (41) set mood */ -#define CP_CMD_KICK 0x002B /* (43) login kick */ -#define CP_CMD_GRPCHAT_CREATE 0x002C /* (44) create new groupchat */ -#define CP_CMD_GRPCHAT_INVITE 0x002D /* (45) add new groupchat member */ -#define CP_CMD_NEW_SUB 0x0033 /* (51) get new subscription */ -#define CP_CMD_ALLOW 0x0034 /* (52) allow subscription */ -#define CP_CMD_DENY 0x0037 /* (55) deny subscription */ -#define CP_CMD_EXTPROFILE_GET 0x0039 /* (57) get extended profile */ -#define CP_CMD_EXTPROFILE_SET 0x003A /* (58) set extended profile */ -#define CP_CMD_PING 0x03E8 /* (1000) ping (keepalive) */ - -/* HTTP connection */ -#define MXIT_HTTP_POLL_MIN 7 /* minimum time between HTTP polls (seconds) */ -#define MXIT_HTTP_POLL_MAX ( 10 * 60 ) /* maximum time between HTTP polls (seconds) */ - -/* receiver states */ -#define RX_STATE_RLEN 0x01 /* reading packet length section */ -#define RX_STATE_DATA 0x02 /* reading packet data section */ -#define RX_STATE_PROC 0x03 /* process read data */ - -/* message flags */ -#define CP_MSG_ENCRYPTED 0x0010 /* message is encrypted */ -#define CP_MSG_MARKUP 0x0200 /* message may contain markup */ -#define CP_MSG_EMOTICON 0x0400 /* message may contain custom emoticons */ - -/* redirect types */ -#define CP_REDIRECT_PERMANENT 1 /* permanent redirect */ -#define CP_REDIRECT_TEMPORARY 2 /* temporary redirect */ - -/* message tx types */ -#define CP_MSGTYPE_NORMAL 0x01 /* normal message */ -#define CP_MSGTYPE_CHAT 0x02 /* chat message */ -#define CP_MSGTYPE_HEADLINE 0x03 /* headline message */ -#define CP_MSGTYPE_ERROR 0x04 /* error message */ -#define CP_MSGTYPE_GROUPCHAT 0x05 /* groupchat message */ -#define CP_MSGTYPE_FORM 0x06 /* mxit custom form */ -#define CP_MSGTYPE_COMMAND 0x07 /* mxit command */ - - -/* extended profile attribute fields */ -#define CP_PROFILE_BIRTHDATE "birthdate" /* Birthdate (String - ISO 8601 format) */ -#define CP_PROFILE_GENDER "gender" /* Gender (Boolean - 0=female, 1=male) */ -#define CP_PROFILE_HIDENUMBER "hidenumber" /* Hide Number (Boolean - 0=false, 1=true) */ -#define CP_PROFILE_FULLNAME "fullname" /* Fullname (UTF8 String) */ -#define CP_PROFILE_STATUS "statusmsg" /* Status Message (UTF8 String) */ -#define CP_PROFILE_PREVSTATUS "prevstatusmsgs" /* Previous Status Messages (UTF8 String) */ -#define CP_PROFILE_AVATAR "avatarid" /* Avatar ID (String) */ -#define CP_PROFILE_MODIFIED "lastmodified" /* Last-Modified timestamp */ -#define CP_PROFILE_TITLE "title" /* Title (UTF8 String) */ -#define CP_PROFILE_FIRSTNAME "firstname" /* First name (UTF8 String) */ -#define CP_PROFILE_LASTNAME "lastname" /* Last name (UTF8 String) */ -#define CP_PROFILE_EMAIL "email" /* Email address (UTF8 String) */ -#define CP_PROFILE_MOBILENR "mobilenumber" /* Mobile Number (UTF8 String) */ - -/* extended profile field types */ -#define CP_PROF_TYPE_BOOL 0x02 /* boolean profile attribute type */ -#define CP_PROF_TYPE_INT 0x05 /* integer profile attribute type */ -#define CP_PROF_TYPE_UTF8 0x0A /* UTF8 string profile attribute type */ -#define CP_PROF_TYPE_DATE 0x0B /* date-time profile attribute type */ - - -/* define this to enable protocol debugging (very verbose logging) */ -#define DEBUG_PROTOCOL - - -/* ======================================================================================= */ - -struct MXitSession; - -/*------------------------------------------*/ - -struct field { - char* data; - int len; -}; - -struct record { - struct field** fields; - int fcount; -}; - -struct rx_packet { - int cmd; - int errcode; - char* errmsg; - struct record** records; - int rcount; -}; - -struct tx_packet { - int cmd; - char header[256]; - int headerlen; - char* data; - int datalen; -}; - -/*------------------------------------------*/ - - -/* - * A received message data object - */ -struct RXMsgData { - struct MXitSession* session; /* MXit session object */ - char* from; /* the sender's name */ - time_t timestamp; /* time at which the message was sent */ - GString* msg; /* newly created message converted to libPurple formatting */ - gboolean got_img; /* flag to say if this message got any images/emoticons embedded */ - short img_count; /* the amount of images/emoticons still outstanding for the message */ - int chatid; /* multimx chatroom id */ - int flags; /* libPurple conversation flags */ - gboolean converted; /* true if the message has been completely parsed and converted to libPurple markup */ - gboolean processed; /* the message has been processed completely and should be freed up */ -}; - - - -/* - * The packet transmission queue. - */ -struct tx_queue { - struct tx_packet* packets[MAX_QUEUE_SIZE]; /* array of packet pointers */ - int count; /* number of packets queued */ - int rd_i; /* queue current read index (queue offset for reading a packet) */ - int wr_i; /* queue current write index (queue offset for adding new packet) */ -}; - - -/* ======================================================================================= */ - -void mxit_popup( int type, const char* heading, const char* message ); -void mxit_strip_domain( char* username ); -gboolean find_active_chat( const GList* chats, const char* who ); - -void mxit_cb_rx( gpointer data, gint source, PurpleInputCondition cond ); -gboolean mxit_manage_queue( gpointer user_data ); -gboolean mxit_manage_polling( gpointer user_data ); - -void mxit_send_register( struct MXitSession* session ); -void mxit_send_login( struct MXitSession* session ); -void mxit_send_logout( struct MXitSession* session ); -void mxit_send_ping( struct MXitSession* session ); -void mxit_send_poll( struct MXitSession* session ); - -void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg ); -void mxit_send_mood( struct MXitSession* session, int mood ); -void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup ); - -void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes ); -void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] ); - -void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname ); -void mxit_send_remove( struct MXitSession* session, const char* username ); -void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias ); -void mxit_send_deny_sub( struct MXitSession* session, const char* username ); -void mxit_send_update_contact( struct MXitSession* session, const char* username, const char* alias, const char* groupname ); -void mxit_send_splashclick( struct MXitSession* session, const char* splashid ); - -void mxit_send_file( struct MXitSession* session, const char* username, const char* filename, const unsigned char* buf, int buflen ); -void mxit_send_file_reject( struct MXitSession* session, const char* fileid ); -void mxit_send_file_accept( struct MXitSession* session, const char* fileid, int filesize, int offset ); -void mxit_send_file_received( struct MXitSession* session, const char* fileid, short status ); -void mxit_set_avatar( struct MXitSession* session, const unsigned char* avatar, int avatarlen ); -void mxit_get_avatar( struct MXitSession* session, const char* mxitId, const char* avatarId ); - -void mxit_send_groupchat_create( struct MXitSession* session, const char* groupname, int nr_usernames, const char* usernames[] ); -void mxit_send_groupchat_invite( struct MXitSession* session, const char* roomid, int nr_usernames, const char* usernames[] ); - -int mxit_parse_packet( struct MXitSession* session ); -void dump_bytes( struct MXitSession* session, const char* buf, int len ); -void mxit_close_connection( struct MXitSession* session ); - - -#endif /* _MXIT_PROTO_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,722 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user roster management (mxit contacts) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "roster.h" - - -struct contact_invite { - struct MXitSession* session; /* MXit session object */ - struct contact* contact; /* The contact performing the invite */ -}; - - -/*======================================================================================================================== - * Presence / Status - */ - -/* statuses (reference: libpurple/status.h) */ -static struct status -{ - PurpleStatusPrimitive primative; - int mxit; - const char* id; - const char* name; -} const mxit_statuses[] = { - /* primative, no, id, name */ - { PURPLE_STATUS_OFFLINE, MXIT_PRESENCE_OFFLINE, "offline", N_( "Offline" ) }, /* 0 */ - { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_ONLINE, "online", N_( "Available" ) }, /* 1 */ - { PURPLE_STATUS_AWAY, MXIT_PRESENCE_AWAY, "away", N_( "Away" ) }, /* 2 */ - { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_AVAILABLE, "chat", N_( "Chatty" ) }, /* 3 */ - { PURPLE_STATUS_UNAVAILABLE, MXIT_PRESENCE_DND, "dnd", N_( "Do Not Disturb" ) } /* 4 */ -}; - - -/*------------------------------------------------------------------------ - * Return list of supported statuses. (see status.h) - * - * @param account The MXit account object - * @return List of PurpleStatusType - */ -GList* mxit_status_types( PurpleAccount* account ) -{ - GList* statuslist = NULL; - PurpleStatusType* type; - unsigned int i; - - for ( i = 0; i < ARRAY_SIZE( mxit_statuses ); i++ ) { - const struct status* status = &mxit_statuses[i]; - - /* add mxit status (reference: "libpurple/status.h") */ - type = purple_status_type_new_with_attrs( status->primative, status->id, _( status->name ), TRUE, TRUE, FALSE, - "message", _( "Message" ), purple_value_new( PURPLE_TYPE_STRING ), - NULL ); - - statuslist = g_list_append( statuslist, type ); - } - - return statuslist; -} - - -/*------------------------------------------------------------------------ - * Returns the MXit presence code, given the unique status ID. - * - * @param id The status ID - * @return The MXit presence code - */ -int mxit_convert_presence( const char* id ) -{ - unsigned int i; - - for ( i = 0; i < ARRAY_SIZE( mxit_statuses ); i++ ) { - if ( strcmp( mxit_statuses[i].id, id ) == 0 ) /* status found! */ - return mxit_statuses[i].mxit; - } - - return -1; -} - - -/*------------------------------------------------------------------------ - * Returns the MXit presence as a string, given the MXit presence ID. - * - * @param no The MXit presence I (see above) - * @return The presence as a text string - */ -const char* mxit_convert_presence_to_name( short no ) -{ - unsigned int i; - - for ( i = 0; i < ARRAY_SIZE( mxit_statuses ); i++ ) { - if ( mxit_statuses[i].mxit == no ) /* status found! */ - return _( mxit_statuses[i].name ); - } - - return ""; -} - - -/*======================================================================================================================== - * Moods - */ - -/*------------------------------------------------------------------------ - * Returns the MXit mood as a string, given the MXit mood's ID. - * - * @param id The MXit mood ID (see roster.h) - * @return The mood as a text string - */ -const char* mxit_convert_mood_to_name( short id ) -{ - switch ( id ) { - case MXIT_MOOD_ANGRY : - return _( "Angry" ); - case MXIT_MOOD_EXCITED : - return _( "Excited" ); - case MXIT_MOOD_GRUMPY : - return _( "Grumpy" ); - case MXIT_MOOD_HAPPY : - return _( "Happy" ); - case MXIT_MOOD_INLOVE : - return _( "In Love" ); - case MXIT_MOOD_INVINCIBLE : - return _( "Invincible" ); - case MXIT_MOOD_SAD : - return _( "Sad" ); - case MXIT_MOOD_HOT : - return _( "Hot" ); - case MXIT_MOOD_SICK : - return _( "Sick" ); - case MXIT_MOOD_SLEEPY : - return _( "Sleepy" ); - case MXIT_MOOD_NONE : - default : - return ""; - } -} - - -/*======================================================================================================================== - * Subscription Types - */ - -/*------------------------------------------------------------------------ - * Returns a Contact subscription type as a string. - * - * @param subtype The subscription type - * @return The subscription type as a text string - */ -const char* mxit_convert_subtype_to_name( short subtype ) -{ - switch ( subtype ) { - case MXIT_SUBTYPE_BOTH : - return _( "Both" ); - case MXIT_SUBTYPE_PENDING : - return _( "Pending" ); - case MXIT_SUBTYPE_ASK : - return _( "Invited" ); - case MXIT_SUBTYPE_REJECTED : - return _( "Rejected" ); - case MXIT_SUBTYPE_DELETED : - return _( "Deleted" ); - case MXIT_SUBTYPE_NONE : - return _( "None" ); - default : - return ""; - } -} - - -/*======================================================================================================================== - * Calls from the MXit Protocol layer - */ - -#if 0 -/*------------------------------------------------------------------------ - * Dump a contact's info the the debug console. - * - * @param contact The contact - */ -static void dump_contact( struct contact* contact ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "CONTACT: name='%s', alias='%s', group='%s', type='%i', presence='%i', mood='%i'\n", - contact->username, contact->alias, contact->groupname, contact->type, contact->presence, contact->mood ); -} -#endif - - -#if 0 -/*------------------------------------------------------------------------ - * Move a buddy from one group to another - * - * @param buddy the buddy to move between groups - * @param group the new group to move the buddy to - */ -static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, PurpleBuddy* buddy, PurpleGroup* group ) -{ - struct contact* contact = NULL; - PurpleGroup* current_group = purple_buddy_get_group( buddy ); - PurpleBuddy* newbuddy = NULL; - - /* make sure the groups actually differs */ - if ( strcmp( current_group->name, group->name ) != 0 ) { - /* groupnames does not match, so we need to make the update */ - - purple_debug_info( MXIT_PLUGIN_ID, "Moving '%s' from group '%s' to '%s'\n", buddy->alias, current_group->name, group->name ); - - /* - * XXX: libPurple does not currently provide an API to change or rename the group name - * for a specific buddy. One option is to remove the buddy from the list and re-adding - * him in the new group, but by doing that makes the buddy go offline and then online - * again. This is really not ideal and very iretating, but how else then? - */ - - /* create new buddy */ - newbuddy = purple_buddy_new( session->acc, buddy->name, buddy->alias ); - newbuddy->proto_data = buddy->proto_data; - buddy->proto_data = NULL; - - /* remove the buddy */ - purple_blist_remove_buddy( buddy ); - - /* add buddy */ - purple_blist_add_buddy( newbuddy, NULL, group, NULL ); - - /* now re-instate his presence again */ - contact = newbuddy->proto_data; - if ( contact ) { - - /* update the buddy's status (reference: "libpurple/prpl.h") */ - if ( contact->statusMsg ) - purple_prpl_got_user_status( session->acc, newbuddy->name, mxit_statuses[contact->presence].id, "message", contact->statusMsg, NULL ); - else - purple_prpl_got_user_status( session->acc, newbuddy->name, mxit_statuses[contact->presence].id, NULL ); - - /* update avatar */ - if ( contact->avatarId ) { - mxit_get_avatar( session, newbuddy->name, contact->avatarId ); - g_free( contact->avatarId ); - contact->avatarId = NULL; - } - } - - return newbuddy; - } - else - return buddy; -} -#endif - - -/*------------------------------------------------------------------------ - * A contact update packet was received from the MXit server, so update the buddy's - * information. - * - * @param session The MXit session object - * @param contact The contact - */ -void mxit_update_contact( struct MXitSession* session, struct contact* contact ) -{ - PurpleBuddy* buddy = NULL; - PurpleGroup* group = NULL; - const char* id = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_update_contact: user='%s' alias='%s' group='%s'\n", contact->username, contact->alias, contact->groupname ); - - /* - * libPurple requires all contacts to be in a group. - * So if this MXit contact isn't in a group, pretend it is. - */ - if ( *contact->groupname == '\0' ) { - strcpy( contact->groupname, MXIT_DEFAULT_GROUP ); - } - - /* find or create a group for this contact */ - group = purple_find_group( contact->groupname ); - if ( !group ) - group = purple_group_new( contact->groupname ); - - /* see if the buddy is not in the group already */ - buddy = purple_find_buddy_in_group( session->acc, contact->username, group ); - if ( !buddy ) { - /* buddy not found in the group */ - - /* lets try finding him in all groups */ - buddy = purple_find_buddy( session->acc, contact->username ); - if ( buddy ) { - /* ok, so we found him in another group. to switch him between groups we must delete him and add him again. */ - purple_blist_remove_buddy( buddy ); - buddy = NULL; - } - - /* create new buddy */ - buddy = purple_buddy_new( session->acc, contact->username, contact->alias ); - buddy->proto_data = contact; - - /* add new buddy to list */ - purple_blist_add_buddy( buddy, NULL, group, NULL ); - } - else { - /* buddy was found in the group */ - - /* now update the buddy's alias */ - purple_blist_alias_buddy( buddy, contact->alias ); - - /* replace the buddy's contact struct */ - if ( buddy->proto_data ) - free( buddy->proto_data ); - buddy->proto_data = contact; - } - - /* load buddy's avatar id */ - id = purple_buddy_icons_get_checksum_for_user( buddy ); - if ( id ) - contact->avatarId = g_strdup( id ); - else - contact->avatarId = NULL; - - /* update the buddy's status (reference: "libpurple/prpl.h") */ - purple_prpl_got_user_status( session->acc, contact->username, mxit_statuses[contact->presence].id, NULL ); -} - - -/*------------------------------------------------------------------------ - * A presence update packet was received from the MXit server, so update the buddy's - * information. - * - * @param session The MXit session object - * @param username The contact which presence to update - * @param presence The new presence state for the contact - * @param mood The new mood for the contact - * @param customMood The custom mood identifier - * @param statusMsg This is the contact's status message - * @param avatarId This is the contact's avatar id - */ -void mxit_update_buddy_presence( struct MXitSession* session, const char* username, short presence, short mood, const char* customMood, const char* statusMsg, const char* avatarId ) -{ - PurpleBuddy* buddy = NULL; - struct contact* contact = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_update_buddy_presence: user='%s' presence=%i mood=%i customMood='%s' statusMsg='%s' avatar='%s'\n", - username, presence, mood, customMood, statusMsg, avatarId ); - - if ( ( presence < MXIT_PRESENCE_OFFLINE ) || ( presence > MXIT_PRESENCE_DND ) ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_update_buddy_presence: invalid presence state %i\n", presence ); - return; /* ignore packet */ - } - - /* find the buddy information for this contact (reference: "libpurple/blist.h") */ - buddy = purple_find_buddy( session->acc, username ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_update_buddy_presence: unable to find the buddy '%s'\n", username ); - return; - } - - contact = buddy->proto_data; - if ( !contact ) - return; - - contact->presence = presence; - contact->mood = mood; - - g_strlcpy( contact->customMood, customMood, sizeof( contact->customMood ) ); - // TODO: Download custom mood frame. - - /* update status message */ - if ( contact->statusMsg ) { - g_free( contact->statusMsg ); - contact->statusMsg = NULL; - } - if ( statusMsg[0] != '\0' ) - contact->statusMsg = g_markup_escape_text( statusMsg, -1 ); - - /* update avatarId */ - if ( ( contact->avatarId ) && ( g_ascii_strcasecmp( contact->avatarId, avatarId ) == 0 ) ) { - /* avatar has not changed - do nothing */ - } - else if ( avatarId[0] != '\0' ) { /* avatar has changed */ - if ( contact->avatarId ) - g_free( contact->avatarId ); - contact->avatarId = g_strdup( avatarId ); - - /* Send request to download new avatar image */ - mxit_get_avatar( session, username, avatarId ); - } - else /* clear current avatar */ - purple_buddy_icons_set_for_user( session->acc, username, NULL, 0, NULL ); - - /* update the buddy's status (reference: "libpurple/prpl.h") */ - if ( contact->statusMsg ) - purple_prpl_got_user_status( session->acc, username, mxit_statuses[contact->presence].id, "message", contact->statusMsg, NULL ); - else - purple_prpl_got_user_status( session->acc, username, mxit_statuses[contact->presence].id, NULL ); -} - - -/*------------------------------------------------------------------------ - * update the blist cached by libPurple. We need to do this to keep - * libPurple and MXit's rosters in sync with each other. - * - * @param session The MXit session object - */ -void mxit_update_blist( struct MXitSession* session ) -{ - PurpleBuddy* buddy = NULL; - GSList* list = NULL; - unsigned int i; - - /* remove all buddies we did not receive a roster update for. - * these contacts must have been removed from another client */ - list = purple_find_buddies( session->acc, NULL ); - - for ( i = 0; i < g_slist_length( list ); i++ ) { - buddy = g_slist_nth_data( list, i ); - - if ( !buddy->proto_data ) { - /* this buddy should be removed, because we did not receive him in our roster update from MXit */ - purple_debug_info( MXIT_PLUGIN_ID, "Removed 'old' buddy from the blist '%s' (%s)\n", buddy->alias, buddy->name ); - purple_blist_remove_buddy( buddy ); - } - } - - /* tell the UI to update the blist */ - purple_blist_add_account( session->acc ); -} - - -/*------------------------------------------------------------------------ - * The user authorized an invite (subscription request). - * - * @param user_data Object associated with the invite - */ -static void mxit_cb_buddy_auth( gpointer user_data ) -{ - struct contact_invite* invite = (struct contact_invite*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_buddy_auth '%s'\n", invite->contact->username ); - - /* send a allow subscription packet to MXit */ - mxit_send_allow_sub( invite->session, invite->contact->username, invite->contact->alias ); - - /* freeup invite object */ - if ( invite->contact->msg ) - g_free( invite->contact->msg ); - g_free( invite->contact ); - g_free( invite ); -} - - -/*------------------------------------------------------------------------ - * The user rejected an invite (subscription request). - * - * @param user_data Object associated with the invite - */ -static void mxit_cb_buddy_deny( gpointer user_data ) -{ - struct contact_invite* invite = (struct contact_invite*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_buddy_deny '%s'\n", invite->contact->username ); - - /* send a deny subscription packet to MXit */ - mxit_send_deny_sub( invite->session, invite->contact->username ); - - /* freeup invite object */ - if ( invite->contact->msg ) - g_free( invite->contact->msg ); - g_free( invite->contact ); - g_free( invite ); -} - - -/*------------------------------------------------------------------------ - * A new subscription request packet was received from the MXit server. - * Prompt user to accept or reject it. - * - * @param session The MXit session object - * @param contact The contact performing the invite - */ -void mxit_new_subscription( struct MXitSession* session, struct contact* contact ) -{ - struct contact_invite* invite; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_new_subscription from '%s' (%s)\n", contact->username, contact->alias ); - - invite = g_new0( struct contact_invite, 1 ); - invite->session = session; - invite->contact = contact; - - /* (reference: "libpurple/account.h") */ - purple_account_request_authorization( session->acc, contact->username, NULL, contact->alias, contact->msg, FALSE, mxit_cb_buddy_auth, mxit_cb_buddy_deny, invite ); -} - - -/*------------------------------------------------------------------------ - * Return TRUE if this is a MXit Chatroom contact. - * - * @param session The MXit session object - * @param username The username of the contact - */ -gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* username ) -{ - PurpleBuddy* buddy; - struct contact* contact = NULL; - - /* find the buddy */ - buddy = purple_find_buddy( session->acc, username ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "is_mxit_chatroom_contact: unable to find the buddy '%s'\n", username ); - return FALSE; - } - - contact = buddy->proto_data; - if ( !contact ) - return FALSE; - - return ( contact->type == MXIT_TYPE_CHATROOM ); -} - - -/*======================================================================================================================== - * Callbacks from libpurple - */ - -/*------------------------------------------------------------------------ - * The user has added a buddy to the list, so send an invite request. - * - * @param gc The connection object - * @param buddy The new buddy - * @param group The group of the new buddy - */ -void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - GSList* list = NULL; - PurpleBuddy* mxbuddy = NULL; - unsigned int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy '%s' (group='%s')\n", buddy->name, group->name ); - - list = purple_find_buddies( session->acc, buddy->name ); - if ( g_slist_length( list ) == 1 ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy (scenario 1) (list:%i)\n", g_slist_length( list ) ); - /* - * we only send an invite to MXit when the user is not already inside our - * blist. this is done because purple does an add_buddy() call when - * you accept an invite. so in that case the user is already - * in our blist and ready to be chatted to. - */ - mxit_send_invite( session, buddy->name, buddy->alias, group->name ); - } - else { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy (scenario 2) (list:%i)\n", g_slist_length( list ) ); - /* - * we already have the buddy in our list, so we will only update - * his information here and not send another invite message - */ - - /* find the correct buddy */ - for ( i = 0; i < g_slist_length( list ); i++ ) { - mxbuddy = g_slist_nth_data( list, i ); - - if ( mxbuddy->proto_data != NULL ) { - /* this is our REAL MXit buddy! */ - - /* now update the buddy's alias */ - purple_blist_alias_buddy( mxbuddy, buddy->alias ); - - /* now update the buddy's group */ -// mxbuddy = mxit_update_buddy_group( session, mxbuddy, group ); - - /* send the update to the MXit server */ - mxit_send_update_contact( session, mxbuddy->name, mxbuddy->alias, group->name ); - } - } - } - - /* - * we remove the buddy here from the buddy list because the MXit server - * will send us a proper contact update packet if this succeeds. now - * we do not have to worry about error handling in case of adding an - * invalid contact. so the user will still see the contact as offline - * until he eventually accepts the invite. - */ - purple_blist_remove_buddy( buddy ); - - g_slist_free( list ); -} - - -/*------------------------------------------------------------------------ - * The user has removed a buddy from the list. - * - * @param gc The connection object - * @param buddy The buddy being removed - * @param group The group the buddy was in - */ -void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_remove_buddy '%s'\n", buddy->name ); - - mxit_send_remove( session, buddy->name ); -} - - -/*------------------------------------------------------------------------ - * The user changed the buddy's alias. - * - * @param gc The connection object - * @param who The username of the buddy - * @param alias The new alias - */ -void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleBuddy* buddy = NULL; - PurpleGroup* group = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_alias '%s' to '%s\n", who, alias ); - - /* find the buddy */ - buddy = purple_find_buddy( session->acc, who ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_buddy_alias: unable to find the buddy '%s'\n", who ); - return; - } - - /* find buddy group */ - group = purple_buddy_get_group( buddy ); - if ( !group ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_buddy_alias: unable to find the group for buddy '%s'\n", who ); - return; - } - - mxit_send_update_contact( session, who, alias, group->name ); -} - - -/*------------------------------------------------------------------------ - * The user changed the group for a single buddy. - * - * @param gc The connection object - * @param who The username of the buddy - * @param old_group The old group's name - * @param new_group The new group's name - */ -void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleBuddy* buddy = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_group from '%s' to '%s'\n", old_group, new_group ); - - /* find the buddy */ - buddy = purple_find_buddy( session->acc, who ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_buddy_group: unable to find the buddy '%s'\n", who ); - return; - } - - mxit_send_update_contact( session, who, buddy->alias, new_group ); -} - - -/*------------------------------------------------------------------------ - * The user has selected to rename a group, so update all contacts in that - * group. - * - * @param gc The connection object - * @param old_name The old group name - * @param group The updated group object - * @param moved_buddies The buddies affected by the rename - */ -void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleBuddy* buddy = NULL; - GList* item = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_rename_group from '%s' to '%s\n", old_name, group->name ); - - // TODO: Might be more efficient to use the "rename group" command (cmd=29). - - /* loop through all the contacts in the group and send updates */ - item = moved_buddies; - while ( item ) { - buddy = item->data; - mxit_send_update_contact( session, buddy->name, buddy->alias, group->name ); - item = g_list_next( item ); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/roster.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user roster management (mxit contacts) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_ROSTER_H_ -#define _MXIT_ROSTER_H_ - - -/* MXit contact presence states */ -#define MXIT_PRESENCE_OFFLINE 0x00 -#define MXIT_PRESENCE_ONLINE 0x01 -#define MXIT_PRESENCE_AWAY 0x02 -#define MXIT_PRESENCE_AVAILABLE 0x03 -#define MXIT_PRESENCE_DND 0x04 - - -/* MXit contact types */ -#define MXIT_TYPE_MXIT 0x00 -#define MXIT_TYPE_JABBER 0x01 -#define MXIT_TYPE_MSN 0x02 -#define MXIT_TYPE_YAHOO 0x03 -#define MXIT_TYPE_ICQ 0x04 -#define MXIT_TYPE_AIM 0x05 -#define MXIT_TYPE_QQ 0x06 -#define MXIT_TYPE_WV 0x07 -#define MXIT_TYPE_BOT 0x08 -#define MXIT_TYPE_CHATROOM 0x09 -#define MXIT_TYPE_SMS 0x0A -#define MXIT_TYPE_GROUP 0x0B -#define MXIT_TYPE_GALLERY 0x0C -#define MXIT_TYPE_INFO 0x0D -#define MXIT_TYPE_MULTIMX 0x0E -#define MXIT_TYPE_HYBRID 0x0F - - -/* MXit contact moods */ -#define MXIT_MOOD_NONE 0x00 -#define MXIT_MOOD_ANGRY 0x01 -#define MXIT_MOOD_EXCITED 0x02 -#define MXIT_MOOD_GRUMPY 0x03 -#define MXIT_MOOD_HAPPY 0x04 -#define MXIT_MOOD_INLOVE 0x05 -#define MXIT_MOOD_INVINCIBLE 0x06 -#define MXIT_MOOD_SAD 0x07 -#define MXIT_MOOD_HOT 0x08 -#define MXIT_MOOD_SICK 0x09 -#define MXIT_MOOD_SLEEPY 0x0A - - -/* MXit contact flags */ -#define MXIT_CFLAG_HIDDEN 0x02 -#define MXIT_CFLAG_GATEWAY 0x04 -#define MXIT_CFLAG_FOCUS_SEND_BLANK 0x20000 - - -/* Subscription types */ -#define MXIT_SUBTYPE_BOTH 'B' -#define MXIT_SUBTYPE_PENDING 'P' -#define MXIT_SUBTYPE_ASK 'A' -#define MXIT_SUBTYPE_REJECTED 'R' -#define MXIT_SUBTYPE_DELETED 'D' -#define MXIT_SUBTYPE_NONE 'N' - - -/* client protocol constants */ -#define MXIT_CP_MAX_JID_LEN 64 -#define MXIT_CP_MAX_GROUP_LEN 32 -#define MXIT_CP_MAX_ALIAS_LEN 48 - -#define MXIT_DEFAULT_GROUP "MXit" - - -/* - * a MXit contact - */ -struct contact { - char username[MXIT_CP_MAX_JID_LEN+1]; /* unique contact name (with domain) */ - char alias[MXIT_CP_MAX_GROUP_LEN+1]; /* contact alias (what will be seen) */ - char groupname[MXIT_CP_MAX_ALIAS_LEN+1]; /* contact group name */ - - short type; /* contact type */ - short mood; /* contact current mood */ - int flags; /* contact flags */ - short presence; /* presence state */ - short subtype; /* subscription type */ - - char* msg; /* invite message */ - - char customMood[16]; /* custom mood */ - char* statusMsg; /* status message */ - char* avatarId; /* avatarId */ -}; - -/* Presence / Status */ -GList* mxit_status_types( PurpleAccount* account ); -int mxit_convert_presence( const char* id ); -const char* mxit_convert_presence_to_name( short no ); -const char* mxit_convert_subtype_to_name( short subtype ); - -/* Moods */ -const char* mxit_convert_mood_to_name( short id ); - -/* MXit Protocol callbacks */ -void mxit_update_contact( struct MXitSession* session, struct contact* contact ); -void mxit_update_buddy_presence( struct MXitSession* session, const char* username, short presence, short mood, const char* customMood, const char* statusMsg, const char* avatarId ); -void mxit_new_subscription( struct MXitSession* session, struct contact* contact ); -void mxit_update_blist( struct MXitSession* session ); -gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* username ); - -/* libPurple callbacks */ -void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ); -void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ); -void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ); -void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ); -void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ); - - -#endif /* _MXIT_ROSTER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- splash screens -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include "purple.h" -#include "imgstore.h" - -#include "protocol.h" -#include "mxit.h" -#include "splashscreen.h" - - -/*------------------------------------------------------------------------ - * Return the ID of the current splash-screen. - * - * @param session The MXit session object - * @return The ID of the splash-screen (or NULL if no splash-screen) - */ -const char* splash_current(struct MXitSession* session) -{ - const char* splashId = purple_account_get_string(session->acc, MXIT_CONFIG_SPLASHID, NULL); - - if ((splashId != NULL) && (*splashId != '\0')) { - purple_debug_info(MXIT_PLUGIN_ID, "Current splashId: '%s'\n", splashId); - return splashId; - } - else - return NULL; -} - - -/*------------------------------------------------------------------------ - * Indicate if splash-screen popups are enabled. - * - * @param session The MXit session object - * @return TRUE if the popup is enabled. - */ -gboolean splash_popup_enabled(struct MXitSession* session) -{ - return purple_account_get_bool(session->acc, MXIT_CONFIG_SPLASHPOPUP, DEFAULT_SPLASH_POPUP); -} - - -/*------------------------------------------------------------------------ - * Return if the current splash-screen is clickable. - * - * @param session The MXit session object - * @return TRUE or FALSE - */ -static gboolean splash_clickable(struct MXitSession* session) -{ - return purple_account_get_bool(session->acc, MXIT_CONFIG_SPLASHCLICK, FALSE); -} - - -/*------------------------------------------------------------------------ - * Remove the stored splash-screen (if it exists). - * - * @param session The MXit session object - */ -void splash_remove(struct MXitSession* session) -{ - const char* splashId = NULL; - char* filename; - - /* Get current splash ID */ - splashId = splash_current(session); - - if (splashId != NULL) { - purple_debug_info(MXIT_PLUGIN_ID, "Removing splashId: '%s'\n", splashId); - - /* Delete stored splash image */ - filename = g_strdup_printf("%s/mxit/%s.png", purple_user_dir(), splashId); - g_unlink(filename); - g_free(filename); - - /* Clear current splash ID from settings */ - purple_account_set_string(session->acc, MXIT_CONFIG_SPLASHID, ""); - purple_account_set_bool(session->acc, MXIT_CONFIG_SPLASHCLICK, FALSE); - } -} - - -/*------------------------------------------------------------------------ - * Save a new splash-screen for later display. - * - * @param session The MXit session object - * @param splashID The ID of the splash-screen - * @param data Splash-screen image data (PNG format) - * @param datalen Splash-screen image data size - */ -void splash_update(struct MXitSession* session, const char* splashId, const char* data, int datalen, gboolean clickable) -{ - char* dir; - char* filename; - - /* Remove the current splash-screen */ - splash_remove(session); - - /* Save the new splash image */ - dir = g_strdup_printf("%s/mxit", purple_user_dir()); - purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR); /* ensure directory exists */ - - filename = g_strdup_printf("%s/%s.png", dir, splashId); - if (purple_util_write_data_to_file_absolute(filename, data, datalen)) { - /* Store new splash-screen ID to settings */ - purple_account_set_string(session->acc, MXIT_CONFIG_SPLASHID, splashId); - purple_account_set_bool(session->acc, MXIT_CONFIG_SPLASHCLICK, clickable ); - } - - g_free(dir); - g_free(filename); -} - - -/*------------------------------------------------------------------------ - * The user has clicked OK on the Splash request form. - * - * @param gc The connection object - * @param fields The list of fields in the accepted form - */ -static void splash_click_ok(PurpleConnection* gc, PurpleRequestFields* fields) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* splashId; - - /* Get current splash ID */ - splashId = splash_current(session); - if (splashId == NULL) /* no splash-screen */ - return; - - /* if is clickable, then send click event */ - if (splash_clickable(session)) - mxit_send_splashclick(session, splashId); -} - - -/*------------------------------------------------------------------------ - * Display the current splash-screen. - * - * @param session The MXit session object - */ -void splash_display(struct MXitSession* session) -{ - const char* splashId = NULL; - char* filename; - gchar* imgdata; - gsize imglen; - int imgid = -1; - - /* Get current splash ID */ - splashId = splash_current(session); - if (splashId == NULL) /* no splash-screen */ - return; - - purple_debug_info(MXIT_PLUGIN_ID, "Display Splash: '%s'\n", splashId); - - /* Load splash-screen image from file */ - filename = g_strdup_printf("%s/mxit/%s.png", purple_user_dir(), splashId); - if (g_file_get_contents(filename, &imgdata, &imglen, NULL)) { - char buf[128]; - - /* Add splash-image to imagestore */ - imgid = purple_imgstore_add_with_id(g_memdup(imgdata, imglen), imglen, NULL); - - /* Generate and display message */ - g_snprintf(buf, sizeof(buf), "", imgid); - - /* Open a request-type popup to display the image */ - { - PurpleRequestFields* fields; - PurpleRequestFieldGroup* group; - PurpleRequestField* field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_image_new("splash", "", imgdata, imglen); /* add splash image */ - purple_request_field_group_add_field(group, field); - - if (splash_clickable(session)) { - purple_request_fields(session->con, _("MXit Advertising"), NULL, NULL, fields, - _("More Information"), G_CALLBACK(splash_click_ok), _("Close"), NULL, session->acc, NULL, NULL, session->con); - } - else { - purple_request_fields(session->con, _("MXit Advertising"), NULL, NULL, fields, - _("Continue"), G_CALLBACK(splash_click_ok), _("Close"), NULL, session->acc, NULL, NULL, session->con); - } - } - - /* Release reference to image */ - purple_imgstore_unref_by_id(imgid); - - g_free(imgdata); - } - - g_free(filename); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/mxit/splashscreen.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- splash screens -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_SPLASHSCREEN_H_ -#define _MXIT_SPLASHSCREEN_H_ - -#define HANDLE_SPLASH1 "plas1.png" -#define HANDLE_SPLASH2 "plas2.png" - -#define DEFAULT_SPLASH_POPUP FALSE /* disabled by default */ - -/* - * Return the ID of the current splash-screen. - */ -const char* splash_current(struct MXitSession* session); - -/* - * Indicate if splash-screen popups are enabled. - */ -gboolean splash_popup_enabled(struct MXitSession* session); - -/* - * Save a new splash-screen. - */ -void splash_update(struct MXitSession* session, const char* splashId, const char* data, int datalen, gboolean clickable); - -/* - * Remove the stored splash-screen (if it exists). - */ -void splash_remove(struct MXitSession* session); - -/* - * Display the current splash-screen. - */ -void splash_display(struct MXitSession* session); - -#endif /* _MXIT_SPLASHSCREEN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MSIMSOURCES = markup.c \ - markup.h \ - message.c \ - message.h \ - myspace.c \ - myspace.h \ - persist.h \ - session.c \ - session.h \ - user.c \ - user.h \ - zap.c \ - zap.h - -AM_CFLAGS = $(st) - -libmyspace_la_LDFLAGS = -module -avoid-version - -if STATIC_MYSPACE - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmyspace.la -libmyspace_la_SOURCES = $(MSIMSOURCES) -libmyspace_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmyspace.la -libmyspace_la_SOURCES = $(MSIMSOURCES) -libmyspace_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,793 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/myspace -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MYSPACE_FALSE@libmyspace_la_DEPENDENCIES = \ -@STATIC_MYSPACE_FALSE@ $(am__DEPENDENCIES_1) -am__libmyspace_la_SOURCES_DIST = markup.c markup.h message.c message.h \ - myspace.c myspace.h persist.h session.c session.h user.c \ - user.h zap.c zap.h -am__objects_1 = libmyspace_la-markup.lo libmyspace_la-message.lo \ - libmyspace_la-myspace.lo libmyspace_la-session.lo \ - libmyspace_la-user.lo libmyspace_la-zap.lo -@STATIC_MYSPACE_FALSE@am_libmyspace_la_OBJECTS = $(am__objects_1) -@STATIC_MYSPACE_TRUE@am_libmyspace_la_OBJECTS = $(am__objects_1) -libmyspace_la_OBJECTS = $(am_libmyspace_la_OBJECTS) -@STATIC_MYSPACE_FALSE@am_libmyspace_la_rpath = -rpath $(pkgdir) -@STATIC_MYSPACE_TRUE@am_libmyspace_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmyspace_la_SOURCES) -DIST_SOURCES = $(am__libmyspace_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MSIMSOURCES = markup.c \ - markup.h \ - message.c \ - message.h \ - myspace.c \ - myspace.h \ - persist.h \ - session.c \ - session.h \ - user.c \ - user.h \ - zap.c \ - zap.h - -AM_CFLAGS = $(st) -libmyspace_la_LDFLAGS = -module -avoid-version -@STATIC_MYSPACE_FALSE@st = -@STATIC_MYSPACE_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MYSPACE_TRUE@noinst_LTLIBRARIES = libmyspace.la -@STATIC_MYSPACE_FALSE@libmyspace_la_SOURCES = $(MSIMSOURCES) -@STATIC_MYSPACE_TRUE@libmyspace_la_SOURCES = $(MSIMSOURCES) -@STATIC_MYSPACE_TRUE@libmyspace_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MYSPACE_FALSE@pkg_LTLIBRARIES = libmyspace.la -@STATIC_MYSPACE_FALSE@libmyspace_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/myspace/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/myspace/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmyspace.la: $(libmyspace_la_OBJECTS) $(libmyspace_la_DEPENDENCIES) - $(LINK) $(am_libmyspace_la_rpath) $(libmyspace_la_LDFLAGS) $(libmyspace_la_OBJECTS) $(libmyspace_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-markup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-message.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-myspace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-zap.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmyspace_la-markup.lo: markup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-markup.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-markup.Tpo" -c -o libmyspace_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-markup.Tpo" "$(DEPDIR)/libmyspace_la-markup.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-markup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='markup.c' object='libmyspace_la-markup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c - -libmyspace_la-message.lo: message.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-message.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-message.Tpo" -c -o libmyspace_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-message.Tpo" "$(DEPDIR)/libmyspace_la-message.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-message.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='message.c' object='libmyspace_la-message.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c - -libmyspace_la-myspace.lo: myspace.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-myspace.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-myspace.Tpo" -c -o libmyspace_la-myspace.lo `test -f 'myspace.c' || echo '$(srcdir)/'`myspace.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-myspace.Tpo" "$(DEPDIR)/libmyspace_la-myspace.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-myspace.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='myspace.c' object='libmyspace_la-myspace.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-myspace.lo `test -f 'myspace.c' || echo '$(srcdir)/'`myspace.c - -libmyspace_la-session.lo: session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-session.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-session.Tpo" -c -o libmyspace_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-session.Tpo" "$(DEPDIR)/libmyspace_la-session.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='session.c' object='libmyspace_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmyspace_la-user.lo: user.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-user.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-user.Tpo" -c -o libmyspace_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-user.Tpo" "$(DEPDIR)/libmyspace_la-user.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-user.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='user.c' object='libmyspace_la-user.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c - -libmyspace_la-zap.lo: zap.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-zap.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-zap.Tpo" -c -o libmyspace_la-zap.lo `test -f 'zap.c' || echo '$(srcdir)/'`zap.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-zap.Tpo" "$(DEPDIR)/libmyspace_la-zap.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-zap.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zap.c' object='libmyspace_la-zap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-zap.lo `test -f 'zap.c' || echo '$(srcdir)/'`zap.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmyspace -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmyspace -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = myspace.c message.c zap.c session.c markup.c user.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,763 +0,0 @@ -/* MySpaceIM Protocol Plugin - markup - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" - -typedef int (*MSIM_XMLNODE_CONVERT)(MsimSession *, xmlnode *, gchar **, gchar **); - -/* Globals */ - -/* The names in in emoticon_names (for ) map to corresponding - * entries in emoticon_symbols (for the ASCII representation of the emoticon). - * - * Multiple emoticon symbols in Pidgin can map to one name. List the - * canonical form, as inserted by the "Smile!" dialog, first. For example, - * :) comes before :-), because although both are recognized as 'happy', - * the first is inserted by the smiley button (first symbol in theme). - * - * Note that symbols are case-sensitive in Pidgin -- :-X is not :-x. */ -static struct MSIM_EMOTICON -{ - gchar *name; - gchar *symbol; -} msim_emoticons[] = { - /* Unfortunately, this list duplicates much of the file - * pidgin/pidgin/pixmaps/emotes/default/22/default.theme.in, because - * that file is part of Pidgin, but we're part of libpurple. - */ - { "bigsmile", ":D" }, - { "bigsmile", ":-D" }, - { "devil", "}:)" }, - { "frazzled", ":Z" }, - { "geek", "B)" }, - { "googles", "%)" }, - { "growl", ":E" }, - { "laugh", ":))" }, /* Must be before ':)' */ - { "happy", ":)" }, - { "happy", ":-)" }, - { "happi", ":)" }, - { "heart", ":X" }, - { "mohawk", "-:" }, - { "mad", "X(" }, - { "messed", "X)" }, - { "nerd", "Q)" }, - { "oops", ":G" }, - { "pirate", "P)" }, - { "scared", ":O" }, - { "sidefrown", ":{" }, - { "sinister", ":B" }, - { "smirk", ":," }, - { "straight", ":|" }, - { "tongue", ":P" }, - { "tongue", ":p" }, - { "tongy", ":P" }, - { "upset", "B|" }, - { "wink", ";-)" }, - { "wink", ";)" }, - { "winc", ";)" }, - { "worried", ":[" }, - { "kiss", ":x" }, - { NULL, NULL } -}; - -/* Indexes of this array + 1 map HTML font size to scale of normal font size. * - * Based on _point_sizes from libpurple/gtkimhtml.c - * 1 2 3 4 5 6 7 */ -static gdouble _font_scale[] = { .85, .95, 1, 1.2, 1.44, 1.728, 2.0736 }; - -/* Purple maximum font size. Equivalent to sizeof(_font_scale) / sizeof(_font_scale[0]) */ -#define MAX_FONT_SIZE 7 - -#define POINTS_PER_INCH 72 /* How many pt's in an inch */ - -/* Text formatting bits for */ -#define MSIM_TEXT_BOLD 1 -#define MSIM_TEXT_ITALIC 2 -#define MSIM_TEXT_UNDERLINE 4 - -/* Default baseline size of purple's fonts, in points. What is size 3 in points. - * _font_scale specifies scaling factor relative to this point size. Note this - * is only the default; it is configurable in account options. */ -#define MSIM_BASE_FONT_POINT_SIZE 8 - -/* Default display's DPI. 96 is common but it can differ. Also configurable - * in account options. */ -#define MSIM_DEFAULT_DPI 96 - -/* round is part of C99, but sometimes is unavailable before then. - * Based on http://forums.belution.com/en/cpp/000/050/13.shtml - */ -static double msim_round(double value) -{ - if (value < 0) { - return -(floor(-value + 0.5)); - } else { - return floor( value + 0.5); - } -} - -/** - * Convert typographical font point size to HTML font size. - * Based on libpurple/gtkimhtml.c - */ -static guint -msim_point_to_purple_size(MsimSession *session, guint point) -{ - guint size, this_point, base; - - base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - - for (size = 0; size < MAX_FONT_SIZE; ++size) { - this_point = (guint)msim_round(base * _font_scale[size]); - - if (this_point >= point) { - purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n", - point, size); - return size; - } - } - - /* No HTML font size was this big; return largest possible. */ - return this_point; -} - -/** - * Convert HTML font size to point size. - */ -static guint -msim_purple_size_to_point(MsimSession *session, guint size) -{ - gdouble scale; - guint point; - guint base; - - scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; - - base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - - point = (guint)msim_round(scale * base); - - purple_debug_info("msim", "msim_purple_size_to_point: size=%d -> %d pt\n", - size, point); - - return point; -} - -/** - * Convert a msim markup font pixel height to the more usual point size, for incoming messages. - */ -static guint -msim_height_to_point(MsimSession *session, guint height) -{ - guint dpi; - - dpi = purple_account_get_int(session->account, "dpi", MSIM_DEFAULT_DPI); - - return (guint)msim_round((POINTS_PER_INCH * 1. / dpi) * height); - - /* See also: libpurple/protocols/bonjour/jabber.c - * _font_size_ichat_to_purple */ -} - -/** - * Convert point size to msim pixel height font size specification, for outgoing messages. - */ -static guint -msim_point_to_height(MsimSession *session, guint point) -{ - guint dpi; - - dpi = purple_account_get_int(session->account, "dpi", MSIM_DEFAULT_DPI); - - return (guint)msim_round((dpi * 1. / POINTS_PER_INCH) * point); -} - -/** - * Convert the msim markup (font) tag into HTML. - */ -static void -msim_markup_f_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *face, *height_str, *decor_str; - GString *gs_end, *gs_begin; - guint decor, height; - - face = xmlnode_get_attrib(root, "f"); - height_str = xmlnode_get_attrib(root, "h"); - decor_str = xmlnode_get_attrib(root, "s"); - - /* Validate the font face, to avoid constructing invalid HTML later */ - if (face != NULL && strchr(face, '\'') != NULL) - face = NULL; - - height = height_str != NULL ? atol(height_str) : 12; - decor = decor_str != NULL ? atol(decor_str) : 0; - - /* - * The HTML we're constructing here is a bit redudant. Ideally we - * would use only the font-family and font-size CSS span, but Pidgin - * doesn't support it (it's included for other UIs). For Pidgin we - * wrap the whole thing in an ugly font tag, and Pidgin will happily - * ignore the . - */ - gs_begin = g_string_new(""); - if (height && !face) { - guint point_size = msim_height_to_point(session, height); - g_string_printf(gs_begin, - "", - msim_point_to_purple_size(session, point_size), - point_size); - } else if (height && face) { - guint point_size = msim_height_to_point(session, height); - g_string_printf(gs_begin, - "", - face, msim_point_to_purple_size(session, point_size), - face, point_size); - } else { - g_string_printf(gs_begin, ""); - } - - gs_end = g_string_new(""); - - if (decor & MSIM_TEXT_BOLD) { - g_string_append(gs_begin, ""); - g_string_prepend(gs_end, ""); - } - - if (decor & MSIM_TEXT_ITALIC) { - g_string_append(gs_begin, ""); - g_string_append(gs_end, ""); - } - - if (decor & MSIM_TEXT_UNDERLINE) { - g_string_append(gs_begin, ""); - g_string_append(gs_end, ""); - } - - *begin = g_string_free(gs_begin, FALSE); - *end = g_string_free(gs_end, FALSE); -} - -/** - * Convert a msim markup color to a color suitable for libpurple. - * - * @param msim Either a color name, or an rgb(x,y,z) code. - * - * @return A new string, either a color name or #rrggbb code. Must g_free(). - */ -static char * -msim_color_to_purple(const char *msim) -{ - guint red, green, blue; - - if (!msim) { - return g_strdup("black"); - } - - if (sscanf(msim, "rgb(%d,%d,%d)", &red, &green, &blue) != 3) { - /* Color name. */ - return g_strdup(msim); - } - /* TODO: rgba (alpha). */ - - return g_strdup_printf("#%.2x%.2x%.2x", red, green, blue); -} - -/** - * Convert the msim markup (anchor) tag into HTML. - */ -static void -msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *href; - - href = xmlnode_get_attrib(root, "h"); - if (!href) { - href = ""; - } - - *begin = g_strdup_printf("%s", href, href); - *end = g_strdup(""); -} - -/** - * Convert the msim markup

(paragraph) tag into HTML. - */ -static void -msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - /* Just pass through unchanged. - * - * Note: attributes currently aren't passed, if there are any. */ - *begin = g_strdup("

"); - *end = g_strdup("

"); -} - -/** - * Convert the msim markup tag (text color) into HTML. - */ -static void -msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *color; - gchar *purple_color; - - color = xmlnode_get_attrib(root, "v"); - if (!color) { - purple_debug_info("msim", "msim_markup_c_to_html: tag w/o v attr\n"); - *begin = g_strdup(""); - *end = g_strdup(""); - /* TODO: log as unrecognized */ - return; - } - - purple_color = msim_color_to_purple(color); - -#ifdef USE_CSS_FORMATTING - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#else - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#endif - - g_free(purple_color); -} - -/** - * Convert the msim markup tag (background color) into HTML. - */ -static void -msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *color; - gchar *purple_color; - - color = xmlnode_get_attrib(root, "v"); - if (!color) { - *begin = g_strdup(""); - *end = g_strdup(""); - purple_debug_info("msim", "msim_markup_b_to_html: w/o v attr\n"); - /* TODO: log as unrecognized. */ - return; - } - - purple_color = msim_color_to_purple(color); - -#ifdef USE_CSS_FORMATTING - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#else - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#endif - - g_free(purple_color); -} - -/** - * Convert the msim markup tag (emoticon image) into HTML. - */ -static void -msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *name; - guint i; - struct MSIM_EMOTICON *emote; - - name = xmlnode_get_attrib(root, "n"); - if (!name) { - purple_debug_info("msim", "msim_markup_i_to_html: w/o n\n"); - *begin = g_strdup(""); - *end = g_strdup(""); - /* TODO: log as unrecognized */ - return; - } - - /* Find and use canonical form of smiley symbol. */ - for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { - if (g_str_equal(name, emote->name)) { - *begin = g_strdup(emote->symbol); - *end = g_strdup(""); - return; - } - } - - /* Couldn't find it, sorry. Try to degrade gracefully. */ - *begin = g_strdup_printf("**%s**", name); - *end = g_strdup(""); -} - -/** - * Convert an individual msim markup tag to HTML. - */ -static int -msim_markup_tag_to_html(MsimSession *session, xmlnode *root, gchar **begin, - gchar **end) -{ - g_return_val_if_fail(root != NULL, 0); - - if (g_str_equal(root->name, "f")) { - msim_markup_f_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "a")) { - msim_markup_a_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "p")) { - msim_markup_p_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "c")) { - msim_markup_c_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "b")) { - msim_markup_b_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "i")) { - msim_markup_i_to_html(session, root, begin, end); - } else { - purple_debug_info("msim", "msim_markup_tag_to_html: " - "unknown tag name=%s, ignoring\n", - root->name ? root->name : "(NULL)"); - *begin = g_strdup(""); - *end = g_strdup(""); - } - return 0; -} - -/** - * Convert an individual HTML tag to msim markup. - */ -static int -html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, - gchar **end) -{ - int ret = 0; - - if (!purple_utf8_strcasecmp(root->name, "root") || - !purple_utf8_strcasecmp(root->name, "html")) { - *begin = g_strdup(""); - *end = g_strdup(""); - /* TODO: Coalesce nested tags into one tag! - * Currently, the 's' value will be overwritten when b/i/u is nested - * within another one, and only the inner-most formatting will be - * applied to the text. */ - } else if (!purple_utf8_strcasecmp(root->name, "b")) { - if (root->child->type == XMLNODE_TYPE_DATA) { - *begin = g_strdup_printf("", MSIM_TEXT_BOLD); - *end = g_strdup(""); - } else { - if (!purple_utf8_strcasecmp(root->child->name,"i")) { - ret++; - if (root->child->child->type == XMLNODE_TYPE_DATA) { - *begin = g_strdup_printf("", (MSIM_TEXT_BOLD + MSIM_TEXT_ITALIC)); - *end = g_strdup(""); - } else { - if (!purple_utf8_strcasecmp(root->child->child->name,"u")) { - ret++; - *begin = g_strdup_printf("", (MSIM_TEXT_BOLD + MSIM_TEXT_ITALIC + MSIM_TEXT_UNDERLINE)); - *end = g_strdup(""); - } - } - } else if (!purple_utf8_strcasecmp(root->child->name,"u")) { - ret++; - *begin = g_strdup_printf("", (MSIM_TEXT_BOLD + MSIM_TEXT_UNDERLINE)); - *end = g_strdup(""); - } - } - } else if (!purple_utf8_strcasecmp(root->name, "i")) { - if (root->child->type == XMLNODE_TYPE_DATA) { - *begin = g_strdup_printf("", MSIM_TEXT_ITALIC); - *end = g_strdup(""); - } else { - if (!purple_utf8_strcasecmp(root->child->name,"u")) { - ret++; - *begin = g_strdup_printf("", (MSIM_TEXT_ITALIC + MSIM_TEXT_UNDERLINE)); - *end = g_strdup(""); - } - } - } else if (!purple_utf8_strcasecmp(root->name, "u")) { - *begin = g_strdup_printf("", MSIM_TEXT_UNDERLINE); - *end = g_strdup(""); - } else if (!purple_utf8_strcasecmp(root->name, "a")) { - const gchar *href; - gchar *link_text; - - href = xmlnode_get_attrib(root, "href"); - - if (!href) { - href = xmlnode_get_attrib(root, "HREF"); - } - - link_text = xmlnode_get_data(root); - - if (href) { - if (g_str_equal(link_text, href)) { - /* Purple gives us: URL - * Translate to - * Displayed as text of URL with link to URL - */ - *begin = g_strdup_printf("", href); - } else { - /* But if we get: text - * Translate to: text: - * - * Because official client only supports self-closed - * tags; you can't change the link text. - */ - *begin = g_strdup_printf("%s: ", link_text, href); - } - } else { - *begin = g_strdup(""); - } - - /* Sorry, kid. MySpace doesn't support you within tags. */ - xmlnode_free(root->child); - g_free(link_text); - root->child = NULL; - - *end = g_strdup(""); - } else if (!purple_utf8_strcasecmp(root->name, "font")) { - GString *tmpbegin, *tmpend; - const gchar *size; - const gchar *face; - const gchar *color; - - size = xmlnode_get_attrib(root, "size"); - face = xmlnode_get_attrib(root, "face"); - color = xmlnode_get_attrib(root, "color"); - - tmpbegin = g_string_new(""); - - if (face != NULL) - g_string_append_printf(tmpbegin, " f='%s'", face); - - if (size != NULL) - g_string_append_printf(tmpbegin, " h='%d'", - msim_point_to_height(session, - msim_purple_size_to_point(session, atoi(size)))); - - /* Close the tag */ - g_string_append(tmpbegin, ">"); - - if (color != NULL) { - g_string_append_printf(tmpbegin, "", color); - g_string_prepend(tmpend, ""); - } - - *begin = g_string_free(tmpbegin, FALSE); - *end = g_string_free(tmpend, FALSE); - - } else if (!purple_utf8_strcasecmp(root->name, "body")) { - const gchar *bgcolor; - - bgcolor = xmlnode_get_attrib(root, "bgcolor"); - - if (bgcolor != NULL) { - *begin = g_strdup_printf("", bgcolor); - *end = g_strdup(""); - } - - } else { - gchar *err; - -#ifdef MSIM_MARKUP_SHOW_UNKNOWN_TAGS - *begin = g_strdup_printf("[%s]", root->name); - *end = g_strdup_printf("[/%s]", root->name); -#else - *begin = g_strdup(""); - *end = g_strdup(""); -#endif - - err = g_strdup_printf("html_tag_to_msim_markup: unrecognized " - "HTML tag %s was sent by the IM client; ignoring", - root->name ? root->name : "(NULL)"); - msim_unrecognized(NULL, NULL, err); - g_free(err); - } - return ret; -} - -/** - * Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. - * - * @param f Function to convert tags. - * - * @return An HTML string. Caller frees. - */ -static void -msim_convert_xmlnode(MsimSession *session, GString *out, xmlnode *root, MSIM_XMLNODE_CONVERT f, int nodes_processed) -{ - xmlnode *node; - gchar *begin, *inner, *end, *tmp; - int descended = nodes_processed; - - if (!root || !root->name) - return; - - purple_debug_info("msim", "msim_convert_xmlnode: got root=%s\n", - root->name); - - begin = inner = end = NULL; - - if (descended == 0) /* We've not formatted this yet.. :) */ - descended = f(session, root, &begin, &end); /* Get the value that our format function has already descended for us */ - - g_string_append(out, begin); - g_free(begin); - - /* Loop over all child nodes. */ - for (node = root->child; node != NULL; node = node->next) { - switch (node->type) { - case XMLNODE_TYPE_ATTRIB: - /* Attributes handled above. */ - break; - - case XMLNODE_TYPE_TAG: - /* A tag or tag with attributes. Recursively descend. */ - msim_convert_xmlnode(session, out, node, f, descended); - - purple_debug_info("msim", " ** node name=%s\n", - node->name ? node->name : "(NULL)"); - break; - - case XMLNODE_TYPE_DATA: - /* Literal text. */ - /* - * TODO: Why is it necessary to escape here? I thought - * node->data was already escaped? - */ - tmp = g_markup_escape_text(node->data, node->data_sz); - g_string_append(out, tmp); - g_free(tmp); - break; - - default: - purple_debug_warning("msim", - "msim_convert_xmlnode: unknown node type\n"); - } - } - - /* TODO: Note that msim counts each piece of text enclosed by as - * a paragraph and will display each on its own line. You actually have - * to _nest_ tags to intersperse different text in one paragraph! - * Comment out this line below to see. */ - g_string_append(out, end); - g_free(end); -} - -/** - * Convert XML to something based on MSIM_XMLNODE_CONVERT. - */ -static gchar * -msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) -{ - xmlnode *root; - GString *str; - gchar *enclosed_raw; - - g_return_val_if_fail(raw != NULL, NULL); - - /* Enclose text in one root tag, to try to make it valid XML for parsing. */ - enclosed_raw = g_strconcat("", raw, "", NULL); - - root = xmlnode_from_str(enclosed_raw, -1); - - if (!root) { - purple_debug_warning("msim", "msim_markup_to_html: couldn't parse " - "%s as XML, returning raw: %s\n", enclosed_raw, raw); - /* TODO: msim_unrecognized */ - g_free(enclosed_raw); - return g_strdup(raw); - } - - g_free(enclosed_raw); - - str = g_string_new(NULL); - msim_convert_xmlnode(session, str, root, f, 0); - xmlnode_free(root); - - purple_debug_info("msim", "msim_markup_to_html: returning %s\n", str->str); - - return g_string_free(str, FALSE); -} - -/** - * Convert plaintext smileys to markup tags. - * - * @param before Original text with ASCII smileys. Will be freed. - * @return A new string with tags, if applicable. Must be g_free()'d. - */ -static gchar * -msim_convert_smileys_to_markup(gchar *before) -{ - gchar *old, *new, *replacement; - guint i; - struct MSIM_EMOTICON *emote; - - old = before; - new = NULL; - - for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { - gchar *name, *symbol; - - name = emote->name; - symbol = emote->symbol; - - replacement = g_strdup_printf("", name); - - purple_debug_info("msim", "msim_convert_smileys_to_markup: %s->%s\n", - symbol ? symbol : "(NULL)", - replacement ? replacement : "(NULL)"); - new = purple_strreplace(old, symbol, replacement); - - g_free(replacement); - g_free(old); - - old = new; - } - - return new; -} - -/** - * High-level function to convert MySpaceIM markup to Purple (HTML) markup. - * - * @return Purple markup string, must be g_free()'d. */ -gchar * -msim_markup_to_html(MsimSession *session, const gchar *raw) -{ - return msim_convert_xml(session, raw, msim_markup_tag_to_html); -} - -/** - * High-level function to convert Purple (HTML) to MySpaceIM markup. - * - * TODO: consider using purple_markup_html_to_xhtml() to make valid XML. - * - * @return HTML markup string, must be g_free()'d. */ -gchar * -html_to_msim_markup(MsimSession *session, const gchar *raw) -{ - gchar *markup; - - markup = msim_convert_xml(session, raw, html_tag_to_msim_markup); - - if (purple_account_get_bool(session->account, "emoticons", TRUE)) { - /* Frees markup and allocates a new one. */ - markup = msim_convert_smileys_to_markup(markup); - } - - return markup; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/markup.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/* MySpaceIM Protocol Plugin - markup - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_MARKUP_H -#define _MYSPACE_MARKUP_H - -/* High-level msim markup <=> Purple html conversion functions. */ -gchar *msim_markup_to_html(MsimSession *, const gchar *raw); -gchar *html_to_msim_markup(MsimSession *, const gchar *raw); - -#endif /* !_MYSPACE_MARKUP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1411 +0,0 @@ -/** MySpaceIM protocol messages - * - * \author Jeff Connelly - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" -#include "message.h" - -static void msim_msg_debug_string_element(gpointer data, gpointer user_data); - -/** - * Escape codes and associated replacement text, used for protocol message - * escaping and unescaping. - */ -static struct MSIM_ESCAPE_REPLACEMENT { - gchar *code; - gchar text; -} msim_escape_replacements[] = { - { "/1", '/' }, - { "/2", '\\' }, - /* { "/3", "|" }, */ /* Not used here -- only for within arrays */ - { NULL, 0 } -}; - -/** - * Escape a protocol message. - * - * @return The escaped message. Caller must g_free(). - */ -gchar * -msim_escape(const gchar *msg) -{ - GString *gs; - guint i, j; - guint msg_len; - - gs = g_string_new(""); - msg_len = strlen(msg); - - for (i = 0; i < msg_len; ++i) { - struct MSIM_ESCAPE_REPLACEMENT *replacement; - gchar *replace; - - replace = NULL; - - /* Check for characters that need to be escaped, and escape them. */ - for (j = 0; (replacement = &msim_escape_replacements[j]) && - replacement->code != NULL; ++j) { - if (msg[i] == replacement->text) { - replace = replacement->code; - break; - } - } - - if (replace) { - g_string_append(gs, replace); - } else { - g_string_append_c(gs, msg[i]); - } - } - -#ifdef MSIM_DEBUG_ESCAPE - purple_debug_info("msim", "msim_escape: msg=%s, ret=%s\n", msg, gs->str); -#endif - - return g_string_free(gs, FALSE); -} - -/** - * Unescape a protocol message. - * - * @return The unescaped message, caller must g_free(). - */ -gchar * -msim_unescape(const gchar *msg) -{ - GString *gs; - guint i, j; - guint msg_len; - - gs = g_string_new(""); - msg_len = strlen(msg); - - for (i = 0; i < msg_len; ++i) { - struct MSIM_ESCAPE_REPLACEMENT *replacement; - gchar replace; - - replace = msg[i]; - - for (j = 0; (replacement = &msim_escape_replacements[j]) && - replacement->code != NULL; ++j) { - if (msg[i] == replacement->code[0] && - i + 1 < msg_len && - msg[i + 1] == replacement->code[1]) { - replace = replacement->text; - ++i; - break; - } - } - - g_string_append_c(gs, replace); - } - -#ifdef MSIM_DEBUG_ESCAPE - purple_debug_info("msim", "msim_unescape: msg=%s, ret=%s\n", msg, gs->str); -#endif - - return g_string_free(gs, FALSE); -} - -/** - * Create a new message from va_list and its first argument. - * - * @param first_key The first argument (a key), or NULL to take all arguments - * from argp. - * @param argp A va_list of variadic arguments, already started with va_start(). Will be va_end()'d. - * @return New MsimMessage *, must be freed with msim_msg_free(). - * - * For internal use - users probably want msim_msg_new() or msim_send(). - */ -static MsimMessage * -msim_msg_new_v(gchar *first_key, va_list argp) -{ - gchar *key, *value; - MsimMessageType type; - MsimMessage *msg; - gboolean first; - - GString *gs; - GList *gl; - MsimMessage *dict; - - /* Begin with an empty message. */ - msg = NULL; - - /* First parameter can be given explicitly. */ - first = first_key != NULL; - - /* Read key, type, value triplets until NULL. */ - do { - if (first) { - key = first_key; - first = FALSE; - } else { - key = va_arg(argp, gchar *); - if (!key) { - break; - } - } - - type = va_arg(argp, int); - - /* Interpret variadic arguments. */ - switch (type) { - case MSIM_TYPE_INTEGER: - case MSIM_TYPE_BOOLEAN: - msg = msim_msg_append(msg, key, type, GUINT_TO_POINTER(va_arg(argp, int))); - break; - - case MSIM_TYPE_STRING: - value = va_arg(argp, char *); - - g_return_val_if_fail(value != NULL, FALSE); - - msg = msim_msg_append(msg, key, type, value); - break; - - case MSIM_TYPE_BINARY: - gs = va_arg(argp, GString *); - - g_return_val_if_fail(gs != NULL, FALSE); - - /* msim_msg_free() will free this GString the caller created. */ - msg = msim_msg_append(msg, key, type, gs); - break; - - case MSIM_TYPE_LIST: - gl = va_arg(argp, GList *); - - g_return_val_if_fail(gl != NULL, FALSE); - - msg = msim_msg_append(msg, key, type, gl); - break; - - case MSIM_TYPE_DICTIONARY: - dict = va_arg(argp, MsimMessage *); - - g_return_val_if_fail(dict != NULL, FALSE); - - msg = msim_msg_append(msg, key, type, dict); - break; - - default: - purple_debug_info("msim", "msim_send: unknown type %d\n", type); - break; - } - } while(key); - va_end(argp); - - return msg; -} - -/** - * Create a new MsimMessage. - * - * @param first_key The first key in the sequence, or NULL for an empty message. - * @param ... A sequence of gchar* key/type/value triplets, terminated with NULL. - * - * See msim_msg_append() documentation for details on types. - */ -MsimMessage * -msim_msg_new(gchar *first_key, ...) -{ - va_list argp; - - if (first_key) { - va_start(argp, first_key); - return msim_msg_new_v(first_key, argp); - } else { - return NULL; - } -} - -/** - * Pack a string using the given GFunc and seperator. - * Used by msim_msg_dump() and msim_msg_pack(). - */ -static gchar * -msim_msg_pack_using(MsimMessage *msg, - GFunc gf, - const gchar *sep, - const gchar *begin, const gchar *end) -{ - int num_items; - gchar **strings; - gchar **strings_tmp; - gchar *joined; - gchar *final; - int i; - - g_return_val_if_fail(msg != NULL, NULL); - - num_items = g_list_length(msg); - - /* Add one for NULL terminator for g_strjoinv(). */ - strings = (gchar **)g_new0(gchar *, num_items + 1); - - strings_tmp = strings; - g_list_foreach(msg, gf, &strings_tmp); - - joined = g_strjoinv(sep, strings); - final = g_strconcat(begin, joined, end, NULL); - g_free(joined); - - /* Clean up. */ - for (i = 0; i < num_items; ++i) { - g_free(strings[i]); - } - - g_free(strings); - - return final; -} - -/** - * Return a human-readable string of the message. - * - * @return A new gchar *, must be g_free()'d. - */ -static gchar * -msim_msg_dump_to_str(MsimMessage *msg) -{ - gchar *debug_str; - - if (!msg) { - debug_str = g_strdup(""); - } else { - debug_str = msim_msg_pack_using(msg, msim_msg_debug_string_element, - "\n", ""); - } - - return debug_str; -} - -/** - * Store a human-readable string describing the element. - * - * @param data Pointer to an MsimMessageElement. - * @param user_data - */ -static void -msim_msg_debug_string_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - gchar *string; - GString *gs; - gchar *binary; - gchar ***items; /* wow, a pointer to a pointer to a pointer */ - - gchar *s; - GList *gl; - guint i; - - elem = (MsimMessageElement *)data; - items = user_data; - - switch (elem->type) { - case MSIM_TYPE_INTEGER: - string = g_strdup_printf("%s(integer): %d", elem->name, - GPOINTER_TO_UINT(elem->data)); - break; - - case MSIM_TYPE_RAW: - string = g_strdup_printf("%s(raw): %s", elem->name, - elem->data ? (gchar *)elem->data : "(NULL)"); - break; - - case MSIM_TYPE_STRING: - string = g_strdup_printf("%s(string): %s", elem->name, - elem->data ? (gchar *)elem->data : "(NULL)"); - break; - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - binary = purple_base64_encode((guchar*)gs->str, gs->len); - string = g_strdup_printf("%s(binary, %d bytes): %s", elem->name, (int)gs->len, binary); - g_free(binary); - break; - - case MSIM_TYPE_BOOLEAN: - string = g_strdup_printf("%s(boolean): %s", elem->name, - elem->data ? "TRUE" : "FALSE"); - break; - - case MSIM_TYPE_DICTIONARY: - if (!elem->data) { - s = g_strdup("(NULL)"); - } else { - s = msim_msg_dump_to_str((MsimMessage *)elem->data); - } - - if (!s) { - s = g_strdup("(NULL, couldn't msim_msg_dump_to_str)"); - } - - string = g_strdup_printf("%s(dict): %s", elem->name, s); - - g_free(s); - break; - - case MSIM_TYPE_LIST: - gs = g_string_new(""); - g_string_append_printf(gs, "%s(list): \n", elem->name); - - i = 0; - for (gl = (GList *)elem->data; gl != NULL; gl = g_list_next(gl)) { - g_string_append_printf(gs, " %d. %s\n", i, (gchar *)(gl->data)); - ++i; - } - - string = g_string_free(gs, FALSE); - break; - - default: - string = g_strdup_printf("%s(unknown type %d", - elem->name ? elem->name : "(NULL)", elem->type); - break; - } - - **items = string; - ++(*items); -} - -/** - * Search for and return the node in msg, matching name, or NULL. - * - * @param msg Message to search within. - * @param name Field name to search for. - * - * @return The GList * node for the MsimMessageElement with the given name, or NULL if not found or name is NULL. - * - * For internal use - users probably want to use msim_msg_get() to - * access the MsimMessageElement *, instead of the GList * container. - * - */ -static GList * -msim_msg_get_node(const MsimMessage *msg, const gchar *name) -{ - GList *node; - - if (!name || !msg) { - return NULL; - } - - /* Linear search for the given name. O(n) but n is small. */ - for (node = (GList*)msg; node != NULL; node = g_list_next(node)) { - MsimMessageElement *elem; - - elem = (MsimMessageElement *)node->data; - - g_return_val_if_fail(elem != NULL, NULL); - g_return_val_if_fail(elem->name != NULL, NULL); - - if (strcmp(elem->name, name) == 0) { - return node; - } - } - return NULL; -} - -/** - * Create a new MsimMessageElement * - must be g_free()'d. - * - * For internal use; users probably want msim_msg_append() or msim_msg_insert_before(). - * - * @param dynamic_name Whether 'name' should be freed when the message is destroyed. - */ -static MsimMessageElement * -msim_msg_element_new(const gchar *name, MsimMessageType type, gpointer data, gboolean dynamic_name) -{ - MsimMessageElement *elem; - - elem = g_new0(MsimMessageElement, 1); - - elem->name = name; - elem->dynamic_name = dynamic_name; - elem->type = type; - elem->data = data; - - return elem; -} - -/** - * Append a new element to a message. - * - * @param name Textual name of element (static string, neither copied nor freed). - * @param type An MSIM_TYPE_* code. - * @param data Pointer to data, see below. - * - * @return The new message - must be assigned to as with GList*. For example: - * - * msg = msim_msg_append(msg, ...) - * - * The data parameter depends on the type given: - * - * * MSIM_TYPE_INTEGER: Use GUINT_TO_POINTER(x). - * - * * MSIM_TYPE_BINARY: Same as integer, non-zero is TRUE and zero is FALSE. - * - * * MSIM_TYPE_STRING: gchar *. The data WILL BE FREED - use g_strdup() if needed. - * - * * MSIM_TYPE_RAW: gchar *. The data WILL BE FREED - use g_strdup() if needed. - * - * * MSIM_TYPE_BINARY: g_string_new_len(data, length). The data AND GString will be freed. - * - * * MSIM_TYPE_DICTIONARY: An MsimMessage *. Freed when message is destroyed. - * - * * MSIM_TYPE_LIST: GList * of gchar *. Again, everything will be freed. - * - * */ -MsimMessage * -msim_msg_append(MsimMessage *msg, const gchar *name, - MsimMessageType type, gpointer data) -{ - return g_list_append(msg, msim_msg_element_new(name, type, data, FALSE)); -} - -/** - * Append a new element, but with a dynamically-allocated name. - * Exactly the same as msim_msg_append(), except 'name' will be freed when - * the message is destroyed. Normally, it isn't, because a static string is given. - */ -static MsimMessage * -msim_msg_append_dynamic_name(MsimMessage *msg, gchar *name, - MsimMessageType type, gpointer data) -{ - return g_list_append(msg, msim_msg_element_new(name, type, data, TRUE)); -} - -/** - * Insert a new element into a message, before the given element name. - * - * @param name_before Name of the element to insert the new element before. If - * could not be found or NULL, new element will be inserted at end. - * - * See msim_msg_append() for usage of other parameters, and an important note about return value. - */ -MsimMessage * -msim_msg_insert_before(MsimMessage *msg, const gchar *name_before, - const gchar *name, MsimMessageType type, gpointer data) -{ - MsimMessageElement *new_elem; - GList *node_before; - - new_elem = msim_msg_element_new(name, type, data, FALSE); - - node_before = msim_msg_get_node(msg, name_before); - - return g_list_insert_before(msg, node_before, new_elem); -} - -/** - * Perform a deep copy on a GList * of gchar * strings. Free with msim_msg_list_free(). - */ -static GList * -msim_msg_list_copy(const GList *old) -{ - GList *new_list; - - new_list = NULL; - - /* Deep copy (g_list_copy is shallow). Copy each string. */ - for (; old != NULL; old = g_list_next(old)) { - new_list = g_list_append(new_list, g_strdup(old->data)); - } - - return new_list; -} - -/** - * Clone an individual element. - * - * @param data MsimMessageElement * to clone. - * @param user_data Pointer to MsimMessage * to add cloned element to. - */ -static void -msim_msg_clone_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - MsimMessage **new; - gpointer new_data; - - GString *gs; - MsimMessage *dict; - - elem = (MsimMessageElement *)data; - new = (MsimMessage **)user_data; - - switch (elem->type) { - case MSIM_TYPE_BOOLEAN: - case MSIM_TYPE_INTEGER: - new_data = elem->data; - break; - - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - new_data = g_strdup((gchar *)elem->data); - break; - - case MSIM_TYPE_LIST: - new_data = (gpointer)msim_msg_list_copy((GList *)(elem->data)); - break; - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - - new_data = g_string_new_len(gs->str, gs->len); - break; - case MSIM_TYPE_DICTIONARY: - dict = (MsimMessage *)elem->data; - - new_data = msim_msg_clone(dict); - break; - - default: - purple_debug_info("msim", "msim_msg_clone_element: unknown type %d\n", elem->type); - g_return_if_reached(); - } - - /* Append cloned data. Note that the 'name' field is a static string, so it - * never needs to be copied nor freed. */ - if (elem->dynamic_name) - *new = msim_msg_append_dynamic_name(*new, g_strdup(elem->name), elem->type, new_data); - else - *new = msim_msg_append(*new, elem->name, elem->type, new_data); -} - -/** - * Clone an existing MsimMessage. - * - * @return Cloned message; caller should free with msim_msg_free(). - */ -MsimMessage * -msim_msg_clone(MsimMessage *old) -{ - MsimMessage *new; - - if (old == NULL) { - return NULL; - } - - new = msim_msg_new(FALSE); - - g_list_foreach(old, msim_msg_clone_element, &new); - - return new; -} - -/** - * Free the data of a message element. - * - * @param elem The MsimMessageElement * - * - * Note this only frees the element data; you may also want to free the - * element itself with g_free() (see msim_msg_free_element()). - */ -void -msim_msg_free_element_data(MsimMessageElement *elem) -{ - switch (elem->type) { - case MSIM_TYPE_BOOLEAN: - case MSIM_TYPE_INTEGER: - /* Integer value stored in gpointer - no need to free(). */ - break; - - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - /* Always free strings - caller should have g_strdup()'d if - * string was static or temporary and not to be freed. */ - g_free(elem->data); - break; - - case MSIM_TYPE_BINARY: - /* Free the GString itself and the binary data. */ - g_string_free((GString *)elem->data, TRUE); - break; - - case MSIM_TYPE_DICTIONARY: - msim_msg_free((MsimMessage *)elem->data); - break; - - case MSIM_TYPE_LIST: - g_list_free((GList *)elem->data); - break; - - default: - purple_debug_info("msim", "msim_msg_free_element_data: " - "not freeing unknown type %d\n", elem->type); - break; - } -} - -/** - * Free a GList * of MsimMessageElement *'s. - */ -void -msim_msg_list_free(GList *l) -{ - - for (; l != NULL; l = g_list_next(l)) { - MsimMessageElement *elem; - - elem = (MsimMessageElement *)l->data; - - /* Note that name is almost never dynamically allocated elsewhere; - * it is usually a static string, but not in lists. So cast it. */ - g_free((gchar *)elem->name); - g_free(elem->data); - g_free(elem); - } - g_list_free(l); -} - -/** - * Free an individual message element. - * - * @param data MsimMessageElement * to free. - * @param user_data Not used; required to match g_list_foreach() callback prototype. - * - * Frees both the element data and the element itself. - * Also frees the name if dynamic_name is TRUE. - */ -static void -msim_msg_free_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - - elem = (MsimMessageElement *)data; - - msim_msg_free_element_data(elem); - - if (elem->dynamic_name) - /* Need to cast to remove const-ness, because - * elem->name is almost always a constant, static - * string, but not in this case. */ - g_free((gchar *)elem->name); - - g_free(elem); -} - -/** - * Free a complete message. - */ -void -msim_msg_free(MsimMessage *msg) -{ - if (!msg) { - /* already free as can be */ - return; - } - - g_list_foreach(msg, msim_msg_free_element, NULL); - g_list_free(msg); -} - -/** - * Pack an element into its protocol representation. - * - * @param data Pointer to an MsimMessageElement. - * @param user_data Pointer to a gchar ** array of string items. - * - * Called by msim_msg_pack(). Will pack the MsimMessageElement into - * a part of the protocol string and append it to the array. Caller - * is responsible for creating array to correct dimensions, and - * freeing each string element of the array added by this function. - */ -static void -msim_msg_pack_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - gchar *string, *data_string; - gchar ***items; - - elem = (MsimMessageElement *)data; - items = (gchar ***)user_data; - - /* Exclude elements beginning with '_' from packed protocol messages. */ - if (elem->name[0] == '_') { - return; - } - - data_string = msim_msg_pack_element_data(elem); - - switch (elem->type) { - /* These types are represented by key name/value pairs (converted above). */ - case MSIM_TYPE_INTEGER: - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - case MSIM_TYPE_BINARY: - case MSIM_TYPE_DICTIONARY: - case MSIM_TYPE_LIST: - string = g_strconcat(elem->name, "\\", data_string, NULL); - break; - - /* Boolean is represented by absence or presence of name. */ - case MSIM_TYPE_BOOLEAN: - if (GPOINTER_TO_UINT(elem->data)) { - /* True - leave in, with blank value. */ - string = g_strdup_printf("%s\\", elem->name); - } else { - /* False - leave out. */ - string = g_strdup(""); - } - break; - - default: - g_free(data_string); - g_return_if_reached(); - break; - } - - g_free(data_string); - - **items = string; - ++(*items); -} - -/** - * Pack an element into its protcol representation inside a dictionary. - * - * See msim_msg_pack_element(). - */ -static void -msim_msg_pack_element_dict(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - gchar *string, *data_string, ***items; - - elem = (MsimMessageElement *)data; - items = (gchar ***)user_data; - - /* Exclude elements beginning with '_' from packed protocol messages. */ - if (elem->name[0] == '_') { - return; - } - - data_string = msim_msg_pack_element_data(elem); - - g_return_if_fail(data_string != NULL); - - switch (elem->type) { - /* These types are represented by key name/value pairs (converted above). */ - case MSIM_TYPE_INTEGER: - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - case MSIM_TYPE_BINARY: - case MSIM_TYPE_DICTIONARY: - case MSIM_TYPE_LIST: - case MSIM_TYPE_BOOLEAN: /* Boolean is On or Off */ - string = g_strconcat(elem->name, "=", data_string, NULL); - break; - - default: - g_free(data_string); - g_return_if_fail(FALSE); - break; - } - - g_free(data_string); - - **items = string; - ++(*items); -} - -/** - * Return a packed string of a message suitable for sending over the wire. - * - * @return A string. Caller must g_free(). - */ -gchar * -msim_msg_pack(MsimMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msim_msg_pack_using(msg, msim_msg_pack_element, "\\", "\\", "\\final\\"); -} - -/** - * Return a packed string of a dictionary, suitable for embedding in MSIM_TYPE_DICTIONARY. - * - * @return A string; caller must g_free(). - */ -static gchar * -msim_msg_pack_dict(MsimMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msim_msg_pack_using(msg, msim_msg_pack_element_dict, "\034", "", ""); -} - -/** - * Send an existing MsimMessage. - */ -gboolean -msim_msg_send(MsimSession *session, MsimMessage *msg) -{ - gchar *raw; - gboolean success; - - raw = msim_msg_pack(msg); - g_return_val_if_fail(raw != NULL, FALSE); - success = msim_send_raw(session, raw); - g_free(raw); - - return success; -} - -/** - * Return a message element data as a new string for a raw protocol message, - * converting from other types (integer, etc.) if necessary. - * - * @return const gchar * The data as a string, or NULL. Caller must g_free(). - * - * Returns a string suitable for inclusion in a raw protocol message, not necessarily - * optimal for human consumption. For example, strings are escaped. Use - * msim_msg_get_string() if you want a string, which in some cases is same as this. - */ -gchar * -msim_msg_pack_element_data(MsimMessageElement *elem) -{ - GString *gs; - GList *gl; - - g_return_val_if_fail(elem != NULL, NULL); - - switch (elem->type) { - case MSIM_TYPE_INTEGER: - return g_strdup_printf("%d", GPOINTER_TO_UINT(elem->data)); - - case MSIM_TYPE_RAW: - /* Not un-escaped - this is a raw element, already escaped if necessary. */ - return (gchar *)g_strdup((gchar *)elem->data); - - case MSIM_TYPE_STRING: - /* Strings get escaped. msim_escape() creates a new string. */ - g_return_val_if_fail(elem->data != NULL, NULL); - return elem->data ? msim_escape((gchar *)elem->data) : - g_strdup("(NULL)"); - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - /* Do not escape! */ - return purple_base64_encode((guchar *)gs->str, gs->len); - - case MSIM_TYPE_BOOLEAN: - /* Not used by messages in the wire protocol * -- see msim_msg_pack_element. - * Only used by dictionaries, see msim_msg_pack_element_dict. */ - return elem->data ? g_strdup("On") : g_strdup("Off"); - - case MSIM_TYPE_DICTIONARY: - return msim_msg_pack_dict((MsimMessage *)elem->data); - - case MSIM_TYPE_LIST: - /* Pack using a|b|c|d|... */ - gs = g_string_new(""); - - for (gl = (GList *)elem->data; gl != NULL; gl = g_list_next(gl)) { - g_string_append_printf(gs, "%s", (gchar*)(gl->data)); - - /* All but last element is separated by a bar. */ - if (g_list_next(gl)) - g_string_append(gs, "|"); - } - - return g_string_free(gs, FALSE); - - default: - purple_debug_info("msim", "field %s, unknown type %d\n", - elem->name ? elem->name : "(NULL)", - elem->type); - return NULL; - } -} - -/** - * Send a message to the server, whose contents is specified using - * variable arguments. - * - * @param session - * @param ... A sequence of gchar* key/type/value triplets, terminated with NULL. - * - * This function exists for coding convenience: it allows a message to be created - * and sent in one line of code. Internally it calls msim_msg_send(). - * - * IMPORTANT: See msim_msg_append() documentation for details on element types. - * - */ -gboolean -msim_send(MsimSession *session, ...) -{ - gboolean success; - MsimMessage *msg; - va_list argp; - - va_start(argp, session); - msg = msim_msg_new_v(NULL, argp); - - /* Actually send the message. */ - success = msim_msg_send(session, msg); - - /* Cleanup. */ - msim_msg_free(msg); - - return success; -} - -/** - * Print a human-readable string of the message to Purple's debug log. - * - * @param fmt_string A static string, in which '%s' will be replaced. - */ -void -msim_msg_dump(const gchar *fmt_string, MsimMessage *msg) -{ - gchar *debug_str; - - g_return_if_fail(fmt_string != NULL); - - debug_str = msim_msg_dump_to_str(msg); - - g_return_if_fail(debug_str != NULL); - - purple_debug_info("msim", fmt_string, debug_str); - - g_free(debug_str); -} - -/** - * Parse a raw protocol message string into a MsimMessage *. - * - * @param raw The raw message string to parse, will be g_free()'d. - * - * @return MsimMessage *. Caller should msim_msg_free() when done. - */ -MsimMessage * -msim_parse(const gchar *raw) -{ - MsimMessage *msg; - gchar *token; - gchar **tokens; - gchar *key; - gchar *value; - int i; - - g_return_val_if_fail(raw != NULL, NULL); - - purple_debug_info("msim", "msim_parse: got <%s>\n", raw); - - key = NULL; - - /* All messages begin with a \. */ - if (raw[0] != '\\' || raw[1] == 0) { - purple_debug_info("msim", "msim_parse: incomplete/bad string, " - "missing initial backslash: <%s>\n", raw); - /* XXX: Should we try to recover, and read to first backslash? */ - - return NULL; - } - - msg = msim_msg_new(FALSE); - - for (tokens = g_strsplit(raw + 1, "\\", 0), i = 0; - (token = tokens[i]); - i++) { -#ifdef MSIM_DEBUG_PARSE - purple_debug_info("msim", "tok=<%s>, i%2=%d\n", token, i % 2); -#endif - if (i % 2) { - /* Odd-numbered ordinal is a value. */ - - value = token; - - /* Incoming protocol messages get tagged as MSIM_TYPE_RAW, which - * represents an untyped piece of data. msim_msg_get_* will - * convert to appropriate types for caller, and handle unescaping if needed. */ - msg = msim_msg_append_dynamic_name(msg, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value)); -#ifdef MSIM_DEBUG_PARSE - purple_debug_info("msim", "insert string: |%s|=|%s|\n", key, value); -#endif - } else { - /* Even numbered indexes are key names. */ - key = token; - } - } - g_strfreev(tokens); - - return msg; -} - -/** - * Return the first MsimMessageElement * with given name in the MsimMessage *. - * - * @param name Name to search for. - * - * @return MsimMessageElement * matching name, or NULL. - * - * Note: useful fields of MsimMessageElement are 'data' and 'type', which - * you can access directly. But it is often more convenient to use - * another msim_msg_get_* that converts the data to what type you want. - */ -MsimMessageElement * -msim_msg_get(const MsimMessage *msg, const gchar *name) -{ - GList *node; - - node = msim_msg_get_node(msg, name); - if (node) { - return (MsimMessageElement *)node->data; - } else { - return NULL; - } -} - -gchar * -msim_msg_get_string_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, NULL); - switch (elem->type) { - case MSIM_TYPE_INTEGER: - return g_strdup_printf("%d", GPOINTER_TO_UINT(elem->data)); - - case MSIM_TYPE_RAW: - /* Raw element from incoming message - if its a string, it'll - * be escaped. */ - return msim_unescape((gchar *)elem->data); - - case MSIM_TYPE_STRING: - /* Already unescaped. */ - return g_strdup((gchar *)elem->data); - - default: - purple_debug_info("msim", "msim_msg_get_string_element: type %d unknown, name %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return NULL; - } -} - -/** - * Return the data of an element of a given name, as a string. - * - * @param name Name of element. - * - * @return gchar * The data as a string, or NULL if not found. - * Caller must g_free(). - * - * Note that msim_msg_pack_element_data() is similar, but returns a string - * for inclusion into a raw protocol string (escaped and everything). - * This function unescapes the string for you, if needed. - */ -gchar * -msim_msg_get_string(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return NULL; - } - - return msim_msg_get_string_from_element(elem); -} - -/** - * Parse a |-separated string into a new GList. Free with msim_msg_list_free(). - */ -static GList * -msim_msg_list_parse(const gchar *raw) -{ - gchar **array; - GList *list; - guint i; - - array = g_strsplit(raw, "|", 0); - list = NULL; - - /* TODO: escape/unescape /3 <-> | within list elements */ - - for (i = 0; array[i] != NULL; ++i) { - MsimMessageElement *elem; - - /* Freed in msim_msg_list_free() */ - elem = g_new0(MsimMessageElement, 1); - - /* Give the element a name for debugging purposes. - * Not supposed to be looked up by this name; instead, - * lookup the elements by indexing the array. */ - elem->name = g_strdup_printf("(list item #%d)", i); - elem->type = MSIM_TYPE_RAW; - elem->data = g_strdup(array[i]); - - list = g_list_append(list, elem); - } - - g_strfreev(array); - - return list; -} - -static GList * -msim_msg_get_list_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, NULL); - switch (elem->type) { - case MSIM_TYPE_LIST: - return msim_msg_list_copy((GList *)elem->data); - - case MSIM_TYPE_RAW: - return msim_msg_list_parse((gchar *)elem->data); - - default: - purple_debug_info("msim_msg_get_list", "type %d unknown, name %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return NULL; - } -} - -/** - * Return an element as a new list. Caller frees with msim_msg_list_free(). - */ -GList * -msim_msg_get_list(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return NULL; - } - - return msim_msg_get_list_from_element(elem); -} - -/** - * Parse a \x1c-separated "dictionary" of key=value pairs into a hash table. - * - * @param raw The text of the dictionary to parse. Often the - * value for the 'body' field. - * - * @return A new MsimMessage *. Must msim_msg_free() when done. - */ -static MsimMessage * -msim_msg_dictionary_parse(const gchar *raw) -{ - MsimMessage *dict; - gchar *item; - gchar **items; - gchar **elements; - guint i; - - g_return_val_if_fail(raw != NULL, NULL); - - dict = msim_msg_new(NULL); - - for (items = g_strsplit(raw, "\x1c", 0), i = 0; - (item = items[i]); - i++) { - gchar *key, *value; - - elements = g_strsplit(item, "=", 2); - - key = elements[0]; - if (!key) { - purple_debug_info("msim", "msim_msg_dictionary_parse(%s): null key\n", - raw); - g_strfreev(elements); - break; - } - - value = elements[1]; - if (!value) { - purple_debug_info("msim", "msim_msg_dictionary_prase(%s): null value\n", - raw); - g_strfreev(elements); - break; - } - -#ifdef MSIM_DEBUG_PARSE - purple_debug_info("msim_msg_dictionary_parse","-- %s: %s\n", key ? key : "(NULL)", - value ? value : "(NULL)"); -#endif - /* Append with _dynamic_name since g_strdup(key) is dynamic, and - * needs to be freed when the message is destroyed. It isn't static as usual. */ - dict = msim_msg_append_dynamic_name(dict, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value)); - - g_strfreev(elements); - } - - g_strfreev(items); - - return dict; -} - -static MsimMessage * -msim_msg_get_dictionary_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, NULL); - switch (elem->type) { - case MSIM_TYPE_DICTIONARY: - return msim_msg_clone((MsimMessage *)elem->data); - - case MSIM_TYPE_RAW: - return msim_msg_dictionary_parse(elem->data); - - default: - purple_debug_info("msim_msg_get_dictionary", "type %d unknown, name %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return NULL; - } -} - -/** - * Return an element as a new dictionary. Caller frees with msim_msg_free(). - */ -MsimMessage * -msim_msg_get_dictionary(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return NULL; - } - - return msim_msg_get_dictionary_from_element(elem); -} - -guint -msim_msg_get_integer_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, 0); - switch (elem->type) { - case MSIM_TYPE_INTEGER: - return GPOINTER_TO_UINT(elem->data); - - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - /* TODO: find out if we need larger integers */ - return (guint)atoi((gchar *)elem->data); - - default: - return 0; - } -} - -/** - * Return the data of an element of a given name, as an unsigned integer. - * - * @param name Name of element. - * - * @return guint Numeric representation of data, or 0 if could not be converted / not found. - * - * Useful to obtain an element's data if you know it should be an integer, - * even if it is not stored as an MSIM_TYPE_INTEGER. MSIM_TYPE_STRING will - * be converted handled correctly, for example. - */ -guint -msim_msg_get_integer(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - - if (!elem) { - return 0; - } - - return msim_msg_get_integer_from_element(elem); -} - -static gboolean -msim_msg_get_binary_from_element(MsimMessageElement *elem, gchar **binary_data, gsize *binary_length) -{ - GString *gs; - - g_return_val_if_fail(elem != NULL, FALSE); - - switch (elem->type) { - case MSIM_TYPE_RAW: - /* Incoming messages are tagged with MSIM_TYPE_RAW, and - * converted appropriately. They can still be "strings", just they won't - * be tagged as MSIM_TYPE_STRING (as MSIM_TYPE_STRING is intended to be used - * by msimprpl code for things like instant messages - stuff that should be - * escaped if needed). DWIM. - */ - - /* Previously, incoming messages were stored as MSIM_TYPE_STRING. - * This was fine for integers and strings, since they can easily be - * converted in msim_get_*, as desirable. However, it does not work - * well for binary strings. Consider: - * - * If incoming base64'd elements were tagged as MSIM_TYPE_STRING. - * msim_msg_get_binary() sees MSIM_TYPE_STRING, base64 decodes, returns. - * everything is fine. - * But then, msim_send() is called on the incoming message, which has - * a base64'd MSIM_TYPE_STRING that really is encoded binary. The values - * will be escaped since strings are escaped, and / becomes /2; no good. - * - */ - *binary_data = (gchar *)purple_base64_decode((const gchar *)elem->data, binary_length); - return TRUE; - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - - /* Duplicate data, so caller can g_free() it. */ - *binary_data = g_memdup(gs->str, gs->len); - *binary_length = gs->len; - - return TRUE; - - - /* Rejected because if it isn't already a GString, have to g_new0 it and - * then caller has to ALSO free the GString! - * - * return (GString *)elem->data; */ - - default: - purple_debug_info("msim", "msim_msg_get_binary: unhandled type %d for key %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return FALSE; - } -} - -/** - * Return the data of an element of a given name, as a binary GString. - * - * @param binary_data A pointer to a new pointer, which will be filled in with the binary data. CALLER MUST g_free(). - * - * @param binary_length A pointer to an integer, which will be set to the binary data length. - * - * @return TRUE if successful, FALSE if not. - */ -gboolean -msim_msg_get_binary(const MsimMessage *msg, const gchar *name, - gchar **binary_data, gsize *binary_length) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return FALSE; - } - - return msim_msg_get_binary_from_element(elem, binary_data, binary_length); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/message.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/** MySpaceIM protocol messages - * - * \author Jeff Connelly - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_MESSAGE_H -#define _MYSPACE_MESSAGE_H - -#include - -#define MsimMessage GList /* #define instead of typedef to avoid casting */ -typedef gchar MsimMessageType; -typedef struct _MsimMessageElement MsimMessageElement; - -#include "session.h" - -/* Types */ -struct _MsimMessageElement -{ - const gchar *name; /**< Textual name of element. */ - gboolean dynamic_name; /**< TRUE if 'name' is a dynamic string to be freed, not static. */ - guint type; /**< MSIM_TYPE_* code. */ - gpointer data; /**< Pointer to data, or GUINT_TO_POINTER for int/bool. */ -}; - -#define msim_msg_get_next_element_node(msg) ((MsimMessage *)(msg->next)) - -/* Protocol field types */ -#define MSIM_TYPE_RAW '-' -#define MSIM_TYPE_INTEGER 'i' -#define MSIM_TYPE_STRING 's' -#define MSIM_TYPE_BINARY 'b' -#define MSIM_TYPE_BOOLEAN 'f' -#define MSIM_TYPE_DICTIONARY 'd' -#define MSIM_TYPE_LIST 'l' - -gchar *msim_escape(const gchar *msg); -gchar *msim_unescape(const gchar *msg); - -MsimMessage *msim_msg_new(gchar *first_key, ...); -/* No sentinel attribute, because can leave off varargs if not_empty is FALSE. */ - -MsimMessage *msim_msg_clone(MsimMessage *old); -void msim_msg_free_element_data(MsimMessageElement *elem); -void msim_msg_free(MsimMessage *msg); -MsimMessage *msim_msg_append(MsimMessage *msg, const gchar *name, MsimMessageType type, gpointer data); -MsimMessage *msim_msg_insert_before(MsimMessage *msg, const gchar *name_before, const gchar *name, MsimMessageType type, gpointer data); -gchar *msim_msg_pack_element_data(MsimMessageElement *elem); -void msim_msg_dump(const char *fmt_string, MsimMessage *msg); -gchar *msim_msg_pack(MsimMessage *msg); - -void msim_msg_list_free(GList *l); - -/* Based on http://permalink.gmane.org/gmane.comp.parsers.sparse/695 - * Define macros for useful gcc attributes. */ -#ifdef __GNUC__ -#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1))) -#define NORETURN_ATTR __attribute__ ((__noreturn__)) -/* __sentinel__ attribute was introduced in gcc 3.5 */ -#if (GCC_VERSION >= 3005) - #define SENTINEL_ATTR __attribute__ ((__sentinel__(0))) -#else - #define SENTINEL_ATTR -#endif /* gcc >= 3.5 */ -#else - #define FORMAT_ATTR(pos) - #define NORETURN_ATTR - #define SENTINEL_ATTR -#endif - -/* Cause gcc to emit "a missing sentinel in function call" if forgot - * to write NULL as last, terminating parameter. */ -gboolean msim_send(struct _MsimSession *session, ...) SENTINEL_ATTR; - -gboolean msim_msg_send(struct _MsimSession *session, MsimMessage *msg); - -MsimMessage *msim_parse(const gchar *raw); - -MsimMessageElement *msim_msg_get(const MsimMessage *msg, const gchar *name); - -/* Retrieve data by name */ -gchar *msim_msg_get_string(const MsimMessage *msg, const gchar *name); -GList *msim_msg_get_list(const MsimMessage *msg, const gchar *name); -MsimMessage *msim_msg_get_dictionary(const MsimMessage *msg, const gchar *name); -guint msim_msg_get_integer(const MsimMessage *msg, const gchar *name); -gboolean msim_msg_get_binary(const MsimMessage *msg, const gchar *name, gchar **binary_data, gsize *binary_length); - -/* Retrieve data by element (MsimMessageElement *), returned from msim_msg_get() */ -gchar *msim_msg_get_string_from_element(MsimMessageElement *elem); -guint msim_msg_get_integer_from_element(MsimMessageElement *elem); - -#endif /* _MYSPACE_MESSAGE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3719 +0,0 @@ -/** - * MySpaceIM Protocol Plugin - * - * \author Jeff Connelly - * - * Copyright (C) 2007, Jeff Connelly - * - * Based on Purple's "C Plugin HOWTO" hello world example. - * - * Code also drawn from mockprpl: - * http://snarfed.org/space/purple+mock+protocol+plugin - * Copyright (C) 2004-2007, Ryan Barrett - * - * and some constructs also based on existing Purple plugins, which are: - * Copyright (C) 2003, Robbert Haarman - * Copyright (C) 2003, Ethan Blanton - * Copyright (C) 2000-2003, Rob Flynn - * Copyright (C) 1998-1999, Mark Spencer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#define PURPLE_PLUGIN - -#include "myspace.h" - -#include "privacy.h" - -static void msim_set_status(PurpleAccount *account, PurpleStatus *status); -static void msim_set_idle(PurpleConnection *gc, int time); - -/** - * Perform actual postprocessing on a message, adding userid as specified. - * - * @param msg The message to postprocess. - * @param uid_before Name of field where to insert new field before, or NULL for end. - * @param uid_field_name Name of field to add uid to. - * @param uid The userid to insert. - * - * If the field named by uid_field_name already exists, then its string contents will - * be used for the field, except "" will be replaced by the userid. - * - * If the field named by uid_field_name does not exist, it will be added before the - * field named by uid_before, as an integer, with the userid. - * - * Does not handle sending, or scheduling userid lookup. For that, see msim_postprocess_outgoing(). - */ -static MsimMessage * -msim_do_postprocessing(MsimMessage *msg, const gchar *uid_before, - const gchar *uid_field_name, guint uid) -{ - MsimMessageElement *elem; - - /* First, check - if the field already exists, replace within it */ - if ((elem = msim_msg_get(msg, uid_field_name)) != NULL) { - gchar *fmt_string; - gchar *uid_str, *new_str; - - /* Get the packed element, flattening it. This allows to be - * replaced within nested data structures, since the replacement is done - * on the linear, packed data, not on a complicated data structure. - * - * For example, if the field was originally a dictionary or a list, you - * would have to iterate over all the items in it to see what needs to - * be replaced. But by packing it first, the marker is easily replaced - * just by a string replacement. - */ - fmt_string = msim_msg_pack_element_data(elem); - - uid_str = g_strdup_printf("%d", uid); - new_str = purple_strreplace(fmt_string, "", uid_str); - g_free(uid_str); - g_free(fmt_string); - - /* Free the old element data */ - msim_msg_free_element_data(elem->data); - - /* Replace it with our new data */ - elem->data = new_str; - elem->type = MSIM_TYPE_RAW; - - } else { - /* Otherwise, insert new field into outgoing message. */ - msg = msim_msg_insert_before(msg, uid_before, uid_field_name, MSIM_TYPE_INTEGER, GUINT_TO_POINTER(uid)); - } - - return msg; -} - -/** - * Callback for msim_postprocess_outgoing() to add a userid to a message, and send it (once receiving userid). - * - * @param session - * @param userinfo The user information reply message, containing the user ID - * @param data The message to postprocess and send. - * - * The data message should contain these fields: - * - * _uid_field_name: string, name of field to add with userid from userinfo message - * _uid_before: string, name of field before field to insert, or NULL for end - */ -static void -msim_postprocess_outgoing_cb(MsimSession *session, const MsimMessage *userinfo, - gpointer data) -{ - gchar *uid_field_name, *uid_before, *username; - guint uid; - MsimMessage *msg, *body; - - msg = (MsimMessage *)data; - - /* Obtain userid from userinfo message. */ - body = msim_msg_get_dictionary(userinfo, "body"); - g_return_if_fail(body != NULL); - - uid = msim_msg_get_integer(body, "UserID"); - msim_msg_free(body); - - username = msim_msg_get_string(msg, "_username"); - - if (!uid) { - gchar *msg; - - msg = g_strdup_printf(_("No such user: %s"), username); - if (!purple_conv_present_error(username, session->account, msg)) { - purple_notify_error(NULL, NULL, _("User lookup"), msg); - } - - g_free(msg); - g_free(username); - /* TODO: free - * msim_msg_free(msg); - */ - return; - } - - uid_field_name = msim_msg_get_string(msg, "_uid_field_name"); - uid_before = msim_msg_get_string(msg, "_uid_before"); - - msg = msim_do_postprocessing(msg, uid_before, uid_field_name, uid); - - /* Send */ - if (!msim_msg_send(session, msg)) { - msim_msg_dump("msim_postprocess_outgoing_cb: sending failed for message: %s\n", msg); - } - - - /* Free field names AFTER sending message, because MsimMessage does NOT copy - * field names - instead, treats them as static strings (which they usually are). - */ - g_free(uid_field_name); - g_free(uid_before); - g_free(username); - /* TODO: free - * msim_msg_free(msg); - */ -} - -/** - * Postprocess and send a message. - * - * @param session - * @param msg Message to postprocess. Will NOT be freed. - * @param username Username to resolve. Assumed to be a static string (will not be freed or copied). - * @param uid_field_name Name of new field to add, containing uid of username. Static string. - * @param uid_before Name of existing field to insert username field before. Static string. - * - * @return TRUE if successful. - */ -static gboolean -msim_postprocess_outgoing(MsimSession *session, MsimMessage *msg, - const gchar *username, const gchar *uid_field_name, - const gchar *uid_before) -{ - PurpleBuddy *buddy; - guint uid; - gboolean rc; - - g_return_val_if_fail(msg != NULL, FALSE); - - /* Store information for msim_postprocess_outgoing_cb(). */ - msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, g_strdup(username)); - msg = msim_msg_append(msg, "_uid_field_name", MSIM_TYPE_STRING, g_strdup(uid_field_name)); - msg = msim_msg_append(msg, "_uid_before", MSIM_TYPE_STRING, g_strdup(uid_before)); - - /* First, try the most obvious. If numeric userid is given, use that directly. */ - if (msim_is_userid(username)) { - uid = atol(username); - } else { - /* Next, see if on buddy list and know uid. */ - buddy = purple_find_buddy(session->account, username); - if (buddy) { - uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID"); - } else { - uid = 0; - } - - if (!buddy || !uid) { - /* Don't have uid offhand - need to ask for it, and wait until hear back before sending. */ - purple_debug_info("msim", ">>> msim_postprocess_outgoing: couldn't find username %s in blist\n", - username ? username : "(NULL)"); - msim_lookup_user(session, username, msim_postprocess_outgoing_cb, msim_msg_clone(msg)); - return TRUE; /* not sure of status yet - haven't sent! */ - } - } - - /* Already have uid, postprocess and send msg immediately. */ - purple_debug_info("msim", "msim_postprocess_outgoing: found username %s has uid %d\n", - username ? username : "(NULL)", uid); - - msg = msim_do_postprocessing(msg, uid_before, uid_field_name, uid); - - rc = msim_msg_send(session, msg); - - /* TODO: free - * msim_msg_free(msg); - */ - - return rc; -} - -/** - * Send a buddy message of a given type. - * - * @param session - * @param who Username to send message to. - * @param text Message text to send. Not freed; will be copied. - * @param type A MSIM_BM_* constant. - * - * @return TRUE if success, FALSE if fail. - * - * Buddy messages ('bm') include instant messages, action messages, status messages, etc. - */ -gboolean -msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, - int type) -{ - gboolean rc; - MsimMessage *msg; - const gchar *from_username; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(who != NULL, FALSE); - g_return_val_if_fail(text != NULL, FALSE); - - from_username = session->account->username; - - g_return_val_if_fail(from_username != NULL, FALSE); - - purple_debug_info("msim", "sending %d message from %s to %s: %s\n", - type, from_username, who, text); - - msg = msim_msg_new( - "bm", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(type), - "sesskey", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(session->sesskey), - /* 't' will be inserted here */ - "cv", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(MSIM_CLIENT_VERSION), - "msg", MSIM_TYPE_STRING, g_strdup(text), - NULL); - - rc = msim_postprocess_outgoing(session, msg, who, "t", "cv"); - - msim_msg_free(msg); - - return rc; -} - -/** - * Lookup a username by userid, from buddy list. - * - * @param wanted_uid - * - * @return Username of wanted_uid, if on blist, or NULL. - * This is a static string, so don't free it. Copy it if needed. - * - */ -static const gchar * -msim_uid2username_from_blist(PurpleAccount *account, guint wanted_uid) -{ - GSList *buddies, *cur; - const gchar *ret; - - buddies = purple_find_buddies(account, NULL); - - if (!buddies) - { - purple_debug_info("msim", "msim_uid2username_from_blist: no buddies?\n"); - return NULL; - } - - ret = NULL; - - for (cur = buddies; cur != NULL; cur = g_slist_next(cur)) - { - PurpleBuddy *buddy; - guint uid; - const gchar *name; - - /* See finch/gnthistory.c */ - buddy = cur->data; - - uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID"); - name = purple_buddy_get_name(buddy); - - if (uid == wanted_uid) - { - ret = name; - break; - } - } - - g_slist_free(buddies); - return ret; -} - -/** - * Setup a callback, to be called when a reply is received with the returned rid. - * - * @param cb The callback, an MSIM_USER_LOOKUP_CB. - * @param data Arbitrary user data to be passed to callback (probably an MsimMessage *). - * - * @return The request/reply ID, used to link replies with requests, or -1. - * Put the rid in your request, 'rid' field. - * - * TODO: Make more generic and more specific: - * 1) MSIM_USER_LOOKUP_CB - make it for PERSIST_REPLY, not just user lookup - * 2) data - make it an MsimMessage? - */ -guint -msim_new_reply_callback(MsimSession *session, MSIM_USER_LOOKUP_CB cb, - gpointer data) -{ - guint rid; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), -1); - - rid = session->next_rid++; - - g_hash_table_insert(session->user_lookup_cb, GUINT_TO_POINTER(rid), cb); - g_hash_table_insert(session->user_lookup_cb_data, GUINT_TO_POINTER(rid), data); - - return rid; -} - -/** - * Return the icon name for a buddy and account. - * - * @param acct The account to find the icon for, or NULL for protocol icon. - * @param buddy The buddy to find the icon for, or NULL for the account icon. - * - * @return The base icon name string. - */ -static const gchar * -msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) -{ - /* Use a MySpace icon submitted by hbons at - * http://developer.pidgin.im/wiki/MySpaceIM. */ - return "myspace"; -} - -/** - * Obtain the status text for a buddy. - * - * @param buddy The buddy to obtain status text for. - * - * @return Status text, or NULL if error. Caller g_free()'s. - */ -static char * -msim_status_text(PurpleBuddy *buddy) -{ - MsimSession *session; - MsimUser *user; - const gchar *display_name, *headline; - PurpleAccount *account; - PurpleConnection *gc; - - g_return_val_if_fail(buddy != NULL, NULL); - - user = msim_get_user_from_buddy(buddy, TRUE); - - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - session = (MsimSession *)gc->proto_data; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL); - - display_name = headline = NULL; - - /* Retrieve display name and/or headline, depending on user preference. */ - if (purple_account_get_bool(session->account, "show_headline", TRUE)) { - headline = user->headline; - } - - if (purple_account_get_bool(session->account, "show_display_name", FALSE)) { - display_name = user->display_name; - } - - /* Return appropriate combination of display name and/or headline, or neither. */ - - if (display_name && headline) { - return g_strconcat(display_name, " ", headline, NULL); - } else if (display_name) { - return g_strdup(display_name); - } else if (headline) { - return g_strdup(headline); - } - - return NULL; -} - -/** - * Obtain the tooltip text for a buddy. - * - * @param buddy Buddy to obtain tooltip text on. - * @param user_info Variable modified to have the tooltip text. - * @param full TRUE if should obtain full tooltip text. - */ -static void -msim_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, - gboolean full) -{ - MsimUser *user; - - g_return_if_fail(buddy != NULL); - g_return_if_fail(user_info != NULL); - - user = msim_get_user_from_buddy(buddy, TRUE); - - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - MsimSession *session; - PurpleAccount *account = purple_buddy_get_account(buddy); - PurpleConnection *gc = purple_account_get_connection(account); - - session = (MsimSession *)gc->proto_data; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - /* TODO: if (full), do something different? */ - - /* TODO: request information? have to figure out how to do - * the asynchronous lookup like oscar does (tooltip shows - * 'retrieving...' if not yet available, then changes when it is). - * - * Right now, only show what we have on hand. - */ - - /* Show abbreviated user info. */ - msim_append_user_info(session, user_info, user, FALSE); - } -} - -/** - * Get possible user status types. Based on mockprpl. - * - * @return GList of status types. - */ -static GList * -msim_status_types(PurpleAccount *acct) -{ - GList *types; - PurpleStatusType *status; - - purple_debug_info("myspace", "returning status types\n"); - - types = NULL; - - /* Statuses are almost all the same. Define a macro to reduce code repetition. */ -#define _MSIM_ADD_NEW_STATUS(prim) status = \ - purple_status_type_new_with_attrs( \ - prim, /* PurpleStatusPrimitive */ \ - NULL, /* id - use default */ \ - NULL, /* name - use default */ \ - TRUE, /* saveable */ \ - TRUE, /* user_settable */ \ - FALSE, /* not independent */ \ - \ - /* Attributes - each status can have a message. */ \ - "message", \ - _("Message"), \ - purple_value_new(PURPLE_TYPE_STRING), \ - NULL); \ - \ - \ - types = g_list_append(types, status) - - - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_AVAILABLE); - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_AWAY); - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_OFFLINE); - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_INVISIBLE); - - /* Except tune status is different... */ - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_TUNE, /* primitive */ - "tune", /* ID */ - NULL, /* name - use default */ - FALSE, /* saveable */ - TRUE, /* should be user_settable some day */ - TRUE, /* independent */ - - PURPLE_TUNE_ARTIST, _("Artist"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Title"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - - types = g_list_append(types, status); - - return types; -} - -/* - * TODO: This define is stolen from oscar.h. - * It's also in yahoo.h. - * It should be in libpurple/util.c - */ -#define msim_put32(buf, data) ( \ - (*((buf)) = (unsigned char)((data)>>24)&0xff), \ - (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ - (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ - (*((buf)+3) = (unsigned char)(data)&0xff), \ - 4) - -/** - * Compute the base64'd login challenge response based on username, password, nonce, and IPs. - * - * @param nonce The base64 encoded nonce ('nc') field from the server. - * @param email User's email address (used as login name). - * @param password User's cleartext password. - * @param response_len Will be written with response length. - * - * @return Binary login challenge response, ready to send to the server. - * Must be g_free()'d when finished. NULL if error. - */ -static gchar * -msim_compute_login_response(const gchar nonce[2 * NONCE_SIZE], - const gchar *email, const gchar *password, guint *response_len) -{ - PurpleCipherContext *key_context; - PurpleCipher *sha1; - PurpleCipherContext *rc4; - - guchar hash_pw[HASH_SIZE]; - guchar key[HASH_SIZE]; - gchar *password_truncated, *password_utf16le, *password_utf8_lc; - GString *data; - guchar *data_out; - size_t data_out_len; - gsize conv_bytes_read, conv_bytes_written; - GError *conv_error; -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - int i; -#endif - - g_return_val_if_fail(nonce != NULL, NULL); - g_return_val_if_fail(email != NULL, NULL); - g_return_val_if_fail(password != NULL, NULL); - g_return_val_if_fail(response_len != NULL, NULL); - - /* - * Truncate password to 10 characters. Their "change password" - * web page doesn't let you enter more than 10 characters, but you - * can enter more than 10 when logging in on myspace.com and they - * truncate it. - */ - password_truncated = g_strndup(password, 10); - - /* Convert password to lowercase (required for passwords containing - * uppercase characters). MySpace passwords are lowercase, - * see ticket #2066. */ - password_utf8_lc = g_utf8_strdown(password_truncated, -1); - g_free(password_truncated); - - /* Convert ASCII password to UTF16 little endian */ - purple_debug_info("msim", "converting password to UTF-16LE\n"); - conv_error = NULL; - password_utf16le = g_convert(password_utf8_lc, -1, "UTF-16LE", "UTF-8", - &conv_bytes_read, &conv_bytes_written, &conv_error); - g_free(password_utf8_lc); - - if (conv_error != NULL) { - purple_debug_error("msim", - "g_convert password UTF8->UTF16LE failed: %s", - conv_error->message); - g_error_free(conv_error); - return NULL; - } - - /* Compute password hash */ - purple_cipher_digest_region("sha1", (guchar *)password_utf16le, - conv_bytes_written, sizeof(hash_pw), hash_pw, NULL); - g_free(password_utf16le); - -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - purple_debug_info("msim", "pwhash = "); - for (i = 0; i < sizeof(hash_pw); i++) - purple_debug_info("msim", "%.2x ", hash_pw[i]); - purple_debug_info("msim", "\n"); -#endif - - /* key = sha1(sha1(pw) + nonce2) */ - sha1 = purple_ciphers_find_cipher("sha1"); - key_context = purple_cipher_context_new(sha1, NULL); - purple_cipher_context_append(key_context, hash_pw, HASH_SIZE); - purple_cipher_context_append(key_context, (guchar *)(nonce + NONCE_SIZE), NONCE_SIZE); - purple_cipher_context_digest(key_context, sizeof(key), key, NULL); - purple_cipher_context_destroy(key_context); - -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - purple_debug_info("msim", "key = "); - for (i = 0; i < sizeof(key); i++) { - purple_debug_info("msim", "%.2x ", key[i]); - } - purple_debug_info("msim", "\n"); -#endif - - rc4 = purple_cipher_context_new_by_name("rc4", NULL); - - /* Note: 'key' variable is 0x14 bytes (from SHA-1 hash), - * but only first 0x10 used for the RC4 key. */ - purple_cipher_context_set_option(rc4, "key_len", (gpointer)0x10); - purple_cipher_context_set_key(rc4, key); - - /* rc4 encrypt: - * nonce1+email+IP list */ - - data = g_string_new(NULL); - g_string_append_len(data, nonce, NONCE_SIZE); - - /* Include the null terminator */ - g_string_append_len(data, email, strlen(email) + 1); - - while (data->len % 4 != 0) - g_string_append_c(data, 0xfb); - -#ifdef SEND_OUR_IP_ADDRESSES - /* TODO: Obtain IPs of network interfaces instead of using this hardcoded value */ - g_string_set_size(data, data->len + 4); - msim_put32(data->str + data->len - 4, MSIM_LOGIN_IP_LIST_LEN); - g_string_append_len(data, MSIM_LOGIN_IP_LIST, MSIM_LOGIN_IP_LIST_LEN); -#else - g_string_set_size(data, data->len + 4); - msim_put32(data->str + data->len - 4, 0); -#endif /* !SEND_OUR_IP_ADDRESSES */ - - data_out = g_new0(guchar, data->len); - - purple_cipher_context_encrypt(rc4, (const guchar *)data->str, - data->len, data_out, &data_out_len); - purple_cipher_context_destroy(rc4); - - if (data_out_len != data->len) { - purple_debug_info("msim", "msim_compute_login_response: " - "data length mismatch: %" G_GSIZE_FORMAT " != %" - G_GSIZE_FORMAT "\n", data_out_len, data->len); - } - - g_string_free(data, TRUE); - -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - purple_debug_info("msim", "response=<%s>\n", data_out); -#endif - - *response_len = data_out_len; - - return (gchar *)data_out; -} - -/** - * Process a login challenge, sending a response. - * - * @param session - * @param msg Login challenge message. - * - * @return TRUE if successful, FALSE if not - */ -static gboolean -msim_login_challenge(MsimSession *session, MsimMessage *msg) -{ - PurpleAccount *account; - gchar *response; - guint response_len; - gchar *nc; - gsize nc_len; - gboolean ret; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - g_return_val_if_fail(msim_msg_get_binary(msg, "nc", &nc, &nc_len), FALSE); - - account = session->account; - - g_return_val_if_fail(account != NULL, FALSE); - - purple_connection_update_progress(session->gc, _("Reading challenge"), 1, 4); - - purple_debug_info("msim", "nc is %" G_GSIZE_FORMAT - " bytes, decoded\n", nc_len); - - if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) { - purple_debug_info("msim", "bad nc length: %" G_GSIZE_MODIFIER - "x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH); - purple_connection_error_reason (session->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unexpected challenge length from server")); - return FALSE; - } - - purple_connection_update_progress(session->gc, _("Logging in"), 2, 4); - - response_len = 0; - response = msim_compute_login_response(nc, account->username, account->password, &response_len); - - g_free(nc); - - ret = msim_send(session, - "login2", MSIM_TYPE_INTEGER, MSIM_AUTH_ALGORITHM, - /* This is actually user's email address. */ - "username", MSIM_TYPE_STRING, g_strdup(account->username), - /* GString will be freed in msim_msg_free() in msim_send(). */ - "response", MSIM_TYPE_BINARY, g_string_new_len(response, response_len), - "clientver", MSIM_TYPE_INTEGER, MSIM_CLIENT_VERSION, - "langid", MSIM_TYPE_INTEGER, MSIM_LANGUAGE_ID_ENGLISH, - "imlang", MSIM_TYPE_STRING, g_strdup(MSIM_LANGUAGE_NAME_ENGLISH), - "reconn", MSIM_TYPE_INTEGER, 0, - "status", MSIM_TYPE_INTEGER, 100, - "id", MSIM_TYPE_INTEGER, 1, - NULL); - - g_free(response); - - return ret; -} - -/** - * Process unrecognized information. - * - * @param session - * @param msg An MsimMessage that was unrecognized, or NULL. - * @param note Information on what was unrecognized, or NULL. - */ -void -msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note) -{ - /* TODO: Some more context, outwardly equivalent to a backtrace, - * for helping figure out what this msg is for. What was going on? - * But not too much information so that a user - * posting this dump reveals confidential information. - */ - - /* TODO: dump unknown msgs to file, so user can send them to me - * if they wish, to help add support for new messages (inspired - * by Alexandr Shutko, who maintains OSCAR protocol documentation). - * - * Filed enhancement ticket for libpurple as #4688. - */ - - purple_debug_info("msim", "Unrecognized data on account for %s\n", - (session && session->account && session->account->username) ? - session->account->username : "(NULL)"); - if (note) { - purple_debug_info("msim", "(Note: %s)\n", note); - } - - if (msg) { - msim_msg_dump("Unrecognized message dump: %s\n", msg); - } -} - -/** Called when the session key arrives to check whether the user - * has a username, and set one if desired. */ -static gboolean -msim_is_username_set(MsimSession *session, MsimMessage *msg) -{ - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - g_return_val_if_fail(session->gc != NULL, FALSE); - - session->sesskey = msim_msg_get_integer(msg, "sesskey"); - purple_debug_info("msim", "SESSKEY=<%d>\n", session->sesskey); - - /* What is proof? Used to be uid, but now is 52 base64'd bytes... */ - - /* Comes with: proof,profileid,userid,uniquenick -- all same values - * some of the time, but can vary. This is our own user ID. */ - session->userid = msim_msg_get_integer(msg, "userid"); - - /* Save uid to account so this account can be looked up by uid. */ - purple_account_set_int(session->account, "uid", session->userid); - - /* Not sure what profileid is used for. */ - if (msim_msg_get_integer(msg, "profileid") != session->userid) { - msim_unrecognized(session, msg, - "Profile ID didn't match user ID, don't know why"); - } - - /* We now know are our own username, only after we're logged in.. - * which is weird, but happens because you login with your email - * address and not username. Will be freed in msim_session_destroy(). */ - session->username = msim_msg_get_string(msg, "uniquenick"); - - /* If user lacks a username, help them get one. */ - if (msim_msg_get_integer(msg, "uniquenick") == session->userid) { - purple_debug_info("msim_is_username_set", "no username is set\n"); - purple_request_yes_no(session->gc, - _("MySpaceIM - No Username Set"), - _("You appear to have no MySpace username."), - _("Would you like to set one now? (Note: THIS CANNOT BE CHANGED!)"), - 0, - session->account, - NULL, - NULL, - session->gc, - G_CALLBACK(msim_set_username_cb), - G_CALLBACK(msim_do_not_set_username_cb)); - purple_debug_info("msim_is_username_set","'username not set' alert prompted\n"); - return FALSE; - } - return TRUE; -} - -#ifdef MSIM_USE_KEEPALIVE -/** - * Check if the connection is still alive, based on last communication. - */ -static gboolean -msim_check_alive(gpointer data) -{ - MsimSession *session; - time_t delta; - - session = (MsimSession *)data; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - - delta = time(NULL) - session->last_comm; - - /* purple_debug_info("msim", "msim_check_alive: delta=%d\n", delta); */ - if (delta >= MSIM_KEEPALIVE_INTERVAL) { - purple_debug_info("msim", - "msim_check_alive: %zu > interval of %d, presumed dead\n", - delta, MSIM_KEEPALIVE_INTERVAL); - purple_connection_error_reason(session->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - - return FALSE; - } - - return TRUE; -} -#endif - -/** - * Handle mail reply checks. - */ -static void -msim_check_inbox_cb(MsimSession *session, const MsimMessage *reply, gpointer data) -{ - MsimMessage *body; - guint old_inbox_status; - guint i, n; - /* Information for each new inbox message type. */ - static struct - { - const gchar *key; - guint bit; - const gchar *url; - const gchar *text; - } message_types[] = { - { "Mail", MSIM_INBOX_MAIL, "http://messaging.myspace.com/index.cfm?fuseaction=mail.inbox", NULL }, - { "BlogComment", MSIM_INBOX_BLOG_COMMENT, "http://blog.myspace.com/index.cfm?fuseaction=blog", NULL }, - { "ProfileComment", MSIM_INBOX_PROFILE_COMMENT, "http://home.myspace.com/index.cfm?fuseaction=user", NULL }, - { "FriendRequest", MSIM_INBOX_FRIEND_REQUEST, "http://messaging.myspace.com/index.cfm?fuseaction=mail.friendRequests", NULL }, - { "PictureComment", MSIM_INBOX_PICTURE_COMMENT, "http://home.myspace.com/index.cfm?fuseaction=user", NULL } - }; - const gchar *froms[G_N_ELEMENTS(message_types) + 1] = { "" }, - *tos[G_N_ELEMENTS(message_types) + 1] = { "" }, - *urls[G_N_ELEMENTS(message_types) + 1] = { "" }, - *subjects[G_N_ELEMENTS(message_types) + 1] = { "" }; - - g_return_if_fail(reply != NULL); - - /* Can't write _()'d strings in array initializers. Workaround. */ - /* khc: then use N_() in the array initializer and use _() when they are - used */ - message_types[0].text = _("New mail messages"); - message_types[1].text = _("New blog comments"); - message_types[2].text = _("New profile comments"); - message_types[3].text = _("New friend requests!"); - message_types[4].text = _("New picture comments"); - - body = msim_msg_get_dictionary(reply, "body"); - - if (body == NULL) - return; - - old_inbox_status = session->inbox_status; - - n = 0; - - for (i = 0; i < G_N_ELEMENTS(message_types); ++i) { - const gchar *key; - guint bit; - - key = message_types[i].key; - bit = message_types[i].bit; - - if (msim_msg_get(body, key)) { - /* Notify only on when _changes_ from no mail -> has mail - * (edge triggered) */ - if (!(session->inbox_status & bit)) { - purple_debug_info("msim", "msim_check_inbox_cb: got %s, at %d\n", - key ? key : "(NULL)", n); - - subjects[n] = message_types[i].text; - froms[n] = _("MySpace"); - tos[n] = session->username; - /* TODO: append token, web challenge, so automatically logs in. - * Would also need to free strings because they won't be static - */ - urls[n] = message_types[i].url; - - ++n; - } else { - purple_debug_info("msim", - "msim_check_inbox_cb: already notified of %s\n", - key ? key : "(NULL)"); - } - - session->inbox_status |= bit; - } - } - - if (n) { - purple_debug_info("msim", - "msim_check_inbox_cb: notifying of %d\n", n); - - /* TODO: free strings with callback _if_ change to dynamic (w/ token) */ - purple_notify_emails(session->gc, /* handle */ - n, /* count */ - TRUE, /* detailed */ - subjects, froms, tos, urls, - NULL, /* PurpleNotifyCloseCallback cb */ - NULL); /* gpointer user_data */ - - } - - msim_msg_free(body); -} - -/** - * Send request to check if there is new mail. - */ -static gboolean -msim_check_inbox(gpointer data) -{ - MsimSession *session; - - session = (MsimSession *)data; - - if (!MSIM_SESSION_VALID(session)) { - purple_debug_info("msim", "msim_check_inbox: session invalid, stopping the mail check.\n"); - return FALSE; - } - - purple_debug_info("msim", "msim_check_inbox: checking mail\n"); - g_return_val_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_CHECK_MAIL_DSN, - "lid", MSIM_TYPE_INTEGER, MG_CHECK_MAIL_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, - msim_new_reply_callback(session, msim_check_inbox_cb, NULL), - "body", MSIM_TYPE_STRING, g_strdup(""), - NULL), TRUE); - - /* Always return true, so that we keep checking for mail. */ - return TRUE; -} - -/** - * Add contact from server to buddy list, after looking up username. - * Callback from msim_add_contact_from_server(). - * - * @param data An MsimMessage * of the contact information. Will be freed. - */ -static void -msim_add_contact_from_server_cb(MsimSession *session, const MsimMessage *user_lookup_info, gpointer data) -{ - MsimMessage *contact_info, *user_lookup_info_body; - PurpleGroup *group; - PurpleBuddy *buddy; - MsimUser *user; - gchar *username, *group_name, *display_name; - guint uid, visibility; - - contact_info = (MsimMessage *)data; - purple_debug_info("msim_add_contact_from_server_cb", "contact_info addr=%p\n", contact_info); - uid = msim_msg_get_integer(contact_info, "ContactID"); - - if (!user_lookup_info) { - username = g_strdup(msim_uid2username_from_blist(session->account, uid)); - display_name = NULL; - g_return_if_fail(username != NULL); - } else { - user_lookup_info_body = msim_msg_get_dictionary(user_lookup_info, "body"); - username = msim_msg_get_string(user_lookup_info_body, "UserName"); - display_name = msim_msg_get_string(user_lookup_info_body, "DisplayName"); - msim_msg_free(user_lookup_info_body); - g_return_if_fail(username != NULL); - } - - purple_debug_info("msim_add_contact_from_server_cb", - "*** about to add/update username=%s\n", username); - - /* 1. Creates a new group, or gets existing group if it exists (or so - * the documentation claims). */ - group_name = msim_msg_get_string(contact_info, "GroupName"); - if (!group_name || (*group_name == '\0')) { - g_free(group_name); - group_name = g_strdup(_("IM Friends")); - purple_debug_info("myspace", "No GroupName specified, defaulting to '%s'.\n", group_name); - } - group = purple_find_group(group_name); - if (!group) { - group = purple_group_new(group_name); - /* Add group to beginning. See #2752. */ - purple_blist_add_group(group, NULL); - } - g_free(group_name); - - visibility = msim_msg_get_integer(contact_info, "Visibility"); - if (visibility == 2) { - /* This buddy is blocked (and therefore not on our buddy list */ - purple_privacy_deny_add(session->account, username, TRUE); - msim_msg_free(contact_info); - g_free(username); - g_free(display_name); - return; - } - - /* 2. Get or create buddy */ - buddy = purple_find_buddy(session->account, username); - if (!buddy) { - purple_debug_info("msim_add_contact_from_server_cb", - "creating new buddy: %s\n", username); - buddy = purple_buddy_new(session->account, username, NULL); - } - - /* TODO: use 'Position' in contact_info to take into account where buddy is */ - purple_blist_add_buddy(buddy, NULL, group, NULL /* insertion point */); - - if (strtol(username, NULL, 10) == uid) { - /* - * This user has not set their username! Set their server - * alias to their display name so that we don't see a bunch - * of numbers in the buddy list. - */ - if (display_name != NULL) { - purple_blist_node_set_string(PURPLE_BLIST_NODE(buddy), "DisplayName", display_name); - serv_got_alias(session->gc, username, display_name); - } else { - serv_got_alias(session->gc, username, - purple_blist_node_get_string(PURPLE_BLIST_NODE(buddy), "DisplayName")); - } - } - g_free(display_name); - - /* 3. Update buddy information */ - user = msim_get_user_from_buddy(buddy, TRUE); - - user->id = uid; - /* Keep track of the user ID across sessions */ - purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", uid); - - /* Stores a few fields in the MsimUser, relevant to the buddy itself. - * AvatarURL, Headline, ContactID. */ - msim_store_user_info(session, contact_info, NULL); - - /* TODO: other fields, store in 'user' */ - msim_msg_free(contact_info); - - g_free(username); -} - -/** - * Add first ContactID in contact_info to buddy's list. Used to add - * server-side buddies to client-side list. - * - * @return TRUE if added. - */ -static gboolean -msim_add_contact_from_server(MsimSession *session, MsimMessage *contact_info) -{ - guint uid; - const gchar *username; - - uid = msim_msg_get_integer(contact_info, "ContactID"); - g_return_val_if_fail(uid != 0, FALSE); - - /* Lookup the username, since NickName and IMName is unreliable */ - username = msim_uid2username_from_blist(session->account, uid); - if (!username) { - gchar *uid_str; - - uid_str = g_strdup_printf("%d", uid); - purple_debug_info("msim_add_contact_from_server", - "contact_info addr=%p\n", contact_info); - msim_lookup_user(session, uid_str, msim_add_contact_from_server_cb, (gpointer)msim_msg_clone(contact_info)); - g_free(uid_str); - } else { - msim_add_contact_from_server_cb(session, NULL, (gpointer)msim_msg_clone(contact_info)); - } - - /* Say that the contact was added, even if we're still looking up - * their username. */ - return TRUE; -} - -/** - * Called when contact list is received from server. - */ -static void -msim_got_contact_list(MsimSession *session, const MsimMessage *reply, gpointer user_data) -{ - MsimMessage *body, *body_node; - gchar *msg; - guint buddy_count; - - body = msim_msg_get_dictionary(reply, "body"); - - buddy_count = 0; - - for (body_node = body; - body_node != NULL; - body_node = msim_msg_get_next_element_node(body_node)) - { - MsimMessageElement *elem; - - elem = (MsimMessageElement *)body_node->data; - - if (g_str_equal(elem->name, "ContactID")) - { - /* Will look for first contact in body_node */ - if (msim_add_contact_from_server(session, body_node)) { - ++buddy_count; - } - } - } - - switch (GPOINTER_TO_UINT(user_data)) { - case MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS: - msg = g_strdup_printf(ngettext("%d buddy was added or updated from the server (including buddies already on the server-side list)", - "%d buddies were added or updated from the server (including buddies already on the server-side list)", - buddy_count), - buddy_count); - purple_notify_info(session->account, _("Add contacts from server"), msg, NULL); - g_free(msg); - break; - - case MSIM_CONTACT_LIST_IMPORT_TOP_FRIENDS: - /* TODO */ - break; - - case MSIM_CONTACT_LIST_INITIAL_FRIENDS: - /* The session is now set up, ready to be connected. This emits the - * signedOn signal, so clients can now do anything with msimprpl, and - * we're ready for it (session key, userid, username all setup). */ - purple_connection_update_progress(session->gc, _("Connected"), 3, 4); - purple_connection_set_state(session->gc, PURPLE_CONNECTED); - break; - } - - msim_msg_free(body); -} - -/** - * Get contact list, calling msim_got_contact_list() with - * what_to_do_after as user_data gpointer. - * - * @param what_to_do_after should be one of the MSIM_CONTACT_LIST_* #defines. - */ -static gboolean -msim_get_contact_list(MsimSession *session, int what_to_do_after) -{ - return msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_LIST_ALL_CONTACTS_DSN, - "lid", MSIM_TYPE_INTEGER, MG_LIST_ALL_CONTACTS_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, - msim_new_reply_callback(session, msim_got_contact_list, GUINT_TO_POINTER(what_to_do_after)), - "body", MSIM_TYPE_STRING, g_strdup(""), - NULL); -} - -/** Called after username is set, if necessary and we're open for business. */ -gboolean msim_we_are_logged_on(MsimSession *session) -{ - MsimMessage *body; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - - /* Set display name to username (otherwise will show email address) */ - purple_connection_set_display_name(session->gc, session->username); - - body = msim_msg_new( - "UserID", MSIM_TYPE_INTEGER, session->userid, - NULL); - - /* Request IM info about ourself. */ - msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_OWN_MYSPACE_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MG_OWN_MYSPACE_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "UserID", MSIM_TYPE_INTEGER, session->userid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - - /* Request MySpace info about ourself. */ - msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_OWN_IM_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MG_OWN_IM_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_STRING, g_strdup(""), - NULL); - - /* TODO: set options (persist cmd=514,dsn=1,lid=10) */ - /* TODO: set blocklist */ - - /* Notify servers of our current status. */ - purple_debug_info("msim", "msim_we_are_logged_on: notifying servers of status\n"); - msim_set_status(session->account, - purple_account_get_active_status(session->account)); - - /* TODO: setinfo */ - /* - body = msim_msg_new( - "TotalFriends", MSIM_TYPE_INTEGER, 666, - NULL); - msim_send(session, - "setinfo", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "info", MSIM_TYPE_DICTIONARY, body, - NULL); - */ - - /* Disable due to problems with timeouts. TODO: fix. */ -#ifdef MSIM_USE_KEEPALIVE - purple_timeout_add_seconds(MSIM_KEEPALIVE_INTERVAL_CHECK, - (GSourceFunc)msim_check_alive, session); -#endif - - /* Check mail if they want to. */ - if (purple_account_get_check_mail(session->account)) { - session->inbox_handle = purple_timeout_add(MSIM_MAIL_INTERVAL_CHECK, - (GSourceFunc)msim_check_inbox, session); - msim_check_inbox(session); - } - - msim_get_contact_list(session, MSIM_CONTACT_LIST_INITIAL_FRIENDS); - - return TRUE; -} - -/** - * Record the client version in the buddy list, from an incoming message. - */ -static gboolean -msim_incoming_bm_record_cv(MsimSession *session, MsimMessage *msg) -{ - gchar *username, *cv; - gboolean ret; - MsimUser *user; - - username = msim_msg_get_string(msg, "_username"); - cv = msim_msg_get_string(msg, "cv"); - - g_return_val_if_fail(username != NULL, FALSE); - if (!cv) { - /* No client version to record, don't worry about it. */ - g_free(username); - return FALSE; - } - - user = msim_find_user(session, username); - - if (user) { - user->client_cv = atol(cv); - ret = TRUE; - } else { - ret = FALSE; - } - - g_free(username); - g_free(cv); - - return ret; -} - -#ifdef MSIM_SEND_CLIENT_VERSION -/** - * Send our client version to another unofficial client that understands it. - */ -static gboolean -msim_send_unofficial_client(MsimSession *session, gchar *username) -{ - gchar *our_info; - gboolean ret; - - our_info = g_strdup_printf("Libpurple %d.%d.%d - msimprpl %s", - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_MICRO_VERSION, - MSIM_PRPL_VERSION_STRING); - - ret = msim_send_bm(session, username, our_info, MSIM_BM_UNOFFICIAL_CLIENT); - - return ret; -} -#endif -/** - * Process incoming status mood messages. - * - * @param session - * @param msg Status mood update message. Caller frees. - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_status_mood(MsimSession *session, MsimMessage *msg) { - /* TODO: I dont know too much about this yet, - * so until I see how the official client handles - * this and decide if libpurple should as well, - * well just say we used it - */ - gchar *ss; - ss = msim_msg_get_string(msg, "msg"); - purple_debug_info("msim", "Incoming Status Message: %s", ss ? ss : "(NULL)"); - g_free(ss); - return TRUE; -} - -/** - * Process incoming status messages. - * - * @param session - * @param msg Status update message. Caller frees. - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_status(MsimSession *session, MsimMessage *msg) -{ - PurpleBuddyList *blist; - MsimUser *user; - GList *list; - gchar *status_headline, *status_headline_escaped; - gint status_code, purple_status_code; - gchar *username; - gchar *unrecognized_msg; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - /* Helpfully looked up by msim_incoming_resolve() for us. */ - username = msim_msg_get_string(msg, "_username"); - g_return_val_if_fail(username != NULL, FALSE); - - { - gchar *ss; - - ss = msim_msg_get_string(msg, "msg"); - purple_debug_info("msim", - "msim_status: updating status for <%s> to <%s>\n", - username, ss ? ss : "(NULL)"); - g_free(ss); - } - - /* Example fields: - * |s|0|ss|Offline - * |s|1|ss|:-)|ls||ip|0|p|0 - */ - list = msim_msg_get_list(msg, "msg"); - - status_code = msim_msg_get_integer_from_element(g_list_nth_data(list, MSIM_STATUS_ORDINAL_ONLINE)); - purple_debug_info("msim", "msim_status: %s's status code = %d\n", username, status_code); - status_headline = msim_msg_get_string_from_element(g_list_nth_data(list, MSIM_STATUS_ORDINAL_HEADLINE)); - - blist = purple_get_blist(); - - /* Add buddy if not found. - * TODO: Could this be responsible for #3444? */ - user = msim_find_user(session, username); - if (!user) { - PurpleBuddy *buddy; - - purple_debug_info("msim", - "msim_status: making new buddy for %s\n", username); - buddy = purple_buddy_new(session->account, username, NULL); - purple_blist_add_buddy(buddy, NULL, NULL, NULL); - - user = msim_get_user_from_buddy(buddy, TRUE); - user->id = msim_msg_get_integer(msg, "f"); - - /* Keep track of the user ID across sessions */ - purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", user->id); - - msim_store_user_info(session, msg, NULL); - } else { - purple_debug_info("msim", "msim_status: found buddy %s\n", username); - } - - if (status_headline && strcmp(status_headline, "") != 0) { - /* The status headline is plaintext, but libpurple treats it as HTML, - * so escape any HTML characters to their entity equivalents. */ - status_headline_escaped = g_markup_escape_text(status_headline, -1); - } else { - status_headline_escaped = NULL; - } - - g_free(status_headline); - - /* don't copy; let the MsimUser own the headline, memory-wise */ - g_free(user->headline); - user->headline = status_headline_escaped; - - /* Set user status */ - switch (status_code) { - case MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN: - purple_status_code = PURPLE_STATUS_OFFLINE; - break; - - case MSIM_STATUS_CODE_ONLINE: - purple_status_code = PURPLE_STATUS_AVAILABLE; - break; - - case MSIM_STATUS_CODE_AWAY: - purple_status_code = PURPLE_STATUS_AWAY; - break; - - case MSIM_STATUS_CODE_IDLE: - /* Treat idle as an available status. */ - purple_status_code = PURPLE_STATUS_AVAILABLE; - break; - - default: - purple_debug_info("msim", "msim_incoming_status for %s, unknown status code %d, treating as available\n", - username, status_code); - purple_status_code = PURPLE_STATUS_AVAILABLE; - - unrecognized_msg = g_strdup_printf("msim_incoming_status, unrecognized status code: %d\n", - status_code); - msim_unrecognized(session, NULL, unrecognized_msg); - g_free(unrecognized_msg); - } - - purple_prpl_got_user_status(session->account, username, purple_primitive_get_id_from_type(purple_status_code), NULL); - - if (status_code == MSIM_STATUS_CODE_IDLE) { - purple_debug_info("msim", "msim_status: got idle: %s\n", username); - purple_prpl_got_user_idle(session->account, username, TRUE, 0); - } else { - /* All other statuses indicate going back to non-idle. */ - purple_prpl_got_user_idle(session->account, username, FALSE, 0); - } - -#ifdef MSIM_SEND_CLIENT_VERSION - if (status_code == MSIM_STATUS_CODE_ONLINE) { - /* Secretly whisper to unofficial clients our own version as they come online */ - msim_send_unofficial_client(session, username); - } -#endif - - if (status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN) { - /* Get information when they come online. - * TODO: periodically refresh? - */ - purple_debug_info("msim_incoming_status", "%s came online, looking up\n", username); - msim_lookup_user(session, username, NULL, NULL); - } - - g_free(username); - msim_msg_list_free(list); - - return TRUE; -} - -/** - * Handle an incoming instant message. - * - * @param session The session - * @param msg Message from the server, containing 'f' (userid from) and 'msg'. - * Should also contain username in _username from preprocessing. - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_im(MsimSession *session, MsimMessage *msg, const gchar *username) -{ - gchar *msg_msim_markup, *msg_purple_markup; - gchar *userid; - time_t time_received; - PurpleConversation *conv; - - /* I know this isn't really a string... but we need it to be one for - * purple_find_conversation_with_account(). */ - userid = msim_msg_get_string(msg, "f"); - - purple_debug_info("msim_incoming_im", "UserID is %s", userid); - - if (msim_is_userid(username)) { - purple_debug_info("msim", "Ignoring message from spambot (%s) on account %s\n", - username, purple_account_get_username(session->account)); - return FALSE; - } - - /* See if a conversation with their UID already exists...*/ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, userid, session->account); - if (conv) { - /* Since the conversation exists... We need to normalize it */ - purple_conversation_set_name(conv, username); - } - - msg_msim_markup = msim_msg_get_string(msg, "msg"); - g_return_val_if_fail(msg_msim_markup != NULL, FALSE); - - msg_purple_markup = msim_markup_to_html(session, msg_msim_markup); - g_free(msg_msim_markup); - - time_received = msim_msg_get_integer(msg, "date"); - if (!time_received) { - purple_debug_info("msim_incoming_im", "date in message not set.\n"); - time_received = time(NULL); - } - - serv_got_im(session->gc, username, msg_purple_markup, PURPLE_MESSAGE_RECV, time_received); - - g_free(msg_purple_markup); - - return TRUE; -} - -/** - * Handle an incoming action message or an IM. - * - * @param session - * @param msg - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_action_or_im(MsimSession *session, MsimMessage *msg) -{ - gchar *msg_text, *username; - gboolean rc; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - msg_text = msim_msg_get_string(msg, "msg"); - g_return_val_if_fail(msg_text != NULL, FALSE); - - username = msim_msg_get_string(msg, "_username"); - g_return_val_if_fail(username != NULL, FALSE); - - purple_debug_info("msim", - "msim_incoming_action_or_im: action <%s> from <%s>\n", - msg_text, username); - - if (g_str_equal(msg_text, "%typing%")) { - serv_got_typing(session->gc, username, 0, PURPLE_TYPING); - rc = TRUE; - } else if (g_str_equal(msg_text, "%stoptyping%")) { - serv_got_typing_stopped(session->gc, username); - rc = TRUE; - } else if (strstr(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_")) { - rc = msim_incoming_zap(session, msg); - } else if (strstr(msg_text, "!!!GroupCount=")) { - /* TODO: support group chats. I think the number in msg_text has - * something to do with the 'gid' field. */ - purple_debug_info("msim", - "msim_incoming_action_or_im: " - "TODO: implement #4691, group chats: %s\n", msg_text); - - rc = TRUE; - } else if (strstr(msg_text, "!!!Offline=")) { - /* TODO: support group chats. This one might mean a user - * went offline or exited the chat. */ - purple_debug_info("msim", "msim_incoming_action_or_im: " - "TODO: implement #4691, group chats: %s\n", msg_text); - - rc = TRUE; - } else if (msim_msg_get_integer(msg, "aid") != 0) { - purple_debug_info("msim", "TODO: implement #4691, group chat from %d on %d: %s\n", - msim_msg_get_integer(msg, "aid"), - msim_msg_get_integer(msg, "f"), - msg_text); - - rc = TRUE; - } else { - rc = msim_incoming_im(session, msg, username); - } - - g_free(msg_text); - g_free(username); - - return rc; -} - -/** - * Process an incoming media (message background?) message. - */ -static gboolean -msim_incoming_media(MsimSession *session, MsimMessage *msg) -{ - gchar *username, *text; - - username = msim_msg_get_string(msg, "_username"); - text = msim_msg_get_string(msg, "msg"); - - g_return_val_if_fail(username != NULL, FALSE); - g_return_val_if_fail(text != NULL, FALSE); - - purple_debug_info("msim", "msim_incoming_media: from %s, got msg=%s\n", username, text); - - /* Media messages are sent when the user opens a window to someone. - * Tell libpurple they started typing and stopped typing, to inform the Psychic - * Mode plugin so it too can open a window to the user. */ - serv_got_typing(session->gc, username, 0, PURPLE_TYPING); - serv_got_typing_stopped(session->gc, username); - - g_free(username); - - return TRUE; -} - -/** - * Process an incoming "unofficial client" message. The plugin for - * Miranda IM sends this message with the plugin information. - */ -static gboolean -msim_incoming_unofficial_client(MsimSession *session, MsimMessage *msg) -{ - MsimUser *user; - gchar *username, *client_info; - - username = msim_msg_get_string(msg, "_username"); - client_info = msim_msg_get_string(msg, "msg"); - - g_return_val_if_fail(username != NULL, FALSE); - g_return_val_if_fail(client_info != NULL, FALSE); - - purple_debug_info("msim", "msim_incoming_unofficial_client: %s is using client %s\n", - username, client_info); - - user = msim_find_user(session, username); - - g_return_val_if_fail(user != NULL, FALSE); - - if (user->client_info) { - g_free(user->client_info); - } - user->client_info = client_info; - - g_free(username); - /* Do not free client_info - the MsimUser now owns it. */ - - return TRUE; -} - -/** - * Handle an incoming buddy message. - */ -static gboolean -msim_incoming_bm(MsimSession *session, MsimMessage *msg) -{ - guint bm; - - bm = msim_msg_get_integer(msg, "bm"); - - msim_incoming_bm_record_cv(session, msg); - - switch (bm) { - case MSIM_BM_STATUS: - return msim_incoming_status(session, msg); - case MSIM_BM_ACTION_OR_IM_DELAYABLE: - case MSIM_BM_ACTION_OR_IM_INSTANT: - return msim_incoming_action_or_im(session, msg); - case MSIM_BM_MEDIA: - return msim_incoming_media(session, msg); - case MSIM_BM_UNOFFICIAL_CLIENT: - return msim_incoming_unofficial_client(session, msg); - case MSIM_BM_STATUS_MOOD: - return msim_incoming_status_mood(session, msg); - default: - /* - * Unknown message type! We used to call - * msim_incoming_action_or_im(session, msg); - * for these, but that doesn't help anything, and it means - * we'll show broken gibberish if MySpace starts sending us - * other message types. - */ - purple_debug_warning("myspace", "Received unknown imcoming " - "message, bm=%u\n", bm); - return TRUE; - } -} - -/** - * Process the initial server information from the server. - */ -static gboolean -msim_process_server_info(MsimSession *session, MsimMessage *msg) -{ - MsimMessage *body; - - body = msim_msg_get_dictionary(msg, "body"); - g_return_val_if_fail(body != NULL, FALSE); - - /* Example body: -AdUnitRefreshInterval=10. -AlertPollInterval=360. -AllowChatRoomEmoticonSharing=False. -ChatRoomUserIDs=78744676;163733130;1300326231;123521495;142663391. -CurClientVersion=673. -EnableIMBrowse=True. -EnableIMStuffAvatars=False. -EnableIMStuffZaps=False. -MaxAddAllFriends=100. -MaxContacts=1000. -MinClientVersion=594. -MySpaceIM_ENGLISH=78744676. -MySpaceNowTimer=720. -PersistenceDataTimeout=900. -UseWebChallenge=1. -WebTicketGoHome=False - - Anything useful? TODO: use what is useful, and use it. -*/ - purple_debug_info("msim_process_server_info", - "maximum contacts: %d\n", - msim_msg_get_integer(body, "MaxContacts")); - - session->server_info = body; - /* session->server_info freed in msim_session_destroy */ - - return TRUE; -} - -/** - * Process a web challenge, used to login to the web site. - */ -static gboolean -msim_web_challenge(MsimSession *session, MsimMessage *msg) -{ - /* TODO: web challenge, store token. #2659. */ - return FALSE; -} - -/** - * Process a persistance message reply from the server. - * - * @param session - * @param msg Message reply from server. - * - * @return TRUE if successful. - * - * msim_lookup_user sets callback for here - */ -static gboolean -msim_process_reply(MsimSession *session, MsimMessage *msg) -{ - MSIM_USER_LOOKUP_CB cb; - gpointer data; - guint rid, cmd, dsn, lid; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - msim_store_user_info(session, msg, NULL); - - rid = msim_msg_get_integer(msg, "rid"); - cmd = msim_msg_get_integer(msg, "cmd"); - dsn = msim_msg_get_integer(msg, "dsn"); - lid = msim_msg_get_integer(msg, "lid"); - - /* Unsolicited messages */ - if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_GET)) { - if (dsn == MG_SERVER_INFO_DSN && lid == MG_SERVER_INFO_LID) { - return msim_process_server_info(session, msg); - } else if (dsn == MG_WEB_CHALLENGE_DSN && lid == MG_WEB_CHALLENGE_LID) { - return msim_web_challenge(session, msg); - } - } - - /* If a callback is registered for this userid lookup, call it. */ - cb = g_hash_table_lookup(session->user_lookup_cb, GUINT_TO_POINTER(rid)); - data = g_hash_table_lookup(session->user_lookup_cb_data, GUINT_TO_POINTER(rid)); - - if (cb) { - purple_debug_info("msim", "msim_process_reply: calling callback now\n"); - /* Clone message, so that the callback 'cb' can use it (needs to free it also). */ - cb(session, msg, data); - g_hash_table_remove(session->user_lookup_cb, GUINT_TO_POINTER(rid)); - g_hash_table_remove(session->user_lookup_cb_data, GUINT_TO_POINTER(rid)); - } else { - purple_debug_info("msim", - "msim_process_reply: no callback for rid %d\n", rid); - } - - return TRUE; -} - -/** - * Handle an error from the server. - * - * @param session - * @param msg The message. - * - * @return TRUE if successfully reported error. - */ -static gboolean -msim_error(MsimSession *session, MsimMessage *msg) -{ - gchar *errmsg, *full_errmsg; - guint err; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - err = msim_msg_get_integer(msg, "err"); - errmsg = msim_msg_get_string(msg, "errmsg"); - - full_errmsg = g_strdup_printf(_("Protocol error, code %d: %s"), err, - errmsg ? errmsg : "no 'errmsg' given"); - - g_free(errmsg); - - purple_debug_info("msim", "msim_error (sesskey=%d): %s\n", - session->sesskey, full_errmsg); - - /* Destroy session if fatal. */ - if (msim_msg_get(msg, "fatal")) { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - purple_debug_info("msim", "fatal error, closing\n"); - - switch (err) { - case MSIM_ERROR_INCORRECT_PASSWORD: /* Incorrect password */ - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); -#ifdef MSIM_MAX_PASSWORD_LENGTH - if (session->account->password && (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH)) { - gchar *suggestion; - - suggestion = g_strdup_printf(_("%s Your password is " - "%zu characters, which is longer than the " - "maximum length of %d. Please shorten your " - "password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."), - full_errmsg, - strlen(session->account->password), - MSIM_MAX_PASSWORD_LENGTH); - - /* Replace full_errmsg. */ - g_free(full_errmsg); - full_errmsg = suggestion; - } else { - g_free(full_errmsg); - full_errmsg = g_strdup(_("Incorrect username or password")); - } -#endif - break; - case MSIM_ERROR_LOGGED_IN_ELSEWHERE: /* Logged in elsewhere */ - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); - break; - } - purple_connection_error_reason(session->gc, reason, full_errmsg); - } else { - purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL); - } - - g_free(full_errmsg); - - return TRUE; -} - -/** - * Process a message. - * - * @param session - * @param msg A message from the server, ready for processing (possibly with resolved username information attached). Caller frees. - * - * @return TRUE if successful. FALSE if processing failed. - */ -static gboolean -msim_process(MsimSession *session, MsimMessage *msg) -{ - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - if (msim_msg_get_integer(msg, "lc") == 1) { - return msim_login_challenge(session, msg); - } else if (msim_msg_get_integer(msg, "lc") == 2) { - /* return msim_we_are_logged_on(session, msg); */ - if (msim_is_username_set(session, msg)) { - return msim_we_are_logged_on(session); - } else { - /* No username is set... We'll wait for the callbacks to do their work */ - /* When they're all done, the last one will call msim_we_are_logged_on() and pick up where we left off */ - return FALSE; - } - } else if (msim_msg_get(msg, "bm")) { - return msim_incoming_bm(session, msg); - } else if (msim_msg_get(msg, "rid")) { - return msim_process_reply(session, msg); - } else if (msim_msg_get(msg, "error")) { - return msim_error(session, msg); - } else if (msim_msg_get(msg, "ka")) { - return TRUE; - } else { - msim_unrecognized(session, msg, "in msim_process"); - return FALSE; - } -} - -/** - * After a uid is resolved to username, tag it with the username and submit for processing. - * - * @param session - * @param userinfo Response messsage to resolving request. - * @param data MsimMessage *, the message to attach information to. - */ -static void -msim_incoming_resolved(MsimSession *session, const MsimMessage *userinfo, - gpointer data) -{ - gchar *username; - MsimMessage *msg, *body; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - g_return_if_fail(userinfo != NULL); - - body = msim_msg_get_dictionary(userinfo, "body"); - g_return_if_fail(body != NULL); - - username = msim_msg_get_string(body, "UserName"); - g_return_if_fail(username != NULL); - /* Note: username will be owned by 'msg' below. */ - - msg = (MsimMessage *)data; - g_return_if_fail(msg != NULL); - - /* TODO: more elegant solution than below. attach whole message? */ - /* Special elements name beginning with '_', we'll use internally within the - * program (did not come directly from the wire). */ - msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, username); /* This makes 'msg' the owner of 'username' */ - - /* TODO: attach more useful information, like ImageURL */ - - msim_process(session, msg); - - msim_msg_free(msg); - msim_msg_free(body); -} - -/** - * Preprocess incoming messages, resolving as needed, calling - * msim_process() when ready to process. - * - * @param session - * @param msg MsimMessage *, freed by caller. - */ -static gboolean -msim_preprocess_incoming(MsimSession *session, MsimMessage *msg) -{ - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - if (msim_msg_get(msg, "bm") && msim_msg_get(msg, "f")) { - guint uid; - const gchar *username; - - /* 'f' = userid message is from, in buddy messages */ - uid = msim_msg_get_integer(msg, "f"); - - username = msim_uid2username_from_blist(session->account, uid); - - if (username) { - /* Know username already, use it. */ - purple_debug_info("msim", "msim_preprocess_incoming: tagging with _username=%s\n", - username); - msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, g_strdup(username)); - return msim_process(session, msg); - - } else { - gchar *from; - - /* Send lookup request. */ - /* XXX: where is msim_msg_get_string() freed? make _strdup and _nonstrdup. */ - purple_debug_info("msim", "msim_incoming: sending lookup, setting up callback\n"); - from = msim_msg_get_string(msg, "f"); - msim_lookup_user(session, from, msim_incoming_resolved, msim_msg_clone(msg)); - g_free(from); - - /* indeterminate */ - return TRUE; - } - } else { - /* Nothing to resolve - send directly to processing. */ - return msim_process(session, msg); - } -} - -/** - * Callback when input available. - * - * @param gc_uncasted A PurpleConnection pointer. - * @param source File descriptor. - * @param cond PURPLE_INPUT_READ - * - * Reads the input, and calls msim_preprocess_incoming() to handle it. - */ -static void -msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc; - PurpleAccount *account; - MsimSession *session; - gchar *end; - int n; - - g_return_if_fail(gc_uncasted != NULL); - g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */ - - gc = (PurpleConnection *)(gc_uncasted); - account = purple_connection_get_account(gc); - session = gc->proto_data; - - /* libpurple/eventloop.h only defines these two */ - if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { - purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid input condition")); - return; - } - - g_return_if_fail(cond == PURPLE_INPUT_READ); - g_return_if_fail(MSIM_SESSION_VALID(session)); - - /* Mark down that we got data, so we don't timeout. */ - session->last_comm = time(NULL); - - /* If approaching end of buffer, reallocate some more memory. */ - if (session->rxsize < session->rxoff + MSIM_READ_BUF_SIZE) { - purple_debug_info("msim", - "msim_input_cb: %d-byte read buffer full, rxoff=%d, " "growing by %d bytes\n", - session->rxsize, session->rxoff, MSIM_READ_BUF_SIZE); - session->rxsize += MSIM_READ_BUF_SIZE; - session->rxbuf = g_realloc(session->rxbuf, session->rxsize); - - return; - } - - purple_debug_info("msim", "dynamic buffer at %d (max %d), reading up to %d\n", - session->rxoff, session->rxsize, - MSIM_READ_BUF_SIZE - session->rxoff - 1); - - /* Read into buffer. On Win32, need recv() not read(). session->fd also holds - * the file descriptor, but it sometimes differs from the 'source' parameter. - */ - n = recv(session->fd, - session->rxbuf + session->rxoff, - session->rxsize - session->rxoff - 1, 0); - - if (n < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (n == 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - /* Null terminate */ - purple_debug_info("msim", "msim_input_cb: going to null terminate " - "at n=%d\n", n); - session->rxbuf[session->rxoff + n] = 0; - -#ifdef MSIM_CHECK_EMBEDDED_NULLS - /* Check for embedded NULs. I don't handle them, and they shouldn't occur. */ - if (strlen(session->rxbuf + session->rxoff) != n) { - /* Occurs after login, but it is not a null byte. */ - purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" - "--null byte encountered?\n", - strlen(session->rxbuf + session->rxoff), n); - /*purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - "Invalid message - null byte on input"); */ - return; - } -#endif - - session->rxoff += n; - purple_debug_info("msim", "msim_input_cb: read=%d\n", n); - -#ifdef MSIM_DEBUG_RXBUF - purple_debug_info("msim", "buf=<%s>\n", session->rxbuf); -#endif - - /* Look for \\final\\ end markers. If found, process message. */ - while((end = strstr(session->rxbuf, MSIM_FINAL_STRING))) { - MsimMessage *msg; - -#ifdef MSIM_DEBUG_RXBUF - purple_debug_info("msim", "in loop: buf=<%s>\n", session->rxbuf); -#endif - *end = 0; - msg = msim_parse(session->rxbuf); - if (!msg) { - purple_debug_info("msim", "msim_input_cb: couldn't parse rxbuf\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to parse message")); - break; - } else { - /* Process message and then free it (processing function should - * clone message if it wants to keep it afterwards.) */ - if (!msim_preprocess_incoming(session, msg)) { - msim_msg_dump("msim_input_cb: preprocessing message failed on msg: %s\n", msg); - } - msim_msg_free(msg); - } - - /* Move remaining part of buffer to beginning. */ - session->rxoff -= strlen(session->rxbuf) + strlen(MSIM_FINAL_STRING); - memmove(session->rxbuf, end + strlen(MSIM_FINAL_STRING), - session->rxsize - (end + strlen(MSIM_FINAL_STRING) - session->rxbuf)); - - /* Clear end of buffer - * memset(end, 0, MSIM_READ_BUF_SIZE - (end - session->rxbuf)); - */ - } -} - -/** - * Callback when connected. Sets up input handlers. - * - * @param data A PurpleConnection pointer. - * @param source File descriptor. - * @param error_message - */ -static void -msim_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc; - MsimSession *session; - - g_return_if_fail(data != NULL); - - gc = (PurpleConnection *)data; - session = (MsimSession *)gc->proto_data; - - if (source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - session->fd = source; - - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc); -} - -/** - * Start logging in to the MSIM servers. - * - * @param acct Account information to use to login. - */ -static void -msim_login(PurpleAccount *acct) -{ - PurpleConnection *gc; - const gchar *host; - int port; - - g_return_if_fail(acct != NULL); - g_return_if_fail(acct->username != NULL); - - purple_debug_info("msim", "logging in %s\n", acct->username); - - gc = purple_account_get_connection(acct); - gc->proto_data = msim_session_new(acct); - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC; - - /* - * Lets wipe out our local list of blocked buddies. We'll get a - * list of all blocked buddies from the server, and we shouldn't - * have stuff in the local list that isn't on the server list. - */ - while (acct->deny != NULL) - purple_privacy_deny_remove(acct, acct->deny->data, TRUE); - - /* 1. connect to server */ - purple_connection_update_progress(gc, _("Connecting"), - 0, /* which connection step this is */ - 4); /* total number of steps */ - - host = purple_account_get_string(acct, "server", MSIM_SERVER); - port = purple_account_get_int(acct, "port", MSIM_PORT); - - /* From purple.sf.net/api: - * """Note that this function name can be misleading--although it is called - * "proxy connect," it is used for establishing any outgoing TCP connection, - * whether through a proxy or not.""" */ - - /* Calls msim_connect_cb when connected. */ - if (!purple_proxy_connect(gc, acct, host, port, msim_connect_cb, gc)) { - /* TODO: try other ports if in auto mode, then save - * working port and try that first next time. */ - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } -} - -/** - * Close the connection. - * - * @param gc The connection. - */ -static void -msim_close(PurpleConnection *gc) -{ - MsimSession *session; - - if (gc == NULL) { - return; - } - - session = (MsimSession *)gc->proto_data; - if (session == NULL) - return; - - gc->proto_data = NULL; - - if (!MSIM_SESSION_VALID(session)) { - return; - } - - if (session->gc->inpa) { - purple_input_remove(session->gc->inpa); - } - if (session->fd >= 0) { - close(session->fd); - session->fd = -1; - } - - msim_session_destroy(session); -} - -/** - * Schedule an IM to be sent once the user ID is looked up. - * - * @param gc Connection. - * @param who A user id, email, or username to send the message to. - * @param message Instant message text to send. - * @param flags Flags. - * - * @return 1 if successful or postponed, -1 if failed - * - * Allows sending to a user by username, email address, or userid. If - * a username or email address is given, the userid must be looked up. - * This function does that by calling msim_postprocess_outgoing(). - */ -static int -msim_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, - PurpleMessageFlags flags) -{ - MsimSession *session; - gchar *message_msim; - int rc; - - g_return_val_if_fail(gc != NULL, -1); - g_return_val_if_fail(who != NULL, -1); - g_return_val_if_fail(message != NULL, -1); - - /* 'flags' has many options, not used here. */ - - session = (MsimSession *)gc->proto_data; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), -1); - - message_msim = html_to_msim_markup(session, message); - - if (msim_send_bm(session, who, message_msim, MSIM_BM_ACTION_OR_IM_DELAYABLE)) { - /* Return 1 to have Purple show this IM as being sent, 0 to not. I always - * return 1 even if the message could not be sent, since I don't know if - * it has failed yet--because the IM is only sent after the userid is - * retrieved from the server (which happens after this function returns). - * If an error does occur, it should be logged to the IM window. - */ - rc = 1; - } else { - rc = -1; - } - - g_free(message_msim); - - return rc; -} - -/** - * Handle when our user starts or stops typing to another user. - * - * @param gc - * @param name The buddy name to which our user is typing to - * @param state PURPLE_TYPING, PURPLE_TYPED, PURPLE_NOT_TYPING - * - * @return 0 - */ -static unsigned int -msim_send_typing(PurpleConnection *gc, const gchar *name, - PurpleTypingState state) -{ - const gchar *typing_str; - MsimSession *session; - - g_return_val_if_fail(gc != NULL, 0); - g_return_val_if_fail(name != NULL, 0); - - session = (MsimSession *)gc->proto_data; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), 0); - - switch (state) { - case PURPLE_TYPING: - typing_str = "%typing%"; - break; - - case PURPLE_TYPED: - case PURPLE_NOT_TYPING: - default: - typing_str = "%stoptyping%"; - break; - } - - purple_debug_info("msim", "msim_send_typing(%s): %d (%s)\n", name, state, typing_str); - msim_send_bm(session, name, typing_str, MSIM_BM_ACTION_OR_IM_INSTANT); - return 0; -} - -/** - * Callback for msim_get_info(), for when user info is received. - */ -static void -msim_get_info_cb(MsimSession *session, const MsimMessage *user_info_msg, - gpointer data) -{ - MsimMessage *msg; - gchar *username; - PurpleNotifyUserInfo *user_info; - MsimUser *user; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - /* Get user{name,id} from msim_get_info, passed as an MsimMessage for - orthogonality. */ - msg = (MsimMessage *)data; - g_return_if_fail(msg != NULL); - - username = msim_msg_get_string(msg, "user"); - if (!username) { - purple_debug_info("msim", "msim_get_info_cb: no 'user' in msg\n"); - return; - } - - msim_msg_free(msg); - purple_debug_info("msim", "msim_get_info_cb: got for user: %s\n", username); - - user = msim_find_user(session, username); - - if (!user) { - /* User isn't on blist, create a temporary user to store info. */ - user = g_new0(MsimUser, 1); - user->temporary_user = TRUE; - } - - /* Update user structure with new information */ - msim_store_user_info(session, user_info_msg, user); - - user_info = purple_notify_user_info_new(); - - /* Append data from MsimUser to PurpleNotifyUserInfo for display, full */ - msim_append_user_info(session, user_info, user, TRUE); - - purple_notify_userinfo(session->gc, username, user_info, NULL, NULL); - purple_debug_info("msim", "msim_get_info_cb: username=%s\n", username); - - purple_notify_user_info_destroy(user_info); - - if (user->temporary_user) { - g_free(user->client_info); - g_free(user->gender); - g_free(user->location); - g_free(user->headline); - g_free(user->display_name); - g_free(user->username); - g_free(user->image_url); - g_free(user); - } - g_free(username); -} - -/** - * Retrieve a user's profile. - * @param username Username, user ID, or email address to lookup. - */ -static void -msim_get_info(PurpleConnection *gc, const gchar *username) -{ - MsimSession *session; - MsimUser *user; - gchar *user_to_lookup; - MsimMessage *user_msg; - - g_return_if_fail(gc != NULL); - g_return_if_fail(username != NULL); - - session = (MsimSession *)gc->proto_data; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - /* Obtain uid of buddy. */ - user = msim_find_user(session, username); - - /* If is on buddy list, lookup by uid since it is faster. */ - if (user && user->id) { - user_to_lookup = g_strdup_printf("%d", user->id); - } else { - /* Looking up buddy not on blist. Lookup by whatever user entered. */ - user_to_lookup = g_strdup(username); - } - - /* Pass the username to msim_get_info_cb(), because since we lookup - * by userid, the userinfo message will only contain the uid (not - * the username) but it would be useful to display the username too. - */ - user_msg = msim_msg_new( - "user", MSIM_TYPE_STRING, g_strdup(username), - NULL); - purple_debug_info("msim", "msim_get_info, setting up lookup, user=%s\n", username); - - msim_lookup_user(session, user_to_lookup, msim_get_info_cb, user_msg); - - g_free(user_to_lookup); -} - -/** - * Set status using an MSIM_STATUS_CODE_* value. - * @param status_code An MSIM_STATUS_CODE_* value. - * @param statstring Status string, must be a dynamic string (will be freed by msim_send). - */ -static void -msim_set_status_code(MsimSession *session, guint status_code, gchar *statstring) -{ - g_return_if_fail(MSIM_SESSION_VALID(session)); - g_return_if_fail(statstring != NULL); - - purple_debug_info("msim", "msim_set_status_code: going to set status to code=%d,str=%s\n", - status_code, statstring); - - if (!msim_send(session, - "status", MSIM_TYPE_INTEGER, status_code, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "statstring", MSIM_TYPE_STRING, statstring, - "locstring", MSIM_TYPE_STRING, g_strdup(""), - NULL)) - { - purple_debug_info("msim", "msim_set_status: failed to set status\n"); - } -} - -/** - * Set your status - callback for when user manually sets it. - */ -static void -msim_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleStatusType *type; - PurplePresence *pres; - MsimSession *session; - guint status_code; - const gchar *message; - gchar *stripped; - gchar *unrecognized_msg; - - session = (MsimSession *)account->gc->proto_data; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - type = purple_status_get_type(status); - pres = purple_status_get_presence(status); - - switch (purple_status_type_get_primitive(type)) { - case PURPLE_STATUS_AVAILABLE: - purple_debug_info("msim", "msim_set_status: available (%d->%d)\n", PURPLE_STATUS_AVAILABLE, - MSIM_STATUS_CODE_ONLINE); - status_code = MSIM_STATUS_CODE_ONLINE; - break; - - case PURPLE_STATUS_INVISIBLE: - purple_debug_info("msim", "msim_set_status: invisible (%d->%d)\n", PURPLE_STATUS_INVISIBLE, - MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN); - status_code = MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN; - break; - - case PURPLE_STATUS_AWAY: - purple_debug_info("msim", "msim_set_status: away (%d->%d)\n", PURPLE_STATUS_AWAY, - MSIM_STATUS_CODE_AWAY); - status_code = MSIM_STATUS_CODE_AWAY; - break; - - default: - purple_debug_info("msim", "msim_set_status: unknown " - "status interpreting as online"); - status_code = MSIM_STATUS_CODE_ONLINE; - - unrecognized_msg = g_strdup_printf("msim_set_status, unrecognized status type: %d\n", - purple_status_type_get_primitive(type)); - msim_unrecognized(session, NULL, unrecognized_msg); - g_free(unrecognized_msg); - - break; - } - - message = purple_status_get_attr_string(status, "message"); - - /* Status strings are plain text. */ - if (message != NULL) - stripped = purple_markup_strip_html(message); - else - stripped = g_strdup(""); - - msim_set_status_code(session, status_code, stripped); - - /* If we should be idle, set that status. Time is irrelevant here. */ - if (purple_presence_is_idle(pres) && status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN) - msim_set_idle(account->gc, 1); -} - -/** - * Go idle. - */ -static void -msim_set_idle(PurpleConnection *gc, int time) -{ - MsimSession *session; - PurpleStatus *status; - - g_return_if_fail(gc != NULL); - - session = (MsimSession *)gc->proto_data; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - status = purple_account_get_active_status(session->account); - - if (time == 0) { - /* Going back from idle. In msim, idle is mutually exclusive - * from the other states (you can only be away or idle, but not - * both, for example), so by going non-idle I go back to what - * libpurple says I should be. - */ - msim_set_status(session->account, status); - } else { - const gchar *message; - gchar *stripped; - - /* Set the idle message to the status message from the real - * current status. - */ - message = purple_status_get_attr_string(status, "message"); - if (message != NULL) - stripped = purple_markup_strip_html(message); - else - stripped = g_strdup(""); - - /* msim doesn't support idle time, so just go idle */ - msim_set_status_code(session, MSIM_STATUS_CODE_IDLE, stripped); - } -} - -/** - * @return TRUE if everything was ok, FALSE if something went awry. - */ -static gboolean -msim_update_blocklist_for_buddy(MsimSession *session, const char *name, gboolean allow, gboolean block) -{ - MsimMessage *msg; - GList *list; - - list = NULL; - list = g_list_prepend(list, allow ? "a+" : "a-"); - list = g_list_prepend(list, ""); - list = g_list_prepend(list, block ? "b+" : "b-"); - list = g_list_prepend(list, ""); - list = g_list_reverse(list); - - msg = msim_msg_new( - "blocklist", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* TODO: MsimMessage lists. Currently isn't replaced in lists. */ - /* "idlist", MSIM_TYPE_STRING, g_strdup("a-||b-|"), */ - "idlist", MSIM_TYPE_LIST, list, - NULL); - - if (!msim_postprocess_outgoing(session, msg, name, "idlist", NULL)) { - purple_debug_error("myspace", - "blocklist command failed for %s, allow=%d, block=%d\n", - name, allow, block); - msim_msg_free(msg); - return FALSE; - } - - msim_msg_free(msg); - - return TRUE; -} - -/** - * Add a buddy to user's buddy list. - */ -static void -msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsimSession *session; - MsimMessage *msg; - MsimMessage *msg_persist; - MsimMessage *body; - const char *name, *gname; - - session = (MsimSession *)gc->proto_data; - name = purple_buddy_get_name(buddy); - gname = group ? purple_group_get_name(group) : NULL; - - if (msim_get_user_from_buddy(buddy, FALSE) != NULL) - return; - - purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", - name, gname ? gname : "(no group)"); - - msg = msim_msg_new( - "addbuddy", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* "newprofileid" will be inserted here with uid. */ - "reason", MSIM_TYPE_STRING, g_strdup(""), - NULL); - - if (!msim_postprocess_outgoing(session, msg, name, "newprofileid", "reason")) { - purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed.")); - msim_msg_free(msg); - return; - } - msim_msg_free(msg); - - /* TODO: if addbuddy fails ('error' message is returned), delete added buddy from - * buddy list since Purple adds it locally. */ - - body = msim_msg_new( - "ContactID", MSIM_TYPE_STRING, g_strdup(""), - "GroupName", MSIM_TYPE_STRING, g_strdup(gname), - "Position", MSIM_TYPE_INTEGER, 1000, - "Visibility", MSIM_TYPE_INTEGER, 1, - "NickName", MSIM_TYPE_STRING, g_strdup(""), - "NameSelect", MSIM_TYPE_INTEGER, 0, - NULL); - - /* TODO: Update blocklist. */ - - msg_persist = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, - /* TODO: Use msim_new_reply_callback to get rid. */ - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - - if (!msim_postprocess_outgoing(session, msg_persist, name, "body", NULL)) - { - purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); - msim_msg_free(msg_persist); - return; - } - msim_msg_free(msg_persist); - - /* Add to allow list, remove from block list */ - msim_update_blocklist_for_buddy(session, name, TRUE, FALSE); -} - -static void -msim_buddy_free(PurpleBuddy *buddy) -{ - msim_user_free(purple_buddy_get_protocol_data(buddy)); - purple_buddy_set_protocol_data(buddy, NULL); -} - -/** - * Remove a buddy from the user's buddy list. - */ -static void -msim_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsimSession *session; - MsimMessage *delbuddy_msg; - MsimMessage *persist_msg; - const char *name; - - session = (MsimSession *)gc->proto_data; - name = purple_buddy_get_name(buddy); - - delbuddy_msg = msim_msg_new( - "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* 'delprofileid' with uid will be inserted here. */ - NULL); - - if (!msim_postprocess_outgoing(session, delbuddy_msg, name, "delprofileid", NULL)) { - purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("'delbuddy' command failed")); - msim_msg_free(delbuddy_msg); - return; - } - msim_msg_free(delbuddy_msg); - - persist_msg = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_DELETE, - "dsn", MSIM_TYPE_INTEGER, MD_DELETE_BUDDY_DSN, - "lid", MSIM_TYPE_INTEGER, MD_DELETE_BUDDY_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - /* will be replaced by postprocessing */ - "body", MSIM_TYPE_STRING, g_strdup("ContactID="), - NULL); - - if (!msim_postprocess_outgoing(session, persist_msg, name, "body", NULL)) { - purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("persist command failed")); - msim_msg_free(persist_msg); - return; - } - msim_msg_free(persist_msg); - - /* - * Remove from our approve list and from our block list (this - * doesn't seem like it would be necessary, but the official client - * does it) - */ - if (!msim_update_blocklist_for_buddy(session, name, FALSE, FALSE)) { - purple_notify_error(NULL, NULL, - _("Failed to remove buddy"), _("blocklist command failed")); - return; - } - msim_buddy_free(buddy); -} - -/** - * Remove a buddy from the user's buddy list and add them to the block list. - */ -static void -msim_add_deny(PurpleConnection *gc, const char *name) -{ - MsimSession *session; - MsimMessage *msg, *body; - - session = (MsimSession *)gc->proto_data; - - /* Remove from buddy list */ - msg = msim_msg_new( - "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* 'delprofileid' with uid will be inserted here. */ - NULL); - if (!msim_postprocess_outgoing(session, msg, name, "delprofileid", NULL)) - purple_debug_error("myspace", "delbuddy command failed\n"); - msim_msg_free(msg); - - /* Remove from our approve list and add to our block list */ - msim_update_blocklist_for_buddy(session, name, FALSE, TRUE); - - /* - * Add the buddy to our list of blocked contacts, so we know they - * are blocked if we log in with another client - */ - body = msim_msg_new( - "ContactID", MSIM_TYPE_STRING, g_strdup(""), - "Visibility", MSIM_TYPE_INTEGER, 2, - NULL); - msg = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - if (!msim_postprocess_outgoing(session, msg, name, "body", NULL)) - purple_debug_error("myspace", "add to block list command failed\n"); - msim_msg_free(msg); - - /* - * TODO: MySpace doesn't allow blocked buddies on our buddy list, - * do they? If not then we need to remove the buddy from - * libpurple's buddy list. - */ -} - -/** - * Remove a buddy from the user's block list. - */ -static void -msim_rem_deny(PurpleConnection *gc, const char *name) -{ - MsimSession *session; - MsimMessage *msg, *body; - - session = (MsimSession *)gc->proto_data; - - /* - * Remove from our list of blocked contacts, so we know they - * are no longer blocked if we log in with another client - */ - body = msim_msg_new( - "ContactID", MSIM_TYPE_STRING, g_strdup(""), - NULL); - msg = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_DELETE, - "dsn", MSIM_TYPE_INTEGER, MC_DELETE_CONTACT_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MC_DELETE_CONTACT_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - if (!msim_postprocess_outgoing(session, msg, name, "body", NULL)) - purple_debug_error("myspace", "remove from block list command failed\n"); - msim_msg_free(msg); - - /* Remove from our approve list and our block list */ - msim_update_blocklist_for_buddy(session, name, FALSE, FALSE); -} - -/** - * Returns a string of a username in canonical form. Basically removes all the - * spaces, lowercases the string, and looks up user IDs to usernames. - * Normalizing tom, TOM, Tom, and 6221 wil all return 'tom'. - * - * Borrowed this code from oscar_normalize. Added checking for - * "if userid, get name before normalizing" - */ -static const char *msim_normalize(const PurpleAccount *account, const char *str) { - static char normalized[BUF_LEN]; - char *tmp1, *tmp2; - int i, j; - guint id; - - g_return_val_if_fail(str != NULL, NULL); - - if (msim_is_userid(str)) { - /* Have user ID, we need to get their username first :) */ - const char *username; - - /* If the account does not exist, we can't look up the user. */ - if (!account || !account->gc) - return str; - - id = atol(str); - username = msim_uid2username_from_blist((PurpleAccount *)account, id); - if (!username) { - /* Not in buddy list... scheisse... TODO: Manual Lookup! Bug #4631 */ - /* Note: manual lookup using msim_lookup_user() is a problem inside - * msim_normalize(), because msim_lookup_user() calls a callback function - * when the user information has been looked up, but msim_normalize() expects - * the result immediately. */ - strncpy(normalized, str, BUF_LEN); - } else { - strncpy(normalized, username, BUF_LEN); - } - } else { - /* Have username. */ - strncpy(normalized, str, BUF_LEN); - } - - /* Strip spaces. */ - for (i=0, j=0; normalized[j]; j++) { - if (normalized[j] != ' ') - normalized[i++] = normalized[j]; - } - normalized[i] = '\0'; - - /* Lowercase and perform UTF-8 normalization. */ - tmp1 = g_utf8_strdown(normalized, -1); - tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT); - g_snprintf(normalized, sizeof(normalized), "%s", tmp2); - g_free(tmp2); - g_free(tmp1); - - /* TODO: re-add caps and spacing back to what the user wanted. - * User can format their own names, for example 'msimprpl' is shown - * as 'MsIm PrPl' in the official client. - * - * TODO: file a ticket to add this enhancement. - */ - - return normalized; -} - -/** - * Return whether the buddy can be messaged while offline. - * - * The protocol supports offline messages in just the same way as online - * messages. - */ -static gboolean -msim_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -/** - * Send raw data to the server, possibly with embedded NULs. - * - * Used in prpl_info struct, so that plugins can have the most possible - * control of what is sent over the connection. Inside this prpl, - * msim_send_raw() is used, since it sends NUL-terminated strings (easier). - * - * @param gc PurpleConnection - * @param buf Buffer to send - * @param total_bytes Size of buffer to send - * - * @return Bytes successfully sent, or -1 on error. - */ -/* - * TODO: This needs to do non-blocking writes and use a watcher to check - * when the fd is available to be written to. - */ -static int -msim_send_really_raw(PurpleConnection *gc, const char *buf, int total_bytes) -{ - int total_bytes_sent; - MsimSession *session; - - g_return_val_if_fail(gc != NULL, -1); - g_return_val_if_fail(buf != NULL, -1); - g_return_val_if_fail(total_bytes >= 0, -1); - - session = (MsimSession *)gc->proto_data; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), -1); - - /* Loop until all data is sent, or a failure occurs. */ - total_bytes_sent = 0; - do { - int bytes_sent; - - bytes_sent = send(session->fd, buf + total_bytes_sent, - total_bytes - total_bytes_sent, 0); - - if (bytes_sent < 0) { - purple_debug_info("msim", "msim_send_raw(%s): send() failed: %s\n", - buf, g_strerror(errno)); - return total_bytes_sent; - } - total_bytes_sent += bytes_sent; - - } while(total_bytes_sent < total_bytes); - - return total_bytes_sent; -} - -/** - * Send raw data (given as a NUL-terminated string) to the server. - * - * @param session - * @param msg The raw data to send, in a NUL-terminated string. - * - * @return TRUE if succeeded, FALSE if not. - * - */ -gboolean -msim_send_raw(MsimSession *session, const gchar *msg) -{ - size_t len; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - purple_debug_info("msim", "msim_send_raw: writing <%s>\n", msg); - len = strlen(msg); - - return msim_send_really_raw(session->gc, msg, len) == len; -} - -static GHashTable * -msim_get_account_text_table(PurpleAccount *unused) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} - -/** - * Callbacks called by Purple, to access this plugin. - */ -static PurplePluginProtocolInfo prpl_info = { - /* options */ - OPT_PROTO_USE_POINTSIZE /* specify font size in sane point size */ - | OPT_PROTO_MAIL_CHECK, - - /* | OPT_PROTO_IM_IMAGE - TODO: direct images. */ - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec - TODO: eventually should add this */ - msim_list_icon, /* list_icon */ - NULL, /* list_emblems */ - msim_status_text, /* status_text */ - msim_tooltip_text, /* tooltip_text */ - msim_status_types, /* status_types */ - msim_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - msim_login, /* login */ - msim_close, /* close */ - msim_send_im, /* send_im */ - NULL, /* set_info */ - msim_send_typing, /* send_typing */ - msim_get_info, /* get_info */ - msim_set_status, /* set_status */ - msim_set_idle, /* set_idle */ - NULL, /* change_passwd */ - msim_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - msim_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - msim_add_deny, /* add_deny */ - NULL, /* rem_permit */ - msim_rem_deny, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - msim_buddy_free, /* buddy_free */ - NULL, /* convo_closed */ - msim_normalize, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - msim_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - msim_send_really_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - msim_send_attention, /* send_attention */ - msim_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - msim_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -/** - * Load the plugin. - */ -static gboolean -msim_load(PurplePlugin *plugin) -{ - /* If compiled to use RC4 from libpurple, check if it is really there. */ - if (!purple_ciphers_find_cipher("rc4")) { - purple_debug_error("msim", "rc4 not in libpurple, but it is required - not loading MySpaceIM plugin!\n"); - purple_notify_error(plugin, _("Missing Cipher"), - _("The RC4 cipher could not be found"), - _("Upgrade " - "to a libpurple with RC4 support (>= 2.0.1). MySpaceIM " - "plugin will not be loaded.")); - return FALSE; - } - return TRUE; -} - -/** - * Called when friends have been imported to buddy list on server. - */ -static void -msim_import_friends_cb(MsimSession *session, const MsimMessage *reply, gpointer user_data) -{ - MsimMessage *body; - gchar *completed; - - /* Check if the friends were imported successfully. */ - body = msim_msg_get_dictionary(reply, "body"); - g_return_if_fail(body != NULL); - completed = msim_msg_get_string(body, "Completed"); - msim_msg_free(body); - g_return_if_fail(completed != NULL); - if (!g_str_equal(completed, "True")) - { - purple_debug_info("msim_import_friends_cb", - "failed to import friends: %s", completed); - purple_notify_error(session->account, _("Add friends from MySpace.com"), - _("Importing friends failed"), NULL); - g_free(completed); - return; - } - g_free(completed); - - purple_debug_info("msim_import_friends_cb", - "added friends to server-side buddy list, requesting new contacts from server"); - - msim_get_contact_list(session, MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS); - - /* TODO: show, X friends have been added */ -} - -/** - * Import friends from myspace.com. - */ -static void msim_import_friends(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsimSession *session; - gchar *group_name; - - gc = (PurpleConnection *)action->context; - session = (MsimSession *)gc->proto_data; - - group_name = "MySpace Friends"; - - g_return_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_IMPORT_ALL_FRIENDS_DSN, - "lid", MSIM_TYPE_INTEGER, MC_IMPORT_ALL_FRIENDS_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, - msim_new_reply_callback(session, msim_import_friends_cb, NULL), - "body", MSIM_TYPE_STRING, - g_strdup_printf("GroupName=%s", group_name), - NULL)); -} - -/** - * Actions menu for account. - */ -static GList * -msim_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc; - GList *menu; - PurplePluginAction *act; - - gc = (PurpleConnection *)context; - - menu = NULL; - -#if 0 - /* TODO: find out how */ - act = purple_plugin_action_new(_("Find people..."), msim_); - menu = g_list_append(menu, act); - - act = purple_plugin_action_new(_("Change IM name..."), NULL); - menu = g_list_append(menu, act); -#endif - - act = purple_plugin_action_new(_("Add friends from MySpace.com"), msim_import_friends); - menu = g_list_append(menu, act); - - return menu; -} - -/** - * Based on MSN's plugin info comments. - */ -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-myspace", /**< id */ - "MySpaceIM", /**< name */ - MSIM_PRPL_VERSION_STRING, /**< version */ - /** summary */ - "MySpaceIM Protocol Plugin", - /** description */ - "MySpaceIM Protocol Plugin", - "Jeff Connelly ", /**< author */ - "http://developer.pidgin.im/wiki/MySpaceIM/", /**< homepage */ - - msim_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - msim_actions, /**< msim_actions */ - NULL, /**< reserved1 */ - NULL, /**< reserved2 */ - NULL, /**< reserved3 */ - NULL /**< reserved4 */ -}; - -#ifdef MSIM_SELF_TEST -/* - * Test functions. - * Used to test or try out the internal workings of msimprpl. If you're reading - * this code for the first time, these functions can be instructive in learning - * how msimprpl is architected. - */ - -/** - * Test MsimMessage for basic functionality. - */ -static int -msim_test_msg(void) -{ - MsimMessage *msg, *msg_cloned, *msg2; - GList *list; - gchar *packed, *packed_expected, *packed_cloned; - guint failures; - - failures = 0; - - purple_debug_info("msim", "\n\nTesting MsimMessage\n"); - msg = msim_msg_new(NULL); /* Create a new, empty message. */ - - /* Append some new elements. */ - msg = msim_msg_append(msg, "bx", MSIM_TYPE_BINARY, g_string_new_len("XXX", 3)); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v1")); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(42)); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v43")); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v52/xxx\\yyy")); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v7")); - msim_msg_dump("msg debug str=%s\n", msg); - packed = msim_msg_pack(msg); - - purple_debug_info("msim", "msg packed=%s\n", packed); - - packed_expected = "\\bx\\WFhY\\k1\\v1\\k1\\42\\k1" - "\\v43\\k1\\v52/1xxx/2yyy\\k1\\v7\\final\\"; - - if (!g_str_equal(packed, packed_expected)) { - purple_debug_info("msim", "!!!(%d), msim_msg_pack not what expected: %s != %s\n", - ++failures, packed, packed_expected); - } - - - msg_cloned = msim_msg_clone(msg); - packed_cloned = msim_msg_pack(msg_cloned); - - purple_debug_info("msim", "msg cloned=%s\n", packed_cloned); - if (!g_str_equal(packed, packed_cloned)) { - purple_debug_info("msim", "!!!(%d), msim_msg_pack on cloned message not equal to original: %s != %s\n", - ++failures, packed_cloned, packed); - } - - g_free(packed); - g_free(packed_cloned); - msim_msg_free(msg_cloned); - msim_msg_free(msg); - - /* Try some of the more advanced functionality */ - list = NULL; - - list = g_list_prepend(list, "item3"); - list = g_list_prepend(list, "item2"); - list = g_list_prepend(list, "item1"); - list = g_list_prepend(list, "item0"); - - msg = msim_msg_new(NULL); - msg = msim_msg_append(msg, "string", MSIM_TYPE_STRING, g_strdup("string value")); - msg = msim_msg_append(msg, "raw", MSIM_TYPE_RAW, g_strdup("raw value")); - msg = msim_msg_append(msg, "integer", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(3140)); - msg = msim_msg_append(msg, "boolean", MSIM_TYPE_BOOLEAN, GUINT_TO_POINTER(FALSE)); - msg = msim_msg_append(msg, "list", MSIM_TYPE_LIST, list); - - msim_msg_dump("msg with list=%s\n", msg); - purple_debug_info("msim", "msg with list packed=%s\n", msim_msg_pack(msg)); - - msg2 = msim_msg_new(NULL); - msg2 = msim_msg_append(msg2, "outer", MSIM_TYPE_STRING, g_strdup("outer value")); - msg2 = msim_msg_append(msg2, "body", MSIM_TYPE_DICTIONARY, msg); - msim_msg_dump("msg with dict=%s\n", msg2); /* msg2 now 'owns' msg */ - purple_debug_info("msim", "msg with dict packed=%s\n", msim_msg_pack(msg2)); - - msim_msg_free(msg2); - - return failures; -} - -/** - * Test protocol-level escaping/unescaping. - */ -static int -msim_test_escaping(void) -{ - guint failures; - gchar *raw, *escaped, *unescaped, *expected; - - failures = 0; - - purple_debug_info("msim", "\n\nTesting escaping\n"); - - raw = "hello/world\\hello/world"; - - escaped = msim_escape(raw); - purple_debug_info("msim", "msim_test_escaping: raw=%s, escaped=%s\n", raw, escaped); - expected = "hello/1world/2hello/1world"; - if (!g_str_equal(escaped, expected)) { - purple_debug_info("msim", "!!!(%d), msim_escape failed: %s != %s\n", - ++failures, escaped, expected); - } - - - unescaped = msim_unescape(escaped); - g_free(escaped); - purple_debug_info("msim", "msim_test_escaping: unescaped=%s\n", unescaped); - if (!g_str_equal(raw, unescaped)) { - purple_debug_info("msim", "!!!(%d), msim_unescape failed: %s != %s\n", - ++failures, raw, unescaped); - } - - return failures; -} - -static void -msim_test_all(void) -{ - guint failures; - - failures = 0; - failures += msim_test_msg(); - failures += msim_test_escaping(); - - if (failures) { - purple_debug_info("msim", "msim_test_all HAD FAILURES: %d\n", failures); - } else { - purple_debug_info("msim", "msim_test_all - all tests passed!\n"); - } - exit(0); -} -#endif - -#ifdef MSIM_CHECK_NEWER_VERSION -/** - * Callback for when a currentversion.txt has been downloaded. - */ -static void -msim_check_newer_version_cb(PurpleUtilFetchUrlData *url_data, - gpointer user_data, - const gchar *url_text, - gsize len, - const gchar *error_message) -{ - GKeyFile *keyfile; - GError *error; - GString *data; - gchar *newest_filever; - - if (!url_text) { - purple_debug_info("msim_check_newer_version_cb", - "got error: %s\n", error_message); - return; - } - - purple_debug_info("msim_check_newer_version_cb", - "url_text=%s\n", url_text ? url_text : "(NULL)"); - - /* Prepend [group] so that GKeyFile can parse it (requires a group). */ - data = g_string_new(url_text); - purple_debug_info("msim", "data=%s\n", data->str - ? data->str : "(NULL)"); - data = g_string_prepend(data, "[group]\n"); - - purple_debug_info("msim", "data=%s\n", data->str - ? data->str : "(NULL)"); - - /* url_text is variable=data\n...†*/ - - /* Check FILEVER, 1.0.716.0. 716 is build, MSIM_CLIENT_VERSION */ - /* New (english) version can be downloaded from SETUPURL+SETUPFILE */ - - error = NULL; - keyfile = g_key_file_new(); - - /* Default list seperator is ;, but currentversion.txt doesn't have - * these, so set to an unused character to avoid parsing problems. */ - g_key_file_set_list_separator(keyfile, '\0'); - - g_key_file_load_from_data(keyfile, data->str, data->len, - G_KEY_FILE_NONE, &error); - g_string_free(data, TRUE); - - if (error != NULL) { - purple_debug_info("msim_check_newer_version_cb", - "couldn't parse, error: %d %d %s\n", - error->domain, error->code, error->message); - g_error_free(error); - return; - } - - gchar **ks; - guint n; - ks = g_key_file_get_keys(keyfile, "group", &n, NULL); - purple_debug_info("msim", "n=%d\n", n); - guint i; - for (i = 0; ks[i] != NULL; ++i) - { - purple_debug_info("msim", "%d=%s\n", i, ks[i]); - } - - newest_filever = g_key_file_get_string(keyfile, "group", - "FILEVER", &error); - - purple_debug_info("msim_check_newer_version_cb", - "newest filever: %s\n", newest_filever ? - newest_filever : "(NULL)"); - if (error != NULL) { - purple_debug_info("msim_check_newer_version_cb", - "error: %d %d %s\n", - error->domain, error->code, error->message); - g_error_free(error); - } - - g_key_file_free(keyfile); - - exit(0); -} -#endif - -/** - Handle a myim:addContact command, after username has been looked up. - */ -static void -msim_uri_handler_addContact_cb(MsimSession *session, MsimMessage *userinfo, gpointer data) -{ - MsimMessage *body; - gchar *username; - - body = msim_msg_get_dictionary(userinfo, "body"); - username = msim_msg_get_string(body, "UserName"); - msim_msg_free(body); - - if (!username) { - guint uid; - - uid = msim_msg_get_integer(userinfo, "UserID"); - g_return_if_fail(uid != 0); - - username = g_strdup_printf("%d", uid); - } - - purple_blist_request_add_buddy(session->account, username, _("Buddies"), NULL); - - g_free(username); -} - -/* TODO: move uid->username resolving to IM sending and buddy adding functions, - * so that user can manually add or IM by userid and username automatically - * looked up if possible? */ - -/** - * Handle a myim:sendIM URI command, after username has been looked up. - */ -static void -msim_uri_handler_sendIM_cb(MsimSession *session, MsimMessage *userinfo, gpointer data) -{ - PurpleConversation *conv; - MsimMessage *body; - gchar *username; - - body = msim_msg_get_dictionary(userinfo, "body"); - username = msim_msg_get_string(body, "UserName"); - msim_msg_free(body); - - if (!username) { - guint uid; - - uid = msim_msg_get_integer(userinfo, "UserID"); - g_return_if_fail(uid != 0); - - username = g_strdup_printf("%d", uid); - } - - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, session->account); - if (!conv) { - purple_debug_info("msim_uri_handler", "creating new conversation for %s\n", username); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, username); - } - - /* Just open the window so the user can send an IM. */ - purple_conversation_present(conv); - - g_free(username); -} - -static gboolean -msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) -{ - PurpleAccount *account; - MsimSession *session; - GList *l; - gchar *uid_str, *cid_str; - guint uid, cid; - - if (g_ascii_strcasecmp(proto, "myim")) - return FALSE; - - /* Parameters are case-insensitive. */ - uid_str = g_hash_table_lookup(params, "uid"); - cid_str = g_hash_table_lookup(params, "cid"); - - uid = uid_str ? atol(uid_str) : 0; - cid = cid_str ? atol(cid_str) : 0; - - /* Need a contact. */ - g_return_val_if_fail(cid != 0, FALSE); - - /* TODO: if auto=true, "Add all the people on this page to my IM List!", on - * http://collect.myspace.com/index.cfm?fuseaction=im.friendslist. Don't need a cid. */ - - /* Convert numeric contact ID back to a string. Needed for looking up. Don't just - * directly use cid directly from parameters, because it might not be numeric. - * It is trivial to change this to allow cID to be a username, but that's not how - * the official MySpaceIM client works, so don't provide that functionality. */ - cid_str = g_strdup_printf("%d", cid); - - - /* Find our account with specified user id, or use first connected account if uid=0. */ - account = NULL; - l = purple_accounts_get_all(); - while (l) { - if (purple_account_is_connected(l->data) && - (uid == 0 || purple_account_get_int(l->data, "uid", 0) == uid)) { - account = l->data; - break; - } - l = l->next; - } - - if (!account) { - purple_notify_error(NULL, _("myim URL handler"), - _("No suitable MySpaceIM account could be found to open this myim URL."), - _("Enable the proper MySpaceIM account and try again.")); - g_free(cid_str); - return FALSE; - } - - session = (MsimSession *)account->gc->proto_data; - g_return_val_if_fail(session != NULL, FALSE); - - /* Lookup userid to username. TODO: push this down, to IM sending/contact - * adding functions. */ - - /* myim:sendIM?uID=USERID&cID=CONTACTID */ - if (!g_ascii_strcasecmp(cmd, "sendIM")) { - msim_lookup_user(session, cid_str, (MSIM_USER_LOOKUP_CB)msim_uri_handler_sendIM_cb, NULL); - g_free(cid_str); - return TRUE; - - /* myim:addContact?uID=USERID&cID=CONTACTID */ - } else if (!g_ascii_strcasecmp(cmd, "addContact")) { - msim_lookup_user(session, cid_str, (MSIM_USER_LOOKUP_CB)msim_uri_handler_addContact_cb, NULL); - g_free(cid_str); - return TRUE; - } - - return FALSE; -} - -/** - * Initialize plugin. - */ -static void -init_plugin(PurplePlugin *plugin) -{ -#ifdef MSIM_SELF_TEST - msim_test_all(); - exit(0); -#endif /* MSIM_SELF_TEST */ - - PurpleAccountOption *option; - static gboolean initialized = FALSE; - -#ifdef MSIM_CHECK_NEWER_VERSION - /* PROBLEM: MySpace's servers always return Content-Location, and - * libpurple redirects to it, infinitely, even though it is the same - * location we requested! */ - purple_util_fetch_url("http://im.myspace.com/nsis/currentversion.txt", - FALSE, /* not full URL */ - "MSIMAutoUpdateAgent", /* user agent */ - TRUE, /* use HTTP/1.1 */ - msim_check_newer_version_cb, NULL); -#endif - - /* TODO: default to automatically try different ports. Make the user be - * able to set the first port to try (like LastConnectedPort in Windows client). */ - option = purple_account_option_string_new(_("Connect server"), "server", MSIM_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Connect port"), "port", MSIM_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - -#ifdef MSIM_USER_WANTS_TO_CONFIGURE_STATUS_TEXT - option = purple_account_option_bool_new(_("Show display name in status text"), "show_display_name", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show headline in status text"), "show_headline", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - -#ifdef MSIM_USER_WANTS_TO_DISABLE_EMOTICONS - option = purple_account_option_bool_new(_("Send emoticons"), "emoticons", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - -#ifdef MSIM_USER_REALLY_CARES_ABOUT_PRECISE_FONT_SIZES - option = purple_account_option_int_new(_("Screen resolution (dots per inch)"), "dpi", MSIM_DEFAULT_DPI); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Base font size (points)"), "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - /* Code below only runs once. Based on oscar.c's oscar_init(). */ - if (initialized) - return; - - initialized = TRUE; - - purple_signal_connect(purple_get_core(), "uri-handler", &initialized, - PURPLE_CALLBACK(msim_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(myspace, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/myspace.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -/* MySpaceIM Protocol Plugin, header file - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_MYSPACE_H -#define _MYSPACE_MYSPACE_H - -#include "internal.h" - -/* Other includes */ -#include -#include /* for EAGAIN */ -#include -#include - -#include - -#ifdef _WIN32 -#include "win32dep.h" -#else -/* For recv() and send(); needed to match Win32 */ -#include -#include -#endif - -#include "notify.h" -#include "plugin.h" -#include "accountopt.h" -#include "version.h" -#include "cipher.h" /* for SHA-1 */ -#include "util.h" /* for base64 */ -#include "debug.h" /* for purple_debug_info */ -#include "request.h" /* For dialogs used in setting the username */ -#include "xmlnode.h" -#include "core.h" -#include "conversation.h" /* For late normalization */ - -/* MySpaceIM includes */ -#include "persist.h" -#include "message.h" -#include "session.h" -#include "zap.h" -#include "markup.h" -#include "user.h" - -/* Conditional compilation options */ -/* Send third-party client version? (Recognized by us and Miranda's plugin) */ -/*#define MSIM_SEND_CLIENT_VERSION */ - -/* Debugging options */ -/* Low-level and rarely needed */ -/*#define MSIM_DEBUG_PARSE */ -/*#define MSIM_DEBUG_LOGIN_CHALLENGE*/ -/*#define MSIM_DEBUG_RXBUF */ - -/* Encode unknown HTML tags from IM clients in messages as [tag], instead of - * ignoring. Useful for debugging */ -/*#define MSIM_MARKUP_SHOW_UNKNOWN_TAGS */ - -/* Define to cause init_plugin() to run some tests and print - * the results to the Purple debug log, then exit. Useful to - * run with 'pidgin -d' to see the output. Don't define if - * you want to actually use the plugin! */ -/*#define MSIM_SELF_TEST */ - -/* Constants */ - -/* Maximum length of a password that is acceptable. This is the limit - * on the official client (build 679) and on the 'new password' field at - * http://settings.myspace.com/index.cfm?fuseaction=user.changepassword - * (though curiously, not on the 'current password' field). */ - -/* After login fails, if password is greater than this many characters, - * warn user that it may be too long. */ -#define MSIM_MAX_PASSWORD_LENGTH 10 - -/* Maximum length of usernames, when setting. */ -#define MSIM_MAX_USERNAME_LENGTH 25 - -/* Build version of MySpaceIM to report to servers (1.0.xxx.0) */ -#define MSIM_CLIENT_VERSION 697 - -/* Check for a newer official MySpaceIM client on startup? - * (Mostly useful for developers) */ -/*#define MSIM_CHECK_NEWER_VERSION*/ - -/* Language codes from http://www.microsoft.com/globaldev/reference/oslocversion.mspx */ -#define MSIM_LANGUAGE_ID_ENGLISH 1033 -#define MSIM_LANGUAGE_NAME_ENGLISH "ENGLISH" - -/* msimprpl version string of this plugin */ -#define MSIM_PRPL_VERSION_STRING "0.18" - -/* Default server */ -#define MSIM_SERVER "im.myspace.akadns.net" -#define MSIM_PORT 1863 /* TODO: alternate ports and automatic */ - -/* Time between keepalives (seconds) - if no data within this time, is dead. */ -#define MSIM_KEEPALIVE_INTERVAL (3 * 60) -/*#define MSIM_USE_KEEPALIVE*/ - -/* Time to check if alive (seconds) */ -#define MSIM_KEEPALIVE_INTERVAL_CHECK 30 - -/* Time to check for new mail (milliseconds) */ -#define MSIM_MAIL_INTERVAL_CHECK (60 * 1000) - -/* Constants */ -#define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */ -#define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ -#define MSIM_READ_BUF_SIZE (15 * 1024) /**< Receive buffer size */ -#define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ - -/* Messages */ -#define MSIM_BM_ACTION_OR_IM_DELAYABLE 1 -#define MSIM_BM_STATUS 100 -#define MSIM_BM_ACTION_OR_IM_INSTANT 121 -#define MSIM_BM_MEDIA 122 -#define MSIM_BM_PROFILE 124 -#define MSIM_BM_STATUS_MOOD 126 -#define MSIM_BM_UNOFFICIAL_CLIENT 200 - -/* Authentication algorithm for login2 */ -#define MSIM_AUTH_ALGORITHM 196610 - -/* Recognized challenge length */ -#define MSIM_AUTH_CHALLENGE_LENGTH 0x40 - -#ifdef SEND_OUR_IP_ADDRESSES -/* TODO: obtain IPs of network interfaces from user's machine, instead of - * hardcoding these values below (used in msim_compute_login_response). - * This is not immediately - * important because you can still connect and perform basic - * functions of the protocol. There is also a high chance that the addreses - * are RFC1918 private, so the servers couldn't do anything with them - * anyways except make note of that fact. Probably important for any - * kind of direct connection, or file transfer functionality. - */ - -#define MSIM_LOGIN_IP_LIST "\x00\x00\x00\x00\x05\x7f\x00\x00\x01\x00\x00\x00\x00\x0a\x00\x00\x40\xc0\xa8\x58\x01\xc0\xa8\x3c\x01" -#define MSIM_LOGIN_IP_LIST_LEN 25 -#endif /* SEND_OUR_IP_ADDRESSES */ - -/* Indexes into status string (0|1|2|3|..., but 0 always empty) */ -#define MSIM_STATUS_ORDINAL_EMPTY 0 -#define MSIM_STATUS_ORDINAL_UNKNOWNs 1 -#define MSIM_STATUS_ORDINAL_ONLINE 2 -#define MSIM_STATUS_ORDINAL_UNKNOWNss 3 -#define MSIM_STATUS_ORDINAL_HEADLINE 4 -#define MSIM_STATUS_ORDINAL_UNKNOWNls 5 -#define MSIM_STATUS_ORDINAL_UNKNOWN 6 -#define MSIM_STATUS_ORDINAL_UNKNOWN1 7 -#define MSIM_STATUS_ORDINAL_UNKNOWNp 8 -#define MSIM_STATUS_ORDINAL_UNKNOWN2 9 - -/* Status codes - states a buddy (or you!) can be in. */ -#define MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN 0 -#define MSIM_STATUS_CODE_ONLINE 1 -#define MSIM_STATUS_CODE_IDLE 2 -#define MSIM_STATUS_CODE_AWAY 5 - -/* Inbox status bitfield values for MsimSession.inbox_status. */ -#define MSIM_INBOX_MAIL (1 << 0) -#define MSIM_INBOX_BLOG_COMMENT (1 << 1) -#define MSIM_INBOX_PROFILE_COMMENT (1 << 2) -#define MSIM_INBOX_FRIEND_REQUEST (1 << 3) -#define MSIM_INBOX_PICTURE_COMMENT (1 << 4) - -/* Codes for msim_got_contact_list(), to tell what to do afterwards. */ -#define MSIM_CONTACT_LIST_INITIAL_FRIENDS 0 -#define MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS 1 -#define MSIM_CONTACT_LIST_IMPORT_TOP_FRIENDS 2 - -/* Error codes */ -#define MSIM_ERROR_INCORRECT_PASSWORD 260 -#define MSIM_ERROR_LOGGED_IN_ELSEWHERE 6 - -/* Functions */ -gboolean msim_send_raw(MsimSession *session, const gchar *msg); - -gboolean msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, int type); - -gboolean msim_we_are_logged_on(MsimSession *session); - -void msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note); -guint msim_new_reply_callback(MsimSession *session, MSIM_USER_LOOKUP_CB cb, gpointer data); - -#endif /* !_MYSPACE_MYSPACE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/persist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/persist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/persist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/persist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/* MySpaceIM Protocol Plugin, persist commands - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_PERSIST_H -#define _MYSPACE_PERSIST_H - -/** Command codes */ -#define MSIM_CMD_GET 1 -#define MSIM_CMD_PUT 2 -#define MSIM_CMD_DELETE 3 - -/** Command bit fields */ -#define MSIM_CMD_BIT_CODE 255 /*< Bits specifying command code */ -#define MSIM_CMD_BIT_REPLY 256 /**< 1=reply, 0=request */ -#define MSIM_CMD_BIT_ACTION 512 /**< 1=action, 0=information */ -#define MSIM_CMD_BIT_ERROR 1024 /**< 1=error, 0=normal */ - -/** Macros to read cmd bitfield. */ -#define MSIM_CMD_GET_CODE(x) (x & MSIM_CMD_BIT_CODE) -#define MSIM_CMD_IS_REPLY(x) (x & MSIM_CMD_BIT_REPLY) -#define MSIM_CMD_IS_REQUEST(x) !(x & MSIM_CMD_BIT_REPLY) -#define MSIM_CMD_IS_ACTION(x) (x & MSIM_CMD_BIT_ACTION) -#define MSIM_CMD_IS_INFO(x) !(x & MSIM_CMD_BIT_ACTION) -#define MSIM_CMD_IS_ERROR(x) (x & MSIM_CMD_BIT_ERROR) -#define MSIM_CMD_IS_NORMAL(x) !(x & MSIM_CMD_BIT_ERROR) - -/** Define a set of _DSN and _LID constants for a persistance request. */ -#define MSIM_PERSIST_DSN_LID(name,dsn,lid) \ - static const int name##_DSN = dsn; \ - static const int name##_LID = lid; - -/* Can't do this, errors: - * persist.h:51:3: error: '#' is not followed by a macro parameter - * In file included from myspace.c:37: - * persist.h:56: error: expected ')' before numeric constant - * So instead, I define const ints above. -#define MSIM_PERSIST_DSN_LID(name,dsn,lid) \ - #define name##_DSN dsn \ - #define name##_LID lid -#endif -*/ - -/** Messages to Get information dsn lid */ -MSIM_PERSIST_DSN_LID(MG_LIST_ALL_CONTACTS, 0, 1) -MSIM_PERSIST_DSN_LID(MG_USER_INFO_BY_ID, 0, 2) -MSIM_PERSIST_DSN_LID(MG_OWN_IM_INFO, 1, 4) -MSIM_PERSIST_DSN_LID(MG_IM_INFO_BY_ID, 1, 17) -MSIM_PERSIST_DSN_LID(MG_LIST_ALL_GROUPS, 2, 6) -MSIM_PERSIST_DSN_LID(MG_MYSPACE_INFO_BY_ID, 4, 3) -MSIM_PERSIST_DSN_LID(MG_OWN_MYSPACE_INFO, 4, 5) -MSIM_PERSIST_DSN_LID(MG_MYSPACE_INFO_BY_STRING, 5, 7) -MSIM_PERSIST_DSN_LID(MG_CHECK_MAIL, 7, 18) -MSIM_PERSIST_DSN_LID(MG_WEB_CHALLENGE, 17, 26) -MSIM_PERSIST_DSN_LID(MG_USER_SONG, 21, 28) -MSIM_PERSIST_DSN_LID(MG_SERVER_INFO, 101, 20) - -/** Messages to Change/send information */ -MSIM_PERSIST_DSN_LID(MC_USER_PREFERENCES, 1, 10) -MSIM_PERSIST_DSN_LID(MC_DELETE_CONTACT_INFO, 0, 8) -MSIM_PERSIST_DSN_LID(MC_CONTACT_INFO, 0, 9) -MSIM_PERSIST_DSN_LID(MC_SET_USERNAME, 9, 14) -MSIM_PERSIST_DSN_LID(MC_IMPORT_ALL_FRIENDS, 14, 21) -MSIM_PERSIST_DSN_LID(MC_INVITE, 16, 25) - -/** Messages to Delete information */ -MSIM_PERSIST_DSN_LID(MD_DELETE_BUDDY, 0, 8) - -/** Error codes */ -#define MERR_PARSE 1 -#define MERR_NOT_LOGGED_IN 2 -#define MERR_ANOTHER_LOGIN 6 -#define MERR_BAD_EMAIL 259 -#define MERR_BAD_PASSWORD 260 -#define MERR_BAD_UID_IN_PERSISTR 4352 - -#endif /* !_MYSPACE_PERSIST_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -MySpaceIM Protocol Plugin for libpurple by Jeff Connelly 2007-08-07 - -Greetings. This package contains a plugin for libpurple (as used in -Pidgin, formerly Gaim) to connect to the new MySpaceIM instant messaging -network and send/receive messages. Functionality is only basic as of yet, -and this code should be considered alpha quality. - -This code was initially developed under Google Summer of Code 2007. - -For features and TODO, see http://developer.pidgin.im/wiki/MySpaceIM - -Usage: - -Login using your _email address_ you use to login to myspace.com. You can't -login using your numeric ID or alias. - -To test it out, send a message to yourself (by your username or numeric -uid (email not yet supported)) or tom (6221). In either case you should -get a reply. You should also be able to talk to other MySpaceIM users if -you desire. Replies will always be shown as coming from a user's username, -even if you IM by email or userid. - -Feedback welcome. You can IM my test account at "msimprpl" if you feel like it. - -Enjoy, --Jeff Connelly -msimprpl@xyzzy.cjb.net diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -/* MySpaceIM Protocol Plugin, session - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" - -/* Session methods */ - -/** - * Create a new MSIM session. - * - * @param acct The account to create the session from. - * - * @return Pointer to a new session. Free with msim_session_destroy. - */ -MsimSession * -msim_session_new(PurpleAccount *acct) -{ - MsimSession *session; - - g_return_val_if_fail(acct != NULL, NULL); - - session = g_new0(MsimSession, 1); - - session->magic = MSIM_SESSION_STRUCT_MAGIC; - session->account = acct; - session->gc = purple_account_get_connection(acct); - session->sesskey = 0; - session->userid = 0; - session->username = NULL; - session->fd = -1; - - /* TODO: Remove. */ - session->user_lookup_cb = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, NULL); /* do NOT free function pointers! (values) */ - session->user_lookup_cb_data = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, NULL);/* TODO: we don't know what the values are, - they could be integers inside gpointers - or strings, so I don't freed them. - Figure this out, once free cache. */ - - /* Created in msim_process_server_info() */ - session->server_info = NULL; - - session->rxoff = 0; - session->rxsize = MSIM_READ_BUF_SIZE; - session->rxbuf = g_new0(gchar, session->rxsize); - session->next_rid = 1; - session->last_comm = time(NULL); - session->inbox_status = 0; - session->inbox_handle = 0; - - return session; -} - -/** - * Free a session. - * - * @param session The session to destroy. - */ -void -msim_session_destroy(MsimSession *session) -{ - g_return_if_fail(MSIM_SESSION_VALID(session)); - - session->magic = -1; - - g_free(session->rxbuf); - g_free(session->username); - - /* TODO: Remove. */ - g_hash_table_destroy(session->user_lookup_cb); - g_hash_table_destroy(session->user_lookup_cb_data); - - if (session->server_info) { - msim_msg_free(session->server_info); - } - - /* Stop checking the inbox at the end of the session. */ - if (session->inbox_handle) { - purple_timeout_remove(session->inbox_handle); - } - - g_free(session); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/* MySpaceIM Protocol Plugin, session - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_SESSION_H -#define _MYSPACE_SESSION_H - -#include "account.h" - -/* Random number in every MsimSession, to ensure it is valid. */ -#define MSIM_SESSION_STRUCT_MAGIC 0xe4a6752b - -/* Everything needed to keep track of a session (proto_data field in PurpleConnection) */ -typedef struct _MsimSession -{ - guint magic; /**< MSIM_SESSION_STRUCT_MAGIC */ - PurpleAccount *account; - PurpleConnection *gc; - guint sesskey; /**< Session key from server */ - guint userid; /**< This user's numeric user ID */ - gchar *username; /**< This user's unique username */ - gboolean show_only_to_list; - int privacy_mode; /**< This is a bitmask */ - int offline_message_mode; - gint fd; /**< File descriptor to/from server */ - - /* TODO: Remove. */ - GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ - GHashTable *user_lookup_cb_data; /**< Username -> userid lookup callback data */ - - MsimMessage *server_info; /**< Parameters from server */ - - gchar *rxbuf; /**< Receive buffer */ - guint rxoff; /**< Receive buffer offset */ - guint rxsize; /**< Receive buffer size */ - guint next_rid; /**< Next request/response ID */ - time_t last_comm; /**< Time received last communication */ - guint inbox_status; /**< Bit field of inbox notifications */ - guint inbox_handle; /**< The handle for the mail check timer */ -} MsimSession; - -/* Check if an MsimSession is valid */ -#define MSIM_SESSION_VALID(s) (session != NULL && session->magic == MSIM_SESSION_STRUCT_MAGIC) - -MsimSession *msim_session_new(PurpleAccount *acct); -void msim_session_destroy(MsimSession *session); - -#endif /* !_MYSPACE_SESSION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,912 +0,0 @@ -/* MySpaceIM Protocol Plugin, header file - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" - -static void msim_check_username_availability_cb(PurpleConnection *gc, const char *username_to_check); - -static char *msim_username_to_set; - -/** - * Format the "now playing" indicator, showing the artist and song. - * - * @return Return a new string (must be g_free()'d), or NULL. - */ -static gchar * -msim_format_now_playing(const gchar *band, const gchar *song) -{ - if ((band && *band) || (song && *song)) { - return g_strdup_printf("%s - %s", - (band && *band) ? band : "Unknown Artist", - (song && *song) ? song : "Unknown Song"); - } else { - return NULL; - } -} - -/** - * Get the MsimUser from a PurpleBuddy, optionally creating it if needed. - */ -MsimUser * -msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create) -{ - MsimUser *user; - - if (!buddy) { - return NULL; - } - - user = purple_buddy_get_protocol_data(buddy); - if (create && !user) { - /* No MsimUser for this buddy; make one. */ - - user = g_new0(MsimUser, 1); - user->buddy = buddy; - user->id = purple_blist_node_get_int(&buddy->node, "UserID"); - purple_buddy_set_protocol_data(buddy, user); - } - - return user; -} - -void msim_user_free(MsimUser *user) -{ - if (!user) - return; - - if (user->url_data != NULL) - purple_util_fetch_url_cancel(user->url_data); - - g_free(user->client_info); - g_free(user->gender); - g_free(user->location); - g_free(user->headline); - g_free(user->display_name); - g_free(user->username); - g_free(user->band_name); - g_free(user->song_name); - g_free(user->image_url); - g_free(user); -} - -/** - * Find and return an MsimUser * representing a user on the buddy list, or NULL. - */ -MsimUser * -msim_find_user(MsimSession *session, const gchar *username) -{ - PurpleBuddy *buddy; - MsimUser *user; - - buddy = purple_find_buddy(session->account, username); - if (!buddy) { - return NULL; - } - - user = msim_get_user_from_buddy(buddy, TRUE); - - return user; -} - -/** - * Append user information to a PurpleNotifyUserInfo, given an MsimUser. - * Used by msim_tooltip_text() and msim_get_info_cb() to show a user's profile. - */ -void -msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, MsimUser *user, gboolean full) -{ - PurplePresence *presence; - gchar *str; - guint cv; - - /* Useful to identify the account the tooltip refers to. - * Other prpls show this. */ - if (user->username) { - purple_notify_user_info_add_pair(user_info, _("User"), user->username); - } - - /* a/s/l...the vitals */ - if (user->age) { - char age[16]; - g_snprintf(age, sizeof(age), "%d", user->age); - purple_notify_user_info_add_pair(user_info, _("Age"), age); - } - - if (user->gender && *user->gender) { - purple_notify_user_info_add_pair(user_info, _("Gender"), user->gender); - } - - if (user->location && *user->location) { - purple_notify_user_info_add_pair(user_info, _("Location"), user->location); - } - - /* Other information */ - if (user->headline && *user->headline) { - purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline); - } - - if (user->buddy != NULL) { - presence = purple_buddy_get_presence(user->buddy); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status; - const char *artist, *title; - - status = purple_presence_get_status(presence, "tune"); - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - - str = msim_format_now_playing(artist, title); - if (str && *str) { - purple_notify_user_info_add_pair(user_info, _("Song"), str); - } - g_free(str); - } - } - - /* Note: total friends only available if looked up by uid, not username. */ - if (user->total_friends) { - char friends[16]; - g_snprintf(friends, sizeof(friends), "%d", user->total_friends); - purple_notify_user_info_add_pair(user_info, _("Total Friends"), friends); - } - - if (full) { - /* Client information */ - char *client = NULL; - - str = user->client_info; - cv = user->client_cv; - - if (str && cv != 0) { - client = g_strdup_printf("%s (build %d)", str, cv); - } else if (str) { - client = g_strdup(str); - } else if (cv) { - client = g_strdup_printf("Build %d", cv); - } - if (client && *client) - purple_notify_user_info_add_pair(user_info, _("Client Version"), client); - g_free(client); - } - - if (full && user->id) { - /* TODO: link to username, if available */ - char *profile; - purple_notify_user_info_add_section_break(user_info); - if (user->buddy != NULL) - profile = g_strdup_printf("%s", - purple_buddy_get_name(user->buddy), _("View web profile")); - else - profile = g_strdup_printf("%s", - user->id, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, profile); - g_free(profile); - } -} - -/** - * Callback for when a buddy icon finished being downloaded. - */ -static void -msim_downloaded_buddy_icon(PurpleUtilFetchUrlData *url_data, - gpointer user_data, - const gchar *url_text, - gsize len, - const gchar *error_message) -{ - MsimUser *user = (MsimUser *)user_data; - const char *name = purple_buddy_get_name(user->buddy); - PurpleAccount *account; - - user->url_data = NULL; - - purple_debug_info("msim_downloaded_buddy_icon", - "Downloaded %" G_GSIZE_FORMAT " bytes\n", len); - - if (!url_text) { - purple_debug_info("msim_downloaded_buddy_icon", - "failed to download icon for %s", - name); - return; - } - - account = purple_buddy_get_account(user->buddy); - purple_buddy_icons_set_for_user(account, name, - g_memdup((gchar *)url_text, len), len, - /* Use URL itself as buddy icon "checksum" (TODO: ETag) */ - user->image_url); /* checksum */ -} - -/** - * Set the currently playing song artist and or title. - * - * @param user User associated with the now playing information. - * - * @param new_artist New artist to set, or NULL/empty to not change artist. - * - * @param new_title New title to set, or NULL/empty to not change title. - * - * If new_artist and new_title are NULL/empty, deactivate PURPLE_STATUS_TUNE. - * - * This function is useful because it lets you set the artist or title - * individually, which purple_prpl_got_user_status() doesn't do. - */ -static void msim_set_artist_or_title(MsimUser *user, const char *new_artist, const char *new_title) -{ - PurplePresence *presence; - PurpleAccount *account; - const char *prev_artist, *prev_title; - const char *name; - - if (user->buddy == NULL) - /* User not on buddy list so nothing to do */ - return; - - prev_artist = NULL; - prev_title = NULL; - - if (new_artist && !*new_artist) - new_artist = NULL; - if (new_title && !*new_title) - new_title = NULL; - - account = purple_buddy_get_account(user->buddy); - name = purple_buddy_get_name(user->buddy); - - if (!new_artist && !new_title) { - purple_prpl_got_user_status_deactive(account, name, "tune"); - return; - } - - presence = purple_buddy_get_presence(user->buddy); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status; - - status = purple_presence_get_status(presence, "tune"); - prev_title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - prev_artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - } - - if (!new_artist) - new_artist = prev_artist; - - if (!new_title) - new_title = prev_title; - - purple_prpl_got_user_status(account, name, "tune", - PURPLE_TUNE_TITLE, new_title, - PURPLE_TUNE_ARTIST, new_artist, - NULL); -} - -/** - * Store a field of information about a buddy. - * - * @param key_str Key to store. - * @param value_str Value string, either user takes ownership of this string - * or it is freed if MsimUser doesn't store the string. - * @param user User to store data in. Existing data will be replaced. - */ -static void -msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user) -{ - const char *name = user->buddy ? purple_buddy_get_name(user->buddy) : NULL; - - if (g_str_equal(key_str, "UserID") || g_str_equal(key_str, "ContactID")) { - /* Save to buddy list, if it exists, for quick cached uid lookup with msim_uid2username_from_blist(). */ - user->id = atol(value_str); - g_free(value_str); - if (user->buddy) - { - purple_debug_info("msim", "associating uid %s with username %s\n", key_str, name); - purple_blist_node_set_int(PURPLE_BLIST_NODE(user->buddy), "UserID", user->id); - } - /* Need to store in MsimUser, too? What if not on blist? */ - } else if (g_str_equal(key_str, "Age")) { - user->age = atol(value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "Gender")) { - g_free(user->gender); - user->gender = value_str; - } else if (g_str_equal(key_str, "Location")) { - g_free(user->location); - user->location = value_str; - } else if (g_str_equal(key_str, "TotalFriends")) { - user->total_friends = atol(value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "DisplayName")) { - g_free(user->display_name); - user->display_name = value_str; - } else if (g_str_equal(key_str, "BandName")) { - msim_set_artist_or_title(user, value_str, NULL); - g_free(value_str); - } else if (g_str_equal(key_str, "SongName")) { - msim_set_artist_or_title(user, NULL, value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "UserName") || g_str_equal(key_str, "IMName") || g_str_equal(key_str, "NickName")) { - /* Ignore because PurpleBuddy knows this already */ - g_free(value_str); - } else if (g_str_equal(key_str, "ImageURL") || g_str_equal(key_str, "AvatarURL")) { - const gchar *previous_url; - - if (user->temporary_user) { - /* This user will be destroyed soon; don't try to look up its image or avatar, - * since that won't return immediately and we will end up accessing freed data. - */ - g_free(value_str); - return; - } - - if (user->temporary_user) { - /* This user will be destroyed soon; don't try to look up its image or avatar, - * since that won't return immediately and we will end up accessing freed data. - */ - g_free(value_str); - return; - } - - g_free(user->image_url); - - user->image_url = value_str; - - /* Instead of showing 'no photo' picture, show nothing. */ - if (g_str_equal(user->image_url, "http://x.myspace.com/images/no_pic.gif")) - { - purple_buddy_icons_set_for_user(purple_buddy_get_account(user->buddy), - name, NULL, 0, NULL); - return; - } - - /* TODO: use ETag for checksum */ - previous_url = purple_buddy_icons_get_checksum_for_user(user->buddy); - - /* Only download if URL changed */ - if (!previous_url || !g_str_equal(previous_url, user->image_url)) { - if (user->url_data != NULL) - purple_util_fetch_url_cancel(user->url_data); - user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user); - } - } else if (g_str_equal(key_str, "LastImageUpdated")) { - /* TODO: use somewhere */ - user->last_image_updated = atol(value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "Headline")) { - g_free(user->headline); - user->headline = value_str; - } else { - /* TODO: other fields in MsimUser */ - gchar *msg; - - msg = g_strdup_printf("msim_store_user_info_each: unknown field %s=%s", - key_str, value_str); - g_free(value_str); - - msim_unrecognized(NULL, NULL, msg); - - g_free(msg); - } -} - -/** - * Save buddy information to the buddy list from a user info reply message. - * - * @param session - * @param msg The user information reply, with any amount of information. - * @param user The structure to save to, or NULL to save in PurpleBuddy->proto_data. - * - * Variable information is saved to the passed MsimUser structure. Permanent - * information (UserID) is stored in the blist node of the buddy list (and - * ends up in blist.xml, persisted to disk) if it exists. - * - * If the function has no buddy information, this function - * is a no-op (and returns FALSE). - */ -gboolean -msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *user) -{ - gchar *username; - MsimMessage *body, *body_node; - - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - body = msim_msg_get_dictionary(msg, "body"); - if (!body) { - return FALSE; - } - - if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) - { - /* - * Some of this info will be available on the buddy list if the - * user has themselves as their own buddy. - * - * Much of the info is already available in MsimSession, - * stored in msim_we_are_logged_on(). - */ - gchar *tmpstr; - - tmpstr = msim_msg_get_string(body, "ShowOnlyToList"); - if (tmpstr != NULL) { - session->show_only_to_list = g_str_equal(tmpstr, "True"); - g_free(tmpstr); - } - - session->privacy_mode = msim_msg_get_integer(body, "PrivacyMode"); - session->offline_message_mode = msim_msg_get_integer(body, "OfflineMessageMode"); - - msim_send(session, - "blocklist", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "idlist", MSIM_TYPE_STRING, - g_strdup_printf("w%d|c%d", - session->show_only_to_list ? 1 : 0, - session->privacy_mode & 1), - NULL); - } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) { - /* TODO: same as above, but for MySpace info. */ - } - - username = msim_msg_get_string(body, "UserName"); - - if (!username) { - purple_debug_info("msim", - "msim_process_reply: not caching body, no UserName\n"); - msim_msg_free(body); - g_free(username); - return FALSE; - } - - /* Null user = find and store in PurpleBuddy's proto_data */ - if (!user) { - user = msim_find_user(session, username); - if (!user) { - msim_msg_free(body); - g_free(username); - return FALSE; - } - } - - /* TODO: make looping over MsimMessage's easier. */ - for (body_node = body; - body_node != NULL; - body_node = msim_msg_get_next_element_node(body_node)) - { - const gchar *key_str; - gchar *value_str; - MsimMessageElement *elem; - - elem = (MsimMessageElement *)body_node->data; - key_str = elem->name; - - value_str = msim_msg_get_string_from_element(elem); - msim_store_user_info_each(key_str, value_str, user); - } - - msim_msg_free(body); - g_free(username); - - return TRUE; -} - -#if 0 -/** - * Return whether a given username is syntactically valid. - * Note: does not actually check that the user exists. - */ -static gboolean -msim_is_valid_username(const gchar *user) -{ - return !msim_is_userid(user) && /* Not all numeric */ - strlen(user) <= MSIM_MAX_USERNAME_LENGTH - && strspn(user, "0123456789" - "abcdefghijklmnopqrstuvwxyz" - "_" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == strlen(user); -} -#endif - -/** - * Check if a string is a userid (all numeric). - * - * @param user The user id, email, or name. - * - * @return TRUE if is userid, FALSE if not. - */ -gboolean -msim_is_userid(const gchar *user) -{ - g_return_val_if_fail(user != NULL, FALSE); - - return strspn(user, "0123456789") == strlen(user); -} - -/** - * Check if a string is an email address (contains an @). - * - * @param user The user id, email, or name. - * - * @return TRUE if is an email, FALSE if not. - * - * This function is not intended to be used as a generic - * means of validating email addresses, but to distinguish - * between a user represented by an email address from - * other forms of identification. - */ -static gboolean -msim_is_email(const gchar *user) -{ - g_return_val_if_fail(user != NULL, FALSE); - - return strchr(user, '@') != NULL; -} - -/** - * Asynchronously lookup user information, calling callback when receive result. - * - * @param session - * @param user The user id, email address, or username. Not freed. - * @param cb Callback, called with user information when available. - * @param data An arbitray data pointer passed to the callback. - */ -/* TODO: change to not use callbacks */ -void -msim_lookup_user(MsimSession *session, const gchar *user, MSIM_USER_LOOKUP_CB cb, gpointer data) -{ - MsimMessage *body; - gchar *field_name; - guint rid, cmd, dsn, lid; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - g_return_if_fail(user != NULL); - /* Callback can be null to not call anything, just lookup & store information. */ - /*g_return_if_fail(cb != NULL);*/ - - purple_debug_info("msim", "msim_lookup_userid: " - "asynchronously looking up <%s>\n", user); - - /* Setup callback. Response will be associated with request using 'rid'. */ - rid = msim_new_reply_callback(session, cb, data); - - /* Send request */ - - cmd = MSIM_CMD_GET; - - if (msim_is_userid(user)) { - field_name = "UserID"; - dsn = MG_MYSPACE_INFO_BY_ID_DSN; - lid = MG_MYSPACE_INFO_BY_ID_LID; - } else if (msim_is_email(user)) { - field_name = "Email"; - dsn = MG_MYSPACE_INFO_BY_STRING_DSN; - lid = MG_MYSPACE_INFO_BY_STRING_LID; - } else { - field_name = "UserName"; - dsn = MG_MYSPACE_INFO_BY_STRING_DSN; - lid = MG_MYSPACE_INFO_BY_STRING_LID; - } - - body = msim_msg_new( - field_name, MSIM_TYPE_STRING, g_strdup(user), - NULL); - - g_return_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, 1, - "dsn", MSIM_TYPE_INTEGER, dsn, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, lid, - "rid", MSIM_TYPE_INTEGER, rid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL)); -} - -/** - * Called after username is set. - */ -static void msim_username_is_set_cb(MsimSession *session, const MsimMessage *userinfo, gpointer data) -{ - gchar *username; - const gchar *errmsg; - MsimMessage *body; - - guint rid; - gint cmd,dsn,uid,lid,code; - /* \persistr\\cmd\258\dsn\9\uid\204084363\lid\14\rid\369\body\UserName=TheAlbinoRhino1.Code=0\final\ */ - - purple_debug_info("msim","username_is_set made\n"); - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - cmd = msim_msg_get_integer(userinfo, "cmd"); - dsn = msim_msg_get_integer(userinfo, "dsn"); - uid = msim_msg_get_integer(userinfo, "uid"); - lid = msim_msg_get_integer(userinfo, "lid"); - body = msim_msg_get_dictionary(userinfo, "body"); - errmsg = _("An error occurred while trying to set the username. " - "Please try again, or visit http://editprofile.myspace.com/index.cfm?" - "fuseaction=profile.username to set your username."); - - if (!body) { - purple_debug_info("msim_username_is_set_cb", "No body"); - /* Error: No body! */ - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); - } - username = msim_msg_get_string(body, "UserName"); - code = msim_msg_get_integer(body,"Code"); - - msim_msg_free(body); - - purple_debug_info("msim_username_is_set_cb", - "cmd = %d, dsn = %d, lid = %d, code = %d, username = %s\n", - cmd, dsn, lid, code, username); - - if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_PUT) - && dsn == MC_SET_USERNAME_DSN - && lid == MC_SET_USERNAME_LID) - { - purple_debug_info("msim_username_is_set_cb", "Proper cmd,dsn,lid for username_is_set!\n"); - purple_debug_info("msim_username_is_set_cb", "Username Set with return code %d\n",code); - if (code == 0) { - /* Good! */ - session->username = username; - msim_we_are_logged_on(session); - } else { - purple_debug_info("msim_username_is_set", "code is %d",code); - /* TODO: what to do here? */ - } - } else if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_GET) - && dsn == MG_MYSPACE_INFO_BY_STRING_DSN - && lid == MG_MYSPACE_INFO_BY_STRING_LID) { - /* Not quite done... ONE MORE STEP :) */ - rid = msim_new_reply_callback(session, msim_username_is_set_cb, data); - body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username), NULL); - if (!msim_send(session, "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_SET_USERNAME_DSN, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, MC_SET_USERNAME_LID, - "rid", MSIM_TYPE_INTEGER, rid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL)) { - /* Error! */ - /* Can't set... Disconnect */ - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); - } - - } else { - /* Error! */ - purple_debug_info("msim","username_is_set Error: Invalid cmd/dsn/lid combination"); - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); - } -} - -/** - * Asynchronously set new username, calling callback when receive result. - * - * @param session - * @param username The username we're setting for ourselves. Not freed. - * @param cb Callback, called with user information when available. - * @param data An arbitray data pointer passed to the callback. - */ -static void -msim_set_username(MsimSession *session, const gchar *username, - MSIM_USER_LOOKUP_CB cb, gpointer data) -{ - MsimMessage *body; - guint rid; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - g_return_if_fail(username != NULL); - g_return_if_fail(cb != NULL); - - purple_debug_info("msim", "msim_set_username: " - "Setting username %s\n", username); - - /* Setup callback. Response will be associated with request using 'rid'. */ - rid = msim_new_reply_callback(session, cb, data); - - /* TODO: I dont know if the ContactType is -/ALWAYS/- 1 */ - - body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username),NULL); -/* \setinfo\\sesskey\469958979\info\Age=21.AvatarUrl=.BandName=.ContactType=1.DisplayName=Msim.Gender=M.ImageURL=http:/1/1x.myspace.com/1images/1no_pic.gif.LastLogin=128335268400000000.Location=US.ShowAvatar=False.SongName=.TotalFriends=1.UserName=msimprpl2\final\ -*/ - - /* Send request */ - g_return_if_fail(msim_send(session, - "setinfo", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "info", MSIM_TYPE_DICTIONARY, body, - NULL)); - body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username),NULL); - g_return_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_MYSPACE_INFO_BY_STRING_DSN, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, MG_MYSPACE_INFO_BY_STRING_LID, - "rid", MSIM_TYPE_INTEGER, rid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL)); -} - -/** - * They've confirmed that username that was available, Lets make the call to set it - */ -static void msim_set_username_confirmed_cb(PurpleConnection *gc) -{ - MsimMessage *user_msg; - MsimSession *session; - - g_return_if_fail(gc != NULL); - - session = (MsimSession *)gc->proto_data; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - - user_msg = msim_msg_new( - "user", MSIM_TYPE_STRING, g_strdup(msim_username_to_set), - NULL); - - purple_debug_info("msim_set_username_confirmed_cb", "Setting username to %s\n", msim_username_to_set); - - /* Sets our username... keep your fingers crossed :) */ - msim_set_username(session, msim_username_to_set, msim_username_is_set_cb, user_msg); - g_free(msim_username_to_set); -} - -/** - * This is where we do a bit more than merely prompt the user. - * Now we have some real data to tell us the state of their requested username - * \persistr\\cmd\257\dsn\5\uid\204084363\lid\7\rid\367\body\UserName=TheAlbinoRhino1\final\ - */ -static void msim_username_is_available_cb(MsimSession *session, const MsimMessage *userinfo, gpointer data) -{ - MsimMessage *msg; - gchar *username; - MsimMessage *body; - gint userid; - - purple_debug_info("msim_username_is_available_cb", "Look up username callback made\n"); - - msg = (MsimMessage *)data; - g_return_if_fail(MSIM_SESSION_VALID(session)); - g_return_if_fail(msg != NULL); - - username = msim_msg_get_string(msg, "user"); - body = msim_msg_get_dictionary(userinfo, "body"); - - if (!body) { - purple_debug_info("msim_username_is_available_cb", "No body for %s?!\n", username); - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("An error occurred while trying to set the username. " - "Please try again, or visit http://editprofile.myspace.com/index.cfm?" - "fuseaction=profile.username to set your username.")); - return; - } - - userid = msim_msg_get_integer(body, "UserID"); - - purple_debug_info("msim_username_is_available_cb", "Returned username is %s and userid is %d\n", username, userid); - msim_msg_free(body); - msim_msg_free(msg); - - /* The response for a free username will ONLY have the UserName in it.. - * thus making UserID return 0 when we msg_get_integer it */ - if (userid == 0) { - /* This username is currently unused */ - purple_debug_info("msim_username_is_available_cb", "Username available. Prompting to Confirm.\n"); - msim_username_to_set = g_strdup(username); - g_free(username); - purple_request_yes_no(session->gc, - _("MySpaceIM - Username Available"), - _("This username is available. Would you like to set it?"), - _("ONCE SET, THIS CANNOT BE CHANGED!"), - 0, - session->account, - NULL, - NULL, - session->gc, - G_CALLBACK(msim_set_username_confirmed_cb), - G_CALLBACK(msim_do_not_set_username_cb)); - } else { - /* Looks like its in use or we have an invalid response */ - purple_debug_info("msim_username_is_available_cb", "Username unavaiable. Prompting for new entry.\n"); - purple_request_input(session->gc, _("MySpaceIM - Please Set a Username"), - _("This username is unavailable."), - _("Please try another username:"), - "", FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msim_check_username_availability_cb), - _("Cancel"), G_CALLBACK(msim_do_not_set_username_cb), - session->account, - NULL, - NULL, - session->gc); - } -} - -/** - * Once they've submitted their desired new username, - * check if it is available here. - */ -static void msim_check_username_availability_cb(PurpleConnection *gc, const char *username_to_check) -{ - MsimMessage *user_msg; - MsimSession *session; - - g_return_if_fail(gc != NULL); - - session = (MsimSession *)gc->proto_data; - - g_return_if_fail(MSIM_SESSION_VALID(session)); - - purple_debug_info("msim_check_username_availability_cb", "Checking username: %s\n", username_to_check); - - user_msg = msim_msg_new( - "user", MSIM_TYPE_STRING, g_strdup(username_to_check), - NULL); - - /* 25 characters: letters, numbers, underscores */ - /* TODO: VERIFY ABOVE */ - - /* \persist\1\sesskey\288500516\cmd\1\dsn\5\uid\204084363\lid\7\rid\367\body\UserName=Jaywalker\final\ */ - /* Official client uses a standard lookup... So do we! */ - msim_lookup_user(session, username_to_check, msim_username_is_available_cb, user_msg); -} - -/*** - * If they hit cancel or no at any point in the Setting Username process, - * we come here. Currently we're safe letting them get by without - * setting it, unless we hear otherwise. So for now give them a menu. - * If this becomes an issue with the official client then boot them here. - */ -void msim_do_not_set_username_cb(PurpleConnection *gc) -{ - purple_debug_info("msim", "Don't set username"); - - /* Protocol won't log in now without a username set.. Disconnect */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("No username set")); -} - -/** - * They've decided to set a username! Yay! - */ -void msim_set_username_cb(PurpleConnection *gc) -{ - g_return_if_fail(gc != NULL); - purple_debug_info("msim","Set username\n"); - purple_request_input(gc, _("MySpaceIM - Please Set a Username"), - _("Please enter a username to check its availability:"), - NULL, - "", FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msim_check_username_availability_cb), - _("Cancel"), G_CALLBACK(msim_do_not_set_username_cb), - purple_connection_get_account(gc), - NULL, - NULL, - gc); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/* MySpaceIM Protocol Plugin, header file - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_USER_H -#define _MYSPACE_USER_H - -/* Hold ephemeral information about buddies, for proto_data of PurpleBuddy. */ -/* GHashTable? */ -typedef struct _MsimUser -{ - PurpleBuddy *buddy; - /* Note: id is also &buddy->node (set_blist_node_int), when buddy is non-NULL */ - int id; - guint client_cv; - gchar *client_info; - guint age; - gchar *gender; - gchar *location; - guint total_friends; - gchar *headline; - gchar *display_name; - gchar *username; - gchar *band_name, *song_name; - gchar *image_url; - guint last_image_updated; - gboolean temporary_user; - PurpleUtilFetchUrlData *url_data; -} MsimUser; - -/* Callback function pointer type for when a user's information is received, - * initiated from a user lookup. */ -typedef void (*MSIM_USER_LOOKUP_CB)(MsimSession *session, const MsimMessage *userinfo, gpointer data); - -MsimUser *msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create); -void msim_user_free(MsimUser *user); -MsimUser *msim_find_user(MsimSession *session, const gchar *username); -void msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, MsimUser *user, gboolean full); -gboolean msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *user); -gboolean msim_is_userid(const gchar *user); -void msim_lookup_user(MsimSession *session, const gchar *user, MSIM_USER_LOOKUP_CB cb, gpointer data); -void msim_set_username_cb(PurpleConnection *gc); -void msim_do_not_set_username_cb(PurpleConnection *gc); - -#endif /* !_MYSPACE_USER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* MySpaceIM Protocol Plugin - zap support - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" -#include "zap.h" - -/** Get zap types. */ -GList * -msim_attention_types(PurpleAccount *acct) -{ - static GList *types = NULL; - PurpleAttentionType* attn; - - if (!types) { -#define _MSIM_ADD_NEW_ATTENTION(icn, ulname, nme, incoming, outgoing) \ - attn = purple_attention_type_new(ulname, nme, incoming, outgoing); \ - purple_attention_type_set_icon_name(attn, icn); \ - types = g_list_append(types, attn); - - /* TODO: icons for each zap */ - - /* Lots of comments for translators: */ - - /* Zap means "to strike suddenly and forcefully as if with a - * projectile or weapon." This term often has an electrical - * connotation, for example, "he was zapped by electricity when - * he put a fork in the toaster." */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Zap", _("Zap"), _("%s has zapped you!"), - _("Zapping %s...")); - - /* Whack means "to hit or strike someone with a sharp blow" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Whack", _("Whack"), - _("%s has whacked you!"), _("Whacking %s...")); - - /* Torch means "to set on fire." Don't worry, this doesn't - * make a whole lot of sense in English, either. Feel free - * to translate it literally. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Torch", _("Torch"), - _("%s has torched you!"), _("Torching %s...")); - - /* Smooch means "to kiss someone, often enthusiastically" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Smooch", _("Smooch"), - _("%s has smooched you!"), _("Smooching %s...")); - - /* A hug is a display of affection; wrapping your arms around someone */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Hug", _("Hug"), _("%s has hugged you!"), - _("Hugging %s...")); - - /* Slap means "to hit someone with an open/flat hand" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Slap", _("Slap"), - _("%s has slapped you!"), _("Slapping %s...")); - - /* Goose means "to pinch someone on their butt" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Goose", _("Goose"), - _("%s has goosed you!"), _("Goosing %s...")); - - /* A high-five is when two people's hands slap each other - * in the air above their heads. It is done to celebrate - * something, often a victory, or to congratulate someone. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "High-five", _("High-five"), - _("%s has high-fived you!"), _("High-fiving %s...")); - - /* We're not entirely sure what the MySpace people mean by - * this... but we think it's the equivalent of "prank." Or, for - * someone to perform a mischievous trick or practical joke. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Punk", _("Punk"), - _("%s has punk'd you!"), _("Punking %s...")); - - /* Raspberry is a slang term for the vibrating sound made - * when you stick your tongue out of your mouth with your - * lips closed and blow. It is typically done when - * gloating or bragging. Nowadays it's a pretty silly - * gesture, so it does not carry a harsh negative - * connotation. It is generally used in a playful tone - * with friends. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Raspberry", _("Raspberry"), - _("%s has raspberried you!"), _("Raspberrying %s...")); - } - - return types; -} - -/** Send a zap to a user. */ -static gboolean -msim_send_zap(MsimSession *session, const gchar *username, guint code) -{ - gchar *zap_string; - gboolean rc; - - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(username != NULL, FALSE); - - /* Construct and send the actual zap command. */ - zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code); - - if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION_OR_IM_INSTANT)) { - purple_debug_info("msim_send_zap", - "msim_send_bm failed: zapping %s with %s\n", - username, zap_string); - rc = FALSE; - } else { - rc = TRUE; - } - - g_free(zap_string); - - return rc; -} - -/** Send a zap */ -gboolean -msim_send_attention(PurpleConnection *gc, const gchar *username, guint code) -{ - GList *types; - MsimSession *session; - PurpleAttentionType *attn; - PurpleBuddy *buddy; - - session = (MsimSession *)gc->proto_data; - - /* Look for this attention type, by the code index given. */ - types = msim_attention_types(gc->account); - attn = (PurpleAttentionType *)g_list_nth_data(types, code); - - if (!attn) { - purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code); - return FALSE; - } - - buddy = purple_find_buddy(session->account, username); - if (!buddy) { - return FALSE; - } - - msim_send_zap(session, username, code); - - return TRUE; -} - -/** Zap someone. Callback from msim_blist_node_menu zap menu. */ -static void -msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr) -{ - PurpleBuddy *buddy; - PurpleAccount *account; - PurpleConnection *gc; - MsimSession *session; - guint zap; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* Only know about buddies for now. */ - return; - } - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - - /* Find the session */ - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - session = (MsimSession *)gc->proto_data; - - zap = GPOINTER_TO_INT(zap_num_ptr); - - purple_prpl_send_attention(session->gc, purple_buddy_get_name(buddy), zap); -} - -/** Return menu, if any, for a buddy list node. */ -GList * -msim_blist_node_menu(PurpleBlistNode *node) -{ - GList *menu, *zap_menu; - GList *types; - PurpleMenuAction *act; - guint i; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* Only know about buddies for now. */ - return NULL; - } - - zap_menu = NULL; - - /* TODO: get rid of once is accessible directly in GUI */ - types = msim_attention_types(NULL); - i = 0; - do - { - PurpleAttentionType *attn; - - attn = (PurpleAttentionType *)types->data; - - act = purple_menu_action_new(purple_attention_type_get_name(attn), - PURPLE_CALLBACK(msim_send_zap_from_menu), GUINT_TO_POINTER(i), NULL); - zap_menu = g_list_append(zap_menu, act); - - ++i; - } while ((types = g_list_next(types))); - - act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu); - menu = g_list_append(NULL, act); - - return menu; -} - -/** Process an incoming zap. */ -gboolean -msim_incoming_zap(MsimSession *session, MsimMessage *msg) -{ - gchar *msg_text, *username; - gint zap; - - msg_text = msim_msg_get_string(msg, "msg"); - username = msim_msg_get_string(msg, "_username"); - - g_return_val_if_fail(msg_text != NULL, FALSE); - g_return_val_if_fail(username != NULL, FALSE); - - g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE); - - zap = CLAMP(zap, 0, 9); - - purple_prpl_got_attention(session->gc, username, zap); - - g_free(msg_text); - g_free(username); - - return TRUE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/myspace/zap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* MySpaceIM Protocol Plugin - zap support - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_ZAP_H -#define _MYSPACE_ZAP_H - -GList *msim_attention_types(PurpleAccount *acct); -gboolean msim_send_attention(PurpleConnection *gc, const gchar *username, guint code); -GList *msim_blist_node_menu(PurpleBlistNode *node); -gboolean msim_incoming_zap(MsimSession *session, MsimMessage *msg); - -#endif /* !_MYSPACE_ZAP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -NOVELLSOURCES = \ - nmfield.h \ - nmfield.c \ - nmconn.h \ - nmconn.c \ - nmconference.h \ - nmconference.c \ - nmcontact.h \ - nmcontact.c \ - nmevent.h \ - nmevent.c \ - nmmessage.h \ - nmmessage.c \ - nmrequest.h \ - nmrequest.c \ - nmrtf.h \ - nmrtf.c \ - nmuser.h \ - nmuser.c \ - nmuserrecord.h \ - nmuserrecord.c \ - novell.c - -AM_CFLAGS = $(st) - -libnovell_la_LDFLAGS = -module -avoid-version - -if STATIC_NOVELL - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libnovell.la -libnovell_la_SOURCES = $(NOVELLSOURCES) -libnovell_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libnovell.la -libnovell_la_SOURCES = $(NOVELLSOURCES) -libnovell_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,847 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/novell -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_NOVELL_FALSE@libnovell_la_DEPENDENCIES = \ -@STATIC_NOVELL_FALSE@ $(am__DEPENDENCIES_1) -am__libnovell_la_SOURCES_DIST = nmfield.h nmfield.c nmconn.h nmconn.c \ - nmconference.h nmconference.c nmcontact.h nmcontact.c \ - nmevent.h nmevent.c nmmessage.h nmmessage.c nmrequest.h \ - nmrequest.c nmrtf.h nmrtf.c nmuser.h nmuser.c nmuserrecord.h \ - nmuserrecord.c novell.c -am__objects_1 = libnovell_la-nmfield.lo libnovell_la-nmconn.lo \ - libnovell_la-nmconference.lo libnovell_la-nmcontact.lo \ - libnovell_la-nmevent.lo libnovell_la-nmmessage.lo \ - libnovell_la-nmrequest.lo libnovell_la-nmrtf.lo \ - libnovell_la-nmuser.lo libnovell_la-nmuserrecord.lo \ - libnovell_la-novell.lo -@STATIC_NOVELL_FALSE@am_libnovell_la_OBJECTS = $(am__objects_1) -@STATIC_NOVELL_TRUE@am_libnovell_la_OBJECTS = $(am__objects_1) -libnovell_la_OBJECTS = $(am_libnovell_la_OBJECTS) -@STATIC_NOVELL_FALSE@am_libnovell_la_rpath = -rpath $(pkgdir) -@STATIC_NOVELL_TRUE@am_libnovell_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libnovell_la_SOURCES) -DIST_SOURCES = $(am__libnovell_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -NOVELLSOURCES = \ - nmfield.h \ - nmfield.c \ - nmconn.h \ - nmconn.c \ - nmconference.h \ - nmconference.c \ - nmcontact.h \ - nmcontact.c \ - nmevent.h \ - nmevent.c \ - nmmessage.h \ - nmmessage.c \ - nmrequest.h \ - nmrequest.c \ - nmrtf.h \ - nmrtf.c \ - nmuser.h \ - nmuser.c \ - nmuserrecord.h \ - nmuserrecord.c \ - novell.c - -AM_CFLAGS = $(st) -libnovell_la_LDFLAGS = -module -avoid-version -@STATIC_NOVELL_FALSE@st = -@STATIC_NOVELL_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_NOVELL_TRUE@noinst_LTLIBRARIES = libnovell.la -@STATIC_NOVELL_FALSE@libnovell_la_SOURCES = $(NOVELLSOURCES) -@STATIC_NOVELL_TRUE@libnovell_la_SOURCES = $(NOVELLSOURCES) -@STATIC_NOVELL_TRUE@libnovell_la_CFLAGS = $(AM_CFLAGS) -@STATIC_NOVELL_FALSE@pkg_LTLIBRARIES = libnovell.la -@STATIC_NOVELL_FALSE@libnovell_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/novell/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/novell/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libnovell.la: $(libnovell_la_OBJECTS) $(libnovell_la_DEPENDENCIES) - $(LINK) $(am_libnovell_la_rpath) $(libnovell_la_LDFLAGS) $(libnovell_la_OBJECTS) $(libnovell_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmconference.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmcontact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmevent.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmfield.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmmessage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmrequest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmrtf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmuser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmuserrecord.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-novell.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libnovell_la-nmfield.lo: nmfield.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmfield.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmfield.Tpo" -c -o libnovell_la-nmfield.lo `test -f 'nmfield.c' || echo '$(srcdir)/'`nmfield.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmfield.Tpo" "$(DEPDIR)/libnovell_la-nmfield.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmfield.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmfield.c' object='libnovell_la-nmfield.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmfield.lo `test -f 'nmfield.c' || echo '$(srcdir)/'`nmfield.c - -libnovell_la-nmconn.lo: nmconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmconn.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmconn.Tpo" -c -o libnovell_la-nmconn.lo `test -f 'nmconn.c' || echo '$(srcdir)/'`nmconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmconn.Tpo" "$(DEPDIR)/libnovell_la-nmconn.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmconn.c' object='libnovell_la-nmconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmconn.lo `test -f 'nmconn.c' || echo '$(srcdir)/'`nmconn.c - -libnovell_la-nmconference.lo: nmconference.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmconference.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmconference.Tpo" -c -o libnovell_la-nmconference.lo `test -f 'nmconference.c' || echo '$(srcdir)/'`nmconference.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmconference.Tpo" "$(DEPDIR)/libnovell_la-nmconference.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmconference.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmconference.c' object='libnovell_la-nmconference.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmconference.lo `test -f 'nmconference.c' || echo '$(srcdir)/'`nmconference.c - -libnovell_la-nmcontact.lo: nmcontact.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmcontact.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmcontact.Tpo" -c -o libnovell_la-nmcontact.lo `test -f 'nmcontact.c' || echo '$(srcdir)/'`nmcontact.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmcontact.Tpo" "$(DEPDIR)/libnovell_la-nmcontact.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmcontact.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmcontact.c' object='libnovell_la-nmcontact.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmcontact.lo `test -f 'nmcontact.c' || echo '$(srcdir)/'`nmcontact.c - -libnovell_la-nmevent.lo: nmevent.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmevent.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmevent.Tpo" -c -o libnovell_la-nmevent.lo `test -f 'nmevent.c' || echo '$(srcdir)/'`nmevent.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmevent.Tpo" "$(DEPDIR)/libnovell_la-nmevent.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmevent.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmevent.c' object='libnovell_la-nmevent.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmevent.lo `test -f 'nmevent.c' || echo '$(srcdir)/'`nmevent.c - -libnovell_la-nmmessage.lo: nmmessage.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmmessage.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmmessage.Tpo" -c -o libnovell_la-nmmessage.lo `test -f 'nmmessage.c' || echo '$(srcdir)/'`nmmessage.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmmessage.Tpo" "$(DEPDIR)/libnovell_la-nmmessage.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmmessage.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmmessage.c' object='libnovell_la-nmmessage.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmmessage.lo `test -f 'nmmessage.c' || echo '$(srcdir)/'`nmmessage.c - -libnovell_la-nmrequest.lo: nmrequest.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmrequest.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmrequest.Tpo" -c -o libnovell_la-nmrequest.lo `test -f 'nmrequest.c' || echo '$(srcdir)/'`nmrequest.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmrequest.Tpo" "$(DEPDIR)/libnovell_la-nmrequest.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmrequest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmrequest.c' object='libnovell_la-nmrequest.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmrequest.lo `test -f 'nmrequest.c' || echo '$(srcdir)/'`nmrequest.c - -libnovell_la-nmrtf.lo: nmrtf.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmrtf.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmrtf.Tpo" -c -o libnovell_la-nmrtf.lo `test -f 'nmrtf.c' || echo '$(srcdir)/'`nmrtf.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmrtf.Tpo" "$(DEPDIR)/libnovell_la-nmrtf.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmrtf.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmrtf.c' object='libnovell_la-nmrtf.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmrtf.lo `test -f 'nmrtf.c' || echo '$(srcdir)/'`nmrtf.c - -libnovell_la-nmuser.lo: nmuser.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmuser.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmuser.Tpo" -c -o libnovell_la-nmuser.lo `test -f 'nmuser.c' || echo '$(srcdir)/'`nmuser.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmuser.Tpo" "$(DEPDIR)/libnovell_la-nmuser.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmuser.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmuser.c' object='libnovell_la-nmuser.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmuser.lo `test -f 'nmuser.c' || echo '$(srcdir)/'`nmuser.c - -libnovell_la-nmuserrecord.lo: nmuserrecord.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmuserrecord.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmuserrecord.Tpo" -c -o libnovell_la-nmuserrecord.lo `test -f 'nmuserrecord.c' || echo '$(srcdir)/'`nmuserrecord.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmuserrecord.Tpo" "$(DEPDIR)/libnovell_la-nmuserrecord.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmuserrecord.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmuserrecord.c' object='libnovell_la-nmuserrecord.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmuserrecord.lo `test -f 'nmuserrecord.c' || echo '$(srcdir)/'`nmuserrecord.c - -libnovell_la-novell.lo: novell.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-novell.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-novell.Tpo" -c -o libnovell_la-novell.lo `test -f 'novell.c' || echo '$(srcdir)/'`novell.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-novell.Tpo" "$(DEPDIR)/libnovell_la-novell.Plo"; else rm -f "$(DEPDIR)/libnovell_la-novell.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='novell.c' object='libnovell_la-novell.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-novell.lo `test -f 'novell.c' || echo '$(srcdir)/'`novell.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libnovell -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libnovell -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = \ - nmfield.c \ - nmconn.c \ - nmconference.c \ - nmcontact.c \ - nmevent.c \ - nmmessage.c \ - nmrequest.c \ - nmrtf.c \ - nmuser.c \ - nmuserrecord.c \ - novell.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -/* - * nmconference.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include "nmconference.h" - -static int conf_count = 0; - -struct _NMConference -{ - - /* The conference identifier */ - char *guid; - - /* The list of participants for the conference */ - GSList *participants; - - /* Flags for the conference */ - guint32 flags; - - /* User defined data */ - gpointer data; - - /* Reference count for this object */ - int ref_count; - -}; - - -/******************************************************************************* - * Conference API -- see header file for comments - ******************************************************************************/ - -NMConference * -nm_create_conference(const char *guid) -{ - NMConference *conf = g_new0(NMConference, 1); - - if (guid) { - conf->guid = g_strdup(guid); - } else { - conf->guid = g_strdup(BLANK_GUID); - } - conf->ref_count = 1; - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Creating a conference %p, total=%d\n", - conf, conf_count++); - - return conf; -} - -void -nm_release_conference(NMConference * conference) -{ - GSList *node; - - g_return_if_fail(conference != NULL); - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "In release conference %p, refs=%d\n", - conference, conference->ref_count); - if (--conference->ref_count == 0) { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Releasing conference %p, total=%d\n", - conference, --conf_count); - - if (conference->guid) - g_free(conference->guid); - - if (conference->participants) { - for (node = conference->participants; node; node = node->next) { - if (node->data) { - NMUserRecord *user_record = node->data; - - nm_release_user_record(user_record); - node->data = NULL; - } - } - - g_slist_free(conference->participants); - } - - g_free(conference); - } -} - -gboolean -nm_conference_is_instantiated(NMConference * conference) -{ - if (conference == NULL) - return FALSE; - - return (strncmp(conference->guid, BLANK_GUID, CONF_GUID_END) != 0); -} - -int -nm_conference_get_participant_count(NMConference * conference) -{ - if (conference == NULL) - return 0; - - return g_slist_length(conference->participants); -} - -NMUserRecord * -nm_conference_get_participant(NMConference * conference, int index) -{ - if (conference == NULL) - return NULL; - - return (NMUserRecord *) g_slist_nth_data(conference->participants, index); -} - -void -nm_conference_add_participant(NMConference * conference, - NMUserRecord * user_record) -{ - if (conference == NULL || user_record == NULL) { - return; - } - - nm_user_record_add_ref(user_record); - conference->participants = g_slist_append(conference->participants, user_record); -} - -void -nm_conference_remove_participant(NMConference * conference, const char *dn) -{ - GSList *node, *element = NULL; - - if (conference == NULL || dn == NULL) { - return; - } - - for (node = conference->participants; node; node = node->next) { - NMUserRecord *user_record = node->data; - - if (user_record) { - if (nm_utf8_str_equal(dn, nm_user_record_get_dn(user_record))) { - element = node; - break; - } - } - } - - if (element) { - nm_release_user_record((NMUserRecord *) element->data); - element->data = NULL; - conference->participants = - g_slist_remove_link(conference->participants, element); - g_slist_free_1(element); - } -} - -void -nm_conference_add_ref(NMConference * conference) -{ - if (conference) - conference->ref_count++; -} - -void -nm_conference_set_flags(NMConference * conference, guint32 flags) -{ - if (conference) { - conference->flags = flags; - } -} - -void -nm_conference_set_guid(NMConference * conference, const char *guid) -{ - if (conference) { - - /* Release memory for old guid */ - if (conference->guid) { - g_free(conference->guid); - } - - /* Set the new guid */ - if (guid) - conference->guid = g_strdup(guid); - else - conference->guid = g_strdup(BLANK_GUID); - } -} - -void -nm_conference_set_data(NMConference * conference, gpointer data) -{ - if (conference == NULL) - return; - - conference->data = data; -} - -gpointer -nm_conference_get_data(NMConference * conference) -{ - if (conference == NULL) - return NULL; - - return conference->data; -} - -const char * -nm_conference_get_guid(NMConference * conference) -{ - if (conference == NULL) - return NULL; - - return conference->guid; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconference.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -/* - * nmconference.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_CONFERENCE_H__ -#define __NM_CONFERENCE_H__ - -typedef struct _NMConference NMConference; - -#include "nmuserrecord.h" - -/* A blank GUID -- represents an uninstatiated conference */ -#define BLANK_GUID "[00000000-00000000-00000000-0000-0000]" - -/* This is how much of the conference GUIDs to compare when testing - * to see if two conferences are the same. We cannot compare the - * entire GUID because the last part is the session count. - */ -#define CONF_GUID_END 27 - -/** - * Creates an conference object. - * - * The conference should be released by calling - * nm_release_conference - * - * @param guid The GUID for the conference. - * - * @return The new NMConference - */ -NMConference *nm_create_conference(const char *guid); - -/** - * Increments the reference count for the conference. - * - * The reference to the conference should be released - * by calling nm_release_conference - * - * @param conference The conference to reference - */ -void nm_conference_add_ref(NMConference * conference); - -/** - * Releases the resources associated with the conference - * if there are no more references to it, otherwise just - * decrements the reference count. - * - * @param conf The conference to release - * - */ -void nm_release_conference(NMConference * conf); - -/** - * Set the GUID for the conference. - * - * @param conference The conference - * @param guid The new conference GUID - * - */ -void nm_conference_set_guid(NMConference * conference, const char *guid); - -/** - * Return the GUID for the conference. - * - * @param conference The conference - * - * @return The GUID for the conference - */ -const char *nm_conference_get_guid(NMConference * conference); - -/** - * Add a participant to the conference. - * - * @param conference The conference - * @param user_record The user record to add as a participant - * - * @return - */ -void nm_conference_add_participant(NMConference * conference, - NMUserRecord * user_record); - -/** - * Remove a participant to the conference. - * - * @param conference The conference - * @param dn The dn of the participant to remove - * - */ -void nm_conference_remove_participant(NMConference * conference, const char *dn); - -/** - * Return the total number of participants in the conference. - * - * @param conference The conference - * - * @return The number of participants for the conference - * - */ -int nm_conference_get_participant_count(NMConference * conference); - -/** - * Return a participant given an index. - * - * @param conference The conference - * @param index The index of the participant to get - * - * @return The participant or NULL if the index is out of range. - * - */ -NMUserRecord *nm_conference_get_participant(NMConference * conference, int index); - -/** - * Check to see if the conference has been instantiated - * - * @param conference The conference - * - * @return TRUE if the conference has been instantiated, - * FALSE otherwise. - * - */ -gboolean nm_conference_is_instantiated(NMConference * conf); - -/** - * Set the flags for the conference. - * - * @param conference The conference - * @param flags The conference flags. - * - */ -void nm_conference_set_flags(NMConference * conference, guint32 flags); - -/** - * Set the user defined data for the conference. - * - * @param conference The conference - * @param data User defined data - * - */ -void nm_conference_set_data(NMConference * conference, gpointer data); - -/** - * Get the user defined data for the conference. - * - * @param conference The conference - * - * @return The data if it has been set, NULL otherwise. - * - */ -gpointer nm_conference_get_data(NMConference * conference); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,701 +0,0 @@ -/* - * nmconn.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include "nmconn.h" - -#ifdef _WIN32 -#include -#endif - -#define NO_ESCAPE(ch) ((ch == 0x20) || (ch >= 0x30 && ch <= 0x39) || \ - (ch >= 0x41 && ch <= 0x5a) || (ch >= 0x61 && ch <= 0x7a)) - -/* Read data from conn until the end of a line */ -static NMERR_T -read_line(NMConn * conn, char *buff, int len) -{ - NMERR_T rc = NM_OK; - int total_bytes = 0; - - while ((rc == NM_OK) && (total_bytes < (len - 1))) { - rc = nm_read_all(conn, &buff[total_bytes], 1); - if (rc == NM_OK) { - total_bytes += 1; - if (buff[total_bytes - 1] == '\n') { - break; - } - } - } - buff[total_bytes] = '\0'; - - return rc; -} - -static char * -url_escape_string(char *src) -{ - guint32 escape = 0; - char *p; - char *q; - char *encoded = NULL; - int ch; - - static const char hex_table[16] = "0123456789abcdef"; - - if (src == NULL) { - return NULL; - } - - /* Find number of chars to escape */ - for (p = src; *p != '\0'; p++) { - ch = (guchar) *p; - if (!NO_ESCAPE(ch)) { - escape++; - } - } - - encoded = g_malloc((p - src) + (escape * 2) + 1); - - /* Escape the string */ - for (p = src, q = encoded; *p != '\0'; p++) { - ch = (guchar) * p; - if (NO_ESCAPE(ch)) { - if (ch != 0x20) { - *q = ch; - q++; - } else { - *q = '+'; - q++; - } - } else { - *q = '%'; - q++; - - *q = hex_table[ch >> 4]; - q++; - - *q = hex_table[ch & 15]; - q++; - } - } - *q = '\0'; - - return encoded; -} - -static char * -encode_method(guint8 method) -{ - char *str; - - switch (method) { - case NMFIELD_METHOD_EQUAL: - str = "G"; - break; - case NMFIELD_METHOD_UPDATE: - str = "F"; - break; - case NMFIELD_METHOD_GTE: - str = "E"; - break; - case NMFIELD_METHOD_LTE: - str = "D"; - break; - case NMFIELD_METHOD_NE: - str = "C"; - break; - case NMFIELD_METHOD_EXIST: - str = "B"; - break; - case NMFIELD_METHOD_NOTEXIST: - str = "A"; - break; - case NMFIELD_METHOD_SEARCH: - str = "9"; - break; - case NMFIELD_METHOD_MATCHBEGIN: - str = "8"; - break; - case NMFIELD_METHOD_MATCHEND: - str = "7"; - break; - case NMFIELD_METHOD_NOT_ARRAY: - str = "6"; - break; - case NMFIELD_METHOD_OR_ARRAY: - str = "5"; - break; - case NMFIELD_METHOD_AND_ARRAY: - str = "4"; - break; - case NMFIELD_METHOD_DELETE_ALL: - str = "3"; - break; - case NMFIELD_METHOD_DELETE: - str = "2"; - break; - case NMFIELD_METHOD_ADD: - str = "1"; - break; - default: /* NMFIELD_METHOD_VALID */ - str = "0"; - break; - } - - return str; -} - -NMConn * -nm_create_conn(const char *addr, int port) -{ - NMConn *conn = g_new0(NMConn, 1); - conn->addr = g_strdup(addr); - conn->port = port; - return conn; -} - -void nm_release_conn(NMConn *conn) -{ - if (conn) { - GSList *node; - for (node = conn->requests; node; node = node->next) { - if (node->data) - nm_release_request(node->data); - } - g_slist_free(conn->requests); - conn->requests = NULL; - if (conn->ssl_conn) { - g_free(conn->ssl_conn); - conn->ssl_conn = NULL; - } - g_free(conn->addr); - conn->addr = NULL; - g_free(conn); - } -} - -int -nm_tcp_write(NMConn * conn, const void *buff, int len) -{ - if (conn == NULL || buff == NULL) - return -1; - - if (!conn->use_ssl) - return (write(conn->fd, buff, len)); - else if (conn->ssl_conn && conn->ssl_conn->write) - return (conn->ssl_conn->write(conn->ssl_conn->data, buff, len)); - else - return -1; -} - -int -nm_tcp_read(NMConn * conn, void *buff, int len) -{ - if (conn == NULL || buff == NULL) - return -1; - - if (!conn->use_ssl) - return (read(conn->fd, buff, len)); - else if (conn->ssl_conn && conn->ssl_conn->read) - return ((conn->ssl_conn->read)(conn->ssl_conn->data, buff, len)); - else - return -1; -} - -NMERR_T -nm_read_all(NMConn * conn, char *buff, int len) -{ - NMERR_T rc = NM_OK; - int bytes_left = len; - int bytes_read; - int total_bytes = 0; - int retry = 1000; - - if (conn == NULL || buff == NULL) - return NMERR_BAD_PARM; - - /* Keep reading until buffer is full */ - while (bytes_left) { - bytes_read = nm_tcp_read(conn, &buff[total_bytes], bytes_left); - if (bytes_read > 0) { - bytes_left -= bytes_read; - total_bytes += bytes_read; - } else { - if (errno == EAGAIN) { - if (--retry == 0) { - rc = NMERR_TCP_READ; - break; - } -#ifdef _WIN32 - Sleep(1); -#else - usleep(1000); -#endif - } else { - rc = NMERR_TCP_READ; - break; - } - } - } - return rc; -} - -NMERR_T -nm_read_uint32(NMConn *conn, guint32 *val) -{ - NMERR_T rc = NM_OK; - - rc = nm_read_all(conn, (char *)val, sizeof(*val)); - if (rc == NM_OK) { - *val = GUINT32_FROM_LE(*val); - } - - return rc; -} - -NMERR_T -nm_read_uint16(NMConn *conn, guint16 *val) -{ - NMERR_T rc = NM_OK; - - rc = nm_read_all(conn, (char *)val, sizeof(*val)); - if (rc == NM_OK) { - *val = GUINT16_FROM_LE(*val); - } - - return rc; -} - -NMERR_T -nm_write_fields(NMConn * conn, NMField * fields) -{ - NMERR_T rc = NM_OK; - NMField *field; - char *value = NULL; - char *method = NULL; - char buffer[4096]; - int ret; - int bytes_to_send; - int val = 0; - - if (conn == NULL || fields == NULL) { - return NMERR_BAD_PARM; - } - - /* Format each field as valid "post" data and write it out */ - for (field = fields; (rc == NM_OK) && (field->tag); field++) { - - /* We don't currently handle binary types */ - if (field->method == NMFIELD_METHOD_IGNORE || - field->type == NMFIELD_TYPE_BINARY) { - continue; - } - - /* Write the field tag */ - bytes_to_send = g_snprintf(buffer, sizeof(buffer), "&tag=%s", field->tag); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - /* Write the field method */ - if (rc == NM_OK) { - method = encode_method(field->method); - bytes_to_send = g_snprintf(buffer, sizeof(buffer), "&cmd=%s", method); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - - /* Write the field value */ - if (rc == NM_OK) { - switch (field->type) { - case NMFIELD_TYPE_UTF8: - case NMFIELD_TYPE_DN: - - value = url_escape_string((char *) field->ptr_value); - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&val=%s", value); - if (bytes_to_send > (int)sizeof(buffer)) { - ret = nm_tcp_write(conn, buffer, sizeof(buffer)); - } else { - ret = nm_tcp_write(conn, buffer, bytes_to_send); - } - - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - g_free(value); - - break; - - case NMFIELD_TYPE_ARRAY: - case NMFIELD_TYPE_MV: - - val = nm_count_fields((NMField *) field->ptr_value); - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&val=%u", val); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - break; - - default: - - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&val=%u", field->value); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - break; - } - } - - /* Write the field type */ - if (rc == NM_OK) { - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&type=%u", field->type); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - - /* If the field is a sub array then post its fields */ - if (rc == NM_OK && val > 0) { - if (field->type == NMFIELD_TYPE_ARRAY || - field->type == NMFIELD_TYPE_MV) { - - rc = nm_write_fields(conn, (NMField *) field->ptr_value); - - } - } - } - - return rc; -} - -NMERR_T -nm_send_request(NMConn *conn, char *cmd, NMField *fields, - nm_response_cb cb, gpointer data, NMRequest **request) -{ - NMERR_T rc = NM_OK; - char buffer[512]; - int bytes_to_send; - int ret; - NMField *request_fields = NULL; - char *str = NULL; - - if (conn == NULL || cmd == NULL) - return NMERR_BAD_PARM; - - /* Write the post */ - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "POST /%s HTTP/1.0\r\n", cmd); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - /* Write headers */ - if (rc == NM_OK) { - if (strcmp("login", cmd) == 0) { - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "Host: %s:%d\r\n\r\n", conn->addr, conn->port); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } else { - bytes_to_send = g_snprintf(buffer, sizeof(buffer), "\r\n"); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - } - - /* Add the transaction id to the request fields */ - if (rc == NM_OK) { - if (fields) - request_fields = nm_copy_field_array(fields); - - str = g_strdup_printf("%d", ++(conn->trans_id)); - request_fields = nm_field_add_pointer(request_fields, NM_A_SZ_TRANSACTION_ID, 0, - NMFIELD_METHOD_VALID, 0, - str, NMFIELD_TYPE_UTF8); - } - - /* Send the request to the server */ - if (rc == NM_OK) { - rc = nm_write_fields(conn, request_fields); - } - - /* Write the CRLF to terminate the data */ - if (rc == NM_OK) { - ret = nm_tcp_write(conn, "\r\n", strlen("\r\n")); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - - /* Create a request struct, add it to our queue, and return it */ - if (rc == NM_OK) { - NMRequest *new_request = nm_create_request(cmd, conn->trans_id, - time(0), cb, NULL, data); - nm_conn_add_request_item(conn, new_request); - - /* Set the out param if it was sent in, otherwise release the request */ - if (request) - *request = new_request; - else - nm_release_request(new_request); - } - - if (request_fields != NULL) - nm_free_fields(&request_fields); - - return rc; -} - -NMERR_T -nm_read_header(NMConn * conn) -{ - NMERR_T rc = NM_OK; - char buffer[512]; - char *ptr = NULL; - int i; - char rtn_buf[8]; - int rtn_code = 0; - - if (conn == NULL) - return NMERR_BAD_PARM; - - *buffer = '\0'; - rc = read_line(conn, buffer, sizeof(buffer)); - if (rc == NM_OK) { - - /* Find the return code */ - ptr = strchr(buffer, ' '); - if (ptr != NULL) { - ptr++; - - i = 0; - while (isdigit(*ptr) && (i < 3)) { - rtn_buf[i] = *ptr; - i++; - ptr++; - } - rtn_buf[i] = '\0'; - - if (i > 0) - rtn_code = atoi(rtn_buf); - } - } - - /* Finish reading header, in the future we might want to do more processing here */ - /* TODO: handle more general redirects in the future */ - while ((rc == NM_OK) && (strcmp(buffer, "\r\n") != 0)) { - rc = read_line(conn, buffer, sizeof(buffer)); - } - - if (rc == NM_OK && rtn_code == 301) - rc = NMERR_SERVER_REDIRECT; - - return rc; -} - -NMERR_T -nm_read_fields(NMConn * conn, int count, NMField ** fields) -{ - NMERR_T rc = NM_OK; - guint8 type; - guint8 method; - guint32 val; - char tag[64]; - NMField *sub_fields = NULL; - char *str = NULL; - - if (conn == NULL || fields == NULL) - return NMERR_BAD_PARM; - - do { - if (count > 0) { - count--; - } - - /* Read the field type, method, and tag */ - rc = nm_read_all(conn, (char *)&type, sizeof(type)); - if (rc != NM_OK || type == 0) - break; - - rc = nm_read_all(conn, (char *)&method, sizeof(method)); - if (rc != NM_OK) - break; - - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - if (val > sizeof(tag)) { - rc = NMERR_PROTOCOL; - break; - } - - rc = nm_read_all(conn, tag, val); - if (rc != NM_OK) - break; - - if (type == NMFIELD_TYPE_MV || type == NMFIELD_TYPE_ARRAY) { - - /* Read the subarray (first read the number of items in the array) */ - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - if (val > 0) { - rc = nm_read_fields(conn, val, &sub_fields); - if (rc != NM_OK) - break; - } - - *fields = nm_field_add_pointer(*fields, tag, 0, method, - 0, sub_fields, type); - - sub_fields = NULL; - - } else if (type == NMFIELD_TYPE_UTF8 || type == NMFIELD_TYPE_DN) { - - /* Read the string (first read the length) */ - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - if (val >= NMFIELD_MAX_STR_LENGTH) { - rc = NMERR_PROTOCOL; - break; - } - - if (val > 0) { - str = g_new0(char, val + 1); - - rc = nm_read_all(conn, str, val); - if (rc != NM_OK) - break; - - *fields = nm_field_add_pointer(*fields, tag, 0, method, - 0, str, type); - str = NULL; - } - - } else { - - /* Read the numerical value */ - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - *fields = nm_field_add_number(*fields, tag, 0, method, - 0, val, type); - } - - } while ((type != 0) && (count != 0)); - - - if (str != NULL) { - g_free(str); - } - - if (sub_fields != NULL) { - nm_free_fields(&sub_fields); - } - - return rc; -} - -void -nm_conn_add_request_item(NMConn * conn, NMRequest * request) -{ - if (conn == NULL || request == NULL) - return; - - nm_request_add_ref(request); - conn->requests = g_slist_append(conn->requests, request); -} - -void -nm_conn_remove_request_item(NMConn * conn, NMRequest * request) -{ - if (conn == NULL || request == NULL) - return; - - conn->requests = g_slist_remove(conn->requests, request); - nm_release_request(request); -} - -NMRequest * -nm_conn_find_request(NMConn * conn, int trans_id) -{ - NMRequest *req = NULL; - GSList *itr = NULL; - - if (conn == NULL) - return NULL; - - itr = conn->requests; - while (itr) { - req = (NMRequest *) itr->data; - if (req != NULL && nm_request_get_trans_id(req) == trans_id) { - return req; - } - itr = g_slist_next(itr); - } - return NULL; -} - -const char * -nm_conn_get_addr(NMConn * conn) -{ - if (conn == NULL) - return NULL; - else - return conn->addr; -} - -int -nm_conn_get_port(NMConn * conn) -{ - if (conn == NULL) - return -1; - else - return conn->port; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* - * nmconn.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_CONN_H__ -#define __NM_CONN_H__ - -typedef struct _NMConn NMConn; -typedef struct _NMSSLConn NMSSLConn; - -#include "nmfield.h" -#include "nmuser.h" - -typedef int (*nm_ssl_read_cb) (gpointer ssl_data, void *buff, int len); -typedef int (*nm_ssl_write_cb) (gpointer ssl_data, const void *buff, int len); - -struct _NMConn -{ - - /* The address of the server that we are connecting to. */ - char *addr; - - /* The port that we are connecting to. */ - int port; - - /* The file descriptor of the socket for the connection. */ - int fd; - - /* The transaction counter. */ - int trans_id; - - /* A list of requests currently awaiting a response. */ - GSList *requests; - - /* Are we connected? TRUE if so, FALSE if not. */ - gboolean connected; - - /* Are we running in secure mode? */ - gboolean use_ssl; - - /* Have we been redirected? */ - gboolean redirect; - - /* SSL connection */ - NMSSLConn *ssl_conn; - -}; - -struct _NMSSLConn -{ - - /* Data to pass to the callbacks */ - gpointer data; - - /* Callbacks for reading/writing */ - nm_ssl_read_cb read; - nm_ssl_write_cb write; - -}; - -/** - * Allocate a new NMConn struct - * - * @param The address of the server that we are connecting to. - * @param The port that we are connecting to. - * - * @return A pointer to a newly allocated NMConn struct, should - * be freed by calling nm_release_conn() - */ -NMConn *nm_create_conn(const char *addr, int port); - -/** - * Release an NMConn - * - * @param Pointer to the NMConn to release. - * - */ -void nm_release_conn(NMConn *conn); - -/** - * Write len bytes from the given buffer. - * - * @param conn The connection to write to. - * @param buff The buffer to write from. - * @param len The number of bytes to write. - * - * @return The number of bytes written. - */ -int nm_tcp_write(NMConn * conn, const void *buff, int len); - -/** - * Read at most len bytes into the given buffer. - * - * @param conn The connection to read from. - * @param buff The buffer to write to. - * @param len The maximum number of bytes to read. - * - * @return The number of bytes read. - */ -int nm_tcp_read(NMConn * conn, void *buff, int len); - -/** - * Read exactly len bytes into the given buffer. - * - * @param conn The connection to read from. - * @param buff The buffer to write to. - * @param len The number of bytes to read. - * - * @return NM_OK on success, NMERR_TCP_READ if read fails. - */ -NMERR_T nm_read_all(NMConn * conn, char *buf, int len); - -/** - * Read a 32 bit value and convert it to the host byte order. - * - * @param conn The connection to read from. - * @param val A pointer to unsigned 32 bit integer - * - * @return NM_OK on success, NMERR_TCP_READ if read fails. - */ -NMERR_T -nm_read_uint32(NMConn *conn, guint32 *val); - -/** - * Read a 16 bit value and convert it to the host byte order. - * - * @param conn The connection to read from. - * @param val A pointer to unsigned 16 bit integer - * - * @return NM_OK on success, NMERR_TCP_READ if read fails. - */ -NMERR_T -nm_read_uint16(NMConn *conn, guint16 *val); - -/** - * Dispatch a request to the server. - * - * @param conn The connection. - * @param cmd The request to dispatch. - * @param fields The field list for the request. - * @param cb The response callback for the new request object. - * @param data The user defined data for the request (to be passed to the resp cb). - * @param req The request. Should be freed with nm_release_request. - * - * @return NM_OK on success. - */ -NMERR_T -nm_send_request(NMConn *conn, char *cmd, NMField *fields, - nm_response_cb cb, gpointer data, NMRequest **request); - -/** - * Write out the given field list. - * - * @param conn The connection to write to. - * @param fields The field list to write. - * - * @return NM_OK on success. - */ -NMERR_T nm_write_fields(NMConn * conn, NMField * fields); - -/** - * Read the headers for a response. - * - * @param conn The connection to read from. - * - * @return NM_OK on success. - */ -NMERR_T nm_read_header(NMConn * conn); - -/** - * Read a field list from the connection. - * - * @param conn The connection to read from. - * @param count The maximum number of fields to read (or -1 for no max). - * @param fields The field list. This is an out param. It - * should be freed by calling nm_free_fields - * when finished. - * - * @return NM_OK on success. - */ -NMERR_T nm_read_fields(NMConn * conn, int count, NMField ** fields); - -/** - * Add a request to the connections request list. - * - * @param conn The connection. - * @param request The request to add to the list. - */ -void nm_conn_add_request_item(NMConn * conn, NMRequest * request); - -/** - * Remove a request from the connections list. - * - * @param conn The connection. - * @param request The request to remove from the list. - */ -void nm_conn_remove_request_item(NMConn * conn, NMRequest * request); - -/** - * Find the request with the given transaction id in the connections - * request list. - * - * @param conn The connection. - * @param trans_id The transaction id of the request to return. - * - * @return The request, or NULL if a matching request is not - * found. - */ -NMRequest *nm_conn_find_request(NMConn * conn, int trans_id); - -/** - * Get the server address for the connection. - * - * @param conn The connection. - * - * @return The server address for the connection. - * - */ -const char *nm_conn_get_addr(NMConn * conn); - -/** - * Get the port for the connection. - * - * @param conn The connection. - * - * @return The port that we are connected to. - */ -int nm_conn_get_port(NMConn * conn); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,972 +0,0 @@ -/* - * nmcontact.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include "nmcontact.h" -#include "nmfield.h" -#include "nmuser.h" - -struct _NMContact -{ - int id; - int parent_id; - int seq; - char *dn; - char *display_name; - NMUserRecord *user_record; - gpointer data; - int ref_count; -}; - -struct _NMFolder -{ - int id; - int seq; - char *name; - GSList *folders; - GSList *contacts; - int ref_count; -}; - -static int count = 0; - -static void _release_folder_contacts(NMFolder * folder); -static void _release_folder_folders(NMFolder * folder); -static void _add_contacts(NMUser * user, NMFolder * folder, NMField * fields); -static void _add_folders(NMFolder * root, NMField * fields); - -/********************************************************************* - * Contact API - *********************************************************************/ - -NMContact * -nm_create_contact() -{ - NMContact *contact = g_new0(NMContact, 1); - - contact->ref_count = 1; - - purple_debug(PURPLE_DEBUG_INFO, "novell", "Creating contact, total=%d\n", - count++); - - return contact; -} - -/* - * This creates a contact for the contact list. The - * field array that is passed in should be a - * NM_A_FA_CONTACT array. - * - */ -NMContact * -nm_create_contact_from_fields(NMField * fields) -{ - NMContact *contact; - NMField *field; - - if ( fields == NULL || fields->tag == NULL || fields->ptr_value == 0 || - strcmp(fields->tag, NM_A_FA_CONTACT) ) - { - return NULL; - } - - contact = nm_create_contact(); - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->id = atoi((char *) field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_PARENT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->parent_id = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->seq = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->display_name = g_strdup((char *) field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_DN, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->dn = g_strdup((char *) field->ptr_value); - - } - - return contact; -} - -void -nm_contact_update_list_properties(NMContact * contact, NMField * fields) -{ - NMField *field; - - if (contact == NULL || fields == NULL || fields->ptr_value == 0) - return; - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->id = atoi((char *)field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_PARENT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->parent_id = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->seq = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) { - if (contact->display_name) - g_free(contact->display_name); - - contact->display_name = g_strdup((char *) field->ptr_value); - } - - } - - if ((field = nm_locate_field(NM_A_SZ_DN, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) { - if (contact->dn) - g_free(contact->dn); - - contact->dn = g_strdup((char *) field->ptr_value); - } - - } -} - -NMField * -nm_contact_to_fields(NMContact * contact) -{ - NMField *fields = NULL; - - if (contact == NULL) - return NULL; - - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", contact->id), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", contact->parent_id), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", contact->seq), NMFIELD_TYPE_UTF8); - - if (contact->display_name != NULL) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(contact->display_name), NMFIELD_TYPE_UTF8); - } - - if (contact->dn != NULL) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(contact->dn), NMFIELD_TYPE_UTF8); - } - - return fields; -} - -void -nm_contact_add_ref(NMContact * contact) -{ - if (contact) - contact->ref_count++; -} - -void -nm_release_contact(NMContact * contact) -{ - if (contact == NULL) - return; - - if (--(contact->ref_count) == 0) { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Releasing contact, total=%d\n", --count); - - if (contact->display_name) { - g_free(contact->display_name); - } - - if (contact->dn) { - g_free(contact->dn); - } - - if (contact->user_record) { - nm_release_user_record(contact->user_record); - } - - g_free(contact); - } - -} - -const char * -nm_contact_get_display_name(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - if (contact->user_record != NULL && contact->display_name == NULL) { - const char *full_name, *lname, *fname, *cn, *display_id; - - full_name = nm_user_record_get_full_name(contact->user_record); - fname = nm_user_record_get_first_name(contact->user_record); - lname = nm_user_record_get_last_name(contact->user_record); - cn = nm_user_record_get_userid(contact->user_record); - display_id = nm_user_record_get_display_id(contact->user_record); - - /* Try to build a display name. */ - if (full_name) { - - contact->display_name = g_strdup(full_name); - - } else if (fname && lname) { - - contact->display_name = g_strdup_printf("%s %s", fname, lname); - - } else { - - /* If auth attribute is set use it */ - if (nm_user_record_get_auth_attr(contact->user_record) && - display_id != NULL) { - - contact->display_name = g_strdup(display_id); - - } else { - - /* Use CN or display id */ - if (cn) { - - contact->display_name = g_strdup(cn); - - } else if (display_id) { - - contact->display_name = g_strdup(display_id); - - } - - } - - } - } - - return contact->display_name; -} - -void -nm_contact_set_display_name(NMContact * contact, const char *display_name) -{ - if (contact == NULL) - return; - - if (contact->display_name) { - g_free(contact->display_name); - contact->display_name = NULL; - } - - if (display_name) - contact->display_name = g_strdup(display_name); -} - -void -nm_contact_set_dn(NMContact * contact, const char *dn) -{ - if (contact == NULL) - return; - - if (contact->dn) { - g_free(contact->dn); - contact->dn = NULL; - } - - if (dn) - contact->dn = g_strdup(dn); -} - -const char * -nm_contact_get_dn(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - return contact->dn; -} - -gpointer -nm_contact_get_data(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - return contact->data; -} - -int -nm_contact_get_id(NMContact * contact) -{ - if (contact == NULL) - return -1; - - return contact->id; -} - -int -nm_contact_get_parent_id(NMContact * contact) -{ - if (contact == NULL) - return -1; - - return contact->parent_id; -} - -void -nm_contact_set_data(NMContact * contact, gpointer data) -{ - if (contact == NULL) - return; - - contact->data = data; -} - -void -nm_contact_set_user_record(NMContact * contact, NMUserRecord * user_record) -{ - if (contact == NULL) - return; - - if (contact->user_record) { - nm_release_user_record(contact->user_record); - } - - nm_user_record_add_ref(user_record); - contact->user_record = user_record; -} - -NMUserRecord * -nm_contact_get_user_record(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - return contact->user_record; -} - -const char * -nm_contact_get_userid(NMContact * contact) -{ - NMUserRecord *user_record; - const char *userid = NULL; - - if (contact == NULL) - return NULL; - - user_record = nm_contact_get_user_record(contact); - if (user_record) { - userid = nm_user_record_get_userid(user_record); - } - - return userid; -} - -const char * -nm_contact_get_display_id(NMContact * contact) -{ - NMUserRecord *user_record; - const char *id = NULL; - - if (contact == NULL) - return NULL; - - user_record = nm_contact_get_user_record(contact); - if (user_record) { - id = nm_user_record_get_display_id(user_record); - } - - return id; -} - - -/********************************************************************* - * Folder API - *********************************************************************/ - -NMFolder * -nm_create_folder(const char *name) -{ - NMFolder *folder = g_new0(NMFolder, 1); - - if (name) - folder->name = g_strdup(name); - - folder->ref_count = 1; - - return folder; -} - -NMFolder * -nm_create_folder_from_fields(NMField * fields) -{ - NMField *field; - NMFolder *folder; - - if (fields == NULL || fields->ptr_value == 0) - return NULL; - - folder = g_new0(NMFolder, 1); - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->id = atoi((char *) field->ptr_value); - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->seq = atoi((char *) field->ptr_value); - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->name = g_strdup((char *) field->ptr_value); - } - - folder->ref_count = 1; - return folder; -} - -NMField * -nm_folder_to_fields(NMFolder * folder) -{ - NMField *fields = NULL; - - if (folder == NULL) - return NULL; - - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", folder->id), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("0"), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_TYPE, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("1"), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", folder->seq), NMFIELD_TYPE_UTF8); - - if (folder->name != NULL) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(folder->name), NMFIELD_TYPE_UTF8); - } - - - return fields; -} - -void -nm_folder_update_list_properties(NMFolder * folder, NMField * fields) -{ - NMField *field; - - if (folder == NULL || fields == NULL || fields->ptr_value == 0) - return; - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->id = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->seq = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) { - if (folder->name) - g_free(folder->name); - - folder->name = g_strdup((char *) field->ptr_value); - } - - } - -} - -void -nm_release_folder(NMFolder * folder) -{ - if (folder == NULL) - return; - - if (--(folder->ref_count) == 0) { - if (folder->name) { - g_free(folder->name); - } - - if (folder->folders) { - _release_folder_folders(folder); - } - - if (folder->contacts) { - _release_folder_contacts(folder); - } - - g_free(folder); - } -} - - -void -nm_folder_add_ref(NMFolder * folder) -{ - if (folder) - folder->ref_count++; -} - -int -nm_folder_get_subfolder_count(NMFolder * folder) -{ - if (folder == NULL) - return 0; - - if (folder->folders) - return g_slist_length(folder->folders); - else - return 0; -} - -NMFolder * -nm_folder_get_subfolder(NMFolder * folder, int index) -{ - if (folder == NULL) - return NULL; - - if (folder->folders) - return (NMFolder *) g_slist_nth_data(folder->folders, index); - else - return NULL; -} - -int -nm_folder_get_contact_count(NMFolder * folder) -{ - if (folder == NULL) - return 0; - - if (folder->contacts != NULL) - return g_slist_length(folder->contacts); - else - return 0; -} - -NMContact * -nm_folder_get_contact(NMFolder * folder, int index) -{ - if (folder == NULL) - return NULL; - - if (folder->contacts) - return (NMContact *) g_slist_nth_data(folder->contacts, index); - else - return NULL; -} - -const char * -nm_folder_get_name(NMFolder * folder) -{ - if (folder == NULL) - return NULL; - - return folder->name; -} - -void -nm_folder_set_name(NMFolder * folder, const char *name) -{ - if (folder == NULL || name == NULL) - return; - - if (folder->name) - g_free(folder->name); - - folder->name = g_strdup(name); -} - -int -nm_folder_get_id(NMFolder * folder) -{ - if (folder == NULL) { - return -1; - } - - return folder->id; -} - -void -nm_folder_add_folder_to_list(NMFolder * root, NMFolder * folder) -{ - GSList *node; - - if (root == NULL || folder == NULL) - return; - - node = root->folders; - while (node) { - if (folder->seq <= ((NMFolder *) node->data)->seq) { - nm_folder_add_ref(folder); - root->folders = g_slist_insert_before(root->folders, node, folder); - break; - } - node = g_slist_next(node); - } - if (node == NULL) { - nm_folder_add_ref(folder); - root->folders = g_slist_append(root->folders, folder); - } -} - -void -nm_folder_remove_contact(NMFolder * folder, NMContact * contact) -{ - GSList *node; - - if (folder == NULL || contact == NULL) - return; - - node = folder->contacts; - while (node) { - if (contact->id == ((NMContact *) (node->data))->id) { - folder->contacts = g_slist_remove(folder->contacts, node->data); - nm_release_contact(contact); - break; - } - node = g_slist_next(node); - } -} - -void -nm_folder_add_contact_to_list(NMFolder * root_folder, NMContact * contact) -{ - GSList *node = NULL; - NMFolder *folder = root_folder; - - if (folder == NULL || contact == NULL) - return; - - /* Find folder to add contact to */ - if (contact->parent_id != 0) { - node = folder->folders; - while (node) { - folder = (NMFolder *) node->data; - if (contact->parent_id == folder->id) { - break; - } - folder = NULL; - node = g_slist_next(node); - } - } - - /* Add contact to list */ - if (folder) { - node = folder->contacts; - while (node) { - if (contact->seq <= ((NMContact *) (node->data))->seq) { - nm_contact_add_ref(contact); - folder->contacts = - g_slist_insert_before(folder->contacts, node, contact); - break; - } - node = g_slist_next(node); - } - - if (node == NULL) { - nm_contact_add_ref(contact); - folder->contacts = g_slist_append(folder->contacts, contact); - } - } -} - -void -nm_folder_add_contacts_and_folders(NMUser * user, NMFolder * root, - NMField * fields) -{ - /* Add the contacts and folders from the field array */ - if (user && root && fields) { - _add_folders(root, fields); - _add_contacts(user, root, fields); - } -} - -gpointer -nm_folder_find_item_by_object_id(NMFolder * root_folder, int object_id) -{ - int cnt, cnt2, i, j; - gpointer item = NULL; - NMFolder *folder; - NMContact *contact; - - if (root_folder == NULL) - return NULL; - - /* Check all contacts for the top level folder */ - cnt = nm_folder_get_contact_count(root_folder); - for (i = 0; i < cnt; i++) { - contact = nm_folder_get_contact(root_folder, i); - if (contact && (contact->id == object_id)) { - item = contact; - break; - } - } - - /* If we haven't found the item yet, check the subfolders */ - if (item == NULL) { - cnt = nm_folder_get_subfolder_count(root_folder); - for (i = 0; (i < cnt) && (item == NULL); i++) { - folder = nm_folder_get_subfolder(root_folder, i); - - /* Check the id of this folder */ - if (folder && (folder->id == object_id)) { - item = folder; - break; - } - - /* Check all contacts for this folder */ - cnt2 = nm_folder_get_contact_count(folder); - for (j = 0; j < cnt2; j++) { - contact = nm_folder_get_contact(folder, j); - if (contact && (contact->id == object_id)) { - item = contact; - break; - } - } - } - } - - return item; -} - -NMContact * -nm_folder_find_contact_by_userid(NMFolder * folder, const char *userid) -{ - int cnt, i; - NMContact *tmp, *contact = NULL; - - if (folder == NULL || userid == NULL) - return NULL; - - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - tmp = nm_folder_get_contact(folder, i); - if (tmp && nm_utf8_str_equal(nm_contact_get_userid(tmp), userid)) { - contact = tmp; - break; - } - } - - return contact; -} - -NMContact * -nm_folder_find_contact_by_display_id(NMFolder * folder, const char *display_id) -{ - int cnt, i; - NMContact *tmp, *contact = NULL; - - if (folder == NULL || display_id == NULL) - return NULL; - - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - tmp = nm_folder_get_contact(folder, i); - if (tmp && nm_utf8_str_equal(nm_contact_get_display_id(tmp), display_id)) { - contact = tmp; - break; - } - } - - return contact; -} - -NMContact * -nm_folder_find_contact(NMFolder * folder, const char *dn) -{ - int cnt, i; - NMContact *tmp, *contact = NULL; - - if (folder == NULL || dn == NULL) - return NULL; - - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - tmp = nm_folder_get_contact(folder, i); - if (tmp && nm_utf8_str_equal(nm_contact_get_dn(tmp), dn)) { - contact = tmp; - break; - } - } - - return contact; -} - - -/********************************************************************* - * Utility functions - *********************************************************************/ - -static void -_release_folder_contacts(NMFolder * folder) -{ - GSList *cnode; - NMContact *contact; - - for (cnode = folder->contacts; cnode; cnode = cnode->next) { - contact = cnode->data; - cnode->data = NULL; - nm_release_contact(contact); - } - - g_slist_free(folder->contacts); - folder->contacts = NULL; -} - -static void -_release_folder_folders(NMFolder * folder) -{ - GSList *fnode; - NMFolder *subfolder; - - if (folder == NULL) - return; - - for (fnode = folder->folders; fnode; fnode = fnode->next) { - subfolder = fnode->data; - fnode->data = NULL; - nm_release_folder(subfolder); - } - - g_slist_free(folder->folders); - folder->folders = NULL; -} - -static void -_add_folders(NMFolder * root, NMField * fields) -{ - NMFolder *folder = NULL; - NMField *locate = NULL; - - locate = nm_locate_field(NM_A_FA_FOLDER, fields); - while (locate != NULL) { - - /* Create a new folder */ - folder = nm_create_folder_from_fields(locate); - - /* Add subfolder to roots folder list */ - nm_folder_add_folder_to_list(root, folder); - - /* Decrement the ref count */ - nm_release_folder(folder); - - /* Find the next folder */ - locate = nm_locate_field(NM_A_FA_FOLDER, locate+1); - - } -} - -static void -_add_contacts(NMUser * user, NMFolder * folder, NMField * fields) -{ - NMContact *contact = NULL; - NMField *locate = NULL, *details; - NMUserRecord *user_record = NULL; - - locate = nm_locate_field(NM_A_FA_CONTACT, fields); - while (locate != NULL) { - - /* Create a new contact from the fields */ - contact = nm_create_contact_from_fields(locate); - - /* Add it to our contact list */ - nm_folder_add_contact_to_list(folder, contact); - - /* Update the contact cache */ - nm_user_add_contact(user, contact); - - /* Update the user record cache */ - if ((details = nm_locate_field(NM_A_FA_USER_DETAILS, - (NMField *) locate->ptr_value))) { - user_record = nm_find_user_record(user, nm_contact_get_dn(contact)); - if (user_record == NULL) { - user_record = nm_create_user_record_from_fields(details); - nm_user_record_set_dn(user_record, nm_contact_get_dn(contact)); - nm_user_add_user_record(user, user_record); - nm_release_user_record(user_record); - } - nm_contact_set_user_record(contact, user_record); - } - - nm_release_contact(contact); - - locate = nm_locate_field(NM_A_FA_CONTACT, locate+1); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmcontact.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,425 +0,0 @@ -/* - * nmcontact.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_CONTACT_H__ -#define __NM_CONTACT_H__ - -#include - -typedef struct _NMContact NMContact; -typedef struct _NMContactProperty NMContactProperty; -typedef struct _NMFolder NMFolder; - -#include "nmfield.h" -#include "nmuser.h" - -/** - * Creates a contact - * - * Should be released by calling nm_release_contact - * - * @return The new NMContact - * - */ -NMContact *nm_create_contact(void); - -/** - * Creates a contact from a field array representing the - * contact - * - * Should be released by calling nm_release_contact - * - * @param fields Should be the NM_A_FA_CONTACT for - * the contact - * - * @return The new contact - * - */ -NMContact *nm_create_contact_from_fields(NMField * fields); - -/** - * Add a reference to an existing contact - * - * The reference should be released by calling - * nm_release_contact - * - * @param contact The contact - * - */ -void nm_contact_add_ref(NMContact * contact); - -/** - * Update the contact list properties of the contact (sequence, parent id, etc.) - * - * @param contact The contact to update - * @param fields The fields to update from (should be a NM_A_FA_CONTACT array) - * - */ -void nm_contact_update_list_properties(NMContact * contact, NMField * fields); - -/** - * Release a contact reference - * - * @param contact The contact to release. - * - */ -void nm_release_contact(NMContact * contact); - -/** - * Get the display name of a contact - * - * @param contact The contact - * - * @return The display name of a contact - * - */ -const char *nm_contact_get_display_name(NMContact * contact); - -/** - * Get the DN of a contact - * - * @param contact The contact - * - * @return The DN of the contact - */ -const char *nm_contact_get_dn(NMContact * contact); - -/** - * Set the display name for a contact. This is called - * by nm_send_rename_contact. It should not be called - * directly (it does not change the display name on the - * server side list -- nm_send_rename_conact does). - * - * @param contact The contact - * @param display_name The new display name - * - */ -void nm_contact_set_display_name(NMContact * contact, const char * display_name); - -/** - * Set the DN for the contact - * - * @param contact The contact - * @param dn The new DN for the contact - * - */ -void nm_contact_set_dn(NMContact * contact, const char * dn); - -/** - * Return a field array (NM_A_FA_CONTACT) representing the contact - * - * @param contact The contact - * - * @return A field array representing the contact - */ -NMField *nm_contact_to_fields(NMContact * contact); - -/** - * Set the user record for the contact - * - * @param contact The contact - * @param user_record The user record - * - */ -void nm_contact_set_user_record(NMContact * contact, NMUserRecord * user_record); - -/** - * Get the user record for the contact - * - * @param contact The contact - * - * @return The user record associated with the contact - * - */ -NMUserRecord *nm_contact_get_user_record(NMContact * contact); - -/** - * Get the user defined data for the contact - * - * @param contact The contact - * - * @return The user defined data for the contact - * - */ -gpointer nm_contact_get_data(NMContact * contact); - -/** - * Get the Object ID for the contact - * - * @param contact The contact - * - * @return The ID for the contact - */ -int nm_contact_get_id(NMContact * contact); - -/** - * Get the ID for the folder that the contact is in - * - * @param contact The contact - * - * @return The ID of the folder that contains the contact - * - */ -int nm_contact_get_parent_id(NMContact * contact); - -/** - * Get The userid of the contact. - * - * @param contact The contact - * - * @return The userid of the contact - * - */ -const char *nm_contact_get_userid(NMContact * contact); - -/** - * Get the display id of the contact - * - * @param contact The contact - * - * @return The display id of the contact - */ -const char *nm_contact_get_display_id(NMContact * contact); - -/** - * Set the user defined data for the contact - * - * @param contact The contact - * @param data The user defined data - * - */ -void nm_contact_set_data(NMContact * contact, gpointer data); - -/** - * Create a folder with the given name - * - * @param name The name of the folder - * - * @return The new folder - * - */ -NMFolder *nm_create_folder(const char *name); - -/** - * Create a folder from a NM_A_FA_FOLDER field array - * - * @param fields The NM_A_FA_FOLDER field array - * - * @return The new folder - * - */ -NMFolder *nm_create_folder_from_fields(NMField * fields); - -/** - * Add a reference to an existing folder - * - * The reference should be released by calling - * nm_release_folder - * - * @param folder The folder - * - */ -void nm_folder_add_ref(NMFolder * folder); - -/** - * Release a reference to a folder. - * - * @param folder The folder to release - * - */ -void nm_release_folder(NMFolder * folder); - -/** - * Return the number of subfolders for the given - * folder - * - * @param folder The folder - * - * @return The number of subfolders contained by folder - */ -int nm_folder_get_subfolder_count(NMFolder * folder); - -/** - * Get a subfolder - * - * @param folder The root folder - * @param index The index of the folder to get - * - * @return The subfolder at the given index - * - */ -NMFolder *nm_folder_get_subfolder(NMFolder * folder, int index); - -/** - * Get the number of contacts in the given folder - * - * @param folder The folder - * - * @return The number of contacts contained by folder - * - */ -int nm_folder_get_contact_count(NMFolder * folder); - -/** - * Get a contact in the given folder - * - * @param folder The folder - * @param index The index of the contact to get - * - * @return The contact at the given index - * - */ -NMContact *nm_folder_get_contact(NMFolder * folder, int index); - -/** - * Get the name of the folder - * - * @param folder The folder - * - * @return The name of the folder. - * - */ -const char *nm_folder_get_name(NMFolder * folder); - -/** - * Set the name of a folder. Do not call this directly. - * It does not change the name of the folder in the - * server side contact list. You must call - * nm_send_set_folder_name(). - * - * @param folder The folder - * @param name The new name for the folder - * - */ -void nm_folder_set_name(NMFolder * folder, const char *name); - -/** - * Get Object ID for folder - * - * @param folder The folder - * - * @return The ID of the folder - * - */ -int nm_folder_get_id(NMFolder * folder); - -/** - * Add contacts and folders from fields into root - * - * @param user The logged in user - * @param root The root folder - * @param fields The contact list field array - * - */ -void nm_folder_add_contacts_and_folders(NMUser * user, NMFolder * root, - NMField * fields); -/** - * Add a contact to the contact list. - * - * @param root_folder The root folder of the contact list - * @param contact The contact to add - * - */ -void nm_folder_add_contact_to_list(NMFolder * root_folder, - NMContact * contact); - -/** - * Update the contact list properties of the folder (sequence, parent id, etc.) - * - * @param folder The folder to update - * @param fields The fields to update from (should be a NM_A_FA_FOLDER array) - * - */ -void nm_folder_update_list_properties(NMFolder * folder, NMField * fields); - -/** - * Add folder to the contact list - * - * @param root_folder The root folder of the contact list - * @param folder The folder to add to the contact list - * - */ -void nm_folder_add_folder_to_list(NMFolder * root_folder, NMFolder * folder); - -/** - * Find the object with the given id - * - * @param root_folder The root folder of the contact list - * @param object_id The object id of the object to find - * - * @return The object with object id (either a contact or a folder) - */ -gpointer nm_folder_find_item_by_object_id(NMFolder * root_folder, - int object_id); - -/** - * Remove a contact from the folder - * - * @param folder The folder - * @param contact The contact to remove - * - */ -void nm_folder_remove_contact(NMFolder * folder, NMContact * contact); - -/** - * Find a contact in a folder by DN - * - * @param folder The folder to search - * @param dn The DN of the contact to find - * - * @return The contact if found, NULL otherwise - * - */ -NMContact *nm_folder_find_contact(NMFolder * folder, const char *dn); - -/** - * Find a contact in a folder by userid - * - * @param folder The folder to search - * @param userid The userid of the contact to find - * - * @return The contact if found, NULL otherwise - * - */ -NMContact *nm_folder_find_contact_by_userid(NMFolder * folder, - const char *userid); - -/** - * Find a contact in a folder by display id - * - * @param folder The folder to search - * @param display_id The userid of the contact to find - * - * @return The contact if found, NULL otherwise - * - */ -NMContact * -nm_folder_find_contact_by_display_id(NMFolder * folder, const char *display_id); - -/** - * Return a field array (NM_A_FA_FOLDER) representing the folder - * - * @param folder The folder - * - * @return A field array representing the folder - */ -NMField *nm_folder_to_fields(NMFolder * folder); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,940 +0,0 @@ -/* - * nmevent.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include -#include "nmevent.h" -#include "nmfield.h" -#include "nmconn.h" -#include "nmuserrecord.h" -#include "nmrtf.h" - -#define MAX_UINT32 0xFFFFFFFF - -struct _NMEvent -{ - - /* Event type */ - int type; - - /* The DN of the event source */ - char *source; - - /* Timestamp of the event */ - guint32 gmt; - - /* Conference to associate with the event */ - NMConference *conference; - - /* User record to associate with the event */ - NMUserRecord *user_record; - - /* Text associated with the event */ - char *text; - - /* Reference count for event structure */ - int ref_count; - -}; - -/* Handle getdetails response and set the new user record into the event */ -static void -_got_user_for_event(NMUser * user, NMERR_T ret_val, - gpointer resp_data, gpointer user_data) -{ - NMUserRecord *user_record; - NMEvent *event; - nm_event_cb cb; - - if (user == NULL) - return; - - user_record = resp_data; - event = user_data; - - if (ret_val == NM_OK) { - if (event && user_record) { - - /* Add the user record to the event structure - * and make the callback. - */ - nm_event_set_user_record(event, user_record); - if ((cb = nm_user_get_event_callback(user))) { - cb(user, event); - } - } - - } else { - /* Cleanup resp_data */ - - } - - /* Clean up */ - if (event) - nm_release_event(event); - -} - -/* Handle getdetails response, set the new user record into the event - * and add the user record as a participant in the conference - */ -static void -_got_user_for_conference(NMUser * user, NMERR_T ret_val, - gpointer resp_data, gpointer user_data) -{ - NMUserRecord *user_record = resp_data; - NMEvent *event = user_data; - NMConference *conference; - nm_event_cb cb; - - if (user == NULL) - return; - - if (event && user_record) { - - conference = nm_event_get_conference(event); - if (conference) { - - /* Add source of event as recip of the conference */ - nm_conference_add_participant(conference, user_record); - - /* Add the user record to the event structure - * and make the callback. - */ - nm_event_set_user_record(event, user_record); - if ((cb = nm_user_get_event_callback(user))) { - cb(user, event); - } - } - } - - if (event) - nm_release_event(event); -} - -/* Read the receive message event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_receive_message(NMUser * user, NMEvent * event, gboolean autoreply) -{ - NMConference *conference; - NMUserRecord *user_record; - NMConn *conn; - NMERR_T rc = NM_OK; - guint32 size = 0, flags = 0; - char *msg = NULL; - char *nortf = NULL; - char *guid = NULL; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the conference flags */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &flags); - } - - /* Read the message text */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - msg = g_new0(char, size + 1); - rc = nm_read_all(conn, msg, size); - - purple_debug(PURPLE_DEBUG_INFO, "novell", "Message is %s\n", msg); - - /* Auto replies are not in RTF format! */ - if (!autoreply) { - NMRtfContext *ctx; - - ctx = nm_rtf_init(); - nortf = nm_rtf_strip_formatting(ctx, msg); - nm_rtf_deinit(ctx); - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Message without RTF is %s\n", nortf); - - /* Store the event data */ - nm_event_set_text(event, nortf); - - } else { - - /* Store the event data */ - nm_event_set_text(event, msg); - } - } - } - - /* Check to see if we already know about the conference */ - conference = nm_conference_list_find(user, guid); - if (conference) { - - nm_conference_set_flags(conference, flags); - nm_event_set_conference(event, conference); - - /* Add a reference to the user record in our event object */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - nm_event_set_user_record(event, user_record); - } - - } else { - - /* This is a new conference, so create one and add it to our list */ - conference = nm_create_conference(guid); - nm_conference_set_flags(conference, flags); - - /* Add a reference to the conference in the event */ - nm_event_set_conference(event, conference); - - /* Add new conference to the conference list */ - nm_conference_list_add(user, conference); - - /* Check to see if we have details for the event source yet */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - /* We do so add the user record as a recipient of the conference */ - nm_conference_add_participant(conference, user_record); - - /* Add a reference to the user record in our event object */ - nm_event_set_user_record(event, user_record); - - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_conference, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - nm_release_conference(conference); - } - - if (msg) - g_free(msg); - - if (nortf) - g_free(nortf); - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the invite event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_conference_invite(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - char *msg = NULL; - NMConn *conn; - NMUserRecord *user_record; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the the message */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - msg = g_new0(char, size + 1); - rc = nm_read_all(conn, msg, size); - } - } - - /* Store the event data */ - if (rc == NM_OK) { - NMConference *conference; - - nm_event_set_text(event, msg); - - conference = nm_conference_list_find(user, guid); - if (conference == NULL) { - conference = nm_create_conference(guid); - - /* Add new conference to the list and the event */ - nm_conference_list_add(user, conference); - nm_event_set_conference(event, conference); - - /* Check to see if we have details for the event source yet */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - /* Add a reference to the user record in our event object */ - nm_event_set_user_record(event, user_record); - - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_event, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - nm_release_conference(conference); - - } - } - - if (msg) - g_free(msg); - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the invite notify event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_conference_invite_notify(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConn *conn; - NMConference *conference; - NMUserRecord *user_record; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - - /* Check to see if we have details for the event source yet */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - /* Add a reference to the user record in our event object */ - nm_event_set_user_record(event, user_record); - - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_event, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference reject event and set up the event object */ -static NMERR_T -handle_conference_reject(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConn *conn; - NMConference *conference; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference left event, set up the event object, and - * remove the conference from the list if there are no more - * participants - */ -static NMERR_T -handle_conference_left(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0, flags = 0; - char *guid = NULL; - NMConference *conference; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the conference flags */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &flags); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - nm_conference_set_flags(conference, flags); - - nm_conference_remove_participant(conference, nm_event_get_source(event)); - if (nm_conference_get_participant_count(conference) == 0) { - nm_conference_list_remove(user, conference); - } - - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference closed, set up the event object, and - * remove the conference from the list - */ -static NMERR_T -handle_conference_closed(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConference *conference; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - nm_conference_list_remove(user, conference); - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference joined event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_conference_joined(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0, flags = 0; - char *guid = NULL; - NMConn *conn; - NMConference *conference; - NMUserRecord *user_record; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the conference flags */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &flags); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_conference_set_flags(conference, flags); - - nm_event_set_conference(event, conference); - - /* Add the new user to the participants list */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - nm_conference_remove_participant(conference, - nm_user_record_get_dn(user_record)); - nm_conference_add_participant(conference, user_record); - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_conference, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the typing event and set up the event object */ -static NMERR_T -handle_typing(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConference *conference; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the event, set up the event object, and update - * the status in the user record (for the event source) - */ -static NMERR_T -handle_status_change(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint16 status; - guint32 size; - char *text = NULL; - NMUserRecord *user_record; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read new status */ - rc = nm_read_uint16(conn, &status); - if (rc == NM_OK) { - - /* Read the status text */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - text = g_new0(char, size + 1); - rc = nm_read_all(conn, text, size); - } - } - - if (rc == NM_OK) { - nm_event_set_text(event, text); - - /* Get a reference to the user record and store the new status */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - nm_event_set_user_record(event, user_record); - nm_user_record_set_status(user_record, status, text); - } - } - - if (text) - g_free(text); - - return rc; -} - -/* Read the undeliverable event */ -static NMERR_T -handle_undeliverable_status(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (guid) - g_free(guid); - - return rc; -} - -/******************************************************************************* - * Event API -- see header file for comments - ******************************************************************************/ - -NMEvent * -nm_create_event(int type, const char *source, guint32 gmt) -{ - NMEvent *event = g_new0(NMEvent, 1); - - event->type = type; - event->gmt = gmt; - - if (source) - event->source = g_strdup(source); - - event->ref_count = 1; - - return event; -} - -void -nm_release_event(NMEvent * event) -{ - if (event == NULL) { - return; - } - - if (--(event->ref_count) == 0) { - - if (event->source) - g_free(event->source); - - if (event->conference) - nm_release_conference(event->conference); - - if (event->user_record) - nm_release_user_record(event->user_record); - - if (event->text) - g_free(event->text); - - g_free(event); - } -} - - -NMConference * -nm_event_get_conference(NMEvent * event) -{ - if (event) - return event->conference; - else - return NULL; -} - -void -nm_event_set_conference(NMEvent * event, NMConference * conference) -{ - if (event && conference) { - nm_conference_add_ref(conference); - event->conference = conference; - } -} - -NMUserRecord * -nm_event_get_user_record(NMEvent * event) -{ - if (event) - return event->user_record; - else - return NULL; -} - -void -nm_event_set_user_record(NMEvent * event, NMUserRecord * user_record) -{ - if (event && user_record) { - nm_user_record_add_ref(user_record); - event->user_record = user_record; - } -} - -const char * -nm_event_get_text(NMEvent * event) -{ - if (event) - return event->text; - else - return NULL; -} - -void -nm_event_set_text(NMEvent * event, const char *text) -{ - if (event) { - if (text) - event->text = g_strdup(text); - else - event->text = NULL; - } -} - -const char * -nm_event_get_source(NMEvent * event) -{ - if (event) - return event->source; - else - return NULL; -} - -int -nm_event_get_type(NMEvent * event) -{ - if (event) - return event->type; - else - return -1; -} - -time_t -nm_event_get_gmt(NMEvent * event) -{ - if (event) - return event->gmt; - else - return (time_t)-1; -} - -NMERR_T -nm_process_event(NMUser * user, int type) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - NMEvent *event = NULL; - char *source = NULL; - nm_event_cb cb; - NMConn *conn; - - if (user == NULL) - return NMERR_BAD_PARM; - - if (type < NMEVT_START || type > NMEVT_STOP) - return NMERR_PROTOCOL; - - conn = nm_user_get_conn(user); - - /* Read the event source */ - rc = nm_read_uint32(conn, &size); - if (rc == NM_OK) { - if (size > 0) { - source = g_new0(char, size); - - rc = nm_read_all(conn, source, size); - } - } - - /* Read the event data */ - if (rc == NM_OK) { - event = nm_create_event(type, source, time(0)); - - if (event) { - - switch (type) { - case NMEVT_STATUS_CHANGE: - rc = handle_status_change(user, event); - break; - - case NMEVT_RECEIVE_MESSAGE: - rc = handle_receive_message(user, event, FALSE); - break; - - case NMEVT_RECEIVE_AUTOREPLY: - rc = handle_receive_message(user, event, TRUE); - break; - - case NMEVT_USER_TYPING: - case NMEVT_USER_NOT_TYPING: - rc = handle_typing(user, event); - break; - - case NMEVT_CONFERENCE_LEFT: - rc = handle_conference_left(user, event); - break; - - case NMEVT_CONFERENCE_CLOSED: - rc = handle_conference_closed(user, event); - break; - - case NMEVT_CONFERENCE_JOINED: - rc = handle_conference_joined(user, event); - break; - - case NMEVT_CONFERENCE_INVITE: - rc = handle_conference_invite(user, event); - break; - - case NMEVT_CONFERENCE_REJECT: - rc = handle_conference_reject(user, event); - break; - - case NMEVT_CONFERENCE_INVITE_NOTIFY: - rc = handle_conference_invite_notify(user, event); - break; - - case NMEVT_UNDELIVERABLE_STATUS: - rc = handle_undeliverable_status(user, event); - break; - - case NMEVT_INVALID_RECIPIENT: - /* Nothing else to read, just callback */ - break; - - case NMEVT_USER_DISCONNECT: - /* Nothing else to read, just callback */ - break; - - case NMEVT_SERVER_DISCONNECT: - /* Nothing else to read, just callback */ - break; - - case NMEVT_RECEIVE_FILE: - case NMEVT_CONTACT_ADD: - /* Safely ignored for now */ - break; - - default: - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Unknown event %d received.\n", type); - rc = NMERR_PROTOCOL; - break; - } - } - } - - if (rc == (NMERR_T)-1) { - /* -1 means that we are not ready to callback yet. */ - rc = NM_OK; - } else if (rc == NM_OK && (cb = nm_user_get_event_callback(user))) { - - cb(user, event); - - if (event) - nm_release_event(event); - } else { - if (event) - nm_release_event(event); - } - - /* Cleanup */ - if (source) - g_free(source); - - return rc; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmevent.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -/* - * nmevent.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_EVENT_H__ -#define __NM_EVENT_H__ - -typedef struct _NMEvent NMEvent; - -#include "nmuser.h" -#include - -/** - * Defines for the event types - */ -#define NMEVT_INVALID_RECIPIENT 101 -#define NMEVT_UNDELIVERABLE_STATUS 102 -#define NMEVT_STATUS_CHANGE 103 -#define NMEVT_CONTACT_ADD 104 -#define NMEVT_CONFERENCE_CLOSED 105 -#define NMEVT_CONFERENCE_JOINED 106 -#define NMEVT_CONFERENCE_LEFT 107 -#define NMEVT_RECEIVE_MESSAGE 108 -#define NMEVT_RECEIVE_FILE 109 -#define NMEVT_USER_TYPING 112 -#define NMEVT_USER_NOT_TYPING 113 -#define NMEVT_USER_DISCONNECT 114 -#define NMEVT_SERVER_DISCONNECT 115 -#define NMEVT_CONFERENCE_RENAME 116 -#define NMEVT_CONFERENCE_INVITE 117 -#define NMEVT_CONFERENCE_INVITE_NOTIFY 118 -#define NMEVT_CONFERENCE_REJECT 119 -#define NMEVT_RECEIVE_AUTOREPLY 121 -#define NMEVT_START NMEVT_INVALID_RECIPIENT -#define NMEVT_STOP NMEVT_RECEIVE_AUTOREPLY - -/** - * Process the event. The event will be read, an NMEvent will - * be created, and the event callback will be called. - * - * @param user The main user structure. - * @param type The type of the event to read. - * - * @return NM_OK on success - */ -NMERR_T nm_process_event(NMUser * user, int type); - -/** - * Creates an NMEvent - * - * The NMEvent should be released by calling - * nm_release_event. - * - * @param type The event type, see defines above. - * @param source The DN of the event source. - * @param gmt The time that the event occurred. - * - * @return The new NMEvent - */ -NMEvent *nm_create_event(int type, const char *source, guint32 gmt); - -/** - * Releases an NMEvent - * - * @param event The event to release - * - */ -void nm_release_event(NMEvent * event); - -/** - * Sets the conference object for the given event. - * - * @param event The event. - * @param conference The conference to associate with the event. - * - */ -void nm_event_set_conference(NMEvent * event, NMConference * conference); - -/** - * Returns the conference object associated with the given event. This should not - * be released. If it needs to be kept around call nm_conference_addref(). - * - * @param event The event. - * - * @return The conference associated with the event, or NULL - * if no conference has been set for the event. - */ -NMConference *nm_event_get_conference(NMEvent * event); - -/** - * Sets the NMUserRecord object for the given event. - * The user record represents the event source. - * - * @param event The event. - * @param user_record The user record to associate with the event. - * - */ -void nm_event_set_user_record(NMEvent * event, NMUserRecord * user_record); - -/** - * Returns the NMUserRecord object associated with the given event. - * The user record represents the event source. This should not - * be released. If it needs to be kept around call - * nm_user_record_add_ref(). - * - * @param event The event. - * - * @return The user record associated with the event, or NULL - * if no user record has been set for the event. - */ -NMUserRecord *nm_event_get_user_record(NMEvent * event); - -/** - * Sets the text to associate with the given event. - * - * @param event The event. - * @param text The text to associate with the event. - * - */ -void nm_event_set_text(NMEvent * event, const char *text); - -/** - * Returns the text associated with the given event. - * - * @param event The event. - * - * @return The text associated with the event, or NULL - * if no text has been set for the event. - */ -const char *nm_event_get_text(NMEvent * event); - -/** - * Returns the source of the event (this will be the full DN of the - * event source). - * - * @param event The event. - * - * @return The full DN of the event's source. - */ -const char *nm_event_get_source(NMEvent * event); - -/** - * Returns the type of the event. See the defines above for - * a list of possible event types. - * - * @param event The event. - * - * @return The type of the event. - * - */ -int nm_event_get_type(NMEvent * event); - -/** - * Returns the time that the event took place. - * - * @param event The event. - * - * @return The timestamp for the event. - */ -time_t nm_event_get_gmt(NMEvent * event); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,364 +0,0 @@ -/* - * nmfield.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include "nmfield.h" - -/* Free a field value and tag */ -static void _free_field(NMField * field); - -/* Free a field value */ -static void _free_field_value(NMField * field); - -/* Make a deep copy of the field */ -static void _copy_field(NMField * dest, NMField * src); - -/* Make a deep copy of the field's value */ -static void _copy_field_value(NMField * dest, NMField * src); - -/* Create a string from a value -- for debugging */ -static char *_value_to_string(NMField * field); - -static NMField * -_add_blank_field(NMField *fields, guint32 count) -{ - guint32 new_len; - - if (fields == NULL) { - fields = g_new0(NMField, 10); - fields->len = 10; - } else { - if (fields->len < count + 2) { - new_len = count + 10; - fields = g_realloc(fields, new_len * sizeof(NMField)); - fields->len = new_len; - } - } - return fields; -} - -NMField * -nm_field_add_number(NMField * fields, const char *tag, guint32 size, guint8 method, - guint8 flags, guint32 value, guint8 type) -{ - guint32 count; - NMField *field; - - count = nm_count_fields(fields); - fields = _add_blank_field(fields, count); - - field = &(fields[count]); - field->tag = g_strdup(tag); - field->size = size; - field->method = method; - field->flags = flags; - field->value = value; - field->type = type; - - /* Null terminate the field array */ - field = &((fields)[count + 1]); - field->tag = NULL; - field->value = 0; - field->ptr_value = NULL; - - return fields; -} - -NMField * -nm_field_add_pointer(NMField * fields, const char *tag, guint32 size, guint8 method, - guint8 flags, gpointer value, guint8 type) -{ - guint32 count; - NMField *field = NULL; - - count = nm_count_fields(fields); - fields = _add_blank_field(fields, count); - - field = &(fields[count]); - field->tag = g_strdup(tag); - field->size = size; - field->method = method; - field->flags = flags; - field->ptr_value = value; - field->type = type; - - /* Null terminate the field array */ - field = &((fields)[count + 1]); - field->tag = NULL; - field->value = 0; - field->ptr_value = NULL; - - return fields; -} - -guint32 -nm_count_fields(NMField * fields) -{ - guint32 count = 0; - - if (fields) { - while (fields->tag != NULL) { - count++; - fields++; - } - } - - return count; -} - -void -nm_free_fields(NMField ** fields) -{ - NMField *field = NULL; - - if ((fields == NULL) || (*fields == NULL)) - return; - - field = *fields; - - while (field->tag != NULL) { - _free_field(field); - field++; - } - - g_free(*fields); - *fields = NULL; -} - - -static void -_free_field(NMField * field) -{ - if (field == NULL) - return; - - _free_field_value(field); - g_free(field->tag); -} - -static void -_free_field_value(NMField * field) -{ - if (field == NULL) - return; - - switch (field->type) { - case NMFIELD_TYPE_BINARY: - case NMFIELD_TYPE_UTF8: - case NMFIELD_TYPE_DN: - g_free(field->ptr_value); - break; - - case NMFIELD_TYPE_ARRAY: - case NMFIELD_TYPE_MV: - nm_free_fields((NMField **)&field->ptr_value); - break; - - default: - break; - } - - field->size = 0; - field->ptr_value = NULL; -} - -NMField * -nm_locate_field(char *tag, NMField * fields) -{ - NMField *ret_fields = NULL; - - if ((fields == NULL) || (tag == NULL)) { - return NULL; - } - - while (fields->tag != NULL) { - if (g_ascii_strcasecmp(fields->tag, tag) == 0) { - ret_fields = fields; - break; - } - fields++; - } - - return ret_fields; -} - -NMField * -nm_copy_field_array(NMField * src) -{ - NMField *ptr = NULL; - NMField *dest = NULL; - int count; - - if (src != NULL) { - count = nm_count_fields(src) + 1; - dest = g_new0(NMField, count); - dest->len = count; - ptr = dest; - while (src->tag != NULL) { - _copy_field(ptr, src); - ptr++; - src++; - } - } - - return dest; -} - -static void -_copy_field(NMField * dest, NMField * src) -{ - dest->type = src->type; - dest->flags = src->flags; - dest->method = src->method; - dest->tag = g_strdup(src->tag); - _copy_field_value(dest, src); -} - -static void -_copy_field_value(NMField * dest, NMField * src) -{ - dest->type = src->type; - switch (dest->type) { - case NMFIELD_TYPE_UTF8: - case NMFIELD_TYPE_DN: - if (src->size == 0 && src->ptr_value != NULL) { - src->size = strlen((char *) src->ptr_value) + 1; - } - /* fall through */ - case NMFIELD_TYPE_BINARY: - if (src->size != 0 && src->ptr_value != NULL) { - dest->ptr_value = g_new0(char, src->size); - memcpy(dest->ptr_value, src->ptr_value, src->size); - } - break; - - case NMFIELD_TYPE_ARRAY: - case NMFIELD_TYPE_MV: - dest->ptr_value = nm_copy_field_array((NMField *)src->ptr_value); - break; - - default: - /* numeric value */ - dest->value = src->value; - break; - } - - dest->size = src->size; -} - -void -nm_remove_field(NMField * field) -{ - NMField *tmp; - guint32 len; - - if ((field != NULL) && (field->tag != NULL)) { - _free_field(field); - - /* Move fields down */ - tmp = field + 1; - while (1) { - /* Don't overwrite the size of the array */ - len = field->len; - - *field = *tmp; - - field->len = len; - - if (tmp->tag == NULL) - break; - - field++; - tmp++; - } - } -} - -void -nm_print_fields(NMField * fields) -{ - char *str = NULL; - NMField *field = fields; - - if (fields == NULL) - return; - - while (field->tag != NULL) { - if (field->type == NMFIELD_TYPE_ARRAY || field->type == NMFIELD_TYPE_MV) { - printf("Subarray START: %s Method = %d\n", field->tag, field->method); - nm_print_fields((NMField *) field->ptr_value); - printf("Subarray END: %s\n", field->tag); - } else { - str = _value_to_string(field); - printf("Tag=%s;Value=%s\n", field->tag, str); - g_free(str); - str = NULL; - } - field++; - } - -} - -static char * -_value_to_string(NMField * field) -{ - char *value = NULL; - - if (field == NULL) - return NULL; - - /* This is a single value attribute */ - if (((field->type == NMFIELD_TYPE_UTF8) || - (field->type == NMFIELD_TYPE_DN)) && (field->ptr_value != NULL)) { - value = g_strdup((const char *) field->ptr_value); - } else if (field->type == NMFIELD_TYPE_BINARY && field->ptr_value != NULL) { - value = g_new0(char, field->size); - memcpy(value, (const char *) field->ptr_value, field->size); - } else if (field->type == NMFIELD_TYPE_BOOL) { - if (field->value) { - value = g_strdup(NM_FIELD_TRUE); - } else { - value = g_strdup(NM_FIELD_FALSE); - } - } else { - /* assume it is a number */ - value = g_new0(char, 20); - - switch (field->type) { - case NMFIELD_TYPE_BYTE: - case NMFIELD_TYPE_WORD: - case NMFIELD_TYPE_DWORD: - value = g_strdup_printf("%ld", (long) field->value); - break; - - case NMFIELD_TYPE_UBYTE: - case NMFIELD_TYPE_UWORD: - case NMFIELD_TYPE_UDWORD: - value = g_strdup_printf("%lu", (unsigned long) field->value); - break; - } - } - - if (value == NULL) - value = g_strdup("NULL"); - - return value; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmfield.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -/* - * nmfield.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef NMFIELD_H -#define NMFIELD_H - -#include - -typedef struct NMField_t -{ - char *tag; /* Field tag */ - guint8 method; /* Method of the field */ - guint8 flags; /* Flags */ - guint8 type; /* Type of value */ - guint32 size; /* Size of value if binary */ - guint32 value; /* Value of a numeric field */ - gpointer ptr_value; /* Value of a string or sub array field */ - guint32 len; /* Length of the array */ -} NMField; - -/* Field types */ -#define NMFIELD_TYPE_INVALID 0 -#define NMFIELD_TYPE_NUMBER 1 -#define NMFIELD_TYPE_BINARY 2 -#define NMFIELD_TYPE_BYTE 3 -#define NMFIELD_TYPE_UBYTE 4 -#define NMFIELD_TYPE_WORD 5 -#define NMFIELD_TYPE_UWORD 6 -#define NMFIELD_TYPE_DWORD 7 -#define NMFIELD_TYPE_UDWORD 8 -#define NMFIELD_TYPE_ARRAY 9 -#define NMFIELD_TYPE_UTF8 10 -#define NMFIELD_TYPE_BOOL 11 -#define NMFIELD_TYPE_MV 12 -#define NMFIELD_TYPE_DN 13 - -/* Field methods */ -#define NMFIELD_METHOD_VALID 0 -#define NMFIELD_METHOD_IGNORE 1 -#define NMFIELD_METHOD_DELETE 2 -#define NMFIELD_METHOD_DELETE_ALL 3 -#define NMFIELD_METHOD_EQUAL 4 -#define NMFIELD_METHOD_ADD 5 -#define NMFIELD_METHOD_UPDATE 6 -#define NMFIELD_METHOD_GTE 10 -#define NMFIELD_METHOD_LTE 12 -#define NMFIELD_METHOD_NE 14 -#define NMFIELD_METHOD_EXIST 15 -#define NMFIELD_METHOD_NOTEXIST 16 -#define NMFIELD_METHOD_SEARCH 17 -#define NMFIELD_METHOD_MATCHBEGIN 19 -#define NMFIELD_METHOD_MATCHEND 20 -#define NMFIELD_METHOD_NOT_ARRAY 40 -#define NMFIELD_METHOD_OR_ARRAY 41 -#define NMFIELD_METHOD_AND_ARRAY 42 - -/* Attribute Names (field tags) */ -#define NM_A_IP_ADDRESS "nnmIPAddress" -#define NM_A_PORT "nnmPort" -#define NM_A_FA_FOLDER "NM_A_FA_FOLDER" -#define NM_A_FA_CONTACT "NM_A_FA_CONTACT" -#define NM_A_FA_CONVERSATION "NM_A_FA_CONVERSATION" -#define NM_A_FA_MESSAGE "NM_A_FA_MESSAGE" -#define NM_A_FA_CONTACT_LIST "NM_A_FA_CONTACT_LIST" -#define NM_A_FA_RESULTS "NM_A_FA_RESULTS" -#define NM_A_FA_INFO_DISPLAY_ARRAY "NM_A_FA_INFO_DISPLAY_ARRAY" -#define NM_A_FA_USER_DETAILS "NM_A_FA_USER_DETAILS" -#define NM_A_SZ_OBJECT_ID "NM_A_SZ_OBJECT_ID" -#define NM_A_SZ_PARENT_ID "NM_A_SZ_PARENT_ID" -#define NM_A_SZ_SEQUENCE_NUMBER "NM_A_SZ_SEQUENCE_NUMBER" -#define NM_A_SZ_TYPE "NM_A_SZ_TYPE" -#define NM_A_SZ_STATUS "NM_A_SZ_STATUS" -#define NM_A_SZ_STATUS_TEXT "NM_A_SZ_STATUS_TEXT" -#define NM_A_SZ_DN "NM_A_SZ_DN" -#define NM_A_SZ_DISPLAY_NAME "NM_A_SZ_DISPLAY_NAME" -#define NM_A_SZ_USERID "NM_A_SZ_USERID" -#define NM_A_SZ_CREDENTIALS "NM_A_SZ_CREDENTIALS" -#define NM_A_SZ_MESSAGE_BODY "NM_A_SZ_MESSAGE_BODY" -#define NM_A_SZ_MESSAGE_TEXT "NM_A_SZ_MESSAGE_TEXT" -#define NM_A_UD_MESSAGE_TYPE "NM_A_UD_MESSAGE_TYPE" -#define NM_A_FA_PARTICIPANTS "NM_A_FA_PARTICIPANTS" -#define NM_A_FA_INVITES "NM_A_FA_INVITES" -#define NM_A_FA_EVENT "NM_A_FA_EVENT" -#define NM_A_UD_COUNT "NM_A_UD_COUNT" -#define NM_A_UD_DATE "NM_A_UD_DATE" -#define NM_A_UD_EVENT "NM_A_UD_EVENT" -#define NM_A_B_NO_CONTACTS "NM_A_B_NO_CONTACTS" -#define NM_A_B_NO_CUSTOMS "NM_A_B_NO_CUSTOMS" -#define NM_A_B_NO_PRIVACY "NM_A_B_NO_PRIVACY" -#define NM_A_UW_STATUS "NM_A_UW_STATUS" -#define NM_A_UD_OBJECT_ID "NM_A_UD_OBJECT_ID" -#define NM_A_SZ_TRANSACTION_ID "NM_A_SZ_TRANSACTION_ID" -#define NM_A_SZ_RESULT_CODE "NM_A_SZ_RESULT_CODE" -#define NM_A_UD_BUILD "NM_A_UD_BUILD" -#define NM_A_SZ_AUTH_ATTRIBUTE "NM_A_SZ_AUTH_ATTRIBUTE" -#define NM_A_UD_KEEPALIVE "NM_A_UD_KEEPALIVE" -#define NM_A_SZ_USER_AGENT "NM_A_SZ_USER_AGENT" -#define NM_A_BLOCKING "nnmBlocking" -#define NM_A_BLOCKING_DENY_LIST "nnmBlockingDenyList" -#define NM_A_BLOCKING_ALLOW_LIST "nnmBlockingAllowList" -#define NM_A_SZ_BLOCKING_ALLOW_ITEM "NM_A_SZ_BLOCKING_ALLOW_ITEM" -#define NM_A_SZ_BLOCKING_DENY_ITEM "NM_A_SZ_BLOCKING_DENY_ITEM" -#define NM_A_LOCKED_ATTR_LIST "nnmLockedAttrList" - -#define NM_PROTOCOL_VERSION 2 - -#define NM_FIELD_TRUE "1" -#define NM_FIELD_FALSE "0" - -#define NMFIELD_MAX_STR_LENGTH 32768 - -/** - * Count the number of fields - * - * @param fields Field array - * - * @return The number of fields in the array. - * - */ -guint32 nm_count_fields(NMField * fields); - -/** - * Add a field to the field array. The field should be of type NMFIELD_TYPE_UTF8, - * NMFIELD_TYPE_DN, NMFIELD_TYPE_ARRAY, or NMFIELD_TYPE_MV - * - * NOTE: field array that is passed in may be realloc'd so you should use - * the returned field array pointer not the passed in pointer after calling - * this function. - * - * @param fields Field array - * @param tag Tag for the new field - * @param size Size of the field value (if type = binary) - * @param method Field method (see method defines above) - * @param flags Flags for new field - * @param value The value of the field - * @param type The type of the field value - * - * @return Pointer to the updated field array - * - */ -NMField *nm_field_add_pointer(NMField *fields, const char *tag, guint32 size, guint8 method, - guint8 flags, gpointer value, guint8 type); - -/** - * Add a numeric field to the field array. - * - * NOTE: field array that is passed in may be realloc'd so you should use - * the returned field array pointer not the passed in pointer after calling - * this function. - * - * @param fields Field array - * @param tag Tag for the new field - * @param size Size of the field value (if type = binary) - * @param method Field method (see method defines above) - * @param flags Flags for new field - * @param value The value of the field - * @param type The type of the field value - * - * @return Pointer to the updated field array - * - */ -NMField *nm_field_add_number(NMField *fields, const char *tag, guint32 size, guint8 method, - guint8 flags, guint32 value, guint8 type); - -/** - * Recursively free an array of fields and set pointer to NULL. - * - * @param fields Pointer to a field array - * - */ -void nm_free_fields(NMField ** fields); - -/** - * Find first field with given tag in field array. - * - * Note: this will only work for 7-bit ascii tags (which is all that - * we use currently). - * - * @param tag Tag to search for - * @param fields Field array - * - * @return The first matching field, or NULL if no fields match. - * - */ -NMField *nm_locate_field(char *tag, NMField * fields); - -/** - * Make a deep copy of a field array - * - * @param src The array to copy - * - * @return The new (copied) array, which must be freed. - * - */ -NMField *nm_copy_field_array(NMField * src); - -/** - * Remove a field and move other fields up to fill the gap - * - * @param field The field to remove - * - */ -void nm_remove_field(NMField * field); - -/* Print a field array (for debugging purposes) */ -void nm_print_fields(NMField * fields); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/* - * nmmessage.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "nmmessage.h" - -struct _NMMessage -{ - NMConference *conference; - char *text; - guint32 ref_count; -}; - - -/** Message API **/ - -NMMessage * -nm_create_message(const char *text) -{ - NMMessage *msg = g_new0(NMMessage, 1); - - if (text) - msg->text = g_strdup(text); - - msg->ref_count = 1; - return msg; -} - -void -nm_message_add_ref(NMMessage * msg) -{ - if (msg) - msg->ref_count++; -} - -void -nm_release_message(NMMessage * msg) -{ - if (msg && (--(msg->ref_count) == 0)) { - if (msg->text) - g_free(msg->text); - - if (msg->conference) - nm_release_conference(msg->conference); - - g_free(msg); - } -} - -const char * -nm_message_get_text(NMMessage * msg) -{ - if (msg == NULL) - return NULL; - - return msg->text; -} - -void -nm_message_set_conference(NMMessage * msg, NMConference * conf) -{ - if (msg == NULL || conf == NULL) - return; - - /* Need to ref the conference first so that it doesn't - * get released out from under us - */ - nm_conference_add_ref(conf); - - msg->conference = conf; -} - -NMConference * -nm_message_get_conference(NMMessage * msg) -{ - if (msg == NULL) - return NULL; - - return msg->conference; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmmessage.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - * nmmessage.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_MESSAGE_H__ -#define __NM_MESSAGE_H__ - -typedef struct _NMMessage NMMessage; - -#include "nmconference.h" - -/** - * Creates a new message. - * - * The returned message should be released by calling - * nm_release_message - * - * @param text The message text - * @return A newly allocated message - */ -NMMessage *nm_create_message(const char *text); - -/** - * Increment the reference count for the message object. - * - * @param msg The message - */ -void nm_message_add_ref(NMMessage * msg); - -/** - * Releases a message. - * - * @param msg The message - */ -void nm_release_message(NMMessage * msg); - -/** - * Returns the message text - * - * @param msg The message - * @return The message text - */ -const char *nm_message_get_text(NMMessage * msg); - -/** - * Sets the conference object for a message - * - * @param msg The message - * @param conf The conference to associate with the message - * @return RVALUE_OK on success - */ -void nm_message_set_conference(NMMessage * msg, NMConference * conf); - -/** - * Returns the conference object associated with the message - * - * Note: this does not increment the reference count for the - * conference and the conference should NOT be released with - * nm_release_conference. If the reference needs to be kept - * around nm_conference_add_ref should be called. - * - * @param msg The message - * @return The conference associated with this message - */ -NMConference *nm_message_get_conference(NMMessage * msg); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/* - * nmrequest.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "nmrequest.h" - -static int count = 0; - -struct _NMRequest -{ - int trans_id; - char *cmd; - int gmt; - gpointer data; - gpointer user_define; - nm_response_cb callback; - int ref_count; - NMERR_T ret_code; -}; - -NMRequest *nm_create_request(const char *cmd, int trans_id, int gmt, nm_response_cb cb, - gpointer resp_data, gpointer user_define) -{ - NMRequest *req; - - if (cmd == NULL) - return NULL; - - req = g_new0(NMRequest, 1); - req->cmd = g_strdup(cmd); - req->trans_id = trans_id; - req->gmt = gmt; - req->callback = cb; - req->data = resp_data; - req->user_define = user_define; - req->ref_count = 1; - - purple_debug_info("novell", "Creating NMRequest instance, total=%d\n", ++count); - - return req; -} - -void -nm_release_request(NMRequest * req) -{ - if (req && (--req->ref_count == 0)) { - if (req->cmd) - g_free(req->cmd); - g_free(req); - - purple_debug_info("novell", - "Releasing NMRequest instance, total=%d\n", --count); - } - -} - -void -nm_request_add_ref(NMRequest * req) -{ - if (req) - req->ref_count++; -} - -void -nm_request_set_callback(NMRequest * req, nm_response_cb callback) -{ - if (req) - req->callback = callback; -} - -void -nm_request_set_data(NMRequest * req, gpointer data) -{ - if (req) - req->data = data; -} - -void -nm_request_set_user_define(NMRequest * req, gpointer user_define) -{ - if (req) - req->user_define = user_define; -} - -int -nm_request_get_trans_id(NMRequest * req) -{ - if (req) - return req->trans_id; - else - return -1; -} - -const char * -nm_request_get_cmd(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->cmd; -} - -gpointer -nm_request_get_data(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->data; -} - -gpointer -nm_request_get_user_define(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->user_define; -} - -nm_response_cb -nm_request_get_callback(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->callback; -} - - -void -nm_request_set_ret_code(NMRequest * req, NMERR_T rc) -{ - if (req) - req->ret_code = rc; -} - -NMERR_T -nm_request_get_ret_code(NMRequest * req) -{ - if (req) - return req->ret_code; - else - return (NMERR_T) - 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrequest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -/* - * nmrequest.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_REQUEST_H__ -#define __NM_REQUEST_H__ - -typedef struct _NMRequest NMRequest; - -#include "nmuser.h" - -/** - * Create a new request object. Object must be release with nm_release_object. - * - * @param cmd The request command string (e.g. "login") - * @param trans_id The request transaction id - * @param gmt The time in seconds that the request was created - * - * @return The new request object - */ -NMRequest *nm_create_request(const char *cmd, int trans_id, int gmt, nm_response_cb cb, - gpointer resp_data, gpointer user_define); - -/** - * Release a request object. - * - * @param req The request to release - */ -void nm_release_request(NMRequest * req); - -/** - * Add a new reference to this object. This reference must be released by - * a call to nm_release_object. - * - * @param req The request object - */ -void nm_request_add_ref(NMRequest * req); - -/** - * Set the response callback for this request object. This is the callback - * that will be made when we get a response from the server. - * - * @param req The request object - * @param callback The response callback - * - */ -void nm_request_set_callback(NMRequest * req, nm_response_cb callback); - -/** - * Set the response data. This will be set differently depending on - * the request type (for example to nm_send_get_details will set this - * to be the newly create NMUserRecord object). - * - * @param req The request object - * @param data Pointer to some data - * - */ -void nm_request_set_data(NMRequest * req, gpointer data); - -/** - * Set the user defined data. This is the data that the client - * passes to the various nm_send_* functions. We will pass it - * back when we make the callback. - * - * @param req The request object - * @param user_define Pointer to some data - * - */ -void nm_request_set_user_define(NMRequest * req, gpointer user_define); - -/** - * Set the return code. This is the return code that we received in - * the server response fields. - * - * @param req The request object - * @param rc The return code to set - */ -void nm_request_set_ret_code(NMRequest * req, NMERR_T rc); - -/** - * Get the transaction id for this request. - * - * @param req The request object - * - * @return The transaction id. - */ -int nm_request_get_trans_id(NMRequest * req); - -/** - * Get the command (request type) for this request. - * - * @param req The request object - * - * @return The request cmd - */ -const char *nm_request_get_cmd(NMRequest * req); - -/** - * Get the response data for this request - * - * @param req The request object - * - * @return The response data - */ -gpointer nm_request_get_data(NMRequest * req); - -/** - * Get the user defined data for this request - * - * @param req The request object - * - * @return The user defined data - */ -gpointer nm_request_get_user_define(NMRequest * req); - -/** - * Get the response callback for this request - * - * @param req The request object - * - * @return The response callback - */ -nm_response_cb nm_request_get_callback(NMRequest * req); - -/** - * Get the return code - * - * @param req The request object - * - * @return The return code (from the response fields) - */ -NMERR_T nm_request_get_ret_code(NMRequest * req); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,829 +0,0 @@ -/* - * nmrtf.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* This code was adapted from the sample RTF reader found here: - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec.asp - */ - -#include -#include -#include -#include -#include -#include -#include "nmrtf.h" -#include "debug.h" - -/* Internal RTF parser error codes */ -#define NMRTF_OK 0 /* Everything's fine! */ -#define NMRTF_STACK_UNDERFLOW 1 /* Unmatched '}' */ -#define NMRTF_STACK_OVERFLOW 2 /* Too many '{' -- memory exhausted */ -#define NMRTF_UNMATCHED_BRACE 3 /* RTF ended during an open group. */ -#define NMRTF_INVALID_HEX 4 /* invalid hex character found in data */ -#define NMRTF_BAD_TABLE 5 /* RTF table (sym or prop) invalid */ -#define NMRTF_ASSERTION 6 /* Assertion failure */ -#define NMRTF_EOF 7 /* End of file reached while reading RTF */ -#define NMRTF_CONVERT_ERROR 8 /* Error converting text */ - -#define NMRTF_MAX_DEPTH 256 - -typedef enum -{ - NMRTF_STATE_NORMAL, - NMRTF_STATE_SKIP, - NMRTF_STATE_FONTTABLE, - NMRTF_STATE_BIN, - NMRTF_STATE_HEX -} NMRtfState; /* Rtf State */ - -/* Property types that we care about */ -typedef enum -{ - NMRTF_PROP_FONT_IDX, - NMRTF_PROP_FONT_CHARSET, - NMRTF_PROP_MAX -} NMRtfProperty; - -typedef enum -{ - NMRTF_SPECIAL_BIN, - NMRTF_SPECIAL_HEX, - NMRTF_SPECIAL_UNICODE, - NMRTF_SPECIAL_SKIP -} NMRtfSpecialKwd; - -typedef enum -{ - NMRTF_DEST_FONTTABLE, - NMRTF_DEST_SKIP -} NMRtfDestinationType; - -typedef enum -{ - NMRTF_KWD_CHAR, - NMRTF_KWD_DEST, - NMRTF_KWD_PROP, - NMRTF_KWD_SPEC -} NMRtfKeywordType; - -typedef struct _NMRTFCharProp -{ - /* All we care about for now is the font. - * bold, italic, underline, etc. should be - * added here - */ - int font_idx; - int font_charset; -} NMRtfCharProp; - -typedef struct _NMRtfStateSave -{ - NMRtfCharProp chp; - NMRtfState rds; - NMRtfState ris; -} NMRtfStateSave; - -typedef struct _NMRtfSymbol -{ - char *keyword; /* RTF keyword */ - int default_val; /* default value to use */ - gboolean pass_default; /* true to use default value from this table */ - NMRtfKeywordType kwd_type; /* the type of the keyword */ - int action; /* property type if the keyword represents a property */ - /* destination type if the keyword represents a destination */ - /* character to print if the keyword represents a character */ -} NMRtfSymbol; - - -typedef struct _NMRtfFont -{ - int number; - char *name; - int charset; -} NMRtfFont; - -/* RTF Context */ -struct _NMRtfContext -{ - NMRtfState rds; /* destination state */ - NMRtfState ris; /* internal state */ - NMRtfCharProp chp; /* current character properties (ie. font, bold, italic, etc.) */ - GSList *font_table; /* the font table */ - GSList *saved; /* saved state stack */ - int param; /* numeric parameter for the current keyword */ - long bytes_to_skip; /* number of bytes to skip (after encountering \bin) */ - int depth; /* how many groups deep are we */ - gboolean skip_unknown; /* if true, skip any unknown destinations (this is set after encountering '\*') */ - char *input; /* input string */ - char nextch; /* next char in input */ - GString *ansi; /* Temporary ansi text, will be convert/flushed to the output string */ - GString *output; /* The plain text UTF8 string */ -}; - -static int rtf_parse(NMRtfContext *ctx); -static int rtf_push_state(NMRtfContext *ctx); -static int rtf_pop_state(NMRtfContext *ctx); -static NMRtfFont *rtf_get_font(NMRtfContext *ctx, int index); -static int rtf_get_char(NMRtfContext *ctx, guchar *ch); -static int rtf_unget_char(NMRtfContext *ctx, guchar ch); -static int rtf_flush_data(NMRtfContext *ctx); -static int rtf_parse_keyword(NMRtfContext *ctx); -static int rtf_dispatch_control(NMRtfContext *ctx, char *keyword, int param, gboolean param_set); -static int rtf_dispatch_char(NMRtfContext *ctx, guchar ch); -static int rtf_dispatch_unicode_char(NMRtfContext *ctx, gunichar ch); -static int rtf_print_char(NMRtfContext *ctx, guchar ch); -static int rtf_print_unicode_char(NMRtfContext *ctx, gunichar ch); -static int rtf_change_destination(NMRtfContext *ctx, NMRtfDestinationType dest); -static int rtf_dispatch_special(NMRtfContext *ctx, NMRtfSpecialKwd special); -static int rtf_apply_property(NMRtfContext *ctx, NMRtfProperty prop, int val); - -/* RTF parser tables */ - -/* Keyword descriptions */ -NMRtfSymbol rtf_symbols[] = { - /* keyword, default, pass_default, keyword_type, action */ - {"fonttbl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_FONTTABLE}, - {"f", 0, FALSE, NMRTF_KWD_PROP, NMRTF_PROP_FONT_IDX}, - {"fcharset", 0, FALSE, NMRTF_KWD_PROP, NMRTF_PROP_FONT_CHARSET}, - {"par", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"line", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"\0x0a", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"\0x0d", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"tab", 0, FALSE, NMRTF_KWD_CHAR, 0x09}, - {"\r", 0, FALSE, NMRTF_KWD_CHAR, '\r'}, - {"\n", 0, FALSE, NMRTF_KWD_CHAR, '\n'}, - {"ldblquote",0, FALSE, NMRTF_KWD_CHAR, '"'}, - {"rdblquote",0, FALSE, NMRTF_KWD_CHAR, '"'}, - {"{", 0, FALSE, NMRTF_KWD_CHAR, '{'}, - {"}", 0, FALSE, NMRTF_KWD_CHAR, '}'}, - {"\\", 0, FALSE, NMRTF_KWD_CHAR, '\\'}, - {"bin", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_BIN}, - {"*", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_SKIP}, - {"'", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_HEX}, - {"u", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_UNICODE}, - {"colortbl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"author", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"buptim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"comment", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"creatim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"doccomm", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footer", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footerf", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footerl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footerr", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footnote", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"ftncn", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"ftnsep", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"ftnsepc", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"header", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"headerf", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"headerl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"headerr", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"info", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"keywords", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"operator", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"pict", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"printim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"private1", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"revtim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"rxe", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"stylesheet", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"subject", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"tc", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"title", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"txe", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"xe", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP} -}; -int table_size = sizeof(rtf_symbols) / sizeof(NMRtfSymbol); - -NMRtfContext * -nm_rtf_init() -{ - NMRtfContext *ctx = g_new0(NMRtfContext, 1); - ctx->nextch = -1; - ctx->ansi = g_string_new(""); - ctx->output = g_string_new(""); - return ctx; -} - -char * -nm_rtf_strip_formatting(NMRtfContext *ctx, const char *input) -{ - int status; - - ctx->input = (char *)input; - status = rtf_parse(ctx); - if (status == NMRTF_OK) - return g_strdup(ctx->output->str); - - purple_debug_info("novell", "RTF parser failed with error code %d\n", status); - return NULL; -} - -void -nm_rtf_deinit(NMRtfContext *ctx) -{ - GSList *node; - NMRtfFont *font; - NMRtfStateSave *save; - - if (ctx) { - for (node = ctx->font_table; node; node = node->next) { - font = node->data; - g_free(font->name); - g_free(font); - node->data = NULL; - } - g_slist_free(ctx->font_table); - for (node = ctx->saved; node; node = node->next) { - save = node->data; - g_free(save); - node->data = NULL; - } - g_slist_free(ctx->saved); - g_string_free(ctx->ansi, TRUE); - g_string_free(ctx->output, TRUE); - g_free(ctx); - } -} - -static const char * -get_current_encoding(NMRtfContext *ctx) -{ - NMRtfFont *font; - - font = rtf_get_font(ctx, ctx->chp.font_idx); - - switch (font->charset) { - case 0: - return "CP1252"; - case 77: - return "MACINTOSH"; - case 78: - return "SJIS"; - case 128: - return "CP932"; - case 129: - return "CP949"; - case 130: - return "CP1361"; - case 134: - return "CP936"; - case 136: - return "CP950"; - case 161: - return "CP1253"; - case 162: - return "CP1254"; - case 163: - return "CP1258"; - case 181: - case 177: - return "CP1255"; - case 178: - case 179: - case 180: - return "CP1256"; - case 186: - return "CP1257"; - case 204: - return "CP1251"; - case 222: - return "CP874"; - case 238: - return "CP1250"; - case 254: - return "CP437"; - default: - purple_debug_info("novell", "Unhandled font charset %d\n", font->charset); - return "CP1252"; - } - return "CP1252"; -} - - -/* - * Add an entry to the font table - */ -static int -rtf_add_font_entry(NMRtfContext *ctx, int number, const char *name, int charset) -{ - NMRtfFont *font = g_new0(NMRtfFont, 1); - - font->number = number; - font->name = g_strdup(name); - font->charset = charset; - - purple_debug_info("novell", "Adding font to table: #%d\t%s\t%d\n", - font->number, font->name, font->charset); - - ctx->font_table = g_slist_append(ctx->font_table, font); - - return NMRTF_OK; -} - -/* - * Return the nth entry in the font table - */ -static NMRtfFont * -rtf_get_font(NMRtfContext *ctx, int nth) -{ - NMRtfFont *font; - - font = g_slist_nth_data(ctx->font_table, nth); - - return font; -} - -/* - * Step 1: - * Isolate RTF keywords and send them to rtf_parse_keyword; - * Push and pop state at the start and end of RTF groups; - * Send text to rtf_dispatch_char for further processing. - */ -static int -rtf_parse(NMRtfContext *ctx) -{ - int status; - guchar ch; - guchar hex_byte = 0; - int hex_count = 2; - int len; - - if (ctx->input == NULL) - return NMRTF_OK; - - while (rtf_get_char(ctx, &ch) == NMRTF_OK) { - if (ctx->depth < 0) - return NMRTF_STACK_UNDERFLOW; - - /* if we're parsing binary data, handle it directly */ - if (ctx->ris == NMRTF_STATE_BIN) { - if ((status = rtf_dispatch_char(ctx, ch)) != NMRTF_OK) - return status; - } else { - switch (ch) { - case '{': - if (ctx->depth > NMRTF_MAX_DEPTH) - return NMRTF_STACK_OVERFLOW; - rtf_flush_data(ctx); - if ((status = rtf_push_state(ctx)) != NMRTF_OK) - return status; - break; - case '}': - rtf_flush_data(ctx); - - /* for some reason there is always an unwanted '\par' at the end */ - if (ctx->rds == NMRTF_STATE_NORMAL) { - len = ctx->output->len; - if (ctx->output->str[len-1] == '\n') - ctx->output = g_string_truncate(ctx->output, len-1); - } - - if ((status = rtf_pop_state(ctx)) != NMRTF_OK) - return status; - - if (ctx->depth < 0) - return NMRTF_STACK_OVERFLOW; - break; - case '\\': - if ((status = rtf_parse_keyword(ctx)) != NMRTF_OK) - return status; - break; - case 0x0d: - case 0x0a: /* cr and lf are noise characters... */ - break; - default: - if (ctx->ris == NMRTF_STATE_NORMAL) { - if ((status = rtf_dispatch_char(ctx, ch)) != NMRTF_OK) - return status; - } else { /* parsing a hex encoded character */ - if (ctx->ris != NMRTF_STATE_HEX) - return NMRTF_ASSERTION; - - hex_byte = hex_byte << 4; - if (isdigit(ch)) - hex_byte += (char) ch - '0'; - else { - if (islower(ch)) { - if (ch < 'a' || ch > 'f') - return NMRTF_INVALID_HEX; - hex_byte += (char) ch - 'a' + 10; - } else { - if (ch < 'A' || ch > 'F') - return NMRTF_INVALID_HEX; - hex_byte += (char) ch - 'A' + 10; - } - } - hex_count--; - if (hex_count == 0) { - if ((status = rtf_dispatch_char(ctx, hex_byte)) != NMRTF_OK) - return status; - hex_count = 2; - hex_byte = 0; - ctx->ris = NMRTF_STATE_NORMAL; - } - } - break; - } - } - } - if (ctx->depth < 0) - return NMRTF_STACK_OVERFLOW; - if (ctx->depth > 0) - return NMRTF_UNMATCHED_BRACE; - return NMRTF_OK; -} - -/* - * Push the current state onto stack - */ -static int -rtf_push_state(NMRtfContext *ctx) -{ - NMRtfStateSave *save = g_new0(NMRtfStateSave, 1); - save->chp = ctx->chp; - save->rds = ctx->rds; - save->ris = ctx->ris; - ctx->saved = g_slist_prepend(ctx->saved, save); - ctx->ris = NMRTF_STATE_NORMAL; - (ctx->depth)++; - return NMRTF_OK; -} - -/* - * Restore the state at the top of the stack - */ -static int -rtf_pop_state(NMRtfContext *ctx) -{ - NMRtfStateSave *save_old; - GSList *link_old; - - if (ctx->saved == NULL) - return NMRTF_STACK_UNDERFLOW; - - save_old = ctx->saved->data; - ctx->chp = save_old->chp; - ctx->rds = save_old->rds; - ctx->ris = save_old->ris; - (ctx->depth)--; - - g_free(save_old); - link_old = ctx->saved; - ctx->saved = g_slist_remove_link(ctx->saved, link_old); - g_slist_free_1(link_old); - return NMRTF_OK; -} - -/* - * Step 2: - * Get a control word (and its associated value) and - * dispatch the control. - */ -static int -rtf_parse_keyword(NMRtfContext *ctx) -{ - int status = NMRTF_OK; - guchar ch; - gboolean param_set = FALSE; - gboolean is_neg = FALSE; - int param = 0; - char keyword[30]; - char parameter[20]; - int i; - - keyword[0] = '\0'; - parameter[0] = '\0'; - if ((status = rtf_get_char(ctx, &ch)) != NMRTF_OK) - return status; - - if (!isalpha(ch)) { - /* a control symbol; no delimiter. */ - keyword[0] = (char) ch; - keyword[1] = '\0'; - return rtf_dispatch_control(ctx, keyword, 0, param_set); - } - - /* parse keyword */ - for (i = 0; isalpha(ch) && (i < sizeof(keyword) - 1); rtf_get_char(ctx, &ch)) { - keyword[i] = (char) ch; - i++; - } - keyword[i] = '\0'; - - /* check for '-' indicated a negative parameter value */ - if (ch == '-') { - is_neg = TRUE; - if ((status = rtf_get_char(ctx, &ch)) != NMRTF_OK) - return status; - } - - /* check for numerical param */ - if (isdigit(ch)) { - - param_set = TRUE; - for (i = 0; isdigit(ch) && (i < sizeof(parameter) - 1); rtf_get_char(ctx, &ch)) { - parameter[i] = (char) ch; - i++; - } - parameter[i] = '\0'; - - ctx->param = param = atoi(parameter); - if (is_neg) - ctx->param = param = -param; - } - - /* space after control is optional, put character back if it is not a space */ - if (ch != ' ') - rtf_unget_char(ctx, ch); - - return rtf_dispatch_control(ctx, keyword, param, param_set); -} - -/* - * Route the character to the appropriate destination - */ -static int -rtf_dispatch_char(NMRtfContext *ctx, guchar ch) -{ - if (ctx->ris == NMRTF_STATE_BIN && --(ctx->bytes_to_skip) <= 0) - ctx->ris = NMRTF_STATE_NORMAL; - - switch (ctx->rds) { - case NMRTF_STATE_SKIP: - return NMRTF_OK; - case NMRTF_STATE_NORMAL: - return rtf_print_char(ctx, ch); - case NMRTF_STATE_FONTTABLE: - if (ch == ';') { - rtf_add_font_entry(ctx, ctx->chp.font_idx, - ctx->ansi->str, ctx->chp.font_charset); - g_string_truncate(ctx->ansi, 0); - } - else { - return rtf_print_char(ctx, ch); - } - return NMRTF_OK; - default: - return NMRTF_OK; - } -} - -/* Handle a unicode character */ -static int -rtf_dispatch_unicode_char(NMRtfContext *ctx, gunichar ch) -{ - switch (ctx->rds) { - case NMRTF_STATE_SKIP: - return NMRTF_OK; - case NMRTF_STATE_NORMAL: - case NMRTF_STATE_FONTTABLE: - return rtf_print_unicode_char(ctx, ch); - default: - return NMRTF_OK; - } -} - -/* - * Output a character - */ -static int -rtf_print_char(NMRtfContext *ctx, guchar ch) -{ - - ctx->ansi = g_string_append_c(ctx->ansi, ch); - - return NMRTF_OK; -} - -/* - * Output a unicode character - */ -static int -rtf_print_unicode_char(NMRtfContext *ctx, gunichar ch) -{ - char buf[7]; - int num; - - /* convert and flush the ansi buffer to the utf8 buffer */ - rtf_flush_data(ctx); - - /* convert the unicode character to utf8 and add directly to the output buffer */ - num = g_unichar_to_utf8((gunichar) ch, buf); - buf[num] = 0; - purple_debug_info("novell", "converted unichar 0x%X to utf8 char %s\n", ch, buf); - - ctx->output = g_string_append(ctx->output, buf); - return NMRTF_OK; -} - -/* - * Flush the output text - */ -static int -rtf_flush_data(NMRtfContext *ctx) -{ - int status = NMRTF_OK; - char *conv_data = NULL; - const char *enc = NULL; - GError *gerror = NULL; - - if (ctx->rds == NMRTF_STATE_NORMAL && ctx->ansi->len > 0) { - enc = get_current_encoding(ctx); - conv_data = g_convert(ctx->ansi->str, ctx->ansi->len, "UTF-8", enc, - NULL, NULL, &gerror); - if (conv_data) { - ctx->output = g_string_append(ctx->output, conv_data); - g_free(conv_data); - ctx->ansi = g_string_truncate(ctx->ansi, 0); - } else { - status = NMRTF_CONVERT_ERROR; - purple_debug_info("novell", "failed to convert data! error code = %d msg = %s\n", - gerror->code, gerror->message); - g_free(gerror); - } - } - - return status; -} - -/* - * Handle a property change - */ -static int -rtf_apply_property(NMRtfContext *ctx, NMRtfProperty prop, int val) -{ - if (ctx->rds == NMRTF_STATE_SKIP) /* If we're skipping text, */ - return NMRTF_OK; /* don't do anything. */ - - /* Need to flush any temporary data before a property change*/ - rtf_flush_data(ctx); - - switch (prop) { - case NMRTF_PROP_FONT_IDX: - ctx->chp.font_idx = val; - break; - case NMRTF_PROP_FONT_CHARSET: - ctx->chp.font_charset = val; - break; - default: - return NMRTF_BAD_TABLE; - } - - return NMRTF_OK; -} - -/* - * Step 3. - * Search the table for keyword and evaluate it appropriately. - * - * Inputs: - * keyword: The RTF control to evaluate. - * param: The parameter of the RTF control. - * param_set: TRUE if the control had a parameter; (that is, if param is valid) - * FALSE if it did not. - */ -static int -rtf_dispatch_control(NMRtfContext *ctx, char *keyword, int param, gboolean param_set) -{ - int idx; - - for (idx = 0; idx < table_size; idx++) { - if (strcmp(keyword, rtf_symbols[idx].keyword) == 0) - break; - } - - if (idx == table_size) { - if (ctx->skip_unknown) - ctx->rds = NMRTF_STATE_SKIP; - ctx->skip_unknown = FALSE; - return NMRTF_OK; - } - - /* found it! use kwd_type and action to determine what to do with it. */ - ctx->skip_unknown = FALSE; - switch (rtf_symbols[idx].kwd_type) { - case NMRTF_KWD_PROP: - if (rtf_symbols[idx].pass_default || !param_set) - param = rtf_symbols[idx].default_val; - return rtf_apply_property(ctx, rtf_symbols[idx].action, param); - case NMRTF_KWD_CHAR: - return rtf_dispatch_char(ctx, rtf_symbols[idx].action); - case NMRTF_KWD_DEST: - return rtf_change_destination(ctx, rtf_symbols[idx].action); - case NMRTF_KWD_SPEC: - return rtf_dispatch_special(ctx, rtf_symbols[idx].action); - default: - return NMRTF_BAD_TABLE; - } - return NMRTF_BAD_TABLE; -} - -/* - * Change to the destination specified. - */ -static int -rtf_change_destination(NMRtfContext *ctx, NMRtfDestinationType type) -{ - /* if we're skipping text, don't do anything */ - if (ctx->rds == NMRTF_STATE_SKIP) - return NMRTF_OK; - - switch (type) { - case NMRTF_DEST_FONTTABLE: - ctx->rds = NMRTF_STATE_FONTTABLE; - g_string_truncate(ctx->ansi, 0); - break; - default: - ctx->rds = NMRTF_STATE_SKIP; /* when in doubt, skip it... */ - break; - } - return NMRTF_OK; -} - -/* - * Dispatch an RTF control that needs special processing - */ -static int -rtf_dispatch_special(NMRtfContext *ctx, NMRtfSpecialKwd type) -{ - int status = NMRTF_OK; - guchar ch; - - if (ctx->rds == NMRTF_STATE_SKIP && type != NMRTF_SPECIAL_BIN) /* if we're skipping, and it's not */ - return NMRTF_OK; /* the \bin keyword, ignore it. */ - - switch (type) { - case NMRTF_SPECIAL_BIN: - ctx->ris = NMRTF_STATE_BIN; - ctx->bytes_to_skip = ctx->param; - break; - case NMRTF_SPECIAL_SKIP: - ctx->skip_unknown = TRUE; - break; - case NMRTF_SPECIAL_HEX: - ctx->ris = NMRTF_STATE_HEX; - break; - case NMRTF_SPECIAL_UNICODE: - purple_debug_info("novell", "parsing unichar\n"); - status = rtf_dispatch_unicode_char(ctx, ctx->param); - /* Skip next char */ - if (status == NMRTF_OK) - status = rtf_get_char(ctx, &ch); - break; - default: - status = NMRTF_BAD_TABLE; - break; - } - - return status; -} - -/* - * Get the next character from the input stream - */ -static int -rtf_get_char(NMRtfContext *ctx, guchar *ch) -{ - if (ctx->nextch >= 0) { - *ch = ctx->nextch; - ctx->nextch = -1; - } - else { - *ch = *(ctx->input); - ctx->input++; - } - - if (*ch) - return NMRTF_OK; - else - return NMRTF_EOF; -} - -/* - * Move a character back into the input stream - */ -static int -rtf_unget_char(NMRtfContext *ctx, guchar ch) -{ - ctx->nextch = ch; - return NMRTF_OK; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmrtf.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * nmrtf.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NMRTF_H__ -#define __NMRTF_H__ - -typedef struct _NMRtfContext NMRtfContext; - -NMRtfContext *nm_rtf_init(void); -char *nm_rtf_strip_formatting(NMRtfContext *ctx, const char *input); -void nm_rtf_deinit(NMRtfContext *ctx); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2137 +0,0 @@ -/* - * nmuser.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include -#include "nmfield.h" -#include "nmuser.h" -#include "nmconn.h" -#include "nmcontact.h" -#include "nmuserrecord.h" -#include "util.h" - -/* This is the template that we wrap outgoing messages in, since the other - * GW Messenger clients expect messages to be in RTF. - */ -#define RTF_TEMPLATE "{\\rtf1\\ansi\n"\ - "{\\fonttbl{\\f0\\fnil Unknown;}}\n"\ - "{\\colortbl ;\\red0\\green0\\blue0;}\n"\ - "\\uc1\\cf1\\f0\\fs24 %s\\par\n}" -#define NM_MAX_MESSAGE_SIZE 2048 - -static NMERR_T nm_process_response(NMUser * user); -static void _update_contact_list(NMUser * user, NMField * fields); -static void _handle_multiple_get_details_login_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data); -static char * nm_rtfize_text(char *text); - -/** - * See header for comments on on "public" functions - */ - -NMUser * -nm_initialize_user(const char *name, const char *server_addr, - int port, gpointer data, nm_event_cb event_callback) -{ - NMUser *user; - if (name == NULL || server_addr == NULL || event_callback == NULL) - return NULL; - - user = g_new0(NMUser, 1); - - - - user->contacts = - g_hash_table_new_full(g_str_hash, nm_utf8_str_equal, - g_free, (GDestroyNotify) nm_release_contact); - - user->user_records = - g_hash_table_new_full(g_str_hash, nm_utf8_str_equal, g_free, - (GDestroyNotify) nm_release_user_record); - - user->display_id_to_dn = g_hash_table_new_full(g_str_hash, nm_utf8_str_equal, - g_free, g_free); - - user->name = g_strdup(name); - user->conn = nm_create_conn(server_addr, port); - user->conn->addr = g_strdup(server_addr); - user->conn->port = port; - user->evt_callback = event_callback; - user->client_data = data; - - return user; -} - - -void -nm_deinitialize_user(NMUser * user) -{ - nm_release_conn(user->conn); - - if (user->contacts) { - g_hash_table_destroy(user->contacts); - } - - if (user->user_records) { - g_hash_table_destroy(user->user_records); - } - - if (user->display_id_to_dn) { - g_hash_table_destroy(user->display_id_to_dn); - } - - if (user->name) { - g_free(user->name); - } - - if (user->user_record) { - nm_release_user_record(user->user_record); - } - - nm_conference_list_free(user); - nm_destroy_contact_list(user); - - g_free(user); -} - -NMERR_T -nm_send_login(NMUser * user, const char *pwd, const char *my_addr, - const char *user_agent, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL || pwd == NULL || user_agent == NULL) { - return NMERR_BAD_PARM; - } - - fields = nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(user->name), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_CREDENTIALS, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(pwd), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_USER_AGENT, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(user_agent), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_number(fields, NM_A_UD_BUILD, 0, NMFIELD_METHOD_VALID, 0, - NM_PROTOCOL_VERSION, NMFIELD_TYPE_UDWORD); - if (my_addr) { - fields = nm_field_add_pointer(fields, NM_A_IP_ADDRESS, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(my_addr), NMFIELD_TYPE_UTF8); - } - - /* Send the login */ - rc = nm_send_request(user->conn, "login", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_set_status(NMUser * user, int status, const char *text, - const char *auto_resp, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL) - return NMERR_BAD_PARM; - - /* Add the status */ - fields = nm_field_add_pointer(fields, NM_A_SZ_STATUS, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", status), NMFIELD_TYPE_UTF8); - - /* Add the status text and auto reply text if there is any */ - if (text) { - fields = nm_field_add_pointer(fields, NM_A_SZ_STATUS_TEXT, 0, - NMFIELD_METHOD_VALID, 0, g_strdup(text), - NMFIELD_TYPE_UTF8); - } - - if (auto_resp) { - fields = nm_field_add_pointer(fields, NM_A_SZ_MESSAGE_BODY, 0, - NMFIELD_METHOD_VALID, 0, g_strdup(auto_resp), - NMFIELD_TYPE_UTF8); - } - - rc = nm_send_request(user->conn, "setstatus", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_multiple_get_details(NMUser * user, GSList *names, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - GSList *node; - - if (user == NULL || names == NULL) - return NMERR_BAD_PARM; - - /* Add in DN or display id */ - for (node = names; node; node = node->next) { - fields = nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(node->data), NMFIELD_TYPE_UTF8); - } - - rc = nm_send_request(user->conn, "getdetails", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_get_details(NMUser * user, const char *name, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL || name == NULL) - return NMERR_BAD_PARM; - - /* Add in DN or display id */ - if (strstr("=", name)) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_DN); - } else { - - const char *dn = nm_lookup_dn(user, name); - if (dn) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_DN); - } else { - fields = - nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_UTF8); - } - - } - - rc = nm_send_request(user->conn, "getdetails", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_create_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMField *field = NULL; - NMRequest *req = NULL; - int count, i; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in a blank guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(BLANK_GUID), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - - /* Add participants in */ - count = nm_conference_get_participant_count(conference); - for (i = 0; i < count; i++) { - NMUserRecord *user_record = nm_conference_get_participant(conference, i); - - if (user_record) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, - 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_user_record_get_dn(user_record)), - NMFIELD_TYPE_DN); - } - } - - /* Add our user in */ - field = nm_locate_field(NM_A_SZ_DN, user->fields); - if (field) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, - 0, NMFIELD_METHOD_VALID, 0, - g_strdup((char *) field->ptr_value), - NMFIELD_TYPE_DN); - } - - rc = nm_send_request(user->conn, "createconf", fields, callback, data, &req); - if (rc == NM_OK && req) { - nm_conference_add_ref(conference); - nm_request_set_data(req, conference); - } - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_leave_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "leaveconf", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_join_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL, *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "joinconf", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_reject_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "rejectconf", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_conference_invite(NMUser *user, NMConference *conference, NMUserRecord *user_record, - const char *message, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL || user_record == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Add in DN of user to invite */ - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_user_record_get_dn(user_record)), - NMFIELD_TYPE_DN); - - /* Add the invite message if there is one */ - if (message) - fields = nm_field_add_pointer(fields, NM_A_SZ_MESSAGE_BODY, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(message), NMFIELD_TYPE_UTF8); - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "sendinvite", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_message(NMUser * user, NMMessage * message, nm_response_cb callback) -{ - NMERR_T rc = NM_OK; - char *text, *rtfized; - NMField *fields = NULL, *tmp = NULL; - NMConference *conf; - NMUserRecord *user_record; - int count, i; - - if (user == NULL || message == NULL) { - return NMERR_BAD_PARM; - } - - conf = nm_message_get_conference(message); - if (!nm_conference_is_instantiated(conf)) { - rc = NMERR_CONFERENCE_NOT_INSTANTIATED; - } else { - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conf)), - NMFIELD_TYPE_UTF8); - - fields = - nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, NMFIELD_METHOD_VALID, 0, - tmp, NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Add RTF and plain text versions of the message */ - text = g_strdup(nm_message_get_text(message)); - - /* Truncate if necessary */ - if (strlen(text) > NM_MAX_MESSAGE_SIZE) - text[NM_MAX_MESSAGE_SIZE] = 0; - - rtfized = nm_rtfize_text(text); - - purple_debug_info("novell", "message text is: %s\n", text); - purple_debug_info("novell", "message rtf is: %s\n", rtfized); - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_MESSAGE_BODY, 0, NMFIELD_METHOD_VALID, 0, - rtfized, NMFIELD_TYPE_UTF8); - - tmp = nm_field_add_number(tmp, NM_A_UD_MESSAGE_TYPE, 0, NMFIELD_METHOD_VALID, 0, - 0, NMFIELD_TYPE_UDWORD); - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_MESSAGE_TEXT, 0, NMFIELD_METHOD_VALID, 0, - text, NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_MESSAGE, 0, NMFIELD_METHOD_VALID, 0, - tmp, NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Add participants */ - count = nm_conference_get_participant_count(conf); - for (i = 0; i < count; i++) { - user_record = nm_conference_get_participant(conf, i); - if (user_record) { - fields = - nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_user_record_get_dn(user_record)), - NMFIELD_TYPE_DN); - } - } - - /* Send the request */ - rc = nm_send_request(user->conn, "sendmessage", fields, callback, NULL, NULL); - } - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_typing(NMUser * user, NMConference * conf, - gboolean typing, nm_response_cb callback) -{ - NMERR_T rc = NM_OK; - char *str = NULL; - NMField *fields = NULL, *tmp = NULL; - - if (user == NULL || conf == NULL) { - return NMERR_BAD_PARM; - } - - if (!nm_conference_is_instantiated(conf)) { - rc = NMERR_CONFERENCE_NOT_INSTANTIATED; - } else { - /* Add the conference GUID */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conf)), - NMFIELD_TYPE_UTF8); - - /* Add typing type */ - str = g_strdup_printf("%d", - (typing ? NMEVT_USER_TYPING : - NMEVT_USER_NOT_TYPING)); - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_TYPE, 0, NMFIELD_METHOD_VALID, 0, - str, NMFIELD_TYPE_UTF8); - - fields = - nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, NMFIELD_METHOD_VALID, 0, - tmp, NMFIELD_TYPE_ARRAY); - tmp = NULL; - - rc = nm_send_request(user->conn, "sendtyping", fields, callback, NULL, NULL); - } - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_create_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - const char *name = NULL; - const char *display_name = NULL; - - if (user == NULL || folder == NULL || contact == NULL) { - return NMERR_BAD_PARM; - } - - /* Add parent ID */ - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Check to see if userid is current user and return an error? */ - - /* Check to see if contact already exists and return an error? */ - - /* Add userid or dn */ - name = nm_contact_get_dn(contact); - if (name == NULL) - return NMERR_BAD_PARM; - - if (strstr("=", name)) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_DN); - } else { - fields = nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_UTF8); - } - - /* Add display name */ - display_name = nm_contact_get_display_name(contact); - if (display_name) - fields = nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(display_name), NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "createcontact", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_remove_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - - if (user == NULL || folder == NULL || contact == NULL) { - return NMERR_BAD_PARM; - } - - /* Add parent id */ - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Add object id */ - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_contact_get_id(contact)), - NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "deletecontact", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_create_folder(NMUser * user, const char *name, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - - if (user == NULL || name == NULL) { - return NMERR_BAD_PARM; - } - - /* Add parent ID */ - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("0"), NMFIELD_TYPE_UTF8); - - /* Add name of the folder to add */ - fields = - nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_UTF8); - - /* Add sequence, for now just put it at the bottom */ - fields = - nm_field_add_pointer(fields, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("-1"), NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "createfolder", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, g_strdup(name)); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_remove_folder(NMUser * user, NMFolder * folder, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - - if (user == NULL || folder == NULL) { - return NMERR_BAD_PARM; - } - - /* Add the object id */ - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "deletecontact", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, folder); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_get_status(NMUser * user, NMUserRecord * user_record, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - const char *dn; - - if (user == NULL || user_record == NULL) - return NMERR_BAD_PARM; - - /* Add DN to field list */ - dn = nm_user_record_get_dn(user_record); - if (dn == NULL) - return (NMERR_T) -1; - - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(dn), NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "getstatus", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, user_record); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_rename_contact(NMUser * user, NMContact * contact, - const char *new_name, nm_response_cb callback, - gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *field = NULL, *fields = NULL, *list = NULL; - NMRequest *req = NULL; - - if (user == NULL || contact == NULL || new_name == NULL) - return NMERR_BAD_PARM; - - /* Create field list for current contact */ - field = nm_contact_to_fields(contact); - if (field) { - - fields = - nm_field_add_pointer(fields, NM_A_FA_CONTACT, 0, NMFIELD_METHOD_DELETE, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Update the contacts display name locally */ - nm_contact_set_display_name(contact, new_name); - - /* Create field list for updated contact */ - field = nm_contact_to_fields(contact); - if (field) { - fields = - nm_field_add_pointer(fields, NM_A_FA_CONTACT, 0, NMFIELD_METHOD_ADD, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Package it up */ - list = - nm_field_add_pointer(list, NM_A_FA_CONTACT_LIST, 0, NMFIELD_METHOD_VALID, - 0, fields, NMFIELD_TYPE_ARRAY); - fields = NULL; - - rc = nm_send_request(user->conn, "updateitem", list, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - } - } - - if (req) - nm_release_request(req); - - if (list) - nm_free_fields(&list); - - return rc; -} - -NMERR_T -nm_send_rename_folder(NMUser * user, NMFolder * folder, const char *new_name, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *field = NULL, *fields = NULL, *list = NULL; - NMRequest *req = NULL; - - if (user == NULL || folder == NULL || new_name == NULL) - return NMERR_BAD_PARM; - - /* Make sure folder does not already exist!? */ - if (nm_find_folder(user, new_name)) - return NMERR_FOLDER_EXISTS; - - /* Create field list for current folder */ - field = nm_folder_to_fields(folder); - if (field) { - - fields = nm_field_add_pointer(fields, NM_A_FA_FOLDER, 0, NMFIELD_METHOD_DELETE, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Update the folders display name locally */ - nm_folder_set_name(folder, new_name); - - /* Create field list for updated folder */ - field = nm_folder_to_fields(folder); - if (field) { - fields = nm_field_add_pointer(fields, NM_A_FA_FOLDER, 0, NMFIELD_METHOD_ADD, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Package it up */ - list = nm_field_add_pointer(list, NM_A_FA_CONTACT_LIST, 0, NMFIELD_METHOD_VALID, - 0, fields, NMFIELD_TYPE_ARRAY); - fields = NULL; - - rc = nm_send_request(user->conn, "updateitem", list, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, folder); - } - } - - if (req) - nm_release_request(req); - - if (list) - nm_free_fields(&list); - - return rc; -} - -NMERR_T -nm_send_move_contact(NMUser * user, NMContact * contact, NMFolder * folder, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *field = NULL, *fields = NULL, *list = NULL; - NMRequest *req = NULL; - - if (user == NULL || contact == NULL || folder == NULL) - return NMERR_BAD_PARM; - - /* Create field list for the contact */ - field = nm_contact_to_fields(contact); - if (field) { - - fields = nm_field_add_pointer(fields, NM_A_FA_CONTACT, 0, NMFIELD_METHOD_DELETE, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Wrap the contact up and add it to the request field list */ - list = nm_field_add_pointer(list, NM_A_FA_CONTACT_LIST, 0, NMFIELD_METHOD_VALID, 0, - fields, NMFIELD_TYPE_ARRAY); - fields = NULL; - - /* Add sequence number */ - list = nm_field_add_pointer(list, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, - 0, g_strdup("-1"), NMFIELD_TYPE_UTF8); - - /* Add parent ID */ - list = nm_field_add_pointer(list, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "movecontact", list, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - - } - - if (req) - nm_release_request(req); - - if (list) - nm_free_fields(&list); - - return rc; -} - - -NMERR_T -nm_send_create_privacy_item(NMUser *user, const char *who, gboolean allow_list, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - const char *tag; - - if (user == NULL || who == NULL) - return NMERR_BAD_PARM; - - if (allow_list) - tag = NM_A_SZ_BLOCKING_ALLOW_ITEM; - else - tag = NM_A_SZ_BLOCKING_DENY_ITEM; - - fields = nm_field_add_pointer(fields, tag, 0, NMFIELD_METHOD_ADD, 0, - g_strdup(who), NMFIELD_TYPE_UTF8); - - rc = nm_send_request(user->conn, "createblock", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_remove_privacy_item(NMUser *user, const char *dn, gboolean allow_list, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - const char *tag; - GSList **list_ptr, *node; - - if (user == NULL || dn == NULL) - return NMERR_BAD_PARM; - - if (allow_list) { - tag = NM_A_BLOCKING_ALLOW_LIST; - list_ptr = &user->allow_list; - } else { - tag = NM_A_BLOCKING_DENY_LIST; - list_ptr = &user->deny_list; - } - - /* Remove item from the cached list */ - if ((node = g_slist_find_custom(*list_ptr, dn, (GCompareFunc)purple_utf8_strcasecmp))) { - *list_ptr = g_slist_remove_link(*list_ptr, node); - g_slist_free_1(node); - } - - fields = nm_field_add_pointer(fields, tag, 0, NMFIELD_METHOD_DELETE, 0, - g_strdup(dn), NMFIELD_TYPE_DN); - - rc = nm_send_request(user->conn, "updateblocks", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; - -} - -NMERR_T -nm_send_set_privacy_default(NMUser *user, gboolean default_deny, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL) - return NMERR_BAD_PARM; - - fields = nm_field_add_pointer(fields, NM_A_BLOCKING, 0, NMFIELD_METHOD_UPDATE, 0, - (default_deny ? g_strdup("1") : g_strdup("0")), - NMFIELD_TYPE_UTF8); - - rc = nm_send_request(user->conn, "updateblocks", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_keepalive(NMUser *user, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - - if (user == NULL) - return NMERR_BAD_PARM; - - rc = nm_send_request(user->conn, "ping", NULL, callback, data, NULL); - - return rc; -} - -NMERR_T -nm_process_new_data(NMUser * user) -{ - NMConn *conn; - NMERR_T rc = NM_OK; - guint32 val; - - if (user == NULL) - return NMERR_BAD_PARM; - - conn = user->conn; - - /* Check to see if this is an event or a response */ - rc = nm_read_all(conn, (char *) &val, sizeof(val)); - if (rc == NM_OK) { - if (strncmp((char *) &val, "HTTP", strlen("HTTP")) == 0) - rc = nm_process_response(user); - else - rc = nm_process_event(user, GUINT32_FROM_LE(val)); - - } else { - if (errno == EAGAIN) - rc = NM_OK; - else - rc = NMERR_PROTOCOL; - } - - return rc; -} - -NMConference * -nm_find_conversation(NMUser * user, const char *who) -{ - NMConference *conference = NULL; - NMConference *tmp; - GSList *cnode; - - if (user && user->conferences) { - for (cnode = user->conferences; cnode; cnode = cnode->next) { - tmp = cnode->data; - if (nm_conference_get_participant_count(tmp) == 1) { - NMUserRecord *ur = nm_conference_get_participant(tmp, 0); - - if (ur) { - if (nm_utf8_str_equal(nm_user_record_get_dn(ur), who)) { - conference = tmp; - break; - } - } - } - } - } - - return conference; -} - -void -nm_conference_list_add(NMUser * user, NMConference * conf) -{ - if (user == NULL || conf == NULL) - return; - - nm_conference_add_ref(conf); - user->conferences = g_slist_append(user->conferences, conf); -} - -void -nm_conference_list_remove(NMUser * user, NMConference * conf) -{ - if (user == NULL || conf == NULL) - return; - - if (g_slist_find(user->conferences, conf)) { - user->conferences = g_slist_remove(user->conferences, conf); - nm_release_conference(conf); - } -} - -void -nm_conference_list_free(NMUser * user) -{ - GSList *cnode; - NMConference *conference; - - if (user == NULL) - return; - - if (user->conferences) { - for (cnode = user->conferences; cnode; cnode = cnode->next) { - conference = cnode->data; - cnode->data = NULL; - nm_release_conference(conference); - } - - g_slist_free(user->conferences); - user->conferences = NULL; - } -} - -NMConference * -nm_conference_list_find(NMUser * user, const char *guid) -{ - GSList *cnode; - NMConference *conference = NULL, *tmp; - - if (user == NULL || guid == NULL) - return NULL; - - if (user->conferences) { - for (cnode = user->conferences; cnode; cnode = cnode->next) { - tmp = cnode->data; - if (nm_are_guids_equal(nm_conference_get_guid(tmp), guid)) { - conference = tmp; - break; - } - } - } - - return conference; -} - -gboolean -nm_are_guids_equal(const char *guid1, const char *guid2) -{ - if (guid1 == NULL || guid2 == NULL) - return FALSE; - - return (strncmp(guid1, guid2, CONF_GUID_END) == 0); -} - -void -nm_user_add_contact(NMUser * user, NMContact * contact) -{ - if (user == NULL || contact == NULL) - return; - - nm_contact_add_ref(contact); - - g_hash_table_insert(user->contacts, - g_utf8_strdown(nm_contact_get_dn(contact), -1), contact); -} - -void -nm_user_add_user_record(NMUser * user, NMUserRecord * user_record) -{ - const char *display_id; - const char *dn; - - if (!user || !user_record) - return; - - display_id = nm_user_record_get_display_id(user_record); - dn = nm_user_record_get_dn(user_record); - - if (!dn || !display_id) - return; - - nm_user_record_add_ref(user_record); - - g_hash_table_insert(user->user_records, - g_utf8_strdown(dn, -1), - user_record); - - g_hash_table_insert(user->display_id_to_dn, - g_utf8_strdown(display_id, -1), - g_utf8_strdown(dn, -1)); -} - -nm_event_cb -nm_user_get_event_callback(NMUser * user) -{ - if (user == NULL) - return NULL; - - return user->evt_callback; -} - -NMConn * -nm_user_get_conn(NMUser * user) -{ - if (user == NULL) - return NULL; - - return user->conn; -} - -NMERR_T -nm_create_contact_list(NMUser * user) -{ - NMERR_T rc = NM_OK; - NMField *locate = NULL; - - if (user == NULL || user->fields == NULL) { - return NMERR_BAD_PARM; - } - - /* Create the root folder */ - user->root_folder = nm_create_folder(""); - - /* Find the contact list in the login fields */ - locate = nm_locate_field(NM_A_FA_CONTACT_LIST, user->fields); - if (locate != NULL) { - - /* Add the folders and then the contacts */ - nm_folder_add_contacts_and_folders(user, user->root_folder, - (NMField *) (locate->ptr_value)); - - } - - return rc; -} - -gboolean nm_user_is_privacy_locked(NMUser *user) -{ - if (user) { - return user->privacy_locked; - } - - return FALSE; -} - -static gboolean -_create_privacy_list(NMUser * user, NMRequest *request) -{ - NMField *locate = NULL; - GSList *need_details = NULL; - - /* Are the privacy settings locked */ - locate = nm_locate_field(NM_A_LOCKED_ATTR_LIST, user->fields); - if (locate && locate->ptr_value) { - if (locate->type == NMFIELD_TYPE_UTF8 && - (purple_utf8_strcasecmp(locate->ptr_value, NM_A_BLOCKING) == 0)) { - user->privacy_locked = TRUE; - } else if (locate->type == NMFIELD_TYPE_MV || - locate->type == NMFIELD_TYPE_ARRAY) { - NMField *tmp = (NMField *)locate->ptr_value; - while (tmp && tmp->tag) { - if (purple_utf8_strcasecmp(tmp->ptr_value, NM_A_BLOCKING) == 0) { - user->privacy_locked = TRUE; - break; - } - tmp++; - } - } - } - - /* Set default deny flag */ - locate = nm_locate_field(NM_A_BLOCKING, user->fields); - if (locate && locate->ptr_value) { - user->default_deny = atoi((char *)locate->ptr_value); - } - - /* Read internal blocking allow list */ - locate = nm_locate_field(NM_A_BLOCKING_ALLOW_LIST, user->fields); - if (locate && locate->ptr_value) { - - if (locate->type == NMFIELD_TYPE_MV) { - locate = (NMField *)locate->ptr_value; - for (; locate->tag != NULL; locate++) { - if (locate->ptr_value) { - - user->allow_list = g_slist_append(user->allow_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - } else { - - user->allow_list = g_slist_append(user->allow_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - - /* Read internal blocking deny list */ - locate = nm_locate_field(NM_A_BLOCKING_DENY_LIST, user->fields); - if (locate && locate->ptr_value) { - - if (locate->type == NMFIELD_TYPE_MV) { - locate = (NMField *)locate->ptr_value; - for (; locate->tag != NULL; locate++) { - if (locate->ptr_value) { - - user->deny_list = g_slist_append(user->deny_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - } else { - - user->deny_list = g_slist_append(user->deny_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - - if (need_details) { - - nm_request_add_ref(request); - nm_send_multiple_get_details(user, need_details, - _handle_multiple_get_details_login_cb, request); - - return FALSE; - } - - return TRUE; -} - -void -nm_destroy_contact_list(NMUser * user) -{ - if (user == NULL) - return; - - if (user->root_folder) { - nm_release_folder(user->root_folder); - user->root_folder = NULL; - } -} - -NMFolder * -nm_get_root_folder(NMUser * user) -{ - if (user == NULL) - return NULL; - - if (user->root_folder == NULL) - nm_create_contact_list(user); - - return user->root_folder; -} - -NMContact * -nm_find_contact(NMUser * user, const char *name) -{ - char *str; - const char *dn = NULL; - NMContact *contact = NULL; - - if (user == NULL || name == NULL) - return NULL; - - str = g_utf8_strdown(name, -1); - if (strstr(str, "=")) { - dn = str; - } else { - /* Assume that we have a display id instead of a dn */ - dn = (const char *) g_hash_table_lookup(user->display_id_to_dn, str); - } - - /* Find contact object in reference table */ - if (dn) { - contact = (NMContact *) g_hash_table_lookup(user->contacts, dn); - } - - g_free(str); - return contact; -} - -GList * -nm_find_contacts(NMUser * user, const char *dn) -{ - guint32 i, cnt; - NMFolder *folder; - NMContact *contact; - GList *contacts = NULL; - - if (user == NULL || dn == NULL) - return NULL; - - /* Check for contact at the root */ - contact = nm_folder_find_contact(user->root_folder, dn); - if (contact) { - contacts = g_list_append(contacts, contact); - contact = NULL; - } - - /* Check for contact in each subfolder */ - cnt = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < cnt; i++) { - folder = nm_folder_get_subfolder(user->root_folder, i); - contact = nm_folder_find_contact(folder, dn); - if (contact) { - contacts = g_list_append(contacts, contact); - contact = NULL; - } - } - - return contacts; -} - -NMUserRecord * -nm_find_user_record(NMUser * user, const char *name) -{ - char *str = NULL; - const char *dn = NULL; - NMUserRecord *user_record = NULL; - - if (user == NULL || name == NULL) - return NULL; - - str = g_utf8_strdown(name, -1); - if (strstr(str, "=")) { - dn = str; - } else { - /* Assume that we have a display id instead of a dn */ - dn = (const char *) g_hash_table_lookup(user->display_id_to_dn, str); - } - - /* Find user record in reference table */ - if (dn) { - user_record = - (NMUserRecord *) g_hash_table_lookup(user->user_records, dn); - } - - g_free(str); - return user_record; -} - -const char * -nm_lookup_dn(NMUser * user, const char *display_id) -{ - const char *dn; - char *lower; - - if (user == NULL || display_id == NULL) - return NULL; - - lower = g_utf8_strdown(display_id, -1); - dn = g_hash_table_lookup(user->display_id_to_dn, lower); - g_free(lower); - - return dn; -} - -NMFolder * -nm_find_folder(NMUser * user, const char *name) -{ - NMFolder *folder = NULL, *temp; - int i, num_folders; - const char *tname = NULL; - - if (user == NULL || name == NULL) - return NULL; - - if (*name == '\0') - return user->root_folder; - - num_folders = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < num_folders; i++) { - temp = nm_folder_get_subfolder(user->root_folder, i); - tname = nm_folder_get_name(temp); - if (tname && (strcmp(tname, name) == 0)) { - folder = temp; - break; - } - } - - return folder; -} - -NMFolder * -nm_find_folder_by_id(NMUser * user, int object_id) -{ - NMFolder *folder = NULL, *temp; - int i, num_folders; - - if (user == NULL) - return NULL; - - if (object_id == 0) - return user->root_folder; - - num_folders = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < num_folders; i++) { - temp = nm_folder_get_subfolder(user->root_folder, i); - if (nm_folder_get_id(temp) == object_id) { - folder = temp; - break; - } - } - - return folder; -} - -static void -_handle_multiple_get_details_login_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - nm_response_cb cb; - NMRequest *request = user_data; - - if (user == NULL || request == NULL) - return; - - if ((cb = nm_request_get_callback(request))) { - cb(user, ret_code, nm_request_get_data(request), - nm_request_get_user_define(request)); - nm_release_request(request); - } -} - -static void -_handle_multiple_get_details_joinconf_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMRequest *request = user_data; - NMUserRecord *user_record = resp_data; - NMConference *conference; - GSList *list, *node; - - if (user == NULL || resp_data == NULL || user_data == NULL) - return; - - conference = nm_request_get_data(request); - list = nm_request_get_user_define(request); - - if (ret_code == 0 && conference && list) { - - /* Add the user to the conference */ - nm_conference_add_participant(conference, user_record); - - /* Find the user in the list and remove it */ - for (node = list; node; node = node->next) { - if (nm_utf8_str_equal(nm_user_record_get_dn(user_record), - (const char *) node->data)) { - g_free(node->data); - list = g_slist_remove(list, node->data); - nm_request_set_user_define(request, list); - break; - } - } - - /* Time to callback? */ - if (list == NULL) { - nm_response_cb cb = nm_request_get_callback(request); - - if (cb) { - cb(user, 0, conference, conference); - } - nm_release_request(request); - } - } -} - -static NMERR_T -nm_call_handler(NMUser * user, NMRequest * request, NMField * fields) -{ - NMERR_T rc = NM_OK, ret_code = NM_OK; - NMConference *conf = NULL; - NMUserRecord *user_record = NULL; - NMField *locate = NULL; - NMField *field = NULL; - const char *cmd; - nm_response_cb cb; - gboolean done = TRUE; - - if (user == NULL || request == NULL || fields == NULL) - return NMERR_BAD_PARM; - - /* Get the return code */ - field = nm_locate_field(NM_A_SZ_RESULT_CODE, fields); - if (field) { - ret_code = atoi((char *) field->ptr_value); - } else { - ret_code = NMERR_PROTOCOL; - } - - cmd = nm_request_get_cmd(request); - if (ret_code == NM_OK && cmd != NULL) { - - if (strcmp("login", cmd) == 0) { - - user->user_record = nm_create_user_record_from_fields(fields); - - /* Save the users fields */ - user->fields = nm_copy_field_array(fields); - - nm_create_contact_list(user); - done = _create_privacy_list(user, request); - - } else if (strcmp("setstatus", cmd) == 0) { - - /* Nothing to do */ - - } else if (strcmp("createconf", cmd) == 0) { - - conf = (NMConference *) nm_request_get_data(request); - - /* get the convo guid */ - locate = nm_locate_field(NM_A_FA_CONVERSATION, fields); - if (locate) { - field = - nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value); - if (field) { - nm_conference_set_guid(conf, (char *) field->ptr_value); - } - } - - nm_conference_list_add(user, conf); - nm_release_conference(conf); - - } else if (strcmp("leaveconf", cmd) == 0) { - - conf = (NMConference *) nm_request_get_data(request); - nm_conference_list_remove(user, conf); - - } else if (strcmp("joinconf", cmd) == 0) { - GSList *list = NULL, *node; - - conf = nm_request_get_data(request); - - locate = nm_locate_field(NM_A_FA_CONTACT_LIST, fields); - if (locate && locate->ptr_value != 0) { - - field = (NMField *) locate->ptr_value; - while ((field = nm_locate_field(NM_A_SZ_DN, field))) { - if (field && field->ptr_value != 0) { - - if (nm_utf8_str_equal - (nm_user_record_get_dn(user->user_record), - (const char *) field->ptr_value)) { - field++; - continue; - } - - user_record = - nm_find_user_record(user, - (const char *) field->ptr_value); - if (user_record == NULL) { - list = - g_slist_append(list, - g_strdup((char *) field->ptr_value)); - } else { - nm_conference_add_participant(conf, user_record); - } - } - field++; - } - - if (list != NULL) { - - done = FALSE; - nm_request_set_user_define(request, list); - nm_request_add_ref(request); - for (node = list; node; node = node->next) { - - nm_send_get_details(user, (const char *) node->data, - _handle_multiple_get_details_joinconf_cb, - request); - } - } - } - - } else if (strcmp("getdetails", cmd) == 0) { - - locate = nm_locate_field(NM_A_FA_RESULTS, fields); - while (locate && locate->ptr_value != 0) { - - user_record = nm_create_user_record_from_fields(locate); - if (user_record) { - NMUserRecord *tmp; - - tmp = - nm_find_user_record(user, - nm_user_record_get_dn(user_record)); - if (tmp) { - - /* Update the existing user record */ - nm_user_record_copy(tmp, user_record); - nm_release_user_record(user_record); - user_record = tmp; - - } else { - nm_user_add_user_record(user, user_record); - nm_release_user_record(user_record); - } - - /* Response data is new user record */ - nm_request_set_data(request, (gpointer) user_record); - } - - locate = nm_locate_field(NM_A_FA_RESULTS, locate+1); - } - - } else if (strcmp("createfolder", cmd) == 0) { - - _update_contact_list(user, fields); - - } else if (strcmp("createcontact", cmd) == 0) { - - _update_contact_list(user, fields); - - locate = - nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value); - if (locate) { - - NMContact *new_contact = - nm_folder_find_item_by_object_id(user->root_folder, - atoi((char *)locate->ptr_value)); - - if (new_contact) { - - /* Add the contact to our cache */ - nm_user_add_contact(user, new_contact); - - /* Set the contact as the response data */ - nm_request_set_data(request, (gpointer) new_contact); - - } - - } - - } else if (strcmp("deletecontact", cmd) == 0) { - - _update_contact_list(user, fields); - - } else if (strcmp("movecontact", cmd) == 0) { - - _update_contact_list(user, fields); - - } else if (strcmp("getstatus", cmd) == 0) { - - locate = nm_locate_field(NM_A_SZ_STATUS, fields); - if (locate) { - nm_user_record_set_status((NMUserRecord *) - nm_request_get_data(request), - atoi((char *) locate->ptr_value), NULL); - } - - } else if (strcmp("updateitem", cmd) == 0) { - - /* Nothing extra to do here */ - - } else if (strcmp("createblock", cmd) == 0) { - if ((locate = nm_locate_field(NM_A_BLOCKING_DENY_LIST, fields))) { - if (locate->ptr_value) { - user->deny_list = g_slist_append(user->deny_list, g_strdup((char *)locate->ptr_value)); - } - } else if ((locate = nm_locate_field(NM_A_BLOCKING_ALLOW_LIST, fields))) { - if (locate->ptr_value) { - user->allow_list = g_slist_append(user->allow_list, g_strdup((char *)locate->ptr_value)); - } - } - } else if (strcmp("updateblocks", cmd) == 0) { - /* nothing to do here */ - } else { - - /* Nothing to do, just print debug message */ - purple_debug(PURPLE_DEBUG_INFO, "novell", - "nm_call_handler(): Unknown request command, %s\n", cmd); - - } - } - - if (done && (cb = nm_request_get_callback(request))) { - - cb(user, ret_code, nm_request_get_data(request), - nm_request_get_user_define(request)); - } - - return rc; -} - -static NMERR_T -nm_process_response(NMUser * user) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *field = NULL; - NMConn *conn = user->conn; - NMRequest *req = NULL; - - rc = nm_read_header(conn); - if (rc == NM_OK) { - rc = nm_read_fields(conn, -1, &fields); - } - - if (rc == NM_OK) { - field = nm_locate_field(NM_A_SZ_TRANSACTION_ID, fields); - if (field != NULL && field->ptr_value != 0) { - req = nm_conn_find_request(conn, atoi((char *) field->ptr_value)); - if (req != NULL) { - rc = nm_call_handler(user, req, fields); - nm_conn_remove_request_item(conn, req); - } - - } - } - - if (fields) - nm_free_fields(&fields); - - return rc; -} - -/* - * Some utility functions...haven't figured out where - * they belong yet. - */ - -gboolean -nm_utf8_str_equal(gconstpointer str1, gconstpointer str2) -{ - return (purple_utf8_strcasecmp(str1, str2) == 0); -} - -char * -nm_typed_to_dotted(const char *typed) -{ - unsigned i = 0, j = 0; - char *dotted; - - if (typed == NULL) - return NULL; - - dotted = g_new0(char, strlen(typed)); - - do { - - /* replace comma with a dot */ - if (j != 0) { - dotted[j] = '.'; - j++; - } - - /* skip the type */ - while (typed[i] != '\0' && typed[i] != '=') - i++; - - /* verify that we aren't running off the end */ - if (typed[i] == '\0') { - dotted[j] = '\0'; - break; - } - - i++; - - /* copy the object name to context */ - while (typed[i] != '\0' && typed[i] != ',') { - dotted[j] = typed[i]; - j++; - i++; - } - - } while (typed[i] != '\0'); - - return dotted; -} - -const char * -nm_error_to_string(NMERR_T err) -{ - static char *unknown_msg = NULL; - - g_free(unknown_msg); - unknown_msg = NULL; - - switch (err) { - - case NMERR_BAD_PARM: - return _("Required parameters not passed in"); - - case NMERR_TCP_WRITE: - return _("Unable to write to network"); - - case NMERR_TCP_READ: - return _("Unable to read from network"); - - case NMERR_PROTOCOL: - return _("Error communicating with server"); - - case NMERR_CONFERENCE_NOT_FOUND: - case NMERR_CONFERENCE_NOT_FOUND_2: - return _("Conference not found"); - - case NMERR_CONFERENCE_NOT_INSTANTIATED: - return _("Conference does not exist"); - - case NMERR_DUPLICATE_FOLDER: - case NMERR_FOLDER_EXISTS: - return _("A folder with that name already exists"); - - case NMERR_NOT_SUPPORTED: - return _("Not supported"); - - case NMERR_PASSWORD_EXPIRED: - case NMERR_PASSWORD_EXPIRED_2: - return _("Password has expired"); - - case NMERR_PASSWORD_INVALID: - return _("Incorrect password"); - - case NMERR_USER_NOT_FOUND: - return _("User not found"); - - case NMERR_USER_DISABLED: - return _("Account has been disabled"); - - case NMERR_DIRECTORY_FAILURE: - return _("The server could not access the directory"); - - case NMERR_ADMIN_LOCKED: - return _("Your system administrator has disabled this operation"); - - case NMERR_SERVER_BUSY: - return _("The server is unavailable; try again later"); - - case NMERR_DUPLICATE_CONTACT: - return _("Cannot add a contact to the same folder twice"); - - case NMERR_USER_NOT_ALLOWED: - return _("Cannot add yourself"); - - case NMERR_MASTER_ARCHIVE_MISSING: - return _("Master archive is misconfigured"); - - case NMERR_AUTHENTICATION_FAILED: - case NMERR_CREDENTIALS_MISSING: - return _("Incorrect username or password"); - - case NMERR_HOST_NOT_FOUND: - return _("Could not recognize the host of the username you entered"); - - case NMERR_ACCESS_DENIED: - return _("Your account has been disabled because too many incorrect passwords were entered"); - - case NMERR_DUPLICATE_PARTICIPANT: - return _("You cannot add the same person twice to a conversation"); - - case NMERR_TOO_MANY_CONTACTS: - case NMERR_TOO_MANY_FOLDERS: - return _("You have reached your limit for the number of contacts allowed"); - - case NMERR_OBJECT_NOT_FOUND: - return _("You have entered an incorrect username"); - - case NMERR_DIRECTORY_UPDATE: - return _("An error occurred while updating the directory"); - - case NMERR_SERVER_PROTOCOL: - return _("Incompatible protocol version"); - - case NMERR_USER_BLOCKED: - return _("The user has blocked you"); - - case NMERR_EVAL_CONNECTION_LIMIT: - return _("This evaluation version does not allow more than ten users to log in at one time"); - - case NMERR_CONVERSATION_INVITE: - return _("The user is either offline or you are blocked"); - - default: - unknown_msg = g_strdup_printf (_("Unknown error: 0x%X"), err); - - return unknown_msg; - } -} - -static void -_update_contact_list(NMUser * user, NMField * fields) -{ - NMField *list, *cursor, *locate; - gint objid1; - NMContact *contact; - NMFolder *folder; - gpointer item; - - if (user == NULL || fields == NULL) - return; - - /* Is it wrapped in a RESULTS array? */ - if (strcmp(fields->tag, NM_A_FA_RESULTS) == 0) { - list = (NMField *) fields->ptr_value; - } else { - list = fields; - } - - /* Update the cached contact list */ - cursor = (NMField *) list->ptr_value; - while (cursor->tag != NULL) { - if ((g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) || - (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) == 0)) { - - locate = - nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) cursor->ptr_value); - if (locate != NULL && locate->ptr_value != 0) { - objid1 = atoi((char *) locate->ptr_value); - item = - nm_folder_find_item_by_object_id(user->root_folder, objid1); - if (item != NULL) { - if (cursor->method == NMFIELD_METHOD_ADD) { - if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) { - contact = (NMContact *) item; - nm_contact_update_list_properties(contact, cursor); - } else if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) - == 0) { - folder = (NMFolder *) item; - nm_folder_update_list_properties(folder, cursor); - } - } else if (cursor->method == NMFIELD_METHOD_DELETE) { - if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) { - contact = (NMContact *) item; - folder = - nm_find_folder_by_id(user, - nm_contact_get_parent_id - (contact)); - if (folder) { - nm_folder_remove_contact(folder, contact); - } - } else if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) - == 0) { - /* TODO: write nm_folder_remove_folder */ - /* ignoring for now, should not be a big deal */ -/* folder = (NMFolder *) item;*/ -/* nm_folder_remove_folder(user->root_folder, folder);*/ - } - } - } else { - - if (cursor->method == NMFIELD_METHOD_ADD) { - - /* Not found, so we need to add it */ - if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) { - - const char *dn = NULL; - - locate = - nm_locate_field(NM_A_SZ_DN, - (NMField *) cursor->ptr_value); - if (locate != NULL && locate->ptr_value != 0) { - dn = (const char *) locate->ptr_value; - if (dn != NULL) { - contact = - nm_create_contact_from_fields(cursor); - if (contact) { - nm_folder_add_contact_to_list(user-> - root_folder, - contact); - nm_release_contact(contact); - } - } - } - } else if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) - == 0) { - folder = nm_create_folder_from_fields(cursor); - nm_folder_add_folder_to_list(user->root_folder, - folder); - nm_release_folder(folder); - } - } - } - } - } - cursor++; - } -} - -static char * -nm_rtfize_text(char *text) -{ - GString *gstr = NULL; - unsigned char *pch; - char *uni_str = NULL, *rtf = NULL; - int bytes; - gunichar uc; - - gstr = g_string_sized_new(strlen(text)*2); - pch = (unsigned char *)text; - while (*pch) { - if ((*pch) <= 0x7F) { - switch (*pch) { - case '{': - case '}': - case '\\': - gstr = g_string_append_c(gstr, '\\'); - gstr = g_string_append_c(gstr, *pch); - break; - case '\n': - gstr = g_string_append(gstr, "\\par "); - break; - default: - gstr = g_string_append_c(gstr, *pch); - break; - } - pch++; - } else { - /* convert the utf-8 character to ucs-4 for rtf encoding */ - if(*pch <= 0xDF) { - uc = ((((gunichar)pch[0]) & 0x001F) << 6) | - (((gunichar)pch[1]) & 0x003F); - bytes = 2; - } else if(*pch <= 0xEF) { - uc = ((((gunichar)pch[0]) & 0x000F) << 12) | - ((((gunichar)pch[1]) & 0x003F) << 6) | - (((gunichar)pch[2]) & 0x003F); - bytes = 3; - } else if (*pch <= 0xF7) { - uc = ((((gunichar)pch[0]) & 0x0007) << 18) | - ((((gunichar)pch[1]) & 0x003F) << 12) | - ((((gunichar)pch[2]) & 0x003F) << 6) | - (((gunichar)pch[3]) & 0x003F); - bytes = 4; - } else if (*pch <= 0xFB) { - uc = ((((gunichar)pch[0]) & 0x0003) << 24) | - ((((gunichar)pch[1]) & 0x003F) << 18) | - ((((gunichar)pch[2]) & 0x003F) << 12) | - ((((gunichar)pch[3]) & 0x003F) << 6) | - (((gunichar)pch[4]) & 0x003F); - bytes = 5; - } else if (*pch <= 0xFD) { - uc = ((((gunichar)pch[0]) & 0x0001) << 30) | - ((((gunichar)pch[1]) & 0x003F) << 24) | - ((((gunichar)pch[2]) & 0x003F) << 18) | - ((((gunichar)pch[3]) & 0x003F) << 12) | - ((((gunichar)pch[4]) & 0x003F) << 6) | - (((gunichar)pch[5]) & 0x003F); - bytes = 6; - } else { - /* should never happen ... bogus utf-8! */ - purple_debug_info("novell", "bogus utf-8 lead byte: 0x%X\n", pch[0]); - uc = 0x003F; - bytes = 1; - } - uni_str = g_strdup_printf("\\u%d?", uc); - purple_debug_info("novell", "unicode escaped char %s\n", uni_str); - gstr = g_string_append(gstr, uni_str); - pch += bytes; - g_free(uni_str); - } - } - - rtf = g_strdup_printf(RTF_TEMPLATE, gstr->str); - g_string_free(gstr, TRUE); - return rtf; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,680 +0,0 @@ -/* - * nmuser.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_USER_H__ -#define __NM_USER_H__ - -#include -#include -#include - -typedef guint32 NMERR_T; -typedef int NMSTATUS_T; - -typedef struct _NMUser NMUser; - -typedef enum -{ - NMREQUEST_TYPE_LOGIN = 0, - NMREQUEST_TYPE_LOGOUT, - NMREQUEST_TYPE_SETSTATUS, - NMREQUEST_TYPE_GETDETAILS, - NMREQUEST_TYPE_CREATECONF, - NMREQUEST_TYPE_SENDMESSAGE, - NMREQUEST_TYPE_JOINCONF, - NMREQUEST_TYPE_LEAVECONF, - NMREQUEST_TYPE_REJECTCONF, - NMREQUEST_TYPE_SENDTYPING, - NMREQUEST_TYPE_CREATECONTACT, - NMREQUEST_TYPE_DELETECONTACT - -} NMRequestType; - -#include "debug.h" -#include "nmmessage.h" -#include "nmconference.h" -#include "nmcontact.h" -#include "nmuserrecord.h" -#include "nmfield.h" -#include "nmevent.h" - -/* Callback typedefs */ -typedef void (*nm_response_cb) (NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data); - -typedef void (*nm_event_cb) (NMUser * user, NMEvent * event); - -#include "nmrequest.h" -#include "nmconn.h" - -/* This represents user that we are currently logged in as */ -struct _NMUser -{ - - char *name; - - NMSTATUS_T status; - - /* A copy of the login response fields */ - NMField *fields; - - /* The user record for this user */ - NMUserRecord *user_record; - - /* Our connection information */ - NMConn *conn; - - /* Our public IP address */ - char *address; - - /* This is the contact list */ - NMFolder *root_folder; - - /* All contacts that we know about hashed by dn */ - GHashTable *contacts; - - /* All user records hashed by dn */ - GHashTable *user_records; - - /* DN lookup */ - GHashTable *display_id_to_dn; - - /* One on one conversations indexed by recipient's dn */ - GSList *conferences; - - guint32 conference_count; - - /* Called when we receive an event */ - nm_event_cb evt_callback; - - /* Privacy settings */ - gboolean privacy_locked; - gboolean default_deny; - GSList *allow_list; - GSList *deny_list; - - /* Pending requests. If we need to go to the server to more info - * before processing a request we will queue it up and process when - * we get a response - */ - GSList *pending_requests; - - /* Pending events. Same as above except for events. */ - GSList *pending_events; - - /* Generic pointer to data needed by the client - * using the API - */ - gpointer client_data; - - /* Have the privacy lists been synched yet */ - gboolean privacy_synched; - - /* Has the contact list been synched */ - gboolean clist_synched; -}; - -#define NM_STATUS_UNKNOWN 0 -#define NM_STATUS_OFFLINE 1 -#define NM_STATUS_AVAILABLE 2 -#define NM_STATUS_BUSY 3 -#define NM_STATUS_AWAY 4 -#define NM_STATUS_AWAY_IDLE 5 -#define NM_STATUS_INVALID 6 - -#define NMERR_BASE 0x2000L -#define NM_OK 0L -#define NMERR_BAD_PARM (NMERR_BASE + 0x0001) -#define NMERR_TCP_WRITE (NMERR_BASE + 0x0002) -#define NMERR_TCP_READ (NMERR_BASE + 0x0003) -#define NMERR_PROTOCOL (NMERR_BASE + 0x0004) -#define NMERR_SERVER_REDIRECT (NMERR_BASE + 0x0005) -#define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006) -#define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007) -#define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008) - -/* Errors that are returned from the server */ -#define NMERR_SERVER_BASE 0xD100L -#define NMERR_ACCESS_DENIED (NMERR_SERVER_BASE + 0x0006) -#define NMERR_NOT_SUPPORTED (NMERR_SERVER_BASE + 0x000A) -#define NMERR_PASSWORD_EXPIRED (NMERR_SERVER_BASE + 0x000B) -#define NMERR_PASSWORD_INVALID (NMERR_SERVER_BASE + 0x000C) -#define NMERR_USER_NOT_FOUND (NMERR_SERVER_BASE + 0x000D) -#define NMERR_USER_DISABLED (NMERR_SERVER_BASE + 0x0010) -#define NMERR_DIRECTORY_FAILURE (NMERR_SERVER_BASE + 0x0011) -#define NMERR_HOST_NOT_FOUND (NMERR_SERVER_BASE + 0x0019) -#define NMERR_ADMIN_LOCKED (NMERR_SERVER_BASE + 0x001C) -#define NMERR_DUPLICATE_PARTICIPANT (NMERR_SERVER_BASE + 0x001F) -#define NMERR_SERVER_BUSY (NMERR_SERVER_BASE + 0x0023) -#define NMERR_OBJECT_NOT_FOUND (NMERR_SERVER_BASE + 0x0024) -#define NMERR_DIRECTORY_UPDATE (NMERR_SERVER_BASE + 0x0025) -#define NMERR_DUPLICATE_FOLDER (NMERR_SERVER_BASE + 0x0026) -#define NMERR_DUPLICATE_CONTACT (NMERR_SERVER_BASE + 0x0027) -#define NMERR_USER_NOT_ALLOWED (NMERR_SERVER_BASE + 0x0028) -#define NMERR_TOO_MANY_CONTACTS (NMERR_SERVER_BASE + 0x0029) -#define NMERR_CONFERENCE_NOT_FOUND_2 (NMERR_SERVER_BASE + 0x002B) -#define NMERR_TOO_MANY_FOLDERS (NMERR_SERVER_BASE + 0x002C) -#define NMERR_SERVER_PROTOCOL (NMERR_SERVER_BASE + 0x0030) -#define NMERR_CONVERSATION_INVITE (NMERR_SERVER_BASE + 0x0035) -#define NMERR_USER_BLOCKED (NMERR_SERVER_BASE + 0x0039) -#define NMERR_MASTER_ARCHIVE_MISSING (NMERR_SERVER_BASE + 0x003A) -#define NMERR_PASSWORD_EXPIRED_2 (NMERR_SERVER_BASE + 0x0042) -#define NMERR_CREDENTIALS_MISSING (NMERR_SERVER_BASE + 0x0046) -#define NMERR_AUTHENTICATION_FAILED (NMERR_SERVER_BASE + 0x0049) -#define NMERR_EVAL_CONNECTION_LIMIT (NMERR_SERVER_BASE + 0x004A) - -/** - * Initialize the user that we are going to login to the system as. - * - * @param name The userid of the user - * @param server IP Address of server - * @param port Port to connect to on the server - * @param data Client data to associate with the user - * @param event_callback Function to call when we receive an event - * - * @return The initialized user object. Must be freed by calling - * nm_deinitialize_user - */ -NMUser *nm_initialize_user(const char *name, const char *server, int port, - gpointer data, nm_event_cb event_callback); - - -/** - * Free up resources associated with the user object. - * - * @param user The user to deinitialize - */ -void nm_deinitialize_user(NMUser * user); - -/** - * Send a login request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The User to login -- must be initialized - * @param pwd The password of the user - * @param my_addr The address of the client machine - * @param user_agent String describing the client (eg. "Purple/0.76 (Linux; 2.4.20)") - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if login is sent successfully, error otherwise. - */ -NMERR_T nm_send_login(NMUser * user, const char *pwd, const char *my_addr, - const char *user_agent, nm_response_cb callback, - gpointer data); - -/** - * Send a set status request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param dn The DN of the user (if known, or NULL if not known) - * @param address IP Address of server - * @param callback Function to call when we get the response from the server - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_set_status(NMUser * user, int status, const char *text, - const char *auto_resp, nm_response_cb callback, - gpointer data); - -/** - * Send a create conference to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference to create - * @param add_participants Add participant list on create? - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - -/** - * Tell server we have left the conference. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is leaving - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_leave_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - -/** - * Send a join conference request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is joining - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_join_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - -/** - * Send a conference reject request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is rejecting - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - - -/** - * Send a conference invitation to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is rejecting - * @param user_record The user to invite - * @param message The invite message if there is one, NULL otherwise - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_conference_invite(NMUser *user, NMConference *conference, NMUserRecord *user_record, - const char *message, nm_response_cb callback, gpointer data); - -/** - * Get details for a more than one user from the server. - * - * The response data sent to the callback will be an NMUserRecord which should be - * freed with nm_release_user_record - * - * @param user The logged in User - * @param names Link list of user id's or dn's - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_multiple_get_details(NMUser * user, GSList *names, - nm_response_cb callback, gpointer data); - -/** - * Get details for a user from the server. - * - * The response data sent to the callback will be an NMUserRecord which should be - * freed with nm_release_user_record - * - * @param user The logged in User - * @param name Userid or DN of the user to look up - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_get_details(NMUser * user, const char *name, - nm_response_cb callback, gpointer data); - -/** - * Send a message. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param message The message to send. - * @param callback Function to call when we get the response from the server - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_message(NMUser * user, NMMessage * message, - nm_response_cb callback); - -/** - * Sends a typing event to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conf The conference that corresponds to the typing event - * @param typing TRUE if the user is typing - * FALSE if the user has stopped typing - * @param callback Function to call when we get the response from the server - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_typing(NMUser * user, NMConference * conf, - gboolean typing, nm_response_cb callback); - -/** - * Send a create contact request to the server. - * - * The given folder should already exist on the server. If not, - * the call will fail. - * - * The response data sent to the callback will be a NMContact which should - * be released with nm_release_contact - * - * @param user The logged in User - * @param folder The folder that the contact should be created in - * @param contact The contact to add - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_create_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data); - -/** - * Send a remove contact request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param folder The folder to remove contact from - * @param contact The contact to remove - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_remove_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data); - -/** - * Send a create folder request to the server. - * - * The response data sent to the callback will be a NMFolder which should be - * released with nm_release_folder - * - * @param user The logged in User - * @param name The name of the folder to create - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_create_folder(NMUser * user, const char *name, - nm_response_cb callback, gpointer data); - -/** - * Send a delete folder request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param folder The name of the folder to remove - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_remove_folder(NMUser * user, NMFolder * folder, - nm_response_cb callback, gpointer data); - -/** - * Send a rename contact request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param contact The contact to rename - * @param new_name The new display name for the contact - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_rename_contact(NMUser * user, NMContact * contact, - const char *new_name, nm_response_cb callback, - gpointer data); - -/** - * Send a rename folder request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param folder The folder to rename - * @param new_name The new name of the folder - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_rename_folder(NMUser * user, NMFolder * folder, - const char *new_name, nm_response_cb callback, - gpointer data); - -/** - * Send a move contact request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param contact The contact to move - * @param folder The folder to move the contact to - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_move_contact(NMUser * user, NMContact * contact, - NMFolder * folder, nm_response_cb callback, - gpointer data); - -/** - * Send a get status request to the server. - * - * The response data sent to the callback will be a NMUserRecord. - * - * @param user The logged in User - * @param contact The contact to move - * @param folder The folder to move the contact to - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record, - nm_response_cb callback, gpointer data); - -/** - * Send a request to add an item to the allow or deny list. - * - * @param user The logged in User - * @param who The userid or DN of the user to add to list - * @param allow_list TRUE if adding to allow list, FALSE if adding to deny list - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_create_privacy_item(NMUser *user, const char *who, gboolean is_allowed, - nm_response_cb callback, gpointer data); - -/** - * Send a request to remove an item from the allow or deny list. - * - * @param user The logged in User - * @param who The userid or DN of the user to add to list - * @param allow_list TRUE if removing from allow list, FALSE if removing from deny list - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_remove_privacy_item(NMUser *user, const char *dn, gboolean allow_list, - nm_response_cb callback, gpointer data); - -/** - * Send a request to change the default privacy setting to deny all or allow all - * - * @param user The logged in User - * @param default_deny TRUE if default should be changed to deny all - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_set_privacy_default(NMUser *user, gboolean default_deny, - nm_response_cb callback, gpointer data); - -/** - * Send a ping to the server - * - * @param user The logged in User - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_keepalive(NMUser *user, nm_response_cb callback, gpointer data); - -/** - * Reads a response/event from the server and processes it. - * - * @param user The logged in User - */ -NMERR_T nm_process_new_data(NMUser * user); - -/** - * Return the root folder of the contact list - * - * @param user The logged in User - * - * @return Root folder - */ -NMFolder *nm_get_root_folder(NMUser * user); - -/** - * Create the contact list based on the login fields - * - * @param user The logged in User - * - */ -NMERR_T nm_create_contact_list(NMUser * user); - -void nm_destroy_contact_list(NMUser * user); - -void nm_user_add_contact(NMUser * user, NMContact * contact); - -void nm_user_add_user_record(NMUser * user, NMUserRecord * user_record); - -NMContact *nm_find_contact(NMUser * user, const char *dn); - -GList *nm_find_contacts(NMUser * user, const char *dn); - -NMUserRecord *nm_find_user_record(NMUser * user, const char *dn); - -NMFolder *nm_find_folder(NMUser * user, const char *name); - -NMFolder *nm_find_folder_by_id(NMUser * user, int object_id); - -NMConference *nm_find_conversation(NMUser * user, const char *who); - -void nm_conference_list_add(NMUser * user, NMConference * conf); - -void nm_conference_list_remove(NMUser * user, NMConference * conf); - -void nm_conference_list_free(NMUser * user); - -NMConference *nm_conference_list_find(NMUser * user, const char *guid); - -const char *nm_lookup_dn(NMUser * user, const char *display_id); - -nm_event_cb nm_user_get_event_callback(NMUser * user); - -NMConn *nm_user_get_conn(NMUser * user); - -gboolean nm_user_is_privacy_locked(NMUser *user); - -/** Some utility functions **/ - -/** - * Check to see if the conference GUIDs are equivalent. - * - * @param guid1 First guid to compare - * @param guid2 Second guid to compare - * - * @return TRUE if conference GUIDs are equivalent, FALSE otherwise. - * - */ -gboolean nm_are_guids_equal(const char *guid1, const char *guid2); - -/** - * Compare UTF8 strings for equality only (case insensitive) - * - * @param guid1 First string to compare - * @param guid2 Second string to compare - * - * @return TRUE if strings are equal, FALSE otherwise - * - */ -gboolean nm_utf8_str_equal(gconstpointer str1, gconstpointer str2); - -/** - * Convert a fully typed LDAP DN to dotted, untype notation - * e.g. cn=mike,o=novell -> mike.novell - * - * @param typed Fully typed dn - * - * @return Dotted equivalent of typed (must be freed). - * - */ -char *nm_typed_to_dotted(const char *typed); - -/** - * Return a string representation of the error code. - * - * @param error NMERR_T to convert to string - * - * @return String representation. - */ -const char *nm_error_to_string (NMERR_T err); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,561 +0,0 @@ -/* - * nmuserrecord.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include "nmuserrecord.h" -#include "nmfield.h" -#include "nmuser.h" - -struct _NMUserRecord -{ - NMSTATUS_T status; - char *status_text; - char *dn; - char *cn; - char *display_id; - char *fname; - char *lname; - char *full_name; - NMField *fields; - gboolean auth_attr; - gpointer data; - int ref_count; -}; - -struct _NMProperty -{ - char *tag; - char *value; -}; - -static int count = 0; - -/* API functions */ - -NMUserRecord * -nm_create_user_record() -{ - NMUserRecord *user_record = g_new0(NMUserRecord, 1); - - user_record->ref_count = 1; - - purple_debug(PURPLE_DEBUG_INFO, "novell", "Creating user_record, total=%d\n", - count++); - - return user_record; -} - -static char * -_get_attribute_value(NMField *field) -{ - char *value = NULL; - - if (field->ptr_value == NULL) - return NULL; - - if (field->type == NMFIELD_TYPE_UTF8 || field->type == NMFIELD_TYPE_DN) { - - value = (char *)field->ptr_value; - - } else if (field->type == NMFIELD_TYPE_MV) { - - /* Need to handle multi-valued returns, for now - * just pick the first value and return it - */ - NMField *tmp = (NMField *)field->ptr_value; - if ((tmp != NULL) && - ((tmp->type == NMFIELD_TYPE_UTF8) || - (tmp->type == NMFIELD_TYPE_DN))) { - - value = (char *)tmp->ptr_value; - - } else { - return NULL; - } - - } else { - return NULL; - } - - return g_strdup(value); -} -/* - * This creates a user_record for the reference list the - * field array that is passed in should be a - * NM_A_FA_USER_DETAILS array. - */ -NMUserRecord * -nm_create_user_record_from_fields(NMField * details) -{ - NMUserRecord *user_record; - NMField *field, *fields = details; - - if (details == NULL) { - return NULL; - } - - if (details->type == NMFIELD_TYPE_ARRAY) { - if (details->ptr_value == NULL) - return NULL; - fields = (NMField *) details->ptr_value; - } - - user_record = nm_create_user_record(); - - if ((field = nm_locate_field(NM_A_SZ_AUTH_ATTRIBUTE, fields))) { - - if (field->ptr_value) { - user_record->display_id = _get_attribute_value(field); - user_record->auth_attr = TRUE; - } - } - - if ((field = nm_locate_field(NM_A_SZ_DN, fields))) { - - if (field->ptr_value) { - user_record->dn = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("CN", fields))) { - - if (field->ptr_value) { - user_record->cn = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("Given Name", fields))) { - - if (field->ptr_value) { - user_record->fname = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("Surname", fields))) { - - if (field->ptr_value) { - user_record->lname = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("Full Name", fields))) { - - if (field->ptr_value) { - user_record->full_name = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field(NM_A_SZ_STATUS, fields))) { - - if (field->ptr_value) - user_record->status = atoi((char *) field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_MESSAGE_BODY, fields))) { - - if (field->ptr_value) - user_record->status_text = g_strdup((char *) field->ptr_value); - - } - - user_record->fields = nm_copy_field_array(fields); - - return user_record; -} - -void -nm_user_record_copy(NMUserRecord * dest, NMUserRecord * src) -{ - if (dest == NULL || src == NULL) - return; - - dest->status = src->status; - - /* Copy status text */ - if (dest->status_text) { - g_free(dest->status_text); - dest->status_text = NULL; - } - - if (src->status_text) - dest->status_text = g_strdup(src->status_text); - - /* Copy DN */ - if (dest->dn) { - g_free(dest->dn); - dest->dn = NULL; - } - - if (src->dn) - dest->dn = g_strdup(src->dn); - - /* Copy CN */ - if (dest->cn) { - g_free(dest->cn); - dest->cn = NULL; - } - - if (src->cn) - dest->cn = g_strdup(src->cn); - - /* Copy display id */ - if (dest->display_id) { - g_free(dest->display_id); - dest->display_id = NULL; - } - - if (src->display_id) - dest->display_id = g_strdup(src->display_id); - - /* Copy first name */ - if (dest->fname) { - g_free(dest->fname); - dest->fname = NULL; - } - - if (src->fname) - dest->fname = g_strdup(src->fname); - - /* Copy last name */ - if (dest->lname) { - g_free(dest->lname); - dest->lname = NULL; - } - - if (src->lname) - dest->lname = g_strdup(src->lname); - - /* Copy full name */ - if (dest->full_name) { - g_free(dest->full_name); - dest->full_name = NULL; - } - - if (src->full_name) - dest->full_name = g_strdup(src->full_name); - - /* Copy fields */ - if (src->fields) { - - if (dest->fields) { - nm_free_fields(&dest->fields); - } - - dest->fields = nm_copy_field_array(src->fields); - } - - /* Copy data */ - dest->data = src->data; -} - -void -nm_user_record_add_ref(NMUserRecord * user_record) -{ - if (user_record) - user_record->ref_count++; -} - -void -nm_release_user_record(NMUserRecord * user_record) -{ - if (--(user_record->ref_count) == 0) { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Releasing user_record, total=%d\n", --count); - - if (user_record->dn) { - g_free(user_record->dn); - } - - if (user_record->cn) { - g_free(user_record->cn); - } - - if (user_record->display_id) { - g_free(user_record->display_id); - } - - if (user_record->fname) { - g_free(user_record->fname); - } - - if (user_record->lname) { - g_free(user_record->lname); - } - - if (user_record->full_name) { - g_free(user_record->full_name); - } - - if (user_record->status_text) { - g_free(user_record->status_text); - } - - nm_free_fields(&user_record->fields); - - g_free(user_record); - } -} - -/* UserRecord API */ - -NMSTATUS_T -nm_user_record_get_status(NMUserRecord * user_record) -{ - if (user_record == NULL) - return (NMSTATUS_T) - 1; - - return user_record->status; - -} - -const char * -nm_user_record_get_status_text(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->status_text; -} - -void -nm_user_record_set_dn(NMUserRecord * user_record, const char *dn) -{ - if (user_record != NULL && dn != NULL) { - if (user_record->dn) - g_free(user_record->dn); - - user_record->dn = g_strdup(dn); - } -} - -const char * -nm_user_record_get_dn(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->dn; -} - -void -nm_user_record_set_userid(NMUserRecord * user_record, const char *userid) -{ - if (user_record != NULL && userid != NULL) { - if (user_record->cn) - g_free(user_record->cn); - - user_record->cn = g_strdup(userid); - } -} - -const char * -nm_user_record_get_userid(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->cn; -} - -void -nm_user_record_set_display_id(NMUserRecord * user_record, const char *display_id) -{ - if (user_record != NULL && display_id != NULL) { - if (user_record->display_id) - g_free(user_record->display_id); - - user_record->display_id = g_strdup(display_id); - } -} - -const char * -nm_user_record_get_display_id(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - if (user_record->display_id == NULL) { - user_record->display_id = nm_typed_to_dotted(user_record->dn); - } - - return user_record->display_id; -} - -const char * -nm_user_record_get_full_name(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - if (user_record->full_name == NULL) { - if (user_record->fname && user_record->lname) { - user_record->full_name = g_strdup_printf("%s %s", - user_record->fname, - user_record->lname); - - } - } - - return user_record->full_name; -} - -const char * -nm_user_record_get_first_name(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->fname; - -} - -const char * -nm_user_record_get_last_name(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->lname; -} - -gpointer -nm_user_record_get_data(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->data; -} - -void -nm_user_record_set_data(NMUserRecord * user_record, gpointer data) -{ - if (user_record == NULL) - return; - - user_record->data = data; -} - -void -nm_user_record_set_status(NMUserRecord * user_record, - int status, const char *text) -{ - if (user_record == NULL) - return; - - user_record->status = status; - - if (user_record->status_text) { - g_free(user_record->status_text); - user_record->status_text = NULL; - } - - if (text) - user_record->status_text = g_strdup(text); -} - -gboolean -nm_user_record_get_auth_attr(NMUserRecord *user_record) -{ - if (user_record == NULL) - return FALSE; - - return user_record->auth_attr; -} - -int -nm_user_record_get_property_count(NMUserRecord * user_record) -{ - NMField *locate, *fields; - - int count = 0; - - if (user_record && user_record->fields) { - locate = nm_locate_field(NM_A_FA_INFO_DISPLAY_ARRAY, - (NMField *) user_record->fields); - if (locate && (fields = (NMField *) (locate->ptr_value))) { - count = (int) nm_count_fields(fields); - } - } - return count; -} - -NMProperty * -nm_user_record_get_property(NMUserRecord * user_record, int index) -{ - NMProperty *property = NULL; - NMField *field = NULL, *fields, *locate; - - if (user_record && user_record->fields) { - locate = nm_locate_field(NM_A_FA_INFO_DISPLAY_ARRAY, - (NMField *) user_record->fields); - if (locate && (fields = (NMField *) (locate->ptr_value))) { - int max = nm_count_fields(fields); - - if (index < max) { - if (user_record) { - field = &fields[index]; - if (field && field->tag && field->ptr_value) { - property = g_new0(NMProperty, 1); - property->tag = g_strdup(field->tag); - property->value = _get_attribute_value(field); - } - } - } - } - } - - return property; -} - -void -nm_release_property(NMProperty * property) -{ - if (property) { - if (property->tag) - g_free(property->tag); - - if (property->value) - g_free(property->value); - - g_free(property); - } -} - -const char * -nm_property_get_tag(NMProperty * property) -{ - if (property) - return property->tag; - else - return NULL; -} - -const char * -nm_property_get_value(NMProperty * property) -{ - if (property) - return property->value; - else - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/nmuserrecord.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,273 +0,0 @@ -/* - * nmuserrecord.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_USER_RECORD_H__ -#define __NM_USER_RECORD_H__ - -#include - -typedef struct _NMUserRecord NMUserRecord; -typedef struct _NMProperty NMProperty; - -#include "nmfield.h" -#include "nmuser.h" - -/** - * Creates an NMUserRecord - * - * The NMUserRecord should be released by calling - * nm_release_user_record - * - * @return The new user record - * - */ -NMUserRecord *nm_create_user_record(void); - -/** - * Creates an NMUserRecord - * - * The NMUserRecord should be released by calling - * nm_release_user_record - * - * @param details Should be a NM_A_FA_USER_DETAILS - * - * - * @return The new user record - * - */ -NMUserRecord *nm_create_user_record_from_fields(NMField * details); - -/** - * Add a reference to an existing user_record - * - * The reference should be released by calling - * nm_release_user_record - * - * @param user_record The contact to addref - * - */ -void nm_user_record_add_ref(NMUserRecord * user_record); - -/** - * Release a reference to the user record - * - * @param user_record The user record - * - */ -void nm_release_user_record(NMUserRecord * user_record); - -/** - * Set the status for the user record - * - * @param user_record The user record - * @param status The status for the user - * @param text The status text for the user - * - */ -void nm_user_record_set_status(NMUserRecord * user_record, NMSTATUS_T status, - const char *text); - -/** - * Get the status for the user record - * - * @param user_record The user record - * - * @return The status for the user record - */ -NMSTATUS_T nm_user_record_get_status(NMUserRecord * user_record); - -/** - * Get the status text for the user record - * - * @param user_record The user record - * - * @return The status text if there is any, NULL otherwise - * - */ -const char *nm_user_record_get_status_text(NMUserRecord * user_record); - -/** - * Set the DN for the user record - * - * @param user_record The user record - * @param dn The new DN for the user record - * - */ -void nm_user_record_set_dn(NMUserRecord * user_record, const char *dn); - -/** - * Get the DN for the user record - * - * @param user_record The user record - * - * @return The DN for the user record - */ -const char *nm_user_record_get_dn(NMUserRecord * user_record); - -/** - * Set the user id for the - * - * @param user_record The user record - * @param userid The userid (CN) for the user record - * - */ -void nm_user_record_set_userid(NMUserRecord * user_record, const char *userid); - -/** - * Get the user id for the user record - * - * @param user_record The user record - * - * @return The user id for the user record - */ -const char *nm_user_record_get_userid(NMUserRecord * user_record); - -/** - * Set the display id for the user record - * - * @param user_record The user record - * @param display_id The new display id for the user - * - */ -void nm_user_record_set_display_id(NMUserRecord * user_record, - const char *display_id); - -/** - * Get the display id for the user record - * - * @param user_record The user record - * - * @return The display id for the user record - */ -const char *nm_user_record_get_display_id(NMUserRecord * user_record); - -/** - * Return whether or not the display id is an auth attribute or not. - * - * @param user_record The user record - * - * @return TRUE if display_id is an auth attribute, FALSE otherwise. - */ -gboolean -nm_user_record_get_auth_attr(NMUserRecord *user_record); - -/** - * Get the full name for the user record - * - * @param user_record The user record - * - * @return The full name for the user - */ -const char *nm_user_record_get_full_name(NMUserRecord * user_record); - -/** - * Get the first name for the user record - * - * @param user_record The user record - * - * @return The first name for the user - */ -const char *nm_user_record_get_first_name(NMUserRecord * user_record); - -/** - * Get the last name for the user record - * - * @param user_record The user record - * - * @return The last name for the user - */ -const char *nm_user_record_get_last_name(NMUserRecord * user_record); - -/** - * Set the user defined data for the user record - * - * @param user_record The user record - * @param data The user defined data for the user record - * - */ -void nm_user_record_set_data(NMUserRecord * user_record, gpointer data); - -/** - * Get the user defined data for the user record - * - * @param user_record The user record - * - * @return The user defined data for the user record - */ -gpointer nm_user_record_get_data(NMUserRecord * user_record); - -/** - * Get the property count for the user record - * - * @param user_record The user record - * - * @return The number of information properties for the user record - * - */ -int nm_user_record_get_property_count(NMUserRecord * user_record); - -/** - * Get an info property for the user record. The property must be released - * by calling nm_release_property() - * - * @param user_record The user record - * @param index The index of the property to get (zero based) - * - * @return The property - */ -NMProperty *nm_user_record_get_property(NMUserRecord * user_record, int index); - -/** - * Release a property object - * - * @param property The property - * - */ -void nm_release_property(NMProperty * property); - -/** - * Get the tag for the property - * - * @param property The property - * - * @return The tag of the property (i.e. "Email Address") - */ -const char *nm_property_get_tag(NMProperty * property); - -/** - * Get the value for the property - * - * @param property The property - * - * @return The value of the property (i.e. "nobody@nowhere.com") - */ -const char *nm_property_get_value(NMProperty * property); - -/** - * Copy a user record (deep copy). The dest user record must have already been - * created (nm_create_user_record) - * - * @param dest The destination of the copy - * @param src The source of the copy - * - */ -void nm_user_record_copy(NMUserRecord * dest, NMUserRecord * src); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/novell.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/novell.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/novell.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/novell/novell.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3586 +0,0 @@ -/* - * novell.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "accountopt.h" -#include "debug.h" -#include "prpl.h" -#include "server.h" -#include "nmuser.h" -#include "notify.h" -#include "util.h" -#include "sslconn.h" -#include "request.h" -#include "network.h" -#include "privacy.h" -#include "status.h" -#include "version.h" - -#define DEFAULT_PORT 8300 -#define NOVELL_CONNECT_STEPS 4 -#define NM_ROOT_FOLDER_NAME "GroupWise Messenger" - -#define NOVELL_STATUS_TYPE_AVAILABLE "available" -#define NOVELL_STATUS_TYPE_AWAY "away" -#define NOVELL_STATUS_TYPE_BUSY "busy" -#define NOVELL_STATUS_TYPE_OFFLINE "offline" -#define NOVELL_STATUS_TYPE_IDLE "idle" -#define NOVELL_STATUS_TYPE_APPEAR_OFFLINE "appearoffline" - -static PurplePlugin *my_protocol = NULL; - -static gboolean -_is_disconnect_error(NMERR_T err); - -static gboolean -_check_for_disconnect(NMUser * user, NMERR_T err); - -static void -_send_message(NMUser * user, NMMessage * message); - -static void -_update_buddy_status(NMUser *user, PurpleBuddy * buddy, int status, int gmt); - -static void -_remove_purple_buddies(NMUser * user); - -static void -_add_contacts_to_purple_blist(NMUser * user, NMFolder * folder); - -static void -_add_purple_buddies(NMUser * user); - -static void -_sync_contact_list(NMUser *user); - -static void -_sync_privacy_lists(NMUser *user); - -static void -_show_info(PurpleConnection * gc, NMUserRecord * user_record); - -const char * -_get_conference_name(int id); - -/******************************************************************************* - * Response callbacks - *******************************************************************************/ - -/* Handle login response */ -static void -_login_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - const char *alias; - NMERR_T rc; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - if (gc == NULL) - return; - - if (ret_code == NM_OK) { - - /* Set alias for user if not set (use Full Name) */ - alias = purple_account_get_alias(user->client_data); - if (alias == NULL || *alias == '\0') { - alias = nm_user_record_get_full_name(user->user_record); - - if (alias) - purple_account_set_alias(user->client_data, alias); - } - - /* Tell Purple that we are connected */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - _sync_contact_list(user); - - rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, - NULL); - _check_for_disconnect(user, rc); - - } else { - PurpleConnectionError reason; - char *err = g_strdup_printf(_("Unable to login: %s"), - nm_error_to_string (ret_code)); - - switch (ret_code) { - case NMERR_AUTHENTICATION_FAILED: - case NMERR_CREDENTIALS_MISSING: - case NMERR_PASSWORD_INVALID: - /* Don't attempt to auto-reconnect if our - * password was invalid. - */ - if (!purple_account_get_remember_password(gc->account)) - purple_account_set_password(gc->account, NULL); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - default: - /* FIXME: There are other reasons login could fail */ - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - } - - purple_connection_error_reason(gc, reason, err); - g_free(err); - } -} - -/* Handle getstatus response*/ -static void -_get_status_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleBuddy *buddy; - GSList *buddies; - GSList *bnode; - NMUserRecord *user_record = (NMUserRecord *) resp_data; - int status; - - if (user == NULL || user_record == NULL) - return; - - if (ret_code == NM_OK) { - - /* Find all Purple buddies and update their statuses */ - const char *name = nm_user_record_get_display_id(user_record); - - if (name) { - buddies = purple_find_buddies((PurpleAccount *) user->client_data, name); - for (bnode = buddies; bnode; bnode = bnode->next) { - buddy = (PurpleBuddy *) bnode->data; - if (buddy) { - status = nm_user_record_get_status(user_record); - _update_buddy_status(user, buddy, status, time(0)); - } - } - g_slist_free(buddies); - } - - } else { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_get_status_resp_cb(): rc = 0x%X\n", ret_code); - - } -} - -/* Show an error if the rename failed */ -static void -_rename_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_rename_contact_resp_cb(): rc = 0x%X\n", ret_code); - } -} - -/* Handle the getdetails response and send the message */ -static void -_get_details_resp_send_msg(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConversation *gconv; - PurpleConnection *gc; - NMUserRecord *user_record = NULL; - NMContact *cntct = NULL; - NMConference *conf; - NMMessage *msg = user_data; - const char *dn = NULL; - const char *name; - - if (user == NULL || msg == NULL) - return; - - if (ret_code == NM_OK) { - user_record = (NMUserRecord *) resp_data; - if (user_record) { - - /* Set the title for the conversation */ - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - nm_user_record_get_display_id(user_record), - (PurpleAccount *) user->client_data); - if (gconv) { - - dn = nm_user_record_get_dn(user_record); - if (dn) { - cntct = nm_find_contact(user, dn); - } - - if (cntct) { - purple_conversation_set_title(gconv, - nm_contact_get_display_name(cntct)); - } else { - - /* Not in the contact list, try to user full name */ - name = (char *) nm_user_record_get_full_name(user_record); - if (name) - purple_conversation_set_title(gconv, name); - } - } - - /* Add the user record to particpant list */ - conf = nm_message_get_conference(msg); - if (conf) { - nm_conference_add_participant(conf, user_record); - _send_message(user, msg); - } - } - - } else { - - gc = purple_account_get_connection(user->client_data); - if (gc != NULL) { - char *err = g_strdup_printf(_("Unable to send message." - " Could not get details for user (%s)."), - nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (msg) - nm_release_message(msg); - } -} - -/* Set up the new PurpleBuddy based on the response from getdetails */ -static void -_get_details_resp_setup_buddy(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMUserRecord *user_record; - NMContact *contact; - PurpleBuddy *buddy; - const char *alias; - NMERR_T rc = NM_OK; - - if (user == NULL || resp_data == NULL || user_data == NULL) - return; - - contact = user_data; - - if (ret_code == NM_OK) { - user_record = resp_data; - - buddy = nm_contact_get_data(contact); - - nm_contact_set_user_record(contact, user_record); - - /* Set the display id */ - purple_blist_rename_buddy(buddy, - nm_user_record_get_display_id(user_record)); - - alias = purple_buddy_get_alias(buddy); - if (alias == NULL || *alias == '\0' || (strcmp(alias, purple_buddy_get_name(buddy)) == 0)) { - purple_blist_alias_buddy(buddy, - nm_user_record_get_full_name(user_record)); - - /* Tell the server about the new display name */ - rc = nm_send_rename_contact(user, contact, - nm_user_record_get_full_name(user_record), - NULL, NULL); - _check_for_disconnect(user, rc); - - } - - - /* Get initial status for the buddy */ - rc = nm_send_get_status(user, resp_data, _get_status_resp_cb, NULL); - _check_for_disconnect(user, rc); - -/* nm_release_contact(contact);*/ - - } - - if (contact) - nm_release_contact(contact); -} - -/* Add the new contact into the PurpleBuddy list */ -static void -_create_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMContact *tmp_contact = (NMContact *) user_data; - NMContact *new_contact = NULL; - NMFolder *folder = NULL; - PurpleGroup *group; - PurpleBuddy *buddy; - const char *folder_name = NULL; - NMERR_T rc = NM_OK; - - if (user == NULL) - return; - - if (ret_code == NM_OK) { - - new_contact = (NMContact *) resp_data; - if (new_contact == NULL || tmp_contact == NULL) - return; - - /* Get the userid and folder name for the new contact */ - folder = nm_find_folder_by_id(user, - nm_contact_get_parent_id(new_contact)); - if (folder) { - folder_name = nm_folder_get_name(folder); - } - - if (folder_name == NULL || *folder_name == '\0') - folder_name = NM_ROOT_FOLDER_NAME; - - /* Re-add the buddy now that we got the okay from the server */ - if (folder_name && (group = purple_find_group(folder_name))) { - - const char *alias = nm_contact_get_display_name(tmp_contact); - const char *display_id = nm_contact_get_display_id(new_contact); - - if (display_id == NULL) - display_id = nm_contact_get_dn(new_contact); - - if (alias && strcmp(alias, display_id)) { - - /* The user requested an alias, tell the server about it. */ - rc = nm_send_rename_contact(user, new_contact, alias, - _rename_contact_resp_cb, NULL); - _check_for_disconnect(user, rc); - - } else { - - alias = ""; - - } - - /* Add it to the purple buddy list if it is not there */ - buddy = purple_find_buddy_in_group(user->client_data, display_id, group); - if (buddy == NULL) { - buddy = purple_buddy_new(user->client_data, display_id, alias); - purple_blist_add_buddy(buddy, NULL, group, NULL); - } - - /* Save the new buddy as part of the contact object */ - nm_contact_set_data(new_contact, (gpointer) buddy); - - /* We need details for the user before we can setup the - * new Purple buddy. We always call this because the - * 'createcontact' response fields do not always contain - * everything that we need. - */ - nm_contact_add_ref(new_contact); - - rc = nm_send_get_details(user, nm_contact_get_dn(new_contact), - _get_details_resp_setup_buddy, new_contact); - _check_for_disconnect(user, rc); - - } - - } else { - PurpleConnection *gc = purple_account_get_connection(user->client_data); - const char *name = nm_contact_get_dn(tmp_contact); - char *err; - - err = - g_strdup_printf(_("Unable to add %s to your buddy list (%s)."), - name, nm_error_to_string (ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } - - if (tmp_contact) - nm_release_contact(tmp_contact); -} - -/* Show an error if we failed to send the message */ -static void -_send_message_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - char *err = NULL; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - gc = purple_account_get_connection(user->client_data); - - /* TODO: Improve this! message to who or for what conference? */ - err = g_strdup_printf(_("Unable to send message (%s)."), - nm_error_to_string (ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } -} - -/* Show an error if the remove failed */ -static void -_remove_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_remove_contact_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -/* Show an error if the remove failed */ -static void -_remove_folder_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_remove_folder_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -/* Show an error if the move failed */ -static void -_move_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_move_contact_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -/* Show an error if the rename failed */ -static void -_rename_folder_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_rename_folder_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -static void -_sendinvite_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - char *err; - PurpleConnection *gc; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - gc = purple_account_get_connection(user->client_data); - err = g_strdup_printf(_("Unable to invite user (%s)."), nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_sendinvite_resp_cb(): rc = 0x%x\n", ret_code); - } - -} - -/* If the createconf was successful attempt to send the message, - * otherwise display an error message to the user. - */ -static void -_createconf_resp_send_msg(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMConference *conf; - NMMessage *msg = user_data; - - if (user == NULL || msg == NULL) - return; - - if (ret_code == NM_OK) { - _send_message(user, msg); - } else { - - if ((conf = nm_message_get_conference(msg))) { - - PurpleConnection *gc = purple_account_get_connection(user->client_data); - const char *name = NULL; - char *err; - NMUserRecord *ur; - - ur = nm_conference_get_participant(conf, 0); - if (ur) - name = nm_user_record_get_userid(ur); - - if (name) - err = g_strdup_printf(_("Unable to send message to %s." - " Could not create the conference (%s)."), - name, - nm_error_to_string (ret_code)); - else - err = g_strdup_printf(_("Unable to send message." - " Could not create the conference (%s)."), - nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (msg) - nm_release_message(msg); - } -} - -/* Move contact to newly created folder */ -static void -_create_folder_resp_move_contact(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMContact *contact = user_data; - NMFolder *new_folder; - char *folder_name = resp_data; - NMERR_T rc = NM_OK; - - if (user == NULL || folder_name == NULL || contact == NULL) { - - if (folder_name) - g_free(folder_name); - - return; - } - - if (ret_code == NM_OK || ret_code == NMERR_DUPLICATE_FOLDER) { - new_folder = nm_find_folder(user, folder_name); - if (new_folder) { - - /* Tell the server to move the contact to the new folder */ -/* rc = nm_send_move_contact(user, contact, new_folder, - _move_contact_resp_cb, NULL); */ - - rc = nm_send_create_contact(user, new_folder, contact, - NULL, NULL); - - _check_for_disconnect(user, rc); - - } - } else { - PurpleConnection *gc = purple_account_get_connection(user->client_data); - char *err = g_strdup_printf(_("Unable to move user %s" - " to folder %s in the server side list." - " Error while creating folder (%s)."), - nm_contact_get_dn(contact), - folder_name, - nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (folder_name) - g_free(folder_name); -} - -/* Add contact to newly create folder */ -static void -_create_folder_resp_add_contact(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMContact *contact = (NMContact *) user_data; - NMFolder *folder; - char *folder_name = (char *) resp_data; - NMERR_T rc = NM_OK; - - if (user == NULL || folder_name == NULL || contact == NULL) { - - if (contact) - nm_release_contact(contact); - - if (folder_name) - g_free(folder_name); - - return; - } - - if (ret_code == NM_OK || ret_code == NMERR_DUPLICATE_FOLDER) { - folder = nm_find_folder(user, folder_name); - if (folder) { - - rc = nm_send_create_contact(user, folder, contact, - _create_contact_resp_cb, contact); - _check_for_disconnect(user, rc); - } - } else { - PurpleConnection *gc = purple_account_get_connection(user->client_data); - const char *name = nm_contact_get_dn(contact); - char *err = - g_strdup_printf(_("Unable to add %s to your buddy list." - " Error creating folder in server side list (%s)."), - name, nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - - nm_release_contact(contact); - g_free(err); - } - - g_free(folder_name); -} - -static void -_join_conf_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConversation *chat; - PurpleConnection *gc; - NMUserRecord *ur; - NMConference *conference = user_data; - const char *name, *conf_name; - int i, count; - - if (user == NULL || conference == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - conf_name = _get_conference_name(++user->conference_count); - chat = serv_got_joined_chat(gc, user->conference_count, conf_name); - if (chat) { - - nm_conference_set_data(conference, (gpointer) chat); - - count = nm_conference_get_participant_count(conference); - for (i = 0; i < count; i++) { - ur = nm_conference_get_participant(conference, i); - if (ur) { - name = nm_user_record_get_display_id(ur); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat), name, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - } - } - } - } -} - -/* Show info returned by getdetails */ -static void -_get_details_resp_show_info(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - char *name; - char *err; - - if (user == NULL) - return; - - name = user_data; - - if (ret_code == NM_OK) { - user_record = (NMUserRecord *) resp_data; - if (user_record) { - _show_info(purple_account_get_connection(user->client_data), - user_record); - } - } else { - gc = purple_account_get_connection(user->client_data); - err = - g_strdup_printf(_("Could not get details for user %s (%s)."), - name, nm_error_to_string (ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (name) - g_free(name); -} - -/* Handle get details response add to privacy list */ -static void -_get_details_resp_add_privacy_item(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record = resp_data; - char *err; - gboolean allowed = GPOINTER_TO_INT(user_data); - const char *display_id; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - display_id = nm_user_record_get_display_id(user_record); - - if (ret_code == NM_OK) { - - if (allowed) { - - if (!g_slist_find_custom(gc->account->permit, - display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); - } - - } else { - - if (!g_slist_find_custom(gc->account->permit, - display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); - } - } - - } else { - - err = g_strdup_printf(_("Unable to add user to privacy list (%s)."), - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -/* Handle response to create privacy item request */ -static void -_create_privacy_item_deny_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - char *who = user_data; - char *err; - NMERR_T rc = NM_OK; - const char *display_id = NULL; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - - user_record = nm_find_user_record(user, who); - if (user_record) - display_id = nm_user_record_get_display_id(user_record); - - if (display_id) { - - if (!g_slist_find_custom(gc->account->deny, - display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - - purple_privacy_deny_add(gc->account, display_id, TRUE); - } - - } else { - rc = nm_send_get_details(user, who, - _get_details_resp_add_privacy_item, - (gpointer)FALSE); - _check_for_disconnect(user, rc); - } - } else { - - err = g_strdup_printf(_("Unable to add %s to deny list (%s)."), - who, nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } - - if (who) - g_free(who); - -} - -/* Handle response to create privacy item request */ -static void -_create_privacy_item_permit_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - char *who = user_data; - char *err; - NMERR_T rc = NM_OK; - const char *display_id = NULL; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - - user_record = nm_find_user_record(user, who); - if (user_record) - display_id = nm_user_record_get_display_id(user_record); - - if (display_id) { - - if (!g_slist_find_custom(gc->account->permit, - display_id, - (GCompareFunc)purple_utf8_strcasecmp)) { - - purple_privacy_permit_add(gc->account, display_id, TRUE); - } - - } else { - rc = nm_send_get_details(user, who, - _get_details_resp_add_privacy_item, - (gpointer)TRUE); - _check_for_disconnect(user, rc); - } - - } else { - - err = g_strdup_printf(_("Unable to add %s to permit list (%s)."), who, - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } - - if (who) - g_free(who); -} - -static void -_get_details_send_privacy_create(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMERR_T rc = NM_OK; - PurpleConnection *gc; - NMUserRecord *user_record = resp_data; - char *err; - gboolean allowed = GPOINTER_TO_INT(user_data); - const char *dn, *display_id; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - dn = nm_user_record_get_dn(user_record); - display_id = nm_user_record_get_display_id(user_record); - - if (ret_code == NM_OK) { - - if (allowed) { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_permit_resp_cb, - g_strdup(display_id)); - _check_for_disconnect(user, rc); - - } else { - rc = nm_send_create_privacy_item(user, dn, FALSE, - _create_privacy_item_deny_resp_cb, - g_strdup(display_id)); - _check_for_disconnect(user, rc); - } - - } else { - - err = g_strdup_printf(_("Unable to add user to privacy list (%s)."), - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -static void -_remove_privacy_item_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - char *who = user_data; - char *err; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - - gc = purple_account_get_connection(user->client_data); - err = g_strdup_printf(_("Unable to remove %s from privacy list (%s)."), who, - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (who) - g_free(who); -} - -static void -_set_privacy_default_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - char *err; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - - gc = purple_account_get_connection(user->client_data); - err = g_strdup_printf(_("Unable to change server side privacy settings (%s)."), - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -/* Handle get details response add to privacy list */ -static void -_get_details_resp_send_invite(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMERR_T rc = NM_OK; - PurpleConnection *gc; - NMUserRecord *user_record = resp_data; - char *err; - GSList *cnode; - NMConference *conference; - gpointer chat; - long id = (long) user_data; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - rc = nm_send_conference_invite(user, conference, user_record, - NULL, _sendinvite_resp_cb, NULL); - _check_for_disconnect(user, rc); - break; - } - } - } - - } else { - - err = g_strdup_printf(_("Unable to invite user (%s)."), nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -static void -_createconf_resp_send_invite(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMERR_T rc = NM_OK; - NMConference *conference = resp_data; - NMUserRecord *user_record = user_data; - PurpleConnection *gc; - char *err; - - if (user == NULL) - return; - - - - if (ret_code == NM_OK) { - rc = nm_send_conference_invite(user, conference, user_record, - NULL, _sendinvite_resp_cb, NULL); - _check_for_disconnect(user, rc); - } else { - err = g_strdup_printf(_("Unable to create conference (%s)."), nm_error_to_string(ret_code)); - gc = purple_account_get_connection(user->client_data); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } -} - -/******************************************************************************* - * Helper functions - ******************************************************************************/ - -static char * -_user_agent_string(void) -{ - -#if !defined(_WIN32) - - const char *sysname = ""; - const char *release = ""; - struct utsname u; - - if (uname(&u) == 0) { - sysname = u.sysname; - release = u.release; - } else { - sysname = "Linux"; - release = "Unknown"; - } - - return g_strdup_printf("Purple/%s (%s; %s)", VERSION, sysname, release); - -#else - - const char *sysname = ""; - OSVERSIONINFO os_info; - SYSTEM_INFO sys_info; - - os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&os_info); - GetSystemInfo(&sys_info); - - if (os_info.dwPlatformId == VER_PLATFORM_WIN32_NT) { - switch (os_info.dwMajorVersion) { - case 3: - case 4: - sysname = "Windows NT"; - break; - case 5: - switch (os_info.dwMinorVersion) { - case 0: - sysname = "Windows 2000"; - break; - case 1: - sysname = "Windows XP"; - break; - case 2: - sysname = "Windows Server 2003"; - break; - default: - sysname = "Windows"; - break; - } - break; - default: - sysname = "Windows"; - break; - } - - } else if (os_info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - switch (os_info.dwMinorVersion) { - case 0: - sysname = "Windows 95"; - break; - case 10: - sysname = "Windows 98"; - break; - case 90: - sysname = "Windows ME"; - break; - default: - sysname = "Windows"; - break; - } - } else { - sysname = "Windows"; - } - - return g_strdup_printf("Purple/%s (%s; %ld.%ld)", VERSION, sysname, - os_info.dwMajorVersion, os_info.dwMinorVersion); - -#endif - - -} - -static gboolean -_is_disconnect_error(NMERR_T err) -{ - return (err == NMERR_TCP_WRITE || - err == NMERR_TCP_READ || err == NMERR_PROTOCOL); -} - -static gboolean -_check_for_disconnect(NMUser * user, NMERR_T err) -{ - PurpleConnection *gc = purple_account_get_connection(user->client_data); - - if (_is_disconnect_error(err)) { - - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error communicating with server. Closing connection.")); - return TRUE; - - } - - return FALSE; -} - -/* Check to see if the conference is instantiated, if so send the message. - * If not send the create conference -- the response handler for the createconf - * will call this function again. - */ -static void -_send_message(NMUser * user, NMMessage * message) -{ - NMConference *conf; - NMERR_T rc = NM_OK; - - conf = nm_message_get_conference(message); - if (conf) { - /* We have a conference make sure that the - server knows about it already. */ - if (nm_conference_is_instantiated(conf)) { - - /* We have everything that we need...finally! */ - rc = nm_send_message(user, message, _send_message_resp_cb); - _check_for_disconnect(user, rc); - - nm_release_message(message); - - } else { - rc = nm_send_create_conference(user, conf, _createconf_resp_send_msg, message); - _check_for_disconnect(user, rc); - } - } -} - -/* - * Update the status of the given buddy in the Purple buddy list - */ -static void -_update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gmt) -{ - PurpleAccount *account; - const char *status_id; - const char *text = NULL; - const char *dn; - const char *name; - int idle = 0; - gboolean loggedin = TRUE; - - account = purple_buddy_get_account(buddy); - name = purple_buddy_get_name(buddy); - - switch (novellstatus) { - case NM_STATUS_AVAILABLE: - status_id = NOVELL_STATUS_TYPE_AVAILABLE; - break; - case NM_STATUS_AWAY: - status_id = NOVELL_STATUS_TYPE_AWAY; - break; - case NM_STATUS_BUSY: - status_id = NOVELL_STATUS_TYPE_BUSY; - break; - case NM_STATUS_OFFLINE: - status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; - break; - case NM_STATUS_AWAY_IDLE: - status_id = NOVELL_STATUS_TYPE_AWAY; - idle = gmt; - break; - default: - status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; - break; - } - - /* Get status text for the user */ - dn = nm_lookup_dn(user, name); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); - if (user_record) { - text = nm_user_record_get_status_text(user_record); - } - } - - purple_prpl_got_user_status(account, name, status_id, - "message", text, NULL); - purple_prpl_got_user_idle(account, name, - (novellstatus == NM_STATUS_AWAY_IDLE), idle); -} - -/* Iterate through the cached Purple buddy list and remove buddies - * that are not in the server side list. - */ -static void -_remove_purple_buddies(NMUser *user) -{ - PurpleBlistNode *gnode; - PurpleBlistNode *cnode; - PurpleBlistNode *bnode; - PurpleGroup *group; - PurpleBuddy *buddy; - GSList *rem_list = NULL; - GSList *l; - NMFolder *folder = NULL; - const char *gname = NULL; - - for (gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - group = (PurpleGroup *) gnode; - gname = purple_group_get_name(group); - for (cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = purple_blist_node_get_first_child(cnode); - bnode; - bnode = purple_blist_node_get_sibling_next(bnode)) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *) bnode; - if (purple_buddy_get_account(buddy) == user->client_data) { - if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) - gname = ""; - folder = nm_find_folder(user, gname); - if (folder == NULL || - !nm_folder_find_contact_by_display_id(folder, purple_buddy_get_name(buddy))) { - rem_list = g_slist_append(rem_list, buddy); - } - } - } - } - } - - if (rem_list) { - for (l = rem_list; l; l = l->next) { - purple_blist_remove_buddy(l->data); - } - g_slist_free(rem_list); - } -} - -/* Add all of the contacts in the given folder to the Purple buddy list */ -static void -_add_contacts_to_purple_blist(NMUser * user, NMFolder * folder) -{ - NMUserRecord *user_record = NULL; - NMContact *contact = NULL; - PurpleBuddy *buddy = NULL; - PurpleGroup *group; - NMERR_T cnt = 0, i; - const char *text = NULL; - const char *name = NULL; - const char *fname = NULL; - int status = 0; - - /* If this is the root folder give it a name. Purple does not have the concept of - * a root folder. - */ - fname = nm_folder_get_name(folder); - if (fname == NULL || *fname == '\0') { - fname = NM_ROOT_FOLDER_NAME; - } - - /* Does the Purple group exist already? */ - group = purple_find_group(fname); - if (group == NULL) { - group = purple_group_new(fname); - purple_blist_add_group(group, NULL); - } - - /* Get each contact for this folder */ - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - contact = nm_folder_get_contact(folder, i); - if (contact) { - - name = nm_contact_get_display_id(contact); - if (name) { - - buddy = purple_find_buddy_in_group(user->client_data, name, group); - if (buddy == NULL) { - /* Add it to the purple buddy list */ - buddy = purple_buddy_new(user->client_data, - name, - nm_contact_get_display_name(contact)); - - purple_blist_add_buddy(buddy, NULL, group, NULL); - } - - /* Set the initial status for the buddy */ - user_record = nm_contact_get_user_record(contact); - if (user_record) { - status = nm_user_record_get_status(user_record); - text = nm_user_record_get_status_text(user_record); - } - _update_buddy_status(user, buddy, status, time(0)); - - /* Save the new buddy as part of the contact object */ - nm_contact_set_data(contact, (gpointer) buddy); - } - - } else { - /* NULL contact. This should not happen, but - * let's break out of the loop. - */ - break; - } - } -} - -/* Add all of the server side contacts to the Purple buddy list. */ -static void -_add_purple_buddies(NMUser * user) -{ - int cnt = 0, i; - NMFolder *root_folder = NULL; - NMFolder *folder = NULL; - - root_folder = nm_get_root_folder(user); - if (root_folder) { - - /* Add sub-folders and contacts to sub-folders... - * iterate throught the sub-folders in reverse order - * because Purple adds the folders to the front -- so we - * want to add the first folder last - */ - cnt = nm_folder_get_subfolder_count(root_folder); - for (i = cnt-1; i >= 0; i--) { - folder = nm_folder_get_subfolder(root_folder, i); - if (folder) { - _add_contacts_to_purple_blist(user, folder); - } - } - - /* Add contacts for the root folder */ - _add_contacts_to_purple_blist(user, root_folder); - } -} - -static void -_sync_contact_list(NMUser *user) -{ - /* Remove all buddies from the local list that are - * not in the server side list and add all buddies - * from the server side list that are not in - * the local list - */ - _remove_purple_buddies(user); - _add_purple_buddies(user); - user->clist_synched = TRUE; -} - -static void -_sync_privacy_lists(NMUser *user) -{ - GSList *node = NULL, *rem_list = NULL; - PurpleConnection *gc; - const char *name, *dn; - NMUserRecord *user_record; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - if (gc == NULL) - return; - - /* Set the Purple privacy setting */ - if (user->default_deny) { - if (user->allow_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL; - } else { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } - } else { - if (user->deny_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; - } else { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - } - - /* Add stuff */ - for (node = user->allow_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) - name = nm_user_record_get_display_id(user_record); - else - name =(char *)node->data; - - if (!g_slist_find_custom(gc->account->permit, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); - } - } - - for (node = user->deny_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) - name = nm_user_record_get_display_id(user_record); - else - name =(char *)node->data; - - if (!g_slist_find_custom(gc->account->deny, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name, TRUE); - } - } - - - /* Remove stuff */ - for (node = gc->account->permit; node; node = node->next) { - dn = nm_lookup_dn(user, (char *)node->data); - if (dn != NULL && - !g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rem_list = g_slist_append(rem_list, node->data); - } - } - - if (rem_list) { - for (node = rem_list; node; node = node->next) { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); - } - g_free(rem_list); - rem_list = NULL; - } - - for (node = gc->account->deny; node; node = node->next) { - dn = nm_lookup_dn(user, (char *)node->data); - if (dn != NULL && - !g_slist_find_custom(user->deny_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rem_list = g_slist_append(rem_list, node->data); - } - } - - if (rem_list) { - for (node = rem_list; node; node = node->next) { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); - } - g_slist_free(rem_list); - } -} - - /* Map known property tags to user-friendly strings */ -static const char * -_map_property_tag(const char *tag) -{ - if (tag == NULL) return NULL; - - if (strcmp(tag, "telephoneNumber") == 0) - return _("Telephone Number"); - else if (strcmp(tag, "L") == 0) - return _("Location"); - else if (strcmp(tag, "OU") == 0) - return _("Department"); - else if (strcmp(tag, "personalTitle") == 0) - return _("Personal Title"); - else if (strcmp(tag, "Title") == 0) - return _("Title"); - else if (strcmp(tag, "mailstop") == 0) - return _("Mailstop"); - else if (strcmp(tag, "Internet EMail Address") == 0) - return _("Email Address"); - else - return tag; -} - -/* Display a dialog box showing the properties for the given user record */ -static void -_show_info(PurpleConnection * gc, NMUserRecord * user_record) -{ - PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); - int count, i; - NMProperty *property; - const char *tag, *value; - - tag = _("User ID"); - value = nm_user_record_get_userid(user_record); - if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } - -/* tag = _("DN"); - value = nm_user_record_get_dn(user_record); - if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } -*/ - - tag = _("Full name"); - value = nm_user_record_get_full_name(user_record); - if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } - - count = nm_user_record_get_property_count(user_record); - for (i = 0; i < count; i++) { - property = nm_user_record_get_property(user_record, i); - if (property) { - tag = _map_property_tag(nm_property_get_tag(property)); - value = nm_property_get_value(property); - if (tag && value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } - nm_release_property(property); - } - } - - purple_notify_userinfo(gc, nm_user_record_get_userid(user_record), - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); -} - -/* Send a join conference, the first item in the parms list is the - * NMUser object and the second item is the conference to join. - * This callback is passed to purple_request_action when we ask the - * user if they want to join the conference. - */ -static void -_join_conference_cb(GSList * parms) -{ - NMUser *user; - NMConference *conference; - NMERR_T rc = NM_OK; - - if (parms == NULL || g_slist_length(parms) != 2) - return; - - user = g_slist_nth_data(parms, 0); - conference = g_slist_nth_data(parms, 1); - - if (user && conference) { - rc = nm_send_join_conference(user, conference, - _join_conf_resp_cb, conference); - _check_for_disconnect(user, rc); - } - - g_slist_free(parms); -} - -/* Send a reject conference, the first item in the parms list is the - * NMUser object and the second item is the conference to reject. - * This callback is passed to purple_request_action when we ask the - * user if they want to joing the conference. - */ -static void -_reject_conference_cb(GSList * parms) -{ - NMUser *user; - NMConference *conference; - NMERR_T rc = NM_OK; - - if (parms == NULL || g_slist_length(parms) != 2) - return; - - user = g_slist_nth_data(parms, 0); - conference = g_slist_nth_data(parms, 1); - - if (user && conference) { - rc = nm_send_reject_conference(user, conference, NULL, NULL); - _check_for_disconnect(user, rc); - } - - g_slist_free(parms); -} - -static void -_initiate_conference_cb(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - NMUser *user; - const char *conf_name; - PurpleConversation *chat = NULL; - NMUserRecord *user_record; - NMConference *conference; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - user = gc->proto_data; - if (user == NULL) - return; - - /* We should already have a userrecord for the buddy */ - user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); - if (user_record == NULL) - return; - - conf_name = _get_conference_name(++user->conference_count); - chat = serv_got_joined_chat(gc, user->conference_count, conf_name); - if (chat) { - - conference = nm_create_conference(NULL); - nm_conference_set_data(conference, (gpointer) chat); - nm_send_create_conference(user, conference, _createconf_resp_send_invite, user_record); - nm_release_conference(conference); - } -} - -const char * -_get_conference_name(int id) -{ - static char *name = NULL; - - if (name) - g_free(name); - - name = g_strdup_printf(_("GroupWise Conference %d"), id); - - return name; -} - -static void -_show_privacy_locked_error(PurpleConnection *gc, NMUser *user) -{ - char *err; - - err = g_strdup_printf(_("Unable to change server side privacy settings (%s)."), - nm_error_to_string(NMERR_ADMIN_LOCKED)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); -} - -/******************************************************************************* - * Connect and recv callbacks - ******************************************************************************/ - -static void -novell_ssl_connect_error(PurpleSslConnection * gsc, - PurpleSslErrorType error, gpointer data) -{ - PurpleConnection *gc; - NMUser *user; - - gc = data; - user = gc->proto_data; - user->conn->ssl_conn->data = NULL; - - purple_connection_ssl_error (gc, error); -} - -static void -novell_ssl_recv_cb(gpointer data, PurpleSslConnection * gsc, - PurpleInputCondition condition) -{ - PurpleConnection *gc = data; - NMUser *user; - NMERR_T rc; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - rc = nm_process_new_data(user); - if (rc != NM_OK) { - - if (_is_disconnect_error(rc)) { - - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error communicating with server. Closing connection.")); - } else { - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Error processing event or response (%d).\n", rc); - } - } -} - -static void -novell_ssl_connected_cb(gpointer data, PurpleSslConnection * gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - NMUser *user; - NMConn *conn; - NMERR_T rc = 0; - const char *pwd = NULL; - const char *my_addr = NULL; - char *ua = NULL; - - if (gc == NULL || gsc == NULL) - return; - - user = gc->proto_data; - if ((user == NULL) || (conn = user->conn) == NULL) - return; - - purple_connection_update_progress(gc, _("Authenticating..."), - 2, NOVELL_CONNECT_STEPS); - - my_addr = purple_network_get_my_ip(gsc->fd); - pwd = purple_connection_get_password(gc); - ua = _user_agent_string(); - - rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); - if (rc == NM_OK) { - conn->connected = TRUE; - purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); - } else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } - - purple_connection_update_progress(gc, _("Waiting for response..."), - 3, NOVELL_CONNECT_STEPS); - - g_free(ua); -} - -/******************************************************************************* - * Event callback and event handlers - ******************************************************************************/ - -static void -_evt_receive_message(NMUser * user, NMEvent * event) -{ - NMUserRecord *user_record = NULL; - NMContact *contact = NULL; - PurpleConversation *gconv; - NMConference *conference; - PurpleMessageFlags flags; - char *text = NULL; - - text = g_markup_escape_text(nm_event_get_text(event), -1); - - conference = nm_event_get_conference(event); - if (conference) { - - PurpleConversation *chat = nm_conference_get_data(conference); - - /* Is this a single person 'conversation' or a conference? */ - if (chat == NULL && nm_conference_get_participant_count(conference) == 1) { - - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - flags = 0; - if (nm_event_get_type(event) == NMEVT_RECEIVE_AUTOREPLY) - flags |= PURPLE_MESSAGE_AUTO_RESP; - - serv_got_im(purple_account_get_connection(user->client_data), - nm_user_record_get_display_id(user_record), - text, flags, - nm_event_get_gmt(event)); - - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - nm_user_record_get_display_id(user_record), - (PurpleAccount *) user->client_data); - if (gconv) { - - contact = nm_find_contact(user, nm_event_get_source(event)); - if (contact) { - - purple_conversation_set_title( - gconv, nm_contact_get_display_name(contact)); - - - } else { - - const char *name = - nm_user_record_get_full_name(user_record); - - if (name == NULL) - name = nm_user_record_get_userid(user_record); - - purple_conversation_set_title(gconv, name); - } - - } - - } else { - /* this should not happen, see the event code. - * the event code will get the contact details from - * the server if it does not have them before calling - * the event callback. - */ - } - - } else if (chat) { - - /* get the contact for send if we have one */ - NMContact *contact = nm_find_contact(user, - nm_event_get_source(event)); - - /* get the user record for the sender */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - const char *name = nm_contact_get_display_name(contact); - - if (name == NULL) { - name = nm_user_record_get_full_name(user_record); - if (name == NULL) - name = nm_user_record_get_display_id(user_record); - } - - serv_got_chat_in(purple_account_get_connection(user->client_data), - purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)), - name, 0, text, nm_event_get_gmt(event)); - } - } - } - - g_free(text); -} - -static void -_evt_conference_left(NMUser * user, NMEvent * event) -{ - PurpleConversation *chat; - NMConference *conference; - - conference = nm_event_get_conference(event); - if (conference) { - chat = nm_conference_get_data(conference); - if (chat) { - NMUserRecord *ur = nm_find_user_record(user, - nm_event_get_source(event)); - - if (ur) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat), - nm_user_record_get_display_id(ur), - NULL); - } - } -} - -static void -_evt_conference_invite_notify(NMUser * user, NMEvent * event) -{ - PurpleConversation *gconv; - NMConference *conference; - NMUserRecord *user_record = NULL; - char *str = NULL; - - user_record = nm_find_user_record(user, nm_event_get_source(event)); - conference = nm_event_get_conference(event); - if (user_record && conference) { - gconv = nm_conference_get_data(conference); - str = g_strdup_printf(_("%s has been invited to this conversation."), - nm_user_record_get_display_id(user_record)); - purple_conversation_write(gconv, NULL, str, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - } -} - -static void -_evt_conference_invite(NMUser * user, NMEvent * event) -{ - NMUserRecord *ur; - PurpleConnection *gc; - GSList *parms = NULL; - const char *title = NULL; - const char *secondary = NULL; - const char *name = NULL; - char *primary = NULL; - time_t gmt; - - ur = nm_find_user_record(user, nm_event_get_source(event)); - if (ur) - name = nm_user_record_get_full_name(ur); - - if (name == NULL) - name = nm_event_get_source(event); - - gmt = nm_event_get_gmt(event); - title = _("Invitation to Conversation"); - primary = g_strdup_printf(_("Invitation from: %s\n\nSent: %s"), - name, purple_date_format_full(localtime(&gmt))); - secondary = _("Would you like to join the conversation?"); - - /* Set up parms list for the callbacks - * We need to send the NMUser object and - * the NMConference object to the callbacks - */ - parms = NULL; - parms = g_slist_append(parms, user); - parms = g_slist_append(parms, nm_event_get_conference(event)); - - /* Prompt the user */ - /* TODO: Would it be better to use serv_got_chat_invite() here? */ - gc = purple_account_get_connection(user->client_data); - purple_request_action(gc, title, primary, secondary, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), name, NULL, - parms, 2, - _("Yes"), G_CALLBACK(_join_conference_cb), - _("No"), G_CALLBACK(_reject_conference_cb)); - - g_free(primary); -} - - -static void -_evt_conference_joined(NMUser * user, NMEvent * event) -{ - PurpleConversation *chat = NULL; - PurpleConnection *gc; - NMConference *conference = NULL; - NMUserRecord *ur = NULL; - const char *name; - const char *conf_name; - - gc = purple_account_get_connection(user->client_data); - if (gc == NULL) - return; - - conference = nm_event_get_conference(event); - if (conference) { - chat = nm_conference_get_data(conference); - if (nm_conference_get_participant_count(conference) == 2 && chat == NULL) { - ur = nm_conference_get_participant(conference, 0); - if (ur) { - conf_name = _get_conference_name(++user->conference_count); - chat = - serv_got_joined_chat(gc, user->conference_count, conf_name); - if (chat) { - - nm_conference_set_data(conference, (gpointer) chat); - - name = nm_user_record_get_display_id(ur); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat), name, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - - } - } - } - - if (chat != NULL) { - ur = nm_find_user_record(user, nm_event_get_source(event)); - if (ur) { - name = nm_user_record_get_display_id(ur); - if (!purple_conv_chat_find_user(PURPLE_CONV_CHAT(chat), name)) { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat), name, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - } - } - } - } -} - -static void -_evt_status_change(NMUser * user, NMEvent * event) -{ - PurpleBuddy *buddy = NULL; - GSList *buddies; - GSList *bnode; - NMUserRecord *user_record; - const char *display_id; - int status; - - user_record = nm_event_get_user_record(event); - if (user_record) { - - /* Retrieve new status */ - status = nm_user_record_get_status(user_record); - - /* Update status for buddy in all folders */ - display_id = nm_user_record_get_display_id(user_record); - buddies = purple_find_buddies(user->client_data, display_id); - for (bnode = buddies; bnode; bnode = bnode->next) { - buddy = (PurpleBuddy *) bnode->data; - if (buddy) { - _update_buddy_status(user, buddy, status, nm_event_get_gmt(event)); - } - } - - g_slist_free(buddies); - - } -} - -static void -_evt_user_disconnect(NMUser * user, NMEvent * event) -{ - PurpleConnection *gc; - PurpleAccount *account = user->client_data; - - gc = purple_account_get_connection(account); - if (gc) - { - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NAME_IN_USE, - _("You have signed on from another location")); - } -} - -static void -_evt_user_typing(NMUser * user, NMEvent * event) -{ - PurpleConnection *gc; - NMUserRecord *user_record = NULL; - - gc = purple_account_get_connection((PurpleAccount *) user->client_data); - if (gc) { - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - serv_got_typing(gc, nm_user_record_get_display_id(user_record), - 30, PURPLE_TYPING); - } - } -} - -static void -_evt_user_not_typing(NMUser * user, NMEvent * event) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - - gc = purple_account_get_connection((PurpleAccount *) user->client_data); - if (gc) { - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - serv_got_typing_stopped(gc, - nm_user_record_get_display_id(user_record)); - } - } -} - -static void -_evt_undeliverable_status(NMUser * user, NMEvent * event) -{ - NMUserRecord *ur; - PurpleConversation *gconv; - char *str; - - ur = nm_find_user_record(user, nm_event_get_source(event)); - if (ur) { - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - gconv = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - nm_user_record_get_display_id(ur), - user->client_data); - if (gconv) { - const char *name = nm_user_record_get_full_name(ur); - - if (name == NULL) { - name = nm_user_record_get_display_id(ur); - } - str = g_strdup_printf(_("%s appears to be offline and did not receive" - " the message that you just sent."), name); - purple_conversation_write(gconv, NULL, str, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - } - } -} - -static void -_event_callback(NMUser * user, NMEvent * event) -{ - if (user == NULL || event == NULL) - return; - - switch (nm_event_get_type(event)) { - case NMEVT_STATUS_CHANGE: - _evt_status_change(user, event); - break; - case NMEVT_RECEIVE_AUTOREPLY: - case NMEVT_RECEIVE_MESSAGE: - _evt_receive_message(user, event); - break; - case NMEVT_USER_DISCONNECT: - _evt_user_disconnect(user, event); - break; - case NMEVT_USER_TYPING: - _evt_user_typing(user, event); - break; - case NMEVT_USER_NOT_TYPING: - _evt_user_not_typing(user, event); - break; - case NMEVT_SERVER_DISCONNECT: - /* Nothing to do? */ - break; - case NMEVT_INVALID_RECIPIENT: - break; - case NMEVT_UNDELIVERABLE_STATUS: - _evt_undeliverable_status(user, event); - break; - case NMEVT_CONFERENCE_INVITE_NOTIFY: - /* Someone else has been invited to join a - * conference that we are currently a part of - */ - _evt_conference_invite_notify(user, event); - break; - case NMEVT_CONFERENCE_INVITE: - /* We have been invited to join a conference */ - _evt_conference_invite(user, event); - break; - case NMEVT_CONFERENCE_JOINED: - /* Some one has joined a conference that we - * are a part of - */ - _evt_conference_joined(user, event); - break; - case NMEVT_CONFERENCE_LEFT: - /* Someone else has left a conference that we - * are currently a part of - */ - _evt_conference_left(user, event); - break; - default: - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_event_callback(): unhandled event, %d\n", - nm_event_get_type(event)); - break; - } -} - -/******************************************************************************* - * Prpl Ops - ******************************************************************************/ - -static void -novell_login(PurpleAccount * account) -{ - PurpleConnection *gc; - NMUser *user = NULL; - const char *server; - const char *name; - int port; - - if (account == NULL) - return; - - gc = purple_account_get_connection(account); - if (gc == NULL) - return; - - server = purple_account_get_string(account, "server", NULL); - if (server == NULL || *server == '\0') { - - /* TODO: Would be nice to prompt if not set! - * purple_request_fields(gc, _("Server Address"),...); - */ - - /* ...but for now just error out with a nice message. */ - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Unable to connect to server. Please enter the " - "address of the server to which you wish to connect.")); - return; - } - - port = purple_account_get_int(account, "port", DEFAULT_PORT); - name = purple_account_get_username(account); - - user = nm_initialize_user(name, server, port, account, _event_callback); - if (user && user->conn) { - /* save user */ - gc->proto_data = user; - - /* connect to the server */ - purple_connection_update_progress(gc, _("Connecting"), - 1, NOVELL_CONNECT_STEPS); - - user->conn->use_ssl = TRUE; - - user->conn->ssl_conn = g_new0(NMSSLConn, 1); - user->conn->ssl_conn->read = (nm_ssl_read_cb) purple_ssl_read; - user->conn->ssl_conn->write = (nm_ssl_write_cb) purple_ssl_write; - - user->conn->ssl_conn->data = purple_ssl_connect(user->client_data, - user->conn->addr, user->conn->port, - novell_ssl_connected_cb, novell_ssl_connect_error, gc); - if (user->conn->ssl_conn->data == NULL) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - } - } -} - -static void -novell_close(PurpleConnection * gc) -{ - NMUser *user; - NMConn *conn; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user) { - conn = user->conn; - if (conn && conn->ssl_conn) { - purple_ssl_close(user->conn->ssl_conn->data); - } - nm_deinitialize_user(user); - } - gc->proto_data = NULL; -} - -static int -novell_send_im(PurpleConnection * gc, const char *name, - const char *message_body, PurpleMessageFlags flags) -{ - NMUserRecord *user_record = NULL; - NMConference *conf = NULL; - NMMessage *message; - NMUser *user; - const char *dn = NULL; - char *plain; - gboolean done = TRUE, created_conf = FALSE; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL || - message_body == NULL || *message_body == '\0') - return 0; - - user = gc->proto_data; - if (user == NULL) - return 0; - - /* Create a new message */ - plain = purple_unescape_html(message_body); - message = nm_create_message(plain); - g_free(plain); - - /* Need to get the DN for the buddy so we can look up the convo */ - dn = nm_lookup_dn(user, name); - - /* Do we already know about the sender? */ - user_record = nm_find_user_record(user, dn); - if (user_record) { - - /* Do we already have an instantiated conference? */ - conf = nm_find_conversation(user, dn); - if (conf == NULL) { - - /* If not, create a blank conference */ - conf = nm_create_conference(NULL); - created_conf = TRUE; - - nm_conference_add_participant(conf, user_record); - } - - nm_message_set_conference(message, conf); - - /* Make sure conference is instantiated */ - if (!nm_conference_is_instantiated(conf)) { - - /* It is not, so send the createconf. We will - * have to finish sending the message when we - * get the response with the new conference guid. - */ - rc = nm_send_create_conference(user, conf, _createconf_resp_send_msg, message); - _check_for_disconnect(user, rc); - - done = FALSE; - } - - } else { - - /* If we don't have details for the user, then we don't have - * a conference yet. So create one and send the getdetails - * to the server. We will have to finish sending the message - * when we get the response from the server. - */ - conf = nm_create_conference(NULL); - created_conf = TRUE; - - nm_message_set_conference(message, conf); - - rc = nm_send_get_details(user, name, _get_details_resp_send_msg, message); - _check_for_disconnect(user, rc); - - done = FALSE; - } - - if (done) { - - /* Did we find everything we needed? */ - rc = nm_send_message(user, message, _send_message_resp_cb); - _check_for_disconnect(user, rc); - - nm_release_message(message); - } - - if (created_conf && conf) - nm_release_conference(conf); - - return 1; -} - -static unsigned int -novell_send_typing(PurpleConnection * gc, const char *name, PurpleTypingState state) -{ - NMConference *conf = NULL; - NMUser *user; - const char *dn = NULL; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL) - return 0; - - user = gc->proto_data; - if (user == NULL) - return 0; - - /* Need to get the DN for the buddy so we can look up the convo */ - dn = nm_lookup_dn(user, name); - if (dn) { - - /* Now find the conference in our list */ - conf = nm_find_conversation(user, dn); - if (conf) { - - rc = nm_send_typing(user, conf, - ((state == PURPLE_TYPING) ? TRUE : FALSE), NULL); - _check_for_disconnect(user, rc); - - } - - } - - return 0; -} - -static void -novell_convo_closed(PurpleConnection * gc, const char *who) -{ - NMUser *user; - NMConference *conf; - const char *dn; - NMERR_T rc = NM_OK; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user && (dn = nm_lookup_dn(user, who))) { - conf = nm_find_conversation(user, dn); - if (conf) { - rc = nm_send_leave_conference(user, conf, NULL, NULL); - _check_for_disconnect(user, rc); - } - } -} - -static void -novell_chat_leave(PurpleConnection * gc, int id) -{ - NMConference *conference; - NMUser *user; - PurpleConversation *chat; - GSList *cnode; - NMERR_T rc = NM_OK; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - rc = nm_send_leave_conference(user, conference, NULL, NULL); - _check_for_disconnect(user, rc); - break; - } - } - } - - serv_got_chat_left(gc, id); -} - -static void -novell_chat_invite(PurpleConnection *gc, int id, - const char *message, const char *who) -{ - NMConference *conference; - NMUser *user; - PurpleConversation *chat; - GSList *cnode; - NMERR_T rc = NM_OK; - NMUserRecord *user_record = NULL; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - user_record = nm_find_user_record(user, who); - if (user_record == NULL) { - rc = nm_send_get_details(user, who, _get_details_resp_send_invite, GINT_TO_POINTER(id)); - _check_for_disconnect(user, rc); - return; - } - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - rc = nm_send_conference_invite(user, conference, user_record, - message, _sendinvite_resp_cb, NULL); - _check_for_disconnect(user, rc); - break; - } - } - } -} - -static int -novell_chat_send(PurpleConnection * gc, int id, const char *text, PurpleMessageFlags flags) -{ - NMConference *conference; - PurpleConversation *chat; - GSList *cnode; - NMMessage *message; - NMUser *user; - NMERR_T rc = NM_OK; - const char *name; - char *str, *plain; - - if (gc == NULL || text == NULL) - return -1; - - user = gc->proto_data; - if (user == NULL) - return -1; - - plain = purple_unescape_html(text); - message = nm_create_message(plain); - g_free(plain); - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - - nm_message_set_conference(message, conference); - - /* check to see if the conference is instatiated yet */ - if (!nm_conference_is_instantiated(conference)) { - nm_message_add_ref(message); - nm_send_create_conference(user, conference, _createconf_resp_send_msg, message); - } else { - rc = nm_send_message(user, message, _send_message_resp_cb); - } - - nm_release_message(message); - - if (!_check_for_disconnect(user, rc)) { - - /* Use the account alias if it is set */ - name = purple_account_get_alias(user->client_data); - if (name == NULL || *name == '\0') { - - /* If there is no account alias, try full name */ - name = nm_user_record_get_full_name(user->user_record); - if (name == NULL || *name == '\0') { - - /* Fall back to the username that we are signed in with */ - name = purple_account_get_username(user->client_data); - } - } - - serv_got_chat_in(gc, id, name, flags, text, time(NULL)); - return 0; - } else - return -1; - - } - } - } - - - /* The conference was not found, must be closed */ - chat = purple_find_chat(gc, id); - if (chat) { - str = g_strdup(_("This conference has been closed." - " No more messages can be sent.")); - purple_conversation_write(chat, NULL, str, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - } - - if (message) - nm_release_message(message); - - return -1; -} - -static void -novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group) -{ - NMFolder *folder = NULL; - NMContact *contact; - NMUser *user; - NMERR_T rc = NM_OK; - const char *alias, *gname, *bname; - - if (gc == NULL || buddy == NULL || group == NULL) - return; - - user = (NMUser *) purple_connection_get_protocol_data(gc); - if (user == NULL) - return; - - /* If we haven't synched the contact list yet, ignore - * the add_buddy calls. Server side list is the master. - */ - if (!user->clist_synched) - return; - - /* Don't re-add a buddy that is already on our contact list */ - if (nm_find_user_record(user, purple_buddy_get_name(buddy)) != NULL) - return; - - contact = nm_create_contact(); - nm_contact_set_dn(contact, purple_buddy_get_name(buddy)); - - /* Remove the PurpleBuddy (we will add it back after adding it - * to the server side list). Save the alias if there is one. - */ - alias = purple_buddy_get_alias(buddy); - bname = purple_buddy_get_name(buddy); - if (alias && strcmp(alias, bname)) - nm_contact_set_display_name(contact, alias); - - purple_blist_remove_buddy(buddy); - buddy = NULL; - - gname = purple_group_get_name(group); - if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { - gname = ""; - } - - folder = nm_find_folder(user, gname); - if (folder) { - - /* We have everything that we need, so send the createcontact */ - rc = nm_send_create_contact(user, folder, contact, - _create_contact_resp_cb, contact); - - } else { - - /* Need to create the folder before we can add the contact */ - rc = nm_send_create_folder(user, gname, - _create_folder_resp_add_contact, contact); - } - - _check_for_disconnect(user, rc); - -} - -static void -novell_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - NMContact *contact; - NMFolder *folder; - NMUser *user; - const char *dn, *gname; - NMERR_T rc = NM_OK; - - if (gc == NULL || buddy == NULL || group == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { - gname = purple_group_get_name(group); - if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { - gname = ""; - } - folder = nm_find_folder(user, gname); - if (folder) { - contact = nm_folder_find_contact(folder, dn); - if (contact) { - - /* Remove the buddy from the contact */ - nm_contact_set_data(contact, NULL); - - /* Tell the server to remove the contact */ - rc = nm_send_remove_contact(user, folder, contact, - _remove_contact_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } - } -} - -static void -novell_remove_group(PurpleConnection * gc, PurpleGroup *group) -{ - NMUser *user; - NMERR_T rc = NM_OK; - - if (gc == NULL || group == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user) { - NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); - - if (folder) { - rc = nm_send_remove_folder(user, folder, - _remove_folder_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } -} - -static void -novell_alias_buddy(PurpleConnection * gc, const char *name, const char *alias) -{ - NMContact *contact; - NMUser *user; - GList *contacts = NULL; - GList *cnode = NULL; - const char *dn = NULL, *fname = NULL; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL || alias == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, name))) { - - /* Alias all of instances of the contact */ - contacts = nm_find_contacts(user, dn); - for (cnode = contacts; cnode != NULL; cnode = cnode->next) { - contact = (NMContact *) cnode->data; - if (contact) { - PurpleGroup *group = NULL; - PurpleBuddy *buddy; - NMFolder *folder; - - /* Alias the Purple buddy? */ - folder = nm_find_folder_by_id(user, - nm_contact_get_parent_id(contact)); - if (folder) { - fname = nm_folder_get_name(folder); - if (*fname == '\0') { - fname = NM_ROOT_FOLDER_NAME; - } - group = purple_find_group(fname); - } - - if (group) { - const char *balias; - buddy = purple_find_buddy_in_group(user->client_data, - name, group); - balias = buddy ? purple_buddy_get_local_buddy_alias(buddy) : NULL; - if (balias && strcmp(balias, alias)) - purple_blist_alias_buddy(buddy, alias); - } - - /* Tell the server to alias the contact */ - rc = nm_send_rename_contact(user, contact, alias, - _rename_contact_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } - if (contacts) - g_list_free(contacts); - } -} - -static void -novell_group_buddy(PurpleConnection * gc, - const char *name, const char *old_group_name, - const char *new_group_name) -{ - NMFolder *old_folder; - NMFolder *new_folder; - NMContact *contact; - NMUser *user; - const char *dn; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL || - old_group_name == NULL || new_group_name == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, name))) { - - /* Find the old folder */ - if (strcmp(old_group_name, NM_ROOT_FOLDER_NAME) == 0) { - old_folder = nm_get_root_folder(user); - if (nm_folder_find_contact(old_folder, dn) == NULL) - old_folder = nm_find_folder(user, old_group_name); - } else { - old_folder = nm_find_folder(user, old_group_name); - } - - if (old_folder && (contact = nm_folder_find_contact(old_folder, dn))) { - - /* Find the new folder */ - new_folder = nm_find_folder(user, new_group_name); - if (new_folder == NULL) { - if (strcmp(new_group_name, NM_ROOT_FOLDER_NAME) == 0) - new_folder = nm_get_root_folder(user); - } - - if (new_folder) { - - /* Tell the server to move the contact to the new folder */ - rc = nm_send_move_contact(user, contact, new_folder, - _move_contact_resp_cb, NULL); - - } else { - - nm_contact_add_ref(contact); - - /* Remove the old contact first */ - nm_send_remove_contact(user, old_folder, contact, - _remove_contact_resp_cb, NULL); - - /* New folder does not exist yet, so create it */ - rc = nm_send_create_folder(user, new_group_name, - _create_folder_resp_move_contact, - contact); - } - - _check_for_disconnect(user, rc); - } - } -} - -static void -novell_rename_group(PurpleConnection * gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - NMERR_T rc = NM_OK; - NMFolder *folder; - NMUser *user; - - if (gc == NULL || old_name == NULL || group == NULL || moved_buddies == NULL) { - return; - } - - user = gc->proto_data; - if (user) { - const char *gname = purple_group_get_name(group); - /* Does new folder exist already? */ - if (nm_find_folder(user, gname)) { - /* purple_blist_rename_group() adds the buddies - * to the new group and removes the old group... - * so there is nothing more to do here. - */ - return; - } - - if (strcmp(old_name, NM_ROOT_FOLDER_NAME) == 0) { - /* Can't rename the root folder ... need to revisit this */ - return; - } - - folder = nm_find_folder(user, old_name); - if (folder) { - rc = nm_send_rename_folder(user, folder, gname, - _rename_folder_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } -} - -static const char * -novell_list_icon(PurpleAccount * account, PurpleBuddy * buddy) -{ - return "novell"; -} - -static void -novell_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * user_info, gboolean full) -{ - NMUserRecord *user_record = NULL; - PurpleConnection *gc; - NMUser *user; - int status = 0; - const char *status_str = NULL; - const char *text = NULL; - - if (buddy == NULL) - return; - - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - if (gc == NULL || (user = gc->proto_data) == NULL) - return; - - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); - if (user_record) { - status = nm_user_record_get_status(user_record); - text = nm_user_record_get_status_text(user_record); - /* No custom text, so default it ... */ - switch (status) { - case NM_STATUS_AVAILABLE: - status_str = _("Available"); - break; - case NM_STATUS_AWAY: - status_str = _("Away"); - break; - case NM_STATUS_BUSY: - status_str = _("Busy"); - break; - case NM_STATUS_AWAY_IDLE: - status_str = _("Idle"); - break; - case NM_STATUS_OFFLINE: - status_str = _("Offline"); - break; - default: - status_str = _("Unknown"); - break; - } - - purple_notify_user_info_add_pair(user_info, _("Status"), status_str); - - if (text) - purple_notify_user_info_add_pair(user_info, _("Message"), text); - } - } -} - -static void -novell_set_idle(PurpleConnection * gc, int time) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *id = NULL; - PurpleStatus *status = NULL; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - status = purple_account_get_active_status(purple_connection_get_account(gc)); - id = purple_status_get_id(status); - - /* Only go idle if active status is available */ - if (!strcmp(id, NOVELL_STATUS_TYPE_AVAILABLE)) { - if (time > 0) { - rc = nm_send_set_status(user, NM_STATUS_AWAY_IDLE, NULL, NULL, NULL, NULL); - } else { - rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, NULL); - } - } - - _check_for_disconnect(user, rc); -} - -static void -novell_get_info(PurpleConnection * gc, const char *name) -{ - NMUserRecord *user_record; - NMUser *user; - NMERR_T rc; - - if (gc == NULL || name == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user) { - - user_record = nm_find_user_record(user, name); - if (user_record) { - - _show_info(gc, user_record); - - } else { - - rc = nm_send_get_details(user, name, - _get_details_resp_show_info, g_strdup(name)); - - _check_for_disconnect(user, rc); - - } - - } -} - -static char * -novell_status_text(PurpleBuddy * buddy) -{ - const char *text = NULL; - const char *dn = NULL; - PurpleAccount *account; - - account = buddy ? purple_buddy_get_account(buddy) : NULL; - if (buddy && account) { - PurpleConnection *gc = purple_account_get_connection(account); - - if (gc && gc->proto_data) { - NMUser *user = gc->proto_data; - - dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); - - if (user_record) { - text = nm_user_record_get_status_text(user_record); - if (text) - return g_strdup(text); - } - } - } - } - - return NULL; -} - -static GList * -novell_status_types(PurpleAccount *account) -{ - GList *status_types = NULL; - PurpleStatusType *type; - - g_return_val_if_fail(account != NULL, NULL); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, NOVELL_STATUS_TYPE_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, NOVELL_STATUS_TYPE_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, NOVELL_STATUS_TYPE_BUSY, - _("Busy"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, NOVELL_STATUS_TYPE_APPEAR_OFFLINE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - return status_types; -} - -static void -novell_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - gboolean connected; - PurplePresence *presence; - PurpleStatusType *type; - PurpleStatusPrimitive primitive; - NMUser *user; - NMSTATUS_T novellstatus = NM_STATUS_AVAILABLE; - NMERR_T rc = NM_OK; - const char *msg = NULL; - char *text = NULL; - - connected = purple_account_is_connected(account); - presence = purple_status_get_presence(status); - type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(type); - - /* - * We don't have any independent statuses, so we don't need to - * do anything when a status is deactivated (because another - * status is about to be activated). - */ - if (!purple_status_is_active(status)) - return; - - if (!connected) - return; - - gc = purple_account_get_connection(account); - user = gc->proto_data; - if (user == NULL) - return; - - if (primitive == PURPLE_STATUS_AVAILABLE) { - novellstatus = NM_STATUS_AVAILABLE; - } else if (primitive == PURPLE_STATUS_AWAY) { - novellstatus = NM_STATUS_AWAY; - } else if (primitive == PURPLE_STATUS_UNAVAILABLE) { - novellstatus = NM_STATUS_BUSY; - } else if (primitive == PURPLE_STATUS_INVISIBLE) { - novellstatus = NM_STATUS_OFFLINE; - } else if (purple_presence_is_idle(presence)) { - novellstatus = NM_STATUS_AWAY_IDLE; - } else { - novellstatus = NM_STATUS_AVAILABLE; - } - - if (primitive == PURPLE_STATUS_AWAY || primitive == PURPLE_STATUS_AVAILABLE || - primitive == PURPLE_STATUS_UNAVAILABLE) { - msg = purple_status_get_attr_string(status, "message"); - text = g_strdup(msg); - - if (primitive == PURPLE_STATUS_AVAILABLE) - msg = NULL; /* no auto replies for online status */ - - /* Don't want newlines in status text */ - purple_util_chrreplace(text, '\n', ' '); - } - - rc = nm_send_set_status(user, novellstatus, text, msg, NULL, NULL); - _check_for_disconnect(user, rc); - - if (text) - g_free(text); -} - -static void -novell_add_permit(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *name = who; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - /* Remove first -- we will add it back in when we get - * the okay from the server - */ - purple_privacy_permit_remove(gc->account, who, TRUE); - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - /* Work around for problem with un-typed, dotted contexts */ - if (strchr(who, '.')) { - const char *dn = nm_lookup_dn(user, who); - if (dn == NULL) { - rc = nm_send_get_details(user, who, _get_details_send_privacy_create, - (gpointer)TRUE); - _check_for_disconnect(user, rc); - return; - } else { - name = dn; - } - } - - rc = nm_send_create_privacy_item(user, name, TRUE, - _create_privacy_item_permit_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_add_deny(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *name = who; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - /* Remove first -- we will add it back in when we get - * the okay from the server - */ - purple_privacy_deny_remove(gc->account, who, TRUE); - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - /* Work around for problem with un-typed, dotted contexts */ - if (strchr(who, '.')) { - const char *dn = nm_lookup_dn(user, who); - if (dn == NULL) { - rc = nm_send_get_details(user, who, _get_details_send_privacy_create, - (gpointer)FALSE); - _check_for_disconnect(user, rc); - return; - } else { - name = dn; - } - } - - rc = nm_send_create_privacy_item(user, name, FALSE, - _create_privacy_item_deny_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_rem_permit(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *dn = NULL; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - dn = nm_lookup_dn(user, who); - if (dn == NULL) - dn = who; - - rc = nm_send_remove_privacy_item(user, dn, TRUE, - _remove_privacy_item_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_rem_deny(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *dn = NULL; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - dn = nm_lookup_dn(user, who); - if (dn == NULL) - dn = who; - - rc = nm_send_remove_privacy_item(user, dn, FALSE, - _remove_privacy_item_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_set_permit_deny(PurpleConnection *gc) -{ - NMERR_T rc = NM_OK; - const char *dn, *name = NULL; - NMUserRecord *user_record = NULL; - GSList *node = NULL, *copy = NULL; - NMUser *user; - int i, j, num_contacts, num_folders; - NMContact *contact; - NMFolder *folder = NULL; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - if (user->privacy_synched == FALSE) { - _sync_privacy_lists(user); - user->privacy_synched = TRUE; - return; - } - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - switch (gc->account->perm_deny) { - - case PURPLE_PRIVACY_ALLOW_ALL: - rc = nm_send_set_privacy_default(user, FALSE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* clear server side deny list */ - if (rc == NM_OK) { - copy = g_slist_copy(user->deny_list); - for (node = copy; node && node->data; node = node->next) { - rc = nm_send_remove_privacy_item(user, (const char *)node->data, - FALSE, NULL, NULL); - if (_check_for_disconnect(user, rc)) - break; - } - g_slist_free(copy); - g_slist_free(user->deny_list); - user->deny_list = NULL; - } - break; - - case PURPLE_PRIVACY_DENY_ALL: - rc = nm_send_set_privacy_default(user, TRUE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* clear server side allow list */ - if (rc == NM_OK) { - copy = g_slist_copy(user->allow_list); - for (node = copy; node && node->data; node = node->next) { - rc = nm_send_remove_privacy_item(user, (const char *)node->data, - TRUE, NULL, NULL); - if (_check_for_disconnect(user, rc)) - break; - } - g_slist_free(copy); - g_slist_free(user->allow_list); - user->allow_list = NULL; - } - break; - - case PURPLE_PRIVACY_ALLOW_USERS: - - rc = nm_send_set_privacy_default(user, TRUE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* sync allow lists */ - if (rc == NM_OK) { - - for (node = user->allow_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) { - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(gc->account->permit, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); - } - } - } - - for (node = gc->account->permit; node; node = node->next) { - name = NULL; - dn = nm_lookup_dn(user, (char *)node->data); - if (dn) { - user_record = nm_find_user_record(user, dn); - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_deny_resp_cb, - g_strdup(dn)); - } - } else { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); - } - } - } - break; - - case PURPLE_PRIVACY_DENY_USERS: - - /* set to default allow */ - rc = nm_send_set_privacy_default(user, FALSE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* sync deny lists */ - if (rc == NM_OK) { - - for (node = user->deny_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) { - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(gc->account->deny, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name , TRUE); - } - } - } - - for (node = gc->account->deny; node; node = node->next) { - - name = NULL; - dn = nm_lookup_dn(user, (char *)node->data); - if (dn) { - user_record = nm_find_user_record(user, dn); - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(user->deny_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rc = nm_send_create_privacy_item(user, dn, FALSE, - _create_privacy_item_deny_resp_cb, - g_strdup(name)); - } - } else { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); - } - } - - } - break; - - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - - /* remove users from allow list that are not in buddy list */ - copy = g_slist_copy(user->allow_list); - for (node = copy; node && node->data; node = node->next) { - if (!nm_find_contacts(user, node->data)) { - rc = nm_send_remove_privacy_item(user, (const char *)node->data, - TRUE, NULL, NULL); - if (_check_for_disconnect(user, rc)) - return; - } - } - g_slist_free(copy); - - /* add all buddies to allow list */ - num_contacts = nm_folder_get_contact_count(user->root_folder); - for (i = 0; i < num_contacts; i++) { - contact = nm_folder_get_contact(user->root_folder, i); - dn = nm_contact_get_dn(contact); - if (dn && !g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) - { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_deny_resp_cb, - g_strdup(dn)); - if (_check_for_disconnect(user, rc)) - return; - } - - } - - num_folders = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < num_folders; i++) { - folder = nm_folder_get_subfolder(user->root_folder, i); - num_contacts = nm_folder_get_contact_count(folder); - for (j = 0; j < num_contacts; j++) { - contact = nm_folder_get_contact(folder, j); - dn = nm_contact_get_dn(contact); - if (dn && !g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) - { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_deny_resp_cb, - g_strdup(dn)); - if (_check_for_disconnect(user, rc)) - return; - } - } - } - - /* set to default deny */ - rc = nm_send_set_privacy_default(user, TRUE, - _set_privacy_default_resp_cb, NULL); - if (_check_for_disconnect(user, rc)) - break; - - break; - } -} - -static GList * -novell_blist_node_menu(PurpleBlistNode *node) -{ - GList *list = NULL; - PurpleMenuAction *act; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(_initiate_conference_cb), - NULL, NULL); - list = g_list_append(list, act); - } - - return list; -} - -static void -novell_keepalive(PurpleConnection *gc) -{ - NMUser *user; - NMERR_T rc = NM_OK; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - rc = nm_send_keepalive(user, NULL, NULL); - _check_for_disconnect(user, rc); -} - -static PurplePluginProtocolInfo prpl_info = { - 0, - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec */ - novell_list_icon, /* list_icon */ - NULL, /* list_emblems */ - novell_status_text, /* status_text */ - novell_tooltip_text, /* tooltip_text */ - novell_status_types, /* status_types */ - novell_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - novell_login, /* login */ - novell_close, /* close */ - novell_send_im, /* send_im */ - NULL, /* set_info */ - novell_send_typing, /* send_typing */ - novell_get_info, /* get_info */ - novell_set_status, /* set_status */ - novell_set_idle, /* set_idle */ - NULL, /* change_passwd */ - novell_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - novell_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - novell_add_permit, /* add_permit */ - novell_add_deny, /* add_deny */ - novell_rem_permit, /* rem_permit */ - novell_rem_deny, /* rem_deny */ - novell_set_permit_deny, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - novell_chat_invite, /* chat_invite */ - novell_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - novell_chat_send, /* chat_send */ - novell_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - novell_alias_buddy, /* alias_buddy */ - novell_group_buddy, /* group_buddy */ - novell_rename_group, /* rename_group */ - NULL, /* buddy_free */ - novell_convo_closed, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - NULL, /* set_buddy_icon */ - novell_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "prpl-novell", /**< id */ - "GroupWise", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Novell GroupWise Messenger Protocol Plugin"), - /** description */ - N_("Novell GroupWise Messenger Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin * plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Server address"), "server", NULL); - prpl_info.protocol_options = - g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Server port"), "port", DEFAULT_PORT); - prpl_info.protocol_options = - g_list_append(prpl_info.protocol_options, option); - - my_protocol = plugin; -} - -PURPLE_INIT_PLUGIN(novell, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -NULLSOURCES = nullprpl.c - -AM_CFLAGS = $(st) - -libnull_la_LDFLAGS = -module -avoid-version - -# nullprpl isn't built by default. when it is built, it's dynamically linked. -st = -pkg_LTLIBRARIES = libnull.la -libnull_la_SOURCES = $(NULLSOURCES) -libnull_la_LIBADD = $(GLIB_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,714 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/null -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -libnull_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_1 = nullprpl.lo -am_libnull_la_OBJECTS = $(am__objects_1) -libnull_la_OBJECTS = $(am_libnull_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libnull_la_SOURCES) -DIST_SOURCES = $(libnull_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - README - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -NULLSOURCES = nullprpl.c -AM_CFLAGS = $(st) -libnull_la_LDFLAGS = -module -avoid-version - -# nullprpl isn't built by default. when it is built, it's dynamically linked. -st = -pkg_LTLIBRARIES = libnull.la -libnull_la_SOURCES = $(NULLSOURCES) -libnull_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/null/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/null/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libnull.la: $(libnull_la_OBJECTS) $(libnull_la_DEPENDENCIES) - $(LINK) -rpath $(pkgdir) $(libnull_la_LDFLAGS) $(libnull_la_OBJECTS) $(libnull_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nullprpl.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pkgLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pkgLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libnull -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libnull -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = nullprpl.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install install_real clean - -all: $(TARGET).dll - -install_real: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -install: all - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/nullprpl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/nullprpl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/nullprpl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/nullprpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1196 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Nullprpl is a mock protocol plugin for Pidgin and libpurple. You can create - * accounts with it, sign on and off, add buddies, and send and receive IMs, - * all without connecting to a server! - * - * Beyond that basic functionality, nullprpl supports presence and - * away/available messages, offline messages, user info, typing notification, - * privacy allow/block lists, chat rooms, whispering, room lists, and protocol - * icons and emblems. Notable missing features are file transfer and account - * registration and authentication. - * - * Nullprpl is intended as an example of how to write a libpurple protocol - * plugin. It doesn't contain networking code or an event loop, but it does - * demonstrate how to use the libpurple API to do pretty much everything a prpl - * might need to do. - * - * Nullprpl is also a useful tool for hacking on Pidgin, Finch, and other - * libpurple clients. It's a full-featured protocol plugin, but doesn't depend - * on an external server, so it's a quick and easy way to exercise test new - * code. It also allows you to work while you're disconnected. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include - -/* If you're using this as the basis of a prpl that will be distributed - * separately from libpurple, remove the internal.h include below and replace - * it with code to include your own config.h or similar. If you're going to - * provide for translation, you'll also need to setup the gettext macros. */ -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cmds.h" -#include "conversation.h" -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "roomlist.h" -#include "status.h" -#include "util.h" -#include "version.h" - - -#define NULLPRPL_ID "prpl-null" -static PurplePlugin *_null_protocol = NULL; - -#define NULL_STATUS_ONLINE "online" -#define NULL_STATUS_AWAY "away" -#define NULL_STATUS_OFFLINE "offline" - -typedef void (*GcFunc)(PurpleConnection *from, - PurpleConnection *to, - gpointer userdata); - -typedef struct { - GcFunc fn; - PurpleConnection *from; - gpointer userdata; -} GcFuncData; - -/* - * stores offline messages that haven't been delivered yet. maps username - * (char *) to GList * of GOfflineMessages. initialized in nullprpl_init. - */ -GHashTable* goffline_messages = NULL; - -typedef struct { - char *from; - char *message; - time_t mtime; - PurpleMessageFlags flags; -} GOfflineMessage; - -/* - * helpers - */ -static PurpleConnection *get_nullprpl_gc(const char *username) { - PurpleAccount *acct = purple_accounts_find(username, NULLPRPL_ID); - if (acct && purple_account_is_connected(acct)) - return acct->gc; - else - return NULL; -} - -static void call_if_nullprpl(gpointer data, gpointer userdata) { - PurpleConnection *gc = (PurpleConnection *)(data); - GcFuncData *gcfdata = (GcFuncData *)userdata; - - if (!strcmp(gc->account->protocol_id, NULLPRPL_ID)) - gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); -} - -static void foreach_nullprpl_gc(GcFunc fn, PurpleConnection *from, - gpointer userdata) { - GcFuncData gcfdata = { fn, from, userdata }; - g_list_foreach(purple_connections_get_all(), call_if_nullprpl, - &gcfdata); -} - - -typedef void(*ChatFunc)(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata); - -typedef struct { - ChatFunc fn; - PurpleConvChat *from_chat; - gpointer userdata; -} ChatFuncData; - -static void call_chat_func(gpointer data, gpointer userdata) { - PurpleConnection *to = (PurpleConnection *)data; - ChatFuncData *cfdata = (ChatFuncData *)userdata; - - int id = cfdata->from_chat->id; - PurpleConversation *conv = purple_find_chat(to, id); - if (conv) { - PurpleConvChat *chat = purple_conversation_get_chat_data(conv); - cfdata->fn(cfdata->from_chat, chat, id, conv->name, cfdata->userdata); - } -} - -static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, - int id, gpointer userdata) { - PurpleConversation *conv = purple_find_chat(from, id); - ChatFuncData cfdata = { fn, - purple_conversation_get_chat_data(conv), - userdata }; - - g_list_foreach(purple_connections_get_all(), call_chat_func, - &cfdata); -} - - -static void discover_status(PurpleConnection *from, PurpleConnection *to, - gpointer userdata) { - const char *from_username = from->account->username; - const char *to_username = to->account->username; - - if (purple_find_buddy(from->account, to_username)) { - PurpleStatus *status = purple_account_get_active_status(to->account); - const char *status_id = purple_status_get_id(status); - const char *message = purple_status_get_attr_string(status, "message"); - - if (!strcmp(status_id, NULL_STATUS_ONLINE) || - !strcmp(status_id, NULL_STATUS_AWAY) || - !strcmp(status_id, NULL_STATUS_OFFLINE)) { - purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", - from_username, to_username, status_id, message); - purple_prpl_got_user_status(from->account, to_username, status_id, - (message) ? "message" : NULL, message, NULL); - } else { - purple_debug_error("nullprpl", - "%s's buddy %s has an unknown status: %s, %s", - from_username, to_username, status_id, message); - } - } -} - -static void report_status_change(PurpleConnection *from, PurpleConnection *to, - gpointer userdata) { - purple_debug_info("nullprpl", "notifying %s that %s changed status\n", - to->account->username, from->account->username); - discover_status(to, from, NULL); -} - - -/* - * UI callbacks - */ -static void nullprpl_input_user_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - PurpleAccount *acct = purple_connection_get_account(gc); - purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n", - acct->username); - - purple_account_request_change_user_info(acct); -} - -/* this is set to the actions member of the PurplePluginInfo struct at the - * bottom. - */ -static GList *nullprpl_actions(PurplePlugin *plugin, gpointer context) -{ - PurplePluginAction *action = purple_plugin_action_new( - _("Set User Info..."), nullprpl_input_user_info); - return g_list_append(NULL, action); -} - - -/* - * prpl functions - */ -static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) -{ - return "null"; -} - -static char *nullprpl_status_text(PurpleBuddy *buddy) { - purple_debug_info("nullprpl", "getting %s's status text for %s\n", - buddy->name, buddy->account->username); - - if (purple_find_buddy(buddy->account, buddy->name)) { - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - const char *name = purple_status_get_name(status); - const char *message = purple_status_get_attr_string(status, "message"); - - char *text; - if (message && strlen(message) > 0) - text = g_strdup_printf("%s: %s", name, message); - else - text = g_strdup(name); - - purple_debug_info("nullprpl", "%s's status text is %s\n", buddy->name, text); - return text; - - } else { - purple_debug_info("nullprpl", "...but %s is not logged in\n", buddy->name); - return g_strdup("Not logged in"); - } -} - -static void nullprpl_tooltip_text(PurpleBuddy *buddy, - PurpleNotifyUserInfo *info, - gboolean full) { - PurpleConnection *gc = get_nullprpl_gc(buddy->name); - - if (gc) { - /* they're logged in */ - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - char *msg = nullprpl_status_text(buddy); - purple_notify_user_info_add_pair(info, purple_status_get_name(status), - msg); - g_free(msg); - - if (full) { - const char *user_info = purple_account_get_user_info(gc->account); - if (user_info) - purple_notify_user_info_add_pair(info, _("User info"), user_info); - } - - } else { - /* they're not logged in */ - purple_notify_user_info_add_pair(info, _("User info"), _("not logged in")); - } - - purple_debug_info("nullprpl", "showing %s tooltip for %s\n", - (full) ? "full" : "short", buddy->name); -} - -static GList *nullprpl_status_types(PurpleAccount *acct) -{ - GList *types = NULL; - PurpleStatusType *type; - - purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", - acct->username, - NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - NULL_STATUS_ONLINE, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - NULL_STATUS_AWAY, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, - NULL_STATUS_OFFLINE, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - - return g_list_reverse(types); -} - -static void blist_example_menu_item(PurpleBlistNode *node, gpointer userdata) { - purple_debug_info("nullprpl", "example menu item clicked on user %s\n", - ((PurpleBuddy *)node)->name); - - purple_notify_info(NULL, /* plugin handle or PurpleConnection */ - _("Primary title"), - _("Secondary title"), - _("This is the callback for the nullprpl menu item.")); -} - -static GList *nullprpl_blist_node_menu(PurpleBlistNode *node) { - purple_debug_info("nullprpl", "providing buddy list context menu item\n"); - - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - PurpleMenuAction *action = purple_menu_action_new( - _("Nullprpl example menu item"), - PURPLE_CALLBACK(blist_example_menu_item), - NULL, /* userdata passed to the callback */ - NULL); /* child menu items */ - return g_list_append(NULL, action); - } else { - return NULL; - } -} - -static GList *nullprpl_chat_info(PurpleConnection *gc) { - struct proto_chat_entry *pce; /* defined in prpl.h */ - - purple_debug_info("nullprpl", "returning chat setting 'room'\n"); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Chat _room"); - pce->identifier = "room"; - pce->required = TRUE; - - return g_list_append(NULL, pce); -} - -static GHashTable *nullprpl_chat_info_defaults(PurpleConnection *gc, - const char *room) { - GHashTable *defaults; - - purple_debug_info("nullprpl", "returning chat default setting " - "'room' = 'default'\n"); - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_insert(defaults, "room", g_strdup("default")); - return defaults; -} - -static void nullprpl_login(PurpleAccount *acct) -{ - PurpleConnection *gc = purple_account_get_connection(acct); - GList *offline_messages; - - purple_debug_info("nullprpl", "logging in %s\n", acct->username); - - purple_connection_update_progress(gc, _("Connecting"), - 0, /* which connection step this is */ - 2); /* total number of steps */ - - purple_connection_update_progress(gc, _("Connected"), - 1, /* which connection step this is */ - 2); /* total number of steps */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* tell purple about everyone on our buddy list who's connected */ - foreach_nullprpl_gc(discover_status, gc, NULL); - - /* notify other nullprpl accounts */ - foreach_nullprpl_gc(report_status_change, gc, NULL); - - /* fetch stored offline messages */ - purple_debug_info("nullprpl", "checking for offline messages for %s\n", - acct->username); - offline_messages = g_hash_table_lookup(goffline_messages, acct->username); - while (offline_messages) { - GOfflineMessage *message = (GOfflineMessage *)offline_messages->data; - purple_debug_info("nullprpl", "delivering offline message to %s: %s\n", - acct->username, message->message); - serv_got_im(gc, message->from, message->message, message->flags, - message->mtime); - offline_messages = g_list_next(offline_messages); - - g_free(message->from); - g_free(message->message); - g_free(message); - } - - g_list_free(offline_messages); - g_hash_table_remove(goffline_messages, &acct->username); -} - -static void nullprpl_close(PurpleConnection *gc) -{ - /* notify other nullprpl accounts */ - foreach_nullprpl_gc(report_status_change, gc, NULL); -} - -static int nullprpl_send_im(PurpleConnection *gc, const char *who, - const char *message, PurpleMessageFlags flags) -{ - const char *from_username = gc->account->username; - PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) - | PURPLE_MESSAGE_RECV); - PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); - PurpleConnection *to; - - purple_debug_info("nullprpl", "sending message from %s to %s: %s\n", - from_username, who, message); - - /* is the sender blocked by the recipient's privacy settings? */ - if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) { - char *msg = g_strdup_printf( - _("Your message was blocked by %s's privacy settings."), who); - purple_debug_info("nullprpl", - "discarding; %s is blocked by %s's privacy settings\n", - from_username, who); - purple_conv_present_error(who, gc->account, msg); - g_free(msg); - return 0; - } - - /* is the recipient online? */ - to = get_nullprpl_gc(who); - if (to) { /* yes, send */ - serv_got_im(to, from_username, message, receive_flags, time(NULL)); - - } else { /* nope, store as an offline message */ - GOfflineMessage *offline_message; - GList *messages; - - purple_debug_info("nullprpl", - "%s is offline, sending as offline message\n", who); - offline_message = g_new0(GOfflineMessage, 1); - offline_message->from = g_strdup(from_username); - offline_message->message = g_strdup(message); - offline_message->mtime = time(NULL); - offline_message->flags = receive_flags; - - messages = g_hash_table_lookup(goffline_messages, who); - messages = g_list_append(messages, offline_message); - g_hash_table_insert(goffline_messages, g_strdup(who), messages); - } - - return 1; -} - -static void nullprpl_set_info(PurpleConnection *gc, const char *info) { - purple_debug_info("nullprpl", "setting %s's user info to %s\n", - gc->account->username, info); -} - -static const char *typing_state_to_string(PurpleTypingState typing) { - switch (typing) { - case PURPLE_NOT_TYPING: return "is not typing"; - case PURPLE_TYPING: return "is typing"; - case PURPLE_TYPED: return "stopped typing momentarily"; - default: return "unknown typing state"; - } -} - -static void notify_typing(PurpleConnection *from, PurpleConnection *to, - gpointer typing) { - const char *from_username = from->account->username; - const char *action = typing_state_to_string((PurpleTypingState)typing); - purple_debug_info("nullprpl", "notifying %s that %s %s\n", - to->account->username, from_username, action); - - serv_got_typing(to, - from_username, - 0, /* if non-zero, a timeout in seconds after which to - * reset the typing status to PURPLE_NOT_TYPING */ - (PurpleTypingState)typing); -} - -static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, - PurpleTypingState typing) { - purple_debug_info("nullprpl", "%s %s\n", gc->account->username, - typing_state_to_string(typing)); - foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); - return 0; -} - -static void nullprpl_get_info(PurpleConnection *gc, const char *username) { - const char *body; - PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - PurpleAccount *acct; - - purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, - gc->account->username); - - if (!get_nullprpl_gc(username)) { - char *msg = g_strdup_printf(_("%s is not logged in."), username); - purple_notify_error(gc, _("User Info"), _("User info not available. "), msg); - g_free(msg); - } - - acct = purple_accounts_find(username, NULLPRPL_ID); - if (acct) - body = purple_account_get_user_info(acct); - else - body = _("No user info."); - purple_notify_user_info_add_pair(info, "Info", body); - - /* show a buddy's user info in a nice dialog box */ - purple_notify_userinfo(gc, /* connection the buddy info came through */ - username, /* buddy's username */ - info, /* body */ - NULL, /* callback called when dialog closed */ - NULL); /* userdata for callback */ -} - -static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { - const char *msg = purple_status_get_attr_string(status, "message"); - purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", - acct->username, purple_status_get_name(status), msg); - - foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username), - NULL); -} - -static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { - purple_debug_info("nullprpl", - "purple reports that %s has been idle for %d seconds\n", - gc->account->username, idletime); -} - -static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, - const char *new_pass) { - purple_debug_info("nullprpl", "%s wants to change their password\n", - gc->account->username); -} - -static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - const char *username = gc->account->username; - PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); - - purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, - username); - - if (buddy_gc) { - PurpleAccount *buddy_acct = buddy_gc->account; - - discover_status(gc, buddy_gc, NULL); - - if (purple_find_buddy(buddy_acct, username)) { - purple_debug_info("nullprpl", "%s is already on %s's buddy list\n", - username, buddy->name); - } else { - purple_debug_info("nullprpl", "asking %s if they want to add %s\n", - buddy->name, username); - purple_account_request_add(buddy_acct, - username, - NULL, /* local account id (rarely used) */ - NULL, /* alias */ - NULL); /* message */ - } - } -} - -static void nullprpl_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { - GList *buddy = buddies; - GList *group = groups; - - purple_debug_info("nullprpl", "adding multiple buddies\n"); - - while (buddy && group) { - nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data); - buddy = g_list_next(buddy); - group = g_list_next(group); - } -} - -static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", - buddy->name, gc->account->username); -} - -static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { - GList *buddy = buddies; - GList *group = groups; - - purple_debug_info("nullprpl", "removing multiple buddies\n"); - - while (buddy && group) { - nullprpl_remove_buddy(gc, (PurpleBuddy *)buddy->data, - (PurpleGroup *)group->data); - buddy = g_list_next(buddy); - group = g_list_next(group); - } -} - -/* - * nullprpl uses purple's local whitelist and blacklist, stored in blist.xml, as - * its authoritative privacy settings, and uses purple's logic (specifically - * purple_privacy_check(), from privacy.h), to determine whether messages are - * allowed or blocked. - */ -static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", - gc->account->username, name); -} - -static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", - gc->account->username, name); -} - -static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", - gc->account->username, name); -} - -static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", - gc->account->username, name); -} - -static void nullprpl_set_permit_deny(PurpleConnection *gc) { - /* this is for synchronizing the local black/whitelist with the server. - * for nullprpl, it's a noop. - */ -} - -static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - /* tell their chat window that we joined */ - purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", - to->nick, from->nick, room); - purple_conv_chat_add_user(to, - from->nick, - NULL, /* user-provided join message, IRC style */ - PURPLE_CBFLAGS_NONE, - TRUE); /* show a join message */ - - if (from != to) { - /* add them to our chat window */ - purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", - from->nick, to->nick, room); - purple_conv_chat_add_user(from, - to->nick, - NULL, /* user-provided join message, IRC style */ - PURPLE_CBFLAGS_NONE, - FALSE); /* show a join message */ - } -} - -static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { - const char *username = gc->account->username; - const char *room = g_hash_table_lookup(components, "room"); - int chat_id = g_str_hash(room); - purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); - - if (!purple_find_chat(gc, chat_id)) { - serv_got_joined_chat(gc, chat_id, room); - - /* tell everyone that we joined, and add them if they're already there */ - foreach_gc_in_chat(joined_chat, gc, chat_id, NULL); - } else { - char *tmp = g_strdup_printf(_("%s is already in chat room %s."), - username, - room); - purple_debug_info("nullprpl", "%s is already in chat room %s\n", username, - room); - purple_notify_info(gc, _("Join chat"), _("Join chat"), tmp); - g_free(tmp); - } -} - -static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { - const char *invited_by = g_hash_table_lookup(components, "invited_by"); - const char *room = g_hash_table_lookup(components, "room"); - const char *username = gc->account->username; - PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); - char *message = g_strdup_printf( - "%s %s %s.", - username, - _("has rejected your invitation to join the chat room"), - room); - - purple_debug_info("nullprpl", - "%s has rejected %s's invitation to join chat room %s\n", - username, invited_by, room); - - purple_notify_info(invited_by_gc, - _("Chat invitation rejected"), - _("Chat invitation rejected"), - message); - g_free(message); -} - -static char *nullprpl_get_chat_name(GHashTable *components) { - const char *room = g_hash_table_lookup(components, "room"); - purple_debug_info("nullprpl", "reporting chat room name '%s'\n", room); - return g_strdup(room); -} - -static void nullprpl_chat_invite(PurpleConnection *gc, int id, - const char *message, const char *who) { - const char *username = gc->account->username; - PurpleConversation *conv = purple_find_chat(gc, id); - const char *room = conv->name; - PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); - - purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", - username, who, room); - - if (to_acct) { - PurpleConversation *to_conv = purple_find_chat(to_acct->gc, id); - if (to_conv) { - char *tmp = g_strdup_printf("%s is already in chat room %s.", who, room); - purple_debug_info("nullprpl", - "%s is already in chat room %s; " - "ignoring invitation from %s\n", - who, room, username); - purple_notify_info(gc, _("Chat invitation"), _("Chat invitation"), tmp); - g_free(tmp); - } else { - GHashTable *components; - components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_replace(components, "room", g_strdup(room)); - g_hash_table_replace(components, "invited_by", g_strdup(username)); - serv_got_chat_invite(to_acct->gc, room, username, message, components); - } - } -} - -static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - if (from != to) { - /* tell their chat window that we left */ - purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", - to->nick, from->nick, room); - purple_conv_chat_remove_user(to, - from->nick, - NULL); /* user-provided message, IRC style */ - } -} - -static void nullprpl_chat_leave(PurpleConnection *gc, int id) { - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("nullprpl", "%s is leaving chat room %s\n", - gc->account->username, conv->name); - - /* tell everyone that we left */ - foreach_gc_in_chat(left_chat_room, gc, id, NULL); -} - -static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **error, void *userdata) { - const char *to_username; - const char *message; - const char *from_username; - PurpleConvChat *chat; - PurpleConvChatBuddy *chat_buddy; - PurpleConnection *to; - - /* parse args */ - to_username = args[0]; - message = args[1]; - - if (!to_username || strlen(to_username) == 0) { - *error = g_strdup(_("Whisper is missing recipient.")); - return PURPLE_CMD_RET_FAILED; - } else if (!message || strlen(message) == 0) { - *error = g_strdup(_("Whisper is missing message.")); - return PURPLE_CMD_RET_FAILED; - } - - from_username = conv->account->username; - purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n", - from_username, to_username, conv->name, message); - - chat = purple_conversation_get_chat_data(conv); - chat_buddy = purple_conv_chat_cb_find(chat, to_username); - to = get_nullprpl_gc(to_username); - - if (!chat_buddy) { - /* this will be freed by the caller */ - *error = g_strdup_printf(_("%s is not logged in."), to_username); - return PURPLE_CMD_RET_FAILED; - } else if (!to) { - *error = g_strdup_printf(_("%s is not in this chat room."), to_username); - return PURPLE_CMD_RET_FAILED; - } else { - /* write the whisper in the sender's chat window */ - char *message_to = g_strdup_printf("%s (to %s)", message, to_username); - purple_conv_chat_write(chat, from_username, message_to, - PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_WHISPER, - time(NULL)); - g_free(message_to); - - /* send the whisper */ - serv_chat_whisper(to, chat->id, from_username, message); - - return PURPLE_CMD_RET_OK; - } -} - -static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, - const char *message) { - const char *username = gc->account->username; - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("nullprpl", - "%s receives whisper from %s in chat room %s: %s\n", - username, who, conv->name, message); - - /* receive whisper on recipient's account */ - serv_got_chat_in(gc, id, who, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_WHISPER, - message, time(NULL)); -} - -static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - const char *message = (const char *)userdata; - PurpleConnection *to_gc = get_nullprpl_gc(to->nick); - - purple_debug_info("nullprpl", - "%s receives message from %s in chat room %s: %s\n", - to->nick, from->nick, room, message); - serv_got_chat_in(to_gc, id, from->nick, PURPLE_MESSAGE_RECV, message, - time(NULL)); -} - -static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, - PurpleMessageFlags flags) { - const char *username = gc->account->username; - PurpleConversation *conv = purple_find_chat(gc, id); - - if (conv) { - purple_debug_info("nullprpl", - "%s is sending message to chat room %s: %s\n", username, - conv->name, message); - - /* send message to everyone in the chat room */ - foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); - return 0; - } else { - purple_debug_info("nullprpl", - "tried to send message from %s to chat room #%d: %s\n" - "but couldn't find chat room", - username, id, message); - return -1; - } -} - -static void nullprpl_register_user(PurpleAccount *acct) { - purple_debug_info("nullprpl", "registering account for %s\n", - acct->username); -} - -static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("nullprpl", - "retrieving %s's info for %s in chat room %s\n", who, - gc->account->username, conv->name); - - nullprpl_get_info(gc, who); -} - -static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, - const char *alias) { - purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", - gc->account->username, who, alias); -} - -static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, - const char *old_group, - const char *new_group) { - purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", - gc->account->username, who, old_group, new_group); -} - -static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) { - purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", - gc->account->username, old_name, group->name); -} - -static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { - purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", - gc->account->username, who); -} - -/* normalize a username (e.g. remove whitespace, add default domain, etc.) - * for nullprpl, this is a noop. - */ -static const char *nullprpl_normalize(const PurpleAccount *acct, - const char *input) { - return NULL; -} - -static void nullprpl_set_buddy_icon(PurpleConnection *gc, - PurpleStoredImage *img) { - purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", - gc->account->username, - img ? purple_imgstore_get_filename(img) : "(null)"); -} - -static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { - purple_debug_info("nullprpl", "%s has removed group %s\n", - gc->account->username, group->name); -} - - -static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - const char *topic = (const char *)userdata; - const char *username = from->conv->account->username; - char *msg; - - purple_conv_chat_set_topic(to, username, topic); - - if (topic && strlen(topic) > 0) - msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); - else - msg = g_strdup_printf(_("%s clears topic"), username); - - purple_conv_chat_write(to, username, msg, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, - time(NULL)); - g_free(msg); -} - -static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, - const char *topic) { - PurpleConversation *conv = purple_find_chat(gc, id); - PurpleConvChat *chat = purple_conversation_get_chat_data(conv); - const char *last_topic; - - if (!chat) - return; - - purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", - gc->account->username, conv->name, topic); - - last_topic = purple_conv_chat_get_topic(chat); - if ((!topic && !last_topic) || - (topic && last_topic && !strcmp(topic, last_topic))) - return; /* topic is unchanged, this is a noop */ - - foreach_gc_in_chat(set_chat_topic_fn, gc, id, (gpointer)topic); -} - -static gboolean nullprpl_finish_get_roomlist(gpointer roomlist) { - purple_roomlist_set_in_progress((PurpleRoomlist *)roomlist, FALSE); - return FALSE; -} - -static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { - const char *username = gc->account->username; - PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); - GList *fields = NULL; - PurpleRoomlistField *field; - GList *chats; - GList *seen_ids = NULL; - - purple_debug_info("nullprpl", "%s asks for room list; returning:\n", username); - - /* set up the room list */ - field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "room", - "room", TRUE /* hidden */); - fields = g_list_append(fields, field); - - field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, "Id", "Id", FALSE); - fields = g_list_append(fields, field); - - purple_roomlist_set_fields(roomlist, fields); - - /* add each chat room. the chat ids are cached in seen_ids so that each room - * is only returned once, even if multiple users are in it. */ - for (chats = purple_get_chats(); chats; chats = g_list_next(chats)) { - PurpleConversation *conv = (PurpleConversation *)chats->data; - PurpleRoomlistRoom *room; - const char *name = conv->name; - int id = purple_conversation_get_chat_data(conv)->id; - - /* have we already added this room? */ - if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp)) - continue; /* yes! try the next one. */ - - /* This cast is OK because this list is only staying around for the life - * of this function and none of the conversations are being deleted - * in that timespan. */ - seen_ids = g_list_prepend(seen_ids, (char *)name); /* no, it's new. */ - purple_debug_info("nullprpl", "%s (%d), ", name, id); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(roomlist, room, name); - purple_roomlist_room_add_field(roomlist, room, &id); - purple_roomlist_room_add(roomlist, room); - } - - g_list_free(seen_ids); - purple_timeout_add(1 /* ms */, nullprpl_finish_get_roomlist, roomlist); - return roomlist; -} - -static void nullprpl_roomlist_cancel(PurpleRoomlist *list) { - purple_debug_info("nullprpl", "%s asked to cancel room list request\n", - list->account->username); -} - -static void nullprpl_roomlist_expand_category(PurpleRoomlist *list, - PurpleRoomlistRoom *category) { - purple_debug_info("nullprpl", "%s asked to expand room list category %s\n", - list->account->username, category->name); -} - -/* nullprpl doesn't support file transfer...yet... */ -static gboolean nullprpl_can_receive_file(PurpleConnection *gc, - const char *who) { - return FALSE; -} - -static gboolean nullprpl_offline_message(const PurpleBuddy *buddy) { - purple_debug_info("nullprpl", - "reporting that offline messages are supported for %s\n", - buddy->name); - return TRUE; -} - - -/* - * prpl stuff. see prpl.h for more information. - */ - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_NO_PASSWORD | OPT_PROTO_CHAT_TOPIC, /* options */ - NULL, /* user_splits, initialized in nullprpl_init() */ - NULL, /* protocol_options, initialized in nullprpl_init() */ - { /* icon_spec, a PurpleBuddyIconSpec */ - "png,jpg,gif", /* format */ - 0, /* min_width */ - 0, /* min_height */ - 128, /* max_width */ - 128, /* max_height */ - 10000, /* max_filesize */ - PURPLE_ICON_SCALE_DISPLAY, /* scale_rules */ - }, - nullprpl_list_icon, /* list_icon */ - NULL, /* list_emblem */ - nullprpl_status_text, /* status_text */ - nullprpl_tooltip_text, /* tooltip_text */ - nullprpl_status_types, /* status_types */ - nullprpl_blist_node_menu, /* blist_node_menu */ - nullprpl_chat_info, /* chat_info */ - nullprpl_chat_info_defaults, /* chat_info_defaults */ - nullprpl_login, /* login */ - nullprpl_close, /* close */ - nullprpl_send_im, /* send_im */ - nullprpl_set_info, /* set_info */ - nullprpl_send_typing, /* send_typing */ - nullprpl_get_info, /* get_info */ - nullprpl_set_status, /* set_status */ - nullprpl_set_idle, /* set_idle */ - nullprpl_change_passwd, /* change_passwd */ - nullprpl_add_buddy, /* add_buddy */ - nullprpl_add_buddies, /* add_buddies */ - nullprpl_remove_buddy, /* remove_buddy */ - nullprpl_remove_buddies, /* remove_buddies */ - nullprpl_add_permit, /* add_permit */ - nullprpl_add_deny, /* add_deny */ - nullprpl_rem_permit, /* rem_permit */ - nullprpl_rem_deny, /* rem_deny */ - nullprpl_set_permit_deny, /* set_permit_deny */ - nullprpl_join_chat, /* join_chat */ - nullprpl_reject_chat, /* reject_chat */ - nullprpl_get_chat_name, /* get_chat_name */ - nullprpl_chat_invite, /* chat_invite */ - nullprpl_chat_leave, /* chat_leave */ - nullprpl_chat_whisper, /* chat_whisper */ - nullprpl_chat_send, /* chat_send */ - NULL, /* keepalive */ - nullprpl_register_user, /* register_user */ - nullprpl_get_cb_info, /* get_cb_info */ - NULL, /* get_cb_away */ - nullprpl_alias_buddy, /* alias_buddy */ - nullprpl_group_buddy, /* group_buddy */ - nullprpl_rename_group, /* rename_group */ - NULL, /* buddy_free */ - nullprpl_convo_closed, /* convo_closed */ - nullprpl_normalize, /* normalize */ - nullprpl_set_buddy_icon, /* set_buddy_icon */ - nullprpl_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - nullprpl_set_chat_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - nullprpl_roomlist_get_list, /* roomlist_get_list */ - nullprpl_roomlist_cancel, /* roomlist_cancel */ - nullprpl_roomlist_expand_category, /* roomlist_expand_category */ - nullprpl_can_receive_file, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - nullprpl_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static void nullprpl_init(PurplePlugin *plugin) -{ - /* see accountopt.h for information about user splits and protocol options */ - PurpleAccountUserSplit *split = purple_account_user_split_new( - _("Example user split"), /* text shown to user */ - "default", /* default value */ - '@'); /* field separator */ - PurpleAccountOption *option = purple_account_option_string_new( - _("Example option"), /* text shown to user */ - "example", /* pref name */ - "default"); /* default value */ - - purple_debug_info("nullprpl", "starting up\n"); - - prpl_info.user_splits = g_list_append(NULL, split); - prpl_info.protocol_options = g_list_append(NULL, option); - - /* register whisper chat command, /msg */ - purple_cmd_register("msg", - "ws", /* args: recipient and message */ - PURPLE_CMD_P_DEFAULT, /* priority */ - PURPLE_CMD_FLAG_CHAT, - "prpl-null", - send_whisper, - "msg <username> <message>: send a private message, aka a whisper", - NULL); /* userdata */ - - /* get ready to store offline messages */ - goffline_messages = g_hash_table_new_full(g_str_hash, /* hash fn */ - g_str_equal, /* key comparison fn */ - g_free, /* key free fn */ - NULL); /* value free fn */ - - _null_protocol = plugin; -} - -static void nullprpl_destroy(PurplePlugin *plugin) { - purple_debug_info("nullprpl", "shutting down\n"); -} - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /* magic */ - PURPLE_MAJOR_VERSION, /* major_version */ - PURPLE_MINOR_VERSION, /* minor_version */ - PURPLE_PLUGIN_PROTOCOL, /* type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - NULLPRPL_ID, /* id */ - "Null - Testing Plugin", /* name */ - DISPLAY_VERSION, /* version */ - N_("Null Protocol Plugin"), /* summary */ - N_("Null Protocol Plugin"), /* description */ - NULL, /* author */ - PURPLE_WEBSITE, /* homepage */ - NULL, /* load */ - NULL, /* unload */ - nullprpl_destroy, /* destroy */ - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - nullprpl_actions, /* actions */ - NULL, /* padding... */ - NULL, - NULL, - NULL, -}; - -PURPLE_INIT_PLUGIN(null, nullprpl_init, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/null/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -nullprpl - --------- -OVERVIEW --------- -Nullprpl is a mock protocol plugin for Pidgin and libpurple. You can create -accounts with it, sign on and off, add buddies, and send and receive IMs, all -without connecting to a server! - -Beyond that basic functionality, nullprpl supports presence and away/available -messages, offline messages, user info, typing notification, privacy -allow/block lists, chat rooms, whispering, room lists, and protocol icons and -emblems. Notable missing features are file transfer and account registration -and authentication. - -Nullprpl is intended as an example of how to write a libpurple protocol -plugin. It doesn't contain networking code or an event loop, but it does -demonstrate how to use the libpurple API to do pretty much everything a prpl -might need to do. - -Nullprpl is also a useful tool for hacking on Pidgin, Finch, and other -libpurple clients. It's a full-featured protocol plugin, but doesn't depend on -an external server, so it's a quick and easy way to exercise test new code. It -also allows you to work while you're disconnected. - ------------------------ -BUILDING AND INSTALLING ------------------------ - -To build, just run ./configure as usual in the root directory of the pidgin -source distribution. Then cd libpurple/protocols/null and then make. To -install, run make install. Then run Pidgin. - -To build nullprpl on Windows (with Cygwin/MinGW), use: make -f Makefile.mingw - ------ -USAGE ------ -To add a nullprpl account, go to the account editor window and click Add. -Select Nullprpl from the protocol drop-down list, and enter any username you -want. - -Now, use Pidgin like normal. You can add buddies, send IMs, set away messages, -etc. If you send IMs to your own username, they will be echoed back to you. - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/AUTHORS qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/AUTHORS --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/AUTHORS 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/AUTHORS 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ - -N: ComBOTS Product GmbH (htfv) -T: 2007 -E: foss@combots.com - -N: Jonathan Clark -T: 2005-2006 -E: ardentlygnarley a.t users d.o.t sourceforge d.o.t net - -N: Mark Doliner -T: 2001-2006 -H: markdoliner -E: thekingant a.t users d.o.t sourceforge d.o.t net -W: http://kingant.net/ - -N: Adam Fritzler -T: 1998-2001 -H: mid -E: mid a.t auk d.o.t cx -W: http://www.auk.cx/~mid,http://www.auk.cx/faim -D: Wrote most of the wap of crap that you see before you. - -N: Josh Myer -T: 1998-2001 -E: josh a.t joshisanerd d.o.t com -D: OFT/ODC (not quite finished yet..), random little things, Munger-At-Large, compile-time warnings. - -N: Daniel M. Pomerantz -H: dmprantz -D: Made initial versions cross platform - -N: Daniel Reed -T: 1998-2001 -H: n, linuxkitty -E: n a.t ml d.o.t org -W: http://users.n.ml.org/n/ -D: Fixed aim_snac.c - -N: Eric Warmenhoven -T: 1998-2001 -E: warmenhoven a.t linux d.o.t com -D: Some OFT info, initial author of the libpurple-side of the oscar protocol plugin - -N: Brock Wilcox -T: 1998-2001 -H: awwaiid -E: awwaiid a.t auk d.o.t cx -D: Figured out original password roasting - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/bstream.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/bstream.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/bstream.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/bstream.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,351 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * This file contains all functions needed to use bstreams. - */ - -#include "oscar.h" - -int byte_stream_new(ByteStream *bs, guint32 len) -{ - if (bs == NULL) - return -1; - - return byte_stream_init(bs, g_malloc(len), len); -} - -int byte_stream_init(ByteStream *bs, guint8 *data, int len) -{ - - if (bs == NULL) - return -1; - - bs->data = data; - bs->len = len; - bs->offset = 0; - - return 0; -} - -void byte_stream_destroy(ByteStream *bs) -{ - g_free(bs->data); -} - -int byte_stream_empty(ByteStream *bs) -{ - return bs->len - bs->offset; -} - -int byte_stream_curpos(ByteStream *bs) -{ - return bs->offset; -} - -int byte_stream_setpos(ByteStream *bs, unsigned int off) -{ - - if (off > bs->len) - return -1; - - bs->offset = off; - - return off; -} - -void byte_stream_rewind(ByteStream *bs) -{ - - byte_stream_setpos(bs, 0); - - return; -} - -/* - * N can be negative, which can be used for going backwards - * in a bstream. I'm not sure if libfaim actually does - * this anywhere... - */ -int byte_stream_advance(ByteStream *bs, int n) -{ - - if ((byte_stream_curpos(bs) + n < 0) || (byte_stream_empty(bs) < n)) - return 0; /* XXX throw an exception */ - - bs->offset += n; - - return n; -} - -guint8 byte_stream_get8(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset++; - - return aimutil_get8(bs->data + bs->offset - 1); -} - -guint16 byte_stream_get16(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += 2; - - return aimutil_get16(bs->data + bs->offset - 2); -} - -guint32 byte_stream_get32(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += 4; - - return aimutil_get32(bs->data + bs->offset - 4); -} - -guint8 byte_stream_getle8(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset++; - - return aimutil_getle8(bs->data + bs->offset - 1); -} - -guint16 byte_stream_getle16(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += 2; - - return aimutil_getle16(bs->data + bs->offset - 2); -} - -guint32 byte_stream_getle32(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += 4; - - return aimutil_getle32(bs->data + bs->offset - 4); -} - -static void byte_stream_getrawbuf_nocheck(ByteStream *bs, guint8 *buf, int len) -{ - memcpy(buf, bs->data + bs->offset, len); - bs->offset += len; -} - -int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len) -{ - - if (byte_stream_empty(bs) < len) - return 0; - - byte_stream_getrawbuf_nocheck(bs, buf, len); - return len; -} - -guint8 *byte_stream_getraw(ByteStream *bs, int len) -{ - guint8 *ob; - - if (byte_stream_empty(bs) < len) - return NULL; - - ob = g_malloc(len); - - byte_stream_getrawbuf_nocheck(bs, ob, len); - - return ob; -} - -char *byte_stream_getstr(ByteStream *bs, int len) -{ - char *ob; - - if (byte_stream_empty(bs) < len) - return NULL; - - ob = g_malloc(len + 1); - - byte_stream_getrawbuf_nocheck(bs, (guint8 *)ob, len); - - ob[len] = '\0'; - - return ob; -} - -int byte_stream_put8(ByteStream *bs, guint8 v) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_put8(bs->data + bs->offset, v); - - return 1; -} - -int byte_stream_put16(ByteStream *bs, guint16 v) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_put16(bs->data + bs->offset, v); - - return 2; -} - -int byte_stream_put32(ByteStream *bs, guint32 v) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_put32(bs->data + bs->offset, v); - - return 1; -} - -int byte_stream_putle8(ByteStream *bs, guint8 v) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_putle8(bs->data + bs->offset, v); - - return 1; -} - -int byte_stream_putle16(ByteStream *bs, guint16 v) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_putle16(bs->data + bs->offset, v); - - return 2; -} - -int byte_stream_putle32(ByteStream *bs, guint32 v) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_putle32(bs->data + bs->offset, v); - - return 1; -} - - -int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len) -{ - - if (byte_stream_empty(bs) < len) - return 0; /* XXX throw an exception */ - - memcpy(bs->data + bs->offset, v, len); - bs->offset += len; - - return len; -} - -int byte_stream_putstr(ByteStream *bs, const char *str) -{ - return byte_stream_putraw(bs, (guint8 *)str, strlen(str)); -} - -int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len) -{ - - if (byte_stream_empty(srcbs) < len) - return 0; /* XXX throw exception (underrun) */ - - if (byte_stream_empty(bs) < len) - return 0; /* XXX throw exception (overflow) */ - - memcpy(bs->data + bs->offset, srcbs->data + srcbs->offset, len); - bs->offset += len; - srcbs->offset += len; - - return len; -} - -int byte_stream_putuid(ByteStream *bs, OscarData *od) -{ - PurpleAccount *account; - - account = purple_connection_get_account(od->gc); - - return byte_stream_putle32(bs, atoi(purple_account_get_username(account))); -} - -void byte_stream_put_bart_asset(ByteStream *bs, guint16 type, ByteStream *data) -{ - byte_stream_put16(bs, type); - - if (data != NULL && data->len > 0) { - /* Flags. 0x04 means "this asset has data attached to it" */ - byte_stream_put8(bs, 0x04); /* Flags */ - byte_stream_put8(bs, data->len); /* Length */ - byte_stream_rewind(data); - byte_stream_putbs(bs, data, data->len); /* Data */ - } else { - byte_stream_put8(bs, 0x00); /* No flags */ - byte_stream_put8(bs, 0x00); /* Length */ - /* No data */ - } -} - -void byte_stream_put_bart_asset_str(ByteStream *bs, guint16 type, const char *datastr) -{ - ByteStream data; - size_t len = datastr != NULL ? strlen(datastr) : 0; - - if (len > 0) { - byte_stream_new(&data, 2 + len + 2); - byte_stream_put16(&data, len); /* Length */ - byte_stream_putstr(&data, datastr); /* String */ - byte_stream_put16(&data, 0x0000); /* Unknown */ - byte_stream_put_bart_asset(bs, type, &data); - byte_stream_destroy(&data); - } else { - byte_stream_put_bart_asset(bs, type, NULL); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/clientlogin.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/clientlogin.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/clientlogin.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/clientlogin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,548 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/** - * This file implements AIM's clientLogin procedure for authenticating - * users. This replaces the older MD5-based and XOR-based - * authentication methods that use SNAC family 0x0017. - * - * This doesn't use SNACs or FLAPs at all. It makes http and https - * POSTs to AOL to validate the user based on the password they - * provided to us. Upon successful authentication we request a - * connection to the BOS server by calling startOSCARsession. The - * AOL server gives us the hostname and port number to use, as well - * as the cookie to use to authenticate to the BOS server. And then - * everything else is the same as with BUCP. - * - * For details, see: - * http://dev.aol.com/aim/oscar/#AUTH - * http://dev.aol.com/authentication_for_clients - */ - -#include "cipher.h" -#include "core.h" - -#include "oscar.h" -#include "oscarcommon.h" - -#define URL_CLIENT_LOGIN "https://api.screenname.aol.com/auth/clientLogin" -#define URL_START_OSCAR_SESSION "http://api.oscar.aol.com/aim/startOSCARSession" - -/* - * Using clientLogin requires a developer ID. This key is for libpurple. - * It is the default key for all libpurple-based clients. AOL encourages - * UIs (especially ones with lots of users) to override this with their - * own key. This key is owned by the AIM account "markdoliner" - * - * Keys can be managed at http://developer.aim.com/manageKeys.jsp - */ -#define DEFAULT_CLIENT_KEY "ma15d7JTxbmVG-RP" - -static const char *get_client_key(OscarData *od) -{ - return oscar_get_ui_info_string( - od->icq ? "prpl-icq-clientkey" : "prpl-aim-clientkey", - DEFAULT_CLIENT_KEY); -} - -/** - * @return A null-terminated base64 encoded version of the HMAC - * calculated using the given key and data. - */ -static gchar *hmac_sha256(const char *key, const char *message) -{ - PurpleCipherContext *context; - guchar digest[32]; - - context = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(context, "hash", "sha256"); - purple_cipher_context_set_key(context, (guchar *)key); - purple_cipher_context_append(context, (guchar *)message, strlen(message)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - return purple_base64_encode(digest, sizeof(digest)); -} - -/** - * @return A base-64 encoded HMAC-SHA256 signature created using the - * technique documented at - * http://dev.aol.com/authentication_for_clients#signing - */ -static gchar *generate_signature(const char *method, const char *url, const char *parameters, const char *session_key) -{ - char *encoded_url, *signature_base_string, *signature; - const char *encoded_parameters; - - encoded_url = g_strdup(purple_url_encode(url)); - encoded_parameters = purple_url_encode(parameters); - signature_base_string = g_strdup_printf("%s&%s&%s", - method, encoded_url, encoded_parameters); - g_free(encoded_url); - - signature = hmac_sha256(session_key, signature_base_string); - g_free(signature_base_string); - - return signature; -} - -static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const gchar *response, gsize response_len, char **host, unsigned short *port, char **cookie, char **tls_certname) -{ - xmlnode *response_node, *tmp_node, *data_node; - xmlnode *host_node = NULL, *port_node = NULL, *cookie_node = NULL, *tls_node = NULL; - gboolean use_tls; - char *tmp; - guint code; - - use_tls = purple_account_get_bool(purple_connection_get_account(gc), "use_ssl", OSCAR_DEFAULT_USE_SSL); - - /* Parse the response as XML */ - response_node = xmlnode_from_str(response, response_len); - if (response_node == NULL) - { - char *msg; - purple_debug_error("oscar", "startOSCARSession could not parse " - "response as XML: %s\n", response); - /* Note to translators: %s in this string is a URL */ - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - return FALSE; - } - - /* Grab the necessary XML nodes */ - tmp_node = xmlnode_get_child(response_node, "statusCode"); - data_node = xmlnode_get_child(response_node, "data"); - if (data_node != NULL) { - host_node = xmlnode_get_child(data_node, "host"); - port_node = xmlnode_get_child(data_node, "port"); - cookie_node = xmlnode_get_child(data_node, "cookie"); - tls_node = xmlnode_get_child(data_node, "tlsCertName"); - } - - /* Make sure we have a status code */ - if (tmp_node == NULL || (tmp = xmlnode_get_data_unescaped(tmp_node)) == NULL) { - char *msg; - purple_debug_error("oscar", "startOSCARSession response was " - "missing statusCode: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Make sure the status code was 200 */ - code = atoi(tmp); - if (code != 200) - { - purple_debug_error("oscar", "startOSCARSession response statusCode " - "was %s: %s\n", tmp, response); - - if (code == 401 || code == 607) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("You have been connecting and disconnecting too " - "frequently. Wait ten minutes and try again. If " - "you continue to try, you will need to wait even " - "longer.")); - else { - char *msg; - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); - g_free(msg); - } - - g_free(tmp); - xmlnode_free(response_node); - return FALSE; - } - g_free(tmp); - - /* Make sure we have everything else */ - if (data_node == NULL || host_node == NULL || - port_node == NULL || cookie_node == NULL || - (use_tls && tls_node == NULL)) - { - char *msg; - purple_debug_error("oscar", "startOSCARSession response was missing " - "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Extract data from the XML */ - *host = xmlnode_get_data_unescaped(host_node); - tmp = xmlnode_get_data_unescaped(port_node); - *cookie = xmlnode_get_data_unescaped(cookie_node); - - if (use_tls) - *tls_certname = xmlnode_get_data_unescaped(tls_node); - - if (*host == NULL || **host == '\0' || tmp == NULL || *tmp == '\0' || *cookie == NULL || **cookie == '\0' || - (use_tls && (*tls_certname == NULL || **tls_certname == '\0'))) - { - char *msg; - purple_debug_error("oscar", "startOSCARSession response was missing " - "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - g_free(*host); - g_free(tmp); - g_free(*cookie); - xmlnode_free(response_node); - return FALSE; - } - - *port = atoi(tmp); - g_free(tmp); - - return TRUE; -} - -static void start_oscar_session_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - OscarData *od; - PurpleConnection *gc; - char *host, *cookie; - char *tls_certname = NULL; - unsigned short port; - guint8 *cookiedata; - gsize cookiedata_len; - - od = user_data; - gc = od->gc; - - od->url_data = NULL; - - if (error_message != NULL || len == 0) { - gchar *tmp; - /* Note to translators: The first %s is a URL, the second is an - error message. */ - tmp = g_strdup_printf(_("Error requesting %s: %s"), - URL_START_OSCAR_SESSION, error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (!parse_start_oscar_session_response(gc, url_text, len, &host, &port, &cookie, &tls_certname)) - return; - - cookiedata = purple_base64_decode(cookie, &cookiedata_len); - oscar_connect_to_bos(gc, od, host, port, cookiedata, cookiedata_len, tls_certname); - g_free(cookiedata); - - g_free(host); - g_free(cookie); - g_free(tls_certname); -} - -static void send_start_oscar_session(OscarData *od, const char *token, const char *session_key, time_t hosttime) -{ - char *query_string, *signature, *url; - gboolean use_tls = purple_account_get_bool(purple_connection_get_account(od->gc), "use_ssl", OSCAR_DEFAULT_USE_SSL); - - /* Construct the GET parameters */ - query_string = g_strdup_printf("a=%s" - "&f=xml" - "&k=%s" - "&ts=%" PURPLE_TIME_T_MODIFIER - "&useTLS=%d", - purple_url_encode(token), get_client_key(od), hosttime, use_tls); - signature = generate_signature("GET", URL_START_OSCAR_SESSION, - query_string, session_key); - url = g_strdup_printf(URL_START_OSCAR_SESSION "?%s&sig_sha256=%s", - query_string, signature); - g_free(query_string); - g_free(signature); - - /* Make the request */ - od->url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, - start_oscar_session_cb, od); - g_free(url); -} - -/** - * This function parses the given response from a clientLogin request - * and extracts the useful information. - * - * @param gc The PurpleConnection. If the response data does - * not indicate then purple_connection_error_reason() - * will be called to close this connection. - * @param response The response data from the clientLogin request. - * @param response_len The length of the above response, or -1 if - * @response is NUL terminated. - * @param token If parsing was successful then this will be set to - * a newly allocated string containing the token. The - * caller should g_free this string when it is finished - * with it. On failure this value will be untouched. - * @param secret If parsing was successful then this will be set to - * a newly allocated string containing the secret. The - * caller should g_free this string when it is finished - * with it. On failure this value will be untouched. - * @param hosttime If parsing was successful then this will be set to - * the time on the OpenAuth Server in seconds since the - * Unix epoch. On failure this value will be untouched. - * - * @return TRUE if the request was successful and we were able to - * extract all info we need. Otherwise FALSE. - */ -static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *response, gsize response_len, char **token, char **secret, time_t *hosttime) -{ - xmlnode *response_node, *tmp_node, *data_node; - xmlnode *secret_node = NULL, *hosttime_node = NULL, *token_node = NULL, *tokena_node = NULL; - char *tmp; - - /* Parse the response as XML */ - response_node = xmlnode_from_str(response, response_len); - if (response_node == NULL) - { - char *msg; - purple_debug_error("oscar", "clientLogin could not parse " - "response as XML: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - return FALSE; - } - - /* Grab the necessary XML nodes */ - tmp_node = xmlnode_get_child(response_node, "statusCode"); - data_node = xmlnode_get_child(response_node, "data"); - if (data_node != NULL) { - secret_node = xmlnode_get_child(data_node, "sessionSecret"); - hosttime_node = xmlnode_get_child(data_node, "hostTime"); - token_node = xmlnode_get_child(data_node, "token"); - if (token_node != NULL) - tokena_node = xmlnode_get_child(token_node, "a"); - } - - /* Make sure we have a status code */ - if (tmp_node == NULL || (tmp = xmlnode_get_data_unescaped(tmp_node)) == NULL) { - char *msg; - purple_debug_error("oscar", "clientLogin response was " - "missing statusCode: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Make sure the status code was 200 */ - if (strcmp(tmp, "200") != 0) - { - int status_code, status_detail_code = 0; - - status_code = atoi(tmp); - g_free(tmp); - tmp_node = xmlnode_get_child(response_node, "statusDetailCode"); - if (tmp_node != NULL && (tmp = xmlnode_get_data_unescaped(tmp_node)) != NULL) { - status_detail_code = atoi(tmp); - g_free(tmp); - } - - purple_debug_error("oscar", "clientLogin response statusCode " - "was %d (%d): %s\n", status_code, status_detail_code, response); - - if (status_code == 330 && status_detail_code == 3011) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Incorrect password")); - } else if (status_code == 401 && status_detail_code == 3019) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("AOL does not allow your screen name to authenticate here")); - } else { - char *msg; - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); - g_free(msg); - } - - xmlnode_free(response_node); - return FALSE; - } - g_free(tmp); - - /* Make sure we have everything else */ - if (data_node == NULL || secret_node == NULL || - token_node == NULL || tokena_node == NULL) - { - char *msg; - purple_debug_error("oscar", "clientLogin response was missing " - "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Extract data from the XML */ - *token = xmlnode_get_data_unescaped(tokena_node); - *secret = xmlnode_get_data_unescaped(secret_node); - tmp = xmlnode_get_data_unescaped(hosttime_node); - if (*token == NULL || **token == '\0' || *secret == NULL || **secret == '\0' || tmp == NULL || *tmp == '\0') - { - char *msg; - purple_debug_error("oscar", "clientLogin response was missing " - "something: %s\n", response); - msg = g_strdup_printf(_("Received unexpected response from %s"), - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - g_free(*token); - g_free(*secret); - g_free(tmp); - xmlnode_free(response_node); - return FALSE; - } - - *hosttime = strtol(tmp, NULL, 10); - g_free(tmp); - - xmlnode_free(response_node); - - return TRUE; -} - -static void client_login_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - OscarData *od; - PurpleConnection *gc; - char *token, *secret, *session_key; - time_t hosttime; - int password_len; - char *password; - - od = user_data; - gc = od->gc; - - od->url_data = NULL; - - if (error_message != NULL || len == 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Error requesting %s: %s"), - URL_CLIENT_LOGIN, error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (!parse_client_login_response(gc, url_text, len, &token, &secret, &hosttime)) - return; - - password_len = strlen(purple_connection_get_password(gc)); - password = g_strdup_printf("%.*s", - od->icq ? MIN(password_len, MAXICQPASSLEN) : password_len, - purple_connection_get_password(gc)); - session_key = hmac_sha256(password, secret); - g_free(password); - g_free(secret); - - send_start_oscar_session(od, token, session_key, hosttime); - - g_free(token); - g_free(session_key); -} - -/** - * This function sends a request to - * https://api.screenname.aol.com/auth/clientLogin with the user's - * username and password and receives the user's session key, which is - * used to request a connection to the BOSS server. - */ -void send_client_login(OscarData *od, const char *username) -{ - PurpleConnection *gc; - GString *request, *body; - const char *tmp; - char *password; - int password_len; - - gc = od->gc; - - /* - * We truncate ICQ passwords to 8 characters. There is probably a - * limit for AIM passwords, too, but we really only need to do - * this for ICQ because older ICQ clients let you enter a password - * as long as you wanted and then they truncated it silently. - * - * And we can truncate based on the number of bytes and not the - * number of characters because passwords for AIM and ICQ are - * supposed to be plain ASCII (I don't know if this has always been - * the case, though). - */ - tmp = purple_connection_get_password(gc); - password_len = strlen(tmp); - password = g_strndup(tmp, od->icq ? MIN(password_len, MAXICQPASSLEN) : password_len); - - /* Construct the body of the HTTP POST request */ - body = g_string_new(""); - g_string_append_printf(body, "devId=%s", get_client_key(od)); - g_string_append_printf(body, "&f=xml"); - g_string_append_printf(body, "&pwd=%s", purple_url_encode(password)); - g_string_append_printf(body, "&s=%s", purple_url_encode(username)); - g_free(password); - - /* Construct an HTTP POST request */ - request = g_string_new("POST /auth/clientLogin HTTP/1.0\r\n" - "Connection: close\r\n" - "Accept: */*\r\n"); - - /* Tack on the body */ - g_string_append_printf(request, "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n"); - g_string_append_printf(request, "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n", body->len); - g_string_append_len(request, body->str, body->len); - g_string_free(body, TRUE); - - /* Send the POST request */ - od->url_data = purple_util_fetch_url_request(URL_CLIENT_LOGIN, - TRUE, NULL, FALSE, request->str, FALSE, - client_login_cb, od); - g_string_free(request, TRUE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/COPYING qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/COPYING --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/COPYING 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_admin.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_admin.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_admin.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_admin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0007 - Account Administration. - * - * Used for stuff like changing the formating of your username, changing your - * email address, requesting an account confirmation email, getting account info, - */ - -#include "oscar.h" - -/** - * Subtype 0x0002 - Request a bit of account info. - * - * Info should be one of the following: - * 0x0001 - Username formatting - * 0x0011 - Email address - * 0x0013 - Unknown - */ -void -aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info) -{ - ByteStream bs; - aim_snacid_t snacid; - - byte_stream_new(&bs, 4); - - byte_stream_put16(&bs, info); - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtypes 0x0003 and 0x0005 - Parse account info. - * - * Called in reply to both an information request (subtype 0x0002) and - * an information change (subtype 0x0004). - */ -static void -infochange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - char *url=NULL, *sn=NULL, *email=NULL; - guint16 perms, tlvcount, err=0; - - perms = byte_stream_get16(bs); - tlvcount = byte_stream_get16(bs); - - while (tlvcount && byte_stream_empty(bs)) { - guint16 type, length; - - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - - switch (type) { - case 0x0001: { - g_free(sn); - sn = byte_stream_getstr(bs, length); - } break; - - case 0x0004: { - g_free(url); - url = byte_stream_getstr(bs, length); - } break; - - case 0x0008: { - err = byte_stream_get16(bs); - } break; - - case 0x0011: { - g_free(email); - if (length == 0) - email = g_strdup("*suppressed"); - else - email = byte_stream_getstr(bs, length); - } break; - } - - tlvcount--; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - userfunc(od, conn, frame, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email); - - g_free(sn); - g_free(url); - g_free(email); -} - -/** - * Subtype 0x0004 - Set the formatting of username (change spaces and capitalization). - */ -void -aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - byte_stream_new(&bs, 2+2+strlen(newnick)); - - aim_tlvlist_add_str(&tlvlist, 0x0001, newnick); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0004 - Change password. - */ -void -aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw) -{ - ByteStream bs; - GSList *tlvlist = NULL; - aim_snacid_t snacid; - - byte_stream_new(&bs, 4+strlen(curpw)+4+strlen(newpw)); - - /* new password TLV t(0002) */ - aim_tlvlist_add_str(&tlvlist, 0x0002, newpw); - - /* current password TLV t(0012) */ - aim_tlvlist_add_str(&tlvlist, 0x0012, curpw); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0004 - Change email address. - */ -void -aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - byte_stream_new(&bs, 2+2+strlen(newemail)); - - aim_tlvlist_add_str(&tlvlist, 0x0011, newemail); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Subtype 0x0006 - Request account confirmation. - * - * This will cause an email to be sent to the address associated with - * the account. By following the instructions in the mail, you can - * get the TRIAL flag removed from your account. - * - */ -void -aim_admin_reqconfirm(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n(od, conn, SNAC_FAMILY_ADMIN, 0x0006); -} - -/** - * Subtype SNAC_FAMILY_ADMIN - Account confirmation request acknowledgement. - */ -static int -accountconfirm(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 status; - /* GSList *tlvlist; */ - - status = byte_stream_get16(bs); - /* Status is 0x0013 if unable to confirm at this time */ - - /* tlvlist = aim_tlvlist_read(bs); */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, status); - - /* aim_tlvlist_free(tlvlist); */ - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) { - infochange(od, conn, mod, frame, snac, bs); - return 1; - } else if (snac->subtype == SNAC_FAMILY_ADMIN) - return accountconfirm(od, conn, mod, frame, snac, bs); - - return 0; -} - -int admin_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ADMIN; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "admin", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_advert.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_advert.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_advert.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_advert.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0005 - Advertisements. - * - */ - -#include "oscar.h" - -void -aim_ads_requestads(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n(od, conn, SNAC_FAMILY_ADVERT, 0x0002); -} - -static int snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) -{ - return 0; -} - -int adverts_modfirst(OscarData *od, aim_module_t *mod) -{ - - mod->family = SNAC_FAMILY_ADVERT; - mod->version = 0x0001; - mod->toolid = 0x0001; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "advert", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_alert.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_alert.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_alert.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_alert.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0018 - Email notification - * - * Used for being alerted when the email address(es) associated with - * your username get new electronic-m. For normal AIM accounts, you - * get the email address username@netscape.net. AOL accounts have - * username@aol.com, and can also activate a netscape.net account. - * Note: This information might be out of date. - */ - -#include "oscar.h" - -/** - * Subtype 0x0006 - Request information about your email account - * - * @param od The oscar session. - * @param conn The email connection for this session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_email_sendcookies(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ALERT))) - return -EINVAL; - - byte_stream_new(&bs, 2+16+16); - - /* Number of cookies to follow */ - byte_stream_put16(&bs, 0x0002); - - /* Cookie */ - byte_stream_put16(&bs, 0x5d5e); - byte_stream_put16(&bs, 0x1708); - byte_stream_put16(&bs, 0x55aa); - byte_stream_put16(&bs, 0x11d3); - byte_stream_put16(&bs, 0xb143); - byte_stream_put16(&bs, 0x0060); - byte_stream_put16(&bs, 0xb0fb); - byte_stream_put16(&bs, 0x1ecb); - - /* Cookie */ - byte_stream_put16(&bs, 0xb380); - byte_stream_put16(&bs, 0x9ad8); - byte_stream_put16(&bs, 0x0dba); - byte_stream_put16(&bs, 0x11d5); - byte_stream_put16(&bs, 0x9f8a); - byte_stream_put16(&bs, 0x0060); - byte_stream_put16(&bs, 0xb0ee); - byte_stream_put16(&bs, 0x0631); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ALERT, 0x0006, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ALERT, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0007 - Receive information about your email account - * - * So I don't even know if you can have multiple 16 byte keys, - * but this is coded so it will handle that, and handle it well. - * This tells you if you have unread mail or not, the URL you - * should use to access that mail, and the domain name for the - * email account (username@domainname.com). If this is the - * first 0x0007 SNAC you've received since you signed on, or if - * this is just a periodic status update, this will also contain - * the number of unread emails that you have. - */ -static int -parseinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - struct aim_emailinfo *new; - GSList *tlvlist; - guint8 *cookie8, *cookie16; - int tmp, havenewmail = 0; /* Used to tell the client we have _new_ mail */ - - char *alertitle = NULL, *alerturl = NULL; - - cookie8 = byte_stream_getraw(bs, 8); /* Possibly the code used to log you in to mail? */ - cookie16 = byte_stream_getraw(bs, 16); /* Mail cookie sent above */ - - /* See if we already have some info associated with this cookie */ - for (new = od->emailinfo; (new && memcmp(cookie16, new->cookie16, 16)); new = new->next); - if (new) { - /* Free some of the old info, if it exists */ - g_free(new->cookie8); - g_free(new->cookie16); - g_free(new->url); - g_free(new->domain); - } else { - /* We don't already have info, so create a new struct for it */ - new = g_new0(struct aim_emailinfo, 1); - new->next = od->emailinfo; - od->emailinfo = new; - } - - new->cookie8 = cookie8; - new->cookie16 = cookie16; - - tlvlist = aim_tlvlist_readnum(bs, byte_stream_get16(bs)); - - tmp = aim_tlv_get16(tlvlist, 0x0080, 1); - if (tmp) { - if (new->nummsgs < tmp) - havenewmail = 1; - new->nummsgs = tmp; - } else { - /* If they don't send a 0x0080 TLV, it means we definitely have new mail */ - /* (ie. this is not just another status update) */ - havenewmail = 1; - new->nummsgs++; /* We know we have at least 1 new email */ - } - new->url = aim_tlv_getstr(tlvlist, 0x0007, 1); - if (!(new->unread = aim_tlv_get8(tlvlist, 0x0081, 1))) { - havenewmail = 0; - new->nummsgs = 0; - } - new->domain = aim_tlv_getstr(tlvlist, 0x0082, 1); - new->flag = aim_tlv_get16(tlvlist, 0x0084, 1); - - alertitle = aim_tlv_getstr(tlvlist, 0x0005, 1); - alerturl = aim_tlv_getstr(tlvlist, 0x000d, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, new, havenewmail, alertitle, (alerturl ? alerturl + 2 : NULL)); - - aim_tlvlist_free(tlvlist); - - g_free(alertitle); - g_free(alerturl); - - return ret; -} - -/** - * Subtype 0x0016 - Send something or other - * - * @param od The oscar session. - * @param conn The email connection for this session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_email_activate(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ALERT))) - return -EINVAL; - - byte_stream_new(&bs, 1+16); - - /* I would guess this tells AIM that you want updates for your mail accounts */ - /* ...but I really have no idea */ - byte_stream_put8(&bs, 0x02); - byte_stream_put32(&bs, 0x04000000); - byte_stream_put32(&bs, 0x04000000); - byte_stream_put32(&bs, 0x04000000); - byte_stream_put32(&bs, 0x00000000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ALERT, 0x0016, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ALERT, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0007) - return parseinfo(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -email_shutdown(OscarData *od, aim_module_t *mod) -{ - while (od->emailinfo) - { - struct aim_emailinfo *tmp = od->emailinfo; - od->emailinfo = od->emailinfo->next; - g_free(tmp->cookie16); - g_free(tmp->cookie8); - g_free(tmp->url); - g_free(tmp->domain); - g_free(tmp); - } - - return; -} - -int -email_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ALERT; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "alert", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = email_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_auth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_auth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_auth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_auth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,659 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0017 - Authentication. - * - * Deals with the authorizer for SNAC-based login, and also old-style - * non-SNAC login. - * - */ - -#include - -#include "cipher.h" - -#include "oscar.h" - -/* #define USE_XOR_FOR_ICQ */ - -#ifdef USE_XOR_FOR_ICQ -/** - * Encode a password using old XOR method - * - * This takes a const pointer to a (null terminated) string - * containing the unencoded password. It also gets passed - * an already allocated buffer to store the encoded password. - * This buffer should be the exact length of the password without - * the null. The encoded password buffer /is not %NULL terminated/. - * - * The encoding_table seems to be a fixed set of values. We'll - * hope it doesn't change over time! - * - * This is only used for the XOR method, not the better MD5 method. - * - * @param password Incoming password. - * @param encoded Buffer to put encoded password. - */ -static int -aim_encode_password(const char *password, guint8 *encoded) -{ - guint8 encoding_table[] = { -#if 0 /* old v1 table */ - 0xf3, 0xb3, 0x6c, 0x99, - 0x95, 0x3f, 0xac, 0xb6, - 0xc5, 0xfa, 0x6b, 0x63, - 0x69, 0x6c, 0xc3, 0x9f -#else /* v2.1 table, also works for ICQ */ - 0xf3, 0x26, 0x81, 0xc4, - 0x39, 0x86, 0xdb, 0x92, - 0x71, 0xa3, 0xb9, 0xe6, - 0x53, 0x7a, 0x95, 0x7c -#endif - }; - unsigned int i; - - for (i = 0; i < strlen(password); i++) - encoded[i] = (password[i] ^ encoding_table[i]); - - return 0; -} -#endif - -#ifdef USE_OLD_MD5 -static int -aim_encode_password_md5(const char *password, size_t password_len, const char *key, guint8 *digest) -{ - PurpleCipherContext *context; - - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, (const guchar *)key, strlen(key)); - purple_cipher_context_append(context, (const guchar *)password, password_len); - purple_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - return 0; -} -#else -static int -aim_encode_password_md5(const char *password, size_t password_len, const char *key, guint8 *digest) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar passdigest[16]; - - cipher = purple_ciphers_find_cipher("md5"); - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (const guchar *)password, password_len); - purple_cipher_context_digest(context, 16, passdigest, NULL); - purple_cipher_context_destroy(context); - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (const guchar *)key, strlen(key)); - purple_cipher_context_append(context, passdigest, 16); - purple_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - return 0; -} -#endif - -#ifdef USE_XOR_FOR_ICQ -/* - * Part two of the ICQ hack. Note the ignoring of the key. - */ -static int -goddamnicq2(OscarData *od, FlapConnection *conn, const char *sn, const char *password, ClientInfo *ci) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - int passwdlen; - guint8 *password_encoded; - guint32 distrib; - - passwdlen = strlen(password); - password_encoded = (guint8 *)g_malloc(passwdlen+1); - if (passwdlen > MAXICQPASSLEN) - passwdlen = MAXICQPASSLEN; - - frame = flap_frame_new(od, 0x01, 1152); - - aim_encode_password(password, password_encoded); - - distrib = oscar_get_ui_info_int( - od->icq ? "prpl-icq-distid" : "prpl-aim-distid", - ci->distrib); - - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_str(&tlvlist, 0x0001, sn); - aim_tlvlist_add_raw(&tlvlist, 0x0002, passwdlen, password_encoded); - - if (ci->clientstring != NULL) - aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); - else { - gchar *clientstring = oscar_get_clientstring(); - aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring); - g_free(clientstring); - } - aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid); - aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); - aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); - aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); - aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); - aim_tlvlist_add_32(&tlvlist, 0x0014, distrib); /* distribution chan */ - aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang); - aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country); - - aim_tlvlist_write(&frame->data, &tlvlist); - - g_free(password_encoded); - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); - - return 0; -} -#endif - -/* - * Subtype 0x0002 - * - * This is the initial login request packet. - * - * NOTE!! If you want/need to make use of the aim_sendmemblock() function, - * then the client information you send here must exactly match the - * executable that you're pulling the data from. - * - * Java AIM 1.1.19: - * clientstring = "AOL Instant Messenger (TM) version 1.1.19 for Java built 03/24/98, freeMem 215871 totalMem 1048567, i686, Linus, #2 SMP Sun Feb 11 03:41:17 UTC 2001 2.4.1-ac9, IBM Corporation, 1.1.8, 45.3, Tue Mar 27 12:09:17 PST 2001" - * clientid = 0x0001 - * major = 0x0001 - * minor = 0x0001 - * point = (not sent) - * build = 0x0013 - * unknown= (not sent) - * - * AIM for Linux 1.1.112: - * clientstring = "AOL Instant Messenger (SM)" - * clientid = 0x1d09 - * major = 0x0001 - * minor = 0x0001 - * point = 0x0001 - * build = 0x0070 - * unknown= 0x0000008b - * serverstore = 0x01 - * - * @param truncate_pass Truncate the password to 8 characters. This - * usually happens for AOL accounts. We are told that we - * should truncate it if the 0x0017/0x0007 SNAC contains - * a TLV of type 0x0026 with data 0x0000. - * @param allow_multiple_logins Allow multiple logins? If TRUE, the AIM - * server will prompt the user when multiple logins occur. If - * FALSE, existing connections (on other clients) will be - * disconnected automatically as we connect. - */ -int -aim_send_login(OscarData *od, FlapConnection *conn, const char *sn, const char *password, gboolean truncate_pass, ClientInfo *ci, const char *key, gboolean allow_multiple_logins) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - guint8 digest[16]; - aim_snacid_t snacid; - size_t password_len; - guint32 distrib; - - if (!ci || !sn || !password) - return -EINVAL; - -#ifdef USE_XOR_FOR_ICQ - /* If we're signing on an ICQ account then use the older, XOR login method */ - if (aim_snvalid_icq(sn)) - return goddamnicq2(od, conn, sn, password, ci); -#endif - - frame = flap_frame_new(od, 0x02, 1152); - - snacid = aim_cachesnac(od, SNAC_FAMILY_AUTH, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&frame->data, SNAC_FAMILY_AUTH, 0x0002, 0x0000, snacid); - - aim_tlvlist_add_str(&tlvlist, 0x0001, sn); - - /* Truncate ICQ and AOL passwords, if necessary */ - password_len = strlen(password); - if (oscar_util_valid_name_icq(sn) && (password_len > MAXICQPASSLEN)) - password_len = MAXICQPASSLEN; - else if (truncate_pass && password_len > 8) - password_len = 8; - - aim_encode_password_md5(password, password_len, key, digest); - - distrib = oscar_get_ui_info_int( - od->icq ? "prpl-icq-distid" : "prpl-aim-distid", - ci->distrib); - - aim_tlvlist_add_raw(&tlvlist, 0x0025, 16, digest); - -#ifndef USE_OLD_MD5 - aim_tlvlist_add_noval(&tlvlist, 0x004c); -#endif - - if (ci->clientstring != NULL) - aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); - else { - gchar *clientstring = oscar_get_clientstring(); - aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring); - g_free(clientstring); - } - aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid); - aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); - aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); - aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); - aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); - aim_tlvlist_add_32(&tlvlist, 0x0014, distrib); - aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang); - aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country); - - /* - * If set, old-fashioned buddy lists will not work. You will need - * to use SSI. - */ - aim_tlvlist_add_8(&tlvlist, 0x004a, (allow_multiple_logins ? 0x01 : 0x03)); - - aim_tlvlist_write(&frame->data, &tlvlist); - - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); - - return 0; -} - -/* - * This is sent back as a general response to the login command. - * It can be either an error or a success, depending on the - * presence of certain TLVs. - * - * The client should check the value passed as errorcode. If - * its nonzero, there was an error. - */ -static int -parse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - GSList *tlvlist; - aim_rxcallback_t userfunc; - struct aim_authresp_info *info; - int ret = 0; - - info = g_new0(struct aim_authresp_info, 1); - - /* - * Read block of TLVs. All further data is derived - * from what is parsed here. - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * No matter what, we should have a username. - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) { - info->bn = aim_tlv_getstr(tlvlist, 0x0001, 1); - purple_connection_set_display_name(od->gc, info->bn); - } - - /* - * Check for an error code. If so, we should also - * have an error url. - */ - if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) - info->errorcode = aim_tlv_get16(tlvlist, 0x0008, 1); - if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) - info->errorurl = aim_tlv_getstr(tlvlist, 0x0004, 1); - - /* - * BOS server address. - */ - if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) - info->bosip = aim_tlv_getstr(tlvlist, 0x0005, 1); - - /* - * Authorization cookie. - */ - if (aim_tlv_gettlv(tlvlist, 0x0006, 1)) { - aim_tlv_t *tmptlv; - - tmptlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); - if (tmptlv != NULL) - { - info->cookielen = tmptlv->length; - info->cookie = tmptlv->value; - } - } - - /* - * The email address attached to this account - * Not available for ICQ or @mac.com logins. - * If you receive this TLV, then you are allowed to use - * family 0x0018 to check the status of your email. - * XXX - Not really true! - */ - if (aim_tlv_gettlv(tlvlist, 0x0011, 1)) - info->email = aim_tlv_getstr(tlvlist, 0x0011, 1); - - /* - * The registration status. (Not real sure what it means.) - * Not available for ICQ or @mac.com logins. - * - * 1 = No disclosure - * 2 = Limited disclosure - * 3 = Full disclosure - * - * This has to do with whether your email address is available - * to other users or not. AFAIK, this feature is no longer used. - * - * Means you can use the admin family? (0x0007) - * - */ - if (aim_tlv_gettlv(tlvlist, 0x0013, 1)) - info->regstatus = aim_tlv_get16(tlvlist, 0x0013, 1); - - if (aim_tlv_gettlv(tlvlist, 0x0040, 1)) - info->latestbeta.build = aim_tlv_get32(tlvlist, 0x0040, 1); - if (aim_tlv_gettlv(tlvlist, 0x0041, 1)) - info->latestbeta.url = aim_tlv_getstr(tlvlist, 0x0041, 1); - if (aim_tlv_gettlv(tlvlist, 0x0042, 1)) - info->latestbeta.info = aim_tlv_getstr(tlvlist, 0x0042, 1); - if (aim_tlv_gettlv(tlvlist, 0x0043, 1)) - info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1); - -#if 0 - if (aim_tlv_gettlv(tlvlist, 0x0048, 1)) { - /* beta serial */ - } -#endif - - if (aim_tlv_gettlv(tlvlist, 0x0044, 1)) - info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1); - if (aim_tlv_gettlv(tlvlist, 0x0045, 1)) - info->latestrelease.url = aim_tlv_getstr(tlvlist, 0x0045, 1); - if (aim_tlv_gettlv(tlvlist, 0x0046, 1)) - info->latestrelease.info = aim_tlv_getstr(tlvlist, 0x0046, 1); - if (aim_tlv_gettlv(tlvlist, 0x0047, 1)) - info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1); - -#if 0 - if (aim_tlv_gettlv(tlvlist, 0x0049, 1)) { - /* lastest release serial */ - } -#endif - - /* - * URL to change password. - */ - if (aim_tlv_gettlv(tlvlist, 0x0054, 1)) - info->chpassurl = aim_tlv_getstr(tlvlist, 0x0054, 1); - -#if 0 - /* - * Unknown. Seen on an @mac.com username with value of 0x003f - */ - if (aim_tlv_gettlv(tlvlist, 0x0055, 1)) { - /* Unhandled */ - } -#endif - - od->authinfo = info; - - if ((userfunc = aim_callhandler(od, snac ? snac->family : SNAC_FAMILY_AUTH, snac ? snac->subtype : 0x0003))) - ret = userfunc(od, conn, frame, info); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -#ifdef USE_XOR_FOR_ICQ -/* - * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client - * - * This is a bit confusing. - * - * Normal SNAC login goes like this: - * - connect - * - server sends flap version - * - client sends flap version - * - client sends username (17/6) - * - server sends hash key (17/7) - * - client sends auth request (17/2 -- aim_send_login) - * - server yells - * - * XOR login (for ICQ) goes like this: - * - connect - * - server sends flap version - * - client sends auth request which contains flap version (aim_send_login) - * - server yells - * - * For the client API, we make them implement the most complicated version, - * and for the simpler version, we fake it and make it look like the more - * complicated process. - * - * This is done by giving the client a faked key, just so we can convince - * them to call aim_send_login right away, which will detect the session - * flag that says this is XOR login and ignore the key, sending an ICQ - * login request instead of the normal SNAC one. - * - * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. - */ -static int -goddamnicq(OscarData *od, FlapConnection *conn, const char *sn) -{ - FlapFrame frame; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_AUTH, 0x0007))) - userfunc(od, conn, &frame, ""); - - return 0; -} -#endif - -/* - * Subtype 0x0006 - * - * In AIM 3.5 protocol, the first stage of login is to request login from the - * Authorizer, passing it the username for verification. If the name is - * invalid, a 0017/0003 is spit back, with the standard error contents. If - * valid, a 0017/0007 comes back, which is the signal to send it the main - * login command (0017/0002). - * - */ -int -aim_request_login(OscarData *od, FlapConnection *conn, const char *sn) -{ - FlapFrame *frame; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !conn || !sn) - return -EINVAL; - -#ifdef USE_XOR_FOR_ICQ - if (aim_snvalid_icq(sn)) - return goddamnicq(od, conn, sn); -#endif - - frame = flap_frame_new(od, 0x02, 10+2+2+strlen(sn)+8); - - snacid = aim_cachesnac(od, SNAC_FAMILY_AUTH, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&frame->data, SNAC_FAMILY_AUTH, 0x0006, 0x0000, snacid); - - aim_tlvlist_add_str(&tlvlist, 0x0001, sn); - - /* Tell the server we support SecurID logins. */ - aim_tlvlist_add_noval(&tlvlist, 0x004b); - - /* Unknown. Sent in recent WinAIM clients.*/ - aim_tlvlist_add_noval(&tlvlist, 0x005a); - - aim_tlvlist_write(&frame->data, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); - - return 0; -} - -/* - * Subtype 0x0007 - * - * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed - * by only its length in a two byte word. - * - * Calls the client, which should then use the value to call aim_send_login. - * - */ -static int -keyparse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int keylen, ret = 1; - aim_rxcallback_t userfunc; - char *keystr; - GSList *tlvlist; - gboolean truncate_pass; - - keylen = byte_stream_get16(bs); - keystr = byte_stream_getstr(bs, keylen); - tlvlist = aim_tlvlist_read(bs); - - /* - * If the truncate_pass TLV exists then we should truncate the - * user's password to 8 characters. This flag is sent to us - * when logging in with an AOL user's username. - */ - truncate_pass = aim_tlv_gettlv(tlvlist, 0x0026, 1) != NULL; - - /* XXX - When GiantGrayPanda signed on AIM I got a thing asking me to register - * for the netscape network. This SNAC had a type 0x0058 TLV with length 10. - * Data is 0x0007 0004 3e19 ae1e 0006 0004 0000 0005 */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, keystr, (int)truncate_pass); - - g_free(keystr); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/** - * Subtype 0x000a - * - * Receive SecurID request. - */ -static int -got_securid_request(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/** - * Subtype 0x000b - * - * Send SecurID response. - */ -int -aim_auth_securid_send(OscarData *od, const char *securid) -{ - FlapConnection *conn; - FlapFrame *frame; - aim_snacid_t snacid; - int len; - - if (!od || !(conn = flap_connection_getbytype_all(od, SNAC_FAMILY_AUTH)) || !securid) - return -EINVAL; - - len = strlen(securid); - - frame = flap_frame_new(od, 0x02, 10+2+len); - - snacid = aim_cachesnac(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_RESPONSE, 0x0000, NULL, 0); - aim_putsnac(&frame->data, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_RESPONSE, 0x0000, 0); - - byte_stream_put16(&frame->data, len); - byte_stream_putstr(&frame->data, securid); - - flap_connection_send(conn, frame); - - return 0; -} - -static void -auth_shutdown(OscarData *od, aim_module_t *mod) -{ - if (od->authinfo != NULL) - { - g_free(od->authinfo->bn); - g_free(od->authinfo->bosip); - g_free(od->authinfo->errorurl); - g_free(od->authinfo->email); - g_free(od->authinfo->chpassurl); - g_free(od->authinfo->latestrelease.name); - g_free(od->authinfo->latestrelease.url); - g_free(od->authinfo->latestrelease.info); - g_free(od->authinfo->latestbeta.name); - g_free(od->authinfo->latestbeta.url); - g_free(od->authinfo->latestbeta.info); - g_free(od->authinfo); - } -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return parse(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0007) - return keyparse(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000a) - return got_securid_request(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -auth_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_AUTH; - mod->version = 0x0000; - mod->flags = 0; - strncpy(mod->name, "auth", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = auth_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bart.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bart.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bart.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bart.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,186 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0010 - Server stored buddy art - * - * Used for storing and retrieving your cute little buddy icon - * from the AIM servers. - * - */ - -#include "oscar.h" - -/** - * Subtype 0x0002 - Upload your icon. - * - * @param od The oscar session. - * @param icon The raw data of the icon image file. - * @param iconlen Length of the raw data of the icon image file. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_BART)) || !icon || !iconlen) - return -EINVAL; - - byte_stream_new(&bs, 2 + 2 + iconlen); - - /* The reference number for the icon */ - byte_stream_put16(&bs, 1); - - /* The icon */ - byte_stream_put16(&bs, iconlen); - byte_stream_putraw(&bs, icon, iconlen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BART, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BART, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0003 - Acknowledgement for uploading a buddy icon. - * - * You get this honky after you upload a buddy icon. - */ -static int -uploadack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 something, somethingelse; - guint8 onemorething; - - something = byte_stream_get16(bs); - somethingelse = byte_stream_get16(bs); - onemorething = byte_stream_get8(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/** - * Subtype 0x0004 - Request someone's icon. - * - * @param od The oscar session. - * @param bn The name of the buddy whose icon you are requesting. - * @param iconcsum The MD5 checksum of the icon you are requesting. - * @param iconcsumlen Length of the MD5 checksum given above. Should be 10 bytes. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_bart_request(OscarData *od, const char *bn, guint8 iconcsumtype, const guint8 *iconcsum, guint16 iconcsumlen) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_BART)) || !bn || !strlen(bn) || !iconcsum || !iconcsumlen) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 4 + 1+iconcsumlen); - - /* Buddy name */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Some numbers. You like numbers, right? */ - byte_stream_put8(&bs, 0x01); - byte_stream_put16(&bs, 0x0001); - byte_stream_put8(&bs, iconcsumtype); - - /* Icon string */ - byte_stream_put8(&bs, iconcsumlen); - byte_stream_putraw(&bs, iconcsum, iconcsumlen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BART, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BART, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0005 - Receive a buddy icon. - * - * This is sent in response to a buddy icon request. - */ -static int -parseicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *bn; - guint16 flags, iconlen; - guint8 iconcsumtype, iconcsumlen, *iconcsum, *icon; - - bn = byte_stream_getstr(bs, byte_stream_get8(bs)); - flags = byte_stream_get16(bs); - iconcsumtype = byte_stream_get8(bs); - iconcsumlen = byte_stream_get8(bs); - iconcsum = byte_stream_getraw(bs, iconcsumlen); - iconlen = byte_stream_get16(bs); - icon = byte_stream_getraw(bs, iconlen); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, iconcsumtype, iconcsum, iconcsumlen, icon, iconlen); - - g_free(bn); - g_free(iconcsum); - g_free(icon); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return uploadack(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0005) - return parseicon(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -bart_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_BART; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "bart", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bos.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bos.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bos.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_bos.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0009 - Basic Oscar Service. - * - * The functionality of this family has been replaced by SSI. - */ - -#include "oscar.h" - -#include - -/* Subtype 0x0002 - Request BOS rights. */ -void -aim_bos_reqrights(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_BOS, 0x0002); -} - -/* Subtype 0x0003 - BOS Rights. */ -static int rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist; - guint16 maxpermits = 0, maxdenies = 0; - int ret = 0; - - /* - * TLVs follow - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * TLV type 0x0001: Maximum number of buddies on permit list. - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) - maxpermits = aim_tlv_get16(tlvlist, 0x0001, 1); - - /* - * TLV type 0x0002: Maximum number of buddies on deny list. - */ - if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) - maxdenies = aim_tlv_get16(tlvlist, 0x0002, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, maxpermits, maxdenies); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0004 - Set group permission mask. - * - * Normally 0x1f (all classes). - * - * The group permission mask allows you to keep users of a certain - * class or classes from talking to you. The mask should be - * a bitwise OR of all the user classes you want to see you. - * - */ -void -aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask) -{ - aim_genericreq_l(od, conn, SNAC_FAMILY_BOS, 0x0004, &mask); -} - -/* - * Stubtypes 0x0005, 0x0006, 0x0007, and 0x0008 - Modify permit/deny lists. - * - * Changes your visibility depending on changetype: - * - * AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you - * AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list - * AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names - * AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again - * - * list should be a list of "Buddy Name One&BuddyNameTwo&" etc. - * - * Equivelents to options in WinAIM: - * - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD - * with only your name on it. - * - Allow only users on my Buddy List: Send an - * AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your - * buddy list - * - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD - * with everyone listed that you want to see you. - * - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only - * yourself in the list - * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with - * the list of users to be blocked - * - * XXX ye gods. - */ -int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int changetype, const char *denylist) -{ - ByteStream bs; - int packlen = 0; - guint16 subtype; - char *localcpy = NULL, *tmpptr = NULL; - int i; - int listcount; - aim_snacid_t snacid; - - if (!denylist) - return -EINVAL; - - if (changetype == AIM_VISIBILITYCHANGE_PERMITADD) - subtype = 0x05; - else if (changetype == AIM_VISIBILITYCHANGE_PERMITREMOVE) - subtype = 0x06; - else if (changetype == AIM_VISIBILITYCHANGE_DENYADD) - subtype = 0x07; - else if (changetype == AIM_VISIBILITYCHANGE_DENYREMOVE) - subtype = 0x08; - else - return -EINVAL; - - localcpy = g_strdup(denylist); - - listcount = aimutil_itemcnt(localcpy, '&'); - packlen = aimutil_tokslen(localcpy, 99, '&') + listcount-1; - - byte_stream_new(&bs, packlen); - - for (i = 0; (i < (listcount - 1)) && (i < 99); i++) { - tmpptr = aimutil_itemindex(localcpy, i, '&'); - - byte_stream_put8(&bs, strlen(tmpptr)); - byte_stream_putstr(&bs, tmpptr); - - g_free(tmpptr); - } - g_free(localcpy); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BOS, subtype, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BOS, subtype, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return rights(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -bos_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_BOS; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "bos", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0003 (SNAC_FAMILY_BUDDY) - Old-style Buddylist Management (non-SSI). - * - */ - -#include "oscar.h" - -#include - -/* - * Subtype 0x0002 - Request rights. - * - * Request Buddy List rights. - * - */ -void -aim_buddylist_reqrights(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_REQRIGHTS); -} - -/* - * Subtype 0x0003 - Rights. - * - */ -static int -rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist; - guint16 maxbuddies = 0, maxwatchers = 0; - int ret = 0; - - /* - * TLVs follow - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * TLV type 0x0001: Maximum number of buddies. - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) - maxbuddies = aim_tlv_get16(tlvlist, 0x0001, 1); - - /* - * TLV type 0x0002: Maximum number of watchers. - * - * Watchers are other users who have you on their buddy - * list. (This is called the "reverse list" by a certain - * other IM protocol.) - * - */ - if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) - maxwatchers = aim_tlv_get16(tlvlist, 0x0002, 1); - - /* - * TLV type 0x0003: Unknown. - * - * ICQ only? - */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, maxbuddies, maxwatchers); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0004 (SNAC_SUBTYPE_BUDDY_ADDBUDDY) - Add buddy to list. - * - * Adds a single buddy to your buddy list after login. - * XXX This should just be an extension of setbuddylist() - * - */ -int -aim_buddylist_addbuddy(OscarData *od, FlapConnection *conn, const char *sn) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!sn || !strlen(sn)) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(sn)); - - byte_stream_put8(&bs, strlen(sn)); - byte_stream_putstr(&bs, sn); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, sn, strlen(sn)+1); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0004 (SNAC_SUBTYPE_BUDDY_ADDBUDDY) - Add multiple buddies to your buddy list. - * - * This just builds the "set buddy list" command then queues it. - * - * buddy_list = "Buddy Name One&BuddyNameTwo&"; - * - * XXX Clean this up. - * - */ -int -aim_buddylist_set(OscarData *od, FlapConnection *conn, const char *buddy_list) -{ - ByteStream bs; - aim_snacid_t snacid; - int len = 0; - char *localcpy = NULL; - char *tmpptr = NULL; - - if (!buddy_list || !(localcpy = g_strdup(buddy_list))) - return -EINVAL; - - for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { - purple_debug_misc("oscar", "---adding: %s (%" G_GSIZE_FORMAT - ")\n", tmpptr, strlen(tmpptr)); - len += 1 + strlen(tmpptr); - tmpptr = strtok(NULL, "&"); - } - - byte_stream_new(&bs, len); - - strncpy(localcpy, buddy_list, strlen(buddy_list) + 1); - - for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { - - purple_debug_misc("oscar", "---adding: %s (%" G_GSIZE_FORMAT - ")\n", tmpptr, strlen(tmpptr)); - - byte_stream_put8(&bs, strlen(tmpptr)); - byte_stream_putstr(&bs, tmpptr); - tmpptr = strtok(NULL, "&"); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - g_free(localcpy); - - return 0; -} - -/* - * Subtype 0x0005 (SNAC_SUBTYPE_BUDDY_REMBUDDY) - Remove buddy from list. - * - * XXX generalise to support removing multiple buddies (basically, its - * the same as setbuddylist() but with a different snac subtype). - * - */ -int -aim_buddylist_removebuddy(OscarData *od, FlapConnection *conn, const char *sn) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!sn || !strlen(sn)) - return -EINVAL; - - byte_stream_new(&bs, 1 + strlen(sn)); - - byte_stream_put8(&bs, strlen(sn)); - byte_stream_putstr(&bs, sn); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BUDDY, 0x0005, 0x0000, sn, strlen(sn)+1); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BUDDY, 0x0005, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtypes 0x000b (SNAC_SUBTYPE_BUDDY_ONCOMING) and 0x000c (SNAC_SUBTYPE_BUDDY_OFFGOING) - Change in buddy status - * - * Oncoming Buddy notifications contain a subset of the - * user information structure. It's close enough to run - * through aim_info_extract() however. - * - * Although the offgoing notification contains no information, - * it is still in a format parsable by aim_info_extract(). - * - */ -static int -buddychange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_userinfo_t userinfo; - aim_rxcallback_t userfunc; - - aim_info_extract(od, bs, &userinfo); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &userinfo); - - aim_info_free(&userinfo); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == SNAC_SUBTYPE_BUDDY_RIGHTSINFO) - return rights(od, conn, mod, frame, snac, bs); - else if ((snac->subtype == SNAC_SUBTYPE_BUDDY_ONCOMING) || (snac->subtype == SNAC_SUBTYPE_BUDDY_OFFGOING)) - return buddychange(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -buddylist_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_BUDDY; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "buddy", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,608 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000e - Routines for the Chat service. - * - */ - -#include "oscar.h" - -#include - -/* Stored in the ->internal of chat connections */ -struct chatconnpriv -{ - guint16 exchange; - char *name; - guint16 instance; -}; - -void -flap_connection_destroy_chat(OscarData *od, FlapConnection *conn) -{ - struct chatconnpriv *ccp = (struct chatconnpriv *)conn->internal; - - if (ccp) - g_free(ccp->name); - g_free(ccp); - - return; -} - -char * -aim_chat_getname(FlapConnection *conn) -{ - struct chatconnpriv *ccp; - - if (!conn) - return NULL; - - if (conn->type != SNAC_FAMILY_CHAT) - return NULL; - - ccp = (struct chatconnpriv *)conn->internal; - - return ccp->name; -} - -/* XXX get this into conn.c -- evil!! */ -FlapConnection * -aim_chat_getconn(OscarData *od, const char *name) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur; cur = cur->next) - { - FlapConnection *conn; - struct chatconnpriv *ccp; - - conn = cur->data; - ccp = (struct chatconnpriv *)conn->internal; - - if (conn->type != SNAC_FAMILY_CHAT) - continue; - if (!conn->internal) - { - purple_debug_misc("oscar", "%sfaim: chat: chat connection with no name! (fd = %d)\n", - conn->gsc ? "(ssl) " : "", conn->gsc ? conn->gsc->fd : conn->fd); - continue; - } - - if (strcmp(ccp->name, name) == 0) - return conn; - } - - return NULL; -} - -int -aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance) -{ - struct chatconnpriv *ccp; - - if (!conn || !roomname) - return -EINVAL; - - if (conn->internal) - g_free(conn->internal); - - ccp = g_new(struct chatconnpriv, 1); - - ccp->exchange = exchange; - ccp->name = g_strdup(roomname); - ccp->instance = instance; - - conn->internal = (void *)ccp; - - return 0; -} - -int -aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo) -{ - if (!bs || !outinfo) - return 0; - - outinfo->exchange = byte_stream_get16(bs); - outinfo->namelen = byte_stream_get8(bs); - outinfo->name = (char *)byte_stream_getraw(bs, outinfo->namelen); - outinfo->instance = byte_stream_get16(bs); - - return 0; -} - -int -aim_chat_leaveroom(OscarData *od, const char *name) -{ - FlapConnection *conn; - - if (!(conn = aim_chat_getconn(od, name))) - return -ENOENT; - - flap_connection_close(od, conn); - - return 0; -} - -/* - * Subtype 0x0002 - General room information. Lots of stuff. - * - * Values I know are in here but I haven't attached - * them to any of the 'Unknown's: - * - Language (English) - * - */ -static int -infoupdate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_userinfo_t *userinfo = NULL; - aim_rxcallback_t userfunc; - int ret = 0; - int usercount; - guint8 detaillevel = 0; - char *roomname; - struct aim_chat_roominfo roominfo; - guint16 tlvcount = 0; - GSList *tlvlist; - aim_tlv_t *tlv; - char *roomdesc; - guint16 flags; - guint32 creationtime; - guint16 maxmsglen, maxvisiblemsglen; - guint16 unknown_d2, unknown_d5; - - aim_chat_readroominfo(bs, &roominfo); - - detaillevel = byte_stream_get8(bs); - - if (detaillevel != 0x02) { - purple_debug_misc("oscar", "faim: chat_roomupdateinfo: detail level %d not supported\n", detaillevel); - return 1; - } - - tlvcount = byte_stream_get16(bs); - - /* - * Everything else are TLVs. - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * TLV type 0x006a is the room name in Human Readable Form. - */ - roomname = aim_tlv_getstr(tlvlist, 0x006a, 1); - - /* - * Type 0x006f: Number of occupants. - */ - usercount = aim_tlv_get16(tlvlist, 0x006f, 1); - - /* - * Type 0x0073: Occupant list. - */ - tlv = aim_tlv_gettlv(tlvlist, 0x0073, 1); - if (tlv != NULL) - { - int curoccupant = 0; - ByteStream occbs; - - /* Allocate enough userinfo structs for all occupants */ - userinfo = g_new0(aim_userinfo_t, usercount); - - byte_stream_init(&occbs, tlv->value, tlv->length); - - while (curoccupant < usercount) - aim_info_extract(od, &occbs, &userinfo[curoccupant++]); - } - - /* - * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG) - */ - flags = aim_tlv_get16(tlvlist, 0x00c9, 1); - - /* - * Type 0x00ca: Creation time (4 bytes) - */ - creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1); - - /* - * Type 0x00d1: Maximum Message Length - */ - maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1); - - /* - * Type 0x00d2: Unknown. (2 bytes) - */ - unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1); - - /* - * Type 0x00d3: Room Description - */ - roomdesc = aim_tlv_getstr(tlvlist, 0x00d3, 1); - -#if 0 - /* - * Type 0x000d4: Unknown (flag only) - */ - if (aim_tlv_gettlv(tlvlist, 0x000d4, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00d5: Unknown. (1 byte) - */ - unknown_d5 = aim_tlv_get8(tlvlist, 0x00d5, 1); - -#if 0 - /* - * Type 0x00d6: Encoding 1 ("us-ascii") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d7: Language 1 ("en") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d7, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d8: Encoding 2 ("us-ascii") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d9: Language 2 ("en") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d9, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00da: Maximum visible message length - */ - maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - ret = userfunc(od, conn, - frame, - &roominfo, - roomname, - usercount, - userinfo, - roomdesc, - flags, - creationtime, - maxmsglen, - unknown_d2, - unknown_d5, - maxvisiblemsglen); - } - - g_free(roominfo.name); - - while (usercount > 0) - aim_info_free(&userinfo[--usercount]); - - g_free(userinfo); - g_free(roomname); - g_free(roomdesc); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* Subtypes 0x0003 and 0x0004 */ -static int -userlistchange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_userinfo_t *userinfo = NULL; - aim_rxcallback_t userfunc; - int curcount = 0, ret = 0; - - while (byte_stream_empty(bs)) { - curcount++; - userinfo = g_realloc(userinfo, curcount * sizeof(aim_userinfo_t)); - aim_info_extract(od, bs, &userinfo[curcount-1]); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, curcount, userinfo); - - aim_info_free(userinfo); - g_free(userinfo); - - return ret; -} - -/* - * Subtype 0x0005 - Send a Chat Message. - * - * Possible flags: - * AIM_CHATFLAGS_NOREFLECT -- Unset the flag that requests messages - * should be sent to their sender. - * AIM_CHATFLAGS_AWAY -- Mark the message as an autoresponse - * (Note that WinAIM does not honor this, - * and displays the message as normal.) - * - * XXX convert this to use tlvchains - */ -int -aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language) -{ - int i; - ByteStream bs; - IcbmCookie *cookie; - aim_snacid_t snacid; - guint8 ckstr[8]; - GSList *tlvlist = NULL, *inner_tlvlist = NULL; - - if (!od || !conn || !msg || (msglen <= 0)) - return 0; - - byte_stream_new(&bs, 1142); - - snacid = aim_cachesnac(od, SNAC_FAMILY_CHAT, 0x0005, 0x0000, NULL, 0); - - /* - * Cookie - * - * XXX mkcookie should generate the cookie and cache it in one - * operation to preserve uniqueness. - */ - for (i = 0; i < 8; i++) - ckstr[i] = (guint8)rand(); - - cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL); - cookie->data = NULL; /* XXX store something useful here */ - - aim_cachecookie(od, cookie); - - /* ICBM Header */ - byte_stream_putraw(&bs, ckstr, 8); /* Cookie */ - byte_stream_put16(&bs, 0x0003); /* Channel */ - - /* - * Type 1: Flag meaning this message is destined to the room. - */ - aim_tlvlist_add_noval(&tlvlist, 0x0001); - - /* - * Type 6: Reflect - */ - if (!(flags & AIM_CHATFLAGS_NOREFLECT)) - aim_tlvlist_add_noval(&tlvlist, 0x0006); - - /* - * Type 7: Autoresponse - */ - if (flags & AIM_CHATFLAGS_AWAY) - aim_tlvlist_add_noval(&tlvlist, 0x0007); - - /* - * SubTLV: Type 1: Message - */ - aim_tlvlist_add_raw(&inner_tlvlist, 0x0001, msglen, (guchar *)msg); - - /* - * SubTLV: Type 2: Encoding - */ - if (encoding != NULL) - aim_tlvlist_add_str(&inner_tlvlist, 0x0002, encoding); - - /* - * SubTLV: Type 3: Language - */ - if (language != NULL) - aim_tlvlist_add_str(&inner_tlvlist, 0x0003, language); - - /* - * Type 5: Message block. Contains more TLVs. - * - * This could include other information... We just - * put in a message TLV however. - * - */ - aim_tlvlist_add_frozentlvlist(&tlvlist, 0x0005, &inner_tlvlist); - - aim_tlvlist_write(&bs, &tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_CHAT, 0x0005, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0006 - * - * We could probably include this in the normal ICBM parsing - * code as channel 0x0003, however, since only the start - * would be the same, we might as well do it here. - * - * General outline of this SNAC: - * snac - * cookie - * channel id - * tlvlist - * unknown - * source user info - * name - * evility - * userinfo tlvs - * online time - * etc - * message metatlv - * message tlv - * message string - * possibly others - * - */ -static int -incomingim_ch3(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0, i; - aim_rxcallback_t userfunc; - aim_userinfo_t userinfo; - guint8 cookie[8]; - guint16 channel; - GSList *tlvlist; - char *msg = NULL; - int len = 0; - char *encoding = NULL, *language = NULL; - IcbmCookie *ck; - aim_tlv_t *tlv; - ByteStream tbs; - - memset(&userinfo, 0, sizeof(aim_userinfo_t)); - - /* - * Read ICBM Cookie. - */ - for (i = 0; i < 8; i++) - cookie[i] = byte_stream_get8(bs); - - if ((ck = aim_uncachecookie(od, cookie, AIM_COOKIETYPE_CHAT))) { - g_free(ck->data); - g_free(ck); - } - - /* - * Channel ID - * - * Channel 0x0003 is used for chat messages. - * - */ - channel = byte_stream_get16(bs); - - if (channel != 0x0003) { - purple_debug_misc("oscar", "faim: chat_incoming: unknown channel! (0x%04x)\n", channel); - return 0; - } - - /* - * Start parsing TLVs right away. - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * Type 0x0003: Source User Information - */ - tlv = aim_tlv_gettlv(tlvlist, 0x0003, 1); - if (tlv != NULL) - { - byte_stream_init(&tbs, tlv->value, tlv->length); - aim_info_extract(od, &tbs, &userinfo); - } - -#if 0 - /* - * Type 0x0001: If present, it means it was a message to the - * room (as opposed to a whisper). - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x0005: Message Block. Conains more TLVs. - */ - tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1); - if (tlv != NULL) - { - GSList *inner_tlvlist; - aim_tlv_t *inner_tlv; - - byte_stream_init(&tbs, tlv->value, tlv->length); - inner_tlvlist = aim_tlvlist_read(&tbs); - - /* - * Type 0x0001: Message. - */ - inner_tlv = aim_tlv_gettlv(inner_tlvlist, 0x0001, 1); - if (inner_tlv != NULL) - { - len = inner_tlv->length; - msg = aim_tlv_getvalue_as_string(inner_tlv); - } - - /* - * Type 0x0002: Encoding. - */ - encoding = aim_tlv_getstr(inner_tlvlist, 0x0002, 1); - - /* - * Type 0x0003: Language. - */ - language = aim_tlv_getstr(inner_tlvlist, 0x0003, 1); - - aim_tlvlist_free(inner_tlvlist); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &userinfo, len, msg, encoding, language); - - aim_info_free(&userinfo); - g_free(msg); - g_free(encoding); - g_free(language); - aim_tlvlist_free(tlvlist); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0002) - return infoupdate(od, conn, mod, frame, snac, bs); - else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004)) - return userlistchange(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0006) - return incomingim_ch3(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -chat_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_CHAT; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "chat", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chatnav.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chatnav.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chatnav.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_chatnav.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000d - Handle ChatNav. - * - * The ChatNav(igation) service does various things to keep chat - * alive. It provides room information, room searching and creating, - * as well as giving users the right ("permission") to use chat. - * - */ - -#include "oscar.h" - -static int -error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_snac_t *snac2; - guint16 error, chatnav_error; - GSList *tlvlist; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_warning("oscar", "chatnav error: received response to unknown request (%08x)\n", snac->id); - return 0; - } - - if (snac2->family != SNAC_FAMILY_CHATNAV) { - purple_debug_warning("oscar", "chatnav error: received response that maps to corrupt request (fam=%04x)\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - /* - * We now know what the original SNAC subtype was. - */ - if (snac2->type == 0x0008) /* create room */ - { - error = byte_stream_get16(bs); - tlvlist = aim_tlvlist_read(bs); - chatnav_error = aim_tlv_get16(tlvlist, 0x0008, 1); - - purple_debug_warning("oscar", - "Could not join room, error=0x%04hx, chatnav_error=0x%04hx\n", - error, chatnav_error); - purple_notify_error(od->gc, NULL, _("Could not join chat room"), - chatnav_error == 0x0033 ? _("Invalid chat room name") : _("Unknown error")); - - ret = 1; - } - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/* - * Subtype 0x0002 - * - * conn must be a chatnav connection! - * - */ -void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_CHATNAV, 0x0002); -} - -/* - * Subtype 0x0008 - */ -int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange) -{ - static const char ck[] = {"create"}; - static const char lang[] = {"en"}; - static const char charset[] = {"us-ascii"}; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - byte_stream_new(&bs, 1142); - - snacid = aim_cachesnac(od, SNAC_FAMILY_CHATNAV, 0x0008, 0x0000, NULL, 0); - - /* exchange */ - byte_stream_put16(&bs, exchange); - - /* - * This looks to be a big hack. You'll note that this entire - * SNAC is just a room info structure, but the hard room name, - * here, is set to "create". - * - * Either this goes on the "list of questions concerning - * why-the-hell-did-you-do-that", or this value is completely - * ignored. Without experimental evidence, but a good knowledge of - * AOL style, I'm going to guess that it is the latter, and that - * the value of the room name in create requests is ignored. - */ - byte_stream_put8(&bs, strlen(ck)); - byte_stream_putstr(&bs, ck); - - /* - * instance - * - * Setting this to 0xffff apparently assigns the last instance. - * - */ - byte_stream_put16(&bs, 0xffff); - - /* detail level */ - byte_stream_put8(&bs, 0x01); - - aim_tlvlist_add_str(&tlvlist, 0x00d3, name); - aim_tlvlist_add_str(&tlvlist, 0x00d6, charset); - aim_tlvlist_add_str(&tlvlist, 0x00d7, lang); - - /* tlvcount */ - byte_stream_put16(&bs, aim_tlvlist_count(tlvlist)); - aim_tlvlist_write(&bs, &tlvlist); - - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_CHATNAV, 0x0008, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -parseinfo_perms(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs, aim_snac_t *snac2) -{ - aim_rxcallback_t userfunc; - int ret = 0; - struct aim_chat_exchangeinfo *exchanges = NULL; - int curexchange; - aim_tlv_t *exchangetlv; - guint8 maxrooms = 0; - GSList *tlvlist, *innerlist; - - tlvlist = aim_tlvlist_read(bs); - - /* - * Type 0x0002: Maximum concurrent rooms. - */ - if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) - maxrooms = aim_tlv_get8(tlvlist, 0x0002, 1); - - /* - * Type 0x0003: Exchange information - * - * There can be any number of these, each one - * representing another exchange. - * - */ - for (curexchange = 0; ((exchangetlv = aim_tlv_gettlv(tlvlist, 0x0003, curexchange+1))); ) { - ByteStream tbs; - - byte_stream_init(&tbs, exchangetlv->value, exchangetlv->length); - - curexchange++; - - exchanges = g_realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); - - /* exchange number */ - exchanges[curexchange-1].number = byte_stream_get16(&tbs); - innerlist = aim_tlvlist_read(&tbs); - -#if 0 - /* - * Type 0x000a: Unknown. - * - * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others). - * - */ - if (aim_tlv_gettlv(innerlist, 0x000a, 1)) { - /* Unhandled */ - } - - /* - * Type 0x000d: Unknown. - */ - if (aim_tlv_gettlv(innerlist, 0x000d, 1)) { - /* Unhandled */ - } - - /* - * Type 0x0004: Unknown - */ - if (aim_tlv_gettlv(innerlist, 0x0004, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x0002: Unknown - */ - if (aim_tlv_gettlv(innerlist, 0x0002, 1)) { - guint16 classperms; - - classperms = aim_tlv_get16(innerlist, 0x0002, 1); - - purple_debug_misc("oscar", "faim: class permissions %x\n", classperms); - } - - /* - * Type 0x00c9: Flags - * - * 1 Evilable - * 2 Nav Only - * 4 Instancing Allowed - * 8 Occupant Peek Allowed - * - */ - if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) - exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1); - -#if 0 - /* - * Type 0x00ca: Creation Date - */ - if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d0: Mandatory Channels? - */ - if (aim_tlv_gettlv(innerlist, 0x00d0, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d1: Maximum Message length - */ - if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d2: Maximum Occupancy? - */ - if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00d3: Exchange Description - */ - if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) - exchanges[curexchange-1].name = aim_tlv_getstr(innerlist, 0x00d3, 1); - else - exchanges[curexchange-1].name = NULL; - -#if 0 - /* - * Type 0x00d4: Exchange Description URL - */ - if (aim_tlv_gettlv(innerlist, 0x00d4, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00d5: Creation Permissions - * - * 0 Creation not allowed - * 1 Room creation allowed - * 2 Exchange creation allowed - * - */ - if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) { - guint8 createperms; - - createperms = aim_tlv_get8(innerlist, 0x00d5, 1); - } - - /* - * Type 0x00d6: Character Set (First Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d6, 1)) - exchanges[curexchange-1].charset1 = aim_tlv_getstr(innerlist, 0x00d6, 1); - else - exchanges[curexchange-1].charset1 = NULL; - - /* - * Type 0x00d7: Language (First Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d7, 1)) - exchanges[curexchange-1].lang1 = aim_tlv_getstr(innerlist, 0x00d7, 1); - else - exchanges[curexchange-1].lang1 = NULL; - - /* - * Type 0x00d8: Character Set (Second Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d8, 1)) - exchanges[curexchange-1].charset2 = aim_tlv_getstr(innerlist, 0x00d8, 1); - else - exchanges[curexchange-1].charset2 = NULL; - - /* - * Type 0x00d9: Language (Second Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d9, 1)) - exchanges[curexchange-1].lang2 = aim_tlv_getstr(innerlist, 0x00d9, 1); - else - exchanges[curexchange-1].lang2 = NULL; - -#if 0 - /* - * Type 0x00da: Unknown - */ - if (aim_tlv_gettlv(innerlist, 0x00da, 1)) { - /* Unhandled */ - } -#endif - - aim_tlvlist_free(innerlist); - } - - /* - * Call client. - */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac2->type, maxrooms, curexchange, exchanges); - - for (curexchange--; curexchange >= 0; curexchange--) { - g_free(exchanges[curexchange].name); - g_free(exchanges[curexchange].charset1); - g_free(exchanges[curexchange].lang1); - g_free(exchanges[curexchange].charset2); - g_free(exchanges[curexchange].lang2); - } - g_free(exchanges); - aim_tlvlist_free(tlvlist); - - return ret; -} - -static int -parseinfo_create(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs, aim_snac_t *snac2) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist, *innerlist; - char *ck = NULL, *fqcn = NULL, *name = NULL; - guint16 exchange = 0, instance = 0, unknown = 0, flags = 0, maxmsglen = 0, maxoccupancy = 0; - guint32 createtime = 0; - guint8 createperms = 0, detaillevel; - int cklen; - aim_tlv_t *bigblock; - int ret = 0; - ByteStream bbbs; - - tlvlist = aim_tlvlist_read(bs); - - if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { - purple_debug_misc("oscar", "no bigblock in top tlv in create room response\n"); - aim_tlvlist_free(tlvlist); - return 0; - } - - byte_stream_init(&bbbs, bigblock->value, bigblock->length); - - exchange = byte_stream_get16(&bbbs); - cklen = byte_stream_get8(&bbbs); - ck = byte_stream_getstr(&bbbs, cklen); - instance = byte_stream_get16(&bbbs); - detaillevel = byte_stream_get8(&bbbs); - - if (detaillevel != 0x02) { - purple_debug_misc("oscar", "unknown detaillevel in create room response (0x%02x)\n", detaillevel); - aim_tlvlist_free(tlvlist); - g_free(ck); - return 0; - } - - unknown = byte_stream_get16(&bbbs); - - innerlist = aim_tlvlist_read(&bbbs); - - if (aim_tlv_gettlv(innerlist, 0x006a, 1)) - fqcn = aim_tlv_getstr(innerlist, 0x006a, 1); - - if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) - flags = aim_tlv_get16(innerlist, 0x00c9, 1); - - if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) - createtime = aim_tlv_get32(innerlist, 0x00ca, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) - maxmsglen = aim_tlv_get16(innerlist, 0x00d1, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) - maxoccupancy = aim_tlv_get16(innerlist, 0x00d2, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) - name = aim_tlv_getstr(innerlist, 0x00d3, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) - createperms = aim_tlv_get8(innerlist, 0x00d5, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - ret = userfunc(od, conn, frame, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck); - } - - g_free(ck); - g_free(name); - g_free(fqcn); - aim_tlvlist_free(innerlist); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0009 - * - * Since multiple things can trigger this callback, we must lookup the - * snacid to determine the original snac subtype that was called. - * - * XXX This isn't really how this works. But this is: Every d/9 response - * has a 16bit value at the beginning. That matches to: - * Short Desc = 1 - * Full Desc = 2 - * Instance Info = 4 - * Nav Short Desc = 8 - * Nav Instance Info = 16 - * And then everything is really asynchronous. There is no specific - * attachment of a response to a create room request, for example. Creating - * the room yields no different a response than requesting the room's info. - * - */ -static int -parseinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_snac_t *snac2; - int ret = 0; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "faim: chatnav_parse_info: received response to unknown request! (%08x)\n", snac->id); - return 0; - } - - if (snac2->family != SNAC_FAMILY_CHATNAV) { - purple_debug_misc("oscar", "faim: chatnav_parse_info: received response that maps to corrupt request! (fam=%04x)\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - /* - * We now know what the original SNAC subtype was. - */ - if (snac2->type == 0x0002) /* request chat rights */ - ret = parseinfo_perms(od, conn, mod, frame, snac, bs, snac2); - else if (snac2->type == 0x0003) /* request exchange info */ - purple_debug_misc("oscar", "chatnav_parse_info: response to exchange info\n"); - else if (snac2->type == 0x0004) /* request room info */ - purple_debug_misc("oscar", "chatnav_parse_info: response to room info\n"); - else if (snac2->type == 0x0005) /* request more room info */ - purple_debug_misc("oscar", "chatnav_parse_info: response to more room info\n"); - else if (snac2->type == 0x0006) /* request occupant list */ - purple_debug_misc("oscar", "chatnav_parse_info: response to occupant info\n"); - else if (snac2->type == 0x0007) /* search for a room */ - purple_debug_misc("oscar", "chatnav_parse_info: search results\n"); - else if (snac2->type == 0x0008) /* create room */ - ret = parseinfo_create(od, conn, mod, frame, snac, bs, snac2); - else - purple_debug_misc("oscar", "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0009) - return parseinfo(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -chatnav_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_CHATNAV; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "chatnav", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_feedbag.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_feedbag.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_feedbag.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_feedbag.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1986 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0013 - Server-Side/Stored Information. - * - * Relatively new facility that allows certain types of information, such as - * a user's buddy list, permit/deny list, and permit/deny preferences, to be - * stored on the server, so that they can be accessed from any client. - * - * We keep 2 copies of SSI data: - * 1) An exact copy of what is stored on the AIM servers. - * 2) A local copy that we make changes to, and then send diffs - * between this and the exact copy to keep them in sync. - * - * All the "aim_ssi_itemlist_bleh" functions near the top just modify the list - * that is given to them (i.e. they don't send SNACs). - * - * The SNAC sending and receiving functions are lower down in the file, and - * they're simpler. They are in the order of the subtypes they deal with, - * starting with the request rights function (subtype 0x0002), then parse - * rights (subtype 0x0003), then--well, you get the idea. - * - * This is entirely too complicated. - * You don't know the half of it. - * - */ - -#include "oscar.h" - -static int aim_ssi_addmoddel(OscarData *od); - -/** - * Locally rebuild the 0x00c8 TLV in the additional data of the given group. - * - * @param list A pointer to a pointer to the current list of items. - * @param name A null terminated string containing the group name, or NULL - * if you want to modify the master group. - * @return Return a pointer to the modified item. - */ -static void -aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) -{ - int newlen; - struct aim_ssi_item *cur, *group; - - /* Find the group */ - if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP))) - return; - - /* Find the length for the new additional data */ - newlen = 0; - if (group->gid == 0x0000) { - for (cur=list; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) - newlen += 2; - } else { - for (cur=list; cur; cur=cur->next) - if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) - newlen += 2; - } - - /* Build the new TLV list */ - if (newlen > 0) { - guint8 *newdata; - - newdata = (guint8 *)g_malloc((newlen)*sizeof(guint8)); - newlen = 0; - if (group->gid == 0x0000) { - for (cur=list; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) - newlen += aimutil_put16(newdata+newlen, cur->gid); - } else { - for (cur=list; cur; cur=cur->next) - if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) - newlen += aimutil_put16(newdata+newlen, cur->bid); - } - aim_tlvlist_replace_raw(&group->data, 0x00c8, newlen, newdata); - - g_free(newdata); - } -} - -/** - * Locally add a new item to the given item list. - * - * @param list A pointer to a pointer to the current list of items. - * @param name A null terminated string of the name of the new item, or NULL if the - * item should have no name. - * @param gid The group ID# you want the new item to have, or 0xFFFF if we should pick something. - * @param bid The buddy ID# you want the new item to have, or 0xFFFF if we should pick something. - * @param type The type of the item, 0x0000 for a contact, 0x0001 for a group, etc. - * @param data The additional data for the new item. - * @return A pointer to the newly created item. - */ -static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, GSList *data) -{ - gboolean exists; - struct aim_ssi_item *cur, *new; - - new = g_new(struct aim_ssi_item, 1); - - /* Set the name */ - new->name = g_strdup(name); - - /* Set the group ID# and buddy ID# */ - new->gid = gid; - new->bid = bid; - if (type == AIM_SSI_TYPE_GROUP) { - if ((new->gid == 0xFFFF) && name) { - do { - new->gid += 0x0001; - exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) { - exists = TRUE; - break; - } - } while (exists); - } - } else if (new->gid == 0x0000) { - /* - * This is weird, but apparently items in the root group can't - * have a buddy ID equal to any group ID. You'll get error - * 0x0003 when trying to add, which is "item already exists" - */ - if (new->bid == 0xFFFF) { - do { - new->bid += 0x0001; - exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) - if (cur->bid == new->bid || cur->gid == new->bid) { - exists = TRUE; - break; - } - } while (exists); - } - } else { - if (new->bid == 0xFFFF) { - do { - new->bid += 0x0001; - exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) - if (cur->bid == new->bid && cur->gid == new->gid) { - exists = TRUE; - break; - } - } while (exists); - } - } - - /* Set the type */ - new->type = type; - - /* Set the TLV list */ - new->data = aim_tlvlist_copy(data); - - /* Add the item to the list in the correct numerical position. Fancy, eh? */ - if (*list) { - if ((new->gid < (*list)->gid) || ((new->gid == (*list)->gid) && (new->bid < (*list)->bid))) { - new->next = *list; - *list = new; - } else { - struct aim_ssi_item *prev; - for ((prev=*list, cur=(*list)->next); (cur && ((new->gid > cur->gid) || ((new->gid == cur->gid) && (new->bid > cur->bid)))); prev=cur, cur=cur->next); - new->next = prev->next; - prev->next = new; - } - } else { - new->next = *list; - *list = new; - } - - return new; -} - -/** - * Locally delete an item from the given item list. - * - * @param list A pointer to a pointer to the current list of items. - * @param del A pointer to the item you want to remove from the list. - * @return Return 0 if no errors, otherwise return the error number. - */ -static int aim_ssi_itemlist_del(struct aim_ssi_item **list, struct aim_ssi_item *del) -{ - if (!(*list) || !del) - return -EINVAL; - - /* Remove the item from the list */ - if (*list == del) { - *list = (*list)->next; - } else { - struct aim_ssi_item *cur; - for (cur=*list; (cur->next && (cur->next!=del)); cur=cur->next); - if (cur->next) - cur->next = del->next; - } - - /* Free the removed item */ - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); - - return 0; -} - -/** - * Compare two items to see if they have the same data. - * - * @param cur1 A pointer to a pointer to the first item. - * @param cur2 A pointer to a pointer to the second item. - * @return Return 0 if no differences, or a number if there are differences. - */ -static int aim_ssi_itemlist_cmp(struct aim_ssi_item *cur1, struct aim_ssi_item *cur2) -{ - if (!cur1 || !cur2) - return 1; - - if (cur1->data && !cur2->data) - return 2; - - if (!cur1->data && cur2->data) - return 3; - - if ((cur1->data && cur2->data) && (aim_tlvlist_cmp(cur1->data, cur2->data))) - return 4; - - if (cur1->name && !cur2->name) - return 5; - - if (!cur1->name && cur2->name) - return 6; - - if (cur1->name && cur2->name && oscar_util_name_compare(cur1->name, cur2->name)) - return 7; - - if (cur1->gid != cur2->gid) - return 8; - - if (cur1->bid != cur2->bid) - return 9; - - if (cur1->type != cur2->type) - return 10; - - return 0; -} - -static gboolean aim_ssi_itemlist_valid(struct aim_ssi_item *list, struct aim_ssi_item *item) -{ - struct aim_ssi_item *cur; - for (cur=list; cur; cur=cur->next) - if (cur == item) - return TRUE; - return FALSE; -} - -/** - * Locally find an item given a group ID# and a buddy ID#. - * - * @param list A pointer to the current list of items. - * @param gid The group ID# of the desired item. - * @param bid The buddy ID# of the desired item. - * @return Return a pointer to the item if found, else return NULL; - */ -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid) -{ - struct aim_ssi_item *cur; - for (cur=list; cur; cur=cur->next) - if ((cur->gid == gid) && (cur->bid == bid)) - return cur; - return NULL; -} - -/** - * Locally find an item given a group name, buddy name, and type. If group name - * and buddy name are null, then just return the first item of the given type. - * - * @param list A pointer to the current list of items. - * @param gn The group name of the desired item. - * @param bn The buddy name of the desired item. - * @param type The type of the desired item. - * @return Return a pointer to the item if found, else return NULL. - */ -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type) -{ - struct aim_ssi_item *cur; - if (!list) - return NULL; - - if (gn && bn) { /* For finding buddies in groups */ - for (cur=list; cur; cur=cur->next) - if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { - struct aim_ssi_item *curg; - for (curg=list; curg; curg=curg->next) - if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) && (curg->name) && !(oscar_util_name_compare(curg->name, gn))) - return cur; - } - - } else if (gn) { /* For finding groups */ - for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (cur->bid == 0x0000) && (cur->name) && !(oscar_util_name_compare(cur->name, gn))) { - return cur; - } - } - - } else if (bn) { /* For finding permits, denies, and ignores */ - for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { - return cur; - } - } - - /* For stuff without names--permit deny setting, visibility mask, etc. */ - } else for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (!cur->name)) - return cur; - } - - return NULL; -} - -/** - * Check if the given buddy exists in any group in the buddy list. - * - * @param list A pointer to the current list of items. - * @param bn The group name of the desired item. - * @return Return a pointer to the name of the item if found, else return NULL; - */ -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn) -{ - if (!bn) - return NULL; - return aim_ssi_itemlist_finditem(list, NULL, bn, AIM_SSI_TYPE_BUDDY); -} - -/** - * Locally find the parent item of the given buddy name. - * - * @param list A pointer to the current list of items. - * @param bn The buddy name of the desired item. - * @return Return a pointer to the name of the item if found, else return NULL; - */ -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn) -{ - struct aim_ssi_item *cur, *curg; - if (!list || !bn) - return NULL; - if (!(cur = aim_ssi_itemlist_exists(list, bn))) - return NULL; - if (!(curg = aim_ssi_itemlist_find(list, cur->gid, 0x0000))) - return NULL; - return curg->name; -} - -/** - * Locally find the permit/deny setting item, and return the setting. - * - * @param list A pointer to the current list of items. - * @return Return the current SSI permit deny setting, or 0 if no setting was found. - */ -int aim_ssi_getpermdeny(struct aim_ssi_item *list) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PDINFO); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00ca, 1); - if (tlv && tlv->value) - return aimutil_get8(tlv->value); - } - return 0; -} - -/** - * Locally find the presence flag item, and return the setting. The returned setting is a - * bitmask of the preferences. See the AIM_SSI_PRESENCE_FLAG_* #defines in oscar.h. - * - * @param list A pointer to the current list of items. - * @return Return the current set of preferences. - */ -guint32 aim_ssi_getpresence(struct aim_ssi_item *list) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00c9, 1); - if (tlv && tlv->length) - return aimutil_get32(tlv->value); - } - return 0xFFFFFFFF; -} - -/** - * Locally find the alias of the given buddy. - * - * @param list A pointer to the current list of items. - * @param gn The group of the buddy. - * @param bn The name of the buddy. - * @return A pointer to a NULL terminated string that is the buddy's - * alias, or NULL if the buddy has no alias. You should free - * this returned value! - */ -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x0131, 1); - if (tlv && tlv->length) - return g_strndup((const gchar *)tlv->value, tlv->length); - } - return NULL; -} - -/** - * Locally find the comment of the given buddy. - * - * @param list A pointer to the current list of items. - * @param gn The group of the buddy. - * @param bn The name of the buddy. - * @return A pointer to a NULL terminated string that is the buddy's - * comment, or NULL if the buddy has no comment. You should free - * this returned value! - */ -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x013c, 1); - if (tlv && tlv->length) { - return g_strndup((const gchar *)tlv->value, tlv->length); - } - } - return NULL; -} - -/** - * Locally find if you are waiting for authorization for a buddy. - * - * @param list A pointer to the current list of items. - * @param gn The group of the buddy. - * @param bn The name of the buddy. - * @return 1 if you are waiting for authorization; 0 if you are not - */ -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - if (aim_tlv_gettlv(cur->data, 0x0066, 1)) - return TRUE; - } - return FALSE; -} - -/** - * If there are changes, then create temporary items and - * call addmoddel. - * - * @param od The oscar session. - * @return Return 0 if no errors, otherwise return the error number. - */ -static int aim_ssi_sync(OscarData *od) -{ - struct aim_ssi_item *cur1, *cur2; - struct aim_ssi_tmp *cur, *new; - int n = 0; - - /* - * The variable "n" is used to limit the number of addmoddel's that - * are performed in a single SNAC. It will hopefully keep the size - * of the SNAC below the maximum SNAC size. - */ - - if (!od) - return -EINVAL; - - /* If we're waiting for an ack, we shouldn't do anything else */ - if (od->ssi.waiting_for_ack) - return 0; - - /* - * Compare the 2 lists and create an aim_ssi_tmp for each difference. - * We should only send either additions, modifications, or deletions - * before waiting for an acknowledgement. So first do deletions, then - * additions, then modifications. Also, both the official and the local - * list should be in ascending numerical order for the group ID#s and the - * buddy ID#s, which makes things more efficient. I think. - */ - - /* Deletions */ - if (!od->ssi.pending) { - for (cur1=od->ssi.official; cur1 && (n < 15); cur1=cur1->next) { - if (!aim_ssi_itemlist_find(od->ssi.local, cur1->gid, cur1->bid)) { - n++; - new = g_new(struct aim_ssi_tmp, 1); - new->action = SNAC_SUBTYPE_FEEDBAG_DEL; - new->ack = 0xffff; - new->name = NULL; - new->item = cur1; - new->next = NULL; - if (od->ssi.pending) { - for (cur=od->ssi.pending; cur->next; cur=cur->next); - cur->next = new; - } else - od->ssi.pending = new; - } - } - } - - /* Additions */ - if (!od->ssi.pending) { - for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { - if (!aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid)) { - n++; - new = g_new(struct aim_ssi_tmp, 1); - new->action = SNAC_SUBTYPE_FEEDBAG_ADD; - new->ack = 0xffff; - new->name = NULL; - new->item = cur1; - new->next = NULL; - if (od->ssi.pending) { - for (cur=od->ssi.pending; cur->next; cur=cur->next); - cur->next = new; - } else - od->ssi.pending = new; - } - } - } - - /* Modifications */ - if (!od->ssi.pending) { - for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { - cur2 = aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid); - if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) { - n++; - new = g_new(struct aim_ssi_tmp, 1); - new->action = SNAC_SUBTYPE_FEEDBAG_MOD; - new->ack = 0xffff; - new->name = NULL; - new->item = cur1; - new->next = NULL; - if (od->ssi.pending) { - for (cur=od->ssi.pending; cur->next; cur=cur->next); - cur->next = new; - } else - od->ssi.pending = new; - } - } - } - - /* We're out of stuff to do, so tell the AIM servers we're done and exit */ - if (!od->ssi.pending) { - if (od->ssi.in_transaction) { - aim_ssi_modend(od); - od->ssi.in_transaction = FALSE; - } - return 0; - } - - /* If this is the first in a series of add/mod/del - * requests then send the "begin transaction" message. */ - if (!od->ssi.in_transaction) - { - aim_ssi_modbegin(od); - od->ssi.in_transaction = TRUE; - } - - /* Make sure we don't send anything else between now - * and when we receive the ack for the following operation */ - od->ssi.waiting_for_ack = TRUE; - - /* Now go mail off our data and wait 4 to 6 weeks */ - return aim_ssi_addmoddel(od);; -} - -/** - * Free all SSI data. - * - * This doesn't remove it from the server, that's different. - * - * @param od The oscar odion. - * @return Return 0 if no errors, otherwise return the error number. - */ -static void -aim_ssi_freelist(OscarData *od) -{ - struct aim_ssi_item *cur, *del; - struct aim_ssi_tmp *curtmp, *deltmp; - - cur = od->ssi.official; - while (cur) { - del = cur; - cur = cur->next; - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); - } - - cur = od->ssi.local; - while (cur) { - del = cur; - cur = cur->next; - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); - } - - curtmp = od->ssi.pending; - while (curtmp) { - deltmp = curtmp; - curtmp = curtmp->next; - g_free(deltmp); - } - - od->ssi.numitems = 0; - od->ssi.official = NULL; - od->ssi.local = NULL; - od->ssi.pending = NULL; - od->ssi.timestamp = (time_t)0; -} - -/** - * This "cleans" the ssi list. It does the following: - * 1) Makes sure all buddies, permits, and denies have names. - * 2) Makes sure that all buddies are in a group that exist. - * 3) Deletes any empty groups - * - * @param od The oscar odion. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_cleanlist(OscarData *od) -{ - struct aim_ssi_item *cur, *next; - - if (!od) - return -EINVAL; - - /* Delete any buddies, permits, or denies with empty names. */ - /* If there are any buddies directly in the master group, add them to a real group. */ - /* DESTROY any buddies that are directly in the master group. */ - /* Do the same for buddies that are in a non-existant group. */ - /* This will kind of mess up if you hit the item limit, but this function isn't too critical */ - cur = od->ssi.local; - while (cur) { - next = cur->next; - if (!cur->name) { - if (cur->type == AIM_SSI_TYPE_BUDDY) - aim_ssi_delbuddy(od, NULL, NULL); - else if (cur->type == AIM_SSI_TYPE_PERMIT) - aim_ssi_delpermit(od, NULL); - else if (cur->type == AIM_SSI_TYPE_DENY) - aim_ssi_deldeny(od, NULL); - } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(od->ssi.local, cur->gid, 0x0000)))) { - char *alias = aim_ssi_getalias(od->ssi.local, NULL, cur->name); - aim_ssi_addbuddy(od, cur->name, "orphans", NULL, alias, NULL, NULL, FALSE); - aim_ssi_delbuddy(od, cur->name, NULL); - g_free(alias); - } - cur = next; - } - - /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ - cur = od->ssi.local; - while (cur) { - if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) - { - struct aim_ssi_item *cur2, *next2; - cur2 = cur->next; - while (cur2) { - next2 = cur2->next; - if ((cur->type == cur2->type) && (cur->gid == cur2->gid) && (cur->name != NULL) && (cur2->name != NULL) && (!oscar_util_name_compare(cur->name, cur2->name))) { - aim_ssi_itemlist_del(&od->ssi.local, cur2); - } - cur2 = next2; - } - } - cur = cur->next; - } - - /* If we've made any changes then sync our list with the server's */ - return aim_ssi_sync(od); -} - -/** - * Add a buddy to the list. - * - * @param od The oscar odion. - * @param name The name of the item. - * @param group The group of the item. - * @param data A TLV list to use as the additional data for this item. - * @param alias The alias/nickname of the item, or NULL. - * @param comment The buddy comment for the item, or NULL. - * @param smsnum The locally assigned SMS number, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *data, const char *alias, const char *comment, const char *smsnum, gboolean needauth) -{ - struct aim_ssi_item *parent; - - if (!od || !name || !group) - return -EINVAL; - - /* Find the parent */ - if (!(parent = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) { - /* Find the parent's parent (the master group) */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Add the parent */ - parent = aim_ssi_itemlist_add(&od->ssi.local, group, 0xFFFF, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Modify the parent's parent (the master group) */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, NULL); - } - - /* Create a TLV list for the new buddy */ - if (needauth) - aim_tlvlist_add_noval(&data, 0x0066); - if (alias != NULL) - aim_tlvlist_add_str(&data, 0x0131, alias); - if (smsnum != NULL) - aim_tlvlist_add_str(&data, 0x013a, smsnum); - if (comment != NULL) - aim_tlvlist_add_str(&data, 0x013c, comment); - - /* Add that bad boy */ - aim_ssi_itemlist_add(&od->ssi.local, name, parent->gid, 0xFFFF, AIM_SSI_TYPE_BUDDY, data); - aim_tlvlist_free(data); - - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Add a permit buddy to the list. - * - * @param od The oscar odion. - * @param name The name of the item.. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_addpermit(OscarData *od, const char *name) -{ - - if (!od || !name || !od->ssi.received_data) - return -EINVAL; - - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Add that bad boy */ - aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_PERMIT, NULL); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Add a deny buddy to the list. - * - * @param od The oscar odion. - * @param name The name of the item.. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_adddeny(OscarData *od, const char *name) -{ - - if (!od || !name || !od->ssi.received_data) - return -EINVAL; - - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Add that bad boy */ - aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_DENY, NULL); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a buddy from the list. - * - * @param od The oscar odion. - * @param name The name of the item, or NULL. - * @param group The group of the item, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group) -{ - struct aim_ssi_item *del; - - if (!od) - return -EINVAL; - - /* Find the buddy */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a group from the list. - * - * @param od The oscar odion. - * @param group The name of the group. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delgroup(OscarData *od, const char *group) -{ - struct aim_ssi_item *del; - aim_tlv_t *tlv; - - if (!od) - return -EINVAL; - - /* Find the group */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) - return -EINVAL; - - /* Don't delete the group if it's not empty */ - tlv = aim_tlv_gettlv(del->data, 0x00c8, 1); - if (tlv && tlv->length > 0) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a permit buddy from the list. - * - * @param od The oscar odion. - * @param name The name of the item, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delpermit(OscarData *od, const char *name) -{ - struct aim_ssi_item *del; - - if (!od) - return -EINVAL; - - /* Find the item */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, NULL, name, AIM_SSI_TYPE_PERMIT))) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a deny buddy from the list. - * - * @param od The oscar odion. - * @param name The name of the item, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_deldeny(OscarData *od, const char *name) -{ - struct aim_ssi_item *del; - - if (!od) - return -EINVAL; - - /* Find the item */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, NULL, name, AIM_SSI_TYPE_DENY))) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Move a buddy from one group to another group. This basically just deletes the - * buddy and re-adds it. - * - * @param od The oscar odion. - * @param oldgn The group that the buddy is currently in. - * @param newgn The group that the buddy should be moved in to. - * @param bn The name of the buddy to be moved. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *bn) -{ - struct aim_ssi_item *buddy; - GSList *data; - - /* Find the buddy */ - buddy = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, bn, AIM_SSI_TYPE_BUDDY); - if (buddy == NULL) - return -EINVAL; - - /* Make a copy of the buddy's TLV list */ - data = aim_tlvlist_copy(buddy->data); - - /* Delete the old item */ - aim_ssi_delbuddy(od, bn, oldgn); - - /* Add the new item using the EXACT SAME TLV list */ - aim_ssi_addbuddy(od, bn, newgn, data, NULL, NULL, NULL, FALSE); - - return 0; -} - -/** - * Change the alias stored on the server for a given buddy. - * - * @param od The oscar odion. - * @param gn The group that the buddy is currently in. - * @param bn The name of the buddy. - * @param alias The new alias for the buddy, or NULL if you want to remove - * a buddy's comment. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias) -{ - struct aim_ssi_item *tmp; - - if (!od || !gn || !bn) - return -EINVAL; - - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) - return -EINVAL; - - /* Either add or remove the 0x0131 TLV from the TLV chain */ - if ((alias != NULL) && (strlen(alias) > 0)) - aim_tlvlist_replace_str(&tmp->data, 0x0131, alias); - else - aim_tlvlist_remove(&tmp->data, 0x0131); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Change the comment stored on the server for a given buddy. - * - * @param od The oscar odion. - * @param gn The group that the buddy is currently in. - * @param bn The name of the buddy. - * @param alias The new comment for the buddy, or NULL if you want to remove - * a buddy's comment. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *comment) -{ - struct aim_ssi_item *tmp; - - if (!od || !gn || !bn) - return -EINVAL; - - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) - return -EINVAL; - - /* Either add or remove the 0x0131 TLV from the TLV chain */ - if ((comment != NULL) && (strlen(comment) > 0)) - aim_tlvlist_replace_str(&tmp->data, 0x013c, comment); - else - aim_tlvlist_remove(&tmp->data, 0x013c); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Rename a group. - * - * @param od The oscar odion. - * @param oldgn The old group name. - * @param newgn The new group name. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn) -{ - struct aim_ssi_item *group; - - if (!od || !oldgn || !newgn) - return -EINVAL; - - if (!(group = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) - return -EINVAL; - - g_free(group->name); - group->name = g_strdup(newgn); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Stores your permit/deny setting on the server, and starts using it. - * - * @param od The oscar odion. - * @param permdeny Your permit/deny setting. Can be one of the following: - * 1 - Allow all users - * 2 - Block all users - * 3 - Allow only the users below - * 4 - Block only the users below - * 5 - Allow only users on my buddy list - * @param vismask A bitmask of the class of users to whom you want to be - * visible. See the AIM_FLAG_BLEH #defines in oscar.h - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask) -{ - struct aim_ssi_item *tmp; - - if (!od || !od->ssi.received_data) - return -EINVAL; - - /* Find the PDINFO item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO))) { - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PDINFO, NULL); - } - - /* Need to add the 0x00ca TLV to the TLV chain */ - aim_tlvlist_replace_8(&tmp->data, 0x00ca, permdeny); - - /* Need to add the 0x00cb TLV to the TLV chain */ - aim_tlvlist_replace_32(&tmp->data, 0x00cb, vismask); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Set buddy icon information - * - * @param od The oscar odion. - * @param iconcsum The MD5 checksum of the icon you are using. - * @param iconcsumlen Length of the MD5 checksum given above. Should be 0x10 bytes. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen) -{ - struct aim_ssi_item *tmp; - guint8 *csumdata; - - if (!od || !iconsum || !iconsumlen || !od->ssi.received_data) - return -EINVAL; - - /* Find the ICONINFO item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL); - } - - /* Need to add the 0x00d5 TLV to the TLV chain */ - csumdata = (guint8 *)g_malloc((iconsumlen+2)*sizeof(guint8)); - aimutil_put8(&csumdata[0], 0x00); - aimutil_put8(&csumdata[1], iconsumlen); - memcpy(&csumdata[2], iconsum, iconsumlen); - aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata); - g_free(csumdata); - - /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */ - aim_tlvlist_replace_noval(&tmp->data, 0x0131); - - /* Sync our local list with the server list */ - aim_ssi_sync(od); - return 0; -} - -/** - * Remove a reference to a server stored buddy icon. This will make your - * icon stop showing up to other people. - * - * Really this function just sets the icon to a dummy value. It's weird... - * but I think the dummy value basically means "I don't have an icon!" - * - * @param od The oscar session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delicon(OscarData *od) -{ - const guint8 csumdata[] = {0x02, 0x01, 0xd2, 0x04, 0x72}; - - return aim_ssi_seticon(od, csumdata, 5); -} - -/** - * Stores your setting for various SSI settings. Whether you - * should show up as idle or not, etc. - * - * @param od The oscar odion. - * @param presence A bitmask of the first 32 entries [0-31] from - * http://dev.aol.com/aim/oscar/#FEEDBAG__BUDDY_PREFS - * 0x00000002 - Hide "eBuddy group" (whatever that is) - * 0x00000400 - Allow others to see your idle time - * 0x00020000 - Don't show Recent Buddies - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_setpresence(OscarData *od, guint32 presence) { - struct aim_ssi_item *tmp; - - if (!od || !od->ssi.received_data) - return -EINVAL; - - /* Find the PRESENCEPREFS item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) { - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PRESENCEPREFS, NULL); - } - - /* Need to add the x00c9 TLV to the TLV chain */ - aim_tlvlist_replace_32(&tmp->data, 0x00c9, presence); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/* - * Subtype 0x0002 - Request SSI Rights. - */ -int aim_ssi_reqrights(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQRIGHTS); - - return 0; -} - -/* - * Subtype 0x0003 - SSI Rights Information. - */ -static int parserights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0, i; - aim_rxcallback_t userfunc; - GSList *tlvlist; - aim_tlv_t *tlv; - ByteStream bstream; - guint16 *maxitems; - - /* This SNAC is made up of a bunch of TLVs */ - tlvlist = aim_tlvlist_read(bs); - - /* TLV 0x0004 contains the maximum number of each item */ - if (!(tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { - aim_tlvlist_free(tlvlist); - return 0; - } - - byte_stream_init(&bstream, tlv->value, tlv->length); - - maxitems = (guint16 *)g_malloc((tlv->length/2)*sizeof(guint16)); - - for (i=0; i<(tlv->length/2); i++) - maxitems[i] = byte_stream_get16(&bstream); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, tlv->length/2, maxitems); - - aim_tlvlist_free(tlvlist); - g_free(maxitems); - - return ret; -} - -/* - * Subtype 0x0004 - Request SSI Data when you don't have a timestamp and - * revision number. - * - */ -int aim_ssi_reqdata(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - /* Free any current data, just in case */ - aim_ssi_freelist(od); - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQDATA); - - return 0; -} - -/* - * Subtype 0x0005 - Request SSI Data when you have a timestamp and revision - * number. - * - * The data will only be sent if it is newer than the posted local - * timestamp and revision. - * - * Note that the client should never increment the revision, only the server. - * - */ -int aim_ssi_reqifchanged(OscarData *od, time_t timestamp, guint16 numitems) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - byte_stream_new(&bs, 4+2); - - byte_stream_put32(&bs, timestamp); - byte_stream_put16(&bs, numitems); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQIFCHANGED, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQIFCHANGED, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - /* Free any current data, just in case */ - aim_ssi_freelist(od); - - return 0; -} - -/* - * Subtype 0x0006 - SSI Data. - */ -static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint8 fmtver; /* guess */ - guint16 namelen, gid, bid, type; - char *name; - GSList *data; - - fmtver = byte_stream_get8(bs); /* Version of ssi data. Should be 0x00 */ - od->ssi.numitems += byte_stream_get16(bs); /* # of items in this SSI SNAC */ - - /* Read in the list */ - while (byte_stream_empty(bs) > 4) { /* last four bytes are timestamp */ - if ((namelen = byte_stream_get16(bs))) - name = byte_stream_getstr(bs, namelen); - else - name = NULL; - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - type = byte_stream_get16(bs); - data = aim_tlvlist_readlen(bs, byte_stream_get16(bs)); - aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data); - g_free(name); - aim_tlvlist_free(data); - } - - /* Read in the timestamp */ - od->ssi.timestamp = byte_stream_get32(bs); - - if (!(snac->flags & 0x0001)) { - /* Make a copy of the list */ - struct aim_ssi_item *cur; - for (cur=od->ssi.official; cur; cur=cur->next) - aim_ssi_itemlist_add(&od->ssi.local, cur->name, cur->gid, cur->bid, cur->type, cur->data); - - od->ssi.received_data = TRUE; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, fmtver, od->ssi.numitems, od->ssi.timestamp); - } - - return ret; -} - -/* - * Subtype 0x0007 - SSI Activate Data. - * - * Should be sent after receiving 13/6 or 13/f to tell the server you - * are ready to begin using the list. It will promptly give you the - * presence information for everyone in your list and put your permit/deny - * settings into effect. - * - */ -int aim_ssi_enable(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, 0x0007); - - return 0; -} - -/* - * Subtype 0x0008/0x0009/0x000a - SSI Add/Mod/Del Item(s). - * - * Sends the SNAC to add, modify, or delete items from the server-stored - * information. These 3 SNACs all have an identical structure. The only - * difference is the subtype that is set for the SNAC. - * - */ -static int aim_ssi_addmoddel(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - struct aim_ssi_tmp *cur; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !od->ssi.pending || !od->ssi.pending->item) - return -EINVAL; - - /* Calculate total SNAC size */ - bslen = 0; - for (cur=od->ssi.pending; cur; cur=cur->next) { - bslen += 10; /* For length, GID, BID, type, and length */ - if (cur->item->name) - bslen += strlen(cur->item->name); - if (cur->item->data) - bslen += aim_tlvlist_size(cur->item->data); - } - - byte_stream_new(&bs, bslen); - - for (cur=od->ssi.pending; cur; cur=cur->next) { - byte_stream_put16(&bs, cur->item->name ? strlen(cur->item->name) : 0); - if (cur->item->name) - byte_stream_putstr(&bs, cur->item->name); - byte_stream_put16(&bs, cur->item->gid); - byte_stream_put16(&bs, cur->item->bid); - byte_stream_put16(&bs, cur->item->type); - byte_stream_put16(&bs, cur->item->data ? aim_tlvlist_size(cur->item->data) : 0); - if (cur->item->data) - aim_tlvlist_write(&bs, &cur->item->data); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, od->ssi.pending->action, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, od->ssi.pending->action, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0008 - Incoming SSI add. - * - * Sent by the server, for example, when someone is added to - * your "Recent Buddies" group. - */ -static int parseadd(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *name; - guint16 len, gid, bid, type; - GSList *data; - - while (byte_stream_empty(bs)) { - if ((len = byte_stream_get16(bs))) - name = byte_stream_getstr(bs, len); - else - name = NULL; - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - type = byte_stream_get16(bs); - if ((len = byte_stream_get16(bs))) - data = aim_tlvlist_readlen(bs, len); - else - data = NULL; - - aim_ssi_itemlist_add(&od->ssi.local, name, gid, bid, type, data); - aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data); - aim_tlvlist_free(data); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac->subtype, type, name); - - g_free(name); - } - - return ret; -} - -/* - * Subtype 0x0009 - Incoming SSI mod. - */ -static int parsemod(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *name; - guint16 len, gid, bid, type; - GSList *data; - struct aim_ssi_item *item; - - while (byte_stream_empty(bs)) { - if ((len = byte_stream_get16(bs))) - name = byte_stream_getstr(bs, len); - else - name = NULL; - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - type = byte_stream_get16(bs); - if ((len = byte_stream_get16(bs))) - data = aim_tlvlist_readlen(bs, len); - else - data = NULL; - - /* Replace the 2 local items with the given one */ - if ((item = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) { - item->type = type; - g_free(item->name); - item->name = g_strdup(name); - aim_tlvlist_free(item->data); - item->data = aim_tlvlist_copy(data); - } - - if ((item = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) { - item->type = type; - g_free(item->name); - item->name = g_strdup(name); - aim_tlvlist_free(item->data); - item->data = aim_tlvlist_copy(data); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac->subtype, type, name); - - g_free(name); - aim_tlvlist_free(data); - } - - return ret; -} - -/* - * Subtype 0x000a - Incoming SSI del. - * - * XXX - It would probably be good for the client to actually do something when it gets this. - */ -static int parsedel(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 gid, bid; - struct aim_ssi_item *del; - - while (byte_stream_empty(bs)) { - byte_stream_advance(bs, byte_stream_get16(bs)); - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - byte_stream_get16(bs); - byte_stream_advance(bs, byte_stream_get16(bs)); - - if ((del = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) - aim_ssi_itemlist_del(&od->ssi.local, del); - if ((del = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) - aim_ssi_itemlist_del(&od->ssi.official, del); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - } - - return ret; -} - -/* - * Subtype 0x000e - SSI Add/Mod/Del Ack. - * - * Response to add, modify, or delete SNAC (sent with aim_ssi_addmoddel). - * - */ -static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - struct aim_ssi_tmp *cur, *del; - - /* Read in the success/failure flags from the ack SNAC */ - cur = od->ssi.pending; - while (cur && (byte_stream_empty(bs)>0)) { - cur->ack = byte_stream_get16(bs); - cur = cur->next; - } - - /* - * If outcome is 0, then add the item to the item list, or replace the other item, - * or remove the old item. If outcome is non-zero, then remove the item from the - * local list, or unmodify it, or add it. - */ - for (cur=od->ssi.pending; (cur && (cur->ack != 0xffff)); cur=cur->next) { - if (cur->item) { - if (cur->ack) { - /* Our action was unsuccessful, so change the local list back to how it was */ - if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { - /* Remove the item from the local list */ - /* Make sure cur->item is still valid memory */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - cur->name = g_strdup(cur->item->name); - aim_ssi_itemlist_del(&od->ssi.local, cur->item); - } - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { - /* Replace the local item with the item from the official list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { - g_free(cur->item->name); - cur->item->name = g_strdup(cur1->name); - aim_tlvlist_free(cur->item->data); - cur->item->data = aim_tlvlist_copy(cur1->data); - } - } else - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { - /* Add the item back into the local list */ - if (aim_ssi_itemlist_valid(od->ssi.official, cur->item)) { - aim_ssi_itemlist_add(&od->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); - } else - cur->item = NULL; - } - - } else { - /* Do the exact opposite */ - if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { - /* Add the local item to the official list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - aim_ssi_itemlist_add(&od->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); - } else - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { - /* Replace the official item with the item from the local list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { - g_free(cur1->name); - cur1->name = g_strdup(cur->item->name); - aim_tlvlist_free(cur1->data); - cur1->data = aim_tlvlist_copy(cur->item->data); - } - } else - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { - /* Remove the item from the official list */ - if (aim_ssi_itemlist_valid(od->ssi.official, cur->item)) - aim_ssi_itemlist_del(&od->ssi.official, cur->item); - cur->item = NULL; - } - - } - } /* End if (cur->item) */ - } /* End for loop */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, od->ssi.pending); - - /* Free all aim_ssi_tmp's with an outcome */ - cur = od->ssi.pending; - while (cur && (cur->ack != 0xffff)) { - del = cur; - cur = cur->next; - g_free(del->name); - g_free(del); - } - od->ssi.pending = cur; - - /* If we're not waiting for any more acks, then send more SNACs */ - if (!od->ssi.pending) { - od->ssi.waiting_for_ack = FALSE; - aim_ssi_sync(od); - } - - return ret; -} - -/* - * Subtype 0x000f - SSI Data Unchanged. - * - * Response to aim_ssi_reqifchanged() if the server-side data is not newer than - * posted local stamp/revision. - * - */ -static int parsedataunchanged(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - od->ssi.received_data = TRUE; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/* - * Subtype 0x0011 - SSI Begin Data Modification. - * - * Tell the server you're going to start modifying data. This marks - * the beginning of a transaction. - */ -int aim_ssi_modbegin(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTART); - - return 0; -} - -/* - * Subtype 0x0012 - SSI End Data Modification. - * - * Tell the server you're finished modifying data. The marks the end - * of a transaction. - */ -int aim_ssi_modend(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTOP); - - return 0; -} - -/* - * Subtype 0x0014 - Grant authorization - * - * Authorizes a contact so they can add you to their contact list. - * - */ -int aim_ssi_sendauth(OscarData *od, char *bn, char *msg) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 2+(msg ? strlen(msg)+1 : 0) + 2); - - /* Username */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Message (null terminated) */ - byte_stream_put16(&bs, msg ? strlen(msg) : 0); - if (msg) { - byte_stream_putstr(&bs, msg); - byte_stream_put8(&bs, 0x00); - } - - /* Unknown */ - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTH, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTH, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0015 - Receive an authorization grant - */ -static int receiveauthgrant(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - char *bn, *msg; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) - msg = byte_stream_getstr(bs, tmp); - else - msg = NULL; - - /* Unknown */ - tmp = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, msg); - - g_free(bn); - g_free(msg); - - return ret; -} - -/* - * Subtype 0x0018 - Send authorization request - * - * Sends a request for authorization to the given contact. The request will either be - * granted, denied, or dropped. - * - */ -int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 2+(msg ? strlen(msg)+1 : 0) + 2); - - /* Username */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Message (null terminated) */ - byte_stream_put16(&bs, msg ? strlen(msg) : 0); - if (msg) { - byte_stream_putstr(&bs, msg); - byte_stream_put8(&bs, 0x00); - } - - /* Unknown */ - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0019 - Receive an authorization request - */ -static int receiveauthrequest(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - char *bn, *msg; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) - msg = byte_stream_getstr(bs, tmp); - else - msg = NULL; - - /* Unknown */ - tmp = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, msg); - - g_free(bn); - g_free(msg); - - return ret; -} - -/* - * Subtype 0x001a - Send authorization reply - * - * Sends a reply to a request for authorization. The reply can either - * grant authorization or deny authorization. - * - * if reply=0x00 then deny - * if reply=0x01 then grant - * - */ -int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 1 + 2+(msg ? (strlen(msg)+1) : 0) + 2); - - /* Username */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Grant or deny */ - byte_stream_put8(&bs, reply); - - /* Message (null terminated) */ - byte_stream_put16(&bs, msg ? (strlen(msg)+1) : 0); - if (msg) { - byte_stream_putstr(&bs, msg); - byte_stream_put8(&bs, 0x00); - } - - /* Unknown */ - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x001b - Receive an authorization reply - * - * You get this bad boy when other people respond to the authorization - * request that you have previously sent them. - */ -static int receiveauthreply(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - guint8 reply; - char *bn, *msg; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - /* Read reply */ - reply = byte_stream_get8(bs); - - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) - msg = byte_stream_getstr(bs, tmp); - else - msg = NULL; - - /* Unknown */ - tmp = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, reply, msg); - - g_free(bn); - g_free(msg); - - return ret; -} - -/* - * Subtype 0x001c - Receive a message telling you someone added you to their list. - */ -static int receiveadded(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - char *bn; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn); - - g_free(bn); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO) - return parserights(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_LIST) - return parsedata(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_ADD) - return parseadd(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_MOD) - return parsemod(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_DEL) - return parsedel(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_SRVACK) - return parseack(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_NOLIST) - return parsedataunchanged(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTH) - return receiveauthgrant(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ) - return receiveauthrequest(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP) - return receiveauthreply(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_ADDED) - return receiveadded(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -ssi_shutdown(OscarData *od, aim_module_t *mod) -{ - aim_ssi_freelist(od); -} - -int -ssi_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_FEEDBAG; - mod->version = 0x0004; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "feedbag", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = ssi_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icbm.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icbm.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icbm.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icbm.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2873 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0004 - Routines for sending/receiving Instant Messages. - * - * Note the term ICBM (Inter-Client Basic Message) which blankets - * all types of generically routed through-server messages. Within - * the ICBM types (family 4), a channel is defined. Each channel - * represents a different type of message. Channel 1 is used for - * what would commonly be called an "instant message". Channel 2 - * is used for negotiating "rendezvous". These transactions end in - * something more complex happening, such as a chat invitation, or - * a file transfer. Channel 3 is used for chat messages (not in - * the same family as these channels). Channel 4 is used for - * various ICQ messages. Examples are normal messages, URLs, and - * old-style authorization. - * - * In addition to the channel, every ICBM contains a cookie. For - * standard IMs, these are only used for error messages. However, - * the more complex rendezvous messages make suitably more complex - * use of this field. - * - * TODO: Split this up into an im.c file an an icbm.c file. It - * will be beautiful, you'll see. - * - * Make sure flap_connection_findbygroup is used by all functions. - */ - -#include "oscar.h" -#include "peer.h" - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -#include "util.h" - - -/** - * Add a standard ICBM header to the given bstream with the given - * information. - * - * @param bs The bstream to write the ICBM header to. - * @param c c is for cookie, and cookie is for me. - * @param channel The ICBM channel (1 through 4). - * @param bn Null-terminated scrizeen nizame. - * @return The number of bytes written. It's really not useful. - */ -static int aim_im_puticbm(ByteStream *bs, const guchar *c, guint16 channel, const char *bn) -{ - byte_stream_putraw(bs, c, 8); - byte_stream_put16(bs, channel); - byte_stream_put8(bs, strlen(bn)); - byte_stream_putstr(bs, bn); - return 8+2+1+strlen(bn); -} - -/** - * Generates a random ICBM cookie in a character array of length 8 - * and copies it into the variable passed as cookie - * TODO: Maybe we should stop limiting our characters to the visible range? - */ -void aim_icbm_makecookie(guchar *cookie) -{ - int i; - - /* Should be like "21CBF95" and null terminated */ - for (i = 0; i < 7; i++) - cookie[i] = 0x30 + ((guchar)rand() % 10); - cookie[7] = '\0'; -} - -/* - * Takes a msghdr (and a length) and returns a client type - * code. Note that this is *only a guess* and has a low likelihood - * of actually being accurate. - * - * Its based on experimental data, with the help of Eric Warmenhoven - * who seems to have collected a wide variety of different AIM clients. - * - * - * Heres the current collection: - * 0501 0003 0101 0101 01 AOL Mobile Communicator, WinAIM 1.0.414 - * 0501 0003 0101 0201 01 WinAIM 2.0.847, 2.1.1187, 3.0.1464, - * 4.3.2229, 4.4.2286 - * 0501 0004 0101 0102 0101 WinAIM 4.1.2010, libfaim (right here) - * 0501 0003 0101 02 WinAIM 5 - * 0501 0001 01 iChat x.x, mobile buddies - * 0501 0001 0101 01 AOL v6.0, CompuServe 2000 v6.0, any TOC client - * 0501 0002 0106 WinICQ 5.45.1.3777.85 - * - * Note that in this function, only the feature bytes are tested, since - * the rest will always be the same. - * - */ -guint16 aim_im_fingerprint(const guint8 *msghdr, int len) -{ - static const struct { - guint16 clientid; - int len; - guint8 data[10]; - } fingerprints[] = { - /* AOL Mobile Communicator, WinAIM 1.0.414 */ - { AIM_CLIENTTYPE_MC, - 3, {0x01, 0x01, 0x01}}, - - /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */ - { AIM_CLIENTTYPE_WINAIM, - 3, {0x01, 0x01, 0x02}}, - - /* WinAIM 4.1.2010, libfaim */ - { AIM_CLIENTTYPE_WINAIM41, - 4, {0x01, 0x01, 0x01, 0x02}}, - - /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */ - { AIM_CLIENTTYPE_AOL_TOC, - 1, {0x01}}, - - { 0, 0, {0x00}} - }; - int i; - - if (!msghdr || (len <= 0)) - return AIM_CLIENTTYPE_UNKNOWN; - - for (i = 0; fingerprints[i].len; i++) { - if (fingerprints[i].len != len) - continue; - if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0) - return fingerprints[i].clientid; - } - - return AIM_CLIENTTYPE_UNKNOWN; -} - -/* - * Subtype 0x0001 - Error - */ -static int -error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - guint16 reason, errcode = 0; - char *bn; - GSList *tlvlist; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "icbm error: received response from unknown request!\n"); - return 0; - } - - if (snac2->family != SNAC_FAMILY_ICBM) { - purple_debug_misc("oscar", "icbm error: received response from invalid request! %d\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - if (!(bn = snac2->data)) { - purple_debug_misc("oscar", "icbm error: received response from request without a buddy name!\n"); - g_free(snac2); - return 0; - } - - reason = byte_stream_get16(bs); - - tlvlist = aim_tlvlist_read(bs); - if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) - errcode = aim_tlv_get16(tlvlist, 0x0008, 1); - aim_tlvlist_free(tlvlist); - - /* Notify the user that the message wasn't delivered */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, reason, errcode, bn); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/** - * Subtype 0x0002 - Set ICBM parameters. - * - * I definitely recommend sending this. If you don't, you'll be stuck - * with the rather unreasonable defaults. - * - */ -int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!params) - return -EINVAL; - - byte_stream_new(&bs, 16); - - /* This is read-only (see Parameter Reply). Must be set to zero here. */ - byte_stream_put16(&bs, 0x0000); - - /* These are all read-write */ - byte_stream_put32(&bs, params->flags); - byte_stream_put16(&bs, params->maxmsglen); - byte_stream_put16(&bs, params->maxsenderwarn); - byte_stream_put16(&bs, params->maxrecverwarn); - byte_stream_put32(&bs, params->minmsginterval); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0004 - Request ICBM parameter information. - * - */ -int aim_im_reqparams(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_ICBM, 0x0004); - - return 0; -} - -/** - * Subtype 0x0005 - Receive parameter information. - * - */ -static int aim_im_paraminfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - struct aim_icbmparameters params; - - params.maxchan = byte_stream_get16(bs); - params.flags = byte_stream_get32(bs); - params.maxmsglen = byte_stream_get16(bs); - params.maxsenderwarn = byte_stream_get16(bs); - params.maxrecverwarn = byte_stream_get16(bs); - params.minmsginterval = byte_stream_get32(bs); - - params.flags = AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED - | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED - | AIM_IMPARAM_FLAG_EVENTS_ALLOWED - | AIM_IMPARAM_FLAG_SMS_SUPPORTED - | AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED; - params.maxmsglen = 8000; - params.minmsginterval = 0; - - aim_im_setparams(od, ¶ms); - - return 0; -} - -/** - * Subtype 0x0006 - Send an ICBM (instant message). - * - * - * Possible flags: - * AIM_IMFLAGS_AWAY -- Marks the message as an autoresponse - * AIM_IMFLAGS_ACK -- Requests that the server send an ack - * when the message is received (of type SNAC_FAMILY_ICBM/0x000c) - * AIM_IMFLAGS_OFFLINE--If destination is offline, store it until they are - * online (probably ICQ only). - * - * Generally, you should use the lowest encoding possible to send - * your message. If you only use basic punctuation and the generic - * Latin alphabet, use ASCII7 (no flags). If you happen to use non-ASCII7 - * characters, but they are all clearly defined in ISO-8859-1, then - * use that. Keep in mind that not all characters in the PC ASCII8 - * character set are defined in the ISO standard. For those cases (most - * notably when the (r) symbol is used), you must use the full UNICODE - * encoding for your message. In UNICODE mode, _all_ characters must - * occupy 16bits, including ones that are not special. (Remember that - * the first 128 UNICODE symbols are equivalent to ASCII7, however they - * must be prefixed with a zero high order byte.) - * - * I strongly discourage the use of UNICODE mode, mainly because none - * of the clients I use can parse those messages (and besides that, - * wchars are difficult and non-portable to handle in most UNIX environments). - * If you really need to include special characters, use the HTML UNICODE - * entities. These are of the form ߪ where 2026 is the hex - * representation of the UNICODE index (in this case, UNICODE - * "Horizontal Ellipsis", or 133 in in ASCII8). - * - * Implementation note: Since this is one of the most-used functions - * in all of libfaim, it is written with performance in mind. As such, - * it is not as clear as it could be in respect to how this message is - * supposed to be layed out. Most obviously, tlvlists should be used - * instead of writing out the bytes manually. - * - * XXX - more precise verification that we never send SNACs larger than 8192 - * XXX - check SNAC size for multipart - * - */ -int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args) -{ - FlapConnection *conn; - aim_snacid_t snacid; - ByteStream data; - guchar cookie[8]; - int msgtlvlen; - static const guint8 deffeatures[] = { 0x01, 0x01, 0x01, 0x02 }; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!args) - return -EINVAL; - - if (args->flags & AIM_IMFLAGS_MULTIPART) { - if (args->mpmsg->numparts == 0) - return -EINVAL; - } else { - if (!args->msg || (args->msglen <= 0)) - return -EINVAL; - - if (args->msglen > MAXMSGLEN) - return -E2BIG; - } - - /* Painfully calculate the size of the message TLV */ - msgtlvlen = 1 + 1; /* 0501 */ - - if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) - msgtlvlen += 2 + args->featureslen; - else - msgtlvlen += 2 + sizeof(deffeatures); - - if (args->flags & AIM_IMFLAGS_MULTIPART) { - aim_mpmsg_section_t *sec; - - for (sec = args->mpmsg->parts; sec; sec = sec->next) { - msgtlvlen += 2 /* 0101 */ + 2 /* block len */; - msgtlvlen += 4 /* charset */ + sec->datalen; - } - - } else { - msgtlvlen += 2 /* 0101 */ + 2 /* block len */; - msgtlvlen += 4 /* charset */ + args->msglen; - } - - byte_stream_new(&data, msgtlvlen + 128); - - /* Generate an ICBM cookie */ - aim_icbm_makecookie(cookie); - - /* ICBM header */ - aim_im_puticbm(&data, cookie, 0x0001, args->destbn); - - /* Message TLV (type 0x0002) */ - byte_stream_put16(&data, 0x0002); - byte_stream_put16(&data, msgtlvlen); - - /* Features TLV (type 0x0501) */ - byte_stream_put16(&data, 0x0501); - if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) { - byte_stream_put16(&data, args->featureslen); - byte_stream_putraw(&data, args->features, args->featureslen); - } else { - byte_stream_put16(&data, sizeof(deffeatures)); - byte_stream_putraw(&data, deffeatures, sizeof(deffeatures)); - } - - if (args->flags & AIM_IMFLAGS_MULTIPART) { - aim_mpmsg_section_t *sec; - - /* Insert each message part in a TLV (type 0x0101) */ - for (sec = args->mpmsg->parts; sec; sec = sec->next) { - byte_stream_put16(&data, 0x0101); - byte_stream_put16(&data, sec->datalen + 4); - byte_stream_put16(&data, sec->charset); - byte_stream_put16(&data, sec->charsubset); - byte_stream_putraw(&data, (guchar *)sec->data, sec->datalen); - } - - } else { - - /* Insert message text in a TLV (type 0x0101) */ - byte_stream_put16(&data, 0x0101); - - /* Message block length */ - byte_stream_put16(&data, args->msglen + 0x04); - - /* Character set */ - byte_stream_put16(&data, args->charset); - byte_stream_put16(&data, args->charsubset); - - /* Message. Not terminated */ - byte_stream_putraw(&data, (guchar *)args->msg, args->msglen); - } - - /* Set the Autoresponse flag */ - if (args->flags & AIM_IMFLAGS_AWAY) { - byte_stream_put16(&data, 0x0004); - byte_stream_put16(&data, 0x0000); - } else { - if (args->flags & AIM_IMFLAGS_ACK) { - /* Set the Request Acknowledge flag */ - byte_stream_put16(&data, 0x0003); - byte_stream_put16(&data, 0x0000); - } - - if (args->flags & AIM_IMFLAGS_OFFLINE) { - /* Allow this message to be queued as an offline message */ - byte_stream_put16(&data, 0x0006); - byte_stream_put16(&data, 0x0000); - } - } - - /* - * Set the I HAVE A REALLY PURTY ICON flag. - * XXX - This should really only be sent on initial - * IMs and when you change your icon. - */ - if (args->flags & AIM_IMFLAGS_HASICON) { - byte_stream_put16(&data, 0x0008); - byte_stream_put16(&data, 0x000c); - byte_stream_put32(&data, args->iconlen); - byte_stream_put16(&data, 0x0001); - byte_stream_put16(&data, args->iconsum); - byte_stream_put32(&data, args->iconstamp); - } - - /* - * Set the Buddy Icon Requested flag. - * XXX - Every time? Surely not... - */ - if (args->flags & AIM_IMFLAGS_BUDDYREQ) { - byte_stream_put16(&data, 0x0009); - byte_stream_put16(&data, 0x0000); - } - - /* XXX - should be optional */ - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, args->destbn, strlen(args->destbn)+1); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &data); - byte_stream_destroy(&data); - - /* clean out SNACs over 60sec old */ - aim_cleansnacs(od, 60); - - return 0; -} - -/* - * Simple wrapper for aim_im_sendch1_ext() - * - * You cannot use aim_send_im if you need the HASICON flag. You must - * use aim_im_sendch1_ext directly for that. - * - * aim_send_im also cannot be used if you require UNICODE messages, because - * that requires an explicit message length. Use aim_im_sendch1_ext(). - * - */ -int aim_im_sendch1(OscarData *od, const char *bn, guint16 flags, const char *msg) -{ - struct aim_sendimext_args args; - - args.destbn = bn; - args.flags = flags; - args.msg = msg; - args.msglen = strlen(msg); - args.charset = 0x0000; - args.charsubset = 0x0000; - - /* Make these don't get set by accident -- they need aim_im_sendch1_ext */ - args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART); - - return aim_im_sendch1_ext(od, &args); -} - -/* - * Subtype 0x0006 - Send a chat invitation. - */ -int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - IcbmCookie *msgcookie; - struct aim_invite_priv *priv; - guchar cookie[8]; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!bn || !msg || !roomname) - return -EINVAL; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 1142+strlen(bn)+strlen(roomname)+strlen(msg)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, bn, strlen(bn)+1); - - /* XXX should be uncached by an unwritten 'invite accept' handler */ - priv = g_malloc(sizeof(struct aim_invite_priv)); - priv->bn = g_strdup(bn); - priv->roomname = g_strdup(roomname); - priv->exchange = exchange; - priv->instance = instance; - - if ((msgcookie = aim_mkcookie(cookie, AIM_COOKIETYPE_INVITE, priv))) - aim_cachecookie(od, msgcookie); - else - g_free(priv); - - /* ICBM Header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - /* - * TLV t(0005) - * - * Everything else is inside this TLV. - * - * Sigh. AOL was rather inconsistent right here. So we have - * to play some minor tricks. Right inside the type 5 is some - * raw data, followed by a series of TLVs. - * - */ - byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2); - - byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ - byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); - - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_add_str(&inner_tlvlist, 0x000c, msg); - aim_tlvlist_add_chatroom(&inner_tlvlist, 0x2711, exchange, roomname, instance); - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0006 - Send your icon to a given user. - * - * This is also performance sensitive. (If you can believe it...) - * - */ -int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!bn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN)) - return -EINVAL; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 8+2+1+strlen(bn)+2+2+2+8+16+2+2+2+2+2+2+2+4+4+4+iconlen+strlen(AIM_ICONIDENT)+2+2); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - /* - * TLV t(0005) - * - * Encompasses everything below. - */ - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT)); - - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, cookie, 8); - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_BUDDYICON); - - /* TLV t(000a) */ - byte_stream_put16(&bs, 0x000a); - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - /* TLV t(000f) */ - byte_stream_put16(&bs, 0x000f); - byte_stream_put16(&bs, 0x0000); - - /* TLV t(2711) */ - byte_stream_put16(&bs, 0x2711); - byte_stream_put16(&bs, 4+4+4+iconlen+strlen(AIM_ICONIDENT)); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, iconsum); - byte_stream_put32(&bs, iconlen); - byte_stream_put32(&bs, stamp); - byte_stream_putraw(&bs, icon, iconlen); - byte_stream_putstr(&bs, AIM_ICONIDENT); - - /* TLV t(0003) */ - byte_stream_put16(&bs, 0x0003); - byte_stream_put16(&bs, 0x0000); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0006 - Send a rich text message. - * - * This only works for ICQ 2001b (thats 2001 not 2000). Better, only - * send it to clients advertising the RTF capability. In fact, if you send - * it to a client that doesn't support that capability, the server will gladly - * bounce it back to you. - * - * You'd think this would be in icq.c, but, well, I'm trying to stick with - * the one-group-per-file scheme as much as possible. This could easily - * be an exception, since Rendezvous IMs are external of the Oscar core, - * and therefore are undefined. Really I just need to think of a good way to - * make an interface similar to what AOL actually uses. But I'm not using COM. - * - */ -int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* OSCAR_CAPABILITY_ICQRTF capability in string form */ - int servdatalen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!args || !args->destbn || !args->rtfmsg) - return -EINVAL; - - servdatalen = 2+2+16+2+4+1+2 + 2+2+4+4+4 + 2+4+2+strlen(args->rtfmsg)+1 + 4+4+4+strlen(rtfcap)+1; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 128+servdatalen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, args->destbn); - - /* TLV t(0005) - Encompasses everything below. */ - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen); - - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, cookie, 8); - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY); - - /* t(000a) l(0002) v(0001) */ - byte_stream_put16(&bs, 0x000a); - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - /* t(000f) l(0000) v() */ - byte_stream_put16(&bs, 0x000f); - byte_stream_put16(&bs, 0x0000); - - /* Service Data TLV */ - byte_stream_put16(&bs, 0x2711); - byte_stream_put16(&bs, servdatalen); - - byte_stream_putle16(&bs, 11 + 16 /* 11 + (sizeof CLSID) */); - byte_stream_putle16(&bs, 9); - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); - byte_stream_putle16(&bs, 0); - byte_stream_putle32(&bs, 0); - byte_stream_putle8(&bs, 0); - byte_stream_putle16(&bs, 0x03ea); /* trid1 */ - - byte_stream_putle16(&bs, 14); - byte_stream_putle16(&bs, 0x03eb); /* trid2 */ - byte_stream_putle32(&bs, 0); - byte_stream_putle32(&bs, 0); - byte_stream_putle32(&bs, 0); - - byte_stream_putle16(&bs, 0x0001); - byte_stream_putle32(&bs, 0); - byte_stream_putle16(&bs, strlen(args->rtfmsg)+1); - byte_stream_putraw(&bs, (const guint8 *)args->rtfmsg, strlen(args->rtfmsg)+1); - - byte_stream_putle32(&bs, args->fgcolor); - byte_stream_putle32(&bs, args->bgcolor); - byte_stream_putle32(&bs, strlen(rtfcap)+1); - byte_stream_putraw(&bs, (const guint8 *)rtfcap, strlen(rtfcap)+1); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Cancel a rendezvous invitation. It could be an invitation to - * establish a direct connection, or a file-send, or a chat invite. - */ -void -aim_im_sendch2_cancel(PeerConnection *peer_conn) -{ - OscarData *od; - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - od = peer_conn->od; - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 118+strlen(peer_conn->bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 64); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_CANCEL); - byte_stream_putraw(&hdrbs, peer_conn->cookie, 8); - byte_stream_putcaps(&hdrbs, peer_conn->type); - - /* This TLV means "cancel!" */ - aim_tlvlist_add_16(&inner_tlvlist, 0x000b, 0x0001); - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send an "I accept and I've connected to - * you" message. - */ -void -aim_im_sendch2_connected(PeerConnection *peer_conn) -{ - OscarData *od; - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - od = peer_conn->od; - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 11+strlen(peer_conn->bn) + 4+2+8+16); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn); - - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 0x001a); - byte_stream_put16(&bs, AIM_RENDEZVOUS_CONNECTED); - byte_stream_putraw(&bs, peer_conn->cookie, 8); - byte_stream_putcaps(&bs, peer_conn->type); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send a direct connect rendezvous ICBM. This - * could have a number of meanings, depending on the content: - * "I want you to connect to me" - * "I want to connect to you" - * "I want to connect through a proxy server" - */ -void -aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 246+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 128); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send a direct connect rendezvous ICBM asking the - * remote user to connect to us via a proxy server. - */ -void -aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - guint8 ip_comp[4]; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 246+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 128); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); - - /* Send the bitwise complement of the port and ip. As a check? */ - ip_comp[0] = ~ip[0]; - ip_comp[1] = ~ip[1]; - ip_comp[2] = ~ip[2]; - ip_comp[3] = ~ip[3]; - aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp); - aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); - - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send an "I want to send you this file" message - * - */ -void -aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - g_return_if_fail(bn != NULL); - g_return_if_fail(ip != NULL); - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 1014); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 512); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - /* TODO: Send 0x0016 and 0x0017 */ - -#if 0 - /* TODO: If the following is ever enabled, ensure that it is - * not sent with a receive redirect or stage 3 proxy - * redirect for a file receive (same conditions for - * sending 0x000f above) - */ - aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file."); -#endif - - if (filename != NULL) - { - ByteStream inner_bs; - - /* Begin TLV t(2711) */ - byte_stream_new(&inner_bs, 2+2+4+strlen(filename)+1); - byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001); - byte_stream_put16(&inner_bs, numfiles); - byte_stream_put32(&inner_bs, size); - - /* Filename - NULL terminated, for some odd reason */ - byte_stream_putstr(&inner_bs, filename); - byte_stream_put8(&inner_bs, 0x00); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, inner_bs.len, inner_bs.data); - byte_stream_destroy(&inner_bs); - /* End TLV t(2711) */ - } - - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send a sendfile connect rendezvous ICBM asking the - * remote user to connect to us via a proxy server. - */ -void -aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - guint8 ip_comp[4]; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 1014); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 512); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); - - /* Send the bitwise complement of the port and ip. As a check? */ - ip_comp[0] = ~ip[0]; - ip_comp[1] = ~ip[1]; - ip_comp[2] = ~ip[2]; - ip_comp[3] = ~ip[3]; - aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp); - aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); - -#if 0 - /* TODO: If the following is ever enabled, ensure that it is - * not sent with a receive redirect or stage 3 proxy - * redirect for a file receive (same conditions for - * sending 0x000f above) - */ - aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file."); -#endif - - if (filename != NULL) - { - ByteStream filename_bs; - - /* Begin TLV t(2711) */ - byte_stream_new(&filename_bs, 2+2+4+strlen(filename)+1); - byte_stream_put16(&filename_bs, (numfiles > 1) ? 0x0002 : 0x0001); - byte_stream_put16(&filename_bs, numfiles); - byte_stream_put32(&filename_bs, size); - - /* Filename - NULL terminated, for some odd reason */ - byte_stream_putstr(&filename_bs, filename); - byte_stream_put8(&filename_bs, 0x00); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, filename_bs.len, filename_bs.data); - byte_stream_destroy(&filename_bs); - /* End TLV t(2711) */ - } - - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Request the status message of the given ICQ user. - * - * @param od The oscar session. - * @param bn The UIN of the user of whom you wish to request info. - * @param type The type of info you wish to request. This should be the current - * state of the user, as one of the AIM_ICQ_STATE_* defines. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)) || !bn) - return -EINVAL; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 8+2+1+strlen(bn) + 4+0x5e + 4); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - /* TLV t(0005) - Encompasses almost everything below. */ - byte_stream_put16(&bs, 0x0005); /* T */ - byte_stream_put16(&bs, 0x005e); /* L */ - { /* V */ - byte_stream_put16(&bs, 0x0000); - - /* Cookie */ - byte_stream_putraw(&bs, cookie, 8); - - /* Put the 16 byte server relay capability */ - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY); - - /* TLV t(000a) */ - byte_stream_put16(&bs, 0x000a); - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - /* TLV t(000f) */ - byte_stream_put16(&bs, 0x000f); - byte_stream_put16(&bs, 0x0000); - - /* TLV t(2711) */ - byte_stream_put16(&bs, 0x2711); - byte_stream_put16(&bs, 0x0036); - { /* V */ - byte_stream_putle16(&bs, 0x001b); /* L */ - byte_stream_putle16(&bs, 0x0009); /* Protocol version */ - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); - byte_stream_putle16(&bs, 0x0000); /* Unknown */ - byte_stream_putle16(&bs, 0x0001); /* Client features? */ - byte_stream_putle16(&bs, 0x0000); /* Unknown */ - byte_stream_putle8(&bs, 0x00); /* Unkizown */ - byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ - - byte_stream_putle16(&bs, 0x000e); /* L */ - byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ - byte_stream_putle32(&bs, 0x00000000); /* Unknown */ - byte_stream_putle32(&bs, 0x00000000); /* Unknown */ - byte_stream_putle32(&bs, 0x00000000); /* Unknown */ - - /* The type of status message being requested */ - if (type & AIM_ICQ_STATE_CHAT) - byte_stream_putle16(&bs, 0x03ec); - else if(type & AIM_ICQ_STATE_DND) - byte_stream_putle16(&bs, 0x03eb); - else if(type & AIM_ICQ_STATE_OUT) - byte_stream_putle16(&bs, 0x03ea); - else if(type & AIM_ICQ_STATE_BUSY) - byte_stream_putle16(&bs, 0x03e9); - else if(type & AIM_ICQ_STATE_AWAY) - byte_stream_putle16(&bs, 0x03e8); - - byte_stream_putle16(&bs, 0x0001); /* Status? */ - byte_stream_putle16(&bs, 0x0001); /* Priority of this message? */ - byte_stream_putle16(&bs, 0x0001); /* L */ - byte_stream_putle8(&bs, 0x00); /* String of length L */ - } /* End TLV t(2711) */ - } /* End TLV t(0005) */ - - /* TLV t(0003) */ - byte_stream_put16(&bs, 0x0003); - byte_stream_put16(&bs, 0x0000); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0006 - Send an ICQ-esque ICBM. - * - * This can be used to send an ICQ authorization reply (deny or grant). It is the "old way." - * The new way is to use SSI. I like the new way a lot better. This seems like such a hack, - * mostly because it's in network byte order. Figuring this stuff out sometimes takes a while, - * but thats ok, because it gives me time to try to figure out what kind of drugs the AOL people - * were taking when they merged the two protocols. - * - * @param bn The destination buddy name. - * @param type The type of message. 0x0007 for authorization denied. 0x0008 for authorization granted. - * @param message The message you want to send, it should be null terminated. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - - if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) - return -EINVAL; - - if (!bn || !type || !message) - return -EINVAL; - - byte_stream_new(&bs, 8+3+strlen(bn)+12+strlen(message)+1+4); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - aim_icbm_makecookie(cookie); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0004, bn); - - /* - * TLV t(0005) - * - * ICQ data (the UIN and the message). - */ - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 4 + 2+2+strlen(message)+1); - - /* - * Your UIN - */ - byte_stream_putuid(&bs, od); - - /* - * TLV t(type) l(strlen(message)+1) v(message+NULL) - */ - byte_stream_putle16(&bs, type); - byte_stream_putle16(&bs, strlen(message)+1); - byte_stream_putraw(&bs, (const guint8 *)message, strlen(message)+1); - - /* - * TLV t(0006) l(0000) v() - */ - byte_stream_put16(&bs, 0x0006); - byte_stream_put16(&bs, 0x0000); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * XXX - I don't see when this would ever get called... - */ -static int outgoingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guchar cookie[8]; - guint16 channel; - GSList *tlvlist; - char *bn; - int bnlen; - guint16 icbmflags = 0; - guint8 flag1 = 0, flag2 = 0; - gchar *msg = NULL; - aim_tlv_t *msgblock; - - /* ICBM Cookie. */ - aim_icbm_makecookie(cookie); - - /* Channel ID */ - channel = byte_stream_get16(bs); - - if (channel != 0x01) { - purple_debug_misc("oscar", "icbm: ICBM recieved on unsupported channel. Ignoring. (chan = %04x)\n", channel); - return 0; - } - - bnlen = byte_stream_get8(bs); - bn = byte_stream_getstr(bs, bnlen); - - tlvlist = aim_tlvlist_read(bs); - - if (aim_tlv_gettlv(tlvlist, 0x0003, 1)) - icbmflags |= AIM_IMFLAGS_ACK; - if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) - icbmflags |= AIM_IMFLAGS_AWAY; - - if ((msgblock = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { - ByteStream mbs; - int featurelen, msglen; - - byte_stream_init(&mbs, msgblock->value, msgblock->length); - - byte_stream_get8(&mbs); - byte_stream_get8(&mbs); - for (featurelen = byte_stream_get16(&mbs); featurelen; featurelen--) - byte_stream_get8(&mbs); - byte_stream_get8(&mbs); - byte_stream_get8(&mbs); - - msglen = byte_stream_get16(&mbs) - 4; /* final block length */ - - flag1 = byte_stream_get16(&mbs); - flag2 = byte_stream_get16(&mbs); - - msg = byte_stream_getstr(&mbs, msglen); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, msg, icbmflags, flag1, flag2); - - g_free(bn); - g_free(msg); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Ahh, the joys of nearly ridiculous over-engineering. - * - * Not only do AIM ICBM's support multiple channels. Not only do they - * support multiple character sets. But they support multiple character - * sets / encodings within the same ICBM. - * - * These multipart messages allow for complex space savings techniques, which - * seem utterly unnecessary by today's standards. In fact, there is only - * one client still in popular use that still uses this method: AOL for the - * Macintosh, Version 5.0. Obscure, yes, I know. - * - * In modern (non-"legacy") clients, if the user tries to send a character - * that is not ISO-8859-1 or ASCII, the client will send the entire message - * as UNICODE, meaning that every character in the message will occupy the - * full 16 bit UNICODE field, even if the high order byte would be zero. - * Multipart messages prevent this wasted space by allowing the client to - * only send the characters in UNICODE that need to be sent that way, and - * the rest of the message can be sent in whatever the native character - * set is (probably ASCII). - * - * An important note is that sections will be displayed in the order that - * they appear in the ICBM. There is no facility for merging or rearranging - * sections at run time. So if you have, say, ASCII then UNICODE then ASCII, - * you must supply two ASCII sections with a UNICODE in the middle, and incur - * the associated overhead. - * - * Normally I would have laughed and given a firm 'no' to supporting this - * seldom-used feature, but something is attracting me to it. In the future, - * it may be possible to abuse this to send mixed-media messages to other - * open source clients (like encryption or something) -- see faimtest for - * examples of how to do this. - * - * I would definitely recommend avoiding this feature unless you really - * know what you are doing, and/or you have something neat to do with it. - * - */ -int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm) -{ - - memset(mpm, 0, sizeof(aim_mpmsg_t)); - - return 0; -} - -static int mpmsg_addsection(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, gchar *data, guint16 datalen) -{ - aim_mpmsg_section_t *sec; - - sec = g_malloc(sizeof(aim_mpmsg_section_t)); - - sec->charset = charset; - sec->charsubset = charsubset; - sec->data = data; - sec->datalen = datalen; - sec->next = NULL; - - if (!mpm->parts) - mpm->parts = sec; - else { - aim_mpmsg_section_t *cur; - - for (cur = mpm->parts; cur->next; cur = cur->next) - ; - cur->next = sec; - } - - mpm->numparts++; - - return 0; -} - -int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen) -{ - gchar *dup; - - dup = g_malloc(datalen); - memcpy(dup, data, datalen); - - if (mpmsg_addsection(od, mpm, charset, charsubset, dup, datalen) == -1) { - g_free(dup); - return -1; - } - - return 0; -} - -/* XXX - should provide a way of saying ISO-8859-1 specifically */ -int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii) -{ - gchar *dup; - - if (!(dup = g_strdup(ascii))) - return -1; - - if (mpmsg_addsection(od, mpm, 0x0000, 0x0000, dup, strlen(ascii)) == -1) { - g_free(dup); - return -1; - } - - return 0; -} - -int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen) -{ - gchar *buf; - ByteStream bs; - int i; - - buf = g_malloc(unicodelen * 2); - - byte_stream_init(&bs, (guchar *)buf, unicodelen * 2); - - /* We assume unicode is in /host/ byte order -- convert to network */ - for (i = 0; i < unicodelen; i++) - byte_stream_put16(&bs, unicode[i]); - - if (mpmsg_addsection(od, mpm, 0x0002, 0x0000, buf, byte_stream_curpos(&bs)) == -1) { - g_free(buf); - return -1; - } - - return 0; -} - -void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm) -{ - aim_mpmsg_section_t *cur; - - for (cur = mpm->parts; cur; ) { - aim_mpmsg_section_t *tmp; - - tmp = cur->next; - g_free(cur->data); - g_free(cur); - cur = tmp; - } - - mpm->numparts = 0; - mpm->parts = NULL; - - return; -} - -/* - * Start by building the multipart structures, then pick the first - * human-readable section and stuff it into args->msg so no one gets - * suspicious. - */ -static int incomingim_ch1_parsemsgs(OscarData *od, aim_userinfo_t *userinfo, guint8 *data, int len, struct aim_incomingim_ch1_args *args) -{ - /* Should this be ASCII -> UNICODE -> Custom */ - static const guint16 charsetpri[] = { - AIM_CHARSET_ASCII, /* ASCII first */ - AIM_CHARSET_LATIN_1, /* then ISO-8859-1 */ - AIM_CHARSET_UNICODE, /* UNICODE as last resort */ - }; - static const int charsetpricount = 3; - int i; - ByteStream mbs; - aim_mpmsg_section_t *sec; - - byte_stream_init(&mbs, data, len); - - while (byte_stream_empty(&mbs)) { - guint16 msglen, flag1, flag2; - gchar *msgbuf; - - byte_stream_get8(&mbs); /* 01 */ - byte_stream_get8(&mbs); /* 01 */ - - /* Message string length, including character set info. */ - msglen = byte_stream_get16(&mbs); - if (msglen > byte_stream_empty(&mbs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - - /* Character set info */ - flag1 = byte_stream_get16(&mbs); - flag2 = byte_stream_get16(&mbs); - - /* Message. */ - msglen -= 4; - - /* - * For now, we don't care what the encoding is. Just copy - * it into a multipart struct and deal with it later. However, - * always pad the ending with a NULL. This makes it easier - * to treat ASCII sections as strings. It won't matter for - * UNICODE or binary data, as you should never read past - * the specified data length, which will not include the pad. - * - * XXX - There's an API bug here. For sending, the UNICODE is - * given in host byte order (aim_mpmsg_addunicode), but here - * the received messages are given in network byte order. - * - */ - msgbuf = (gchar *)byte_stream_getraw(&mbs, msglen); - mpmsg_addsection(od, &args->mpmsg, flag1, flag2, msgbuf, msglen); - - } /* while */ - - args->icbmflags |= AIM_IMFLAGS_MULTIPART; /* always set */ - - /* - * Clients that support multiparts should never use args->msg, as it - * will point to an arbitrary section. - * - * Here, we attempt to provide clients that do not support multipart - * messages with something to look at -- hopefully a human-readable - * string. But, failing that, a UNICODE message, or nothing at all. - * - * Which means that even if args->msg is NULL, it does not mean the - * message was blank. - * - */ - for (i = 0; i < charsetpricount; i++) { - for (sec = args->mpmsg.parts; sec; sec = sec->next) { - - if (sec->charset != charsetpri[i]) - continue; - - /* Great. We found one. Fill it in. */ - args->charset = sec->charset; - args->charsubset = sec->charsubset; - - /* Set up the simple flags */ - switch (args->charsubset) - { - case 0x0000: - /* standard subencoding? */ - break; - case 0x000b: - args->icbmflags |= AIM_IMFLAGS_SUBENC_MACINTOSH; - break; - case 0xffff: - /* no subencoding */ - break; - default: - break; - } - - args->msg = sec->data; - args->msglen = sec->datalen; - - return 0; - } - } - - /* No human-readable sections found. Oh well. */ - args->charset = args->charsubset = 0xffff; - args->msg = NULL; - args->msglen = 0; - - return 0; -} - -static int incomingim_ch1(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, ByteStream *bs, guint8 *cookie) -{ - guint16 type, length, magic1, msglen = 0; - aim_rxcallback_t userfunc; - int ret = 0; - int rev = 0; - struct aim_incomingim_ch1_args args; - unsigned int endpos; - - memset(&args, 0, sizeof(args)); - - aim_mpmsg_init(od, &args.mpmsg); - - /* - * This used to be done using tlvchains. For performance reasons, - * I've changed it to process the TLVs in-place. This avoids lots - * of per-IM memory allocations. - */ - while (byte_stream_empty(bs) >= 4) - { - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - - if (length > byte_stream_empty(bs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - - endpos = byte_stream_curpos(bs) + length; - - if (type == 0x0002) { /* Message Block */ - - /* - * This TLV consists of the following: - * - 0501 -- Unknown - * - Features: Don't know how to interpret these - * - 0101 -- Unknown - * - Message - * - * Slick and possible others reverse 'Features' and 'Messages' section. - * Thus, the TLV could have following layout: - * - 0101 -- Unknown (possibly magic for message section) - * - Message - * - 0501 -- Unknown (possibly magic for features section) - * - Features: Don't know how to interpret these - */ - - magic1 = byte_stream_get16(bs); /* 0501 or 0101 */ - if (magic1 == 0x101) /* Bad, message comes before attributes */ - { - /* Jump to the features section */ - msglen = byte_stream_get16(bs); - bs->offset += msglen; - rev = 1; - - magic1 = byte_stream_get16(bs); /* 0501 */ - } - - if (magic1 != 0x501) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - - args.featureslen = byte_stream_get16(bs); - if (args.featureslen > byte_stream_empty(bs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - if (args.featureslen == 0) - { - args.features = NULL; - } - else - { - args.features = byte_stream_getraw(bs, args.featureslen); - args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES; - } - - if (rev) - { - /* Fix buffer back to message */ - bs->offset -= args.featureslen + 2 + 2 + msglen + 2 + 2; - } - - magic1 = byte_stream_get16(bs); /* 01 01 */ - if (magic1 != 0x101) /* Bad, message comes before attributes */ - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - msglen = byte_stream_get16(bs); - - /* - * The rest of the TLV contains one or more message - * blocks... - */ - incomingim_ch1_parsemsgs(od, userinfo, bs->data + bs->offset - 2 - 2 /* XXX evil!!! */, msglen + 2 + 2, &args); - - } else if (type == 0x0003) { /* Server Ack Requested */ - - args.icbmflags |= AIM_IMFLAGS_ACK; - - } else if (type == 0x0004) { /* Message is Auto Response */ - - args.icbmflags |= AIM_IMFLAGS_AWAY; - - } else if (type == 0x0006) { /* Message was received offline. */ - - /* - * This flag is set on incoming offline messages for both - * AIM and ICQ accounts. - */ - args.icbmflags |= AIM_IMFLAGS_OFFLINE; - - } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ - - args.iconlen = byte_stream_get32(bs); - byte_stream_get16(bs); /* 0x0001 */ - args.iconsum = byte_stream_get16(bs); - args.iconstamp = byte_stream_get32(bs); - - /* - * This looks to be a client bug. MacAIM 4.3 will - * send this tag, but with all zero values, in the - * first message of a conversation. This makes no - * sense whatsoever, so I'm going to say its a bug. - * - * You really shouldn't advertise a zero-length icon - * anyway. - * - */ - if (args.iconlen) - args.icbmflags |= AIM_IMFLAGS_HASICON; - - } else if (type == 0x0009) { - - args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; - - } else if (type == 0x000b) { /* Non-direct connect typing notification */ - - args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; - - } else if (type == 0x0016) { - - /* - * UTC timestamp for when the message was sent. Only - * provided for offline messages. - */ - args.timestamp = byte_stream_get32(bs); - - } else if (type == 0x0017) { - - if (length > byte_stream_empty(bs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - g_free(args.extdata); - args.extdatalen = length; - if (args.extdatalen == 0) - args.extdata = NULL; - else - args.extdata = byte_stream_getraw(bs, args.extdatalen); - - } else { - purple_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length); - } - - /* - * This is here to protect ourselves from ourselves. That - * is, if something above doesn't completely parse its value - * section, or, worse, overparses it, this will set the - * stream where it needs to be in order to land on the next - * TLV when the loop continues. - * - */ - byte_stream_setpos(bs, endpos); - } - - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, userinfo, &args); - - aim_mpmsg_free(od, &args.mpmsg); - g_free(args.features); - g_free(args.extdata); - - return ret; -} - -static void -incomingim_ch2_buddylist(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - /* - * This goes like this... - * - * group name length - * group name - * num of buddies in group - * buddy name length - * buddy name - * buddy name length - * buddy name - * ... - * group name length - * group name - * num of buddies in group - * buddy name length - * buddy name - * ... - * ... - */ - while (byte_stream_empty(servdata)) - { - guint16 gnlen, numb; - int i; - char *gn; - - gnlen = byte_stream_get16(servdata); - gn = byte_stream_getstr(servdata, gnlen); - numb = byte_stream_get16(servdata); - - for (i = 0; i < numb; i++) { - guint16 bnlen; - char *bn; - - bnlen = byte_stream_get16(servdata); - bn = byte_stream_getstr(servdata, bnlen); - - purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->bn, gn, bn); - - g_free(bn); - } - - g_free(gn); - } - - return; -} - -static void -incomingim_ch2_buddyicon_free(OscarData *od, IcbmArgsCh2 *args) -{ - g_free(args->info.icon.icon); - - return; -} - -static void -incomingim_ch2_buddyicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - args->info.icon.checksum = byte_stream_get32(servdata); - args->info.icon.length = byte_stream_get32(servdata); - args->info.icon.timestamp = byte_stream_get32(servdata); - args->info.icon.icon = byte_stream_getraw(servdata, args->info.icon.length); - - args->destructor = (void *)incomingim_ch2_buddyicon_free; - - return; -} - -static void -incomingim_ch2_chat_free(OscarData *od, IcbmArgsCh2 *args) -{ - /* XXX - aim_chat_roominfo_free() */ - g_free(args->info.chat.roominfo.name); - - return; -} - -static void -incomingim_ch2_chat(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - /* - * Chat room info. - */ - aim_chat_readroominfo(servdata, &args->info.chat.roominfo); - - args->destructor = (void *)incomingim_ch2_chat_free; -} - -static void -incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args) -{ - g_free((char *)args->info.rtfmsg.rtfmsg); -} - -/* - * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is - * kind of odd. This sends the client ICQRTF since that is all that I've seen - * SERVERRELAY used for. - * - * Note that this is all little-endian. Cringe. - * - */ -static void -incomingim_ch2_icqserverrelay(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - guint16 hdrlen, anslen, msglen; - - if (byte_stream_empty(servdata) < 24) - /* Someone sent us a short server relay ICBM. Weird. (Maybe?) */ - return; - - hdrlen = byte_stream_getle16(servdata); - byte_stream_advance(servdata, hdrlen); - - hdrlen = byte_stream_getle16(servdata); - byte_stream_advance(servdata, hdrlen); - - args->info.rtfmsg.msgtype = byte_stream_getle16(servdata); - - anslen = byte_stream_getle32(servdata); - byte_stream_advance(servdata, anslen); - - msglen = byte_stream_getle16(servdata); - args->info.rtfmsg.rtfmsg = byte_stream_getstr(servdata, msglen); - - args->info.rtfmsg.fgcolor = byte_stream_getle32(servdata); - args->info.rtfmsg.bgcolor = byte_stream_getle32(servdata); - - hdrlen = byte_stream_getle32(servdata); - byte_stream_advance(servdata, hdrlen); - - args->destructor = (void *)incomingim_ch2_icqserverrelay_free; -} - -static void -incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args) -{ - g_free(args->info.sendfile.filename); -} - -/* Someone is sending us a file */ -static void -incomingim_ch2_sendfile(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - int flen; - - args->destructor = (void *)incomingim_ch2_sendfile_free; - - /* Maybe there is a better way to tell what kind of sendfile - * this is? Maybe TLV t(000a)? */ - - /* subtype is one of AIM_OFT_SUBTYPE_* */ - args->info.sendfile.subtype = byte_stream_get16(servdata); - args->info.sendfile.totfiles = byte_stream_get16(servdata); - args->info.sendfile.totsize = byte_stream_get32(servdata); - - /* - * I hope to God I'm right when I guess that there is a - * 32 char max filename length for single files. I think - * OFT tends to do that. Gotta love inconsistency. I saw - * a 26 byte filename? - */ - /* AAA - create an byte_stream_getnullstr function (don't anymore)(maybe) */ - /* Use an inelegant way of getting the null-terminated filename, - * since there's no easy bstream routine. */ - for (flen = 0; byte_stream_get8(servdata); flen++); - byte_stream_advance(servdata, -flen -1); - args->info.sendfile.filename = byte_stream_getstr(servdata, flen); - - /* There is sometimes more after the null-terminated filename, - * but I'm unsure of its format. */ - /* I don't believe him. */ - /* There is sometimes a null byte inside a unicode filename, - * but as far as I can tell the filename is the last - * piece of data that will be in this message. --Jonathan */ -} - -typedef void (*ch2_args_destructor_t)(OscarData *od, IcbmArgsCh2 *args); - -static int incomingim_ch2(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie) -{ - aim_rxcallback_t userfunc; - aim_tlv_t *block1, *servdatatlv; - GSList *list2; - aim_tlv_t *tlv; - IcbmArgsCh2 args; - ByteStream bbs, sdbs, *sdbsptr = NULL; - guint8 *cookie2; - int ret = 0; - - char proxyip[30] = {""}; - char clientip[30] = {""}; - char verifiedip[30] = {""}; - - memset(&args, 0, sizeof(args)); - - /* - * There's another block of TLVs embedded in the type 5 here. - */ - block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1); - if (block1 == NULL) - { - /* The server sent us ch2 ICBM without ch2 info? Weird. */ - return 1; - } - byte_stream_init(&bbs, block1->value, block1->length); - - /* - * First two bytes represent the status of the connection. - * One of the AIM_RENDEZVOUS_ defines. - * - * 0 is a request, 1 is a cancel, 2 is an accept - */ - args.status = byte_stream_get16(&bbs); - - /* - * Next comes the cookie. Should match the ICBM cookie. - */ - cookie2 = byte_stream_getraw(&bbs, 8); - if (memcmp(cookie, cookie2, 8) != 0) - { - purple_debug_warning("oscar", - "Cookies don't match in rendezvous ICBM, bailing out.\n"); - g_free(cookie2); - return 1; - } - memcpy(args.cookie, cookie2, 8); - g_free(cookie2); - - /* - * The next 16bytes are a capability block so we can - * identify what type of rendezvous this is. - */ - args.type = aim_locate_getcaps(od, &bbs, 0x10); - - /* - * What follows may be TLVs or nothing, depending on the - * purpose of the message. - * - * Ack packets for instance have nothing more to them. - */ - list2 = aim_tlvlist_read(&bbs); - - /* - * IP address to proxy the file transfer through. - * - * TODO: I don't like this. Maybe just read in an int? Or inet_ntoa... - */ - tlv = aim_tlv_gettlv(list2, 0x0002, 1); - if ((tlv != NULL) && (tlv->length == 4)) - snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu", - tlv->value[0], tlv->value[1], - tlv->value[2], tlv->value[3]); - - /* - * IP address from the perspective of the client. - */ - tlv = aim_tlv_gettlv(list2, 0x0003, 1); - if ((tlv != NULL) && (tlv->length == 4)) - snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu", - tlv->value[0], tlv->value[1], - tlv->value[2], tlv->value[3]); - - /* - * Verified IP address (from the perspective of Oscar). - * - * This is added by the server. - */ - tlv = aim_tlv_gettlv(list2, 0x0004, 1); - if ((tlv != NULL) && (tlv->length == 4)) - snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu", - tlv->value[0], tlv->value[1], - tlv->value[2], tlv->value[3]); - - /* - * Port number for something. - */ - if (aim_tlv_gettlv(list2, 0x0005, 1)) - args.port = aim_tlv_get16(list2, 0x0005, 1); - - /* - * File transfer "request number": - * 0x0001 - Initial file transfer request for no proxy or stage 1 proxy - * 0x0002 - "Reply request" for a stage 2 proxy (receiver wants to use proxy) - * 0x0003 - A third request has been sent; applies only to stage 3 proxied transfers - */ - if (aim_tlv_gettlv(list2, 0x000a, 1)) - args.requestnumber = aim_tlv_get16(list2, 0x000a, 1); - - /* - * Terminate connection/error code. 0x0001 means the other user - * canceled the connection. - */ - if (aim_tlv_gettlv(list2, 0x000b, 1)) - args.errorcode = aim_tlv_get16(list2, 0x000b, 1); - - /* - * Invitation message / chat description. - */ - if (aim_tlv_gettlv(list2, 0x000c, 1)) { - args.msg = aim_tlv_getstr(list2, 0x000c, 1); - args.msglen = aim_tlv_getlength(list2, 0x000c, 1); - } - - /* - * Character set. - */ - if (aim_tlv_gettlv(list2, 0x000d, 1)) - args.encoding = aim_tlv_getstr(list2, 0x000d, 1); - - /* - * Language. - */ - if (aim_tlv_gettlv(list2, 0x000e, 1)) - args.language = aim_tlv_getstr(list2, 0x000e, 1); - -#if 0 - /* - * Unknown -- no value - * - * Maybe means we should connect directly to transfer the file? - * Also used in ICQ Lite Beta 4.0 URLs. Also empty. - */ - /* I don't think this indicates a direct transfer; this flag is - * also present in a stage 1 proxied file send request -- Jonathan */ - if (aim_tlv_gettlv(list2, 0x000f, 1)) { - /* Unhandled */ - } -#endif - - /* - * Flag meaning we should proxy the file transfer through an AIM server - */ - if (aim_tlv_gettlv(list2, 0x0010, 1)) - args.use_proxy = TRUE; - - if (strlen(proxyip)) - args.proxyip = (char *)proxyip; - if (strlen(clientip)) - args.clientip = (char *)clientip; - if (strlen(verifiedip)) - args.verifiedip = (char *)verifiedip; - - /* - * This must be present in PROPOSALs, but will probably not - * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite - * Beta 4.0 URLs (OSCAR_CAPABILITY_ICQSERVERRELAY). - * - * Service Data blocks are module-specific in format. - */ - if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) { - - byte_stream_init(&sdbs, servdatatlv->value, servdatatlv->length); - sdbsptr = &sdbs; - - /* - * The rest of the handling depends on what type it is. - * - * Not all of them have special handling (yet). - */ - if (args.type & OSCAR_CAPABILITY_BUDDYICON) - incomingim_ch2_buddyicon(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_SENDBUDDYLIST) - incomingim_ch2_buddylist(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_CHAT) - incomingim_ch2_chat(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_ICQSERVERRELAY) - incomingim_ch2_icqserverrelay(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_SENDFILE) - incomingim_ch2_sendfile(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, userinfo, &args); - - - if (args.destructor) - ((ch2_args_destructor_t)args.destructor)(od, &args); - - g_free((char *)args.msg); - g_free((char *)args.encoding); - g_free((char *)args.language); - - aim_tlvlist_free(list2); - - return ret; -} - -static int incomingim_ch4(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie) -{ - ByteStream meat; - aim_rxcallback_t userfunc; - aim_tlv_t *block; - struct aim_incomingim_ch4_args args; - int ret = 0; - - /* - * Make a bstream for the meaty part. Yum. Meat. - */ - if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1))) - return -1; - byte_stream_init(&meat, block->value, block->length); - - args.uin = byte_stream_getle32(&meat); - args.type = byte_stream_getle8(&meat); - args.flags = byte_stream_getle8(&meat); - if (args.type == 0x1a) - /* There seems to be a problem with the length in SMS msgs from server, this fixed it */ - args.msglen = block->length - 6; - else - args.msglen = byte_stream_getle16(&meat); - args.msg = (gchar *)byte_stream_getraw(&meat, args.msglen); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, userinfo, &args); - - g_free(args.msg); - - return ret; -} - -/* - * Subtype 0x0007 - * - * It can easily be said that parsing ICBMs is THE single - * most difficult thing to do in the in AIM protocol. In - * fact, I think I just did say that. - * - * Below is the best damned solution I've come up with - * over the past sixteen months of battling with it. This - * can parse both away and normal messages from every client - * I have access to. Its not fast, its not clean. But it works. - * - */ -static int incomingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - guchar *cookie; - guint16 channel; - aim_userinfo_t userinfo; - - memset(&userinfo, 0x00, sizeof(aim_userinfo_t)); - - /* - * Read ICBM Cookie. - */ - cookie = byte_stream_getraw(bs, 8); - - /* - * Channel ID. - * - * Channel 0x0001 is the message channel. It is - * used to send basic ICBMs. - * - * Channel 0x0002 is the Rendezvous channel, which - * is where Chat Invitiations and various client-client - * connection negotiations come from. - * - * Channel 0x0003 is used for chat messages. - * - * Channel 0x0004 is used for ICQ authorization, or - * possibly any system notice. - * - */ - channel = byte_stream_get16(bs); - - /* - * Extract the standard user info block. - * - * Note that although this contains TLVs that appear contiguous - * with the TLVs read below, they are two different pieces. The - * userinfo block contains the number of TLVs that contain user - * information, the rest are not even though there is no separation. - * You can start reading the message TLVs after aim_info_extract() - * parses out the standard userinfo block. - * - * That also means that TLV types can be duplicated between the - * userinfo block and the rest of the message, however there should - * never be two TLVs of the same type in one block. - * - */ - aim_info_extract(od, bs, &userinfo); - - /* - * From here on, its depends on what channel we're on. - * - * Technically all channels have a TLV list have this, however, - * for the common channel 1 case, in-place parsing is used for - * performance reasons (less memory allocation). - */ - if (channel == 1) { - - ret = incomingim_ch1(od, conn, mod, frame, snac, channel, &userinfo, bs, cookie); - - } else if (channel == 2) { - GSList *tlvlist; - - /* - * Read block of TLVs (not including the userinfo data). All - * further data is derived from what is parsed here. - */ - tlvlist = aim_tlvlist_read(bs); - - ret = incomingim_ch2(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); - - aim_tlvlist_free(tlvlist); - - } else if (channel == 4) { - GSList *tlvlist; - - tlvlist = aim_tlvlist_read(bs); - ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); - aim_tlvlist_free(tlvlist); - - } else { - purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); - } - - aim_info_free(&userinfo); - g_free(cookie); - - return ret; -} - -/* - * Subtype 0x0008 - Send a warning to bn. - * - * Flags: - * AIM_WARN_ANON Send as an anonymous (doesn't count as much) - * - * returns -1 on error (couldn't alloc packet), 0 on success. - * - */ -int aim_im_warn(OscarData *od, FlapConnection *conn, const char *bn, guint32 flags) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !conn || !bn) - return -EINVAL; - - byte_stream_new(&bs, strlen(bn)+3); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0008, 0x0000, bn, strlen(bn)+1); - - byte_stream_put16(&bs, (flags & AIM_WARN_ANON) ? 0x0001 : 0x0000); - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0008, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* Subtype 0x000a */ -static int missedcall(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 channel, nummissed, reason; - aim_userinfo_t userinfo; - - while (byte_stream_empty(bs)) { - - channel = byte_stream_get16(bs); - aim_info_extract(od, bs, &userinfo); - nummissed = byte_stream_get16(bs); - reason = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, &userinfo, nummissed, reason); - - aim_info_free(&userinfo); - } - - return ret; -} - -/* - * Subtype 0x000b - * - * Possible codes: - * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support" - * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer" - * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers" - * - */ -int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - byte_stream_new(&bs, 8+2+1+strlen(bn)+6); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0); - - byte_stream_putraw(&bs, cookie, 8); - - byte_stream_put16(&bs, 0x0002); /* channel */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - aim_tlvlist_add_16(&tlvlist, 0x0003, code); - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static void parse_status_note_text(OscarData *od, guchar *cookie, char *bn, ByteStream *bs) -{ - struct aim_icq_info *info; - struct aim_icq_info *prev_info; - char *response; - char *encoding; - char *stripped_encoding; - char *status_note_title; - char *status_note_text; - char *stripped_status_note_text; - char *status_note; - guint32 length; - guint16 version; - guint32 capability; - guint8 message_type; - guint16 status_code; - guint16 text_length; - guint32 request_length; - guint32 response_length; - guint32 encoding_length; - PurpleAccount *account; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - - for (prev_info = NULL, info = od->icq_info; info != NULL; prev_info = info, info = info->next) - { - if (memcmp(&info->icbm_cookie, cookie, 8) == 0) - { - if (prev_info == NULL) - od->icq_info = info->next; - else - prev_info->next = info->next; - - break; - } - } - - if (info == NULL) - return; - - status_note_title = info->status_note_title; - g_free(info); - - length = byte_stream_getle16(bs); - if (length != 27) { - purple_debug_misc("oscar", "clientautoresp: incorrect header " - "size; expected 27, received %u.\n", length); - g_free(status_note_title); - return; - } - - version = byte_stream_getle16(bs); - if (version != 9) { - purple_debug_misc("oscar", "clientautoresp: incorrect version; " - "expected 9, received %u.\n", version); - g_free(status_note_title); - return; - } - - capability = aim_locate_getcaps(od, bs, 0x10); - if (capability != OSCAR_CAPABILITY_EMPTY) { - purple_debug_misc("oscar", "clientautoresp: plugin ID is not null.\n"); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 2); /* unknown */ - byte_stream_advance(bs, 4); /* client capabilities flags */ - byte_stream_advance(bs, 1); /* unknown */ - byte_stream_advance(bs, 2); /* downcouner? */ - - length = byte_stream_getle16(bs); - if (length != 14) { - purple_debug_misc("oscar", "clientautoresp: incorrect header " - "size; expected 14, received %u.\n", length); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 2); /* downcounter? */ - byte_stream_advance(bs, 12); /* unknown */ - - message_type = byte_stream_get8(bs); - if (message_type != 0x1a) { - purple_debug_misc("oscar", "clientautoresp: incorrect message " - "type; expected 0x1a, received 0x%x.\n", message_type); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 1); /* message flags */ - - status_code = byte_stream_getle16(bs); - if (status_code != 0) { - purple_debug_misc("oscar", "clientautoresp: incorrect status " - "code; expected 0, received %u.\n", status_code); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 2); /* priority code */ - - text_length = byte_stream_getle16(bs); - byte_stream_advance(bs, text_length); /* text */ - - length = byte_stream_getle16(bs); - byte_stream_advance(bs, 18); /* unknown */ - - request_length = byte_stream_getle32(bs); - if (length != 18 + 4 + request_length + 17) { - purple_debug_misc("oscar", "clientautoresp: incorrect block; " - "expected length is %u, got %u.\n", - 18 + 4 + request_length + 17, length); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, request_length); /* x request */ - byte_stream_advance(bs, 17); /* unknown */ - - length = byte_stream_getle32(bs); - response_length = byte_stream_getle32(bs); - response = byte_stream_getstr(bs, response_length); - encoding_length = byte_stream_getle32(bs); - if (length != 4 + response_length + 4 + encoding_length) { - purple_debug_misc("oscar", "clientautoresp: incorrect block; " - "expected length is %u, got %u.\n", - 4 + response_length + 4 + encoding_length, length); - g_free(status_note_title); - g_free(response); - return; - } - - encoding = byte_stream_getstr(bs, encoding_length); - - account = purple_connection_get_account(od->gc); - - stripped_encoding = oscar_encoding_extract(encoding); - status_note_text = oscar_encoding_to_utf8(account, stripped_encoding, response, response_length); - stripped_status_note_text = purple_markup_strip_html(status_note_text); - - if (stripped_status_note_text != NULL && stripped_status_note_text[0] != 0) - status_note = g_strdup_printf("%s: %s", status_note_title, stripped_status_note_text); - else - status_note = g_strdup(status_note_title); - - g_free(status_note_title); - g_free(response); - g_free(encoding); - g_free(stripped_encoding); - g_free(status_note_text); - g_free(stripped_status_note_text); - - buddy = purple_find_buddy(account, bn); - if (buddy == NULL) - { - purple_debug_misc("oscar", "clientautoresp: buddy %s was not found.\n", bn); - g_free(status_note); - return; - } - - purple_debug_misc("oscar", "clientautoresp: setting status " - "message to \"%s\".\n", status_note); - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - purple_prpl_got_user_status(account, bn, - purple_status_get_id(status), - "message", status_note, NULL); - - g_free(status_note); -} - -/* - * Subtype 0x000b - Receive the response from an ICQ status message - * request (in which case this contains the ICQ status message) or - * a file transfer or direct IM request was declined. - */ -static int clientautoresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 channel, reason; - char *bn; - guchar *cookie; - guint8 bnlen; - - cookie = byte_stream_getraw(bs, 8); - channel = byte_stream_get16(bs); - bnlen = byte_stream_get8(bs); - bn = byte_stream_getstr(bs, bnlen); - reason = byte_stream_get16(bs); - - if (channel == 0x0002) - { - if (reason == 0x0003) /* channel-specific */ - /* parse status note text */ - parse_status_note_text(od, cookie, bn, bs); - - byte_stream_get16(bs); /* Unknown */ - byte_stream_get16(bs); /* Unknown */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, reason, cookie); - - } else if (channel == 0x0004) { /* ICQ message */ - switch (reason) { - case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */ - guint8 statusmsgtype, *msg; - guint16 len; - guint32 state; - - len = byte_stream_getle16(bs); /* Should be 0x001b */ - byte_stream_advance(bs, len); /* Unknown */ - - len = byte_stream_getle16(bs); /* Should be 0x000e */ - byte_stream_advance(bs, len); /* Unknown */ - - statusmsgtype = byte_stream_getle8(bs); - switch (statusmsgtype) { - case 0xe8: - state = AIM_ICQ_STATE_AWAY; - break; - case 0xe9: - state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; - break; - case 0xea: - state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT; - break; - case 0xeb: - state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; - break; - case 0xec: - state = AIM_ICQ_STATE_CHAT; - break; - default: - state = 0; - break; - } - - byte_stream_getle8(bs); /* Unknown - 0x03 Maybe this means this is an auto-reply */ - byte_stream_getle16(bs); /* Unknown - 0x0000 */ - byte_stream_getle16(bs); /* Unknown - 0x0000 */ - - len = byte_stream_getle16(bs); - msg = byte_stream_getraw(bs, len); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, reason, state, msg); - - g_free(msg); - } break; - - default: { - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, reason); - } break; - } /* end switch */ - } - - g_free(cookie); - g_free(bn); - - return ret; -} - -/* - * Subtype 0x000c - Receive an ack after sending an ICBM. - * - * You have to have send the message with the AIM_IMFLAGS_ACK flag set - * (TLV t(0003)). The ack contains the ICBM header of the message you - * sent. - * - */ -static int msgack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - guint16 ch; - guchar *cookie; - char *bn; - int ret = 0; - - cookie = byte_stream_getraw(bs, 8); - ch = byte_stream_get16(bs); - bn = byte_stream_getstr(bs, byte_stream_get8(bs)); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, ch, bn); - - g_free(bn); - g_free(cookie); - - return ret; -} - -/* - * Subtype 0x0010 - Request any offline messages that are waiting for - * us. This is the "new" way of handling offline messages which is - * used for both AIM and ICQ. The old way is to use the ugly - * aim_icq_reqofflinemsgs() function, but that is no longer necessary. - * - * We set the 0x00000100 flag on the ICBM message parameters, which - * tells the oscar servers that we support offline messages. When we - * set that flag the servers do not automatically send us offline - * messages. Instead we must request them using this function. This - * should happen after sending the 0x0001/0x0002 "client online" SNAC. - */ -int aim_im_reqofflinemsgs(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_ICBM, 0x0010); - - return 0; -} - -/* - * Subtype 0x0014 - Send a mini typing notification (mtn) packet. - * - * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, - * and Purple 0.60 and newer. - * - */ -int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) - return -EINVAL; - - if (!bn) - return -EINVAL; - - byte_stream_new(&bs, 11+strlen(bn)+2); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0); - - /* ICBM cookie */ - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - - /* - * Channel (should be 0x0001 for mtn) - */ - byte_stream_put16(&bs, channel); - - /* - * Dest buddy name - */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* - * Event (should be 0x0000, 0x0001, or 0x0002 for mtn) - */ - byte_stream_put16(&bs, event); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. - * - * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, - * and Purple 0.60 and newer. - * - */ -static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *bn; - guint8 bnlen; - guint16 channel, event; - - byte_stream_advance(bs, 8); /* ICBM cookie */ - channel = byte_stream_get16(bs); - bnlen = byte_stream_get8(bs); - bn = byte_stream_getstr(bs, bnlen); - event = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, event); - - g_free(bn); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0005) - return aim_im_paraminfo(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0006) - return outgoingim(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0007) - return incomingim(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000a) - return missedcall(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000b) - return clientautoresp(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000c) - return msgack(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0014) - return mtn_receive(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -msg_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ICBM; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "messaging", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_icq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,897 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0015 - Encapsulated ICQ. - * - */ - -#include "oscar.h" - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -int aim_icq_reqofflinemsgs(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - purple_debug_info("oscar", "Requesting offline messages\n"); - - bslen = 2 + 4 + 2 + 2; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x003c); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -int aim_icq_ackofflinemsgs(OscarData *od) -{ - ByteStream bs; - FlapFrame *frame; - aim_snacid_t snacid; - int bslen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - purple_debug_info("oscar", "Acknowledged receipt of offline messages\n"); - - bslen = 2 + 4 + 2 + 2; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x003e); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - -int -aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2+4+2+2+2+2+2+1+1+1+1+1+1; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x0c3a); /* shrug. */ - byte_stream_putle16(&bs, 0x030c); - byte_stream_putle16(&bs, 0x0001); - byte_stream_putle8(&bs, webaware); - byte_stream_putle8(&bs, 0xf8); - byte_stream_putle8(&bs, 0x02); - byte_stream_putle8(&bs, 0x01); - byte_stream_putle8(&bs, 0x00); - byte_stream_putle8(&bs, !auth_required); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Change your ICQ password. - * - * @param od The oscar session - * @param passwd The new password. If this is longer than 8 characters it - * will be truncated. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_icq_changepasswd(OscarData *od, const char *passwd) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen, passwdlen; - - if (!passwd) - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - passwdlen = strlen(passwd); - if (passwdlen > MAXICQPASSLEN) - passwdlen = MAXICQPASSLEN; - bslen = 2+4+2+2+2+2+passwdlen+1; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x042e); /* shrug. */ - byte_stream_putle16(&bs, passwdlen+1); - byte_stream_putstr(&bs, passwd); - byte_stream_putle8(&bs, '\0'); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -int aim_icq_getallinfo(OscarData *od, const char *uin) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - struct aim_icq_info *info; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x04b2); /* shrug. */ - byte_stream_putle32(&bs, atoi(uin)); - - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - /* Keep track of this request and the ICQ number and request ID */ - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); - info->reqid = snacid; - info->uin = atoi(uin); - info->next = od->icq_info; - od->icq_info = info; - - return 0; -} - -int aim_icq_getalias(OscarData *od, const char *uin) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - struct aim_icq_info *info; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - purple_debug_info("oscar", "Requesting ICQ alias for %s\n", uin); - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x04ba); /* shrug. */ - byte_stream_putle32(&bs, atoi(uin)); - - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - /* Keep track of this request and the ICQ number and request ID */ - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); - info->reqid = snacid; - info->uin = atoi(uin); - info->next = od->icq_info; - od->icq_info = info; - - return 0; -} - -int aim_icq_getsimpleinfo(OscarData *od, const char *uin) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x051f); /* shrug. */ - byte_stream_putle32(&bs, atoi(uin)); - - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - return 0; -} - -#if 0 -int aim_icq_sendxmlreq(OscarData *od, const char *xml) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!xml || !strlen(xml)) - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2 + 10 + 2 + strlen(xml) + 1; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x0998); /* shrug. */ - byte_stream_putle16(&bs, strlen(xml) + 1); - byte_stream_putraw(&bs, (guint8 *)xml, strlen(xml) + 1); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} -#endif - -/* - * Send an SMS message. This is the non-US way. The US-way is to IM - * their cell phone number (+19195551234). - * - * We basically construct and send an XML message. The format is: - * - * full_phone_without_leading_+ - * message - * 1252 - * self_uin - * self_name - * Yes|No - * - * - * - * Yeah hi Peter, whaaaat's happening. If there's any way to use - * a codepage other than 1252 that would be great. Thaaaanks. - */ -int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias) -{ - FlapConnection *conn; - PurpleAccount *account; - ByteStream bs; - aim_snacid_t snacid; - int bslen, xmllen; - char *xml; - const char *timestr, *username; - time_t t; - struct tm *tm; - gchar *stripped; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - if (!name || !msg || !alias) - return -EINVAL; - - account = purple_connection_get_account(od->gc); - username = purple_account_get_username(account); - - time(&t); - tm = gmtime(&t); - timestr = purple_utf8_strftime("%a, %d %b %Y %T %Z", tm); - - stripped = purple_markup_strip_html(msg); - - /* The length of xml included the null terminating character */ - xmllen = 209 + strlen(name) + strlen(stripped) + strlen(username) + strlen(alias) + strlen(timestr) + 1; - - xml = g_new(char, xmllen); - snprintf(xml, xmllen, "" - "%s" - "%s" - "1252" - "%s" - "%s" - "Yes" - "" - "", - name, stripped, username, alias, timestr); - - bslen = 36 + xmllen; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - - /* From libicq200-0.3.2/src/SNAC-SRV.cpp */ - byte_stream_putle16(&bs, 0x1482); - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, 0x0016); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, xmllen); - byte_stream_putstr(&bs, xml); - byte_stream_put8(&bs, 0x00); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - g_free(xml); - g_free(stripped); - - return 0; -} - -static void aim_icq_freeinfo(struct aim_icq_info *info) { - int i; - - if (!info) - return; - g_free(info->nick); - g_free(info->first); - g_free(info->last); - g_free(info->email); - g_free(info->homecity); - g_free(info->homestate); - g_free(info->homephone); - g_free(info->homefax); - g_free(info->homeaddr); - g_free(info->mobile); - g_free(info->homezip); - g_free(info->personalwebpage); - if (info->email2) - for (i = 0; i < info->numaddresses; i++) - g_free(info->email2[i]); - g_free(info->email2); - g_free(info->workcity); - g_free(info->workstate); - g_free(info->workphone); - g_free(info->workfax); - g_free(info->workaddr); - g_free(info->workzip); - g_free(info->workcompany); - g_free(info->workdivision); - g_free(info->workposition); - g_free(info->workwebpage); - g_free(info->info); - g_free(info->status_note_title); - g_free(info); -} - -/** - * Subtype 0x0003 - Response to SNAC_FAMILY_ICQ/0x002, contains an ICQesque packet. - */ -static int -icqresponse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - GSList *tlvlist; - aim_tlv_t *datatlv; - ByteStream qbs; - guint32 ouruin; - guint16 cmdlen, cmd, reqid; - - if (!(tlvlist = aim_tlvlist_read(bs)) || !(datatlv = aim_tlv_gettlv(tlvlist, 0x0001, 1))) { - aim_tlvlist_free(tlvlist); - purple_debug_misc("oscar", "corrupt ICQ response\n"); - return 0; - } - - byte_stream_init(&qbs, datatlv->value, datatlv->length); - - cmdlen = byte_stream_getle16(&qbs); - ouruin = byte_stream_getle32(&qbs); - cmd = byte_stream_getle16(&qbs); - reqid = byte_stream_getle16(&qbs); - - purple_debug_misc("oscar", "icq response: %d bytes, %u, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); - - if (cmd == 0x0041) { /* offline message */ -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS - struct aim_icq_offlinemsg msg; - aim_rxcallback_t userfunc; - - memset(&msg, 0, sizeof(msg)); - - msg.sender = byte_stream_getle32(&qbs); - msg.year = byte_stream_getle16(&qbs); - msg.month = byte_stream_getle8(&qbs); - msg.day = byte_stream_getle8(&qbs); - msg.hour = byte_stream_getle8(&qbs); - msg.minute = byte_stream_getle8(&qbs); - msg.type = byte_stream_getle8(&qbs); - msg.flags = byte_stream_getle8(&qbs); - msg.msglen = byte_stream_getle16(&qbs); - msg.msg = byte_stream_getstr(&qbs, msg.msglen); - - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG))) - ret = userfunc(od, conn, frame, &msg); - - g_free(msg.msg); - - } else if (cmd == 0x0042) { - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE))) - ret = userfunc(od, conn, frame); -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - - } else if (cmd == 0x07da) { /* information */ - guint16 subtype; - struct aim_icq_info *info; - aim_rxcallback_t userfunc; - - subtype = byte_stream_getle16(&qbs); - byte_stream_advance(&qbs, 1); /* 0x0a */ - - /* find other data from the same request */ - for (info = od->icq_info; info && (info->reqid != reqid); info = info->next); - if (!info) { - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); - info->reqid = reqid; - info->next = od->icq_info; - od->icq_info = info; - } - - switch (subtype) { - case 0x00a0: { /* hide ip status */ - /* nothing */ - } break; - - case 0x00aa: { /* password change status */ - /* nothing */ - } break; - - case 0x00c8: { /* general and "home" information */ - info->nick = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->first = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->last = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->email = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homecity = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homestate = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homephone = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homefax = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homeaddr = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->mobile = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homezip = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homecountry = byte_stream_getle16(&qbs); - /* 0x0a 00 02 00 */ - /* 1 byte timezone? */ - /* 1 byte hide email flag? */ - } break; - - case 0x00dc: { /* personal information */ - info->age = byte_stream_getle8(&qbs); - info->unknown = byte_stream_getle8(&qbs); - info->gender = byte_stream_getle8(&qbs); /* Not specified=0x00, Female=0x01, Male=0x02 */ - info->personalwebpage = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->birthyear = byte_stream_getle16(&qbs); - info->birthmonth = byte_stream_getle8(&qbs); - info->birthday = byte_stream_getle8(&qbs); - info->language1 = byte_stream_getle8(&qbs); - info->language2 = byte_stream_getle8(&qbs); - info->language3 = byte_stream_getle8(&qbs); - /* 0x00 00 01 00 00 01 00 00 00 00 00 */ - } break; - - case 0x00d2: { /* work information */ - info->workcity = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workstate = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workphone = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workfax = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workaddr = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workzip = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workcountry = byte_stream_getle16(&qbs); - info->workcompany = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workdivision = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workposition = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - byte_stream_advance(&qbs, 2); /* 0x01 00 */ - info->workwebpage = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - } break; - - case 0x00e6: { /* additional personal information */ - info->info = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)-1); - } break; - - case 0x00eb: { /* email address(es) */ - int i; - info->numaddresses = byte_stream_getle16(&qbs); - info->email2 = (char **)g_new0(char *, info->numaddresses); - for (i = 0; i < info->numaddresses; i++) { - info->email2[i] = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - if (i+1 != info->numaddresses) - byte_stream_advance(&qbs, 1); /* 0x00 */ - } - } break; - - case 0x00f0: { /* personal interests */ - } break; - - case 0x00fa: { /* past background and current organizations */ - } break; - - case 0x0104: { /* alias info */ - info->nick = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->first = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->last = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - byte_stream_advance(&qbs, byte_stream_getle16(&qbs)); /* email address? */ - /* Then 0x00 02 00 */ - } break; - - case 0x010e: { /* unknown */ - /* 0x00 00 */ - } break; - - case 0x019a: { /* simple info */ - byte_stream_advance(&qbs, 2); - info->uin = byte_stream_getle32(&qbs); - info->nick = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->first = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->last = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->email = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - /* Then 0x00 02 00 00 00 00 00 */ - } break; - - /* status note title and send request for status note text */ - case 0x0fb4: { - GSList *tlvlist; - aim_tlv_t *tlv; - FlapConnection *conn; - char *uin = NULL; - char *status_note_title = NULL; - - conn = flap_connection_findbygroup(od, 0x0004); - if (conn == NULL) - { - purple_debug_misc("oscar", "icq/0x0fb4: flap connection was not found.\n"); - break; - } - - byte_stream_advance(&qbs, 0x02); /* length */ - byte_stream_advance(&qbs, 0x2f); /* unknown stuff */ - - tlvlist = aim_tlvlist_read(&qbs); - - tlv = aim_tlv_gettlv(tlvlist, 0x0032, 1); - if (tlv != NULL) - /* Get user number */ - uin = aim_tlv_getvalue_as_string(tlv); - - tlv = aim_tlv_gettlv(tlvlist, 0x0226, 1); - if (tlv != NULL) - /* Get status note title */ - status_note_title = aim_tlv_getvalue_as_string(tlv); - - aim_tlvlist_free(tlvlist); - - if (uin == NULL || status_note_title == NULL) - { - purple_debug_misc("oscar", "icq/0x0fb4: uin or " - "status_note_title was not found\n"); - g_free(uin); - g_free(status_note_title); - break; - } - - if (status_note_title[0] == '\0') - { - PurpleAccount *account; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - - account = purple_connection_get_account(od->gc); - buddy = purple_find_buddy(account, uin); - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - purple_prpl_got_user_status(account, uin, - purple_status_get_id(status), - "message", NULL, NULL); - - g_free(status_note_title); - } - else - { - struct aim_icq_info *info; - ByteStream bs; - guint32 bslen; - aim_snacid_t snacid; - guchar cookie[8]; - - info = g_new0(struct aim_icq_info, 1); - - bslen = 13 + strlen(uin) + 30 + 6 + 4 + 55 + 85 + 4; - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, 0x0004, 0x0006, 0x0000, NULL, 0); - - aim_icbm_makecookie(cookie); - - byte_stream_putraw(&bs, cookie, 8); /* ICBM cookie */ - byte_stream_put16(&bs, 0x0002); /* message channel */ - byte_stream_put8(&bs, strlen(uin)); /* uin */ - byte_stream_putstr(&bs, uin); - - byte_stream_put16(&bs, 0x0005); /* rendez vous data */ - byte_stream_put16(&bs, 0x00b2); - byte_stream_put16(&bs, 0x0000); /* request */ - byte_stream_putraw(&bs, cookie, 8); /* ICBM cookie */ - byte_stream_put32(&bs, 0x09461349); /* ICQ server relaying */ - byte_stream_put16(&bs, 0x4c7f); - byte_stream_put16(&bs, 0x11d1); - byte_stream_put32(&bs, 0x82224445); - byte_stream_put32(&bs, 0x53540000); - - byte_stream_put16(&bs, 0x000a); /* unknown TLV */ - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - byte_stream_put16(&bs, 0x000f); /* unknown TLV */ - byte_stream_put16(&bs, 0x0000); - - byte_stream_put16(&bs, 0x2711); /* extended data */ - byte_stream_put16(&bs, 0x008a); - byte_stream_putle16(&bs, 0x001b); /* length */ - byte_stream_putle16(&bs, 0x0009); /* version */ - byte_stream_putle32(&bs, 0x00000000); /* plugin: none */ - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle16(&bs, 0x0000); /* unknown */ - byte_stream_putle32(&bs, 0x00000000); /* client capabilities flags */ - byte_stream_put8(&bs, 0x00); /* unknown */ - byte_stream_putle16(&bs, 0x0064); /* downcounter? */ - byte_stream_putle16(&bs, 0x000e); /* length */ - byte_stream_putle16(&bs, 0x0064); /* downcounter? */ - byte_stream_putle32(&bs, 0x00000000); /* unknown */ - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle32(&bs, 0x00000000); - byte_stream_put8(&bs, 0x1a); /* message type: plugin message descibed by text string */ - byte_stream_put8(&bs, 0x00); /* message flags */ - byte_stream_putle16(&bs, 0x0000); /* status code */ - byte_stream_putle16(&bs, 0x0001); /* priority code */ - byte_stream_putle16(&bs, 0x0000); /* text length */ - - byte_stream_put8(&bs, 0x3a); /* message dump */ - byte_stream_put32(&bs, 0x00811a18); - byte_stream_put32(&bs, 0xbc0e6c18); - byte_stream_put32(&bs, 0x47a5916f); - byte_stream_put32(&bs, 0x18dcc76f); - byte_stream_put32(&bs, 0x1a010013); - byte_stream_put32(&bs, 0x00000041); - byte_stream_put32(&bs, 0x77617920); - byte_stream_put32(&bs, 0x53746174); - byte_stream_put32(&bs, 0x7573204d); - byte_stream_put32(&bs, 0x65737361); - byte_stream_put32(&bs, 0x67650100); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000015); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x0000000d); - byte_stream_put32(&bs, 0x00000074); - byte_stream_put32(&bs, 0x6578742f); - byte_stream_put32(&bs, 0x782d616f); - byte_stream_put32(&bs, 0x6c727466); - - byte_stream_put16(&bs, 0x0003); /* server ACK requested */ - byte_stream_put16(&bs, 0x0000); - - info->uin = atoi(uin); - info->status_note_title = status_note_title; - - memcpy(&info->icbm_cookie, cookie, 8); - - info->next = od->icq_info; - od->icq_info = info; - - flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - } - - g_free(uin); - - } break; - - } /* End switch statement */ - - if (!(snac->flags & 0x0001)) { - if (subtype != 0x0104) - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO))) - ret = userfunc(od, conn, frame, info); - - if (info->uin && info->nick) - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS))) - ret = userfunc(od, conn, frame, info); - - if (od->icq_info == info) { - od->icq_info = info->next; - } else { - struct aim_icq_info *cur; - for (cur=od->icq_info; (cur->next && (cur->next!=info)); cur=cur->next); - if (cur->next) - cur->next = cur->next->next; - } - aim_icq_freeinfo(info); - } - } - - aim_tlvlist_free(tlvlist); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return icqresponse(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -icq_shutdown(OscarData *od, aim_module_t *mod) -{ - struct aim_icq_info *del; - - while (od->icq_info) { - del = od->icq_info; - od->icq_info = od->icq_info->next; - aim_icq_freeinfo(del); - } - - return; -} - -int -icq_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ICQ; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x047c; - mod->flags = 0; - strncpy(mod->name, "icq", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = icq_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_invite.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_invite.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_invite.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_invite.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0006 - This isn't really ever used by anyone anymore. - * - * Once upon a time, there used to be a menu item in AIM clients that - * said something like "Invite a friend to use AIM..." and then it would - * ask for an email address and it would sent a mail to them saying - * how perfectly wonderful the AIM service is and why you should use it - * and click here if you hate the person who sent this to you and want to - * complain and yell at them in a small box with pretty fonts. - * - * I could've sworn libfaim had this implemented once, a long long time ago, - * but I can't find it. - * - * I'm mainly adding this so that I can keep advertising that we support - * group 6, even though we don't. - * - */ - -#include "oscar.h" - -int invite_modfirst(OscarData *od, aim_module_t *mod) -{ - - mod->family = SNAC_FAMILY_INVITE; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "invite", sizeof(mod->name)); - mod->snachandler = NULL; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_locate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_locate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_locate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_locate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1401 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0002 - Locate. - * - * The functions here are responsible for requesting and parsing information- - * gathering SNACs. Or something like that. This family contains the SNACs - * for getting and setting info, away messages, directory profile thingy, etc. - */ - -#include "oscar.h" -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* Define to log unknown TLVs */ -/* #define LOG_UNKNOWN_TLV */ - -/* - * Capability blocks. - * - * These are CLSIDs. They should actually be of the form: - * - * {0x0946134b, 0x4c7f, 0x11d1, - * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}}, - * - * But, eh. - */ -static const struct { - guint32 flag; - guint8 data[16]; -} aim_caps[] = { - - /* - * These are in ascending numerical order. - */ - - /* Client understands short caps, a UUID of the form - * 0946XXYY-4C7F-11D1-8222-444553540000 where XXYY is the short cap. */ - {OSCAR_CAPABILITY_SHORTCAPS, - {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_SECUREIM, - {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* OSCAR_CAPABILITY_XHTML_IM */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x00, 0x02, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_VIDEO, - {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* "Live Video" (SIP/RTC Video) support in Windows AIM 5.5.3501 and newer */ - {OSCAR_CAPABILITY_LIVEVIDEO, - {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* "Camera" support in Windows AIM 5.5.3501 and newer */ - {OSCAR_CAPABILITY_CAMERA, - {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* "Microphone" support in Windows AIM 5.5.3501 and newer */ - /* OSCAR_CAPABILITY_MICROPHONE */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* Supports RTC Audio */ - /* OSCAR_CAPABILITY_RTCAUDIO */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x04, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* In iChatAV (version numbers...?) */ - {OSCAR_CAPABILITY_ICHATAV, - {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}}, - - /* Supports "new status message features" (Who advertises this one?) */ - /* OSCAR_CAPABILITY_HOST_STATUS_TEXT_AWARE */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x0a, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* Supports "see as I type" (Who advertises this one?) */ - /* OSCAR_CAPABILITY_SEE_AS_I_TYPE */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x0b, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* Client only asserts caps for services in which it is participating */ - /* OSCAR_CAPABILITY_SMARTCAPS */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_HIPTOP, - {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_TALK, - {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_SENDFILE, - {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ICQ_DIRECT, - {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_DIRECTIM, - {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_BUDDYICON, - {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ADDINS, - {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_GETFILE, - {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ICQSERVERRELAY, - {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* - * Indeed, there are two of these. The former appears to be correct, - * but in some versions of winaim, the second one is set. Either they - * forgot to fix endianness, or they made a typo. It really doesn't - * matter which. - */ - {OSCAR_CAPABILITY_GAMES, - {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - {OSCAR_CAPABILITY_GAMES2, - {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, - 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_SENDBUDDYLIST, - {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* - * Setting this lets AIM users receive messages from ICQ users, and ICQ - * users receive messages from AIM users. It also lets ICQ users show - * up in buddy lists for AIM users, and AIM users show up in buddy lists - * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, - * in that if you add a user to your deny list, you will not be able to - * see them as online (previous you could still see them, but they - * couldn't see you. - */ - {OSCAR_CAPABILITY_INTEROPERATE, - {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_UNICODE, - {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ICHAT_SCREENSHARE, - {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_UNICODEOLD, - {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, - 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, - - {OSCAR_CAPABILITY_TYPING, - {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, - 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, - - /* - * Chat is oddball. - */ - {OSCAR_CAPABILITY_CHAT, - {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* This is added by the servers and it only shows up for ourselves... */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, - 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, - - {OSCAR_CAPABILITY_ICQRTF, - {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, - 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, - - {OSCAR_CAPABILITY_APINFO, - {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, - 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, - - {OSCAR_CAPABILITY_TRILLIANCRYPT, - {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, - 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_EMPTY, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_LAST, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, -}; - -/* - * Add the userinfo to our linked list. If we already have userinfo - * for this buddy, then just overwrite parts of the old data. - * - * @param userinfo Contains the new information for the buddy. - */ -static void -aim_locate_adduserinfo(OscarData *od, aim_userinfo_t *userinfo) -{ - aim_userinfo_t *cur; - - cur = aim_locate_finduserinfo(od, userinfo->bn); - - if (cur == NULL) { - cur = (aim_userinfo_t *)g_new0(aim_userinfo_t, 1); - cur->bn = g_strdup(userinfo->bn); - cur->next = od->locate.userinfo; - od->locate.userinfo = cur; - } - - cur->warnlevel = userinfo->warnlevel; - cur->idletime = userinfo->idletime; - if (userinfo->flags != 0) - cur->flags = userinfo->flags; - if (userinfo->createtime != 0) - cur->createtime = userinfo->createtime; - if (userinfo->membersince != 0) - cur->membersince = userinfo->membersince; - if (userinfo->onlinesince != 0) - cur->onlinesince = userinfo->onlinesince; - if (userinfo->sessionlen != 0) - cur->sessionlen = userinfo->sessionlen; - if (userinfo->capabilities != 0) - cur->capabilities = userinfo->capabilities; - cur->present |= userinfo->present; - - if (userinfo->iconcsumlen > 0) { - g_free(cur->iconcsum); - cur->iconcsum = (guint8 *)g_malloc(userinfo->iconcsumlen); - memcpy(cur->iconcsum, userinfo->iconcsum, userinfo->iconcsumlen); - cur->iconcsumlen = userinfo->iconcsumlen; - } - - if (userinfo->info != NULL) { - g_free(cur->info); - g_free(cur->info_encoding); - if (userinfo->info_len > 0) { - cur->info = (char *)g_malloc(userinfo->info_len); - memcpy(cur->info, userinfo->info, userinfo->info_len); - } else - cur->info = NULL; - cur->info_encoding = g_strdup(userinfo->info_encoding); - cur->info_len = userinfo->info_len; - } - - if (userinfo->status != NULL) { - g_free(cur->status); - g_free(cur->status_encoding); - if (userinfo->status_len > 0) { - cur->status = (char *)g_malloc(userinfo->status_len); - memcpy(cur->status, userinfo->status, userinfo->status_len); - } else - cur->status = NULL; - if (userinfo->status_encoding != NULL) - cur->status_encoding = g_strdup(userinfo->status_encoding); - else - cur->status_encoding = NULL; - cur->status_len = userinfo->status_len; - } - - if (userinfo->itmsurl != NULL) { - g_free(cur->itmsurl); - g_free(cur->itmsurl_encoding); - if (userinfo->itmsurl_len > 0) { - cur->itmsurl = (char *)g_malloc(userinfo->itmsurl_len); - memcpy(cur->itmsurl, userinfo->itmsurl, userinfo->itmsurl_len); - } else - cur->itmsurl = NULL; - if (userinfo->itmsurl_encoding != NULL) - cur->itmsurl_encoding = g_strdup(userinfo->itmsurl_encoding); - else - cur->itmsurl_encoding = NULL; - cur->itmsurl_len = userinfo->itmsurl_len; - } - - if (userinfo->away != NULL) { - g_free(cur->away); - g_free(cur->away_encoding); - if (userinfo->away_len > 0) { - cur->away = (char *)g_malloc(userinfo->away_len); - memcpy(cur->away, userinfo->away, userinfo->away_len); - } else - cur->away = NULL; - cur->away_encoding = g_strdup(userinfo->away_encoding); - cur->away_len = userinfo->away_len; - - } else { - /* - * We don't have an away message specified in this user_info - * block, so clear any cached away message now. - */ - if (cur->away) { - g_free(cur->away); - cur->away = NULL; - } - if (cur->away_encoding) { - g_free(cur->away_encoding); - cur->away_encoding = NULL; - } - cur->away_len = 0; - } -} - -aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn) { - aim_userinfo_t *cur = NULL; - - if (bn == NULL) - return NULL; - - cur = od->locate.userinfo; - - while (cur != NULL) { - if (oscar_util_name_compare(cur->bn, bn) == 0) - return cur; - cur = cur->next; - } - - return NULL; -} - -guint32 -aim_locate_getcaps(OscarData *od, ByteStream *bs, int len) -{ - guint32 flags = 0; - int offset; - - for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x10) { - guint8 *cap; - int i, identified; - - cap = byte_stream_getraw(bs, 0x10); - - for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) { - if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { - flags |= aim_caps[i].flag; - identified++; - break; /* should only match once... */ - } - } - - if (!identified) - purple_debug_misc("oscar", "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", - cap[0], cap[1], cap[2], cap[3], - cap[4], cap[5], - cap[6], cap[7], - cap[8], cap[9], - cap[10], cap[11], cap[12], cap[13], - cap[14], cap[15]); - - g_free(cap); - } - - return flags; -} - -guint32 -aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len) -{ - guint32 flags = 0; - int offset; - - for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x02) { - guint8 *cap; - int i, identified; - - cap = byte_stream_getraw(bs, 0x02); - - for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) { - if (memcmp(&aim_caps[i].data[2], cap, 0x02) == 0) { - flags |= aim_caps[i].flag; - identified++; - break; /* should only match once... */ - } - } - - if (!identified) - purple_debug_misc("oscar", "unknown short capability: {%02x%02x}\n", cap[0], cap[1]); - - g_free(cap); - } - - return flags; -} - -int -byte_stream_putcaps(ByteStream *bs, guint32 caps) -{ - int i; - - if (!bs) - return -EINVAL; - - for (i = 0; byte_stream_empty(bs); i++) { - - if (aim_caps[i].flag == OSCAR_CAPABILITY_LAST) - break; - - if (caps & aim_caps[i].flag) - byte_stream_putraw(bs, aim_caps[i].data, 0x10); - - } - - return 0; -} - -#ifdef LOG_UNKNOWN_TLV -static void -dumptlv(OscarData *od, guint16 type, ByteStream *bs, guint8 len) -{ - int i; - - if (!od || !bs || !len) - return; - - purple_debug_misc("oscar", "userinfo: type =0x%04x\n", type); - purple_debug_misc("oscar", "userinfo: length=0x%04x\n", len); - purple_debug_misc("oscar", "userinfo: value:\n"); - - for (i = 0; i < len; i++) { - if ((i % 8) == 0) - purple_debug_misc("oscar", "\nuserinfo: "); - purple_debug_misc("oscar", "0x%2x ", byte_stream_get8(bs)); - } - - purple_debug_misc("oscar", "\n"); - - return; -} -#endif - -void -aim_info_free(aim_userinfo_t *info) -{ - g_free(info->bn); - g_free(info->iconcsum); - g_free(info->info); - g_free(info->info_encoding); - g_free(info->status); - g_free(info->status_encoding); - g_free(info->itmsurl); - g_free(info->itmsurl_encoding); - g_free(info->away); - g_free(info->away_encoding); -} - -/* - * AIM is fairly regular about providing user info. This is a generic - * routine to extract it in its standard form. - */ -int -aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *outinfo) -{ - int curtlv, tlvcnt; - guint8 bnlen; - - if (!bs || !outinfo) - return -EINVAL; - - /* Clear out old data first */ - memset(outinfo, 0x00, sizeof(aim_userinfo_t)); - - /* - * Username. Stored as an unterminated string prepended with a - * byte containing its length. - */ - bnlen = byte_stream_get8(bs); - outinfo->bn = byte_stream_getstr(bs, bnlen); - - /* - * Warning Level. Stored as an unsigned short. - */ - outinfo->warnlevel = byte_stream_get16(bs); - - /* - * TLV Count. Unsigned short representing the number of - * Type-Length-Value triples that follow. - */ - tlvcnt = byte_stream_get16(bs); - - /* - * Parse out the Type-Length-Value triples as they're found. - */ - for (curtlv = 0; curtlv < tlvcnt; curtlv++) { - guint16 type, length; - int endpos; - - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - - endpos = byte_stream_curpos(bs) + MIN(length, byte_stream_empty(bs)); - - if (type == 0x0001) { - /* - * User flags - * - * Specified as any of the following ORed together: - * 0x0001 Unconfirmed account - * 0x0002 Unknown bit 2 - * 0x0004 AOL Main Service user - * 0x0008 Unknown bit 4 - * 0x0010 Free (AIM) user - * 0x0020 Away - * 0x0040 ICQ user (AIM bit also set) - * 0x0080 Mobile device - * 0x0400 Bot (like ActiveBuddy) - */ - outinfo->flags = byte_stream_get16(bs); - outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; - - } else if (type == 0x0002) { - /* - * Account creation time - * - * The time/date that the user originally registered for - * the service, stored in time_t format. - * - * I'm not sure how this differs from type 5 ("member - * since"). - * - * Note: This is the field formerly known as "member - * since". All these years and I finally found out - * that I got the name wrong. - */ - outinfo->createtime = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; - - } else if (type == 0x0003) { - /* - * On-Since date - * - * The time/date that the user started their current - * session, stored in time_t format. - */ - outinfo->onlinesince = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; - - } else if (type == 0x0004) { - /* - * Idle time - * - * Number of minutes since the user actively used the - * service. - * - * Note that the client tells the server when to start - * counting idle times, so this may or may not be - * related to reality. - */ - outinfo->idletime = byte_stream_get16(bs); - outinfo->present |= AIM_USERINFO_PRESENT_IDLE; - - } else if (type == 0x0005) { - /* - * Member since date - * - * The time/date that the user originally registered for - * the service, stored in time_t format. - * - * This is sometimes sent instead of type 2 ("account - * creation time"), particularly in the self-info. - * And particularly for ICQ? - */ - outinfo->membersince = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; - - } else if (type == 0x0006) { - /* - * ICQ Online Status - * - * ICQ's Away/DND/etc "enriched" status. Some decoding - * of values done by Scott - */ - byte_stream_get16(bs); - outinfo->icqinfo.status = byte_stream_get16(bs); - outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; - - } else if (type == 0x0008) { - /* - * Client type, or some such. - */ - - } else if (type == 0x000a) { - /* - * ICQ User IP Address - * - * Ahh, the joy of ICQ security. - */ - outinfo->icqinfo.ipaddr = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; - - } else if (type == 0x000c) { - /* - * Random crap containing the IP address, - * apparently a port number, and some Other Stuff. - * - * Format is: - * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 - */ - byte_stream_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); - outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; - - } else if (type == 0x000d) { - /* - * OSCAR Capability information - */ - outinfo->capabilities |= aim_locate_getcaps(od, bs, length); - outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; - - } else if (type == 0x000e) { - /* - * AOL capability information - */ - - } else if ((type == 0x000f) || (type == 0x0010)) { - /* - * Type = 0x000f: Session Length. (AIM) - * Type = 0x0010: Session Length. (AOL) - * - * The duration, in seconds, of the user's current - * session. - * - * Which TLV type this comes in depends on the - * service the user is using (AIM or AOL). - */ - outinfo->sessionlen = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; - - } else if (type == 0x0014) { - /* - * My instance number. - */ - guint8 instance_number; - instance_number = byte_stream_get8(bs); - - } else if (type == 0x0019) { - /* - * OSCAR short capability information. A shortened - * form of the normal capabilities. - */ - outinfo->capabilities |= aim_locate_getcaps_short(od, bs, length); - outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; - - } else if (type == 0x001a) { - /* - * Type = 0x001a - * - * AOL short capability information. A shortened - * form of the normal capabilities. - */ - - } else if (type == 0x001b) { - /* - * Encryption certification MD5 checksum. - */ - - } else if (type == 0x001d) { - /* - * Buddy icon information and status/available messages. - * - * This almost seems like the AIM protocol guys gave - * the iChat guys a Type, and the iChat guys tried to - * cram as much cool shit into it as possible. Then - * the Windows AIM guys were like, "hey, that's - * pretty neat, let's copy those prawns." - * - * In that spirit, this can contain a custom message, - * kind of like an away message, but you're not away - * (it's called an "available" message). Or it can - * contain information about the buddy icon the user - * has stored on the server. - */ - guint16 type2; - guint8 number2, length2; - int endpos2; - - /* - * Continue looping as long as we're able to read type2, - * number2, and length2. - */ - while (byte_stream_curpos(bs) + 4 <= endpos) { - type2 = byte_stream_get16(bs); - number2 = byte_stream_get8(bs); - length2 = byte_stream_get8(bs); - - endpos2 = byte_stream_curpos(bs) + MIN(length2, byte_stream_empty(bs)); - - switch (type2) { - case 0x0000: { /* This is an official buddy icon? */ - /* This is always 5 bytes of "0x02 01 d2 04 72"? */ - } break; - - case 0x0001: { /* A buddy icon checksum */ - if ((length2 > 0) && ((number2 == 0x00) || (number2 == 0x01))) { - g_free(outinfo->iconcsum); - outinfo->iconcsumtype = number2; - outinfo->iconcsum = byte_stream_getraw(bs, length2); - outinfo->iconcsumlen = length2; - } - } break; - - case 0x0002: { /* A status/available message */ - g_free(outinfo->status); - g_free(outinfo->status_encoding); - if (length2 >= 4) { - outinfo->status_len = byte_stream_get16(bs); - outinfo->status = byte_stream_getstr(bs, outinfo->status_len); - if (byte_stream_get16(bs) == 0x0001) { /* We have an encoding */ - byte_stream_get16(bs); - outinfo->status_encoding = byte_stream_getstr(bs, byte_stream_get16(bs)); - } else { - /* No explicit encoding, client should use UTF-8 */ - outinfo->status_encoding = NULL; - } - } else { - byte_stream_advance(bs, length2); - outinfo->status_len = 0; - outinfo->status = g_strdup(""); - outinfo->status_encoding = NULL; - } - } break; - - case 0x0009: { /* An iTunes Music Store link */ - g_free(outinfo->itmsurl); - g_free(outinfo->itmsurl_encoding); - if (length2 >= 4) { - outinfo->itmsurl_len = byte_stream_get16(bs); - outinfo->itmsurl = byte_stream_getstr(bs, outinfo->itmsurl_len); - if (byte_stream_get16(bs) == 0x0001) { - /* We have an encoding */ - byte_stream_get16(bs); - outinfo->itmsurl_encoding = byte_stream_getstr(bs, byte_stream_get16(bs)); - } else { - /* No explicit encoding, client should use UTF-8 */ - outinfo->itmsurl_encoding = NULL; - } - } else { - byte_stream_advance(bs, length2); - outinfo->itmsurl_len = 0; - outinfo->itmsurl = g_strdup(""); - outinfo->itmsurl_encoding = NULL; - } - } break; - } - - /* Save ourselves. */ - byte_stream_setpos(bs, endpos2); - } - - } else if (type == 0x001e) { - /* - * Always four bytes, but it doesn't look like an int. - */ - - } else if (type == 0x001f) { - /* - * Upper bytes of user flags. Can be any size - * - * Seen on a buddy using DeadAIM. Data was 4 bytes: - * 0x00 00 00 10 - */ - - } else if (type == 0x0023) { - /* - * Last Buddy Feed update time, in seconds since the epoch. - */ - - } else if (type == 0x0026) { - /* - * Time that the profile was set, in seconds since the epoch. - */ - - } else if (type == 0x0027) { - /* - * Time that the away message was set, in seconds since the epoch. - */ - - } else if (type == 0x002a) { - /* - * Country code based on GeoIP data. - */ - - } else { - - /* - * Reaching here indicates that either AOL has - * added yet another TLV for us to deal with, - * or the parsing has gone Terribly Wrong. - * - * Either way, inform the owner and attempt - * recovery. - * - */ -#ifdef LOG_UNKNOWN_TLV - purple_debug_misc("oscar", "userinfo: **warning: unexpected TLV:\n"); - purple_debug_misc("oscar", "userinfo: bn =%s\n", outinfo->bn); - dumptlv(od, type, bs, length); -#endif - } - - /* Save ourselves. */ - byte_stream_setpos(bs, endpos); - } - - aim_locate_adduserinfo(od, outinfo); - - return 0; -} - -/* - * Inverse of aim_info_extract() - */ -int -aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info) -{ - GSList *tlvlist = NULL; - - if (!bs || !info) - return -EINVAL; - - byte_stream_put8(bs, strlen(info->bn)); - byte_stream_putstr(bs, info->bn); - - byte_stream_put16(bs, info->warnlevel); - - if (info->present & AIM_USERINFO_PRESENT_FLAGS) - aim_tlvlist_add_16(&tlvlist, 0x0001, info->flags); - if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) - aim_tlvlist_add_32(&tlvlist, 0x0002, info->membersince); - if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) - aim_tlvlist_add_32(&tlvlist, 0x0003, info->onlinesince); - if (info->present & AIM_USERINFO_PRESENT_IDLE) - aim_tlvlist_add_16(&tlvlist, 0x0004, info->idletime); - -/* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ -#ifdef ICQ_OSCAR_SUPPORT - if (atoi(info->bn) != 0) { - if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) - aim_tlvlist_add_16(&tlvlist, 0x0006, info->icqinfo.status); - if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) - aim_tlvlist_add_32(&tlvlist, 0x000a, info->icqinfo.ipaddr); - } -#endif - - if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) - aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities); - - if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) - aim_tlvlist_add_32(&tlvlist, (guint16)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); - - byte_stream_put16(bs, aim_tlvlist_count(tlvlist)); - aim_tlvlist_write(bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - return 0; -} - -/* - * Subtype 0x0001 - */ -static int -error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - guint16 reason; - char *bn; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "locate error: received response from unknown request!\n"); - return 0; - } - - if ((snac2->family != SNAC_FAMILY_LOCATE) && (snac2->type != 0x0015)) { - purple_debug_misc("oscar", "locate error: received response from invalid request! %d\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - if (!(bn = snac2->data)) { - purple_debug_misc("oscar", "locate error: received response from request without a buddy name!\n"); - g_free(snac2); - return 0; - } - - reason = byte_stream_get16(bs); - - /* Notify the user that we do not have info for this buddy */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, reason, bn); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/* - * Subtype 0x0002 - * - * Request Location services rights. - * - */ -int -aim_locate_reqrights(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_REQRIGHTS); - - return 0; -} - -/* - * Subtype 0x0003 - * - * Normally contains: - * t(0001) - short containing max profile length (value = 1024) - * t(0002) - short - unknown (value = 16) [max MIME type length?] - * t(0003) - short - unknown (value = 10) - * t(0004) - short - unknown (value = 2048) [ICQ only?] - */ -static int -rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - GSList *tlvlist; - aim_rxcallback_t userfunc; - int ret = 0; - guint16 maxsiglen = 0; - - tlvlist = aim_tlvlist_read(bs); - - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) - maxsiglen = aim_tlv_get16(tlvlist, 0x0001, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, maxsiglen); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0004 - * - * Gives BOS your profile. - * - * profile_encoding and awaymsg_encoding MUST be set if profile or - * away are set, respectively, and their value may or may not be - * restricted to a few choices. I am currently aware of: - * - * us-ascii Just that - * unicode-2-0 UTF-16BE - * - * profile_len and awaymsg_len MUST be set similarly, and they MUST - * be the length of their respective strings in bytes. - * - * To get the previous behavior of awaymsg == "" un-setting the away - * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the - * obvious equivalent). - * - */ -int -aim_locate_setprofile(OscarData *od, - const char *profile_encoding, const gchar *profile, const int profile_len, - const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - char *encoding; - static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - if (!profile && !awaymsg) - return -EINVAL; - - if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { - return -EINVAL; - } - - /* Build the packet first to get real length */ - if (profile) { - /* no + 1 here because of %s */ - encoding = g_malloc(strlen(defencoding) + strlen(profile_encoding)); - snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); - aim_tlvlist_add_str(&tlvlist, 0x0001, encoding); - aim_tlvlist_add_raw(&tlvlist, 0x0002, profile_len, (const guchar *)profile); - g_free(encoding); - } - - /* - * So here's how this works: - * - You are away when you have a non-zero-length type 4 TLV stored. - * - You become unaway when you clear the TLV with a zero-length - * type 4 TLV. - * - If you do not send the type 4 TLV, your status does not change - * (that is, if you were away, you'll remain away). - */ - if (awaymsg) { - if (awaymsg_len) { - encoding = g_malloc(strlen(defencoding) + strlen(awaymsg_encoding)); - snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); - aim_tlvlist_add_str(&tlvlist, 0x0003, encoding); - aim_tlvlist_add_raw(&tlvlist, 0x0004, awaymsg_len, (const guchar *)awaymsg); - g_free(encoding); - } else - aim_tlvlist_add_noval(&tlvlist, 0x0004); - } - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0004 - Set your client's capabilities. - */ -int -aim_locate_setcaps(OscarData *od, guint32 caps) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - aim_tlvlist_add_caps(&tlvlist, 0x0005, caps); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0005 - Request info of another AIM user. - * - * @param bn The buddy name whose info you wish to request. - * @param infotype The type of info you wish to request. - * 0x0001 - Info/profile - * 0x0003 - Away message - * 0x0004 - Capabilities - */ -int -aim_locate_getinfo(OscarData *od, const char *bn, guint16 infotype) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 2+1+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0005, 0x0000, NULL, 0); - - byte_stream_put16(&bs, infotype); - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0005, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* Subtype 0x0006 */ -static int -userinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_userinfo_t *userinfo, *userinfo2; - GSList *tlvlist; - aim_tlv_t *tlv = NULL; - - userinfo = (aim_userinfo_t *)g_malloc(sizeof(aim_userinfo_t)); - aim_info_extract(od, bs, userinfo); - tlvlist = aim_tlvlist_read(bs); - - /* Profile will be 1 and 2 */ - userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1); - if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { - userinfo->info = (char *)g_malloc(tlv->length); - memcpy(userinfo->info, tlv->value, tlv->length); - userinfo->info_len = tlv->length; - } - - /* Away message will be 3 and 4 */ - userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1); - if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { - userinfo->away = (char *)g_malloc(tlv->length); - memcpy(userinfo->away, tlv->value, tlv->length); - userinfo->away_len = tlv->length; - } - - /* Caps will be 5 */ - if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) { - ByteStream cbs; - byte_stream_init(&cbs, tlv->value, tlv->length); - userinfo->capabilities = aim_locate_getcaps(od, &cbs, tlv->length); - userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES; - } - aim_tlvlist_free(tlvlist); - - aim_locate_adduserinfo(od, userinfo); - userinfo2 = aim_locate_finduserinfo(od, userinfo->bn); - aim_info_free(userinfo); - g_free(userinfo); - - /* Show the info to the user */ - if (userinfo2 != NULL && ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))) - ret = userfunc(od, conn, frame, userinfo2); - - return ret; -} - -/* - * Subtype 0x0009 - Set directory profile data. - * - * This is not the same as aim_location_setprofile! - * privacy: 1 to allow searching, 0 to disallow. - * - */ -int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - aim_tlvlist_add_16(&tlvlist, 0x000a, privacy); - - if (first) - aim_tlvlist_add_str(&tlvlist, 0x0001, first); - if (last) - aim_tlvlist_add_str(&tlvlist, 0x0002, last); - if (middle) - aim_tlvlist_add_str(&tlvlist, 0x0003, middle); - if (maiden) - aim_tlvlist_add_str(&tlvlist, 0x0004, maiden); - - if (state) - aim_tlvlist_add_str(&tlvlist, 0x0007, state); - if (city) - aim_tlvlist_add_str(&tlvlist, 0x0008, city); - - if (nickname) - aim_tlvlist_add_str(&tlvlist, 0x000c, nickname); - if (zip) - aim_tlvlist_add_str(&tlvlist, 0x000d, zip); - - if (street) - aim_tlvlist_add_str(&tlvlist, 0x0021, street); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0009, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0009, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x000b - Huh? What is this? - */ -int aim_locate_000b(OscarData *od, const char *bn) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x000b, 0x0000, NULL, 0); - - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x000b, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x000f - * - * XXX pass these in better - * - */ -int -aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - /* ?? privacy ?? */ - aim_tlvlist_add_16(&tlvlist, 0x000a, privacy); - - if (interest1) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest1); - if (interest2) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest2); - if (interest3) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest3); - if (interest4) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest4); - if (interest5) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest5); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x000f, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x000f, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - return 0; -} - -/* - * Subtype 0x0015 - Request the info of a user using the short method. This is - * what iChat uses. It normally is VERY leniently rate limited. - * - * @param bn The buddy name whose info you wish to request. - * @param flags The bitmask which specifies the type of info you wish to request. - * 0x00000001 - Info/profile. - * 0x00000002 - Away message. - * 0x00000004 - Capabilities. - * 0x00000008 - Certification. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 4 + 1 + strlen(bn)); - byte_stream_put32(&bs, flags); - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0015, 0x0000, bn, strlen(bn)+1); - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_LOCATE, 0x0015, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0003) - return rights(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0006) - return userinfo(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -locate_shutdown(OscarData *od, aim_module_t *mod) -{ - aim_userinfo_t *del; - - while (od->locate.userinfo) { - del = od->locate.userinfo; - od->locate.userinfo = od->locate.userinfo->next; - aim_info_free(del); - g_free(del); - } -} - -int -locate_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_LOCATE; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "locate", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = locate_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_odir.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_odir.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_odir.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_odir.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,264 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000f - Newer Search Method - * - * Used for searching for other AIM users by email address, name, - * location, commmon interests, and a few other similar things. - * - */ - -#include "oscar.h" - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * Search for an AIM buddy based on their email address. - * - * @param od The oscar session. - * @param region Should be "us-ascii" unless you know what you're doing. - * @param email The email address you want to search for. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_odir_email(OscarData *od, const char *region, const char *email) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region || !email) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_str(&tlvlist, 0x001c, region); - aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0001); /* Type of search */ - aim_tlvlist_add_str(&tlvlist, 0x0005, email); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * Search for an AIM buddy based on various info - * about the person. - * - * @param od The oscar session. - * @param region Should be "us-ascii" unless you know what you're doing. - * @param first The first name of the person you want to search for. - * @param middle The middle name of the person you want to search for. - * @param last The last name of the person you want to search for. - * @param maiden The maiden name of the person you want to search for. - * @param nick The nick name of the person you want to search for. - * @param city The city where the person you want to search for resides. - * @param state The state where the person you want to search for resides. - * @param country The country where the person you want to search for resides. - * @param zip The zip code where the person you want to search for resides. - * @param address The street address where the person you want to seach for resides. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_odir_name(OscarData *od, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_str(&tlvlist, 0x001c, region); - aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0000); /* Type of search */ - if (first) - aim_tlvlist_add_str(&tlvlist, 0x0001, first); - if (last) - aim_tlvlist_add_str(&tlvlist, 0x0002, last); - if (middle) - aim_tlvlist_add_str(&tlvlist, 0x0003, middle); - if (maiden) - aim_tlvlist_add_str(&tlvlist, 0x0004, maiden); - if (country) - aim_tlvlist_add_str(&tlvlist, 0x0006, country); - if (state) - aim_tlvlist_add_str(&tlvlist, 0x0007, state); - if (city) - aim_tlvlist_add_str(&tlvlist, 0x0008, city); - if (nick) - aim_tlvlist_add_str(&tlvlist, 0x000c, nick); - if (zip) - aim_tlvlist_add_str(&tlvlist, 0x000d, zip); - if (address) - aim_tlvlist_add_str(&tlvlist, 0x0021, address); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * @param od The oscar session. - * @param interest1 An interest you want to search for. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_odir_interest(OscarData *od, const char *region, const char *interest) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_str(&tlvlist, 0x001c, region); - aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0001); /* Type of search */ - if (interest) - aim_tlvlist_add_str(&tlvlist, 0x0001, interest); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0003 - Receive Reply From a User Search - * - */ -static int parseresults(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp, numresults; - struct aim_odir *results = NULL; - - tmp = byte_stream_get16(bs); /* Unknown */ - tmp = byte_stream_get16(bs); /* Unknown */ - byte_stream_advance(bs, tmp); - - numresults = byte_stream_get16(bs); /* Number of results to follow */ - - /* Allocate a linked list, 1 node per result */ - while (numresults) { - struct aim_odir *new; - GSList *tlvlist = aim_tlvlist_readnum(bs, byte_stream_get16(bs)); - new = (struct aim_odir *)g_malloc(sizeof(struct aim_odir)); - new->first = aim_tlv_getstr(tlvlist, 0x0001, 1); - new->last = aim_tlv_getstr(tlvlist, 0x0002, 1); - new->middle = aim_tlv_getstr(tlvlist, 0x0003, 1); - new->maiden = aim_tlv_getstr(tlvlist, 0x0004, 1); - new->email = aim_tlv_getstr(tlvlist, 0x0005, 1); - new->country = aim_tlv_getstr(tlvlist, 0x0006, 1); - new->state = aim_tlv_getstr(tlvlist, 0x0007, 1); - new->city = aim_tlv_getstr(tlvlist, 0x0008, 1); - new->bn = aim_tlv_getstr(tlvlist, 0x0009, 1); - new->interest = aim_tlv_getstr(tlvlist, 0x000b, 1); - new->nick = aim_tlv_getstr(tlvlist, 0x000c, 1); - new->zip = aim_tlv_getstr(tlvlist, 0x000d, 1); - new->region = aim_tlv_getstr(tlvlist, 0x001c, 1); - new->address = aim_tlv_getstr(tlvlist, 0x0021, 1); - new->next = results; - results = new; - numresults--; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, results); - - /* Now free everything from above */ - while (results) { - struct aim_odir *del = results; - results = results->next; - g_free(del->first); - g_free(del->last); - g_free(del->middle); - g_free(del->maiden); - g_free(del->email); - g_free(del->country); - g_free(del->state); - g_free(del->city); - g_free(del->bn); - g_free(del->interest); - g_free(del->nick); - g_free(del->zip); - g_free(del->region); - g_free(del->address); - g_free(del); - } - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return parseresults(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -odir_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ODIR; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "odir", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_oservice.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_oservice.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_oservice.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_oservice.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1157 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0001 - This is a very special group. All connections support - * this group, as it does some particularly good things (like rate limiting). - */ - -#include "oscar.h" - -#include "cipher.h" - -/* Subtype 0x0002 - Client Online */ -void -aim_srv_clientready(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *cur; - - byte_stream_new(&bs, 1142); - - /* - * Send only the tool versions that the server cares about (that it - * marked as supporting in the server ready SNAC). - */ - for (cur = conn->groups; cur != NULL; cur = cur->next) - { - aim_module_t *mod; - - if ((mod = aim__findmodulebygroup(od, GPOINTER_TO_UINT(cur->data)))) - { - byte_stream_put16(&bs, mod->family); - byte_stream_put16(&bs, mod->version); - byte_stream_put16(&bs, mod->toolid); - byte_stream_put16(&bs, mod->toolversion); - } - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Subtype 0x0003 - Host Online - * - * See comments in conn.c about how the group associations are supposed - * to work, and how they really work. - * - * This info probably doesn't even need to make it to the client. - * - * We don't actually call the client here. This starts off the connection - * initialization routine required by all AIM connections. The next time - * the client is called is the CONNINITDONE callback, which should be - * shortly after the rate information is acknowledged. - * - */ -static int -hostonline(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int group; - - while (byte_stream_empty(bs)) - { - group = byte_stream_get16(bs); - conn->groups = g_slist_prepend(conn->groups, GUINT_TO_POINTER(group)); - } - - /* - * Next step is in the Host Versions handler. - * - * Note that we must send this before we request rates, since - * the format of the rate information depends on the versions we - * give it. - * - */ - aim_srv_setversions(od, conn); - - return 1; -} - -/* Subtype 0x0004 - Service request */ -void -aim_srv_requestnew(OscarData *od, guint16 serviceid) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - if(!conn) - return; - - byte_stream_new(&bs, 6); - - byte_stream_put16(&bs, serviceid); - - if (od->use_ssl) - /* Request SSL Connection */ - aim_tlvlist_add_noval(&tlvlist, 0x008c); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Join a room of name roomname. This is the first step to joining an - * already created room. It's basically a Service Request for - * family 0x000e, with a little added on to specify the exchange and room - * name. - */ -int -aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - struct chatsnacinfo csi; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - if (!conn || !roomname || roomname[0] == '\0') - return -EINVAL; - - byte_stream_new(&bs, 506); - - memset(&csi, 0, sizeof(csi)); - csi.exchange = exchange; - g_strlcpy(csi.name, roomname, sizeof(csi.name)); - csi.instance = instance; - - /* - * Requesting service chat (0x000e) - */ - byte_stream_put16(&bs, 0x000e); - - aim_tlvlist_add_chatroom(&tlvlist, 0x0001, exchange, roomname, instance); - - if (od->use_ssl) - /* Request SSL Connection */ - aim_tlvlist_add_noval(&tlvlist, 0x008c); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, &csi, sizeof(csi)); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* Subtype 0x0005 - Redirect */ -static int -redirect(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - struct aim_redirect_data redir; - aim_rxcallback_t userfunc; - GSList *tlvlist; - aim_snac_t *origsnac = NULL; - int ret = 0; - - memset(&redir, 0, sizeof(redir)); - - tlvlist = aim_tlvlist_read(bs); - - if (!aim_tlv_gettlv(tlvlist, 0x000d, 1) || - !aim_tlv_gettlv(tlvlist, 0x0005, 1) || - !aim_tlv_gettlv(tlvlist, 0x0006, 1)) { - aim_tlvlist_free(tlvlist); - return 0; - } - - redir.group = aim_tlv_get16(tlvlist, 0x000d, 1); - redir.ip = aim_tlv_getstr(tlvlist, 0x0005, 1); - redir.cookielen = aim_tlv_gettlv(tlvlist, 0x0006, 1)->length; - redir.cookie = (guchar *)aim_tlv_getstr(tlvlist, 0x0006, 1); - redir.ssl_cert_cn = aim_tlv_getstr(tlvlist, 0x008d, 1); - redir.use_ssl = aim_tlv_get8(tlvlist, 0x008e, 1); - - /* Fetch original SNAC so we can get csi if needed */ - origsnac = aim_remsnac(od, snac->id); - - if ((redir.group == SNAC_FAMILY_CHAT) && origsnac) { - struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data; - - redir.chat.exchange = csi->exchange; - redir.chat.room = csi->name; - redir.chat.instance = csi->instance; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &redir); - - g_free((void *)redir.ip); - g_free((void *)redir.cookie); - g_free((void *)redir.ssl_cert_cn); - - if (origsnac) - g_free(origsnac->data); - g_free(origsnac); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* Subtype 0x0006 - Request Rate Information. */ -void -aim_srv_reqrates(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x0006); -} - -/* - * OSCAR defines several 'rate classes'. Each class has separate - * rate limiting properties (limit level, alert level, disconnect - * level, etc), and a set of SNAC family/type pairs associated with - * it. The rate classes, their limiting properties, and the definitions - * of which SNACs belong to which class are defined in the - * Rate Response packet at login to each host. - * - * Logically, all rate offenses within one class count against further - * offenses for other SNACs in the same class (ie, sending messages - * too fast will limit the number of user info requests you can send, - * since those two SNACs are in the same rate class). - * - * Since the rate classes are defined dynamically at login, the values - * below may change. But they seem to be fairly constant. - * - * Currently, BOS defines five rate classes, with the commonly used - * members as follows... - * - * Rate class 0x0001: - * - Everything thats not in any of the other classes - * - * Rate class 0x0002: - * - Buddy list add/remove - * - Permit list add/remove - * - Deny list add/remove - * - * Rate class 0x0003: - * - User information requests - * - Outgoing ICBMs - * - * Rate class 0x0004: - * - A few unknowns: 2/9, 2/b, and f/2 - * - * Rate class 0x0005: - * - Chat room create - * - Outgoing chat ICBMs - * - * The only other thing of note is that class 5 (chat) has slightly looser - * limiting properties than class 3 (normal messages). But thats just a - * small bit of trivia for you. - * - * The last thing that needs to be learned about the rate limiting - * system is how the actual numbers relate to the passing of time. This - * seems to be a big mystery. - * - * See joscar's javadoc for the RateClassInfo class for a great - * explanation. You might be able to find it at - * http://dscoder.com/RateClassInfo.html - */ - -static struct rateclass * -rateclass_find(GSList *rateclasses, guint16 id) -{ - GSList *tmp; - - for (tmp = rateclasses; tmp != NULL; tmp = tmp->next) - { - struct rateclass *rateclass; - rateclass = tmp->data; - if (rateclass->classid == id) - return rateclass; - } - - return NULL; -} - -/* Subtype 0x0007 - Rate Parameters */ -static int -rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - guint16 numclasses, i; - aim_rxcallback_t userfunc; - - /* - * First are the parameters for each rate class. - */ - numclasses = byte_stream_get16(bs); - for (i = 0; i < numclasses; i++) - { - struct rateclass *rateclass; - guint32 delta; - struct timeval now; - - gettimeofday(&now, NULL); - rateclass = g_new0(struct rateclass, 1); - - rateclass->classid = byte_stream_get16(bs); - rateclass->windowsize = byte_stream_get32(bs); - rateclass->clear = byte_stream_get32(bs); - rateclass->alert = byte_stream_get32(bs); - rateclass->limit = byte_stream_get32(bs); - rateclass->disconnect = byte_stream_get32(bs); - rateclass->current = byte_stream_get32(bs); - rateclass->max = byte_stream_get32(bs); - - /* - * The server will send an extra five bytes of parameters - * depending on the version we advertised in 1/17. If we - * didn't send 1/17 (evil!), then this will crash and you - * die, as it will default to the old version but we have - * the new version hardcoded here. - */ - if (mod->version >= 3) - { - rateclass->delta = byte_stream_get32(bs); - rateclass->dropping_snacs = byte_stream_get8(bs); - - delta = rateclass->delta; - - rateclass->last.tv_sec = now.tv_sec - delta / 1000; - delta %= 1000; - rateclass->last.tv_usec = now.tv_usec - delta * 1000; - } - else - { - rateclass->delta = rateclass->dropping_snacs = 0; - rateclass->last.tv_sec = now.tv_sec; - rateclass->last.tv_usec = now.tv_usec; - } - - rateclass->members = g_hash_table_new(g_direct_hash, g_direct_equal); - conn->rateclasses = g_slist_prepend(conn->rateclasses, rateclass); - } - conn->rateclasses = g_slist_reverse(conn->rateclasses); - - /* - * Then the members of each class. - */ - for (i = 0; i < numclasses; i++) - { - guint16 classid, count; - struct rateclass *rateclass; - int j; - - classid = byte_stream_get16(bs); - count = byte_stream_get16(bs); - - rateclass = rateclass_find(conn->rateclasses, classid); - - for (j = 0; j < count; j++) - { - guint16 group, subtype; - - group = byte_stream_get16(bs); - subtype = byte_stream_get16(bs); - - if (rateclass != NULL) - g_hash_table_insert(rateclass->members, - GUINT_TO_POINTER((group << 16) + subtype), - GUINT_TO_POINTER(TRUE)); - } - } - - /* - * We don't pass the rate information up to the client, as it really - * doesn't care. The information is stored in the connection, however - * so that we can do rate limiting management when sending SNACs. - */ - - /* - * Subscribe to rate change information for all rate classes. - */ - aim_srv_rates_addparam(od, conn); - - /* - * Finally, tell the client it's ready to go... - */ - if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE))) - userfunc(od, conn, frame); - - return 1; -} - -/* Subtype 0x0008 - Add Rate Parameter */ -void -aim_srv_rates_addparam(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tmp; - - byte_stream_new(&bs, 502); - - for (tmp = conn->rateclasses; tmp != NULL; tmp = tmp->next) - { - struct rateclass *rateclass; - rateclass = tmp->data; - byte_stream_put16(&bs, rateclass->classid); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x0009 - Delete Rate Parameter */ -void -aim_srv_rates_delparam(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tmp; - - byte_stream_new(&bs, 502); - - for (tmp = conn->rateclasses; tmp != NULL; tmp = tmp->next) - { - struct rateclass *rateclass; - rateclass = tmp->data; - byte_stream_put16(&bs, rateclass->classid); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x000a - Rate Change */ -static int -ratechange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 code, classid; - struct rateclass *rateclass; - guint32 delta; - struct timeval now; - - gettimeofday(&now, NULL); - code = byte_stream_get16(bs); - classid = byte_stream_get16(bs); - - rateclass = rateclass_find(conn->rateclasses, classid); - if (rateclass == NULL) - /* This should never really happen */ - return 0; - - rateclass->windowsize = byte_stream_get32(bs); - rateclass->clear = byte_stream_get32(bs); - rateclass->alert = byte_stream_get32(bs); - rateclass->limit = byte_stream_get32(bs); - rateclass->disconnect = byte_stream_get32(bs); - rateclass->current = byte_stream_get32(bs); - rateclass->max = byte_stream_get32(bs); - - if (mod->version >= 3) - { - rateclass->delta = byte_stream_get32(bs); - rateclass->dropping_snacs = byte_stream_get8(bs); - - delta = rateclass->delta; - - rateclass->last.tv_sec = now.tv_sec - delta / 1000; - delta %= 1000; - rateclass->last.tv_usec = now.tv_usec - delta * 1000; - } - else - { - rateclass->delta = rateclass->dropping_snacs = 0; - rateclass->last.tv_sec = now.tv_sec; - rateclass->last.tv_usec = now.tv_usec; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - /* Can't pass in guint8 via ... varargs, so we use an unsigned int */ - unsigned int dropping_snacs = rateclass->dropping_snacs; - ret = userfunc(od, conn, frame, code, classid, rateclass->windowsize, rateclass->clear, rateclass->alert, rateclass->limit, rateclass->disconnect, rateclass->current, rateclass->max, rateclass->delta, dropping_snacs); - } - - return ret; -} - -/* - * How Migrations work. - * - * The server sends a Server Pause message, which the client should respond to - * with a Server Pause Ack, which contains the families it needs on this - * connection. The server will send a Migration Notice with an IP address, and - * then disconnect. Next the client should open the connection and send the - * cookie. Repeat the normal login process and pretend this never happened. - * - * The Server Pause contains no data. - * - */ - -/* Subtype 0x000b - Service Pause */ -static int -serverpause(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/* - * Subtype 0x000c - Service Pause Acknowledgement - * - * It is rather important that aim_srv_sendpauseack() gets called for the exact - * same connection that the Server Pause callback was called for, since - * libfaim extracts the data for the SNAC from the connection structure. - * - * Of course, if you don't do that, more bad things happen than just what - * libfaim can cause. - * - */ -void -aim_srv_sendpauseack(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *cur; - - byte_stream_new(&bs, 1014); - - /* - * This list should have all the groups that the original - * Host Online / Server Ready said this host supports. And - * we want them all back after the migration. - */ - for (cur = conn->groups; cur != NULL; cur = cur->next) - byte_stream_put16(&bs, GPOINTER_TO_UINT(cur->data)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x000d - Service Resume */ -static int -serverresume(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/* Subtype 0x000e - Request self-info */ -void -aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x000e); -} - -/* Subtype 0x000f - Self User Info */ -static int -selfinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_userinfo_t userinfo; - - aim_info_extract(od, bs, &userinfo); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &userinfo); - - aim_info_free(&userinfo); - - return ret; -} - -/* Subtype 0x0010 - Evil Notification */ -static int -evilnotify(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 newevil; - aim_userinfo_t userinfo; - - memset(&userinfo, 0, sizeof(aim_userinfo_t)); - - newevil = byte_stream_get16(bs); - - if (byte_stream_empty(bs)) - aim_info_extract(od, bs, &userinfo); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, newevil, &userinfo); - - aim_info_free(&userinfo); - - return ret; -} - -/* - * Subtype 0x0011 - Idle Notification - * - * Should set your current idle time in seconds. Note that this should - * never be called consecutively with a non-zero idle time. That makes - * OSCAR do funny things. Instead, just set it once you go idle, and then - * call it again with zero when you're back. - * - */ -void -aim_srv_setidle(OscarData *od, guint32 idletime) -{ - FlapConnection *conn; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - if(!conn) - return; - - aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0011, &idletime); -} - -/* - * Subtype 0x0012 - Service Migrate - * - * This is the final SNAC sent on the original connection during a migration. - * It contains the IP and cookie used to connect to the new server, and - * optionally a list of the SNAC groups being migrated. - * - */ -static int -migrate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - int ret = 0; - guint16 groupcount, i; - GSList *tlvlist; - char *ip = NULL; - aim_tlv_t *cktlv; - - /* - * Apparently there's some fun stuff that can happen right here. The - * migration can actually be quite selective about what groups it - * moves to the new server. When not all the groups for a connection - * are migrated, or they are all migrated but some groups are moved - * to a different server than others, it is called a bifurcated - * migration. - * - * Let's play dumb and not support that. - * - */ - groupcount = byte_stream_get16(bs); - for (i = 0; i < groupcount; i++) { - guint16 group; - - group = byte_stream_get16(bs); - - purple_debug_misc("oscar", "bifurcated migration unsupported -- group 0x%04x\n", group); - } - - tlvlist = aim_tlvlist_read(bs); - - if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) - ip = aim_tlv_getstr(tlvlist, 0x0005, 1); - - cktlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, ip, cktlv ? cktlv->value : NULL); - - aim_tlvlist_free(tlvlist); - g_free(ip); - - return ret; -} - -/* Subtype 0x0013 - Message of the Day */ -static int -motd(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - char *msg = NULL; - int ret = 0; - GSList *tlvlist; - guint16 id; - - /* - * Code. - * - * Valid values: - * 1 Mandatory upgrade - * 2 Advisory upgrade - * 3 System bulletin - * 4 Nothing's wrong ("top o the world" -- normal) - * 5 Lets-break-something. - * - */ - id = byte_stream_get16(bs); - - /* - * TLVs follow - */ - tlvlist = aim_tlvlist_read(bs); - - msg = aim_tlv_getstr(tlvlist, 0x000b, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, id, msg); - - g_free(msg); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0014 - Set privacy flags - * - * Normally 0x03. - * - * Bit 1: Allows other AIM users to see how long you've been idle. - * Bit 2: Allows other AIM users to see how long you've been a member. - * - */ -void -aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags) -{ - aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0014, &flags); -} - -/* - * Subtype 0x0016 - No-op - * - * WinAIM sends these every 4min or so to keep the connection alive. Its not - * really necessary. - * - * Wha? No? Since when? I think WinAIM sends an empty channel 5 - * FLAP as a no-op... - */ -void -aim_srv_nop(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n(od, conn, SNAC_FAMILY_OSERVICE, 0x0016); -} - -/* - * Subtype 0x0017 - Set client versions - * - * If you've seen the clientonline/clientready SNAC you're probably - * wondering what the point of this one is. And that point seems to be - * that the versions in the client online SNAC are sent too late for the - * server to be able to use them to change the protocol for the earlier - * login packets (client versions are sent right after Host Online is - * received, but client online versions aren't sent until quite a bit later). - * We can see them already making use of this by changing the format of - * the rate information based on what version of group 1 we advertise here. - * - */ -void -aim_srv_setversions(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *cur; - - byte_stream_new(&bs, 1142); - - /* - * Send only the versions that the server cares about (that it - * marked as supporting in the server ready SNAC). - */ - for (cur = conn->groups; cur != NULL; cur = cur->next) - { - aim_module_t *mod; - - if ((mod = aim__findmodulebygroup(od, GPOINTER_TO_UINT(cur->data)))) - { - byte_stream_put16(&bs, mod->family); - byte_stream_put16(&bs, mod->version); - } - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x0018 - Host versions */ -static int -hostversions(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int vercount; - guint8 *versions; - - /* This is frivolous. (Thank you SmarterChild.) */ - vercount = byte_stream_empty(bs)/4; - versions = byte_stream_getraw(bs, byte_stream_empty(bs)); - g_free(versions); - - /* - * Now request rates. - */ - aim_srv_reqrates(od, conn); - - return 1; -} - -/** - * Subtype 0x001e - Extended Status/Extra Info. - * - * These settings are transient, not server-stored (i.e. they only - * apply to this session, and must be re-set the next time you sign - * on). - * - * You can set your ICQ status (available, away, do not disturb, - * etc.), or whether your IP address should be hidden or not, or - * if your status is visible on ICQ web sites, and you can set - * your IP address info and what not. - * - * You can also set your "available" message. This is currently - * only supported by iChat, Purple and other 3rd party clients. - * - * These are the same TLVs seen in user info. You can - * also set 0x0008 and 0x000c. - */ -int -aim_srv_setextrainfo(OscarData *od, - gboolean seticqstatus, guint32 icqstatus, - gboolean setstatusmsg, const char *statusmsg, const char *itmsurl) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (seticqstatus) - { - aim_tlvlist_add_32(&tlvlist, 0x0006, icqstatus | - AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_DIRECTREQUIREAUTH); - } - -#if 0 - if (other_stuff_that_isnt_implemented) - { - aim_tlvlist_add_raw(&tlvlist, 0x000c, 0x0025, - chunk_of_x25_bytes_with_ip_address_etc); - aim_tlvlist_add_raw(&tlvlist, 0x0011, 0x0005, unknown 0x01 61 10 f6 41); - aim_tlvlist_add_16(&tlvlist, 0x0012, unknown 0x00 00); - } -#endif - - if (setstatusmsg) - { - size_t statusmsglen, itmsurllen; - ByteStream tmpbs; - - statusmsglen = (statusmsg != NULL) ? strlen(statusmsg) : 0; - itmsurllen = (itmsurl != NULL) ? strlen(itmsurl) : 0; - - byte_stream_new(&tmpbs, statusmsglen + 8 + itmsurllen + 8); - byte_stream_put_bart_asset_str(&tmpbs, 0x0002, statusmsg); - byte_stream_put_bart_asset_str(&tmpbs, 0x0009, itmsurl); - - aim_tlvlist_add_raw(&tlvlist, 0x001d, - byte_stream_curpos(&tmpbs), tmpbs.data); - byte_stream_destroy(&tmpbs); - } - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Starting this past week (26 Mar 2001, say), AOL has started sending - * this nice little extra SNAC. AFAIK, it has never been used until now. - * - * The request contains eight bytes. The first four are an offset, the - * second four are a length. - * - * The offset is an offset into aim.exe when it is mapped during execution - * on Win32. So far, AOL has only been requesting bytes in static regions - * of memory. (I won't put it past them to start requesting data in - * less static regions -- regions that are initialized at run time, but still - * before the client receives this request.) - * - * When the client receives the request, it adds it to the current ds - * (0x00400000) and dereferences it, copying the data into a buffer which - * it then runs directly through the MD5 hasher. The 16 byte output of - * the hash is then sent back to the server. - * - * If the client does not send any data back, or the data does not match - * the data that the specific client should have, the client will get the - * following message from "AOL Instant Messenger": - * "You have been disconnected from the AOL Instant Message Service (SM) - * for accessing the AOL network using unauthorized software. You can - * download a FREE, fully featured, and authorized client, here - * http://www.aol.com/aim/download2.html" - * The connection is then closed, receiving disconnect code 1, URL - * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html. - * - * Note, however, that numerous inconsistencies can cause the above error, - * not just sending back a bad hash. Do not immediatly suspect this code - * if you get disconnected. AOL and the open/free software community have - * played this game for a couple years now, generating the above message - * on numerous ocassions. - * - * Anyway, neener. We win again. - * - */ -/* Subtype 0x001f - Client verification */ -static int -memrequest(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint32 offset, len; - GSList *tlvlist; - char *modname; - - offset = byte_stream_get32(bs); - len = byte_stream_get32(bs); - tlvlist = aim_tlvlist_read(bs); - - modname = aim_tlv_getstr(tlvlist, 0x0001, 1); - - purple_debug_info("oscar", "Got memory request for data at 0x%08x (%u bytes) of requested %s\n", offset, len, modname ? modname : "aim.exe"); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, offset, len, modname); - - g_free(modname); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* Subtype 0x0020 - Client verification reply */ -int -aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !conn) - return -EINVAL; - - byte_stream_new(&bs, 2+16); - - byte_stream_put16(&bs, 0x0010); /* md5 is always 16 bytes */ - - if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */ - - byte_stream_putraw(&bs, buf, 0x10); - - } else if (buf && (len > 0)) { /* use input buffer */ - PurpleCipherContext *context; - guchar digest[16]; - - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, buf, len); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - byte_stream_putraw(&bs, digest, 0x10); - - } else if (len == 0) { /* no length, just hash NULL (buf is optional) */ - PurpleCipherContext *context; - guchar digest[16]; - guint8 nil = '\0'; - - /* - * I'm not sure if we really need the empty append with the - * new MD5 functions, so I'll leave it in, just in case. - */ - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, &nil, 0); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - byte_stream_putraw(&bs, digest, 0x10); - - } else { - - /* - * This data is correct for AIM 3.5.1670. - * - * Using these blocks is as close to "legal" as you can get - * without using an AIM binary. - * - */ - if ((offset == 0x03ffffff) && (len == 0x03ffffff)) { - -#if 1 /* with "AnrbnrAqhfzcd" */ - byte_stream_put32(&bs, 0x44a95d26); - byte_stream_put32(&bs, 0xd2490423); - byte_stream_put32(&bs, 0x93b8821f); - byte_stream_put32(&bs, 0x51c54b01); -#else /* no filename */ - byte_stream_put32(&bs, 0x1df8cbae); - byte_stream_put32(&bs, 0x5523b839); - byte_stream_put32(&bs, 0xa0e10db3); - byte_stream_put32(&bs, 0xa46d3b39); -#endif - - } else - purple_debug_warning("oscar", "sendmemblock: unknown hash request\n"); - - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0021 - Receive our extended status - * - * This is used for iChat's "available" messages, and maybe ICQ extended - * status messages? It's also used to tell the client whether or not it - * needs to upload an SSI buddy icon... who engineers this stuff, anyway? - */ -static int -aim_parse_extstatus(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 type; - guint8 flags, length; - - type = byte_stream_get16(bs); - flags = byte_stream_get8(bs); - length = byte_stream_get8(bs); - - /* - * A flag of 0x01 could mean "this is the checksum we have for you" - * A flag of 0x40 could mean "I don't have your icon, upload it" - */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - switch (type) { - case 0x0000: - case 0x0001: { /* buddy icon checksum */ - /* not sure what the difference between 1 and 0 is */ - guint8 *md5 = byte_stream_getraw(bs, length); - ret = userfunc(od, conn, frame, type, flags, length, md5); - g_free(md5); - } break; - case 0x0002: { /* available message */ - /* there is a second length that is just for the message */ - char *msg = byte_stream_getstr(bs, byte_stream_get16(bs)); - ret = userfunc(od, conn, frame, msg); - g_free(msg); - } break; - } - } - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return hostonline(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0005) - return redirect(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0007) - return rateresp(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000a) - return ratechange(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000b) - return serverpause(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000d) - return serverresume(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000f) - return selfinfo(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0010) - return evilnotify(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0012) - return migrate(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0013) - return motd(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0018) - return hostversions(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x001f) - return memrequest(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0021) - return aim_parse_extstatus(od, conn, mod, frame, snac, bs); - - return 0; -} - -int service_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_OSERVICE; - mod->version = 0x0003; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "oservice", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_popup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_popup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_popup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_popup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0008 - Popups. - * - * Popups are just what it sounds like. They're a way for the server to - * open up an informative box on the client's screen. - */ - -#include - -/* - * This is all there is to it. - * - * The message is probably HTML. - * - */ -static int -parsepopup(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist; - int ret = 0; - char *msg, *url; - guint16 width, height, delay; - - tlvlist = aim_tlvlist_read(bs); - - msg = aim_tlv_getstr(tlvlist, 0x0001, 1); - url = aim_tlv_getstr(tlvlist, 0x0002, 1); - width = aim_tlv_get16(tlvlist, 0x0003, 1); - height = aim_tlv_get16(tlvlist, 0x0004, 1); - delay = aim_tlv_get16(tlvlist, 0x0005, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, msg, url, width, height, delay); - - aim_tlvlist_free(tlvlist); - g_free(msg); - g_free(url); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0002) - return parsepopup(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -popups_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_POPUP; - mod->version = 0x0001; - mod->toolid = 0x0104; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "popup", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_stats.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_stats.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_stats.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_stats.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000b - Statistics. - * - */ - -#include - -static int -reportinterval(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 interval; - - interval = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, interval); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0002) - return reportinterval(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -stats_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_STATS; - mod->version = 0x0001; - mod->toolid = 0x0104; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "stats", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_translate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_translate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_translate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_translate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000c - Translation. - * - * I have no idea why this group was issued. I have never seen anything - * that uses it. From what I remember, the last time I tried to poke at - * the server with this group, it whined about not supporting it. - * - * But we advertise it anyway, because its fun. - * - */ - -#include "oscar.h" - -int translate_modfirst(OscarData *od, aim_module_t *mod) -{ - - mod->family = SNAC_FAMILY_TRANSLATE; - mod->version = 0x0001; - mod->toolid = 0x0104; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "translate", sizeof(mod->name)); - mod->snachandler = NULL; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_userlookup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_userlookup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_userlookup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/family_userlookup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000a - User Search. - * - * TODO: Add aim_usersearch_name() - * - */ - -#include "oscar.h" - -/* - * Subtype 0x0001 - * - * XXX can this be integrated with the rest of the error handling? - */ -static int error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - - /* XXX the modules interface should have already retrieved this for us */ - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "search error: couldn't get a snac for 0x%08x\n", snac->id); - return 0; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac2->data /* address */); - - /* XXX freesnac()? */ - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/* - * Subtype 0x0002 - * - */ -int aim_search_address(OscarData *od, const char *address) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_USERLOOKUP); - - if (!conn || !address) - return -EINVAL; - - byte_stream_new(&bs, strlen(address)); - - byte_stream_putstr(&bs, address); - - snacid = aim_cachesnac(od, SNAC_FAMILY_USERLOOKUP, 0x0002, 0x0000, address, strlen(address)+1); - flap_connection_send_snac(od, conn, SNAC_FAMILY_USERLOOKUP, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0003 - * - */ -static int reply(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int j = 0, m, ret = 0; - GSList *tlvlist; - char *cur = NULL, *buf = NULL; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - const char *searchaddr = NULL; - - if ((snac2 = aim_remsnac(od, snac->id))) - searchaddr = (const char *)snac2->data; - - tlvlist = aim_tlvlist_read(bs); - m = aim_tlvlist_count(tlvlist); - - /* XXX uhm. - * This is the only place that uses something other than 1 for the 3rd - * parameter to aim_tlv_gettlv_whatever(). - */ - while ((cur = aim_tlv_getstr(tlvlist, 0x0001, j+1)) && j < m) - { - buf = g_realloc(buf, (j+1) * (MAXSNLEN+1)); - - strncpy(&buf[j * (MAXSNLEN+1)], cur, MAXSNLEN); - g_free(cur); - - j++; - } - g_free(cur); - - aim_tlvlist_free(tlvlist); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, searchaddr, j, buf); - - /* XXX freesnac()? */ - if (snac2) - g_free(snac2->data); - g_free(snac2); - - g_free(buf); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0003) - return reply(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -search_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_USERLOOKUP; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "userlookup", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/flap_connection.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/flap_connection.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/flap_connection.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/flap_connection.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1146 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" - -#include "eventloop.h" -#include "proxy.h" - -#ifndef _WIN32 -#include -#include -#include -#endif - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/** - * This sends a channel 1 SNAC containing the FLAP version. - * The FLAP version is sent by itself at the beginning of every - * connection to a FLAP server. It is always the very first - * packet sent by both the server and the client after the SYN, - * SYN/ACK, ACK handshake. - */ -void -flap_connection_send_version(OscarData *od, FlapConnection *conn) -{ - FlapFrame *frame; - - frame = flap_frame_new(od, 0x01, 4); - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - flap_connection_send(conn, frame); -} - -/** - * This sends a channel 1 FLAP containing the FLAP version and - * the authentication cookie. This is sent when connecting to - * any FLAP server after the initial connection to the auth - * server. It is always the very first packet sent by both the - * server and the client after the SYN, SYN/ACK, ACK handshake. - */ -void -flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - - frame = flap_frame_new(od, 0x01, 4 + 2 + 2 + length); - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_raw(&tlvlist, 0x0006, length, chipsahoy); - aim_tlvlist_write(&frame->data, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); -} - -void -flap_connection_send_version_with_cookie_and_clientinfo(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy, ClientInfo *ci, gboolean allow_multiple_logins) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - - frame = flap_frame_new(od, 0x01, 1152 + length); - - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_raw(&tlvlist, 0x0006, length, chipsahoy); - - if (ci->clientstring != NULL) - aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); - else { - gchar *clientstring = oscar_get_clientstring(); - aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring); - g_free(clientstring); - } - aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); - aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); - aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); - aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); - aim_tlvlist_add_8(&tlvlist, 0x004a, (allow_multiple_logins ? 0x01 : 0x03)); - - aim_tlvlist_write(&frame->data, &tlvlist); - - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); -} - -static struct rateclass * -flap_connection_get_rateclass(FlapConnection *conn, guint16 family, guint16 subtype) -{ - GSList *tmp1; - gconstpointer key; - - key = GUINT_TO_POINTER((family << 16) + subtype); - - for (tmp1 = conn->rateclasses; tmp1 != NULL; tmp1 = tmp1->next) - { - struct rateclass *rateclass; - rateclass = tmp1->data; - - if (g_hash_table_lookup(rateclass->members, key)) - return rateclass; - } - - return NULL; -} - -/* - * Attempt to calculate what our new current average would be if we - * were to send a SNAC in this rateclass at the given time. - */ -static guint32 -rateclass_get_new_current(FlapConnection *conn, struct rateclass *rateclass, struct timeval *now) -{ - unsigned long timediff; /* In milliseconds */ - guint32 current; - - timediff = (now->tv_sec - rateclass->last.tv_sec) * 1000 + (now->tv_usec - rateclass->last.tv_usec) / 1000; - current = ((rateclass->current * (rateclass->windowsize - 1)) + timediff) / rateclass->windowsize; - - /* This formula is taken from http://dev.aol.com/aim/oscar/#RATELIMIT */ - return MIN(current, rateclass->max); -} - -/* - * Attempt to send the contents of a given queue - * - * @return TRUE if the queue was completely emptied or was initially - * empty; FALSE if rate limiting prevented it from being - * emptied. - */ -static gboolean flap_connection_send_snac_queue(FlapConnection *conn, struct timeval now, GQueue *queue) -{ - while (!g_queue_is_empty(queue)) - { - QueuedSnac *queued_snac; - struct rateclass *rateclass; - - queued_snac = g_queue_peek_head(queue); - - rateclass = flap_connection_get_rateclass(conn, queued_snac->family, queued_snac->subtype); - if (rateclass != NULL) - { - guint32 new_current; - - new_current = rateclass_get_new_current(conn, rateclass, &now); - - if (rateclass->dropping_snacs || new_current <= rateclass->alert) - /* Not ready to send this SNAC yet--keep waiting. */ - return FALSE; - - rateclass->current = new_current; - rateclass->last.tv_sec = now.tv_sec; - rateclass->last.tv_usec = now.tv_usec; - } - - flap_connection_send(conn, queued_snac->frame); - g_free(queued_snac); - g_queue_pop_head(queue); - } - - /* We emptied the queue */ - return TRUE; -} - -static gboolean flap_connection_send_queued(gpointer data) -{ - FlapConnection *conn; - struct timeval now; - - conn = data; - gettimeofday(&now, NULL); - - purple_debug_info("oscar", "Attempting to send %u queued SNACs and %u queued low-priority SNACs for %p\n", - (conn->queued_snacs ? conn->queued_snacs->length : 0), - (conn->queued_lowpriority_snacs ? conn->queued_lowpriority_snacs->length : 0), - conn); - if (!conn->queued_snacs || flap_connection_send_snac_queue(conn, now, conn->queued_snacs)) { - if (!conn->queued_lowpriority_snacs || flap_connection_send_snac_queue(conn, now, conn->queued_lowpriority_snacs)) { - /* Both queues emptied. */ - conn->queued_timeout = 0; - return FALSE; - } - } - - /* We couldn't send all our SNACs. Keep trying */ - return TRUE; -} - -/** - * This sends a channel 2 FLAP containing a SNAC. The SNAC family and - * subtype are looked up in the rate info for this connection, and if - * sending this SNAC will induce rate limiting then we delay sending - * of the SNAC by putting it into an outgoing holding queue. - * - * @param data The optional bytestream that makes up the data portion - * of this SNAC. For empty SNACs this should be NULL. - * @param high_priority If TRUE, the SNAC will be queued normally if - * needed. If FALSE, it wil be queued separately, to be sent - * only if all high priority SNACs have been sent. - */ -void -flap_connection_send_snac_with_priority(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data, gboolean high_priority) -{ - FlapFrame *frame; - guint32 length; - gboolean enqueue = FALSE; - struct rateclass *rateclass; - - length = data != NULL ? data->offset : 0; - - frame = flap_frame_new(od, 0x02, 10 + length); - aim_putsnac(&frame->data, family, subtype, flags, snacid); - - if (length > 0) - { - byte_stream_rewind(data); - byte_stream_putbs(&frame->data, data, length); - } - - if (conn->queued_timeout != 0) - enqueue = TRUE; - else if ((rateclass = flap_connection_get_rateclass(conn, family, subtype)) != NULL) - { - struct timeval now; - guint32 new_current; - - gettimeofday(&now, NULL); - new_current = rateclass_get_new_current(conn, rateclass, &now); - - if (rateclass->dropping_snacs || new_current <= rateclass->alert) - { - purple_debug_info("oscar", "Current rate for conn %p would be %u, but we alert at %u; enqueueing\n", conn, new_current, rateclass->alert); - - enqueue = TRUE; - } - else - { - rateclass->current = new_current; - rateclass->last.tv_sec = now.tv_sec; - rateclass->last.tv_usec = now.tv_usec; - } - } else { - /* - * It's normal for SNACs 0x0001/0x0006 and 0x0001/0x0017 to be - * sent before we receive rate info from the server, so don't - * bother warning about them. - */ - if (family != 0x0001 || (subtype != 0x0006 && subtype != 0x0017)) - purple_debug_warning("oscar", "No rate class found for family 0x%04hx subtype 0x%04hx\n", family, subtype); - } - - if (enqueue) - { - /* We've been sending too fast, so delay this message */ - QueuedSnac *queued_snac; - - queued_snac = g_new(QueuedSnac, 1); - queued_snac->family = family; - queued_snac->subtype = subtype; - queued_snac->frame = frame; - - if (high_priority) { - if (!conn->queued_snacs) - conn->queued_snacs = g_queue_new(); - g_queue_push_tail(conn->queued_snacs, queued_snac); - } else { - if (!conn->queued_lowpriority_snacs) - conn->queued_lowpriority_snacs = g_queue_new(); - g_queue_push_tail(conn->queued_lowpriority_snacs, queued_snac); - } - - if (conn->queued_timeout == 0) - conn->queued_timeout = purple_timeout_add(500, flap_connection_send_queued, conn); - - return; - } - - flap_connection_send(conn, frame); -} - -void -flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data) -{ - flap_connection_send_snac_with_priority(od, conn, family, subtype, flags, snacid, data, TRUE); -} - -/** - * This sends an empty channel 4 FLAP. This is sent to signify - * that we're logging off. This shouldn't really be necessary-- - * usually the AIM server will detect that the TCP connection has - * been destroyed--but it's good practice. - */ -static void -flap_connection_send_close(OscarData *od, FlapConnection *conn) -{ - FlapFrame *frame; - - frame = flap_frame_new(od, 0x04, 0); - flap_connection_send(conn, frame); -} - -/** - * This sends an empty channel 5 FLAP. This is used as a keepalive - * packet in FLAP connections. WinAIM 4.x and higher send these - * _every minute_ to keep the connection alive. - */ -void -flap_connection_send_keepalive(OscarData *od, FlapConnection *conn) -{ - FlapFrame *frame; - - frame = flap_frame_new(od, 0x05, 0); - flap_connection_send(conn, frame); - - /* clean out SNACs over 60sec old */ - aim_cleansnacs(od, 60); -} - -/** - * Allocate a new empty connection structure. - * - * @param od The oscar session associated with this connection. - * @param type Type of connection to create - * - * @return Returns the new connection structure. - */ -FlapConnection * -flap_connection_new(OscarData *od, int type) -{ - FlapConnection *conn; - - conn = g_new0(FlapConnection, 1); - conn->od = od; - conn->buffer_outgoing = purple_circ_buffer_new(0); - conn->fd = -1; - conn->subtype = -1; - conn->type = type; - - od->oscar_connections = g_slist_prepend(od->oscar_connections, conn); - - return conn; -} - -/** - * Close (but not free) a connection. - * - * This cancels any currently pending connection attempt, - * closes any open fd and frees the auth cookie. - * - * @param conn The connection to close. - */ -void -flap_connection_close(OscarData *od, FlapConnection *conn) -{ - if (conn->connect_data != NULL) - { - purple_proxy_connect_cancel(conn->connect_data); - conn->connect_data = NULL; - } - - if (conn->new_conn_data != NULL) - { - if (conn->type == SNAC_FAMILY_CHAT) - { - oscar_chat_destroy(conn->new_conn_data); - conn->new_conn_data = NULL; - } - } - - if ((conn->fd >= 0 || conn->gsc != NULL) - && conn->type == SNAC_FAMILY_LOCATE) - flap_connection_send_close(od, conn); - - if (conn->watcher_incoming != 0) - { - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - } - - if (conn->watcher_outgoing != 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - } - - if (conn->fd >= 0) - { - close(conn->fd); - conn->fd = -1; - } - - if (conn->gsc != NULL) - { - purple_ssl_close(conn->gsc); - conn->gsc = NULL; - } - - g_free(conn->buffer_incoming.data.data); - conn->buffer_incoming.data.data = NULL; - - purple_circ_buffer_destroy(conn->buffer_outgoing); - conn->buffer_outgoing = NULL; -} - -static void -flap_connection_destroy_rateclass(struct rateclass *rateclass) -{ - g_hash_table_destroy(rateclass->members); - g_free(rateclass); -} - -/** - * Free a FlapFrame - * - * @param frame The frame to free. - */ -static void -flap_frame_destroy(FlapFrame *frame) -{ - g_free(frame->data.data); - g_free(frame); -} - -static gboolean -flap_connection_destroy_cb(gpointer data) -{ - FlapConnection *conn; - OscarData *od; - PurpleAccount *account; - aim_rxcallback_t userfunc; - - conn = data; - od = conn->od; - account = purple_connection_get_account(od->gc); - - purple_debug_info("oscar", "Destroying oscar connection of " - "type 0x%04hx. Disconnect reason is %d\n", - conn->type, conn->disconnect_reason); - - od->oscar_connections = g_slist_remove(od->oscar_connections, conn); - - if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) - userfunc(od, conn, NULL, conn->disconnect_code, conn->error_message); - - /* - * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then - * we should try to request one instead of disconnecting. - */ - if (!account->disconnecting && ((od->oscar_connections == NULL) - || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE)))) - { - /* No more FLAP connections! Sign off this PurpleConnection! */ - gchar *tmp; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - - if (conn->disconnect_code == 0x0001) { - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - tmp = g_strdup(_("You have signed on from another location")); - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - tmp = g_strdup(_("Server closed the connection")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - tmp = g_strdup_printf(_("Lost connection with server: %s"), - conn->error_message); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - tmp = g_strdup(_("Received invalid data on connection with server")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - tmp = g_strdup_printf(_("Unable to connect: %s"), - conn->error_message); - else - /* - * We shouldn't print a message for some disconnect_reasons. - * Like OSCAR_DISCONNECT_LOCAL_CLOSED. - */ - tmp = NULL; - - if (tmp != NULL) - { - purple_connection_error_reason(od->gc, reason, tmp); - g_free(tmp); - } - } - - flap_connection_close(od, conn); - - g_free(conn->error_message); - g_free(conn->cookie); - - /* - * Free conn->internal, if necessary - */ - if (conn->type == SNAC_FAMILY_CHAT) - flap_connection_destroy_chat(od, conn); - - g_slist_free(conn->groups); - while (conn->rateclasses != NULL) - { - flap_connection_destroy_rateclass(conn->rateclasses->data); - conn->rateclasses = g_slist_delete_link(conn->rateclasses, conn->rateclasses); - } - - if (conn->queued_snacs) { - while (!g_queue_is_empty(conn->queued_snacs)) - { - QueuedSnac *queued_snac; - queued_snac = g_queue_pop_head(conn->queued_snacs); - flap_frame_destroy(queued_snac->frame); - g_free(queued_snac); - } - g_queue_free(conn->queued_snacs); - } - - if (conn->queued_lowpriority_snacs) { - while (!g_queue_is_empty(conn->queued_lowpriority_snacs)) - { - QueuedSnac *queued_snac; - queued_snac = g_queue_pop_head(conn->queued_lowpriority_snacs); - flap_frame_destroy(queued_snac->frame); - g_free(queued_snac); - } - g_queue_free(conn->queued_lowpriority_snacs); - } - - if (conn->queued_timeout > 0) - purple_timeout_remove(conn->queued_timeout); - - g_free(conn); - - return FALSE; -} - -/** - * See the comments for the parameters of - * flap_connection_schedule_destroy(). - */ -void -flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - purple_timeout_remove(conn->destroy_timeout); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - flap_connection_destroy_cb(conn); -} - -/** - * Schedule Purple to destroy the given FlapConnection as soon as we - * return control back to the program's main loop. We must do this - * if we want to destroy the connection but we are still using it - * for some reason. - * - * @param reason The reason for the disconnection. - * @param error_message A brief error message that gives more detail - * regarding the reason for the disconnecting. This should - * be NULL for everything except OSCAR_DISCONNECT_LOST_CONNECTION, - * in which case it should contain the value of g_strerror(errno), - * and OSCAR_DISCONNECT_COULD_NOT_CONNECT, in which case it - * should contain the error_message passed back from the call - * to purple_proxy_connect(). - */ -void -flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - /* Already taken care of */ - return; - - purple_debug_info("oscar", "Scheduling destruction of FLAP " - "connection of type 0x%04hx\n", conn->type); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - conn->destroy_timeout = purple_timeout_add(0, flap_connection_destroy_cb, conn); -} - -/** - * In OSCAR, every connection has a set of SNAC groups associated - * with it. These are the groups that you can send over this connection - * without being guaranteed a "Not supported" SNAC error. - * - * The grand theory of things says that these associations transcend - * what libfaim calls "connection types" (conn->type). You can probably - * see the elegance here, but since I want to revel in it for a bit, you - * get to hear it all spelled out. - * - * So let us say that you have your core BOS connection running. One - * of your modules has just given you a SNAC of the group 0x0004 to send - * you. Maybe an IM destined for some twit in Greenland. So you start - * at the top of your connection list, looking for a connection that - * claims to support group 0x0004. You find one. Why, that neat BOS - * connection of yours can do that. So you send it on its way. - * - * Now, say, that fellow from Greenland has friends and they all want to - * meet up with you in a lame chat room. This has landed you a SNAC - * in the family 0x000e and you have to admit you're a bit lost. You've - * searched your connection list for someone who wants to make your life - * easy and deliver this SNAC for you, but there isn't one there. - * - * Here comes the good bit. Without even letting anyone know, particularly - * the module that decided to send this SNAC, and definitely not that twit - * in Greenland, you send out a service request. In this request, you have - * marked the need for a connection supporting group 0x000e. A few seconds - * later, you receive a service redirect with an IP address and a cookie in - * it. Great, you say. Now I have something to do. Off you go, making - * that connection. One of the first things you get from this new server - * is a message saying that indeed it does support the group you were looking - * for. So you continue and send rate confirmation and all that. - * - * Then you remember you had that SNAC to send, and now you have a means to - * do it, and you do, and everyone is happy. Except the Greenlander, who is - * still stuck in the bitter cold. - * - * Oh, and this is useful for building the Migration SNACs, too. In the - * future, this may help convince me to implement rate limit mitigation - * for real. We'll see. - * - * Just to make me look better, I'll say that I've known about this great - * scheme for quite some time now. But I still haven't convinced myself - * to make libfaim work that way. It would take a fair amount of effort, - * and probably some client API changes as well. (Whenever I don't want - * to do something, I just say it would change the client API. Then I - * instantly have a couple of supporters of not doing it.) - * - * Generally, addgroup is only called by the internal handling of the - * server ready SNAC. So if you want to do something before that, you'll - * have to be more creative. That is done rather early, though, so I don't - * think you have to worry about it. Unless you're me. I care deeply - * about such inane things. - * - */ - -/** - * Find a FlapConnection that supports the given oscar - * family. - */ -FlapConnection * -flap_connection_findbygroup(OscarData *od, guint16 group) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur != NULL; cur = cur->next) - { - FlapConnection *conn; - GSList *l; - - conn = cur->data; - - for (l = conn->groups; l != NULL; l = l->next) - { - if (GPOINTER_TO_UINT(l->data) == group) - return conn; - } - } - - return NULL; -} - -/** - * Locates a connection of the specified type in the - * specified session. - * - * TODO: Use flap_connection_findbygroup everywhere and get rid of this. - * - * @param od The session to search. - * @param type The type of connection to look for. - * - * @return Returns the first connection found of the given target type, - * or NULL if none could be found. - */ -FlapConnection * -flap_connection_getbytype(OscarData *od, int type) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur != NULL; cur = cur->next) - { - FlapConnection *conn; - conn = cur->data; - if ((conn->type == type) && (conn->connected)) - return conn; - } - - return NULL; -} - -FlapConnection * -flap_connection_getbytype_all(OscarData *od, int type) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur; cur = cur->next) - { - FlapConnection *conn; - conn = cur->data; - if (conn->type == type) - return conn; - } - - return NULL; -} - -/** - * Allocate a new FLAP frame. - * - * @param channel The FLAP channel. This is almost always 2. - */ -FlapFrame * -flap_frame_new(OscarData *od, guint16 channel, int datalen) -{ - FlapFrame *frame; - - frame = g_new0(FlapFrame, 1); - frame->channel = channel; - - if (datalen > 0) - byte_stream_new(&frame->data, datalen); - - return frame; -} - -static void -parse_snac(OscarData *od, FlapConnection *conn, FlapFrame *frame) -{ - aim_module_t *cur; - aim_modsnac_t snac; - - if (byte_stream_empty(&frame->data) < 10) - return; - - snac.family = byte_stream_get16(&frame->data); - snac.subtype = byte_stream_get16(&frame->data); - snac.flags = byte_stream_get16(&frame->data); - snac.id = byte_stream_get32(&frame->data); - - /* SNAC flags are apparently uniform across all SNACs, so we handle them here */ - if (snac.flags & 0x0001) { - /* - * This means the SNAC will be followed by another SNAC with - * related information. We don't need to do anything about - * this here. - */ - } - if (snac.flags & 0x8000) { - /* - * This packet contains the version of the family that this SNAC is - * in. You get this when your SSI module is version 2 or higher. - * For now we have no need for this, but you could always save - * it as a part of aim_modnsac_t, or something. The format is... - * 2 byte length of total mini-header (which is 6 bytes), then TLV - * of type 0x0001, length 0x0002, value is the 2 byte version - * number - */ - byte_stream_advance(&frame->data, byte_stream_get16(&frame->data)); - } - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - - if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && - (cur->family != snac.family)) - continue; - - if (cur->snachandler(od, conn, cur, frame, &snac, &frame->data)) - return; - } -} - -static void -parse_fakesnac(OscarData *od, FlapConnection *conn, FlapFrame *frame, guint16 family, guint16 subtype) -{ - aim_module_t *cur; - aim_modsnac_t snac; - - snac.family = family; - snac.subtype = subtype; - snac.flags = snac.id = 0; - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - - if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && - (cur->family != snac.family)) - continue; - - if (cur->snachandler(od, conn, cur, frame, &snac, &frame->data)) - return; - } -} - -static void -parse_flap_ch4(OscarData *od, FlapConnection *conn, FlapFrame *frame) -{ - GSList *tlvlist; - char *msg = NULL; - - if (byte_stream_empty(&frame->data) == 0) { - /* XXX should do something with this */ - return; - } - - /* An ICQ account is logging in */ - if (conn->type == SNAC_FAMILY_AUTH) - { - parse_fakesnac(od, conn, frame, 0x0017, 0x0003); - return; - } - - tlvlist = aim_tlvlist_read(&frame->data); - - if (aim_tlv_gettlv(tlvlist, 0x0009, 1)) - conn->disconnect_code = aim_tlv_get16(tlvlist, 0x0009, 1); - - if (aim_tlv_gettlv(tlvlist, 0x000b, 1)) - msg = aim_tlv_getstr(tlvlist, 0x000b, 1); - - /* - * The server ended this FLAP connnection, so let's be nice and - * close the physical TCP connection - */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_REMOTE_CLOSED, msg); - - aim_tlvlist_free(tlvlist); - - g_free(msg); -} - -/** - * Takes a new incoming FLAP frame and sends it to the appropriate - * handler function to be parsed. - */ -static void -parse_flap(OscarData *od, FlapConnection *conn, FlapFrame *frame) -{ - if (frame->channel == 0x01) { - guint32 flap_version = byte_stream_get32(&frame->data); - if (flap_version != 0x00000001) - { - /* Error! */ - purple_debug_warning("oscar", "Expecting FLAP version " - "0x00000001 but received FLAP version %08x. Closing connection.\n", - flap_version); - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - } - else - conn->connected = TRUE; - - } else if (frame->channel == 0x02) { - parse_snac(od, conn, frame); - - } else if (frame->channel == 0x04) { - parse_flap_ch4(od, conn, frame); - - } else if (frame->channel == 0x05) { - /* TODO: Reset our keepalive watchdog? */ - - } -} - -/** - * Read in all available data on the socket for a given connection. - * All complete FLAPs handled immedate after they're received. - * Incomplete FLAP data is stored locally and appended to the next - * time this callback is triggered. - * - * This is called by flap_connection_recv_cb and - * flap_connection_recv_cb_ssl for unencrypted/encrypted connections. - */ -static void -flap_connection_recv(FlapConnection *conn) -{ - gpointer buf; - gsize buflen; - gssize read; - - /* Read data until we run out of data and break out of the loop */ - while (TRUE) - { - /* Start reading a new FLAP */ - if (conn->buffer_incoming.data.data == NULL) - { - buf = conn->header + conn->header_received; - buflen = 6 - conn->header_received; - - /* Read the first 6 bytes (the FLAP header) */ - if (conn->gsc) - read = purple_ssl_read(conn->gsc, buf, buflen); - else - read = recv(conn->fd, buf, buflen, 0); - - /* Check if the FLAP server closed the connection */ - if (read == 0) - { - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - break; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - break; - - /* Error! */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - break; - } - conn->od->gc->last_received = time(NULL); - - /* If we don't even have a complete FLAP header then do nothing */ - conn->header_received += read; - if (conn->header_received < 6) - break; - - /* All FLAP frames must start with the byte 0x2a */ - if (aimutil_get8(&conn->header[0]) != 0x2a) - { - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - break; - } - - /* Verify the sequence number sent by the server. */ -#if 0 - /* TODO: Need to initialize conn->seqnum_in somewhere before we can use this. */ - if (aimutil_get16(&conn->header[1]) != conn->seqnum_in++) - { - /* Received an out-of-order FLAP! */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - break; - } -#endif - - /* Initialize a new temporary FlapFrame for incoming data */ - conn->buffer_incoming.channel = aimutil_get8(&conn->header[1]); - conn->buffer_incoming.seqnum = aimutil_get16(&conn->header[2]); - conn->buffer_incoming.data.len = aimutil_get16(&conn->header[4]); - conn->buffer_incoming.data.data = g_new(guint8, conn->buffer_incoming.data.len); - conn->buffer_incoming.data.offset = 0; - } - - buflen = conn->buffer_incoming.data.len - conn->buffer_incoming.data.offset; - if (buflen) - { - buf = &conn->buffer_incoming.data.data[conn->buffer_incoming.data.offset]; - /* Read data into the temporary FlapFrame until it is complete */ - if (conn->gsc) - read = purple_ssl_read(conn->gsc, buf, buflen); - else - read = recv(conn->fd, buf, buflen, 0); - - /* Check if the FLAP server closed the connection */ - if (read == 0) - { - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - break; - } - - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - break; - - /* Error! */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - break; - } - - conn->buffer_incoming.data.offset += read; - if (conn->buffer_incoming.data.offset < conn->buffer_incoming.data.len) - /* Waiting for more data to arrive */ - break; - } - - /* We have a complete FLAP! Handle it and continue reading */ - byte_stream_rewind(&conn->buffer_incoming.data); - parse_flap(conn->od, conn, &conn->buffer_incoming); - conn->lastactivity = time(NULL); - - g_free(conn->buffer_incoming.data.data); - conn->buffer_incoming.data.data = NULL; - - conn->header_received = 0; - } -} - -void -flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - FlapConnection *conn = data; - - flap_connection_recv(conn); -} - -void -flap_connection_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond) -{ - FlapConnection *conn = data; - - flap_connection_recv(conn); -} - -/** - * @param source When this function is called as a callback source is - * set to the fd that triggered the callback. But this function - * is also called directly from flap_connection_send_byte_stream(), - * in which case source will be -1. So don't use source--use - * conn->gsc or conn->fd instead. - */ -static void -send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - FlapConnection *conn; - int writelen, ret; - - conn = data; - writelen = purple_circ_buffer_get_max_read(conn->buffer_outgoing); - - if (writelen == 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - return; - } - - if (conn->gsc) - ret = purple_ssl_write(conn->gsc, conn->buffer_outgoing->outptr, - writelen); - else - ret = send(conn->fd, conn->buffer_outgoing->outptr, writelen, 0); - if (ret <= 0) - { - if (ret < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) - /* No worries */ - return; - - /* Error! */ - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - if (conn->gsc) { - purple_ssl_close(conn->gsc); - conn->gsc = NULL; - } else { - close(conn->fd); - conn->fd = -1; - } - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - purple_circ_buffer_mark_read(conn->buffer_outgoing, ret); -} - -static void -flap_connection_send_byte_stream(ByteStream *bs, FlapConnection *conn, size_t count) -{ - if (conn == NULL) - return; - - /* Make sure we don't send past the end of the bs */ - if (count > byte_stream_empty(bs)) - count = byte_stream_empty(bs); /* truncate to remaining space */ - - if (count == 0) - return; - - /* Add everything to our outgoing buffer */ - purple_circ_buffer_append(conn->buffer_outgoing, bs->data, count); - - /* If we haven't already started writing stuff, then start the cycle */ - if (conn->watcher_outgoing == 0) - { - if (conn->gsc) { - conn->watcher_outgoing = purple_input_add(conn->gsc->fd, - PURPLE_INPUT_WRITE, send_cb, conn); - send_cb(conn, -1, 0); - } else if (conn->fd >= 0) { - conn->watcher_outgoing = purple_input_add(conn->fd, - PURPLE_INPUT_WRITE, send_cb, conn); - send_cb(conn, -1, 0); - } - } -} - -static void -sendframe_flap(FlapConnection *conn, FlapFrame *frame) -{ - ByteStream bs; - int payloadlen, bslen; - - payloadlen = byte_stream_curpos(&frame->data); - - byte_stream_new(&bs, 6 + payloadlen); - - /* FLAP header */ - byte_stream_put8(&bs, 0x2a); - byte_stream_put8(&bs, frame->channel); - byte_stream_put16(&bs, frame->seqnum); - byte_stream_put16(&bs, payloadlen); - - /* Payload */ - byte_stream_rewind(&frame->data); - byte_stream_putbs(&bs, &frame->data, payloadlen); - - bslen = byte_stream_curpos(&bs); - byte_stream_rewind(&bs); - flap_connection_send_byte_stream(&bs, conn, bslen); - - byte_stream_destroy(&bs); -} - -void -flap_connection_send(FlapConnection *conn, FlapFrame *frame) -{ - frame->seqnum = ++(conn->seqnum_out); - sendframe_flap(conn, frame); - flap_frame_destroy(frame); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libaim.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libaim.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libaim.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libaim.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* libaim is the AIM protocol plugin. It is linked against liboscarcommon, - * which contains all the shared implementation code with libicq - */ - -#include "oscarcommon.h" - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - /* The mimimum icon size below is not needed in AIM 6.0 */ - {"gif,jpeg,bmp,ico", 48, 48, 50, 50, 7168, - PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - oscar_list_icon_aim, /* list_icon */ - oscar_list_emblem, /* list_emblems */ - oscar_status_text, /* status_text */ - oscar_tooltip_text, /* tooltip_text */ - oscar_status_types, /* status_types */ - oscar_blist_node_menu, /* blist_node_menu */ - oscar_chat_info, /* chat_info */ - oscar_chat_info_defaults, /* chat_info_defaults */ - oscar_login, /* login */ - oscar_close, /* close */ - oscar_send_im, /* send_im */ - oscar_set_info, /* set_info */ - oscar_send_typing, /* send_typing */ - oscar_get_info, /* get_info */ - oscar_set_status, /* set_status */ - oscar_set_idle, /* set_idle */ - oscar_change_passwd, /* change_passwd */ - oscar_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - oscar_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - oscar_add_permit, /* add_permit */ - oscar_add_deny, /* add_deny */ - oscar_rem_permit, /* rem_permit */ - oscar_rem_deny, /* rem_deny */ - oscar_set_permit_deny, /* set_permit_deny */ - oscar_join_chat, /* join_chat */ - NULL, /* reject_chat */ - oscar_get_chat_name, /* get_chat_name */ - oscar_chat_invite, /* chat_invite */ - oscar_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - oscar_send_chat, /* chat_send */ - oscar_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - oscar_alias_buddy, /* alias_buddy */ - oscar_move_buddy, /* group_buddy */ - oscar_rename_group, /* rename_group */ - NULL, /* buddy_free */ - oscar_convo_closed, /* convo_closed */ - oscar_normalize, /* normalize */ - oscar_set_icon, /* set_buddy_icon */ - oscar_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - oscar_can_receive_file, /* can_receive_file */ - oscar_send_file, /* send_file */ - oscar_new_xfer, /* new_xfer */ - oscar_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-aim", /**< id */ - "AIM", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("AIM Protocol Plugin"), - /** description */ - N_("AIM Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - oscar_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - oscar_init(plugin); -} - -PURPLE_INIT_PLUGIN(aim, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libicq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libicq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libicq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/libicq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* libicq is the ICQ protocol plugin. It is linked against liboscarcommon, - * which contains all the shared implementation code with libaim - */ - - -#include "oscarcommon.h" - -static GHashTable * -icq_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(table, "login_label", (gpointer)_("ICQ UIN...")); - return table; -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"gif,jpeg,bmp,ico", 48, 48, 52, 64, 7168, - PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - oscar_list_icon_icq, /* list_icon */ - oscar_list_emblem, /* list_emblems */ - oscar_status_text, /* status_text */ - oscar_tooltip_text, /* tooltip_text */ - oscar_status_types, /* status_types */ - oscar_blist_node_menu, /* blist_node_menu */ - oscar_chat_info, /* chat_info */ - oscar_chat_info_defaults, /* chat_info_defaults */ - oscar_login, /* login */ - oscar_close, /* close */ - oscar_send_im, /* send_im */ - oscar_set_info, /* set_info */ - oscar_send_typing, /* send_typing */ - oscar_get_info, /* get_info */ - oscar_set_status, /* set_status */ - oscar_set_idle, /* set_idle */ - oscar_change_passwd, /* change_passwd */ - oscar_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - oscar_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - oscar_add_permit, /* add_permit */ - oscar_add_deny, /* add_deny */ - oscar_rem_permit, /* rem_permit */ - oscar_rem_deny, /* rem_deny */ - oscar_set_permit_deny, /* set_permit_deny */ - oscar_join_chat, /* join_chat */ - NULL, /* reject_chat */ - oscar_get_chat_name, /* get_chat_name */ - oscar_chat_invite, /* chat_invite */ - oscar_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - oscar_send_chat, /* chat_send */ - oscar_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - oscar_alias_buddy, /* alias_buddy */ - oscar_move_buddy, /* group_buddy */ - oscar_rename_group, /* rename_group */ - NULL, /* buddy_free */ - oscar_convo_closed, /* convo_closed */ - oscar_normalize, /* normalize */ - oscar_set_icon, /* set_buddy_icon */ - oscar_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - oscar_can_receive_file, /* can_receive_file */ - oscar_send_file, /* send_file */ - oscar_new_xfer, /* new_xfer */ - oscar_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - icq_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-icq", /**< id */ - "ICQ", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("ICQ Protocol Plugin"), - /** description */ - N_("ICQ Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - oscar_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - oscar_init(plugin); - - option = purple_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -} - -PURPLE_INIT_PLUGIN(icq, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -EXTRA_DIST = \ - COPYING \ - AUTHORS \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -OSCARSOURCES = \ - bstream.c \ - clientlogin.c \ - family_admin.c \ - family_advert.c \ - family_alert.c \ - family_auth.c \ - family_bart.c \ - family_bos.c \ - family_buddy.c \ - family_chat.c \ - family_chatnav.c \ - family_icq.c \ - family_icbm.c \ - family_invite.c \ - family_locate.c \ - family_odir.c \ - family_oservice.c \ - family_popup.c \ - family_feedbag.c \ - family_stats.c \ - family_translate.c \ - family_userlookup.c \ - flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ - oscar.h \ - oscarcommon.h \ - oscar_data.c \ - peer.c \ - peer.h \ - peer_proxy.c \ - rxhandlers.c \ - snac.c \ - snactypes.h \ - tlv.c \ - util.c - -AM_CFLAGS = $(st) - -libaim_la_LDFLAGS = -module -avoid-version -libicq_la_LDFLAGS = -module -avoid-version -if STATIC_OSCAR - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = liboscar.la -liboscar_la_SOURCES = $(OSCARSOURCES) libaim.c libicq.c -liboscar_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = liboscar.la libaim.la libicq.la -liboscar_la_SOURCES = $(OSCARSOURCES) -liboscar_la_LIBADD = $(GLIB_LIBS) - -libaim_la_SOURCES = libaim.c -libaim_la_LIBADD = liboscar.la - -libicq_la_SOURCES = libicq.c -libicq_la_LIBADD = liboscar.la - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1116 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/oscar -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in AUTHORS \ - COPYING -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -@STATIC_OSCAR_FALSE@libaim_la_DEPENDENCIES = liboscar.la -am__libaim_la_SOURCES_DIST = libaim.c -@STATIC_OSCAR_FALSE@am_libaim_la_OBJECTS = libaim.lo -libaim_la_OBJECTS = $(am_libaim_la_OBJECTS) -@STATIC_OSCAR_FALSE@am_libaim_la_rpath = -rpath $(pkgdir) -@STATIC_OSCAR_FALSE@libicq_la_DEPENDENCIES = liboscar.la -am__libicq_la_SOURCES_DIST = libicq.c -@STATIC_OSCAR_FALSE@am_libicq_la_OBJECTS = libicq.lo -libicq_la_OBJECTS = $(am_libicq_la_OBJECTS) -@STATIC_OSCAR_FALSE@am_libicq_la_rpath = -rpath $(pkgdir) -am__DEPENDENCIES_1 = -@STATIC_OSCAR_FALSE@liboscar_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__liboscar_la_SOURCES_DIST = bstream.c clientlogin.c family_admin.c \ - family_advert.c family_alert.c family_auth.c family_bart.c \ - family_bos.c family_buddy.c family_chat.c family_chatnav.c \ - family_icq.c family_icbm.c family_invite.c family_locate.c \ - family_odir.c family_oservice.c family_popup.c \ - family_feedbag.c family_stats.c family_translate.c \ - family_userlookup.c flap_connection.c misc.c msgcookie.c odc.c \ - oft.c oscar.c oscar.h oscarcommon.h oscar_data.c peer.c peer.h \ - peer_proxy.c rxhandlers.c snac.c snactypes.h tlv.c util.c \ - libaim.c libicq.c -am__objects_1 = liboscar_la-bstream.lo liboscar_la-clientlogin.lo \ - liboscar_la-family_admin.lo liboscar_la-family_advert.lo \ - liboscar_la-family_alert.lo liboscar_la-family_auth.lo \ - liboscar_la-family_bart.lo liboscar_la-family_bos.lo \ - liboscar_la-family_buddy.lo liboscar_la-family_chat.lo \ - liboscar_la-family_chatnav.lo liboscar_la-family_icq.lo \ - liboscar_la-family_icbm.lo liboscar_la-family_invite.lo \ - liboscar_la-family_locate.lo liboscar_la-family_odir.lo \ - liboscar_la-family_oservice.lo liboscar_la-family_popup.lo \ - liboscar_la-family_feedbag.lo liboscar_la-family_stats.lo \ - liboscar_la-family_translate.lo \ - liboscar_la-family_userlookup.lo \ - liboscar_la-flap_connection.lo liboscar_la-misc.lo \ - liboscar_la-msgcookie.lo liboscar_la-odc.lo liboscar_la-oft.lo \ - liboscar_la-oscar.lo liboscar_la-oscar_data.lo \ - liboscar_la-peer.lo liboscar_la-peer_proxy.lo \ - liboscar_la-rxhandlers.lo liboscar_la-snac.lo \ - liboscar_la-tlv.lo liboscar_la-util.lo -@STATIC_OSCAR_FALSE@am_liboscar_la_OBJECTS = $(am__objects_1) -@STATIC_OSCAR_TRUE@am_liboscar_la_OBJECTS = $(am__objects_1) \ -@STATIC_OSCAR_TRUE@ liboscar_la-libaim.lo liboscar_la-libicq.lo -liboscar_la_OBJECTS = $(am_liboscar_la_OBJECTS) -@STATIC_OSCAR_FALSE@am_liboscar_la_rpath = -rpath $(pkgdir) -@STATIC_OSCAR_TRUE@am_liboscar_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libaim_la_SOURCES) $(libicq_la_SOURCES) \ - $(liboscar_la_SOURCES) -DIST_SOURCES = $(am__libaim_la_SOURCES_DIST) \ - $(am__libicq_la_SOURCES_DIST) $(am__liboscar_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - COPYING \ - AUTHORS \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -OSCARSOURCES = \ - bstream.c \ - clientlogin.c \ - family_admin.c \ - family_advert.c \ - family_alert.c \ - family_auth.c \ - family_bart.c \ - family_bos.c \ - family_buddy.c \ - family_chat.c \ - family_chatnav.c \ - family_icq.c \ - family_icbm.c \ - family_invite.c \ - family_locate.c \ - family_odir.c \ - family_oservice.c \ - family_popup.c \ - family_feedbag.c \ - family_stats.c \ - family_translate.c \ - family_userlookup.c \ - flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ - oscar.h \ - oscarcommon.h \ - oscar_data.c \ - peer.c \ - peer.h \ - peer_proxy.c \ - rxhandlers.c \ - snac.c \ - snactypes.h \ - tlv.c \ - util.c - -AM_CFLAGS = $(st) -libaim_la_LDFLAGS = -module -avoid-version -libicq_la_LDFLAGS = -module -avoid-version -@STATIC_OSCAR_FALSE@st = -@STATIC_OSCAR_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_OSCAR_TRUE@noinst_LTLIBRARIES = liboscar.la -@STATIC_OSCAR_FALSE@liboscar_la_SOURCES = $(OSCARSOURCES) -@STATIC_OSCAR_TRUE@liboscar_la_SOURCES = $(OSCARSOURCES) libaim.c libicq.c -@STATIC_OSCAR_TRUE@liboscar_la_CFLAGS = $(AM_CFLAGS) -@STATIC_OSCAR_FALSE@pkg_LTLIBRARIES = liboscar.la libaim.la libicq.la -@STATIC_OSCAR_FALSE@liboscar_la_LIBADD = $(GLIB_LIBS) -@STATIC_OSCAR_FALSE@libaim_la_SOURCES = libaim.c -@STATIC_OSCAR_FALSE@libaim_la_LIBADD = liboscar.la -@STATIC_OSCAR_FALSE@libicq_la_SOURCES = libicq.c -@STATIC_OSCAR_FALSE@libicq_la_LIBADD = liboscar.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/oscar/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/oscar/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libaim.la: $(libaim_la_OBJECTS) $(libaim_la_DEPENDENCIES) - $(LINK) $(am_libaim_la_rpath) $(libaim_la_LDFLAGS) $(libaim_la_OBJECTS) $(libaim_la_LIBADD) $(LIBS) -libicq.la: $(libicq_la_OBJECTS) $(libicq_la_DEPENDENCIES) - $(LINK) $(am_libicq_la_rpath) $(libicq_la_LDFLAGS) $(libicq_la_OBJECTS) $(libicq_la_LIBADD) $(LIBS) -liboscar.la: $(liboscar_la_OBJECTS) $(liboscar_la_DEPENDENCIES) - $(LINK) $(am_liboscar_la_rpath) $(liboscar_la_LDFLAGS) $(liboscar_la_OBJECTS) $(liboscar_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-bstream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-clientlogin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_admin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_advert.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_alert.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_auth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_bart.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_bos.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_chatnav.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_feedbag.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_icbm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_icq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_invite.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_locate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_odir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_oservice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_popup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_stats.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_translate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_userlookup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-flap_connection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-libaim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-libicq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-misc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-msgcookie.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-odc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-oft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-oscar.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-oscar_data.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-peer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-peer_proxy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-rxhandlers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-snac.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-tlv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-util.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -liboscar_la-bstream.lo: bstream.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-bstream.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-bstream.Tpo" -c -o liboscar_la-bstream.lo `test -f 'bstream.c' || echo '$(srcdir)/'`bstream.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-bstream.Tpo" "$(DEPDIR)/liboscar_la-bstream.Plo"; else rm -f "$(DEPDIR)/liboscar_la-bstream.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bstream.c' object='liboscar_la-bstream.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-bstream.lo `test -f 'bstream.c' || echo '$(srcdir)/'`bstream.c - -liboscar_la-clientlogin.lo: clientlogin.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-clientlogin.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-clientlogin.Tpo" -c -o liboscar_la-clientlogin.lo `test -f 'clientlogin.c' || echo '$(srcdir)/'`clientlogin.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-clientlogin.Tpo" "$(DEPDIR)/liboscar_la-clientlogin.Plo"; else rm -f "$(DEPDIR)/liboscar_la-clientlogin.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='clientlogin.c' object='liboscar_la-clientlogin.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-clientlogin.lo `test -f 'clientlogin.c' || echo '$(srcdir)/'`clientlogin.c - -liboscar_la-family_admin.lo: family_admin.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_admin.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_admin.Tpo" -c -o liboscar_la-family_admin.lo `test -f 'family_admin.c' || echo '$(srcdir)/'`family_admin.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_admin.Tpo" "$(DEPDIR)/liboscar_la-family_admin.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_admin.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_admin.c' object='liboscar_la-family_admin.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_admin.lo `test -f 'family_admin.c' || echo '$(srcdir)/'`family_admin.c - -liboscar_la-family_advert.lo: family_advert.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_advert.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_advert.Tpo" -c -o liboscar_la-family_advert.lo `test -f 'family_advert.c' || echo '$(srcdir)/'`family_advert.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_advert.Tpo" "$(DEPDIR)/liboscar_la-family_advert.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_advert.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_advert.c' object='liboscar_la-family_advert.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_advert.lo `test -f 'family_advert.c' || echo '$(srcdir)/'`family_advert.c - -liboscar_la-family_alert.lo: family_alert.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_alert.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_alert.Tpo" -c -o liboscar_la-family_alert.lo `test -f 'family_alert.c' || echo '$(srcdir)/'`family_alert.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_alert.Tpo" "$(DEPDIR)/liboscar_la-family_alert.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_alert.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_alert.c' object='liboscar_la-family_alert.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_alert.lo `test -f 'family_alert.c' || echo '$(srcdir)/'`family_alert.c - -liboscar_la-family_auth.lo: family_auth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_auth.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_auth.Tpo" -c -o liboscar_la-family_auth.lo `test -f 'family_auth.c' || echo '$(srcdir)/'`family_auth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_auth.Tpo" "$(DEPDIR)/liboscar_la-family_auth.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_auth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_auth.c' object='liboscar_la-family_auth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_auth.lo `test -f 'family_auth.c' || echo '$(srcdir)/'`family_auth.c - -liboscar_la-family_bart.lo: family_bart.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_bart.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_bart.Tpo" -c -o liboscar_la-family_bart.lo `test -f 'family_bart.c' || echo '$(srcdir)/'`family_bart.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_bart.Tpo" "$(DEPDIR)/liboscar_la-family_bart.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_bart.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_bart.c' object='liboscar_la-family_bart.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_bart.lo `test -f 'family_bart.c' || echo '$(srcdir)/'`family_bart.c - -liboscar_la-family_bos.lo: family_bos.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_bos.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_bos.Tpo" -c -o liboscar_la-family_bos.lo `test -f 'family_bos.c' || echo '$(srcdir)/'`family_bos.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_bos.Tpo" "$(DEPDIR)/liboscar_la-family_bos.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_bos.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_bos.c' object='liboscar_la-family_bos.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_bos.lo `test -f 'family_bos.c' || echo '$(srcdir)/'`family_bos.c - -liboscar_la-family_buddy.lo: family_buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_buddy.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_buddy.Tpo" -c -o liboscar_la-family_buddy.lo `test -f 'family_buddy.c' || echo '$(srcdir)/'`family_buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_buddy.Tpo" "$(DEPDIR)/liboscar_la-family_buddy.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_buddy.c' object='liboscar_la-family_buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_buddy.lo `test -f 'family_buddy.c' || echo '$(srcdir)/'`family_buddy.c - -liboscar_la-family_chat.lo: family_chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_chat.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_chat.Tpo" -c -o liboscar_la-family_chat.lo `test -f 'family_chat.c' || echo '$(srcdir)/'`family_chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_chat.Tpo" "$(DEPDIR)/liboscar_la-family_chat.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_chat.c' object='liboscar_la-family_chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_chat.lo `test -f 'family_chat.c' || echo '$(srcdir)/'`family_chat.c - -liboscar_la-family_chatnav.lo: family_chatnav.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_chatnav.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_chatnav.Tpo" -c -o liboscar_la-family_chatnav.lo `test -f 'family_chatnav.c' || echo '$(srcdir)/'`family_chatnav.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_chatnav.Tpo" "$(DEPDIR)/liboscar_la-family_chatnav.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_chatnav.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_chatnav.c' object='liboscar_la-family_chatnav.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_chatnav.lo `test -f 'family_chatnav.c' || echo '$(srcdir)/'`family_chatnav.c - -liboscar_la-family_icq.lo: family_icq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_icq.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_icq.Tpo" -c -o liboscar_la-family_icq.lo `test -f 'family_icq.c' || echo '$(srcdir)/'`family_icq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_icq.Tpo" "$(DEPDIR)/liboscar_la-family_icq.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_icq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_icq.c' object='liboscar_la-family_icq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_icq.lo `test -f 'family_icq.c' || echo '$(srcdir)/'`family_icq.c - -liboscar_la-family_icbm.lo: family_icbm.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_icbm.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_icbm.Tpo" -c -o liboscar_la-family_icbm.lo `test -f 'family_icbm.c' || echo '$(srcdir)/'`family_icbm.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_icbm.Tpo" "$(DEPDIR)/liboscar_la-family_icbm.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_icbm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_icbm.c' object='liboscar_la-family_icbm.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_icbm.lo `test -f 'family_icbm.c' || echo '$(srcdir)/'`family_icbm.c - -liboscar_la-family_invite.lo: family_invite.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_invite.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_invite.Tpo" -c -o liboscar_la-family_invite.lo `test -f 'family_invite.c' || echo '$(srcdir)/'`family_invite.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_invite.Tpo" "$(DEPDIR)/liboscar_la-family_invite.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_invite.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_invite.c' object='liboscar_la-family_invite.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_invite.lo `test -f 'family_invite.c' || echo '$(srcdir)/'`family_invite.c - -liboscar_la-family_locate.lo: family_locate.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_locate.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_locate.Tpo" -c -o liboscar_la-family_locate.lo `test -f 'family_locate.c' || echo '$(srcdir)/'`family_locate.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_locate.Tpo" "$(DEPDIR)/liboscar_la-family_locate.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_locate.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_locate.c' object='liboscar_la-family_locate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_locate.lo `test -f 'family_locate.c' || echo '$(srcdir)/'`family_locate.c - -liboscar_la-family_odir.lo: family_odir.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_odir.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_odir.Tpo" -c -o liboscar_la-family_odir.lo `test -f 'family_odir.c' || echo '$(srcdir)/'`family_odir.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_odir.Tpo" "$(DEPDIR)/liboscar_la-family_odir.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_odir.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_odir.c' object='liboscar_la-family_odir.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_odir.lo `test -f 'family_odir.c' || echo '$(srcdir)/'`family_odir.c - -liboscar_la-family_oservice.lo: family_oservice.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_oservice.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_oservice.Tpo" -c -o liboscar_la-family_oservice.lo `test -f 'family_oservice.c' || echo '$(srcdir)/'`family_oservice.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_oservice.Tpo" "$(DEPDIR)/liboscar_la-family_oservice.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_oservice.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_oservice.c' object='liboscar_la-family_oservice.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_oservice.lo `test -f 'family_oservice.c' || echo '$(srcdir)/'`family_oservice.c - -liboscar_la-family_popup.lo: family_popup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_popup.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_popup.Tpo" -c -o liboscar_la-family_popup.lo `test -f 'family_popup.c' || echo '$(srcdir)/'`family_popup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_popup.Tpo" "$(DEPDIR)/liboscar_la-family_popup.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_popup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_popup.c' object='liboscar_la-family_popup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_popup.lo `test -f 'family_popup.c' || echo '$(srcdir)/'`family_popup.c - -liboscar_la-family_feedbag.lo: family_feedbag.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_feedbag.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_feedbag.Tpo" -c -o liboscar_la-family_feedbag.lo `test -f 'family_feedbag.c' || echo '$(srcdir)/'`family_feedbag.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_feedbag.Tpo" "$(DEPDIR)/liboscar_la-family_feedbag.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_feedbag.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_feedbag.c' object='liboscar_la-family_feedbag.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_feedbag.lo `test -f 'family_feedbag.c' || echo '$(srcdir)/'`family_feedbag.c - -liboscar_la-family_stats.lo: family_stats.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_stats.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_stats.Tpo" -c -o liboscar_la-family_stats.lo `test -f 'family_stats.c' || echo '$(srcdir)/'`family_stats.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_stats.Tpo" "$(DEPDIR)/liboscar_la-family_stats.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_stats.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_stats.c' object='liboscar_la-family_stats.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_stats.lo `test -f 'family_stats.c' || echo '$(srcdir)/'`family_stats.c - -liboscar_la-family_translate.lo: family_translate.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_translate.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_translate.Tpo" -c -o liboscar_la-family_translate.lo `test -f 'family_translate.c' || echo '$(srcdir)/'`family_translate.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_translate.Tpo" "$(DEPDIR)/liboscar_la-family_translate.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_translate.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_translate.c' object='liboscar_la-family_translate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_translate.lo `test -f 'family_translate.c' || echo '$(srcdir)/'`family_translate.c - -liboscar_la-family_userlookup.lo: family_userlookup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_userlookup.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_userlookup.Tpo" -c -o liboscar_la-family_userlookup.lo `test -f 'family_userlookup.c' || echo '$(srcdir)/'`family_userlookup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_userlookup.Tpo" "$(DEPDIR)/liboscar_la-family_userlookup.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_userlookup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_userlookup.c' object='liboscar_la-family_userlookup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_userlookup.lo `test -f 'family_userlookup.c' || echo '$(srcdir)/'`family_userlookup.c - -liboscar_la-flap_connection.lo: flap_connection.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-flap_connection.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-flap_connection.Tpo" -c -o liboscar_la-flap_connection.lo `test -f 'flap_connection.c' || echo '$(srcdir)/'`flap_connection.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-flap_connection.Tpo" "$(DEPDIR)/liboscar_la-flap_connection.Plo"; else rm -f "$(DEPDIR)/liboscar_la-flap_connection.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='flap_connection.c' object='liboscar_la-flap_connection.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-flap_connection.lo `test -f 'flap_connection.c' || echo '$(srcdir)/'`flap_connection.c - -liboscar_la-misc.lo: misc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-misc.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-misc.Tpo" -c -o liboscar_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-misc.Tpo" "$(DEPDIR)/liboscar_la-misc.Plo"; else rm -f "$(DEPDIR)/liboscar_la-misc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='liboscar_la-misc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c - -liboscar_la-msgcookie.lo: msgcookie.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-msgcookie.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-msgcookie.Tpo" -c -o liboscar_la-msgcookie.lo `test -f 'msgcookie.c' || echo '$(srcdir)/'`msgcookie.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-msgcookie.Tpo" "$(DEPDIR)/liboscar_la-msgcookie.Plo"; else rm -f "$(DEPDIR)/liboscar_la-msgcookie.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msgcookie.c' object='liboscar_la-msgcookie.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-msgcookie.lo `test -f 'msgcookie.c' || echo '$(srcdir)/'`msgcookie.c - -liboscar_la-odc.lo: odc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-odc.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-odc.Tpo" -c -o liboscar_la-odc.lo `test -f 'odc.c' || echo '$(srcdir)/'`odc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-odc.Tpo" "$(DEPDIR)/liboscar_la-odc.Plo"; else rm -f "$(DEPDIR)/liboscar_la-odc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='odc.c' object='liboscar_la-odc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-odc.lo `test -f 'odc.c' || echo '$(srcdir)/'`odc.c - -liboscar_la-oft.lo: oft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-oft.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-oft.Tpo" -c -o liboscar_la-oft.lo `test -f 'oft.c' || echo '$(srcdir)/'`oft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-oft.Tpo" "$(DEPDIR)/liboscar_la-oft.Plo"; else rm -f "$(DEPDIR)/liboscar_la-oft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oft.c' object='liboscar_la-oft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-oft.lo `test -f 'oft.c' || echo '$(srcdir)/'`oft.c - -liboscar_la-oscar.lo: oscar.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-oscar.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-oscar.Tpo" -c -o liboscar_la-oscar.lo `test -f 'oscar.c' || echo '$(srcdir)/'`oscar.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-oscar.Tpo" "$(DEPDIR)/liboscar_la-oscar.Plo"; else rm -f "$(DEPDIR)/liboscar_la-oscar.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oscar.c' object='liboscar_la-oscar.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-oscar.lo `test -f 'oscar.c' || echo '$(srcdir)/'`oscar.c - -liboscar_la-oscar_data.lo: oscar_data.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-oscar_data.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-oscar_data.Tpo" -c -o liboscar_la-oscar_data.lo `test -f 'oscar_data.c' || echo '$(srcdir)/'`oscar_data.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-oscar_data.Tpo" "$(DEPDIR)/liboscar_la-oscar_data.Plo"; else rm -f "$(DEPDIR)/liboscar_la-oscar_data.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oscar_data.c' object='liboscar_la-oscar_data.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-oscar_data.lo `test -f 'oscar_data.c' || echo '$(srcdir)/'`oscar_data.c - -liboscar_la-peer.lo: peer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-peer.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-peer.Tpo" -c -o liboscar_la-peer.lo `test -f 'peer.c' || echo '$(srcdir)/'`peer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-peer.Tpo" "$(DEPDIR)/liboscar_la-peer.Plo"; else rm -f "$(DEPDIR)/liboscar_la-peer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='peer.c' object='liboscar_la-peer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-peer.lo `test -f 'peer.c' || echo '$(srcdir)/'`peer.c - -liboscar_la-peer_proxy.lo: peer_proxy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-peer_proxy.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-peer_proxy.Tpo" -c -o liboscar_la-peer_proxy.lo `test -f 'peer_proxy.c' || echo '$(srcdir)/'`peer_proxy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-peer_proxy.Tpo" "$(DEPDIR)/liboscar_la-peer_proxy.Plo"; else rm -f "$(DEPDIR)/liboscar_la-peer_proxy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='peer_proxy.c' object='liboscar_la-peer_proxy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-peer_proxy.lo `test -f 'peer_proxy.c' || echo '$(srcdir)/'`peer_proxy.c - -liboscar_la-rxhandlers.lo: rxhandlers.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-rxhandlers.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-rxhandlers.Tpo" -c -o liboscar_la-rxhandlers.lo `test -f 'rxhandlers.c' || echo '$(srcdir)/'`rxhandlers.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-rxhandlers.Tpo" "$(DEPDIR)/liboscar_la-rxhandlers.Plo"; else rm -f "$(DEPDIR)/liboscar_la-rxhandlers.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rxhandlers.c' object='liboscar_la-rxhandlers.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-rxhandlers.lo `test -f 'rxhandlers.c' || echo '$(srcdir)/'`rxhandlers.c - -liboscar_la-snac.lo: snac.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-snac.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-snac.Tpo" -c -o liboscar_la-snac.lo `test -f 'snac.c' || echo '$(srcdir)/'`snac.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-snac.Tpo" "$(DEPDIR)/liboscar_la-snac.Plo"; else rm -f "$(DEPDIR)/liboscar_la-snac.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='snac.c' object='liboscar_la-snac.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-snac.lo `test -f 'snac.c' || echo '$(srcdir)/'`snac.c - -liboscar_la-tlv.lo: tlv.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-tlv.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-tlv.Tpo" -c -o liboscar_la-tlv.lo `test -f 'tlv.c' || echo '$(srcdir)/'`tlv.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-tlv.Tpo" "$(DEPDIR)/liboscar_la-tlv.Plo"; else rm -f "$(DEPDIR)/liboscar_la-tlv.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlv.c' object='liboscar_la-tlv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-tlv.lo `test -f 'tlv.c' || echo '$(srcdir)/'`tlv.c - -liboscar_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-util.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-util.Tpo" -c -o liboscar_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-util.Tpo" "$(DEPDIR)/liboscar_la-util.Plo"; else rm -f "$(DEPDIR)/liboscar_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='liboscar_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -liboscar_la-libaim.lo: libaim.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-libaim.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-libaim.Tpo" -c -o liboscar_la-libaim.lo `test -f 'libaim.c' || echo '$(srcdir)/'`libaim.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-libaim.Tpo" "$(DEPDIR)/liboscar_la-libaim.Plo"; else rm -f "$(DEPDIR)/liboscar_la-libaim.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libaim.c' object='liboscar_la-libaim.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-libaim.lo `test -f 'libaim.c' || echo '$(srcdir)/'`libaim.c - -liboscar_la-libicq.lo: libicq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-libicq.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-libicq.Tpo" -c -o liboscar_la-libicq.lo `test -f 'libicq.c' || echo '$(srcdir)/'`libicq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-libicq.Tpo" "$(DEPDIR)/liboscar_la-libicq.Plo"; else rm -f "$(DEPDIR)/liboscar_la-libicq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libicq.c' object='liboscar_la-libicq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-libicq.lo `test -f 'libicq.c' || echo '$(srcdir)/'`libicq.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of liboscar -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = liboscar -AIM_TARGET = libaim -ICQ_TARGET = libicq -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else - ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) - endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L. - -## -## SOURCES, OBJECTS -## -C_SRC = \ - bstream.c \ - clientlogin.c \ - family_admin.c \ - family_advert.c \ - family_alert.c \ - family_auth.c \ - family_bart.c \ - family_bos.c \ - family_buddy.c \ - family_chat.c \ - family_chatnav.c \ - family_icq.c \ - family_icbm.c \ - family_invite.c \ - family_locate.c \ - family_odir.c \ - family_popup.c \ - family_oservice.c \ - family_feedbag.c \ - family_stats.c \ - family_translate.c \ - family_userlookup.c \ - flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ - oscar_data.c \ - peer.c \ - peer_proxy.c \ - rxhandlers.c \ - snac.c \ - tlv.c \ - util.c - -OBJECTS = $(C_SRC:%.c=%.o) - -AIM_C_SRC = libaim.c -AIM_OBJECTS = $(AIM_C_SRC:%.c=%.o) - -ICQ_C_SRC = libicq.c -ICQ_OBJECTS = $(ICQ_C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll $(AIM_TARGET).dll $(ICQ_TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(AIM_TARGET).dll $(ICQ_TARGET).dll $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll.a $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -$(AIM_TARGET).dll: $(TARGET).dll.a $(AIM_OBJECTS) - $(CC) -shared $(AIM_OBJECTS) $(LIB_PATHS) $(LIBS) -loscar $(DLL_LD_FLAGS) -o $(AIM_TARGET).dll - -$(ICQ_TARGET).dll: $(TARGET).dll.a $(ICQ_OBJECTS) - $(CC) -shared $(ICQ_OBJECTS) $(LIB_PATHS) $(LIBS) -loscar $(DLL_LD_FLAGS) -o $(ICQ_TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a - rm -f $(AIM_OBJECTS) $(AIM_TARGET).dll - rm -f $(ICQ_OBJECTS) $(ICQ_TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/misc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/misc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/misc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/misc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,155 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Random stuff. Basically just a few functions for sending - * simple SNACs, and then the generic error handler. - */ - -#include "oscar.h" - -/* - * Generic routine for sending commands. - * - * I know I can do this in a smarter way...but I'm not thinking straight - * right now... - * - * I had one big function that handled all three cases, but then it broke - * and I split it up into three. But then I fixed it. I just never went - * back to the single. I don't see any advantage to doing it either way. - * - */ -void -aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) -{ - aim_snacid_t snacid = 0x00000000; - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL); -} - -void -aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) -{ - aim_snacid_t snacid; - - snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL); -} - -void -aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *longdata) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!longdata) - { - aim_genericreq_n(od, conn, family, subtype); - return; - } - - byte_stream_new(&bs, 4); - - snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); - - byte_stream_put32(&bs, *longdata); - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -void -aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *shortdata) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!shortdata) - { - aim_genericreq_n(od, conn, family, subtype); - return; - } - - byte_stream_new(&bs, 2); - - snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); - - byte_stream_put16(&bs, *shortdata); - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Should be generic enough to handle the errors for all groups. - * - */ -static int -generror(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - int error = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - - snac2 = aim_remsnac(od, snac->id); - - if (byte_stream_empty(bs)) - error = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, error, snac2 ? snac2->data : NULL); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return generror(od, conn, mod, frame, snac, bs); - else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) { - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - return userfunc(od, conn, frame); - } - - return 0; -} - -int -misc_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = 0xffff; - mod->version = 0x0000; - mod->flags = AIM_MODFLAG_MULTIFAMILY; - strncpy(mod->name, "misc", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/msgcookie.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/msgcookie.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/msgcookie.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/msgcookie.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Cookie Caching stuff. Adam wrote this, apparently just some - * derivatives of n's SNAC work. I cleaned it up, added comments. - * - */ - -/* - * I'm assuming that cookies are type-specific. that is, we can have - * "1234578" for type 1 and type 2 concurrently. if i'm wrong, then we - * lose some error checking. if we assume cookies are not type-specific and are - * wrong, we get quirky behavior when cookies step on each others' toes. - */ - -#include "oscar.h" - -/** - * aim_cachecookie - appends a cookie to the cookie list - * - * if cookie->cookie for type cookie->type is found, updates the - * ->addtime of the found structure; otherwise adds the given cookie - * to the cache - * - * @param od session to add to - * @param cookie pointer to struct to append - * @return returns -1 on error, 0 on append, 1 on update. the cookie you pass - * in may be free'd, so don't count on its value after calling this! - */ -int aim_cachecookie(OscarData *od, IcbmCookie *cookie) -{ - IcbmCookie *newcook; - - if (!od || !cookie) - return -EINVAL; - - newcook = aim_checkcookie(od, cookie->cookie, cookie->type); - - if (newcook == cookie) { - newcook->addtime = time(NULL); - return 1; - } else if (newcook) - aim_cookie_free(od, newcook); - - cookie->addtime = time(NULL); - - cookie->next = od->msgcookies; - od->msgcookies = cookie; - - return 0; -} - -/** - * aim_uncachecookie - grabs a cookie from the cookie cache (removes it from the list) - * - * takes a cookie string and a cookie type and finds the cookie struct associated with that duple, removing it from the cookie list ikn the process. - * - * @param od session to grab cookie from - * @param cookie cookie string to look for - * @param type cookie type to look for - * @return if found, returns the struct; if none found (or on error), returns NULL: - */ -IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type) -{ - IcbmCookie *cur, **prev; - - if (!cookie || !od->msgcookies) - return NULL; - - for (prev = &od->msgcookies; (cur = *prev); ) { - if ((cur->type == type) && - (memcmp(cur->cookie, cookie, 8) == 0)) { - *prev = cur->next; - return cur; - } - prev = &cur->next; - } - - return NULL; -} - -/** - * aim_mkcookie - generate an IcbmCookie *struct from a cookie string, a type, and a data pointer. - * - * @param c pointer to the cookie string array - * @param type cookie type to use - * @param data data to be cached with the cookie - * @return returns NULL on error, a pointer to the newly-allocated - * cookie on success. - */ -IcbmCookie *aim_mkcookie(guint8 *c, int type, void *data) -{ - IcbmCookie *cookie; - - if (!c) - return NULL; - - cookie = g_new0(IcbmCookie, 1); - - cookie->data = data; - cookie->type = type; - memcpy(cookie->cookie, c, 8); - - return cookie; -} - -/** - * aim_checkcookie - check to see if a cookietuple has been cached - * - * @param od session to check for the cookie in - * @param cookie pointer to the cookie string array - * @param type type of the cookie to look for - * @return returns a pointer to the cookie struct (still in the list) - * on success; returns NULL on error/not found - */ - -IcbmCookie *aim_checkcookie(OscarData *od, const guint8 *cookie, const int type) -{ - IcbmCookie *cur; - - for (cur = od->msgcookies; cur; cur = cur->next) { - if ((cur->type == type) && - (memcmp(cur->cookie, cookie, 8) == 0)) - return cur; - } - - return NULL; -} - -/** - * aim_cookie_free - free an IcbmCookie struct - * - * this function removes the cookie *cookie from the list of cookies - * in od, and then frees all memory associated with it. including - * its data! if you want to use the private data after calling this, - * make sure you copy it first. - * - * @param od session to remove the cookie from - * @param cookie the address of a pointer to the cookie struct to remove - * @return returns -1 on error, 0 on success. - * - */ -int aim_cookie_free(OscarData *od, IcbmCookie *cookie) -{ - IcbmCookie *cur, **prev; - - if (!od || !cookie) - return -EINVAL; - - for (prev = &od->msgcookies; (cur = *prev); ) { - if (cur == cookie) - *prev = cur->next; - else - prev = &cur->next; - } - - g_free(cookie->data); - g_free(cookie); - - return 0; -} - -/* XXX I hate switch */ -int aim_msgcookie_gettype(int type) -{ - /* XXX: hokey-assed. needs fixed. */ - switch(type) { - case OSCAR_CAPABILITY_BUDDYICON: return AIM_COOKIETYPE_OFTICON; - case OSCAR_CAPABILITY_TALK: return AIM_COOKIETYPE_OFTVOICE; - case OSCAR_CAPABILITY_DIRECTIM: return AIM_COOKIETYPE_OFTIMAGE; - case OSCAR_CAPABILITY_CHAT: return AIM_COOKIETYPE_CHAT; - case OSCAR_CAPABILITY_GETFILE: return AIM_COOKIETYPE_OFTGET; - case OSCAR_CAPABILITY_SENDFILE: return AIM_COOKIETYPE_OFTSEND; - default: return AIM_COOKIETYPE_UNKNOWN; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/odc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/odc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/odc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/odc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,626 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* From the oscar PRPL */ -#include "oscar.h" -#include "peer.h" - -/* From Purple */ -#include "conversation.h" -#include "imgstore.h" -#include "util.h" - -#define DIRECTIM_MAX_FILESIZE 52428800 - -/** - * Free any ODC related data and print a message to the conversation - * window based on conn->disconnect_reason. - */ -void -peer_odc_close(PeerConnection *conn) -{ - gchar *tmp; - - if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - tmp = g_strdup(_("The remote user has closed the connection.")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - tmp = g_strdup(_("The remote user has declined your request.")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - tmp = g_strdup_printf(_("Lost connection with the remote user:
%s"), - conn->error_message); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - tmp = g_strdup(_("Received invalid data on connection with remote user.")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - tmp = g_strdup(_("Unable to establish a connection with the remote user.")); - else - /* - * We shouldn't print a message for some disconnect_reasons. - * Like OSCAR_DISCONNECT_LOCAL_CLOSED. - */ - tmp = NULL; - - if (tmp != NULL) - { - PurpleAccount *account; - PurpleConversation *conv; - - account = purple_connection_get_account(conn->od->gc); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - - if (conn->frame != NULL) - { - OdcFrame *frame; - frame = conn->frame; - g_free(frame->payload.data); - g_free(frame); - } -} - -/** - * Write the given OdcFrame to a ByteStream and send it out - * on the established PeerConnection. - */ -static void -peer_odc_send(PeerConnection *conn, OdcFrame *frame) -{ - PurpleAccount *account; - const char *username; - size_t length; - ByteStream bs; - - purple_debug_info("oscar", "Outgoing ODC frame to %s with " - "type=0x%04x, flags=0x%04x, payload length=%u\n", - conn->bn, frame->type, frame->flags, frame->payload.len); - - account = purple_connection_get_account(conn->od->gc); - username = purple_account_get_username(account); - memcpy(frame->bn, username, strlen(username)); - memcpy(frame->cookie, conn->cookie, 8); - - length = 76; - byte_stream_new(&bs, length + frame->payload.len); - byte_stream_putraw(&bs, conn->magic, 4); - byte_stream_put16(&bs, length); - byte_stream_put16(&bs, frame->type); - byte_stream_put16(&bs, frame->subtype); - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, frame->cookie, 8); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put32(&bs, frame->payload.len); - byte_stream_put16(&bs, frame->encoding); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, frame->flags); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, frame->bn, 32); - byte_stream_putraw(&bs, frame->payload.data, frame->payload.len); - - peer_connection_send(conn, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Send a very basic ODC frame (which contains the cookie) so that the - * remote user can verify that we are the person they were expecting. - * If we made an outgoing connection to then remote user, then we send - * this immediately. If the remote user connected to us, then we wait - * for the other person to send this to us, then we send one to them. - */ -void -peer_odc_send_cookie(PeerConnection *conn) -{ - OdcFrame frame; - - memset(&frame, 0, sizeof(OdcFrame)); - frame.type = 0x0001; - frame.subtype = 0x0006; - frame.flags = 0x0060; /* Maybe this means "we're sending the cookie"? */ - - peer_odc_send(conn, &frame); -} - -/** - * Send client-to-client typing notification over an established direct connection. - */ -void -peer_odc_send_typing(PeerConnection *conn, PurpleTypingState typing) -{ - OdcFrame frame; - - memset(&frame, 0, sizeof(OdcFrame)); - frame.type = 0x0001; - frame.subtype = 0x0006; - if (typing == PURPLE_TYPING) - frame.flags = 0x0002 | 0x0008; - else if (typing == PURPLE_TYPED) - frame.flags = 0x0002 | 0x0004; - else - frame.flags = 0x0002; - - peer_odc_send(conn, &frame); -} - -/** - * Send client-to-client IM over an established direct connection. - * To send a direct IM, call this just like you would aim_send_im. - * - * @param conn The already-connected ODC connection. - * @param msg Null-terminated string to send. - * @param len The length of the message to send, including binary data. - * @param encoding See the AIM_CHARSET_* defines in oscar.h - * @param autoreply TRUE if this is any auto-reply. - */ -void -peer_odc_send_im(PeerConnection *conn, const char *msg, int len, int encoding, gboolean autoreply) -{ - OdcFrame frame; - - g_return_if_fail(msg != NULL); - g_return_if_fail(len > 0); - - memset(&frame, 0, sizeof(OdcFrame)); - frame.type = 0x0001; - frame.subtype = 0x0006; - frame.payload.len = len; - frame.encoding = encoding; - frame.flags = autoreply; - byte_stream_new(&frame.payload, len); - byte_stream_putraw(&frame.payload, (guint8 *)msg, len); - - peer_odc_send(conn, &frame); - - g_free(frame.payload.data); -} - -struct embedded_data -{ - size_t size; - const guint8 *data; -}; - -/** - * This is called after a direct IM has been received in its entirety. This - * function is passed a long chunk of data which contains the IM with any - * data chunks (images) appended to it. - * - * This function rips out all the data chunks and creates an imgstore for - * each one. In order to do this, it first goes through the IM and takes - * out all the IMG tags. When doing so, it rewrites the original IMG tag - * with one compatible with the imgstore Purple core code. For each one, we - * then read in chunks of data from the end of the message and actually - * create the img store using the given data. - * - * For somewhat easy reference, here's a sample message - * (with added whitespace): - * - * - * - * This is a really stupid picture:
- *
- * Yeah it is
- * Here is another one:
- * - *
- * - * - * datadatadatadata - * datadatadatadata - * - */ -static void -peer_odc_handle_payload(PeerConnection *conn, const char *msg, size_t len, int encoding, gboolean autoreply) -{ - PurpleConnection *gc; - PurpleAccount *account; - const char *msgend, *binary_start, *dataend; - const char *tmp, *start, *end, *idstr, *src, *sizestr; - GData *attributes; - GHashTable *embedded_datas; - struct embedded_data *embedded_data; - GSList *images; - gchar *utf8; - GString *newmsg; - PurpleMessageFlags imflags; - - gc = conn->od->gc; - account = purple_connection_get_account(gc); - - dataend = msg + len; - - /* - * Create a hash table containing references to each embedded - * data chunk. The key is the "ID" and the value is an - * embedded_data struct. - */ - embedded_datas = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, g_free); - - /* - * Create an index of any binary chunks. If we run into any - * problems while parsing the binary data section then we stop - * parsing it, and the local user will see broken image icons. - */ - /* TODO: Use a length argument when looking for the tag! */ - binary_start = purple_strcasestr(msg, ""); - if (binary_start == NULL) - msgend = dataend; - else - { - msgend = binary_start; - - /* Move our pointer to immediately after the tag */ - tmp = binary_start + 8; - - /* The embedded binary markup has a mimimum length of 29 bytes */ - /* TODO: Use a length argument when looking for the tag! */ - while ((tmp + 29 <= dataend) && - purple_markup_find_tag("data", tmp, &start, &tmp, &attributes)) - { - unsigned int id; - size_t size; - - /* Move the binary pointer from ">" to the start of the data */ - tmp++; - - /* Get the ID */ - idstr = g_datalist_get_data(&attributes, "id"); - if (idstr == NULL) - { - g_datalist_clear(&attributes); - break; - } - id = atoi(idstr); - - /* Get the size */ - sizestr = g_datalist_get_data(&attributes, "size"); - if (sizestr == NULL) - { - g_datalist_clear(&attributes); - break; - } - size = atol(sizestr); - - g_datalist_clear(&attributes); - - if ((size > 0) && (tmp + size > dataend)) - break; - - embedded_data = g_new(struct embedded_data, 1); - embedded_data->size = size; - embedded_data->data = (const guint8 *)tmp; - tmp += size; - - /* Skip past the closing tag */ - if (g_ascii_strncasecmp(tmp, "", 7)) - { - g_free(embedded_data); - break; - } - tmp += 7; - - g_hash_table_insert(embedded_datas, - GINT_TO_POINTER(id), embedded_data); - } - } - - /* - * Loop through the message, replacing OSCAR img tags with the - * equivalent Purple img tag. - */ - images = NULL; - newmsg = g_string_new(""); - tmp = msg; - while (purple_markup_find_tag("img", tmp, &start, &end, &attributes)) - { - int imgid = 0; - - idstr = g_datalist_get_data(&attributes, "id"); - src = g_datalist_get_data(&attributes, "src"); - sizestr = g_datalist_get_data(&attributes, "datasize"); - - if ((idstr != NULL) && (src != NULL) && (sizestr!= NULL)) - { - unsigned int id; - size_t size; - - id = atoi(idstr); - size = atol(sizestr); - embedded_data = g_hash_table_lookup(embedded_datas, - GINT_TO_POINTER(id)); - - if ((embedded_data != NULL) && (embedded_data->size == size)) - { - imgid = purple_imgstore_add_with_id(g_memdup(embedded_data->data, size), size, src); - - /* Record the image number */ - images = g_slist_append(images, GINT_TO_POINTER(imgid)); - } - } - - /* Delete the attribute list */ - g_datalist_clear(&attributes); - - /* Append the message up to the tag */ - utf8 = purple_plugin_oscar_decode_im_part(account, conn->bn, - encoding, 0x0000, tmp, start - tmp); - if (utf8 != NULL) { - g_string_append(newmsg, utf8); - g_free(utf8); - } - - if (imgid != 0) - { - /* Write the new image tag */ - g_string_append_printf(newmsg, "", imgid); - } - - /* Continue from the end of the tag */ - tmp = end + 1; - } - - /* Append any remaining message data */ - if (tmp <= msgend) - { - utf8 = purple_plugin_oscar_decode_im_part(account, conn->bn, - encoding, 0x0000, tmp, msgend - tmp); - if (utf8 != NULL) { - g_string_append(newmsg, utf8); - g_free(utf8); - } - } - - /* Display the message we received */ - imflags = 0; - if (images != NULL) - imflags |= PURPLE_MESSAGE_IMAGES; - if (autoreply) - imflags |= PURPLE_MESSAGE_AUTO_RESP; - serv_got_im(gc, conn->bn, newmsg->str, imflags, time(NULL)); - g_string_free(newmsg, TRUE); - - /* unref any images we allocated */ - if (images) - { - GSList *l; - for (l = images; l != NULL; l = l->next) - purple_imgstore_unref_by_id(GPOINTER_TO_INT(l->data)); - g_slist_free(images); - } - - /* Delete our list of pointers to embedded images */ - g_hash_table_destroy(embedded_datas); -} - -/** - * This is a purple_input_add() watcher callback function for reading - * direct IM payload data. "Payload data" is always an IM and - * maybe some embedded images or files or something. The actual - * ODC frame is read using peer_connection_recv_cb(). We temporarily - * switch to this watcher callback ONLY to read the payload, and we - * switch back once we're done. - */ -static void -peer_odc_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - OdcFrame *frame; - ByteStream *bs; - gssize read; - - conn = data; - frame = conn->frame; - bs = &frame->payload; - - /* Read data into the temporary buffer until it is complete */ - read = recv(conn->fd, - &bs->data[bs->offset], - bs->len - bs->offset, - 0); - - /* Check if the remote user closed the connection */ - if (read == 0) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - return; - } - - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - peer_connection_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - bs->offset += read; - if (bs->offset < bs->len) - /* Waiting for more data to arrive */ - return; - - /* We have a complete ODC/OFT frame! Handle it and continue reading */ - byte_stream_rewind(bs); - peer_odc_handle_payload(conn, (const char *)bs->data, - bs->len, frame->encoding, frame->flags & 0x0001); - g_free(bs->data); - bs->data = NULL; - g_free(frame); - conn->frame = NULL; - - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_connection_recv_cb, conn); -} - -/** - * Handle an incoming OdcFrame. If there is a payload associated - * with this frame, then we remove the old watcher and add the - * ODC watcher to read in the payload. - */ -void -peer_odc_recv_frame(PeerConnection *conn, ByteStream *bs) -{ - PurpleConnection *gc; - OdcFrame *frame; - - gc = conn->od->gc; - - frame = g_new0(OdcFrame, 1); - frame->type = byte_stream_get16(bs); - frame->subtype = byte_stream_get16(bs); - byte_stream_advance(bs, 2); - byte_stream_getrawbuf(bs, frame->cookie, 8); - byte_stream_advance(bs, 8); - frame->payload.len = byte_stream_get32(bs); - frame->encoding = byte_stream_get16(bs); - byte_stream_advance(bs, 4); - frame->flags = byte_stream_get16(bs); - byte_stream_advance(bs, 4); - byte_stream_getrawbuf(bs, frame->bn, 32); - - purple_debug_info("oscar", "Incoming ODC frame from %s with " - "type=0x%04x, flags=0x%04x, payload length=%u\n", - frame->bn, frame->type, frame->flags, frame->payload.len); - - if (!conn->ready) - { - /* - * We need to verify the cookie so that we know we are - * connected to our friend and not a malicious middle man. - */ - - PurpleAccount *account; - PurpleConversation *conv; - - if (conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING) - { - if (memcmp(conn->cookie, frame->cookie, 8)) - { - /* - * Oh no! The user that connected to us did not send - * the correct cookie! They are not our friend. Go try - * to accept another connection? - */ - purple_debug_info("oscar", "Received an incorrect cookie. " - "Closing connection.\n"); - peer_connection_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - g_free(frame); - return; - } - - /* - * Ok, we know they are legit. Now be courteous and - * send them our cookie. Note: This doesn't seem - * to be necessary, but it also doesn't seem to hurt. - */ - peer_odc_send_cookie(conn); - } - - conn->ready = TRUE; - - /* - * If they connected to us then close the listener socket - * and send them our cookie. - */ - if (conn->listenerfd != -1) - { - close(conn->listenerfd); - conn->listenerfd = -1; - } - - /* Tell the local user that we are connected */ - account = purple_connection_get_account(gc); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, _("Direct IM established"), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - if ((frame->type != 0x0001) && (frame->subtype != 0x0006)) - { - purple_debug_info("oscar", "Unknown ODC frame type 0x%04hx, " - "subtype 0x%04hx.\n", frame->type, frame->subtype); - g_free(frame); - return; - } - - if (frame->flags & 0x0008) - { - /* I had to leave this. It's just too funny. It reminds me of my sister. */ - purple_debug_info("oscar", "ohmigod! %s has started typing " - "(DirectIM). He's going to send you a message! " - "*squeal*\n", conn->bn); - serv_got_typing(gc, conn->bn, 0, PURPLE_TYPING); - } - else if (frame->flags & 0x0004) - { - serv_got_typing(gc, conn->bn, 0, PURPLE_TYPED); - } - else - { - serv_got_typing_stopped(gc, conn->bn); - } - - if (frame->payload.len > 0) - { - if (frame->payload.len > DIRECTIM_MAX_FILESIZE) - { - gchar *tmp, *size1, *size2; - PurpleAccount *account; - PurpleConversation *conv; - - size1 = purple_str_size_to_units(frame->payload.len); - size2 = purple_str_size_to_units(DIRECTIM_MAX_FILESIZE); - tmp = g_strdup_printf(_("%s tried to send you a %s file, but we only allow files up to %s over Direct IM. Try using file transfer instead.\n"), conn->bn, size1, size2); - g_free(size1); - g_free(size2); - - account = purple_connection_get_account(conn->od->gc); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - g_free(frame); - return; - } - - /* We have payload data! Switch to the ODC watcher to read it. */ - frame->payload.data = g_new(guint8, frame->payload.len); - frame->payload.offset = 0; - conn->frame = frame; - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_odc_recv_cb, conn); - return; - } - - g_free(frame); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,813 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * I feel like this is a good place to explain OFT, so I'm going to - * do just that. Each OFT packet has a header type. I guess this - * is pretty similar to the subtype of a SNAC packet. The type - * basically tells the other client the meaning of the OFT packet. - * There are two distinct types of file transfer, which I usually - * call "sendfile" and "getfile." Sendfile is when you send a file - * to another AIM user. Getfile is when you share a group of files, - * and other users request that you send them the files. - * - * A typical sendfile file transfer goes like this: - * 1) Sender sends a channel 2 ICBM telling the other user that - * we want to send them a file. At the same time, we open a - * listener socket (this should be done before sending the - * ICBM) on some port, and wait for them to connect to us. - * The ICBM we sent should contain our IP address and the port - * number that we're listening on. - * 2) The receiver connects to the sender on the given IP address - * and port. After the connection is established, the receiver - * sends an ICBM signifying that we are ready and waiting. - * 3) The sender sends an OFT PROMPT message over the OFT - * connection. - * 4) The receiver of the file sends back an exact copy of this - * OFT packet, except the cookie is filled in with the cookie - * from the ICBM. I think this might be an attempt to verify - * that the user that is connected is actually the guy that - * we sent the ICBM to. Oh, I've been calling this the ACK. - * 5) The sender starts sending raw data across the connection - * until the entire file has been sent. - * 6) The receiver knows the file is finished because the sender - * sent the file size in an earlier OFT packet. So then the - * receiver sends the DONE thingy (after filling in the - * "received" checksum and size) and closes the connection. - */ - -#include "oscar.h" -#include "peer.h" - -#include "util.h" - -#define CHECKSUM_BUFFER_SIZE 256 * 1024 - -struct _ChecksumData -{ - PeerConnection *conn; - PurpleXfer *xfer; - GSourceFunc callback; - size_t size; - guint32 checksum; - size_t total; - FILE *file; - guint8 buffer[CHECKSUM_BUFFER_SIZE]; - guint timer; -}; - -void -peer_oft_checksum_destroy(ChecksumData *checksum_data) -{ - checksum_data->conn->checksum_data = NULL; - fclose(checksum_data->file); - if (checksum_data->timer > 0) - purple_timeout_remove(checksum_data->timer); - g_free(checksum_data); -} - -/** - * Calculate oft checksum of buffer - * - * Prevcheck should be 0xFFFF0000 when starting a checksum of a file. The - * checksum is kind of a rolling checksum thing, so each time you get bytes - * of a file you just call this puppy and it updates the checksum. You can - * calculate the checksum of an entire file by calling this in a while or a - * for loop, or something. - * - * Thanks to Graham Booker for providing this improved checksum routine, - * which is simpler and should be more accurate than Josh Myer's original - * code. -- wtm - * - * This algorithm works every time I have tried it. The other fails - * sometimes. So, AOL who thought this up? It has got to be the weirdest - * checksum I have ever seen. - * - * @param buffer Buffer of data to checksum. Man I'd like to buff her... - * @param bufsize Size of buffer. - * @param prevchecksum Previous checksum. - * @param odd Whether an odd number of bytes have been processed before this call - */ -static guint32 -peer_oft_checksum_chunk(const guint8 *buffer, int bufferlen, guint32 prevchecksum, int odd) -{ - guint32 checksum, oldchecksum; - int i = 0; - unsigned short val; - - checksum = (prevchecksum >> 16) & 0xffff; - if (odd) - { - /* - * This is one hell of a hack, but it should always work. - * Essentially, I am reindexing the array so that index 1 - * is the first element. Since the odd and even bytes are - * detected by the index number. - */ - i = 1; - bufferlen++; - buffer--; - } - for (; i < bufferlen; i++) - { - oldchecksum = checksum; - if (i & 1) - val = buffer[i]; - else - val = buffer[i] << 8; - checksum -= val; - /* - * The following appears to be necessary.... It happens - * every once in a while and the checksum doesn't fail. - */ - if (checksum > oldchecksum) - checksum--; - } - checksum = ((checksum & 0x0000ffff) + (checksum >> 16)); - checksum = ((checksum & 0x0000ffff) + (checksum >> 16)); - return checksum << 16; -} - -static gboolean -peer_oft_checksum_file_piece(gpointer data) -{ - ChecksumData *checksum_data; - gboolean repeat; - - checksum_data = data; - repeat = FALSE; - - if (checksum_data->total < checksum_data->size) - { - size_t bytes = MIN(CHECKSUM_BUFFER_SIZE, - checksum_data->size - checksum_data->total); - - bytes = fread(checksum_data->buffer, 1, bytes, checksum_data->file); - if (bytes != 0) - { - checksum_data->checksum = peer_oft_checksum_chunk(checksum_data->buffer, bytes, checksum_data->checksum, checksum_data->total & 1); - checksum_data->total += bytes; - repeat = TRUE; - } - } - - if (!repeat) - { - purple_debug_info("oscar", "Checksum of %s calculated\n", - purple_xfer_get_local_filename(checksum_data->xfer)); - if (checksum_data->callback != NULL) - checksum_data->callback(checksum_data); - peer_oft_checksum_destroy(checksum_data); - } - - return repeat; -} - -/** - * Calculate oft checksum of a file in a series of calls to - * peer_oft_checksum_file_piece(). We do it this way because - * calculating the checksum on large files can take a long time, - * and we want to return control to the UI so that the application - * doesn't appear completely frozen. - * - * @param conn The connection used for this file transfer. - * @param xfer The file transfer needing this checksum. - * @param callback The function to call upon calculation of the checksum. - * @param size The maximum size to check. - */ - -static void -peer_oft_checksum_file(PeerConnection *conn, PurpleXfer *xfer, GSourceFunc callback, size_t size) -{ - ChecksumData *checksum_data; - - purple_debug_info("oscar", "Calculating checksum of %s\n", - purple_xfer_get_local_filename(xfer)); - - checksum_data = g_malloc0(sizeof(ChecksumData)); - checksum_data->conn = conn; - checksum_data->xfer = xfer; - checksum_data->callback = callback; - checksum_data->size = size; - checksum_data->checksum = 0xffff0000; - checksum_data->file = fopen(purple_xfer_get_local_filename(xfer), "rb"); - - if (checksum_data->file == NULL) - { - purple_debug_error("oscar", "Unable to open %s for checksumming: %s\n", - purple_xfer_get_local_filename(xfer), g_strerror(errno)); - callback(checksum_data); - g_free(checksum_data); - } - else - { - checksum_data->timer = purple_timeout_add(10, - peer_oft_checksum_file_piece, checksum_data); - conn->checksum_data = checksum_data; - } -} - -static void -peer_oft_copy_xfer_data(PeerConnection *conn, OftFrame *frame) -{ - g_free(conn->xferdata.name); - - memcpy(&(conn->xferdata), frame, sizeof(OftFrame)); - conn->xferdata.name = g_memdup(frame->name, frame->name_length); -} - -/** - * Free any OFT related data. - */ -void -peer_oft_close(PeerConnection *conn) -{ - /* - * If canceled by local user, and we're receiving a file, and - * we're not connected/ready then send an ICBM cancel message. - */ - if ((purple_xfer_get_status(conn->xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) && - !conn->ready) - { - aim_im_sendch2_cancel(conn); - } - - if (conn->sending_data_timer != 0) - { - purple_timeout_remove(conn->sending_data_timer); - conn->sending_data_timer = 0; - } -} - -/** - * Write the given OftFrame to a ByteStream and send it out - * on the established PeerConnection. - */ -static void -peer_oft_send(PeerConnection *conn, OftFrame *frame) -{ - size_t length; - ByteStream bs; - - length = 192 + frame->name_length; - byte_stream_new(&bs, length); - byte_stream_putraw(&bs, conn->magic, 4); - byte_stream_put16(&bs, length); - byte_stream_put16(&bs, frame->type); - byte_stream_putraw(&bs, frame->cookie, 8); - byte_stream_put16(&bs, frame->encrypt); - byte_stream_put16(&bs, frame->compress); - byte_stream_put16(&bs, frame->totfiles); - byte_stream_put16(&bs, frame->filesleft); - byte_stream_put16(&bs, frame->totparts); - byte_stream_put16(&bs, frame->partsleft); - byte_stream_put32(&bs, frame->totsize); - byte_stream_put32(&bs, frame->size); - byte_stream_put32(&bs, frame->modtime); - byte_stream_put32(&bs, frame->checksum); - byte_stream_put32(&bs, frame->rfrcsum); - byte_stream_put32(&bs, frame->rfsize); - byte_stream_put32(&bs, frame->cretime); - byte_stream_put32(&bs, frame->rfcsum); - byte_stream_put32(&bs, frame->nrecvd); - byte_stream_put32(&bs, frame->recvcsum); - byte_stream_putraw(&bs, frame->idstring, 32); - byte_stream_put8(&bs, frame->flags); - byte_stream_put8(&bs, frame->lnameoffset); - byte_stream_put8(&bs, frame->lsizeoffset); - byte_stream_putraw(&bs, frame->dummy, 69); - byte_stream_putraw(&bs, frame->macfileinfo, 16); - byte_stream_put16(&bs, frame->nencode); - byte_stream_put16(&bs, frame->nlanguage); - /* - * The name can be more than 64 characters, but if it is less than - * 64 characters it is padded with NULLs. - */ - byte_stream_putraw(&bs, frame->name, frame->name_length); - - peer_connection_send(conn, &bs); - - byte_stream_destroy(&bs); -} - -void -peer_oft_send_prompt(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_PROMPT; - peer_oft_send(conn, &conn->xferdata); -} - -static void -peer_oft_send_ack(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_ACK; - - /* Fill in the cookie */ - memcpy(conn->xferdata.cookie, conn->cookie, 8); - - peer_oft_send(conn, &conn->xferdata); -} - -static void -peer_oft_send_resume_accept(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_RESUMEACCEPT; - - /* Fill in the cookie */ - memcpy(conn->xferdata.cookie, conn->cookie, 8); - - peer_oft_send(conn, &conn->xferdata); -} - -static void -peer_oft_send_done(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_DONE; - conn->xferdata.rfrcsum = 0xffff0000; - conn->xferdata.nrecvd = purple_xfer_get_bytes_sent(conn->xfer); - peer_oft_send(conn, &conn->xferdata); -} - -/** - * This function exists so that we don't remove the outgoing - * data watcher while we're still sending data. In most cases - * any data we're sending will be instantly wisked away to a TCP - * buffer maintained by our operating system... but we want to - * make sure the core doesn't start sending file data while - * we're still sending OFT frame data. That would be bad. - */ -static gboolean -start_transfer_when_done_sending_data(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) - { - conn->sending_data_timer = 0; - conn->xfer->fd = conn->fd; - conn->fd = -1; - purple_xfer_start(conn->xfer, conn->xfer->fd, NULL, 0); - return FALSE; - } - - return TRUE; -} - -/** - * This function is similar to the above function, except instead - * of starting the xfer it will destroy the connection. This is - * used when you want to send one final message across the peer - * connection, and then close everything. - */ -static gboolean -destroy_connection_when_done_sending_data(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) - { - conn->sending_data_timer = 0; - peer_connection_destroy(conn, conn->disconnect_reason, NULL); - return FALSE; - } - - return TRUE; -} - -/* - * This is called when a buddy sends us some file info. This happens when they - * are sending a file to you, and you have just established a connection to them. - * You should send them the exact same info except use the real cookie. We also - * get like totally ready to like, receive the file, kay? - */ -static void -peer_oft_recv_frame_prompt(PeerConnection *conn, OftFrame *frame) -{ - /* Record the file information and send an ack */ - peer_oft_copy_xfer_data(conn, frame); - peer_oft_send_ack(conn); - - /* Remove our watchers and use the file transfer watchers in the core */ - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - conn->sending_data_timer = purple_timeout_add(100, - start_transfer_when_done_sending_data, conn); -} - -/** - * We are sending a file to someone else. They have just acknowledged our - * prompt, so we want to start sending data like there's no tomorrow. - */ -static void -peer_oft_recv_frame_ack(PeerConnection *conn, OftFrame *frame) -{ - if (memcmp(conn->cookie, frame->cookie, 8) != 0) - { - purple_debug_info("oscar", "Received an incorrect cookie. " - "Closing connection.\n"); - peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); - return; - } - - /* Remove our watchers and use the file transfer watchers in the core */ - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - conn->sending_data_timer = purple_timeout_add(100, - start_transfer_when_done_sending_data, conn); -} - -static gboolean -peer_oft_recv_frame_resume_checksum_calculated_cb(gpointer data) -{ - ChecksumData *checksum_data; - PeerConnection *conn; - - checksum_data = data; - conn = checksum_data->conn; - - /* Check the checksums here. If not match, don't allow resume */ - if (checksum_data->checksum != conn->xferdata.recvcsum || checksum_data->total != conn->xferdata.nrecvd) - { - /* Reset internal structure */ - conn->xferdata.recvcsum = 0xffff0000; - conn->xferdata.rfrcsum = 0xffff0000; - conn->xferdata.nrecvd = 0; - } - else - /* Accept the change */ - purple_xfer_set_bytes_sent(checksum_data->xfer, conn->xferdata.nrecvd); - - peer_oft_send_resume_accept(conn); - - return FALSE; -} - -/** - * We are sending a file to someone else. They have just acknowledged our - * prompt and are asking to resume, so we accept their resume and await - * a resume ack. - */ -static void -peer_oft_recv_frame_resume(PeerConnection *conn, OftFrame *frame) -{ - if (memcmp(conn->cookie, frame->cookie, 8) != 0) - { - purple_debug_info("oscar", "Received an incorrect cookie. " - "Closing connection.\n"); - peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); - return; - } - - /* Copy resume data into internal structure */ - conn->xferdata.recvcsum = frame->recvcsum; - conn->xferdata.rfrcsum = frame->rfrcsum; - conn->xferdata.nrecvd = frame->nrecvd; - - peer_oft_checksum_file(conn, conn->xfer, - peer_oft_recv_frame_resume_checksum_calculated_cb, - frame->nrecvd); -} - -/* - * We just sent a file to someone. They said they got it and everything, - * so we can close our direct connection and what not. - */ -static void -peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) -{ - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - conn->xfer->fd = conn->fd; - conn->fd = -1; - conn->disconnect_reason = OSCAR_DISCONNECT_DONE; - peer_connection_schedule_destroy(conn, conn->disconnect_reason, NULL); -} - -/** - * Handle an incoming OftFrame. If there is a payload associated - * with this frame, then we remove the old watcher and add the - * OFT watcher to read in the payload. - */ -void -peer_oft_recv_frame(PeerConnection *conn, ByteStream *bs) -{ - OftFrame frame; - - frame.type = byte_stream_get16(bs); - byte_stream_getrawbuf(bs, frame.cookie, 8); - frame.encrypt = byte_stream_get16(bs); - frame.compress = byte_stream_get16(bs); - frame.totfiles = byte_stream_get16(bs); - frame.filesleft = byte_stream_get16(bs); - frame.totparts = byte_stream_get16(bs); - frame.partsleft = byte_stream_get16(bs); - frame.totsize = byte_stream_get32(bs); - frame.size = byte_stream_get32(bs); - frame.modtime = byte_stream_get32(bs); - frame.checksum = byte_stream_get32(bs); - frame.rfrcsum = byte_stream_get32(bs); - frame.rfsize = byte_stream_get32(bs); - frame.cretime = byte_stream_get32(bs); - frame.rfcsum = byte_stream_get32(bs); - frame.nrecvd = byte_stream_get32(bs); - frame.recvcsum = byte_stream_get32(bs); - byte_stream_getrawbuf(bs, frame.idstring, 32); - frame.flags = byte_stream_get8(bs); - frame.lnameoffset = byte_stream_get8(bs); - frame.lsizeoffset = byte_stream_get8(bs); - byte_stream_getrawbuf(bs, frame.dummy, 69); - byte_stream_getrawbuf(bs, frame.macfileinfo, 16); - frame.nencode = byte_stream_get16(bs); - frame.nlanguage = byte_stream_get16(bs); - frame.name_length = bs->len - 186; - frame.name = byte_stream_getraw(bs, frame.name_length); - - purple_debug_info("oscar", "Incoming OFT frame from %s with " - "type=0x%04x\n", conn->bn, frame.type); - - /* TODOFT: peer_oft_dirconvert_fromstupid(frame->name); */ - - switch(frame.type) - { - case PEER_TYPE_PROMPT: - peer_oft_recv_frame_prompt(conn, &frame); - break; - case PEER_TYPE_ACK: - case PEER_TYPE_RESUMEACK: - peer_oft_recv_frame_ack(conn, &frame); - break; - case PEER_TYPE_RESUME: - peer_oft_recv_frame_resume(conn, &frame); - break; - case PEER_TYPE_DONE: - peer_oft_recv_frame_done(conn, &frame); - break; - default: - break; - } - - g_free(frame.name); -} - -/*******************************************************************/ -/* Begin PurpleXfer callbacks for use when receiving a file */ -/*******************************************************************/ - -void -peer_oft_recvcb_init(PurpleXfer *xfer) -{ - PeerConnection *conn; - - conn = xfer->data; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - peer_connection_trynext(conn); -} - -void -peer_oft_recvcb_end(PurpleXfer *xfer) -{ - PeerConnection *conn; - - conn = xfer->data; - - /* Tell the other person that we've received everything */ - conn->fd = conn->xfer->fd; - conn->xfer->fd = -1; - peer_oft_send_done(conn); - - conn->disconnect_reason = OSCAR_DISCONNECT_DONE; - conn->sending_data_timer = purple_timeout_add(100, - destroy_connection_when_done_sending_data, conn); -} - -void -peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size) -{ - PeerConnection *conn; - - /* Update our rolling checksum. Like Walmart, yo. */ - conn = xfer->data; - conn->xferdata.recvcsum = peer_oft_checksum_chunk(buffer, - size, conn->xferdata.recvcsum, purple_xfer_get_bytes_sent(xfer) & 1); -} - -/*******************************************************************/ -/* End PurpleXfer callbacks for use when receiving a file */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin PurpleXfer callbacks for use when sending a file */ -/*******************************************************************/ - -static gboolean -peer_oft_checksum_calculated_cb(gpointer data) -{ - ChecksumData *checksum_data; - PeerConnection *conn; - - checksum_data = data; - conn = checksum_data->conn; - - conn->xferdata.checksum = checksum_data->checksum; - - /* Start the connection process */ - peer_connection_trynext(checksum_data->conn); - - return FALSE; -} - -void -peer_oft_sendcb_init(PurpleXfer *xfer) -{ - PeerConnection *conn; - size_t size; - - conn = xfer->data; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - - /* Make sure the file size can be represented in 32 bits */ - size = purple_xfer_get_size(xfer); - if (size > G_MAXUINT32) - { - gchar *tmp, *size1, *size2; - size1 = purple_str_size_to_units(size); - size2 = purple_str_size_to_units(G_MAXUINT32); - tmp = g_strdup_printf(_("File %s is %s, which is larger than " - "the maximum size of %s."), - xfer->local_filename, size1, size2); - purple_xfer_error(purple_xfer_get_type(xfer), - purple_xfer_get_account(xfer), xfer->who, tmp); - g_free(size1); - g_free(size2); - g_free(tmp); - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - return; - } - - /* Keep track of file transfer info */ - conn->xferdata.totfiles = 1; - conn->xferdata.filesleft = 1; - conn->xferdata.totparts = 1; - conn->xferdata.partsleft = 1; - conn->xferdata.totsize = size; - conn->xferdata.size = size; - conn->xferdata.checksum = 0xffff0000; - conn->xferdata.rfrcsum = 0xffff0000; - conn->xferdata.rfcsum = 0xffff0000; - conn->xferdata.recvcsum = 0xffff0000; - strncpy((gchar *)conn->xferdata.idstring, "Cool FileXfer", 31); - conn->xferdata.modtime = 0; - conn->xferdata.cretime = 0; - xfer->filename = g_path_get_basename(xfer->local_filename); - conn->xferdata.name_length = MAX(64, strlen(xfer->filename) + 1); - conn->xferdata.name = (guchar *)g_strndup(xfer->filename, conn->xferdata.name_length - 1); - - peer_oft_checksum_file(conn, xfer, - peer_oft_checksum_calculated_cb, G_MAXUINT32); -} - -/* - * AIM file transfers aren't really meant to be thought - * of as a transferring just a single file. The rendezvous - * establishes a connection between two computers, and then - * those computers can use the same connection for transferring - * multiple files. So we don't want the Purple core up and closing - * the socket all willy-nilly. We want to do that in the oscar - * prpl, whenever one side or the other says they're finished - * using the connection. There might be a better way to intercept - * the socket from the core... - */ -void -peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) -{ - PeerConnection *conn; - - conn = xfer->data; - - /* - * If we're done sending, intercept the socket from the core ft code - * and wait for the other guy to send the "done" OFT packet. - */ - if (purple_xfer_get_bytes_remaining(xfer) <= 0) - { - purple_input_remove(xfer->watcher); - conn->fd = xfer->fd; - xfer->fd = -1; - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_connection_recv_cb, conn); - } -} - -/*******************************************************************/ -/* End PurpleXfer callbacks for use when sending a file */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin PurpleXfer callbacks for use when sending and receiving */ -/*******************************************************************/ - -void -peer_oft_cb_generic_cancel(PurpleXfer *xfer) -{ - PeerConnection *conn; - - conn = xfer->data; - - if (conn == NULL) - return; - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); -} - -/*******************************************************************/ -/* End PurpleXfer callbacks for use when sending and receiving */ -/*******************************************************************/ - -#ifdef TODOFT -/* - * This little area in oscar.c is the nexus of file transfer code, - * so I wrote a little explanation of what happens. I am such a - * ninja. - * - * The series of events for a file send is: - * -Create xfer and call purple_xfer_request (this happens in oscar_ask_sendfile) - * -User chooses a file and oscar_xfer_init is called. It establishes a - * listening socket, then asks the remote user to connect to us (and - * gives them the file name, port, IP, etc.) - * -They connect to us and we send them an PEER_TYPE_PROMPT (this happens - * in peer_oft_recv_frame_established) - * -They send us an PEER_TYPE_ACK and then we start sending data - * -When we finish, they send us an PEER_TYPE_DONE and they close the - * connection. - * -We get drunk because file transfer kicks ass. - * - * The series of events for a file receive is: - * -Create xfer and call purple_xfer request (this happens in incomingim_chan2) - * -Purple user selects file to name and location to save file to and - * oscar_xfer_init is called - * -It connects to the remote user using the IP they gave us earlier - * -After connecting, they send us an PEER_TYPE_PROMPT. In reply, we send - * them an PEER_TYPE_ACK. - * -They begin to send us lots of raw data. - * -When they finish sending data we send an PEER_TYPE_DONE and then close - * the connection. - * - * Update August 2005: - * The series of events for transfers has been seriously complicated by the addition - * of transfer redirects and proxied connections. I could throw a whole lot of words - * at trying to explain things here, but it probably wouldn't do much good. To get - * a better idea of what happens, take a look at the diagrams and documentation - * from my Summer of Code project. -- Jonathan Clark - */ - -/** - * Convert the directory separator from / (0x2f) to ^A (0x01) - * - * @param name The filename to convert. - */ -static void -peer_oft_dirconvert_tostupid(char *name) -{ - while (name[0]) { - if (name[0] == 0x01) - name[0] = G_DIR_SEPARATOR; - name++; - } -} - -/** - * Convert the directory separator from ^A (0x01) to / (0x2f) - * - * @param name The filename to convert. - */ -static void -peer_oft_dirconvert_fromstupid(char *name) -{ - while (name[0]) { - if (name[0] == G_DIR_SEPARATOR) - name[0] = 0x01; - name++; - } -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,7289 +0,0 @@ -/* - * purple - * - * Some code copyright (C) 1998-1999, Mark Spencer - * Some code copyright (C) 1999-2001, Eric Warmenhoven - * Some code copyright (C) 2001-2003, Sean Egan - * Some code copyright (C) 2001-2007, Mark Doliner - * Some code copyright (C) 2005, Jonathan Clark - * Some code copyright (C) 2007, ComBOTS Product GmbH (htfv) - * Some code copyright (C) 2008, Aman Gupta - * - * Most libfaim code copyright (C) 1998-2001 Adam Fritzler - * Some libfaim code copyright (C) 2001-2004 Mark Doliner - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "buddyicon.h" -#include "cipher.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "imgstore.h" -#include "network.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "util.h" -#include "version.h" - -#include "oscarcommon.h" -#include "oscar.h" -#include "peer.h" - -#define OSCAR_STATUS_ID_INVISIBLE "invisible" -#define OSCAR_STATUS_ID_OFFLINE "offline" -#define OSCAR_STATUS_ID_AVAILABLE "available" -#define OSCAR_STATUS_ID_AWAY "away" -#define OSCAR_STATUS_ID_DND "dnd" -#define OSCAR_STATUS_ID_NA "na" -#define OSCAR_STATUS_ID_OCCUPIED "occupied" -#define OSCAR_STATUS_ID_FREE4CHAT "free4chat" -#define OSCAR_STATUS_ID_CUSTOM "custom" -#define OSCAR_STATUS_ID_MOBILE "mobile" - -#define AIMHASHDATA "http://pidgin.im/aim_data.php3" - -#define OSCAR_CONNECT_STEPS 6 - -static OscarCapability purple_caps = (OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | - OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | - OSCAR_CAPABILITY_SHORTCAPS | OSCAR_CAPABILITY_TYPING); - -static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02}; -static guint8 features_icq[] = {0x01, 0x06}; -static guint8 features_icq_offline[] = {0x01}; -static guint8 ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -struct create_room { - char *name; - int exchange; -}; - -struct oscar_ask_directim_data -{ - OscarData *od; - char *who; -}; - -/* - * Various PRPL-specific buddy info that we want to keep track of - * Some other info is maintained by locate.c, and I'd like to move - * the rest of this to libfaim, mostly im.c - * - * TODO: More of this should use the status API. - */ -struct buddyinfo { - gboolean typingnot; - guint32 ipaddr; - - unsigned long ico_me_len; - unsigned long ico_me_csum; - time_t ico_me_time; - gboolean ico_informed; - - unsigned long ico_len; - unsigned long ico_csum; - time_t ico_time; - gboolean ico_need; - gboolean ico_sent; -}; - -struct name_data { - PurpleConnection *gc; - gchar *name; - gchar *nick; -}; - -static const char * const msgerrreason[] = { - N_("Invalid error"), - N_("Invalid SNAC"), - N_("Rate to host"), - N_("Rate to client"), - N_("Not logged in"), - N_("Service unavailable"), - N_("Service not defined"), - N_("Obsolete SNAC"), - N_("Not supported by host"), - N_("Not supported by client"), - N_("Refused by client"), - N_("Reply too big"), - N_("Responses lost"), - N_("Request denied"), - N_("Busted SNAC payload"), - N_("Insufficient rights"), - N_("In local permit/deny"), - N_("Warning level too high (sender)"), - N_("Warning level too high (receiver)"), - N_("User temporarily unavailable"), - N_("No match"), - N_("List overflow"), - N_("Request ambiguous"), - N_("Queue full"), - N_("Not while on AOL") -}; -static const int msgerrreasonlen = G_N_ELEMENTS(msgerrreason); - -static const char * const errcodereason[] = { - N_("Invalid error"), - N_("Not logged in"), - N_("Cannot receive IM due to parental controls"), - N_("Cannot send SMS without accepting terms"), - N_("Cannot send SMS"), /* SMS_WITHOUT_DISCLAIMER is weird */ - N_("Cannot send SMS to this country"), - N_("Unknown error"), /* Undocumented */ - N_("Unknown error"), /* Undocumented */ - N_("Cannot send SMS to unknown country"), - N_("Bot accounts cannot initiate IMs"), - N_("Bot account cannot IM this user"), - N_("Bot account reached IM limit"), - N_("Bot account reached daily IM limit"), - N_("Bot account reached monthly IM limit"), - N_("Unable to receive offline messages"), - N_("Offline message store full") -}; -static const int errcodereasonlen = G_N_ELEMENTS(errcodereason); - -/* All the libfaim->purple callback functions */ - -/* Only used when connecting with the old-style BUCP login */ -static int purple_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_login (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...); - -static int purple_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_info_change (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_account_confirm (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_oncoming (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_offgoing (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_incoming_im(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_misses (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_clientauto (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_userinfo (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_motd (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_chatnav_info (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_join (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_leave (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_info_update (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_icon_parseicon (OscarData *, FlapConnection *, FlapFrame *, ...); -static int oscar_icon_req (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_msgack (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_ratechange (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_searchreply(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_bosrights (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_connerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_msgerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_mtn (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_locaterights(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_buddyrights(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_locerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_genericerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_memrequest (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_selfinfo (OscarData *, FlapConnection *, FlapFrame *, ...); -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -static int purple_offlinemsg (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_offlinemsgdone (OscarData *, FlapConnection *, FlapFrame *, ...); -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ -static int purple_icqalias (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_icqinfo (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_popup (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parseerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parserights (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parselist (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parseack (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parseaddmod (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_authgiven (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_authrequest (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_authreply (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_gotadded (OscarData *, FlapConnection *, FlapFrame *, ...); - -static void purple_icons_fetch(PurpleConnection *gc); - -void oscar_set_info(PurpleConnection *gc, const char *info); -static void oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, PurpleStatus *status); -static void oscar_set_extendedstatus(PurpleConnection *gc); -static gboolean purple_ssi_rerequestdata(gpointer data); - -static void oscar_free_name_data(struct name_data *data) { - g_free(data->name); - g_free(data->nick); - g_free(data); -} - -#ifdef _WIN32 -const char *oscar_get_locale_charset(void) { - static const char *charset = NULL; - if (charset == NULL) - g_get_charset(&charset); - return charset; -} -#endif - -/** - * Determine how we can send this message. Per the warnings elsewhere - * in this file, these little checks determine the simplest encoding - * we can use for a given message send using it. - */ -static guint32 -oscar_charset_check(const char *utf8) -{ - int i = 0; - int charset = AIM_CHARSET_ASCII; - - /* - * Can we get away with using our custom encoding? - */ - while (utf8[i]) - { - if ((unsigned char)utf8[i] > 0x7f) { - /* not ASCII! */ - charset = AIM_CHARSET_LATIN_1; - break; - } - i++; - } - - /* - * Must we send this message as UNICODE (in the UTF-16BE encoding)? - */ - while (utf8[i]) - { - /* ISO-8859-1 is 0x00-0xbf in the first byte - * followed by 0xc0-0xc3 in the second */ - if ((unsigned char)utf8[i] < 0x80) { - i++; - continue; - } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && - ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { - i += 2; - continue; - } - charset = AIM_CHARSET_UNICODE; - break; - } - - return charset; -} - -/** - * Take a string of the form charset="bleh" where bleh is - * one of us-ascii, utf-8, iso-8859-1, or unicode-2-0, and - * return a newly allocated string containing bleh. - */ -gchar * -oscar_encoding_extract(const char *encoding) -{ - gchar *ret = NULL; - char *begin, *end; - - g_return_val_if_fail(encoding != NULL, NULL); - - /* Make sure encoding begins with charset= */ - if (strncmp(encoding, "text/aolrtf; charset=", 21) && - strncmp(encoding, "text/x-aolrtf; charset=", 23) && - strncmp(encoding, "text/plain; charset=", 20)) - { - return NULL; - } - - begin = strchr(encoding, '"'); - end = strrchr(encoding, '"'); - - if ((begin == NULL) || (end == NULL) || (begin >= end)) - return NULL; - - ret = g_strndup(begin+1, (end-1) - begin); - - return ret; -} - -gchar * -oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen) -{ - gchar *utf8 = NULL; - - if ((encoding == NULL) || encoding[0] == '\0') { - purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n"); - } else if (!g_ascii_strcasecmp(encoding, "iso-8859-1")) { - utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL); - } else if (!g_ascii_strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") || - !g_ascii_strcasecmp(encoding, "us-ascii")) - { - utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL); - } else if (!g_ascii_strcasecmp(encoding, "unicode-2-0")) { - /* Some official ICQ clients are apparently total crack, - * and have been known to save a UTF-8 string converted - * from the locale character set to UTF-16 (not from UTF-8 - * to UTF-16!) in the away message. This hack should find - * and do something (un)reasonable with that, and not - * mess up too much else. */ - const gchar *charset = purple_account_get_string(account, "encoding", NULL); - if (charset) { - gsize len; - utf8 = g_convert(text, textlen, charset, "UTF-16BE", &len, NULL, NULL); - if (!utf8 || len != textlen || !g_utf8_validate(utf8, -1, NULL)) { - g_free(utf8); - utf8 = NULL; - } else { - purple_debug_info("oscar", "Used broken ICQ fallback encoding\n"); - } - } - if (!utf8) - utf8 = g_convert(text, textlen, "UTF-8", "UTF-16BE", NULL, NULL, NULL); - } else if (g_ascii_strcasecmp(encoding, "utf-8")) { - purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", " - "attempting to convert to UTF-8 anyway\n", encoding); - utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); - } - - /* - * If utf8 is still NULL then either the encoding is utf-8 or - * we have been unable to convert the text to utf-8 from the encoding - * that was specified. So we check if the text is valid utf-8 then - * just copy it. - */ - if (utf8 == NULL) { - if (textlen != 0 && *text != '\0' - && !g_utf8_validate(text, textlen, NULL)) - utf8 = g_strdup(_("(There was an error receiving this message. The buddy you are speaking with is probably using a different encoding than expected. If you know what encoding he is using, you can specify it in the advanced account options for your AIM/ICQ account.)")); - else - utf8 = g_strndup(text, textlen); - } - - return utf8; -} - -static gchar * -oscar_utf8_try_convert(PurpleAccount *account, const gchar *msg) -{ - const char *charset = NULL; - char *ret = NULL; - - if(oscar_util_valid_name_icq(purple_account_get_username(account))) - charset = purple_account_get_string(account, "encoding", NULL); - - if(charset && *charset) - ret = g_convert(msg, -1, "UTF-8", charset, NULL, NULL, NULL); - - if(!ret) - ret = purple_utf8_try_convert(msg); - - return ret; -} - -static gchar * -purple_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback) -{ - gchar *ret = NULL; - GError *err = NULL; - - if ((charsetstr == NULL) || (*charsetstr == '\0')) - return NULL; - - if (g_ascii_strcasecmp("UTF-8", charsetstr)) { - if (fallback) - ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err); - else - ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err); - if (err != NULL) { - purple_debug_warning("oscar", "Conversion from %s failed: %s.\n", - charsetstr, err->message); - g_error_free(err); - } - } else { - if (g_utf8_validate(data, datalen, NULL)) - ret = g_strndup(data, datalen); - else - purple_debug_warning("oscar", "String is not valid UTF-8.\n"); - } - - return ret; -} - -/** - * This attemps to decode an incoming IM into a UTF8 string. - * - * We try decoding using two different character sets. The charset - * specified in the IM determines the order in which we attempt to - * decode. We do this because there are lots of broken ICQ clients - * that don't correctly send non-ASCII messages. And if Purple isn't - * able to deal with that crap, then people complain like banshees. - * charsetstr1 is always set to what the correct encoding should be. - */ -gchar * -purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcebn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen) -{ - gchar *ret = NULL; - const gchar *charsetstr1, *charsetstr2, *charsetstr3 = NULL; - - if ((datalen == 0) || (data == NULL)) - return NULL; - - if (charset == AIM_CHARSET_UNICODE) { - charsetstr1 = "UTF-16BE"; - charsetstr2 = "UTF-8"; - } else if (charset == AIM_CHARSET_LATIN_1) { - if ((sourcebn != NULL) && oscar_util_valid_name_icq(sourcebn)) - charsetstr1 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - else - charsetstr1 = "ISO-8859-1"; - charsetstr2 = "UTF-8"; - } else if (charset == AIM_CHARSET_ASCII) { - /* Should just be "ASCII" */ - charsetstr1 = "ASCII"; - charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - } else if (charset == 0x000d) { - /* iChat sending unicode over a Direct IM connection = UTF-8 */ - /* Mobile AIM client on multiple devices (including Blackberry Tour, Nokia 3100, and LG VX6000) = ISO-8859-1 */ - charsetstr1 = "UTF-8"; - charsetstr2 = "ISO-8859-1"; - charsetstr3 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - } else { - /* Unknown, hope for valid UTF-8... */ - charsetstr1 = "UTF-8"; - charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - } - - purple_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%" G_GSIZE_FORMAT ", choice1=%s, choice2=%s, choice3=%s\n", - charset, charsubset, datalen, charsetstr1, charsetstr2, (charsetstr3 ? charsetstr3 : "")); - - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE); - if (ret == NULL) { - if (charsetstr3 != NULL) { - /* Try charsetstr2 without allowing substitutions, then fall through to charsetstr3 if needed */ - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, FALSE); - if (ret == NULL) - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr3, TRUE); - } else { - /* Try charsetstr2, allowing substitutions */ - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE); - } - } - if (ret == NULL) { - char *str, *salvage, *tmp; - - str = g_malloc(datalen + 1); - strncpy(str, data, datalen); - str[datalen] = '\0'; - salvage = purple_utf8_salvage(str); - tmp = g_strdup_printf(_("(There was an error receiving this message. Either you and %s have different encodings selected, or %s has a buggy client.)"), - sourcebn, sourcebn); - ret = g_strdup_printf("%s %s", salvage, tmp); - g_free(tmp); - g_free(str); - g_free(salvage); - } - - return ret; -} - -/** - * Figure out what encoding to use when sending a given outgoing message. - */ -static void -purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, - const char *destbn, const gchar *from, - gchar **msg, int *msglen_int, - guint16 *charset, guint16 *charsubset) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleAccount *account = purple_connection_get_account(gc); - GError *err = NULL; - aim_userinfo_t *userinfo = NULL; - const gchar *charsetstr; - gsize msglen; - - /* Attempt to send as ASCII */ - if (oscar_charset_check(from) == AIM_CHARSET_ASCII) { - *msg = g_convert(from, -1, "ASCII", "UTF-8", NULL, &msglen, NULL); - *charset = AIM_CHARSET_ASCII; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - /* - * If we're sending to an ICQ user, and they are in our - * buddy list, and they are advertising the Unicode - * capability, and they are online, then attempt to send - * as UTF-16BE. - */ - if ((destbn != NULL) && oscar_util_valid_name_icq(destbn)) - userinfo = aim_locate_finduserinfo(od, destbn); - - if ((userinfo != NULL) && (userinfo->capabilities & OSCAR_CAPABILITY_UNICODE)) - { - PurpleBuddy *b; - b = purple_find_buddy(account, destbn); - if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b))) - { - *msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, &err); - if (*msg != NULL) - { - *charset = AIM_CHARSET_UNICODE; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - purple_debug_error("oscar", "Conversion from UTF-8 to UTF-16BE failed: %s.\n", - err->message); - g_error_free(err); - err = NULL; - } - } - - /* - * If this is AIM then attempt to send as ISO-8859-1. If this is - * ICQ then attempt to send as the user specified character encoding. - */ - charsetstr = "ISO-8859-1"; - if ((destbn != NULL) && oscar_util_valid_name_icq(destbn)) - charsetstr = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - - /* - * XXX - We need a way to only attempt to convert if we KNOW "from" - * can be converted to "charsetstr" - */ - *msg = g_convert(from, -1, charsetstr, "UTF-8", NULL, &msglen, &err); - if (*msg != NULL) { - *charset = AIM_CHARSET_LATIN_1; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - purple_debug_info("oscar", "Conversion from UTF-8 to %s failed (%s). Falling back to unicode.\n", - charsetstr, err->message); - g_error_free(err); - err = NULL; - - /* - * Nothing else worked, so send as UTF-16BE. - */ - *msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, &err); - if (*msg != NULL) { - *charset = AIM_CHARSET_UNICODE; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - purple_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message); - g_error_free(err); - err = NULL; - - purple_debug_error("oscar", "This should NEVER happen! Sending UTF-8 text flagged as ASCII.\n"); - *msg = g_strdup(from); - *msglen_int = strlen(*msg); - *charset = AIM_CHARSET_ASCII; - *charsubset = 0x0000; - return; -} - -/** - * Looks for %n, %d, or %t in a string, and replaces them with the - * specified name, date, and time, respectively. - * - * @param str The string that may contain the special variables. - * @param name The sender name. - * - * @return A newly allocated string where the special variables are - * expanded. This should be g_free'd by the caller. - */ -static gchar * -purple_str_sub_away_formatters(const char *str, const char *name) -{ - char *c; - GString *cpy; - time_t t; - struct tm *tme; - - g_return_val_if_fail(str != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - /* Create an empty GString that is hopefully big enough for most messages */ - cpy = g_string_sized_new(1024); - - t = time(NULL); - tme = localtime(&t); - - c = (char *)str; - while (*c) { - switch (*c) { - case '%': - if (*(c + 1)) { - switch (*(c + 1)) { - case 'n': - /* append name */ - g_string_append(cpy, name); - c++; - break; - case 'd': - /* append date */ - g_string_append(cpy, purple_date_format_short(tme)); - c++; - break; - case 't': - /* append time */ - g_string_append(cpy, purple_time_format(tme)); - c++; - break; - default: - g_string_append_c(cpy, *c); - } - } else { - g_string_append_c(cpy, *c); - } - break; - default: - g_string_append_c(cpy, *c); - } - c++; - } - - return g_string_free(cpy, FALSE); -} - -static gchar *oscar_caps_to_string(OscarCapability caps) -{ - GString *str; - const gchar *tmp; - guint bit = 1; - - str = g_string_new(""); - - if (!caps) { - return NULL; - } else while (bit <= OSCAR_CAPABILITY_LAST) { - if (bit & caps) { - switch (bit) { - case OSCAR_CAPABILITY_BUDDYICON: - tmp = _("Buddy Icon"); - break; - case OSCAR_CAPABILITY_TALK: - tmp = _("Voice"); - break; - case OSCAR_CAPABILITY_DIRECTIM: - tmp = _("AIM Direct IM"); - break; - case OSCAR_CAPABILITY_CHAT: - tmp = _("Chat"); - break; - case OSCAR_CAPABILITY_GETFILE: - tmp = _("Get File"); - break; - case OSCAR_CAPABILITY_SENDFILE: - tmp = _("Send File"); - break; - case OSCAR_CAPABILITY_GAMES: - case OSCAR_CAPABILITY_GAMES2: - tmp = _("Games"); - break; - case OSCAR_CAPABILITY_ADDINS: - tmp = _("Add-Ins"); - break; - case OSCAR_CAPABILITY_SENDBUDDYLIST: - tmp = _("Send Buddy List"); - break; - case OSCAR_CAPABILITY_ICQ_DIRECT: - tmp = _("ICQ Direct Connect"); - break; - case OSCAR_CAPABILITY_APINFO: - tmp = _("AP User"); - break; - case OSCAR_CAPABILITY_ICQRTF: - tmp = _("ICQ RTF"); - break; - case OSCAR_CAPABILITY_EMPTY: - tmp = _("Nihilist"); - break; - case OSCAR_CAPABILITY_ICQSERVERRELAY: - tmp = _("ICQ Server Relay"); - break; - case OSCAR_CAPABILITY_UNICODEOLD: - tmp = _("Old ICQ UTF8"); - break; - case OSCAR_CAPABILITY_TRILLIANCRYPT: - tmp = _("Trillian Encryption"); - break; - case OSCAR_CAPABILITY_UNICODE: - tmp = _("ICQ UTF8"); - break; - case OSCAR_CAPABILITY_HIPTOP: - tmp = _("Hiptop"); - break; - case OSCAR_CAPABILITY_SECUREIM: - tmp = _("Security Enabled"); - break; - case OSCAR_CAPABILITY_VIDEO: - tmp = _("Video Chat"); - break; - /* Not actually sure about this one... WinAIM doesn't show anything */ - case OSCAR_CAPABILITY_ICHATAV: - tmp = _("iChat AV"); - break; - case OSCAR_CAPABILITY_LIVEVIDEO: - tmp = _("Live Video"); - break; - case OSCAR_CAPABILITY_CAMERA: - tmp = _("Camera"); - break; - case OSCAR_CAPABILITY_ICHAT_SCREENSHARE: - tmp = _("Screen Sharing"); - break; - default: - tmp = NULL; - break; - } - if (tmp) - g_string_append_printf(str, "%s%s", (*(str->str) == '\0' ? "" : ", "), tmp); - } - bit <<= 1; - } - - return g_string_free(str, FALSE); -} - -static char *oscar_icqstatus(int state) { - /* Make a cute little string that shows the status of the dude or dudet */ - if (state & AIM_ICQ_STATE_CHAT) - return g_strdup(_("Free For Chat")); - else if (state & AIM_ICQ_STATE_DND) - return g_strdup(_("Do Not Disturb")); - else if (state & AIM_ICQ_STATE_OUT) - return g_strdup(_("Not Available")); - else if (state & AIM_ICQ_STATE_BUSY) - return g_strdup(_("Occupied")); - else if (state & AIM_ICQ_STATE_AWAY) - return g_strdup(_("Away")); - else if (state & AIM_ICQ_STATE_WEBAWARE) - return g_strdup(_("Web Aware")); - else if (state & AIM_ICQ_STATE_INVISIBLE) - return g_strdup(_("Invisible")); - else - return g_strdup(_("Online")); -} - -static void -oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value) -{ - if (value && value[0]) { - purple_notify_user_info_add_pair(user_info, name, value); - } -} - -static void -oscar_user_info_convert_and_add_pair(PurpleAccount *account, PurpleNotifyUserInfo *user_info, - const char *name, const char *value) -{ - gchar *utf8; - - if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) { - purple_notify_user_info_add_pair(user_info, name, utf8); - g_free(utf8); - } -} - -static void -oscar_user_info_convert_and_add(PurpleAccount *account, PurpleNotifyUserInfo *user_info, - const char *name, const char *value) -{ - gchar *utf8; - - if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, value))) { - purple_notify_user_info_add_pair(user_info, name, utf8); - g_free(utf8); - } -} - -/** - * @brief Append the status information to a user_info struct - * - * The returned information is HTML-ready, appropriately escaped, as all information in a user_info struct should be HTML. - * - * @param gc The PurpleConnection - * @param user_info A PurpleNotifyUserInfo object to which status information will be added - * @param b The PurpleBuddy whose status is desired. This or the aim_userinfo_t (or both) must be passed to oscar_user_info_append_status(). - * @param userinfo The aim_userinfo_t of the buddy whose status is desired. This or the PurpleBuddy (or both) must be passed to oscar_user_info_append_status(). - * @param strip_html_tags If strip_html_tags is TRUE, tags embedded in the status message will be stripped, returning a non-formatted string. The string will still be HTML escaped. - */ -static void oscar_user_info_append_status(PurpleConnection *gc, PurpleNotifyUserInfo *user_info, PurpleBuddy *b, aim_userinfo_t *userinfo, gboolean strip_html_tags) -{ - PurpleAccount *account = purple_connection_get_account(gc); - OscarData *od; - PurplePresence *presence = NULL; - PurpleStatus *status = NULL; - gchar *message = NULL, *itmsurl = NULL, *tmp; - gboolean is_away; - - od = purple_connection_get_protocol_data(gc); - - if (b == NULL && userinfo == NULL) - return; - - if (b == NULL) - b = purple_find_buddy(purple_connection_get_account(gc), userinfo->bn); - else - userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); - - if (b) { - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - } - - /* If we have both b and userinfo we favor userinfo, because if we're - viewing someone's profile then we want the HTML away message, and - the "message" attribute of the status contains only the plaintext - message. */ - if (userinfo) { - if ((userinfo->flags & AIM_FLAG_AWAY) - && userinfo->away_len > 0 - && userinfo->away != NULL - && userinfo->away_encoding != NULL) - { - /* Away message */ - tmp = oscar_encoding_extract(userinfo->away_encoding); - message = oscar_encoding_to_utf8(account, - tmp, userinfo->away, userinfo->away_len); - g_free(tmp); - } else { - /* - * Available message or non-HTML away message (because that's - * all we have right now. - */ - if ((userinfo->status != NULL) && userinfo->status[0] != '\0') { - message = oscar_encoding_to_utf8(account, - userinfo->status_encoding, userinfo->status, - userinfo->status_len); - } -#if defined (_WIN32) || defined (__APPLE__) - if (userinfo->itmsurl && (userinfo->itmsurl[0] != '\0')) - itmsurl = oscar_encoding_to_utf8(account, userinfo->itmsurl_encoding, - userinfo->itmsurl, userinfo->itmsurl_len); -#endif - } - } else { - message = g_strdup(purple_status_get_attr_string(status, "message")); - itmsurl = g_strdup(purple_status_get_attr_string(status, "itmsurl")); - } - - is_away = ((status && !purple_status_is_available(status)) || - (userinfo && (userinfo->flags & AIM_FLAG_AWAY))); - - if (strip_html_tags) { - /* Away messages are HTML, but available messages were originally plain text. - * We therefore need to strip away messages but not available messages if we're asked to remove HTML tags. - */ - /* - * It seems like the above comment no longer applies. All messages need - * to be escaped. - */ - if (message) { - gchar *tmp2; - tmp = purple_markup_strip_html(message); - g_free(message); - tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - message = tmp2; - } - - } else { - if (itmsurl) { - tmp = g_strdup_printf("%s", - itmsurl, message); - g_free(message); - message = tmp; - } - } - g_free(itmsurl); - - if (message) { - tmp = purple_str_sub_away_formatters(message, purple_account_get_username(account)); - g_free(message); - message = tmp; - } - - if (b) { - if (purple_presence_is_online(presence)) { - if (oscar_util_valid_name_icq(purple_buddy_get_name(b)) || is_away || !message || !(*message)) { - /* Append the status name for online ICQ statuses, away AIM statuses, and for all buddies with no message. - * If the status name and the message are the same, only show one. */ - const char *status_name = purple_status_get_name(status); - if (status_name && message && !strcmp(status_name, message)) - status_name = NULL; - - tmp = g_strdup_printf("%s%s%s", - status_name ? status_name : "", - ((status_name && message) && *message) ? ": " : "", - (message && *message) ? message : ""); - g_free(message); - message = tmp; - } - - } else if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, purple_buddy_get_name(b)), - purple_buddy_get_name(b))) - { - /* Note if an offline buddy is not authorized */ - tmp = g_strdup_printf("%s%s%s", - _("Not Authorized"), - (message && *message) ? ": " : "", - (message && *message) ? message : ""); - g_free(message); - message = tmp; - } else { - g_free(message); - message = g_strdup(_("Offline")); - } - } - - purple_notify_user_info_add_pair(user_info, _("Status"), message); - g_free(message); -} - -static void oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *user_info, PurpleBuddy *b, aim_userinfo_t *userinfo) -{ - OscarData *od; - PurpleAccount *account; - PurplePresence *presence = NULL; - PurpleStatus *status = NULL; - PurpleGroup *g = NULL; - struct buddyinfo *bi = NULL; - char *tmp; - const char *bname = NULL, *gname = NULL; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) - return; - - if (userinfo == NULL) - userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); - - if (b == NULL) - b = purple_find_buddy(account, userinfo->bn); - - if (b != NULL) { - bname = purple_buddy_get_name(b); - g = purple_buddy_get_group(b); - gname = purple_group_get_name(g); - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - } - - if (userinfo != NULL) - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->bn)); - - if ((bi != NULL) && (bi->ipaddr != 0)) { - tmp = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", - (bi->ipaddr & 0xff000000) >> 24, - (bi->ipaddr & 0x00ff0000) >> 16, - (bi->ipaddr & 0x0000ff00) >> 8, - (bi->ipaddr & 0x000000ff)); - oscar_user_info_add_pair(user_info, _("IP Address"), tmp); - g_free(tmp); - } - - if ((userinfo != NULL) && (userinfo->warnlevel != 0)) { - tmp = g_strdup_printf("%d", (int)(userinfo->warnlevel/10.0 + .5)); - oscar_user_info_add_pair(user_info, _("Warning Level"), tmp); - g_free(tmp); - } - - if ((b != NULL) && (bname != NULL) && (g != NULL) && (gname != NULL)) { - tmp = aim_ssi_getcomment(od->ssi.local, gname, bname); - if (tmp != NULL) { - char *tmp2 = g_markup_escape_text(tmp, strlen(tmp)); - g_free(tmp); - - oscar_user_info_convert_and_add_pair(account, user_info, _("Buddy Comment"), tmp2); - g_free(tmp2); - } - } -} - -static char *extract_name(const char *name) { - char *tmp, *x; - int i, j; - - if (!name) - return NULL; - - x = strchr(name, '-'); - if (!x) - return NULL; - - x = strchr(x + 1, '-'); - if (!x) - return NULL; - - tmp = g_strdup(++x); - - for (i = 0, j = 0; x[i]; i++) { - char hex[3]; - if (x[i] != '%') { - tmp[j++] = x[i]; - continue; - } - strncpy(hex, x + ++i, 2); - hex[2] = 0; - i++; - tmp[j++] = strtol(hex, NULL, 16); - } - - tmp[j] = 0; - return tmp; -} - -static struct chat_connection * -find_oscar_chat(PurpleConnection *gc, int id) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - GSList *cur; - struct chat_connection *cc; - - for (cur = od->oscar_chats; cur != NULL; cur = cur->next) - { - cc = (struct chat_connection *)cur->data; - if (cc->id == id) - return cc; - } - - return NULL; -} - -static struct chat_connection * -find_oscar_chat_by_conn(PurpleConnection *gc, FlapConnection *conn) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - GSList *cur; - struct chat_connection *cc; - - for (cur = od->oscar_chats; cur != NULL; cur = cur->next) - { - cc = (struct chat_connection *)cur->data; - if (cc->conn == conn) - return cc; - } - - return NULL; -} - -static struct chat_connection * -find_oscar_chat_by_conv(PurpleConnection *gc, PurpleConversation *conv) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - GSList *cur; - struct chat_connection *cc; - - for (cur = od->oscar_chats; cur != NULL; cur = cur->next) - { - cc = (struct chat_connection *)cur->data; - if (cc->conv == conv) - return cc; - } - - return NULL; -} - -void -oscar_chat_destroy(struct chat_connection *cc) -{ - g_free(cc->name); - g_free(cc->show); - g_free(cc); -} - -static void -oscar_chat_kill(PurpleConnection *gc, struct chat_connection *cc) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - /* Notify the conversation window that we've left the chat */ - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(cc->conv))); - - /* Destroy the chat_connection */ - od->oscar_chats = g_slist_remove(od->oscar_chats, cc); - flap_connection_schedule_destroy(cc->conn, OSCAR_DISCONNECT_DONE, NULL); - oscar_chat_destroy(cc); -} - -/** - * This is called from the callback functions for establishing - * a TCP connection with an oscar host if an error occurred. - */ -static void -connection_common_error_cb(FlapConnection *conn, const gchar *error_message) -{ - OscarData *od; - PurpleConnection *gc; - - od = conn->od; - gc = od->gc; - - purple_debug_error("oscar", "unable to connect to FLAP " - "server of type 0x%04hx\n", conn->type); - - if (conn->type == SNAC_FAMILY_AUTH) - { - /* This only happens when connecting with the old-style BUCP login */ - gchar *msg; - msg = g_strdup_printf(_("Unable to connect to authentication server: %s"), - error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - } - else if (conn->type == SNAC_FAMILY_LOCATE) - { - gchar *msg; - msg = g_strdup_printf(_("Unable to connect to BOS server: %s"), - error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - } - else - { - /* Maybe we should call this for BOS connections, too? */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_COULD_NOT_CONNECT, error_message); - } -} - -/** - * This is called from the callback functions for establishing - * a TCP connection with an oscar host. Depending on the type - * of host, we do a few different things here. - */ -static void -connection_common_established_cb(FlapConnection *conn) -{ - OscarData *od; - PurpleConnection *gc; - PurpleAccount *account; - - od = conn->od; - gc = od->gc; - account = purple_connection_get_account(gc); - - purple_debug_info("oscar", "connected to FLAP server of type 0x%04hx\n", - conn->type); - - if (conn->cookie == NULL) - flap_connection_send_version(od, conn); - else - { - if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN)) - { - ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; - ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; - flap_connection_send_version_with_cookie_and_clientinfo(od, - conn, conn->cookielen, conn->cookie, - od->icq ? &icqinfo : &aiminfo, - purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); - } else { - flap_connection_send_version_with_cookie(od, conn, - conn->cookielen, conn->cookie); - } - - - g_free(conn->cookie); - conn->cookie = NULL; - } - - if (conn->type == SNAC_FAMILY_AUTH) - { - /* This only happens when connecting with the old-style BUCP login */ - aim_request_login(od, conn, purple_account_get_username(account)); - purple_debug_info("oscar", "Username sent, waiting for response\n"); - purple_connection_update_progress(gc, _("Username sent"), 1, OSCAR_CONNECT_STEPS); - ck[1] = 0x65; - } - else if (conn->type == SNAC_FAMILY_LOCATE) - { - purple_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); - ck[4] = 0x61; - } - else if (conn->type == SNAC_FAMILY_CHAT) - { - od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data); - conn->new_conn_data = NULL; - } -} - -static void -connection_established_cb(gpointer data, gint source, const gchar *error_message) -{ - FlapConnection *conn; - - conn = data; - - conn->connect_data = NULL; - conn->fd = source; - - if (source < 0) - { - connection_common_error_cb(conn, error_message); - return; - } - - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, flap_connection_recv_cb, conn); - connection_common_established_cb(conn); -} - -static void -ssl_connection_established_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - FlapConnection *conn; - - conn = data; - - purple_ssl_input_add(gsc, flap_connection_recv_cb_ssl, conn); - connection_common_established_cb(conn); -} - -static void -ssl_connection_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - FlapConnection *conn; - - conn = data; - - if (conn->watcher_outgoing) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - } - - /* sslconn frees the connection on error */ - conn->gsc = NULL; - - connection_common_error_cb(conn, purple_ssl_strerror(error)); -} - -static void -flap_connection_established_bos(OscarData *od, FlapConnection *conn) -{ - PurpleConnection *gc = od->gc; - - aim_srv_reqpersonalinfo(od, conn); - - purple_debug_info("oscar", "ssi: requesting rights and list\n"); - aim_ssi_reqrights(od); - aim_ssi_reqdata(od); - if (od->getblisttimer > 0) - purple_timeout_remove(od->getblisttimer); - od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od); - - aim_locate_reqrights(od); - aim_buddylist_reqrights(od, conn); - aim_im_reqparams(od); - aim_bos_reqrights(od, conn); /* TODO: Don't call this with ssi */ - - purple_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); -} - -static void -flap_connection_established_admin(OscarData *od, FlapConnection *conn) -{ - aim_srv_clientready(od, conn); - purple_debug_info("oscar", "connected to admin\n"); - - if (od->chpass) { - purple_debug_info("oscar", "changing password\n"); - aim_admin_changepasswd(od, conn, od->newp, od->oldp); - g_free(od->oldp); - od->oldp = NULL; - g_free(od->newp); - od->newp = NULL; - od->chpass = FALSE; - } - if (od->setnick) { - purple_debug_info("oscar", "formatting username\n"); - aim_admin_setnick(od, conn, od->newformatting); - g_free(od->newformatting); - od->newformatting = NULL; - od->setnick = FALSE; - } - if (od->conf) { - purple_debug_info("oscar", "confirming account\n"); - aim_admin_reqconfirm(od, conn); - od->conf = FALSE; - } - if (od->reqemail) { - purple_debug_info("oscar", "requesting email address\n"); - aim_admin_getinfo(od, conn, 0x0011); - od->reqemail = FALSE; - } - if (od->setemail) { - purple_debug_info("oscar", "setting email address\n"); - aim_admin_setemail(od, conn, od->email); - g_free(od->email); - od->email = NULL; - od->setemail = FALSE; - } -} - -static void -flap_connection_established_chat(OscarData *od, FlapConnection *conn) -{ - PurpleConnection *gc = od->gc; - struct chat_connection *chatcon; - static int id = 1; - - aim_srv_clientready(od, conn); - - chatcon = find_oscar_chat_by_conn(gc, conn); - if (chatcon) { - chatcon->id = id; - chatcon->conv = serv_got_joined_chat(gc, id++, chatcon->show); - } -} - -static void -flap_connection_established_chatnav(OscarData *od, FlapConnection *conn) -{ - aim_srv_clientready(od, conn); - aim_chatnav_reqrights(od, conn); -} - -static void -flap_connection_established_alert(OscarData *od, FlapConnection *conn) -{ - aim_email_sendcookies(od); - aim_email_activate(od); - aim_srv_clientready(od, conn); -} - -static void -flap_connection_established_bart(OscarData *od, FlapConnection *conn) -{ - PurpleConnection *gc = od->gc; - - aim_srv_clientready(od, conn); - - od->iconconnecting = FALSE; - - purple_icons_fetch(gc); -} - -static int -flap_connection_established(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - purple_debug_info("oscar", "FLAP connection of type 0x%04hx is " - "now fully connected\n", conn->type); - if (conn->type == SNAC_FAMILY_LOCATE) - flap_connection_established_bos(od, conn); - else if (conn->type == SNAC_FAMILY_ADMIN) - flap_connection_established_admin(od, conn); - else if (conn->type == SNAC_FAMILY_CHAT) - flap_connection_established_chat(od, conn); - else if (conn->type == SNAC_FAMILY_CHATNAV) - flap_connection_established_chatnav(od, conn); - else if (conn->type == SNAC_FAMILY_ALERT) - flap_connection_established_alert(od, conn); - else if (conn->type == SNAC_FAMILY_BART) - flap_connection_established_bart(od, conn); - - return 1; -} - -static void -idle_reporting_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleConnection *gc; - OscarData *od; - gboolean report_idle; - guint32 presence; - - gc = data; - od = purple_connection_get_protocol_data(gc); - report_idle = strcmp((const char *)value, "none") != 0; - presence = aim_ssi_getpresence(od->ssi.local); - - if (report_idle) - aim_ssi_setpresence(od, presence | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); - else - aim_ssi_setpresence(od, presence & ~AIM_SSI_PRESENCE_FLAG_SHOWIDLE); -} - -/** - * Should probably make a "Use recent buddies group" account preference - * so that this option is surfaced to the user. - */ -static void -recent_buddies_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleConnection *gc; - OscarData *od; - guint32 presence; - - gc = data; - od = purple_connection_get_protocol_data(gc); - presence = aim_ssi_getpresence(od->ssi.local); - - if (value) - aim_ssi_setpresence(od, presence & ~AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES); - else - aim_ssi_setpresence(od, presence | AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES); -} - -void -oscar_login(PurpleAccount *account) -{ - PurpleConnection *gc; - OscarData *od; - - gc = purple_account_get_connection(account); - od = oscar_data_new(); - od->gc = gc; - purple_connection_set_protocol_data(gc, od); - - oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, purple_connerr, 0); - oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, flap_connection_established, 0); - - oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0003, purple_info_change, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0005, purple_info_change, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0007, purple_account_confirm, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, purple_email_parseupdate, 0); - - /* These are only needed when connecting with the old-style BUCP login */ - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0); - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, purple_parse_login, 0); - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0); - - oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, purple_bosrights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_RIGHTSINFO, purple_parse_buddyrights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_ONCOMING, purple_parse_oncoming, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_OFFGOING, purple_parse_offgoing, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERJOIN, purple_conv_chat_join, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERLEAVE, purple_conv_chat_leave, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE, purple_conv_chat_info_update, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_INCOMINGMSG, purple_conv_chat_incoming_msg, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, purple_chatnav_info, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, purple_ssi_parseerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, purple_ssi_parserights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, purple_ssi_parselist, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, purple_ssi_parseack, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, purple_ssi_parseaddmod, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_MOD, purple_ssi_parseaddmod, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, purple_ssi_authgiven, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, purple_ssi_authrequest, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, purple_ssi_authreply, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, purple_ssi_gotadded, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_INCOMING, purple_parse_incoming_im, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MISSEDCALL, purple_parse_misses, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_CLIENTAUTORESP, purple_parse_clientauto, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ERROR, purple_parse_msgerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MTN, purple_parse_mtn, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ACK, purple_parse_msgack, 0); -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG, purple_offlinemsg, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE, purple_offlinemsgdone, 0); -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS, purple_icqalias, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO, purple_icqinfo, 0); - oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_RIGHTSINFO, purple_parse_locaterights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_USERINFO, purple_parse_userinfo, 0); - oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_ERROR, purple_parse_locerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, purple_selfinfo, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, purple_memrequest, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0021, oscar_icon_req,0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_RATECHANGE, purple_parse_ratechange, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, purple_handle_redirect, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, purple_parse_motd, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, purple_parse_evilnotify, 0); - oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, purple_popup, 0); - oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, purple_parse_searcherror, 0); - oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0); - - purple_debug_misc("oscar", "oscar_login: gc = %p\n", gc); - - if (!oscar_util_valid_name(purple_account_get_username(account))) { - gchar *buf; - buf = g_strdup_printf(_("Unable to sign on as %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf); - g_free(buf); - return; - } - - if (oscar_util_valid_name_icq((purple_account_get_username(account)))) { - od->icq = TRUE; - } else { - gc->flags |= PURPLE_CONNECTION_HTML; - gc->flags |= PURPLE_CONNECTION_AUTO_RESP; - } - - od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); - od->use_ssl = purple_account_get_bool(account, "use_ssl", OSCAR_DEFAULT_USE_SSL); - - /* Connect to core Purple signals */ - purple_prefs_connect_callback(gc, "/purple/away/idle_reporting", idle_reporting_pref_cb, gc); - purple_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_pref_cb, gc); - - /* - * On 2008-03-05 AOL released some documentation on the OSCAR protocol - * which includes a new login method called clientLogin. It is similar - * (though not the same?) as what the AIM 6.0 series uses to - * authenticate. - * - * AIM 5.9 and lower use an MD5-based login procedure called "BUCP". - * This authentication method is used for both ICQ and AIM when - * clientLogin is not enabled. - */ - if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN)) { - send_client_login(od, purple_account_get_username(account)); - } else { - FlapConnection *newconn; - const char *server; - - newconn = flap_connection_new(od, SNAC_FAMILY_AUTH); - - if (od->use_ssl) { - if (!purple_ssl_is_supported()) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - return; - } - - server = purple_account_get_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER); - - /* - * If the account's server is what the oscar prpl has offered as - * the default login server through the vast eons (all two of - * said default options, AFAIK) and the user wants SSL, we'll - * do what we know is best for them and change the setting out - * from under them to the SSL login server. - */ - if (!strcmp(server, OSCAR_DEFAULT_LOGIN_SERVER) || !strcmp(server, OSCAR_OLD_LOGIN_SERVER)) { - purple_debug_info("oscar", "Account uses SSL, so changing server to default SSL server\n"); - purple_account_set_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER); - server = OSCAR_DEFAULT_SSL_LOGIN_SERVER; - } - - newconn->gsc = purple_ssl_connect(account, server, - purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), - ssl_connection_established_cb, ssl_connection_error_cb, newconn); - } else { - server = purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER); - - /* - * See the comment above. We do the reverse here. If they don't want - * SSL but their server is set to OSCAR_DEFAULT_SSL_LOGIN_SERVER, - * set it back to the default. - */ - if (!strcmp(server, OSCAR_DEFAULT_SSL_LOGIN_SERVER)) { - purple_debug_info("oscar", "Account does not use SSL, so changing server back to non-SSL\n"); - purple_account_set_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER); - server = OSCAR_DEFAULT_LOGIN_SERVER; - } - - newconn->connect_data = purple_proxy_connect(NULL, account, server, - purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), - connection_established_cb, newconn); - } - - if (newconn->gsc == NULL && newconn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - } - - purple_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); - ck[0] = 0x5a; -} - -void -oscar_close(PurpleConnection *gc) -{ - OscarData *od; - - od = purple_connection_get_protocol_data(gc); - - while (od->oscar_chats) - { - struct chat_connection *cc = od->oscar_chats->data; - od->oscar_chats = g_slist_remove(od->oscar_chats, cc); - oscar_chat_destroy(cc); - } - while (od->create_rooms) - { - struct create_room *cr = od->create_rooms->data; - g_free(cr->name); - od->create_rooms = g_slist_remove(od->create_rooms, cr); - g_free(cr); - } - oscar_data_destroy(od); - purple_connection_set_protocol_data(gc, NULL); - - purple_prefs_disconnect_by_handle(gc); - - purple_debug_info("oscar", "Signed off.\n"); -} - -/* XXX - Should use purple_util_fetch_url for the below stuff */ -struct pieceofcrap { - PurpleConnection *gc; - unsigned long offset; - unsigned long len; - char *modname; - int fd; - FlapConnection *conn; - unsigned int inpa; -}; - -static void damn_you(gpointer data, gint source, PurpleInputCondition c) -{ - struct pieceofcrap *pos = data; - OscarData *od = purple_connection_get_protocol_data(pos->gc); - char in = '\0'; - int x = 0; - unsigned char m[17]; - GString *msg; - - while (read(pos->fd, &in, 1) == 1) { - if (in == '\n') - x++; - else if (in != '\r') - x = 0; - if (x == 2) - break; - in = '\0'; - } - if (in != '\n') { - char buf[256]; - g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. " - "If so, check %s for updates."), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_notify_warning(pos->gc, NULL, - _("Unable to get a valid AIM login hash."), - buf); - purple_input_remove(pos->inpa); - close(pos->fd); - g_free(pos); - return; - } - if (read(pos->fd, m, 16) != 16) - { - purple_debug_warning("oscar", "Could not read full AIM login hash " - "from " AIMHASHDATA "--that's bad.\n"); - } - m[16] = '\0'; - - msg = g_string_new("Sending hash: "); - for (x = 0; x < 16; x++) - g_string_append_printf(msg, "%02hhx ", (unsigned char)m[x]); - g_string_append(msg, "\n"); - purple_debug_misc("oscar", "%s", msg->str); - g_string_free(msg, TRUE); - - purple_input_remove(pos->inpa); - close(pos->fd); - aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); - g_free(pos); -} - -static void -straight_to_hell(gpointer data, gint source, const gchar *error_message) -{ - struct pieceofcrap *pos = data; - gchar *buf; - gssize result; - - pos->fd = source; - - if (source < 0) { - buf = g_strdup_printf(_("You may be disconnected shortly. " - "If so, check %s for updates."), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_notify_warning(pos->gc, NULL, - _("Unable to get a valid AIM login hash."), - buf); - g_free(buf); - g_free(pos->modname); - g_free(pos); - return; - } - - buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", - pos->offset, pos->len, pos->modname ? pos->modname : ""); - result = send(pos->fd, buf, strlen(buf), 0); - if (result != strlen(buf)) { - if (result < 0) - purple_debug_error("oscar", "Error writing %" G_GSIZE_FORMAT - " bytes to fetch AIM hash data: %s\n", - strlen(buf), g_strerror(errno)); - else - purple_debug_error("oscar", "Tried to write %" - G_GSIZE_FORMAT " bytes to fetch AIM hash data but " - "instead wrote %" G_GSSIZE_FORMAT " bytes\n", - strlen(buf), result); - } - g_free(buf); - g_free(pos->modname); - pos->inpa = purple_input_add(pos->fd, PURPLE_INPUT_READ, damn_you, pos); - return; -} - -/* size of icbmui.ocm, the largest module in AIM 3.5 */ -#define AIM_MAX_FILE_SIZE 98304 - -static int purple_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - va_list ap; - struct pieceofcrap *pos; - guint32 offset, len; - char *modname; - - va_start(ap, fr); - offset = va_arg(ap, guint32); - len = va_arg(ap, guint32); - modname = va_arg(ap, char *); - va_end(ap); - - purple_debug_misc("oscar", "offset: %u, len: %u, file: %s\n", - offset, len, (modname ? modname : "aim.exe")); - - if (len == 0) { - purple_debug_misc("oscar", "len is 0, hashing NULL\n"); - aim_sendmemblock(od, conn, offset, len, NULL, - AIM_SENDMEMBLOCK_FLAG_ISREQUEST); - return 1; - } - /* uncomment this when you're convinced it's right. remember, it's been wrong before. */ -#if 0 - if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { - char *buf; - int i = 8; - if (modname) - i += strlen(modname); - buf = g_malloc(i); - i = 0; - if (modname) { - memcpy(buf, modname, strlen(modname)); - i += strlen(modname); - } - buf[i++] = offset & 0xff; - buf[i++] = (offset >> 8) & 0xff; - buf[i++] = (offset >> 16) & 0xff; - buf[i++] = (offset >> 24) & 0xff; - buf[i++] = len & 0xff; - buf[i++] = (len >> 8) & 0xff; - buf[i++] = (len >> 16) & 0xff; - buf[i++] = (len >> 24) & 0xff; - purple_debug_misc("oscar", "len + offset is invalid, " - "hashing request\n"); - aim_sendmemblock(od, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); - g_free(buf); - return 1; - } -#endif - - pos = g_new0(struct pieceofcrap, 1); - pos->gc = od->gc; - pos->conn = conn; - - pos->offset = offset; - pos->len = len; - pos->modname = g_strdup(modname); - - if (purple_proxy_connect(pos->gc, pos->gc->account, "pidgin.im", 80, - straight_to_hell, pos) == NULL) - { - char buf[256]; - g_free(pos->modname); - g_free(pos); - - g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. " - "If so, check %s for updates."), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_notify_warning(pos->gc, NULL, - _("Unable to get a valid login hash."), - buf); - } - - return 1; -} - -int oscar_connect_to_bos(PurpleConnection *gc, OscarData *od, const char *host, guint16 port, guint8 *cookie, guint16 cookielen, const char *tls_certname) -{ - PurpleAccount *account; - FlapConnection *conn; - - account = purple_connection_get_account(gc); - - conn = flap_connection_new(od, SNAC_FAMILY_LOCATE); - conn->cookielen = cookielen; - conn->cookie = g_memdup(cookie, cookielen); - - /* - * tls_certname is only set (and must be set if we get this far) if - * SSL is enabled. - */ - if (tls_certname) - { - conn->gsc = purple_ssl_connect_with_ssl_cn(account, host, port, - ssl_connection_established_cb, ssl_connection_error_cb, - tls_certname, conn); - } - else - { - conn->connect_data = purple_proxy_connect(NULL, - account, host, port, - connection_established_cb, conn); - } - - if (conn->gsc == NULL && conn->connect_data == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - return 0; - } - - od->default_port = port; - - purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); - ck[3] = 0x64; - - return 1; -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char *host; int port; - int i; - FlapConnection *newconn; - va_list ap; - struct aim_authresp_info *info; - - port = purple_account_get_int(account, "port", od->default_port); - - va_start(ap, fr); - info = va_arg(ap, struct aim_authresp_info *); - va_end(ap); - - purple_debug_info("oscar", - "inside auth_resp (Username: %s)\n", info->bn); - - if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { - char buf[256]; - switch (info->errorcode) { - case 0x01: - /* Unregistered username */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_USERNAME, _("Username does not exist")); - break; - case 0x05: - /* Incorrect password */ - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); - break; - case 0x11: - /* Suspended account */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Your account is currently suspended")); - break; - case 0x02: - case 0x14: - /* service temporarily unavailable */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); - break; - case 0x18: - /* username connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your username has been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); - break; - case 0x1c: - { - /* client too old */ - g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, buf); - break; - } - case 0x1d: - /* IP address connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your IP address has been connecting and disconnecting too frequently. Wait a minute and try again. If you continue to try, you will need to wait even longer.")); - break; - default: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Unknown reason")); - break; - } - purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); - purple_debug_info("oscar", "Error URL: %s\n", info->errorurl ? info->errorurl : ""); - return 1; - } - - purple_debug_misc("oscar", "Reg status: %hu\n" - "Email: %s\n" - "BOSIP: %s\n", - info->regstatus, - info->email ? info->email : "null", - info->bosip ? info->bosip : "null"); - purple_debug_info("oscar", "Closing auth connection...\n"); - flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_DONE, NULL); - - for (i = 0; i < strlen(info->bosip); i++) { - if (info->bosip[i] == ':') { - port = atoi(&(info->bosip[i+1])); - break; - } - } - host = g_strndup(info->bosip, i); - newconn = flap_connection_new(od, SNAC_FAMILY_LOCATE); - newconn->cookielen = info->cookielen; - newconn->cookie = g_memdup(info->cookie, info->cookielen); - - if (od->use_ssl) - { - /* - * This shouldn't be hardcoded to "bos.oscar.aol.com" except that - * the server isn't sending us a name to use for comparing the - * certificate common name. - */ - newconn->gsc = purple_ssl_connect_with_ssl_cn(account, host, port, - ssl_connection_established_cb, ssl_connection_error_cb, - "bos.oscar.aol.com", newconn); - } - else - { - newconn->connect_data = purple_proxy_connect(NULL, account, host, port, - connection_established_cb, newconn); - } - - g_free(host); - if (newconn->gsc == NULL && newconn->connect_data == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - return 0; - } - - purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); - ck[3] = 0x64; - - return 1; -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static void -purple_parse_auth_securid_request_yes_cb(gpointer user_data, const char *msg) -{ - PurpleConnection *gc = user_data; - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_auth_securid_send(od, msg); -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static void -purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value) -{ - PurpleConnection *gc = user_data; - - /* Disconnect */ - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("The SecurID key entered is invalid")); -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - gchar *primary; - - purple_debug_info("oscar", "Got SecurID request\n"); - - primary = g_strdup_printf("Enter the SecurID key for %s.", purple_account_get_username(account)); - purple_request_input(gc, NULL, _("Enter SecurID"), primary, - _("Enter the 6 digit number from the digital display."), - FALSE, FALSE, NULL, - _("_OK"), G_CALLBACK(purple_parse_auth_securid_request_yes_cb), - _("_Cancel"), G_CALLBACK(purple_parse_auth_securid_request_no_cb), - account, NULL, NULL, - gc); - g_free(primary); - - return 1; -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; - ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; - va_list ap; - char *key; - gboolean truncate_pass; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - key = va_arg(ap, char *); - truncate_pass = va_arg(ap, int); - va_end(ap); - - aim_send_login(od, conn, purple_account_get_username(account), - purple_connection_get_password(gc), truncate_pass, - od->icq ? &icqinfo : &aiminfo, key, - purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); - - purple_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); - ck[2] = 0x6c; - - return 1; -} - -static int -purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char *host, *separator; - int port; - FlapConnection *newconn; - va_list ap; - struct aim_redirect_data *redir; - - va_start(ap, fr); - redir = va_arg(ap, struct aim_redirect_data *); - va_end(ap); - - port = od->default_port; - separator = strchr(redir->ip, ':'); - if (separator != NULL) - { - host = g_strndup(redir->ip, separator - redir->ip); - port = atoi(separator + 1); - } - else - host = g_strdup(redir->ip); - - /* - * These FLAP servers advertise SSL (type "0x02"), but SSL connections to these hosts - * die a painful death. iChat and Miranda, when using SSL, still do these in plaintext. - */ - if (redir->use_ssl && (redir->group == SNAC_FAMILY_ADMIN || - redir->group == SNAC_FAMILY_BART)) - { - purple_debug_info("oscar", "Ignoring broken SSL for FLAP type 0x%04hx.\n", - redir->group); - redir->use_ssl = 0; - } - - purple_debug_info("oscar", "Connecting to FLAP server %s:%d of type 0x%04hx%s\n", - host, port, redir->group, - od->use_ssl && !redir->use_ssl ? " without SSL, despite main stream encryption" : ""); - - newconn = flap_connection_new(od, redir->group); - newconn->cookielen = redir->cookielen; - newconn->cookie = g_memdup(redir->cookie, redir->cookielen); - if (newconn->type == SNAC_FAMILY_CHAT) - { - struct chat_connection *cc; - cc = g_new0(struct chat_connection, 1); - cc->conn = newconn; - cc->gc = gc; - cc->name = g_strdup(redir->chat.room); - cc->exchange = redir->chat.exchange; - cc->instance = redir->chat.instance; - cc->show = extract_name(redir->chat.room); - newconn->new_conn_data = cc; - purple_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange); - } - - - if (redir->use_ssl) - { - newconn->gsc = purple_ssl_connect_with_ssl_cn(account, host, port, - ssl_connection_established_cb, ssl_connection_error_cb, - redir->ssl_cert_cn, newconn); - } - else - { - newconn->connect_data = purple_proxy_connect(NULL, account, host, port, - connection_established_cb, newconn); - } - - if (newconn->gsc == NULL && newconn->connect_data == NULL) - { - flap_connection_schedule_destroy(newconn, - OSCAR_DISCONNECT_COULD_NOT_CONNECT, - _("Unable to initialize connection")); - purple_debug_error("oscar", "Unable to connect to FLAP server " - "of type 0x%04hx\n", redir->group); - } - g_free(host); - - return 1; -} - - -static int purple_parse_oncoming(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - struct buddyinfo *bi; - time_t time_idle = 0, signon = 0; - int type = 0; - gboolean buddy_is_away = FALSE; - const char *status_id; - va_list ap; - aim_userinfo_t *info; - char *message = NULL; - char *itmsurl = NULL; - char *tmp; - const char *tmp2; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - g_return_val_if_fail(info != NULL, 1); - g_return_val_if_fail(info->bn != NULL, 1); - - /* - * If this is an AIM buddy and their name has formatting, set their - * server alias. - */ - if (!oscar_util_valid_name_icq(info->bn)) { - gboolean bn_has_formatting = FALSE; - char *c; - for (c = info->bn; *c != '\0'; c++) { - if (!islower(*c)) { - bn_has_formatting = TRUE; - break; - } - } - serv_got_alias(gc, info->bn, - bn_has_formatting ? info->bn : NULL); - } - - if (info->present & AIM_USERINFO_PRESENT_FLAGS) { - if (info->flags & AIM_FLAG_AWAY) - buddy_is_away = TRUE; - } - if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { - type = info->icqinfo.status; - if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && - (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { - buddy_is_away = TRUE; - } - } - - if (oscar_util_valid_name_icq(info->bn)) { - if (type & AIM_ICQ_STATE_CHAT) - status_id = OSCAR_STATUS_ID_FREE4CHAT; - else if (type & AIM_ICQ_STATE_DND) - status_id = OSCAR_STATUS_ID_DND; - else if (type & AIM_ICQ_STATE_OUT) - status_id = OSCAR_STATUS_ID_NA; - else if (type & AIM_ICQ_STATE_BUSY) - status_id = OSCAR_STATUS_ID_OCCUPIED; - else if (type & AIM_ICQ_STATE_AWAY) - status_id = OSCAR_STATUS_ID_AWAY; - else if (type & AIM_ICQ_STATE_INVISIBLE) - status_id = OSCAR_STATUS_ID_INVISIBLE; - else - status_id = OSCAR_STATUS_ID_AVAILABLE; - } else { - if (type & AIM_ICQ_STATE_INVISIBLE) - status_id = OSCAR_STATUS_ID_INVISIBLE; - else if (buddy_is_away) - status_id = OSCAR_STATUS_ID_AWAY; - else - status_id = OSCAR_STATUS_ID_AVAILABLE; - } - - if (info->flags & AIM_FLAG_WIRELESS) - { - purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_MOBILE, NULL); - } else { - purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); - } - - if (info->status != NULL && info->status[0] != '\0') - /* Grab the available message */ - message = oscar_encoding_to_utf8(account, info->status_encoding, - info->status, info->status_len); - - tmp2 = tmp = (message ? purple_markup_escape_text(message, -1) : NULL); - - if (strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) == 0) { - if (info->itmsurl_encoding && info->itmsurl && info->itmsurl_len) - /* Grab the iTunes Music Store URL */ - itmsurl = oscar_encoding_to_utf8(account, info->itmsurl_encoding, - info->itmsurl, info->itmsurl_len); - - if (tmp2 == NULL && itmsurl != NULL) - /* - * The message can't be NULL because NULL means it was the - * last attribute, so the itmsurl would get ignored below. - */ - tmp2 = ""; - - purple_prpl_got_user_status(account, info->bn, status_id, - "message", tmp2, "itmsurl", itmsurl, NULL); - } - else - purple_prpl_got_user_status(account, info->bn, status_id, "message", tmp2, NULL); - - g_free(tmp); - - g_free(message); - g_free(itmsurl); - - /* Login time stuff */ - if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) - signon = info->onlinesince; - else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) - signon = time(NULL) - info->sessionlen; - purple_prpl_got_user_login_time(account, info->bn, signon); - - /* Idle time stuff */ - /* info->idletime is the number of minutes that this user has been idle */ - if (info->present & AIM_USERINFO_PRESENT_IDLE) - time_idle = time(NULL) - info->idletime * 60; - - if (time_idle > 0) - purple_prpl_got_user_idle(account, info->bn, TRUE, time_idle); - else - purple_prpl_got_user_idle(account, info->bn, FALSE, 0); - - /* Server stored icon stuff */ - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, info->bn)); - if (!bi) { - bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, info->bn)), bi); - } - bi->typingnot = FALSE; - bi->ico_informed = FALSE; - bi->ipaddr = info->icqinfo.ipaddr; - - if (info->iconcsumlen) { - const char *saved_b16 = NULL; - char *b16 = NULL; - PurpleBuddy *b = NULL; - - b16 = purple_base16_encode(info->iconcsum, info->iconcsumlen); - b = purple_find_buddy(account, info->bn); - if (b != NULL) - saved_b16 = purple_buddy_icons_get_checksum_for_user(b); - - if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { - /* Invalidate the old icon for this user */ - purple_buddy_icons_set_for_user(account, info->bn, NULL, 0, NULL); - - /* Fetch the new icon (if we're not already doing so) */ - if (g_slist_find_custom(od->requesticon, info->bn, - (GCompareFunc)oscar_util_name_compare) == NULL) - { - od->requesticon = g_slist_prepend(od->requesticon, - g_strdup(purple_normalize(account, info->bn))); - purple_icons_fetch(gc); - } - } - g_free(b16); - } - - return 1; -} - -static void purple_check_comment(OscarData *od, const char *str) { - if ((str == NULL) || strcmp(str, (const char *)ck)) - aim_locate_setcaps(od, purple_caps); - else - aim_locate_setcaps(od, purple_caps | OSCAR_CAPABILITY_SECUREIM); -} - -static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - va_list ap; - aim_userinfo_t *info; - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_OFFLINE, NULL); - purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); - g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->bn)); - - return 1; -} - -static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleMessageFlags flags = 0; - struct buddyinfo *bi; - PurpleStoredImage *img; - GString *message; - gchar *tmp; - aim_mpmsg_section_t *curpart; - const char *start, *end; - GData *attribs; - - purple_debug_misc("oscar", "Received IM from %s with %d parts\n", - userinfo->bn, args->mpmsg.numparts); - - if (args->mpmsg.numparts == 0) - return 1; - - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->bn)); - if (!bi) { - bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, userinfo->bn)), bi); - } - - if (args->icbmflags & AIM_IMFLAGS_AWAY) - flags |= PURPLE_MESSAGE_AUTO_RESP; - - if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) - bi->typingnot = TRUE; - else - bi->typingnot = FALSE; - - if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { - purple_debug_misc("oscar", "%s has an icon\n", userinfo->bn); - if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { - bi->ico_need = TRUE; - bi->ico_len = args->iconlen; - bi->ico_csum = args->iconsum; - bi->ico_time = args->iconstamp; - } - } - - img = purple_buddy_icons_find_account_icon(account); - if ((img != NULL) && - (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { - gconstpointer data = purple_imgstore_get_data(img); - size_t len = purple_imgstore_get_size(img); - purple_debug_info("oscar", - "Sending buddy icon to %s (%" G_GSIZE_FORMAT " bytes)\n", - userinfo->bn, len); - aim_im_sendch2_icon(od, userinfo->bn, data, len, - purple_buddy_icons_get_account_icon_timestamp(account), - aimutil_iconsum(data, len)); - } - purple_imgstore_unref(img); - - message = g_string_new(""); - curpart = args->mpmsg.parts; - while (curpart != NULL) { - tmp = purple_plugin_oscar_decode_im_part(account, userinfo->bn, curpart->charset, - curpart->charsubset, curpart->data, curpart->datalen); - if (tmp != NULL) { - g_string_append(message, tmp); - g_free(tmp); - } - - curpart = curpart->next; - } - tmp = g_string_free(message, FALSE); - - /* - * If the message is from an ICQ user and to an ICQ user then escape any HTML, - * because HTML is not sent over ICQ as a means to format a message. - * So any HTML we receive is intended to be displayed. Also, \r\n must be - * replaced with
- * - * Note: There *may* be some clients which send messages as HTML formatted - - * they need to be special-cased somehow. - */ - if (oscar_util_valid_name_icq(purple_account_get_username(account)) && oscar_util_valid_name_icq(userinfo->bn)) { - /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */ - gchar *tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - tmp = tmp2; - tmp2 = purple_strreplace(tmp, "\r\n", "
"); - g_free(tmp); - tmp = tmp2; - } - - /* - * Convert iChat color tags to normal font tags. - */ - if (purple_markup_find_tag("body", tmp, &start, &end, &attribs)) - { - int len; - char *tmp2, *body; - const char *ichattextcolor, *ichatballooncolor; - const char *slash_body_start, *slash_body_end = NULL; /* */ - GData *unused; - - /* - * Find the ending so we can strip off the outer - * and - */ - if (purple_markup_find_tag("/body", end + 1, &slash_body_start, &slash_body_end, &unused)) - { - body = g_strndup(start, slash_body_end - start + 1); - g_datalist_clear(&unused); - } - else - { - purple_debug_warning("oscar", "Broken message contains but not !\n"); - /* Take everything after */ - body = g_strdup(start); - } - - ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor"); - if (ichattextcolor != NULL) - { - tmp2 = g_strdup_printf("%s", ichattextcolor, body); - g_free(body); - body = tmp2; - } - - ichatballooncolor = g_datalist_get_data(&attribs, "ichatballooncolor"); - if (ichatballooncolor != NULL) - { - tmp2 = g_strdup_printf("%s", ichatballooncolor, body); - g_free(body); - body = tmp2; - } - - g_datalist_clear(&attribs); - - len = start - tmp; - tmp2 = g_strdup_printf("%.*s%s%s", len, tmp, body, slash_body_end ? slash_body_end + 1: ""); - g_free(tmp); - g_free(body); - - tmp = tmp2; - } - - /* - * Are there surrounding tags? If so, strip them out, too. - */ - if (purple_markup_find_tag("html", tmp, &start, &end, &attribs)) - { - gchar *tmp2; - int len; - - g_datalist_clear(&attribs); - - len = start - tmp; - tmp2 = g_strdup_printf("%.*s%s", len, tmp, end + 1); - g_free(tmp); - tmp = tmp2; - } - - if (purple_markup_find_tag("/html", tmp, &start, &end, &attribs)) - { - gchar *tmp2; - int len; - - g_datalist_clear(&attribs); - - len = start - tmp; - tmp2 = g_strdup_printf("%.*s%s", len, tmp, end + 1); - g_free(tmp); - tmp = tmp2; - } - - serv_got_im(gc, userinfo->bn, tmp, flags, - (args->icbmflags & AIM_IMFLAGS_OFFLINE) ? args->timestamp : time(NULL)); - g_free(tmp); - - return 1; -} - -static int -incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args) -{ - PurpleConnection *gc; - PurpleAccount *account; - char *message = NULL; - - g_return_val_if_fail(od != NULL, 0); - g_return_val_if_fail(od->gc != NULL, 0); - - gc = od->gc; - account = purple_connection_get_account(gc); - od = purple_connection_get_protocol_data(gc); - - if (args == NULL) - return 0; - - purple_debug_misc("oscar", "Incoming rendezvous message of type %u, " - "user %s, status %hu\n", args->type, userinfo->bn, args->status); - - if (args->msg != NULL) - { - if (args->encoding != NULL) - { - char *encoding = NULL; - encoding = oscar_encoding_extract(args->encoding); - message = oscar_encoding_to_utf8(account, encoding, args->msg, - args->msglen); - g_free(encoding); - } else { - if (g_utf8_validate(args->msg, args->msglen, NULL)) - message = g_strdup(args->msg); - } - } - - if (args->type & OSCAR_CAPABILITY_CHAT) - { - char *encoding, *utf8name, *tmp; - GHashTable *components; - - if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange) { - g_free(message); - return 1; - } - encoding = args->encoding ? oscar_encoding_extract(args->encoding) : NULL; - utf8name = oscar_encoding_to_utf8(account, encoding, - args->info.chat.roominfo.name, - args->info.chat.roominfo.namelen); - g_free(encoding); - - tmp = extract_name(utf8name); - if (tmp != NULL) - { - g_free(utf8name); - utf8name = tmp; - } - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - g_free); - g_hash_table_replace(components, g_strdup("room"), utf8name); - g_hash_table_replace(components, g_strdup("exchange"), - g_strdup_printf("%d", args->info.chat.roominfo.exchange)); - serv_got_chat_invite(gc, - utf8name, - userinfo->bn, - message, - components); - } - - else if ((args->type & OSCAR_CAPABILITY_SENDFILE) || - (args->type & OSCAR_CAPABILITY_DIRECTIM)) - { - if (args->status == AIM_RENDEZVOUS_PROPOSE) - { - peer_connection_got_proposition(od, userinfo->bn, message, args); - } - else if (args->status == AIM_RENDEZVOUS_CANCEL) - { - /* The other user canceled a peer request */ - PeerConnection *conn; - - conn = peer_connection_find_by_cookie(od, userinfo->bn, args->cookie); - /* - * If conn is NULL it means we haven't tried to create - * a connection with that user. They may be trying to - * do something malicious. - */ - if (conn != NULL) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - } - } - else if (args->status == AIM_RENDEZVOUS_CONNECTED) - { - /* - * Remote user has accepted our peer request. If we - * wanted to we could look up the PeerConnection using - * args->cookie, but we don't need to do anything here. - */ - } - } - - else if (args->type & OSCAR_CAPABILITY_GETFILE) - { - } - - else if (args->type & OSCAR_CAPABILITY_TALK) - { - } - - else if (args->type & OSCAR_CAPABILITY_BUDDYICON) - { - purple_buddy_icons_set_for_user(account, userinfo->bn, - g_memdup(args->info.icon.icon, args->info.icon.length), - args->info.icon.length, - NULL); - } - - else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY) - { - purple_debug_error("oscar", "Got an ICQ Server Relay message of " - "type %d\n", args->info.rtfmsg.msgtype); - } - - else - { - purple_debug_error("oscar", "Unknown request class %hu\n", - args->type); - } - - g_free(message); - - return 1; -} - -/* - * Authorization Functions - * Most of these are callbacks from dialogs. They're used by both - * methods of authorization (SSI and old-school channel 4 ICBM) - */ -/* When you ask other people for authorization */ -static void -purple_auth_request(struct name_data *data, char *msg) -{ - PurpleConnection *gc; - OscarData *od; - PurpleAccount *account; - PurpleBuddy *buddy; - PurpleGroup *group; - const char *bname, *gname; - - gc = data->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - buddy = purple_find_buddy(account, data->name); - if (buddy != NULL) - group = purple_buddy_get_group(buddy); - else - group = NULL; - - if (group != NULL) - { - bname = purple_buddy_get_name(buddy); - gname = purple_group_get_name(group); - purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", - bname, gname); - aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); - if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) - { - aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); - - /* Mobile users should always be online */ - if (bname[0] == '+') { - purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_MOBILE, NULL); - } - } - } - - oscar_free_name_data(data); -} - -static void -purple_auth_sendrequest(PurpleConnection *gc, const char *name) -{ - struct name_data *data; - - data = g_new0(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(name); - - purple_request_input(data->gc, NULL, _("Authorization Request Message:"), - NULL, _("Please authorize me!"), TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(purple_auth_request), - _("_Cancel"), G_CALLBACK(oscar_free_name_data), - purple_connection_get_account(gc), name, NULL, - data); -} - -static void -purple_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - purple_auth_sendrequest(gc, purple_buddy_get_name(buddy)); -} - -/* When other people ask you for authorization */ -static void -purple_auth_grant(gpointer cbdata) -{ - struct name_data *data = cbdata; - PurpleConnection *gc = data->gc; - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_ssi_sendauthreply(od, data->name, 0x01, NULL); - - oscar_free_name_data(data); -} - -/* When other people ask you for authorization */ -static void -purple_auth_dontgrant(struct name_data *data, char *msg) -{ - PurpleConnection *gc = data->gc; - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given.")); -} - -static void -purple_auth_dontgrant_msgprompt(gpointer cbdata) -{ - struct name_data *data = cbdata; - purple_request_input(data->gc, NULL, _("Authorization Denied Message:"), - NULL, _("No reason given."), TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(purple_auth_dontgrant), - _("_Cancel"), G_CALLBACK(oscar_free_name_data), - purple_connection_get_account(data->gc), data->name, NULL, - data); -} - -/* When someone sends you buddies */ -static void -purple_icq_buddyadd(struct name_data *data) -{ - PurpleConnection *gc = data->gc; - - purple_blist_request_add_buddy(purple_connection_get_account(gc), data->name, NULL, data->nick); - - oscar_free_name_data(data); -} - -static int -incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - gchar **msg1, **msg2; - int i, numtoks; - - if (!args->type || !args->msg || !args->uin) - return 1; - - purple_debug_info("oscar", - "Received a channel 4 message of type 0x%02hx.\n", - args->type); - - /* - * Split up the message at the delimeter character, then convert each - * string to UTF-8. Unless, of course, this is a type 1 message. If - * this is a type 1 message, then the delimiter 0xfe could be a valid - * character in whatever encoding the message was sent in. Type 1 - * messages are always made up of only one part, so we can easily account - * for this suck-ass part of the protocol by splitting the string into at - * most 1 baby string. - */ - msg1 = g_strsplit(args->msg, "\376", (args->type == 0x01 ? 1 : 0)); - for (numtoks=0; msg1[numtoks]; numtoks++); - msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); - for (i=0; msg1[i]; i++) { - gchar *uin = g_strdup_printf("%u", args->uin); - - purple_str_strip_char(msg1[i], '\r'); - /* TODO: Should use an encoding other than ASCII? */ - msg2[i] = purple_plugin_oscar_decode_im_part(account, uin, AIM_CHARSET_ASCII, 0x0000, msg1[i], strlen(msg1[i])); - g_free(uin); - } - msg2[i] = NULL; - - switch (args->type) { - case 0x01: { /* MacICQ message or basic offline message */ - if (i >= 1) { - gchar *uin = g_strdup_printf("%u", args->uin); - gchar *tmp; - - /* If the message came from an ICQ user then escape any HTML */ - tmp = g_markup_escape_text(msg2[0], -1); - - if (t) { /* This is an offline message */ - /* The timestamp is UTC-ish, so we need to get the offset */ -#ifdef HAVE_TM_GMTOFF - time_t now; - struct tm *tm; - now = time(NULL); - tm = localtime(&now); - t += tm->tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); - t -= timezone; -# endif -#endif - serv_got_im(gc, uin, tmp, 0, t); - } else { /* This is a message from MacICQ/Miranda */ - serv_got_im(gc, uin, tmp, 0, time(NULL)); - } - g_free(uin); - g_free(tmp); - } - } break; - - case 0x04: { /* Someone sent you a URL */ - if (i >= 2) { - if (msg2[1] != NULL) { - gchar *uin = g_strdup_printf("%u", args->uin); - gchar *message = g_strdup_printf("%s", - msg2[1], - (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); - serv_got_im(gc, uin, message, 0, time(NULL)); - g_free(uin); - g_free(message); - } - } - } break; - - case 0x06: { /* Someone requested authorization */ - if (i >= 6) { - struct name_data *data = g_new(struct name_data, 1); - gchar *bn = g_strdup_printf("%u", args->uin); - gchar *reason = NULL; - - if (msg2[5] != NULL) - reason = purple_plugin_oscar_decode_im_part(account, bn, AIM_CHARSET_LATIN_1, 0x0000, msg2[5], strlen(msg2[5])); - - purple_debug_info("oscar", - "Received an authorization request from UIN %u\n", - args->uin); - data->gc = gc; - data->name = bn; - data->nick = NULL; - - purple_account_request_authorization(account, bn, NULL, NULL, - reason, purple_find_buddy(account, bn) != NULL, - purple_auth_grant, - purple_auth_dontgrant_msgprompt, data); - g_free(reason); - } - } break; - - case 0x07: { /* Someone has denied you authorization */ - if (i >= 1) { - gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); - purple_notify_info(gc, NULL, _("ICQ authorization denied."), - dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x08: { /* Someone has granted you authorization */ - gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin); - purple_notify_info(gc, NULL, "ICQ authorization accepted.", - dialog_msg); - g_free(dialog_msg); - } break; - - case 0x09: { /* Message from the Godly ICQ server itself, I think */ - if (i >= 5) { - gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); - purple_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ - if (i >= 6) { - gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); - purple_notify_info(gc, NULL, "ICQ Page", dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ - if (i >= 6) { - gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]); - purple_notify_info(gc, NULL, "ICQ Email", dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x12: { - /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ - /* Someone added you to their buddy list? */ - } break; - - case 0x13: { /* Someone has sent you some ICQ buddies */ - guint i, num; - gchar **text; - text = g_strsplit(args->msg, "\376", 0); - if (text) { - /* Read the number of contacts that we were sent */ - errno = 0; - num = text[0] ? strtoul(text[0], NULL, 10) : 0; - - if (num > 0 && errno == 0) { - for (i=0; imsg, NULL); - purple_debug_error("oscar", "Unknown syntax parsing " - "ICQ buddies. args->msg=%s\n", tmp); - g_free(tmp); - break; - } - - message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); - - data = g_new(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(text[i*2+1]); - data->nick = g_strdup(text[i*2+2]); - - purple_request_action(gc, NULL, message, - _("Do you want to add this buddy " - "to your buddy list?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), data->name, NULL, - data, 2, - _("_Add"), G_CALLBACK(purple_icq_buddyadd), - _("_Decline"), G_CALLBACK(oscar_free_name_data)); - g_free(message); - } - } else { - gchar *tmp = g_strescape(args->msg, NULL); - purple_debug_error("oscar", "Unknown syntax parsing " - "ICQ buddies. args->msg=%s\n", tmp); - g_free(tmp); - } - g_strfreev(text); - } - } break; - - case 0x1a: { /* Handle SMS or someone has sent you a greeting card or requested buddies? */ - ByteStream qbs; - int smstype, taglen, smslen; - char *tagstr = NULL, *smsmsg = NULL; - xmlnode *xmlroot = NULL, *xmltmp = NULL; - gchar *uin = NULL, *message = NULL; - - /* From libicq2000-0.3.2/src/ICQ.cpp */ - byte_stream_init(&qbs, (guint8 *)args->msg, args->msglen); - byte_stream_advance(&qbs, 21); - /* expected: 01 00 00 20 00 0e 28 f6 00 11 e7 d3 11 bc f3 00 04 ac 96 9d c2 | 00 00 | 06 00 00 00 | 49 43 51 53 43 53 ...*/ - /* unexpected: 00 00 26 00 81 1a 18 bc 0e 6c 18 47 a5 91 6f 18 dc c7 6f 1a | 00 00 | 0d 00 00 00 | 49 43 51 57 65 62 4d 65 73 73 61 67 65 ... */ - smstype = byte_stream_getle16(&qbs); - if (smstype != 0) - break; - taglen = byte_stream_getle32(&qbs); - tagstr = byte_stream_getstr(&qbs, taglen); - if (tagstr == NULL) - break; - byte_stream_advance(&qbs, 3); - byte_stream_advance(&qbs, 4); - smslen = byte_stream_getle32(&qbs); - smsmsg = byte_stream_getstr(&qbs, smslen); - - /* Check if this is an SMS being sent from server */ - if ((smstype == 0) && (!strcmp(tagstr, "ICQSMS")) && (smsmsg != NULL)) - { - xmlroot = xmlnode_from_str(smsmsg, -1); - if (xmlroot != NULL) - { - xmltmp = xmlnode_get_child(xmlroot, "sender"); - if (xmltmp != NULL) - uin = xmlnode_get_data(xmltmp); - - xmltmp = xmlnode_get_child(xmlroot, "text"); - if (xmltmp != NULL) - message = xmlnode_get_data(xmltmp); - - if ((uin != NULL) && (message != NULL)) - serv_got_im(gc, uin, message, 0, time(NULL)); - - g_free(uin); - g_free(message); - xmlnode_free(xmlroot); - } - } - g_free(tagstr); - g_free(smsmsg); - } break; - - default: { - purple_debug_info("oscar", - "Received a channel 4 message of unknown type " - "(type 0x%02hhx).\n", args->type); - } break; - } - - g_strfreev(msg1); - g_strfreev(msg2); - - return 1; -} - -static int purple_parse_incoming_im(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - guint16 channel; - int ret = 0; - aim_userinfo_t *userinfo; - va_list ap; - - va_start(ap, fr); - channel = (guint16)va_arg(ap, unsigned int); - userinfo = va_arg(ap, aim_userinfo_t *); - - switch (channel) { - case 1: { /* standard message */ - struct aim_incomingim_ch1_args *args; - args = va_arg(ap, struct aim_incomingim_ch1_args *); - ret = incomingim_chan1(od, conn, userinfo, args); - } break; - - case 2: { /* rendezvous */ - IcbmArgsCh2 *args; - args = va_arg(ap, IcbmArgsCh2 *); - ret = incomingim_chan2(od, conn, userinfo, args); - } break; - - case 4: { /* ICQ */ - struct aim_incomingim_ch4_args *args; - args = va_arg(ap, struct aim_incomingim_ch4_args *); - ret = incomingim_chan4(od, conn, userinfo, args, 0); - } break; - - default: { - purple_debug_warning("oscar", - "ICBM received on unsupported channel (channel " - "0x%04hx).", channel); - } break; - } - - va_end(ap); - - return ret; -} - -static int purple_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char *buf; - va_list ap; - guint16 chan, nummissed, reason; - aim_userinfo_t *userinfo; - - va_start(ap, fr); - chan = (guint16)va_arg(ap, unsigned int); - userinfo = va_arg(ap, aim_userinfo_t *); - nummissed = (guint16)va_arg(ap, unsigned int); - reason = (guint16)va_arg(ap, unsigned int); - va_end(ap); - - switch(reason) { - case 0: /* Invalid (0) */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because it was invalid.", - "You missed %hu messages from %s because they were invalid.", - nummissed), - nummissed, - userinfo->bn); - break; - case 1: /* Message too large */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because it was too large.", - "You missed %hu messages from %s because they were too large.", - nummissed), - nummissed, - userinfo->bn); - break; - case 2: /* Rate exceeded */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because the rate limit has been exceeded.", - "You missed %hu messages from %s because the rate limit has been exceeded.", - nummissed), - nummissed, - userinfo->bn); - break; - case 3: /* Evil Sender */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because his/her warning level is too high.", - "You missed %hu messages from %s because his/her warning level is too high.", - nummissed), - nummissed, - userinfo->bn); - break; - case 4: /* Evil Receiver */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because your warning level is too high.", - "You missed %hu messages from %s because your warning level is too high.", - nummissed), - nummissed, - userinfo->bn); - break; - default: - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s for an unknown reason.", - "You missed %hu messages from %s for an unknown reason.", - nummissed), - nummissed, - userinfo->bn); - break; - } - - if (!purple_conv_present_error(userinfo->bn, account, buf)) - purple_notify_error(od->gc, NULL, buf, NULL); - g_free(buf); - - return 1; -} - -static int -purple_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, const guchar *cookie) -{ - if (reason == 0x0003) - { - /* Rendezvous was refused. */ - PeerConnection *conn; - - conn = peer_connection_find_by_cookie(od, who, cookie); - - if (conn == NULL) - { - purple_debug_info("oscar", "Received a rendezvous cancel message " - "for a nonexistant connection from %s.\n", who); - } - else - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_REFUSED, NULL); - } - } - else - { - purple_debug_warning("oscar", "Received an unknown rendezvous " - "message from %s. Type 0x%04hx\n", who, reason); - } - - return 0; -} - -static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) { - PurpleConnection *gc = od->gc; - - switch(reason) { - case 0x0003: { /* Reply from an ICQ status message request */ - char *statusmsg, **splitmsg; - PurpleNotifyUserInfo *user_info; - - /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ - statusmsg = oscar_icqstatus(state); - splitmsg = g_strsplit(msg, "\r\n", 0); - - user_info = purple_notify_user_info_new(); - - purple_notify_user_info_add_pair(user_info, _("UIN"), who); - purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("
", splitmsg)); - - g_free(statusmsg); - g_strfreev(splitmsg); - - purple_notify_userinfo(gc, who, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - } break; - - default: { - purple_debug_warning("oscar", - "Received an unknown client auto-response from %s. " - "Type 0x%04hx\n", who, reason); - } break; - } /* end of switch */ - - return 0; -} - -static int purple_parse_clientauto(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 chan, reason; - char *who; - - va_start(ap, fr); - chan = (guint16)va_arg(ap, unsigned int); - who = va_arg(ap, char *); - reason = (guint16)va_arg(ap, unsigned int); - - if (chan == 0x0002) { /* File transfer declined */ - guchar *cookie = va_arg(ap, guchar *); - return purple_parse_clientauto_ch2(od, who, reason, cookie); - } else if (chan == 0x0004) { /* ICQ message */ - guint32 state = 0; - char *msg = NULL; - if (reason == 0x0003) { - state = va_arg(ap, guint32); - msg = va_arg(ap, char *); - } - return purple_parse_clientauto_ch4(od, who, reason, state, msg); - } - - va_end(ap); - - return 1; -} - -static int purple_parse_genericerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 reason; - - va_start(ap, fr); - reason = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_error("oscar", - "snac threw error (reason 0x%04hx: %s)\n", reason, - (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); - return 1; -} - -static int purple_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; -#ifdef TODOFT - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleXfer *xfer; -#endif - va_list ap; - guint16 reason, errcode; - char *data, *reason_str, *buf; - - va_start(ap, fr); - reason = (guint16)va_arg(ap, unsigned int); - errcode = (guint16)va_arg(ap, unsigned int); - data = va_arg(ap, char *); - va_end(ap); - - purple_debug_error("oscar", - "Message error with data %s and reason %hu and errcode %hu\n", - (data != NULL ? data : ""), reason, errcode); - - if ((data == NULL) || (*data == '\0')) - /* We can't do anything if data is empty */ - return 1; - -#ifdef TODOFT - /* If this was a file transfer request, data is a cookie */ - if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { - purple_xfer_cancel_remote(xfer); - return 1; - } -#endif - - /* Data is assumed to be the destination bn */ - - reason_str = g_strdup((reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason")); - if (errcode != 0 && errcode < errcodereasonlen) - buf = g_strdup_printf(_("Unable to send message: %s (%s)"), reason_str, - _(errcodereason[errcode])); - else - buf = g_strdup_printf(_("Unable to send message: %s"), reason_str); - - if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) { - g_free(buf); - if (errcode != 0 && errcode < errcodereasonlen) - buf = g_strdup_printf(_("Unable to send message to %s: %s (%s)"), - data ? data : "(unknown)", reason_str, - _(errcodereason[errcode])); - else - buf = g_strdup_printf(_("Unable to send message to %s: %s"), - data ? data : "(unknown)", reason_str); - purple_notify_error(od->gc, NULL, buf, reason_str); - } - g_free(buf); - g_free(reason_str); - - return 1; -} - -static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 channel, event; - char *bn; - - va_start(ap, fr); - channel = (guint16) va_arg(ap, unsigned int); - bn = va_arg(ap, char *); - event = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - switch (event) { - case 0x0000: { /* Text has been cleared */ - serv_got_typing_stopped(gc, bn); - } break; - - case 0x0001: { /* Paused typing */ - serv_got_typing(gc, bn, 0, PURPLE_TYPED); - } break; - - case 0x0002: { /* Typing */ - serv_got_typing(gc, bn, 0, PURPLE_TYPING); - } break; - - case 0x000f: { /* Closed IM window */ - serv_got_typing_stopped(gc, bn); - } break; - - default: { - purple_debug_info("oscar", "Received unknown typing " - "notification message from %s. Channel is 0x%04x " - "and event is 0x%04hx.\n", bn, channel, event); - } break; - } - - return 1; -} - -/* - * We get this error when there was an error in the locate family. This - * happens when you request info of someone who is offline. - */ -static int purple_parse_locerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - gchar *buf; - va_list ap; - guint16 reason; - char *destn; - PurpleNotifyUserInfo *user_info; - - va_start(ap, fr); - reason = (guint16) va_arg(ap, unsigned int); - destn = va_arg(ap, char *); - va_end(ap); - - if (destn == NULL) - return 1; - - user_info = purple_notify_user_info_new(); - buf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason.")); - purple_notify_user_info_add_pair(user_info, NULL, buf); - purple_notify_userinfo(od->gc, destn, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - purple_conv_present_error(destn, purple_connection_get_account(od->gc), buf); - g_free(buf); - - return 1; -} - -static int purple_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleNotifyUserInfo *user_info; - gchar *tmp = NULL, *info_utf8 = NULL; - va_list ap; - aim_userinfo_t *userinfo; - - va_start(ap, fr); - userinfo = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - user_info = purple_notify_user_info_new(); - - oscar_user_info_append_status(gc, user_info, /* PurpleBuddy */ NULL, userinfo, /* strip_html_tags */ FALSE); - - if ((userinfo->present & AIM_USERINFO_PRESENT_IDLE) && userinfo->idletime != 0) { - tmp = purple_str_seconds_to_string(userinfo->idletime*60); - oscar_user_info_add_pair(user_info, _("Idle"), tmp); - g_free(tmp); - } - - oscar_user_info_append_extra_info(gc, user_info, NULL, userinfo); - - if ((userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) && !oscar_util_valid_name_sms(userinfo->bn)) { - /* An SMS contact is always online; its Online Since value is not useful */ - time_t t = userinfo->onlinesince; - oscar_user_info_add_pair(user_info, _("Online Since"), purple_date_format_full(localtime(&t))); - } - - if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { - time_t t = userinfo->membersince; - oscar_user_info_add_pair(user_info, _("Member Since"), purple_date_format_full(localtime(&t))); - } - - if (userinfo->capabilities != 0) { - tmp = oscar_caps_to_string(userinfo->capabilities); - oscar_user_info_add_pair(user_info, _("Capabilities"), tmp); - g_free(tmp); - } - - /* Info */ - if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { - tmp = oscar_encoding_extract(userinfo->info_encoding); - info_utf8 = oscar_encoding_to_utf8(account, tmp, userinfo->info, - userinfo->info_len); - g_free(tmp); - if (info_utf8 != NULL) { - tmp = purple_str_sub_away_formatters(info_utf8, purple_account_get_username(account)); - purple_notify_user_info_add_section_break(user_info); - oscar_user_info_add_pair(user_info, _("Profile"), tmp); - g_free(tmp); - g_free(info_utf8); - } - } - - purple_notify_user_info_add_section_break(user_info); - tmp = g_strdup_printf("%s", - purple_normalize(account, userinfo->bn), _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - purple_notify_userinfo(gc, userinfo->bn, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - return 1; -} - -static int purple_parse_motd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - char *msg; - guint16 id; - va_list ap; - - va_start(ap, fr); - id = (guint16) va_arg(ap, unsigned int); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_misc("oscar", - "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); - if (id < 4) - purple_notify_warning(od->gc, NULL, - _("Your AIM connection may be lost."), NULL); - - return 1; -} - -static int purple_chatnav_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 type; - - va_start(ap, fr); - type = (guint16) va_arg(ap, unsigned int); - - switch(type) { - case 0x0002: { - guint8 maxrooms; - struct aim_chat_exchangeinfo *exchanges; - int exchangecount, i; - - maxrooms = (guint8) va_arg(ap, unsigned int); - exchangecount = va_arg(ap, int); - exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); - - purple_debug_misc("oscar", "chat info: Chat Rights:\n"); - purple_debug_misc("oscar", - "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); - purple_debug_misc("oscar", - "chat info: \tExchange List: (%d total)\n", exchangecount); - for (i = 0; i < exchangecount; i++) - purple_debug_misc("oscar", - "chat info: \t\t%hu %s\n", - exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); - while (od->create_rooms) { - struct create_room *cr = od->create_rooms->data; - purple_debug_info("oscar", - "creating room %s\n", cr->name); - aim_chatnav_createroom(od, conn, cr->name, cr->exchange); - g_free(cr->name); - od->create_rooms = g_slist_remove(od->create_rooms, cr); - g_free(cr); - } - } - break; - case 0x0008: { - char *fqcn, *name, *ck; - guint16 instance, flags, maxmsglen, maxoccupancy, unknown, exchange; - guint8 createperms; - guint32 createtime; - - fqcn = va_arg(ap, char *); - instance = (guint16)va_arg(ap, unsigned int); - exchange = (guint16)va_arg(ap, unsigned int); - flags = (guint16)va_arg(ap, unsigned int); - createtime = va_arg(ap, guint32); - maxmsglen = (guint16)va_arg(ap, unsigned int); - maxoccupancy = (guint16)va_arg(ap, unsigned int); - createperms = (guint8)va_arg(ap, unsigned int); - unknown = (guint16)va_arg(ap, unsigned int); - name = va_arg(ap, char *); - ck = va_arg(ap, char *); - - purple_debug_misc("oscar", - "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", - fqcn ? fqcn : "(null)", exchange, instance, flags, createtime, - maxmsglen, maxoccupancy, createperms, unknown, - name ? name : "(null)", ck); - aim_chat_join(od, exchange, ck, instance); - } - break; - default: - purple_debug_warning("oscar", - "chatnav info: unknown type (%04hx)\n", type); - break; - } - - va_end(ap); - - return 1; -} - -static int purple_conv_chat_join(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - int count, i; - aim_userinfo_t *info; - PurpleConnection *gc = od->gc; - - struct chat_connection *c = NULL; - - va_start(ap, fr); - count = va_arg(ap, int); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - c = find_oscar_chat_by_conn(gc, conn); - if (!c) - return 1; - - for (i = 0; i < count; i++) - purple_conv_chat_add_user(PURPLE_CONV_CHAT(c->conv), info[i].bn, NULL, PURPLE_CBFLAGS_NONE, TRUE); - - return 1; -} - -static int purple_conv_chat_leave(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - int count, i; - aim_userinfo_t *info; - PurpleConnection *gc = od->gc; - - struct chat_connection *c = NULL; - - va_start(ap, fr); - count = va_arg(ap, int); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - c = find_oscar_chat_by_conn(gc, conn); - if (!c) - return 1; - - for (i = 0; i < count; i++) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c->conv), info[i].bn, NULL); - - return 1; -} - -static int purple_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - aim_userinfo_t *userinfo; - struct aim_chat_roominfo *roominfo; - char *roomname; - int usercount; - char *roomdesc; - guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; - guint32 creationtime; - PurpleConnection *gc = od->gc; - struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); - - if (!ccon) - return 1; - - va_start(ap, fr); - roominfo = va_arg(ap, struct aim_chat_roominfo *); - roomname = va_arg(ap, char *); - usercount= va_arg(ap, int); - userinfo = va_arg(ap, aim_userinfo_t *); - roomdesc = va_arg(ap, char *); - unknown_c9 = (guint16)va_arg(ap, unsigned int); - creationtime = va_arg(ap, guint32); - maxmsglen = (guint16)va_arg(ap, unsigned int); - unknown_d2 = (guint16)va_arg(ap, unsigned int); - unknown_d5 = (guint16)va_arg(ap, unsigned int); - maxvisiblemsglen = (guint16)va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", - maxmsglen, maxvisiblemsglen); - - ccon->maxlen = maxmsglen; - ccon->maxvis = maxvisiblemsglen; - - return 1; -} - -static int purple_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); - gchar *utf8; - va_list ap; - aim_userinfo_t *info; - int len; - char *msg; - char *charset; - - if (!ccon) - return 1; - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - len = va_arg(ap, int); - msg = va_arg(ap, char *); - charset = va_arg(ap, char *); - va_end(ap); - - utf8 = oscar_encoding_to_utf8(account, charset, msg, len); - if (utf8 == NULL) - /* The conversion failed! */ - utf8 = g_strdup(_("[Unable to display a message from this user because it contained invalid characters.]")); - serv_got_chat_in(gc, ccon->id, info->bn, 0, utf8, time((time_t)NULL)); - g_free(utf8); - - return 1; -} - -static int purple_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - PurpleConnection *gc; - PurpleAccount *account; - struct aim_emailinfo *emailinfo; - int havenewmail; - char *alertitle, *alerturl; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - emailinfo = va_arg(ap, struct aim_emailinfo *); - havenewmail = va_arg(ap, int); - alertitle = va_arg(ap, char *); - alerturl = va_arg(ap, char *); - va_end(ap); - - if (account != NULL && emailinfo != NULL && purple_account_get_check_mail(account) && - emailinfo->unread && havenewmail) { - gchar *to = g_strdup_printf("%s%s%s", - purple_account_get_username(account), - emailinfo->domain ? "@" : "", - emailinfo->domain ? emailinfo->domain : ""); - const char *tos[2] = { to }; - const char *urls[2] = { emailinfo->url }; - purple_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, - tos, urls, NULL, NULL); - g_free(to); - } - - if (alertitle) - purple_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); - - return 1; -} - -static int purple_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn; - guint8 iconcsumtype, *iconcsum, *icon; - guint16 iconcsumlen, iconlen; - - va_start(ap, fr); - bn = va_arg(ap, char *); - iconcsumtype = va_arg(ap, int); - iconcsum = va_arg(ap, guint8 *); - iconcsumlen = va_arg(ap, int); - icon = va_arg(ap, guint8 *); - iconlen = va_arg(ap, int); - va_end(ap); - - /* - * Some AIM clients will send a blank GIF image with iconlen 90 when - * no icon is set. Ignore these. - */ - if ((iconlen > 0) && (iconlen != 90)) { - char *b16 = purple_base16_encode(iconcsum, iconcsumlen); - purple_buddy_icons_set_for_user(purple_connection_get_account(gc), - bn, g_memdup(icon, iconlen), iconlen, b16); - g_free(b16); - } - - return 1; -} - -static void -purple_icons_fetch(PurpleConnection *gc) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - aim_userinfo_t *userinfo; - FlapConnection *conn; - - conn = flap_connection_getbytype(od, SNAC_FAMILY_BART); - if (!conn) { - if (!od->iconconnecting) { - aim_srv_requestnew(od, SNAC_FAMILY_BART); - od->iconconnecting = TRUE; - } - return; - } - - if (od->set_icon) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) { - aim_ssi_delicon(od); - } else { - purple_debug_info("oscar", - "Uploading icon to icon server\n"); - aim_bart_upload(od, purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_imgstore_unref(img); - } - od->set_icon = FALSE; - } - - while (od->requesticon != NULL) - { - userinfo = aim_locate_finduserinfo(od, (char *)od->requesticon->data); - if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) - aim_bart_request(od, od->requesticon->data, userinfo->iconcsumtype, userinfo->iconcsum, userinfo->iconcsumlen); - - g_free(od->requesticon->data); - od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); - } - - purple_debug_misc("oscar", "no more icons to request\n"); -} - -/* - * Received in response to an IM sent with the AIM_IMFLAGS_ACK option. - */ -static int purple_parse_msgack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 type; - char *bn; - - va_start(ap, fr); - type = (guint16) va_arg(ap, unsigned int); - bn = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", "Sent message to %s.\n", bn); - - return 1; -} - -static int purple_parse_ratechange(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - static const char *codes[5] = { - "invalid", - "change", - "warning", - "limit", - "limit cleared", - }; - va_list ap; - guint16 code, rateclass; - guint32 windowsize, clear, alert, limit, disconnect, currentavg, maxavg, delta; - guint8 dropping_snacs; - - va_start(ap, fr); - code = (guint16)va_arg(ap, unsigned int); - rateclass= (guint16)va_arg(ap, unsigned int); - windowsize = va_arg(ap, guint32); - clear = va_arg(ap, guint32); - alert = va_arg(ap, guint32); - limit = va_arg(ap, guint32); - disconnect = va_arg(ap, guint32); - currentavg = va_arg(ap, guint32); - maxavg = va_arg(ap, guint32); - delta = va_arg(ap, guint32); - dropping_snacs = (guint8)va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " - "clear warning at %u, limit at %u, disconnect at %u, delta is %u, dropping is %u (window size = %u)\n", - (code < 5) ? codes[code] : codes[0], - rateclass, - currentavg, maxavg, - alert, clear, - limit, disconnect, - delta, - dropping_snacs, - windowsize - ); - - if (code == AIM_RATE_CODE_LIMIT) - { - purple_debug_warning("oscar", _("The last action you attempted could not be " - "performed because you are over the rate limit. " - "Please wait 10 seconds and try again.\n")); - } - - return 1; -} - -static int purple_parse_evilnotify(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { -#ifdef CRAZY_WARNING - va_list ap; - guint16 newevil; - aim_userinfo_t *userinfo; - - va_start(ap, fr); - newevil = (guint16) va_arg(ap, unsigned int); - userinfo = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - purple_prpl_got_account_warning_level(account, (userinfo && userinfo->bn) ? userinfo->bn : NULL, (newevil/10.0) + 0.5); -#endif - - return 1; -} - -static int purple_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - int warning_level; - va_list ap; - aim_userinfo_t *info; - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - purple_connection_set_display_name(od->gc, info->bn); - - /* - * What's with the + 0.5? - * The 0.5 is basically poor-man's rounding. Normally - * casting "13.7" to an int will truncate to "13," but - * with 13.7 + 0.5 = 14.2, which becomes "14" when - * truncated. - */ - warning_level = info->warnlevel/10.0 + 0.5; - -#ifdef CRAZY_WARNING - purple_presence_set_warning_level(presence, warning_level); -#endif - - return 1; -} - -static int purple_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 code; - char *msg; - - va_start(ap, fr); - code = (guint16)va_arg(ap, int); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", "Disconnected. Code is 0x%04x and msg is %s\n", - code, (msg != NULL ? msg : "")); - - g_return_val_if_fail(conn != NULL, 1); - - if (conn->type == SNAC_FAMILY_CHAT) { - struct chat_connection *cc; - PurpleConversation *conv = NULL; - - cc = find_oscar_chat_by_conn(gc, conn); - if (cc != NULL) - { - conv = purple_find_chat(gc, cc->id); - - if (conv != NULL) - { - /* - * TOOD: Have flap_connection_destroy_cb() send us the - * error message stored in 'tmp', which should be - * human-friendly, and print that to the chat room. - */ - gchar *buf; - buf = g_strdup_printf(_("You have been disconnected from chat " - "room %s."), cc->name); - purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL)); - g_free(buf); - } - oscar_chat_kill(gc, cc); - } - } - - return 1; -} - -static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - va_list ap; - guint16 maxsiglen; - - va_start(ap, fr); - maxsiglen = (guint16) va_arg(ap, int); - va_end(ap); - - purple_debug_misc("oscar", - "locate rights: max sig len = %d\n", maxsiglen); - - od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; - - aim_locate_setcaps(od, purple_caps); - oscar_set_info_and_status(account, TRUE, account->user_info, TRUE, - purple_account_get_active_status(account)); - - return 1; -} - -static int purple_parse_buddyrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 maxbuddies, maxwatchers; - - va_start(ap, fr); - maxbuddies = (guint16) va_arg(ap, unsigned int); - maxwatchers = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); - - od->rights.maxbuddies = (guint)maxbuddies; - od->rights.maxwatchers = (guint)maxwatchers; - - return 1; -} - -static int purple_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc; - PurpleAccount *account; - PurpleStatus *status; - gboolean is_available; - PurplePresence *presence; - const char *username, *message, *itmsurl; - char *tmp; - va_list ap; - guint16 maxpermits, maxdenies; - - gc = od->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - va_start(ap, fr); - maxpermits = (guint16) va_arg(ap, unsigned int); - maxdenies = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); - - od->rights.maxpermits = (guint)maxpermits; - od->rights.maxdenies = (guint)maxdenies; - - purple_debug_info("oscar", "buddy list loaded\n"); - - if (purple_account_get_user_info(account) != NULL) - serv_set_info(gc, purple_account_get_user_info(account)); - - username = purple_account_get_username(account); - if (!od->icq && strcmp(username, purple_connection_get_display_name(gc)) != 0) - /* - * Format the username for AIM accounts if it's different - * than what's currently set. - */ - oscar_format_username(gc, username); - - /* Set our available message based on the current status */ - status = purple_account_get_active_status(account); - is_available = purple_status_is_available(status); - if (is_available) - message = purple_status_get_attr_string(status, "message"); - else - message = NULL; - tmp = purple_markup_strip_html(message); - itmsurl = purple_status_get_attr_string(status, "itmsurl"); - aim_srv_setextrainfo(od, FALSE, 0, is_available, tmp, itmsurl); - g_free(tmp); - - presence = purple_status_get_presence(status); - aim_srv_setidle(od, !purple_presence_is_idle(presence) ? 0 : time(NULL) - purple_presence_get_idle_time(presence)); - - if (od->icq) { -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS - aim_icq_reqofflinemsgs(od); -#endif - oscar_set_extendedstatus(gc); - aim_icq_setsecurity(od, - purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION), - purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)); - } - - aim_srv_requestnew(od, SNAC_FAMILY_ALERT); - aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); - - od->bos.have_rights = TRUE; - - /* - * If we've already received our feedbag data then we're not waiting on - * anything else, so send the server clientready. - * - * Normally we get bos rights before we get our feedbag data, so this - * rarely (never?) happens. And I'm not sure it actually matters if we - * wait for bos rights before calling clientready. But it seems safer - * to do it this way. - */ - if (od->ssi.received_data) { - aim_srv_clientready(od, conn); - - /* Request offline messages for AIM and ICQ */ - aim_im_reqofflinemsgs(od); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - } - - return 1; -} - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -static int purple_offlinemsg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - struct aim_icq_offlinemsg *msg; - struct aim_incomingim_ch4_args args; - time_t t; - - va_start(ap, fr); - msg = va_arg(ap, struct aim_icq_offlinemsg *); - va_end(ap); - - purple_debug_info("oscar", - "Received offline message. Converting to channel 4 ICBM...\n"); - args.uin = msg->sender; - args.type = msg->type; - args.flags = msg->flags; - args.msglen = msg->msglen; - args.msg = msg->msg; - t = purple_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); - incomingim_chan4(od, conn, NULL, &args, t); - - return 1; -} - -static int purple_offlinemsgdone(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - aim_icq_ackofflinemsgs(od); - return 1; -} -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - -static int purple_icqinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - PurpleBuddy *buddy; - struct buddyinfo *bi; - gchar who[16]; - PurpleNotifyUserInfo *user_info; - gchar *utf8; - gchar *buf; - const gchar *alias; - va_list ap; - struct aim_icq_info *info; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - info = va_arg(ap, struct aim_icq_info *); - va_end(ap); - - if (!info->uin) - return 0; - - user_info = purple_notify_user_info_new(); - - g_snprintf(who, sizeof(who), "%u", info->uin); - buddy = purple_find_buddy(account, who); - if (buddy != NULL) - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, purple_buddy_get_name(buddy))); - else - bi = NULL; - - purple_notify_user_info_add_pair(user_info, _("UIN"), who); - oscar_user_info_convert_and_add(account, user_info, _("Nick"), info->nick); - if ((bi != NULL) && (bi->ipaddr != 0)) { - char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", - (bi->ipaddr & 0xff000000) >> 24, - (bi->ipaddr & 0x00ff0000) >> 16, - (bi->ipaddr & 0x0000ff00) >> 8, - (bi->ipaddr & 0x000000ff)); - purple_notify_user_info_add_pair(user_info, _("IP Address"), tstr); - g_free(tstr); - } - oscar_user_info_convert_and_add(account, user_info, _("First Name"), info->first); - oscar_user_info_convert_and_add(account, user_info, _("Last Name"), info->last); - if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(account, info->email))) { - buf = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); - g_free(buf); - g_free(utf8); - } - if (info->numaddresses && info->email2) { - int i; - for (i = 0; i < info->numaddresses; i++) { - if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(account, info->email2[i]))) { - buf = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); - g_free(buf); - g_free(utf8); - } - } - } - oscar_user_info_convert_and_add(account, user_info, _("Mobile Phone"), info->mobile); - - if (info->gender != 0) - purple_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male"))); - - if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) { - /* Initialize the struct properly or strftime() will crash - * under some conditions (e.g. Debian sarge w/ LANG=en_HK). */ - time_t t = time(NULL); - struct tm *tm = localtime(&t); - - tm->tm_mday = (int)info->birthday; - tm->tm_mon = (int)info->birthmonth - 1; - tm->tm_year = (int)info->birthyear - 1900; - - /* To be 100% sure that the fields are re-normalized. - * If you're sure strftime() ALWAYS does this EVERYWHERE, - * feel free to remove it. --rlaager */ - mktime(tm); - - oscar_user_info_convert_and_add(account, user_info, _("Birthday"), purple_date_format_short(tm)); - } - if ((info->age > 0) && (info->age < 255)) { - char age[5]; - snprintf(age, sizeof(age), "%hhd", info->age); - purple_notify_user_info_add_pair(user_info, _("Age"), age); - } - if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(account, info->personalwebpage))) { - buf = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf); - g_free(buf); - g_free(utf8); - } - - if (buddy != NULL) - oscar_user_info_append_status(gc, user_info, buddy, /* aim_userinfo_t */ NULL, /* strip_html_tags */ FALSE); - - oscar_user_info_convert_and_add(account, user_info, _("Additional Information"), info->info); - purple_notify_user_info_add_section_break(user_info); - - if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { - purple_notify_user_info_add_section_header(user_info, _("Home Address")); - - oscar_user_info_convert_and_add(account, user_info, _("Address"), info->homeaddr); - oscar_user_info_convert_and_add(account, user_info, _("City"), info->homecity); - oscar_user_info_convert_and_add(account, user_info, _("State"), info->homestate); - oscar_user_info_convert_and_add(account, user_info, _("Zip Code"), info->homezip); - } - if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { - purple_notify_user_info_add_section_header(user_info, _("Work Address")); - - oscar_user_info_convert_and_add(account, user_info, _("Address"), info->workaddr); - oscar_user_info_convert_and_add(account, user_info, _("City"), info->workcity); - oscar_user_info_convert_and_add(account, user_info, _("State"), info->workstate); - oscar_user_info_convert_and_add(account, user_info, _("Zip Code"), info->workzip); - } - if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { - purple_notify_user_info_add_section_header(user_info, _("Work Information")); - - oscar_user_info_convert_and_add(account, user_info, _("Company"), info->workcompany); - oscar_user_info_convert_and_add(account, user_info, _("Division"), info->workdivision); - oscar_user_info_convert_and_add(account, user_info, _("Position"), info->workposition); - - if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(account, info->workwebpage))) { - char *webpage = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Web Page"), webpage); - g_free(webpage); - g_free(utf8); - } - } - - if (buddy != NULL) - alias = purple_buddy_get_alias(buddy); - else - alias = who; - purple_notify_userinfo(gc, who, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - return 1; -} - -static int purple_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - gchar who[16], *utf8; - PurpleBuddy *b; - va_list ap; - struct aim_icq_info *info; - - va_start(ap, fr); - info = va_arg(ap, struct aim_icq_info *); - va_end(ap); - - if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, info->nick))) { - g_snprintf(who, sizeof(who), "%u", info->uin); - serv_got_alias(gc, who, utf8); - if ((b = purple_find_buddy(account, who))) { - purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8); - } - g_free(utf8); - } - - return 1; -} - -static int purple_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - gchar *text; - va_list ap; - char *msg, *url; - guint16 wid, hei, delay; - - va_start(ap, fr); - msg = va_arg(ap, char *); - url = va_arg(ap, char *); - wid = (guint16) va_arg(ap, int); - hei = (guint16) va_arg(ap, int); - delay = (guint16) va_arg(ap, int); - va_end(ap); - - text = g_strdup_printf("%s
%s", msg, url, url); - purple_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); - g_free(text); - - return 1; -} - -static void oscar_searchresults_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) -{ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 0), NULL, NULL); -} - -static int purple_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - gchar *secondary; - int i, num; - va_list ap; - char *email, *usernames; - - va_start(ap, fr); - email = va_arg(ap, char *); - num = va_arg(ap, int); - usernames = va_arg(ap, char *); - va_end(ap); - - results = purple_notify_searchresults_new(); - - if (results == NULL) { - purple_debug_error("oscar", "purple_parse_searchreply: " - "Unable to display the search results.\n"); - purple_notify_error(gc, NULL, - _("Unable to display the search results."), - NULL); - return 1; - } - - secondary = g_strdup_printf( - dngettext(PACKAGE, "The following username is associated with %s", - "The following usernames are associated with %s", - num), - email); - - column = purple_notify_searchresults_column_new(_("Username")); - purple_notify_searchresults_column_add(results, column); - - for (i = 0; i < num; i++) { - GList *row; - row = g_list_append(NULL, g_strdup(&usernames[i * (MAXSNLEN + 1)])); - purple_notify_searchresults_row_add(results, row); - } - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - oscar_searchresults_add_buddy_cb); - purple_notify_searchresults(gc, NULL, NULL, secondary, results, NULL, NULL); - - g_free(secondary); - - return 1; -} - -static int purple_parse_searcherror(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - char *email; - char *buf; - - va_start(ap, fr); - email = va_arg(ap, char *); - va_end(ap); - - buf = g_strdup_printf(_("No results found for email address %s"), email); - purple_notify_error(od->gc, NULL, buf, NULL); - g_free(buf); - - return 1; -} - -static int purple_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - guint16 status; - va_list ap; - char msg[256]; - - va_start(ap, fr); - status = (guint16) va_arg(ap, unsigned int); /* status code of confirmation request */ - va_end(ap); - - purple_debug_info("oscar", - "account confirmation returned status 0x%04x (%s)\n", status, - status ? "unknown" : "email sent"); - if (!status) { - g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), - purple_account_get_username(purple_connection_get_account(gc))); - purple_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); - } - - return 1; -} - -static int purple_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 perms, err; - char *url, *bn, *email; - int change; - - va_start(ap, fr); - change = va_arg(ap, int); - perms = (guint16) va_arg(ap, unsigned int); - err = (guint16) va_arg(ap, unsigned int); - url = va_arg(ap, char *); - bn = va_arg(ap, char *); - email = va_arg(ap, char *); - va_end(ap); - - purple_debug_misc("oscar", - "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, bn=%s, email=%s\n", - change ? "change" : "request", perms, err, - (url != NULL) ? url : "(null)", - (bn != NULL) ? bn : "(null)", - (email != NULL) ? email : "(null)"); - - if ((err > 0) && (url != NULL)) { - char *dialog_msg; - - if (err == 0x0001) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format username because the requested name differs from the original."), err); - else if (err == 0x0006) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format username because it is invalid."), err); - else if (err == 0x00b) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format username because the requested name is too long."), err); - else if (err == 0x001d) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because there is already a request pending for this username."), err); - else if (err == 0x0021) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address has too many usernames associated with it."), err); - else if (err == 0x0023) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); - else - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); - purple_notify_error(gc, NULL, - _("Error Changing Account Info"), dialog_msg); - g_free(dialog_msg); - return 1; - } - - if (email != NULL) { - char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), - purple_account_get_username(purple_connection_get_account(gc)), email); - purple_notify_info(gc, NULL, _("Account Info"), dialog_msg); - g_free(dialog_msg); - } - - return 1; -} - -void -oscar_keepalive(PurpleConnection *gc) -{ - OscarData *od; - FlapConnection *conn; - - od = purple_connection_get_protocol_data(gc); - conn = flap_connection_getbytype(od, SNAC_FAMILY_LOCATE); - if (conn != NULL) - flap_connection_send_keepalive(od, conn); -} - -unsigned int -oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) -{ - OscarData *od; - PeerConnection *conn; - - od = purple_connection_get_protocol_data(gc); - conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); - - if ((conn != NULL) && (conn->ready)) - { - peer_odc_send_typing(conn, state); - } - else { - /* Don't send if this turkey is in our deny list */ - GSList *list; - for (list=gc->account->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); - if (!list) { - struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name)); - if (bi && bi->typingnot) { - if (state == PURPLE_TYPING) - aim_im_sendmtn(od, 0x0001, name, 0x0002); - else if (state == PURPLE_TYPED) - aim_im_sendmtn(od, 0x0001, name, 0x0001); - else - aim_im_sendmtn(od, 0x0001, name, 0x0000); - } - } - } - return 0; -} - -/* TODO: Move this into odc.c! */ -static void -purple_odc_send_im(PeerConnection *conn, const char *message, PurpleMessageFlags imflags) -{ - GString *msg; - GString *data; - gchar *tmp; - int tmplen; - guint16 charset, charsubset; - GData *attribs; - const char *start, *end, *last; - int oscar_id = 0; - - msg = g_string_new(""); - data = g_string_new(""); - last = message; - - /* for each valid IMG tag... */ - while (last && *last && purple_markup_find_tag("img", last, &start, &end, &attribs)) - { - PurpleStoredImage *image = NULL; - const char *id; - - if (start - last) { - g_string_append_len(msg, last, start - last); - } - - id = g_datalist_get_data(&attribs, "id"); - - /* ... if it refers to a valid purple image ... */ - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - /* ... append the message from start to the tag ... */ - unsigned long size = purple_imgstore_get_size(image); - const char *filename = purple_imgstore_get_filename(image); - gconstpointer imgdata = purple_imgstore_get_data(image); - - oscar_id++; - - /* ... insert a new img tag with the oscar id ... */ - if (filename) - g_string_append_printf(msg, - "", - filename, oscar_id, size); - else - g_string_append_printf(msg, - "", - oscar_id, size); - - /* ... and append the data to the binary section ... */ - g_string_append_printf(data, "", - oscar_id, size); - g_string_append_len(data, imgdata, size); - g_string_append(data, ""); - } - /* If the tag is invalid, skip it, thus no else here */ - - g_datalist_clear(&attribs); - - /* continue from the end of the tag */ - last = end + 1; - } - - /* append any remaining message data */ - if (last && *last) - g_string_append(msg, last); - - g_string_append(msg, ""); - - /* Convert the message to a good encoding */ - purple_plugin_oscar_convert_to_best_encoding(conn->od->gc, - conn->bn, msg->str, &tmp, &tmplen, &charset, &charsubset); - g_string_free(msg, TRUE); - msg = g_string_new_len(tmp, tmplen); - g_free(tmp); - - /* Append any binary data that we may have */ - if (oscar_id) { - msg = g_string_append_len(msg, data->str, data->len); - msg = g_string_append(msg, ""); - } - g_string_free(data, TRUE); - - purple_debug_info("oscar", "sending direct IM %s using charset %i", msg->str, charset); - - peer_odc_send_im(conn, msg->str, msg->len, charset, - imflags & PURPLE_MESSAGE_AUTO_RESP); - g_string_free(msg, TRUE); -} - -int -oscar_send_im(PurpleConnection *gc, const char *name, const char *message, PurpleMessageFlags imflags) -{ - OscarData *od; - PurpleAccount *account; - PeerConnection *conn; - int ret; - char *tmp1, *tmp2; - gboolean is_sms, is_html; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - ret = 0; - - is_sms = oscar_util_valid_name_sms(name); - - if (od->icq && is_sms) { - /* - * We're sending to a phone number and this is ICQ, - * so send the message as an SMS using aim_icq_sendsms() - */ - int ret; - purple_debug_info("oscar", "Sending SMS to %s.\n", name); - ret = aim_icq_sendsms(od, name, message, purple_account_get_username(account)); - return (ret >= 0 ? 1 : ret); - } - - if (imflags & PURPLE_MESSAGE_AUTO_RESP) - tmp1 = purple_str_sub_away_formatters(message, name); - else - tmp1 = g_strdup(message); - - conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); - if ((conn != NULL) && (conn->ready)) - { - /* If we're directly connected, send a direct IM */ - purple_debug_info("oscar", "Sending direct IM with flags %i", imflags); - purple_odc_send_im(conn, tmp1, imflags); - } else { - struct buddyinfo *bi; - struct aim_sendimext_args args; - PurpleConversation *conv; - PurpleStoredImage *img; - PurpleBuddy *buddy; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); - - if (strstr(tmp1, "buddyinfo, purple_normalize(account, name)); - if (!bi) { - bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, name)), bi); - } - - args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; - - if (!is_sms && (!buddy || !PURPLE_BUDDY_IS_ONLINE(buddy))) - args.flags |= AIM_IMFLAGS_OFFLINE; - - if (od->icq) { - /* We have to present different "features" (whose meaning - is unclear and are merely a result of protocol inspection) - to offline ICQ buddies. Otherwise, the official - ICQ client doesn't treat those messages as being "ANSI- - encoded" (and instead, assumes them to be UTF-8). - For more details, see SF issue 1179452. - */ - if (buddy && PURPLE_BUDDY_IS_ONLINE(buddy)) { - args.features = features_icq; - args.featureslen = sizeof(features_icq); - } else { - args.features = features_icq_offline; - args.featureslen = sizeof(features_icq_offline); - } - } else { - args.features = features_aim; - args.featureslen = sizeof(features_aim); - - if (imflags & PURPLE_MESSAGE_AUTO_RESP) - args.flags |= AIM_IMFLAGS_AWAY; - } - - if (bi->ico_need) { - purple_debug_info("oscar", - "Sending buddy icon request with message\n"); - args.flags |= AIM_IMFLAGS_BUDDYREQ; - bi->ico_need = FALSE; - } - - img = purple_buddy_icons_find_account_icon(account); - if (img) { - gconstpointer data = purple_imgstore_get_data(img); - args.iconlen = purple_imgstore_get_size(img); - args.iconsum = aimutil_iconsum(data, args.iconlen); - args.iconstamp = purple_buddy_icons_get_account_icon_timestamp(account); - - if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { - bi->ico_informed = FALSE; - bi->ico_sent = FALSE; - } - - /* - * TODO: - * For some reason sending our icon to people only works - * when we're the ones who initiated the conversation. If - * the other person sends the first IM then they never get - * the icon. We should fix that. - */ - if (!bi->ico_informed) { - purple_debug_info("oscar", - "Claiming to have a buddy icon\n"); - args.flags |= AIM_IMFLAGS_HASICON; - bi->ico_me_len = args.iconlen; - bi->ico_me_csum = args.iconsum; - bi->ico_me_time = args.iconstamp; - bi->ico_informed = TRUE; - } - - purple_imgstore_unref(img); - } - - args.destbn = name; - - /* - * If we're IMing an SMS user or an ICQ user from an ICQ account, then strip HTML. - */ - if (oscar_util_valid_name_sms(name)) { - /* Messaging an SMS (mobile) user */ - tmp2 = purple_markup_strip_html(tmp1); - is_html = FALSE; - } else if (oscar_util_valid_name_icq(purple_account_get_username(account))) { - if (oscar_util_valid_name_icq(name)) { - /* From ICQ to ICQ */ - tmp2 = purple_markup_strip_html(tmp1); - is_html = FALSE; - } else { - /* From ICQ to AIM */ - tmp2 = g_strdup(tmp1); - is_html = TRUE; - } - } else { - /* From AIM to AIM and AIM to ICQ */ - tmp2 = g_strdup(tmp1); - is_html = TRUE; - } - g_free(tmp1); - tmp1 = tmp2; - - purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset); - if (is_html && (args.msglen > MAXMSGLEN)) { - /* If the length was too long, try stripping the HTML and then running it back through - * purple_strdup_withhtml() and the encoding process. The result may be shorter. */ - g_free((char *)args.msg); - - tmp2 = purple_markup_strip_html(tmp1); - g_free(tmp1); - - /* re-escape the entities */ - tmp1 = g_markup_escape_text(tmp2, -1); - g_free(tmp2); - - tmp2 = purple_strdup_withhtml(tmp1); - g_free(tmp1); - tmp1 = tmp2; - - purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset); - - purple_debug_info("oscar", "Sending %s as %s because the original was too long.\n", - message, (char *)args.msg); - } - - purple_debug_info("oscar", "Sending IM, charset=0x%04hx, charsubset=0x%04hx, length=%d\n", - args.charset, args.charsubset, args.msglen); - ret = aim_im_sendch1_ext(od, &args); - g_free((char *)args.msg); - } - - g_free(tmp1); - - if (ret >= 0) - return 1; - - return ret; -} - -/* - * As of 26 June 2006, ICQ users can request AIM info from - * everyone, and can request ICQ info from ICQ users, and - * AIM users can only request AIM info. - */ -void oscar_get_info(PurpleConnection *gc, const char *name) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->icq && oscar_util_valid_name_icq(name)) - aim_icq_getallinfo(od, name); - else - aim_locate_getinfoshort(od, name, 0x00000003); -} - -#if 0 -static void oscar_set_dir(PurpleConnection *gc, const char *first, const char *middle, const char *last, - const char *maiden, const char *city, const char *state, const char *country, int web) { - /* XXX - some of these things are wrong, but i'm lazy */ - OscarData *od = purple_connection_get_protocol_data(gc); - aim_locate_setdirinfo(od, first, middle, last, - maiden, NULL, NULL, city, state, NULL, 0, web); -} -#endif - -void oscar_set_idle(PurpleConnection *gc, int time) { - OscarData *od = purple_connection_get_protocol_data(gc); - aim_srv_setidle(od, time); -} - -static -gchar *purple_prpl_oscar_convert_to_infotext(const gchar *str, gsize *ret_len, char **encoding) -{ - int charset = 0; - char *encoded = NULL; - - charset = oscar_charset_check(str); - if (charset == AIM_CHARSET_UNICODE) { - encoded = g_convert(str, -1, "UTF-16BE", "UTF-8", NULL, ret_len, NULL); - *encoding = "unicode-2-0"; - } else if (charset == AIM_CHARSET_LATIN_1) { - encoded = g_convert(str, -1, "ISO-8859-1", "UTF-8", NULL, ret_len, NULL); - *encoding = "iso-8859-1"; - } else { - encoded = g_strdup(str); - *ret_len = strlen(str); - *encoding = "us-ascii"; - } - - return encoded; -} - -void -oscar_set_info(PurpleConnection *gc, const char *rawinfo) -{ - PurpleAccount *account; - PurpleStatus *status; - - account = purple_connection_get_account(gc); - status = purple_account_get_active_status(account); - oscar_set_info_and_status(account, TRUE, rawinfo, FALSE, status); -} - -static void -oscar_set_extendedstatus(PurpleConnection *gc) -{ - OscarData *od; - PurpleAccount *account; - PurpleStatus *status; - const gchar *status_id; - guint32 data = 0x00000000; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - status = purple_account_get_active_status(account); - status_id = purple_status_get_id(status); - - data |= AIM_ICQ_STATE_HIDEIP; - if (purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)) - data |= AIM_ICQ_STATE_WEBAWARE; - - if (!strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE)) - data |= AIM_ICQ_STATE_NORMAL; - else if (!strcmp(status_id, OSCAR_STATUS_ID_AWAY)) - data |= AIM_ICQ_STATE_AWAY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_DND)) - data |= AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_NA)) - data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_OCCUPIED)) - data |= AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_FREE4CHAT)) - data |= AIM_ICQ_STATE_CHAT; - else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE)) - data |= AIM_ICQ_STATE_INVISIBLE; - else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) - data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; - - aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL); -} - -static void -oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, - gboolean setstatus, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleStatusType *status_type; - PurpleStatusPrimitive primitive; - - char *info_encoding = NULL; - char *info = NULL; - gsize infolen = 0; - - char *away_encoding = NULL; - char *away = NULL; - gsize awaylen = 0; - - char *status_text = NULL; - const char *itmsurl = NULL; - - status_type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(status_type); - - if (!setinfo) - { - /* Do nothing! */ - } - else if (od->rights.maxsiglen == 0) - { - purple_notify_warning(gc, NULL, _("Unable to set AIM profile."), - _("You have probably requested to set your " - "profile before the login procedure completed. " - "Your profile remains unset; try setting it " - "again when you are fully connected.")); - } - else if (rawinfo != NULL) - { - char *htmlinfo = purple_strdup_withhtml(rawinfo); - info = purple_prpl_oscar_convert_to_infotext(htmlinfo, &infolen, &info_encoding); - g_free(htmlinfo); - - if (infolen > od->rights.maxsiglen) - { - gchar *errstr; - errstr = g_strdup_printf(dngettext(PACKAGE, "The maximum profile length of %d byte " - "has been exceeded. It has been truncated for you.", - "The maximum profile length of %d bytes " - "has been exceeded. It has been truncated for you.", - od->rights.maxsiglen), od->rights.maxsiglen); - purple_notify_warning(gc, NULL, _("Profile too long."), errstr); - g_free(errstr); - } - } - - if (setstatus) - { - const char *status_html; - - status_html = purple_status_get_attr_string(status, "message"); - - if (status_html == NULL || primitive == PURPLE_STATUS_AVAILABLE || primitive == PURPLE_STATUS_INVISIBLE) - { - /* This is needed for us to un-set any previous away message. */ - away = g_strdup(""); - } - else - { - gchar *linkified; - - /* We do this for icq too so that they work for old third party clients */ - linkified = purple_markup_linkify(status_html); - away = purple_prpl_oscar_convert_to_infotext(linkified, &awaylen, &away_encoding); - g_free(linkified); - - if (awaylen > od->rights.maxawaymsglen) - { - gchar *errstr; - - errstr = g_strdup_printf(dngettext(PACKAGE, "The maximum away message length of %d byte " - "has been exceeded. It has been truncated for you.", - "The maximum away message length of %d bytes " - "has been exceeded. It has been truncated for you.", - od->rights.maxawaymsglen), od->rights.maxawaymsglen); - purple_notify_warning(gc, NULL, _("Away message too long."), errstr); - g_free(errstr); - } - } - } - - aim_locate_setprofile(od, - info_encoding, info, MIN(infolen, od->rights.maxsiglen), - away_encoding, away, MIN(awaylen, od->rights.maxawaymsglen)); - g_free(info); - g_free(away); - - if (setstatus) - { - const char *status_html; - - status_html = purple_status_get_attr_string(status, "message"); - if (od->icq && (status_html == NULL || status_html[0] == '\0')) - status_html = purple_status_type_get_name(status_type); - if (status_html != NULL) - { - status_text = purple_markup_strip_html(status_html); - /* If the status_text is longer than 251 characters then truncate it */ - if (strlen(status_text) > MAXAVAILMSGLEN) - { - char *tmp = g_utf8_find_prev_char(status_text, &status_text[MAXAVAILMSGLEN - 2]); - strcpy(tmp, "..."); - } - } - - itmsurl = purple_status_get_attr_string(status, "itmsurl"); - - /* TODO: Combine these two calls! */ - aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl); - oscar_set_extendedstatus(gc); - g_free(status_text); - } -} - -static void -oscar_set_status_icq(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - - /* Our permit/deny setting affects our invisibility */ - oscar_set_permit_deny(gc); - - /* - * TODO: I guess we should probably wait and do this after we get - * confirmation from the above SSI call? Right now other people - * see our status blip to "invisible" before we appear offline. - */ - oscar_set_extendedstatus(gc); -} - -void -oscar_set_status(PurpleAccount *account, PurpleStatus *status) -{ - purple_debug_info("oscar", "Set status to %s\n", purple_status_get_name(status)); - - if (!purple_status_is_active(status)) - return; - - if (!purple_account_is_connected(account)) - return; - - /* Set the AIM-style away message for both AIM and ICQ accounts */ - oscar_set_info_and_status(account, FALSE, NULL, TRUE, status); - - /* Set the ICQ status for ICQ accounts only */ - if (oscar_util_valid_name_icq(purple_account_get_username(account))) - oscar_set_status_icq(account); -} - -#ifdef CRAZY_WARN -void -oscar_warn(PurpleConnection *gc, const char *name, gboolean anonymous) { - OscarData *od = purple_connection_get_protocol_data(gc); - aim_im_warn(od, od->conn, name, anonymous ? AIM_WARN_ANON : 0); -} -#endif - -void -oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - OscarData *od; - PurpleAccount *account; - const char *bname, *gname; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - bname = purple_buddy_get_name(buddy); - gname = purple_group_get_name(group); - - if (!oscar_util_valid_name(bname)) { - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), bname); - if (!purple_conv_present_error(bname, account, buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); - - return; - } - - if (od->ssi.received_data) { - if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s\n", bname, gname); - aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); - - /* Mobile users should always be online */ - if (bname[0] == '+') { - purple_prpl_got_user_status(account, bname, - OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, bname, - OSCAR_STATUS_ID_MOBILE, NULL); - } - } else if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, bname), - bname)) { - /* Not authorized -- Re-request authorization */ - purple_auth_sendrequest(gc, bname); - } - } - - /* XXX - Should this be done from AIM accounts, as well? */ - if (od->icq) - aim_icq_getalias(od, bname); -} - -void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - const char *gname = purple_group_get_name(group); - const char *bname = purple_buddy_get_name(buddy); - purple_debug_info("oscar", - "ssi: deleting buddy %s from group %s\n", bname, gname); - aim_ssi_delbuddy(od, bname, gname); - } -} - -void oscar_move_buddy(PurpleConnection *gc, const char *name, const char *old_group, const char *new_group) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data && strcmp(old_group, new_group)) { - purple_debug_info("oscar", - "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); - aim_ssi_movebuddy(od, old_group, new_group, name); - } -} - -void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - if (gname) { - purple_debug_info("oscar", - "ssi: changing the alias for buddy %s to %s\n", name, alias ? alias : "(none)"); - aim_ssi_aliasbuddy(od, gname, name, alias); - } - } -} - -/* - * FYI, the OSCAR SSI code removes empty groups automatically. - */ -void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - const char *gname = purple_group_get_name(group); - if (aim_ssi_itemlist_finditem(od->ssi.local, gname, NULL, AIM_SSI_TYPE_GROUP)) { - GList *cur, *groups = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - - /* Make a list of what the groups each buddy is in */ - for (cur = moved_buddies; cur != NULL; cur = cur->next) { - PurpleBlistNode *node = cur->data; - /* node is PurpleBuddy, parent is a PurpleContact. - * We must go two levels up to get the Group */ - groups = g_list_append(groups, - purple_buddy_get_group((PurpleBuddy*)node)); - } - - purple_account_remove_buddies(account, moved_buddies, groups); - purple_account_add_buddies(account, moved_buddies); - g_list_free(groups); - purple_debug_info("oscar", - "ssi: moved all buddies from group %s to %s\n", old_name, gname); - } else { - aim_ssi_rename_group(od, old_name, gname); - purple_debug_info("oscar", - "ssi: renamed group %s to %s\n", old_name, gname); - } - } -} - -void oscar_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - aim_ssi_delgroup(purple_connection_get_protocol_data(gc), purple_group_get_name(group)); -} - -static gboolean purple_ssi_rerequestdata(gpointer data) { - OscarData *od = data; - - aim_ssi_reqdata(od); - - return TRUE; -} - -static int purple_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 reason; - - va_start(ap, fr); - reason = (guint16)va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_error("oscar", "ssi: SNAC error %hu\n", reason); - - if (reason == 0x0005) { - if (od->getblisttimer > 0) - purple_timeout_remove(od->getblisttimer); - else - /* We only show this error the first time it happens */ - purple_notify_error(gc, NULL, - _("Unable to Retrieve Buddy List"), - _("The AIM servers were temporarily unable to send " - "your buddy list. Your buddy list is not lost, and " - "will probably become available in a few minutes.")); - od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od); - return 1; - } - - oscar_set_status_icq(purple_connection_get_account(gc)); - - return 1; -} - -static int purple_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - int i; - va_list ap; - int numtypes; - guint16 *maxitems; - GString *msg; - - va_start(ap, fr); - numtypes = va_arg(ap, int); - maxitems = va_arg(ap, guint16 *); - va_end(ap); - - msg = g_string_new("ssi rights:"); - for (i=0; istr); - g_string_free(msg, TRUE); - - if (numtypes >= 0) - od->rights.maxbuddies = maxitems[0]; - if (numtypes >= 1) - od->rights.maxgroups = maxitems[1]; - if (numtypes >= 2) - od->rights.maxpermits = maxitems[2]; - if (numtypes >= 3) - od->rights.maxdenies = maxitems[3]; - - return 1; -} - -static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - PurpleGroup *g; - PurpleBuddy *b; - struct aim_ssi_item *curitem; - guint32 tmp; - PurpleStoredImage *img; - va_list ap; - guint16 fmtver, numitems; - guint32 timestamp; - - gc = od->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - va_start(ap, fr); - fmtver = (guint16)va_arg(ap, int); - numitems = (guint16)va_arg(ap, int); - timestamp = va_arg(ap, guint32); - va_end(ap); - - /* Don't attempt to re-request our buddy list later */ - if (od->getblisttimer != 0) - purple_timeout_remove(od->getblisttimer); - od->getblisttimer = 0; - - purple_debug_info("oscar", - "ssi: syncing local list and server list\n"); - - /* Clean the buddy list */ - aim_ssi_cleanlist(od); - - { /* If not in server list then prune from local list */ - GSList *cur, *next; - GSList *buddies = purple_find_buddies(account, NULL); - - /* Buddies */ - cur = NULL; - - while(buddies) { - PurpleGroup *g; - const char *gname; - const char *bname; - - b = buddies->data; - g = purple_buddy_get_group(b); - gname = purple_group_get_name(g); - bname = purple_buddy_get_name(b); - - if (aim_ssi_itemlist_exists(od->ssi.local, bname)) { - /* If the buddy is an ICQ user then load his nickname */ - const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"); - char *alias; - const char *balias; - if (servernick) - serv_got_alias(gc, bname, servernick); - - /* Store local alias on server */ - alias = aim_ssi_getalias(od->ssi.local, gname, bname); - balias = purple_buddy_get_local_buddy_alias(b); - if (!alias && balias && *balias) - aim_ssi_aliasbuddy(od, gname, bname, balias); - g_free(alias); - } else { - purple_debug_info("oscar", - "ssi: removing buddy %s from local list\n", bname); - /* We can't actually remove now because it will screw up our looping */ - cur = g_slist_prepend(cur, b); - } - buddies = g_slist_delete_link(buddies, buddies); - } - - while (cur != NULL) { - b = cur->data; - cur = g_slist_remove(cur, b); - purple_blist_remove_buddy(b); - } - - /* Permit list */ - if (account->permit) { - next = account->permit; - while (next != NULL) { - cur = next; - next = next->next; - if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { - purple_debug_info("oscar", - "ssi: removing permit %s from local list\n", (const char *)cur->data); - purple_privacy_permit_remove(account, cur->data, TRUE); - } - } - } - - /* Deny list */ - if (account->deny) { - next = account->deny; - while (next != NULL) { - cur = next; - next = next->next; - if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { - purple_debug_info("oscar", - "ssi: removing deny %s from local list\n", (const char *)cur->data); - purple_privacy_deny_remove(account, cur->data, TRUE); - } - } - } - /* Presence settings (idle time visibility) */ - tmp = aim_ssi_getpresence(od->ssi.local); - if (tmp != 0xFFFFFFFF) { - const char *idle_reporting_pref; - gboolean report_idle; - - idle_reporting_pref = purple_prefs_get_string("/purple/away/idle_reporting"); - report_idle = strcmp(idle_reporting_pref, "none") != 0; - - if (report_idle) - aim_ssi_setpresence(od, tmp | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); - else - aim_ssi_setpresence(od, tmp & ~AIM_SSI_PRESENCE_FLAG_SHOWIDLE); - } - - - } /* end pruning buddies from local list */ - - /* Add from server list to local list */ - for (curitem=od->ssi.local; curitem; curitem=curitem->next) { - if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) - switch (curitem->type) { - case AIM_SSI_TYPE_BUDDY: { /* Buddy */ - if (curitem->name) { - struct aim_ssi_item *groupitem; - char *gname, *gname_utf8, *alias, *alias_utf8; - - groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000); - gname = groupitem ? groupitem->name : NULL; - if (gname != NULL) { - if (g_utf8_validate(gname, -1, NULL)) - gname_utf8 = g_strdup(gname); - else - gname_utf8 = oscar_utf8_try_convert(account, gname); - } else - gname_utf8 = NULL; - - g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")); - if (g == NULL) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); - purple_blist_add_group(g, NULL); - } - - alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name); - if (alias != NULL) { - if (g_utf8_validate(alias, -1, NULL)) - alias_utf8 = g_strdup(alias); - else - alias_utf8 = oscar_utf8_try_convert(account, alias); - g_free(alias); - } else - alias_utf8 = NULL; - - b = purple_find_buddy_in_group(account, curitem->name, g); - if (b) { - /* Get server stored alias */ - purple_blist_alias_buddy(b, alias_utf8); - } else { - b = purple_buddy_new(account, curitem->name, alias_utf8); - - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); - purple_blist_add_buddy(b, NULL, g, NULL); - } - if (!oscar_util_name_compare(curitem->name, purple_account_get_username(account))) { - char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name); - if (comment != NULL) - { - purple_check_comment(od, comment); - g_free(comment); - } - } - - /* Mobile users should always be online */ - if (curitem->name[0] == '+') { - purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_MOBILE, NULL); - } - - g_free(gname_utf8); - g_free(alias_utf8); - } - } break; - - case AIM_SSI_TYPE_GROUP: { /* Group */ - char *gname; - char *gname_utf8; - - gname = curitem->name; - if (gname != NULL) { - if (g_utf8_validate(gname, -1, NULL)) - gname_utf8 = g_strdup(gname); - else - gname_utf8 = oscar_utf8_try_convert(account, gname); - } else - gname_utf8 = NULL; - - if (gname_utf8 != NULL && purple_find_group(gname_utf8) == NULL) { - g = purple_group_new(gname_utf8); - purple_blist_add_group(g, NULL); - } - g_free(gname_utf8); - } break; - - case AIM_SSI_TYPE_PERMIT: { /* Permit buddy */ - if (curitem->name) { - /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ - GSList *list; - for (list=account->permit; (list && oscar_util_name_compare(curitem->name, list->data)); list=list->next); - if (!list) { - purple_debug_info("oscar", - "ssi: adding permit buddy %s to local list\n", curitem->name); - purple_privacy_permit_add(account, curitem->name, TRUE); - } - } - } break; - - case AIM_SSI_TYPE_DENY: { /* Deny buddy */ - if (curitem->name) { - GSList *list; - for (list=account->deny; (list && oscar_util_name_compare(curitem->name, list->data)); list=list->next); - if (!list) { - purple_debug_info("oscar", - "ssi: adding deny buddy %s to local list\n", curitem->name); - purple_privacy_deny_add(account, curitem->name, TRUE); - } - } - } break; - - case AIM_SSI_TYPE_PDINFO: { /* Permit/deny setting */ - /* - * We don't inherit the permit/deny setting from the server - * for ICQ because, for ICQ, this setting controls who can - * see your online status when you are invisible. Thus it is - * a part of your status and not really related to blocking. - */ - if (!od->icq && curitem->data) { - guint8 perm_deny = aim_ssi_getpermdeny(od->ssi.local); - if (perm_deny != 0 && perm_deny != account->perm_deny) - { - purple_debug_info("oscar", - "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, perm_deny); - account->perm_deny = perm_deny; - } - } - } break; - - case AIM_SSI_TYPE_PRESENCEPREFS: { /* Presence setting */ - /* We don't want to change Purple's setting because it applies to all accounts */ - } break; - } /* End of switch on curitem->type */ - } /* End of for loop */ - - oscar_set_status_icq(account); - - /* Activate SSI */ - /* Sending the enable causes other people to be able to see you, and you to see them */ - /* Make sure your privacy setting/invisibility is set how you want it before this! */ - purple_debug_info("oscar", - "ssi: activating server-stored buddy list\n"); - aim_ssi_enable(od); - - /* - * Make sure our server-stored icon is updated correctly in - * the event that the local user set a new icon while this - * account was offline. - */ - img = purple_buddy_icons_find_account_icon(account); - oscar_set_icon(gc, img); - purple_imgstore_unref(img); - - /* - * If we've already received our bos rights then we're not waiting on - * anything else, so send the server clientready. - */ - if (od->bos.have_rights) { - aim_srv_clientready(od, conn); - - /* Request offline messages for AIM and ICQ */ - aim_im_reqofflinemsgs(od); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - } - - return 1; -} - -static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - struct aim_ssi_tmp *retval; - - va_start(ap, fr); - retval = va_arg(ap, struct aim_ssi_tmp *); - va_end(ap); - - while (retval) { - purple_debug_misc("oscar", - "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item"); - - if (retval->ack != 0xffff) - switch (retval->ack) { - case 0x0000: { /* added successfully */ - } break; - - case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); - if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - } - - case 0x000e: { /* buddy requires authorization */ - if ((retval->action == SNAC_SUBTYPE_FEEDBAG_ADD) && (retval->name)) - purple_auth_sendrequest(gc, retval->name); - } break; - - default: { /* La la la */ - gchar *buf; - purple_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); - buf = g_strdup_printf(_("Unable to add the buddy %s for an unknown reason."), - (retval->name ? retval->name : _("(no name)"))); - if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - } break; - } - - retval = retval->next; - } - - return 1; -} - -static int -purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - char *gname, *gname_utf8, *alias, *alias_utf8; - PurpleBuddy *b; - PurpleGroup *g; - struct aim_ssi_item *ssi_item; - va_list ap; - guint16 snac_subtype, type; - const char *name; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - snac_subtype = (guint16)va_arg(ap, int); - type = (guint16)va_arg(ap, int); - name = va_arg(ap, char *); - va_end(ap); - - if ((type != 0x0000) || (name == NULL)) - return 1; - - gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - gname_utf8 = gname ? oscar_utf8_try_convert(account, gname) : NULL; - - alias = aim_ssi_getalias(od->ssi.local, gname, name); - if (alias != NULL) - { - if (g_utf8_validate(alias, -1, NULL)) - alias_utf8 = g_strdup(alias); - else - alias_utf8 = oscar_utf8_try_convert(account, alias); - } - else - alias_utf8 = NULL; - g_free(alias); - - b = purple_find_buddy(account, name); - if (b) { - /* - * You're logged in somewhere else and you aliased one - * of your buddies, so update our local buddy list with - * the person's new alias. - */ - purple_blist_alias_buddy(b, alias_utf8); - } else if (snac_subtype == 0x0008) { - /* - * You're logged in somewhere else and you added a buddy to - * your server list, so add them to your local buddy list. - */ - b = purple_buddy_new(account, name, alias_utf8); - - if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); - purple_blist_add_group(g, NULL); - } - - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); - purple_blist_add_buddy(b, NULL, g, NULL); - - /* Mobile users should always be online */ - if (name[0] == '+') { - purple_prpl_got_user_status(account, - name, OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - name, OSCAR_STATUS_ID_MOBILE, NULL); - } - - } - - ssi_item = aim_ssi_itemlist_finditem(od->ssi.local, - gname, name, AIM_SSI_TYPE_BUDDY); - if (ssi_item == NULL) - { - purple_debug_error("oscar", "purple_ssi_parseaddmod: " - "Could not find ssi item for oncoming buddy %s, " - "group %s\n", name, gname); - } - - g_free(gname_utf8); - g_free(alias_utf8); - - return 1; -} - -static int purple_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn, *msg; - gchar *dialog_msg, *nombre; - struct name_data *data; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", - "ssi: %s has given you permission to add him to your buddy list\n", bn); - - buddy = purple_find_buddy(purple_connection_get_account(gc), bn); - if (buddy && (purple_buddy_get_alias_only(buddy))) - nombre = g_strdup_printf("%s (%s)", bn, purple_buddy_get_alias_only(buddy)); - else - nombre = g_strdup(bn); - - dialog_msg = g_strdup_printf(_("The user %s has given you permission to add him or her to your buddy list. Do you want to add this user?"), nombre); - g_free(nombre); - - data = g_new(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(bn); - data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); - - purple_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), bn, NULL, - data, - G_CALLBACK(purple_icq_buddyadd), - G_CALLBACK(oscar_free_name_data)); - g_free(dialog_msg); - - return 1; -} - -static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn; - char *msg; - PurpleAccount *account = purple_connection_get_account(gc); - gchar *reason = NULL; - struct name_data *data; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", - "ssi: received authorization request from %s\n", bn); - - buddy = purple_find_buddy(account, bn); - - if (msg != NULL) - reason = purple_plugin_oscar_decode_im_part(account, bn, AIM_CHARSET_LATIN_1, 0x0000, msg, strlen(msg)); - - data = g_new(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(bn); - data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); - - purple_account_request_authorization(account, bn, NULL, - (buddy ? purple_buddy_get_alias_only(buddy) : NULL), - reason, buddy != NULL, purple_auth_grant, - purple_auth_dontgrant_msgprompt, data); - g_free(reason); - - return 1; -} - -static int purple_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn, *msg; - gchar *dialog_msg, *nombre; - guint8 reply; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - reply = (guint8)va_arg(ap, int); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", - "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", bn, reply); - - buddy = purple_find_buddy(purple_connection_get_account(gc), bn); - if (buddy && (purple_buddy_get_alias_only(buddy))) - nombre = g_strdup_printf("%s (%s)", bn, purple_buddy_get_alias_only(buddy)); - else - nombre = g_strdup(bn); - - if (reply) { - /* Granted */ - dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre); - purple_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); - } else { - /* Denied */ - dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); - purple_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); - } - g_free(dialog_msg); - g_free(nombre); - - return 1; -} - -static int purple_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - va_list ap; - char *bn; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - va_end(ap); - - buddy = purple_find_buddy(account, bn); - purple_debug_info("oscar", "ssi: %s added you to their buddy list\n", bn); - purple_account_notify_added(account, bn, NULL, - (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL); - - return 1; -} - -GList *oscar_chat_info(PurpleConnection *gc) { - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Room:"); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Exchange:"); - pce->identifier = "exchange"; - pce->required = TRUE; - pce->is_int = TRUE; - pce->min = 4; - pce->max = 20; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *oscar_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "room", g_strdup(chat_name)); - g_hash_table_insert(defaults, "exchange", g_strdup("4")); - - return defaults; -} - -char * -oscar_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "room")); -} - -void -oscar_join_chat(PurpleConnection *gc, GHashTable *data) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - FlapConnection *conn; - char *name, *exchange; - int exchange_int; - - name = g_hash_table_lookup(data, "room"); - exchange = g_hash_table_lookup(data, "exchange"); - - g_return_if_fail(name != NULL && *name != '\0'); - g_return_if_fail(exchange != NULL); - - errno = 0; - exchange_int = strtol(exchange, NULL, 10); - g_return_if_fail(errno == 0); - - purple_debug_info("oscar", "Attempting to join chat room %s.\n", name); - - if ((conn = flap_connection_getbytype(od, SNAC_FAMILY_CHATNAV))) - { - purple_debug_info("oscar", "chatnav exists, creating room\n"); - aim_chatnav_createroom(od, conn, name, exchange_int); - } else { - /* this gets tricky */ - struct create_room *cr = g_new0(struct create_room, 1); - purple_debug_info("oscar", "chatnav does not exist, opening chatnav\n"); - cr->exchange = exchange_int; - cr->name = g_strdup(name); - od->create_rooms = g_slist_prepend(od->create_rooms, cr); - aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); - } -} - -void -oscar_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - struct chat_connection *ccon = find_oscar_chat(gc, id); - - if (ccon == NULL) - return; - - aim_im_sendch2_chatinvite(od, name, message ? message : "", - ccon->exchange, ccon->name, 0x0); -} - -void -oscar_chat_leave(PurpleConnection *gc, int id) -{ - PurpleConversation *conv; - struct chat_connection *cc; - - conv = purple_find_chat(gc, id); - - g_return_if_fail(conv != NULL); - - purple_debug_info("oscar", "Leaving chat room %s\n", - purple_conversation_get_name(conv)); - - cc = find_oscar_chat(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); - oscar_chat_kill(gc, cc); -} - -int oscar_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleConversation *conv = NULL; - struct chat_connection *c = NULL; - char *buf, *buf2, *buf3; - guint16 charset, charsubset; - char *charsetstr = NULL; - int len; - - if (!(conv = purple_find_chat(gc, id))) - return -EINVAL; - - if (!(c = find_oscar_chat_by_conv(gc, conv))) - return -EINVAL; - - buf = purple_strdup_withhtml(message); - - if (strstr(buf, " c->maxlen) || (len > c->maxvis)) { - /* If the length was too long, try stripping the HTML and then running it back through - * purple_strdup_withhtml() and the encoding process. The result may be shorter. */ - g_free(buf2); - - buf3 = purple_markup_strip_html(buf); - g_free(buf); - - buf = purple_strdup_withhtml(buf3); - g_free(buf3); - - purple_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset); - - if ((len > c->maxlen) || (len > c->maxvis)) { - purple_debug_warning("oscar", "Could not send %s because (%i > maxlen %i) or (%i > maxvis %i)\n", - buf2, len, c->maxlen, len, c->maxvis); - g_free(buf); - g_free(buf2); - return -E2BIG; - } - - purple_debug_info("oscar", "Sending %s as %s because the original was too long.\n", - message, buf2); - } - - if (charset == AIM_CHARSET_ASCII) - charsetstr = "us-ascii"; - else if (charset == AIM_CHARSET_UNICODE) - charsetstr = "unicode-2-0"; - else if (charset == AIM_CHARSET_LATIN_1) - charsetstr = "iso-8859-1"; - aim_chat_send_im(od, c->conn, 0, buf2, len, charsetstr, "en"); - g_free(buf2); - g_free(buf); - - return 0; -} - -const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b) -{ - const char *name = b ? purple_buddy_get_name(b) : NULL; - if ((b == NULL) || (name == NULL) || oscar_util_valid_name_sms(name)) - { - if (a == NULL || oscar_util_valid_name_icq(purple_account_get_username(a))) - return "icq"; - else - return "aim"; - } - - if (oscar_util_valid_name_icq(name)) - return "icq"; - return "aim"; -} - -const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b) -{ - const char *name = b ? purple_buddy_get_name(b) : NULL; - if ((b == NULL) || (name == NULL) || oscar_util_valid_name_sms(name)) - { - if (a != NULL && oscar_util_valid_name_icq(purple_account_get_username(a))) - return "icq"; - else - return "aim"; - } - - if (oscar_util_valid_name_icq(name)) - return "icq"; - return "aim"; -} - -const char *oscar_list_emblem(PurpleBuddy *b) -{ - PurpleConnection *gc = NULL; - OscarData *od = NULL; - PurpleAccount *account = NULL; - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - aim_userinfo_t *userinfo = NULL; - const char *name; - - account = purple_buddy_get_account(b); - name = purple_buddy_get_name(b); - if (account != NULL) - gc = purple_account_get_connection(account); - if (gc != NULL) - od = purple_connection_get_protocol_data(gc); - if (od != NULL) - userinfo = aim_locate_finduserinfo(od, name); - - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); - - if (purple_presence_is_online(presence) == FALSE) { - char *gname; - if ((name) && (od) && (od->ssi.received_data) && - (gname = aim_ssi_itemlist_findparentname(od->ssi.local, name)) && - (aim_ssi_waitingforauth(od->ssi.local, gname, name))) { - return "not-authorized"; - } - } - - if (userinfo != NULL ) { - if (userinfo->flags & AIM_FLAG_ADMINISTRATOR) - return "admin"; - if (userinfo->flags & AIM_FLAG_ACTIVEBUDDY) - return "bot"; - if (userinfo->capabilities & OSCAR_CAPABILITY_HIPTOP) - return "hiptop"; - if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM) - return "secure"; - if (userinfo->icqinfo.status & AIM_ICQ_STATE_BIRTHDAY) - return "birthday"; - } - return NULL; -} - -void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurpleConnection *gc; - PurpleAccount *account; - OscarData *od; - aim_userinfo_t *userinfo; - - if (!PURPLE_BUDDY_IS_ONLINE(b)) - return; - - account = purple_buddy_get_account(b); - gc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(gc); - userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); - - oscar_user_info_append_status(gc, user_info, b, userinfo, /* strip_html_tags */ TRUE); - - if (full) - oscar_user_info_append_extra_info(gc, user_info, b, userinfo); -} - -char *oscar_status_text(PurpleBuddy *b) -{ - PurpleConnection *gc; - PurpleAccount *account; - OscarData *od; - const PurplePresence *presence; - const PurpleStatus *status; - const char *id; - const char *message; - gchar *ret = NULL; - - gc = purple_account_get_connection(purple_buddy_get_account(b)); - account = purple_connection_get_account(gc); - od = purple_connection_get_protocol_data(gc); - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - id = purple_status_get_id(status); - - if ((od != NULL) && !purple_presence_is_online(presence)) - { - const char *name = purple_buddy_get_name(b); - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - if (aim_ssi_waitingforauth(od->ssi.local, gname, name)) - ret = g_strdup(_("Not Authorized")); - else - ret = g_strdup(_("Offline")); - } - else - { - message = purple_status_get_attr_string(status, "message"); - if (message != NULL) - { - gchar *tmp1, *tmp2; - tmp1 = purple_markup_strip_html(message); - purple_util_chrreplace(tmp1, '\n', ' '); - tmp2 = g_markup_escape_text(tmp1, -1); - ret = purple_str_sub_away_formatters(tmp2, purple_account_get_username(account)); - g_free(tmp1); - g_free(tmp2); - } - else if (purple_status_is_available(status)) - { - /* Don't show "Available" as status message in case buddy doesn't have a status message */ - } - else - { - ret = g_strdup(purple_status_get_name(status)); - } - } - - return ret; -} - - -static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 type; - guint8 flags = 0, length = 0; - guchar *md5 = NULL; - - va_start(ap, fr); - type = va_arg(ap, int); - - switch(type) { - case 0x0000: - case 0x0001: { - flags = va_arg(ap, int); - length = va_arg(ap, int); - md5 = va_arg(ap, guchar *); - - if ((flags == 0x00) || (flags == 0x41)) { - if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { - od->iconconnecting = TRUE; - od->set_icon = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_BART); - } else { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) { - aim_ssi_delicon(od); - } else { - - purple_debug_info("oscar", - "Uploading icon to icon server\n"); - aim_bart_upload(od, purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_imgstore_unref(img); - } - } - } else if (flags == 0x81) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) - aim_ssi_delicon(od); - else { - aim_ssi_seticon(od, md5, length); - purple_imgstore_unref(img); - } - } - } break; - - case 0x0002: { /* We just set an "available" message? */ - } break; - } - - va_end(ap); - - return 0; -} - -void oscar_set_permit_deny(PurpleConnection *gc) { - PurpleAccount *account = purple_connection_get_account(gc); - OscarData *od = purple_connection_get_protocol_data(gc); - PurplePrivacyType perm_deny; - - /* - * For ICQ the permit/deny setting controls who you can see you - * online when you set your status to "invisible." If we're ICQ - * and we're invisible then we need to use one of - * PURPLE_PRIVACY_ALLOW_USERS or PURPLE_PRIVACY_ALLOW_BUDDYLIST or - * PURPLE_PRIVACY_DENY_USERS if we actually want to be invisible - * to anyone. - * - * These three permit/deny settings correspond to: - * 1. Invisible to everyone except the people on my "permit" list - * 2. Invisible to everyone except the people on my buddy list - * 3. Invisible only to the people on my "deny" list - * - * It would be nice to allow cases 2 and 3, but our UI doesn't have - * a nice way to do it. For now we just force case 1. - */ - if (od->icq && purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE)) - perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - else - perm_deny = account->perm_deny; - - if (od->ssi.received_data) - /* - * Conveniently there is a one-to-one mapping between the - * values of libpurple's PurplePrivacyType and the values used - * by the oscar protocol. - */ - aim_ssi_setpermdeny(od, perm_deny, 0xffffffff); -} - -void oscar_add_permit(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to add a permit\n"); - if (od->ssi.received_data) - aim_ssi_addpermit(od, who); -} - -void oscar_add_deny(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to add a deny\n"); - if (od->ssi.received_data) - aim_ssi_adddeny(od, who); -} - -void oscar_rem_permit(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to delete a permit\n"); - if (od->ssi.received_data) - aim_ssi_delpermit(od, who); -} - -void oscar_rem_deny(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to delete a deny\n"); - if (od->ssi.received_data) - aim_ssi_deldeny(od, who); -} - -GList * -oscar_status_types(PurpleAccount *account) -{ - gboolean is_icq; - GList *status_types = NULL; - PurpleStatusType *type; - - g_return_val_if_fail(account != NULL, NULL); - - /* Used to flag some statuses as "user settable" or not */ - is_icq = oscar_util_valid_name_icq(purple_account_get_username(account)); - - /* Common status types */ - /* Really the available message should only be settable for AIM accounts */ - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - OSCAR_STATUS_ID_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), - "itmsurl", _("iTunes Music Store Link"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, - OSCAR_STATUS_ID_FREE4CHAT, - _("Free For Chat"), TRUE, is_icq, FALSE); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - OSCAR_STATUS_ID_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - OSCAR_STATUS_ID_INVISIBLE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE); - status_types = g_list_prepend(status_types, type); - - /* ICQ-specific status types */ - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - OSCAR_STATUS_ID_OCCUPIED, - _("Occupied"), TRUE, is_icq, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - OSCAR_STATUS_ID_DND, - _("Do Not Disturb"), TRUE, is_icq, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY, - OSCAR_STATUS_ID_NA, - _("Not Available"), TRUE, is_icq, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - OSCAR_STATUS_ID_OFFLINE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_prepend(status_types, type); - - status_types = g_list_reverse(status_types); - - return status_types; -} - -static void oscar_ssi_editcomment(struct name_data *data, const char *text) { - PurpleConnection *gc; - PurpleAccount *account; - OscarData *od; - PurpleBuddy *b; - PurpleGroup *g; - const char *username; - - gc = data->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - b = purple_find_buddy(account, data->name); - if (b == NULL) { - oscar_free_name_data(data); - return; - } - - g = purple_buddy_get_group(b); - if (g == NULL) { - oscar_free_name_data(data); - return; - } - - aim_ssi_editcomment(od, purple_group_get_name(g), data->name, text); - - username = purple_account_get_username(account); - if (!oscar_util_name_compare(data->name, username)) - purple_check_comment(od, text); - - oscar_free_name_data(data); -} - -static void oscar_buddycb_edit_comment(PurpleBlistNode *node, gpointer ignore) { - - PurpleBuddy *buddy; - PurpleConnection *gc; - OscarData *od; - struct name_data *data; - PurpleGroup *g; - char *comment; - gchar *comment_utf8; - gchar *title; - PurpleAccount *account; - const char *name; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - name = purple_buddy_get_name(buddy); - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(gc); - - if (!(g = purple_buddy_get_group(buddy))) - return; - - data = g_new(struct name_data, 1); - - comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), name); - comment_utf8 = comment ? oscar_utf8_try_convert(account, comment) : NULL; - - data->gc = gc; - data->name = g_strdup(name); - data->nick = g_strdup(purple_buddy_get_alias_only(buddy)); - - title = g_strdup_printf(_("Buddy Comment for %s"), data->name); - purple_request_input(gc, title, _("Buddy Comment:"), NULL, - comment_utf8, TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(oscar_ssi_editcomment), - _("_Cancel"), G_CALLBACK(oscar_free_name_data), - account, data->name, NULL, - data); - g_free(title); - - g_free(comment); - g_free(comment_utf8); -} - -static void -oscar_ask_directim_yes_cb(struct oscar_ask_directim_data *data) -{ - peer_connection_propose(data->od, OSCAR_CAPABILITY_DIRECTIM, data->who); - g_free(data->who); - g_free(data); -} - -static void -oscar_ask_directim_no_cb(struct oscar_ask_directim_data *data) -{ - g_free(data->who); - g_free(data); -} - -/* This is called from right-click menu on a buddy node. */ -static void -oscar_ask_directim(gpointer object, gpointer ignored) -{ - PurpleBlistNode *node; - PurpleBuddy *buddy; - PurpleConnection *gc; - gchar *buf; - struct oscar_ask_directim_data *data; - PurpleAccount *account; - - node = object; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - - data = g_new0(struct oscar_ask_directim_data, 1); - data->who = g_strdup(purple_buddy_get_name(buddy)); - data->od = purple_connection_get_protocol_data(gc); - buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), - data->who); - - purple_request_action(gc, NULL, buf, - _("Because this reveals your IP address, it " - "may be considered a security risk. Do you " - "wish to continue?"), - 0, /* Default action is "connect" */ - account, data->who, NULL, - data, 2, - _("C_onnect"), G_CALLBACK(oscar_ask_directim_yes_cb), - _("_Cancel"), G_CALLBACK(oscar_ask_directim_no_cb)); - g_free(buf); -} - -static void -oscar_close_directim(gpointer object, gpointer ignored) -{ - PurpleBlistNode *node; - PurpleBuddy *buddy; - PurpleAccount *account; - PurpleConnection *gc; - PurpleConversation *conv; - OscarData *od; - PeerConnection *conn; - const char *name; - - node = object; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy*)node; - name = purple_buddy_get_name(buddy); - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - od = gc->proto_data; - conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); - - if (conn != NULL) - { - if (!conn->ready) - aim_im_sendch2_cancel(conn); - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - - /* OSCAR_DISCONNECT_LOCAL_CLOSED doesn't write anything to the convo - * window. Let the user know that we canceled the Direct IM. */ - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); - purple_conversation_write(conv, NULL, _("You closed the connection."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } -} - -static void -oscar_get_aim_info_cb(PurpleBlistNode *node, gpointer ignore) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - aim_locate_getinfoshort(purple_connection_get_protocol_data(gc), - purple_buddy_get_name(buddy), 0x00000003); -} - -static GList * -oscar_buddy_menu(PurpleBuddy *buddy) { - - PurpleConnection *gc; - OscarData *od; - GList *menu; - PurpleMenuAction *act; - aim_userinfo_t *userinfo; - PurpleAccount *account; - const char *bname = purple_buddy_get_name(buddy); - - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(gc); - userinfo = aim_locate_finduserinfo(od, bname); - menu = NULL; - - if (od->icq && oscar_util_valid_name_icq(bname)) - { - act = purple_menu_action_new(_("Get AIM Info"), - PURPLE_CALLBACK(oscar_get_aim_info_cb), - NULL, NULL); - menu = g_list_prepend(menu, act); - } - - if (purple_buddy_get_group(buddy) != NULL) - { - /* We only do this if the user is in our buddy list */ - act = purple_menu_action_new(_("Edit Buddy Comment"), - PURPLE_CALLBACK(oscar_buddycb_edit_comment), - NULL, NULL); - menu = g_list_prepend(menu, act); - } - -#if 0 - if (od->icq) - { - act = purple_menu_action_new(_("Get Status Msg"), - PURPLE_CALLBACK(oscar_get_icqstatusmsg), - NULL, NULL); - menu = g_list_prepend(menu, act); - } -#endif - - if (userinfo && - oscar_util_name_compare(purple_account_get_username(account), bname) && - PURPLE_BUDDY_IS_ONLINE(buddy)) - { - PeerConnection *conn; - conn = peer_connection_find_by_type(od, bname, OSCAR_CAPABILITY_DIRECTIM); - - if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) - { - if (conn) - { - act = purple_menu_action_new(_("End Direct IM Session"), - PURPLE_CALLBACK(oscar_close_directim), - NULL, NULL); - } - else - { - act = purple_menu_action_new(_("Direct IM"), - PURPLE_CALLBACK(oscar_ask_directim), - NULL, NULL); - } - menu = g_list_prepend(menu, act); - } -#if 0 - /* TODO: This menu item should be added by the core */ - if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) { - act = purple_menu_action_new(_("Get File"), - PURPLE_CALLBACK(oscar_ask_getfile), - NULL, NULL); - menu = g_list_prepend(menu, act); - } -#endif - } - - if (od->ssi.received_data && purple_buddy_get_group(buddy) != NULL) - { - /* - * We only do this if the user is in our buddy list and we're - * waiting for authorization. - */ - char *gname; - gname = aim_ssi_itemlist_findparentname(od->ssi.local, bname); - if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) - { - act = purple_menu_action_new(_("Re-request Authorization"), - PURPLE_CALLBACK(purple_auth_sendrequest_menu), - NULL, NULL); - menu = g_list_prepend(menu, act); - } - } - - menu = g_list_reverse(menu); - - return menu; -} - - -GList *oscar_blist_node_menu(PurpleBlistNode *node) { - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return oscar_buddy_menu((PurpleBuddy *) node); - } else { - return NULL; - } -} - -static void -oscar_icq_privacy_opts(PurpleConnection *gc, PurpleRequestFields *fields) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleAccount *account = purple_connection_get_account(gc); - PurpleRequestField *f; - gboolean auth, web_aware; - - f = purple_request_fields_get_field(fields, "authorization"); - auth = purple_request_field_bool_get_value(f); - - f = purple_request_fields_get_field(fields, "web_aware"); - web_aware = purple_request_field_bool_get_value(f); - - purple_account_set_bool(account, "authorization", auth); - purple_account_set_bool(account, "web_aware", web_aware); - - oscar_set_extendedstatus(gc); - aim_icq_setsecurity(od, auth, web_aware); -} - -static void -oscar_show_icq_privacy_opts(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - gboolean auth, web_aware; - - auth = purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION); - web_aware = purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - - f = purple_request_field_bool_new("authorization", _("Require authorization"), auth); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware); - purple_request_field_group_add_field(g, f); - - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"), - NULL, fields, - _("OK"), G_CALLBACK(oscar_icq_privacy_opts), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -void oscar_format_username(PurpleConnection *gc, const char *nick) { - OscarData *od = purple_connection_get_protocol_data(gc); - if (!oscar_util_name_compare(purple_account_get_username(purple_connection_get_account(gc)), nick)) { - if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) { - od->setnick = TRUE; - g_free(od->newformatting); - od->newformatting = g_strdup(nick); - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } else { - aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick); - } - } else { - purple_notify_error(gc, NULL, _("The new formatting is invalid."), - _("Username formatting can change only capitalization and whitespace.")); - } -} - -static void oscar_confirm_account(PurplePluginAction *action) -{ - PurpleConnection *gc; - OscarData *od; - FlapConnection *conn; - - gc = (PurpleConnection *)action->context; - od = purple_connection_get_protocol_data(gc); - - conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - if (conn != NULL) { - aim_admin_reqconfirm(od, conn); - } else { - od->conf = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } -} - -static void oscar_show_email(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - OscarData *od = purple_connection_get_protocol_data(gc); - FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - - if (conn) { - aim_admin_getinfo(od, conn, 0x11); - } else { - od->reqemail = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } -} - -static void oscar_change_email(PurpleConnection *gc, const char *email) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - - if (conn) { - aim_admin_setemail(od, conn, email); - } else { - od->setemail = TRUE; - od->email = g_strdup(email); - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } -} - -static void oscar_show_change_email(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, - FALSE, FALSE, NULL, - _("_OK"), G_CALLBACK(oscar_change_email), - _("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void oscar_show_awaitingauth(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - OscarData *od = purple_connection_get_protocol_data(gc); - gchar *text, *tmp; - GSList *buddies; - PurpleAccount *account; - int num=0; - - text = g_strdup(""); - account = purple_connection_get_account(gc); - - buddies = purple_find_buddies(account, NULL); - while (buddies) { - PurpleBuddy *buddy; - const gchar *bname, *gname; - - buddy = buddies->data; - bname = purple_buddy_get_name(buddy); - gname = purple_group_get_name(purple_buddy_get_group(buddy)); - if (aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { - const gchar *alias = purple_buddy_get_alias_only(buddy); - if (alias) - tmp = g_strdup_printf("%s %s (%s)
", text, bname, alias); - else - tmp = g_strdup_printf("%s %s
", text, bname); - g_free(text); - text = tmp; - - num++; - } - - buddies = g_slist_delete_link(buddies, buddies); - } - - if (!num) { - g_free(text); - text = g_strdup(_("you are not waiting for authorization")); - } - - purple_notify_formatted(gc, NULL, _("You are awaiting authorization from " - "the following buddies"), _("You can re-request " - "authorization from these buddies by " - "right-clicking on them and selecting " - "\"Re-request Authorization.\""), text, NULL, NULL); - g_free(text); -} - -static void search_by_email_cb(PurpleConnection *gc, const char *email) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_search_address(od, email); -} - -static void oscar_show_find_email(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, _("Find Buddy by Email"), - _("Search for a buddy by email address"), - _("Type the email address of the buddy you are " - "searching for."), - NULL, FALSE, FALSE, NULL, - _("_Search"), G_CALLBACK(search_by_email_cb), - _("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void oscar_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void oscar_show_set_info_icqurl(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_notify_uri(gc, "http://www.icq.com/whitepages/user_details.php"); -} - -static void oscar_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static void oscar_show_chpassurl(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - OscarData *od = purple_connection_get_protocol_data(gc); - gchar *substituted = purple_strreplace(od->authinfo->chpassurl, "%s", purple_account_get_username(purple_connection_get_account(gc))); - purple_notify_uri(gc, substituted); - g_free(substituted); -} - -static void oscar_show_imforwardingurl(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); -} - -void oscar_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - if (img == NULL) { - aim_ssi_delicon(od); - } else { - PurpleCipherContext *context; - guchar md5[16]; - gconstpointer data = purple_imgstore_get_data(img); - size_t len = purple_imgstore_get_size(img); - - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, data, len); - purple_cipher_context_digest(context, 16, md5, NULL); - purple_cipher_context_destroy(context); - - aim_ssi_seticon(od, md5, 16); - } -} - -/** - * Called by the Purple core to determine whether or not we're - * allowed to send a file to this user. - */ -gboolean -oscar_can_receive_file(PurpleConnection *gc, const char *who) -{ - OscarData *od; - PurpleAccount *account; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - if (od != NULL) - { - aim_userinfo_t *userinfo; - userinfo = aim_locate_finduserinfo(od, who); - - /* - * Don't allowing sending a file to a user that does not support - * file transfer, and don't allow sending to ourselves. - */ - if (((userinfo == NULL) || - (userinfo->capabilities & OSCAR_CAPABILITY_SENDFILE)) && - oscar_util_name_compare(who, purple_account_get_username(account))) - { - return TRUE; - } - } - - return FALSE; -} - -PurpleXfer * -oscar_new_xfer(PurpleConnection *gc, const char *who) -{ - PurpleXfer *xfer; - OscarData *od; - PurpleAccount *account; - PeerConnection *conn; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - xfer = purple_xfer_new(account, PURPLE_XFER_SEND, who); - if (xfer) - { - purple_xfer_ref(xfer); - purple_xfer_set_init_fnc(xfer, peer_oft_sendcb_init); - purple_xfer_set_cancel_send_fnc(xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_request_denied_fnc(xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_ack_fnc(xfer, peer_oft_sendcb_ack); - - conn = peer_connection_new(od, OSCAR_CAPABILITY_SENDFILE, who); - conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - aim_icbm_makecookie(conn->cookie); - conn->xfer = xfer; - xfer->data = conn; - } - - return xfer; -} - -/* - * Called by the Purple core when the user indicates that a - * file is to be sent to a special someone. - */ -void -oscar_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer; - - xfer = oscar_new_xfer(gc, who); - - if (file != NULL) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -GList * -oscar_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc = (PurpleConnection *) context; - OscarData *od = purple_connection_get_protocol_data(gc); - GList *menu = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set User Info..."), - oscar_show_set_info); - menu = g_list_prepend(menu, act); - - if (od->icq) - { - act = purple_plugin_action_new(_("Set User Info (web)..."), - oscar_show_set_info_icqurl); - menu = g_list_prepend(menu, act); - } - - act = purple_plugin_action_new(_("Change Password..."), - oscar_change_pass); - menu = g_list_prepend(menu, act); - - if (od->authinfo != NULL && od->authinfo->chpassurl != NULL) - { - /* This only happens when connecting with the old-style BUCP login */ - act = purple_plugin_action_new(_("Change Password (web)"), - oscar_show_chpassurl); - menu = g_list_prepend(menu, act); - } - - if (!od->icq) - { - act = purple_plugin_action_new(_("Configure IM Forwarding (web)"), - oscar_show_imforwardingurl); - menu = g_list_prepend(menu, act); - } - - menu = g_list_prepend(menu, NULL); - - if (od->icq) - { - /* ICQ actions */ - act = purple_plugin_action_new(_("Set Privacy Options..."), - oscar_show_icq_privacy_opts); - menu = g_list_prepend(menu, act); - } - else - { - /* AIM actions */ - act = purple_plugin_action_new(_("Confirm Account"), - oscar_confirm_account); - menu = g_list_prepend(menu, act); - - act = purple_plugin_action_new(_("Display Currently Registered Email Address"), - oscar_show_email); - menu = g_list_prepend(menu, act); - - act = purple_plugin_action_new(_("Change Currently Registered Email Address..."), - oscar_show_change_email); - menu = g_list_prepend(menu, act); - } - - menu = g_list_prepend(menu, NULL); - - act = purple_plugin_action_new(_("Show Buddies Awaiting Authorization"), - oscar_show_awaitingauth); - menu = g_list_prepend(menu, act); - - menu = g_list_prepend(menu, NULL); - - act = purple_plugin_action_new(_("Search for Buddy by Email Address..."), - oscar_show_find_email); - menu = g_list_prepend(menu, act); - -#if 0 - act = purple_plugin_action_new(_("Search for Buddy by Information"), - show_find_info); - menu = g_list_prepend(menu, act); -#endif - - menu = g_list_reverse(menu); - - return menu; -} - -void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->icq) { - aim_icq_changepasswd(od, new); - } else { - FlapConnection *conn; - conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - if (conn) { - aim_admin_changepasswd(od, conn, new, old); - } else { - od->chpass = TRUE; - od->oldp = g_strdup(old); - od->newp = g_strdup(new); - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } - } -} - -void -oscar_convo_closed(PurpleConnection *gc, const char *who) -{ - OscarData *od; - PeerConnection *conn; - - od = purple_connection_get_protocol_data(gc); - conn = peer_connection_find_by_type(od, who, OSCAR_CAPABILITY_DIRECTIM); - - if (conn != NULL) - { - if (!conn->ready) - aim_im_sendch2_cancel(conn); - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - } -} - -const char * -oscar_normalize(const PurpleAccount *account, const char *str) -{ - static char buf[BUF_LEN]; - char *tmp1, *tmp2; - int i, j; - - g_return_val_if_fail(str != NULL, NULL); - - /* copy str to buf and skip all blanks */ - i = 0; - for (j = 0; str[j]; j++) { - if (str[j] != ' ') { - buf[i++] = str[j]; - if (i >= BUF_LEN - 1) - break; - } - } - buf[i] = '\0'; - - tmp1 = g_utf8_strdown(buf, -1); - tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT); - strcpy(buf, tmp2); - g_free(tmp2); - g_free(tmp1); - - return buf; -} - -gboolean -oscar_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -/* TODO: Find somewhere to put this instead of including it in a bunch of places. - * Maybe just change purple_accounts_find() to return anything for the prpl if there is no acct_id. - */ -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - - -static gboolean oscar_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - char prpl[11]; - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "aim") && g_ascii_strcasecmp(proto, "icq")) - return FALSE; - - g_snprintf(prpl, sizeof(prpl), "prpl-%s", proto); - - acct = find_acct(prpl, acct_id); - - if (!acct) - return FALSE; - - /* aim:GoIM?screenname=SCREENNAME&message=MESSAGE */ - if (!g_ascii_strcasecmp(cmd, "GoIM")) { - char *bname = g_hash_table_lookup(params, "screenname"); - if (bname) { - char *message = g_hash_table_lookup(params, "message"); - - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, bname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, bname); - purple_conversation_present(conv); - - if (message) { - /* Spaces are encoded as '+' */ - g_strdelimit(message, "+", ' '); - purple_conv_send_confirm(conv, message); - } - } - /*else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im();*/ - - return TRUE; - } - /* aim:GoChat?roomname=CHATROOMNAME&exchange=4 */ - else if (!g_ascii_strcasecmp(cmd, "GoChat")) { - char *rname = g_hash_table_lookup(params, "roomname"); - if (rname) { - /* This is somewhat hacky, but the params aren't useful after this command */ - g_hash_table_insert(params, g_strdup("exchange"), g_strdup("4")); - g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); - serv_join_chat(purple_account_get_connection(acct), params); - } - /*else - ** Same as above (except that this would have to be re-written using purple_request_*) - pidgin_blist_joinchat_show(); */ - - return TRUE; - } - /* aim:AddBuddy?screenname=SCREENNAME&groupname=GROUPNAME*/ - else if (!g_ascii_strcasecmp(cmd, "AddBuddy")) { - char *bname = g_hash_table_lookup(params, "screenname"); - char *gname = g_hash_table_lookup(params, "groupname"); - purple_blist_request_add_buddy(acct, bname, gname, NULL); - return TRUE; - } - - return FALSE; -} - -void oscar_init(PurplePlugin *plugin) -{ - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - PurpleAccountOption *option; - static gboolean init = FALSE; - - option = purple_account_option_string_new(_("Server"), "server", OSCAR_DEFAULT_LOGIN_SERVER); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_bool_new(_("Use SSL"), "use_ssl", - OSCAR_DEFAULT_USE_SSL); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin", - OSCAR_DEFAULT_USE_CLIENTLOGIN); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_bool_new( - _("Always use AIM/ICQ proxy server for\nfile transfers and direct IM (slower,\nbut does not reveal your IP address)"), "always_use_rv_proxy", - OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - if (g_str_equal(purple_plugin_get_id(plugin), "prpl-aim")) { - option = purple_account_option_bool_new(_("Allow multiple simultaneous logins"), "allow_multiple_logins", - OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - } - - if (init) - return; - init = TRUE; - - /* Preferences */ - purple_prefs_add_none("/plugins/prpl/oscar"); - purple_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE); - - purple_prefs_remove("/plugins/prpl/oscar/show_idle"); - purple_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy"); - - /* protocol handler */ - /* TODO: figure out a good instance to use here */ - purple_signal_connect(purple_get_core(), "uri-handler", &init, - PURPLE_CALLBACK(oscar_uri_handler), NULL); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscarcommon.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscarcommon.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscarcommon.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscarcommon.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* oscarcommon.h contains prototypes for the prpl functions used by libaim.c - * and libicq.c - */ - -#include "accountopt.h" -#include "internal.h" -#include "prpl.h" -#include "version.h" -#include "notify.h" - -#define OSCAR_DEFAULT_LOGIN_SERVER "login.messaging.aol.com" -#define OSCAR_DEFAULT_LOGIN_PORT 5190 -#define OSCAR_DEFAULT_SSL_LOGIN_SERVER "slogin.oscar.aol.com" -#define OSCAR_OLD_LOGIN_SERVER "login.oscar.aol.com" -#ifndef _WIN32 -#define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1" -#else -#define OSCAR_DEFAULT_CUSTOM_ENCODING oscar_get_locale_charset() -#endif -#define OSCAR_DEFAULT_AUTHORIZATION TRUE -#define OSCAR_DEFAULT_HIDE_IP TRUE -#define OSCAR_DEFAULT_WEB_AWARE FALSE -#define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE -#define OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS TRUE -#define OSCAR_DEFAULT_USE_SSL TRUE -#define OSCAR_DEFAULT_USE_CLIENTLOGIN TRUE - -#ifdef _WIN32 -const char *oscar_get_locale_charset(void); -#endif -const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b); -const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b); -const char* oscar_list_emblem(PurpleBuddy *b); -char *oscar_status_text(PurpleBuddy *b); -void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -GList *oscar_status_types(PurpleAccount *account); -GList *oscar_blist_node_menu(PurpleBlistNode *node); -GList *oscar_chat_info(PurpleConnection *gc); -GHashTable *oscar_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -void oscar_login(PurpleAccount *account); -void oscar_close(PurpleConnection *gc); -int oscar_send_im(PurpleConnection *gc, const char *name, const char *message, PurpleMessageFlags imflags); -void oscar_set_info(PurpleConnection *gc, const char *rawinfo); -unsigned int oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); -void oscar_get_info(PurpleConnection *gc, const char *name); -void oscar_set_status(PurpleAccount *account, PurpleStatus *status); -void oscar_set_idle(PurpleConnection *gc, int time); -void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new); -void oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void oscar_add_permit(PurpleConnection *gc, const char *who); -void oscar_add_deny(PurpleConnection *gc, const char *who); -void oscar_rem_permit(PurpleConnection *gc, const char *who); -void oscar_rem_deny(PurpleConnection *gc, const char *who); -void oscar_set_permit_deny(PurpleConnection *gc); -void oscar_join_chat(PurpleConnection *gc, GHashTable *data); -char *oscar_get_chat_name(GHashTable *data); -void oscar_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name); -void oscar_chat_leave(PurpleConnection *gc, int id); -int oscar_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); -void oscar_keepalive(PurpleConnection *gc); -void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias); -void oscar_move_buddy(PurpleConnection *gc, const char *name, const char *old_group, const char *new_group); -void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies); -void oscar_convo_closed(PurpleConnection *gc, const char *who); -const char *oscar_normalize(const PurpleAccount *account, const char *str); -void oscar_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -void oscar_remove_group(PurpleConnection *gc, PurpleGroup *group); -gboolean oscar_can_receive_file(PurpleConnection *gc, const char *who); -void oscar_send_file(PurpleConnection *gc, const char *who, const char *file); -PurpleXfer *oscar_new_xfer(PurpleConnection *gc, const char *who); -gboolean oscar_offline_message(const PurpleBuddy *buddy); -void oscar_format_username(PurpleConnection *gc, const char *nick); -GList *oscar_actions(PurplePlugin *plugin, gpointer context); -void oscar_init(PurplePlugin *plugin); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar_data.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar_data.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar_data.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar_data.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" - -typedef struct _SnacHandler SnacHandler; - -struct _SnacHandler -{ - guint16 family; - guint16 subtype; - aim_rxcallback_t handler; - guint16 flags; -}; - -/** - * Allocates a new OscarData and initializes it with default values. - */ -OscarData * -oscar_data_new(void) -{ - OscarData *od; - - od = g_new0(OscarData, 1); - - aim_initsnachash(od); - od->snacid_next = 0x00000001; - od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); - - /* - * Register all the modules for this session... - */ - aim__registermodule(od, misc_modfirst); /* load the catch-all first */ - aim__registermodule(od, service_modfirst); - aim__registermodule(od, locate_modfirst); - aim__registermodule(od, buddylist_modfirst); - aim__registermodule(od, msg_modfirst); - /* aim__registermodule(od, adverts_modfirst); */ - /* aim__registermodule(od, invite_modfirst); */ - aim__registermodule(od, admin_modfirst); - aim__registermodule(od, popups_modfirst); - aim__registermodule(od, bos_modfirst); - aim__registermodule(od, search_modfirst); - aim__registermodule(od, stats_modfirst); - /* aim__registermodule(od, translate_modfirst); */ - aim__registermodule(od, chatnav_modfirst); - aim__registermodule(od, chat_modfirst); - aim__registermodule(od, odir_modfirst); - aim__registermodule(od, bart_modfirst); - /* missing 0x11 - 0x12 */ - aim__registermodule(od, ssi_modfirst); - /* missing 0x14 */ - aim__registermodule(od, icq_modfirst); - /* missing 0x16 */ - /* auth_modfirst is only needed if we're connecting with the old-style BUCP login */ - aim__registermodule(od, auth_modfirst); - aim__registermodule(od, email_modfirst); - - return od; -} - -/** - * Logoff and deallocate a session. - * - * @param od Session to kill - */ -void -oscar_data_destroy(OscarData *od) -{ - aim_cleansnacs(od, -1); - - /* Only used when connecting with clientLogin */ - if (od->url_data != NULL) - purple_util_fetch_url_cancel(od->url_data); - - while (od->requesticon) - { - g_free(od->requesticon->data); - od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); - } - g_free(od->email); - g_free(od->newp); - g_free(od->oldp); - if (od->getblisttimer > 0) - purple_timeout_remove(od->getblisttimer); - while (od->oscar_connections != NULL) - flap_connection_destroy(od->oscar_connections->data, - OSCAR_DISCONNECT_DONE, NULL); - - while (od->peer_connections != NULL) - peer_connection_destroy(od->peer_connections->data, - OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - - aim__shutdownmodules(od); - - g_hash_table_destroy(od->buddyinfo); - g_hash_table_destroy(od->handlerlist); - - g_free(od); -} - -void -oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags) -{ - SnacHandler *snac_handler; - - purple_debug_misc("oscar", "Adding handler for %04x/%04x\n", family, subtype); - - snac_handler = g_new0(SnacHandler, 1); - - snac_handler->family = family; - snac_handler->subtype = subtype; - snac_handler->flags = flags; - snac_handler->handler = newhandler; - - g_hash_table_insert(od->handlerlist, - GUINT_TO_POINTER((family << 16) + subtype), - snac_handler); -} - -aim_rxcallback_t -aim_callhandler(OscarData *od, guint16 family, guint16 subtype) -{ - SnacHandler *snac_handler; - - snac_handler = g_hash_table_lookup(od->handlerlist, GUINT_TO_POINTER((family << 16) + subtype)); - - return snac_handler ? snac_handler->handler : NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/oscar.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1711 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Main libfaim header. Must be included in client for prototypes/macros. - * - * "come on, i turned a chick lesbian; i think this is the hackish equivalent" - * -- Josh Myer - * - */ - -#ifndef _OSCAR_H_ -#define _OSCAR_H_ - -#include "internal.h" -#include "circbuffer.h" -#include "debug.h" -#include "eventloop.h" -#include "proxy.h" -#include "sslconn.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#else -#include "libc_interface.h" -#endif - -typedef struct _ByteStream ByteStream; -typedef struct _ClientInfo ClientInfo; -typedef struct _FlapConnection FlapConnection; -typedef struct _FlapFrame FlapFrame; -typedef struct _IcbmArgsCh2 IcbmArgsCh2; -typedef struct _IcbmCookie IcbmCookie; -typedef struct _OscarData OscarData; -typedef struct _QueuedSnac QueuedSnac; - -typedef guint32 aim_snacid_t; - -#include "snactypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define FAIM_SNAC_HASH_SIZE 16 - -/* - * Current Maximum Length for usernames (not including NULL) - * - * Currently only names up to 16 characters can be registered - * however it is apparently legal for them to be larger. - */ -#define MAXSNLEN 97 - -/* - * Current Maximum Length for Instant Messages - * - * This was found basically by experiment, but not wholly - * accurate experiment. It should not be regarded - * as completely correct. But its a decent approximation. - * - * Note that although we can send this much, its impossible - * for WinAIM clients (up through the latest (4.0.1957)) to - * send any more than 1kb. Amaze all your windows friends - * with utterly oversized instant messages! - */ -#define MAXMSGLEN 2544 - -/* - * Maximum size of a Buddy Icon. - */ -#define MAXICONLEN 7168 -#define AIM_ICONIDENT "AVT1picture.id" - -/* - * Current Maximum Length for Chat Room Messages - * - * This is actually defined by the protocol to be - * dynamic, but I have yet to see due cause to - * define it dynamically here. Maybe later. - * - */ -#define MAXCHATMSGLEN 512 - -/* - * Found by trial and error. - */ -#define MAXAVAILMSGLEN 251 - -/** - * Maximum length for the password of an ICQ account - */ -#define MAXICQPASSLEN 8 - -#define AIM_MD5_STRING "AOL Instant Messenger (SM)" - -/* - * Client info. Filled in by the client and passed in to - * aim_send_login(). The information ends up getting passed to OSCAR - * through the initial login command. - * - */ -struct _ClientInfo -{ - const char *clientstring; - guint16 clientid; - guint16 major; - guint16 minor; - guint16 point; - guint16 build; - guint32 distrib; - const char *country; /* two-letter abbrev */ - const char *lang; /* two-letter abbrev */ -}; - -/* Needs to be checked */ -#define CLIENTINFO_AIM_3_5_1670 { \ - "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \ - 0x0004, \ - 0x0003, 0x0005, \ - 0x0000, 0x0686, \ - 0x0000002a, \ - "us", "en", \ -} - -/* Needs to be checked */ -/* Latest winaim without ssi */ -#define CLIENTINFO_AIM_4_1_2010 { \ - "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \ - 0x0004, \ - 0x0004, 0x0001, \ - 0x0000, 0x07da, \ - 0x0000004b, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_AIM_4_3_2188 { \ - "AOL Instant Messenger (SM), version 4.3.2188/WIN32", \ - 0x0109, \ - 0x0400, 0x0003, \ - 0x0000, 0x088c, \ - 0x00000086, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_AIM_4_8_2540 { \ - "AOL Instant Messenger (SM), version 4.8.2540/WIN32", \ - 0x0109, \ - 0x0004, 0x0008, \ - 0x0000, 0x09ec, \ - 0x000000af, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_AIM_5_0_2938 { \ - "AOL Instant Messenger, version 5.0.2938/WIN32", \ - 0x0109, \ - 0x0005, 0x0000, \ - 0x0000, 0x0b7a, \ - 0x00000000, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_5_1_3036 { \ - "AOL Instant Messenger, version 5.1.3036/WIN32", \ - 0x0109, \ - 0x0005, 0x0001, \ - 0x0000, 0x0bdc, \ - 0x000000d2, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_5_5_3415 { \ - "AOL Instant Messenger, version 5.5.3415/WIN32", \ - 0x0109, \ - 0x0005, 0x0005, \ - 0x0000, 0x0057, \ - 0x000000ef, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_5_9_3702 { \ - "AOL Instant Messenger, version 5.9.3702/WIN32", \ - 0x0109, \ - 0x0005, 0x0009, \ - 0x0000, 0x0e76, \ - 0x00000111, \ - "us", "en", \ -} - -#define CLIENTINFO_ICHAT_1_0 { \ - "Apple iChat", \ - 0x311a, \ - 0x0001, 0x0000, \ - 0x0000, 0x003c, \ - 0x000000c6, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_ICQ_4_65_3281 { \ - "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \ - 0x010a, \ - 0x0004, 0x0041, \ - 0x0001, 0x0cd1, \ - 0x00000055, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_ICQ_5_34_3728 { \ - "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \ - 0x010a, \ - 0x0005, 0x0022, \ - 0x0001, 0x0e8f, \ - 0x00000055, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQ_5_45_3777 { \ - "ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \ - 0x010a, \ - 0x0005, 0x002d, \ - 0x0001, 0x0ec1, \ - 0x00000055, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQ6_6_0_6059 { \ - "ICQ Client", \ - 0x010a, \ - 0x0006, 0x0000, \ - 0x0000, 0x17ab, \ - 0x00007535, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQBASIC_14_3_1068 { \ - "ICQBasic", \ - 0x010a, \ - 0x0014, 0x0003, \ - 0x0000, 0x042c, \ - 0x0000043d, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQBASIC_14_34_3000 { \ - "ICQBasic", \ - 0x010a, \ - 0x0014, 0x0034, \ - 0x0000, 0x0bb8, \ - 0x0000043d, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQBASIC_14_34_3096 { \ - "ICQBasic", \ - 0x010a, \ - 0x0014, 0x0034, \ - 0x0000, 0x0c18, \ - 0x0000043d, \ - "us", "en", \ -} - -#define CLIENTINFO_NETSCAPE_7_0_1 { \ - "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \ - 0x1d0d, \ - 0x0007, 0x0000, \ - 0x0001, 0x0000, \ - 0x00000058, \ - "us", "en", \ -} - -/* - * We need to use the major-minor-micro versions from the official - * AIM and ICQ programs here or AOL won't let us use certain features. - * - * 0x00000611 is the distid given to us by AOL for use as the default - * libpurple distid. - */ -#define CLIENTINFO_PURPLE_AIM { \ - NULL, \ - 0x0109, \ - 0x0005, 0x0001, \ - 0x0000, 0x0bdc, \ - 0x00000611, \ - "us", "en", \ -} - -#define CLIENTINFO_PURPLE_ICQ { \ - NULL, \ - 0x010a, \ - 0x0014, 0x0034, \ - 0x0000, 0x0c18, \ - 0x00000611, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036 -#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQBASIC_14_34_3096 - -typedef enum -{ - OSCAR_DISCONNECT_DONE, /* not considered an error */ - OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */ - OSCAR_DISCONNECT_REMOTE_CLOSED, - OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */ - OSCAR_DISCONNECT_LOST_CONNECTION, - OSCAR_DISCONNECT_INVALID_DATA, - OSCAR_DISCONNECT_COULD_NOT_CONNECT, - OSCAR_DISCONNECT_RETRYING /* peer connections only */ -} OscarDisconnectReason; - -typedef enum -{ - OSCAR_CAPABILITY_BUDDYICON = 0x00000001, - OSCAR_CAPABILITY_TALK = 0x00000002, - OSCAR_CAPABILITY_DIRECTIM = 0x00000004, - OSCAR_CAPABILITY_CHAT = 0x00000008, - OSCAR_CAPABILITY_GETFILE = 0x00000010, - OSCAR_CAPABILITY_SENDFILE = 0x00000020, - OSCAR_CAPABILITY_GAMES = 0x00000040, - OSCAR_CAPABILITY_ADDINS = 0x00000080, - OSCAR_CAPABILITY_SENDBUDDYLIST = 0x00000100, - OSCAR_CAPABILITY_GAMES2 = 0x00000200, - OSCAR_CAPABILITY_ICQ_DIRECT = 0x00000400, - OSCAR_CAPABILITY_APINFO = 0x00000800, - OSCAR_CAPABILITY_ICQRTF = 0x00001000, - OSCAR_CAPABILITY_EMPTY = 0x00002000, - OSCAR_CAPABILITY_ICQSERVERRELAY = 0x00004000, - OSCAR_CAPABILITY_UNICODEOLD = 0x00008000, - OSCAR_CAPABILITY_TRILLIANCRYPT = 0x00010000, - OSCAR_CAPABILITY_UNICODE = 0x00020000, - OSCAR_CAPABILITY_INTEROPERATE = 0x00040000, - OSCAR_CAPABILITY_SHORTCAPS = 0x00080000, - OSCAR_CAPABILITY_HIPTOP = 0x00100000, - OSCAR_CAPABILITY_SECUREIM = 0x00200000, - OSCAR_CAPABILITY_SMS = 0x00400000, - OSCAR_CAPABILITY_VIDEO = 0x00800000, - OSCAR_CAPABILITY_ICHATAV = 0x01000000, - OSCAR_CAPABILITY_LIVEVIDEO = 0x02000000, - OSCAR_CAPABILITY_CAMERA = 0x04000000, - OSCAR_CAPABILITY_ICHAT_SCREENSHARE = 0x08000000, - OSCAR_CAPABILITY_TYPING = 0x10000000, - OSCAR_CAPABILITY_GENERICUNKNOWN = 0x20000000, - OSCAR_CAPABILITY_LAST = 0x40000000 -} OscarCapability; - -/* - * Byte Stream type. Sort of. - * - * Use of this type serves a couple purposes: - * - Buffer/buflen pairs are passed all around everywhere. This turns - * that into one value, as well as abstracting it slightly. - * - Through the abstraction, it is possible to enable bounds checking - * for robustness at the cost of performance. But a clean failure on - * weird packets is much better than a segfault. - * - I like having variables named "bs". - * - * Don't touch the insides of this struct. Or I'll have to kill you. - * - */ -struct _ByteStream -{ - guint8 *data; - guint32 len; - guint32 offset; -}; - -struct _QueuedSnac -{ - guint16 family; - guint16 subtype; - FlapFrame *frame; -}; - -struct _FlapFrame -{ - guint8 channel; - guint16 seqnum; - ByteStream data; /* payload stream */ -}; - -struct _FlapConnection -{ - OscarData *od; /**< Pointer to parent session. */ - gboolean connected; - time_t lastactivity; /**< Time of last transmit. */ - guint destroy_timeout; - OscarDisconnectReason disconnect_reason; - gchar *error_message; - guint16 disconnect_code; - - /* A few variables that are only used when connecting */ - PurpleProxyConnectData *connect_data; - guint16 cookielen; - guint8 *cookie; - gpointer new_conn_data; - - int fd; - PurpleSslConnection *gsc; - guint8 header[6]; - gssize header_received; - FlapFrame buffer_incoming; - PurpleCircBuffer *buffer_outgoing; - guint watcher_incoming; - guint watcher_outgoing; - - guint16 type; - guint16 subtype; - guint16 seqnum_out; /**< The sequence number of most recently sent packet. */ - guint16 seqnum_in; /**< The sequence number of most recently received packet. */ - GSList *groups; - GSList *rateclasses; /* Contains nodes of struct rateclass. */ - - GQueue *queued_snacs; /**< Contains QueuedSnacs. */ - GQueue *queued_lowpriority_snacs; /**< Contains QueuedSnacs to send only once queued_snacs is empty */ - guint queued_timeout; - - void *internal; /* internal conn-specific libfaim data */ -}; - -struct _IcbmCookie -{ - guchar cookie[8]; - int type; - void *data; - time_t addtime; - struct _IcbmCookie *next; -}; - -#include "peer.h" - -/* - * AIM Session: The main client-data interface. - * - */ -struct _OscarData -{ - /** Only used when connecting with clientLogin */ - PurpleUtilFetchUrlData *url_data; - - gboolean iconconnecting; - gboolean set_icon; - - GSList *create_rooms; - - gboolean conf; - gboolean reqemail; - gboolean setemail; - char *email; - gboolean setnick; - char *newformatting; - gboolean chpass; - char *oldp; - char *newp; - - GSList *oscar_chats; - GHashTable *buddyinfo; - GSList *requesticon; - - gboolean use_ssl; - gboolean icq; - guint getblisttimer; - - struct { - guint maxwatchers; /* max users who can watch you */ - guint maxbuddies; /* max users you can watch */ - guint maxgroups; /* max groups in server list */ - guint maxpermits; /* max users on permit list */ - guint maxdenies; /* max users on deny list */ - guint maxsiglen; /* max size (bytes) of profile */ - guint maxawaymsglen; /* max size (bytes) of posted away message */ - } rights; - - PurpleConnection *gc; - - void *modlistv; - - /* - * Outstanding snac handling - * - * TODO: Should these be per-connection? -mid - */ - void *snac_hash[FAIM_SNAC_HASH_SIZE]; - aim_snacid_t snacid_next; - - /* - * TODO: Data specific to a certain family should go into a - * hashtable and the core parts of libfaim shouldn't - * need to know about them. - */ - - IcbmCookie *msgcookies; - struct aim_icq_info *icq_info; - - /** Only used when connecting with the old-style BUCP login. */ - struct aim_authresp_info *authinfo; - struct aim_emailinfo *emailinfo; - - struct { - struct aim_userinfo_s *userinfo; - } locate; - - struct { - gboolean have_rights; - } bos; - - /* Server-stored information (ssi) */ - struct { - gboolean received_data; - guint16 numitems; - struct aim_ssi_item *official; - struct aim_ssi_item *local; - struct aim_ssi_tmp *pending; - time_t timestamp; - gboolean waiting_for_ack; - gboolean in_transaction; - } ssi; - - /** Contains pointers to handler functions for each family/subtype. */ - GHashTable *handlerlist; - - /** A linked list containing FlapConnections. */ - GSList *oscar_connections; - guint16 default_port; - - /** A linked list containing PeerConnections. */ - GSList *peer_connections; -}; - -/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ -#define AIM_ICQ_STATE_NORMAL 0x00000000 -#define AIM_ICQ_STATE_AWAY 0x00000001 -#define AIM_ICQ_STATE_DND 0x00000002 -#define AIM_ICQ_STATE_OUT 0x00000004 -#define AIM_ICQ_STATE_BUSY 0x00000010 -#define AIM_ICQ_STATE_CHAT 0x00000020 -#define AIM_ICQ_STATE_INVISIBLE 0x00000100 -#define AIM_ICQ_STATE_WEBAWARE 0x00010000 -#define AIM_ICQ_STATE_HIDEIP 0x00020000 -#define AIM_ICQ_STATE_BIRTHDAY 0x00080000 -#define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000 -#define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000 -#define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000 -#define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000 - -/** - * Only used when connecting with the old-style BUCP login. - */ -struct aim_clientrelease -{ - char *name; - guint32 build; - char *url; - char *info; -}; - -/** - * Only used when connecting with the old-style BUCP login. - */ -struct aim_authresp_info -{ - char *bn; - guint16 errorcode; - char *errorurl; - guint16 regstatus; - char *email; - char *bosip; - guint16 cookielen; - guint8 *cookie; - char *chpassurl; - struct aim_clientrelease latestrelease; - struct aim_clientrelease latestbeta; -}; - -/* Callback data for redirect. */ -struct aim_redirect_data -{ - guint16 group; - const char *ip; - guint16 cookielen; - const guint8 *cookie; - const char *ssl_cert_cn; - guint8 use_ssl; - struct { /* group == SNAC_FAMILY_CHAT */ - guint16 exchange; - const char *room; - guint16 instance; - } chat; -}; - -int oscar_connect_to_bos(PurpleConnection *gc, OscarData *od, const char *host, guint16 port, guint8 *cookie, guint16 cookielen, const char *tls_certname); - -/* family_auth.c */ - -/** - * Only used when connecting with the old-style BUCP login. - */ -int aim_request_login(OscarData *od, FlapConnection *conn, const char *bn); - -/** - * Only used when connecting with the old-style BUCP login. - */ -int aim_send_login(OscarData *od, FlapConnection *conn, const char *bn, const char *password, gboolean truncate_pass, ClientInfo *ci, const char *key, gboolean allow_multiple_logins); - -/** - * Only used when connecting with the old-style BUCP login. - */ -/* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid); - -/** - * Only used when connecting with clientLogin. - */ -void send_client_login(OscarData *od, const char *username); - -/* flap_connection.c */ -FlapConnection *flap_connection_new(OscarData *, int type); -void flap_connection_close(OscarData *od, FlapConnection *conn); -void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -void flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group); -FlapConnection *flap_connection_getbytype(OscarData *, int type); -FlapConnection *flap_connection_getbytype_all(OscarData *, int type); -void flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond); -void flap_connection_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); - -void flap_connection_send(FlapConnection *conn, FlapFrame *frame); -void flap_connection_send_version(OscarData *od, FlapConnection *conn); -void flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy); -void flap_connection_send_version_with_cookie_and_clientinfo(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy, ClientInfo *ci, gboolean allow_multiple_login); -void flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data); -void flap_connection_send_snac_with_priority(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data, gboolean high_priority); -void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn); -FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen); - -/* oscar_data.c */ -typedef int (*aim_rxcallback_t)(OscarData *od, FlapConnection *conn, FlapFrame *frame, ...); - -OscarData *oscar_data_new(void); -void oscar_data_destroy(OscarData *); -void oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags); -aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 subtype); - -/* misc.c */ -#define AIM_VISIBILITYCHANGE_PERMITADD 0x05 -#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 -#define AIM_VISIBILITYCHANGE_DENYADD 0x07 -#define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 - -#define AIM_PRIVFLAGS_ALLOWIDLE 0x01 -#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 - -#define AIM_WARN_ANON 0x01 - - - -/* 0x0001 - family_oservice.c */ -/* 0x0002 */ void aim_srv_clientready(OscarData *od, FlapConnection *conn); -/* 0x0004 */ void aim_srv_requestnew(OscarData *od, guint16 serviceid); -/* 0x0006 */ void aim_srv_reqrates(OscarData *od, FlapConnection *conn); -/* 0x0008 */ void aim_srv_rates_addparam(OscarData *od, FlapConnection *conn); -/* 0x0009 */ void aim_srv_rates_delparam(OscarData *od, FlapConnection *conn); -/* 0x000c */ void aim_srv_sendpauseack(OscarData *od, FlapConnection *conn); -/* 0x000e */ void aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn); -/* 0x0011 */ void aim_srv_setidle(OscarData *od, guint32 idletime); -/* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32); -/* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn); -/* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn); -/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setstatusmsg, const char *statusmsg, const char *itmsurl); - - -void aim_bos_reqrights(OscarData *od, FlapConnection *conn); -int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int, const char *); -void aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask); - - - -#define AIM_CLIENTTYPE_UNKNOWN 0x0000 -#define AIM_CLIENTTYPE_MC 0x0001 -#define AIM_CLIENTTYPE_WINAIM 0x0002 -#define AIM_CLIENTTYPE_WINAIM41 0x0003 -#define AIM_CLIENTTYPE_AOL_TOC 0x0004 -guint16 aim_im_fingerprint(const guint8 *msghdr, int len); - -#define AIM_RATE_CODE_CHANGE 0x0001 -#define AIM_RATE_CODE_WARNING 0x0002 -#define AIM_RATE_CODE_LIMIT 0x0003 -#define AIM_RATE_CODE_CLEARLIMIT 0x0004 -void aim_ads_requestads(OscarData *od, FlapConnection *conn); - - - -/* family_icbm.c */ -#define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 -#define AIM_OFT_SUBTYPE_SEND_DIR 0x0002 -#define AIM_OFT_SUBTYPE_GET_FILE 0x0011 -#define AIM_OFT_SUBTYPE_GET_LIST 0x0012 - -#define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 -#define AIM_TRANSFER_DENY_DECLINE 0x0001 -#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 - -#define AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED 0x00000001 -#define AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED 0x00000002 -#define AIM_IMPARAM_FLAG_EVENTS_ALLOWED 0x00000008 -#define AIM_IMPARAM_FLAG_SMS_SUPPORTED 0x00000010 -#define AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED 0x00000100 - -/* This is what the server will give you if you don't set them yourself. */ -/* This is probably out of date. */ -#define AIM_IMPARAM_DEFAULTS { \ - 0, \ - AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED, \ - 512, /* !! Note how small this is. */ \ - (99.9)*10, (99.9)*10, \ - 1000 /* !! And how large this is. */ \ -} - -/* This is what most AIM versions use. */ -/* This is probably out of date. */ -#define AIM_IMPARAM_REASONABLE { \ - 0, \ - AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED, \ - 8000, \ - (99.9)*10, (99.9)*10, \ - 0 \ -} - -struct aim_icbmparameters -{ - guint16 maxchan; - guint32 flags; /* AIM_IMPARAM_FLAG_ */ - guint16 maxmsglen; /* message size that you will accept */ - guint16 maxsenderwarn; /* this and below are *10 (999=99.9%) */ - guint16 maxrecverwarn; - guint32 minmsginterval; /* in milliseconds? */ -}; - -/* - * TODO: Should probably combine this with struct chat_connection. - */ -struct aim_chat_roominfo -{ - guint16 exchange; - char *name; - guint8 namelen; - guint16 instance; -}; - -struct chat_connection -{ - char *name; - char *show; /* AOL did something funny to us */ - guint16 exchange; - guint16 instance; - FlapConnection *conn; - int id; - PurpleConnection *gc; - PurpleConversation *conv; - int maxlen; - int maxvis; -}; - -/* - * All this chat struct stuff should be in family_chat.c - */ -void oscar_chat_destroy(struct chat_connection *cc); - -#define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */ -#define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */ -#define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */ -#define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ -#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ -#define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ -#define AIM_IMFLAGS_EXTDATA 0x0100 -#define AIM_IMFLAGS_X 0x0200 -#define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ -#define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ -#define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ - -#define AIM_CHARSET_ASCII 0x0000 /* ISO 646 */ -#define AIM_CHARSET_UNICODE 0x0002 /* ISO 10646 (UTF-16/UCS-2BE) */ -#define AIM_CHARSET_LATIN_1 0x0003 /* ISO 8859-1 */ - -/* - * Multipart message structures. - */ -typedef struct aim_mpmsg_section_s -{ - guint16 charset; - guint16 charsubset; - gchar *data; - guint16 datalen; - struct aim_mpmsg_section_s *next; -} aim_mpmsg_section_t; - -typedef struct aim_mpmsg_s -{ - unsigned int numparts; - aim_mpmsg_section_t *parts; -} aim_mpmsg_t; - -int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm); -int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen); -int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii); -int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen); -void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm); - -/* - * Arguments to aim_send_im_ext(). - * - * This is really complicated. But immensely versatile. - * - */ -struct aim_sendimext_args -{ - - /* These are _required_ */ - const char *destbn; - guint32 flags; /* often 0 */ - - /* Only required if not using multipart messages */ - const char *msg; - int msglen; - - /* Required if ->msg is not provided */ - aim_mpmsg_t *mpmsg; - - /* Only used if AIM_IMFLAGS_HASICON is set */ - guint32 iconlen; - time_t iconstamp; - guint32 iconsum; - - /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ - guint16 featureslen; - guint8 *features; - - /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ - guint16 charset; - guint16 charsubset; -}; - -/* - * Arguments to aim_send_rtfmsg(). - */ -struct aim_sendrtfmsg_args -{ - const char *destbn; - guint32 fgcolor; - guint32 bgcolor; - const char *rtfmsg; /* must be in RTF */ -}; - -/* - * This information is provided in the Incoming ICBM callback for - * Channel 1 ICBM's. - * - * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they - * are optional, both are always set by the current libfaim code. - * That may or may not change in the future. It is mainly for - * consistency with aim_sendimext_args. - * - * Multipart messages require some explanation. If you want to use them, - * I suggest you read all the comments in family_icbm.c. - * - */ -struct aim_incomingim_ch1_args -{ - - /* Always provided */ - aim_mpmsg_t mpmsg; - guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */ - time_t timestamp; /* Only set for offline messages */ - - /* Only provided if message has a human-readable section */ - gchar *msg; - int msglen; - - /* Only provided if AIM_IMFLAGS_HASICON is set */ - time_t iconstamp; - guint32 iconlen; - guint16 iconsum; - - /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */ - guint8 *features; - guint8 featureslen; - - /* Only provided if AIM_IMFLAGS_EXTDATA is set */ - guint8 extdatalen; - guint8 *extdata; - - /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */ - guint16 charset; - guint16 charsubset; -}; - -/* Valid values for channel 2 args->status */ -#define AIM_RENDEZVOUS_PROPOSE 0x0000 -#define AIM_RENDEZVOUS_CANCEL 0x0001 -#define AIM_RENDEZVOUS_CONNECTED 0x0002 - -struct _IcbmArgsCh2 -{ - guint16 status; - guchar cookie[8]; - int type; /* One of the OSCAR_CAPABILITY_ constants */ - const char *proxyip; - const char *clientip; - const char *verifiedip; - guint16 port; - gboolean use_proxy; - guint16 errorcode; - const char *msg; /* invite message or file description */ - guint16 msglen; - const char *encoding; - const char *language; - guint16 requestnumber; - union { - struct { - guint32 checksum; - guint32 length; - time_t timestamp; - guint8 *icon; - } icon; - struct { - struct aim_chat_roominfo roominfo; - } chat; - struct { - guint16 msgtype; - guint32 fgcolor; - guint32 bgcolor; - const char *rtfmsg; - } rtfmsg; - struct { - guint16 subtype; - guint16 totfiles; - guint32 totsize; - char *filename; - } sendfile; - } info; - void *destructor; /* used internally only */ -}; - -/* Valid values for channel 4 args->type */ -#define AIM_ICQMSG_AUTHREQUEST 0x0006 -#define AIM_ICQMSG_AUTHDENIED 0x0007 -#define AIM_ICQMSG_AUTHGRANTED 0x0008 - -struct aim_incomingim_ch4_args -{ - guint32 uin; /* Of the sender of the ICBM */ - guint8 type; - guint8 flags; - gchar *msg; /* Reason for auth request, deny, or accept */ - int msglen; -}; - -/* SNAC sending functions */ -/* 0x0002 */ int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params); -/* 0x0004 */ int aim_im_reqparams(OscarData *od); -/* 0x0006 */ int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args); -/* 0x0006 */ int aim_im_sendch1(OscarData *, const char *destbn, guint16 flags, const char *msg); -/* 0x0006 */ int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance); -/* 0x0006 */ int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum); -/* 0x0006 */ int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args); - -/* 0x0006 */ void aim_im_sendch2_cancel(PeerConnection *peer_conn); -/* 0x0006 */ void aim_im_sendch2_connected(PeerConnection *peer_conn); -/* 0x0006 */ void aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber); -/* 0x0006 */ void aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber); -/* 0x0006 */ void aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles); -/* 0x0006 */ void aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles); - -/* 0x0006 */ int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type); -/* 0x0006 */ int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message); -/* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destbn, guint32 flags); -/* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code); -/* 0x0010 */ int aim_im_reqofflinemsgs(OscarData *od); -/* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event); -void aim_icbm_makecookie(guchar* cookie); -gchar *oscar_encoding_extract(const char *encoding); -gchar *oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen); -gchar *purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcebn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen); - - -/* 0x0002 - family_locate.c */ -/* - * AIM User Info, Standard Form. - */ -#define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ -#define AIM_FLAG_ADMINISTRATOR 0x0002 -#define AIM_FLAG_AOL 0x0004 -#define AIM_FLAG_OSCAR_PAY 0x0008 -#define AIM_FLAG_FREE 0x0010 -#define AIM_FLAG_AWAY 0x0020 -#define AIM_FLAG_ICQ 0x0040 -#define AIM_FLAG_WIRELESS 0x0080 -#define AIM_FLAG_UNKNOWN100 0x0100 -#define AIM_FLAG_IMFORWARDING 0x0200 -#define AIM_FLAG_ACTIVEBUDDY 0x0400 -#define AIM_FLAG_UNKNOWN800 0x0800 -#define AIM_FLAG_ONEWAYWIRELESS 0x1000 -#define AIM_FLAG_NOKNOCKKNOCK 0x00040000 -#define AIM_FLAG_FORWARD_MOBILE 0x00080000 - -#define AIM_USERINFO_PRESENT_FLAGS 0x00000001 -#define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 -#define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 -#define AIM_USERINFO_PRESENT_IDLE 0x00000008 -#define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010 -#define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020 -#define AIM_USERINFO_PRESENT_ICQDATA 0x00000040 -#define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080 -#define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 -#define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 - -struct userinfo_node -{ - char *bn; - struct userinfo_node *next; -}; - -typedef struct aim_userinfo_s -{ - char *bn; - guint16 warnlevel; /* evil percent * 10 (999 = 99.9%) */ - guint16 idletime; /* in seconds */ - guint16 flags; - guint32 createtime; /* time_t */ - guint32 membersince; /* time_t */ - guint32 onlinesince; /* time_t */ - guint32 sessionlen; /* in seconds */ - guint32 capabilities; - struct { - guint32 status; - guint32 ipaddr; - guint8 crap[0x25]; /* until we figure it out... */ - } icqinfo; - guint32 present; - - guint8 iconcsumtype; - guint16 iconcsumlen; - guint8 *iconcsum; - - char *info; - char *info_encoding; - guint16 info_len; - - char *status; - char *status_encoding; - guint16 status_len; - - char *itmsurl; - char *itmsurl_encoding; - guint16 itmsurl_len; - - char *away; - char *away_encoding; - guint16 away_len; - - struct aim_userinfo_s *next; -} aim_userinfo_t; - -#define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 -#define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 - -int aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag); - -struct aim_invite_priv -{ - char *bn; - char *roomname; - guint16 exchange; - guint16 instance; -}; - -#define AIM_COOKIETYPE_UNKNOWN 0x00 -#define AIM_COOKIETYPE_ICBM 0x01 -#define AIM_COOKIETYPE_ADS 0x02 -#define AIM_COOKIETYPE_BOS 0x03 -#define AIM_COOKIETYPE_IM 0x04 -#define AIM_COOKIETYPE_CHAT 0x05 -#define AIM_COOKIETYPE_CHATNAV 0x06 -#define AIM_COOKIETYPE_INVITE 0x07 -/* we'll move OFT up a bit to give breathing room. not like it really - * matters. */ -#define AIM_COOKIETYPE_OFTIM 0x10 -#define AIM_COOKIETYPE_OFTGET 0x11 -#define AIM_COOKIETYPE_OFTSEND 0x12 -#define AIM_COOKIETYPE_OFTVOICE 0x13 -#define AIM_COOKIETYPE_OFTIMAGE 0x14 -#define AIM_COOKIETYPE_OFTICON 0x15 - -aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn); -void aim_locate_dorequest(OscarData *od); - -/* 0x0002 */ int aim_locate_reqrights(OscarData *od); -/* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps); -/* 0x0004 */ int aim_locate_setprofile(OscarData *od, const char *profile_encoding, const gchar *profile, const int profile_len, const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len); -/* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16); -/* 0x0009 */ int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy); -/* 0x000b */ int aim_locate_000b(OscarData *od, const char *bn); -/* 0x000f */ int aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy); -/* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags); - -guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len); -guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len); -void aim_info_free(aim_userinfo_t *); -int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *); -int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info); - - - -/* 0x0003 - family_buddy.c */ -/* 0x0002 */ void aim_buddylist_reqrights(OscarData *, FlapConnection *); -/* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *); -/* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *); -/* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *); - - - -/* 0x000a - family_userlookup.c */ -int aim_search_address(OscarData *, const char *); - - - -/* 0x000d - family_chatnav.c */ -/* 0x000e - family_chat.c */ -/* These apply to exchanges as well. */ -#define AIM_CHATROOM_FLAG_EVILABLE 0x0001 -#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002 -#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004 -#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008 - -struct aim_chat_exchangeinfo -{ - guint16 number; - guint16 flags; - char *name; - char *charset1; - char *lang1; - char *charset2; - char *lang2; -}; - -#define AIM_CHATFLAGS_NOREFLECT 0x0001 -#define AIM_CHATFLAGS_AWAY 0x0002 -int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language); -int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance); -int aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance); -char *aim_chat_getname(FlapConnection *conn); -FlapConnection *aim_chat_getconn(OscarData *, const char *name); - -void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn); - -int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange); -int aim_chat_leaveroom(OscarData *od, const char *name); - - - -/* 0x000f - family_odir.c */ -struct aim_odir -{ - char *first; - char *last; - char *middle; - char *maiden; - char *email; - char *country; - char *state; - char *city; - char *bn; - char *interest; - char *nick; - char *zip; - char *region; - char *address; - struct aim_odir *next; -}; - -int aim_odir_email(OscarData *, const char *, const char *); -int aim_odir_name(OscarData *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); -int aim_odir_interest(OscarData *, const char *, const char *); - - - -/* 0x0010 - family_bart.c */ -int aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen); -int aim_bart_request(OscarData *od, const char *bn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen); - - - -/* 0x0013 - family_feedbag.c */ -#define AIM_SSI_TYPE_BUDDY 0x0000 -#define AIM_SSI_TYPE_GROUP 0x0001 -#define AIM_SSI_TYPE_PERMIT 0x0002 -#define AIM_SSI_TYPE_DENY 0x0003 -#define AIM_SSI_TYPE_PDINFO 0x0004 -#define AIM_SSI_TYPE_PRESENCEPREFS 0x0005 -#define AIM_SSI_TYPE_ICONINFO 0x0014 - -#define AIM_SSI_ACK_SUCCESS 0x0000 -#define AIM_SSI_ACK_ITEMNOTFOUND 0x0002 -#define AIM_SSI_ACK_IDNUMINUSE 0x000a -#define AIM_SSI_ACK_ATMAX 0x000c -#define AIM_SSI_ACK_INVALIDNAME 0x000d -#define AIM_SSI_ACK_AUTHREQUIRED 0x000e - -/* These flags are set in the 0x00c9 TLV of SSI type 0x0005 */ -#define AIM_SSI_PRESENCE_FLAG_SHOWIDLE 0x00000400 -#define AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES 0x00020000 - -struct aim_ssi_item -{ - char *name; - guint16 gid; - guint16 bid; - guint16 type; - GSList *data; - struct aim_ssi_item *next; -}; - -struct aim_ssi_tmp -{ - guint16 action; - guint16 ack; - char *name; - struct aim_ssi_item *item; - struct aim_ssi_tmp *next; -}; - -/* These build the actual SNACs and queue them to be sent */ -/* 0x0002 */ int aim_ssi_reqrights(OscarData *od); -/* 0x0004 */ int aim_ssi_reqdata(OscarData *od); -/* 0x0005 */ int aim_ssi_reqifchanged(OscarData *od, time_t localstamp, guint16 localrev); -/* 0x0007 */ int aim_ssi_enable(OscarData *od); -/* 0x0011 */ int aim_ssi_modbegin(OscarData *od); -/* 0x0012 */ int aim_ssi_modend(OscarData *od); -/* 0x0014 */ int aim_ssi_sendauth(OscarData *od, char *bn, char *msg); -/* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg); -/* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg); - -/* Client functions for retrieving SSI data */ -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid); -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type); -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn); -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn); -int aim_ssi_getpermdeny(struct aim_ssi_item *list); -guint32 aim_ssi_getpresence(struct aim_ssi_item *list); -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn); -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn); -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn); - -/* Client functions for changing SSI data */ -int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *tlvlist, const char *alias, const char *comment, const char *smsnum, gboolean needauth); -int aim_ssi_addpermit(OscarData *od, const char *name); -int aim_ssi_adddeny(OscarData *od, const char *name); -int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group); -int aim_ssi_delgroup(OscarData *od, const char *group); -int aim_ssi_delpermit(OscarData *od, const char *name); -int aim_ssi_deldeny(OscarData *od, const char *name); -int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *bn); -int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias); -int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *alias); -int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn); -int aim_ssi_cleanlist(OscarData *od); -int aim_ssi_deletelist(OscarData *od); -int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask); -int aim_ssi_setpresence(OscarData *od, guint32 presence); -int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen); -int aim_ssi_delicon(OscarData *od); - - - -/* 0x0015 - family_icq.c */ -#define AIM_ICQ_INFO_SIMPLE 0x001 -#define AIM_ICQ_INFO_SUMMARY 0x002 -#define AIM_ICQ_INFO_EMAIL 0x004 -#define AIM_ICQ_INFO_PERSONAL 0x008 -#define AIM_ICQ_INFO_ADDITIONAL 0x010 -#define AIM_ICQ_INFO_WORK 0x020 -#define AIM_ICQ_INFO_INTERESTS 0x040 -#define AIM_ICQ_INFO_ORGS 0x080 -#define AIM_ICQ_INFO_UNKNOWN 0x100 -#define AIM_ICQ_INFO_HAVEALL 0x1ff - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -struct aim_icq_offlinemsg -{ - guint32 sender; - guint16 year; - guint8 month, day, hour, minute; - guint8 type; - guint8 flags; - char *msg; - int msglen; -}; -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - -struct aim_icq_info -{ - guint16 reqid; - - /* simple */ - guint32 uin; - - /* general and "home" information (0x00c8) */ - char *nick; - char *first; - char *last; - char *email; - char *homecity; - char *homestate; - char *homephone; - char *homefax; - char *homeaddr; - char *mobile; - char *homezip; - guint16 homecountry; -/* guint8 timezone; - guint8 hideemail; */ - - /* personal (0x00dc) */ - guint8 age; - guint8 unknown; - guint8 gender; - char *personalwebpage; - guint16 birthyear; - guint8 birthmonth; - guint8 birthday; - guint8 language1; - guint8 language2; - guint8 language3; - - /* work (0x00d2) */ - char *workcity; - char *workstate; - char *workphone; - char *workfax; - char *workaddr; - char *workzip; - guint16 workcountry; - char *workcompany; - char *workdivision; - char *workposition; - char *workwebpage; - - /* additional personal information (0x00e6) */ - char *info; - - /* email (0x00eb) */ - guint16 numaddresses; - char **email2; - - /* we keep track of these in a linked list because we're 1337 */ - struct aim_icq_info *next; - - /* status note info */ - guint8 icbm_cookie[8]; - char *status_note_title; -}; - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -int aim_icq_reqofflinemsgs(OscarData *od); -int aim_icq_ackofflinemsgs(OscarData *od); -#endif -int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware); -int aim_icq_changepasswd(OscarData *od, const char *passwd); -int aim_icq_getsimpleinfo(OscarData *od, const char *uin); -int aim_icq_getalias(OscarData *od, const char *uin); -int aim_icq_getallinfo(OscarData *od, const char *uin); -int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias); - - -/* 0x0017 - family_auth.c */ -void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *); -void aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw); -void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn); -void aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info); -void aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail); -void aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick); - - - -/* 0x0018 - family_alert.c */ -struct aim_emailinfo -{ - guint8 *cookie16; - guint8 *cookie8; - char *url; - guint16 nummsgs; - guint8 unread; - char *domain; - guint16 flag; - struct aim_emailinfo *next; -}; - -int aim_email_sendcookies(OscarData *od); -int aim_email_activate(OscarData *od); - - - -/* tlv.c - TLV handling */ - -/* TLV structure */ -typedef struct aim_tlv_s -{ - guint16 type; - guint16 length; - guint8 *value; -} aim_tlv_t; - -/* TLV handling functions */ -char *aim_tlv_getvalue_as_string(aim_tlv_t *tlv); - -aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth); -int aim_tlv_getlength(GSList *list, const guint16 type, const int nth); -char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth); -guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth); -guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth); -guint32 aim_tlv_get32(GSList *list, const guint16 type, const int nth); - -/* TLV list handling functions */ -GSList *aim_tlvlist_read(ByteStream *bs); -GSList *aim_tlvlist_readnum(ByteStream *bs, guint16 num); -GSList *aim_tlvlist_readlen(ByteStream *bs, guint16 len); -GSList *aim_tlvlist_copy(GSList *orig); - -int aim_tlvlist_count(GSList *list); -int aim_tlvlist_size(GSList *list); -int aim_tlvlist_cmp(GSList *one, GSList *two); -int aim_tlvlist_write(ByteStream *bs, GSList **list); -void aim_tlvlist_free(GSList *list); - -int aim_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value); -int aim_tlvlist_add_noval(GSList **list, const guint16 type); -int aim_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value); -int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value); -int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value); -int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value); -int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps); -int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo); -int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance); -int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tl); - -int aim_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 lenth, const guint8 *value); -int aim_tlvlist_replace_str(GSList **list, const guint16 type, const char *str); -int aim_tlvlist_replace_noval(GSList **list, const guint16 type); -int aim_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value); -int aim_tlvlist_replace_16(GSList **list, const guint16 type, const guint16 value); -int aim_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value); - -void aim_tlvlist_remove(GSList **list, const guint16 type); - - - -/* util.c */ -/* These are really ugly. You'd think this was LISP. I wish it was. */ -#define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1) -#define aimutil_get8(buf) ((*(buf))&0xff) -#define aimutil_put16(buf, data) ( \ - (*(buf) = (guint8)((data)>>8)&0xff), \ - (*((buf)+1) = (guint8)(data)&0xff), \ - 2) -#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) -#define aimutil_put32(buf, data) ( \ - (*((buf)) = (guint8)((data)>>24)&0xff), \ - (*((buf)+1) = (guint8)((data)>>16)&0xff), \ - (*((buf)+2) = (guint8)((data)>>8)&0xff), \ - (*((buf)+3) = (guint8)(data)&0xff), \ - 4) -#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ - (((*((buf)+1))<<16)&0x00ff0000) + \ - (((*((buf)+2))<< 8)&0x0000ff00) + \ - (((*((buf)+3) )&0x000000ff))) - -/* Little-endian versions (damn ICQ) */ -#define aimutil_putle8(buf, data) ( \ - (*(buf) = (guint8)(data) & 0xff), \ - 1) -#define aimutil_getle8(buf) ( \ - (*(buf)) & 0xff \ - ) -#define aimutil_putle16(buf, data) ( \ - (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \ - (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \ - 2) -#define aimutil_getle16(buf) ( \ - (((*((buf)+0)) << 0) & 0x00ff) + \ - (((*((buf)+1)) << 8) & 0xff00) \ - ) -#define aimutil_putle32(buf, data) ( \ - (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \ - (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \ - (*((buf)+2) = (guint8)((data) >> 16) & 0xff), \ - (*((buf)+3) = (guint8)((data) >> 24) & 0xff), \ - 4) -#define aimutil_getle32(buf) ( \ - (((*((buf)+0)) << 0) & 0x000000ff) + \ - (((*((buf)+1)) << 8) & 0x0000ff00) + \ - (((*((buf)+2)) << 16) & 0x00ff0000) + \ - (((*((buf)+3)) << 24) & 0xff000000)) - -int oscar_get_ui_info_int(const char *str, int default_value); -const char *oscar_get_ui_info_string(const char *str, const char *default_value); -gchar *oscar_get_clientstring(void); - -guint16 aimutil_iconsum(const guint8 *buf, int buflen); -int aimutil_tokslen(char *toSearch, int theindex, char dl); -int aimutil_itemcnt(char *toSearch, char dl); -char *aimutil_itemindex(char *toSearch, int theindex, char dl); - -gboolean oscar_util_valid_name(const char *bn); -gboolean oscar_util_valid_name_icq(const char *bn); -gboolean oscar_util_valid_name_sms(const char *bn); -int oscar_util_name_compare(const char *bn1, const char *bn2); - - - - -typedef struct { - guint16 family; - guint16 subtype; - guint16 flags; - guint32 id; -} aim_modsnac_t; - -#define AIM_MODULENAME_MAXLEN 16 -#define AIM_MODFLAG_MULTIFAMILY 0x0001 -typedef struct aim_module_s -{ - guint16 family; - guint16 version; - guint16 toolid; - guint16 toolversion; - guint16 flags; - char name[AIM_MODULENAME_MAXLEN+1]; - int (*snachandler)(OscarData *od, FlapConnection *conn, struct aim_module_s *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs); - void (*shutdown)(OscarData *od, struct aim_module_s *mod); - void *priv; - struct aim_module_s *next; -} aim_module_t; - -int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *)); -void aim__shutdownmodules(OscarData *od); -aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group); -aim_module_t *aim__findmodule(OscarData *od, const char *name); - -int admin_modfirst(OscarData *od, aim_module_t *mod); -int buddylist_modfirst(OscarData *od, aim_module_t *mod); -int bos_modfirst(OscarData *od, aim_module_t *mod); -int search_modfirst(OscarData *od, aim_module_t *mod); -int stats_modfirst(OscarData *od, aim_module_t *mod); -int auth_modfirst(OscarData *od, aim_module_t *mod); -int msg_modfirst(OscarData *od, aim_module_t *mod); -int misc_modfirst(OscarData *od, aim_module_t *mod); -int chatnav_modfirst(OscarData *od, aim_module_t *mod); -int chat_modfirst(OscarData *od, aim_module_t *mod); -int locate_modfirst(OscarData *od, aim_module_t *mod); -int service_modfirst(OscarData *od, aim_module_t *mod); -int invite_modfirst(OscarData *od, aim_module_t *mod); -int translate_modfirst(OscarData *od, aim_module_t *mod); -int popups_modfirst(OscarData *od, aim_module_t *mod); -int adverts_modfirst(OscarData *od, aim_module_t *mod); -int odir_modfirst(OscarData *od, aim_module_t *mod); -int bart_modfirst(OscarData *od, aim_module_t *mod); -int ssi_modfirst(OscarData *od, aim_module_t *mod); -int icq_modfirst(OscarData *od, aim_module_t *mod); -int email_modfirst(OscarData *od, aim_module_t *mod); - -void aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype); -void aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype); -void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *); -void aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *); - -/* bstream.c */ -int byte_stream_new(ByteStream *bs, guint32 len); -int byte_stream_init(ByteStream *bs, guint8 *data, int len); -void byte_stream_destroy(ByteStream *bs); -int byte_stream_empty(ByteStream *bs); -int byte_stream_curpos(ByteStream *bs); -int byte_stream_setpos(ByteStream *bs, unsigned int off); -void byte_stream_rewind(ByteStream *bs); -int byte_stream_advance(ByteStream *bs, int n); -guint8 byte_stream_get8(ByteStream *bs); -guint16 byte_stream_get16(ByteStream *bs); -guint32 byte_stream_get32(ByteStream *bs); -guint8 byte_stream_getle8(ByteStream *bs); -guint16 byte_stream_getle16(ByteStream *bs); -guint32 byte_stream_getle32(ByteStream *bs); -int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len); -guint8 *byte_stream_getraw(ByteStream *bs, int len); -char *byte_stream_getstr(ByteStream *bs, int len); -int byte_stream_put8(ByteStream *bs, guint8 v); -int byte_stream_put16(ByteStream *bs, guint16 v); -int byte_stream_put32(ByteStream *bs, guint32 v); -int byte_stream_putle8(ByteStream *bs, guint8 v); -int byte_stream_putle16(ByteStream *bs, guint16 v); -int byte_stream_putle32(ByteStream *bs, guint32 v); -int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len); -int byte_stream_putstr(ByteStream *bs, const char *str); -int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len); -int byte_stream_putuid(ByteStream *bs, OscarData *od); -int byte_stream_putcaps(ByteStream *bs, guint32 caps); - -/** - * Inserts a BART asset block into the given byte stream. The flags - * and length are set appropriately based on the value of data. - */ -void byte_stream_put_bart_asset(ByteStream *bs, guint16 type, ByteStream *data); - -/** - * A helper function that calls byte_stream_put_bart_asset with the - * appropriate data ByteStream given the datastr. - */ -void byte_stream_put_bart_asset_str(ByteStream *bs, guint16 type, const char *datastr); - -/* - * Generic SNAC structure. Rarely if ever used. - */ -typedef struct aim_snac_s { - aim_snacid_t id; - guint16 family; - guint16 type; - guint16 flags; - void *data; - time_t issuetime; - struct aim_snac_s *next; -} aim_snac_t; - -/* snac.c */ -void aim_initsnachash(OscarData *od); -aim_snacid_t aim_newsnac(OscarData *, aim_snac_t *newsnac); -aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen); -aim_snac_t *aim_remsnac(OscarData *, aim_snacid_t id); -void aim_cleansnacs(OscarData *, int maxage); -int aim_putsnac(ByteStream *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id); - -struct chatsnacinfo { - guint16 exchange; - char name[128]; - guint16 instance; -}; - -struct rateclass { - guint16 classid; - guint32 windowsize; - guint32 clear; - guint32 alert; - guint32 limit; - guint32 disconnect; - guint32 current; - guint32 max; - guint32 delta; - guint8 dropping_snacs; - GHashTable *members; /* Key is family and subtype, value is TRUE. */ - - struct timeval last; /**< The time when we last sent a SNAC of this rate class. */ -}; - -int aim_cachecookie(OscarData *od, IcbmCookie *cookie); -IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type); -IcbmCookie *aim_mkcookie(guint8 *, int, void *); -IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int); -int aim_freecookie(OscarData *od, IcbmCookie *cookie); -int aim_msgcookie_gettype(int type); -int aim_cookie_free(OscarData *od, IcbmCookie *cookie); - -int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo); - -void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn); - -#ifdef __cplusplus -} -#endif - -#endif /* _OSCAR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1125 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Functions dealing with peer connections. This includes the code - * used to establish a peer connection for both Oscar File transfer - * (OFT) and Oscar Direct Connect (ODC). (ODC is also referred to - * as DirectIM and IM Image.) - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -/* From the oscar PRPL */ -#include "oscar.h" -#include "peer.h" - -/* From Purple */ -#include "conversation.h" -#include "ft.h" -#include "network.h" -#include "notify.h" -#include "request.h" -#include "util.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#include /* for inet_ntoa */ -#include /* for UINT_MAX */ -#endif - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* - * I really want to switch all our networking code to using IPv6 only, - * but that really isn't a good idea at all. Evan S. of Adium says - * OS X sets all connections as "AF_INET6/PF_INET6," even if there is - * nothing inherently IPv6 about them. And I feel like Linux kernel - * 2.6.5 is doing the same thing. So we REALLY should accept - * connections if they're showing up as IPv6. Old OSes (Solaris?) - * that might not have full IPv6 support yet will fail if we try - * to use PF_INET6 but it isn't defined. --Mark Doliner - */ -#ifndef PF_INET6 -#define PF_INET6 PF_INET -#endif - -PeerConnection * -peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type) -{ - GSList *cur; - PeerConnection *conn; - - for (cur = od->peer_connections; cur != NULL; cur = cur->next) - { - conn = cur->data; - if ((conn->type == type) && !oscar_util_name_compare(conn->bn, bn)) - return conn; - } - - return NULL; -} - -/** - * @param cookie This must be exactly 8 characters. - */ -PeerConnection * -peer_connection_find_by_cookie(OscarData *od, const char *bn, const guchar *cookie) -{ - GSList *cur; - PeerConnection *conn; - - for (cur = od->peer_connections; cur != NULL; cur = cur->next) - { - conn = cur->data; - if (!memcmp(conn->cookie, cookie, 8) && !oscar_util_name_compare(conn->bn, bn)) - return conn; - } - - return NULL; -} - -PeerConnection * -peer_connection_new(OscarData *od, OscarCapability type, const char *bn) -{ - PeerConnection *conn; - PurpleAccount *account; - - account = purple_connection_get_account(od->gc); - - conn = g_new0(PeerConnection, 1); - conn->od = od; - conn->type = type; - conn->bn = g_strdup(bn); - conn->buffer_outgoing = purple_circ_buffer_new(0); - conn->listenerfd = -1; - conn->fd = -1; - conn->lastactivity = time(NULL); - conn->use_proxy |= purple_account_get_bool(account, "always_use_rv_proxy", FALSE); - - if (type == OSCAR_CAPABILITY_DIRECTIM) - memcpy(conn->magic, "ODC2", 4); - else if (type == OSCAR_CAPABILITY_SENDFILE) - memcpy(conn->magic, "OFT2", 4); - - od->peer_connections = g_slist_prepend(od->peer_connections, conn); - - return conn; -} - -static void -peer_connection_close(PeerConnection *conn) -{ - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - peer_odc_close(conn); - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - peer_oft_close(conn); - - if (conn->verified_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->verified_connect_data); - conn->verified_connect_data = NULL; - } - - if (conn->client_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->client_connect_data); - conn->client_connect_data = NULL; - } - - if (conn->listen_data != NULL) - { - purple_network_listen_cancel(conn->listen_data); - conn->listen_data = NULL; - } - - if (conn->connect_timeout_timer != 0) - { - purple_timeout_remove(conn->connect_timeout_timer); - conn->connect_timeout_timer = 0; - } - - if (conn->watcher_incoming != 0) - { - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - } - if (conn->watcher_outgoing != 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - } - if (conn->listenerfd >= 0) - { - close(conn->listenerfd); - conn->listenerfd = -1; - } - if (conn->fd >= 0) - { - close(conn->fd); - conn->fd = -1; - } - - g_free(conn->buffer_incoming.data); - conn->buffer_incoming.data = NULL; - conn->buffer_incoming.len = 0; - conn->buffer_incoming.offset = 0; - - purple_circ_buffer_destroy(conn->buffer_outgoing); - conn->buffer_outgoing = purple_circ_buffer_new(0); - - conn->flags &= ~PEER_CONNECTION_FLAG_IS_INCOMING; -} - -static gboolean -peer_connection_destroy_cb(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - purple_request_close_with_handle(conn); - - peer_connection_close(conn); - - if (conn->checksum_data != NULL) - peer_oft_checksum_destroy(conn->checksum_data); - - if (conn->xfer != NULL) - { - PurpleXferStatusType status; - conn->xfer->data = NULL; - status = purple_xfer_get_status(conn->xfer); - if ((status != PURPLE_XFER_STATUS_DONE) && - (status != PURPLE_XFER_STATUS_CANCEL_LOCAL) && - (status != PURPLE_XFER_STATUS_CANCEL_REMOTE)) - { - if ((conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) || - (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED)) - purple_xfer_cancel_remote(conn->xfer); - else - purple_xfer_cancel_local(conn->xfer); - } - purple_xfer_unref(conn->xfer); - conn->xfer = NULL; - } - - g_free(conn->bn); - g_free(conn->error_message); - g_free(conn->proxyip); - g_free(conn->clientip); - g_free(conn->verifiedip); - g_free(conn->xferdata.name); - purple_circ_buffer_destroy(conn->buffer_outgoing); - - conn->od->peer_connections = g_slist_remove(conn->od->peer_connections, conn); - - g_free(conn); - - return FALSE; -} - -void -peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - purple_timeout_remove(conn->destroy_timeout); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - peer_connection_destroy_cb(conn); -} - -void -peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - /* Already taken care of */ - return; - - purple_debug_info("oscar", "Scheduling destruction of peer connection\n"); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - conn->destroy_timeout = purple_timeout_add(0, peer_connection_destroy_cb, conn); -} - -/*******************************************************************/ -/* Begin code for receiving data on a peer connection */ -/*******************************************************************/ - -/** - * This should be used to read ODC and OFT framing info. It should - * NOT be used to read the payload sent across the connection (IMs, - * file data, etc), and it should NOT be used to read proxy negotiation - * headers. - * - * Unlike flap_connection_recv_cb(), this only reads one frame at a - * time. This is done so that the watcher can be changed during the - * handling of the frame. If the watcher is changed then this - * function will not read in any more data. This happens when - * reading the payload of a direct IM frame, or when we're - * receiving a file from the remote user. Once the data has been - * read, the watcher will be switched back to this function to - * continue reading the next frame. - */ -void -peer_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - gssize read; - - conn = data; - - /* Start reading a new ODC/OFT frame */ - if (conn->buffer_incoming.data == NULL) - { - /* Read the first 6 bytes (magic string and frame length) */ - read = recv(conn->fd, conn->header + conn->header_received, - 6 - conn->header_received, 0); - - /* Check if the remote user closed the connection */ - if (read == 0) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - return; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - peer_connection_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - conn->lastactivity = time(NULL); - - /* If we don't even have the first 6 bytes then do nothing */ - conn->header_received += read; - if (conn->header_received < 6) - return; - - /* All ODC/OFT frames must start with a magic string */ - if (memcmp(conn->magic, conn->header, 4)) - { - purple_debug_warning("oscar", "Expecting magic string to " - "be %c%c%c%c but received magic string %c%c%c%c. " - "Closing connection.\n", - conn->magic[0], conn->magic[1], conn->magic[2], - conn->magic[3], conn->header[0], conn->header[1], - conn->header[2], conn->header[3]); - peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); - return; - } - - /* Initialize a new temporary ByteStream for incoming data */ - conn->buffer_incoming.len = aimutil_get16(&conn->header[4]) - 6; - conn->buffer_incoming.data = g_new(guint8, conn->buffer_incoming.len); - conn->buffer_incoming.offset = 0; - } - - /* Read data into the temporary buffer until it is complete */ - read = recv(conn->fd, - &conn->buffer_incoming.data[conn->buffer_incoming.offset], - conn->buffer_incoming.len - conn->buffer_incoming.offset, - 0); - - /* Check if the remote user closed the connection */ - if (read == 0) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - return; - } - - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - peer_connection_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - conn->lastactivity = time(NULL); - conn->buffer_incoming.offset += read; - if (conn->buffer_incoming.offset < conn->buffer_incoming.len) - /* Waiting for more data to arrive */ - return; - - /* We have a complete ODC/OFT frame! Handle it and continue reading */ - byte_stream_rewind(&conn->buffer_incoming); - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - peer_odc_recv_frame(conn, &conn->buffer_incoming); - } - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - peer_oft_recv_frame(conn, &conn->buffer_incoming); - } - - g_free(conn->buffer_incoming.data); - conn->buffer_incoming.data = NULL; - - conn->header_received = 0; -} - -/*******************************************************************/ -/* End code for receiving data on a peer connection */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin code for sending data on a peer connection */ -/*******************************************************************/ - -static void -send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - gsize writelen; - gssize wrotelen; - - conn = data; - writelen = purple_circ_buffer_get_max_read(conn->buffer_outgoing); - - if (writelen == 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - /* - * The buffer is currently empty, so reset the current input - * and output positions to the start of the buffer. We do - * this so that the next chunk of data that we put into the - * buffer can be read back out of the buffer in one fell swoop. - * Otherwise it gets fragmented and we have to read from the - * second half of the buffer than go back and read the rest of - * the chunk from the first half. - * - * We're using TCP, which is a stream based protocol, so this - * isn't supposed to matter. However, experience has shown - * that at least the proxy file transfer code in AIM 6.1.41.2 - * requires that the entire OFT frame arrive all at once. If - * the frame is fragmented then AIM freaks out and aborts the - * file transfer. Somebody should teach those guys how to - * write good TCP code. - */ - conn->buffer_outgoing->inptr = conn->buffer_outgoing->buffer; - conn->buffer_outgoing->outptr = conn->buffer_outgoing->buffer; - return; - } - - wrotelen = send(conn->fd, conn->buffer_outgoing->outptr, writelen, 0); - if (wrotelen <= 0) - { - if (wrotelen < 0 && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) - /* No worries */ - return; - - if (conn->ready) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - close(conn->fd); - conn->fd = -1; - peer_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, NULL); - } - else - { - /* - * This could happen when unable to send a negotiation - * frame to a peer proxy server. - */ - peer_connection_trynext(conn); - } - return; - } - - purple_circ_buffer_mark_read(conn->buffer_outgoing, wrotelen); - conn->lastactivity = time(NULL); -} - -/** - * This should be called by OFT/ODC code to send a standard OFT or ODC - * frame across the peer connection along with some payload data. Or - * maybe a file. Anything, really. - */ -void -peer_connection_send(PeerConnection *conn, ByteStream *bs) -{ - /* Add everything to our outgoing buffer */ - purple_circ_buffer_append(conn->buffer_outgoing, bs->data, bs->len); - - /* If we haven't already started writing stuff, then start the cycle */ - if ((conn->watcher_outgoing == 0) && (conn->fd >= 0)) - { - conn->watcher_outgoing = purple_input_add(conn->fd, - PURPLE_INPUT_WRITE, send_cb, conn); - send_cb(conn, conn->fd, 0); - } -} - -/*******************************************************************/ -/* End code for sending data on a peer connection */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin code for establishing a peer connection */ -/*******************************************************************/ - -void -peer_connection_finalize_connection(PeerConnection *conn) -{ - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_connection_recv_cb, conn); - - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - /* - * If we are connecting to them then send our cookie so they - * can verify who we are. Note: This doesn't seem to be - * necessary, but it also doesn't seem to hurt. - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING)) - peer_odc_send_cookie(conn); - } - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - if (purple_xfer_get_type(conn->xfer) == PURPLE_XFER_SEND) - { - peer_oft_send_prompt(conn); - } - } - - /* - * Tell the remote user that we're connected (which may also imply - * that we've accepted their request). - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING)) - aim_im_sendch2_connected(conn); -} - -/** - * We tried to make an outgoing connection to a remote user. It - * either connected or failed to connect. - */ -static void -peer_connection_common_established_cb(gpointer data, gint source, const gchar *error_message, gboolean verified) -{ - PeerConnection *conn; - - conn = data; - - if (verified) - conn->verified_connect_data = NULL; - else - conn->client_connect_data = NULL; - - if (source < 0) - { - if ((conn->verified_connect_data == NULL) && - (conn->client_connect_data == NULL)) - { - /* Our parallel connection attemps have both failed. */ - peer_connection_trynext(conn); - } - return; - } - - purple_timeout_remove(conn->connect_timeout_timer); - conn->connect_timeout_timer = 0; - - if (conn->client_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->client_connect_data); - conn->client_connect_data = NULL; - } - - if (conn->verified_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->verified_connect_data); - conn->verified_connect_data = NULL; - } - - conn->fd = source; - - peer_connection_finalize_connection(conn); -} - -static void -peer_connection_verified_established_cb(gpointer data, gint source, const gchar *error_message) -{ - peer_connection_common_established_cb(data, source, error_message, TRUE); -} - -static void -peer_connection_client_established_cb(gpointer data, gint source, const gchar *error_message) -{ - peer_connection_common_established_cb(data, source, error_message, FALSE); -} - -/** - * This is the watcher callback for any listening socket that is - * waiting for a peer to connect. When a peer connects we set the - * input watcher to start reading data from the peer. - * - * To make sure that the connection is with the intended person and - * not with a malicious middle man, we don't send anything until we've - * received a peer frame from the remote user and have verified that - * the cookie in the peer frame matches the cookie that was exchanged - * in the channel 2 ICBM. - */ -void -peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - OscarData *od; - PurpleConnection *gc; - struct sockaddr addr; - socklen_t addrlen = sizeof(addr); - int flags; - - conn = data; - od = conn->od; - gc = od->gc; - - purple_debug_info("oscar", "Accepting connection on listener socket.\n"); - - conn->fd = accept(conn->listenerfd, &addr, &addrlen); - if (conn->fd < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No connection yet--no worries */ - /* TODO: Hmm, but they SHOULD be connected if we're here, right? */ - return; - - peer_connection_trynext(conn); - return; - } - - if ((addr.sa_family != PF_INET) && (addr.sa_family != PF_INET6)) - { - /* Invalid connection type?! Continue waiting. */ - close(conn->fd); - return; - } - - flags = fcntl(conn->fd, F_GETFL); - fcntl(conn->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(conn->fd, F_SETFD, FD_CLOEXEC); -#endif - - purple_input_remove(conn->watcher_incoming); - - peer_connection_finalize_connection(conn); -} - -/** - * We've just opened a listener socket, so we send the remote - * user an ICBM and ask them to connect to us. - */ -static void -peer_connection_establish_listener_cb(int listenerfd, gpointer data) -{ - PeerConnection *conn; - OscarData *od; - PurpleConnection *gc; - PurpleAccount *account; - PurpleConversation *conv; - char *tmp; - FlapConnection *bos_conn; - const char *listener_ip; - unsigned short listener_port; - - conn = data; - conn->listen_data = NULL; - - if (listenerfd < 0) - { - /* Could not open listener socket */ - peer_connection_trynext(conn); - return; - } - - od = conn->od; - gc = od->gc; - account = purple_connection_get_account(gc); - conn->listenerfd = listenerfd; - - /* Watch for new connections on our listener socket */ - conn->watcher_incoming = purple_input_add(conn->listenerfd, - PURPLE_INPUT_READ, peer_connection_listen_cb, conn); - - /* Send the "please connect to me!" ICBM */ - bos_conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (bos_conn == NULL) - { - /* Not good */ - peer_connection_trynext(conn); - return; - } - - if (bos_conn->gsc) - listener_ip = purple_network_get_my_ip(bos_conn->gsc->fd); - else - listener_ip = purple_network_get_my_ip(bos_conn->fd); - listener_port = purple_network_get_port_from_fd(conn->listenerfd); - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - aim_im_sendch2_odc_requestdirect(od, - conn->cookie, conn->bn, purple_network_ip_atoi(listener_ip), - listener_port, ++conn->lastrequestnumber); - - /* Print a message to a local conversation window */ - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for " - "Direct IM."), conn->bn, listener_ip, listener_port); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - const guchar *ip_atoi = purple_network_ip_atoi(listener_ip); - if (ip_atoi == NULL) { - purple_debug_error("oscar", "Cannot send file. atoi(%s) failed.\n" - "Other possibly useful information: fd = %d, port = %d\n", - listener_ip ? listener_ip : "(null!)", conn->listenerfd, - listener_port); - purple_xfer_cancel_local(conn->xfer); - return; - } - aim_im_sendch2_sendfile_requestdirect(od, - conn->cookie, conn->bn, - ip_atoi, - listener_port, ++conn->lastrequestnumber, - (const gchar *)conn->xferdata.name, - conn->xferdata.size, conn->xferdata.totfiles); - } -} - -/** - * This is a callback function used when we're connecting to a peer - * using either the client IP or the verified IP and the connection - * took longer than 5 seconds to complete. We do this because - * waiting for the OS to time out the connection attempt is not - * practical--the default timeout on many OSes can be 3 minutes or - * more, and users are impatient. - * - * Worst case scenario: the user is connected to the Internet using - * a modem with severe lag. The peer connections fail and Purple falls - * back to using a proxied connection. The lower bandwidth - * limitations imposed by the proxied connection won't matter because - * the user is using a modem. - * - * I suppose this line of thinking is discriminatory against people - * with very high lag but decent throughput who are transferring - * large files. But we don't care about those people. - * - * I (Sean) changed the timeout from 15 to 5 seconds, as 60 seconds is - * too long for a user to wait to send a file. I'm also parallelizing - * requests when possible. The longest we should have to wait now is 10 - * seconds. We shouldn't make it shorter than this. - */ -static gboolean -peer_connection_tooktoolong(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - purple_debug_info("oscar", "Peer connection timed out after 5 seconds. " - "Trying next method...\n"); - - peer_connection_trynext(conn); - - /* Cancel this timer. It'll be added again, if needed. */ - return FALSE; -} - -/** - * Try to establish the given PeerConnection using a defined - * sequence of steps. - */ -void -peer_connection_trynext(PeerConnection *conn) -{ - PurpleAccount *account; - - account = purple_connection_get_account(conn->od->gc); - - /* - * Close any remnants of a previous failed connection attempt. - */ - peer_connection_close(conn); - - /* - * 1. Attempt to connect to the remote user using their verifiedip and clientip. - * We try these at the same time and use whichever succeeds first, so we don't - * have to wait for a timeout. - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_DIRECT) && - (conn->verifiedip != NULL) && (conn->port != 0) && (!conn->use_proxy)) - { - conn->flags |= PEER_CONNECTION_FLAG_TRIED_DIRECT; - - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - gchar *tmp; - PurpleConversation *conv; - tmp = g_strdup_printf(_("Attempting to connect to %s:%hu."), - conn->verifiedip, conn->port); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - - conn->verified_connect_data = purple_proxy_connect(NULL, account, - conn->verifiedip, conn->port, - peer_connection_verified_established_cb, conn); - - if ((conn->verifiedip == NULL) || - strcmp(conn->verifiedip, conn->clientip)) - { - conn->client_connect_data = purple_proxy_connect(NULL, account, - conn->clientip, conn->port, - peer_connection_client_established_cb, conn); - } - - if ((conn->verified_connect_data != NULL) || - (conn->client_connect_data != NULL)) - { - /* Connecting... */ - conn->connect_timeout_timer = purple_timeout_add_seconds(5, - peer_connection_tooktoolong, conn); - return; - } - } - - /* - * 2. Attempt to have the remote user connect to us (using both - * our verifiedip and our clientip). - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_INCOMING) && - (!conn->use_proxy)) - { - conn->flags |= PEER_CONNECTION_FLAG_TRIED_INCOMING; - - /* - * Remote user is connecting to us, so we'll need to verify - * that the user who connected is our friend. - */ - conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - - conn->listen_data = purple_network_listen_range(5190, 5290, SOCK_STREAM, - peer_connection_establish_listener_cb, conn); - if (conn->listen_data != NULL) - { - /* Opening listener socket... */ - return; - } - } - - /* - * 3. Attempt to have both users connect to an intermediate proxy - * server. - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_PROXY)) - { - conn->flags |= PEER_CONNECTION_FLAG_TRIED_PROXY; - - /* - * If we initiate the proxy connection, then the remote user - * could be anyone, so we need to verify that the user who - * connected is our friend. - */ - if (!conn->use_proxy) - conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - gchar *tmp; - PurpleConversation *conv; - tmp = g_strdup(_("Attempting to connect via proxy server.")); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - - conn->verified_connect_data = purple_proxy_connect(NULL, account, - (conn->proxyip != NULL) ? conn->proxyip : PEER_PROXY_SERVER, - PEER_PROXY_PORT, - peer_proxy_connection_established_cb, conn); - if (conn->verified_connect_data != NULL) - { - /* Connecting... */ - return; - } - } - - /* Give up! */ - peer_connection_destroy(conn, OSCAR_DISCONNECT_COULD_NOT_CONNECT, NULL); -} - -/** - * Initiate a peer connection with someone. - */ -void -peer_connection_propose(OscarData *od, OscarCapability type, const char *bn) -{ - PeerConnection *conn; - - if (type == OSCAR_CAPABILITY_DIRECTIM) - { - conn = peer_connection_find_by_type(od, bn, type); - if (conn != NULL) - { - if (conn->ready) - { - PurpleAccount *account; - PurpleConversation *conv; - - purple_debug_info("oscar", "Already have a direct IM " - "session with %s.\n", bn); - account = purple_connection_get_account(od->gc); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - bn, account); - if (conv != NULL) - purple_conversation_present(conv); - return; - } - - /* Cancel the old connection and try again */ - peer_connection_destroy(conn, OSCAR_DISCONNECT_RETRYING, NULL); - } - } - - conn = peer_connection_new(od, type, bn); - conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - aim_icbm_makecookie(conn->cookie); - - peer_connection_trynext(conn); -} - -/** - * Someone else wants to establish a peer connection with us, - * and we said yes. - */ -static void -peer_connection_got_proposition_yes_cb(gpointer data, gint id) -{ - PeerConnection *conn; - - conn = data; - - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - peer_connection_trynext(conn); -} - -/** - * Someone else wants to establish a peer connection with us, - * and we said no. - * - * "Well, one time my friend asked me if I wanted to play the - * piccolo. But I said no." - */ -static void -peer_connection_got_proposition_no_cb(gpointer data, gint id) -{ - PeerConnection *conn; - - conn = data; - - aim_im_denytransfer(conn->od, conn->bn, conn->cookie, - AIM_TRANSFER_DENY_DECLINE); - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); -} - -/** - * Someone else wants to establish a peer connection with us. - */ -void -peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *message, IcbmArgsCh2 *args) -{ - PurpleConnection *gc; - PurpleAccount *account; - PeerConnection *conn; - gchar *buf; - - gc = od->gc; - account = purple_connection_get_account(gc); - - /* - * If we have a connection with this same cookie then they are - * probably just telling us they weren't able to connect to us - * and we should try connecting to them, instead. Or they want - * to go through a proxy. - */ - conn = peer_connection_find_by_cookie(od, bn, args->cookie); - if ((conn != NULL) && (conn->type == args->type)) - { - purple_debug_info("oscar", "Remote user wants to try a " - "different connection method\n"); - g_free(conn->proxyip); - g_free(conn->clientip); - g_free(conn->verifiedip); - if (args->use_proxy) - conn->proxyip = g_strdup(args->proxyip); - else - conn->proxyip = NULL; - conn->verifiedip = g_strdup(args->verifiedip); - conn->clientip = g_strdup(args->clientip); - conn->port = args->port; - conn->use_proxy |= args->use_proxy; - conn->lastrequestnumber++; - peer_connection_trynext(conn); - return; - } - - /* If this is a direct IM, then close any existing session */ - if (args->type == OSCAR_CAPABILITY_DIRECTIM) - { - conn = peer_connection_find_by_type(od, bn, args->type); - if (conn != NULL) - { - /* Close the old direct IM and start a new one */ - purple_debug_info("oscar", "Received new direct IM request " - "from %s. Destroying old connection.\n", bn); - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - } - } - - /* Check for proper arguments */ - if (args->type == OSCAR_CAPABILITY_SENDFILE) - { - if ((args->info.sendfile.filename == NULL) || - (args->info.sendfile.totsize == 0) || - (args->info.sendfile.totfiles == 0)) - { - purple_debug_warning("oscar", - "%s tried to send you a file with incomplete " - "information.\n", bn); - return; - } - } - - conn = peer_connection_new(od, args->type, bn); - memcpy(conn->cookie, args->cookie, 8); - if (args->use_proxy) - conn->proxyip = g_strdup(args->proxyip); - conn->clientip = g_strdup(args->clientip); - conn->verifiedip = g_strdup(args->verifiedip); - conn->port = args->port; - conn->use_proxy |= args->use_proxy; - conn->lastrequestnumber++; - - if (args->type == OSCAR_CAPABILITY_DIRECTIM) - { - buf = g_strdup_printf(_("%s has just asked to directly connect to %s"), - bn, purple_account_get_username(account)); - - purple_request_action(conn, NULL, buf, - _("This requires a direct connection between " - "the two computers and is necessary for IM " - "Images. Because your IP address will be " - "revealed, this may be considered a privacy " - "risk."), - PURPLE_DEFAULT_ACTION_NONE, - account, bn, NULL, - conn, 2, - _("C_onnect"), G_CALLBACK(peer_connection_got_proposition_yes_cb), - _("Cancel"), G_CALLBACK(peer_connection_got_proposition_no_cb)); - } - else if (args->type == OSCAR_CAPABILITY_SENDFILE) - { - gchar *filename; - - conn->xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, bn); - if (conn->xfer) - { - conn->xfer->data = conn; - purple_xfer_ref(conn->xfer); - purple_xfer_set_size(conn->xfer, args->info.sendfile.totsize); - - /* Set the file name */ - if (g_utf8_validate(args->info.sendfile.filename, -1, NULL)) - filename = g_strdup(args->info.sendfile.filename); - else - filename = purple_utf8_salvage(args->info.sendfile.filename); - - if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) - { - /* - * If they are sending us a directory then the last character - * of the file name will be an asterisk. We don't want to - * save stuff to a directory named "*" so we remove the - * asterisk from the file name. - */ - char *tmp = strrchr(filename, '\\'); - if ((tmp != NULL) && (tmp[1] == '*')) - tmp[0] = '\0'; - } - purple_xfer_set_filename(conn->xfer, filename); - g_free(filename); - - /* - * Set the message, unless this is the dummy message from an - * ICQ client or an empty message from an AIM client. - * TODO: Maybe we should strip HTML and then see if strlen>0? - */ - if ((message != NULL) && - (g_ascii_strncasecmp(message, "", 13) != 0) && - (g_ascii_strcasecmp(message, "") != 0)) - { - purple_xfer_set_message(conn->xfer, message); - } - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(conn->xfer, peer_oft_recvcb_init); - purple_xfer_set_end_fnc(conn->xfer, peer_oft_recvcb_end); - purple_xfer_set_request_denied_fnc(conn->xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_cancel_recv_fnc(conn->xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_ack_fnc(conn->xfer, peer_oft_recvcb_ack_recv); - - /* Now perform the request */ - purple_xfer_request(conn->xfer); - } - } -} - -/*******************************************************************/ -/* End code for establishing a peer connection */ -/*******************************************************************/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,281 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * OFT and ODC Services - */ - -#ifndef _PEER_H_ -#define _PEER_H_ - -#include "ft.h" -#include "network.h" -#include "proxy.h" - -typedef struct _ChecksumData ChecksumData; -typedef struct _OdcFrame OdcFrame; -typedef struct _OftFrame OftFrame; -typedef struct _ProxyFrame ProxyFrame; -typedef struct _PeerConnection PeerConnection; - -#define PEER_CONNECTION_FLAG_INITIATED_BY_ME 0x0001 -#define PEER_CONNECTION_FLAG_APPROVED 0x0002 -#define PEER_CONNECTION_FLAG_TRIED_DIRECT 0x0004 -#define PEER_CONNECTION_FLAG_TRIED_INCOMING 0x0008 -#define PEER_CONNECTION_FLAG_TRIED_PROXY 0x0010 -#define PEER_CONNECTION_FLAG_IS_INCOMING 0x0020 - -#define PEER_TYPE_PROMPT 0x0101 /* "I am going to send you this file, is that ok?" */ -#define PEER_TYPE_RESUMEACCEPT 0x0106 /* We are accepting the resume */ -#define PEER_TYPE_ACK 0x0202 /* "Yes, it is ok for you to send me that file" */ -#define PEER_TYPE_DONE 0x0204 /* "I received that file with no problems, thanks a bunch" */ -#define PEER_TYPE_RESUME 0x0205 /* Resume transferring, sent by whoever receives */ -#define PEER_TYPE_RESUMEACK 0x0207 /* Our resume accept was ACKed */ - -#define PEER_TYPE_GETFILE_REQUESTLISTING 0x1108 /* "I have a listing.txt file, do you want it?" */ -#define PEER_TYPE_GETFILE_RECEIVELISTING 0x1209 /* "Yes, please send me your listing.txt file" */ -#define PEER_TYPE_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? I'm just guessing about this one... */ -#define PEER_TYPE_GETFILE_ACKLISTING 0x120b /* "I received the listing.txt file successfully" */ -#define PEER_TYPE_GETFILE_REQUESTFILE 0x120c /* "Please send me this file" */ - -/* - * For peer proxying - */ -#define PEER_PROXY_SERVER "ars.oscar.aol.com" -#define PEER_PROXY_PORT 5190 /* The port we should always connect to */ -#define PEER_PROXY_PACKET_VERSION 0x044a - -/* Thanks to Keith Lea and the Joust project for documenting these */ -#define PEER_PROXY_TYPE_ERROR 0x0001 -#define PEER_PROXY_TYPE_CREATE 0x0002 -#define PEER_PROXY_TYPE_CREATED 0x0003 -#define PEER_PROXY_TYPE_JOIN 0x0004 -#define PEER_PROXY_TYPE_READY 0x0005 - -struct _OdcFrame -{ - /* guchar magic[4]; */ /* 0 */ - /* guint16 length; */ /* 4 */ - guint16 type; /* 6 */ - guint16 subtype; /* 8 */ - /* Unknown */ /* 10 */ - guchar cookie[8]; /* 12 */ - /* Unknown */ - /* guint32 payloadlength; */ /* 28 */ - guint16 encoding; /* 32 */ - /* Unknown */ - guint16 flags; /* 38 */ - /* Unknown */ - guchar bn[32]; /* 44 */ - /* Unknown */ - ByteStream payload; /* 76 */ -}; - -struct _OftFrame -{ - /* guchar magic[4]; */ /* 0 */ - /* guint16 length; */ /* 4 */ - guint16 type; /* 6 */ - guchar cookie[8]; /* 8 */ - guint16 encrypt; /* 16 */ - guint16 compress; /* 18 */ - guint16 totfiles; /* 20 */ - guint16 filesleft; /* 22 */ - guint16 totparts; /* 24 */ - guint16 partsleft; /* 26 */ - guint32 totsize; /* 28 */ - guint32 size; /* 32 */ - guint32 modtime; /* 36 */ - guint32 checksum; /* 40 */ - guint32 rfrcsum; /* 44 */ - guint32 rfsize; /* 48 */ - guint32 cretime; /* 52 */ - guint32 rfcsum; /* 56 */ - guint32 nrecvd; /* 60 */ - guint32 recvcsum; /* 64 */ - guchar idstring[32]; /* 68 */ - guint8 flags; /* 100 */ - guint8 lnameoffset; /* 101 */ - guint8 lsizeoffset; /* 102 */ - guchar dummy[69]; /* 103 */ - guchar macfileinfo[16]; /* 172 */ - guint16 nencode; /* 188 */ - guint16 nlanguage; /* 190 */ - guchar *name; /* 192 */ - size_t name_length; - /* Payload? */ /* 256 */ -}; - -struct _ProxyFrame -{ - /* guint16 length; */ /* 0 */ - guint16 version; /* 2 */ - guint16 type; /* 4 */ - guint32 unknown; /* 6 */ - guint16 flags; /* 10 */ - ByteStream payload; /* 12 */ -}; - -struct _PeerConnection -{ - OscarData *od; - OscarCapability type; - char *bn; - guchar magic[4]; - guchar cookie[8]; - guint16 lastrequestnumber; - - gboolean ready; - int flags; /**< Bitmask of PEER_CONNECTION_FLAG_ */ - time_t lastactivity; /**< Time of last transmit. */ - guint destroy_timeout; - OscarDisconnectReason disconnect_reason; - char *error_message; - - /** - * A pointer to either an OdcFrame or an OftFrame. - */ - gpointer frame; - - /** - * This is only used when the peer connection is being established. - */ - PurpleProxyConnectData *client_connect_data; - PurpleProxyConnectData *verified_connect_data; - - /** - * This is only used when the peer connection is being established. - */ - PurpleNetworkListenData *listen_data; - - - /** - * This is only used when the peer connection is being established. - */ - guint connect_timeout_timer; - - /** - * This is only used while the remote user is attempting to - * connect to us. - */ - int listenerfd; - - int fd; - guint8 header[6]; - gssize header_received; - guint8 proxy_header[12]; - gssize proxy_header_received; - ByteStream buffer_incoming; - PurpleCircBuffer *buffer_outgoing; - guint watcher_incoming; - guint watcher_outgoing; - - /** - * IP address of the proxy server, if applicable. - */ - gchar *proxyip; - - /** - * IP address of the remote user from THEIR point of view. - */ - gchar *clientip; - - /** - * IP address of the remote user from the oscar server's - * point of view. - */ - gchar *verifiedip; - - guint16 port; - gboolean use_proxy; - - /** - * Checksumming - */ - ChecksumData *checksum_data; - - /* TODOFT */ - PurpleXfer *xfer; - OftFrame xferdata; - guint sending_data_timer; -}; - -/* - * For all peer connections - */ - -/** - * Create a new PeerConnection structure and initialize it with some - * sane defaults. - * - * @param type The type of the peer connection. One of - * OSCAR_CAPABILITY_DIRECTIM or OSCAR_CAPABILITY_SENDFILE. - */ -PeerConnection *peer_connection_new(OscarData *od, OscarCapability type, const char *bn); - -void peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -void peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -PeerConnection *peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type); -PeerConnection *peer_connection_find_by_cookie(OscarData *od, const char *bn, const guchar *cookie); - -void peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond); -void peer_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond); -void peer_connection_send(PeerConnection *conn, ByteStream *bs); - -void peer_connection_trynext(PeerConnection *conn); -void peer_connection_finalize_connection(PeerConnection *conn); -void peer_connection_propose(OscarData *od, OscarCapability type, const char *bn); -void peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *message, IcbmArgsCh2 *args); - -/* - * For ODC - */ -void peer_odc_close(PeerConnection *conn); -void peer_odc_recv_frame(PeerConnection *conn, ByteStream *bs); -void peer_odc_send_cookie(PeerConnection *conn); -void peer_odc_send_typing(PeerConnection *conn, PurpleTypingState typing); -void peer_odc_send_im(PeerConnection *conn, const char *msg, int len, int encoding, gboolean autoreply); - -/* - * For OFT - */ -void peer_oft_close(PeerConnection *conn); -void peer_oft_recv_frame(PeerConnection *conn, ByteStream *bs); -void peer_oft_send_prompt(PeerConnection *conn); -void peer_oft_checksum_destroy(ChecksumData *checksum_data); - -/* Xfer callbacks for receiving a file */ -void peer_oft_recvcb_init(PurpleXfer *xfer); -void peer_oft_recvcb_end(PurpleXfer *xfer); -void peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size); - -/* Xfer callbacks for sending a file */ -void peer_oft_sendcb_init(PurpleXfer *xfer); -void peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size); - -/* Xfer callbacks for both sending and receiving */ -void peer_oft_cb_generic_cancel(PurpleXfer *xfer); - -/* - * For peer proxying - */ -void peer_proxy_connection_established_cb(gpointer data, gint source, const gchar *error_message); - -#endif /* _PEER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer_proxy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer_proxy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer_proxy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/peer_proxy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,351 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "oscar.h" -#include "peer.h" - -static void -peer_proxy_send(PeerConnection *conn, ProxyFrame *frame) -{ - size_t length; - ByteStream bs; - - purple_debug_info("oscar", "Outgoing peer proxy frame with " - "type=0x%04hx, unknown=0x%08x, " - "flags=0x%04hx, and payload length=%hd\n", - frame->type, frame->unknown, - frame->flags, frame->payload.len); - - length = 12 + frame->payload.len; - byte_stream_new(&bs, length); - byte_stream_put16(&bs, length - 2); - byte_stream_put16(&bs, PEER_PROXY_PACKET_VERSION); - byte_stream_put16(&bs, frame->type); - byte_stream_put32(&bs, frame->unknown); - byte_stream_put16(&bs, frame->flags); - byte_stream_putraw(&bs, frame->payload.data, frame->payload.len); - - peer_connection_send(conn, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Create a rendezvous "init send" packet and send it on its merry way. - * This is the first packet sent to the proxy server by the first client - * to indicate that this will be a proxied connection - * - * @param conn The peer connection. - */ -static void -peer_proxy_send_create_new_conn(PeerConnection *conn) -{ - ProxyFrame frame; - PurpleAccount *account; - const gchar *bn; - guint8 bn_length; - - memset(&frame, 0, sizeof(ProxyFrame)); - frame.type = PEER_PROXY_TYPE_CREATE; - frame.flags = 0x0000; - - account = purple_connection_get_account(conn->od->gc); - bn = purple_account_get_username(account); - bn_length = strlen(bn); - byte_stream_new(&frame.payload, 1 + bn_length + 8 + 20); - byte_stream_put8(&frame.payload, bn_length); - byte_stream_putraw(&frame.payload, (const guint8 *)bn, bn_length); - byte_stream_putraw(&frame.payload, conn->cookie, 8); - - byte_stream_put16(&frame.payload, 0x0001); /* Type */ - byte_stream_put16(&frame.payload, 16); /* Length */ - byte_stream_putcaps(&frame.payload, conn->type); /* Value */ - - peer_proxy_send(conn, &frame); -} - -/** - * Create a rendezvous "init recv" packet and send it on its merry way. - * This is the first packet sent to the proxy server by the second client - * involved in this rendezvous proxy session. - * - * @param conn The peer connection. - * @param pin The 2 byte PIN sent to us by the other user. This acts - * as our passcode when establishing the proxy session. - */ -static void -peer_proxy_send_join_existing_conn(PeerConnection *conn, guint16 pin) -{ - ProxyFrame frame; - PurpleAccount *account; - const gchar *bn; - guint8 bn_length; - - memset(&frame, 0, sizeof(ProxyFrame)); - frame.type = PEER_PROXY_TYPE_JOIN; - frame.flags = 0x0000; - - account = purple_connection_get_account(conn->od->gc); - bn = purple_account_get_username(account); - bn_length = strlen(bn); - byte_stream_new(&frame.payload, 1 + bn_length + 2 + 8 + 20); - byte_stream_put8(&frame.payload, bn_length); - byte_stream_putraw(&frame.payload, (const guint8 *)bn, bn_length); - byte_stream_put16(&frame.payload, pin); - byte_stream_putraw(&frame.payload, conn->cookie, 8); - - byte_stream_put16(&frame.payload, 0x0001); /* Type */ - byte_stream_put16(&frame.payload, 16); /* Length */ - byte_stream_putcaps(&frame.payload, conn->type); /* Value */ - - peer_proxy_send(conn, &frame); -} - -/** - * Handle an incoming peer proxy negotiation frame. - */ -static void -peer_proxy_recv_frame(PeerConnection *conn, ProxyFrame *frame) -{ - purple_debug_info("oscar", "Incoming peer proxy frame with " - "type=0x%04hx, unknown=0x%08x, " - "flags=0x%04hx, and payload length=%hd\n", frame->type, - frame->unknown, frame->flags, frame->payload.len); - - if (frame->type == PEER_PROXY_TYPE_CREATED) - { - /* - * Read in 2 byte port then 4 byte IP and tell the - * remote user to connect to it by sending an ICBM. - */ - guint16 pin; - int i; - guint8 ip[4]; - - pin = byte_stream_get16(&frame->payload); - for (i = 0; i < 4; i++) - ip[i] = byte_stream_get8(&frame->payload); - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - aim_im_sendch2_odc_requestproxy(conn->od, - conn->cookie, - conn->bn, ip, pin, ++conn->lastrequestnumber); - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - aim_im_sendch2_sendfile_requestproxy(conn->od, - conn->cookie, conn->bn, - ip, pin, ++conn->lastrequestnumber, - (const gchar *)conn->xferdata.name, - conn->xferdata.size, conn->xferdata.totfiles); - } - } - else if (frame->type == PEER_PROXY_TYPE_READY) - { - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - - peer_connection_finalize_connection(conn); - } - else if (frame->type == PEER_PROXY_TYPE_ERROR) - { - if (byte_stream_empty(&frame->payload) >= 2) - { - guint16 error; - const char *msg; - error = byte_stream_get16(&frame->payload); - if (error == 0x000d) - msg = "bad request"; - else if (error == 0x0010) - msg = "initial request timed out"; - else if (error == 0x001a) - msg ="accept period timed out"; - else - msg = "unknown reason"; - purple_debug_info("oscar", "Proxy negotiation failed with " - "error 0x%04hx: %s\n", error, msg); - } - else - { - purple_debug_warning("oscar", "Proxy negotiation failed with " - "an unknown error\n"); - } - peer_connection_trynext(conn); - } - else - { - purple_debug_warning("oscar", "Unknown peer proxy frame type 0x%04hx.\n", - frame->type); - } -} - -static void -peer_proxy_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - gssize read; - ProxyFrame *frame; - - conn = data; - frame = conn->frame; - - /* Start reading a new proxy frame */ - if (frame == NULL) - { - /* Read the first 12 bytes (frame length and header) */ - read = recv(conn->fd, conn->proxy_header + conn->proxy_header_received, - 12 - conn->proxy_header_received, 0); - - /* Check if the proxy server closed the connection */ - if (read == 0) - { - purple_debug_info("oscar", "Peer proxy server closed connection\n"); - peer_connection_trynext(conn); - return; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - purple_debug_info("oscar", "Lost connection with peer proxy server\n"); - peer_connection_trynext(conn); - return; - } - - conn->lastactivity = time(NULL); - - /* If we don't even have the first 12 bytes then do nothing */ - conn->proxy_header_received += read; - if (conn->proxy_header_received < 12) - return; - - /* We only support a specific version of the proxy protocol */ - if (aimutil_get16(&conn->proxy_header[2]) != PEER_PROXY_PACKET_VERSION) - { - purple_debug_warning("oscar", "Expected peer proxy protocol " - "version %u but received version %u. Closing " - "connection.\n", PEER_PROXY_PACKET_VERSION, - aimutil_get16(&conn->proxy_header[2])); - peer_connection_trynext(conn); - return; - } - - /* Initialize a new temporary ProxyFrame for incoming data */ - frame = g_new0(ProxyFrame, 1); - frame->payload.len = aimutil_get16(&conn->proxy_header[0]) - 10; - frame->version = aimutil_get16(&conn->proxy_header[2]); - frame->type = aimutil_get16(&conn->proxy_header[4]); - frame->unknown = aimutil_get16(&conn->proxy_header[6]); - frame->flags = aimutil_get16(&conn->proxy_header[10]); - if (frame->payload.len > 0) - frame->payload.data = g_new(guint8, frame->payload.len); - conn->frame = frame; - } - - /* If this frame has a payload then attempt to read it */ - if (frame->payload.len - frame->payload.offset > 0) - { - /* Read data into the temporary buffer until it is complete */ - read = recv(conn->fd, - &frame->payload.data[frame->payload.offset], - frame->payload.len - frame->payload.offset, - 0); - - /* Check if the proxy server closed the connection */ - if (read == 0) - { - purple_debug_info("oscar", "Peer proxy server closed connection\n"); - g_free(frame->payload.data); - g_free(frame); - conn->frame = NULL; - peer_connection_trynext(conn); - return; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - purple_debug_info("oscar", "Lost connection with peer proxy server\n"); - g_free(frame->payload.data); - g_free(frame); - conn->frame = NULL; - peer_connection_trynext(conn); - return; - } - - frame->payload.offset += read; - } - - conn->lastactivity = time(NULL); - if (frame->payload.offset < frame->payload.len) - /* Waiting for more data to arrive */ - return; - - /* We have a complete proxy frame! Handle it and continue reading */ - conn->frame = NULL; - byte_stream_rewind(&frame->payload); - peer_proxy_recv_frame(conn, frame); - - g_free(frame->payload.data); - g_free(frame); - - conn->proxy_header_received = 0; -} - -/** - * We tried to make an outgoing connection to a proxy server. It - * either connected or failed to connect. - */ -void -peer_proxy_connection_established_cb(gpointer data, gint source, const gchar *error_message) -{ - PeerConnection *conn; - - conn = data; - - conn->verified_connect_data = NULL; - - if (source < 0) - { - peer_connection_trynext(conn); - return; - } - - conn->fd = source; - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_proxy_connection_recv_cb, conn); - - if (conn->proxyip != NULL) - /* Connect to the session created by the remote user */ - peer_proxy_send_join_existing_conn(conn, conn->port); - else - /* Create a new session */ - peer_proxy_send_create_new_conn(conn); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/rxhandlers.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/rxhandlers.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/rxhandlers.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/rxhandlers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,288 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" -#include "peer.h" - -aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group) -{ - aim_module_t *cur; - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - if (cur->family == group) - return cur; - } - - return NULL; -} - -aim_module_t *aim__findmodule(OscarData *od, const char *name) -{ - aim_module_t *cur; - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - if (strcmp(name, cur->name) == 0) - return cur; - } - - return NULL; -} - -int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *)) -{ - aim_module_t *mod; - - if (!od || !modfirst) - return -1; - - mod = g_new0(aim_module_t, 1); - - if (modfirst(od, mod) == -1) { - g_free(mod); - return -1; - } - - if (aim__findmodule(od, mod->name)) { - if (mod->shutdown) - mod->shutdown(od, mod); - g_free(mod); - return -1; - } - - mod->next = (aim_module_t *)od->modlistv; - od->modlistv = mod; - - purple_debug_misc("oscar", "registered module %s (family 0x%04x, version = 0x%04x, tool 0x%04x, tool version 0x%04x)\n", mod->name, mod->family, mod->version, mod->toolid, mod->toolversion); - - return 0; -} - -void aim__shutdownmodules(OscarData *od) -{ - aim_module_t *cur; - - for (cur = (aim_module_t *)od->modlistv; cur; ) { - aim_module_t *tmp; - - tmp = cur->next; - - if (cur->shutdown) - cur->shutdown(od, cur); - - g_free(cur); - - cur = tmp; - } - - od->modlistv = NULL; - - return; -} - -#if 0 -/* - * Bleck functions get called when there's no non-bleck functions - * around to cleanup the mess... - */ -static int bleck(OscarData *od, FlapFrame *frame, ...) -{ - guint16 family, subtype; - guint16 maxf, maxs; - - static const char *channels[6] = { - "Invalid (0)", - "FLAP Version", - "SNAC", - "Invalid (3)", - "Negotiation", - "FLAP NOP" - }; - static const int maxchannels = 5; - - /* XXX: this is ugly. and big just for debugging. */ - static const char *literals[14][25] = { - {"Invalid", - NULL - }, - {"General", - "Invalid", - "Error", - "Client Ready", - "Server Ready", - "Service Request", - "Redirect", - "Rate Information Request", - "Rate Information", - "Rate Information Ack", - NULL, - "Rate Information Change", - "Server Pause", - NULL, - "Server Resume", - "Request Personal User Information", - "Personal User Information", - "Evil Notification", - NULL, - "Migration notice", - "Message of the Day", - "Set Privacy Flags", - "Well Known URL", - "NOP" - }, - {"Location", - "Invalid", - "Error", - "Request Rights", - "Rights Information", - "Set user information", - "Request User Information", - "User Information", - "Watcher Sub Request", - "Watcher Notification" - }, - {"Buddy List Management", - "Invalid", - "Error", - "Request Rights", - "Rights Information", - "Add Buddy", - "Remove Buddy", - "Watcher List Query", - "Watcher List Response", - "Watcher SubRequest", - "Watcher Notification", - "Reject Notification", - "Oncoming Buddy", - "Offgoing Buddy" - }, - {"Messeging", - "Invalid", - "Error", - "Add ICBM Parameter", - "Remove ICBM Parameter", - "Request Parameter Information", - "Parameter Information", - "Outgoing Message", - "Incoming Message", - "Evil Request", - "Evil Reply", - "Missed Calls", - "Message Error", - "Host Ack" - }, - {"Advertisements", - "Invalid", - "Error", - "Request Ad", - "Ad Data (GIFs)" - }, - {"Invitation / Client-to-Client", - "Invalid", - "Error", - "Invite a Friend", - "Invitation Ack" - }, - {"Administrative", - "Invalid", - "Error", - "Information Request", - "Information Reply", - "Information Change Request", - "Information Chat Reply", - "Account Confirm Request", - "Account Confirm Reply", - "Account Delete Request", - "Account Delete Reply" - }, - {"Popups", - "Invalid", - "Error", - "Display Popup" - }, - {"BOS", - "Invalid", - "Error", - "Request Rights", - "Rights Response", - "Set group permission mask", - "Add permission list entries", - "Delete permission list entries", - "Add deny list entries", - "Delete deny list entries", - "Server Error" - }, - {"User Lookup", - "Invalid", - "Error", - "Search Request", - "Search Response" - }, - {"Stats", - "Invalid", - "Error", - "Set minimum report interval", - "Report Events" - }, - {"Translate", - "Invalid", - "Error", - "Translate Request", - "Translate Reply", - }, - {"Chat Navigation", - "Invalid", - "Error", - "Request rights", - "Request Exchange Information", - "Request Room Information", - "Request Occupant List", - "Search for Room", - "Outgoing Message", - "Incoming Message", - "Evil Request", - "Evil Reply", - "Chat Error", - } - }; - - maxf = sizeof(literals) / sizeof(literals[0]); - maxs = sizeof(literals[0]) / sizeof(literals[0][0]); - - if (frame->channel == 0x02) { - - family = byte_stream_get16(&frame->data); - subtype = byte_stream_get16(&frame->data); - - if ((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL)) - purple_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (%s)\n", channels[frame->channel], family, subtype, literals[family][subtype+1]); - else - purple_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (no literal)\n", channels[frame->channel], family, subtype); - } else { - - if (frame->channel <= maxchannels) - purple_debug_misc("oscar", "bleck: channel %s (0x%02x)\n", channels[frame->channel], frame->channel); - else - purple_debug_misc("oscar", "bleck: unknown channel 0x%02x\n", frame->channel); - - } - - return 1; -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snac.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snac.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snac.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snac.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * - * Various SNAC-related dodads... - * - * outstanding_snacs is a list of aim_snac_t structs. A SNAC should be added - * whenever a new SNAC is sent and it should remain in the list until the - * response for it has been received. - * - * cleansnacs() should be called periodically by the client in order - * to facilitate the aging out of unreplied-to SNACs. This can and does - * happen, so it should be handled. - * - */ - -#include "oscar.h" - -/* - * Called from oscar_session_new() to initialize the hash. - */ -void aim_initsnachash(OscarData *od) -{ - int i; - - for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) - od->snac_hash[i] = NULL; - - return; -} - -aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen) -{ - aim_snac_t snac; - - snac.id = od->snacid_next++; - snac.family = family; - snac.type = type; - snac.flags = flags; - - if (datalen) { - if (!(snac.data = g_malloc(datalen))) - return 0; /* er... */ - memcpy(snac.data, data, datalen); - } else - snac.data = NULL; - - return aim_newsnac(od, &snac); -} - -/* - * Clones the passed snac structure and caches it in the - * list/hash. - */ -aim_snacid_t aim_newsnac(OscarData *od, aim_snac_t *newsnac) -{ - aim_snac_t *snac; - int index; - - if (!newsnac) - return 0; - - if (!(snac = g_malloc(sizeof(aim_snac_t)))) - return 0; - memcpy(snac, newsnac, sizeof(aim_snac_t)); - snac->issuetime = time(NULL); - - index = snac->id % FAIM_SNAC_HASH_SIZE; - - snac->next = (aim_snac_t *)od->snac_hash[index]; - od->snac_hash[index] = (void *)snac; - - return snac->id; -} - -/* - * Finds a snac structure with the passed SNAC ID, - * removes it from the list/hash, and returns a pointer to it. - * - * The returned structure must be freed by the caller. - * - */ -aim_snac_t *aim_remsnac(OscarData *od, aim_snacid_t id) -{ - aim_snac_t *cur, **prev; - int index; - - index = id % FAIM_SNAC_HASH_SIZE; - - for (prev = (aim_snac_t **)&od->snac_hash[index]; (cur = *prev); ) { - if (cur->id == id) { - *prev = cur->next; - if (cur->flags & AIM_SNACFLAGS_DESTRUCTOR) { - g_free(cur->data); - cur->data = NULL; - } - return cur; - } else - prev = &cur->next; - } - - return cur; -} - -/* - * This is for cleaning up old SNACs that either don't get replies or - * a reply was never received for. Garbage collection. Plain and simple. - * - * maxage is the _minimum_ age in seconds to keep SNACs. - * - */ -void aim_cleansnacs(OscarData *od, int maxage) -{ - int i; - - for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) { - aim_snac_t *cur, **prev; - time_t curtime; - - if (!od->snac_hash[i]) - continue; - - curtime = time(NULL); /* done here in case we waited for the lock */ - - for (prev = (aim_snac_t **)&od->snac_hash[i]; (cur = *prev); ) { - if ((curtime - cur->issuetime) > maxage) { - - *prev = cur->next; - - g_free(cur->data); - g_free(cur); - } else - prev = &cur->next; - } - } - - return; -} - -int aim_putsnac(ByteStream *bs, guint16 family, guint16 subtype, guint16 flags, aim_snacid_t snacid) -{ - - byte_stream_put16(bs, family); - byte_stream_put16(bs, subtype); - byte_stream_put16(bs, flags); - byte_stream_put32(bs, snacid); - - return 10; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snactypes.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snactypes.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snactypes.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/snactypes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,287 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * AIM Callback Types - * - */ -#ifndef _SNACTYPES_H_ -#define _SNACTYPES_H_ - -/* - * SNAC Families. - */ -#define SNAC_FAMILY_OSERVICE 0x0001 -#define SNAC_FAMILY_LOCATE 0x0002 -#define SNAC_FAMILY_BUDDY 0x0003 -#define SNAC_FAMILY_ICBM 0x0004 -#define SNAC_FAMILY_ADVERT 0x0005 -#define SNAC_FAMILY_INVITE 0x0006 -#define SNAC_FAMILY_ADMIN 0x0007 -#define SNAC_FAMILY_POPUP 0x0008 -#define SNAC_FAMILY_BOS 0x0009 -#define SNAC_FAMILY_USERLOOKUP 0x000a -#define SNAC_FAMILY_STATS 0x000b -#define SNAC_FAMILY_TRANSLATE 0x000c -#define SNAC_FAMILY_CHATNAV 0x000d -#define SNAC_FAMILY_CHAT 0x000e -#define SNAC_FAMILY_ODIR 0x000f -#define SNAC_FAMILY_BART 0x0010 -#define SNAC_FAMILY_FEEDBAG 0x0013 -#define SNAC_FAMILY_ICQ 0x0015 -#define SNAC_FAMILY_AUTH 0x0017 -#define SNAC_FAMILY_ALERT 0x0018 - -#define AIM_CB_FAM_SPECIAL 0xffff /* Internal libfaim use */ - -/* - * SNAC Family: Ack. - * - * Not really a family, but treating it as one really - * helps it fit into the libfaim callback structure better. - * - */ -#define AIM_CB_ACK_ACK 0x0001 - -/* - * SNAC Family: General. - */ -#define SNAC_SUBTYPE_OSERVICE_ERROR 0x0001 -#define SNAC_SUBTYPE_OSERVICE_CLIENTREADY 0x0002 -#define SNAC_SUBTYPE_OSERVICE_SERVERREADY 0x0003 -#define SNAC_SUBTYPE_OSERVICE_SERVICEREQ 0x0004 -#define SNAC_SUBTYPE_OSERVICE_REDIRECT 0x0005 -#define SNAC_SUBTYPE_OSERVICE_RATEINFOREQ 0x0006 -#define SNAC_SUBTYPE_OSERVICE_RATEINFO 0x0007 -#define SNAC_SUBTYPE_OSERVICE_RATEINFOACK 0x0008 -#define SNAC_SUBTYPE_OSERVICE_RATECHANGE 0x000a -#define SNAC_SUBTYPE_OSERVICE_SERVERPAUSE 0x000b -#define SNAC_SUBTYPE_OSERVICE_SERVERRESUME 0x000d -#define SNAC_SUBTYPE_OSERVICE_REQSELFINFO 0x000e -#define SNAC_SUBTYPE_OSERVICE_SELFINFO 0x000f -#define SNAC_SUBTYPE_OSERVICE_EVIL 0x0010 -#define SNAC_SUBTYPE_OSERVICE_SETIDLE 0x0011 -#define SNAC_SUBTYPE_OSERVICE_MIGRATIONREQ 0x0012 -#define SNAC_SUBTYPE_OSERVICE_MOTD 0x0013 -#define SNAC_SUBTYPE_OSERVICE_SETPRIVFLAGS 0x0014 -#define SNAC_SUBTYPE_OSERVICE_WELLKNOWNURL 0x0015 -#define SNAC_SUBTYPE_OSERVICE_NOP 0x0016 -#define SNAC_SUBTYPE_OSERVICE_DEFAULT 0xffff - -/* - * SNAC Family: Location Services. - */ -#define SNAC_SUBTYPE_LOCATE_ERROR 0x0001 -#define SNAC_SUBTYPE_LOCATE_REQRIGHTS 0x0002 -#define SNAC_SUBTYPE_LOCATE_RIGHTSINFO 0x0003 -#define SNAC_SUBTYPE_LOCATE_SETUSERINFO 0x0004 -#define SNAC_SUBTYPE_LOCATE_REQUSERINFO 0x0005 -#define SNAC_SUBTYPE_LOCATE_USERINFO 0x0006 -#define SNAC_SUBTYPE_LOCATE_WATCHERSUBREQ 0x0007 -#define SNAC_SUBTYPE_LOCATE_WATCHERNOT 0x0008 -#define SNAC_SUBTYPE_LOCATE_DEFAULT 0xffff - -/* - * SNAC Family: Buddy List Management Services. - */ -#define SNAC_SUBTYPE_BUDDY_ERROR 0x0001 -#define SNAC_SUBTYPE_BUDDY_REQRIGHTS 0x0002 -#define SNAC_SUBTYPE_BUDDY_RIGHTSINFO 0x0003 -#define SNAC_SUBTYPE_BUDDY_ADDBUDDY 0x0004 -#define SNAC_SUBTYPE_BUDDY_REMBUDDY 0x0005 -#define SNAC_SUBTYPE_BUDDY_REJECT 0x000a -#define SNAC_SUBTYPE_BUDDY_ONCOMING 0x000b -#define SNAC_SUBTYPE_BUDDY_OFFGOING 0x000c -#define SNAC_SUBTYPE_BUDDY_DEFAULT 0xffff - -/* - * SNAC Family: Messaging Services. - */ -#define SNAC_SUBTYPE_ICBM_ERROR 0x0001 -#define SNAC_SUBTYPE_ICBM_PARAMINFO 0x0005 -#define SNAC_SUBTYPE_ICBM_INCOMING 0x0007 -#define SNAC_SUBTYPE_ICBM_EVIL 0x0009 -#define SNAC_SUBTYPE_ICBM_MISSEDCALL 0x000a -#define SNAC_SUBTYPE_ICBM_CLIENTAUTORESP 0x000b -#define SNAC_SUBTYPE_ICBM_ACK 0x000c -#define SNAC_SUBTYPE_ICBM_MTN 0x0014 -#define SNAC_SUBTYPE_ICBM_DEFAULT 0xffff - -/* - * SNAC Family: Advertisement Services - */ -#define SNAC_SUBTYPE_ADVERT_ERROR 0x0001 -#define SNAC_SUBTYPE_ADVERT_DEFAULT 0xffff - -/* - * SNAC Family: Invitation Services. - */ -#define SNAC_SUBTYPE_INVITE_ERROR 0x0001 -#define SNAC_SUBTYPE_INVITE_DEFAULT 0xffff - -/* - * SNAC Family: Administrative Services. - */ -#define SNAC_SUBTYPE_ADMIN_ERROR 0x0001 -#define SNAC_SUBTYPE_ADMIN_INFOCHANGE_REPLY 0x0005 -#define SNAC_SUBTYPE_ADMIN_DEFAULT 0xffff - -/* - * SNAC Family: Popup Messages - */ -#define SNAC_SUBTYPE_POPUP_ERROR 0x0001 -#define SNAC_SUBTYPE_POPUP_DEFAULT 0xffff - -/* - * SNAC Family: Misc BOS Services. - */ -#define SNAC_SUBTYPE_BOS_ERROR 0x0001 -#define SNAC_SUBTYPE_BOS_RIGHTSQUERY 0x0002 -#define SNAC_SUBTYPE_BOS_RIGHTS 0x0003 -#define SNAC_SUBTYPE_BOS_DEFAULT 0xffff - -/* - * SNAC Family: User Lookup Services - */ -#define SNAC_SUBTYPE_USERLOOKUP_ERROR 0x0001 -#define SNAC_SUBTYPE_USERLOOKUP_DEFAULT 0xffff - -/* - * SNAC Family: User Status Services - */ -#define SNAC_SUBTYPE_STATS_ERROR 0x0001 -#define SNAC_SUBTYPE_STATS_SETREPORTINTERVAL 0x0002 -#define SNAC_SUBTYPE_STATS_REPORTACK 0x0004 -#define SNAC_SUBTYPE_STATS_DEFAULT 0xffff - -/* - * SNAC Family: Translation Services - */ -#define SNAC_SUBTYPE_TRANSLATE_ERROR 0x0001 -#define SNAC_SUBTYPE_TRANSLATE_DEFAULT 0xffff - -/* - * SNAC Family: Chat Navigation Services - */ -#define SNAC_SUBTYPE_CHATNAV_ERROR 0x0001 -#define SNAC_SUBTYPE_CHATNAV_CREATE 0x0008 -#define SNAC_SUBTYPE_CHATNAV_INFO 0x0009 -#define SNAC_SUBTYPE_CHATNAV_DEFAULT 0xffff - -/* - * SNAC Family: Chat Services - */ -#define SNAC_SUBTYPE_CHAT_ERROR 0x0001 -#define SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE 0x0002 -#define SNAC_SUBTYPE_CHAT_USERJOIN 0x0003 -#define SNAC_SUBTYPE_CHAT_USERLEAVE 0x0004 -#define SNAC_SUBTYPE_CHAT_OUTGOINGMSG 0x0005 -#define SNAC_SUBTYPE_CHAT_INCOMINGMSG 0x0006 -#define SNAC_SUBTYPE_CHAT_DEFAULT 0xffff - -/* - * SNAC Family: "New" Search - */ -#define SNAC_SUBTYPE_ODIR_ERROR 0x0001 -#define SNAC_SUBTYPE_ODIR_SEARCH 0x0002 -#define SNAC_SUBTYPE_ODIR_RESULTS 0x0003 - -/* - * SNAC Family: Buddy icons - */ -#define SNAC_SUBTYPE_BART_ERROR 0x0001 -#define SNAC_SUBTYPE_BART_REQUEST 0x0004 -#define SNAC_SUBTYPE_BART_RESPONSE 0x0005 - -/* - * SNAC Family: Server-Stored Buddy Lists - */ -#define SNAC_SUBTYPE_FEEDBAG_ERROR 0x0001 -#define SNAC_SUBTYPE_FEEDBAG_REQRIGHTS 0x0002 -#define SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO 0x0003 -#define SNAC_SUBTYPE_FEEDBAG_REQDATA 0x0004 -#define SNAC_SUBTYPE_FEEDBAG_REQIFCHANGED 0x0005 -#define SNAC_SUBTYPE_FEEDBAG_LIST 0x0006 -#define SNAC_SUBTYPE_FEEDBAG_ACTIVATE 0x0007 -#define SNAC_SUBTYPE_FEEDBAG_ADD 0x0008 -#define SNAC_SUBTYPE_FEEDBAG_MOD 0x0009 -#define SNAC_SUBTYPE_FEEDBAG_DEL 0x000A -#define SNAC_SUBTYPE_FEEDBAG_SRVACK 0x000E -#define SNAC_SUBTYPE_FEEDBAG_NOLIST 0x000F -#define SNAC_SUBTYPE_FEEDBAG_EDITSTART 0x0011 -#define SNAC_SUBTYPE_FEEDBAG_EDITSTOP 0x0012 -#define SNAC_SUBTYPE_FEEDBAG_SENDAUTH 0x0014 -#define SNAC_SUBTYPE_FEEDBAG_RECVAUTH 0x0015 -#define SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ 0x0018 -#define SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ 0x0019 -#define SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP 0x001a -#define SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP 0x001b -#define SNAC_SUBTYPE_FEEDBAG_ADDED 0x001c - -/* - * SNAC Family: ICQ - * - * Most of these are actually special. - */ -#define SNAC_SUBTYPE_ICQ_ERROR 0x0001 -#define SNAC_SUBTYPE_ICQ_OFFLINEMSG 0x00f0 -#define SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE 0x00f1 -#define SNAC_SUBTYPE_ICQ_INFO 0x00f2 -#define SNAC_SUBTYPE_ICQ_ALIAS 0x00f3 -#define SNAC_SUBTYPE_ICQ_DEFAULT 0xffff - -/* - * SNAC Family: Authorizer - * - * Used only in protocol versions three and above. - */ -#define SNAC_SUBTYPE_AUTH_ERROR 0x0001 -#define SNAC_SUBTYPE_AUTH_LOGINREQEST 0x0002 -#define SNAC_SUBTYPE_AUTH_LOGINRESPONSE 0x0003 -#define SNAC_SUBTYPE_AUTH_AUTHREQ 0x0006 -#define SNAC_SUBTYPE_AUTH_AUTHRESPONSE 0x0007 -#define SNAC_SUBTYPE_AUTH_SECURID_REQUEST 0x000a -#define SNAC_SUBTYPE_AUTH_SECURID_RESPONSE 0x000b - -/* - * SNAC Family: Email - * - * Used for getting information on the email address - * associated with your username. - */ -#define SNAC_SUBTYPE_ALERT_ERROR 0x0001 -#define SNAC_SUBTYPE_ALERT_SENDCOOKIES 0x0006 -#define SNAC_SUBTYPE_ALERT_MAILSTATUS 0x0007 -#define SNAC_SUBTYPE_ALERT_INIT 0x0016 - -/* - * SNAC Family: Internal Messages - * - * This isn't truly a SNAC family either, but using - * these, we can integrated non-SNAC services into - * the SNAC-centered libfaim callback structure. - */ -#define AIM_CB_SPECIAL_CONNERR 0x0003 -#define AIM_CB_SPECIAL_CONNINITDONE 0x0006 - -/* SNAC flags */ -#define AIM_SNACFLAGS_DESTRUCTOR 0x0001 - -#endif /* _SNACTYPES_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/tlv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/tlv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/tlv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/tlv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,825 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" - -static aim_tlv_t * -createtlv(guint16 type, guint16 length, guint8 *value) -{ - aim_tlv_t *ret; - - ret = g_new(aim_tlv_t, 1); - ret->type = type; - ret->length = length; - ret->value = value; - - return ret; -} - -static void -freetlv(aim_tlv_t *oldtlv) -{ - g_free(oldtlv->value); - g_free(oldtlv); -} - -static GSList * -aim_tlv_read(GSList *list, ByteStream *bs) -{ - guint16 type, length; - aim_tlv_t *tlv; - - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - -#if 0 - /* - * This code hasn't been needed in years. It's been commented - * out since 2003, at the latest. It seems likely that it was - * just a bug in their server code that has since been fixed. - * In any case, here's the orignal comment, kept for historical - * purposes: - * - * Okay, so now AOL has decided that any TLV of - * type 0x0013 can only be two bytes, despite - * what the actual given length is. So here - * we dump any invalid TLVs of that sort. Hopefully - * there's no special cases to this special case. - * - mid (30jun2000) - */ - if ((type == 0x0013) && (length != 0x0002)) { - length = 0x0002; - return list; - } -#endif - if (length > byte_stream_empty(bs)) { - aim_tlvlist_free(list); - return NULL; - } - - tlv = createtlv(type, length, NULL); - if (tlv->length > 0) { - tlv->value = byte_stream_getraw(bs, length); - if (!tlv->value) { - freetlv(tlv); - aim_tlvlist_free(list); - return NULL; - } - } - - return g_slist_prepend(list, tlv); -} - -/** - * Read a TLV chain from a buffer. - * - * Reads and parses a series of TLV patterns from a data buffer; the - * returned structure is manipulatable with the rest of the TLV - * routines. When done with a TLV chain, aim_tlvlist_free() should - * be called to free the dynamic substructures. - * - * TODO: There should be a flag setable here to have the tlvlist contain - * bstream references, so that at least the ->value portion of each - * element doesn't need to be malloc/memcpy'd. This could prove to be - * just as efficient as the in-place TLV parsing used in a couple places - * in libfaim. - * - * @param bs Input bstream - * @return Return the TLV chain read - */ -GSList *aim_tlvlist_read(ByteStream *bs) -{ - GSList *list = NULL; - - while (byte_stream_empty(bs) > 0) { - list = aim_tlv_read(list, bs); - if (list == NULL) - return NULL; - } - - return g_slist_reverse(list); -} - -/** - * Read a TLV chain from a buffer. - * - * Reads and parses a series of TLV patterns from a data buffer; the - * returned structure is manipulatable with the rest of the TLV - * routines. When done with a TLV chain, aim_tlvlist_free() should - * be called to free the dynamic substructures. - * - * TODO: There should be a flag setable here to have the tlvlist contain - * bstream references, so that at least the ->value portion of each - * element doesn't need to be malloc/memcpy'd. This could prove to be - * just as efficient as the in-place TLV parsing used in a couple places - * in libfaim. - * - * @param bs Input bstream - * @param num The max number of TLVs that will be read, or -1 if unlimited. - * There are a number of places where you want to read in a tlvchain, - * but the chain is not at the end of the SNAC, and the chain is - * preceded by the number of TLVs. So you can limit that with this. - * @return Return the TLV chain read - */ -GSList *aim_tlvlist_readnum(ByteStream *bs, guint16 num) -{ - GSList *list = NULL; - - while ((byte_stream_empty(bs) > 0) && (num != 0)) { - list = aim_tlv_read(list, bs); - if (list == NULL) - return NULL; - num--; - } - - return g_slist_reverse(list); -} - -/** - * Read a TLV chain from a buffer. - * - * Reads and parses a series of TLV patterns from a data buffer; the - * returned structure is manipulatable with the rest of the TLV - * routines. When done with a TLV chain, aim_tlvlist_free() should - * be called to free the dynamic substructures. - * - * TODO: There should be a flag setable here to have the tlvlist contain - * bstream references, so that at least the ->value portion of each - * element doesn't need to be malloc/memcpy'd. This could prove to be - * just as efficient as the in-place TLV parsing used in a couple places - * in libfaim. - * - * @param bs Input bstream - * @param len The max length in bytes that will be read. - * There are a number of places where you want to read in a tlvchain, - * but the chain is not at the end of the SNAC, and the chain is - * preceded by the length of the TLVs. So you can limit that with this. - * @return Return the TLV chain read - */ -GSList *aim_tlvlist_readlen(ByteStream *bs, guint16 len) -{ - GSList *list = NULL; - - while ((byte_stream_empty(bs) > 0) && (len > 0)) { - list = aim_tlv_read(list, bs); - if (list == NULL) - return NULL; - - len -= 2 + 2 + ((aim_tlv_t *)list->data)->length; - } - - return g_slist_reverse(list); -} - -/** - * Duplicate a TLV chain. - * This is pretty self explanatory. - * - * @param orig The TLV chain you want to make a copy of. - * @return A newly allocated TLV chain. - */ -GSList *aim_tlvlist_copy(GSList *orig) -{ - GSList *new = NULL; - aim_tlv_t *tlv; - - while (orig != NULL) { - tlv = orig->data; - aim_tlvlist_add_raw(&new, tlv->type, tlv->length, tlv->value); - orig = orig->next; - } - - return new; -} - -/* - * Compare two TLV lists for equality. This probably is not the most - * efficient way to do this. - * - * @param one One of the TLV chains to compare. - * @param two The other TLV chain to compare. - * @return Return 0 if the lists are the same, return 1 if they are different. - */ -int aim_tlvlist_cmp(GSList *one, GSList *two) -{ - ByteStream bs1, bs2; - - if (aim_tlvlist_size(one) != aim_tlvlist_size(two)) - return 1; - - byte_stream_new(&bs1, aim_tlvlist_size(one)); - byte_stream_new(&bs2, aim_tlvlist_size(two)); - - aim_tlvlist_write(&bs1, &one); - aim_tlvlist_write(&bs2, &two); - - if (memcmp(bs1.data, bs2.data, bs1.len)) { - byte_stream_destroy(&bs1); - byte_stream_destroy(&bs2); - return 1; - } - - byte_stream_destroy(&bs1); - byte_stream_destroy(&bs2); - - return 0; -} - -/** - * Free a TLV chain structure - * - * Walks the list of TLVs in the passed TLV chain and - * frees each one. Note that any references to this data - * should be removed before calling this. - * - * @param list Chain to be freed - */ -void aim_tlvlist_free(GSList *list) -{ - while (list != NULL) - { - freetlv(list->data); - list = g_slist_delete_link(list, list); - } -} - -/** - * Count the number of TLVs in a chain. - * - * @param list Chain to be counted. - * @return The number of TLVs stored in the passed chain. - */ -int aim_tlvlist_count(GSList *list) -{ - GSList *cur; - int count; - - if (list == NULL) - return 0; - - for (cur = list, count = 0; cur; cur = cur->next) - count++; - - return count; -} - -/** - * Count the number of bytes in a TLV chain. - * - * @param list Chain to be sized - * @return The number of bytes that would be needed to - * write the passed TLV chain to a data buffer. - */ -int aim_tlvlist_size(GSList *list) -{ - GSList *cur; - int size; - - if (list == NULL) - return 0; - - for (cur = list, size = 0; cur; cur = cur->next) - size += (4 + ((aim_tlv_t *)cur->data)->length); - - return size; -} - -/** - * Adds the passed string as a TLV element of the passed type - * to the TLV chain. - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param length Length of string to add (not including %NULL). - * @param value String to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value) -{ - aim_tlv_t *tlv; - - if (list == NULL) - return 0; - - tlv = createtlv(type, length, NULL); - if (tlv->length > 0) - tlv->value = g_memdup(value, length); - - *list = g_slist_append(*list, tlv); - - return tlv->length; -} - -/** - * Add a one byte integer to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value) -{ - guint8 v8[1]; - - aimutil_put8(v8, value); - - return aim_tlvlist_add_raw(list, type, 1, v8); -} - -/** - * Add a two byte integer to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value) -{ - guint8 v16[2]; - - aimutil_put16(v16, value); - - return aim_tlvlist_add_raw(list, type, 2, v16); -} - -/** - * Add a four byte integer to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value) -{ - guint8 v32[4]; - - aimutil_put32(v32, value); - - return aim_tlvlist_add_raw(list, type, 4, v32); -} - -/** - * Add a string to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value) -{ - return aim_tlvlist_add_raw(list, type, strlen(value), (guint8 *)value); -} - -/** - * Adds a block of capability blocks to a TLV chain. The bitfield - * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: - * - * %OSCAR_CAPABILITY_BUDDYICON Supports Buddy Icons - * %OSCAR_CAPABILITY_TALK Supports Voice Chat - * %OSCAR_CAPABILITY_IMIMAGE Supports DirectIM/IMImage - * %OSCAR_CAPABILITY_CHAT Supports Chat - * %OSCAR_CAPABILITY_GETFILE Supports Get File functions - * %OSCAR_CAPABILITY_SENDFILE Supports Send File functions - * - * @param list Destination chain - * @param type TLV type to add - * @param caps Bitfield of capability flags to send - * @return The size of the value added. - */ -int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps) -{ - guint8 buf[256]; /* TODO: Don't use a fixed length buffer */ - ByteStream bs; - - if (caps == 0) - return 0; /* nothing there anyway */ - - byte_stream_init(&bs, buf, sizeof(buf)); - - byte_stream_putcaps(&bs, caps); - - return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), buf); -} - -/** - * Adds the given chatroom info to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param roomname The name of the chat. - * @param instance The instance. - * @return The size of the value added. - */ -int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance) -{ - int len; - ByteStream bs; - - byte_stream_new(&bs, 2 + 1 + strlen(roomname) + 2); - - byte_stream_put16(&bs, exchange); - byte_stream_put8(&bs, strlen(roomname)); - byte_stream_putstr(&bs, roomname); - byte_stream_put16(&bs, instance); - - len = aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data); - - byte_stream_destroy(&bs); - - return len; -} - -/** - * Adds a TLV with a zero length to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_noval(GSList **list, const guint16 type) -{ - return aim_tlvlist_add_raw(list, type, 0, NULL); -} - -/* - * Note that the inner TLV chain will not be modifiable as a tlvchain once - * it is written using this. Or rather, it can be, but updates won't be - * made to this. - * - * TODO: Should probably support sublists for real. - * - * This is so neat. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param t1 The TLV chain you want to write. - * @return The number of bytes written to the destination TLV chain. - * 0 is returned if there was an error or if the destination - * TLV chain has length 0. - */ -int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tlvlist) -{ - int buflen; - ByteStream bs; - - buflen = aim_tlvlist_size(*tlvlist); - - if (buflen <= 0) - return 0; - - byte_stream_new(&bs, buflen); - - aim_tlvlist_write(&bs, tlvlist); - - aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data); - - byte_stream_destroy(&bs); - - return buflen; -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param length Length of string to add (not including %NULL). - * @param value String to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value) -{ - GSList *cur; - aim_tlv_t *tlv; - - if (list == NULL) - return 0; - - for (cur = *list; cur != NULL; cur = cur->next) - { - tlv = cur->data; - if (tlv->type == type) - break; - } - - if (cur == NULL) - /* TLV does not exist, so add a new one */ - return aim_tlvlist_add_raw(list, type, length, value); - - g_free(tlv->value); - tlv->length = length; - if (tlv->length > 0) { - tlv->value = g_memdup(value, length); - } else - tlv->value = NULL; - - return tlv->length; -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_str(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param str String to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_str(GSList **list, const guint16 type, const char *str) -{ - return aim_tlvlist_replace_raw(list, type, strlen(str), (const guchar *)str); -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_noval(GSList **list, const guint16 type) -{ - return aim_tlvlist_replace_raw(list, type, 0, NULL); -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param value 8 bit value to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value) -{ - guint8 v8[1]; - - aimutil_put8(v8, value); - - return aim_tlvlist_replace_raw(list, type, 1, v8); -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param value 32 bit value to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value) -{ - guint8 v32[4]; - - aimutil_put32(v32, value); - - return aim_tlvlist_replace_raw(list, type, 4, v32); -} - -/** - * Remove all TLVs of a given type. If you attempt to remove a TLV - * that does not exist, nothing happens. - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - */ -void aim_tlvlist_remove(GSList **list, const guint16 type) -{ - GSList *cur, *next; - aim_tlv_t *tlv; - - if (list == NULL || *list == NULL) - return; - - cur = *list; - while (cur != NULL) - { - tlv = cur->data; - next = cur->next; - - if (tlv->type == type) - { - /* Delete this TLV */ - *list = g_slist_delete_link(*list, cur); - g_free(tlv->value); - g_free(tlv); - } - - cur = next; - } -} - -/** - * Write a TLV chain into a data buffer. - * - * Copies a TLV chain into a raw data buffer, writing only the number - * of bytes specified. This operation does not free the chain; - * aim_tlvlist_free() must still be called to free up the memory used - * by the chain structures. - * - * TODO: Clean this up, make better use of bstreams - * - * @param bs Input bstream - * @param list Source TLV chain - * @return Return 0 if the destination bstream is too small. - */ -int aim_tlvlist_write(ByteStream *bs, GSList **list) -{ - int goodbuflen; - GSList *cur; - aim_tlv_t *tlv; - - /* do an initial run to test total length */ - goodbuflen = aim_tlvlist_size(*list); - - if (goodbuflen > byte_stream_empty(bs)) - return 0; /* not enough buffer */ - - /* do the real write-out */ - for (cur = *list; cur; cur = cur->next) { - tlv = cur->data; - byte_stream_put16(bs, tlv->type); - byte_stream_put16(bs, tlv->length); - if (tlv->length > 0) - byte_stream_putraw(bs, tlv->value, tlv->length); - } - - return 1; /* TODO: This is a nonsensical return */ -} - - -/** - * Grab the Nth TLV of type type in the TLV list list. - * - * Returns a pointer to an aim_tlv_t of the specified type; - * %NULL on error. The @nth parameter is specified starting at %1. - * In most cases, there will be no more than one TLV of any type - * in a chain. - * - * @param list Source chain. - * @param type Requested TLV type. - * @param nth Index of TLV of type to get. - * @return The TLV you were looking for, or NULL if one could not be found. - */ -aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth) -{ - GSList *cur; - aim_tlv_t *tlv; - int i; - - for (cur = list, i = 0; cur != NULL; cur = cur->next) { - tlv = cur->data; - if (tlv->type == type) - i++; - if (i >= nth) - return tlv; - } - - return NULL; -} - -/** - * Get the length of the data of the nth TLV in the given TLV chain. - * - * @param list Source chain. - * @param type Requested TLV type. - * @param nth Index of TLV of type to get. - * @return The length of the data in this TLV, or -1 if the TLV could not be - * found. Unless -1 is returned, this value will be 2 bytes. - */ -int aim_tlv_getlength(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return -1; - - return tlv->length; -} - -char * -aim_tlv_getvalue_as_string(aim_tlv_t *tlv) -{ - char *ret; - - ret = g_malloc(tlv->length + 1); - memcpy(ret, tlv->value, tlv->length); - ret[tlv->length] = '\0'; - - return ret; -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as a string. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value of the TLV you were looking for, or NULL if one could - * not be found. This is a dynamic buffer and must be freed by the - * caller. - */ -char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return NULL; - - return aim_tlv_getvalue_as_string(tlv); -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as an 8bit - * integer. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value the TLV you were looking for, or 0 if one could - * not be found. - */ -guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return 0; /* erm */ - - return aimutil_get8(tlv->value); -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as a 16bit - * integer. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value the TLV you were looking for, or 0 if one could - * not be found. - */ -guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return 0; /* erm */ - - return aimutil_get16(tlv->value); -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as a 32bit - * integer. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value the TLV you were looking for, or 0 if one could - * not be found. - */ -guint32 aim_tlv_get32(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return 0; /* erm */ - - return aimutil_get32(tlv->value); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/oscar/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,291 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * A little bit of this - * A little bit of that - * It started with a kiss - * Now we're up to bat - */ - -#include "oscar.h" - -#include "core.h" - -#include - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -int oscar_get_ui_info_int(const char *str, int default_value) -{ - GHashTable *ui_info; - - ui_info = purple_core_get_ui_info(); - if (ui_info != NULL) { - gpointer value; - if (g_hash_table_lookup_extended(ui_info, str, NULL, &value)) - return GPOINTER_TO_INT(value); - } - - return default_value; -} - -const char *oscar_get_ui_info_string(const char *str, const char *default_value) -{ - GHashTable *ui_info; - const char *value = NULL; - - ui_info = purple_core_get_ui_info(); - if (ui_info != NULL) - value = g_hash_table_lookup(ui_info, str); - if (value == NULL) - value = default_value; - - return value; -} - -gchar *oscar_get_clientstring(void) -{ - const char *name, *version; - - name = oscar_get_ui_info_string("name", "Purple"); - version = oscar_get_ui_info_string("version", VERSION); - - return g_strdup_printf("%s/%s", name, version);; -} - -/* - * Tokenizing functions. Used to portably replace strtok/sep. - * -- DMP. - * - */ -/* TODO: Get rid of this and use glib functions */ -int -aimutil_tokslen(char *toSearch, int theindex, char dl) -{ - int curCount = 1; - char *next; - char *last; - int toReturn; - - last = toSearch; - next = strchr(toSearch, dl); - - while(curCount < theindex && next != NULL) { - curCount++; - last = next + 1; - next = strchr(last, dl); - } - - if ((curCount < theindex) || (next == NULL)) - toReturn = strlen(toSearch) - (curCount - 1); - else - toReturn = next - toSearch - (curCount - 1); - - return toReturn; -} - -int -aimutil_itemcnt(char *toSearch, char dl) -{ - int curCount; - char *next; - - curCount = 1; - - next = strchr(toSearch, dl); - - while(next != NULL) { - curCount++; - next = strchr(next + 1, dl); - } - - return curCount; -} - -char * -aimutil_itemindex(char *toSearch, int theindex, char dl) -{ - int curCount; - char *next; - char *last; - char *toReturn; - - curCount = 0; - - last = toSearch; - next = strchr(toSearch, dl); - - while (curCount < theindex && next != NULL) { - curCount++; - last = next + 1; - next = strchr(last, dl); - } - next = strchr(last, dl); - - if (curCount < theindex) { - toReturn = g_malloc(sizeof(char)); - *toReturn = '\0'; - } else { - if (next == NULL) { - toReturn = g_malloc((strlen(last) + 1) * sizeof(char)); - strcpy(toReturn, last); - } else { - toReturn = g_malloc((next - last + 1) * sizeof(char)); - memcpy(toReturn, last, (next - last)); - toReturn[next - last] = '\0'; - } - } - return toReturn; -} - -/** - * Calculate the checksum of a given icon. - */ -guint16 -aimutil_iconsum(const guint8 *buf, int buflen) -{ - guint32 sum; - int i; - - for (i=0, sum=0; i+1> 16) + (sum & 0x0000ffff); - - return sum; -} - -/** - * Check if the given name is a valid AIM username. - * Example: BobDole - * Example: Henry_Ford@mac.com - * Example: 1KrazyKat@example.com - * - * @return TRUE if the name is valid, FALSE if not. - */ -static gboolean -oscar_util_valid_name_aim(const char *name) -{ - int i; - - if (purple_email_is_valid(name)) - return TRUE; - - /* Normal AIM usernames can't start with a number */ - if (isdigit(name[0])) - return FALSE; - - for (i = 0; name[i] != '\0'; i++) { - if (!isalnum(name[i]) && (name[i] != ' ')) - return FALSE; - } - - return TRUE; -} - -/** - * Check if the given name is a valid ICQ username. - * Example: 1234567 - * - * @return TRUE if the name is valid, FALSE if not. - */ -gboolean -oscar_util_valid_name_icq(const char *name) -{ - int i; - - for (i = 0; name[i] != '\0'; i++) { - if (!isdigit(name[i])) - return FALSE; - } - - return TRUE; -} - -/** - * Check if the given name is a valid SMS username. - * Example: +19195551234 - * - * @return TRUE if the name is valid, FALSE if not. - */ -gboolean -oscar_util_valid_name_sms(const char *name) -{ - int i; - - if (name[0] != '+') - return FALSE; - - for (i = 1; name[i] != '\0'; i++) { - if (!isdigit(name[i])) - return FALSE; - } - - return TRUE; -} - -/** - * Check if the given name is a valid oscar username. - * - * @return TRUE if the name is valid, FALSE if not. - */ -gboolean -oscar_util_valid_name(const char *name) -{ - if ((name == NULL) || (*name == '\0')) - return FALSE; - - return oscar_util_valid_name_icq(name) - || oscar_util_valid_name_sms(name) - || oscar_util_valid_name_aim(name); -} - -/** - * This takes two names and compares them using the rules - * on usernames for AIM/AOL. Mainly, this means case and space - * insensitivity (all case differences and spacing differences are - * ignored, with the exception that usernames can not start with - * a space). - * - * @return 0 if equal, non-0 if different - */ -/* TODO: Do something different for email addresses. */ -int -oscar_util_name_compare(const char *name1, const char *name2) -{ - - if ((name1 == NULL) || (name2 == NULL)) - return -1; - - do { - while (*name2 == ' ') - name2++; - while (*name1 == ' ') - name1++; - if (toupper(*name1) != toupper(*name2)) - return 1; - } while ((*name1 != '\0') && name1++ && name2++); - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/AUTHORS qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/AUTHORS --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/AUTHORS 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/AUTHORS 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -Code Contributors -========= -puzzlebird : original author -gfhuang(poppyer): patches for libpurple 2.0.0beta2, maintainer -Yuan Qingyun : patches for libpurple 1.5.0, maintainer -henryouly : file transfer, udp sock5 proxy and qq_show, maintainer -hzhr : maintainer -joymarquis : maintainer -arfankai : fixed bugs in char_conv.c -rakescar : provided filter for HTML tag -yyw : improved performance on PPC linux -lvxiang : provided ip to location original code -markhuetsch : OpenQ merge into libpurple, maintainer 2006-2007 -ccpaging : maintainer since 2007 -icesky : maintainer since 2007 -csyfek : faces, maintainer since 2007 - -Lovely Patch Writers -========= -gnap : message displaying, documentation -manphiz : qun processing -moo : qun processing -Coly Li : qun processing -Emil Alexiev : captcha verification on login based on LumaQQ for MAC (2007), - login, add buddy, remove buddy, message exchange and logout -Chengming Wang : buddy memo -lonicerae : chat room window bugfix, server list bugfix, buddy memo - -Acknowledgement -========= -Shufeng Tan : http://sf.net/projects/perl-oicq -Jeff Ye : http://www.sinomac.com -Hu Zheng : http://forlinux.yeah.net -yunfan : http://www.myswear.net -OpenQ Team : http://openq.linuxsir.org -LumaQQ Team : http://lumaqq.linuxsir.org -Pidgin Team : http://www.pidgin.im -Huang Guan : http://home.xxsyzx.com -OpenQ Google Group : http://groups.google.com/group/openq - -Scrupulous Testers -========= -yegle -cnzhangbx -casparant -wd -x6719620 -netelk -and more, please let me know... thank you! diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,898 +0,0 @@ -/** - * @file buddy_info.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "request.h" - -#include "utils.h" -#include "packet_parse.h" -#include "buddy_list.h" -#include "buddy_info.h" -#include "char_conv.h" -#include "im.h" -#include "qq_define.h" -#include "qq_base.h" -#include "qq_network.h" - -#define QQ_HOROSCOPE_SIZE 13 -static const gchar *horoscope_names[] = { - "-", N_("Aquarius"), N_("Pisces"), N_("Aries"), N_("Taurus"), - N_("Gemini"), N_("Cancer"), N_("Leo"), N_("Virgo"), N_("Libra"), - N_("Scorpio"), N_("Sagittarius"), N_("Capricorn") -}; - -#define QQ_ZODIAC_SIZE 13 -static const gchar *zodiac_names[] = { - "-", N_("Rat"), N_("Ox"), N_("Tiger"), N_("Rabbit"), - N_("Dragon"), N_("Snake"), N_("Horse"), N_("Goat"), N_("Monkey"), - N_("Rooster"), N_("Dog"), N_("Pig") -}; - -#define QQ_BLOOD_SIZE 6 -static const gchar *blood_types[] = { - "-", "A", "B", "O", "AB", N_("Other") -}; - -#define QQ_PUBLISH_SIZE 3 -static const gchar *publish_types[] = { - N_("Visible"), N_("Friend Only"), N_("Private") -}; - -#define QQ_GENDER_SIZE 3 -static const gchar *genders[] = { - N_("Private"), - N_("Male"), - N_("Female"), -}; - -static const gchar *genders_zh[] = { - "-", - "\xc4\xd0", - "\xc5\xae", -}; - -#define QQ_FACES 134 -#define QQ_ICON_PREFIX "qq_" -#define QQ_ICON_SUFFIX ".png" - -enum { - QQ_INFO_UID = 0, QQ_INFO_NICK, QQ_INFO_COUNTRY, QQ_INFO_PROVINCE, QQ_INFO_ZIPCODE, - QQ_INFO_ADDR, QQ_INFO_TEL, QQ_INFO_AGE, QQ_INFO_GENDER, QQ_INFO_NAME, QQ_INFO_EMAIL, - QQ_INFO_PG_SN, QQ_INFO_PG_NUM, QQ_INFO_PG_SP, QQ_INFO_PG_BASE_NUM, QQ_INFO_PG_TYPE, - QQ_INFO_OCCU, QQ_INFO_HOME_PAGE, QQ_INFO_AUTH_TYPE, QQ_INFO_UNKNOW1, QQ_INFO_UNKNOW2, - QQ_INFO_FACE, QQ_INFO_MOBILE, QQ_INFO_MOBILE_TYPE, QQ_INFO_INTRO, QQ_INFO_CITY, - QQ_INFO_UNKNOW3, QQ_INFO_UNKNOW4, QQ_INFO_UNKNOW5, - QQ_INFO_IS_PUB_MOBILE, QQ_INFO_IS_PUB_CONTACT, QQ_INFO_COLLEGE, QQ_INFO_HOROSCOPE, - QQ_INFO_ZODIAC, QQ_INFO_BLOOD, QQ_INFO_SHOW, QQ_INFO_UNKNOW6, - QQ_INFO_LAST_2007, QQ_INFO_LAST -}; - -enum { - QQ_FIELD_UNUSED = 0, QQ_FIELD_BASE, QQ_FIELD_EXT, QQ_FIELD_CONTACT, QQ_FIELD_ADDR -}; - -enum { - QQ_FIELD_LABEL = 0, QQ_FIELD_STRING, QQ_FIELD_MULTI, QQ_FIELD_BOOL, QQ_FIELD_CHOICE -}; - -typedef struct { - int iclass; - int type; - char *id; - char *text; - const gchar **choice; - int choice_size; -} QQ_FIELD_INFO; - -static const QQ_FIELD_INFO field_infos[] = { - { QQ_FIELD_BASE, QQ_FIELD_STRING, "uid", N_("QQ Number"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "nick", N_("Nickname"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "country", N_("Country/Region"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "province", N_("Province/State"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "zipcode", N_("Zipcode"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "address", N_("Address"), NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "tel", N_("Phone Number"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "age", N_("Age"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_CHOICE, "gender", N_("Gender"), genders, QQ_GENDER_SIZE }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "name", N_("Name"), NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "email", N_("Email"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sn", "Pager Serial Num", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_num", "Pager Num", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sp", "Pager Serivce Provider", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sta", "Pager Station Num", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_type", "Pager Type", NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "occupation", N_("Occupation"), NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "homepage", N_("Homepage"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_BOOL, "auth", N_("Authorize adding"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow1", "Unknow1", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow2", "Unknow2", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "face", "Face", NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "mobile", N_("Cellphone Number"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "mobile_type", "Cellphone Type", NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_MULTI, "intro", N_("Personal Introduction"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "city", N_("City/Area"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow3", "Unknow3", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow4", "Unknow4", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow5", "Unknow5", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_CHOICE, "pub_mobile", N_("Publish Mobile"), publish_types, QQ_PUBLISH_SIZE }, - { QQ_FIELD_CONTACT, QQ_FIELD_CHOICE, "pub_contact", N_("Publish Contact"), publish_types, QQ_PUBLISH_SIZE }, - { QQ_FIELD_EXT, QQ_FIELD_STRING, "college", N_("College"), NULL, 0 }, - { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "horoscope", N_("Horoscope"), horoscope_names, QQ_HOROSCOPE_SIZE }, - { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "zodiac", N_("Zodiac"), zodiac_names, QQ_ZODIAC_SIZE }, - { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "blood", N_("Blood"), blood_types, QQ_BLOOD_SIZE }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "qq_show", "QQ Show", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow6", "Unknow6", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "LAST_2005", "LAST_2005", NULL, 0 } -}; - -typedef struct _modify_info_request { - PurpleConnection *gc; - int iclass; - gchar **segments; -} modify_info_request; - -#ifdef DEBUG -static void info_debug(gchar **segments) -{ -#if 0 - int index; - gchar *utf8_str; - for (index = 0; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].type == QQ_FIELD_STRING - || field_infos[index].type == QQ_FIELD_LABEL - || field_infos[index].type == QQ_FIELD_MULTI - || index == QQ_INFO_GENDER) { - utf8_str = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT); - purple_debug_info("QQ_BUDDY_INFO", "%s: %s\n", field_infos[index].text, utf8_str); - g_free(utf8_str); - continue; - } - purple_debug_info("QQ_BUDDY_INFO", "%s: %s\n", field_infos[index].text, segments[index]); - } -#endif -} -#endif - -static void info_display_only(PurpleConnection *gc, gchar **segments) -{ - PurpleNotifyUserInfo *user_info; - gchar *utf8_value; - int index; - int choice_num; - - user_info = purple_notify_user_info_new(); - - for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].iclass == QQ_FIELD_UNUSED) { - continue; - } - switch (field_infos[index].type) { - case QQ_FIELD_BOOL: - purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), - strtol(segments[index], NULL, 10) ? _("True") : _("False")); - break; - case QQ_FIELD_CHOICE: - choice_num = strtol(segments[index], NULL, 10); - if (choice_num < 0 || choice_num >= field_infos[index].choice_size) { - choice_num = 0; - } - - purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), field_infos[index].choice[choice_num]); - break; - case QQ_FIELD_LABEL: - case QQ_FIELD_STRING: - case QQ_FIELD_MULTI: - default: - if (strlen(segments[index]) != 0) { - utf8_value = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT); - purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), utf8_value); - g_free(utf8_value); - } - break; - } - } - - purple_notify_userinfo(gc, segments[0], user_info, NULL, NULL); - - purple_notify_user_info_destroy(user_info); - g_strfreev(segments); -} - -void qq_request_buddy_info(PurpleConnection *gc, guint32 uid, - guint32 update_class, int action) -{ - qq_data *qd; - gchar raw_data[16] = {0}; - - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - g_snprintf(raw_data, sizeof(raw_data), "%u", uid); - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data), - update_class, action); -} - -/* send packet to modify personal information */ -static void request_change_info(PurpleConnection *gc, gchar **segments) -{ - gint bytes = 0; - guint8 raw_data[MAX_PACKET_SIZE - 128] = {0}; - guint8 bar; - gchar *join; - - g_return_if_fail(segments != NULL); - - bar = 0x1f; - - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_put8(raw_data + bytes, bar); - - /* important! skip the first uid entry */ - join = g_strjoinv("\x1f", segments + 1); - bytes += qq_putdata(raw_data + bytes, (guint8 *)join, strlen(join)); - g_free(join); - - bytes += qq_put8(raw_data + bytes, bar); - - /* qq_show_packet("request_modify_info", raw_data, bytes); */ - qq_send_cmd(gc, QQ_CMD_UPDATE_INFO, raw_data, bytes); -} - -static void info_modify_cancel_cb(modify_info_request *info_request) -{ - g_strfreev(info_request->segments); - g_free(info_request); -} - -/* parse fields and send info packet */ -static void info_modify_ok_cb(modify_info_request *info_request, PurpleRequestFields *fields) -{ - PurpleConnection *gc; - qq_data *qd; - gchar **segments; - int index; - const char *utf8_str; - gchar *value; - int choice_num; - - gc = info_request->gc; - g_return_if_fail(gc != NULL && info_request->gc); - qd = (qq_data *) gc->proto_data; - segments = info_request->segments; - g_return_if_fail(segments != NULL); - - for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].iclass == QQ_FIELD_UNUSED) { - continue; - } - if (!purple_request_fields_exists(fields, field_infos[index].id)) { - continue; - } - switch (field_infos[index].type) { - case QQ_FIELD_BOOL: - value = purple_request_fields_get_bool(fields, field_infos[index].id) - ? g_strdup("1") : g_strdup("0"); - g_free(segments[index]); - segments[index] = value; - break; - case QQ_FIELD_CHOICE: - choice_num = purple_request_fields_get_choice(fields, field_infos[index].id); - if (choice_num < 0 || choice_num >= field_infos[index].choice_size) choice_num = 0; - - if (index == QQ_INFO_GENDER) { - /* QQ Server only recept gender in Chinese */ - value = g_strdup(genders_zh[choice_num]); - } else { - value = g_strdup_printf("%d", choice_num); - } - g_free(segments[index]); - segments[index] = value; - break; - case QQ_FIELD_LABEL: - case QQ_FIELD_STRING: - case QQ_FIELD_MULTI: - default: - utf8_str = purple_request_fields_get_string(fields, field_infos[index].id); - if (utf8_str == NULL) { - value = g_strdup("-"); - } else { - value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT); - if (value == NULL) value = g_strdup("-"); - } - g_free(segments[index]); - segments[index] = value; - break; - } - } - request_change_info(gc, segments); - - g_strfreev(segments); - g_free(info_request); -} - -static void field_request_new(PurpleRequestFieldGroup *group, gint index, gchar **segments) -{ - PurpleRequestField *field; - gchar *utf8_value; - int choice_num; - int i; - - g_return_if_fail(index >=0 && segments[index] != NULL && index < QQ_INFO_LAST); - - switch (field_infos[index].type) { - case QQ_FIELD_STRING: - case QQ_FIELD_MULTI: - utf8_value = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT); - if (field_infos[index].type == QQ_FIELD_STRING) { - field = purple_request_field_string_new( - field_infos[index].id, _(field_infos[index].text), utf8_value, FALSE); - } else { - field = purple_request_field_string_new( - field_infos[index].id, _(field_infos[index].text), utf8_value, TRUE); - } - purple_request_field_group_add_field(group, field); - g_free(utf8_value); - break; - case QQ_FIELD_BOOL: - field = purple_request_field_bool_new( - field_infos[index].id, _(field_infos[index].text), - strtol(segments[index], NULL, 10) ? TRUE : FALSE); - purple_request_field_group_add_field(group, field); - break; - case QQ_FIELD_CHOICE: - choice_num = strtol(segments[index], NULL, 10); - if (choice_num < 0 || choice_num >= field_infos[index].choice_size) choice_num = 0; - - if (index == QQ_INFO_GENDER && strlen(segments[index]) != 0) { - for (i = 0; i < QQ_GENDER_SIZE; i++) { - if (strcmp(segments[index], genders_zh[i]) == 0) { - choice_num = i; - } - } - } - field = purple_request_field_choice_new( - field_infos[index].id, _(field_infos[index].text), choice_num); - for (i = 0; i < field_infos[index].choice_size; i++) { - purple_request_field_choice_add(field, field_infos[index].choice[i]); - } - purple_request_field_group_add_field(group, field); - break; - case QQ_FIELD_LABEL: - default: - field = purple_request_field_label_new(field_infos[index].id, segments[index]); - purple_request_field_group_add_field(group, field); - break; - } -} - -static void info_modify_dialogue(PurpleConnection *gc, gchar **segments, int iclass) -{ - qq_data *qd; - PurpleRequestFieldGroup *group; - PurpleRequestFields *fields; - modify_info_request *info_request; - gchar *utf8_title, *utf8_prim; - int index; - - qd = (qq_data *) gc->proto_data; - /* Keep one dialog once a time */ - purple_request_close_with_handle(gc); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].iclass != iclass) { - continue; - } - field_request_new(group, index, segments); - } - - switch (iclass) { - case QQ_FIELD_CONTACT: - utf8_title = g_strdup(_("Modify Contact")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Contact"), segments[0]); - case QQ_FIELD_ADDR: - utf8_title = g_strdup(_("Modify Address")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Address"), segments[0]); - case QQ_FIELD_EXT: - utf8_title = g_strdup(_("Modify Extended Information")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Extended Information"), segments[0]); - break; - case QQ_FIELD_BASE: - default: - utf8_title = g_strdup(_("Modify Information")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Information"), segments[0]); - } - - info_request = g_new0(modify_info_request, 1); - info_request->gc = gc; - info_request->iclass = iclass; - info_request->segments = segments; - - purple_request_fields(gc, - utf8_title, - utf8_prim, - NULL, - fields, - _("Update"), G_CALLBACK(info_modify_ok_cb), - _("Cancel"), G_CALLBACK(info_modify_cancel_cb), - purple_connection_get_account(gc), NULL, NULL, - info_request); - - g_free(utf8_title); - g_free(utf8_prim); -} - -/* process the reply of modify_info packet */ -void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - data[data_len] = '\0'; - if (qd->uid != atoi((gchar *) data)) { /* return should be my uid */ - purple_debug_info("QQ", "Failed Updating info\n"); - qq_got_message(gc, _("Could not change buddy information.")); - } -} - -static void request_set_buddy_icon(PurpleConnection *gc, gint face_num) -{ - PurpleAccount *account = purple_connection_get_account(gc); - PurplePresence *presence = purple_account_get_presence(account); - qq_data *qd = (qq_data *) gc->proto_data; - gint offset; - - if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { - offset = 2; - } else if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY)) { - offset = 1; - } else { - offset = 0; - } - - qd->my_icon = 3 * (face_num - 1) + offset; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_SET_ICON); -} - -void qq_change_icon_cb(PurpleConnection *gc, const char *filepath) -{ - gchar *basename; - size_t index; - gint face; - - g_return_if_fail(filepath != NULL); - - purple_debug_info("QQ", "Change my icon to %s\n", filepath); - - basename = g_path_get_basename(filepath); - index = strcspn(basename, "0123456789"); - face = strtol(basename + index, NULL, 10); - g_free(basename); - purple_debug_info("QQ", "Set face to %d\n", face); - - request_set_buddy_icon(gc, face); -} - -void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - PurpleAccount *account = purple_connection_get_account(gc); - const gchar *icon_path = purple_account_get_buddy_icon_path(account); - - g_return_if_fail(icon_path != NULL); - - /* Fixme: - * icon_path is always null - * purple_imgstore_get_filename is always new file - * QQ buddy may set custom icon if level is over 16 */ - purple_debug_info("QQ", "Change my icon to %s\n", icon_path); -} - -gchar *qq_get_icon_name(gint face) -{ - gint icon; - gchar *icon_name; - - icon = face / 3 + 1; - if (icon < 1 || icon > QQ_FACES) { - icon = 1; - } - - icon_name = g_strdup_printf("%s%d%s", QQ_ICON_PREFIX, icon, QQ_ICON_SUFFIX); - return icon_name; -} - -/* - * This function seems to let people set their buddy icon, but it restricts - * them to using a small list of stock icons. Wouldn't it make more sense - * to use libpurple's normal icon setting stuff? - * - * Also it would be nice to unify the icon_dir code for Windows and Linux. - */ -gchar *qq_get_icon_path(gchar *icon_name) -{ - gchar *icon_path; - const gchar *icon_dir; -#ifdef _WIN32 - static char *dir = NULL; - if (dir == NULL) { - dir = g_build_filename(wpurple_install_dir(), "pixmaps", - "purple", "buddy_icons", "qq", NULL); - } -#endif - - /* - * TODO: The QQ protocol plugin should probably call - * purple_prefs_add_string() at startup to initialize this - * preference. It is used to allow users or distributions - * to specify this directory. We don't include these icons - * with libpurple because of possible copyright concerns. - */ - icon_dir = purple_prefs_get_string("/plugins/prpl/qq/icon_dir"); - if ( icon_dir == NULL || strlen(icon_dir) == 0) { -#ifdef _WIN32 - icon_dir = dir; -#else - icon_dir = QQ_BUDDY_ICON_DIR; -#endif - } - icon_path = g_strdup_printf("%s%c%s", icon_dir, G_DIR_SEPARATOR, icon_name); - - return icon_path; -} - -void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face) -{ - PurpleBuddy *buddy; - const gchar *icon_name_prev = NULL; - gchar *icon_name; - gchar *icon_path; - gchar *icon_file_content; - gsize icon_file_size; - - g_return_if_fail(account != NULL && who != NULL); - - /* purple_debug_info("QQ", "Update %s icon to %d\n", who, face); */ - - icon_name = qq_get_icon_name(face); - g_return_if_fail(icon_name != NULL); - /* purple_debug_info("QQ", "icon file name is %s\n", icon_name); */ - - if ((buddy = purple_find_buddy(account, who))) { - icon_name_prev = purple_buddy_icons_get_checksum_for_user(buddy); - /* - purple_debug_info("QQ", "Previous icon is %s\n", - icon_name_prev != NULL ? icon_name_prev : "(NULL)"); - */ - } - if (icon_name_prev != NULL && !strcmp(icon_name, icon_name_prev)) { - /* purple_debug_info("QQ", "Icon is not changed\n"); */ - g_free(icon_name); - return; - } - - icon_path = qq_get_icon_path(icon_name); - if (icon_path == NULL) { - g_free(icon_name); - return; - } - - if (!g_file_get_contents(icon_path, &icon_file_content, &icon_file_size, NULL)) { - purple_debug_error("QQ", "Failed reading icon file %s\n", icon_path); - } else { - purple_debug_info("QQ", "Update %s icon to %d (%s)\n", - who, face, icon_path); - purple_buddy_icons_set_for_user(account, who, - icon_file_content, icon_file_size, icon_name); - } - g_free(icon_name); - g_free(icon_path); -} - -/* after getting info or modify myself, refresh the buddy list accordingly */ -static void update_buddy_info(PurpleConnection *gc, gchar **segments) -{ - PurpleBuddy *buddy = NULL; - qq_data *qd = NULL; - qq_buddy_data *bd = NULL; - guint32 uid; - gchar *who; - gchar *alias_utf8; - - PurpleAccount *account = purple_connection_get_account(gc); - qd = (qq_data *)purple_connection_get_protocol_data(gc); - - uid = strtoul(segments[QQ_INFO_UID], NULL, 10); - who = uid_to_purple_name(uid); - qq_filter_str(segments[QQ_INFO_NICK]); - alias_utf8 = qq_to_utf8(segments[QQ_INFO_NICK], QQ_CHARSET_DEFAULT); - - if (uid == qd->uid) { /* it is me */ - purple_debug_info("QQ", "Got my info\n"); - qd->my_icon = strtol(segments[QQ_INFO_FACE], NULL, 10); - if (alias_utf8 != NULL) { - purple_account_set_alias(account, alias_utf8); - } - /* add me to buddy list */ - buddy = qq_buddy_find_or_new(gc, uid); - } else { - buddy = purple_find_buddy(gc->account, who); - /* purple_debug_info("QQ", "buddy=%p\n", (void*)buddy); */ - } - - /* if the buddy is null, the api will catch it and return null here */ - bd = purple_buddy_get_protocol_data(buddy); - /* purple_debug_info("QQ", "bd=%p\n", (void*)bd); */ - - if (bd == NULL || buddy == NULL) { - g_free(who); - g_free(alias_utf8); - return; - } - - /* update buddy list (including myself, if myself is the buddy) */ - bd->age = strtol(segments[QQ_INFO_AGE], NULL, 10); - bd->gender = strtol(segments[QQ_INFO_GENDER], NULL, 10); - bd->face = strtol(segments[QQ_INFO_FACE], NULL, 10); - - if (alias_utf8 != NULL) { - if (bd->nickname) g_free(bd->nickname); - bd->nickname = g_strdup(alias_utf8); - } - bd->last_update = time(NULL); - - purple_blist_server_alias_buddy(buddy, bd->nickname); - - /* convert face num from packet (0-299) to local face (1-100) */ - qq_update_buddy_icon(gc->account, who, bd->face); - - g_free(who); - g_free(alias_utf8); -} - -/* process reply to get_info packet */ -void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc) -{ - qq_data *qd; - gchar **segments; - gint field_count; - gchar *icon_name; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (qd->client_version >= 2008) { - field_count = QQ_INFO_LAST; - } else { - field_count = QQ_INFO_LAST_2007; - } - if (NULL == (segments = split_data(data, data_len, "\x1e", field_count))) - return; - -#ifdef DEBUG - info_debug(segments); -#endif - - if (action == QQ_BUDDY_INFO_SET_ICON) { - if (strtol(segments[QQ_INFO_FACE], NULL, 10) != qd->my_icon) { - icon_name = g_strdup_printf("%d", qd->my_icon); - g_free(segments[QQ_INFO_FACE]); - segments[QQ_INFO_FACE] = icon_name; - - /* Update me in buddy list */ - update_buddy_info(gc, segments); - /* send new face to server */ - request_change_info(gc, segments); - } - g_strfreev(segments); - return; - } - - update_buddy_info(gc, segments); - switch (action) { - case QQ_BUDDY_INFO_DISPLAY: - info_display_only(gc, segments); - break; - case QQ_BUDDY_INFO_SET_ICON: - g_return_if_reached(); - break; - case QQ_BUDDY_INFO_MODIFY_BASE: - info_modify_dialogue(gc, segments, QQ_FIELD_BASE); - break; - case QQ_BUDDY_INFO_MODIFY_EXT: - info_modify_dialogue(gc, segments, QQ_FIELD_EXT); - break; - case QQ_BUDDY_INFO_MODIFY_ADDR: - info_modify_dialogue(gc, segments, QQ_FIELD_ADDR); - break; - case QQ_BUDDY_INFO_MODIFY_CONTACT: - info_modify_dialogue(gc, segments, QQ_FIELD_CONTACT); - break; - default: - g_strfreev(segments); - break; - } - return; -} - -void qq_request_get_level(PurpleConnection *gc, guint32 uid) -{ - qq_data *qd = (qq_data *) gc->proto_data; - guint8 buf[16] = {0}; - gint bytes = 0; - - if (qd->client_version >= 2007) { - bytes += qq_put8(buf + bytes, 0x02); - } else { - bytes += qq_put8(buf + bytes, 0x00); - } - bytes += qq_put32(buf + bytes, uid); - qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes); -} - -void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid) -{ - guint8 buf[16] = {0}; - gint bytes = 0; - - bytes += qq_put8(buf + bytes, 0x08); - bytes += qq_put32(buf + bytes, uid); - bytes += qq_put8(buf + bytes, 0x00); - qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes); -} - -void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class) -{ - qq_data *qd = (qq_data *) gc->proto_data; - PurpleBuddy *buddy; - qq_buddy_data *bd; - guint8 *buf; - GSList *buddies, *it; - gint bytes; - - /* server only reply levels for online buddies */ - buf = g_newa(guint8, MAX_PACKET_SIZE); - - bytes = 0; - bytes += qq_put8(buf + bytes, 0x00); - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - for (it = buddies; it; it = it->next) { - buddy = it->data; - if (buddy == NULL) continue; - if ((bd = purple_buddy_get_protocol_data(buddy)) == NULL) continue; - if (bd->uid == 0) continue; /* keep me as end of packet*/ - if (bd->uid == qd->uid) continue; - bytes += qq_put32(buf + bytes, bd->uid); - } - bytes += qq_put32(buf + bytes, qd->uid); - qq_send_cmd_mess(gc, QQ_CMD_GET_LEVEL, buf, bytes, update_class, 0); -} - -static void process_level(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes = 0; - guint32 uid, onlineTime; - guint16 level, timeRemainder; - qq_buddy_data *bd; - - while (data_len - bytes >= 12) { - bytes += qq_get32(&uid, data + bytes); - bytes += qq_get32(&onlineTime, data + bytes); - bytes += qq_get16(&level, data + bytes); - bytes += qq_get16(&timeRemainder, data + bytes); - purple_debug_info("QQ", "level: %d, uid %u, tmOnline: %d, tmRemainder: %d\n", - level, uid, onlineTime, timeRemainder); - - bd = qq_buddy_data_find(gc, uid); - if (bd == NULL) { - purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid); - continue; - } - - bd->onlineTime = onlineTime; - bd->level = level; - bd->timeRemainder = timeRemainder; - } - - if (bytes != data_len) { - purple_debug_error("QQ", - "Wrong format of Get levels. Truncate %d bytes.\n", data_len - bytes); - } -} - -static void process_level_2007(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes; - guint32 uid, onlineTime; - guint16 level, timeRemainder; - qq_buddy_data *bd; - guint16 str_len; - gchar *str; - gchar *str_utf8; - - bytes = 0; - bytes += qq_get32(&uid, data + bytes); - bytes += qq_get32(&onlineTime, data + bytes); - bytes += qq_get16(&level, data + bytes); - bytes += qq_get16(&timeRemainder, data + bytes); - purple_debug_info("QQ", "level: %d, uid %u, tmOnline: %d, tmRemainder: %d\n", - level, uid, onlineTime, timeRemainder); - - bd = qq_buddy_data_find(gc, uid); - if (bd == NULL) { - purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid); - return; - } - - bd->onlineTime = onlineTime; - bd->level = level; - bd->timeRemainder = timeRemainder; - - /* extend bytes in qq2007*/ - bytes += 4; /* skip 8 bytes */ - /* qq_show_packet("Buddies level", data + bytes, data_len - bytes); */ - - do { - bytes += qq_get16(&str_len, data + bytes); - if (str_len <= 0 || bytes + str_len > data_len) { - purple_debug_error("QQ", - "Wrong format of Get levels. Truncate %d bytes.\n", data_len - bytes); - break; - } - str = g_strndup((gchar *)data + bytes, str_len); - bytes += str_len; - str_utf8 = qq_to_utf8(str, QQ_CHARSET_DEFAULT); - purple_debug_info("QQ", "%s\n", str_utf8); - g_free(str_utf8); - g_free(str); - } while (bytes < data_len); -} - -void qq_process_get_level_reply(guint8 *data, gint data_len, PurpleConnection *gc) -{ - gint bytes; - guint8 sub_cmd; - - bytes = 0; - bytes += qq_get8(&sub_cmd, data + bytes); - switch (sub_cmd) { - case 0x08: - process_level_2007(gc, data + bytes, data_len - bytes); - break; - case 0x00: - case 0x02: - default: - process_level(gc, data + bytes, data_len - bytes); - break; - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_info.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file buddy_info.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_INFO_H_ -#define _QQ_BUDDY_INFO_H_ - -#include -#include "connection.h" - -#include "buddy_opt.h" -#include "qq.h" - -/* use in qq2005 - * ext_flag: (0-7) - * bit1 => qq space - * comm_flag: (0-7) - * bit1 => member - * bit4 => TCP mode - * bit5 => open mobile QQ - * bit6 => bind to mobile - * bit7 => whether having a video -#define QQ_COMM_FLAG_QQ_MEMBER 0x02 -#define QQ_COMM_FLAG_TCP_MODE 0x10 -#define QQ_COMM_FLAG_MOBILE 0x20 -#define QQ_COMM_FLAG_BIND_MOBILE 0x40 -#define QQ_COMM_FLAG_VIDEO 0x80 - */ -/* status in eva for qq2006 -#define QQ_FRIEND_FLAG_QQ_MEMBER 0x01 -#define QQ_FRIEND_FLAG_MOBILE 0x10 -#define QQ_FRIEND_FLAG_BIND_MOBILE 0x20 -*/ -#define QQ_COMM_FLAG_QQ_VIP 0x02 -#define QQ_COMM_FLAG_QQ_MEMBER 0x04 -#define QQ_COMM_FLAG_TCP_MODE 0x10 -#define QQ_COMM_FLAG_MOBILE 0x20 -#define QQ_COMM_FLAG_BIND_MOBILE 0x40 -#define QQ_COMM_FLAG_VIDEO 0x80 - -#define QQ_EXT_FLAG_ZONE 0x02 - -#define QQ_BUDDY_GENDER_GG 0x00 -#define QQ_BUDDY_GENDER_MM 0x01 -#define QQ_BUDDY_GENDER_UNKNOWN 0xff - -enum { - QQ_BUDDY_INFO_UPDATE_ONLY = 0, - QQ_BUDDY_INFO_DISPLAY, - QQ_BUDDY_INFO_SET_ICON, - QQ_BUDDY_INFO_MODIFY_BASE, - QQ_BUDDY_INFO_MODIFY_EXT, - QQ_BUDDY_INFO_MODIFY_ADDR, - QQ_BUDDY_INFO_MODIFY_CONTACT -}; - -gchar *qq_get_icon_name(gint face); -gchar *qq_get_icon_path(gchar *icon_name); -void qq_change_icon_cb(PurpleConnection *gc, const char *filepath); - -void qq_request_buddy_info(PurpleConnection *gc, guint32 uid, - guint32 update_class, int action); -void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img); -void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len); -void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc); - -void qq_request_get_level(PurpleConnection *gc, guint32 uid); -void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid); -void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class); -void qq_process_get_level_reply(guint8 *buf, gint buf_len, PurpleConnection *gc); - -void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,707 +0,0 @@ -/** - * @file buddy_list.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "qq.h" - -#include "debug.h" -#include "notify.h" -#include "utils.h" -#include "packet_parse.h" -#include "buddy_info.h" -#include "buddy_memo.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "char_conv.h" -#include "qq_define.h" -#include "qq_base.h" -#include "group.h" -#include "group_internal.h" -#include "group_info.h" - -#include "qq_network.h" - -#define QQ_GET_ONLINE_BUDDY_02 0x02 -#define QQ_GET_ONLINE_BUDDY_03 0x03 /* unknown function */ - -typedef struct _qq_buddy_online { - guint16 unknown1; - guint8 ext_flag; - guint8 comm_flag; - guint16 unknown2; - guint8 ending; /* 0x00 */ -} qq_buddy_online; - -/* get a list of online_buddies */ -void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class) -{ - qq_data *qd; - guint8 *raw_data; - gint bytes = 0; - - qd = (qq_data *) gc->proto_data; - raw_data = g_newa(guint8, 5); - - /* 000-000 get online friends cmd - * only 0x02 and 0x03 returns info from server, other valuse all return 0xff - * I can also only send the first byte (0x02, or 0x03) - * and the result is the same */ - bytes += qq_put8(raw_data + bytes, QQ_GET_ONLINE_BUDDY_02); - /* 001-001 seems it supports 255 online buddies at most */ - bytes += qq_put8(raw_data + bytes, position); - /* 002-002 */ - bytes += qq_put8(raw_data + bytes, 0x00); - /* 003-004 */ - bytes += qq_put16(raw_data + bytes, 0x0000); - - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_ONLINE, raw_data, 5, update_class, 0); -} - -/* position starts with 0x0000, - * server may return a position tag if list is too long for one packet */ -void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes = 0; - - qd = (qq_data *) gc->proto_data; - - /* 000-001 starting position, can manually specify */ - bytes += qq_put16(raw_data + bytes, position); - /* before Mar 18, 2004, any value can work, and we sent 00 - * I do not know what data QQ server is expecting, as QQ2003iii 0304 itself - * even can sending packets 00 and get no response. - * Now I tested that 00,00,00,00,00,01 work perfectly - * March 22, found the 00,00,00 starts to work as well */ - bytes += qq_put8(raw_data + bytes, 0x00); - if (qd->client_version >= 2007) { - bytes += qq_put16(raw_data + bytes, 0x0000); - } - - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_LIST, raw_data, bytes, update_class, 0); -} - -/* get all list, buddies & Quns with groupsid support */ -void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class) -{ - guint8 raw_data[16] = {0}; - gint bytes = 0; - - /* 0x01 download, 0x02, upload */ - bytes += qq_put8(raw_data + bytes, 0x01); - /* unknown 0x02 */ - bytes += qq_put8(raw_data + bytes, 0x02); - /* unknown 00 00 00 00 */ - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, position); - - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_AND_ROOMS, raw_data, bytes, update_class, 0); -} - -/* parse the data into qq_buddy_status */ -static gint get_buddy_status(qq_buddy_status *bs, guint8 *data) -{ - gint bytes = 0; - - g_return_val_if_fail(data != NULL && bs != NULL, -1); - - /* 000-003: uid */ - bytes += qq_get32(&bs->uid, data + bytes); - /* 004-004: 0x01 */ - bytes += qq_get8(&bs->unknown1, data + bytes); - /* this is no longer the IP, it seems QQ (as of 2006) no longer sends - * the buddy's IP in this packet. all 0s */ - /* 005-008: ip */ - bytes += qq_getIP(&bs->ip, data + bytes); - /* port info is no longer here either */ - /* 009-010: port */ - bytes += qq_get16(&bs->port, data + bytes); - /* 011-011: 0x00 */ - bytes += qq_get8(&bs->unknown2, data + bytes); - /* 012-012: status */ - bytes += qq_get8(&bs->status, data + bytes); - /* 013-014: client tag */ - bytes += qq_get16(&bs->unknown3, data + bytes); - /* 015-030: unknown key */ - bytes += qq_getdata(&(bs->unknown_key[0]), QQ_KEY_LENGTH, data + bytes); - - purple_debug_info("QQ", "Status:%d, uid: %u, ip: %s:%d, U: %d - %d - %04X\n", - bs->status, bs->uid, inet_ntoa(bs->ip), bs->port, - bs->unknown1, bs->unknown2, bs->unknown3); - - return bytes; -} - -/* process the reply packet for get_buddies_online packet */ -guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes, bytes_start; - gint count; - guint8 position; - gchar *who; - PurpleBuddy *buddy; - qq_buddy_data *bd; - int entry_len = 38; - - qq_buddy_status bs; - struct { - guint16 unknown1; - guint8 ext_flag; - guint8 comm_flag; - guint16 unknown2; - guint8 ending; /* 0x00 */ - } packet; - - g_return_val_if_fail(data != NULL && data_len != 0, -1); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Get buddies online reply packet", data, len); */ - if (qd->client_version >= 2007) entry_len += 4; - - bytes = 0; - bytes += qq_get8(&position, data + bytes); - - count = 0; - while (bytes < data_len) { - if (data_len - bytes < entry_len) { - purple_debug_error("QQ", "[buddies online] only %d, need %d\n", - (data_len - bytes), entry_len); - break; - } - memset(&bs, 0 ,sizeof(bs)); - memset(&packet, 0 ,sizeof(packet)); - - /* set flag */ - bytes_start = bytes; - /* based on one online buddy entry */ - /* 000-030 qq_buddy_status */ - bytes += get_buddy_status(&bs, data + bytes); - /* 031-032: */ - bytes += qq_get16(&packet.unknown1, data + bytes); - /* 033-033: ext_flag */ - bytes += qq_get8(&packet.ext_flag, data + bytes); - /* 034-034: comm_flag */ - bytes += qq_get8(&packet.comm_flag, data + bytes); - /* 035-036: */ - bytes += qq_get16(&packet.unknown2, data + bytes); - /* 037-037: */ - bytes += qq_get8(&packet.ending, data + bytes); /* 0x00 */ - /* skip 4 bytes in qq2007 */ - if (qd->client_version >= 2007) bytes += 4; - - if (bs.uid == 0 || (bytes - bytes_start) != entry_len) { - purple_debug_error("QQ", "uid=0 or entry complete len(%d) != %d\n", - (bytes - bytes_start), entry_len); - continue; - } /* check if it is a valid entry */ - - if (bs.uid == qd->uid) { - purple_debug_warning("QQ", "I am in online list %u\n", bs.uid); - } - - /* update buddy information */ - who = uid_to_purple_name(bs.uid); - buddy = purple_find_buddy(gc->account, who); - g_free(who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, bs.uid); - } - bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); - if (bd == NULL) { - purple_debug_error("QQ", - "Got an online buddy %u, but not in my buddy list\n", bs.uid); - continue; - } - /* - if(0 != fe->s->client_tag) - q_bud->client_tag = fe->s->client_tag; - */ - if (bd->status != bs.status || bd->comm_flag != packet.comm_flag) { - bd->status = bs.status; - bd->comm_flag = packet.comm_flag; - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } - bd->ip.s_addr = bs.ip.s_addr; - bd->port = bs.port; - bd->ext_flag = packet.ext_flag; - bd->last_update = time(NULL); - count++; - } - - if(bytes > data_len) { - purple_debug_error("QQ", - "qq_process_get_buddies_online: Dangerous error! maybe protocol changed, notify developers!\n"); - } - - purple_debug_info("QQ", "Received %d online buddies, nextposition=%u\n", - count, (guint) position); - return position; -} - - -/* process reply for get_buddies_list */ -guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - qq_buddy_data bd; - gint bytes_expected, count; - gint bytes, buddy_bytes; - gint nickname_len; - guint16 position, unknown; - PurpleBuddy *buddy; - - g_return_val_if_fail(data != NULL && data_len != 0, -1); - - qd = (qq_data *) gc->proto_data; - - if (data_len <= 2) { - purple_debug_error("QQ", "empty buddies list\n"); - return -1; - } - /* qq_show_packet("QQ get buddies list", data, data_len); */ - bytes = 0; - bytes += qq_get16(&position, data + bytes); - /* the following data is buddy list in this packet */ - count = 0; - while (bytes < data_len) { - memset(&bd, 0, sizeof(bd)); - /* set flag */ - buddy_bytes = bytes; - /* 000-003: uid */ - bytes += qq_get32(&bd.uid, data + bytes); - /* 004-005: icon index (1-255) */ - bytes += qq_get16(&bd.face, data + bytes); - /* 006-006: age */ - bytes += qq_get8(&bd.age, data + bytes); - /* 007-007: gender */ - bytes += qq_get8(&bd.gender, data + bytes); - - nickname_len = qq_get_vstr(&bd.nickname, QQ_CHARSET_DEFAULT, data + bytes); - bytes += nickname_len; - qq_filter_str(bd.nickname); - - /* Fixme: merge following as 32bit flag */ - bytes += qq_get16(&unknown, data + bytes); - bytes += qq_get8(&bd.ext_flag, data + bytes); - bytes += qq_get8(&bd.comm_flag, data + bytes); - - if (qd->client_version >= 2007) { - bytes += 4; /* skip 4 bytes */ - bytes_expected = 16 + nickname_len; - } else { - bytes_expected = 12 + nickname_len; - } - - if (bd.uid == 0 || (bytes - buddy_bytes) != bytes_expected) { - purple_debug_info("QQ", - "Buddy entry, expect %d bytes, read %d bytes\n", - bytes_expected, bytes - buddy_bytes); - g_free(bd.nickname); - continue; - } else { - count++; - } - -#if 1 - purple_debug_info("QQ", "buddy [%09d]: ext_flag=0x%02x, comm_flag=0x%02x, nick=%s\n", - bd.uid, bd.ext_flag, bd.comm_flag, bd.nickname); -#endif - - buddy = qq_buddy_find_or_new(gc, bd.uid); - if (buddy == NULL || purple_buddy_get_protocol_data(buddy) == NULL) { - g_free(bd.nickname); - continue; - } - purple_blist_server_alias_buddy(buddy, bd.nickname); - bd.last_update = time(NULL); - qq_update_buddy_status(gc, bd.uid, bd.status, bd.comm_flag); - - g_memmove(purple_buddy_get_protocol_data(buddy), &bd, sizeof(qq_buddy_data)); - /* nickname has been copy to buddy_data do not free - g_free(bd.nickname); - */ - /*qq_request_buddy_memo(gc, ((qq_buddy_data*)buddy->proto_data)->uid, 0, QQ_BUDDY_MEMO_GET);*/ - qq_request_buddy_memo(gc, bd.uid, bd.uid, QQ_BUDDY_MEMO_GET); - } - - if(bytes > data_len) { - purple_debug_error("QQ", - "qq_process_get_buddies: Dangerous error! maybe protocol changed, notify developers!\n"); - } - - purple_debug_info("QQ", "Received %d buddies, nextposition=%u\n", - count, (guint) position); - return position; -} - -guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint i, j; - gint bytes; - guint8 sub_cmd, reply_code; - guint32 unknown, position; - guint32 uid; - guint8 type; - qq_room_data *rmd; - - g_return_val_if_fail(data != NULL && data_len != 0, -1); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&sub_cmd, data + bytes); - g_return_val_if_fail(sub_cmd == 0x01, -1); - - bytes += qq_get8(&reply_code, data + bytes); - if(0 != reply_code) { - purple_debug_warning("QQ", "qq_process_get_buddies_and_rooms, %d\n", reply_code); - } - - bytes += qq_get32(&unknown, data + bytes); - bytes += qq_get32(&position, data + bytes); - /* the following data is all list in this packet */ - i = 0; - j = 0; - while (bytes < data_len) { - /* 00-03: uid */ - bytes += qq_get32(&uid, data + bytes); - /* 04: type 0x1:buddy 0x4:Qun */ - bytes += qq_get8(&type, data + bytes); - /* 05: skip unknow 0x00 */ - bytes += 1; - if (uid == 0 || (type != 0x1 && type != 0x4)) { - purple_debug_info("QQ", "Buddy entry, uid=%u, type=%d\n", uid, type); - continue; - } - if(0x1 == type) { /* a buddy */ - /* don't do anything but count - buddies are handled by - * qq_request_get_buddies */ - ++i; - } else { /* a group */ - rmd = qq_room_data_find(gc, uid); - if(rmd == NULL) { - purple_debug_info("QQ", "Unknown room id %u\n", uid); - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_INFO, uid); - } else { - rmd->my_role = QQ_ROOM_ROLE_YES; - } - ++j; - } - } - - if(bytes > data_len) { - purple_debug_error("QQ", - "qq_process_get_buddies_and_rooms: Dangerous error! maybe protocol changed, notify developers!\n"); - } - - purple_debug_info("QQ", "Received %d buddies and %d groups, nextposition=%u\n", i, j, (guint) position); - return position; -} - -#define QQ_MISC_STATUS_HAVING_VIIDEO 0x00000001 -#define QQ_CHANGE_ONLINE_STATUS_REPLY_OK 0x30 /* ASCII value of "0" */ - -/* TODO: figure out what's going on with the IP region. Sometimes I get valid IP addresses, - * but the port number's weird, other times I get 0s. I get these simultaneously on the same buddy, - * using different accounts to get info. */ -static guint8 get_status_from_purple(PurpleConnection *gc) -{ - qq_data *qd; - PurpleAccount *account; - PurplePresence *presence; - guint8 ret; - - qd = (qq_data *) gc->proto_data; - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { - ret = QQ_BUDDY_ONLINE_INVISIBLE; - } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) - { - if (qd->client_version >= 2007) { - ret = QQ_BUDDY_ONLINE_BUSY; - } else { - ret = QQ_BUDDY_ONLINE_INVISIBLE; - } - } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) { - ret = QQ_BUDDY_ONLINE_AWAY; - } else { - ret = QQ_BUDDY_ONLINE_NORMAL; - } - return ret; -} - -/* send a packet to change my online status */ -void qq_request_change_status(PurpleConnection *gc, guint32 update_class) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes = 0; - guint8 away_cmd; - guint32 misc_status; - gboolean fake_video; - PurpleAccount *account; - PurplePresence *presence; - - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - qd = (qq_data *) gc->proto_data; - if (!qd->is_login) - return; - - away_cmd = get_status_from_purple(gc); - - misc_status = 0x00000000; - fake_video = purple_prefs_get_bool("/plugins/prpl/qq/show_fake_video"); - if (fake_video) - misc_status |= QQ_MISC_STATUS_HAVING_VIIDEO; - - if (qd->client_version >= 2007) { - bytes = 0; - bytes += qq_put8(raw_data + bytes, away_cmd); - /* status version */ - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put32(raw_data + bytes, misc_status); - /* Fixme: custom status message, now is empty */ - bytes += qq_put16(raw_data + bytes, 0); - } else { - bytes = 0; - bytes += qq_put8(raw_data + bytes, away_cmd); - bytes += qq_put32(raw_data + bytes, misc_status); - } - qq_send_cmd_mess(gc, QQ_CMD_CHANGE_STATUS, raw_data, bytes, update_class, 0); -} - -/* parse the reply packet for change_status */ -void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - guint8 reply; - qq_buddy_data *bd; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes = qq_get8(&reply, data + bytes); - if (reply != QQ_CHANGE_ONLINE_STATUS_REPLY_OK) { - purple_debug_warning("QQ", "Change status fail 0x%02X\n", reply); - return; - } - - /* purple_debug_info("QQ", "Change status OK\n"); */ - bd = qq_buddy_data_find(gc, qd->uid); - if (bd != NULL) { - bd->status = get_status_from_purple(gc); - bd->last_update = time(NULL); - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } -} - -/* it is a server message indicating that one of my buddies has changed its status */ -void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - guint32 my_uid; - gchar *who; - PurpleBuddy *buddy; - qq_buddy_data *bd; - qq_buddy_status bs; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (data_len < 35) { - purple_debug_error("QQ", "[buddy status change] only %d, need 35 bytes\n", data_len); - return; - } - - memset(&bs, 0, sizeof(bs)); - bytes = 0; - /* 000-030: qq_buddy_status */ - bytes += get_buddy_status(&bs, data + bytes); - /* 031-034: Unknow, maybe my uid */ - /* This has a value of 0 when we've changed our status to - * QQ_BUDDY_ONLINE_INVISIBLE */ - bytes += qq_get32(&my_uid, data + bytes); - - /* update buddy information */ - who = uid_to_purple_name(bs.uid); - buddy = purple_find_buddy(gc->account, who); - g_free(who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, bs.uid); - } - bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); - if (bd == NULL) { - purple_debug_warning("QQ", "Got status of no-auth buddy %u\n", bs.uid); - return; - } - - if(bs.ip.s_addr != 0) { - bd->ip.s_addr = bs.ip.s_addr; - bd->port = bs.port; - } - if (bd->status != bs.status) { - bd->status = bs.status; - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } - bd->last_update = time(NULL); - - if (bd->status == QQ_BUDDY_ONLINE_NORMAL && bd->level <= 0) { - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, bd->uid); - } else { - qq_request_get_level(gc, bd->uid); - } - } -} - -/*TODO: maybe this should be qq_update_buddy_status() ?*/ -void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag) -{ - gchar *who; - gchar *status_id; - - g_return_if_fail(uid != 0); - - /* purple supports signon and idle time - * but it is not much use for QQ, I do not use them */ - /* serv_got_update(gc, name, online, 0, q_bud->signon, q_bud->idle, bud->uc); */ - status_id = "available"; - switch(status) { - case QQ_BUDDY_OFFLINE: - status_id = "offline"; - break; - case QQ_BUDDY_ONLINE_NORMAL: - status_id = "available"; - break; - case QQ_BUDDY_CHANGE_TO_OFFLINE: - status_id = "offline"; - break; - case QQ_BUDDY_ONLINE_AWAY: - status_id = "away"; - break; - case QQ_BUDDY_ONLINE_INVISIBLE: - status_id = "invisible"; - break; - case QQ_BUDDY_ONLINE_BUSY: - status_id = "busy"; - break; - default: - status_id = "invisible"; - purple_debug_error("QQ", "unknown status: 0x%X\n", status); - break; - } - - purple_debug_info("QQ", "buddy %u status = %s\n", uid, status_id); - who = uid_to_purple_name(uid); - purple_prpl_got_user_status(gc->account, who, status_id, NULL); - - if (flag & QQ_COMM_FLAG_MOBILE && status != QQ_BUDDY_OFFLINE) - purple_prpl_got_user_status(gc->account, who, "mobile", NULL); - else - purple_prpl_got_user_status_deactive(gc->account, who, "mobile"); - - g_free(who); -} - -/* refresh all buddies online/offline, - * after receiving reply for get_buddies_online packet */ -void qq_update_buddyies_status(PurpleConnection *gc) -{ - qq_data *qd; - PurpleBuddy *buddy; - qq_buddy_data *bd; - GSList *buddies, *it; - time_t tm_limit = time(NULL); - - qd = (qq_data *) (gc->proto_data); - - tm_limit -= QQ_UPDATE_ONLINE_INTERVAL; - - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - for (it = buddies; it; it = it->next) { - buddy = it->data; - if (buddy == NULL) continue; - - bd = purple_buddy_get_protocol_data(buddy); - if (bd == NULL) continue; - - if (bd->uid == 0) continue; - if (bd->uid == qd->uid) continue; /* my status is always online in my buddy list */ - if (tm_limit < bd->last_update) continue; - if (bd->status == QQ_BUDDY_ONLINE_INVISIBLE) continue; - if (bd->status == QQ_BUDDY_CHANGE_TO_OFFLINE) continue; - - bd->status = QQ_BUDDY_CHANGE_TO_OFFLINE; - bd->last_update = time(NULL); - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } -} - -void qq_buddy_data_free_all(PurpleConnection *gc) -{ - qq_data *qd; - PurpleBuddy *buddy; - GSList *buddies, *it; - gint count = 0; - - qd = (qq_data *)purple_connection_get_protocol_data(gc); - - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - for (it = buddies; it; it = it->next) { - qq_buddy_data *qbd = NULL; - - buddy = it->data; - if (buddy == NULL) continue; - - qbd = purple_buddy_get_protocol_data(buddy); - if (qbd == NULL) continue; - - qq_buddy_data_free(qbd); - purple_buddy_set_protocol_data(buddy, NULL); - - count++; - } - - if (count > 0) { - purple_debug_info("QQ", "%d buddies' data are freed\n", count); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_list.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/** - * @file buddy_list.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_LIST_H_ -#define _QQ_BUDDY_LIST_H_ - -#include -#include "connection.h" - -#include "qq.h" -typedef struct _qq_buddy_status { - guint32 uid; - guint8 unknown1; - struct in_addr ip; - guint16 port; - guint8 unknown2; - guint8 status; - guint16 unknown3; - guint8 unknown_key[QQ_KEY_LENGTH]; -} qq_buddy_status; - -void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class); -guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class); -guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class); -guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_change_status(PurpleConnection *gc, guint32 update_class); -void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc); -void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_update_buddyies_status(PurpleConnection *gc); -void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag); -void qq_buddy_data_free_all(PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,390 +0,0 @@ -/** - * @file buddy_memo.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "request.h" - -#include "buddy_memo.h" -#include "utils.h" -#include "packet_parse.h" -#include "buddy_list.h" -#include "buddy_info.h" -#include "char_conv.h" -#include "im.h" -#include "qq_define.h" -#include "qq_base.h" -#include "qq_network.h" -#include "qq.h" - - -#include -#include -#include - -#include -#include - -/* memo index */ -enum { - QQ_MEMO_ALIAS = 0, - QQ_MEMO_MOBILD, - QQ_MEMO_TELEPHONE, - QQ_MEMO_ADDRESS, - QQ_MEMO_EMAIL, - QQ_MEMO_ZIPCODE, - QQ_MEMO_NOTE, - QQ_MEMO_SIZE -}; - -/* memo id */ -static const gchar *memo_id[] = { - "mm_alias", - "mm_mobile", - "mm_telephone", - "mm_address", - "mm_email", - "mm_zipcode", - "mm_note" -}; - -/* memo text */ -static const gchar *memo_txt[] = { - N_("Alias"), - N_("Mobile"), - N_("Telephone"), - N_("Address"), - N_("Email"), - N_("Postal Code"), - N_("Note") -}; - -typedef struct _modify_memo_request { - PurpleConnection *gc; - guint32 bd_uid; - gchar **segments; -} modify_memo_request; - - -static void memo_debug(gchar **segments) -{ - gint index; - g_return_if_fail(NULL != segments); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - purple_debug_info("QQ","memo[%i]=%s\n", index, segments[index]); - } -} - -static void memo_free(gchar **segments) -{ - gint index; - g_return_if_fail(NULL != segments); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - g_free(segments[index]); - } - purple_debug_info("QQ", "memo freed\n"); -} - -static void update_buddy_memo(PurpleConnection *gc, guint32 bd_uid, gchar *alias) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - gchar *who; - g_return_if_fail(NULL != gc && NULL != alias); - - account = (PurpleAccount *)gc->account; - g_return_if_fail(NULL != account); - - who = uid_to_purple_name(bd_uid); - buddy = purple_find_buddy(account, who); - if (buddy == NULL || buddy->proto_data == NULL) { - g_free(who); - purple_debug_info("QQ", "Error...Can NOT find %d!\n", bd_uid); - return; - } - purple_blist_alias_buddy(buddy, (const char*)alias); -} - -static void request_change_memo(PurpleConnection *gc, guint32 bd_uid, gchar **segments) -{ - gint bytes; - /* Attention, length of each segment must be guint8(0~255), - * so length of memo string is limited. - * convert it to guint8 first before putting data */ - guint seg_len; - gint index; - guint8 raw_data[MAX_PACKET_SIZE - 16] = {0}; - - purple_debug_info( "QQ", "request_change_memo\n" ); - g_return_if_fail(NULL != gc && NULL != segments); - - bytes = 0; - bytes += qq_put8(raw_data+bytes, QQ_BUDDY_MEMO_MODIFY); - bytes += qq_put8(raw_data+bytes, 0x00); - bytes += qq_put32(raw_data+bytes, (guint32)bd_uid); - bytes += qq_put8(raw_data+bytes, 0x00); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - seg_len = strlen(segments[index]); - seg_len = seg_len & 0xff; - bytes += qq_put8(raw_data+bytes, (guint8)seg_len); - bytes += qq_putdata(raw_data+bytes, (const guint8 *)segments[index], (guint8)seg_len); - } - - /* debug */ - /* - qq_show_packet("MEMO MODIFY", raw_data, bytes); - */ - - qq_send_cmd(gc, QQ_CMD_BUDDY_MEMO, raw_data, bytes); -} - -static void memo_modify_cancle_cb(modify_memo_request *memo_request, PurpleRequestFields *fields) -{ - memo_free(memo_request->segments); - g_free(memo_request); -} - -/* prepare segments to be sent, string all convert to qq charset */ -static void memo_modify_ok_cb(modify_memo_request *memo_request, PurpleRequestFields *fields) -{ - PurpleConnection *gc; - guint32 bd_uid; - gchar **segments; - const gchar *utf8_str; - gchar *value = NULL; - gint index; - - g_return_if_fail(NULL != memo_request); - gc = (PurpleConnection *)memo_request->gc; - segments = (gchar **)memo_request->segments; - g_return_if_fail(NULL != gc && NULL != segments); - bd_uid = (guint32)memo_request->bd_uid; - - - for (index = 0; index < QQ_MEMO_SIZE; index++) { - utf8_str = purple_request_fields_get_string(fields, memo_id[index]); - /* update alias */ - if (QQ_MEMO_ALIAS == index) { - update_buddy_memo(gc, bd_uid, segments[QQ_MEMO_ALIAS]); - } - if (NULL == utf8_str) { - value = g_strdup(""); - } - else { - value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT); - /* Warnning: value will be string "(NULL)" instead of NULL */ - if (!qq_strcmp("(NULL)", value)) { - value = g_strdup(""); - } - } - g_free(segments[index]); - segments[index] = value; - } - - memo_debug(segments); - /* send segments */ - request_change_memo(gc, bd_uid, segments); - - /* free segments */ - memo_free(segments); - g_free(memo_request); -} - -/* memo modify dialogue */ -static void memo_modify_dialogue(PurpleConnection *gc, guint32 bd_uid, gchar **segments, guint32 action) -{ - modify_memo_request *memo_request; - PurpleRequestField *field; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - int index; - gchar *utf8_title; - gchar *utf8_primary; - - g_return_if_fail(NULL != gc && NULL != segments); - - switch (action) { - case QQ_BUDDY_MEMO_GET: - memo_free(segments); - break; - case QQ_BUDDY_MEMO_MODIFY: - /* keep one dialog once a time */ - purple_request_close_with_handle(gc); - /* show dialog */ - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - for(index = 0; index < QQ_MEMO_SIZE; index++) { - /* - purple_debug_info("QQ", "id:%s txt:%s segment:%s\n", - memo_id[index], memo_txt[index], segments[index]); - */ - field = purple_request_field_string_new(memo_id[index], memo_txt[index], - segments[index], FALSE); - purple_request_field_group_add_field(group, field); - } - - /* for upload cb */ - memo_request = g_new0(modify_memo_request, 1); - memo_request->gc = gc; - memo_request->bd_uid = bd_uid; - memo_request->segments = segments; - /* callback */ - utf8_title = g_strdup(_("Buddy Memo")); - utf8_primary = g_strdup(_("Change his/her memo as you like")); - - purple_request_fields(gc, utf8_title, utf8_primary, NULL, - fields, - _("_Modify"), G_CALLBACK(memo_modify_ok_cb), - _("_Cancel"), G_CALLBACK(memo_modify_cancle_cb), - purple_connection_get_account(gc), NULL, NULL, - memo_request); - - g_free(utf8_title); - g_free(utf8_primary); - break; - default: - purple_debug_info("QQ", "Error...unknown memo action, please tell us\n"); - break; - } -} - -static void qq_create_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 action) -{ - gchar **segments; - gint index; - g_return_if_fail(NULL != gc); - - segments = g_new0(gchar*, QQ_MEMO_SIZE); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - segments[index] = g_strdup("");; - } - memo_modify_dialogue(gc, bd_uid, segments, action); -} - -/* process reply to get_memo packet */ -void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, - guint32 update_class, guint32 action) -{ - gchar **segments; - gint bytes; - gint index; - guint8 rcv_cmd; - guint32 rcv_uid; - guint8 unk1_8; - guint8 is_success; - - g_return_if_fail(NULL != gc && NULL != data && 0 != data_len); - /* - qq_show_packet("MEMO REACH", data, data_len); - */ - purple_debug_info("QQ", "action=0x%02X\n", action); - - bytes = 0; - - /* TX looks a bit clever than before... :) */ - bytes += qq_get8(&rcv_cmd, data+bytes); - purple_debug_info("QQ", "rcv_cmd=0x%02X\n", rcv_cmd); - - /* it's possible that packet contains no buddy uid and no memo!!! - * go to next step according to previous action sent */ - if (1 == data_len) { /* only one byte */ - purple_debug_info("QQ", "memo packet contains no buddy uid and memo...\n"); - if (QQ_BUDDY_MEMO_MODIFY == action) { - qq_create_buddy_memo(gc, (guint32)update_class, QQ_BUDDY_MEMO_MODIFY); - return; - } - return; - } - - switch (rcv_cmd) { - case QQ_BUDDY_MEMO_MODIFY: - case QQ_BUDDY_MEMO_REMOVE: - bytes += qq_get8(&is_success, data+bytes); - if (QQ_BUDDY_MEMO_REQUEST_SUCCESS == is_success) { - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, - _("Memo Modify"), _("Server says:"), - _("Your request was accepted."), - NULL, NULL); - purple_debug_info("QQ", "memo change succeessfully!\n"); - } - else { - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, - _("Memo Modify"), _("Server says:"), - _("Your request was rejected."), - NULL, NULL); - purple_debug_info("QQ", "memo change failed\n"); - } - break; - case QQ_BUDDY_MEMO_GET: - bytes += qq_get32(&rcv_uid, data+bytes); - purple_debug_info("QQ", "rcv_uid=%u\n", rcv_uid); - bytes += qq_get8(&unk1_8, data+bytes); - purple_debug_info("QQ", "unk1_8=0x%02X\n", unk1_8); - segments = g_new0(gchar*, QQ_MEMO_SIZE); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - /* get utf8 string */ - bytes += qq_get_vstr(&segments[index], QQ_CHARSET_DEFAULT, data+bytes); - /* - purple_debug_info("QQ", "bytes:%d, seg:%s\n", bytes, segments[index]); - */ - } - - /* common action, update buddy memo */ - update_buddy_memo(gc, rcv_uid, segments[QQ_MEMO_ALIAS]); - - /* memo is thing that we regard our buddy as, so we need one more buddy_uid */ - memo_modify_dialogue(gc, rcv_uid, segments, action); - break; - default: - purple_debug_info("QQ", "received an UNKNOWN memo cmd!!!\n"); - break; - } -} - -/* request buddy memo */ -void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action) -{ - guint8 raw_data[16] = {0}; - gint bytes; - - purple_debug_info("QQ", "qq_request_buddy_memo, buddy uid=%u, update_class=%u\n", - bd_uid, update_class); - g_return_if_fail(NULL != gc); - /* '0' is ok - g_return_if_fail(uid != 0); - */ - bytes = 0; - bytes += qq_put8(raw_data+bytes, QQ_BUDDY_MEMO_GET); - bytes += qq_put32(raw_data+bytes, bd_uid); - /* - qq_show_packet("MEMO REQUEST", raw_data, bytes); - */ - - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_MEMO, (guint8*)raw_data, bytes, update_class, action); -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_memo.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file buddy_memo.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_MEMO_H_ -#define _QQ_BUDDY_MEMO_H_ - -#include -#include "connection.h" -#include "blist.h" - -#define QQ_BUDDY_MEMO_REQUEST_SUCCESS 0x00 - -/* clan command for memo */ -enum -{ - QQ_BUDDY_MEMO_MODIFY = 0x01, /* upload memo */ - QQ_BUDDY_MEMO_REMOVE, /* remove memo */ - QQ_BUDDY_MEMO_GET /* get memo */ -}; - - -void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, guint32 update_class, guint32 action); - -void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action); - -#endif - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1304 +0,0 @@ -/** - * @file buddy_opt.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "request.h" -#include "privacy.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "char_conv.h" -#include "qq_define.h" -#include "im.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "utils.h" - -#define PURPLE_GROUP_QQ_FORMAT "QQ (%s)" - -#define QQ_REMOVE_SELF_REPLY_OK 0x00 - -enum { - QQ_MY_AUTH_APPROVE = 0x30, /* ASCII value of "0" */ - QQ_MY_AUTH_REJECT = 0x31, /* ASCII value of "1" */ - QQ_MY_AUTH_REQUEST = 0x32 /* ASCII value of "2" */ -}; - -typedef struct _qq_buddy_req { - PurpleConnection *gc; - guint32 uid; - guint8 *auth; - guint8 auth_len; -} qq_buddy_req; - -void add_buddy_authorize_input(PurpleConnection *gc, guint32 uid, - guint8 *auth, guint8 auth_len); - -static void buddy_req_free(qq_buddy_req *add_req) -{ - g_return_if_fail(add_req != NULL); - if (add_req->auth) g_free(add_req->auth); - g_free(add_req); -} - -static void buddy_req_cancel_cb(qq_buddy_req *add_req, const gchar *msg) -{ - g_return_if_fail(add_req != NULL); - buddy_req_free(add_req); -} - -PurpleGroup *qq_group_find_or_new(const gchar *group_name) -{ - PurpleGroup *g; - - g_return_val_if_fail(group_name != NULL, NULL); - - g = purple_find_group(group_name); - if (g == NULL) { - g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - purple_debug_warning("QQ", "Add new group: %s\n", group_name); - } - - return g; -} - -static qq_buddy_data *qq_buddy_data_new(guint32 uid) -{ - qq_buddy_data *bd = g_new0(qq_buddy_data, 1); - memset(bd, 0, sizeof(qq_buddy_data)); - bd->uid = uid; - bd->status = QQ_BUDDY_OFFLINE; - return bd; -} - -qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, guint32 uid) -{ - gchar *who; - PurpleBuddy *buddy; - qq_buddy_data *bd; - - g_return_val_if_fail(gc != NULL, NULL); - - who = uid_to_purple_name(uid); - if (who == NULL) return NULL; - buddy = purple_find_buddy(purple_connection_get_account(gc), who); - g_free(who); - - if (buddy == NULL) { - purple_debug_error("QQ", "Can not find purple buddy of %u\n", uid); - return NULL; - } - - if ((bd = purple_buddy_get_protocol_data(buddy)) == NULL) { - purple_debug_error("QQ", "Can not find buddy data of %u\n", uid); - return NULL; - } - return bd; -} - -void qq_buddy_data_free(qq_buddy_data *bd) -{ - g_return_if_fail(bd != NULL); - - if (bd->nickname) g_free(bd->nickname); - g_free(bd); -} - -/* create purple buddy without data and display with no-auth icon */ -PurpleBuddy *qq_buddy_new(PurpleConnection *gc, guint32 uid) -{ - PurpleBuddy *buddy; - PurpleGroup *group; - gchar *who; - gchar *group_name; - - g_return_val_if_fail(gc->account != NULL && uid != 0, NULL); - - group_name = g_strdup_printf(PURPLE_GROUP_QQ_FORMAT, - purple_account_get_username(gc->account)); - group = qq_group_find_or_new(group_name); - if (group == NULL) { - purple_debug_error("QQ", "Failed creating group %s\n", group_name); - return NULL; - } - - purple_debug_info("QQ", "Add new purple buddy: [%u]\n", uid); - who = uid_to_purple_name(uid); - buddy = purple_buddy_new(gc->account, who, NULL); /* alias is NULL */ - purple_buddy_set_protocol_data(buddy, NULL); - - g_free(who); - - purple_blist_add_buddy(buddy, NULL, group, NULL); - - g_free(group_name); - - return buddy; -} - -static void qq_buddy_free(PurpleBuddy *buddy) -{ - qq_buddy_data *bd; - - g_return_if_fail(buddy); - - if ((bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - qq_buddy_data_free(bd); - } - purple_buddy_set_protocol_data(buddy, NULL); - purple_blist_remove_buddy(buddy); -} - -PurpleBuddy *qq_buddy_find(PurpleConnection *gc, guint32 uid) -{ - PurpleBuddy *buddy; - gchar *who; - - g_return_val_if_fail(gc->account != NULL && uid != 0, NULL); - - who = uid_to_purple_name(uid); - buddy = purple_find_buddy(gc->account, who); - g_free(who); - return buddy; -} - -PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, guint32 uid) -{ - PurpleBuddy *buddy; - qq_buddy_data *bd; - - g_return_val_if_fail(gc->account != NULL && uid != 0, NULL); - - buddy = qq_buddy_find(gc, uid); - if (buddy == NULL) { - buddy = qq_buddy_new(gc, uid); - if (buddy == NULL) { - return NULL; - } - } - - if (purple_buddy_get_protocol_data(buddy) != NULL) { - return buddy; - } - - bd = qq_buddy_data_new(uid); - purple_buddy_set_protocol_data(buddy, bd); - return buddy; -} - -/* send packet to remove a buddy from my buddy list */ -static void request_remove_buddy(PurpleConnection *gc, guint32 uid) -{ - gchar uid_str[11]; - gint bytes; - - g_return_if_fail(uid > 0); - - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - bytes = strlen(uid_str); - qq_send_cmd_mess(gc, QQ_CMD_REMOVE_BUDDY, (guint8 *) uid_str, bytes, 0, uid); -} - -static void request_remove_buddy_ex(PurpleConnection *gc, - guint32 uid, guint8 *auth, guint8 auth_len) -{ - gint bytes; - guint8 *raw_data; - gchar uid_str[16]; - - g_return_if_fail(uid != 0); - g_return_if_fail(auth != NULL && auth_len > 0); - - raw_data = g_newa(guint8, auth_len + sizeof(uid_str) ); - bytes = 0; - bytes += qq_put8(raw_data + bytes, auth_len); - bytes += qq_putdata(raw_data + bytes, auth, auth_len); - - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - bytes += qq_putdata(raw_data + bytes, (guint8 *)uid_str, strlen(uid_str)); - - qq_send_cmd_mess(gc, QQ_CMD_REMOVE_BUDDY, raw_data, bytes, 0, uid); -} - -void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, guint32 uid) -{ - guint8 raw_data[16]; - gint bytes; - - g_return_if_fail(uid > 0); - bytes = 0; - bytes += qq_put8(raw_data + bytes, cmd); - bytes += qq_put16(raw_data + bytes, sub_cmd); - bytes += qq_put32(raw_data + bytes, uid); - - qq_send_cmd_mess(gc, QQ_CMD_AUTH_CODE, raw_data, bytes, 0, uid); -} - -void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gint bytes; - guint8 cmd, reply; - guint16 sub_cmd; - guint8 *code = NULL; - guint16 code_len = 0; - - g_return_if_fail(data != NULL && data_len != 0); - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - - qq_show_packet("qq_process_auth_code", data, data_len); - bytes = 0; - bytes += qq_get8(&cmd, data + bytes); - bytes += qq_get16(&sub_cmd, data + bytes); - bytes += qq_get8(&reply, data + bytes); - g_return_if_fail(bytes + 2 <= data_len); - - bytes += qq_get16(&code_len, data + bytes); - g_return_if_fail(code_len > 0); - g_return_if_fail(bytes + code_len <= data_len); - code = g_newa(guint8, code_len); - bytes += qq_getdata(code, code_len, data + bytes); - - if (cmd == QQ_AUTH_INFO_BUDDY && sub_cmd == QQ_AUTH_INFO_REMOVE_BUDDY) { - request_remove_buddy_ex(gc, uid, code, code_len); - return; - } - if (cmd == QQ_AUTH_INFO_BUDDY && sub_cmd == QQ_AUTH_INFO_ADD_BUDDY) { - add_buddy_authorize_input(gc, uid, code, code_len); - return; - } - purple_debug_info("QQ", "Got auth info cmd 0x%x, sub 0x%x, reply 0x%x\n", - cmd, sub_cmd, reply); -} - -static void add_buddy_question_cb(qq_buddy_req *add_req, const gchar *text) -{ - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - qq_request_question(add_req->gc, QQ_QUESTION_ANSWER, add_req->uid, NULL, text); - buddy_req_free(add_req); -} - -static void add_buddy_question_input(PurpleConnection *gc, guint32 uid, gchar *question) -{ - gchar *who, *msg; - qq_buddy_req *add_req; - g_return_if_fail(uid != 0); - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; - add_req->auth = NULL; - add_req->auth_len = 0; - - who = uid_to_purple_name(uid); - msg = g_strdup_printf(_("%u requires verification"), uid); - purple_request_input(gc, _("Add buddy question"), msg, - _("Enter answer here"), - NULL, - TRUE, FALSE, NULL, - _("Send"), G_CALLBACK(add_buddy_question_cb), - _("Cancel"), G_CALLBACK(buddy_req_cancel_cb), - purple_connection_get_account(gc), who, NULL, - add_req); - - g_free(msg); - g_free(who); -} - -void qq_request_question(PurpleConnection *gc, - guint8 cmd, guint32 uid, const gchar *question_utf8, const gchar *answer_utf8) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(uid > 0); - bytes = 0; - bytes += qq_put8(raw_data + bytes, cmd); - if (cmd == QQ_QUESTION_GET) { - bytes += qq_put8(raw_data + bytes, 0); - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; - } - if (cmd == QQ_QUESTION_SET) { - bytes += qq_put_vstr(raw_data + bytes, question_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put_vstr(raw_data + bytes, answer_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put8(raw_data + bytes, 0); - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; - } - /* Unknow 2 bytes, 0x(00 01) */ - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put8(raw_data + bytes, 0x01); - g_return_if_fail(uid != 0); - bytes += qq_put32(raw_data + bytes, uid); - if (cmd == QQ_QUESTION_REQUEST) { - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; - } - bytes += qq_put_vstr(raw_data + bytes, answer_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put8(raw_data + bytes, 0); - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; -} - -static void request_add_buddy_by_question(PurpleConnection *gc, guint32 uid, - guint8 *code, guint16 code_len) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes = 0; - - g_return_if_fail(uid != 0 && code_len > 0); - - bytes = 0; - bytes += qq_put8(raw_data + bytes, 0x10); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put16(raw_data + bytes, 0); - - bytes += qq_put8(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, 0); /* no auth code */ - - bytes += qq_put16(raw_data + bytes, code_len); - bytes += qq_putdata(raw_data + bytes, code, code_len); - - bytes += qq_put8(raw_data + bytes, 1); /* ALLOW ADD ME FLAG */ - bytes += qq_put8(raw_data + bytes, 0); /* group number? */ - qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes); -} - -void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gint bytes; - guint8 cmd, reply; - gchar *question, *answer; - guint16 code_len; - guint8 *code; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - qq_show_packet("qq_process_question", data, data_len); - bytes = 0; - bytes += qq_get8(&cmd, data + bytes); - if (cmd == QQ_QUESTION_GET) { - bytes += qq_get_vstr(&question, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&answer, QQ_CHARSET_DEFAULT, data + bytes); - purple_debug_info("QQ", "Get buddy adding Q&A:\n%s\n%s\n", question, answer); - g_free(question); - g_free(answer); - return; - } - if (cmd == QQ_QUESTION_SET) { - bytes += qq_get8(&reply, data + bytes); - if (reply == 0) { - purple_debug_info("QQ", "Successed setting Q&A\n"); - } else { - purple_debug_warning("QQ", "Failed setting Q&A, reply %d\n", reply); - } - return; - } - - g_return_if_fail(uid != 0); - bytes += 2; /* skip 2 bytes, 0x(00 01)*/ - if (cmd == QQ_QUESTION_REQUEST) { - bytes += qq_get8(&reply, data + bytes); - if (reply == 0x01) { - purple_debug_warning("QQ", "Failed getting question, reply %d\n", reply); - return; - } - bytes += qq_get_vstr(&question, QQ_CHARSET_DEFAULT, data + bytes); - purple_debug_info("QQ", "Get buddy question:\n%s\n", question); - add_buddy_question_input(gc, uid, question); - g_free(question); - return; - } - - if (cmd == QQ_QUESTION_ANSWER) { - bytes += qq_get8(&reply, data + bytes); - if (reply == 0x01) { - purple_notify_error(gc, _("Add Buddy"), _("Invalid answer."), NULL); - return; - } - bytes += qq_get16(&code_len, data + bytes); - g_return_if_fail(code_len > 0); - g_return_if_fail(bytes + code_len <= data_len); - - code = g_newa(guint8, code_len); - bytes += qq_getdata(code, code_len, data + bytes); - request_add_buddy_by_question(gc, uid, code, code_len); - return; - } - - g_return_if_reached(); -} - -/* try to remove myself from someone's buddy list */ -static void request_buddy_remove_me(PurpleConnection *gc, guint32 uid) -{ - guint8 raw_data[16] = {0}; - gint bytes = 0; - - g_return_if_fail(uid > 0); - - bytes += qq_put32(raw_data + bytes, uid); - - qq_send_cmd_mess(gc, QQ_CMD_REMOVE_ME, raw_data, bytes, 0, uid); -} - -/* try to add a buddy without authentication */ -static void request_add_buddy_no_auth(PurpleConnection *gc, guint32 uid) -{ - gchar uid_str[11]; - - g_return_if_fail(uid > 0); - - /* we need to send the ascii code of this uid to qq server */ - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - qq_send_cmd_mess(gc, QQ_CMD_ADD_BUDDY_NO_AUTH, - (guint8 *) uid_str, strlen(uid_str), 0, uid); -} - -static void request_add_buddy_no_auth_ex(PurpleConnection *gc, guint32 uid) -{ - guint bytes; - guint8 raw_data[16]; - - g_return_if_fail(uid != 0); - - bytes = 0; - bytes += qq_put32(raw_data + bytes, uid); - qq_send_cmd_mess(gc, QQ_CMD_ADD_BUDDY_NO_AUTH_EX, raw_data, bytes, 0, uid); -} - -/* this buddy needs authentication, text conversion is done at lowest level */ -static void request_add_buddy_auth(PurpleConnection *gc, guint32 uid, const gchar response, const gchar *text) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - gchar *msg, uid_str[11]; - guint8 bar; - - g_return_if_fail(uid != 0); - - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - bar = 0x1f; - - bytes = 0; - bytes += qq_putdata(raw_data + bytes, (guint8 *) uid_str, strlen(uid_str)); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_put8(raw_data + bytes, response); - - if (text != NULL) { - msg = utf8_to_qq(text, QQ_CHARSET_DEFAULT); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_putdata(raw_data + bytes, (guint8 *) msg, strlen(msg)); - g_free(msg); - } - - qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH, raw_data, bytes); -} - -static void request_add_buddy_auth_ex(PurpleConnection *gc, guint32 uid, - const gchar *text, guint8 *auth, guint8 auth_len) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes = 0; - - g_return_if_fail(uid != 0); - - bytes = 0; - bytes += qq_put8(raw_data + bytes, 0x02); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put16(raw_data + bytes, 0); - - bytes += qq_put8(raw_data + bytes, 0); - if (auth == NULL || auth_len <= 0) { - bytes += qq_put8(raw_data + bytes, 0); - } else { - bytes += qq_put8(raw_data + bytes, auth_len); - bytes += qq_putdata(raw_data + bytes, auth, auth_len); - } - bytes += qq_put8(raw_data + bytes, 1); /* ALLOW ADD ME FLAG */ - bytes += qq_put8(raw_data + bytes, 0); /* group number? */ - bytes += qq_put_vstr(raw_data + bytes, text, QQ_CHARSET_DEFAULT); - qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes); -} - -void qq_process_add_buddy_auth_ex(PurpleConnection *gc, guint8 *data, gint data_len, guint32 ship32) -{ - g_return_if_fail(data != NULL && data_len != 0); - - qq_show_packet("qq_process_question", data, data_len); -} - -static void add_buddy_auth_cb(qq_buddy_req *add_req, const gchar *text) -{ - qq_data *qd; - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - qd = (qq_data *)add_req->gc->proto_data; - if (qd->client_version > 2005) { - request_add_buddy_auth_ex(add_req->gc, add_req->uid, - text, add_req->auth, add_req->auth_len); - } else { - request_add_buddy_auth(add_req->gc, add_req->uid, QQ_MY_AUTH_REQUEST, text); - } - buddy_req_free(add_req); -} - -/* the real packet to reject and request is sent from here */ -static void buddy_add_deny_reason_cb(qq_buddy_req *add_req, const gchar *reason) -{ - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - request_add_buddy_auth(add_req->gc, add_req->uid, QQ_MY_AUTH_REJECT, reason); - buddy_req_free(add_req); -} - -static void buddy_add_deny_noreason_cb(qq_buddy_req *add_req) -{ - buddy_add_deny_reason_cb(add_req, NULL); -} - -/* we approve other's request of adding me as friend */ -static void buddy_add_authorize_cb(gpointer data) -{ - qq_buddy_req *add_req = (qq_buddy_req *)data; - - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - request_add_buddy_auth(add_req->gc, add_req->uid, QQ_MY_AUTH_APPROVE, NULL); - buddy_req_free(add_req); -} - -/* we reject other's request of adding me as friend */ -static void buddy_add_deny_cb(gpointer data) -{ - qq_buddy_req *add_req = (qq_buddy_req *)data; - gchar *who = uid_to_purple_name(add_req->uid); - purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), - NULL, _("Sorry, you're not my style."), TRUE, FALSE, NULL, - _("OK"), G_CALLBACK(buddy_add_deny_reason_cb), - _("Cancel"), G_CALLBACK(buddy_add_deny_noreason_cb), - purple_connection_get_account(add_req->gc), who, NULL, - add_req); - g_free(who); -} - -static void add_buddy_no_auth_cb(qq_buddy_req *add_req) -{ - qq_data *qd; - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - qd = (qq_data *) add_req->gc->proto_data; - if (qd->client_version > 2005) { - request_add_buddy_no_auth_ex(add_req->gc, add_req->uid); - } else { - request_add_buddy_no_auth(add_req->gc, add_req->uid); - } - buddy_req_free(add_req); -} - -void add_buddy_authorize_input(PurpleConnection *gc, guint32 uid, - guint8 *auth, guint8 auth_len) -{ - gchar *who, *msg; - qq_buddy_req *add_req; - g_return_if_fail(uid != 0); - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; - add_req->auth = NULL; - add_req->auth_len = 0; - if (auth != NULL && auth_len > 0) { - add_req->auth = g_new0(guint8, auth_len); - g_memmove(add_req->auth, auth, auth_len); - add_req->auth_len = auth_len; - } - - who = uid_to_purple_name(uid); - msg = g_strdup_printf(_("%u needs authorization"), uid); - purple_request_input(gc, _("Add buddy authorize"), msg, - _("Enter request here"), - _("Would you be my friend?"), - TRUE, FALSE, NULL, - _("Send"), G_CALLBACK(add_buddy_auth_cb), - _("Cancel"), G_CALLBACK(buddy_req_cancel_cb), - purple_connection_get_account(gc), who, NULL, - add_req); - - g_free(msg); - g_free(who); -} - -/* add a buddy and send packet to QQ server - * note that when purple load local cached buddy list into its blist - * it also calls this funtion, so we have to - * define qd->is_login=TRUE AFTER LOGIN */ -void qq_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - qq_data *qd; - guint32 uid; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - g_return_if_fail(buddy != NULL); - - qd = (qq_data *) gc->proto_data; - if (!qd->is_login) - return; /* IMPORTANT ! */ - - uid = purple_name_to_uid(purple_buddy_get_name(buddy)); - if (uid > 0) { - if (qd->client_version > 2005) { - request_add_buddy_no_auth_ex(gc, uid); - } else { - request_add_buddy_no_auth(gc, uid); - } - return; - } - - purple_notify_error(gc, _("QQ Buddy"), _("Add buddy"), _("Invalid QQ Number")); - if (buddy == NULL) { - return; - } - - purple_debug_info("QQ", "Remove buddy with invalid QQ number %u\n", uid); - qq_buddy_free(buddy); -} - -/* process reply to add_buddy_auth request */ -void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gchar **segments, *msg_utf8; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (data[0] == '0') { - purple_debug_info("QQ", "Reply OK for sending authorize\n"); - return; - } - - if (NULL == (segments = split_data(data, data_len, "\x1f", 2))) { - purple_notify_error(gc, _("QQ Buddy"), _("Failed sending authorize"), NULL); - return; - } - msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); - purple_notify_error(gc, _("QQ Buddy"), _("Failed sending authorize"), msg_utf8); - g_free(msg_utf8); -} - -/* process the server reply for my request to remove a buddy */ -void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - PurpleBuddy *buddy = NULL; - gchar *msg; - - g_return_if_fail(data != NULL && data_len != 0); - g_return_if_fail(uid != 0); - - buddy = qq_buddy_find(gc, uid); - if (data[0] != 0) { - msg = g_strdup_printf(_("Failed removing buddy %u"), uid); - purple_notify_info(gc, _("QQ Buddy"), msg, NULL); - g_free(msg); - } - - purple_debug_info("QQ", "Reply OK for removing buddy\n"); - /* remove buddy again */ - if (buddy != NULL) { - qq_buddy_free(buddy); - } -} - -/* process the server reply for my request to remove myself from a buddy */ -void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gchar *msg; - - g_return_if_fail(data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - - if (data[0] == 0) { - purple_debug_info("QQ", "Reply OK for removing me from %u's buddy list\n", uid); - return; - } - msg = g_strdup_printf(_("Failed removing me from %d's buddy list"), uid); - purple_notify_info(gc, _("QQ Buddy"), msg, NULL); - g_free(msg); -} - -void qq_process_add_buddy_no_auth(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gchar **segments; - gchar *dest_uid, *reply; - PurpleBuddy *buddy; - qq_buddy_data *bd; - - g_return_if_fail(data != NULL && data_len != 0); - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Process buddy add for id [%u]\n", uid); - qq_show_packet("buddy_add_no_auth", data, data_len); - - if (NULL == (segments = split_data(data, data_len, "\x1f", 2))) - return; - - dest_uid = segments[0]; - reply = segments[1]; - if (strtoul(dest_uid, NULL, 10) != qd->uid) { /* should not happen */ - purple_debug_error("QQ", "Add buddy reply is to [%s], not me!\n", dest_uid); - g_strfreev(segments); - return; - } - - if (strtol(reply, NULL, 10) == 0) { - /* add OK */ - qq_buddy_find_or_new(gc, uid); - - qq_request_buddy_info(gc, uid, 0, 0); - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - qq_request_get_buddies_online(gc, 0, 0); - - purple_debug_info("QQ", "Successed adding into %u's buddy list\n", uid); - g_strfreev(segments); - return; - } - - /* need auth */ - purple_debug_warning("QQ", "Failed adding buddy, need authorize\n"); - - buddy = qq_buddy_find(gc, uid); - if (buddy == NULL) { - buddy = qq_buddy_new(gc, uid); - } - if (buddy != NULL && (bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - /* Not authorized now, free buddy data */ - qq_buddy_data_free(bd); - purple_buddy_set_protocol_data(buddy, NULL); - } - - add_buddy_authorize_input(gc, uid, NULL, 0); - g_strfreev(segments); -} - -void qq_process_add_buddy_no_auth_ex(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gint bytes; - guint32 dest_uid; - guint8 reply; - guint8 auth_type; - - g_return_if_fail(data != NULL && data_len >= 5); - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Process buddy add no auth for id [%u]\n", uid); - qq_show_packet("buddy_add_no_auth_ex", data, data_len); - - bytes = 0; - bytes += qq_get32(&dest_uid, data + bytes); - bytes += qq_get8(&reply, data + bytes); - - g_return_if_fail(dest_uid == uid); - - if (reply == 0x99) { - purple_debug_info("QQ", "Successfully added buddy %u\n", uid); - qq_buddy_find_or_new(gc, uid); - - qq_request_buddy_info(gc, uid, 0, 0); - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - qq_request_get_buddies_online(gc, 0, 0); - return; - } - - if (reply != 0) { - purple_debug_info("QQ", "Failed adding buddy %u, Unknown reply 0x%02X\n", - uid, reply); - } - - /* need auth */ - g_return_if_fail(data_len > bytes); - bytes += qq_get8(&auth_type, data + bytes); - purple_debug_warning("QQ", "Adding buddy needs authorize 0x%02X\n", auth_type); - - switch (auth_type) { - case 0x00: /* no authorize */ - break; - case 0x01: /* authorize */ - qq_request_auth_code(gc, QQ_AUTH_INFO_BUDDY, QQ_AUTH_INFO_ADD_BUDDY, uid); - break; - case 0x02: /* disable */ - break; - case 0x03: /* answer question */ - qq_request_question(gc, QQ_QUESTION_REQUEST, uid, NULL, NULL); - break; - default: - g_return_if_reached(); - break; - } - return; -} - -/* remove a buddy and send packet to QQ server accordingly */ -void qq_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - qq_data *qd; - qq_buddy_data *bd; - guint32 uid; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - g_return_if_fail(buddy != NULL); - - qd = (qq_data *) gc->proto_data; - if (!qd->is_login) - return; - - uid = purple_name_to_uid(purple_buddy_get_name(buddy)); - if (uid > 0 && uid != qd->uid) { - if (qd->client_version > 2005) { - qq_request_auth_code(gc, QQ_AUTH_INFO_BUDDY, QQ_AUTH_INFO_REMOVE_BUDDY, uid); - } else { - request_remove_buddy(gc, uid); - request_buddy_remove_me(gc, uid); - } - } - - if ((bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - qq_buddy_data_free(bd); - purple_buddy_set_protocol_data(buddy, NULL); - } else { - purple_debug_warning("QQ", "Empty buddy data of %s\n", purple_buddy_get_name(buddy)); - } - - /* Do not call purple_blist_remove_buddy, - * otherwise purple segmentation fault */ -} - -static void buddy_add_input(PurpleConnection *gc, guint32 uid, gchar *reason) -{ - PurpleAccount *account = purple_connection_get_account(gc); - qq_buddy_req *add_req; - gchar *who; - - g_return_if_fail(uid != 0 && reason != NULL); - - purple_debug_info("QQ", "Buddy %u request adding, msg: %s\n", uid, reason); - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; - - if (purple_prefs_get_bool("/plugins/prpl/qq/auto_get_authorize_info")) { - qq_request_buddy_info(gc, add_req->uid, 0, QQ_BUDDY_INFO_DISPLAY); - } - who = uid_to_purple_name(add_req->uid); - - purple_account_request_authorization(account, - who, NULL, - NULL, reason, - purple_find_buddy(account, who) != NULL, - buddy_add_authorize_cb, - buddy_add_deny_cb, - add_req); - - g_free(who); -} - -/* someone wants to add you to his buddy list */ -static void server_buddy_add_request(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - guint32 uid; - gchar *msg, *reason; - - g_return_if_fail(from != NULL && to != NULL); - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid != 0); - - if (purple_prefs_get_bool("/plugins/prpl/qq/auto_get_authorize_info")) { - qq_request_buddy_info(gc, uid, 0, QQ_BUDDY_INFO_DISPLAY); - } - - if (data_len <= 0) { - reason = g_strdup( _("No reason given") ); - } else { - msg = g_strndup((gchar *)data, data_len); - reason = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - if (reason == NULL) reason = g_strdup( _("Unknown reason") ); - g_free(msg); - } - - buddy_add_input(gc, uid, reason); - g_free(reason); -} - -void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint8 cmd; - guint8 reply; - guint32 uid; - guint16 flag1, flag2; - - g_return_if_fail(data != NULL && data_len >= 5); - - qd = (qq_data *) gc->proto_data; - - qq_show_packet("buddy_check_code", data, data_len); - - bytes = 0; - bytes += qq_get8(&cmd, data + bytes); /* 0x03 */ - bytes += qq_get8(&reply, data + bytes); - - if (reply == 0) { - purple_debug_info("QQ", "Failed checking code\n"); - return; - } - - bytes += qq_get32(&uid, data + bytes); - g_return_if_fail(uid != 0); - bytes += qq_get16(&flag1, data + bytes); - bytes += qq_get16(&flag2, data + bytes); - purple_debug_info("QQ", "Check code reply Ok, uid %u, flag 0x%04X-0x%04X\n", - uid, flag1, flag2); - return; -} - -static void request_buddy_check_code(PurpleConnection *gc, - gchar *from, guint8 *code, gint code_len) -{ - guint8 *raw_data; - gint bytes; - guint32 uid; - - g_return_if_fail(code != NULL && code_len > 0 && from != NULL); - - uid = strtoul(from, NULL, 10); - raw_data = g_newa(guint8, code_len + 16); - bytes = 0; - bytes += qq_put8(raw_data + bytes, 0x03); - bytes += qq_put8(raw_data + bytes, 0x01); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put16(raw_data + bytes, code_len); - bytes += qq_putdata(raw_data + bytes, code, code_len); - - qq_send_cmd(gc, QQ_CMD_BUDDY_CHECK_CODE, raw_data, bytes); -} - -static gint server_buddy_check_code(PurpleConnection *gc, - gchar *from, guint8 *data, gint data_len) -{ - gint bytes; - guint16 code_len; - guint8 *code; - - g_return_val_if_fail(data != NULL && data_len > 0, 0); - - bytes = 0; - bytes += qq_get16(&code_len, data + bytes); - if (code_len <= 0) { - purple_debug_info("QQ", "Server msg for buddy has no code\n"); - return bytes; - } - if (bytes + code_len < data_len) { - purple_debug_error("QQ", "Code len error in server msg for buddy\n"); - qq_show_packet("server_buddy_check_code", data, data_len); - code_len = data_len - bytes; - } - code = g_newa(guint8, code_len); - bytes += qq_getdata(code, code_len, data + bytes); - - request_buddy_check_code(gc, from, code, code_len); - return bytes; -} - -static void server_buddy_add_request_ex(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - gint bytes; - guint32 uid; - gchar *msg; - guint8 allow_reverse; - - g_return_if_fail(from != NULL && to != NULL); - g_return_if_fail(data != NULL && data_len >= 3); - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid != 0); - - /* qq_show_packet("server_buddy_add_request_ex", data, data_len); */ - - bytes = 0; - bytes += qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data+bytes); - bytes += qq_get8(&allow_reverse, data + bytes); /* allow_reverse = 0x01, allowed */ - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); - - if (strlen(msg) <= 0) { - g_free(msg); - msg = g_strdup( _("No reason given") ); - } - buddy_add_input(gc, uid, msg); - g_free(msg); -} - -/* when you are added by a person, QQ server will send sys message */ -static void server_buddy_added(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - PurpleAccount *account = purple_connection_get_account(gc); - PurpleBuddy *buddy; - guint32 uid; - qq_buddy_req *add_req; - gchar *who; - gchar *primary; - - g_return_if_fail(from != NULL && to != NULL); - - uid = strtoul(from, NULL, 10); - who = uid_to_purple_name(uid); - - buddy = purple_find_buddy(account, who); - if (buddy != NULL) { - purple_account_notify_added(account, from, to, NULL, NULL); - } - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; /* only need to get value */ - primary = g_strdup_printf(_("You have been added by %s"), from); - purple_request_action(gc, NULL, primary, - _("Would you like to add him?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), who, NULL, - add_req, 2, - _("Add"), G_CALLBACK(add_buddy_no_auth_cb), - _("Cancel"), G_CALLBACK(buddy_req_cancel_cb)); - - g_free(who); - g_free(primary); -} - -static void server_buddy_added_ex(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - gint bytes; - guint8 allow_reverse; - gchar *msg; - - g_return_if_fail(from != NULL && to != NULL); - g_return_if_fail(data != NULL && data_len >= 3); - - qq_show_packet("server_buddy_added_ex", data, data_len); - - bytes = 0; - bytes += qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data+bytes); /* always empty msg */ - purple_debug_info("QQ", "Buddy added msg: %s\n", msg); - bytes += qq_get8(&allow_reverse, data + bytes); /* allow_reverse = 0x01, allowed */ - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); - - g_free(msg); -} - -static void server_buddy_adding_ex(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - gint bytes; - guint8 allow_reverse; - - g_return_if_fail(from != NULL && to != NULL); - g_return_if_fail(data != NULL && data_len >= 3); - - qq_show_packet("server_buddy_adding_ex", data, data_len); - - bytes = 0; - bytes += qq_get8(&allow_reverse, data + bytes); /* allow_reverse = 0x01, allowed */ - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); -} - -/* the buddy approves your request of adding him/her as your friend */ -static void server_buddy_added_me(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - PurpleAccount *account = purple_connection_get_account(gc); - qq_data *qd; - guint32 uid; - - g_return_if_fail(from != NULL && to != NULL); - - qd = (qq_data *) gc->proto_data; - - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid > 0); - - server_buddy_check_code(gc, from, data, data_len); - - qq_buddy_find_or_new(gc, uid); - qq_request_buddy_info(gc, uid, 0, 0); - qq_request_get_buddies_online(gc, 0, 0); - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - - purple_account_notify_added(account, to, from, NULL, NULL); -} - -/* you are rejected by the person */ -static void server_buddy_rejected_me(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - guint32 uid; - PurpleBuddy *buddy; - gchar *msg, *msg_utf8; - gint bytes; - gchar **segments; - gchar *primary, *secondary; - qq_buddy_data *bd; - - g_return_if_fail(from != NULL && to != NULL); - - qq_show_packet("server_buddy_rejected_me", data, data_len); - - if (data_len <= 0) { - msg = g_strdup( _("No reason given") ); - } else { - segments = g_strsplit((gchar *)data, "\x1f", 1); - if (segments != NULL && segments[0] != NULL) { - msg = g_strdup(segments[0]); - g_strfreev(segments); - bytes = strlen(msg) + 1; - if (bytes < data_len) { - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); - } - } else { - msg = g_strdup( _("No reason given") ); - } - } - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - if (msg_utf8 == NULL) { - msg_utf8 = g_strdup( _("Unknown reason") ); - } - g_free(msg); - - primary = g_strdup_printf(_("Rejected by %s"), from); - secondary = g_strdup_printf(_("Message: %s"), msg_utf8); - - purple_notify_info(gc, _("QQ Buddy"), primary, secondary); - - g_free(msg_utf8); - g_free(primary); - g_free(secondary); - - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid != 0); - - buddy = qq_buddy_find(gc, uid); - if (buddy != NULL && (bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - /* Not authorized now, free buddy data */ - qq_buddy_data_free(bd); - purple_buddy_set_protocol_data(buddy, NULL); - } -} - -void qq_process_buddy_from_server(PurpleConnection *gc, int funct, - gchar *from, gchar *to, guint8 *data, gint data_len) -{ - switch (funct) { - case QQ_SERVER_BUDDY_ADDED: - server_buddy_added(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADD_REQUEST: - server_buddy_add_request(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADD_REQUEST_EX: - server_buddy_add_request_ex(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADDED_ME: - server_buddy_added_me(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_REJECTED_ME: - server_buddy_rejected_me(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADDED_EX: - server_buddy_added_ex(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADDING_EX: - case QQ_SERVER_BUDDY_ADDED_ANSWER: - server_buddy_adding_ex(gc, from, to, data, data_len); - break; - default: - purple_debug_warning("QQ", "Unknow buddy operate (%d) from server\n", funct); - break; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/buddy_opt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/** - * @file buddy_opt.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_OPT_H_ -#define _QQ_BUDDY_OPT_H_ - -#include -#include "connection.h" - -#include "qq.h" - -enum { - QQ_AUTH_INFO_BUDDY = 0x01, - QQ_AUTH_INFO_ROOM = 0x02, - - QQ_AUTH_INFO_ADD_BUDDY = 0x0001, - QQ_AUTH_INFO_TEMP_SESSION = 0x0003, - QQ_AUTH_INFO_CLUSTER = 0x0002, - QQ_AUTH_INFO_REMOVE_BUDDY = 0x0006, - QQ_AUTH_INFO_UPDATE_BUDDY_INFO = 0x0007 -}; - -enum { - QQ_QUESTION_GET = 0x01, - QQ_QUESTION_SET = 0x02, - QQ_QUESTION_REQUEST = 0x03, /* get question only*/ - QQ_QUESTION_ANSWER = 0x04 -}; - -void qq_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void qq_change_buddys_group(PurpleConnection *gc, const char *who, - const char *old_group, const char *new_group); -void qq_remove_buddy_and_me(PurpleBlistNode * node); -void qq_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); - -void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); -void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); -void qq_process_add_buddy_no_auth(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid); -void qq_process_add_buddy_no_auth_ex(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid); -void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc); -void qq_process_buddy_from_server(PurpleConnection *gc, int funct, - gchar *from, gchar *to, guint8 *data, gint data_len); - -void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, guint32 uid); -void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); -void qq_request_question(PurpleConnection *gc, - guint8 cmd, guint32 uid, const gchar *question_utf8, const gchar *answer_utf8); -void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); - -void qq_process_add_buddy_auth_ex(PurpleConnection *gc, guint8 *data, gint data_len, guint32 ship32); - -qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, guint32 uid); -void qq_buddy_data_free(qq_buddy_data *bd); - -PurpleBuddy *qq_buddy_new(PurpleConnection *gc, guint32 uid); -PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, guint32 uid); -PurpleBuddy *qq_buddy_find(PurpleConnection *gc, guint32 uid); -PurpleGroup *qq_group_find_or_new(const gchar *group_name); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/ChangeLog qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/ChangeLog --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/ChangeLog 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/ChangeLog 1970-01-01 00:00:00.000000000 +0000 @@ -1,373 +0,0 @@ -2009.04.23 - flos - * Fixed a bug of updating buddy who is not in user's buddy list - -2009.02.25 - flos - * Changed text 'ZipCode' to 'Postal Code' - -2009.02.24 - flos - * NEVER forget our COPYRIGHT, ;) - -2009.02.24 - flos - * Changed update_class type from gint to guint32 - * Fixed a bug of displaying of memo when memo is nothing - -2009.02.21 - flos - * Added 'qq_strlen' and 'qq_strcmp' funtions in qq.h - * Fixed compiling problems with lower version of GTK+ - -2009.02.21 - flos - * Rewrite whole buddy memo part - * Remove 'qq_to_utf8_len' and 'utf8_to_qq_len' functions in char_conv.c - * Update ChangeLog, AUTHORS - -2009.02.09 - Chengming Wang - * Rewrite buddy_memo using qq_put/qq_get series functions - -2009.02.09 - Chengming Wang - * Added buddy 'get memo', 'remove memo', 'upload memo' functions - -2009.02.08 - flos - * Fixed showing message of chat room when message comes in - -2008.12.28 - flos - * Fixes #7908 - -2008.12.28 - flos - * References #7908 - -2008.12.25 - flos - * References #7821 - * Updated authors - -2008.12.17 - flos - * Minor fixed in buddy_info.c - -2008.12.06 - flos - * Removed version checking script in Makefiles since our developers all migrated to monotone - * Use our development revision as OPENQ_VERSION in qq.c - -2008.12.05 - flos - * Fixed a bug after propagating - -2008.11.18 - ccpaging - * Fixed: IM format suuport in IM and QUN IM - * Divide long IM message into segment and sending - * Divide long QUN IM message in to segment and sending - * Add some new function in im.c to put format when sending - * Add some new function in im.c to get format when receiving - * Need improvement: - Merge long IM message when receiving. Need a buffer to store segments of long IM message. - Send segment of long IM message one by one. Need a buffer to store segments of long IM message. - -2008.11.11 - ccpaging - * Change QQ number to unsigned long - * Change Qun ID and Qun extend ID to unsigned long - * Rewrite smiley convert function, use qsort and bsearch - * Update smiley map according EVA and pidgin theme file - * Support long IM message in private and Qun - -2008.10.27 - ccpaging - * Fixed a bug in group_join.c - -2008.10.30 - flos - * Fixed a bug which made xgettext failed in buddy_info.c - * Fixed a bug in Makefile.am and Makefile.mingw - * Updated acknowledgement in qq.c - -2008.10.28 - flos - * Updated AUTHORS - -2008.10.27 - ccpaging - * Fixed a bug in buddy_info.c - -2008.10.27 - ccpaging - * Update 'buddy_adding' protocol - -2008.10.22 - ccpaging - * 20081022 - -2008.10.20 - ccpaging - * Support incoming authorization of 'buddy_adding' protocol of QQ2007/2008 - -2008.10.14 - ccpaging - * 2007 remove buddy ok - * Removed group_search.c/h - -2008.10.10 - ccpaging - * Support part of 'buddy' protocol of QQ2007/2008 - -2008.10.10 - ccpaging - * Keep group_search.c/h for later use - * Update 'group' - -2008.10.09 - ccpaging - * 20081009-1 - -2008.10.09 - ccpaging - * Update 'group' protocol - * Functions of group_find, group_free, group_search merged into group_join and group_internal - * Removed group_find.c/h, group_free.c/h, group_search.c/h - -2008.10.08 - ccpaging - * Update 'group' protocol - -2008.10.08 - ccpaging - * 20081008-1 - -2008.10.08 - ccpaging - * Update group part - * Delete some meaningless functions and data - * Added 'change my icon' - -2008.10.08 - lonicerae - * Update Makefile.mingw - -2008.10.08 - ccpaging - * Fixed QQ_BUDDY_ICON_DIR problem - -2008.10.07 - lonicerae - * Update 'version display' - -2008.10.07 - lonicerae - * Added some defensive code for 'action' series functions of qq.c - -2008.10.07 - ccpaging - * Update buddy icon - -2008.10.07 - ccpaging - * Update qq_buddy - -2008.10.07 - ccpaging - * Update qun conversation - -2008.10.05 - lonicerae - * Bug fix in 'About OpenQ' dialog - -2008.10.05 - lonicerae - * Added 'About OpenQ' dialog - -2008.10.05 - ccpaging - * Add my uid into buddy list - * Fixed a minor bug in qq_create_buddy. Not get new buddy's info. - * There are 38 fields in protocol 2008, one more than 2005/2007. - * The packet of Modifing buddy info is changed. Need sample to fix it. - -2008.10.04 - ccpaging - * Update protocol for 2007 - * Code cleanup - -2008.10.04 - lonicerae - * fixed a bug in qq_base.c - -2008.10.03 - ccpaging - * 2007 protocol: - 1. fixed 'get room info' - 2. fixed 'get buddy level' - -2008.10.02 - ccpaging - * Added 'Captcha Display' function - * QQ2007 for openq, programed by Emil Alexiev: - 1. Most functions from patch written by Emil Alexiev merged into trunk, except 'buddy operations' - 2. 'online buddy status' and 'qun buddies' still have problems - * QQ2008 console client, programed by Shrimp: - 1. 'before login' and 'keep alive' parts merged into trunk - -2008.09.30 - ccpaging - * Successfully login using 2007/2008 protocols - -2008.09.29 - ccpaging - * 'Check Password' function for protocol 2007/2008 - -2008.09.28 - ccpaging - * The source is only for debug, not for user: - 1. Implement new QQ protocol 2007/2008, include login and change status - 2. Check 2005's login reply packet, get last 3 login time. - 3. Server's notice and news is displayed in self buddy (The new buddy created in buddy list). - 4. The notice messages when adding/removing QQ Qun's buddy displayed in char conversation. They are displayed as purple notify windows in the past. - 5. The notice messages when adding/removing buddy displayed in self buddy's conversation. They are displayed as purple notify windows in the past. - 6. Client version can be selected in account option. Now only qq2005 is working, other new version is only for debug. - -2008.09.26 - ccpaging - * Added 'Request/Add/Remove Buddy' functions - -2008.09.19 - ccpaging - * Rewrite buddy modify info, there is a ticket for this problem - * Use ship32 to trans action code between request packet and reply packet process - -2008.09.15 - csyfek - * im.pidgin.pidgin.openq branch - -2008.09.05 - ccpaging - * Filter chars 0x01-0x20 in nickname - -2008.09.05 - ccpaging - * Fixed compilation even pidgin-udp-patch not applied - * Place and analysis 'before login packet' after login. packages will be updated slowly and server may send lots of 'server command packet', while 'before login packet' is placed after 'finished update' - -2008.09.02 - ccpaging - * Bugfix: can not send message to the QUN blocked adding - * Tickets: - Fixes #6957 - -2008.09.02 - ccpaging - * Use new tactics of information update: - 1. send next package till the previous package received - 2. fix duplicated get_room_info and get_room_buddies commands - -2008.08.16 - ccpaging - * Rename group to room. If you used pidginqq before, this may create a new room with same title, you may delete old one - * Replace purple_debug with purple_debug_info, purple_debug_warning, purple_debug_error - * Add server notice and server new, and two options to turn on/off - * Minor modify for reducing transaction's debug infor - * Minor modifies for system notice and QQ news. - * Add 4 new strings need translate compare with p10. - * Tickets: - Fixes #6990 - -2008.08.10 - csyfek - * Commit to Pidgin - -2008.08.07 - ccpaging - * Support managing multi-connections according to simple.c - -2008.08.06 - ccpaging - * Rename names of variables, Group, to Room - * Functions of group_network merged into qq_network and qq_process - * Canceled managing glist of group packet, add sub_cmdd and room_id to transaction - * Fixed error of demo group: - If 'room list' and 'room infor' are not setup, response received from server will emits 'room_id = 0' packet. - -2008.08.04 - ccpaging - * Use new crypt/decrypt functions - * Rename crypt.c/h to qq_crypt.c/h - * Clean code of decrypt functions - * Fixed decryption failure - -2008.08.04 - csyfek - * Update AUTHORS - -2008.08.03 - csyfek - * Commit lost files to Pidgin - -2008.08.02 - csyfek - * Commit to Pidgin - * Tickets: - Fixes #1861 - Fixes #1902 - References #5112 - -2008.08.02 - ccpaging - * Store all keys and md5 values of qq_data in char[QQ_KEY_LENGTH] - * Use random value in inikey - * TEA header padding in crypt.c - * Rewrite login part of qq_process - -2008.07.31 - ccpaging - * Fixed: send reply when get duplicate server command. The server may not get our reply before. - * Tag custom picture as text "(Broken)" - -2008.07.30 - ccpaging , csyfek - * Change some debug message - * Modify buddy status flag according to eva for QQ2006 - * Modify buddy status parse and correspond to eva2 - * Add getIP/putIP functions to packet_parse.c, and replace some gen_ip_str - * Replace guint32 *ip with struct in_addr, and reduce g_new/g_free operation - * Source file changed: - Merge buddy_status into buddy_list - Change login_logout to qq_base - Merge keep_alive into qq_base - New qq_process extract from qq_network - * Fixed: Byte alignment bug in crypt.c, tested in ARM PDA - * Fixed: group chat message may get in before getting group info, and so group info is empty - * Add qq_send_cmd_group_get_group_info when joined a group chat in group_im.c - * Add some new group command identify according eva but further program - * Add some new QQ client version identify - * Fixed: Identify buddy's client version by IM packet, and not by status - * Add some new info in buddy's tooltip text - * Add video falg to buddy's emblem. But those flag in buddy status may not prasing correctly - * Use new timeout function to handle send keep_alive, resend packet, update buddy status - * Add new advanced options: - The end user may change interval of keep_alive, resend packet, update buddy status to feed their need. - For example, saving network flow when use mobile phone. - Keep alive packet must be sent in 60-120 seconds whatever client rcved data of not. - The intervals of keep alive and update status should be multiple of resend's interval, - Since we use counter not time() in a single timeout function for efficiency. - * Rewrite qq_trans.c, and use one g_list to manage: - Store server packet before login, and prase all of them when get login - Store client send packet for resend scanning, confirm server reply, filter duplicate server reply - Store server packet for filter out duplicate - * Add QQ_MSG_SYS_NOTICE = 0x06 in sys_msg.c - * Rewrite qq_proc_cmd_reply and qq_proc_cmd_server: - In QQ protocol, one packet reply may need a new packet send later. - We may call it packet trigger. The triggers always is hided in every qq_process_reply. - Now we try to extract those triggers and put into a single function, - and then every trigger should be obviously and easy to manage. - -2008.07.12 - ccpaging - * Fixed: Always lost connection. Now send keep alive packet in every 30 seconds - * Minor fix for debug information - * Filter \r\n and replace with SPCAE in group notive - * Fixed a memory leak - * Tickets: - * Fixes #4024. - -2008.06.29 - csyfek - * Minor bug fix - * Add some doxygen syntax for preparing development documentation - * References #6199 - -2008.06.28 - ccpaging , moo - * Patches from moo and ccpaging. - * Tickets: - * Fixes #4956. - * Fixes #2998. - -2008.06.07 - ccpaging , csyfek - * Clean code and apply patches from QuLogic - -2008.05.19 - ccpaging , csyfek - * Reconnect server 5 time in 5000 ms, when connect failed - * Rename sendqueue.c/sendqueue.h to qq_trans.c/qq_trans.h - * Rewrite packet_process - * Rewrite qq_send_cmd - * Create server list, try to connect every server when failed - -2008.05.14 - ccpaging - * Move function for before login packets storing to sendqueue - * Use transaction data structure to store before login packets - * Rewrite tcp_pending and packet_process in qq_network.c - -2008.05.09 - ccpaging - * Remove function _create_packet_head_seq in qq_network.c - * Create new function encap in qq_netowork.c - * Clean code of qq_send_packet_request_login_token and qq_send_packet_login in login_out.c - -2008.05.09 - ccpaging - * Clean code of packet_parse.c, enable PARSER_DEBUG - * Rewrite send_queue - -2008.05.08 - ccpaging - * Rewrite qq_network - * Add srv resolve function when qq_login - * Merge function _qq_common_clean in qq_proxy.c to qq_disconnect - * Move orignal qq_disconnect to qq_close - * qq_data alloc in qq_open and release in qq_close - * Network connect of QQ is created in qq_connect, and release in qq_disconnect - -2008.05.05 - ccpaging - * Merge function _qq_common_clean in qq_proxy.c to qq_disconnect - * Move orignal qq_disconnect to qq_close - * qq_data alloc in qq_open and release in qq_close - * Network connect of QQ is created in qq_connect, and release in qq_disconnect - -2008.05.05 - ccpaging - * Add qq_hex_dump function - -2008.04.25 - ccpaging , csyfek - * Rewrite read_packet and create_packet functions, use qq_put and qq_get functions instead - * New logic in accord with protocol models to handle packets, some related functions rewritten - -2008.03.24 - ccpaging - * Remove qq_crypt function in crypt.c, use qq_crypt and qq_decrypt directly - -** since pidgin-2.4.0 *** diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/** - * @file char_conv.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" - -#include "char_conv.h" -#include "packet_parse.h" -#include "utils.h" - -#define UTF8 "UTF-8" -#define QQ_CHARSET_ZH_CN "GB18030" -#define QQ_CHARSET_ENG "ISO-8859-1" - -#define QQ_NULL_MSG "(NULL)" /* return this if conversion fails */ - -/* convert a string from from_charset to to_charset, using g_convert */ -/* Warning: do not return NULL */ -static gchar *do_convert(const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset) -{ - GError *error = NULL; - gchar *ret; - gsize byte_read, byte_write; - - g_return_val_if_fail(str != NULL && to_charset != NULL && from_charset != NULL, g_strdup(QQ_NULL_MSG)); - - ret = g_convert(str, len, to_charset, from_charset, &byte_read, &byte_write, &error); - - if (error == NULL) { - return ret; /* convert is OK */ - } - - /* convert error */ - purple_debug_error("QQ_CONVERT", "%s\n", error->message); - qq_show_packet("Dump failed text", (guint8 *) str, (len == -1) ? strlen(str) : len); - - g_error_free(error); - return g_strdup(QQ_NULL_MSG); -} - -/* - * take the input as a pascal string and return a converted c-string in UTF-8 - * returns the number of bytes read, return -1 if fatal error - * the converted UTF-8 will be saved in ret - * Return: *ret != NULL - */ -gint qq_get_vstr(gchar **ret, const gchar *from_charset, guint8 *data) -{ - guint8 len; - - g_return_val_if_fail(data != NULL && from_charset != NULL, -1); - - len = data[0]; - if (len == 0) { - *ret = g_strdup(""); - return 1; - } - *ret = do_convert((gchar *) (data + 1), (gssize) len, UTF8, from_charset); - - return len + 1; -} - -gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset) -{ - gchar *str; - guint8 len; - - if (str_utf8 == NULL || (len = strlen(str_utf8)) == 0) { - buf[0] = 0; - return 1; - } - str = do_convert(str_utf8, -1, to_charset, UTF8); - len = strlen(str_utf8); - buf[0] = len; - if (len > 0) { - memcpy(buf + 1, str, len); - } - return 1 + len; -} - -/* Warning: do not return NULL */ -gchar *utf8_to_qq(const gchar *str, const gchar *to_charset) -{ - return do_convert(str, -1, to_charset, UTF8); -} - -/* Warning: do not return NULL */ -gchar *qq_to_utf8(const gchar *str, const gchar *from_charset) -{ - return do_convert(str, -1, UTF8, from_charset); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/char_conv.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/** - * @file char_conv.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_CHAR_CONV_H_ -#define _QQ_CHAR_CONV_H_ - -#include - -#define QQ_CHARSET_DEFAULT "GB18030" - -gint qq_get_vstr(gchar **ret, const gchar *from_charset, guint8 *data); -gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset); - -gchar *utf8_to_qq(const gchar *str, const gchar *to_charset); -gchar *qq_to_utf8(const gchar *str, const gchar *from_charset); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,825 +0,0 @@ -/** - * @file file_trans.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "ft.h" -#include "cipher.h" - -#include "qq_crypt.h" -#include "file_trans.h" -#include "qq_define.h" -#include "im.h" -#include "packet_parse.h" -#include "proxy.h" -#include "qq_network.h" -#include "send_file.h" -#include "utils.h" - -struct _qq_file_header { - guint16 client_ver; - guint8 file_key; - guint32 sender_uid; - guint32 receiver_uid; -}; - -typedef struct _qq_file_header qq_file_header; - -static guint32 _get_file_key(guint8 seed) -{ - guint32 key; - key = seed | (seed << 8) | (seed << 16) | (seed << 24); - return key; -} - -static guint32 _gen_file_key(void) -{ - guint8 seed; - - seed = rand() & 0xFF; - return _get_file_key(seed); -} - -static guint32 _decrypt_qq_uid(guint32 uid, guint32 key) -{ - return ~(uid ^ key); -} - -static guint32 _encrypt_qq_uid(guint32 uid, guint32 key) -{ - return (~uid) ^ key; -} - -static void _fill_file_md5(const gchar *filename, gint filelen, guint8 *md5) -{ - FILE *fp; - guint8 *buffer; - size_t wc; - - const gint QQ_MAX_FILE_MD5_LENGTH = 10002432; - - g_return_if_fail(filename != NULL && md5 != NULL); - if (filelen > QQ_MAX_FILE_MD5_LENGTH) - filelen = QQ_MAX_FILE_MD5_LENGTH; - - fp = fopen(filename, "rb"); - g_return_if_fail(fp != NULL); - - buffer = g_newa(guint8, filelen); - g_return_if_fail(buffer != NULL); - wc = fread(buffer, filelen, 1, fp); - fclose(fp); - if (wc != 1) { - purple_debug_error("qq", "Unable to read file: %s\n", filename); - - /* TODO: XXX: Really, the caller should be modified to deal with this properly. */ - return; - } - - qq_get_md5(md5, QQ_KEY_LENGTH, buffer, filelen); -} - -static gint _qq_get_file_header(qq_file_header *fh, guint8 *buf) -{ - gint bytes = 0; - bytes += qq_get16(&(fh->client_ver), buf + bytes); - bytes += qq_get8(&fh->file_key, buf + bytes); - bytes += qq_get32(&(fh->sender_uid), buf + bytes); - bytes += qq_get32(&(fh->receiver_uid), buf + bytes); - - fh->sender_uid = _decrypt_qq_uid(fh->sender_uid, _get_file_key(fh->file_key)); - fh->receiver_uid = _decrypt_qq_uid(fh->receiver_uid, _get_file_key(fh->file_key)); - return bytes; -} - -static const gchar *qq_get_file_cmd_desc(gint type) -{ - switch (type) { - case QQ_FILE_CMD_SENDER_SAY_HELLO: - return "QQ_FILE_CMD_SENDER_SAY_HELLO"; - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - return "QQ_FILE_CMD_SENDER_SAY_HELLO_ACK"; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - return "QQ_FILE_CMD_RECEIVER_SAY_HELLO"; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - return "QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK"; - case QQ_FILE_CMD_NOTIFY_IP_ACK: - return "QQ_FILE_CMD_NOTIFY_IP_ACK"; - case QQ_FILE_CMD_PING: - return "QQ_FILE_CMD_PING"; - case QQ_FILE_CMD_PONG: - return "QQ_FILE_CMD_PONG"; - case QQ_FILE_CMD_INITATIVE_CONNECT: - return "QQ_FILE_CMD_INITATIVE_CONNECT"; - case QQ_FILE_CMD_FILE_OP: - return "QQ_FILE_CMD_FILE_OP"; - case QQ_FILE_CMD_FILE_OP_ACK: - return "QQ_FILE_CMD_FILE_OP_ACK"; - case QQ_FILE_BASIC_INFO: - return "QQ_FILE_BASIC_INFO"; - case QQ_FILE_DATA_INFO: - return "QQ_FILE_DATA_INFO"; - case QQ_FILE_EOF: - return "QQ_FILE_EOF"; - default: - return "UNKNOWN_TYPE"; - } -} - -/* The memmap version has better performance for big files transfering - * but it will spend plenty of memory, so do not use it in a low-memory host */ -#ifdef USE_MMAP -#include - -static int _qq_xfer_open_file(const gchar *filename, const gchar *method, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - int fd; - if (method[0] == 'r') { - fd = open(purple_xfer_get_local_filename(xfer), O_RDONLY); - info->buffer = mmap(0, purple_xfer_get_size(xfer), PROT_READ, MAP_PRIVATE, fd, 0); - } - else - { - fd = open(purple_xfer_get_local_filename(xfer), O_RDWR|O_CREAT, 0644); - info->buffer = mmap(0, purple_xfer_get_size(xfer), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FILE, fd, 0); - } - - if (info->buffer == NULL) { - return - 1; - } - return 0; -} - -static gint _qq_xfer_read_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - gint readbytes; - - buffer = info->buffer + len * index; - readbytes = purple_xfer_get_size(xfer) - (buffer - info->buffer); - if (readbytes > info->fragment_len) readbytes = info->fragment_len; - return readbytes; -} - -static gint _qq_xfer_write_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - memcpy(info->buffer + index * len, buffer, len); - return 0; -} - -void qq_xfer_close_file(PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - if (info->buffer) munmap(info->buffer, purple_xfer_get_size(xfer)); -} -#else -static int _qq_xfer_open_file(const gchar *filename, const gchar *method, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - info->dest_fp = fopen(purple_xfer_get_local_filename(xfer), method); - if (info->dest_fp == NULL) { - return -1; - } - return 0; -} - -static gint _qq_xfer_read_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - fseek(info->dest_fp, index * len, SEEK_SET); - return fread(buffer, 1, len, info->dest_fp); -} - -static gint _qq_xfer_write_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - fseek(info->dest_fp, index * len, SEEK_SET); - return fwrite(buffer, 1, len, info->dest_fp); -} - -void qq_xfer_close_file(PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - if (info->dest_fp) fclose(info->dest_fp); -} -#endif - -static gint _qq_send_file(PurpleConnection *gc, guint8 *data, gint len, guint16 packet_type, guint32 to_uid) -{ - guint8 *raw_data; - gint bytes = 0; - guint32 file_key; - qq_data *qd; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - - info = (ft_info *) qd->xfer->data; - - raw_data = g_newa(guint8, MAX_PACKET_SIZE); - file_key = _gen_file_key(); - - bytes += qq_put8(raw_data + bytes, packet_type); - bytes += qq_put16(raw_data + bytes, qd->client_tag); - bytes += qq_put8(raw_data + bytes, file_key & 0xff); - bytes += qq_put32(raw_data + bytes, _encrypt_qq_uid(qd->uid, file_key)); - bytes += qq_put32(raw_data + bytes, _encrypt_qq_uid(to_uid, file_key)); - bytes += qq_putdata(raw_data + bytes, data, len); - - if (bytes == len + 12) { - _qq_xfer_write(raw_data, bytes, qd->xfer); - } else - purple_debug_info("QQ", "send_file: want %d but got %d\n", len + 12, bytes); - return bytes; -} - -/* send a file to udp channel with QQ_FILE_CONTROL_PACKET_TAG */ -void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte) -{ - qq_data *qd; - gint bytes, bytes_expected, encrypted_len; - guint8 *raw_data, *encrypted; - time_t now; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - info = (ft_info *) qd->xfer->data; - - raw_data = g_newa (guint8, 61); - bytes = 0; - - now = time(NULL); - - bytes += qq_putdata(raw_data + bytes, qd->session_md5, 16); - bytes += qq_put16(raw_data + bytes, packet_type); - switch (packet_type) { - case QQ_FILE_CMD_SENDER_SAY_HELLO: - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - case QQ_FILE_CMD_NOTIFY_IP_ACK: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - bytes += qq_put16(raw_data + bytes, info->send_seq); - break; - default: - bytes += qq_put16(raw_data + bytes, ++qd->send_seq); - } - bytes += qq_put32(raw_data + bytes, (guint32) now); - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put8(raw_data + bytes, qd->my_icon); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, 0x00); - /* 0x65: send a file, 0x6b: send a custom face */ - bytes += qq_put8(raw_data + bytes, QQ_FILE_TRANSFER_FILE); /* FIXME temp by gfhuang */ - switch (packet_type) - { - case QQ_FILE_CMD_SENDER_SAY_HELLO: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put8(raw_data + bytes, hellobyte); - bytes_expected = 48; - break; - case QQ_FILE_CMD_PING: - case QQ_FILE_CMD_PONG: - case QQ_FILE_CMD_NOTIFY_IP_ACK: - bytes += qq_fill_conn_info(raw_data, info); - bytes_expected = 61; - break; - default: - purple_debug_info("QQ", "qq_send_file_ctl_packet: Unknown packet type[%d]\n", - packet_type); - bytes_expected = 0; - } - - if (bytes != bytes_expected) { - purple_debug_error("QQ", "qq_send_file_ctl_packet: Expected to get %d bytes, but get %d\n", - bytes_expected, bytes); - return; - } - - qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", - raw_data, bytes, - "sending packet[%s]:", qq_get_file_cmd_desc(packet_type)); - - encrypted = g_newa(guint8, bytes + 17); - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, info->file_session_key); - /*debug: try to decrypt it */ - -#if 0 - guint8 *buf; - int buflen; - hex_dump = hex_dump_to_str(encrypted, encrypted_len); - purple_debug_info("QQ", "encrypted packet: \n%s\n", hex_dump); - g_free(hex_dump); - buf = g_newa(guint8, MAX_PACKET_SIZE); - buflen = encrypted_len; - if (qq_crypt(DECRYPT, encrypted, encrypted_len, info->file_session_key, buf, &buflen)) { - purple_debug_info("QQ", "decrypt success\n"); - if (buflen == bytes && memcmp(raw_data, buf, buflen) == 0) - purple_debug_info("QQ", "checksum ok\n"); - - hex_dump = hex_dump_to_str(buf, buflen); - purple_debug_info("QQ", "decrypted packet: \n%s\n", hex_dump); - g_free(hex_dump); - } else { - purple_debug_info("QQ", "decrypt fail\n"); - } -#endif - - purple_debug_info("QQ", "<== send %s packet\n", qq_get_file_cmd_desc(packet_type)); - _qq_send_file(gc, encrypted, encrypted_len, QQ_FILE_CONTROL_PACKET_TAG, info->to_uid); -} - -/* send a file to udp channel with QQ_FILE_DATA_PACKET_TAG */ -static void _qq_send_file_data_packet(PurpleConnection *gc, guint16 packet_type, guint8 sub_type, - guint32 fragment_index, guint16 seq, guint8 *data, gint len) -{ - guint8 *raw_data, filename_md5[QQ_KEY_LENGTH], file_md5[QQ_KEY_LENGTH]; - gint bytes; - guint32 fragment_size = 1000; - const char *filename; - gint filename_len, filesize; - qq_data *qd; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - info = (ft_info *) qd->xfer->data; - - filename = purple_xfer_get_filename(qd->xfer); - filesize = purple_xfer_get_size(qd->xfer); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE); - bytes = 0; - - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put16(raw_data + bytes, packet_type); - switch (packet_type) { - case QQ_FILE_BASIC_INFO: - case QQ_FILE_DATA_INFO: - case QQ_FILE_EOF: - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, 0x00); - break; - case QQ_FILE_CMD_FILE_OP: - switch(sub_type) - { - case QQ_FILE_BASIC_INFO: - filename_len = strlen(filename); - qq_get_md5(filename_md5, sizeof(filename_md5), (guint8 *)filename, filename_len); - _fill_file_md5(purple_xfer_get_local_filename(qd->xfer), - purple_xfer_get_size(qd->xfer), - file_md5); - - info->fragment_num = (filesize - 1) / QQ_FILE_FRAGMENT_MAXLEN + 1; - info->fragment_len = QQ_FILE_FRAGMENT_MAXLEN; - - purple_debug_info("QQ", - "start transfering data, %d fragments with %d length each\n", - info->fragment_num, info->fragment_len); - /* Unknown */ - bytes += qq_put16(raw_data + bytes, 0x0000); - /* Sub-operation type */ - bytes += qq_put8(raw_data + bytes, sub_type); - /* Length of file */ - bytes += qq_put32(raw_data + bytes, filesize); - /* Number of fragments */ - bytes += qq_put32(raw_data + bytes, info->fragment_num); - /* Length of a single fragment */ - bytes += qq_put32(raw_data + bytes, info->fragment_len); - bytes += qq_putdata(raw_data + bytes, file_md5, 16); - bytes += qq_putdata(raw_data + bytes, filename_md5, 16); - /* Length of filename */ - bytes += qq_put16(raw_data + bytes, filename_len); - /* 8 unknown bytes */ - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - /* filename */ - bytes += qq_putdata(raw_data + bytes, (guint8 *) filename, - filename_len); - break; - case QQ_FILE_DATA_INFO: - purple_debug_info("QQ", - "sending %dth fragment with length %d, offset %d\n", - fragment_index, len, (fragment_index-1)*fragment_size); - /* bytes += qq_put16(raw_data + bytes, ++(qd->send_seq)); */ - bytes += qq_put16(raw_data + bytes, info->send_seq); - bytes += qq_put8(raw_data + bytes, sub_type); - /* bytes += qq_put32(raw_data + bytes, fragment_index); */ - bytes += qq_put32(raw_data + bytes, fragment_index - 1); - bytes += qq_put32(raw_data + bytes, (fragment_index - 1) * fragment_size); - bytes += qq_put16(raw_data + bytes, len); - bytes += qq_putdata(raw_data + bytes, data, len); - break; - case QQ_FILE_EOF: - purple_debug_info("QQ", "end of sending data\n"); - /* bytes += qq_put16(raw_data + bytes, info->fragment_num + 1); */ - bytes += qq_put16(raw_data + bytes, info->fragment_num); - bytes += qq_put8(raw_data + bytes, sub_type); - /* purple_xfer_set_completed(qd->xfer, TRUE); */ - } - break; - case QQ_FILE_CMD_FILE_OP_ACK: - switch (sub_type) - { - case QQ_FILE_BASIC_INFO: - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, sub_type); - bytes += qq_put32(raw_data + bytes, 0x00000000); - break; - case QQ_FILE_DATA_INFO: - bytes += qq_put16(raw_data + bytes, seq); - bytes += qq_put8(raw_data + bytes, sub_type); - bytes += qq_put32(raw_data + bytes, fragment_index); - break; - case QQ_FILE_EOF: - bytes += qq_put16(raw_data + bytes, filesize / QQ_FILE_FRAGMENT_MAXLEN + 2); - bytes += qq_put8(raw_data + bytes, sub_type); - break; - } - } - purple_debug_info("QQ", "<== send %s packet\n", qq_get_file_cmd_desc(packet_type)); - _qq_send_file(gc, raw_data, bytes, QQ_FILE_DATA_PACKET_TAG, info->to_uid); -} - -/* A conversation starts like this: - * Sender ==> Receiver [QQ_FILE_CMD_PING] - * Sender <== Receiver [QQ_FILE_CMD_PONG] - * Sender ==> Receiver [QQ_FILE_CMD_SENDER_SAY_HELLO] - * Sender <== Receiver [QQ_FILE_CMD_SENDER_SAY_HELLO_ACK] - * Sender <== Receiver [QQ_FILE_CMD_RECEIVER_SAY_HELLO] - * Sender ==> Receiver [QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK] - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_BASIC_INFO] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_BASIC_INFO] - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_DATA_INFO] - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_DATA_INFO] - * ...... - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_EOF] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_EOF] - */ - - -static void _qq_process_recv_file_ctl_packet(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes ; - gint decryped_bytes; - qq_file_header fh; - guint8 *decrypted_data; - gint decrypted_len; - qq_data *qd = (qq_data *) gc->proto_data; - guint16 packet_type; - guint16 seq; - guint8 hellobyte; - ft_info *info = (ft_info *) qd->xfer->data; - - bytes = 0; - bytes += _qq_get_file_header(&fh, data + bytes); - - decrypted_data = g_newa(guint8, data_len); - decrypted_len = qq_decrypt(decrypted_data, data, data_len, qd->session_md5); - if ( decrypted_len <= 0 ) { - purple_debug_error("QQ", "Error decrypt rcv file ctrl packet\n"); - return; - } - - /* only for debug info */ - decryped_bytes = 16; /* skip md5 section */ - decryped_bytes += qq_get16(&packet_type, decrypted_data + decryped_bytes); - decryped_bytes += qq_get16(&seq, decrypted_data + decryped_bytes); - decryped_bytes += 4+1+1+19+1; /* skip something */ - - purple_debug_info("QQ", "==> [%d] receive %s packet\n", seq, qq_get_file_cmd_desc(packet_type)); - qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", - decrypted_data, decrypted_len, - "decrypted control packet received:"); - - switch (packet_type) { - case QQ_FILE_CMD_NOTIFY_IP_ACK: - decryped_bytes = 0; - qq_get_conn_info(info, decrypted_data + decryped_bytes); - /* qq_send_file_ctl_packet(gc, QQ_FILE_CMD_PING, fh->sender_uid, 0); */ - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_SENDER_SAY_HELLO, fh.sender_uid, 0); - break; - case QQ_FILE_CMD_SENDER_SAY_HELLO: - /* I'm receiver, if we receive SAY_HELLO from sender, we send back the ACK */ - decryped_bytes += 47; - decryped_bytes += qq_get8(&hellobyte, decrypted_data + decryped_bytes); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_SENDER_SAY_HELLO_ACK, fh.sender_uid, hellobyte); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_RECEIVER_SAY_HELLO, fh.sender_uid, 0); - break; - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - /* I'm sender, do nothing */ - break; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - /* I'm sender, ack the hello packet and send the first data */ - decryped_bytes += 47; - decryped_bytes += qq_get8(&hellobyte, decrypted_data + decryped_bytes); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK, fh.sender_uid, hellobyte); - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_BASIC_INFO, 0, 0, NULL, 0); - break; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - /* I'm receiver, do nothing */ - break; - case QQ_FILE_CMD_PING: - /* I'm receiver, ack the PING */ - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_PONG, fh.sender_uid, 0); - break; - case QQ_FILE_CMD_PONG: - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_SENDER_SAY_HELLO, fh.sender_uid, 0); - break; - default: - purple_debug_info("QQ", "unprocess file command %d\n", packet_type); - } -} - -static void _qq_recv_file_progess(PurpleConnection *gc, guint8 *buffer, guint16 len, guint32 index, guint32 offset) -{ - qq_data *qd = (qq_data *) gc->proto_data; - PurpleXfer *xfer = qd->xfer; - ft_info *info = (ft_info *) xfer->data; - guint32 mask; - - purple_debug_info("QQ", - "receiving %dth fragment with length %d, slide window status %o, max_fragment_index %d\n", - index, len, info->window, info->max_fragment_index); - if (info->window == 0 && info->max_fragment_index == 0) { - if (_qq_xfer_open_file(purple_xfer_get_local_filename(xfer), "wb", xfer) == -1) { - purple_xfer_cancel_local(xfer); - return; - } - purple_debug_info("QQ", "object file opened for writing\n"); - } - mask = 0x1 << (index % sizeof(info->window)); - if (index < info->max_fragment_index || (info->window & mask)) { - purple_debug_info("QQ", "duplicate %dth fragment, drop it!\n", index+1); - return; - } - - info->window |= mask; - - _qq_xfer_write_file(buffer, index, len, xfer); - - xfer->bytes_sent += len; - xfer->bytes_remaining -= len; - purple_xfer_update_progress(xfer); - - mask = 0x1 << (info->max_fragment_index % sizeof(info->window)); - while (info->window & mask) - { - info->window &= ~mask; - info->max_fragment_index ++; - if (mask & 0x8000) mask = 0x0001; - else mask = mask << 1; - } - purple_debug_info("QQ", "procceed %dth fragment, slide window status %o, max_fragment_index %d\n", - index, info->window, info->max_fragment_index); -} - -static void _qq_send_file_progess(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *) gc->proto_data; - PurpleXfer *xfer = qd->xfer; - ft_info *info = (ft_info *) xfer->data; - guint32 mask; - guint8 *buffer; - guint i; - gint readbytes; - - if (purple_xfer_get_bytes_remaining(xfer) <= 0) return; - if (info->window == 0 && info->max_fragment_index == 0) - { - if (_qq_xfer_open_file(purple_xfer_get_local_filename(xfer), "rb", xfer) == -1) { - purple_xfer_cancel_local(xfer); - return; - } - } - buffer = g_newa(guint8, info->fragment_len); - mask = 0x1 << (info->max_fragment_index % sizeof(info->window)); - for (i = 0; i < sizeof(info->window); i++) { - if ((info->window & mask) == 0) { - readbytes = _qq_xfer_read_file(buffer, info->max_fragment_index + i, info->fragment_len, xfer); - if (readbytes > 0) - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO, - info->max_fragment_index + i + 1, 0, buffer, readbytes); - } - if (mask & 0x8000) mask = 0x0001; - else mask = mask << 1; - } -} - -static void _qq_update_send_progess(PurpleConnection *gc, guint32 fragment_index) -{ - guint32 mask; - guint8 *buffer; - gint readbytes; - qq_data *qd = (qq_data *) gc->proto_data; - PurpleXfer *xfer = qd->xfer; - ft_info *info = (ft_info *) xfer->data; - - purple_debug_info("QQ", - "receiving %dth fragment ack, slide window status %o, max_fragment_index %d\n", - fragment_index, info->window, info->max_fragment_index); - if (fragment_index < info->max_fragment_index || - fragment_index >= info->max_fragment_index + sizeof(info->window)) { - purple_debug_info("QQ", "duplicate %dth fragment, drop it!\n", fragment_index+1); - return; - } - mask = 0x1 << (fragment_index % sizeof(info->window)); - if ((info->window & mask) == 0) - { - info->window |= mask; - if (fragment_index + 1 != info->fragment_num) { - xfer->bytes_sent += info->fragment_len; - } else { - xfer->bytes_sent += purple_xfer_get_size(xfer) % info->fragment_len; - } - xfer->bytes_remaining = purple_xfer_get_size(xfer) - purple_xfer_get_bytes_sent(xfer); - purple_xfer_update_progress(xfer); - if (purple_xfer_get_bytes_remaining(xfer) <= 0) { - /* We have finished sending the file */ - purple_xfer_set_completed(xfer, TRUE); - return; - } - mask = 0x1 << (info->max_fragment_index % sizeof(info->window)); - while (info->window & mask) - { - /* move the slide window */ - info->window &= ~mask; - - buffer = g_newa(guint8, info->fragment_len); - readbytes = _qq_xfer_read_file(buffer, info->max_fragment_index + sizeof(info->window), - info->fragment_len, xfer); - if (readbytes > 0) - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO, - info->max_fragment_index + sizeof(info->window) + 1, 0, buffer, readbytes); - - info->max_fragment_index ++; - if (mask & 0x8000) mask = 0x0001; - else mask = mask << 1; - } - } - purple_debug_info("QQ", - "procceed %dth fragment ack, slide window status %o, max_fragment_index %d\n", - fragment_index, info->window, info->max_fragment_index); -} - -static void _qq_process_recv_file_data(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes ; - qq_file_header fh; - guint16 packet_type; - guint16 packet_seq; - guint8 sub_type; - guint32 fragment_index; - guint16 fragment_len; - guint32 fragment_offset; - qq_data *qd = (qq_data *) gc->proto_data; - ft_info *info = (ft_info *) qd->xfer->data; - - bytes = 0; - bytes += _qq_get_file_header(&fh, data + bytes); - - bytes += 1; /* skip an unknown byte */ - bytes += qq_get16(&packet_type, data + bytes); - switch(packet_type) - { - case QQ_FILE_CMD_FILE_OP: - bytes += qq_get16(&packet_seq, data + bytes); - bytes += qq_get8(&sub_type, data + bytes); - switch (sub_type) - { - case QQ_FILE_BASIC_INFO: - bytes += 4; /* file length, we have already known it from xfer */ - bytes += qq_get32(&info->fragment_num, data + bytes); - bytes += qq_get32(&info->fragment_len, data + bytes); - - /* FIXME: We must check the md5 here, - * if md5 doesn't match we will ignore - * the packet or send sth as error number */ - - info->max_fragment_index = 0; - info->window = 0; - purple_debug_info("QQ", - "start receiving data, %d fragments with %d length each\n", - info->fragment_num, info->fragment_len); - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP_ACK, sub_type, - 0, 0, NULL, 0); - break; - case QQ_FILE_DATA_INFO: - bytes += qq_get32(&fragment_index, data + bytes); - bytes += qq_get32(&fragment_offset, data + bytes); - bytes += qq_get16(&fragment_len, data + bytes); - purple_debug_info("QQ", - "received %dth fragment with length %d, offset %d\n", - fragment_index, fragment_len, fragment_offset); - - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP_ACK, sub_type, - fragment_index, packet_seq, NULL, 0); - _qq_recv_file_progess(gc, data + bytes, fragment_len, fragment_index, fragment_offset); - break; - case QQ_FILE_EOF: - purple_debug_info("QQ", "end of receiving\n"); - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP_ACK, sub_type, - 0, 0, NULL, 0); - break; - } - break; - case QQ_FILE_CMD_FILE_OP_ACK: - bytes += qq_get16(&packet_seq, data + bytes); - bytes += qq_get8(&sub_type, data + bytes); - switch (sub_type) - { - case QQ_FILE_BASIC_INFO: - info->max_fragment_index = 0; - info->window = 0; - /* It is ready to send file data */ - _qq_send_file_progess(gc); - break; - case QQ_FILE_DATA_INFO: - bytes += qq_get32(&fragment_index, data + bytes); - _qq_update_send_progess(gc, fragment_index); - if (purple_xfer_is_completed(qd->xfer)) - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_EOF, 0, 0, NULL, 0); - /* else - _qq_send_file_progess(gc); */ - break; - case QQ_FILE_EOF: - /* FIXME: OK, we can end the connection successfully */ - - _qq_send_file_data_packet(gc, QQ_FILE_EOF, 0, 0, 0, NULL, 0); - purple_xfer_set_completed(qd->xfer, TRUE); - break; - } - break; - case QQ_FILE_EOF: - _qq_send_file_data_packet(gc, QQ_FILE_EOF, 0, 0, 0, NULL, 0); - purple_xfer_set_completed(qd->xfer, TRUE); - purple_xfer_end(qd->xfer); - break; - case QQ_FILE_BASIC_INFO: - purple_debug_info("QQ", "here\n"); - _qq_send_file_data_packet(gc, QQ_FILE_DATA_INFO, 0, 0, 0, NULL, 0); - break; - default: - purple_debug_info("QQ", "_qq_process_recv_file_data: unknown packet type [%d]\n", - packet_type); - break; - } -} - -void qq_process_recv_file(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes; - guint8 tag; - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&tag, data + bytes); - - switch (tag) { - case QQ_FILE_CONTROL_PACKET_TAG: - _qq_process_recv_file_ctl_packet(gc, data + bytes, len - bytes); - break; - case QQ_FILE_DATA_PACKET_TAG: - _qq_process_recv_file_data(gc, data + bytes, len - bytes); - break; - default: - purple_debug_info("QQ", "unknown packet tag\n"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/file_trans.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/** - * @file file_trans.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_QQ_FILE_TRANS_H_ -#define _QQ_QQ_FILE_TRANS_H_ - -#include "server.h" - -enum { - QQ_FILE_CMD_SENDER_SAY_HELLO = 0x31, - QQ_FILE_CMD_SENDER_SAY_HELLO_ACK = 0x32, - QQ_FILE_CMD_RECEIVER_SAY_HELLO = 0x33, - QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK = 0x34, - QQ_FILE_CMD_NOTIFY_IP_ACK = 0x3c, - QQ_FILE_CMD_PING = 0x3d, - QQ_FILE_CMD_PONG = 0x3e, - QQ_FILE_CMD_INITATIVE_CONNECT = 0x40 -}; - -enum { - QQ_FILE_TRANSFER_FILE = 0x65, - QQ_FILE_TRANSFER_FACE = 0x6b -}; - -enum { - QQ_FILE_BASIC_INFO = 0x01, - QQ_FILE_DATA_INFO = 0x02, - QQ_FILE_EOF = 0x03, - QQ_FILE_CMD_FILE_OP = 0x07, - QQ_FILE_CMD_FILE_OP_ACK = 0x08 -}; - -#define QQ_FILE_FRAGMENT_MAXLEN 1000 - -#define QQ_FILE_CONTROL_PACKET_TAG 0x00 -/* #define QQ_PACKET_TAG 0x02 */ /* all QQ text packets starts with it */ -#define QQ_FILE_DATA_PACKET_TAG 0x03 -#define QQ_FILE_AGENT_PACKET_TAG 0x04 -/* #define QQ_PACKET_TAIL 0x03 */ /* all QQ text packets end with it */ - -void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte); -void qq_process_recv_file(PurpleConnection *gc, guint8 *data, gint len); -/* void qq_send_file_data_packet(PurpleConnection *gc, guint16 packet_type, guint8 sub_type, guint32 fragment_index, guint16 seq, guint8 *data, gint len); */ -void qq_xfer_close_file(PurpleXfer *xfer); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/** - * @file group.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "prpl.h" -#include "request.h" - -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "utils.h" -#include "qq_network.h" -#include "qq_define.h" - -static void _qq_group_search_callback(PurpleConnection *gc, const gchar *input) -{ - guint32 ext_id; - - g_return_if_fail(input != NULL); - ext_id = strtoul(input, NULL, 10); - /* 0x00000000 means search for demo group */ - qq_request_room_search(gc, ext_id, QQ_ROOM_SEARCH_ONLY); -} - -static void _qq_group_search_cancel_callback(PurpleConnection *gc, const gchar *input) -{ - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - purple_roomlist_set_in_progress(qd->roomlist, FALSE); -} - -/* This is needed for PurpleChat node to be valid */ -GList *qq_chat_info(PurpleConnection *gc) -{ - GList *m; - struct proto_chat_entry *pce; - - m = NULL; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("ID: "); - pce->identifier = QQ_ROOM_KEY_EXTERNAL_ID; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *qq_chat_info_defaults(PurpleConnection *gc, const gchar *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, QQ_ROOM_KEY_EXTERNAL_ID, g_strdup(chat_name)); - - return defaults; -} - -/* get a list of qq groups */ -PurpleRoomlist *qq_roomlist_get_list(PurpleConnection *gc) -{ - GList *fields; - qq_data *qd; - PurpleRoomlist *rl; - PurpleRoomlistField *f; - - qd = (qq_data *) gc->proto_data; - - fields = NULL; - rl = purple_roomlist_new(purple_connection_get_account(gc)); - qd->roomlist = rl; - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Group ID"), QQ_ROOM_KEY_EXTERNAL_ID, FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", QQ_ROOM_KEY_INTERNAL_ID, TRUE); - fields = g_list_append(fields, f); - - fields = g_list_append(fields, f); - purple_roomlist_set_fields(rl, fields); - purple_roomlist_set_in_progress(qd->roomlist, TRUE); - - purple_request_input(gc, _("QQ Qun"), - _("Please enter Qun number"), - _("You can only search for permanent Qun\n"), - NULL, FALSE, FALSE, NULL, - _("Search"), G_CALLBACK(_qq_group_search_callback), - _("Cancel"), G_CALLBACK(_qq_group_search_cancel_callback), - purple_connection_get_account(gc), NULL, NULL, - gc); - - return qd->roomlist; -} - -/* free roomlist space, I have no idea when this one is called... */ -void qq_roomlist_cancel(PurpleRoomlist *list) -{ - qq_data *qd; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - gc = purple_account_get_connection(list->account); - - qd = (qq_data *) gc->proto_data; - purple_roomlist_set_in_progress(list, FALSE); - purple_roomlist_unref(list); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/** - * @file group.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_H_ -#define _QQ_GROUP_H_ - -#include -#include "account.h" -#include "connection.h" -#include "roomlist.h" -#include "qq.h" - -#define PURPLE_GROUP_QQ_QUN "QQ 群" - -typedef enum { - QQ_ROOM_ROLE_NO = 0x00, /* default 0x00 means not member */ - QQ_ROOM_ROLE_YES, - QQ_ROOM_ROLE_REQUESTING, - QQ_ROOM_ROLE_ADMIN -} qq_room_role; - -typedef struct _qq_room_data qq_room_data; -struct _qq_room_data { - /* all these will be saved when we exit Purple */ - qq_room_role my_role; /* my role for this room */ - guint32 id; - guint32 ext_id; - guint8 type8; /* permanent or temporory */ - guint32 creator_uid; - guint32 category; - guint8 auth_type; - gchar *title_utf8; - gchar *desc_utf8; - /* all these will be loaded from the network */ - gchar *notice_utf8; /* group notice by admin */ - - gboolean is_got_buddies; - GList *members; -}; - -GList *qq_chat_info(PurpleConnection *gc); -GHashTable *qq_chat_info_defaults(PurpleConnection *gc, const gchar *chat_name); - -PurpleRoomlist *qq_roomlist_get_list(PurpleConnection *gc); - -void qq_roomlist_cancel(PurpleRoomlist *list); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,442 +0,0 @@ -/** - * @file group_im.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "request.h" -#include "util.h" - -#include "char_conv.h" -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "group_im.h" -#include "group_opt.h" -#include "im.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_process.h" -#include "utils.h" - -/* show group conversation window */ -PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd) -{ - PurpleConversation *conv; - qq_data *qd; - gchar *topic_utf8; - - g_return_val_if_fail(rmd != NULL, NULL); - g_return_val_if_fail(rmd->title_utf8, NULL); - qd = (qq_data *) gc->proto_data; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - rmd->title_utf8, purple_connection_get_account(gc)); - if (conv != NULL) { - /* show only one conversation per room */ - return conv; - } - - serv_got_joined_chat(gc, rmd->id, rmd->title_utf8); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, rmd->title_utf8, purple_connection_get_account(gc)); - if (conv != NULL) { - if (rmd->notice_utf8 != NULL) { - topic_utf8 = g_strdup_printf("%u %s", rmd->ext_id, rmd->notice_utf8); - } else { - topic_utf8 = g_strdup_printf("%u", rmd->ext_id); - } - purple_debug_info("QQ", "Chat topic = %s\n", topic_utf8); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); - g_free(topic_utf8); - - if (rmd->is_got_buddies) - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_ONLINES, rmd->id); - else - qq_update_room(gc, 0, rmd->id); - return conv; - } - return NULL; -} - -/* refresh online member in group conversation window */ -void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd) -{ - GList *names, *list, *flags; - qq_buddy_data *bd; - gchar *member_name, *member_uid; - PurpleConversation *conv; - gint flag; - gboolean is_find; - - g_return_if_fail(rmd != NULL); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - rmd->title_utf8, purple_connection_get_account(gc)); - if (conv == NULL) { - purple_debug_warning("QQ", "Conversation \"%s\" is not opened\n", rmd->title_utf8); - return; - } - g_return_if_fail(rmd->members != NULL); - - names = NULL; - flags = NULL; - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - - /* we need unique identifiers for everyone in the chat or else we'll - * run into problems with functions like get_cb_real_name from qq.c */ - member_name = (bd->nickname != NULL && *(bd->nickname) != '\0') ? - g_strdup_printf("%s (%u)", bd->nickname, bd->uid) : - g_strdup_printf("(%u)", bd->uid); - member_uid = g_strdup_printf("(%u)", bd->uid); - - flag = 0; - /* TYPING to put online above OP and FOUNDER */ - if (is_online(bd->status)) flag |= (PURPLE_CBFLAGS_TYPING | PURPLE_CBFLAGS_VOICE); - if(1 == (bd->role & 1)) flag |= PURPLE_CBFLAGS_OP; - if(bd->uid == rmd->creator_uid) flag |= PURPLE_CBFLAGS_FOUNDER; - - is_find = TRUE; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), member_name)) - { - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), - member_name, - flag); - } else if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), member_uid)) - { - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), - member_uid, - flag); - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(conv), member_uid, member_name); - } else { - is_find = FALSE; - } - if (!is_find) { - /* always put it even offline */ - names = g_list_append(names, member_name); - flags = g_list_append(flags, GINT_TO_POINTER(flag)); - } else { - g_free(member_name); - } - g_free(member_uid); - list = list->next; - } - - if (names != NULL && flags != NULL) { - purple_conv_chat_add_users(PURPLE_CONV_CHAT(conv), names, NULL, flags, FALSE); - } - - /* clean up names */ - while (names != NULL) { - member_name = (gchar *) names->data; - names = g_list_remove(names, member_name); - g_free(member_name); - } - g_list_free(flags); -} - -void qq_room_got_chat_in(PurpleConnection *gc, - guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time) -{ - PurpleConversation *conv; - qq_data *qd; - qq_buddy_data *bd; - qq_room_data *rmd; - gchar *from; - - g_return_if_fail(gc != NULL && room_id != 0); - g_return_if_fail(msg != NULL); - - qd = (qq_data *)gc->proto_data; - conv = purple_find_chat(gc, room_id); - rmd = qq_room_data_find(gc, room_id); - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "is_show_chat:%d\n", qd->is_show_chat); - if (NULL == conv && qd->is_show_chat) { - conv = qq_room_conv_open(gc, rmd); - } - - if (NULL == conv) { - purple_debug_info("QQ", "Conversion of %u is not open, missing from %d:/n%s/v\n", - room_id, uid_from, msg); - return; - } - - if (uid_from != 0) { - - bd = qq_room_buddy_find(rmd, uid_from); - if (bd == NULL || bd->nickname == NULL) - from = g_strdup_printf("%u", uid_from); - else - from = g_strdup(bd->nickname); - } else { - from = g_strdup(""); - } - serv_got_chat_in(gc, room_id, from, 0, msg, in_time); - g_free(from); -} - -/* recv an IM from a group chat */ -void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type) -{ - qq_data *qd; - gchar *msg_smiley, *msg_fmt, *msg_utf8; - gint bytes, tail_len; - struct { - guint32 ext_id; - guint8 type8; - guint32 member_uid; - guint16 unknown; - guint16 msg_seq; - time_t send_time; - guint32 version; - guint16 msg_len; - gchar *msg; - } im_text; - guint32 temp_id; - guint16 content_type; - guint8 frag_count, frag_index; - guint16 msg_id; - qq_im_format *fmt = NULL; - - /* at least include im_text.msg_len */ - g_return_if_fail(data != NULL && data_len > 23); - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("ROOM_IM", data, data_len); */ - memset(&im_text, 0, sizeof(im_text)); - bytes = 0; - bytes += qq_get32(&(im_text.ext_id), data + bytes); - bytes += qq_get8(&(im_text.type8), data + bytes); - - if(QQ_MSG_TEMP_QUN_IM == msg_type) { - bytes += qq_get32(&temp_id, data + bytes); - } - - bytes += qq_get32(&(im_text.member_uid), bytes + data); - bytes += qq_get16(&im_text.unknown, data + bytes); /* 0x0001? */ - bytes += qq_get16(&(im_text.msg_seq), data + bytes); - bytes += qq_getime(&im_text.send_time, data + bytes); - bytes += qq_get32(&im_text.version, data + bytes); - bytes += qq_get16(&(im_text.msg_len), data + bytes); - purple_debug_info("QQ", "Room IM, ext id %u, seq %u, version 0x%04X, len %u\n", - im_text.ext_id, im_text.msg_seq, im_text.version, im_text.msg_len); - - if (im_text.msg_len != data_len - bytes) { - purple_debug_warning("QQ", "Room IM length %d should be %d\n", - im_text.msg_len, data_len - bytes); - im_text.msg_len = data_len - bytes; - } - - g_return_if_fail(im_text.msg_len > 0 && bytes + im_text.msg_len <= data_len); - if(msg_type != QQ_MSG_QUN_IM_UNKNOWN) { - g_return_if_fail(im_text.msg_len >= 10); - - bytes += qq_get16(&content_type, data + bytes); - bytes += qq_get8(&frag_count, data + bytes); - bytes += qq_get8(&frag_index, data + bytes); - bytes += qq_get16(&msg_id, data + bytes); - bytes += 4; /* skip 0x(00 00 00 00) */ - purple_debug_info("QQ", "Room IM, content %d, frag %d-%d, msg id %u\n", - content_type, frag_count, frag_index, msg_id); - im_text.msg_len -= 10; - } - g_return_if_fail(im_text.msg_len > 0); - - /* qq_show_packet("Message", data + bytes, data_len - bytes); */ - if (frag_count <= 1 || frag_count == frag_index + 1) { - fmt = qq_im_fmt_new(); - tail_len = qq_get_im_tail(fmt, data + bytes, data_len - bytes); - im_text.msg = g_strndup((gchar *)(data + bytes), data_len - tail_len); - } else { - im_text.msg = g_strndup((gchar *)(data + bytes), data_len - bytes); - } - - /* group im_group has no flag to indicate whether it has font_attr or not */ - msg_smiley = qq_emoticon_to_purple(im_text.msg); - if (fmt != NULL) { - msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); - msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); - g_free(msg_fmt); - qq_im_fmt_free(fmt); - } else { - msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); - } - g_free(msg_smiley); - - purple_debug_info("QQ", "Room (%u) IM from %u: %s\n", - im_text.ext_id, im_text.member_uid, msg_utf8); - qq_room_got_chat_in(gc, id, im_text.member_uid, msg_utf8, im_text.send_time); - - g_free(msg_utf8); - g_free(im_text.msg); -} - -/* send IM to a group */ -static void request_room_send_im(PurpleConnection *gc, guint32 room_id, qq_im_format *fmt, const gchar *msg) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(room_id != 0 && msg != NULL); - - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); - bytes += qq_put_im_tail(raw_data + bytes, fmt); - /* reset first two bytes */ - qq_put16(raw_data, bytes - 2); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM, room_id, raw_data, bytes); -} - -/* this is the ACK */ -void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len) -{ - /* return should be the internal group id - * but we have nothing to do with it */ - return; -} - -void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len) -{ - /* return should be the internal group id - * but we have nothing to do with it */ - return; -} - -#if 0 -static void request_room_send_im_ex(PurpleConnection *gc, guint32 room_id, - qq_im_format *fmt, gchar *msg, guint16 msg_id, guint8 frag_count, guint8 frag_index) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - - g_return_if_fail(room_id != 0 && msg != NULL); - - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); /* packet len */ - /* type 0x0001, text only; 0x0002, with custom emoticon */ - bytes += qq_put16(raw_data + bytes, 0x0001); - bytes += qq_put8(raw_data + bytes, frag_count); - bytes += qq_put8(raw_data + bytes, frag_index); - bytes += qq_put16(raw_data + bytes, msg_id); - bytes += qq_put32(raw_data + bytes, 0); /* unknow 4 bytes */ - bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); - if (frag_count == frag_index + 1) { - bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ - bytes += qq_put_im_tail(raw_data + bytes, fmt); - } - - /* reset first two bytes as length */ - qq_put16(raw_data, bytes - 2); - - /*qq_show_packet("QQ_ROOM_CMD_SEND_IM_EX", raw_data, bytes); */ - qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM_EX, room_id, raw_data, bytes); -} -#endif - -/* send a chat msg to a QQ Qun - * called by purple */ -int qq_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) -{ - qq_data *qd; - qq_im_format *fmt; - gchar *msg_stripped, *tmp; - GSList *segments, *it; - gint msg_len; - const gchar *start_invalid; - gboolean is_smiley_none; - guint8 frag_count, frag_index; - - g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1); - g_return_val_if_fail(id != 0 && what != NULL, -1); - - qd = (qq_data *) gc->proto_data; - purple_debug_info("QQ", "Send chat IM to %u, len %" G_GSIZE_FORMAT ":\n%s\n", id, strlen(what), what); - - /* qq_show_packet("chat IM UTF8", (guint8 *)what, strlen(what)); */ - - fmt = qq_im_fmt_new_by_purple(what); - is_smiley_none = qq_im_smiley_none(what); - - msg_stripped = purple_markup_strip_html(what); - g_return_val_if_fail(msg_stripped != NULL, -1); - /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ - - /* Check and valid utf8 string */ - msg_len = strlen(msg_stripped); - if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { - if (start_invalid > msg_stripped) { - tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); - g_free(msg_stripped); - msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); - g_free(tmp); - } else { - g_free(msg_stripped); - msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); - } - } - - is_smiley_none = qq_im_smiley_none(what); - segments = qq_im_get_segments(msg_stripped, is_smiley_none); - g_free(msg_stripped); - - if (segments == NULL) { - return -1; - } - - qd->send_im_id++; - fmt = qq_im_fmt_new_by_purple(what); - frag_count = g_slist_length(segments); - frag_index = 0; -/* - if (frag_count <= 1) { -*/ - for (it = segments; it; it = it->next) { - request_room_send_im(gc, id, fmt, (gchar *)it->data); - g_free(it->data); - } -/* - } else { - for (it = segments; it; it = it->next) { - request_room_send_im_ex(gc, id, fmt, (gchar *)it->data, - qd->send_im_id, frag_count, frag_index); - g_free(it->data); - frag_index++; - } - } -*/ - qq_im_fmt_free(fmt); - g_slist_free(segments); - return 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_im.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/** - * @file group_im.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_IM_H_ -#define _QQ_GROUP_IM_H_ - -#include -#include "connection.h" -#include "conversation.h" -#include "group.h" - -PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd); -void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd); - -void qq_room_got_chat_in(PurpleConnection *gc, - guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time); - -int qq_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); -void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len); -void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len); - -void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,392 +0,0 @@ -/** - * @file group_info.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" - -#include "char_conv.h" -#include "group_im.h" -#include "group_internal.h" -#include "group_info.h" -#include "buddy_list.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "utils.h" - -/* we check who needs to update member info every minutes - * this interval determines if their member info is outdated */ -#define QQ_GROUP_CHAT_REFRESH_NICKNAME_INTERNAL 180 - -static gboolean check_update_interval(qq_buddy_data *member) -{ - g_return_val_if_fail(member != NULL, FALSE); - return (member->nickname == NULL) || - (time(NULL) - member->last_update) > QQ_GROUP_CHAT_REFRESH_NICKNAME_INTERNAL; -} - -/* this is done when we receive the reply to get_online_members sub_cmd - * all member are set offline, and then only those in reply packets are online */ -static void set_all_offline(qq_room_data *rmd) -{ - GList *list; - qq_buddy_data *bd; - g_return_if_fail(rmd != NULL); - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - bd->status = QQ_BUDDY_CHANGE_TO_OFFLINE; - list = list->next; - } -} - -/* send packet to get info for each group member */ -gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class) -{ - guint8 *raw_data; - gint bytes, num; - GList *list; - qq_room_data *rmd; - qq_buddy_data *bd; - - g_return_val_if_fail(room_id > 0, 0); - - rmd = qq_room_data_find(gc, room_id); - g_return_val_if_fail(rmd != NULL, 0); - - for (num = 0, list = rmd->members; list != NULL; list = list->next) { - bd = (qq_buddy_data *) list->data; - if (check_update_interval(bd)) - num++; - } - - if (num <= 0) { - purple_debug_info("QQ", "No group member info needs to be updated now.\n"); - return 0; - } - - raw_data = g_newa(guint8, 4 * num); - - bytes = 0; - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (check_update_interval(bd)) - bytes += qq_put32(raw_data + bytes, bd->uid); - list = list->next; - } - - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_BUDDIES, rmd->id, raw_data, bytes, - update_class, 0); - return num; -} - -static gchar *get_role_desc(qq_room_role role) -{ - const char *role_desc; - switch (role) { - case QQ_ROOM_ROLE_NO: - role_desc = _("Not member"); - break; - case QQ_ROOM_ROLE_YES: - role_desc = _("Member"); - break; - case QQ_ROOM_ROLE_REQUESTING: - role_desc = _("Requesting"); - break; - case QQ_ROOM_ROLE_ADMIN: - role_desc = _("Admin"); - break; - default: - role_desc = _("Unknown"); - } - - return g_strdup(role_desc); -} - -static void room_info_display(PurpleConnection *gc, qq_room_data *rmd) -{ - PurpleNotifyUserInfo *room_info; - gchar *utf8_value; - - g_return_if_fail(rmd != NULL && rmd->id > 0); - - room_info = purple_notify_user_info_new(); - - purple_notify_user_info_add_pair(room_info, _("Title"), rmd->title_utf8); - purple_notify_user_info_add_pair(room_info, _("Notice"), rmd->notice_utf8); - purple_notify_user_info_add_pair(room_info, _("Detail"), rmd->desc_utf8); - - purple_notify_user_info_add_section_break(room_info); - - utf8_value = g_strdup_printf(("%u"), rmd->creator_uid); - purple_notify_user_info_add_pair(room_info, _("Creator"), utf8_value); - g_free(utf8_value); - - utf8_value = get_role_desc(rmd->my_role); - purple_notify_user_info_add_pair(room_info, _("About me"), utf8_value); - g_free(utf8_value); - - utf8_value = g_strdup_printf(("%d"), rmd->category); - purple_notify_user_info_add_pair(room_info, _("Category"), utf8_value); - g_free(utf8_value); - - utf8_value = g_strdup_printf(("%d"), rmd->auth_type); - purple_notify_user_info_add_pair(room_info, _("Authorize"), utf8_value); - g_free(utf8_value); - - utf8_value = g_strdup_printf(("%u"), rmd->ext_id); - purple_notify_userinfo(gc, utf8_value, room_info, NULL, NULL); - g_free(utf8_value); - - purple_notify_user_info_destroy(room_info); -} - -void qq_process_room_cmd_get_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc) -{ - qq_data *qd; - qq_room_data *rmd; - qq_buddy_data *bd; - PurpleChat *chat; - PurpleConversation *conv; - guint8 organization, role; - guint16 unknown, max_members; - guint32 member_uid, id, ext_id; - guint32 unknown4; - guint8 unknown1; - gint bytes, num; - gchar *notice; - gchar *topic_utf8; - - g_return_if_fail(data != NULL && data_len > 0); - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Room Info", data, data_len); */ - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - bytes += qq_get32(&ext_id, data + bytes); - g_return_if_fail(ext_id > 0); - - chat = qq_room_find_or_new(gc, id, ext_id); - g_return_if_fail(chat != NULL); - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - bytes += qq_get8(&(rmd->type8), data + bytes); - bytes += qq_get32(&unknown4, data + bytes); /* unknown 4 bytes */ - bytes += qq_get32(&(rmd->creator_uid), data + bytes); - bytes += qq_get8(&(rmd->auth_type), data + bytes); - bytes += qq_get32(&unknown4, data + bytes); /* oldCategory */ - bytes += qq_get16(&unknown, data + bytes); - bytes += qq_get32(&(rmd->category), data + bytes); - bytes += qq_get16(&max_members, data + bytes); - bytes += qq_get8(&unknown1, data + bytes); - /* the following, while Eva: - * 4(unk), 4(verID), 1(nameLen), nameLen(qunNameContent), 1(0x00), - * 2(qunNoticeLen), qunNoticeLen(qunNoticeContent, 1(qunDescLen), - * qunDestLen(qunDestcontent)) */ - bytes += qq_get8(&unknown1, data + bytes); - purple_debug_info("QQ", "type: %u creator: %u category: %u maxmembers: %u\n", - rmd->type8, rmd->creator_uid, rmd->category, max_members); - - if (qd->client_version >= 2007) { - /* skip 7 bytes unknow in qq2007 0x(00 00 01 00 00 00 fc)*/ - bytes += 7; - } - /* qq_show_packet("Room Info", data + bytes, data_len - bytes); */ - /* strlen + */ - bytes += qq_get_vstr(&(rmd->title_utf8), QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get16(&unknown, data + bytes); /* 0x0000 */ - bytes += qq_get_vstr(¬ice, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&(rmd->desc_utf8), QQ_CHARSET_DEFAULT, data + bytes); - - purple_debug_info("QQ", "room [%s] notice [%s] desc [%s] unknow 0x%04X\n", - rmd->title_utf8, notice, rmd->desc_utf8, unknown); - - num = 0; - /* now comes the member list separated by 0x00 */ - while (bytes < data_len) { - bytes += qq_get32(&member_uid, data + bytes); - num++; - bytes += qq_get8(&organization, data + bytes); - bytes += qq_get8(&role, data + bytes); - -#if 0 - if(organization != 0 || role != 0) { - purple_debug_info("QQ", "%u, organization=%d, role=%d\n", member_uid, organization, role); - } -#endif - - bd = qq_room_buddy_find_or_new(gc, rmd, member_uid); - if (bd != NULL) - bd->role = role; - } - if(bytes > data_len) { - purple_debug_error("QQ", - "group_cmd_get_group_info: Dangerous error! maybe protocol changed, notify me!"); - } - - purple_debug_info("QQ", "group \"%s\" has %d members\n", rmd->title_utf8, num); - - if (rmd->creator_uid == qd->uid) - rmd->my_role = QQ_ROOM_ROLE_ADMIN; - - /* filter \r\n in notice */ - qq_filter_str(notice); - rmd->notice_utf8 = strdup(notice); - g_free(notice); - - qq_room_update_chat_info(chat, rmd); - - if (action == QQ_ROOM_INFO_DISPLAY) { - room_info_display(gc, rmd); - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - rmd->title_utf8, purple_connection_get_account(gc)); - if(NULL == conv) { - purple_debug_warning("QQ", "Conversation \"%s\" is not opened\n", rmd->title_utf8); - return; - } - - topic_utf8 = g_strdup_printf("%u %s", rmd->ext_id, rmd->notice_utf8); - purple_debug_info("QQ", "Set chat topic to %s\n", topic_utf8); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); - g_free(topic_utf8); -} - -void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc) -{ - guint32 room_id, member_uid; - guint8 unknown; - gint bytes, num; - qq_room_data *rmd; - qq_buddy_data *bd; - - g_return_if_fail(data != NULL && len > 0); - - if (len <= 3) { - purple_debug_error("QQ", "Invalid group online member reply, discard it!\n"); - return; - } - - bytes = 0; - bytes += qq_get32(&room_id, data + bytes); - bytes += qq_get8(&unknown, data + bytes); /* 0x3c ?? */ - g_return_if_fail(room_id > 0); - - rmd = qq_room_data_find(gc, room_id); - if (rmd == NULL) { - purple_debug_error("QQ", "Can not info of room id [%u]\n", room_id); - return; - } - - /* set all offline first, then update those online */ - set_all_offline(rmd); - num = 0; - while (bytes < len) { - bytes += qq_get32(&member_uid, data + bytes); - num++; - bd = qq_room_buddy_find_or_new(gc, rmd, member_uid); - if (bd != NULL) - bd->status = QQ_BUDDY_ONLINE_NORMAL; - } - if(bytes > len) { - purple_debug_error("QQ", - "group_cmd_get_online_members: Dangerous error! maybe protocol changed, notify developers!"); - } - - purple_debug_info("QQ", "Group \"%s\" has %d online members\n", rmd->title_utf8, num); - qq_room_conv_set_onlines(gc, rmd); -} - -/* process the reply to get_members_info packet */ -void qq_process_room_cmd_get_buddies(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - gint num; - guint32 id, member_uid; - guint16 unknown; - qq_room_data *rmd; - qq_buddy_data *bd; - gchar *nick; - - g_return_if_fail(data != NULL && len > 0); - - /* qq_show_packet("qq_process_room_cmd_get_buddies", data, len); */ - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - num = 0; - /* now starts the member info, as get buddy list reply */ - while (bytes < len) { - bytes += qq_get32(&member_uid, data + bytes); - g_return_if_fail(member_uid > 0); - bd = qq_room_buddy_find_or_new(gc, rmd, member_uid); - g_return_if_fail(bd != NULL); - - num++; - bytes += qq_get16(&(bd->face), data + bytes); - bytes += qq_get8(&(bd->age), data + bytes); - bytes += qq_get8(&(bd->gender), data + bytes); - bytes += qq_get_vstr(&nick, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get16(&unknown, data + bytes); - bytes += qq_get8(&(bd->ext_flag), data + bytes); - bytes += qq_get8(&(bd->comm_flag), data + bytes); - - /* filter \r\n in nick */ - qq_filter_str(nick); - bd->nickname = g_strdup(nick); - g_free(nick); - -#if 0 - purple_debug_info("QQ", - "member [%09d]: ext_flag=0x%02x, comm_flag=0x%02x, nick=%s\n", - member_uid, bd->ext_flag, bd->comm_flag, bd->nickname); -#endif - - bd->last_update = time(NULL); - } - if (bytes > len) { - purple_debug_error("QQ", - "group_cmd_get_members_info: Dangerous error! maybe protocol changed, notify developers!"); - } - purple_debug_info("QQ", "Group \"%s\" got %d member info\n", rmd->title_utf8, num); - - rmd->is_got_buddies = TRUE; - qq_room_conv_set_onlines(gc, rmd); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_info.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/** - * @file group_info.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_INFO_H_ -#define _QQ_GROUP_INFO_H_ - -#include -#include "connection.h" -#include "group.h" - -enum { - QQ_ROOM_INFO_UPDATE_ONLY = 0, - QQ_ROOM_INFO_DISPLAY -}; - -gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class); - -void qq_process_room_cmd_get_info(guint8 *data, gint len, guint32 action, PurpleConnection *gc); -void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc); -void qq_process_room_cmd_get_buddies(guint8 *data, gint len, PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,434 +0,0 @@ -/** - * @file group_internal.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "blist.h" -#include "debug.h" - -#include "buddy_opt.h" -#include "group_internal.h" -#include "utils.h" - -static qq_room_data *room_data_new(guint32 id, guint32 ext_id, const gchar *title) -{ - qq_room_data *rmd; - - purple_debug_info("QQ", "Created room data: %s, ext id %u, id %u\n", - title == NULL ? "(NULL)" : title, - ext_id, id); - rmd = g_new0(qq_room_data, 1); - rmd->my_role = QQ_ROOM_ROLE_NO; - rmd->id = id; - rmd->ext_id = ext_id; - rmd->type8 = 0x01; /* assume permanent Qun */ - rmd->creator_uid = 10000; /* assume by QQ admin */ - rmd->category = 0x01; - rmd->auth_type = 0x02; /* assume need auth */ - rmd->title_utf8 = g_strdup(title == NULL ? "" : title); - rmd->desc_utf8 = g_strdup(""); - rmd->notice_utf8 = g_strdup(""); - rmd->members = NULL; - rmd->is_got_buddies = FALSE; - return rmd; -} - -/* create a qq_room_data from hashtable */ -static qq_room_data *room_data_new_by_hashtable(PurpleConnection *gc, GHashTable *data) -{ - qq_room_data *rmd; - guint32 id, ext_id; - gchar *value; - - value = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); - id = value ? strtoul(value, NULL, 10) : 0; - value = g_hash_table_lookup(data, QQ_ROOM_KEY_EXTERNAL_ID); - ext_id = value ? strtoul(value, NULL, 10) : 0; - value = g_hash_table_lookup(data, QQ_ROOM_KEY_TITLE_UTF8); - - rmd = room_data_new(id, ext_id, value); - rmd->my_role = QQ_ROOM_ROLE_YES; - return rmd; -} - -/* gracefully free all members in a room */ -static void room_buddies_free(qq_room_data *rmd) -{ - gint i; - GList *list; - qq_buddy_data *bd; - - g_return_if_fail(rmd != NULL); - i = 0; - while (NULL != (list = rmd->members)) { - bd = (qq_buddy_data *) list->data; - i++; - rmd->members = g_list_remove(rmd->members, bd); - qq_buddy_data_free(bd); - } - - rmd->members = NULL; -} - -/* gracefully free the memory for one qq_room_data */ -static void room_data_free(qq_room_data *rmd) -{ - g_return_if_fail(rmd != NULL); - room_buddies_free(rmd); - g_free(rmd->title_utf8); - g_free(rmd->desc_utf8); - g_free(rmd->notice_utf8); - g_free(rmd); -} - -void qq_room_update_chat_info(PurpleChat *chat, qq_room_data *rmd) -{ - GHashTable *components; - - if (rmd->title_utf8 != NULL && strlen(rmd->title_utf8) > 0) { - purple_blist_alias_chat(chat, rmd->title_utf8); - } - - components = purple_chat_get_components(chat); - - g_hash_table_replace(components, - g_strdup(QQ_ROOM_KEY_INTERNAL_ID), - g_strdup_printf("%u", rmd->id)); - g_hash_table_replace(components, - g_strdup(QQ_ROOM_KEY_EXTERNAL_ID), - g_strdup_printf("%u", rmd->ext_id)); - g_hash_table_replace(components, - g_strdup(QQ_ROOM_KEY_TITLE_UTF8), g_strdup(rmd->title_utf8)); -} - -static PurpleChat *chat_new(PurpleConnection *gc, qq_room_data *rmd) -{ - GHashTable *components; - PurpleGroup *g; - PurpleChat *chat; - - purple_debug_info("QQ", "Add new chat: id %u, ext id %u, title %s\n", - rmd->id, rmd->ext_id, - rmd->title_utf8 == NULL ? "(NULL)" : rmd->title_utf8); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, - g_strdup(QQ_ROOM_KEY_INTERNAL_ID), g_strdup_printf("%u", rmd->id)); - g_hash_table_insert(components, g_strdup(QQ_ROOM_KEY_EXTERNAL_ID), - g_strdup_printf("%u", rmd->ext_id)); - g_hash_table_insert(components, g_strdup(QQ_ROOM_KEY_TITLE_UTF8), g_strdup(rmd->title_utf8)); - - chat = purple_chat_new(purple_connection_get_account(gc), rmd->title_utf8, components); - g = qq_group_find_or_new(PURPLE_GROUP_QQ_QUN); - purple_blist_add_chat(chat, g, NULL); - - return chat; -} - -PurpleChat *qq_room_find_or_new(PurpleConnection *gc, guint32 id, guint32 ext_id) -{ - qq_data *qd; - qq_room_data *rmd; - PurpleChat *chat; - gchar *num_str; - - g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, NULL); - qd = (qq_data *) gc->proto_data; - - g_return_val_if_fail(id != 0 && ext_id != 0, NULL); - - purple_debug_info("QQ", "Find or add new room: id %u, ext id %u\n", id, ext_id); - - rmd = qq_room_data_find(gc, id); - if (rmd == NULL) { - rmd = room_data_new(id, ext_id, NULL); - g_return_val_if_fail(rmd != NULL, NULL); - rmd->my_role = QQ_ROOM_ROLE_YES; - qd->groups = g_list_append(qd->groups, rmd); - } - - num_str = g_strdup_printf("%u", ext_id); - chat = purple_blist_find_chat(purple_connection_get_account(gc), num_str); - g_free(num_str); - if (chat) { - return chat; - } - - return chat_new(gc, rmd); -} - -void qq_room_remove(PurpleConnection *gc, guint32 id) -{ - qq_data *qd; - PurpleChat *chat; - qq_room_data *rmd; - gchar *num_str; - guint32 ext_id; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Find and remove room data, id %u\n", id); - rmd = qq_room_data_find(gc, id); - g_return_if_fail (rmd != NULL); - - ext_id = rmd->ext_id; - qd->groups = g_list_remove(qd->groups, rmd); - room_data_free(rmd); - - purple_debug_info("QQ", "Find and remove chat, ext_id %u\n", ext_id); - num_str = g_strdup_printf("%u", ext_id); - chat = purple_blist_find_chat(purple_connection_get_account(gc), num_str); - g_free(num_str); - - g_return_if_fail (chat != NULL); - - purple_blist_remove_chat(chat); -} - -/* find a qq_buddy_data by uid, called by im.c */ -qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, guint32 uid) -{ - GList *list; - qq_buddy_data *bd; - g_return_val_if_fail(rmd != NULL && uid > 0, NULL); - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (bd->uid == uid) - return bd; - else - list = list->next; - } - - return NULL; -} - -/* remove a qq_buddy_data by uid, called by qq_group_opt.c */ -void qq_room_buddy_remove(qq_room_data *rmd, guint32 uid) -{ - GList *list; - qq_buddy_data *bd; - g_return_if_fail(rmd != NULL && uid > 0); - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (bd->uid == uid) { - rmd->members = g_list_remove(rmd->members, bd); - return; - } else { - list = list->next; - } - } -} - -qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, guint32 member_uid) -{ - qq_buddy_data *member, *bd; - PurpleBuddy *buddy; - g_return_val_if_fail(rmd != NULL && member_uid > 0, NULL); - - member = qq_room_buddy_find(rmd, member_uid); - if (member == NULL) { /* first appear during my session */ - member = g_new0(qq_buddy_data, 1); - member->uid = member_uid; - buddy = purple_find_buddy(purple_connection_get_account(gc), uid_to_purple_name(member_uid)); - if (buddy != NULL) { - const gchar *alias = NULL; - - bd = purple_buddy_get_protocol_data(buddy); - if (bd != NULL && bd->nickname != NULL) - member->nickname = g_strdup(bd->nickname); - else if ((alias = purple_buddy_get_alias(buddy)) != NULL) - member->nickname = g_strdup(alias); - } - rmd->members = g_list_append(rmd->members, member); - } - - return member; -} - -qq_room_data *qq_room_data_find(PurpleConnection *gc, guint32 room_id) -{ - GList *list; - qq_room_data *rmd; - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - - if (qd->groups == NULL || room_id <= 0) - return 0; - - list = qd->groups; - while (list != NULL) { - rmd = (qq_room_data *) list->data; - if (rmd->id == room_id) { - return rmd; - } - list = list->next; - } - - return NULL; -} - -guint32 qq_room_get_next(PurpleConnection *gc, guint32 room_id) -{ - GList *list; - qq_room_data *rmd; - qq_data *qd; - gboolean is_find = FALSE; - - qd = (qq_data *) gc->proto_data; - - if (qd->groups == NULL) { - return 0; - } - - if (room_id <= 0) { - rmd = (qq_room_data *) qd->groups->data; - return rmd->id; - } - - list = qd->groups; - while (list != NULL) { - rmd = (qq_room_data *) list->data; - list = list->next; - if (rmd->id == room_id) { - is_find = TRUE; - break; - } - } - - g_return_val_if_fail(is_find, 0); - if (list == NULL) return 0; /* be the end */ - rmd = (qq_room_data *) list->data; - g_return_val_if_fail(rmd != NULL, 0); - return rmd->id; -} - -guint32 qq_room_get_next_conv(PurpleConnection *gc, guint32 room_id) -{ - GList *list; - qq_room_data *rmd; - qq_data *qd; - gboolean is_find; - - qd = (qq_data *) gc->proto_data; - - list = qd->groups; - if (room_id > 0) { - /* search next room */ - is_find = FALSE; - while (list != NULL) { - rmd = (qq_room_data *) list->data; - list = list->next; - if (rmd->id == room_id) { - is_find = TRUE; - break; - } - } - g_return_val_if_fail(is_find, 0); - } - - while (list != NULL) { - rmd = (qq_room_data *) list->data; - g_return_val_if_fail(rmd != NULL, 0); - - if (rmd->my_role == QQ_ROOM_ROLE_YES || rmd->my_role == QQ_ROOM_ROLE_ADMIN) { - if (NULL != purple_find_conversation_with_account( - PURPLE_CONV_TYPE_CHAT,rmd->title_utf8, purple_connection_get_account(gc))) { - /* In convseration*/ - return rmd->id; - } - } - list = list->next; - } - - return 0; -} - -/* this should be called upon signin, even when we did not open group chat window */ -void qq_room_data_initial(PurpleConnection *gc) -{ - PurpleAccount *account; - PurpleChat *chat; - PurpleGroup *purple_group; - PurpleBlistNode *node; - qq_data *qd; - qq_room_data *rmd; - gint count; - - account = purple_connection_get_account(gc); - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Initial QQ Qun configurations\n"); - purple_group = purple_find_group(PURPLE_GROUP_QQ_QUN); - if (purple_group == NULL) { - purple_debug_info("QQ", "We have no QQ Qun\n"); - return; - } - - count = 0; - for (node = purple_blist_node_get_first_child((PurpleBlistNode *)purple_group); - node != NULL; - node = purple_blist_node_get_sibling_next(node)) - { - if ( !PURPLE_BLIST_NODE_IS_CHAT(node)) { - continue; - } - /* got one */ - chat = (PurpleChat *) node; - if (account != purple_chat_get_account(chat)) /* not qq account*/ - continue; - - rmd = room_data_new_by_hashtable(gc, purple_chat_get_components(chat)); - qd->groups = g_list_append(qd->groups, rmd); - count++; - } - - purple_debug_info("QQ", "Load %d QQ Qun configurations\n", count); -} - -void qq_room_data_free_all(PurpleConnection *gc) -{ - qq_data *qd; - qq_room_data *rmd; - gint count; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - count = 0; - while (qd->groups != NULL) { - rmd = (qq_room_data *) qd->groups->data; - qd->groups = g_list_remove(qd->groups, rmd); - room_data_free(rmd); - count++; - } - - if (count > 0) { - purple_debug_info("QQ", "%d rooms are freed\n", count); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file group_internal.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_HASH_H_ -#define _QQ_GROUP_HASH_H_ - -#include -#include "group.h" - -#define QQ_ROOM_KEY_INTERNAL_ID "id" -#define QQ_ROOM_KEY_EXTERNAL_ID "ext_id" -#define QQ_ROOM_KEY_TITLE_UTF8 "title_utf8" - -PurpleChat *qq_room_find_or_new(PurpleConnection *gc, guint32 id, guint32 ext_id); -void qq_room_remove(PurpleConnection *gc, guint32 id); -void qq_room_update_chat_info(PurpleChat *chat, qq_room_data *rmd); - -qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, guint32 uid); -void qq_room_buddy_remove(qq_room_data *rmd, guint32 uid); -qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, guint32 member_uid); - -void qq_room_data_initial(PurpleConnection *gc); -void qq_room_data_free_all(PurpleConnection *gc); -qq_room_data *qq_room_data_find(PurpleConnection *gc, guint32 room_id); - -guint32 qq_room_get_next(PurpleConnection *gc, guint32 room_id); -guint32 qq_room_get_next_conv(PurpleConnection *gc, guint32 room_id); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,429 +0,0 @@ -/** - * @file group_join.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "notify.h" -#include "request.h" -#include "server.h" - -#include "char_conv.h" -#include "im.h" -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "group_opt.h" -#include "group_im.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_process.h" - -enum { - QQ_ROOM_JOIN_OK = 0x01, - QQ_ROOM_JOIN_NEED_AUTH = 0x02, - QQ_ROOM_JOIN_DENIED = 0x03 -}; - -enum { - QQ_ROOM_SEARCH_TYPE_BY_ID = 0x01, - QQ_ROOM_SEARCH_TYPE_DEMO = 0x02 -}; - -static void group_quit_cb(qq_room_req *add_req) -{ - PurpleConnection *gc; - guint32 id; - qq_room_data *rmd; - - if (add_req->gc == NULL || add_req->id == 0) { - g_free(add_req); - return; - } - - gc = add_req->gc; - id = add_req->id; - - rmd = qq_room_data_find(gc, id); - if (rmd == NULL) { - g_free(add_req); - return; - } - - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_QUIT, rmd->id); - g_free(add_req); -} - -/* send packet to join a group without auth */ -void qq_request_room_join(PurpleConnection *gc, qq_room_data *rmd) -{ - g_return_if_fail(rmd != NULL); - - if (rmd->my_role == QQ_ROOM_ROLE_NO) { - rmd->my_role = QQ_ROOM_ROLE_REQUESTING; - } - - switch (rmd->auth_type) { - case QQ_ROOM_AUTH_TYPE_NO_AUTH: - case QQ_ROOM_AUTH_TYPE_NEED_AUTH: - break; - case QQ_ROOM_AUTH_TYPE_NO_ADD: - if (rmd->my_role == QQ_ROOM_ROLE_NO - && rmd->my_role == QQ_ROOM_ROLE_REQUESTING) { - purple_notify_warning(gc, NULL, _("The Qun does not allow others to join"), NULL); - return; - } - break; - default: - purple_debug_error("QQ", "Unknown room auth type: %d\n", rmd->auth_type); - break; - } - - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_JOIN, rmd->id); -} - -static void group_join_cb(qq_room_req *add_req, const gchar *reason_utf8) -{ - qq_room_data *rmd; - - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->id == 0) { - g_free(add_req); - return; - } - - rmd = qq_room_data_find(add_req->gc, add_req->id); - if (rmd == NULL) { - purple_debug_error("QQ", "Can not find room data of %u\n", add_req->id); - g_free(add_req); - return; - } - - qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_APPLY, 0, reason_utf8); - g_free(add_req); -} - -static void room_join_cancel_cb(qq_room_req *add_req, const gchar *msg) -{ - g_return_if_fail(add_req != NULL); - g_free(add_req); -} - -static void do_room_join_request(PurpleConnection *gc, qq_room_data *rmd) -{ - gchar *msg; - qq_room_req *add_req; - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "Room id %u needs authentication\n", rmd->id); - - msg = g_strdup_printf("QQ Qun %u needs authentication\n", rmd->ext_id); - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = rmd->id; - purple_request_input(gc, _("Join QQ Qun"), msg, - _("Input request here"), - _("Would you be my friend?"), TRUE, FALSE, NULL, - _("Send"), - G_CALLBACK(group_join_cb), - _("Cancel"), G_CALLBACK(room_join_cancel_cb), - purple_connection_get_account(gc), rmd->title_utf8, NULL, - add_req); - g_free(msg); -} - -void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd, - guint8 opt, guint32 uid, const gchar *reason_utf8) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(rmd != NULL); - - if (opt == QQ_ROOM_AUTH_REQUEST_APPLY) { - rmd->my_role = QQ_ROOM_ROLE_REQUESTING; - uid = 0; - } - - bytes = 0; - bytes += qq_put8(raw_data + bytes, opt); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put_vstr(raw_data + bytes, reason_utf8, QQ_CHARSET_DEFAULT); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_AUTH, rmd->id, raw_data, bytes); -} - -/* If comes here, cmd is OK already */ -void qq_process_group_cmd_exit_group(guint8 *data, gint len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - guint32 id; - - g_return_if_fail(data != NULL && len > 0); - qd = (qq_data *) gc->proto_data; - - if (len < 4) { - purple_debug_error("QQ", "Invalid exit group reply, expect %d bytes, read %d bytes\n", 4, len); - return; - } - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - - qq_room_remove(gc, id); -} - -/* Process the reply to group_auth subcmd */ -void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - qq_data *qd; - qq_room_data *rmd; - gchar *msg; - - g_return_if_fail(data != NULL && len > 0); - qd = (qq_data *) gc->proto_data; - - if (len < 4) { - purple_debug_error("QQ", - "Invalid join room reply, expect %d bytes, read %d bytes\n", 4, len); - return; - } - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - msg = g_strdup_printf(_("Successfully joined Qun %s (%u)"), rmd->title_utf8, rmd->ext_id); - qq_got_message(gc, msg); - g_free(msg); - } else { - qq_got_message(gc, _("Successfully joined Qun")); - } -} - -/* process group cmd reply "join group" */ -void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - guint8 reply; - qq_room_data *rmd; - gchar *msg; - - g_return_if_fail(data != NULL && len > 0); - - if (len < 5) { - purple_debug_error("QQ", - "Invalid join room reply, expect %d bytes, read %d bytes\n", 5, len); - return; - } - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - bytes += qq_get8(&reply, data + bytes); - - /* join group OK */ - rmd = qq_room_data_find(gc, id); - /* need to check if group is NULL or not. */ - g_return_if_fail(rmd != NULL); - switch (reply) { - case QQ_ROOM_JOIN_OK: - purple_debug_info("QQ", "Succeeded in joining group \"%s\"\n", rmd->title_utf8); - rmd->my_role = QQ_ROOM_ROLE_YES; - /* this must be shown before getting online members */ - qq_room_conv_open(gc, rmd); - break; - case QQ_ROOM_JOIN_NEED_AUTH: - purple_debug_info("QQ", - "Failed to join room ext id %u %s, needs authentication\n", - rmd->ext_id, rmd->title_utf8); - rmd->my_role = QQ_ROOM_ROLE_NO; - do_room_join_request(gc, rmd); - break; - case QQ_ROOM_JOIN_DENIED: - msg = g_strdup_printf(_("Qun %u denied from joining"), rmd->ext_id); - purple_notify_info(gc, _("QQ Qun Operation"), _("Failed:"), msg); - g_free(msg); - break; - default: - purple_debug_info("QQ", - "Failed to join room ext id %u %s, unknown reply: 0x%02x\n", - rmd->ext_id, rmd->title_utf8, reply); - - purple_notify_info(gc, _("QQ Qun Operation"), _("Failed:"), _("Join Qun, Unknown Reply")); - } -} - -/* Attempt to join a group without auth */ -void qq_group_join(PurpleConnection *gc, GHashTable *data) -{ - qq_data *qd; - gchar *ext_id_str; - gchar *id_str; - guint32 ext_id; - guint32 id; - qq_room_data *rmd; - - g_return_if_fail(data != NULL); - qd = (qq_data *) gc->proto_data; - - ext_id_str = g_hash_table_lookup(data, QQ_ROOM_KEY_EXTERNAL_ID); - id_str = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); - purple_debug_info("QQ", "Join room %s, extend id %s\n", id_str, ext_id_str); - - if (id_str != NULL) { - id = strtoul(id_str, NULL, 10); - if (id != 0) { - rmd = qq_room_data_find(gc, id); - if (rmd) { - qq_request_room_join(gc, rmd); - return; - } - } - } - - purple_debug_info("QQ", "Search and join extend id %s\n", ext_id_str); - if (ext_id_str == NULL) { - return; - } - ext_id = strtoul(ext_id_str, NULL, 10); - if (ext_id == 0) { - return; - } - - qq_request_room_search(gc, ext_id, QQ_ROOM_SEARCH_FOR_JOIN); -} - -void qq_room_quit(PurpleConnection *gc, guint32 room_id) -{ - qq_room_req *add_req; - - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = room_id; - - purple_request_action(gc, _("QQ Qun Operation"), - _("Quit Qun"), - _("Note, if you are the creator, \nthis operation will eventually remove this Qun."), - 1, - purple_connection_get_account(gc), NULL, NULL, - add_req, 2, _("Cancel"), - G_CALLBACK(room_join_cancel_cb), - _("Continue"), G_CALLBACK(group_quit_cb)); -} - -/* send packet to search for qq_group */ -void qq_request_room_search(PurpleConnection *gc, guint32 ext_id, int action) -{ - guint8 raw_data[16] = {0}; - gint bytes = 0; - guint8 type; - - purple_debug_info("QQ", "Search QQ Qun %u\n", ext_id); - type = (ext_id == 0x00000000) ? QQ_ROOM_SEARCH_TYPE_DEMO : QQ_ROOM_SEARCH_TYPE_BY_ID; - - bytes = 0; - bytes += qq_put8(raw_data + bytes, type); - bytes += qq_put32(raw_data + bytes, ext_id); - - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_SEARCH, 0, raw_data, bytes, 0, action); -} - -static void add_to_roomlist(qq_data *qd, qq_room_data *rmd) -{ - PurpleRoomlistRoom *room; - gchar field[11]; - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, rmd->title_utf8, NULL); - g_snprintf(field, sizeof(field), "%u", rmd->ext_id); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%u", rmd->creator_uid); - purple_roomlist_room_add_field(qd->roomlist, room, field); - purple_roomlist_room_add_field(qd->roomlist, room, rmd->desc_utf8); - g_snprintf(field, sizeof(field), "%u", rmd->id); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%d", rmd->type8); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%d", rmd->auth_type); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%d", rmd->category); - purple_roomlist_room_add_field(qd->roomlist, room, field); - purple_roomlist_room_add_field(qd->roomlist, room, rmd->title_utf8); - purple_roomlist_room_add(qd->roomlist, room); - - purple_roomlist_set_in_progress(qd->roomlist, FALSE); -} - -/* process group cmd reply "search group" */ -void qq_process_room_search(PurpleConnection *gc, guint8 *data, gint len, guint32 ship32) -{ - qq_data *qd; - qq_room_data rmd; - PurpleChat *chat; - gint bytes; - guint8 search_type; - guint16 unknown; - - g_return_if_fail(data != NULL && len > 0); - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&search_type, data + bytes); - - /* now it starts with group_info_entry */ - bytes += qq_get32(&(rmd.id), data + bytes); - bytes += qq_get32(&(rmd.ext_id), data + bytes); - bytes += qq_get8(&(rmd.type8), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get32(&(rmd.creator_uid), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get32(&(rmd.category), data + bytes); - bytes += qq_get_vstr(&(rmd.title_utf8), QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get8(&(rmd.auth_type), data + bytes); - bytes += qq_get_vstr(&(rmd.desc_utf8), QQ_CHARSET_DEFAULT, data + bytes); - /* end of one qq_group */ - if(bytes != len) { - purple_debug_error("QQ", - "group_cmd_search_group: Dangerous error! maybe protocol changed, notify developers!"); - } - - if (ship32 == QQ_ROOM_SEARCH_FOR_JOIN) { - chat = qq_room_find_or_new(gc, rmd.id, rmd.ext_id); - g_return_if_fail(chat != NULL); - - qq_room_update_chat_info(chat, &rmd); - qq_request_room_join(gc, &rmd); - } else { - add_to_roomlist(qd, &rmd); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_join.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/** - * @file group_join.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_JOIN_H_ -#define _QQ_GROUP_JOIN_H_ - -#include -#include "connection.h" -#include "group.h" - -enum { - QQ_ROOM_AUTH_TYPE_NO_AUTH = 0x01, - QQ_ROOM_AUTH_TYPE_NEED_AUTH = 0x02, - QQ_ROOM_AUTH_TYPE_NO_ADD = 0x03 -}; - -enum { - QQ_ROOM_AUTH_REQUEST_APPLY = 0x01, - QQ_ROOM_AUTH_REQUEST_APPROVE = 0x02, - QQ_ROOM_AUTH_REQUEST_REJECT = 0x03 -}; - -enum { - QQ_ROOM_SEARCH_ONLY = 0, - QQ_ROOM_SEARCH_FOR_JOIN -}; - -void qq_request_room_search(PurpleConnection *gc, guint32 ext_id, int action); -void qq_process_room_search(PurpleConnection *gc, guint8 *data, gint len, guint32 ship32); - -void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd, guint8 opt, guint32 uid, const gchar *reason_utf8); -void qq_group_join(PurpleConnection *gc, GHashTable *data); -void qq_request_room_join(PurpleConnection *gc, qq_room_data *rmd); -void qq_room_quit(PurpleConnection *gc, guint32 room_id); -void qq_process_group_cmd_exit_group(guint8 *data, gint len, PurpleConnection *gc); -void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc); -void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,594 +0,0 @@ -/** - * @file group_opt.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "qq.h" - -#include "debug.h" -#include "notify.h" -#include "request.h" - -#include "buddy_info.h" -#include "char_conv.h" -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "group_im.h" -#include "group_opt.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_process.h" -#include "utils.h" - -static int _compare_guint32(const void *a, - const void *b) -{ - const guint32 *x = a; - const guint32 *y = b; - return (*x - *y); -} - -static void _sort(guint32 *list) -{ - gint i; - for (i = 0; list[i] < 0xffffffff; i++) {; - } - qsort (list, i, sizeof (guint32), _compare_guint32); -} - -static void _qq_group_member_opt(PurpleConnection *gc, qq_room_data *rmd, gint operation, guint32 *members) -{ - guint8 *data; - gint i, count, data_len; - gint bytes; - g_return_if_fail(members != NULL); - - for (count = 0; members[count] != 0xffffffff; count++) {; - } - data_len = 6 + count * 4; - data = g_newa(guint8, data_len); - - bytes = 0; - bytes += qq_put8(data + bytes, operation); - for (i = 0; i < count; i++) - bytes += qq_put32(data + bytes, members[i]); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_MEMBER_OPT, rmd->id, data, bytes); -} - -static void room_req_cancel_cb(qq_room_req *add_req) -{ - if (add_req != NULL) - g_free(add_req); -} - -static void member_join_authorize_cb(gpointer data) -{ - qq_room_req *add_req = (qq_room_req *)data; - qq_room_data *rmd; - g_return_if_fail(add_req != NULL && add_req->gc != NULL); - g_return_if_fail(add_req->id > 0 && add_req->member > 0); - rmd = qq_room_data_find(add_req->gc, add_req->id); - g_return_if_fail(rmd != NULL); - - qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, add_req->member, ""); - qq_room_buddy_find_or_new(add_req->gc, rmd, add_req->member); - g_free(add_req); -} - -static void member_join_deny_reason_cb(qq_room_req *add_req, gchar *msg_utf8) -{ - qq_room_data *rmd; - g_return_if_fail(add_req != NULL && add_req->gc != NULL); - g_return_if_fail(add_req->id > 0 && add_req->member > 0); - rmd = qq_room_data_find(add_req->gc, add_req->id); - g_return_if_fail(rmd != NULL); - qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_REJECT, add_req->member, msg_utf8); - g_free(add_req); -} - -static void member_join_deny_noreason_cb(qq_room_req *add_req, gchar *msg_utf8) -{ - member_join_deny_reason_cb(add_req, NULL); -} - -static void member_join_deny_cb(gpointer data) -{ - qq_room_req *add_req = (qq_room_req *)data; - gchar *who; - g_return_if_fail(add_req != NULL && add_req->gc != NULL); - g_return_if_fail(add_req->id > 0 && add_req->member > 0); - - who = uid_to_purple_name(add_req->member); - purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), - NULL, _("Sorry, you are not our style"), TRUE, FALSE, NULL, - _("OK"), G_CALLBACK(member_join_deny_reason_cb), - _("Cancel"), G_CALLBACK(member_join_deny_noreason_cb), - purple_connection_get_account(add_req->gc), who, NULL, - add_req); - g_free(who); -} - -void qq_group_modify_members(PurpleConnection *gc, qq_room_data *rmd, guint32 *new_members) -{ - guint32 *old_members, *del_members, *add_members; - qq_buddy_data *bd; - qq_data *qd; - gint i = 0, old = 0, new = 0, del = 0, add = 0; - GList *list; - - g_return_if_fail(rmd != NULL); - qd = (qq_data *) gc->proto_data; - if (new_members[0] == 0xffffffff) - return; - - old_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - del_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - add_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - - /* construct the old member list */ - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (bd != NULL) - old_members[i++] = bd->uid; - list = list->next; - } - old_members[i] = 0xffffffff; /* this is the end */ - - /* sort to speed up making del_members and add_members list */ - _sort(old_members); - _sort(new_members); - - for (old = 0, new = 0; old_members[old] < 0xffffffff || new_members[new] < 0xffffffff;) { - if (old_members[old] > new_members[new]) { - add_members[add++] = new_members[new++]; - } else if (old_members[old] < new_members[new]) { - del_members[del++] = old_members[old++]; - } else { - if (old_members[old] < 0xffffffff) - old++; - if (new_members[new] < 0xffffffff) - new++; - } - } - del_members[del] = add_members[add] = 0xffffffff; - - for (i = 0; i < del; i++) - qq_room_buddy_remove(rmd, del_members[i]); - for (i = 0; i < add; i++) - qq_room_buddy_find_or_new(gc, rmd, add_members[i]); - - if (del > 0) - _qq_group_member_opt(gc, rmd, QQ_ROOM_MEMBER_DEL, del_members); - if (add > 0) - _qq_group_member_opt(gc, rmd, QQ_ROOM_MEMBER_ADD, add_members); -} - -void qq_group_process_modify_members_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - time_t now = time(NULL); - qq_room_data *rmd; - g_return_if_fail(data != NULL); - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - /* we should have its info locally */ - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "Succeed in modify members for room %u\n", rmd->ext_id); - - qq_room_got_chat_in(gc, id, 0, _("Successfully changed Qun members"), now); -} - -void qq_room_change_info(PurpleConnection *gc, qq_room_data *rmd) -{ - guint8 data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(rmd != NULL); - - bytes = 0; - /* 005-005 */ - bytes += qq_put8(data + bytes, 0x01); - /* 006-006 */ - bytes += qq_put8(data + bytes, rmd->auth_type); - /* 007-008 */ - bytes += qq_put16(data + bytes, 0x0000); - /* 009-010 */ - bytes += qq_put16(data + bytes, rmd->category); - - bytes += qq_put_vstr(data + bytes, rmd->title_utf8, QQ_CHARSET_DEFAULT); - - bytes += qq_put16(data + bytes, 0x0000); - - bytes += qq_put_vstr(data + bytes, rmd->notice_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put_vstr(data + bytes, rmd->desc_utf8, QQ_CHARSET_DEFAULT); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_CHANGE_INFO, rmd->id, data, bytes); -} - -void qq_group_process_modify_info_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - time_t now = time(NULL); - - g_return_if_fail(data != NULL); - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - purple_debug_info("QQ", "Successfully modified room info of %u\n", id); - - qq_room_got_chat_in(gc, id, 0, _("Successfully changed Qun information"), now); -} - -/* we create a very simple room first, and then let the user to modify */ -void qq_create_room(PurpleConnection *gc, const gchar *name) -{ - guint8 *data; - gint data_len; - gint bytes; - qq_data *qd; - g_return_if_fail(name != NULL); - - qd = (qq_data *) gc->proto_data; - - data_len = 64 + strlen(name); - data = g_newa(guint8, data_len); - - bytes = 0; - /* we create the simpleset group, only group name is given */ - /* 001 */ - bytes += qq_put8(data + bytes, QQ_ROOM_TYPE_PERMANENT); - /* 002 */ - bytes += qq_put8(data + bytes, QQ_ROOM_AUTH_TYPE_NEED_AUTH); - /* 003-004 */ - bytes += qq_put16(data + bytes, 0x0000); - /* 005-006 */ - bytes += qq_put16(data + bytes, 0x0003); - /* 007 */ - bytes += qq_put8(data + bytes, strlen(name)); - bytes += qq_putdata(data + bytes, (guint8 *) name, strlen(name)); - bytes += qq_put16(data + bytes, 0x0000); - bytes += qq_put8(data + bytes, 0x00); /* no group notice */ - bytes += qq_put8(data + bytes, 0x00); /* no group desc */ - bytes += qq_put32(data + bytes, qd->uid); /* I am member of coz */ - - if (bytes > data_len) { - purple_debug_error("QQ", - "Overflow in qq_room_create, max %d bytes, now %d bytes\n", - data_len, bytes); - return; - } - qq_send_room_cmd_noid(gc, QQ_ROOM_CMD_CREATE, data, bytes); -} - -static void room_create_cb(qq_room_req *add_req) -{ - qq_room_data *rmd; - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->id == 0) { - g_free(add_req); - return; - } - - rmd = qq_room_data_find(add_req->gc, add_req->id); - if (rmd == NULL) { - g_free(add_req); - return; - } - - /* TODO insert UI code here */ - /* qq_group_detail_window_show(g->gc, rmd); */ - g_free(add_req); -} - -void qq_group_process_create_group_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id, ext_id; - qq_room_data *rmd; - qq_room_req *add_req; - qq_data *qd; - - g_return_if_fail(data != NULL); - g_return_if_fail(gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - bytes += qq_get32(&ext_id, data + bytes); - g_return_if_fail(id > 0 && ext_id); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - rmd->my_role = QQ_ROOM_ROLE_ADMIN; - rmd->creator_uid = qd->uid; - - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_ACTIVATE, id); - qq_update_room(gc, 0, rmd->id); - - purple_debug_info("QQ", "Succeed in create Qun, ext id %u\n", rmd->ext_id); - - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = id; - - purple_request_action(gc, _("QQ Qun Operation"), - _("You have successfully created a Qun"), - _("Would you like to set up detailed information now?"), - 1, - purple_connection_get_account(gc), NULL, NULL, - add_req, 2, - _("Setup"), G_CALLBACK(room_create_cb), - _("Cancel"), G_CALLBACK(room_req_cancel_cb)); -} - -void qq_group_process_activate_group_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - qq_room_data *rmd; - g_return_if_fail(data != NULL); - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - /* we should have its info locally */ - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "Succeed in activate Qun %u\n", rmd->ext_id); -} - -void qq_group_manage_group(PurpleConnection *gc, GHashTable *data) -{ - gchar *id_ptr; - guint32 id; - qq_room_data *rmd; - - g_return_if_fail(data != NULL); - - id_ptr = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); - id = strtoul(id_ptr, NULL, 10); - g_return_if_fail(id > 0); - - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - /* XXX insert UI code here */ - /* qq_group_detail_window_show(gc, rmd); */ -} - -/* receive an application to join the group */ -void qq_process_room_buddy_request_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, member_id; - guint8 type8; - gchar *msg, *reason; - qq_room_req *add_req; - gchar *who; - gint bytes = 0; - qq_room_data *rmd; - time_t now = time(NULL); - - g_return_if_fail(id > 0 && data != NULL && len > 0); - - /* FIXME: check length here */ - - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&member_id, data + bytes); - - g_return_if_fail(ext_id > 0 && member_id > 0); - - bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - - purple_debug_info("QQ", "%u requested to join room, ext id %u\n", member_id, ext_id); - - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - if (qq_room_buddy_find(rmd, member_id)) { - purple_debug_info("QQ", "Approve join, buddy joined before\n"); - msg = g_strdup_printf(_("%u requested to join Qun %u for %s"), - member_id, ext_id, reason); - qq_room_got_chat_in(gc, id, 0, msg, now); - qq_send_cmd_group_auth(gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, member_id, ""); - g_free(msg); - g_free(reason); - return; - } - - if (purple_prefs_get_bool("/plugins/prpl/qq/auto_get_authorize_info")) { - qq_request_buddy_info(gc, member_id, 0, QQ_BUDDY_INFO_DISPLAY); - } - who = uid_to_purple_name(member_id); - msg = g_strdup_printf(_("%u request to join Qun %u"), member_id, ext_id); - - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = id; - add_req->member = member_id; - - purple_request_action(gc, _("QQ Qun Operation"), - msg, reason, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), who, NULL, - add_req, 2, - _("Deny"), G_CALLBACK(member_join_deny_cb), - _("Authorize"), G_CALLBACK(member_join_authorize_cb)); - - g_free(who); - g_free(msg); - g_free(reason); -} - -/* the request to join a group is rejected */ -void qq_process_room_buddy_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, admin_uid; - guint8 type8; - gchar *msg, *reason; - qq_room_data *rmd; - gint bytes; - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&admin_uid, data + bytes); - - g_return_if_fail(ext_id > 0 && admin_uid > 0); - - bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - - msg = g_strdup_printf - (_("Failed to join Qun %u, operated by admin %u"), ext_id, admin_uid); - - purple_notify_warning(gc, _("QQ Qun Operation"), msg, reason); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - rmd->my_role = QQ_ROOM_ROLE_NO; - } - - g_free(msg); - g_free(reason); -} - -/* the request to join a group is approved */ -void qq_process_room_buddy_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, admin_uid; - guint8 type8; - gchar *msg, *reason; - qq_room_data *rmd; - gint bytes; - time_t now; - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&admin_uid, data + bytes); - - g_return_if_fail(ext_id > 0 && admin_uid > 0); - /* it is also a "无" here, so do not display */ - bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - rmd->my_role = QQ_ROOM_ROLE_YES; - } - - msg = g_strdup_printf(_("Joining Qun %u is approved by admin %u for %s"), - ext_id, admin_uid, reason); - now = time(NULL); - qq_room_got_chat_in(gc, id, 0, msg, now); - - g_free(msg); - g_free(reason); -} - -/* process the packet when removed from a group */ -void qq_process_room_buddy_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, uid; - guint8 type8; - gchar *msg; - qq_room_data *rmd; - gint bytes = 0; - time_t now = time(NULL); - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&uid, data + bytes); - - g_return_if_fail(ext_id > 0 && uid > 0); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - rmd->my_role = QQ_ROOM_ROLE_NO; - } - - msg = g_strdup_printf(_("Removed buddy %u."), uid); - qq_room_got_chat_in(gc, id, 0, msg, now); - g_free(msg); -} - -/* process the packet when added to a group */ -void qq_process_room_buddy_joined(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, uid; - guint8 type8; - qq_room_data *rmd; - gint bytes; - gchar *msg; - time_t now = time(NULL); - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&uid, data + bytes); - - g_return_if_fail(ext_id > 0 && id > 0); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - rmd->my_role = QQ_ROOM_ROLE_YES; - - qq_update_room(gc, 0, rmd->id); - - msg = g_strdup_printf(_("New buddy %u joined."), uid); - qq_room_got_chat_in(gc, id, 0, msg, now); - g_free(msg); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/group_opt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/** - * @file group_opt.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_OPT_H_ -#define _QQ_GROUP_OPT_H_ - -#include -#include "connection.h" -#include "group.h" - -#define QQ_QUN_MEMBER_MAX 80 /* max number of the group */ - -typedef struct _qq_room_req { - PurpleConnection *gc; - guint32 id; - guint32 member; -} qq_room_req; - -enum { - QQ_ROOM_TYPE_PERMANENT = 0x01, - QQ_ROOM_TYPE_TEMPORARY -}; - -enum { - QQ_ROOM_MEMBER_ADD = 0x01, - QQ_ROOM_MEMBER_DEL -}; - -void qq_group_modify_members(PurpleConnection *gc, qq_room_data *rmd, guint32 *new_members); -void qq_room_change_info(PurpleConnection *gc, qq_room_data *rmd); - -void qq_create_room(PurpleConnection *gc, const gchar *name); -void qq_group_process_modify_info_reply(guint8 *data, gint len, PurpleConnection *gc); -void qq_group_process_modify_members_reply(guint8 *data, gint len, PurpleConnection *gc); -void qq_group_manage_group(PurpleConnection *gc, GHashTable *data); -void qq_group_process_activate_group_reply(guint8 *data, gint len, PurpleConnection *gc); -void qq_group_process_create_group_reply(guint8 *data, gint len, PurpleConnection *gc); - -void qq_process_room_buddy_request_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_joined(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1320 +0,0 @@ -/** - * @file im.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" -#include "internal.h" -#include "notify.h" -#include "server.h" -#include "util.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "char_conv.h" -#include "qq_define.h" -#include "im.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "send_file.h" -#include "utils.h" - -#define QQ_MSG_IM_MAX 700 /* max length of IM */ - -enum { - QQ_IM_TEXT = 0x01, - QQ_IM_AUTO_REPLY = 0x02 -}; - -enum -{ - QQ_NORMAL_IM_TEXT = 0x000b, - QQ_NORMAL_IM_FILE_REQUEST_TCP = 0x0001, - QQ_NORMAL_IM_FILE_APPROVE_TCP = 0x0003, - QQ_NORMAL_IM_FILE_REJECT_TCP = 0x0005, - QQ_NORMAL_IM_FILE_REQUEST_UDP = 0x0035, - QQ_NORMAL_IM_FILE_APPROVE_UDP = 0x0037, - QQ_NORMAL_IM_FILE_REJECT_UDP = 0x0039, - QQ_NORMAL_IM_FILE_NOTIFY = 0x003b, - QQ_NORMAL_IM_FILE_PASV = 0x003f, /* are you behind a firewall? */ - QQ_NORMAL_IM_FILE_CANCEL = 0x0049, - QQ_NORMAL_IM_FILE_EX_REQUEST_UDP = 0x81, - QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT = 0x83, - QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL = 0x85, - QQ_NORMAL_IM_FILE_EX_NOTIFY_IP = 0x87 -}; - -typedef struct _qq_im_header qq_im_header; -struct _qq_im_header { - /* this is the common part of normal_text */ - guint16 version_from; - guint32 uid_from; - guint32 uid_to; - guint8 session_md5[QQ_KEY_LENGTH]; - guint16 im_type; -}; - -/* read the common parts of the normal_im, - * returns the bytes read if succeed, or -1 if there is any error */ -static gint get_im_header(qq_im_header *im_header, guint8 *data, gint len) -{ - gint bytes; - g_return_val_if_fail(data != NULL && len > 0, -1); - - bytes = 0; - bytes += qq_get16(&(im_header->version_from), data + bytes); - bytes += qq_get32(&(im_header->uid_from), data + bytes); - bytes += qq_get32(&(im_header->uid_to), data + bytes); - bytes += qq_getdata(im_header->session_md5, QQ_KEY_LENGTH, data + bytes); - bytes += qq_get16(&(im_header->im_type), data + bytes); - return bytes; -} - -typedef struct _qq_emoticon qq_emoticon; -struct _qq_emoticon { - guint8 symbol; - gchar *name; -}; - -static gboolean emoticons_is_sorted = FALSE; -/* Map for purple smiley convert to qq, need qsort */ -static qq_emoticon emoticons_std[] = { - {0x4f, "/:)"}, {0x4f, "/wx"}, {0x4f, "/small_smile"}, - {0x42, "/:~"}, {0x42, "/pz"}, {0x42, "/curl_lip"}, - {0x43, "/:*"}, {0x43, "/se"}, {0x43, "/desire"}, - {0x44, "/:|"}, {0x44, "/fd"}, {0x44, "/dazed"}, - {0x45, "/8-)"}, {0x45, "/dy"}, {0x45, "/revel"}, - {0x46, "/:<"}, {0x46, "/ll"}, {0x46, "/cry"}, - {0x47, "/:$"}, {0x47, "/hx"}, {0x47, "/bashful"}, - {0x48, "/:x"}, {0x48, "/bz"}, {0x48, "/shut_mouth"}, - {0x8f, "/|-)"}, {0x8f, "/kun"}, {0x8f, "/sleepy"}, - {0x49, "/:z"}, {0x49, "/shui"}, {0x49, "/sleep"}, /* after sleepy */ - {0x4a, "/:'"}, {0x4a, "/dk"}, {0x4a, "/weep"}, - {0x4b, "/:-|"}, {0x4b, "/gg"}, {0x4b, "/embarassed"}, - {0x4c, "/:@"}, {0x4c, "/fn"}, {0x4c, "/pissed_off"}, - {0x4d, "/:P"}, {0x4d, "/tp"}, {0x4d, "/act_up"}, - {0x4e, "/:D"}, {0x4e, "/cy"}, {0x4e, "/toothy_smile"}, - {0x41, "/:O"}, {0x41, "/jy"}, {0x41, "/surprised"}, - {0x73, "/:("}, {0x73, "/ng"}, {0x73, "/sad"}, - {0x74, "/:+"}, {0x74, "/kuk"}, {0x74, "/cool"}, - {0xa1, "/--b"}, {0xa1, "/lengh"}, - {0x76, "/:Q"}, {0x76, "/zk"}, {0x76, "/crazy"}, - {0x8a, "/;P"}, {0x8a, "/tx"}, {0x8a, "/titter"}, - {0x8b, "/;-D"}, {0x8b, "/ka"}, {0x8b, "/cute"}, - {0x8c, "/;d"}, {0x8c, "/by"}, {0x8c, "/disdain"}, - {0x8d, "/;o"}, {0x8d, "/am"}, {0x8d, "/arrogant"}, - {0x8e, "/:g"}, {0x8e, "/jie"}, {0x8e, "/starving"}, - {0x78, "/:!"}, {0x78, "/jk"}, {0x78, "/terror"}, - {0x79, "/:L"}, {0x79, "/lh"}, {0x79, "/sweat"}, - {0x7a, "/:>"}, {0x7a, "/hanx"}, {0x7a, "/smirk"}, - {0x7b, "/:;"}, {0x7b, "/db"}, {0x7b, "/soldier"}, - {0x90, "/;f"}, {0x90, "/fendou"}, {0x90, "/struggle"}, - {0x91, "/:-S"}, {0x91, "/zhm"}, {0x91, "/curse"}, - {0x92, "/?"}, {0x92, "/yiw"}, {0x92, "/question"}, - {0x93, "/;x"}, {0x93, "/xu"}, {0x93, "/shh"}, - {0x94, "/;@"}, {0x94, "/yun"}, {0x94, "/dizzy"}, - {0x95, "/:8"}, {0x95, "/zhem"}, {0x95, "/excrutiating"}, - {0x96, "/;!"}, {0x96, "/shuai"}, {0x96, "/freaked_out"}, - {0x97, "/!!!"}, {0x97, "/kl"}, {0x97, "/skeleton"}, - {0x98, "/xx"}, {0x98, "/qiao"}, {0x98, "/hammer"}, - {0x99, "/bye"}, {0x99, "/zj"}, {0x99, "/bye"}, - {0xa2, "/wipe"}, {0xa2, "/ch"}, - {0xa3, "/dig"}, {0xa3, "/kb"}, - {0xa4, "/handclap"},{0xa4, "/gz"}, - {0xa5, "/&-("}, {0xa5, "/qd"}, - {0xa6, "/B-)"}, {0xa6, "/huaix"}, - {0xa7, "/<@"}, {0xa7, "/zhh"}, - {0xa8, "/@>"}, {0xa8, "/yhh"}, - {0xa9, "/:-O"}, {0xa9, "/hq"}, - {0xaa, "/>-|"}, {0xaa, "/bs"}, - {0xab, "/P-("}, {0xab, "/wq"}, - {0xac, "/:'|"}, {0xac, "/kk"}, - {0xad, "/X-)"}, {0xad, "/yx"}, - {0xae, "/:*"}, {0xae, "/qq"}, - {0xaf, "/@x"}, {0xaf, "/xia"}, - {0xb0, "/8*"}, {0xb0, "/kel"}, - {0xb1, "/pd"}, {0xb1, "/cd"}, - {0x61, "/"}, {0x61, "/xig"}, {0x61, "/watermelon"}, - {0xb2, "/beer"}, {0xb2, "/pj"}, - {0xb3, "/basketb"}, {0xb3, "/lq"}, - {0xb4, "/oo"}, {0xb4, "/pp"}, - {0x80, "/coffee"}, {0x80, "/kf"}, - {0x81, "/eat"}, {0x81, "/fan"}, - {0x62, "/rose"}, {0x62, "/mg"}, - {0x63, "/fade"}, {0x63, "/dx"}, {0x63, "/wilt"}, - {0xb5, "/showlove"},{0xb5, "/sa"}, /* after sad */ - {0x65, "/heart"}, {0x65, "/xin"}, - {0x66, "/break"}, {0x66, "/xs"}, {0x66, "/broken_heart"}, - {0x67, "/cake"}, {0x67, "/dg"}, - {0x9c, "/li"}, {0x9c, "/shd"}, {0x9c, "/lightning"}, - {0x9d, "/bome"}, {0x9d, "/zhd"}, {0x9d, "/bomb"}, - {0x9e, "/kn"}, {0x9e, "/dao"}, {0x9e, "/knife"}, - {0x5e, "/footb"}, {0x5e, "/zq"}, {0x5e, "/soccer"}, - {0xb6, "/ladybug"}, {0xb6, "/pc"}, - {0x89, "/shit"}, {0x89, "/bb"}, - {0x6e, "/moon"}, {0x6e, "/yl"}, - {0x6b, "/sun"}, {0x6b, "/ty"}, - {0x68, "/gift"}, {0x68, "/lw"}, - {0x7f, "/hug"}, {0x7f, "/yb"}, - {0x6f, "/strong"}, {0x6f, "/qiang"}, {0x6f, "/thumbs_up"}, - {0x70, "/weak"}, {0x70, "/ruo"}, {0x70, "/thumbs_down"}, - {0x88, "/share"}, {0x88, "/ws"}, {0x88, "/handshake"}, - {0xb7, "/@)"}, {0xb7, "/bq"}, - {0xb8, "/jj"}, {0xb8, "/gy"}, - {0xb9, "/@@"}, {0xb9, "/qt"}, - {0xba, "/bad"}, {0xba, "/cj"}, - {0xbb, "/loveu"}, {0xbb, "/aini"}, - {0xbc, "/no"}, {0xbc, "/bu"}, - {0xbd, "/ok"}, {0xbd, "/hd"}, - {0x5c, "/love"}, {0x5c, "/aiq"}, /* after loveu */ - {0x56, "/"}, {0x56, "/fw"}, {0x56, "/blow_kiss"}, - {0x58, "/jump"}, {0x58, "/tiao"}, - {0x5a, "/shake"}, {0x5a, "/fad"}, /* after fade */ - {0x5b, "/"}, {0x5b, "/oh"}, {0x5b, "/angry"}, - {0xbe, "/circle"}, {0xbe, "/zhq"}, - {0xbf, "/kotow"}, {0xbf, "/kt"}, - {0xc0, "/turn"}, {0xc0, "/ht"}, - {0x77, "/:t"}, {0x77, "/tu"}, {0x77, "/vomit"}, /* after turn */ - {0xa0, "/victory"}, {0xa0, "/shl"}, {0xa0, "/v"}, /* end of v */ - {0xc1, "/skip"}, {0xc1, "/tsh"}, - {0xc2, "/oY"}, {0xc2, "/hsh"}, - {0xc3, "/#-O"}, {0xc3, "/jd"}, - {0xc4, "/hiphop"}, {0xc4, "/jw"}, - {0xc5, "/kiss"}, {0xc5, "/xw"}, - {0xc6, "/<&"}, {0xc6, "/ztj"}, - {0x7c, "/pig"}, {0x7c, "/zt"}, /* after ztj */ - {0xc7, "/&>"}, {0xc7, "/ytj"}, /* must be end of "&" */ - {0x75, "/:#"}, {0x75, "/feid"}, {0x75, "/SARS"}, - {0x59, "/go"}, {0x59, "/shan"}, - {0x57, "/find"}, {0x57, "/zhao"}, {0x57, "/search"}, - {0x55, "/&"}, {0x55, "/mm"}, {0x55, "/beautiful_eyebrows"}, - {0x7d, "/cat"}, {0x7d, "/maom"}, - {0x7e, "/dog"}, {0x7e, "/xg"}, - {0x9a, "/$"}, {0x9a, "/qianc"}, {0x9a, "/money"}, - {0x9b, "/(!)"}, {0x9b, "/dp"}, {0x9b, "/lightbulb"}, - {0x60, "/cup"}, {0x60, "/bei"}, - {0x9f, "/music"}, {0x9f, "/yy"}, - {0x82, "/pill"}, {0x82, "/yw"}, - {0x64, "/kiss"}, {0x64, "/wen"}, - {0x83, "/meeting"}, {0x83, "/hy"}, - {0x84, "/phone"}, {0x84, "/dh"}, - {0x85, "/time"}, {0x85, "/sj"}, - {0x86, "/email"}, {0x86, "/yj"}, - {0x87, "/tv"}, {0x87, "/ds"}, - {0x50, "/"}, {0x50, "/dd"}, - {0x51, "/"}, {0x51, "/mn"}, {0x51, "/beauty"}, - {0x52, "/"}, {0x52, "/hl"}, - {0x53, "/"}, {0x53, "/mamao"}, - {0x54, "/"}, {0x54, "/qz"}, {0x54, "/qq"}, - {0x5d, "/"}, {0x5d, "/bj"}, {0x5d, "/baijiu"}, - {0x5f, "/"}, {0x5f, "/qsh"}, {0x5f, "/soda"}, - {0x69, "/"}, {0x69, "/xy"}, {0x69, "/rain"}, - {0x6a, "/<~>"}, {0x6a, "/duoy"}, {0x6a, "/cloudy"}, - {0x6c, "/"}, {0x6c, "/xr"}, {0x6c, "/snowman"}, - {0x6d, "/<*>"}, {0x6d, "/xixing"}, {0x6d, "/star"}, /* after starving */ - {0x71, "/<00>"}, {0x71, "/nv"}, {0x71, "/woman"}, - {0x72, "/<11>"}, {0x72, "/nan"}, {0x72, "/man"}, - {0, NULL} -}; -gint emoticons_std_num = sizeof(emoticons_std) / sizeof(qq_emoticon) - 1; - -/* Map for purple smiley convert to qq, need qsort */ -static qq_emoticon emoticons_ext[] = { - {0xc7, "/&>"}, {0xa5, "/&-("}, - {0xbb, "/loveu"}, - {0x63, "/fade"}, - {0x8f, "/sleepy"}, {0x73, "/sad"}, {0x8e, "/starving"}, - {0xc0, "/turn"}, - {0xa0, "/victory"}, {0x77, "/vomit"}, - {0xc6, "/ztj"}, - {0, NULL} -}; -gint emoticons_ext_num = sizeof(emoticons_ext) / sizeof(qq_emoticon) - 1; - -/* Map for qq smiley convert to purple */ -static qq_emoticon emoticons_sym[] = { - {0x41, "/jy"}, - {0x42, "/pz"}, - {0x43, "/se"}, - {0x44, "/fd"}, - {0x45, "/dy"}, - {0x46, "/ll"}, - {0x47, "/hx"}, - {0x48, "/bz"}, - {0x49, "/shui"}, - {0x4a, "/dk"}, - {0x4b, "/gg"}, - {0x4c, "/fn"}, - {0x4d, "/tp"}, - {0x4e, "/cy"}, - {0x4f, "/wx"}, - {0x50, "/dd"}, - {0x51, "/mn"}, - {0x52, "/hl"}, - {0x53, "/mamao"}, - {0x54, "/qz"}, - {0x55, "/mm"}, - {0x56, "/fw"}, - {0x57, "/zhao"}, - {0x58, "/tiao"}, - {0x59, "/shan"}, - {0x5a, "/fad"}, - {0x5b, "/oh"}, - {0x5c, "/aiq"}, - {0x5d, "/bj"}, - {0x5e, "/zq"}, - {0x5f, "/qsh"}, - {0x60, "/bei"}, - {0x61, "/xig"}, - {0x62, "/mg"}, - {0x63, "/dx"}, - {0x64, "/wen"}, - {0x65, "/xin"}, - {0x66, "/xs"}, - {0x67, "/dg"}, - {0x68, "/lw"}, - {0x69, "/xy"}, - {0x6a, "/duoy"}, - {0x6b, "/ty"}, - {0x6c, "/xr"}, - {0x6d, "/xixing"}, - {0x6e, "/yl"}, - {0x6f, "/qiang"}, - {0x70, "/ruo"}, - {0x71, "/nv"}, - {0x72, "/nan"}, - {0x73, "/ng"}, - {0x74, "/kuk"}, - {0x75, "/feid"}, - {0x76, "/zk"}, - {0x77, "/tu"}, - {0x78, "/jk"}, - {0x79, "/sweat"}, - {0x7a, "/hanx"}, - {0x7b, "/db"}, - {0x7c, "/zt"}, - {0x7d, "/maom"}, - {0x7e, "/xg"}, - {0x7f, "/yb"}, - {0x80, "/coffee"}, - {0x81, "/fan"}, - {0x82, "/yw"}, - {0x83, "/hy"}, - {0x84, "/dh"}, - {0x85, "/sj"}, - {0x86, "/yj"}, - {0x87, "/ds"}, - {0x88, "/ws"}, - {0x89, "/bb"}, - {0x8a, "/tx"}, - {0x8b, "/ka"}, - {0x8c, "/by"}, - {0x8d, "/am"}, - {0x8e, "/jie"}, - {0x8f, "/kun"}, - {0x90, "/fendou"}, - {0x91, "/zhm"}, - {0x92, "/yiw"}, - {0x93, "/xu"}, - {0x94, "/yun"}, - {0x95, "/zhem"}, - {0x96, "/shuai"}, - {0x97, "/kl"}, - {0x98, "/qiao"}, - {0x99, "/zj"}, - {0x9a, "/qianc"}, - {0x9b, "/dp"}, - {0x9c, "/shd"}, - {0x9d, "/zhd"}, - {0x9e, "/dao"}, - {0x9f, "/yy"}, - {0xa0, "/shl"}, - {0xa1, "/lengh"}, - {0xa2, "/wipe"}, - {0xa3, "/kb"}, - {0xa4, "/gz"}, - {0xa5, "/qd"}, - {0xa6, "/huaix"}, - {0xa7, "/zhh"}, - {0xa8, "/yhh"}, - {0xa9, "/hq"}, - {0xaa, "/bs"}, - {0xab, "/wq"}, - {0xac, "/kk"}, - {0xad, "/yx"}, - {0xae, "/qq"}, - {0xaf, "/xia"}, - {0xb0, "/kel"}, - {0xb1, "/cd"}, - {0xb2, "/pj"}, - {0xb3, "/lq"}, - {0xb4, "/pp"}, - {0xb5, "/sa"}, - {0xb6, "/pc"}, - {0xb7, "/bq"}, - {0xb8, "/gy"}, - {0xb9, "/qt"}, - {0xba, "/cj"}, - {0xbb, "/aini"}, - {0xbc, "/bu"}, - {0xbd, "/hd"}, - {0xbe, "/zhq"}, - {0xbf, "/kt"}, - {0xc0, "/ht"}, - {0xc1, "/tsh"}, - {0xc2, "/hsh"}, - {0xc3, "/jd"}, - {0xc4, "/jw"}, - {0xc5, "/xw"}, - {0xc6, "/ztj"}, - {0xc7, "/ytj"}, - {0, NULL} -}; -gint emoticons_sym_num = sizeof(emoticons_sym) / sizeof(qq_emoticon) - 1;; - -static int emoticon_cmp(const void *k1, const void *k2) -{ - const qq_emoticon *e1 = (const qq_emoticon *) k1; - const qq_emoticon *e2 = (const qq_emoticon *) k2; - if (e1->symbol == 0) { - /* purple_debug_info("QQ", "emoticon_cmp len %d\n", strlen(e2->name)); */ - return strncmp(e1->name, e2->name, strlen(e2->name)); - } - if (e2->symbol == 0) { - /* purple_debug_info("QQ", "emoticon_cmp len %d\n", strlen(e1->name)); */ - return strncmp(e1->name, e2->name, strlen(e1->name)); - } - return strcmp(e1->name, e2->name); -} - -static void emoticon_try_sort() -{ - if (emoticons_is_sorted) - return; - - purple_debug_info("QQ", "qsort stand emoticons\n"); - qsort(emoticons_std, emoticons_std_num, sizeof(qq_emoticon), emoticon_cmp); - purple_debug_info("QQ", "qsort extend emoticons\n"); - qsort(emoticons_ext, emoticons_ext_num, sizeof(qq_emoticon), emoticon_cmp); - emoticons_is_sorted = TRUE; -} - -static qq_emoticon *emoticon_find(gchar *name) -{ - qq_emoticon *ret = NULL; - qq_emoticon key; - - g_return_val_if_fail(name != NULL, NULL); - emoticon_try_sort(); - - key.name = name; - key.symbol = 0; - - /* purple_debug_info("QQ", "bsearch emoticon %.20s\n", name); */ - ret = (qq_emoticon *)bsearch(&key, emoticons_ext, emoticons_ext_num, - sizeof(qq_emoticon), emoticon_cmp); - if (ret != NULL) { - return ret; - } - ret = (qq_emoticon *)bsearch(&key, emoticons_std, emoticons_std_num, - sizeof(qq_emoticon), emoticon_cmp); - return ret; -} - -static gchar *emoticon_get(guint8 symbol) -{ - g_return_val_if_fail(symbol >= emoticons_sym[0].symbol, NULL); - g_return_val_if_fail(symbol <= emoticons_sym[emoticons_sym_num - 2].symbol, NULL); - - return emoticons_sym[symbol - emoticons_sym[0].symbol].name; -} - -/* convert qq emote icon to purple sytle - Notice: text is in qq charset, GB18030 or utf8 */ -gchar *qq_emoticon_to_purple(gchar *text) -{ - gchar *ret; - GString *converted; - gchar **segments; - gboolean have_smiley; - gchar *purple_smiley; - gchar *cur; - guint8 symbol; - - /* qq_show_packet("text", (guint8 *)text, strlen(text)); */ - g_return_val_if_fail(text != NULL && strlen(text) != 0, g_strdup("")); - - while ((cur = strchr(text, '\x14')) != NULL) - *cur = '\x15'; - - segments = g_strsplit(text, "\x15", 0); - if(segments == NULL) { - return g_strdup(""); - } - - converted = g_string_new(""); - have_smiley = FALSE; - if (segments[0] != NULL) { - g_string_append(converted, segments[0]); - } else { - purple_debug_info("QQ", "segments[0] is NULL\n"); - } - while ((*(++segments)) != NULL) { - have_smiley = TRUE; - - cur = *segments; - if (cur == NULL) { - purple_debug_info("QQ", "current segment is NULL\n"); - break; - } - if (strlen(cur) == 0) { - purple_debug_info("QQ", "current segment length is 0\n"); - break; - } - symbol = (guint8)cur[0]; - - purple_smiley = emoticon_get(symbol); - if (purple_smiley == NULL) { - purple_debug_info("QQ", "Not found smiley of 0x%02X\n", symbol); - g_string_append(converted, ""); - } else { - purple_debug_info("QQ", "Found 0x%02X smiley is %s\n", symbol, purple_smiley); - g_string_append(converted, purple_smiley); - g_string_append(converted, cur + 1); - } - /* purple_debug_info("QQ", "next segment\n"); */ - } - - /* purple_debug_info("QQ", "end of convert\n"); */ - if (!have_smiley) { - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - ret = converted->str; - g_string_free(converted, FALSE); - return ret; -} - -void qq_im_fmt_free(qq_im_format *fmt) -{ - g_return_if_fail(fmt != NULL); - if (fmt->font) g_free(fmt->font); - g_free(fmt); -} - -qq_im_format *qq_im_fmt_new(void) -{ - qq_im_format *fmt; - const gchar simsun[] = { 0xcb, 0xce, 0xcc, 0xe5, 0}; /* simsun in Chinese */ - - fmt = g_new0(qq_im_format, 1); - memset(fmt, 0, sizeof(qq_im_format)); - fmt->font_len = strlen(simsun); - fmt->font = g_strdup(simsun); - fmt->attr = 10; - /* encoding, 0x8602=GB, 0x0000=EN, define BIG5 support here */ - fmt->charset = 0x8602; - - return fmt; -} - -qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg) -{ - qq_im_format *fmt; - const gchar *start, *end, *last; - GData *attribs; - gchar *tmp; - unsigned char *rgb; - - g_return_val_if_fail(msg != NULL, NULL); - - fmt = qq_im_fmt_new(); - - last = msg; - while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { - tmp = g_datalist_get_data(&attribs, "face"); - if (tmp && strlen(tmp) > 0) { - if (fmt->font) g_free(fmt->font); - fmt->font_len = strlen(tmp); - fmt->font = g_strdup(tmp); - } - - tmp = g_datalist_get_data(&attribs, "size"); - if (tmp) { - fmt->attr = atoi(tmp) * 3 + 1; - fmt->attr &= 0x0f; - } - - tmp = g_datalist_get_data(&attribs, "color"); - if (tmp && strlen(tmp) > 1) { - rgb = purple_base16_decode(tmp + 1, NULL); - g_memmove(fmt->rgb, rgb, 3); - g_free(rgb); - } - - g_datalist_clear(&attribs); - last = end + 1; - } - - if (purple_markup_find_tag("b", msg, &start, &end, &attribs)) { - fmt->attr |= 0x20; - g_datalist_clear(&attribs); - } - - if (purple_markup_find_tag("i", msg, &start, &end, &attribs)) { - fmt->attr |= 0x40; - g_datalist_clear(&attribs); - } - - if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) { - fmt->attr |= 0x80; - g_datalist_clear(&attribs); - } - - return fmt; -} - -/* convert qq format to purple - Notice: text is in qq charset, GB18030 or utf8 */ -gchar *qq_im_fmt_to_purple(qq_im_format *fmt, gchar *text) -{ - GString *converted, *tmp; - gchar *ret; - gint size; - - converted = g_string_new(text); - tmp = g_string_new(""); - g_string_append_printf(tmp, "", - fmt->rgb[0], fmt->rgb[1], fmt->rgb[2]); - g_string_prepend(converted, tmp->str); - g_string_set_size(tmp, 0); - g_string_append(converted, ""); - - /* Fixme: - * check font face can be convert to utf8 or not? - * If failed, prepending font face cause msg display as "(NULL)" */ - if (fmt->font != NULL) { - g_string_append_printf(tmp, "", fmt->font); - g_string_prepend(converted, tmp->str); - g_string_set_size(tmp, 0); - g_string_append(converted, ""); - } - size = (fmt->attr & 0x1f) / 3; - if (size >= 0) { - g_string_append_printf(tmp, "", size); - g_string_prepend(converted, tmp->str); - g_string_set_size(tmp, 0); - g_string_append(converted, ""); - } - if (fmt->attr & 0x20) { - /* bold */ - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - if (fmt->attr & 0x40) { - /* italic */ - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - if (fmt->attr & 0x80) { - /* underline */ - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - - g_string_free(tmp, TRUE); - ret = converted->str; - g_string_free(converted, FALSE); - return ret; -} - -gint qq_put_im_tail(guint8 *buf, qq_im_format *fmt) -{ - gint bytes; - - g_return_val_if_fail(buf != NULL && fmt != NULL, 0); - - bytes = 0; - bytes += qq_put8(buf + bytes, 0); - bytes += qq_put8(buf + bytes, fmt->attr); - bytes += qq_putdata(buf + bytes, fmt->rgb, sizeof(fmt->rgb)); - bytes += qq_put8(buf + bytes, 0); - bytes += qq_put16(buf + bytes, fmt->charset); - if (fmt->font != NULL && fmt->font_len > 0) { - bytes += qq_putdata(buf + bytes, (guint8 *)fmt->font, fmt->font_len); - } else { - purple_debug_warning("QQ", "Font name is empty\n"); - } - bytes += qq_put8(buf + bytes, bytes + 1); - /* qq_show_packet("IM tail", buf, bytes); */ - return bytes; -} - -/* data includes text msg and font attr*/ -gint qq_get_im_tail(qq_im_format *fmt, guint8 *data, gint data_len) -{ - gint bytes, text_len; - guint8 tail_len; - guint8 font_len; - - g_return_val_if_fail(fmt != NULL && data != NULL, 0); - g_return_val_if_fail(data_len > 1, 0); - tail_len = data[data_len - 1]; - g_return_val_if_fail(tail_len > 2, 0); - text_len = data_len - tail_len; - g_return_val_if_fail(text_len >= 0, 0); - - bytes = text_len; - /* qq_show_packet("IM tail", data + bytes, tail_len); */ - bytes += 1; /* skip 0x00 */ - bytes += qq_get8(&fmt->attr, data + bytes); - bytes += qq_getdata(fmt->rgb, sizeof(fmt->rgb), data + bytes); /* red,green,blue */ - bytes += 1; /* skip 0x00 */ - bytes += qq_get16(&fmt->charset, data + bytes); - - font_len = data_len - bytes - 1; - g_return_val_if_fail(font_len > 0, bytes + 1); - - fmt->font_len = font_len; - if (fmt->font != NULL) g_free(fmt->font); - fmt->font = g_strndup((gchar *)data + bytes, fmt->font_len); - return tail_len; -} - -void qq_got_message(PurpleConnection *gc, const gchar *msg) -{ - qq_data *qd; - gchar *from; - time_t now = time(NULL); - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = gc->proto_data; - - g_return_if_fail(qd->uid > 0); - - qq_buddy_find_or_new(gc, qd->uid); - - from = uid_to_purple_name(qd->uid); - serv_got_im(gc, from, msg, PURPLE_MESSAGE_SYSTEM, now); - g_free(from); -} - -/* process received normal text IM */ -static void process_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header) -{ - qq_data *qd; - guint16 purple_msg_type; - gchar *who; - gchar *msg_smiley, *msg_fmt, *msg_utf8; - PurpleBuddy *buddy; - qq_buddy_data *bd; - gint bytes, tail_len; - qq_im_format *fmt = NULL; - - struct { - /* now comes the part for text only */ - guint16 msg_seq; - guint32 send_time; - guint16 sender_icon; - guint8 unknown1[3]; - guint8 has_font_attr; - guint8 fragment_count; - guint8 fragment_index; - guint8 msg_id; - guint8 unknown2; - guint8 msg_type; - gchar *msg; /* no fixed length, ends with 0x00 */ - } im_text; - - g_return_if_fail (data != NULL && len > 0); - g_return_if_fail(im_header != NULL); - - qd = (qq_data *) gc->proto_data; - memset(&im_text, 0, sizeof(im_text)); - - /* qq_show_packet("IM text", data, len); */ - bytes = 0; - bytes += qq_get16(&(im_text.msg_seq), data + bytes); - bytes += qq_get32(&(im_text.send_time), data + bytes); - bytes += qq_get16(&(im_text.sender_icon), data + bytes); - bytes += qq_getdata(im_text.unknown1, sizeof(im_text.unknown1), data + bytes); /* 0x(00 00 00)*/ - bytes += qq_get8(&(im_text.has_font_attr), data + bytes); - bytes += qq_get8(&(im_text.fragment_count), data + bytes); - bytes += qq_get8(&(im_text.fragment_index), data + bytes); - bytes += qq_get8(&(im_text.msg_id), data + bytes); - bytes += 1; /* skip 0x00 */ - bytes += qq_get8(&(im_text.msg_type), data + bytes); - purple_debug_info("QQ", "IM Seq %u, id %04X, fragment %d-%d, type %d, %s\n", - im_text.msg_seq, im_text.msg_id, - im_text.fragment_count, im_text.fragment_index, - im_text.msg_type, - im_text.has_font_attr ? "exist font atrr" : ""); - - if (im_text.has_font_attr) { - fmt = qq_im_fmt_new(); - tail_len = qq_get_im_tail(fmt, data + bytes, len - bytes); - im_text.msg = g_strndup((gchar *)(data + bytes), len - tail_len); - } else { - im_text.msg = g_strndup((gchar *)(data + bytes), len - bytes); - } - /* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg) ); */ - - who = uid_to_purple_name(im_header->uid_from); - buddy = purple_find_buddy(gc->account, who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, im_header->uid_from); - } - bd = (buddy == NULL) ? NULL : purple_buddy_get_protocol_data(buddy); - if (bd != NULL) { - bd->client_tag = im_header->version_from; - bd->face = im_text.sender_icon; - qq_update_buddy_icon(gc->account, who, bd->face); - } - - purple_msg_type = (im_text.msg_type == QQ_IM_AUTO_REPLY) - ? PURPLE_MESSAGE_AUTO_RESP : 0; - - msg_smiley = qq_emoticon_to_purple(im_text.msg); - if (fmt != NULL) { - msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); - msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); - g_free(msg_fmt); - qq_im_fmt_free(fmt); - } else { - msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); - } - g_free(msg_smiley); - - /* send encoded to purple, note that we use im_text.send_time, - * not the time we receive the message - * as it may have been delayed when I am not online. */ - purple_debug_info("QQ", "IM from %u: %s\n", im_header->uid_from,msg_utf8); - serv_got_im(gc, who, msg_utf8, purple_msg_type, (time_t) im_text.send_time); - - g_free(msg_utf8); - g_free(who); - g_free(im_text.msg); -} - -/* process received extended (2007) text IM */ -static void process_extend_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header) -{ - qq_data *qd; - guint16 purple_msg_type; - gchar *who; - gchar *msg_smiley, *msg_fmt, *msg_utf8; - PurpleBuddy *buddy; - qq_buddy_data *bd; - gint bytes, tail_len; - qq_im_format *fmt = NULL; - - struct { - /* now comes the part for text only */ - guint16 msg_seq; - guint32 send_time; - guint16 sender_icon; - guint32 has_font_attr; - guint8 unknown1[8]; - guint8 fragment_count; - guint8 fragment_index; - guint8 msg_id; - guint8 unknown2; - guint8 msg_type; - gchar *msg; /* no fixed length, ends with 0x00 */ - guint8 fromMobileQQ; - } im_text; - - g_return_if_fail (data != NULL && len > 0); - g_return_if_fail(im_header != NULL); - - qd = (qq_data *) gc->proto_data; - memset(&im_text, 0, sizeof(im_text)); - - /* qq_show_packet("Extend IM text", data, len); */ - bytes = 0; - bytes += qq_get16(&(im_text.msg_seq), data + bytes); - bytes += qq_get32(&(im_text.send_time), data + bytes); - bytes += qq_get16(&(im_text.sender_icon), data + bytes); - bytes += qq_get32(&(im_text.has_font_attr), data + bytes); - bytes += qq_getdata(im_text.unknown1, sizeof(im_text.unknown1), data + bytes); - bytes += qq_get8(&(im_text.fragment_count), data + bytes); - bytes += qq_get8(&(im_text.fragment_index), data + bytes); - bytes += qq_get8(&(im_text.msg_id), data + bytes); - bytes += 1; /* skip 0x00 */ - bytes += qq_get8(&(im_text.msg_type), data + bytes); - purple_debug_info("QQ", "IM Seq %u, id %04X, fragment %d-%d, type %d, %s\n", - im_text.msg_seq, im_text.msg_id, - im_text.fragment_count, im_text.fragment_index, - im_text.msg_type, - im_text.has_font_attr ? "exist font atrr" : ""); - - if (im_text.has_font_attr) { - fmt = qq_im_fmt_new(); - tail_len = qq_get_im_tail(fmt, data + bytes, len - bytes); - im_text.msg = g_strndup((gchar *)(data + bytes), len - tail_len); - } else { - im_text.msg = g_strndup((gchar *)(data + bytes), len - bytes); - } - /* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg)); */ - - if(im_text.fragment_count == 0) im_text.fragment_count = 1; - - who = uid_to_purple_name(im_header->uid_from); - buddy = purple_find_buddy(gc->account, who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, im_header->uid_from); - } - bd = (buddy == NULL) ? NULL : purple_buddy_get_protocol_data(buddy); - if (bd != NULL) { - bd->client_tag = im_header->version_from; - bd->face = im_text.sender_icon; - qq_update_buddy_icon(gc->account, who, bd->face); - } - - purple_msg_type = 0; - - msg_smiley = qq_emoticon_to_purple(im_text.msg); - if (fmt != NULL) { - msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); - msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); - g_free(msg_fmt); - qq_im_fmt_free(fmt); - } else { - msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); - } - g_free(msg_smiley); - - /* send encoded to purple, note that we use im_text.send_time, - * not the time we receive the message - * as it may have been delayed when I am not online. */ - serv_got_im(gc, who, msg_utf8, purple_msg_type, (time_t) im_text.send_time); - - g_free(msg_utf8); - g_free(who); - g_free(im_text.msg); -} - -/* it is a normal IM, maybe text or video request */ -void qq_process_im(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes = 0; - qq_im_header im_header; - - g_return_if_fail (data != NULL && len > 0); - - bytes = get_im_header(&im_header, data, len); - if (bytes < 0) { - purple_debug_error("QQ", "Fail read im header, len %d\n", len); - qq_show_packet ("IM Header", data, len); - return; - } - purple_debug_info("QQ", - "Got IM to %u, type: %02X from: %u ver: %s (%04X)\n", - im_header.uid_to, im_header.im_type, im_header.uid_from, - qq_get_ver_desc(im_header.version_from), im_header.version_from); - - switch (im_header.im_type) { - case QQ_NORMAL_IM_TEXT: - if (bytes >= len - 1) { - purple_debug_warning("QQ", "Received normal IM text is empty\n"); - return; - } - process_im_text(gc, data + bytes, len - bytes, &im_header); - break; - case QQ_NORMAL_IM_FILE_REJECT_UDP: - qq_process_recv_file_reject(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_APPROVE_UDP: - qq_process_recv_file_accept(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_UDP: - qq_process_recv_file_request(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_CANCEL: - qq_process_recv_file_cancel(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_NOTIFY: - qq_process_recv_file_notify(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_TCP: - /* Check ReceivedFileIM::parseContents in eva*/ - /* some client use this function for detect invisable buddy*/ - case QQ_NORMAL_IM_FILE_APPROVE_TCP: - case QQ_NORMAL_IM_FILE_REJECT_TCP: - case QQ_NORMAL_IM_FILE_PASV: - case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP: - case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT: - case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL: - case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP: - qq_show_packet ("Not support", data, len); - break; - default: - /* a simple process here, maybe more later */ - qq_show_packet ("Unknow", data + bytes, len - bytes); - return; - } -} - -/* it is a extended IM, maybe text or video request */ -void qq_process_extend_im(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes; - qq_im_header im_header; - - g_return_if_fail (data != NULL && len > 0); - - bytes = get_im_header(&im_header, data, len); - if (bytes < 0) { - purple_debug_error("QQ", "Fail read im header, len %d\n", len); - qq_show_packet ("IM Header", data, len); - return; - } - purple_debug_info("QQ", - "Got Extend IM to %u, type: %02X from: %u ver: %s (%04X)\n", - im_header.uid_to, im_header.im_type, im_header.uid_from, - qq_get_ver_desc(im_header.version_from), im_header.version_from); - - switch (im_header.im_type) { - case QQ_NORMAL_IM_TEXT: - process_extend_im_text(gc, data + bytes, len - bytes, &im_header); - break; - case QQ_NORMAL_IM_FILE_REJECT_UDP: - qq_process_recv_file_reject (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_APPROVE_UDP: - qq_process_recv_file_accept (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_UDP: - qq_process_recv_file_request (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_CANCEL: - qq_process_recv_file_cancel (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_NOTIFY: - qq_process_recv_file_notify (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_TCP: - /* Check ReceivedFileIM::parseContents in eva*/ - /* some client use this function for detect invisable buddy*/ - case QQ_NORMAL_IM_FILE_APPROVE_TCP: - case QQ_NORMAL_IM_FILE_REJECT_TCP: - case QQ_NORMAL_IM_FILE_PASV: - case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP: - case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT: - case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL: - case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP: - qq_show_packet ("Not support", data, len); - break; - default: - /* a simple process here, maybe more later */ - qq_show_packet ("Unknow", data + bytes, len - bytes); - break; - } -} - -/* send an IM to uid_to */ -static void request_send_im(PurpleConnection *gc, guint32 uid_to, gint type, - qq_im_format *fmt, gchar *msg, guint8 id, guint8 frag_count, guint8 frag_index) -{ - qq_data *qd; - guint8 raw_data[MAX_PACKET_SIZE - 16]; - guint16 im_type; - gint bytes; - time_t now; - - qd = (qq_data *) gc->proto_data; - im_type = QQ_NORMAL_IM_TEXT; - - /* purple_debug_info("QQ", "Send IM %d-%d\n", frag_count, frag_index); */ - bytes = 0; - /* 000-003: receiver uid */ - bytes += qq_put32(raw_data + bytes, qd->uid); - /* 004-007: sender uid */ - bytes += qq_put32(raw_data + bytes, uid_to); - /* 008-009: sender client version */ - bytes += qq_put16(raw_data + bytes, qd->client_tag); - /* 010-013: receiver uid */ - bytes += qq_put32(raw_data + bytes, qd->uid); - /* 014-017: sender uid */ - bytes += qq_put32(raw_data + bytes, uid_to); - /* 018-033: md5 of (uid+session_key) */ - bytes += qq_putdata(raw_data + bytes, qd->session_md5, 16); - /* 034-035: message type */ - bytes += qq_put16(raw_data + bytes, QQ_NORMAL_IM_TEXT); - /* 036-037: sequence number */ - bytes += qq_put16(raw_data + bytes, qd->send_seq); - /* 038-041: send time */ - now = time(NULL); - bytes += qq_put32(raw_data + bytes, (guint32) now); - /* 042-043: sender icon */ - bytes += qq_put16(raw_data + bytes, qd->my_icon); - /* 044-046: always 0x00 */ - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, 0x00); - /* 047-047: always use font attr */ - bytes += qq_put8(raw_data + bytes, 0x01); - /* 048-051: always 0x00 */ - /* Fixme: frag_count, frag_index not working now */ - bytes += qq_put8(raw_data + bytes, frag_count); - bytes += qq_put8(raw_data + bytes, frag_index); - bytes += qq_put8(raw_data + bytes, id); - bytes += qq_put8(raw_data + bytes, 0); - /* 052-052: text message type (normal/auto-reply) */ - bytes += qq_put8(raw_data + bytes, type); - /* 053- : msg ends with 0x00 */ - bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); - if (frag_count == frag_index + 1) { - bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ - } - bytes += qq_put_im_tail(raw_data + bytes, fmt); - - /* qq_show_packet("QQ_CMD_SEND_IM", raw_data, bytes); */ - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); -} - -static void im_convert_and_merge(GString *dest, GString *append) -{ - gchar *converted; - g_return_if_fail(dest != NULL && append != NULL); - - if (append->str == NULL || append->len <= 0) { - return; - } - /* purple_debug_info("QQ", "Append:\n%s\n", append->str); */ - converted = utf8_to_qq(append->str, QQ_CHARSET_DEFAULT); - g_string_append(dest, converted); - g_string_set_size(append, 0); - g_free(converted); -} - -GSList *qq_im_get_segments(gchar *msg_stripped, gboolean is_smiley_none) -{ - GSList *string_list = NULL; - GString *new_string; - GString *append_utf8; - gchar *start, *p; - gint count, len; - qq_emoticon *emoticon; - - g_return_val_if_fail(msg_stripped != NULL, NULL); - - start = msg_stripped; - count = 0; - new_string = g_string_new(""); - append_utf8 = g_string_new(""); - while (*start) { - p = start; - - /* Convert emoticon */ - if (!is_smiley_none && *p == '/') { - if (new_string->len + append_utf8->len + 2 > QQ_MSG_IM_MAX) { - /* enough chars to send */ - im_convert_and_merge(new_string, append_utf8); - string_list = g_slist_append(string_list, strdup(new_string->str)); - g_string_set_size(new_string, 0); - continue; - } - emoticon = emoticon_find(p); - if (emoticon != NULL) { - purple_debug_info("QQ", "found emoticon %s as 0x%02X\n", - emoticon->name, emoticon->symbol); - /* QQ emoticon code prevent converting from utf8 to QQ charset - * convert append_utf8 to QQ charset - * merge the result to dest - * append qq QQ emoticon code to dest */ - im_convert_and_merge(new_string, append_utf8); - g_string_append_c(new_string, 0x14); - g_string_append_c(new_string, emoticon->symbol); - start += strlen(emoticon->name); - continue; - } else { - purple_debug_info("QQ", "Not found emoticon %.20s\n", p); - } - } - - /* Get next char */ - start = g_utf8_next_char(p); - len = start - p; - if (new_string->len + append_utf8->len + len > QQ_MSG_IM_MAX) { - /* enough chars to send */ - im_convert_and_merge(new_string, append_utf8); - string_list = g_slist_append(string_list, strdup(new_string->str)); - g_string_set_size(new_string, 0); - } - g_string_append_len(append_utf8, p, len); - } - - if (new_string->len + append_utf8->len > 0) { - im_convert_and_merge(new_string, append_utf8); - string_list = g_slist_append(string_list, strdup(new_string->str)); - } - g_string_free(new_string, TRUE); - g_string_free(append_utf8, TRUE); - return string_list; -} - -gboolean qq_im_smiley_none(const gchar *msg) -{ - const gchar *start, *end, *last; - GData *attribs; - gchar *tmp; - gboolean ret = FALSE; - - g_return_val_if_fail(msg != NULL, TRUE); - - last = msg; - while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { - tmp = g_datalist_get_data(&attribs, "sml"); - if (tmp && strlen(tmp) > 0) { - if (strcmp(tmp, "none") == 0) { - ret = TRUE; - break; - } - } - g_datalist_clear(&attribs); - last = end + 1; - } - return ret; -} - -/* Grab custom emote icons -static GSList* qq_grab_emoticons(const char *msg, const char*username) -{ - GSList *list; - GList *smileys; - PurpleSmiley *smiley; - const char *smiley_shortcut; - char *ptr; - int length; - PurpleStoredImage *img; - - smileys = purple_smileys_get_all(); - length = strlen(msg); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - smiley = smileys->data; - smiley_shortcut = purple_smiley_get_shortcut(smiley); - purple_debug_info("QQ", "Smiley shortcut [%s]\n", smiley_shortcut); - - ptr = g_strstr_len(msg, length, smiley_shortcut); - - if (!ptr) - continue; - - purple_debug_info("QQ", "Found Smiley shortcut [%s]\n", smiley_shortcut); - - img = purple_smiley_get_stored_image(smiley); - - emoticon = g_new0(MsnEmoticon, 1); - emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); - emoticon->obj = msn_object_new_from_image(img, - purple_imgstore_get_filename(img), - username, MSN_OBJECT_EMOTICON); - - purple_imgstore_unref(img); - list = g_slist_prepend(list, emoticon); - } - return list; -} -*/ - -gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *what, PurpleMessageFlags flags) -{ - qq_data *qd; - guint32 uid_to; - gint type; - qq_im_format *fmt; - gchar *msg_stripped, *tmp; - GSList *segments, *it; - gint msg_len; - const gchar *start_invalid; - gboolean is_smiley_none; - guint8 frag_count, frag_index; - guint8 msg_id; - - g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1); - g_return_val_if_fail(who != NULL && what != NULL, -1); - - qd = (qq_data *) gc->proto_data; - purple_debug_info("QQ", "Send IM to %s, len %" G_GSIZE_FORMAT ":\n%s\n", who, strlen(what), what); - - uid_to = purple_name_to_uid(who); - if (uid_to == qd->uid) { - /* if msg is to myself, bypass the network */ - serv_got_im(gc, who, what, flags, time(NULL)); - return 1; - } - - type = (flags == PURPLE_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT); - /* qq_show_packet("IM UTF8", (guint8 *)what, strlen(what)); */ - - msg_stripped = purple_markup_strip_html(what); - g_return_val_if_fail(msg_stripped != NULL, -1); - /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ - - /* Check and valid utf8 string */ - msg_len = strlen(msg_stripped); - g_return_val_if_fail(msg_len > 0, -1); - if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { - if (start_invalid > msg_stripped) { - tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); - g_free(msg_stripped); - msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); - g_free(tmp); - } else { - g_free(msg_stripped); - msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); - } - } - - is_smiley_none = qq_im_smiley_none(what); - segments = qq_im_get_segments(msg_stripped, is_smiley_none); - g_free(msg_stripped); - - if (segments == NULL) { - return -1; - } - - qd->send_im_id++; - msg_id = (guint8)(qd->send_im_id && 0xFF); - fmt = qq_im_fmt_new_by_purple(what); - frag_count = g_slist_length(segments); - frag_index = 0; - for (it = segments; it; it = it->next) { - /* - request_send_im(gc, uid_to, type, fmt, (gchar *)it->data, - msg_id, frag_count, frag_index); - */ - request_send_im(gc, uid_to, type, fmt, (gchar *)it->data, 0, 0, 0); - g_free(it->data); - frag_index++; - } - g_slist_free(segments); - qq_im_fmt_free(fmt); - return 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/im.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -/** - * @file im.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_IM_H_ -#define _QQ_IM_H_ - -#include -#include "connection.h" - -enum { - QQ_MSG_TO_BUDDY = 0x0009, - QQ_MSG_TO_UNKNOWN = 0x000a, - QQ_MSG_SMS = 0x0014, /* not sure */ - QQ_MSG_NEWS = 0x0018, - QQ_MSG_QUN_IM_UNKNOWN = 0x0020, - QQ_MSG_ADD_TO_QUN = 0x0021, - QQ_MSG_DEL_FROM_QUN = 0x0022, - QQ_MSG_APPLY_ADD_TO_QUN = 0x0023, - QQ_MSG_APPROVE_APPLY_ADD_TO_QUN = 0x0024, - QQ_MSG_REJCT_APPLY_ADD_TO_QUN = 0x0025, - QQ_MSG_CREATE_QUN = 0x0026, - QQ_MSG_TEMP_QUN_IM = 0x002A, - QQ_MSG_QUN_IM = 0x002B, - QQ_MSG_SYS_30 = 0x0030, - QQ_MSG_SYS_4C = 0x004C, - QQ_MSG_EXTEND = 0x0084, - QQ_MSG_EXTEND_85 = 0x0085 -}; - -typedef struct { - guint8 attr; - guint8 rgb[3]; - guint16 charset; - gchar *font; /* Attension: font may NULL. font name is in QQ charset */ - guint8 font_len; -} qq_im_format; - -gint qq_put_im_tail(guint8 *buf, qq_im_format *fmt); -gint qq_get_im_tail(qq_im_format *fmt, guint8 *data, gint data_len); - -qq_im_format *qq_im_fmt_new(void); -void qq_im_fmt_free(qq_im_format *fmt); -qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg); -gchar *qq_im_fmt_to_purple(qq_im_format *fmt, gchar *text); -gboolean qq_im_smiley_none(const gchar *msg); -GSList *qq_im_get_segments(gchar *msg_stripped, gboolean is_smiley_none); - -void qq_got_message(PurpleConnection *gc, const gchar *msg); -gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags); - -void qq_process_im(PurpleConnection *gc, guint8 *data, gint len); -void qq_process_extend_im(PurpleConnection *gc, guint8 *data, gint len); - -gchar *qq_emoticon_to_purple(gchar *text); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -QQSOURCES = \ - buddy_info.c \ - buddy_info.h \ - buddy_memo.c \ - buddy_memo.h \ - buddy_list.c \ - buddy_list.h \ - buddy_opt.c \ - buddy_opt.h \ - char_conv.c \ - char_conv.h \ - qq_crypt.c \ - qq_crypt.h \ - file_trans.c \ - file_trans.h \ - group.c \ - group.h \ - group_internal.c \ - group_internal.h \ - group_im.c \ - group_im.h \ - group_info.c \ - group_info.h \ - group_join.c \ - group_join.h \ - group_opt.c \ - group_opt.h \ - qq_define.c \ - qq_define.h \ - im.c \ - im.h \ - qq_process.c \ - qq_process.h \ - qq_base.c \ - qq_base.h \ - packet_parse.c \ - packet_parse.h \ - qq.c \ - qq.h \ - qq_network.c \ - qq_network.h \ - send_file.c \ - send_file.h \ - qq_trans.c \ - qq_trans.h \ - utils.c \ - utils.h - -AM_CFLAGS = $(st) - -libqq_la_LDFLAGS = -module -avoid-version - -if STATIC_QQ - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libqq.la -libqq_la_SOURCES = $(QQSOURCES) -libqq_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libqq.la -libqq_la_SOURCES = $(QQSOURCES) -libqq_la_LIBADD = $(GLIB_LIBS) - -endif - -# QQ_BUDDY_ICON_DIR is the path where a bunch of stock icons can be -# places for users to choose from when setting their buddy icon. We -# don't distribute those icons ourselves because of possibly copyright -# concerns, but distributions might want to put icons here. -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DQQ_BUDDY_ICON_DIR=\"$(datadir)/pixmaps/purple/buddy_icons/qq\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,983 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/qq -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in AUTHORS \ - ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_QQ_FALSE@libqq_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libqq_la_SOURCES_DIST = buddy_info.c buddy_info.h buddy_memo.c \ - buddy_memo.h buddy_list.c buddy_list.h buddy_opt.c buddy_opt.h \ - char_conv.c char_conv.h qq_crypt.c qq_crypt.h file_trans.c \ - file_trans.h group.c group.h group_internal.c group_internal.h \ - group_im.c group_im.h group_info.c group_info.h group_join.c \ - group_join.h group_opt.c group_opt.h qq_define.c qq_define.h \ - im.c im.h qq_process.c qq_process.h qq_base.c qq_base.h \ - packet_parse.c packet_parse.h qq.c qq.h qq_network.c \ - qq_network.h send_file.c send_file.h qq_trans.c qq_trans.h \ - utils.c utils.h -am__objects_1 = libqq_la-buddy_info.lo libqq_la-buddy_memo.lo \ - libqq_la-buddy_list.lo libqq_la-buddy_opt.lo \ - libqq_la-char_conv.lo libqq_la-qq_crypt.lo \ - libqq_la-file_trans.lo libqq_la-group.lo \ - libqq_la-group_internal.lo libqq_la-group_im.lo \ - libqq_la-group_info.lo libqq_la-group_join.lo \ - libqq_la-group_opt.lo libqq_la-qq_define.lo libqq_la-im.lo \ - libqq_la-qq_process.lo libqq_la-qq_base.lo \ - libqq_la-packet_parse.lo libqq_la-qq.lo libqq_la-qq_network.lo \ - libqq_la-send_file.lo libqq_la-qq_trans.lo libqq_la-utils.lo -@STATIC_QQ_FALSE@am_libqq_la_OBJECTS = $(am__objects_1) -@STATIC_QQ_TRUE@am_libqq_la_OBJECTS = $(am__objects_1) -libqq_la_OBJECTS = $(am_libqq_la_OBJECTS) -@STATIC_QQ_FALSE@am_libqq_la_rpath = -rpath $(pkgdir) -@STATIC_QQ_TRUE@am_libqq_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libqq_la_SOURCES) -DIST_SOURCES = $(am__libqq_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -QQSOURCES = \ - buddy_info.c \ - buddy_info.h \ - buddy_memo.c \ - buddy_memo.h \ - buddy_list.c \ - buddy_list.h \ - buddy_opt.c \ - buddy_opt.h \ - char_conv.c \ - char_conv.h \ - qq_crypt.c \ - qq_crypt.h \ - file_trans.c \ - file_trans.h \ - group.c \ - group.h \ - group_internal.c \ - group_internal.h \ - group_im.c \ - group_im.h \ - group_info.c \ - group_info.h \ - group_join.c \ - group_join.h \ - group_opt.c \ - group_opt.h \ - qq_define.c \ - qq_define.h \ - im.c \ - im.h \ - qq_process.c \ - qq_process.h \ - qq_base.c \ - qq_base.h \ - packet_parse.c \ - packet_parse.h \ - qq.c \ - qq.h \ - qq_network.c \ - qq_network.h \ - send_file.c \ - send_file.h \ - qq_trans.c \ - qq_trans.h \ - utils.c \ - utils.h - -AM_CFLAGS = $(st) -libqq_la_LDFLAGS = -module -avoid-version -@STATIC_QQ_FALSE@st = -@STATIC_QQ_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_QQ_TRUE@noinst_LTLIBRARIES = libqq.la -@STATIC_QQ_FALSE@libqq_la_SOURCES = $(QQSOURCES) -@STATIC_QQ_TRUE@libqq_la_SOURCES = $(QQSOURCES) -@STATIC_QQ_TRUE@libqq_la_CFLAGS = $(AM_CFLAGS) -@STATIC_QQ_FALSE@pkg_LTLIBRARIES = libqq.la -@STATIC_QQ_FALSE@libqq_la_LIBADD = $(GLIB_LIBS) - -# QQ_BUDDY_ICON_DIR is the path where a bunch of stock icons can be -# places for users to choose from when setting their buddy icon. We -# don't distribute those icons ourselves because of possibly copyright -# concerns, but distributions might want to put icons here. -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DQQ_BUDDY_ICON_DIR=\"$(datadir)/pixmaps/purple/buddy_icons/qq\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/qq/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/qq/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libqq.la: $(libqq_la_OBJECTS) $(libqq_la_DEPENDENCIES) - $(LINK) $(am_libqq_la_rpath) $(libqq_la_LDFLAGS) $(libqq_la_OBJECTS) $(libqq_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_memo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_opt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-char_conv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-file_trans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_im.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_internal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_join.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_opt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-im.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-packet_parse.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_base.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_crypt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_define.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_network.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_process.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_trans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-send_file.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-utils.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libqq_la-buddy_info.lo: buddy_info.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_info.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_info.Tpo" -c -o libqq_la-buddy_info.lo `test -f 'buddy_info.c' || echo '$(srcdir)/'`buddy_info.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_info.Tpo" "$(DEPDIR)/libqq_la-buddy_info.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_info.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_info.c' object='libqq_la-buddy_info.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_info.lo `test -f 'buddy_info.c' || echo '$(srcdir)/'`buddy_info.c - -libqq_la-buddy_memo.lo: buddy_memo.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_memo.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_memo.Tpo" -c -o libqq_la-buddy_memo.lo `test -f 'buddy_memo.c' || echo '$(srcdir)/'`buddy_memo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_memo.Tpo" "$(DEPDIR)/libqq_la-buddy_memo.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_memo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_memo.c' object='libqq_la-buddy_memo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_memo.lo `test -f 'buddy_memo.c' || echo '$(srcdir)/'`buddy_memo.c - -libqq_la-buddy_list.lo: buddy_list.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_list.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_list.Tpo" -c -o libqq_la-buddy_list.lo `test -f 'buddy_list.c' || echo '$(srcdir)/'`buddy_list.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_list.Tpo" "$(DEPDIR)/libqq_la-buddy_list.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_list.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_list.c' object='libqq_la-buddy_list.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_list.lo `test -f 'buddy_list.c' || echo '$(srcdir)/'`buddy_list.c - -libqq_la-buddy_opt.lo: buddy_opt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_opt.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_opt.Tpo" -c -o libqq_la-buddy_opt.lo `test -f 'buddy_opt.c' || echo '$(srcdir)/'`buddy_opt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_opt.Tpo" "$(DEPDIR)/libqq_la-buddy_opt.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_opt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_opt.c' object='libqq_la-buddy_opt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_opt.lo `test -f 'buddy_opt.c' || echo '$(srcdir)/'`buddy_opt.c - -libqq_la-char_conv.lo: char_conv.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-char_conv.lo -MD -MP -MF "$(DEPDIR)/libqq_la-char_conv.Tpo" -c -o libqq_la-char_conv.lo `test -f 'char_conv.c' || echo '$(srcdir)/'`char_conv.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-char_conv.Tpo" "$(DEPDIR)/libqq_la-char_conv.Plo"; else rm -f "$(DEPDIR)/libqq_la-char_conv.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_conv.c' object='libqq_la-char_conv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-char_conv.lo `test -f 'char_conv.c' || echo '$(srcdir)/'`char_conv.c - -libqq_la-qq_crypt.lo: qq_crypt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_crypt.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_crypt.Tpo" -c -o libqq_la-qq_crypt.lo `test -f 'qq_crypt.c' || echo '$(srcdir)/'`qq_crypt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_crypt.Tpo" "$(DEPDIR)/libqq_la-qq_crypt.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_crypt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_crypt.c' object='libqq_la-qq_crypt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_crypt.lo `test -f 'qq_crypt.c' || echo '$(srcdir)/'`qq_crypt.c - -libqq_la-file_trans.lo: file_trans.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-file_trans.lo -MD -MP -MF "$(DEPDIR)/libqq_la-file_trans.Tpo" -c -o libqq_la-file_trans.lo `test -f 'file_trans.c' || echo '$(srcdir)/'`file_trans.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-file_trans.Tpo" "$(DEPDIR)/libqq_la-file_trans.Plo"; else rm -f "$(DEPDIR)/libqq_la-file_trans.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_trans.c' object='libqq_la-file_trans.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-file_trans.lo `test -f 'file_trans.c' || echo '$(srcdir)/'`file_trans.c - -libqq_la-group.lo: group.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group.Tpo" -c -o libqq_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group.Tpo" "$(DEPDIR)/libqq_la-group.Plo"; else rm -f "$(DEPDIR)/libqq_la-group.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group.c' object='libqq_la-group.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c - -libqq_la-group_internal.lo: group_internal.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_internal.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_internal.Tpo" -c -o libqq_la-group_internal.lo `test -f 'group_internal.c' || echo '$(srcdir)/'`group_internal.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_internal.Tpo" "$(DEPDIR)/libqq_la-group_internal.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_internal.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_internal.c' object='libqq_la-group_internal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_internal.lo `test -f 'group_internal.c' || echo '$(srcdir)/'`group_internal.c - -libqq_la-group_im.lo: group_im.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_im.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_im.Tpo" -c -o libqq_la-group_im.lo `test -f 'group_im.c' || echo '$(srcdir)/'`group_im.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_im.Tpo" "$(DEPDIR)/libqq_la-group_im.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_im.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_im.c' object='libqq_la-group_im.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_im.lo `test -f 'group_im.c' || echo '$(srcdir)/'`group_im.c - -libqq_la-group_info.lo: group_info.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_info.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_info.Tpo" -c -o libqq_la-group_info.lo `test -f 'group_info.c' || echo '$(srcdir)/'`group_info.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_info.Tpo" "$(DEPDIR)/libqq_la-group_info.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_info.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_info.c' object='libqq_la-group_info.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_info.lo `test -f 'group_info.c' || echo '$(srcdir)/'`group_info.c - -libqq_la-group_join.lo: group_join.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_join.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_join.Tpo" -c -o libqq_la-group_join.lo `test -f 'group_join.c' || echo '$(srcdir)/'`group_join.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_join.Tpo" "$(DEPDIR)/libqq_la-group_join.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_join.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_join.c' object='libqq_la-group_join.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_join.lo `test -f 'group_join.c' || echo '$(srcdir)/'`group_join.c - -libqq_la-group_opt.lo: group_opt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_opt.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_opt.Tpo" -c -o libqq_la-group_opt.lo `test -f 'group_opt.c' || echo '$(srcdir)/'`group_opt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_opt.Tpo" "$(DEPDIR)/libqq_la-group_opt.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_opt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_opt.c' object='libqq_la-group_opt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_opt.lo `test -f 'group_opt.c' || echo '$(srcdir)/'`group_opt.c - -libqq_la-qq_define.lo: qq_define.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_define.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_define.Tpo" -c -o libqq_la-qq_define.lo `test -f 'qq_define.c' || echo '$(srcdir)/'`qq_define.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_define.Tpo" "$(DEPDIR)/libqq_la-qq_define.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_define.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_define.c' object='libqq_la-qq_define.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_define.lo `test -f 'qq_define.c' || echo '$(srcdir)/'`qq_define.c - -libqq_la-im.lo: im.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-im.lo -MD -MP -MF "$(DEPDIR)/libqq_la-im.Tpo" -c -o libqq_la-im.lo `test -f 'im.c' || echo '$(srcdir)/'`im.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-im.Tpo" "$(DEPDIR)/libqq_la-im.Plo"; else rm -f "$(DEPDIR)/libqq_la-im.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='im.c' object='libqq_la-im.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-im.lo `test -f 'im.c' || echo '$(srcdir)/'`im.c - -libqq_la-qq_process.lo: qq_process.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_process.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_process.Tpo" -c -o libqq_la-qq_process.lo `test -f 'qq_process.c' || echo '$(srcdir)/'`qq_process.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_process.Tpo" "$(DEPDIR)/libqq_la-qq_process.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_process.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_process.c' object='libqq_la-qq_process.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_process.lo `test -f 'qq_process.c' || echo '$(srcdir)/'`qq_process.c - -libqq_la-qq_base.lo: qq_base.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_base.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_base.Tpo" -c -o libqq_la-qq_base.lo `test -f 'qq_base.c' || echo '$(srcdir)/'`qq_base.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_base.Tpo" "$(DEPDIR)/libqq_la-qq_base.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_base.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_base.c' object='libqq_la-qq_base.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_base.lo `test -f 'qq_base.c' || echo '$(srcdir)/'`qq_base.c - -libqq_la-packet_parse.lo: packet_parse.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-packet_parse.lo -MD -MP -MF "$(DEPDIR)/libqq_la-packet_parse.Tpo" -c -o libqq_la-packet_parse.lo `test -f 'packet_parse.c' || echo '$(srcdir)/'`packet_parse.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-packet_parse.Tpo" "$(DEPDIR)/libqq_la-packet_parse.Plo"; else rm -f "$(DEPDIR)/libqq_la-packet_parse.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='packet_parse.c' object='libqq_la-packet_parse.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-packet_parse.lo `test -f 'packet_parse.c' || echo '$(srcdir)/'`packet_parse.c - -libqq_la-qq.lo: qq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq.Tpo" -c -o libqq_la-qq.lo `test -f 'qq.c' || echo '$(srcdir)/'`qq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq.Tpo" "$(DEPDIR)/libqq_la-qq.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq.c' object='libqq_la-qq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq.lo `test -f 'qq.c' || echo '$(srcdir)/'`qq.c - -libqq_la-qq_network.lo: qq_network.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_network.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_network.Tpo" -c -o libqq_la-qq_network.lo `test -f 'qq_network.c' || echo '$(srcdir)/'`qq_network.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_network.Tpo" "$(DEPDIR)/libqq_la-qq_network.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_network.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_network.c' object='libqq_la-qq_network.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_network.lo `test -f 'qq_network.c' || echo '$(srcdir)/'`qq_network.c - -libqq_la-send_file.lo: send_file.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-send_file.lo -MD -MP -MF "$(DEPDIR)/libqq_la-send_file.Tpo" -c -o libqq_la-send_file.lo `test -f 'send_file.c' || echo '$(srcdir)/'`send_file.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-send_file.Tpo" "$(DEPDIR)/libqq_la-send_file.Plo"; else rm -f "$(DEPDIR)/libqq_la-send_file.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='send_file.c' object='libqq_la-send_file.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-send_file.lo `test -f 'send_file.c' || echo '$(srcdir)/'`send_file.c - -libqq_la-qq_trans.lo: qq_trans.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_trans.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_trans.Tpo" -c -o libqq_la-qq_trans.lo `test -f 'qq_trans.c' || echo '$(srcdir)/'`qq_trans.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_trans.Tpo" "$(DEPDIR)/libqq_la-qq_trans.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_trans.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_trans.c' object='libqq_la-qq_trans.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_trans.lo `test -f 'qq_trans.c' || echo '$(srcdir)/'`qq_trans.c - -libqq_la-utils.lo: utils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-utils.lo -MD -MP -MF "$(DEPDIR)/libqq_la-utils.Tpo" -c -o libqq_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-utils.Tpo" "$(DEPDIR)/libqq_la-utils.Plo"; else rm -f "$(DEPDIR)/libqq_la-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libqq_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of the QQ prpl -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libqq -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += \ - -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = \ - buddy_info.c \ - buddy_list.c \ - buddy_memo.c \ - buddy_opt.c \ - char_conv.c \ - qq_crypt.c \ - file_trans.c \ - group.c \ - group_internal.c \ - group_im.c \ - group_info.c \ - group_join.c \ - group_opt.c \ - qq_define.c \ - im.c \ - packet_parse.c \ - qq.c \ - qq_base.c \ - qq_network.c \ - qq_process.c \ - qq_trans.c \ - send_file.c \ - utils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/** - * @file packet_parse.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include - -#include "packet_parse.h" -#include "debug.h" - -/*------------------------------------------------PUT------------------------------------------------*/ - -/* note: - * 1, in these functions, 'b' stands for byte, 'w' stands for word, 'dw' stands for double word. - * 2, we use '*cursor' and 'buf' as two addresses to calculate the length. - * 3, change 'undef' to 'define' to get more info about the packet parsing. */ - -#undef PARSER_DEBUG - -/* read one byte from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_get8(guint8 *b, guint8 *buf) -{ - guint8 b_dest; - memcpy(&b_dest, buf, sizeof(b_dest)); - *b = b_dest; -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][get8] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][get8] b_dest 0x%2x, *b 0x%02x\n", b_dest, *b); -#endif - return sizeof(b_dest); -} - - -/* read two bytes as "guint16" from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_get16(guint16 *w, guint8 *buf) -{ - guint16 w_dest; - memcpy(&w_dest, buf, sizeof(w_dest)); - *w = g_ntohs(w_dest); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][get16] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][get16] w_dest 0x%04x, *w 0x%04x\n", w_dest, *w); -#endif - return sizeof(w_dest); -} - -/* read four bytes as "guint32" from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_get32(guint32 *dw, guint8 *buf) -{ - guint32 dw_dest; - memcpy(&dw_dest, buf, sizeof(dw_dest)); - *dw = g_ntohl(dw_dest); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][get32] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][get32] dw_dest 0x%08x, *dw 0x%08x\n", dw_dest, *dw); -#endif - return sizeof(dw_dest); -} - -gint qq_getIP(struct in_addr *ip, guint8 *buf) -{ - memcpy(ip, buf, sizeof(struct in_addr)); - return sizeof(struct in_addr); -} - -/* read datalen bytes from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_getdata(guint8 *data, gint datalen, guint8 *buf) -{ - memcpy(data, buf, datalen); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][getdata] buf %p\n", (void *)buf); -#endif - return datalen; -} - - -/* read four bytes as "time_t" from buf, - * return the number of bytes read if succeeds, otherwise return -1 - * This function is a wrapper around read_packet_dw() to avoid casting. */ -gint qq_getime(time_t *t, guint8 *buf) -{ - guint32 dw_dest; - memcpy(&dw_dest, buf, sizeof(dw_dest)); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][getime] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][getime] dw_dest before 0x%08x\n", dw_dest); -#endif - dw_dest = g_ntohl(dw_dest); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][getime] dw_dest after 0x%08x\n", dw_dest); -#endif - memcpy(t, &dw_dest, sizeof(dw_dest)); - return sizeof(dw_dest); -} - -/*------------------------------------------------PUT------------------------------------------------*/ -/* pack one byte into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_put8(guint8 *buf, guint8 b) -{ - memcpy(buf, &b, sizeof(b)); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put8] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put8] b 0x%02x\n", b); -#endif - return sizeof(b); -} - - -/* pack two bytes as "guint16" into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_put16(guint8 *buf, guint16 w) -{ - guint16 w_porter; - w_porter = g_htons(w); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put16] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put16] w 0x%04x, w_porter 0x%04x\n", w, w_porter); -#endif - memcpy(buf, &w_porter, sizeof(w_porter)); - return sizeof(w_porter); -} - - -/* pack four bytes as "guint32" into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_put32(guint8 *buf, guint32 dw) -{ - guint32 dw_porter; - dw_porter = g_htonl(dw); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put32] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter); -#endif - memcpy(buf, &dw_porter, sizeof(dw_porter)); - return sizeof(dw_porter); -} - -gint qq_putime(guint8 *buf, time_t *t) -{ - guint32 dw, dw_porter; - memcpy(&dw, t, sizeof(dw)); - dw_porter = g_htonl(dw); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put32] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter); -#endif - memcpy(buf, &dw_porter, sizeof(dw_porter)); - return sizeof(dw_porter); -} - -gint qq_putIP(guint8* buf, struct in_addr *ip) -{ - memcpy(buf, ip, sizeof(struct in_addr)); - return sizeof(struct in_addr); -} - -/* pack datalen bytes into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_putdata(guint8 *buf, const guint8 *data, const int datalen) -{ - memcpy(buf, data, datalen); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][putdata] buf %p\n", (void *)buf); -#endif - return datalen; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/packet_parse.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/** - * @file packet_parse.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_PACKET_PARSE_H_ -#define _QQ_PACKET_PARSE_H_ - -#include -#include - -/* According to "UNIX Network Programming", all TCP/IP implementations - * must support a minimum IP datagram size of 576 bytes, regardless of the MTU. - * Assuming a 20 byte IP header and 8 byte UDP header, this leaves 548 bytes - * as a safe maximum size for UDP messages. - * - * TCP allows packet 64K - */ -#define MAX_PACKET_SIZE 65535 - -#ifndef _WIN32 -#include -#else -#include "win32dep.h" -#endif - -gint qq_get8(guint8 *b, guint8 *buf); -gint qq_get16(guint16 *w, guint8 *buf); -gint qq_get32(guint32 *dw, guint8 *buf); -gint qq_getIP(struct in_addr *ip, guint8 *buf); -gint qq_getime(time_t *t, guint8 *buf); -gint qq_getdata(guint8 *data, gint datalen, guint8 *buf); - -gint qq_put8(guint8 *buf, guint8 b); -gint qq_put16(guint8 *buf, guint16 w); -gint qq_put32(guint8 *buf, guint32 dw); -gint qq_putIP(guint8* buf, struct in_addr *ip); -gint qq_putime(guint8 *buf, time_t *t); -gint qq_putdata(guint8 *buf, const guint8 *data, const int datalen); - -/* -gint read_packet_b(guint8 *buf, guint8 **cursor, gint buflen, guint8 *b); -gint read_packet_w(guint8 *buf, guint8 **cursor, gint buflen, guint16 *w); -gint read_packet_dw(guint8 *buf, guint8 **cursor, gint buflen, guint32 *dw); -gint read_packet_time(guint8 *buf, guint8 **cursor, gint buflen, time_t *t); -gint read_packet_data(guint8 *buf, guint8 **cursor, gint buflen, guint8 *data, gint datalen); - -gint create_packet_b(guint8 *buf, guint8 **cursor, guint8 b); -gint create_packet_w(guint8 *buf, guint8 **cursor, guint16 w); -gint create_packet_dw(guint8 *buf, guint8 **cursor, guint32 dw); -gint create_packet_data(guint8 *buf, guint8 **cursor, guint8 *data, gint datalen); -*/ - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1489 +0,0 @@ -/** - * @file qq_base.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "server.h" -#include "cipher.h" -#include "request.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "char_conv.h" -#include "qq_crypt.h" -#include "group.h" -#include "qq_define.h" -#include "qq_network.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq.h" -#include "qq_network.h" -#include "utils.h" - -/* generate a md5 key using uid and session_key */ -static void get_session_md5(guint8 *session_md5, guint32 uid, guint8 *session_key) -{ - guint8 src[QQ_KEY_LENGTH + QQ_KEY_LENGTH]; - gint bytes = 0; - - bytes += qq_put32(src + bytes, uid); - bytes += qq_putdata(src + bytes, session_key, QQ_KEY_LENGTH); - - qq_get_md5(session_md5, QQ_KEY_LENGTH, src, bytes); -} - -/* process login reply which says OK */ -static gint8 process_login_ok(PurpleConnection *gc, guint8 *data, gint len) -{ - qq_data *qd; - gint bytes; - - guint8 ret; - guint32 uid; - struct in_addr ip; - guint16 port; - struct tm *tm_local; - - qd = (qq_data *) gc->proto_data; - /* qq_show_packet("Login reply", data, len); */ - - if (len < 148) { - qq_show_packet("Login reply OK, but length < 139", data, len); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt server reply")); - return QQ_LOGIN_REPLY_ERR; - } - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); - get_session_md5(qd->session_md5, qd->uid, qd->session_key); - purple_debug_info("QQ", "Got session_key\n"); - bytes += qq_get32(&uid, data + bytes); - if (uid != qd->uid) { - purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); - } - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - purple_debug_info("QQ", "Internet IP: %s, %d\n", inet_ntoa(qd->my_ip), qd->my_port); - - bytes += qq_getIP(&qd->my_local_ip, data + bytes); - bytes += qq_get16(&qd->my_local_port, data + bytes); - purple_debug_info("QQ", "Local IP: %s, %d\n", inet_ntoa(qd->my_local_ip), qd->my_local_port); - - bytes += qq_getime(&qd->login_time, data + bytes); - tm_local = localtime(&qd->login_time); - purple_debug_info("QQ", "Login time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - /* skip unknown 2 bytes, 0x(03 0a) */ - bytes += 2; - /* skip unknown 24 bytes, maybe token to access Qun shared files */ - bytes += 24; - /* unknow ip and port */ - bytes += qq_getIP(&ip, data + bytes); - bytes += qq_get16(&port, data + bytes); - purple_debug_info("QQ", "Unknow IP: %s, %d\n", inet_ntoa(ip), port); - /* unknow ip and port */ - bytes += qq_getIP(&ip, data + bytes); - bytes += qq_get16(&port, data + bytes); - purple_debug_info("QQ", "Unknow IP: %s, %d\n", inet_ntoa(ip), port); - /* unknown 4 bytes, 0x(00 81 00 00)*/ - bytes += 4; - /* skip unknown 32 bytes, maybe key to access QQ Home */ - bytes += 32; - /* skip unknown 16 bytes, 0x(00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00) */ - bytes += 16; - /* time */ - bytes += qq_getime(&qd->last_login_time[0], data + bytes); - tm_local = localtime(&qd->last_login_time[0]); - purple_debug_info("QQ", "Last login time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - /* unknow time */ - g_return_val_if_fail(sizeof(qd->last_login_time) / sizeof(time_t) > 1, QQ_LOGIN_REPLY_OK); - bytes += qq_getime(&qd->last_login_time[1], data + bytes); - tm_local = localtime(&qd->last_login_time[1]); - purple_debug_info("QQ", "Time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - - g_return_val_if_fail(sizeof(qd->last_login_time) / sizeof(time_t) > 2, QQ_LOGIN_REPLY_OK); - bytes += qq_getime(&qd->last_login_time[2], data + bytes); - tm_local = localtime(&qd->last_login_time[2]); - purple_debug_info("QQ", "Time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - /* unknow 9 bytes, 0x(00 0a 00 0a 01 00 00 0e 10) */ - - if (len > 148) { - qq_show_packet("Login reply OK, but length > 139", data, len); - } - return QQ_LOGIN_REPLY_OK; -} - -/* process login reply packet which includes redirected new server address */ -static gint8 process_login_redirect(PurpleConnection *gc, guint8 *data, gint len) -{ - qq_data *qd; - gint bytes; - struct { - guint8 result; - guint32 uid; - struct in_addr new_server_ip; - guint16 new_server_port; - } packet; - - - if (len < 11) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt server reply")); - return QQ_LOGIN_REPLY_ERR; - } - - qd = (qq_data *) gc->proto_data; - bytes = 0; - /* 000-000: reply code */ - bytes += qq_get8(&packet.result, data + bytes); - /* 001-004: login uid */ - bytes += qq_get32(&packet.uid, data + bytes); - /* 005-008: redirected new server IP */ - bytes += qq_getIP(&packet.new_server_ip, data + bytes); - /* 009-010: redirected new server port */ - bytes += qq_get16(&packet.new_server_port, data + bytes); - - if (len > 11) { - purple_debug_error("QQ", "Login redirect more than expected %d bytes, read %d bytes\n", 11, bytes); - } - - /* redirect to new server, do not disconnect or connect here - * those connect should be called at packet_process */ - qd->redirect_ip.s_addr = packet.new_server_ip.s_addr; - qd->redirect_port = packet.new_server_port; - return QQ_LOGIN_REPLY_REDIRECT; -} - -/* request before login */ -void qq_request_token(PurpleConnection *gc) -{ - qq_data *qd; - guint8 buf[16] = {0}; - gint bytes = 0; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - bytes += qq_put8(buf + bytes, 0); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN, qd->send_seq, buf, bytes, TRUE); -} - -/* send login packet to QQ server */ -void qq_request_login(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - /* for QQ 2005? copy from lumaqq */ - static const guint8 login_23_51[29] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x86, 0xcc, 0x4c, 0x35, - 0x2c, 0xd3, 0x73, 0x6c, 0x14, 0xf6, 0xf6, 0xaf, - 0xc3, 0xfa, 0x33, 0xa4, 0x01 - }; - - static const guint8 login_53_68[16] = { - 0x8D, 0x8B, 0xFA, 0xEC, 0xD5, 0x52, 0x17, 0x4A, - 0x86, 0xF9, 0xA7, 0x75, 0xE6, 0x32, 0xD1, 0x6D - }; - - static const guint8 login_100_bytes[100] = { - 0x40, 0x0B, 0x04, 0x02, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0xE9, 0x03, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF3, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xED, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xEC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0xEE, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0xEF, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0xEB, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - /* now generate the encrypted data - * 000-015 use password_twice_md5 as key to encrypt empty string */ - encrypted_len = qq_encrypt(encrypted, (guint8 *) "", 0, qd->ld.pwd_twice_md5); - g_return_if_fail(encrypted_len == 16); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - - /* 016-016 */ - bytes += qq_put8(raw_data + bytes, 0x00); - /* 017-020, used to be IP, now zero */ - bytes += qq_put32(raw_data + bytes, 0x00000000); - /* 021-022, used to be port, now zero */ - bytes += qq_put16(raw_data + bytes, 0x0000); - /* 023-051, fixed value, unknown */ - bytes += qq_putdata(raw_data + bytes, login_23_51, 29); - /* 052-052, login mode */ - bytes += qq_put8(raw_data + bytes, qd->login_mode); - /* 053-068, fixed value, maybe related to per machine */ - bytes += qq_putdata(raw_data + bytes, login_53_68, 16); - /* 069, login token length */ - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - /* 070-093, login token, normally 24 bytes */ - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - /* 100 bytes unknown */ - bytes += qq_putdata(raw_data + bytes, login_100_bytes, 100); - /* all zero left */ - memset(raw_data + bytes, 0, 416 - bytes); - bytes = 416; - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_LOGIN, qd->send_seq, buf, bytes, TRUE); -} - -guint8 qq_process_token(PurpleConnection *gc, guint8 *buf, gint buf_len) -{ - qq_data *qd; - gint bytes; - guint8 ret; - guint8 token_len; - gchar *msg; - - g_return_val_if_fail(buf != NULL && buf_len != 0, QQ_LOGIN_REPLY_ERR); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&ret, buf + bytes); - bytes += qq_get8(&token_len, buf + bytes); - - if (ret != QQ_LOGIN_REPLY_OK) { - qq_show_packet("Failed requesting token", buf, buf_len); - - msg = g_strdup_printf( _("Failed requesting token, 0x%02X"), ret ); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - msg); - g_free(msg); - return QQ_LOGIN_REPLY_ERR; - } - - if (bytes + token_len < buf_len) { - msg = g_strdup_printf( _("Invalid token len, %d"), token_len); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - msg); - g_free(msg); - return QQ_LOGIN_REPLY_ERR; - } - - if (bytes + token_len > buf_len) { - purple_debug_info("QQ", "Extra token data, %d %d\n", token_len, buf_len - bytes); - } - /* qq_show_packet("Got token", buf + bytes, buf_len - bytes); */ - - if (qd->ld.token != NULL) { - g_free(qd->ld.token); - qd->ld.token = NULL; - qd->ld.token_len = 0; - } - qd->ld.token = g_new0(guint8, token_len); - qd->ld.token_len = token_len; - g_memmove(qd->ld.token, buf + 2, qd->ld.token_len); - return ret; -} - -/* send logout packets to QQ server */ -void qq_request_logout(PurpleConnection *gc) -{ - gint i; - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - for (i = 0; i < 4; i++) - qq_send_cmd(gc, QQ_CMD_LOGOUT, qd->ld.pwd_twice_md5, QQ_KEY_LENGTH); - - qd->is_login = FALSE; /* update login status AFTER sending logout packets */ -} - -/* for QQ 2003iii 0117, fixed value */ -/* static const guint8 login_23_51[29] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xbf, 0x14, 0x11, 0x20, - 0x03, 0x9d, 0xb2, 0xe6, 0xb3, 0x11, 0xb7, 0x13, - 0x95, 0x67, 0xda, 0x2c, 0x01 -}; */ - -/* for QQ 2003iii 0304, fixed value */ -/* -static const guint8 login_23_51[29] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9a, 0x93, 0xfe, 0x85, - 0xd3, 0xd9, 0x2a, 0x41, 0xc8, 0x0d, 0xff, 0xb6, - 0x40, 0xb8, 0xac, 0x32, 0x01 -}; -*/ - -/* fixed value, not affected by version, or mac address */ -/* -static const guint8 login_53_68[16] = { - 0x82, 0x2a, 0x91, 0xfd, 0xa5, 0xca, 0x67, 0x4c, - 0xac, 0x81, 0x1f, 0x6f, 0x52, 0x05, 0xa7, 0xbf -}; -*/ - -/* process the login reply packet */ -guint8 qq_process_login( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - guint8 ret = data[0]; - gchar *msg, *msg_utf8; - gchar *error; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - qd = (qq_data *) gc->proto_data; - - switch (ret) { - case QQ_LOGIN_REPLY_OK: - purple_debug_info("QQ", "Login OK\n"); - return process_login_ok(gc, data, data_len); - case QQ_LOGIN_REPLY_REDIRECT: - purple_debug_info("QQ", "Redirect new server\n"); - return process_login_redirect(gc, data, data_len); - - case 0x0A: /* extend redirect used in QQ2006 */ - error = g_strdup( _("Redirect_EX is not currently supported") ); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0x05: /* invalid password */ - if (!purple_account_get_remember_password(gc->account)) { - purple_account_set_password(gc->account, NULL); - } - error = g_strdup( _("Incorrect password")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0x06: /* need activation */ - error = g_strdup( _("Activation required")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - - default: - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, - ">>> [default] decrypt and dump"); - error = g_strdup_printf( - _("Unknown reply code when logging in (0x%02X)"), - ret ); - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - - msg = g_strndup((gchar *)data + 1, data_len - 1); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - - purple_debug_error("QQ", "%s: %s\n", error, msg_utf8); - purple_connection_error_reason(gc, reason, msg_utf8); - - g_free(error); - g_free(msg); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; -} - -/* send keep-alive packet to QQ server (it is a heart-beat) */ -void qq_request_keep_alive(PurpleConnection *gc) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes= 0; - - qd = (qq_data *) gc->proto_data; - - /* In fact, we can send whatever we like to server - * with this command, server return the same result including - * the amount of online QQ users, my ip and port */ - bytes += qq_put32(raw_data + bytes, qd->uid); - qq_send_cmd(gc, QQ_CMD_KEEP_ALIVE, raw_data, bytes); -} - -/* parse the return ofqq_process_keep_alive keep-alive packet, it includes some system information */ -gboolean qq_process_keep_alive(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gchar **segments; - - g_return_val_if_fail(data != NULL, FALSE); - g_return_val_if_fail(data_len != 0, FALSE); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Keep alive reply packet", data, len); */ - - /* the last one is 60, don't know what it is */ - segments = split_data(data, data_len, "\x1f", 6); - if (segments == NULL) - return TRUE; - - /* segments[0] and segment[1] are all 0x30 ("0") */ - qd->online_total = strtol(segments[2], NULL, 10); - if(0 == qd->online_total) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - } - qd->my_ip.s_addr = inet_addr(segments[3]); - qd->my_port = strtol(segments[4], NULL, 10); - - purple_debug_info("QQ", "keep alive, %s:%d\n", - inet_ntoa(qd->my_ip), qd->my_port); - - g_strfreev(segments); - return TRUE; -} - -void qq_request_keep_alive_2007(PurpleConnection *gc) -{ - qq_data *qd; - guint8 raw_data[32] = {0}; - gint bytes= 0; - gchar *uid_str; - - qd = (qq_data *) gc->proto_data; - - /* In fact, we can send whatever we like to server - * with this command, server return the same result including - * the amount of online QQ users, my ip and port */ - uid_str = g_strdup_printf("%u", qd->uid); - bytes += qq_putdata(raw_data + bytes, (guint8 *)uid_str, strlen(uid_str)); - qq_send_cmd(gc, QQ_CMD_KEEP_ALIVE, raw_data, bytes); - - g_free(uid_str); -} - -gboolean qq_process_keep_alive_2007(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes= 0; - guint8 ret; - - g_return_val_if_fail(data != NULL && data_len != 0, FALSE); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Keep alive reply packet", data, len); */ - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - bytes += qq_get32(&qd->online_total, data + bytes); - if(0 == qd->online_total) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - } - - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - return TRUE; -} - -void qq_request_keep_alive_2008(PurpleConnection *gc) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes= 0; - - qd = (qq_data *) gc->proto_data; - - /* In fact, we can send whatever we like to server - * with this command, server return the same result including - * the amount of online QQ users, my ip and port */ - bytes += qq_put32(raw_data + bytes, qd->uid); - bytes += qq_putime(raw_data + bytes, &qd->login_time); - qq_send_cmd(gc, QQ_CMD_KEEP_ALIVE, raw_data, bytes); -} - -gboolean qq_process_keep_alive_2008(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes= 0; - guint8 ret; - time_t server_time; - struct tm *tm_local; - - g_return_val_if_fail(data != NULL && data_len != 0, FALSE); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Keep alive reply packet", data, len); */ - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - bytes += qq_get32(&qd->online_total, data + bytes); - if(0 == qd->online_total) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - } - - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - /* skip 2 byytes, 0x(00 3c) */ - bytes += 2; - bytes += qq_getime(&server_time, data + bytes); - /* skip 5 bytes, all are 0 */ - - purple_debug_info("QQ", "keep alive, %s:%d\n", - inet_ntoa(qd->my_ip), qd->my_port); - - tm_local = localtime(&server_time); - purple_debug_info("QQ", "Server time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - return TRUE; -} - -/* For QQ2007/2008 */ -void qq_request_get_server(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - raw_data = g_newa(guint8, 128); - memset(raw_data, 0, 128); - - encrypted = g_newa(guint8, 128 + 17); /* 17 bytes more */ - - bytes = 0; - if (qd->redirect == NULL) { - /* first packet to get server */ - qd->redirect_len = 15; - qd->redirect = g_realloc(qd->redirect, qd->redirect_len); - memset(qd->redirect, 0, qd->redirect_len); - } - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_GET_SERVER, qd->send_seq, buf, bytes, TRUE); -} - -guint16 qq_process_get_server(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint16 ret; - - g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - g_return_val_if_fail (data != NULL, QQ_LOGIN_REPLY_ERR); - - /* qq_show_packet("Get Server", data, data_len); */ - bytes = 0; - bytes += qq_get16(&ret, data + bytes); - if (ret == 0) { - /* Notice: do not clear redirect_data here. It will be used in login*/ - qd->redirect_ip.s_addr = 0; - return QQ_LOGIN_REPLY_OK; - } - - if (data_len < 15) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt server reply")); - return QQ_LOGIN_REPLY_ERR; - } - - qd->redirect_len = data_len; - qd->redirect = g_realloc(qd->redirect, qd->redirect_len); - qq_getdata(qd->redirect, qd->redirect_len, data); - /* qq_show_packet("Redirect to", qd->redirect, qd->redirect_len); */ - - qq_getIP(&qd->redirect_ip, data + 11); - purple_debug_info("QQ", "Get server %s\n", inet_ntoa(qd->redirect_ip)); - return QQ_LOGIN_REPLY_REDIRECT; -} - -void qq_request_token_ex(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - bytes += qq_put8(raw_data + bytes, 3); /* Subcommand */ - bytes += qq_put16(raw_data + bytes, 5); - bytes += qq_put32(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, 0); /* fragment index */ - bytes += qq_put16(raw_data + bytes, 0); /* captcha token */ - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN_EX, qd->send_seq, buf, bytes, TRUE); -} - -void qq_request_token_ex_next(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - bytes += qq_put8(raw_data + bytes, 3); /* Subcommand */ - bytes += qq_put16(raw_data + bytes, 5); - bytes += qq_put32(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, qd->captcha.next_index); /* fragment index */ - bytes += qq_put16(raw_data + bytes, qd->captcha.token_len); /* captcha token */ - bytes += qq_putdata(raw_data + bytes, qd->captcha.token, qd->captcha.token_len); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN_EX, qd->send_seq, buf, bytes, TRUE); - - purple_connection_update_progress(gc, _("Requesting captcha"), 3, QQ_CONNECT_STEPS); -} - -static void request_token_ex_code(PurpleConnection *gc, - guint8 *token, guint16 token_len, guint8 *code, guint16 code_len) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - g_return_if_fail(code != NULL && code_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - bytes += qq_put8(raw_data + bytes, 4); /* Subcommand */ - bytes += qq_put16(raw_data + bytes, 5); - bytes += qq_put32(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, code_len); - bytes += qq_putdata(raw_data + bytes, code, code_len); - bytes += qq_put16(raw_data + bytes, qd->ld.token_ex_len); /* login token ex */ - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN_EX, qd->send_seq, buf, bytes, TRUE); - - purple_connection_update_progress(gc, _("Checking captcha"), 3, QQ_CONNECT_STEPS); -} - -typedef struct { - PurpleConnection *gc; - guint8 *token; - guint16 token_len; -} qq_captcha_request; - -static void captcha_request_destory(qq_captcha_request *captcha_req) -{ - g_return_if_fail(captcha_req != NULL); - if (captcha_req->token) g_free(captcha_req->token); - g_free(captcha_req); -} - -static void captcha_input_cancel_cb(qq_captcha_request *captcha_req, - PurpleRequestFields *fields) -{ - captcha_request_destory(captcha_req); - - purple_connection_error_reason(captcha_req->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Failed captcha verification")); -} - -static void captcha_input_ok_cb(qq_captcha_request *captcha_req, - PurpleRequestFields *fields) -{ - gchar *code; - - g_return_if_fail(captcha_req != NULL && captcha_req->gc != NULL); - - code = utf8_to_qq( - purple_request_fields_get_string(fields, "captcha_code"), - QQ_CHARSET_DEFAULT); - - if (strlen(code) <= 0) { - captcha_input_cancel_cb(captcha_req, fields); - return; - } - - request_token_ex_code(captcha_req->gc, - captcha_req->token, captcha_req->token_len, - (guint8 *)code, strlen(code)); - - captcha_request_destory(captcha_req); -} - -void qq_captcha_input_dialog(PurpleConnection *gc,qq_captcha_data *captcha) -{ - PurpleAccount *account; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - qq_captcha_request *captcha_req; - - g_return_if_fail(captcha->token != NULL && captcha->token_len > 0); - g_return_if_fail(captcha->data != NULL && captcha->data_len > 0); - - captcha_req = g_new0(qq_captcha_request, 1); - captcha_req->gc = gc; - captcha_req->token = g_new0(guint8, captcha->token_len); - g_memmove(captcha_req->token, captcha->token, captcha->token_len); - captcha_req->token_len = captcha->token_len; - - account = purple_connection_get_account(gc); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_image_new("captcha_img", - _("Captcha Image"), (char *)captcha->data, captcha->data_len); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("captcha_code", - _("Enter code"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(account, - _("QQ Captcha Verification"), - _("QQ Captcha Verification"), - _("Enter the text from the image"), - fields, - _("OK"), G_CALLBACK(captcha_input_ok_cb), - _("Cancel"), G_CALLBACK(captcha_input_cancel_cb), - purple_connection_get_account(gc), NULL, NULL, - captcha_req); -} - -guint8 qq_process_token_ex(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - int bytes; - guint8 ret; - guint8 sub_cmd; - guint8 reply; - guint16 captcha_len; - guint8 curr_index; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - ret = data[0]; - - bytes = 0; - bytes += qq_get8(&sub_cmd, data + bytes); /* 03: ok; 04: need verifying */ - bytes += 2; /* 0x(00 05) */ - bytes += qq_get8(&reply, data + bytes); - - bytes += qq_get16(&(qd->ld.token_ex_len), data + bytes); - qd->ld.token_ex = g_realloc(qd->ld.token_ex, qd->ld.token_ex_len); - bytes += qq_getdata(qd->ld.token_ex, qd->ld.token_ex_len, data + bytes); - /* qq_show_packet("Get token ex", qd->ld.token_ex, qd->ld.token_ex_len); */ - - if(reply != 1) - { - purple_debug_info("QQ", "Captcha verified, result %d\n", reply); - return QQ_LOGIN_REPLY_OK; - } - - bytes += qq_get16(&captcha_len, data + bytes); - - qd->captcha.data = g_realloc(qd->captcha.data, qd->captcha.data_len + captcha_len); - bytes += qq_getdata(qd->captcha.data + qd->captcha.data_len, captcha_len, data + bytes); - qd->captcha.data_len += captcha_len; - - bytes += qq_get8(&curr_index, data + bytes); - bytes += qq_get8(&qd->captcha.next_index, data + bytes); - - bytes += qq_get16(&qd->captcha.token_len, data + bytes); - qd->captcha.token = g_realloc(qd->captcha.token, qd->captcha.token_len); - bytes += qq_getdata(qd->captcha.token, qd->captcha.token_len, data + bytes); - /* qq_show_packet("Get captcha token", qd->captcha.token, qd->captcha.token_len); */ - - purple_debug_info("QQ", "Request next captcha %d, new %d, total %d\n", - qd->captcha.next_index, captcha_len, qd->captcha.data_len); - if(qd->captcha.next_index > 0) - { - return QQ_LOGIN_REPLY_NEXT_TOKEN_EX; - } - - return QQ_LOGIN_REPLY_CAPTCHA_DLG; -} - -/* source copy from gg's common.c */ -static guint32 crc32_table[256]; -static int crc32_initialized = 0; - -static void crc32_make_table() -{ - guint32 h = 1; - unsigned int i, j; - - memset(crc32_table, 0, sizeof(crc32_table)); - - for (i = 128; i; i >>= 1) { - h = (h >> 1) ^ ((h & 1) ? 0xedb88320L : 0); - - for (j = 0; j < 256; j += 2 * i) - crc32_table[i + j] = crc32_table[j] ^ h; - } - - crc32_initialized = 1; -} - -static guint32 crc32(guint32 crc, const guint8 *buf, int len) -{ - if (!crc32_initialized) - crc32_make_table(); - - if (!buf || len < 0) - return crc; - - crc ^= 0xffffffffL; - - while (len--) - crc = (crc >> 8) ^ crc32_table[(crc ^ *buf++) & 0xff]; - - return crc ^ 0xffffffffL; -} - -void qq_request_check_pwd(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - static guint8 header[] = { - 0x00, 0x5F, 0x00, 0x00, 0x08, 0x04, 0x01, 0xE0 - }; - static guint8 unknown[] = { - 0xDB, 0xB9, 0xF3, 0x0B, 0xF9, 0x13, 0x87, 0xB2, - 0xE6, 0x20, 0x43, 0xBE, 0x53, 0xCA, 0x65, 0x03 - }; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token_ex != NULL && qd->ld.token_ex_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - /* Encrypted password and put in encrypted */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, qd->ld.pwd_md5, sizeof(qd->ld.pwd_md5)); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, rand() & 0xffff); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.pwd_twice_md5); - - /* create packet */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, header, sizeof(header)); - /* token get from qq_request_token_ex */ - bytes += qq_put8(raw_data + bytes, (guint8)(qd->ld.token_ex_len & 0xff)); - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - /* password encrypted */ - bytes += qq_put16(raw_data + bytes, encrypted_len); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* len of unknown + len of CRC32 */ - bytes += qq_put16(raw_data + bytes, sizeof(unknown) + 4); - bytes += qq_putdata(raw_data + bytes, unknown, sizeof(unknown)); - bytes += qq_put32( - raw_data + bytes, crc32(0xFFFFFFFF, unknown, sizeof(unknown))); - - /* put length into first 2 bytes */ - qq_put8(raw_data + 1, bytes - 2); - - /* tail */ - bytes += qq_put16(raw_data + bytes, 0x0003); - bytes += qq_put8(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, qd->ld.pwd_md5[1]); - bytes += qq_put8(raw_data + bytes, qd->ld.pwd_md5[2]); - - /* qq_show_packet("Check password", raw_data, bytes); */ - /* Encrypted by random key*/ - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_CHECK_PWD, qd->send_seq, buf, bytes, TRUE); -} - -guint8 qq_process_check_pwd( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - int bytes; - guint8 ret; - gchar *error = NULL; - guint16 unknow_token_len; - gchar *msg, *msg_utf8; - guint16 msg_len; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Check password reply", data, data_len); */ - - bytes = 0; - bytes += qq_get16(&unknow_token_len, data + bytes); /* maybe total length */ - bytes += qq_get8(&ret, data + bytes); - bytes += 4; /* 0x(00 00 6d b9) */ - /* unknow_token_len may 0 when not reply ok*/ - bytes += qq_get16(&unknow_token_len, data + bytes); /* 0x0020 */ - bytes += unknow_token_len; - bytes += qq_get16(&unknow_token_len, data + bytes); /* 0x0020 */ - bytes += unknow_token_len; - - if (ret == 0) { - /* get login_token */ - bytes += qq_get16(&qd->ld.login_token_len, data + bytes); - if (qd->ld.login_token != NULL) g_free(qd->ld.login_token); - qd->ld.login_token = g_new0(guint8, qd->ld.login_token_len); - bytes += qq_getdata(qd->ld.login_token, qd->ld.login_token_len, data + bytes); - /* qq_show_packet("Get login token", qd->ld.login_token, qd->ld.login_token_len); */ - - /* get login_key */ - bytes += qq_getdata(qd->ld.login_key, sizeof(qd->ld.login_key), data + bytes); - /* qq_show_packet("Get login key", qd->ld.login_key, sizeof(qd->ld.login_key)); */ - return QQ_LOGIN_REPLY_OK; - } - - switch (ret) - { - case 0x34: /* invalid password */ - if (!purple_account_get_remember_password(gc->account)) { - purple_account_set_password(gc->account, NULL); - } - error = g_strdup(_("Incorrect password")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0x33: /* need activation */ - case 0x51: /* need activation */ - error = g_strdup(_("Activation required")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0xBF: /* uid is not exist */ - error = g_strdup(_("Username does not exist")); - reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - default: - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, - ">>> [default] decrypt and dump"); - error = g_strdup_printf( - _("Unknown reply when checking password (0x%02X)"), - ret ); - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - - bytes += qq_get16(&msg_len, data + bytes); - - msg = g_strndup((gchar *)data + bytes, msg_len); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - - purple_debug_error("QQ", "%s: %s\n", error, msg_utf8); - purple_connection_error_reason(gc, reason, msg_utf8); - - g_free(error); - g_free(msg); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; -} - -void qq_request_login_2007(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - static const guint8 login_1_16[] = { - 0x56, 0x4E, 0xC8, 0xFB, 0x0A, 0x4F, 0xEF, 0xB3, - 0x7A, 0x5D, 0xD8, 0x86, 0x0F, 0xAC, 0xE5, 0x1A - }; - static const guint8 login_2_16[] = { - 0x5E, 0x22, 0x3A, 0xBE, 0x13, 0xBF, 0xDA, 0x4C, - 0xA9, 0xB7, 0x0B, 0x43, 0x63, 0x51, 0x8E, 0x28 - }; - static const guint8 login_3_83[] = { - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x40, 0x01, 0x01, 0x58, 0x83, - 0xD0, 0x00, 0x10, 0x9D, 0x14, 0x64, 0x0A, 0x2E, - 0xE2, 0x11, 0xF7, 0x90, 0xF0, 0xB5, 0x5F, 0x16, - 0xFB, 0x41, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x76, 0x3C, 0xEE, - 0x4A, 0x00, 0x10, 0x86, 0x81, 0xAD, 0x1F, 0xC8, - 0xC9, 0xCC, 0xCF, 0xCA, 0x9F, 0xFF, 0x88, 0xC0, - 0x5C, 0x88, 0xD5 - }; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - /* Encrypted password and put in encrypted */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, qd->ld.pwd_md5, sizeof(qd->ld.pwd_md5)); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, 0xffff); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.pwd_twice_md5); - - /* create packet */ - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); /* Unknow */ - /* password encrypted */ - bytes += qq_put16(raw_data + bytes, encrypted_len); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* put data which NULL string encrypted by key pwd_twice_md5 */ - encrypted_len = qq_encrypt(encrypted, (guint8 *) "", 0, qd->ld.pwd_twice_md5); - g_return_if_fail(encrypted_len == 16); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* unknow fill 0 */ - memset(raw_data + bytes, 0, 19); - bytes += 19; - bytes += qq_putdata(raw_data + bytes, login_1_16, sizeof(login_1_16)); - - bytes += qq_put8(raw_data + bytes, rand() & 0xff); - bytes += qq_put8(raw_data + bytes, qd->login_mode); - /* unknow 10 bytes zero filled*/ - memset(raw_data + bytes, 0, 10); - bytes += 10; - /* redirect data, 15 bytes */ - /* qq_show_packet("Redirect", qd->redirect, qd->redirect_len); */ - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_2_16, sizeof(login_2_16)); - /* captcha token get from qq_process_token_ex */ - bytes += qq_put8(raw_data + bytes, (guint8)(qd->ld.token_ex_len & 0xff)); - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_3_83, sizeof(login_3_83)); - memset(raw_data + bytes, 0, 332 - sizeof(login_3_83)); - bytes += 332 - sizeof(login_3_83); - - /* qq_show_packet("Login", raw_data, bytes); */ - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.login_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - /* logint token get from qq_process_check_pwd_2007 */ - bytes += qq_put16(buf + bytes, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, qd->ld.login_token, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_LOGIN, qd->send_seq, buf, bytes, TRUE); -} - -/* process the login reply packet */ -guint8 qq_process_login_2007( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint8 ret; - guint32 uid; - gchar *error; - gchar *msg; - gchar *msg_utf8; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - if (ret != 0) { - msg = g_strndup((gchar *)data + bytes, data_len - bytes); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - - switch (ret) { - case 0x05: - purple_debug_error("QQ", "Server busy for %s\n", msg_utf8); - return QQ_LOGIN_REPLY_REDIRECT; - case 0x0A: - /* 0a 2d 9a 4b 9a 01 01 00 00 00 05 00 00 00 00 79 0e 5f fd */ - /* Missing get server before login*/ - default: - error = g_strdup_printf( - _("Unknown reply code when logging in (0x%02X):\n%s"), - ret, msg_utf8); - break; - } - - purple_debug_error("QQ", "%s\n", error); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - error); - - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, error); - - g_free(error); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; - } - - bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); - purple_debug_info("QQ", "Got session_key\n"); - get_session_md5(qd->session_md5, qd->uid, qd->session_key); - - bytes += qq_get32(&uid, data + bytes); - if (uid != qd->uid) { - purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); - } - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - bytes += qq_getIP(&qd->my_local_ip, data + bytes); - bytes += qq_get16(&qd->my_local_port, data + bytes); - bytes += qq_getime(&qd->login_time, data + bytes); - /* skip unknow 50 byte */ - bytes += 50; - /* skip client key 32 byte */ - bytes += 32; - /* skip unknow 12 byte */ - bytes += 12; - /* last login */ - bytes += qq_getIP(&qd->last_login_ip, data + bytes); - bytes += qq_getime(&qd->last_login_time[0], data + bytes); - purple_debug_info("QQ", "Last Login: %s, %s\n", - inet_ntoa(qd->last_login_ip), ctime(&qd->last_login_time[0])); - return QQ_LOGIN_REPLY_OK; -} - -void qq_request_login_2008(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - guint8 index, count; - - static const guint8 login_1_16[] = { - 0xD2, 0x41, 0x75, 0x12, 0xC2, 0x86, 0x57, 0x10, - 0x78, 0x57, 0xDC, 0x24, 0x8C, 0xAA, 0x8F, 0x4E - }; - - static const guint8 login_2_16[] = { - 0x94, 0x0B, 0x73, 0x7A, 0xA2, 0x51, 0xF0, 0x4B, - 0x95, 0x2F, 0xC6, 0x0A, 0x5B, 0xF6, 0x76, 0x52 - }; - static const guint8 login_3_18[] = { - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x40, 0x01, 0x1b, 0x02, 0x84, - 0x50, 0x00 - }; - static const guint8 login_4_16[] = { - 0x2D, 0x49, 0x15, 0x55, 0x78, 0xFC, 0xF3, 0xD4, - 0x53, 0x55, 0x60, 0x9C, 0x37, 0x9F, 0xE9, 0x59 - }; - static const guint8 login_5_6[] = { - 0x02, 0x68, 0xe8, 0x07, 0x83, 0x00 - }; - static const guint8 login_6_16[] = { - 0x3B, 0xCE, 0x43, 0xF1, 0x8B, 0xA4, 0x2B, 0xB5, - 0xB3, 0x51, 0x57, 0xF7, 0x06, 0x4B, 0x18, 0xFC - }; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - /* Encrypted password and put in encrypted */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, qd->ld.pwd_md5, sizeof(qd->ld.pwd_md5)); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, 0xffff); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.pwd_twice_md5); - - /* create packet */ - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); /* Unknow */ - /* password encrypted */ - bytes += qq_put16(raw_data + bytes, encrypted_len); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* put data which NULL string encrypted by key pwd_twice_md5 */ - encrypted_len = qq_encrypt(encrypted, (guint8 *) "", 0, qd->ld.pwd_twice_md5); - g_return_if_fail(encrypted_len == 16); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* unknow 19 bytes zero filled*/ - memset(raw_data + bytes, 0, 19); - bytes += 19; - bytes += qq_putdata(raw_data + bytes, login_1_16, sizeof(login_1_16)); - - index = rand() % 3; /* can be set as 1 */ - for( count = 0; count < encrypted_len; count++ ) - index ^= encrypted[count]; - for( count = 0; count < sizeof(login_1_16); count++ ) - index ^= login_1_16[count]; - bytes += qq_put8(raw_data + bytes, index); /* random in QQ 2007*/ - - bytes += qq_put8(raw_data + bytes, qd->login_mode); - /* unknow 10 bytes zero filled*/ - memset(raw_data + bytes, 0, 10); - bytes += 10; - /* redirect data, 15 bytes */ - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_2_16, sizeof(login_2_16)); - /* captcha token get from qq_process_token_ex */ - bytes += qq_put8(raw_data + bytes, (guint8)(qd->ld.token_ex_len & 0xff)); - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_3_18, sizeof(login_3_18)); - bytes += qq_put8(raw_data + bytes , sizeof(login_4_16)); - bytes += qq_putdata(raw_data + bytes, login_4_16, sizeof(login_4_16)); - /* unknow 10 bytes zero filled*/ - memset(raw_data + bytes, 0, 10); - bytes += 10; - /* redirect data, 15 bytes */ - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_5_6, sizeof(login_5_6)); - bytes += qq_put8(raw_data + bytes , sizeof(login_6_16)); - bytes += qq_putdata(raw_data + bytes, login_6_16, sizeof(login_6_16)); - /* unknow 249 bytes zero filled*/ - memset(raw_data + bytes, 0, 249); - bytes += 249; - - /* qq_show_packet("Login request", raw_data, bytes); */ - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.login_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - /* logint token get from qq_process_check_pwd_2007 */ - bytes += qq_put16(buf + bytes, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, qd->ld.login_token, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_LOGIN, qd->send_seq, buf, bytes, TRUE); -} - -guint8 qq_process_login_2008( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint8 ret; - guint32 uid; - gchar *error; - gchar *msg; - gchar *msg_utf8; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - if (ret != 0) { - msg = g_strndup((gchar *)data + bytes, data_len - bytes); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - - switch (ret) { - case 0x05: - purple_debug_error("QQ", "Server busy for %s\n", msg_utf8); - return QQ_LOGIN_REPLY_REDIRECT; - break; - default: - error = g_strdup_printf( - _("Unknown reply code when logging in (0x%02X):\n%s"), - ret, msg_utf8); - break; - } - - purple_debug_error("QQ", "%s\n", error); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - error); - - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, error); - - g_free(error); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; - } - - bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); - purple_debug_info("QQ", "Got session_key\n"); - get_session_md5(qd->session_md5, qd->uid, qd->session_key); - - bytes += qq_get32(&uid, data + bytes); - if (uid != qd->uid) { - purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); - } - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - bytes += qq_getIP(&qd->my_local_ip, data + bytes); - bytes += qq_get16(&qd->my_local_port, data + bytes); - bytes += qq_getime(&qd->login_time, data + bytes); - /* skip 1 byte, always 0x03 */ - /* skip 1 byte, login mode */ - bytes = 131; - bytes += qq_getIP(&qd->last_login_ip, data + bytes); - bytes += qq_getime(&qd->last_login_time[0], data + bytes); - purple_debug_info("QQ", "Last Login: %s, %s\n", - inet_ntoa(qd->last_login_ip), ctime(&qd->last_login_time[0])); - return QQ_LOGIN_REPLY_OK; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_base.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/** - * file qq_base.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BASE_H_ -#define _QQ_BASE_H_ - -#include -#include "connection.h" - -#define QQ_LOGIN_REPLY_OK 0x00 -#define QQ_LOGIN_REPLY_REDIRECT 0x01 -/* defined by myself */ -#define QQ_LOGIN_REPLY_CAPTCHA_DLG 0xfd -#define QQ_LOGIN_REPLY_NEXT_TOKEN_EX 0xfe -#define QQ_LOGIN_REPLY_ERR 0xff - -#define QQ_LOGIN_MODE_NORMAL 0x0a -#define QQ_LOGIN_MODE_AWAY 0x1e -#define QQ_LOGIN_MODE_HIDDEN 0x28 - -#define QQ_UPDATE_ONLINE_INTERVAL 300 /* in sec */ - -void qq_request_token(PurpleConnection *gc); -guint8 qq_process_token(PurpleConnection *gc, guint8 *buf, gint buf_len); - -void qq_request_login(PurpleConnection *gc); -guint8 qq_process_login( PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_logout(PurpleConnection *gc); - -void qq_request_keep_alive(PurpleConnection *gc); -gboolean qq_process_keep_alive(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_keep_alive_2007(PurpleConnection *gc); -gboolean qq_process_keep_alive_2007(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_keep_alive_2008(PurpleConnection *gc); -gboolean qq_process_keep_alive_2008(guint8 *data, gint data_len, PurpleConnection *gc); - -/* for QQ2007/2008 */ -void qq_request_get_server(PurpleConnection *gc); -guint16 qq_process_get_server(PurpleConnection *gc, guint8 *rcved, gint rcved_len); - -void qq_request_token_ex(PurpleConnection *gc); -void qq_request_token_ex_next(PurpleConnection *gc); -guint8 qq_process_token_ex(PurpleConnection *gc, guint8 *buf, gint buf_len); -void qq_captcha_input_dialog(PurpleConnection *gc,qq_captcha_data *captcha); - -void qq_request_check_pwd(PurpleConnection *gc); -guint8 qq_process_check_pwd( PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_login_2007(PurpleConnection *gc); -guint8 qq_process_login_2007( PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_login_2008(PurpleConnection *gc); -guint8 qq_process_login_2008( PurpleConnection *gc, guint8 *data, gint data_len); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1161 +0,0 @@ -/** - * @file qq.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "prpl.h" -#include "privacy.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -#include "buddy_info.h" -#include "buddy_memo.h" -#include "buddy_opt.h" -#include "buddy_list.h" -#include "char_conv.h" -#include "group.h" -#include "group_im.h" -#include "group_info.h" -#include "group_join.h" -#include "group_opt.h" -#include "group_internal.h" -#include "qq_define.h" -#include "im.h" -#include "qq_process.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq.h" -#include "qq_network.h" -#include "send_file.h" -#include "utils.h" -#include "version.h" - -#define OPENQ_VERSION "0.3.2-p20" - -static GList *server_list_build(gchar select) -{ - GList *list = NULL; - - if ( select == 'T' || select == 'A') { - list = g_list_append(list, "tcpconn.tencent.com:8000"); - list = g_list_append(list, "tcpconn2.tencent.com:8000"); - list = g_list_append(list, "tcpconn3.tencent.com:8000"); - list = g_list_append(list, "tcpconn4.tencent.com:8000"); - list = g_list_append(list, "tcpconn5.tencent.com:8000"); - list = g_list_append(list, "tcpconn6.tencent.com:8000"); - } - if ( select == 'U' || select == 'A') { - list = g_list_append(list, "sz.tencent.com:8000"); - list = g_list_append(list, "sz2.tencent.com:8000"); - list = g_list_append(list, "sz3.tencent.com:8000"); - list = g_list_append(list, "sz4.tencent.com:8000"); - list = g_list_append(list, "sz5.tencent.com:8000"); - list = g_list_append(list, "sz6.tencent.com:8000"); - list = g_list_append(list, "sz7.tencent.com:8000"); - list = g_list_append(list, "sz8.tencent.com:8000"); - list = g_list_append(list, "sz9.tencent.com:8000"); - } - return list; -} - -static void server_list_create(PurpleAccount *account) -{ - PurpleConnection *gc; - qq_data *qd; - PurpleProxyInfo *gpi; - const gchar *custom_server; - - gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = gc->proto_data; - - gpi = purple_proxy_get_setup(account); - - qd->use_tcp = purple_account_get_bool(account, "use_tcp", TRUE); - - custom_server = purple_account_get_string(account, "server", NULL); - - if (custom_server != NULL) { - purple_debug_info("QQ", "Select server '%s'\n", custom_server); - if (*custom_server != '\0' && g_ascii_strcasecmp(custom_server, "auto") != 0) { - qd->servers = g_list_append(qd->servers, g_strdup(custom_server)); - return; - } - } - - if (qd->use_tcp) { - qd->servers = server_list_build('T'); - return; - } - - qd->servers = server_list_build('U'); -} - -static void server_list_remove_all(qq_data *qd) -{ - g_return_if_fail(qd != NULL); - - purple_debug_info("QQ", "free server list\n"); - g_list_free(qd->servers); - qd->curr_server = NULL; -} - -static void qq_login(PurpleAccount *account) -{ - PurpleConnection *gc; - qq_data *qd; - PurplePresence *presence; - const gchar *version_str; - - g_return_if_fail(account != NULL); - - gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL); - - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_AUTO_RESP; - - qd = g_new0(qq_data, 1); - memset(qd, 0, sizeof(qq_data)); - qd->gc = gc; - gc->proto_data = qd; - - presence = purple_account_get_presence(account); - if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { - qd->login_mode = QQ_LOGIN_MODE_HIDDEN; - } else if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY)) { - qd->login_mode = QQ_LOGIN_MODE_AWAY; - } else { - qd->login_mode = QQ_LOGIN_MODE_NORMAL; - } - - server_list_create(account); - purple_debug_info("QQ", "Server list has %d\n", g_list_length(qd->servers)); - - version_str = purple_account_get_string(account, "client_version", NULL); - qd->client_tag = QQ_CLIENT_0D55; /* set default as QQ2005 */ - qd->client_version = 2005; - if (version_str != NULL && strlen(version_str) != 0) { - if (strcmp(version_str, "qq2007") == 0) { - qd->client_tag = QQ_CLIENT_111D; - qd->client_version = 2007; - } else if (strcmp(version_str, "qq2008") == 0) { - qd->client_tag = QQ_CLIENT_115B; - qd->client_version = 2008; - } - } - - qd->is_show_notice = purple_account_get_bool(account, "show_notice", TRUE); - qd->is_show_news = purple_account_get_bool(account, "show_news", TRUE); - qd->is_show_chat = purple_account_get_bool(account, "show_chat", TRUE); - - qd->resend_times = purple_prefs_get_int("/plugins/prpl/qq/resend_times"); - if (qd->resend_times <= 1) qd->itv_config.resend = 4; - - qd->itv_config.resend = purple_prefs_get_int("/plugins/prpl/qq/resend_interval"); - if (qd->itv_config.resend <= 0) qd->itv_config.resend = 3; - purple_debug_info("QQ", "Resend interval %d, retries %d\n", - qd->itv_config.resend, qd->resend_times); - - qd->itv_config.keep_alive = purple_account_get_int(account, "keep_alive_interval", 60); - if (qd->itv_config.keep_alive < 30) qd->itv_config.keep_alive = 30; - qd->itv_config.keep_alive /= qd->itv_config.resend; - qd->itv_count.keep_alive = qd->itv_config.keep_alive; - - qd->itv_config.update = purple_account_get_int(account, "update_interval", 300); - if (qd->itv_config.update > 0) { - if (qd->itv_config.update < qd->itv_config.keep_alive) { - qd->itv_config.update = qd->itv_config.keep_alive; - } - qd->itv_config.update /= qd->itv_config.resend; - qd->itv_count.update = qd->itv_config.update; - } else { - qd->itv_config.update = 0; - } - - qd->connect_watcher = purple_timeout_add_seconds(0, qq_connect_later, gc); -} - -/* clean up the given QQ connection and free all resources */ -static void qq_close(PurpleConnection *gc) -{ - qq_data *qd; - - g_return_if_fail(gc != NULL && gc->proto_data); - qd = gc->proto_data; - - if (qd->check_watcher > 0) { - purple_timeout_remove(qd->check_watcher); - qd->check_watcher = 0; - } - - if (qd->connect_watcher > 0) { - purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = 0; - } - - qq_disconnect(gc); - - if (qd->redirect) g_free(qd->redirect); - if (qd->ld.token) g_free(qd->ld.token); - if (qd->ld.token_ex) g_free(qd->ld.token_ex); - if (qd->captcha.token) g_free(qd->captcha.token); - if (qd->captcha.data) g_free(qd->captcha.data); - - server_list_remove_all(qd); - - g_free(qd); - gc->proto_data = NULL; -} - -/* returns the icon name for a buddy or protocol */ -static const gchar *qq_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "qq"; -} - - -/* a short status text beside buddy icon*/ -static gchar *qq_status_text(PurpleBuddy *b) -{ - qq_buddy_data *bd; - GString *status; - - bd = purple_buddy_get_protocol_data(b); - if (bd == NULL) - return NULL; - - status = g_string_new(""); - - switch(bd->status) { - case QQ_BUDDY_OFFLINE: - g_string_append(status, _("Offline")); - break; - case QQ_BUDDY_ONLINE_NORMAL: - g_string_append(status, _("Online")); - break; - /* TODO What does this status mean? Labelling it as offline... */ - case QQ_BUDDY_CHANGE_TO_OFFLINE: - g_string_append(status, _("Offline")); - break; - case QQ_BUDDY_ONLINE_AWAY: - g_string_append(status, _("Away")); - break; - case QQ_BUDDY_ONLINE_INVISIBLE: - g_string_append(status, _("Invisible")); - break; - case QQ_BUDDY_ONLINE_BUSY: - g_string_append(status, _("Busy")); - break; - default: - g_string_printf(status, _("Unknown-%d"), bd->status); - } - - return g_string_free(status, FALSE); -} - - -/* a floating text when mouse is on the icon, show connection status here */ -static void qq_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - qq_buddy_data *bd; - gchar *tmp; - GString *str; - - g_return_if_fail(b != NULL); - - bd = purple_buddy_get_protocol_data(b); - if (bd == NULL) - return; - - /* if (PURPLE_BUDDY_IS_ONLINE(b) && bd != NULL) */ - if (bd->ip.s_addr != 0) { - str = g_string_new(NULL); - g_string_printf(str, "%s:%d", inet_ntoa(bd->ip), bd->port); - if (bd->comm_flag & QQ_COMM_FLAG_TCP_MODE) { - g_string_append(str, " TCP"); - } else { - g_string_append(str, " UDP"); - } - g_string_free(str, TRUE); - } - - tmp = g_strdup_printf("%d", bd->age); - purple_notify_user_info_add_pair(user_info, _("Age"), tmp); - g_free(tmp); - - switch (bd->gender) { - case QQ_BUDDY_GENDER_GG: - purple_notify_user_info_add_pair(user_info, _("Gender"), _("Male")); - break; - case QQ_BUDDY_GENDER_MM: - purple_notify_user_info_add_pair(user_info, _("Gender"), _("Female")); - break; - case QQ_BUDDY_GENDER_UNKNOWN: - purple_notify_user_info_add_pair(user_info, _("Gender"), _("Unknown")); - break; - default: - tmp = g_strdup_printf("Error (%d)", bd->gender); - purple_notify_user_info_add_pair(user_info, _("Gender"), tmp); - g_free(tmp); - } - - if (bd->level) { - tmp = g_strdup_printf("%d", bd->level); - purple_notify_user_info_add_pair(user_info, _("Level"), tmp); - g_free(tmp); - } - - str = g_string_new(NULL); - if (bd->comm_flag & QQ_COMM_FLAG_QQ_MEMBER) { - g_string_append( str, _("Member") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_QQ_VIP) { - g_string_append( str, _(" VIP") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_TCP_MODE) { - g_string_append( str, _(" TCP") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_MOBILE) { - g_string_append( str, _(" FromMobile") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_BIND_MOBILE) { - g_string_append( str, _(" BindMobile") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_VIDEO) { - g_string_append( str, _(" Video") ); - } - - if (bd->ext_flag & QQ_EXT_FLAG_ZONE) { - g_string_append( str, _(" Zone") ); - } - purple_notify_user_info_add_pair(user_info, _("Flag"), str->str); - - g_string_free(str, TRUE); - -#ifdef DEBUG - tmp = g_strdup_printf( "%s (%04X)", - qq_get_ver_desc(bd->client_tag), - bd->client_tag ); - purple_notify_user_info_add_pair(user_info, _("Ver"), tmp); - g_free(tmp); - - tmp = g_strdup_printf( "Ext 0x%X, Comm 0x%X", - bd->ext_flag, bd->comm_flag ); - purple_notify_user_info_add_pair(user_info, _("Flag"), tmp); - g_free(tmp); -#endif -} - -/* we can show tiny icons on the four corners of buddy icon, */ -static const char *qq_list_emblem(PurpleBuddy *b) -{ - PurpleAccount *account; - PurpleConnection *gc; - qq_data *qd; - qq_buddy_data *buddy; - - if (!b || !(account = purple_buddy_get_account(b)) || - !(gc = purple_account_get_connection(account)) || - !(qd = purple_connection_get_protocol_data(gc))) - return NULL; - - buddy = purple_buddy_get_protocol_data(b); - if (!buddy) { - return "not-authorized"; - } - - if (buddy->comm_flag & QQ_COMM_FLAG_MOBILE) - return "mobile"; - if (buddy->comm_flag & QQ_COMM_FLAG_VIDEO) - return "video"; - if (buddy->comm_flag & QQ_COMM_FLAG_QQ_MEMBER) - return "qq_member"; - - return NULL; -} - -/* QQ away status (used to initiate QQ away packet) */ -static GList *qq_status_types(PurpleAccount *ga) -{ - PurpleStatusType *status; - GList *types = NULL; - - status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, - "available", _("Available"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - "away", _("Away"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - "invisible", _("Invisible"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "busy", _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - "offline", _("Offline"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, - "mobile", NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, status); - - return types; -} - -/* initiate QQ away with proper change_status packet */ -static void qq_change_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - - qq_request_change_status(gc, 0); -} - -/* send packet to get who's detailed information */ -static void qq_show_buddy_info(PurpleConnection *gc, const gchar *who) -{ - guint32 uid; - qq_data *qd; - - qd = gc->proto_data; - uid = purple_name_to_uid(who); - - if (uid <= 0) { - purple_debug_error("QQ", "Not valid QQid: %s\n", who); - purple_notify_error(gc, NULL, _("Invalid name"), NULL); - return; - } - - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - qq_request_buddy_info(gc, uid, 0, QQ_BUDDY_INFO_DISPLAY); -} - -static void action_update_all_rooms(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - - if ( !qd->is_login ) { - return; - } - - qq_update_all_rooms(gc, 0, 0); -} - -static void action_change_icon(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - gchar *icon_name; - gchar *icon_path; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - - if ( !qd->is_login ) { - return; - } - - icon_name = qq_get_icon_name(qd->my_icon); - icon_path = qq_get_icon_path(icon_name); - g_free(icon_name); - - purple_debug_info("QQ", "Change prev icon %s to...\n", icon_path); - purple_request_file(action, _("Select icon..."), icon_path, - FALSE, - G_CALLBACK(qq_change_icon_cb), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - g_free(icon_path); -} - -static void action_modify_info_base(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_BASE); -} - -static void action_modify_info_ext(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_EXT); -} - -static void action_modify_info_addr(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_ADDR); -} - -static void action_modify_info_contact(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_CONTACT); -} - -static void action_change_password(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - purple_notify_uri(NULL, "https://password.qq.com"); -} - -/* show a brief summary of what we get from login packet */ -static void action_show_account_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - GString *info; - struct tm *tm_local; - int index; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - info = g_string_new(""); - - tm_local = localtime(&qd->login_time); - g_string_append_printf(info, _("Login time: %d-%d-%d, %d:%d:%d
\n"), - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - g_string_append_printf(info, _("Total Online Buddies: %d
\n"), qd->online_total); - tm_local = localtime(&qd->online_last_update); - g_string_append_printf(info, _("Last Refresh: %d-%d-%d, %d:%d:%d
\n"), - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - - g_string_append(info, "
"); - - g_string_append_printf(info, _("Server: %s
\n"), qd->curr_server); - g_string_append_printf(info, _("Client Tag: %s
\n"), qq_get_ver_desc(qd->client_tag)); - g_string_append_printf(info, _("Connection Mode: %s
\n"), qd->use_tcp ? "TCP" : "UDP"); - g_string_append_printf(info, _("My Internet IP: %s:%d
\n"), inet_ntoa(qd->my_ip), qd->my_port); - - g_string_append(info, "
"); - g_string_append(info, "Network Status
\n"); - g_string_append_printf(info, _("Sent: %lu
\n"), qd->net_stat.sent); - g_string_append_printf(info, _("Resend: %lu
\n"), qd->net_stat.resend); - g_string_append_printf(info, _("Lost: %lu
\n"), qd->net_stat.lost); - g_string_append_printf(info, _("Received: %lu
\n"), qd->net_stat.rcved); - g_string_append_printf(info, _("Received Duplicate: %lu
\n"), qd->net_stat.rcved_dup); - - g_string_append(info, "
"); - g_string_append(info, "Last Login Information
\n"); - - for (index = 0; index < sizeof(qd->last_login_time) / sizeof(time_t); index++) { - tm_local = localtime(&qd->last_login_time[index]); - g_string_append_printf(info, _("Time: %d-%d-%d, %d:%d:%d
\n"), - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - } - if (qd->last_login_ip.s_addr != 0) { - g_string_append_printf(info, _("IP: %s
\n"), inet_ntoa(qd->last_login_ip)); - } - - g_string_append(info, ""); - - purple_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL); - - g_string_free(info, TRUE); -} - -static void action_about_openq(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - GString *info; - gchar *title; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - - info = g_string_new(""); - g_string_append(info, _("

Original Author:
\n")); - g_string_append(info, "puzzlebird
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Code Contributors:
\n")); - g_string_append(info, "gfhuang(poppyer) : patches for libpurple 2.0.0beta2, maintainer
\n"); - g_string_append(info, "Yuan Qingyun : patches for libpurple 1.5.0, maintainer
\n"); - g_string_append(info, "henryouly : file transfer, udp sock5 proxy and qq_show, maintainer
\n"); - g_string_append(info, "hzhr : maintainer
\n"); - g_string_append(info, "joymarquis : maintainer
\n"); - g_string_append(info, "arfankai : fixed bugs in char_conv.c
\n"); - g_string_append(info, "rakescar : provided filter for HTML tag
\n"); - g_string_append(info, "yyw : improved performance on PPC linux
\n"); - g_string_append(info, "lvxiang : provided ip to location original code
\n"); - g_string_append(info, "markhuetsch : OpenQ merge into libpurple, maintainer 2006-2007
\n"); - g_string_append(info, "ccpaging : maintainer since 2007
\n"); - g_string_append(info, "icesky : maintainer since 2007
\n"); - g_string_append(info, "csyfek : faces, maintainer since 2007
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Lovely Patch Writers:
\n")); - g_string_append(info, "gnap : message displaying, documentation
\n"); - g_string_append(info, "manphiz : qun processing
\n"); - g_string_append(info, "moo : qun processing
\n"); - g_string_append(info, "Coly Li : qun processing
\n"); - g_string_append(info, "Emil Alexiev : captcha verification on login based on LumaQQ for MAC (2007), login, add buddy, remove buddy, message exchange and logout
\n"); - g_string_append(info, "Chengming Wang : buddy memo
\n"); - g_string_append(info, "lonicerae : chat room window bugfix, server list bugfix, buddy memo
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Acknowledgement:
\n")); - g_string_append(info, "Shufeng Tan : http://sf.net/projects/perl-oicq
\n"); - g_string_append(info, "Jeff Ye : http://www.sinomac.com
\n"); - g_string_append(info, "Hu Zheng : http://forlinux.yeah.net
\n"); - g_string_append(info, "yunfan : http://www.myswear.net
\n"); - g_string_append(info, "OpenQ Team : http://openq.linuxsir.org
\n"); - g_string_append(info, "LumaQQ Team : http://lumaqq.linuxsir.org
\n"); - g_string_append(info, "Pidgin Team : http://www.pidgin.im
\n"); - g_string_append(info, "Huang Guan : http://home.xxsyzx.com
\n"); - g_string_append(info, "OpenQ Google Group : http://groups.google.com/group/openq
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Scrupulous Testers:
\n")); - g_string_append(info, "yegle
\n"); - g_string_append(info, "cnzhangbx
\n"); - g_string_append(info, "casparant
\n"); - g_string_append(info, "wd
\n"); - g_string_append(info, "x6719620
\n"); - g_string_append(info, "netelk
\n"); - g_string_append(info, _("and more, please let me know... thank you!))")); - g_string_append(info, "
\n
\n"); - g_string_append(info, _("

And, all the boys in the backroom...
\n")); - g_string_append(info, _("Feel free to join us! :)")); - g_string_append(info, ""); - - title = g_strdup_printf(_("About OpenQ %s"), OPENQ_VERSION); - purple_notify_formatted(gc, title, title, NULL, info->str, NULL, NULL); - - g_free(title); - g_string_free(info, TRUE); -} - -/* - static void _qq_menu_search_or_add_permanent_group(PurplePluginAction *action) - { - purple_roomlist_show_with_account(NULL); - } -*/ - -/* - static void _qq_menu_create_permanent_group(PurplePluginAction * action) - { - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, _("Create QQ Qun"), - _("Input Qun name here"), - _("Only QQ members can create permanent Qun"), - "OpenQ", FALSE, FALSE, NULL, - _("Create"), G_CALLBACK(qq_create_room), _("Cancel"), NULL, gc); - } -*/ - -static void action_chat_quit(PurpleBlistNode * node) -{ - PurpleChat *chat = (PurpleChat *)node; - PurpleAccount *account = purple_chat_get_account(chat); - PurpleConnection *gc = purple_account_get_connection(account); - GHashTable *components = purple_chat_get_components(chat); - gchar *num_str; - guint32 room_id; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - g_return_if_fail(components != NULL); - - num_str = g_hash_table_lookup(components, QQ_ROOM_KEY_INTERNAL_ID); - room_id = strtoul(num_str, NULL, 10); - g_return_if_fail(room_id != 0); - - qq_room_quit(gc, room_id); -} - -static void action_chat_get_info(PurpleBlistNode * node) -{ - PurpleChat *chat = (PurpleChat *)node; - PurpleAccount *account = purple_chat_get_account(chat); - PurpleConnection *gc = purple_account_get_connection(account); - GHashTable *components = purple_chat_get_components(chat); - gchar *num_str; - guint32 room_id; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - g_return_if_fail(components != NULL); - - num_str = g_hash_table_lookup(components, QQ_ROOM_KEY_INTERNAL_ID); - room_id = strtoul(num_str, NULL, 10); - g_return_if_fail(room_id != 0); - - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0, - 0, QQ_ROOM_INFO_DISPLAY); -} - -#if 0 -/* TODO: re-enable this */ -static void _qq_menu_send_file(PurpleBlistNode * node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - qq_buddy_data *bd; - - g_return_if_fail (PURPLE_BLIST_NODE_IS_BUDDY (node)); - buddy = (PurpleBuddy *) node; - bd = (qq_buddy_data *) buddy->proto_data; - /* if (is_online (bd->status)) { */ - gc = purple_account_get_connection (buddy->account); - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qq_send_file(gc, buddy->name, NULL); - /* } */ -} -#endif - -/* protocol related menus */ -static GList *qq_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m; - PurplePluginAction *act; - - m = NULL; - act = purple_plugin_action_new(_("Change Icon"), action_change_icon); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Information"), action_modify_info_base); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Extended Information"), action_modify_info_ext); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Address"), action_modify_info_addr); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Contact"), action_modify_info_contact); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Change Password"), action_change_password); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Account Information"), action_show_account_info); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Update all QQ Quns"), action_update_all_rooms); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("About OpenQ"), action_about_openq); - m = g_list_append(m, act); - /* - act = purple_plugin_action_new(_("Qun: Search a permanent Qun"), _qq_menu_search_or_add_permanent_group); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Qun: Create a permanent Qun"), _qq_menu_create_permanent_group); - m = g_list_append(m, act); - */ - - return m; -} - -static void qq_add_buddy_from_menu_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - qq_add_buddy(gc, buddy, NULL); -} - -static void qq_modify_buddy_memo_from_menu_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - qq_buddy_data *bd; - PurpleConnection *gc; - guint32 bd_uid; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - g_return_if_fail(NULL != buddy); - - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - g_return_if_fail(NULL != gc); - - bd = (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); - g_return_if_fail(NULL != bd); - bd_uid = bd->uid; - - /* param: gc, uid, update_class, action - * here, update_class is set to bd_uid. because some memo packages returned - * without uid, which will make us confused */ - qq_request_buddy_memo(gc, bd_uid, bd_uid, QQ_BUDDY_MEMO_MODIFY); -} - -static GList *qq_buddy_menu(PurpleBuddy *buddy) -{ - GList *m = NULL; - PurpleMenuAction *act; - qq_buddy_data *bd = purple_buddy_get_protocol_data(buddy); - - if (bd == NULL) { - act = purple_menu_action_new(_("Add Buddy"), - PURPLE_CALLBACK(qq_add_buddy_from_menu_cb), - NULL, NULL); - m = g_list_append(m, act); - return m; - } - - - act = purple_menu_action_new(_("Modify Buddy Memo"), - PURPLE_CALLBACK(qq_modify_buddy_memo_from_menu_cb), - NULL, NULL); - m = g_list_append(m, act); - - - /* TODO : not working, temp commented out by gfhuang */ -#if 0 - if (bd && is_online(bd->status)) { - act = purple_menu_action_new(_("Send File"), PURPLE_CALLBACK(_qq_menu_send_file), NULL, NULL); /* add NULL by gfhuang */ - m = g_list_append(m, act); - } -#endif - return m; -} - -/* chat-related (QQ Qun) menu shown up with right-click */ -static GList *qq_chat_menu(PurpleBlistNode *node) -{ - GList *m; - PurpleMenuAction *act; - - m = NULL; - act = purple_menu_action_new(_("Get Info"), PURPLE_CALLBACK(action_chat_get_info), NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Quit Qun"), PURPLE_CALLBACK(action_chat_quit), NULL, NULL); - m = g_list_append(m, act); - return m; -} - -/* buddy-related menu shown up with right-click */ -static GList *qq_blist_node_menu(PurpleBlistNode * node) -{ - if(PURPLE_BLIST_NODE_IS_CHAT(node)) - return qq_chat_menu(node); - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - return qq_buddy_menu((PurpleBuddy *) node); - - return NULL; -} - -/* convert name displayed in a chat channel to original QQ UID */ -static gchar *chat_name_to_purple_name(const gchar *const name) -{ - const char *start; - const char *end; - gchar *ret; - - g_return_val_if_fail(name != NULL, NULL); - - /* Sample: (1234567)*/ - start = strchr(name, '('); - g_return_val_if_fail(start != NULL, NULL); - end = strchr(start, ')'); - g_return_val_if_fail(end != NULL && (end - start) > 1, NULL); - - ret = g_strndup(start + 1, end - start - 1); - - return ret; -} - -/* convert chat nickname to uid to get this buddy info */ -/* who is the nickname of buddy in QQ chat-room (Qun) */ -static void qq_get_chat_buddy_info(PurpleConnection *gc, gint channel, const gchar *who) -{ - qq_data *qd; - gchar *uid_str; - guint32 uid; - - purple_debug_info("QQ", "Get chat buddy info of %s\n", who); - g_return_if_fail(who != NULL); - - uid_str = chat_name_to_purple_name(who); - if (uid_str == NULL) { - return; - } - - qd = gc->proto_data; - uid = purple_name_to_uid(uid_str); - g_free(uid_str); - - if (uid <= 0) { - purple_debug_error("QQ", "Not valid chat name: %s\n", who); - purple_notify_error(gc, NULL, _("Invalid name"), NULL); - return; - } - - if (qd->client_version < 2007) { - qq_request_get_level(gc, uid); - } - qq_request_buddy_info(gc, uid, 0, QQ_BUDDY_INFO_DISPLAY); -} - -/* convert chat nickname to uid to invite individual IM to buddy */ -/* who is the nickname of buddy in QQ chat-room (Qun) */ -static gchar *qq_get_chat_buddy_real_name(PurpleConnection *gc, gint channel, const gchar *who) -{ - g_return_val_if_fail(who != NULL, NULL); - return chat_name_to_purple_name(who); -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_USE_POINTSIZE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - qq_list_icon, /* list_icon */ - qq_list_emblem, /* list_emblems */ - qq_status_text, /* status_text */ - qq_tooltip_text, /* tooltip_text */ - qq_status_types, /* away_states */ - qq_blist_node_menu, /* blist_node_menu */ - qq_chat_info, /* chat_info */ - qq_chat_info_defaults, /* chat_info_defaults */ - qq_login, /* open */ - qq_close, /* close */ - qq_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - qq_show_buddy_info, /* get_info */ - qq_change_status, /* change status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - qq_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - qq_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - qq_group_join, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - qq_chat_send, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - qq_get_chat_buddy_info, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* change buddy's group */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - qq_set_custom_icon, - NULL, /* remove_group */ - qq_get_chat_buddy_real_name, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - qq_roomlist_get_list, /* roomlist_get_list */ - qq_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* qq_send_file send_file */ - NULL, /* new xfer */ - NULL, /* offline_message */ - NULL, /* PurpleWhiteboardPrplOps */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-qq", /**< id */ - "QQ", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("QQ Protocol Plugin"), - /** description */ - N_("QQ Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - qq_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleKeyValuePair *kvp; - GList *server_list = NULL; - GList *server_kv_list = NULL; - GList *it; - /* #ifdef DEBUG */ - GList *version_kv_list = NULL; - /* #endif */ - - server_list = server_list_build('A'); - - purple_prefs_remove("/plugins/prpl/qq/serverlist"); - - server_kv_list = NULL; - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("Auto")); - kvp->value = g_strdup("auto"); - server_kv_list = g_list_append(server_kv_list, kvp); - - it = server_list; - while(it) { - if (it->data != NULL && strlen(it->data) > 0) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(it->data); - kvp->value = g_strdup(it->data); - server_kv_list = g_list_append(server_kv_list, kvp); - } - it = it->next; - } - - g_list_free(server_list); - - option = purple_account_option_list_new(_("Select Server"), "server", server_kv_list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("QQ2005")); - kvp->value = g_strdup("qq2005"); - version_kv_list = g_list_append(version_kv_list, kvp); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("QQ2007")); - kvp->value = g_strdup("qq2007"); - version_kv_list = g_list_append(version_kv_list, kvp); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("QQ2008")); - kvp->value = g_strdup("qq2008"); - version_kv_list = g_list_append(version_kv_list, kvp); - - option = purple_account_option_list_new(_("Client Version"), "client_version", version_kv_list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Connect by TCP"), "use_tcp", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show server notice"), "show_notice", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show server news"), "show_news", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show chat room when msg comes"), "show_chat", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Keep alive interval (seconds)"), "keep_alive_interval", 60); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Update interval (seconds)"), "update_interval", 300); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_add_none("/plugins/prpl/qq"); - purple_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE); - purple_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE); - purple_prefs_add_bool("/plugins/prpl/qq/auto_get_authorize_info", TRUE); - purple_prefs_add_int("/plugins/prpl/qq/resend_interval", 3); - purple_prefs_add_int("/plugins/prpl/qq/resend_times", 10); -} - -PURPLE_INIT_PLUGIN(qq, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,337 +0,0 @@ -/** - * @file qq_crypt.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * - * QQ encryption algorithm - * Convert from ASM code provided by PerlOICQ - * - * Puzzlebird, Nov-Dec 2002 - */ - -/* Notes: (QQ uses 16 rounds, and modified something...) - -IN : 64 bits of data in v[0] - v[1]. -OUT: 64 bits of data in w[0] - w[1]. -KEY: 128 bits of key in k[0] - k[3]. - -delta is chosen to be the real part of -the golden ratio: Sqrt(5/4) - 1/2 ~ 0.618034 multiplied by 2^32. - -0x61C88647 is what we can track on the ASM codes.!! -*/ - -#include - -#include "debug.h" -#include "qq_crypt.h" - -#if 0 -void show_binary(char *psztitle, const guint8 *const buffer, gint bytes) -{ - printf("== %s %d ==\r\n", psztitle, bytes); - gint i, j, ch; - for (i = 0; i < bytes; i += 16) { - /* length label */ - printf("%07x: ", i); - - /* dump hex value */ - for (j = 0; j < 16; j++) { - if (j == 8) { - printf(" -"); - } - if ((i + j) < bytes) - printf(" %02x", buffer[i + j]); - else - printf(" "); - } - - printf(" "); - - - /* dump ascii value */ - for (j = 0; j < 16 && (i + j) < bytes; j++) { - ch = buffer[i + j] & 127; - if (ch < ' ' || ch == 127) - printf("."); - else - printf("%c", ch); - } - printf("\r\n"); - } - printf("========\r\n"); -} -#else - -#define show_binary(args... ) /* nothing */ - -#endif - -/******************************************************************** - * encryption - *******************************************************************/ - -/* Tiny Encryption Algorithm (TEA) */ -static inline void qq_encipher(guint32 *const v, const guint32 *const k, guint32 *const w) -{ - register guint32 - y = g_ntohl(v[0]), - z = g_ntohl(v[1]), - a = g_ntohl(k[0]), - b = g_ntohl(k[1]), - c = g_ntohl(k[2]), - d = g_ntohl(k[3]), - n = 0x10, - sum = 0, - delta = 0x9E3779B9; /* 0x9E3779B9 - 0x100000000 = -0x61C88647 */ - - while (n-- > 0) { - sum += delta; - y += ((z << 4) + a) ^ (z + sum) ^ ((z >> 5) + b); - z += ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d); - } - - w[0] = g_htonl(y); - w[1] = g_htonl(z); -} - -/* it can be the real random seed function */ -/* override with number, convenient for debug */ -#ifdef DEBUG -static gint crypt_rand(void) { - return 0xdead; -} -#else -#include -#define crypt_rand() rand() -#endif - -/* 64-bit blocks and some kind of feedback mode of operation */ -static inline void encrypt_out(guint8 *crypted, const gint crypted_len, const guint8 *key) -{ - /* ships in encipher */ - guint32 plain32[2]; - guint32 p32_prev[2]; - guint32 key32[4]; - guint32 crypted32[2]; - guint32 c32_prev[2]; - - guint8 *crypted_ptr; - gint count64; - - /* prepare at first */ - crypted_ptr = crypted; - - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - - p32_prev[0] = 0; p32_prev[1] = 0; - plain32[0] = crypted32[0] ^ p32_prev[0]; plain32[1] = crypted32[1] ^ p32_prev[1]; - - g_memmove(key32, key, 16); - count64 = crypted_len / 8; - while (count64-- > 0){ - /* encrypt it */ - qq_encipher(plain32, key32, crypted32); - - crypted32[0] ^= p32_prev[0]; crypted32[1] ^= p32_prev[1]; - - /* store curr 64 bits crypted */ - g_memmove(crypted_ptr, crypted32, sizeof(crypted32)); - - /* set prev */ - p32_prev[0] = plain32[0]; p32_prev[1] = plain32[1]; - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - - /* set next 64 bits want to crypt*/ - if (count64 > 0) { - crypted_ptr += 8; - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - plain32[0] = crypted32[0] ^ c32_prev[0]; plain32[1] = crypted32[1] ^ c32_prev[1]; - } - } -} - -/* length of crypted buffer must be plain_len + 17*/ -/* - * The above comment used to say "plain_len + 16", but based on the - * behavior of the function that is wrong. If you give this function - * a plain string with len%8 = 7 then the returned length is len+17 - */ -gint qq_encrypt(guint8* crypted, const guint8* const plain, const gint plain_len, const guint8* const key) -{ - guint8 *crypted_ptr = crypted; /* current position of dest */ - gint pos, padding; - - padding = (plain_len + 10) % 8; - if (padding) { - padding = 8 - padding; - } - - pos = 0; - - /* set first byte as padding len */ - crypted_ptr[pos] = (rand() & 0xf8) | padding; - pos++; - - /* extra 2 bytes */ - padding += 2; - - /* faster a little - memset(crypted_ptr + pos, rand() & 0xff, padding); - pos += padding; - */ - - /* more random */ - while (padding--) { - crypted_ptr[pos++] = rand() & 0xff; - } - - g_memmove(crypted_ptr + pos, plain, plain_len); - pos += plain_len; - - /* header padding len + plain len must be multiple of 8 - * tail pading len is always 8 - (1st byte) - */ - memset(crypted_ptr + pos, 0x00, 7); - pos += 7; - - show_binary("After padding", crypted, pos); - - encrypt_out(crypted, pos, key); - - show_binary("Encrypted", crypted, pos); - return pos; -} - -/******************************************************************** - * decryption - ********************************************************************/ - -static inline void qq_decipher(guint32 *const v, const guint32 *const k, guint32 *const w) -{ - register guint32 - y = g_ntohl(v[0]), - z = g_ntohl(v[1]), - a = g_ntohl(k[0]), - b = g_ntohl(k[1]), - c = g_ntohl(k[2]), - d = g_ntohl(k[3]), - n = 0x10, - sum = 0xE3779B90, /* why this ? must be related with n value */ - delta = 0x9E3779B9; - - /* sum = delta<<5, in general sum = delta * n */ - while (n-- > 0) { - z -= ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d); - y -= ((z << 4) + a) ^ (z + sum) ^ ((z >> 5) + b); - sum -= delta; - } - - w[0] = g_htonl(y); - w[1] = g_htonl(z); -} - -static inline gint decrypt_out(guint8 *dest, gint crypted_len, const guint8* const key) -{ - gint plain_len; - guint32 key32[4]; - guint32 crypted32[2]; - guint32 c32_prev[2]; - guint32 plain32[2]; - guint32 p32_prev[2]; - gint count64; - gint padding; - guint8 *crypted_ptr = dest; - - /* decrypt first 64 bit */ - memcpy(key32, key, sizeof(key32)); - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - - qq_decipher(crypted32, key32, p32_prev); - memcpy(crypted_ptr, p32_prev, sizeof(p32_prev)); - - /* check padding len */ - padding = 2 + (crypted_ptr[0] & 0x7); - if (padding < 2) { - padding += 8; - } - plain_len = crypted_len - 1 - padding - 7; - if( plain_len < 0 ) { - return -2; - } - - count64 = crypted_len / 8; - while (--count64 > 0){ - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - crypted_ptr += 8; - - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - p32_prev[0] ^= crypted32[0]; p32_prev[1] ^= crypted32[1]; - - qq_decipher(p32_prev, key32, p32_prev); - - plain32[0] = p32_prev[0] ^ c32_prev[0]; plain32[1] = p32_prev[1] ^ c32_prev[1]; - memcpy(crypted_ptr, plain32, sizeof(plain32)); - } - - return plain_len; -} - -/* length of plain buffer must be equal to crypted_len */ -gint qq_decrypt(guint8 *plain, const guint8* const crypted, const gint crypted_len, const guint8* const key) -{ - gint plain_len = 0; - gint hdr_padding; - gint pos; - - /* at least 16 bytes and %8 == 0 */ - if ((crypted_len % 8) || (crypted_len < 16)) { - return -1; - } - - memcpy(plain, crypted, crypted_len); - - plain_len = decrypt_out(plain, crypted_len, key); - if (plain_len < 0) { - return plain_len; /* invalid first 64 bits */ - } - - show_binary("Decrypted with padding", plain, crypted_len); - - /* check last 7 bytes is zero or not? */ - for (pos = crypted_len - 1; pos > crypted_len - 8; pos--) { - if (plain[pos] != 0) { - return -3; - } - } - if (plain_len == 0) { - return plain_len; - } - - hdr_padding = crypted_len - plain_len - 7; - g_memmove(plain, plain + hdr_padding, plain_len); - - return plain_len; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_crypt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ - /** - * @file qq_crypt.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef _QQ_CRYPT_H_ -#define _QQ_CRYPT_H_ - -#include - -gint qq_encrypt(guint8* crypted, const guint8* const plain, const gint plain_len, const guint8* const key); - -gint qq_decrypt(guint8 *plain, const guint8* const crypted, const gint crypted_len, const guint8* const key); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,268 +0,0 @@ -/** - * @file qq_define.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "qq_define.h" - -#define QQ_CLIENT_062E 0x062e /* GB QQ2000c build 0630 */ -#define QQ_CLIENT_072E 0x072e /* EN QQ2000c build 0305 */ -#define QQ_CLIENT_0801 0x0801 /* EN QQ2000c build 0630 */ -#define QQ_CLIENT_0A1D 0x0a1d /* GB QQ2003c build 0808 */ -#define QQ_CLIENT_0B07 0x0b07 /* GB QQ2003c build 0925 */ -#define QQ_CLIENT_0B2F 0x0b2f /* GB QQ2003iii build 0117 */ -#define QQ_CLIENT_0B35 0x0b35 /* GB QQ2003iii build 0304 (offical release) */ -#define QQ_CLIENT_0B37 0x0b37 /* GB QQ2003iii build 0304 (April 05 updates) */ -#define QQ_CLIENT_0E1B 0x0e1b /* QQ2005 ? */ -#define QQ_CLIENT_0E35 0x0e35 /* EN QQ2005 V05.0.200.020 */ -#define QQ_CLIENT_0F15 0x0f15 /* QQ2006 Spring Festival build */ -#define QQ_CLIENT_0F5F 0x0f5f /* QQ2006 final build */ - -#define QQ_CLIENT_0C0B 0x0C0B /* QQ2004 */ -#define QQ_CLIENT_0C0D 0x0C0D /* QQ2004 preview*/ -#define QQ_CLIENT_0C21 0x0C21 /* QQ2004 */ -#define QQ_CLIENT_0C49 0x0C49 /* QQ2004II */ -#define QQ_CLIENT_0D05 0x0D05 /* QQ2005 beta1 */ -#define QQ_CLIENT_0D51 0x0D51 /* QQ2005 beta2 */ -#define QQ_CLIENT_0D61 0x0D61 /* QQ2005 */ -#define QQ_CLIENT_05A5 0x05A5 /* ? */ -#define QQ_CLIENT_05F1 0x0F15 /* QQ2006 Spring Festival */ -#define QQ_CLIENT_0F4B 0x0F4B /* QQ2006 Beta 3 */ - -#define QQ_CLIENT_1105 0x1105 /* QQ2007 beta4*/ -#define QQ_CLIENT_1203 0x1203 /* QQ2008 */ -#define QQ_CLIENT_1205 0x1205 /* QQ2008 Qi Fu */ -#define QQ_CLIENT_120B 0x120B /* QQ2008 July 8.0.978.400 */ -#define QQ_CLIENT_1412 0x1412 /* QQMac 1.0 preview1 build 670 */ -#define QQ_CLIENT_1441 0x1441 /* QQ2009 preview2 */ - -#define QQ_SERVER_0100 0x0100 /* server */ - - -/* given source tag, return its description accordingly */ -const gchar *qq_get_ver_desc(gint source) -{ - switch (source) { - case QQ_CLIENT_062E: - return "GB QQ2000c build 0630"; - case QQ_CLIENT_072E: - return "En QQ2000c build 0305"; - case QQ_CLIENT_0801: - return "En QQ2000c build 0630"; - case QQ_CLIENT_0A1D: - return "GB QQ2003ii build 0808"; - case QQ_CLIENT_0B07: - return "GB QQ2003ii build 0925"; - case QQ_CLIENT_0B2F: - return "GB QQ2003iii build 0117"; - case QQ_CLIENT_0B35: - return "GB QQ2003iii build 0304"; - case QQ_CLIENT_0B37: - return "GB QQ2003iii build 0304 (April 5 update)"; - case QQ_CLIENT_0C0B: - return "QQ2004"; - case QQ_CLIENT_0C0D: - return "QQ2004 preview"; - case QQ_CLIENT_0C21: - return "QQ2004"; - case QQ_CLIENT_0C49: - return "QQ2004II"; - case QQ_CLIENT_0D05: - return "QQ2005 beta1"; - case QQ_CLIENT_0D51: - return "QQ2005 beta2"; - case QQ_CLIENT_0D55: - case QQ_CLIENT_0D61: - return "QQ2005"; - case QQ_CLIENT_0E1B: - return "QQ2005 or QQ2006"; - case QQ_CLIENT_0E35: - return "En QQ2005 V05.0.200.020"; - case QQ_CLIENT_0F15: - return "QQ2006 Spring Festival"; - case QQ_CLIENT_0F4B: - return "QQ2006 beta3"; - case QQ_CLIENT_0F5F: - return "QQ2006 final build"; - case QQ_CLIENT_1105: - return "QQ2007 beta4"; - case QQ_CLIENT_111D: - return "QQ2007"; - case QQ_CLIENT_115B: - case QQ_CLIENT_1203: - case QQ_CLIENT_1205: - case QQ_CLIENT_120B: - return "QQ2008"; - case QQ_CLIENT_1412: - return "QQMac 1.0 preview1 build 670"; - case QQ_CLIENT_1441: - return "QQ2009 preview2"; - case QQ_SERVER_0100: - return "QQ Server 0100"; - default: - return "Unknown Version"; - } -} - -/* given command alias, return the command name accordingly */ -const gchar *qq_get_cmd_desc(gint cmd) -{ - switch (cmd) { - case QQ_CMD_LOGOUT: - return "QQ_CMD_LOGOUT"; - case QQ_CMD_KEEP_ALIVE: - return "CMD_KEEP_ALIVE"; - case QQ_CMD_UPDATE_INFO: - return "CMD_UPDATE_INFO"; - case QQ_CMD_SEARCH_USER: - return "CMD_SEARCH_USER"; - case QQ_CMD_GET_BUDDY_INFO: - return "CMD_GET_BUDDY_INFO"; - case QQ_CMD_ADD_BUDDY_NO_AUTH: - return "CMD_ADD_BUDDY_NO_AUTH"; - case QQ_CMD_REMOVE_BUDDY: - return "CMD_REMOVE_BUDDY"; - case QQ_CMD_ADD_BUDDY_AUTH: - return "CMD_ADD_BUDDY_AUTH"; - case QQ_CMD_CHANGE_STATUS: - return "CMD_CHANGE_STATUS"; - case QQ_CMD_ACK_SYS_MSG: - return "CMD_ACK_SYS_MSG"; - case QQ_CMD_SEND_IM: - return "CMD_SEND_IM"; - case QQ_CMD_RECV_IM: - return "CMD_RECV_IM"; - case QQ_CMD_REMOVE_ME: - return "CMD_REMOVE_ME"; - case QQ_CMD_LOGIN: - return "CMD_LOGIN"; - case QQ_CMD_GET_BUDDIES_LIST: - return "CMD_GET_BUDDIES_LIST"; - case QQ_CMD_GET_BUDDIES_ONLINE: - return "CMD_GET_BUDDIES_ONLINE"; - case QQ_CMD_ROOM: - return "CMD_ROOM"; - case QQ_CMD_GET_BUDDIES_AND_ROOMS: - return "CMD_GET_BUDDIES_AND_ROOMS"; - case QQ_CMD_GET_LEVEL: - return "CMD_GET_LEVEL"; - case QQ_CMD_TOKEN: - return "CMD_TOKEN"; - case QQ_CMD_RECV_MSG_SYS: - return "CMD_RECV_MSG_SYS"; - case QQ_CMD_BUDDY_CHANGE_STATUS: - return "CMD_BUDDY_CHANGE_STATUS"; - case QQ_CMD_GET_SERVER: - return "CMD_GET_SERVER"; - case QQ_CMD_TOKEN_EX: - return "CMD_TOKEN_EX"; - case QQ_CMD_CHECK_PWD: - return "CMD_CHECK_PWD"; - case QQ_CMD_AUTH_CODE: - return "CMD_AUTH_CODE"; - case QQ_CMD_ADD_BUDDY_NO_AUTH_EX: - return "CMD_ADD_BUDDY_NO_AUTH_EX"; - case QQ_CMD_ADD_BUDDY_AUTH_EX: - return "CMD_BUDDY_ADD_AUTH_EX"; - case QQ_CMD_BUDDY_CHECK_CODE: - return "CMD_BUDDY_CHECK_CODE"; - case QQ_CMD_BUDDY_QUESTION: - return "CMD_BUDDY_QUESTION"; - case QQ_CMD_BUDDY_MEMO: - return "CMD_BUDDY_MEMO"; - default: - return "CMD_UNKNOW"; - } -} - -const gchar *qq_get_room_cmd_desc(gint room_cmd) -{ - switch (room_cmd) { - case QQ_ROOM_CMD_CREATE: - return "ROOM_CMD_CREATE"; - case QQ_ROOM_CMD_MEMBER_OPT: - return "ROOM_CMD_MEMBER_OPT"; - case QQ_ROOM_CMD_CHANGE_INFO: - return "ROOM_CMD_CHANGE_INFO"; - case QQ_ROOM_CMD_GET_INFO: - return "ROOM_CMD_GET_INFO"; - case QQ_ROOM_CMD_ACTIVATE: - return "ROOM_CMD_ACTIVATE"; - case QQ_ROOM_CMD_SEARCH: - return "ROOM_CMD_SEARCH"; - case QQ_ROOM_CMD_JOIN: - return "ROOM_CMD_JOIN"; - case QQ_ROOM_CMD_AUTH: - return "ROOM_CMD_AUTH"; - case QQ_ROOM_CMD_QUIT: - return "ROOM_CMD_QUIT"; - case QQ_ROOM_CMD_SEND_IM: - return "ROOM_CMD_SEND_IM"; - case QQ_ROOM_CMD_GET_ONLINES: - return "ROOM_CMD_GET_ONLINES"; - case QQ_ROOM_CMD_GET_BUDDIES: - return "ROOM_CMD_GET_BUDDIES"; - case QQ_ROOM_CMD_CHANGE_CARD: - return "ROOM_CMD_CHANGE_CARD"; - case QQ_ROOM_CMD_GET_REALNAMES: - return "ROOM_CMD_GET_REALNAMES"; - case QQ_ROOM_CMD_GET_CARD: - return "ROOM_CMD_GET_CARD"; - case QQ_ROOM_CMD_SEND_IM_EX: - return "ROOM_CMD_SEND_IM_EX"; - case QQ_ROOM_CMD_ADMIN: - return "ROOM_CMD_ADMIN"; - case QQ_ROOM_CMD_TRANSFER: - return "ROOM_CMD_TRANSFER"; - case QQ_ROOM_CMD_TEMP_CREATE: - return "ROOM_CMD_TEMP_CREATE"; - case QQ_ROOM_CMD_TEMP_CHANGE_MEMBER: - return "ROOM_CMD_TEMP_CHANGE_MEMBER"; - case QQ_ROOM_CMD_TEMP_QUIT: - return "ROOM_CMD_TEMP_QUIT"; - case QQ_ROOM_CMD_TEMP_GET_INFO: - return "ROOM_CMD_TEMP_GET_INFO"; - case QQ_ROOM_CMD_TEMP_SEND_IM: - return "ROOM_CMD_TEMP_SEND_IM"; - case QQ_ROOM_CMD_TEMP_GET_MEMBERS: - return "ROOM_CMD_TEMP_GET_MEMBERS"; - default: - return "ROOM_CMD_UNKNOW"; - } -} - -/* check if status means online or offline */ -gboolean is_online(guint8 status) -{ - switch(status) { - case QQ_BUDDY_ONLINE_NORMAL: - case QQ_BUDDY_ONLINE_AWAY: - case QQ_BUDDY_ONLINE_INVISIBLE: - case QQ_BUDDY_ONLINE_BUSY: - return TRUE; - case QQ_BUDDY_CHANGE_TO_OFFLINE: - return FALSE; - } - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_define.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/** - * @file qq_define.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_HEADER_INFO_H_ -#define _QQ_HEADER_INFO_H_ - -#include - -#define QQ_UDP_HEADER_LENGTH 7 -#define QQ_TCP_HEADER_LENGTH 9 - -#define QQ_PACKET_TAG 0x02 /* all QQ text packets starts with it */ -#define QQ_PACKET_TAIL 0x03 /* all QQ text packets end with it */ - -#define QQ_CLIENT_0D55 0x0d55 /* QQ2005 used by openq before */ -#define QQ_CLIENT_111D 0x111D /* QQ2007 */ -#define QQ_CLIENT_115B 0x115B /* QQ2008 He Sui*/ - -const gchar *qq_get_ver_desc(gint source); - -/* list of known QQ commands */ -enum { - QQ_CMD_LOGOUT = 0x0001, /* log out */ - QQ_CMD_KEEP_ALIVE = 0x0002, /* get onlines from tencent */ - QQ_CMD_UPDATE_INFO = 0x0004, /* update information */ - QQ_CMD_SEARCH_USER = 0x0005, /* search for user */ - QQ_CMD_GET_BUDDY_INFO = 0x0006, /* get user information */ - QQ_CMD_ADD_BUDDY_NO_AUTH = 0x0009, /* add buddy without auth */ - QQ_CMD_REMOVE_BUDDY = 0x000a, /* delete a buddy */ - QQ_CMD_ADD_BUDDY_AUTH = 0x000b, /* buddy authentication */ - QQ_CMD_CHANGE_STATUS = 0x000d, /* change my online status */ - QQ_CMD_ACK_SYS_MSG = 0x0012, /* ack system message */ - QQ_CMD_SEND_IM = 0x0016, /* send message */ - QQ_CMD_RECV_IM = 0x0017, /* receive message */ - QQ_CMD_REMOVE_ME = 0x001c, /* remove self */ - QQ_CMD_REQUEST_KEY = 0x001d, /* request key for file transfer */ - QQ_CMD_CELL_PHONE_1 = 0x0021, /* cell phone 1 */ - QQ_CMD_LOGIN = 0x0022, /* login */ - QQ_CMD_GET_BUDDIES_LIST = 0x0026, /* get buddies list */ - QQ_CMD_GET_BUDDIES_ONLINE = 0x0027, /* get online buddies list */ - QQ_CMD_CELL_PHONE_2 = 0x0029, /* cell phone 2 */ - QQ_CMD_ROOM = 0x0030, /* room command */ - QQ_CMD_GET_BUDDIES_AND_ROOMS = 0x0058, - QQ_CMD_GET_LEVEL = 0x005C, /* get level for one or more buddies */ - QQ_CMD_TOKEN = 0x0062, /* get login token */ - QQ_CMD_RECV_MSG_SYS = 0x0080, /* receive a system message */ - QQ_CMD_BUDDY_CHANGE_STATUS = 0x0081, /* buddy change status */ - QQ_CMD_BUDDY_MEMO = 0x003E, /* the message about buddy memo */ - - /* for QQ2007*/ - QQ_CMD_GET_SERVER = 0x0091, /* select login server */ - QQ_CMD_TOKEN_EX = 0x00BA, /* get LOGIN token */ - QQ_CMD_CHECK_PWD = 0x00DD, /* Password verify */ - QQ_CMD_AUTH_CODE = 0x00AE, /* the request verification of information */ - QQ_CMD_ADD_BUDDY_NO_AUTH_EX = 0x00A7, /* add friend without auth */ - QQ_CMD_ADD_BUDDY_AUTH_EX = 0x00A8, /* add buddy with auth */ - QQ_CMD_BUDDY_CHECK_CODE = 0x00B5, - QQ_CMD_BUDDY_QUESTION = 0x00B7 -}; - -const gchar *qq_get_cmd_desc(gint type); - -enum { - QQ_ROOM_CMD_CREATE = 0x01, - QQ_ROOM_CMD_MEMBER_OPT = 0x02, - QQ_ROOM_CMD_CHANGE_INFO = 0x03, - QQ_ROOM_CMD_GET_INFO = 0x04, - QQ_ROOM_CMD_ACTIVATE = 0x05, - QQ_ROOM_CMD_SEARCH = 0x06, - QQ_ROOM_CMD_JOIN = 0x07, - QQ_ROOM_CMD_AUTH = 0x08, - QQ_ROOM_CMD_QUIT = 0x09, - QQ_ROOM_CMD_SEND_IM = 0x0a, - QQ_ROOM_CMD_GET_ONLINES = 0x0b, - QQ_ROOM_CMD_GET_BUDDIES = 0x0c, - - QQ_ROOM_CMD_CHANGE_CARD = 0x0E, - QQ_ROOM_CMD_GET_REALNAMES = 0x0F, - QQ_ROOM_CMD_GET_CARD = 0x10, - QQ_ROOM_CMD_SEND_IM_EX = 0x1A, - QQ_ROOM_CMD_ADMIN = 0x1B, - QQ_ROOM_CMD_TRANSFER = 0x1C, - QQ_ROOM_CMD_TEMP_CREATE = 0x30, - QQ_ROOM_CMD_TEMP_CHANGE_MEMBER = 0x31, - QQ_ROOM_CMD_TEMP_QUIT = 0x32, - QQ_ROOM_CMD_TEMP_GET_INFO = 0x33, - QQ_ROOM_CMD_TEMP_SEND_IM = 0x35, - QQ_ROOM_CMD_TEMP_GET_MEMBERS = 0x37 -}; - -const gchar *qq_get_room_cmd_desc(gint room_cmd); - -enum { - QQ_SERVER_BUDDY_ADDED = 1, - QQ_SERVER_BUDDY_ADD_REQUEST = 2, - QQ_SERVER_BUDDY_ADDED_ME = 3, - QQ_SERVER_BUDDY_REJECTED_ME = 4, - QQ_SERVER_NOTICE= 6, - QQ_SERVER_NEW_CLIENT = 9, - QQ_SERVER_BUDDY_ADDING_EX = 40, - QQ_SERVER_BUDDY_ADD_REQUEST_EX = 41, - QQ_SERVER_BUDDY_ADDED_ANSWER = 42, - QQ_SERVER_BUDDY_ADDED_EX = 43 -}; - -enum { - QQ_BUDDY_OFFLINE = 0x00, - QQ_BUDDY_ONLINE_NORMAL = 10, - QQ_BUDDY_CHANGE_TO_OFFLINE = 20, - QQ_BUDDY_ONLINE_AWAY = 30, - QQ_BUDDY_ONLINE_INVISIBLE = 40, - QQ_BUDDY_ONLINE_BUSY = 50 -}; - - -gboolean is_online(guint8 status); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/** - * @file qq.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_QQ_H_ -#define _QQ_QQ_H_ - -#include "internal.h" -#include "ft.h" -#include "circbuffer.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "proxy.h" -#include "roomlist.h" - -#define QQ_KEY_LENGTH 16 - -/* steal from kazehakase :) */ -#define qq_strlen(s) ((s)!=NULL?strlen(s):0) -#define qq_strcmp(s1,s2) ((s1)!=NULL && (s2)!=NULL?strcmp(s1,s2):0) - -typedef struct _qq_data qq_data; -typedef struct _qq_buddy_data qq_buddy_data; -typedef struct _qq_interval qq_interval; -typedef struct _qq_net_stat qq_net_stat; -typedef struct _qq_login_data qq_login_data; -typedef struct _qq_captcha_data qq_captcha_data; - -struct _qq_captcha_data { - guint8 *token; - guint16 token_len; - guint8 next_index; - guint8 *data; - guint16 data_len; -}; - -struct _qq_login_data { - guint8 random_key[QQ_KEY_LENGTH]; /* first encrypt key generated by client */ - guint8 *token; /* get from server */ - guint8 token_len; - guint8 *token_ex; /* get from server */ - guint16 token_ex_len; - - guint8 pwd_md5[QQ_KEY_LENGTH]; /* password in md5 (or md5' md5) */ - guint8 pwd_twice_md5[QQ_KEY_LENGTH]; - - guint8 *login_token; - guint16 login_token_len; - guint8 login_key[QQ_KEY_LENGTH]; -}; - -struct _qq_interval { - gint resend; - gint keep_alive; - gint update; -}; - -struct _qq_net_stat { - glong sent; - glong resend; - glong lost; - glong rcved; - glong rcved_dup; -}; - -struct _qq_buddy_data { - guint32 uid; - guint16 face; /* index: 0 - 299 */ - guint8 age; - guint8 gender; - gchar *nickname; - struct in_addr ip; - guint16 port; - guint8 status; - guint8 ext_flag; - guint8 comm_flag; /* details in qq_buddy_list.c */ - guint16 client_tag; - guint8 onlineTime; - guint16 level; - guint16 timeRemainder; - time_t signon; - time_t idle; - time_t last_update; - gchar** memo; - - gint8 role; /* role in group, used only in group->members list */ -}; - -typedef struct _qq_connection qq_connection; -struct _qq_connection { - int fd; /* socket file handler */ - int input_handler; - - /* tcp related */ - int can_write_handler; /* use in tcp_send_out */ - PurpleCircBuffer *tcp_txbuf; - guint8 *tcp_rxqueue; - int tcp_rxlen; -}; - -struct _qq_data { - PurpleConnection *gc; - - GSList *openconns; - gboolean use_tcp; /* network in tcp or udp */ - PurpleProxyConnectData *conn_data; -#ifndef purple_proxy_connect_udp - PurpleDnsQueryData *udp_query_data; /* udp related */ - gint udp_can_write_handler; /* socket can_write handle, use in udp connecting and tcp send out */ -#endif - gint fd; /* socket file handler */ - qq_net_stat net_stat; - - GList *servers; - gchar *curr_server; /* point to servers->data, do not free*/ - - guint16 client_tag; - gint client_version; - - struct in_addr redirect_ip; - guint16 redirect_port; - guint8 *redirect; - guint8 redirect_len; - - guint check_watcher; - guint connect_watcher; - gint connect_retry; - - qq_interval itv_config; - qq_interval itv_count; - guint network_watcher; - gint resend_times; - - GList *transactions; /* check ack packet and resend */ - - guint32 uid; /* QQ number */ - - qq_login_data ld; - qq_captcha_data captcha; - - guint8 session_key[QQ_KEY_LENGTH]; /* later use this as key in this session */ - guint8 session_md5[QQ_KEY_LENGTH]; /* concatenate my uid with session_key and md5 it */ - - guint16 send_seq; /* send sequence number */ - guint8 login_mode; /* online of invisible */ - gboolean is_login; /* used by qq_add_buddy */ - - PurpleXfer *xfer; /* file transfer handler */ - - /* get from login reply packet */ - struct in_addr my_local_ip; /* my local ip address detected by server */ - guint16 my_local_port; /* my lcoal port detected by server */ - time_t login_time; - time_t last_login_time[3]; - struct in_addr last_login_ip; - /* get from keep_alive packet */ - struct in_addr my_ip; /* my ip address detected by server */ - guint16 my_port; /* my port detected by server */ - guint16 my_icon; /* my icon index */ - guint32 online_total; /* the number of online QQ users */ - time_t online_last_update; /* last time send get_friends_online packet */ - - PurpleRoomlist *roomlist; - - GList *groups; - - gboolean is_show_notice; - gboolean is_show_news; - gboolean is_show_chat; - - guint16 send_im_id; /* send IM sequence number */ -}; - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1320 +0,0 @@ -/** - * @file qq_network.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "cipher.h" -#include "debug.h" - -#include "buddy_info.h" -#include "group_info.h" -#include "group_internal.h" -#include "qq_crypt.h" -#include "qq_define.h" -#include "qq_base.h" -#include "buddy_list.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_trans.h" -#include "utils.h" -#include "qq_process.h" - -#define QQ_DEFAULT_PORT 8000 - -/* set QQ_CONNECT_MAX to 1, when test reconnecting */ -#define QQ_CONNECT_MAX 3 -#define QQ_CONNECT_INTERVAL 2 -#define QQ_CONNECT_CHECK 5 -#define QQ_KEEP_ALIVE_INTERVAL 60 -#define QQ_TRANS_INTERVAL 10 - -gboolean connect_to_server(PurpleConnection *gc, gchar *server, gint port); - -static qq_connection *connection_find(qq_data *qd, int fd) { - qq_connection *ret = NULL; - GSList *entry = qd->openconns; - while(entry) { - ret = entry->data; - if(ret->fd == fd) return ret; - entry = entry->next; - } - return NULL; -} - -static qq_connection *connection_create(qq_data *qd, int fd) { - qq_connection *ret = g_new0(qq_connection, 1); - ret->fd = fd; - qd->openconns = g_slist_append(qd->openconns, ret); - return ret; -} - -static void connection_remove(qq_data *qd, int fd) { - qq_connection *conn = connection_find(qd, fd); - qd->openconns = g_slist_remove(qd->openconns, conn); - - g_return_if_fail( conn != NULL ); - - purple_debug_info("QQ", "Close socket %d\n", conn->fd); - if(conn->input_handler > 0) purple_input_remove(conn->input_handler); - if(conn->can_write_handler > 0) purple_input_remove(conn->can_write_handler); - - if (conn->fd >= 0) close(conn->fd); - if(conn->tcp_txbuf != NULL) purple_circ_buffer_destroy(conn->tcp_txbuf); - if (conn->tcp_rxqueue != NULL) g_free(conn->tcp_rxqueue); - - g_free(conn); -} - -static void connection_free_all(qq_data *qd) { - qq_connection *ret = NULL; - GSList *entry = qd->openconns; - while(entry) { - ret = entry->data; - connection_remove(qd, ret->fd); - entry = qd->openconns; - } -} -static gboolean set_new_server(qq_data *qd) -{ - gint count; - gint index; - GList *it = NULL; - - g_return_val_if_fail(qd != NULL, FALSE); - - if (qd->servers == NULL) { - purple_debug_info("QQ", "Server list is NULL\n"); - return FALSE; - } - - /* remove server used before */ - if (qd->curr_server != NULL) { - purple_debug_info("QQ", - "Remove current [%s] from server list\n", qd->curr_server); - qd->servers = g_list_remove(qd->servers, qd->curr_server); - qd->curr_server = NULL; - } - - count = g_list_length(qd->servers); - purple_debug_info("QQ", "Server list has %d\n", count); - if (count <= 0) { - /* no server left, disconnect when result is false */ - qd->servers = NULL; - return FALSE; - } - - /* get new server */ - index = rand() % count; - it = g_list_nth(qd->servers, index); - qd->curr_server = it->data; /* do not free server_name */ - if (qd->curr_server == NULL || strlen(qd->curr_server) <= 0 ) { - purple_debug_info("QQ", "Server name at %d is empty\n", index); - return FALSE; - } - - purple_debug_info("QQ", "set new server to %s\n", qd->curr_server); - return TRUE; -} - -static gint packet_get_header(guint8 *header_tag, guint16 *source_tag, - guint16 *cmd, guint16 *seq, guint8 *buf) -{ - gint bytes = 0; - bytes += qq_get8(header_tag, buf + bytes); - bytes += qq_get16(source_tag, buf + bytes); - bytes += qq_get16(cmd, buf + bytes); - bytes += qq_get16(seq, buf + bytes); - return bytes; -} - -static gboolean connect_check(gpointer data) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); - qd = (qq_data *) gc->proto_data; - - if (qd->connect_watcher > 0) { - purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = 0; - } - - if (qd->fd >= 0 && qd->ld.token != NULL && qd->ld.token_len > 0) { - purple_debug_info("QQ", "Connect ok\n"); - return FALSE; - } - - qd->connect_watcher = purple_timeout_add_seconds(0, qq_connect_later, gc); - return FALSE; -} - -/* Warning: qq_connect_later destory all connection - * Any function should be care of use qq_data after call this function - * Please conside tcp_pending and udp_pending */ -gboolean qq_connect_later(gpointer data) -{ - PurpleConnection *gc; - char *tmp_server; - int port; - gchar **segments; - qq_data *qd; - - gc = (PurpleConnection *) data; - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); - qd = (qq_data *) gc->proto_data; - tmp_server = NULL; - - if (qd->check_watcher > 0) { - purple_timeout_remove(qd->check_watcher); - qd->check_watcher = 0; - } - qq_disconnect(gc); - - if (qd->redirect_ip.s_addr != 0) { - /* redirect to new server */ - tmp_server = g_strdup_printf("%s:%d", inet_ntoa(qd->redirect_ip), qd->redirect_port); - qd->servers = g_list_append(qd->servers, tmp_server); - - qd->curr_server = tmp_server; - tmp_server = NULL; - - qd->redirect_ip.s_addr = 0; - qd->redirect_port = 0; - qd->connect_retry = QQ_CONNECT_MAX; - } - - if (qd->curr_server == NULL || strlen (qd->curr_server) == 0 || qd->connect_retry <= 0) { - if ( set_new_server(qd) != TRUE) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return FALSE; - } - qd->connect_retry = QQ_CONNECT_MAX; - } - - segments = g_strsplit_set(qd->curr_server, ":", 0); - tmp_server = g_strdup(segments[0]); - if (NULL != segments[1]) { - port = atoi(segments[1]); - if (port <= 0) { - purple_debug_info("QQ", "Port not define in %s, use default.\n", qd->curr_server); - port = QQ_DEFAULT_PORT; - } - } else { - purple_debug_info("QQ", "Error splitting server string: %s, setting port to default.\n", qd->curr_server); - port = QQ_DEFAULT_PORT; - } - - g_strfreev(segments); - - qd->connect_retry--; - if ( !connect_to_server(gc, tmp_server, port) ) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } - - g_free(tmp_server); - tmp_server = NULL; - - qd->check_watcher = purple_timeout_add_seconds(QQ_CONNECT_CHECK, connect_check, gc); - return FALSE; /* timeout callback stops */ -} - -static void redirect_server(PurpleConnection *gc) -{ - qq_data *qd; - qd = (qq_data *) gc->proto_data; - - if (qd->check_watcher > 0) { - purple_timeout_remove(qd->check_watcher); - qd->check_watcher = 0; - } - if (qd->connect_watcher > 0) purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc); -} - -/* process the incoming packet from qq_pending */ -static gboolean packet_process(PurpleConnection *gc, guint8 *buf, gint buf_len) -{ - qq_data *qd; - gint bytes, bytes_not_read; - - guint8 header_tag; - guint16 source_tag; - guint16 cmd; - guint16 seq; /* May be ack_seq or send_seq, depends on cmd */ - guint8 room_cmd; - guint32 room_id; - guint32 update_class; - guint32 ship32; - int ret; - - qq_transaction *trans; - - g_return_val_if_fail(buf != NULL && buf_len > 0, TRUE); - - qd = (qq_data *) gc->proto_data; - - qd->net_stat.rcved++; - if (qd->net_stat.rcved <= 0) memset(&(qd->net_stat), 0, sizeof(qd->net_stat)); - - /* Len, header and tail tag have been checked before */ - bytes = 0; - bytes += packet_get_header(&header_tag, &source_tag, &cmd, &seq, buf + bytes); - -#if 1 - purple_debug_info("QQ", "==> [%05d] %s 0x%04X, source tag 0x%04X len %d\n", - seq, qq_get_cmd_desc(cmd), cmd, source_tag, buf_len); -#endif - /* this is the length of all the encrypted data (also remove tail tag) */ - bytes_not_read = buf_len - bytes - 1; - - /* ack packet, we need to update send tranactions */ - /* we do not check duplication for server ack */ - trans = qq_trans_find_rcved(gc, cmd, seq); - if (trans == NULL) { - /* new server command */ - if ( !qd->is_login ) { - qq_trans_add_remain(gc, cmd, seq, buf + bytes, bytes_not_read); - } else { - qq_trans_add_server_cmd(gc, cmd, seq, buf + bytes, bytes_not_read); - qq_proc_server_cmd(gc, cmd, seq, buf + bytes, bytes_not_read); - } - return TRUE; - } - - if (qq_trans_is_dup(trans)) { - qd->net_stat.rcved_dup++; - purple_debug_info("QQ", "dup [%05d] %s, discard...\n", seq, qq_get_cmd_desc(cmd)); - return TRUE; - } - - update_class = qq_trans_get_class(trans); - ship32 = qq_trans_get_ship(trans); - if (update_class != 0 || ship32 != 0) { - purple_debug_info("QQ", "Update class %d, ship32 %d\n", update_class, ship32); - } - - switch (cmd) { - case QQ_CMD_TOKEN: - case QQ_CMD_GET_SERVER: - case QQ_CMD_TOKEN_EX: - case QQ_CMD_CHECK_PWD: - case QQ_CMD_LOGIN: - ret = qq_proc_login_cmds(gc, cmd, seq, buf + bytes, bytes_not_read, update_class, ship32); - if (ret != QQ_LOGIN_REPLY_OK) { - if (ret == QQ_LOGIN_REPLY_REDIRECT) { - redirect_server(gc); - } - return FALSE; /* do nothing after this function and return now */ - } - break; - case QQ_CMD_ROOM: - room_cmd = qq_trans_get_room_cmd(trans); - room_id = qq_trans_get_room_id(trans); - qq_proc_room_cmds(gc, seq, room_cmd, room_id, buf + bytes, bytes_not_read, update_class, ship32); - break; - default: - qq_proc_client_cmds(gc, cmd, seq, buf + bytes, bytes_not_read, update_class, ship32); - break; - } - - return TRUE; -} - -static void tcp_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - qq_connection *conn; - guint8 buf[1024]; /* set to 16 when test tcp_rxqueue */ - gint buf_len; - gint bytes; - - guint8 *pkt; - guint16 pkt_len; - - gchar *error_msg; - guint8 *jump; - gint jump_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - if(cond != PURPLE_INPUT_READ) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Socket error")); - return; - } - - conn = connection_find(qd, source); - g_return_if_fail(conn != NULL); - - /* test code, not using tcp_rxqueue - memset(pkt,0, sizeof(pkt)); - buf_len = read(qd->fd, pkt, sizeof(pkt)); - if (buf_len > 2) { - packet_process(gc, pkt + 2, buf_len - 2); - } - return; - */ - - buf_len = read(source, buf, sizeof(buf)); - if (buf_len < 0) { - if (errno == EAGAIN) - /* No worries */ - return; - - error_msg = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - error_msg); - g_free(error_msg); - return; - } else if (buf_len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - /* keep alive will be sent in 30 seconds since last_receive - * QQ need a keep alive packet in every 60 seconds - gc->last_received = time(NULL); - */ - /* purple_debug_info("TCP_PENDING", "Read %d bytes, rxlen is %d\n", buf_len, conn->tcp_rxlen); */ - conn->tcp_rxqueue = g_realloc(conn->tcp_rxqueue, buf_len + conn->tcp_rxlen); - memcpy(conn->tcp_rxqueue + conn->tcp_rxlen, buf, buf_len); - conn->tcp_rxlen += buf_len; - - pkt = g_newa(guint8, MAX_PACKET_SIZE); - while (PURPLE_CONNECTION_IS_VALID(gc)) { - if (qd->openconns == NULL) { - break; - } - if (conn->tcp_rxqueue == NULL) { - conn->tcp_rxlen = 0; - break; - } - if (conn->tcp_rxlen < QQ_TCP_HEADER_LENGTH) { - break; - } - - bytes = 0; - bytes += qq_get16(&pkt_len, conn->tcp_rxqueue + bytes); - if (conn->tcp_rxlen < pkt_len) { - break; - } - - /* purple_debug_info("TCP_PENDING", "Packet len=%d, rxlen=%d\n", pkt_len, conn->tcp_rxlen); */ - if ( pkt_len < QQ_TCP_HEADER_LENGTH - || *(conn->tcp_rxqueue + bytes) != QQ_PACKET_TAG - || *(conn->tcp_rxqueue + pkt_len - 1) != QQ_PACKET_TAIL) { - /* HEY! This isn't even a QQ. What are you trying to pull? */ - purple_debug_warning("TCP_PENDING", "Packet error, no header or tail tag\n"); - - jump = memchr(conn->tcp_rxqueue + 1, QQ_PACKET_TAIL, conn->tcp_rxlen - 1); - if ( !jump ) { - purple_debug_warning("TCP_PENDING", "Failed to find next tail, clear receive buffer\n"); - g_free(conn->tcp_rxqueue); - conn->tcp_rxqueue = NULL; - conn->tcp_rxlen = 0; - return; - } - - /* jump and over QQ_PACKET_TAIL */ - jump_len = (jump - conn->tcp_rxqueue) + 1; - purple_debug_warning("TCP_PENDING", "Find next tail at %d, jump %d\n", jump_len, jump_len + 1); - g_memmove(conn->tcp_rxqueue, jump, conn->tcp_rxlen - jump_len); - conn->tcp_rxlen -= jump_len; - continue; - } - - memset(pkt, 0, MAX_PACKET_SIZE); - g_memmove(pkt, conn->tcp_rxqueue + bytes, pkt_len - bytes); - - /* jump to next packet */ - conn->tcp_rxlen -= pkt_len; - if (conn->tcp_rxlen) { - /* purple_debug_info("TCP_PENDING", "shrink tcp_rxqueue to %d\n", conn->tcp_rxlen); */ - jump = g_memdup(conn->tcp_rxqueue + pkt_len, conn->tcp_rxlen); - g_free(conn->tcp_rxqueue); - conn->tcp_rxqueue = jump; - } else { - /* purple_debug_info("TCP_PENDING", "free tcp_rxqueue\n"); */ - g_free(conn->tcp_rxqueue); - conn->tcp_rxqueue = NULL; - } - - /* packet_process may call disconnect and destory data like conn - * do not call packet_process before jump, - * break if packet_process return FALSE */ - if (packet_process(gc, pkt, pkt_len - bytes) == FALSE) { - purple_debug_info("TCP_PENDING", "Connection has been destory\n"); - break; - } - } -} - -static void udp_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = NULL; - qq_data *qd; - guint8 *buf; - gint buf_len; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - if(cond != PURPLE_INPUT_READ) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Socket error")); - return; - } - - buf = g_newa(guint8, MAX_PACKET_SIZE); - - /* here we have UDP proxy suppport */ - buf_len = read(source, buf, MAX_PACKET_SIZE); - if (buf_len <= 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to read from socket")); - return; - } - - /* keep alive will be sent in 30 seconds since last_receive - * QQ need a keep alive packet in every 60 seconds - gc->last_received = time(NULL); - */ - - if (buf_len < QQ_UDP_HEADER_LENGTH) { - if (buf[0] != QQ_PACKET_TAG || buf[buf_len - 1] != QQ_PACKET_TAIL) { - qq_hex_dump(PURPLE_DEBUG_ERROR, "UDP_PENDING", - buf, buf_len, - "Received packet is too short, or no header and tail tag"); - return; - } - } - - /* packet_process may call disconnect and destory data like conn - * do not call packet_process before jump, - * break if packet_process return FALSE */ - packet_process(gc, buf, buf_len); -} - -static gint udp_send_out(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint ret; - - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - -#if 0 - purple_debug_info("UDP_SEND_OUT", "Send %d bytes to socket %d\n", data_len, qd->fd); -#endif - - errno = 0; - ret = send(qd->fd, data, data_len, 0); - if (ret < 0 && errno == EAGAIN) { - return ret; - } - - if (ret < 0) { - /* TODO: what to do here - do we really have to disconnect? */ - purple_debug_error("UDP_SEND_OUT", "Send failed: %d, %s\n", errno, g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - g_strerror(errno)); - } - return ret; -} - -static void tcp_can_write(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - qq_connection *conn; - int ret, writelen; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - conn = connection_find(qd, source); - g_return_if_fail(conn != NULL); - - writelen = purple_circ_buffer_get_max_read(conn->tcp_txbuf); - if (writelen == 0) { - purple_input_remove(conn->can_write_handler); - conn->can_write_handler = 0; - return; - } - - ret = write(source, conn->tcp_txbuf->outptr, writelen); - purple_debug_info("TCP_CAN_WRITE", "total %d bytes is sent %d\n", writelen, ret); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret < 0) { - /* TODO: what to do here - do we really have to disconnect? */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(conn->tcp_txbuf, ret); -} - -static gint tcp_send_out(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - qq_connection *conn; - gint ret; - - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - - conn = connection_find(qd, qd->fd); - g_return_val_if_fail(conn, -1); - -#if 0 - purple_debug_info("TCP_SEND_OUT", "Send %d bytes to socket %d\n", data_len, qd->fd); -#endif - - if (conn->can_write_handler == 0) { - ret = write(qd->fd, data, data_len); - } else { - ret = -1; - errno = EAGAIN; - } - - /* - purple_debug_info("TCP_SEND_OUT", - "Socket %d, total %d bytes is sent %d\n", qd->fd, data_len, ret); - */ - if (ret < 0 && errno == EAGAIN) { - /* socket is busy, send later */ - purple_debug_info("TCP_SEND_OUT", "Socket is busy and send later\n"); - ret = 0; - } else if (ret <= 0) { - /* TODO: what to do here - do we really have to disconnect? */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_debug_error("TCP_SEND_OUT", - "Send to socket %d failed: %d, %s\n", qd->fd, errno, g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return ret; - } - - if (ret < data_len) { - purple_debug_info("TCP_SEND_OUT", "Add %d bytes to buffer\n", data_len - ret); - if (conn->can_write_handler == 0) { - conn->can_write_handler = purple_input_add(qd->fd, PURPLE_INPUT_WRITE, tcp_can_write, gc); - } - if (conn->tcp_txbuf == NULL) { - conn->tcp_txbuf = purple_circ_buffer_new(4096); - } - purple_circ_buffer_append(conn->tcp_txbuf, data + ret, data_len - ret); - } - return ret; -} - -static gboolean network_timeout(gpointer data) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - gboolean is_lost_conn; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, TRUE); - qd = (qq_data *) gc->proto_data; - - is_lost_conn = qq_trans_scan(gc); - if (is_lost_conn) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - return TRUE; - } - - if ( !qd->is_login ) { - return TRUE; - } - - qd->itv_count.keep_alive--; - if (qd->itv_count.keep_alive <= 0) { - qd->itv_count.keep_alive = qd->itv_config.keep_alive; - if (qd->client_version >= 2008) { - qq_request_keep_alive_2008(gc); - } else if (qd->client_version >= 2007) { - qq_request_keep_alive_2007(gc); - } else { - qq_request_keep_alive(gc); - } - return TRUE; - } - - if (qd->itv_config.update <= 0) { - return TRUE; - } - - qd->itv_count.update--; - if (qd->itv_count.update <= 0) { - qd->itv_count.update = qd->itv_config.update; - qq_update_online(gc, 0); - return TRUE; - } - - return TRUE; /* if return FALSE, timeout callback stops */ -} - -static void set_all_keys(PurpleConnection *gc) -{ - qq_data *qd; - const gchar *passwd; - guint8 *dest; - int dest_len = QQ_KEY_LENGTH; -#ifndef DEBUG - int bytes; -#endif - /* _qq_show_socket("Got login socket", source); */ - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - /* QQ use random seq, to minimize duplicated packets */ - srand(time(NULL)); - qd->send_seq = rand() & 0xffff; - - qd->is_login = FALSE; - qd->uid = strtoul(purple_account_get_username(purple_connection_get_account(gc)), NULL, 10); - -#ifdef DEBUG - memset(qd->ld.random_key, 0x01, sizeof(qd->ld.random_key)); -#else - for (bytes = 0; bytes < sizeof(qd->ld.random_key); bytes++) { - qd->ld.random_key[bytes] = (guint8) (rand() & 0xff); - } -#endif - - /* now generate md5 processed passwd */ - passwd = purple_account_get_password(purple_connection_get_account(gc)); - - /* use twice-md5 of user password as session key since QQ 2003iii */ - dest = qd->ld.pwd_md5; - qq_get_md5(dest, dest_len, (guint8 *)passwd, strlen(passwd)); - - dest = qd->ld.pwd_twice_md5; - qq_get_md5(dest, dest_len, qd->ld.pwd_md5, dest_len); -} - -/* the callback function after socket is built - * we setup the qq protocol related configuration here */ -static void connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc; - qq_data *qd; - PurpleAccount *account ; - qq_connection *conn; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - qd = (qq_data *) gc->proto_data; - account = purple_connection_get_account(gc); - - /* conn_data will be destoryed */ - qd->conn_data = NULL; - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_debug_info("QQ_CONN", "Invalid connection\n"); - close(source); - return; - } - - if (source < 0) { /* socket returns -1 */ - purple_debug_info("QQ_CONN", - "Could not establish a connection with the server:\n%s\n", - error_message); - if (qd->connect_watcher > 0) purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc); - return; - } - - /* _qq_show_socket("Got login socket", source); */ - qd->fd = source; - conn = connection_create(qd, source); - if (qd->use_tcp) { - conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, tcp_pending, gc); - } else { - conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, udp_pending, gc); - } - - g_return_if_fail(qd->network_watcher == 0); - qd->network_watcher = purple_timeout_add_seconds(qd->itv_config.resend, network_timeout, gc); - - set_all_keys( gc ); - - if (qd->client_version >= 2007) { - purple_connection_update_progress(gc, _("Getting server"), 2, QQ_CONNECT_STEPS); - qq_request_get_server(gc); - return; - } - - purple_connection_update_progress(gc, _("Requesting token"), 2, QQ_CONNECT_STEPS); - qq_request_token(gc); -} - -#ifndef purple_proxy_connect_udp -static void udp_can_write(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc; - qq_data *qd; - socklen_t len; - int error=0, ret; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - qd = (qq_data *) gc->proto_data; - - - purple_debug_info("proxy", "Connected.\n"); - - /* - * getsockopt after a non-blocking connect returns -1 if something is - * really messed up (bad descriptor, usually). Otherwise, it returns 0 and - * error holds what connect would have returned if it blocked until now. - * Thus, error == 0 is success, error == EINPROGRESS means "try again", - * and anything else is a real error. - * - * (error == EINPROGRESS can happen after a select because the kernel can - * be overly optimistic sometimes. select is just a hint that you might be - * able to do something.) - */ - len = sizeof(error); - ret = getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len); - if (ret == 0 && error == EINPROGRESS) - return; /* we'll be called again later */ - - purple_input_remove(qd->udp_can_write_handler); - qd->udp_can_write_handler = 0; - if (ret < 0 || error != 0) { - if(ret != 0) - error = errno; - - close(source); - - purple_debug_error("proxy", "getsockopt SO_ERROR check: %s\n", g_strerror(error)); - - connect_cb(gc, -1, _("Unable to connect")); - return; - } - - connect_cb(gc, source, NULL); -} - -static void udp_host_resolved(GSList *hosts, gpointer data, const char *error_message) { - PurpleConnection *gc; - qq_data *qd; - struct sockaddr server_addr; - int addr_size; - gint fd = -1; - int flags; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - qd = (qq_data *) gc->proto_data; - - /* udp_query_data must be set as NULL. - * Otherwise purple_dnsquery_destroy in qq_disconnect cause glib double free error */ - qd->udp_query_data = NULL; - - if (!hosts || !hosts->data) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to resolve hostname")); - return; - } - - addr_size = GPOINTER_TO_INT(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - memcpy(&server_addr, hosts->data, addr_size); - g_free(hosts->data); - - hosts = g_slist_remove(hosts, hosts->data); - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - fd = socket(PF_INET, SOCK_DGRAM, 0); - if (fd < 0) { - purple_debug_error("QQ", - "Unable to create socket: %s\n", g_strerror(errno)); - return; - } - - /* we use non-blocking mode to speed up connection */ - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - /* From Unix-socket-FAQ: http://www.faqs.org/faqs/unix-faq/socket/ - * - * If a UDP socket is unconnected, which is the normal state after a - * bind() call, then send() or write() are not allowed, since no - * destination is available; only sendto() can be used to send data. - * - * Calling connect() on the socket simply records the specified address - * and port number as being the desired communications partner. That - * means that send() or write() are now allowed; they use the destination - * address and port given on the connect call as the destination of packets. - */ - if (connect(fd, &server_addr, addr_size) >= 0) { - purple_debug_info("QQ", "Connected.\n"); - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); - connect_cb(gc, fd, NULL); - return; - } - - /* [EINPROGRESS] - * The socket is marked as non-blocking and the connection cannot be - * completed immediately. It is possible to select for completion by - * selecting the socket for writing. - * [EINTR] - * A signal interrupted the call. - * The connection is established asynchronously. - */ - if ((errno == EINPROGRESS) || (errno == EINTR)) { - purple_debug_warning( "QQ", "Connect in asynchronous mode.\n"); - qd->udp_can_write_handler = purple_input_add(fd, PURPLE_INPUT_WRITE, udp_can_write, gc); - return; - } - - purple_debug_error("QQ", "Connection failed: %s\n", g_strerror(errno)); - close(fd); -} -#endif - -gboolean connect_to_server(PurpleConnection *gc, gchar *server, gint port) -{ - PurpleAccount *account ; - qq_data *qd; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); - account = purple_connection_get_account(gc); - qd = (qq_data *) gc->proto_data; - - if (server == NULL || server[0] == '\0' || port == 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid server or port")); - return FALSE; - } - - purple_connection_update_progress(gc, _("Connecting to server"), 1, QQ_CONNECT_STEPS); - - purple_debug_info("QQ", "Connect to %s:%d\n", server, port); - - if (qd->conn_data != NULL) { - purple_proxy_connect_cancel(qd->conn_data); - qd->conn_data = NULL; - } - -#ifdef purple_proxy_connect_udp - if (qd->use_tcp) { - qd->conn_data = purple_proxy_connect(gc, account, server, port, connect_cb, gc); - } else { - qd->conn_data = purple_proxy_connect_udp(gc, account, server, port, connect_cb, gc); - } - if ( qd->conn_data == NULL ) { - purple_debug_error("QQ", "Couldn't create socket\n"); - return FALSE; - } -#else - /* QQ connection via UDP/TCP. - * Now use Purple proxy function to provide TCP proxy support, - * and qq_udp_proxy.c to add UDP proxy support (thanks henry) */ - if(qd->use_tcp) { - qd->conn_data = purple_proxy_connect(gc, account, server, port, connect_cb, gc); - if ( qd->conn_data == NULL ) { - purple_debug_error("QQ", "Unable to connect.\n"); - return FALSE; - } - return TRUE; - } - - purple_debug_info("QQ", "UDP Connect to %s:%d\n", server, port); - qd->udp_query_data = purple_dnsquery_a(server, port, udp_host_resolved, gc); - if ( qd->udp_query_data == NULL ) { - purple_debug_error("QQ", "Could not resolve hostname\n"); - return FALSE; - } -#endif - return TRUE; -} - -/* clean up qq_data structure and all its components - * always used before a redirectly connection */ -void qq_disconnect(PurpleConnection *gc) -{ - qq_data *qd; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Disconnecting...\n"); - - if (qd->network_watcher > 0) { - purple_debug_info("QQ", "Remove network watcher\n"); - purple_timeout_remove(qd->network_watcher); - qd->network_watcher = 0; - } - - /* finish all I/O */ - if (qd->fd >= 0 && qd->is_login) { - qq_request_logout(gc); - } - - /* not connected */ - if (qd->conn_data != NULL) { - purple_debug_info("QQ", "Connect cancel\n"); - purple_proxy_connect_cancel(qd->conn_data); - qd->conn_data = NULL; - } -#ifndef purple_proxy_connect_udp - if (qd->udp_can_write_handler) { - purple_input_remove(qd->udp_can_write_handler); - qd->udp_can_write_handler = 0; - } - if (qd->udp_query_data != NULL) { - purple_debug_info("QQ", "destroy udp_query_data\n"); - purple_dnsquery_destroy(qd->udp_query_data); - qd->udp_query_data = NULL; - } -#endif - connection_free_all(qd); - qd->fd = -1; - - qq_trans_remove_all(gc); - - memset(qd->ld.random_key, 0, sizeof(qd->ld.random_key)); - memset(qd->ld.pwd_md5, 0, sizeof(qd->ld.pwd_md5)); - memset(qd->ld.pwd_twice_md5, 0, sizeof(qd->ld.pwd_twice_md5)); - memset(qd->ld.login_key, 0, sizeof(qd->ld.login_key)); - memset(qd->session_key, 0, sizeof(qd->session_key)); - memset(qd->session_md5, 0, sizeof(qd->session_md5)); - - qd->my_local_ip.s_addr = 0; - qd->my_local_port = 0; - qd->my_ip.s_addr = 0; - qd->my_port = 0; - - qq_room_data_free_all(gc); - qq_buddy_data_free_all(gc); -} - -static gint packet_encap(qq_data *qd, guint8 *buf, gint maxlen, guint16 cmd, guint16 seq, - guint8 *data, gint data_len) -{ - gint bytes = 0; - g_return_val_if_fail(qd != NULL && buf != NULL && maxlen > 0, -1); - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - /* QQ TCP packet has two bytes in the begining defines packet length - * so leave room here to store packet size */ - if (qd->use_tcp) { - bytes += qq_put16(buf + bytes, 0x0000); - } - /* now comes the normal QQ packet as UDP */ - bytes += qq_put8(buf + bytes, QQ_PACKET_TAG); - bytes += qq_put16(buf + bytes, qd->client_tag); - bytes += qq_put16(buf + bytes, cmd); - - bytes += qq_put16(buf + bytes, seq); - - bytes += qq_put32(buf + bytes, qd->uid); - bytes += qq_putdata(buf + bytes, data, data_len); - bytes += qq_put8(buf + bytes, QQ_PACKET_TAIL); - - /* set TCP packet length at begin of the packet */ - if (qd->use_tcp) { - qq_put16(buf, bytes); - } - - return bytes; -} - -/* data has been encrypted before */ -static gint packet_send_out(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *data, gint data_len) -{ - qq_data *qd; - guint8 *buf; - gint buf_len; - gint bytes_sent; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *)gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - buf_len = packet_encap(qd, buf, MAX_PACKET_SIZE, cmd, seq, data, data_len); - if (buf_len <= 0) { - return -1; - } - - qd->net_stat.sent++; - if (qd->use_tcp) { - bytes_sent = tcp_send_out(gc, buf, buf_len); - } else { - bytes_sent = udp_send_out(gc, buf, buf_len); - } - - return bytes_sent; -} - -gint qq_send_cmd_encrypted(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *encrypted, gint encrypted_len, gboolean is_save2trans) -{ - gint sent_len; - -#if 1 - /* qq_show_packet("qq_send_cmd_encrypted", data, data_len); */ - purple_debug_info("QQ", "<== [%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, encrypted_len); -#endif - - sent_len = packet_send_out(gc, cmd, seq, encrypted, encrypted_len); - if (is_save2trans) { - qq_trans_add_client_cmd(gc, cmd, seq, encrypted, encrypted_len, 0, 0); - } - return sent_len; -} - -/* Encrypt data with session_key, and send packet out */ -static gint send_cmd_detail(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len, gboolean is_save2trans, - guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *encrypted; - gint encrypted_len; - gint bytes_sent; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *)gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - /* at most 17 bytes more */ - encrypted = g_newa(guint8, data_len + 17); - encrypted_len = qq_encrypt(encrypted, data, data_len, qd->session_key); - if (encrypted_len < 16) { - purple_debug_error("QQ_ENCRYPT", "Error len %d: [%05d] 0x%04X %s\n", - encrypted_len, seq, cmd, qq_get_cmd_desc(cmd)); - return -1; - } - - bytes_sent = packet_send_out(gc, cmd, seq, encrypted, encrypted_len); - - if (is_save2trans) { - qq_trans_add_client_cmd(gc, cmd, seq, encrypted, encrypted_len, - update_class, ship32); - } - return bytes_sent; -} - -gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len, - guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint16 seq; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - seq = ++qd->send_seq; -#if 1 - purple_debug_info("QQ", "<== [%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, data_len); -#endif - return send_cmd_detail(gc, cmd, seq, data, data_len, TRUE, update_class, ship32); -} - -/* set seq and is_save2trans, then call send_cmd_detail */ -gint qq_send_cmd(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len) -{ - qq_data *qd; - guint16 seq; - gboolean is_save2trans; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - if (cmd != QQ_CMD_LOGOUT) { - seq = ++qd->send_seq; - is_save2trans = TRUE; - } else { - seq = 0xFFFF; - is_save2trans = FALSE; - } -#if 1 - purple_debug_info("QQ", "<== [%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, data_len); -#endif - return send_cmd_detail(gc, cmd, seq, data, data_len, is_save2trans, 0, 0); -} - -/* set seq and is_save2trans, then call send_cmd_detail */ -gint qq_send_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *data, gint data_len) -{ - qq_data *qd; - guint8 *encrypted; - gint encrypted_len; - gint bytes_sent; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *)gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - -#if 1 - purple_debug_info("QQ", "<== [SRV-%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, data_len); -#endif - /* at most 17 bytes more */ - encrypted = g_newa(guint8, data_len + 17); - encrypted_len = qq_encrypt(encrypted, data, data_len, qd->session_key); - if (encrypted_len < 16) { - purple_debug_error("QQ_ENCRYPT", "Error len %d: [%05d] 0x%04X %s\n", - encrypted_len, seq, cmd, qq_get_cmd_desc(cmd)); - return -1; - } - - bytes_sent = packet_send_out(gc, cmd, seq, encrypted, encrypted_len); - qq_trans_add_server_reply(gc, cmd, seq, encrypted, encrypted_len); - - return bytes_sent; -} - -static gint send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *buf; - gint buf_len; - guint8 *encrypted; - gint encrypted_len; - gint bytes_sent; - guint16 seq; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - - /* encap room_cmd and room id to buf*/ - buf_len = 0; - buf_len += qq_put8(buf + buf_len, room_cmd); - if (room_id != 0) { - /* id 0 is for QQ Demo Group, now they are closed*/ - buf_len += qq_put32(buf + buf_len, room_id); - } - if (data != NULL && data_len > 0) { - buf_len += qq_putdata(buf + buf_len, data, data_len); - } - - qd->send_seq++; - seq = qd->send_seq; - - /* Encrypt to encrypted with session_key */ - /* at most 17 bytes more */ - encrypted = g_newa(guint8, buf_len + 17); - encrypted_len = qq_encrypt(encrypted, buf, buf_len, qd->session_key); - if (encrypted_len < 16) { - purple_debug_error("QQ_ENCRYPT", "Error len %d: [%05d] %s (0x%02X)\n", - encrypted_len, seq, qq_get_room_cmd_desc(room_cmd), room_cmd); - return -1; - } - - bytes_sent = packet_send_out(gc, QQ_CMD_ROOM, seq, encrypted, encrypted_len); -#if 1 - /* qq_show_packet("send_room_cmd", buf, buf_len); */ - purple_debug_info("QQ", - "<== [%05d] %s (0x%02X) to room %d, datalen %d\n", - seq, qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, buf_len); -#endif - - qq_trans_add_room_cmd(gc, seq, room_cmd, room_id, encrypted, encrypted_len, - update_class, ship32); - return bytes_sent; -} - -gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - g_return_val_if_fail(room_cmd > 0, -1); - return send_room_cmd(gc, room_cmd, room_id, data, data_len, update_class, ship32); -} - -gint qq_send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len) -{ - g_return_val_if_fail(room_cmd > 0 && room_id > 0, -1); - return send_room_cmd(gc, room_cmd, room_id, data, data_len, 0, 0); -} - -gint qq_send_room_cmd_noid(PurpleConnection *gc, guint8 room_cmd, - guint8 *data, gint data_len) -{ - g_return_val_if_fail(room_cmd > 0, -1); - return send_room_cmd(gc, room_cmd, 0, data, data_len, 0, 0); -} - -gint qq_send_room_cmd_only(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - g_return_val_if_fail(room_cmd > 0 && room_id > 0, -1); - return send_room_cmd(gc, room_cmd, room_id, NULL, 0, 0, 0); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_network.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/** - * @file qq_network.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_NETWORK_H -#define _QQ_NETWORK_H - -#include -#include "connection.h" - -#include "qq.h" - -#define QQ_CONNECT_STEPS 4 /* steps in connection */ - -gboolean qq_connect_later(gpointer data); -void qq_disconnect(PurpleConnection *gc); - -gint qq_send_cmd_encrypted(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *encrypted_data, gint encrypted_len, gboolean is_save2trans); -gint qq_send_cmd(PurpleConnection *gc, guint16 cmd, guint8 *data, gint datalen); -gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len, - guint32 update_class, guint32 ship32); - -gint qq_send_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len); - -gint qq_send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len); -gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32); -gint qq_send_room_cmd_only(PurpleConnection *gc, guint8 room_cmd, guint32 room_id); -gint qq_send_room_cmd_noid(PurpleConnection *gc, guint8 room_cmd, - guint8 *data, gint data_len); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1173 +0,0 @@ -/** - * @file qq_network.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "cipher.h" -#include "debug.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "group_info.h" -#include "char_conv.h" -#include "qq_crypt.h" - -#include "group_internal.h" -#include "group_im.h" -#include "group_info.h" -#include "group_join.h" -#include "group_opt.h" - -#include "qq_define.h" -#include "qq_base.h" -#include "im.h" -#include "qq_process.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_trans.h" -#include "utils.h" -#include "buddy_memo.h" - -enum { - QQ_ROOM_CMD_REPLY_OK = 0x00, - QQ_ROOM_CMD_REPLY_SEARCH_ERROR = 0x02, - QQ_ROOM_CMD_REPLY_NOT_MEMBER = 0x0a -}; - -/* default process, decrypt and dump */ -static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq) -{ - qq_data *qd; - gchar *msg; - - g_return_if_fail(data != NULL && data_len != 0); - - qq_show_packet(title, data, data_len); - - qd = (qq_data *) gc->proto_data; - - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", - data, data_len, - ">>> [%d] %s -> [default] decrypt and dump", - seq, qq_get_cmd_desc(cmd)); - - msg = g_strdup_printf("Unknow command 0x%02X, %s", cmd, qq_get_cmd_desc(cmd)); - purple_notify_info(gc, _("QQ Error"), title, msg); - g_free(msg); -} - -/* parse the reply to send_im */ -static void do_im_ack(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = gc->proto_data; - - if (data[0] != 0) { - purple_debug_warning("QQ", "Failed sent IM\n"); - purple_notify_error(gc, _("Error"), _("Unable to send message."), NULL); - return; - } - - purple_debug_info("QQ", "OK sent IM\n"); -} - -static void do_server_news(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd = (qq_data *) gc->proto_data; - gint bytes; - gchar *title, *brief, *url; - gchar *content; - - g_return_if_fail(data != NULL && data_len != 0); - - /* qq_show_packet("Rcv news", data, data_len); */ - - bytes = 4; /* skip unknown 4 bytes */ - - bytes += qq_get_vstr(&title, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&brief, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&url, QQ_CHARSET_DEFAULT, data + bytes); - - content = g_strdup_printf(_("Server News:\n%s\n%s\n%s"), title, brief, url); - - if (qd->is_show_news) { - qq_got_message(gc, content); - } else { - purple_debug_info("QQ", "QQ Server news:\n%s\n", content); - } - g_free(title); - g_free(brief); - g_free(url); - g_free(content); -} - -static void do_got_sms(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes; - gchar *mobile = NULL; - gchar *msg = NULL; - gchar *msg_utf8 = NULL; - gchar *msg_formated; - - g_return_if_fail(data != NULL && data_len > 26); - - qq_show_packet("Rcv sms", data, data_len); - - bytes = 0; - bytes += 1; /* skip 0x00 */ - mobile = g_strndup((gchar *)data + bytes, 20); - bytes += 20; - bytes += 5; /* skip 0x(49 11 98 d5 03)*/ - if (bytes < data_len) { - msg = g_strndup((gchar *)data + bytes, data_len - bytes); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - } else { - msg_utf8 = g_strdup(""); - } - - msg_formated = g_strdup_printf(_("%s:%s"), mobile, msg_utf8); - - qq_got_message(gc, msg_formated); - - g_free(msg_formated); - g_free(msg_utf8); - g_free(mobile); -} - -static void do_msg_sys_30(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint len; - guint8 reply; - gchar **segments, *msg_utf8; - - g_return_if_fail(data != NULL && data_len != 0); - - len = data_len; - - if (NULL == (segments = split_data(data, len, "\x2f", 2))) - return; - - reply = strtol(segments[0], NULL, 10); - if (reply == 1) - purple_debug_warning("QQ", "We are kicked out by QQ server\n"); - - msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); - qq_got_message(gc, msg_utf8); -} - -static void do_msg_sys_4c(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes; - gint msg_len; - GString *content; - gchar *msg = NULL; - - g_return_if_fail(data != NULL && data_len > 0); - - bytes = 6; /* skip 0x(06 00 01 1e 01 1c)*/ - - content = g_string_new(""); - while (bytes < data_len) { - msg_len = qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data + bytes); - g_string_append(content, msg); - g_string_append(content, "\n"); - g_free(msg); - - if (msg_len <= 1) { - break; - } - bytes += msg_len; - } - if (bytes != data_len) { - purple_debug_warning("QQ", "Failed to read QQ_MSG_SYS_4C\n"); - qq_show_packet("do_msg_sys_4c", data, data_len); - } - qq_got_message(gc, content->str); - g_string_free(content, FALSE); -} - -static const gchar *get_im_type_desc(gint type) -{ - switch (type) { - case QQ_MSG_TO_BUDDY: - return "QQ_MSG_TO_BUDDY"; - case QQ_MSG_TO_UNKNOWN: - return "QQ_MSG_TO_UNKNOWN"; - case QQ_MSG_QUN_IM_UNKNOWN: - return "QQ_MSG_QUN_IM_UNKNOWN"; - case QQ_MSG_ADD_TO_QUN: - return "QQ_MSG_ADD_TO_QUN"; - case QQ_MSG_DEL_FROM_QUN: - return "QQ_MSG_DEL_FROM_QUN"; - case QQ_MSG_APPLY_ADD_TO_QUN: - return "QQ_MSG_APPLY_ADD_TO_QUN"; - case QQ_MSG_CREATE_QUN: - return "QQ_MSG_CREATE_QUN"; - case QQ_MSG_SYS_30: - return "QQ_MSG_SYS_30"; - case QQ_MSG_SYS_4C: - return "QQ_MSG_SYS_4C"; - case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: - return "QQ_MSG_APPROVE_APPLY_ADD_TO_QUN"; - case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: - return "QQ_MSG_REJCT_APPLY_ADD_TO_QUN"; - case QQ_MSG_TEMP_QUN_IM: - return "QQ_MSG_TEMP_QUN_IM"; - case QQ_MSG_QUN_IM: - return "QQ_MSG_QUN_IM"; - case QQ_MSG_NEWS: - return "QQ_MSG_NEWS"; - case QQ_MSG_SMS: - return "QQ_MSG_SMS"; - case QQ_MSG_EXTEND: - return "QQ_MSG_EXTEND"; - case QQ_MSG_EXTEND_85: - return "QQ_MSG_EXTEND_85"; - default: - return "QQ_MSG_UNKNOWN"; - } -} - -/* I receive a message, mainly it is text msg, - * but we need to proess other types (group etc) */ -static void process_private_msg(guint8 *data, gint data_len, guint16 seq, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - - struct { - guint32 uid_from; - guint32 uid_to; - guint32 seq; - struct in_addr ip_from; - guint16 port_from; - guint16 msg_type; - } header; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (data_len < 16) { /* we need to ack with the first 16 bytes */ - purple_debug_error("QQ", "MSG is too short\n"); - return; - } else { - /* when we receive a message, - * we send an ACK which is the first 16 bytes of incoming packet */ - qq_send_server_reply(gc, QQ_CMD_RECV_IM, seq, data, 16); - } - - /* check len first */ - if (data_len < 20) { /* length of im_header */ - purple_debug_error("QQ", "Invald MSG header, len %d < 20\n", data_len); - return; - } - - bytes = 0; - bytes += qq_get32(&(header.uid_from), data + bytes); - bytes += qq_get32(&(header.uid_to), data + bytes); - bytes += qq_get32(&(header.seq), data + bytes); - /* if the message is delivered via server, it is server IP/port */ - bytes += qq_getIP(&(header.ip_from), data + bytes); - bytes += qq_get16(&(header.port_from), data + bytes); - bytes += qq_get16(&(header.msg_type), data + bytes); - /* im_header prepared */ - - if (header.uid_to != qd->uid) { /* should not happen */ - purple_debug_error("QQ", "MSG to %u, NOT me\n", header.uid_to); - return; - } - - /* check bytes */ - if (bytes >= data_len - 1) { - purple_debug_warning("QQ", "Empty MSG\n"); - return; - } - - switch (header.msg_type) { - case QQ_MSG_NEWS: - do_server_news(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_SMS: - do_got_sms(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_EXTEND: - case QQ_MSG_EXTEND_85: - purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from); - qq_process_extend_im(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_TO_UNKNOWN: - case QQ_MSG_TO_BUDDY: - purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from); - qq_process_im(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_QUN_IM_UNKNOWN: - case QQ_MSG_TEMP_QUN_IM: - case QQ_MSG_QUN_IM: - purple_debug_info("QQ", "MSG from room [%d]\n", header.uid_from); - qq_process_room_im(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type); - break; - case QQ_MSG_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from [%d], Added\n", header.uid_from); - /* uid_from is group id - * we need this to create a dummy group and add to blist */ - qq_process_room_buddy_joined(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_DEL_FROM_QUN: - purple_debug_info("QQ", "Notice from room [%d], Removed\n", header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_removed(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_APPLY_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from room [%d], Joined\n", header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_request_join(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n", - header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_approved(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n", - header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_rejected(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_SYS_30: - do_msg_sys_30(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_SYS_4C: - do_msg_sys_4c(gc, data + bytes, data_len - bytes); - break; - default: - purple_debug_warning("QQ", "MSG from %u, unknown type %s [0x%04X]\n", - header.uid_from, get_im_type_desc(header.msg_type), header.msg_type); - qq_show_packet("MSG header", data, bytes); - if (data_len - bytes > 0) { - qq_show_packet("MSG data", data + bytes, data_len - bytes); - } - break; - } -} - -/* Send ACK if the sys message needs an ACK */ -static void request_server_ack(PurpleConnection *gc, gchar *funct_str, gchar *from, guint16 seq) -{ - qq_data *qd; - guint8 *raw_data; - gint bytes; - guint8 bar; - - g_return_if_fail(funct_str != NULL && from != NULL); - qd = (qq_data *) gc->proto_data; - - - bar = 0x1e; - raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16); - - bytes = 0; - bytes += qq_putdata(raw_data + bytes, (guint8 *)funct_str, strlen(funct_str)); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_putdata(raw_data + bytes, (guint8 *)from, strlen(from)); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_put16(raw_data + bytes, seq); - - qq_send_server_reply(gc, QQ_CMD_ACK_SYS_MSG, 0, raw_data, bytes); -} - -static void do_server_notice(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - qq_data *qd = (qq_data *) gc->proto_data; - gchar *msg, *msg_utf8; - gchar *title, *content; - - g_return_if_fail(from != NULL && to != NULL && data_len > 0); - - msg = g_strndup((gchar *)data, data_len); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - if (msg_utf8 == NULL) { - purple_debug_error("QQ", "Recv NULL sys msg from %s to %s, discard\n", - from, to); - return; - } - - title = g_strdup_printf(_("From %s:"), from); - content = g_strdup_printf(_("Server notice From %s: \n%s"), from, msg_utf8); - - if (qd->is_show_notice) { - qq_got_message(gc, content); - } else { - purple_debug_info("QQ", "QQ Server notice from %s:\n%s\n", from, msg_utf8); - } - g_free(msg_utf8); - g_free(title); - g_free(content); -} - -static void process_server_msg(PurpleConnection *gc, guint8 *data, gint data_len, guint16 seq) -{ - qq_data *qd; - guint8 *data_str, i = 0; - gchar **segments, **seg; - gchar *funct_str, *from, *to; - gint bytes, funct; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - data_str = g_newa(guint8, data_len + 1); - g_memmove(data_str, data, data_len); - data_str[data_len] = 0x00; - - segments = g_strsplit((gchar *) data_str, "\x1f", 0); - g_return_if_fail(segments != NULL); - for (seg = segments; *seg != NULL; seg++) - i++; - if (i < 3) { - purple_debug_warning("QQ", "Server message segments is less than 3\n"); - g_strfreev(segments); - return; - } - - bytes = 0; - funct_str = segments[0]; - bytes += strlen(funct_str) + 1; - from = segments[1]; - bytes += strlen(from) + 1; - to = segments[2]; - bytes += strlen(to) + 1; - - request_server_ack(gc, funct_str, from, seq); - - /* qq_show_packet("Server MSG", data, data_len); */ - if (strtoul(to, NULL, 10) != qd->uid) { /* not to me */ - purple_debug_error("QQ", "Recv sys msg to [%s], not me!, discard\n", to); - g_strfreev(segments); - return; - } - - funct = strtol(funct_str, NULL, 10); - switch (funct) { - case QQ_SERVER_BUDDY_ADDED: - case QQ_SERVER_BUDDY_ADD_REQUEST: - case QQ_SERVER_BUDDY_ADDED_ME: - case QQ_SERVER_BUDDY_REJECTED_ME: - case QQ_SERVER_BUDDY_ADD_REQUEST_EX: - case QQ_SERVER_BUDDY_ADDING_EX: - case QQ_SERVER_BUDDY_ADDED_ANSWER: - case QQ_SERVER_BUDDY_ADDED_EX: - qq_process_buddy_from_server(gc, funct, from, to, data + bytes, data_len - bytes); - break; - case QQ_SERVER_NOTICE: - do_server_notice(gc, from, to, data + bytes, data_len - bytes); - break; - case QQ_SERVER_NEW_CLIENT: - purple_debug_warning("QQ", "QQ Server has newer client version\n"); - break; - default: - qq_show_packet("Unknown sys msg", data, data_len); - purple_debug_warning("QQ", "Recv unknown sys msg code: %s\n", funct_str); - break; - } - g_strfreev(segments); -} - -void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len) -{ - qq_data *qd; - - guint8 *data; - gint data_len; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - data = g_newa(guint8, rcved_len); - data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); - if (data_len < 0) { - purple_debug_warning("QQ", - "Can not decrypt server cmd by session key, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - return; - } - - if (data_len <= 0) { - purple_debug_warning("QQ", - "Server cmd decrypted is empty, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - return; - } - - /* now process the packet */ - switch (cmd) { - case QQ_CMD_RECV_IM: - process_private_msg(data, data_len, seq, gc); - break; - case QQ_CMD_RECV_MSG_SYS: - process_server_msg(gc, data, data_len, seq); - break; - case QQ_CMD_BUDDY_CHANGE_STATUS: - qq_process_buddy_change_status(data, data_len, gc); - break; - default: - process_unknow_cmd(gc, _("Unknown SERVER CMD"), data, data_len, cmd, seq); - break; - } -} - -static void process_room_cmd_notify(PurpleConnection *gc, - guint8 room_cmd, guint8 room_id, guint8 reply, guint8 *data, gint data_len) -{ - gchar *prim; - gchar *msg, *msg_utf8; - g_return_if_fail(data != NULL && data_len > 0); - - msg = g_strndup((gchar *) data, data_len); /* it will append 0x00 */ - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - - prim = g_strdup_printf(_("Error reply of %s(0x%02X)\nRoom %u, reply 0x%02X"), - qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, reply); - - purple_notify_error(gc, _("QQ Qun Command"), prim, msg_utf8); - - g_free(prim); - g_free(msg_utf8); -} - -void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - qq_data *qd; - gint ret; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - switch (room_cmd) { - case 0: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ROOM, 0); - break; - case QQ_ROOM_CMD_GET_INFO: - ret = qq_request_room_get_buddies(gc, room_id, QQ_CMD_CLASS_UPDATE_ROOM); - if (ret <= 0) { - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ROOM, 0); - } - break; - case QQ_ROOM_CMD_GET_BUDDIES: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ROOM, 0); - break; - case QQ_ROOM_CMD_GET_ONLINES: - /* last command */ - default: - break; - } -} - -void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - qq_data *qd; - gboolean is_new_turn = FALSE; - guint32 next_id; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - next_id = qq_room_get_next(gc, room_id); - purple_debug_info("QQ", "Update rooms, next id %u, prev id %u\n", next_id, room_id); - - if (next_id <= 0) { - if (room_id > 0) { - is_new_turn = TRUE; - next_id = qq_room_get_next(gc, 0); - purple_debug_info("QQ", "New turn, id %u\n", next_id); - } else { - purple_debug_info("QQ", "No room. Finished update\n"); - return; - } - } - - switch (room_cmd) { - case 0: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - case QQ_ROOM_CMD_GET_INFO: - if (!is_new_turn) { - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - } else { - qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL); - } - break; - case QQ_ROOM_CMD_GET_BUDDIES: - /* last command */ - if (!is_new_turn) { - qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL); - } else { - purple_debug_info("QQ", "Finished update\n"); - } - break; - default: - break; - } -} - -void qq_update_all(PurpleConnection *gc, guint16 cmd) -{ - qq_data *qd; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - switch (cmd) { - case 0: - qq_request_buddy_info(gc, qd->uid, QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - case QQ_CMD_GET_BUDDY_INFO: - qq_request_change_status(gc, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_CHANGE_STATUS: - qq_request_get_buddies(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_GET_BUDDIES_LIST: - qq_request_get_buddies_and_rooms(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_GET_BUDDIES_AND_ROOMS: - if (qd->client_version >= 2007) { - /* QQ2007/2008 can not get buddies level*/ - qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - } else { - qq_request_get_buddies_level(gc, QQ_CMD_CLASS_UPDATE_ALL); - } - break; - case QQ_CMD_GET_LEVEL: - qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_GET_BUDDIES_ONLINE: - /* last command */ - qq_update_all_rooms(gc, 0, 0); - break; - default: - break; - } - qd->online_last_update = time(NULL); -} - -static void update_all_rooms_online(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - qq_data *qd; - guint32 next_id; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - next_id = qq_room_get_next_conv(gc, room_id); - if (next_id <= 0 && room_id <= 0) { - purple_debug_info("QQ", "No room in conversation, no update online buddies\n"); - return; - } - if (next_id <= 0 ) { - purple_debug_info("QQ", "finished update rooms' online buddies\n"); - return; - } - - switch (room_cmd) { - case 0: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - case QQ_ROOM_CMD_GET_ONLINES: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - default: - break; - } -} - -void qq_update_online(PurpleConnection *gc, guint16 cmd) -{ - qq_data *qd; - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - switch (cmd) { - case 0: - qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ONLINE); - break; - case QQ_CMD_GET_BUDDIES_ONLINE: - /* last command */ - update_all_rooms_online(gc, 0, 0); - break; - default: - break; - } - qd->online_last_update = time(NULL); -} - -void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq, - guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len, - guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *data; - gint data_len; - qq_room_data *rmd; - gint bytes; - guint8 reply_cmd, reply; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - data = g_newa(guint8, rcved_len); - data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); - if (data_len < 0) { - purple_debug_warning("QQ", - "Can not decrypt room cmd by session key, [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - return; - } - - if (room_id <= 0) { - purple_debug_warning("QQ", - "Invaild room id, [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - /* Some room cmd has no room id, like QQ_ROOM_CMD_SEARCH */ - } - - if (data_len <= 2) { - purple_debug_warning("QQ", - "Invaild len of room cmd decrypted, [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - return; - } - - bytes = 0; - bytes += qq_get8(&reply_cmd, data + bytes); - bytes += qq_get8(&reply, data + bytes); - - if (reply_cmd != room_cmd) { - purple_debug_warning("QQ", - "Missing room cmd in reply 0x%02X %s, [%05d], 0x%02X %s for %d, len %d\n", - reply_cmd, qq_get_room_cmd_desc(reply_cmd), - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - } - - /* now process the packet */ - if (reply != QQ_ROOM_CMD_REPLY_OK) { - switch (reply) { /* this should be all errors */ - case QQ_ROOM_CMD_REPLY_NOT_MEMBER: - rmd = qq_room_data_find(gc, room_id); - if (rmd == NULL) { - purple_debug_warning("QQ", - "Missing room id in [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - } else { - purple_debug_warning("QQ", - "Not a member of room \"%s\"\n", rmd->title_utf8); - rmd->my_role = QQ_ROOM_ROLE_NO; - } - break; - case QQ_ROOM_CMD_REPLY_SEARCH_ERROR: - if (qd->roomlist != NULL) { - if (purple_roomlist_get_in_progress(qd->roomlist)) - purple_roomlist_set_in_progress(qd->roomlist, FALSE); - } - default: - process_room_cmd_notify(gc, reply_cmd, room_id, reply, data + bytes, data_len - bytes); - } - return; - } - - /* seems ok so far, so we process the reply according to sub_cmd */ - switch (reply_cmd) { - case QQ_ROOM_CMD_GET_INFO: - qq_process_room_cmd_get_info(data + bytes, data_len - bytes, ship32, gc); - break; - case QQ_ROOM_CMD_CREATE: - qq_group_process_create_group_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_CHANGE_INFO: - qq_group_process_modify_info_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_MEMBER_OPT: - qq_group_process_modify_members_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_ACTIVATE: - qq_group_process_activate_group_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_SEARCH: - qq_process_room_search(gc, data + bytes, data_len - bytes, ship32); - break; - case QQ_ROOM_CMD_JOIN: - qq_process_group_cmd_join_group(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_AUTH: - qq_process_group_cmd_join_group_auth(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_QUIT: - qq_process_group_cmd_exit_group(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_SEND_IM: - qq_process_room_send_im(gc, data + bytes, data_len - bytes); - break; - case QQ_ROOM_CMD_SEND_IM_EX: - qq_process_room_send_im_ex(gc, data + bytes, data_len - bytes); - break; - case QQ_ROOM_CMD_GET_ONLINES: - qq_process_room_cmd_get_onlines(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_GET_BUDDIES: - qq_process_room_cmd_get_buddies(data + bytes, data_len - bytes, gc); - break; - default: - purple_debug_warning("QQ", "Unknow room cmd 0x%02X %s\n", - reply_cmd, qq_get_room_cmd_desc(reply_cmd)); - } - - if (update_class == QQ_CMD_CLASS_NONE) - return; - - if (update_class == QQ_CMD_CLASS_UPDATE_ALL) { - qq_update_all_rooms(gc, room_cmd, room_id); - return; - } - if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) { - update_all_rooms_online(gc, room_cmd, room_id); - return; - } - if (update_class == QQ_CMD_CLASS_UPDATE_ROOM) { - qq_update_room(gc, room_cmd, room_id); - } -} - -guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *data = NULL; - gint data_len = 0; - guint ret_8 = QQ_LOGIN_REPLY_ERR; - - g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - g_return_val_if_fail(rcved_len > 0, QQ_LOGIN_REPLY_ERR); - data = g_newa(guint8, rcved_len); - - switch (cmd) { - case QQ_CMD_TOKEN: - if (qq_process_token(gc, rcved, rcved_len) == QQ_LOGIN_REPLY_OK) { - if (qd->client_version >= 2007) { - qq_request_token_ex(gc); - } else { - qq_request_login(gc); - } - return QQ_LOGIN_REPLY_OK; - } - return QQ_LOGIN_REPLY_ERR; - case QQ_CMD_GET_SERVER: - case QQ_CMD_TOKEN_EX: - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); - break; - case QQ_CMD_CHECK_PWD: - /* May use password_twice_md5 in the past version like QQ2005 */ - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by random_key, %d bytes\n", data_len); - } else { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5, %d bytes\n", data_len); - } - } - break; - case QQ_CMD_LOGIN: - default: - if (qd->client_version >= 2007) { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); - } else { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.login_key); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by login_key\n"); - } - } - } else { - /* May use password_twice_md5 in the past version like QQ2005 */ - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by random_key\n"); - } else { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); - } - } - } - break; - } - - if (data_len < 0) { - purple_debug_warning("QQ", - "Can not decrypt login cmd, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt login reply")); - return QQ_LOGIN_REPLY_ERR; - } - - switch (cmd) { - case QQ_CMD_GET_SERVER: - ret_8 = qq_process_get_server(gc, data, data_len); - if ( ret_8 == QQ_LOGIN_REPLY_OK) { - qq_request_token(gc); - } else if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { - return QQ_LOGIN_REPLY_REDIRECT; - } - break; - case QQ_CMD_TOKEN_EX: - ret_8 = qq_process_token_ex(gc, data, data_len); - if (ret_8 == QQ_LOGIN_REPLY_OK) { - qq_request_check_pwd(gc); - } else if (ret_8 == QQ_LOGIN_REPLY_NEXT_TOKEN_EX) { - qq_request_token_ex_next(gc); - } else if (ret_8 == QQ_LOGIN_REPLY_CAPTCHA_DLG) { - qq_captcha_input_dialog(gc, &(qd->captcha)); - g_free(qd->captcha.token); - g_free(qd->captcha.data); - memset(&qd->captcha, 0, sizeof(qd->captcha)); - } - break; - case QQ_CMD_CHECK_PWD: - ret_8 = qq_process_check_pwd(gc, data, data_len); - if (ret_8 != QQ_LOGIN_REPLY_OK) { - return ret_8; - } - if (qd->client_version >= 2008) { - qq_request_login_2008(gc); - } else { - qq_request_login_2007(gc); - } - break; - case QQ_CMD_LOGIN: - if (qd->client_version >= 2008) { - ret_8 = qq_process_login_2008(gc, data, data_len); - if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { - qq_request_get_server(gc); - return QQ_LOGIN_REPLY_OK; - } - } else if (qd->client_version >= 2007) { - ret_8 = qq_process_login_2007(gc, data, data_len); - if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { - qq_request_get_server(gc); - return QQ_LOGIN_REPLY_OK; - } - } else { - ret_8 = qq_process_login(gc, data, data_len); - } - if (ret_8 != QQ_LOGIN_REPLY_OK) { - return ret_8; - } - - purple_connection_update_progress(gc, _("Logging in"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS); - purple_debug_info("QQ", "Login replies OK; everything is fine\n"); - purple_connection_set_state(gc, PURPLE_CONNECTED); - qd->is_login = TRUE; /* must be defined after sev_finish_login */ - - /* now initiate QQ Qun, do it first as it may take longer to finish */ - qq_room_data_initial(gc); - - /* is_login, but we have packets before login */ - qq_trans_process_remained(gc); - - qq_update_all(gc, 0); - break; - default: - process_unknow_cmd(gc, _("Unknown LOGIN CMD"), data, data_len, cmd, seq); - return QQ_LOGIN_REPLY_ERR; - } - return QQ_LOGIN_REPLY_OK; -} - -void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - - guint8 *data; - gint data_len; - - guint8 ret_8 = 0; - guint16 ret_16 = 0; - guint32 ret_32 = 0; - gboolean is_unknow = FALSE; - - g_return_if_fail(rcved_len > 0); - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - data = g_newa(guint8, rcved_len); - data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); - if (data_len < 0) { - purple_debug_warning("QQ", - "Reply can not be decrypted by session key, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - return; - } - - if (data_len <= 0) { - purple_debug_warning("QQ", - "Reply decrypted is empty, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - return; - } - - switch (cmd) { - case QQ_CMD_UPDATE_INFO: - qq_process_change_info(gc, data, data_len); - break; - case QQ_CMD_ADD_BUDDY_NO_AUTH: - qq_process_add_buddy_no_auth(gc, data, data_len, ship32); - break; - case QQ_CMD_REMOVE_BUDDY: - qq_process_remove_buddy(gc, data, data_len, ship32); - break; - case QQ_CMD_REMOVE_ME: - qq_process_buddy_remove_me(gc, data, data_len, ship32); - break; - case QQ_CMD_ADD_BUDDY_AUTH: - qq_process_add_buddy_auth(data, data_len, gc); - break; - case QQ_CMD_GET_BUDDY_INFO: - qq_process_get_buddy_info(data, data_len, ship32, gc); - break; - case QQ_CMD_CHANGE_STATUS: - qq_process_change_status(data, data_len, gc); - break; - case QQ_CMD_SEND_IM: - do_im_ack(data, data_len, gc); - break; - case QQ_CMD_KEEP_ALIVE: - if (qd->client_version >= 2008) { - qq_process_keep_alive_2008(data, data_len, gc); - } else if (qd->client_version >= 2007) { - qq_process_keep_alive_2007(data, data_len, gc); - } else { - qq_process_keep_alive(data, data_len, gc); - } - break; - case QQ_CMD_GET_BUDDIES_ONLINE: - ret_8 = qq_process_get_buddies_online(data, data_len, gc); - if (ret_8 > 0 && ret_8 < 0xff) { - purple_debug_info("QQ", "Requesting for more online buddies\n"); - qq_request_get_buddies_online(gc, ret_8, update_class); - return; - } - purple_debug_info("QQ", "All online buddies received\n"); - qq_update_buddyies_status(gc); - break; - case QQ_CMD_GET_LEVEL: - qq_process_get_level_reply(data, data_len, gc); - break; - case QQ_CMD_GET_BUDDIES_LIST: - ret_16 = qq_process_get_buddies(data, data_len, gc); - if (ret_16 > 0 && ret_16 < 0xffff) { - purple_debug_info("QQ", "Requesting for more buddies\n"); - qq_request_get_buddies(gc, ret_16, update_class); - return; - } - purple_debug_info("QQ", "All buddies received. Requesting buddies' levels\n"); - break; - case QQ_CMD_GET_BUDDIES_AND_ROOMS: - ret_32 = qq_process_get_buddies_and_rooms(data, data_len, gc); - if (ret_32 > 0 && ret_32 < 0xffffffff) { - purple_debug_info("QQ", "Requesting for more buddies and groups\n"); - qq_request_get_buddies_and_rooms(gc, ret_32, update_class); - return; - } - purple_debug_info("QQ", "All buddies and groups received\n"); - break; - case QQ_CMD_AUTH_CODE: - qq_process_auth_code(gc, data, data_len, ship32); - break; - case QQ_CMD_BUDDY_QUESTION: - qq_process_question(gc, data, data_len, ship32); - break; - case QQ_CMD_ADD_BUDDY_NO_AUTH_EX: - qq_process_add_buddy_no_auth_ex(gc, data, data_len, ship32); - break; - case QQ_CMD_ADD_BUDDY_AUTH_EX: - qq_process_add_buddy_auth_ex(gc, data, data_len, ship32); - break; - case QQ_CMD_BUDDY_CHECK_CODE: - qq_process_buddy_check_code(gc, data, data_len); - break; - case QQ_CMD_BUDDY_MEMO: - purple_debug_info("QQ", "Receive memo from server!\n"); - qq_process_get_buddy_memo(gc, data, data_len, update_class, ship32); - return; - purple_debug_info("QQ", "Should NOT be here...\n"); - break; - default: - process_unknow_cmd(gc, _("Unknown CLIENT CMD"), data, data_len, cmd, seq); - is_unknow = TRUE; - break; - } - if (is_unknow) - return; - - if (update_class == QQ_CMD_CLASS_NONE) - return; - - purple_debug_info("QQ", "Update class %d\n", update_class); - if (update_class == QQ_CMD_CLASS_UPDATE_ALL) { - qq_update_all(gc, cmd); - return; - } - if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) { - qq_update_online(gc, cmd); - return; - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_process.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/** - * @file qq_process.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_PROCESS_H -#define _QQ_PROCESS_H - -#include -#include "connection.h" - -#include "qq.h" - -enum { - QQ_CMD_CLASS_NONE = 0, - QQ_CMD_CLASS_UPDATE_ALL, - QQ_CMD_CLASS_UPDATE_ONLINE, - QQ_CMD_CLASS_UPDATE_BUDDY, - QQ_CMD_CLASS_UPDATE_ROOM -}; - -guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32); -void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32); -void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq, - guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len, - guint32 update_class, guint32 ship32); - -void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len); - -void qq_update_all(PurpleConnection *gc, guint16 cmd); -void qq_update_online(PurpleConnection *gc, guint16 cmd); -void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id); -void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id); -#endif - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,415 +0,0 @@ -/** - * @file qq_trans.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "request.h" - -#include "qq_define.h" -#include "qq_network.h" -#include "qq_process.h" -#include "qq_trans.h" - -enum { - QQ_TRANS_IS_SERVER = 0x01, /* Is server command or client command */ - QQ_TRANS_IS_IMPORT = 0x02, /* Only notice if not get reply; or resend, disconn if reties get 0*/ - QQ_TRANS_REMAINED = 0x04, /* server command before login*/ - QQ_TRANS_IS_REPLY = 0x08 /* server command before login*/ -}; - -struct _qq_transaction { - guint8 flag; - guint16 seq; - guint16 cmd; - - guint8 room_cmd; - guint32 room_id; - - guint8 *data; - gint data_len; - - gint fd; - gint send_retries; - gint rcved_times; - gint scan_times; - - guint32 update_class; - guint32 ship32; -}; - -gboolean qq_trans_is_server(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, FALSE); - - if (trans->flag & QQ_TRANS_IS_SERVER) - return TRUE; - else - return FALSE; -} - -gboolean qq_trans_is_dup(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, TRUE); - - if (trans->rcved_times > 1) - return TRUE; - else - return FALSE; -} - -guint8 qq_trans_get_room_cmd(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, 0); - return trans->room_cmd; -} - -guint32 qq_trans_get_room_id(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, 0); - return trans->room_id; -} - -guint32 qq_trans_get_class(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, QQ_CMD_CLASS_NONE); - return trans->update_class; -} - -guint32 qq_trans_get_ship(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, 0); - return trans->ship32; -} - -static qq_transaction *trans_create(PurpleConnection *gc, gint fd, - guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - qq_transaction *trans; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, NULL); - qd = (qq_data *) gc->proto_data; - - trans = g_new0(qq_transaction, 1); - - memset(trans, 0, sizeof(qq_transaction)); - trans->fd = fd; - trans->cmd = cmd; - trans->seq = seq; - - trans->data = NULL; - trans->data_len = 0; - if (data != NULL && data_len > 0) { - /* don't use g_strdup, may have 0x00 */ - trans->data = g_memdup(data, data_len); - trans->data_len = data_len; - } - - trans->update_class = update_class; - trans->ship32 = ship32; - return trans; -} - -/* Remove a packet with seq from send trans */ -static void trans_remove(PurpleConnection *gc, qq_transaction *trans) -{ - qq_data *qd = (qq_data *)gc->proto_data; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(trans != NULL); -#if 0 - purple_debug_info("QQ_TRANS", - "Remove [%s%05d] retry %d rcved %d scan %d %s\n", - (trans->flag & QQ_TRANS_IS_SERVER) ? "SRV-" : "", - trans->seq, - trans->send_retries, trans->rcved_times, trans->scan_times, - qq_get_cmd_desc(trans->cmd)); -#endif - if (trans->data) g_free(trans->data); - qd->transactions = g_list_remove(qd->transactions, trans); - g_free(trans); -} - -static qq_transaction *trans_find(PurpleConnection *gc, guint16 cmd, guint16 seq) -{ - qq_data *qd; - GList *list; - qq_transaction *trans; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, NULL); - qd = (qq_data *) gc->proto_data; - - list = qd->transactions; - while (list != NULL) { - trans = (qq_transaction *) list->data; - if(trans->cmd == cmd && trans->seq == seq) { - return trans; - } - list = list->next; - } - - return NULL; -} - -void qq_trans_add_client_cmd(PurpleConnection *gc, - guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, update_class, ship32); - - if (cmd == QQ_CMD_TOKEN || cmd == QQ_CMD_LOGIN || cmd == QQ_CMD_KEEP_ALIVE) { - trans->flag |= QQ_TRANS_IS_IMPORT; - } - trans->send_retries = qd->resend_times; -#if 0 - purple_debug_info("QQ_TRANS", "Add client cmd, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -qq_transaction *qq_trans_find_rcved(PurpleConnection *gc, guint16 cmd, guint16 seq) -{ - qq_transaction *trans; - - trans = trans_find(gc, cmd, seq); - if (trans == NULL) { - return NULL; - } - - if (trans->rcved_times == 0) { - trans->scan_times = 0; - } - trans->rcved_times++; - /* server may not get our confirm reply before, send reply again*/ - if (qq_trans_is_server(trans) && (trans->flag & QQ_TRANS_IS_REPLY)) { - if (trans->data != NULL && trans->data_len > 0) { - qq_send_cmd_encrypted(gc, trans->cmd, trans->seq, trans->data, trans->data_len, FALSE); - } - } - return trans; -} - -void qq_trans_add_room_cmd(PurpleConnection *gc, - guint16 seq, guint8 room_cmd, guint32 room_id, guint8 *data, gint data_len, - guint32 update_class, guint32 ship32) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, QQ_CMD_ROOM, seq, data, data_len, - update_class, ship32); - - trans->room_cmd = room_cmd; - trans->room_id = room_id; - trans->send_retries = qd->resend_times; -#if 0 - purple_debug_info("QQ_TRANS", "Add room cmd, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, rcved, rcved_len, QQ_CMD_CLASS_NONE, 0); - - trans->flag = QQ_TRANS_IS_SERVER; - trans->send_retries = 0; - trans->rcved_times = 1; -#if 0 - purple_debug_info("QQ_TRANS", "Add server cmd, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -void qq_trans_add_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *reply, gint reply_len) -{ - qq_transaction *trans; - - g_return_if_fail(reply != NULL && reply_len > 0); - - trans = trans_find(gc, cmd, seq); - if (trans == NULL) { - return; - } - - g_return_if_fail(trans->flag & QQ_TRANS_IS_SERVER); - trans->flag |= QQ_TRANS_IS_REPLY; - - if (trans->data) g_free(trans->data); - - trans->data = g_memdup(reply, reply_len); - trans->data_len = reply_len; -} - -void qq_trans_add_remain(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, QQ_CMD_CLASS_NONE, 0); - - trans->flag = QQ_TRANS_IS_SERVER; - trans->flag |= QQ_TRANS_REMAINED; - trans->send_retries = 0; - trans->rcved_times = 1; -#if 1 - purple_debug_info("QQ_TRANS", "Add server cmd and remained, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -void qq_trans_process_remained(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *)gc->proto_data; - GList *curr; - GList *next; - qq_transaction *trans; - - g_return_if_fail(qd != NULL); - - next = qd->transactions; - while( (curr = next) ) { - next = curr->next; - trans = (qq_transaction *) (curr->data); -#if 0 - purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); -#endif - if ( !(trans->flag & QQ_TRANS_IS_SERVER) ) { - continue; - } - if ( !(trans->flag & QQ_TRANS_REMAINED) ) { - continue; - } - /* set QQ_TRANS_REMAINED off */ - trans->flag &= ~QQ_TRANS_REMAINED; - -#if 1 - purple_debug_info("QQ_TRANS", - "Process server cmd remained, seq %d, data %p, len %d, send_retries %d\n", - trans->seq, trans->data, trans->data_len, trans->send_retries); -#endif - qq_proc_server_cmd(gc, trans->cmd, trans->seq, trans->data, trans->data_len); - } - - /* purple_debug_info("QQ_TRANS", "Scan finished\n"); */ - return; -} - -gboolean qq_trans_scan(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *)gc->proto_data; - GList *curr; - GList *next; - qq_transaction *trans; - - g_return_val_if_fail(qd != NULL, FALSE); - - next = qd->transactions; - while( (curr = next) ) { - next = curr->next; - trans = (qq_transaction *) (curr->data); - /* purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); */ - - if (trans->flag & QQ_TRANS_REMAINED) { - /* keep server cmd before login*/ - continue; - } - - trans->scan_times++; - if (trans->scan_times <= 1) { - /* skip in 10 seconds */ - continue; - } - - if (trans->rcved_times > 0) { - /* Has been received */ - trans_remove(gc, trans); - continue; - } - - if (trans->flag & QQ_TRANS_IS_SERVER) { - continue; - } - - /* Never get reply */ - trans->send_retries--; - if (trans->send_retries <= 0) { - purple_debug_warning("QQ_TRANS", - "[%d] %s is lost.\n", - trans->seq, qq_get_cmd_desc(trans->cmd)); - if (trans->flag & QQ_TRANS_IS_IMPORT) { - return TRUE; - } - - qd->net_stat.lost++; - purple_debug_error("QQ_TRANS", - "Lost [%d] %s, data %p, len %d, retries %d\n", - trans->seq, qq_get_cmd_desc(trans->cmd), - trans->data, trans->data_len, trans->send_retries); - trans_remove(gc, trans); - continue; - } - - qd->net_stat.resend++; - purple_debug_warning("QQ_TRANS", - "Resend [%d] %s data %p, len %d, send_retries %d\n", - trans->seq, qq_get_cmd_desc(trans->cmd), - trans->data, trans->data_len, trans->send_retries); - qq_send_cmd_encrypted(gc, trans->cmd, trans->seq, trans->data, trans->data_len, FALSE); - } - - /* purple_debug_info("QQ_TRANS", "Scan finished\n"); */ - return FALSE; -} - -/* clean up send trans and free all contents */ -void qq_trans_remove_all(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans; - gint count = 0; - - while(qd->transactions != NULL) { - trans = (qq_transaction *) (qd->transactions->data); - qd->transactions = g_list_remove(qd->transactions, trans); - - if (trans->data) g_free(trans->data); - g_free(trans); - - count++; - } - if (count > 0) { - purple_debug_info("QQ_TRANS", "Free all %d packets\n", count); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/qq_trans.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file qq_trans.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_SEND_QUEUE_H_ -#define _QQ_SEND_QUEUE_H_ - -#include -#include "qq.h" - -typedef struct _qq_transaction qq_transaction; - -qq_transaction *qq_trans_find_rcved(PurpleConnection *gc, guint16 cmd, guint16 seq); -gboolean qq_trans_is_server(qq_transaction *trans) ; -gboolean qq_trans_is_dup(qq_transaction *trans); -guint8 qq_trans_get_room_cmd(qq_transaction *trans); -guint32 qq_trans_get_room_id(qq_transaction *trans); -guint32 qq_trans_get_class(qq_transaction *trans); -guint32 qq_trans_get_ship(qq_transaction *trans); - -void qq_trans_add_client_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32); -void qq_trans_add_room_cmd(PurpleConnection *gc, - guint16 seq, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32); -void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len); -void qq_trans_add_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *reply, gint reply_len); -void qq_trans_add_remain(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len); - -void qq_trans_process_remained(PurpleConnection *gc); -gboolean qq_trans_scan(PurpleConnection *gc); -void qq_trans_remove_all(PurpleConnection *gc); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,944 +0,0 @@ -/** - * @file send_file.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "qq.h" - -#include "send_file.h" -#include "debug.h" -#include "network.h" -#include "notify.h" - -#include "buddy_list.h" -#include "file_trans.h" -#include "qq_define.h" -#include "im.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "utils.h" - -enum -{ - QQ_FILE_TRANS_REQ = 0x0035, - QQ_FILE_TRANS_ACC_UDP = 0x0037, - QQ_FILE_TRANS_ACC_TCP = 0x0003, - QQ_FILE_TRANS_DENY_UDP = 0x0039, - QQ_FILE_TRANS_DENY_TCP = 0x0005, - QQ_FILE_TRANS_NOTIFY = 0x003b, - QQ_FILE_TRANS_NOTIFY_ACK = 0x003c, - QQ_FILE_TRANS_CANCEL = 0x0049, - QQ_FILE_TRANS_PASV = 0x003f -}; - -static int _qq_in_same_lan(ft_info *info) -{ - if (info->remote_internet_ip == info->local_internet_ip) return 1; - purple_debug_info("QQ", - "Not in the same LAN, remote internet ip[%x], local internet ip[%x]\n", - info->remote_internet_ip - , info->local_internet_ip); - return 0; -} - -static int _qq_xfer_init_udp_channel(ft_info *info) -{ - struct sockaddr_in sin; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - if (!_qq_in_same_lan(info)) { - sin.sin_port = g_htons(info->remote_major_port); - sin.sin_addr.s_addr = g_htonl(info->remote_internet_ip); - } else { - sin.sin_port = g_htons(info->remote_minor_port); - sin.sin_addr.s_addr = g_htonl(info->remote_real_ip); - } - return 0; -} - -/* these 2 functions send and recv buffer from/to UDP channel */ -static ssize_t _qq_xfer_udp_recv(guint8 *buf, size_t len, PurpleXfer *xfer) -{ - struct sockaddr_in sin; - socklen_t sinlen; - ft_info *info; - gint r; - - info = (ft_info *) xfer->data; - sinlen = sizeof(sin); - r = recvfrom(info->recv_fd, buf, len, 0, (struct sockaddr *) &sin, &sinlen); - purple_debug_info("QQ", - "==> recv %d bytes from File UDP Channel, remote ip[%s], remote port[%d]\n", - r, inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port)); - return r; -} - -/* -static ssize_t _qq_xfer_udp_send(const char *buf, size_t len, PurpleXfer *xfer) -{ - ft_info *info; - - info = (ft_info *) xfer->data; - return send(info->sender_fd, buf, len, 0); -} -*/ - -static ssize_t _qq_xfer_udp_send(const guint8 *buf, size_t len, PurpleXfer *xfer) -{ - struct sockaddr_in sin; - ft_info *info; - - info = (ft_info *) xfer->data; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - if (!_qq_in_same_lan(info)) { - sin.sin_port = g_htons(info->remote_major_port); - sin.sin_addr.s_addr = g_htonl(info->remote_internet_ip); - } else if (info->use_major) { - sin.sin_port = g_htons(info->remote_major_port); - sin.sin_addr.s_addr = g_htonl(info->remote_real_ip); - } else { - sin.sin_port = g_htons(info->remote_minor_port); - sin.sin_addr.s_addr = g_htonl(info->remote_real_ip); - } - purple_debug_info("QQ", "sending to channel: %s:%d\n", - inet_ntoa(sin.sin_addr), - (int)g_ntohs(sin.sin_port) - ); - return sendto(info->sender_fd, buf, len, 0, (struct sockaddr *) &sin, sizeof(sin)); -} - -/* user-defined functions for purple_xfer_read and purple_xfer_write */ - -/* -static ssize_t _qq_xfer_read(char **buf, PurpleXfer *xfer) -{ - *buf = g_newa(char, QQ_FILE_FRAGMENT_MAXLEN + 100); - return _qq_xfer_udp_recv(*buf, QQ_FILE_FRAGMENT_MAXLEN + 100, xfer); -} -*/ - -gssize _qq_xfer_write(const guint8 *buf, size_t len, PurpleXfer *xfer) -{ - return _qq_xfer_udp_send(buf, len, xfer); -} - -static void _qq_xfer_recv_packet(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - PurpleAccount *account = purple_xfer_get_account(xfer); - PurpleConnection *gc = purple_account_get_connection(account); - guint8 *buf; - gint size; - /* FIXME: It seems that the transfer never use a packet - * larger than 1500 bytes, so if it happened to be a - * larger packet, either error occurred or protocol should - * be modified - */ - ft_info *info; - info = xfer->data; - g_return_if_fail (source == info->recv_fd); - buf = g_newa(guint8, 1500); - size = _qq_xfer_udp_recv(buf, 1500, xfer); - qq_process_recv_file(gc, buf, size); -} - -/* start file transfer process */ -/* -static void _qq_xfer_send_start (PurpleXfer *xfer) -{ - PurpleAccount *account; - PurpleConnection *gc; - ft_info *info; - - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - info = (ft_info *) xfer->data; -} -*/ - -/* -static void _qq_xfer_send_ack (PurpleXfer *xfer, const char *buffer, size_t len) -{ - PurpleAccount *account; - PurpleConnection *gc; - - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - qq_process_recv_file(gc, (guint8 *) buffer, len); -} -*/ - -/* -static void _qq_xfer_recv_start(PurpleXfer *xfer) -{ -} -*/ - -static void _qq_xfer_end(PurpleXfer *xfer) -{ - ft_info *info; - g_return_if_fail(xfer != NULL && xfer->data != NULL); - info = (ft_info *) xfer->data; - - qq_xfer_close_file(xfer); - if (info->dest_fp != NULL) { - fclose(info->dest_fp); - purple_debug_info("QQ", "file closed\n"); - } - if (info->major_fd != 0) { - close(info->major_fd); - purple_debug_info("QQ", "major port closed\n"); - } - if (info->minor_fd != 0) { - close(info->minor_fd); - purple_debug_info("QQ", "minor port closed\n"); - } - /* - if (info->buffer != NULL) { - munmap(info->buffer, purple_xfer_get_size(xfer)); - purple_debug_info("QQ", "file mapping buffer is freed.\n"); - } - */ - g_free(info); -} - -static void qq_show_conn_info(ft_info *info) -{ - gchar *internet_ip_str, *real_ip_str; - guint32 ip; - - ip = g_htonl(info->remote_real_ip); - real_ip_str = gen_ip_str((guint8 *) &ip); - ip = g_htonl(info->remote_internet_ip); - internet_ip_str = gen_ip_str((guint8 *) &ip); - purple_debug_info("QQ", "remote internet ip[%s:%d], major port[%d], real ip[%s], minor port[%d]\n", - internet_ip_str, info->remote_internet_port, - info->remote_major_port, real_ip_str, info->remote_minor_port - ); - g_free(real_ip_str); - g_free(internet_ip_str); -} - -#define QQ_CONN_INFO_LEN 61 -gint qq_get_conn_info(ft_info *info, guint8 *data) -{ - gint bytes = 0; - /* 16 + 30 + 1 + 4 + 2 + 2 + 4 + 2 = 61 */ - bytes += qq_getdata(info->file_session_key, 16, data + bytes); - bytes += 30; /* skip 30 bytes */ - bytes += qq_get8(&info->conn_method, data + bytes); - bytes += qq_get32(&info->remote_internet_ip, data + bytes); - bytes += qq_get16(&info->remote_internet_port, data + bytes); - bytes += qq_get16(&info->remote_major_port, data + bytes); - bytes += qq_get32(&info->remote_real_ip, data + bytes); - bytes += qq_get16(&info->remote_minor_port, data + bytes); - qq_show_conn_info(info); - return bytes; -} - -gint qq_fill_conn_info(guint8 *raw_data, ft_info *info) -{ - gint bytes = 0; - /* 064: connection method, UDP 0x00, TCP 0x03 */ - bytes += qq_put8 (raw_data + bytes, info->conn_method); - /* 065-068: outer ip address of sender (proxy address) */ - bytes += qq_put32 (raw_data + bytes, info->local_internet_ip); - /* 069-070: sender port */ - bytes += qq_put16 (raw_data + bytes, info->local_internet_port); - /* 071-072: the first listening port(TCP doesn't have this part) */ - bytes += qq_put16 (raw_data + bytes, info->local_major_port); - /* 073-076: real ip */ - bytes += qq_put32 (raw_data + bytes, info->local_real_ip); - /* 077-078: the second listening port */ - bytes += qq_put16 (raw_data + bytes, info->local_minor_port); - return bytes; -} - - -/* fill in the common information of file transfer */ -static gint _qq_create_packet_file_header -(guint8 *raw_data, guint32 to_uid, guint16 message_type, qq_data *qd, gboolean seq_ack) -{ - gint bytes; - time_t now; - guint16 seq; - ft_info *info; - - bytes = 0; - now = time(NULL); - if (!seq_ack) seq = qd->send_seq; - else { - info = (ft_info *) qd->xfer->data; - seq = info->send_seq; - } - - /* 000-003: receiver uid */ - bytes += qq_put32 (raw_data + bytes, qd->uid); - /* 004-007: sender uid */ - bytes += qq_put32 (raw_data + bytes, to_uid); - /* 008-009: sender client version */ - bytes += qq_put16 (raw_data + bytes, qd->client_tag); - /* 010-013: receiver uid */ - bytes += qq_put32 (raw_data + bytes, qd->uid); - /* 014-017: sender uid */ - bytes += qq_put32 (raw_data + bytes, to_uid); - /* 018-033: md5 of (uid+session_key) */ - bytes += qq_putdata (raw_data + bytes, qd->session_md5, 16); - /* 034-035: message type */ - bytes += qq_put16 (raw_data + bytes, message_type); - /* 036-037: sequence number */ - bytes += qq_put16 (raw_data + bytes, seq); - /* 038-041: send time */ - bytes += qq_put32 (raw_data + bytes, (guint32) now); - /* 042-042: always 0x00 */ - bytes += qq_put8 (raw_data + bytes, 0x00); - /* 043-043: sender icon */ - bytes += qq_put8 (raw_data + bytes, qd->my_icon); - /* 044-046: always 0x00 */ - bytes += qq_put16 (raw_data + bytes, 0x0000); - bytes += qq_put8 (raw_data + bytes, 0x00); - /* 047-047: we use font attr */ - bytes += qq_put8 (raw_data + bytes, 0x01); - /* 048-051: always 0x00 */ - bytes += qq_put32 (raw_data + bytes, 0x00000000); - - /* 052-062: always 0x00 */ - bytes += qq_put32 (raw_data + bytes, 0x00000000); - bytes += qq_put32 (raw_data + bytes, 0x00000000); - bytes += qq_put16 (raw_data + bytes, 0x0000); - bytes += qq_put8 (raw_data + bytes, 0x00); - /* 063: transfer_type, 0x65: FILE 0x6b: FACE */ - bytes += qq_put8 (raw_data + bytes, QQ_FILE_TRANSFER_FILE); /* FIXME */ - - return bytes; -} - -#if 0 -in_addr_t get_real_ip() -{ - char hostname[40]; - struct hostent *host; - - gethostname(hostname, sizeof(hostname)); - host = gethostbyname(hostname); - return *(host->h_addr); -} - - -#include -#include - -#define MAXINTERFACES 16 -in_addr_t get_real_ip() -{ - int fd, intrface, i; - struct ifconf ifc; - struct ifreq buf[MAXINTERFACES]; - in_addr_t ret; - - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 0; - ifc.ifc_len = sizeof(buf); - ifc.ifc_buf = (caddr_t) buf; - if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0) return 0; - intrface = ifc.ifc_len / sizeof(struct ifreq); - for (i = 0; i < intrface; i++) { - /* buf[intrface].ifr_name */ - if (ioctl(fd, SIOCGIFADDR, (char *) &buf[i]) >= 0) - { - ret = (((struct sockaddr_in *)(&buf[i].ifr_addr))->sin_addr).s_addr; - if (ret == g_ntohl(0x7f000001)) continue; - return ret; - } - } - return 0; -} -#endif - -static void _qq_xfer_init_socket(PurpleXfer *xfer) -{ - gint sockfd, listen_port = 0, i; - socklen_t sin_len; - struct sockaddr_in sin; - ft_info *info; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - info = (ft_info *) xfer->data; - - /* debug - info->local_real_ip = 0x7f000001; - */ - info->local_real_ip = g_ntohl(inet_addr(purple_network_get_my_ip(-1))); - purple_debug_info("QQ", "local real ip is %x\n", info->local_real_ip); - - for (i = 0; i < 2; i++) { - sockfd = socket(PF_INET, SOCK_DGRAM, 0); - g_return_if_fail(sockfd >= 0); - - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - sin_len = sizeof(sin); - bind(sockfd, (struct sockaddr *) &sin, sin_len); - getsockname(sockfd, (struct sockaddr *) &sin, &sin_len); - listen_port = g_ntohs(sin.sin_port); - - switch (i) { - case 0: - info->local_major_port = listen_port; - info->major_fd = sockfd; - purple_debug_info("QQ", "UDP Major Channel created on port[%d]\n", - info->local_major_port); - break; - case 1: - info->local_minor_port = listen_port; - info->minor_fd = sockfd; - purple_debug_info("QQ", "UDP Minor Channel created on port[%d]\n", - info->local_minor_port); - break; - } - } - - if (_qq_in_same_lan(info)) { - info->sender_fd = info->recv_fd = info->minor_fd; - } else { - info->sender_fd = info->recv_fd = info->major_fd; - } -/* xfer->watcher = purple_input_add(info->recv_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); */ -} - -/* create the QQ_FILE_TRANS_REQ packet with file infomations */ -static void _qq_send_packet_file_request (PurpleConnection *gc, guint32 to_uid, gchar *filename, gint filesize) -{ - qq_data *qd; - guint8 *raw_data; - gchar *filelen_str; - gint filename_len, filelen_strlen, packet_len, bytes; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - - info = g_new0(ft_info, 1); - info->to_uid = to_uid; - info->send_seq = qd->send_seq; - info->local_internet_ip = qd->my_ip.s_addr; - info->local_internet_port = qd->my_port; - info->local_real_ip = 0x00000000; - info->conn_method = 0x00; - qd->xfer->data = info; - - filename_len = strlen(filename); - filelen_str = g_strdup_printf("%d ?ֽ?", filesize); - filelen_strlen = strlen(filelen_str); - - packet_len = 82 + filename_len + filelen_strlen; - raw_data = g_newa(guint8, packet_len); - bytes = 0; - - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, - QQ_FILE_TRANS_REQ, qd, FALSE); - bytes += qq_fill_conn_info(raw_data + bytes, info); - /* 079: 0x20 */ - bytes += qq_put8 (raw_data + bytes, 0x20); - /* 080: 0x1f */ - bytes += qq_put8 (raw_data + bytes, 0x1f); - /* undetermined len: filename */ - bytes += qq_putdata (raw_data + bytes, (guint8 *) filename, filename_len); - /* 0x1f */ - bytes += qq_put8 (raw_data + bytes, 0x1f); - /* file length */ - bytes += qq_putdata (raw_data + bytes, (guint8 *) filelen_str, filelen_strlen); - - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file_request", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); - - g_free (filelen_str); -} - -/* tell the buddy we want to accept the file */ -static void _qq_send_packet_file_accept(PurpleConnection *gc, guint32 to_uid) -{ - qq_data *qd; - guint8 *raw_data; - guint16 minor_port; - guint32 real_ip; - gint packet_len, bytes; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - info = (ft_info *) qd->xfer->data; - - purple_debug_info("QQ", "I've accepted the file transfer request from %d\n", to_uid); - _qq_xfer_init_socket(qd->xfer); - - packet_len = 79; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - minor_port = info->local_minor_port; - real_ip = info->local_real_ip; - info->local_minor_port = 0; - info->local_real_ip = 0; - - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_ACC_UDP, qd, TRUE); - bytes += qq_fill_conn_info(raw_data + bytes, info); - - info->local_minor_port = minor_port; - info->local_real_ip = real_ip; - - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file_accept", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); -} - -static void _qq_send_packet_file_notifyip(PurpleConnection *gc, guint32 to_uid) -{ - PurpleXfer *xfer; - ft_info *info; - qq_data *qd; - guint8 *raw_data; - gint packet_len, bytes; - - qd = (qq_data *) gc->proto_data; - xfer = qd->xfer; - info = xfer->data; - - packet_len = 79; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - purple_debug_info("QQ", "<== sending qq file notify ip packet\n"); - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_NOTIFY, qd, TRUE); - bytes += qq_fill_conn_info(raw_data + bytes, info); - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file_notify", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); - - if (xfer->watcher) purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(info->recv_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); - purple_input_add(info->major_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); -} - -/* tell the buddy we don't want the file */ -static void _qq_send_packet_file_reject (PurpleConnection *gc, guint32 to_uid) -{ - qq_data *qd; - guint8 *raw_data; - gint packet_len, bytes; - - purple_debug_info("_qq_send_packet_file_reject", "start\n"); - qd = (qq_data *) gc->proto_data; - - packet_len = 64; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_DENY_UDP, qd, TRUE); - - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); -} - -/* tell the buddy to cancel transfer */ -static void _qq_send_packet_file_cancel (PurpleConnection *gc, guint32 to_uid) -{ - qq_data *qd; - guint8 *raw_data; - gint packet_len, bytes; - - purple_debug_info("_qq_send_packet_file_cancel", "start\n"); - qd = (qq_data *) gc->proto_data; - - packet_len = 64; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - purple_debug_info("_qq_send_packet_file_cancel", "before create header\n"); - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_CANCEL, qd, TRUE); - purple_debug_info("_qq_send_packet_file_cancel", "end create header\n"); - - if (packet_len == bytes) { - purple_debug_info("_qq_send_packet_file_cancel", "before send cmd\n"); - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - } - else - purple_debug_info("qq_send_packet_file", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); - - purple_debug_info("qq_send_packet_file_cancel", "end\n"); -} - -/* request to send a file */ -static void -_qq_xfer_init (PurpleXfer * xfer) -{ - PurpleConnection *gc; - PurpleAccount *account; - guint32 to_uid; - const gchar *filename; - gchar *base_filename; - - g_return_if_fail (xfer != NULL); - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - - to_uid = purple_name_to_uid (xfer->who); - g_return_if_fail (to_uid != 0); - - filename = purple_xfer_get_local_filename (xfer); - g_return_if_fail (filename != NULL); - - base_filename = g_path_get_basename(filename); - - _qq_send_packet_file_request (gc, to_uid, base_filename, - purple_xfer_get_size(xfer)); - g_free(base_filename); -} - -/* cancel the transfer of receiving files */ -static void _qq_xfer_cancel(PurpleXfer *xfer) -{ - PurpleConnection *gc; - PurpleAccount *account; - guint16 *seq; - - g_return_if_fail (xfer != NULL); - seq = (guint16 *) xfer->data; - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - - switch (purple_xfer_get_status(xfer)) { - case PURPLE_XFER_STATUS_CANCEL_LOCAL: - _qq_send_packet_file_cancel(gc, purple_name_to_uid(xfer->who)); - break; - case PURPLE_XFER_STATUS_CANCEL_REMOTE: - _qq_send_packet_file_cancel(gc, purple_name_to_uid(xfer->who)); - break; - case PURPLE_XFER_STATUS_NOT_STARTED: - break; - case PURPLE_XFER_STATUS_UNKNOWN: - _qq_send_packet_file_reject(gc, purple_name_to_uid(xfer->who)); - break; - case PURPLE_XFER_STATUS_DONE: - break; - case PURPLE_XFER_STATUS_ACCEPTED: - break; - case PURPLE_XFER_STATUS_STARTED: - break; - } -} - -/* init the transfer of receiving files */ -static void _qq_xfer_recv_init(PurpleXfer *xfer) -{ - PurpleConnection *gc; - PurpleAccount *account; - ft_info *info; - - g_return_if_fail (xfer != NULL && xfer->data != NULL); - info = (ft_info *) xfer->data; - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - - _qq_send_packet_file_accept(gc, purple_name_to_uid(xfer->who)); -} - -/* process reject im for file transfer request */ -void qq_process_recv_file_reject (guint8 *data, gint data_len, - guint32 sender_uid, PurpleConnection *gc) -{ - gchar *msg, *filename; - qq_data *qd; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - g_return_if_fail (qd->xfer != NULL); - - /* border has been checked before - if (*cursor >= (data + data_len - 1)) { - purple_debug_warning("QQ", - "Received file reject message is empty\n"); - return; - } - */ - filename = g_path_get_basename(purple_xfer_get_local_filename(qd->xfer)); - msg = g_strdup_printf(_("%d has declined the file %s"), - sender_uid, filename); - - purple_notify_warning (gc, _("File Send"), msg, NULL); - purple_xfer_request_denied(qd->xfer); - qd->xfer = NULL; - - g_free(filename); - g_free(msg); -} - -/* process cancel im for file transfer request */ -void qq_process_recv_file_cancel (guint8 *data, gint data_len, - guint32 sender_uid, PurpleConnection *gc) -{ - gchar *msg, *filename; - qq_data *qd; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - g_return_if_fail (qd->xfer != NULL - && purple_xfer_get_filename(qd->xfer) != NULL); - - /* border has been checked before - if (*cursor >= (data + data_len - 1)) { - purple_debug_warning("QQ", "Received file reject message is empty\n"); - return; - } - */ - filename = g_path_get_basename(purple_xfer_get_local_filename(qd->xfer)); - msg = g_strdup_printf - (_("%d cancelled the transfer of %s"), - sender_uid, filename); - - purple_notify_warning (gc, _("File Send"), msg, NULL); - purple_xfer_cancel_remote(qd->xfer); - qd->xfer = NULL; - - g_free(filename); - g_free(msg); -} - -/* process accept im for file transfer request */ -void qq_process_recv_file_accept(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - ft_info *info; - PurpleXfer *xfer; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - xfer = qd->xfer; - info = (ft_info *) qd->xfer->data; - - if (data_len <= 30 + QQ_CONN_INFO_LEN) { - purple_debug_warning("QQ", "Received file reject message is empty\n"); - return; - } - - bytes = 18 + 12; /* skip 30 bytes */ - qq_get_conn_info(info, data + bytes); - _qq_xfer_init_socket(qd->xfer); - - _qq_xfer_init_udp_channel(info); - _qq_send_packet_file_notifyip(gc, sender_uid); -} - -/* process request from buddy's im for file transfer request */ -void qq_process_recv_file_request(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection * gc) -{ - qq_data *qd; - PurpleXfer *xfer; - gchar *sender_name, **fileinfo; - ft_info *info; - PurpleBuddy *b; - qq_buddy_data *bd; - gint bytes; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - - info = g_newa(ft_info, 1); - info->local_internet_ip = qd->my_ip.s_addr; - info->local_internet_port = qd->my_port; - info->local_real_ip = 0x00000000; - info->to_uid = sender_uid; - - if (data_len <= 2 + 30 + QQ_CONN_INFO_LEN) { - purple_debug_warning("QQ", "Received file request message is empty\n"); - return; - } - bytes = 0; - bytes += qq_get16(&(info->send_seq), data + bytes); - - bytes += 18 + 12; /* skip 30 bytes */ - bytes += qq_get_conn_info(info, data + bytes); - - fileinfo = g_strsplit((gchar *) (data + 81 + 12), "\x1f", 2); - g_return_if_fail (fileinfo != NULL && fileinfo[0] != NULL && fileinfo[1] != NULL); - - sender_name = uid_to_purple_name(sender_uid); - - /* FACE from IP detector, ignored by gfhuang */ - if(g_ascii_strcasecmp(fileinfo[0], "FACE") == 0) { - purple_debug_warning("QQ", - "Received a FACE ip detect from %d, so he/she must be online :)\n", sender_uid); - - b = purple_find_buddy(gc->account, sender_name); - bd = (b == NULL) ? NULL : purple_buddy_get_protocol_data(b); - if (bd) { - if(0 != info->remote_real_ip) { - g_memmove(&(bd->ip), &info->remote_real_ip, sizeof(bd->ip)); - bd->port = info->remote_minor_port; - } - else if (0 != info->remote_internet_ip) { - g_memmove(&(bd->ip), &info->remote_internet_ip, sizeof(bd->ip)); - bd->port = info->remote_major_port; - } - - if(!is_online(bd->status)) { - bd->status = QQ_BUDDY_ONLINE_INVISIBLE; - bd->last_update = time(NULL); - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } - else - purple_debug_info("QQ", "buddy %d is already online\n", sender_uid); - - } - else - purple_debug_warning("QQ", "buddy %d is not in list\n", sender_uid); - - g_free(sender_name); - g_strfreev(fileinfo); - return; - } - - xfer = purple_xfer_new(purple_connection_get_account(gc), - PURPLE_XFER_RECEIVE, - sender_name); - if (xfer) - { - purple_xfer_set_filename(xfer, fileinfo[0]); - purple_xfer_set_size(xfer, atoi(fileinfo[1])); - - purple_xfer_set_init_fnc(xfer, _qq_xfer_recv_init); - purple_xfer_set_request_denied_fnc(xfer, _qq_xfer_cancel); - purple_xfer_set_cancel_recv_fnc(xfer, _qq_xfer_cancel); - purple_xfer_set_end_fnc(xfer, _qq_xfer_end); - purple_xfer_set_write_fnc(xfer, _qq_xfer_write); - - xfer->data = info; - qd->xfer = xfer; - - purple_xfer_request(xfer); - } - - g_free(sender_name); - g_strfreev(fileinfo); -} - -static void _qq_xfer_send_notify_ip_ack(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - PurpleAccount *account = purple_xfer_get_account(xfer); - PurpleConnection *gc = purple_account_get_connection(account); - ft_info *info = (ft_info *) xfer->data; - - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(info->recv_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_NOTIFY_IP_ACK, info->to_uid, 0); - /* - info->use_major = TRUE; - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_NOTIFY_IP_ACK, info->to_uid, 0); - info->use_major = FALSE; - */ -} - -void qq_process_recv_file_notify(guint8 *data, gint data_len, - guint32 sender_uid, PurpleConnection *gc) -{ - gint bytes; - qq_data *qd; - ft_info *info; - PurpleXfer *xfer; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - - xfer = qd->xfer; - info = (ft_info *) qd->xfer->data; - if (data_len <= 2 + 30 + QQ_CONN_INFO_LEN) { - purple_debug_warning("QQ", "Received file notify message is empty\n"); - return; - } - - bytes = 0; - bytes += qq_get16(&(info->send_seq), data + bytes); - - bytes += 18 + 12; - bytes += qq_get_conn_info(info, data + bytes); - - _qq_xfer_init_udp_channel(info); - - xfer->watcher = purple_input_add(info->sender_fd, PURPLE_INPUT_WRITE, _qq_xfer_send_notify_ip_ack, xfer); -} - -/* temp placeholder until a working function can be implemented */ -gboolean qq_can_receive_file(PurpleConnection *gc, const char *who) -{ - return TRUE; -} - -void qq_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - qq_data *qd; - PurpleXfer *xfer; - - qd = (qq_data *) gc->proto_data; - - xfer = purple_xfer_new (gc->account, PURPLE_XFER_SEND, - who); - if (xfer) - { - purple_xfer_set_init_fnc (xfer, _qq_xfer_init); - purple_xfer_set_cancel_send_fnc (xfer, _qq_xfer_cancel); - purple_xfer_set_write_fnc(xfer, _qq_xfer_write); - - qd->xfer = xfer; - purple_xfer_request(xfer); - } -} - -/* -static void qq_send_packet_request_key(PurpleConnection *gc, guint8 key) -{ - qq_send_cmd(gc, QQ_CMD_REQUEST_KEY, &key, 1); -} - -static void qq_process_recv_request_key(PurpleConnection *gc) -{ -} -*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/send_file.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/** - * @file send_file.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_QQ_SEND_FILE_H_ -#define _QQ_QQ_SEND_FILE_H_ - -#include "ft.h" -#include "qq.h" - -typedef struct _ft_info { - guint32 to_uid; - guint16 send_seq; - guint8 file_session_key[QQ_KEY_LENGTH]; - guint8 conn_method; - guint32 remote_internet_ip; - guint16 remote_internet_port; - guint16 remote_major_port; - guint32 remote_real_ip; - guint16 remote_minor_port; - guint32 local_internet_ip; - guint16 local_internet_port; - guint16 local_major_port; - guint32 local_real_ip; - guint16 local_minor_port; - /* we use these to control the packets sent or received */ - guint32 fragment_num; - guint32 fragment_len; - /* The max index of sending/receiving fragment - * for sender, it is the lower bolder of a slide window for sending - * for receiver, it seems that packets having a fragment index lower - * than max_fragment_index have been received already - */ - guint32 max_fragment_index; - guint32 window; - - /* It seems that using xfer's function is not enough for our - * transfer module. So I will use our own structure instead - * of xfer provided - */ - int major_fd; - int minor_fd; - int sender_fd; - int recv_fd; - FILE *dest_fp; - /* guint8 *buffer; */ - gboolean use_major; -} ft_info; - -void qq_process_recv_file_accept(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_reject(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_cancel(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_request(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_notify(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -gboolean qq_can_receive_file(PurpleConnection *gc, const char *who); -void qq_send_file(PurpleConnection *gc, const char *who, const char *file); -gint qq_get_conn_info(ft_info *info, guint8 *data); -gint qq_fill_conn_info(guint8 *data, ft_info *info); -gssize _qq_xfer_write(const guint8 *buf, size_t len, PurpleXfer *xfer); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ -/** - * @file utils.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "limits.h" -#include "stdlib.h" -#include "string.h" - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -#include "cipher.h" - -#include "char_conv.h" -#include "debug.h" -#include "prefs.h" -#include "qq.h" -#include "util.h" -#include "utils.h" - -/* These functions are used only in development phase */ -/* - static void _qq_show_socket(gchar *desc, gint fd) { - struct sockaddr_in sin; - socklen_t len = sizeof(sin); - getsockname(fd, (struct sockaddr *)&sin, &len); - purple_debug_info(desc, "%s:%d\n", - inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port)); - } - */ - -void qq_get_md5(guint8 *md5, gint md5_len, const guint8* const src, gint src_len) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - - g_return_if_fail(md5 != NULL && md5_len > 0); - g_return_if_fail(src != NULL && src_len > 0); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, src, src_len); - purple_cipher_context_digest(context, md5_len, md5, NULL); - purple_cipher_context_destroy(context); -} - -gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount) -{ - gint index; - - index = atoi(index_str); - if (index < 0 || index >= amount) - index = 0; - - return array[index]; -} - -gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount) -{ - gint index; - - for (index = 0; index <= amount; index++) - if (g_ascii_strcasecmp(array[index], name) == 0) - break; - - if (index >= amount) - index = 0; /* meaning no match */ - return g_strdup_printf("%d", index); -} - -/* split the given data(len) with delimit, - * check the number of field matches the expected_fields (<=0 means all) - * return gchar* array (needs to be freed by g_strfreev later), or NULL */ -gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields) -{ - guint8 *input; - gchar **segments, **seg; - gint count = 0, j; - - g_return_val_if_fail(data != NULL && len != 0 && delimit != 0, NULL); - - /* as the last field would be string, but data is not ended with 0x00 - * we have to duplicate the data and append a 0x00 at the end */ - input = g_newa(guint8, len + 1); - g_memmove(input, data, len); - input[len] = 0x00; - - segments = g_strsplit((gchar *) input, delimit, 0); - if (expected_fields <= 0) - return segments; - - for (seg = segments; *seg != NULL; seg++) - count++; - if (count < expected_fields) { /* not enough fields */ - purple_debug_error("QQ", "Less fields %d then %d\n", count, expected_fields); - return NULL; - } else if (count > expected_fields) { /* more fields, OK */ - purple_debug_warning("QQ", "More fields %d than %d\n", count, expected_fields); - /* free up those not used */ - for (j = expected_fields; j < count; j++) { - purple_debug_warning("QQ", "field[%d] is %s\n", j, segments[j]); - g_free(segments[j]); - } - segments[expected_fields] = NULL; - } - - return segments; -} - -/* convert Purple name to original QQ UID */ -guint32 purple_name_to_uid(const gchar *const name) -{ - guint32 ret; - g_return_val_if_fail(name != NULL, 0); - - ret = strtoul(name, NULL, 10); - if (errno == ERANGE) - return 0; - else - return ret; -} - -gchar *gen_ip_str(guint8 *ip) { - gchar *ret; - if (ip == NULL || ip[0] == 0) { - ret = g_new(gchar, 1); - *ret = '\0'; - return ret; - } else { - return g_strdup_printf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - } -} - -guint8 *str_ip_gen(gchar *str) { - guint8 *ip = g_new(guint8, 4); - gint a, b, c, d; - - sscanf(str, "%d.%d.%d.%d", &a, &b, &c, &d); - ip[0] = a; - ip[1] = b; - ip[2] = c; - ip[3] = d; - return ip; -} - -/* convert a QQ UID to a unique name of Purple - * the return needs to be freed */ -gchar *uid_to_purple_name(guint32 uid) -{ - return g_strdup_printf("%u", uid); -} - -/* try to dump the data as GBK */ -gchar* try_dump_as_gbk(const guint8 *const data, gint len) -{ - gint i; - guint8 *incoming; - gchar *msg_utf8; - - incoming = g_newa(guint8, len + 1); - g_memmove(incoming, data, len); - incoming[len] = 0x00; - /* GBK code: - * Single-byte ASCII: 0x21-0x7E - * GBK first byte range: 0x81-0xFE - * GBK second byte range: 0x40-0x7E and 0x80-0xFE */ - for (i = 0; i < len; i++) - if (incoming[i] >= 0x81) - break; - - msg_utf8 = i < len ? qq_to_utf8((gchar *) &incoming[i], QQ_CHARSET_DEFAULT) : NULL; - - if (msg_utf8 != NULL) { - purple_debug_warning("QQ", "Try extract GB msg: %s\n", msg_utf8); - } - return msg_utf8; -} - -/* strips whitespace */ -static gchar *strstrip(const gchar *const buffer) -{ - GString *stripped; - gchar *ret, cur; - gint i; - - g_return_val_if_fail(buffer != NULL, NULL); - - stripped = g_string_new(""); - for (i=0; istr; - g_string_free(stripped, FALSE); - - return ret; -} - -/* Attempts to dump an ASCII hex string to a string of bytes. - * The return should be freed later. */ -guint8 *hex_str_to_bytes(const gchar *const buffer, gint *out_len) -{ - gchar *hex_str, *hex_buffer, *cursor; - gchar tmp[2]; - guint8 *bytes, nibble1, nibble2; - gint index; - - g_return_val_if_fail(buffer != NULL, NULL); - - hex_buffer = strstrip(buffer); - - if (strlen(hex_buffer) % 2 != 0) { - purple_debug_warning("QQ", - "Unable to convert an odd number of nibbles to a string of bytes!\n"); - g_free(hex_buffer); - return NULL; - } - bytes = g_newa(guint8, strlen(hex_buffer) / 2); - hex_str = g_ascii_strdown(hex_buffer, -1); - g_free(hex_buffer); - index = 0; - for (cursor = hex_str; cursor < hex_str + sizeof(gchar) * (strlen(hex_str)) - 1; cursor++) { - if (g_ascii_isdigit(*cursor)) { - tmp[0] = *cursor; - tmp[1] = '\0'; - nibble1 = atoi(tmp); - } else if (g_ascii_isalpha(*cursor) && (gint) *cursor - 87 < 16) { - nibble1 = (gint) *cursor - 87; - } else { - purple_debug_warning("QQ", "Invalid char \'%c\' found in hex string!\n", - *cursor); - g_free(hex_str); - return NULL; - } - nibble1 = nibble1 << 4; - cursor++; - if (g_ascii_isdigit(*cursor)) { - tmp[0] = *cursor; - tmp[1] = '\0'; - nibble2 = atoi(tmp); - } else if (g_ascii_isalpha(*cursor) && (gint) (*cursor - 87) < 16) { - nibble2 = (gint) *cursor - 87; - } else { - purple_debug_warning("QQ", "Invalid char found in hex string!\n"); - g_free(hex_str); - return NULL; - } - bytes[index++] = nibble1 + nibble2; - } - *out_len = strlen(hex_str) / 2; - g_free(hex_str); - return g_memdup(bytes, *out_len); -} - -/* Dumps a chunk of raw data into an ASCII hex string. - * The return should be freed later. */ -static gchar *hex_dump_to_str(const guint8 *const buffer, gint bytes) -{ - GString *str; - gchar *ret; - gint i, j, ch; - - str = g_string_new(""); - for (i = 0; i < bytes; i += 16) { - /* length label */ - g_string_append_printf(str, "%07x: ", i); - - /* dump hex value */ - for (j = 0; j < 16; j++) - if ((i + j) < bytes) - g_string_append_printf(str, " %02x", buffer[i + j]); - else - g_string_append(str, " --"); - g_string_append(str, " "); - - /* dump ascii value */ - for (j = 0; j < 16 && (i + j) < bytes; j++) { - ch = buffer[i + j] & 127; - if (ch < ' ' || ch == 127) - g_string_append_c(str, '.'); - else - g_string_append_c(str, ch); - } - g_string_append_c(str, '\n'); - } - - ret = str->str; - /* GString can be freed without freeing it character data */ - g_string_free(str, FALSE); - - return ret; -} - -void qq_hex_dump(PurpleDebugLevel level, const char *category, - const guint8 *pdata, gint bytes, - const char *format, ...) -{ - va_list args; - char *arg_s = NULL; - gchar *phex = NULL; - - g_return_if_fail(level != PURPLE_DEBUG_ALL); - g_return_if_fail(format != NULL); - - va_start(args, format); - arg_s = g_strdup_vprintf(format, args); - va_end(args); - - if (bytes <= 0) { - purple_debug(level, category, "%s", arg_s); - return; - } - - phex = hex_dump_to_str(pdata, bytes); - purple_debug(level, category, "%s - (len %d)\n%s", arg_s, bytes, phex); - g_free(phex); -} - -void qq_show_packet(const gchar *desc, const guint8 *buf, gint len) -{ - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", buf, len, desc); -} - -void qq_filter_str(gchar *str) { - gchar *temp; - if (str == NULL) { - return; - } - - for (temp = str; *temp != 0; temp++) { - /*if (*temp == '\r' || *temp == '\n') *temp = ' ';*/ - if (*temp > 0 && *temp < 0x20) *temp = ' '; - } - g_strstrip(str); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/qq/utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/** - * @file utils.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_MY_UTILS_H_ -#define _QQ_MY_UTILS_H_ - -#include -#include - -#include "debug.h" - -void qq_get_md5(guint8 *md5, gint md5_len, const guint8* const src, gint src_len); - -gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount); -gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount); - -gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields); - -gchar *gen_ip_str(guint8 *ip); -guint8 *str_ip_gen(gchar *str); - -guint32 purple_name_to_uid(const gchar *name); -gchar *uid_to_purple_name(guint32 uid); - -gchar *try_dump_as_gbk(const guint8 *const data, gint len); - -void qq_show_packet(const gchar *desc, const guint8 *buf, gint len); -void qq_hex_dump(PurpleDebugLevel level, const char *category, - const guint8 *pdata, gint bytes, - const char *format, ...); -guint8 *hex_str_to_bytes(const gchar *buf, gint *out_len); - -void qq_filter_str(gchar *str); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -noinst_HEADERS = sametime.h - -SAMETIMESOURCES = sametime.c - -AM_CFLAGS = \ - $(st) - -if STATIC_SAMETIME - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libsametime.la -libsametime_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libsametime.la - -endif - -libsametime_la_SOURCES = $(SAMETIMESOURCES) -libsametime_la_LDFLAGS = -module -avoid-version -libsametime_la_LIBADD = $(GLIB_LIBS) $(MEANWHILE_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(MEANWHILE_CFLAGS) \ - -DG_LOG_DOMAIN=\"sametime\" - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,741 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/sametime -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -libsametime_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am__objects_1 = libsametime_la-sametime.lo -am_libsametime_la_OBJECTS = $(am__objects_1) -libsametime_la_OBJECTS = $(am_libsametime_la_OBJECTS) -@STATIC_SAMETIME_FALSE@am_libsametime_la_rpath = -rpath $(pkgdir) -@STATIC_SAMETIME_TRUE@am_libsametime_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsametime_la_SOURCES) -DIST_SOURCES = $(libsametime_la_SOURCES) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -noinst_HEADERS = sametime.h -SAMETIMESOURCES = sametime.c -AM_CFLAGS = \ - $(st) - -@STATIC_SAMETIME_FALSE@st = -@STATIC_SAMETIME_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_SAMETIME_TRUE@noinst_LTLIBRARIES = libsametime.la -@STATIC_SAMETIME_TRUE@libsametime_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SAMETIME_FALSE@pkg_LTLIBRARIES = libsametime.la -libsametime_la_SOURCES = $(SAMETIMESOURCES) -libsametime_la_LDFLAGS = -module -avoid-version -libsametime_la_LIBADD = $(GLIB_LIBS) $(MEANWHILE_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(MEANWHILE_CFLAGS) \ - -DG_LOG_DOMAIN=\"sametime\" - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/sametime/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/sametime/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsametime.la: $(libsametime_la_OBJECTS) $(libsametime_la_DEPENDENCIES) - $(LINK) $(am_libsametime_la_rpath) $(libsametime_la_LDFLAGS) $(libsametime_la_OBJECTS) $(libsametime_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsametime_la-sametime.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsametime_la-sametime.lo: sametime.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsametime_la_CFLAGS) $(CFLAGS) -MT libsametime_la-sametime.lo -MD -MP -MF "$(DEPDIR)/libsametime_la-sametime.Tpo" -c -o libsametime_la-sametime.lo `test -f 'sametime.c' || echo '$(srcdir)/'`sametime.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsametime_la-sametime.Tpo" "$(DEPDIR)/libsametime_la-sametime.Plo"; else rm -f "$(DEPDIR)/libsametime_la-sametime.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sametime.c' object='libsametime_la-sametime.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsametime_la_CFLAGS) $(CFLAGS) -c -o libsametime_la-sametime.lo `test -f 'sametime.c' || echo '$(srcdir)/'`sametime.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsametime -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libsametime -NEEDED_DLLS = $(MEANWHILE_TOP)/bin/libmeanwhile-1.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else - ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) - endif -endif - -CFLAGS += -DG_LOG_DOMAIN=\"sametime\" - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(MEANWHILE_TOP)/include/meanwhile \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(MEANWHILE_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = sametime.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lmeanwhile \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5849 +0,0 @@ - -/* - Meanwhile Protocol Plugin for Purple - Adds Lotus Sametime support to Purple using the Meanwhile library - - Copyright (C) 2004 Christopher (siege) O'Brien - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - USA. -*/ - -#include "internal.h" - -/* system includes */ -#include -#include - -/* glib includes */ -#include - -/* purple includes */ -#include "account.h" -#include "accountopt.h" -#include "circbuffer.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "imgstore.h" -#include "mime.h" -#include "notify.h" -#include "plugin.h" -#include "privacy.h" -#include "prpl.h" -#include "request.h" -#include "util.h" -#include "version.h" - -/* meanwhile includes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* plugin includes */ -#include "sametime.h" - - -/* considering that there's no display of this information for prpls, - I don't know why I even bother providing these. Oh valiant reader, - I do it all for you. */ -/* scratch that, I just added it to the prpl options panel */ -#define PLUGIN_ID "prpl-meanwhile" -#define PLUGIN_NAME "Sametime" -#define PLUGIN_SUMMARY "Sametime Protocol Plugin" -#define PLUGIN_DESC "Open implementation of a Lotus Sametime client" -#define PLUGIN_AUTHOR "Christopher (siege) O'Brien " -#define PLUGIN_HOMEPAGE "http://meanwhile.sourceforge.net/" - - -/* plugin preference names */ -#define MW_PRPL_OPT_BASE "/plugins/prpl/meanwhile" -#define MW_PRPL_OPT_BLIST_ACTION MW_PRPL_OPT_BASE "/blist_action" -#define MW_PRPL_OPT_PSYCHIC MW_PRPL_OPT_BASE "/psychic" -#define MW_PRPL_OPT_FORCE_LOGIN MW_PRPL_OPT_BASE "/force_login" -#define MW_PRPL_OPT_SAVE_DYNAMIC MW_PRPL_OPT_BASE "/save_dynamic" - - -/* stages of connecting-ness */ -#define MW_CONNECT_STEPS 11 - - -/* stages of conciousness */ -#define MW_STATE_OFFLINE "offline" -#define MW_STATE_ACTIVE "active" -#define MW_STATE_AWAY "away" -#define MW_STATE_BUSY "dnd" -#define MW_STATE_MESSAGE "message" -#define MW_STATE_ENLIGHTENED "buddha" - - -/* keys to get/set chat information */ -#define CHAT_KEY_CREATOR "chat.creator" -#define CHAT_KEY_NAME "chat.name" -#define CHAT_KEY_TOPIC "chat.topic" -#define CHAT_KEY_INVITE "chat.invite" -#define CHAT_KEY_IS_PLACE "chat.is_place" - - -/* key for associating a mwLoginType with a buddy */ -#define BUDDY_KEY_CLIENT "meanwhile.client" - -/* store the remote alias so that we can re-create it easily */ -#define BUDDY_KEY_NAME "meanwhile.shortname" - -/* enum mwSametimeUserType */ -#define BUDDY_KEY_TYPE "meanwhile.type" - - -/* key for the real group name for a meanwhile group */ -#define GROUP_KEY_NAME "meanwhile.group" - -/* enum mwSametimeGroupType */ -#define GROUP_KEY_TYPE "meanwhile.type" - -/* NAB group owning account */ -#define GROUP_KEY_OWNER "meanwhile.account" - -/* key gtk blist uses to indicate a collapsed group */ -#define GROUP_KEY_COLLAPSED "collapsed" - - -/* verification replacement */ -#define mwSession_NO_SECRET "meanwhile.no_secret" - - -/* keys to get/set purple plugin information */ -#define MW_KEY_HOST "server" -#define MW_KEY_PORT "port" -#define MW_KEY_FORCE "force_login" -#define MW_KEY_FAKE_IT "fake_client_id" -#define MW_KEY_CLIENT "client_id_val" -#define MW_KEY_MAJOR "client_major" -#define MW_KEY_MINOR "client_minor" - - -/** number of seconds from the first blist change before a save to the - storage service occurs. */ -#define BLIST_SAVE_SECONDS 15 - - -/** the possible buddy list storage settings */ -enum blist_choice { - blist_choice_LOCAL = 1, /**< local only */ - blist_choice_MERGE = 2, /**< merge from server */ - blist_choice_STORE = 3, /**< merge from and save to server */ - blist_choice_SYNCH = 4 /**< sync with server */ -}; - - -/** the default blist storage option */ -#define BLIST_CHOICE_DEFAULT blist_choice_SYNCH - - -/* testing for the above */ -#define BLIST_PREF_IS(n) (purple_prefs_get_int(MW_PRPL_OPT_BLIST_ACTION)==(n)) -#define BLIST_PREF_IS_LOCAL() BLIST_PREF_IS(blist_choice_LOCAL) -#define BLIST_PREF_IS_MERGE() BLIST_PREF_IS(blist_choice_MERGE) -#define BLIST_PREF_IS_STORE() BLIST_PREF_IS(blist_choice_STORE) -#define BLIST_PREF_IS_SYNCH() BLIST_PREF_IS(blist_choice_SYNCH) - - -/* debugging output */ -#define DEBUG_ERROR(a...) purple_debug_error(G_LOG_DOMAIN, a) -#define DEBUG_INFO(a...) purple_debug_info(G_LOG_DOMAIN, a) -#define DEBUG_MISC(a...) purple_debug_misc(G_LOG_DOMAIN, a) -#define DEBUG_WARN(a...) purple_debug_warning(G_LOG_DOMAIN, a) - - -/** ensure non-null strings */ -#ifndef NSTR -# define NSTR(str) ((str)? (str): "(null)") -#endif - - -/** calibrates distinct secure channel nomenclature */ -static const unsigned char no_secret[] = { - 0x2d, 0x2d, 0x20, 0x73, 0x69, 0x65, 0x67, 0x65, - 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x6a, - 0x65, 0x6e, 0x6e, 0x69, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x7a, 0x6f, 0x65, 0x20, 0x2d, 0x2d, 0x00, -}; - - -/** handler IDs from g_log_set_handler in mw_plugin_init */ -static guint log_handler[2] = { 0, 0 }; - - -/** the purple plugin data. - available as gc->proto_data and mwSession_getClientData */ -struct mwPurplePluginData { - struct mwSession *session; - - struct mwServiceAware *srvc_aware; - struct mwServiceConference *srvc_conf; - struct mwServiceFileTransfer *srvc_ft; - struct mwServiceIm *srvc_im; - struct mwServicePlace *srvc_place; - struct mwServiceResolve *srvc_resolve; - struct mwServiceStorage *srvc_store; - - /** map of PurpleGroup:mwAwareList and mwAwareList:PurpleGroup */ - GHashTable *group_list_map; - - /** event id for the buddy list save callback */ - guint save_event; - - /** socket fd */ - int socket; - gint outpa; /* like inpa, but the other way */ - - /** circular buffer for outgoing data */ - PurpleCircBuffer *sock_buf; - - PurpleConnection *gc; -}; - - -typedef struct { - PurpleBuddy *buddy; - PurpleGroup *group; -} BuddyAddData; - - -/* blist and aware functions */ - -static void blist_export(PurpleConnection *gc, struct mwSametimeList *stlist); - -static void blist_store(struct mwPurplePluginData *pd); - -static void blist_schedule(struct mwPurplePluginData *pd); - -static void blist_merge(PurpleConnection *gc, struct mwSametimeList *stlist); - -static void blist_sync(PurpleConnection *gc, struct mwSametimeList *stlist); - -static gboolean buddy_is_external(PurpleBuddy *b); - -static void buddy_add(struct mwPurplePluginData *pd, PurpleBuddy *buddy); - -static PurpleBuddy * -buddy_ensure(PurpleConnection *gc, PurpleGroup *group, - struct mwSametimeUser *stuser); - -static void group_add(struct mwPurplePluginData *pd, PurpleGroup *group); - -static PurpleGroup * -group_ensure(PurpleConnection *gc, struct mwSametimeGroup *stgroup); - -static struct mwAwareList * -list_ensure(struct mwPurplePluginData *pd, PurpleGroup *group); - - -/* session functions */ - -static struct mwSession * -gc_to_session(PurpleConnection *gc); - -static PurpleConnection *session_to_gc(struct mwSession *session); - - -/* conference functions */ - -static struct mwConference * -conf_find_by_id(struct mwPurplePluginData *pd, int id); - - -/* conversation functions */ - -struct convo_msg { - enum mwImSendType type; - gpointer data; - GDestroyNotify clear; -}; - - -struct convo_data { - struct mwConversation *conv; - GList *queue; /**< outgoing message queue, list of convo_msg */ -}; - -static void convo_data_new(struct mwConversation *conv); - -static void convo_data_free(struct convo_data *conv); - -static void convo_features(struct mwConversation *conv); - -static PurpleConversation *convo_get_gconv(struct mwConversation *conv); - - -/* name and id */ - -struct named_id { - char *id; - char *name; -}; - - -/* connection functions */ - -static void connect_cb(gpointer data, gint source, const gchar *error_message); - - -/* ----- session ------ */ - - -/** resolves a mwSession from a PurpleConnection */ -static struct mwSession *gc_to_session(PurpleConnection *gc) { - struct mwPurplePluginData *pd; - - g_return_val_if_fail(gc != NULL, NULL); - - pd = gc->proto_data; - g_return_val_if_fail(pd != NULL, NULL); - - return pd->session; -} - - -/** resolves a PurpleConnection from a mwSession */ -static PurpleConnection *session_to_gc(struct mwSession *session) { - struct mwPurplePluginData *pd; - - g_return_val_if_fail(session != NULL, NULL); - - pd = mwSession_getClientData(session); - g_return_val_if_fail(pd != NULL, NULL); - - return pd->gc; -} - - -static void write_cb(gpointer data, gint source, PurpleInputCondition cond) { - struct mwPurplePluginData *pd = data; - PurpleCircBuffer *circ = pd->sock_buf; - gsize avail; - int ret; - - DEBUG_INFO("write_cb\n"); - - g_return_if_fail(circ != NULL); - - avail = purple_circ_buffer_get_max_read(circ); - if(BUF_LONG < avail) avail = BUF_LONG; - - while(avail) { - ret = write(pd->socket, circ->outptr, avail); - - if(ret <= 0) - break; - - purple_circ_buffer_mark_read(circ, ret); - avail = purple_circ_buffer_get_max_read(circ); - if(BUF_LONG < avail) avail = BUF_LONG; - } - - if(! avail) { - purple_input_remove(pd->outpa); - pd->outpa = 0; - } -} - - -static int mw_session_io_write(struct mwSession *session, - const guchar *buf, gsize len) { - struct mwPurplePluginData *pd; - gssize ret = 0; - int err = 0; - - pd = mwSession_getClientData(session); - - /* socket was already closed. */ - if(pd->socket == 0) - return 1; - - if(pd->outpa) { - DEBUG_INFO("already pending INPUT_WRITE, buffering\n"); - purple_circ_buffer_append(pd->sock_buf, buf, len); - return 0; - } - - while(len) { - ret = write(pd->socket, buf, (len > BUF_LEN)? BUF_LEN: len); - - if(ret <= 0) - break; - - len -= ret; - buf += ret; - } - - if(ret <= 0) - err = errno; - - if(err == EAGAIN) { - /* append remainder to circular buffer */ - DEBUG_INFO("EAGAIN\n"); - purple_circ_buffer_append(pd->sock_buf, buf, len); - pd->outpa = purple_input_add(pd->socket, PURPLE_INPUT_WRITE, write_cb, pd); - - } else if(len > 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - DEBUG_ERROR("write returned %" G_GSSIZE_FORMAT ", %" G_GSIZE_FORMAT - " bytes left unwritten\n", ret, len); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - -#if 0 - close(pd->socket); - pd->socket = 0; -#endif - - return -1; - } - - return 0; -} - - -static void mw_session_io_close(struct mwSession *session) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - - if(pd->outpa) { - purple_input_remove(pd->outpa); - pd->outpa = 0; - } - - if(pd->socket) { - close(pd->socket); - pd->socket = 0; - } - - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; - } -} - - -static void mw_session_clear(struct mwSession *session) { - ; /* nothing for now */ -} - - -/* ----- aware list ----- */ - - -static void blist_resolve_alias_cb(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer data) { - struct mwResolveResult *result; - struct mwResolveMatch *match; - - g_return_if_fail(results != NULL); - - result = results->data; - g_return_if_fail(result != NULL); - g_return_if_fail(result->matches != NULL); - - match = result->matches->data; - g_return_if_fail(match != NULL); - - purple_blist_server_alias_buddy(data, match->name); - purple_blist_node_set_string(data, BUDDY_KEY_NAME, match->name); -} - - -static void mw_aware_list_on_aware(struct mwAwareList *list, - struct mwAwareSnapshot *aware) { - - PurpleConnection *gc; - PurpleAccount *acct; - - struct mwPurplePluginData *pd; - guint32 idle; - guint stat; - const char *id; - const char *status = MW_STATE_ACTIVE; - - gc = mwAwareList_getClientData(list); - acct = purple_connection_get_account(gc); - - pd = gc->proto_data; - idle = aware->status.time; - stat = aware->status.status; - id = aware->id.user; - - if(idle) { - guint32 idle_len; /*< how long a client has been idle */ - guint32 ugly_idle_len; /*< how long a broken client has been idle */ - - DEBUG_INFO("%s has idle value 0x%x\n", NSTR(id), idle); - - idle_len = time(NULL) - idle; - ugly_idle_len = ((time(NULL) * 1000) - idle) / 1000; - - if(idle > ugly_idle_len) - ugly_idle_len = 0; - else - ugly_idle_len = (ugly_idle_len - idle) / 1000; - - /* - what's the deal here? Well, good clients are smart enough to - publish their idle time by using an attribute to indicate that - they went idle at some time UTC, in seconds since epoch. Bad - clients use milliseconds since epoch. So we're going to compute - the idle time for either method, then figure out the lower of - the two and use that. Blame the ST 7.5 development team for - this. - */ - - DEBUG_INFO("idle time: %u, ugly idle time: %u\n", idle_len, ugly_idle_len); - -#if 1 - if(idle_len <= ugly_idle_len) { - ; /* DEBUG_INFO("sane idle value, let's use it\n"); */ - } else { - idle = time(NULL) - ugly_idle_len; - } - -#else - if(idle < 0 || idle > time(NULL)) { - DEBUG_INFO("hiding a messy idle value 0x%x\n", NSTR(id), idle); - idle = -1; - } -#endif - } - - switch(stat) { - case mwStatus_ACTIVE: - status = MW_STATE_ACTIVE; - idle = 0; - break; - - case mwStatus_IDLE: - if(! idle) idle = -1; - break; - - case mwStatus_AWAY: - status = MW_STATE_AWAY; - break; - - case mwStatus_BUSY: - status = MW_STATE_BUSY; - break; - } - - /* NAB group members */ - if(aware->group) { - PurpleGroup *group; - PurpleBuddy *buddy; - PurpleBlistNode *bnode; - - group = g_hash_table_lookup(pd->group_list_map, list); - buddy = purple_find_buddy_in_group(acct, id, group); - bnode = (PurpleBlistNode *) buddy; - - if(! buddy) { - struct mwServiceResolve *srvc; - GList *query; - - buddy = purple_buddy_new(acct, id, NULL); - purple_blist_add_buddy(buddy, NULL, group, NULL); - - bnode = (PurpleBlistNode *) buddy; - - srvc = pd->srvc_resolve; - query = g_list_append(NULL, (char *) id); - - mwServiceResolve_resolve(srvc, query, mwResolveFlag_USERS, - blist_resolve_alias_cb, buddy, NULL); - g_list_free(query); - } - - purple_blist_node_set_int(bnode, BUDDY_KEY_TYPE, mwSametimeUser_NORMAL); - } - - if(aware->online) { - purple_prpl_got_user_status(acct, id, status, NULL); - purple_prpl_got_user_idle(acct, id, !!idle, (time_t) idle); - - } else { - purple_prpl_got_user_status(acct, id, MW_STATE_OFFLINE, NULL); - } -} - - -static void mw_aware_list_on_attrib(struct mwAwareList *list, - struct mwAwareIdBlock *id, - struct mwAwareAttribute *attrib) { - - ; /* nothing. We'll get attribute data as we need it */ -} - - -static void mw_aware_list_clear(struct mwAwareList *list) { - ; /* nothing for now */ -} - - -static struct mwAwareListHandler mw_aware_list_handler = { - mw_aware_list_on_aware, - mw_aware_list_on_attrib, - mw_aware_list_clear, -}; - - -/** Ensures that an Aware List is associated with the given group, and - returns that list. */ -static struct mwAwareList * -list_ensure(struct mwPurplePluginData *pd, PurpleGroup *group) { - - struct mwAwareList *list; - - g_return_val_if_fail(pd != NULL, NULL); - g_return_val_if_fail(group != NULL, NULL); - - list = g_hash_table_lookup(pd->group_list_map, group); - if(! list) { - list = mwAwareList_new(pd->srvc_aware, &mw_aware_list_handler); - mwAwareList_setClientData(list, pd->gc, NULL); - - mwAwareList_watchAttributes(list, - mwAttribute_AV_PREFS_SET, - mwAttribute_MICROPHONE, - mwAttribute_SPEAKERS, - mwAttribute_VIDEO_CAMERA, - mwAttribute_FILE_TRANSFER, - NULL); - - g_hash_table_replace(pd->group_list_map, group, list); - g_hash_table_insert(pd->group_list_map, list, group); - } - - return list; -} - - -static void blist_export(PurpleConnection *gc, struct mwSametimeList *stlist) { - /* - find the account for this connection - - iterate through the buddy list - - add each buddy matching this account to the stlist - */ - - PurpleAccount *acct; - PurpleBlistNode *gn, *cn, *bn; - PurpleGroup *grp; - PurpleBuddy *bdy; - - struct mwSametimeGroup *stg = NULL; - struct mwIdBlock idb = { NULL, NULL }; - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - for(gn = purple_blist_get_root(); gn; - gn = purple_blist_node_get_sibling_next(gn)) { - const char *owner; - const char *gname; - enum mwSametimeGroupType gtype; - gboolean gopen; - - if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; - grp = (PurpleGroup *) gn; - - /* the group's type (normal or dynamic) */ - gtype = purple_blist_node_get_int(gn, GROUP_KEY_TYPE); - if(! gtype) gtype = mwSametimeGroup_NORMAL; - - /* if it's a normal group with none of our people in it, skip it */ - if(gtype == mwSametimeGroup_NORMAL && !purple_group_on_account(grp, acct)) - continue; - - /* if the group has an owner and we're not it, skip it */ - owner = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - if(owner && strcmp(owner, purple_account_get_username(acct))) - continue; - - /* the group's actual name may be different from the purple group's - name. Find whichever is there */ - gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = purple_group_get_name(grp); - - /* we save this, but never actually honor it */ - gopen = ! purple_blist_node_get_bool(gn, GROUP_KEY_COLLAPSED); - - stg = mwSametimeGroup_new(stlist, gtype, gname); - mwSametimeGroup_setAlias(stg, purple_group_get_name(grp)); - mwSametimeGroup_setOpen(stg, gopen); - - /* don't attempt to put buddies in a dynamic group, it breaks - other clients */ - if(gtype == mwSametimeGroup_DYNAMIC) - continue; - - for(cn = purple_blist_node_get_first_child(gn); - cn; - cn = purple_blist_node_get_sibling_next(cn)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cn)) continue; - - for(bn = purple_blist_node_get_first_child(cn); - bn; - bn = purple_blist_node_get_sibling_next(bn)) { - if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - if(! PURPLE_BLIST_NODE_SHOULD_SAVE(bn)) continue; - - bdy = (PurpleBuddy *) bn; - - if(purple_buddy_get_account(bdy) == acct) { - struct mwSametimeUser *stu; - enum mwSametimeUserType utype; - - idb.user = (char *)purple_buddy_get_name(bdy); - - utype = purple_blist_node_get_int(bn, BUDDY_KEY_TYPE); - if(! utype) utype = mwSametimeUser_NORMAL; - - stu = mwSametimeUser_new(stg, utype, &idb); - mwSametimeUser_setShortName(stu, purple_buddy_get_server_alias(bdy)); - mwSametimeUser_setAlias(stu, purple_buddy_get_local_buddy_alias(bdy)); - } - } - } - } -} - - -static void blist_store(struct mwPurplePluginData *pd) { - - struct mwSametimeList *stlist; - struct mwServiceStorage *srvc; - struct mwStorageUnit *unit; - - PurpleConnection *gc; - - struct mwPutBuffer *b; - struct mwOpaque *o; - - g_return_if_fail(pd != NULL); - - srvc = pd->srvc_store; - g_return_if_fail(srvc != NULL); - - gc = pd->gc; - - if(BLIST_PREF_IS_LOCAL() || BLIST_PREF_IS_MERGE()) { - DEBUG_INFO("preferences indicate not to save remote blist\n"); - return; - - } else if(MW_SERVICE_IS_DEAD(srvc)) { - DEBUG_INFO("aborting save of blist: storage service is not alive\n"); - return; - - } else if(BLIST_PREF_IS_STORE() || BLIST_PREF_IS_SYNCH()) { - DEBUG_INFO("saving remote blist\n"); - - } else { - g_return_if_reached(); - } - - /* create and export to a list object */ - stlist = mwSametimeList_new(); - blist_export(gc, stlist); - - /* write it to a buffer */ - b = mwPutBuffer_new(); - mwSametimeList_put(b, stlist); - mwSametimeList_free(stlist); - - /* put the buffer contents into a storage unit */ - unit = mwStorageUnit_new(mwStore_AWARE_LIST); - o = mwStorageUnit_asOpaque(unit); - mwPutBuffer_finalize(o, b); - - /* save the storage unit to the service */ - mwServiceStorage_save(srvc, unit, NULL, NULL, NULL); -} - - -static gboolean blist_save_cb(gpointer data) { - struct mwPurplePluginData *pd = data; - - blist_store(pd); - pd->save_event = 0; - return FALSE; -} - - -/** schedules the buddy list to be saved to the server */ -static void blist_schedule(struct mwPurplePluginData *pd) { - if(pd->save_event) return; - - pd->save_event = purple_timeout_add_seconds(BLIST_SAVE_SECONDS, - blist_save_cb, pd); -} - - -static gboolean buddy_is_external(PurpleBuddy *b) { - g_return_val_if_fail(b != NULL, FALSE); - return purple_str_has_prefix(purple_buddy_get_name(b), "@E "); -} - - -/** Actually add a buddy to the aware service, and schedule the buddy - list to be saved to the server */ -static void buddy_add(struct mwPurplePluginData *pd, - PurpleBuddy *buddy) { - - struct mwAwareIdBlock idb = { mwAware_USER, (char *) purple_buddy_get_name(buddy), NULL }; - struct mwAwareList *list; - - PurpleGroup *group; - GList *add; - - add = g_list_prepend(NULL, &idb); - - group = purple_buddy_get_group(buddy); - list = list_ensure(pd, group); - - if(mwAwareList_addAware(list, add)) { - purple_blist_remove_buddy(buddy); - } - - blist_schedule(pd); - - g_list_free(add); -} - - -/** ensure that a PurpleBuddy exists in the group with data - appropriately matching the st user entry from the st list */ -static PurpleBuddy *buddy_ensure(PurpleConnection *gc, PurpleGroup *group, - struct mwSametimeUser *stuser) { - - struct mwPurplePluginData *pd = gc->proto_data; - PurpleBuddy *buddy; - PurpleAccount *acct = purple_connection_get_account(gc); - - const char *id = mwSametimeUser_getUser(stuser); - const char *name = mwSametimeUser_getShortName(stuser); - const char *alias = mwSametimeUser_getAlias(stuser); - enum mwSametimeUserType type = mwSametimeUser_getType(stuser); - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(strlen(id) > 0, NULL); - - buddy = purple_find_buddy_in_group(acct, id, group); - if(! buddy) { - buddy = purple_buddy_new(acct, id, alias); - - purple_blist_add_buddy(buddy, NULL, group, NULL); - buddy_add(pd, buddy); - } - - purple_blist_alias_buddy(buddy, alias); - purple_blist_server_alias_buddy(buddy, name); - purple_blist_node_set_string((PurpleBlistNode *) buddy, BUDDY_KEY_NAME, name); - purple_blist_node_set_int((PurpleBlistNode *) buddy, BUDDY_KEY_TYPE, type); - - return buddy; -} - - -/** add aware watch for a dynamic group */ -static void group_add(struct mwPurplePluginData *pd, - PurpleGroup *group) { - - struct mwAwareIdBlock idb = { mwAware_GROUP, NULL, NULL }; - struct mwAwareList *list; - const char *n; - GList *add; - - n = purple_blist_node_get_string((PurpleBlistNode *) group, GROUP_KEY_NAME); - if(! n) n = purple_group_get_name(group); - - idb.user = (char *) n; - add = g_list_prepend(NULL, &idb); - - list = list_ensure(pd, group); - mwAwareList_addAware(list, add); - g_list_free(add); -} - - -/** ensure that a PurpleGroup exists in the blist with data - appropriately matching the st group entry from the st list */ -static PurpleGroup *group_ensure(PurpleConnection *gc, - struct mwSametimeGroup *stgroup) { - PurpleAccount *acct; - PurpleGroup *group = NULL; - PurpleBuddyList *blist; - PurpleBlistNode *gn; - const char *name, *alias, *owner; - enum mwSametimeGroupType type; - - acct = purple_connection_get_account(gc); - owner = purple_account_get_username(acct); - - blist = purple_get_blist(); - g_return_val_if_fail(blist != NULL, NULL); - - name = mwSametimeGroup_getName(stgroup); - alias = mwSametimeGroup_getAlias(stgroup); - type = mwSametimeGroup_getType(stgroup); - - DEBUG_INFO("attempting to ensure group %s, called %s\n", - NSTR(name), NSTR(alias)); - - /* first attempt at finding the group, by the name key */ - for(gn = purple_blist_get_root(); gn; - gn = purple_blist_node_get_sibling_next(gn)) { - const char *n, *o; - if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; - n = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - o = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - - DEBUG_INFO("found group named %s, owned by %s\n", NSTR(n), NSTR(o)); - - if(n && !strcmp(n, name)) { - if(!o || !strcmp(o, owner)) { - DEBUG_INFO("that'll work\n"); - group = (PurpleGroup *) gn; - break; - } - } - } - - /* try again, by alias */ - if(! group) { - DEBUG_INFO("searching for group by alias %s\n", NSTR(alias)); - group = purple_find_group(alias); - } - - /* oh well, no such group. Let's create it! */ - if(! group) { - DEBUG_INFO("creating group\n"); - group = purple_group_new(alias); - purple_blist_add_group(group, NULL); - } - - gn = (PurpleBlistNode *) group; - purple_blist_node_set_string(gn, GROUP_KEY_NAME, name); - purple_blist_node_set_int(gn, GROUP_KEY_TYPE, type); - - if(type == mwSametimeGroup_DYNAMIC) { - purple_blist_node_set_string(gn, GROUP_KEY_OWNER, owner); - group_add(gc->proto_data, group); - } - - return group; -} - - -/** merge the entries from a st list into the purple blist */ -static void blist_merge(PurpleConnection *gc, struct mwSametimeList *stlist) { - struct mwSametimeGroup *stgroup; - struct mwSametimeUser *stuser; - - PurpleGroup *group; - PurpleBuddy *buddy; - - GList *gl, *gtl, *ul, *utl; - - gl = gtl = mwSametimeList_getGroups(stlist); - for(; gl; gl = gl->next) { - - stgroup = (struct mwSametimeGroup *) gl->data; - group = group_ensure(gc, stgroup); - - ul = utl = mwSametimeGroup_getUsers(stgroup); - for(; ul; ul = ul->next) { - - stuser = (struct mwSametimeUser *) ul->data; - buddy = buddy_ensure(gc, group, stuser); - } - g_list_free(utl); - } - g_list_free(gtl); -} - - -/** remove all buddies on account from group. If del is TRUE and group - is left empty, remove group as well */ -static void group_clear(PurpleGroup *group, PurpleAccount *acct, gboolean del) { - PurpleConnection *gc; - GList *prune = NULL; - PurpleBlistNode *gn, *cn, *bn; - - g_return_if_fail(group != NULL); - - DEBUG_INFO("clearing members from pruned group %s\n", NSTR(purple_group_get_name(group))); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - gn = (PurpleBlistNode *) group; - - for(cn = purple_blist_node_get_first_child(gn); - cn; - cn = purple_blist_node_get_sibling_next(cn)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cn)) continue; - - for(bn = purple_blist_node_get_first_child(cn); - bn; - bn = purple_blist_node_get_sibling_next(bn)) { - PurpleBuddy *gb = (PurpleBuddy *) bn; - - if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - - if(purple_buddy_get_account(gb) == acct) { - DEBUG_INFO("clearing %s from group\n", NSTR(purple_buddy_get_name(gb))); - prune = g_list_prepend(prune, gb); - } - } - } - - /* quickly unsubscribe from presence for the entire group */ - purple_account_remove_group(acct, group); - - /* remove blist entries that need to go */ - while(prune) { - purple_blist_remove_buddy(prune->data); - prune = g_list_delete_link(prune, prune); - } - DEBUG_INFO("cleared buddies\n"); - - /* optionally remove group from blist */ - if(del && !purple_blist_get_group_size(group, TRUE)) { - DEBUG_INFO("removing empty group\n"); - purple_blist_remove_group(group); - } -} - - -/** prune out group members that shouldn't be there */ -static void group_prune(PurpleConnection *gc, PurpleGroup *group, - struct mwSametimeGroup *stgroup) { - - PurpleAccount *acct; - PurpleBlistNode *gn, *cn, *bn; - - GHashTable *stusers; - GList *prune = NULL; - GList *ul, *utl; - - g_return_if_fail(group != NULL); - - DEBUG_INFO("pruning membership of group %s\n", NSTR(purple_group_get_name(group))); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - stusers = g_hash_table_new(g_str_hash, g_str_equal); - - /* build a hash table for quick lookup while pruning the group - contents */ - utl = mwSametimeGroup_getUsers(stgroup); - for(ul = utl; ul; ul = ul->next) { - const char *id = mwSametimeUser_getUser(ul->data); - g_hash_table_insert(stusers, (char *) id, ul->data); - DEBUG_INFO("server copy has %s\n", NSTR(id)); - } - g_list_free(utl); - - gn = (PurpleBlistNode *) group; - - for(cn = purple_blist_node_get_first_child(gn); - cn; - cn = purple_blist_node_get_sibling_next(cn)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cn)) continue; - - for(bn = purple_blist_node_get_first_child(cn); - bn; - bn = purple_blist_node_get_sibling_next(bn)) { - PurpleBuddy *gb = (PurpleBuddy *) bn; - - if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - - /* if the account is correct and they're not in our table, mark - them for pruning */ - if(purple_buddy_get_account(gb) == acct && !g_hash_table_lookup(stusers, purple_buddy_get_name(gb))) { - DEBUG_INFO("marking %s for pruning\n", NSTR(purple_buddy_get_name(gb))); - prune = g_list_prepend(prune, gb); - } - } - } - DEBUG_INFO("done marking\n"); - - g_hash_table_destroy(stusers); - - if(prune) { - purple_account_remove_buddies(acct, prune, NULL); - while(prune) { - purple_blist_remove_buddy(prune->data); - prune = g_list_delete_link(prune, prune); - } - } -} - - -/** synch the entries from a st list into the purple blist, removing any - existing buddies that aren't in the st list */ -static void blist_sync(PurpleConnection *gc, struct mwSametimeList *stlist) { - - PurpleAccount *acct; - PurpleBuddyList *blist; - PurpleBlistNode *gn; - - GHashTable *stgroups; - GList *g_prune = NULL; - - GList *gl, *gtl; - - const char *acct_n; - - DEBUG_INFO("synchronizing local buddy list from server list\n"); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - acct_n = purple_account_get_username(acct); - - blist = purple_get_blist(); - g_return_if_fail(blist != NULL); - - /* build a hash table for quick lookup while pruning the local - list, mapping group name to group structure */ - stgroups = g_hash_table_new(g_str_hash, g_str_equal); - - gtl = mwSametimeList_getGroups(stlist); - for(gl = gtl; gl; gl = gl->next) { - const char *name = mwSametimeGroup_getName(gl->data); - g_hash_table_insert(stgroups, (char *) name, gl->data); - } - g_list_free(gtl); - - /* find all groups which should be pruned from the local list */ - for(gn = purple_blist_get_root(); gn; - gn = purple_blist_node_get_sibling_next(gn)) { - PurpleGroup *grp = (PurpleGroup *) gn; - const char *gname, *owner; - struct mwSametimeGroup *stgrp; - - if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; - - /* group not belonging to this account */ - if(! purple_group_on_account(grp, acct)) - continue; - - /* dynamic group belonging to this account. don't prune contents */ - owner = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - if(owner && !strcmp(owner, acct_n)) - continue; - - /* we actually are synching by this key as opposed to the group - title, which can be different things in the st list */ - gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = purple_group_get_name(grp); - - stgrp = g_hash_table_lookup(stgroups, gname); - if(! stgrp) { - /* remove the whole group */ - DEBUG_INFO("marking group %s for pruning\n", purple_group_get_name(grp)); - g_prune = g_list_prepend(g_prune, grp); - - } else { - /* synch the group contents */ - group_prune(gc, grp, stgrp); - } - } - DEBUG_INFO("done marking groups\n"); - - /* don't need this anymore */ - g_hash_table_destroy(stgroups); - - /* prune all marked groups */ - while(g_prune) { - PurpleGroup *grp = g_prune->data; - PurpleBlistNode *gn = (PurpleBlistNode *) grp; - const char *owner; - gboolean del = TRUE; - - owner = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - if(owner && strcmp(owner, acct_n)) { - /* it's a specialty group belonging to another account with some - of our members in it, so don't fully delete it */ - del = FALSE; - } - - group_clear(g_prune->data, acct, del); - g_prune = g_list_delete_link(g_prune, g_prune); - } - - /* done with the pruning, let's merge in the additions */ - blist_merge(gc, stlist); -} - - -/** callback passed to the storage service when it's told to load the - st list */ -static void fetch_blist_cb(struct mwServiceStorage *srvc, - guint32 result, struct mwStorageUnit *item, - gpointer data) { - - struct mwPurplePluginData *pd = data; - struct mwSametimeList *stlist; - - struct mwGetBuffer *b; - - g_return_if_fail(result == ERR_SUCCESS); - - /* check our preferences for loading */ - if(BLIST_PREF_IS_LOCAL()) { - DEBUG_INFO("preferences indicate not to load remote buddy list\n"); - return; - } - - b = mwGetBuffer_wrap(mwStorageUnit_asOpaque(item)); - - stlist = mwSametimeList_new(); - mwSametimeList_get(b, stlist); - - /* merge or synch depending on preferences */ - if(BLIST_PREF_IS_MERGE() || BLIST_PREF_IS_STORE()) { - blist_merge(pd->gc, stlist); - - } else if(BLIST_PREF_IS_SYNCH()) { - blist_sync(pd->gc, stlist); - } - - mwSametimeList_free(stlist); - mwGetBuffer_free(b); -} - - -/** signal triggered when a conversation is opened in Purple */ -static void conversation_created_cb(PurpleConversation *g_conv, - struct mwPurplePluginData *pd) { - - /* we need to tell the IM service to negotiate features for the - conversation right away, otherwise it'll wait until the first - message is sent before offering NotesBuddy features. Therefore - whenever Purple creates a conversation, we'll immediately open the - channel to the other side and figure out what the target can - handle. Unfortunately, this makes us vulnerable to Psychic Mode, - whereas a more lazy negotiation based on the first message - would not */ - - PurpleConnection *gc; - struct mwIdBlock who = { 0, 0 }; - struct mwConversation *conv; - - gc = purple_conversation_get_gc(g_conv); - if(pd->gc != gc) - return; /* not ours */ - - if(purple_conversation_get_type(g_conv) != PURPLE_CONV_TYPE_IM) - return; /* wrong type */ - - who.user = (char *) purple_conversation_get_name(g_conv); - conv = mwServiceIm_getConversation(pd->srvc_im, &who); - - convo_features(conv); - - if(mwConversation_isClosed(conv)) - mwConversation_open(conv); -} - - -static void blist_menu_nab(PurpleBlistNode *node, gpointer data) { - struct mwPurplePluginData *pd = data; - PurpleConnection *gc; - - PurpleGroup *group = (PurpleGroup *) node; - - GString *str; - char *tmp; - const char *gname; - - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP(node)); - - str = g_string_new(NULL); - - tmp = (char *) purple_blist_node_get_string(node, GROUP_KEY_NAME); - gname = purple_group_get_name(group); - - g_string_append_printf(str, _("Group Title: %s
"), gname); - g_string_append_printf(str, _("Notes Group ID: %s
"), tmp); - - tmp = g_strdup_printf(_("Info for Group %s"), gname); - - purple_notify_formatted(gc, tmp, _("Notes Address Book Information"), - NULL, str->str, NULL, NULL); - - g_free(tmp); - g_string_free(str, TRUE); -} - - -/** The normal blist menu prpl function doesn't get called for groups, - so we use the blist-node-extended-menu signal to trigger this - handler */ -static void blist_node_menu_cb(PurpleBlistNode *node, - GList **menu, struct mwPurplePluginData *pd) { - const char *owner; - PurpleGroup *group; - PurpleAccount *acct; - PurpleMenuAction *act; - - /* we only want groups */ - if(! PURPLE_BLIST_NODE_IS_GROUP(node)) return; - group = (PurpleGroup *) node; - - acct = purple_connection_get_account(pd->gc); - g_return_if_fail(acct != NULL); - - /* better make sure we're connected */ - if(! purple_account_is_connected(acct)) return; - -#if 0 - /* if there's anyone in the group for this acct, offer to invite - them all to a conference */ - if(purple_group_on_account(group, acct)) { - act = purple_menu_action_new(_("Invite Group to Conference..."), - PURPLE_CALLBACK(blist_menu_group_invite), - pd, NULL); - *menu = g_list_append(*menu, NULL); - } -#endif - - /* check if it's a NAB group for this account */ - owner = purple_blist_node_get_string(node, GROUP_KEY_OWNER); - if(owner && !strcmp(owner, purple_account_get_username(acct))) { - act = purple_menu_action_new(_("Get Notes Address Book Info"), - PURPLE_CALLBACK(blist_menu_nab), pd, NULL); - *menu = g_list_append(*menu, act); - } -} - - -/* lifted this from oldstatus, since HEAD doesn't do this at login - anymore. */ -static void blist_init(PurpleAccount *acct) { - PurpleBlistNode *gnode, *cnode, *bnode; - GList *add_buds = NULL; - - for(gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - if(! PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; - - for(cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for(bnode = purple_blist_node_get_first_child(cnode); - bnode; - bnode = purple_blist_node_get_sibling_next(bnode)) { - PurpleBuddy *b; - if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - - b = (PurpleBuddy *)bnode; - if(purple_buddy_get_account(b) == acct) { - add_buds = g_list_append(add_buds, b); - } - } - } - } - - if(add_buds) { - purple_account_add_buddies(acct, add_buds); - g_list_free(add_buds); - } -} - - -/** Last thing to happen from a started session */ -static void services_starting(struct mwPurplePluginData *pd) { - - PurpleConnection *gc; - PurpleAccount *acct; - struct mwStorageUnit *unit; - PurpleBlistNode *l; - - gc = pd->gc; - acct = purple_connection_get_account(gc); - - /* grab the buddy list from the server */ - unit = mwStorageUnit_new(mwStore_AWARE_LIST); - mwServiceStorage_load(pd->srvc_store, unit, fetch_blist_cb, pd, NULL); - - /* find all the NAB groups and subscribe to them */ - for(l = purple_blist_get_root(); l; - l = purple_blist_node_get_sibling_next(l)) { - PurpleGroup *group = (PurpleGroup *) l; - enum mwSametimeGroupType gt; - const char *owner; - - if(! PURPLE_BLIST_NODE_IS_GROUP(l)) continue; - - /* if the group is ownerless, or has an owner and we're not it, - skip it */ - owner = purple_blist_node_get_string(l, GROUP_KEY_OWNER); - if(!owner || strcmp(owner, purple_account_get_username(acct))) - continue; - - gt = purple_blist_node_get_int(l, GROUP_KEY_TYPE); - if(gt == mwSametimeGroup_DYNAMIC) - group_add(pd, group); - } - - /* set the aware attributes */ - /* indicate we understand what AV prefs are, but don't support any */ - mwServiceAware_setAttributeBoolean(pd->srvc_aware, - mwAttribute_AV_PREFS_SET, TRUE); - mwServiceAware_unsetAttribute(pd->srvc_aware, mwAttribute_MICROPHONE); - mwServiceAware_unsetAttribute(pd->srvc_aware, mwAttribute_SPEAKERS); - mwServiceAware_unsetAttribute(pd->srvc_aware, mwAttribute_VIDEO_CAMERA); - - /* ... but we can do file transfers! */ - mwServiceAware_setAttributeBoolean(pd->srvc_aware, - mwAttribute_FILE_TRANSFER, TRUE); - - blist_init(acct); -} - - -static void session_loginRedirect(struct mwSession *session, - const char *host) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *account; - guint port; - const char *current_host; - - pd = mwSession_getClientData(session); - gc = pd->gc; - account = purple_connection_get_account(gc); - port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT); - current_host = purple_account_get_string(account, MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - - if(purple_account_get_bool(account, MW_KEY_FORCE, FALSE) || - !host || (! strcmp(current_host, host)) || - (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL)) { - - /* if we're configured to force logins, or if we're being - redirected to the already configured host, or if we couldn't - connect to the new host, we'll force the login instead */ - - mwSession_forceLogin(session); - } -} - - -static void mw_prpl_set_status(PurpleAccount *acct, PurpleStatus *status); - - -/** called from mw_session_stateChange when the session's state is - mwSession_STARTED. Any finalizing of start-up stuff should go - here */ -static void session_started(struct mwPurplePluginData *pd) { - PurpleStatus *status; - PurpleAccount *acct; - - /* set out initial status */ - acct = purple_connection_get_account(pd->gc); - status = purple_account_get_active_status(acct); - mw_prpl_set_status(acct, status); - - /* start watching for new conversations */ - purple_signal_connect(purple_conversations_get_handle(), - "conversation-created", pd, - PURPLE_CALLBACK(conversation_created_cb), pd); - - /* watch for group extended menu items */ - purple_signal_connect(purple_blist_get_handle(), - "blist-node-extended-menu", pd, - PURPLE_CALLBACK(blist_node_menu_cb), pd); - - /* use our services to do neat things */ - services_starting(pd); -} - - -static void session_stopping(struct mwPurplePluginData *pd) { - /* stop watching the signals from session_started */ - purple_signals_disconnect_by_handle(pd); -} - - -static void mw_session_stateChange(struct mwSession *session, - enum mwSessionState state, - gpointer info) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - const char *msg = NULL; - - pd = mwSession_getClientData(session); - gc = pd->gc; - - switch(state) { - case mwSession_STARTING: - msg = _("Sending Handshake"); - purple_connection_update_progress(gc, msg, 2, MW_CONNECT_STEPS); - break; - - case mwSession_HANDSHAKE: - msg = _("Waiting for Handshake Acknowledgement"); - purple_connection_update_progress(gc, msg, 3, MW_CONNECT_STEPS); - break; - - case mwSession_HANDSHAKE_ACK: - msg = _("Handshake Acknowledged, Sending Login"); - purple_connection_update_progress(gc, msg, 4, MW_CONNECT_STEPS); - break; - - case mwSession_LOGIN: - msg = _("Waiting for Login Acknowledgement"); - purple_connection_update_progress(gc, msg, 5, MW_CONNECT_STEPS); - break; - - case mwSession_LOGIN_REDIR: - msg = _("Login Redirected"); - purple_connection_update_progress(gc, msg, 6, MW_CONNECT_STEPS); - session_loginRedirect(session, info); - break; - - case mwSession_LOGIN_CONT: - msg = _("Forcing Login"); - purple_connection_update_progress(gc, msg, 7, MW_CONNECT_STEPS); - - case mwSession_LOGIN_ACK: - msg = _("Login Acknowledged"); - purple_connection_update_progress(gc, msg, 8, MW_CONNECT_STEPS); - break; - - case mwSession_STARTED: - msg = _("Starting Services"); - purple_connection_update_progress(gc, msg, 9, MW_CONNECT_STEPS); - - session_started(pd); - - msg = _("Connected"); - purple_connection_update_progress(gc, msg, 10, MW_CONNECT_STEPS); - purple_connection_set_state(gc, PURPLE_CONNECTED); - break; - - case mwSession_STOPPING: - - session_stopping(pd); - - if(GPOINTER_TO_UINT(info) & ERR_FAILURE) { - char *err = mwError(GPOINTER_TO_UINT(info)); - PurpleConnectionError reason; - switch (GPOINTER_TO_UINT(info)) { - case VERSION_MISMATCH: - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - - case USER_RESTRICTED: - case INCORRECT_LOGIN: - case USER_UNREGISTERED: - case GUEST_IN_USE: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - - case ENCRYPT_MISMATCH: - case ERR_ENCRYPT_NO_SUPPORT: - case ERR_NO_COMMON_ENCRYPT: - reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; - break; - - case VERIFICATION_DOWN: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE; - break; - - case MULTI_SERVER_LOGIN: - case MULTI_SERVER_LOGIN2: - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - break; - - default: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - } - purple_connection_error_reason(gc, reason, err); - g_free(err); - } - break; - - case mwSession_STOPPED: - break; - - case mwSession_UNKNOWN: - default: - DEBUG_WARN("session in unknown state\n"); - } -} - - -static void mw_session_setPrivacyInfo(struct mwSession *session) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - struct mwPrivacyInfo *privacy; - GSList *l, **ll; - guint count; - - DEBUG_INFO("privacy information set from server\n"); - - g_return_if_fail(session != NULL); - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - privacy = mwSession_getPrivacyInfo(session); - count = privacy->count; - - ll = (privacy->deny)? &acct->deny: &acct->permit; - for(l = *ll; l; l = l->next) g_free(l->data); - g_slist_free(*ll); - l = *ll = NULL; - - while(count--) { - struct mwUserItem *u = privacy->users + count; - l = g_slist_prepend(l, g_strdup(u->id)); - } - *ll = l; -} - - -static void mw_session_setUserStatus(struct mwSession *session) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - struct mwAwareIdBlock idb = { mwAware_USER, NULL, NULL }; - struct mwUserStatus *stat; - - g_return_if_fail(session != NULL); - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - idb.user = mwSession_getProperty(session, mwSession_AUTH_USER_ID); - stat = mwSession_getUserStatus(session); - - /* trigger an update of our own status if we're in the buddy list */ - mwServiceAware_setStatus(pd->srvc_aware, &idb, stat); -} - - -static void mw_session_admin(struct mwSession *session, - const char *text) { - PurpleConnection *gc; - PurpleAccount *acct; - const char *host; - const char *msg; - char *prim; - - gc = session_to_gc(session); - g_return_if_fail(gc != NULL); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - host = purple_account_get_string(acct, MW_KEY_HOST, NULL); - - msg = _("A Sametime administrator has issued the following announcement" - " on server %s"); - prim = g_strdup_printf(msg, NSTR(host)); - - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, - _("Sametime Administrator Announcement"), - prim, text, NULL, NULL); - - g_free(prim); -} - - -/** called from read_cb, attempts to read available data from sock and - pass it to the session, passing back the return code from the read - call for handling in read_cb */ -static int read_recv(struct mwSession *session, int sock) { - guchar buf[BUF_LEN]; - int len; - - len = read(sock, buf, BUF_LEN); - if(len > 0) { - mwSession_recv(session, buf, len); - } - - return len; -} - - -/** callback triggered from purple_input_add, watches the socked for - available data to be processed by the session */ -static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { - struct mwPurplePluginData *pd = data; - int ret = 0, err = 0; - - g_return_if_fail(pd != NULL); - - ret = read_recv(pd->session, pd->socket); - - /* normal operation ends here */ - if(ret > 0) return; - - /* fetch the global error value */ - err = errno; - - /* read problem occurred if we're here, so we'll need to take care of - it and clean up internal state */ - - if(pd->socket) { - close(pd->socket); - pd->socket = 0; - } - - if(pd->gc->inpa) { - purple_input_remove(pd->gc->inpa); - pd->gc->inpa = 0; - } - - if(! ret) { - DEBUG_INFO("connection reset\n"); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - - } else if(ret < 0) { - const gchar *err_str = g_strerror(err); - char *msg = NULL; - - DEBUG_INFO("error in read callback: %s\n", err_str); - - msg = g_strdup_printf(_("Lost connection with server: %s"), err_str); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - msg); - g_free(msg); - } -} - - -/** Callback passed to purple_proxy_connect when an account is logged - in, and if the session logging in receives a redirect message */ -static void connect_cb(gpointer data, gint source, const gchar *error_message) { - - struct mwPurplePluginData *pd = data; - PurpleConnection *gc = pd->gc; - - if(source < 0) { - /* connection failed */ - - if(pd->socket) { - /* this is a redirect connect, force login on existing socket */ - mwSession_forceLogin(pd->session); - - } else { - /* this is a regular connect, error out */ - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - } - - return; - } - - if(pd->socket) { - /* stop any existing login attempt */ - mwSession_stop(pd->session, ERR_SUCCESS); - } - - pd->socket = source; - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, - read_cb, pd); - - mwSession_start(pd->session); -} - - -static void mw_session_announce(struct mwSession *s, - struct mwLoginInfo *from, - gboolean may_reply, - const char *text) { - struct mwPurplePluginData *pd; - PurpleAccount *acct; - PurpleConversation *conv; - PurpleBuddy *buddy; - char *who = from->user_id; - char *msg; - - pd = mwSession_getClientData(s); - acct = purple_connection_get_account(pd->gc); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, acct); - if(! conv) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, who); - - buddy = purple_find_buddy(acct, who); - if(buddy) who = (char *) purple_buddy_get_contact_alias(buddy); - - who = g_strdup_printf(_("Announcement from %s"), who); - msg = purple_markup_linkify(text); - - purple_conversation_write(conv, who, msg ? msg : "", PURPLE_MESSAGE_RECV, time(NULL)); - g_free(who); - g_free(msg); -} - - -static struct mwSessionHandler mw_session_handler = { - mw_session_io_write, - mw_session_io_close, - mw_session_clear, - mw_session_stateChange, - mw_session_setPrivacyInfo, - mw_session_setUserStatus, - mw_session_admin, - mw_session_announce, -}; - - -static void mw_aware_on_attrib(struct mwServiceAware *srvc, - struct mwAwareAttribute *attrib) { - - ; /** @todo handle server attributes. There may be some stuff we - actually want to look for, but I'm not aware of anything right - now.*/ -} - - -static void mw_aware_clear(struct mwServiceAware *srvc) { - ; /* nothing for now */ -} - - -static struct mwAwareHandler mw_aware_handler = { - mw_aware_on_attrib, - mw_aware_clear, -}; - - -static struct mwServiceAware *mw_srvc_aware_new(struct mwSession *s) { - struct mwServiceAware *srvc; - srvc = mwServiceAware_new(s, &mw_aware_handler); - return srvc; -}; - - -static void mw_conf_invited(struct mwConference *conf, - struct mwLoginInfo *inviter, - const char *invitation) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - char *c_inviter, *c_name, *c_topic, *c_invitation; - GHashTable *ht; - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - c_inviter = g_strdup(inviter->user_id); - g_hash_table_insert(ht, CHAT_KEY_CREATOR, c_inviter); - - c_name = g_strdup(mwConference_getName(conf)); - g_hash_table_insert(ht, CHAT_KEY_NAME, c_name); - - c_topic = g_strdup(mwConference_getTitle(conf)); - g_hash_table_insert(ht, CHAT_KEY_TOPIC, c_topic); - - c_invitation = g_strdup(invitation); - g_hash_table_insert(ht, CHAT_KEY_INVITE, c_invitation); - - DEBUG_INFO("received invitation from '%s' to join ('%s','%s'): '%s'\n", - NSTR(c_inviter), NSTR(c_name), - NSTR(c_topic), NSTR(c_invitation)); - - if(! c_topic) c_topic = "(no title)"; - if(! c_invitation) c_invitation = "(no message)"; - serv_got_chat_invite(gc, c_topic, c_inviter, c_invitation, ht); -} - - -/* The following mess helps us relate a mwConference to a PurpleConvChat - in the various forms by which either may be indicated */ - -#define CONF_TO_ID(conf) (GPOINTER_TO_INT(conf)) -#define ID_TO_CONF(pd, id) (conf_find_by_id((pd), (id))) - -#define CHAT_TO_ID(chat) (purple_conv_chat_get_id(chat)) -#define ID_TO_CHAT(id) (purple_find_chat(id)) - -#define CHAT_TO_CONF(pd, chat) (ID_TO_CONF((pd), CHAT_TO_ID(chat))) -#define CONF_TO_CHAT(conf) (ID_TO_CHAT(CONF_TO_ID(conf))) - - -static struct mwConference * -conf_find_by_id(struct mwPurplePluginData *pd, int id) { - - struct mwServiceConference *srvc = pd->srvc_conf; - struct mwConference *conf = NULL; - GList *l, *ll; - - ll = mwServiceConference_getConferences(srvc); - for(l = ll; l; l = l->next) { - struct mwConference *c = l->data; - PurpleConvChat *h = mwConference_getClientData(c); - - if(CHAT_TO_ID(h) == id) { - conf = c; - break; - } - } - g_list_free(ll); - - return conf; -} - - -static void mw_conf_opened(struct mwConference *conf, GList *members) { - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *g_conf; - - const char *n = mwConference_getName(conf); - const char *t = mwConference_getTitle(conf); - - DEBUG_INFO("conf %s opened, %u initial members\n", - NSTR(n), g_list_length(members)); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - if(! t) t = "(no title)"; - g_conf = serv_got_joined_chat(gc, CONF_TO_ID(conf), t); - - mwConference_setClientData(conf, PURPLE_CONV_CHAT(g_conf), NULL); - - for(; members; members = members->next) { - struct mwLoginInfo *peer = members->data; - purple_conv_chat_add_user(PURPLE_CONV_CHAT(g_conf), peer->user_id, - NULL, PURPLE_CBFLAGS_NONE, FALSE); - } -} - - -static void mw_conf_closed(struct mwConference *conf, guint32 reason) { - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - const char *n = mwConference_getName(conf); - char *msg = mwError(reason); - - DEBUG_INFO("conf %s closed, 0x%08x\n", NSTR(n), reason); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - serv_got_chat_left(gc, CONF_TO_ID(conf)); - - purple_notify_error(gc, _("Conference Closed"), NULL, msg); - g_free(msg); -} - - -static void mw_conf_peer_joined(struct mwConference *conf, - struct mwLoginInfo *peer) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConvChat *g_conf; - - const char *n = mwConference_getName(conf); - - DEBUG_INFO("%s joined conf %s\n", NSTR(peer->user_id), NSTR(n)); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - g_conf = mwConference_getClientData(conf); - g_return_if_fail(g_conf != NULL); - - purple_conv_chat_add_user(g_conf, peer->user_id, - NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - - -static void mw_conf_peer_parted(struct mwConference *conf, - struct mwLoginInfo *peer) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConvChat *g_conf; - - const char *n = mwConference_getName(conf); - - DEBUG_INFO("%s left conf %s\n", NSTR(peer->user_id), NSTR(n)); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - g_conf = mwConference_getClientData(conf); - g_return_if_fail(g_conf != NULL); - - purple_conv_chat_remove_user(g_conf, peer->user_id, NULL); -} - - -static void mw_conf_text(struct mwConference *conf, - struct mwLoginInfo *who, const char *text) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - char *esc; - - if(! text) return; - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - esc = g_markup_escape_text(text, -1); - serv_got_chat_in(gc, CONF_TO_ID(conf), who->user_id, 0, esc, time(NULL)); - g_free(esc); -} - - -static void mw_conf_typing(struct mwConference *conf, - struct mwLoginInfo *who, gboolean typing) { - - /* purple really has no good way to expose this to the user. */ - - const char *n = mwConference_getName(conf); - const char *w = who->user_id; - - if(typing) { - DEBUG_INFO("%s in conf %s: \n", NSTR(w), NSTR(n)); - - } else { - DEBUG_INFO("%s in conf %s: \n", NSTR(w), NSTR(n)); - } -} - - -static void mw_conf_clear(struct mwServiceConference *srvc) { - ; -} - - -static struct mwConferenceHandler mw_conference_handler = { - mw_conf_invited, - mw_conf_opened, - mw_conf_closed, - mw_conf_peer_joined, - mw_conf_peer_parted, - mw_conf_text, - mw_conf_typing, - mw_conf_clear, -}; - - -static struct mwServiceConference *mw_srvc_conf_new(struct mwSession *s) { - struct mwServiceConference *srvc; - srvc = mwServiceConference_new(s, &mw_conference_handler); - return srvc; -} - - -/** size of an outgoing file transfer chunk */ -#define MW_FT_LEN (BUF_LONG * 2) - - -static void ft_incoming_cancel(PurpleXfer *xfer) { - /* incoming transfer rejected or canceled in-progress */ - struct mwFileTransfer *ft = xfer->data; - if(ft) mwFileTransfer_reject(ft); -} - - -static void ft_incoming_init(PurpleXfer *xfer) { - /* incoming transfer accepted */ - - /* - accept the mwFileTransfer - - open/create the local FILE "wb" - - stick the FILE's fp in xfer->dest_fp - */ - - struct mwFileTransfer *ft; - FILE *fp; - - ft = xfer->data; - - fp = g_fopen(xfer->local_filename, "wb"); - if(! fp) { - mwFileTransfer_cancel(ft); - return; - } - - xfer->dest_fp = fp; - mwFileTransfer_accept(ft); -} - - -static void mw_ft_offered(struct mwFileTransfer *ft) { - /* - - create a purple ft object - - offer it - */ - - struct mwServiceFileTransfer *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - const char *who; - PurpleXfer *xfer; - - /* @todo add some safety checks */ - srvc = mwFileTransfer_getService(ft); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - acct = purple_connection_get_account(gc); - - who = mwFileTransfer_getUser(ft)->user; - - DEBUG_INFO("file transfer %p offered\n", ft); - DEBUG_INFO(" from: %s\n", NSTR(who)); - DEBUG_INFO(" file: %s\n", NSTR(mwFileTransfer_getFileName(ft))); - DEBUG_INFO(" size: %u\n", mwFileTransfer_getFileSize(ft)); - DEBUG_INFO(" text: %s\n", NSTR(mwFileTransfer_getMessage(ft))); - - xfer = purple_xfer_new(acct, PURPLE_XFER_RECEIVE, who); - if (xfer) - { - purple_xfer_ref(xfer); - mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; - - purple_xfer_set_init_fnc(xfer, ft_incoming_init); - purple_xfer_set_cancel_recv_fnc(xfer, ft_incoming_cancel); - purple_xfer_set_request_denied_fnc(xfer, ft_incoming_cancel); - - purple_xfer_set_filename(xfer, mwFileTransfer_getFileName(ft)); - purple_xfer_set_size(xfer, mwFileTransfer_getFileSize(ft)); - purple_xfer_set_message(xfer, mwFileTransfer_getMessage(ft)); - - purple_xfer_request(xfer); - } -} - - -static void ft_send(struct mwFileTransfer *ft, FILE *fp) { - guchar buf[MW_FT_LEN]; - struct mwOpaque o = { .data = buf, .len = MW_FT_LEN }; - guint32 rem; - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - - rem = mwFileTransfer_getRemaining(ft); - if(rem < MW_FT_LEN) o.len = rem; - - if(fread(buf, (size_t) o.len, 1, fp)) { - - /* calculate progress and display it */ - xfer->bytes_sent += o.len; - xfer->bytes_remaining -= o.len; - purple_xfer_update_progress(xfer); - - mwFileTransfer_send(ft, &o); - - } else { - int err = errno; - DEBUG_WARN("problem reading from file %s: %s\n", - NSTR(mwFileTransfer_getFileName(ft)), g_strerror(err)); - - mwFileTransfer_cancel(ft); - } -} - - -static void mw_ft_opened(struct mwFileTransfer *ft) { - /* - - get purple ft from client data in ft - - set the state to active - */ - - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - - if(! xfer) { - mwFileTransfer_cancel(ft); - mwFileTransfer_free(ft); - g_return_if_reached(); - } - - if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - xfer->dest_fp = g_fopen(xfer->local_filename, "rb"); - ft_send(ft, xfer->dest_fp); - } -} - - -static void mw_ft_closed(struct mwFileTransfer *ft, guint32 code) { - /* - - get purple ft from client data in ft - - indicate rejection/cancelation/completion - - free the file transfer itself - */ - - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - if(xfer) { - xfer->data = NULL; - - if(! mwFileTransfer_getRemaining(ft)) { - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - - } else if(mwFileTransfer_isCancelLocal(ft)) { - /* calling purple_xfer_cancel_local is redundant, since that's - probably what triggered this function to be called */ - ; - - } else if(mwFileTransfer_isCancelRemote(ft)) { - /* steal the reference for the xfer */ - mwFileTransfer_setClientData(ft, NULL, NULL); - purple_xfer_cancel_remote(xfer); - - /* drop the stolen reference */ - purple_xfer_unref(xfer); - return; - } - } - - mwFileTransfer_free(ft); -} - - -static void mw_ft_recv(struct mwFileTransfer *ft, - struct mwOpaque *data) { - /* - - get purple ft from client data in ft - - update transfered percentage - - if done, destroy the ft, disassociate from purple ft - */ - - PurpleXfer *xfer; - FILE *fp; - size_t wc; - - xfer = mwFileTransfer_getClientData(ft); - g_return_if_fail(xfer != NULL); - - fp = xfer->dest_fp; - g_return_if_fail(fp != NULL); - - /* we must collect and save our precious data */ - wc = fwrite(data->data, 1, data->len, fp); - if (wc != data->len) { - DEBUG_ERROR("failed to write data\n"); - purple_xfer_cancel_local(xfer); - return; - } - - /* update the progress */ - xfer->bytes_sent += data->len; - xfer->bytes_remaining -= data->len; - purple_xfer_update_progress(xfer); - - /* let the other side know we got it, and to send some more */ - mwFileTransfer_ack(ft); -} - - -static void mw_ft_ack(struct mwFileTransfer *ft) { - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->watcher == 0); - - if(! mwFileTransfer_getRemaining(ft)) { - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - - } else if(mwFileTransfer_isOpen(ft)) { - ft_send(ft, xfer->dest_fp); - } -} - - -static void mw_ft_clear(struct mwServiceFileTransfer *srvc) { - ; -} - - -static struct mwFileTransferHandler mw_ft_handler = { - mw_ft_offered, - mw_ft_opened, - mw_ft_closed, - mw_ft_recv, - mw_ft_ack, - mw_ft_clear, -}; - - -static struct mwServiceFileTransfer *mw_srvc_ft_new(struct mwSession *s) { - struct mwServiceFileTransfer *srvc; - GHashTable *ft_map; - - ft_map = g_hash_table_new(g_direct_hash, g_direct_equal); - - srvc = mwServiceFileTransfer_new(s, &mw_ft_handler); - mwService_setClientData(MW_SERVICE(srvc), ft_map, - (GDestroyNotify) g_hash_table_destroy); - - return srvc; -} - - -static void convo_data_free(struct convo_data *cd) { - GList *l; - - /* clean the queue */ - for(l = cd->queue; l; l = g_list_delete_link(l, l)) { - struct convo_msg *m = l->data; - if(m->clear) m->clear(m->data); - g_free(m); - } - - g_free(cd); -} - - -/** allocates a convo_data structure and associates it with the - conversation in the client data slot */ -static void convo_data_new(struct mwConversation *conv) { - struct convo_data *cd; - - g_return_if_fail(conv != NULL); - - if(mwConversation_getClientData(conv)) - return; - - cd = g_new0(struct convo_data, 1); - cd->conv = conv; - - mwConversation_setClientData(conv, cd, (GDestroyNotify) convo_data_free); -} - - -static PurpleConversation *convo_get_gconv(struct mwConversation *conv) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - - struct mwIdBlock *idb; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - acct = purple_connection_get_account(gc); - - idb = mwConversation_getTarget(conv); - - return purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - idb->user, acct); -} - - -static void convo_queue(struct mwConversation *conv, - enum mwImSendType type, gconstpointer data) { - - struct convo_data *cd; - struct convo_msg *m; - - convo_data_new(conv); - cd = mwConversation_getClientData(conv); - - m = g_new0(struct convo_msg, 1); - m->type = type; - - switch(type) { - case mwImSend_PLAIN: - m->data = g_strdup(data); - m->clear = g_free; - break; - - case mwImSend_TYPING: - default: - m->data = (gpointer) data; - m->clear = NULL; - } - - cd->queue = g_list_append(cd->queue, m); -} - - -/* Does what it takes to get an error displayed for a conversation */ -static void convo_error(struct mwConversation *conv, guint32 err) { - PurpleConversation *gconv; - char *tmp, *text; - struct mwIdBlock *idb; - - idb = mwConversation_getTarget(conv); - - tmp = mwError(err); - text = g_strconcat(_("Unable to send message: "), tmp, NULL); - - gconv = convo_get_gconv(conv); - if(gconv && !purple_conv_present_error(idb->user, gconv->account, text)) { - - g_free(text); - text = g_strdup_printf(_("Unable to send message to %s:"), - (idb->user)? idb->user: "(unknown)"); - purple_notify_error(purple_account_get_connection(gconv->account), - NULL, text, tmp); - } - - g_free(tmp); - g_free(text); -} - - -static void convo_queue_send(struct mwConversation *conv) { - struct convo_data *cd; - GList *l; - - cd = mwConversation_getClientData(conv); - - for(l = cd->queue; l; l = g_list_delete_link(l, l)) { - struct convo_msg *m = l->data; - - mwConversation_send(conv, m->type, m->data); - - if(m->clear) m->clear(m->data); - g_free(m); - } - - cd->queue = NULL; -} - - -/** called when a mw conversation leaves a purple conversation to - inform the purple conversation that it's unsafe to offer any *cool* - features. */ -static void convo_nofeatures(struct mwConversation *conv) { - PurpleConversation *gconv; - PurpleConnection *gc; - - gconv = convo_get_gconv(conv); - if(! gconv) return; - - gc = purple_conversation_get_gc(gconv); - if(! gc) return; - - purple_conversation_set_features(gconv, gc->flags); -} - - -/** called when a mw conversation and purple conversation come together, - to inform the purple conversation of what features to offer the - user */ -static void convo_features(struct mwConversation *conv) { - PurpleConversation *gconv; - PurpleConnectionFlags feat; - - gconv = convo_get_gconv(conv); - if(! gconv) return; - - feat = purple_conversation_get_features(gconv); - - if(mwConversation_isOpen(conv)) { - if(mwConversation_supports(conv, mwImSend_HTML)) { - feat |= PURPLE_CONNECTION_HTML; - } else { - feat &= ~PURPLE_CONNECTION_HTML; - } - - if(mwConversation_supports(conv, mwImSend_MIME)) { - feat &= ~PURPLE_CONNECTION_NO_IMAGES; - } else { - feat |= PURPLE_CONNECTION_NO_IMAGES; - } - - DEBUG_INFO("conversation features set to 0x%04x\n", feat); - purple_conversation_set_features(gconv, feat); - - } else { - convo_nofeatures(conv); - } -} - - -static void mw_conversation_opened(struct mwConversation *conv) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - - struct convo_dat *cd; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - acct = purple_connection_get_account(gc); - - /* set up the queue */ - cd = mwConversation_getClientData(conv); - if(cd) { - convo_queue_send(conv); - - if(! convo_get_gconv(conv)) { - mwConversation_free(conv); - return; - } - - } else { - convo_data_new(conv); - } - - { /* record the client key for the buddy */ - PurpleBuddy *buddy; - struct mwLoginInfo *info; - info = mwConversation_getTargetInfo(conv); - - buddy = purple_find_buddy(acct, info->user_id); - if(buddy) { - purple_blist_node_set_int((PurpleBlistNode *) buddy, - BUDDY_KEY_CLIENT, info->type); - } - } - - convo_features(conv); -} - - -static void mw_conversation_closed(struct mwConversation *conv, - guint32 reason) { - - struct convo_data *cd; - - g_return_if_fail(conv != NULL); - - /* if there's an error code and a non-typing message in the queue, - print an error message to the conversation */ - cd = mwConversation_getClientData(conv); - if(reason && cd && cd->queue) { - GList *l; - for(l = cd->queue; l; l = l->next) { - struct convo_msg *m = l->data; - if(m->type != mwImSend_TYPING) { - convo_error(conv, reason); - break; - } - } - } - -#if 0 - /* don't do this, to prevent the occasional weird sending of - formatted messages as plaintext when the other end closes the - conversation after we've begun composing the message */ - convo_nofeatures(conv); -#endif - - mwConversation_removeClientData(conv); -} - - -static void im_recv_text(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *msg) { - - struct mwIdBlock *idb; - char *txt, *esc; - const char *t; - - idb = mwConversation_getTarget(conv); - - txt = purple_utf8_try_convert(msg); - t = txt? txt: msg; - - esc = g_markup_escape_text(t, -1); - serv_got_im(pd->gc, idb->user, esc, 0, time(NULL)); - g_free(esc); - - g_free(txt); -} - - -static void im_recv_typing(struct mwConversation *conv, - struct mwPurplePluginData *pd, - gboolean typing) { - - struct mwIdBlock *idb; - idb = mwConversation_getTarget(conv); - - serv_got_typing(pd->gc, idb->user, 0, - typing? PURPLE_TYPING: PURPLE_NOT_TYPING); -} - - -static void im_recv_html(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *msg) { - struct mwIdBlock *idb; - char *t1, *t2; - const char *t; - - idb = mwConversation_getTarget(conv); - - /* ensure we're receiving UTF8 */ - t1 = purple_utf8_try_convert(msg); - t = t1? t1: msg; - - /* convert entities to UTF8 so they'll log correctly */ - t2 = purple_utf8_ncr_decode(t); - t = t2? t2: t; - - serv_got_im(pd->gc, idb->user, t, 0, time(NULL)); - - g_free(t1); - g_free(t2); -} - - -static void im_recv_subj(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *subj) { - - /** @todo somehow indicate receipt of a conversation subject. It - would also be nice if we added a /topic command for the - protocol */ - ; -} - - -/** generate "cid:908@20582notesbuddy" from "<908@20582notesbuddy>" */ -static char *make_cid(const char *cid) { - gsize n; - char *c, *d; - - g_return_val_if_fail(cid != NULL, NULL); - - n = strlen(cid); - g_return_val_if_fail(n > 2, NULL); - - c = g_strndup(cid+1, n-2); - d = g_strdup_printf("cid:%s", c); - - g_free(c); - return d; -} - - -static void im_recv_mime(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *data) { - - GHashTable *img_by_cid; - GList *images; - - GString *str; - - PurpleMimeDocument *doc; - GList *parts; - - img_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - images = NULL; - - /* don't want the contained string to ever be NULL */ - str = g_string_new(""); - - doc = purple_mime_document_parse(data); - - /* handle all the MIME parts */ - parts = purple_mime_document_get_parts(doc); - for(; parts; parts = parts->next) { - PurpleMimePart *part = parts->data; - const char *type; - - type = purple_mime_part_get_field(part, "content-type"); - DEBUG_INFO("MIME part Content-Type: %s\n", NSTR(type)); - - if(! type) { - ; /* feh */ - - } else if(purple_str_has_prefix(type, "image")) { - /* put images into the image store */ - - guchar *d_dat; - gsize d_len; - char *cid; - int img; - - /* obtain and unencode the data */ - purple_mime_part_get_data_decoded(part, &d_dat, &d_len); - - /* look up the content id */ - cid = (char *) purple_mime_part_get_field(part, "Content-ID"); - cid = make_cid(cid); - - /* add image to the purple image store */ - img = purple_imgstore_add_with_id(d_dat, d_len, cid); - - /* map the cid to the image store identifier */ - g_hash_table_insert(img_by_cid, cid, GINT_TO_POINTER(img)); - - /* recall the image for dereferencing later */ - images = g_list_append(images, GINT_TO_POINTER(img)); - - } else if(purple_str_has_prefix(type, "text")) { - - /* concatenate all the text parts together */ - guchar *data; - gsize len; - - purple_mime_part_get_data_decoded(part, &data, &len); - g_string_append(str, (const char *)data); - g_free(data); - } - } - - purple_mime_document_free(doc); - - /* @todo should put this in its own function */ - { /* replace each IMG tag's SRC attribute with an ID attribute. This - actually modifies the contents of str */ - GData *attribs; - char *start, *end; - char *tmp = str->str; - - while(*tmp && purple_markup_find_tag("img", tmp, (const char **) &start, - (const char **) &end, &attribs)) { - - char *alt, *align, *border, *src; - int img = 0; - - alt = g_datalist_get_data(&attribs, "alt"); - align = g_datalist_get_data(&attribs, "align"); - border = g_datalist_get_data(&attribs, "border"); - src = g_datalist_get_data(&attribs, "src"); - - if(src) - img = GPOINTER_TO_INT(g_hash_table_lookup(img_by_cid, src)); - - if(img) { - GString *atstr; - gsize len = (end - start); - gsize mov; - - atstr = g_string_new(""); - if(alt) g_string_append_printf(atstr, " alt=\"%s\"", alt); - if(align) g_string_append_printf(atstr, " align=\"%s\"", align); - if(border) g_string_append_printf(atstr, " border=\"%s\"", border); - - mov = g_snprintf(start, len, "str, img); - while(mov < len) start[mov++] = ' '; - - g_string_free(atstr, TRUE); - } - - g_datalist_clear(&attribs); - tmp = end + 1; - } - } - - im_recv_html(conv, pd, str->str); - - g_string_free(str, TRUE); - - /* clean up the cid table */ - g_hash_table_destroy(img_by_cid); - - /* dereference all the imgages */ - while(images) { - purple_imgstore_unref_by_id(GPOINTER_TO_INT(images->data)); - images = g_list_delete_link(images, images); - } -} - - -static void mw_conversation_recv(struct mwConversation *conv, - enum mwImSendType type, - gconstpointer msg) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - - switch(type) { - case mwImSend_PLAIN: - im_recv_text(conv, pd, msg); - break; - - case mwImSend_TYPING: - im_recv_typing(conv, pd, !! msg); - break; - - case mwImSend_HTML: - im_recv_html(conv, pd, msg); - break; - - case mwImSend_SUBJECT: - im_recv_subj(conv, pd, msg); - break; - - case mwImSend_MIME: - im_recv_mime(conv, pd, msg); - break; - - default: - DEBUG_INFO("conversation received strange type, 0x%04x\n", type); - ; /* erm... */ - } -} - - -static void mw_place_invite(struct mwConversation *conv, - const char *message, - const char *title, const char *name) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - - struct mwIdBlock *idb; - GHashTable *ht; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - - idb = mwConversation_getTarget(conv); - - ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_insert(ht, CHAT_KEY_CREATOR, g_strdup(idb->user)); - g_hash_table_insert(ht, CHAT_KEY_NAME, g_strdup(name)); - g_hash_table_insert(ht, CHAT_KEY_TOPIC, g_strdup(title)); - g_hash_table_insert(ht, CHAT_KEY_INVITE, g_strdup(message)); - g_hash_table_insert(ht, CHAT_KEY_IS_PLACE, g_strdup("")); /* ugh */ - - if(! title) title = "(no title)"; - if(! message) message = "(no message)"; - serv_got_chat_invite(pd->gc, title, idb->user, message, ht); - - mwConversation_close(conv, ERR_SUCCESS); - mwConversation_free(conv); -} - - -static void mw_im_clear(struct mwServiceIm *srvc) { - ; -} - - -static struct mwImHandler mw_im_handler = { - mw_conversation_opened, - mw_conversation_closed, - mw_conversation_recv, - mw_place_invite, - mw_im_clear, -}; - - -static struct mwServiceIm *mw_srvc_im_new(struct mwSession *s) { - struct mwServiceIm *srvc; - srvc = mwServiceIm_new(s, &mw_im_handler); - mwServiceIm_setClientType(srvc, mwImClient_NOTESBUDDY); - return srvc; -} - - -/* The following helps us relate a mwPlace to a PurpleConvChat in the - various forms by which either may be indicated. Uses some of - the similar macros from the conference service above */ - -#define PLACE_TO_ID(place) (GPOINTER_TO_INT(place)) -#define ID_TO_PLACE(pd, id) (place_find_by_id((pd), (id))) - -#define CHAT_TO_PLACE(pd, chat) (ID_TO_PLACE((pd), CHAT_TO_ID(chat))) -#define PLACE_TO_CHAT(place) (ID_TO_CHAT(PLACE_TO_ID(place))) - - -static struct mwPlace * -place_find_by_id(struct mwPurplePluginData *pd, int id) { - struct mwServicePlace *srvc = pd->srvc_place; - struct mwPlace *place = NULL; - GList *l; - - l = (GList *) mwServicePlace_getPlaces(srvc); - for(; l; l = l->next) { - struct mwPlace *p = l->data; - PurpleConvChat *h = PURPLE_CONV_CHAT(mwPlace_getClientData(p)); - - if(CHAT_TO_ID(h) == id) { - place = p; - break; - } - } - - return place; -} - - -static void mw_place_opened(struct mwPlace *place) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *gconf; - - GList *members, *l; - - const char *n = mwPlace_getName(place); - const char *t = mwPlace_getTitle(place); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - members = mwPlace_getMembers(place); - - DEBUG_INFO("place %s opened, %u initial members\n", - NSTR(n), g_list_length(members)); - - if(! t) t = "(no title)"; - gconf = serv_got_joined_chat(gc, PLACE_TO_ID(place), t); - - mwPlace_setClientData(place, gconf, NULL); - - for(l = members; l; l = l->next) { - struct mwIdBlock *idb = l->data; - purple_conv_chat_add_user(PURPLE_CONV_CHAT(gconf), idb->user, - NULL, PURPLE_CBFLAGS_NONE, FALSE); - } - g_list_free(members); -} - - -static void mw_place_closed(struct mwPlace *place, guint32 code) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - const char *n = mwPlace_getName(place); - char *msg = mwError(code); - - DEBUG_INFO("place %s closed, 0x%08x\n", NSTR(n), code); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - serv_got_chat_left(gc, PLACE_TO_ID(place)); - - purple_notify_error(gc, _("Place Closed"), NULL, msg); - g_free(msg); -} - - -static void mw_place_peerJoined(struct mwPlace *place, - const struct mwIdBlock *peer) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *gconf; - - const char *n = mwPlace_getName(place); - - DEBUG_INFO("%s joined place %s\n", NSTR(peer->user), NSTR(n)); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - gconf = mwPlace_getClientData(place); - g_return_if_fail(gconf != NULL); - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(gconf), peer->user, - NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - - -static void mw_place_peerParted(struct mwPlace *place, - const struct mwIdBlock *peer) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *gconf; - - const char *n = mwPlace_getName(place); - - DEBUG_INFO("%s left place %s\n", NSTR(peer->user), NSTR(n)); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - gconf = mwPlace_getClientData(place); - g_return_if_fail(gconf != NULL); - - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(gconf), peer->user, NULL); -} - - -static void mw_place_peerSetAttribute(struct mwPlace *place, - const struct mwIdBlock *peer, - guint32 attr, struct mwOpaque *o) { - ; -} - - -static void mw_place_peerUnsetAttribute(struct mwPlace *place, - const struct mwIdBlock *peer, - guint32 attr) { - ; -} - - -static void mw_place_message(struct mwPlace *place, - const struct mwIdBlock *who, - const char *msg) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - char *esc; - - if(! msg) return; - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - esc = g_markup_escape_text(msg, -1); - serv_got_chat_in(gc, PLACE_TO_ID(place), who->user, 0, esc, time(NULL)); - g_free(esc); -} - - -static void mw_place_clear(struct mwServicePlace *srvc) { - ; -} - - -static struct mwPlaceHandler mw_place_handler = { - mw_place_opened, - mw_place_closed, - mw_place_peerJoined, - mw_place_peerParted, - mw_place_peerSetAttribute, - mw_place_peerUnsetAttribute, - mw_place_message, - mw_place_clear, -}; - - -static struct mwServicePlace *mw_srvc_place_new(struct mwSession *s) { - struct mwServicePlace *srvc; - srvc = mwServicePlace_new(s, &mw_place_handler); - return srvc; -} - - -static struct mwServiceResolve *mw_srvc_resolve_new(struct mwSession *s) { - struct mwServiceResolve *srvc; - srvc = mwServiceResolve_new(s); - return srvc; -} - - -static struct mwServiceStorage *mw_srvc_store_new(struct mwSession *s) { - struct mwServiceStorage *srvc; - srvc = mwServiceStorage_new(s); - return srvc; -} - - -/** allocate and associate a mwPurplePluginData with a PurpleConnection */ -static struct mwPurplePluginData *mwPurplePluginData_new(PurpleConnection *gc) { - struct mwPurplePluginData *pd; - - g_return_val_if_fail(gc != NULL, NULL); - - pd = g_new0(struct mwPurplePluginData, 1); - pd->gc = gc; - pd->session = mwSession_new(&mw_session_handler); - pd->srvc_aware = mw_srvc_aware_new(pd->session); - pd->srvc_conf = mw_srvc_conf_new(pd->session); - pd->srvc_ft = mw_srvc_ft_new(pd->session); - pd->srvc_im = mw_srvc_im_new(pd->session); - pd->srvc_place = mw_srvc_place_new(pd->session); - pd->srvc_resolve = mw_srvc_resolve_new(pd->session); - pd->srvc_store = mw_srvc_store_new(pd->session); - pd->group_list_map = g_hash_table_new(g_direct_hash, g_direct_equal); - pd->sock_buf = purple_circ_buffer_new(0); - - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_aware)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_conf)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_ft)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_im)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_place)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_resolve)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_store)); - - mwSession_addCipher(pd->session, mwCipher_new_RC2_40(pd->session)); - mwSession_addCipher(pd->session, mwCipher_new_RC2_128(pd->session)); - - mwSession_setClientData(pd->session, pd, NULL); - gc->proto_data = pd; - - return pd; -} - - -static void mwPurplePluginData_free(struct mwPurplePluginData *pd) { - g_return_if_fail(pd != NULL); - - pd->gc->proto_data = NULL; - - mwSession_removeService(pd->session, mwService_AWARE); - mwSession_removeService(pd->session, mwService_CONFERENCE); - mwSession_removeService(pd->session, mwService_FILE_TRANSFER); - mwSession_removeService(pd->session, mwService_IM); - mwSession_removeService(pd->session, mwService_PLACE); - mwSession_removeService(pd->session, mwService_RESOLVE); - mwSession_removeService(pd->session, mwService_STORAGE); - - mwService_free(MW_SERVICE(pd->srvc_aware)); - mwService_free(MW_SERVICE(pd->srvc_conf)); - mwService_free(MW_SERVICE(pd->srvc_ft)); - mwService_free(MW_SERVICE(pd->srvc_im)); - mwService_free(MW_SERVICE(pd->srvc_place)); - mwService_free(MW_SERVICE(pd->srvc_resolve)); - mwService_free(MW_SERVICE(pd->srvc_store)); - - mwCipher_free(mwSession_getCipher(pd->session, mwCipher_RC2_40)); - mwCipher_free(mwSession_getCipher(pd->session, mwCipher_RC2_128)); - - mwSession_free(pd->session); - - g_hash_table_destroy(pd->group_list_map); - purple_circ_buffer_destroy(pd->sock_buf); - - g_free(pd); -} - - -static const char *mw_prpl_list_icon(PurpleAccount *a, PurpleBuddy *b) { - /* my little green dude is a chopped up version of the aim running - guy. First, cut off the head and store someplace safe. Then, - take the left-half side of the body and throw it away. Make a - copy of the remaining body, and flip it horizontally. Now attach - the two pieces into an X shape, and drop the head back on the - top, being careful to center it. Then, just change the color - saturation to bring the red down a bit, and voila! */ - - /* then, throw all of that away and use sodipodi to make a new - icon. You know, LIKE A REAL MAN. */ - - return "meanwhile"; -} - - -static const char* mw_prpl_list_emblem(PurpleBuddy *b) -{ - if(buddy_is_external(b)) - return "external"; - - return NULL; -} - - -static char *mw_prpl_status_text(PurpleBuddy *b) { - PurpleConnection *gc; - struct mwPurplePluginData *pd; - struct mwAwareIdBlock t = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; - const char *ret = NULL; - - if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) - ret = mwServiceAware_getText(pd->srvc_aware, &t); - - return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; -} - - -static const char *status_text(PurpleBuddy *b) { - PurplePresence *presence; - PurpleStatus *status; - - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - - return purple_status_get_name(status); -} - - -static gboolean user_supports(struct mwServiceAware *srvc, - const char *who, guint32 feature) { - - const struct mwAwareAttribute *attr; - struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; - - attr = mwServiceAware_getAttribute(srvc, &idb, feature); - return (attr != NULL) && mwAwareAttribute_asBoolean(attr); -} - - -static char *user_supports_text(struct mwServiceAware *srvc, const char *who) { - const char *feat[] = {NULL, NULL, NULL, NULL, NULL}; - const char **f = feat; - - if(user_supports(srvc, who, mwAttribute_AV_PREFS_SET)) { - gboolean mic, speak, video; - - mic = user_supports(srvc, who, mwAttribute_MICROPHONE); - speak = user_supports(srvc, who, mwAttribute_SPEAKERS); - video = user_supports(srvc, who, mwAttribute_VIDEO_CAMERA); - - if(mic) *f++ = _("Microphone"); - if(speak) *f++ = _("Speakers"); - if(video) *f++ = _("Video Camera"); - } - - if(user_supports(srvc, who, mwAttribute_FILE_TRANSFER)) - *f++ = _("File Transfer"); - - return (*feat)? g_strjoinv(", ", (char **)feat): NULL; - /* jenni loves siege */ -} - - -static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { - PurpleConnection *gc; - struct mwPurplePluginData *pd = NULL; - struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; - - const char *message = NULL; - const char *status; - char *tmp; - - if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) - message = mwServiceAware_getText(pd->srvc_aware, &idb); - - status = status_text(b); - - if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) { - tmp = g_markup_escape_text(message, -1); - purple_notify_user_info_add_pair(user_info, status, tmp); - g_free(tmp); - - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), status); - } - - if(full && pd != NULL) { - tmp = user_supports_text(pd->srvc_aware, purple_buddy_get_name(b)); - if(tmp) { - purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); - g_free(tmp); - } - - if(buddy_is_external(b)) { - purple_notify_user_info_add_pair(user_info, NULL, _("External User")); - } - } -} - -static GList *mw_prpl_status_types(PurpleAccount *acct) -{ - GList *types = NULL; - PurpleStatusType *type; - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - MW_STATE_ACTIVE, NULL, TRUE, TRUE, FALSE, - MW_STATE_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - MW_STATE_AWAY, NULL, TRUE, TRUE, FALSE, - MW_STATE_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - MW_STATE_BUSY, _("Do Not Disturb"), TRUE, TRUE, FALSE, - MW_STATE_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - MW_STATE_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - - -static void conf_create_prompt_cancel(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - ; /* nothing to do */ -} - - -static void conf_create_prompt_join(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - PurpleAccount *acct; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - struct mwServiceConference *srvc; - - PurpleRequestField *f; - - const char *topic, *invite; - struct mwConference *conf; - struct mwIdBlock idb = { NULL, NULL }; - - acct = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(acct); - pd = gc->proto_data; - srvc = pd->srvc_conf; - - f = purple_request_fields_get_field(fields, CHAT_KEY_TOPIC); - topic = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, CHAT_KEY_INVITE); - invite = purple_request_field_string_get_value(f); - - conf = mwConference_new(srvc, topic); - mwConference_open(conf); - - idb.user = (char *)purple_buddy_get_name(buddy); - mwConference_invite(conf, &idb, invite); -} - - -static void blist_menu_conf_create(PurpleBuddy *buddy, const char *msg) { - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - - PurpleAccount *acct; - PurpleConnection *gc; - - const char *msgA; - const char *msgB; - char *msg1; - - g_return_if_fail(buddy != NULL); - - acct = purple_buddy_get_account(buddy); - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, g); - - f = purple_request_field_string_new(CHAT_KEY_TOPIC, _("Topic"), NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new(CHAT_KEY_INVITE, _("Message"), msg, FALSE); - purple_request_field_group_add_field(g, f); - - msgA = _("Create conference with user"); - msgB = _("Please enter a topic for the new conference, and an invitation" - " message to be sent to %s"); - msg1 = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); - - purple_request_fields(gc, _("New Conference"), - msgA, msg1, fields, - _("Create"), G_CALLBACK(conf_create_prompt_join), - _("Cancel"), G_CALLBACK(conf_create_prompt_cancel), - acct, purple_buddy_get_name(buddy), NULL, - buddy); - g_free(msg1); -} - - -static void conf_select_prompt_cancel(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - ; -} - - -static void conf_select_prompt_invite(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - PurpleRequestField *f; - GList *l; - const char *msg; - - f = purple_request_fields_get_field(fields, CHAT_KEY_INVITE); - msg = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "conf"); - l = purple_request_field_list_get_selected(f); - - if(l) { - gpointer d = purple_request_field_list_get_data(f, l->data); - - if(GPOINTER_TO_INT(d) == 0x01) { - blist_menu_conf_create(buddy, msg); - - } else { - struct mwIdBlock idb = { (char *)purple_buddy_get_name(buddy), NULL }; - mwConference_invite(d, &idb, msg); - } - } -} - - -static void blist_menu_conf_list(PurpleBuddy *buddy, - GList *confs) { - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - - PurpleAccount *acct; - PurpleConnection *gc; - - const char *msgA; - const char *msgB; - char *msg; - - acct = purple_buddy_get_account(buddy); - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, g); - - f = purple_request_field_list_new("conf", _("Available Conferences")); - purple_request_field_list_set_multi_select(f, FALSE); - for(; confs; confs = confs->next) { - struct mwConference *c = confs->data; - purple_request_field_list_add(f, mwConference_getTitle(c), c); - } - purple_request_field_list_add(f, _("Create New Conference..."), - GINT_TO_POINTER(0x01)); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new(CHAT_KEY_INVITE, "Message", NULL, FALSE); - purple_request_field_group_add_field(g, f); - - msgA = _("Invite user to a conference"); - msgB = _("Select a conference from the list below to send an invite to" - " user %s. Select \"Create New Conference\" if you'd like to" - " create a new conference to invite this user to."); - msg = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); - - purple_request_fields(gc, _("Invite to Conference"), - msgA, msg, fields, - _("Invite"), G_CALLBACK(conf_select_prompt_invite), - _("Cancel"), G_CALLBACK(conf_select_prompt_cancel), - acct, purple_buddy_get_name(buddy), NULL, - buddy); - g_free(msg); -} - - -static void blist_menu_conf(PurpleBlistNode *node, gpointer data) { - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleAccount *acct; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - GList *l; - - g_return_if_fail(node != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - acct = purple_buddy_get_account(buddy); - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* - - get a list of all conferences on this session - - if none, prompt to create one, and invite buddy to it - - else, prompt to select a conference or create one - */ - - l = mwServiceConference_getConferences(pd->srvc_conf); - if(l) { - blist_menu_conf_list(buddy, l); - g_list_free(l); - - } else { - blist_menu_conf_create(buddy, NULL); - } -} - - -#if 0 -static void blist_menu_announce(PurpleBlistNode *node, gpointer data) { - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleAccount *acct; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - struct mwSession *session; - char *rcpt_name; - GList *rcpt; - - g_return_if_fail(node != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - acct = buddy->account; - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - rcpt_name = g_strdup_printf("@U %s", buddy->name); - rcpt = g_list_prepend(NULL, rcpt_name); - - session = pd->session; - mwSession_sendAnnounce(session, FALSE, - "This is a TEST announcement. Please ignore.", - rcpt); - - g_list_free(rcpt); - g_free(rcpt_name); -} -#endif - - -static GList *mw_prpl_blist_node_menu(PurpleBlistNode *node) { - GList *l = NULL; - PurpleMenuAction *act; - - if(! PURPLE_BLIST_NODE_IS_BUDDY(node)) - return l; - - l = g_list_append(l, NULL); - - act = purple_menu_action_new(_("Invite to Conference..."), - PURPLE_CALLBACK(blist_menu_conf), NULL, NULL); - l = g_list_append(l, act); - -#if 0 - act = purple_menu_action_new(_("Send TEST Announcement"), - PURPLE_CALLBACK(blist_menu_announce), NULL, NULL); - l = g_list_append(l, act); -#endif - - /** note: this never gets called for a PurpleGroup, have to use the - blist-node-extended-menu signal for that. The function - blist_node_menu_cb is assigned to this signal in the function - services_starting */ - - return l; -} - - -static GList *mw_prpl_chat_info(PurpleConnection *gc) { - GList *l = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Topic:"); - pce->identifier = CHAT_KEY_TOPIC; - l = g_list_append(l, pce); - - return l; -} - - -static GHashTable *mw_prpl_chat_info_defaults(PurpleConnection *gc, - const char *name) { - GHashTable *table; - - g_return_val_if_fail(gc != NULL, NULL); - - table = g_hash_table_new_full(g_str_hash, g_str_equal, - NULL, g_free); - - g_hash_table_insert(table, CHAT_KEY_NAME, g_strdup(name)); - g_hash_table_insert(table, CHAT_KEY_INVITE, NULL); - - return table; -} - - -static void mw_prpl_login(PurpleAccount *acct); - - -static void prompt_host_cancel_cb(PurpleConnection *gc) { - const char *msg = _("No Sametime Community Server specified"); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - msg); -} - - -static void prompt_host_ok_cb(PurpleConnection *gc, const char *host) { - if(host && *host) { - PurpleAccount *acct = purple_connection_get_account(gc); - purple_account_set_string(acct, MW_KEY_HOST, host); - mw_prpl_login(acct); - - } else { - prompt_host_cancel_cb(gc); - } -} - - -static void prompt_host(PurpleConnection *gc) { - PurpleAccount *acct; - const char *msgA; - char *msg; - - acct = purple_connection_get_account(gc); - msgA = _("No host or IP address has been configured for the" - " Meanwhile account %s. Please enter one below to" - " continue logging in."); - msg = g_strdup_printf(msgA, NSTR(purple_account_get_username(acct))); - - purple_request_input(gc, _("Meanwhile Connection Setup"), - _("No Sametime Community Server Specified"), msg, - MW_PLUGIN_DEFAULT_HOST, FALSE, FALSE, NULL, - _("Connect"), G_CALLBACK(prompt_host_ok_cb), - _("Cancel"), G_CALLBACK(prompt_host_cancel_cb), - acct, NULL, NULL, - gc); - - g_free(msg); -} - - -static void mw_prpl_login(PurpleAccount *account) { - PurpleConnection *gc; - struct mwPurplePluginData *pd; - - char *user, *pass, *host; - guint port; - - gc = purple_account_get_connection(account); - pd = mwPurplePluginData_new(gc); - - /* while we do support images, the default is to not offer it */ - gc->flags |= PURPLE_CONNECTION_NO_IMAGES; - - user = g_strdup(purple_account_get_username(account)); - - host = strrchr(user, ':'); - if(host) { - /* annoying user split from 1.2.0, need to undo it */ - *host++ = '\0'; - purple_account_set_string(account, MW_KEY_HOST, host); - purple_account_set_username(account, user); - - } else { - host = (char *) purple_account_get_string(account, MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - } - - if(! host || ! *host) { - /* somehow, we don't have a host to connect to. Well, we need one - to actually continue, so let's ask the user directly. */ - g_free(user); - prompt_host(gc); - return; - } - - pass = g_strdup(purple_account_get_password(account)); - port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT); - - DEBUG_INFO("user: '%s'\n", user); - DEBUG_INFO("host: '%s'\n", host); - DEBUG_INFO("port: %u\n", port); - - mwSession_setProperty(pd->session, mwSession_NO_SECRET, - (char *) no_secret, NULL); - mwSession_setProperty(pd->session, mwSession_AUTH_USER_ID, user, g_free); - mwSession_setProperty(pd->session, mwSession_AUTH_PASSWORD, pass, g_free); - - if(purple_account_get_bool(account, MW_KEY_FAKE_IT, FALSE)) { - guint client, major, minor; - - /* if we're faking the login, let's also fake the version we're - reporting. Let's also allow the actual values to be specified */ - - client = purple_account_get_int(account, MW_KEY_CLIENT, mwLogin_BINARY); - major = purple_account_get_int(account, MW_KEY_MAJOR, 0x001e); - minor = purple_account_get_int(account, MW_KEY_MINOR, 0x196f); - - DEBUG_INFO("client id: 0x%04x\n", client); - DEBUG_INFO("client major: 0x%04x\n", major); - DEBUG_INFO("client minor: 0x%04x\n", minor); - - mwSession_setProperty(pd->session, mwSession_CLIENT_TYPE_ID, - GUINT_TO_POINTER(client), NULL); - - mwSession_setProperty(pd->session, mwSession_CLIENT_VER_MAJOR, - GUINT_TO_POINTER(major), NULL); - - mwSession_setProperty(pd->session, mwSession_CLIENT_VER_MINOR, - GUINT_TO_POINTER(minor), NULL); - } - - purple_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS); - - if (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } -} - - -static void mw_prpl_close(PurpleConnection *gc) { - struct mwPurplePluginData *pd; - - g_return_if_fail(gc != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* get rid of the blist save timeout */ - if(pd->save_event) { - purple_timeout_remove(pd->save_event); - pd->save_event = 0; - blist_store(pd); - } - - /* stop the session */ - mwSession_stop(pd->session, 0x00); - - /* no longer necessary */ - gc->proto_data = NULL; - - /* stop watching the socket */ - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; - } - - /* clean up the rest */ - mwPurplePluginData_free(pd); -} - - -static int mw_rand(void) { - static int seed = 0; - - /* for diversity, not security. don't touch */ - srand(time(NULL) ^ seed); - seed = rand(); - - return seed; -} - - -/** generates a random-ish content id string */ -static char *im_mime_content_id(void) { - return g_strdup_printf("%03x@%05xmeanwhile", - mw_rand() & 0xfff, mw_rand() & 0xfffff); -} - - -/** generates a multipart/related content type with a random-ish - boundary value */ -static char *im_mime_content_type(void) { - return g_strdup_printf("multipart/related; boundary=related_MW%03x_%04x", - mw_rand() & 0xfff, mw_rand() & 0xffff); -} - - -/** determine content type from extension. Not so happy about this, - but I don't want to actually write image type detection */ -static char *im_mime_img_content_type(PurpleStoredImage *img) { - const char *fn = purple_imgstore_get_filename(img); - const char *ct = NULL; - - ct = strrchr(fn, '.'); - if(! ct) { - ct = "image"; - - } else if(! strcmp(".png", ct)) { - ct = "image/png"; - - } else if(! strcmp(".jpg", ct)) { - ct = "image/jpeg"; - - } else if(! strcmp(".jpeg", ct)) { - ct = "image/jpeg"; - - } else if(! strcmp(".gif", ct)) { - ct = "image/gif"; - - } else { - ct = "image"; - } - - return g_strdup_printf("%s; name=\"%s\"", ct, fn); -} - - -static char *im_mime_img_content_disp(PurpleStoredImage *img) { - const char *fn = purple_imgstore_get_filename(img); - return g_strdup_printf("attachment; filename=\"%s\"", fn); -} - - -/** turn an IM with embedded images into a multi-part mime document */ -static char *im_mime_convert(PurpleConnection *gc, - struct mwConversation *conv, - const char *message) { - GString *str; - PurpleMimeDocument *doc; - PurpleMimePart *part; - - GData *attr; - char *tmp, *start, *end; - - str = g_string_new(NULL); - - doc = purple_mime_document_new(); - - purple_mime_document_set_field(doc, "Mime-Version", "1.0"); - purple_mime_document_set_field(doc, "Content-Disposition", "inline"); - - tmp = im_mime_content_type(); - purple_mime_document_set_field(doc, "Content-Type", tmp); - g_free(tmp); - - tmp = (char *) message; - while(*tmp && purple_markup_find_tag("img", tmp, (const char **) &start, - (const char **) &end, &attr)) { - char *id; - PurpleStoredImage *img = NULL; - - gsize len = (start - tmp); - - /* append the in-between-tags text */ - if(len) g_string_append_len(str, tmp, len); - - /* find the imgstore data by the id tag */ - id = g_datalist_get_data(&attr, "id"); - if(id && *id) - img = purple_imgstore_find_by_id(atoi(id)); - - if(img) { - char *cid; - gpointer data; - size_t size; - - part = purple_mime_part_new(doc); - - data = im_mime_img_content_disp(img); - purple_mime_part_set_field(part, "Content-Disposition", data); - g_free(data); - - data = im_mime_img_content_type(img); - purple_mime_part_set_field(part, "Content-Type", data); - g_free(data); - - cid = im_mime_content_id(); - data = g_strdup_printf("<%s>", cid); - purple_mime_part_set_field(part, "Content-ID", data); - g_free(data); - - purple_mime_part_set_field(part, "Content-transfer-encoding", "base64"); - - /* obtain and base64 encode the image data, and put it in the - mime part */ - size = purple_imgstore_get_size(img); - data = purple_base64_encode(purple_imgstore_get_data(img), (gsize) size); - purple_mime_part_set_data(part, data); - g_free(data); - - /* append the modified tag */ - g_string_append_printf(str, "", cid); - g_free(cid); - - } else { - /* append the literal image tag, since we couldn't find a - relative imgstore object */ - gsize len = (end - start) + 1; - g_string_append_len(str, start, len); - } - - g_datalist_clear(&attr); - tmp = end + 1; - } - - /* append left-overs */ - g_string_append(str, tmp); - - /* add the text/html part */ - part = purple_mime_part_new(doc); - purple_mime_part_set_field(part, "Content-Disposition", "inline"); - - tmp = purple_utf8_ncr_encode(str->str); - purple_mime_part_set_field(part, "Content-Type", "text/html"); - purple_mime_part_set_field(part, "Content-Transfer-Encoding", "7bit"); - purple_mime_part_set_data(part, tmp); - g_free(tmp); - - g_string_free(str, TRUE); - - str = g_string_new(NULL); - purple_mime_document_write(doc, str); - tmp = str->str; - g_string_free(str, FALSE); - - return tmp; -} - - -static int mw_prpl_send_im(PurpleConnection *gc, - const char *name, - const char *message, - PurpleMessageFlags flags) { - - struct mwPurplePluginData *pd; - struct mwIdBlock who = { (char *) name, NULL }; - struct mwConversation *conv; - - g_return_val_if_fail(gc != NULL, 0); - pd = gc->proto_data; - - g_return_val_if_fail(pd != NULL, 0); - - conv = mwServiceIm_getConversation(pd->srvc_im, &who); - - /* this detection of features to determine how to send the message - (plain, html, or mime) is flawed because the other end of the - conversation could close their channel at any time, rendering any - existing formatting in an outgoing message innapropriate. The end - result is that it may be possible that the other side of the - conversation will receive a plaintext message with html contents, - which is bad. I'm not sure how to fix this correctly. */ - - if(strstr(message, "proto_data; - - g_return_val_if_fail(pd != NULL, 0); - - conv = mwServiceIm_getConversation(pd->srvc_im, &who); - - if(mwConversation_isOpen(conv)) { - mwConversation_send(conv, mwImSend_TYPING, t); - - } else if((state == PURPLE_TYPING) || (state == PURPLE_TYPED)) { - /* only open a channel for sending typing notification, not for - when typing has stopped. There's no point in re-opening a - channel just to tell someone that this side isn't typing. */ - - convo_queue(conv, mwImSend_TYPING, t); - - if(! mwConversation_isPending(conv)) { - mwConversation_open(conv); - } - } - - return 0; -} - - -static const char *mw_client_name(guint16 type) { - switch(type) { - case mwLogin_LIB: - return "Lotus Binary Library"; - - case mwLogin_JAVA_WEB: - return "Lotus Java Client Applet"; - - case mwLogin_BINARY: - return "Lotus Sametime Connect"; - - case mwLogin_JAVA_APP: - return "Lotus Java Client Application"; - - case mwLogin_LINKS: - return "Lotus Sametime Links"; - - case mwLogin_NOTES_6_5: - case mwLogin_NOTES_6_5_3: - case mwLogin_NOTES_7_0_beta: - case mwLogin_NOTES_7_0: - return "Lotus Notes Client"; - - case mwLogin_ICT: - case mwLogin_ICT_1_7_8_2: - case mwLogin_ICT_SIP: - return "IBM Community Tools"; - - case mwLogin_NOTESBUDDY_4_14: - case mwLogin_NOTESBUDDY_4_15: - case mwLogin_NOTESBUDDY_4_16: - return "Alphaworks NotesBuddy"; - - case 0x1305: - case 0x1306: - case 0x1307: - return "Lotus Sametime Connect 7.5"; - - case mwLogin_SANITY: - return "Sanity"; - - case mwLogin_ST_PERL: - return "ST-Send-Message"; - - case mwLogin_TRILLIAN: - case mwLogin_TRILLIAN_IBM: - return "Trillian"; - - case mwLogin_MEANWHILE: - return "Meanwhile"; - - default: - return NULL; - } -} - - -static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { - - struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; - - struct mwPurplePluginData *pd; - PurpleAccount *acct; - PurpleBuddy *b; - PurpleNotifyUserInfo *user_info; - char *tmp; - const char *tmp2; - - g_return_if_fail(who != NULL); - g_return_if_fail(*who != '\0'); - - pd = gc->proto_data; - - acct = purple_connection_get_account(gc); - b = purple_find_buddy(acct, who); - user_info = purple_notify_user_info_new(); - - if(purple_str_has_prefix(who, "@E ")) { - purple_notify_user_info_add_pair(user_info, _("External User"), NULL); - } - - purple_notify_user_info_add_pair(user_info, _("User ID"), who); - - if(b) { - guint32 type; - - if(purple_buddy_get_server_alias(b)) { - purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); - } - - type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT); - if(type) { - tmp = g_strdup(mw_client_name(type)); - if (!tmp) - tmp = g_strdup_printf(_("Unknown (0x%04x)
"), type); - - purple_notify_user_info_add_pair(user_info, _("Last Known Client"), tmp); - - g_free(tmp); - } - } - - tmp = user_supports_text(pd->srvc_aware, who); - if(tmp) { - purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); - g_free(tmp); - } - - if(b) { - purple_notify_user_info_add_pair(user_info, _("Status"), status_text(b)); - - /* XXX Is this adding a status message in its own section rather than with the "Status" label? */ - tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb); - if(tmp2 && g_utf8_validate(tmp2, -1, NULL)) { - tmp = g_markup_escape_text(tmp2, -1); - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - } - } - - /* @todo emit a signal to allow a plugin to override the display of - this notification, so that it can create its own */ - - purple_notify_userinfo(gc, who, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); -} - - -static void mw_prpl_set_status(PurpleAccount *acct, PurpleStatus *status) { - PurpleConnection *gc; - const char *state; - char *message = NULL; - struct mwSession *session; - struct mwUserStatus stat; - - g_return_if_fail(acct != NULL); - gc = purple_account_get_connection(acct); - - state = purple_status_get_id(status); - - DEBUG_INFO("Set status to %s\n", purple_status_get_name(status)); - - g_return_if_fail(gc != NULL); - - session = gc_to_session(gc); - g_return_if_fail(session != NULL); - - /* get a working copy of the current status */ - mwUserStatus_clone(&stat, mwSession_getUserStatus(session)); - - /* determine the state */ - if(! strcmp(state, MW_STATE_ACTIVE)) { - stat.status = mwStatus_ACTIVE; - - } else if(! strcmp(state, MW_STATE_AWAY)) { - stat.status = mwStatus_AWAY; - - } else if(! strcmp(state, MW_STATE_BUSY)) { - stat.status = mwStatus_BUSY; - } - - /* determine the message */ - message = (char *) purple_status_get_attr_string(status, MW_STATE_MESSAGE); - - if(message) { - /* all the possible non-NULL values of message up to this point - are const, so we don't need to free them */ - message = purple_markup_strip_html(message); - } - - /* out with the old */ - g_free(stat.desc); - - /* in with the new */ - stat.desc = (char *) message; - - mwSession_setUserStatus(session, &stat); - mwUserStatus_clear(&stat); -} - - -static void mw_prpl_set_idle(PurpleConnection *gc, int t) { - struct mwSession *session; - struct mwUserStatus stat; - - - session = gc_to_session(gc); - g_return_if_fail(session != NULL); - - mwUserStatus_clone(&stat, mwSession_getUserStatus(session)); - - if(t) { - time_t now = time(NULL); - stat.time = now - t; - - } else { - stat.time = 0; - } - - if(t > 0 && stat.status == mwStatus_ACTIVE) { - /* we were active and went idle, so change the status to IDLE. */ - stat.status = mwStatus_IDLE; - - } else if(t == 0 && stat.status == mwStatus_IDLE) { - /* we only become idle automatically, so change back to ACTIVE */ - stat.status = mwStatus_ACTIVE; - } - - mwSession_setUserStatus(session, &stat); - mwUserStatus_clear(&stat); -} - - -static void notify_im(PurpleConnection *gc, GList *row, void *user_data) { - PurpleAccount *acct; - PurpleConversation *conv; - char *id; - - acct = purple_connection_get_account(gc); - id = g_list_nth_data(row, 1); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, id, acct); - if(! conv) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, id); - purple_conversation_present(conv); -} - - -static void notify_add(PurpleConnection *gc, GList *row, void *user_data) { - BuddyAddData *data = user_data; - const char *group_name = NULL; - - if (data && data->group) { - group_name = purple_group_get_name(data->group); - } - - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 1), group_name, - g_list_nth_data(row, 0)); -} - - -static void notify_close(gpointer data) { - if (data) { - g_free(data); - } -} - - -static void multi_resolved_query(struct mwResolveResult *result, - PurpleConnection *gc, gpointer data) { - GList *l; - const char *msgA; - const char *msgB; - char *msg; - - PurpleNotifySearchResults *sres; - PurpleNotifySearchColumn *scol; - - sres = purple_notify_searchresults_new(); - - scol = purple_notify_searchresults_column_new(_("User Name")); - purple_notify_searchresults_column_add(sres, scol); - - scol = purple_notify_searchresults_column_new(_("Sametime ID")); - purple_notify_searchresults_column_add(sres, scol); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_IM, - notify_im); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_ADD, - notify_add); - - for(l = result->matches; l; l = l->next) { - struct mwResolveMatch *match = l->data; - GList *row = NULL; - - DEBUG_INFO("multi resolve: %s, %s\n", - NSTR(match->id), NSTR(match->name)); - - if(!match->id || !match->name) - continue; - - row = g_list_append(row, g_strdup(match->name)); - row = g_list_append(row, g_strdup(match->id)); - purple_notify_searchresults_row_add(sres, row); - } - - msgA = _("An ambiguous user ID was entered"); - msgB = _("The identifier '%s' may possibly refer to any of the following" - " users. Please select the correct user from the list below to" - " add them to your buddy list."); - msg = g_strdup_printf(msgB, result->name); - - purple_notify_searchresults(gc, _("Select User"), - msgA, msg, sres, notify_close, data); - - g_free(msg); -} - - -static void add_buddy_resolved(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer b) { - - struct mwResolveResult *res = NULL; - BuddyAddData *data = b; - PurpleBuddy *buddy = NULL; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - - g_return_if_fail(data != NULL); - - buddy = data->buddy; - - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - pd = gc->proto_data; - - if(results) - res = results->data; - - if(!code && res && res->matches) { - if(!res->matches->next) { - struct mwResolveMatch *match = res->matches->data; - - /* only one? that might be the right one! */ - if(strcmp(res->name, match->id)) { - /* uh oh, the single result isn't identical to the search - term, better safe then sorry, so let's make sure it's who - the user meant to add */ - purple_blist_remove_buddy(buddy); - multi_resolved_query(res, gc, data); - - } else { - - /* same person, set the server alias */ - purple_blist_server_alias_buddy(buddy, match->name); - purple_blist_node_set_string((PurpleBlistNode *) buddy, - BUDDY_KEY_NAME, match->name); - - /* subscribe to awareness */ - buddy_add(pd, buddy); - - blist_schedule(pd); - - g_free(data); - } - - } else { - /* prompt user if more than one match was returned */ - purple_blist_remove_buddy(buddy); - multi_resolved_query(res, gc, data); - } - - return; - } - -#if 0 - /* fall-through indicates that we couldn't find a matching user in - the resolve service (ether error or zero results), so we remove - this buddy */ - - /* note: I can't really think of a good reason to alter the buddy - list in any way. There has been at least one report where the - resolve service isn't returning correct results anyway, so let's - just leave them in the list. I'm just going to if0 this section - out unless I can think of a very good reason to do this. -siege */ - - DEBUG_INFO("no such buddy in community\n"); - purple_blist_remove_buddy(buddy); - blist_schedule(pd); - - if(res && res->name) { - /* compose and display an error message */ - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("Unable to add user: user not found"); - - msgB = _("The identifier '%s' did not match any users in your" - " Sametime community. This entry has been removed from" - " your buddy list."); - msg = g_strdup_printf(msgB, NSTR(res->name)); - - purple_notify_error(gc, _("Unable to add user"), msgA, msg); - - g_free(msg); - } -#endif -} - - -static void mw_prpl_add_buddy(PurpleConnection *gc, - PurpleBuddy *buddy, - PurpleGroup *group) { - - struct mwPurplePluginData *pd = gc->proto_data; - struct mwServiceResolve *srvc; - GList *query; - enum mwResolveFlag flags; - guint32 req; - BuddyAddData *data; - - /* catch external buddies. They won't be in the resolve service */ - if(buddy_is_external(buddy)) { - buddy_add(pd, buddy); - return; - } - - data = g_new0(BuddyAddData, 1); - data->buddy = buddy; - data->group = group; - - srvc = pd->srvc_resolve; - - query = g_list_prepend(NULL, (char *)purple_buddy_get_name(buddy)); - flags = mwResolveFlag_FIRST | mwResolveFlag_USERS; - - req = mwServiceResolve_resolve(srvc, query, flags, add_buddy_resolved, - data, NULL); - g_list_free(query); - - if(req == SEARCH_ERROR) { - purple_blist_remove_buddy(buddy); - blist_schedule(pd); - } -} - - -static void foreach_add_buddies(PurpleGroup *group, GList *buddies, - struct mwPurplePluginData *pd) { - struct mwAwareList *list; - - list = list_ensure(pd, group); - mwAwareList_addAware(list, buddies); - g_list_free(buddies); -} - - -static void mw_prpl_add_buddies(PurpleConnection *gc, - GList *buddies, - GList *groups) { - - struct mwPurplePluginData *pd; - GHashTable *group_sets; - struct mwAwareIdBlock *idbs, *idb; - - pd = gc->proto_data; - - /* map PurpleGroup:GList of mwAwareIdBlock */ - group_sets = g_hash_table_new(g_direct_hash, g_direct_equal); - - /* bunch of mwAwareIdBlock allocated at once, free'd at once */ - idb = idbs = g_new(struct mwAwareIdBlock, g_list_length(buddies)); - - /* first pass collects mwAwareIdBlock lists for each group */ - for(; buddies; buddies = buddies->next) { - PurpleBuddy *b = buddies->data; - PurpleGroup *g; - const char *fn; - GList *l; - - /* nab the saved server alias and stick it on the buddy */ - fn = purple_blist_node_get_string((PurpleBlistNode *) b, BUDDY_KEY_NAME); - purple_blist_server_alias_buddy(b, fn); - - /* convert PurpleBuddy into a mwAwareIdBlock */ - idb->type = mwAware_USER; - idb->user = (char *) purple_buddy_get_name(b); - idb->community = NULL; - - /* put idb into the list associated with the buddy's group */ - g = purple_buddy_get_group(b); - l = g_hash_table_lookup(group_sets, g); - l = g_list_prepend(l, idb++); - g_hash_table_insert(group_sets, g, l); - } - - /* each group's buddies get added in one shot, and schedule the blist - for saving */ - g_hash_table_foreach(group_sets, (GHFunc) foreach_add_buddies, pd); - blist_schedule(pd); - - /* cleanup */ - g_hash_table_destroy(group_sets); - g_free(idbs); -} - - -static void mw_prpl_remove_buddy(PurpleConnection *gc, - PurpleBuddy *buddy, PurpleGroup *group) { - - struct mwPurplePluginData *pd; - struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(buddy), NULL }; - struct mwAwareList *list; - - GList *rem = g_list_prepend(NULL, &idb); - - pd = gc->proto_data; - group = purple_buddy_get_group(buddy); - list = list_ensure(pd, group); - - mwAwareList_removeAware(list, rem); - blist_schedule(pd); - - g_list_free(rem); -} - - -static void privacy_fill(struct mwPrivacyInfo *priv, - GSList *members) { - - struct mwUserItem *u; - guint count; - - count = g_slist_length(members); - DEBUG_INFO("privacy_fill: %u members\n", count); - - priv->count = count; - priv->users = g_new0(struct mwUserItem, count); - - while(count--) { - u = priv->users + count; - u->id = members->data; - members = members->next; - } -} - - -static void mw_prpl_set_permit_deny(PurpleConnection *gc) { - PurpleAccount *acct; - struct mwPurplePluginData *pd; - struct mwSession *session; - - struct mwPrivacyInfo privacy = { - FALSE, /* deny */ - 0, /* count */ - NULL, /* users */ - }; - - g_return_if_fail(gc != NULL); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - session = pd->session; - g_return_if_fail(session != NULL); - - switch(acct->perm_deny) { - case PURPLE_PRIVACY_DENY_USERS: - DEBUG_INFO("PURPLE_PRIVACY_DENY_USERS\n"); - privacy_fill(&privacy, acct->deny); - privacy.deny = TRUE; - break; - - case PURPLE_PRIVACY_ALLOW_ALL: - DEBUG_INFO("PURPLE_PRIVACY_ALLOW_ALL\n"); - privacy.deny = TRUE; - break; - - case PURPLE_PRIVACY_ALLOW_USERS: - DEBUG_INFO("PURPLE_PRIVACY_ALLOW_USERS\n"); - privacy_fill(&privacy, acct->permit); - privacy.deny = FALSE; - break; - - case PURPLE_PRIVACY_DENY_ALL: - DEBUG_INFO("PURPLE_PRIVACY_DENY_ALL\n"); - privacy.deny = FALSE; - break; - - default: - DEBUG_INFO("acct->perm_deny is 0x%x\n", acct->perm_deny); - return; - } - - mwSession_setPrivacyInfo(session, &privacy); - g_free(privacy.users); -} - - -static void mw_prpl_add_permit(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static void mw_prpl_add_deny(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static void mw_prpl_rem_permit(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static void mw_prpl_rem_deny(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static struct mwConference *conf_find(struct mwServiceConference *srvc, - const char *name) { - GList *l, *ll; - struct mwConference *conf = NULL; - - ll = mwServiceConference_getConferences(srvc); - for(l = ll; l; l = l->next) { - struct mwConference *c = l->data; - if(! strcmp(name, mwConference_getName(c))) { - conf = c; - break; - } - } - g_list_free(ll); - - return conf; -} - - -static void mw_prpl_join_chat(PurpleConnection *gc, - GHashTable *components) { - - struct mwPurplePluginData *pd; - char *c, *t; - - pd = gc->proto_data; - - c = g_hash_table_lookup(components, CHAT_KEY_NAME); - t = g_hash_table_lookup(components, CHAT_KEY_TOPIC); - - if(g_hash_table_lookup(components, CHAT_KEY_IS_PLACE)) { - /* use place service */ - struct mwServicePlace *srvc; - struct mwPlace *place = NULL; - - srvc = pd->srvc_place; - place = mwPlace_new(srvc, c, t); - mwPlace_open(place); - - } else { - /* use conference service */ - struct mwServiceConference *srvc; - struct mwConference *conf = NULL; - - srvc = pd->srvc_conf; - if(c) conf = conf_find(srvc, c); - - if(conf) { - DEBUG_INFO("accepting conference invitation\n"); - mwConference_accept(conf); - - } else { - DEBUG_INFO("creating new conference\n"); - conf = mwConference_new(srvc, t); - mwConference_open(conf); - } - } -} - - -static void mw_prpl_reject_chat(PurpleConnection *gc, - GHashTable *components) { - - struct mwPurplePluginData *pd; - struct mwServiceConference *srvc; - char *c; - - pd = gc->proto_data; - srvc = pd->srvc_conf; - - if(g_hash_table_lookup(components, CHAT_KEY_IS_PLACE)) { - ; /* nothing needs doing */ - - } else { - /* reject conference */ - c = g_hash_table_lookup(components, CHAT_KEY_NAME); - if(c) { - struct mwConference *conf = conf_find(srvc, c); - if(conf) mwConference_reject(conf, ERR_SUCCESS, "Declined"); - } - } -} - - -static char *mw_prpl_get_chat_name(GHashTable *components) { - return g_hash_table_lookup(components, CHAT_KEY_NAME); -} - - -static void mw_prpl_chat_invite(PurpleConnection *gc, - int id, - const char *invitation, - const char *who) { - - struct mwPurplePluginData *pd; - struct mwConference *conf; - struct mwPlace *place; - struct mwIdBlock idb = { (char *) who, NULL }; - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - conf = ID_TO_CONF(pd, id); - - if(conf) { - mwConference_invite(conf, &idb, invitation); - return; - } - - place = ID_TO_PLACE(pd, id); - g_return_if_fail(place != NULL); - - /* @todo: use the IM service for invitation */ - mwPlace_legacyInvite(place, &idb, invitation); -} - - -static void mw_prpl_chat_leave(PurpleConnection *gc, - int id) { - - struct mwPurplePluginData *pd; - struct mwConference *conf; - - pd = gc->proto_data; - - g_return_if_fail(pd != NULL); - conf = ID_TO_CONF(pd, id); - - if(conf) { - mwConference_destroy(conf, ERR_SUCCESS, "Leaving"); - - } else { - struct mwPlace *place = ID_TO_PLACE(pd, id); - g_return_if_fail(place != NULL); - - mwPlace_destroy(place, ERR_SUCCESS); - } -} - - -static void mw_prpl_chat_whisper(PurpleConnection *gc, - int id, - const char *who, - const char *message) { - - mw_prpl_send_im(gc, who, message, 0); -} - - -static int mw_prpl_chat_send(PurpleConnection *gc, - int id, - const char *message, - PurpleMessageFlags flags) { - - struct mwPurplePluginData *pd; - struct mwConference *conf; - char *msg; - int ret; - - pd = gc->proto_data; - - g_return_val_if_fail(pd != NULL, 0); - conf = ID_TO_CONF(pd, id); - - msg = purple_markup_strip_html(message); - - if(conf) { - ret = ! mwConference_sendText(conf, msg); - - } else { - struct mwPlace *place = ID_TO_PLACE(pd, id); - g_return_val_if_fail(place != NULL, 0); - - ret = ! mwPlace_sendText(place, msg); - } - - g_free(msg); - return ret; -} - - -static void mw_prpl_keepalive(PurpleConnection *gc) { - struct mwSession *session; - - g_return_if_fail(gc != NULL); - - session = gc_to_session(gc); - g_return_if_fail(session != NULL); - - mwSession_sendKeepalive(session); -} - - -static void mw_prpl_alias_buddy(PurpleConnection *gc, - const char *who, - const char *alias) { - - struct mwPurplePluginData *pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* it's a change to the buddy list, so we've gotta reflect that in - the server copy */ - - blist_schedule(pd); -} - - -static void mw_prpl_group_buddy(PurpleConnection *gc, - const char *who, - const char *old_group, - const char *new_group) { - - struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; - GList *gl = g_list_prepend(NULL, &idb); - - struct mwPurplePluginData *pd = gc->proto_data; - PurpleGroup *group; - struct mwAwareList *list; - - /* add who to new_group's aware list */ - group = purple_find_group(new_group); - list = list_ensure(pd, group); - mwAwareList_addAware(list, gl); - - /* remove who from old_group's aware list */ - group = purple_find_group(old_group); - list = list_ensure(pd, group); - mwAwareList_removeAware(list, gl); - - g_list_free(gl); - - /* schedule the changes to be saved */ - blist_schedule(pd); -} - - -static void mw_prpl_rename_group(PurpleConnection *gc, - const char *old, - PurpleGroup *group, - GList *buddies) { - - struct mwPurplePluginData *pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* it's a change in the buddy list, so we've gotta reflect that in - the server copy. Also, having this function should prevent all - those buddies from being removed and re-added. We don't really - give a crap what the group is named in Purple other than to record - that as the group name/alias */ - - blist_schedule(pd); -} - - -static void mw_prpl_buddy_free(PurpleBuddy *buddy) { - /* I don't think we have any cleanup for buddies yet */ - ; -} - - -static void mw_prpl_convo_closed(PurpleConnection *gc, const char *who) { - struct mwPurplePluginData *pd = gc->proto_data; - struct mwServiceIm *srvc; - struct mwConversation *conv; - struct mwIdBlock idb = { (char *) who, NULL }; - - g_return_if_fail(pd != NULL); - - srvc = pd->srvc_im; - g_return_if_fail(srvc != NULL); - - conv = mwServiceIm_findConversation(srvc, &idb); - if(! conv) return; - - if(mwConversation_isOpen(conv)) - mwConversation_free(conv); -} - - -static const char *mw_prpl_normalize(const PurpleAccount *account, - const char *id) { - - /* code elsewhere assumes that the return value points to different - memory than the passed value, but it won't free the normalized - data. wtf? */ - - static char buf[BUF_LEN]; - strncpy(buf, id, sizeof(buf)); - return buf; -} - - -static void mw_prpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { - struct mwPurplePluginData *pd; - struct mwAwareList *list; - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - g_return_if_fail(pd->group_list_map != NULL); - - list = g_hash_table_lookup(pd->group_list_map, group); - - if(list) { - g_hash_table_remove(pd->group_list_map, list); - g_hash_table_remove(pd->group_list_map, group); - mwAwareList_free(list); - - blist_schedule(pd); - } -} - - -static gboolean mw_prpl_can_receive_file(PurpleConnection *gc, - const char *who) { - struct mwPurplePluginData *pd; - struct mwServiceAware *srvc; - PurpleAccount *acct; - - g_return_val_if_fail(gc != NULL, FALSE); - - pd = gc->proto_data; - g_return_val_if_fail(pd != NULL, FALSE); - - srvc = pd->srvc_aware; - g_return_val_if_fail(srvc != NULL, FALSE); - - acct = purple_connection_get_account(gc); - g_return_val_if_fail(acct != NULL, FALSE); - - return purple_find_buddy(acct, who) && - user_supports(srvc, who, mwAttribute_FILE_TRANSFER); -} - - -static void ft_outgoing_init(PurpleXfer *xfer) { - PurpleAccount *acct; - PurpleConnection *gc; - - struct mwPurplePluginData *pd; - struct mwServiceFileTransfer *srvc; - struct mwFileTransfer *ft; - - const char *filename; - gsize filesize; - FILE *fp; - - struct mwIdBlock idb = { NULL, NULL }; - - DEBUG_INFO("ft_outgoing_init\n"); - - acct = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(acct); - pd = gc->proto_data; - srvc = pd->srvc_ft; - - filename = purple_xfer_get_local_filename(xfer); - filesize = purple_xfer_get_size(xfer); - idb.user = xfer->who; - - purple_xfer_update_progress(xfer); - - /* test that we can actually send the file */ - fp = g_fopen(filename, "rb"); - if(! fp) { - char *msg = g_strdup_printf(_("Error reading file %s: \n%s\n"), - filename, g_strerror(errno)); - purple_xfer_error(purple_xfer_get_type(xfer), acct, xfer->who, msg); - g_free(msg); - return; - } - fclose(fp); - - { - char *tmp = strrchr(filename, G_DIR_SEPARATOR); - if(tmp++) filename = tmp; - } - - ft = mwFileTransfer_new(srvc, &idb, NULL, filename, filesize); - - purple_xfer_ref(xfer); - mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; - - mwFileTransfer_offer(ft); -} - - -static void ft_outgoing_cancel(PurpleXfer *xfer) { - struct mwFileTransfer *ft = xfer->data; - - DEBUG_INFO("ft_outgoing_cancel called\n"); - - if(ft) mwFileTransfer_cancel(ft); -} - - -static PurpleXfer *mw_prpl_new_xfer(PurpleConnection *gc, const char *who) { - PurpleAccount *acct; - PurpleXfer *xfer; - - acct = purple_connection_get_account(gc); - - xfer = purple_xfer_new(acct, PURPLE_XFER_SEND, who); - if (xfer) - { - purple_xfer_set_init_fnc(xfer, ft_outgoing_init); - purple_xfer_set_cancel_send_fnc(xfer, ft_outgoing_cancel); - } - - return xfer; -} - -static void mw_prpl_send_file(PurpleConnection *gc, - const char *who, const char *file) { - - PurpleXfer *xfer = mw_prpl_new_xfer(gc, who); - - if(file) { - DEBUG_INFO("file != NULL\n"); - purple_xfer_request_accepted(xfer, file); - - } else { - DEBUG_INFO("file == NULL\n"); - purple_xfer_request(xfer); - } -} - - -static PurplePluginProtocolInfo mw_prpl_info = { - .options = OPT_PROTO_IM_IMAGE, - .user_splits = NULL, /*< set in mw_plugin_init */ - .protocol_options = NULL, /*< set in mw_plugin_init */ - .icon_spec = NO_BUDDY_ICONS, - .list_icon = mw_prpl_list_icon, - .list_emblem = mw_prpl_list_emblem, - .status_text = mw_prpl_status_text, - .tooltip_text = mw_prpl_tooltip_text, - .status_types = mw_prpl_status_types, - .blist_node_menu = mw_prpl_blist_node_menu, - .chat_info = mw_prpl_chat_info, - .chat_info_defaults = mw_prpl_chat_info_defaults, - .login = mw_prpl_login, - .close = mw_prpl_close, - .send_im = mw_prpl_send_im, - .set_info = NULL, - .send_typing = mw_prpl_send_typing, - .get_info = mw_prpl_get_info, - .set_status = mw_prpl_set_status, - .set_idle = mw_prpl_set_idle, - .change_passwd = NULL, - .add_buddy = mw_prpl_add_buddy, - .add_buddies = mw_prpl_add_buddies, - .remove_buddy = mw_prpl_remove_buddy, - .remove_buddies = NULL, - .add_permit = mw_prpl_add_permit, - .add_deny = mw_prpl_add_deny, - .rem_permit = mw_prpl_rem_permit, - .rem_deny = mw_prpl_rem_deny, - .set_permit_deny = mw_prpl_set_permit_deny, - .join_chat = mw_prpl_join_chat, - .reject_chat = mw_prpl_reject_chat, - .get_chat_name = mw_prpl_get_chat_name, - .chat_invite = mw_prpl_chat_invite, - .chat_leave = mw_prpl_chat_leave, - .chat_whisper = mw_prpl_chat_whisper, - .chat_send = mw_prpl_chat_send, - .keepalive = mw_prpl_keepalive, - .register_user = NULL, - .get_cb_info = NULL, - .get_cb_away = NULL, - .alias_buddy = mw_prpl_alias_buddy, - .group_buddy = mw_prpl_group_buddy, - .rename_group = mw_prpl_rename_group, - .buddy_free = mw_prpl_buddy_free, - .convo_closed = mw_prpl_convo_closed, - .normalize = mw_prpl_normalize, - .set_buddy_icon = NULL, - .remove_group = mw_prpl_remove_group, - .get_cb_real_name = NULL, - .set_chat_topic = NULL, - .find_blist_chat = NULL, - .roomlist_get_list = NULL, - .roomlist_expand_category = NULL, - .can_receive_file = mw_prpl_can_receive_file, - .send_file = mw_prpl_send_file, - .new_xfer = mw_prpl_new_xfer, - .offline_message = NULL, - .whiteboard_prpl_ops = NULL, - .send_raw = NULL, - .struct_size = sizeof(PurplePluginProtocolInfo) -}; - - -static PurplePluginPrefFrame * -mw_plugin_get_plugin_pref_frame(PurplePlugin *plugin) { - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - pref = purple_plugin_pref_new_with_label(_("Remotely Stored Buddy List")); - purple_plugin_pref_frame_add(frame, pref); - - - pref = purple_plugin_pref_new_with_name(MW_PRPL_OPT_BLIST_ACTION); - purple_plugin_pref_set_label(pref, _("Buddy List Storage Mode")); - - purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); - purple_plugin_pref_add_choice(pref, _("Local Buddy List Only"), - GINT_TO_POINTER(blist_choice_LOCAL)); - purple_plugin_pref_add_choice(pref, _("Merge List from Server"), - GINT_TO_POINTER(blist_choice_MERGE)); - purple_plugin_pref_add_choice(pref, _("Merge and Save List to Server"), - GINT_TO_POINTER(blist_choice_STORE)); - purple_plugin_pref_add_choice(pref, _("Synchronize List with Server"), - GINT_TO_POINTER(blist_choice_SYNCH)); - - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - - -static PurplePluginUiInfo mw_plugin_ui_info = { - mw_plugin_get_plugin_pref_frame, - 0, /* page_num */ - NULL, /* frame */ - NULL, - NULL, - NULL, - NULL -}; - - -static void st_import_action_cb(PurpleConnection *gc, char *filename) { - struct mwSametimeList *l; - - FILE *file; - char buf[BUF_LEN]; - size_t len; - - GString *str; - - file = g_fopen(filename, "r"); - g_return_if_fail(file != NULL); - - str = g_string_new(NULL); - while( (len = fread(buf, 1, BUF_LEN, file)) ) { - g_string_append_len(str, buf, len); - } - - fclose(file); - - l = mwSametimeList_load(str->str); - g_string_free(str, TRUE); - - blist_merge(gc, l); - mwSametimeList_free(l); -} - - -/** prompts for a file to import blist from */ -static void st_import_action(PurplePluginAction *act) { - PurpleConnection *gc; - PurpleAccount *account; - char *title; - - gc = act->context; - account = purple_connection_get_account(gc); - title = g_strdup_printf(_("Import Sametime List for Account %s"), - purple_account_get_username(account)); - - purple_request_file(gc, title, NULL, FALSE, - G_CALLBACK(st_import_action_cb), NULL, - account, NULL, NULL, - gc); - - g_free(title); -} - - -static void st_export_action_cb(PurpleConnection *gc, char *filename) { - struct mwSametimeList *l; - char *str; - FILE *file; - - file = g_fopen(filename, "w"); - g_return_if_fail(file != NULL); - - l = mwSametimeList_new(); - blist_export(gc, l); - str = mwSametimeList_store(l); - mwSametimeList_free(l); - - fprintf(file, "%s", str); - fclose(file); - - g_free(str); -} - - -/** prompts for a file to export blist to */ -static void st_export_action(PurplePluginAction *act) { - PurpleConnection *gc; - PurpleAccount *account; - char *title; - - gc = act->context; - account = purple_connection_get_account(gc); - title = g_strdup_printf(_("Export Sametime List for Account %s"), - purple_account_get_username(account)); - - purple_request_file(gc, title, NULL, TRUE, - G_CALLBACK(st_export_action_cb), NULL, - account, NULL, NULL, - gc); - - g_free(title); -} - - -static void remote_group_multi_cleanup(gpointer ignore, - PurpleRequestFields *fields) { - - PurpleRequestField *f; - GList *l; - - f = purple_request_fields_get_field(fields, "group"); - l = purple_request_field_list_get_items(f); - - for(; l; l = l->next) { - const char *i = l->data; - struct named_id *res; - - res = purple_request_field_list_get_data(f, i); - - g_free(res->id); - g_free(res->name); - g_free(res); - } -} - - -static void remote_group_done(struct mwPurplePluginData *pd, - const char *id, const char *name) { - PurpleConnection *gc; - PurpleAccount *acct; - PurpleGroup *group; - PurpleBlistNode *gn; - const char *owner; - - g_return_if_fail(pd != NULL); - - gc = pd->gc; - acct = purple_connection_get_account(gc); - - /* collision checking */ - group = purple_find_group(name); - if(group) { - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("Unable to add group: group exists"); - msgB = _("A group named '%s' already exists in your buddy list."); - msg = g_strdup_printf(msgB, name); - - purple_notify_error(gc, _("Unable to add group"), msgA, msg); - - g_free(msg); - return; - } - - group = purple_group_new(name); - gn = (PurpleBlistNode *) group; - - owner = purple_account_get_username(acct); - - purple_blist_node_set_string(gn, GROUP_KEY_NAME, id); - purple_blist_node_set_int(gn, GROUP_KEY_TYPE, mwSametimeGroup_DYNAMIC); - purple_blist_node_set_string(gn, GROUP_KEY_OWNER, owner); - purple_blist_add_group(group, NULL); - - group_add(pd, group); - blist_schedule(pd); -} - - -static void remote_group_multi_cb(struct mwPurplePluginData *pd, - PurpleRequestFields *fields) { - PurpleRequestField *f; - GList *l; - - f = purple_request_fields_get_field(fields, "group"); - l = purple_request_field_list_get_selected(f); - - if(l) { - const char *i = l->data; - struct named_id *res; - - res = purple_request_field_list_get_data(f, i); - remote_group_done(pd, res->id, res->name); - } - - remote_group_multi_cleanup(NULL, fields); -} - - -static void remote_group_multi(struct mwResolveResult *result, - struct mwPurplePluginData *pd) { - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - GList *l; - const char *msgA; - const char *msgB; - char *msg; - - PurpleConnection *gc = pd->gc; - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, g); - - f = purple_request_field_list_new("group", _("Possible Matches")); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_field_set_required(f, TRUE); - - for(l = result->matches; l; l = l->next) { - struct mwResolveMatch *match = l->data; - struct named_id *res = g_new0(struct named_id, 1); - - res->id = g_strdup(match->id); - res->name = g_strdup(match->name); - - purple_request_field_list_add(f, res->name, res); - } - - purple_request_field_group_add_field(g, f); - - msgA = _("Notes Address Book group results"); - msgB = _("The identifier '%s' may possibly refer to any of the following" - " Notes Address Book groups. Please select the correct group from" - " the list below to add it to your buddy list."); - msg = g_strdup_printf(msgB, result->name); - - purple_request_fields(gc, _("Select Notes Address Book"), - msgA, msg, fields, - _("Add Group"), G_CALLBACK(remote_group_multi_cb), - _("Cancel"), G_CALLBACK(remote_group_multi_cleanup), - purple_connection_get_account(gc), result->name, NULL, - pd); - - g_free(msg); -} - - -static void remote_group_resolved(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer b) { - - struct mwResolveResult *res = NULL; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - session = mwService_getSession(MW_SERVICE(srvc)); - g_return_if_fail(session != NULL); - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - if(!code && results) { - res = results->data; - - if(res->matches) { - remote_group_multi(res, pd); - return; - } - } - - if(res && res->name) { - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("Unable to add group: group not found"); - - msgB = _("The identifier '%s' did not match any Notes Address Book" - " groups in your Sametime community."); - msg = g_strdup_printf(msgB, res->name); - - purple_notify_error(gc, _("Unable to add group"), msgA, msg); - - g_free(msg); - } -} - - -static void remote_group_action_cb(PurpleConnection *gc, const char *name) { - struct mwPurplePluginData *pd; - struct mwServiceResolve *srvc; - GList *query; - enum mwResolveFlag flags; - guint32 req; - - pd = gc->proto_data; - srvc = pd->srvc_resolve; - - query = g_list_prepend(NULL, (char *) name); - flags = mwResolveFlag_FIRST | mwResolveFlag_GROUPS; - - req = mwServiceResolve_resolve(srvc, query, flags, remote_group_resolved, - NULL, NULL); - g_list_free(query); - - if(req == SEARCH_ERROR) { - /** @todo display error */ - } -} - - -static void remote_group_action(PurplePluginAction *act) { - PurpleConnection *gc; - const char *msgA; - const char *msgB; - - gc = act->context; - - msgA = _("Notes Address Book Group"); - msgB = _("Enter the name of a Notes Address Book group in the field below" - " to add the group and its members to your buddy list."); - - purple_request_input(gc, _("Add Group"), msgA, msgB, NULL, - FALSE, FALSE, NULL, - _("Add"), G_CALLBACK(remote_group_action_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - - -static void search_notify(struct mwResolveResult *result, - PurpleConnection *gc) { - GList *l; - const char *msgA; - const char *msgB; - char *msg1; - char *msg2; - - PurpleNotifySearchResults *sres; - PurpleNotifySearchColumn *scol; - - sres = purple_notify_searchresults_new(); - - scol = purple_notify_searchresults_column_new(_("User Name")); - purple_notify_searchresults_column_add(sres, scol); - - scol = purple_notify_searchresults_column_new(_("Sametime ID")); - purple_notify_searchresults_column_add(sres, scol); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_IM, - notify_im); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_ADD, - notify_add); - - for(l = result->matches; l; l = l->next) { - struct mwResolveMatch *match = l->data; - GList *row = NULL; - - if(!match->id || !match->name) - continue; - - row = g_list_append(row, g_strdup(match->name)); - row = g_list_append(row, g_strdup(match->id)); - purple_notify_searchresults_row_add(sres, row); - } - - msgA = _("Search results for '%s'"); - msgB = _("The identifier '%s' may possibly refer to any of the following" - " users. You may add these users to your buddy list or send them" - " messages with the action buttons below."); - - msg1 = g_strdup_printf(msgA, result->name); - msg2 = g_strdup_printf(msgB, result->name); - - purple_notify_searchresults(gc, _("Search Results"), - msg1, msg2, sres, notify_close, NULL); - - g_free(msg1); - g_free(msg2); -} - - -static void search_resolved(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer b) { - - PurpleConnection *gc = b; - struct mwResolveResult *res = NULL; - - if(results) res = results->data; - - if(!code && res && res->matches) { - search_notify(res, gc); - - } else { - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("No matches"); - msgB = _("The identifier '%s' did not match any users in your" - " Sametime community."); - msg = g_strdup_printf(msgB, (res && res->name) ? NSTR(res->name) : ""); - - purple_notify_error(gc, _("No Matches"), msgA, msg); - - g_free(msg); - } -} - - -static void search_action_cb(PurpleConnection *gc, const char *name) { - struct mwPurplePluginData *pd; - struct mwServiceResolve *srvc; - GList *query; - enum mwResolveFlag flags; - guint32 req; - - pd = gc->proto_data; - srvc = pd->srvc_resolve; - - query = g_list_prepend(NULL, (char *) name); - flags = mwResolveFlag_FIRST | mwResolveFlag_USERS; - - req = mwServiceResolve_resolve(srvc, query, flags, search_resolved, - gc, NULL); - g_list_free(query); - - if(req == SEARCH_ERROR) { - /** @todo display error */ - } -} - - -static void search_action(PurplePluginAction *act) { - PurpleConnection *gc; - const char *msgA; - const char *msgB; - - gc = act->context; - - msgA = _("Search for a user"); - msgB = _("Enter a name or partial ID in the field below to search" - " for matching users in your Sametime community."); - - purple_request_input(gc, _("User Search"), msgA, msgB, NULL, - FALSE, FALSE, NULL, - _("Search"), G_CALLBACK(search_action_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - - -static GList *mw_plugin_actions(PurplePlugin *plugin, gpointer context) { - PurplePluginAction *act; - GList *l = NULL; - - act = purple_plugin_action_new(_("Import Sametime List..."), - st_import_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Export Sametime List..."), - st_export_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Add Notes Address Book Group..."), - remote_group_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("User Search..."), - search_action); - l = g_list_append(l, act); - - return l; -} - - -static gboolean mw_plugin_load(PurplePlugin *plugin) { - return TRUE; -} - - -static gboolean mw_plugin_unload(PurplePlugin *plugin) { - return TRUE; -} - - -static void mw_plugin_destroy(PurplePlugin *plugin) { - g_log_remove_handler(G_LOG_DOMAIN, log_handler[0]); - g_log_remove_handler("meanwhile", log_handler[1]); -} - -static PurplePluginInfo mw_plugin_info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - PLUGIN_ID, /**< id */ - PLUGIN_NAME, /**< name */ - DISPLAY_VERSION, /**< version */ - PLUGIN_SUMMARY, /**< summary */ - PLUGIN_DESC, /**< description */ - PLUGIN_AUTHOR, /**< author */ - PLUGIN_HOMEPAGE, /**< homepage */ - - mw_plugin_load, /**< load */ - mw_plugin_unload, /**< unload */ - mw_plugin_destroy, /**< destroy */ - - NULL, /**< ui_info */ - &mw_prpl_info, /**< extra_info */ - &mw_plugin_ui_info, /**< prefs_info */ - mw_plugin_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void mw_log_handler(const gchar *domain, GLogLevelFlags flags, - const gchar *msg, gpointer data) { - - if(! (msg && *msg)) return; - - /* handle g_log requests via purple's built-in debug logging */ - if(flags & G_LOG_LEVEL_ERROR) { - purple_debug_error(domain, "%s\n", msg); - - } else if(flags & G_LOG_LEVEL_WARNING) { - purple_debug_warning(domain, "%s\n", msg); - - } else { - purple_debug_info(domain, "%s\n", msg); - } -} - - -static void mw_plugin_init(PurplePlugin *plugin) { - PurpleAccountOption *opt; - GList *l = NULL; - - GLogLevelFlags logflags = - G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION; - - /* set up the preferences */ - purple_prefs_add_none(MW_PRPL_OPT_BASE); - purple_prefs_add_int(MW_PRPL_OPT_BLIST_ACTION, BLIST_CHOICE_DEFAULT); - - /* remove dead preferences */ - purple_prefs_remove(MW_PRPL_OPT_PSYCHIC); - purple_prefs_remove(MW_PRPL_OPT_SAVE_DYNAMIC); - - /* host to connect to */ - opt = purple_account_option_string_new(_("Server"), MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - l = g_list_append(l, opt); - - /* port to connect to */ - opt = purple_account_option_int_new(_("Port"), MW_KEY_PORT, - MW_PLUGIN_DEFAULT_PORT); - l = g_list_append(l, opt); - - { /* copy the old force login setting from prefs if it's - there. Don't delete the preference, since there may be more - than one account that wants to check for it. */ - gboolean b = FALSE; - const char *label = _("Force login (ignore server redirects)"); - - if(purple_prefs_exists(MW_PRPL_OPT_FORCE_LOGIN)) - b = purple_prefs_get_bool(MW_PRPL_OPT_FORCE_LOGIN); - - opt = purple_account_option_bool_new(label, MW_KEY_FORCE, b); - l = g_list_append(l, opt); - } - - /* pretend to be Sametime Connect */ - opt = purple_account_option_bool_new(_("Hide client identity"), - MW_KEY_FAKE_IT, FALSE); - l = g_list_append(l, opt); - - mw_prpl_info.protocol_options = l; - l = NULL; - - /* forward all our g_log messages to purple. Generally all the logging - calls are using purple_log directly, but the g_return macros will - get caught here */ - log_handler[0] = g_log_set_handler(G_LOG_DOMAIN, logflags, - mw_log_handler, NULL); - - /* redirect meanwhile's logging to purple's */ - log_handler[1] = g_log_set_handler("meanwhile", logflags, - mw_log_handler, NULL); -} - - -PURPLE_INIT_PLUGIN(sametime, mw_plugin_init, mw_plugin_info); -/* The End. */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/sametime/sametime.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ - - -/* CFLAGS trumps configure values */ - - -/** default host for the purple plugin. You can specialize a build to - default to your server by supplying this at compile time */ -#ifndef MW_PLUGIN_DEFAULT_HOST -#define MW_PLUGIN_DEFAULT_HOST "" -#endif -/* "" */ - - -/** default port for the purple plugin. You can specialize a build to - default to your server by supplying this at compile time */ -#ifndef MW_PLUGIN_DEFAULT_PORT -#define MW_PLUGIN_DEFAULT_PORT 1533 -#endif -/* 1533 */ - - -/** default encoding for the purple plugin.*/ -#ifndef MW_PLUGIN_DEFAULT_ENCODING -#define MW_PLUGIN_DEFAULT_ENCODING "ISO-8859-1" -#endif -/* ISO-8859-1 */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1738 +0,0 @@ -/* - - silcpurple_buddy.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Key Agreement *********************************/ - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data); - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local); - -typedef struct { - char *nick; - PurpleConnection *gc; -} *SilcPurpleResolve; - -static void -silcpurple_buddy_keyagr_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleResolve r = context; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), r->nick); - purple_notify_error(gc, _("Key Agreement"), - _("Cannot perform the key agreement"), tmp); - g_free(r->nick); - silc_free(r); - return; - } - - silcpurple_buddy_keyagr_do(gc, r->nick, FALSE); - g_free(r->nick); - silc_free(r); -} - -static void -silcpurple_buddy_keyagr_cb(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - SilcKeyAgreementStatus status, - SilcSKEKeyMaterial key, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn) - return; - - switch (status) { - case SILC_KEY_AGREEMENT_OK: - { - PurpleConversation *convo; - char tmp[128]; - - /* Set the private key for this client */ - silc_client_del_private_message_key(client, conn, client_entry); - silc_client_add_private_message_key_ske(client, conn, client_entry, - NULL, NULL, key); - silc_ske_free_key_material(key); - - - /* Open IM window */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - client_entry->nickname, sg->account); - if (convo) { - /* we don't have windows in the core anymore...but we may want to - * provide some method for asking the UI to show the window - purple_conv_window_show(purple_conversation_get_window(convo)); - */ - } else { - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, sg->account, - client_entry->nickname); - } - g_snprintf(tmp, sizeof(tmp), "%s [private key]", client_entry->nickname); - purple_conversation_set_title(convo, tmp); - } - break; - - case SILC_KEY_AGREEMENT_ERROR: - purple_notify_error(gc, _("Key Agreement"), - _("Error occurred during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_FAILURE: - purple_notify_error(gc, _("Key Agreement"), _("Key Agreement failed"), NULL); - break; - - case SILC_KEY_AGREEMENT_TIMEOUT: - purple_notify_error(gc, _("Key Agreement"), - _("Timeout during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_ABORTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement was aborted"), NULL); - break; - - case SILC_KEY_AGREEMENT_ALREADY_STARTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement is already started"), NULL); - break; - - case SILC_KEY_AGREEMENT_SELF_DENIED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement cannot be started with yourself"), - NULL); - break; - - default: - break; - } -} - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local) -{ - SilcPurple sg = gc->proto_data; - SilcDList clients; - SilcClientEntry client_entry; - SilcClientConnectionParams params; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - SilcSocket sock; - - if (!sg->conn || !name) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, name, - FALSE); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleResolve r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->nick = g_strdup(name); - r->gc = gc; - silc_client_get_clients(sg->client, sg->conn, name, NULL, - silcpurple_buddy_keyagr_resolved, r); - return; - } - - silc_socket_stream_get_info(silc_packet_stream_get_stream(sg->conn->stream), - &sock, NULL, NULL, NULL); - - /* Resolve the local IP from the outgoing socket connection. We resolve - it to check whether we have a private range IP address or public IP - address. If we have public then we will assume that we are not behind - NAT and will provide automatically the point of connection to the - agreement. If we have private range address we assume that we are - behind NAT and we let the responder provide the point of connection. - - The algorithm also checks the remote IP address of server connection. - If it is private range address and we have private range address we - assume that we are chatting in LAN and will provide the point of - connection. - - Naturally this algorithm does not always get things right. */ - - if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (!force_local && silcpurple_ip_is_private(local_ip)) { - local = FALSE; - - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide - the connection point. */ - local = TRUE; - } - } - - if (force_local) - local = TRUE; - - if (local && !local_ip) - local_ip = silc_net_localip(); - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - if (local) - /* Provide connection point */ - params.local_ip = local_ip; - - /* Send the key agreement request */ - silc_client_send_key_agreement(sg->client, sg->conn, client_entry, - ¶ms, sg->public_key, - sg->private_key, - silcpurple_buddy_keyagr_cb, NULL); - - silc_free(local_ip); - silc_free(remote_ip); - silc_client_list_free(sg->client, sg->conn, clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - char *hostname; - SilcUInt16 port; -} *SilcPurpleKeyAgrAsk; - -static void -silcpurple_buddy_keyagr_request_cb(SilcPurpleKeyAgrAsk a, gint id) -{ - SilcClientEntry client_entry; - SilcClientConnectionParams params; - - if (id != 1) - goto out; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(a->client, a->conn, - &a->client_id); - if (!client_entry) { - purple_notify_error(a->client->application, _("Key Agreement"), - _("The remote user is not present in the network any more"), - NULL); - goto out; - } - - /* If the hostname was provided by the requestor perform the key agreement - now. Otherwise, we will send him a request to connect to us. */ - if (a->hostname) { - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - silc_client_perform_key_agreement(a->client, a->conn, - client_entry, ¶ms, - a->conn->public_key, - a->conn->private_key, - a->hostname, a->port, - silcpurple_buddy_keyagr_cb, NULL); - } else { - /* Send request. Force us as the point of connection since requestor - did not provide the point of connection. */ - silcpurple_buddy_keyagr_do(a->client->application, - client_entry->nickname, TRUE); - } - - out: - g_free(a->hostname); - silc_free(a); -} - -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port, - SilcUInt16 protocol) -{ - char tmp[128], tmp2[128]; - SilcPurpleKeyAgrAsk a; - PurpleConnection *gc = client->application; - - /* For now Pidgin don't support UDP key agreement */ - if (protocol == 1) - return; - - g_snprintf(tmp, sizeof(tmp), - _("Key agreement request received from %s. Would you like to " - "perform the key agreement?"), client_entry->nickname); - if (hostname) - g_snprintf(tmp2, sizeof(tmp2), - _("The remote user is waiting key agreement on:\n" - "Remote host: %s\nRemote port: %d"), hostname, port); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->client = client; - a->conn = conn; - a->client_id = client_entry->id; - if (hostname) - a->hostname = g_strdup(hostname); - a->port = port; - - purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, - NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), - _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); -} - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleAccount *account; - - buddy = (PurpleBuddy *)node; - account = purple_buddy_get_account(buddy); - silcpurple_buddy_keyagr_do(purple_account_get_connection(account), - purple_buddy_get_name(buddy), FALSE); -} - - -/**************************** Static IM Key **********************************/ - -static void -silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcDList clients; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - purple_buddy_get_name(b), FALSE); - if (!clients) - return; - - silc_dlist_start(clients); - silc_client_del_private_message_key(sg->client, sg->conn, - silc_dlist_get(clients)); - silc_client_list_free(sg->client, sg->conn, clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurplePrivkey; - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_privkey_cb(SilcPurplePrivkey p, const char *passphrase) -{ - SilcClientEntry client_entry; - - if (!passphrase || !(*passphrase)) { - silc_free(p); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(p->client, p->conn, - &p->client_id); - if (!client_entry) { - purple_notify_error(p->client->application, _("IM With Password"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(p); - return; - } - - /* Set the private message key */ - silc_client_del_private_message_key(p->client, p->conn, - client_entry); - silc_client_add_private_message_key(p->client, p->conn, - client_entry, NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase)); - silc_free(p); -} - -static void -silcpurple_buddy_privkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("IM With Password"), - _("Cannot set IM key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_privkey(client->application, context); - g_free(context); -} - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcPurplePrivkey p; - SilcDList clients; - SilcClientEntry client_entry; - - if (!name) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - name, FALSE); - if (!clients) { - silc_client_get_clients(sg->client, sg->conn, name, NULL, - silcpurple_buddy_privkey_resolved, - g_strdup(name)); - return; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->client = sg->client; - p->conn = sg->conn; - p->client_id = client_entry->id; - purple_request_input(gc, _("IM With Password"), NULL, - _("Set IM Password"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), - _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); - - silc_client_list_free(sg->client, sg->conn, clients); -} - -static void -silcpurple_buddy_privkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - silcpurple_buddy_privkey(gc, purple_buddy_get_name(buddy)); -} - - -/**************************** Get Public Key *********************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurpleBuddyGetkey; - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name); - -static SilcBool -silcpurple_buddy_getkey_cb(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap) -{ - SilcClientEntry client_entry; - SilcPurpleBuddyGetkey g = context; - - if (status != SILC_STATUS_OK) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return FALSE; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(g->client, g->conn, - &g->client_id); - if (!client_entry) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return FALSE; - } - - if (!client_entry->public_key) { - silc_free(g); - return FALSE; - } - - /* Now verify the public key */ - silcpurple_verify_public_key(g->client, g->conn, client_entry->nickname, - SILC_CONN_CLIENT, client_entry->public_key, - NULL, NULL); - silc_free(g); - return TRUE; -} - -static void -silcpurple_buddy_getkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("Get Public Key"), - _("Cannot fetch the public key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_getkey(client->application, context); - g_free(context); -} - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - SilcDList clients; - SilcPurpleBuddyGetkey g; - SilcUInt16 cmd_ident; - - if (!name) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, name, FALSE); - if (!clients) { - silc_client_get_clients(client, conn, name, NULL, - silcpurple_buddy_getkey_resolved, - g_strdup(name)); - return; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - /* Call GETKEY */ - g = silc_calloc(1, sizeof(*g)); - if (!g) - return; - g->client = client; - g->conn = conn; - g->client_id = client_entry->id; - cmd_ident = silc_client_command_call(client, conn, NULL, "GETKEY", - client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, cmd_ident, - silcpurple_buddy_getkey_cb, g); - silc_client_list_free(client, conn, clients); -} - -static void -silcpurple_buddy_getkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - silcpurple_buddy_getkey(gc, purple_buddy_get_name(buddy)); -} - -static void -silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcPublicKey public_key; - const char *pkfile; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; - - pkfile = purple_blist_node_get_string(node, "public-key"); - if (!silc_pkcs_load_public_key(pkfile, &public_key)) { - purple_notify_error(gc, - _("Show Public Key"), - _("Could not load public key"), NULL); - return; - } - - silcpurple_show_public_key(sg, purple_buddy_get_name(b), public_key, NULL, NULL); - silc_pkcs_public_key_free(public_key); -} - - -/**************************** Buddy routines *********************************/ - -/* The buddies are implemented by using the WHOIS and WATCH commands that - can be used to search users by their public key. Since nicknames aren't - unique in SILC we cannot trust the buddy list using their nickname. We - associate public keys to buddies and use those to search and watch - in the network. - - The problem is that Purple does not return PurpleBuddy contexts to the - callbacks but the buddy names. Naturally, this is not going to work - with SILC. But, for now, we have to do what we can... */ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - PurpleBuddy *b; - unsigned char *offline_pk; - SilcUInt32 offline_pk_len; - SilcPublicKey public_key; - unsigned int offline : 1; - unsigned int pubkey_search : 1; - unsigned int init : 1; -} *SilcPurpleBuddyRes; - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id); -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context); - -void silcpurple_get_info(PurpleConnection *gc, const char *who) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - PurpleBuddy *b; - const char *filename, *nick = who; - char tmp[256]; - - if (!who) - return; - if (strlen(who) > 1 && who[0] == '@') - nick = who + 1; - if (strlen(who) > 1 && who[0] == '*') - nick = who + 1; - if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') - nick = who + 2; - - b = purple_find_buddy(gc->account, nick); - if (b) { - /* See if we have this buddy's public key. If we do use that - to search the details. */ - gpointer proto_data; - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - "-details", "-pubkey", filename, NULL); - return; - } - - if (!(proto_data = purple_buddy_get_protocol_data(b))) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), purple_buddy_get_name(b)); - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), tmp); - return; - } - - client_entry = silc_client_get_client_by_id(client, conn, proto_data); - if (client_entry) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - client_entry->nickname, "-details", NULL); - } - } else { - /* Call WHOIS just with nickname. */ - silc_client_command_call(client, conn, NULL, "WHOIS", nick, NULL); - } -} - -static void -silcpurple_add_buddy_pk_no(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - purple_buddy_get_name(r->b)); - purple_notify_error(r->client->application, _("Add Buddy"), tmp, - _("You cannot receive buddy notifications until you " - "import his/her public key. You can use the Get Public Key " - "command to get the public key.")); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); -} - -static void -silcpurple_add_buddy_save(SilcBool success, void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttribute attribute; - SilcVCardStruct vcard; - SilcMime message = NULL, extension = NULL; - SilcMime usericon = NULL; - SilcAttributeObjPk serverpk, usersign, serversign; - gboolean usign_success = TRUE, ssign_success = TRUE; - char filename[512], filename2[512], *fingerprint = NULL, *tmp; - SilcUInt32 len; - SilcHash hash; - int i; - - if (!success) { - /* The user did not trust the public key. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r->offline_pk); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); - return; - } - - if (r->offline) { - /* User is offline. Associate the imported public key with - this user. */ - fingerprint = silc_hash_fingerprint(NULL, r->offline_pk, - r->offline_pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - silc_free(fingerprint); - silc_free(r->offline_pk); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry) { - silc_free(r->offline_pk); - silc_pkcs_public_key_free(r->public_key); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); - return; - } - - memset(&vcard, 0, sizeof(vcard)); - memset(&serverpk, 0, sizeof(serverpk)); - memset(&usersign, 0, sizeof(usersign)); - memset(&serversign, 0, sizeof(serversign)); - - /* Now that we have the public key and we trust it now we - save the attributes of the buddy and update its status. */ - - if (client_entry->attrs) { - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) - != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - - switch (attribute) { - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - break; - - case SILC_ATTRIBUTE_STATUS_MESSAGE: - message = silc_mime_alloc(); - if (!silc_attribute_get_object(attr, (void *)message, - sizeof(*message))) - continue; - break; - - case SILC_ATTRIBUTE_EXTENSION: - extension = silc_mime_alloc(); - if (!silc_attribute_get_object(attr, (void *)extension, - sizeof(*extension))) - continue; - break; - - case SILC_ATTRIBUTE_USER_ICON: - usericon = silc_mime_alloc(); - if (!silc_attribute_get_object(attr, (void *)usericon, - sizeof(*usericon))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_PUBLIC_KEY: - if (serverpk.type) - continue; - if (!silc_attribute_get_object(attr, (void *)&serverpk, - sizeof(serverpk))) - continue; - break; - - case SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE: - if (usersign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&usersign, - sizeof(usersign))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_DIGITAL_SIGNATURE: - if (serversign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&serversign, - sizeof(serversign))) - continue; - break; - - default: - break; - } - } - } - - /* Verify the attribute signatures */ - silc_hash_alloc((const unsigned char *)"sha1", &hash); - - if (usersign.data) { - unsigned char *verifyd; - SilcUInt32 verify_len; - - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - FALSE, &verify_len); - if (verifyd && !silc_pkcs_verify(client_entry->public_key, - usersign.data, - usersign.data_len, - verifyd, verify_len, hash)) - usign_success = FALSE; - silc_free(verifyd); - } - - if (serversign.data) { - SilcPublicKey public_key; - SilcPKCSType type = 0; - unsigned char *verifyd; - SilcUInt32 verify_len; - - if (!strcmp(serverpk.type, "silc-rsa")) - type = SILC_PKCS_SILC; - else if (!strcmp(serverpk.type, "ssh-rsa")) - type = SILC_PKCS_SSH2; - else if (!strcmp(serverpk.type, "x509v3-sign-rsa")) - type = SILC_PKCS_X509V3; - else if (!strcmp(serverpk.type, "pgp-sign-rsa")) - type = SILC_PKCS_OPENPGP; - - if (silc_pkcs_public_key_alloc(type, serverpk.data, - serverpk.data_len, - &public_key)) { - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - TRUE, &verify_len); - if (verifyd && !silc_pkcs_verify(public_key, - serversign.data, - serversign.data_len, - verifyd, verify_len, - hash)) - ssign_success = FALSE; - silc_pkcs_public_key_free(public_key); - silc_free(verifyd); - } - } - - fingerprint = silc_fingerprint(client_entry->fingerprint, 20); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - if (usign_success || ssign_success) { - struct passwd *pw; - struct stat st; - - memset(filename2, 0, sizeof(filename2)); - - /* Filename for dir */ - tmp = fingerprint + strlen(fingerprint) - 9; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "friends" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), tmp); - - pw = getpwuid(getuid()); - if (!pw) - return; - - /* Create dir if it doesn't exist */ - if ((g_stat(filename, &st)) == -1) { - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - int ret = g_mkdir(filename, 0755); - if (ret < 0) - return; - } - } - } - - /* Save VCard */ - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "vcard", filename); - if (vcard.full_name) { - tmp = (char *)silc_vcard_encode(&vcard, &len); - silc_file_writefile(filename2, tmp, len); - silc_free(tmp); - } - - /* Save status message */ - if (message) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "status_message.mime", - filename); - tmp = (char *)silc_mime_get_data(message, &len); - silc_file_writefile(filename2, tmp, len); - silc_mime_free(message); - } - - /* Save extension data */ - if (extension) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "extension.mime", - filename); - tmp = (char *)silc_mime_get_data(extension, &len); - silc_file_writefile(filename2, tmp, len); - silc_mime_free(extension); - } - - /* Save user icon */ - if (usericon) { - const char *type = silc_mime_get_field(usericon, "Content-Type"); - if (type && - (!strcmp(type, "image/jpeg") || - !strcmp(type, "image/gif") || - !strcmp(type, "image/bmp") || - !strcmp(type, "image/png"))) { - const unsigned char *data; - SilcUInt32 data_len; - data = silc_mime_get_data(usericon, &data_len); - if (data) { - /* TODO: Check if SILC gives us something to use as the checksum instead */ - purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len, NULL); - } - } - silc_mime_free(usericon); - } - } - - /* Save the public key path to buddy properties, as it is used - to identify the buddy in the network (and not the nickname). */ - memset(filename, 0, sizeof(filename)); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - - /* Update online status */ - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - - /* Finally, start watching this user so we receive its status - changes from the server */ - g_snprintf(filename2, sizeof(filename2) - 1, "+%s", filename); - silc_client_command_call(r->client, r->conn, NULL, "WATCH", "-pubkey", - filename2, NULL); - - silc_hash_free(hash); - silc_free(fingerprint); - silc_free(r->offline_pk); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_import(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &r->public_key)) { - silcpurple_add_buddy_ask_pk_cb(r, 0); - purple_notify_error(r->client->application, - _("Add Buddy"), _("Could not load public key"), NULL); - return; - } - - /* Now verify the public key */ - r->offline_pk = silc_pkcs_public_key_encode(r->public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, purple_buddy_get_name(r->b), - SILC_CONN_CLIENT, r->public_key, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_ask_pk_cancel(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id) -{ - if (id != 0) { - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - /* Open file selector to select the public key. */ - purple_request_file(r->client->application, _("Open..."), NULL, FALSE, - G_CALLBACK(silcpurple_add_buddy_ask_import), - G_CALLBACK(silcpurple_add_buddy_ask_pk_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); - -} - -static void -silcpurple_add_buddy_ask_pk(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - purple_buddy_get_name(r->b)); - purple_request_action(r->client->application, _("Add Buddy"), tmp, - _("To add the buddy you must import his/her public key. " - "Press Import to import a public key."), 0, - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r, 2, - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb), - _("_Import..."), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb)); -} - -static SilcBool -silcpurple_add_buddy_getkey_cb(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap) -{ - SilcPurpleBuddyRes r = context; - SilcClientEntry client_entry; - - if (status != SILC_STATUS_OK) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return FALSE; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry || !client_entry->public_key) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return FALSE; - } - - /* Now verify the public key */ - silcpurple_verify_public_key(r->client, r->conn, client_entry->nickname, - SILC_CONN_CLIENT, client_entry->public_key, - silcpurple_add_buddy_save, r); - return TRUE; -} - -static void -silcpurple_add_buddy_select_cb(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - PurpleRequestField *f; - GList *list; - SilcClientEntry client_entry; - SilcDList clients; - - f = purple_request_fields_get_field(fields, "list"); - list = purple_request_field_list_get_selected(f); - if (!list) { - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - client_entry = purple_request_field_list_get_data(f, list->data); - clients = silc_dlist_init(); - silc_dlist_add(clients, client_entry); - silcpurple_add_buddy_resolved(r->client, r->conn, SILC_STATUS_OK, - clients, r); - silc_dlist_uninit(clients); -} - -static void -silcpurple_add_buddy_select_cancel(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_select(SilcPurpleBuddyRes r, SilcDList clients) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512], tmp2[128]; - char *fingerprint; - SilcClientEntry client_entry; - - fields = purple_request_fields_new(); - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields_add_group(fields, g); - - silc_dlist_start(clients); - while ((client_entry = silc_dlist_get(clients))) { - fingerprint = NULL; - if (*client_entry->fingerprint) { - fingerprint = silc_fingerprint(client_entry->fingerprint, 20); - g_snprintf(tmp2, sizeof(tmp2), "\n%s", fingerprint); - } - g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s", - client_entry->realname, client_entry->nickname, - client_entry->username, *client_entry->hostname ? - client_entry->hostname : "", - fingerprint ? tmp2 : ""); - purple_request_field_list_add(f, tmp, client_entry); - silc_free(fingerprint); - } - - purple_request_fields(r->client->application, _("Add Buddy"), - _("Select correct user"), - r->pubkey_search - ? _("More than one user was found with the same public key. Select " - "the correct user from the list to add to the buddy list.") - : _("More than one user was found with the same name. Select " - "the correct user from the list to add to the buddy list."), - fields, - _("OK"), G_CALLBACK(silcpurple_add_buddy_select_cb), - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_select_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); -} - -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcAttributePayload pub; - SilcAttributeObjPk userpk; - const char *filename; - SilcClientEntry client_entry = NULL; - SilcUInt16 cmd_ident; - const char *name; - - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - - /* If the buddy is offline/nonexistent, we will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - if (!clients) { - if (r->init) { - silc_free(r); - return; - } - - r->offline = TRUE; - /* If the user has already associated a public key, try loading it - * before prompting the user to load it again */ - if (filename != NULL) - silcpurple_add_buddy_ask_import(r, filename); - else - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* If more than one client was found with nickname, we need to verify - from user which one is the correct. */ - if (silc_dlist_count(clients) > 1 && !r->pubkey_search) { - if (r->init) { - silc_free(r); - return; - } - - silcpurple_add_buddy_select(r, clients); - return; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - name = purple_buddy_get_name(b); - - /* If we searched using public keys and more than one entry was found - the same person is logged on multiple times. */ - if (silc_dlist_count(clients) > 1 && r->pubkey_search && name) { - if (r->init) { - /* Find the entry that closest matches to the - buddy nickname. */ - SilcClientEntry entry; - silc_dlist_start(clients); - while ((entry = silc_dlist_get(clients))) { - if (!g_ascii_strncasecmp(name, entry->nickname, - strlen(name))) { - client_entry = entry; - break; - } - } - } else { - /* Verify from user which one is correct */ - silcpurple_add_buddy_select(r, clients); - return; - } - } - - /* The client was found. Now get its public key and verify - that before adding the buddy. */ - memset(&userpk, 0, sizeof(userpk)); - purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id, sizeof(client_entry->id))); - r->client_id = client_entry->id; - - /* Get the public key from attributes, if not present then - resolve it with GETKEY unless we have it cached already. */ - if (client_entry->attrs && !client_entry->public_key) { - pub = silcpurple_get_attr(client_entry->attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY); - if (!pub || !silc_attribute_get_object(pub, (void *)&userpk, - sizeof(userpk))) { - /* Get public key with GETKEY */ - cmd_ident = - silc_client_command_call(client, conn, NULL, - "GETKEY", client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - cmd_ident, - silcpurple_add_buddy_getkey_cb, - r); - return; - } - if (!silc_pkcs_public_key_alloc(SILC_PKCS_SILC, - userpk.data, userpk.data_len, - &client_entry->public_key)) - return; - silc_free(userpk.data); - } else if (filename && !client_entry->public_key) { - if (!silc_pkcs_load_public_key(filename, &client_entry->public_key)) { - /* Get public key with GETKEY */ - cmd_ident = - silc_client_command_call(client, conn, NULL, - "GETKEY", client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - cmd_ident, - silcpurple_add_buddy_getkey_cb, - r); - return; - } - } else if (!client_entry->public_key) { - /* Get public key with GETKEY */ - cmd_ident = - silc_client_command_call(client, conn, NULL, - "GETKEY", client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - cmd_ident, - silcpurple_add_buddy_getkey_cb, - r); - return; - } - - /* We have the public key, verify it. */ - silcpurple_verify_public_key(client, conn, client_entry->nickname, - SILC_CONN_CLIENT, - client_entry->public_key, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPurpleBuddyRes r; - SilcBuffer attrs; - const char *filename, *name = purple_buddy_get_name(b); - - r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->client = client; - r->conn = conn; - r->b = b; - r->init = init; - - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - SilcPublicKey public_key; - SilcAttributeObjPk userpk; - - if (!silc_pkcs_load_public_key(filename, &public_key)) - return; - - /* Get all attributes, and use the public key to search user */ - name = NULL; - attrs = silc_client_attributes_request(SILC_ATTRIBUTE_USER_INFO, - SILC_ATTRIBUTE_SERVICE, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_ATTRIBUTE_STATUS_FREETEXT, - SILC_ATTRIBUTE_STATUS_MESSAGE, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_ATTRIBUTE_TIMEZONE, - SILC_ATTRIBUTE_GEOLOCATION, - SILC_ATTRIBUTE_USER_ICON, - SILC_ATTRIBUTE_DEVICE_INFO, 0); - userpk.type = "silc-rsa"; - userpk.data = silc_pkcs_public_key_encode(public_key, &userpk.data_len); - attrs = silc_attribute_payload_encode(attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY, - SILC_ATTRIBUTE_FLAG_VALID, - &userpk, sizeof(userpk)); - silc_free(userpk.data); - silc_pkcs_public_key_free(public_key); - r->pubkey_search = TRUE; - } else { - /* Get all attributes */ - attrs = silc_client_attributes_request(0); - } - - /* Resolve */ - silc_client_get_clients_whois(client, conn, name, NULL, attrs, - silcpurple_add_buddy_resolved, r); - silc_buffer_free(attrs); -} - -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - /* Don't add if the buddy is already on the list. - * - * SILC doesn't have groups, so we also don't need to do anything - * for a move. */ - if (purple_buddy_get_protocol_data(buddy) == NULL) - silcpurple_add_buddy_i(gc, buddy, FALSE); -} - -void silcpurple_send_buddylist(PurpleConnection *gc) -{ - GSList *buddies; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) - { - PurpleBuddy *buddy = buddies->data; - silcpurple_add_buddy_i(gc, buddy, TRUE); - } -} - -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - silc_free(purple_buddy_get_protocol_data(buddy)); -} - -void silcpurple_idle_set(PurpleConnection *gc, int idle) - -{ - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - SilcAttributeObjService service; - const char *server; - int port; - - sg = gc->proto_data; - if (sg == NULL) - return; - - client = sg->client; - if (client == NULL) - return; - - conn = sg->conn; - if (conn == NULL) - return; - - server = purple_account_get_string(sg->account, "server", - "silc.silcnet.org"); - port = purple_account_get_int(sg->account, "port", 706), - - memset(&service, 0, sizeof(service)); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - service.port = port; - g_snprintf(service.address, sizeof(service.address), "%s", server); - service.idle = idle; - silc_client_attribute_add(client, conn, SILC_ATTRIBUTE_SERVICE, - &service, sizeof(service)); -} - -char *silcpurple_status_text(PurpleBuddy *b) -{ - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = purple_buddy_get_protocol_data(b); - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return NULL; - - /* If user is online, we show the mood status, if available. - If user is offline or away that status is indicated. */ - - if (client_entry->mode & SILC_UMODE_DETACHED) - return g_strdup(_("Detached")); - if (client_entry->mode & SILC_UMODE_GONE) - return g_strdup(_("Away")); - if (client_entry->mode & SILC_UMODE_INDISPOSED) - return g_strdup(_("Indisposed")); - if (client_entry->mode & SILC_UMODE_BUSY) - return g_strdup(_("Busy")); - if (client_entry->mode & SILC_UMODE_PAGE) - return g_strdup(_("Wake Me Up")); - if (client_entry->mode & SILC_UMODE_HYPER) - return g_strdup(_("Hyper Active")); - if (client_entry->mode & SILC_UMODE_ROBOT) - return g_strdup(_("Robot")); - - attr = silcpurple_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - /* The mood is a bit mask, so we could show multiple moods, - but let's show only one for now. */ - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - return g_strdup(_("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - return g_strdup(_("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - return g_strdup(_("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - return g_strdup(_("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - return g_strdup(_("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - return g_strdup(_("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - return g_strdup(_("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - return g_strdup(_("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - return g_strdup(_("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - return g_strdup(_("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - return g_strdup(_("Anxious")); - } - - return NULL; -} - -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = purple_buddy_get_protocol_data(b); - SilcClientEntry client_entry; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - char tmp[256]; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return; - - if (client_entry->nickname) - purple_notify_user_info_add_pair(user_info, _("Nickname"), - client_entry->nickname); - if (client_entry->username && client_entry->hostname) { - g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - } - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - - if (statusstr) { - purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); - g_free(statusstr); - } - - if (full) { - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - } -} - -static void -silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; - - /* Call KILL */ - silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - purple_buddy_get_name(b), "Killed by operator", NULL); -} - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; -} *SilcPurpleBuddyWb; - -static void -silcpurple_buddy_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleBuddyWb wb = data; - silcpurple_wb_init(wb->sg, wb->client_entry); - silc_free(wb); -} - -GList *silcpurple_buddy_menu(PurpleBuddy *buddy) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *pkfile = NULL; - SilcClientEntry client_entry = NULL; - PurpleMenuAction *act; - GList *m = NULL; - SilcPurpleBuddyWb wb; - - pkfile = purple_blist_node_get_string((PurpleBlistNode *) buddy, "public-key"); - client_entry = silc_client_get_client_by_id(sg->client, - sg->conn, - purple_buddy_get_protocol_data(buddy)); - - if (client_entry && - silc_client_private_message_key_is_set(sg->client, - sg->conn, client_entry)) { - act = purple_menu_action_new(_("Reset IM Key"), - PURPLE_CALLBACK(silcpurple_buddy_resetkey), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("IM with Key Exchange"), - PURPLE_CALLBACK(silcpurple_buddy_keyagr), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("IM with Password"), - PURPLE_CALLBACK(silcpurple_buddy_privkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (pkfile) { - act = purple_menu_action_new(_("Show Public Key"), - PURPLE_CALLBACK(silcpurple_buddy_showkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("Get Public Key..."), - PURPLE_CALLBACK(silcpurple_buddy_getkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (conn && conn->local_entry->mode & SILC_UMODE_ROUTER_OPERATOR) { - act = purple_menu_action_new(_("Kill User"), - PURPLE_CALLBACK(silcpurple_buddy_kill), - NULL, NULL); - m = g_list_append(m, act); - } - - if (client_entry) { - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->client_entry = client_entry; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_buddy_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - return m; -} - -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcMime mime; - char type[32]; - const char *t; - - /* Remove */ - if (!img) { - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_ICON, NULL); - return; - } - - /* Add */ - mime = silc_mime_alloc(); - if (!mime) - return; - - t = purple_imgstore_get_extension(img); - if (!t || !strcmp(t, "icon")) { - silc_mime_free(mime); - return; - } - if (!strcmp(t, "jpg")) - t = "jpeg"; - g_snprintf(type, sizeof(type), "image/%s", t); - silc_mime_add_field(mime, "Content-Type", type); - silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img)); - - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_ICON, mime, sizeof(*mime)); - - silc_mime_free(mime); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1434 +0,0 @@ -/* - - silcpurple_chat.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Channel Routines ******************************/ - -GList *silcpurple_chat_info(PurpleConnection *gc) -{ - GList *ci = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - ci = g_list_append(ci, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Passphrase:"); - pce->identifier = "passphrase"; - pce->secret = TRUE; - ci = g_list_append(ci, pce); - - return ci; -} - -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); - -static void -silcpurple_chat_getinfo_res(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList channels, - void *context) -{ - GHashTable *components = context; - PurpleConnection *gc = client->application; - const char *chname; - char tmp[256]; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - - if (!channels) { - g_snprintf(tmp, sizeof(tmp), - _("Channel %s does not exist in the network"), chname); - purple_notify_error(gc, _("Channel Information"), - _("Cannot get channel information"), tmp); - return; - } - - silcpurple_chat_getinfo(gc, components); -} - - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) -{ - SilcPurple sg = gc->proto_data; - const char *chname; - char tmp[256], *tmp2; - GString *s; - SilcChannelEntry channel; - SilcHashTableList htl; - SilcChannelUser chu; - - if (!components) - return; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - silc_client_get_channel_resolve(sg->client, sg->conn, - (char *)chname, - silcpurple_chat_getinfo_res, - components); - return; - } - - s = g_string_new(""); - tmp2 = g_markup_escape_text(channel->channel_name, -1); - g_string_append_printf(s, _("Channel Name: %s"), tmp2); - g_free(tmp2); - if (channel->user_list && silc_hash_table_count(channel->user_list)) - g_string_append_printf(s, _("
User Count: %d"), - (int)silc_hash_table_count(channel->user_list)); - - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - tmp2 = g_markup_escape_text(chu->client->nickname, -1); - g_string_append_printf(s, _("
Channel Founder: %s"), - tmp2); - g_free(tmp2); - break; - } - } - silc_hash_table_list_reset(&htl); - - if (channel->cipher) - g_string_append_printf(s, _("
Channel Cipher: %s"), - channel->cipher); - - if (channel->hmac) - /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ - g_string_append_printf(s, _("
Channel HMAC: %s"), - channel->hmac); - - if (channel->topic) { - tmp2 = g_markup_escape_text(channel->topic, -1); - g_string_append_printf(s, _("
Channel Topic:
%s"), tmp2); - g_free(tmp2); - } - - if (channel->mode) { - g_string_append_printf(s, _("
Channel Modes: ")); - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - g_string_append(s, tmp); - } - - if (channel->founder_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); - if (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - g_string_append_printf(s, _("
Founder Key Fingerprint:
%s"), fingerprint); - g_string_append_printf(s, _("
Founder Key Babbleprint:
%s"), babbleprint); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - } - - purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, s->str, NULL, NULL); - g_string_free(s, TRUE); -} - - -static void -silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat = (PurpleChat *)node; - PurpleAccount *account = purple_chat_get_account(chat); - silcpurple_chat_getinfo(purple_account_get_connection(account), - purple_chat_get_components(chat)); -} - - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ -/************************** Channel Invite List ******************************/ - -static void -silcpurple_chat_invitelist(PurpleBlistNode *node, gpointer data); -{ - -} - - -/**************************** Channel Ban List *******************************/ - -static void -silcpurple_chat_banlist(PurpleBlistNode *node, gpointer data); -{ - -} -#endif - - -/************************* Channel Authentication ****************************/ - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; - PurpleChat *c; - SilcDList pubkeys; -} *SilcPurpleChauth; - -static void -silcpurple_chat_chpk_add(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - unsigned char mode[4]; - SilcUInt32 m; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key)) { - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_dlist_uninit(sgc->pubkeys); - silc_free(sgc); - purple_notify_error(client->application, - _("Add Channel Public Key"), - _("Could not load public key"), NULL); - return; - } - - pk = silc_public_key_payload_encode(public_key); - chpks = silc_buffer_alloc_size(2); - SILC_PUT16_MSB(1, chpks->head); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - silc_buffer_len(pk), 0x00); - silc_buffer_free(pk); - - m = sgc->channel->mode; - m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - silcpurple_command_reply, NULL, 3, - 1, chidp->data, silc_buffer_len(chidp), - 2, mode, sizeof(mode), - 9, chpks->data, silc_buffer_len(chpks)); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cancel(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPublicKey public_key; - - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - GList *list; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - SilcUInt16 c = 0, ct; - unsigned char mode[4]; - SilcUInt32 m; - - f = purple_request_fields_get_field(fields, "list"); - if (!purple_request_field_list_get_selected(f)) { - /* Add new public key */ - purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, - G_CALLBACK(silcpurple_chat_chpk_add), - G_CALLBACK(silcpurple_chat_chpk_cancel), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - - list = purple_request_field_list_get_items(f); - chpks = silc_buffer_alloc_size(2); - - for (ct = 0; list; list = list->next, ct++) { - public_key = purple_request_field_list_get_data(f, list->data); - if (purple_request_field_list_is_selected(f, list->data)) { - /* Delete this public key */ - pk = silc_public_key_payload_encode(public_key); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - silc_buffer_len(pk), 0x01); - silc_buffer_free(pk); - c++; - } - } - if (!c) { - silc_buffer_free(chpks); - return; - } - SILC_PUT16_MSB(c, chpks->head); - - m = sgc->channel->mode; - if (ct == c) - m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - silcpurple_command_reply, NULL, 3, - 1, chidp->data, silc_buffer_len(chidp), - 2, mode, sizeof(mode), - 9, chpks->data, silc_buffer_len(chpks)); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -static void -silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - PurpleRequestField *f; - SilcPublicKey public_key; - const char *curpass, *val; - int set; - - f = purple_request_fields_get_field(fields, "passphrase"); - val = purple_request_field_string_get_value(f); - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - if (!val && curpass) - set = 0; - else if (val && !curpass) - set = 1; - else if (val && curpass && strcmp(val, curpass)) - set = 1; - else - set = -1; - - if (set == 1) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "+a", val, NULL); - purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); - } else if (set == 0) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "-a", NULL); - purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); - } - - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcDList channel_pubkeys) -{ - SilcPublicKey public_key; - SilcSILCPublicKey silc_pubkey; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint, *babbleprint; - SilcPublicKeyIdentifier ident; - char tmp2[1024], t[512]; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcPurpleChauth sgc; - const char *curpass = NULL; - - sgc = silc_calloc(1, sizeof(*sgc)); - if (!sgc) - return; - sgc->sg = sg; - sgc->channel = channel; - - fields = purple_request_fields_new(); - - if (sgc->c) - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), - curpass, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l1", _("Channel Public Keys List")); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(t, sizeof(t), - _("Channel authentication is used to secure the channel from " - "unauthorized access. The authentication may be based on " - "passphrase and digital signatures. If passphrase is set, it " - "is required to be able to join. If channel public keys are set " - "then only users whose public keys are listed are able to join.")); - - if (!channel_pubkeys || !silc_dlist_count(channel_pubkeys)) { - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - if (channel_pubkeys) - silc_dlist_uninit(channel_pubkeys); - return; - } - sgc->pubkeys = channel_pubkeys; - - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - silc_dlist_start(channel_pubkeys); - while ((public_key = silc_dlist_get(channel_pubkeys))) { - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - continue; - fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); - babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); - - silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key); - ident = &silc_pubkey->identifier; - - g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", - ident->realname ? ident->realname : ident->username ? - ident->username : "", fingerprint, babbleprint); - purple_request_field_list_add(f, tmp2, public_key); - - silc_free(fingerprint); - silc_free(babbleprint); - } - - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); -} - -static void -silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+C", NULL); -} - - -/************************** Channel Private Groups **************************/ - -/* Private groups are "virtual" channels. They are groups inside a channel. - This is implemented by using channel private keys. By knowing a channel - private key user becomes part of that group and is able to talk on that - group. Other users, on the same channel, won't be able to see the - messages of that group. It is possible to have multiple groups inside - a channel - and thus having multiple private keys on the channel. */ - -typedef struct { - SilcPurple sg; - PurpleChat *c; - const char *channel; -} *SilcPurpleCharPrv; - -static void -silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - SilcPurple sg = p->sg; - char tmp[512]; - PurpleRequestField *f; - const char *name, *passphrase, *alias; - GHashTable *comp; - PurpleGroup *g; - PurpleChat *cn; - - f = purple_request_fields_get_field(fields, "name"); - name = purple_request_field_string_get_value(f); - if (!name) { - silc_free(p); - return; - } - f = purple_request_fields_get_field(fields, "passphrase"); - passphrase = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "alias"); - alias = purple_request_field_string_get_value(f); - - /* Add private group to buddy list */ - g_snprintf(tmp, sizeof(tmp), "%s [Private Group]", name); - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_replace(comp, "channel", g_strdup(tmp)); - g_hash_table_replace(comp, "passphrase", g_strdup(passphrase)); - - cn = purple_chat_new(sg->account, alias, comp); - g = purple_chat_get_group(p->c); - purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); - - /* Associate to a real channel */ - purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); - - /* Join the group */ - silcpurple_chat_join(sg->gc, comp); - - silc_free(p); -} - -static void -silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - silc_free(p); -} - -static void -silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleCharPrv p; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->sg = sg; - - p->channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); - p->c = purple_blist_find_chat(sg->account, p->channel); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("name", _("Group Name"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("passphrase", _("Passphrase"), - NULL, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("alias", _("Alias"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(tmp, sizeof(tmp), - _("Please enter the %s channel private group name and passphrase."), - p->channel); - purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, - _("Add"), G_CALLBACK(silcpurple_chat_prv_add), - _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), - purple_connection_get_account(gc), NULL, NULL, p); -} - - -/****************************** Channel Modes ********************************/ - -static void -silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-f", NULL); -} - -static void -silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - const char *channel; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - if (!sg->conn) - return; - - /* XXX we should have ability to define which founder - key to use. Now we use the user's own public key - (default key). */ - - /* Call CMODE */ - channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, - "+f", NULL); -} - -typedef struct { - SilcPurple sg; - char *channel; -} *SilcPurpleChatInput; - -static void -silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) -{ - SilcChannelEntry channel; - int ulimit = 0; - - channel = silc_client_get_channel(s->sg->client, s->sg->conn, - (char *)s->channel); - if (!channel) - return; - if (limit) - ulimit = atoi(limit); - - if (!limit || !(*limit) || *limit == '0') { - if (limit && ulimit == channel->user_limit) { - g_free(s->channel); - silc_free(s); - return; - } - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "-l", NULL); - - g_free(s->channel); - silc_free(s); - return; - } - - if (ulimit == channel->user_limit) { - g_free(s->channel); - silc_free(s); - return; - } - - /* Call CMODE */ - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "+l", limit, NULL); - - g_free(s->channel); - silc_free(s); -} - -static void -silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleChatInput s; - SilcChannelEntry channel; - char *ch; - char tmp[32]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - if (!sg->conn) - return; - - ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); - channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); - if (!channel) - return; - - s = silc_calloc(1, sizeof(*s)); - if (!s) - return; - s->channel = ch; - s->sg = sg; - g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); - purple_request_input(gc, _("User Limit"), NULL, - _("Set user limit on channel. Set to zero to reset user limit."), - tmp, FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), - _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), - purple_connection_get_account(gc), NULL, NULL, s); -} - -static void -silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-t", NULL); -} - -static void -silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+t", NULL); -} - -static void -silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-p", NULL); -} - -static void -silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+p", NULL); -} - -static void -silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-s", NULL); -} - -static void -silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+s", NULL); -} - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; -} *SilcPurpleChatWb; - -static void -silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleChatWb wb = data; - silcpurple_wb_init_ch(wb->sg, wb->channel); - silc_free(wb); -} - -GList *silcpurple_chat_menu(PurpleChat *chat) -{ - GHashTable *components = purple_chat_get_components(chat); - PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *chname = NULL; - SilcChannelEntry channel = NULL; - SilcChannelUser chu = NULL; - SilcUInt32 mode = 0; - - GList *m = NULL; - PurpleMenuAction *act; - - if (components) - chname = g_hash_table_lookup(components, "channel"); - if (chname) - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (channel) { - chu = silc_client_on_channel(channel, conn->local_entry); - if (chu) - mode = chu->mode; - } - - if (strstr(chname, "[Private Group]")) - return NULL; - - act = purple_menu_action_new(_("Get Info"), - PURPLE_CALLBACK(silcpurple_chat_getinfo_menu), - NULL, NULL); - m = g_list_append(m, act); - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Invite List"), - PURPLE_CALLBACK(silcpurple_chat_invitelist), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Ban List"), - PURPLE_CALLBACK(silcpurple_chat_banlist), - NULL, NULL); - m = g_list_append(m, act); - } -#endif - - if (chu) { - act = purple_menu_action_new(_("Add Private Group"), - PURPLE_CALLBACK(silcpurple_chat_prv), - NULL, NULL); - m = g_list_append(m, act); - } - - if (chu && mode & SILC_CHANNEL_UMODE_CHANFO) { - act = purple_menu_action_new(_("Channel Authentication"), - PURPLE_CALLBACK(silcpurple_chat_chauth), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { - act = purple_menu_action_new(_("Reset Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent_reset), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (chu && mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Set User Limit"), - PURPLE_CALLBACK(silcpurple_chat_ulimit), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { - act = purple_menu_action_new(_("Reset Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_resettopic), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_settopic), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { - act = purple_menu_action_new(_("Reset Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetprivate), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_setprivate), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_SECRET) { - act = purple_menu_action_new(_("Reset Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetsecret), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_setsecret), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (chu && channel) { - SilcPurpleChatWb wb; - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->channel = channel; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_chat_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - - return m; -} - - -/******************************* Joining Etc. ********************************/ - -char *silcpurple_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - const char *channel, *passphrase, *parentch; - - if (!conn) - return; - - channel = g_hash_table_lookup(data, "channel"); - passphrase = g_hash_table_lookup(data, "passphrase"); - - /* Check if we are joining a private group. Handle it - purely locally as it's not a real channel */ - if (strstr(channel, "[Private Group]")) { - SilcChannelEntry channel_entry; - SilcChannelPrivateKey key; - PurpleChat *c; - SilcPurplePrvgrp grp; - - c = purple_blist_find_chat(sg->account, channel); - parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); - if (!parentch) - return; - - channel_entry = silc_client_get_channel(sg->client, sg->conn, - (char *)parentch); - if (!channel_entry || - !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), - _("You have to join the %s channel before you are " - "able to join the private group"), parentch); - purple_notify_error(gc, _("Join Private Group"), - _("Cannot join private group"), tmp); - return; - } - - /* Add channel private key */ - if (!silc_client_add_channel_private_key(client, conn, - channel_entry, channel, - NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), &key)) - return; - - /* Join the group */ - grp = silc_calloc(1, sizeof(*grp)); - if (!grp) - return; - grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; - grp->chid = SILC_PTR_TO_32(channel_entry->context); - grp->parentch = parentch; - grp->channel = channel; - grp->key = key; - sg->grps = g_list_append(sg->grps, grp); - serv_got_joined_chat(gc, grp->id, channel); - return; - } - - /* XXX We should have other properties here as well: - 1. whether to try to authenticate to the channel - 1a. with default key, - 1b. with specific key. - 2. whether to try to authenticate to become founder. - 2a. with default key, - 2b. with specific key. - - Since now such variety is not possible in the join dialog - we always use -founder and -auth options, which try to - do both 1 and 2 with default keys. */ - - /* Call JOIN */ - if ((passphrase != NULL) && (*passphrase != '\0')) - silc_client_command_call(client, conn, NULL, "JOIN", - channel, passphrase, "-auth", "-founder", NULL); - else - silc_client_command_call(client, conn, NULL, "JOIN", - channel, "-auth", "-founder", NULL); -} - -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if we are inviting on a private group. Invite - to the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call INVITE */ - silc_client_command_call(client, conn, NULL, "INVITE", - chu->channel->channel_name, - name, NULL); -} - -void silcpurple_chat_leave(PurpleConnection *gc, int id) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - GList *l; - SilcPurplePrvgrp prv; - - if (!conn) - return; - - /* See if we are leaving a private group */ - if (id > SILCPURPLE_PRVGRP) { - SilcChannelEntry channel; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) - return; - silc_client_del_channel_private_key(client, conn, - channel, prv->key); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - serv_got_chat_left(gc, id); - return; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call LEAVE */ - silc_client_command_call(client, conn, NULL, "LEAVE", - chu->channel->channel_name, NULL); - - serv_got_chat_left(gc, id); - - /* Leave from private groups on this channel as well */ - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->chid == id) { - prv = l->data; - silc_client_del_channel_private_key(client, conn, - chu->channel, - prv->key); - serv_got_chat_left(gc, prv->id); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - if (!sg->grps) - break; - } -} - -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, - PurpleMessageFlags msgflags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - SilcChannelEntry channel = NULL; - SilcChannelPrivateKey key = NULL; - SilcUInt32 flags; - int ret = 0; - char *msg2, *tmp; - gboolean found = FALSE; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - SilcDList list; - - if (!msg || !conn) - return 0; - - flags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg2 = purple_unescape_html(msg); - - if (!g_ascii_strncasecmp(msg2, "/me ", 4)) - { - msg2 += 4; - if (!*msg2) { - g_free(tmp); - return 0; - } - flags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (sign) - flags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Get the channel private key if we are sending on - private group */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) { - g_free(tmp); - return 0; - } - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) { - g_free(tmp); - return 0; - } - key = prv->key; - } - - if (!channel) { - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) { - g_free(tmp); - return 0; - } - channel = chu->channel; - } - - /* Check for images */ - if (msgflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(msg, &flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_channel_message(client, conn, - channel, key, - flags, sg->sha1hash, - buf->data, - silc_buffer_len(buf)); - silc_mime_partial_free(list); - g_free(tmp); - - if (ret) - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, time(NULL)); - return ret; - } - } - - /* Send channel message */ - ret = silc_client_send_channel_message(client, conn, channel, key, - flags, sg->sha1hash, - (unsigned char *)msg2, - strlen(msg2)); - if (ret) { - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, - time(NULL)); - } - g_free(tmp); - - return ret; -} - -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if setting topic on private group. Set it - on the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call TOPIC */ - silc_client_command_call(client, conn, NULL, "TOPIC", - chu->channel->channel_name, topic, NULL); -} - -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - GList *fields = NULL; - PurpleRoomlistField *f; - - if (!conn) - return NULL; - - if (sg->roomlist) - purple_roomlist_unref(sg->roomlist); - - sg->roomlist_canceled = FALSE; - - sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, - _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, - _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - purple_roomlist_set_fields(sg->roomlist, fields); - - /* Call LIST */ - silc_client_command_call(client, conn, "LIST"); - - purple_roomlist_set_in_progress(sg->roomlist, TRUE); - - return sg->roomlist; -} - -void silcpurple_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - if (sg->roomlist == list) { - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - sg->roomlist_canceled = TRUE; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,488 +0,0 @@ -/* - - silcpurple_ft.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" - -/****************************** File Transfer ********************************/ - -/* This implements the secure file transfer protocol (SFTP) using the SILC - SFTP library implementation. The API we use from the SILC Toolkit is the - SILC Client file transfer API, as it provides a simple file transfer we - need in this case. We could use the SILC SFTP API directly, but it would - be an overkill since we'd effectively re-implement the file transfer what - the SILC Client's file transfer API already provides. - - From Purple we do NOT use the FT API to do the transfer as it is very limiting. - In fact it does not suite to file transfers like SFTP at all. For example, - it assumes that read operations are synchronous what they are not in SFTP. - It also assumes that the file transfer socket is to be handled by the Purple - eventloop, and this naturally is something we don't want to do in case of - SILC Toolkit. The FT API suites well to purely stream based file transfers - like HTTP GET and similar. - - For this reason, we directly access the Purple GKT FT API and hack the FT - API to merely provide the user interface experience and all the magic - is done in the SILC Toolkit. Ie. we update the statistics information in - the FT API for user interface, and that's it. A bit dirty but until the - FT API gets better this is the way to go. Good thing that FT API allowed - us to do this. */ - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; - SilcUInt32 session_id; - char *hostname; - SilcUInt16 port; - PurpleXfer *xfer; - - SilcClientFileName completion; - void *completion_context; -} *SilcPurpleXfer; - -static void -silcpurple_ftp_monitor(SilcClient client, - SilcClientConnection conn, - SilcClientMonitorStatus status, - SilcClientFileError error, - SilcUInt64 offset, - SilcUInt64 filesize, - SilcClientEntry client_entry, - SilcUInt32 session_id, - const char *filepath, - void *context) -{ - SilcPurpleXfer xfer = context; - PurpleConnection *gc = xfer->sg->gc; - char tmp[256]; - - if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { - /* All started sessions terminate here */ - xfer->xfer->data = NULL; - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_DISCONNECT) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Remote disconnected")); - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(client, conn, session_id); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) - return; - - if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { - if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { - g_snprintf(tmp, sizeof(tmp), "No such file %s", - filepath ? filepath : "[N/A]"); - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), tmp); - } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Permission denied")); - } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Key agreement failed")); - } else if (error == SILC_CLIENT_FILE_TIMEOUT) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Connection timed out")); - } else if (error == SILC_CLIENT_FILE_CONNECT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Creating connection failed")); - } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("File transfer session does not exist")); - } - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(client, conn, session_id); - return; - } - - /* Update file transfer UI */ - if (!offset && filesize) - purple_xfer_set_size(xfer->xfer, filesize); - if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; - } - purple_xfer_update_progress(xfer->xfer); - - if (status == SILC_CLIENT_FILE_MONITOR_SEND || - status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { - if (offset == filesize) { - /* Download finished */ - purple_xfer_set_completed(xfer->xfer, TRUE); - silc_client_file_close(client, conn, session_id); - } - } -} - -static void -silcpurple_ftp_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - if (!xfer) - return; - - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - if (!xfer) - return; - - /* Cancel the transmission */ - xfer->completion(NULL, xfer->completion_context); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_ok(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - - if (!xfer) - return; - - name = purple_xfer_get_local_filename(x); - g_unlink(name); - xfer->completion(name, xfer->completion_context); -} - -static void -silcpurple_ftp_ask_name(SilcClient client, - SilcClientConnection conn, - SilcUInt32 session_id, - const char *remote_filename, - SilcClientFileName completion, - void *completion_context, - void *context) -{ - SilcPurpleXfer xfer = context; - - xfer->completion = completion; - xfer->completion_context = completion_context; - - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_ask_name_ok); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_ask_name_cancel); - - /* Request to save the file */ - purple_xfer_set_filename(xfer->xfer, remote_filename); - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_request_result(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - SilcClientFileError status; - PurpleConnection *gc = xfer->sg->gc; - SilcClientConnectionParams params; - gboolean local = xfer->hostname ? FALSE : TRUE; - char *local_ip = NULL, *remote_ip = NULL; - SilcSocket sock; - - if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) - return; - if (!xfer) - return; - - silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), - &sock, NULL, NULL, NULL); - - if (local) { - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = TRUE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - } - - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - if (local) - /* Provide connection point */ - params.local_ip = local_ip; - - /* Start the file transfer */ - status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn, - ¶ms, xfer->sg->public_key, - xfer->sg->private_key, - silcpurple_ftp_monitor, xfer, - NULL, xfer->session_id, - silcpurple_ftp_ask_name, xfer); - switch (status) { - case SILC_CLIENT_FILE_OK: - silc_free(local_ip); - silc_free(remote_ip); - return; - break; - - case SILC_CLIENT_FILE_UNKNOWN_SESSION: - purple_notify_error(gc, _("Secure File Transfer"), - _("No file transfer session active"), NULL); - break; - - case SILC_CLIENT_FILE_ALREADY_STARTED: - purple_notify_error(gc, _("Secure File Transfer"), - _("File transfer already started"), NULL); - break; - - case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not perform key agreement for file transfer"), - NULL); - break; - - default: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not start the file transfer"), NULL); - break; - } - - /* Error */ - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_request_denied(PurpleXfer *x) -{ - -} - -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleXfer xfer; - - xfer = silc_calloc(1, sizeof(*xfer)); - if (!xfer) { - silc_client_file_close(sg->client, sg->conn, session_id); - return; - } - - xfer->sg = sg; - xfer->client_entry = client_entry; - xfer->session_id = session_id; - xfer->hostname = g_strdup(hostname); - xfer->port = port; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_RECEIVE, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_request_result); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); - xfer->xfer->remote_ip = g_strdup(hostname); - xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; - - /* File transfer request */ - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_send_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - if (!xfer) - return; - - /* This call will free all resources */ - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_send(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - SilcClientConnectionParams params; - SilcSocket sock; - - if (!xfer) - return; - - name = purple_xfer_get_local_filename(x); - - silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), - &sock, NULL, NULL, NULL); - - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = FALSE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - if (local) - /* Provide connection point */ - params.local_ip = local_ip; - - /* Send the file */ - silc_client_file_send(xfer->sg->client, xfer->sg->conn, - xfer->client_entry, ¶ms, - xfer->sg->public_key, xfer->sg->private_key, - silcpurple_ftp_monitor, xfer, - name, &xfer->session_id); - - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_send_file_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - PurpleConnection *gc = client->application; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(gc, _("Secure File Transfer"), - _("Cannot send file"), tmp); - g_free(context); - return; - } - - silcpurple_ftp_send_file(client->application, (const char *)context, NULL); - g_free(context); -} - -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcDList clients; - SilcPurpleXfer xfer; - - g_return_val_if_fail(name != NULL, NULL); - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, name, FALSE); - if (!clients) { - silc_client_get_clients(client, conn, name, NULL, - silcpurple_ftp_send_file_resolved, - g_strdup(name)); - return NULL; - } - silc_dlist_start(clients); - - xfer = silc_calloc(1, sizeof(*xfer)); - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->sg = sg; - xfer->client_entry = silc_dlist_get(clients); - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_SEND, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_free(xfer); - return NULL; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; - - silc_free(clients); - - return xfer->xfer; -} - -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file) -{ - PurpleXfer *xfer = silcpurple_ftp_new_xfer(gc, name); - - g_return_if_fail(xfer != NULL); - - /* Choose file to send */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SILCSOURCES = \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - silc.c \ - silcpurple.h \ - util.c \ - wb.c \ - wb.h - -AM_CFLAGS = $(st) - -libsilcpurple_la_LDFLAGS = -module -avoid-version - -if STATIC_SILC - -st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -noinst_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -libsilcpurple_la_LIBADD = $(SILC_LIBS) - -else - -st = $(SILC_CFLAGS) -pkg_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,813 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/silc -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_SILC_FALSE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@STATIC_SILC_TRUE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_TRUE@ $(am__DEPENDENCIES_1) -am__libsilcpurple_la_SOURCES_DIST = buddy.c chat.c ft.c ops.c pk.c \ - silc.c silcpurple.h util.c wb.c wb.h -am__objects_1 = libsilcpurple_la-buddy.lo libsilcpurple_la-chat.lo \ - libsilcpurple_la-ft.lo libsilcpurple_la-ops.lo \ - libsilcpurple_la-pk.lo libsilcpurple_la-silc.lo \ - libsilcpurple_la-util.lo libsilcpurple_la-wb.lo -@STATIC_SILC_FALSE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -@STATIC_SILC_TRUE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -libsilcpurple_la_OBJECTS = $(am_libsilcpurple_la_OBJECTS) -@STATIC_SILC_FALSE@am_libsilcpurple_la_rpath = -rpath $(pkgdir) -@STATIC_SILC_TRUE@am_libsilcpurple_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsilcpurple_la_SOURCES) -DIST_SOURCES = $(am__libsilcpurple_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -SILCSOURCES = \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - silc.c \ - silcpurple.h \ - util.c \ - wb.c \ - wb.h - -AM_CFLAGS = $(st) -libsilcpurple_la_LDFLAGS = -module -avoid-version -@STATIC_SILC_FALSE@st = $(SILC_CFLAGS) -@STATIC_SILC_TRUE@st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -@STATIC_SILC_TRUE@noinst_LTLIBRARIES = libsilcpurple.la -@STATIC_SILC_FALSE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SILC_FALSE@libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) -@STATIC_SILC_TRUE@libsilcpurple_la_LIBADD = $(SILC_LIBS) -@STATIC_SILC_FALSE@pkg_LTLIBRARIES = libsilcpurple.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/silc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/silc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsilcpurple.la: $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_DEPENDENCIES) - $(LINK) $(am_libsilcpurple_la_rpath) $(libsilcpurple_la_LDFLAGS) $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ops.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-pk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-silc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-wb.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsilcpurple_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" "$(DEPDIR)/libsilcpurple_la-buddy.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libsilcpurple_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libsilcpurple_la-chat.lo: chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-chat.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-chat.Tpo" -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo" "$(DEPDIR)/libsilcpurple_la-chat.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chat.c' object='libsilcpurple_la-chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c - -libsilcpurple_la-ft.lo: ft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ft.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ft.Tpo" -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo" "$(DEPDIR)/libsilcpurple_la-ft.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ft.c' object='libsilcpurple_la-ft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c - -libsilcpurple_la-ops.lo: ops.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ops.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ops.Tpo" -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo" "$(DEPDIR)/libsilcpurple_la-ops.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ops.c' object='libsilcpurple_la-ops.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c - -libsilcpurple_la-pk.lo: pk.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-pk.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-pk.Tpo" -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo" "$(DEPDIR)/libsilcpurple_la-pk.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pk.c' object='libsilcpurple_la-pk.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c - -libsilcpurple_la-silc.lo: silc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-silc.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-silc.Tpo" -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo" "$(DEPDIR)/libsilcpurple_la-silc.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='silc.c' object='libsilcpurple_la-silc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c - -libsilcpurple_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-util.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-util.Tpo" -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-util.Tpo" "$(DEPDIR)/libsilcpurple_la-util.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libsilcpurple_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -libsilcpurple_la-wb.lo: wb.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-wb.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-wb.Tpo" -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo" "$(DEPDIR)/libsilcpurple_la-wb.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wb.c' object='libsilcpurple_la-wb.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsilc protocol plugin -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = libsilc -NEEDED_DLLS = $(SILC_TOOLKIT)/bin/libsilc-1-1-2.dll \ - $(SILC_TOOLKIT)/bin/libsilcclient-1-1-2.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(SILC_TOOLKIT)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(SILC_TOOLKIT)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = silc.c \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - util.c \ - wb.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lsilc \ - -lsilcclient - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--image-base,0x74000000 -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ops.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ops.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ops.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/ops.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1874 +0,0 @@ -/* - - silcpurple_ops.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" -#include "wb.h" - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcChannelPrivateKey key, SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context); - -/* Message sent to the application by library. `conn' associates the - message to a specific connection. `conn', however, may be NULL. - The `type' indicates the type of the message sent by the library. - The application can for example filter the message according the - type. */ - -void silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...) -{ - char tmp[256]; - va_list va; - PurpleConnection *gc = NULL; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - - va_start(va, msg); - silc_vsnprintf(tmp, sizeof(tmp), msg, va); - va_end(va); - - if (type != SILC_CLIENT_MESSAGE_ERROR) { - purple_debug_misc("silc", "silc_say (%d) %s\n", type, tmp); - return; - } - - purple_debug_error("silc", "silc_say error: %s\n", tmp); - - if (!strcmp(tmp, "Authentication failed")) - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - - if (client != NULL) - gc = client->application; - - if (gc != NULL) - purple_connection_error_reason(gc, reason, tmp); - else - purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp); -} - -/* Processes incoming MIME message. Can be private message or channel - message. Returns TRUE if the message `mime' was displayed. */ - -static SilcBool -silcpurple_mime_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, SilcMime mime, - gboolean recursive) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *type; - const unsigned char *data; - SilcUInt32 data_len; - PurpleMessageFlags cflags = 0; - PurpleConversation *convo = NULL; - SilcBool ret = FALSE; - - if (!mime) - return FALSE; - - /* Check for fragmented MIME message */ - if (silc_mime_is_partial(mime)) { - if (!sg->mimeass) - sg->mimeass = silc_mime_assembler_alloc(); - - /* Defragment */ - mime = silc_mime_assemble(sg->mimeass, mime); - if (!mime) - /* More fragments to come */ - return FALSE; - - /* Process the complete message */ - return silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, mime, - FALSE); - } - - /* Check for multipart message */ - if (silc_mime_is_multipart(mime)) { - SilcMime p; - const char *mtype; - SilcDList parts = silc_mime_get_multiparts(mime, &mtype); - SilcBool ret; - - if (!strcmp(mtype, "mixed")) { - /* Contains multiple messages */ - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Recursively process parts */ - ret = silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE); - } - } - - if (!strcmp(mtype, "alternative")) { - /* Same message in alternative formats. Kopete sends - these. Go in order from last to first. */ - silc_dlist_end(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Go through the alternatives and display the first - one we support. */ - if (silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE)) { - ret = TRUE; - break; - } - } - } - - goto out; - } - - /* Get content type and MIME data */ - type = silc_mime_get_field(mime, "Content-Type"); - if (!type) - goto out; - data = silc_mime_get_data(mime, &data_len); - if (!data) - goto out; - - /* Process according to content type */ - - /* Plain text */ - if (strstr(type, "text/plain")) { - /* Default is UTF-8, don't check for other charsets */ - if (!strstr(type, "utf-8")) - goto out; - - if (channel) - silc_channel_message(client, conn, sender, channel, - payload, key, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - else - silc_private_message(client, conn, sender, payload, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - ret = TRUE; - goto out; - } - - /* Image */ - if (strstr(type, "image/png") || - strstr(type, "image/jpeg") || - strstr(type, "image/gif") || - strstr(type, "image/tiff")) { - char tmp[32]; - int imgid; - - /* Get channel convo (if message is for channel) */ - if (key && channel) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (channel && !convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (channel && !convo) - goto out; - - imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); - if (imgid) { - cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; - g_snprintf(tmp, sizeof(tmp), "", imgid); - - if (channel) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : - "", cflags, - tmp, time(NULL)); - else - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, cflags, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - cflags = 0; - ret = TRUE; - } - goto out; - } - - /* Whiteboard message */ - if (strstr(type, "application/x-wb") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) { - if (channel) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); - else - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); - ret = TRUE; - goto out; - } - - out: - if (!recursive) - silc_mime_free(mime); - return ret; -} - -/* Message for a channel. The `sender' is the sender of the message - The `channel' is the channel. The `message' is the message. Note - that `message' maybe NULL. The `flags' indicates message flags - and it is used to determine how the message can be interpreted - (like it may tell the message is multimedia message). */ - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcChannelPrivateKey key, SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (key) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (!convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(NULL, message, message_len); - silcpurple_mime_message(client, conn, sender, channel, payload, - key, flags, mime, FALSE); - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname, 0, tmp, time(NULL)); - g_free(tmp); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname, (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname, 0, tmp, time(NULL)); - g_free(tmp); - } -} - - -/* Private message to the client. The `sender' is the sender of the - message. The message is `message'and maybe NULL. The `flags' - indicates message flags and it is used to determine how the message - can be interpreted (like it may tell the message is multimedia - message). */ - -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (sender->nickname) - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - sender->nickname, sg->account); - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(NULL, message, message_len); - silcpurple_mime_message(client, conn, sender, NULL, payload, - NULL, flags, mime, FALSE); - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - tmp = g_markup_escape_text(msg, -1); - serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); - g_free(msg); - g_free(tmp); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname, (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); - g_free(tmp); - } -} - - -/* Notify message to the client. The notify arguments are sent in the - same order as servers sends them. The arguments are same as received - from the server except for ID's. If ID is received application receives - the corresponding entry to the ID. For example, if Client ID is received - application receives SilcClientEntry. Also, if the notify type is - for channel the channel entry is sent to application (even if server - does not send it because client library gets the channel entry from - the Channel ID in the packet's header). */ - -static void -silc_notify(SilcClient client, SilcClientConnection conn, - SilcNotifyType type, ...) -{ - va_list va; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *convo; - SilcClientEntry client_entry, client_entry2; - SilcChannelEntry channel; - SilcServerEntry server_entry; - SilcIdType idtype; - void *entry; - SilcUInt32 mode; - SilcHashTableList htl; - SilcChannelUser chu; - char buf[512], buf2[512], *tmp, *name; - SilcNotifyType notify; - PurpleBuddy *b; - SilcDList list; - int i; - - va_start(va, type); - memset(buf, 0, sizeof(buf)); - - switch (type) { - - case SILC_NOTIFY_TYPE_NONE: - break; - - case SILC_NOTIFY_TYPE_INVITE: - { - GHashTable *components; - (void)va_arg(va, SilcChannelEntry); - name = va_arg(va, char *); - client_entry = va_arg(va, SilcClientEntry); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, g_strdup("channel"), g_strdup(name)); - serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); - } - break; - - case SILC_NOTIFY_TYPE_JOIN: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - /* If we joined channel, do nothing */ - if (client_entry == conn->local_entry) - break; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Join user to channel */ - g_snprintf(buf, sizeof(buf), "%s@%s", - client_entry->username, client_entry->hostname); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, buf, PURPLE_CBFLAGS_NONE, TRUE); - - break; - - case SILC_NOTIFY_TYPE_LEAVE: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Remove user from channel */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, NULL); - - break; - - case SILC_NOTIFY_TYPE_SIGNOFF: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - tmp); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_TOPIC_SET: - { - char *esc, *tmp2; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - tmp = va_arg(va, char *); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (!tmp) - break; - - esc = g_markup_escape_text(tmp, -1); - tmp2 = purple_markup_linkify(esc); - g_free(esc); - - if (idtype == SILC_ID_CLIENT) { - client_entry = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - client_entry->nickname, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - server_entry->server_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - server_entry->server_name, tmp); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - channel->channel_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - channel->channel_name, tmp); - } else { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); - } - - g_free(tmp2); - - break; - - } - case SILC_NOTIFY_TYPE_NICK_CHANGE: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); /* Old nick */ - name = va_arg(va, char *); /* New nick */ - - if (!strcmp(tmp, name)) - break; - - /* Change nick on all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - tmp, name); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_CMODE_CHANGE: - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, SilcPublicKey); - (void)va_arg(va, SilcDList); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set channel %s modes to: %s"), name, - channel->channel_name, buf2); - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all channel %s modes"), name, - channel->channel_name); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - break; - - case SILC_NOTIFY_TYPE_CUMODE_CHANGE: - { - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set %s's modes to: %s"), name, - client_entry2->nickname, buf2); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (mode & SILC_CHANNEL_UMODE_CHANOP) - flags |= PURPLE_CBFLAGS_OP; - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all %s's modes"), name, - client_entry2->nickname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); - break; - } - - case SILC_NOTIFY_TYPE_MOTD: - tmp = va_arg(va, char *); - silc_free(sg->motd); - sg->motd = silc_memdup(tmp, strlen(tmp)); - break; - - case SILC_NOTIFY_TYPE_KICKED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (client_entry == conn->local_entry) { - /* Remove us from channel */ - g_snprintf(buf, sizeof(buf), - _("You have been kicked off %s by %s (%s)"), - channel->channel_name, client_entry2->nickname, - tmp ? tmp : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - /* Remove user from channel */ - g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - buf); - } - - break; - - case SILC_NOTIFY_TYPE_KILLED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - idtype = va_arg(va, int); - entry = va_arg(va, SilcClientEntry); - - if (client_entry == conn->local_entry) { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove us from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } - silc_hash_table_list_reset(&htl); - - } else { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove user from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } - silc_hash_table_list_reset(&htl); - } - - break; - - case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: - break; - - case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: - (void)va_arg(va, void *); - list = va_arg(va, SilcDList); - - silc_dlist_start(list); - while ((client_entry = silc_dlist_get(list))) { - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - _("Server signoff")); - } - silc_hash_table_list_reset(&htl); - } - break; - - case SILC_NOTIFY_TYPE_ERROR: - { - SilcStatus error = va_arg(va, int); - purple_notify_error(gc, "Error Notify", - silc_get_status_message(error), - NULL); - } - break; - - case SILC_NOTIFY_TYPE_WATCH: - { - SilcPublicKey public_key; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint; - - client_entry = va_arg(va, SilcClientEntry); - (void)va_arg(va, char *); - mode = va_arg(va, SilcUInt32); - notify = va_arg(va, int); - public_key = va_arg(va, SilcPublicKey); - - b = NULL; - if (public_key) { - GSList *buddies; - const char *f; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - break; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(buf, sizeof(buf) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" - G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - silc_free(fingerprint); - silc_free(pk); - - /* Find buddy by associated public key */ - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - b = buddies->data; - f = purple_blist_node_get_string(PURPLE_BLIST_NODE(b), "public-key"); - if (purple_strequal(f, buf)) - goto cont; - b = NULL; - } - } - cont: - if (!b) { - /* Find buddy by nickname */ - b = purple_find_buddy(sg->account, client_entry->nickname); - if (!b) { - purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", - client_entry->nickname); - break; - } - } - - silc_free(purple_buddy_get_protocol_data(b)); - purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id, - sizeof(client_entry->id))); - if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { - break; - } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { - /* See if client was away and is now present */ - if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | - SILC_UMODE_BUSY | SILC_UMODE_PAGE | - SILC_UMODE_DETACHED)) && - (client_entry->mode & SILC_UMODE_GONE || - client_entry->mode & SILC_UMODE_INDISPOSED || - client_entry->mode & SILC_UMODE_BUSY || - client_entry->mode & SILC_UMODE_PAGE || - client_entry->mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - else if ((mode & SILC_UMODE_GONE) || - (mode & SILC_UMODE_INDISPOSED) || - (mode & SILC_UMODE_BUSY) || - (mode & SILC_UMODE_PAGE) || - (mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } - } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || - notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || - notify == SILC_NOTIFY_TYPE_KILLED) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } else if (notify == SILC_NOTIFY_TYPE_NONE) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - } - break; - - default: - purple_debug_info("silc", "Unhandled notification: %d\n", type); - break; - } - - va_end(va); -} - - -/* Command handler. This function is called always after application has - called a command. It will be called to indicate that the command - was processed. It will also be called if error occurs while processing - the command. The `success' indicates whether the command was sent - or if error occurred. The `status' indicates the actual error. - The `argc' and `argv' are the command line arguments sent to the - command by application. Note that, this is not reply to the command - from server, this is merely and indication to application that the - command was processed. */ - -static void -silc_command(SilcClient client, SilcClientConnection conn, - SilcBool success, SilcCommand command, SilcStatus status, - SilcUInt32 argc, unsigned char **argv) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - switch (command) { - - case SILC_COMMAND_CMODE: - if (argc == 3 && !strcmp((char *)argv[2], "+C")) - sg->chpk = TRUE; - else - sg->chpk = FALSE; - break; - - default: - break; - } -} - -#if 0 -static void -silcpurple_whois_more(SilcClientEntry client_entry, gint id) -{ - SilcAttributePayload attr; - SilcAttribute attribute; - GString *s; - SilcVCardStruct vcard; - int i; - - if (id != 0) - return; - - memset(&vcard, 0, sizeof(vcard)); - - s = g_string_new(""); - - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - switch (attribute) { - - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - g_string_append_printf(s, "%s:\n\n", _("Personal Information")); - if (vcard.full_name) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Full Name"), - vcard.full_name); - if (vcard.first_name) - g_string_append_printf(s, "%s:\t%s\n", - _("First Name"), - vcard.first_name); - if (vcard.middle_names) - g_string_append_printf(s, "%s:\t%s\n", - _("Middle Name"), - vcard.middle_names); - if (vcard.family_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Family Name"), - vcard.family_name); - if (vcard.nickname) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Nickname"), - vcard.nickname); - if (vcard.bday) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Birth Day"), - vcard.bday); - if (vcard.title) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Title"), - vcard.title); - if (vcard.role) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Role"), - vcard.role); - if (vcard.org_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Organization"), - vcard.org_name); - if (vcard.org_unit) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Unit"), - vcard.org_unit); - if (vcard.url) - g_string_append_printf(s, "%s:\t%s\n", - _("Homepage"), - vcard.url); - if (vcard.label) - g_string_append_printf(s, "%s:\t%s\n", - _("Address"), - vcard.label); - for (i = 0; i < vcard.num_tels; i++) { - if (vcard.tels[i].telnum) - g_string_append_printf(s, "%s:\t\t\t%s\n", - _("Phone"), - vcard.tels[i].telnum); - } - for (i = 0; i < vcard.num_emails; i++) { - if (vcard.emails[i].address) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Email"), - vcard.emails[i].address); - } - if (vcard.note) - g_string_append_printf(s, "\n%s:\t\t%s\n", - _("Note"), - vcard.note); - break; - } - } - - purple_notify_info(NULL, _("User Information"), _("User Information"), - s->str); - g_string_free(s, TRUE); -} -#endif - - -/* Command reply handler. Delivers a reply to command that was sent - earlier. The `conn' is the associated client connection. The `command' - indicates the command reply type. If the `status' other than - SILC_STATUS_OK an error occurred. In this case the `error' will indicate - the error. It is possible to receive list of command replies and list - of errors. In this case the `status' will indicate it is an list entry - (the `status' is SILC_STATUS_LIST_START, SILC_STATUS_LIST_ITEM and/or - SILC_STATUS_LIST_END). - - The arguments received in `ap' are command specific. See a separate - documentation in the Toolkit Reference Manual for the command reply - arguments. */ - -static void -silc_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, va_list ap) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - - switch (command) { - case SILC_COMMAND_JOIN: - { - SilcChannelEntry channel; - PurpleConversation *convo; - SilcHashTableList *user_list; - SilcChannelUser chu; - GList *users = NULL, *flags = NULL; - char tmp[256], *topic; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), - silc_get_status_message(error)); - return; - } - - (void)va_arg(ap, char *); - channel = va_arg(ap, SilcChannelEntry); - (void)va_arg(ap, SilcUInt32); - user_list = va_arg(ap, SilcHashTableList *); - topic = va_arg(ap, char *); - - /* Add channel to Purple */ - channel->context = SILC_32_TO_PTR(++sg->channel_ids); - serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - /* Add all users to channel */ - while (silc_hash_table_get(user_list, NULL, (void *)&chu)) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - chu->context = SILC_32_TO_PTR(sg->channel_ids); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) - f |= PURPLE_CBFLAGS_FOUNDER; - if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) - f |= PURPLE_CBFLAGS_OP; - users = g_list_append(users, chu->client->nickname); - flags = g_list_append(flags, GINT_TO_POINTER(f)); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - if (chu->client == conn->local_entry) - g_snprintf(tmp, sizeof(tmp), - _("You are channel founder on %s"), - channel->channel_name); - else - g_snprintf(tmp, sizeof(tmp), - _("Channel founder on %s is %s"), - channel->channel_name, chu->client->nickname); - - purple_conversation_write(convo, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - } - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - g_list_free(users); - g_list_free(flags); - - /* Set topic */ - if (topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic); - - /* Set nick */ - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), conn->local_entry->nickname); - } - break; - - case SILC_COMMAND_LEAVE: - break; - - case SILC_COMMAND_USERS: - break; - - case SILC_COMMAND_WHOIS: - { - SilcUInt32 idle, *user_modes; - SilcDList channels; - SilcClientEntry client_entry; - char tmp[1024], *tmp2; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - PurpleNotifyUserInfo *user_info; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(error)); - break; - } - - client_entry = va_arg(ap, SilcClientEntry); - (void)va_arg(ap, char *); - (void)va_arg(ap, char *); - (void)va_arg(ap, char *); - channels = va_arg(ap, SilcDList); - (void)va_arg(ap, SilcUInt32); - idle = va_arg(ap, SilcUInt32); - (void)va_arg(ap, unsigned char *); - user_modes = va_arg(ap, SilcUInt32 *); - - user_info = purple_notify_user_info_new(); - tmp2 = g_markup_escape_text(client_entry->nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); - g_free(tmp2); - if (client_entry->realname) { - tmp2 = g_markup_escape_text(client_entry->realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); - g_free(tmp2); - } - tmp2 = g_markup_escape_text(client_entry->username, -1); - if (*client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); - g_free(tmp2); - - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (statusstr) { - tmp2 = g_markup_escape_text(statusstr, -1); - purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); - g_free(statusstr); - g_free(tmp2); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - - if (*client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - if (channels && user_modes) { - SilcChannelPayload entry; - int i = 0; - - memset(tmp, 0, sizeof(tmp)); - silc_dlist_start(channels); - while ((entry = silc_dlist_get(channels))) { - SilcUInt32 name_len; - char *m = silc_client_chumode_char(user_modes[i++]); - char *name = (char *)silc_channel_get_name(entry, &name_len); - if (m) - silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); - silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); - silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); - silc_free(m); - } - tmp2 = g_markup_escape_text(tmp, -1); - purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); - g_free(tmp2); - } - - if (client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - if (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - } - -#if 0 /* XXX for now, let's not show attrs here */ - if (client_entry->attrs) - purple_request_action(gc, _("User Information"), - _("User Information"), - buf, 1, client_entry, 2, - _("OK"), G_CALLBACK(silcpurple_whois_more), - _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); - else -#endif /* 0 */ - purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_WHOWAS: - { - SilcClientEntry client_entry; - char *nickname, *realname, *username, *tmp; - PurpleNotifyUserInfo *user_info; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(error)); - break; - } - - client_entry = va_arg(ap, SilcClientEntry); - nickname = va_arg(ap, char *); - username = va_arg(ap, char *); - realname = va_arg(ap, char *); - if (!nickname) - break; - - user_info = purple_notify_user_info_new(); - tmp = g_markup_escape_text(nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - if (realname) { - tmp = g_markup_escape_text(realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); - g_free(tmp); - } - if (username) { - tmp = g_markup_escape_text(username, -1); - if (client_entry && *client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - g_free(tmp); - } - if (client_entry && *client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - - if (client_entry && client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - if (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - } - - purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_DETACH: - { - const char *file; - SilcBuffer detach_data; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), - silc_get_status_message(error)); - return; - } - - detach_data = va_arg(ap, SilcBuffer); - - /* Save the detachment data to file. */ - file = silcpurple_session_file(purple_account_get_username(sg->account)); - g_unlink(file); - silc_file_writefile(file, (const char *)silc_buffer_data(detach_data), - silc_buffer_len(detach_data)); - } - break; - - case SILC_COMMAND_TOPIC: - { - SilcChannelEntry channel; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Topic"), _("Cannot set topic"), - silc_get_status_message(error)); - return; - } - - channel = va_arg(ap, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) { - purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", - channel->channel_name); - break; - } - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - } - break; - - case SILC_COMMAND_NICK: - { - SilcClientEntry local_entry; - SilcHashTableList htl; - SilcChannelUser chu; - const char *oldnick, *newnick; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), - silc_get_status_message(error)); - return; - } - - local_entry = va_arg(ap, SilcClientEntry); - newnick = va_arg(ap, char *); - - /* Change nick on all channels */ - silc_hash_table_list(local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); - if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), newnick))) { - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - oldnick, newnick); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), newnick); - } - } - silc_hash_table_list_reset(&htl); - - purple_connection_set_display_name(gc, newnick); - } - break; - - case SILC_COMMAND_LIST: - { - char *topic, *name; - int usercount; - PurpleRoomlistRoom *room; - - if (sg->roomlist_canceled) - break; - - if (error != SILC_STATUS_OK) { - purple_notify_error(gc, _("Error"), _("Error retrieving room list"), - silc_get_status_message(error)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - - (void)va_arg(ap, SilcChannelEntry); - name = va_arg(ap, char *); - if (!name) { - purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), - _("Network is empty")); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - topic = va_arg(ap, char *); - usercount = va_arg(ap, int); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(sg->roomlist, room, name); - purple_roomlist_room_add_field(sg->roomlist, room, - SILC_32_TO_PTR(usercount)); - purple_roomlist_room_add_field(sg->roomlist, room, - topic ? topic : ""); - purple_roomlist_room_add(sg->roomlist, room); - - if (status == SILC_STATUS_LIST_END || - status == SILC_STATUS_OK) { - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - } - } - break; - - case SILC_COMMAND_GETKEY: - { - SilcPublicKey public_key; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - silc_get_status_message(error)); - return; - } - - (void)va_arg(ap, SilcUInt32); - (void)va_arg(ap, void *); - public_key = va_arg(ap, SilcPublicKey); - - if (!public_key) - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - _("No public key was received")); - } - break; - - case SILC_COMMAND_INFO: - { - - char *server_name; - char *server_info; - char tmp[256]; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Server Information"), - _("Cannot get server information"), - silc_get_status_message(error)); - return; - } - - (void)va_arg(ap, SilcServerEntry); - server_name = va_arg(ap, char *); - server_info = va_arg(ap, char *); - - if (server_name && server_info) { - g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", - server_name, server_info); - purple_notify_info(gc, NULL, _("Server Information"), tmp); - } - } - break; - - case SILC_COMMAND_STATS: - { - SilcClientStats *stats; - char *msg; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Server Statistics"), - _("Cannot get server statistics"), - silc_get_status_message(error)); - return; - } - - stats = va_arg(ap, SilcClientStats *); - - msg = g_strdup_printf(_("Local server start time: %s\n" - "Local server uptime: %s\n" - "Local server clients: %d\n" - "Local server channels: %d\n" - "Local server operators: %d\n" - "Local router operators: %d\n" - "Local cell clients: %d\n" - "Local cell channels: %d\n" - "Local cell servers: %d\n" - "Total clients: %d\n" - "Total channels: %d\n" - "Total servers: %d\n" - "Total routers: %d\n" - "Total server operators: %d\n" - "Total router operators: %d\n"), - silc_time_string(stats->starttime), - purple_str_seconds_to_string((int)stats->uptime), - (int)stats->my_clients, - (int)stats->my_channels, - (int)stats->my_server_ops, - (int)stats->my_router_ops, - (int)stats->cell_clients, - (int)stats->cell_channels, - (int)stats->cell_servers, - (int)stats->clients, - (int)stats->channels, - (int)stats->servers, - (int)stats->routers, - (int)stats->server_ops, - (int)stats->router_ops); - - purple_notify_info(gc, NULL, - _("Network Statistics"), msg); - g_free(msg); - } - break; - - case SILC_COMMAND_PING: - { - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Ping"), _("Ping failed"), - silc_get_status_message(error)); - return; - } - - purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), - NULL); - } - break; - - case SILC_COMMAND_KILL: - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Kill User"), - _("Could not kill user"), - silc_get_status_message(error)); - return; - } - break; - - case SILC_COMMAND_CMODE: - { - SilcChannelEntry channel_entry; - SilcDList channel_pubkeys, list; - SilcArgumentDecodedList e; - - if (status != SILC_STATUS_OK) - return; - - channel_entry = va_arg(ap, SilcChannelEntry); - (void)va_arg(ap, SilcUInt32); - (void)va_arg(ap, SilcPublicKey); - channel_pubkeys = va_arg(ap, SilcDList); - - if (!sg->chpk) - break; - - list = silc_dlist_init(); - - if (channel_pubkeys) { - silc_dlist_start(channel_pubkeys); - while ((e = silc_dlist_get(channel_pubkeys))) { - if (e->arg_type == 0x00 || - e->arg_type == 0x03) - silc_dlist_add(list, silc_pkcs_public_key_copy(e->argument)); - } - } - silcpurple_chat_chauth_show(sg, channel_entry, list); - } - break; - - case SILC_COMMAND_WATCH: - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("WATCH"), _("Cannot watch user"), - silc_get_status_message(error)); - return; - } - break; - - default: - if (status == SILC_STATUS_OK) - purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); - else - purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, - silc_get_status_message(error)); - break; - } -} - -/* Generic command reply callback for silc_client_command_send. Simply - calls the default command_reply client operation callback */ - -SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap) -{ - silc_command_reply(client, conn, command, status, error, ap); - return TRUE; -} - - -typedef struct { - union { - SilcAskPassphrase ask_pass; - SilcGetAuthMeth get_auth; - } u; - void *context; -} *SilcPurpleAskPassphrase; - -static void -silc_ask_auth_password_cb(const unsigned char *passphrase, - SilcUInt32 passphrase_len, void *context) -{ - SilcPurpleAskPassphrase internal = context; - - if (!passphrase || !(*passphrase)) - internal->u.get_auth(SILC_AUTH_NONE, NULL, 0, internal->context); - else - internal->u.get_auth(SILC_AUTH_PASSWORD, - (unsigned char *)passphrase, - passphrase_len, internal->context); - silc_free(internal); -} - -/* Find authentication method and authentication data by hostname and - port. The hostname may be IP address as well. The `auth_method' is - the authentication method the remote connection requires. It is - however possible that remote accepts also some other authentication - method. Application should use the method that may have been - configured for this connection. If none has been configured it should - use the required `auth_method'. If the `auth_method' is - SILC_AUTH_NONE, server does not require any authentication or the - required authentication method is not known. The `completion' - callback must be called to deliver the chosen authentication method - and data. The `conn' may be NULL. */ - -static void -silc_get_auth_method(SilcClient client, SilcClientConnection conn, - char *hostname, SilcUInt16 port, - SilcAuthMethod auth_method, - SilcGetAuthMeth completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleAskPassphrase internal; - const char *password; - - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 4, 5); - else - purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); - - /* Check configuration if we have this connection configured. */ - if (auth_method == SILC_AUTH_PUBLIC_KEY && - purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { - completion(SILC_AUTH_PUBLIC_KEY, NULL, 0, context); - return; - } - if (auth_method == SILC_AUTH_PASSWORD) { - password = purple_connection_get_password(gc); - if (password && *password) { - completion(SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); - return; - } - - /* Ask password from user */ - internal = silc_calloc(1, sizeof(*internal)); - if (!internal) - return; - internal->u.get_auth = completion; - internal->context = context; - silc_ask_passphrase(client, conn, silc_ask_auth_password_cb, - internal); - return; - } - - completion(SILC_AUTH_NONE, NULL, 0, context); -} - - -/* Called to verify received public key. The `conn_type' indicates which - entity (server or client) has sent the public key. If user decides to - trust the key the application may save the key as trusted public key for - later use. The `completion' must be called after the public key has - been verified. */ - -static void -silc_verify_public_key(SilcClient client, SilcClientConnection conn, - SilcConnectionType conn_type, - SilcPublicKey public_key, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn && (conn_type == SILC_CONN_SERVER || - conn_type == SILC_CONN_ROUTER)) { - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 3, 5); - else - purple_connection_update_progress(gc, _("Verifying server public key"), - 3, 5); - } - - /* Verify public key */ - silcpurple_verify_public_key(client, conn, NULL, conn_type, - public_key, completion, context); -} - -static void -silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) -{ - if (!passphrase || !(*passphrase)) - internal->u.ask_pass(NULL, 0, internal->context); - else - internal->u.ask_pass((unsigned char *)passphrase, - strlen(passphrase), internal->context); - silc_free(internal); -} - -/* Ask (interact, that is) a passphrase from user. The passphrase is - returned to the library by calling the `completion' callback with - the `context'. The returned passphrase SHOULD be in UTF-8 encoded, - if not then the library will attempt to encode. */ - -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); - - if (!internal) - return; - internal->u.ask_pass = completion; - internal->context = context; - purple_request_input(gc, _("Passphrase"), NULL, - _("Passphrase required"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silc_ask_passphrase_cb), - _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), - purple_connection_get_account(gc), NULL, NULL, internal); -} - - -/* Called to indicate that incoming key agreement request has been - received. If the application wants to perform key agreement it may - call silc_client_perform_key_agreement to initiate key agreement or - silc_client_send_key_agreement to provide connection point to the - remote client in case the `hostname' is NULL. If key agreement is - not desired this request can be ignored. The `protocol' is either - value 0 for TCP or value 1 for UDP. */ - -static void -silc_key_agreement(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 protocol, - SilcUInt16 port) -{ - silcpurple_buddy_keyagr_request(client, conn, client_entry, - hostname, port, protocol); -} - - -/* Notifies application that file transfer protocol session is being - requested by the remote client indicated by the `client_entry' from - the `hostname' and `port'. The `session_id' is the file transfer - session and it can be used to either accept or reject the file - transfer request, by calling the silc_client_file_receive or - silc_client_file_close, respectively. */ - -static void -silc_ftp(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - silcpurple_ftp_request(client, conn, client_entry, session_id, - hostname, port); -} - -SilcClientOperations ops = { - silc_say, - silc_channel_message, - silc_private_message, - silc_notify, - silc_command, - silc_command_reply, - silc_get_auth_method, - silc_verify_public_key, - silc_ask_passphrase, - silc_key_agreement, - silc_ftp -}; diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/pk.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/pk.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/pk.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/pk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,274 +0,0 @@ -/* - - silcpurple_pk.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" - -/************************* Public Key Verification ***************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - char *filename; - char *entity; - char *entity_name; - char *fingerprint; - char *babbleprint; - SilcPublicKey public_key; - SilcVerifyPublicKey completion; - void *context; - gboolean changed; -} *PublicKeyVerify; - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify); - -static void silcpurple_verify_cb(PublicKeyVerify verify, gint id) -{ - if (id != 2) { - if (verify->completion) - verify->completion(FALSE, verify->context); - } else { - if (verify->completion) - verify->completion(TRUE, verify->context); - - /* Save the key for future checking */ - silc_pkcs_save_public_key(verify->filename, verify->public_key, - SILC_PKCS_FILE_BASE64); - } - - g_free(verify->filename); - g_free(verify->entity); - g_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_pkcs_public_key_free(verify->public_key); - silc_free(verify); -} - -static void silcpurple_verify_details_cb(PublicKeyVerify verify) -{ - /* What a hack. We have to display the accept dialog _again_ - because Purple closes the dialog after you press the button. Purple - should have option for the dialogs whether the buttons close them - or not. */ - silcpurple_verify_ask(verify->entity, verify->fingerprint, - verify->babbleprint, verify); -} - -static void silcpurple_verify_details(PublicKeyVerify verify, gint id) -{ - PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; - - silcpurple_show_public_key(sg, verify->entity_name, verify->public_key, - G_CALLBACK(silcpurple_verify_details_cb), - verify); -} - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify) -{ - PurpleConnection *gc = verify->client->application; - char tmp[256], tmp2[256]; - - if (verify->changed) { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Your local copy does not match this " - "key. Would you still like to accept this public key?"), - entity); - } else { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Would you like to accept this " - "public key?"), entity); - } - g_snprintf(tmp2, sizeof(tmp2), - _("Fingerprint and babbleprint for the %s key are:\n\n" - "%s\n%s\n"), entity, fingerprint, babbleprint); - - purple_request_action(gc, _("Verify Public Key"), tmp, tmp2, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), entity, NULL, verify, 3, - _("Yes"), G_CALLBACK(silcpurple_verify_cb), - _("No"), G_CALLBACK(silcpurple_verify_cb), - _("_View..."), G_CALLBACK(silcpurple_verify_details)); -} - -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcConnectionType conn_type, - SilcPublicKey public_key, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - int i; - char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; - char *fingerprint, *babbleprint; - struct passwd *pw; - struct stat st; - char *entity = ((conn_type == SILC_CONN_SERVER || - conn_type == SILC_CONN_ROUTER) ? - "server" : "client"); - PublicKeyVerify verify; - const char *ip, *hostname; - SilcUInt16 port; - unsigned char *pk; - SilcUInt32 pk_len; - - if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC) { - purple_notify_error(gc, _("Verify Public Key"), - _("Unsupported public key type"), NULL); - if (completion) - completion(FALSE, context); - return; - } - - pw = getpwuid(getuid()); - if (!pw) { - if (completion) - completion(FALSE, context); - return; - } - - memset(filename, 0, sizeof(filename)); - memset(filename2, 0, sizeof(filename2)); - memset(file, 0, sizeof(file)); - - silc_socket_stream_get_info(silc_packet_stream_get_stream(conn->stream), - NULL, &hostname, &ip, &port); - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) { - if (completion) - completion(FALSE, context); - return; - } - - if (conn_type == SILC_CONN_SERVER || - conn_type == SILC_CONN_ROUTER) { - if (!name) { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - ip, port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - hostname, port); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - hostf = filename2; - } else { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - name, port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - } - } else { - /* Replace all whitespaces with `_'. */ - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - g_snprintf(file, sizeof(file) - 1, "%skey_%s.pub", entity, fingerprint); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - silc_free(fingerprint); - - ipf = filename; - } - - verify = silc_calloc(1, sizeof(*verify)); - if (!verify) - return; - verify->client = client; - verify->conn = conn; - verify->filename = g_strdup(ipf); - verify->entity = g_strdup(entity); - verify->entity_name = (conn_type != SILC_CONN_CLIENT ? - (name ? g_strdup(name) : g_strdup(hostname)) - : NULL); - verify->public_key = silc_pkcs_public_key_copy(public_key); - verify->completion = completion; - verify->context = context; - fingerprint = verify->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = verify->babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - /* Check whether this key already exists */ - if (g_stat(ipf, &st) < 0 && (!hostf || g_stat(hostf, &st) < 0)) { - /* Key does not exist, ask user to verify the key and save it */ - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } else { - /* The key already exists, verify it. */ - SilcPublicKey public_key; - unsigned char *encpk; - SilcUInt32 encpk_len; - - /* Load the key file, try for both IP filename and hostname filename */ - if (!silc_pkcs_load_public_key(ipf, &public_key) && - (!hostf || (!silc_pkcs_load_public_key(hostf, &public_key)))) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Encode the key data */ - encpk = silc_pkcs_public_key_encode(public_key, &encpk_len); - if (!encpk) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Compare the keys */ - if (memcmp(encpk, pk, encpk_len)) { - /* Ask user to verify the key and save it */ - verify->changed = TRUE; - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Local copy matched */ - if (completion) - completion(TRUE, context); - g_free(verify->filename); - g_free(verify->entity); - g_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_pkcs_public_key_free(verify->public_key); - silc_free(verify); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -SILC Purple Plugin -================== - -This is the Purple protocol plugin of the protocol called Secure Internet -Live Conferencing (SILC). The implementation will use the SILC Toolkit, -freely available from the http://silcnet.org/ site, for the actual SILC -protocol implementation. - -To include SILC into Purple, one needs to first compile and install -the SILC Toolkit. It is done as follows: - - ./configure - make - make install - -This will compile shared libraries of the SILC Toolkit. If the --prefix -is not given to ./configure, the binaries are installed into the -/usr/local/silc directory. - -Once the Toolkit is installed one needs to tell Purple's ./configure -script where the SILC Toolkit is located. It is done as simply as: - - ./configure - -if pkg-config is installed in your system. If it is isn't it's done as: - - ./configure --with-silc-libs=/path/to/silc/lib - --with-silc-includes=/path/to/silc/include - -If the SILC Toolkit cannot be found then the SILC protocol plugin will -not be compiled. diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2252 +0,0 @@ -/* - - silcpurple.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "version.h" -#include "wb.h" -#include "core.h" - -extern SilcClientOperations ops; -static PurplePlugin *silc_plugin = NULL; - -/* Error log message callback */ - -static SilcBool silcpurple_log_error(SilcLogType type, char *message, - void *context) -{ - silc_say(NULL, NULL, SILC_CLIENT_MESSAGE_ERROR, message); - return TRUE; -} - -static const char * -silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return (const char *)"silc"; -} - -static GList * -silcpurple_away_states(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static void -silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = NULL; - SilcUInt32 mode; - SilcBuffer idp; - unsigned char mb[4]; - const char *state; - - if (gc != NULL) - sg = gc->proto_data; - - if (status == NULL) - return; - - state = purple_status_get_id(status); - - if (state == NULL) - return; - - if ((sg == NULL) || (sg->conn == NULL)) - return; - - mode = sg->conn->local_entry->mode; - mode &= ~(SILC_UMODE_GONE | - SILC_UMODE_HYPER | - SILC_UMODE_BUSY | - SILC_UMODE_INDISPOSED | - SILC_UMODE_PAGE); - - if (!strcmp(state, "hyper")) - mode |= SILC_UMODE_HYPER; - else if (!strcmp(state, "away")) - mode |= SILC_UMODE_GONE; - else if (!strcmp(state, "busy")) - mode |= SILC_UMODE_BUSY; - else if (!strcmp(state, "indisposed")) - mode |= SILC_UMODE_INDISPOSED; - else if (!strcmp(state, "page")) - mode |= SILC_UMODE_PAGE; - - /* Send UMODE */ - idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); - SILC_PUT32_MSB(mode, mb); - silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, - silcpurple_command_reply, NULL, 2, - 1, idp->data, silc_buffer_len(idp), - 2, mb, sizeof(mb)); - silc_buffer_free(idp); -} - - -/*************************** Connection Routines *****************************/ - -static void -silcpurple_keepalive(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, - NULL, 0); -} - -#if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) -static gboolean -silcpurple_scheduler(gpointer *context) -{ - SilcClient client = (SilcClient)context; - silc_client_run_one(client); - return TRUE; -} -#else -typedef struct { - SilcPurple sg; - SilcUInt32 fd; - guint tag; -} *SilcPurpleTask; - -/* A timeout occurred. Call SILC scheduler. */ - -static gboolean -silcpurple_scheduler_timeout(gpointer context) -{ - SilcPurpleTask task = (SilcPurpleTask)context; - silc_client_run_one(task->sg->client); - silc_dlist_del(task->sg->tasks, task); - silc_free(task); - return FALSE; -} - -/* An fd task event occurred. Call SILC scheduler. */ - -static void -silcpurple_scheduler_fd(gpointer data, gint fd, PurpleInputCondition cond) -{ - SilcClient client = (SilcClient)data; - silc_client_run_one(client); -} - -/* SILC Scheduler notify callback. This is called whenever task is added to - or deleted from SILC scheduler. It's also called when fd task events - change. Here we add same tasks to glib's main loop. */ - -static void -silcpurple_scheduler(SilcSchedule schedule, - SilcBool added, SilcTask task, - SilcBool fd_task, SilcUInt32 fd, - SilcTaskEvent event, - long seconds, long useconds, - void *context) -{ - SilcClient client = (SilcClient)context; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleTask ptask = NULL; - - if (added) { - if (fd_task) { - /* Add fd or change fd events */ - PurpleInputCondition e = 0; - - silc_dlist_start(sg->tasks); - while ((ptask = silc_dlist_get(sg->tasks))) - if (ptask->fd == fd) { - purple_input_remove(ptask->tag); - break; - } - - if (event & SILC_TASK_READ) - e |= PURPLE_INPUT_READ; - if (event & SILC_TASK_WRITE) - e |= PURPLE_INPUT_WRITE; - - if (e) { - if (!ptask) { - ptask = silc_calloc(1, sizeof(*ptask)); - ptask->fd = fd; - silc_dlist_add(sg->tasks, ptask); - } - ptask->tag = purple_input_add(fd, e, silcpurple_scheduler_fd, - client); - } else if (ptask) { - silc_dlist_del(sg->tasks, ptask); - silc_free(ptask); - } - } else { - /* Add timeout */ - ptask = silc_calloc(1, sizeof(*ptask)); - ptask->sg = sg; - ptask->tag = purple_timeout_add((seconds * 1000) + - (useconds / 1000), - silcpurple_scheduler_timeout, - ptask); - silc_dlist_add(sg->tasks, ptask); - } - } else { - if (fd_task) { - /* Remove fd */ - silc_dlist_start(sg->tasks); - while ((ptask = silc_dlist_get(sg->tasks))) - if (ptask->fd == fd) { - purple_input_remove(ptask->tag); - silc_dlist_del(sg->tasks, ptask); - silc_free(ptask); - break; - } - } - } -} -#endif /* __SILC_TOOLKIT_VERSION */ - -static void -silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, - SilcClientConnectionStatus status, SilcStatus error, - const char *message, void *context) -{ - PurpleConnection *gc = context; - SilcPurple sg; - SilcUInt32 mask; - char tz[16]; - PurpleStoredImage *img; -#ifdef HAVE_SYS_UTSNAME_H - struct utsname u; -#endif - - sg = gc->proto_data; - - switch (status) { - case SILC_CLIENT_CONN_SUCCESS: - case SILC_CLIENT_CONN_SUCCESS_RESUME: - sg->conn = conn; - - /* Connection created successfully */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Send the server our buddy list */ - silcpurple_send_buddylist(gc); - - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Send any UMODEs configured for account */ - if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { - silc_client_command_call(sg->client, sg->conn, NULL, - "UMODE", "+P", NULL); - } - - /* Set default attributes */ - mask = SILC_ATTRIBUTE_MOOD_NORMAL; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - mask = SILC_ATTRIBUTE_CONTACT_CHAT; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); -#ifdef HAVE_SYS_UTSNAME_H - if (!uname(&u)) { - SilcAttributeObjDevice dev; - memset(&dev, 0, sizeof(dev)); - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } -#endif - silc_timezone(tz, sizeof(tz)); - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)tz, strlen(tz)); - - /* Set our buddy icon */ - img = purple_buddy_icons_find_account_icon(sg->account); - silcpurple_buddy_set_icon(gc, img); - purple_imgstore_unref(img); - - return; - break; - - case SILC_CLIENT_CONN_DISCONNECTED: - /* Disconnected */ - if (sg->resuming && !sg->detaching) - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Close the connection */ - if (!sg->detaching) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected by server")); - else - /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ - purple_account_disconnect(purple_connection_get_account(gc)); - break; - - case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error connecting to SILC Server")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Key Exchange failed")); - break; - - case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Authentication failed")); - break; - - case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Resuming detached session failed. " - "Press Reconnect to create new connection.")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection timed out")); - break; - } - - /* Error */ - sg->conn = NULL; -} - -static void -silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, - void *context) -{ - PurpleConnection *gc = context; - SilcPurple sg; - SilcClient client; - SilcClientConnectionParams params; - const char *dfile; - - sg = gc->proto_data; - - if (status != SILC_SOCKET_OK) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - silc_pkcs_public_key_free(sg->public_key); - silc_pkcs_private_key_free(sg->private_key); - silc_free(sg); - gc->proto_data = NULL; - return; - } - - client = sg->client; - - /* Get session detachment data, if available */ - memset(¶ms, 0, sizeof(params)); - dfile = silcpurple_session_file(purple_account_get_username(sg->account)); - params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); - if (params.detach_data) - params.detach_data[params.detach_data_len] = 0; - params.ignore_requested_attributes = FALSE; - params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE); - - /* Progress */ - if (params.detach_data) { - purple_connection_update_progress(gc, _("Resuming session"), 2, 5); - sg->resuming = TRUE; - } else { - purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); - } - - /* Perform SILC Key Exchange. */ - silc_client_key_exchange(sg->client, ¶ms, sg->public_key, - sg->private_key, stream, SILC_CONN_SERVER, - silcpurple_connect_cb, gc); - - silc_free(params.detach_data); -} - -static void -silcpurple_login_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - SilcPurple sg; - - g_return_if_fail(gc != NULL); - - sg = gc->proto_data; - - if (source < 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - silc_pkcs_public_key_free(sg->public_key); - silc_pkcs_private_key_free(sg->private_key); - silc_free(sg); - gc->proto_data = NULL; - return; - } - - silc_hash_alloc((unsigned char *)"sha1", &sg->sha1hash); - - /* Wrap socket to TCP stream */ - silc_socket_tcp_stream_create(source, TRUE, FALSE, - sg->client->schedule, - silcpurple_stream_created, gc); -} - -static void silcpurple_continue_running(SilcPurple sg) -{ - PurpleConnection *gc = sg->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - /* Connect to the SILC server */ - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), - silcpurple_login_connected, gc) == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - gc->proto_data = NULL; - silc_free(sg); - return; - } -} - -static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = (SilcPurple)gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - char pkd[256], prd[256]; - const char *password; - gboolean remember; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - password = purple_request_fields_get_string(fields, "password"); - remember = purple_request_fields_get_bool(fields, "remember"); - - if (!password || !*password) - { - purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); - gc->proto_data = NULL; - silc_free(sg); - return; - } - - if (remember) - purple_account_set_remember_password(account, TRUE); - - purple_account_set_password(account, password); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - password, - &sg->public_key, &sg->private_key)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to load SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); - return; - } - silcpurple_continue_running(sg); -} - -static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg; - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - sg = gc->proto_data; - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to load SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); -} - -static void silcpurple_running(SilcClient client, void *context) -{ - SilcPurple sg = context; - PurpleConnection *gc = sg->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char pkd[256], prd[256]; - - - /* Progress */ - purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, - &sg->public_key, &sg->private_key)) { - if (!purple_account_get_password(account)) { - purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), - G_CALLBACK(silcpurple_no_password_cb), gc); - return; - } - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to load SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); - return; - } - silcpurple_continue_running(sg); -} - -static void -silcpurple_login(PurpleAccount *account) -{ - SilcClient client; - PurpleConnection *gc; - SilcPurple sg; - SilcClientParams params; - const char *cipher, *hmac; - char *username, *hostname, *realname, **up; - int i; - - gc = account->gc; - if (!gc) - return; - gc->proto_data = NULL; - - memset(¶ms, 0, sizeof(params)); - strcat(params.nickname_format, "%n#a"); - - /* Allocate SILC client */ - client = silc_client_alloc(&ops, ¶ms, gc, NULL); - if (!client) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Out of memory")); - return; - } - - /* Get username, real name and local hostname for SILC library */ - if (!purple_account_get_username(account)) - purple_account_set_username(account, silc_get_username()); - - username = (char *)purple_account_get_username(account); - up = g_strsplit(username, "@", 2); - username = g_strdup(up[0]); - g_strfreev(up); - - if (!purple_account_get_user_info(account)) { - purple_account_set_user_info(account, silc_get_real_name()); - if (!purple_account_get_user_info(account)) - purple_account_set_user_info(account, - "John T. Noname"); - } - realname = (char *)purple_account_get_user_info(account); - hostname = silc_net_localhost(); - - purple_connection_set_display_name(gc, username); - - /* Register requested cipher and HMAC */ - cipher = purple_account_get_string(account, "cipher", - SILC_DEFAULT_CIPHER); - for (i = 0; silc_default_ciphers[i].name; i++) - if (!strcmp(silc_default_ciphers[i].name, cipher)) { - silc_cipher_register(&(silc_default_ciphers[i])); - break; - } - hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); - for (i = 0; silc_default_hmacs[i].name; i++) - if (!strcmp(silc_default_hmacs[i].name, hmac)) { - silc_hmac_register(&(silc_default_hmacs[i])); - break; - } - - sg = silc_calloc(1, sizeof(*sg)); - if (!sg) - return; - sg->client = client; - sg->gc = gc; - sg->account = account; - gc->proto_data = sg; - - /* Init SILC client */ - if (!silc_client_init(client, username, hostname, realname, - silcpurple_running, sg)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to initialize SILC protocol")); - gc->proto_data = NULL; - silc_free(sg); - silc_free(hostname); - g_free(username); - return; - } - silc_free(hostname); - g_free(username); - - /* Check the ~/.silc dir and create it, and new key pair if necessary. */ - if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Error loading SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); - return; - } - -#if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) - /* Schedule SILC using Glib's event loop */ - sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, client); -#else - /* Run SILC scheduler */ - sg->tasks = silc_dlist_init(); - silc_schedule_set_notify(client->schedule, silcpurple_scheduler, - client); - silc_client_run_one(client); -#endif /* __SILC_TOOLKIT_VERSION */ -} - -static int -silcpurple_close_final(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - - silc_client_stop(sg->client, NULL, NULL); - silc_client_free(sg->client); - if (sg->sha1hash) - silc_hash_free(sg->sha1hash); - if (sg->mimeass) - silc_mime_assembler_free(sg->mimeass); - silc_free(sg); - return 0; -} - -static void -silcpurple_close(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; -#if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) - SilcPurpleTask task; -#endif /* __SILC_TOOLKIT_VERSION */ - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - g_return_if_fail(sg != NULL); - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - /* Send QUIT */ - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", quit_msg, - NULL); - g_free(quit_msg); - - if (sg->conn) - silc_client_close_connection(sg->client, sg->conn); - -#if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) - if (sg->conn) - silc_client_run_one(sg->client); - silc_schedule_set_notify(sg->client->schedule, NULL, NULL); - - silc_dlist_start(sg->tasks); - while ((task = silc_dlist_get(sg->tasks))) { - purple_input_remove(task->tag); - silc_free(task); - } - silc_dlist_uninit(sg->tasks); -#endif /* __SILC_TOOLKIT_VERSION */ - - purple_timeout_remove(sg->scheduler); - purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); -} - - -/****************************** Protocol Actions *****************************/ - -static void -silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - char *tmp; - SilcUInt32 tmp_len, mask; - SilcAttributeObjService service; - SilcAttributeObjDevice dev; - SilcVCardStruct vcard; - const char *val; - - sg = gc->proto_data; - if (!sg) - return; - - memset(&service, 0, sizeof(service)); - memset(&dev, 0, sizeof(dev)); - memset(&vcard, 0, sizeof(vcard)); - - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_INFO, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_TIMEZONE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_GEOLOCATION, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, NULL); - - /* Set mood */ - mask = 0; - f = purple_request_fields_get_field(fields, "mood_normal"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_NORMAL; - f = purple_request_fields_get_field(fields, "mood_happy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_HAPPY; - f = purple_request_fields_get_field(fields, "mood_sad"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SAD; - f = purple_request_fields_get_field(fields, "mood_angry"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANGRY; - f = purple_request_fields_get_field(fields, "mood_jealous"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; - f = purple_request_fields_get_field(fields, "mood_ashamed"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; - f = purple_request_fields_get_field(fields, "mood_invincible"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; - f = purple_request_fields_get_field(fields, "mood_inlove"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INLOVE; - f = purple_request_fields_get_field(fields, "mood_sleepy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; - f = purple_request_fields_get_field(fields, "mood_bored"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_BORED; - f = purple_request_fields_get_field(fields, "mood_excited"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_EXCITED; - f = purple_request_fields_get_field(fields, "mood_anxious"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set preferred contact */ - mask = 0; - f = purple_request_fields_get_field(fields, "contact_chat"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CHAT; - f = purple_request_fields_get_field(fields, "contact_email"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; - f = purple_request_fields_get_field(fields, "contact_call"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CALL; - f = purple_request_fields_get_field(fields, "contact_sms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_SMS; - f = purple_request_fields_get_field(fields, "contact_mms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_MMS; - f = purple_request_fields_get_field(fields, "contact_video"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; - if (mask) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set status text */ - val = NULL; - f = purple_request_fields_get_field(fields, "status_text"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, - (void *)val, strlen(val)); - - /* Set vcard */ - val = NULL; - f = purple_request_fields_get_field(fields, "vcard"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) { - purple_account_set_string(sg->account, "vcard", val); - tmp = silc_file_readfile(val, &tmp_len); - if (tmp) { - tmp[tmp_len] = 0; - if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_INFO, - (void *)&vcard, - sizeof(vcard)); - } - silc_vcard_free(&vcard); - silc_free(tmp); - } else { - purple_account_set_string(sg->account, "vcard", ""); - } - -#ifdef HAVE_SYS_UTSNAME_H - /* Set device info */ - f = purple_request_fields_get_field(fields, "device"); - if (f && purple_request_field_bool_get_value(f)) { - struct utsname u; - if (!uname(&u)) { - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } - } -#endif - - /* Set timezone */ - val = NULL; - f = purple_request_fields_get_field(fields, "timezone"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)val, strlen(val)); -} - -static void -silcpurple_attrs(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcHashTable attrs; - SilcAttributePayload attr; - gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, - mangry = FALSE, mjealous = FALSE, mashamed = FALSE, - minvincible = FALSE, minlove = FALSE, msleepy = FALSE, - mbored = FALSE, mexcited = FALSE, manxious = FALSE; - gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, - cmms = FALSE, cchat = TRUE, cvideo = FALSE; - gboolean device = TRUE; - char status[1024], tz[16]; - - sg = gc->proto_data; - if (!sg) - return; - - memset(status, 0, sizeof(status)); - - attrs = silc_client_attributes_get(client, conn); - if (attrs) { - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), - NULL, (void *)&attr)) { - SilcUInt32 mood = 0; - silc_attribute_get_object(attr, &mood, sizeof(mood)); - mnormal = !mood; - mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); - msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); - mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); - mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); - mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); - minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); - minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); - msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); - mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); - mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); - manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), - NULL, (void *)&attr)) { - SilcUInt32 contact = 0; - silc_attribute_get_object(attr, &contact, sizeof(contact)); - cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); - ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); - csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); - cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); - cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); - cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), - NULL, (void *)&attr)) - silc_attribute_get_object(attr, &status, sizeof(status)); - - if (!silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), - NULL, (void *)&attr)) - device = FALSE; - } - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l3", _("Your Current Mood")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_email", _("Email"), cemail); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("status_text", _("Your Current Status"), - status[0] ? status : NULL, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); -#if 0 - f = purple_request_field_label_new("l2", _("Online Services")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("services", - _("Let others see what services you are using"), - TRUE); - purple_request_field_group_add_field(g, f); -#endif -#ifdef HAVE_SYS_UTSNAME_H - f = purple_request_field_bool_new("device", - _("Let others see what computer you are using"), - device); - purple_request_field_group_add_field(g, f); -#endif - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("vcard", _("Your VCard File"), - purple_account_get_string(sg->account, "vcard", ""), - FALSE); - purple_request_field_group_add_field(g, f); - - silc_timezone(tz, sizeof(tz)); - f = purple_request_field_string_new("timezone", _("Timezone (UTC)"), tz, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("User Online Status Attributes"), - _("User Online Status Attributes"), - _("You can let other users see your online status information " - "and your personal information. Please fill the information " - "you would like other users to see about yourself."), - fields, - _("OK"), G_CALLBACK(silcpurple_attrs_cb), - _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); -} - -static void -silcpurple_detach(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - /* Call DETACH */ - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; -} - -static void -silcpurple_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - char *tmp; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - if (!sg->motd) { - purple_notify_error( - gc, _("Message of the Day"), _("No Message of the Day available"), - _("There is no Message of the Day associated with this connection")); - return; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); -} - -static void -silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - PurpleRequestField *f; - const char *val, *pkfile = NULL, *prfile = NULL; - const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; - const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; - char *identifier; - int keylen = SILCPURPLE_DEF_PKCS_LEN; - SilcPublicKey public_key; - - sg = gc->proto_data; - if (!sg) - return; - - val = NULL; - f = purple_request_fields_get_field(fields, "pass1"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass1 = val; - else - pass1 = ""; - val = NULL; - f = purple_request_fields_get_field(fields, "pass2"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass2 = val; - else - pass2 = ""; - - if (strcmp(pass1, pass2)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); - return; - } - - val = NULL; - f = purple_request_fields_get_field(fields, "key"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - keylen = atoi(val); - f = purple_request_fields_get_field(fields, "pkfile"); - if (f) - pkfile = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "prfile"); - if (f) - prfile = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "un"); - if (f) - un = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "hn"); - if (f) - hn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "rn"); - if (f) - rn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "e"); - if (f) - e = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "o"); - if (f) - o = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "c"); - if (f) - c = purple_request_field_string_get_value(f); - - identifier = silc_pkcs_silc_encode_identifier((char *)un, (char *)hn, - (char *)rn, (char *)e, - (char *)o, (char *)c, - NULL); - - /* Create the key pair */ - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile, - identifier, pass1, &public_key, NULL, - FALSE)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); - return; - } - - silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); - - silc_pkcs_public_key_free(public_key); - silc_free(identifier); -} - -static void -silcpurple_create_keypair(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - const char *username, *realname; - char *hostname, **u; - char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; - - username = purple_account_get_username(sg->account); - u = g_strsplit(username, "@", 2); - username = u[0]; - realname = purple_account_get_user_info(sg->account); - hostname = silc_net_localhost(); - g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); - - g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); - g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); - g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); - g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("e", _("Email"), tmp, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("o", _("Organization"), "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("c", _("Country"), "", FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("Create New SILC Key Pair"), - _("Create New SILC Key Pair"), NULL, fields, - _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), - _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); - - g_strfreev(u); - silc_free(hostname); -} - -static void -silcpurple_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -static void -silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - char prd[256]; - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, - "private-key", - prd), old ? old : "", new ? new : ""); -} - -static void -silcpurple_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void -silcpurple_set_info(PurpleConnection *gc, const char *text) -{ -} - -static GList * -silcpurple_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Online Status"), - silcpurple_attrs); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Detach From Server"), - silcpurple_detach); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("View Message of the Day"), - silcpurple_view_motd); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Create SILC Key Pair..."), - silcpurple_create_keypair); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Change Password..."), - silcpurple_change_pass); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Set User Info..."), - silcpurple_show_set_info); - list = g_list_append(list, act); - - return list; -} - - -/******************************* IM Routines *********************************/ - -typedef struct { - char *nick; - char *message; - SilcUInt32 message_len; - SilcMessageFlags flags; - PurpleMessageFlags gflags; -} *SilcPurpleIM; - -static void -silcpurple_send_im_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleIM im = context; - PurpleConversation *convo; - char tmp[256]; - SilcClientEntry client_entry; - SilcDList list; - gboolean free_list = FALSE; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, - sg->account); - if (!convo) - return; - - if (!clients) - goto err; - - if (silc_dlist_count(clients) > 1) { - /* Find the correct one. The im->nick might be a formatted nick - so this will find the correct one. */ - clients = silc_client_get_clients_local(client, conn, - im->nick, FALSE); - if (!clients) - goto err; - - free_list = TRUE; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - /* Check for images */ - if (im->gflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(im->message, - (SilcUInt32 *)(void *)&im->flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - silc_client_send_private_message(client, conn, - client_entry, im->flags, sg->sha1hash, - buf->data, - silc_buffer_len(buf)); - silc_mime_partial_free(list); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - } - } - - /* Send the message */ - silc_client_send_private_message(client, conn, client_entry, im->flags, - sg->sha1hash, (unsigned char *)im->message, im->message_len); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - - err: - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), im->nick); - purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - out: - if (free_list) { - silc_client_list_free(client, conn, clients); - } - g_free(im->nick); - g_free(im->message); - silc_free(im); -} - -static int -silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcDList clients; - SilcClientEntry client_entry; - SilcUInt32 mflags; - char *msg, *tmp; - int ret = 0; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - SilcDList list; - - if (!who || !message) - return 0; - - mflags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg = purple_unescape_html(message); - - if (!g_ascii_strncasecmp(msg, "/me ", 4)) { - msg += 4; - if (!*msg) { - g_free(tmp); - return 0; - } - mflags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), - _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - if (sign) - mflags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, who, FALSE); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleIM im = silc_calloc(1, sizeof(*im)); - if (!im) { - g_free(tmp); - return 0; - } - im->nick = g_strdup(who); - im->message = g_strdup(message); - im->message_len = strlen(im->message); - im->flags = mflags; - im->gflags = flags; - silc_client_get_clients(client, conn, who, NULL, - silcpurple_send_im_resolved, im); - g_free(tmp); - return 0; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - /* Check for images */ - if (flags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(message, &mflags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_private_message(client, conn, - client_entry, mflags, sg->sha1hash, - buf->data, - silc_buffer_len(buf)); - silc_mime_partial_free(list); - g_free(tmp); - silc_client_list_free(client, conn, clients); - return ret; - } - } - - /* Send private message directly */ - ret = silc_client_send_private_message(client, conn, client_entry, - mflags, sg->sha1hash, - (unsigned char *)msg, - strlen(msg)); - - g_free(tmp); - silc_client_list_free(client, conn, clients); - return ret; -} - - -static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { - /* split this single menu building function back into the two - original: one for buddies and one for chats */ - if(PURPLE_BLIST_NODE_IS_CHAT(node)) { - return silcpurple_chat_menu((PurpleChat *) node); - } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return silcpurple_buddy_menu((PurpleBuddy *) node); - } else { - g_return_val_if_reached(NULL); - } -} - -/********************************* Commands **********************************/ - -static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - PurpleConversation *convo = conv; - int id = 0; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - if(args && args[0]) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); - - if (convo != NULL) - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); - - if (id == 0) - return PURPLE_CMD_RET_FAILED; - - silcpurple_chat_leave(gc, id); - - return PURPLE_CMD_RET_OK; - -} - -static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - int id = 0; - char *buf, *tmp, *tmp2; - const char *topic; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == 0) - return PURPLE_CMD_RET_FAILED; - - if (!args || !args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); - if (topic) { - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - } - - if (args && args[0] && (strlen(args[0]) > 255)) { - *error = g_strdup(_("Topic too long")); - return PURPLE_CMD_RET_FAILED; - } - - silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - GHashTable *comp; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(comp, "channel", args[0]); - if(args[1]) - g_hash_table_replace(comp, "passphrase", args[1]); - - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); - purple_roomlist_show_with_account(purple_connection_get_account(gc)); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - silcpurple_get_info(gc, args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret; - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret = 1; - PurpleConversation *convo; - PurpleConnection *gc; - PurpleAccount *account; - - if (!args || !args[0]) { - *error = g_strdup(_("You must specify a nick")); - return PURPLE_CMD_RET_FAILED; - } - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - account = purple_connection_get_account(gc); - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); - - if (args[1]) { - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *tmp; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!sg->motd) { - *error = g_strdup(_("There is no Message of the Day associated with this connection")); - return PURPLE_CMD_RET_FAILED; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - SilcChannelEntry channel; - char *silccmd, *silcargs, *msg, tmp[256]; - const char *chname; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL || !args || gc->proto_data == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (args[0]) - chname = args[0]; - else - chname = purple_conversation_get_name(conv); - - if (!args[1]) { - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - *error = g_strdup_printf(_("channel %s not found"), chname); - return PURPLE_CMD_RET_FAILED; - } - if (channel->mode) { - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); - } else { - msg = g_strdup_printf(_("no channel modes are set on %s"), chname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", - msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - return PURPLE_CMD_RET_OK; - } - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *silccmd, *silcargs; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); - g_free(quit_msg); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!silc_client_command_call(sg->client, sg->conn, args[0])) { - *error = g_strdup_printf(_("Unknown command: %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - - -/************************** Plugin Initialization ****************************/ - -static void -silcpurple_register_commands(void) -{ - purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); - purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); - purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); - purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_join, - _("join <channel> [<password>]: Join a chat on this network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); - purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", - silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); - purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_msg, - _("msg <nick> <message>: Send a private message to a user"), NULL); - purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, - _("query <nick> [<message>]: Send a private message to a user"), NULL); - purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, - _("motd: View the server's Message Of The Day"), NULL); - purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_detach, - _("detach: Detach this session"), NULL); - purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, - _("quit [message]: Disconnect from the server, with an optional message"), NULL); - purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_call, - _("call <command>: Call any silc client command"), NULL); - /* These below just get passed through for the silc client library to deal - * with */ - purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); - purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("nick <newnick>: Change your nickname"), NULL); - purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("whowas <nick>: View nick's information"), NULL); - purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, - _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); - purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); - purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("umode <usermodes>: Set your modes in the network"), NULL); - purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); - purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); - purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); - purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("info [server]: View server administrative details"), NULL); - purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); - purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); - purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("stats: View server and network statistics"), NULL); - purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("ping: Send PING to the connected server"), NULL); -#if 0 /* Purple doesn't handle these yet */ - purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_users, - _("users <channel>: List users in channel")); - purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names, - _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); -#endif -} - -static PurpleWhiteboardPrplOps silcpurple_wb_ops = -{ - silcpurple_wb_start, - silcpurple_wb_end, - silcpurple_wb_get_dimensions, - silcpurple_wb_set_dimensions, - silcpurple_wb_get_brush, - silcpurple_wb_set_brush, - silcpurple_wb_send, - silcpurple_wb_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | - OPT_PROTO_SLASH_COMMANDS_NATIVE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - silcpurple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - silcpurple_status_text, /* status_text */ - silcpurple_tooltip_text, /* tooltip_text */ - silcpurple_away_states, /* away_states */ - silcpurple_blist_node_menu, /* blist_node_menu */ - silcpurple_chat_info, /* chat_info */ - silcpurple_chat_info_defaults, /* chat_info_defaults */ - silcpurple_login, /* login */ - silcpurple_close, /* close */ - silcpurple_send_im, /* send_im */ - silcpurple_set_info, /* set_info */ - NULL, /* send_typing */ - silcpurple_get_info, /* get_info */ - silcpurple_set_status, /* set_status */ - silcpurple_idle_set, /* set_idle */ - silcpurple_change_passwd, /* change_passwd */ - silcpurple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - silcpurple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - silcpurple_chat_join, /* join_chat */ - NULL, /* reject_chat */ - silcpurple_get_chat_name, /* get_chat_name */ - silcpurple_chat_invite, /* chat_invite */ - silcpurple_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - silcpurple_chat_send, /* chat_send */ - silcpurple_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - silcpurple_buddy_set_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - silcpurple_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - silcpurple_roomlist_get_list, /* roomlist_get_list */ - silcpurple_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - silcpurple_ftp_send_file, /* send_file */ - silcpurple_ftp_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - &silcpurple_wb_ops, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-silc", /**< id */ - "SILC", /**< name */ - "1.1", /**< version */ - /** summary */ - N_("SILC Protocol Plugin"), - /** description */ - N_("Secure Internet Live Conferencing (SILC) Protocol"), - "Pekka Riikonen", /**< author */ - "http://silcnet.org/", /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - silcpurple_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -#if 0 -static SilcBool silcpurple_debug_cb(char *file, char *function, int line, - char *message, void *context) -{ - purple_debug_info("SILC", "%s:%d:%s - %s\n", file ? file : "(null)", line, function ? function : "(null)", message ? message : "(null)"); - return TRUE; -} -#endif - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleAccountUserSplit *split; - char tmp[256]; - int i; - PurpleKeyValuePair *kvp; - GList *list = NULL; - - silc_plugin = plugin; - - split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Account options */ - option = purple_account_option_string_new(_("Connect server"), - "server", - "silc.silcnet.org"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_int_new(_("Port"), "port", 706); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Public Key file"), - "public-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Private Key file"), - "private-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - for (i = 0; silc_default_ciphers[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_ciphers[i].name); - kvp->value = g_strdup(silc_default_ciphers[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("Cipher"), "cipher", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - list = NULL; - for (i = 0; silc_default_hmacs[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_hmacs[i].name); - kvp->value = g_strdup(silc_default_hmacs[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("HMAC"), "hmac", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use Perfect Forward Secrecy"), - "pfs", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Public key authentication"), - "pubkey-auth", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), - "block-ims", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block messages to whiteboard"), - "block-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Automatically open whiteboard"), - "open-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), - "sign-verify", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_remove("/plugins/prpl/silc"); - - silc_log_set_callback(SILC_LOG_ERROR, silcpurple_log_error, NULL); - silcpurple_register_commands(); - -#if 0 -silc_log_debug(TRUE); -silc_log_set_debug_string("*client*"); -silc_log_quick(TRUE); -silc_log_set_debug_callbacks(silcpurple_debug_cb, NULL, NULL, NULL); -#endif - -} - -PURPLE_INIT_PLUGIN(silc, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silcpurple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silcpurple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silcpurple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/silcpurple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_H -#define SILCPURPLE_H - -/* Purple includes */ -#include "internal.h" -#include "account.h" -#include "accountopt.h" -#include "cmds.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -#undef SILC_VERSION -#define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)) - -/* Default public and private key file names */ -#define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" -#define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" - -/* Default settings for creating key pair */ -#define SILCPURPLE_DEF_PKCS "rsa" -#define SILCPURPLE_DEF_PKCS_LEN 2048 - -#define SILCPURPLE_PRVGRP 0x001fffff - -/* Status IDs */ -#define SILCPURPLE_STATUS_ID_OFFLINE "offline" -#define SILCPURPLE_STATUS_ID_AVAILABLE "available" -#define SILCPURPLE_STATUS_ID_HYPER "hyper" -#define SILCPURPLE_STATUS_ID_AWAY "away" -#define SILCPURPLE_STATUS_ID_BUSY "busy" -#define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" -#define SILCPURPLE_STATUS_ID_PAGE "page" - -typedef struct { - unsigned long id; - const char *channel; - unsigned long chid; - const char *parentch; - SilcChannelPrivateKey key; -} *SilcPurplePrvgrp; - -/* The SILC Purple plugin context */ -typedef struct SilcPurpleStruct { - SilcClient client; - SilcClientConnection conn; - SilcPublicKey public_key; - SilcPrivateKey private_key; - SilcHash sha1hash; - - SilcDList tasks; - guint scheduler; - PurpleConnection *gc; - PurpleAccount *account; - unsigned long channel_ids; - GList *grps; - - char *motd; - PurpleRoomlist *roomlist; - SilcMimeAssembler mimeass; - unsigned int detaching : 1; - unsigned int resuming : 1; - unsigned int roomlist_canceled : 1; - unsigned int chpk : 1; -} *SilcPurple; - - -void silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...); -SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap); -gboolean silcpurple_check_silc_dir(PurpleConnection *gc); -const char *silcpurple_silcdir(void); -const char *silcpurple_session_file(const char *account); -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, - SilcConnectionType conn_type, - SilcPublicKey public_key, - SilcVerifyPublicKey completion, - void *context); -GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_send_buddylist(PurpleConnection *gc); -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port, - SilcUInt16 protocol); -void silcpurple_idle_set(PurpleConnection *gc, int idle); -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -char *silcpurple_status_text(PurpleBuddy *b); -gboolean silcpurple_ip_is_private(const char *ip); -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port); -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context); -void silcpurple_get_info(PurpleConnection *gc, const char *who); -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -GList *silcpurple_chat_info(PurpleConnection *gc); -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -GList *silcpurple_chat_menu(PurpleChat *); -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); -char *silcpurple_get_chat_name(GHashTable *data); -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name); -void silcpurple_chat_leave(PurpleConnection *gc, int id); -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); -void silcpurple_roomlist_cancel(PurpleRoomlist *list); -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcDList channel_pubkeys); -void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr); -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -char *silcpurple_file2mime(const char *filename); -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); - -#ifdef _WIN32 -typedef int uid_t; - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - int pw_uid; /* user id */ - int pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct passwd *getpwuid(int uid); -int getuid(void); -int geteuid(void); -#endif - -#endif /* SILCPURPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/TODO qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/TODO --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/TODO 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -Features TODO (maybe) -===================== - -Preferences - - Add joined channels to buddy list automatically (during - session) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,779 +0,0 @@ -/* - - silcpurple_util.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" - -/**************************** Utility Routines *******************************/ - -static char str[256], str2[256]; - -const char *silcpurple_silcdir(void) -{ - const char *hd = purple_home_dir(); - memset(str, 0, sizeof(str)); - g_snprintf(str, sizeof(str) - 1, "%s" G_DIR_SEPARATOR_S ".silc", hd ? hd : "/tmp"); - return (const char *)str; -} - -const char *silcpurple_session_file(const char *account) -{ - memset(str2, 0, sizeof(str2)); - g_snprintf(str2, sizeof(str2) - 1, "%s" G_DIR_SEPARATOR_S "%s_session", - silcpurple_silcdir(), account); - return (const char *)str2; -} - -gboolean silcpurple_ip_is_private(const char *ip) -{ - if (silc_net_is_ip4(ip)) { - if (!strncmp(ip, "10.", 3)) { - return TRUE; - } else if (!strncmp(ip, "172.", 4) && strlen(ip) > 6) { - char tmp[3]; - int s; - memset(tmp, 0, sizeof(tmp)); - strncpy(tmp, ip + 4, 2); - s = atoi(tmp); - if (s >= 16 && s <= 31) - return TRUE; - } else if (!strncmp(ip, "192.168.", 8)) { - return TRUE; - } - } - - return FALSE; -} - -/* This checks stats for various SILC files and directories. First it - checks if ~/.silc directory exist and is owned by the correct user. If - it doesn't exist, it will create the directory. After that it checks if - user's Public and Private key files exists and creates them if needed. */ - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc) -{ - char filename[256], file_public_key[256], file_private_key[256]; - char servfilename[256], clientfilename[256], friendsfilename[256]; - char pkd[256], prd[256]; - struct stat st; - struct passwd *pw; - int fd; - - pw = getpwuid(getuid()); - if (!pw) { - purple_debug_error("silc", "silc: %s\n", g_strerror(errno)); - return FALSE; - } - - g_snprintf(filename, sizeof(filename) - 1, "%s", silcpurple_silcdir()); - g_snprintf(servfilename, sizeof(servfilename) - 1, "%s" G_DIR_SEPARATOR_S "serverkeys", - silcpurple_silcdir()); - g_snprintf(clientfilename, sizeof(clientfilename) - 1, "%s" G_DIR_SEPARATOR_S "clientkeys", - silcpurple_silcdir()); - g_snprintf(friendsfilename, sizeof(friendsfilename) - 1, "%s" G_DIR_SEPARATOR_S "friends", - silcpurple_silcdir()); - - /* - * Check ~/.silc directory - */ - if ((g_stat(filename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(filename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno)); - return FALSE; - } - } else { -#ifndef _WIN32 - /* Check the owner of the dir */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own '%s' directory\n", - filename); - return FALSE; - } -#endif - } - - /* - * Check ~./silc/serverkeys directory - */ - if ((g_stat(servfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(servfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - servfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/clientkeys directory - */ - if ((g_stat(clientfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(clientfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - clientfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/friends directory - */ - if ((g_stat(friendsfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(friendsfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - friendsfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check Public and Private keys - */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); - g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); - - if ((g_stat(file_public_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, - file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, - NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to create SILC key pair")); - return FALSE; - } - - if ((g_stat(file_public_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the public key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your public key!?\n"); - return FALSE; - } -#endif - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } else if ((g_stat(file_private_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, - file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, - NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to create SILC key pair")); - return FALSE; - } - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } - /* This shouldn't really happen because silc_create_key_pair() - * will set the permissions */ - else if ((g_stat(file_private_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the private key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your private key!?\n"); - if (fd != -1) - close(fd); - return FALSE; - } - - /* Check the permissions for the private key */ - if ((st.st_mode & 0777) != 0600) { - purple_debug_warning("silc", "Wrong permissions in your private key file `%s'!\n" - "Trying to change them ...\n", file_private_key); - if ((fd == -1) || (fchmod(fd, S_IRUSR | S_IWUSR)) == -1) { - purple_debug_error("silc", - "Failed to change permissions for private key file!\n" - "Permissions for your private key file must be 0600.\n"); - if (fd != -1) - close(fd); - return FALSE; - } - purple_debug_warning("silc", "Done.\n\n"); - } -#endif - - if (fd != -1) - close(fd); - - return TRUE; -} - -#ifdef _WIN32 -struct passwd *getpwuid(uid_t uid) { - struct passwd *pwd = calloc(1, sizeof(struct passwd)); - return pwd; -} - -uid_t getuid() { - return 0; -} - -uid_t geteuid() { - return 0; -} -#endif - -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context) -{ - SilcPublicKeyIdentifier ident; - SilcSILCPublicKey silc_pubkey; - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len, key_len = 0; - GString *s; - - /* We support showing only SILC public keys for now */ - if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC) - return; - - silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key); - ident = &silc_pubkey->identifier; - key_len = silc_pkcs_public_key_get_len(public_key); - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - return; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - if (!fingerprint || !babbleprint) - return; - - s = g_string_new(""); - if (ident->realname) - /* Hint for translators: Please check the tabulator width here and in - the next strings (short strings: 2 tabs, longer strings 1 tab, - sum: 3 tabs or 24 characters) */ - g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname); - if (ident->username) - g_string_append_printf(s, _("User Name: \t%s\n"), ident->username); - if (ident->email) - g_string_append_printf(s, _("Email: \t\t%s\n"), ident->email); - if (ident->host) - g_string_append_printf(s, _("Host Name: \t%s\n"), ident->host); - if (ident->org) - g_string_append_printf(s, _("Organization: \t%s\n"), ident->org); - if (ident->country) - g_string_append_printf(s, _("Country: \t%s\n"), ident->country); - g_string_append_printf(s, _("Algorithm: \t%s\n"), silc_pubkey->pkcs->name); - g_string_append_printf(s, _("Key Length: \t%d bits\n"), (int)key_len); - if (ident->version) - g_string_append_printf(s, _("Version: \t%s\n"), ident->version); - g_string_append_printf(s, "\n"); - g_string_append_printf(s, _("Public Key Fingerprint:\n%s\n\n"), fingerprint); - g_string_append_printf(s, _("Public Key Babbleprint:\n%s"), babbleprint); - - purple_request_action(sg->gc, _("Public Key Information"), - _("Public Key Information"), - s->str, 0, purple_connection_get_account(sg->gc), - NULL, NULL, context, 1, _("Close"), callback); - - g_string_free(s, TRUE); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); -} - -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute) -{ - SilcAttributePayload attr = NULL; - - if (!attrs) - return NULL; - - silc_dlist_start(attrs); - while ((attr = silc_dlist_get(attrs)) != SILC_LIST_END) - if (attribute == silc_attribute_get_attribute(attr)) - break; - - return attr; -} - -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if ((mode & SILC_UMODE_SERVER_OPERATOR) || - (mode & SILC_UMODE_ROUTER_OPERATOR)) { - strcat(buf, (mode & SILC_UMODE_SERVER_OPERATOR) ? - "[server operator] " : - (mode & SILC_UMODE_ROUTER_OPERATOR) ? - "[SILC operator] " : "[unknown mode] "); - } - if (mode & SILC_UMODE_GONE) - strcat(buf, "[away] "); - if (mode & SILC_UMODE_INDISPOSED) - strcat(buf, "[indisposed] "); - if (mode & SILC_UMODE_BUSY) - strcat(buf, "[busy] "); - if (mode & SILC_UMODE_PAGE) - strcat(buf, "[wake me up] "); - if (mode & SILC_UMODE_HYPER) - strcat(buf, "[hyperactive] "); - if (mode & SILC_UMODE_ROBOT) - strcat(buf, "[robot] "); - if (mode & SILC_UMODE_ANONYMOUS) - strcat(buf, "[anonymous] "); - if (mode & SILC_UMODE_BLOCK_PRIVMSG) - strcat(buf, "[blocks private messages] "); - if (mode & SILC_UMODE_DETACHED) - strcat(buf, "[detached] "); - if (mode & SILC_UMODE_REJECT_WATCHING) - strcat(buf, "[rejects watching] "); - if (mode & SILC_UMODE_BLOCK_INVITE) - strcat(buf, "[blocks invites] "); - g_strchomp(buf); -} - -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) - strcat(buf, "[permanent] "); - if (mode & SILC_CHANNEL_MODE_PRIVATE) - strcat(buf, "[private] "); - if (mode & SILC_CHANNEL_MODE_SECRET) - strcat(buf, "[secret] "); - if (mode & SILC_CHANNEL_MODE_PRIVKEY) - strcat(buf, "[private key] "); - if (mode & SILC_CHANNEL_MODE_INVITE) - strcat(buf, "[invite only] "); - if (mode & SILC_CHANNEL_MODE_TOPIC) - strcat(buf, "[topic restricted] "); - if (mode & SILC_CHANNEL_MODE_ULIMIT) - strcat(buf, "[user count limit] "); - if (mode & SILC_CHANNEL_MODE_PASSPHRASE) - strcat(buf, "[passphrase auth] "); - if (mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) - strcat(buf, "[public key auth] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_USERS) - strcat(buf, "[users silenced] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_OPERS) - strcat(buf, "[operators silenced] "); - g_strchomp(buf); -} - -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strcat(buf, "[founder] "); - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strcat(buf, "[operator] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES) - strcat(buf, "[blocks messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_USERS) - strcat(buf, "[blocks user messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS) - strcat(buf, "[blocks robot messages] "); - if (mode & SILC_CHANNEL_UMODE_QUIET) - strcat(buf, "[quieted] "); - g_strchomp(buf); -} - -void -silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr) -{ - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - SilcAttributeContact contact; - SilcAttributeObjDevice device; - SilcAttributeObjGeo geo; - - char tmp[1024]; - GString *s; - - *moodstr = NULL; - *statusstr = NULL; - *contactstr = NULL; - *langstr = NULL; - *devicestr = NULL; - *tzstr = NULL; - *geostr = NULL; - - if (!attrs) - return; - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - g_string_append_printf(s, "[%s] ", _("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - g_string_append_printf(s, "[%s] ", _("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - g_string_append_printf(s, "[%s] ", _("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - g_string_append_printf(s, "[%s] ", _("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - g_string_append_printf(s, "[%s] ", _("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - g_string_append_printf(s, "[%s] ", _("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - g_string_append_printf(s, "[%s] ", _("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - g_string_append_printf(s, "[%s] ", _("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - g_string_append_printf(s, "[%s] ", _("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - g_string_append_printf(s, "[%s] ", _("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - g_string_append_printf(s, "[%s] ", _("Anxious")); - } - if (strlen(s->str)) { - *moodstr = g_string_free(s, FALSE); - g_strchomp(*moodstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *statusstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); - if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { - if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) - g_string_append_printf(s, "[%s] ", _("Chat")); - if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) - g_string_append_printf(s, "[%s] ", _("Email")); - if (contact & SILC_ATTRIBUTE_CONTACT_CALL) - g_string_append_printf(s, "[%s] ", _("Phone")); - if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) - g_string_append_printf(s, "[%s] ", _("Paging")); - if (contact & SILC_ATTRIBUTE_CONTACT_SMS) - g_string_append_printf(s, "[%s] ", _("SMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_MMS) - g_string_append_printf(s, "[%s] ", _("MMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) - g_string_append_printf(s, "[%s] ", _("Video Conferencing")); - } - if (strlen(s->str)) { - *contactstr = g_string_free(s, FALSE); - g_strchomp(*contactstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *langstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_DEVICE_INFO); - memset(&device, 0, sizeof(device)); - if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { - if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) - g_string_append_printf(s, "%s: ", _("Computer")); - if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) - g_string_append_printf(s, "%s: ", _("Mobile Phone")); - if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) - g_string_append_printf(s, "%s: ", _("PDA")); - if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) - g_string_append_printf(s, "%s: ", _("Terminal")); - g_string_append_printf(s, "%s %s %s %s", - device.manufacturer ? device.manufacturer : "", - device.version ? device.version : "", - device.model ? device.model : "", - device.language ? device.language : ""); - } - if (strlen(s->str)) - *devicestr = g_string_free(s, FALSE); - else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_TIMEZONE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *tzstr = g_strdup(tmp); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_GEOLOCATION); - memset(&geo, 0, sizeof(geo)); - if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) - *geostr = g_strdup_printf("%s %s %s (%s)", - geo.longitude ? geo.longitude : "", - geo.latitude ? geo.latitude : "", - geo.altitude ? geo.altitude : "", - geo.accuracy ? geo.accuracy : ""); -} - -/* Returns MIME type of filetype */ - -char *silcpurple_file2mime(const char *filename) -{ - const char *ct; - - ct = strrchr(filename, '.'); - if (!ct) - return NULL; - else if (!g_ascii_strcasecmp(".png", ct)) - return g_strdup("image/png"); - else if (!g_ascii_strcasecmp(".jpg", ct)) - return g_strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".jpeg", ct)) - return g_strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".gif", ct)) - return g_strdup("image/gif"); - else if (!g_ascii_strcasecmp(".tiff", ct)) - return g_strdup("image/tiff"); - - return NULL; -} - -/* Checks if message has images, and assembles MIME message if it has. - If only one image is present, creates simple MIME image message. If - there are multiple images and/or text with images multipart MIME - message is created. */ - -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags) -{ - SilcMime mime = NULL, p; - SilcDList list, parts = NULL; - const char *start, *end, *last; - GData *attribs; - char *type; - gboolean images = FALSE; - - last = msg; - while (last && *last && purple_markup_find_tag("img", last, &start, - &end, &attribs)) { - PurpleStoredImage *image = NULL; - const char *id; - - /* Check if there is text before image */ - if (start - last) { - char *text, *tmp; - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - tmp = g_strndup(last, start - last); - text = purple_unescape_html(tmp); - g_free(tmp); - - /* Add text */ - silc_mime_add_data(p, (const unsigned char *)text, strlen(text)); - g_free(text); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - id = g_datalist_get_data(&attribs, "id"); - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - unsigned long imglen = purple_imgstore_get_size(image); - gconstpointer img = purple_imgstore_get_data(image); - - p = silc_mime_alloc(); - - /* Add content type */ - type = silcpurple_file2mime(purple_imgstore_get_filename(image)); - if (!type) { - g_datalist_clear(&attribs); - last = end + 1; - continue; - } - silc_mime_add_field(p, "Content-Type", type); - g_free(type); - - /* Add content transfer encoding */ - silc_mime_add_field(p, "Content-Transfer-Encoding", "binary"); - - /* Add image data */ - silc_mime_add_data(p, img, imglen); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - images = TRUE; - } - - g_datalist_clear(&attribs); - - /* Continue after tag */ - last = end + 1; - } - - /* Check for text after the image(s) */ - if (images && last && *last) { - char *tmp = purple_unescape_html(last); - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - /* Add text */ - silc_mime_add_data(p, (const unsigned char *)tmp, strlen(tmp)); - g_free(tmp); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - /* If there weren't any images, don't return anything. */ - if (!images) { - if (parts) - silc_dlist_uninit(parts); - return NULL; - } - - if (silc_dlist_count(parts) > 1) { - /* Multipart MIME message */ - char b[32]; - mime = silc_mime_alloc(); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - g_snprintf(b, sizeof(b), "b%4X%4X", - (unsigned int)time(NULL), - silc_dlist_count(parts)); - silc_mime_set_multipart(mime, "mixed", b); - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) - silc_mime_add_multipart(mime, p); - } else { - /* Simple MIME message */ - silc_dlist_start(parts); - mime = silc_dlist_get(parts); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - } - - *mflags &= ~SILC_MESSAGE_FLAG_UTF8; - *mflags |= SILC_MESSAGE_FLAG_DATA; - - /* Encode message. Fragment if it is too large */ - list = silc_mime_encode_partial(mime, 0xfc00); - - silc_dlist_uninit(parts); - - /* Added multiparts gets freed here */ - silc_mime_free(mime); - - return list; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -/* - - wb.c - - Author: Pekka Riikonen - - Copyright (C) 2005 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/* - SILC Whiteboard packet: - - 1 byte command - 2 bytes width - 2 bytes height - 4 bytes brush color - 2 bytes brush size - n bytes data - - Data: - - 4 bytes x - 4 bytes y - - Commands: - - 0x01 draw - 0x02 clear - - MIME: - - MIME-Version: 1.0 - Content-Type: application/x-wb - Content-Transfer-Encoding: binary - -*/ - -#define SILCPURPLE_WB_MIME "MIME-Version: 1.0\r\nContent-Type: application/x-wb\r\nContent-Transfer-Encoding: binary\r\n\r\n" -#define SILCPURPLE_WB_HEADER strlen(SILCPURPLE_WB_MIME) + 11 - -#define SILCPURPLE_WB_WIDTH 500 -#define SILCPURPLE_WB_HEIGHT 400 -#define SILCPURPLE_WB_WIDTH_MAX 1024 -#define SILCPURPLE_WB_HEIGHT_MAX 1024 - -/* Commands */ -typedef enum { - SILCPURPLE_WB_DRAW = 0x01, - SILCPURPLE_WB_CLEAR = 0x02, -} SilcPurpleWbCommand; - -/* Brush size */ -typedef enum { - SILCPURPLE_WB_BRUSH_SMALL = 2, - SILCPURPLE_WB_BRUSH_MEDIUM = 5, - SILCPURPLE_WB_BRUSH_LARGE = 10, -} SilcPurpleWbBrushSize; - -/* Brush color (XXX Purple should provide default colors) */ -typedef enum { - SILCPURPLE_WB_COLOR_BLACK = 0, - SILCPURPLE_WB_COLOR_RED = 13369344, - SILCPURPLE_WB_COLOR_GREEN = 52224, - SILCPURPLE_WB_COLOR_BLUE = 204, - SILCPURPLE_WB_COLOR_YELLOW = 15658496, - SILCPURPLE_WB_COLOR_ORANGE = 16737792, - SILCPURPLE_WB_COLOR_CYAN = 52428, - SILCPURPLE_WB_COLOR_VIOLET = 5381277, - SILCPURPLE_WB_COLOR_PURPLE = 13369548, - SILCPURPLE_WB_COLOR_TAN = 12093547, - SILCPURPLE_WB_COLOR_BROWN = 5256485, - SILCPURPLE_WB_COLOR_GREY = 11184810, - SILCPURPLE_WB_COLOR_WHITE = 16777215, -} SilcPurpleWbColor; - -typedef struct { - int type; /* 0 = buddy, 1 = channel */ - union { - SilcClientEntry client; - SilcChannelEntry channel; - } u; - int width; - int height; - int brush_size; - int brush_color; -} *SilcPurpleWb; - -/* Initialize whiteboard */ - -PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) -{ - SilcClientConnection conn; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - conn = sg->conn; - wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); - if (!wb) - wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 0; - wbs->u.client = client_entry; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) -{ - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) - wb = purple_whiteboard_create(sg->account, channel->channel_name, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 1; - wbs->u.channel = channel; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, - unsigned char *message, SilcUInt32 message_len) -{ - SilcUInt8 command; - SilcUInt16 width, height, brush_size; - SilcUInt32 brush_color, x, y, dx, dy; - SilcBufferStruct buf; - int ret; - - /* Parse the packet */ - silc_buffer_set(&buf, message, message_len); - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_CHAR(&command), - SILC_STR_UI_SHORT(&width), - SILC_STR_UI_SHORT(&height), - SILC_STR_UI_INT(&brush_color), - SILC_STR_UI_SHORT(&brush_size), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, ret); - - /* Update whiteboard if its dimensions changed */ - if (width != wbs->width || height != wbs->height) - silcpurple_wb_set_dimensions(wb, height, width); - - if (command == SILCPURPLE_WB_DRAW) { - /* Parse data and draw it */ - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - x = dx; - y = dy; - while (silc_buffer_len(&buf) > 0) { - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - - purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy, - brush_color, brush_size); - x += dx; - y += dy; - } - } - - if (command == SILCPURPLE_WB_CLEAR) - purple_whiteboard_clear(wb); -} - -typedef struct { - unsigned char *message; - SilcUInt32 message_len; - SilcPurple sg; - SilcClientEntry sender; - SilcChannelEntry channel; -} *SilcPurpleWbRequest; - -static void -silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) -{ - PurpleWhiteboard *wb; - - if (id != 1) - goto out; - - if (!req->channel) - wb = silcpurple_wb_init(req->sg, req->sender); - else - wb = silcpurple_wb_init_ch(req->sg, req->channel); - - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); - - out: - silc_free(req->message); - silc_free(req); -} - -static void -silcpurple_wb_request(SilcClient client, const unsigned char *message, - SilcUInt32 message_len, SilcClientEntry sender, - SilcChannelEntry channel) -{ - char tmp[256]; - SilcPurpleWbRequest req; - PurpleConnection *gc; - SilcPurple sg; - - gc = client->application; - sg = gc->proto_data; - - /* Open whiteboard automatically if requested */ - if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { - PurpleWhiteboard *wb; - - if (!channel) - wb = silcpurple_wb_init(sg, sender); - else - wb = silcpurple_wb_init_ch(sg, channel); - - silcpurple_wb_parse(wb->proto_data, wb, - (unsigned char *)message, - message_len); - return; - } - - /* Close any previous unaccepted requests */ - purple_request_close_with_handle(sender); - - if (!channel) { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard. Would you like " - "to open the whiteboard?"), sender->nickname); - } else { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard on %s channel. " - "Would you like to open the whiteboard?"), - sender->nickname, channel->channel_name); - } - - req = silc_calloc(1, sizeof(*req)); - if (!req) - return; - req->message = silc_memdup(message, message_len); - req->message_len = message_len; - req->sender = sender; - req->channel = channel; - req->sg = sg; - - purple_request_action(gc, _("Whiteboard"), tmp, NULL, 1, - sg->account, sender->nickname, NULL, req, 2, - _("Yes"), G_CALLBACK(silcpurple_wb_request_cb), - _("No"), G_CALLBACK(silcpurple_wb_request_cb)); -} - -/* Process incoming whiteboard message */ - -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, sender->nickname); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, NULL); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Process incoming whiteboard message on channel */ - -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, channel); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Send whiteboard message */ - -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - GList *list; - int len; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - for (list = draw_list; list; list = list->next) - len += 4; - - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_DRAW), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - silc_buffer_pull(packet, SILCPURPLE_WB_HEADER); - for (list = draw_list; list; list = list->next) { - silc_buffer_format(packet, - SILC_STR_UI_INT(GPOINTER_TO_INT(list->data)), - SILC_STR_END); - silc_buffer_pull(packet, 4); - } - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } else if (wbs->type == 1) { - /* Channel message. Channel private keys are not supported. */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } - - silc_buffer_free(packet); -} - -/* Purple Whiteboard operations */ - -void silcpurple_wb_start(PurpleWhiteboard *wb) -{ - /* Nothing here. Everything is in initialization */ -} - -void silcpurple_wb_end(PurpleWhiteboard *wb) -{ - silc_free(wb->proto_data); - wb->proto_data = NULL; -} - -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - SilcPurpleWb wbs = wb->proto_data; - *width = wbs->width; - *height = wbs->height; -} - -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : - width; - wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : - height; - - /* Update whiteboard */ - purple_whiteboard_set_dimensions(wb, wbs->width, wbs->height); -} - -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - SilcPurpleWb wbs = wb->proto_data; - *size = wbs->brush_size; - *color = wbs->brush_color; -} - -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->brush_size = size; - wbs->brush_color = color; - - /* Update whiteboard */ - purple_whiteboard_set_brush(wb, size, color); -} - -void silcpurple_wb_clear(PurpleWhiteboard *wb) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - int len; - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_CLEAR), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } else if (wbs->type == 1) { - /* Channel message */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } - - silc_buffer_free(packet); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc/wb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_WB_H -#define SILCPURPLE_WB_H - -#include "silcpurple.h" -#include "whiteboard.h" - -PurpleWhiteboard * -silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry); -PurpleWhiteboard * -silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel); -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_start(PurpleWhiteboard *wb); -void silcpurple_wb_end(PurpleWhiteboard *wb); -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height); -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color); -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list); -void silcpurple_wb_clear(PurpleWhiteboard *wb); - -#endif /* SILCPURPLE_WB_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1748 +0,0 @@ -/* - - silcpurple_buddy.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Key Agreement *********************************/ - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data); - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local); - -typedef struct { - char *nick; - PurpleConnection *gc; -} *SilcPurpleResolve; - -static void -silcpurple_buddy_keyagr_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleResolve r = context; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), r->nick); - purple_notify_error(gc, _("Key Agreement"), - _("Cannot perform the key agreement"), tmp); - silc_free(r->nick); - silc_free(r); - return; - } - - silcpurple_buddy_keyagr_do(gc, r->nick, FALSE); - silc_free(r->nick); - silc_free(r); -} - -typedef struct { - gboolean responder; -} *SilcPurpleKeyAgr; - -static void -silcpurple_buddy_keyagr_cb(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - SilcKeyAgreementStatus status, - SilcSKEKeyMaterial *key, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleKeyAgr a = context; - - if (!sg->conn) - return; - - switch (status) { - case SILC_KEY_AGREEMENT_OK: - { - PurpleConversation *convo; - char tmp[128]; - - /* Set the private key for this client */ - silc_client_del_private_message_key(client, conn, client_entry); - silc_client_add_private_message_key_ske(client, conn, client_entry, - NULL, NULL, key, a->responder); - silc_ske_free_key_material(key); - - - /* Open IM window */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - client_entry->nickname, sg->account); - if (convo) { - /* we don't have windows in the core anymore...but we may want to - * provide some method for asking the UI to show the window - purple_conv_window_show(purple_conversation_get_window(convo)); - */ - } else { - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, sg->account, - client_entry->nickname); - } - g_snprintf(tmp, sizeof(tmp), "%s [private key]", client_entry->nickname); - purple_conversation_set_title(convo, tmp); - } - break; - - case SILC_KEY_AGREEMENT_ERROR: - purple_notify_error(gc, _("Key Agreement"), - _("Error occurred during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_FAILURE: - purple_notify_error(gc, _("Key Agreement"), _("Key Agreement failed"), NULL); - break; - - case SILC_KEY_AGREEMENT_TIMEOUT: - purple_notify_error(gc, _("Key Agreement"), - _("Timeout during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_ABORTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement was aborted"), NULL); - break; - - case SILC_KEY_AGREEMENT_ALREADY_STARTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement is already started"), NULL); - break; - - case SILC_KEY_AGREEMENT_SELF_DENIED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement cannot be started with yourself"), - NULL); - break; - - default: - break; - } - - silc_free(a); -} - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local) -{ - SilcPurple sg = gc->proto_data; - SilcClientEntry *clients; - SilcUInt32 clients_count; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - char *nickname; - SilcPurpleKeyAgr a; - - if (!sg->conn || !name) - return; - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, nickname, name, - &clients_count); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleResolve r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->nick = g_strdup(name); - r->gc = gc; - silc_client_get_clients(sg->client, sg->conn, nickname, NULL, - silcpurple_buddy_keyagr_resolved, r); - silc_free(nickname); - return; - } - - /* Resolve the local IP from the outgoing socket connection. We resolve - it to check whether we have a private range IP address or public IP - address. If we have public then we will assume that we are not behind - NAT and will provide automatically the point of connection to the - agreement. If we have private range address we assume that we are - behind NAT and we let the responder provide the point of connection. - - The algorithm also checks the remote IP address of server connection. - If it is private range address and we have private range address we - assume that we are chatting in LAN and will provide the point of - connection. - - Naturally this algorithm does not always get things right. */ - - if (silc_net_check_local_by_sock(sg->conn->sock->sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (!force_local && silcpurple_ip_is_private(local_ip)) { - local = FALSE; - - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sg->conn->sock->sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide - the connection point. */ - local = TRUE; - } - } - - if (force_local) - local = TRUE; - - if (local && !local_ip) - local_ip = silc_net_localip(); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->responder = local; - - /* Send the key agreement request */ - silc_client_send_key_agreement(sg->client, sg->conn, clients[0], - local ? local_ip : NULL, NULL, 0, 60, - silcpurple_buddy_keyagr_cb, a); - - silc_free(local_ip); - silc_free(remote_ip); - silc_free(clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - char *hostname; - SilcUInt16 port; -} *SilcPurpleKeyAgrAsk; - -static void -silcpurple_buddy_keyagr_request_cb(SilcPurpleKeyAgrAsk a, gint id) -{ - SilcPurpleKeyAgr ai; - SilcClientEntry client_entry; - - if (id != 1) - goto out; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(a->client, a->conn, - &a->client_id); - if (!client_entry) { - purple_notify_error(a->client->application, _("Key Agreement"), - _("The remote user is not present in the network any more"), - NULL); - goto out; - } - - /* If the hostname was provided by the requestor perform the key agreement - now. Otherwise, we will send him a request to connect to us. */ - if (a->hostname) { - ai = silc_calloc(1, sizeof(*ai)); - if (!ai) - goto out; - ai->responder = FALSE; - silc_client_perform_key_agreement(a->client, a->conn, client_entry, - a->hostname, a->port, - silcpurple_buddy_keyagr_cb, ai); - } else { - /* Send request. Force us as the point of connection since requestor - did not provide the point of connection. */ - silcpurple_buddy_keyagr_do(a->client->application, - client_entry->nickname, TRUE); - } - - out: - silc_free(a->hostname); - silc_free(a); -} - -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port) -{ - char tmp[128], tmp2[128]; - SilcPurpleKeyAgrAsk a; - PurpleConnection *gc = client->application; - - g_snprintf(tmp, sizeof(tmp), - _("Key agreement request received from %s. Would you like to " - "perform the key agreement?"), client_entry->nickname); - if (hostname) - g_snprintf(tmp2, sizeof(tmp2), - _("The remote user is waiting key agreement on:\n" - "Remote host: %s\nRemote port: %d"), hostname, port); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->client = client; - a->conn = conn; - a->client_id = *client_entry->id; - if (hostname) - a->hostname = strdup(hostname); - a->port = port; - - purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, - NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), - _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); -} - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - - buddy = (PurpleBuddy *)node; - silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE); -} - - -/**************************** Static IM Key **********************************/ - -static void -silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - char *nickname; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - if (!silc_parse_userfqdn(b->name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, b->name, - &clients_count); - if (!clients) { - silc_free(nickname); - return; - } - - clients[0]->prv_resp = FALSE; - silc_client_del_private_message_key(sg->client, sg->conn, - clients[0]); - silc_free(clients); - silc_free(nickname); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurplePrivkey; - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_privkey_cb(SilcPurplePrivkey p, const char *passphrase) -{ - SilcClientEntry client_entry; - - if (!passphrase || !(*passphrase)) { - silc_free(p); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(p->client, p->conn, - &p->client_id); - if (!client_entry) { - purple_notify_error(p->client->application, _("IM With Password"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(p); - return; - } - - /* Set the private message key */ - silc_client_del_private_message_key(p->client, p->conn, - client_entry); - silc_client_add_private_message_key(p->client, p->conn, - client_entry, NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), FALSE, - client_entry->prv_resp); - if (!client_entry->prv_resp) - silc_client_send_private_message_key_request(p->client, - p->conn, - client_entry); - silc_free(p); -} - -static void -silcpurple_buddy_privkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("IM With Password"), - _("Cannot set IM key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_privkey(client->application, context); - silc_free(context); -} - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - char *nickname; - SilcPurplePrivkey p; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - if (!name) - return; - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(sg->client, sg->conn, nickname, NULL, - silcpurple_buddy_privkey_resolved, - g_strdup(name)); - silc_free(nickname); - return; - } - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->client = sg->client; - p->conn = sg->conn; - p->client_id = *clients[0]->id; - purple_request_input(gc, _("IM With Password"), NULL, - _("Set IM Password"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), - _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); - - silc_free(clients); - silc_free(nickname); -} - -static void -silcpurple_buddy_privkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - silcpurple_buddy_privkey(gc, buddy->name); -} - - -/**************************** Get Public Key *********************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurpleBuddyGetkey; - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_getkey_cb(SilcPurpleBuddyGetkey g, - SilcClientCommandReplyContext cmd) -{ - SilcClientEntry client_entry; - unsigned char *pk; - SilcUInt32 pk_len; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(g->client, g->conn, - &g->client_id); - if (!client_entry) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return; - } - - if (!client_entry->public_key) { - silc_free(g); - return; - } - - /* Now verify the public key */ - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - silcpurple_verify_public_key(g->client, g->conn, client_entry->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - NULL, NULL); - silc_free(pk); - silc_free(g); -} - -static void -silcpurple_buddy_getkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("Get Public Key"), - _("Cannot fetch the public key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_getkey(client->application, context); - silc_free(context); -} - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count; - SilcPurpleBuddyGetkey g; - char *nickname; - - if (!name) - return; - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_buddy_getkey_resolved, - g_strdup(name)); - silc_free(nickname); - return; - } - - /* Call GETKEY */ - g = silc_calloc(1, sizeof(*g)); - if (!g) - return; - g->client = client; - g->conn = conn; - g->client_id = *clients[0]->id; - silc_client_command_call(client, conn, NULL, "GETKEY", - clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_buddy_getkey_cb, g); - silc_free(clients); - silc_free(nickname); -} - -static void -silcpurple_buddy_getkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - silcpurple_buddy_getkey(gc, buddy->name); -} - -static void -silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcPublicKey public_key; - const char *pkfile; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - pkfile = purple_blist_node_get_string(node, "public-key"); - if (!silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_BIN)) { - purple_notify_error(gc, - _("Show Public Key"), - _("Could not load public key"), NULL); - return; - } - - silcpurple_show_public_key(sg, b->name, public_key, NULL, NULL); - silc_pkcs_public_key_free(public_key); -} - - -/**************************** Buddy routines *********************************/ - -/* The buddies are implemented by using the WHOIS and WATCH commands that - can be used to search users by their public key. Since nicknames aren't - unique in SILC we cannot trust the buddy list using their nickname. We - associate public keys to buddies and use those to search and watch - in the network. - - The problem is that Purple does not return PurpleBuddy contexts to the - callbacks but the buddy names. Naturally, this is not going to work - with SILC. But, for now, we have to do what we can... */ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - PurpleBuddy *b; - unsigned char *offline_pk; - SilcUInt32 offline_pk_len; - unsigned int offline : 1; - unsigned int pubkey_search : 1; - unsigned int init : 1; -} *SilcPurpleBuddyRes; - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id); -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context); - -void silcpurple_get_info(PurpleConnection *gc, const char *who) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - PurpleBuddy *b; - const char *filename, *nick = who; - char tmp[256]; - - if (!who) - return; - if (strlen(who) > 1 && who[0] == '@') - nick = who + 1; - if (strlen(who) > 1 && who[0] == '*') - nick = who + 1; - if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') - nick = who + 2; - - b = purple_find_buddy(gc->account, nick); - if (b) { - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - "-details", "-pubkey", filename, NULL); - return; - } - - if (!b->proto_data) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), b->name); - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), tmp); - return; - } - - client_entry = silc_client_get_client_by_id(client, conn, b->proto_data); - if (client_entry) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - client_entry->nickname, "-details", NULL); - } - } else { - /* Call WHOIS just with nickname. */ - silc_client_command_call(client, conn, NULL, "WHOIS", nick, NULL); - } -} - -static void -silcpurple_add_buddy_pk_no(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - r->b->name); - purple_notify_error(r->client->application, _("Add Buddy"), tmp, - _("You cannot receive buddy notifications until you " - "import his/her public key. You can use the Get Public Key " - "command to get the public key.")); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); -} - -static void -silcpurple_add_buddy_save(bool success, void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcClient client = r->client; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttribute attribute; - SilcVCardStruct vcard; - SilcAttributeObjMime message, extension; -#ifdef SILC_ATTRIBUTE_USER_ICON - SilcAttributeObjMime usericon; -#endif - SilcAttributeObjPk serverpk, usersign, serversign; - gboolean usign_success = TRUE, ssign_success = TRUE; - char filename[512], filename2[512], *fingerprint = NULL, *tmp; - SilcUInt32 len; - int i; - - if (!success) { - /* The user did not trust the public key. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - if (r->offline) { - /* User is offline. Associate the imported public key with - this user. */ - fingerprint = silc_hash_fingerprint(NULL, r->offline_pk, - r->offline_pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - silc_free(fingerprint); - silc_free(r->offline_pk); - silc_free(r); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry) { - silc_free(r); - return; - } - - memset(&vcard, 0, sizeof(vcard)); - memset(&message, 0, sizeof(message)); - memset(&extension, 0, sizeof(extension)); -#ifdef SILC_ATTRIBUTE_USER_ICON - memset(&usericon, 0, sizeof(usericon)); -#endif - memset(&serverpk, 0, sizeof(serverpk)); - memset(&usersign, 0, sizeof(usersign)); - memset(&serversign, 0, sizeof(serversign)); - - /* Now that we have the public key and we trust it now we - save the attributes of the buddy and update its status. */ - - if (client_entry->attrs) { - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) - != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - - switch (attribute) { - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - break; - - case SILC_ATTRIBUTE_STATUS_MESSAGE: - if (!silc_attribute_get_object(attr, (void *)&message, - sizeof(message))) - continue; - break; - - case SILC_ATTRIBUTE_EXTENSION: - if (!silc_attribute_get_object(attr, (void *)&extension, - sizeof(extension))) - continue; - break; - -#ifdef SILC_ATTRIBUTE_USER_ICON - case SILC_ATTRIBUTE_USER_ICON: - if (!silc_attribute_get_object(attr, (void *)&usericon, - sizeof(usericon))) - continue; - break; -#endif - - case SILC_ATTRIBUTE_SERVER_PUBLIC_KEY: - if (serverpk.type) - continue; - if (!silc_attribute_get_object(attr, (void *)&serverpk, - sizeof(serverpk))) - continue; - break; - - case SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE: - if (usersign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&usersign, - sizeof(usersign))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_DIGITAL_SIGNATURE: - if (serversign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&serversign, - sizeof(serversign))) - continue; - break; - - default: - break; - } - } - } - - /* Verify the attribute signatures */ - - if (usersign.data) { - SilcPKCS pkcs; - unsigned char *verifyd; - SilcUInt32 verify_len; - - silc_pkcs_alloc((unsigned char*)"rsa", &pkcs); - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - FALSE, &verify_len); - if (verifyd && silc_pkcs_public_key_set(pkcs, client_entry->public_key)){ - if (!silc_pkcs_verify_with_hash(pkcs, client->sha1hash, - usersign.data, - usersign.data_len, - verifyd, verify_len)) - usign_success = FALSE; - } - silc_free(verifyd); - } - - if (serversign.data && !strcmp(serverpk.type, "silc-rsa")) { - SilcPublicKey public_key; - SilcPKCS pkcs; - unsigned char *verifyd; - SilcUInt32 verify_len; - - if (silc_pkcs_public_key_decode(serverpk.data, serverpk.data_len, - &public_key)) { - silc_pkcs_alloc((unsigned char *)"rsa", &pkcs); - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - TRUE, &verify_len); - if (verifyd && silc_pkcs_public_key_set(pkcs, public_key)) { - if (!silc_pkcs_verify_with_hash(pkcs, client->sha1hash, - serversign.data, - serversign.data_len, - verifyd, verify_len)) - ssign_success = FALSE; - } - silc_pkcs_public_key_free(public_key); - silc_free(verifyd); - } - } - - fingerprint = silc_fingerprint(client_entry->fingerprint, - client_entry->fingerprint_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - if (usign_success || ssign_success) { - struct passwd *pw; - struct stat st; - - memset(filename2, 0, sizeof(filename2)); - - /* Filename for dir */ - tmp = fingerprint + strlen(fingerprint) - 9; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "friends" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), tmp); - - pw = getpwuid(getuid()); - if (!pw) - return; - - /* Create dir if it doesn't exist */ - if ((g_stat(filename, &st)) == -1) { - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - int ret = g_mkdir(filename, 0755); - if (ret < 0) - return; - } - } - } - - /* Save VCard */ - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "vcard", filename); - if (vcard.full_name) { - tmp = (char *)silc_vcard_encode(&vcard, &len); - silc_file_writefile(filename2, tmp, len); - silc_free(tmp); - } - - /* Save status message */ - if (message.mime) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "status_message.mime", - filename); - silc_file_writefile(filename2, (char *)message.mime, - message.mime_len); - } - - /* Save extension data */ - if (extension.mime) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "extension.mime", - filename); - silc_file_writefile(filename2, (char *)extension.mime, - extension.mime_len); - } - -#ifdef SILC_ATTRIBUTE_USER_ICON - /* Save user icon */ - if (usericon.mime) { - SilcMime m = silc_mime_decode(usericon.mime, - usericon.mime_len); - if (m) { - const char *type = silc_mime_get_field(m, "Content-Type"); - if (!strcmp(type, "image/jpeg") || - !strcmp(type, "image/gif") || - !strcmp(type, "image/bmp") || - !strcmp(type, "image/png")) { - const unsigned char *data; - SilcUInt32 data_len; - data = silc_mime_get_data(m, &data_len); - if (data) { - /* TODO: Check if SILC gives us something to use as the checksum instead */ - purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len, NULL); - } - } - silc_mime_free(m); - } - } -#endif - } - - /* Save the public key path to buddy properties, as it is used - to identify the buddy in the network (and not the nickname). */ - memset(filename, 0, sizeof(filename)); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - - /* Update online status */ - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - - /* Finally, start watching this user so we receive its status - changes from the server */ - g_snprintf(filename2, sizeof(filename2) - 1, "+%s", filename); - silc_client_command_call(r->client, r->conn, NULL, "WATCH", "-pubkey", - filename2, NULL); - - silc_free(fingerprint); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_import(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - SilcPublicKey public_key; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_BIN)) { - silcpurple_add_buddy_ask_pk_cb(r, 0); - purple_notify_error(r->client->application, - _("Add Buddy"), _("Could not load public key"), NULL); - return; - } - - /* Now verify the public key */ - r->offline_pk = silc_pkcs_public_key_encode(public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, r->b->name, - SILC_SOCKET_TYPE_CLIENT, - r->offline_pk, r->offline_pk_len, - SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_ask_pk_cancel(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id) -{ - if (id != 0) { - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - /* Open file selector to select the public key. */ - purple_request_file(r->client->application, _("Open..."), NULL, FALSE, - G_CALLBACK(silcpurple_add_buddy_ask_import), - G_CALLBACK(silcpurple_add_buddy_ask_pk_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); - -} - -static void -silcpurple_add_buddy_ask_pk(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - r->b->name); - purple_request_action(r->client->application, _("Add Buddy"), tmp, - _("To add the buddy you must import his/her public key. " - "Press Import to import a public key."), 0, - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r, 2, - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb), - _("_Import..."), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb)); -} - -static void -silcpurple_add_buddy_getkey_cb(SilcPurpleBuddyRes r, - SilcClientCommandReplyContext cmd) -{ - SilcClientEntry client_entry; - unsigned char *pk; - SilcUInt32 pk_len; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry || !client_entry->public_key) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* Now verify the public key */ - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - silcpurple_verify_public_key(r->client, r->conn, client_entry->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); - silc_free(pk); -} - -static void -silcpurple_add_buddy_select_cb(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - PurpleRequestField *f; - GList *list; - SilcClientEntry client_entry; - - f = purple_request_fields_get_field(fields, "list"); - list = purple_request_field_list_get_selected(f); - if (!list) { - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - client_entry = purple_request_field_list_get_data(f, list->data); - silcpurple_add_buddy_resolved(r->client, r->conn, &client_entry, 1, r); -} - -static void -silcpurple_add_buddy_select_cancel(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_select(SilcPurpleBuddyRes r, - SilcClientEntry *clients, - SilcUInt32 clients_count) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512], tmp2[128]; - int i; - char *fingerprint; - - fields = purple_request_fields_new(); - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields_add_group(fields, g); - - for (i = 0; i < clients_count; i++) { - fingerprint = NULL; - if (clients[i]->fingerprint) { - fingerprint = silc_fingerprint(clients[i]->fingerprint, - clients[i]->fingerprint_len); - g_snprintf(tmp2, sizeof(tmp2), "\n%s", fingerprint); - } - g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s", - clients[i]->realname, clients[i]->nickname, - clients[i]->username, clients[i]->hostname ? - clients[i]->hostname : "", - fingerprint ? tmp2 : ""); - purple_request_field_list_add(f, tmp, clients[i]); - silc_free(fingerprint); - } - - purple_request_fields(r->client->application, _("Add Buddy"), - _("Select correct user"), - r->pubkey_search - ? _("More than one user was found with the same public key. Select " - "the correct user from the list to add to the buddy list.") - : _("More than one user was found with the same name. Select " - "the correct user from the list to add to the buddy list."), - fields, - _("OK"), G_CALLBACK(silcpurple_add_buddy_select_cb), - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_select_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); -} - -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcAttributePayload pub; - SilcAttributeObjPk userpk; - unsigned char *pk; - SilcUInt32 pk_len; - const char *filename; - - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - - /* If the buddy is offline/nonexistent, we will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - if (!clients_count) { - if (r->init) { - silc_free(r); - return; - } - - r->offline = TRUE; - /* If the user has already associated a public key, try loading it - * before prompting the user to load it again */ - if (filename != NULL) - silcpurple_add_buddy_ask_import(r, filename); - else - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* If more than one client was found with nickname, we need to verify - from user which one is the correct. */ - if (clients_count > 1 && !r->pubkey_search) { - if (r->init) { - silc_free(r); - return; - } - - silcpurple_add_buddy_select(r, clients, clients_count); - return; - } - - /* If we searched using public keys and more than one entry was found - the same person is logged on multiple times. */ - if (clients_count > 1 && r->pubkey_search && b->name) { - if (r->init) { - /* Find the entry that closest matches to the - buddy nickname. */ - int i; - for (i = 0; i < clients_count; i++) { - if (!g_ascii_strncasecmp(b->name, clients[i]->nickname, - strlen(b->name))) { - clients[0] = clients[i]; - break; - } - } - } else { - /* Verify from user which one is correct */ - silcpurple_add_buddy_select(r, clients, clients_count); - return; - } - } - - /* The client was found. Now get its public key and verify - that before adding the buddy. */ - memset(&userpk, 0, sizeof(userpk)); - b->proto_data = silc_memdup(clients[0]->id, sizeof(*clients[0]->id)); - r->client_id = *clients[0]->id; - - /* Get the public key from attributes, if not present then - resolve it with GETKEY unless we have it cached already. */ - if (clients[0]->attrs && !clients[0]->public_key) { - pub = silcpurple_get_attr(clients[0]->attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY); - if (!pub || !silc_attribute_get_object(pub, (void *)&userpk, - sizeof(userpk))) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - if (!silc_pkcs_public_key_decode(userpk.data, userpk.data_len, - &clients[0]->public_key)) - return; - silc_free(userpk.data); - } else if (filename && !clients[0]->public_key) { - if (!silc_pkcs_load_public_key(filename, &clients[0]->public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(filename, &clients[0]->public_key, - SILC_PKCS_FILE_BIN)) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - } else if (!clients[0]->public_key) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - - /* We have the public key, verify it. */ - pk = silc_pkcs_public_key_encode(clients[0]->public_key, &pk_len); - silcpurple_verify_public_key(client, conn, clients[0]->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); - silc_free(pk); -} - -static void -silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPurpleBuddyRes r; - SilcBuffer attrs; - const char *filename, *name = b->name; - - r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->client = client; - r->conn = conn; - r->b = b; - r->init = init; - - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - SilcPublicKey public_key; - SilcAttributeObjPk userpk; - - if (!silc_pkcs_load_public_key(filename, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(filename, &public_key, - SILC_PKCS_FILE_BIN)) - return; - - /* Get all attributes, and use the public key to search user */ - name = NULL; - attrs = silc_client_attributes_request(SILC_ATTRIBUTE_USER_INFO, - SILC_ATTRIBUTE_SERVICE, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_ATTRIBUTE_STATUS_FREETEXT, - SILC_ATTRIBUTE_STATUS_MESSAGE, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_ATTRIBUTE_TIMEZONE, - SILC_ATTRIBUTE_GEOLOCATION, -#ifdef SILC_ATTRIBUTE_USER_ICON - SILC_ATTRIBUTE_USER_ICON, -#endif - SILC_ATTRIBUTE_DEVICE_INFO, 0); - userpk.type = "silc-rsa"; - userpk.data = silc_pkcs_public_key_encode(public_key, &userpk.data_len); - attrs = silc_attribute_payload_encode(attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY, - SILC_ATTRIBUTE_FLAG_VALID, - &userpk, sizeof(userpk)); - silc_free(userpk.data); - silc_pkcs_public_key_free(public_key); - r->pubkey_search = TRUE; - } else { - /* Get all attributes */ - attrs = silc_client_attributes_request(0); - } - - /* Resolve */ - silc_client_get_clients_whois(client, conn, name, NULL, attrs, - silcpurple_add_buddy_resolved, r); - silc_buffer_free(attrs); -} - -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - /* Don't add if the buddy is already on the list. - * - * SILC doesn't have groups, so we don't need to do anything - * for a move. */ - if (purple_buddy_get_protocol_data(buddy) == NULL) - silcpurple_add_buddy_i(gc, buddy, FALSE); -} - -void silcpurple_send_buddylist(PurpleConnection *gc) -{ - PurpleBuddyList *blist; - PurpleBlistNode *gnode, *cnode, *bnode; - PurpleBuddy *buddy; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - if ((blist = purple_get_blist()) != NULL) - { - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) - { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) - { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *)bnode; - if (purple_buddy_get_account(buddy) == account) - silcpurple_add_buddy_i(gc, buddy, TRUE); - } - } - } - } -} - -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - silc_free(buddy->proto_data); -} - -void silcpurple_idle_set(PurpleConnection *gc, int idle) - -{ - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - SilcAttributeObjService service; - const char *server; - int port; - - sg = gc->proto_data; - if (sg == NULL) - return; - - client = sg->client; - if (client == NULL) - return; - - conn = sg->conn; - if (conn == NULL) - return; - - server = purple_account_get_string(sg->account, "server", - "silc.silcnet.org"); - port = purple_account_get_int(sg->account, "port", 706), - - memset(&service, 0, sizeof(service)); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - service.port = port; - g_snprintf(service.address, sizeof(service.address), "%s", server); - service.idle = idle; - silc_client_attribute_add(client, conn, SILC_ATTRIBUTE_SERVICE, - &service, sizeof(service)); -} - -char *silcpurple_status_text(PurpleBuddy *b) -{ - SilcPurple sg = b->account->gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = b->proto_data; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return NULL; - - /* If user is online, we show the mood status, if available. - If user is offline or away that status is indicated. */ - - if (client_entry->mode & SILC_UMODE_DETACHED) - return g_strdup(_("Detached")); - if (client_entry->mode & SILC_UMODE_GONE) - return g_strdup(_("Away")); - if (client_entry->mode & SILC_UMODE_INDISPOSED) - return g_strdup(_("Indisposed")); - if (client_entry->mode & SILC_UMODE_BUSY) - return g_strdup(_("Busy")); - if (client_entry->mode & SILC_UMODE_PAGE) - return g_strdup(_("Wake Me Up")); - if (client_entry->mode & SILC_UMODE_HYPER) - return g_strdup(_("Hyper Active")); - if (client_entry->mode & SILC_UMODE_ROBOT) - return g_strdup(_("Robot")); - - attr = silcpurple_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - /* The mood is a bit mask, so we could show multiple moods, - but let's show only one for now. */ - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - return g_strdup(_("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - return g_strdup(_("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - return g_strdup(_("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - return g_strdup(_("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - return g_strdup(_("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - return g_strdup(_("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - return g_strdup(_("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - return g_strdup(_("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - return g_strdup(_("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - return g_strdup(_("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - return g_strdup(_("Anxious")); - } - - return NULL; -} - -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - SilcPurple sg = b->account->gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = b->proto_data; - SilcClientEntry client_entry; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - char tmp[256]; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return; - - if (client_entry->nickname) - purple_notify_user_info_add_pair(user_info, _("Nickname"), - client_entry->nickname); - if (client_entry->username && client_entry->hostname) { - g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - } - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - - if (statusstr) { - purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); - g_free(statusstr); - } - - if (full) { - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - } -} - -static void -silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - /* Call KILL */ - silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - b->name, "Killed by operator", NULL); -} - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; -} *SilcPurpleBuddyWb; - -static void -silcpurple_buddy_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleBuddyWb wb = data; - silcpurple_wb_init(wb->sg, wb->client_entry); - silc_free(wb); -} - -GList *silcpurple_buddy_menu(PurpleBuddy *buddy) -{ - PurpleConnection *gc = purple_account_get_connection(buddy->account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *pkfile = NULL; - SilcClientEntry client_entry = NULL; - PurpleMenuAction *act; - GList *m = NULL; - SilcPurpleBuddyWb wb; - - pkfile = purple_blist_node_get_string((PurpleBlistNode *) buddy, "public-key"); - client_entry = silc_client_get_client_by_id(sg->client, - sg->conn, - buddy->proto_data); - - if (client_entry && client_entry->send_key) { - act = purple_menu_action_new(_("Reset IM Key"), - PURPLE_CALLBACK(silcpurple_buddy_resetkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("IM with Key Exchange"), - PURPLE_CALLBACK(silcpurple_buddy_keyagr), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("IM with Password"), - PURPLE_CALLBACK(silcpurple_buddy_privkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (pkfile) { - act = purple_menu_action_new(_("Show Public Key"), - PURPLE_CALLBACK(silcpurple_buddy_showkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("Get Public Key..."), - PURPLE_CALLBACK(silcpurple_buddy_getkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (conn && conn->local_entry->mode & SILC_UMODE_ROUTER_OPERATOR) { - act = purple_menu_action_new(_("Kill User"), - PURPLE_CALLBACK(silcpurple_buddy_kill), - NULL, NULL); - m = g_list_append(m, act); - } - - if (client_entry) { - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->client_entry = client_entry; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_buddy_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - return m; -} - -#ifdef SILC_ATTRIBUTE_USER_ICON -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcMime mime; - char type[32]; - unsigned char *icon; - const char *t; - SilcAttributeObjMime obj; - - /* Remove */ - if (!img) { - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_ICON, NULL); - return; - } - - /* Add */ - mime = silc_mime_alloc(); - if (!mime) - return; - - t = purple_imgstore_get_extension(img); - if (!t || !strcmp(t, "icon")) { - silc_mime_free(mime); - return; - } - if (!strcmp(t, "jpg")) - t = "jpeg"; - g_snprintf(type, sizeof(type), "image/%s", t); - silc_mime_add_field(mime, "Content-Type", type); - silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img)); - - obj.mime = icon = silc_mime_encode(mime, &obj.mime_len); - if (obj.mime) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_ICON, &obj, sizeof(obj)); - - silc_free(icon); - silc_mime_free(mime); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1456 +0,0 @@ -/* - - silcpurple_chat.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Channel Routines ******************************/ - -GList *silcpurple_chat_info(PurpleConnection *gc) -{ - GList *ci = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - ci = g_list_append(ci, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Passphrase:"); - pce->identifier = "passphrase"; - pce->secret = TRUE; - ci = g_list_append(ci, pce); - - return ci; -} - -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); - -static void -silcpurple_chat_getinfo_res(SilcClient client, - SilcClientConnection conn, - SilcChannelEntry *channels, - SilcUInt32 channels_count, - void *context) -{ - GHashTable *components = context; - PurpleConnection *gc = client->application; - const char *chname; - char tmp[256]; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - - if (!channels) { - g_snprintf(tmp, sizeof(tmp), - _("Channel %s does not exist in the network"), chname); - purple_notify_error(gc, _("Channel Information"), - _("Cannot get channel information"), tmp); - return; - } - - silcpurple_chat_getinfo(gc, components); -} - - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) -{ - SilcPurple sg = gc->proto_data; - const char *chname; - char *buf, tmp[256], *tmp2; - GString *s; - SilcChannelEntry channel; - SilcHashTableList htl; - SilcChannelUser chu; - - if (!components) - return; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - silc_client_get_channel_resolve(sg->client, sg->conn, - (char *)chname, - silcpurple_chat_getinfo_res, - components); - return; - } - - s = g_string_new(""); - tmp2 = g_markup_escape_text(channel->channel_name, -1); - g_string_append_printf(s, _("Channel Name: %s"), tmp2); - g_free(tmp2); - if (channel->user_list && silc_hash_table_count(channel->user_list)) - g_string_append_printf(s, _("
User Count: %d"), - (int)silc_hash_table_count(channel->user_list)); - - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - tmp2 = g_markup_escape_text(chu->client->nickname, -1); - g_string_append_printf(s, _("
Channel Founder: %s"), - tmp2); - g_free(tmp2); - break; - } - } - silc_hash_table_list_reset(&htl); - - if (channel->channel_key) - g_string_append_printf(s, _("
Channel Cipher: %s"), - silc_cipher_get_name(channel->channel_key)); - if (channel->hmac) - /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ - g_string_append_printf(s, _("
Channel HMAC: %s"), - silc_hmac_get_name(channel->hmac)); - - if (channel->topic) { - tmp2 = g_markup_escape_text(channel->topic, -1); - g_string_append_printf(s, _("
Channel Topic:
%s"), tmp2); - g_free(tmp2); - } - - if (channel->mode) { - g_string_append_printf(s, _("
Channel Modes: ")); - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - g_string_append(s, tmp); - } - - if (channel->founder_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - g_string_append_printf(s, _("
Founder Key Fingerprint:
%s"), fingerprint); - g_string_append_printf(s, _("
Founder Key Babbleprint:
%s"), babbleprint); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - - buf = g_string_free(s, FALSE); - purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, buf, NULL, NULL); - g_free(buf); -} - - -static void -silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat = (PurpleChat *)node; - silcpurple_chat_getinfo(chat->account->gc, chat->components); -} - - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ -/************************** Channel Invite List ******************************/ - -static void -silcpurple_chat_invitelist(PurpleBlistNode *node, gpointer data); -{ - -} - - -/**************************** Channel Ban List *******************************/ - -static void -silcpurple_chat_banlist(PurpleBlistNode *node, gpointer data); -{ - -} -#endif - - -/************************* Channel Authentication ****************************/ - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; - PurpleChat *c; - SilcBuffer pubkeys; -} *SilcPurpleChauth; - -static void -silcpurple_chat_chpk_add(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - unsigned char mode[4]; - SilcUInt32 m; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_BIN)) { - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); - purple_notify_error(client->application, - _("Add Channel Public Key"), - _("Could not load public key"), NULL); - return; - } - - pk = silc_pkcs_public_key_payload_encode(public_key); - chpks = silc_buffer_alloc_size(2); - SILC_PUT16_MSB(1, chpks->head); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - pk->len, 0x00); - silc_buffer_free(pk); - - m = sgc->channel->mode; - m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - ++conn->cmd_ident, 3, - 1, chidp->data, chidp->len, - 2, mode, sizeof(mode), - 9, chpks->data, chpks->len); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cancel(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - GList *list; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - SilcUInt16 c = 0, ct; - unsigned char mode[4]; - SilcUInt32 m; - - f = purple_request_fields_get_field(fields, "list"); - if (!purple_request_field_list_get_selected(f)) { - /* Add new public key */ - purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, - G_CALLBACK(silcpurple_chat_chpk_add), - G_CALLBACK(silcpurple_chat_chpk_cancel), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - - list = purple_request_field_list_get_items(f); - chpks = silc_buffer_alloc_size(2); - - for (ct = 0; list; list = list->next, ct++) { - public_key = purple_request_field_list_get_data(f, list->data); - if (purple_request_field_list_is_selected(f, list->data)) { - /* Delete this public key */ - pk = silc_pkcs_public_key_payload_encode(public_key); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - pk->len, 0x01); - silc_buffer_free(pk); - c++; - } - silc_pkcs_public_key_free(public_key); - } - if (!c) { - silc_buffer_free(chpks); - return; - } - SILC_PUT16_MSB(c, chpks->head); - - m = sgc->channel->mode; - if (ct == c) - m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - ++conn->cmd_ident, 3, - 1, chidp->data, chidp->len, - 2, mode, sizeof(mode), - 9, chpks->data, chpks->len); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - PurpleRequestField *f; - const char *curpass, *val; - int set; - - f = purple_request_fields_get_field(fields, "passphrase"); - val = purple_request_field_string_get_value(f); - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - if (!val && curpass) - set = 0; - else if (val && !curpass) - set = 1; - else if (val && curpass && strcmp(val, curpass)) - set = 1; - else - set = -1; - - if (set == 1) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "+a", val, NULL); - purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); - } else if (set == 0) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "-a", NULL); - purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); - } - - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcBuffer channel_pubkeys) -{ - SilcUInt16 argc; - SilcArgumentPayload chpks; - unsigned char *pk; - SilcUInt32 pk_len, type; - char *fingerprint, *babbleprint; - SilcPublicKey pubkey; - SilcPublicKeyIdentifier ident; - char tmp2[1024], t[512]; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcPurpleChauth sgc; - const char *curpass = NULL; - - sgc = silc_calloc(1, sizeof(*sgc)); - if (!sgc) - return; - sgc->sg = sg; - sgc->channel = channel; - - fields = purple_request_fields_new(); - - if (sgc->c) - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), - curpass, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l1", _("Channel Public Keys List")); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(t, sizeof(t), - _("Channel authentication is used to secure the channel from " - "unauthorized access. The authentication may be based on " - "passphrase and digital signatures. If passphrase is set, it " - "is required to be able to join. If channel public keys are set " - "then only users whose public keys are listed are able to join.")); - - if (!channel_pubkeys) { - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - sgc->pubkeys = silc_buffer_copy(channel_pubkeys); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - SILC_GET16_MSB(argc, channel_pubkeys->data); - chpks = silc_argument_payload_parse(channel_pubkeys->data + 2, - channel_pubkeys->len - 2, argc); - if (!chpks) - return; - - pk = silc_argument_get_first_arg(chpks, &type, &pk_len); - while (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); - babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); - silc_pkcs_public_key_payload_decode(pk, pk_len, &pubkey); - ident = silc_pkcs_decode_identifier(pubkey->identifier); - - g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", - ident->realname ? ident->realname : ident->username ? - ident->username : "", fingerprint, babbleprint); - purple_request_field_list_add(f, tmp2, pubkey); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_pkcs_free_identifier(ident); - pk = silc_argument_get_next_arg(chpks, &type, &pk_len); - } - - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - - silc_argument_payload_free(chpks); -} - -static void -silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+C", NULL); -} - - -/************************** Channel Private Groups **************************/ - -/* Private groups are "virtual" channels. They are groups inside a channel. - This is implemented by using channel private keys. By knowing a channel - private key user becomes part of that group and is able to talk on that - group. Other users, on the same channel, won't be able to see the - messages of that group. It is possible to have multiple groups inside - a channel - and thus having multiple private keys on the channel. */ - -typedef struct { - SilcPurple sg; - PurpleChat *c; - const char *channel; -} *SilcPurpleCharPrv; - -static void -silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - SilcPurple sg = p->sg; - char tmp[512]; - PurpleRequestField *f; - const char *name, *passphrase, *alias; - GHashTable *comp; - PurpleGroup *g; - PurpleChat *cn; - - f = purple_request_fields_get_field(fields, "name"); - name = purple_request_field_string_get_value(f); - if (!name) { - silc_free(p); - return; - } - f = purple_request_fields_get_field(fields, "passphrase"); - passphrase = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "alias"); - alias = purple_request_field_string_get_value(f); - - /* Add private group to buddy list */ - g_snprintf(tmp, sizeof(tmp), "%s [Private Group]", name); - comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(comp, g_strdup("channel"), g_strdup(tmp)); - g_hash_table_replace(comp, g_strdup("passphrase"), g_strdup(passphrase)); - - cn = purple_chat_new(sg->account, alias, comp); - g = (PurpleGroup *)p->c->node.parent; - purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); - - /* Associate to a real channel */ - purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); - - /* Join the group */ - silcpurple_chat_join(sg->gc, comp); - - silc_free(p); -} - -static void -silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - silc_free(p); -} - -static void -silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleCharPrv p; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->sg = sg; - - p->channel = g_hash_table_lookup(chat->components, "channel"); - p->c = purple_blist_find_chat(sg->account, p->channel); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("name", _("Group Name"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("passphrase", _("Passphrase"), - NULL, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("alias", _("Alias"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(tmp, sizeof(tmp), - _("Please enter the %s channel private group name and passphrase."), - p->channel); - purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, - _("Add"), G_CALLBACK(silcpurple_chat_prv_add), - _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), - purple_connection_get_account(gc), NULL, NULL, p); -} - - -/****************************** Channel Modes ********************************/ - -static void -silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-f", NULL); -} - -static void -silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - const char *channel; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - if (!sg->conn) - return; - - /* XXX we should have ability to define which founder - key to use. Now we use the user's own public key - (default key). */ - - /* Call CMODE */ - channel = g_hash_table_lookup(chat->components, "channel"); - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, - "+f", NULL); -} - -typedef struct { - SilcPurple sg; - char *channel; -} *SilcPurpleChatInput; - -static void -silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) -{ - SilcChannelEntry channel; - int ulimit = 0; - - channel = silc_client_get_channel(s->sg->client, s->sg->conn, - (char *)s->channel); - if (!channel) - return; - if (limit) - ulimit = atoi(limit); - - if (!limit || !(*limit) || *limit == '0') { - if (limit && ulimit == channel->user_limit) { - silc_free(s); - return; - } - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "-l", NULL); - - silc_free(s); - return; - } - - if (ulimit == channel->user_limit) { - silc_free(s); - return; - } - - /* Call CMODE */ - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "+l", limit, NULL); - - silc_free(s); -} - -static void -silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleChatInput s; - SilcChannelEntry channel; - char *ch; - char tmp[32]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - if (!sg->conn) - return; - - ch = g_strdup(g_hash_table_lookup(chat->components, "channel")); - channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); - if (!channel) - return; - - s = silc_calloc(1, sizeof(*s)); - if (!s) - return; - s->channel = ch; - s->sg = sg; - g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); - purple_request_input(gc, _("User Limit"), NULL, - _("Set user limit on channel. Set to zero to reset user limit."), - tmp, FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), - _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), - purple_connection_get_account(gc), NULL, NULL, s); -} - -static void -silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-t", NULL); -} - -static void -silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+t", NULL); -} - -static void -silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-p", NULL); -} - -static void -silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+p", NULL); -} - -static void -silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-s", NULL); -} - -static void -silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+s", NULL); -} - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; -} *SilcPurpleChatWb; - -static void -silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleChatWb wb = data; - silcpurple_wb_init_ch(wb->sg, wb->channel); - silc_free(wb); -} - -GList *silcpurple_chat_menu(PurpleChat *chat) -{ - GHashTable *components = chat->components; - PurpleConnection *gc = purple_account_get_connection(chat->account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *chname = NULL; - SilcChannelEntry channel = NULL; - SilcChannelUser chu = NULL; - SilcUInt32 mode = 0; - - GList *m = NULL; - PurpleMenuAction *act; - - if (components) - chname = g_hash_table_lookup(components, "channel"); - if (chname) - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (channel) { - chu = silc_client_on_channel(channel, conn->local_entry); - if (chu) - mode = chu->mode; - } - - if (strstr(chname, "[Private Group]")) - return NULL; - - act = purple_menu_action_new(_("Get Info"), - PURPLE_CALLBACK(silcpurple_chat_getinfo_menu), - NULL, NULL); - m = g_list_append(m, act); - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Invite List"), - PURPLE_CALLBACK(silcpurple_chat_invitelist), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Ban List"), - PURPLE_CALLBACK(silcpurple_chat_banlist), - NULL, NULL); - m = g_list_append(m, act); - } -#endif - - if (chu) { - act = purple_menu_action_new(_("Add Private Group"), - PURPLE_CALLBACK(silcpurple_chat_prv), - NULL, NULL); - m = g_list_append(m, act); - } - - if (mode & SILC_CHANNEL_UMODE_CHANFO) { - act = purple_menu_action_new(_("Channel Authentication"), - PURPLE_CALLBACK(silcpurple_chat_chauth), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { - act = purple_menu_action_new(_("Reset Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent_reset), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Set User Limit"), - PURPLE_CALLBACK(silcpurple_chat_ulimit), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { - act = purple_menu_action_new(_("Reset Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_resettopic), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_settopic), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { - act = purple_menu_action_new(_("Reset Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetprivate), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_setprivate), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_SECRET) { - act = purple_menu_action_new(_("Reset Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetsecret), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_setsecret), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (channel) { - SilcPurpleChatWb wb; - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->channel = channel; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_chat_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - - return m; -} - - -/******************************* Joining Etc. ********************************/ - -void silcpurple_chat_join_done(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcChannelEntry channel = context; - PurpleConversation *convo; - SilcUInt32 retry = SILC_PTR_TO_32(channel->context); - SilcHashTableList htl; - SilcChannelUser chu; - GList *users = NULL, *flags = NULL; - char tmp[256]; - - if (!clients && retry < 1) { - /* Resolving users failed, try again. */ - channel->context = SILC_32_TO_PTR(retry + 1); - silc_client_get_clients_by_channel(client, conn, channel, - silcpurple_chat_join_done, channel); - return; - } - - /* Add channel to Purple */ - channel->context = SILC_32_TO_PTR(++sg->channel_ids); - serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - /* Add all users to channel */ - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - if (!chu->client->nickname) - continue; - chu->context = SILC_32_TO_PTR(sg->channel_ids); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) - f |= PURPLE_CBFLAGS_FOUNDER; - if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) - f |= PURPLE_CBFLAGS_OP; - users = g_list_append(users, g_strdup(chu->client->nickname)); - flags = g_list_append(flags, GINT_TO_POINTER(f)); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - if (chu->client == conn->local_entry) - g_snprintf(tmp, sizeof(tmp), - _("You are channel founder on %s"), - channel->channel_name); - else - g_snprintf(tmp, sizeof(tmp), - _("Channel founder on %s is %s"), - channel->channel_name, chu->client->nickname); - - purple_conversation_write(convo, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - } - } - silc_hash_table_list_reset(&htl); - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - g_list_free(users); - g_list_free(flags); - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - - /* Set nick */ - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), conn->local_entry->nickname); -} - -char *silcpurple_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - const char *channel, *passphrase, *parentch; - - if (!conn) - return; - - channel = g_hash_table_lookup(data, "channel"); - passphrase = g_hash_table_lookup(data, "passphrase"); - - /* Check if we are joining a private group. Handle it - purely locally as it's not a real channel */ - if (strstr(channel, "[Private Group]")) { - SilcChannelEntry channel_entry; - SilcChannelPrivateKey key; - PurpleChat *c; - SilcPurplePrvgrp grp; - - c = purple_blist_find_chat(sg->account, channel); - parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); - if (!parentch) - return; - - channel_entry = silc_client_get_channel(sg->client, sg->conn, - (char *)parentch); - if (!channel_entry || - !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), - _("You have to join the %s channel before you are " - "able to join the private group"), parentch); - purple_notify_error(gc, _("Join Private Group"), - _("Cannot join private group"), tmp); - return; - } - - /* Add channel private key */ - if (!silc_client_add_channel_private_key(client, conn, - channel_entry, channel, - NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), &key)) - return; - - /* Join the group */ - grp = silc_calloc(1, sizeof(*grp)); - if (!grp) - return; - grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; - grp->chid = SILC_PTR_TO_32(channel_entry->context); - grp->parentch = parentch; - grp->channel = channel; - grp->key = key; - sg->grps = g_list_append(sg->grps, grp); - serv_got_joined_chat(gc, grp->id, channel); - return; - } - - /* XXX We should have other properties here as well: - 1. whether to try to authenticate to the channel - 1a. with default key, - 1b. with specific key. - 2. whether to try to authenticate to become founder. - 2a. with default key, - 2b. with specific key. - - Since now such variety is not possible in the join dialog - we always use -founder and -auth options, which try to - do both 1 and 2 with default keys. */ - - /* Call JOIN */ - if ((passphrase != NULL) && (*passphrase != '\0')) - silc_client_command_call(client, conn, NULL, "JOIN", - channel, passphrase, "-auth", "-founder", NULL); - else - silc_client_command_call(client, conn, NULL, "JOIN", - channel, "-auth", "-founder", NULL); -} - -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if we are inviting on a private group. Invite - to the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call INVITE */ - silc_client_command_call(client, conn, NULL, "INVITE", - chu->channel->channel_name, - name, NULL); -} - -void silcpurple_chat_leave(PurpleConnection *gc, int id) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - GList *l; - SilcPurplePrvgrp prv; - - if (!conn) - return; - - /* See if we are leaving a private group */ - if (id > SILCPURPLE_PRVGRP) { - SilcChannelEntry channel; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) - return; - silc_client_del_channel_private_key(client, conn, - channel, prv->key); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - serv_got_chat_left(gc, id); - return; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call LEAVE */ - silc_client_command_call(client, conn, NULL, "LEAVE", - chu->channel->channel_name, NULL); - - serv_got_chat_left(gc, id); - - /* Leave from private groups on this channel as well */ - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->chid == id) { - prv = l->data; - silc_client_del_channel_private_key(client, conn, - chu->channel, - prv->key); - serv_got_chat_left(gc, prv->id); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - if (!sg->grps) - break; - } -} - -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags msgflags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - SilcChannelEntry channel = NULL; - SilcChannelPrivateKey key = NULL; - SilcUInt32 flags; - int ret; - char *msg2, *tmp; - gboolean found = FALSE; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - - if (!msg || !conn) - return 0; - - flags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg2 = purple_unescape_html(msg); - - if (!g_ascii_strncasecmp(msg2, "/me ", 4)) - { - msg2 += 4; - if (!*msg2) { - g_free(tmp); - return 0; - } - flags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (sign) - flags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Get the channel private key if we are sending on - private group */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) { - g_free(tmp); - return 0; - } - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) { - g_free(tmp); - return 0; - } - key = prv->key; - } - - if (!channel) { - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) { - g_free(tmp); - return 0; - } - channel = chu->channel; - } - - /* Send channel message */ - ret = silc_client_send_channel_message(client, conn, channel, key, - flags, (unsigned char *)msg2, - strlen(msg2), TRUE); - if (ret) { - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, - time(NULL)); - } - g_free(tmp); - - return ret; -} - -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if setting topic on private group. Set it - on the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call TOPIC */ - silc_client_command_call(client, conn, NULL, "TOPIC", - chu->channel->channel_name, topic, NULL); -} - -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - GList *fields = NULL; - PurpleRoomlistField *f; - - if (!conn) - return NULL; - - if (sg->roomlist) - purple_roomlist_unref(sg->roomlist); - - sg->roomlist_canceled = FALSE; - - sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, - _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, - _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - purple_roomlist_set_fields(sg->roomlist, fields); - - /* Call LIST */ - silc_client_command_call(client, conn, "LIST"); - - purple_roomlist_set_in_progress(sg->roomlist, TRUE); - - return sg->roomlist; -} - -void silcpurple_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - if (sg->roomlist == list) { - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - sg->roomlist_canceled = TRUE; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,412 +0,0 @@ -/* - - silcpurple_ft.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" - -/****************************** File Transfer ********************************/ - -/* This implements the secure file transfer protocol (SFTP) using the SILC - SFTP library implementation. The API we use from the SILC Toolkit is the - SILC Client file transfer API, as it provides a simple file transfer we - need in this case. We could use the SILC SFTP API directly, but it would - be an overkill since we'd effectively re-implement the file transfer what - the SILC Client's file transfer API already provides. - - From Purple we do NOT use the FT API to do the transfer as it is very limiting. - In fact it does not suite to file transfers like SFTP at all. For example, - it assumes that read operations are synchronous what they are not in SFTP. - It also assumes that the file transfer socket is to be handled by the Purple - eventloop, and this naturally is something we don't want to do in case of - SILC Toolkit. The FT API suites well to purely stream based file transfers - like HTTP GET and similar. - - For this reason, we directly access the Purple GKT FT API and hack the FT - API to merely provide the user interface experience and all the magic - is done in the SILC Toolkit. Ie. we update the statistics information in - the FT API for user interface, and that's it. A bit dirty but until the - FT API gets better this is the way to go. Good thing that FT API allowed - us to do this. */ - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; - SilcUInt32 session_id; - char *hostname; - SilcUInt16 port; - PurpleXfer *xfer; - - SilcClientFileName completion; - void *completion_context; -} *SilcPurpleXfer; - -static void -silcpurple_ftp_monitor(SilcClient client, - SilcClientConnection conn, - SilcClientMonitorStatus status, - SilcClientFileError error, - SilcUInt64 offset, - SilcUInt64 filesize, - SilcClientEntry client_entry, - SilcUInt32 session_id, - const char *filepath, - void *context) -{ - SilcPurpleXfer xfer = context; - PurpleConnection *gc = xfer->sg->gc; - char tmp[256]; - - if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) - return; - - if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { - if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { - g_snprintf(tmp, sizeof(tmp), "No such file %s", - filepath ? filepath : "[N/A]"); - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), tmp); - } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Permission denied")); - } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Key agreement failed")); - } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("File transfer session does not exist")); - } else { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), NULL); - } - silc_client_file_close(client, conn, session_id); - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - /* Update file transfer UI */ - if (!offset && filesize) - purple_xfer_set_size(xfer->xfer, filesize); - if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; - } - purple_xfer_update_progress(xfer->xfer); - - if (status == SILC_CLIENT_FILE_MONITOR_SEND || - status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { - if (offset == filesize) { - /* Download finished */ - purple_xfer_set_completed(xfer->xfer, TRUE); - silc_client_file_close(client, conn, session_id); - } - } -} - -static void -silcpurple_ftp_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - /* Cancel the transmission */ - xfer->completion(NULL, xfer->completion_context); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_ok(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - - name = purple_xfer_get_local_filename(x); - g_unlink(name); - xfer->completion(name, xfer->completion_context); -} - -static void -silcpurple_ftp_ask_name(SilcClient client, - SilcClientConnection conn, - SilcUInt32 session_id, - const char *remote_filename, - SilcClientFileName completion, - void *completion_context, - void *context) -{ - SilcPurpleXfer xfer = context; - - xfer->completion = completion; - xfer->completion_context = completion_context; - - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_ask_name_ok); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_ask_name_cancel); - - /* Request to save the file */ - purple_xfer_set_filename(xfer->xfer, remote_filename); - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_request_result(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - SilcClientFileError status; - PurpleConnection *gc = xfer->sg->gc; - - if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) - return; - - /* Start the file transfer */ - status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn, - silcpurple_ftp_monitor, xfer, - NULL, xfer->session_id, - silcpurple_ftp_ask_name, xfer); - switch (status) { - case SILC_CLIENT_FILE_OK: - return; - break; - - case SILC_CLIENT_FILE_UNKNOWN_SESSION: - purple_notify_error(gc, _("Secure File Transfer"), - _("No file transfer session active"), NULL); - break; - - case SILC_CLIENT_FILE_ALREADY_STARTED: - purple_notify_error(gc, _("Secure File Transfer"), - _("File transfer already started"), NULL); - break; - - case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not perform key agreement for file transfer"), - NULL); - break; - - default: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not start the file transfer"), NULL); - break; - } - - /* Error */ - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); -} - -static void -silcpurple_ftp_request_denied(PurpleXfer *x) -{ - -} - -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleXfer xfer; - - xfer = silc_calloc(1, sizeof(*xfer)); - if (!xfer) { - silc_client_file_close(sg->client, sg->conn, session_id); - return; - } - - xfer->sg = sg; - xfer->client_entry = client_entry; - xfer->session_id = session_id; - xfer->hostname = g_strdup(hostname); - xfer->port = port; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_RECEIVE, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_request_result); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); - xfer->xfer->remote_ip = g_strdup(hostname); - xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; - - /* File transfer request */ - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_send_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); -} - -static void -silcpurple_ftp_send(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - - name = purple_xfer_get_local_filename(x); - - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(xfer->sg->conn->sock->sock, - NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = FALSE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(xfer->sg->conn->sock->sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - - /* Send the file */ - silc_client_file_send(xfer->sg->client, xfer->sg->conn, - silcpurple_ftp_monitor, xfer, - local_ip, 0, !local, xfer->client_entry, - name, &xfer->session_id); - - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_send_file_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(gc, _("Secure File Transfer"), - _("Cannot send file"), tmp); - silc_free(context); - return; - } - - silcpurple_ftp_send_file(client->application, (const char *)context, NULL); - silc_free(context); -} - -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count; - SilcPurpleXfer xfer; - char *nickname; - - g_return_val_if_fail(name != NULL, NULL); - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return NULL; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_ftp_send_file_resolved, - strdup(name)); - silc_free(nickname); - return NULL; - } - - xfer = silc_calloc(1, sizeof(*xfer)); - - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->sg = sg; - xfer->client_entry = clients[0]; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_SEND, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return NULL; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; - - silc_free(clients); - silc_free(nickname); - - return xfer->xfer; -} - -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file) -{ - PurpleXfer *xfer = silcpurple_ftp_new_xfer(gc, name); - - g_return_if_fail(xfer != NULL); - - /* Choose file to send */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SILCSOURCES = silc.c silcpurple.h buddy.c chat.c ft.c ops.c pk.c util.c wb.c wb.h - -AM_CFLAGS = $(st) - -libsilcpurple_la_LDFLAGS = -module -avoid-version - -if STATIC_SILC - -st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -noinst_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -libsilcpurple_la_LIBADD = $(SILC_LIBS) - -else - -st = $(SILC_CFLAGS) -pkg_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,802 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/silc10 -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_SILC_FALSE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@STATIC_SILC_TRUE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_TRUE@ $(am__DEPENDENCIES_1) -am__libsilcpurple_la_SOURCES_DIST = silc.c silcpurple.h buddy.c chat.c \ - ft.c ops.c pk.c util.c wb.c wb.h -am__objects_1 = libsilcpurple_la-silc.lo libsilcpurple_la-buddy.lo \ - libsilcpurple_la-chat.lo libsilcpurple_la-ft.lo \ - libsilcpurple_la-ops.lo libsilcpurple_la-pk.lo \ - libsilcpurple_la-util.lo libsilcpurple_la-wb.lo -@STATIC_SILC_FALSE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -@STATIC_SILC_TRUE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -libsilcpurple_la_OBJECTS = $(am_libsilcpurple_la_OBJECTS) -@STATIC_SILC_FALSE@am_libsilcpurple_la_rpath = -rpath $(pkgdir) -@STATIC_SILC_TRUE@am_libsilcpurple_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsilcpurple_la_SOURCES) -DIST_SOURCES = $(am__libsilcpurple_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -SILCSOURCES = silc.c silcpurple.h buddy.c chat.c ft.c ops.c pk.c util.c wb.c wb.h -AM_CFLAGS = $(st) -libsilcpurple_la_LDFLAGS = -module -avoid-version -@STATIC_SILC_FALSE@st = $(SILC_CFLAGS) -@STATIC_SILC_TRUE@st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -@STATIC_SILC_TRUE@noinst_LTLIBRARIES = libsilcpurple.la -@STATIC_SILC_FALSE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SILC_FALSE@libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) -@STATIC_SILC_TRUE@libsilcpurple_la_LIBADD = $(SILC_LIBS) -@STATIC_SILC_FALSE@pkg_LTLIBRARIES = libsilcpurple.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/silc10/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/silc10/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsilcpurple.la: $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_DEPENDENCIES) - $(LINK) $(am_libsilcpurple_la_rpath) $(libsilcpurple_la_LDFLAGS) $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ops.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-pk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-silc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-wb.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsilcpurple_la-silc.lo: silc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-silc.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-silc.Tpo" -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo" "$(DEPDIR)/libsilcpurple_la-silc.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='silc.c' object='libsilcpurple_la-silc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c - -libsilcpurple_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" "$(DEPDIR)/libsilcpurple_la-buddy.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libsilcpurple_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libsilcpurple_la-chat.lo: chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-chat.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-chat.Tpo" -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo" "$(DEPDIR)/libsilcpurple_la-chat.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chat.c' object='libsilcpurple_la-chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c - -libsilcpurple_la-ft.lo: ft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ft.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ft.Tpo" -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo" "$(DEPDIR)/libsilcpurple_la-ft.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ft.c' object='libsilcpurple_la-ft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c - -libsilcpurple_la-ops.lo: ops.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ops.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ops.Tpo" -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo" "$(DEPDIR)/libsilcpurple_la-ops.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ops.c' object='libsilcpurple_la-ops.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c - -libsilcpurple_la-pk.lo: pk.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-pk.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-pk.Tpo" -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo" "$(DEPDIR)/libsilcpurple_la-pk.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pk.c' object='libsilcpurple_la-pk.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c - -libsilcpurple_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-util.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-util.Tpo" -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-util.Tpo" "$(DEPDIR)/libsilcpurple_la-util.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libsilcpurple_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -libsilcpurple_la-wb.lo: wb.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-wb.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-wb.Tpo" -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo" "$(DEPDIR)/libsilcpurple_la-wb.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wb.c' object='libsilcpurple_la-wb.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsilc protocol plugin -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = libsilc -NEEDED_DLLS = $(SILC_TOOLKIT)/lib/silc.dll \ - $(SILC_TOOLKIT)/lib/silcclient.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(SILC_TOOLKIT)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(SILC_TOOLKIT)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = silc.c \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - util.c \ - wb.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lsilc \ - -lsilcclient - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--image-base,0x64000000 -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ops.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ops.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ops.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/ops.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2063 +0,0 @@ -/* - - silcpurple_ops.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" -#include "wb.h" - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); - -/* Message sent to the application by library. `conn' associates the - message to a specific connection. `conn', however, may be NULL. - The `type' indicates the type of the message sent by the library. - The application can for example filter the message according the - type. */ - -static void -silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...) -{ - /* Nothing */ -} - -#ifdef HAVE_SILCMIME_H -/* Processes incoming MIME message. Can be private message or channel - message. */ - -static void -silcpurple_mime_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, SilcMime mime, - gboolean recursive) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *type; - const unsigned char *data; - SilcUInt32 data_len; - PurpleMessageFlags cflags = 0; - PurpleConversation *convo = NULL; - - if (!mime) - return; - - /* Check for fragmented MIME message */ - if (silc_mime_is_partial(mime)) { - if (!sg->mimeass) - sg->mimeass = silc_mime_assembler_alloc(); - - /* Defragment */ - mime = silc_mime_assemble(sg->mimeass, mime); - if (!mime) - /* More fragments to come */ - return; - - /* Process the complete message */ - silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, mime, FALSE); - return; - } - - /* Check for multipart message */ - if (silc_mime_is_multipart(mime)) { - SilcMime p; - const char *mtype; - SilcDList parts = silc_mime_get_multiparts(mime, &mtype); - - /* Only "mixed" type supported */ - if (strcmp(mtype, "mixed")) - goto out; - - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Recursively process parts */ - silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE); - } - goto out; - } - - /* Get content type and MIME data */ - type = silc_mime_get_field(mime, "Content-Type"); - if (!type) - goto out; - data = silc_mime_get_data(mime, &data_len); - if (!data) - goto out; - - /* Process according to content type */ - - /* Plain text */ - if (strstr(type, "text/plain")) { - /* Default is UTF-8, don't check for other charsets */ - if (!strstr(type, "utf-8")) - goto out; - - if (channel) - silc_channel_message(client, conn, sender, channel, - payload, key, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - else - silc_private_message(client, conn, sender, payload, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - goto out; - } - - /* Image */ - if (strstr(type, "image/png") || - strstr(type, "image/jpeg") || - strstr(type, "image/gif") || - strstr(type, "image/tiff")) { - char tmp[32]; - int imgid; - - /* Get channel convo (if message is for channel) */ - if (key && channel) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (channel && !convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (channel && !convo) - goto out; - - imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); - if (imgid) { - cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; - g_snprintf(tmp, sizeof(tmp), "", imgid); - - if (channel) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : - "", cflags, - tmp, time(NULL)); - else - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, cflags, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - cflags = 0; - } - goto out; - } - - /* Whiteboard message */ - if (strstr(type, "application/x-wb") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) { - if (channel) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); - else - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); - goto out; - } - - out: - if (!recursive) - silc_mime_free(mime); -} -#endif /* HAVE_SILCMIME_H */ - -/* Message for a channel. The `sender' is the sender of the message - The `channel' is the channel. The `message' is the message. Note - that `message' maybe NULL. The `flags' indicates message flags - and it is used to determine how the message can be interpreted - (like it may tell the message is multimedia message). */ - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (key) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (!convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ -#ifdef HAVE_SILCMIME_H - SilcMime mime; - mime = silc_mime_decode(message, message_len); - silcpurple_mime_message(client, conn, sender, channel, payload, - key, flags, mime, FALSE); -#else - char type[128], enc[128]; - unsigned char *data; - SilcUInt32 data_len; - - memset(type, 0, sizeof(type)); - memset(enc, 0, sizeof(enc)); - - if (!silc_mime_parse(message, message_len, NULL, 0, - type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, - &data_len)) - return; - - if (!strcmp(type, "application/x-wb") && - !strcmp(enc, "binary") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); -#endif - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : "", 0, - tmp, time(NULL)); - g_free(tmp); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname ? - sender->nickname : "", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : "", 0, - tmp, time(NULL)); - g_free(tmp); - } -} - - -/* Private message to the client. The `sender' is the sender of the - message. The message is `message'and maybe NULL. The `flags' - indicates message flags and it is used to determine how the message - can be interpreted (like it may tell the message is multimedia - message). */ - -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (sender->nickname) - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - sender->nickname, sg->account); - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { -#ifdef HAVE_SILCMIME_H - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(message, message_len); - silcpurple_mime_message(client, conn, sender, NULL, payload, - NULL, flags, mime, FALSE); -#else - char type[128], enc[128]; - unsigned char *data; - SilcUInt32 data_len; - - memset(type, 0, sizeof(type)); - memset(enc, 0, sizeof(enc)); - - if (!silc_mime_parse(message, message_len, NULL, 0, - type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, - &data_len)) - return; - - if (!strcmp(type, "application/x-wb") && - !strcmp(enc, "binary") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); -#endif - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, 0, time(NULL)); - g_free(msg); - g_free(tmp); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname ? - sender->nickname : "", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, 0, time(NULL)); - g_free(tmp); - } -} - - -/* Notify message to the client. The notify arguments are sent in the - same order as servers sends them. The arguments are same as received - from the server except for ID's. If ID is received application receives - the corresponding entry to the ID. For example, if Client ID is received - application receives SilcClientEntry. Also, if the notify type is - for channel the channel entry is sent to application (even if server - does not send it because client library gets the channel entry from - the Channel ID in the packet's header). */ - -static void -silc_notify(SilcClient client, SilcClientConnection conn, - SilcNotifyType type, ...) -{ - va_list va; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - SilcClientEntry client_entry, client_entry2; - SilcChannelEntry channel; - SilcServerEntry server_entry; - SilcIdType idtype; - void *entry; - SilcUInt32 mode; - SilcHashTableList htl; - SilcChannelUser chu; - char buf[512], buf2[512], *tmp, *name; - SilcNotifyType notify; - PurpleBuddy *b; - int i; - - va_start(va, type); - memset(buf, 0, sizeof(buf)); - - switch (type) { - - case SILC_NOTIFY_TYPE_NONE: - break; - - case SILC_NOTIFY_TYPE_INVITE: - { - GHashTable *components; - va_arg(va, SilcChannelEntry); - name = va_arg(va, char *); - client_entry = va_arg(va, SilcClientEntry); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, strdup("channel"), strdup(name)); - serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); - } - break; - - case SILC_NOTIFY_TYPE_JOIN: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - /* If we joined channel, do nothing */ - if (client_entry == conn->local_entry) - break; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Join user to channel */ - g_snprintf(buf, sizeof(buf), "%s@%s", - client_entry->username, client_entry->hostname); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), - g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE); - - break; - - case SILC_NOTIFY_TYPE_LEAVE: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Remove user from channel */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, NULL); - - break; - - case SILC_NOTIFY_TYPE_SIGNOFF: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - - if (!client_entry->nickname) - break; - - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - tmp); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_TOPIC_SET: - { - char *esc, *tmp2; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - tmp = va_arg(va, char *); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (!tmp) - break; - - esc = g_markup_escape_text(tmp, -1); - tmp2 = purple_markup_linkify(esc); - g_free(esc); - - if (idtype == SILC_ID_CLIENT) { - client_entry = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - client_entry->nickname, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - server_entry->server_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - server_entry->server_name, tmp); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - channel->channel_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - channel->channel_name, tmp); - } else { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); - } - - g_free(tmp2); - - break; - - } - case SILC_NOTIFY_TYPE_NICK_CHANGE: - client_entry = va_arg(va, SilcClientEntry); - client_entry2 = va_arg(va, SilcClientEntry); - - if (!strcmp(client_entry->nickname, client_entry2->nickname)) - break; - - /* Change nick on all channels */ - silc_hash_table_list(client_entry2->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - client_entry2->nickname); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_CMODE_CHANGE: - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, SilcPublicKey); - (void)va_arg(va, SilcBuffer); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set channel %s modes to: %s"), name, - channel->channel_name, buf2); - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all channel %s modes"), name, - channel->channel_name); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - break; - - case SILC_NOTIFY_TYPE_CUMODE_CHANGE: - { - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set %s's modes to: %s"), name, - client_entry2->nickname, buf2); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (mode & SILC_CHANNEL_UMODE_CHANOP) - flags |= PURPLE_CBFLAGS_OP; - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all %s's modes"), name, - client_entry2->nickname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); - break; - } - - case SILC_NOTIFY_TYPE_MOTD: - tmp = va_arg(va, char *); - silc_free(sg->motd); - sg->motd = silc_memdup(tmp, strlen(tmp)); - break; - - case SILC_NOTIFY_TYPE_KICKED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (client_entry == conn->local_entry) { - /* Remove us from channel */ - g_snprintf(buf, sizeof(buf), - _("You have been kicked off %s by %s (%s)"), - channel->channel_name, client_entry2->nickname, - tmp ? tmp : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - /* Remove user from channel */ - g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - buf); - } - - break; - - case SILC_NOTIFY_TYPE_KILLED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - idtype = va_arg(va, int); - entry = va_arg(va, SilcClientEntry); - - if (!client_entry->nickname) - break; - - if (client_entry == conn->local_entry) { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove us from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } - silc_hash_table_list_reset(&htl); - - } else { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove user from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } - silc_hash_table_list_reset(&htl); - } - - break; - - case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: - break; - - case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: - { - int i; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - (void)va_arg(va, void *); - clients = va_arg(va, SilcClientEntry *); - clients_count = va_arg(va, SilcUInt32); - - for (i = 0; i < clients_count; i++) { - if (!clients[i]->nickname) - break; - - /* Remove from all channels */ - silc_hash_table_list(clients[i]->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - clients[i]->nickname, - _("Server signoff")); - } - silc_hash_table_list_reset(&htl); - } - } - break; - - case SILC_NOTIFY_TYPE_ERROR: - { - SilcStatus error = va_arg(va, int); - purple_notify_error(gc, "Error Notify", - silc_get_status_message(error), - NULL); - } - break; - - case SILC_NOTIFY_TYPE_WATCH: - { - SilcPublicKey public_key; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint; - - client_entry = va_arg(va, SilcClientEntry); - (void)va_arg(va, char *); - mode = va_arg(va, SilcUInt32); - notify = va_arg(va, int); - public_key = va_arg(va, SilcPublicKey); - - b = NULL; - if (public_key) { - PurpleBlistNode *gnode, *cnode, *bnode; - const char *f; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - break; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(buf, sizeof(buf) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" - G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - silc_free(fingerprint); - silc_free(pk); - - /* Find buddy by associated public key */ - for (gnode = purple_get_blist()->root; gnode; - gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if( !PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = cnode->child; bnode; - bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - b = (PurpleBuddy *)bnode; - if (b->account != gc->account) - continue; - f = purple_blist_node_get_string(bnode, "public-key"); - if (f && !strcmp(f, buf)) - goto cont; - b = NULL; - } - } - } - } - cont: - if (!b) { - /* Find buddy by nickname */ - b = purple_find_buddy(sg->account, client_entry->nickname); - if (!b) { - purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", - client_entry->nickname); - break; - } - } - - silc_free(b->proto_data); - b->proto_data = silc_memdup(client_entry->id, - sizeof(*client_entry->id)); - if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { - break; - } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { - /* See if client was away and is now present */ - if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | - SILC_UMODE_BUSY | SILC_UMODE_PAGE | - SILC_UMODE_DETACHED)) && - (client_entry->mode & SILC_UMODE_GONE || - client_entry->mode & SILC_UMODE_INDISPOSED || - client_entry->mode & SILC_UMODE_BUSY || - client_entry->mode & SILC_UMODE_PAGE || - client_entry->mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - else if ((mode & SILC_UMODE_GONE) || - (mode & SILC_UMODE_INDISPOSED) || - (mode & SILC_UMODE_BUSY) || - (mode & SILC_UMODE_PAGE) || - (mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } - } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || - notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || - notify == SILC_NOTIFY_TYPE_KILLED) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } else if (notify == SILC_NOTIFY_TYPE_NONE) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - } - break; - - default: - purple_debug_info("silc", "Unhandled notification: %d\n", type); - break; - } - - va_end(va); -} - - -/* Command handler. This function is called always in the command function. - If error occurs it will be called as well. `conn' is the associated - client connection. `cmd_context' is the command context that was - originally sent to the command. `success' is FALSE if error occurred - during command. `command' is the command being processed. It must be - noted that this is not reply from server. This is merely called just - after application has called the command. Just to tell application - that the command really was processed. */ - -static void -silc_command(SilcClient client, SilcClientConnection conn, - SilcClientCommandContext cmd_context, bool success, - SilcCommand command, SilcStatus status) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - switch (command) { - - case SILC_COMMAND_CMODE: - if (cmd_context->argc == 3 && - !strcmp((char *)cmd_context->argv[2], "+C")) - sg->chpk = TRUE; - else - sg->chpk = FALSE; - break; - - default: - break; - } -} - -#if 0 -static void -silcpurple_whois_more(SilcClientEntry client_entry, gint id) -{ - SilcAttributePayload attr; - SilcAttribute attribute; - char *buf; - GString *s; - SilcVCardStruct vcard; - int i; - - if (id != 0) - return; - - memset(&vcard, 0, sizeof(vcard)); - - s = g_string_new(""); - - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - switch (attribute) { - - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - g_string_append_printf(s, "%s:\n\n", _("Personal Information")); - if (vcard.full_name) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Full Name"), - vcard.full_name); - if (vcard.first_name) - g_string_append_printf(s, "%s:\t%s\n", - _("First Name"), - vcard.first_name); - if (vcard.middle_names) - g_string_append_printf(s, "%s:\t%s\n", - _("Middle Name"), - vcard.middle_names); - if (vcard.family_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Family Name"), - vcard.family_name); - if (vcard.nickname) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Nickname"), - vcard.nickname); - if (vcard.bday) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Birth Day"), - vcard.bday); - if (vcard.title) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Title"), - vcard.title); - if (vcard.role) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Role"), - vcard.role); - if (vcard.org_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Organization"), - vcard.org_name); - if (vcard.org_unit) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Unit"), - vcard.org_unit); - if (vcard.url) - g_string_append_printf(s, "%s:\t%s\n", - _("Homepage"), - vcard.url); - if (vcard.label) - g_string_append_printf(s, "%s:\t%s\n", - _("Address"), - vcard.label); - for (i = 0; i < vcard.num_tels; i++) { - if (vcard.tels[i].telnum) - g_string_append_printf(s, "%s:\t\t\t%s\n", - _("Phone"), - vcard.tels[i].telnum); - } - for (i = 0; i < vcard.num_emails; i++) { - if (vcard.emails[i].address) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Email"), - vcard.emails[i].address); - } - if (vcard.note) - g_string_append_printf(s, "\n%s:\t\t%s\n", - _("Note"), - vcard.note); - break; - } - } - - buf = g_string_free(s, FALSE); - purple_notify_info(NULL, _("User Information"), _("User Information"), - buf); - g_free(buf); -} -#endif - -/* Command reply handler. This function is called always in the command reply - function. If error occurs it will be called as well. Normal scenario - is that it will be called after the received command data has been parsed - and processed. The function is used to pass the received command data to - the application. - - `conn' is the associated client connection. `cmd_payload' is the command - payload data received from server and it can be ignored. It is provided - if the application would like to re-parse the received command data, - however, it must be noted that the data is parsed already by the library - thus the payload can be ignored. `success' is FALSE if error occurred. - In this case arguments are not sent to the application. The `status' is - the command reply status server returned. The `command' is the command - reply being processed. The function has variable argument list and each - command defines the number and type of arguments it passes to the - application (on error they are not sent). */ - -static void -silc_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommandPayload cmd_payload, bool success, - SilcCommand command, SilcStatus status, ...) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - va_list vp; - - va_start(vp, status); - - switch (command) { - case SILC_COMMAND_JOIN: - { - SilcChannelEntry channel_entry; - - if (!success) { - purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, char *); - channel_entry = va_arg(vp, SilcChannelEntry); - - /* Resolve users on channel */ - silc_client_get_clients_by_channel(client, conn, channel_entry, - silcpurple_chat_join_done, - channel_entry); - } - break; - - case SILC_COMMAND_LEAVE: - break; - - case SILC_COMMAND_USERS: - break; - - case SILC_COMMAND_WHOIS: - { - SilcUInt32 idle, mode; - SilcBuffer channels, user_modes; - SilcClientEntry client_entry; - char tmp[1024], *tmp2; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - PurpleNotifyUserInfo *user_info; - - if (!success) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(status)); - break; - } - - client_entry = va_arg(vp, SilcClientEntry); - if (!client_entry->nickname) - break; - (void)va_arg(vp, char *); - (void)va_arg(vp, char *); - (void)va_arg(vp, char *); - channels = va_arg(vp, SilcBuffer); - mode = va_arg(vp, SilcUInt32); - idle = va_arg(vp, SilcUInt32); - (void)va_arg(vp, unsigned char *); - user_modes = va_arg(vp, SilcBuffer); - - user_info = purple_notify_user_info_new(); - tmp2 = g_markup_escape_text(client_entry->nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); - g_free(tmp2); - if (client_entry->realname) { - tmp2 = g_markup_escape_text(client_entry->realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); - g_free(tmp2); - } - if (client_entry->username) { - tmp2 = g_markup_escape_text(client_entry->username, -1); - if (client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); - g_free(tmp2); - } - - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (statusstr) { - tmp2 = g_markup_escape_text(statusstr, -1); - purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); - g_free(statusstr); - g_free(tmp2); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - - if (client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - if (channels && user_modes) { - SilcUInt32 *umodes; - SilcDList list = - silc_channel_payload_parse_list(channels->data, - channels->len); - if (list && silc_get_mode_list(user_modes, - silc_dlist_count(list), - &umodes)) { - SilcChannelPayload entry; - int i = 0; - - memset(tmp, 0, sizeof(tmp)); - silc_dlist_start(list); - while ((entry = silc_dlist_get(list)) - != SILC_LIST_END) { - SilcUInt32 name_len; - char *m = silc_client_chumode_char(umodes[i++]); - char *name = (char *)silc_channel_get_name(entry, &name_len); - if (m) - silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); - silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); - silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); - silc_free(m); - - } - tmp2 = g_markup_escape_text(tmp, -1); - purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); - g_free(tmp2); - silc_free(umodes); - } - } - - if (client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - -#if 0 /* XXX for now, let's not show attrs here */ - if (client_entry->attrs) - purple_request_action(gc, _("User Information"), - _("User Information"), - buf, 1, client_entry, 2, - _("OK"), G_CALLBACK(silcpurple_whois_more), - _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); - else -#endif - purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_WHOWAS: - { - SilcClientEntry client_entry; - char *nickname, *realname, *username, *tmp; - PurpleNotifyUserInfo *user_info; - - if (!success) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(status)); - break; - } - - client_entry = va_arg(vp, SilcClientEntry); - nickname = va_arg(vp, char *); - username = va_arg(vp, char *); - realname = va_arg(vp, char *); - if (!nickname) - break; - - user_info = purple_notify_user_info_new(); - tmp = g_markup_escape_text(nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - if (realname) { - tmp = g_markup_escape_text(realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); - g_free(tmp); - } - if (username) { - tmp = g_markup_escape_text(username, -1); - if (client_entry && client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - g_free(tmp); - } - if (client_entry && client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - - if (client_entry && client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - - purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_DETACH: - if (!success) { - purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), - silc_get_status_message(status)); - return; - } - break; - - case SILC_COMMAND_TOPIC: - { - SilcChannelEntry channel; - - if (!success) { - purple_notify_error(gc, _("Topic"), _("Cannot set topic"), - silc_get_status_message(status)); - return; - } - - channel = va_arg(vp, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) { - purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", - channel->channel_name); - break; - } - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - } - break; - - case SILC_COMMAND_NICK: - { - /* I don't think we should need to do this because the server should - * be sending a SILC_NOTIFY_TYPE_NICK_CHANGE when we change our own - * nick, but it isn't, so we deal with it here instead. Stu. */ - SilcClientEntry local_entry; - SilcHashTableList htl; - SilcChannelUser chu; - const char *oldnick; - - if (!success) { - purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), - silc_get_status_message(status)); - return; - } - - local_entry = va_arg(vp, SilcClientEntry); - - /* Change nick on all channels */ - silc_hash_table_list(local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); - if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), local_entry->nickname))) { - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - oldnick, local_entry->nickname); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), local_entry->nickname); - } - } - silc_hash_table_list_reset(&htl); - - purple_connection_set_display_name(gc, local_entry->nickname); - } - break; - - case SILC_COMMAND_LIST: - { - char *topic, *name; - int usercount; - PurpleRoomlistRoom *room; - - if (sg->roomlist_canceled) - break; - - if (!success) { - purple_notify_error(gc, _("Error"), _("Error retrieving room list"), - silc_get_status_message(status)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - - (void)va_arg(vp, SilcChannelEntry); - name = va_arg(vp, char *); - if (!name) { - purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), - silc_get_status_message(status)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - topic = va_arg(vp, char *); - usercount = va_arg(vp, int); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(sg->roomlist, room, name); - purple_roomlist_room_add_field(sg->roomlist, room, - SILC_32_TO_PTR(usercount)); - purple_roomlist_room_add_field(sg->roomlist, room, - topic ? topic : ""); - purple_roomlist_room_add(sg->roomlist, room); - - if (status == SILC_STATUS_LIST_END || - status == SILC_STATUS_OK) { - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - } - } - break; - - case SILC_COMMAND_GETKEY: - { - SilcPublicKey public_key; - - if (!success) { - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, SilcUInt32); - (void)va_arg(vp, void *); - public_key = va_arg(vp, SilcPublicKey); - - if (!public_key) - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - _("No public key was received")); - } - break; - - case SILC_COMMAND_INFO: - { - - char *server_name; - char *server_info; - char tmp[256]; - - if (!success) { - purple_notify_error(gc, _("Server Information"), - _("Cannot get server information"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, SilcServerEntry); - server_name = va_arg(vp, char *); - server_info = va_arg(vp, char *); - - if (server_name && server_info) { - g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", - server_name, server_info); - purple_notify_info(gc, NULL, _("Server Information"), tmp); - } - } - break; - - case SILC_COMMAND_STATS: - { - SilcUInt32 starttime, uptime, my_clients, my_channels, my_server_ops, - my_router_ops, cell_clients, cell_channels, cell_servers, - clients, channels, servers, routers, server_ops, router_ops; - SilcUInt32 buffer_length; - SilcBufferStruct buf; - - unsigned char *server_stats; - char *msg; - - if (!success) { - purple_notify_error(gc, _("Server Statistics"), - _("Cannot get server statistics"), - silc_get_status_message(status)); - return; - } - - server_stats = va_arg(vp, unsigned char *); - buffer_length = va_arg(vp, SilcUInt32); - if (!server_stats || !buffer_length) { - purple_notify_error(gc, _("Server Statistics"), - _("No server statistics available"), NULL); - break; - } - silc_buffer_set(&buf, server_stats, buffer_length); - silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&starttime), - SILC_STR_UI_INT(&uptime), - SILC_STR_UI_INT(&my_clients), - SILC_STR_UI_INT(&my_channels), - SILC_STR_UI_INT(&my_server_ops), - SILC_STR_UI_INT(&my_router_ops), - SILC_STR_UI_INT(&cell_clients), - SILC_STR_UI_INT(&cell_channels), - SILC_STR_UI_INT(&cell_servers), - SILC_STR_UI_INT(&clients), - SILC_STR_UI_INT(&channels), - SILC_STR_UI_INT(&servers), - SILC_STR_UI_INT(&routers), - SILC_STR_UI_INT(&server_ops), - SILC_STR_UI_INT(&router_ops), - SILC_STR_END); - - msg = g_strdup_printf(_("Local server start time: %s\n" - "Local server uptime: %s\n" - "Local server clients: %d\n" - "Local server channels: %d\n" - "Local server operators: %d\n" - "Local router operators: %d\n" - "Local cell clients: %d\n" - "Local cell channels: %d\n" - "Local cell servers: %d\n" - "Total clients: %d\n" - "Total channels: %d\n" - "Total servers: %d\n" - "Total routers: %d\n" - "Total server operators: %d\n" - "Total router operators: %d\n"), - silc_get_time(starttime), - purple_str_seconds_to_string((int)uptime), - (int)my_clients, (int)my_channels, (int)my_server_ops, (int)my_router_ops, - (int)cell_clients, (int)cell_channels, (int)cell_servers, - (int)clients, (int)channels, (int)servers, (int)routers, - (int)server_ops, (int)router_ops); - - purple_notify_info(gc, NULL, - _("Network Statistics"), msg); - g_free(msg); - } - break; - - case SILC_COMMAND_PING: - { - if (!success) { - purple_notify_error(gc, _("Ping"), _("Ping failed"), - silc_get_status_message(status)); - return; - } - - purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), - NULL); - } - break; - - case SILC_COMMAND_KILL: - if (!success) { - purple_notify_error(gc, _("Kill User"), - _("Could not kill user"), - silc_get_status_message(status)); - return; - } - break; - - case SILC_COMMAND_CMODE: - { - SilcChannelEntry channel_entry; - SilcBuffer channel_pubkeys; - - if (!success) - return; - - channel_entry = va_arg(vp, SilcChannelEntry); - (void)va_arg(vp, SilcUInt32); - (void)va_arg(vp, SilcPublicKey); - channel_pubkeys = va_arg(vp, SilcBuffer); - - if (sg->chpk) - silcpurple_chat_chauth_show(sg, channel_entry, channel_pubkeys); - } - break; - - default: - if (success) - purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); - else - purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, - silc_get_status_message(status)); - break; - } - - va_end(vp); -} - - -/* Called to indicate that connection was either successfully established - or connecting failed. This is also the first time application receives - the SilcClientConnection object which it should save somewhere. - If the `success' is FALSE the application must always call the function - silc_client_close_connection. */ - -static void -silc_connected(SilcClient client, SilcClientConnection conn, - SilcClientConnectionStatus status) -{ - PurpleConnection *gc = client->application; - SilcPurple sg; - - if (gc == NULL) { - silc_client_close_connection(client, conn); - return; - } - sg = gc->proto_data; - - switch (status) { - case SILC_CLIENT_CONN_SUCCESS: - case SILC_CLIENT_CONN_SUCCESS_RESUME: - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Send the server our buddy list */ - silcpurple_send_buddylist(gc); - - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Send any UMODEs configured for account */ - if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { - silc_client_command_call(sg->client, sg->conn, NULL, - "UMODE", "+P", NULL); - } - - return; - break; - case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error during connecting to SILC Server")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Key Exchange failed")); - break; - - case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Authentication failed")); - break; - - case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Resuming detached session failed. " - "Press Reconnect to create new connection.")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection timed out")); - break; - } - - /* Error */ - sg->conn = NULL; - silc_client_close_connection(client, conn); -} - - -/* Called to indicate that connection was disconnected to the server. - The `status' may tell the reason of the disconnection, and if the - `message' is non-NULL it may include the disconnection message - received from server. */ - -static void -silc_disconnected(SilcClient client, SilcClientConnection conn, - SilcStatus status, const char *message) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (sg->resuming && !sg->detaching) - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - sg->conn = NULL; - - /* Close the connection */ - if (!sg->detaching) - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected by server")); - else - /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ - purple_account_disconnect(purple_connection_get_account(gc)); -} - - -typedef struct { - SilcGetAuthMeth completion; - void *context; -} *SilcPurpleGetAuthMethod; - -/* Callback called when we've received the authentication method information - from the server after we've requested it. */ - -static void silc_get_auth_method_callback(SilcClient client, - SilcClientConnection conn, - SilcAuthMethod auth_meth, - void *context) -{ - SilcPurpleGetAuthMethod internal = context; - - switch (auth_meth) { - case SILC_AUTH_NONE: - /* No authentication required. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - - case SILC_AUTH_PASSWORD: - /* By returning NULL here the library will ask the passphrase from us - by calling the silc_ask_passphrase. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - - case SILC_AUTH_PUBLIC_KEY: - /* Do not get the authentication data now, the library will generate - it using our default key, if we do not provide it here. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - } - - silc_free(internal); -} - -/* Find authentication method and authentication data by hostname and - port. The hostname may be IP address as well. When the authentication - method has been resolved the `completion' callback with the found - authentication method and authentication data is called. The `conn' - may be NULL. */ - -static void -silc_get_auth_method(SilcClient client, SilcClientConnection conn, - char *hostname, SilcUInt16 port, - SilcGetAuthMeth completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleGetAuthMethod internal; - const char *password; - - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 4, 5); - else - purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); - - /* Check configuration if we have this connection configured. If we - have then return that data immediately, as it's faster way. */ - if (purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { - completion(TRUE, SILC_AUTH_PUBLIC_KEY, NULL, 0, context); - return; - } - password = purple_connection_get_password(gc); - if (password && *password) { - completion(TRUE, SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); - return; - } - - /* Resolve the authentication method from server, as we may not know it. */ - internal = silc_calloc(1, sizeof(*internal)); - if (!internal) - return; - internal->completion = completion; - internal->context = context; - silc_client_request_authentication_method(client, conn, - silc_get_auth_method_callback, - internal); -} - - -/* Verifies received public key. The `conn_type' indicates which entity - (server, client etc.) has sent the public key. If user decides to trust - the application may save the key as trusted public key for later - use. The `completion' must be called after the public key has been - verified. */ - -static void -silc_verify_public_key(SilcClient client, SilcClientConnection conn, - SilcSocketType conn_type, unsigned char *pk, - SilcUInt32 pk_len, SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn && (conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER)) { - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 3, 5); - else - purple_connection_update_progress(gc, _("Verifying server public key"), - 3, 5); - } - - /* Verify public key */ - silcpurple_verify_public_key(client, conn, NULL, conn_type, pk, - pk_len, pk_type, completion, context); -} - -typedef struct { - SilcAskPassphrase completion; - void *context; -} *SilcPurpleAskPassphrase; - -static void -silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) -{ - if (!passphrase || !(*passphrase)) - internal->completion(NULL, 0, internal->context); - else - internal->completion((unsigned char *)passphrase, - strlen(passphrase), internal->context); - silc_free(internal); -} - -/* Ask (interact, that is) a passphrase from user. The passphrase is - returned to the library by calling the `completion' callback with - the `context'. The returned passphrase SHOULD be in UTF-8 encoded, - if not then the library will attempt to encode. */ - -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); - - if (!internal) - return; - internal->completion = completion; - internal->context = context; - purple_request_input(gc, _("Passphrase"), NULL, - _("Passphrase required"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silc_ask_passphrase_cb), - _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), - purple_connection_get_account(gc), NULL, NULL, internal); -} - - -/* Notifies application that failure packet was received. This is called - if there is some protocol active in the client. The `protocol' is the - protocol context. The `failure' is opaque pointer to the failure - indication. Note, that the `failure' is protocol dependant and - application must explicitly cast it to correct type. Usually `failure' - is 32 bit failure type (see protocol specs for all protocol failure - types). */ - -static void -silc_failure(SilcClient client, SilcClientConnection conn, - SilcProtocol protocol, void *failure) -{ - PurpleConnection *gc = client->application; - char buf[128]; - - memset(buf, 0, sizeof(buf)); - - if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_KEY_EXCHANGE) { - SilcSKEStatus status = (SilcSKEStatus)SILC_PTR_TO_32(failure); - - if (status == SILC_SKE_STATUS_BAD_VERSION) - g_snprintf(buf, sizeof(buf), - _("Failure: Version mismatch, upgrade your client")); - if (status == SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not trust/support your public key")); - if (status == SILC_SKE_STATUS_UNKNOWN_GROUP) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed KE group")); - if (status == SILC_SKE_STATUS_UNKNOWN_CIPHER) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed cipher")); - if (status == SILC_SKE_STATUS_UNKNOWN_PKCS) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed PKCS")); - if (status == SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed hash function")); - if (status == SILC_SKE_STATUS_UNKNOWN_HMAC) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed HMAC")); - if (status == SILC_SKE_STATUS_INCORRECT_SIGNATURE) - g_snprintf(buf, sizeof(buf), _("Failure: Incorrect signature")); - if (status == SILC_SKE_STATUS_INVALID_COOKIE) - g_snprintf(buf, sizeof(buf), _("Failure: Invalid cookie")); - - /* Show the error on the progress bar. A more generic error message - is going to be showed to user after this in the silc_connected. */ - purple_connection_update_progress(gc, buf, 2, 5); - } - - if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_CONNECTION_AUTH) { - SilcUInt32 err = SILC_PTR_TO_32(failure); - - if (err == SILC_AUTH_FAILED) - g_snprintf(buf, sizeof(buf), _("Failure: Authentication failed")); - - /* Show the error on the progress bar. A more generic error message - is going to be showed to user after this in the silc_connected. */ - purple_connection_update_progress(gc, buf, 4, 5); - } -} - -/* Asks whether the user would like to perform the key agreement protocol. - This is called after we have received an key agreement packet or an - reply to our key agreement packet. This returns TRUE if the user wants - the library to perform the key agreement protocol and FALSE if it is not - desired (application may start it later by calling the function - silc_client_perform_key_agreement). If TRUE is returned also the - `completion' and `context' arguments must be set by the application. */ - -static bool -silc_key_agreement(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, const char *hostname, - SilcUInt16 port, SilcKeyAgreementCallback *completion, - void **context) -{ - silcpurple_buddy_keyagr_request(client, conn, client_entry, hostname, port); - *completion = NULL; - *context = NULL; - return FALSE; -} - - -/* Notifies application that file transfer protocol session is being - requested by the remote client indicated by the `client_entry' from - the `hostname' and `port'. The `session_id' is the file transfer - session and it can be used to either accept or reject the file - transfer request, by calling the silc_client_file_receive or - silc_client_file_close, respectively. */ - -static void -silc_ftp(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - silcpurple_ftp_request(client, conn, client_entry, session_id, - hostname, port); -} - - -/* Delivers SILC session detachment data indicated by `detach_data' to the - application. If application has issued SILC_COMMAND_DETACH command - the client session in the SILC network is not quit. The client remains - in the network but is detached. The detachment data may be used later - to resume the session in the SILC Network. The appliation is - responsible of saving the `detach_data', to for example in a file. - - The detachment data can be given as argument to the functions - silc_client_connect_to_server, or silc_client_add_connection when - creating connection to remote server, inside SilcClientConnectionParams - structure. If it is provided the client library will attempt to resume - the session in the network. After the connection is created - successfully, the application is responsible of setting the user - interface for user into the same state it was before detaching (showing - same channels, channel modes, etc). It can do this by fetching the - information (like joined channels) from the client library. */ - -static void -silc_detach(SilcClient client, SilcClientConnection conn, - const unsigned char *detach_data, SilcUInt32 detach_data_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *file; - - /* Save the detachment data to file. */ - file = silcpurple_session_file(purple_account_get_username(sg->account)); - g_unlink(file); - silc_file_writefile(file, (char *)detach_data, detach_data_len); -} - -SilcClientOperations ops = { - silc_say, - silc_channel_message, - silc_private_message, - silc_notify, - silc_command, - silc_command_reply, - silc_connected, - silc_disconnected, - silc_get_auth_method, - silc_verify_public_key, - silc_ask_passphrase, - silc_failure, - silc_key_agreement, - silc_ftp, - silc_detach -}; diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/pk.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/pk.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/pk.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/pk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,274 +0,0 @@ -/* - - silcpurple_pk.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" - -/************************* Public Key Verification ***************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - char *filename; - char *entity; - char *entity_name; - char *fingerprint; - char *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - SilcSKEPKType pk_type; - SilcVerifyPublicKey completion; - void *context; - gboolean changed; -} *PublicKeyVerify; - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify); - -static void silcpurple_verify_cb(PublicKeyVerify verify, gint id) -{ - if (id != 2) { - if (verify->completion) - verify->completion(FALSE, verify->context); - } else { - if (verify->completion) - verify->completion(TRUE, verify->context); - - /* Save the key for future checking */ - silc_pkcs_save_public_key_data(verify->filename, verify->pk, - verify->pk_len, SILC_PKCS_FILE_PEM); - } - - silc_free(verify->filename); - silc_free(verify->entity); - silc_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_free(verify->pk); - silc_free(verify); -} - -static void silcpurple_verify_details_cb(PublicKeyVerify verify) -{ - /* What a hack. We have to display the accept dialog _again_ - because Purple closes the dialog after you press the button. Purple - should have option for the dialogs whether the buttons close them - or not. */ - silcpurple_verify_ask(verify->entity, verify->fingerprint, - verify->babbleprint, verify); -} - -static void silcpurple_verify_details(PublicKeyVerify verify, gint id) -{ - SilcPublicKey public_key; - PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; - - silc_pkcs_public_key_decode(verify->pk, verify->pk_len, - &public_key); - silcpurple_show_public_key(sg, verify->entity_name, public_key, - G_CALLBACK(silcpurple_verify_details_cb), - verify); - silc_pkcs_public_key_free(public_key); -} - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify) -{ - PurpleConnection *gc = verify->client->application; - char tmp[256], tmp2[256]; - - if (verify->changed) { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Your local copy does not match this " - "key. Would you still like to accept this public key?"), - entity); - } else { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Would you like to accept this " - "public key?"), entity); - } - g_snprintf(tmp2, sizeof(tmp2), - _("Fingerprint and babbleprint for the %s key are:\n\n" - "%s\n%s\n"), entity, fingerprint, babbleprint); - - purple_request_action(gc, _("Verify Public Key"), tmp, tmp2, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), entity, NULL, verify, 3, - _("Yes"), G_CALLBACK(silcpurple_verify_cb), - _("No"), G_CALLBACK(silcpurple_verify_cb), - _("_View..."), G_CALLBACK(silcpurple_verify_details)); -} - -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcSocketType conn_type, - unsigned char *pk, SilcUInt32 pk_len, - SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - int i; - char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; - char *fingerprint, *babbleprint; - struct passwd *pw; - struct stat st; - char *entity = ((conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER) ? - "server" : "client"); - PublicKeyVerify verify; - - if (pk_type != SILC_SKE_PK_TYPE_SILC) { - purple_notify_error(gc, _("Verify Public Key"), - _("Unsupported public key type"), NULL); - if (completion) - completion(FALSE, context); - return; - } - - pw = getpwuid(getuid()); - if (!pw) { - if (completion) - completion(FALSE, context); - return; - } - - memset(filename, 0, sizeof(filename)); - memset(filename2, 0, sizeof(filename2)); - memset(file, 0, sizeof(file)); - - if (conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER) { - if (!name) { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - conn->sock->ip, conn->sock->port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - conn->sock->hostname, conn->sock->port); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - hostf = filename2; - } else { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - name, conn->sock->port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - } - } else { - /* Replace all whitespaces with `_'. */ - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - g_snprintf(file, sizeof(file) - 1, "%skey_%s.pub", entity, fingerprint); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - silc_free(fingerprint); - - ipf = filename; - } - - verify = silc_calloc(1, sizeof(*verify)); - if (!verify) - return; - verify->client = client; - verify->conn = conn; - verify->filename = strdup(ipf); - verify->entity = strdup(entity); - verify->entity_name = (conn_type != SILC_SOCKET_TYPE_CLIENT ? - (name ? strdup(name) : strdup(conn->sock->hostname)) - : NULL); - verify->pk = silc_memdup(pk, pk_len); - verify->pk_len = pk_len; - verify->pk_type = pk_type; - verify->completion = completion; - verify->context = context; - fingerprint = verify->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = verify->babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - /* Check whether this key already exists */ - if (g_stat(ipf, &st) < 0 && (!hostf || g_stat(hostf, &st) < 0)) { - /* Key does not exist, ask user to verify the key and save it */ - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } else { - /* The key already exists, verify it. */ - SilcPublicKey public_key; - unsigned char *encpk; - SilcUInt32 encpk_len; - - /* Load the key file, try for both IP filename and hostname filename */ - if (!silc_pkcs_load_public_key(ipf, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(ipf, &public_key, - SILC_PKCS_FILE_BIN) && - (!hostf || (!silc_pkcs_load_public_key(hostf, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(hostf, &public_key, - SILC_PKCS_FILE_BIN)))) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Encode the key data */ - encpk = silc_pkcs_public_key_encode(public_key, &encpk_len); - if (!encpk) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Compare the keys */ - if (memcmp(encpk, pk, encpk_len)) { - /* Ask user to verify the key and save it */ - verify->changed = TRUE; - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Local copy matched */ - if (completion) - completion(TRUE, context); - silc_free(verify->filename); - silc_free(verify->entity); - silc_free(verify->entity_name); - silc_free(verify->pk); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_free(verify); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -SILC Purple Plugin -================== - -This is the Purple protocol plugin of the protocol called Secure Internet -Live Conferencing (SILC). The implementation will use the SILC Toolkit, -freely available from the http://silcnet.org/ site, for the actual SILC -protocol implementation. - -To include SILC into Purple, one needs to first compile and install -the SILC Toolkit. It is done as follows: - - ./configure --enable-shared - make - make install - -This will compile shared libraries of the SILC Toolkit. If the --prefix -is not given to ./configure, the binaries are installed into the -/usr/local/silc directory. - -Once the Toolkit is installed one needs to tell Purple's ./configure -script where the SILC Toolkit is located. It is done as simply as: - - ./configure - -if pkg-config is installed in your system. If it is isn't it's done as: - - ./configure --with-silc-libs=/path/to/silc/lib - --with-silc-includes=/path/to/silc/include - -If the SILC Toolkit cannot be found then the SILC protocol plugin will -not be compiled. diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1960 +0,0 @@ -/* - - silcpurple.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "version.h" -#include "wb.h" -#include "core.h" - -extern SilcClientOperations ops; -static PurplePlugin *silc_plugin = NULL; - -static const char * -silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return (const char *)"silc"; -} - -static GList * -silcpurple_away_states(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static void -silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = NULL; - SilcUInt32 mode; - SilcBuffer idp; - unsigned char mb[4]; - const char *state; - - if (gc != NULL) - sg = gc->proto_data; - - if (status == NULL) - return; - - state = purple_status_get_id(status); - - if (state == NULL) - return; - - if ((sg == NULL) || (sg->conn == NULL)) - return; - - mode = sg->conn->local_entry->mode; - mode &= ~(SILC_UMODE_GONE | - SILC_UMODE_HYPER | - SILC_UMODE_BUSY | - SILC_UMODE_INDISPOSED | - SILC_UMODE_PAGE); - - if (!strcmp(state, "hyper")) - mode |= SILC_UMODE_HYPER; - else if (!strcmp(state, "away")) - mode |= SILC_UMODE_GONE; - else if (!strcmp(state, "busy")) - mode |= SILC_UMODE_BUSY; - else if (!strcmp(state, "indisposed")) - mode |= SILC_UMODE_INDISPOSED; - else if (!strcmp(state, "page")) - mode |= SILC_UMODE_PAGE; - - /* Send UMODE */ - idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); - SILC_PUT32_MSB(mode, mb); - silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, - ++sg->conn->cmd_ident, 2, - 1, idp->data, idp->len, - 2, mb, sizeof(mb)); - silc_buffer_free(idp); -} - - -/*************************** Connection Routines *****************************/ - -static void -silcpurple_keepalive(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - silc_client_send_packet(sg->client, sg->conn, SILC_PACKET_HEARTBEAT, - NULL, 0); -} - -static gboolean -silcpurple_scheduler(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - silc_client_run_one(sg->client); - return TRUE; -} - -static void -silcpurple_nickname_parse(const char *nickname, - char **ret_nickname) -{ - silc_parse_userfqdn(nickname, ret_nickname, NULL); -} - -static void -silcpurple_login_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - PurpleAccount *account; - SilcClientConnectionParams params; - SilcUInt32 mask; - const char *dfile, *tmp; -#ifdef SILC_ATTRIBUTE_USER_ICON - PurpleStoredImage *img; -#endif -#ifdef HAVE_SYS_UTSNAME_H - struct utsname u; -#endif - - - g_return_if_fail(gc != NULL); - - sg = gc->proto_data; - - if (source < 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - return; - } - - client = sg->client; - account = sg->account; - - /* Get session detachment data, if available */ - memset(¶ms, 0, sizeof(params)); - dfile = silcpurple_session_file(purple_account_get_username(sg->account)); - params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); - if (params.detach_data) - params.detach_data[params.detach_data_len] = 0; - - /* Add connection to SILC client library */ - conn = silc_client_add_connection( - sg->client, ¶ms, - (char *)purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), sg); - if (!conn) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to initialize SILC Client connection")); - gc->proto_data = NULL; - return; - } - sg->conn = conn; - - /* Progress */ - if (params.detach_data) { - purple_connection_update_progress(gc, _("Resuming session"), 2, 5); - sg->resuming = TRUE; - } else { - purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); - } - - /* Perform SILC Key Exchange. The "silc_connected" will be called - eventually. */ - silc_client_start_key_exchange(sg->client, sg->conn, source); - - /* Set default attributes */ - mask = SILC_ATTRIBUTE_MOOD_NORMAL; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - mask = SILC_ATTRIBUTE_CONTACT_CHAT; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); -#ifdef HAVE_SYS_UTSNAME_H - if (!uname(&u)) { - SilcAttributeObjDevice dev; - memset(&dev, 0, sizeof(dev)); - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } -#endif -#ifdef _WIN32 - tmp = _tzname[0]; -#else - tmp = tzname[0]; -#endif - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)tmp, strlen(tmp)); - -#ifdef SILC_ATTRIBUTE_USER_ICON - /* Set our buddy icon */ - img = purple_buddy_icons_find_account_icon(account); - silcpurple_buddy_set_icon(gc, img); - purple_imgstore_unref(img); -#endif - - silc_free(params.detach_data); -} - -static void -silcpurple_login(PurpleAccount *account) -{ - SilcPurple sg; - SilcClient client; - SilcClientParams params; - PurpleConnection *gc; - char pkd[256], prd[256]; - const char *cipher, *hmac; - char *realname; - int i; - - gc = account->gc; - if (!gc) - return; - gc->proto_data = NULL; - - memset(¶ms, 0, sizeof(params)); - strcat(params.nickname_format, "%n@%h%a"); - params.nickname_parse = silcpurple_nickname_parse; - params.ignore_requested_attributes = FALSE; - - /* Allocate SILC client */ - client = silc_client_alloc(&ops, ¶ms, gc, NULL); - if (!client) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Out of memory")); - return; - } - - /* Get username, real name and local hostname for SILC library */ - if (purple_account_get_username(account)) { - const char *u = purple_account_get_username(account); - char **up = g_strsplit(u, "@", 2); - client->username = strdup(up[0]); - g_strfreev(up); - } else { - client->username = silc_get_username(); - purple_account_set_username(account, client->username); - } - realname = silc_get_real_name(); - if (purple_account_get_user_info(account)) { - client->realname = strdup(purple_account_get_user_info(account)); - free(realname); - } else if ((silc_get_real_name() != NULL) && (*realname != '\0')) { - client->realname = realname; - purple_account_set_user_info(account, client->realname); - } else { - free(realname); - client->realname = strdup(_("John Noname")); - } - client->hostname = silc_net_localhost(); - - purple_connection_set_display_name(gc, client->username); - - /* Register requested cipher and HMAC */ - cipher = purple_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER); - for (i = 0; silc_default_ciphers[i].name; i++) - if (!strcmp(silc_default_ciphers[i].name, cipher)) { - silc_cipher_register(&(silc_default_ciphers[i])); - break; - } - hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); - for (i = 0; silc_default_hmacs[i].name; i++) - if (!strcmp(silc_default_hmacs[i].name, hmac)) { - silc_hmac_register(&(silc_default_hmacs[i])); - break; - } - - /* Init SILC client */ - if (!silc_client_init(client)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to initialize SILC protocol")); - return; - } - - /* Check the ~/.silc dir and create it, and new key pair if necessary. */ - if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Error loading SILC key pair")); - return; - } - - /* Progress */ - purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, &client->pkcs, - &client->public_key, &client->private_key)) { - g_snprintf(pkd, sizeof(pkd), _("Unable to load SILC key pair: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - pkd); - return; - } - - sg = silc_calloc(1, sizeof(*sg)); - if (!sg) - return; - memset(sg, 0, sizeof(*sg)); - sg->client = client; - sg->gc = gc; - sg->account = account; - gc->proto_data = sg; - - /* Connect to the SILC server */ - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), - silcpurple_login_connected, gc) == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create connection")); - return; - } - - /* Schedule SILC using Glib's event loop */ - sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, sg); -} - -static int -silcpurple_close_final(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - silc_client_stop(sg->client); - silc_client_free(sg->client); -#ifdef HAVE_SILCMIME_H - if (sg->mimeass) - silc_mime_assembler_free(sg->mimeass); -#endif - silc_free(sg); - return 0; -} - -static void -silcpurple_close(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - g_return_if_fail(sg != NULL); - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - /* Send QUIT */ - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", quit_msg, NULL); - g_free(quit_msg); - - if (sg->conn) - silc_client_close_connection(sg->client, sg->conn); - - purple_timeout_remove(sg->scheduler); - purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); -} - - -/****************************** Protocol Actions *****************************/ - -static void -silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - char *tmp; - SilcUInt32 tmp_len, mask; - SilcAttributeObjService service; - SilcAttributeObjDevice dev; - SilcVCardStruct vcard; - const char *val; - - sg = gc->proto_data; - if (!sg) - return; - - memset(&service, 0, sizeof(service)); - memset(&dev, 0, sizeof(dev)); - memset(&vcard, 0, sizeof(vcard)); - - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_INFO, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_TIMEZONE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_GEOLOCATION, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, NULL); - - /* Set mood */ - mask = 0; - f = purple_request_fields_get_field(fields, "mood_normal"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_NORMAL; - f = purple_request_fields_get_field(fields, "mood_happy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_HAPPY; - f = purple_request_fields_get_field(fields, "mood_sad"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SAD; - f = purple_request_fields_get_field(fields, "mood_angry"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANGRY; - f = purple_request_fields_get_field(fields, "mood_jealous"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; - f = purple_request_fields_get_field(fields, "mood_ashamed"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; - f = purple_request_fields_get_field(fields, "mood_invincible"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; - f = purple_request_fields_get_field(fields, "mood_inlove"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INLOVE; - f = purple_request_fields_get_field(fields, "mood_sleepy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; - f = purple_request_fields_get_field(fields, "mood_bored"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_BORED; - f = purple_request_fields_get_field(fields, "mood_excited"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_EXCITED; - f = purple_request_fields_get_field(fields, "mood_anxious"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set preferred contact */ - mask = 0; - f = purple_request_fields_get_field(fields, "contact_chat"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CHAT; - f = purple_request_fields_get_field(fields, "contact_email"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; - f = purple_request_fields_get_field(fields, "contact_call"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CALL; - f = purple_request_fields_get_field(fields, "contact_sms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_SMS; - f = purple_request_fields_get_field(fields, "contact_mms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_MMS; - f = purple_request_fields_get_field(fields, "contact_video"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; - if (mask) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set status text */ - val = NULL; - f = purple_request_fields_get_field(fields, "status_text"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, - (void *)val, strlen(val)); - - /* Set vcard */ - val = NULL; - f = purple_request_fields_get_field(fields, "vcard"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) { - purple_account_set_string(sg->account, "vcard", val); - tmp = silc_file_readfile(val, &tmp_len); - if (tmp) { - tmp[tmp_len] = 0; - if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_INFO, - (void *)&vcard, - sizeof(vcard)); - } - silc_vcard_free(&vcard); - silc_free(tmp); - } else { - purple_account_set_string(sg->account, "vcard", ""); - } - -#ifdef HAVE_SYS_UTSNAME_H - /* Set device info */ - f = purple_request_fields_get_field(fields, "device"); - if (f && purple_request_field_bool_get_value(f)) { - struct utsname u; - if (!uname(&u)) { - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } - } -#endif - - /* Set timezone */ - val = NULL; - f = purple_request_fields_get_field(fields, "timezone"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)val, strlen(val)); -} - -static void -silcpurple_attrs(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcHashTable attrs; - SilcAttributePayload attr; - gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, - mangry = FALSE, mjealous = FALSE, mashamed = FALSE, - minvincible = FALSE, minlove = FALSE, msleepy = FALSE, - mbored = FALSE, mexcited = FALSE, manxious = FALSE; - gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, - cmms = FALSE, cchat = TRUE, cvideo = FALSE; - gboolean device = TRUE; - char status[1024]; - - sg = gc->proto_data; - if (!sg) - return; - - memset(status, 0, sizeof(status)); - - attrs = silc_client_attributes_get(client, conn); - if (attrs) { - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), - NULL, (void *)&attr)) { - SilcUInt32 mood = 0; - silc_attribute_get_object(attr, &mood, sizeof(mood)); - mnormal = !mood; - mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); - msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); - mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); - mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); - mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); - minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); - minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); - msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); - mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); - mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); - manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), - NULL, (void *)&attr)) { - SilcUInt32 contact = 0; - silc_attribute_get_object(attr, &contact, sizeof(contact)); - cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); - ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); - csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); - cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); - cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); - cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), - NULL, (void *)&attr)) - silc_attribute_get_object(attr, &status, sizeof(status)); - - if (!silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), - NULL, (void *)&attr)) - device = FALSE; - } - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l3", _("Your Current Mood")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_email", _("Email"), cemail); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("status_text", _("Your Current Status"), - status[0] ? status : NULL, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); -#if 0 - f = purple_request_field_label_new("l2", _("Online Services")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("services", - _("Let others see what services you are using"), - TRUE); - purple_request_field_group_add_field(g, f); -#endif -#ifdef HAVE_SYS_UTSNAME_H - f = purple_request_field_bool_new("device", - _("Let others see what computer you are using"), - device); - purple_request_field_group_add_field(g, f); -#endif - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("vcard", _("Your VCard File"), - purple_account_get_string(sg->account, "vcard", ""), - FALSE); - purple_request_field_group_add_field(g, f); -#ifdef _WIN32 - f = purple_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); -#else - f = purple_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); -#endif - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("User Online Status Attributes"), - _("User Online Status Attributes"), - _("You can let other users see your online status information " - "and your personal information. Please fill the information " - "you would like other users to see about yourself."), - fields, - _("OK"), G_CALLBACK(silcpurple_attrs_cb), - _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); -} - -static void -silcpurple_detach(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - /* Call DETACH */ - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; -} - -static void -silcpurple_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - char *tmp; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - if (!sg->motd) { - purple_notify_error( - gc, _("Message of the Day"), _("No Message of the Day available"), - _("There is no Message of the Day associated with this connection")); - return; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); -} - -static void -silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - PurpleRequestField *f; - const char *val, *pkfile = NULL, *prfile = NULL; - const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; - const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; - char *identifier; - int keylen = SILCPURPLE_DEF_PKCS_LEN; - SilcPublicKey public_key; - - sg = gc->proto_data; - if (!sg) - return; - - val = NULL; - f = purple_request_fields_get_field(fields, "pass1"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass1 = val; - else - pass1 = ""; - val = NULL; - f = purple_request_fields_get_field(fields, "pass2"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass2 = val; - else - pass2 = ""; - - if (strcmp(pass1, pass2)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); - return; - } - - val = NULL; - f = purple_request_fields_get_field(fields, "key"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - keylen = atoi(val); - f = purple_request_fields_get_field(fields, "pkfile"); - if (f) - pkfile = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "prfile"); - if (f) - prfile = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "un"); - if (f) - un = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "hn"); - if (f) - hn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "rn"); - if (f) - rn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "e"); - if (f) - e = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "o"); - if (f) - o = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "c"); - if (f) - c = purple_request_field_string_get_value(f); - - identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn, - (char *)rn, (char *)e, (char *)o, (char *)c); - - /* Create the key pair */ - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile, - identifier, pass1, NULL, &public_key, NULL, - FALSE)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); - return; - } - - silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); - - silc_pkcs_public_key_free(public_key); - silc_free(identifier); -} - -static void -silcpurple_create_keypair(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - const char *username, *realname; - char *hostname, **u; - char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; - - username = purple_account_get_username(sg->account); - u = g_strsplit(username, "@", 2); - username = u[0]; - realname = purple_account_get_user_info(sg->account); - hostname = silc_net_localhost(); - g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); - - g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); - g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); - g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); - g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("e", _("Email"), tmp, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("o", _("Organization"), "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("c", _("Country"), "", FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("Create New SILC Key Pair"), - _("Create New SILC Key Pair"), NULL, fields, - _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), - _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); - - g_strfreev(u); - silc_free(hostname); -} - -static void -silcpurple_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -static void -silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - char prd[256]; - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, - "private-key", - prd), old ? old : "", new ? new : ""); -} - -static void -silcpurple_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void -silcpurple_set_info(PurpleConnection *gc, const char *text) -{ -} - -static GList * -silcpurple_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Online Status"), - silcpurple_attrs); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Detach From Server"), - silcpurple_detach); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("View Message of the Day"), - silcpurple_view_motd); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Create SILC Key Pair..."), - silcpurple_create_keypair); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Change Password..."), - silcpurple_change_pass); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Set User Info..."), - silcpurple_show_set_info); - list = g_list_append(list, act); - - return list; -} - - -/******************************* IM Routines *********************************/ - -typedef struct { - char *nick; - char *message; - SilcUInt32 message_len; - SilcMessageFlags flags; - PurpleMessageFlags gflags; -} *SilcPurpleIM; - -static void -silcpurple_send_im_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleIM im = context; - PurpleConversation *convo; - char tmp[256], *nickname = NULL; - SilcClientEntry client_entry; -#ifdef HAVE_SILCMIME_H - SilcDList list; -#endif - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, - sg->account); - if (!convo) - return; - - if (!clients) - goto err; - - if (clients_count > 1) { - silc_parse_userfqdn(im->nick, &nickname, NULL); - - /* Find the correct one. The im->nick might be a formatted nick - so this will find the correct one. */ - clients = silc_client_get_clients_local(client, conn, - nickname, im->nick, - &clients_count); - if (!clients) - goto err; - client_entry = clients[0]; - silc_free(clients); - } else { - client_entry = clients[0]; - } - -#ifdef HAVE_SILCMIME_H - /* Check for images */ - if (im->gflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(im->message, (SilcUInt32 *)&im->flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - silc_client_send_private_message(client, conn, - client_entry, im->flags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - } - } -#endif - - /* Send the message */ - silc_client_send_private_message(client, conn, client_entry, im->flags, - (unsigned char *)im->message, im->message_len, TRUE); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - - err: - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), im->nick); - purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - out: - g_free(im->nick); - g_free(im->message); - silc_free(im); - silc_free(nickname); -} - -static int -silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count, mflags; - char *nickname, *msg, *tmp; - int ret = 0; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); -#ifdef HAVE_SILCMIME_H - SilcDList list; -#endif - - if (!who || !message) - return 0; - - mflags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg = purple_unescape_html(message); - - if (!g_ascii_strncasecmp(msg, "/me ", 4)) { - msg += 4; - if (!*msg) { - g_free(tmp); - return 0; - } - mflags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (!silc_parse_userfqdn(who, &nickname, NULL)) { - g_free(tmp); - return 0; - } - - if (sign) - mflags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, who, - &clients_count); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleIM im = silc_calloc(1, sizeof(*im)); - if (!im) { - g_free(tmp); - return 0; - } - im->nick = g_strdup(who); - im->message = g_strdup(message); - im->message_len = strlen(im->message); - im->flags = mflags; - im->gflags = flags; - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_send_im_resolved, im); - silc_free(nickname); - g_free(tmp); - return 0; - } - -#ifdef HAVE_SILCMIME_H - /* Check for images */ - if (flags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(message, &mflags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_private_message(client, conn, - clients[0], mflags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - g_free(tmp); - silc_free(nickname); - silc_free(clients); - return ret; - } - } -#endif - - /* Send private message directly */ - ret = silc_client_send_private_message(client, conn, clients[0], - mflags, - (unsigned char *)msg, - strlen(msg), TRUE); - - g_free(tmp); - silc_free(nickname); - silc_free(clients); - return ret; -} - - -static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { - /* split this single menu building function back into the two - original: one for buddies and one for chats */ - - if(PURPLE_BLIST_NODE_IS_CHAT(node)) { - return silcpurple_chat_menu((PurpleChat *) node); - } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return silcpurple_buddy_menu((PurpleBuddy *) node); - } else { - g_return_val_if_reached(NULL); - } -} - -/********************************* Commands **********************************/ - -static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - PurpleConversation *convo = conv; - int id = 0; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - if(args && args[0]) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); - - if (convo != NULL) - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); - - if (id == 0) - return PURPLE_CMD_RET_FAILED; - - silcpurple_chat_leave(gc, id); - - return PURPLE_CMD_RET_OK; - -} - -static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - int id = 0; - char *buf, *tmp, *tmp2; - const char *topic; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == 0) - return PURPLE_CMD_RET_FAILED; - - if (!args || !args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); - if (topic) { - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - } - - if (args && args[0] && (strlen(args[0]) > 255)) { - *error = g_strdup(_("Topic too long")); - return PURPLE_CMD_RET_FAILED; - } - - silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - GHashTable *comp; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(comp, "channel", args[0]); - if(args[1]) - g_hash_table_replace(comp, "passphrase", args[1]); - - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); - purple_roomlist_show_with_account(purple_connection_get_account(gc)); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - silcpurple_get_info(gc, args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret; - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret = 1; - PurpleConversation *convo; - PurpleConnection *gc; - PurpleAccount *account; - - if (!args || !args[0]) { - *error = g_strdup(_("You must specify a nick")); - return PURPLE_CMD_RET_FAILED; - } - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - account = purple_connection_get_account(gc); - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); - - if (args[1]) { - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *tmp; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!sg->motd) { - *error = g_strdup(_("There is no Message of the Day associated with this connection")); - return PURPLE_CMD_RET_FAILED; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - SilcChannelEntry channel; - char *silccmd, *silcargs, *msg, tmp[256]; - const char *chname; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL || !args || gc->proto_data == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (args[0]) - chname = args[0]; - else - chname = purple_conversation_get_name(conv); - - if (!args[1]) { - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - *error = g_strdup_printf(_("channel %s not found"), chname); - return PURPLE_CMD_RET_FAILED; - } - if (channel->mode) { - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); - } else { - msg = g_strdup_printf(_("no channel modes are set on %s"), chname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", - msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - return PURPLE_CMD_RET_OK; - } - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *silccmd, *silcargs; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); - g_free(quit_msg); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!silc_client_command_call(sg->client, sg->conn, args[0])) { - *error = g_strdup_printf(_("Unknown command: %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - - -/************************** Plugin Initialization ****************************/ - -static void -silcpurple_register_commands(void) -{ - purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); - purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); - purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); - purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_join, - _("join <channel> [<password>]: Join a chat on this network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); - purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", - silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); - purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_msg, - _("msg <nick> <message>: Send a private message to a user"), NULL); - purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, - _("query <nick> [<message>]: Send a private message to a user"), NULL); - purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, - _("motd: View the server's Message Of The Day"), NULL); - purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_detach, - _("detach: Detach this session"), NULL); - purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, - _("quit [message]: Disconnect from the server, with an optional message"), NULL); - purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_call, - _("call <command>: Call any silc client command"), NULL); - /* These below just get passed through for the silc client library to deal - * with */ - purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); - purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("nick <newnick>: Change your nickname"), NULL); - purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("whowas <nick>: View nick's information"), NULL); - purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, - _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); - purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); - purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("umode <usermodes>: Set your modes in the network"), NULL); - purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); - purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); - purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); - purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("info [server]: View server administrative details"), NULL); - purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); - purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); - purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("stats: View server and network statistics"), NULL); - purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("ping: Send PING to the connected server"), NULL); -#if 0 /* Purple doesn't handle these yet */ - purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_users, - _("users <channel>: List users in channel")); - purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names, - _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); -#endif -} - -static PurpleWhiteboardPrplOps silcpurple_wb_ops = -{ - silcpurple_wb_start, - silcpurple_wb_end, - silcpurple_wb_get_dimensions, - silcpurple_wb_set_dimensions, - silcpurple_wb_get_brush, - silcpurple_wb_set_brush, - silcpurple_wb_send, - silcpurple_wb_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ -#ifdef HAVE_SILCMIME_H - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | - OPT_PROTO_SLASH_COMMANDS_NATIVE, -#else - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | - OPT_PROTO_SLASH_COMMANDS_NATIVE, -#endif - NULL, /* user_splits */ - NULL, /* protocol_options */ -#ifdef SILC_ATTRIBUTE_USER_ICON - {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ -#else - NO_BUDDY_ICONS, -#endif - silcpurple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - silcpurple_status_text, /* status_text */ - silcpurple_tooltip_text, /* tooltip_text */ - silcpurple_away_states, /* away_states */ - silcpurple_blist_node_menu, /* blist_node_menu */ - silcpurple_chat_info, /* chat_info */ - silcpurple_chat_info_defaults,/* chat_info_defaults */ - silcpurple_login, /* login */ - silcpurple_close, /* close */ - silcpurple_send_im, /* send_im */ - silcpurple_set_info, /* set_info */ - NULL, /* send_typing */ - silcpurple_get_info, /* get_info */ - silcpurple_set_status, /* set_status */ - silcpurple_idle_set, /* set_idle */ - silcpurple_change_passwd, /* change_passwd */ - silcpurple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - silcpurple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - silcpurple_chat_join, /* join_chat */ - NULL, /* reject_chat */ - silcpurple_get_chat_name, /* get_chat_name */ - silcpurple_chat_invite, /* chat_invite */ - silcpurple_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - silcpurple_chat_send, /* chat_send */ - silcpurple_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ -#ifdef SILC_ATTRIBUTE_USER_ICON - silcpurple_buddy_set_icon, /* set_buddy_icon */ -#else - NULL, -#endif - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - silcpurple_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - silcpurple_roomlist_get_list, /* roomlist_get_list */ - silcpurple_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - silcpurple_ftp_send_file, /* send_file */ - silcpurple_ftp_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - &silcpurple_wb_ops, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-silc", /**< id */ - "SILC", /**< name */ - "1.0", /**< version */ - /** summary */ - N_("SILC Protocol Plugin"), - /** description */ - N_("Secure Internet Live Conferencing (SILC) Protocol"), - "Pekka Riikonen", /**< author */ - "http://silcnet.org/", /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - silcpurple_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleAccountUserSplit *split; - char tmp[256]; - int i; - PurpleKeyValuePair *kvp; - GList *list = NULL; - - silc_plugin = plugin; - - split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Account options */ - option = purple_account_option_string_new(_("Connect server"), - "server", - "silc.silcnet.org"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_int_new(_("Port"), "port", 706); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Public Key file"), - "public-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Private Key file"), - "private-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - for (i = 0; silc_default_ciphers[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_ciphers[i].name); - kvp->value = g_strdup(silc_default_ciphers[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("Cipher"), "cipher", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - list = NULL; - for (i = 0; silc_default_hmacs[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_hmacs[i].name); - kvp->value = g_strdup(silc_default_hmacs[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("HMAC"), "hmac", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Public key authentication"), - "pubkey-auth", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), - "block-ims", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block messages to whiteboard"), - "block-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Automatically open whiteboard"), - "open-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), - "sign-verify", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_remove("/plugins/prpl/silc"); - - silcpurple_register_commands(); - -#ifdef _WIN32 - silc_net_win32_init(); -#endif -} - -PURPLE_INIT_PLUGIN(silc10, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silcpurple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silcpurple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silcpurple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/silcpurple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_H -#define SILCPURPLE_H - -/* Purple includes */ -#include "internal.h" -#include "account.h" -#include "accountopt.h" -#include "cmds.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -/* Default public and private key file names */ -#define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" -#define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" - -/* Default settings for creating key pair */ -#define SILCPURPLE_DEF_PKCS "rsa" -#define SILCPURPLE_DEF_PKCS_LEN 2048 - -#define SILCPURPLE_PRVGRP 0x001fffff - -/* Status IDs */ -#define SILCPURPLE_STATUS_ID_OFFLINE "offline" -#define SILCPURPLE_STATUS_ID_AVAILABLE "available" -#define SILCPURPLE_STATUS_ID_HYPER "hyper" -#define SILCPURPLE_STATUS_ID_AWAY "away" -#define SILCPURPLE_STATUS_ID_BUSY "busy" -#define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" -#define SILCPURPLE_STATUS_ID_PAGE "page" - -typedef struct { - unsigned long id; - const char *channel; - unsigned long chid; - const char *parentch; - SilcChannelPrivateKey key; -} *SilcPurplePrvgrp; - -/* The SILC Purple plugin context */ -typedef struct SilcPurpleStruct { - SilcClient client; - SilcClientConnection conn; - - guint scheduler; - PurpleConnection *gc; - PurpleAccount *account; - unsigned long channel_ids; - GList *grps; - - char *motd; - PurpleRoomlist *roomlist; -#ifdef HAVE_SILCMIME_H - SilcMimeAssembler mimeass; -#endif - unsigned int detaching : 1; - unsigned int resuming : 1; - unsigned int roomlist_canceled : 1; - unsigned int chpk : 1; -} *SilcPurple; - - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc); -void silcpurple_chat_join_done(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context); -const char *silcpurple_silcdir(void); -const char *silcpurple_session_file(const char *account); -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcSocketType conn_type, - unsigned char *pk, SilcUInt32 pk_len, - SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context); -GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_send_buddylist(PurpleConnection *gc); -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port); -void silcpurple_idle_set(PurpleConnection *gc, int idle); -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -char *silcpurple_status_text(PurpleBuddy *b); -gboolean silcpurple_ip_is_private(const char *ip); -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port); -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context); -void silcpurple_get_info(PurpleConnection *gc, const char *who); -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -GList *silcpurple_chat_info(PurpleConnection *gc); -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -GList *silcpurple_chat_menu(PurpleChat *); -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); -char *silcpurple_get_chat_name(GHashTable *data); -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name); -void silcpurple_chat_leave(PurpleConnection *gc, int id); -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); -void silcpurple_roomlist_cancel(PurpleRoomlist *list); -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcBuffer channel_pubkeys); -void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr); -#ifdef SILC_ATTRIBUTE_USER_ICON -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -#endif -#ifdef HAVE_SILCMIME_H -char *silcpurple_file2mime(const char *filename); -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); -#endif - -#ifdef _WIN32 -typedef int uid_t; - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - int pw_uid; /* user id */ - int pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct passwd *getpwuid(int uid); -int getuid(void); -int geteuid(void); -#endif - -#endif /* SILCPURPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/TODO qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/TODO --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/TODO 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -Features TODO (maybe) -===================== - -Preferences - - Add joined channels to buddy list automatically (during - session) - - Add joined channels to buddy list automatically permanently - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,776 +0,0 @@ -/* - - silcpurple_util.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" - -/**************************** Utility Routines *******************************/ - -static char str[256], str2[256]; - -const char *silcpurple_silcdir(void) -{ - const char *hd = purple_home_dir(); - memset(str, 0, sizeof(str)); - g_snprintf(str, sizeof(str) - 1, "%s" G_DIR_SEPARATOR_S ".silc", hd ? hd : "/tmp"); - return (const char *)str; -} - -const char *silcpurple_session_file(const char *account) -{ - memset(str2, 0, sizeof(str2)); - g_snprintf(str2, sizeof(str2) - 1, "%s" G_DIR_SEPARATOR_S "%s_session", - silcpurple_silcdir(), account); - return (const char *)str2; -} - -gboolean silcpurple_ip_is_private(const char *ip) -{ - if (silc_net_is_ip4(ip)) { - if (!strncmp(ip, "10.", 3)) { - return TRUE; - } else if (!strncmp(ip, "172.", 4) && strlen(ip) > 6) { - char tmp[3]; - int s; - memset(tmp, 0, sizeof(tmp)); - strncpy(tmp, ip + 4, 2); - s = atoi(tmp); - if (s >= 16 && s <= 31) - return TRUE; - } else if (!strncmp(ip, "192.168.", 8)) { - return TRUE; - } - } - - return FALSE; -} - -/* This checks stats for various SILC files and directories. First it - checks if ~/.silc directory exist and is owned by the correct user. If - it doesn't exist, it will create the directory. After that it checks if - user's Public and Private key files exists and creates them if needed. */ - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc) -{ - char filename[256], file_public_key[256], file_private_key[256]; - char servfilename[256], clientfilename[256], friendsfilename[256]; - char pkd[256], prd[256]; - struct stat st; - struct passwd *pw; - int fd; - - pw = getpwuid(getuid()); - if (!pw) { - purple_debug_error("silc", "silc: %s\n", g_strerror(errno)); - return FALSE; - } - - g_snprintf(filename, sizeof(filename) - 1, "%s", silcpurple_silcdir()); - g_snprintf(servfilename, sizeof(servfilename) - 1, "%s" G_DIR_SEPARATOR_S "serverkeys", - silcpurple_silcdir()); - g_snprintf(clientfilename, sizeof(clientfilename) - 1, "%s" G_DIR_SEPARATOR_S "clientkeys", - silcpurple_silcdir()); - g_snprintf(friendsfilename, sizeof(friendsfilename) - 1, "%s" G_DIR_SEPARATOR_S "friends", - silcpurple_silcdir()); - - /* - * Check ~/.silc directory - */ - if ((g_stat(filename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(filename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno)); - return FALSE; - } - } else { -#ifndef _WIN32 - /* Check the owner of the dir */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own '%s' directory\n", - filename); - return FALSE; - } -#endif - } - - /* - * Check ~./silc/serverkeys directory - */ - if ((g_stat(servfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(servfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - servfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/clientkeys directory - */ - if ((g_stat(clientfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(clientfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - clientfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/friends directory - */ - if ((g_stat(friendsfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(friendsfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - friendsfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check Public and Private keys - */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); - g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); - - if ((g_stat(file_public_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, file_private_key, NULL, - (gc->password == NULL) ? "" : gc->password, - NULL, NULL, NULL, FALSE)) { - purple_debug_error("silc", "Couldn't create key pair\n"); - return FALSE; - } - - if ((g_stat(file_public_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the public key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your public key!?\n"); - return FALSE; - } -#endif - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } else if ((g_stat(file_private_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, file_private_key, NULL, - (gc->password == NULL) ? "" : gc->password, - NULL, NULL, NULL, FALSE)) { - purple_debug_error("silc", "Couldn't create key pair\n"); - return FALSE; - } - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } - /* This shouldn't really happen because silc_create_key_pair() - * will set the permissions */ - else if ((g_stat(file_private_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the private key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your private key!?\n"); - if (fd != -1) - close(fd); - return FALSE; - } - - /* Check the permissions for the private key */ - if ((st.st_mode & 0777) != 0600) { - purple_debug_warning("silc", "Wrong permissions in your private key file `%s'!\n" - "Trying to change them ...\n", file_private_key); - if ((fd == -1) || (fchmod(fd, S_IRUSR | S_IWUSR)) == -1) { - purple_debug_error("silc", - "Failed to change permissions for private key file!\n" - "Permissions for your private key file must be 0600.\n"); - if (fd != -1) - close(fd); - return FALSE; - } - purple_debug_warning("silc", "Done.\n\n"); - } -#endif - - if (fd != -1) - close(fd); - - return TRUE; -} - -#ifdef _WIN32 -struct passwd *getpwuid(uid_t uid) { - struct passwd *pwd = calloc(1, sizeof(struct passwd)); - return pwd; -} - -uid_t getuid() { - return 0; -} - -uid_t geteuid() { - return 0; -} -#endif - -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context) -{ - SilcPublicKeyIdentifier ident; - SilcPKCS pkcs; - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len, key_len = 0; - GString *s; - char *buf; - - ident = silc_pkcs_decode_identifier(public_key->identifier); - if (!ident) - return; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - if (silc_pkcs_alloc((unsigned char *)public_key->name, &pkcs)) { - key_len = silc_pkcs_public_key_set(pkcs, public_key); - silc_pkcs_free(pkcs); - } - - s = g_string_new(""); - if (ident->realname) - /* Hint for translators: Please check the tabulator width here and in - the next strings (short strings: 2 tabs, longer strings 1 tab, - sum: 3 tabs or 24 characters) */ - g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname); - if (ident->username) - g_string_append_printf(s, _("User Name: \t%s\n"), ident->username); - if (ident->email) - g_string_append_printf(s, _("Email: \t\t%s\n"), ident->email); - if (ident->host) - g_string_append_printf(s, _("Host Name: \t%s\n"), ident->host); - if (ident->org) - g_string_append_printf(s, _("Organization: \t%s\n"), ident->org); - if (ident->country) - g_string_append_printf(s, _("Country: \t%s\n"), ident->country); - g_string_append_printf(s, _("Algorithm: \t%s\n"), public_key->name); - g_string_append_printf(s, _("Key Length: \t%d bits\n"), (int)key_len); - g_string_append_printf(s, "\n"); - g_string_append_printf(s, _("Public Key Fingerprint:\n%s\n\n"), fingerprint); - g_string_append_printf(s, _("Public Key Babbleprint:\n%s"), babbleprint); - - buf = g_string_free(s, FALSE); - - purple_request_action(sg->gc, _("Public Key Information"), - _("Public Key Information"), - buf, 0, purple_connection_get_account(sg->gc), - NULL, NULL, context, 1, _("Close"), callback); - - g_free(buf); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - silc_pkcs_free_identifier(ident); -} - -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute) -{ - SilcAttributePayload attr = NULL; - - if (!attrs) - return NULL; - - silc_dlist_start(attrs); - while ((attr = silc_dlist_get(attrs)) != SILC_LIST_END) - if (attribute == silc_attribute_get_attribute(attr)) - break; - - return attr; -} - -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if ((mode & SILC_UMODE_SERVER_OPERATOR) || - (mode & SILC_UMODE_ROUTER_OPERATOR)) { - strcat(buf, (mode & SILC_UMODE_SERVER_OPERATOR) ? - "[server operator] " : - (mode & SILC_UMODE_ROUTER_OPERATOR) ? - "[SILC operator] " : "[unknown mode] "); - } - if (mode & SILC_UMODE_GONE) - strcat(buf, "[away] "); - if (mode & SILC_UMODE_INDISPOSED) - strcat(buf, "[indisposed] "); - if (mode & SILC_UMODE_BUSY) - strcat(buf, "[busy] "); - if (mode & SILC_UMODE_PAGE) - strcat(buf, "[wake me up] "); - if (mode & SILC_UMODE_HYPER) - strcat(buf, "[hyperactive] "); - if (mode & SILC_UMODE_ROBOT) - strcat(buf, "[robot] "); - if (mode & SILC_UMODE_ANONYMOUS) - strcat(buf, "[anonymous] "); - if (mode & SILC_UMODE_BLOCK_PRIVMSG) - strcat(buf, "[blocks private messages] "); - if (mode & SILC_UMODE_DETACHED) - strcat(buf, "[detached] "); - if (mode & SILC_UMODE_REJECT_WATCHING) - strcat(buf, "[rejects watching] "); - if (mode & SILC_UMODE_BLOCK_INVITE) - strcat(buf, "[blocks invites] "); - g_strchomp(buf); -} - -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) - strcat(buf, "[permanent] "); - if (mode & SILC_CHANNEL_MODE_PRIVATE) - strcat(buf, "[private] "); - if (mode & SILC_CHANNEL_MODE_SECRET) - strcat(buf, "[secret] "); - if (mode & SILC_CHANNEL_MODE_PRIVKEY) - strcat(buf, "[private key] "); - if (mode & SILC_CHANNEL_MODE_INVITE) - strcat(buf, "[invite only] "); - if (mode & SILC_CHANNEL_MODE_TOPIC) - strcat(buf, "[topic restricted] "); - if (mode & SILC_CHANNEL_MODE_ULIMIT) - strcat(buf, "[user count limit] "); - if (mode & SILC_CHANNEL_MODE_PASSPHRASE) - strcat(buf, "[passphrase auth] "); - if (mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) - strcat(buf, "[public key auth] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_USERS) - strcat(buf, "[users silenced] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_OPERS) - strcat(buf, "[operators silenced] "); - g_strchomp(buf); -} - -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strcat(buf, "[founder] "); - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strcat(buf, "[operator] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES) - strcat(buf, "[blocks messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_USERS) - strcat(buf, "[blocks user messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS) - strcat(buf, "[blocks robot messages] "); - if (mode & SILC_CHANNEL_UMODE_QUIET) - strcat(buf, "[quieted] "); - g_strchomp(buf); -} - -void -silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr) -{ - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - SilcAttributeContact contact; - SilcAttributeObjDevice device; - SilcAttributeObjGeo geo; - - char tmp[1024]; - GString *s; - - *moodstr = NULL; - *statusstr = NULL; - *contactstr = NULL; - *langstr = NULL; - *devicestr = NULL; - *tzstr = NULL; - *geostr = NULL; - - if (!attrs) - return; - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - g_string_append_printf(s, "[%s] ", _("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - g_string_append_printf(s, "[%s] ", _("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - g_string_append_printf(s, "[%s] ", _("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - g_string_append_printf(s, "[%s] ", _("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - g_string_append_printf(s, "[%s] ", _("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - g_string_append_printf(s, "[%s] ", _("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - g_string_append_printf(s, "[%s] ", _("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - g_string_append_printf(s, "[%s] ", _("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - g_string_append_printf(s, "[%s] ", _("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - g_string_append_printf(s, "[%s] ", _("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - g_string_append_printf(s, "[%s] ", _("Anxious")); - } - if (strlen(s->str)) { - *moodstr = s->str; - g_string_free(s, FALSE); - g_strchomp(*moodstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *statusstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); - if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { - if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) - g_string_append_printf(s, "[%s] ", _("Chat")); - if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) - g_string_append_printf(s, "[%s] ", _("Email")); - if (contact & SILC_ATTRIBUTE_CONTACT_CALL) - g_string_append_printf(s, "[%s] ", _("Phone")); - if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) - g_string_append_printf(s, "[%s] ", _("Paging")); - if (contact & SILC_ATTRIBUTE_CONTACT_SMS) - g_string_append_printf(s, "[%s] ", _("SMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_MMS) - g_string_append_printf(s, "[%s] ", _("MMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) - g_string_append_printf(s, "[%s] ", _("Video Conferencing")); - } - if (strlen(s->str)) { - *contactstr = s->str; - g_string_free(s, FALSE); - g_strchomp(*contactstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *langstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_DEVICE_INFO); - memset(&device, 0, sizeof(device)); - if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { - if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) - g_string_append_printf(s, "%s: ", _("Computer")); - if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) - g_string_append_printf(s, "%s: ", _("Mobile Phone")); - if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) - g_string_append_printf(s, "%s: ", _("PDA")); - if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) - g_string_append_printf(s, "%s: ", _("Terminal")); - g_string_append_printf(s, "%s %s %s %s", - device.manufacturer ? device.manufacturer : "", - device.version ? device.version : "", - device.model ? device.model : "", - device.language ? device.language : ""); - } - if (strlen(s->str)) { - *devicestr = s->str; - g_string_free(s, FALSE); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_TIMEZONE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *tzstr = g_strdup(tmp); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_GEOLOCATION); - memset(&geo, 0, sizeof(geo)); - if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) - *geostr = g_strdup_printf("%s %s %s (%s)", - geo.longitude ? geo.longitude : "", - geo.latitude ? geo.latitude : "", - geo.altitude ? geo.altitude : "", - geo.accuracy ? geo.accuracy : ""); -} - -#ifdef HAVE_SILCMIME_H -/* Returns MIME type of filetype */ - -char *silcpurple_file2mime(const char *filename) -{ - const char *ct; - - ct = strrchr(filename, '.'); - if (!ct) - return NULL; - else if (!g_ascii_strcasecmp(".png", ct)) - return strdup("image/png"); - else if (!g_ascii_strcasecmp(".jpg", ct)) - return strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".jpeg", ct)) - return strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".gif", ct)) - return strdup("image/gif"); - else if (!g_ascii_strcasecmp(".tiff", ct)) - return strdup("image/tiff"); - - return NULL; -} - -/* Checks if message has images, and assembles MIME message if it has. - If only one image is present, creates simple MIME image message. If - there are multiple images and/or text with images multipart MIME - message is created. */ - -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags) -{ - SilcMime mime = NULL, p; - SilcDList list, parts = NULL; - const char *start, *end, *last; - GData *attribs; - char *type; - gboolean images = FALSE; - - last = msg; - while (last && *last && purple_markup_find_tag("img", last, &start, - &end, &attribs)) { - PurpleStoredImage *image = NULL; - const char *id; - - /* Check if there is text before image */ - if (start - last) { - char *text, *tmp; - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - tmp = g_strndup(last, start - last); - text = purple_unescape_html(tmp); - g_free(tmp); - /* Add text */ - silc_mime_add_data(p, (unsigned char *)text, strlen(text)); - g_free(text); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - id = g_datalist_get_data(&attribs, "id"); - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - unsigned long imglen = purple_imgstore_get_size(image); - gconstpointer img = purple_imgstore_get_data(image); - - p = silc_mime_alloc(); - - /* Add content type */ - type = silcpurple_file2mime(purple_imgstore_get_filename(image)); - if (!type) { - g_datalist_clear(&attribs); - last = end + 1; - continue; - } - silc_mime_add_field(p, "Content-Type", type); - silc_free(type); - - /* Add content transfer encoding */ - silc_mime_add_field(p, "Content-Transfer-Encoding", "binary"); - - /* Add image data */ - silc_mime_add_data(p, img, imglen); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - images = TRUE; - } - - g_datalist_clear(&attribs); - - /* Continue after tag */ - last = end + 1; - } - - /* Check for text after the image(s) */ - if (images && last && *last) { - char *tmp = purple_unescape_html(last); - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - /* Add text */ - silc_mime_add_data(p, (unsigned char *)tmp, strlen(tmp)); - g_free(tmp); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - /* If there weren't any images, don't return anything. */ - if (!images) { - if (parts) - silc_dlist_uninit(parts); - return NULL; - } - - if (silc_dlist_count(parts) > 1) { - /* Multipart MIME message */ - char b[32]; - mime = silc_mime_alloc(); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - g_snprintf(b, sizeof(b), "b%4X%4X", - (unsigned int)time(NULL), - silc_dlist_count(parts)); - silc_mime_set_multipart(mime, "mixed", b); - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) - silc_mime_add_multipart(mime, p); - } else { - /* Simple MIME message */ - silc_dlist_start(parts); - mime = silc_dlist_get(parts); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - } - - *mflags &= ~SILC_MESSAGE_FLAG_UTF8; - *mflags |= SILC_MESSAGE_FLAG_DATA; - - /* Encode message. Fragment if it is too large */ - list = silc_mime_encode_partial(mime, 0xfc00); - - silc_dlist_uninit(parts); - - /* Added multiparts gets freed here */ - silc_mime_free(mime); - - return list; -} - -#endif /* HAVE_SILCMIME_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,520 +0,0 @@ -/* - - wb.c - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/* - SILC Whiteboard packet: - - 1 byte command - 2 bytes width - 2 bytes height - 4 bytes brush color - 2 bytes brush size - n bytes data - - Data: - - 4 bytes x - 4 bytes y - - Commands: - - 0x01 draw - 0x02 clear - - MIME: - - MIME-Version: 1.0 - Content-Type: application/x-wb - Content-Transfer-Encoding: binary - -*/ - -#define SILCPURPLE_WB_MIME "MIME-Version: 1.0\r\nContent-Type: application/x-wb\r\nContent-Transfer-Encoding: binary\r\n\r\n" -#define SILCPURPLE_WB_HEADER strlen(SILCPURPLE_WB_MIME) + 11 - -#define SILCPURPLE_WB_WIDTH 500 -#define SILCPURPLE_WB_HEIGHT 400 -#define SILCPURPLE_WB_WIDTH_MAX 1024 -#define SILCPURPLE_WB_HEIGHT_MAX 1024 - -/* Commands */ -typedef enum { - SILCPURPLE_WB_DRAW = 0x01, - SILCPURPLE_WB_CLEAR = 0x02 -} SilcPurpleWbCommand; - -/* Brush size */ -typedef enum { - SILCPURPLE_WB_BRUSH_SMALL = 2, - SILCPURPLE_WB_BRUSH_MEDIUM = 5, - SILCPURPLE_WB_BRUSH_LARGE = 10 -} SilcPurpleWbBrushSize; - -/* Brush color (XXX Purple should provide default colors) */ -typedef enum { - SILCPURPLE_WB_COLOR_BLACK = 0, - SILCPURPLE_WB_COLOR_RED = 13369344, - SILCPURPLE_WB_COLOR_GREEN = 52224, - SILCPURPLE_WB_COLOR_BLUE = 204, - SILCPURPLE_WB_COLOR_YELLOW = 15658496, - SILCPURPLE_WB_COLOR_ORANGE = 16737792, - SILCPURPLE_WB_COLOR_CYAN = 52428, - SILCPURPLE_WB_COLOR_VIOLET = 5381277, - SILCPURPLE_WB_COLOR_PURPLE = 13369548, - SILCPURPLE_WB_COLOR_TAN = 12093547, - SILCPURPLE_WB_COLOR_BROWN = 5256485, - SILCPURPLE_WB_COLOR_GREY = 11184810, - SILCPURPLE_WB_COLOR_WHITE = 16777215 -} SilcPurpleWbColor; - -typedef struct { - int type; /* 0 = buddy, 1 = channel */ - union { - SilcClientEntry client; - SilcChannelEntry channel; - } u; - int width; - int height; - int brush_size; - int brush_color; -} *SilcPurpleWb; - -/* Initialize whiteboard */ - -PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) -{ - SilcClientConnection conn; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - conn = sg->conn; - wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); - if (!wb) - wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 0; - wbs->u.client = client_entry; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) -{ - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) - wb = purple_whiteboard_create(sg->account, channel->channel_name, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 1; - wbs->u.channel = channel; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, - unsigned char *message, SilcUInt32 message_len) -{ - SilcUInt8 command; - SilcUInt16 width, height, brush_size; - SilcUInt32 brush_color, x, y, dx, dy; - SilcBufferStruct buf; - int ret; - - /* Parse the packet */ - silc_buffer_set(&buf, message, message_len); - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_CHAR(&command), - SILC_STR_UI_SHORT(&width), - SILC_STR_UI_SHORT(&height), - SILC_STR_UI_INT(&brush_color), - SILC_STR_UI_SHORT(&brush_size), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, ret); - - /* Update whiteboard if its dimensions changed */ - if (width != wbs->width || height != wbs->height) - silcpurple_wb_set_dimensions(wb, height, width); - - if (command == SILCPURPLE_WB_DRAW) { - /* Parse data and draw it */ - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - x = dx; - y = dy; - while (buf.len > 0) { - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - - purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy, - brush_color, brush_size); - x += dx; - y += dy; - } - } - - if (command == SILCPURPLE_WB_CLEAR) - purple_whiteboard_clear(wb); -} - -typedef struct { - unsigned char *message; - SilcUInt32 message_len; - SilcPurple sg; - SilcClientEntry sender; - SilcChannelEntry channel; -} *SilcPurpleWbRequest; - -static void -silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) -{ - PurpleWhiteboard *wb; - - if (id != 1) - goto out; - - if (!req->channel) - wb = silcpurple_wb_init(req->sg, req->sender); - else - wb = silcpurple_wb_init_ch(req->sg, req->channel); - - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); - - out: - silc_free(req->message); - silc_free(req); -} - -static void -silcpurple_wb_request(SilcClient client, const unsigned char *message, - SilcUInt32 message_len, SilcClientEntry sender, - SilcChannelEntry channel) -{ - char tmp[128]; - SilcPurpleWbRequest req; - PurpleConnection *gc; - SilcPurple sg; - - gc = client->application; - sg = gc->proto_data; - - /* Open whiteboard automatically if requested */ - if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { - PurpleWhiteboard *wb; - - if (!channel) - wb = silcpurple_wb_init(sg, sender); - else - wb = silcpurple_wb_init_ch(sg, channel); - - silcpurple_wb_parse(wb->proto_data, wb, (unsigned char *)message, - message_len); - return; - } - - /* Close any previous unaccepted requests */ - purple_request_close_with_handle(sender); - - if (!channel) { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard. Would you like " - "to open the whiteboard?"), sender->nickname); - } else { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard on %s channel. " - "Would you like to open the whiteboard?"), - sender->nickname, channel->channel_name); - } - - req = silc_calloc(1, sizeof(*req)); - if (!req) - return; - req->message = silc_memdup(message, message_len); - req->message_len = message_len; - req->sender = sender; - req->channel = channel; - req->sg = sg; - - purple_request_action(sender, _("Whiteboard"), tmp, NULL, 1, - sg->account, sender->nickname, NULL, req, 2, - _("Yes"), G_CALLBACK(silcpurple_wb_request_cb), - _("No"), G_CALLBACK(silcpurple_wb_request_cb)); -} - -/* Process incoming whiteboard message */ - -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, sender->nickname); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, NULL); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Process incoming whiteboard message on channel */ - -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, channel); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Send whiteboard message */ - -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - GList *list; - int len; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - for (list = draw_list; list; list = list->next) - len += 4; - - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_DRAW), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - silc_buffer_pull(packet, SILCPURPLE_WB_HEADER); - for (list = draw_list; list; list = list->next) { - silc_buffer_format(packet, - SILC_STR_UI_INT(GPOINTER_TO_INT(list->data)), - SILC_STR_END); - silc_buffer_pull(packet, 4); - } - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } else if (wbs->type == 1) { - /* Channel message. Channel private keys are not supported. */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } - - silc_buffer_free(packet); -} - -/* Purple Whiteboard operations */ - -void silcpurple_wb_start(PurpleWhiteboard *wb) -{ - /* Nothing here. Everything is in initialization */ -} - -void silcpurple_wb_end(PurpleWhiteboard *wb) -{ - silc_free(wb->proto_data); - wb->proto_data = NULL; -} - -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - SilcPurpleWb wbs = wb->proto_data; - *width = wbs->width; - *height = wbs->height; -} - -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : - width; - wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : - height; - - /* Update whiteboard */ - purple_whiteboard_set_dimensions(wb, wbs->width, wbs->height); -} - -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - SilcPurpleWb wbs = wb->proto_data; - *size = wbs->brush_size; - *color = wbs->brush_color; -} - -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->brush_size = size; - wbs->brush_color = color; - - /* Update whiteboard */ - purple_whiteboard_set_brush(wb, size, color); -} - -void silcpurple_wb_clear(PurpleWhiteboard *wb) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - int len; - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_CLEAR), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } else if (wbs->type == 1) { - /* Channel message */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } - - silc_buffer_free(packet); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/silc10/wb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_WB_H -#define SILCPURPLE_WB_H - -#include "silcpurple.h" -#include "whiteboard.h" - -PurpleWhiteboard * -silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry); -PurpleWhiteboard * -silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel); -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_start(PurpleWhiteboard *wb); -void silcpurple_wb_end(PurpleWhiteboard *wb); -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height); -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color); -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list); -void silcpurple_wb_clear(PurpleWhiteboard *wb); - -#endif /* SILCPURPLE_WB_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SIMPLESOURCES = \ - simple.c \ - simple.h \ - sipmsg.c \ - sipmsg.h - -AM_CFLAGS = $(st) - -libsimple_la_LDFLAGS = -module -avoid-version - -if STATIC_SIMPLE - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libsimple.la -libsimple_la_SOURCES = $(SIMPLESOURCES) -libsimple_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libsimple.la -libsimple_la_SOURCES = $(SIMPLESOURCES) -libsimple_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,749 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/simple -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_SIMPLE_FALSE@libsimple_la_DEPENDENCIES = \ -@STATIC_SIMPLE_FALSE@ $(am__DEPENDENCIES_1) -am__libsimple_la_SOURCES_DIST = simple.c simple.h sipmsg.c sipmsg.h -am__objects_1 = libsimple_la-simple.lo libsimple_la-sipmsg.lo -@STATIC_SIMPLE_FALSE@am_libsimple_la_OBJECTS = $(am__objects_1) -@STATIC_SIMPLE_TRUE@am_libsimple_la_OBJECTS = $(am__objects_1) -libsimple_la_OBJECTS = $(am_libsimple_la_OBJECTS) -@STATIC_SIMPLE_FALSE@am_libsimple_la_rpath = -rpath $(pkgdir) -@STATIC_SIMPLE_TRUE@am_libsimple_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsimple_la_SOURCES) -DIST_SOURCES = $(am__libsimple_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -SIMPLESOURCES = \ - simple.c \ - simple.h \ - sipmsg.c \ - sipmsg.h - -AM_CFLAGS = $(st) -libsimple_la_LDFLAGS = -module -avoid-version -@STATIC_SIMPLE_FALSE@st = -@STATIC_SIMPLE_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_SIMPLE_TRUE@noinst_LTLIBRARIES = libsimple.la -@STATIC_SIMPLE_FALSE@libsimple_la_SOURCES = $(SIMPLESOURCES) -@STATIC_SIMPLE_TRUE@libsimple_la_SOURCES = $(SIMPLESOURCES) -@STATIC_SIMPLE_TRUE@libsimple_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SIMPLE_FALSE@pkg_LTLIBRARIES = libsimple.la -@STATIC_SIMPLE_FALSE@libsimple_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/simple/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/simple/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsimple.la: $(libsimple_la_OBJECTS) $(libsimple_la_DEPENDENCIES) - $(LINK) $(am_libsimple_la_rpath) $(libsimple_la_LDFLAGS) $(libsimple_la_OBJECTS) $(libsimple_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsimple_la-simple.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsimple_la-sipmsg.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsimple_la-simple.lo: simple.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -MT libsimple_la-simple.lo -MD -MP -MF "$(DEPDIR)/libsimple_la-simple.Tpo" -c -o libsimple_la-simple.lo `test -f 'simple.c' || echo '$(srcdir)/'`simple.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsimple_la-simple.Tpo" "$(DEPDIR)/libsimple_la-simple.Plo"; else rm -f "$(DEPDIR)/libsimple_la-simple.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='simple.c' object='libsimple_la-simple.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -c -o libsimple_la-simple.lo `test -f 'simple.c' || echo '$(srcdir)/'`simple.c - -libsimple_la-sipmsg.lo: sipmsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -MT libsimple_la-sipmsg.lo -MD -MP -MF "$(DEPDIR)/libsimple_la-sipmsg.Tpo" -c -o libsimple_la-sipmsg.lo `test -f 'sipmsg.c' || echo '$(srcdir)/'`sipmsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsimple_la-sipmsg.Tpo" "$(DEPDIR)/libsimple_la-sipmsg.Plo"; else rm -f "$(DEPDIR)/libsimple_la-sipmsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sipmsg.c' object='libsimple_la-sipmsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -c -o libsimple_la-sipmsg.lo `test -f 'sipmsg.c' || echo '$(srcdir)/'`sipmsg.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsimple -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libsimple -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = simple.c \ - sipmsg.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2154 +0,0 @@ -/** - * @file simple.c - * - * purple - * - * Copyright (C) 2005 Thomas Butter - * - * *** - * Thanks to Google's Summer of Code Program and the helpful mentors - * *** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "blist.h" -#include "conversation.h" -#include "dnsquery.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "plugin.h" -#include "util.h" -#include "version.h" -#include "network.h" -#include "xmlnode.h" - -#include "simple.h" -#include "sipmsg.h" -#include "dnssrv.h" -#include "ntlm.h" - -static char *gentag(void) { - return g_strdup_printf("%04d%04d", rand() & 0xFFFF, rand() & 0xFFFF); -} - -static char *genbranch(void) { - return g_strdup_printf("z9hG4bK%04X%04X%04X%04X%04X", - rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF, - rand() & 0xFFFF, rand() & 0xFFFF); -} - -static char *gencallid(void) { - return g_strdup_printf("%04Xg%04Xa%04Xi%04Xm%04Xt%04Xb%04Xx%04Xx", - rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF, - rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF, - rand() & 0xFFFF, rand() & 0xFFFF); -} - -static const char *simple_list_icon(PurpleAccount *a, PurpleBuddy *b) { - return "simple"; -} - -static void simple_keep_alive(PurpleConnection *gc) { - struct simple_account_data *sip = gc->proto_data; - if(sip->udp) { /* in case of UDP send a packet only with a 0 byte to - remain in the NAT table */ - gchar buf[2] = {0, 0}; - purple_debug_info("simple", "sending keep alive\n"); - sendto(sip->fd, buf, 1, 0, (struct sockaddr*)&sip->serveraddr, sizeof(struct sockaddr_in)); - } - return; -} - -static gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc); -static void send_notify(struct simple_account_data *sip, struct simple_watcher *); - -static void send_open_publish(struct simple_account_data *sip); -static void send_closed_publish(struct simple_account_data *sip); - -static void do_notifies(struct simple_account_data *sip) { - GSList *tmp = sip->watcher; - purple_debug_info("simple", "do_notifies()\n"); - if((sip->republish != -1) || sip->republish < time(NULL)) { - if(purple_account_get_bool(sip->account, "dopublish", TRUE)) { - send_open_publish(sip); - } - } - - while(tmp) { - purple_debug_info("simple", "notifying %s\n", ((struct simple_watcher*)tmp->data)->name); - send_notify(sip, tmp->data); - tmp = tmp->next; - } -} - -static void simple_set_status(PurpleAccount *account, PurpleStatus *status) { - PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); - struct simple_account_data *sip = NULL; - - if (!purple_status_is_active(status)) - return; - - if (account->gc) - sip = account->gc->proto_data; - - if (sip) - { - g_free(sip->status); - if (primitive == PURPLE_STATUS_AVAILABLE) - sip->status = g_strdup("available"); - else - sip->status = g_strdup("busy"); - - do_notifies(sip); - } -} - -static struct sip_connection *connection_find(struct simple_account_data *sip, int fd) { - struct sip_connection *ret = NULL; - GSList *entry = sip->openconns; - while(entry) { - ret = entry->data; - if(ret->fd == fd) return ret; - entry = entry->next; - } - return NULL; -} - -static struct simple_watcher *watcher_find(struct simple_account_data *sip, - const gchar *name) { - struct simple_watcher *watcher; - GSList *entry = sip->watcher; - while(entry) { - watcher = entry->data; - if(!strcmp(name, watcher->name)) return watcher; - entry = entry->next; - } - return NULL; -} - -static struct simple_watcher *watcher_create(struct simple_account_data *sip, - const gchar *name, const gchar *callid, const gchar *ourtag, - const gchar *theirtag, gboolean needsxpidf) { - struct simple_watcher *watcher = g_new0(struct simple_watcher, 1); - watcher->name = g_strdup(name); - watcher->dialog.callid = g_strdup(callid); - watcher->dialog.ourtag = g_strdup(ourtag); - watcher->dialog.theirtag = g_strdup(theirtag); - watcher->needsxpidf = needsxpidf; - sip->watcher = g_slist_append(sip->watcher, watcher); - return watcher; -} - -static void watcher_remove(struct simple_account_data *sip, const gchar *name) { - struct simple_watcher *watcher = watcher_find(sip, name); - sip->watcher = g_slist_remove(sip->watcher, watcher); - g_free(watcher->name); - g_free(watcher->dialog.callid); - g_free(watcher->dialog.ourtag); - g_free(watcher->dialog.theirtag); - g_free(watcher); -} - -static struct sip_connection *connection_create(struct simple_account_data *sip, int fd) { - struct sip_connection *ret = g_new0(struct sip_connection, 1); - ret->fd = fd; - sip->openconns = g_slist_append(sip->openconns, ret); - return ret; -} - -static void connection_remove(struct simple_account_data *sip, int fd) { - struct sip_connection *conn = connection_find(sip, fd); - sip->openconns = g_slist_remove(sip->openconns, conn); - if(conn->inputhandler) purple_input_remove(conn->inputhandler); - g_free(conn->inbuf); - g_free(conn); -} - -static void connection_free_all(struct simple_account_data *sip) { - struct sip_connection *ret = NULL; - GSList *entry = sip->openconns; - while(entry) { - ret = entry->data; - connection_remove(sip, ret->fd); - entry = sip->openconns; - } -} - -static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; - struct simple_buddy *b; - const char *name = purple_buddy_get_name(buddy); - if(strncmp(name, "sip:", 4)) { - gchar *buf = g_strdup_printf("sip:%s", name); - purple_blist_rename_buddy(buddy, buf); - g_free(buf); - } - if(!g_hash_table_lookup(sip->buddies, name)) { - b = g_new0(struct simple_buddy, 1); - purple_debug_info("simple", "simple_add_buddy %s\n", name); - b->name = g_strdup(name); - g_hash_table_insert(sip->buddies, b->name, b); - } else { - purple_debug_info("simple", "buddy %s already in internal list\n", name); - } -} - -static void simple_get_buddies(PurpleConnection *gc) { - GSList *buddies; - PurpleAccount *account; - - purple_debug_info("simple", "simple_get_buddies\n"); - - account = purple_connection_get_account(gc); - buddies = purple_find_buddies(account, NULL); - while (buddies) { - PurpleBuddy *buddy = buddies->data; - simple_add_buddy(gc, buddy, purple_buddy_get_group(buddy)); - - buddies = g_slist_delete_link(buddies, buddies); - } -} - -static void simple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - const char *name = purple_buddy_get_name(buddy); - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; - struct simple_buddy *b = g_hash_table_lookup(sip->buddies, name); - g_hash_table_remove(sip->buddies, name); - g_free(b->name); - g_free(b); -} - -static GList *simple_status_types(PurpleAccount *acc) { - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_full( - PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static gchar *auth_header(struct simple_account_data *sip, - struct sip_auth *auth, const gchar *method, const gchar *target) { - gchar noncecount[9]; - gchar *response; - gchar *ret; - gchar *tmp; - const char *authdomain; - const char *authuser; - - authdomain = purple_account_get_string(sip->account, "authdomain", ""); - authuser = purple_account_get_string(sip->account, "authuser", sip->username); - - if(!authuser || strlen(authuser) < 1) { - authuser = sip->username; - } - - if(auth->type == 1) { /* Digest */ - sprintf(noncecount, "%08d", auth->nc++); - response = purple_cipher_http_digest_calculate_response( - "md5", method, target, NULL, NULL, - auth->nonce, noncecount, NULL, auth->digest_session_key); - purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); - - ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); - g_free(response); - return ret; - } else if(auth->type == 2) { /* NTLM */ - if(auth->nc == 3 && auth->nonce) { - /* TODO: Don't hardcode "purple" as the hostname */ - ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags); - tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"", auth->opaque, auth->realm, auth->target, ret); - g_free(ret); - return tmp; - } - tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"", auth->realm, auth->target); - return tmp; - } - - sprintf(noncecount, "%08d", auth->nc++); - response = purple_cipher_http_digest_calculate_response( - "md5", method, target, NULL, NULL, - auth->nonce, noncecount, NULL, auth->digest_session_key); - purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); - - ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); - g_free(response); - return ret; -} - -static char *parse_attribute(const char *attrname, const char *source) { - const char *tmp, *tmp2; - char *retval = NULL; - int len = strlen(attrname); - - /* we know that source is NULL-terminated. - * Therefore this loop won't be infinite. - */ - while (source[0] == ' ') - source++; - - if(!strncmp(source, attrname, len)) { - tmp = source + len; - tmp2 = g_strstr_len(tmp, strlen(tmp), "\""); - if(tmp2) - retval = g_strndup(tmp, tmp2 - tmp); - else - retval = g_strdup(tmp); - } - - return retval; -} - -static void fill_auth(struct simple_account_data *sip, const gchar *hdr, struct sip_auth *auth) { - int i = 0; - const char *authuser; - char *tmp; - gchar **parts; - - authuser = purple_account_get_string(sip->account, "authuser", sip->username); - - if(!authuser || strlen(authuser) < 1) { - authuser = sip->username; - } - - if(!hdr) { - purple_debug_error("simple", "fill_auth: hdr==NULL\n"); - return; - } - - if(!g_ascii_strncasecmp(hdr, "NTLM", 4)) { - purple_debug_info("simple", "found NTLM\n"); - auth->type = 2; - parts = g_strsplit(hdr+5, "\",", 0); - i = 0; - while(parts[i]) { - purple_debug_info("simple", "parts[i] %s\n", parts[i]); - if((tmp = parse_attribute("gssapi-data=\"", parts[i]))) { - auth->nonce = g_memdup(purple_ntlm_parse_type2(tmp, &auth->flags), 8); - g_free(tmp); - } - if((tmp = parse_attribute("targetname=\"", - parts[i]))) { - auth->target = tmp; - } - else if((tmp = parse_attribute("realm=\"", - parts[i]))) { - auth->realm = tmp; - } - else if((tmp = parse_attribute("opaque=\"", parts[i]))) { - auth->opaque = tmp; - } - i++; - } - g_strfreev(parts); - auth->nc = 1; - if(!strstr(hdr, "gssapi-data")) { - auth->nc = 1; - } else { - auth->nc = 3; - } - - return; - } else if(!g_ascii_strncasecmp(hdr, "DIGEST", 6)) { - - purple_debug_info("simple", "found DIGEST\n"); - - auth->type = 1; - parts = g_strsplit(hdr+7, ",", 0); - while(parts[i]) { - if((tmp = parse_attribute("nonce=\"", parts[i]))) { - auth->nonce = tmp; - } - else if((tmp = parse_attribute("realm=\"", parts[i]))) { - auth->realm = tmp; - } - i++; - } - g_strfreev(parts); - purple_debug(PURPLE_DEBUG_MISC, "simple", "nonce: %s realm: %s\n", - auth->nonce ? auth->nonce : "(null)", - auth->realm ? auth->realm : "(null)"); - - if(auth->realm) { - auth->digest_session_key = purple_cipher_http_digest_calculate_session_key( - "md5", authuser, auth->realm, sip->password, auth->nonce, NULL); - - auth->nc = 1; - } - - } else { - purple_debug_error("simple", "Unsupported or bad WWW-Authenticate header (%s).\n", hdr); - } - -} - -static void simple_canwrite_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - gsize max_write; - gssize written; - - max_write = purple_circ_buffer_get_max_read(sip->txbuf); - - if(max_write == 0) { - purple_input_remove(sip->tx_handler); - sip->tx_handler = 0; - return; - } - - written = write(sip->fd, sip->txbuf->outptr, max_write); - - if(written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - /*TODO: do we really want to disconnect on a failure to write?*/ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(sip->txbuf, written); -} - -static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond); - -static void send_later_cb(gpointer data, gint source, const gchar *error_message) { - PurpleConnection *gc = data; - struct simple_account_data *sip; - struct sip_connection *conn; - - if(source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - sip = gc->proto_data; - sip->fd = source; - sip->connecting = FALSE; - - simple_canwrite_cb(gc, sip->fd, PURPLE_INPUT_WRITE); - - /* If there is more to write now, we need to register a handler */ - if(sip->txbuf->bufused > 0) - sip->tx_handler = purple_input_add(sip->fd, PURPLE_INPUT_WRITE, - simple_canwrite_cb, gc); - - conn = connection_create(sip, source); - conn->inputhandler = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_input_cb, gc); -} - - -static void sendlater(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; - - if(!sip->connecting) { - purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); - if (purple_proxy_connect(gc, sip->account, sip->realhostname, sip->realport, send_later_cb, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - } - sip->connecting = TRUE; - } - - if(purple_circ_buffer_get_max_read(sip->txbuf) > 0) - purple_circ_buffer_append(sip->txbuf, "\r\n", 2); - - purple_circ_buffer_append(sip->txbuf, buf, strlen(buf)); -} - -static void sendout_pkt(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; - time_t currtime = time(NULL); - int writelen = strlen(buf); - - purple_debug(PURPLE_DEBUG_MISC, "simple", "\n\nsending - %s\n######\n%s\n######\n\n", ctime(&currtime), buf); - if(sip->udp) { - if(sendto(sip->fd, buf, writelen, 0, (struct sockaddr*)&sip->serveraddr, sizeof(struct sockaddr_in)) < writelen) { - purple_debug_info("simple", "could not send packet\n"); - } - } else { - int ret; - if(sip->fd < 0) { - sendlater(gc, buf); - return; - } - - if(sip->tx_handler) { - ret = -1; - errno = EAGAIN; - } else - ret = write(sip->fd, buf, writelen); - - if (ret < 0 && errno == EAGAIN) - ret = 0; - else if(ret <= 0) { /* XXX: When does this happen legitimately? */ - sendlater(gc, buf); - return; - } - - if (ret < writelen) { - if(!sip->tx_handler) - sip->tx_handler = purple_input_add(sip->fd, - PURPLE_INPUT_WRITE, simple_canwrite_cb, - gc); - - /* XXX: is it OK to do this? You might get part of a request sent - with part of another. */ - if(sip->txbuf->bufused > 0) - purple_circ_buffer_append(sip->txbuf, "\r\n", 2); - - purple_circ_buffer_append(sip->txbuf, buf + ret, - writelen - ret); - } - } -} - -static int simple_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - sendout_pkt(gc, buf); - return len; -} - -static void sendout_sipmsg(struct simple_account_data *sip, struct sipmsg *msg) { - GSList *tmp = msg->headers; - gchar *name; - gchar *value; - GString *outstr = g_string_new(""); - g_string_append_printf(outstr, "%s %s SIP/2.0\r\n", msg->method, msg->target); - while(tmp) { - name = ((struct siphdrelement*) (tmp->data))->name; - value = ((struct siphdrelement*) (tmp->data))->value; - g_string_append_printf(outstr, "%s: %s\r\n", name, value); - tmp = g_slist_next(tmp); - } - g_string_append_printf(outstr, "\r\n%s", msg->body ? msg->body : ""); - sendout_pkt(sip->gc, outstr->str); - g_string_free(outstr, TRUE); -} - -static void send_sip_response(PurpleConnection *gc, struct sipmsg *msg, int code, - const char *text, const char *body) { - GSList *tmp = msg->headers; - gchar *name; - gchar *value; - GString *outstr = g_string_new(""); - - /* When sending the acknowlegements and errors, the content length from the original - message is still here, but there is no body; we need to make sure we're sending the - correct content length */ - sipmsg_remove_header(msg, "Content-Length"); - if(body) { - gchar len[12]; - sprintf(len, "%" G_GSIZE_FORMAT , strlen(body)); - sipmsg_add_header(msg, "Content-Length", len); - } - else - sipmsg_add_header(msg, "Content-Length", "0"); - g_string_append_printf(outstr, "SIP/2.0 %d %s\r\n", code, text); - while(tmp) { - name = ((struct siphdrelement*) (tmp->data))->name; - value = ((struct siphdrelement*) (tmp->data))->value; - - g_string_append_printf(outstr, "%s: %s\r\n", name, value); - tmp = g_slist_next(tmp); - } - g_string_append_printf(outstr, "\r\n%s", body ? body : ""); - sendout_pkt(gc, outstr->str); - g_string_free(outstr, TRUE); -} - -static void transactions_remove(struct simple_account_data *sip, struct transaction *trans) { - if(trans->msg) sipmsg_free(trans->msg); - sip->transactions = g_slist_remove(sip->transactions, trans); - g_free(trans); -} - -static void transactions_add_buf(struct simple_account_data *sip, const gchar *buf, void *callback) { - struct transaction *trans = g_new0(struct transaction, 1); - trans->time = time(NULL); - trans->msg = sipmsg_parse_msg(buf); - trans->cseq = sipmsg_find_header(trans->msg, "CSeq"); - trans->callback = callback; - sip->transactions = g_slist_append(sip->transactions, trans); -} - -static struct transaction *transactions_find(struct simple_account_data *sip, struct sipmsg *msg) { - struct transaction *trans; - GSList *transactions = sip->transactions; - const gchar *cseq = sipmsg_find_header(msg, "CSeq"); - - if (cseq) { - while(transactions) { - trans = transactions->data; - if(!strcmp(trans->cseq, cseq)) { - return trans; - } - transactions = transactions->next; - } - } else { - purple_debug(PURPLE_DEBUG_MISC, "simple", "Received message contains no CSeq header.\n"); - } - - return NULL; -} - -static void send_sip_request(PurpleConnection *gc, const gchar *method, - const gchar *url, const gchar *to, const gchar *addheaders, - const gchar *body, struct sip_dialog *dialog, TransCallback tc) { - struct simple_account_data *sip = gc->proto_data; - char *callid = dialog ? g_strdup(dialog->callid) : gencallid(); - char *auth = NULL; - const char *addh = ""; - gchar *branch = genbranch(); - gchar *tag = NULL; - char *buf; - - if(!strcmp(method, "REGISTER")) { - if(sip->regcallid) { - g_free(callid); - callid = g_strdup(sip->regcallid); - } - else sip->regcallid = g_strdup(callid); - } - - if(addheaders) addh = addheaders; - if(sip->registrar.type && !strcmp(method, "REGISTER")) { - buf = auth_header(sip, &sip->registrar, method, url); - auth = g_strdup_printf("Authorization: %s\r\n", buf); - g_free(buf); - purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); - } else if(sip->proxy.type && strcmp(method, "REGISTER")) { - buf = auth_header(sip, &sip->proxy, method, url); - auth = g_strdup_printf("Proxy-Authorization: %s\r\n", buf); - g_free(buf); - purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); - } - - if (!dialog) - tag = gentag(); - - buf = g_strdup_printf("%s %s SIP/2.0\r\n" - "Via: SIP/2.0/%s %s:%d;branch=%s\r\n" - /* Don't know what epid is, but LCS wants it */ - "From: ;tag=%s;epid=1234567890\r\n" - "To: <%s>%s%s\r\n" - "Max-Forwards: 10\r\n" - "CSeq: %d %s\r\n" - "User-Agent: Purple/" VERSION "\r\n" - "Call-ID: %s\r\n" - "%s%s" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%s", - method, - url, - sip->udp ? "UDP" : "TCP", - purple_network_get_my_ip(-1), - sip->listenport, - branch, - sip->username, - sip->servername, - dialog ? dialog->ourtag : tag, - to, - dialog ? ";tag=" : "", - dialog ? dialog->theirtag : "", - ++sip->cseq, - method, - callid, - auth ? auth : "", - addh, - strlen(body), - body); - - g_free(tag); - g_free(auth); - g_free(branch); - g_free(callid); - - /* add to ongoing transactions */ - - transactions_add_buf(sip, buf, tc); - - sendout_pkt(gc, buf); - - g_free(buf); -} - -static char *get_contact(struct simple_account_data *sip) { - return g_strdup_printf(";methods=\"MESSAGE, SUBSCRIBE, NOTIFY\"", - sip->username, purple_network_get_my_ip(-1), - sip->listenport, - sip->udp ? "udp" : "tcp"); -} - -static void do_register_exp(struct simple_account_data *sip, int expire) { - char *uri, *to, *contact, *hdr; - - sip->reregister = time(NULL) + expire - 50; - - uri = g_strdup_printf("sip:%s", sip->servername); - to = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - contact = get_contact(sip); - hdr = g_strdup_printf("Contact: %s\r\nExpires: %d\r\n", contact, expire); - g_free(contact); - - sip->registerstatus = SIMPLE_REGISTER_SENT; - - send_sip_request(sip->gc, "REGISTER", uri, to, hdr, "", NULL, - process_register_response); - - g_free(hdr); - g_free(uri); - g_free(to); -} - -static void do_register(struct simple_account_data *sip) { - do_register_exp(sip, sip->registerexpire); -} - -static gchar *parse_from(const gchar *hdr) { - gchar *from; - const gchar *tmp, *tmp2 = hdr; - - if(!hdr) return NULL; - purple_debug_info("simple", "parsing address out of %s\n", hdr); - tmp = strchr(hdr, '<'); - - /* i hate the different SIP UA behaviours... */ - if(tmp) { /* sip address in <...> */ - tmp2 = tmp + 1; - tmp = strchr(tmp2, '>'); - if(tmp) { - from = g_strndup(tmp2, tmp - tmp2); - } else { - purple_debug_info("simple", "found < without > in From\n"); - return NULL; - } - } else { - tmp = strchr(tmp2, ';'); - if(tmp) { - from = g_strndup(tmp2, tmp - tmp2); - } else { - from = g_strdup(tmp2); - } - } - purple_debug_info("simple", "got %s\n", from); - return from; -} -static gchar *find_tag(const gchar *); - -static gboolean process_subscribe_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - gchar *to = NULL; - struct simple_buddy *b = NULL; - gchar *theirtag = NULL, *ourtag = NULL; - const gchar *callid = NULL; - - purple_debug_info("simple", "process subscribe response\n"); - - if(msg->response == 200 || msg->response == 202) { - if ( (to = parse_from(sipmsg_find_header(msg, "To"))) && - (b = g_hash_table_lookup(sip->buddies, to)) && - !(b->dialog)) - { - purple_debug_info("simple", "creating dialog" - " information for a subscription.\n"); - - theirtag = find_tag(sipmsg_find_header(msg, "To")); - ourtag = find_tag(sipmsg_find_header(msg, "From")); - callid = sipmsg_find_header(msg, "Call-ID"); - - if (theirtag && ourtag && callid) - { - b->dialog = g_new0(struct sip_dialog, 1); - b->dialog->ourtag = g_strdup(ourtag); - b->dialog->theirtag = g_strdup(theirtag); - b->dialog->callid = g_strdup(callid); - - purple_debug_info("simple", "ourtag: %s\n", - ourtag); - purple_debug_info("simple", "theirtag: %s\n", - theirtag); - purple_debug_info("simple", "callid: %s\n", - callid); - g_free(theirtag); - g_free(ourtag); - } - } - else - { - purple_debug_info("simple", "cannot create dialog!\n"); - } - return TRUE; - } - - to = parse_from(sipmsg_find_header(tc->msg, "To")); /* cant be NULL since it is our own msg */ - - /* we can not subscribe -> user is offline (TODO unknown status?) */ - - purple_prpl_got_user_status(sip->account, to, "offline", NULL); - g_free(to); - return TRUE; -} - -static void simple_subscribe_exp(struct simple_account_data *sip, struct simple_buddy *buddy, int expiration) { - gchar *contact, *to, *tmp, *tmp2; - - tmp2 = g_strdup_printf( - "Expires: %d\r\n" - "Accept: application/pidf+xml, application/xpidf+xml\r\n" - "Event: presence\r\n", - expiration); - - if(strncmp(buddy->name, "sip:", 4)) - to = g_strdup_printf("sip:%s", buddy->name); - else - to = g_strdup(buddy->name); - - tmp = get_contact(sip); - contact = g_strdup_printf("%sContact: %s\r\n", tmp2, tmp); - g_free(tmp); - g_free(tmp2); - - send_sip_request(sip->gc, "SUBSCRIBE", to, to, contact,"",buddy->dialog, - (expiration > 0) ? process_subscribe_response : NULL); - - g_free(to); - g_free(contact); - - /* resubscribe before subscription expires */ - /* add some jitter */ - if (expiration > 60) - buddy->resubscribe = time(NULL) + (expiration - 60) + (rand() % 50); - else if (expiration > 0) - buddy->resubscribe = time(NULL) + ((int) (expiration / 2)); -} - -static void simple_subscribe(struct simple_account_data *sip, struct simple_buddy *buddy) { - simple_subscribe_exp(sip, buddy, SUBSCRIBE_EXPIRATION); -} - -static void simple_unsubscribe(char *name, struct simple_buddy *buddy, struct simple_account_data *sip) { - if (buddy->dialog) - { - purple_debug_info("simple", "Unsubscribing from %s\n", name); - simple_subscribe_exp(sip, buddy, 0); - } -} - -static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - const gchar *tmp; - xmlnode *item, *group, *isc; - const char *name_group; - PurpleBuddy *b; - PurpleGroup *g = NULL; - struct simple_buddy *bs; - int len = msg->bodylen; - - - tmp = sipmsg_find_header(msg, "Event"); - if(tmp && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){ - - purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len); - /*Convert the contact from XML to Purple Buddies*/ - isc = xmlnode_from_str(msg->body, len); - - /* ToDo. Find for all groups */ - if ((group = xmlnode_get_child(isc, "group"))) { - name_group = xmlnode_get_attrib(group, "name"); - purple_debug_info("simple", "name_group->%s\n", name_group); - g = purple_find_group(name_group); - if(!g) - g = purple_group_new(name_group); - } - - if (!g) { - g = purple_find_group("Buddies"); - if(!g) - g = purple_group_new("Buddies"); - } - - for(item = xmlnode_get_child(isc, "contact"); item; item = xmlnode_get_next_twin(item)) - { - const char *uri, *name, *groups; - char *buddy_name; - uri = xmlnode_get_attrib(item, "uri"); - name = xmlnode_get_attrib(item, "name"); - groups = xmlnode_get_attrib(item, "groups"); - purple_debug_info("simple", "URI->%s\n", uri); - - buddy_name = g_strdup_printf("sip:%s", uri); - - b = purple_find_buddy(sip->account, buddy_name); - if(!b){ - b = purple_buddy_new(sip->account, buddy_name, uri); - } - g_free(buddy_name); - - purple_blist_add_buddy(b, NULL, g, NULL); - purple_blist_alias_buddy(b, uri); - bs = g_new0(struct simple_buddy, 1); - bs->name = g_strdup(purple_buddy_get_name(b)); - g_hash_table_insert(sip->buddies, bs->name, bs); - } - xmlnode_free(isc); - } - return 0; -} - -static void simple_subscribe_buddylist(struct simple_account_data *sip) { - gchar *contact = "Event: vnd-microsoft-roaming-contacts\r\nAccept: application/vnd-microsoft-roaming-contacts+xml\r\nSupported: com.microsoft.autoextend\r\nSupported: ms-benotify\r\nProxy-Require: ms-benotify\r\nSupported: ms-piggyback-first-notify\r\n"; - gchar *to; - gchar *tmp; - to = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - - tmp = get_contact(sip); - - contact = g_strdup_printf("%sContact: %s\r\n", contact, tmp); - g_free(tmp); - - send_sip_request(sip->gc, "SUBSCRIBE", to, to, contact, "", NULL, simple_add_lcs_contacts); - - g_free(to); - g_free(contact); -} - - -static void simple_buddy_resub(char *name, struct simple_buddy *buddy, struct simple_account_data *sip) { - time_t curtime = time(NULL); - purple_debug_info("simple", "buddy resub\n"); - if(buddy->resubscribe < curtime) { - purple_debug(PURPLE_DEBUG_MISC, "simple", "simple_buddy_resub %s\n", name); - simple_subscribe(sip, buddy); - } -} - -static gboolean resend_timeout(struct simple_account_data *sip) { - GSList *tmp = sip->transactions; - time_t currtime = time(NULL); - while(tmp) { - struct transaction *trans = tmp->data; - tmp = tmp->next; - purple_debug_info("simple", "have open transaction age: %lu\n", currtime- trans->time); - if((currtime - trans->time > 5) && trans->retries >= 1) { - /* TODO 408 */ - } else { - if((currtime - trans->time > 2) && trans->retries == 0) { - trans->retries++; - sendout_sipmsg(sip, trans->msg); - } - } - } - return TRUE; -} - -static gboolean subscribe_timeout(struct simple_account_data *sip) { - GSList *tmp; - time_t curtime = time(NULL); - /* register again if first registration expires */ - if(sip->reregister < curtime) { - do_register(sip); - } - - /* publish status again if our last update is about to expire. */ - if (sip->republish != -1 && - sip->republish < curtime && - purple_account_get_bool(sip->account, "dopublish", TRUE)) - { - purple_debug_info("simple", "subscribe_timeout: republishing status.\n"); - send_open_publish(sip); - } - - /* check for every subscription if we need to resubscribe */ - g_hash_table_foreach(sip->buddies, (GHFunc)simple_buddy_resub, (gpointer)sip); - - /* remove a timed out suscriber */ - tmp = sip->watcher; - while(tmp) { - struct simple_watcher *watcher = tmp->data; - if(watcher->expire < curtime) { - watcher_remove(sip, watcher->name); - tmp = sip->watcher; - } - if(tmp) tmp = tmp->next; - } - - return TRUE; -} - -static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) { - gchar *hdr; - gchar *fullto; - if(strncmp(to, "sip:", 4)) - fullto = g_strdup_printf("sip:%s", to); - else - fullto = g_strdup(to); - - if(type) { - hdr = g_strdup_printf("Content-Type: %s\r\n", type); - } else { - hdr = g_strdup("Content-Type: text/plain\r\n"); - } - send_sip_request(sip->gc, "MESSAGE", fullto, fullto, hdr, msg, NULL, NULL); - g_free(hdr); - g_free(fullto); -} - -static int simple_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct simple_account_data *sip = gc->proto_data; - char *to = g_strdup(who); - char *text = purple_unescape_html(what); - simple_send_message(sip, to, text, NULL); - g_free(to); - g_free(text); - return 1; -} - -static void process_incoming_message(struct simple_account_data *sip, struct sipmsg *msg) { - gchar *from; - const gchar *contenttype; - gboolean found = FALSE; - - from = parse_from(sipmsg_find_header(msg, "From")); - - if(!from) return; - - purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body); - - contenttype = sipmsg_find_header(msg, "Content-Type"); - if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) { - serv_got_im(sip->gc, from, msg->body, 0, time(NULL)); - send_sip_response(sip->gc, msg, 200, "OK", NULL); - found = TRUE; - } - else if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) { - xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen); - xmlnode *state; - gchar *statedata; - - if(!isc) { - purple_debug_info("simple", "process_incoming_message: can not parse iscomposing\n"); - g_free(from); - return; - } - - state = xmlnode_get_child(isc, "state"); - - if(!state) { - purple_debug_info("simple", "process_incoming_message: no state found\n"); - xmlnode_free(isc); - g_free(from); - return; - } - - statedata = xmlnode_get_data(state); - if(statedata) { - if(strstr(statedata, "active")) - serv_got_typing(sip->gc, from, 0, PURPLE_TYPING); - else - serv_got_typing_stopped(sip->gc, from); - - g_free(statedata); - } - xmlnode_free(isc); - send_sip_response(sip->gc, msg, 200, "OK", NULL); - found = TRUE; - } - if(!found) { - purple_debug_info("simple", "got unknown mime-type\n"); - send_sip_response(sip->gc, msg, 415, "Unsupported media type", NULL); - } - g_free(from); -} - - -gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - const gchar *tmp; - purple_debug(PURPLE_DEBUG_MISC, "simple", "in process register response response: %d\n", msg->response); - switch (msg->response) { - case 200: - if(sip->registerstatus < SIMPLE_REGISTER_COMPLETE) { /* registered */ - if(purple_account_get_bool(sip->account, "dopublish", TRUE)) { - send_open_publish(sip); - } - } - sip->registerstatus = SIMPLE_REGISTER_COMPLETE; - purple_connection_set_state(sip->gc, PURPLE_CONNECTED); - - /* get buddies from blist */ - simple_get_buddies(sip->gc); - - subscribe_timeout(sip); - tmp = sipmsg_find_header(msg, "Allow-Events"); - if(tmp && strstr(tmp, "vnd-microsoft-provisioning")){ - simple_subscribe_buddylist(sip); - } - - break; - case 401: - if(sip->registerstatus != SIMPLE_REGISTER_RETRY) { - purple_debug_info("simple", "REGISTER retries %d\n", sip->registrar.retries); - if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - if (!purple_account_get_remember_password(sip->gc->account)) - purple_account_set_password(sip->gc->account, NULL); - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Incorrect password")); - return TRUE; - } - tmp = sipmsg_find_header(msg, "WWW-Authenticate"); - fill_auth(sip, tmp, &sip->registrar); - sip->registerstatus = SIMPLE_REGISTER_RETRY; - do_register(sip); - } - break; - default: - if (sip->registerstatus != SIMPLE_REGISTER_RETRY) { - purple_debug_info("simple", "Unrecognized return code for REGISTER.\n"); - if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unknown server response")); - return TRUE; - } - sip->registerstatus = SIMPLE_REGISTER_RETRY; - do_register(sip); - } - break; - } - return TRUE; -} - -static gboolean dialog_match(struct sip_dialog *dialog, struct sipmsg *msg) -{ - const gchar *fromhdr; - const gchar *tohdr; - const gchar *callid; - gchar *ourtag, *theirtag; - gboolean match = FALSE; - - fromhdr = sipmsg_find_header(msg, "From"); - tohdr = sipmsg_find_header(msg, "To"); - callid = sipmsg_find_header(msg, "Call-ID"); - - if (!fromhdr || !tohdr || !callid) - return FALSE; - - ourtag = find_tag(tohdr); - theirtag = find_tag(fromhdr); - - if (ourtag && theirtag && - !strcmp(dialog->callid, callid) && - !strcmp(dialog->ourtag, ourtag) && - !strcmp(dialog->theirtag, theirtag)) - match = TRUE; - - g_free(ourtag); - g_free(theirtag); - - return match; -} - -static void process_incoming_notify(struct simple_account_data *sip, struct sipmsg *msg) { - gchar *from; - const gchar *fromhdr; - gchar *basicstatus_data; - xmlnode *pidf; - xmlnode *basicstatus = NULL, *tuple, *status; - gboolean isonline = FALSE; - struct simple_buddy *b = NULL; - const gchar *sshdr = NULL; - - fromhdr = sipmsg_find_header(msg, "From"); - from = parse_from(fromhdr); - if(!from) return; - - b = g_hash_table_lookup(sip->buddies, from); - if (!b) - { - g_free(from); - purple_debug_info("simple", "Could not find the buddy.\n"); - return; - } - - if (b->dialog && !dialog_match(b->dialog, msg)) - { - /* We only accept notifies from people that - * we already have a dialog with. - */ - purple_debug_info("simple","No corresponding dialog for notify--discard\n"); - g_free(from); - return; - } - - pidf = xmlnode_from_str(msg->body, msg->bodylen); - - if(!pidf) { - purple_debug_info("simple", "process_incoming_notify: no parseable pidf\n"); - sshdr = sipmsg_find_header(msg, "Subscription-State"); - if (sshdr) - { - int i = 0; - gchar **ssparts = g_strsplit(sshdr, ":", 0); - while (ssparts[i]) - { - g_strchug(ssparts[i]); - if (purple_str_has_prefix(ssparts[i], "terminated")) - { - purple_debug_info("simple", "Subscription expired!"); - if (b->dialog) - { - g_free(b->dialog->ourtag); - g_free(b->dialog->theirtag); - g_free(b->dialog->callid); - g_free(b->dialog); - b->dialog = NULL; - } - - purple_prpl_got_user_status(sip->account, from, "offline", NULL); - break; - } - i++; - } - g_strfreev(ssparts); - } - send_sip_response(sip->gc, msg, 200, "OK", NULL); - g_free(from); - return; - } - - if ((tuple = xmlnode_get_child(pidf, "tuple"))) - if ((status = xmlnode_get_child(tuple, "status"))) - basicstatus = xmlnode_get_child(status, "basic"); - - if(!basicstatus) { - purple_debug_info("simple", "process_incoming_notify: no basic found\n"); - xmlnode_free(pidf); - g_free(from); - return; - } - - basicstatus_data = xmlnode_get_data(basicstatus); - - if(!basicstatus_data) { - purple_debug_info("simple", "process_incoming_notify: no basic data found\n"); - xmlnode_free(pidf); - g_free(from); - return; - } - - if(strstr(basicstatus_data, "open")) - isonline = TRUE; - - - if(isonline) - purple_prpl_got_user_status(sip->account, from, "available", NULL); - else - purple_prpl_got_user_status(sip->account, from, "offline", NULL); - - xmlnode_free(pidf); - g_free(from); - g_free(basicstatus_data); - - send_sip_response(sip->gc, msg, 200, "OK", NULL); -} - -static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { - struct simple_account_data *sip = gc->proto_data; - - gchar *xml = "\n" - "\n" - "%s\n" - "text/plain\n" - "60\n" - ""; - gchar *recv = g_strdup(name); - if(state == PURPLE_TYPING) { - gchar *msg = g_strdup_printf(xml, "active"); - simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); - g_free(msg); - } else /* TODO: Only if (state == PURPLE_TYPED) ? */ { - gchar *msg = g_strdup_printf(xml, "idle"); - simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); - g_free(msg); - } - g_free(recv); - /* - * TODO: Is this right? It will cause the core to call - * serv_send_typing(gc, who, PURPLE_TYPING) once every second - * until the user stops typing. If that's not desired, - * then return 0 instead. - */ - return 1; -} - -static gchar *find_tag(const gchar *hdr) { - const gchar *tmp = strstr(hdr, ";tag="), *tmp2; - - if(!tmp) return NULL; - tmp += 5; - if((tmp2 = strchr(tmp, ';'))) { - return g_strndup(tmp, tmp2 - tmp); - } - return g_strdup(tmp); -} - -static gchar* gen_xpidf(struct simple_account_data *sip) { - gchar *doc = g_strdup_printf("\n" - "\n" - "\n" - "\n" - "\n" - "

\n" - "\n" - "
\n" - "\n" - "\n", - sip->username, - sip->servername, - sip->username, - sip->servername, - sip->username, - sip->servername, - sip->status); - return doc; -} - -static gchar* gen_pidf(struct simple_account_data *sip, gboolean open) { - gchar *doc = g_strdup_printf("\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "%s\n" - "\n" - "", - sip->username, - sip->servername, - (open == TRUE) ? "open" : "closed", - (open == TRUE) ? sip->status : ""); - return doc; -} - -static void send_notify(struct simple_account_data *sip, struct simple_watcher *watcher) { - gchar *doc = watcher->needsxpidf ? gen_xpidf(sip) : gen_pidf(sip, TRUE); - gchar *hdr = watcher->needsxpidf ? "Event: presence\r\nContent-Type: application/xpidf+xml\r\n" : "Event: presence\r\nContent-Type: application/pidf+xml\r\n"; - send_sip_request(sip->gc, "NOTIFY", watcher->name, watcher->name, hdr, doc, &watcher->dialog, NULL); - g_free(doc); -} - -static gboolean process_publish_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - - const gchar *etag = NULL; - - if(msg->response != 200 && msg->response != 408) { - /* never send again */ - sip->republish = -1; - } - - etag = sipmsg_find_header(msg, "SIP-Etag"); - if (etag) { - /* we must store the etag somewhere. */ - g_free(sip->publish_etag); - sip->publish_etag = g_strdup(etag); - } - - return TRUE; -} - -static void send_open_publish(struct simple_account_data *sip) { - gchar *add_headers = NULL; - gchar *uri = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - gchar *doc = gen_pidf(sip, TRUE); - - add_headers = g_strdup_printf("%s%s%s%s%d\r\n%s", - sip->publish_etag ? "SIP-If-Match: " : "", - sip->publish_etag ? sip->publish_etag : "", - sip->publish_etag ? "\r\n" : "", - "Expires: ", PUBLISH_EXPIRATION, - "Event: presence\r\n" - "Content-Type: application/pidf+xml\r\n"); - - send_sip_request(sip->gc, "PUBLISH", uri, uri, - add_headers, doc, NULL, process_publish_response); - sip->republish = time(NULL) + PUBLISH_EXPIRATION - 50; - g_free(uri); - g_free(doc); - g_free(add_headers); -} - -static void send_closed_publish(struct simple_account_data *sip) { - gchar *uri = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - gchar *add_headers, *doc; - - add_headers = g_strdup_printf("%s%s%s%s", - sip->publish_etag ? "SIP-If-Match: " : "", - sip->publish_etag ? sip->publish_etag : "", - sip->publish_etag ? "\r\n" : "", - "Expires: 600\r\n" - "Event: presence\r\n" - "Content-Type: application/pidf+xml\r\n"); - - doc = gen_pidf(sip, FALSE); - send_sip_request(sip->gc, "PUBLISH", uri, uri, add_headers, - doc, NULL, process_publish_response); - /*sip->republish = time(NULL) + 500;*/ - g_free(uri); - g_free(doc); - g_free(add_headers); -} - -static void process_incoming_subscribe(struct simple_account_data *sip, struct sipmsg *msg) { - const char *from_hdr = sipmsg_find_header(msg, "From"); - gchar *from = parse_from(from_hdr); - gchar *theirtag = find_tag(from_hdr); - gchar *ourtag = find_tag(sipmsg_find_header(msg, "To")); - gboolean tagadded = FALSE; - const gchar *callid = sipmsg_find_header(msg, "Call-ID"); - const gchar *expire = sipmsg_find_header(msg, "Expire"); - gchar *tmp; - struct simple_watcher *watcher = watcher_find(sip, from); - if(!ourtag) { - tagadded = TRUE; - ourtag = gentag(); - } - if(!watcher) { /* new subscription */ - const gchar *acceptheader = sipmsg_find_header(msg, "Accept"); - gboolean needsxpidf = FALSE; - if(!purple_privacy_check(sip->account, from)) { - send_sip_response(sip->gc, msg, 202, "Ok", NULL); - goto privend; - } - if(acceptheader) { - const gchar *tmp = acceptheader; - gboolean foundpidf = FALSE; - gboolean foundxpidf = FALSE; - while(tmp && tmp < acceptheader + strlen(acceptheader)) { - gchar *tmp2 = strchr(tmp, ','); - if(tmp2) *tmp2 = '\0'; - if(!g_ascii_strcasecmp("application/pidf+xml", tmp)) - foundpidf = TRUE; - if(!g_ascii_strcasecmp("application/xpidf+xml", tmp)) - foundxpidf = TRUE; - if(tmp2) { - *tmp2 = ','; - tmp = tmp2 + 1; - while(*tmp == ' ') tmp++; - } else - tmp = 0; - } - if(!foundpidf && foundxpidf) needsxpidf = TRUE; - } - watcher = watcher_create(sip, from, callid, ourtag, theirtag, needsxpidf); - } - if(tagadded) { - gchar *to = g_strdup_printf("%s;tag=%s", sipmsg_find_header(msg, "To"), ourtag); - sipmsg_remove_header(msg, "To"); - sipmsg_add_header(msg, "To", to); - g_free(to); - } - if(expire) - watcher->expire = time(NULL) + strtol(expire, NULL, 10); - else - watcher->expire = time(NULL) + 600; - sipmsg_remove_header(msg, "Contact"); - tmp = get_contact(sip); - sipmsg_add_header(msg, "Contact", tmp); - g_free(tmp); - purple_debug_info("simple", "got subscribe: name %s ourtag %s theirtag %s callid %s\n", watcher->name, watcher->dialog.ourtag, watcher->dialog.theirtag, watcher->dialog.callid); - send_sip_response(sip->gc, msg, 200, "Ok", NULL); - send_notify(sip, watcher); -privend: - g_free(from); - g_free(theirtag); - g_free(ourtag); -} - -static void process_input_message(struct simple_account_data *sip, struct sipmsg *msg) { - gboolean found = FALSE; - if(msg->response == 0) { /* request */ - if(!strcmp(msg->method, "MESSAGE")) { - process_incoming_message(sip, msg); - found = TRUE; - } else if(!strcmp(msg->method, "NOTIFY")) { - process_incoming_notify(sip, msg); - found = TRUE; - } else if(!strcmp(msg->method, "SUBSCRIBE")) { - process_incoming_subscribe(sip, msg); - found = TRUE; - } else { - send_sip_response(sip->gc, msg, 501, "Not implemented", NULL); - } - } else { /* response */ - struct transaction *trans = transactions_find(sip, msg); - if(trans) { - if(msg->response == 407) { - gchar *resend, *auth; - const gchar *ptmp; - - if(sip->proxy.retries > 3) return; - sip->proxy.retries++; - /* do proxy authentication */ - - ptmp = sipmsg_find_header(msg, "Proxy-Authenticate"); - - fill_auth(sip, ptmp, &sip->proxy); - auth = auth_header(sip, &sip->proxy, trans->msg->method, trans->msg->target); - sipmsg_remove_header(trans->msg, "Proxy-Authorization"); - sipmsg_add_header(trans->msg, "Proxy-Authorization", auth); - g_free(auth); - resend = sipmsg_to_string(trans->msg); - /* resend request */ - sendout_pkt(sip->gc, resend); - g_free(resend); - } else { - if(msg->response == 100) { - /* ignore provisional response */ - purple_debug_info("simple", "got trying response\n"); - } else { - sip->proxy.retries = 0; - if(!strcmp(trans->msg->method, "REGISTER")) { - - /* This is encountered when a REGISTER request was ... - */ - if(msg->response == 401) { - /* denied until further authentication was provided. */ - sip->registrar.retries++; - } - else if (msg->response != 200) { - /* denied for some other reason! */ - sip->registrar.retries++; - } - else { - /* accepted! */ - sip->registrar.retries = 0; - } - } else { - if(msg->response == 401) { - /* This is encountered when a generic (MESSAGE, NOTIFY, etc) - * was denied until further authorization is provided. - */ - gchar *resend, *auth; - const gchar *ptmp; - - if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) return; - sip->registrar.retries++; - - ptmp = sipmsg_find_header(msg, "WWW-Authenticate"); - - fill_auth(sip, ptmp, &sip->registrar); - auth = auth_header(sip, &sip->registrar, trans->msg->method, trans->msg->target); - sipmsg_remove_header(trans->msg, "Authorization"); - sipmsg_add_header(trans->msg, "Authorization", auth); - g_free(auth); - resend = sipmsg_to_string(trans->msg); - /* resend request */ - sendout_pkt(sip->gc, resend); - g_free(resend); - } else { - /* Reset any count of retries that may have - * accumulated in the above branch. - */ - sip->registrar.retries = 0; - } - } - if(trans->callback) { - /* call the callback to process response*/ - (trans->callback)(sip, msg, trans); - } - transactions_remove(sip, trans); - } - } - found = TRUE; - } else { - purple_debug(PURPLE_DEBUG_MISC, "simple", "received response to unknown transaction"); - } - } - if(!found) { - purple_debug(PURPLE_DEBUG_MISC, "simple", "received a unknown sip message with method %s and response %d\n", msg->method, msg->response); - } -} - -static void process_input(struct simple_account_data *sip, struct sip_connection *conn) -{ - char *cur; - char *dummy; - struct sipmsg *msg; - int restlen; - cur = conn->inbuf; - - /* according to the RFC remove CRLF at the beginning */ - while(*cur == '\r' || *cur == '\n') { - cur++; - } - if(cur != conn->inbuf) { - memmove(conn->inbuf, cur, conn->inbufused - (cur - conn->inbuf)); - conn->inbufused = strlen(conn->inbuf); - } - - /* Received a full Header? */ - if((cur = strstr(conn->inbuf, "\r\n\r\n")) != NULL) { - time_t currtime = time(NULL); - cur += 2; - cur[0] = '\0'; - purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), conn->inbuf); - msg = sipmsg_parse_header(conn->inbuf); - - if(!msg) { - /* Should we re-use this error message (from lower in the function)? */ - purple_debug_misc("simple", "received a incomplete sip msg: %s\n", conn->inbuf); - return; - } - - cur[0] = '\r'; - cur += 2; - restlen = conn->inbufused - (cur - conn->inbuf); - if(restlen >= msg->bodylen) { - dummy = g_malloc(msg->bodylen + 1); - memcpy(dummy, cur, msg->bodylen); - dummy[msg->bodylen] = '\0'; - msg->body = dummy; - cur += msg->bodylen; - memmove(conn->inbuf, cur, conn->inbuflen - (cur - conn->inbuf)); - conn->inbufused = strlen(conn->inbuf); - } else { - sipmsg_free(msg); - return; - } - purple_debug(PURPLE_DEBUG_MISC, "simple", "in process response response: %d\n", msg->response); - process_input_message(sip, msg); - } else { - purple_debug(PURPLE_DEBUG_MISC, "simple", "received a incomplete sip msg: %s\n", conn->inbuf); - } -} - -static void simple_udp_process(gpointer data, gint source, PurpleInputCondition con) { - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - struct sipmsg *msg; - int len; - time_t currtime; - - static char buffer[65536]; - if((len = recv(source, buffer, sizeof(buffer) - 1, 0)) > 0) { - buffer[len] = '\0'; - purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), buffer); - msg = sipmsg_parse_msg(buffer); - if(msg) process_input_message(sip, msg); - } -} - -static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - int len; - struct sip_connection *conn = connection_find(sip, source); - if(!conn) { - purple_debug_error("simple", "Connection not found!\n"); - return; - } - - if(conn->inbuflen < conn->inbufused + SIMPLE_BUF_INC) { - conn->inbuflen += SIMPLE_BUF_INC; - conn->inbuf = g_realloc(conn->inbuf, conn->inbuflen); - } - - len = read(source, conn->inbuf + conn->inbufused, SIMPLE_BUF_INC - 1); - - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_debug_info("simple", "simple_input_cb: read error\n"); - connection_remove(sip, source); - if(sip->fd == source) sip->fd = -1; - return; - } - gc->last_received = time(NULL); - conn->inbufused += len; - conn->inbuf[conn->inbufused] = '\0'; - - process_input(sip, conn); -} - -/* Callback for new connections on incoming TCP port */ -static void simple_newconn_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - struct sip_connection *conn; - int newfd, flags; - - newfd = accept(source, NULL, NULL); - - flags = fcntl(newfd, F_GETFL); - fcntl(newfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(newfd, F_SETFD, FD_CLOEXEC); -#endif - - conn = connection_create(sip, newfd); - - conn->inputhandler = purple_input_add(newfd, PURPLE_INPUT_READ, simple_input_cb, gc); -} - -static void login_cb(gpointer data, gint source, const gchar *error_message) { - PurpleConnection *gc = data; - struct simple_account_data *sip; - struct sip_connection *conn; - - if(source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - sip = gc->proto_data; - sip->fd = source; - - conn = connection_create(sip, source); - - sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip); - - do_register(sip); - - conn->inputhandler = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_input_cb, gc); -} - -static guint simple_ht_hash_nick(const char *nick) { - char *lc = g_utf8_strdown(nick, -1); - guint bucket = g_str_hash(lc); - g_free(lc); - - return bucket; -} - -static gboolean simple_ht_equals_nick(const char *nick1, const char *nick2) { - return (purple_utf8_strcasecmp(nick1, nick2) == 0); -} - -static void simple_udp_host_resolved_listen_cb(int listenfd, gpointer data) { - struct simple_account_data *sip = (struct simple_account_data*) data; - - sip->listen_data = NULL; - - if(listenfd == -1) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } - - sip->fd = listenfd; - - sip->listenport = purple_network_get_port_from_fd(sip->fd); - sip->listenfd = sip->fd; - - sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc); - - sip->resendtimeout = purple_timeout_add(2500, (GSourceFunc) resend_timeout, sip); - sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip); - do_register(sip); -} - -static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *error_message) { - struct simple_account_data *sip = (struct simple_account_data*) data; - int addr_size; - - sip->query_data = NULL; - - if (!hosts || !hosts->data) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to resolve hostname")); - return; - } - - addr_size = GPOINTER_TO_INT(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - memcpy(&(sip->serveraddr), hosts->data, addr_size); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM, - simple_udp_host_resolved_listen_cb, sip); - if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } -} - -static void -simple_tcp_connect_listen_cb(int listenfd, gpointer data) { - struct simple_account_data *sip = (struct simple_account_data*) data; - - sip->listen_data = NULL; - - sip->listenfd = listenfd; - if(sip->listenfd == -1) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } - - purple_debug_info("simple", "listenfd: %d\n", sip->listenfd); - sip->listenport = purple_network_get_port_from_fd(sip->listenfd); - sip->listenpa = purple_input_add(sip->listenfd, PURPLE_INPUT_READ, - simple_newconn_cb, sip->gc); - purple_debug_info("simple", "connecting to %s port %d\n", - sip->realhostname, sip->realport); - /* open tcp connection to the server */ - if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname, - sip->realport, login_cb, sip->gc) == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } -} - -static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { - struct simple_account_data *sip; - gchar *hostname; - int port; - - sip = data; - sip->srv_query_data = NULL; - - port = purple_account_get_int(sip->account, "port", 0); - - /* find the host to connect to */ - if(results) { - hostname = g_strdup(resp->hostname); - if(!port) - port = resp->port; - g_free(resp); - } else { - if(!purple_account_get_bool(sip->account, "useproxy", FALSE)) { - hostname = g_strdup(sip->servername); - } else { - hostname = g_strdup(purple_account_get_string(sip->account, "proxy", sip->servername)); - } - } - - sip->realhostname = hostname; - sip->realport = port; - if(!sip->realport) sip->realport = 5060; - - /* TCP case */ - if(!sip->udp) { - /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, - simple_tcp_connect_listen_cb, sip); - if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } - } else { /* UDP */ - purple_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - - sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); - if (sip->query_data == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to resolve hostname")); - } - } -} - -static void simple_login(PurpleAccount *account) -{ - PurpleConnection *gc; - struct simple_account_data *sip; - gchar **userserver; - const gchar *hosttoconnect; - - const char *username = purple_account_get_username(account); - gc = purple_account_get_connection(account); - - if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("SIP usernames may not contain whitespaces or @ symbols")); - return; - } - - gc->proto_data = sip = g_new0(struct simple_account_data, 1); - sip->gc = gc; - sip->account = account; - sip->registerexpire = 900; - sip->udp = purple_account_get_bool(account, "udp", FALSE); - /* TODO: is there a good default grow size? */ - if(!sip->udp) - sip->txbuf = purple_circ_buffer_new(0); - - userserver = g_strsplit(username, "@", 2); - if (userserver[1] == NULL || userserver[1][0] == '\0') { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("SIP connect server not specified")); - return; - } - - purple_connection_set_display_name(gc, userserver[0]); - sip->username = g_strdup(userserver[0]); - sip->servername = g_strdup(userserver[1]); - sip->password = g_strdup(purple_connection_get_password(gc)); - g_strfreev(userserver); - - sip->buddies = g_hash_table_new((GHashFunc)simple_ht_hash_nick, (GEqualFunc)simple_ht_equals_nick); - - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - - /* TODO: Set the status correctly. */ - sip->status = g_strdup("available"); - - if(!purple_account_get_bool(account, "useproxy", FALSE)) { - hosttoconnect = sip->servername; - } else { - hosttoconnect = purple_account_get_string(account, "proxy", sip->servername); - } - - sip->srv_query_data = purple_srv_resolve("sip", - sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip); -} - -static void simple_close(PurpleConnection *gc) -{ - struct simple_account_data *sip = gc->proto_data; - - if(sip) { - /* unregister */ - if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE) - { - g_hash_table_foreach(sip->buddies, - (GHFunc)simple_unsubscribe, - (gpointer)sip); - - if(purple_account_get_bool(sip->account, - "dopublish", TRUE)) - send_closed_publish(sip); - - do_register_exp(sip, 0); - } - connection_free_all(sip); - - if (sip->query_data != NULL) - purple_dnsquery_destroy(sip->query_data); - - if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); - - if (sip->listen_data != NULL) - purple_network_listen_cancel(sip->listen_data); - - g_free(sip->servername); - g_free(sip->username); - g_free(sip->password); - g_free(sip->registrar.nonce); - g_free(sip->registrar.opaque); - g_free(sip->registrar.target); - g_free(sip->registrar.realm); - g_free(sip->registrar.digest_session_key); - g_free(sip->proxy.nonce); - g_free(sip->proxy.opaque); - g_free(sip->proxy.target); - g_free(sip->proxy.realm); - g_free(sip->proxy.digest_session_key); - g_free(sip->publish_etag); - if(sip->txbuf) - purple_circ_buffer_destroy(sip->txbuf); - g_free(sip->realhostname); - if(sip->listenpa) purple_input_remove(sip->listenpa); - if(sip->tx_handler) purple_input_remove(sip->tx_handler); - if(sip->resendtimeout) purple_timeout_remove(sip->resendtimeout); - if(sip->registertimeout) purple_timeout_remove(sip->registertimeout); - } - g_free(gc->proto_data); - gc->proto_data = NULL; -} - -static PurplePluginProtocolInfo prpl_info = -{ - 0, - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec */ - simple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - NULL, /* status_text */ - NULL, /* tooltip_text */ - simple_status_types, /* away_states */ - NULL, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - simple_login, /* login */ - simple_close, /* close */ - simple_im_send, /* send_im */ - NULL, /* set_info */ - simple_typing, /* send_typing */ - NULL, /* get_info */ - simple_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - simple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - simple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - simple_keep_alive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - simple_send_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-simple", /**< id */ - "SIMPLE", /**< name */ - DISPLAY_VERSION, /**< version */ - N_("SIP/SIMPLE Protocol Plugin"), /** summary */ - N_("The SIP/SIMPLE Protocol Plugin"), /** description */ - "Thomas Butter ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void _init_plugin(PurplePlugin *plugin) -{ - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - split = purple_account_user_split_new(_("Server"), "", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_bool_new(_("Publish status (note: everyone may watch you)"), "dopublish", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Connect port"), "port", 0); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use UDP"), "udp", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Use proxy"), "useproxy", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("Proxy"), "proxy", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("Auth User"), "authuser", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("Auth Domain"), "authdomain", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -} - -PURPLE_INIT_PLUGIN(simple, _init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/simple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ -/** - * @file simple.h - * - * purple - * - * Copyright (C) 2005, Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_SIMPLE_H -#define _PURPLE_SIMPLE_H - -#include -#include - -#include "cipher.h" -#include "circbuffer.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "network.h" -#include "proxy.h" -#include "prpl.h" - -#include "sipmsg.h" - -#define SIMPLE_BUF_INC 1024 -#define SIMPLE_REGISTER_RETRY_MAX 2 - -#define SIMPLE_REGISTER_SENT 1 -#define SIMPLE_REGISTER_RETRY 2 -#define SIMPLE_REGISTER_COMPLETE 3 - -#define PUBLISH_EXPIRATION 600 -#define SUBSCRIBE_EXPIRATION 1200 - -struct sip_dialog { - gchar *ourtag; - gchar *theirtag; - gchar *callid; -}; - -struct simple_watcher { - gchar *name; - time_t expire; - struct sip_dialog dialog; - gboolean needsxpidf; -}; - -struct simple_buddy { - gchar *name; - time_t resubscribe; - struct sip_dialog *dialog; -}; - -struct sip_auth { - int type; /* 1 = Digest / 2 = NTLM */ - gchar *nonce; - gchar *opaque; - gchar *realm; - gchar *target; - guint32 flags; - int nc; - gchar *digest_session_key; - int retries; -}; - -struct simple_account_data { - PurpleConnection *gc; - gchar *servername; - gchar *username; - gchar *password; - PurpleDnsQueryData *query_data; - PurpleSrvQueryData *srv_query_data; - PurpleNetworkListenData *listen_data; - int fd; - int cseq; - time_t reregister; - time_t republish; - int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */ - struct sip_auth registrar; - struct sip_auth proxy; - int listenfd; - int listenport; - int listenpa; - gchar *status; - GHashTable *buddies; - guint registertimeout; - guint resendtimeout; - gboolean connecting; - PurpleAccount *account; - PurpleCircBuffer *txbuf; - guint tx_handler; - gchar *regcallid; - GSList *transactions; - GSList *watcher; - GSList *openconns; - gboolean udp; - struct sockaddr_in serveraddr; - int registerexpire; - gchar *realhostname; - int realport; /* port and hostname from SRV record */ - gchar *publish_etag; -}; - -struct sip_connection { - int fd; - gchar *inbuf; - int inbuflen; - int inbufused; - int inputhandler; -}; - -struct transaction; - -typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *); - -struct transaction { - time_t time; - int retries; - int transport; /* 0 = tcp, 1 = udp */ - int fd; - const gchar *cseq; - struct sipmsg *msg; - TransCallback callback; -}; - -#endif /* _PURPLE_SIMPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,222 +0,0 @@ -/** - * @file sipmsg.c - * - * purple - * - * Copyright (C) 2005 Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "plugin.h" -#include "util.h" -#include "version.h" - -#include "simple.h" -#include "sipmsg.h" - -struct sipmsg *sipmsg_parse_msg(const gchar *msg) { - const char *tmp = strstr(msg, "\r\n\r\n"); - char *line; - struct sipmsg *smsg; - - if(!tmp) return NULL; - - line = g_strndup(msg, tmp - msg); - - smsg = sipmsg_parse_header(line); - if(smsg != NULL) - smsg->body = g_strdup(tmp + 4); - else - purple_debug_error("SIMPLE", "No header parsed from line: %s\n", line); - - g_free(line); - return smsg; -} - -struct sipmsg *sipmsg_parse_header(const gchar *header) { - struct sipmsg *msg = g_new0(struct sipmsg,1); - gchar **parts, **lines = g_strsplit(header,"\r\n",0); - gchar *dummy, *dummy2, *tmp; - const gchar *tmp2; - int i = 1; - - if(!lines[0]) { - g_strfreev(lines); - g_free(msg); - return NULL; - } - - parts = g_strsplit(lines[0], " ", 3); - if(!parts[0] || !parts[1] || !parts[2]) { - g_strfreev(parts); - g_strfreev(lines); - g_free(msg); - return NULL; - } - - if(strstr(parts[0],"SIP")) { /* numeric response */ - msg->method = g_strdup(parts[2]); - msg->response = strtol(parts[1],NULL,10); - } else { /* request */ - msg->method = g_strdup(parts[0]); - msg->target = g_strdup(parts[1]); - msg->response = 0; - } - g_strfreev(parts); - - for(i=1; lines[i] && strlen(lines[i])>2; i++) { - parts = g_strsplit(lines[i], ":", 2); - if(!parts[0] || !parts[1]) { - g_strfreev(parts); - g_strfreev(lines); - g_free(msg); - return NULL; - } - dummy = parts[1]; - dummy2 = 0; - while(*dummy==' ' || *dummy=='\t') dummy++; - dummy2 = g_strdup(dummy); - while(lines[i+1] && (lines[i+1][0]==' ' || lines[i+1][0]=='\t')) { - i++; - dummy = lines[i]; - while(*dummy==' ' || *dummy=='\t') dummy++; - tmp = g_strdup_printf("%s %s",dummy2, dummy); - g_free(dummy2); - dummy2 = tmp; - } - sipmsg_add_header(msg, parts[0], dummy2); - g_strfreev(parts); - } - g_strfreev(lines); - - tmp2 = sipmsg_find_header(msg, "Content-Length"); - if (tmp2 != NULL) - msg->bodylen = strtol(tmp2, NULL, 10); - - if(msg->response) { - tmp2 = sipmsg_find_header(msg, "CSeq"); - if(!tmp2) { - /* SHOULD NOT HAPPEN */ - msg->method = 0; - } else { - parts = g_strsplit(tmp2, " ", 2); - msg->method = g_strdup(parts[1]); - g_strfreev(parts); - } - } - - return msg; -} - -void sipmsg_print(const struct sipmsg *msg) { - GSList *cur; - struct siphdrelement *elem; - purple_debug(PURPLE_DEBUG_MISC, "simple", "SIP MSG\n"); - purple_debug(PURPLE_DEBUG_MISC, "simple", "response: %d\nmethod: %s\nbodylen: %d\n",msg->response,msg->method,msg->bodylen); - if(msg->target) purple_debug(PURPLE_DEBUG_MISC, "simple", "target: %s\n",msg->target); - cur = msg->headers; - while(cur) { - elem = cur->data; - purple_debug(PURPLE_DEBUG_MISC, "simple", "name: %s value: %s\n",elem->name, elem->value); - cur = g_slist_next(cur); - } -} - -char *sipmsg_to_string(const struct sipmsg *msg) { - GSList *cur; - GString *outstr = g_string_new(""); - struct siphdrelement *elem; - - if(msg->response) - g_string_append_printf(outstr, "SIP/2.0 %d Unknown\r\n", - msg->response); - else - g_string_append_printf(outstr, "%s %s SIP/2.0\r\n", - msg->method, msg->target); - - cur = msg->headers; - while(cur) { - elem = cur->data; - g_string_append_printf(outstr, "%s: %s\r\n", elem->name, - elem->value); - cur = g_slist_next(cur); - } - - g_string_append_printf(outstr, "\r\n%s", msg->bodylen ? msg->body : ""); - - return g_string_free(outstr, FALSE); -} -void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value) { - struct siphdrelement *element = g_new0(struct siphdrelement,1); - element->name = g_strdup(name); - element->value = g_strdup(value); - msg->headers = g_slist_append(msg->headers, element); -} - -void sipmsg_free(struct sipmsg *msg) { - struct siphdrelement *elem; - while(msg->headers) { - elem = msg->headers->data; - msg->headers = g_slist_remove(msg->headers,elem); - g_free(elem->name); - g_free(elem->value); - g_free(elem); - } - g_free(msg->method); - g_free(msg->target); - g_free(msg->body); - g_free(msg); -} - -void sipmsg_remove_header(struct sipmsg *msg, const gchar *name) { - struct siphdrelement *elem; - GSList *tmp = msg->headers; - while(tmp) { - elem = tmp->data; - if(g_ascii_strcasecmp(elem->name, name)==0) { - msg->headers = g_slist_remove(msg->headers, elem); - g_free(elem->name); - g_free(elem->value); - g_free(elem); - return; - } - tmp = g_slist_next(tmp); - } - return; -} - -const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name) { - GSList *tmp; - struct siphdrelement *elem; - tmp = msg->headers; - while(tmp) { - elem = tmp->data; - if(g_ascii_strcasecmp(elem->name, name)==0) { - return elem->value; - } - tmp = g_slist_next(tmp); - } - return NULL; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/simple/sipmsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file sipmsg.h - * - * purple - * - * Copyright (C) 2005, Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_SIPMSG_H -#define _PURPLE_SIPMSG_H - -#include - -struct sipmsg { - int response; /* 0 means request, otherwise response code */ - gchar *method; - gchar *target; - GSList *headers; - int bodylen; - gchar *body; -}; - -struct siphdrelement { - gchar *name; - gchar *value; -}; - -struct sipmsg *sipmsg_parse_msg(const gchar *msg); -struct sipmsg *sipmsg_parse_header(const gchar *header); -void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value); -void sipmsg_free(struct sipmsg *msg); -const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name); -void sipmsg_remove_header(struct sipmsg *msg, const gchar *name); -void sipmsg_print(const struct sipmsg *msg); -char *sipmsg_to_string(const struct sipmsg *msg); -#endif /* _PURPLE_SIMPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoo.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoo.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoo.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,352 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include -#include - -#include "libymsg.h" -#include "yahoochat.h" -#include "yahoo_aliases.h" -#include "yahoo_doodle.h" -#include "yahoo_filexfer.h" -#include "yahoo_picture.h" - -static PurplePlugin *my_protocol = NULL; - -static void yahoo_register_commands(void) -{ - purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoopurple_cmd_chat_join, - _("join <room>: Join a chat room on the Yahoo network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoopurple_cmd_chat_list, - _("list: List rooms on the Yahoo network"), NULL); - purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoopurple_cmd_buzz, - _("buzz: Buzz a user to get their attention"), NULL); - purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoo_doodle_purple_cmd_start, - _("doodle: Request user to start a Doodle session"), NULL); -} - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -/* This may not be the best way to do this, but we find the first key w/o a value - * and assume it is the buddy name */ -static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data) -{ - char **retval = user_data; - - if (value == NULL && *retval == NULL) { - *retval = key; - } -} - -static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "ymsgr")) - return FALSE; - - acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); - - if (!acct) - return FALSE; - - /* ymsgr:SendIM?screename&m=The+Message */ - if (!g_ascii_strcasecmp(cmd, "SendIM")) { - char *sname = NULL; - g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname); - if (sname) { - char *message = g_hash_table_lookup(params, "m"); - - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, sname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); - purple_conversation_present(conv); - - if (message) { - /* Spaces are encoded as '+' */ - g_strdelimit(message, "+", ' '); - purple_conv_send_confirm(conv, message); - } - } - /* else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im(); */ - - return TRUE; - } - /* ymsgr:Chat?roomname */ - else if (!g_ascii_strcasecmp(cmd, "Chat")) { - char *rname = NULL; - g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname); - if (rname) { - /* This is somewhat hacky, but the params aren't useful after this command */ - g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); - g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat")); - serv_join_chat(purple_account_get_connection(acct), params); - } - /* else - ** Same as above (except that this would have to be re-written using purple_request_*) - pidgin_blist_joinchat_show(); */ - - return TRUE; - } - /* ymsgr:AddFriend?name */ - else if (!g_ascii_strcasecmp(cmd, "AddFriend")) { - char *name = NULL; - g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name); - purple_blist_request_add_buddy(acct, name, NULL, NULL); - return TRUE; - } - - return FALSE; -} - -static GHashTable * -yahoo_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo ID...")); - return table; -} - -static gboolean yahoo_unload_plugin(PurplePlugin *plugin) -{ - yahoo_dest_colorht(); - - return TRUE; -} - -static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = -{ - yahoo_doodle_start, - yahoo_doodle_end, - yahoo_doodle_get_dimensions, - NULL, - yahoo_doodle_get_brush, - yahoo_doodle_set_brush, - yahoo_doodle_send_draw_list, - yahoo_doodle_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, - yahoo_list_icon, - yahoo_list_emblem, - yahoo_status_text, - yahoo_tooltip_text, - yahoo_status_types, - yahoo_blist_node_menu, - yahoo_c_info, - yahoo_c_info_defaults, - yahoo_login, - yahoo_close, - yahoo_send_im, - NULL, /* set info */ - yahoo_send_typing, - yahoo_get_info, - yahoo_set_status, - yahoo_set_idle, - NULL, /* change_passwd*/ - yahoo_add_buddy, - NULL, /* add_buddies */ - yahoo_remove_buddy, - NULL, /* remove_buddies */ - NULL, /* add_permit */ - yahoo_add_deny, - NULL, /* rem_permit */ - yahoo_rem_deny, - yahoo_set_permit_deny, - yahoo_c_join, - NULL, /* reject chat invite */ - yahoo_get_chat_name, - yahoo_c_invite, - yahoo_c_leave, - NULL, /* chat whisper */ - yahoo_c_send, - yahoo_keepalive, - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - yahoo_update_alias, /* alias_buddy */ - yahoo_change_buddys_group, - yahoo_rename_group, - NULL, /* buddy_free */ - NULL, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - yahoo_set_buddy_icon, - NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/ - NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - yahoo_roomlist_get_list, - yahoo_roomlist_cancel, - yahoo_roomlist_expand_category, - yahoo_can_receive_file, /* can_receive_file */ - yahoo_send_file, - yahoo_new_xfer, - yahoo_offline_message, /* offline_message */ - &yahoo_whiteboard_prpl_ops, - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - - yahoo_send_attention, - yahoo_attention_types, - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - yahoo_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "prpl-yahoo", /**< id */ - "Yahoo", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Yahoo! Protocol Plugin"), - /** description */ - N_("Yahoo! Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - NULL, /**< load */ - yahoo_unload_plugin, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - yahoo_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use account proxy for SSL connections"), "proxy_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - -#if 0 - option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - my_protocol = plugin; - yahoo_register_commands(); - yahoo_init_colorht(); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(yahoo_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(yahoo, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoojp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoojp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoojp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libyahoojp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,245 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include - -#include "libymsg.h" -#include "yahoochat.h" -#include "yahoo_aliases.h" -#include "yahoo_doodle.h" -#include "yahoo_filexfer.h" -#include "yahoo_picture.h" - -static void yahoojp_register_commands(void) -{ - purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoopurple_cmd_chat_join, - _("join <room>: Join a chat room on the Yahoo network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoopurple_cmd_chat_list, - _("list: List rooms on the Yahoo network"), NULL); - purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoopurple_cmd_buzz, - _("buzz: Buzz a user to get their attention"), NULL); - purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoo_doodle_purple_cmd_start, - _("doodle: Request user to start a Doodle session"), NULL); -} - -static GHashTable * -yahoojp_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo JAPAN ID...")); - return table; -} - -static gboolean yahoojp_unload_plugin(PurplePlugin *plugin) -{ - yahoo_dest_colorht(); - - return TRUE; -} - -static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = -{ - yahoo_doodle_start, - yahoo_doodle_end, - yahoo_doodle_get_dimensions, - NULL, - yahoo_doodle_get_brush, - yahoo_doodle_set_brush, - yahoo_doodle_send_draw_list, - yahoo_doodle_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, - yahoo_list_icon, - yahoo_list_emblem, - yahoo_status_text, - yahoo_tooltip_text, - yahoo_status_types, - yahoo_blist_node_menu, - yahoo_c_info, - yahoo_c_info_defaults, - yahoo_login, - yahoo_close, - yahoo_send_im, - NULL, /* set info */ - yahoo_send_typing, - yahoo_get_info, - yahoo_set_status, - yahoo_set_idle, - NULL, /* change_passwd*/ - yahoo_add_buddy, - NULL, /* add_buddies */ - yahoo_remove_buddy, - NULL, /* remove_buddies */ - NULL, /* add_permit */ - yahoo_add_deny, - NULL, /* rem_permit */ - yahoo_rem_deny, - yahoo_set_permit_deny, - yahoo_c_join, - NULL, /* reject chat invite */ - yahoo_get_chat_name, - yahoo_c_invite, - yahoo_c_leave, - NULL, /* chat whisper */ - yahoo_c_send, - yahoo_keepalive, - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - yahoo_update_alias, /* alias_buddy */ - yahoo_change_buddys_group, - yahoo_rename_group, - NULL, /* buddy_free */ - NULL, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - yahoo_set_buddy_icon, - NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/ - NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - yahoo_roomlist_get_list, - yahoo_roomlist_cancel, - yahoo_roomlist_expand_category, - NULL, /* can_receive_file */ - yahoo_send_file, - yahoo_new_xfer, - yahoo_offline_message, /* offline_message */ - &yahoo_whiteboard_prpl_ops, - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - - yahoo_send_attention, - yahoo_attention_types, - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - yahoojp_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "prpl-yahoojp", /**< id */ - "Yahoo JAPAN", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Yahoo! JAPAN Protocol Plugin"), - /** description */ - N_("Yahoo! JAPAN Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - NULL, /**< load */ - yahoojp_unload_plugin, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - yahoo_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Pager server"), "server", YAHOOJP_PAGER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOOJP_XFER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOOJP_ROOMLIST_LOCALE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use account proxy for SSL connections"), "proxy_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - -#if 0 - option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - yahoojp_register_commands(); - yahoo_init_colorht(); -} - -PURPLE_INIT_PLUGIN(yahoojp, init_plugin, info); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5124 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cipher.h" -#include "cmds.h" -#include "core.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "server.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -#include "libymsg.h" -#include "yahoochat.h" -#include "yahoo_aliases.h" -#include "yahoo_doodle.h" -#include "yahoo_filexfer.h" -#include "yahoo_friend.h" -#include "yahoo_packet.h" -#include "yahoo_picture.h" -#include "ycht.h" - -/* #define YAHOO_DEBUG */ - -/* #define TRY_WEBMESSENGER_LOGIN 0 */ - -/* One hour */ -#define PING_TIMEOUT 3600 - -/* One minute */ -#define KEEPALIVE_TIMEOUT 60 - -#ifdef TRY_WEBMESSENGER_LOGIN -static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); -#endif /* TRY_WEBMESSENGER_LOGIN */ - -static gboolean yahoo_is_japan(PurpleAccount *account) -{ - return purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoojp"); -} - -static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) -{ - char *status = NULL; - - if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name)) - return; - - switch (f->status) { - case YAHOO_STATUS_OFFLINE: - status = YAHOO_STATUS_TYPE_OFFLINE; - break; - case YAHOO_STATUS_AVAILABLE: - status = YAHOO_STATUS_TYPE_AVAILABLE; - break; - case YAHOO_STATUS_BRB: - status = YAHOO_STATUS_TYPE_BRB; - break; - case YAHOO_STATUS_BUSY: - status = YAHOO_STATUS_TYPE_BUSY; - break; - case YAHOO_STATUS_NOTATHOME: - status = YAHOO_STATUS_TYPE_NOTATHOME; - break; - case YAHOO_STATUS_NOTATDESK: - status = YAHOO_STATUS_TYPE_NOTATDESK; - break; - case YAHOO_STATUS_NOTINOFFICE: - status = YAHOO_STATUS_TYPE_NOTINOFFICE; - break; - case YAHOO_STATUS_ONPHONE: - status = YAHOO_STATUS_TYPE_ONPHONE; - break; - case YAHOO_STATUS_ONVACATION: - status = YAHOO_STATUS_TYPE_ONVACATION; - break; - case YAHOO_STATUS_OUTTOLUNCH: - status = YAHOO_STATUS_TYPE_OUTTOLUNCH; - break; - case YAHOO_STATUS_STEPPEDOUT: - status = YAHOO_STATUS_TYPE_STEPPEDOUT; - break; - case YAHOO_STATUS_INVISIBLE: /* this should never happen? */ - status = YAHOO_STATUS_TYPE_INVISIBLE; - break; - case YAHOO_STATUS_CUSTOM: - case YAHOO_STATUS_IDLE: - if (!f->away) - status = YAHOO_STATUS_TYPE_AVAILABLE; - else - status = YAHOO_STATUS_TYPE_AWAY; - break; - default: - purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); - break; - } - - if (status) { - if (f->status == YAHOO_STATUS_CUSTOM) - purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message", - yahoo_friend_get_status_message(f), NULL); - else - purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL); - } - - if (f->idle != 0) - purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle); - else - purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0); - - if (f->sms) - purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); - else - purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); -} - -static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - GSList *l = pkt->hash; - YahooFriend *f = NULL; - char *name = NULL; - gboolean unicode = FALSE; - char *message = NULL; - YahooFederation fed = YAHOO_FEDERATION_NONE; - char *fedname = NULL; - - if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, - _("You have signed on from another location")); - return; - } - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 0: /* we won't actually do anything with this */ - case 1: /* we won't actually do anything with this */ - break; - case 8: /* how many online buddies we have */ - break; - case 7: /* the current buddy */ - /* update the previous buddy before changing the variables */ - if (f) { - if (message) - yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); - if (name) - yahoo_update_status(gc, name, f); - } - name = message = NULL; - f = NULL; - if (pair->value && g_utf8_validate(pair->value, -1, NULL)) { - GSList *tmplist; - - name = pair->value; - - /* Look ahead to see if we have the federation info about the buddy */ - for (tmplist = l->next; tmplist; tmplist = tmplist->next) { - struct yahoo_pair *p = tmplist->data; - if (p->key == 7) - break; - if (p->key == 241) { - fed = strtol(p->value, NULL, 10); - g_free(fedname); - switch (fed) { - case YAHOO_FEDERATION_MSN: - name = fedname = g_strconcat("msn/", name, NULL); - break; - case YAHOO_FEDERATION_OCS: - name = fedname = g_strconcat("ocs/", name, NULL); - break; - case YAHOO_FEDERATION_IBM: - name = fedname = g_strconcat("ibm/", name, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - fedname = NULL; - break; - } - break; - } - } - f = yahoo_friend_find_or_new(gc, name); - f->fed = fed; - } - break; - case 10: /* state */ - if (!f) - break; - - f->status = strtol(pair->value, NULL, 10); - if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT)) - f->away = 1; - else - f->away = 0; - - if (f->status == YAHOO_STATUS_IDLE) { - /* Idle may have already been set in a more precise way in case 137 */ - if (f->idle == 0) - { - if(pkt->service == YAHOO_SERVICE_STATUS_15) - f->idle = -1; - else - f->idle = time(NULL); - } - } else - f->idle = 0; - - if (f->status != YAHOO_STATUS_CUSTOM) - yahoo_friend_set_status_message(f, NULL); - - f->sms = 0; - break; - case 19: /* custom message */ - if (f) - message = pair->value; - break; - case 11: /* this is the buddy's session id */ - if (f) - f->session_id = strtol(pair->value, NULL, 10); - break; - case 17: /* in chat? */ - break; - case 47: /* is custom status away or not? 2=idle*/ - if (!f) - break; - - /* I have no idea what it means when this is - * set when someone's available, but it doesn't - * mean idle. */ - if (f->status == YAHOO_STATUS_AVAILABLE) - break; - - f->away = strtol(pair->value, NULL, 10); - if (f->away == 2) { - /* Idle may have already been set in a more precise way in case 137 */ - if (f->idle == 0) - { - if(pkt->service == YAHOO_SERVICE_STATUS_15) - f->idle = -1; - else - f->idle = time(NULL); - } - } - - break; - case 138: /* when value is 1, either we're not idle, or we are but won't say how long */ - if (!f) - break; - - if( (strtol(pair->value, NULL, 10) == 1) && (f->idle) ) - f->idle = -1; - break; - case 137: /* usually idle time in seconds, sometimes login time */ - if (!f) - break; - - if (f->status != YAHOO_STATUS_AVAILABLE) - f->idle = time(NULL) - strtol(pair->value, NULL, 10); - break; - case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ - if (strtol(pair->value, NULL, 10) == 0) { - if (f) - f->status = YAHOO_STATUS_OFFLINE; - if (name) { - purple_prpl_got_user_status(account, name, "offline", NULL); - purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); - } - break; - } - break; - case 60: /* SMS */ - if (f) { - f->sms = strtol(pair->value, NULL, 10); - yahoo_update_status(gc, name, f); - } - break; - case 197: /* Avatars */ - { - guchar *decoded; - char *tmp; - gsize len; - - if (pair->value) { - decoded = purple_base64_decode(pair->value, &len); - if (len) { - tmp = purple_str_binary_to_ascii(decoded, len); - purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp); - g_free(tmp); - } - g_free(decoded); - } - break; - } - case 192: /* Pictures, aka Buddy Icons, checksum */ - { - /* FIXME: Please, if you know this protocol, - * FIXME: fix up the strtol() stuff if possible. */ - int cksum = strtol(pair->value, NULL, 10); - const char *locksum = NULL; - PurpleBuddy *b; - - if (!name) - break; - - b = purple_find_buddy(gc->account, name); - - if (!cksum || (cksum == -1)) { - if (f) - yahoo_friend_set_buddy_icon_need_request(f, TRUE); - purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); - break; - } - - if (!f) - break; - - yahoo_friend_set_buddy_icon_need_request(f, FALSE); - if (b) { - locksum = purple_buddy_icons_get_checksum_for_user(b); - if (!locksum || (cksum != strtol(locksum, NULL, 10))) - yahoo_send_picture_request(gc, name); - } - - break; - } - case 16: /* Custom error message */ - { - char *tmp = yahoo_string_decode(gc, pair->value, TRUE); - purple_notify_error(gc, NULL, tmp, NULL); - g_free(tmp); - } - break; - case 97: /* Unicode status message */ - unicode = !strcmp(pair->value, "1"); - break; - case 244: /* client version number. Yahoo Client Detection */ - if(f && strtol(pair->value, NULL, 10)) - f->version_id = strtol(pair->value, NULL, 10); - break; - case 241: /* Federated network buddy belongs to */ - break; /* We process this when get '7' */ - default: - purple_debug_warning("yahoo", - "Unknown status key %d\n", pair->key); - break; - } - - l = l->next; - } - - if (f) { - if (pkt->service == YAHOO_SERVICE_LOGOFF) - f->status = YAHOO_STATUS_OFFLINE; - if (message) - yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); - - if (name) /* update the last buddy */ - yahoo_update_status(gc, name, f); - } - - g_free(fedname); -} - -static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) -{ - PurpleBuddy *b; - PurpleGroup *g; - GSList *list, *i; - gboolean onlist = 0; - char *oname = NULL; - char **oname_p = &oname; - GSList **list_p = &list; - - if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) - list = purple_find_buddies(account, name); - else - g_hash_table_steal(ht, name); - - for (i = list; i; i = i->next) { - b = i->data; - g = purple_buddy_get_group(b); - if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { - purple_debug_misc("yahoo", - "Oh good, %s is in the right group (%s).\n", name, group); - list = g_slist_delete_link(list, i); - onlist = 1; - break; - } - } - - if (!onlist) { - purple_debug_misc("yahoo", - "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); - if (!(g = purple_find_group(group))) { - g = purple_group_new(group); - purple_blist_add_group(g, NULL); - } - b = purple_buddy_new(account, name, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - - if (list) { - if (!oname) - oname = g_strdup(purple_normalize(account, name)); - g_hash_table_insert(ht, oname, list); - } else if (oname) - g_free(oname); -} - -static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) -{ - char *name = key; - GSList *list = value, *i; - PurpleBuddy *b; - PurpleGroup *g; - - for (i = list; i; i = i->next) { - b = i->data; - g = purple_buddy_get_group(b); - purple_debug_misc("yahoo", "Deleting Buddy %s from group %s.\n", name, - purple_group_get_name(g)); - purple_blist_remove_buddy(b); - } -} - -static char *_getcookie(char *rawcookie) -{ - char *cookie = NULL; - char *tmpcookie; - char *cookieend; - - if (strlen(rawcookie) < 2) - return NULL; - tmpcookie = g_strdup(rawcookie+2); - cookieend = strchr(tmpcookie, ';'); - - if (cookieend) - *cookieend = '\0'; - - cookie = g_strdup(tmpcookie); - g_free(tmpcookie); - - return cookie; -} - -static void yahoo_process_cookie(YahooData *yd, char *c) -{ - if (c[0] == 'Y') { - if (yd->cookie_y) - g_free(yd->cookie_y); - yd->cookie_y = _getcookie(c); - } else if (c[0] == 'T') { - if (yd->cookie_t) - g_free(yd->cookie_t); - yd->cookie_t = _getcookie(c); - } else - purple_debug_info("yahoo", "Unrecognized cookie '%c'\n", c[0]); - yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c)); -} - -static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - GHashTable *ht; - char *norm_bud = NULL; - char *temp = NULL; - YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ - /* But what if you had no friends? */ - PurpleBuddy *b; - PurpleGroup *g; - YahooFederation fed = YAHOO_FEDERATION_NONE; - int stealth = 0; - - ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); - - while (l) { - struct yahoo_pair *pair = l->data; - l = l->next; - - switch (pair->key) { - case 302: - /* This is always 318 before a group, 319 before the first s/n in a group, 320 before any ignored s/n. - * It is not sent for s/n's in a group after the first. - * All ignored s/n's are listed last, so when we see a 320 we clear the group and begin marking the - * s/n's as ignored. It is always followed by an identical 300 key. - */ - if (pair->value && !strcmp(pair->value, "320")) { - /* No longer in any group; this indicates the start of the ignore list. */ - g_free(yd->current_list15_grp); - yd->current_list15_grp = NULL; - } - - break; - case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */ - if(temp != NULL) { - switch (fed) { - case YAHOO_FEDERATION_MSN: - norm_bud = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - norm_bud = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - norm_bud = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - norm_bud = g_strdup(temp); - break; - } - if (yd->current_list15_grp) { - /* This buddy is in a group */ - f = yahoo_friend_find_or_new(gc, norm_bud); - if (!(b = purple_find_buddy(account, norm_bud))) { - if (!(g = purple_find_group(yd->current_list15_grp))) { - g = purple_group_new(yd->current_list15_grp); - purple_blist_add_group(g, NULL); - } - b = purple_buddy_new(account, norm_bud, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp); - if(fed) { - f->fed = fed; - purple_debug_info("yahoo", "Setting federation to %d\n", f->fed); - } - if(stealth == 2) - f->presence = YAHOO_PRESENCE_PERM_OFFLINE; - - /* set p2p status not connected and no p2p packet sent */ - if(fed == YAHOO_FEDERATION_NONE) { - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - f->p2p_packet_sent = 0; - } else - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); - } else { - /* This buddy is on the ignore list (and therefore in no group) */ - purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); - purple_privacy_deny_add(account, norm_bud, 1); - } - - g_free(norm_bud); - norm_bud=NULL; - fed = YAHOO_FEDERATION_NONE; - stealth = 0; - g_free(temp); - temp = NULL; - } - break; - case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ - break; - case 65: /* This is the group */ - g_free(yd->current_list15_grp); - yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 7: /* buddy's s/n */ - g_free(temp); - temp = g_strdup(purple_normalize(account, pair->value)); - break; - case 241: /* user on federated network */ - fed = strtol(pair->value, NULL, 10); - break; - case 59: /* somebody told cookies come here too, but im not sure */ - yahoo_process_cookie(yd, pair->value); - break; - case 317: /* Stealth Setting */ - stealth = strtol(pair->value, NULL, 10); - break; - /* case 242: */ /* this seems related to 241 */ - /* break; */ - } - } - - g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); - - /* The reporter of ticket #9745 determined that we weren't retrieving the - * aliases during buddy list retrieval, so we never updated aliases that - * changed while we were signed off. */ - yahoo_fetch_aliases(gc); - - /* Now that we have processed the buddy list, we can say yahoo has connected */ - purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account))); - yd->logged_in = TRUE; - purple_debug_info("yahoo","Authentication: Connection established\n"); - purple_connection_set_state(gc, PURPLE_CONNECTED); - if (yd->picture_upload_todo) { - yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); - yd->picture_upload_todo = NULL; - } - yahoo_set_status(account, purple_account_get_active_status(account)); - - g_hash_table_destroy(ht); - g_free(temp); -} - -static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - gboolean export = FALSE; - gboolean got_serv_list = FALSE; - PurpleBuddy *b; - PurpleGroup *g; - YahooFriend *f = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - GHashTable *ht; - - char **lines; - char **split; - char **buddies; - char **tmp, **bud, *norm_bud; - char *grp = NULL; - - if (pkt->id) - yd->session_id = pkt->id; - - while (l) { - struct yahoo_pair *pair = l->data; - l = l->next; - - switch (pair->key) { - case 87: - if (!yd->tmp_serv_blist) - yd->tmp_serv_blist = g_string_new(pair->value); - else - g_string_append(yd->tmp_serv_blist, pair->value); - break; - case 88: - if (!yd->tmp_serv_ilist) - yd->tmp_serv_ilist = g_string_new(pair->value); - else - g_string_append(yd->tmp_serv_ilist, pair->value); - break; - case 89: - yd->profiles = g_strsplit(pair->value, ",", -1); - break; - case 59: /* cookies, yum */ - yahoo_process_cookie(yd, pair->value); - break; - case YAHOO_SERVICE_PRESENCE_PERM: - if (!yd->tmp_serv_plist) - yd->tmp_serv_plist = g_string_new(pair->value); - else - g_string_append(yd->tmp_serv_plist, pair->value); - break; - } - } - - if (pkt->status != 0) - return; - - if (yd->tmp_serv_blist) { - ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); - - lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1); - for (tmp = lines; *tmp; tmp++) { - split = g_strsplit(*tmp, ":", 2); - if (!split) - continue; - if (!split[0] || !split[1]) { - g_strfreev(split); - continue; - } - grp = yahoo_string_decode(gc, split[0], FALSE); - buddies = g_strsplit(split[1], ",", -1); - for (bud = buddies; bud && *bud; bud++) { - norm_bud = g_strdup(purple_normalize(account, *bud)); - f = yahoo_friend_find_or_new(gc, norm_bud); - - if (!(b = purple_find_buddy(account, norm_bud))) { - if (!(g = purple_find_group(grp))) { - g = purple_group_new(grp); - purple_blist_add_group(g, NULL); - } - b = purple_buddy_new(account, norm_bud, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - export = TRUE; - } - - yahoo_do_group_check(account, ht, norm_bud, grp); - /* set p2p status not connected and no p2p packet sent */ - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - f->p2p_packet_sent = 0; - - g_free(norm_bud); - } - g_strfreev(buddies); - g_strfreev(split); - g_free(grp); - } - g_strfreev(lines); - - g_string_free(yd->tmp_serv_blist, TRUE); - yd->tmp_serv_blist = NULL; - g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); - g_hash_table_destroy(ht); - } - - if (yd->tmp_serv_ilist) { - buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); - for (bud = buddies; bud && *bud; bud++) { - /* The server is already ignoring the user */ - got_serv_list = TRUE; - purple_privacy_deny_add(account, *bud, 1); - } - g_strfreev(buddies); - - g_string_free(yd->tmp_serv_ilist, TRUE); - yd->tmp_serv_ilist = NULL; - } - - if (got_serv_list && - ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && - (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && - (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) - { - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", - account->username); - } - - if (yd->tmp_serv_plist) { - buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); - for (bud = buddies; bud && *bud; bud++) { - f = yahoo_friend_find(gc, *bud); - if (f) { - purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", - account->username, *bud); - f->presence = YAHOO_PRESENCE_PERM_OFFLINE; - } - } - g_strfreev(buddies); - g_string_free(yd->tmp_serv_plist, TRUE); - yd->tmp_serv_plist = NULL; - - } - /* Now that we've got the list, request aliases */ - yahoo_fetch_aliases(gc); -} - -/* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ -static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) -{ - PurpleAccount *account; - char *msg = NULL; - char *from = NULL; - char *stat = NULL; - char *game = NULL; - YahooFriend *f = NULL; - GSList *l = pkt->hash; - gint val_11 = 0; - YahooData *yd = gc->proto_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - account = purple_connection_get_account(gc); - - while (l) { - struct yahoo_pair *pair = l->data; - if (pair->key == 4 || pair->key == 1) - from = pair->value; - if (pair->key == 49) - msg = pair->value; - if (pair->key == 13) - stat = pair->value; - if (pair->key == 14) - game = pair->value; - if (pair->key == 11) - val_11 = strtol(pair->value, NULL, 10); - if (pair->key == 241) - fed = strtol(pair->value, NULL, 10); - l = l->next; - } - - if (!from || !msg) - return; - - /* disconnect the peer if connected through p2p and sends wrong value for session id */ - if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { - purple_debug_warning("yahoo","p2p: %s sent us notify with wrong session id. Disconnecting p2p connection to peer\n", from); - /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - g_hash_table_remove(yd->peers, from); - return; - } - - if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) - && (purple_privacy_check(account, from))) - { - char *fed_from = from; - switch (fed) { - case YAHOO_FEDERATION_MSN: - fed_from = g_strconcat("msn/", from, NULL); - break; - case YAHOO_FEDERATION_OCS: - fed_from = g_strconcat("ocs/", from, NULL); - break; - case YAHOO_FEDERATION_IBM: - fed_from = g_strconcat("ibm/", from, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - - if (*stat == '1') - serv_got_typing(gc, fed_from, 0, PURPLE_TYPING); - else - serv_got_typing_stopped(gc, fed_from); - - if (fed_from != from) - g_free(fed_from); - - } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { - PurpleBuddy *bud = purple_find_buddy(account, from); - - if (!bud) { - purple_debug_warning("yahoo", - "%s is playing a game, and doesn't want you to know.\n", from); - } - - f = yahoo_friend_find(gc, from); - if (!f) - return; /* if they're not on the list, don't bother */ - - yahoo_friend_set_game(f, NULL); - - if (*stat == '1') { - yahoo_friend_set_game(f, game); - if (bud) - yahoo_update_status(gc, from, f); - } - } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) { - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); - char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from); - purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); - g_free(buf); - } -} - - -struct _yahoo_im { - char *from; - char *active_id; - int time; - int utf8; - int buddy_icon; - char *id; - char *msg; - YahooFederation fed; - char *fed_from; -}; - -static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - GSList *l = pkt->hash; - struct _yahoo_im *sms = NULL; - YahooData *yd; - char *server_msg = NULL; - char *m; - - yd = gc->proto_data; - account = purple_connection_get_account(gc); - - while (l != NULL) { - struct yahoo_pair *pair = l->data; - if (pair->key == 4) { - sms = g_new0(struct _yahoo_im, 1); - sms->from = g_strdup_printf("+%s", pair->value); - sms->time = time(NULL); - sms->utf8 = TRUE; - } - if (pair->key == 14) { - if (sms) - sms->msg = pair->value; - } - if (pair->key == 68) - if(sms) - g_hash_table_insert(yd->sms_carrier, g_strdup(sms->from), g_strdup(pair->value)); - if (pair->key == 16) - server_msg = pair->value; - l = l->next; - } - - if( (pkt->status == -1) || (pkt->status == YAHOO_STATUS_DISCONNECTED) ) { - if (server_msg) { - PurpleConversation *c; - c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms->from, account); - if (c == NULL) - c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sms->from); - purple_conversation_write(c, NULL, server_msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - else - purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL); - - g_free(sms->from); - g_free(sms); - return ; - } - - if (!sms->from || !sms->msg) { - g_free(sms); - return; - } - - m = yahoo_string_decode(gc, sms->msg, sms->utf8); - serv_got_im(gc, sms->from, m, 0, sms->time); - - g_free(m); - g_free(sms->from); - g_free(sms); -} - -/* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ -static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) -{ - PurpleAccount *account; - YahooData *yd = gc->proto_data; - GSList *l = pkt->hash; - GSList *list = NULL; - struct _yahoo_im *im = NULL; - - account = purple_connection_get_account(gc); - - if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { - /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ - while (l != NULL) { - struct yahoo_pair *pair = l->data; - if (pair->key == 4 || pair->key == 1) { - im = g_new0(struct _yahoo_im, 1); - list = g_slist_append(list, im); - im->from = pair->value; - im->time = time(NULL); - im->utf8 = TRUE; - im->fed = YAHOO_FEDERATION_NONE; - im->fed_from = g_strdup(im->from); - } - if (im && pair->key == 5) - im->active_id = pair->value; - if (pair->key == 97) - if (im) - im->utf8 = strtol(pair->value, NULL, 10); - if (pair->key == 15) - if (im) - im->time = strtol(pair->value, NULL, 10); - if (pair->key == 206) - if (im) - im->buddy_icon = strtol(pair->value, NULL, 10); - if (pair->key == 14) { - if (im) - im->msg = pair->value; - } - if (im && pair->key == 241) { - im->fed = strtol(pair->value, NULL, 10); - g_free(im->fed_from); - switch (im->fed) { - case YAHOO_FEDERATION_MSN: - im->fed_from = g_strconcat("msn/",im->from, NULL); - break; - case YAHOO_FEDERATION_OCS: - im->fed_from = g_strconcat("ocs/",im->from, NULL); - break; - case YAHOO_FEDERATION_IBM: - im->fed_from = g_strconcat("ibm/",im->from, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - im->fed_from = g_strdup(im->from); - break; - } - purple_debug_info("yahoo", "Message from federated (%d) buddy %s.\n", im->fed, im->fed_from); - - } - /* peer session id */ - if (im && (pair->key == 11)) { - /* disconnect the peer if connected through p2p and sends wrong value for session id */ - if( (im->fed == YAHOO_FEDERATION_NONE) && (pkt_type == YAHOO_PKT_TYPE_P2P) - && (yd->session_id != strtol(pair->value, NULL, 10)) ) - { - purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->fed_from); - /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - g_hash_table_remove(yd->peers, im->fed_from); - g_free(im->fed_from); - g_free(im); - return; /* Not sure whether we should process remaining IMs in this packet */ - } - } - /* IMV key */ - if (im && pair->key == 63) - { - /* Check for the Doodle IMV, no IMvironment for federated buddies */ - if (im->from != NULL && im->fed == YAHOO_FEDERATION_NONE) - { - g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(pair->value)); - - if (strstr(pair->value, "doodle;") != NULL) - { - PurpleWhiteboard *wb; - - if (!purple_privacy_check(account, im->from)) { - purple_debug_info("yahoo", "Doodle request from %s dropped.\n", - im->from); - g_free(im->fed_from); - g_free(im); - return; - } - /* I'm not sure the following ever happens -DAA */ - wb = purple_whiteboard_get_session(account, im->from); - - /* If a Doodle session doesn't exist between this user */ - if(wb == NULL) - { - doodle_session *ds; - wb = purple_whiteboard_create(account, im->from, - DOODLE_STATE_REQUESTED); - ds = wb->proto_data; - ds->imv_key = g_strdup(pair->value); - - yahoo_doodle_command_send_request(gc, im->from, pair->value); - yahoo_doodle_command_send_ready(gc, im->from, pair->value); - } - } - } - } - if (pair->key == 429) - if (im) - im->id = pair->value; - l = l->next; - } - } else if (pkt->status == 2) { - purple_notify_error(gc, NULL, - _("Your Yahoo! message did not get sent."), NULL); - } - - for (l = list; l; l = l->next) { - YahooFriend *f; - char *m, *m2; - im = l->data; - - if (!im->fed_from || !im->msg) { - g_free(im->fed_from); - g_free(im); - continue; - } - - if (!purple_privacy_check(account, im->fed_from)) { - purple_debug_info("yahoo", "Message from %s dropped.\n", im->fed_from); - return; - } - - /* - * TODO: Is there anything else we should check when determining whether - * we should send an acknowledgement? - */ - if (im->id != NULL) { - /* Send acknowledgement. If we don't do this then the official - * Yahoo Messenger client for Windows will send us the same - * message 7 seconds later as an offline message. This is true - * for at least version 9.0.0.2162 on Windows XP. */ - struct yahoo_packet *pkt2; - pkt2 = yahoo_packet_new(YAHOO_SERVICE_MESSAGE_ACK, - YAHOO_STATUS_AVAILABLE, pkt->id); - yahoo_packet_hash(pkt2, "ssisii", - 1, im->active_id, /* May not always be the connection's display name */ - 5, im->from, - 302, 430, - 430, im->id, - 303, 430, - 450, 0); - yahoo_packet_send_and_free(pkt2, yd); - } - - m = yahoo_string_decode(gc, im->msg, im->utf8); - /* This may actually not be necessary, but it appears - * that at least at one point some clients were sending - * "\r\n" as line delimiters, so we want to avoid double - * lines. */ - m2 = purple_strreplace(m, "\r\n", "\n"); - g_free(m); - m = m2; - purple_util_chrreplace(m, '\r', '\n'); - if (!strcmp(m, "")) { - char *username; - - username = g_markup_escape_text(im->fed_from, -1); - purple_prpl_got_attention(gc, username, YAHOO_BUZZ); - g_free(username); - g_free(m); - g_free(im->fed_from); - g_free(im); - continue; - } - - m2 = yahoo_codes_to_html(m); - g_free(m); - - serv_got_im(gc, im->fed_from, m2, 0, im->time); - g_free(m2); - - /* Official clients don't share buddy images with federated buddies */ - if (im->fed == YAHOO_FEDERATION_NONE) { - if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) { - if (yahoo_friend_get_buddy_icon_need_request(f)) { - yahoo_send_picture_request(gc, im->from); - yahoo_friend_set_buddy_icon_need_request(f, FALSE); - } - } - } - - g_free(im->fed_from); - g_free(im); - } - - g_slist_free(list); -} - -static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *prim, *me = NULL, *msg = NULL; - - while (l) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 5) - me = pair->value; - if (pair->key == 14) - msg = pair->value; - - l = l->next; - } - - if (!msg || !g_utf8_validate(msg, -1, NULL)) - return; - - prim = g_strdup_printf(_("Yahoo! system message for %s:"), - me?me:purple_connection_get_display_name(gc)); - purple_notify_info(NULL, NULL, prim, msg); - g_free(prim); -} - -struct yahoo_add_request { - PurpleConnection *gc; - char *id; - char *who; - YahooFederation fed; -}; - -static void -yahoo_buddy_add_authorize_cb(gpointer data) -{ - struct yahoo_add_request *add_req = data; - struct yahoo_packet *pkt; - YahooData *yd = add_req->gc->proto_data; - const char *who = add_req->who; - - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - if (add_req->fed) { - who += 4; - yahoo_packet_hash(pkt, "ssiii", - 1, add_req->id, - 5, who, - 241, add_req->fed, - 13, 1, - 334, 0); - } - else { - yahoo_packet_hash(pkt, "ssii", - 1, add_req->id, - 5, who, - 13, 1, - 334, 0); - } - - yahoo_packet_send_and_free(pkt, yd); - - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); -} - -static void -yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) -{ - YahooData *yd = add_req->gc->proto_data; - struct yahoo_packet *pkt; - char *encoded_msg = NULL; - const char *who = add_req->who; - - if (msg && *msg) - encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL); - - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - if (add_req->fed) { - who += 4; /* Skip fed identifier (msn|ocs|ibm)/' */ - yahoo_packet_hash(pkt, "ssiiiis", - 1, add_req->id, - 5, who, - 241, add_req->fed, - 13, 2, - 334, 0, - 97, 1, - 14, encoded_msg ? encoded_msg : ""); - } - else { - yahoo_packet_hash(pkt, "ssiiis", - 1, add_req->id, - 5, who, - 13, 2, - 334, 0, - 97, 1, - 14, encoded_msg ? encoded_msg : ""); - } - - - yahoo_packet_send_and_free(pkt, yd); - - g_free(encoded_msg); - - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); -} - -static void -yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg) -{ - yahoo_buddy_add_deny_cb(add_req, NULL); -} - -static void -yahoo_buddy_add_deny_reason_cb(gpointer data) { - struct yahoo_add_request *add_req = data; - purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), - NULL, _("No reason given."), TRUE, FALSE, NULL, - _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), - _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), - purple_connection_get_account(add_req->gc), add_req->who, NULL, - add_req); -} - -static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) -{ - char *notify_msg; - YahooData *yd = gc->proto_data; - - if (who == NULL) - return; - - if (reason != NULL) { - char *msg2 = yahoo_string_decode(gc, reason, FALSE); - notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2); - g_free(msg2); - } else - notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list."), who); - - purple_notify_info(gc, NULL, _("Add buddy rejected"), notify_msg); - g_free(notify_msg); - - g_hash_table_remove(yd->friends, who); - purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */ - /* TODO: Shouldn't we remove the buddy from our local list? */ -} - -static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) { - PurpleAccount *account; - GSList *l = pkt->hash; - const char *msg = NULL; - - account = purple_connection_get_account(gc); - - /* Buddy authorized/declined our addition */ - if (pkt->status == 1) { - char *temp = NULL; - char *who = NULL; - int response = 0; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - temp = pair->value; - break; - case 13: - response = strtol(pair->value, NULL, 10); - break; - case 14: - msg = pair->value; - break; - case 241: - fed = strtol(pair->value, NULL, 10); - break; - } - l = l->next; - } - - switch (fed) { - case YAHOO_FEDERATION_MSN: - who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - who = g_strdup(temp); - break; - } - - if (response == 1) /* Authorized */ - purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); - else if (response == 2) { /* Declined */ - purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); - yahoo_buddy_denied_our_add(gc, who, msg); - } else - purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)"); - g_free(who); - } - /* Buddy requested authorization to add us. */ - else if (pkt->status == 3) { - struct yahoo_add_request *add_req; - const char *firstname = NULL, *lastname = NULL; - char *temp = NULL; - - add_req = g_new0(struct yahoo_add_request, 1); - add_req->gc = gc; - add_req->fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - temp = pair->value; - break; - case 5: - add_req->id = g_strdup(pair->value); - break; - case 14: - msg = pair->value; - break; - case 216: - firstname = pair->value; - break; - case 241: - add_req->fed = strtol(pair->value, NULL, 10); - break; - case 254: - lastname = pair->value; - break; - - } - l = l->next; - } - switch (add_req->fed) { - case YAHOO_FEDERATION_MSN: - add_req->who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - add_req->who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - add_req->who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - add_req->who = g_strdup(temp); - break; - } - - if (add_req->id && add_req->who) { - char *alias = NULL, *dec_msg = NULL; - - if (!purple_privacy_check(account, add_req->who)) - { - purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", - add_req->who); - yahoo_buddy_add_deny_cb(add_req, NULL); - return; - } - - if (msg) - dec_msg = yahoo_string_decode(gc, msg, FALSE); - - if (firstname && lastname) - alias = g_strdup_printf("%s %s", firstname, lastname); - else if (firstname) - alias = g_strdup(firstname); - else if (lastname) - alias = g_strdup(lastname); - - /* DONE! this is almost exactly the same as what MSN does, - * this should probably be moved to the core. - */ - purple_account_request_authorization(account, add_req->who, add_req->id, - alias, dec_msg, - purple_find_buddy(account, add_req->who) != NULL, - yahoo_buddy_add_authorize_cb, - yahoo_buddy_add_deny_reason_cb, - add_req); - g_free(alias); - g_free(dec_msg); - } else { - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); - } - } else { - purple_debug_error("yahoo", "Received authorization of unknown status (%d).\n", pkt->status); - } -} - -/* I don't think this happens anymore in Version 15 */ -static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { - PurpleAccount *account; - struct yahoo_add_request *add_req; - char *msg = NULL; - GSList *l = pkt->hash; - - account = purple_connection_get_account(gc); - - add_req = g_new0(struct yahoo_add_request, 1); - add_req->gc = gc; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 1: - add_req->id = g_strdup(pair->value); - break; - case 3: - add_req->who = g_strdup(pair->value); - break; - case 15: /* time, for when they add us and we're offline */ - break; - case 14: - msg = pair->value; - break; - } - l = l->next; - } - - if (add_req->id && add_req->who) { - char *dec_msg = NULL; - - if (!purple_privacy_check(account, add_req->who)) { - purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", - add_req->who); - yahoo_buddy_add_deny_cb(add_req, NULL); - return; - } - - if (msg) - dec_msg = yahoo_string_decode(gc, msg, FALSE); - - /* DONE! this is almost exactly the same as what MSN does, - * this should probably be moved to the core. - */ - purple_account_request_authorization(account, add_req->who, add_req->id, - NULL, dec_msg, - purple_find_buddy(account,add_req->who) != NULL, - yahoo_buddy_add_authorize_cb, - yahoo_buddy_add_deny_reason_cb, add_req); - g_free(dec_msg); - } else { - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); - } -} - -/* I have no idea if this every gets called in version 15 */ -static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *who = NULL; - char *msg = NULL; - GSList *l = pkt->hash; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 3: - who = pair->value; - break; - case 14: - msg = pair->value; - break; - } - l = l->next; - } - - yahoo_buddy_denied_our_add(gc, who, msg); -} - -static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - switch (pkt->status) { - case 1: - yahoo_process_status(gc, pkt); - return; - case 3: - yahoo_buddy_added_us(gc, pkt); - break; - case 7: - yahoo_buddy_denied_our_add_old(gc, pkt); - break; - default: - break; - } -} - -#define OUT_CHARSET "utf-8" - -static char *yahoo_decode(const char *text) -{ - char *converted = NULL; - char *n, *new; - const char *end, *p; - int i, k; - - n = new = g_malloc(strlen (text) + 1); - end = text + strlen(text); - - for (p = text; p < end; p++, n++) { - if (*p == '\\') { - if (p[1] >= '0' && p[1] <= '7') { - p += 1; - for (i = 0, k = 0; k < 3; k += 1) { - char c = p[k]; - if (c < '0' || c > '7') break; - i *= 8; - i += c - '0'; - } - *n = i; - p += k - 1; - } else { /* bug 959248 */ - /* If we see a \ not followed by an octal number, - * it means that it is actually a \\ with one \ - * already eaten by some unknown function. - * This is arguably broken. - * - * I think wing is wrong here, there is no function - * called that I see that could have done it. I guess - * it is just really sending single \'s. That's yahoo - * for you. - */ - *n = *p; - } - } - else - *n = *p; - } - - *n = '\0'; - - if (strstr(text, "\033$B")) - converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL); - if (!converted) - converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL); - g_free(new); - - return converted; -} - -static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - const char *who = NULL; - const char *email = NULL; - const char *subj = NULL; - const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); - int count = 0; - GSList *l = pkt->hash; - - if (!purple_account_get_check_mail(account)) - return; - - while (l) { - struct yahoo_pair *pair = l->data; - if (pair->key == 9) - count = strtol(pair->value, NULL, 10); - else if (pair->key == 43) - who = pair->value; - else if (pair->key == 42) - email = pair->value; - else if (pair->key == 18) - subj = pair->value; - l = l->next; - } - - if (who && subj && email && *email) { - char *dec_who = yahoo_decode(who); - char *dec_subj = yahoo_decode(subj); - char *from = g_strdup_printf("%s (%s)", dec_who, email); - - purple_notify_email(gc, dec_subj, from, purple_account_get_username(account), - yahoo_mail_url, NULL, NULL); - - g_free(dec_who); - g_free(dec_subj); - g_free(from); - } else if (count > 0) { - const char *tos[2] = { purple_account_get_username(account) }; - const char *urls[2] = { yahoo_mail_url }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls, - NULL, NULL); - } -} - -/* We use this structure once while we authenticate */ -struct yahoo_auth_data -{ - PurpleConnection *gc; - char *seed; -}; - -/* This is the y64 alphabet... it's like base64, but has a . and a _ */ -static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; - -/* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function - * in util.c, but it is different from the one yahoo uses */ -static void to_y64(char *out, const unsigned char *in, gsize inlen) - /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ -{ - for (; inlen >= 3; inlen -= 3) - { - *out++ = base64digits[in[0] >> 2]; - *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; - *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; - *out++ = base64digits[in[2] & 0x3f]; - in += 3; - } - if (inlen > 0) - { - unsigned char fragment; - - *out++ = base64digits[in[0] >> 2]; - fragment = (in[0] << 4) & 0x30; - if (inlen > 1) - fragment |= in[1] >> 4; - *out++ = base64digits[fragment]; - *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c]; - *out++ = '-'; - } - *out = '\0'; -} - -static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) -{ - YahooData *yd = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - const char *name = purple_normalize(account, purple_account_get_username(account)); - PurpleCipher *md5_cipher; - PurpleCipherContext *md5_ctx; - guchar md5_digest[16]; - gchar base64_string[25]; - struct yahoo_packet *pkt; - - purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n"); - - md5_cipher = purple_ciphers_find_cipher("md5"); - md5_ctx = purple_cipher_context_new(md5_cipher, NULL); - purple_cipher_context_append(md5_ctx, (guchar *)crypt, strlen(crypt)); - purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), md5_digest, NULL); - - to_y64(base64_string, md5_digest, 16); - - purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, yd->session_id); - - yahoo_packet_hash(pkt, "sssssssss", - 1, name, - 0, name, - 277, yd->cookie_y, - 278, yd->cookie_t, - 307, base64_string, - 244, yd->jp ? YAHOOJP_CLIENT_VERSION_ID : YAHOO_CLIENT_VERSION_ID, - 2, name, - 2, "1", - 135, yd->jp ? YAHOOJP_CLIENT_VERSION : YAHOO_CLIENT_VERSION); - - if (yd->picture_checksum) - yahoo_packet_hash_int(pkt, 192, yd->picture_checksum); - yahoo_packet_send_and_free(pkt, yd); - - purple_cipher_context_destroy(md5_ctx); -} - -static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) -{ - struct yahoo_auth_data *auth_data = user_data; - PurpleConnection *gc = auth_data->gc; - YahooData *yd; - gboolean try_login_on_error = FALSE; - - purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - g_free(auth_data->seed); - g_free(auth_data); - g_return_if_reached(); - } - - yd = (YahooData *)gc->proto_data; - - if (error_message != NULL) { - purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); - g_free(auth_data->seed); - g_free(auth_data); - return; - } - else if (len > 0 && ret_data && *ret_data) { - gchar **split_data = g_strsplit(ret_data, "\r\n", -1); - int totalelements = 0; - int response_no = -1; - char *crumb = NULL; - char *crypt = NULL; - -#if GLIB_CHECK_VERSION(2,6,0) - totalelements = g_strv_length(split_data); -#else - while (split_data[++totalelements] != NULL); -#endif - if (totalelements >= 4) { - response_no = strtol(split_data[0], NULL, 10); - crumb = g_strdup(split_data[1] + strlen("crumb=")); - yd->cookie_y = g_strdup(split_data[2] + strlen("Y=")); - yd->cookie_t = g_strdup(split_data[3] + strlen("T=")); - } - - g_strfreev(split_data); - - if(response_no != 0) { - /* Some error in the login process */ - PurpleConnectionError error; - char *error_reason = NULL; - - switch(response_no) { - case -1: - /* Some error in the received stream */ - error_reason = g_strdup(_("Received invalid data")); - error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 100: - /* Unknown error */ - error_reason = g_strdup(_("Unknown error")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - default: - /* if we have everything we need, why not try to login irrespective of response */ - if((crumb != NULL) && (yd->cookie_y != NULL) && (yd->cookie_t != NULL)) { - try_login_on_error = TRUE; - break; - } - error_reason = g_strdup(_("Unknown error")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - if(error_reason) { - purple_debug_error("yahoo", "Authentication error: %s. " - "Code %d\n", error_reason, response_no); - purple_connection_error_reason(gc, error, error_reason); - g_free(error_reason); - g_free(auth_data->seed); - g_free(auth_data); - return; - } - } - - crypt = g_strconcat(crumb, auth_data->seed, NULL); - yahoo_auth16_stage3(gc, crypt); - g_free(crypt); - g_free(crumb); - } - g_free(auth_data->seed); - g_free(auth_data); -} - -static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) -{ - struct yahoo_auth_data *auth_data = user_data; - PurpleConnection *gc = auth_data->gc; - - purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage1_cb\n"); - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - g_free(auth_data->seed); - g_free(auth_data); - g_return_if_reached(); - } - - if (error_message != NULL) { - purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); - g_free(auth_data->seed); - g_free(auth_data); - return; - } - else if (len > 0 && ret_data && *ret_data) { - gchar **split_data = g_strsplit(ret_data, "\r\n", -1); - int totalelements = 0; - int response_no = -1; - char *token = NULL; - -#if GLIB_CHECK_VERSION(2,6,0) - totalelements = g_strv_length(split_data); -#else - while (split_data[++totalelements] != NULL); -#endif - if(totalelements == 1) - response_no = strtol(split_data[0], NULL, 10); - else if(totalelements >= 2) { - response_no = strtol(split_data[0], NULL, 10); - token = g_strdup(split_data[1] + strlen("ymsgr=")); - } - - g_strfreev(split_data); - - if(response_no != 0) { - /* Some error in the login process */ - PurpleConnectionError error; - char *error_reason; - - switch(response_no) { - case -1: - /* Some error in the received stream */ - error_reason = g_strdup(_("Received invalid data")); - error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 1212: - /* Password incorrect */ - /* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */ - if (!purple_account_get_remember_password(purple_connection_get_account(gc))) - purple_account_set_password(purple_connection_get_account(gc), NULL); - error_reason = g_strdup(_("Incorrect password")); - error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 1213: - /* security lock from too many failed login attempts */ - error_reason = g_strdup(_("Account locked: Too many failed login attempts. Logging into the Yahoo! website may fix this.")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - case 1235: - /* the username does not exist */ - error_reason = g_strdup(_("Username does not exist")); - error = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - case 1214: - case 1236: - /* indicates a lock of some description */ - error_reason = g_strdup(_("Account locked: Unknown reason. Logging into the Yahoo! website may fix this.")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - case 100: - /* username or password missing */ - error_reason = g_strdup(_("Username or password missing")); - error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - default: - /* Unknown error! */ - error_reason = g_strdup_printf(_("Unknown error (%d)"), response_no); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - purple_debug_error("yahoo", "Authentication error: %s. Code %d\n", - error_reason, response_no); - purple_connection_error_reason(gc, error, error_reason); - g_free(error_reason); - g_free(auth_data->seed); - g_free(auth_data); - g_free(token); - } - else { - /* OK to login, correct information provided */ - PurpleUtilFetchUrlData *url_data = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - char *url = NULL; - gboolean yahoojp = yahoo_is_japan(account); - gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); - - url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); - url_data = purple_util_fetch_url_request_len_with_account( - proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, - TRUE, NULL, FALSE, -1, yahoo_auth16_stage2, auth_data); - g_free(url); - g_free(token); - } - } -} - -static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) -{ - PurpleAccount *account = purple_connection_get_account(gc); - PurpleUtilFetchUrlData *url_data = NULL; - struct yahoo_auth_data *auth_data = NULL; - char *url = NULL; - char *encoded_username; - char *encoded_password; - gboolean yahoojp = yahoo_is_japan(account); - gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); - - purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n"); - - if(!purple_ssl_is_supported()) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); - return; - } - - auth_data = g_new0(struct yahoo_auth_data, 1); - auth_data->gc = gc; - auth_data->seed = g_strdup(seed); - - encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc)))); - encoded_password = g_strdup(purple_url_encode(purple_connection_get_password(gc))); - url = g_strdup_printf(yahoojp ? YAHOOJP_TOKEN_URL : YAHOO_TOKEN_URL, - encoded_username, encoded_password, purple_url_encode(seed)); - g_free(encoded_password); - g_free(encoded_username); - - url_data = purple_util_fetch_url_request_len_with_account( - proxy_ssl ? account : NULL, url, TRUE, - YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, - yahoo_auth16_stage1_cb, auth_data); - - g_free(url); -} - -static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *seed = NULL; - char *sn = NULL; - GSList *l = pkt->hash; - int m = 0; - gchar *buf; - - while (l) { - struct yahoo_pair *pair = l->data; - if (pair->key == 94) - seed = pair->value; - if (pair->key == 1) - sn = pair->value; - if (pair->key == 13) - m = atoi(pair->value); - l = l->next; - } - - if (seed) { - switch (m) { - case 0: - /* used to be for really old auth routine, dont support now */ - case 1: - case 2: /* Yahoo ver 16 authentication */ - yahoo_auth16_stage1(gc, seed); - break; - default: - { - GHashTable *ui_info = purple_core_get_ui_info(); - - buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " - "authentication method. You will probably not be able " - "to successfully sign on to Yahoo. Check %s for updates."), - ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); - purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), - buf); - g_free(buf); - yahoo_auth16_stage1(gc, seed); /* Can't hurt to try it anyway. */ - break; - } - } - } -} - -static void ignore_buddy(PurpleBuddy *buddy) { - PurpleGroup *group; - PurpleAccount *account; - gchar *name; - - if (!buddy) - return; - - group = purple_buddy_get_group(buddy); - name = g_strdup(purple_buddy_get_name(buddy)); - account = purple_buddy_get_account(buddy); - - purple_debug_info("yahoo", "blist: Removing '%s' from buddy list.\n", name); - purple_account_remove_buddy(account, buddy, group); - purple_blist_remove_buddy(buddy); - - serv_add_deny(purple_account_get_connection(account), name); - - g_free(name); -} - -static void keep_buddy(PurpleBuddy *b) -{ - purple_privacy_deny_remove(purple_buddy_get_account(b), - purple_buddy_get_name(b), 1); -} - -static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { - PurpleBuddy *b; - GSList *l; - gchar *who = NULL; - gchar *me = NULL; - gchar buf[BUF_LONG]; - gboolean ignore = TRUE; - gint status = 0; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - switch (pair->key) { - case 0: - who = pair->value; - break; - case 1: - me = pair->value; - break; - case 13: - /* 1 == ignore, 2 == unignore */ - ignore = (strtol(pair->value, NULL, 10) == 1); - break; - case 66: - status = strtol(pair->value, NULL, 10); - break; - default: - break; - } - } - - /* - * status - * 0 - ok - * 2 - already in ignore list, could not add - * 3 - not in ignore list, could not delete - * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?) - */ - switch (status) { - case 12: - purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s", - who, (ignore ? "ignoring" : "unignoring")); - - if (ignore) { - b = purple_find_buddy(gc->account, who); - g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " - "user is on your buddy list. Clicking \"Yes\" " - "will remove and ignore the buddy."), who); - purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, - gc->account, who, NULL, - b, - G_CALLBACK(ignore_buddy), - G_CALLBACK(keep_buddy)); - break; - } - case 2: - purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.\n", - who); - break; - case 3: - purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete\n", - who); - case 0: - default: - break; - } -} - -static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) -{ -#ifdef TRY_WEBMESSENGER_LOGIN - YahooData *yd = gc->proto_data; -#endif /* TRY_WEBMESSENGER_LOGIN */ - GSList *l = pkt->hash; - int err = 0; - char *msg; - char *url = NULL; - char *fullmsg; - PurpleAccount *account = gc->account; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - - while (l) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 66) - err = strtol(pair->value, NULL, 10); - else if (pair->key == 20) - url = pair->value; - - l = l->next; - } - - switch (err) { - case 0: - msg = g_strdup(_("Unknown error")); - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 3: - msg = g_strdup(_("Username does not exist")); - reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - case 13: -#ifdef TRY_WEBMESSENGER_LOGIN - if (!yd->wm) { - PurpleUtilFetchUrlData *url_data; - yd->wm = TRUE; - if (yd->fd >= 0) - close(yd->fd); - if (gc->inpa) - purple_input_remove(gc->inpa); - url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, - "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - return; - } -#endif /* TRY_WEBMESSENGER_LOGIN */ - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - - msg = g_strdup(_("Invalid username or password")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 14: - msg = g_strdup(_("Your account has been locked due to too many failed login attempts." - " Please try logging into the Yahoo! website.")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 52: - /* See #9660. As much as we know, reconnecting shouldn't hurt */ - purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n"); - msg = g_strdup_printf(_("Unknown error 52. Reconnecting should fix this.")); - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 1013: - msg = g_strdup(_("Error 1013: The username you have entered is invalid." - " The most common cause of this error is entering your email" - " address instead of your Yahoo! ID.")); - reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - default: - msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err); - } - - if (url) - fullmsg = g_strdup_printf("%s\n%s", msg, url); - else - fullmsg = g_strdup(msg); - - purple_connection_error_reason(gc, reason, fullmsg); - g_free(msg); - g_free(fullmsg); -} - -static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - int err = 0; - char *who = NULL; - char *temp = NULL; - char *group = NULL; - char *decoded_group; - char *buf; - YahooFriend *f; - GSList *l = pkt->hash; - YahooData *yd = gc->proto_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 66: - err = strtol(pair->value, NULL, 10); - break; - case 7: - temp = pair->value; - break; - case 65: - group = pair->value; - break; - case 241: - fed = strtol(pair->value, NULL, 10); - break; - } - - l = l->next; - } - - if (!temp) - return; - if (!group) - group = ""; - - switch (fed) { - case YAHOO_FEDERATION_MSN: - who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - who = g_strdup(temp); - break; - } - - if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */ - f = yahoo_friend_find_or_new(gc, who); - yahoo_update_status(gc, who, f); - f->fed = fed; - - if( !g_hash_table_lookup(yd->peers, who) ) { - /* we are not connected as client, so set friend to not connected */ - if(fed) - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); - else { - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - f->p2p_packet_sent = 0; - } - } - else /* we are already connected. set friend to YAHOO_P2PSTATUS_WE_ARE_CLIENT */ - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); - g_free(who); - return; - } - - decoded_group = yahoo_string_decode(gc, group, FALSE); - buf = g_strdup_printf(_("Unable to add buddy %s to group %s to the server list on account %s."), - who, decoded_group, purple_connection_get_display_name(gc)); - if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to add buddy to server list"), buf); - g_free(buf); - g_free(decoded_group); - g_free(who); -} - -/* write pkt to the source */ -static void yahoo_p2p_write_pkt(gint source, struct yahoo_packet *pkt) -{ - size_t pkt_len; - guchar *raw_packet; - - /*build the raw packet and send it to the host*/ - pkt_len = yahoo_packet_build(pkt, 0, 0, 0, &raw_packet); - if(write(source, raw_packet, pkt_len) != pkt_len) - purple_debug_warning("yahoo","p2p: couldn't write to the source\n"); - g_free(raw_packet); -} - -static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_data) -{ - struct yahoo_p2p_data *p2p_data = value; - PurpleConnection *gc = user_data; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - YahooData *yd = gc->proto_data; - - account = purple_connection_get_account(gc); - - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssisi", - 4, purple_normalize(account, purple_account_get_username(account)), - 5, p2p_data->host_username, - 241, 0, /* Protocol identifier */ - 49, "PEERTOPEER", - 13, 7); - yahoo_p2p_write_pkt(p2p_data->source, pkt_to_send); - - yahoo_packet_free(pkt_to_send); -} - -static gboolean yahoo_p2p_keepalive(gpointer data) -{ - PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; - - g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); - - return TRUE; -} - -/* destroy p2p_data associated with a peer and close p2p connection. - * g_hash_table_remove() calls this function to destroy p2p_data associated with the peer, - * call g_hash_table_remove() instead of this fucntion if peer has an entry in the table */ -static void yahoo_p2p_disconnect_destroy_data(gpointer data) -{ - struct yahoo_p2p_data *p2p_data; - YahooFriend *f; - - if(!(p2p_data = data)) - return ; - - /* If friend, set him not connected */ - f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); - if (f) - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - - if(p2p_data->source >= 0) - close(p2p_data->source); - if (p2p_data->input_event > 0) - purple_input_remove(p2p_data->input_event); - g_free(p2p_data->host_ip); - g_free(p2p_data->host_username); - g_free(p2p_data); -} - -/* exchange of initial p2pfilexfer packets, service type YAHOO_SERVICE_P2PFILEXFER */ -static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yahoo_packet *pkt) -{ - struct yahoo_p2p_data *p2p_data; - char *who = NULL; - GSList *l = pkt->hash; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - int val_13_to_send = 0; - YahooData *yd; - YahooFriend *f; - - if(!(p2p_data = data)) - return ; - - yd = p2p_data->gc->proto_data; - - /* lets see whats in the packet */ - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - if(strncmp(who, p2p_data->host_username, strlen(p2p_data->host_username)) != 0) { - /* from whom are we receiving the packets ?? */ - purple_debug_warning("yahoo","p2p: received data from wrong user\n"); - return; - } - break; - case 13: - p2p_data->val_13 = strtol(pair->value, NULL, 10); /* Value should be 5-7 */ - break; - /* case 5, 49 look laters, no use right now */ - } - l = l->next; - } - - account = purple_connection_get_account(p2p_data->gc); - - /* key_13: sort of a counter. - * WHEN WE ARE CLIENT: yahoo server sends val_13 = 0, we send to peer val_13 = 1, receive back val_13 = 5, - * we send val_13=6, receive val_13=7, we send val_13=7, HALT. Keep sending val_13 = 7 as keep alive. - * WHEN WE ARE SERVER: we send val_13 = 0 to yahoo server, peer sends us val_13 = 1, we send val_13 = 5, - * receive val_13 = 6, send val_13 = 7, receive val_13 = 7. HALT. Keep sending val_13 = 7 as keep alive. */ - - switch(p2p_data->val_13) { - case 1 : val_13_to_send = 5; break; - case 5 : val_13_to_send = 6; break; - case 6 : val_13_to_send = 7; break; - case 7 : if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) - return; - val_13_to_send = 7; break; - default: purple_debug_warning("yahoo","p2p:Unknown value for key 13\n"); - return; - } - - /* Build the yahoo packet */ - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssisi", - 4, purple_normalize(account, purple_account_get_username(account)), - 5, p2p_data->host_username, - 241, 0, /* Protocol identifier */ - 49, "PEERTOPEER", - 13, val_13_to_send); - - /* build the raw packet and send it to the host */ - yahoo_p2p_write_pkt(source, pkt_to_send); - yahoo_packet_free(pkt_to_send); - - if( val_13_to_send == 7 ) - if( !g_hash_table_lookup(yd->peers, p2p_data->host_username) ) { - g_hash_table_insert(yd->peers, g_strdup(p2p_data->host_username), p2p_data); - /* If the peer is a friend, set him connected */ - f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); - if (f) { - if(p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) { - p2p_data->session_id = f->session_id; - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_SERVER); - } - else - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); - } - } -} - -/* callback function associated with receiving of data, not considering receipt of multiple YMSG packets in a single TCP packet */ -static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - guchar buf[1024]; /* is it safe to assume a fixed array length of 1024 ?? */ - int len; - int pos = 0; - int pktlen; - struct yahoo_packet *pkt; - guchar *start = NULL; - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return ; - yd = p2p_data->gc->proto_data; - - len = read(source, buf, sizeof(buf)); - if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) - return ; /* No Worries*/ - else if (len <= 0) - { - purple_debug_warning("yahoo","p2p: Error in connection, or host disconnected\n"); - /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) - g_hash_table_remove(yd->peers,p2p_data->host_username); - else - yahoo_p2p_disconnect_destroy_data(data); - return; - } - - if(len < YAHOO_PACKET_HDRLEN) - return; - - if(strncmp((char *)buf, "YMSG", MIN(4, len)) != 0) { - /* Not a YMSG packet */ - purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n"); - - start = memchr(buf + 1, 'Y', len - 1); - if (start == NULL) - return; - - g_memmove(buf, start, len - (start - buf)); - len -= start - buf; - } - - pos += 4; /* YMSG */ - pos += 2; - pos += 2; - - pktlen = yahoo_get16(buf + pos); pos += 2; - purple_debug_misc("yahoo", "p2p: %d bytes to read\n", len); - - pkt = yahoo_packet_new(0, 0, 0); - pkt->service = yahoo_get16(buf + pos); pos += 2; - pkt->status = yahoo_get32(buf + pos); pos += 4; - pkt->id = yahoo_get32(buf + pos); pos += 4; - - purple_debug_misc("yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status); - yahoo_packet_read(pkt, buf + pos, pktlen); - - /* packet processing */ - switch(pkt->service) { - case YAHOO_SERVICE_P2PFILEXFER: - yahoo_p2p_process_p2pfilexfer(data, source, pkt); - break; - case YAHOO_SERVICE_MESSAGE: - yahoo_process_message(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); - break; - case YAHOO_SERVICE_NOTIFY: - yahoo_process_notify(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); - break; - default: - purple_debug_warning("yahoo","p2p: p2p service %d Unhandled\n",pkt->service); - } - - yahoo_packet_free(pkt); -} - -static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - int acceptfd; - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return ; - yd = p2p_data->gc->proto_data; - - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) - return; - else if(acceptfd == -1) { - purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); - yahoo_p2p_disconnect_destroy_data(data); - return; - } - - /* remove timeout */ - if (yd->yahoo_p2p_server_timeout_handle) { - purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); - yd->yahoo_p2p_server_timeout_handle = 0; - } - - /* remove watcher and close p2p server */ - if (yd->yahoo_p2p_server_watcher) { - purple_input_remove(yd->yahoo_p2p_server_watcher); - yd->yahoo_p2p_server_watcher = 0; - } - if (yd->yahoo_local_p2p_server_fd >= 0) { - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; - } - - /* Add an Input Read event to the file descriptor */ - p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); - p2p_data->source = acceptfd; -} - -static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) -{ - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return FALSE; - - yd = p2p_data->gc->proto_data; - - purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n"); - yahoo_p2p_disconnect_destroy_data(data); - purple_input_remove(yd->yahoo_p2p_server_watcher); - yd->yahoo_p2p_server_watcher = 0; - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; - yd->yahoo_p2p_server_timeout_handle = 0; - - return FALSE; -} - -static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) -{ - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return ; - - if(listenfd == -1) { - purple_debug_warning("yahoo","p2p: error starting p2p server\n"); - yahoo_p2p_disconnect_destroy_data(data); - return; - } - - yd = p2p_data->gc->proto_data; - - /* Add an Input Read event to the file descriptor */ - yd->yahoo_local_p2p_server_fd = listenfd; - yd->yahoo_p2p_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_server_send_connected_cb,data); - - /* add timeout */ - yd->yahoo_p2p_server_timeout_handle = purple_timeout_add_seconds(YAHOO_P2P_SERVER_TIMEOUT, yahoo_cancel_p2p_server_listen_cb, data); -} - -/* send p2p pkt containing our encoded ip, asking peer to connect to us */ -void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) -{ - const char *public_ip; - guint32 temp[4]; - guint32 ip; - char temp_str[100]; - gchar *base64_ip = NULL; - YahooFriend *f; - struct yahoo_packet *pkt; - PurpleAccount *account; - YahooData *yd = gc->proto_data; - struct yahoo_p2p_data *p2p_data; - - f = yahoo_friend_find(gc, who); - account = purple_connection_get_account(gc); - - /* Do not send invitation if already listening for other connection */ - if(yd->yahoo_local_p2p_server_fd >= 0) - return; - - /* One shouldn't try to connect to self */ - if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0) - return; - - /* send packet to only those friends who arent p2p connected and to whom we havent already sent. Do not send if this condition doesn't hold good */ - if( !( f && (yahoo_friend_get_p2p_status(f) == YAHOO_P2PSTATUS_NOT_CONNECTED) && (f->p2p_packet_sent == 0)) ) - return; - - /* Dont send p2p packet to buddies of other protocols */ - if(f->fed) - return; - - /* Finally, don't try to connect to buddies not online or on sms */ - if( (f->status == YAHOO_STATUS_OFFLINE) || f->sms ) - return; - - public_ip = purple_network_get_public_ip(); - if( (sscanf(public_ip, "%u.%u.%u.%u", &temp[0], &temp[1], &temp[2], &temp[3])) !=4 ) - return ; - - ip = (temp[3] << 24) | (temp[2] <<16) | (temp[1] << 8) | temp[0]; - sprintf(temp_str, "%d", ip); - base64_ip = purple_base64_encode( (guchar *)temp_str, strlen(temp_str) ); - - pkt = yahoo_packet_new(YAHOO_SERVICE_PEERTOPEER, YAHOO_STATUS_AVAILABLE, 0); - yahoo_packet_hash(pkt, "sssissis", - 1, purple_normalize(account, purple_account_get_username(account)), - 4, purple_normalize(account, purple_account_get_username(account)), - 12, base64_ip, /* base64 encode ip */ - 61, 0, /* To-do : figure out what is 61 for?? */ - 2, "", - 5, who, - 13, val_13, - 49, "PEERTOPEER"); - yahoo_packet_send_and_free(pkt, yd); - - f->p2p_packet_sent = 1; /* set p2p_packet_sent to sent */ - - p2p_data = g_new0(struct yahoo_p2p_data, 1); - - p2p_data->gc = gc; - p2p_data->host_ip = NULL; - p2p_data->host_username = g_strdup(who); - p2p_data->val_13 = val_13; - p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER; - p2p_data->source = -1; - - purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); - - g_free(base64_ip); -} - -/* function called when connection to p2p host is setup */ -static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message) -{ - struct yahoo_p2p_data *p2p_data; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - YahooData *yd; - - p2p_data = data; - yd = p2p_data->gc->proto_data; - - if(error_message != NULL) { - purple_debug_warning("yahoo","p2p: %s\n",error_message); - yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */ - - yahoo_p2p_disconnect_destroy_data(p2p_data); - return; - } - - /* Add an Input Read event to the file descriptor */ - p2p_data->input_event = purple_input_add(source, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); - p2p_data->source = source; - - account = purple_connection_get_account(p2p_data->gc); - - /* Build the yahoo packet */ - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssisi", - 4, purple_normalize(account, purple_account_get_username(account)), - 5, p2p_data->host_username, - 241, 0, /* Protocol identifier */ - 49, "PEERTOPEER", - 13, 1); /* we receive key13= 0 or 2, we send key13=1 */ - - yahoo_p2p_write_pkt(source, pkt_to_send); /* build raw packet and send */ - yahoo_packet_free(pkt_to_send); -} - -static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *who = NULL; - char *base64 = NULL; - guchar *decoded; - gsize len; - gint val_13 = 0; - gint val_11 = 0; - PurpleAccount *account; - YahooFriend *f; - - /* if status is not 1 ie YAHOO_STATUS_BRB, the packet bounced back, so contains our own ip */ - if(!(pkt->status == YAHOO_STATUS_BRB)) - return ; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 5: - /* our identity */ - break; - case 4: - who = pair->value; - break; - case 1: - /* who again, the master identity this time? */ - break; - case 12: - base64 = pair->value; - /* so, this is an ip address. in base64. decoded it's in ascii. - after strtol, it's in reversed byte order. Who thought this up?*/ - break; - case 13: - val_13 = strtol(pair->value, NULL, 10); - break; - case 11: - val_11 = strtol(pair->value, NULL, 10); /* session id of peer */ - if( (f = yahoo_friend_find(gc, who)) ) - f->session_id = val_11; - break; - /* - TODO: figure these out - yahoo: Key: 61 Value: 0 - yahoo: Key: 2 Value: - yahoo: Key: 13 Value: 0 packet count ?? - yahoo: Key: 49 Value: PEERTOPEER - yahoo: Key: 140 Value: 1 - */ - - } - - l = l->next; - } - - if (base64) { - guint32 ip; - YahooFriend *f; - char *host_ip; - struct yahoo_p2p_data *p2p_data; - - decoded = purple_base64_decode(base64, &len); - if (len) { - char *tmp = purple_str_binary_to_ascii(decoded, len); - purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); - g_free(tmp); - } - - ip = strtol((gchar *)decoded, NULL, 10); - g_free(decoded); - host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, - (ip >> 24) & 0xff); - f = yahoo_friend_find(gc, who); - if (f) - yahoo_friend_set_ip(f, host_ip); - purple_debug_info("yahoo", "IP : %s\n", host_ip); - - account = purple_connection_get_account(gc); - - if(val_11==0) { - if(!f) - return; - else - val_11 = f->session_id; - } - - p2p_data = g_new0(struct yahoo_p2p_data, 1); - p2p_data->host_username = g_strdup(who); - p2p_data->val_13 = val_13; - p2p_data->session_id = val_11; - p2p_data->host_ip = host_ip; - p2p_data->gc = gc; - p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT; - p2p_data->source = -1; - - /* connect to host */ - if((purple_proxy_connect(gc, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) { - purple_debug_info("yahoo","p2p: Connection to %s failed\n", host_ip); - g_free(p2p_data->host_ip); - g_free(p2p_data->host_username); - g_free(p2p_data); - } - } -} - -static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - char *who = NULL, *msg = NULL, *id = NULL; - GSList *l = pkt->hash; - - account = purple_connection_get_account(gc); - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - break; - case 5: - /* us */ - break; - case 230: - /* the audible, in foo.locale.bar.baz format - eg: base.tw.smiley.smiley43 */ - id = pair->value; - break; - case 231: - /* the text of the audible */ - msg = pair->value; - break; - case 232: - /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */ - break; - } - - l = l->next; - } - - if (!msg) - msg = id; - if (!who || !msg) - return; - if (!g_utf8_validate(msg, -1, NULL)) { - purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); - return; - } - if (!purple_privacy_check(account, who)) { - purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", - purple_account_get_username(account), who); - return; - } - if (id) { - /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */ - char **audible_locale = g_strsplit(id, ".", 0); - char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg); - g_strfreev(audible_locale); - - serv_got_im(gc, who, buf, 0, time(NULL)); - g_free(buf); - } else - serv_got_im(gc, who, msg, 0, time(NULL)); -} - -static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - switch (pkt->service) { - case YAHOO_SERVICE_LOGON: - case YAHOO_SERVICE_LOGOFF: - case YAHOO_SERVICE_ISAWAY: - case YAHOO_SERVICE_ISBACK: - case YAHOO_SERVICE_GAMELOGON: - case YAHOO_SERVICE_GAMELOGOFF: - case YAHOO_SERVICE_CHATLOGON: - case YAHOO_SERVICE_CHATLOGOFF: - case YAHOO_SERVICE_Y6_STATUS_UPDATE: - case YAHOO_SERVICE_STATUS_15: - yahoo_process_status(gc, pkt); - break; - case YAHOO_SERVICE_NOTIFY: - yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER); - break; - case YAHOO_SERVICE_MESSAGE: - case YAHOO_SERVICE_GAMEMSG: - case YAHOO_SERVICE_CHATMSG: - yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER); - break; - case YAHOO_SERVICE_SYSMESSAGE: - yahoo_process_sysmessage(gc, pkt); - break; - case YAHOO_SERVICE_NEWMAIL: - yahoo_process_mail(gc, pkt); - break; - case YAHOO_SERVICE_NEWCONTACT: - yahoo_process_contact(gc, pkt); - break; - case YAHOO_SERVICE_AUTHRESP: - yahoo_process_authresp(gc, pkt); - break; - case YAHOO_SERVICE_LIST: - yahoo_process_list(gc, pkt); - break; - case YAHOO_SERVICE_LIST_15: - yahoo_process_list_15(gc, pkt); - break; - case YAHOO_SERVICE_AUTH: - yahoo_process_auth(gc, pkt); - break; - case YAHOO_SERVICE_AUTH_REQ_15: - yahoo_buddy_auth_req_15(gc, pkt); - break; - case YAHOO_SERVICE_ADDBUDDY: - yahoo_process_addbuddy(gc, pkt); - break; - case YAHOO_SERVICE_IGNORECONTACT: - yahoo_process_ignore(gc, pkt); - break; - case YAHOO_SERVICE_CONFINVITE: - case YAHOO_SERVICE_CONFADDINVITE: - yahoo_process_conference_invite(gc, pkt); - break; - case YAHOO_SERVICE_CONFDECLINE: - yahoo_process_conference_decline(gc, pkt); - break; - case YAHOO_SERVICE_CONFLOGON: - yahoo_process_conference_logon(gc, pkt); - break; - case YAHOO_SERVICE_CONFLOGOFF: - yahoo_process_conference_logoff(gc, pkt); - break; - case YAHOO_SERVICE_CONFMSG: - yahoo_process_conference_message(gc, pkt); - break; - case YAHOO_SERVICE_CHATONLINE: - yahoo_process_chat_online(gc, pkt); - break; - case YAHOO_SERVICE_CHATLOGOUT: - yahoo_process_chat_logout(gc, pkt); - break; - case YAHOO_SERVICE_CHATGOTO: - yahoo_process_chat_goto(gc, pkt); - break; - case YAHOO_SERVICE_CHATJOIN: - yahoo_process_chat_join(gc, pkt); - break; - case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */ - case YAHOO_SERVICE_CHATEXIT: - yahoo_process_chat_exit(gc, pkt); - break; - case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */ - case YAHOO_SERVICE_CHATADDINVITE: - yahoo_process_chat_addinvite(gc, pkt); - break; - case YAHOO_SERVICE_COMMENT: - yahoo_process_chat_message(gc, pkt); - break; - case YAHOO_SERVICE_PRESENCE_PERM: - case YAHOO_SERVICE_PRESENCE_SESSION: - yahoo_process_presence(gc, pkt); - break; - case YAHOO_SERVICE_P2PFILEXFER: - /* This case had no break and continued; thus keeping it this way.*/ - yahoo_process_p2p(gc, pkt); /* P2PFILEXFER handled the same way as process_p2p */ - yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */ - case YAHOO_SERVICE_FILETRANSFER: - yahoo_process_filetransfer(gc, pkt); - break; - case YAHOO_SERVICE_PEERTOPEER: - yahoo_process_p2p(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE: - yahoo_process_picture(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE_CHECKSUM: - yahoo_process_picture_checksum(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE_UPLOAD: - yahoo_process_picture_upload(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE_UPDATE: - case YAHOO_SERVICE_AVATAR_UPDATE: - yahoo_process_avatar_update(gc, pkt); - break; - case YAHOO_SERVICE_AUDIBLE: - yahoo_process_audible(gc, pkt); - break; - case YAHOO_SERVICE_CONTACT_DETAILS: - yahoo_process_contact_details(gc, pkt); - break; - case YAHOO_SERVICE_FILETRANS_15: - yahoo_process_filetrans_15(gc, pkt); - break; - case YAHOO_SERVICE_FILETRANS_INFO_15: - yahoo_process_filetrans_info_15(gc, pkt); - break; - case YAHOO_SERVICE_FILETRANS_ACC_15: - yahoo_process_filetrans_acc_15(gc, pkt); - break; - case YAHOO_SERVICE_SMS_MSG: - yahoo_process_sms_message(gc, pkt); - break; - - default: - purple_debug_error("yahoo", "Unhandled service 0x%02x\n", pkt->service); - break; - } -} - -static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; - char buf[1024]; - int len; - - len = read(yd->fd, buf, sizeof(buf)); - - if (len < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - gc->last_received = time(NULL); - yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); - memcpy(yd->rxqueue + yd->rxlen, buf, len); - yd->rxlen += len; - - while (1) { - struct yahoo_packet *pkt; - int pos = 0; - int pktlen; - - if (yd->rxlen < YAHOO_PACKET_HDRLEN) - return; - - if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { - /* HEY! This isn't even a YMSG packet. What - * are you trying to pull? */ - guchar *start; - - purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n"); - - start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); - if (start) { - g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); - yd->rxlen -= start - yd->rxqueue; - continue; - } else { - g_free(yd->rxqueue); - yd->rxqueue = NULL; - yd->rxlen = 0; - return; - } - } - - pos += 4; /* YMSG */ - pos += 2; - pos += 2; - - pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; - purple_debug_misc("yahoo", "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); - - if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) - return; - - yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); - - pkt = yahoo_packet_new(0, 0, 0); - - pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; - pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; - purple_debug_misc("yahoo", "Yahoo Service: 0x%02x Status: %d\n", - pkt->service, pkt->status); - pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; - - yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); - - yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; - if (yd->rxlen) { - guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen); - g_free(yd->rxqueue); - yd->rxqueue = tmp; - } else { - g_free(yd->rxqueue); - yd->rxqueue = NULL; - } - - yahoo_packet_process(gc, pkt); - - yahoo_packet_free(pkt); - } -} - -static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - YahooData *yd; - struct yahoo_packet *pkt; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - yd = gc->proto_data; - yd->fd = source; - - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); - - yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); - yahoo_packet_send_and_free(pkt, yd); - - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); -} - -#ifdef TRY_WEBMESSENGER_LOGIN -static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - YahooData *yd; - struct yahoo_packet *pkt; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - yd = gc->proto_data; - yd->fd = source; - - pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); - - yahoo_packet_hash(pkt, "sss", 0, - purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), - 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), - 6, yd->auth); - yahoo_packet_send_and_free(pkt, yd); - - g_free(yd->auth); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); -} - -static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - char bufread[2048], *i = bufread, *buf = bufread; - int len; - GString *s; - - len = read(source, bufread, sizeof(bufread) - 1); - - if (len < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) { - yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); - memcpy(yd->rxqueue + yd->rxlen, buf, len); - yd->rxlen += len; - i = buf = (char *)yd->rxqueue; - len = yd->rxlen; - } - buf[len] = '\0'; - - if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && - strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Received unexpected HTTP response from server")); - purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf); - return; - } - - s = g_string_sized_new(len); - - while ((i = strstr(i, "Set-Cookie: "))) { - - i += strlen("Set-Cookie: "); - for (;*i != ';' && *i != '\0'; i++) - g_string_append_c(s, *i); - - g_string_append(s, "; "); - /* Should these cookies be included too when trying for xfer? - * It seems to work without these - */ - } - - yd->auth = g_string_free(s, FALSE); - purple_input_remove(gc->inpa); - close(source); - g_free(yd->rxqueue); - yd->rxqueue = NULL; - yd->rxlen = 0; - /* Now we have our cookies to login with. I'll go get the milk. */ - if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", - purple_account_get_int(account, "port", YAHOO_PAGER_PORT), - yahoo_got_web_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } -} - -static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc; - YahooData *yd; - int written, remaining; - - gc = data; - yd = gc->proto_data; - - remaining = strlen(yd->auth) - yd->auth_written; - written = write(source, yd->auth + yd->auth_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - gchar *tmp; - g_free(yd->auth); - yd->auth = NULL; - if (gc->inpa) - purple_input_remove(gc->inpa); - gc->inpa = 0; - tmp = g_strdup_printf(_("Lost connection with %s: %s"), - "login.yahoo.com:80", g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (written < remaining) { - yd->auth_written += written; - return; - } - - g_free(yd->auth); - yd->auth = NULL; - yd->auth_written = 0; - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); -} - -static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to establish a connection with %s: %s"), - "login.yahoo.com:80", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (gc->inpa == 0) - { - gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_got_cookies_send_cb, gc); - yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) -{ - if (!strcmp(key, "passwd") || !strcmp(key, "login")) - return; - g_string_append_c(url, '&'); - g_string_append(url, key); - g_string_append_c(url, '='); - if (!strcmp(key, ".save") || !strcmp(key, ".js")) - g_string_append_c(url, '1'); - else if (!strcmp(key, ".challenge")) - g_string_append(url, val); - else - g_string_append(url, purple_url_encode(val)); -} - -static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) -{ - GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - const char *c = buf; - char *d; - char name[64], value[64]; - int count; - int input_len = strlen(" ((c - buf) + input_len)) - && (c = strstr(c, " ((c - buf) + 1)) && *c!='"' - && count; c++, d++, count--) - *d = *c; - *d = '\0'; - count = sizeof(value)-1; - if (!(d = g_strstr_len(c, len - (c - buf), "value=\""))) - continue; - d += value_len; - if (strchr(c, '>') < d) - break; - for (c = d, d = value; (len > ((c - buf) + 1)) - && *c!='"' && count; c++, d++, count--) - *d = *c; - *d = '\0'; - g_hash_table_insert(hash, g_strdup(name), g_strdup(value)); - } - return hash; -} - -static void -yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - PurpleConnection *gc = (PurpleConnection *)user_data; - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - const char *sn = purple_account_get_username(account); - const char *pass = purple_connection_get_password(gc); - GHashTable *hash = yahoo_login_page_hash(url_text, len); - GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); - char md5[33], *hashp = md5, *chal; - int i; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; - - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (error_message != NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - error_message); - return; - } - - url = g_string_append(url, sn); - url = g_string_append(url, "&passwd="); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - for (i = 0; i < 16; ++i) { - g_snprintf(hashp, 3, "%02x", digest[i]); - hashp += 2; - } - - chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)chal, strlen(chal)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - hashp = md5; - for (i = 0; i < 16; ++i) { - g_snprintf(hashp, 3, "%02x", digest[i]); - hashp += 2; - } - /* - * I dunno why this is here and commented out.. but in case it's needed - * I updated it.. - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, md5, strlen(md5)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - hashp = md5; - for (i = 0; i < 16; ++i) { - g_snprintf(hashp, 3, "%02x", digest[i]); - hashp += 2; - } - */ - g_free(chal); - - url = g_string_append(url, md5); - g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url); - - url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" - "Host: login.yahoo.com\r\n\r\n"); - g_hash_table_destroy(hash); - yd->auth = g_string_free(url, FALSE); - if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - - purple_cipher_context_destroy(context); -} -#endif /* TRY_WEBMESSENGER_LOGIN */ - -static void yahoo_server_check(PurpleAccount *account) -{ - const char *server; - - server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST); - - if (*server == '\0' || g_str_equal(server, "scs.yahoo.com") || - g_str_equal(server, "scs.msg.yahoo.com")) - purple_account_set_string(account, "server", YAHOO_PAGER_HOST); -} - -static void yahoo_picture_check(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - - yahoo_set_buddy_icon(gc, img); - purple_imgstore_unref(img); -} - -static int get_yahoo_status_from_purple_status(PurpleStatus *status) -{ - PurplePresence *presence; - const char *status_id; - const char *msg; - - presence = purple_status_get_presence(status); - status_id = purple_status_get_id(status); - msg = purple_status_get_attr_string(status, "message"); - - if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { - if ((msg != NULL) && (*msg != '\0')) - return YAHOO_STATUS_CUSTOM; - else - return YAHOO_STATUS_AVAILABLE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) { - return YAHOO_STATUS_BRB; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) { - return YAHOO_STATUS_BUSY; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) { - return YAHOO_STATUS_NOTATHOME; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) { - return YAHOO_STATUS_NOTATDESK; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) { - return YAHOO_STATUS_NOTINOFFICE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) { - return YAHOO_STATUS_ONPHONE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) { - return YAHOO_STATUS_ONVACATION; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) { - return YAHOO_STATUS_OUTTOLUNCH; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) { - return YAHOO_STATUS_STEPPEDOUT; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { - return YAHOO_STATUS_INVISIBLE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { - return YAHOO_STATUS_CUSTOM; - } else if (purple_presence_is_idle(presence)) { - return YAHOO_STATUS_IDLE; - } else { - purple_debug_error("yahoo", "Unexpected PurpleStatus!\n"); - return YAHOO_STATUS_AVAILABLE; - } -} - -void yahoo_login(PurpleAccount *account) { - PurpleConnection *gc = purple_account_get_connection(account); - YahooData *yd = gc->proto_data = g_new0(YahooData, 1); - PurpleStatus *status = purple_account_get_active_status(account); - const char *server = NULL; - int pager_port = 0; - - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; - - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - - purple_connection_set_display_name(gc, purple_account_get_username(account)); - - yd->gc = gc; - yd->yahoo_local_p2p_server_fd = -1; - yd->fd = -1; - yd->txhandler = 0; - /* TODO: Is there a good grow size for the buffer? */ - yd->txbuf = purple_circ_buffer_new(0); - yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); - yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - yahoo_p2p_disconnect_destroy_data); - yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, - yahoo_p2p_keepalive, gc); - yd->confs = NULL; - yd->conf_id = 2; - yd->last_keepalive = yd->last_ping = time(NULL); - - yd->current_status = get_yahoo_status_from_purple_status(status); - yd->jp = yahoo_is_japan(account); - - yahoo_server_check(account); - yahoo_picture_check(account); - - server = purple_account_get_string(account, "server", - yd->jp ? YAHOOJP_PAGER_HOST : YAHOO_PAGER_HOST); - pager_port = purple_account_get_int(account, "port", YAHOO_PAGER_PORT); - - if (purple_proxy_connect(gc, account, server, pager_port, yahoo_got_connected, gc) == NULL) - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - - return; -} - -void yahoo_close(PurpleConnection *gc) { - YahooData *yd = (YahooData *)gc->proto_data; - GSList *l; - - if (gc->inpa) - purple_input_remove(gc->inpa); - - while (yd->url_datas) { - purple_util_fetch_url_cancel(yd->url_datas->data); - yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); - } - - for (l = yd->confs; l; l = l->next) { - PurpleConversation *conv = l->data; - - yahoo_conf_leave(yd, purple_conversation_get_name(conv), - purple_connection_get_display_name(gc), - purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))); - } - g_slist_free(yd->confs); - - for (l = yd->cookies; l; l = l->next) { - g_free(l->data); - l->data=NULL; - } - g_slist_free(yd->cookies); - - yd->chat_online = FALSE; - if (yd->in_chat) - yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ - - purple_timeout_remove(yd->yahoo_p2p_timer); - if(yd->yahoo_p2p_server_timeout_handle != 0) { - purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); - yd->yahoo_p2p_server_timeout_handle = 0; - } - - /* close p2p server if it is waiting for a peer to connect */ - if (yd->yahoo_p2p_server_watcher) { - purple_input_remove(yd->yahoo_p2p_server_watcher); - yd->yahoo_p2p_server_watcher = 0; - } - if (yd->yahoo_local_p2p_server_fd >= 0) { - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; - } - - g_hash_table_destroy(yd->sms_carrier); - g_hash_table_destroy(yd->peers); - g_hash_table_destroy(yd->friends); - g_hash_table_destroy(yd->imvironments); - g_hash_table_destroy(yd->xfer_peer_idstring_map); - g_free(yd->chat_name); - - g_free(yd->cookie_y); - g_free(yd->cookie_t); - - if (yd->txhandler) - purple_input_remove(yd->txhandler); - - purple_circ_buffer_destroy(yd->txbuf); - - if (yd->fd >= 0) - close(yd->fd); - - g_free(yd->rxqueue); - yd->rxlen = 0; - g_free(yd->picture_url); - - if (yd->buddy_icon_connect_data) - purple_proxy_connect_cancel(yd->buddy_icon_connect_data); - if (yd->picture_upload_todo) - yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); - if (yd->ycht) - ycht_connection_close(yd->ycht); - - g_free(yd->pending_chat_room); - g_free(yd->pending_chat_id); - g_free(yd->pending_chat_topic); - g_free(yd->pending_chat_goto); - g_strfreev(yd->profiles); - - yahoo_personal_details_reset(&yd->ypd, TRUE); - - g_free(yd->current_list15_grp); - - g_free(yd); - gc->proto_data = NULL; -} - -const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "yahoo"; -} - -const char *yahoo_list_emblem(PurpleBuddy *b) -{ - PurpleAccount *account; - PurpleConnection *gc; - YahooData *yd; - YahooFriend *f; - PurplePresence *presence; - - if (!b || !(account = purple_buddy_get_account(b)) || - !(gc = purple_account_get_connection(account)) || - !(yd = gc->proto_data)) - return NULL; - - f = yahoo_friend_find(gc, purple_buddy_get_name(b)); - if (!f) { - return "not-authorized"; - } - - presence = purple_buddy_get_presence(b); - - if (purple_presence_is_online(presence)) { - if (yahoo_friend_get_game(f)) - return "game"; - - if (f->fed) - return "external"; - } - return NULL; -} - -static const char *yahoo_get_status_string(enum yahoo_status a) -{ - switch (a) { - case YAHOO_STATUS_BRB: - return _("Be Right Back"); - case YAHOO_STATUS_BUSY: - return _("Busy"); - case YAHOO_STATUS_NOTATHOME: - return _("Not at Home"); - case YAHOO_STATUS_NOTATDESK: - return _("Not at Desk"); - case YAHOO_STATUS_NOTINOFFICE: - return _("Not in Office"); - case YAHOO_STATUS_ONPHONE: - return _("On the Phone"); - case YAHOO_STATUS_ONVACATION: - return _("On Vacation"); - case YAHOO_STATUS_OUTTOLUNCH: - return _("Out to Lunch"); - case YAHOO_STATUS_STEPPEDOUT: - return _("Stepped Out"); - case YAHOO_STATUS_INVISIBLE: - return _("Invisible"); - case YAHOO_STATUS_IDLE: - return _("Idle"); - case YAHOO_STATUS_OFFLINE: - return _("Offline"); - default: - return _("Available"); - } -} - -static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { - - PurpleBuddy *buddy; - PurpleConnection *gc; - - GHashTable *components; - YahooData *yd; - int id; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = gc->proto_data; - id = yd->conf_id; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(components, g_strdup("room"), - g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id)); - g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); - g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); - yahoo_c_join(gc, components); - g_hash_table_destroy(components); - - yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy)); -} - -static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { - PurpleBuddy *buddy; - PurpleConnection *gc; - int presence_val = GPOINTER_TO_INT(data); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val); -} - -static void yahoo_game(PurpleBlistNode *node, gpointer data) { - - PurpleBuddy *buddy; - PurpleConnection *gc; - - YahooData *yd; - const char *game; - char *game2; - char *t; - char url[256]; - YahooFriend *f; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = (YahooData *) gc->proto_data; - - f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); - if (!f) - return; - - game = yahoo_friend_get_game(f); - if (!game) - return; - - t = game2 = g_strdup(strstr(game, "ante?room=")); - while (*t && *t != '\t') - t++; - *t = 0; - g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); - purple_notify_uri(gc, url); - g_free(game2); -} - -char *yahoo_status_text(PurpleBuddy *b) -{ - YahooFriend *f = NULL; - const char *msg; - char *msg2; - PurpleAccount *account; - PurpleConnection *gc; - - account = purple_buddy_get_account(b); - gc = purple_account_get_connection(account); - if (!gc || !purple_connection_get_protocol_data(gc)) - return NULL; - - f = yahoo_friend_find(gc, purple_buddy_get_name(b)); - if (!f) - return g_strdup(_("Not on server list")); - - switch (f->status) { - case YAHOO_STATUS_AVAILABLE: - return NULL; - case YAHOO_STATUS_IDLE: - if (f->idle == -1) - return g_strdup(yahoo_get_status_string(f->status)); - return NULL; - case YAHOO_STATUS_CUSTOM: - if (!(msg = yahoo_friend_get_status_message(f))) - return NULL; - msg2 = g_markup_escape_text(msg, strlen(msg)); - purple_util_chrreplace(msg2, '\n', ' '); - return msg2; - - default: - return g_strdup(yahoo_get_status_string(f->status)); - } -} - -void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - YahooFriend *f; - char *escaped; - char *status = NULL; - const char *presence = NULL; - PurpleAccount *account; - - account = purple_buddy_get_account(b); - f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); - if (!f) - status = g_strdup_printf("\n%s", _("Not on server list")); - else { - switch (f->status) { - case YAHOO_STATUS_CUSTOM: - if (!yahoo_friend_get_status_message(f)) - return; - status = g_strdup(yahoo_friend_get_status_message(f)); - break; - case YAHOO_STATUS_OFFLINE: - break; - default: - status = g_strdup(yahoo_get_status_string(f->status)); - break; - } - - switch (f->presence) { - case YAHOO_PRESENCE_ONLINE: - presence = _("Appear Online"); - break; - case YAHOO_PRESENCE_PERM_OFFLINE: - presence = _("Appear Permanently Offline"); - break; - case YAHOO_PRESENCE_DEFAULT: - break; - default: - purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n"); - break; - } - } - - if (status != NULL) { - escaped = g_markup_escape_text(status, strlen(status)); - purple_notify_user_info_add_pair(user_info, _("Status"), escaped); - g_free(status); - g_free(escaped); - } - - if (presence != NULL) - purple_notify_user_info_add_pair(user_info, _("Presence"), presence); - - if (f && full) { - YahooPersonalDetails *ypd = &f->ypd; - int i; - struct { - char *id; - char *text; - char *value; - } yfields[] = { - {"hp", N_("Home Phone Number"), ypd->phone.home}, - {"wp", N_("Work Phone Number"), ypd->phone.work}, - {"mo", N_("Mobile Phone Number"), ypd->phone.mobile}, - {NULL, NULL, NULL} - }; - for (i = 0; yfields[i].id; i++) { - if (!yfields[i].value || !*yfields[i].value) - continue; - purple_notify_user_info_add_pair(user_info, _(yfields[i].text), yfields[i].value); - } - } -} - -static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - yahoo_add_buddy(gc, buddy, NULL); -} - - -static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - yahoo_chat_goto(gc, purple_buddy_get_name(buddy)); -} - -static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { - GList *m = NULL; - PurpleMenuAction *act; - YahooData *yd = (YahooData *) gc->proto_data; - - if (yd->current_status == YAHOO_STATUS_INVISIBLE) { - if (f->presence != YAHOO_PRESENCE_ONLINE) { - act = purple_menu_action_new(_("Appear Online"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), - NULL); - m = g_list_append(m, act); - } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { - act = purple_menu_action_new(_("Appear Offline"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), - NULL); - m = g_list_append(m, act); - } - } - - if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { - act = purple_menu_action_new(_("Don't Appear Permanently Offline"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), - NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Appear Permanently Offline"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), - NULL); - m = g_list_append(m, act); - } - - return m; -} - -static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - - yahoo_doodle_initiate(gc, purple_buddy_get_name(b)); -} - -static void -yahoo_userinfo_blist_node(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - - yahoo_set_userinfo_for_buddy(gc, b); -} - -static GList *yahoo_buddy_menu(PurpleBuddy *buddy) -{ - GList *m = NULL; - PurpleMenuAction *act; - - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - YahooData *yd = gc->proto_data; - static char buf2[1024]; - YahooFriend *f; - - f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); - - if (!f && !yd->wm) { - act = purple_menu_action_new(_("Add Buddy"), - PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb), - NULL, NULL); - m = g_list_append(m, act); - - return m; - - } - - if (f && f->status != YAHOO_STATUS_OFFLINE && f->fed == YAHOO_FEDERATION_NONE) { - if (!yd->wm) { - act = purple_menu_action_new(_("Join in Chat"), - PURPLE_CALLBACK(yahoo_chat_goto_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - act = purple_menu_action_new(_("Initiate Conference"), - PURPLE_CALLBACK(yahoo_initiate_conference), - NULL, NULL); - m = g_list_append(m, act); - - if (yahoo_friend_get_game(f)) { - const char *game = yahoo_friend_get_game(f); - char *room; - char *t; - - if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */ - while (*room && *room != '\t') /* skip to the tab */ - room++; - t = room++; /* room as now at the name */ - while (*t != '\n') - t++; /* replace the \n with a space */ - *t = ' '; - g_snprintf(buf2, sizeof buf2, "%s", room); - - act = purple_menu_action_new(buf2, - PURPLE_CALLBACK(yahoo_game), - NULL, NULL); - m = g_list_append(m, act); - } - } - } - - if (f) { - act = purple_menu_action_new(_("Presence Settings"), NULL, NULL, - build_presence_submenu(f, gc)); - m = g_list_append(m, act); - - if (f->fed == YAHOO_FEDERATION_NONE) { - act = purple_menu_action_new(_("Start Doodling"), - PURPLE_CALLBACK(yahoo_doodle_blist_node), - NULL, NULL); - m = g_list_append(m, act); - } - - act = purple_menu_action_new(_("Set User Info..."), - PURPLE_CALLBACK(yahoo_userinfo_blist_node), - NULL, NULL); - m = g_list_append(m, act); - } - - return m; -} - -GList *yahoo_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return yahoo_buddy_menu((PurpleBuddy *) node); - } else { - return NULL; - } -} - -static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) -{ - YahooData *yd = gc->proto_data; - const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; - - struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 3, name); - yahoo_packet_send_and_free(pkt, yd); - - purple_connection_set_display_name(gc, name); -} - -static void -yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *token, size_t len, const gchar *error_message) -{ - PurpleConnection *gc = user_data; - gboolean set_cookie = FALSE; - gchar *url; - YahooData *yd = gc->proto_data; - - g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (error_message != NULL) - purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message); - else if (len > 0 && token && *token) { - /* Should we not be hardcoding the rd url? */ - url = g_strdup_printf( - "http://login.yahoo.com/config/reset_cookies_token?" - ".token=%s" - "&.done=http://us.rd.yahoo.com/messenger/client/%%3fhttp://mail.yahoo.com/", - token); - set_cookie = TRUE; - } - - if (!set_cookie) { - purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n"); - url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); - } - - /* Open the mailbox with the parsed url data */ - purple_notify_uri(gc, url); - - g_free(url); -} - - -static void yahoo_show_inbox(PurplePluginAction *action) -{ - /* Setup a cookie that can be used by the browser */ - /* XXX I have no idea how this will work with Yahoo! Japan. */ - - PurpleConnection *gc = action->context; - YahooData *yd = gc->proto_data; - - PurpleUtilFetchUrlData *url_data; - const char* base_url = "http://login.yahoo.com"; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - gchar *request = g_strdup_printf( - "POST %s/config/cookie_token HTTP/1.0\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: login.yahoo.com\r\n" - "Content-Length: 0\r\n\r\n", - use_whole_url ? base_url : "", - yd->cookie_t, yd->cookie_y); - - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), base_url, use_whole_url, - YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, - yahoo_get_inbox_token_cb, gc); - - g_free(request); - - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - else { - const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); - purple_debug_error("yahoo", - "Unable to request mail login token; forwarding to login screen."); - purple_notify_uri(gc, yahoo_mail_url); - } -} - -static void -yahoo_set_userinfo_fn(PurplePluginAction *action) -{ - yahoo_set_userinfo(action->context); -} - -static void yahoo_show_act_id(PurplePluginAction *action) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - PurpleConnection *gc = (PurpleConnection *) action->context; - YahooData *yd = purple_connection_get_protocol_data(gc); - const char *name = purple_connection_get_display_name(gc); - int iter; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - field = purple_request_field_choice_new("id", "Activate which ID?", 0); - purple_request_field_group_add_field(group, field); - - for (iter = 0; yd->profiles[iter]; iter++) { - purple_request_field_choice_add(field, yd->profiles[iter]); - if (purple_strequal(yd->profiles[iter], name)) - purple_request_field_choice_set_default_value(field, iter); - } - - purple_request_fields(gc, NULL, _("Select the ID you want to activate"), NULL, - fields, - _("OK"), G_CALLBACK(yahoo_act_id), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void yahoo_show_chat_goto(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, NULL, _("Join whom in chat?"), NULL, - "", FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(yahoo_chat_goto), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -GList *yahoo_actions(PurplePlugin *plugin, gpointer context) { - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set User Info..."), - yahoo_set_userinfo_fn); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Activate ID..."), - yahoo_show_act_id); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Join User in Chat..."), - yahoo_show_chat_goto); - m = g_list_append(m, act); - - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Inbox"), - yahoo_show_inbox); - m = g_list_append(m, act); - - return m; -} - -struct yahoo_sms_carrier_cb_data { - PurpleConnection *gc; - char *who; - char *what; -}; - -static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *webdata, size_t len, const gchar *error_message) -{ - struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; - PurpleConnection *gc = sms_cb_data->gc; - YahooData *yd = gc->proto_data; - char *status = NULL; - char *carrier = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); - - if (error_message != NULL) { - purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - - g_free(sms_cb_data->who); - g_free(sms_cb_data->what); - g_free(sms_cb_data); - return ; - } - else if (len > 0 && webdata && *webdata) { - xmlnode *validate_data_root = xmlnode_from_str(webdata, -1); - xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no"); - const char *mobile_no = xmlnode_get_attrib(validate_data_child, "msisdn"); - - validate_data_root = xmlnode_copy(validate_data_child); - validate_data_child = xmlnode_get_child(validate_data_root, "status"); - status = xmlnode_get_data(validate_data_child); - - validate_data_child = xmlnode_get_child(validate_data_root, "carrier"); - carrier = xmlnode_get_data(validate_data_child); - - purple_debug_info("yahoo","SMS validate data: Mobile:%s, Status:%s, Carrier:%s\n", mobile_no, status, carrier); - - if( strcmp(status, "Valid") == 0) { - g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup(carrier)); - yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, sms_cb_data->what, PURPLE_MESSAGE_SEND); - } - else { - g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup("Unknown")); - purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - xmlnode_free(validate_data_child); - xmlnode_free(validate_data_root); - g_free(sms_cb_data->who); - g_free(sms_cb_data->what); - g_free(sms_cb_data); - g_free(status); - g_free(carrier); - } -} - -static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) -{ - YahooData *yd = gc->proto_data; - PurpleUtilFetchUrlData *url_data; - struct yahoo_sms_carrier_cb_data *sms_cb_data; - char *validate_request_str = NULL; - char *request = NULL; - gboolean use_whole_url = FALSE; - xmlnode *validate_request_root = NULL; - xmlnode *validate_request_child = NULL; - - if(!(sms_cb_data = data)) - return; - - validate_request_root = xmlnode_new("validate"); - xmlnode_set_attrib(validate_request_root, "intl", "us"); - xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION); - xmlnode_set_attrib(validate_request_root, "qos", "0"); - - validate_request_child = xmlnode_new_child(validate_request_root, "mobile_no"); - xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1); - - validate_request_str = xmlnode_to_str(validate_request_root, NULL); - - xmlnode_free(validate_request_child); - xmlnode_free(validate_request_root); - - request = g_strdup_printf( - "POST /mobileno?intl=us&version=%s HTTP/1.1\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: validate.msg.yahoo.com\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "Cache-Control: no-cache\r\n\r\n%s", - YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); - - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; - - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, - YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, - yahoo_get_sms_carrier_cb, data); - - g_free(request); - g_free(validate_request_str); - - if (!url_data) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); - purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(sms_cb_data->who); - g_free(sms_cb_data->what); - g_free(sms_cb_data); - } -} - -int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt = NULL; - char *msg = yahoo_html_to_codes(what); - char *msg2; - gboolean utf8 = TRUE; - PurpleWhiteboard *wb; - int ret = 1; - const char *fed_who; - gsize lenb = 0; - glong lenc = 0; - struct yahoo_p2p_data *p2p_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - msg2 = yahoo_string_encode(gc, msg, &utf8); - - if(msg2) { - lenb = strlen(msg2); - lenc = g_utf8_strlen(msg2, -1); - - if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) { - purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT - " bytes, %ld characters. Max is %d bytes, %d chars." - " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES, - YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2); - g_free(msg); - g_free(msg2); - return -E2BIG; - } - } - - fed = yahoo_get_federation_from_name(who); - - if (who[0] == '+') { - /* we have an sms to be sent */ - gchar *carrier = NULL; - const char *alias = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); - - carrier = g_hash_table_lookup(yd->sms_carrier, who); - if (!carrier) { - struct yahoo_sms_carrier_cb_data *sms_cb_data; - sms_cb_data = g_malloc(sizeof(struct yahoo_sms_carrier_cb_data)); - sms_cb_data->gc = gc; - sms_cb_data->who = g_strdup(who); - sms_cb_data->what = g_strdup(what); - - purple_conversation_write(conv, NULL, _("Getting mobile carrier to send the SMS."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - - yahoo_get_sms_carrier(gc, sms_cb_data); - - g_free(msg); - g_free(msg2); - return ret; - } - else if( strcmp(carrier,"Unknown") == 0 ) { - purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - - g_free(msg); - g_free(msg2); - return -1; - } - - alias = purple_account_get_alias(account); - pkt = yahoo_packet_new(YAHOO_SERVICE_SMS_MSG, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sssss", - 1, purple_connection_get_display_name(gc), - 69, alias, - 5, who + 1, - 68, carrier, - 14, msg2); - yahoo_packet_send_and_free(pkt, yd); - - g_free(msg); - g_free(msg2); - - return ret; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, yd->session_id); - fed_who = who; - switch (fed) { - case YAHOO_FEDERATION_MSN: - case YAHOO_FEDERATION_OCS: - case YAHOO_FEDERATION_IBM: - fed_who += 4; - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, fed_who); - if (fed) - yahoo_packet_hash_int(pkt, 241, fed); - - if (utf8) - yahoo_packet_hash_str(pkt, 97, "1"); - yahoo_packet_hash_str(pkt, 14, msg2); - - /* - * IMVironment. - * - * If this message is to a user who is also Doodling with the local user, - * format the chat packet with the correct IMV information (thanks Yahoo!) - * - * Otherwise attempt to use the same IMVironment as the remote user, - * just so that we don't inadvertantly reset their IMVironment back - * to nothing. - * - * If they have not set an IMVironment, then use the default. - */ - wb = purple_whiteboard_get_session(gc->account, who); - if (wb) - yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); - else - { - const char *imv; - imv = g_hash_table_lookup(yd->imvironments, who); - if (imv != NULL) - yahoo_packet_hash_str(pkt, 63, imv); - else - yahoo_packet_hash_str(pkt, 63, ";0"); - } - - yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ - yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ - if (!yd->picture_url) - yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ - else - yahoo_packet_hash_str(pkt, 206, "2"); - - /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ - if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) { - /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */ - if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) { - yahoo_packet_hash_int(pkt, 11, p2p_data->session_id); - yahoo_p2p_write_pkt(p2p_data->source, pkt); - } - else { - yahoo_packet_send(pkt, yd); - if(!fed) - yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */ - } - } - else - ret = -E2BIG; - - yahoo_packet_free(pkt); - - g_free(msg); - g_free(msg2); - - return ret; -} - -unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - YahooData *yd = gc->proto_data; - struct yahoo_p2p_data *p2p_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - struct yahoo_packet *pkt = NULL; - - fed = yahoo_get_federation_from_name(who); - - /* Don't do anything if sms is being typed */ - if( strncmp(who, "+", 1) == 0 ) - return 0; - - pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, yd->session_id); - - /* check to see if p2p link exists, send through it */ - if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) { - yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc), - 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", - 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */ - yahoo_p2p_write_pkt(p2p_data->source, pkt); - yahoo_packet_free(pkt); - } - else { /* send through yahoo server */ - - const char *fed_who = who; - switch (fed) { - case YAHOO_FEDERATION_MSN: - case YAHOO_FEDERATION_OCS: - case YAHOO_FEDERATION_IBM: - fed_who += 4; - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - - yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), - 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", - 5, fed_who, 1002, "1"); - if (fed) - yahoo_packet_hash_int(pkt, 241, fed); - yahoo_packet_send_and_free(pkt, yd); - } - - return 0; -} - -static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data) -{ - YahooFriend *f = value; - if (f && f->presence == YAHOO_PRESENCE_ONLINE) - f->presence = YAHOO_PRESENCE_DEFAULT; -} - -void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - PurplePresence *presence; - YahooData *yd; - struct yahoo_packet *pkt; - int old_status; - const char *msg = NULL; - char *tmp = NULL; - char *conv_msg = NULL; - gboolean utf8 = TRUE; - - if (!purple_status_is_active(status)) - return; - - gc = purple_account_get_connection(account); - presence = purple_status_get_presence(status); - yd = (YahooData *)gc->proto_data; - old_status = yd->current_status; - - yd->current_status = get_yahoo_status_from_purple_status(status); - - if (yd->current_status == YAHOO_STATUS_CUSTOM) - { - msg = purple_status_get_attr_string(status, "message"); - - if (purple_status_is_available(status)) { - tmp = yahoo_string_encode(gc, msg, &utf8); - conv_msg = purple_markup_strip_html(tmp); - g_free(tmp); - } else { - if ((msg == NULL) || (*msg == '\0')) - msg = _("Away"); - tmp = yahoo_string_encode(gc, msg, &utf8); - conv_msg = purple_markup_strip_html(tmp); - g_free(tmp); - } - } - - if (yd->current_status == YAHOO_STATUS_INVISIBLE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 13, "2"); - yahoo_packet_send_and_free(pkt, yd); - - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_int(pkt, 10, yd->current_status); - - if (yd->current_status == YAHOO_STATUS_CUSTOM) { - yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); - yahoo_packet_hash_str(pkt, 19, conv_msg); - } else { - yahoo_packet_hash_str(pkt, 19, ""); - } - - g_free(conv_msg); - - if (purple_presence_is_idle(presence)) - yahoo_packet_hash_str(pkt, 47, "2"); - else { - if (!purple_status_is_available(status)) - yahoo_packet_hash_str(pkt, 47, "1"); - else - yahoo_packet_hash_str(pkt, 47, "0"); - } - - yahoo_packet_send_and_free(pkt, yd); - - if (old_status == YAHOO_STATUS_INVISIBLE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 13, "1"); - yahoo_packet_send_and_free(pkt, yd); - - /* Any per-session presence settings are removed */ - g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL); - - } -} - -void yahoo_set_idle(PurpleConnection *gc, int idle) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt = NULL; - char *msg = NULL, *msg2 = NULL; - PurpleStatus *status = NULL; - gboolean invisible = FALSE; - - if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) - yd->current_status = YAHOO_STATUS_IDLE; - else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { - status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); - yd->current_status = get_yahoo_status_from_purple_status(status); - } - - invisible = (yd->current_status == YAHOO_STATUS_INVISIBLE); - - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); - - if (!idle && invisible) - yahoo_packet_hash_int(pkt, 10, YAHOO_STATUS_AVAILABLE); - else - yahoo_packet_hash_int(pkt, 10, yd->current_status); - - if (yd->current_status == YAHOO_STATUS_CUSTOM) { - const char *tmp; - if (status == NULL) - status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); - tmp = purple_status_get_attr_string(status, "message"); - if (tmp != NULL) { - gboolean utf8 = TRUE; - msg = yahoo_string_encode(gc, tmp, &utf8); - msg2 = purple_markup_strip_html(msg); - yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); - yahoo_packet_hash_str(pkt, 19, msg2); - } else { - /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for - * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ - yahoo_packet_hash_str(pkt, 19, _("Away")); - } - } else { - yahoo_packet_hash_str(pkt, 19, ""); - } - - if (idle) - yahoo_packet_hash_str(pkt, 47, "2"); - - yahoo_packet_send_and_free(pkt, yd); - - g_free(msg); - g_free(msg2); -} - -GList *yahoo_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE); - types = g_list_append(types, type); - - - type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, type); - - return types; -} - -void yahoo_keepalive(PurpleConnection *gc) -{ - struct yahoo_packet *pkt; - YahooData *yd = gc->proto_data; - time_t now = time(NULL); - - /* We're only allowed to send a ping once an hour or the servers will boot us */ - if ((now - yd->last_ping) >= PING_TIMEOUT) { - yd->last_ping = now; - - /* The native client will only send PING or CHATPING */ - if (yd->chat_online) { - if (yd->wm) { - ycht_chat_send_keepalive(yd->ycht); - } else { - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc)); - yahoo_packet_send_and_free(pkt, yd); - } - } else { - pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_send_and_free(pkt, yd); - } - } - - if ((now - yd->last_keepalive) >= KEEPALIVE_TIMEOUT) { - yd->last_keepalive = now; - pkt = yahoo_packet_new(YAHOO_SERVICE_KEEPALIVE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); - yahoo_packet_send_and_free(pkt, yd); - } - -} - -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) -{ - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - const char *group = NULL; - char *group2; - YahooFriend *f; - const char *bname; - const char *fed_bname; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - if (!yd->logged_in) - return; - - fed_bname = bname = purple_buddy_get_name(buddy); - if (!purple_privacy_check(purple_connection_get_account(gc), bname)) - return; - - f = yahoo_friend_find(gc, bname); - fed = yahoo_get_federation_from_name(bname); - if (fed != YAHOO_FEDERATION_NONE) - fed_bname += 4; - - g = purple_buddy_get_group(buddy); - if (g) - group = purple_group_get_name(g); - else - group = "Buddies"; - - group2 = yahoo_string_encode(gc, group, NULL); - pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); - if (fed) { - yahoo_packet_hash(pkt, "sssssssisss", - 14, "", - 65, group2, - 97, "1", - 1, purple_connection_get_display_name(gc), - 302, "319", - 300, "319", - 7, fed_bname, - 241, fed, - 334, "0", - 301, "319", - 303, "319" - ); - } - else { - yahoo_packet_hash(pkt, "ssssssssss", - 14, "", - 65, group2, - 97, "1", - 1, purple_connection_get_display_name(gc), - 302, "319", - 300, "319", - 7, fed_bname, - 334, "0", - 301, "319", - 303, "319" - ); - } - - yahoo_packet_send_and_free(pkt, yd); - g_free(group2); -} - -void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - GSList *buddies, *l; - PurpleGroup *g; - gboolean remove = TRUE; - char *cg; - const char *bname, *gname; - YahooFriend *f = NULL; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - bname = purple_buddy_get_name(buddy); - f = yahoo_friend_find(gc, bname); - if (!f) - return; - fed = f->fed; - - gname = purple_group_get_name(group); - buddies = purple_find_buddies(purple_connection_get_account(gc), bname); - for (l = buddies; l; l = l->next) { - g = purple_buddy_get_group(l->data); - if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) { - remove = FALSE; - break; - } - } - - g_slist_free(buddies); - - if (remove) { - g_hash_table_remove(yd->friends, bname); - f = NULL; /* f no longer valid - Just making it clear */ - } - - cg = yahoo_string_encode(gc, gname, NULL); - pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); - - switch (fed) { - case YAHOO_FEDERATION_MSN: - case YAHOO_FEDERATION_OCS: - case YAHOO_FEDERATION_IBM: - bname += 4; - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), - 7, bname, 65, cg); - if (fed) - yahoo_packet_hash_int(pkt, 241, fed); - yahoo_packet_send_and_free(pkt, yd); - g_free(cg); -} - -void yahoo_add_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - if (!yd->logged_in) - return; - - if (!who || who[0] == '\0') - return; - - fed = yahoo_get_federation_from_name(who); - - pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id); - - if(fed) - yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "1"); - else - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "1"); - - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_rem_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - if (!yd->logged_in) - return; - - if (!who || who[0] == '\0') - return; - fed = yahoo_get_federation_from_name(who); - - pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id); - - if(fed) - yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "2"); - else - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2"); - - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_set_permit_deny(PurpleConnection *gc) -{ - PurpleAccount *account; - GSList *deny; - - account = purple_connection_get_account(gc); - - switch (account->perm_deny) - { - case PURPLE_PRIVACY_ALLOW_ALL: - for (deny = account->deny; deny; deny = deny->next) - yahoo_rem_deny(gc, deny->data); - break; - - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - case PURPLE_PRIVACY_ALLOW_USERS: - case PURPLE_PRIVACY_DENY_USERS: - case PURPLE_PRIVACY_DENY_ALL: - for (deny = account->deny; deny; deny = deny->next) - yahoo_add_deny(gc, deny->data); - break; - } -} - -void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, - const char *old_group, const char *new_group) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *gpn, *gpo; - YahooFriend *f = yahoo_friend_find(gc, who); - const char *temp = NULL; - - /* Step 0: If they aren't on the server list anyway, - * don't bother letting the server know. - */ - if (!f) - return; - - if(f->fed) { - temp = who+4; - } else - temp = who; - - /* If old and new are the same, we would probably - * end up deleting the buddy, which would be bad. - * This might happen because of the charset conversation. - */ - gpn = yahoo_string_encode(gc, new_group, NULL); - gpo = yahoo_string_encode(gc, old_group, NULL); - if (!strcmp(gpn, gpo)) { - g_free(gpn); - g_free(gpo); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - if(f->fed) - yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc), - 302, "240", 300, "240", 7, temp, 241, f->fed, 224, gpo, 264, gpn, 301, - "240", 303, "240"); - else - yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), - 302, "240", 300, "240", 7, temp, 224, gpo, 264, gpn, 301, - "240", 303, "240"); - yahoo_packet_send_and_free(pkt, yd); - - g_free(gpn); - g_free(gpo); -} - -void yahoo_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *gpn, *gpo; - - gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); - gpo = yahoo_string_encode(gc, old_name, NULL); - if (!strcmp(gpn, gpo)) { - g_free(gpn); - g_free(gpo); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), - 65, gpo, 67, gpn); - yahoo_packet_send_and_free(pkt, yd); - g_free(gpn); - g_free(gpo); -} - -/********************************* Commands **********************************/ - -PurpleCmdRet -yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { - PurpleAccount *account = purple_conversation_get_account(c); - - if (*args && args[0]) - return PURPLE_CMD_RET_FAILED; - - purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ); - - return PURPLE_CMD_RET_OK; -} - -PurpleCmdRet -yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, - char **args, char **error, void *data) -{ - GHashTable *comp; - PurpleConnection *gc; - YahooData *yd; - int id; - - if (!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - gc = purple_conversation_get_gc(conv); - yd = gc->proto_data; - id = yd->conf_id; - purple_debug_info("yahoo", "Trying to join %s \n", args[0]); - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1)); - g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); - - yahoo_c_join(gc, comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -PurpleCmdRet -yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, - char **args, char **error, void *data) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - if (*args && args[0]) - return PURPLE_CMD_RET_FAILED; - purple_roomlist_show_with_account(account); - return PURPLE_CMD_RET_OK; -} - -gboolean yahoo_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type) -{ - PurpleConversation *c; - - c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - username, gc->account); - - g_return_val_if_fail(c != NULL, FALSE); - - purple_debug_info("yahoo", "Sending on account %s to buddy %s.\n", - username, c->name); - purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "", PURPLE_MESSAGE_INVISIBLE); - - return TRUE; -} - -GList *yahoo_attention_types(PurpleAccount *account) -{ - static GList *list = NULL; - - if (!list) { - /* Yahoo only supports one attention command: the 'buzz'. */ - /* This is index number YAHOO_BUZZ. */ - list = g_list_append(list, purple_attention_type_new("Buzz", _("Buzz"), - _("%s has buzzed you!"), _("Buzzing %s..."))); - } - - return list; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/libymsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ -/** - * @file libymsg.h The Yahoo! and Yahoo! JAPAN Protocol Plugins - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _LIBYMSG_H_ -#define _LIBYMSG_H_ - -#include "circbuffer.h" -#include "cmds.h" -#include "prpl.h" - -#define YAHOO_PAGER_HOST "scsa.msg.yahoo.com" -#define YAHOO_PAGER_PORT 5050 -#define YAHOO_PAGER_PORT_P2P 5101 -#define YAHOO_LOGIN_URL "https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=&token=%s" -#define YAHOO_TOKEN_URL "https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=&login=%s&passwd=%s&chal=%s" -#define YAHOO_P2P_KEEPALIVE_SECS 300 -#define YAHOO_P2P_SERVER_TIMEOUT 10 -#define YAHOO_PROFILE_URL "http://profiles.yahoo.com/" -#define YAHOO_MAIL_URL "http://rd.yahoo.com/messenger/client/?http://mail.yahoo.com/" -#define YAHOO_XFER_HOST "filetransfer.msg.yahoo.com" -#define YAHOO_XFER_PORT 80 -#define YAHOO_XFER_RELAY_HOST "relay.msg.yahoo.com" -#define YAHOO_XFER_RELAY_PORT 80 -#define YAHOO_ROOMLIST_URL "http://insider.msg.yahoo.com/ycontent/" -#define YAHOO_ROOMLIST_LOCALE "us" -/* really we should get the list of servers from - http://update.messenger.yahoo.co.jp/servers.html */ -#define YAHOOJP_PAGER_HOST "cs.yahoo.co.jp" -#define YAHOOJP_TOKEN_URL "https://login.yahoo.co.jp/config/pwtoken_get?src=ymsgr&ts=&login=%s&passwd=%s&chal=%s" -#define YAHOOJP_LOGIN_URL "https://login.yahoo.co.jp/config/pwtoken_login?src=ymsgr&ts=&token=%s" -#define YAHOOJP_PROFILE_URL "http://profiles.yahoo.co.jp/" -#define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/" -#define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp" -#define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp" -/* not sure, must test: */ -#define YAHOOJP_XFER_RELAY_HOST "relay.msg.yahoo.co.jp" -#define YAHOOJP_XFER_RELAY_PORT 80 -#define YAHOOJP_ROOMLIST_URL "http://insider.msg.yahoo.co.jp/ycontent/" -#define YAHOOJP_ROOMLIST_LOCALE "ja" - -#define YAHOO_AUDIBLE_URL "http://us.dl1.yimg.com/download.yahoo.com/dl/aud" - -#define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" - -#define YAHOO_SMS_CARRIER_URL "http://lookup.msg.vip.mud.yahoo.com" - -#define YAHOO_USERINFO_URL "http://address.yahoo.com/yab/us?v=XM&sync=1&tags=short&useutf8=1&noclear=1&legenc=codepage-1252" -#define YAHOOJP_USERINFO_URL "http://address.yahoo.co.jp/yab/jp?v=XM&sync=1&tags=short&useutf8=1&noclear=1&legenc=codepage-1252" - -#define YAHOO_PICURL_SETTING "picture_url" -#define YAHOO_PICCKSUM_SETTING "picture_checksum" -#define YAHOO_PICEXPIRE_SETTING "picture_expire" - -#define YAHOO_STATUS_TYPE_OFFLINE "offline" -#define YAHOO_STATUS_TYPE_AVAILABLE "available" -#define YAHOO_STATUS_TYPE_BRB "brb" -#define YAHOO_STATUS_TYPE_BUSY "busy" -#define YAHOO_STATUS_TYPE_NOTATHOME "notathome" -#define YAHOO_STATUS_TYPE_NOTATDESK "notatdesk" -#define YAHOO_STATUS_TYPE_NOTINOFFICE "notinoffice" -#define YAHOO_STATUS_TYPE_ONPHONE "onphone" -#define YAHOO_STATUS_TYPE_ONVACATION "onvacation" -#define YAHOO_STATUS_TYPE_OUTTOLUNCH "outtolunch" -#define YAHOO_STATUS_TYPE_STEPPEDOUT "steppedout" -#define YAHOO_STATUS_TYPE_AWAY "away" -#define YAHOO_STATUS_TYPE_INVISIBLE "invisible" -#define YAHOO_STATUS_TYPE_MOBILE "mobile" - -#define YAHOO_CLIENT_VERSION_ID "4194239" -#define YAHOO_CLIENT_VERSION "9.0.0.2162" - -#define YAHOOJP_CLIENT_VERSION_ID "4194239" -#define YAHOOJP_CLIENT_VERSION "9.0.0.2162" - -#define YAHOO_CLIENT_USERAGENT "Mozilla/5.0" - -/* Index into attention types list. */ -#define YAHOO_BUZZ 0 - -typedef enum { - YAHOO_PKT_TYPE_SERVER = 0, - YAHOO_PKT_TYPE_P2P -} yahoo_pkt_type; - -typedef enum { - YAHOO_P2P_WE_ARE_CLIENT =0, - YAHOO_P2P_WE_ARE_SERVER -} yahoo_p2p_connection_type; - -enum yahoo_status { - YAHOO_STATUS_AVAILABLE = 0, - YAHOO_STATUS_BRB, - YAHOO_STATUS_BUSY, - YAHOO_STATUS_NOTATHOME, - YAHOO_STATUS_NOTATDESK, - YAHOO_STATUS_NOTINOFFICE, - YAHOO_STATUS_ONPHONE, - YAHOO_STATUS_ONVACATION, - YAHOO_STATUS_OUTTOLUNCH, - YAHOO_STATUS_STEPPEDOUT, - YAHOO_STATUS_INVISIBLE = 12, - YAHOO_STATUS_CUSTOM = 99, - YAHOO_STATUS_IDLE = 999, - YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, - YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ - YAHOO_STATUS_TYPING = 0x16, - YAHOO_STATUS_DISCONNECTED = 0xffffffff /* in ymsg 15. doesnt mean the normal sense of 'disconnected' */ -}; - -/* - * Yahoo federated networks. Key 241 in ymsg. - * If it doesn't exist, it is on Yahoo's netowrk. - * It if does exist, send to another IM network. - */ - -typedef enum { - YAHOO_FEDERATION_NONE = 0, /* No federation - Yahoo! network */ - YAHOO_FEDERATION_OCS = 1, /* LCS or OCS private networks */ - YAHOO_FEDERATION_MSN = 2, /* MSN or Windows Live network */ - YAHOO_FEDERATION_IBM = 9 /* IBM/Sametime network */ -} YahooFederation; - - -struct yahoo_buddy_icon_upload_data { - PurpleConnection *gc; - GString *str; - char *filename; - int pos; - int fd; - guint watcher; -}; - -struct yahoo_p2p_data { - PurpleConnection *gc; - char *host_ip; - char *host_username; - int val_13; - guint input_event; - gint source; - int session_id; - yahoo_p2p_connection_type connection_type; -}; - -struct _YchtConn; - -typedef struct _YahooPersonalDetails { - char *id; - - struct { - char *first; - char *last; - char *middle; - char *nick; - } names; - - struct { - char *work; - char *home; - char *mobile; - } phone; -} YahooPersonalDetails; - -typedef struct { - PurpleConnection *gc; - int fd; - guchar *rxqueue; - int rxlen; - PurpleCircBuffer *txbuf; - guint txhandler; - GHashTable *friends; - - char **profiles; /* Multiple profiles can be associated with an account */ - YahooPersonalDetails ypd; - - /** - * This is used to keep track of the IMVironment chosen - * by people you talk to. We don't do very much with - * this right now... but at least now if the remote user - * selects an IMVironment we won't reset it back to the - * default of nothing. - */ - GHashTable *imvironments; - - int current_status; - gboolean logged_in; - GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist; - GSList *confs; - unsigned int conf_id; /* just a counter */ - gboolean chat_online; - gboolean in_chat; - char *chat_name; - char *pending_chat_room; - char *pending_chat_id; - char *pending_chat_topic; - char *pending_chat_goto; - char *auth; - gsize auth_written; - char *cookie_y; - char *cookie_t; - int session_id; - gboolean jp; - gboolean wm; /* connected w/ web messenger method */ - /* picture aka buddy icon stuff */ - char *picture_url; - int picture_checksum; - - /* ew. we have to check the icon before we connect, - * but can't upload it til we're connected. */ - struct yahoo_buddy_icon_upload_data *picture_upload_todo; - PurpleProxyConnectData *buddy_icon_connect_data; - - struct _YchtConn *ycht; - - /** - * This linked list contains PurpleUtilFetchUrlData structs - * for when we lookup people profile or photo information. - */ - GSList *url_datas; - GHashTable *xfer_peer_idstring_map;/* Hey, i dont know, but putting this HashTable next to friends gives a run time fault... */ - GSList *cookies;/* contains all cookies, including _y and _t */ - - /** - * We may receive a list15 in multiple packets with no prior warning as to how many we'll be getting; - * the server expects us to keep track of the group for which it is sending us contact names. - */ - char *current_list15_grp; - time_t last_ping; - time_t last_keepalive; - GHashTable *peers; /* information about p2p data */ - int yahoo_p2p_timer; - int yahoo_local_p2p_server_fd; - int yahoo_p2p_server_watcher; - GHashTable *sms_carrier; /* sms carrier data */ - guint yahoo_p2p_server_timeout_handle; -} YahooData; - -#define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) - -/* - * Current Maximum Length for Instant Messages - * - * This was found by experiment. - * - * The YMSG protocol allows a message of up to 948 bytes, but the official client - * limits to 800 characters. According to experiments I conducted, it seems that - * the discrepancy is to allow some leeway for messages with mixed single- and - * multi-byte characters, as I was able to send messages of 840 and 932 bytes - * by using some multibyte characters (some random Chinese or Japanese characters, - * to be precise). - rekkanoryo - */ -#define YAHOO_MAX_MESSAGE_LENGTH_BYTES 948 -#define YAHOO_MAX_MESSAGE_LENGTH_CHARS 800 - -/* sometimes i wish prpls could #include things from other prpls. then i could just - * use the routines from libfaim and not have to admit to knowing how they work. */ -#define yahoo_put16(buf, data) ( \ - (*(buf) = (unsigned char)((data)>>8)&0xff), \ - (*((buf)+1) = (unsigned char)(data)&0xff), \ - 2) -#define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) -#define yahoo_put32(buf, data) ( \ - (*((buf)) = (unsigned char)((data)>>24)&0xff), \ - (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ - (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ - (*((buf)+3) = (unsigned char)(data)&0xff), \ - 4) -#define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \ - (((*((buf)+1))<<16)&0x00ff0000) + \ - (((*((buf)+2))<< 8)&0x0000ff00) + \ - (((*((buf)+3) )&0x000000ff))) - -/* util.c */ -void yahoo_init_colorht(void); -void yahoo_dest_colorht(void); -char *yahoo_codes_to_html(const char *x); - -/** - * This function takes a normal HTML message and converts it to the message - * format used by Yahoo, which uses a frankensteinish combination of ANSI - * escape codes and broken HTML. - * - * It results in slightly different output than would be sent by official - * Yahoo clients. The two main differences are: - * - * 1. We always close all tags, whereas official Yahoo clients leave tags - * dangling open at the end of each message (and the client treats them - * as closed). - * 2. We always close inner tags first before closing outter tags. - * - * For example, if you want to send this message: - * bold bolditalic italic - * Official Yahoo clients would send: - * ESC[1m bold ESC[2m bolditalic ESC[x1m italic - * But we will send: - * ESC[1m bold ESC[2m bolditalic ESC[x2mESC[x1mESC[2m italic ESC[x2m - */ -char *yahoo_html_to_codes(const char *src); - -gboolean -yahoo_account_use_http_proxy(PurpleConnection *conn); - -/** - * Encode some text to send to the yahoo server. - * - * @param gc The connection handle. - * @param str The null terminated utf8 string to encode. - * @param utf8 If not @c NULL, whether utf8 is okay or not. - * Even if it is okay, we may not use it. If we - * used it, we set this to @c TRUE, else to - * @c FALSE. If @c NULL, false is assumed, and - * it is not dereferenced. - * @return The g_malloced string in the appropriate encoding. - */ -char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8); - -/** - * Decode some text received from the server. - * - * @param gc The gc handle. - * @param str The null terminated string to decode. - * @param utf8 Did the server tell us it was supposed to be utf8? - * @return The decoded, utf-8 string, which must be g_free()'d. - */ -char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8); - -char *yahoo_convert_to_numeric(const char *str); - -YahooFederation yahoo_get_federation_from_name(const char *who); - -/* yahoo_profile.c */ -void yahoo_get_info(PurpleConnection *gc, const char *name); - -/* libymsg.h - these functions were formerly static but need not to be for the - * new two-prpl model. */ -const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b); -const char *yahoo_list_emblem(PurpleBuddy *b); -char *yahoo_status_text(PurpleBuddy *b); -void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -GList *yahoo_status_types(PurpleAccount *account); -GList *yahoo_blist_node_menu(PurpleBlistNode *node); -void yahoo_login(PurpleAccount *account); -void yahoo_close(PurpleConnection *gc); -int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags); -unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state); -void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); -void yahoo_set_idle(PurpleConnection *gc, int idle); -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g); -void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void yahoo_add_deny(PurpleConnection *gc, const char *who); -void yahoo_rem_deny(PurpleConnection *gc, const char *who); -void yahoo_set_permit_deny(PurpleConnection *gc); -void yahoo_keepalive(PurpleConnection *gc); -void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group); -void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies); -gboolean yahoo_offline_message(const PurpleBuddy *buddy); -gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type); -GList *yahoo_attention_types(PurpleAccount *account); - -GList *yahoo_actions(PurplePlugin *plugin, gpointer context); -void yahoopurple_register_commands(void); - -PurpleCmdRet yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data); -PurpleCmdRet yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data); -PurpleCmdRet yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data); -/* needed for xfer, thought theyd be useful for other enhancements later on - Returns list of cookies stored in yahoo_data formatted as a single null terminated string - returned value must be g_freed -*/ -gchar* yahoo_get_cookies(PurpleConnection *gc); - -/* send p2p pkt containing our encoded ip, asking peer to connect to us */ -void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13); - -#endif /* _LIBYMSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -YAHOOSOURCES = \ - libymsg.c \ - libymsg.h \ - util.c \ - yahoochat.h \ - yahoochat.c \ - yahoo_aliases.c \ - yahoo_aliases.h \ - yahoo_doodle.h \ - yahoo_doodle.c \ - yahoo_filexfer.h \ - yahoo_filexfer.c \ - yahoo_friend.h \ - yahoo_friend.c \ - yahoo_packet.h \ - yahoo_packet.c \ - yahoo_picture.c \ - yahoo_picture.h \ - yahoo_profile.c \ - ycht.c \ - ycht.h - -AM_CFLAGS = $(st) - -libyahoo_la_LDFLAGS = -module -avoid-version -libyahoojp_la_LDFLAGS = -module -avoid-version - -if STATIC_YAHOO - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libymsg.la -libymsg_la_SOURCES = $(YAHOOSOURCES) libyahoo.c libyahoojp.c -libymsg_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libymsg.la libyahoo.la libyahoojp.la - -libymsg_la_SOURCES = $(YAHOOSOURCES) -libymsg_la_LIBADD = $(GLIB_LIBS) - -libyahoo_la_SOURCES = libyahoo.c -libyahoo_la_LIBADD = libymsg.la - -libyahoojp_la_SOURCES = libyahoojp.c -libyahoojp_la_LIBADD = libymsg.la - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,888 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/yahoo -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -@STATIC_YAHOO_FALSE@libyahoo_la_DEPENDENCIES = libymsg.la -am__libyahoo_la_SOURCES_DIST = libyahoo.c -@STATIC_YAHOO_FALSE@am_libyahoo_la_OBJECTS = libyahoo.lo -libyahoo_la_OBJECTS = $(am_libyahoo_la_OBJECTS) -@STATIC_YAHOO_FALSE@am_libyahoo_la_rpath = -rpath $(pkgdir) -@STATIC_YAHOO_FALSE@libyahoojp_la_DEPENDENCIES = libymsg.la -am__libyahoojp_la_SOURCES_DIST = libyahoojp.c -@STATIC_YAHOO_FALSE@am_libyahoojp_la_OBJECTS = libyahoojp.lo -libyahoojp_la_OBJECTS = $(am_libyahoojp_la_OBJECTS) -@STATIC_YAHOO_FALSE@am_libyahoojp_la_rpath = -rpath $(pkgdir) -am__DEPENDENCIES_1 = -@STATIC_YAHOO_FALSE@libymsg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libymsg_la_SOURCES_DIST = libymsg.c libymsg.h util.c yahoochat.h \ - yahoochat.c yahoo_aliases.c yahoo_aliases.h yahoo_doodle.h \ - yahoo_doodle.c yahoo_filexfer.h yahoo_filexfer.c \ - yahoo_friend.h yahoo_friend.c yahoo_packet.h yahoo_packet.c \ - yahoo_picture.c yahoo_picture.h yahoo_profile.c ycht.c ycht.h \ - libyahoo.c libyahoojp.c -am__objects_1 = libymsg_la-libymsg.lo libymsg_la-util.lo \ - libymsg_la-yahoochat.lo libymsg_la-yahoo_aliases.lo \ - libymsg_la-yahoo_doodle.lo libymsg_la-yahoo_filexfer.lo \ - libymsg_la-yahoo_friend.lo libymsg_la-yahoo_packet.lo \ - libymsg_la-yahoo_picture.lo libymsg_la-yahoo_profile.lo \ - libymsg_la-ycht.lo -@STATIC_YAHOO_FALSE@am_libymsg_la_OBJECTS = $(am__objects_1) -@STATIC_YAHOO_TRUE@am_libymsg_la_OBJECTS = $(am__objects_1) \ -@STATIC_YAHOO_TRUE@ libymsg_la-libyahoo.lo \ -@STATIC_YAHOO_TRUE@ libymsg_la-libyahoojp.lo -libymsg_la_OBJECTS = $(am_libymsg_la_OBJECTS) -@STATIC_YAHOO_FALSE@am_libymsg_la_rpath = -rpath $(pkgdir) -@STATIC_YAHOO_TRUE@am_libymsg_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libyahoo_la_SOURCES) $(libyahoojp_la_SOURCES) \ - $(libymsg_la_SOURCES) -DIST_SOURCES = $(am__libyahoo_la_SOURCES_DIST) \ - $(am__libyahoojp_la_SOURCES_DIST) \ - $(am__libymsg_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -YAHOOSOURCES = \ - libymsg.c \ - libymsg.h \ - util.c \ - yahoochat.h \ - yahoochat.c \ - yahoo_aliases.c \ - yahoo_aliases.h \ - yahoo_doodle.h \ - yahoo_doodle.c \ - yahoo_filexfer.h \ - yahoo_filexfer.c \ - yahoo_friend.h \ - yahoo_friend.c \ - yahoo_packet.h \ - yahoo_packet.c \ - yahoo_picture.c \ - yahoo_picture.h \ - yahoo_profile.c \ - ycht.c \ - ycht.h - -AM_CFLAGS = $(st) -libyahoo_la_LDFLAGS = -module -avoid-version -libyahoojp_la_LDFLAGS = -module -avoid-version -@STATIC_YAHOO_FALSE@st = -@STATIC_YAHOO_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_YAHOO_TRUE@noinst_LTLIBRARIES = libymsg.la -@STATIC_YAHOO_FALSE@libymsg_la_SOURCES = $(YAHOOSOURCES) -@STATIC_YAHOO_TRUE@libymsg_la_SOURCES = $(YAHOOSOURCES) libyahoo.c libyahoojp.c -@STATIC_YAHOO_TRUE@libymsg_la_CFLAGS = $(AM_CFLAGS) -@STATIC_YAHOO_FALSE@pkg_LTLIBRARIES = libymsg.la libyahoo.la libyahoojp.la -@STATIC_YAHOO_FALSE@libymsg_la_LIBADD = $(GLIB_LIBS) -@STATIC_YAHOO_FALSE@libyahoo_la_SOURCES = libyahoo.c -@STATIC_YAHOO_FALSE@libyahoo_la_LIBADD = libymsg.la -@STATIC_YAHOO_FALSE@libyahoojp_la_SOURCES = libyahoojp.c -@STATIC_YAHOO_FALSE@libyahoojp_la_LIBADD = libymsg.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/yahoo/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/yahoo/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libyahoo.la: $(libyahoo_la_OBJECTS) $(libyahoo_la_DEPENDENCIES) - $(LINK) $(am_libyahoo_la_rpath) $(libyahoo_la_LDFLAGS) $(libyahoo_la_OBJECTS) $(libyahoo_la_LIBADD) $(LIBS) -libyahoojp.la: $(libyahoojp_la_OBJECTS) $(libyahoojp_la_DEPENDENCIES) - $(LINK) $(am_libyahoojp_la_rpath) $(libyahoojp_la_LDFLAGS) $(libyahoojp_la_OBJECTS) $(libyahoojp_la_LIBADD) $(LIBS) -libymsg.la: $(libymsg_la_OBJECTS) $(libymsg_la_DEPENDENCIES) - $(LINK) $(am_libymsg_la_rpath) $(libymsg_la_LDFLAGS) $(libymsg_la_OBJECTS) $(libymsg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libyahoo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libyahoojp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-libyahoo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-libyahoojp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-libymsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_aliases.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_doodle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_filexfer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_friend.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_packet.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_picture.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_profile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoochat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-ycht.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libymsg_la-libymsg.lo: libymsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-libymsg.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-libymsg.Tpo" -c -o libymsg_la-libymsg.lo `test -f 'libymsg.c' || echo '$(srcdir)/'`libymsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-libymsg.Tpo" "$(DEPDIR)/libymsg_la-libymsg.Plo"; else rm -f "$(DEPDIR)/libymsg_la-libymsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libymsg.c' object='libymsg_la-libymsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-libymsg.lo `test -f 'libymsg.c' || echo '$(srcdir)/'`libymsg.c - -libymsg_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-util.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-util.Tpo" -c -o libymsg_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-util.Tpo" "$(DEPDIR)/libymsg_la-util.Plo"; else rm -f "$(DEPDIR)/libymsg_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libymsg_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -libymsg_la-yahoochat.lo: yahoochat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoochat.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoochat.Tpo" -c -o libymsg_la-yahoochat.lo `test -f 'yahoochat.c' || echo '$(srcdir)/'`yahoochat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoochat.Tpo" "$(DEPDIR)/libymsg_la-yahoochat.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoochat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoochat.c' object='libymsg_la-yahoochat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoochat.lo `test -f 'yahoochat.c' || echo '$(srcdir)/'`yahoochat.c - -libymsg_la-yahoo_aliases.lo: yahoo_aliases.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_aliases.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_aliases.Tpo" -c -o libymsg_la-yahoo_aliases.lo `test -f 'yahoo_aliases.c' || echo '$(srcdir)/'`yahoo_aliases.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_aliases.Tpo" "$(DEPDIR)/libymsg_la-yahoo_aliases.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_aliases.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_aliases.c' object='libymsg_la-yahoo_aliases.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_aliases.lo `test -f 'yahoo_aliases.c' || echo '$(srcdir)/'`yahoo_aliases.c - -libymsg_la-yahoo_doodle.lo: yahoo_doodle.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_doodle.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_doodle.Tpo" -c -o libymsg_la-yahoo_doodle.lo `test -f 'yahoo_doodle.c' || echo '$(srcdir)/'`yahoo_doodle.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_doodle.Tpo" "$(DEPDIR)/libymsg_la-yahoo_doodle.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_doodle.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_doodle.c' object='libymsg_la-yahoo_doodle.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_doodle.lo `test -f 'yahoo_doodle.c' || echo '$(srcdir)/'`yahoo_doodle.c - -libymsg_la-yahoo_filexfer.lo: yahoo_filexfer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_filexfer.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_filexfer.Tpo" -c -o libymsg_la-yahoo_filexfer.lo `test -f 'yahoo_filexfer.c' || echo '$(srcdir)/'`yahoo_filexfer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_filexfer.Tpo" "$(DEPDIR)/libymsg_la-yahoo_filexfer.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_filexfer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_filexfer.c' object='libymsg_la-yahoo_filexfer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_filexfer.lo `test -f 'yahoo_filexfer.c' || echo '$(srcdir)/'`yahoo_filexfer.c - -libymsg_la-yahoo_friend.lo: yahoo_friend.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_friend.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_friend.Tpo" -c -o libymsg_la-yahoo_friend.lo `test -f 'yahoo_friend.c' || echo '$(srcdir)/'`yahoo_friend.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_friend.Tpo" "$(DEPDIR)/libymsg_la-yahoo_friend.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_friend.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_friend.c' object='libymsg_la-yahoo_friend.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_friend.lo `test -f 'yahoo_friend.c' || echo '$(srcdir)/'`yahoo_friend.c - -libymsg_la-yahoo_packet.lo: yahoo_packet.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_packet.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_packet.Tpo" -c -o libymsg_la-yahoo_packet.lo `test -f 'yahoo_packet.c' || echo '$(srcdir)/'`yahoo_packet.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_packet.Tpo" "$(DEPDIR)/libymsg_la-yahoo_packet.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_packet.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_packet.c' object='libymsg_la-yahoo_packet.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_packet.lo `test -f 'yahoo_packet.c' || echo '$(srcdir)/'`yahoo_packet.c - -libymsg_la-yahoo_picture.lo: yahoo_picture.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_picture.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_picture.Tpo" -c -o libymsg_la-yahoo_picture.lo `test -f 'yahoo_picture.c' || echo '$(srcdir)/'`yahoo_picture.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_picture.Tpo" "$(DEPDIR)/libymsg_la-yahoo_picture.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_picture.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_picture.c' object='libymsg_la-yahoo_picture.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_picture.lo `test -f 'yahoo_picture.c' || echo '$(srcdir)/'`yahoo_picture.c - -libymsg_la-yahoo_profile.lo: yahoo_profile.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_profile.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_profile.Tpo" -c -o libymsg_la-yahoo_profile.lo `test -f 'yahoo_profile.c' || echo '$(srcdir)/'`yahoo_profile.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_profile.Tpo" "$(DEPDIR)/libymsg_la-yahoo_profile.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_profile.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_profile.c' object='libymsg_la-yahoo_profile.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_profile.lo `test -f 'yahoo_profile.c' || echo '$(srcdir)/'`yahoo_profile.c - -libymsg_la-ycht.lo: ycht.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-ycht.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-ycht.Tpo" -c -o libymsg_la-ycht.lo `test -f 'ycht.c' || echo '$(srcdir)/'`ycht.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-ycht.Tpo" "$(DEPDIR)/libymsg_la-ycht.Plo"; else rm -f "$(DEPDIR)/libymsg_la-ycht.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ycht.c' object='libymsg_la-ycht.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-ycht.lo `test -f 'ycht.c' || echo '$(srcdir)/'`ycht.c - -libymsg_la-libyahoo.lo: libyahoo.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-libyahoo.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-libyahoo.Tpo" -c -o libymsg_la-libyahoo.lo `test -f 'libyahoo.c' || echo '$(srcdir)/'`libyahoo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-libyahoo.Tpo" "$(DEPDIR)/libymsg_la-libyahoo.Plo"; else rm -f "$(DEPDIR)/libymsg_la-libyahoo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libyahoo.c' object='libymsg_la-libyahoo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-libyahoo.lo `test -f 'libyahoo.c' || echo '$(srcdir)/'`libyahoo.c - -libymsg_la-libyahoojp.lo: libyahoojp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-libyahoojp.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-libyahoojp.Tpo" -c -o libymsg_la-libyahoojp.lo `test -f 'libyahoojp.c' || echo '$(srcdir)/'`libyahoojp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-libyahoojp.Tpo" "$(DEPDIR)/libymsg_la-libyahoojp.Plo"; else rm -f "$(DEPDIR)/libymsg_la-libyahoojp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libyahoojp.c' object='libymsg_la-libyahoojp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-libyahoojp.lo `test -f 'libyahoojp.c' || echo '$(srcdir)/'`libyahoojp.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libyahoo -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libymsg -YAHOO_TARGET = libyahoo -YAHOOJP_TARGET = libyahoojp -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L. \ - -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = util.c \ - libymsg.c \ - yahoochat.c \ - yahoo_aliases.c \ - yahoo_doodle.c \ - yahoo_filexfer.c \ - yahoo_friend.c \ - yahoo_packet.c \ - yahoo_picture.c \ - yahoo_profile.c \ - ycht.c - -OBJECTS = $(C_SRC:%.c=%.o) - -YAHOO_C_SRC = libyahoo.c -YAHOO_OBJECTS = $(YAHOO_C_SRC:%.c=%.o) - -YAHOOJP_C_SRC = libyahoojp.c -YAHOOJP_OBJECTS = $(YAHOOJP_C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## - -.PHONY: all install clean - -all: $(TARGET).dll $(YAHOO_TARGET).dll $(YAHOOJP_TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(YAHOO_TARGET).dll $(YAHOOJP_TARGET).dll $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll.a $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--output-def,$(TARGET).def,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -$(YAHOO_TARGET).dll: $(TARGET).dll.a $(YAHOO_OBJECTS) - $(CC) -shared $(YAHOO_OBJECTS) $(LIB_PATHS) $(LIBS) -lymsg $(DLL_LD_FLAGS) -o $(YAHOO_TARGET).dll - -$(YAHOOJP_TARGET).dll: $(TARGET).dll.a $(YAHOOJP_OBJECTS) - $(CC) -shared $(YAHOOJP_OBJECTS) $(LIB_PATHS) $(LIBS) -lymsg $(DLL_LD_FLAGS) -o $(YAHOOJP_TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a - rm -f $(YAHOO_OBJECTS) $(YAHOO_TARGET).dll - rm -f $(YAHOOJP_OBJECTS) $(YAHOOJP_TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,936 +0,0 @@ -/* - * purple - * - * Some code copyright 2003 Tim Ringenbach - * (marv on irc.freenode.net) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include "debug.h" -#include "internal.h" -#include "prpl.h" - -#include "libymsg.h" - -#include - -gboolean -yahoo_account_use_http_proxy(PurpleConnection *conn) -{ - PurpleProxyInfo *ppi = purple_proxy_get_setup(conn->account); - return (ppi->type == PURPLE_PROXY_HTTP || ppi->type == PURPLE_PROXY_USE_ENVVAR); -} - -/* - * Returns cookies formatted as a null terminated string for the given connection. - * Must g_free return value. - * - * TODO:will work, but must test for strict correctness - */ -gchar* yahoo_get_cookies(PurpleConnection *gc) -{ - gchar *ans = NULL; - gchar *cur; - char firstflag = 1; - gchar *t1,*t2,*t3; - GSList *tmp; - GSList *cookies; - cookies = ((YahooData*)(gc->proto_data))->cookies; - tmp = cookies; - while(tmp) - { - cur = tmp->data; - t1 = ans; - t2 = g_strrstr(cur, ";expires="); - if(t2 == NULL) - t2 = g_strrstr(cur, "; expires="); - if(t2 == NULL) - { - if(firstflag) - ans = g_strdup_printf("%c=%s", cur[0], cur+2); - else - ans = g_strdup_printf("%s; %c=%s", t1, cur[0], cur+2); - } - else - { - t3 = strstr(t2+1, ";"); - if(t3 != NULL) - { - t2[0] = '\0'; - - if(firstflag) - ans = g_strdup_printf("%c=%s%s", cur[0], cur+2, t3); - else - ans = g_strdup_printf("%s; %c=%s%s", t1, cur[0], cur+2, t3); - - t2[0] = ';'; - } - else - { - t2[0] = '\0'; - - if(firstflag) - ans = g_strdup_printf("%c=%s", cur[0], cur+2); - else - ans = g_strdup_printf("%s; %c=%s", t1, cur[0], cur+2); - - t2[0] = ';'; - } - } - if(firstflag) - firstflag = 0; - else - g_free(t1); - tmp = g_slist_next(tmp); - } - return ans; -} - -/** - * Encode some text to send to the yahoo server. - * - * @param gc The connection handle. - * @param str The null terminated utf8 string to encode. - * @param utf8 If not @c NULL, whether utf8 is okay or not. - * Even if it is okay, we may not use it. If we - * used it, we set this to @c TRUE, else to - * @c FALSE. If @c NULL, false is assumed, and - * it is not dereferenced. - * @return The g_malloced string in the appropriate encoding. - */ -char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) -{ - YahooData *yd = gc->proto_data; - char *ret; - const char *to_codeset; - - if (yd->jp) - return g_strdup(str); - - if (utf8 && *utf8) /* FIXME: maybe don't use utf8 if it'll fit in latin1 */ - return g_strdup(str); - - to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); - ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL); - - if (ret) - return ret; - else - return g_strdup(""); -} - -/** - * Decode some text received from the server. - * - * @param gc The gc handle. - * @param str The null terminated string to decode. - * @param utf8 Did the server tell us it was supposed to be utf8? - * @return The decoded, utf-8 string, which must be g_free()'d. - */ -char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8) -{ - YahooData *yd = gc->proto_data; - char *ret; - const char *from_codeset; - - if (utf8) { - if (g_utf8_validate(str, -1, NULL)) - return g_strdup(str); - } - - if (yd->jp) - from_codeset = "SHIFT_JIS"; - else - from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); - - ret = g_convert_with_fallback(str, -1, "UTF-8", from_codeset, NULL, NULL, NULL, NULL); - - if (ret) - return ret; - else - return g_strdup(""); -} - -char *yahoo_convert_to_numeric(const char *str) -{ - GString *gstr = NULL; - const unsigned char *p; - - gstr = g_string_sized_new(strlen(str) * 6 + 1); - - for (p = (unsigned char *)str; *p; p++) { - g_string_append_printf(gstr, "&#%u;", *p); - } - - return g_string_free(gstr, FALSE); -} - -/* - * The values in this hash table should probably be lowercase, since that's - * what xhtml expects. Also because yahoo_codes_to_html() does - * case-sensitive comparisons. - * - * I found these on some website but i don't know that they actually - * work (or are supposed to work). I didn't implement them yet. - * - * [0;30m ---black - * [1;37m ---white - * [0;37m ---tan - * [0;38m ---light black - * [1;39m ---dark blue - * [0;32m ---green - * [0;33m ---yellow - * [0;35m ---pink - * [1;35m ---purple - * [1;30m ---light blue - * [0;31m ---red - * [0;34m ---blue - * [0;36m ---aqua - * (shift+comma)lyellow(shift+period) ---light yellow - * (shift+comma)lgreen(shift+period) ---light green - * [2;30m <--white out - */ - -static GHashTable *esc_codes_ht = NULL; -static GHashTable *tags_ht = NULL; - -void yahoo_init_colorht() -{ - if (esc_codes_ht != NULL) - /* Hash table has already been initialized */ - return; - - /* Key is the escape code string. Value is the HTML that should be - * inserted in place of the escape code. */ - esc_codes_ht = g_hash_table_new(g_str_hash, g_str_equal); - - /* Key is the name of the HTML tag, for example "font" or "/font" - * value is the HTML that should be inserted in place of the old tag */ - tags_ht = g_hash_table_new(g_str_hash, g_str_equal); - - /* the numbers in comments are what gyach uses, but i think they're incorrect */ -#ifdef USE_CSS_FORMATTING - g_hash_table_insert(esc_codes_ht, "30", ""); /* black */ - g_hash_table_insert(esc_codes_ht, "31", ""); /* blue */ - g_hash_table_insert(esc_codes_ht, "32", ""); /* cyan */ /* 00b2b2 */ - g_hash_table_insert(esc_codes_ht, "33", ""); /* gray */ /* 808080 */ - g_hash_table_insert(esc_codes_ht, "34", ""); /* green */ /* 00c200 */ - g_hash_table_insert(esc_codes_ht, "35", ""); /* pink */ /* ffafaf */ - g_hash_table_insert(esc_codes_ht, "36", ""); /* purple */ /* b200b2 */ - g_hash_table_insert(esc_codes_ht, "37", ""); /* orange */ /* ffff00 */ - g_hash_table_insert(esc_codes_ht, "38", ""); /* red */ - g_hash_table_insert(esc_codes_ht, "39", ""); /* olive */ /* 546b50 */ -#else - g_hash_table_insert(esc_codes_ht, "30", ""); /* black */ - g_hash_table_insert(esc_codes_ht, "31", ""); /* blue */ - g_hash_table_insert(esc_codes_ht, "32", ""); /* cyan */ /* 00b2b2 */ - g_hash_table_insert(esc_codes_ht, "33", ""); /* gray */ /* 808080 */ - g_hash_table_insert(esc_codes_ht, "34", ""); /* green */ /* 00c200 */ - g_hash_table_insert(esc_codes_ht, "35", ""); /* pink */ /* ffafaf */ - g_hash_table_insert(esc_codes_ht, "36", ""); /* purple */ /* b200b2 */ - g_hash_table_insert(esc_codes_ht, "37", ""); /* orange */ /* ffff00 */ - g_hash_table_insert(esc_codes_ht, "38", ""); /* red */ - g_hash_table_insert(esc_codes_ht, "39", ""); /* olive */ /* 546b50 */ -#endif /* !USE_CSS_FORMATTING */ - - g_hash_table_insert(esc_codes_ht, "1", ""); - g_hash_table_insert(esc_codes_ht, "x1", ""); - g_hash_table_insert(esc_codes_ht, "2", ""); - g_hash_table_insert(esc_codes_ht, "x2", ""); - g_hash_table_insert(esc_codes_ht, "4", ""); - g_hash_table_insert(esc_codes_ht, "x4", ""); - - /* these just tell us the text they surround is supposed - * to be a link. purple figures that out on its own so we - * just ignore it. - */ - g_hash_table_insert(esc_codes_ht, "l", ""); /* link start */ - g_hash_table_insert(esc_codes_ht, "xl", ""); /* link end */ - -#ifdef USE_CSS_FORMATTING - g_hash_table_insert(tags_ht, "black", ""); - g_hash_table_insert(tags_ht, "blue", ""); - g_hash_table_insert(tags_ht, "cyan", ""); - g_hash_table_insert(tags_ht, "gray", ""); - g_hash_table_insert(tags_ht, "green", ""); - g_hash_table_insert(tags_ht, "pink", ""); - g_hash_table_insert(tags_ht, "purple", ""); - g_hash_table_insert(tags_ht, "orange", ""); - g_hash_table_insert(tags_ht, "red", ""); - g_hash_table_insert(tags_ht, "yellow", ""); - - g_hash_table_insert(tags_ht, "/black", ""); - g_hash_table_insert(tags_ht, "/blue", ""); - g_hash_table_insert(tags_ht, "/cyan", ""); - g_hash_table_insert(tags_ht, "/gray", ""); - g_hash_table_insert(tags_ht, "/green", ""); - g_hash_table_insert(tags_ht, "/pink", ""); - g_hash_table_insert(tags_ht, "/purple", ""); - g_hash_table_insert(tags_ht, "/orange", ""); - g_hash_table_insert(tags_ht, "/red", ""); - g_hash_table_insert(tags_ht, "/yellow", ""); -#else - g_hash_table_insert(tags_ht, "black", ""); - g_hash_table_insert(tags_ht, "blue", ""); - g_hash_table_insert(tags_ht, "cyan", ""); - g_hash_table_insert(tags_ht, "gray", ""); - g_hash_table_insert(tags_ht, "green", ""); - g_hash_table_insert(tags_ht, "pink", ""); - g_hash_table_insert(tags_ht, "purple", ""); - g_hash_table_insert(tags_ht, "orange", ""); - g_hash_table_insert(tags_ht, "red", ""); - g_hash_table_insert(tags_ht, "yellow", ""); - - g_hash_table_insert(tags_ht, "/black", ""); - g_hash_table_insert(tags_ht, "/blue", ""); - g_hash_table_insert(tags_ht, "/cyan", ""); - g_hash_table_insert(tags_ht, "/gray", ""); - g_hash_table_insert(tags_ht, "/green", ""); - g_hash_table_insert(tags_ht, "/pink", ""); - g_hash_table_insert(tags_ht, "/purple", ""); - g_hash_table_insert(tags_ht, "/orange", ""); - g_hash_table_insert(tags_ht, "/red", ""); - g_hash_table_insert(tags_ht, "/yellow", ""); -#endif /* !USE_CSS_FORMATTING */ - - /* We don't support these tags, so discard them */ - g_hash_table_insert(tags_ht, "alt", ""); - g_hash_table_insert(tags_ht, "fade", ""); - g_hash_table_insert(tags_ht, "snd", ""); - g_hash_table_insert(tags_ht, "/alt", ""); - g_hash_table_insert(tags_ht, "/fade", ""); - - /* Official clients don't seem to send b, i or u tags. They use - * the escape codes listed above. Official clients definitely send - * font tags, though. I wonder if we can remove the opening and - * closing b, i and u tags from here? */ - g_hash_table_insert(tags_ht, "b", ""); - g_hash_table_insert(tags_ht, "i", ""); - g_hash_table_insert(tags_ht, "u", ""); - g_hash_table_insert(tags_ht, "font", ""); - - g_hash_table_insert(tags_ht, "/b", ""); - g_hash_table_insert(tags_ht, "/i", ""); - g_hash_table_insert(tags_ht, "/u", ""); - g_hash_table_insert(tags_ht, "/font", ""); -} - -void yahoo_dest_colorht() -{ - if (esc_codes_ht == NULL) - /* Hash table has already been destroyed */ - return; - - g_hash_table_destroy(esc_codes_ht); - esc_codes_ht = NULL; - g_hash_table_destroy(tags_ht); - tags_ht = NULL; -} - -#ifndef USE_CSS_FORMATTING -static int point_to_html(int x) -{ - if (x < 9) - return 1; - if (x < 11) - return 2; - if (x < 13) - return 3; - if (x < 17) - return 4; - if (x < 25) - return 5; - if (x < 35) - return 6; - return 7; -} -#endif /* !USE_CSS_FORMATTING */ - -static void append_attrs_datalist_foreach_cb(GQuark key_id, gpointer data, gpointer user_data) -{ - const char *key; - const char *value; - xmlnode *cur; - - key = g_quark_to_string(key_id); - value = data; - cur = user_data; - - xmlnode_set_attrib(cur, key, value); -} - -/** - * @param cur A pointer to the position in the XML tree that we're - * currently building. This will be modified when opening a tag - * or closing an existing tag. - */ -static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean is_closing_tag, const gchar *tag_name, gboolean is_font_tag) -{ - if (is_closing_tag) { - xmlnode *tmp; - GSList *dangling_tags = NULL; - - /* Move up the DOM until we find the opening tag */ - for (tmp = *cur; tmp != NULL; tmp = xmlnode_get_parent(tmp)) { - /* Add one to tag_name when doing this comparison because it starts with a / */ - if (g_str_equal(tmp->name, tag_name + 1)) - /* Found */ - break; - dangling_tags = g_slist_prepend(dangling_tags, tmp); - } - if (tmp == NULL) { - /* This is a closing tag with no opening tag. Useless. */ - purple_debug_error("yahoo", "Ignoring unmatched tag %s", tag); - g_slist_free(dangling_tags); - return; - } - - /* Move our current position up, now that we've closed a tag */ - *cur = xmlnode_get_parent(tmp); - - /* Re-open any tags that were nested below the tag we just closed */ - while (dangling_tags != NULL) { - tmp = dangling_tags->data; - dangling_tags = g_slist_delete_link(dangling_tags, dangling_tags); - - /* Create a copy of this tag+attributes (but not child tags or - * data) at our new location */ - *cur = xmlnode_new_child(*cur, tmp->name); - for (tmp = tmp->child; tmp != NULL; tmp = tmp->next) - if (tmp->type == XMLNODE_TYPE_ATTRIB) - xmlnode_set_attrib_full(*cur, tmp->name, - tmp->xmlns, tmp->prefix, tmp->data); - } - } else { - const char *start; - const char *end; - GData *attributes; - char *fontsize = NULL; - - purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - *cur = xmlnode_new_child(*cur, tag_name); - - if (is_font_tag) { - /* Special case for the font size attribute */ - fontsize = g_strdup(g_datalist_get_data(&attributes, "size")); - if (fontsize != NULL) - g_datalist_remove_data(&attributes, "size"); - } - - /* Add all font tag attributes */ - g_datalist_foreach(&attributes, append_attrs_datalist_foreach_cb, *cur); - g_datalist_clear(&attributes); - - if (fontsize != NULL) { -#ifdef USE_CSS_FORMATTING - /* - * The Yahoo font size value is given in pt, even though the HTML - * standard for treats the size as a number on a - * scale between 1 and 7. So we insert the font size as a CSS - * style on a span tag. - */ - gchar *tmp = g_strdup_printf("font-size: %spt", fontsize); - *cur = xmlnode_new_child(*cur, "span"); - xmlnode_set_attrib(*cur, "style", tmp); - g_free(tmp); -#else - /* - * The Yahoo font size value is given in pt, even though the HTML - * standard for treats the size as a number on a - * scale between 1 and 7. So we convert it to an appropriate - * value. This loses precision, which is why CSS formatting is - * preferred. The "absz" attribute remains here for backward - * compatibility with UIs that might use it, but it is totally - * not standard at all. - */ - int size, htmlsize; - gchar tmp[11]; - size = strtol(fontsize, NULL, 10); - htmlsize = point_to_html(size); - sprintf(tmp, "%u", htmlsize); - xmlnode_set_attrib(*cur, "size", tmp); - xmlnode_set_attrib(*cur, "absz", fontsize); -#endif /* !USE_CSS_FORMATTING */ - g_free(fontsize); - } - } -} - -/** - * Similar to purple_markup_get_tag_name(), but works with closing tags. - * - * @return The lowercase name of the tag. If this is a closing tag then - * this value starts with a forward slash. The caller must free - * this string with g_free. - */ -static gchar *yahoo_markup_get_tag_name(const char *tag, gboolean *is_closing_tag) -{ - size_t len; - - *is_closing_tag = (tag[1] == '/'); - if (*is_closing_tag) - len = strcspn(tag + 1, "> "); - else - len = strcspn(tag + 1, "> /"); - - return g_utf8_strdown(tag + 1, len); -} - -/* - * Yahoo! messages generally aren't well-formed. Their markup is - * more of a flow from start to finish rather than a hierarchy from - * outer to inner. They tend to open tags and close them only when - * necessary. - * - * Example: size 8 size 16 size 8 again - * - * But we want to send well-formed HTML to the core, so we step through - * the input string and build an xmlnode tree containing sanitized HTML. - */ -char *yahoo_codes_to_html(const char *x) -{ - size_t x_len; - xmlnode *html, *cur; - GString *cdata = g_string_new(NULL); - int i, j; - gboolean no_more_gt_brackets = FALSE; - const char *match; - gchar *xmlstr1, *xmlstr2, *esc; - - x_len = strlen(x); - html = xmlnode_new("html"); - - cur = html; - for (i = 0; i < x_len; i++) { - if ((x[i] == 0x1b) && (x[i+1] == '[')) { - /* This escape sequence signifies the beginning of some - * text formatting code */ - j = i + 1; - - while (j++ < x_len) { - gchar *code; - - if (x[j] != 'm') - /* Keep looking for the end of this sequence */ - continue; - - /* We've reached the end of the formatting sequence, yay */ - - /* Append any character data that belongs in the current node */ - if (cdata->len > 0) { - xmlnode_insert_data(cur, cdata->str, cdata->len); - g_string_truncate(cdata, 0); - } - - code = g_strndup(x + i + 2, j - i - 2); - if (code[0] == '#') { -#ifdef USE_CSS_FORMATTING - gchar *tmp = g_strdup_printf("color: %s", code); - cur = xmlnode_new_child(cur, "span"); - xmlnode_set_attrib(cur, "style", tmp); - g_free(tmp); -#else - cur = xmlnode_new_child(cur, "font"); - xmlnode_set_attrib(cur, "color", code); -#endif /* !USE_CSS_FORMATTING */ - - } else if ((match = g_hash_table_lookup(esc_codes_ht, code))) { - /* Some tags are in the hash table only because we - * want to ignore them */ - if (match[0] != '\0') { - gboolean is_closing_tag; - gchar *tag_name; - tag_name = yahoo_markup_get_tag_name(match, &is_closing_tag); - yahoo_codes_to_html_add_tag(&cur, match, is_closing_tag, tag_name, FALSE); - g_free(tag_name); - } - - } else { - purple_debug_error("yahoo", - "Ignoring unknown ansi code 'ESC[%sm'.\n", code); - } - - g_free(code); - i = j; - break; - } - - } else if (x[i] == '<' && !no_more_gt_brackets) { - /* The start of an HTML tag */ - j = i; - - while (j++ < x_len) { - gchar *tag; - gboolean is_closing_tag; - gchar *tag_name; - - if (x[j] != '>') { - if (x[j] == '"') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != x_len && x[j] != '"') - j++; - } else if (x[j] == '\'') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != x_len && x[j] != '\'') - j++; - } - if (j != x_len) - /* Keep looking for the end of this tag */ - continue; - - /* This < has no corresponding > */ - g_string_append_c(cdata, x[i]); - no_more_gt_brackets = TRUE; - break; - } - - tag = g_strndup(x + i, j - i + 1); - tag_name = yahoo_markup_get_tag_name(tag, &is_closing_tag); - - match = g_hash_table_lookup(tags_ht, tag_name); - if (match == NULL) { - /* Unknown tag. The user probably typed a less-than sign */ - g_string_append_c(cdata, x[i]); - g_free(tag); - g_free(tag_name); - break; - } - - /* Some tags are in the hash table only because we - * want to ignore them */ - if (match[0] != '\0') { - /* Append any character data that belongs in the current node */ - if (cdata->len > 0) { - xmlnode_insert_data(cur, cdata->str, cdata->len); - g_string_truncate(cdata, 0); - } - if (g_str_equal(tag_name, "font")) - /* Font tags are a special case. We don't - * necessarily want to replace the whole thing-- - * we just want to fix the size attribute. */ - yahoo_codes_to_html_add_tag(&cur, tag, is_closing_tag, tag_name, TRUE); - else - yahoo_codes_to_html_add_tag(&cur, match, is_closing_tag, tag_name, FALSE); - } - - i = j; - g_free(tag); - g_free(tag_name); - break; - } - - } else { - g_string_append_c(cdata, x[i]); - } - } - - /* Append any remaining character data */ - if (cdata->len > 0) - xmlnode_insert_data(cur, cdata->str, cdata->len); - g_string_free(cdata, TRUE); - - /* Serialize our HTML */ - xmlstr1 = xmlnode_to_str(html, NULL); - xmlnode_free(html); - - /* Strip off the outter HTML node */ - /* This probably isn't necessary, especially if we made the outter HTML - * node an empty span. But the HTML is simpler this way. */ - if (!purple_strequal(xmlstr1, "")) - xmlstr2 = g_strndup(xmlstr1 + 6, strlen(xmlstr1) - 13); - else - xmlstr2 = g_strdup(""); - g_free(xmlstr1); - - esc = g_strescape(x, NULL); - purple_debug_misc("yahoo", "yahoo_codes_to_html(%s)=%s\n", esc, xmlstr2); - g_free(esc); - - return xmlstr2; -} - -/* borrowed from gtkimhtml */ -#define MAX_FONT_SIZE 7 -#define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) -static const gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; - -typedef struct -{ - gboolean bold; - gboolean italic; - gboolean underline; - gboolean in_link; - int font_size; - char *font_face; - char *font_color; -} CurrentMsgState; - -static void yahoo_htc_list_cleanup(GSList *l) -{ - while (l != NULL) { - g_free(l->data); - l = g_slist_delete_link(l, l); - } -} - -static void parse_font_tag(GString *dest, const char *tag_name, const char *tag, - GSList **colors, GSList **tags) -{ - const char *start; - const char *end; - GData *attributes; - const char *attribute; - gboolean needendtag; - GString *tmp; - - purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - - needendtag = FALSE; - tmp = g_string_new(NULL); - - attribute = g_datalist_get_data(&attributes, "color"); - if (attribute != NULL) { - g_string_append(tmp, *colors ? (*colors)->data : "\033[#000000m"); - g_string_append_printf(dest, "\033[%sm", attribute); - *colors = g_slist_prepend(*colors, - g_strdup_printf("\033[%sm", attribute)); - } else { - /* We need to add a value to the colors stack even if we're not - * setting a color because we ALWAYS pop exactly 1 element from - * this stack for every tag. If we don't add anything - * then we'll pop something that we shouldn't when we hit this - * corresponding . */ - *colors = g_slist_prepend(*colors, - *colors ? g_strdup((*colors)->data) : g_strdup("\033[#000000m")); - } - - attribute = g_datalist_get_data(&attributes, "face"); - if (attribute != NULL) { - needendtag = TRUE; - g_string_append(dest, "str[dest->len-1] = '>'; - *tags = g_slist_prepend(*tags, g_strdup("")); - g_string_free(tmp, TRUE); - } else { - *tags = g_slist_prepend(*tags, tmp->str); - g_string_free(tmp, FALSE); - } - - g_datalist_clear(&attributes); -} - -char *yahoo_html_to_codes(const char *src) -{ - GSList *colors = NULL; - - /** - * A stack of char*s where each char* is the string that should be - * appended to dest in order to close all the tags that were opened - * by a tag. - */ - GSList *tags = NULL; - - size_t src_len; - int i, j; - GString *dest; - char *esc; - gboolean no_more_gt_brackets = FALSE; - gchar *tag, *tag_name; - gboolean is_closing_tag; - CurrentMsgState current_state; - - memset(¤t_state, 0, sizeof(current_state)); - - src_len = strlen(src); - dest = g_string_sized_new(src_len); - - for (i = 0; i < src_len; i++) { - if (src[i] == '<' && !no_more_gt_brackets) { - /* The start of an HTML tag */ - j = i; - - while (j++ < src_len) { - if (src[j] != '>') { - if (src[j] == '"') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != src_len && src[j] != '"') - j++; - } else if (src[j] == '\'') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != src_len && src[j] != '\'') - j++; - } - if (j != src_len) - /* Keep looking for the end of this tag */ - continue; - - /* This < has no corresponding > */ - g_string_append_c(dest, src[i]); - no_more_gt_brackets = TRUE; - break; - } - - tag = g_strndup(src + i, j - i + 1); - tag_name = yahoo_markup_get_tag_name(tag, &is_closing_tag); - - if (g_str_equal(tag_name, "a")) { - const char *start; - const char *end; - GData *attributes; - const char *attribute; - - /* - * TODO: Ideally we would replace this: - * Pidgin - * with this: - * Pidgin (http://pidgin.im/) - * - * Currently we drop the text within the tag and - * just show the URL. Doing it the fancy way is - * complicated when dealing with HTML tags within the - * tag. - */ - - /* Append the URL */ - purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - attribute = g_datalist_get_data(&attributes, "href"); - if (attribute != NULL) { - if (purple_str_has_prefix(attribute, "mailto:")) - attribute += 7; - g_string_append(dest, attribute); - } - g_datalist_clear(&attributes); - - /* Skip past the closing tag */ - end = purple_strcasestr(src + j, ""); - if (end != NULL) - j = end - src + 3; - - } else if (g_str_equal(tag_name, "font")) { - parse_font_tag(dest, tag_name, tag, &colors, &tags); - } else if (g_str_equal(tag_name, "b")) { - g_string_append(dest, "\033[1m"); - current_state.bold = TRUE; - } else if (g_str_equal(tag_name, "/b")) { - if (current_state.bold) { - g_string_append(dest, "\033[x1m"); - current_state.bold = FALSE; - } - } else if (g_str_equal(tag_name, "i")) { - current_state.italic = TRUE; - g_string_append(dest, "\033[2m"); - } else if (g_str_equal(tag_name, "/i")) { - if (current_state.italic) { - g_string_append(dest, "\033[x2m"); - current_state.italic = FALSE; - } - } else if (g_str_equal(tag_name, "u")) { - current_state.underline = TRUE; - g_string_append(dest, "\033[4m"); - } else if (g_str_equal(tag_name, "/u")) { - if (current_state.underline) { - g_string_append(dest, "\033[x4m"); - current_state.underline = FALSE; - } - } else if (g_str_equal(tag_name, "/a")) { - /* Do nothing */ - } else if (g_str_equal(tag_name, "br")) { - g_string_append_c(dest, '\n'); - } else if (g_str_equal(tag_name, "/font")) { - if (tags != NULL) { - char *etag = tags->data; - tags = g_slist_delete_link(tags, tags); - g_string_append(dest, etag); - if (colors != NULL) { - g_free(colors->data); - colors = g_slist_delete_link(colors, colors); - } - g_free(etag); - } - } else { - /* We don't know what the tag is. Send it unmodified. */ - g_string_append(dest, tag); - } - - i = j; - g_free(tag); - g_free(tag_name); - break; - } - - } else { - const char *entity; - int length; - - entity = purple_markup_unescape_entity(src + i, &length); - if (entity != NULL) { - /* src[i] is the start of an HTML entity */ - g_string_append(dest, entity); - i += length - 1; - } else - /* src[i] is a normal character */ - g_string_append_c(dest, src[i]); - } - } - - esc = g_strescape(dest->str, NULL); - purple_debug_misc("yahoo", "yahoo_html_to_codes(%s)=%s\n", src, esc); - g_free(esc); - - yahoo_htc_list_cleanup(colors); - yahoo_htc_list_cleanup(tags); - - return g_string_free(dest, FALSE); -} - -YahooFederation yahoo_get_federation_from_name(const char *who) -{ - YahooFederation fed = YAHOO_FEDERATION_NONE; - if (who[3] == '/') { - if (!g_ascii_strncasecmp(who, "msn", 3)) - fed = YAHOO_FEDERATION_MSN; - else if (!g_ascii_strncasecmp(who, "ocs", 3)) - fed = YAHOO_FEDERATION_OCS; - else if (!g_ascii_strncasecmp(who, "ibm", 3)) - fed = YAHOO_FEDERATION_IBM; - } - return fed; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,718 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "debug.h" -#include "util.h" -#include "request.h" -#include "version.h" -#include "libymsg.h" -#include "yahoo_aliases.h" -#include "yahoo_friend.h" -#include "yahoo_packet.h" - -/* I hate hardcoding this stuff, but Yahoo never sends us anything to use. Someone in the know may be able to tweak this URL */ -#define YAHOO_ALIAS_FETCH_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&diffs=1&t=0&tags=short&rt=0&prog-ver=" YAHOO_CLIENT_VERSION "&useutf8=1&legenc=codepage-1252" -#define YAHOO_ALIAS_UPDATE_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&sync=1&tags=short&noclear=1&useutf8=1&legenc=codepage-1252" -#define YAHOOJP_ALIAS_FETCH_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&diffs=1&t=0&tags=short&rt=0&prog-ver=" YAHOOJP_CLIENT_VERSION -#define YAHOOJP_ALIAS_UPDATE_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&sync=1&tags=short&noclear=1" - -void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias); - -/** - * Stuff we want passed to the callback function - */ -struct callback_data { - PurpleConnection *gc; - gchar *id; - gchar *who; -}; - -void yahoo_personal_details_reset(YahooPersonalDetails *ypd, gboolean all) -{ - if (all) - g_free(ypd->id); - g_free(ypd->names.first); - g_free(ypd->names.last); - g_free(ypd->names.middle); - g_free(ypd->names.nick); - g_free(ypd->phone.work); - g_free(ypd->phone.home); - g_free(ypd->phone.mobile); -} - -/************************************************************************** - * Alias Fetch Functions - **************************************************************************/ - -static void -yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) -{ - PurpleConnection *gc = user_data; - YahooData *yd = gc->proto_data; - - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (len == 0) { - purple_debug_info("yahoo", "No Aliases to process.%s%s\n", - error_message ? " Error:" : "", error_message ? error_message : ""); - } else { - gchar *full_name, *nick_name; - const char *yid, *id, *fn, *ln, *nn, *alias, *mn; - const char *hp, *wp, *mo; - YahooFriend *f; - PurpleBuddy *b; - xmlnode *item, *contacts; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - /* Put our web response into a xmlnode for easy management */ - contacts = xmlnode_from_str(url_text, -1); - - if (contacts == NULL) { - purple_debug_error("yahoo", "Badly formed Alias XML\n"); - return; - } - purple_debug_info("yahoo", "Fetched %" G_GSIZE_FORMAT - " bytes of alias data\n", len); - - /* Loop around and around and around until we have gone through all the received aliases */ - for(item = xmlnode_get_child(contacts, "ct"); item; item = xmlnode_get_next_twin(item)) { - /* Yahoo replies with two types of contact (ct) record, we are only interested in the alias ones */ - if ((yid = xmlnode_get_attrib(item, "yi"))) { - YahooPersonalDetails *ypd = NULL; - /* Grab all the bits of information we can */ - fn = xmlnode_get_attrib(item, "fn"); - ln = xmlnode_get_attrib(item, "ln"); - nn = xmlnode_get_attrib(item, "nn"); - mn = xmlnode_get_attrib(item, "mn"); - id = xmlnode_get_attrib(item, "id"); - - hp = xmlnode_get_attrib(item, "hp"); - wp = xmlnode_get_attrib(item, "wp"); - mo = xmlnode_get_attrib(item, "mo"); - - full_name = nick_name = NULL; - alias = NULL; - - /* Yahoo stores first and last names separately, lets put them together into a full name */ - if (yd->jp) - full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : ""))); - else - full_name = g_strstrip(g_strdup_printf("%s %s", (fn != NULL ? fn : "") , (ln != NULL ? ln : ""))); - nick_name = (nn != NULL ? g_strstrip(g_strdup(nn)) : NULL); - - if (nick_name != NULL) - alias = nick_name; /* If we have a nickname from Yahoo, let's use it */ - else if (strlen(full_name) != 0) - alias = full_name; /* If no Yahoo nickname, we can use the full_name created above */ - - /* Find the local buddy that matches */ - f = yahoo_friend_find(gc, yid); - b = purple_find_buddy(account, yid); - - /* If we don't find a matching buddy, ignore the alias !! */ - if (f != NULL && b != NULL) { - const char *buddy_alias = purple_buddy_get_alias(b); - yahoo_friend_set_alias_id(f, id); - - /* Finally, if we received an alias, we better update the buddy list */ - if (alias != NULL) { - serv_got_alias(gc, yid, alias); - purple_debug_info("yahoo", "Fetched alias '%s' (%s)\n", alias, id); - } else if (buddy_alias != NULL && strcmp(buddy_alias, "") != 0) { - /* Or if we have an alias that Yahoo doesn't, send it up */ - yahoo_update_alias(gc, yid, buddy_alias); - purple_debug_info("yahoo", "Sent updated alias '%s'\n", buddy_alias); - } - } - - if (f != NULL) - ypd = &f->ypd; - else { - /* May be the alias is for the account? */ - const char *yidn = purple_normalize(account, yid); - if (purple_strequal(yidn, purple_connection_get_display_name(gc))) { - ypd = &yd->ypd; - } - } - - if (ypd) { - yahoo_personal_details_reset(ypd, TRUE); - ypd->id = g_strdup(id); - ypd->names.first = g_strdup(fn); - ypd->names.middle = g_strdup(mn); - ypd->names.last = g_strdup(ln); - ypd->names.nick = g_strdup(nn); - - ypd->phone.work = g_strdup(wp); - ypd->phone.home = g_strdup(hp); - ypd->phone.mobile = g_strdup(mo); - } - - g_free(full_name); - g_free(nick_name); - } - } - xmlnode_free(contacts); - } -} - -void -yahoo_fetch_aliases(PurpleConnection *gc) -{ - YahooData *yd = gc->proto_data; - const char *url; - gchar *request, *webpage, *webaddress; - PurpleUtilFetchUrlData *url_data; - - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - /* Build all the info to make the web request */ - url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL; - purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); - request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; Y=%s\r\n" - "Host: %s\r\n" - "Cache-Control: no-cache\r\n\r\n", - use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, - yd->cookie_t, yd->cookie_y, - webaddress); - - /* We have a URL and some header information, let's connect and get some aliases */ - url_data = purple_util_fetch_url_request_len_with_account(purple_connection_get_account(gc), - url, use_whole_url, NULL, TRUE, request, FALSE, -1, - yahoo_fetch_aliases_cb, gc); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - - g_free(webaddress); - g_free(webpage); - g_free(request); -} - -/************************************************************************** - * Alias Update Functions - **************************************************************************/ - -static void -yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) -{ - xmlnode *node, *result; - struct callback_data *cb = user_data; - PurpleConnection *gc = cb->gc; - YahooData *yd; - - yd = gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (len == 0 || error_message != NULL) { - purple_debug_info("yahoo", "Error updating alias for %s: %s\n", - cb->who, - error_message ? error_message : ""); - g_free(cb->who); - g_free(cb->id); - g_free(cb); - return; - } - - result = xmlnode_from_str(url_text, -1); - - if (result == NULL) { - purple_debug_error("yahoo", "Alias update for %s failed: Badly formed response\n", - cb->who); - g_free(cb->who); - g_free(cb->id); - g_free(cb); - return; - } - - if ((node = xmlnode_get_child(result, "ct"))) { - if (cb->id == NULL) { - const char *new_id = xmlnode_get_attrib(node, "id"); - if (new_id != NULL) { - /* We now have an addressbook id for the friend; we should save it */ - YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); - - purple_debug_info("yahoo", "Alias creation for %s succeeded\n", cb->who); - - if (f) - yahoo_friend_set_alias_id(f, new_id); - else - purple_debug_error("yahoo", "Missing YahooFriend. Unable to store new addressbook id.\n"); - } else - purple_debug_error("yahoo", "Missing new addressbook id in add response for %s (weird).\n", - cb->who); - } else { - if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) - purple_debug_info("yahoo", "Alias update for %s succeeded\n", cb->who); - else - purple_debug_error("yahoo", "Alias update for %s failed (Contact record return mismatch)\n", - cb->who); - } - } else - purple_debug_info("yahoo", "Alias update for %s failed (No contact record returned)\n", cb->who); - - g_free(cb->who); - g_free(cb->id); - g_free(cb); - xmlnode_free(result); -} - -void -yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) -{ - YahooData *yd; - const char *url; - gchar *content, *request, *webpage, *webaddress; - struct callback_data *cb; - PurpleUtilFetchUrlData *url_data; - YahooFriend *f; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - g_return_if_fail(who != NULL); - g_return_if_fail(gc != NULL); - - if (alias == NULL) - alias = ""; - - f = yahoo_friend_find(gc, who); - if (f == NULL) { - purple_debug_error("yahoo", "Missing YahooFriend. Unable to set server alias.\n"); - return; - } - - yd = gc->proto_data; - - /* Using callback_data so I have access to gc in the callback function */ - cb = g_new0(struct callback_data, 1); - cb->who = g_strdup(who); - cb->id = g_strdup(yahoo_friend_get_alias_id(f)); - cb->gc = gc; - - /* Build all the info to make the web request */ - url = yd->jp ? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL; - purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); - - if (cb->id == NULL) { - /* No id for this buddy, so create an address book entry */ - purple_debug_info("yahoo", "Creating '%s' as new alias for user '%s'\n", alias, who); - - if (yd->jp) { - gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); - gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, converted_alias_jp); - g_free(converted_alias_jp); - g_free(alias_jp); - } else { - gchar *escaped_alias = g_markup_escape_text(alias, -1); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, escaped_alias); - g_free(escaped_alias); - } - } else { - purple_debug_info("yahoo", "Updating '%s' as new alias for user '%s'\n", alias, who); - - if (yd->jp) { - gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); - gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, cb->id, converted_alias_jp); - g_free(converted_alias_jp); - g_free(alias_jp); - } else { - gchar *escaped_alias = g_markup_escape_text(alias, -1); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, cb->id, escaped_alias); - g_free(escaped_alias); - } - } - - request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; Y=%s\r\n" - "Host: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "Cache-Control: no-cache\r\n\r\n" - "%s", - use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, - yd->cookie_t, yd->cookie_y, - webaddress, - strlen(content), - content); - - /* We have a URL and some header information, let's connect and update the alias */ - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, - request, FALSE, -1, yahoo_update_alias_cb, cb); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - - g_free(webpage); - g_free(webaddress); - g_free(content); - g_free(request); -} - - -/************************************************************************** - * User Info Update Functions - **************************************************************************/ - -#if 0 -/* This block of code can be used to send our contact details to - * everyone in the buddylist. But with the official messenger, - * doing this pops a conversation window at the receiver's end, - * which is stupid, and thus not really surprising. */ - -struct yahoo_userinfo { - YahooData *yd; - char *xml; -}; - -static void -yahoo_send_userinfo_to_user(struct yahoo_userinfo *yui, const char *who) -{ - struct yahoo_packet *pkt; - PurpleConnection *gc; - - gc = yui->yd->gc; - pkt = yahoo_packet_new(YAHOO_SERVICE_CONTACT_DETAILS, 0, 0); - yahoo_packet_hash(pkt, "siisis", - 1, purple_connection_get_display_name(gc), - 13, 1, /* This creates a conversation window in the official client */ - 302, 5, - 5, who, - 303, 5, - 280, yui->xml); - yahoo_packet_send_and_free(pkt, yui->yd); -} - -static void -yahoo_send_userinfo_foreach(gpointer key, gpointer value, gpointer data) -{ - const char *who = key; - YahooFriend *f = value; - - if (f->status != YAHOO_STATUS_OFFLINE) { - yahoo_send_userinfo_to_user(data, who); - } -} - -static void -yahoo_sent_userinfo_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) -{ - struct yahoo_userinfo *yui = user_data; - yahoo_fetch_aliases_cb(url_data, yui->yd->gc, url_text, len, error_message); - g_hash_table_foreach(yui->yd->friends, yahoo_send_userinfo_foreach, yui); - g_free(yui->xml); - g_free(yui); -} -#endif - -static void -yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - xmlnode *node = xmlnode_new("ab"); - xmlnode *ct = xmlnode_new_child(node, "ct"); - YahooData *yd = purple_connection_get_protocol_data(gc); - PurpleAccount *account; - PurpleUtilFetchUrlData *url_data; - char *webaddress, *webpage; - char *request, *content; - int len; - int i; - char * yfields[] = { "fn", "ln", "nn", "mn", "hp", "wp", "mo", NULL }; - - account = purple_connection_get_account(gc); - - xmlnode_set_attrib(node, "k", purple_connection_get_display_name(gc)); - xmlnode_set_attrib(node, "cc", "1"); /* XXX: ? */ - - xmlnode_set_attrib(ct, "e", "1"); - xmlnode_set_attrib(ct, "yi", purple_request_fields_get_string(fields, "yname")); - xmlnode_set_attrib(ct, "id", purple_request_fields_get_string(fields, "yid")); - xmlnode_set_attrib(ct, "pr", "0"); - - for (i = 0; yfields[i]; i++) { - const char *v = purple_request_fields_get_string(fields, yfields[i]); - xmlnode_set_attrib(ct, yfields[i], v ? v : ""); - } - - content = xmlnode_to_formatted_str(node, &len); - xmlnode_free(node); - purple_url_parse(yd->jp ? YAHOOJP_USERINFO_URL : YAHOO_USERINFO_URL, &webaddress, NULL, &webpage, NULL, NULL); - - request = g_strdup_printf("POST %s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" - "Host: %s\r\n" - "Content-Length: %d\r\n" - "Cache-Control: no-cache\r\n\r\n" - "%s\r\n\r\n", - webpage, - yd->cookie_t, yd->cookie_y, - webaddress, - len + 4, - content); - -#if 0 - { - /* This is if we wanted to send our contact details to everyone - * in the buddylist. But this cannot be done now, because in the - * official messenger, doing this pops a conversation window at - * the receiver's end, which is stupid, and thus not really - * surprising. */ - struct yahoo_userinfo *ui = g_new(struct yahoo_userinfo, 1); - node = xmlnode_new("contact"); - - for (i = 0; yfields[i]; i++) { - const char *v = purple_request_fields_get_string(fields, yfields[i]); - if (v) { - xmlnode *nd = xmlnode_new_child(node, yfields[i]); - xmlnode_insert_data(nd, v, -1); - } - } - - ui->yd = yd; - ui->xml = xmlnode_to_str(node, NULL); - xmlnode_free(node); - } -#endif - - url_data = purple_util_fetch_url_request_len_with_account(account, webaddress, FALSE, - YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, - yahoo_fetch_aliases_cb, gc); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - - g_free(webaddress); - g_free(webpage); - g_free(content); - g_free(request); -} - -static PurpleRequestFields * -request_fields_from_personal_details(YahooPersonalDetails *ypd, const char *id) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - int i; - struct { - char *id; - char *text; - char *value; - } yfields[] = { - {"fn", N_("First Name"), ypd->names.first}, - {"ln", N_("Last Name"), ypd->names.last}, - {"nn", N_("Nickname"), ypd->names.nick}, - {"mn", N_("Middle Name"), ypd->names.middle}, - {"hp", N_("Home Phone Number"), ypd->phone.home}, - {"wp", N_("Work Phone Number"), ypd->phone.work}, - {"mo", N_("Mobile Phone Number"), ypd->phone.mobile}, - {NULL, NULL, NULL} - }; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("yname", "", id, FALSE); - purple_request_field_set_visible(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("yid", "", ypd->id, FALSE); - purple_request_field_set_visible(field, FALSE); - purple_request_field_group_add_field(group, field); - - for (i = 0; yfields[i].id; i++) { - field = purple_request_field_string_new(yfields[i].id, _(yfields[i].text), - yfields[i].value, FALSE); - purple_request_field_group_add_field(group, field); - } - - return fields; -} - -void yahoo_set_userinfo_for_buddy(PurpleConnection *gc, PurpleBuddy *buddy) -{ - PurpleRequestFields *fields; - YahooFriend *f; - const char *name; - - name = purple_buddy_get_name(buddy); - f = yahoo_friend_find(gc, name); - if (!f) - return; - - fields = request_fields_from_personal_details(&f->ypd, name); - purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, - _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, gc); -} - -void yahoo_set_userinfo(PurpleConnection *gc) -{ - YahooData *yd = purple_connection_get_protocol_data(gc); - PurpleRequestFields *fields = request_fields_from_personal_details(&yd->ypd, - purple_connection_get_display_name(gc)); - purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, - _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, gc); -} - -static gboolean -parse_contact_details(YahooData *yd, const char *who, const char *xml) -{ - xmlnode *node, *nd; - YahooFriend *f; - char *yid; - - node = xmlnode_from_str(xml, -1); - if (!node) { - purple_debug_info("yahoo", "Received malformed XML for contact details from '%s':\n%s\n", - who, xml); - return FALSE; - } - - nd = xmlnode_get_child(node, "yi"); - if (!nd || !(yid = xmlnode_get_data(nd))) { - xmlnode_free(node); - return FALSE; - } - - if (!purple_strequal(yid, who)) { - /* The user may not want to set the contact details about folks in the buddylist - to what some random dude might have sent. So it would be good if we popped - up a prompt requiring the user to confirm the details before we set them. - However, someone could send details about hundreds of users at the same time, - which would make things really bad. So for now, until we have a better way of - dealing with this, ignore this details. */ - purple_debug_info("yahoo", "Ignoring contact details sent by %s about %s\n", - who, yid); - g_free(yid); - xmlnode_free(node); - return FALSE; - } - - f = yahoo_friend_find(yd->gc, yid); - if (!f) { - g_free(yid); - xmlnode_free(node); - return FALSE; - } else { - int i; - YahooPersonalDetails *ypd = &f->ypd; - char *alias = NULL; - struct { - char *id; - char **field; - } details[] = { - {"fn", &ypd->names.first}, - {"mn", &ypd->names.middle}, - {"ln", &ypd->names.last}, - {"nn", &ypd->names.nick}, - {"wp", &ypd->phone.work}, - {"hp", &ypd->phone.home}, - {"mo", &ypd->phone.mobile}, - {NULL, NULL} - }; - - yahoo_personal_details_reset(ypd, FALSE); - - for (i = 0; details[i].id; i++) { - nd = xmlnode_get_child(node, details[i].id); - *details[i].field = nd ? xmlnode_get_data(nd) : NULL; - } - - if (ypd->names.nick) - alias = ypd->names.nick; - else if (ypd->names.first || ypd->names.last) { - alias = g_strstrip(g_strdup_printf("%s %s", - ypd->names.first ? ypd->names.first : "", - ypd->names.last ? ypd->names.last : "")); - } - - if (alias) { - serv_got_alias(yd->gc, yid, alias); - if (alias != ypd->names.nick) - g_free(alias); - } - } - - xmlnode_free(node); - g_free(yid); - return TRUE; -} - -/* I don't think this happens for MSN buddies. -- sad */ -void yahoo_process_contact_details(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - const char *who = NULL, *xml = NULL; - YahooData *yd = purple_connection_get_protocol_data(gc); - - for (; l; l = l->next) { - struct yahoo_pair *pair = l->data; - switch (pair->key) { - case 4: - who = pair->value; /* This is the person who sent us the details. - But not necessarily about himself. */ - break; - case 5: - break; - case 13: - /* This is '1' if 'who' is sending the contact details about herself, - '0' if 'who' is sending the contact details she has about buddies - in her list. However, in all cases, the xml in key 280 always seems - to contain the yid of the person, so we may as well ignore this field - and look into the xml instead to see who the information is about. */ - break; - case 280: - xml = pair->value; - parse_contact_details(yd, who, xml); - break; - } - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_aliases.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "debug.h" -#include "util.h" -#include "version.h" -#include "libymsg.h" -#include "yahoo_packet.h" - -void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias); -void yahoo_fetch_aliases(PurpleConnection *gc); -void yahoo_set_userinfo(PurpleConnection *gc); -void yahoo_set_userinfo_for_buddy(PurpleConnection *gc, PurpleBuddy *buddy); -void yahoo_personal_details_reset(YahooPersonalDetails *ypd, gboolean all); -void yahoo_process_contact_details(PurpleConnection *gc, struct yahoo_packet *pkt); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1639 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Some code copyright 2003 Tim Ringenbach - * (marv on irc.freenode.net) - * Some code borrowed from libyahoo2, copyright (C) 2002, Philip - * S Tellis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include "debug.h" -#include "privacy.h" -#include "prpl.h" - -#include "conversation.h" -#include "notify.h" -#include "util.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoochat.h" -#include "ycht.h" - -#define YAHOO_CHAT_ID (1) - -/* prototype(s) */ -static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout); - -/* special function to log us on to the yahoo chat service */ -static void yahoo_chat_online(PurpleConnection *gc) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - const char *rll; - - if (yd->wm) { - ycht_connection_open(gc); - return; - } - - rll = purple_account_get_string(purple_connection_get_account(gc), - "room_list_locale", YAHOO_ROOMLIST_LOCALE); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sssss", - 109, purple_connection_get_display_name(gc), - 1, purple_connection_get_display_name(gc), - 6, "abcde", - /* I'm not sure this is the correct way to set this. */ - 98, rll, - 135, yd->jp ? YAHOO_CLIENT_VERSION : YAHOOJP_CLIENT_VERSION); - yahoo_packet_send_and_free(pkt, yd); -} - -/* this is slow, and different from the purple_* version in that it (hopefully) won't add a user twice */ -void yahoo_chat_add_users(PurpleConvChat *chat, GList *newusers) -{ - GList *i; - - for (i = newusers; i; i = i->next) { - if (purple_conv_chat_find_user(chat, i->data)) - continue; - purple_conv_chat_add_user(chat, i->data, NULL, PURPLE_CBFLAGS_NONE, TRUE); - } -} - -void yahoo_chat_add_user(PurpleConvChat *chat, const char *user, const char *reason) -{ - if (purple_conv_chat_find_user(chat, user)) - return; - - purple_conv_chat_add_user(chat, user, reason, PURPLE_CBFLAGS_NONE, TRUE); -} - -static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const char *name) -{ - YahooData *yd; - GSList *l; - - yd = gc->proto_data; - - for (l = yd->confs; l; l = l->next) { - PurpleConversation *c = l->data; - if (!purple_utf8_strcasecmp(purple_conversation_get_name(c), name)) - return c; - } - return NULL; -} - - -void yahoo_process_conference_invite(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - GSList *l; - char *room = NULL; - char *who = NULL; - char *msg = NULL; - GString *members = NULL; - GHashTable *components; - PurpleConversation *c = NULL; - - if ( (pkt->status == 2) || (pkt->status == 11) ) - return; /* Status is 11 when we are being notified about invitation being sent to someone else */ - - account = purple_connection_get_account(gc); - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - if (pair->key == 57) - { - room = yahoo_string_decode(gc, pair->value, FALSE); - if((c = yahoo_find_conference(gc, room))) - { - /* Looks like we got invited to an already open conference. */ - /* Laters: Should we accept this conference rather than ignoring the invitation ? */ - purple_debug_info("yahoo","Ignoring invitation for an already existing chat, room:%s\n",room); - g_free(room); - return; - } - } - } - - members = g_string_sized_new(512); - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 1: /* us, but we already know who we are */ - break; - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 50: /* inviter */ - who = pair->value; - g_string_append_printf(members, "%s\n", who); - break; - case 51: /* This user is being invited to the conference. Comes with status = 11, so we wont reach here */ - break; - case 52: /* Invited users. Assuming us invited, since we got this packet */ - break; /* break needed, or else we add the users to the conference before they accept the invitation */ - case 53: /* members who have already joined the conference */ - g_string_append_printf(members, "%s\n", pair->value); - break; - case 58: - g_free(msg); - msg = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 13: /* ? */ - break; - } - } - - if (!room) { - g_string_free(members, TRUE); - g_free(msg); - return; - } - - if (!purple_privacy_check(account, who) || - (purple_account_get_bool(account, "ignore_invites", FALSE))) - { - purple_debug_info("yahoo", - "Invite to conference %s from %s has been dropped.\n", room, who); - g_free(room); - g_free(msg); - g_string_free(members, TRUE); - return; - } - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(components, g_strdup("room"), room); - if (msg) - g_hash_table_replace(components, g_strdup("topic"), msg); - g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); - g_hash_table_replace(components, g_strdup("members"), g_string_free(members, FALSE)); - serv_got_chat_invite(gc, room, who, msg, components); - -} - -void yahoo_process_conference_decline(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - char *msg = NULL; - PurpleConversation *c = NULL; - int utf8 = 0; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 54: - who = pair->value; - break; - case 14: - g_free(msg); - msg = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 97: - utf8 = strtol(pair->value, NULL, 10); - break; - } - } - if (!purple_privacy_check(purple_connection_get_account(gc), who)) - { - g_free(room); - g_free(msg); - return; - } - - if (who && room) { - /* make sure we're in the room before we process a decline message for it */ - if((c = yahoo_find_conference(gc, room))) { - char *tmp = NULL, *msg_tmp = NULL; - if(msg) - { - msg_tmp = yahoo_string_decode(gc, msg, utf8); - msg = yahoo_codes_to_html(msg_tmp); - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), who, 0, msg, time(NULL)); - g_free(msg_tmp); - g_free(msg); - } - - tmp = g_strdup_printf(_("%s has declined to join."), who); - purple_conversation_write(c, NULL, tmp, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); - - g_free(tmp); - } - - g_free(room); - } -} - -void yahoo_process_conference_logon(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - PurpleConversation *c; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 53: - who = pair->value; - break; - } - } - - if (who && room) { - c = yahoo_find_conference(gc, room); - if (c) - { /* Prevent duplicate users in the chat */ - if( !purple_conv_chat_find_user(PURPLE_CONV_CHAT(c), who) ) - yahoo_chat_add_user(PURPLE_CONV_CHAT(c), who, NULL); - } - g_free(room); - } -} - -void yahoo_process_conference_logoff(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - PurpleConversation *c; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 56: - who = pair->value; - break; - } - } - - if (who && room) { - c = yahoo_find_conference(gc, room); - if (c) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); - g_free(room); - } -} - -void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - char *msg = NULL; - int utf8 = 0; - PurpleConversation *c; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 3: - who = pair->value; - break; - case 14: - msg = pair->value; - break; - case 97: - utf8 = strtol(pair->value, NULL, 10); - break; - } - } - - if (room && who && msg) { - char *msg2; - - c = yahoo_find_conference(gc, room); - if (!c) { - g_free(room); - return; - } - - msg2 = yahoo_string_decode(gc, msg, utf8); - msg = yahoo_codes_to_html(msg2); - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), who, 0, msg, time(NULL)); - g_free(msg); - g_free(msg2); - } - - g_free(room); -} - -static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *room2; - gboolean utf8 = TRUE; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - ycht_chat_join(yd->ycht, room); - return; - } - - /* apparently room names are always utf8, or else always not utf8, - * so we don't have to actually pass the flag in the packet. Or something. */ - room2 = yahoo_string_encode(gc, room, &utf8); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssss", - 1, purple_connection_get_display_name(gc), - 104, room2, - 62, "2", - 129, id ? id : "0"); - yahoo_packet_send_and_free(pkt, yd); - g_free(room2); -} - -/* this is a confirmation of yahoo_chat_online(); */ -void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - YahooData *yd = (YahooData *) gc->proto_data; - - if (pkt->status == 1) { - yd->chat_online = TRUE; - - /* We need to goto a user in chat */ - if (yd->pending_chat_goto) { - struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", - 109, yd->pending_chat_goto, - 1, purple_connection_get_display_name(gc), - 62, "2"); - yahoo_packet_send_and_free(pkt, yd); - } else if (yd->pending_chat_room) { - yahoo_chat_join(gc, purple_connection_get_display_name(gc), yd->pending_chat_room, - yd->pending_chat_topic, yd->pending_chat_id); - } - - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - } -} - -/* this is basicly the opposite of chat_online */ -void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - YahooData *yd = (YahooData *) gc->proto_data; - GSList *l; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 1) - if (g_ascii_strcasecmp(pair->value, - purple_connection_get_display_name(gc))) - return; - } - - if (pkt->status == 1) { - yd->chat_online = FALSE; - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - if (yd->in_chat) - yahoo_c_leave(gc, YAHOO_CHAT_ID); - } -} - -void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = (YahooData *) gc->proto_data; - PurpleConversation *c = NULL; - GSList *l; - GList *members = NULL; - GList *roomies = NULL; - char *room = NULL; - char *topic = NULL; - char *someid, *someotherid, *somebase64orhashosomething, *somenegativenumber; - - if (pkt->status == -1) { - /* We can't join */ - struct yahoo_pair *pair = pkt->hash->data; - gchar const *failed_to_join = _("Failed to join chat"); - switch (atoi(pair->value)) { - case 0xFFFFFFFA: /* -6 */ - purple_notify_error(gc, NULL, failed_to_join, _("Unknown room")); - break; - case 0xFFFFFFF1: /* -15 */ - purple_notify_error(gc, NULL, failed_to_join, _("Maybe the room is full")); - break; - case 0xFFFFFFDD: /* -35 */ - purple_notify_error(gc, NULL, failed_to_join, _("Not available")); - break; - default: - purple_notify_error(gc, NULL, failed_to_join, - _("Unknown error. You may need to logout and wait five minutes before being able to rejoin a chatroom")); - } - return; - } - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - - case 104: - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 105: - g_free(topic); - topic = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 128: - someid = pair->value; - break; - case 108: /* number of joiners */ - break; - case 129: - someotherid = pair->value; - break; - case 130: - somebase64orhashosomething = pair->value; - break; - case 126: - somenegativenumber = pair->value; - break; - case 13: /* this is 1. maybe its the type of room? (normal, user created, private, etc?) */ - break; - case 61: /*this looks similar to 130 */ - break; - - /* the previous section was just room info. this next section is - info about individual room members, (including us) */ - - case 109: /* the yahoo id */ - members = g_list_append(members, pair->value); - break; - case 110: /* age */ - break; - case 141: /* nickname */ - break; - case 142: /* location */ - break; - case 113: /* bitmask */ - break; - } - } - - if (room && yd->chat_name && purple_utf8_strcasecmp(room, yd->chat_name)) - yahoo_chat_leave(gc, room, - purple_connection_get_display_name(gc), FALSE); - - c = purple_find_chat(gc, YAHOO_CHAT_ID); - - if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) && - members && (members->next || - !g_ascii_strcasecmp(members->data, purple_connection_get_display_name(gc)))) { - GList *l; - GList *flags = NULL; - for (l = members; l; l = l->next) - flags = g_list_prepend(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); - if (c && purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) { - /* this might be a hack, but oh well, it should nicely */ - char *tmpmsg; - - purple_conversation_set_name(c, room); - - c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); - if (topic) { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - /* Also print the topic to the backlog so that the captcha link is clickable */ - purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", topic, PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - yd->in_chat = 1; - yd->chat_name = g_strdup(room); - purple_conv_chat_add_users(PURPLE_CONV_CHAT(c), members, NULL, flags, FALSE); - - tmpmsg = g_strdup_printf(_("You are now chatting in %s."), room); - purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", tmpmsg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmpmsg); - } else { - c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); - if (topic) { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - /* Also print the topic to the backlog so that the captcha link is clickable */ - purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", topic, PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - yd->in_chat = 1; - yd->chat_name = g_strdup(room); - purple_conv_chat_add_users(PURPLE_CONV_CHAT(c), members, NULL, flags, FALSE); - } - g_list_free(flags); - } else if (c) { - if (topic) { - const char *cur_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(c)); - if (cur_topic == NULL || strcmp(cur_topic, topic) != 0) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - } - yahoo_chat_add_users(PURPLE_CONV_CHAT(c), members); - } - - if (account->deny && c) { - PurpleConversationUiOps *ops = purple_conversation_get_ui_ops(c); - for (l = account->deny; l != NULL; l = l->next) { - for (roomies = members; roomies; roomies = roomies->next) { - if (!purple_utf8_strcasecmp((char *)l->data, roomies->data)) { - purple_debug_info("yahoo", "Ignoring room member %s in room %s\n" , (char *)roomies->data, room ? room : ""); - purple_conv_chat_ignore(PURPLE_CONV_CHAT(c),roomies->data); - ops->chat_update_user(c, roomies->data); - } - } - } - } - g_list_free(roomies); - g_list_free(members); - g_free(room); - g_free(topic); -} - -void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *who = NULL; - char *room = NULL; - GSList *l; - YahooData *yd; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 104) { - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - } - if (pair->key == 109) - who = pair->value; - } - - if (who && room) { - PurpleConversation *c = purple_find_chat(gc, YAHOO_CHAT_ID); - if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room)) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); - - } - if (room) - g_free(room); -} - -void yahoo_process_chat_message(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *room = NULL, *who = NULL, *msg = NULL, *msg2; - int msgtype = 1, utf8 = 1; /* default to utf8 */ - PurpleConversation *c = NULL; - GSList *l; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - - case 97: - utf8 = strtol(pair->value, NULL, 10); - break; - case 104: - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 109: - who = pair->value; - break; - case 117: - msg = pair->value; - break; - case 124: - msgtype = strtol(pair->value, NULL, 10); - break; - } - } - - c = purple_find_chat(gc, YAHOO_CHAT_ID); - if (!who || !c) { - if (room) - g_free(room); - /* we still get messages after we part, funny that */ - return; - } - - if (!msg) { - purple_debug_misc("yahoo", "Got a message packet with no message.\nThis probably means something important, but we're ignoring it.\n"); - return; - } - msg2 = yahoo_string_decode(gc, msg, utf8); - msg = yahoo_codes_to_html(msg2); - g_free(msg2); - - if (msgtype == 2 || msgtype == 3) { - char *tmp; - tmp = g_strdup_printf("/me %s", msg); - g_free(msg); - msg = tmp; - } - - serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, msg, time(NULL)); - g_free(msg); - g_free(room); -} - -void yahoo_process_chat_addinvite(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - GSList *l; - char *room = NULL; - char *msg = NULL; - char *who = NULL; - - account = purple_connection_get_account(gc); - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 104: - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 129: /* room id? */ - break; - case 126: /* ??? */ - break; - case 117: - g_free(msg); - msg = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 119: - who = pair->value; - break; - case 118: /* us */ - break; - } - } - - if (room && who) { - GHashTable *components; - - if (!purple_privacy_check(account, who) || - (purple_account_get_bool(account, "ignore_invites", FALSE))) - { - purple_debug_info("yahoo", "Invite to room %s from %s has been dropped.\n", room, who); - g_free(room); - g_free(msg); - return; - } - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(components, g_strdup("room"), g_strdup(room)); - serv_got_chat_invite(gc, room, who, msg, components); - } - - g_free(room); - g_free(msg); -} - -void yahoo_process_chat_goto(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - if (pkt->status == -1) - purple_notify_error(gc, NULL, _("Failed to join buddy in chat"), - _("Maybe they're not in a chat?")); -} - -/* - * Functions dealing with conferences - * I think conference names are always ascii. - */ - -void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *who) -{ - struct yahoo_packet *pkt; - GList *w; - - purple_debug_misc("yahoo", "leaving conference %s\n", room); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash_str(pkt, 1, dn); - for (w = who; w; w = w->next) { - const char *name = purple_conv_chat_cb_get_name(w->data); - yahoo_packet_hash_str(pkt, 3, name); - } - - yahoo_packet_hash_str(pkt, 57, room); - yahoo_packet_send_and_free(pkt, yd); -} - -static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room, - GList *members, const char *what) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - GList *who; - char *msg, *msg2; - int utf8 = 1; - - msg = yahoo_html_to_codes(what); - msg2 = yahoo_string_encode(gc, msg, &utf8); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash_str(pkt, 1, dn); - for (who = members; who; who = who->next) { - const char *name = purple_conv_chat_cb_get_name(who->data); - yahoo_packet_hash_str(pkt, 53, name); - } - yahoo_packet_hash(pkt, "ss", 57, room, 14, msg2); - if (utf8) - yahoo_packet_hash_str(pkt, 97, "1"); /* utf-8 */ - - yahoo_packet_send_and_free(pkt, yd); - g_free(msg); - g_free(msg2); - - return 0; -} - -static void yahoo_conf_join(YahooData *yd, PurpleConversation *c, const char *dn, const char *room, - const char *topic, const char *members) -{ - struct yahoo_packet *pkt; - char **memarr = NULL; - int i; - - if (members) - memarr = g_strsplit(members, "\n", 0); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGON, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sss", 1, dn, 3, dn, 57, room); - if (memarr) { - for(i = 0 ; memarr[i]; i++) { - if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) - continue; - yahoo_packet_hash_str(pkt, 3, memarr[i]); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), memarr[i], NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - } - yahoo_packet_send_and_free(pkt, yd); - - if (memarr) - g_strfreev(memarr); -} - -static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, - const char *dn, const char *buddy, const char *room, const char *msg) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - GList *members; - char *msg2 = NULL; - - if (msg) - msg2 = yahoo_string_encode(gc, msg, NULL); - - members = purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sssss", 1, dn, 51, buddy, 57, room, 58, msg?msg2:"", 13, "0"); - for(; members; members = members->next) { - const char *name = purple_conv_chat_cb_get_name(members->data); - if (!strcmp(name, dn)) - continue; - yahoo_packet_hash(pkt, "ss", 52, name, 53, name); - } - - yahoo_packet_send_and_free(pkt, yd); - g_free(msg2); -} - -/* - * Functions dealing with chats - */ - -static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - PurpleConversation *c; - - char *eroom; - gboolean utf8 = 1; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - - ycht_chat_leave(yd->ycht, room, logout); - return; - } - - eroom = yahoo_string_encode(gc, room, &utf8); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", 104, eroom, 109, dn, 108, "1"); - yahoo_packet_hash_str(pkt, 112, "0"); /* what does this one mean? */ - yahoo_packet_send_and_free(pkt, yd); - - yd->in_chat = 0; - if (yd->chat_name) { - g_free(yd->chat_name); - yd->chat_name = NULL; - } - - if ((c = purple_find_chat(gc, YAHOO_CHAT_ID))) - serv_got_chat_left(gc, YAHOO_CHAT_ID); - - if (!logout) - return; - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATLOGOUT, - YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 1, dn); - yahoo_packet_send_and_free(pkt, yd); - - yd->chat_online = FALSE; - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - g_free(eroom); -} - -static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - int me = 0; - char *msg1, *msg2, *room2; - gboolean utf8 = TRUE; - - if (yd->wm) { - g_return_val_if_fail(yd->ycht != NULL, 1); - - return ycht_chat_send(yd->ycht, room, what); - } - - msg1 = g_strdup(what); - - if (purple_message_meify(msg1, -1)) - me = 1; - - msg2 = yahoo_html_to_codes(msg1); - g_free(msg1); - msg1 = yahoo_string_encode(gc, msg2, &utf8); - g_free(msg2); - room2 = yahoo_string_encode(gc, room, NULL); - - pkt = yahoo_packet_new(YAHOO_SERVICE_COMMENT, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sss", 1, dn, 104, room2, 117, msg1); - if (me) - yahoo_packet_hash_str(pkt, 124, "2"); - else - yahoo_packet_hash_str(pkt, 124, "1"); - /* fixme: what about /think? (124=3) */ - if (utf8) - yahoo_packet_hash_str(pkt, 97, "1"); - - yahoo_packet_send_and_free(pkt, yd); - g_free(msg1); - g_free(room2); - - return 0; -} - - -static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy, - const char *room, const char *msg) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *room2, *msg2 = NULL; - gboolean utf8 = TRUE; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - ycht_chat_send_invite(yd->ycht, room, buddy, msg); - return; - } - - room2 = yahoo_string_encode(gc, room, &utf8); - if (msg) - msg2 = yahoo_string_encode(gc, msg, NULL); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sssss", 1, dn, 118, buddy, 104, room2, 117, (msg2?msg2:""), 129, "0"); - yahoo_packet_send_and_free(pkt, yd); - - g_free(room2); - g_free(msg2); -} - -void yahoo_chat_goto(PurpleConnection *gc, const char *name) -{ - YahooData *yd; - struct yahoo_packet *pkt; - - yd = gc->proto_data; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - ycht_chat_goto_user(yd->ycht, name); - return; - } - - if (!yd->chat_online) { - yahoo_chat_online(gc); - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = g_strdup(name); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", 109, name, 1, purple_connection_get_display_name(gc), 62, "2"); - yahoo_packet_send_and_free(pkt, yd); -} -/* - * These are the functions registered with the core - * which get called for both chats and conferences. - */ - -void yahoo_c_leave(PurpleConnection *gc, int id) -{ - YahooData *yd = (YahooData *) gc->proto_data; - PurpleConversation *c; - - if (!yd) - return; - - c = purple_find_chat(gc, id); - if (!c) - return; - - if (id != YAHOO_CHAT_ID) { - yahoo_conf_leave(yd, purple_conversation_get_name(c), - purple_connection_get_display_name(gc), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c))); - yd->confs = g_slist_remove(yd->confs, c); - } else { - yahoo_chat_leave(gc, purple_conversation_get_name(c), purple_connection_get_display_name(gc), TRUE); - } - - serv_got_chat_left(gc, id); -} - -int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) -{ - PurpleConversation *c; - int ret; - YahooData *yd; - - yd = (YahooData *) gc->proto_data; - if (!yd) - return -1; - - c = purple_find_chat(gc, id); - if (!c) - return -1; - - if (id != YAHOO_CHAT_ID) { - ret = yahoo_conf_send(gc, purple_connection_get_display_name(gc), - purple_conversation_get_name(c), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)), what); - } else { - ret = yahoo_chat_send(gc, purple_connection_get_display_name(gc), - purple_conversation_get_name(c), what, flags); - if (!ret) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), - purple_connection_get_display_name(gc), flags, what, time(NULL)); - } - return ret; -} - -GList *yahoo_c_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Room:"); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *yahoo_c_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "room", g_strdup(chat_name)); - - return defaults; -} - -char *yahoo_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "room")); -} - -void yahoo_c_join(PurpleConnection *gc, GHashTable *data) -{ - YahooData *yd; - char *room, *topic, *type; - PurpleConversation *c; - - yd = (YahooData *) gc->proto_data; - if (!yd) - return; - - room = g_hash_table_lookup(data, "room"); - if (!room) - return; - - topic = g_hash_table_lookup(data, "topic"); - if (!topic) - topic = ""; - - if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { - int id; - const char *members = g_hash_table_lookup(data, "members"); - id = yd->conf_id++; - c = serv_got_joined_chat(gc, id, room); - yd->confs = g_slist_prepend(yd->confs, c); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), purple_connection_get_display_name(gc), topic); - yahoo_conf_join(yd, c, purple_connection_get_display_name(gc), room, topic, members); - return; - } else { - const char *id; - /*if (yd->in_chat) - yahoo_chat_leave(gc, room, - purple_connection_get_display_name(gc), - FALSE);*/ - - id = g_hash_table_lookup(data, "id"); - - if (!yd->chat_online) { - yahoo_chat_online(gc); - g_free(yd->pending_chat_room); - yd->pending_chat_room = g_strdup(room); - g_free(yd->pending_chat_id); - yd->pending_chat_id = g_strdup(id); - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = g_strdup(topic); - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - } else { - yahoo_chat_join(gc, purple_connection_get_display_name(gc), room, topic, id); - } - return; - } -} - -void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *name) -{ - PurpleConversation *c; - - c = purple_find_chat(gc, id); - if (!c || !c->name) - return; - - if (id != YAHOO_CHAT_ID) { - yahoo_conf_invite(gc, c, purple_connection_get_display_name(gc), name, - purple_conversation_get_name(c), msg); - } else { - yahoo_chat_invite(gc, purple_connection_get_display_name(gc), name, - purple_conversation_get_name(c), msg); - } -} - -struct yahoo_roomlist { - int fd; - int inpa; - gchar *txbuf; - gsize tx_written; - guchar *rxqueue; - int rxlen; - gboolean started; - char *path; - char *host; - PurpleRoomlist *list; - PurpleRoomlistRoom *cat; - PurpleRoomlistRoom *ucat; - GMarkupParseContext *parse; -}; - -static void yahoo_roomlist_destroy(struct yahoo_roomlist *yrl) -{ - if (yrl->inpa) - purple_input_remove(yrl->inpa); - g_free(yrl->txbuf); - g_free(yrl->rxqueue); - g_free(yrl->path); - g_free(yrl->host); - if (yrl->parse) - g_markup_parse_context_free(yrl->parse); - g_free(yrl); -} - -enum yahoo_room_type { - yrt_yahoo, - yrt_user -}; - -struct yahoo_chatxml_state { - PurpleRoomlist *list; - struct yahoo_roomlist *yrl; - GQueue *q; - struct { - enum yahoo_room_type type; - char *name; - char *topic; - char *id; - int users, voices, webcams; - } room; -}; - -struct yahoo_lobby { - int count, users, voices, webcams; -}; - -static struct yahoo_chatxml_state *yahoo_chatxml_state_new(PurpleRoomlist *list, struct yahoo_roomlist *yrl) -{ - struct yahoo_chatxml_state *s; - - s = g_new0(struct yahoo_chatxml_state, 1); - s->list = list; - s->yrl = yrl; - s->q = g_queue_new(); - - return s; -} - -static void yahoo_chatxml_state_destroy(struct yahoo_chatxml_state *s) -{ - g_queue_free(s->q); - g_free(s->room.name); - g_free(s->room.topic); - g_free(s->room.id); - g_free(s); -} - -static void yahoo_chatlist_start_element(GMarkupParseContext *context, - const gchar *ename, const gchar **anames, - const gchar **avalues, gpointer user_data, - GError **error) -{ - struct yahoo_chatxml_state *s = user_data; - PurpleRoomlist *list = s->list; - PurpleRoomlistRoom *r; - PurpleRoomlistRoom *parent; - int i; - - if (!strcmp(ename, "category")) { - const gchar *name = NULL, *id = NULL; - - for (i = 0; anames[i]; i++) { - if (!strcmp(anames[i], "id")) - id = avalues[i]; - if (!strcmp(anames[i], "name")) - name = avalues[i]; - } - if (!name || !id) - return; - - parent = g_queue_peek_head(s->q); - r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, name, parent); - purple_roomlist_room_add_field(list, r, (gpointer)name); - purple_roomlist_room_add_field(list, r, (gpointer)id); - purple_roomlist_room_add(list, r); - g_queue_push_head(s->q, r); - } else if (!strcmp(ename, "room")) { - s->room.users = s->room.voices = s->room.webcams = 0; - - for (i = 0; anames[i]; i++) { - if (!strcmp(anames[i], "id")) { - g_free(s->room.id); - s->room.id = g_strdup(avalues[i]); - } else if (!strcmp(anames[i], "name")) { - g_free(s->room.name); - s->room.name = g_strdup(avalues[i]); - } else if (!strcmp(anames[i], "topic")) { - g_free(s->room.topic); - s->room.topic = g_strdup(avalues[i]); - } else if (!strcmp(anames[i], "type")) { - if (!strcmp("yahoo", avalues[i])) - s->room.type = yrt_yahoo; - else - s->room.type = yrt_user; - } - } - - } else if (!strcmp(ename, "lobby")) { - struct yahoo_lobby *lob = g_new0(struct yahoo_lobby, 1); - - for (i = 0; anames[i]; i++) { - if (!strcmp(anames[i], "count")) { - lob->count = strtol(avalues[i], NULL, 10); - } else if (!strcmp(anames[i], "users")) { - s->room.users += lob->users = strtol(avalues[i], NULL, 10); - } else if (!strcmp(anames[i], "voices")) { - s->room.voices += lob->voices = strtol(avalues[i], NULL, 10); - } else if (!strcmp(anames[i], "webcams")) { - s->room.webcams += lob->webcams = strtol(avalues[i], NULL, 10); - } - } - g_queue_push_head(s->q, lob); - } -} - -static void yahoo_chatlist_end_element(GMarkupParseContext *context, const gchar *ename, - gpointer user_data, GError **error) -{ - struct yahoo_chatxml_state *s = user_data; - - if (!strcmp(ename, "category")) { - g_queue_pop_head(s->q); - } else if (!strcmp(ename, "room")) { - struct yahoo_lobby *lob; - PurpleRoomlistRoom *r, *l; - - if (s->room.type == yrt_yahoo) - r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY|PURPLE_ROOMLIST_ROOMTYPE_ROOM, - s->room.name, s->yrl->cat); - else - r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY|PURPLE_ROOMLIST_ROOMTYPE_ROOM, - s->room.name, s->yrl->ucat); - - purple_roomlist_room_add_field(s->list, r, s->room.name); - purple_roomlist_room_add_field(s->list, r, s->room.id); - purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.users)); - purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.voices)); - purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.webcams)); - purple_roomlist_room_add_field(s->list, r, s->room.topic); - purple_roomlist_room_add(s->list, r); - - while ((lob = g_queue_pop_head(s->q))) { - char *name = g_strdup_printf("%s:%d", s->room.name, lob->count); - l = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, r); - - purple_roomlist_room_add_field(s->list, l, name); - purple_roomlist_room_add_field(s->list, l, s->room.id); - purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->users)); - purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->voices)); - purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->webcams)); - purple_roomlist_room_add_field(s->list, l, s->room.topic); - purple_roomlist_room_add(s->list, l); - - g_free(name); - g_free(lob); - } - } -} - -static GMarkupParser parser = { - yahoo_chatlist_start_element, - yahoo_chatlist_end_element, - NULL, - NULL, - NULL -}; - -static void yahoo_roomlist_cleanup(PurpleRoomlist *list, struct yahoo_roomlist *yrl) -{ - purple_roomlist_set_in_progress(list, FALSE); - - if (yrl) { - list->proto_data = g_list_remove(list->proto_data, yrl); - yahoo_roomlist_destroy(yrl); - } - - purple_roomlist_unref(list); -} - -static void yahoo_roomlist_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - struct yahoo_roomlist *yrl = data; - PurpleRoomlist *list = yrl->list; - char buf[1024]; - int len; - guchar *start; - struct yahoo_chatxml_state *s; - - len = read(yrl->fd, buf, sizeof(buf)); - - if (len < 0 && errno == EAGAIN) - return; - - if (len <= 0) { - if (yrl->parse) - g_markup_parse_context_end_parse(yrl->parse, NULL); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - yrl->rxqueue = g_realloc(yrl->rxqueue, len + yrl->rxlen); - memcpy(yrl->rxqueue + yrl->rxlen, buf, len); - yrl->rxlen += len; - - if (!yrl->started) { - yrl->started = TRUE; - start = (guchar *)g_strstr_len((char *)yrl->rxqueue, yrl->rxlen, "\r\n\r\n"); - if (!start || (start - yrl->rxqueue + 4) >= yrl->rxlen) - return; - start += 4; - } else { - start = yrl->rxqueue; - } - - if (yrl->parse == NULL) { - s = yahoo_chatxml_state_new(list, yrl); - yrl->parse = g_markup_parse_context_new(&parser, 0, s, - (GDestroyNotify)yahoo_chatxml_state_destroy); - } - - if (!g_markup_parse_context_parse(yrl->parse, (char *)start, (yrl->rxlen - (start - yrl->rxqueue)), NULL)) { - - yahoo_roomlist_cleanup(list, yrl); - return; - } - - yrl->rxlen = 0; -} - -static void yahoo_roomlist_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - struct yahoo_roomlist *yrl; - PurpleRoomlist *list; - int written, remaining; - - yrl = data; - list = yrl->list; - - remaining = strlen(yrl->txbuf) - yrl->tx_written; - written = write(yrl->fd, yrl->txbuf + yrl->tx_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_input_remove(yrl->inpa); - yrl->inpa = 0; - g_free(yrl->txbuf); - yrl->txbuf = NULL; - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - if (written < remaining) { - yrl->tx_written += written; - return; - } - - g_free(yrl->txbuf); - yrl->txbuf = NULL; - - purple_input_remove(yrl->inpa); - yrl->inpa = purple_input_add(yrl->fd, PURPLE_INPUT_READ, - yahoo_roomlist_pending, yrl); - -} - -static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar *error_message) -{ - struct yahoo_roomlist *yrl = data; - PurpleRoomlist *list = yrl->list; - YahooData *yd = purple_account_get_connection(list->account)->proto_data; - - if (source < 0) { - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - yrl->fd = source; - - yrl->txbuf = g_strdup_printf( - "GET http://%s/%s HTTP/1.0\r\n" - "Host: %s\r\n" - "Cookie: Y=%s; T=%s\r\n\r\n", - yrl->host, yrl->path, yrl->host, yd->cookie_y, - yd->cookie_t); - - - yrl->inpa = purple_input_add(yrl->fd, PURPLE_INPUT_WRITE, - yahoo_roomlist_send_cb, yrl); - yahoo_roomlist_send_cb(yrl, yrl->fd, PURPLE_INPUT_WRITE); -} - -PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) -{ - PurpleAccount *account; - PurpleRoomlist *rl; - PurpleRoomlistField *f; - GList *fields = NULL; - struct yahoo_roomlist *yrl; - const char *rll, *rlurl; - char *url; - - account = purple_connection_get_account(gc); - - /* for Yahoo Japan, it appears there is only one valid URL and locale */ - if(purple_account_get_bool(account, "yahoojp", FALSE)) { - rll = YAHOOJP_ROOMLIST_LOCALE; - rlurl = YAHOOJP_ROOMLIST_URL; - } - else { /* but for the rest of the world that isn't the case */ - rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE); - rlurl = purple_account_get_string(account, "room_list", YAHOO_ROOMLIST_URL); - } - - url = g_strdup_printf("%s?chatcat=0&intl=%s", rlurl, rll); - - yrl = g_new0(struct yahoo_roomlist, 1); - rl = purple_roomlist_new(account); - yrl->list = rl; - - purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); - g_free(url); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "id", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Voices"), "voices", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Webcams"), "webcams", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - - purple_roomlist_set_fields(rl, fields); - - if (purple_proxy_connect(gc, account, yrl->host, 80, - yahoo_roomlist_got_connected, yrl) == NULL) - { - purple_notify_error(gc, NULL, _("Connection problem"), _("Unable to fetch room list.")); - yahoo_roomlist_cleanup(rl, yrl); - return NULL; - } - - rl->proto_data = g_list_append(rl->proto_data, yrl); - - purple_roomlist_set_in_progress(rl, TRUE); - return rl; -} - -void yahoo_roomlist_cancel(PurpleRoomlist *list) -{ - GList *l, *k; - - k = l = list->proto_data; - list->proto_data = NULL; - - purple_roomlist_set_in_progress(list, FALSE); - - for (; l; l = l->next) { - yahoo_roomlist_destroy(l->data); - purple_roomlist_unref(list); - } - g_list_free(k); -} - -void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) -{ - struct yahoo_roomlist *yrl; - char *url; - char *id; - const char *rll; - - if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) - return; - - if (!(id = g_list_nth_data(category->fields, 1))) { - purple_roomlist_set_in_progress(list, FALSE); - return; - } - - rll = purple_account_get_string(list->account, "room_list_locale", - YAHOO_ROOMLIST_LOCALE); - - if (rll != NULL && *rll != '\0') { - url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", - purple_account_get_string(list->account,"room_list", - YAHOO_ROOMLIST_URL), id, rll); - } else { - url = g_strdup_printf("%s?chatroom_%s=0", - purple_account_get_string(list->account,"room_list", - YAHOO_ROOMLIST_URL), id); - } - - yrl = g_new0(struct yahoo_roomlist, 1); - yrl->list = list; - yrl->cat = category; - list->proto_data = g_list_append(list->proto_data, yrl); - - purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); - g_free(url); - - yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); - purple_roomlist_room_add(list, yrl->ucat); - - if (purple_proxy_connect(purple_account_get_connection(list->account), - list->account, yrl->host, 80, - yahoo_roomlist_got_connected, yrl) == NULL) - { - purple_notify_error(purple_account_get_connection(list->account), - NULL, _("Connection problem"), _("Unable to fetch room list.")); - purple_roomlist_ref(list); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - purple_roomlist_set_in_progress(list, TRUE); - purple_roomlist_ref(list); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoochat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/** - * @file yahoochat.h The Yahoo! protocol plugin, chat and conference stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOOCHAT_H_ -#define _YAHOOCHAT_H_ - -#include "roomlist.h" -#include "yahoo_packet.h" - -void yahoo_process_conference_invite(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_decline(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_logon(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_logoff(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_message(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_addinvite(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_goto(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_c_leave(PurpleConnection *gc, int id); -int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags); -GList *yahoo_c_info(PurpleConnection *gc); -GHashTable *yahoo_c_info_defaults(PurpleConnection *gc, const char *chat_name); -void yahoo_c_join(PurpleConnection *gc, GHashTable *data); -char *yahoo_get_chat_name(GHashTable *data); -void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *name); - -void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *who); - -void yahoo_chat_goto(PurpleConnection *gc, const char *name); - -/* room listing functions */ -PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc); -void yahoo_roomlist_cancel(PurpleRoomlist *list); -void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); - -/* util */ -void yahoo_chat_add_users(PurpleConvChat *chat, GList *newusers); -void yahoo_chat_add_user(PurpleConvChat *chat, const char *user, const char *reason); - -#endif /* _YAHOO_CHAT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,611 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/****************************************************************************** - * INCLUDES - *****************************************************************************/ -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cipher.h" -#include "cmds.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "server.h" -#include "util.h" -#include "version.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoo_friend.h" -#include "yahoochat.h" -#include "ycht.h" -#include "yahoo_filexfer.h" -#include "yahoo_picture.h" - -#include "whiteboard.h" -#include "yahoo_doodle.h" - -/****************************************************************************** - * Globals - *****************************************************************************/ -#if 0 -const int DefaultColorRGB24[] = -{ - DOODLE_COLOR_RED, - DOODLE_COLOR_ORANGE, - DOODLE_COLOR_YELLOW, - DOODLE_COLOR_GREEN, - DOODLE_COLOR_CYAN, - DOODLE_COLOR_BLUE, - DOODLE_COLOR_VIOLET, - DOODLE_COLOR_PURPLE, - DOODLE_COLOR_TAN, - DOODLE_COLOR_BROWN, - DOODLE_COLOR_BLACK, - DOODLE_COLOR_GREY, - DOODLE_COLOR_WHITE -}; -#endif - -/****************************************************************************** - * Functions - *****************************************************************************/ -PurpleCmdRet yahoo_doodle_purple_cmd_start(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) -{ - PurpleAccount *account; - PurpleConnection *gc; - const gchar *name; - - if(*args && args[0]) - return PURPLE_CMD_RET_FAILED; - - account = purple_conversation_get_account(conv); - gc = purple_account_get_connection(account); - name = purple_conversation_get_name(conv); - yahoo_doodle_initiate(gc, name); - - /* Write a local message to this conversation showing that a request for a - * Doodle session has been made - */ - purple_conv_im_write(PURPLE_CONV_IM(conv), "", _("Sent Doodle request."), - PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_RECV, time(NULL)); - - return PURPLE_CMD_RET_OK; -} - -void yahoo_doodle_initiate(PurpleConnection *gc, const char *name) -{ - PurpleAccount *account; - char *to = (char*)name; - PurpleWhiteboard *wb; - - g_return_if_fail(gc); - g_return_if_fail(name); - - account = purple_connection_get_account(gc); - wb = purple_whiteboard_get_session(account, to); - - if(wb == NULL) - { - /* Insert this 'session' in the list. At this point, it's only a - * requested session. - */ - wb = purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); - } - - /* NOTE Perhaps some careful handling of remote assumed established - * sessions - */ - - yahoo_doodle_command_send_ready(gc, to, DOODLE_IMV_KEY); - yahoo_doodle_command_send_request(gc, to, DOODLE_IMV_KEY); - -} - -static void yahoo_doodle_command_got_request(PurpleConnection *gc, const char *from, const char *imv_key) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Request (%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - /* If a session with the remote user doesn't exist */ - if(wb == NULL) - { - doodle_session *ds; - /* Ask user if they wish to accept the request for a doodle session */ - /* TODO Ask local user to start Doodle session with remote user */ - /* NOTE This if/else statement won't work right--must use dialog - * results - */ - - /* char dialog_message[64]; - g_sprintf(dialog_message, "%s is requesting to start a Doodle session with you.", from); - - purple_notify_message(NULL, PURPLE_NOTIFY_MSG_INFO, "Doodle", - dialog_message, NULL, NULL, NULL); - */ - - wb = purple_whiteboard_create(account, from, DOODLE_STATE_REQUESTED); - ds = wb->proto_data; - ds->imv_key = g_strdup(imv_key); - - yahoo_doodle_command_send_ready(gc, from, imv_key); - } - - /* TODO Might be required to clear the canvas of an existing doodle - * session at this point - */ -} - -static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *from, const char *imv_key) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Ready(%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - if(wb->state == DOODLE_STATE_REQUESTING) - { - doodle_session *ds = wb->proto_data; - purple_whiteboard_start(wb); - - wb->state = DOODLE_STATE_ESTABLISHED; - - yahoo_doodle_command_send_confirm(gc, from, imv_key); - /* Let's steal the imv_key and reuse it */ - g_free(ds->imv_key); - ds->imv_key = g_strdup(imv_key); - } - else if(wb->state == DOODLE_STATE_ESTABLISHED) - { - /* TODO Ask whether to save picture too */ - purple_whiteboard_clear(wb); - } - - /* NOTE Not sure about this... I am trying to handle if the remote user - * already thinks we're in a session with them (when their chat message - * contains the doodle imv key) - */ - else if(wb->state == DOODLE_STATE_REQUESTED) - { - /* purple_whiteboard_start(wb); */ - yahoo_doodle_command_send_ready(gc, from, imv_key); - } -} - -static void yahoo_doodle_command_got_draw(PurpleConnection *gc, const char *from, const char *message) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - char **tokens; - int i; - GList *d_list = NULL; /* a local list of drawing info */ - - g_return_if_fail(message != NULL); - - purple_debug_info("yahoo", "doodle: Got Draw (%s)\n", from); - purple_debug_info("yahoo", "doodle: Draw message: %s\n", message); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - /* TODO Functionalize - * Convert drawing packet message to an integer list - */ - - /* Check to see if the message begans and ends with quotes */ - if((message[0] != '\"') || (message[strlen(message) - 1] != '\"')) - return; - - /* Ignore the inital quotation mark. */ - message += 1; - - tokens = g_strsplit(message, ",", 0); - - /* Traverse and extract all integers divided by commas */ - for (i = 0; tokens[i] != NULL; i++) - { - int last = strlen(tokens[i]) - 1; - if (tokens[i][last] == '"') - tokens[i][last] = '\0'; - - d_list = g_list_prepend(d_list, GINT_TO_POINTER(atoi(tokens[i]))); - } - d_list = g_list_reverse(d_list); - - g_strfreev(tokens); - - yahoo_doodle_draw_stroke(wb, d_list); - - /* goodle_doodle_session_set_canvas_as_icon(ds); */ - - g_list_free(d_list); -} - - -static void yahoo_doodle_command_got_clear(PurpleConnection *gc, const char *from) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Clear (%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - if(wb->state == DOODLE_STATE_ESTABLISHED) - { - /* TODO Ask user whether to save the image before clearing it */ - - purple_whiteboard_clear(wb); - } -} - - -static void -yahoo_doodle_command_got_extra(PurpleConnection *gc, const char *from, const char *message, const char *imv_key) -{ - purple_debug_info("yahoo", "doodle: Got Extra (%s)\n", from); - - /* I do not like these 'extra' features, so I'll only handle them in one - * way, which is returning them with the command/packet to turn them off - */ - yahoo_doodle_command_send_extra(gc, from, DOODLE_EXTRA_NONE, imv_key); -} - -static void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *from) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Confirm (%s)\n", from); - - /* Get the doodle session */ - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - /* TODO Combine the following IF's? */ - - /* Check if we requested a doodle session */ - /*if(wb->state == DOODLE_STATE_REQUESTING) - { - wb->state = DOODLE_STATE_ESTABLISHED; - - purple_whiteboard_start(wb); - - yahoo_doodle_command_send_confirm(gc, from); - }*/ - - /* Check if we accepted a request for a doodle session */ - if(wb->state == DOODLE_STATE_REQUESTED) - { - wb->state = DOODLE_STATE_ESTABLISHED; - - purple_whiteboard_start(wb); - } -} - -void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - g_return_if_fail(from != NULL); - - purple_debug_info("yahoo", "doodle: Got Shutdown (%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - /* TODO Ask if user wants to save picture before the session is closed */ - - wb->state = DOODLE_STATE_CANCELED; - purple_whiteboard_destroy(wb); -} - -static void yahoo_doodle_command_send_generic(const char *type, - PurpleConnection *gc, - const char *to, - const char *message, - int command, - const char *imv, - const char *sixtyfour) -{ - YahooData *yd; - struct yahoo_packet *pkt; - - purple_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to); - - yd = gc->proto_data; - - /* Make and send an acknowledge (ready) Doodle packet */ - pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT"); - yahoo_packet_hash_str(pkt, 1, purple_account_get_username(gc->account)); - yahoo_packet_hash_str(pkt, 14, message); - yahoo_packet_hash_int(pkt, 13, command); - yahoo_packet_hash_str(pkt, 5, to); - yahoo_packet_hash_str(pkt, 63, imv ? imv : DOODLE_IMV_KEY); - yahoo_packet_hash_str(pkt, 64, sixtyfour); - yahoo_packet_hash_str(pkt, 1002, "1"); - - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_doodle_command_send_ready(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Ready", gc, to, "1", DOODLE_CMD_READY, imv_key, "1"); -} - -void yahoo_doodle_command_send_request(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Request", gc, to, "", DOODLE_CMD_REQUEST, imv_key, "0"); -} - -void yahoo_doodle_command_send_draw(PurpleConnection *gc, const char *to, const char *message, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Draw", gc, to, message, DOODLE_CMD_DRAW, imv_key, "1"); -} - -void yahoo_doodle_command_send_clear(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Clear", gc, to, " ", DOODLE_CMD_CLEAR, imv_key, "1"); -} - -void yahoo_doodle_command_send_extra(PurpleConnection *gc, const char *to, const char *message, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Extra", gc, to, message, DOODLE_CMD_EXTRA, imv_key, "1"); -} - -void yahoo_doodle_command_send_confirm(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Confirm", gc, to, "1", DOODLE_CMD_CONFIRM, imv_key, "1"); -} - -void yahoo_doodle_command_send_shutdown(PurpleConnection *gc, const char *to) -{ - yahoo_doodle_command_send_generic("Shutdown", gc, to, "", DOODLE_CMD_SHUTDOWN, ";0", "0"); -} - -void yahoo_doodle_start(PurpleWhiteboard *wb) -{ - doodle_session *ds = g_new0(doodle_session, 1); - - /* purple_debug_debug("yahoo", "doodle: yahoo_doodle_start()\n"); */ - - /* Set default brush size and color */ - ds->brush_size = DOODLE_BRUSH_SMALL; - ds->brush_color = DOODLE_COLOR_RED; - - wb->proto_data = ds; -} - -void yahoo_doodle_end(PurpleWhiteboard *wb) -{ - PurpleConnection *gc = purple_account_get_connection(wb->account); - doodle_session *ds = wb->proto_data; - - /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */ - - if (gc && wb->state != DOODLE_STATE_CANCELED) - yahoo_doodle_command_send_shutdown(gc, wb->who); - - g_free(ds->imv_key); - g_free(wb->proto_data); -} - -void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - /* standard Doodle canvases are of one size: 368x256 */ - *width = DOODLE_CANVAS_WIDTH; - *height = DOODLE_CANVAS_HEIGHT; -} - -static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list) -{ - GString *message; - - g_return_val_if_fail(draw_list != NULL, NULL); - - message = g_string_new(""); - g_string_printf(message, "\"%d,%d", ds->brush_color, ds->brush_size); - - for(; draw_list != NULL; draw_list = draw_list->next) - { - g_string_append_printf(message, ",%d", GPOINTER_TO_INT(draw_list->data)); - } - g_string_append_c(message, '"'); - - return g_string_free(message, FALSE); -} - -void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list) -{ - doodle_session *ds = wb->proto_data; - char *message; - - g_return_if_fail(draw_list != NULL); - - message = yahoo_doodle_build_draw_string(ds, draw_list); - yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message, ds->imv_key); - g_free(message); -} - -void yahoo_doodle_clear(PurpleWhiteboard *wb) -{ - doodle_session *ds = wb->proto_data; - yahoo_doodle_command_send_clear(wb->account->gc, wb->who, ds->imv_key); -} - - -/* Traverse through the list and draw the points and lines */ -void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list) -{ - int brush_color; - int brush_size; - int x; - int y; - - g_return_if_fail(draw_list != NULL); - - brush_color = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - brush_size = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - x = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - y = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - /* - purple_debug_debug("yahoo", "doodle: Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size, x, y); - */ - - while(draw_list != NULL && draw_list->next != NULL) - { - int dx = GPOINTER_TO_INT(draw_list->data); - int dy = GPOINTER_TO_INT(draw_list->next->data); - - purple_whiteboard_draw_line(wb, - x, y, - x + dx, y + dy, - brush_color, brush_size); - - x += dx; - y += dy; - - draw_list = draw_list->next->next; - } -} - -void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - doodle_session *ds = wb->proto_data; - *size = ds->brush_size; - *color = ds->brush_color; -} - -void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - doodle_session *ds = wb->proto_data; - ds->brush_size = size; - ds->brush_color = color; - - /* Notify the core about the changes */ - purple_whiteboard_set_brush(wb, size, color); -} - -void yahoo_doodle_process(PurpleConnection *gc, const char *me, const char *from, - const char *command, const char *message, const char *imv_key) -{ - if(!command) - return; - - /* Now check to see what sort of Doodle message it is */ - switch(atoi(command)) - { - case DOODLE_CMD_REQUEST: - yahoo_doodle_command_got_request(gc, from, imv_key); - break; - - case DOODLE_CMD_READY: - yahoo_doodle_command_got_ready(gc, from, imv_key); - break; - - case DOODLE_CMD_CLEAR: - yahoo_doodle_command_got_clear(gc, from); - break; - - case DOODLE_CMD_DRAW: - yahoo_doodle_command_got_draw(gc, from, message); - break; - - case DOODLE_CMD_EXTRA: - yahoo_doodle_command_got_extra(gc, from, message, imv_key); - break; - - case DOODLE_CMD_CONFIRM: - yahoo_doodle_command_got_confirm(gc, from); - break; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_doodle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/** - * @file yahoo_doodle.h The Yahoo! protocol plugin Doodle IMVironment object - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOO_DOODLE_H_ -#define _YAHOO_DOODLE_H_ - -/****************************************************************************** - * Includes - *****************************************************************************/ -#include "whiteboard.h" -#include "cmds.h" - -#define DOODLE_IMV_KEY "doodle;106" - -/****************************************************************************** - * Defines - *****************************************************************************/ -/* Doodle communication commands */ -/* TODO: Should be an enum. */ -#define DOODLE_CMD_REQUEST 0 -#define DOODLE_CMD_CLEAR 1 -#define DOODLE_CMD_DRAW 2 -#define DOODLE_CMD_EXTRA 3 -#define DOODLE_CMD_READY 4 -#define DOODLE_CMD_CONFIRM 5 -/* Doodle communication command for shutting down (also 0) */ -#define DOODLE_CMD_SHUTDOWN 0 - -#define DOODLE_EXTRA_NONE "\"1\"" -#define DOODLE_EXTRA_TICTACTOE "\"3\"" -#define DOODLE_EXTRA_DOTS "\"2\"" - -/* Doodle session states */ -/* TODO: Should be an enum. */ -#define DOODLE_STATE_REQUESTING 0 -#define DOODLE_STATE_REQUESTED 1 -#define DOODLE_STATE_ESTABLISHED 2 -#define DOODLE_STATE_CANCELED 3 - -/* Doodle canvas dimensions */ -#define DOODLE_CANVAS_WIDTH 368 -#define DOODLE_CANVAS_HEIGHT 256 - -/* Doodle color codes (most likely RGB) */ -/* TODO: Should be an enum and sorted by color name. */ -#define DOODLE_COLOR_RED 13369344 -#define DOODLE_COLOR_ORANGE 16737792 -#define DOODLE_COLOR_YELLOW 15658496 -#define DOODLE_COLOR_GREEN 52224 -#define DOODLE_COLOR_CYAN 52428 -#define DOODLE_COLOR_BLUE 204 -#define DOODLE_COLOR_VIOLET 5381277 -#define DOODLE_COLOR_PURPLE 13369548 -#define DOODLE_COLOR_TAN 12093547 -#define DOODLE_COLOR_BROWN 5256485 -#define DOODLE_COLOR_BLACK 0 -#define DOODLE_COLOR_GREY 11184810 -#define DOODLE_COLOR_WHITE 16777215 - -#define PALETTE_NUM_OF_COLORS 12 - -/* Doodle brush sizes (most likely variable) */ -#define DOODLE_BRUSH_SMALL 2 -#define DOODLE_BRUSH_MEDIUM 5 -#define DOODLE_BRUSH_LARGE 10 - -#define DOODLE_MAX_BRUSH_MOTIONS 100 - -/****************************************************************************** - * Datatypes - *****************************************************************************/ -typedef struct _doodle_session -{ - int brush_size; /* Size of drawing brush */ - int brush_color; /* Color of drawing brush */ - gchar *imv_key; -} doodle_session; - -/****************************************************************************** - * API - *****************************************************************************/ - -PurpleCmdRet yahoo_doodle_purple_cmd_start(PurpleConversation *conv, const char *cmd, char **args, - char **error, void *data); - -void yahoo_doodle_process(PurpleConnection *gc, const char *me, const char *from, - const char *command, const char *message, const char *imv_key); -void yahoo_doodle_initiate(PurpleConnection *gc, const char *to); - -void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from); - -void yahoo_doodle_command_send_request(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_ready(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_draw(PurpleConnection *gc, const char *to, const char *message, const char *imv_key); -void yahoo_doodle_command_send_clear(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_extra(PurpleConnection *gc, const char *to, const char *message, const char *imv_key); -void yahoo_doodle_command_send_confirm(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_shutdown(PurpleConnection *gc, const char *to); - -void yahoo_doodle_start(PurpleWhiteboard *wb); -void yahoo_doodle_end(PurpleWhiteboard *wb); -void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list); -void yahoo_doodle_clear(PurpleWhiteboard *wb); - -void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list); -void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color); - -#endif /* _YAHOO_DOODLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1943 +0,0 @@ -/* - * @file yahoo_filexfer.c Yahoo Filetransfer - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "dnsquery.h" - -#include "prpl.h" -#include "util.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "proxy.h" -#include "ft.h" -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoo_filexfer.h" -#include "yahoo_doodle.h" -#include "yahoo_friend.h" - -struct yahoo_xfer_data { - gchar *host; - gchar *path; - int port; - PurpleConnection *gc; - long expires; - gboolean started; - gchar *txbuf; - gsize txbuflen; - gsize txbuf_written; - guint tx_handler; - gchar *rxqueue; - guint rxlen; - gchar *xfer_peer_idstring; - gchar *xfer_idstring_for_relay; - int version; /* 0 for old, 15 for Y7(YMSG 15) */ - int info_val_249; - - enum { - STARTED = 0, - HEAD_REQUESTED, - HEAD_REPLY_RECEIVED, - TRANSFER_PHASE, - ACCEPTED, - P2P_HEAD_REQUESTED, - P2P_HEAD_REPLIED, - P2P_GET_REQUESTED - } status_15; - - /* contains all filenames, in case of multiple transfers, with the first - * one in the list being the current file's name (ymsg15) */ - GSList *filename_list; - GSList *size_list; /* corresponds to filename_list, with size as **STRING** */ - gboolean firstoflist; - gchar *xfer_url; /* url of the file, used when we are p2p server */ - int yahoo_local_p2p_ft_server_fd; - int yahoo_local_p2p_ft_server_port; - int yahoo_p2p_ft_server_watcher; - int input_event; -}; - -static void yahoo_xfer_data_free(struct yahoo_xfer_data *xd) -{ - PurpleConnection *gc; - YahooData *yd; - PurpleXfer *xfer; - GSList *l; - - gc = xd->gc; - yd = gc->proto_data; - - /* remove entry from map */ - if(xd->xfer_peer_idstring) { - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring); - if(xfer) - g_hash_table_remove(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring); - } - - /* empty file & filesize list */ - for (l = xd->filename_list; l; l = l->next) { - g_free(l->data); - l->data=NULL; - } - for (l = xd->size_list; l; l = l->next) { - g_free(l->data); - l->data=NULL; - } - g_slist_free(xd->filename_list); - g_slist_free(xd->size_list); - - g_free(xd->host); - g_free(xd->path); - g_free(xd->txbuf); - g_free(xd->xfer_peer_idstring); - g_free(xd->xfer_idstring_for_relay); - if (xd->tx_handler) - purple_input_remove(xd->tx_handler); - g_free(xd); -} - -static void yahoo_receivefile_send_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int remaining, written; - - xfer = data; - xd = xfer->data; - - remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - if (written < remaining) { - xd->txbuf_written += written; - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - g_free(xd->txbuf); - xd->txbuf = NULL; - xd->txbuflen = 0; - - purple_xfer_start(xfer, source, NULL, 0); - -} - -static void yahoo_receivefile_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - - purple_debug_info("yahoo", "in yahoo_receivefile_connected\n"); - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { - purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); - purple_xfer_cancel_remote(xfer); - return; - } - - xfer->fd = source; - - /* The first time we get here, assemble the tx buffer */ - if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", - xd->path, xd->host); - xd->txbuflen = strlen(xd->txbuf); - xd->txbuf_written = 0; - } - - if (!xd->tx_handler) - { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_receivefile_send_cb, xfer); - yahoo_receivefile_send_cb(xfer, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_sendfile_send_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int written, remaining; - - xfer = data; - xd = xfer->data; - - remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - if (written < remaining) { - xd->txbuf_written += written; - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - g_free(xd->txbuf); - xd->txbuf = NULL; - xd->txbuflen = 0; - - purple_xfer_start(xfer, source, NULL, 0); -} - -static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - struct yahoo_packet *pkt; - gchar *size, *filename, *encoded_filename, *header; - guchar *pkt_buf; - const char *host; - int port; - size_t content_length, header_len, pkt_buf_len; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - - purple_debug_info("yahoo", "in yahoo_sendfile_connected\n"); - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - - if (source < 0) { - purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); - purple_xfer_cancel_remote(xfer); - return; - } - - xfer->fd = source; - - /* Assemble the tx buffer */ - gc = xd->gc; - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - encoded_filename = yahoo_string_encode(gc, filename, NULL); - - yahoo_packet_hash(pkt, "sssss", 0, purple_connection_get_display_name(gc), - 5, xfer->who, 14, "", 27, encoded_filename, 28, size); - g_free(size); - g_free(encoded_filename); - g_free(filename); - - content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt); - - pkt_buf_len = yahoo_packet_build(pkt, 4, FALSE, yd->jp, &pkt_buf); - yahoo_packet_free(pkt); - - host = purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST); - port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); - header = g_strdup_printf( - "POST http://%s:%d/notifyft HTTP/1.0\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n" - "Host: %s:%d\r\n" - "Cookie: Y=%s; T=%s\r\n" - "\r\n", - host, port, content_length + 4 + purple_xfer_get_size(xfer), - host, port, yd->cookie_y, yd->cookie_t); - - header_len = strlen(header); - - xd->txbuflen = header_len + pkt_buf_len + 4; - xd->txbuf = g_malloc(xd->txbuflen); - - memcpy(xd->txbuf, header, header_len); - g_free(header); - memcpy(xd->txbuf + header_len, pkt_buf, pkt_buf_len); - g_free(pkt_buf); - memcpy(xd->txbuf + header_len + pkt_buf_len, "29\xc0\x80", 4); - - xd->txbuf_written = 0; - - if (xd->tx_handler == 0) - { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_sendfile_send_cb, xfer); - yahoo_sendfile_send_cb(xfer, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_xfer_init(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - - xfer_data = xfer->data; - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - if (yd->jp) { - if (purple_proxy_connect(gc, account, purple_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), - purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_sendfile_connected, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } else { - if (purple_proxy_connect(gc, account, purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), - purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_sendfile_connected, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } - } else { - xfer->fd = -1; - if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, - yahoo_receivefile_connected, xfer) == NULL) { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } -} - -static void yahoo_xfer_init_15(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - struct yahoo_packet *pkt; - - xfer_data = xfer->data; - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - gchar *filename; - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, - yd->session_id); - yahoo_packet_hash(pkt, "sssiiiisiii", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 1, - 266, 1, - 302, 268, - 300, 268, - 27, filename, - 28, xfer->size, - 301, 268, - 303, 268); - g_free(filename); - } else { - if(xfer_data->firstoflist == TRUE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 3); - } else { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 271, 1); - } - } - yahoo_packet_send_and_free(pkt, yd); -} - -static void yahoo_xfer_start(PurpleXfer *xfer) -{ - /* We don't need to do anything here, do we? */ -} - -static guint calculate_length(const gchar *l, size_t len) -{ - int i; - - for (i = 0; i < len; i++) { - if (!g_ascii_isdigit(l[i])) - continue; - return strtol(l + i, NULL, 10); - } - return 0; -} - -static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) -{ - gchar buf[4096]; - gssize len; - gchar *start = NULL; - gchar *length; - gchar *end; - int filelen; - struct yahoo_xfer_data *xd = xfer->data; - - if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) { - return 0; - } - - len = read(xfer->fd, buf, sizeof(buf)); - - if (len <= 0) { - if ((purple_xfer_get_size(xfer) > 0) && - (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))) { - purple_xfer_set_completed(xfer, TRUE); - return 0; - } else - return -1; - } - - if (!xd->started) { - xd->rxqueue = g_realloc(xd->rxqueue, len + xd->rxlen); - memcpy(xd->rxqueue + xd->rxlen, buf, len); - xd->rxlen += len; - - length = g_strstr_len(xd->rxqueue, len, "Content-length:"); - /* some proxies re-write this header, changing the capitalization :( - * technically that's allowed since headers are case-insensitive - * [RFC 2616, section 4.2] */ - if (length == NULL) - length = g_strstr_len(xd->rxqueue, len, "Content-Length:"); - if (length) { - end = g_strstr_len(length, length - xd->rxqueue, "\r\n"); - if (!end) - return 0; - if ((filelen = calculate_length(length, len - (length - xd->rxqueue)))) - purple_xfer_set_size(xfer, filelen); - } - start = g_strstr_len(xd->rxqueue, len, "\r\n\r\n"); - if (start) - start += 4; - if (!start || start > (xd->rxqueue + len)) - return 0; - xd->started = TRUE; - - len -= (start - xd->rxqueue); - - *buffer = g_malloc(len); - memcpy(*buffer, start, len); - g_free(xd->rxqueue); - xd->rxqueue = NULL; - xd->rxlen = 0; - } else { - *buffer = g_malloc(len); - memcpy(*buffer, buf, len); - } - - return len; -} - -static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xfer) -{ - gssize len; - struct yahoo_xfer_data *xd = xfer->data; - - if (!xd) - return -1; - - if (purple_xfer_get_type(xfer) != PURPLE_XFER_SEND) { - return -1; - } - - len = write(xfer->fd, buffer, size); - - if (len == -1) { - if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) - purple_xfer_set_completed(xfer, TRUE); - if ((errno != EAGAIN) && (errno != EINTR)) - return -1; - return 0; - } - - if ((purple_xfer_get_bytes_sent(xfer) + len) >= purple_xfer_get_size(xfer)) - purple_xfer_set_completed(xfer, TRUE); - - return len; -} - -static void yahoo_xfer_cancel_send(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - - xfer_data = xfer->data; - - if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) - { - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - struct yahoo_packet *pkt; - - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, - YAHOO_STATUS_DISCONNECTED, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 66, -1); - } - else - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 2); - } - yahoo_packet_send_and_free(pkt, yd); - } - - - if (xfer_data) - yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; -} - -static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - - xfer_data = xfer->data; - - if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) - { - - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - struct yahoo_packet *pkt; - - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 4); - } - else - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_DISCONNECTED, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 66, -1); - } - yahoo_packet_send_and_free(pkt, yd); - } - - if (xfer_data) - yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; -} - -/* Send HTTP OK after receiving file */ -static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) -{ - char *tx = NULL; - int written; - - tx = g_strdup_printf("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"); - written = write(xfer->fd, tx, strlen(tx)); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) - purple_debug_info("yahoo", "p2p filetransfer: Unable to write HTTP OK"); - - /* close connection */ - close(xfer->fd); - xfer->fd = -1; - g_free(tx); -} - -static void yahoo_xfer_end(PurpleXfer *xfer_old) -{ - struct yahoo_xfer_data *xfer_data; - PurpleXfer *xfer = NULL; - PurpleConnection *gc; - YahooData *yd; - - xfer_data = xfer_old->data; - if(xfer_data && xfer_data->version == 15 - && purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE - && xfer_data->filename_list) { - - /* Send HTTP OK in case of p2p transfer, when we act as server */ - if((xfer_data->xfer_url != NULL) && (xfer_old->fd >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) - yahoo_p2p_ft_server_send_OK(xfer_old); - - /* removing top of filename & size list completely */ - g_free( xfer_data->filename_list->data ); - g_free( xfer_data->size_list->data ); - - xfer_data->filename_list->data = NULL; - xfer_data->size_list->data = NULL; - - xfer_data->filename_list = g_slist_delete_link(xfer_data->filename_list, xfer_data->filename_list); - xfer_data->size_list = g_slist_delete_link(xfer_data->size_list, xfer_data->size_list); - - /* if there are still more files */ - if(xfer_data->filename_list) - { - gchar* filename; - long filesize; - - filename = xfer_data->filename_list->data; - filesize = atol( xfer_data->size_list->data ); - - gc = xfer_data->gc; - yd = gc->proto_data; - - /* setting up xfer_data for next file's tranfer */ - g_free(xfer_data->host); - g_free(xfer_data->path); - g_free(xfer_data->txbuf); - g_free(xfer_data->rxqueue); - g_free(xfer_data->xfer_idstring_for_relay); - if (xfer_data->tx_handler) - purple_input_remove(xfer_data->tx_handler); - xfer_data->host = NULL; - xfer_data->host = NULL; - xfer_data->port = 0; - xfer_data->expires = 0; - xfer_data->started = FALSE; - xfer_data->txbuf = NULL; - xfer_data->txbuflen = 0; - xfer_data->txbuf_written = 0; - xfer_data->tx_handler = 0; - xfer_data->rxqueue = NULL; - xfer_data->rxlen = 0; - xfer_data->xfer_idstring_for_relay = NULL; - xfer_data->info_val_249 = 0; - xfer_data->status_15 = STARTED; - xfer_data->firstoflist = FALSE; - - /* Dereference xfer_data from old xfer */ - xfer_old->data = NULL; - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); - - - if (xfer) { - /* Set the info about the incoming file. */ - char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - purple_xfer_set_size(xfer, filesize); - - xfer->data = xfer_data; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); - - /* update map to current xfer */ - g_hash_table_remove(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring); - g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer); - - /* Now perform the request */ - purple_xfer_request(xfer); - } - return; - } - } - if (xfer_data) - yahoo_xfer_data_free(xfer_data); - xfer_old->data = NULL; - -} - -void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - - char *me = NULL; - char *from = NULL; - char *service = NULL; - char *message = NULL; - char *command = NULL; - char *imv = NULL; - char *unknown = NULL; - - /* Get all the necessary values from this new packet */ - while(l != NULL) - { - struct yahoo_pair *pair = l->data; - - switch(pair->key) { - case 5: /* Get who the packet is for */ - me = pair->value; - break; - case 4: /* Get who the packet is from */ - from = pair->value; - break; - case 49: /* Get the type of service */ - service = pair->value; - break; - case 14: /* Get the 'message' of the packet */ - message = pair->value; - break; - case 13: /* Get the command associated with this packet */ - command = pair->value; - break; - case 63: /* IMVironment name and version */ - imv = pair->value; - break; - case 64: /* Not sure, but it does vary with initialization of Doodle */ - unknown = pair->value; /* So, I'll keep it (for a little while atleast) */ - break; - } - - l = l->next; - } - - /* If this packet is an IMVIRONMENT, handle it accordingly */ - if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT")) - { - /* Check for a Doodle packet and handle it accordingly */ - if(strstr(imv, "doodle;") != NULL) - yahoo_doodle_process(gc, me, from, command, message, imv); - - /* If an IMVIRONMENT packet comes without a specific imviroment name */ - if(!strcmp(imv, ";0")) - { - /* It is unfortunately time to close all IMVironments with the remote client */ - yahoo_doodle_command_got_shutdown(gc, from); - } - } -} - -void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *from = NULL; - char *to = NULL; - char *msg = NULL; - char *url = NULL; - char *imv = NULL; - long expires = 0; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - char *service = NULL; - char *filename = NULL; - unsigned long filesize = 0L; - GSList *l; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - from = pair->value; - break; - case 5: - to = pair->value; - break; - case 14: - msg = pair->value; - break; - case 20: - url = pair->value; - break; - case 38: - expires = strtol(pair->value, NULL, 10); - break; - case 27: - filename = pair->value; - break; - case 28: - filesize = atol(pair->value); - break; - case 49: - service = pair->value; - break; - case 63: - imv = pair->value; - break; - } - } - - /* - * The remote user has changed their IMVironment. We - * record it for later use. - */ - if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { - g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); - return; - } - - if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { - if (service && (strcmp("FILEXFER", service) != 0)) { - purple_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); - return; - } - } - - if (msg) { - char *tmp; - tmp = strchr(msg, '\006'); - if (tmp) - *tmp = '\0'; - } - - if (!url || !from) - return; - - /* Setup the Yahoo-specific file transfer data */ - xfer_data = g_new0(struct yahoo_xfer_data, 1); - xfer_data->gc = gc; - if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) { - g_free(xfer_data); - return; - } - - purple_debug_misc("yahoo_filexfer", "Host is %s, port is %d, path is %s, and the full url was %s.\n", - xfer_data->host, xfer_data->port, xfer_data->path, url); - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); - if (xfer == NULL) { - g_free(xfer_data); - g_return_if_reached(); - } - - xfer->data = xfer_data; - - /* Set the info about the incoming file. */ - if (filename) { - char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - } else { - gchar *start, *end; - start = g_strrstr(xfer_data->path, "/"); - if (start) - start++; - end = g_strrstr(xfer_data->path, "?"); - if (start && *start && end) { - char *utf8_filename; - filename = g_strndup(start, end - start); - utf8_filename = yahoo_string_decode(gc, filename, TRUE); - g_free(filename); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - filename = NULL; - } - } - - purple_xfer_set_size(xfer, filesize); - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - - /* Now perform the request */ - purple_xfer_request(xfer); -} - -PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xfer_data; - - g_return_val_if_fail(who != NULL, NULL); - - xfer_data = g_new0(struct yahoo_xfer_data, 1); - xfer_data->gc = gc; - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - if (xfer == NULL) - { - g_free(xfer_data); - g_return_val_if_reached(NULL); - } - - xfer->data = xfer_data; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - - return xfer; -} - -static gchar* yahoo_xfer_new_xfer_id(void) -{ - gchar *ans; - int i,j; - ans = g_strnfill(24, ' '); - ans[23] = '$'; - ans[22] = '$'; - for(i = 0; i < 22; i++) - { - j = g_random_int_range (0,61); - if(j < 26) - ans[i] = j + 'a'; - else if(j < 52) - ans[i] = j - 26 + 'A'; - else - ans[i] = j - 52 + '0'; - } - return ans; -} - -static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - struct sockaddr_in *addr; - struct yahoo_packet *pkt; - long actaddr; - long a,b,c,d; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - gchar *url; - gchar *filename; - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - gc = xd->gc; - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - if(!hosts) - { - purple_debug_error("yahoo", "Unable to find an IP address for relay.msg.yahoo.com\n"); - purple_xfer_cancel_remote(xfer); - return; - } - - /* Discard the length... */ - hosts = g_slist_remove(hosts, hosts->data); - if(!hosts) - { - purple_debug_error("yahoo", "Unable to find an IP address for relay.msg.yahoo.com\n"); - purple_xfer_cancel_remote(xfer); - return; - } - - /* TODO:actually, u must try with addr no.1 , if its not working addr no.2 ..... */ - addr = hosts->data; - actaddr = addr->sin_addr.s_addr; - d = actaddr % 256; - actaddr = (actaddr - d) / 256; - c = actaddr % 256; - actaddr = (actaddr - c) / 256; - b = actaddr % 256; - actaddr = (actaddr - b) / 256; - a = actaddr; - if(yd->jp) - xd->port = YAHOOJP_XFER_RELAY_PORT; - else - xd->port = YAHOO_XFER_RELAY_PORT; - - url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a); - - /* Free the address... */ - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - addr = NULL; - while (hosts != NULL) - { - /* Discard the length... */ - hosts = g_slist_remove(hosts, hosts->data); - /* Free the address... */ - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) { - purple_xfer_cancel_remote(xfer); - g_free(url); - return; - } - g_free(url); - - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - - yahoo_packet_hash(pkt, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, filename, - 249, 3, - 250, xd->host); - - g_free(filename); - yahoo_packet_send_and_free(pkt, yd); -} - -gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who) -{ - if (!who || yahoo_get_federation_from_name(who) != YAHOO_FEDERATION_NONE) - return FALSE; - return TRUE; -} - -void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - struct yahoo_xfer_data *xfer_data; - YahooData *yd = gc->proto_data; - PurpleXfer *xfer = yahoo_new_xfer(gc, who); - - g_return_if_fail(xfer != NULL); - - /* if we don't have a p2p connection, try establishing it now */ - if( !g_hash_table_lookup(yd->peers, who) ) - yahoo_send_p2p_pkt(gc, who, 0); - - xfer_data = xfer->data; - xfer_data->status_15 = STARTED; - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); - xfer_data->version = 15; - xfer_data->xfer_peer_idstring = yahoo_xfer_new_xfer_id(); - g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer); - - /* Now perform the request */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data); /* using this in yahoo_xfer_send_cb_15 */ -static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message);/* using this in recv_cb */ - -static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int did; - gchar* buf; - gchar* t; - PurpleAccount *account; - PurpleConnection *gc; - - xfer = data; - xd = xfer->data; - account = purple_connection_get_account(xd->gc); - gc = xd->gc; - - buf=g_strnfill(1000, 0); - while((did = read(source, buf, 998)) > 0) - { - xd->txbuflen += did; - buf[did] = '\0'; - t = xd->txbuf; - xd->txbuf = g_strconcat(t,buf,NULL); - g_free(t); - } - g_free(buf); - - if (did < 0 && errno == EAGAIN) - return; - else if (did < 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - xd->txbuflen = 0; - - if(xd->status_15 == HEAD_REQUESTED) { - xd->status_15 = HEAD_REPLY_RECEIVED; - close(source);/* Is this required? */ - g_free(xd->txbuf); - xd->txbuf = NULL; - if (purple_proxy_connect(gc, account, xd->host, xd->port, yahoo_xfer_connected_15, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } else { - purple_debug_error("yahoo","Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", - purple_xfer_get_type(xfer), - xd->status_15); - return; - } -} - -static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int remaining, written; - - xfer = data; - xd = xfer->data; - remaining = xd->txbuflen - xd->txbuf_written; - written = write(source, xd->txbuf + xd->txbuf_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - if (written < remaining) { - xd->txbuf_written += written; - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - g_free(xd->txbuf); - xd->txbuf = NULL; - xd->txbuflen = 0; - xd->txbuf_written = 0; - - if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) - { - xd->status_15 = HEAD_REQUESTED; - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_READ, yahoo_xfer_recv_cb_15, xfer); - yahoo_xfer_recv_cb_15(xfer, source, PURPLE_INPUT_READ); - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) - { - xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; - purple_xfer_start(xfer, source, NULL, 0); - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && (xd->status_15 == ACCEPTED || xd->status_15 == P2P_GET_REQUESTED) ) - { - xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; - /* Remove Read event */ - purple_input_remove(xd->input_event); - xd->input_event = 0; - purple_xfer_start(xfer, source, NULL, 0); - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == P2P_HEAD_REQUESTED) - { - xd->status_15 = P2P_HEAD_REPLIED; - /* Remove Read event and close descriptor */ - purple_input_remove(xd->input_event); - xd->input_event = 0; - close(source); - xfer->fd = -1; - /* start local server, listen for connections */ - purple_network_listen(xd->yahoo_local_p2p_ft_server_port, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); - } - else - { - purple_debug_error("yahoo", "Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", purple_xfer_get_type(xfer), xd->status_15); - return; - } -} - -static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - PurpleAccount *account; - YahooData* yd; - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - yd = xd->gc->proto_data; - account = purple_connection_get_account(xd->gc); - if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { - purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); - purple_xfer_cancel_remote(xfer); - return; - } - /* The first time we get here, assemble the tx buffer */ - if (xd->txbuflen == 0) - { - gchar* cookies; - cookies = yahoo_get_cookies(xd->gc); - if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == ACCEPTED) - { - if(xd->info_val_249 == 2) - { - /* sending file via p2p, we are connected as client */ - xd->txbuf = g_strdup_printf("POST /%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: %ld\r\n" - "Cache-Control: no-cache\r\n\r\n", - xd->path, - xd->host, - (long int)xfer->size); /* to do, add Referer */ - } - else - { - /* sending file via relaying */ - xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" - "Cookie:%s\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: %ld\r\n" - "Cache-Control: no-cache\r\n\r\n", - purple_url_encode(xd->xfer_idstring_for_relay), - purple_normalize(account, purple_account_get_username(account)), - xfer->who, - cookies, - xd->host, - (long int)xfer->size); - } - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) - { - if(xd->info_val_249 == 1) - { - /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: 0\r\n" - "Cache-Control: no-cache\r\n\r\n", - xd->path,xd->host); - } - else - { - /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Cookie: %s\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: 0\r\n" - "Cache-Control: no-cache\r\n\r\n", - purple_url_encode(xd->xfer_idstring_for_relay), - purple_normalize(account, purple_account_get_username(account)), - xfer->who, - cookies, - xd->host); - } - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) - { - if(xd->info_val_249 == 1) - { - /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Connection: Keep-Alive\r\n\r\n", - xd->path, xd->host); - } - else - { - /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" - "Cookie: %s\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Connection: Keep-Alive\r\n\r\n", - purple_url_encode(xd->xfer_idstring_for_relay), - purple_normalize(account, purple_account_get_username(account)), - xfer->who, - cookies, - xd->host); - } - } - else - { - purple_debug_error("yahoo", "Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", purple_xfer_get_type(xfer), xd->status_15); - g_free(cookies); - return; - } - xd->txbuflen = strlen(xd->txbuf); - xd->txbuf_written = 0; - g_free(cookies); - } - - if (!xd->tx_handler) - { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_xfer_send_cb_15, xfer); - yahoo_xfer_send_cb_15(xfer, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_p2p_ft_POST_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - - xfer = data; - if (!(xd = xfer->data)) { - purple_xfer_cancel_remote(xfer); - return; - } - - purple_input_remove(xd->input_event); - xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; - purple_xfer_start(xfer, source, NULL, 0); -} - -static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - guchar buf[1024]; - int len; - char *url_head; - char *url_get; - time_t unix_time; - char *time_str; - - xfer = data; - if (!(xd = xfer->data)) { - purple_xfer_cancel_remote(xfer); - return; - } - - len = read(source, buf, sizeof(buf)); - if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) - return ; /* No Worries*/ - else if (len <= 0) { - purple_debug_warning("yahoo","p2p-ft: Error in connection, or host disconnected\n"); - purple_input_remove(xd->input_event); - purple_xfer_cancel_remote(xfer); - return; - } - - url_head = g_strdup_printf("HEAD %s", xd->xfer_url); - url_get = g_strdup_printf("GET %s", xd->xfer_url); - - if( strncmp(url_head, (char *)buf, strlen(url_head)) == 0 ) - xd->status_15 = P2P_HEAD_REQUESTED; - else if( strncmp(url_get, (char *)buf, strlen(url_get)) == 0 ) - xd->status_15 = P2P_GET_REQUESTED; - else { - purple_debug_warning("yahoo","p2p-ft: Wrong HEAD/GET request from peer, disconnecting host\n"); - purple_input_remove(xd->input_event); - purple_xfer_cancel_remote(xfer); - g_free(url_head); - return; - } - - unix_time = time(NULL); - time_str = ctime(&unix_time); - strcpy(time_str + strlen(time_str) - 1, "\0"); - - if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\n" - "Date: %s GMT\r\n" - "Server: Y!/1.0\r\n" - "MIME-version: 1.0\r\n" - "Last-modified: %s GMT\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", - time_str, time_str, xfer->size); - xd->txbuflen = strlen(xd->txbuf); - xd->txbuf_written = 0; - } - - if (!xd->tx_handler) { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, yahoo_xfer_send_cb_15, xfer); - yahoo_xfer_send_cb_15(xfer, source, PURPLE_INPUT_WRITE); - } - - g_free(url_head); - g_free(url_get); -} - -static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - int acceptfd; - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - - xfer = data; - if (!(xd = xfer->data)) { - purple_xfer_cancel_remote(xfer); - return; - } - - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) - return; - else if(acceptfd == -1) { - purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); - purple_xfer_cancel_remote(xfer); - /* remove watcher and close p2p ft server */ - purple_input_remove(xd->yahoo_p2p_ft_server_watcher); - close(xd->yahoo_local_p2p_ft_server_fd); - return; - } - - /* remove watcher and close p2p ft server */ - purple_input_remove(xd->yahoo_p2p_ft_server_watcher); - close(xd->yahoo_local_p2p_ft_server_fd); - - /* Add an Input Read event to the file descriptor */ - xfer->fd = acceptfd; - if(xfer->type == PURPLE_XFER_RECEIVE) - xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_POST_cb, data); - else - xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_HEAD_GET_cb, data); -} - -static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - struct yahoo_packet *pkt; - PurpleAccount *account; - YahooData *yd; - gchar *filename; - const char *local_ip; - gchar *url_to_send = NULL; - char *filename_without_spaces = NULL; - - xfer = data; - if (!(xd = xfer->data) || (listenfd == -1)) { - purple_debug_warning("yahoo","p2p: error starting server for p2p file transfer\n"); - purple_xfer_cancel_remote(xfer); - return; - } - - if( (xfer->type == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { - yd = xd->gc->proto_data; - account = purple_connection_get_account(xd->gc); - local_ip = purple_network_get_my_ip(listenfd); - xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd); - - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - filename_without_spaces = g_strdup(filename); - purple_util_chrreplace(filename_without_spaces, ' ', '+'); - xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename_without_spaces, xfer->who); - url_to_send = g_strdup_printf("http://%s:%d%s", local_ip, xd->yahoo_local_p2p_ft_server_port, xd->xfer_url); - - if(xfer->type == PURPLE_XFER_RECEIVE) { - xd->info_val_249 = 2; /* 249=2: we are p2p server, and receiving file */ - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, xfer->filename, - 249, 2, - 250, url_to_send); - } - else { - xd->info_val_249 = 1; /* 249=1: we are p2p server, and sending file */ - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, filename, - 249, 1, - 250, url_to_send); - } - - yahoo_packet_send_and_free(pkt, yd); - - g_free(filename); - g_free(url_to_send); - g_free(filename_without_spaces); - } - - /* Add an Input Read event to the file descriptor */ - xd->yahoo_local_p2p_ft_server_fd = listenfd; - xd->yahoo_p2p_ft_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_ft_server_send_connected_cb, data); -} - -/* send (p2p) file transfer information */ -static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xd; - struct yahoo_packet *pkt; - PurpleAccount *account; - YahooData *yd; - gchar *filename; - struct yahoo_p2p_data *p2p_data; - - if (!(xd = xfer->data)) - return; - - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); - if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) - if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) - return; - - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - - yahoo_packet_hash(pkt, "ssssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, filename, - 249, 2); /* 249=2: we are p2p client */ - xd->info_val_249 = 2; - yahoo_packet_send_and_free(pkt, yd); - - g_free(filename); -} - -void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *from = NULL; - char *to = NULL; - char *imv = NULL; - long val_222 = 0L; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - char *service = NULL; - char *filename = NULL; - char *xfer_peer_idstring = NULL; - char *utf8_filename; - unsigned long filesize = 0L; - GSList *l; - GSList *filename_list = NULL; - GSList *size_list = NULL; - int nooffiles = 0; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - from = pair->value; - break; - case 5: - to = pair->value; - break; - case 265: - xfer_peer_idstring = pair->value; - break; - case 27: - filename_list = g_slist_prepend(filename_list, g_strdup(pair->value)); - nooffiles++; - break; - case 28: - size_list = g_slist_prepend(size_list, g_strdup(pair->value)); - break; - case 222: - val_222 = atol(pair->value); - /* 1=send, 2=cancel, 3=accept, 4=reject */ - break; - - /* check for p2p and imviron .... not sure it comes by this service packet. Since it was bundled with filexfer in old ymsg version, still keeping it. */ - case 49: - service = pair->value; - break; - case 63: - imv = pair->value; - break; - /* end check */ - - } - } - if(!xfer_peer_idstring) - return; - - if(val_222 == 2 || val_222 == 4) - { - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, - xfer_peer_idstring); - if(!xfer) return; - purple_xfer_cancel_remote(xfer); - return; - } - if(val_222 == 3) - { - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, - xfer_peer_idstring); - if(!xfer) - return; - /* - * In the file trans info packet that we must reply with, we are - * supposed to mention the ip address... - * purple connect does not give me a way of finding the ip address... - * so, purple dnsquery is used... but retries, trying with next ip - * address etc. is not implemented..TODO - */ - - /* To send through p2p */ - if( g_hash_table_lookup(yd->peers, from) ) { - /* send p2p file transfer information */ - yahoo_p2p_client_send_ft_info(gc, xfer); - return; - } - - if (yd->jp) - { - purple_dnsquery_a(YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT, - yahoo_xfer_dns_connected_15, xfer); - } - else - { - purple_dnsquery_a(YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT, - yahoo_xfer_dns_connected_15, xfer); - } - return; - } - - /* processing for p2p and imviron .... not sure it comes by this service packet. Since it was bundled with filexfer in old ymsg version, still keeping it. */ - /* - * The remote user has changed their IMVironment. We - * record it for later use. - */ - if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { - g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); - return; - } - - if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { - if (service && (strcmp("FILEXFER", service) != 0)) { - purple_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); - return; - } - } - /* end processing */ - - if(!filename_list) - return; - /* have to change list into order in which client at other end sends */ - filename_list = g_slist_reverse(filename_list); - size_list = g_slist_reverse(size_list); - filename = filename_list->data; - filesize = atol(size_list->data); - - if(!from) return; - xfer_data = g_new0(struct yahoo_xfer_data, 1); - xfer_data->version = 15; - xfer_data->firstoflist = TRUE; - xfer_data->gc = gc; - xfer_data->xfer_peer_idstring = g_strdup(xfer_peer_idstring); - xfer_data->filename_list = filename_list; - xfer_data->size_list = size_list; - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); - if (xfer == NULL) - { - g_free(xfer_data); - g_return_if_reached(); - } - - xfer->message = NULL; - - /* Set the info about the incoming file. */ - utf8_filename = yahoo_string_decode(gc, filename, TRUE); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - purple_xfer_set_size(xfer, filesize); - - xfer->data = xfer_data; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); - - g_hash_table_insert(yd->xfer_peer_idstring_map, - xfer_data->xfer_peer_idstring, - xfer); - - if(nooffiles > 1) { - gchar* message; - message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles); - purple_xfer_conversation_write(xfer, message, FALSE); - g_free(message); - } - /* Now perform the request */ - purple_xfer_request(xfer); -} - -void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *from = NULL; - char *to = NULL; - char *url = NULL; - long val_249 = 0; - long val_66 = 0; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - char *filename = NULL; - char *xfer_peer_idstring = NULL; - char *xfer_idstring_for_relay = NULL; - GSList *l; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - struct yahoo_p2p_data *p2p_data; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - from = pair->value; - break; - case 5: - to = pair->value; - break; - case 265: - xfer_peer_idstring = pair->value; - break; - case 27: - filename = pair->value; - break; - case 66: - val_66 = strtol(pair->value, NULL, 10); - break; - case 249: - val_249 = strtol(pair->value, NULL, 10); - /* 249 has value 1 or 2 when doing p2p transfer and value 3 when relaying through yahoo server */ - break; - case 250: - url = pair->value; - break; - case 251: - xfer_idstring_for_relay = pair->value; - break; - } - } - - if(!xfer_peer_idstring) - return; - - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring); - - if(!xfer) return; - - if(val_66==-1) - { - purple_xfer_cancel_remote(xfer); - return; - } - - xfer_data = xfer->data; - - xfer_data->info_val_249 = val_249; - xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); - if(val_249 == 1 || val_249 == 3) { - if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) { - purple_xfer_cancel_remote(xfer); - return; - } - - account = purple_connection_get_account(xfer_data->gc); - - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 27, xfer->filename, - 249, xfer_data->info_val_249, - 251, xfer_data->xfer_idstring_for_relay); - - yahoo_packet_send_and_free(pkt_to_send, yd); - - if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, - yahoo_xfer_connected_15, xfer) == NULL) { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } - else if(val_249 == 2) { - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); - if( !( p2p_data && (p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) ) ) { - purple_xfer_cancel_remote(xfer); - return; - } - if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { - purple_xfer_cancel_remote(xfer); - return; - } - } -} - -/* TODO: Check filename etc. No probs till some hacker comes in the way */ -void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - gchar *xfer_peer_idstring = NULL; - gchar *xfer_idstring_for_relay = NULL; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - GSList *l; - PurpleAccount *account; - long val_66 = 0; - gchar *url = NULL; - int val_249 = 0; - - yd = gc->proto_data; - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 251: - xfer_idstring_for_relay = pair->value; - break; - case 265: - xfer_peer_idstring = pair->value; - break; - case 66: - val_66 = atol(pair->value); - break; - case 249: - val_249 = atol(pair->value); - break; - case 250: - url = pair->value; /* we get a p2p url here when sending file, connected as client */ - break; - } - } - - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring); - if(!xfer) return; - - if(val_66 == -1 || ( (!(xfer_idstring_for_relay)) && (val_249 != 2) )) - { - purple_xfer_cancel_remote(xfer); - return; - } - - if( (val_249 == 2) && (!(url)) ) - { - purple_xfer_cancel_remote(xfer); - return; - } - - xfer_data = xfer->data; - if(url) - purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL); - - xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); - xfer_data->status_15 = ACCEPTED; - account = purple_connection_get_account(gc); - - if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, - yahoo_xfer_connected_15, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"),_("Unable to connect")); - purple_xfer_cancel_remote(xfer); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_filexfer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _YAHOO_FILEXFER_H_ -#define _YAHOO_FILEXFER_H_ - -#include "ft.h" - -/** - * Process ymsg events, particular IMViroments like Doodle - */ -void yahoo_process_p2pfilexfer( PurpleConnection *gc, struct yahoo_packet *pkt ); - -/** - * Process ymsg file receive invites. - */ -void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt); - -/** - * Create a new PurpleXfer - * - * @param gc The PurpleConnection handle. - * @param who Who will we be sending it to? - */ -PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who); - -/** - * Returns TRUE if the buddy can receive file, FALSE otherwise. - * Federated users cannot receive files. So this will return FALSE only - * for them. - * - * @param gc The connection - * @param who The name of the remote user - * - * @return TRUE or FALSE - */ -gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who); - -/** - * Send a file. - * - * @param gc The PurpleConnection handle. - * @param who Who are we sending it to? - * @param file What file? If NULL, user will choose after this call. - */ -void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file); - -void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *pkt); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,322 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "prpl.h" -#include "util.h" -#include "debug.h" - -#include "yahoo_friend.h" -#include "yahoo_aliases.h" - -static YahooFriend *yahoo_friend_new(void) -{ - YahooFriend *ret; - - ret = g_new0(YahooFriend, 1); - ret->status = YAHOO_STATUS_OFFLINE; - ret->presence = YAHOO_PRESENCE_DEFAULT; - - return ret; -} - -YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name) -{ - YahooData *yd; - const char *norm; - - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - - yd = gc->proto_data; - norm = purple_normalize(purple_connection_get_account(gc), name); - - return g_hash_table_lookup(yd->friends, norm); -} - -YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name) -{ - YahooFriend *f; - YahooData *yd; - const char *norm; - - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - - yd = gc->proto_data; - norm = purple_normalize(purple_connection_get_account(gc), name); - - f = g_hash_table_lookup(yd->friends, norm); - if (!f) { - f = yahoo_friend_new(); - g_hash_table_insert(yd->friends, g_strdup(norm), f); - } - - return f; -} - -void yahoo_friend_set_ip(YahooFriend *f, const char *ip) -{ - g_free(f->ip); - f->ip = g_strdup(ip); -} - -const char *yahoo_friend_get_ip(YahooFriend *f) -{ - return f->ip; -} - -void yahoo_friend_set_game(YahooFriend *f, const char *game) -{ - g_free(f->game); - - if (game) - f->game = g_strdup(game); - else - f->game = NULL; -} - -const char *yahoo_friend_get_game(YahooFriend *f) -{ - return f->game; -} - -void yahoo_friend_set_status_message(YahooFriend *f, char *msg) -{ - g_free(f->msg); - - f->msg = msg; -} - -const char *yahoo_friend_get_status_message(YahooFriend *f) -{ - return f->msg; -} - -void yahoo_friend_set_buddy_icon_need_request(YahooFriend *f, gboolean needs) -{ - f->bicon_sent_request = !needs; -} - -gboolean yahoo_friend_get_buddy_icon_need_request(YahooFriend *f) -{ - return !f->bicon_sent_request; -} - -void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id) -{ - g_free(f->ypd.id); - f->ypd.id = g_strdup(alias_id); -} - -const char *yahoo_friend_get_alias_id(YahooFriend *f) -{ - return f->ypd.id; -} - -void yahoo_friend_free(gpointer p) -{ - YahooFriend *f = p; - g_free(f->msg); - g_free(f->game); - g_free(f->ip); - yahoo_personal_details_reset(&f->ypd, TRUE); - g_free(f); -} - -void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - YahooFriend *f; - char *temp = NULL; - char *who = NULL; - int value = 0; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 7: - temp = pair->value; - break; - case 31: - value = strtol(pair->value, NULL, 10); - break; - case 241: - fed = strtol(pair->value, NULL, 10); - break; - } - - l = l->next; - } - - if (value != 1 && value != 2) { - purple_debug_error("yahoo", "Received unknown value for presence key: %d\n", value); - return; - } - - switch (fed) { - case YAHOO_FEDERATION_MSN: - who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - who = g_strdup(temp); - break; - } - g_return_if_fail(who != NULL); - - f = yahoo_friend_find(gc, who); - if (!f) { - g_free(who); - return; - } - - if (pkt->service == YAHOO_SERVICE_PRESENCE_PERM) { - purple_debug_info("yahoo", "Setting permanent presence for %s to %d.\n", who, (value == 1)); - /* If setting from perm offline to online when in invisible status, - * this has already been taken care of (when the temp status changed) */ - if (value == 2 && f->presence == YAHOO_PRESENCE_ONLINE) { - } else { - if (value == 1) /* Setting Perm offline */ - f->presence = YAHOO_PRESENCE_PERM_OFFLINE; - else - f->presence = YAHOO_PRESENCE_DEFAULT; - } - } else { - purple_debug_info("yahoo", "Setting session presence for %s to %d.\n", who, (value == 1)); - if (value == 1) - f->presence = YAHOO_PRESENCE_ONLINE; - else - f->presence = YAHOO_PRESENCE_DEFAULT; - } - g_free(who); -} - -void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, - YahooPresenceVisibility presence) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt = NULL; - YahooFriend *f; - const char *thirtyone, *thirteen; - int service = -1; - const char *temp = NULL; - - if (!yd->logged_in) - return; - - f = yahoo_friend_find(gc, name); - if (!f) - return; - - if(f->fed != YAHOO_FEDERATION_NONE) - temp = name+4; - else - temp = name; - - /* No need to change the value if it is already correct */ - if (f->presence == presence) { - purple_debug_info("yahoo", "Not setting presence because there are no changes.\n"); - return; - } - - if (presence == YAHOO_PRESENCE_PERM_OFFLINE) { - service = YAHOO_SERVICE_PRESENCE_PERM; - thirtyone = "1"; - thirteen = "2"; - } else if (presence == YAHOO_PRESENCE_DEFAULT) { - if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { - service = YAHOO_SERVICE_PRESENCE_PERM; - thirtyone = "2"; - thirteen = "2"; - } else if (yd->current_status == YAHOO_STATUS_INVISIBLE) { - service = YAHOO_SERVICE_PRESENCE_SESSION; - thirtyone = "2"; - thirteen = "1"; - } - } else if (presence == YAHOO_PRESENCE_ONLINE) { - if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM, - YAHOO_STATUS_AVAILABLE, yd->session_id); - if(f->fed) - yahoo_packet_hash(pkt, "ssssssiss", - 1, purple_connection_get_display_name(gc), - 31, "2", 13, "2", - 302, "319", 300, "319", - 7, temp, 241, f->fed, - 301, "319", 303, "319"); - else - yahoo_packet_hash(pkt, "ssssssss", - 1, purple_connection_get_display_name(gc), - 31, "2", 13, "2", - 302, "319", 300, "319", - 7, temp, - 301, "319", 303, "319"); - - yahoo_packet_send_and_free(pkt, yd); - } - - service = YAHOO_SERVICE_PRESENCE_SESSION; - thirtyone = "1"; - thirteen = "1"; - } - - if (service > 0) { - pkt = yahoo_packet_new(service, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - if(f->fed) - yahoo_packet_hash(pkt, "ssssssiss", - 1, purple_connection_get_display_name(gc), - 31, thirtyone, 13, thirteen, - 302, "319", 300, "319", - 7, temp, 241, f->fed, - 301, "319", 303, "319"); - else - yahoo_packet_hash(pkt, "ssssssss", - 1, purple_connection_get_display_name(gc), - 31, thirtyone, 13, thirteen, - 302, "319", 300, "319", - 7, temp, - 301, "319", 303, "319"); - - yahoo_packet_send_and_free(pkt, yd); - } -} - -void yahoo_friend_set_p2p_status(YahooFriend *f, YahooP2PStatus p2p_status) -{ - f->p2p_status = p2p_status; -} - -YahooP2PStatus yahoo_friend_get_p2p_status(YahooFriend *f) -{ - return f->p2p_status; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_friend.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file yahoo_friend.h The Yahoo! protocol plugin YahooFriend object - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOO_FRIEND_H_ -#define _YAHOO_FRIEND_H_ - -#include "libymsg.h" -#include "yahoo_packet.h" - -typedef enum { - YAHOO_PRESENCE_DEFAULT = 0, - YAHOO_PRESENCE_ONLINE, - YAHOO_PRESENCE_PERM_OFFLINE -} YahooPresenceVisibility; - -typedef enum { - YAHOO_P2PSTATUS_NOT_CONNECTED = 0, - YAHOO_P2PSTATUS_DO_NOT_CONNECT, - YAHOO_P2PSTATUS_WE_ARE_SERVER, - YAHOO_P2PSTATUS_WE_ARE_CLIENT -} YahooP2PStatus; - - -/* these are called friends instead of buddies mainly so I can use variables - * named f and not confuse them with variables named b - */ -typedef struct _YahooFriend { - enum yahoo_status status; - gchar *msg; - gchar *game; - int idle; - int away; - gboolean sms; - gchar *ip; - gboolean bicon_sent_request; - YahooPresenceVisibility presence; - YahooFederation fed; - long int version_id; - YahooPersonalDetails ypd; - YahooP2PStatus p2p_status; - gboolean p2p_packet_sent; /* 0:not sent, 1=sent */ - gint session_id; /* session id of friend */ -} YahooFriend; - -YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name); -YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name); - -void yahoo_friend_set_ip(YahooFriend *f, const char *ip); -const char *yahoo_friend_get_ip(YahooFriend *f); - -void yahoo_friend_set_game(YahooFriend *f, const char *game); -const char *yahoo_friend_get_game(YahooFriend *f); - -void yahoo_friend_set_status_message(YahooFriend *f, char *msg); -const char *yahoo_friend_get_status_message(YahooFriend *f); - -void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id); -const char *yahoo_friend_get_alias_id(YahooFriend *f); - -void yahoo_friend_set_buddy_icon_need_request(YahooFriend *f, gboolean needs); -gboolean yahoo_friend_get_buddy_icon_need_request(YahooFriend *f); - -void yahoo_friend_free(gpointer p); - -void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, - YahooPresenceVisibility presence); - -void yahoo_friend_set_p2p_status(YahooFriend *f, YahooP2PStatus p2p_status); -YahooP2PStatus yahoo_friend_get_p2p_status(YahooFriend *f); - -#endif /* _YAHOO_FRIEND_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,403 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "debug.h" - -#include "libymsg.h" -#include "yahoo_packet.h" - -struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id) -{ - struct yahoo_packet *pkt = g_new0(struct yahoo_packet, 1); - - pkt->service = service; - pkt->status = status; - pkt->id = id; - - return pkt; -} - -void yahoo_packet_hash_str(struct yahoo_packet *pkt, int key, const char *value) -{ - struct yahoo_pair *pair; - - g_return_if_fail(value != NULL); - - pair = g_new0(struct yahoo_pair, 1); - pair->key = key; - pair->value = g_strdup(value); - pkt->hash = g_slist_prepend(pkt->hash, pair); -} - -void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value) -{ - struct yahoo_pair *pair; - - pair = g_new0(struct yahoo_pair, 1); - pair->key = key; - pair->value = g_strdup_printf("%d", value); - pkt->hash = g_slist_prepend(pkt->hash, pair); -} - -void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...) -{ - char *strval; - int key, intval; - const char *cur; - va_list ap; - - va_start(ap, fmt); - for (cur = fmt; *cur; cur++) { - key = va_arg(ap, int); - switch (*cur) { - case 'i': - intval = va_arg(ap, int); - yahoo_packet_hash_int(pkt, key, intval); - break; - case 's': - strval = va_arg(ap, char *); - yahoo_packet_hash_str(pkt, key, strval); - break; - default: - purple_debug_error("yahoo", "Invalid format character '%c'\n", *cur); - break; - } - } - va_end(ap); -} - -size_t yahoo_packet_length(struct yahoo_packet *pkt) -{ - GSList *l; - - size_t len = 0; - - l = pkt->hash; - while (l) { - struct yahoo_pair *pair = l->data; - int tmp = pair->key; - do { - tmp /= 10; - len++; - } while (tmp); - len += 2; - len += strlen(pair->value); - len += 2; - l = l->next; - } - - return len; -} - -/* - * 'len' is the value given to us by the server that is supposed to - * be the length of 'data'. But apparently there's a time when this - * length is incorrect. Christopher Layne thinks it might be a bug - * in their server code. - * - * The following information is from Christopher: - * - * It sometimes happens when Yahoo! sends a packet continuation within - * chat. Sometimes when joining a large chatroom the initial - * SERVICE_CHATJOIN packet will be so large that it will need to be - * split into multiple packets. That's fine, except that the length - * of the second packet is wrong. The packet has the same length as - * the first packet, and the length given in the header is the same, - * however the actual data in the packet is shorter than this length. - * So half of the packet contains good, valid data, and then the rest - * of the packet is junk. Luckily there is a null terminator after - * the valid data and before the invalid data. - * - * What does all this mean? It means that we parse through the data - * pulling out key/value pairs until we've parsed 'len' bytes, or until - * we run into a null terminator, whichever comes first. - */ -void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) -{ - int pos = 0; - char key[64]; - const guchar *delimiter; - gboolean accept; - int x; - struct yahoo_pair *pair; - - while (pos + 1 < len) - { - if (data[pos] == '\0') - break; - - pair = g_new0(struct yahoo_pair, 1); - - x = 0; - while (pos + 1 < len) { - if (data[pos] == 0xc0 && data[pos + 1] == 0x80) - break; - if (x >= sizeof(key)-1) { - x++; - pos++; - continue; - } - key[x++] = data[pos++]; - } - if (x >= sizeof(key)-1) { - x = 0; - } - key[x] = 0; - pos += 2; - pair->key = strtol(key, NULL, 10); - accept = x; /* if x is 0 there was no key, so don't accept it */ - - if (pos + 1 > len) { - /* Malformed packet! (Truncated--garbage or something) */ - accept = FALSE; - } - - if (accept) { - delimiter = (const guchar *)g_strstr_len((const char *)&data[pos], len - pos, "\xc0\x80"); - if (delimiter == NULL) - { - /* Malformed packet! (It doesn't end in 0xc0 0x80) */ - g_free(pair); - pos = len; - continue; - } - x = delimiter - data; - pair->value = g_strndup((const gchar *)&data[pos], x - pos); - pos = x; - pkt->hash = g_slist_prepend(pkt->hash, pair); - - if (purple_debug_is_verbose() || g_getenv("PURPLE_YAHOO_DEBUG")) { - char *esc; - esc = g_strescape(pair->value, NULL); - purple_debug_misc("yahoo", "Key: %d \tValue: %s\n", pair->key, esc); - g_free(esc); - } - } else { - g_free(pair); - } - pos += 2; - - if (pos + 1 > len) break; - - /* Skip over garbage we've noticed in the mail notifications */ - if (data[0] == '9' && data[pos] == 0x01) - pos++; - } - - /* - * Originally this function used g_slist_append(). I changed - * it to use g_slist_prepend() for improved performance. - * Ideally the Yahoo! PRPL code would be indifferent to the - * order of the key/value pairs, but I don't know if this is - * the case for all incoming messages. To be on the safe side - * we reverse the list. - */ - pkt->hash = g_slist_reverse(pkt->hash); -} - -void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data) -{ - GSList *l; - int pos = 0; - - /* This is only called from one place, and the list is - * always backwards */ - - l = pkt->hash = g_slist_reverse(pkt->hash); - - while (l) { - struct yahoo_pair *pair = l->data; - gchar buf[100]; - - g_snprintf(buf, sizeof(buf), "%d", pair->key); - strcpy((char *)&data[pos], buf); - pos += strlen(buf); - data[pos++] = 0xc0; - data[pos++] = 0x80; - - strcpy((char *)&data[pos], pair->value); - pos += strlen(pair->value); - data[pos++] = 0xc0; - data[pos++] = 0x80; - - l = l->next; - } -} - -void yahoo_packet_dump(guchar *data, int len) -{ -#ifdef YAHOO_DEBUG - int i; - - purple_debug_misc("yahoo", ""); - - for (i = 0; i + 1 < len; i += 2) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - purple_debug_misc(NULL, "%02x%02x ", data[i], data[i + 1]); - } - if (i < len) - purple_debug_misc(NULL, "%02x", data[i]); - - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - - for (i = 0; i < len; i++) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - if (g_ascii_isprint(data[i])) - purple_debug_misc(NULL, "%c ", data[i]); - else - purple_debug_misc(NULL, ". "); - } - - purple_debug_misc(NULL, "\n"); -#endif /* YAHOO_DEBUG */ -} - -static void -yahoo_packet_send_can_write(gpointer data, gint source, PurpleInputCondition cond) -{ - YahooData *yd = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(yd->txbuf); - - if (writelen == 0) { - purple_input_remove(yd->txhandler); - yd->txhandler = 0; - return; - } - - ret = write(yd->fd, yd->txbuf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret < 0) { - /* TODO: what to do here - do we really have to disconnect? */ - purple_connection_error_reason(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Write Error")); - return; - } - - purple_circ_buffer_mark_read(yd->txbuf, ret); -} - - -size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, - gboolean jp, guchar **buf) -{ - size_t pktlen = yahoo_packet_length(pkt); - size_t len = YAHOO_PACKET_HDRLEN + pktlen; - guchar *data; - int pos = 0; - - data = g_malloc0(len + 1); - - memcpy(data + pos, "YMSG", 4); pos += 4; - - if (wm) - pos += yahoo_put16(data + pos, YAHOO_WEBMESSENGER_PROTO_VER); - else if (jp) - pos += yahoo_put16(data + pos, YAHOO_PROTO_VER_JAPAN); - else - pos += yahoo_put16(data + pos, YAHOO_PROTO_VER); - pos += yahoo_put16(data + pos, 0x0000); - pos += yahoo_put16(data + pos, pktlen + pad); - pos += yahoo_put16(data + pos, pkt->service); - pos += yahoo_put32(data + pos, pkt->status); - pos += yahoo_put32(data + pos, pkt->id); - - yahoo_packet_write(pkt, data + pos); - - *buf = data; - - return len; -} - -int yahoo_packet_send(struct yahoo_packet *pkt, YahooData *yd) -{ - size_t len; - gssize ret; - guchar *data; - - if (yd->fd < 0) - return -1; - - len = yahoo_packet_build(pkt, 0, yd->wm, yd->jp, &data); - - yahoo_packet_dump(data, len); - if (yd->txhandler == 0) - ret = write(yd->fd, data, len); - else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno == EAGAIN) - ret = 0; - else if (ret <= 0) { - purple_debug_warning("yahoo", "Only wrote %" G_GSSIZE_FORMAT - " of %" G_GSIZE_FORMAT " bytes!\n", ret, len); - g_free(data); - return ret; - } - - if (ret < len) { - if (yd->txhandler == 0) - yd->txhandler = purple_input_add(yd->fd, PURPLE_INPUT_WRITE, - yahoo_packet_send_can_write, yd); - purple_circ_buffer_append(yd->txbuf, data + ret, len - ret); - } - - g_free(data); - - return ret; -} - -int yahoo_packet_send_and_free(struct yahoo_packet *pkt, YahooData *yd) -{ - int ret; - - ret = yahoo_packet_send(pkt, yd); - yahoo_packet_free(pkt); - return ret; -} - -void yahoo_packet_free(struct yahoo_packet *pkt) -{ - while (pkt->hash) { - struct yahoo_pair *pair = pkt->hash->data; - g_free(pair->value); - g_free(pair); - pkt->hash = g_slist_delete_link(pkt->hash, pkt->hash); - } - g_free(pkt); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_packet.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -/** - * @file yahoo_packet.h The Yahoo! protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOO_PACKET_H_ -#define _YAHOO_PACKET_H_ - -enum yahoo_service { /* these are easier to see in hex */ - YAHOO_SERVICE_LOGON = 1, - YAHOO_SERVICE_LOGOFF, - YAHOO_SERVICE_ISAWAY, - YAHOO_SERVICE_ISBACK, - YAHOO_SERVICE_IDLE, /* 5 (placemarker) */ - YAHOO_SERVICE_MESSAGE, - YAHOO_SERVICE_IDACT, - YAHOO_SERVICE_IDDEACT, - YAHOO_SERVICE_MAILSTAT, - YAHOO_SERVICE_USERSTAT, /* 0xa */ - YAHOO_SERVICE_NEWMAIL, - YAHOO_SERVICE_CHATINVITE, - YAHOO_SERVICE_CALENDAR, - YAHOO_SERVICE_NEWPERSONALMAIL, - YAHOO_SERVICE_NEWCONTACT, - YAHOO_SERVICE_ADDIDENT, /* 0x10 */ - YAHOO_SERVICE_ADDIGNORE, - YAHOO_SERVICE_PING, - YAHOO_SERVICE_GOTGROUPRENAME, - YAHOO_SERVICE_SYSMESSAGE = 0x14, - YAHOO_SERVICE_SKINNAME = 0x15, - YAHOO_SERVICE_PASSTHROUGH2 = 0x16, - YAHOO_SERVICE_CONFINVITE = 0x18, - YAHOO_SERVICE_CONFLOGON, - YAHOO_SERVICE_CONFDECLINE, - YAHOO_SERVICE_CONFLOGOFF, - YAHOO_SERVICE_CONFADDINVITE, - YAHOO_SERVICE_CONFMSG, - YAHOO_SERVICE_CHATLOGON, - YAHOO_SERVICE_CHATLOGOFF, - YAHOO_SERVICE_CHATMSG = 0x20, - YAHOO_SERVICE_GAMELOGON = 0x28, - YAHOO_SERVICE_GAMELOGOFF, - YAHOO_SERVICE_GAMEMSG = 0x2a, - YAHOO_SERVICE_FILETRANSFER = 0x46, - YAHOO_SERVICE_VOICECHAT = 0x4A, - YAHOO_SERVICE_NOTIFY = 0x4B, - YAHOO_SERVICE_VERIFY, - YAHOO_SERVICE_P2PFILEXFER, - YAHOO_SERVICE_PEERTOPEER = 0x4F, - YAHOO_SERVICE_WEBCAM, - YAHOO_SERVICE_AUTHRESP = 0x54, - YAHOO_SERVICE_LIST = 0x55, - YAHOO_SERVICE_AUTH = 0x57, - YAHOO_SERVICE_AUTHBUDDY = 0x6d, - YAHOO_SERVICE_ADDBUDDY = 0x83, - YAHOO_SERVICE_REMBUDDY = 0x84, - YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0*/ - YAHOO_SERVICE_REJECTCONTACT, - YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ - YAHOO_SERVICE_KEEPALIVE = 0x8A, - YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ - YAHOO_SERVICE_CHATGOTO, - YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */ - YAHOO_SERVICE_CHATLEAVE, - YAHOO_SERVICE_CHATEXIT = 0x9b, - YAHOO_SERVICE_CHATADDINVITE = 0x9d, - YAHOO_SERVICE_CHATLOGOUT = 0xa0, - YAHOO_SERVICE_CHATPING, - YAHOO_SERVICE_COMMENT = 0xa8, - YAHOO_SERVICE_PRESENCE_PERM = 0xb9, - YAHOO_SERVICE_PRESENCE_SESSION = 0xba, - YAHOO_SERVICE_AVATAR = 0xbc, - YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd, - YAHOO_SERVICE_PICTURE = 0xbe, - YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, - YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, - YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5, - YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6, - YAHOO_SERVICE_AVATAR_UPDATE = 0xc7, - YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, - YAHOO_SERVICE_AUDIBLE = 0xd0, - YAHOO_SERVICE_CONTACT_DETAILS = 0xd3, - /* YAHOO_SERVICE_CHAT_SESSION = 0xd4,?? Reports start of chat session, gets an id from server */ - YAHOO_SERVICE_AUTH_REQ_15 = 0xd6, - YAHOO_SERVICE_FILETRANS_15 = 0xdc, - YAHOO_SERVICE_FILETRANS_INFO_15 = 0xdd, - YAHOO_SERVICE_FILETRANS_ACC_15 = 0xde, - /* photo sharing services ?? - 0xd2, 0xd7, 0xd8, 0xda */ - YAHOO_SERVICE_CHGRP_15 = 0xe7, - YAHOO_SERVICE_STATUS_15 = 0xf0, - YAHOO_SERVICE_LIST_15 = 0xf1, - YAHOO_SERVICE_MESSAGE_ACK = 0xfb, - YAHOO_SERVICE_WEBLOGIN = 0x0226, - YAHOO_SERVICE_SMS_MSG = 0x02ea - /* YAHOO_SERVICE_DISCONNECT = 0x07d1 Server forces us to disconnect. Is sent with TCP FIN flag set */ -}; - -struct yahoo_pair { - int key; - char *value; -}; - -struct yahoo_packet { - guint16 service; - guint32 status; - guint32 id; - GSList *hash; -}; - -#define YAHOO_WEBMESSENGER_PROTO_VER 0x0065 -#define YAHOO_PROTO_VER 0x0010 -#define YAHOO_PROTO_VER_JAPAN 0x0010 - -#define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4) - -struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, - enum yahoo_status status, int id); -void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...); -void yahoo_packet_hash_str(struct yahoo_packet *pkt, int key, const char *value); -void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value); -int yahoo_packet_send(struct yahoo_packet *pkt, YahooData *yd); -int yahoo_packet_send_and_free(struct yahoo_packet *pkt, YahooData *yd); -size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, gboolean jp, -guchar **buf); -void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len); -void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data); -void yahoo_packet_dump(guchar *data, int len); -size_t yahoo_packet_length(struct yahoo_packet *pkt); -void yahoo_packet_free(struct yahoo_packet *pkt); - -#endif /* _YAHOO_PACKET_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,597 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "debug.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "util.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoo_friend.h" -#include "yahoo_picture.h" - - -struct yahoo_fetch_picture_data { - PurpleConnection *gc; - char *who; - int checksum; -}; - -static void -yahoo_fetch_picture_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *pic_data, size_t len, const gchar *error_message) -{ - struct yahoo_fetch_picture_data *d; - YahooData *yd; - - d = user_data; - yd = d->gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (error_message != NULL) { - purple_debug_error("yahoo", "Fetching buddy icon failed: %s\n", error_message); - } else if (len == 0) { - purple_debug_error("yahoo", "Fetched an icon with length 0. Strange.\n"); - } else { - char *checksum = g_strdup_printf("%i", d->checksum); - purple_buddy_icons_set_for_user(purple_connection_get_account(d->gc), d->who, g_memdup(pic_data, len), len, checksum); - g_free(checksum); - } - - g_free(d->who); - g_free(d); -} - -void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - YahooData *yd; - GSList *l = pkt->hash; - char *who = NULL, *us = NULL; - gboolean got_icon_info = FALSE, send_icon_info = FALSE; - char *url = NULL; - int checksum = 0; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 1: - case 4: - who = pair->value; - break; - case 5: - us = pair->value; - break; - case 13: { - int tmp; - tmp = strtol(pair->value, NULL, 10); - if (tmp == 1) { - send_icon_info = TRUE; - } else if (tmp == 2) { - got_icon_info = TRUE; - } - break; - } - case 20: - url = pair->value; - break; - case 192: - checksum = strtol(pair->value, NULL, 10); - break; - } - - l = l->next; - } - - if (!who) - return; - - if (!purple_privacy_check(purple_connection_get_account(gc), who)) { - purple_debug_info("yahoo", "Picture packet from %s dropped.\n", who); - return; - } - - /* Yahoo IM 6 spits out 0.png as the URL if the buddy icon is not set */ - if (who && got_icon_info && url && !g_ascii_strncasecmp(url, "http://", 7)) { - /* TODO: make this work p2p, try p2p before the url */ - PurpleUtilFetchUrlData *url_data; - struct yahoo_fetch_picture_data *data; - PurpleBuddy *b = purple_find_buddy(gc->account, who); - const char *locksum = NULL; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - /* FIXME: Cleanup this strtol() stuff if possible. */ - if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && - (checksum == strtol(locksum, NULL, 10))) - return; - - data = g_new0(struct yahoo_fetch_picture_data, 1); - data->gc = gc; - data->who = g_strdup(who); - data->checksum = checksum; - /* TODO: Does this need to be MSIE 5.0? */ - url_data = purple_util_fetch_url(url, use_whole_url, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, - yahoo_fetch_picture_cb, data); - if (url_data != NULL) { - yd = gc->proto_data; - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - } else { - g_free(data->who); - g_free(data); - } - } else if (who && send_icon_info) { - yahoo_send_picture_info(gc, who); - } -} - -void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *who = NULL; - int checksum = 0; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - break; - case 5: - /* us */ - break; - case 192: - checksum = strtol(pair->value, NULL, 10); - break; - } - l = l->next; - } - - if (who) { - PurpleBuddy *b = purple_find_buddy(gc->account, who); - const char *locksum = NULL; - - /* FIXME: Cleanup this strtol() stuff if possible. */ - if (b) { - locksum = purple_buddy_icons_get_checksum_for_user(b); - if (!locksum || (checksum != strtol(locksum, NULL, 10))) - yahoo_send_picture_request(gc, who); - } - } -} - -void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - GSList *l = pkt->hash; - char *url = NULL; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 5: - /* us */ - break; - case 27: - /* filename on our computer. */ - break; - case 20: /* url at yahoo */ - url = pair->value; - case 38: /* timestamp */ - break; - } - l = l->next; - } - - if (url) { - g_free(yd->picture_url); - yd->picture_url = g_strdup(url); - purple_account_set_string(account, YAHOO_PICURL_SETTING, url); - purple_account_set_int(account, YAHOO_PICCKSUM_SETTING, yd->picture_checksum); - yahoo_send_picture_checksum(gc); - yahoo_send_picture_update(gc, 2); - } -} - -void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *who = NULL; - int avatar = 0; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - break; - case 5: - /* us */ - break; - case 206: /* Older versions. Still needed? */ - case 213: /* Newer versions */ - /* - * 0 - No icon or avatar - * 1 - Using an avatar - * 2 - Using an icon - */ - avatar = strtol(pair->value, NULL, 10); - break; - } - l = l->next; - } - - if (who) { - if (avatar == 2) - yahoo_send_picture_request(gc, who); - else if ((avatar == 0) || (avatar == 1)) { - YahooFriend *f; - purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL); - if ((f = yahoo_friend_find(gc, who))) - yahoo_friend_set_buddy_icon_need_request(f, TRUE); - purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who); - } - } -} - -void yahoo_send_picture_info(PurpleConnection *gc, const char *who) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - if (!yd->picture_url) { - purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssssi", 1, purple_connection_get_display_name(gc), - 5, who, - 13, "2", 20, yd->picture_url, 192, yd->picture_checksum); - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_send_picture_request(PurpleConnection *gc, const char *who) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ - yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ - yahoo_packet_hash_str(pkt, 13, "1"); /* 1 = request, 2 = reply */ - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_send_picture_checksum(PurpleConnection *gc) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), - 212, "1", 192, yd->picture_checksum); - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "si", 3, who, 213, type); - yahoo_packet_send_and_free(pkt, yd); -} - -struct yspufe { - PurpleConnection *gc; - int type; -}; - -static void yahoo_send_picture_update_foreach(gpointer key, gpointer value, gpointer data) -{ - const char *who = key; - YahooFriend *f = value; - struct yspufe *d = data; - - if (f->status != YAHOO_STATUS_OFFLINE) - yahoo_send_picture_update_to_user(d->gc, who, d->type); -} - -void yahoo_send_picture_update(PurpleConnection *gc, int type) -{ - YahooData *yd = gc->proto_data; - struct yspufe data; - - data.gc = gc; - data.type = type; - - g_hash_table_foreach(yd->friends, yahoo_send_picture_update_foreach, &data); -} - -void yahoo_buddy_icon_upload_data_free(struct yahoo_buddy_icon_upload_data *d) -{ - purple_debug_misc("yahoo", "In yahoo_buddy_icon_upload_data_free()\n"); - - if (d->str) - g_string_free(d->str, TRUE); - g_free(d->filename); - if (d->watcher) - purple_input_remove(d->watcher); - if (d->fd != -1) - close(d->fd); - g_free(d); -} - -/* we couldn't care less about the server's response, but yahoo gets grumpy if we close before it sends it */ -static void yahoo_buddy_icon_upload_reading(gpointer data, gint source, PurpleInputCondition condition) -{ - struct yahoo_buddy_icon_upload_data *d = data; - PurpleConnection *gc = d->gc; - char buf[1024]; - int ret; - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - yahoo_buddy_icon_upload_data_free(d); - return; - } - - ret = read(d->fd, buf, sizeof(buf)); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - /* There are other problems if d->str->len overflows, so shut up the - * warning on 64-bit. */ - purple_debug_info("yahoo", "Buddy icon upload response (%" G_GSIZE_FORMAT ") bytes (> ~400 indicates failure):\n%.*s\n", - d->str->len, (guint)d->str->len, d->str->str); - - yahoo_buddy_icon_upload_data_free(d); - return; - } - - g_string_append_len(d->str, buf, ret); -} - -static void yahoo_buddy_icon_upload_pending(gpointer data, gint source, PurpleInputCondition condition) -{ - struct yahoo_buddy_icon_upload_data *d = data; - PurpleConnection *gc = d->gc; - gssize wrote; - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - yahoo_buddy_icon_upload_data_free(d); - return; - } - - wrote = write(d->fd, d->str->str + d->pos, d->str->len - d->pos); - if (wrote < 0 && errno == EAGAIN) - return; - if (wrote <= 0) { - purple_debug_info("yahoo", "Error uploading buddy icon.\n"); - yahoo_buddy_icon_upload_data_free(d); - return; - } - d->pos += wrote; - if (d->pos >= d->str->len) { - purple_debug_misc("yahoo", "Finished uploading buddy icon.\n"); - purple_input_remove(d->watcher); - /* Clean out the sent buffer and reuse it to read the result */ - g_string_free(d->str, TRUE); - d->str = g_string_new(""); - d->watcher = purple_input_add(d->fd, PURPLE_INPUT_READ, yahoo_buddy_icon_upload_reading, d); - } -} - -static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const gchar *error_message) -{ - struct yahoo_buddy_icon_upload_data *d = data; - struct yahoo_packet *pkt; - gchar *tmp, *header; - guchar *pkt_buf; - const char *host; - int port; - gsize pkt_buf_len; - PurpleConnection *gc = d->gc; - PurpleAccount *account; - YahooData *yd; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ - yd->buddy_icon_connect_data = NULL; - - if (source < 0) { - purple_debug_error("yahoo", "Buddy icon upload failed: %s\n", error_message); - yahoo_buddy_icon_upload_data_free(d); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPLOAD, YAHOO_STATUS_AVAILABLE, yd->session_id); - - tmp = g_strdup_printf("%" G_GSIZE_FORMAT, d->str->len); - /* 1 = me, 38 = expire time(?), 0 = me, 28 = size, 27 = filename, 14 = NULL, 29 = data */ - yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); - yahoo_packet_hash_str(pkt, 38, "604800"); /* time til expire */ - purple_account_set_int(account, YAHOO_PICEXPIRE_SETTING, time(NULL) + 604800); - yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); - yahoo_packet_hash_str(pkt, 28, tmp); - g_free(tmp); - yahoo_packet_hash_str(pkt, 27, d->filename); - yahoo_packet_hash_str(pkt, 14, ""); - /* 4 padding for the 29 key name */ - pkt_buf_len = yahoo_packet_build(pkt, 4, FALSE, yd->jp, &pkt_buf); - yahoo_packet_free(pkt); - - /* header + packet + "29" + 0xc0 + 0x80) + pictureblob */ - - host = purple_account_get_string(account, "xfer_host", yd->jp? YAHOOJP_XFER_HOST : YAHOO_XFER_HOST); - port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); - tmp = g_strdup_printf("%s:%d", host, port); - header = g_strdup_printf("POST %s%s/notifyft HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; Y=%s\r\n" - "Host: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "Cache-Control: no-cache\r\n\r\n", - use_whole_url ? "http://" : "", use_whole_url ? tmp : "", - yd->cookie_t, yd->cookie_y, - tmp, - pkt_buf_len + 4 + d->str->len); - g_free(tmp); - - /* There's no magic here, we just need to prepend in reverse order */ - g_string_prepend(d->str, "29\xc0\x80"); - - g_string_prepend_len(d->str, (char *)pkt_buf, pkt_buf_len); - g_free(pkt_buf); - - g_string_prepend(d->str, header); - g_free(header); - - /* There are other problems if we're uploading over 4GB of data */ - purple_debug_info("yahoo", "Buddy icon upload data:\n%.*s\n", (guint)d->str->len, d->str->str); - - d->fd = source; - d->watcher = purple_input_add(d->fd, PURPLE_INPUT_WRITE, yahoo_buddy_icon_upload_pending, d); - - yahoo_buddy_icon_upload_pending(d, d->fd, PURPLE_INPUT_WRITE); -} - -void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - - if (yd->buddy_icon_connect_data != NULL) { - /* Cancel any in-progress buddy icon upload */ - purple_proxy_connect_cancel(yd->buddy_icon_connect_data); - yd->buddy_icon_connect_data = NULL; - } - - yd->buddy_icon_connect_data = purple_proxy_connect(NULL, account, - purple_account_get_string(account, "xfer_host", - yd->jp? YAHOOJP_XFER_HOST : YAHOO_XFER_HOST), - purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_buddy_icon_upload_connected, d); - - if (yd->buddy_icon_connect_data == NULL) - { - purple_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); - yahoo_buddy_icon_upload_data_free(d); - } -} - -static int yahoo_buddy_icon_calculate_checksum(const guchar *data, gsize len) -{ - /* This code is borrowed from Kopete, which seems to be managing to calculate - checksums in such a manner that Yahoo!'s servers are happy */ - - const guchar *p = data; - int checksum = 0, g, i = len; - - while(i--) { - checksum = (checksum << 4) + *p++; - - if((g = (checksum & 0xf0000000)) != 0) - checksum ^= g >> 23; - - checksum &= ~g; - } - - purple_debug_misc("yahoo", "Calculated buddy icon checksum: %d\n", checksum); - - return checksum; -} - -void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - YahooData *yd = gc->proto_data; - PurpleAccount *account = gc->account; - - if (img == NULL) { - g_free(yd->picture_url); - yd->picture_url = NULL; - - /* TODO: don't we have to clear it on the server too?! */ - - purple_account_set_string(account, YAHOO_PICURL_SETTING, NULL); - purple_account_set_int(account, YAHOO_PICCKSUM_SETTING, 0); - purple_account_set_int(account, YAHOO_PICEXPIRE_SETTING, 0); - if (yd->logged_in) - /* Tell everyone we ain't got one no more */ - yahoo_send_picture_update(gc, 0); - - } else { - gconstpointer data = purple_imgstore_get_data(img); - size_t len = purple_imgstore_get_size(img); - GString *s = g_string_new_len(data, len); - struct yahoo_buddy_icon_upload_data *d; - int oldcksum = purple_account_get_int(account, YAHOO_PICCKSUM_SETTING, 0); - int expire = purple_account_get_int(account, YAHOO_PICEXPIRE_SETTING, 0); - const char *oldurl = purple_account_get_string(account, YAHOO_PICURL_SETTING, NULL); - - yd->picture_checksum = yahoo_buddy_icon_calculate_checksum(data, len); - - if ((yd->picture_checksum == oldcksum) && - (expire > (time(NULL) + 60*60*24)) && oldurl) - { - purple_debug_misc("yahoo", "buddy icon is up to date. Not reuploading.\n"); - g_string_free(s, TRUE); - g_free(yd->picture_url); - yd->picture_url = g_strdup(oldurl); - return; - } - - /* We use this solely for sending a filename to the server */ - d = g_new0(struct yahoo_buddy_icon_upload_data, 1); - d->gc = gc; - d->str = s; - d->fd = -1; - d->filename = g_strdup(purple_imgstore_get_filename(img)); - - if (!yd->logged_in) { - yd->picture_upload_todo = d; - return; - } - - yahoo_buddy_icon_upload(gc, d); - - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_picture.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _YAHOO_PICTURE_H_ -#define _YAHOO_PICTURE_H_ - -void yahoo_send_picture_request(PurpleConnection *gc, const char *who); -void yahoo_send_picture_info(PurpleConnection *gc, const char *who); -void yahoo_send_picture_checksum(PurpleConnection *gc); -void yahoo_send_picture_update(PurpleConnection *gc, int type); -void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type); - -void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img); -void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d); -void yahoo_buddy_icon_upload_data_free(struct yahoo_buddy_icon_upload_data *d); - -#endif /* _YAHOO_PICTURE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_profile.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_profile.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_profile.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/yahoo_profile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1288 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#define PHOTO_SUPPORT 1 - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "util.h" -#if PHOTO_SUPPORT -#include "imgstore.h" -#endif /* PHOTO_SUPPORT */ - -#include "libymsg.h" -#include "yahoo_friend.h" - -typedef struct { - PurpleConnection *gc; - char *name; -} YahooGetInfoData; - -typedef enum profile_lang_id { - XX, DA, DE, EL, - EN, EN_GB, - ES_AR, ES_ES, ES_MX, ES_US, - FR_CA, FR_FR, - IT, JA, KO, NO, PT, SV, - ZH_CN, ZH_HK, ZH_TW, ZH_US, PT_BR -} profile_lang_id_t; - -typedef struct profile_lang_node { - profile_lang_id_t lang; - char *last_updated_string; - char *det; -} profile_lang_node_t; - -typedef struct profile_strings_node { - profile_lang_id_t lang; - char *lang_string; /* Only to make debugging output saner */ - char *charset; - char *yahoo_id_string; - char *private_string; - char *no_answer_string; - char *my_email_string; - char *realname_string; - char *location_string; - char *age_string; - char *maritalstatus_string; - char *gender_string; - char *occupation_string; - char *hobbies_string; - char *latest_news_string; - char *favorite_quote_string; - char *links_string; - char *no_home_page_specified_string; - char *home_page_string; - char *no_cool_link_specified_string; - char *cool_link_1_string; - char *cool_link_2_string; - char *cool_link_3_string; - char *dummy; -} profile_strings_node_t; - -typedef enum profile_state { - PROFILE_STATE_DEFAULT, - PROFILE_STATE_NOT_FOUND, - PROFILE_STATE_UNKNOWN_LANGUAGE -} profile_state_t; - -typedef struct { - YahooGetInfoData *info_data; - PurpleNotifyUserInfo *user_info; - char *url_buffer; - char *photo_url_text; - char *profile_url_text; - const profile_strings_node_t *strings; - const char *last_updated_string; - const char *title; - profile_state_t profile_state; -} YahooGetInfoStepTwoData; - -/* Strings to determine the profile "language" (more accurately "locale"). - * Strings in this list must be in the original charset in the profile. - * The "Last Updated" string is used, but sometimes is not sufficient to - * distinguish 2 locales with this (e.g., ES_ES from ES_US, or FR_CA from - * FR_FR, or EL from EN_GB), in which case a second string is added and - * such special cases must be placed before the more general case. - */ -static const profile_lang_node_t profile_langs[] = { - { DA, "Opdateret sidste gang ", NULL }, - { DE, "Letzter Update ", NULL }, - { EL, "Last Updated:", "http://gr.profiles.yahoo.com" }, - { EN_GB, "Last Update ", "Favourite Quote" }, - { EN, "Last Update:", NULL }, - { EN, "Last Update ", NULL }, - { ES_AR, "\332ltima actualizaci\363n ", NULL }, - { ES_ES, "Actualizada el ", "http://es.profiles.yahoo.com" }, - { ES_MX, "Actualizada el  ", "http://mx.profiles.yahoo.com" }, - { ES_US, "Actualizada el  ", NULL }, - { FR_CA, "Derni\xe8re mise \xe0 jour", "http://cf.profiles.yahoo.com" }, - { FR_FR, "Derni\xe8re mise \xe0 jour", NULL }, - { IT, "Ultimo aggiornamento:", NULL }, - { JA, "\xba\xc7\xbd\xaa\xb9\xb9\xbf\xb7\xc6\xfc\xa1\xa7", NULL }, - { KO, "\xb0\xbb\xbd\xc5\x20\xb3\xaf\xc2\xa5 ", NULL }, - { NO, "Sist oppdatert ", NULL }, - { PT, "\332ltima atualiza\347\343o ", NULL }, - { PT_BR, "\332ltima atualiza\347\343o:", NULL }, - { SV, "Senast uppdaterad ", NULL }, - { ZH_CN, "\xd7\xee\xba\xf3\xd0\xde\xb8\xc4\xc8\xd5\xc6\xda", NULL }, - { ZH_HK, "\xb3\xcc\xaa\xf1\xa7\xf3\xb7\x73\xae\xc9\xb6\xa1", NULL }, - { ZH_US, "\xb3\xcc\xab\xe1\xad\xd7\xa7\xef\xa4\xe9\xb4\xc1", "http://chinese.profiles.yahoo.com" }, - { ZH_TW, "\xb3\xcc\xab\xe1\xad\xd7\xa7\xef\xa4\xe9\xb4\xc1", NULL }, - { XX, NULL, NULL } -}; - -/* Strings in this list must be in UTF-8;  's should be specified as spaces. */ -static const profile_strings_node_t profile_strings[] = { - { DA, "da", "ISO-8859-1", - "Yahoo! ID:", - "Privat", - "Intet svar", - "Min Email", - "Rigtige navn:", - "Opholdssted:", - "Alder:", - "Ægteskabelig status:", - "Køn:", - "Erhverv:", - "Hobbyer:", - "Sidste nyt:", - "Favoritcitat", - "Links", - "Ingen hjemmeside specificeret", - "Forside:", - "Intet cool link specificeret", - "Cool link 1:", - "Cool link 2:", - "Cool link 3:", - NULL - }, - { DE, "de", "ISO-8859-1", - "Yahoo!-ID:", - "Privat", - "Keine Antwort", - "Meine E-Mail", - "Realer Name:", - "Ort:", - "Alter:", - "Familienstand:", - "Geschlecht:", - "Beruf:", - "Hobbys:", - "Neuste Nachrichten:", - "Mein Lieblingsspruch", - "Links", - "Keine Homepage angegeben", - "Homepage:", - "Keinen coolen Link angegeben", - "Cooler Link 1:", - "Cooler Link 2:", - "Cooler Link 3:", - NULL - }, - { EL, "el", "ISO-8859-7", /* EL is identical to EN, except no_answer_string */ - "Yahoo! ID:", - "Private", - "Καμία απάντηση", - "My Email", - "Real Name:", - "Location:", - "Age:", - "Marital Status:", - "Gender:", - "Occupation:", - "Hobbies:", - "Latest News", - "Favorite Quote", - "Links", - "No home page specified", - "Home Page:", - "No cool link specified", - "Cool Link 1:", - "Cool Link 2:", - "Cool Link 3:", - NULL - }, - { EN, "en", "ISO-8859-1", - "Yahoo! ID:", - "Private", - "No Answer", - "My Email:", - "Real Name:", - "Location:", - "Age:", - "Marital Status:", - "Sex:", - "Occupation:", - "Hobbies", - "Latest News", - "Favorite Quote", - "Links", - "No home page specified", - "Home Page:", - "No cool link specified", - "Cool Link 1", - "Cool Link 2", - "Cool Link 3", - NULL - }, - { EN_GB, "en_GB", "ISO-8859-1", /* Same as EN except spelling of "Favourite" */ - "Yahoo! ID:", - "Private", - "No Answer", - "My Email:", - "Real Name:", - "Location:", - "Age:", - "Marital Status:", - "Sex:", - "Occupation:", - "Hobbies", - "Latest News", - "Favourite Quote", - "Links", - "No home page specified", - "Home Page:", - "No cool link specified", - "Cool Link 1", - "Cool Link 2", - "Cool Link 3", - NULL - }, - { ES_AR, "es_AR", "ISO-8859-1", - "Usuario de Yahoo!:", - "Privado", - "No introdujiste una respuesta", - "Mi dirección de correo electrónico", - "Nombre real:", - "Ubicación:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Pasatiempos:", - "Últimas noticias:", - "Tu cita favorita", - "Enlaces", - "Ninguna página de inicio especificada", - "Página de inicio:", - "Ningún enlace preferido", - "Enlace genial 1:", - "Enlace genial 2:", - "Enlace genial 3:", - NULL - }, - { ES_ES, "es_ES", "ISO-8859-1", - "ID de Yahoo!:", - "Privado", - "Sin respuesta", - "Mi correo-e", - "Nombre verdadero:", - "Lugar:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Aficiones:", - "Ultimas Noticias:", - "Tu cita Favorita", - "Enlace", - "Ninguna página personal especificada", - "Página de Inicio:", - "Ningún enlace preferido", - "Enlaces Preferidos 1:", - "Enlaces Preferidos 2:", - "Enlaces Preferidos 3:", - NULL - }, - { ES_MX, "es_MX", "ISO-8859-1", - "ID de Yahoo!:", - "Privado", - "Sin responder", - "Mi Dirección de correo-e", - "Nombre real:", - "Ubicación:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Pasatiempos:", - "Ultimas Noticias:", - "Su cita favorita", - "Enlaces", - "Ninguna Página predefinida", - "Página web:", - "Ningún Enlace preferido", - "Enlaces Preferidos 1:", - "Enlaces Preferidos 2:", - "Enlaces Preferidos 3:", - NULL - }, - { ES_US, "es_US", "ISO-8859-1", - "ID de Yahoo!:", - "Privado", - "No introdujo una respuesta", - "Mi Dirección de correo-e", - "Nombre real:", - "Localidad:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Pasatiempos:", - "Ultimas Noticias:", - "Su cita Favorita", - "Enlaces", - "Ninguna Página de inicio predefinida", - "Página de inicio:", - "Ningún Enlace preferido", - "Enlaces Preferidos 1:", - "Enlaces Preferidos 2:", - "Enlaces Preferidos 3:", - NULL - }, - { FR_CA, "fr_CA", "ISO-8859-1", - "Compte Yahoo!:", - "Privé", - "Sans réponse", - "Mon courriel", - "Nom réel:", - "Lieu:", - "Âge:", - "État civil:", - "Sexe:", - "Profession:", - "Passe-temps:", - "Actualités:", - "Citation préférée", - "Liens", - "Pas de mention d'une page personnelle", - "Page personnelle:", - "Pas de mention d'un lien favori", - "Lien préféré 1:", - "Lien préféré 2:", - "Lien préféré 3:", - NULL - }, - { FR_FR, "fr_FR", "ISO-8859-1", - "Compte Yahoo!:", - "Privé", - "Sans réponse", - "Mon E-mail", - "Nom réel:", - "Lieu:", - "Âge:", - "Situation de famille:", - "Sexe:", - "Profession:", - "Centres d'intérêts:", - "Actualités:", - "Citation préférée", - "Liens", - "Pas de mention d'une page perso", - "Page perso:", - "Pas de mention d'un lien favori", - "Lien préféré 1:", - "Lien préféré 2:", - "Lien préféré 3:", - NULL - }, - { IT, "it", "ISO-8859-1", - "Yahoo! ID:", - "Non pubblica", - "Nessuna risposta", - "La mia e-mail:", - "Nome vero:", - "Località:", - "Età:", - "Stato civile:", - "Sesso:", - "Occupazione:", - "Hobby", - "Ultime notizie", - "Citazione preferita", - "Link", - "Nessuna home page specificata", - "Inizio:", - "Nessun link specificato", - "Cool Link 1", - "Cool Link 2", - "Cool Link 3", - NULL - }, - { JA, "ja", "EUC-JP", - "Yahoo! JAPAN ID:", - "非公開", - "無回答", - "メール:", - "名前:", - "住所:", - "年齢:", - "未婚/既婚:", - "性別:", - "職業:", - "趣味:", - "最近の出来事:", - NULL, -#if 0 - "おすすめサイト", -#else - "自己PR", /* "Self description" comes before "Links" for yahoo.co.jp */ -#endif - NULL, - NULL, - NULL, - "おすすめサイト1:", - "おすすめサイト2:", - "おすすめサイト3:", - NULL - }, - { KO, "ko", "EUC-KR", - "야후! ID:", - "비공개", - "비공개", - "My Email", - "실명:", - "거주지:", - "나이:", - "결혼 여부:", - "성별:", - "직업:", - "취미:", - "자기 소개:", - "좋아하는 명언", - "링크", - "홈페이지를 지정하지 않았습니다.", - "홈페이지:", - "추천 사이트가 없습니다.", - "추천 사이트 1:", - "추천 사이트 2:", - "추천 사이트 3:", - NULL - }, - { NO, "no", "ISO-8859-1", - "Yahoo! ID:", - "Privat", - "Ikke noe svar", - "Min e-post", - "Virkelig navn:", - "Sted:", - "Alder:", - "Sivilstatus:", - "Kjønn:", - "Yrke:", - "Hobbyer:", - "Siste nytt:", - "Yndlingssitat", - "Lenker", - "Ingen hjemmeside angitt", - "Hjemmeside:", - "No cool link specified", - "Bra lenke 1:", - "Bra lenke 2:", - "Bra lenke 3:", - NULL - }, - { PT, "pt", "ISO-8859-1", - "ID Yahoo!:", - "Particular", - "Sem resposta", - "Meu e-mail", - "Nome verdadeiro:", - "Local:", - "Idade:", - "Estado civil:", - "Sexo:", - "Ocupação:", - "Hobbies:", - "Últimas notícias:", - "Frase favorita", - "Links", - "Nenhuma página pessoal especificada", - "Página pessoal:", - "Nenhum site legal especificado", - "Site legal 1:", - "Site legal 2:", - "Site legal 3:", - NULL - }, - { PT_BR, "pt_br", "ISO-8859-1", - "ID Yahoo!:", - "Particular", - "Sem resposta", - "Meu e-mail", - "Nome verdadeiro:", - "Localização:", - "Idade:", - "Estado civil:", - "Sexo:", - "Ocupação:", - "Pasatiempos:", - "Últimas novidades:", - "Frase preferida:", - "Links", - "Nenhuma home page especificada", - "Página Web:", - "Nenhum site legal especificado", - "Link legal 1", - "Link legal 2", - "Link legal 3", - NULL - }, - { SV, "sv", "ISO-8859-1", - "Yahoo!-ID:", - "Privat", - "Inget svar", - "Min mail", - "Riktigt namn:", - "Plats:", - "Ålder:", - "Civilstånd:", - "Kön:", - "Yrke:", - "Hobby:", - "Senaste nytt:", - "Favoritcitat", - "Länkar", - "Ingen hemsida specificerad", - "Hemsida:", - "Ingen cool länk specificerad", - "Coola länkar 1:", - "Coola länkar 2:", - "Coola länkar 3:", - NULL - }, - { ZH_CN, "zh_CN", "GB2312", - "Yahoo! ID:", - "没有提供", - "没有回答", - "个人电邮地址", - "真实姓名:", - "所在地点:", - "年龄:", - "婚姻状况:", - "性别:", - "职业:", - "业余爱好:", - "个人近况:", - "喜欢的引言", - "链接", - "没有个人主页", - "个人主页:", - "没有推荐网站链接", - "推荐网站链接 1:", - "推荐网站链接 2:", - "推荐网站链接 3:", - NULL - }, - { ZH_HK, "zh_HK", "Big5", - "Yahoo! ID:", - "私人的", - "沒有回答", - "電子信箱", - "真實姓名:", - "地點:", - "年齡:", - "婚姻狀況:", - "性別:", - "職業:", - "嗜好:", - "最新消息:", - "最喜愛的股票叫價", /* [sic] Yahoo!'s translators don't check context */ - "連結", - "沒有注明個人網頁", /* [sic] */ - "個人網頁:", - "沒有注明 Cool 連結", /* [sic] */ - "Cool 連結 1:", /* TODO */ - "Cool 連結 2:", /* TODO */ - "Cool 連結 3:", /* TODO */ - NULL - }, - { ZH_TW, "zh_TW", "Big5", - "帳 號:", - "沒有提供", - "沒有回應", - "電子信箱", - "姓名:", - "地點:", - "年齡:", - "婚姻狀態:", - "性別:", - "職業:", - "興趣:", - "個人近況:", - "喜歡的名句", - "連結", - "沒有個人網頁", - "個人網頁:", - "沒有推薦網站連結", - "推薦網站連結 1:", - "推薦網站連結 2:", - "推薦網站連結 3:", - NULL - }, - { ZH_US, "zh_US", "Big5", /* ZH_US is like ZH_TW, but also a bit like ZH_HK */ - "Yahoo! ID:", - "沒有提供", - "沒有回答", - "個人Email地址", - "真實姓名:", - "地點:", - "年齡:", - "婚姻狀態:", - "性別:", - "職業:", - "嗜好:", - "個人近況:", - "喜歡的名句", - "連結", - "沒有個人網頁", - "個人網頁:", - "沒有推薦網站連結", - "推薦網站連結 1:", /* TODO */ - "推薦網站連結 2:", /* TODO */ - "推薦網站連結 3:", /* TODO */ - NULL - }, - { XX, NULL, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL - }, -}; - -static char *yahoo_info_date_reformat(const char *field, size_t len) -{ - char *tmp = g_strndup(field, len); - time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - - g_free(tmp); - return g_strdup(purple_date_format_short(localtime(&t))); -} - -static char *yahoo_remove_nonbreaking_spaces(char *str) -{ - char *p; - while ((p = strstr(str, " ")) != NULL) { - *p = ' '; /* Turn  's into ordinary blanks */ - p += 1; - memmove(p, p + 5, strlen(p + 5)); - str[strlen(str) - 5] = '\0'; - } - return str; -} - -static void yahoo_extract_user_info_text(PurpleNotifyUserInfo *user_info, YahooGetInfoData *info_data) { - PurpleBuddy *b; - YahooFriend *f; - - b = purple_find_buddy(purple_connection_get_account(info_data->gc), - info_data->name); - - if (b) { - const char *balias = purple_buddy_get_local_buddy_alias(b); - if(balias && balias[0]) { - char *aliastext = g_markup_escape_text(balias, -1); - purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); - g_free(aliastext); - } - #if 0 - if (b->idle > 0) { - char *idletime = purple_str_seconds_to_string(time(NULL) - b->idle); - purple_notify_user_info_add_pair(user_info, _("Idle"), idletime); - g_free(idletime); - } - #endif - - /* Add the normal tooltip pairs */ - yahoo_tooltip_text(b, user_info, TRUE); - - if ((f = yahoo_friend_find(info_data->gc, purple_buddy_get_name(b)))) { - const char *ip; - if ((ip = yahoo_friend_get_ip(f))) - purple_notify_user_info_add_pair(user_info, _("IP Address"), ip); - } - } -} - -#if PHOTO_SUPPORT - -static char *yahoo_get_photo_url(const char *url_text, const char *name) { - GString *s = g_string_sized_new(strlen(name) + 8); - char *p; - char *it = NULL; - - /*g_string_printf(s, " alt=\"%s\">", name);*/ - /* Y! newformat */ - g_string_printf(s, " alt=%s>", name); - p = strstr(url_text, s->str); - - if (p) { - /* Search backwards for "http://". This is stupid, but it works. */ - for (; !it && p > url_text; p -= 1) { - /*if (strncmp(p, "\"http://", 8) == 0) {*/ - /* Y! newformat*/ - if (strncmp(p, "=http://", 8) == 0) { - char *q; - p += 1; /* skip only the ' ' */ - q = strchr(p, ' '); - if (q) { - g_free(it); - it = g_strndup(p, q - p); - } - } - } - } - - g_string_free(s, TRUE); - return it; -} - -static void -yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message); - -#endif /* PHOTO_SUPPORT */ - -static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - YahooGetInfoData *info_data = (YahooGetInfoData *)user_data; - PurpleNotifyUserInfo *user_info; - char *p; -#if PHOTO_SUPPORT - YahooGetInfoStepTwoData *info2_data; - char *photo_url_text = NULL; -#else - gboolean found = FALSE; - char *stripped; - int stripped_len; - char *last_updated_utf8_string = NULL; -#endif /* !PHOTO_SUPPORT */ - const char *last_updated_string = NULL; - char *url_buffer; - GString *s; - char *tmp; - char *profile_url_text = NULL; - int lang, strid; - YahooData *yd; - const profile_strings_node_t *strings = NULL; - const char *title; - profile_state_t profile_state = PROFILE_STATE_DEFAULT; - - purple_debug_info("yahoo", "In yahoo_got_info\n"); - - yd = info_data->gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - user_info = purple_notify_user_info_new(); - - title = yd->jp ? _("Yahoo! Japan Profile") : - _("Yahoo! Profile"); - - /* Get the tooltip info string */ - yahoo_extract_user_info_text(user_info, info_data); - - /* We failed to grab the profile URL. This is not expected to actually - * happen except under unusual error conditions, as Yahoo is observed - * to send back HTML, with a 200 status code. - */ - if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { - purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), NULL); - purple_notify_userinfo(info_data->gc, info_data->name, - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - g_free(profile_url_text); - g_free(info_data->name); - g_free(info_data); - return; - } - - /* Construct the correct profile URL */ - s = g_string_sized_new(80); /* wild guess */ - g_string_printf(s, "%s%s", (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), - info_data->name); - profile_url_text = g_string_free(s, FALSE); - s = NULL; - - /* We don't yet support the multiple link level of the warning page for - * 'adult' profiles, not to mention the fact that yahoo wants you to be - * logged in (on the website) to be able to view an 'adult' profile. For - * now, just tell them that we can't help them, and provide a link to the - * profile if they want to do the web browser thing. - */ - p = strstr(url_text, "Adult Profiles Warning Message"); - if (!p) { - p = strstr(url_text, "Adult Content Warning"); /* TITLE element */ - } - if (p) { - tmp = g_strdup_printf("%s

" - "%s
%s", - _("Sorry, profiles marked as containing adult content " - "are not supported at this time."), - _("If you wish to view this profile, " - "you will need to visit this link in your web browser:"), - profile_url_text, profile_url_text); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - purple_notify_userinfo(info_data->gc, info_data->name, - user_info, NULL, NULL); - - g_free(profile_url_text); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); - return; - } - - /* Check whether the profile is written in a supported language */ - for (lang = 0;; lang += 1) { - last_updated_string = profile_langs[lang].last_updated_string; - if (!last_updated_string) - break; - - p = strstr(url_text, last_updated_string); - - if (p) { - if (profile_langs[lang].det && !strstr(url_text, profile_langs[lang].det)) - p = NULL; - else - break; - } - } - - if (p) { - for (strid = 0; profile_strings[strid].lang != XX; strid += 1) { - if (profile_strings[strid].lang == profile_langs[lang].lang) break; - } - strings = profile_strings + strid; - purple_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang); - } - - /* Every user may choose his/her own profile language, and this language - * has nothing to do with the preferences of the user which looks at the - * profile. We try to support all languages, but nothing is guaranteed. - * If we cannot determine the language, it means either (1) the profile - * is written in an unsupported language, (2) our language support is - * out of date, or (3) the user is not found, or (4) Y! have changed their - * webpage layout - */ - if (!p || strings->lang == XX) { - if (!strstr(url_text, "Yahoo! Member Directory - User not found") - && !strstr(url_text, "was not found on this server.") - && !strstr(url_text, "\xb8\xf8\xb3\xab\xa5\xd7\xa5\xed\xa5\xd5\xa5\xa3\xa1\xbc\xa5\xeb\xa4\xac\xb8\xab\xa4\xc4\xa4\xab\xa4\xea\xa4\xde\xa4\xbb\xa4\xf3")) { - profile_state = PROFILE_STATE_UNKNOWN_LANGUAGE; - } else { - profile_state = PROFILE_STATE_NOT_FOUND; - } - } - -#if PHOTO_SUPPORT - photo_url_text = yahoo_get_photo_url(url_text, info_data->name); -#endif /* PHOTO_SUPPORT */ - - url_buffer = g_strdup(url_text); - - /* - * purple_markup_strip_html() doesn't strip out character entities like   - * and · - */ - yahoo_remove_nonbreaking_spaces(url_buffer); -#if 1 - while ((p = strstr(url_buffer, "·")) != NULL) { - memmove(p, p + 6, strlen(p + 6)); - url_buffer[strlen(url_buffer) - 6] = '\0'; - } -#endif - - /* nuke the nasty \r's */ - purple_str_strip_char(url_buffer, '\r'); - -#if PHOTO_SUPPORT - /* Marshall the existing state */ - info2_data = g_malloc(sizeof(YahooGetInfoStepTwoData)); - info2_data->info_data = info_data; - info2_data->url_buffer = url_buffer; - info2_data->photo_url_text = photo_url_text; - info2_data->profile_url_text = profile_url_text; - info2_data->strings = strings; - info2_data->last_updated_string = last_updated_string; - info2_data->title = title; - info2_data->profile_state = profile_state; - info2_data->user_info = user_info; - - /* Try to put the photo in there too, if there's one */ - if (photo_url_text) { - PurpleUtilFetchUrlData *url_data; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(info_data->gc); - - /* User-uploaded photos use a different server that requires the Host - * header, but Yahoo Japan will use the "chunked" content encoding if - * we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url - */ - url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL, - FALSE, yahoo_got_photo, info2_data); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - } else { - /* Emulate a callback */ - yahoo_got_photo(NULL, info2_data, NULL, 0, NULL); - } -} - -static void -yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - YahooGetInfoStepTwoData *info2_data = (YahooGetInfoStepTwoData *)data; - YahooData *yd; - gboolean found = FALSE; - int id = -1; - - /* Temporary variables */ - char *p = NULL; - char *stripped; - int stripped_len; - char *last_updated_utf8_string = NULL; - char *tmp; - - /* Unmarshall the saved state */ - YahooGetInfoData *info_data = info2_data->info_data; - char *url_buffer = info2_data->url_buffer; - PurpleNotifyUserInfo *user_info = info2_data->user_info; - char *photo_url_text = info2_data->photo_url_text; - char *profile_url_text = info2_data->profile_url_text; - const profile_strings_node_t *strings = info2_data->strings; - const char *last_updated_string = info2_data->last_updated_string; - profile_state_t profile_state = info2_data->profile_state; - - /* We continue here from yahoo_got_info, as if nothing has happened */ -#endif /* PHOTO_SUPPORT */ - - /* Jun 29 05 Bleeter: Y! changed their profile pages. Terminators now seem to be */ - /* and not \n. The prpl's need to be audited before it can be moved */ - /* in to purple_markup_strip_html*/ - char *fudged_buffer; - - yd = info_data->gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - fudged_buffer = purple_strcasereplace(url_buffer, "", "
"); - /* nuke the html, it's easier than trying to parse the horrid stuff */ - stripped = purple_markup_strip_html(fudged_buffer); - stripped_len = strlen(stripped); - - purple_debug_misc("yahoo", "stripped = %p\n", stripped); - purple_debug_misc("yahoo", "url_buffer = %p\n", url_buffer); - - /* convert to utf8 */ - if (strings && strings->charset) { - p = g_convert(stripped, -1, "utf-8", strings->charset, - NULL, NULL, NULL); - if (!p) { - p = g_locale_to_utf8(stripped, -1, NULL, NULL, NULL); - if (!p) { - p = g_convert(stripped, -1, "utf-8", "windows-1252", - NULL, NULL, NULL); - } - } - if (p) { - g_free(stripped); - stripped = purple_utf8_ncr_decode(p); - stripped_len = strlen(stripped); - g_free(p); - } - } - p = NULL; - - /* "Last updated" should also be converted to utf8 and with   killed */ - if (strings && strings->charset) { - last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8", - strings->charset, NULL, NULL, NULL); - yahoo_remove_nonbreaking_spaces(last_updated_utf8_string); - - purple_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped); - } - - if (profile_state == PROFILE_STATE_DEFAULT) { -#if 0 - /* extract their Yahoo! ID and put it in. Don't bother marking has_info as - * true, since the Yahoo! ID will always be there */ - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->yahoo_id_string, (yd->jp ? 2 : 10), "\n", 0, - NULL, _("Yahoo! ID"), 0, NULL, NULL)) - ; -#endif - -#if PHOTO_SUPPORT - /* Try to put the photo in there too, if there's one and is readable */ - if (data && url_text && len != 0) { - if (strstr(url_text, "400 Bad Request") - || strstr(url_text, "403 Forbidden") - || strstr(url_text, "404 Not Found")) { - - purple_debug_info("yahoo", "Error getting %s: %s\n", - photo_url_text, url_text); - } else { - purple_debug_info("yahoo", "%s is %" G_GSIZE_FORMAT - " bytes\n", photo_url_text, len); - id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - - tmp = g_strdup_printf("
", id); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - } - } -#endif /* PHOTO_SUPPORT */ - - /* extract their Email address and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->my_email_string, (yd->jp ? 4 : 1), " ", 0, - strings->private_string, _("Email"), 0, NULL, NULL); - - /* extract the Nickname if it exists */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - "Nickname:", 1, "\n", '\n', - NULL, _("Nickname"), 0, NULL, NULL); - - /* extract their RealName and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->realname_string, (yd->jp ? 3 : 1), "\n", '\n', - NULL, _("Real Name"), 0, NULL, NULL); - - /* extract their Location and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->location_string, (yd->jp ? 4 : 2), "\n", '\n', - NULL, _("Location"), 0, NULL, NULL); - - /* extract their Age and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->age_string, (yd->jp ? 2 : 3), "\n", '\n', - NULL, _("Age"), 0, NULL, NULL); - - /* extract their MaritalStatus and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->maritalstatus_string, (yd->jp ? 2 : 3), "\n", '\n', - strings->no_answer_string, _("Marital Status"), 0, NULL, NULL); - - /* extract their Gender and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->gender_string, (yd->jp ? 2 : 3), "\n", '\n', - strings->no_answer_string, _("Gender"), 0, NULL, NULL); - - /* extract their Occupation and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->occupation_string, 2, "\n", '\n', - NULL, _("Occupation"), 0, NULL, NULL); - - /* Hobbies, Latest News, and Favorite Quote are a bit different, since - * the values can contain embedded newlines... but any or all of them - * can also not appear. The way we delimit them is to successively - * look for the next one that _could_ appear, and if all else fails, - * we end the section by looking for the 'Links' heading, which is the - * next thing to follow this bunch. (For Yahoo Japan, we check for - * the "Description" ("Self PR") heading instead of "Links".) - */ - - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->hobbies_string, (yd->jp ? 3 : 1), strings->latest_news_string, - '\n', "\n", _("Hobbies"), 0, NULL, NULL)) - { - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->hobbies_string, 1, strings->favorite_quote_string, - '\n', "\n", _("Hobbies"), 0, NULL, NULL)) - { - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->hobbies_string, 1, strings->links_string, - '\n', "\n", _("Hobbies"), 0, NULL, NULL); - } - else - found = TRUE; - } - else - found = TRUE; - - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->latest_news_string, 1, strings->favorite_quote_string, - '\n', "\n", _("Latest News"), 0, NULL, NULL)) - { - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->latest_news_string, (yd->jp ? 2 : 1), strings->links_string, - '\n', "\n", _("Latest News"), 0, NULL, NULL); - } - else - found = TRUE; - - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->favorite_quote_string, 1, strings->links_string, - '\n', "\n", _("Favorite Quote"), 0, NULL, NULL); - - /* Home Page will either be "No home page specified", - * or "Home Page: " and a link. - * For Yahoo! Japan, if there is no home page specified, - * neither "No home page specified" nor "Home Page:" is shown. - */ - if (strings->home_page_string) { - p = !strings->no_home_page_specified_string? NULL: - strstr(stripped, strings->no_home_page_specified_string); - if(!p) - { - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->home_page_string, 1, "\n", 0, NULL, - _("Home Page"), 1, NULL, NULL); - } - } - - /* Cool Link {1,2,3} is also different. If "No cool link specified" - * exists, then we have none. If we have one however, we'll need to - * check and see if we have a second one. If we have a second one, - * we have to check to see if we have a third one. - */ - p = !strings->no_cool_link_specified_string? NULL: - strstr(stripped,strings->no_cool_link_specified_string); - if (!p) - { - if (purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->cool_link_1_string, 1, "\n", 0, NULL, - _("Cool Link 1"), 1, NULL, NULL)) - { - found = TRUE; - if (purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->cool_link_2_string, 1, "\n", 0, NULL, - _("Cool Link 2"), 1, NULL, NULL)) - { - purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->cool_link_3_string, 1, "\n", 0, NULL, - _("Cool Link 3"), 1, NULL, NULL); - } - } - } - - if (last_updated_utf8_string != NULL) { - /* see if Member Since is there, and if so, extract it. */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - "Member Since:", 1, last_updated_utf8_string, - '\n', NULL, _("Member Since"), 0, NULL, yahoo_info_date_reformat); - - /* extract the Last Updated date and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - last_updated_utf8_string, (yd->jp ? 2 : 1), (yd->jp ? "\n" : " "), (yd->jp ? 0 : '\n'), NULL, - _("Last Update"), 0, NULL, (yd->jp ? NULL : yahoo_info_date_reformat)); - } - } /* if (profile_state == PROFILE_STATE_DEFAULT) */ - - if(!found) - { - const gchar *str; - - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, - _("Error retrieving profile"), NULL); - - if (profile_state == PROFILE_STATE_UNKNOWN_LANGUAGE) { - str = _("This profile is in a language " - "or format that is not supported at this time."); - - } else if (profile_state == PROFILE_STATE_NOT_FOUND) { - PurpleBuddy *b = purple_find_buddy - (purple_connection_get_account(info_data->gc), - info_data->name); - YahooFriend *f = NULL; - if (b) { - /* Someone on the buddy list can be "not on server list", - * in which case the user may or may not actually exist. - * Hence this extra step. - */ - PurpleAccount *account = purple_buddy_get_account(b); - f = yahoo_friend_find(purple_account_get_connection(account), - purple_buddy_get_name(b)); - } - str = f ? _("Could not retrieve the user's profile. " - "This most likely is a temporary server-side problem. " - "Please try again later.") : - _("Could not retrieve the user's profile. " - "This most likely means that the user does not exist; " - "however, Yahoo! sometimes does fail to find a user's " - "profile. If you know that the user exists, " - "please try again later."); - } else { - str = _("The user's profile is empty."); - } - - purple_notify_user_info_add_pair(user_info, NULL, str); - } - - /* put a link to the actual profile URL */ - purple_notify_user_info_add_section_break(user_info); - tmp = g_strdup_printf("%s", - profile_url_text, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - g_free(stripped); - - /* show it to the user */ - purple_notify_userinfo(info_data->gc, info_data->name, - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(last_updated_utf8_string); - g_free(url_buffer); - g_free(fudged_buffer); - g_free(profile_url_text); - g_free(info_data->name); - g_free(info_data); - -#if PHOTO_SUPPORT - g_free(photo_url_text); - g_free(info2_data); - if (id != -1) - purple_imgstore_unref_by_id(id); -#endif /* PHOTO_SUPPORT */ -} - -void yahoo_get_info(PurpleConnection *gc, const char *name) -{ - YahooData *yd = gc->proto_data; - YahooGetInfoData *data; - char *url; - PurpleUtilFetchUrlData *url_data; - - data = g_new0(YahooGetInfoData, 1); - data->gc = gc; - data->name = g_strdup(name); - - url = g_strdup_printf("%s%s", - (yd->jp ? YAHOOJP_PROFILE_URL : YAHOO_PROFILE_URL), name); - - url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, yahoo_got_info, data); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - else { - g_free(data->name); - g_free(data); - } - - g_free(url); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,660 +0,0 @@ -/** - * @file ycht.c The Yahoo! protocol plugin, YCHT protocol stuff. - * - * purple - * - * Copyright (C) 2004 Timothy Ringenbach - * Liberal amounts of code borrowed from the rest of the Yahoo! prpl. - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include - -#include "internal.h" -#include "prpl.h" -#include "notify.h" -#include "account.h" -#include "proxy.h" -#include "debug.h" -#include "conversation.h" -#include "util.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "ycht.h" -#include "yahoochat.h" - -/* - * dword: YCHT - * dword: 0x000000AE - * dword: service - * word: status - * word: size - */ -#define YAHOO_CHAT_ID (1) -/************************************************************************************ - * Functions to process various kinds of packets. - ************************************************************************************/ -static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt) -{ - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - - if (ycht->logged_in) - return; - - yd->chat_online = TRUE; - ycht->logged_in = TRUE; - - if (ycht->room) - ycht_chat_join(ycht, ycht->room); -} - -static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt) -{ - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - - yd->chat_online = FALSE; - ycht->logged_in = FALSE; -} - -static void ycht_process_chatjoin(YchtConn *ycht, YchtPkt *pkt) -{ - char *room, *topic; - PurpleConnection *gc = ycht->gc; - PurpleConversation *c = NULL; - gboolean new_room = FALSE; - char **members; - int i; - - room = g_list_nth_data(pkt->data, 0); - topic = g_list_nth_data(pkt->data, 1); - if (!g_list_nth_data(pkt->data, 4)) - return; - if (!room) - return; - - members = g_strsplit(g_list_nth_data(pkt->data, 4), "\001", 0); - for (i = 0; members[i]; i++) { - char *tmp = strchr(members[i], '\002'); - if (tmp) - *tmp = '\0'; - } - - if (g_list_length(pkt->data) > 5) - new_room = TRUE; - - if (new_room && ycht->changing_rooms) { - serv_got_chat_left(gc, YAHOO_CHAT_ID); - ycht->changing_rooms = FALSE; - c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); - } else { - c = purple_find_chat(gc, YAHOO_CHAT_ID); - } - - if (topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - - for (i = 0; members[i]; i++) { - if (new_room) { - /*if (!strcmp(members[i], purple_connection_get_display_name(ycht->gc))) - continue;*/ - purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), members[i], NULL, PURPLE_CBFLAGS_NONE, TRUE); - } else { - yahoo_chat_add_user(PURPLE_CONV_CHAT(c), members[i], NULL); - } - } - - g_strfreev(members); -} - -static void ycht_process_chatpart(YchtConn *ycht, YchtPkt *pkt) -{ - char *room, *who; - - room = g_list_nth_data(pkt->data, 0); - who = g_list_nth_data(pkt->data, 1); - - if (who && room) { - PurpleConversation *c = purple_find_chat(ycht->gc, YAHOO_CHAT_ID); - if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room)) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); - - } -} - -static void ycht_progress_chatmsg(YchtConn *ycht, YchtPkt *pkt) -{ - char *who, *what, *msg; - PurpleConversation *c; - PurpleConnection *gc = ycht->gc; - - who = g_list_nth_data(pkt->data, 1); - what = g_list_nth_data(pkt->data, 2); - - if (!who || !what) - return; - - c = purple_find_chat(gc, YAHOO_CHAT_ID); - if (!c) - return; - - msg = yahoo_string_decode(gc, what, 1); - what = yahoo_codes_to_html(msg); - g_free(msg); - - if (pkt->service == YCHT_SERVICE_CHATMSG_EMOTE) { - char *tmp = g_strdup_printf("/me %s", what); - g_free(what); - what = tmp; - } - - serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, what, time(NULL)); - g_free(what); -} - -static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt) -{ -#if 0 - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - - if (ycht->logged_in) - return; - - yd->chat_online = TRUE; - ycht->logged_in = TRUE; - - if (ycht->room) - ycht_chat_join(ycht, ycht->room); -#endif -} - -/***************************************************************************** - * Functions dealing with YCHT packets and their contents directly. - *****************************************************************************/ -static void ycht_packet_dump(const guchar *data, int len) -{ -#ifdef YAHOO_YCHT_DEBUG - int i; - - purple_debug_misc("yahoo", ""); - - for (i = 0; i + 1 < len; i += 2) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - purple_debug_misc(NULL, "%02hhx%02hhx ", data[i], data[i + 1]); - } - if (i < len) - purple_debug_misc(NULL, "%02hhx", data[i]); - - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - - for (i = 0; i < len; i++) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - if (g_ascii_isprint(data[i])) - purple_debug_misc(NULL, "%c ", data[i]); - else - purple_debug_misc(NULL, ". "); - } - - purple_debug_misc(NULL, "\n"); -#endif /* YAHOO_YCHT_DEBUG */ -} - -static YchtPkt *ycht_packet_new(guint version, guint service, int status) -{ - YchtPkt *ret; - - ret = g_new0(YchtPkt, 1); - - ret->version = version; - ret->service = service; - ret->status = status; - - return ret; -} - -static void ycht_packet_append(YchtPkt *pkt, const char *str) -{ - g_return_if_fail(pkt != NULL); - g_return_if_fail(str != NULL); - - pkt->data = g_list_append(pkt->data, g_strdup(str)); -} - -static int ycht_packet_length(YchtPkt *pkt) -{ - int ret; - GList *l; - - ret = YCHT_HEADER_LEN; - - for (l = pkt->data; l; l = l->next) { - ret += strlen(l->data); - if (l->next) - ret += strlen(YCHT_SEP); - } - - return ret; -} - -static void ycht_packet_send_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - YchtConn *ycht = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(ycht->txbuf); - - if (writelen == 0) { - purple_input_remove(ycht->tx_handler); - ycht->tx_handler = 0; - return; - } - - ret = write(ycht->fd, ycht->txbuf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - /* TODO: error handling */ -/* - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(purple_account_get_connection(irc->account), - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); -*/ - return; - } - - purple_circ_buffer_mark_read(ycht->txbuf, ret); - -} - -static void ycht_packet_send(YchtConn *ycht, YchtPkt *pkt) -{ - int len, pos, written; - char *buf; - GList *l; - - g_return_if_fail(ycht != NULL); - g_return_if_fail(pkt != NULL); - g_return_if_fail(ycht->fd != -1); - - pos = 0; - len = ycht_packet_length(pkt); - buf = g_malloc(len); - - memcpy(buf + pos, "YCHT", 4); pos += 4; - pos += yahoo_put32(buf + pos, pkt->version); - pos += yahoo_put32(buf + pos, pkt->service); - pos += yahoo_put16(buf + pos, pkt->status); - pos += yahoo_put16(buf + pos, len - YCHT_HEADER_LEN); - - for (l = pkt->data; l; l = l->next) { - int slen = strlen(l->data); - memcpy(buf + pos, l->data, slen); pos += slen; - - if (l->next) { - memcpy(buf + pos, YCHT_SEP, strlen(YCHT_SEP)); - pos += strlen(YCHT_SEP); - } - } - - if (!ycht->tx_handler) - written = write(ycht->fd, buf, len); - else { - written = -1; - errno = EAGAIN; - } - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - /* TODO: Error handling (was none before NBIO changes) */ - written = 0; - } - - if (written < len) { - if (!ycht->tx_handler) - ycht->tx_handler = purple_input_add(ycht->fd, - PURPLE_INPUT_WRITE, ycht_packet_send_write_cb, - ycht); - purple_circ_buffer_append(ycht->txbuf, buf + written, - len - written); - } - - g_free(buf); -} - -static void ycht_packet_read(YchtPkt *pkt, const char *buf, int len) -{ - const char *pos = buf; - const char *needle; - char *tmp, *tmp2; - int i = 0; - - while (len > 0 && (needle = g_strstr_len(pos, len, YCHT_SEP))) { - tmp = g_strndup(pos, needle - pos); - pkt->data = g_list_append(pkt->data, tmp); - len -= needle - pos + strlen(YCHT_SEP); - pos = needle + strlen(YCHT_SEP); - tmp2 = g_strescape(tmp, NULL); - purple_debug_misc("yahoo", "Data[%d]:\t%s\n", i++, tmp2); - g_free(tmp2); - } - - if (len) { - tmp = g_strndup(pos, len); - pkt->data = g_list_append(pkt->data, tmp); - tmp2 = g_strescape(tmp, NULL); - purple_debug_misc("yahoo", "Data[%d]:\t%s\n", i, tmp2); - g_free(tmp2); - }; - - purple_debug_misc("yahoo", "--==End of incoming YCHT packet==--\n"); -} - -static void ycht_packet_process(YchtConn *ycht, YchtPkt *pkt) -{ - if (pkt->data && !strncmp(pkt->data->data, "*** Danger Will Robinson!!!", strlen("*** Danger Will Robinson!!!"))) - return; - - switch (pkt->service) { - case YCHT_SERVICE_LOGIN: - ycht_process_login(ycht, pkt); - break; - case YCHT_SERVICE_LOGOUT: - ycht_process_logout(ycht, pkt); - break; - case YCHT_SERVICE_CHATJOIN: - ycht_process_chatjoin(ycht, pkt); - break; - case YCHT_SERVICE_CHATPART: - ycht_process_chatpart(ycht, pkt); - break; - case YCHT_SERVICE_CHATMSG: - case YCHT_SERVICE_CHATMSG_EMOTE: - ycht_progress_chatmsg(ycht, pkt); - break; - case YCHT_SERVICE_ONLINE_FRIENDS: - ycht_progress_online_friends(ycht, pkt); - break; - default: - purple_debug_warning("yahoo", "YCHT: warning, unhandled service 0x%02x\n", pkt->service); - } -} - -static void ycht_packet_free(YchtPkt *pkt) -{ - GList *l; - - g_return_if_fail(pkt != NULL); - - for (l = pkt->data; l; l = l->next) - g_free(l->data); - g_list_free(pkt->data); - g_free(pkt); -} - -/************************************************************************************ - * Functions dealing with connecting and disconnecting and reading data into YchtPkt - * structs, and all that stuff. - ************************************************************************************/ - -void ycht_connection_close(YchtConn *ycht) -{ - YahooData *yd = ycht->gc->proto_data; - - if (yd) { - yd->ycht = NULL; - yd->chat_online = FALSE; - } - - if (ycht->fd > 0) - close(ycht->fd); - if (ycht->inpa) - purple_input_remove(ycht->inpa); - - if (ycht->tx_handler) - purple_input_remove(ycht->tx_handler); - - purple_circ_buffer_destroy(ycht->txbuf); - - g_free(ycht->rxqueue); - - g_free(ycht); -} - -static void ycht_connection_error(YchtConn *ycht, const gchar *error) -{ - - purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server"), error); - ycht_connection_close(ycht); -} - -static void ycht_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - YchtConn *ycht = data; - char buf[1024]; - int len; - - len = read(ycht->fd, buf, sizeof(buf)); - - if (len < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - ycht_connection_error(ycht, tmp); - g_free(tmp); - return; - } else if (len == 0) { - ycht_connection_error(ycht, _("Server closed the connection")); - return; - } - - ycht->rxqueue = g_realloc(ycht->rxqueue, len + ycht->rxlen); - memcpy(ycht->rxqueue + ycht->rxlen, buf, len); - ycht->rxlen += len; - - while (1) { - YchtPkt *pkt; - int pos = 0; - int pktlen; - guint service; - guint version; - gint status; - - if (ycht->rxlen < YCHT_HEADER_LEN) - return; - - if (strncmp("YCHT", (char *)ycht->rxqueue, 4) != 0) - purple_debug_error("yahoo", "YCHT: protocol error.\n"); - - pos += 4; /* YCHT */ - - version = yahoo_get32(ycht->rxqueue + pos); pos += 4; - service = yahoo_get32(ycht->rxqueue + pos); pos += 4; - status = yahoo_get16(ycht->rxqueue + pos); pos += 2; - pktlen = yahoo_get16(ycht->rxqueue + pos); pos += 2; - purple_debug_misc("yahoo", "ycht: %d bytes to read, rxlen is %d\n", - pktlen, ycht->rxlen); - - if (ycht->rxlen < (YCHT_HEADER_LEN + pktlen)) - return; - - purple_debug_misc("yahoo", "--==Incoming YCHT packet==--\n"); - purple_debug_misc("yahoo", "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n", - service, version, status); - ycht_packet_dump(ycht->rxqueue, YCHT_HEADER_LEN + pktlen); - - pkt = ycht_packet_new(version, service, status); - ycht_packet_read(pkt, (char *)ycht->rxqueue + pos, pktlen); - - ycht->rxlen -= YCHT_HEADER_LEN + pktlen; - if (ycht->rxlen) { - guchar *tmp = g_memdup(ycht->rxqueue + YCHT_HEADER_LEN + pktlen, ycht->rxlen); - g_free(ycht->rxqueue); - ycht->rxqueue = tmp; - } else { - g_free(ycht->rxqueue); - ycht->rxqueue = NULL; - } - - ycht_packet_process(ycht, pkt); - - ycht_packet_free(pkt); - } -} - -static void ycht_got_connected(gpointer data, gint source, const gchar *error_message) -{ - YchtConn *ycht = data; - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - YchtPkt *pkt; - char *buf; - - if (source < 0) { - ycht_connection_error(ycht, _("Unable to connect")); - return; - } - - ycht->fd = source; - - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_LOGIN, 0); - - buf = g_strdup_printf("%s\001Y=%s; T=%s", purple_connection_get_display_name(gc), yd->cookie_y, yd->cookie_t); - ycht_packet_append(pkt, buf); - g_free(buf); - - ycht_packet_send(ycht, pkt); - - ycht_packet_free(pkt); - - ycht->inpa = purple_input_add(ycht->fd, PURPLE_INPUT_READ, ycht_pending, ycht); -} - -void ycht_connection_open(PurpleConnection *gc) -{ - YchtConn *ycht; - YahooData *yd = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - - ycht = g_new0(YchtConn, 1); - ycht->gc = gc; - ycht->fd = -1; - - yd->ycht = ycht; - - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST), - purple_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT), - ycht_got_connected, ycht) == NULL) - { - ycht_connection_error(ycht, _("Unable to connect")); - return; - } -} - -/******************************************************************************************* - * These are functions called because the user did something. - *******************************************************************************************/ - -void ycht_chat_join(YchtConn *ycht, const char *room) -{ - YchtPkt *pkt; - char *tmp; - - tmp = g_strdup(room); - g_free(ycht->room); - ycht->room = tmp; - - if (!ycht->logged_in) - return; - - ycht->changing_rooms = TRUE; - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATJOIN, 0); - ycht_packet_append(pkt, ycht->room); - ycht_packet_send(ycht, pkt); - ycht_packet_free(pkt); -} - -int ycht_chat_send(YchtConn *ycht, const char *room, const char *what) -{ - YchtPkt *pkt; - char *msg1, *msg2, *buf; - - if (strcmp(room, ycht->room)) - purple_debug_warning("yahoo", "uhoh, sending to the wrong room!\n"); - - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATMSG, 0); - - msg1 = yahoo_html_to_codes(what); - msg2 = yahoo_string_encode(ycht->gc, msg1, NULL); - g_free(msg1); - - buf = g_strdup_printf("%s\001%s", ycht->room, msg2); - ycht_packet_append(pkt, buf); - g_free(msg2); - g_free(buf); - - ycht_packet_send(ycht, pkt); - ycht_packet_free(pkt); - return 1; -} - -void ycht_chat_leave(YchtConn *ycht, const char *room, gboolean logout) -{ - if (logout) - ycht_connection_close(ycht); -} - -void ycht_chat_send_invite(YchtConn *ycht, const char *room, const char *buddy, const char *msg) -{ -} - -void ycht_chat_goto_user(YchtConn *ycht, const char *name) -{ -} - -void ycht_chat_send_keepalive(YchtConn *ycht) -{ - YchtPkt *pkt; - - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_PING, 0); - ycht_packet_send(ycht, pkt); - ycht_packet_free(pkt); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/yahoo/ycht.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/** - * @file ycht.h The Yahoo! protocol plugin, YCHT protocol stuff. - * - * purple - * - * Copyright (C) 2004 Timothy Ringenbach - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_YCHT_H_ -#define _PURPLE_YCHT_H_ - -/* #define YAHOO_YCHT_DEBUG */ - -#define YAHOO_YCHT_HOST "jcs3.chat.dcn.yahoo.com" -#define YAHOO_YCHT_PORT 8002 - -#define YCHT_VERSION (0xae) -#define YCHT_HEADER_LEN (0x10) - -typedef enum { - YCHT_SERVICE_LOGIN = 0x01, - YCHT_SERVICE_LOGOUT = 0x02, - YCHT_SERVICE_CHATJOIN = 0x11, - YCHT_SERVICE_CHATPART = 0x12, - YCHT_SERVICE_CHATMSG = 0x41, - YCHT_SERVICE_CHATMSG_EMOTE = 0x43, - YCHT_SERVICE_PING = 0x62, - YCHT_SERVICE_ONLINE_FRIENDS = 0x68 -} ycht_service; -/* -yahoo: YCHT Service: 0x11 Version: 0x100 -yahoo: Data[0]: Linux, FreeBSD, Solaris:1 -yahoo: Data[1]: Questions, problems and discussions about all flavors of Unix. -yahoo: Data[2]: -yahoo: Data[3]: 0 -yahoo: Data[4]: sgooki888\0020\002 \0022769036\00258936\002 -yahoo: --==End of incoming YCHT packet==-- - -yahoo: --==Incoming YCHT packet==-- -yahoo: YCHT Service: 0x12 Version: 0x100 -yahoo: Data[0]: Linux, FreeBSD, Solaris:1 -yahoo: Data[1]: cccc4cccc -yahoo: --==End of incoming YCHT packet==-- - -*/ -#define YCHT_SEP "\xc0\x80" - -typedef struct _YchtConn { - PurpleConnection *gc; - gchar *room; - int room_id; - gint fd; - gint inpa; - gboolean logged_in; - gboolean changing_rooms; - guchar *rxqueue; - guint rxlen; - PurpleCircBuffer *txbuf; - guint tx_handler; -} YchtConn; - -typedef struct { - guint version; - guint service; - gint status; - GList *data; -} YchtPkt; - -void ycht_connection_open(PurpleConnection *gc); -void ycht_connection_close(YchtConn *ycht); - -void ycht_chat_join(YchtConn *ycht, const char *room); -int ycht_chat_send(YchtConn *ycht, const char *room, const char *what); -void ycht_chat_leave(YchtConn *ycht, const char *room, gboolean logout); -void ycht_chat_send_invite(YchtConn *ycht, const char *room, const char *buddy, const char *msg); -void ycht_chat_goto_user(YchtConn *ycht, const char *name); -void ycht_chat_send_keepalive(YchtConn *ycht); - -#endif /* _PURPLE_YCHT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/com_err.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/com_err.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/com_err.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/com_err.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - * Header file for common error description library. - * - * Copyright 1988, Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright and distribution info, see the documentation supplied - * with this package. - */ - -#ifndef __COM_ERR_H -#define __COM_ERR_H - -#define COM_ERR_BUF_LEN 25 - -/* Use __STDC__ to guess whether we can use stdarg, prototypes, and const. - * This is a public header file, so autoconf can't help us here. */ -#ifdef __STDC__ -# include -# define ETP(x) x -# define ETCONST const -#else -# define ETP(x) () -# define ETCONST -#endif - -typedef void (*error_handler_t) ETP((ETCONST char *, long, ETCONST char *, - va_list)); -extern error_handler_t com_err_hook; -void com_err ETP((ETCONST char *, long, ETCONST char *, ...)); -ETCONST char *error_message ETP((long)); -ETCONST char *error_message_r ETP((long, char *)); -error_handler_t set_com_err_hook ETP((error_handler_t)); -error_handler_t reset_com_err_hook ETP((void)); - -#undef ETP - -#endif /* ! defined(__COM_ERR_H) */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_message.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_message.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_message.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_message.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright 1987 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * For copyright info, see "mit-sipb-copyright.h". - */ - -#include "error_table.h" -#include "com_err.h" -#include - -char *error_table_name_r __P((int, char *)); - -struct et_list * _et_list = (struct et_list *) NULL; - -const char * error_message (code) -long code; -{ - static char buf[COM_ERR_BUF_LEN]; - - return(error_message_r(code, buf)); -} - -const char * error_message_r (code, buf) -long code; -char *buf; -{ - int offset; - struct et_list *et; - int table_num; - int started = 0; - char *cp, namebuf[6]; - - offset = code & ((1<next) { - if (et->table->base == table_num) { - /* This is the right table */ - if (et->table->n_msgs <= offset) - break; - return(et->table->msgs[offset]); - } - } - - strcpy (buf, "Unknown code "); - if (table_num) { - strcat (buf, error_table_name_r (table_num, namebuf)); - strcat (buf, " "); - } - for (cp = buf; *cp; cp++) - ; - if (offset >= 100) { - *cp++ = '0' + offset / 100; - offset %= 100; - started++; - } - if (started || offset >= 10) { - *cp++ = '0' + offset / 10; - offset %= 10; - } - *cp++ = '0' + offset; - *cp = '\0'; - return(buf); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_table.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_table.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_table.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/error_table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright 1988 by the Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#ifndef _ET_H -struct error_table { - char const * const * msgs; - long base; - int n_msgs; -}; -struct et_list { - struct et_list *next; - const struct error_table *table; -}; -extern struct et_list * _et_list; - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - -const char *error_table_name(void); -#define _ET_H -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/et_name.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/et_name.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/et_name.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/et_name.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 1987 by MIT Student Information Processing Board - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include - - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - - -static const char char_set[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; - -/* Prototypes for -Wmissing-prototypes */ -const char * error_table_name(int num); -const char * error_table_name_r(int num, char *buf); - -const char * error_table_name_r(int num, char *buf) -{ - int ch; - int i; - char *p; - - /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ - p = buf; - num >>= ERRCODE_RANGE; - /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */ - num &= 077777777; - /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */ - for (i = 4; i >= 0; i--) { - ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1); - if (ch != 0) - *p++ = char_set[ch-1]; - } - *p = '\0'; - return(buf); -} - -const char * error_table_name(int num) -{ - static char buf[6]; - - return(error_table_name_r(num, buf)); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/init_et.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/init_et.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/init_et.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/init_et.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -/* - * Copyright 1986, 1987, 1988 by MIT Information Systems and - * the MIT Student Information Processing Board. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include - -extern struct et_list * _et_list; - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -#ifndef __INTERNAL_H__ -#define __INTERNAL_H__ - -#include - -#ifdef LIBZEPHYR_EXT -#include -#else -#include -#endif - -#ifndef WIN32 -#include -#endif - - - -#ifdef WIN32 - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 512 -#endif - -#define ETIMEDOUT WSAETIMEDOUT -#define EADDRINUSE WSAEADDRINUSE -#else /* !WIN32 */ - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 4096 -#endif - -#endif - -#ifdef ZEPHYR_USES_HESIOD -#include -#endif - -#ifndef ZEPHYR_USES_KERBEROS -#define REALM_SZ MAXHOSTNAMELEN -#define INST_SZ 0 /* no instances w/o Kerberos */ -#define ANAME_SZ 9 /* size of a username + null */ -#define CLOCK_SKEW 300 /* max time to cache packet ids */ -#endif - -#define SERVER_SVC_FALLBACK htons((unsigned short) 2103) -#define HM_SVC_FALLBACK htons((unsigned short) 2104) -#define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105) - -#define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */ -#define ZAUTH_UNSET (-3) /* Internal to client library. */ -#define Z_MAXFRAGS 500 /* Max number of packet fragments */ -#define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */ -#define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */ -#define Z_FRAGFUDGE 13 /* Room to for multinotice field */ -#define Z_NOTICETIMELIMIT 30 /* Time to wait for fragments */ -#define Z_INITFILTERSIZE 30 /* Starting size of uid filter */ - -struct _Z_Hole { - struct _Z_Hole *next; - int first; - int last; -}; - -struct _Z_InputQ { - struct _Z_InputQ *next; - struct _Z_InputQ *prev; - ZNotice_Kind_t kind; - unsigned ZEPHYR_INT32 timep; - int packet_len; - char *packet; - int complete; - struct sockaddr_in from; - struct _Z_Hole *holelist; - ZUnique_Id_t uid; - int auth; - int header_len; - char *header; - int msg_len; - char *msg; -}; - -extern struct _Z_InputQ *__Q_Head, *__Q_Tail; - -extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */ -extern int __HM_set; /* 0 if dest addr set, 1 otherwise */ -extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */ - -extern ZLocations_t *__locate_list; -extern int __locate_num; -extern int __locate_next; - -extern ZSubscription_t *__subscriptions_list; -extern int __subscriptions_num; -extern int __subscriptions_next; - -extern int __Zephyr_port; /* Port number */ -extern struct in_addr __My_addr; - -typedef Code_t (*Z_SendProc) __P((ZNotice_t *, char *, int, int)); - -struct _Z_InputQ *Z_GetFirstComplete __P((void)); -struct _Z_InputQ *Z_GetNextComplete __P((struct _Z_InputQ *)); -Code_t Z_XmitFragment __P((ZNotice_t*, char *,int,int)); -void Z_RemQueue __P((struct _Z_InputQ *)); -Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int)); -Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); -Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); -Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, int, - int*, char **, char **)); -Code_t Z_ReadEnqueue __P((void)); -Code_t Z_ReadWait __P((void)); -Code_t Z_SendLocation __P((char*, char*, Z_AuthProc, char*)); -Code_t Z_SendFragmentedNotice __P((ZNotice_t *notice, int len, - Z_AuthProc cert_func, - Z_SendProc send_func)); -Code_t Z_WaitForComplete __P((void)); -Code_t Z_WaitForNotice __P((ZNotice_t *notice, - int (*pred) __P((ZNotice_t *, void *)), void *arg, - int timeout)); - -#endif /* __INTERNAL_H__ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -ZEPHYRSOURCES = \ - ZAsyncLocate.c \ - ZCkAuth.c \ - ZCkIfNot.c \ - ZClosePort.c \ - ZCmpUID.c \ - ZCmpUIDP.c \ - ZFlsLocs.c \ - ZFlsSubs.c \ - ZFmtAuth.c \ - ZFmtList.c \ - ZFmtNotice.c \ - ZFmtRaw.c \ - ZFmtRawLst.c \ - ZFmtSmRLst.c \ - ZFmtSmRaw.c \ - ZFreeNot.c \ - ZGetLocs.c \ - ZGetSender.c \ - ZGetSubs.c \ - ZGetWGPort.c \ - ZIfNotice.c \ - ZInit.c \ - ZLocations.c \ - ZMakeAscii.c \ - ZMkAuth.c \ - ZNewLocU.c \ - ZOpenPort.c \ - ZParseNot.c \ - ZPeekIfNot.c \ - ZPeekNot.c \ - ZPeekPkt.c \ - ZPending.c \ - ZReadAscii.c \ - ZRecvNot.c \ - ZRecvPkt.c \ - ZRetSubs.c \ - ZSendList.c \ - ZSendNot.c \ - ZSendPkt.c \ - ZSendRLst.c \ - ZSendRaw.c \ - ZSetDest.c \ - ZSetFD.c \ - ZSetSrv.c \ - ZSubs.c \ - ZVariables.c \ - ZWait4Not.c \ - ZhmStat.c \ - Zinternal.c \ - com_err.h \ - error_message.c \ - error_table.h \ - et_name.c \ - init_et.c \ - internal.h \ - mit-copyright.h \ - mit-sipb-copyright.h \ - sysdep.h \ - zephyr_err.c \ - zephyr_err.h \ - zephyr_internal.h \ - zephyr.c - -ZEPHYRSOURCESEXT = zephyr.c - -AM_CFLAGS = $(st) - -ZEPHYRLIBS = $(KRB4_LDFLAGS) $(KRB4_LIBS) - -ZEPHYRLIBSEXT = $(ZEPHYR_LDFLAGS) $(ZEPHYR_LIBS) - -libzephyr_la_LDFLAGS = -module -avoid-version - -if STATIC_ZEPHYR - -st = -DPURPLE_STATIC_PRPL -Dlint -noinst_LTLIBRARIES = libzephyr.la -libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -libzephyr_la_CFLAGS = $(AM_CFLAGS) -libzephyr_la_LIBADD = $(ZEPHYRLIBS) - -else - -st = -Dlint -pkg_LTLIBRARIES = libzephyr.la - -if EXTERNAL_LIBZEPHYR -libzephyr_la_SOURCES = $(ZEPHYRSOURCESEXT) -libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBSEXT) -else -libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBS) -endif - - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/libpurple/protocols \ - -DCONFDIR=\"$(sysconfdir)\" \ - $(GLIB_CFLAGS) \ - $(KRB4_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1274 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/zephyr -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@libzephyr_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@ $(am__DEPENDENCIES_2) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@libzephyr_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@ $(am__DEPENDENCIES_2) -@STATIC_ZEPHYR_TRUE@libzephyr_la_DEPENDENCIES = $(am__DEPENDENCIES_2) -am__libzephyr_la_SOURCES_DIST = ZAsyncLocate.c ZCkAuth.c ZCkIfNot.c \ - ZClosePort.c ZCmpUID.c ZCmpUIDP.c ZFlsLocs.c ZFlsSubs.c \ - ZFmtAuth.c ZFmtList.c ZFmtNotice.c ZFmtRaw.c ZFmtRawLst.c \ - ZFmtSmRLst.c ZFmtSmRaw.c ZFreeNot.c ZGetLocs.c ZGetSender.c \ - ZGetSubs.c ZGetWGPort.c ZIfNotice.c ZInit.c ZLocations.c \ - ZMakeAscii.c ZMkAuth.c ZNewLocU.c ZOpenPort.c ZParseNot.c \ - ZPeekIfNot.c ZPeekNot.c ZPeekPkt.c ZPending.c ZReadAscii.c \ - ZRecvNot.c ZRecvPkt.c ZRetSubs.c ZSendList.c ZSendNot.c \ - ZSendPkt.c ZSendRLst.c ZSendRaw.c ZSetDest.c ZSetFD.c \ - ZSetSrv.c ZSubs.c ZVariables.c ZWait4Not.c ZhmStat.c \ - Zinternal.c com_err.h error_message.c error_table.h et_name.c \ - init_et.c internal.h mit-copyright.h mit-sipb-copyright.h \ - sysdep.h zephyr_err.c zephyr_err.h zephyr_internal.h zephyr.c -am__objects_1 = libzephyr_la-ZAsyncLocate.lo libzephyr_la-ZCkAuth.lo \ - libzephyr_la-ZCkIfNot.lo libzephyr_la-ZClosePort.lo \ - libzephyr_la-ZCmpUID.lo libzephyr_la-ZCmpUIDP.lo \ - libzephyr_la-ZFlsLocs.lo libzephyr_la-ZFlsSubs.lo \ - libzephyr_la-ZFmtAuth.lo libzephyr_la-ZFmtList.lo \ - libzephyr_la-ZFmtNotice.lo libzephyr_la-ZFmtRaw.lo \ - libzephyr_la-ZFmtRawLst.lo libzephyr_la-ZFmtSmRLst.lo \ - libzephyr_la-ZFmtSmRaw.lo libzephyr_la-ZFreeNot.lo \ - libzephyr_la-ZGetLocs.lo libzephyr_la-ZGetSender.lo \ - libzephyr_la-ZGetSubs.lo libzephyr_la-ZGetWGPort.lo \ - libzephyr_la-ZIfNotice.lo libzephyr_la-ZInit.lo \ - libzephyr_la-ZLocations.lo libzephyr_la-ZMakeAscii.lo \ - libzephyr_la-ZMkAuth.lo libzephyr_la-ZNewLocU.lo \ - libzephyr_la-ZOpenPort.lo libzephyr_la-ZParseNot.lo \ - libzephyr_la-ZPeekIfNot.lo libzephyr_la-ZPeekNot.lo \ - libzephyr_la-ZPeekPkt.lo libzephyr_la-ZPending.lo \ - libzephyr_la-ZReadAscii.lo libzephyr_la-ZRecvNot.lo \ - libzephyr_la-ZRecvPkt.lo libzephyr_la-ZRetSubs.lo \ - libzephyr_la-ZSendList.lo libzephyr_la-ZSendNot.lo \ - libzephyr_la-ZSendPkt.lo libzephyr_la-ZSendRLst.lo \ - libzephyr_la-ZSendRaw.lo libzephyr_la-ZSetDest.lo \ - libzephyr_la-ZSetFD.lo libzephyr_la-ZSetSrv.lo \ - libzephyr_la-ZSubs.lo libzephyr_la-ZVariables.lo \ - libzephyr_la-ZWait4Not.lo libzephyr_la-ZhmStat.lo \ - libzephyr_la-Zinternal.lo libzephyr_la-error_message.lo \ - libzephyr_la-et_name.lo libzephyr_la-init_et.lo \ - libzephyr_la-zephyr_err.lo libzephyr_la-zephyr.lo -am__objects_2 = libzephyr_la-zephyr.lo -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@am_libzephyr_la_OBJECTS = $(am__objects_1) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@am_libzephyr_la_OBJECTS = $(am__objects_2) -@STATIC_ZEPHYR_TRUE@am_libzephyr_la_OBJECTS = $(am__objects_1) -libzephyr_la_OBJECTS = $(am_libzephyr_la_OBJECTS) -@STATIC_ZEPHYR_FALSE@am_libzephyr_la_rpath = -rpath $(pkgdir) -@STATIC_ZEPHYR_TRUE@am_libzephyr_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libzephyr_la_SOURCES) -DIST_SOURCES = $(am__libzephyr_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -ZEPHYRSOURCES = \ - ZAsyncLocate.c \ - ZCkAuth.c \ - ZCkIfNot.c \ - ZClosePort.c \ - ZCmpUID.c \ - ZCmpUIDP.c \ - ZFlsLocs.c \ - ZFlsSubs.c \ - ZFmtAuth.c \ - ZFmtList.c \ - ZFmtNotice.c \ - ZFmtRaw.c \ - ZFmtRawLst.c \ - ZFmtSmRLst.c \ - ZFmtSmRaw.c \ - ZFreeNot.c \ - ZGetLocs.c \ - ZGetSender.c \ - ZGetSubs.c \ - ZGetWGPort.c \ - ZIfNotice.c \ - ZInit.c \ - ZLocations.c \ - ZMakeAscii.c \ - ZMkAuth.c \ - ZNewLocU.c \ - ZOpenPort.c \ - ZParseNot.c \ - ZPeekIfNot.c \ - ZPeekNot.c \ - ZPeekPkt.c \ - ZPending.c \ - ZReadAscii.c \ - ZRecvNot.c \ - ZRecvPkt.c \ - ZRetSubs.c \ - ZSendList.c \ - ZSendNot.c \ - ZSendPkt.c \ - ZSendRLst.c \ - ZSendRaw.c \ - ZSetDest.c \ - ZSetFD.c \ - ZSetSrv.c \ - ZSubs.c \ - ZVariables.c \ - ZWait4Not.c \ - ZhmStat.c \ - Zinternal.c \ - com_err.h \ - error_message.c \ - error_table.h \ - et_name.c \ - init_et.c \ - internal.h \ - mit-copyright.h \ - mit-sipb-copyright.h \ - sysdep.h \ - zephyr_err.c \ - zephyr_err.h \ - zephyr_internal.h \ - zephyr.c - -ZEPHYRSOURCESEXT = zephyr.c -AM_CFLAGS = $(st) -ZEPHYRLIBS = $(KRB4_LDFLAGS) $(KRB4_LIBS) -ZEPHYRLIBSEXT = $(ZEPHYR_LDFLAGS) $(ZEPHYR_LIBS) -libzephyr_la_LDFLAGS = -module -avoid-version -@STATIC_ZEPHYR_FALSE@st = -Dlint -@STATIC_ZEPHYR_TRUE@st = -DPURPLE_STATIC_PRPL -Dlint -@STATIC_ZEPHYR_TRUE@noinst_LTLIBRARIES = libzephyr.la -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@libzephyr_la_SOURCES = $(ZEPHYRSOURCESEXT) -@STATIC_ZEPHYR_TRUE@libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -@STATIC_ZEPHYR_TRUE@libzephyr_la_CFLAGS = $(AM_CFLAGS) -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBS) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBSEXT) -@STATIC_ZEPHYR_TRUE@libzephyr_la_LIBADD = $(ZEPHYRLIBS) -@STATIC_ZEPHYR_FALSE@pkg_LTLIBRARIES = libzephyr.la -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/libpurple/protocols \ - -DCONFDIR=\"$(sysconfdir)\" \ - $(GLIB_CFLAGS) \ - $(KRB4_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/zephyr/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/zephyr/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libzephyr.la: $(libzephyr_la_OBJECTS) $(libzephyr_la_DEPENDENCIES) - $(LINK) $(am_libzephyr_la_rpath) $(libzephyr_la_LDFLAGS) $(libzephyr_la_OBJECTS) $(libzephyr_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZAsyncLocate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCkAuth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCkIfNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZClosePort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCmpUID.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCmpUIDP.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFlsLocs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFlsSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtAuth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtList.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtNotice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtRaw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtRawLst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFreeNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetLocs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetSender.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetWGPort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZIfNotice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZInit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZLocations.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZMakeAscii.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZMkAuth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZNewLocU.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZOpenPort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZParseNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPeekIfNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPeekNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPeekPkt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPending.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZReadAscii.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZRecvNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZRecvPkt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZRetSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendList.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendPkt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendRLst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendRaw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSetDest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSetFD.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSetSrv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZVariables.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZWait4Not.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZhmStat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-Zinternal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-error_message.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-et_name.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-init_et.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-zephyr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-zephyr_err.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libzephyr_la-ZAsyncLocate.lo: ZAsyncLocate.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZAsyncLocate.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Tpo" -c -o libzephyr_la-ZAsyncLocate.lo `test -f 'ZAsyncLocate.c' || echo '$(srcdir)/'`ZAsyncLocate.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Tpo" "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZAsyncLocate.c' object='libzephyr_la-ZAsyncLocate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZAsyncLocate.lo `test -f 'ZAsyncLocate.c' || echo '$(srcdir)/'`ZAsyncLocate.c - -libzephyr_la-ZCkAuth.lo: ZCkAuth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCkAuth.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCkAuth.Tpo" -c -o libzephyr_la-ZCkAuth.lo `test -f 'ZCkAuth.c' || echo '$(srcdir)/'`ZCkAuth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCkAuth.Tpo" "$(DEPDIR)/libzephyr_la-ZCkAuth.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCkAuth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCkAuth.c' object='libzephyr_la-ZCkAuth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCkAuth.lo `test -f 'ZCkAuth.c' || echo '$(srcdir)/'`ZCkAuth.c - -libzephyr_la-ZCkIfNot.lo: ZCkIfNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCkIfNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCkIfNot.Tpo" -c -o libzephyr_la-ZCkIfNot.lo `test -f 'ZCkIfNot.c' || echo '$(srcdir)/'`ZCkIfNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCkIfNot.Tpo" "$(DEPDIR)/libzephyr_la-ZCkIfNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCkIfNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCkIfNot.c' object='libzephyr_la-ZCkIfNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCkIfNot.lo `test -f 'ZCkIfNot.c' || echo '$(srcdir)/'`ZCkIfNot.c - -libzephyr_la-ZClosePort.lo: ZClosePort.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZClosePort.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZClosePort.Tpo" -c -o libzephyr_la-ZClosePort.lo `test -f 'ZClosePort.c' || echo '$(srcdir)/'`ZClosePort.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZClosePort.Tpo" "$(DEPDIR)/libzephyr_la-ZClosePort.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZClosePort.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZClosePort.c' object='libzephyr_la-ZClosePort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZClosePort.lo `test -f 'ZClosePort.c' || echo '$(srcdir)/'`ZClosePort.c - -libzephyr_la-ZCmpUID.lo: ZCmpUID.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCmpUID.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCmpUID.Tpo" -c -o libzephyr_la-ZCmpUID.lo `test -f 'ZCmpUID.c' || echo '$(srcdir)/'`ZCmpUID.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCmpUID.Tpo" "$(DEPDIR)/libzephyr_la-ZCmpUID.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCmpUID.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCmpUID.c' object='libzephyr_la-ZCmpUID.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCmpUID.lo `test -f 'ZCmpUID.c' || echo '$(srcdir)/'`ZCmpUID.c - -libzephyr_la-ZCmpUIDP.lo: ZCmpUIDP.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCmpUIDP.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Tpo" -c -o libzephyr_la-ZCmpUIDP.lo `test -f 'ZCmpUIDP.c' || echo '$(srcdir)/'`ZCmpUIDP.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Tpo" "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCmpUIDP.c' object='libzephyr_la-ZCmpUIDP.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCmpUIDP.lo `test -f 'ZCmpUIDP.c' || echo '$(srcdir)/'`ZCmpUIDP.c - -libzephyr_la-ZFlsLocs.lo: ZFlsLocs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFlsLocs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFlsLocs.Tpo" -c -o libzephyr_la-ZFlsLocs.lo `test -f 'ZFlsLocs.c' || echo '$(srcdir)/'`ZFlsLocs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFlsLocs.Tpo" "$(DEPDIR)/libzephyr_la-ZFlsLocs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFlsLocs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFlsLocs.c' object='libzephyr_la-ZFlsLocs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFlsLocs.lo `test -f 'ZFlsLocs.c' || echo '$(srcdir)/'`ZFlsLocs.c - -libzephyr_la-ZFlsSubs.lo: ZFlsSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFlsSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFlsSubs.Tpo" -c -o libzephyr_la-ZFlsSubs.lo `test -f 'ZFlsSubs.c' || echo '$(srcdir)/'`ZFlsSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFlsSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZFlsSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFlsSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFlsSubs.c' object='libzephyr_la-ZFlsSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFlsSubs.lo `test -f 'ZFlsSubs.c' || echo '$(srcdir)/'`ZFlsSubs.c - -libzephyr_la-ZFmtAuth.lo: ZFmtAuth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtAuth.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtAuth.Tpo" -c -o libzephyr_la-ZFmtAuth.lo `test -f 'ZFmtAuth.c' || echo '$(srcdir)/'`ZFmtAuth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtAuth.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtAuth.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtAuth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtAuth.c' object='libzephyr_la-ZFmtAuth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtAuth.lo `test -f 'ZFmtAuth.c' || echo '$(srcdir)/'`ZFmtAuth.c - -libzephyr_la-ZFmtList.lo: ZFmtList.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtList.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtList.Tpo" -c -o libzephyr_la-ZFmtList.lo `test -f 'ZFmtList.c' || echo '$(srcdir)/'`ZFmtList.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtList.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtList.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtList.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtList.c' object='libzephyr_la-ZFmtList.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtList.lo `test -f 'ZFmtList.c' || echo '$(srcdir)/'`ZFmtList.c - -libzephyr_la-ZFmtNotice.lo: ZFmtNotice.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtNotice.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtNotice.Tpo" -c -o libzephyr_la-ZFmtNotice.lo `test -f 'ZFmtNotice.c' || echo '$(srcdir)/'`ZFmtNotice.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtNotice.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtNotice.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtNotice.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtNotice.c' object='libzephyr_la-ZFmtNotice.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtNotice.lo `test -f 'ZFmtNotice.c' || echo '$(srcdir)/'`ZFmtNotice.c - -libzephyr_la-ZFmtRaw.lo: ZFmtRaw.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtRaw.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtRaw.Tpo" -c -o libzephyr_la-ZFmtRaw.lo `test -f 'ZFmtRaw.c' || echo '$(srcdir)/'`ZFmtRaw.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtRaw.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtRaw.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtRaw.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtRaw.c' object='libzephyr_la-ZFmtRaw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtRaw.lo `test -f 'ZFmtRaw.c' || echo '$(srcdir)/'`ZFmtRaw.c - -libzephyr_la-ZFmtRawLst.lo: ZFmtRawLst.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtRawLst.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Tpo" -c -o libzephyr_la-ZFmtRawLst.lo `test -f 'ZFmtRawLst.c' || echo '$(srcdir)/'`ZFmtRawLst.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtRawLst.c' object='libzephyr_la-ZFmtRawLst.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtRawLst.lo `test -f 'ZFmtRawLst.c' || echo '$(srcdir)/'`ZFmtRawLst.c - -libzephyr_la-ZFmtSmRLst.lo: ZFmtSmRLst.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtSmRLst.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Tpo" -c -o libzephyr_la-ZFmtSmRLst.lo `test -f 'ZFmtSmRLst.c' || echo '$(srcdir)/'`ZFmtSmRLst.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtSmRLst.c' object='libzephyr_la-ZFmtSmRLst.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtSmRLst.lo `test -f 'ZFmtSmRLst.c' || echo '$(srcdir)/'`ZFmtSmRLst.c - -libzephyr_la-ZFmtSmRaw.lo: ZFmtSmRaw.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtSmRaw.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Tpo" -c -o libzephyr_la-ZFmtSmRaw.lo `test -f 'ZFmtSmRaw.c' || echo '$(srcdir)/'`ZFmtSmRaw.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtSmRaw.c' object='libzephyr_la-ZFmtSmRaw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtSmRaw.lo `test -f 'ZFmtSmRaw.c' || echo '$(srcdir)/'`ZFmtSmRaw.c - -libzephyr_la-ZFreeNot.lo: ZFreeNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFreeNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFreeNot.Tpo" -c -o libzephyr_la-ZFreeNot.lo `test -f 'ZFreeNot.c' || echo '$(srcdir)/'`ZFreeNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFreeNot.Tpo" "$(DEPDIR)/libzephyr_la-ZFreeNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFreeNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFreeNot.c' object='libzephyr_la-ZFreeNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFreeNot.lo `test -f 'ZFreeNot.c' || echo '$(srcdir)/'`ZFreeNot.c - -libzephyr_la-ZGetLocs.lo: ZGetLocs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetLocs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetLocs.Tpo" -c -o libzephyr_la-ZGetLocs.lo `test -f 'ZGetLocs.c' || echo '$(srcdir)/'`ZGetLocs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetLocs.Tpo" "$(DEPDIR)/libzephyr_la-ZGetLocs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetLocs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetLocs.c' object='libzephyr_la-ZGetLocs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetLocs.lo `test -f 'ZGetLocs.c' || echo '$(srcdir)/'`ZGetLocs.c - -libzephyr_la-ZGetSender.lo: ZGetSender.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetSender.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetSender.Tpo" -c -o libzephyr_la-ZGetSender.lo `test -f 'ZGetSender.c' || echo '$(srcdir)/'`ZGetSender.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetSender.Tpo" "$(DEPDIR)/libzephyr_la-ZGetSender.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetSender.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetSender.c' object='libzephyr_la-ZGetSender.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetSender.lo `test -f 'ZGetSender.c' || echo '$(srcdir)/'`ZGetSender.c - -libzephyr_la-ZGetSubs.lo: ZGetSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetSubs.Tpo" -c -o libzephyr_la-ZGetSubs.lo `test -f 'ZGetSubs.c' || echo '$(srcdir)/'`ZGetSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZGetSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetSubs.c' object='libzephyr_la-ZGetSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetSubs.lo `test -f 'ZGetSubs.c' || echo '$(srcdir)/'`ZGetSubs.c - -libzephyr_la-ZGetWGPort.lo: ZGetWGPort.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetWGPort.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetWGPort.Tpo" -c -o libzephyr_la-ZGetWGPort.lo `test -f 'ZGetWGPort.c' || echo '$(srcdir)/'`ZGetWGPort.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetWGPort.Tpo" "$(DEPDIR)/libzephyr_la-ZGetWGPort.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetWGPort.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetWGPort.c' object='libzephyr_la-ZGetWGPort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetWGPort.lo `test -f 'ZGetWGPort.c' || echo '$(srcdir)/'`ZGetWGPort.c - -libzephyr_la-ZIfNotice.lo: ZIfNotice.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZIfNotice.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZIfNotice.Tpo" -c -o libzephyr_la-ZIfNotice.lo `test -f 'ZIfNotice.c' || echo '$(srcdir)/'`ZIfNotice.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZIfNotice.Tpo" "$(DEPDIR)/libzephyr_la-ZIfNotice.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZIfNotice.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZIfNotice.c' object='libzephyr_la-ZIfNotice.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZIfNotice.lo `test -f 'ZIfNotice.c' || echo '$(srcdir)/'`ZIfNotice.c - -libzephyr_la-ZInit.lo: ZInit.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZInit.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZInit.Tpo" -c -o libzephyr_la-ZInit.lo `test -f 'ZInit.c' || echo '$(srcdir)/'`ZInit.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZInit.Tpo" "$(DEPDIR)/libzephyr_la-ZInit.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZInit.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZInit.c' object='libzephyr_la-ZInit.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZInit.lo `test -f 'ZInit.c' || echo '$(srcdir)/'`ZInit.c - -libzephyr_la-ZLocations.lo: ZLocations.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZLocations.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZLocations.Tpo" -c -o libzephyr_la-ZLocations.lo `test -f 'ZLocations.c' || echo '$(srcdir)/'`ZLocations.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZLocations.Tpo" "$(DEPDIR)/libzephyr_la-ZLocations.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZLocations.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZLocations.c' object='libzephyr_la-ZLocations.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZLocations.lo `test -f 'ZLocations.c' || echo '$(srcdir)/'`ZLocations.c - -libzephyr_la-ZMakeAscii.lo: ZMakeAscii.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZMakeAscii.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZMakeAscii.Tpo" -c -o libzephyr_la-ZMakeAscii.lo `test -f 'ZMakeAscii.c' || echo '$(srcdir)/'`ZMakeAscii.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZMakeAscii.Tpo" "$(DEPDIR)/libzephyr_la-ZMakeAscii.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZMakeAscii.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZMakeAscii.c' object='libzephyr_la-ZMakeAscii.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZMakeAscii.lo `test -f 'ZMakeAscii.c' || echo '$(srcdir)/'`ZMakeAscii.c - -libzephyr_la-ZMkAuth.lo: ZMkAuth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZMkAuth.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZMkAuth.Tpo" -c -o libzephyr_la-ZMkAuth.lo `test -f 'ZMkAuth.c' || echo '$(srcdir)/'`ZMkAuth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZMkAuth.Tpo" "$(DEPDIR)/libzephyr_la-ZMkAuth.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZMkAuth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZMkAuth.c' object='libzephyr_la-ZMkAuth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZMkAuth.lo `test -f 'ZMkAuth.c' || echo '$(srcdir)/'`ZMkAuth.c - -libzephyr_la-ZNewLocU.lo: ZNewLocU.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZNewLocU.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZNewLocU.Tpo" -c -o libzephyr_la-ZNewLocU.lo `test -f 'ZNewLocU.c' || echo '$(srcdir)/'`ZNewLocU.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZNewLocU.Tpo" "$(DEPDIR)/libzephyr_la-ZNewLocU.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZNewLocU.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZNewLocU.c' object='libzephyr_la-ZNewLocU.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZNewLocU.lo `test -f 'ZNewLocU.c' || echo '$(srcdir)/'`ZNewLocU.c - -libzephyr_la-ZOpenPort.lo: ZOpenPort.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZOpenPort.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZOpenPort.Tpo" -c -o libzephyr_la-ZOpenPort.lo `test -f 'ZOpenPort.c' || echo '$(srcdir)/'`ZOpenPort.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZOpenPort.Tpo" "$(DEPDIR)/libzephyr_la-ZOpenPort.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZOpenPort.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZOpenPort.c' object='libzephyr_la-ZOpenPort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZOpenPort.lo `test -f 'ZOpenPort.c' || echo '$(srcdir)/'`ZOpenPort.c - -libzephyr_la-ZParseNot.lo: ZParseNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZParseNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZParseNot.Tpo" -c -o libzephyr_la-ZParseNot.lo `test -f 'ZParseNot.c' || echo '$(srcdir)/'`ZParseNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZParseNot.Tpo" "$(DEPDIR)/libzephyr_la-ZParseNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZParseNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZParseNot.c' object='libzephyr_la-ZParseNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZParseNot.lo `test -f 'ZParseNot.c' || echo '$(srcdir)/'`ZParseNot.c - -libzephyr_la-ZPeekIfNot.lo: ZPeekIfNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPeekIfNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Tpo" -c -o libzephyr_la-ZPeekIfNot.lo `test -f 'ZPeekIfNot.c' || echo '$(srcdir)/'`ZPeekIfNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Tpo" "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPeekIfNot.c' object='libzephyr_la-ZPeekIfNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPeekIfNot.lo `test -f 'ZPeekIfNot.c' || echo '$(srcdir)/'`ZPeekIfNot.c - -libzephyr_la-ZPeekNot.lo: ZPeekNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPeekNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPeekNot.Tpo" -c -o libzephyr_la-ZPeekNot.lo `test -f 'ZPeekNot.c' || echo '$(srcdir)/'`ZPeekNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPeekNot.Tpo" "$(DEPDIR)/libzephyr_la-ZPeekNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPeekNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPeekNot.c' object='libzephyr_la-ZPeekNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPeekNot.lo `test -f 'ZPeekNot.c' || echo '$(srcdir)/'`ZPeekNot.c - -libzephyr_la-ZPeekPkt.lo: ZPeekPkt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPeekPkt.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPeekPkt.Tpo" -c -o libzephyr_la-ZPeekPkt.lo `test -f 'ZPeekPkt.c' || echo '$(srcdir)/'`ZPeekPkt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPeekPkt.Tpo" "$(DEPDIR)/libzephyr_la-ZPeekPkt.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPeekPkt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPeekPkt.c' object='libzephyr_la-ZPeekPkt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPeekPkt.lo `test -f 'ZPeekPkt.c' || echo '$(srcdir)/'`ZPeekPkt.c - -libzephyr_la-ZPending.lo: ZPending.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPending.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPending.Tpo" -c -o libzephyr_la-ZPending.lo `test -f 'ZPending.c' || echo '$(srcdir)/'`ZPending.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPending.Tpo" "$(DEPDIR)/libzephyr_la-ZPending.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPending.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPending.c' object='libzephyr_la-ZPending.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPending.lo `test -f 'ZPending.c' || echo '$(srcdir)/'`ZPending.c - -libzephyr_la-ZReadAscii.lo: ZReadAscii.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZReadAscii.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZReadAscii.Tpo" -c -o libzephyr_la-ZReadAscii.lo `test -f 'ZReadAscii.c' || echo '$(srcdir)/'`ZReadAscii.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZReadAscii.Tpo" "$(DEPDIR)/libzephyr_la-ZReadAscii.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZReadAscii.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZReadAscii.c' object='libzephyr_la-ZReadAscii.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZReadAscii.lo `test -f 'ZReadAscii.c' || echo '$(srcdir)/'`ZReadAscii.c - -libzephyr_la-ZRecvNot.lo: ZRecvNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZRecvNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZRecvNot.Tpo" -c -o libzephyr_la-ZRecvNot.lo `test -f 'ZRecvNot.c' || echo '$(srcdir)/'`ZRecvNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZRecvNot.Tpo" "$(DEPDIR)/libzephyr_la-ZRecvNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZRecvNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZRecvNot.c' object='libzephyr_la-ZRecvNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZRecvNot.lo `test -f 'ZRecvNot.c' || echo '$(srcdir)/'`ZRecvNot.c - -libzephyr_la-ZRecvPkt.lo: ZRecvPkt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZRecvPkt.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZRecvPkt.Tpo" -c -o libzephyr_la-ZRecvPkt.lo `test -f 'ZRecvPkt.c' || echo '$(srcdir)/'`ZRecvPkt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZRecvPkt.Tpo" "$(DEPDIR)/libzephyr_la-ZRecvPkt.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZRecvPkt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZRecvPkt.c' object='libzephyr_la-ZRecvPkt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZRecvPkt.lo `test -f 'ZRecvPkt.c' || echo '$(srcdir)/'`ZRecvPkt.c - -libzephyr_la-ZRetSubs.lo: ZRetSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZRetSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZRetSubs.Tpo" -c -o libzephyr_la-ZRetSubs.lo `test -f 'ZRetSubs.c' || echo '$(srcdir)/'`ZRetSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZRetSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZRetSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZRetSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZRetSubs.c' object='libzephyr_la-ZRetSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZRetSubs.lo `test -f 'ZRetSubs.c' || echo '$(srcdir)/'`ZRetSubs.c - -libzephyr_la-ZSendList.lo: ZSendList.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendList.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendList.Tpo" -c -o libzephyr_la-ZSendList.lo `test -f 'ZSendList.c' || echo '$(srcdir)/'`ZSendList.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendList.Tpo" "$(DEPDIR)/libzephyr_la-ZSendList.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendList.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendList.c' object='libzephyr_la-ZSendList.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendList.lo `test -f 'ZSendList.c' || echo '$(srcdir)/'`ZSendList.c - -libzephyr_la-ZSendNot.lo: ZSendNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendNot.Tpo" -c -o libzephyr_la-ZSendNot.lo `test -f 'ZSendNot.c' || echo '$(srcdir)/'`ZSendNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendNot.Tpo" "$(DEPDIR)/libzephyr_la-ZSendNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendNot.c' object='libzephyr_la-ZSendNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendNot.lo `test -f 'ZSendNot.c' || echo '$(srcdir)/'`ZSendNot.c - -libzephyr_la-ZSendPkt.lo: ZSendPkt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendPkt.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendPkt.Tpo" -c -o libzephyr_la-ZSendPkt.lo `test -f 'ZSendPkt.c' || echo '$(srcdir)/'`ZSendPkt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendPkt.Tpo" "$(DEPDIR)/libzephyr_la-ZSendPkt.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendPkt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendPkt.c' object='libzephyr_la-ZSendPkt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendPkt.lo `test -f 'ZSendPkt.c' || echo '$(srcdir)/'`ZSendPkt.c - -libzephyr_la-ZSendRLst.lo: ZSendRLst.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendRLst.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendRLst.Tpo" -c -o libzephyr_la-ZSendRLst.lo `test -f 'ZSendRLst.c' || echo '$(srcdir)/'`ZSendRLst.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendRLst.Tpo" "$(DEPDIR)/libzephyr_la-ZSendRLst.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendRLst.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendRLst.c' object='libzephyr_la-ZSendRLst.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendRLst.lo `test -f 'ZSendRLst.c' || echo '$(srcdir)/'`ZSendRLst.c - -libzephyr_la-ZSendRaw.lo: ZSendRaw.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendRaw.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendRaw.Tpo" -c -o libzephyr_la-ZSendRaw.lo `test -f 'ZSendRaw.c' || echo '$(srcdir)/'`ZSendRaw.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendRaw.Tpo" "$(DEPDIR)/libzephyr_la-ZSendRaw.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendRaw.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendRaw.c' object='libzephyr_la-ZSendRaw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendRaw.lo `test -f 'ZSendRaw.c' || echo '$(srcdir)/'`ZSendRaw.c - -libzephyr_la-ZSetDest.lo: ZSetDest.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSetDest.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSetDest.Tpo" -c -o libzephyr_la-ZSetDest.lo `test -f 'ZSetDest.c' || echo '$(srcdir)/'`ZSetDest.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSetDest.Tpo" "$(DEPDIR)/libzephyr_la-ZSetDest.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSetDest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSetDest.c' object='libzephyr_la-ZSetDest.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSetDest.lo `test -f 'ZSetDest.c' || echo '$(srcdir)/'`ZSetDest.c - -libzephyr_la-ZSetFD.lo: ZSetFD.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSetFD.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSetFD.Tpo" -c -o libzephyr_la-ZSetFD.lo `test -f 'ZSetFD.c' || echo '$(srcdir)/'`ZSetFD.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSetFD.Tpo" "$(DEPDIR)/libzephyr_la-ZSetFD.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSetFD.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSetFD.c' object='libzephyr_la-ZSetFD.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSetFD.lo `test -f 'ZSetFD.c' || echo '$(srcdir)/'`ZSetFD.c - -libzephyr_la-ZSetSrv.lo: ZSetSrv.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSetSrv.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSetSrv.Tpo" -c -o libzephyr_la-ZSetSrv.lo `test -f 'ZSetSrv.c' || echo '$(srcdir)/'`ZSetSrv.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSetSrv.Tpo" "$(DEPDIR)/libzephyr_la-ZSetSrv.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSetSrv.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSetSrv.c' object='libzephyr_la-ZSetSrv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSetSrv.lo `test -f 'ZSetSrv.c' || echo '$(srcdir)/'`ZSetSrv.c - -libzephyr_la-ZSubs.lo: ZSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSubs.Tpo" -c -o libzephyr_la-ZSubs.lo `test -f 'ZSubs.c' || echo '$(srcdir)/'`ZSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSubs.c' object='libzephyr_la-ZSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSubs.lo `test -f 'ZSubs.c' || echo '$(srcdir)/'`ZSubs.c - -libzephyr_la-ZVariables.lo: ZVariables.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZVariables.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZVariables.Tpo" -c -o libzephyr_la-ZVariables.lo `test -f 'ZVariables.c' || echo '$(srcdir)/'`ZVariables.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZVariables.Tpo" "$(DEPDIR)/libzephyr_la-ZVariables.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZVariables.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZVariables.c' object='libzephyr_la-ZVariables.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZVariables.lo `test -f 'ZVariables.c' || echo '$(srcdir)/'`ZVariables.c - -libzephyr_la-ZWait4Not.lo: ZWait4Not.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZWait4Not.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZWait4Not.Tpo" -c -o libzephyr_la-ZWait4Not.lo `test -f 'ZWait4Not.c' || echo '$(srcdir)/'`ZWait4Not.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZWait4Not.Tpo" "$(DEPDIR)/libzephyr_la-ZWait4Not.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZWait4Not.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZWait4Not.c' object='libzephyr_la-ZWait4Not.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZWait4Not.lo `test -f 'ZWait4Not.c' || echo '$(srcdir)/'`ZWait4Not.c - -libzephyr_la-ZhmStat.lo: ZhmStat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZhmStat.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZhmStat.Tpo" -c -o libzephyr_la-ZhmStat.lo `test -f 'ZhmStat.c' || echo '$(srcdir)/'`ZhmStat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZhmStat.Tpo" "$(DEPDIR)/libzephyr_la-ZhmStat.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZhmStat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZhmStat.c' object='libzephyr_la-ZhmStat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZhmStat.lo `test -f 'ZhmStat.c' || echo '$(srcdir)/'`ZhmStat.c - -libzephyr_la-Zinternal.lo: Zinternal.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-Zinternal.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-Zinternal.Tpo" -c -o libzephyr_la-Zinternal.lo `test -f 'Zinternal.c' || echo '$(srcdir)/'`Zinternal.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-Zinternal.Tpo" "$(DEPDIR)/libzephyr_la-Zinternal.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-Zinternal.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Zinternal.c' object='libzephyr_la-Zinternal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-Zinternal.lo `test -f 'Zinternal.c' || echo '$(srcdir)/'`Zinternal.c - -libzephyr_la-error_message.lo: error_message.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-error_message.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-error_message.Tpo" -c -o libzephyr_la-error_message.lo `test -f 'error_message.c' || echo '$(srcdir)/'`error_message.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-error_message.Tpo" "$(DEPDIR)/libzephyr_la-error_message.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-error_message.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error_message.c' object='libzephyr_la-error_message.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-error_message.lo `test -f 'error_message.c' || echo '$(srcdir)/'`error_message.c - -libzephyr_la-et_name.lo: et_name.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-et_name.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-et_name.Tpo" -c -o libzephyr_la-et_name.lo `test -f 'et_name.c' || echo '$(srcdir)/'`et_name.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-et_name.Tpo" "$(DEPDIR)/libzephyr_la-et_name.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-et_name.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='et_name.c' object='libzephyr_la-et_name.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-et_name.lo `test -f 'et_name.c' || echo '$(srcdir)/'`et_name.c - -libzephyr_la-init_et.lo: init_et.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-init_et.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-init_et.Tpo" -c -o libzephyr_la-init_et.lo `test -f 'init_et.c' || echo '$(srcdir)/'`init_et.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-init_et.Tpo" "$(DEPDIR)/libzephyr_la-init_et.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-init_et.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='init_et.c' object='libzephyr_la-init_et.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-init_et.lo `test -f 'init_et.c' || echo '$(srcdir)/'`init_et.c - -libzephyr_la-zephyr_err.lo: zephyr_err.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-zephyr_err.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-zephyr_err.Tpo" -c -o libzephyr_la-zephyr_err.lo `test -f 'zephyr_err.c' || echo '$(srcdir)/'`zephyr_err.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-zephyr_err.Tpo" "$(DEPDIR)/libzephyr_la-zephyr_err.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-zephyr_err.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zephyr_err.c' object='libzephyr_la-zephyr_err.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-zephyr_err.lo `test -f 'zephyr_err.c' || echo '$(srcdir)/'`zephyr_err.c - -libzephyr_la-zephyr.lo: zephyr.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-zephyr.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-zephyr.Tpo" -c -o libzephyr_la-zephyr.lo `test -f 'zephyr.c' || echo '$(srcdir)/'`zephyr.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-zephyr.Tpo" "$(DEPDIR)/libzephyr_la-zephyr.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-zephyr.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zephyr.c' object='libzephyr_la-zephyr.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-zephyr.lo `test -f 'zephyr.c' || echo '$(srcdir)/'`zephyr.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-copyright.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-copyright.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-copyright.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-copyright.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -/* - -Copyright 1987,1988 by the Massachusetts Institute of Technology - -All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the Massachusetts -Institute of Technology (M.I.T.) not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. - -M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-sipb-copyright.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-sipb-copyright.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-sipb-copyright.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/mit-sipb-copyright.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -/* - -Copyright 1987, 1989 by the Student Information Processing Board - of the Massachusetts Institute of Technology - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice -appear in all copies and that both that copyright notice and -this permission notice appear in supporting documentation, -and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. -M.I.T. and the M.I.T. S.I.P.B. make no representations about -the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -*/ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/sysdep.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/sysdep.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/sysdep.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/sysdep.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains system-dependent header code. - * - * Created by: Greg Hudson - * - * Copyright (c) 1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#ifndef __SYSDEP_H__ -#define __SYSDEP_H__ - -#include -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#endif - -#include -#include -#include -#include - -#if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H) -# include -#else -# ifdef HAVE_MALLOC_H -# include -# else -char *malloc(), *realloc(void); -# endif -char *getenv(), *strerror(), *ctime(), *strcpy(void); -time_t time(void); -ZEPHYR_INT32 random(void); -#endif - -#ifndef HAVE_RANDOM -#ifdef HAVE_LRAND48 -#define random lrand48 -#define srandom srand48 -#else -#define random rand -#define srandom srand -#endif -#endif - -#ifndef HAVE_STRERROR -extern char *sys_errlist[]; -# define strerror(x) (sys_errlist[(x)]) -#endif - -/* Strings. */ -#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) -# include -#else -# ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr(), *strrchr(void); -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memcmp bcmp -# endif -# ifndef HAVE_MEMMOVE -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -/* Exit status handling and wait(). */ -#ifdef HAVE_SYS_WAIT_H -# include -#endif -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif - -#ifdef HAVE_SYS_CDEFS_H -#include -#endif - -/* Because we have public header files (and our prototypes need to agree with - * those header files, use __STDC__ to guess whether the compiler can handle - * stdarg, const, and prototypes. */ -#ifdef __STDC__ -# include -# define VA_START(ap, last) va_start(ap, last) -# ifndef __P -# define __P(x) x -# endif -#else -# include -# define VA_START(ap, last) va_start(ap) -# define const -# ifndef __P -# define __P(x) () -# endif -#endif - -/* openlog(). */ -#ifdef LOG_AUTH -/* A decent syslog */ -#define OPENLOG(str, opts, facility) openlog(str, opts, facility) -#else -/* Probably a 4.2-type syslog */ -#define OPENLOG(str, opts, facility) openlog(str, opts) -#endif - -#ifdef HAVE_FCNTL_H -# include -#endif - -#ifdef HAVE_PATHS_H -# include -# define TEMP_DIRECTORY _PATH_VARTMP -#else -# define TEMP_DIRECTORY FOUND_TMP -#endif - -#ifdef HAVE_UNISTD_H -# include -#else -# ifdef HAVE_SYS_FILE_H -# include -# endif -uid_t getuid(void); -char *ttyname(void); -#ifdef HAVE_GETHOSTID -ZEPHYR_INT32 gethostid(void); -#endif -#endif - -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 -#endif - -#ifdef HAVE_TERMIOS_H -# include -#else -# ifdef HAVE_SYS_FILIO_H -# include -# else -# ifdef HAVE_SGTTY_H -# include -# endif -# ifdef HAVE_SYS_IOCTL_H -# include -# endif -# endif -#endif - -/* Kerberos compatibility. */ -#ifdef ZEPHYR_USES_KERBEROS -# include -#ifdef WIN32 - -#else -# include -#endif /* WIN32 */ -# include -#ifndef WIN32 -# ifndef HAVE_KRB_GET_ERR_TEXT -# define krb_get_err_text(n) krb_err_txt[n] -# endif -#endif /* WIN32 */ -# ifndef HAVE_KRB_LOG -# define krb_log log -# endif -#endif /* ZEPHYR_USES_KERBEROS */ - -#ifdef HAVE_SYS_UIO_H -# include -#endif - -#ifdef HAVE_SYS_UTSNAME_H -# include -#endif - -#ifdef HAVE_SYS_SELECT_H -# include -#endif - -#ifdef HAVE_SYS_MSGBUF_H -#include -#endif - -#ifndef MSG_BSIZE -#define MSG_BSIZE BUFSIZ -#endif - -#endif /* __SYSDEP_H__ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZAsyncLocate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZAsyncLocate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZAsyncLocate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZAsyncLocate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for asynchronous location functions. - * - * Created by: Marc Horowitz - * - * Copyright (c) 1990,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZRequestLocations(user, zald, kind, auth) - const char *user; - ZAsyncLocateData_t *zald; - ZNotice_Kind_t kind; /* UNSAFE, UNACKED, or ACKED */ - Z_AuthProc auth; -{ - int retval; - ZNotice_t notice; - - if (ZGetFD() < 0) - if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) - return (retval); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = kind; - notice.z_port = __Zephyr_port; - notice.z_class = LOCATE_CLASS; - notice.z_class_inst = user; - notice.z_opcode = LOCATE_LOCATE; - notice.z_sender = 0; - notice.z_recipient = ""; - notice.z_default_format = ""; - notice.z_message_len = 0; - - if ((retval = ZSendNotice(¬ice, auth)) != ZERR_NONE) - return(retval); - - if ((zald->user = (char *) malloc(strlen(user)+1)) == NULL) { - return(ENOMEM); - } - if ((zald->version = (char *) malloc(strlen(notice.z_version)+1)) == NULL) { - free(zald->user); - return(ENOMEM); - } - zald->uid = notice.z_multiuid; - strcpy(zald->user,user); - strcpy(zald->version,notice.z_version); - - return(ZERR_NONE); -} - -Code_t ZParseLocations(notice,zald,nlocs,user) - ZNotice_t *notice; - ZAsyncLocateData_t *zald; - int *nlocs; - char **user; -{ - char *ptr, *end; - int i; - - ZFlushLocations(); /* This never fails (this function is part of the - library, so it is allowed to know this). */ - - /* non-matching protocol version numbers means the - server is probably an older version--must punt */ - - if (zald && strcmp(notice->z_version, zald->version)) - return(ZERR_VERS); - - if (notice->z_kind == SERVNAK) - return (ZERR_SERVNAK); - - /* flag ACKs as special */ - if (notice->z_kind == SERVACK && - !strcmp(notice->z_opcode, LOCATE_LOCATE)) { - *nlocs = -1; - return(ZERR_NONE); - } - - if (notice->z_kind != ACKED) - return (ZERR_INTERNAL); - - end = notice->z_message+notice->z_message_len; - - __locate_num = 0; - - for (ptr=notice->z_message;ptrz_message, i=0; i<__locate_num; i++) { - unsigned int len; - - len = strlen (ptr) + 1; - __locate_list[i].host = (char *) malloc(len); - if (!__locate_list[i].host) - return (ENOMEM); - (void) strcpy(__locate_list[i].host, ptr); - ptr += len; - - len = strlen (ptr) + 1; - __locate_list[i].time = (char *) malloc(len); - if (!__locate_list[i].time) - return (ENOMEM); - (void) strcpy(__locate_list[i].time, ptr); - ptr += len; - - len = strlen (ptr) + 1; - __locate_list[i].tty = (char *) malloc(len); - if (!__locate_list[i].tty) - return (ENOMEM); - (void) strcpy(__locate_list[i].tty, ptr); - ptr += len; - } - - __locate_next = 0; - *nlocs = __locate_num; - if (user) { - if (zald) { - if ((*user = (char *) malloc(strlen(zald->user)+1)) == NULL) - return(ENOMEM); - strcpy(*user,zald->user); - } else { - if ((*user = (char *) malloc(strlen(notice->z_class_inst)+1)) == NULL) - return(ENOMEM); - strcpy(*user,notice->z_class_inst); - } - } - return (ZERR_NONE); -} - -int ZCompareALDPred(notice, zald) - ZNotice_t *notice; - void *zald; -{ - return(ZCompareUID(&(notice->z_multiuid), - &(((ZAsyncLocateData_t *) zald)->uid))); -} - -void ZFreeALD(zald) - ZAsyncLocateData_t *zald; -{ - if (!zald) return; - - if (zald->user) free(zald->user); - if (zald->version) free(zald->version); - (void) memset(zald, 0, sizeof(*zald)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkAuth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkAuth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkAuth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkAuth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCheckAuthentication function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -/* Check authentication of the notice. - If it looks authentic but fails the Kerberos check, return -1. - If it looks authentic and passes the Kerberos check, return 1. - If it doesn't look authentic, return 0 - - When not using Kerberos, return true if the notice claims to be authentic. - Only used by clients; the server uses its own routine. - */ -Code_t ZCheckAuthentication(notice, from) - ZNotice_t *notice; - struct sockaddr_in *from; -{ -#ifdef ZEPHYR_USES_KERBEROS - int result; - ZChecksum_t our_checksum; - CREDENTIALS cred; - - /* If the value is already known, return it. */ - if (notice->z_checked_auth != ZAUTH_UNSET) - return (notice->z_checked_auth); - - if (!notice->z_auth) - return (ZAUTH_NO); - - if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, - __Zephyr_realm, &cred)) != 0) - return (ZAUTH_NO); - -#ifdef NOENCRYPTION - our_checksum = 0; -#else - our_checksum = des_quad_cksum(notice->z_packet, NULL, - notice->z_default_format+ - strlen(notice->z_default_format)+1- - notice->z_packet, 0, (C_Block *)cred.session); -#endif - /* if mismatched checksum, then the packet was corrupted */ - return ((our_checksum == notice->z_checksum) ? ZAUTH_YES : ZAUTH_FAILED); - -#else - return (notice->z_auth ? ZAUTH_YES : ZAUTH_NO); -#endif -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkIfNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkIfNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkIfNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCkIfNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCheckIfNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZCheckIfNotice(notice, from, predicate, args) - ZNotice_t *notice; - struct sockaddr_in *from; - register int (*predicate) __P((ZNotice_t *, void *)); - void *args; -{ - ZNotice_t tmpnotice; - Code_t retval; - register char *buffer; - register struct _Z_InputQ *qptr; - - if ((retval = Z_ReadEnqueue()) != ZERR_NONE) - return (retval); - - qptr = Z_GetFirstComplete(); - - while (qptr) { - if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, - &tmpnotice)) != ZERR_NONE) - return (retval); - if ((*predicate)(&tmpnotice, args)) { - if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(buffer, qptr->packet, qptr->packet_len); - if (from) - *from = qptr->from; - if ((retval = ZParseNotice(buffer, qptr->packet_len, - notice)) != ZERR_NONE) { - free(buffer); - return (retval); - } - Z_RemQueue(qptr); - return (ZERR_NONE); - } - qptr = Z_GetNextComplete(qptr); - } - - return (ZERR_NONOTICE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZClosePort.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZClosePort.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZClosePort.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZClosePort.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZClosePort function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZClosePort() -{ - if (__Zephyr_fd >= 0 && __Zephyr_open) - (void) close(__Zephyr_fd); - - __Zephyr_fd = -1; - __Zephyr_open = 0; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUID.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUID.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUID.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUID.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCompareUID function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -int ZCompareUID(uid1, uid2) - ZUnique_Id_t *uid1, *uid2; -{ - return (!memcmp((char *)uid1, (char *)uid2, sizeof (*uid1))); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUIDP.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUIDP.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUIDP.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZCmpUIDP.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCompareUIDPred function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -int ZCompareUIDPred(notice, uid) - ZNotice_t *notice; - void *uid; -{ - return (ZCompareUID(¬ice->z_uid, (ZUnique_Id_t *) uid)); -} - -int ZCompareMultiUIDPred(notice, uid) - ZNotice_t *notice; - void *uid; -{ - return (ZCompareUID(¬ice->z_multiuid, (ZUnique_Id_t *) uid)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2986 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * purple - * - * Copyright (C) 1998-2001, Mark Spencer - * Some code borrowed from GtkZephyr, by - * Jag/Sean Dilda / - * http://gtkzephyr.linuxpower.org/ - * - * Some code borrowed from kzephyr, by - * Chris Colohan - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - -*/ -#include "libpurple/internal.h" - -#include "accountopt.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "server.h" -#include "util.h" -#include "cmds.h" -#include "privacy.h" -#include "version.h" - -#include "internal.h" - -#include - -#define ZEPHYR_FALLBACK_CHARSET "ISO-8859-1" - -/* these are deliberately high, since most people don't send multiple "PING"s */ -#define ZEPHYR_TYPING_SEND_TIMEOUT 15 -#define ZEPHYR_TYPING_RECV_TIMEOUT 10 -#define ZEPHYR_FD_READ 0 -#define ZEPHYR_FD_WRITE 1 - -extern Code_t ZGetLocations(ZLocations_t *, int *); -extern Code_t ZSetLocation(char *); -extern Code_t ZUnsetLocation(void); -extern Code_t ZGetSubscriptions(ZSubscription_t *, int*); -extern char __Zephyr_realm[]; -typedef struct _zframe zframe; -typedef struct _zephyr_triple zephyr_triple; -typedef struct _zephyr_account zephyr_account; -typedef struct _parse_tree parse_tree; - -typedef enum { - PURPLE_ZEPHYR_NONE, /* Non-kerberized ZEPH0.2 */ - PURPLE_ZEPHYR_KRB4, /* ZEPH0.2 w/ KRB4 support */ - PURPLE_ZEPHYR_TZC, /* tzc executable proxy */ - PURPLE_ZEPHYR_INTERGALACTIC_KRB4 /* Kerberized ZEPH0.3 */ -} zephyr_connection_type; - -struct _zephyr_account { - PurpleAccount* account; - char *username; - char *realm; - char *encoding; - char* galaxy; /* not yet useful */ - char* krbtkfile; /* not yet useful */ - guint32 nottimer; - guint32 loctimer; - GList *pending_zloc_names; - GSList *subscrips; - int last_id; - unsigned short port; - char ourhost[HOST_NAME_MAX + 1]; - char ourhostcanon[HOST_NAME_MAX + 1]; - zephyr_connection_type connection_type; - int totzc[2]; - int fromtzc[2]; - char *exposure; - pid_t tzc_pid; - gchar *away; -}; - -#define MAXCHILDREN 20 - -struct _parse_tree { - gchar* contents; - parse_tree *children[MAXCHILDREN]; - int num_children; -}; - -parse_tree null_parse_tree = { - "", - {NULL}, - 0, -}; - -#define use_none(zephyr) ((zephyr->connection_type == PURPLE_ZEPHYR_NONE)?1:0) -#define use_krb4(zephyr) ((zephyr->connection_type == PURPLE_ZEPHYR_KRB4)?1:0) -#define use_tzc(zephyr) ((zephyr->connection_type == PURPLE_ZEPHYR_TZC)?1:0) - -#define use_zeph02(zephyr) ( (zephyr->connection_type == PURPLE_ZEPHYR_NONE)?1: ((zephyr->connection_type == PURPLE_ZEPHYR_KRB4)?1:0)) - -/* struct I need for zephyr_to_html */ -struct _zframe { - /* true for everything but @color, since inside the parens of that one is - * the color. */ - gboolean has_closer; - /* @i, @b, etc. */ - const char *env; - /* }=1, ]=2, )=4, >=8 */ - int closer_mask; - /* }, ], ), > */ - char *closer; - /*
, , , etc. */ - const char *closing; - /* text including the opening html thingie. */ - GString *text; - /* href for links */ - gboolean is_href; - GString *href; - struct _zframe *enclosing; -}; - -struct _zephyr_triple { - char *class; - char *instance; - char *recipient; - char *name; - gboolean open; - int id; -}; - -#define z_call(func) if (func != ZERR_NONE)\ - return; -#define z_call_r(func) if (func != ZERR_NONE)\ - return TRUE; - -#define z_call_s(func, err) if (func != ZERR_NONE) {\ - purple_connection_error(gc, err);\ - return;\ - } - -#ifdef WIN32 -extern const char *username; -#endif - -static Code_t zephyr_subscribe_to(zephyr_account* zephyr, char* class, char *instance, char *recipient, char* galaxy) { - size_t result; - Code_t ret_val = -1; - - if (use_tzc(zephyr)) { - /* ((tzcfodder . subscribe) ("class" "instance" "recipient")) */ - gchar *zsubstr = g_strdup_printf("((tzcfodder . subscribe) (\"%s\" \"%s\" \"%s\"))\n",class,instance,recipient); - size_t len = strlen(zsubstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zsubstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write a message: %s\n", g_strerror(errno)); - } else { - ret_val = ZERR_NONE; - } - g_free(zsubstr); - } - else { - if (use_zeph02(zephyr)) { - ZSubscription_t sub; - sub.zsub_class = class; - sub.zsub_classinst = instance; - sub.zsub_recipient = recipient; - ret_val = ZSubscribeTo(&sub,1,0); - } - } - return ret_val; -} - -char *local_zephyr_normalize(zephyr_account* zephyr,const char *); -static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *topic); -char* zephyr_tzc_deescape_str(const char *message); - -static char *zephyr_strip_local_realm(zephyr_account* zephyr,const char* user){ - /* - Takes in a username of the form username or username@realm - and returns: - username, if there is no realm, or the realm is the local realm - or: - username@realm if there is a realm and it is foreign - */ - char *tmp = g_strdup(user); - char *at = strchr(tmp,'@'); - if (at && !g_ascii_strcasecmp(at+1,zephyr->realm)) { - /* We're passed in a username of the form user@users-realm */ - char* tmp2; - *at = '\0'; - tmp2 = g_strdup(tmp); - g_free(tmp); - return tmp2; - } - else { - /* We're passed in a username of the form user or user@foreign-realm */ - return tmp; - } -} - -/* this is so bad, and if Zephyr weren't so fucked up to begin with I - * wouldn't do this. but it is so i will. */ - -/* just for debugging */ -static void handle_unknown(ZNotice_t notice) -{ - purple_debug_error("zephyr","z_packet: %s\n", notice.z_packet); - purple_debug_error("zephyr","z_version: %s\n", notice.z_version); - purple_debug_error("zephyr","z_kind: %d\n", (int)(notice.z_kind)); - purple_debug_error("zephyr","z_class: %s\n", notice.z_class); - purple_debug_error("zephyr","z_class_inst: %s\n", notice.z_class_inst); - purple_debug_error("zephyr","z_opcode: %s\n", notice.z_opcode); - purple_debug_error("zephyr","z_sender: %s\n", notice.z_sender); - purple_debug_error("zephyr","z_recipient: %s\n", notice.z_recipient); - purple_debug_error("zephyr","z_message: %s\n", notice.z_message); - purple_debug_error("zephyr","z_message_len: %d\n", notice.z_message_len); -} - - -static zephyr_triple *new_triple(zephyr_account *zephyr,const char *c, const char *i, const char *r) -{ - zephyr_triple *zt; - - zt = g_new0(zephyr_triple, 1); - zt->class = g_strdup(c); - zt->instance = g_strdup(i); - zt->recipient = g_strdup(r); - zt->name = g_strdup_printf("%s,%s,%s", c, i?i:"", r?r:""); - zt->id = ++(zephyr->last_id); - zt->open = FALSE; - return zt; -} - -static void free_triple(zephyr_triple * zt) -{ - g_free(zt->class); - g_free(zt->instance); - g_free(zt->recipient); - g_free(zt->name); - g_free(zt); -} - -/* returns true if zt1 is a subset of zt2. This function is used to - determine whether a zephyr sent to zt1 should be placed in the chat - with triple zt2 - - zt1 is a subset of zt2 - iff. the classnames are identical ignoring case - AND. the instance names are identical (ignoring case), or zt2->instance is *. - AND. the recipient names are identical -*/ - -static gboolean triple_subset(zephyr_triple * zt1, zephyr_triple * zt2) -{ - - if (!zt2) { - purple_debug_error("zephyr","zt2 doesn't exist\n"); - return FALSE; - } - if (!zt1) { - purple_debug_error("zephyr","zt1 doesn't exist\n"); - return FALSE; - } - if (!(zt1->class)) { - purple_debug_error("zephyr","zt1c doesn't exist\n"); - return FALSE; - } - if (!(zt1->instance)) { - purple_debug_error("zephyr","zt1i doesn't exist\n"); - return FALSE; - } - if (!(zt1->recipient)) { - purple_debug_error("zephyr","zt1r doesn't exist\n"); - return FALSE; - } - if (!(zt2->class)) { - purple_debug_error("zephyr","zt2c doesn't exist\n"); - return FALSE; - } - if (!(zt2->recipient)) { - purple_debug_error("zephyr","zt2r doesn't exist\n"); - return FALSE; - } - if (!(zt2->instance)) { - purple_debug_error("zephyr","zt2i doesn't exist\n"); - return FALSE; - } - - if (g_ascii_strcasecmp(zt2->class, zt1->class)) { - return FALSE; - } - if (g_ascii_strcasecmp(zt2->instance, zt1->instance) && g_ascii_strcasecmp(zt2->instance, "*")) { - return FALSE; - } - if (g_ascii_strcasecmp(zt2->recipient, zt1->recipient)) { - return FALSE; - } - purple_debug_info("zephyr","<%s,%s,%s> is in <%s,%s,%s>\n",zt1->class,zt1->instance,zt1->recipient,zt2->class,zt2->instance,zt2->recipient); - return TRUE; -} - -static zephyr_triple *find_sub_by_triple(zephyr_account *zephyr,zephyr_triple * zt) -{ - zephyr_triple *curr_t; - GSList *curr = zephyr->subscrips; - - while (curr) { - curr_t = curr->data; - if (triple_subset(zt, curr_t)) - return curr_t; - curr = curr->next; - } - return NULL; -} - -static zephyr_triple *find_sub_by_id(zephyr_account *zephyr,int id) -{ - zephyr_triple *zt; - GSList *curr = zephyr->subscrips; - - while (curr) { - zt = curr->data; - if (zt->id == id) - return zt; - curr = curr->next; - } - return NULL; -} - -/* - Converts strings to utf-8 if necessary using user specified encoding -*/ - -static gchar *zephyr_recv_convert(PurpleConnection *gc, gchar *string) -{ - gchar *utf8; - GError *err = NULL; - zephyr_account *zephyr = gc->proto_data; - if (g_utf8_validate(string, -1, NULL)) { - return g_strdup(string); - } else { - utf8 = g_convert(string, -1, "UTF-8", zephyr->encoding, NULL, NULL, &err); - if (err) { - purple_debug_error("zephyr", "recv conversion error: %s\n", err->message); - utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); - g_error_free(err); - } - - return utf8; - } -} - -/* This parses HTML formatting (put out by one of the gtkimhtml widgets - And converts it to zephyr formatting. - It currently deals properly with ,
, , , , - It ignores - It does - @small - 3 or 4 @medium() - 5,6, or 7 @large() - " or just "description" as appropriate -*/ - -static char *html_to_zephyr(const char *message) -{ - zframe *frames, *new_f; - char *ret; - - if (*message == '\0') - return g_strdup(""); - - frames = g_new(zframe, 1); - frames->text = g_string_new(""); - frames->href = NULL; - frames->is_href = FALSE; - frames->enclosing = NULL; - frames->closing = NULL; - frames->env = ""; - frames->has_closer = FALSE; - frames->closer_mask = 15; - - purple_debug_info("zephyr","html received %s\n",message); - while (*message) { - if (frames->closing && !g_ascii_strncasecmp(message, frames->closing, strlen(frames->closing))) { - zframe *popped; - message += strlen(frames->closing); - popped = frames; - frames = frames->enclosing; - if (popped->is_href) { - frames->href = popped->text; - } else { - g_string_append(frames->text, popped->env); - if (popped->has_closer) { - g_string_append_c(frames->text, - (popped->closer_mask & 1) ? '{' : - (popped->closer_mask & 2) ? '[' : - (popped->closer_mask & 4) ? '(' : - '<'); - } - g_string_append(frames->text, popped->text->str); - if (popped->href) - { - int text_len = strlen(popped->text->str), href_len = strlen(popped->href->str); - if (!((text_len == href_len && !strncmp(popped->href->str, popped->text->str, text_len)) || - (7 + text_len == href_len && !strncmp(popped->href->str, "http://", 7) && - !strncmp(popped->href->str + 7, popped->text->str, text_len)) || - (7 + text_len == href_len && !strncmp(popped->href->str, "mailto:", 7) && - !strncmp(popped->href->str + 7, popped->text->str, text_len)))) { - g_string_append(frames->text, " <"); - g_string_append(frames->text, popped->href->str); - if (popped->closer_mask & ~8) { - g_string_append_c(frames->text, '>'); - popped->closer_mask &= ~8; - } else { - g_string_append(frames->text, "@{>}"); - } - } - g_string_free(popped->href, TRUE); - } - if (popped->has_closer) { - g_string_append_c(frames->text, - (popped->closer_mask & 1) ? '}' : - (popped->closer_mask & 2) ? ']' : - (popped->closer_mask & 4) ? ')' : - '>'); - } - if (!popped->has_closer) - frames->closer_mask = popped->closer_mask; - g_string_free(popped->text, TRUE); - } - g_free(popped); - } else if (*message == '<') { - if (!g_ascii_strncasecmp(message + 1, "i>", 2)) { - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = ""; - new_f->env = "@i"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - frames = new_f; - message += 3; - } else if (!g_ascii_strncasecmp(message + 1, "b>", 2)) { - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = "
"; - new_f->env = "@b"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - frames = new_f; - message += 3; - } else if (!g_ascii_strncasecmp(message + 1, "br>", 3)) { - g_string_append_c(frames->text, '\n'); - message += 4; - } else if (!g_ascii_strncasecmp(message + 1, "a href=\"", 8)) { - message += 9; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = ""; - new_f->env = ""; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - frames = new_f; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = TRUE; - new_f->closing = "\">"; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - frames = new_f; - } else if (!g_ascii_strncasecmp(message + 1, "font", 4)) { - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = ""; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - message += 5; - while (*message == ' ') - message++; - if (!g_ascii_strncasecmp(message, "color=\"", 7)) { - message += 7; - new_f->env = "@"; - frames = new_f; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->env = "@color"; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = "\">"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - } else if (!g_ascii_strncasecmp(message, "face=\"", 6)) { - message += 6; - new_f->env = "@"; - frames = new_f; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->env = "@font"; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = "\">"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - } else if (!g_ascii_strncasecmp(message, "size=\"", 6)) { - message += 6; - if ((*message == '1') || (*message == '2')) { - new_f->env = "@small"; - } else if ((*message == '3') - || (*message == '4')) { - new_f->env = "@medium"; - } else if ((*message == '5') - || (*message == '6') - || (*message == '7')) { - new_f->env = "@large"; - } else { - new_f->env = ""; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - } - message += 3; - } else { - /* Drop all unrecognized/misparsed font tags */ - new_f->env = ""; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - while (g_ascii_strncasecmp(message, "\">", 2) != 0) { - message++; - } - if (*message != '\0') - message += 2; - } - frames = new_f; - } else { - /* Catch all for all unrecognized/misparsed tage */ - g_string_append_c(frames->text, *message++); - } - } else if (*message == '@') { - g_string_append(frames->text, "@@"); - message++; - } else if (*message == '}') { - if (frames->closer_mask & ~1) { - frames->closer_mask &= ~1; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@[}]"); - message++; - } - } else if (*message == ']') { - if (frames->closer_mask & ~2) { - frames->closer_mask &= ~2; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@{]}"); - message++; - } - } else if (*message == ')') { - if (frames->closer_mask & ~4) { - frames->closer_mask &= ~4; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@{)}"); - message++; - } - } else if (!g_ascii_strncasecmp(message, ">", 4)) { - if (frames->closer_mask & ~8) { - frames->closer_mask &= ~8; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@{>}"); - message += 4; - } - } else { - g_string_append_c(frames->text, *message++); - } - } - ret = frames->text->str; - g_string_free(frames->text, FALSE); - g_free(frames); - purple_debug_info("zephyr","zephyr outputted %s\n",ret); - return ret; -} - -/* this parses zephyr formatting and converts it to html. For example, if - * you pass in "@{@color(blue)@i(hello)}" you should get out - * "hello". */ -static char *zephyr_to_html(const char *message) -{ - zframe *frames, *curr; - char *ret; - - frames = g_new(zframe, 1); - frames->text = g_string_new(""); - frames->enclosing = NULL; - frames->closing = ""; - frames->has_closer = FALSE; - frames->closer = NULL; - - while (*message) { - if (*message == '@' && message[1] == '@') { - g_string_append(frames->text, "@"); - message += 2; - } else if (*message == '@') { - int end; - for (end = 1; message[end] && (isalnum(message[end]) || message[end] == '_'); end++); - if (message[end] && - (message[end] == '{' || message[end] == '[' || message[end] == '(' || - !g_ascii_strncasecmp(message + end, "<", 4))) { - zframe *new_f; - char *buf; - buf = g_new0(char, end); - g_snprintf(buf, end, "%s", message + 1); - message += end; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->has_closer = TRUE; - new_f->closer = (*message == '{' ? "}" : - *message == '[' ? "]" : - *message == '(' ? ")" : - ">"); - message += (*message == '&' ? 4 : 1); - if (!g_ascii_strcasecmp(buf, "italic") || !g_ascii_strcasecmp(buf, "i")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "small")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "medium")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "large")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "bold") - || !g_ascii_strcasecmp(buf, "b")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "font")) { - zframe *extra_f; - extra_f = g_new(zframe, 1); - extra_f->enclosing = frames; - new_f->enclosing = extra_f; - extra_f->text = g_string_new(""); - extra_f->has_closer = FALSE; - extra_f->closer = frames->closer; - extra_f->closing = ""; - new_f->text = g_string_new("closing = "\">"; - } else if (!g_ascii_strcasecmp(buf, "color")) { - zframe *extra_f; - extra_f = g_new(zframe, 1); - extra_f->enclosing = frames; - new_f->enclosing = extra_f; - extra_f->text = g_string_new(""); - extra_f->has_closer = FALSE; - extra_f->closer = frames->closer; - extra_f->closing = ""; - new_f->text = g_string_new("closing = "\">"; - } else { - new_f->text = g_string_new(""); - new_f->closing = ""; - } - frames = new_f; - } else { - /* Not a formatting tag, add the character as normal. */ - g_string_append_c(frames->text, *message++); - } - } else if (frames->closer && !g_ascii_strncasecmp(message, frames->closer, strlen(frames->closer))) { - zframe *popped; - gboolean last_had_closer; - - message += strlen(frames->closer); - if (frames && frames->enclosing) { - do { - popped = frames; - frames = frames->enclosing; - g_string_append(frames->text, popped->text->str); - g_string_append(frames->text, popped->closing); - g_string_free(popped->text, TRUE); - last_had_closer = popped->has_closer; - g_free(popped); - } while (frames && frames->enclosing && !last_had_closer); - } else { - g_string_append_c(frames->text, *message); - } - } else if (*message == '\n') { - g_string_append(frames->text, "
"); - message++; - } else { - g_string_append_c(frames->text, *message++); - } - } - /* go through all the stuff that they didn't close */ - while (frames->enclosing) { - curr = frames; - g_string_append(frames->enclosing->text, frames->text->str); - g_string_append(frames->enclosing->text, frames->closing); - g_string_free(frames->text, TRUE); - frames = frames->enclosing; - g_free(curr); - } - ret = frames->text->str; - g_string_free(frames->text, FALSE); - g_free(frames); - return ret; -} - -static gboolean pending_zloc(zephyr_account *zephyr, const char *who) -{ - GList *curr; - - for (curr = zephyr->pending_zloc_names; curr != NULL; curr = curr->next) { - char* normalized_who = local_zephyr_normalize(zephyr,who); - if (!g_ascii_strcasecmp(normalized_who, (char *)curr->data)) { - g_free((char *)curr->data); - zephyr->pending_zloc_names = g_list_remove(zephyr->pending_zloc_names, curr->data); - return TRUE; - } - } - return FALSE; -} - -/* Called when the server notifies us a message couldn't get sent */ - -static void message_failed(PurpleConnection *gc, ZNotice_t notice, struct sockaddr_in from) -{ - if (g_ascii_strcasecmp(notice.z_class, "message")) { - gchar* chat_failed = g_strdup_printf(_("Unable to send to chat %s,%s,%s"),notice.z_class,notice.z_class_inst,notice.z_recipient); - purple_notify_error(gc,"",chat_failed,NULL); - g_free(chat_failed); - } else { - purple_notify_error(gc, notice.z_recipient, _("User is offline"), NULL); - } -} - -static void handle_message(PurpleConnection *gc,ZNotice_t notice) -{ - zephyr_account* zephyr = gc->proto_data; - - if (!g_ascii_strcasecmp(notice.z_class, LOGIN_CLASS)) { - /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ - } else if (!g_ascii_strcasecmp(notice.z_class, LOCATE_CLASS)) { - if (!g_ascii_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { - int nlocs; - char *user; - PurpleBuddy *b; - const char *bname; - - /* XXX add real error reporting */ - if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) - return; - - if ((b = purple_find_buddy(gc->account, user)) == NULL) { - char* stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account,stripped_user); - g_free(stripped_user); - } - - bname = b ? purple_buddy_get_name(b) : NULL; - if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user)) { - ZLocations_t locs; - int one = 1; - PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); - char *tmp; - const char *balias; - - purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); - balias = purple_buddy_get_local_buddy_alias(b); - if (b && balias) - purple_notify_user_info_add_pair(user_info, _("Alias"), balias); - - if (!nlocs) { - purple_notify_user_info_add_pair(user_info, NULL, _("Hidden or not logged-in")); - } - for (; nlocs > 0; nlocs--) { - /* XXX add real error reporting */ - - ZGetLocations(&locs, &one); - tmp = g_strdup_printf(_("
At %s since %s"), locs.host, locs.time); - purple_notify_user_info_add_pair(user_info, _("Location"), tmp); - g_free(tmp); - } - purple_notify_userinfo(gc, (b ? bname : user), - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } else { - if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); - else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); - } - - g_free(user); - } - } else { - char *buf, *buf2, *buf3; - char *send_inst; - PurpleConversation *gconv1; - PurpleConvChat *gcc; - char *ptr = (char *) notice.z_message + (strlen(notice.z_message) + 1); - int len; - char *stripped_sender; - int signature_length = strlen(notice.z_message); - int message_has_no_body = 0; - PurpleMessageFlags flags = 0; - gchar *tmpescape; - - /* Need to deal with 0 length messages to handle typing notification (OPCODE) ping messages */ - /* One field zephyrs would have caused purple to crash */ - if ( (notice.z_message_len == 0) || (signature_length >= notice.z_message_len - 1)) { - message_has_no_body = 1; - len = 0; - purple_debug_info("zephyr","message_size %d %d %d\n",len,notice.z_message_len,signature_length); - buf3 = g_strdup(""); - - } else { - len = notice.z_message_len - ( signature_length +1); - purple_debug_info("zephyr","message_size %d %d %d\n",len,notice.z_message_len,signature_length); - buf = g_malloc(len + 1); - g_snprintf(buf, len + 1, "%s", ptr); - g_strchomp(buf); - tmpescape = g_markup_escape_text(buf, -1); - g_free(buf); - buf2 = zephyr_to_html(tmpescape); - buf3 = zephyr_recv_convert(gc, buf2); - g_free(buf2); - g_free(tmpescape); - } - - stripped_sender = zephyr_strip_local_realm(zephyr,notice.z_sender); - - if (!g_ascii_strcasecmp(notice.z_class, "MESSAGE") && !g_ascii_strcasecmp(notice.z_class_inst, "PERSONAL") - && !g_ascii_strcasecmp(notice.z_recipient,zephyr->username)) { - if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:")) - flags |= PURPLE_MESSAGE_AUTO_RESP; - - if (!g_ascii_strcasecmp(notice.z_opcode,"PING")) - serv_got_typing(gc,stripped_sender,ZEPHYR_TYPING_RECV_TIMEOUT, PURPLE_TYPING); - else - serv_got_im(gc, stripped_sender, buf3, flags, time(NULL)); - - } else { - zephyr_triple *zt1, *zt2; - gchar *send_inst_utf8; - zephyr_account *zephyr = gc->proto_data; - zt1 = new_triple(gc->proto_data,notice.z_class, notice.z_class_inst, notice.z_recipient); - zt2 = find_sub_by_triple(gc->proto_data,zt1); - if (!zt2) { - /* This is a server supplied subscription */ - zephyr->subscrips = g_slist_append(zephyr->subscrips, new_triple(zephyr,zt1->class,zt1->instance,zt1->recipient)); - zt2 = find_sub_by_triple(gc->proto_data,zt1); - } - - if (!zt2->open) { - zt2->open = TRUE; - serv_got_joined_chat(gc, zt2->id, zt2->name); - zephyr_chat_set_topic(gc,zt2->id,notice.z_class_inst); - } - - if (!g_ascii_strcasecmp(notice.z_class_inst,"PERSONAL")) - send_inst_utf8 = g_strdup(stripped_sender); - else { - send_inst = g_strdup_printf("[%s] %s",notice.z_class_inst,stripped_sender); - send_inst_utf8 = zephyr_recv_convert(gc,send_inst); - g_free(send_inst); - if (!send_inst_utf8) { - purple_debug_error("zephyr","Failed to convert instance for sender %s.\n", stripped_sender); - send_inst_utf8 = g_strdup(stripped_sender); - } - } - - gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - zt2->name, gc->account); - gcc = purple_conversation_get_chat_data(gconv1); -#ifndef INET_ADDRSTRLEN -#define INET_ADDRSTRLEN 16 -#endif - if (!purple_conv_chat_find_user(gcc, stripped_sender)) { - gchar ipaddr[INET_ADDRSTRLEN]; -#ifdef HAVE_INET_NTOP - inet_ntop(AF_INET, ¬ice.z_sender_addr.s_addr, ipaddr, sizeof(ipaddr)); -#else - memcpy(ipaddr,inet_ntoa(notice.z_sender_addr),sizeof(ipaddr)); -#endif - purple_conv_chat_add_user(gcc, stripped_sender, ipaddr, PURPLE_CBFLAGS_NONE, TRUE); - } - serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL)); - g_free(send_inst_utf8); - - free_triple(zt1); - } - g_free(stripped_sender); - g_free(buf3); - } -} - -static int free_parse_tree(parse_tree* tree) { - if (!tree) { - return 0; - } - else { - int i; - if (tree->children) { - for(i=0;inum_children;i++){ - if (tree->children[i]) { - free_parse_tree(tree->children[i]); - g_free(tree->children[i]); - } - } - } - if ((tree != &null_parse_tree) && (tree->contents != NULL)) - g_free(tree->contents); - - } - return 0; -} - -static parse_tree *tree_child(parse_tree* tree,int index) { - if (index < tree->num_children) { - return tree->children[index]; - } else { - return &null_parse_tree; - } -} - -static parse_tree *find_node(parse_tree* ptree,gchar* key) -{ - gchar* tc; - - if (!ptree || ! key) - return &null_parse_tree; - - tc = tree_child(ptree,0)->contents; - - /* g_strcasecmp() is deprecated. What is the encoding here??? */ - if (ptree->num_children > 0 && tc && !g_ascii_strcasecmp(tc, key)) { - return ptree; - } else { - parse_tree *result = &null_parse_tree; - int i; - for(i = 0; i < ptree->num_children; i++) { - result = find_node(ptree->children[i],key); - if(result != &null_parse_tree) { - break; - } - } - return result; - } -} - -static parse_tree *parse_buffer(gchar* source, gboolean do_parse) { - - parse_tree *ptree = g_new0(parse_tree,1); - ptree->contents = NULL; - ptree->num_children=0; - if (do_parse) { - unsigned int p = 0; - while(p < strlen(source)) { - unsigned int end; - gchar *newstr; - - /* Eat white space: */ - if(g_ascii_isspace(source[p]) || source[p] == '\001') { - p++; - continue; - } - - /* Skip comments */ - if(source[p] == ';') { - while(source[p] != '\n' && p < strlen(source)) { - p++; - } - continue; - } - - if(source[p] == '(') { - int nesting = 0; - gboolean in_quote = FALSE; - gboolean escape_next = FALSE; - p++; - end = p; - while(!(source[end] == ')' && nesting == 0 && !in_quote) && end < strlen(source)) { - if(!escape_next) { - if(source[end] == '\\') { - escape_next = TRUE; - } - if(!in_quote) { - if(source[end] == '(') { - nesting++; - } - if(source[end] == ')') { - nesting--; - } - } - if(source[end] == '"') { - in_quote = !in_quote; - } - } else { - escape_next = FALSE; - } - end++; - } - do_parse = TRUE; - - } else { - gchar end_char; - if(source[p] == '"') { - end_char = '"'; - p++; - } else { - end_char = ' '; - } - do_parse = FALSE; - - end = p; - while(source[end] != end_char && end < strlen(source)) { - if(source[end] == '\\') - end++; - end++; - } - } - newstr = g_new0(gchar, end+1-p); - strncpy(newstr,source+p,end-p); - if (ptree->num_children < MAXCHILDREN) { - /* In case we surpass maxchildren, ignore this */ - ptree->children[ptree->num_children++] = parse_buffer( newstr, do_parse); - } else { - purple_debug_error("zephyr","too many children in tzc output. skipping\n"); - } - g_free(newstr); - p = end + 1; - } - return ptree; - } else { - /* XXX does this have to be strdup'd */ - ptree->contents = g_strdup(source); - return ptree; - } -} - -static parse_tree *read_from_tzc(zephyr_account* zephyr){ - struct timeval tv; - fd_set rfds; - int bufsize = 2048; - char *buf = (char *)calloc(bufsize, 1); - char *bufcur = buf; - int selected = 0; - parse_tree *incoming_msg; - - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - incoming_msg=NULL; - - while (select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, &tv)) { - selected = 1; - read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1); - bufcur++; - if ((bufcur - buf) > (bufsize - 1)) { - if ((buf = realloc(buf, bufsize * 2)) == NULL) { - purple_debug_error("zephyr","Ran out of memory\n"); - exit(-1); - } else { - bufcur = buf + bufsize; - bufsize *= 2; - } - } - } - *bufcur = '\0'; - - if (selected) { - incoming_msg = parse_buffer(buf,TRUE); - } - free(buf); - return incoming_msg; -} - -static gint check_notify_tzc(gpointer data) -{ - PurpleConnection *gc = (PurpleConnection *)data; - zephyr_account* zephyr = gc->proto_data; - parse_tree *newparsetree = read_from_tzc(zephyr); - if (newparsetree != NULL) { - gchar *spewtype; - if ( (spewtype = tree_child(find_node(newparsetree,"tzcspew"),2)->contents) ) { - if (!g_ascii_strncasecmp(spewtype,"message",7)) { - ZNotice_t notice; - parse_tree *msgnode = tree_child(find_node(newparsetree,"message"),2); - parse_tree *bodynode = tree_child(msgnode,1); - /* char *zsig = g_strdup(" "); */ /* purple doesn't care about zsigs */ - char *msg = zephyr_tzc_deescape_str(bodynode->contents); - size_t bufsize = strlen(msg) + 3; - char *buf = g_new0(char,bufsize); - g_snprintf(buf,1+strlen(msg)+2," %c%s",'\0',msg); - memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = ACKED; - notice.z_port = 0; - notice.z_opcode = tree_child(find_node(newparsetree,"opcode"),2)->contents; - notice.z_class = zephyr_tzc_deescape_str(tree_child(find_node(newparsetree,"class"),2)->contents); - notice.z_class_inst = tree_child(find_node(newparsetree,"instance"),2)->contents; - notice.z_recipient = local_zephyr_normalize(zephyr,tree_child(find_node(newparsetree,"recipient"),2)->contents); - notice.z_sender = local_zephyr_normalize(zephyr,tree_child(find_node(newparsetree,"sender"),2)->contents); - notice.z_default_format = "Class $class, Instance $instance:\n" "To: @bold($recipient) at $time $date\n" "From: @bold($1) <$sender>\n\n$2"; - notice.z_message_len = strlen(msg) + 3; - notice.z_message = buf; - handle_message(gc, notice); - g_free(msg); - /* g_free(zsig); */ - g_free(buf); - /* free_parse_tree(msgnode); - free_parse_tree(bodynode); - g_free(msg); - g_free(zsig); - g_free(buf); - */ - } - else if (!g_ascii_strncasecmp(spewtype,"zlocation",9)) { - /* check_loc or zephyr_zloc respectively */ - /* XXX fix */ - char *user; - PurpleBuddy *b; - const char *bname; - int nlocs = 0; - parse_tree *locations; - gchar *locval; - user = tree_child(find_node(newparsetree,"user"),2)->contents; - - if ((b = purple_find_buddy(gc->account, user)) == NULL) { - gchar *stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account, stripped_user); - g_free(stripped_user); - } - locations = find_node(newparsetree,"locations"); - locval = tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents; - - if (!locval || !g_ascii_strcasecmp(locval," ") || (strlen(locval) == 0)) { - nlocs = 0; - } else { - nlocs = 1; - } - - bname = b ? purple_buddy_get_name(b) : NULL; - if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user) || pending_zloc(zephyr,local_zephyr_normalize(zephyr,user))){ - PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); - char *tmp; - const char *balias; - - purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); - - balias = b ? purple_buddy_get_local_buddy_alias(b) : NULL; - if (balias) - purple_notify_user_info_add_pair(user_info, _("Alias"), balias); - - if (!nlocs) { - purple_notify_user_info_add_pair(user_info, NULL, _("Hidden or not logged-in")); - } else { - tmp = g_strdup_printf(_("
At %s since %s"), - tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents, - tree_child(tree_child(tree_child(tree_child(locations,2),0),2),2)->contents); - purple_notify_user_info_add_pair(user_info, _("Location"), tmp); - g_free(tmp); - } - - purple_notify_userinfo(gc, b ? bname : user, - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } else { - if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); - else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); - } - } - else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { - } - else if (!g_ascii_strncasecmp(spewtype,"start",5)) { - } - else if (!g_ascii_strncasecmp(spewtype,"error",5)) { - /* XXX handle */ - } - } else { - } - } else { - } - - free_parse_tree(newparsetree); - return TRUE; -} - -static gint check_notify_zeph02(gpointer data) -{ - /* XXX add real error reporting */ - PurpleConnection *gc = (PurpleConnection*) data; - while (ZPending()) { - ZNotice_t notice; - struct sockaddr_in from; - /* XXX add real error reporting */ - - z_call_r(ZReceiveNotice(¬ice, &from)); - - switch (notice.z_kind) { - case UNSAFE: - case UNACKED: - case ACKED: - handle_message(gc,notice); - break; - case SERVACK: - if (!(g_ascii_strcasecmp(notice.z_message, ZSRVACK_NOTSENT))) { - message_failed(gc,notice, from); - } - break; - case CLIENTACK: - purple_debug_error("zephyr", "Client ack received\n"); - default: - /* we'll just ignore things for now */ - handle_unknown(notice); - purple_debug_error("zephyr", "Unhandled notice.\n"); - break; - } - /* XXX add real error reporting */ - ZFreeNotice(¬ice); - } - - return TRUE; -} - -#ifdef WIN32 - -static gint check_loc(gpointer data) -{ - GSList *buddies; - ZLocations_t locations; - PurpleConnection *gc = data; - zephyr_account *zephyr = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - int numlocs; - int one = 1; - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *b = buddies->data; - char *chk; - const char *bname = purple_buddy_get_name(b); - chk = local_zephyr_normalize(bname); - ZLocateUser(chk,&numlocs, ZAUTH); - if (numlocs) { - int i; - for(i=0;iproto_data; - PurpleAccount *account = purple_connection_get_account(gc); - - if (use_zeph02(zephyr)) { - ald.user = NULL; - memset(&(ald.uid), 0, sizeof(ZUnique_Id_t)); - ald.version = NULL; - } - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *b = buddies->data; - - const char *chk; - const char *name = purple_buddy_get_name(b); - - chk = local_zephyr_normalize(zephyr,name); - purple_debug_info("zephyr","chk: %s b->name %s\n",chk,name); - /* XXX add real error reporting */ - /* doesn't matter if this fails or not; we'll just move on to the next one */ - if (use_zeph02(zephyr)) { -#ifdef WIN32 - int numlocs; - int one=1; - ZLocateUser(chk,&numlocs,ZAUTH); - if (numlocs) { - int i; - for(i=0;i0) - purple_prpl_got_user_status(account,name,"available",NULL); - else - purple_prpl_got_user_status(account,name,"offline",NULL); - } - } -#else - ZRequestLocations(chk, &ald, UNACKED, ZAUTH); - g_free(ald.user); - g_free(ald.version); -#endif /* WIN32 */ - } else - if (use_tzc(zephyr)) { - gchar *zlocstr = g_strdup_printf("((tzcfodder . zlocate) \"%s\")\n",chk); - size_t len = strlen(zlocstr); - size_t result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zlocstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write a message: %s\n", g_strerror(errno)); - } - g_free(zlocstr); - } - } - - return TRUE; -} - -#endif /* WIN32 */ - -static char *get_exposure_level(void) -{ - /* XXX add real error reporting */ - char *exposure = ZGetVariable("exposure"); - - if (!exposure) - return EXPOSE_REALMVIS; - if (!g_ascii_strcasecmp(exposure, EXPOSE_NONE)) - return EXPOSE_NONE; - if (!g_ascii_strcasecmp(exposure, EXPOSE_OPSTAFF)) - return EXPOSE_OPSTAFF; - if (!g_ascii_strcasecmp(exposure, EXPOSE_REALMANN)) - return EXPOSE_REALMANN; - if (!g_ascii_strcasecmp(exposure, EXPOSE_NETVIS)) - return EXPOSE_NETVIS; - if (!g_ascii_strcasecmp(exposure, EXPOSE_NETANN)) - return EXPOSE_NETANN; - return EXPOSE_REALMVIS; -} - -static void strip_comments(char *str) -{ - char *tmp = strchr(str, '#'); - - if (tmp) - *tmp = '\0'; - g_strchug(str); - g_strchomp(str); -} - -static void zephyr_inithosts(zephyr_account *zephyr) -{ - /* XXX This code may not be Win32 clean */ - struct hostent *hent; - - if (gethostname(zephyr->ourhost, sizeof(zephyr->ourhost)) == -1) { - purple_debug_error("zephyr", "unable to retrieve hostname, %%host%% and %%canon%% will be wrong in subscriptions and have been set to unknown\n"); - g_strlcpy(zephyr->ourhost, "unknown", sizeof(zephyr->ourhost)); - g_strlcpy(zephyr->ourhostcanon, "unknown", sizeof(zephyr->ourhostcanon)); - return; - } - - if (!(hent = gethostbyname(zephyr->ourhost))) { - purple_debug_error("zephyr", "unable to resolve hostname, %%canon%% will be wrong in subscriptions.and has been set to the value of %%host%%, %s\n",zephyr->ourhost); - g_strlcpy(zephyr->ourhostcanon, zephyr->ourhost, sizeof(zephyr->ourhostcanon)); - return; - } - - g_strlcpy(zephyr->ourhostcanon, hent->h_name, sizeof(zephyr->ourhostcanon)); - - return; -} - -static void process_zsubs(zephyr_account *zephyr) -{ - /* Loads zephyr chats "(subscriptions) from ~/.zephyr.subs, and - registers (subscribes to) them on the server */ - - /* XXX deal with unsubscriptions */ - /* XXX deal with punts */ - - FILE *f; - gchar *fname; - gchar buff[BUFSIZ]; - - fname = g_strdup_printf("%s/.zephyr.subs", purple_home_dir()); - f = g_fopen(fname, "r"); - if (f) { - char **triple; - char *recip; - char *z_class; - char *z_instance; - char *z_galaxy = NULL; - - while (fgets(buff, BUFSIZ, f)) { - strip_comments(buff); - if (buff[0]) { - triple = g_strsplit(buff, ",", 3); - if (triple[0] && triple[1]) { - char *tmp = g_strdup_printf("%s", zephyr->username); - char *atptr; - - z_class = triple[0]; - z_instance = triple[1]; - if (triple[2] == NULL) { - recip = g_malloc0(1); - } else if (!g_ascii_strcasecmp(triple[2], "%me%")) { - recip = g_strdup_printf("%s", zephyr->username); - } else if (!g_ascii_strcasecmp(triple[2], "*")) { - /* wildcard - * form of class,instance,* */ - recip = g_malloc0(1); - } else if (!g_ascii_strcasecmp(triple[2], tmp)) { - /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ - recip = g_strdup(triple[2]); - } else if ((atptr = strchr(triple[2], '@')) != NULL) { - /* form of class,instance,*@ANDREW.CMU.EDU - * class,instance,@ANDREW.CMU.EDU - * If realm is local realm, blank recipient, else - * @REALM-NAME - */ - char *realmat = g_strdup_printf("@%s",zephyr->realm); - - if (!g_ascii_strcasecmp(atptr, realmat)) - recip = g_malloc0(1); - else - recip = g_strdup(atptr); - g_free(realmat); - } else { - recip = g_strdup(triple[2]); - } - g_free(tmp); - - if (!g_ascii_strcasecmp(triple[0],"%host%")) { - z_class = g_strdup(zephyr->ourhost); - } else if (!g_ascii_strcasecmp(triple[0],"%canon%")) { - z_class = g_strdup(zephyr->ourhostcanon); - } else { - z_class = g_strdup(triple[0]); - } - - if (!g_ascii_strcasecmp(triple[1],"%host%")) { - z_instance = g_strdup(zephyr->ourhost); - } else if (!g_ascii_strcasecmp(triple[1],"%canon%")) { - z_instance = g_strdup(zephyr->ourhostcanon); - } else { - z_instance = g_strdup(triple[1]); - } - - /* There should be some sort of error report listing classes that couldn't be subbed to. - Not important right now though */ - - if (zephyr_subscribe_to(zephyr,z_class, z_instance, recip,z_galaxy) != ZERR_NONE) { - - purple_debug_error("zephyr", "Couldn't subscribe to %s, %s, %s\n", z_class,z_instance,recip); - } - - zephyr->subscrips = g_slist_append(zephyr->subscrips, new_triple(zephyr,z_class,z_instance,recip)); - /* g_hash_table_destroy(sub_hash_table); */ - g_free(z_instance); - g_free(z_class); - g_free(recip); - } - g_strfreev(triple); - } - } - fclose(f); - } -} - -static void process_anyone(PurpleConnection *gc) -{ - FILE *fd; - gchar buff[BUFSIZ], *filename; - PurpleGroup *g; - PurpleBuddy *b; - - if (!(g = purple_find_group(_("Anyone")))) { - g = purple_group_new(_("Anyone")); - purple_blist_add_group(g, NULL); - } - - filename = g_strconcat(purple_home_dir(), "/.anyone", NULL); - if ((fd = g_fopen(filename, "r")) != NULL) { - while (fgets(buff, BUFSIZ, fd)) { - strip_comments(buff); - if (buff[0]) { - if (!(b = purple_find_buddy(gc->account, buff))) { - char *stripped_user = zephyr_strip_local_realm(gc->proto_data,buff); - purple_debug_info("zephyr","stripped_user %s\n",stripped_user); - if (!(b = purple_find_buddy(gc->account,stripped_user))){ - b = purple_buddy_new(gc->account, stripped_user, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - g_free(stripped_user); - } - } - } - fclose(fd); - } - g_free(filename); -} - -static char* normalize_zephyr_exposure(const char* exposure) { - char *exp2 = g_strstrip(g_ascii_strup(exposure,-1)); - - if (!exp2) - return EXPOSE_REALMVIS; - if (!g_ascii_strcasecmp(exp2, EXPOSE_NONE)) - return EXPOSE_NONE; - if (!g_ascii_strcasecmp(exp2, EXPOSE_OPSTAFF)) - return EXPOSE_OPSTAFF; - if (!g_ascii_strcasecmp(exp2, EXPOSE_REALMANN)) - return EXPOSE_REALMANN; - if (!g_ascii_strcasecmp(exp2, EXPOSE_NETVIS)) - return EXPOSE_NETVIS; - if (!g_ascii_strcasecmp(exp2, EXPOSE_NETANN)) - return EXPOSE_NETANN; - return EXPOSE_REALMVIS; -} - -static void zephyr_login(PurpleAccount * account) -{ - PurpleConnection *gc; - zephyr_account *zephyr; - gboolean read_anyone; - gboolean read_zsubs; - gchar *exposure; - - gc = purple_account_get_connection(account); - read_anyone = purple_account_get_bool(gc->account,"read_anyone",TRUE); - read_zsubs = purple_account_get_bool(gc->account,"read_zsubs",TRUE); - exposure = (gchar *)purple_account_get_string(gc->account, "exposure_level", EXPOSE_REALMVIS); - -#ifdef WIN32 - username = purple_account_get_username(account); -#endif - gc->flags |= PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; - gc->proto_data = zephyr=g_new0(zephyr_account,1); - - zephyr->account = account; - - /* Make sure that the exposure (visibility) is set to a sane value */ - zephyr->exposure=g_strdup(normalize_zephyr_exposure(exposure)); - - if (purple_account_get_bool(gc->account,"use_tzc",0)) { - zephyr->connection_type = PURPLE_ZEPHYR_TZC; - } else { - zephyr->connection_type = PURPLE_ZEPHYR_KRB4; - } - - zephyr->encoding = (char *)purple_account_get_string(gc->account, "encoding", ZEPHYR_FALLBACK_CHARSET); - purple_connection_update_progress(gc, _("Connecting"), 0, 8); - - /* XXX z_call_s should actually try to report the com_err determined error */ - if (use_tzc(zephyr)) { - pid_t pid; - /* purple_connection_error(gc,"tzc not supported yet"); */ - if ((pipe(zephyr->totzc) != 0) || (pipe(zephyr->fromtzc) != 0)) { - purple_debug_error("zephyr", "pipe creation failed. killing\n"); - exit(-1); - } - - pid = fork(); - - if (pid == -1) { - purple_debug_error("zephyr", "forking failed\n"); - exit(-1); - } - if (pid == 0) { - unsigned int i=0; - gboolean found_ps = FALSE; - gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(gc->account,"tzc_command","/usr/bin/tzc -e %s")," ",0); - if (close(1) == -1) { - exit(-1); - } - if (dup2(zephyr->fromtzc[1], 1) == -1) { - exit(-1); - } - if (close(zephyr->fromtzc[1]) == -1) { - exit(-1); - } - if (close(0) == -1) { - exit(-1); - } - if (dup2(zephyr->totzc[0], 0) == -1) { - exit(-1); - } - if (close(zephyr->totzc[0]) == -1) { - exit(-1); - } - /* tzc_command should really be of the form - path/to/tzc -e %s - or - ssh username@hostname pathtotzc -e %s - -- this should not require a password, and ideally should be kerberized ssh -- - or - fsh username@hostname pathtotzc -e %s - */ - while(tzc_cmd_array[i] != NULL){ - if (!g_ascii_strncasecmp(tzc_cmd_array[i],"%s",2)) { - /* fprintf(stderr,"replacing %%s with %s\n",zephyr->exposure); */ - tzc_cmd_array[i] = g_strdup(zephyr->exposure); - found_ps = TRUE; - - } else { - /* fprintf(stderr,"keeping %s\n",tzc_cmd_array[i]); */ - } - i++; - } - - if (!found_ps) { - exit(-1); - } - - execvp(tzc_cmd_array[0], tzc_cmd_array); - exit(-1); - } - else { - fd_set rfds; - int bufsize = 2048; - char *buf = (char *)calloc(bufsize, 1); - char *bufcur = buf; - struct timeval tv; - char *ptr; - int parenlevel=0; - char* tempstr; - int tempstridx; - int select_status; - - zephyr->tzc_pid = pid; - /* wait till we have data to read from ssh */ - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - - tv.tv_sec = 10; - tv.tv_usec = 0; - - purple_debug_info("zephyr", "about to read from tzc\n"); - - if (waitpid(pid, NULL, WNOHANG) == 0) { /* Only select if tzc is still running */ - purple_debug_info("zephyr", "about to read from tzc\n"); - select_status = select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, NULL); - } - else { - purple_debug_info("zephyr", "tzc exited early\n"); - select_status = -1; - } - - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - while (select_status > 0 && - select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, &tv) > 0) { - read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1); - bufcur++; - if ((bufcur - buf) > (bufsize - 1)) { - if ((buf = realloc(buf, bufsize * 2)) == NULL) { - exit(-1); - } else { - bufcur = buf + bufsize; - bufsize *= 2; - } - } - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - tv.tv_sec = 10; - tv.tv_usec = 0; - - } - /* fprintf(stderr, "read from tzc\n"); */ - *bufcur = '\0'; - ptr = buf; - - /* ignore all tzcoutput till we've received the first (*/ - while (ptr < bufcur && (*ptr !='(')) { - ptr++; - } - if (ptr >=bufcur) { - purple_connection_error(gc,"invalid output by tzc (or bad parsing code)"); - free(buf); - return; - } - - while(ptr < bufcur) { - if (*ptr == '(') { - parenlevel++; - } - else if (*ptr == ')') { - parenlevel--; - } - purple_debug_info("zephyr","tzc parenlevel is %d\n",parenlevel); - switch (parenlevel) { - case 0: - break; - case 1: - /* Search for next beginning (, or for the ending */ - ptr++; - while((*ptr != '(') && (*ptr != ')') && (ptr = bufcur) - purple_debug_error("zephyr","tzc parsing error\n"); - break; - case 2: - /* You are probably at - (foo . bar ) or (foo . "bar") or (foo . chars) or (foo . numbers) or (foo . () ) - Parse all the data between the first and last f, and move past ) - */ - tempstr = g_malloc0(20000); - tempstridx=0; - while(parenlevel >1) { - ptr++; - if (*ptr == '(') - parenlevel++; - if (*ptr == ')') - parenlevel--; - if (parenlevel > 1) { - tempstr[tempstridx++]=*ptr; - } else { - ptr++; - } - } - purple_debug_info("zephyr","tempstr parsed\n"); - /* tempstr should now be a tempstridx length string containing all characters - from that after the first ( to the one before the last paren ). */ - /* We should have the following possible lisp strings but we don't care - (tzcspew . start) (version . "something") (pid . number)*/ - /* We care about 'zephyrid . "username@REALM.NAME"' and 'exposure . "SOMETHING"' */ - tempstridx=0; - if (!g_ascii_strncasecmp(tempstr,"zephyrid",8)) { - gchar* username = g_malloc0(100); - int username_idx=0; - char *realm; - purple_debug_info("zephyr","zephyrid found\n"); - tempstridx+=8; - while(tempstr[tempstridx] !='"' && tempstridx < 20000) - tempstridx++; - tempstridx++; - while(tempstr[tempstridx] !='"' && tempstridx < 20000) - username[username_idx++]=tempstr[tempstridx++]; - - zephyr->username = g_strdup_printf("%s",username); - if ((realm = strchr(username,'@'))) - zephyr->realm = g_strdup_printf("%s",realm+1); - else { - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); - if (!*realm) { - realm = "local-realm"; - } - zephyr->realm = g_strdup(realm); - g_strlcpy(__Zephyr_realm, (const char*)zephyr->realm, REALM_SZ-1); - } - /* else { - zephyr->realm = g_strdup("local-realm"); - }*/ - - g_free(username); - } else { - purple_debug_info("zephyr", "something that's not zephyr id found %s\n",tempstr); - } - - /* We don't care about anything else yet */ - g_free(tempstr); - break; - default: - purple_debug_info("zephyr","parenlevel is not 1 or 2\n"); - /* This shouldn't be happening */ - break; - } - if (parenlevel==0) - break; - } /* while (ptr < bufcur) */ - purple_debug_info("zephyr", "tzc startup done\n"); - free(buf); - } - } - else if ( use_zeph02(zephyr)) { - gchar* realm; - z_call_s(ZInitialize(), "Couldn't initialize zephyr"); - z_call_s(ZOpenPort(&(zephyr->port)), "Couldn't open port"); - z_call_s(ZSetLocation((char *)zephyr->exposure), "Couldn't set location"); - - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); - if (!*realm) { - realm = ZGetRealm(); - } - zephyr->realm = g_strdup(realm); - g_strlcpy(__Zephyr_realm, (const char*)zephyr->realm, REALM_SZ-1); - zephyr->username = g_strdup(ZGetSender()); - - /* zephyr->realm = g_strdup(ZGetRealm()); */ - purple_debug_info("zephyr","realm: %s\n",zephyr->realm); - } - else { - purple_connection_error(gc,"Only ZEPH0.2 supported currently"); - return; - } - purple_debug_info("zephyr","does it get here\n"); - purple_debug_info("zephyr"," realm: %s username:%s\n", zephyr->realm, zephyr->username); - - /* For now */ - zephyr->galaxy = NULL; - zephyr->krbtkfile = NULL; - zephyr_inithosts(zephyr); - - if (zephyr_subscribe_to(zephyr,"MESSAGE","PERSONAL",zephyr->username,NULL) != ZERR_NONE) { - /* XXX don't translate this yet. It could be written better */ - /* XXX error messages could be handled with more detail */ - purple_notify_error(account->gc, NULL, - "Unable to subscribe to messages", "Unable to subscribe to initial messages"); - return; - } - - purple_connection_set_state(gc, PURPLE_CONNECTED); - - if (read_anyone) - process_anyone(gc); - if (read_zsubs) - process_zsubs(zephyr); - - if (use_zeph02(zephyr)) { - zephyr->nottimer = purple_timeout_add(100, check_notify_zeph02, gc); - } else if (use_tzc(zephyr)) { - zephyr->nottimer = purple_timeout_add(100, check_notify_tzc, gc); - } - zephyr->loctimer = purple_timeout_add_seconds(20, check_loc, gc); - -} - -static void write_zsubs(zephyr_account *zephyr) -{ - /* Exports subscription (chat) list back to - * .zephyr.subs - * XXX deal with %host%, %canon%, unsubscriptions, and negative subscriptions (punts?) - */ - - GSList *s = zephyr->subscrips; - zephyr_triple *zt; - FILE *fd; - char *fname; - - char **triple; - - fname = g_strdup_printf("%s/.zephyr.subs", purple_home_dir()); - fd = g_fopen(fname, "w"); - - if (!fd) { - g_free(fname); - return; - } - - while (s) { - char *zclass, *zinst, *zrecip; - zt = s->data; - triple = g_strsplit(zt->name, ",", 3); - - /* deal with classes */ - if (!g_ascii_strcasecmp(triple[0],zephyr->ourhost)) { - zclass = g_strdup("%host%"); - } else if (!g_ascii_strcasecmp(triple[0],zephyr->ourhostcanon)) { - zclass = g_strdup("%canon%"); - } else { - zclass = g_strdup(triple[0]); - } - - /* deal with instances */ - - if (!g_ascii_strcasecmp(triple[1],zephyr->ourhost)) { - zinst = g_strdup("%host%"); - } else if (!g_ascii_strcasecmp(triple[1],zephyr->ourhostcanon)) { - zinst = g_strdup("%canon%");; - } else { - zinst = g_strdup(triple[1]); - } - - /* deal with recipients */ - if (triple[2] == NULL) { - zrecip = g_strdup("*"); - } else if (!g_ascii_strcasecmp(triple[2],"")){ - zrecip = g_strdup("*"); - } else if (!g_ascii_strcasecmp(triple[2], zephyr->username)) { - zrecip = g_strdup("%me%"); - } else { - zrecip = g_strdup(triple[2]); - } - - fprintf(fd, "%s,%s,%s\n",zclass,zinst,zrecip); - - g_free(zclass); - g_free(zinst); - g_free(zrecip); - g_free(triple); - s = s->next; - } - g_free(fname); - fclose(fd); -} - -static void write_anyone(PurpleConnection *gc) -{ - GSList *buddies; - char *fname; - FILE *fd; - PurpleAccount *account; - zephyr_account* zephyr = gc->proto_data; - fname = g_strdup_printf("%s/.anyone", purple_home_dir()); - fd = g_fopen(fname, "w"); - if (!fd) { - g_free(fname); - return; - } - - account = purple_connection_get_account(gc); - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *b = buddies->data; - gchar *stripped_user = zephyr_strip_local_realm(zephyr, purple_buddy_get_name(b)); - fprintf(fd, "%s\n", stripped_user); - g_free(stripped_user); - } - - fclose(fd); - g_free(fname); -} - -static void zephyr_close(PurpleConnection * gc) -{ - GList *l; - GSList *s; - zephyr_account *zephyr = gc->proto_data; - pid_t tzc_pid = zephyr->tzc_pid; - - l = zephyr->pending_zloc_names; - while (l) { - g_free((char *)l->data); - l = l->next; - } - g_list_free(zephyr->pending_zloc_names); - - if (purple_account_get_bool(gc->account, "write_anyone", FALSE)) - write_anyone(gc); - - if (purple_account_get_bool(gc->account, "write_zsubs", FALSE)) - write_zsubs(gc->proto_data); - - s = zephyr->subscrips; - while (s) { - free_triple((zephyr_triple *) s->data); - s = s->next; - } - g_slist_free(zephyr->subscrips); - - if (zephyr->nottimer) - purple_timeout_remove(zephyr->nottimer); - zephyr->nottimer = 0; - if (zephyr->loctimer) - purple_timeout_remove(zephyr->loctimer); - zephyr->loctimer = 0; - gc = NULL; - if (use_zeph02(zephyr)) { - z_call(ZCancelSubscriptions(0)); - z_call(ZUnsetLocation()); - z_call(ZClosePort()); - } else { - /* assume tzc */ - if (kill(tzc_pid,SIGTERM) == -1) { - int err=errno; - if (err==EINVAL) { - purple_debug_error("zephyr","An invalid signal was specified when killing tzc\n"); - } - else if (err==ESRCH) { - purple_debug_error("zephyr","Tzc's pid didn't exist while killing tzc\n"); - } - else if (err==EPERM) { - purple_debug_error("zephyr","purple didn't have permission to kill tzc\n"); - } - else { - purple_debug_error("zephyr","miscellaneous error while attempting to close tzc\n"); - } - } - } -} - -static int zephyr_send_message(zephyr_account *zephyr,char* zclass, char* instance, char* recipient, const char *im, - const char *sig, char *opcode) ; - -static const char * zephyr_get_signature(void) -{ - /* XXX add zephyr error reporting */ - const char * sig =ZGetVariable("zwrite-signature"); - if (!sig) { - sig = g_get_real_name(); - } - return sig; -} - -static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, PurpleMessageFlags flags) -{ - zephyr_triple *zt; - const char *sig; - PurpleConversation *gconv1; - PurpleConvChat *gcc; - char *inst; - char *recipient; - zephyr_account *zephyr = gc->proto_data; - - zt = find_sub_by_id(gc->proto_data,id); - if (!zt) - /* this should never happen. */ - return -EINVAL; - - sig = zephyr_get_signature(); - - gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); - gcc = purple_conversation_get_chat_data(gconv1); - - if (!(inst = (char *)purple_conv_chat_get_topic(gcc))) - inst = g_strdup("PERSONAL"); - - if (!g_ascii_strcasecmp(zt->recipient, "*")) - recipient = local_zephyr_normalize(zephyr,""); - else - recipient = local_zephyr_normalize(zephyr,zt->recipient); - - zephyr_send_message(zephyr,zt->class,inst,recipient,im,sig,""); - return 0; -} - - -static int zephyr_send_im(PurpleConnection * gc, const char *who, const char *im, PurpleMessageFlags flags) -{ - const char *sig; - zephyr_account *zephyr = gc->proto_data; - if (flags & PURPLE_MESSAGE_AUTO_RESP) - sig = "Automated reply:"; - else { - sig = zephyr_get_signature(); - } - zephyr_send_message(zephyr,"MESSAGE","PERSONAL",local_zephyr_normalize(zephyr,who),im,sig,""); - - return 1; -} - -/* Munge the outgoing zephyr so that any quotes or backslashes are - escaped and do not confuse tzc: */ - -static char* zephyr_tzc_escape_msg(const char *message) -{ - int pos = 0; - int pos2 = 0; - char *newmsg; - - if (message && (strlen(message) > 0)) { - newmsg = g_new0(char,1+strlen(message)*2); - while(pos < strlen(message)) { - if (message[pos]=='\\') { - newmsg[pos2]='\\'; - newmsg[pos2+1]='\\'; - pos2+=2; - } - else if (message[pos]=='"') { - newmsg[pos2]='\\'; - newmsg[pos2+1]='"'; - pos2+=2; - } - else { - newmsg[pos2] = message[pos]; - pos2++; - } - pos++; - } - } else { - newmsg = g_strdup(""); - } - /* fprintf(stderr,"newmsg %s message %s\n",newmsg,message); */ - return newmsg; -} - -char* zephyr_tzc_deescape_str(const char *message) -{ - int pos = 0; - int pos2 = 0; - char *newmsg; - - if (message && (strlen(message) > 0)) { - newmsg = g_new0(char,strlen(message)+1); - while(pos < strlen(message)) { - if (message[pos]=='\\') { - pos++; - } - newmsg[pos2] = message[pos]; - pos++;pos2++; - } - newmsg[pos2]='\0'; - } else { - newmsg = g_strdup(""); - } - - return newmsg; -} - -static int zephyr_send_message(zephyr_account *zephyr,char* zclass, char* instance, char* recipient, const char *im, - const char *sig, char *opcode) -{ - - /* (From the tzc source) - * emacs sends something of the form: - * ((class . "MESSAGE") - * (auth . t) - * (recipients ("PERSONAL" . "bovik") ("test" . "")) - * (sender . "bovik") - * (message . ("Harry Bovik" "my zgram")) - * ) - */ - char *html_buf; - char *html_buf2; - html_buf = html_to_zephyr(im); - html_buf2 = purple_unescape_html(html_buf); - - if(use_tzc(zephyr)) { - size_t len; - size_t result; - char* zsendstr; - /* CMU cclub tzc doesn't grok opcodes for now */ - char* tzc_sig = zephyr_tzc_escape_msg(sig); - char *tzc_body = zephyr_tzc_escape_msg(html_buf2); - zsendstr = g_strdup_printf("((tzcfodder . send) (class . \"%s\") (auth . t) (recipients (\"%s\" . \"%s\")) (message . (\"%s\" \"%s\")) ) \n", - zclass, instance, recipient, tzc_sig, tzc_body); - /* fprintf(stderr,"zsendstr = %s\n",zsendstr); */ - len = strlen(zsendstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE], zsendstr, len); - if (result != len) { - g_free(zsendstr); - g_free(html_buf2); - g_free(html_buf); - return errno; - } - g_free(zsendstr); - } else if (use_zeph02(zephyr)) { - ZNotice_t notice; - char *buf = g_strdup_printf("%s%c%s", sig, '\0', html_buf2); - memset((char *)¬ice, 0, sizeof(notice)); - - notice.z_kind = ACKED; - notice.z_port = 0; - notice.z_opcode = ""; - notice.z_class = zclass; - notice.z_class_inst = instance; - notice.z_recipient = recipient; - notice.z_sender = 0; - notice.z_default_format = "Class $class, Instance $instance:\n" "To: @bold($recipient) at $time $date\n" "From: @bold($1) <$sender>\n\n$2"; - notice.z_message_len = strlen(html_buf2) + strlen(sig) + 2; - notice.z_message = buf; - notice.z_opcode = g_strdup(opcode); - purple_debug_info("zephyr","About to send notice\n"); - if (! ZSendNotice(¬ice, ZAUTH) == ZERR_NONE) { - /* XXX handle errors here */ - g_free(buf); - g_free(html_buf2); - g_free(html_buf); - return 0; - } - purple_debug_info("zephyr","notice sent\n"); - g_free(buf); - } - - g_free(html_buf2); - g_free(html_buf); - - return 1; -} - -char *local_zephyr_normalize(zephyr_account *zephyr,const char *orig) -{ - /* - Basically the inverse of zephyr_strip_local_realm - */ - char* buf; - - if (!g_ascii_strcasecmp(orig, "")) { - return g_strdup(""); - } - - if (strchr(orig,'@')) { - buf = g_strdup_printf("%s",orig); - } else { - buf = g_strdup_printf("%s@%s",orig,zephyr->realm); - } - return buf; -} - -static const char *zephyr_normalize(const PurpleAccount *account, const char *who) -{ - static char buf[BUF_LEN]; - PurpleConnection *gc; - char *tmp; - - gc = purple_account_get_connection(account); - if (gc == NULL) - return NULL; - - tmp = local_zephyr_normalize(gc->proto_data, who); - - if (strlen(tmp) >= sizeof(buf)) { - g_free(tmp); - return NULL; - } - - strcpy(buf, tmp); - g_free(tmp); - - return buf; -} - -static void zephyr_zloc(PurpleConnection *gc, const char *who) -{ - ZAsyncLocateData_t ald; - zephyr_account *zephyr = gc->proto_data; - gchar* normalized_who = local_zephyr_normalize(zephyr,who); - - if (use_zeph02(zephyr)) { - if (ZRequestLocations(normalized_who, &ald, UNACKED, ZAUTH) == ZERR_NONE) { - zephyr->pending_zloc_names = g_list_append(zephyr->pending_zloc_names, - g_strdup(normalized_who)); - } else { - /* XXX deal with errors somehow */ - } - } else if (use_tzc(zephyr)) { - size_t len; - size_t result; - char* zlocstr = g_strdup_printf("((tzcfodder . zlocate) \"%s\")\n",normalized_who); - zephyr->pending_zloc_names = g_list_append(zephyr->pending_zloc_names, g_strdup(normalized_who)); - len = strlen(zlocstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zlocstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write a message: %s\n", g_strerror(errno)); - } - g_free(zlocstr); - } -} - -static void zephyr_set_status(PurpleAccount *account, PurpleStatus *status) { - size_t len; - size_t result; - zephyr_account *zephyr = purple_account_get_connection(account)->proto_data; - PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); - - if (zephyr->away) { - g_free(zephyr->away); - zephyr->away=NULL; - } - - if (primitive == PURPLE_STATUS_AWAY) { - zephyr->away = g_strdup(purple_status_get_attr_string(status,"message")); - } - else if (primitive == PURPLE_STATUS_AVAILABLE) { - if (use_zeph02(zephyr)) { - ZSetLocation(zephyr->exposure); - } - else { - char *zexpstr = g_strdup_printf("((tzcfodder . set-location) (hostname . \"%s\") (exposure . \"%s\"))\n",zephyr->ourhost,zephyr->exposure); - len = strlen(zexpstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zexpstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write message: %s\n", g_strerror(errno)); - } - g_free(zexpstr); - } - } - else if (primitive == PURPLE_STATUS_INVISIBLE) { - /* XXX handle errors */ - if (use_zeph02(zephyr)) { - ZSetLocation(EXPOSE_OPSTAFF); - } else { - char *zexpstr = g_strdup_printf("((tzcfodder . set-location) (hostname . \"%s\") (exposure . \"%s\"))\n",zephyr->ourhost,EXPOSE_OPSTAFF); - len = strlen(zexpstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zexpstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write message: %s\n", g_strerror(errno)); - } - g_free(zexpstr); - } - } -} - -static GList *zephyr_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - /* zephyr has several exposures - NONE (where you are hidden, and zephyrs to you are in practice silently dropped -- yes this is wrong) - OPSTAFF "hidden" - REALM-VISIBLE visible to people in local realm - REALM-ANNOUNCED REALM-VISIBLE+ plus your logins/logouts are announced to - NET-VISIBLE REALM-ANNOUNCED, plus visible to people in foreign realm - NET-ANNOUNCED NET-VISIBLE, plus logins/logouts are announced to - - Online will set the user to the exposure they have in their options (defaulting to REALM-VISIBLE), - Hidden, will set the user's exposure to OPSTAFF - - Away won't change their exposure but will set an auto away message (for IMs only) - */ - - type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); - types = g_list_append(types,type); - - type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE); - types = g_list_append(types,type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); - types = g_list_append(types,type); - - return types; -} - -static GList *zephyr_chat_info(PurpleConnection * gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - - pce->label = _("_Class:"); - pce->identifier = "class"; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - - pce->label = _("_Instance:"); - pce->identifier = "instance"; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - - pce->label = _("_Recipient:"); - pce->identifier = "recipient"; - m = g_list_append(m, pce); - - return m; -} - -/* Called when the server notifies us a message couldn't get sent */ - -static void zephyr_subscribe_failed(PurpleConnection *gc,char * z_class, char *z_instance, char * z_recipient, char* z_galaxy) -{ - gchar* subscribe_failed = g_strdup_printf(_("Attempt to subscribe to %s,%s,%s failed"), z_class, z_instance,z_recipient); - purple_notify_error(gc,"", subscribe_failed, NULL); - g_free(subscribe_failed); -} - -static char *zephyr_get_chat_name(GHashTable *data) { - gchar* zclass = g_hash_table_lookup(data,"class"); - gchar* inst = g_hash_table_lookup(data,"instance"); - gchar* recipient = g_hash_table_lookup(data, "recipient"); - if (!zclass) /* This should never happen */ - zclass = ""; - if (!inst) - inst = "*"; - if (!recipient) - recipient = ""; - return g_strdup_printf("%s,%s,%s",zclass,inst,recipient); -} - - -static void zephyr_join_chat(PurpleConnection * gc, GHashTable * data) -{ - /* ZSubscription_t sub; */ - zephyr_triple *zt1, *zt2; - const char *classname; - const char *instname; - const char *recip; - zephyr_account *zephyr=gc->proto_data; - classname = g_hash_table_lookup(data, "class"); - instname = g_hash_table_lookup(data, "instance"); - recip = g_hash_table_lookup(data, "recipient"); - - - if (!classname) - return; - - if (!g_ascii_strcasecmp(classname,"%host%")) - classname = g_strdup(zephyr->ourhost); - if (!g_ascii_strcasecmp(classname,"%canon%")) - classname = g_strdup(zephyr->ourhostcanon); - - if (!instname || !strlen(instname)) - instname = "*"; - - if (!g_ascii_strcasecmp(instname,"%host%")) - instname = g_strdup(zephyr->ourhost); - if (!g_ascii_strcasecmp(instname,"%canon%")) - instname = g_strdup(zephyr->ourhostcanon); - - if (!recip || (*recip == '*')) - recip = ""; - if (!g_ascii_strcasecmp(recip, "%me%")) - recip = zephyr->username; - - zt1 = new_triple(gc->proto_data,classname, instname, recip); - zt2 = find_sub_by_triple(gc->proto_data,zt1); - if (zt2) { - free_triple(zt1); - if (!zt2->open) { - if (!g_ascii_strcasecmp(instname,"*")) - instname = "PERSONAL"; - serv_got_joined_chat(gc, zt2->id, zt2->name); - zephyr_chat_set_topic(gc,zt2->id,instname); - zt2->open = TRUE; - } - return; - } - - /* sub.zsub_class = zt1->class; - sub.zsub_classinst = zt1->instance; - sub.zsub_recipient = zt1->recipient; */ - - if (zephyr_subscribe_to(zephyr,zt1->class,zt1->instance,zt1->recipient,NULL) != ZERR_NONE) { - /* XXX output better subscription information */ - zephyr_subscribe_failed(gc,zt1->class,zt1->instance,zt1->recipient,NULL); - free_triple(zt1); - return; - } - - zephyr->subscrips = g_slist_append(zephyr->subscrips, zt1); - zt1->open = TRUE; - serv_got_joined_chat(gc, zt1->id, zt1->name); - if (!g_ascii_strcasecmp(instname,"*")) - instname = "PERSONAL"; - zephyr_chat_set_topic(gc,zt1->id,instname); -} - -static void zephyr_chat_leave(PurpleConnection * gc, int id) -{ - zephyr_triple *zt; - zephyr_account *zephyr = gc->proto_data; - zt = find_sub_by_id(zephyr,id); - - if (zt) { - zt->open = FALSE; - zt->id = ++(zephyr->last_id); - } -} - -static PurpleChat *zephyr_find_blist_chat(PurpleAccount *account, const char *name) -{ - PurpleBlistNode *gnode, *cnode; - - /* XXX needs to be %host%,%canon%, and %me% clean */ - for(gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - for(cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - PurpleChat *chat = (PurpleChat*)cnode; - char *zclass, *inst, *recip; - char** triple; - GHashTable *components; - if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) - continue; - if(purple_chat_get_account(chat) != account) - continue; - components = purple_chat_get_components(chat); - if(!(zclass = g_hash_table_lookup(components, "class"))) - continue; - if(!(inst = g_hash_table_lookup(components, "instance"))) - inst = g_strdup(""); - if(!(recip = g_hash_table_lookup(components, "recipient"))) - recip = g_strdup(""); - /* purple_debug_info("zephyr","in zephyr_find_blist_chat name: %s\n",name?name:""); */ - triple = g_strsplit(name,",",3); - if (!g_ascii_strcasecmp(triple[0],zclass) && !g_ascii_strcasecmp(triple[1],inst) && !g_ascii_strcasecmp(triple[2],recip)) - return chat; - - } - } - return NULL; -} -static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b) -{ - return "zephyr"; -} - -static unsigned int zephyr_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { - gchar *recipient; - zephyr_account *zephyr = gc->proto_data; - if (use_tzc(zephyr)) - return 0; - - if (state == PURPLE_NOT_TYPING) - return 0; - - /* XXX We probably should care if this fails. Or maybe we don't want to */ - if (!who) { - purple_debug_info("zephyr", "who is null\n"); - recipient = local_zephyr_normalize(zephyr,""); - } else { - char *comma = strrchr(who, ','); - /* Don't ping broadcast (chat) recipients */ - /* The strrchr case finds a realm-stripped broadcast subscription - e.g. comma is the last character in the string */ - if (comma && ( (*(comma+1) == '\0') || (*(comma+1) == '@'))) - return 0; - - recipient = local_zephyr_normalize(zephyr,who); - } - - purple_debug_info("zephyr","about to send typing notification to %s\n",recipient); - zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,"","","PING"); - purple_debug_info("zephyr","sent typing notification\n"); - - /* - * TODO: Is this correct? It means we will call - * serv_send_typing(gc, who, PURPLE_TYPING) once every 15 seconds - * until the Purple user stops typing. - */ - return ZEPHYR_TYPING_SEND_TIMEOUT; -} - - - -static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *topic) -{ - zephyr_triple *zt; - PurpleConversation *gconv; - PurpleConvChat *gcc; - gchar *topic_utf8; - zephyr_account* zephyr = gc->proto_data; - char *sender = (char *)zephyr->username; - - zt = find_sub_by_id(gc->proto_data,id); - /* find_sub_by_id can return NULL */ - if (!zt) - return; - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); - gcc = purple_conversation_get_chat_data(gconv); - - topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic); - purple_conv_chat_set_topic(gcc,sender,topic_utf8); - g_free(topic_utf8); - return; -} - -/* commands */ - -static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - char *recipient; - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if (!g_ascii_strcasecmp(args[0],"*")) - return PURPLE_CMD_RET_FAILED; /* "*" is not a valid argument */ - else - recipient = local_zephyr_normalize(zephyr,args[0]); - - if (strlen(recipient) < 1) - return PURPLE_CMD_RET_FAILED; /* a null recipient is a chat message, not an IM */ - - if (zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,args[1],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zlocate(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - zephyr_zloc(purple_conversation_get_gc(conv),args[0]); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet zephyr_purple_cmd_instance(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* Currently it sets the instance with leading spaces and - * all. This might not be the best thing to do, though having - * one word isn't ideal either. */ - - PurpleConvChat *gcc = purple_conversation_get_chat_data(conv); - int id = gcc->id; - const char* instance = args[0]; - zephyr_chat_set_topic(purple_conversation_get_gc(conv),id,instance); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet zephyr_purple_cmd_joinchat_cir(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* Join a new zephyr chat */ - GHashTable *triple = g_hash_table_new(NULL,NULL); - g_hash_table_insert(triple,"class",args[0]); - g_hash_table_insert(triple,"instance",args[1]); - g_hash_table_insert(triple,"recipient",args[2]); - zephyr_join_chat(purple_conversation_get_gc(conv),triple); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet zephyr_purple_cmd_zi(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,"message",args[0],"",args[1],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zci(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = class, instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,args[0],args[1],"",args[2],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zcir(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = class, instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,args[0],args[1],args[2],args[3],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zir(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,"message",args[0],args[1],args[2],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zc(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = class, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,args[0],"PERSONAL","",args[1],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static void zephyr_register_slash_commands(void) -{ - - purple_cmd_register("msg","ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_msg, _("msg <nick> <message>: Send a private message to a user"), NULL); - - purple_cmd_register("zlocate","w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zlocate, _("zlocate <nick>: Locate user"), NULL); - - purple_cmd_register("zl","w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zlocate, _("zl <nick>: Locate user"), NULL); - - purple_cmd_register("instance","s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_instance, _("instance <instance>: Set the instance to be used on this class"), NULL); - - purple_cmd_register("inst","s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_instance, _("inst <instance>: Set the instance to be used on this class"), NULL); - - purple_cmd_register("topic","s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_instance, _("topic <instance>: Set the instance to be used on this class"), NULL); - - purple_cmd_register("sub", "www", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_joinchat_cir, - _("sub <class> <instance> <recipient>: Join a new chat"), NULL); - - purple_cmd_register("zi","ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zi, _("zi <instance>: Send a message to <message,instance,*>"), NULL); - - purple_cmd_register("zci","wws",PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zci, - _("zci <class> <instance>: Send a message to <class,instance,*>"), NULL); - - purple_cmd_register("zcir","wwws",PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zcir, - _("zcir <class> <instance> <recipient>: Send a message to <class,instance,recipient>"), NULL); - - purple_cmd_register("zir","wws",PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zir, - _("zir <instance> <recipient>: Send a message to <MESSAGE,instance,recipient>"), NULL); - - purple_cmd_register("zc","ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zc, _("zc <class>: Send a message to <class,PERSONAL,*>"), NULL); - -} - - -static int zephyr_resubscribe(PurpleConnection *gc) -{ - /* Resubscribe to the in-memory list of subscriptions and also - unsubscriptions*/ - zephyr_account *zephyr = gc->proto_data; - GSList *s = zephyr->subscrips; - zephyr_triple *zt; - while (s) { - zt = s->data; - /* XXX We really should care if this fails */ - zephyr_subscribe_to(zephyr,zt->class,zt->instance,zt->recipient,NULL); - s = s->next; - } - /* XXX handle unsubscriptions */ - return 1; -} - - -static void zephyr_action_resubscribe(PurplePluginAction *action) -{ - - PurpleConnection *gc = (PurpleConnection *) action->context; - zephyr_resubscribe(gc); -} - - -static void zephyr_action_get_subs_from_server(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - zephyr_account *zephyr = gc->proto_data; - gchar *title; - int retval, nsubs, one,i; - ZSubscription_t subs; - if (use_zeph02(zephyr)) { - GString* subout = g_string_new("Subscription list
"); - - title = g_strdup_printf("Server subscriptions for %s", zephyr->username); - - if (zephyr->port == 0) { - purple_debug_error("zephyr", "error while retrieving port\n"); - return; - } - if ((retval = ZRetrieveSubscriptions(zephyr->port,&nsubs)) != ZERR_NONE) { - /* XXX better error handling */ - purple_debug_error("zephyr", "error while retrieving subscriptions from server\n"); - return; - } - for(i=0;i", - subs.zsub_class, subs.zsub_classinst, - subs.zsub_recipient); - } - purple_notify_formatted(gc, title, title, NULL, subout->str, NULL, NULL); - } else { - /* XXX fix */ - purple_notify_error(gc,"","tzc doesn't support this action",NULL); - } -} - - -static GList *zephyr_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act = NULL; - - act = purple_plugin_action_new(_("Resubscribe"), zephyr_action_resubscribe); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Retrieve subscriptions from server"), zephyr_action_get_subs_from_server); - list = g_list_append(list,act); - - return list; -} - -static PurplePlugin *my_protocol = NULL; - -static PurplePluginProtocolInfo prpl_info = { - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD, - NULL, /* ??? user_splits */ - NULL, /* ??? protocol_options */ - NO_BUDDY_ICONS, - zephyr_list_icon, - NULL, /* ??? list_emblems */ - NULL, /* ??? status_text */ - NULL, /* ??? tooltip_text */ - zephyr_status_types, /* status_types */ - NULL, /* ??? blist_node_menu - probably all useful actions are already handled*/ - zephyr_chat_info, /* chat_info */ - NULL, /* chat_info_defaults */ - zephyr_login, /* login */ - zephyr_close, /* close */ - zephyr_send_im, /* send_im */ - NULL, /* XXX set info (Location?) */ - zephyr_send_typing, /* send_typing */ - zephyr_zloc, /* get_info */ - zephyr_set_status, /* set_status */ - NULL, /* ??? set idle */ - NULL, /* change password */ - NULL, /* add_buddy */ - NULL, /* add_buddies */ - NULL, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* remove_permit */ - NULL, /* remove_deny */ - NULL, /* set_permit_deny */ - zephyr_join_chat, /* join_chat */ - NULL, /* reject_chat -- No chat invites*/ - zephyr_get_chat_name, /* get_chat_name */ - NULL, /* chat_invite -- No chat invites*/ - zephyr_chat_leave, /* chat_leave */ - NULL, /* chat_whisper -- No "whispering"*/ - zephyr_chat_send, /* chat_send */ - NULL, /* keepalive -- Not necessary*/ - NULL, /* register_user -- Not supported*/ - NULL, /* XXX get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - zephyr_normalize, /* normalize */ - NULL, /* XXX set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* XXX get_cb_real_name */ - zephyr_chat_set_topic, /* set_chat_topic */ - zephyr_find_blist_chat, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - - NULL, - NULL, - NULL, - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-zephyr", /**< id */ - "Zephyr", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Zephyr Protocol Plugin"), - /** description */ - N_("Zephyr Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - zephyr_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void init_plugin(PurplePlugin * plugin) -{ - PurpleAccountOption *option; - char *tmp = get_exposure_level(); - - option = purple_account_option_bool_new(_("Use tzc"), "use_tzc", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("tzc command"), "tzc_command", "/usr/bin/tzc -e %s"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Export to .anyone"), "write_anyone", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Export to .zephyr.subs"), "write_zsubs", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Import from .anyone"), "read_anyone", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Import from .zephyr.subs"), "read_zsubs", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Realm"), "realm", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Exposure"), "exposure_level", tmp?tmp: EXPOSE_REALMVIS); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encoding"), "encoding", ZEPHYR_FALLBACK_CHARSET); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - my_protocol = plugin; - zephyr_register_slash_commands(); -} - -PURPLE_INIT_PLUGIN(zephyr, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -#include "zephyr_err.h" - -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - -static const char * const text[] = { - "Packet too long or buffer too small", - "Notice header too large", - "Illegal value in notice", - "Can't get host manager port", - "Can't assign port", - "Bad packet format", - "Incompatible version numbers", - "No port opened", - "No notices match criteria", - "Input queue too long", - "Hostmanager not responding", - "Internal error", - "No previous call to ZLocateUser", - "No more locations available", - "Field too long for buffer", - "Improperly formatted field", - "SERVNAK received", - "Server could not verify authentication", - "Not logged-in", - "No previous call to ZRetrieveSubscriptions", - "No more subscriptions available", - "Too many subscriptions to transmit", - "End of file detected during read", - 0 -}; - -struct error_table { - char const * const * msgs; - long base; - int n_msgs; -}; -struct et_list { - struct et_list *next; - const struct error_table * table; -}; -extern struct et_list *_et_list; - -static const struct error_table et = { text, -772103680L, 23 }; - -static struct et_list link = { 0, 0 }; - -void initialize_zeph_error_table (NOARGS) { - if (!link.table) { - link.next = _et_list; - link.table = &et; - _et_list = &link; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_err.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* - * zephyr_err.h: - * This file is automatically generated; please do not edit it. - */ -#define ZERR_PKTLEN (-772103680L) -#define ZERR_HEADERLEN (-772103679L) -#define ZERR_ILLVAL (-772103678L) -#define ZERR_HMPORT (-772103677L) -#define ZERR_PORTINUSE (-772103676L) -#define ZERR_BADPKT (-772103675L) -#define ZERR_VERS (-772103674L) -#define ZERR_NOPORT (-772103673L) -#define ZERR_NONOTICE (-772103672L) -#define ZERR_QLEN (-772103671L) -#define ZERR_HMDEAD (-772103670L) -#define ZERR_INTERNAL (-772103669L) -#define ZERR_NOLOCATIONS (-772103668L) -#define ZERR_NOMORELOCS (-772103667L) -#define ZERR_FIELDLEN (-772103666L) -#define ZERR_BADFIELD (-772103665L) -#define ZERR_SERVNAK (-772103664L) -#define ZERR_AUTHFAIL (-772103663L) -#define ZERR_LOGINFAIL (-772103662L) -#define ZERR_NOSUBSCRIPTIONS (-772103661L) -#define ZERR_NOMORESUBSCRIPTIONS (-772103660L) -#define ZERR_TOOMANYSUBS (-772103659L) -#define ZERR_EOF (-772103658L) -void initialize_zeph_error_table (void); -#define ERROR_TABLE_BASE_zeph (-772103680L) - -/* for compatibility with older versions... */ -#define init_zeph_err_tbl initialize_zeph_error_table -#define zeph_err_base ERROR_TABLE_BASE_zeph diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/zephyr_internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,339 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains global definitions - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of - * Technology. For copying and distribution information, see the - * file "mit-copyright.h". - */ - -#ifndef __ZEPHYR_H__ -#define __ZEPHYR_H__ - -#include - -#include - -#include -#include - -#include - -#ifndef IPPROTO_MAX /* Make sure not already included */ -#ifndef WIN32 -#include -#endif -#endif - -/* Use __STDC__ to guess whether we can use stdarg, prototypes, and const. - * This is a public header file, so autoconf can't help us here. */ -#ifdef __STDC__ -# include -# define ZP(x) x -# define ZCONST const -#else -# define ZP(x) () -# define ZCONST -#endif - -#ifdef WIN32 -/* this really should be uint32_t */ -/*typedef unsigned int in_addr_t; -struct in_addr -{ - in_addr_t s_addr; -}; */ -#include -#endif - -/* Service names */ -#define HM_SVCNAME "zephyr-hm" -#define HM_SRV_SVCNAME "zephyr-hm-srv" -#define SERVER_SVCNAME "zephyr-clt" -#define SERVER_SERVICE "zephyr" -#define SERVER_INSTANCE "zephyr" - -#define ZVERSIONHDR "ZEPH" -#define ZVERSIONMAJOR 0 -#define ZVERSIONMINOR 2 - -#define Z_MAXPKTLEN 1024 -#define Z_MAXHEADERLEN 800 -#define Z_MAXOTHERFIELDS 10 /* Max unknown fields in ZNotice_t */ -#define Z_NUMFIELDS 17 - -/* Authentication levels returned by ZCheckAuthentication */ -#define ZAUTH_FAILED (-1) -#define ZAUTH_YES 1 -#define ZAUTH_NO 0 - -typedef char ZPacket_t[Z_MAXPKTLEN]; - -/* Packet type */ -typedef enum { - UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT -} ZNotice_Kind_t; -extern ZCONST char *ZNoticeKinds[9]; - -/* Unique ID format */ -typedef struct _ZUnique_Id_t { - struct in_addr zuid_addr; - struct timeval tv; -} ZUnique_Id_t; - -/* Checksum */ -typedef unsigned long ZChecksum_t; - -/* Notice definition */ -typedef struct _ZNotice_t { - char *z_packet; - char *z_version; - ZNotice_Kind_t z_kind; - ZUnique_Id_t z_uid; -#define z_sender_addr z_uid.zuid_addr - struct timeval z_time; - unsigned short z_port; - int z_auth; - int z_checked_auth; - int z_authent_len; - char *z_ascii_authent; - char *z_class; - const char *z_class_inst; - char *z_opcode; - char *z_sender; - const char *z_recipient; - char *z_default_format; - char *z_multinotice; - ZUnique_Id_t z_multiuid; - ZChecksum_t z_checksum; - int z_num_other_fields; - char *z_other_fields[Z_MAXOTHERFIELDS]; - caddr_t z_message; - int z_message_len; -} ZNotice_t; - -/* Subscription structure */ -typedef struct _ZSubscriptions_t { - char *zsub_recipient; - char *zsub_class; - char *zsub_classinst; -} ZSubscription_t; - -/* Function return code */ -typedef int Code_t; - -/* Locations structure */ -typedef struct _ZLocations_t { - char *host; - char *time; - char *tty; -} ZLocations_t; - -typedef struct _ZAsyncLocateData_t { - char *user; - ZUnique_Id_t uid; - char *version; -} ZAsyncLocateData_t; - -/* for ZSetDebug */ -#ifdef Z_DEBUG -void (*__Z_debug_print) ZP((ZCONST char *fmt, va_list args, void *closure)); -void *__Z_debug_print_closure; -#endif - -int ZCompareUIDPred ZP((ZNotice_t *, void *)); -int ZCompareMultiUIDPred ZP((ZNotice_t *, void *)); - -/* Defines for ZFormatNotice, et al. */ -typedef Code_t (*Z_AuthProc) ZP((ZNotice_t*, char *, int, int *)); -Code_t ZMakeAuthentication ZP((ZNotice_t*, char *,int, int*)); - -char *ZGetSender ZP((void)); -char *ZGetVariable ZP((char *)); -Code_t ZSetVariable ZP((char *var, char *value)); -Code_t ZUnsetVariable ZP((char *var)); -int ZGetWGPort ZP((void)); -Code_t ZSetDestAddr ZP((struct sockaddr_in *)); -Code_t ZFormatNoticeList ZP((ZNotice_t*, char**, int, - char **, int*, Z_AuthProc)); -Code_t ZParseNotice ZP((char*, int, ZNotice_t *)); -Code_t ZReadAscii ZP((char*, int, unsigned char*, int)); -Code_t ZReadAscii32 ZP((char *, int, unsigned long *)); -Code_t ZReadAscii16 ZP((char *, int, unsigned short *)); -Code_t ZSendPacket ZP((char*, int, int)); -Code_t ZSendList ZP((ZNotice_t*, char *[], int, Z_AuthProc)); -Code_t ZSrvSendList ZP((ZNotice_t*, char*[], int, Z_AuthProc, Code_t (*)())); -Code_t ZSendNotice ZP((ZNotice_t *, Z_AuthProc)); -Code_t ZSrvSendNotice ZP((ZNotice_t*, Z_AuthProc, Code_t (*)())); -Code_t ZFormatNotice ZP((ZNotice_t*, char**, int*, Z_AuthProc)); -Code_t ZFormatSmallNotice ZP((ZNotice_t*, ZPacket_t, int*, Z_AuthProc)); -Code_t ZFormatRawNoticeList ZP((ZNotice_t *notice, char *list[], int nitems, - char **buffer, int *ret_len)); -Code_t ZLocateUser ZP((char *, int *, Z_AuthProc)); -Code_t ZRequestLocations ZP((const char *, ZAsyncLocateData_t *, - ZNotice_Kind_t, Z_AuthProc)); -Code_t ZhmStat ZP((struct in_addr *, ZNotice_t *)); -Code_t ZInitialize ZP((void)); -Code_t ZSetServerState ZP((int)); -Code_t ZSetFD ZP((int)); -Code_t ZFormatSmallRawNotice ZP((ZNotice_t*, ZPacket_t, int*)); -int ZCompareUID ZP((ZUnique_Id_t*, ZUnique_Id_t*)); -Code_t ZMakeAscii ZP((char*, int, unsigned char*, int)); -Code_t ZMakeAscii32 ZP((char *, int, unsigned long)); -Code_t ZMakeAscii16 ZP((char *, int, unsigned int)); -Code_t ZReceivePacket ZP((ZPacket_t, int*, struct sockaddr_in*)); -Code_t ZCheckAuthentication ZP((ZNotice_t*, struct sockaddr_in*)); -Code_t ZSetLocation ZP((char *exposure)); -Code_t ZUnsetLocation ZP((void)); -Code_t ZFlushMyLocations ZP((void)); -Code_t ZFormatRawNotice ZP((ZNotice_t *, char**, int *)); -Code_t ZRetrieveSubscriptions ZP((unsigned short, int*)); -Code_t ZOpenPort ZP((unsigned short *port)); -Code_t ZClosePort ZP((void)); -Code_t ZFlushLocations ZP((void)); -Code_t ZFlushSubscriptions ZP((void)); -Code_t ZFreeNotice ZP((ZNotice_t *notice)); -Code_t ZParseLocations ZP((register ZNotice_t *notice, - register ZAsyncLocateData_t *zald, int *nlocs, - char **user)); -int ZCompareALDPred ZP((ZNotice_t *notice, void *zald)); -void ZFreeALD ZP((register ZAsyncLocateData_t *zald)); -Code_t ZCheckIfNotice ZP((ZNotice_t *notice, struct sockaddr_in *from, - register int (*predicate) ZP((ZNotice_t *,void *)), - void *args)); -Code_t ZPeekPacket ZP((char **buffer, int *ret_len, - struct sockaddr_in *from)); -Code_t ZPeekNotice ZP((ZNotice_t *notice, struct sockaddr_in *from)); -Code_t ZIfNotice ZP((ZNotice_t *notice, struct sockaddr_in *from, - int (*predicate) ZP((ZNotice_t *, void *)), void *args)); -Code_t ZSubscribeTo ZP((ZSubscription_t *sublist, int nitems, - unsigned int port)); -Code_t ZSubscribeToSansDefaults ZP((ZSubscription_t *sublist, int nitems, - unsigned int port)); -Code_t ZUnsubscribeTo ZP((ZSubscription_t *sublist, int nitems, - unsigned int port)); -Code_t ZCancelSubscriptions ZP((unsigned int port)); -int ZPending ZP((void)); -Code_t ZReceiveNotice ZP((ZNotice_t *notice, struct sockaddr_in *from)); -#ifdef Z_DEBUG -void Z_debug ZP((ZCONST char *, ...)); -#endif - -#undef ZP - -/* Compatibility */ -#define ZNewLocateUser ZLocateUser - -/* Macros to retrieve Zephyr library values. */ -extern int __Zephyr_fd; -extern int __Q_CompleteLength; -extern struct sockaddr_in __HM_addr; -extern char __Zephyr_realm[]; -#define ZGetFD() __Zephyr_fd -#define ZQLength() __Q_CompleteLength -#define ZGetDestAddr() __HM_addr -#define ZGetRealm() __Zephyr_realm - -#ifdef Z_DEBUG -void ZSetDebug ZP((void (*)(ZCONST char *, va_list, void *), void *)); -#define ZSetDebug(proc,closure) (__Z_debug_print=(proc), \ - __Z_debug_print_closure=(closure), \ - (void) 0) -#else -#define ZSetDebug(proc,closure) -#endif - -/* Maximum queue length */ -#define Z_MAXQLEN 30 - -/* Successful function return */ -#define ZERR_NONE 0 - -/* Hostmanager wait time (in secs) */ -#define HM_TIMEOUT 1 - -/* Server wait time (in secs) */ -#define SRV_TIMEOUT 30 - -#define ZAUTH (ZMakeAuthentication) -#define ZNOAUTH ((Z_AuthProc)0) - -/* Packet strings */ -#define ZSRVACK_SENT "SENT" /* SERVACK codes */ -#define ZSRVACK_NOTSENT "LOST" -#define ZSRVACK_FAIL "FAIL" - -/* Server internal class */ -#define ZEPHYR_ADMIN_CLASS "ZEPHYR_ADMIN" /* Class */ - -/* Control codes sent to a server */ -#define ZEPHYR_CTL_CLASS "ZEPHYR_CTL" /* Class */ - -#define ZEPHYR_CTL_CLIENT "CLIENT" /* Inst: From client */ -#define CLIENT_SUBSCRIBE "SUBSCRIBE" /* Opcode: Subscribe */ -#define CLIENT_SUBSCRIBE_NODEFS "SUBSCRIBE_NODEFS" /* Opcode: Subscribe */ -#define CLIENT_UNSUBSCRIBE "UNSUBSCRIBE" /* Opcode: Unsubsubscribe */ -#define CLIENT_CANCELSUB "CLEARSUB" /* Opcode: Clear all subs */ -#define CLIENT_GIMMESUBS "GIMME" /* Opcode: Give me subs */ -#define CLIENT_GIMMEDEFS "GIMMEDEFS" /* Opcode: Give me default - * subscriptions */ - -#define ZEPHYR_CTL_HM "HM" /* Inst: From HM */ -#define HM_BOOT "BOOT" /* Opcode: Boot msg */ -#define HM_FLUSH "FLUSH" /* Opcode: Flush me */ -#define HM_DETACH "DETACH" /* Opcode: Detach me */ -#define HM_ATTACH "ATTACH" /* Opcode: Attach me */ - -/* Control codes send to a HostManager */ -#define HM_CTL_CLASS "HM_CTL" /* Class */ - -#define HM_CTL_SERVER "SERVER" /* Inst: From server */ -#define SERVER_SHUTDOWN "SHUTDOWN" /* Opcode: Server shutdown */ -#define SERVER_PING "PING" /* Opcode: PING */ - -#define HM_CTL_CLIENT "CLIENT" /* Inst: From client */ -#define CLIENT_FLUSH "FLUSH" /* Opcode: Send flush to srv */ -#define CLIENT_NEW_SERVER "NEWSERV" /* Opcode: Find new server */ - -/* HM Statistics */ -#define HM_STAT_CLASS "HM_STAT" /* Class */ - -#define HM_STAT_CLIENT "HMST_CLIENT" /* Inst: From client */ -#define HM_GIMMESTATS "GIMMESTATS" /* Opcode: get stats */ - -/* Login class messages */ -#define LOGIN_CLASS "LOGIN" /* Class */ - -/* Class Instance is principal of user who is logging in or logging out */ - -#define EXPOSE_NONE "NONE" /* Opcode: Not visible */ -#define EXPOSE_OPSTAFF "OPSTAFF" /* Opcode: Opstaff visible */ -#define EXPOSE_REALMVIS "REALM-VISIBLE" /* Opcode: Realm visible */ -#define EXPOSE_REALMANN "REALM-ANNOUNCED"/* Opcode: Realm announced */ -#define EXPOSE_NETVIS "NET-VISIBLE" /* Opcode: Net visible */ -#define EXPOSE_NETANN "NET-ANNOUNCED" /* Opcode: Net announced */ -#define LOGIN_USER_LOGIN "USER_LOGIN" /* Opcode: user login - (from server) */ -#define LOGIN_USER_LOGOUT "USER_LOGOUT" /* Opcode: User logout */ -#define LOGIN_USER_FLUSH "USER_FLUSH" /* Opcode: flush all locs */ - -/* Locate class messages */ -#define LOCATE_CLASS "USER_LOCATE" /* Class */ - -#define LOCATE_HIDE "USER_HIDE" /* Opcode: Hide me */ -#define LOCATE_UNHIDE "USER_UNHIDE" /* Opcode: Unhide me */ - -/* Class Instance is principal of user to locate */ -#define LOCATE_LOCATE "LOCATE" /* Opcode: Locate user */ - -/* WG_CTL class messages */ -#define WG_CTL_CLASS "WG_CTL" /* Class */ - -#define WG_CTL_USER "USER" /* Inst: User request */ -#define USER_REREAD "REREAD" /* Opcode: Reread desc file */ -#define USER_SHUTDOWN "SHUTDOWN" /* Opcode: Go catatonic */ -#define USER_STARTUP "STARTUP" /* Opcode: Come out of it */ -#define USER_EXIT "EXIT" /* Opcode: Exit the client */ - -#endif /* __ZEPHYR_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsLocs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsLocs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsLocs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsLocs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFlushLocations function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFlushLocations() -{ - int i; - - if (!__locate_list) - return (ZERR_NONE); - - for (i=0;i<__locate_num;i++) { - free(__locate_list[i].host); - free(__locate_list[i].time); - free(__locate_list[i].tty); - } - - free((char *)__locate_list); - - __locate_list = 0; - __locate_num = 0; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFlsSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFlushSubscriptions function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFlushSubscriptions() -{ - register int i; - - if (!__subscriptions_list) - return (ZERR_NONE); - - for (i=0;i<__subscriptions_num;i++) { - free(__subscriptions_list[i].zsub_class); - free(__subscriptions_list[i].zsub_classinst); - free(__subscriptions_list[i].zsub_recipient); - } - - free((char *)__subscriptions_list); - - __subscriptions_list = 0; - __subscriptions_num = 0; - - return (ZERR_NONE); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtAuth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtAuth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtAuth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtAuth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatAuthenticNotice function. - * - * Created by: Robert French - - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifdef ZEPHYR_USES_KERBEROS -Code_t ZFormatAuthenticNotice(notice, buffer, buffer_len, len, session) - ZNotice_t *notice; - register char *buffer; - register int buffer_len; - int *len; - C_Block session; -{ - ZNotice_t newnotice; - char *ptr; - int retval, hdrlen; - - newnotice = *notice; - newnotice.z_auth = 1; - newnotice.z_authent_len = 0; - newnotice.z_ascii_authent = ""; - - if ((retval = Z_FormatRawHeader(&newnotice, buffer, buffer_len, - &hdrlen, &ptr, NULL)) != ZERR_NONE) - return (retval); - -#ifdef NOENCRYPTION - newnotice.z_checksum = 0; -#else - newnotice.z_checksum = - (ZChecksum_t)des_quad_cksum(buffer, NULL, ptr - buffer, 0, (C_Block*)session); -#endif - if ((retval = Z_FormatRawHeader(&newnotice, buffer, buffer_len, - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - ptr = buffer+hdrlen; - - if (newnotice.z_message_len+hdrlen > buffer_len) - return (ZERR_PKTLEN); - - (void) memcpy(ptr, newnotice.z_message, newnotice.z_message_len); - - *len = hdrlen+newnotice.z_message_len; - - if (*len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - return (ZERR_NONE); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtList.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtList.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtList.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtList.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatNoticeList function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFormatNoticeList(notice, list, nitems, buffer, ret_len, - cert_routine) - ZNotice_t *notice; - register char **list; - int nitems; - char **buffer; - int *ret_len; - Z_AuthProc cert_routine; -{ - char header[Z_MAXHEADERLEN]; - register int i; - int hdrlen, size; - char *ptr; - Code_t retval; - - if ((retval = Z_FormatHeader(notice, header, sizeof(header), &hdrlen, - cert_routine)) != ZERR_NONE) - return (retval); - - size = 0; - for (i=0;iz_message_len; - - /* Length can never be zero, don't have to worry about malloc(0). */ - if (!(*buffer = (char *) malloc((unsigned)*ret_len))) - return (ENOMEM); - - (void) memcpy(*buffer, header, hdrlen); - (void) memcpy(*buffer+hdrlen, notice->z_message, notice->z_message_len); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRaw.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRaw.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRaw.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRaw.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatRawNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFormatRawNotice(notice, buffer, ret_len) - register ZNotice_t *notice; - char **buffer; - int *ret_len; -{ - char header[Z_MAXHEADERLEN]; - int hdrlen; - Code_t retval; - - if ((retval = Z_FormatRawHeader(notice, header, sizeof(header), - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - *ret_len = hdrlen+notice->z_message_len; - - /* *ret_len is never 0, don't have to worry about malloc(0) */ - if (!(*buffer = (char *) malloc((unsigned) *ret_len))) - return (ENOMEM); - - (void) memcpy(*buffer, header, hdrlen); - (void) memcpy(*buffer+hdrlen, notice->z_message, notice->z_message_len); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRawLst.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRawLst.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRawLst.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtRawLst.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatRawNoticeList function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFormatRawNoticeList(notice, list, nitems, buffer, ret_len) - ZNotice_t *notice; - char *list[]; - int nitems; - char **buffer; - int *ret_len; -{ - char header[Z_MAXHEADERLEN]; - int hdrlen, i, size; - char *ptr; - Code_t retval; - - if ((retval = Z_FormatRawHeader(notice, header, sizeof(header), - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - size = 0; - for (i=0;iz_message_len; - - if (*ret_len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - (void) memcpy(buffer+hdrlen, notice->z_message, notice->z_message_len); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtSmRLst.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtSmRLst.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtSmRLst.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFmtSmRLst.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatSmallRawNoticeList function. - * - * Created by: John T. Kohl - * - * Copyright (c) 1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZFormatSmallRawNoticeList(notice, list, nitems, buffer, ret_len) - ZNotice_t *notice; - char *list[]; - int nitems; - ZPacket_t buffer; - int *ret_len; -{ - Code_t retval; - int hdrlen, i, size; - char *ptr; - - if ((retval = Z_FormatRawHeader(notice, buffer, Z_MAXHEADERLEN, - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - size = 0; - for (i=0;i Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - ptr = buffer+hdrlen; - - for (;nitems;nitems--, list++) { - i = strlen(*list)+1; - (void) memcpy(ptr, *list, i); - ptr += i; - } - - return (ZERR_NONE); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFreeNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFreeNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFreeNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZFreeNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFreeNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFreeNotice(notice) - ZNotice_t *notice; -{ - free(notice->z_packet); - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetLocs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetLocs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetLocs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetLocs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZGetLocations function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#define min(a,b) ((a)<(b)?(a):(b)) - -/* Prototype for -Wmissing-prototypes */ -Code_t ZGetLocations(ZLocations_t *location, int *numlocs); - -Code_t ZGetLocations(ZLocations_t *location, int *numlocs) -{ - int i; - - if (!__locate_list) - return (ZERR_NOLOCATIONS); - - if (__locate_next == __locate_num) - return (ZERR_NOMORELOCS); - - for (i=0;i -#endif - -char *ZGetSender() -{ - struct passwd *pw; -#ifdef ZEPHYR_USES_KERBEROS - char pname[ANAME_SZ]; - char pinst[INST_SZ]; - char prealm[REALM_SZ]; - static char sender[ANAME_SZ+INST_SZ+REALM_SZ+3] = ""; - long int kerror; -#else - static char sender[128] = ""; -#endif - -#ifdef WIN32 - unsigned long sender_size = sizeof(sender) - 1; -#endif - -#ifdef ZEPHYR_USES_KERBEROS - if ((kerror = krb_get_tf_fullname((char *)TKT_FILE, pname, pinst, prealm)) == KSUCCESS) - { - sprintf(sender, "%s%s%s@%s", pname, (pinst[0] ? "." : ""), pinst, prealm); - return sender; - } -#endif - -#ifdef WIN32 - GetUserName(sender, &sender_size); -#else - /* XXX a uid_t is a u_short (now), but getpwuid - * wants an int. AARGH! */ - pw = getpwuid((int) getuid()); - if (!pw) - return ("unknown"); - sprintf(sender, "%s@%s", pw->pw_name, __Zephyr_realm); -#endif - return sender; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZGetSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZGetSubscriptions function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#define min(a,b) ((a)<(b)?(a):(b)) - -/* Prototype for -Wmissing-prototypes */ -Code_t ZGetSubscriptions(ZSubscription_t *subscription, int *numsubs); - -Code_t ZGetSubscriptions(ZSubscription_t *subscription, int *numsubs) -{ - int i; - - if (!__subscriptions_list) - return (ZERR_NOSUBSCRIPTIONS); - - if (__subscriptions_next == __subscriptions_num) - return (ZERR_NOMORESUBSCRIPTIONS); - - for (i=0;i -#else -#include -#endif - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK 0x7f000001 -#endif - -Code_t ZhmStat(hostaddr, notice) - struct in_addr *hostaddr; - ZNotice_t *notice; -{ - struct servent *sp; - struct sockaddr_in sin; - ZNotice_t req; - Code_t code; - struct timeval tv; - fd_set readers; - - (void) memset((char *)&sin, 0, sizeof(struct sockaddr_in)); - - sp = getservbyname(HM_SVCNAME, "udp"); - - sin.sin_port = (sp) ? sp->s_port : HM_SVC_FALLBACK; - sin.sin_family = AF_INET; - - if (hostaddr) - sin.sin_addr = *hostaddr; - else - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - (void) memset((char *)&req, 0, sizeof(req)); - req.z_kind = STAT; - req.z_port = 0; - req.z_class = HM_STAT_CLASS; - req.z_class_inst = HM_STAT_CLIENT; - req.z_opcode = HM_GIMMESTATS; - req.z_sender = ""; - req.z_recipient = ""; - req.z_default_format = ""; - req.z_message_len = 0; - - if ((code = ZSetDestAddr(&sin)) != ZERR_NONE) - return(code); - - if ((code = ZSendNotice(&req, ZNOAUTH)) != ZERR_NONE) - return(code); - - /* Wait up to ten seconds for a response. */ - FD_ZERO(&readers); - FD_SET(ZGetFD(), &readers); - tv.tv_sec = 10; - tv.tv_usec = 0; - code = select(ZGetFD() + 1, &readers, NULL, NULL, &tv); - if (code < 0 && errno != EINTR) - return(errno); - if (code == 0 || (code < 0 && errno == EINTR) || ZPending() == 0) - return(ZERR_HMDEAD); - - return(ZReceiveNotice(notice, (struct sockaddr_in *) 0)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZIfNotice.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZIfNotice.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZIfNotice.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZIfNotice.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZIfNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZIfNotice(notice, from, predicate, args) - ZNotice_t *notice; - struct sockaddr_in *from; - int (*predicate) __P((ZNotice_t *, void *)); - void *args; -{ - ZNotice_t tmpnotice; - Code_t retval; - char *buffer; - struct _Z_InputQ *qptr; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - qptr = Z_GetFirstComplete(); - - for (;;) { - while (qptr) { - if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, - &tmpnotice)) != ZERR_NONE) - return (retval); - if ((*predicate)(&tmpnotice, args)) { - if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(buffer, qptr->packet, qptr->packet_len); - if (from) - *from = qptr->from; - if ((retval = ZParseNotice(buffer, qptr->packet_len, - notice)) != ZERR_NONE) { - free(buffer); - return (retval); - } - Z_RemQueue(qptr); - return (ZERR_NONE); - } - qptr = Z_GetNextComplete(qptr); - } - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - qptr = Z_GetFirstComplete(); /* need to look over all of - the queued messages, in case - a fragment has been reassembled */ - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZInit.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZInit.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZInit.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZInit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZInitialize function. - * - * Created by: Robert French - * - * Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#ifdef ZEPHYR_USES_KERBEROS -#ifdef WIN32 - -#else -#include -#endif -#endif - -#include "internal.h" - -#ifdef WIN32 -#include -#else -#include -#endif - - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -Code_t ZInitialize() -{ - struct servent *hmserv; - struct hostent *hostent; - char addr[4], hostname[MAXHOSTNAMELEN]; - struct in_addr servaddr; - struct sockaddr_in sin; - int s; - socklen_t sinsize = sizeof(sin); - Code_t code; - ZNotice_t notice; -#ifdef ZEPHYR_USES_KERBEROS - char *krealm = NULL; - int krbval; - char d1[ANAME_SZ], d2[INST_SZ]; - - /* initialize_krb_error_table(); */ -#endif - - initialize_zeph_error_table(); - - (void) memset((char *)&__HM_addr, 0, sizeof(__HM_addr)); - - __HM_addr.sin_family = AF_INET; - - /* Set up local loopback address for HostManager */ - addr[0] = 127; - addr[1] = 0; - addr[2] = 0; - addr[3] = 1; - - hmserv = (struct servent *)getservbyname(HM_SVCNAME, "udp"); - __HM_addr.sin_port = (hmserv) ? hmserv->s_port : HM_SVC_FALLBACK; - - (void) memcpy((char *)&__HM_addr.sin_addr, addr, 4); - - __HM_set = 0; - - /* Initialize the input queue */ - __Q_Tail = NULL; - __Q_Head = NULL; - - /* if the application is a server, there might not be a zhm. The - code will fall back to something which might not be "right", - but this is is ok, since none of the servers call krb_rd_req. */ - - servaddr.s_addr = INADDR_NONE; - if (! __Zephyr_server) { - if ((code = ZOpenPort(NULL)) != ZERR_NONE) - return(code); - - if ((code = ZhmStat(NULL, ¬ice)) != ZERR_NONE) - return(code); - - ZClosePort(); - - /* the first field, which is NUL-terminated, is the server name. - If this code ever support a multiplexing zhm, this will have to - be made smarter, and probably per-message */ - -#ifdef ZEPHYR_USES_KERBEROS - krealm = krb_realmofhost(notice.z_message); -#endif - hostent = gethostbyname(notice.z_message); - if (hostent && hostent->h_addrtype == AF_INET) - memcpy(&servaddr, hostent->h_addr, sizeof(servaddr)); - - ZFreeNotice(¬ice); - } - -#ifdef ZEPHYR_USES_KERBEROS - if (krealm) { - strcpy(__Zephyr_realm, krealm); - } else if ((krb_get_tf_fullname(TKT_FILE, d1, d2, __Zephyr_realm) - != KSUCCESS) && - ((krbval = krb_get_lrealm(__Zephyr_realm, 1)) != KSUCCESS)) { - return (krbval); - } -#else - strcpy(__Zephyr_realm, "local-realm"); -#endif - - __My_addr.s_addr = INADDR_NONE; - if (servaddr.s_addr != INADDR_NONE) { - /* Try to get the local interface address by connecting a UDP - * socket to the server address and getting the local address. - * Some broken operating systems (e.g. Solaris 2.0-2.5) yield - * INADDR_ANY (zero), so we have to check for that. */ - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s != -1) { - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - memcpy(&sin.sin_addr, &servaddr, sizeof(servaddr)); - sin.sin_port = HM_SRV_SVC_FALLBACK; - if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == 0 - && getsockname(s, (struct sockaddr *) &sin, &sinsize) == 0 - && sin.sin_addr.s_addr != 0) - memcpy(&__My_addr, &sin.sin_addr, sizeof(__My_addr)); - close(s); - } - } - if (__My_addr.s_addr == INADDR_NONE) { - /* We couldn't figure out the local interface address by the - * above method. Try by resolving the local hostname. (This - * is a pretty broken thing to do, and unfortunately what we - * always do on server machines.) */ - if (gethostname(hostname, sizeof(hostname)) == 0) { - hostent = gethostbyname(hostname); - if (hostent && hostent->h_addrtype == AF_INET) - memcpy(&__My_addr, hostent->h_addr, sizeof(__My_addr)); - } - } - /* If the above methods failed, zero out __My_addr so things will - * sort of kind of work. */ - if (__My_addr.s_addr == INADDR_NONE) - __My_addr.s_addr = 0; - - /* Get the sender so we can cache it */ - (void) ZGetSender(); - - return (ZERR_NONE); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Zinternal.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Zinternal.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Zinternal.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/Zinternal.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,990 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the internal Zephyr routines. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of - * Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" -#ifdef WIN32 -#include - -#ifndef ZEPHYR_USES_KERBEROS - int gettimeofday(struct timeval* p, struct timezone* tz ){ - union { - long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } _now; - - GetSystemTimeAsFileTime( &(_now.ft) ); - p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); - p->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); - return 0; - } -#endif - -#else -#include -#include -#include -#endif - -int __Zephyr_fd = -1; -int __Zephyr_open; -int __Zephyr_port = -1; -struct in_addr __My_addr; -int __Q_CompleteLength; -int __Q_Size; -struct _Z_InputQ *__Q_Head, *__Q_Tail; -struct sockaddr_in __HM_addr; -struct sockaddr_in __HM_addr_real; -int __HM_set; -int __Zephyr_server; -ZLocations_t *__locate_list; -int __locate_num; -int __locate_next; -ZSubscription_t *__subscriptions_list; -int __subscriptions_num; -int __subscriptions_next; -int Z_discarded_packets = 0; - -#ifdef ZEPHYR_USES_KERBEROS -C_Block __Zephyr_session; -#endif -char __Zephyr_realm[REALM_SZ]; - -#ifdef Z_DEBUG -void (*__Z_debug_print) __P((const char *fmt, va_list args, void *closure)); -void *__Z_debug_print_closure; -#endif - -#define min(a,b) ((a)<(b)?(a):(b)) - -static int Z_AddField __P((char **ptr, const char *field, char *end)); -static int find_or_insert_uid __P((ZUnique_Id_t *uid, ZNotice_Kind_t kind)); - -/* Find or insert uid in the old uids buffer. The buffer is a sorted - * circular queue. We make the assumption that most packets arrive in - * order, so we can usually search for a uid or insert it into the buffer - * by looking back just a few entries from the end. Since this code is - * only executed by the client, the implementation isn't microoptimized. */ -static int find_or_insert_uid(uid, kind) - ZUnique_Id_t *uid; - ZNotice_Kind_t kind; -{ - static struct _filter { - ZUnique_Id_t uid; - ZNotice_Kind_t kind; - time_t t; - } *buffer; - static long size; - static long start; - static long num; - - time_t now; - struct _filter *new; - long i, j, new_size; - int result; - - /* Initialize the uid buffer if it hasn't been done already. */ - if (!buffer) { - size = Z_INITFILTERSIZE; - buffer = (struct _filter *) malloc(size * sizeof(*buffer)); - if (!buffer) - return 0; - } - - /* Age the uid buffer, discarding any uids older than the clock skew. */ - time(&now); - while (num && (now - buffer[start % size].t) > CLOCK_SKEW) - start++, num--; - start %= size; - - /* Make room for a new uid, since we'll probably have to insert one. */ - if (num == size) { - new_size = size * 2 + 2; - new = (struct _filter *) malloc(new_size * sizeof(*new)); - if (!new) - return 0; - for (i = 0; i < num; i++) - new[i] = buffer[(start + i) % size]; - free(buffer); - buffer = new; - size = new_size; - start = 0; - } - - /* Search for this uid in the buffer, starting from the end. */ - for (i = start + num - 1; i >= start; i--) { - result = memcmp(uid, &buffer[i % size].uid, sizeof(*uid)); - if (result == 0 && buffer[i % size].kind == kind) - return 1; - if (result > 0) - break; - } - - /* We didn't find it; insert the uid into the buffer after i. */ - i++; - for (j = start + num; j > i; j--) - buffer[j % size] = buffer[(j - 1) % size]; - buffer[i % size].uid = *uid; - buffer[i % size].kind = kind; - buffer[i % size].t = now; - num++; - - return 0; -} - - -/* Return 1 if there is a packet waiting, 0 otherwise */ - -static int Z_PacketWaiting(void) -{ - struct timeval tv; - fd_set read; - - tv.tv_sec = tv.tv_usec = 0; - FD_ZERO(&read); - FD_SET(ZGetFD(), &read); - return (select(ZGetFD() + 1, &read, NULL, NULL, &tv)); -} - - -/* Wait for a complete notice to become available */ - -Code_t Z_WaitForComplete(void) -{ - Code_t retval; - - if (__Q_CompleteLength) - return (Z_ReadEnqueue()); - - while (!__Q_CompleteLength) - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - - return (ZERR_NONE); -} - - -/* Read any available packets and enqueue them */ - -Code_t Z_ReadEnqueue() -{ - Code_t retval; - - if (ZGetFD() < 0) - return (ZERR_NOPORT); - - while (Z_PacketWaiting()) - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - - return (ZERR_NONE); -} - - -/* - * Search the queue for a notice with the proper multiuid - remove any - * notices that haven't been touched in a while - */ - -static struct _Z_InputQ *Z_SearchQueue(ZUnique_Id_t *uid, ZNotice_Kind_t kind) -{ - register struct _Z_InputQ *qptr; - struct _Z_InputQ *next; - struct timeval tv; - - (void) gettimeofday(&tv, (struct timezone *)0); - - qptr = __Q_Head; - - while (qptr) { - if (ZCompareUID(uid, &qptr->uid) && qptr->kind == kind) - return (qptr); - next = qptr->next; - if (qptr->timep && (qptr->timep+Z_NOTICETIMELIMIT < tv.tv_sec)) - Z_RemQueue(qptr); - qptr = next; - } - return (NULL); -} - -/* - * Now we delve into really convoluted queue handling and - * fragmentation reassembly algorithms and other stuff you probably - * don't want to look at... - * - * This routine does NOT guarantee a complete packet will be ready when it - * returns. - */ - -Code_t Z_ReadWait() -{ - register struct _Z_InputQ *qptr; - ZNotice_t notice; - ZPacket_t packet; - struct sockaddr_in olddest, from; - int packet_len, zvlen, part, partof; - socklen_t from_len; - char *slash; - Code_t retval; - fd_set fds; - struct timeval tv; - - if (ZGetFD() < 0) - return (ZERR_NOPORT); - - FD_ZERO(&fds); - FD_SET(ZGetFD(), &fds); - tv.tv_sec = 60; - tv.tv_usec = 0; - - if (select(ZGetFD() + 1, &fds, NULL, NULL, &tv) < 0) - return (errno); - if (!FD_ISSET(ZGetFD(), &fds)) - return ETIMEDOUT; - - from_len = sizeof(struct sockaddr_in); - - packet_len = recvfrom(ZGetFD(), packet, sizeof(packet), 0, - (struct sockaddr *)&from, &from_len); - - if (packet_len < 0) - return (errno); - - if (!packet_len) - return (ZERR_EOF); - - /* Ignore obviously non-Zephyr packets. */ - zvlen = sizeof(ZVERSIONHDR) - 1; - if (packet_len < zvlen || memcmp(packet, ZVERSIONHDR, zvlen) != 0) { - Z_discarded_packets++; - return (ZERR_NONE); - } - - /* Parse the notice */ - if ((retval = ZParseNotice(packet, packet_len, ¬ice)) != ZERR_NONE) - return (retval); - - /* - * If we're not a server and the notice is of an appropriate kind, - * send back a CLIENTACK to whoever sent it to say we got it. - */ - if (!__Zephyr_server) { - if (notice.z_kind != HMACK && notice.z_kind != SERVACK && - notice.z_kind != SERVNAK && notice.z_kind != CLIENTACK) { - ZNotice_t tmpnotice; - ZPacket_t pkt; - int len; - - tmpnotice = notice; - tmpnotice.z_kind = CLIENTACK; - tmpnotice.z_message_len = 0; - olddest = __HM_addr; - __HM_addr = from; - if ((retval = ZFormatSmallRawNotice(&tmpnotice, pkt, &len)) - != ZERR_NONE) - return(retval); - if ((retval = ZSendPacket(pkt, len, 0)) != ZERR_NONE) - return (retval); - __HM_addr = olddest; - } - if (find_or_insert_uid(¬ice.z_uid, notice.z_kind)) - return(ZERR_NONE); - - /* Check authentication on the notice. */ - notice.z_checked_auth = ZCheckAuthentication(¬ice, &from); - } - - - /* - * Parse apart the z_multinotice field - if the field is blank for - * some reason, assume this packet stands by itself. - */ - slash = strchr(notice.z_multinotice, '/'); - if (slash) { - part = atoi(notice.z_multinotice); - partof = atoi(slash+1); - if (part > partof || partof == 0) { - part = 0; - partof = notice.z_message_len; - } - } - else { - part = 0; - partof = notice.z_message_len; - } - - /* Too big a packet...just ignore it! */ - if (partof > Z_MAXNOTICESIZE) - return (ZERR_NONE); - - /* - * If we aren't a server and we can find a notice in the queue - * with the same multiuid field, insert the current fragment as - * appropriate. - */ - switch (notice.z_kind) { - case SERVACK: - case SERVNAK: - /* The SERVACK and SERVNAK replies shouldn't be reassembled - (they have no parts). Instead, we should hold on to the reply - ONLY if it's the first part of a fragmented message, i.e. - multi_uid == uid. This allows programs to wait for the uid - of the first packet, and get a response when that notice - arrives. Acknowledgements of the other fragments are discarded - (XXX we assume here that they all carry the same information - regarding failure/success) - */ - if (!__Zephyr_server && - !ZCompareUID(¬ice.z_multiuid, ¬ice.z_uid)) - /* they're not the same... throw away this packet. */ - return(ZERR_NONE); - /* fall thru & process it */ - default: - /* for HMACK types, we assume no packet loss (local loopback - connections). The other types can be fragmented and MUST - run through this code. */ - if (!__Zephyr_server && (qptr = Z_SearchQueue(¬ice.z_multiuid, - notice.z_kind))) { - /* - * If this is the first fragment, and we haven't already - * gotten a first fragment, grab the header from it. - */ - if (part == 0 && !qptr->header) { - qptr->header_len = packet_len-notice.z_message_len; - qptr->header = (char *) malloc((unsigned) qptr->header_len); - if (!qptr->header) - return (ENOMEM); - (void) memcpy(qptr->header, packet, qptr->header_len); - } - return (Z_AddNoticeToEntry(qptr, ¬ice, part)); - } - } - - /* - * We'll have to create a new entry...make sure the queue isn't - * going to get too big. - */ - if (__Q_Size+(__Zephyr_server ? notice.z_message_len : partof) > Z_MAXQUEUESIZE) - return (ZERR_NONE); - - /* - * This is a notice we haven't heard of, so create a new queue - * entry for it and zero it out. - */ - qptr = (struct _Z_InputQ *)malloc(sizeof(struct _Z_InputQ)); - if (!qptr) - return (ENOMEM); - (void) memset((char *)qptr, 0, sizeof(struct _Z_InputQ)); - - /* Insert the entry at the end of the queue */ - qptr->next = NULL; - qptr->prev = __Q_Tail; - if (__Q_Tail) - __Q_Tail->next = qptr; - __Q_Tail = qptr; - - if (!__Q_Head) - __Q_Head = qptr; - - - /* Copy the from field, multiuid, kind, and checked authentication. */ - qptr->from = from; - qptr->uid = notice.z_multiuid; - qptr->kind = notice.z_kind; - qptr->auth = notice.z_checked_auth; - - /* - * If this is the first part of the notice, we take the header - * from it. We only take it if this is the first fragment so that - * the Unique ID's will be predictable. - * - * If a Zephyr Server, we always take the header. - */ - if (__Zephyr_server || part == 0) { - qptr->header_len = packet_len-notice.z_message_len; - qptr->header = (char *) malloc((unsigned) qptr->header_len); - if (!qptr->header) - return ENOMEM; - (void) memcpy(qptr->header, packet, qptr->header_len); - } - - /* - * If this is not a fragmented notice, then don't bother with a - * hole list. - * If we are a Zephyr server, all notices are treated as complete. - */ - if (__Zephyr_server || (part == 0 && notice.z_message_len == partof)) { - __Q_CompleteLength++; - qptr->holelist = (struct _Z_Hole *) 0; - qptr->complete = 1; - /* allocate a msg buf for this piece */ - if (notice.z_message_len == 0) - qptr->msg = 0; - else if (!(qptr->msg = (char *) malloc((unsigned) notice.z_message_len))) - return(ENOMEM); - else - (void) memcpy(qptr->msg, notice.z_message, notice.z_message_len); - qptr->msg_len = notice.z_message_len; - __Q_Size += notice.z_message_len; - qptr->packet_len = qptr->header_len+qptr->msg_len; - if (!(qptr->packet = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(qptr->packet, qptr->header, qptr->header_len); - if(qptr->msg) - (void) memcpy(qptr->packet+qptr->header_len, qptr->msg, - qptr->msg_len); - return (ZERR_NONE); - } - - /* - * We know how long the message is going to be (this is better - * than IP fragmentation...), so go ahead and allocate it all. - */ - if (!(qptr->msg = (char *) malloc((unsigned) partof)) && partof) - return (ENOMEM); - qptr->msg_len = partof; - __Q_Size += partof; - - /* - * Well, it's a fragmented notice...allocate a hole list and - * initialize it to the full packet size. Then insert the - * current fragment. - */ - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_Hole)))) - return (ENOMEM); - qptr->holelist->next = (struct _Z_Hole *) 0; - qptr->holelist->first = 0; - qptr->holelist->last = partof-1; - return (Z_AddNoticeToEntry(qptr, ¬ice, part)); -} - - -/* Fragment management routines - compliments, more or less, of RFC815 */ - -Code_t Z_AddNoticeToEntry(qptr, notice, part) - struct _Z_InputQ *qptr; - ZNotice_t *notice; - int part; -{ - int last, oldfirst, oldlast; - struct _Z_Hole *hole, *lasthole; - struct timeval tv; - - /* Incorporate this notice's checked authentication. */ - if (notice->z_checked_auth == ZAUTH_FAILED) - qptr->auth = ZAUTH_FAILED; - else if (notice->z_checked_auth == ZAUTH_NO && qptr->auth != ZAUTH_FAILED) - qptr->auth = ZAUTH_NO; - - (void) gettimeofday(&tv, (struct timezone *)0); - qptr->timep = tv.tv_sec; - - last = part+notice->z_message_len-1; - - hole = qptr->holelist; - lasthole = (struct _Z_Hole *) 0; - - /* copy in the message body */ - (void) memcpy(qptr->msg+part, notice->z_message, notice->z_message_len); - - /* Search for a hole that overlaps with the current fragment */ - while (hole) { - if (part <= hole->last && last >= hole->first) - break; - lasthole = hole; - hole = hole->next; - } - - /* If we found one, delete it and reconstruct a new hole */ - if (hole) { - oldfirst = hole->first; - oldlast = hole->last; - if (lasthole) - lasthole->next = hole->next; - else - qptr->holelist = hole->next; - free((char *)hole); - /* - * Now create a new hole that is the original hole without the - * current fragment. - */ - if (part > oldfirst) { - /* Search for the end of the hole list */ - hole = qptr->holelist; - lasthole = (struct _Z_Hole *) 0; - while (hole) { - lasthole = hole; - hole = hole->next; - } - if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = lasthole->next; - } - else { - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = qptr->holelist; - } - hole->next = NULL; - hole->first = oldfirst; - hole->last = part-1; - } - if (last < oldlast) { - /* Search for the end of the hole list */ - hole = qptr->holelist; - lasthole = (struct _Z_Hole *) 0; - while (hole) { - lasthole = hole; - hole = hole->next; - } - if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = lasthole->next; - } - else { - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = qptr->holelist; - } - hole->next = (struct _Z_Hole *) 0; - hole->first = last+1; - hole->last = oldlast; - } - } - - if (!qptr->holelist) { - if (!qptr->complete) - __Q_CompleteLength++; - qptr->complete = 1; - qptr->timep = 0; /* don't time out anymore */ - qptr->packet_len = qptr->header_len+qptr->msg_len; - if (!(qptr->packet = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(qptr->packet, qptr->header, qptr->header_len); - (void) memcpy(qptr->packet+qptr->header_len, qptr->msg, - qptr->msg_len); - } - - return (ZERR_NONE); -} - -Code_t Z_FormatHeader(notice, buffer, buffer_len, len, cert_routine) - ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; - Z_AuthProc cert_routine; -{ - Code_t retval; - static char version[BUFSIZ]; /* default init should be all \0 */ - struct sockaddr_in name; - socklen_t namelen = sizeof(name); - - if (!notice->z_sender) - notice->z_sender = ZGetSender(); - - if (notice->z_port == 0) { - if (ZGetFD() < 0) { - retval = ZOpenPort((unsigned short *)0); - if (retval != ZERR_NONE) - return (retval); - } - retval = getsockname(ZGetFD(), (struct sockaddr *) &name, &namelen); - if (retval != 0) - return (retval); - notice->z_port = name.sin_port; - } - - notice->z_multinotice = ""; - - (void) gettimeofday(¬ice->z_uid.tv, (struct timezone *)0); - notice->z_uid.tv.tv_sec = htonl((unsigned long) notice->z_uid.tv.tv_sec); - notice->z_uid.tv.tv_usec = htonl((unsigned long) notice->z_uid.tv.tv_usec); - - (void) memcpy(¬ice->z_uid.zuid_addr, &__My_addr, sizeof(__My_addr)); - - notice->z_multiuid = notice->z_uid; - - if (!version[0]) - (void) sprintf(version, "%s%d.%d", ZVERSIONHDR, ZVERSIONMAJOR, - ZVERSIONMINOR); - notice->z_version = version; - - return Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine); -} - -Code_t Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine) - ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; - Z_AuthProc cert_routine; -{ - if (!cert_routine) { - notice->z_auth = 0; - notice->z_authent_len = 0; - notice->z_ascii_authent = ""; - notice->z_checksum = 0; - return (Z_FormatRawHeader(notice, buffer, buffer_len, - len, NULL, NULL)); - } - - return ((*cert_routine)(notice, buffer, buffer_len, len)); -} - -Code_t Z_FormatRawHeader(notice, buffer, buffer_len, len, cstart, cend) - ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; - char **cstart, **cend; -{ - char newrecip[BUFSIZ]; - char *ptr, *end; - int i; - - if (!notice->z_class) - notice->z_class = ""; - - if (!notice->z_class_inst) - notice->z_class_inst = ""; - - if (!notice->z_opcode) - notice->z_opcode = ""; - - if (!notice->z_recipient) - notice->z_recipient = ""; - - if (!notice->z_default_format) - notice->z_default_format = ""; - - ptr = buffer; - end = buffer+buffer_len; - - if (buffer_len < strlen(notice->z_version)+1) - return (ZERR_HEADERLEN); - - (void) strcpy(ptr, notice->z_version); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, Z_NUMFIELDS + notice->z_num_other_fields) - == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, notice->z_kind) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii(ptr, end-ptr, (unsigned char *)¬ice->z_uid, - sizeof(ZUnique_Id_t)) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii16(ptr, end-ptr, ntohs(notice->z_port)) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, notice->z_auth) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, notice->z_authent_len) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (Z_AddField(&ptr, notice->z_ascii_authent, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_class, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_class_inst, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_opcode, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_sender, end)) - return (ZERR_HEADERLEN); - if (strchr(notice->z_recipient, '@') || !*notice->z_recipient) { - if (Z_AddField(&ptr, notice->z_recipient, end)) - return (ZERR_HEADERLEN); - } - else { - if (strlen(notice->z_recipient) + strlen(__Zephyr_realm) + 2 > - sizeof(newrecip)) - return (ZERR_HEADERLEN); - (void) sprintf(newrecip, "%s@%s", notice->z_recipient, __Zephyr_realm); - if (Z_AddField(&ptr, newrecip, end)) - return (ZERR_HEADERLEN); - } - if (Z_AddField(&ptr, notice->z_default_format, end)) - return (ZERR_HEADERLEN); - - /* copy back the end pointer location for crypto checksum */ - if (cstart) - *cstart = ptr; - if (ZMakeAscii32(ptr, end-ptr, notice->z_checksum) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - if (cend) - *cend = ptr; - - if (Z_AddField(&ptr, notice->z_multinotice, end)) - return (ZERR_HEADERLEN); - - if (ZMakeAscii(ptr, end-ptr, (unsigned char *)¬ice->z_multiuid, - sizeof(ZUnique_Id_t)) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - for (i=0;iz_num_other_fields;i++) - if (Z_AddField(&ptr, notice->z_other_fields[i], end)) - return (ZERR_HEADERLEN); - - *len = ptr-buffer; - - return (ZERR_NONE); -} - -static int -Z_AddField(char **ptr, const char *field, char *end) -{ - register int len; - - len = field ? strlen (field) + 1 : 1; - - if (*ptr+len > end) - return 1; - if (field) - (void) strcpy(*ptr, field); - else - **ptr = '\0'; - *ptr += len; - - return 0; -} - -struct _Z_InputQ *Z_GetFirstComplete() -{ - struct _Z_InputQ *qptr; - - qptr = __Q_Head; - - while (qptr) { - if (qptr->complete) - return (qptr); - qptr = qptr->next; - } - - return ((struct _Z_InputQ *)0); -} - -struct _Z_InputQ *Z_GetNextComplete(qptr) - struct _Z_InputQ *qptr; -{ - qptr = qptr->next; - while (qptr) { - if (qptr->complete) - return (qptr); - qptr = qptr->next; - } - - return ((struct _Z_InputQ *)0); -} - -void Z_RemQueue(qptr) - struct _Z_InputQ *qptr; -{ - struct _Z_Hole *hole, *nexthole; - - if (qptr->complete) - __Q_CompleteLength--; - - __Q_Size -= qptr->msg_len; - - if (qptr->header) - free(qptr->header); - if (qptr->msg) - free(qptr->msg); - if (qptr->packet) - free(qptr->packet); - - hole = qptr->holelist; - while (hole) { - nexthole = hole->next; - free((char *)hole); - hole = nexthole; - } - - if (qptr == __Q_Head && __Q_Head == __Q_Tail) { - free ((char *)qptr); - __Q_Head = (struct _Z_InputQ *)0; - __Q_Tail = (struct _Z_InputQ *)0; - return; - } - - if (qptr == __Q_Head) { - __Q_Head = qptr->next; - __Q_Head->prev = (struct _Z_InputQ *)0; - free ((char *)qptr); - return; - } - if (qptr == __Q_Tail) { - __Q_Tail = qptr->prev; - __Q_Tail->next = (struct _Z_InputQ *)0; - free ((char *)qptr); - return; - } - qptr->prev->next = qptr->next; - qptr->next->prev = qptr->prev; - free ((char *)qptr); - return; -} - -Code_t Z_SendFragmentedNotice(notice, len, cert_func, send_func) - ZNotice_t *notice; - int len; - Z_AuthProc cert_func; - Z_SendProc send_func; -{ - ZNotice_t partnotice; - ZPacket_t buffer; - char multi[64]; - int offset, hdrsize, fragsize, ret_len, message_len, waitforack; - Code_t retval; - - hdrsize = len-notice->z_message_len; - fragsize = Z_MAXPKTLEN-hdrsize-Z_FRAGFUDGE; - - offset = 0; - - waitforack = ((notice->z_kind == UNACKED || notice->z_kind == ACKED) - && !__Zephyr_server); - - partnotice = *notice; - - while (offset < notice->z_message_len || !notice->z_message_len) { - (void) sprintf(multi, "%d/%d", offset, notice->z_message_len); - partnotice.z_multinotice = multi; - if (offset > 0) { - (void) gettimeofday(&partnotice.z_uid.tv, - (struct timezone *)0); - partnotice.z_uid.tv.tv_sec = - htonl((unsigned long) partnotice.z_uid.tv.tv_sec); - partnotice.z_uid.tv.tv_usec = - htonl((unsigned long) partnotice.z_uid.tv.tv_usec); - (void) memcpy((char *)&partnotice.z_uid.zuid_addr, &__My_addr, - sizeof(__My_addr)); - } - message_len = min(notice->z_message_len-offset, fragsize); - partnotice.z_message = (char*)notice->z_message+offset; - partnotice.z_message_len = message_len; - if ((retval = Z_FormatAuthHeader(&partnotice, buffer, Z_MAXHEADERLEN, - &ret_len, cert_func)) != ZERR_NONE) { - return (retval); - } - memcpy(buffer + ret_len, partnotice.z_message, message_len); - if ((retval = (*send_func)(&partnotice, buffer, ret_len+message_len, - waitforack)) != ZERR_NONE) { - return (retval); - } - offset += fragsize; - if (!notice->z_message_len) - break; - } - - return (ZERR_NONE); -} - -/*ARGSUSED*/ -Code_t Z_XmitFragment(notice, buf, len, wait) -ZNotice_t *notice; -char *buf; -int len; -int wait; -{ - return(ZSendPacket(buf, len, wait)); -} - -#ifdef Z_DEBUG -/* For debugging printing */ -const char *const ZNoticeKinds[] = { - "UNSAFE", "UNACKED", "ACKED", "HMACK", "HMCTL", "SERVACK", "SERVNAK", - "CLIENTACK", "STAT" -}; -#endif - -#ifdef Z_DEBUG - -#undef Z_debug -#ifdef HAVE_STDARG_H -void Z_debug (const char *format, ...) -{ - va_list pvar; - if (!__Z_debug_print) - return; - va_start (pvar, format); - (*__Z_debug_print) (format, pvar, __Z_debug_print_closure); - va_end (pvar); -} -#else /* stdarg */ -void Z_debug (va_alist) va_dcl -{ - va_list pvar; - char *format; - if (!__Z_debug_print) - return; - va_start (pvar); - format = va_arg (pvar, char *); - (*__Z_debug_print) (format, pvar, __Z_debug_print_closure); - va_end (pvar); -} -#endif - -void Z_debug_stderr (format, args, closure) - const char *format; - va_list args; - void *closure; -{ -#ifdef HAVE_VPRINTF - vfprintf (stderr, format, args); -#else - _doprnt (format, args, stderr); -#endif - putc ('\n', stderr); -} - -#undef ZGetFD -int ZGetFD () { return __Zephyr_fd; } - -#undef ZQLength -int ZQLength () { return __Q_CompleteLength; } - -#undef ZGetDestAddr -struct sockaddr_in ZGetDestAddr () { return __HM_addr; } - -#undef ZGetRealm -Zconst char * ZGetRealm () { return __Zephyr_realm; } - -#undef ZSetDebug -void ZSetDebug(proc, arg) - void (*proc) __P((const char *, va_list, void *)); - char *arg; -{ - __Z_debug_print = proc; - __Z_debug_print_closure = arg; -} -#endif /* Z_DEBUG */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZLocations.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZLocations.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZLocations.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZLocations.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetLocation, ZUnsetLocation, and - * ZFlushMyLocations functions. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifndef WIN32 -#include -#endif - -#include -#include - -Code_t ZSetLocation(exposure) - char *exposure; -{ - return (Z_SendLocation(LOGIN_CLASS, exposure, ZAUTH, - "$sender logged in to $1 on $3 at $2")); -} - -Code_t ZUnsetLocation() -{ - return (Z_SendLocation(LOGIN_CLASS, LOGIN_USER_LOGOUT, ZNOAUTH, - "$sender logged out of $1 on $3 at $2")); -} - -Code_t ZFlushMyLocations() -{ - return (Z_SendLocation(LOGIN_CLASS, LOGIN_USER_FLUSH, ZAUTH, "")); -} - -static char host[MAXHOSTNAMELEN]; -static char *mytty = NULL; -static int reenter = 0; - -Code_t Z_SendLocation(class, opcode, auth, format) - char *class; - char *opcode; - Z_AuthProc auth; - char *format; -{ - int retval; - time_t ourtime; - ZNotice_t notice, retnotice; - char *bptr[3]; -#ifndef X_DISPLAY_MISSING - char *display; -#endif -#ifndef WIN32 - char *ttyp; - char *p; -#endif - struct hostent *hent; - short wg_port = ZGetWGPort(); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = ACKED; - notice.z_port = (unsigned short) ((wg_port == -1) ? 0 : wg_port); - notice.z_class = class; - notice.z_class_inst = ZGetSender(); - notice.z_opcode = opcode; - notice.z_sender = 0; - notice.z_recipient = ""; - notice.z_num_other_fields = 0; - notice.z_default_format = format; - - /* - keep track of what we said before so that we can be consistent - when changing location information. - This is done mainly for the sake of the WindowGram client. - */ - - if (!reenter) { - if (gethostname(host, MAXHOSTNAMELEN) < 0) - return (errno); - - hent = gethostbyname(host); - if (hent) { - (void) strncpy(host, hent->h_name, sizeof(host)); - host[sizeof(host) - 1] = '\0'; - } -#ifndef X_DISPLAY_MISSING - if ((display = getenv("DISPLAY")) && *display) { - mytty = g_strdup(display); - } else { -#endif -#ifdef WIN32 - mytty = g_strdup("WinPurple"); -#else - ttyp = ttyname(0); - if (ttyp && *ttyp) { - p = strchr(ttyp + 1, '/'); - mytty = g_strdup((p) ? p + 1 : ttyp); - } else { - mytty = g_strdup("unknown"); - } -#endif -#ifndef X_DISPLAY_MISSING - } -#endif - reenter = 1; - } - - ourtime = time((time_t *)0); - bptr[0] = host; - bptr[1] = ctime(&ourtime); - bptr[1][strlen(bptr[1])-1] = '\0'; - bptr[2] = mytty; - - if ((retval = ZSendList(¬ice, bptr, 3, auth)) != ZERR_NONE) - return (retval); - - retval = Z_WaitForNotice (&retnotice, ZCompareUIDPred, ¬ice.z_uid, - SRV_TIMEOUT); - if (retval != ZERR_NONE) - return retval; - - if (retnotice.z_kind == SERVNAK) { - if (!retnotice.z_message_len) { - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - if (!strcmp(retnotice.z_message, ZSRVACK_NOTSENT)) { - ZFreeNotice(&retnotice); - return (ZERR_AUTHFAIL); - } - if (!strcmp(retnotice.z_message, ZSRVACK_FAIL)) { - ZFreeNotice(&retnotice); - return (ZERR_LOGINFAIL); - } - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - - if (retnotice.z_kind != SERVACK) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - if (!retnotice.z_message_len) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - if (strcmp(retnotice.z_message, ZSRVACK_SENT) && - strcmp(retnotice.z_message, ZSRVACK_NOTSENT)) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - ZFreeNotice(&retnotice); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMakeAscii.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMakeAscii.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMakeAscii.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMakeAscii.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZMakeAscii function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -static char *itox_chars = "0123456789ABCDEF"; - -Code_t ZMakeAscii(ptr, len, field, num) - register char *ptr; - int len; - unsigned char *field; - int num; -{ - int i; - - for (i=0;i> 4)]; - *ptr++ = itox_chars[(int) (field[i] & 0xf)]; - len -= 2; - } - - *ptr = '\0'; - return ZERR_NONE; -} - -Code_t ZMakeAscii32(ptr, len, value) - register char *ptr; - int len; - unsigned long value; -{ - if (len < 11) - return ZERR_FIELDLEN; - *ptr++ = '0'; - *ptr++ = 'x'; - *ptr++ = itox_chars[(value >> 28) & 0xf]; - *ptr++ = itox_chars[(value >> 24) & 0xf]; - *ptr++ = itox_chars[(value >> 20) & 0xf]; - *ptr++ = itox_chars[(value >> 16) & 0xf]; - *ptr++ = itox_chars[(value >> 12) & 0xf]; - *ptr++ = itox_chars[(value >> 8) & 0xf]; - *ptr++ = itox_chars[(value >> 4) & 0xf]; - *ptr++ = itox_chars[(value >> 0) & 0xf]; - *ptr = 0; - return ZERR_NONE; -} - -Code_t ZMakeAscii16(ptr, len, value) - register char *ptr; - int len; - unsigned int value; -{ - if (len < 7) - return ZERR_FIELDLEN; - *ptr++ = '0'; - *ptr++ = 'x'; - *ptr++ = itox_chars[(value >> 12) & 0xf]; - *ptr++ = itox_chars[(value >> 8) & 0xf]; - *ptr++ = itox_chars[(value >> 4) & 0xf]; - *ptr++ = itox_chars[(value >> 0) & 0xf]; - *ptr = 0; - return ZERR_NONE; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMkAuth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMkAuth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMkAuth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZMkAuth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZMakeAuthentication function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifndef ERROR_TABLE_BASE_krb -#define ERROR_TABLE_BASE_krb (39525376L) -#endif - -#ifdef ZEPHYR_USES_KERBEROS -#ifdef WIN32 - -#else -#include -#endif -static long last_authent_time = 0L; -static KTEXT_ST last_authent; -#endif - -#if 0 -Code_t ZResetAuthentication () { -#ifdef ZEPHYR_USES_KERBEROS - last_authent_time = 0L; -#endif - return ZERR_NONE; -} -#endif - -Code_t ZMakeAuthentication(notice, buffer, buffer_len, len) - register ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; -{ -#ifdef ZEPHYR_USES_KERBEROS - int result; - time_t now; - KTEXT_ST authent; - char *cstart, *cend; - ZChecksum_t checksum; - CREDENTIALS cred; - extern unsigned long des_quad_cksum(); - - now = time(0); - if (last_authent_time == 0 || (now - last_authent_time > 120)) { - result = krb_mk_req(&authent, SERVER_SERVICE, - SERVER_INSTANCE, __Zephyr_realm, 0); - if (result != MK_AP_OK) { - last_authent_time = 0; - return (result+ERROR_TABLE_BASE_krb); - } - last_authent_time = now; - last_authent = authent; - } - else { - authent = last_authent; - } - notice->z_auth = 1; - notice->z_authent_len = authent.length; - notice->z_ascii_authent = (char *)malloc((unsigned)authent.length*3); - /* zero length authent is an error, so malloc(0) is not a problem */ - if (!notice->z_ascii_authent) - return (ENOMEM); - if ((result = ZMakeAscii(notice->z_ascii_authent, - authent.length*3, - authent.dat, - authent.length)) != ZERR_NONE) { - free(notice->z_ascii_authent); - return (result); - } - result = Z_FormatRawHeader(notice, buffer, buffer_len, len, &cstart, - &cend); - free(notice->z_ascii_authent); - notice->z_authent_len = 0; - if (result) - return(result); - - /* Compute a checksum over the header and message. */ - if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, - __Zephyr_realm, &cred)) != 0) - return result; - checksum = des_quad_cksum(buffer, NULL, cstart - buffer, 0, (C_Block *)cred.session); - checksum ^= des_quad_cksum(cend, NULL, buffer + *len - cend, 0, - (C_Block *)cred.session); - checksum ^= des_quad_cksum(notice->z_message, NULL, notice->z_message_len, - 0, (C_Block *)cred.session); - notice->z_checksum = checksum; - ZMakeAscii32(cstart, buffer + buffer_len - cstart, checksum); - - return (ZERR_NONE); -#else - notice->z_checksum = 0; - notice->z_auth = 1; - notice->z_authent_len = 0; - notice->z_ascii_authent = ""; - return (Z_FormatRawHeader(notice, buffer, buffer_len, len, NULL, NULL)); -#endif -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZNewLocU.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZNewLocU.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZNewLocU.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZNewLocU.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZNewLocateUser function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZLocateUser(user, nlocs, auth) - char *user; - int *nlocs; - Z_AuthProc auth; -{ - Code_t retval; - ZNotice_t notice; - ZAsyncLocateData_t zald; - - (void) ZFlushLocations(); /* ZFlushLocations never fails (the library - is allowed to know this). */ - - if ((retval = ZRequestLocations(user, &zald, UNACKED, auth)) != ZERR_NONE) - return(retval); - - retval = Z_WaitForNotice (¬ice, ZCompareALDPred, &zald, SRV_TIMEOUT); - if (retval == ZERR_NONOTICE) - return ETIMEDOUT; - if (retval != ZERR_NONE) - return retval; - - if ((retval = ZParseLocations(¬ice, &zald, nlocs, NULL)) != ZERR_NONE) { - ZFreeNotice(¬ice); - return(retval); - } - - ZFreeNotice(¬ice); - ZFreeALD(&zald); - return(ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZOpenPort.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZOpenPort.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZOpenPort.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZOpenPort.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZOpenPort function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" -#ifdef WIN32 -#include -#else -#include -#endif - -Code_t ZOpenPort(port) - unsigned short *port; -{ - struct sockaddr_in bindin; - socklen_t len; - - (void) ZClosePort(); - - if ((__Zephyr_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - __Zephyr_fd = -1; - return (errno); - } - -#ifdef SO_BSDCOMPAT - { - int on = 1; - - setsockopt(__Zephyr_fd, SOL_SOCKET, SO_BSDCOMPAT, (char *)&on, - sizeof(on)); - } -#endif - - bindin.sin_family = AF_INET; - - if (port && *port) - bindin.sin_port = *port; - else - bindin.sin_port = 0; - - bindin.sin_addr.s_addr = INADDR_ANY; - - if (bind(__Zephyr_fd, (struct sockaddr *)&bindin, sizeof(bindin)) < 0) { - if (errno == EADDRINUSE && port && *port) - return (ZERR_PORTINUSE); - else - return (errno); - } - - if (!bindin.sin_port) { - len = sizeof(bindin); - if (getsockname(__Zephyr_fd, (struct sockaddr *)&bindin, &len)) - return (errno); - } - - __Zephyr_port = bindin.sin_port; - __Zephyr_open = 1; - - if (port) - *port = bindin.sin_port; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZParseNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZParseNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZParseNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZParseNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZParseNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -/* Assume that strlen is efficient on this machine... */ -#define next_field(ptr) ptr += strlen (ptr) + 1 - -#if defined (__GNUC__) && defined (__vax__) -#undef next_field -static __inline__ char * Istrend (char *str) { - /* - * This should be faster on VAX models outside the 2 series. Don't - * use it if you are using MicroVAX 2 servers. If you are using a - * VS2 server, use something like - * #define next_field(ptr) while(*ptr++) - * instead of this code. - * - * This requires use of GCC to get the optimized code, but - * everybody uses GCC, don't they? :-) - */ - register char *str2 asm ("r1"); - /* Assumes that no field is longer than 64K.... */ - asm ("locc $0,$65535,(%1)" : "=r" (str2) : "r" (str) : "r0"); - return str2; -} -#define next_field(ptr) ptr = Istrend (ptr) + 1 -#endif - -#ifdef mips -#undef next_field -/* - * The compiler doesn't optimize this macro as well as it does the - * following function. - */ -#define next_fieldXXX(ptr) do{register unsigned c1,c2;c1= *ptr; \ - while((ptr++,c2= *ptr,c1)&&(ptr++,c1= *ptr,c2));}while(0) -static char *next_field_1 (s) char *s; { - /* - * Calling overhead is still present, but this routine is faster - * than strlen, and doesn't bother with some of the other math - * that we'd just have to undo later anyways. - */ - register unsigned c1 = *s, c2; - while (1) { - s++; c2 = *s; if (c1 == 0) break; - s++; c1 = *s; if (c2 == 0) break; - s++; c2 = *s; if (c1 == 0) break; - s++; c1 = *s; if (c2 == 0) break; - } - return s; -} -#define next_field(ptr) ptr=next_field_1(ptr) -#endif - -Code_t ZParseNotice(buffer, len, notice) - char *buffer; - int len; - ZNotice_t *notice; -{ - char *ptr, *end; - unsigned long temp; - int maj, numfields, i; - -#ifdef __LINE__ - int lineno; - /* Note: This definition of BAD eliminates lint and compiler - * complains about the "while (0)", but require that the macro not - * be used as the "then" part of an "if" statement that also has - * an "else" clause. - */ -#define BAD_PACKET {lineno=__LINE__;goto badpkt;} - /* This one gets lint/compiler complaints. */ -/*#define BAD do{lineno=__LINE__;goto badpkt;}while(0)*/ -#else -#define BAD_PACKET goto badpkt -#endif - - (void) memset((char *)notice, 0, sizeof(ZNotice_t)); - - ptr = buffer; - end = buffer+len; - - notice->z_packet = buffer; - - notice->z_version = ptr; - if (strncmp(ptr, ZVERSIONHDR, sizeof(ZVERSIONHDR) - 1)) - return (ZERR_VERS); - ptr += sizeof(ZVERSIONHDR) - 1; - if (!*ptr) { -#ifdef Z_DEBUG - Z_debug ("ZParseNotice: null version string"); -#endif - return ZERR_BADPKT; - } - maj = atoi(ptr); - if (maj != ZVERSIONMAJOR) - return (ZERR_VERS); - next_field (ptr); - - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - numfields = temp; - next_field (ptr); - - /*XXX 3 */ - numfields -= 2; /* numfields, version, and checksum */ - if (numfields < 0) { -#ifdef __LINE__ - lineno = __LINE__; - badpkt: -#ifdef Z_DEBUG - Z_debug ("ZParseNotice: bad packet from %s/%d (line %d)", - inet_ntoa (notice->z_uid.zuid_addr.s_addr), - notice->z_port, lineno); -#endif -#else - badpkt: -#ifdef Z_DEBUG - Z_debug ("ZParseNotice: bad packet from %s/%d", - inet_ntoa (notice->z_uid.zuid_addr.s_addr), - notice->z_port); -#endif -#endif - return ZERR_BADPKT; - } - - if (numfields) { - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_kind = temp; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_uid, - sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_time.tv_sec = ntohl((unsigned long) notice->z_uid.tv.tv_sec); - notice->z_time.tv_usec = ntohl((unsigned long) notice->z_uid.tv.tv_usec); - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - if (ZReadAscii16(ptr, end-ptr, ¬ice->z_port) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_port = htons(notice->z_port); - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_auth = temp; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - notice->z_checked_auth = ZAUTH_UNSET; - - if (numfields) { - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_authent_len = temp; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - notice->z_ascii_authent = ptr; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - notice->z_class = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_class = ""; - - if (numfields) { - notice->z_class_inst = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_class_inst = ""; - - if (numfields) { - notice->z_opcode = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_opcode = ""; - - if (numfields) { - notice->z_sender = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_sender = ""; - - if (numfields) { - notice->z_recipient = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_recipient = ""; - - if (numfields) { - notice->z_default_format = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_default_format = ""; - -/*XXX*/ - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_checksum = temp; - numfields--; - next_field (ptr); - - if (numfields) { - notice->z_multinotice = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_multinotice = ""; - - if (numfields) { - if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_multiuid, - sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_time.tv_sec = ntohl((unsigned long) notice->z_multiuid.tv.tv_sec); - notice->z_time.tv_usec = ntohl((unsigned long) notice->z_multiuid.tv.tv_usec); - numfields--; - next_field (ptr); - } - else - notice->z_multiuid = notice->z_uid; - - for (i=0;iz_other_fields[i] = ptr; - next_field (ptr); - } - notice->z_num_other_fields = i; - - for (i=0;iz_message = (void *)ptr; - notice->z_message_len = len-(ptr-buffer); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekIfNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekIfNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekIfNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekIfNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZPeekIfNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZPeekIfNotice(notice, from, predicate, args) - ZNotice_t *notice; - struct sockaddr_in *from; - int (*predicate)(); - char *args; -{ - ZNotice_t tmpnotice; - Code_t retval; - char *buffer; - struct _Z_InputQ *qptr; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - for (;;) { - qptr = Z_GetFirstComplete(); - while (qptr) { - if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, - &tmpnotice)) != ZERR_NONE) - return (retval); - if ((*predicate)(&tmpnotice, args)) { - if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(buffer, qptr->packet, qptr->packet_len); - if (from) - *from = qptr->from; - if ((retval = ZParseNotice(buffer, qptr->packet_len, - notice)) != ZERR_NONE) { - free(buffer); - return (retval); - } - return (ZERR_NONE); - } - qptr = Z_GetNextComplete(qptr); - } - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - } -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for ZPeekNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZPeekNotice(notice, from) - ZNotice_t *notice; - struct sockaddr_in *from; -{ - char *buffer; - int len; - Code_t retval; - - if ((retval = ZPeekPacket(&buffer, &len, from)) != ZERR_NONE) - return (retval); - - return (ZParseNotice(buffer, len, notice)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekPkt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekPkt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekPkt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPeekPkt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for ZPeekPacket function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZPeekPacket(buffer, ret_len, from) - char **buffer; - int *ret_len; - struct sockaddr_in *from; -{ - Code_t retval; - struct _Z_InputQ *nextq; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - nextq =Z_GetFirstComplete(); - - *ret_len = nextq->packet_len; - - if (!(*buffer = (char *) malloc((unsigned) *ret_len))) - return (ENOMEM); - - (void) memcpy(*buffer, nextq->packet, *ret_len); - - if (from) - *from = nextq->from; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPending.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPending.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPending.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZPending.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZPending function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -int ZPending() -{ - int retval; - - if (ZGetFD() < 0) { - errno = ZERR_NOPORT; - return (-1); - } - - if ((retval = Z_ReadEnqueue()) != ZERR_NONE) { - errno = retval; - return (-1); - } - - return(ZQLength()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZReadAscii.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZReadAscii.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZReadAscii.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZReadAscii.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZReadAscii function. - * - * Created by: Robert French - * - * Copyright (c) 1987, 1990 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?temp:((temp-='A'-'9'-1),(temp<16)?temp:-1)) - -Code_t ZReadAscii(ptr, len, field, num) - char *ptr; - int len; - unsigned char *field; - int num; -{ - int i; - unsigned int hexbyte; - register int c1, c2; - register unsigned int temp; - - for (i=0;ipacket_len; - - if (!(buffer = (char *) malloc((unsigned) len))) - return (ENOMEM); - - if (from) - *from = nextq->from; - - (void) memcpy(buffer, nextq->packet, len); - - auth = nextq->auth; - Z_RemQueue(nextq); - - if ((retval = ZParseNotice(buffer, len, notice)) != ZERR_NONE) - return (retval); - notice->z_checked_auth = auth; - return ZERR_NONE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRecvPkt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRecvPkt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRecvPkt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRecvPkt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for ZReceivePacket function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZReceivePacket(buffer, ret_len, from) - ZPacket_t buffer; - int *ret_len; - struct sockaddr_in *from; -{ - Code_t retval; - struct _Z_InputQ *nextq; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - nextq = Z_GetFirstComplete(); - - *ret_len = nextq->packet_len; - if (*ret_len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - (void) memcpy(buffer, nextq->packet, *ret_len); - - if (from) - *from = nextq->from; - - Z_RemQueue(nextq); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRetSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRetSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRetSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZRetSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZRetrieveSubscriptions and - * ZRetrieveDefaultSubscriptions functions. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -static Code_t Z_RetSubs(ZNotice_t *notice, int *nsubs, Z_AuthProc auth_routine); - -/* Need STDC definition when possible for unsigned short argument. */ -#ifdef __STDC__ -Code_t ZRetrieveSubscriptions(unsigned short port, int *nsubs) -#else -Code_t ZRetrieveSubscriptions(port,nsubs) - unsigned short port; - int *nsubs; -#endif -{ - int retval; - ZNotice_t notice; - char asciiport[50]; - - if (!port) /* use default port */ - port = __Zephyr_port; - - retval = ZMakeAscii16(asciiport, sizeof(asciiport), ntohs(port)); - if (retval != ZERR_NONE) - return (retval); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_message = asciiport; - notice.z_message_len = strlen(asciiport)+1; - notice.z_opcode = CLIENT_GIMMESUBS; - - return(Z_RetSubs(¬ice, nsubs, ZAUTH)); -} - -#if 0 -Code_t ZRetrieveDefaultSubscriptions(nsubs) - int *nsubs; -{ - ZNotice_t notice; - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_message = (char *) 0; - notice.z_message_len = 0; - notice.z_opcode = CLIENT_GIMMEDEFS; - - return(Z_RetSubs(¬ice, nsubs, ZNOAUTH)); - -} -#endif - -static Code_t Z_RetSubs(notice, nsubs, auth_routine) - register ZNotice_t *notice; - int *nsubs; - Z_AuthProc auth_routine; -{ - register int i; - int retval,nrecv,gimmeack; - ZNotice_t retnotice; - char *ptr,*end,*ptr2; - - retval = ZFlushSubscriptions(); - - if (retval != ZERR_NONE && retval != ZERR_NOSUBSCRIPTIONS) - return (retval); - - if (ZGetFD() < 0) - if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) - return (retval); - - notice->z_kind = ACKED; - notice->z_port = __Zephyr_port; - notice->z_class = ZEPHYR_CTL_CLASS; - notice->z_class_inst = ZEPHYR_CTL_CLIENT; - notice->z_sender = 0; - notice->z_recipient = ""; - notice->z_default_format = ""; - - if ((retval = ZSendNotice(notice,auth_routine)) != ZERR_NONE) - return (retval); - - nrecv = 0; - gimmeack = 0; - __subscriptions_list = (ZSubscription_t *) 0; - - while (!nrecv || !gimmeack) { - retval = Z_WaitForNotice (&retnotice, ZCompareMultiUIDPred, - ¬ice->z_multiuid, SRV_TIMEOUT); - if (retval == ZERR_NONOTICE) - return ETIMEDOUT; - else if (retval != ZERR_NONE) - return retval; - - if (retnotice.z_kind == SERVNAK) { - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - /* non-matching protocol version numbers means the - server is probably an older version--must punt */ - if (strcmp(notice->z_version,retnotice.z_version)) { - ZFreeNotice(&retnotice); - return(ZERR_VERS); - } - if (retnotice.z_kind == SERVACK && - !strcmp(retnotice.z_opcode,notice->z_opcode)) { - ZFreeNotice(&retnotice); - gimmeack = 1; - continue; - } - - if (retnotice.z_kind != ACKED) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - nrecv++; - - end = retnotice.z_message+retnotice.z_message_len; - - __subscriptions_num = 0; - for (ptr=retnotice.z_message;ptr -#else -#include -#endif - -static int wait_for_hmack(ZNotice_t *notice, void *uid); - -Code_t ZSendPacket(packet, len, waitforack) - char *packet; - int len; - int waitforack; -{ - Code_t retval; - struct sockaddr_in dest; - ZNotice_t notice, acknotice; - - if (!packet || len < 0) - return (ZERR_ILLVAL); - - if (len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - if (ZGetFD() < 0) - if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) - return (retval); - - dest = ZGetDestAddr(); - - if (sendto(ZGetFD(), packet, len, 0, (struct sockaddr *)&dest, - sizeof(dest)) < 0) - return (errno); - - if (!waitforack) - return (ZERR_NONE); - - if ((retval = ZParseNotice(packet, len, ¬ice)) != ZERR_NONE) - return (retval); - - retval = Z_WaitForNotice (&acknotice, wait_for_hmack, ¬ice.z_uid, - HM_TIMEOUT); - if (retval == ETIMEDOUT) - return ZERR_HMDEAD; - if (retval == ZERR_NONE) - ZFreeNotice (&acknotice); - return retval; -} - -static int wait_for_hmack(ZNotice_t *notice, void *uid) -{ - return (notice->z_kind == HMACK && ZCompareUID(¬ice->z_uid, (ZUnique_Id_t *)uid)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRaw.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRaw.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRaw.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRaw.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSendRawNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZSendRawNotice(notice) - ZNotice_t *notice; -{ - Code_t retval; - ZNotice_t newnotice; - char *buffer; - int len; - - if ((retval = ZFormatRawNotice(notice, &buffer, &len)) != - ZERR_NONE) - return (retval); - - if ((retval = ZParseNotice(buffer, len, &newnotice)) != ZERR_NONE) - return (retval); - - retval = Z_SendFragmentedNotice(&newnotice, len, NULL, Z_XmitFragment); - - free(buffer); - - return (retval); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRLst.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRLst.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRLst.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSendRLst.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSendRawList function. - * - * Created by: John T. Kohl - * - * Copyright (c) 1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZSendRawList(notice, list, nitems) - ZNotice_t *notice; - char *list[]; - int nitems; -{ - return(ZSrvSendRawList(notice, list, nitems, Z_XmitFragment)); -} - -Code_t ZSrvSendRawList(notice, list, nitems, send_routine) - ZNotice_t *notice; - char *list[]; - int nitems; - Code_t (*send_routine)(); -{ - Code_t retval; - ZNotice_t newnotice; - char *buffer; - int len; - - if ((retval = ZFormatRawNoticeList(notice, list, nitems, &buffer, - &len)) != ZERR_NONE) - return (retval); - - if ((retval = ZParseNotice(buffer, len, &newnotice)) != ZERR_NONE) - return (retval); - - retval = Z_SendFragmentedNotice(&newnotice, len, NULL, send_routine); - - free(buffer); - - return (retval); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetDest.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetDest.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetDest.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetDest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetDestAddr function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZSetDestAddr(addr) - struct sockaddr_in *addr; -{ - __HM_addr = *addr; - - __HM_set = 1; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetFD.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetFD.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetFD.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetFD.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetFD function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZSetFD(fd) - int fd; -{ - (void) ZClosePort(); - - __Zephyr_fd = fd; - __Zephyr_open = 0; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetSrv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetSrv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetSrv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSetSrv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetServerState function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZSetServerState(state) - int state; -{ - __Zephyr_server = state; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,193 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSubscribeTo, ZUnsubscribeTo, and - * ZCancelSubscriptions functions. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -static Code_t Z_Subscriptions __P((register ZSubscription_t *sublist, - int nitems, unsigned int port, - char *opcode, int authit)); -static Code_t subscr_sendoff __P((ZNotice_t *notice, char **lyst, int num, - int authit)); - -Code_t ZSubscribeTo(sublist, nitems, port) - ZSubscription_t *sublist; - int nitems; - unsigned int port; -{ - return (Z_Subscriptions(sublist, nitems, port, CLIENT_SUBSCRIBE, 1)); -} - -Code_t ZSubscribeToSansDefaults(sublist, nitems, port) - ZSubscription_t *sublist; - int nitems; - unsigned int port; -{ - return (Z_Subscriptions(sublist, nitems, port, CLIENT_SUBSCRIBE_NODEFS, - 1)); -} - -Code_t ZUnsubscribeTo(sublist, nitems, port) - ZSubscription_t *sublist; - int nitems; - unsigned int port; -{ - return (Z_Subscriptions(sublist, nitems, port, CLIENT_UNSUBSCRIBE, 1)); -} - -Code_t ZCancelSubscriptions(port) - unsigned int port; -{ - return (Z_Subscriptions((ZSubscription_t *)0, 0, port, - CLIENT_CANCELSUB, 0)); -} - -/* - * This routine must do its own fragmentation. Subscriptions must - * not be broken across packet boundaries, or else the server will - * mis-interpret them. - */ - -static Code_t -Z_Subscriptions(sublist, nitems, port, opcode, authit) - register ZSubscription_t *sublist; - int nitems; - unsigned int port; - char *opcode; - int authit; -{ - register int i, j; - int retval; - ZNotice_t notice; - char header[Z_MAXHEADERLEN]; - char **list; - char *recip; - int hdrlen; - int size_avail = Z_MAXPKTLEN-Z_FRAGFUDGE; /* space avail for data, - adjusted below */ - int size, start, numok; - - /* nitems = 0 means cancel all subscriptions; still need to allocate a */ - /* array for one item so we can cancel, however. */ - - list = (char **)malloc((unsigned)((nitems==0)?1:nitems)*3*sizeof(char *)); - if (!list) - return (ENOMEM); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = ACKED; - notice.z_port = port; - notice.z_class = ZEPHYR_CTL_CLASS; - notice.z_class_inst = ZEPHYR_CTL_CLIENT; - notice.z_opcode = opcode; - notice.z_sender = 0; - notice.z_recipient = ""; - notice.z_default_format = ""; - notice.z_message_len = 0; - - /* format the header to figure out how long it is */ - retval = Z_FormatHeader(¬ice, header, sizeof(header), &hdrlen, ZAUTH); - if (retval != ZERR_NONE && !authit) - retval = Z_FormatHeader(¬ice, header, sizeof(header), - &hdrlen, ZNOAUTH); - if (retval != ZERR_NONE) { - free((char *)list); - return(retval); - } - - /* compute amount of room left */ - size_avail -= hdrlen; - size = size_avail; - - /* assemble subs into an array of pointers */ - for (i=0;iz_uid)) != - ZERR_NONE) - return (retval); - if (retnotice.z_kind == SERVNAK) { - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - if (retnotice.z_kind != SERVACK) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - ZFreeNotice(&retnotice); - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZVariables.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZVariables.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZVariables.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZVariables.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZGetVariable, ZSetVariable, and ZUnsetVariable - * functions. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "libpurple/internal.h" -#include "internal.h" -#include "util.h" - -#include -#ifndef WIN32 -#include -#endif - -static char *get_localvarfile __P((void)); -static char *get_varval __P((char *fn, char *val)); -static int varline __P((char *bfr, char *var)); - -char *ZGetVariable(var) - char *var; -{ - char *varfile, *ret; - - if ((varfile = get_localvarfile()) == NULL) - return ((char *)0); - - if ((ret = get_varval(varfile, var)) != ZERR_NONE) { - g_free(varfile); - return ret; - } - -#ifdef WIN32 - varfile = g_strdup("C:\\zephyr\\zephyr.var"); -#else - varfile = g_strdup_printf("%s/zephyr.vars", CONFDIR); -#endif - ret = get_varval(varfile, var); - g_free(varfile); - - return ret; -} - -Code_t ZSetVariable(var, value) - char *var; - char *value; -{ - int written; - FILE *fpin, *fpout; - char *varfile, *varfilebackup, varbfr[512]; - - written = 0; - - if ((varfile = get_localvarfile()) == NULL) - return (ZERR_INTERNAL); - - varfilebackup = g_strconcat(varfile, ".backup", NULL); - - if (!(fpout = fopen(varfilebackup, "w"))) { - g_free(varfile); - g_free(varfilebackup); - return (errno); - } - if ((fpin = fopen(varfile, "r")) != NULL) { - while (fgets(varbfr, sizeof varbfr, fpin) != (char *) 0) { - if (varbfr[strlen(varbfr)-1] < ' ') - varbfr[strlen(varbfr)-1] = '\0'; - if (varline(varbfr, var)) { - fprintf(fpout, "%s = %s\n", var, value); - written = 1; - } - else - fprintf(fpout, "%s\n", varbfr); - } - (void) fclose(fpin); /* don't care about errs on input */ - } - if (!written) - fprintf(fpout, "%s = %s\n", var, value); - if (fclose(fpout) == EOF) { - g_free(varfilebackup); - g_free(varfile); - return(EIO); /* can't rely on errno */ - } - if (rename(varfilebackup, varfile)) { - g_free(varfilebackup); - g_free(varfile); - return (errno); - } - g_free(varfilebackup); - g_free(varfile); - return (ZERR_NONE); -} - -Code_t ZUnsetVariable(var) - char *var; -{ - FILE *fpin, *fpout; - char *varfile, *varfilebackup, varbfr[512]; - - if ((varfile = get_localvarfile()) == NULL) - return (ZERR_INTERNAL); - - varfilebackup = g_strconcat(varfile, ".backup", NULL); - - if (!(fpout = fopen(varfilebackup, "w"))) { - g_free(varfile); - g_free(varfilebackup); - return (errno); - } - if ((fpin = fopen(varfile, "r")) != NULL) { - while (fgets(varbfr, sizeof varbfr, fpin) != (char *) 0) { - if (varbfr[strlen(varbfr)-1] < ' ') - varbfr[strlen(varbfr)-1] = '\0'; - if (!varline(varbfr, var)) - fprintf(fpout, "%s\n", varbfr); - } - (void) fclose(fpin); /* don't care about read close errs */ - } - if (fclose(fpout) == EOF) { - g_free(varfilebackup); - g_free(varfile); - return(EIO); /* errno isn't reliable */ - } - if (rename(varfilebackup, varfile)) { - g_free(varfilebackup); - g_free(varfile); - return (errno); - } - g_free(varfilebackup); - g_free(varfile); - return (ZERR_NONE); -} - -static char *get_localvarfile(void) -{ - const char *base; -#ifndef WIN32 - struct passwd *pwd; - base = purple_home_dir(); -#else - base = getenv("HOME"); - if (!base) - base = getenv("HOMEPATH"); - if (!base) - base = "C:\\"; -#endif - if (!base) { -#ifndef WIN32 - if (!(pwd = getpwuid((int) getuid()))) { - fprintf(stderr, "Zephyr internal failure: Can't find your entry in /etc/passwd\n"); - return NULL; - } - base = pwd->pw_dir; -#endif - } - - return g_strconcat(base, "/.zephyr.vars", NULL); -} - -static char *get_varval(fn, var) - char *fn; - char *var; -{ - FILE *fp; - static char varbfr[512]; - int i; - - fp = fopen(fn, "r"); - if (!fp) - return ((char *)0); - - while (fgets(varbfr, sizeof varbfr, fp) != (char *) 0) { - if (varbfr[strlen(varbfr)-1] < ' ') - varbfr[strlen(varbfr)-1] = '\0'; - if (!(i = varline(varbfr, var))) - continue; - (void) fclose(fp); /* open read-only, don't care */ - return (varbfr+i); - } - (void) fclose(fp); /* open read-only, don't care */ - return ((char *)0); -} - -/* If the variable in the line bfr[] is the same as var, return index to - the variable value, else return 0. */ -static int varline(bfr, var) - char *bfr; - char *var; -{ - register char *cp; - - - if (!bfr[0] || bfr[0] == '#') /* comment or null line */ - return (0); - - cp = bfr; - while (*cp && !isspace(*cp) && (*cp != '=')) - cp++; - -#ifndef WIN32 -#define max(a,b) ((a > b) ? (a) : (b)) -#endif - - if (g_ascii_strncasecmp(bfr, var, max(strlen(var), cp - bfr))) - return(0); /* var is not the var in - bfr ==> no match */ - - cp = strchr(bfr, '='); - if (!cp) - return(0); - cp++; - while (*cp && isspace(*cp)) /* space up to variable value */ - cp++; - - return (cp - bfr); /* return index */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZWait4Not.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZWait4Not.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZWait4Not.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/protocols/zephyr/ZWait4Not.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains the ZCheckIfNotice/select loop used for waiting for - * a notice, with a timeout. - * - * Copyright (c) 1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifdef WIN32 -#include - -#ifndef ZEPHYR_USES_KERBEROS -static int gettimeofday(struct timeval* tv, struct timezone* tz){ - union { - long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } _now; - - GetSystemTimeAsFileTime( &(_now.ft) ); - tv->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); - tv->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); - return 0; - } -#endif - -#else -#include -#endif - -Code_t Z_WaitForNotice (notice, pred, arg, timeout) - ZNotice_t *notice; - int (*pred) __P((ZNotice_t *, void *)); - void *arg; - int timeout; -{ - Code_t retval; - struct timeval tv, t0; - fd_set fdmask; - int i, fd; - - retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, - (char *) arg); - if (retval == ZERR_NONE) - return ZERR_NONE; - if (retval != ZERR_NONOTICE) - return retval; - - fd = ZGetFD (); - FD_ZERO (&fdmask); - tv.tv_sec = timeout; - tv.tv_usec = 0; - gettimeofday (&t0, (struct timezone *)NULL); - t0.tv_sec += timeout; - while (1) { - FD_SET (fd, &fdmask); - i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv); - if (i == 0) - return ETIMEDOUT; - if (i < 0 && errno != EINTR) - return errno; - if (i > 0) { - retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, - (char *) arg); - if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */ - return retval; - } - gettimeofday (&tv, (struct timezone *) NULL); - tv.tv_usec = t0.tv_usec - tv.tv_usec; - if (tv.tv_usec < 0) { - tv.tv_usec += 1000000; - tv.tv_sec = t0.tv_sec - tv.tv_sec - 1; - } - else - tv.tv_sec = t0.tv_sec - tv.tv_sec; - } - /*NOTREACHED*/ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2539 +0,0 @@ -/** - * @file proxy.c Proxy API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* this is a little piece of code to handle proxy connection */ -/* it is intended to : 1st handle http proxy, using the CONNECT command - , 2nd provide an easy way to add socks support - , 3rd draw women to it like flies to honey */ - -#include "internal.h" -#include "cipher.h" -#include "debug.h" -#include "dnsquery.h" -#include "notify.h" -#include "ntlm.h" -#include "prefs.h" -#include "proxy.h" -#include "util.h" - -struct _PurpleProxyConnectData { - void *handle; - PurpleProxyConnectFunction connect_cb; - gpointer data; - gchar *host; - int port; - int fd; - int socket_type; - guint inpa; - PurpleProxyInfo *gpi; - PurpleDnsQueryData *query_data; - - /** - * This contains alternating length/char* values. The char* - * values need to be freed when removed from the linked list. - */ - GSList *hosts; - - /* - * All of the following variables are used when establishing a - * connection through a proxy. - */ - guchar *write_buffer; - gsize write_buf_len; - gsize written_len; - PurpleInputFunction read_cb; - guchar *read_buffer; - gsize read_buf_len; - gsize read_len; -}; - -static const char * const socks5errors[] = { - "succeeded\n", - "general SOCKS server failure\n", - "connection not allowed by ruleset\n", - "Network unreachable\n", - "Host unreachable\n", - "Connection refused\n", - "TTL expired\n", - "Command not supported\n", - "Address type not supported\n" -}; - -static PurpleProxyInfo *global_proxy_info = NULL; - -static GSList *handles = NULL; - -static void try_connect(PurpleProxyConnectData *connect_data); - -/* - * TODO: Eventually (GObjectification) this bad boy will be removed, because it is - * a gross fix for a crashy problem. - */ -#define PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data) g_slist_find(handles, connect_data) - -/************************************************************************** - * Proxy structure API - **************************************************************************/ -PurpleProxyInfo * -purple_proxy_info_new(void) -{ - return g_new0(PurpleProxyInfo, 1); -} - -void -purple_proxy_info_destroy(PurpleProxyInfo *info) -{ - g_return_if_fail(info != NULL); - - g_free(info->host); - g_free(info->username); - g_free(info->password); - - g_free(info); -} - -void -purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type) -{ - g_return_if_fail(info != NULL); - - info->type = type; -} - -void -purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host) -{ - g_return_if_fail(info != NULL); - - g_free(info->host); - info->host = g_strdup(host); -} - -void -purple_proxy_info_set_port(PurpleProxyInfo *info, int port) -{ - g_return_if_fail(info != NULL); - - info->port = port; -} - -void -purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username) -{ - g_return_if_fail(info != NULL); - - g_free(info->username); - info->username = g_strdup(username); -} - -void -purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password) -{ - g_return_if_fail(info != NULL); - - g_free(info->password); - info->password = g_strdup(password); -} - -PurpleProxyType -purple_proxy_info_get_type(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, PURPLE_PROXY_NONE); - - return info->type; -} - -const char * -purple_proxy_info_get_host(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, NULL); - - return info->host; -} - -int -purple_proxy_info_get_port(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, 0); - - return info->port; -} - -const char * -purple_proxy_info_get_username(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, NULL); - - return info->username; -} - -const char * -purple_proxy_info_get_password(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, NULL); - - return info->password; -} - -/************************************************************************** - * Global Proxy API - **************************************************************************/ -PurpleProxyInfo * -purple_global_proxy_get_info(void) -{ - return global_proxy_info; -} - -void -purple_global_proxy_set_info(PurpleProxyInfo *info) -{ - g_return_if_fail(info != NULL); - - purple_proxy_info_destroy(global_proxy_info); - - global_proxy_info = info; -} - -static PurpleProxyInfo * -purple_gnome_proxy_get_info(void) -{ - static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; - gboolean use_same_proxy = FALSE; - gchar *tmp, *err = NULL; - - tmp = g_find_program_in_path("gconftool-2"); - if (tmp == NULL) - return purple_global_proxy_get_info(); - - g_free(tmp); - tmp = NULL; - - /* Check whether to use a proxy. */ - if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/mode", - &tmp, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - - if (purple_strequal(tmp, "none\n")) { - info.type = PURPLE_PROXY_NONE; - g_free(tmp); - return &info; - } - - if (!purple_strequal(tmp, "manual\n")) { - /* Unknown setting. Fallback to using our global proxy settings. */ - g_free(tmp); - return purple_global_proxy_get_info(); - } - - g_free(tmp); - tmp = NULL; - - /* Free the old fields */ - if (info.host) { - g_free(info.host); - info.host = NULL; - } - if (info.username) { - g_free(info.username); - info.username = NULL; - } - if (info.password) { - g_free(info.password); - info.password = NULL; - } - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/use_same_proxy", - &tmp, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - - if (purple_strequal(tmp, "true\n")) - use_same_proxy = TRUE; - g_free(tmp); - tmp = NULL; - - if (!use_same_proxy) { - if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_host", - &info.host, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - } - - if(info.host != NULL) - g_strchomp(info.host); - - if (!use_same_proxy && (info.host != NULL) && (*info.host != '\0')) { - info.type = PURPLE_PROXY_SOCKS5; - if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_port", - &tmp, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - info.port = atoi(tmp); - g_free(tmp); - } else { - g_free(info.host); - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", - &info.host, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - - /* If we get this far then we know we're using an HTTP proxy */ - info.type = PURPLE_PROXY_HTTP; - - g_strchomp(info.host); - if (*info.host == '\0') - { - purple_debug_info("proxy", "Gnome proxy settings are set to " - "'manual' but no suitable proxy server is specified. Using " - "Pidgin's proxy settings instead.\n"); - g_free(info.host); - info.host = NULL; - return purple_global_proxy_get_info(); - } - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", - &info.username, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - err = NULL; - g_strchomp(info.username); - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_password", - &info.password, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - g_free(info.username); - info.username = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - err = NULL; - g_strchomp(info.password); - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", - &tmp, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - g_free(info.username); - info.username = NULL; - g_free(info.password); - info.password = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - info.port = atoi(tmp); - g_free(tmp); - } - - return &info; -} - -#ifdef _WIN32 - -typedef BOOL (CALLBACK* LPFNWINHTTPGETIEPROXYCONFIG)(/*IN OUT*/ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig); - -/* This modifies "host" in-place evilly */ -static void -_proxy_fill_hostinfo(PurpleProxyInfo *info, char *host, int default_port) -{ - int port = default_port; - char *d; - - d = g_strrstr(host, ":"); - if (d) - *d = '\0'; - d++; - if (*d) - sscanf(d, "%d", &port); - - purple_proxy_info_set_host(info, host); - purple_proxy_info_set_port(info, port); -} - -static PurpleProxyInfo * -purple_win32_proxy_get_info(void) -{ - static LPFNWINHTTPGETIEPROXYCONFIG MyWinHttpGetIEProxyConfig = NULL; - static gboolean loaded = FALSE; - static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; - - WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_proxy_config; - - if (!loaded) { - loaded = TRUE; - MyWinHttpGetIEProxyConfig = (LPFNWINHTTPGETIEPROXYCONFIG) - wpurple_find_and_loadproc("winhttp.dll", "WinHttpGetIEProxyConfigForCurrentUser"); - if (!MyWinHttpGetIEProxyConfig) - purple_debug_warning("proxy", "Unable to read Windows Proxy Settings.\n"); - } - - if (!MyWinHttpGetIEProxyConfig) - return NULL; - - ZeroMemory(&ie_proxy_config, sizeof(ie_proxy_config)); - if (!MyWinHttpGetIEProxyConfig(&ie_proxy_config)) { - purple_debug_error("proxy", "Error reading Windows Proxy Settings(%lu).\n", GetLastError()); - return NULL; - } - - /* We can't do much if it is autodetect*/ - if (ie_proxy_config.fAutoDetect) { - purple_debug_error("proxy", "Windows Proxy Settings set to autodetect (not supported).\n"); - - /* TODO: For 3.0.0 we'll revisit this (maybe)*/ - - return NULL; - - } else if (ie_proxy_config.lpszProxy) { - gchar *proxy_list = g_utf16_to_utf8(ie_proxy_config.lpszProxy, -1, - NULL, NULL, NULL); - - /* We can't do anything about the bypass list, as we don't have the url */ - /* TODO: For 3.0.0 we'll revisit this*/ - - /* There are proxy settings for several protocols */ - if (proxy_list && *proxy_list) { - char *specific = NULL, *tmp; - - /* If there is only a global proxy, which means "HTTP" */ - if (!strchr(proxy_list, ';') || (specific = g_strstr_len(proxy_list, -1, "http=")) != NULL) { - - if (specific) { - specific += strlen("http="); - tmp = strchr(specific, ';'); - if (tmp) - *tmp = '\0'; - /* specific now points the proxy server (and port) */ - } else - specific = proxy_list; - - purple_proxy_info_set_type(&info, PURPLE_PROXY_HTTP); - _proxy_fill_hostinfo(&info, specific, 80); - /* TODO: is there a way to set the username/password? */ - purple_proxy_info_set_username(&info, NULL); - purple_proxy_info_set_password(&info, NULL); - - purple_debug_info("proxy", "Windows Proxy Settings: HTTP proxy: '%s:%d'.\n", - purple_proxy_info_get_host(&info), - purple_proxy_info_get_port(&info)); - - } else if ((specific = g_strstr_len(proxy_list, -1, "socks=")) != NULL) { - - specific += strlen("socks="); - tmp = strchr(specific, ';'); - if (tmp) - *tmp = '\0'; - /* specific now points the proxy server (and port) */ - - purple_proxy_info_set_type(&info, PURPLE_PROXY_SOCKS5); - _proxy_fill_hostinfo(&info, specific, 1080); - /* TODO: is there a way to set the username/password? */ - purple_proxy_info_set_username(&info, NULL); - purple_proxy_info_set_password(&info, NULL); - - purple_debug_info("proxy", "Windows Proxy Settings: SOCKS5 proxy: '%s:%d'.\n", - purple_proxy_info_get_host(&info), - purple_proxy_info_get_port(&info)); - - } else { - - purple_debug_info("proxy", "Windows Proxy Settings: No supported proxy specified.\n"); - - purple_proxy_info_set_type(&info, PURPLE_PROXY_NONE); - - } - } - - /* TODO: Fix API to be able look at proxy bypass settings */ - - g_free(proxy_list); - } else { - purple_debug_info("proxy", "No Windows proxy set.\n"); - purple_proxy_info_set_type(&info, PURPLE_PROXY_NONE); - } - - if (ie_proxy_config.lpszAutoConfigUrl) - GlobalFree(ie_proxy_config.lpszAutoConfigUrl); - if (ie_proxy_config.lpszProxy) - GlobalFree(ie_proxy_config.lpszProxy); - if (ie_proxy_config.lpszProxyBypass) - GlobalFree(ie_proxy_config.lpszProxyBypass); - - return &info; -} -#endif - - -/************************************************************************** - * Proxy API - **************************************************************************/ - -/** - * Whoever calls this needs to have called - * purple_proxy_connect_data_disconnect() beforehand. - */ -static void -purple_proxy_connect_data_destroy(PurpleProxyConnectData *connect_data) -{ - handles = g_slist_remove(handles, connect_data); - - if (connect_data->query_data != NULL) - purple_dnsquery_destroy(connect_data->query_data); - - while (connect_data->hosts != NULL) - { - /* Discard the length... */ - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); - /* Free the address... */ - g_free(connect_data->hosts->data); - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); - } - - g_free(connect_data->host); - g_free(connect_data); -} - -/** - * Free all information dealing with a connection attempt and - * reset the connect_data to prepare for it to try to connect - * to another IP address. - * - * If an error message is passed in, then we know the connection - * attempt failed. If the connection attempt failed and - * connect_data->hosts is not empty then we try the next IP address. - * If the connection attempt failed and we have no more hosts - * try try then we call the callback with the given error message, - * then destroy the connect_data. - * - * @param error_message An error message explaining why the connection - * failed. This will be passed to the callback function - * specified in the call to purple_proxy_connect(). If the - * connection was successful then pass in null. - */ -static void -purple_proxy_connect_data_disconnect(PurpleProxyConnectData *connect_data, const gchar *error_message) -{ - if (connect_data->inpa > 0) - { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - if (connect_data->fd >= 0) - { - close(connect_data->fd); - connect_data->fd = -1; - } - - g_free(connect_data->write_buffer); - connect_data->write_buffer = NULL; - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - if (error_message != NULL) - { - purple_debug_error("proxy", "Connection attempt failed: %s\n", - error_message); - if (connect_data->hosts != NULL) - try_connect(connect_data); - else - { - /* Everything failed! Tell the originator of the request. */ - connect_data->connect_cb(connect_data->data, -1, error_message); - purple_proxy_connect_data_destroy(connect_data); - } - } -} - -/** - * This calls purple_proxy_connect_data_disconnect(), but it lets you - * specify the error_message using a printf()-like syntax. - */ -static void -purple_proxy_connect_data_disconnect_formatted(PurpleProxyConnectData *connect_data, const char *format, ...) -{ - va_list args; - gchar *tmp; - - va_start(args, format); - tmp = g_strdup_vprintf(format, args); - va_end(args); - - purple_proxy_connect_data_disconnect(connect_data, tmp); - g_free(tmp); -} - -static void -purple_proxy_connect_data_connected(PurpleProxyConnectData *connect_data) -{ - purple_debug_info("proxy", "Connected to %s:%d.\n", - connect_data->host, connect_data->port); - - connect_data->connect_cb(connect_data->data, connect_data->fd, NULL); - - /* - * We've passed the file descriptor to the protocol, so it's no longer - * our responsibility, and we should be careful not to free it when - * we destroy the connect_data. - */ - connect_data->fd = -1; - - purple_proxy_connect_data_disconnect(connect_data, NULL); - purple_proxy_connect_data_destroy(connect_data); -} - -static void -socket_ready_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int error = 0; - int ret; - - /* If the socket-connected message had already been triggered when connect_data - * was destroyed via purple_proxy_connect_cancel(), we may get here with a freed connect_data. - */ - if (!PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data)) - return; - - purple_debug_info("proxy", "Connecting to %s:%d.\n", - connect_data->host, connect_data->port); - - /* - * purple_input_get_error after a non-blocking connect returns -1 if something is - * really messed up (bad descriptor, usually). Otherwise, it returns 0 and - * error holds what connect would have returned if it blocked until now. - * Thus, error == 0 is success, error == EINPROGRESS means "try again", - * and anything else is a real error. - * - * (error == EINPROGRESS can happen after a select because the kernel can - * be overly optimistic sometimes. select is just a hint that you might be - * able to do something.) - */ - ret = purple_input_get_error(connect_data->fd, &error); - - if (ret == 0 && error == EINPROGRESS) { - /* No worries - we'll be called again later */ - /* TODO: Does this ever happen? */ - purple_debug_info("proxy", "(ret == 0 && error == EINPROGRESS)\n"); - return; - } - - if (ret != 0 || error != 0) { - if (ret != 0) - error = errno; - purple_debug_error("proxy", "Error connecting to %s:%d (%s).\n", - connect_data->host, connect_data->port, g_strerror(error)); - - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - purple_proxy_connect_data_connected(connect_data); -} - -static gboolean -clean_connect(gpointer data) -{ - purple_proxy_connect_data_connected(data); - - return FALSE; -} - -static void -proxy_connect_udp_none(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", "UDP Connecting to %s:%d with no proxy\n", - connect_data->host, connect_data->port); - - connect_data->fd = socket(addr->sa_family, SOCK_DGRAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("proxy", "UDP Connection in progress\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, socket_ready_cb, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - /* - * The connection happened IMMEDIATELY... strange, but whatever. - */ - int error = ETIMEDOUT; - int ret; - - purple_debug_info("proxy", "UDP Connected immediately.\n"); - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) - { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - /* - * We want to call the "connected" callback eventually, but we - * don't want to call it before we return, just in case. - */ - purple_timeout_add(10, clean_connect, connect_data); - } -} - -static void -proxy_connect_none(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", "Connecting to %s:%d with no proxy\n", - connect_data->host, connect_data->port); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("proxy", "Connection in progress\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, socket_ready_cb, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - /* - * The connection happened IMMEDIATELY... strange, but whatever. - */ - int error = ETIMEDOUT; - int ret; - - purple_debug_info("proxy", "Connected immediately.\n"); - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) - { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - /* - * We want to call the "connected" callback eventually, but we - * don't want to call it before we return, just in case. - */ - purple_timeout_add(10, clean_connect, connect_data); - } -} - -/** - * This is a utility function used by the HTTP, SOCKS4 and SOCKS5 - * connect functions. It writes data from a buffer to a socket. - * When all the data is written it sets up a watcher to read a - * response and call a specified function. - */ -static void -proxy_do_write(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data; - const guchar *request; - gsize request_len; - int ret; - - connect_data = data; - request = connect_data->write_buffer + connect_data->written_len; - request_len = connect_data->write_buf_len - connect_data->written_len; - - ret = write(connect_data->fd, request, request_len); - if (ret <= 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - return; - } - if (ret < request_len) { - connect_data->written_len += ret; - return; - } - - /* We're done writing data! Wait for a response. */ - g_free(connect_data->write_buffer); - connect_data->write_buffer = NULL; - purple_input_remove(connect_data->inpa); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_READ, connect_data->read_cb, connect_data); -} - -#define HTTP_GOODSTRING "HTTP/1.0 200" -#define HTTP_GOODSTRING2 "HTTP/1.1 200" - -/** - * We're using an HTTP proxy for a non-port 80 tunnel. Read the - * response to the CONNECT request. - */ -static void -http_canread(gpointer data, gint source, PurpleInputCondition cond) -{ - int len, headers_len, status = 0; - gboolean error; - PurpleProxyConnectData *connect_data = data; - char *p; - gsize max_read; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 8192; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - p = (char *)connect_data->read_buffer + connect_data->read_len; - max_read = connect_data->read_buf_len - connect_data->read_len - 1; - - len = read(connect_data->fd, p, max_read); - - if (len == 0) { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - p[len] = '\0'; - - p = g_strstr_len((const gchar *)connect_data->read_buffer, - connect_data->read_len, "\r\n\r\n"); - if (p != NULL) { - *p = '\0'; - headers_len = (p - (char *)connect_data->read_buffer) + 4; - } else if(len == max_read) - headers_len = len; - else - return; - - error = strncmp((const char *)connect_data->read_buffer, "HTTP/", 5) != 0; - if (!error) { - int major; - p = (char *)connect_data->read_buffer + 5; - major = strtol(p, &p, 10); - error = (major == 0) || (*p != '.'); - if(!error) { - int minor; - p++; - minor = strtol(p, &p, 10); - error = (*p != ' '); - if(!error) { - p++; - status = strtol(p, &p, 10); - error = (*p != ' '); - } - } - } - - /* Read the contents */ - p = g_strrstr((const gchar *)connect_data->read_buffer, "Content-Length: "); - if (p != NULL) { - gchar *tmp; - int len = 0; - char tmpc; - p += strlen("Content-Length: "); - tmp = strchr(p, '\r'); - if(tmp) - *tmp = '\0'; - len = atoi(p); - if(tmp) - *tmp = '\r'; - - /* Compensate for what has already been read */ - len -= connect_data->read_len - headers_len; - /* I'm assuming that we're doing this to prevent the server from - complaining / breaking since we don't read the whole page */ - while (len--) { - /* TODO: deal with EAGAIN (and other errors) better */ - if (read(connect_data->fd, &tmpc, 1) < 0 && errno != EAGAIN) - break; - } - } - - if (error) { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to parse response from HTTP proxy: %s"), - connect_data->read_buffer); - return; - } - else if (status != 200) { - purple_debug_error("proxy", - "Proxy server replied with:\n%s\n", - connect_data->read_buffer); - - if (status == 407 /* Proxy Auth */) { - const char *header; - gchar *request; - - header = g_strrstr((const gchar *)connect_data->read_buffer, - "Proxy-Authenticate: NTLM"); - if (header != NULL) { - const char *header_end = header + strlen("Proxy-Authenticate: NTLM"); - const char *domain = purple_proxy_info_get_username(connect_data->gpi); - char *username = NULL, hostname[256]; - gchar *response; - int ret; - - ret = gethostname(hostname, sizeof(hostname)); - hostname[sizeof(hostname) - 1] = '\0'; - if (ret < 0 || hostname[0] == '\0') { - purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?"); - strcpy(hostname, "localhost"); - } - - if (domain != NULL) - username = (char*) strchr(domain, '\\'); - if (username == NULL) { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("HTTP proxy connection error %d"), status); - return; - } - *username = '\0'; - - /* Is there a message? */ - if (*header_end == ' ') { - /* Check for Type-2 */ - char *tmp = (char*) header; - guint8 *nonce; - - header_end++; - username++; - while(*tmp != '\r' && *tmp != '\0') tmp++; - *tmp = '\0'; - nonce = purple_ntlm_parse_type2(header_end, NULL); - response = purple_ntlm_gen_type3(username, - (gchar*) purple_proxy_info_get_password(connect_data->gpi), - hostname, - domain, nonce, NULL); - username--; - } else /* Empty message */ - response = purple_ntlm_gen_type1(hostname, domain); - - *username = '\\'; - - request = g_strdup_printf( - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: %s:%d\r\n" - "Proxy-Authorization: NTLM %s\r\n" - "Proxy-Connection: Keep-Alive\r\n\r\n", - connect_data->host, connect_data->port, - connect_data->host, connect_data->port, - response); - - g_free(response); - - } else if((header = g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: Basic"))) { - gchar *t1, *t2; - const char *username, *password; - - username = purple_proxy_info_get_username(connect_data->gpi); - password = purple_proxy_info_get_password(connect_data->gpi); - - t1 = g_strdup_printf("%s:%s", - username ? username : "", - password ? password : ""); - t2 = purple_base64_encode((guchar *)t1, strlen(t1)); - g_free(t1); - - request = g_strdup_printf( - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: %s:%d\r\n" - "Proxy-Authorization: Basic %s\r\n", - connect_data->host, connect_data->port, - connect_data->host, connect_data->port, - t2); - - g_free(t2); - - } else { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("HTTP proxy connection error %d"), status); - return; - } - - purple_input_remove(connect_data->inpa); - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->write_buffer = (guchar *)request; - connect_data->write_buf_len = strlen(request); - connect_data->written_len = 0; - - connect_data->read_cb = http_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, cond); - - return; - } - - if (status == 403) { - /* Forbidden */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Access denied: HTTP proxy server forbids port %d tunneling"), - connect_data->port); - } else { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("HTTP proxy connection error %d"), status); - } - } else { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - purple_debug_info("proxy", "HTTP proxy connection established\n"); - purple_proxy_connect_data_connected(connect_data); - return; - } -} - -static void -http_start_connect_tunneling(PurpleProxyConnectData *connect_data) { - GString *request; - int ret; - - purple_debug_info("proxy", "Using CONNECT tunneling for %s:%d\n", - connect_data->host, connect_data->port); - - request = g_string_sized_new(4096); - g_string_append_printf(request, - "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", - connect_data->host, connect_data->port, - connect_data->host, connect_data->port); - - if (purple_proxy_info_get_username(connect_data->gpi) != NULL) - { - char *t1, *t2, *ntlm_type1; - char hostname[256]; - - ret = gethostname(hostname, sizeof(hostname)); - hostname[sizeof(hostname) - 1] = '\0'; - if (ret < 0 || hostname[0] == '\0') { - purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?"); - strcpy(hostname, "localhost"); - } - - t1 = g_strdup_printf("%s:%s", - purple_proxy_info_get_username(connect_data->gpi), - purple_proxy_info_get_password(connect_data->gpi) ? - purple_proxy_info_get_password(connect_data->gpi) : ""); - t2 = purple_base64_encode((const guchar *)t1, strlen(t1)); - g_free(t1); - - ntlm_type1 = purple_ntlm_gen_type1(hostname, ""); - - g_string_append_printf(request, - "Proxy-Authorization: Basic %s\r\n" - "Proxy-Authorization: NTLM %s\r\n" - "Proxy-Connection: Keep-Alive\r\n", - t2, ntlm_type1); - g_free(ntlm_type1); - g_free(t2); - } - - g_string_append(request, "\r\n"); - - connect_data->write_buf_len = request->len; - connect_data->write_buffer = (guchar *)g_string_free(request, FALSE); - connect_data->written_len = 0; - connect_data->read_cb = http_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -http_canwrite(gpointer data, gint source, PurpleInputCondition cond) { - PurpleProxyConnectData *connect_data = data; - int ret, error = ETIMEDOUT; - - purple_debug_info("proxy", "Connected to %s:%d.\n", - connect_data->host, connect_data->port); - - if (connect_data->inpa > 0) { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - ret = purple_input_get_error(connect_data->fd, &error); - if (ret != 0 || error != 0) { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - if (connect_data->port == 80) { - /* - * If we're trying to connect to something running on - * port 80 then we assume the traffic using this - * connection is going to be HTTP traffic. If it's - * not then this will fail (uglily). But it's good - * to avoid using the CONNECT method because it's - * not always allowed. - */ - purple_debug_info("proxy", "HTTP proxy connection established\n"); - purple_proxy_connect_data_connected(connect_data); - } else { - http_start_connect_tunneling(connect_data); - } - -} - -static void -proxy_connect_http(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", - "Connecting to %s:%d via %s:%d using HTTP\n", - connect_data->host, connect_data->port, - (purple_proxy_info_get_host(connect_data->gpi) ? purple_proxy_info_get_host(connect_data->gpi) : "(null)"), - purple_proxy_info_get_port(connect_data->gpi)); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) { - if (errno == EINPROGRESS || errno == EINTR) { - purple_debug_info("proxy", "Connection in progress\n"); - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, http_canwrite, connect_data); - } else - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } else { - purple_debug_info("proxy", "Connected immediately.\n"); - - http_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } -} - -static void -s4_canread(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - guchar *buf; - int len, max_read; - - /* This is really not going to block under normal circumstances, but to - * be correct, we deal with the unlikely scenario */ - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 12; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - buf = connect_data->read_buffer + connect_data->read_len; - max_read = connect_data->read_buf_len - connect_data->read_len; - - len = read(connect_data->fd, buf, max_read); - - if ((len < 0 && errno == EAGAIN) || (len > 0 && len + connect_data->read_len < 4)) - return; - else if (len + connect_data->read_len >= 4) { - if (connect_data->read_buffer[1] == 90) { - purple_proxy_connect_data_connected(connect_data); - return; - } - } - - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); -} - -static void -s4_host_resolved(GSList *hosts, gpointer data, const char *error_message) -{ - PurpleProxyConnectData *connect_data = data; - unsigned char packet[9]; - struct sockaddr *addr; - - connect_data->query_data = NULL; - - if (error_message != NULL) { - purple_proxy_connect_data_disconnect(connect_data, error_message); - return; - } - - if (hosts == NULL) { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Error resolving %s"), connect_data->host); - return; - } - - /* Discard the length... */ - hosts = g_slist_delete_link(hosts, hosts); - addr = hosts->data; - hosts = g_slist_delete_link(hosts, hosts); - - packet[0] = 0x04; - packet[1] = 0x01; - packet[2] = connect_data->port >> 8; - packet[3] = connect_data->port & 0xff; - memcpy(packet + 4, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4); - packet[8] = 0x00; - - g_free(addr); - - /* We could try the other hosts, but hopefully that shouldn't be necessary */ - while (hosts != NULL) { - /* Discard the length... */ - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address... */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } - - connect_data->write_buffer = g_memdup(packet, sizeof(packet)); - connect_data->write_buf_len = sizeof(packet); - connect_data->written_len = 0; - connect_data->read_cb = s4_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -s4_canwrite(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int error = ETIMEDOUT; - int ret; - - purple_debug_info("socks4 proxy", "Connected.\n"); - - if (connect_data->inpa > 0) { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - /* - * The socks4 spec doesn't include support for doing host name lookups by - * the proxy. Many socks4 servers do this via the "socks4a" extension to - * the protocol. There doesn't appear to be a way to detect if a server - * supports this, so we require that the user set a global option. - */ - if (purple_prefs_get_bool("/purple/proxy/socks4_remotedns")) { - unsigned char packet[9]; - int len; - - purple_debug_info("socks4 proxy", "Attempting to use remote DNS.\n"); - - packet[0] = 0x04; - packet[1] = 0x01; - packet[2] = connect_data->port >> 8; - packet[3] = connect_data->port & 0xff; - packet[4] = 0x00; - packet[5] = 0x00; - packet[6] = 0x00; - packet[7] = 0x01; - packet[8] = 0x00; - - len = sizeof(packet) + strlen(connect_data->host) + 1; - - connect_data->write_buffer = g_malloc0(len); - memcpy(connect_data->write_buffer, packet, sizeof(packet)); - memcpy(connect_data->write_buffer + sizeof(packet), connect_data->host, strlen(connect_data->host)); - connect_data->write_buf_len = len; - connect_data->written_len = 0; - connect_data->read_cb = s4_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } else { - connect_data->query_data = purple_dnsquery_a(connect_data->host, - connect_data->port, s4_host_resolved, connect_data); - - if (connect_data->query_data == NULL) { - purple_debug_error("proxy", "dns query failed unexpectedly.\n"); - purple_proxy_connect_data_destroy(connect_data); - } - } -} - -static void -proxy_connect_socks4(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", - "Connecting to %s:%d via %s:%d using SOCKS4\n", - connect_data->host, connect_data->port, - purple_proxy_info_get_host(connect_data->gpi), - purple_proxy_info_get_port(connect_data->gpi)); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("proxy", "Connection in progress.\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, s4_canwrite, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - purple_debug_info("proxy", "Connected immediately.\n"); - - s4_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } -} - -static gboolean -s5_ensure_buffer_length(PurpleProxyConnectData *connect_data, int len) -{ - if(connect_data->read_len < len) { - if(connect_data->read_buf_len < len) { - /* it's not just that we haven't read enough, it's that we haven't tried to read enough yet */ - purple_debug_info("s5", "reallocing from %" G_GSIZE_FORMAT - " to %d\n", connect_data->read_buf_len, len); - connect_data->read_buf_len = len; - connect_data->read_buffer = g_realloc(connect_data->read_buffer, connect_data->read_buf_len); - } - return FALSE; - } - - return TRUE; -} - -static void -s5_canread_again(gpointer data, gint source, PurpleInputCondition cond) -{ - guchar *dest, *buf; - PurpleProxyConnectData *connect_data = data; - int len; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 5; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - dest = connect_data->read_buffer + connect_data->read_len; - buf = connect_data->read_buffer; - - len = read(connect_data->fd, dest, (connect_data->read_buf_len - connect_data->read_len)); - - if (len == 0) - { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - - if(connect_data->read_len < 4) - return; - - if ((buf[0] != 0x05) || (buf[1] != 0x00)) { - if ((buf[0] == 0x05) && (buf[1] < 0x09)) { - purple_debug_error("socks5 proxy", "%s", socks5errors[buf[1]]); - purple_proxy_connect_data_disconnect(connect_data, - socks5errors[buf[1]]); - } else { - purple_debug_error("socks5 proxy", "Bad data.\n"); - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - } - return; - } - - /* Skip past BND.ADDR */ - switch(buf[3]) { - case 0x01: /* the address is a version-4 IP address, with a length of 4 octets */ - if(!s5_ensure_buffer_length(connect_data, 4 + 4)) - return; - buf += 4 + 4; - break; - case 0x03: /* the address field contains a fully-qualified domain name. The first - octet of the address field contains the number of octets of name that - follow, there is no terminating NUL octet. */ - if(!s5_ensure_buffer_length(connect_data, 4 + 1)) - return; - buf += 4; - if(!s5_ensure_buffer_length(connect_data, 4 + 1 + buf[0])) - return; - buf += buf[0] + 1; - break; - case 0x04: /* the address is a version-6 IP address, with a length of 16 octets */ - if(!s5_ensure_buffer_length(connect_data, 4 + 16)) - return; - buf += 4 + 16; - break; - default: - purple_debug_error("socks5 proxy", "Invalid ATYP received (0x%X)\n", buf[3]); - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return; - } - - /* Skip past BND.PORT */ - if(!s5_ensure_buffer_length(connect_data, (buf - connect_data->read_buffer) + 2)) - return; - - purple_proxy_connect_data_connected(connect_data); -} - -static void -s5_sendconnect(gpointer data, int source) -{ - PurpleProxyConnectData *connect_data = data; - size_t hlen = strlen(connect_data->host); - connect_data->write_buf_len = 5 + hlen + 2; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - connect_data->write_buffer[0] = 0x05; - connect_data->write_buffer[1] = 0x01; /* CONNECT */ - connect_data->write_buffer[2] = 0x00; /* reserved */ - connect_data->write_buffer[3] = 0x03; /* address type -- host name */ - connect_data->write_buffer[4] = hlen; - memcpy(connect_data->write_buffer + 5, connect_data->host, hlen); - connect_data->write_buffer[5 + hlen] = connect_data->port >> 8; - connect_data->write_buffer[5 + hlen + 1] = connect_data->port & 0xff; - - connect_data->read_cb = s5_canread_again; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -s5_readauth(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int len; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 2; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - purple_debug_info("socks5 proxy", "Got auth response.\n"); - - len = read(connect_data->fd, connect_data->read_buffer + connect_data->read_len, - connect_data->read_buf_len - connect_data->read_len); - - if (len == 0) - { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - if (connect_data->read_len < 2) - return; - - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - - if ((connect_data->read_buffer[0] != 0x01) || (connect_data->read_buffer[1] != 0x00)) { - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return; - } - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - s5_sendconnect(connect_data, connect_data->fd); -} - -static void -hmacmd5_chap(const unsigned char * challenge, int challen, const char * passwd, unsigned char * response) -{ - PurpleCipher *cipher; - PurpleCipherContext *ctx; - int i; - unsigned char Kxoripad[65]; - unsigned char Kxoropad[65]; - size_t pwlen; - - cipher = purple_ciphers_find_cipher("md5"); - ctx = purple_cipher_context_new(cipher, NULL); - - memset(Kxoripad,0,sizeof(Kxoripad)); - memset(Kxoropad,0,sizeof(Kxoropad)); - - pwlen=strlen(passwd); - if (pwlen>64) { - purple_cipher_context_append(ctx, (const guchar *)passwd, strlen(passwd)); - purple_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); - pwlen=16; - } else { - memcpy(Kxoripad, passwd, pwlen); - } - memcpy(Kxoropad,Kxoripad,pwlen); - - for (i=0;i<64;i++) { - Kxoripad[i]^=0x36; - Kxoropad[i]^=0x5c; - } - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, Kxoripad, 64); - purple_cipher_context_append(ctx, challenge, challen); - purple_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, Kxoropad, 64); - purple_cipher_context_append(ctx, Kxoripad, 16); - purple_cipher_context_digest(ctx, 16, response, NULL); - - purple_cipher_context_destroy(ctx); -} - -static void -s5_readchap(gpointer data, gint source, PurpleInputCondition cond); - -/* - * Return how many bytes we processed - * -1 means we've shouldn't keep reading from the buffer - */ -static gssize -s5_parse_chap_msg(PurpleProxyConnectData *connect_data) -{ - guchar *buf, *cmdbuf = connect_data->read_buffer; - int len, navas, currentav; - - purple_debug_misc("socks5 proxy", "Reading CHAP message: %x\n", *cmdbuf); - - if (*cmdbuf != 0x01) { - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return -1; - } - cmdbuf++; - - navas = *cmdbuf; - - purple_debug_misc("socks5 proxy", "Expecting %d attribute(s).\n", navas); - - cmdbuf++; - - for (currentav = 0; currentav < navas; currentav++) { - - len = connect_data->read_len - (cmdbuf - connect_data->read_buffer); - /* We don't have enough data to even know how long the next attribute is, - * or we don't have the full length of the next attribute. */ - if (len < 2 || len < (cmdbuf[1] + 2)) { - /* Clear out the attributes that have been read - decrease the attribute count */ - connect_data->read_buffer[1] = navas - currentav; - /* Move the unprocessed data into the first attribute position */ - memmove((connect_data->read_buffer + 2), cmdbuf, len); - /* Decrease the read count accordingly */ - connect_data->read_len = len + 2; - - purple_debug_info("socks5 proxy", "Need more data to retrieve attribute %d.\n", currentav); - - return -1; - } - - buf = cmdbuf + 2; - - if (cmdbuf[1] == 0) { - purple_debug_error("socks5 proxy", "Attribute %x Value length of 0; ignoring.\n", cmdbuf[0]); - cmdbuf = buf; - continue; - } - - switch (cmdbuf[0]) { - case 0x00: - purple_debug_info("socks5 proxy", "Received STATUS of %x\n", buf[0]); - /* Did auth work? */ - if (buf[0] == 0x00) { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - /* Success */ - s5_sendconnect(connect_data, connect_data->fd); - } else { - /* Failure */ - purple_debug_warning("proxy", - "socks5 CHAP authentication " - "failed. Disconnecting..."); - purple_proxy_connect_data_disconnect(connect_data, - _("Authentication failed")); - } - return -1; - case 0x01: - /* We've already validated that cmdbuf[1] is sane. */ - purple_debug_info("socks5 proxy", "Received TEXT-MESSAGE of '%.*s'\n", (int) cmdbuf[1], buf); - break; - case 0x03: - purple_debug_info("socks5 proxy", "Received CHALLENGE\n"); - /* Server wants our credentials */ - - connect_data->write_buf_len = 16 + 4; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - hmacmd5_chap(buf, cmdbuf[1], - purple_proxy_info_get_password(connect_data->gpi), - connect_data->write_buffer + 4); - /* TODO: What about USER-IDENTITY? */ - connect_data->write_buffer[0] = 0x01; - connect_data->write_buffer[1] = 0x01; - connect_data->write_buffer[2] = 0x04; - connect_data->write_buffer[3] = 0x10; - - purple_input_remove(connect_data->inpa); - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->read_cb = s5_readchap; - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - return -1; - case 0x11: - purple_debug_info("socks5 proxy", "Received ALGORIGTHMS of %x\n", buf[0]); - /* Server wants to select an algorithm */ - if (buf[0] != 0x85) { - /* Only currently support HMAC-MD5 */ - purple_debug_warning("proxy", - "Server tried to select an " - "algorithm that we did not advertise " - "as supporting. This is a violation " - "of the socks5 CHAP specification. " - "Disconnecting..."); - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return -1; - } - break; - default: - purple_debug_info("socks5 proxy", "Received unused command %x, length=%d\n", cmdbuf[0], cmdbuf[1]); - } - cmdbuf = buf + cmdbuf[1]; - } - - return (cmdbuf - connect_data->read_buffer); -} - -static void -s5_readchap(gpointer data, gint source, PurpleInputCondition cond) -{ - gssize msg_ret; - PurpleProxyConnectData *connect_data = data; - int len; - - purple_debug(PURPLE_DEBUG_INFO, "socks5 proxy", "Got CHAP response.\n"); - - if (connect_data->read_buffer == NULL) { - /* A big enough butfer to read the message header (2 bytes) and at least one complete attribute and value (1 + 1 + 255). */ - connect_data->read_buf_len = 259; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - if (connect_data->read_buf_len - connect_data->read_len == 0) { - /*If the stuff below is right, this shouldn't be possible. */ - purple_debug_error("socks5 proxy", "This is about to suck because the read buffer is full (shouldn't happen).\n"); - } - - len = read(connect_data->fd, connect_data->read_buffer + connect_data->read_len, - connect_data->read_buf_len - connect_data->read_len); - - if (len == 0) { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - - /* We may have read more than one message into the buffer, we need to make sure to process them all */ - while (1) { - - /* We need more to be able to read this message */ - if (connect_data->read_len < 2) - return; - - msg_ret = s5_parse_chap_msg(connect_data); - - if (msg_ret < 0) - return; - - /* See if we have another message already in the buffer */ - if ((len = connect_data->read_len - msg_ret) > 0) { - - /* Move on to the next message */ - memmove(connect_data->read_buffer, connect_data->read_buffer + msg_ret, len); - /* Decrease the read count accordingly */ - connect_data->read_len = len; - - /* Try to read the message that connect_data->read_buffer now points to */ - continue; - } - - break; - } - - /* Fell through. We ran out of CHAP events to process, but haven't - * succeeded or failed authentication - there may be more to come. - * If this is the case, come straight back here. */ - - purple_debug_info("socks5 proxy", "Waiting for another message from which to read CHAP info.\n"); - - /* We've processed all the available attributes, so get ready for a whole new message */ - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; -} - -static void -s5_canread(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int len; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 2; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - purple_debug_info("socks5 proxy", "Able to read.\n"); - - len = read(connect_data->fd, connect_data->read_buffer + connect_data->read_len, - connect_data->read_buf_len - connect_data->read_len); - - if (len == 0) - { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - if (connect_data->read_len < 2) - return; - - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - - if ((connect_data->read_buffer[0] != 0x05) || (connect_data->read_buffer[1] == 0xff)) { - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return; - } - - if (connect_data->read_buffer[1] == 0x02) { - size_t i, j; - const char *u, *p; - - u = purple_proxy_info_get_username(connect_data->gpi); - p = purple_proxy_info_get_password(connect_data->gpi); - - i = (u == NULL) ? 0 : strlen(u); - j = (p == NULL) ? 0 : strlen(p); - - connect_data->write_buf_len = 1 + 1 + i + 1 + j; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - connect_data->write_buffer[0] = 0x01; /* version 1 */ - connect_data->write_buffer[1] = i; - if (u != NULL) - memcpy(connect_data->write_buffer + 2, u, i); - connect_data->write_buffer[2 + i] = j; - if (p != NULL) - memcpy(connect_data->write_buffer + 2 + i + 1, p, j); - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->read_cb = s5_readauth; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, - proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - - return; - } else if (connect_data->read_buffer[1] == 0x03) { - size_t userlen; - userlen = strlen(purple_proxy_info_get_username(connect_data->gpi)); - - connect_data->write_buf_len = 7 + userlen; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - connect_data->write_buffer[0] = 0x01; - connect_data->write_buffer[1] = 0x02; - connect_data->write_buffer[2] = 0x11; - connect_data->write_buffer[3] = 0x01; - connect_data->write_buffer[4] = 0x85; - connect_data->write_buffer[5] = 0x02; - connect_data->write_buffer[6] = userlen; - memcpy(connect_data->write_buffer + 7, - purple_proxy_info_get_username(connect_data->gpi), userlen); - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->read_cb = s5_readchap; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, - proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - - return; - } else { - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - s5_sendconnect(connect_data, connect_data->fd); - } -} - -static void -s5_canwrite(gpointer data, gint source, PurpleInputCondition cond) -{ - unsigned char buf[5]; - int i; - PurpleProxyConnectData *connect_data = data; - int error = ETIMEDOUT; - int ret; - - purple_debug_info("socks5 proxy", "Connected.\n"); - - if (connect_data->inpa > 0) - { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) - { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - i = 0; - buf[0] = 0x05; /* SOCKS version 5 */ - - if (purple_proxy_info_get_username(connect_data->gpi) != NULL) { - buf[1] = 0x03; /* three methods */ - buf[2] = 0x00; /* no authentication */ - buf[3] = 0x03; /* CHAP authentication */ - buf[4] = 0x02; /* username/password authentication */ - i = 5; - } - else { - buf[1] = 0x01; - buf[2] = 0x00; - i = 3; - } - - connect_data->write_buf_len = i; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - memcpy(connect_data->write_buffer, buf, i); - - connect_data->read_cb = s5_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -proxy_connect_socks5(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", - "Connecting to %s:%d via %s:%d using SOCKS5\n", - connect_data->host, connect_data->port, - purple_proxy_info_get_host(connect_data->gpi), - purple_proxy_info_get_port(connect_data->gpi)); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("socks5 proxy", "Connection in progress\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, s5_canwrite, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - purple_debug_info("proxy", "Connected immediately.\n"); - - s5_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } -} - -/** - * This function attempts to connect to the next IP address in the list - * of IP addresses returned to us by purple_dnsquery_a() and attemps - * to connect to each one. This is called after the hostname is - * resolved, and each time a connection attempt fails (assuming there - * is another IP address to try). - */ -#ifndef INET6_ADDRSTRLEN -#define INET6_ADDRSTRLEN 46 -#endif - -static void try_connect(PurpleProxyConnectData *connect_data) -{ - socklen_t addrlen; - struct sockaddr *addr; - char ipaddr[INET6_ADDRSTRLEN]; - - addrlen = GPOINTER_TO_INT(connect_data->hosts->data); - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); - addr = connect_data->hosts->data; - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); -#ifdef HAVE_INET_NTOP - inet_ntop(addr->sa_family, &((struct sockaddr_in *)addr)->sin_addr, - ipaddr, sizeof(ipaddr)); -#else - memcpy(ipaddr, inet_ntoa(((struct sockaddr_in *)addr)->sin_addr), - sizeof(ipaddr)); -#endif - purple_debug_info("proxy", "Attempting connection to %s\n", ipaddr); - - if (connect_data->socket_type == SOCK_DGRAM) { - proxy_connect_udp_none(connect_data, addr, addrlen); - g_free(addr); - return; - } - - switch (purple_proxy_info_get_type(connect_data->gpi)) { - case PURPLE_PROXY_NONE: - proxy_connect_none(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_HTTP: - proxy_connect_http(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_SOCKS4: - proxy_connect_socks4(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_SOCKS5: - proxy_connect_socks5(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_USE_ENVVAR: - proxy_connect_http(connect_data, addr, addrlen); - break; - - default: - break; - } - - g_free(addr); -} - -static void -connection_host_resolved(GSList *hosts, gpointer data, - const char *error_message) -{ - PurpleProxyConnectData *connect_data; - - connect_data = data; - connect_data->query_data = NULL; - - if (error_message != NULL) - { - purple_proxy_connect_data_disconnect(connect_data, error_message); - return; - } - - if (hosts == NULL) - { - purple_proxy_connect_data_disconnect(connect_data, _("Unable to resolve hostname")); - return; - } - - connect_data->hosts = hosts; - - try_connect(connect_data); -} - -PurpleProxyInfo * -purple_proxy_get_setup(PurpleAccount *account) -{ - PurpleProxyInfo *gpi = NULL; - const gchar *tmp; - - /* This is used as a fallback so we don't overwrite the selected proxy type */ - static PurpleProxyInfo *tmp_none_proxy_info = NULL; - if (!tmp_none_proxy_info) { - tmp_none_proxy_info = purple_proxy_info_new(); - purple_proxy_info_set_type(tmp_none_proxy_info, PURPLE_PROXY_NONE); - } - - if (account && purple_account_get_proxy_info(account) != NULL) { - gpi = purple_account_get_proxy_info(account); - if (purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_GLOBAL) - gpi = NULL; - } - if (gpi == NULL) { - if (purple_running_gnome()) - gpi = purple_gnome_proxy_get_info(); - else - gpi = purple_global_proxy_get_info(); - } - - if (purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_ENVVAR) { - if ((tmp = g_getenv("HTTP_PROXY")) != NULL || - (tmp = g_getenv("http_proxy")) != NULL || - (tmp = g_getenv("HTTPPROXY")) != NULL) { - char *proxyhost, *proxyuser, *proxypasswd; - int proxyport; - - /* http_proxy-format: - * export http_proxy="http://user:passwd@your.proxy.server:port/" - */ - if(purple_url_parse(tmp, &proxyhost, &proxyport, NULL, &proxyuser, &proxypasswd)) { - purple_proxy_info_set_host(gpi, proxyhost); - g_free(proxyhost); - - purple_proxy_info_set_username(gpi, proxyuser); - g_free(proxyuser); - - purple_proxy_info_set_password(gpi, proxypasswd); - g_free(proxypasswd); - - /* only for backward compatibility */ - if (proxyport == 80 && - ((tmp = g_getenv("HTTP_PROXY_PORT")) != NULL || - (tmp = g_getenv("http_proxy_port")) != NULL || - (tmp = g_getenv("HTTPPROXYPORT")) != NULL)) - proxyport = atoi(tmp); - - purple_proxy_info_set_port(gpi, proxyport); - - /* XXX: Do we want to skip this step if user/password were part of url? */ - if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL || - (tmp = g_getenv("http_proxy_user")) != NULL || - (tmp = g_getenv("HTTPPROXYUSER")) != NULL) - purple_proxy_info_set_username(gpi, tmp); - - if ((tmp = g_getenv("HTTP_PROXY_PASS")) != NULL || - (tmp = g_getenv("http_proxy_pass")) != NULL || - (tmp = g_getenv("HTTPPROXYPASS")) != NULL) - purple_proxy_info_set_password(gpi, tmp); - - } - } else { -#ifdef _WIN32 - PurpleProxyInfo *wgpi; - if ((wgpi = purple_win32_proxy_get_info()) != NULL) - return wgpi; -#endif - /* no proxy environment variable found, don't use a proxy */ - purple_debug_info("proxy", "No environment settings found, not using a proxy\n"); - gpi = tmp_none_proxy_info; - } - - } - - return gpi; -} - -PurpleProxyConnectData * -purple_proxy_connect(void *handle, PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data) -{ - const char *connecthost = host; - int connectport = port; - PurpleProxyConnectData *connect_data; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port > 0, NULL); - g_return_val_if_fail(connect_cb != NULL, NULL); - - connect_data = g_new0(PurpleProxyConnectData, 1); - connect_data->fd = -1; - connect_data->socket_type = SOCK_STREAM; - connect_data->handle = handle; - connect_data->connect_cb = connect_cb; - connect_data->data = data; - connect_data->host = g_strdup(host); - connect_data->port = port; - connect_data->gpi = purple_proxy_get_setup(account); - - if ((purple_proxy_info_get_type(connect_data->gpi) != PURPLE_PROXY_NONE) && - (purple_proxy_info_get_host(connect_data->gpi) == NULL || - purple_proxy_info_get_port(connect_data->gpi) <= 0)) { - - purple_notify_error(NULL, NULL, _("Invalid proxy settings"), _("Either the host name or port number specified for your given proxy type is invalid.")); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - switch (purple_proxy_info_get_type(connect_data->gpi)) - { - case PURPLE_PROXY_NONE: - break; - - case PURPLE_PROXY_HTTP: - case PURPLE_PROXY_SOCKS4: - case PURPLE_PROXY_SOCKS5: - case PURPLE_PROXY_USE_ENVVAR: - connecthost = purple_proxy_info_get_host(connect_data->gpi); - connectport = purple_proxy_info_get_port(connect_data->gpi); - break; - - default: - purple_debug_error("proxy", "Invalid Proxy type (%d) specified.\n", - purple_proxy_info_get_type(connect_data->gpi)); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - connect_data->query_data = purple_dnsquery_a(connecthost, - connectport, connection_host_resolved, connect_data); - if (connect_data->query_data == NULL) - { - purple_debug_error("proxy", "dns query failed unexpectedly.\n"); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - handles = g_slist_prepend(handles, connect_data); - - return connect_data; -} - -PurpleProxyConnectData * -purple_proxy_connect_udp(void *handle, PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data) -{ - const char *connecthost = host; - int connectport = port; - PurpleProxyConnectData *connect_data; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port > 0, NULL); - g_return_val_if_fail(connect_cb != NULL, NULL); - - connect_data = g_new0(PurpleProxyConnectData, 1); - connect_data->fd = -1; - connect_data->socket_type = SOCK_DGRAM; - connect_data->handle = handle; - connect_data->connect_cb = connect_cb; - connect_data->data = data; - connect_data->host = g_strdup(host); - connect_data->port = port; - connect_data->gpi = purple_proxy_get_setup(account); - - if ((purple_proxy_info_get_type(connect_data->gpi) != PURPLE_PROXY_NONE) && - (purple_proxy_info_get_host(connect_data->gpi) == NULL || - purple_proxy_info_get_port(connect_data->gpi) <= 0)) { - - purple_notify_error(NULL, NULL, _("Invalid proxy settings"), _("Either the host name or port number specified for your given proxy type is invalid.")); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - switch (purple_proxy_info_get_type(connect_data->gpi)) - { - case PURPLE_PROXY_NONE: - break; - - case PURPLE_PROXY_HTTP: - case PURPLE_PROXY_SOCKS4: - case PURPLE_PROXY_SOCKS5: - case PURPLE_PROXY_USE_ENVVAR: - purple_debug_info("proxy", "Ignoring Proxy type (%d) for UDP.\n", - purple_proxy_info_get_type(connect_data->gpi)); - break; - - default: - purple_debug_error("proxy", "Invalid Proxy type (%d) specified.\n", - purple_proxy_info_get_type(connect_data->gpi)); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - connect_data->query_data = purple_dnsquery_a(connecthost, - connectport, connection_host_resolved, connect_data); - if (connect_data->query_data == NULL) - { - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - handles = g_slist_prepend(handles, connect_data); - - return connect_data; -} - -/* - * Combine some of this code with purple_proxy_connect() - */ -PurpleProxyConnectData * -purple_proxy_connect_socks5(void *handle, PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, - gpointer data) -{ - PurpleProxyConnectData *connect_data; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port >= 0, NULL); - g_return_val_if_fail(connect_cb != NULL, NULL); - - connect_data = g_new0(PurpleProxyConnectData, 1); - connect_data->fd = -1; - connect_data->socket_type = SOCK_STREAM; - connect_data->handle = handle; - connect_data->connect_cb = connect_cb; - connect_data->data = data; - connect_data->host = g_strdup(host); - connect_data->port = port; - connect_data->gpi = gpi; - - connect_data->query_data = - purple_dnsquery_a(purple_proxy_info_get_host(gpi), - purple_proxy_info_get_port(gpi), - connection_host_resolved, connect_data); - if (connect_data->query_data == NULL) - { - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - handles = g_slist_prepend(handles, connect_data); - - return connect_data; -} - -void -purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data) -{ - purple_proxy_connect_data_disconnect(connect_data, NULL); - purple_proxy_connect_data_destroy(connect_data); -} - -void -purple_proxy_connect_cancel_with_handle(void *handle) -{ - GSList *l, *l_next; - - for (l = handles; l != NULL; l = l_next) { - PurpleProxyConnectData *connect_data = l->data; - - l_next = l->next; - - if (connect_data->handle == handle) - purple_proxy_connect_cancel(connect_data); - } -} - -static void -proxy_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleProxyInfo *info = purple_global_proxy_get_info(); - - if (purple_strequal(name, "/purple/proxy/type")) { - int proxytype; - const char *type = value; - - if (purple_strequal(type, "none")) - proxytype = PURPLE_PROXY_NONE; - else if (purple_strequal(type, "http")) - proxytype = PURPLE_PROXY_HTTP; - else if (purple_strequal(type, "socks4")) - proxytype = PURPLE_PROXY_SOCKS4; - else if (purple_strequal(type, "socks5")) - proxytype = PURPLE_PROXY_SOCKS5; - else if (purple_strequal(type, "envvar")) - proxytype = PURPLE_PROXY_USE_ENVVAR; - else - proxytype = -1; - - purple_proxy_info_set_type(info, proxytype); - } else if (purple_strequal(name, "/purple/proxy/host")) - purple_proxy_info_set_host(info, value); - else if (purple_strequal(name, "/purple/proxy/port")) - purple_proxy_info_set_port(info, GPOINTER_TO_INT(value)); - else if (purple_strequal(name, "/purple/proxy/username")) - purple_proxy_info_set_username(info, value); - else if (purple_strequal(name, "/purple/proxy/password")) - purple_proxy_info_set_password(info, value); -} - -void * -purple_proxy_get_handle() -{ - static int handle; - - return &handle; -} - -void -purple_proxy_init(void) -{ - void *handle; - - /* Initialize a default proxy info struct. */ - global_proxy_info = purple_proxy_info_new(); - - /* Proxy */ - purple_prefs_add_none("/purple/proxy"); - purple_prefs_add_string("/purple/proxy/type", "none"); - purple_prefs_add_string("/purple/proxy/host", ""); - purple_prefs_add_int("/purple/proxy/port", 0); - purple_prefs_add_string("/purple/proxy/username", ""); - purple_prefs_add_string("/purple/proxy/password", ""); - purple_prefs_add_bool("/purple/proxy/socks4_remotedns", FALSE); - - /* Setup callbacks for the preferences. */ - handle = purple_proxy_get_handle(); - purple_prefs_connect_callback(handle, "/purple/proxy/type", proxy_pref_cb, - NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/host", proxy_pref_cb, - NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/port", proxy_pref_cb, - NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/username", - proxy_pref_cb, NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/password", - proxy_pref_cb, NULL); - - /* Load the initial proxy settings */ - purple_prefs_trigger_callback("/purple/proxy/type"); - purple_prefs_trigger_callback("/purple/proxy/host"); - purple_prefs_trigger_callback("/purple/proxy/port"); - purple_prefs_trigger_callback("/purple/proxy/username"); - purple_prefs_trigger_callback("/purple/proxy/password"); -} - -void -purple_proxy_uninit(void) -{ - while (handles != NULL) - { - purple_proxy_connect_data_disconnect(handles->data, NULL); - purple_proxy_connect_data_destroy(handles->data); - } - - purple_prefs_disconnect_by_handle(purple_proxy_get_handle()); - - purple_proxy_info_destroy(global_proxy_info); - global_proxy_info = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/proxy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,338 +0,0 @@ -/** - * @file proxy.h Proxy API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_PROXY_H_ -#define _PURPLE_PROXY_H_ - -#include -#include "eventloop.h" - -/** - * A type of proxy connection. - */ -typedef enum -{ - PURPLE_PROXY_USE_GLOBAL = -1, /**< Use the global proxy information. */ - PURPLE_PROXY_NONE = 0, /**< No proxy. */ - PURPLE_PROXY_HTTP, /**< HTTP proxy. */ - PURPLE_PROXY_SOCKS4, /**< SOCKS 4 proxy. */ - PURPLE_PROXY_SOCKS5, /**< SOCKS 5 proxy. */ - PURPLE_PROXY_USE_ENVVAR /**< Use environmental settings. */ - -} PurpleProxyType; - -/** - * Information on proxy settings. - */ -typedef struct -{ - PurpleProxyType type; /**< The proxy type. */ - - char *host; /**< The host. */ - int port; /**< The port number. */ - char *username; /**< The username. */ - char *password; /**< The password. */ - -} PurpleProxyInfo; - -typedef struct _PurpleProxyConnectData PurpleProxyConnectData; - -typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message); - - -#include "account.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Proxy structure API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a proxy information structure. - * - * @return The proxy information structure. - */ -PurpleProxyInfo *purple_proxy_info_new(void); - -/** - * Destroys a proxy information structure. - * - * @param info The proxy information structure to destroy. - */ -void purple_proxy_info_destroy(PurpleProxyInfo *info); - -/** - * Sets the type of proxy. - * - * @param info The proxy information. - * @param type The proxy type. - */ -void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type); - -/** - * Sets the proxy host. - * - * @param info The proxy information. - * @param host The host. - */ -void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host); - -/** - * Sets the proxy port. - * - * @param info The proxy information. - * @param port The port. - */ -void purple_proxy_info_set_port(PurpleProxyInfo *info, int port); - -/** - * Sets the proxy username. - * - * @param info The proxy information. - * @param username The username. - */ -void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username); - -/** - * Sets the proxy password. - * - * @param info The proxy information. - * @param password The password. - */ -void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password); - -/** - * Returns the proxy's type. - * - * @param info The proxy information. - * - * @return The type. - */ -PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info); - -/** - * Returns the proxy's host. - * - * @param info The proxy information. - * - * @return The host. - */ -const char *purple_proxy_info_get_host(const PurpleProxyInfo *info); - -/** - * Returns the proxy's port. - * - * @param info The proxy information. - * - * @return The port. - */ -int purple_proxy_info_get_port(const PurpleProxyInfo *info); - -/** - * Returns the proxy's username. - * - * @param info The proxy information. - * - * @return The username. - */ -const char *purple_proxy_info_get_username(const PurpleProxyInfo *info); - -/** - * Returns the proxy's password. - * - * @param info The proxy information. - * - * @return The password. - */ -const char *purple_proxy_info_get_password(const PurpleProxyInfo *info); - -/*@}*/ - -/**************************************************************************/ -/** @name Global Proxy API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns purple's global proxy information. - * - * @return The global proxy information. - */ -PurpleProxyInfo *purple_global_proxy_get_info(void); - -/** - * Set purple's global proxy information. - * - * @param info The proxy information. - * @since 2.6.0 - */ -void purple_global_proxy_set_info(PurpleProxyInfo *info); - -/*@}*/ - -/**************************************************************************/ -/** @name Proxy API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the proxy subsystem handle. - * - * @return The proxy subsystem handle. - */ -void *purple_proxy_get_handle(void); - -/** - * Initializes the proxy subsystem. - */ -void purple_proxy_init(void); - -/** - * Uninitializes the proxy subsystem. - */ -void purple_proxy_uninit(void); - -/** - * Returns configuration of a proxy. - * - * @param account The account for which the configuration is needed. - * - * @return The configuration of a proxy. - */ -PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account); - -/** - * Makes a connection to the specified host and port. Note that this - * function name can be misleading--although it is called "proxy - * connect," it is used for establishing any outgoing TCP connection, - * whether through a proxy or not. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - */ -PurpleProxyConnectData *purple_proxy_connect(void *handle, - PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); - -/** - * Makes a connection to the specified host and port. Note that this - * function name can be misleading--although it is called "proxy - * connect," it is used for establishing any outgoing UDP connection, - * whether through a proxy or not. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - */ -PurpleProxyConnectData *purple_proxy_connect_udp(void *handle, - PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); - -/** - * Makes a connection through a SOCKS5 proxy. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param gpi The PurpleProxyInfo specifying the proxy settings - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - */ -PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle, - PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); - -/** - * Cancel an in-progress connection attempt. This should be called - * by the PRPL if the user disables an account while it is still - * performing the initial sign on. Or when establishing a file - * transfer, if we attempt to connect to a remote user but they - * are behind a firewall then the PRPL can cancel the connection - * attempt early rather than just letting the OS's TCP/IP stack - * time-out the connection. - */ -void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data); - -/* - * Closes all proxy connections registered with the specified handle. - * - * @param handle The handle. - */ -void purple_proxy_connect_cancel_with_handle(void *handle); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PROXY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,583 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "conversation.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "util.h" - -/**************************************************************************/ -/** @name Attention Type API */ -/**************************************************************************/ -PurpleAttentionType * -purple_attention_type_new(const char *ulname, const char *name, - const char *inc_desc, const char *out_desc) -{ - PurpleAttentionType *attn = g_new0(PurpleAttentionType, 1); - - purple_attention_type_set_name(attn, name); - purple_attention_type_set_incoming_desc(attn, inc_desc); - purple_attention_type_set_outgoing_desc(attn, out_desc); - purple_attention_type_set_unlocalized_name(attn, ulname); - - return attn; -} - - -void -purple_attention_type_set_name(PurpleAttentionType *type, const char *name) -{ - g_return_if_fail(type != NULL); - - type->name = name; -} - -void -purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc) -{ - g_return_if_fail(type != NULL); - - type->incoming_description = desc; -} - -void -purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc) -{ - g_return_if_fail(type != NULL); - - type->outgoing_description = desc; -} - -void -purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name) -{ - g_return_if_fail(type != NULL); - - type->icon_name = name; -} - -void -purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname) -{ - g_return_if_fail(type != NULL); - - type->unlocalized_name = ulname; -} - -const char * -purple_attention_type_get_name(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->name; -} - -const char * -purple_attention_type_get_incoming_desc(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->incoming_description; -} - -const char * -purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->outgoing_description; -} - -const char * -purple_attention_type_get_icon_name(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - if(type->icon_name == NULL || *(type->icon_name) == '\0') - return NULL; - - return type->icon_name; -} - -const char * -purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->unlocalized_name; -} - -/**************************************************************************/ -/** @name Protocol Plugin API */ -/**************************************************************************/ -void -purple_prpl_got_account_idle(PurpleAccount *account, gboolean idle, - time_t idle_time) -{ - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - purple_presence_set_idle(purple_account_get_presence(account), - idle, idle_time); -} - -void -purple_prpl_got_account_login_time(PurpleAccount *account, time_t login_time) -{ - PurplePresence *presence; - - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - if (login_time == 0) - login_time = time(NULL); - - presence = purple_account_get_presence(account); - - purple_presence_set_login_time(presence, login_time); -} - -void -purple_prpl_got_account_status(PurpleAccount *account, const char *status_id, ...) -{ - PurplePresence *presence; - PurpleStatus *status; - va_list args; - - g_return_if_fail(account != NULL); - g_return_if_fail(status_id != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - presence = purple_account_get_presence(account); - status = purple_presence_get_status(presence, status_id); - - g_return_if_fail(status != NULL); - - va_start(args, status_id); - purple_status_set_active_with_attrs(status, TRUE, args); - va_end(args); -} - -void -purple_prpl_got_account_actions(PurpleAccount *account) -{ - - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - purple_signal_emit(purple_accounts_get_handle(), "account-actions-changed", - account); -} - -void -purple_prpl_got_user_idle(PurpleAccount *account, const char *name, - gboolean idle, time_t idle_time) -{ - PurplePresence *presence; - GSList *list; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); - - if ((list = purple_find_buddies(account, name)) == NULL) - return; - - while (list) { - presence = purple_buddy_get_presence(list->data); - list = g_slist_delete_link(list, list); - purple_presence_set_idle(presence, idle, idle_time); - } -} - -void -purple_prpl_got_user_login_time(PurpleAccount *account, const char *name, - time_t login_time) -{ - GSList *list; - PurplePresence *presence; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - - if ((list = purple_find_buddies(account, name)) == NULL) - return; - - if (login_time == 0) - login_time = time(NULL); - - while (list) { - PurpleBuddy *buddy = list->data; - presence = purple_buddy_get_presence(buddy); - list = g_slist_delete_link(list, list); - - if (purple_presence_get_login_time(presence) != login_time) - { - purple_presence_set_login_time(presence, login_time); - - purple_signal_emit(purple_blist_get_handle(), "buddy-got-login-time", buddy); - } - } -} - -void -purple_prpl_got_user_status(PurpleAccount *account, const char *name, - const char *status_id, ...) -{ - GSList *list, *l; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - PurpleStatus *old_status; - va_list args; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(status_id != NULL); - g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); - - if((list = purple_find_buddies(account, name)) == NULL) - return; - - for(l = list; l != NULL; l = l->next) { - buddy = l->data; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_status(presence, status_id); - - if(NULL == status) - /* - * TODO: This should never happen, right? We should call - * g_warning() or something. - */ - continue; - - old_status = purple_presence_get_active_status(presence); - - va_start(args, status_id); - purple_status_set_active_with_attrs(status, TRUE, args); - va_end(args); - - purple_blist_update_buddy_status(buddy, old_status); - } - - g_slist_free(list); - - /* The buddy is no longer online, they are therefore by definition not - * still typing to us. */ - if (!purple_status_is_online(status)) - serv_got_typing_stopped(purple_account_get_connection(account), name); -} - -void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name, - const char *status_id) -{ - GSList *list, *l; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(status_id != NULL); - g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); - - if((list = purple_find_buddies(account, name)) == NULL) - return; - - for(l = list; l != NULL; l = l->next) { - buddy = l->data; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_status(presence, status_id); - - if(NULL == status) - continue; - - if (purple_status_is_active(status)) { - purple_status_set_active(status, FALSE); - purple_blist_update_buddy_status(buddy, status); - } - } - - g_slist_free(list); -} - -static void -do_prpl_change_account_status(PurpleAccount *account, - PurpleStatus *old_status, PurpleStatus *new_status) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (purple_status_is_online(new_status) && - purple_account_is_disconnected(account) && - purple_network_is_available()) - { - purple_account_connect(account); - return; - } - - if (!purple_status_is_online(new_status)) - { - if (!purple_account_is_disconnected(account)) - purple_account_disconnect(account); - /* Clear out the unsaved password if we're already disconnected and we switch to offline status */ - else if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - return; - } - - if (purple_account_is_connecting(account)) - /* - * We don't need to call the set_status PRPL function because - * the PRPL will take care of setting its status during the - * connection process. - */ - return; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - - if (prpl == NULL) - return; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (!purple_account_is_disconnected(account) && prpl_info->set_status != NULL) - { - prpl_info->set_status(account, new_status); - } -} - -void -purple_prpl_change_account_status(PurpleAccount *account, - PurpleStatus *old_status, PurpleStatus *new_status) -{ - g_return_if_fail(account != NULL); - g_return_if_fail(new_status != NULL); - g_return_if_fail(!purple_status_is_exclusive(new_status) || old_status != NULL); - - do_prpl_change_account_status(account, old_status, new_status); - - purple_signal_emit(purple_accounts_get_handle(), "account-status-changed", - account, old_status, new_status); -} - -GList * -purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence) -{ - GList *statuses = NULL; - GList *l; - PurpleStatus *status; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(presence != NULL, NULL); - - for (l = purple_account_get_status_types(account); l != NULL; l = l->next) - { - status = purple_status_new((PurpleStatusType *)l->data, presence); - statuses = g_list_prepend(statuses, status); - } - - statuses = g_list_reverse(statuses); - - return statuses; -} - -void -purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - PurpleAttentionType *attn; - PurpleMessageFlags flags; - PurplePlugin *prpl; - PurpleConversation *conv; - gboolean (*send_attention)(PurpleConnection *, const char *, guint); - PurpleBuddy *buddy; - const char *alias; - gchar *description; - time_t mtime; - - g_return_if_fail(gc != NULL); - g_return_if_fail(who != NULL); - - prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); - send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; - g_return_if_fail(send_attention != NULL); - - mtime = time(NULL); - - attn = purple_get_attention_type_from_code(gc->account, type_code); - - if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) - alias = purple_buddy_get_contact_alias(buddy); - else - alias = who; - - if (attn && purple_attention_type_get_outgoing_desc(attn)) { - description = g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias); - } else { - description = g_strdup_printf(_("Requesting %s's attention..."), alias); - } - - flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; - - purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", - description, who); - - if (!send_attention(gc, who, type_code)) - return; - - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who); - purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); - - g_free(description); -} - -static void -got_attention(PurpleConnection *gc, int id, const char *who, guint type_code) -{ - PurpleMessageFlags flags; - PurpleAttentionType *attn; - PurpleBuddy *buddy; - const char *alias; - gchar *description; - time_t mtime; - - mtime = time(NULL); - - attn = purple_get_attention_type_from_code(gc->account, type_code); - - /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ - flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; - - /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display - * it next to the attention command. And if it is null, display a generic icon. */ - - if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) - alias = purple_buddy_get_contact_alias(buddy); - else - alias = who; - - if (attn && purple_attention_type_get_incoming_desc(attn)) { - description = g_strdup_printf(purple_attention_type_get_incoming_desc(attn), alias); - } else { - description = g_strdup_printf(_("%s has requested your attention!"), alias); - } - - purple_debug_info("server", "got_attention: got '%s' from %s\n", - description, who); - - if (id == -1) - serv_got_im(gc, who, description, flags, mtime); - else - serv_got_chat_in(gc, id, who, flags, description, mtime); - - /* TODO: sounds (depending on PurpleAttentionType), shaking, etc. */ - - g_free(description); -} - -void -purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - got_attention(gc, -1, who, type_code); -} - -void -purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code) -{ - got_attention(gc, id, who, type_code); -} - -gboolean -purple_prpl_initiate_media(PurpleAccount *account, - const char *who, - PurpleMediaSessionType type) -{ -#ifdef USE_VV - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - if (account) - gc = purple_account_get_connection(account); - if (gc) - prpl = purple_connection_get_prpl(gc); - if (prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, initiate_media)) { - /* should check that the protocol supports this media type here? */ - return prpl_info->initiate_media(account, who, type); - } else -#endif - return FALSE; -} - -PurpleMediaCaps -purple_prpl_get_media_caps(PurpleAccount *account, const char *who) -{ -#ifdef USE_VV - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - if (account) - gc = purple_account_get_connection(account); - if (gc) - prpl = purple_connection_get_prpl(gc); - if (prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, - get_media_caps)) { - return prpl_info->get_media_caps(account, who); - } -#endif - return PURPLE_MEDIA_CAPS_NONE; -} - -/************************************************************************** - * Protocol Plugin Subsystem API - **************************************************************************/ - -PurplePlugin * -purple_find_prpl(const char *id) -{ - GList *l; - PurplePlugin *plugin; - - g_return_val_if_fail(id != NULL, NULL); - - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - plugin = (PurplePlugin *)l->data; - - if (purple_strequal(plugin->info->id, id)) - return plugin; - } - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/prpl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,926 +0,0 @@ -/** - * @file prpl.h Protocol Plugin functions - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -/* this file should be all that prpls need to include. therefore, by including - * this file, they should get glib, proxy, purple_connection, prpl, etc. */ - -#ifndef _PURPLE_PRPL_H_ -#define _PURPLE_PRPL_H_ - -typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo; -/** @copydoc _PurpleAttentionType */ -typedef struct _PurpleAttentionType PurpleAttentionType; - -/**************************************************************************/ -/** @name Basic Protocol Information */ -/**************************************************************************/ - -typedef enum { - PURPLE_ICON_SCALE_DISPLAY = 0x01, /**< We scale the icon when we display it */ - PURPLE_ICON_SCALE_SEND = 0x02 /**< We scale the icon before we send it to the server */ -} PurpleIconScaleRules; - - -/** - * A description of a Buddy Icon specification. This tells Purple what kind of image file - * it should give this prpl, and what kind of image file it should expect back. - * Dimensions less than 1 should be ignored and the image not scaled. - */ -typedef struct _PurpleBuddyIconSpec PurpleBuddyIconSpec; - -/** - * This \#define exists just to make it easier to fill out the buddy icon - * field in the prpl info struct for protocols that couldn't care less. - */ -#define NO_BUDDY_ICONS {NULL, 0, 0, 0, 0, 0, 0} - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "blist.h" -#include "conversation.h" -#include "ft.h" -#include "imgstore.h" -#include "media.h" -#include "notify.h" -#include "proxy.h" -#include "plugin.h" -#include "roomlist.h" -#include "status.h" -#include "whiteboard.h" - - -/** @copydoc PurpleBuddyIconSpec */ -struct _PurpleBuddyIconSpec { - /** This is a comma-delimited list of image formats or @c NULL if icons - * are not supported. Neither the core nor the prpl will actually - * check to see if the data it's given matches this; it's entirely up - * to the UI to do what it wants - */ - char *format; - - int min_width; /**< Minimum width of this icon */ - int min_height; /**< Minimum height of this icon */ - int max_width; /**< Maximum width of this icon */ - int max_height; /**< Maximum height of this icon */ - size_t max_filesize; /**< Maximum size in bytes */ - PurpleIconScaleRules scale_rules; /**< How to stretch this icon */ -}; - -/** Represents an entry containing information that must be supplied by the - * user when joining a chat. - */ -struct proto_chat_entry { - const char *label; /**< User-friendly name of the entry */ - const char *identifier; /**< Used by the PRPL to identify the option */ - gboolean required; /**< True if it's required */ - gboolean is_int; /**< True if the entry expects an integer */ - int min; /**< Minimum value in case of integer */ - int max; /**< Maximum value in case of integer */ - gboolean secret; /**< True if the entry is secret (password) */ -}; - -/** Represents "nudges" and "buzzes" that you may send to a buddy to attract - * their attention (or vice-versa). - */ -struct _PurpleAttentionType -{ - const char *name; /**< Shown in GUI elements */ - const char *incoming_description; /**< Shown when sent */ - const char *outgoing_description; /**< Shown when receied */ - const char *icon_name; /**< Icon to display (optional) */ - const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ - - /* Reserved fields for future purposes */ - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - -/** - * Protocol options - * - * These should all be stuff that some plugins can do and others can't. - */ -typedef enum -{ - /** - * User names are unique to a chat and are not shared between rooms. - * - * XMPP lets you choose what name you want in chats, so it shouldn't - * be pulling the aliases from the buddy list for the chat list; - * it gets annoying. - */ - OPT_PROTO_UNIQUE_CHATNAME = 0x00000004, - - /** - * Chat rooms have topics. - * - * IRC and XMPP support this. - */ - OPT_PROTO_CHAT_TOPIC = 0x00000008, - - /** - * Don't require passwords for sign-in. - * - * Zephyr doesn't require passwords, so there's no - * need for a password prompt. - */ - OPT_PROTO_NO_PASSWORD = 0x00000010, - - /** - * Notify on new mail. - * - * MSN and Yahoo notify you when you have new mail. - */ - OPT_PROTO_MAIL_CHECK = 0x00000020, - - /** - * Images in IMs. - * - * Oscar lets you send images in direct IMs. - */ - OPT_PROTO_IM_IMAGE = 0x00000040, - - /** - * Allow passwords to be optional. - * - * Passwords in IRC are optional, and are needed for certain - * functionality. - */ - OPT_PROTO_PASSWORD_OPTIONAL = 0x00000080, - - /** - * Allows font size to be specified in sane point size - * - * Probably just XMPP and Y!M - */ - OPT_PROTO_USE_POINTSIZE = 0x00000100, - - /** - * Set the Register button active even when the username has not - * been specified. - * - * Gadu-Gadu doesn't need a username to register new account (because - * usernames are assigned by the server). - */ - OPT_PROTO_REGISTER_NOSCREENNAME = 0x00000200, - - /** - * Indicates that slash commands are native to this protocol. - * Used as a hint that unknown commands should not be sent as messages. - * @since 2.1.0 - */ - OPT_PROTO_SLASH_COMMANDS_NATIVE = 0x00000400 - -} PurpleProtocolOptions; - -/** - * A protocol plugin information structure. - * - * Every protocol plugin initializes this structure. It is the gateway - * between purple and the protocol plugin. Many of these callbacks can be - * NULL. If a callback must be implemented, it has a comment indicating so. - */ -struct _PurplePluginProtocolInfo -{ - PurpleProtocolOptions options; /**< Protocol options. */ - - GList *user_splits; /**< A GList of PurpleAccountUserSplit */ - GList *protocol_options; /**< A GList of PurpleAccountOption */ - - PurpleBuddyIconSpec icon_spec; /**< The icon spec. */ - - /** - * Returns the base icon name for the given buddy and account. - * If buddy is NULL and the account is non-NULL, it will return the - * name to use for the account's icon. If both are NULL, it will - * return the name to use for the protocol's icon. - * - * This must be implemented. - */ - const char *(*list_icon)(PurpleAccount *account, PurpleBuddy *buddy); - - /** - * Fills the four char**'s with string identifiers for "emblems" - * that the UI will interpret and display as relevant - */ - const char *(*list_emblem)(PurpleBuddy *buddy); - - /** - * Gets a short string representing this buddy's status. This will - * be shown on the buddy list. - */ - char *(*status_text)(PurpleBuddy *buddy); - - /** - * Allows the prpl to add text to a buddy's tooltip. - */ - void (*tooltip_text)(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full); - - /** - * Returns a list of #PurpleStatusType which exist for this account; - * this must be implemented, and must add at least the offline and - * online states. - */ - GList *(*status_types)(PurpleAccount *account); - - /** - * Returns a list of #PurpleMenuAction structs, which represent extra - * actions to be shown in (for example) the right-click menu for @a - * node. - */ - GList *(*blist_node_menu)(PurpleBlistNode *node); - - /** - * Returns a list of #proto_chat_entry structs, which represent - * information required by the PRPL to join a chat. libpurple will - * call join_chat along with the information filled by the user. - * - * @return A list of #proto_chat_entry structs - */ - GList *(*chat_info)(PurpleConnection *); - - /** - * Returns a hashtable which maps #proto_chat_entry struct identifiers - * to default options as strings based on chat_name. The resulting - * hashtable should be created with g_hash_table_new_full(g_str_hash, - * g_str_equal, NULL, g_free);. Use #get_chat_name if you instead need - * to extract a chat name from a hashtable. - * - * @param chat_name The chat name to be turned into components - * @return Hashtable containing the information extracted from chat_name - */ - GHashTable *(*chat_info_defaults)(PurpleConnection *, const char *chat_name); - - /* All the server-related functions */ - - /** This must be implemented. */ - void (*login)(PurpleAccount *); - - /** This must be implemented. */ - void (*close)(PurpleConnection *); - - /** - * This PRPL function should return a positive value on success. - * If the message is too big to be sent, return -E2BIG. If - * the account is not connected, return -ENOTCONN. If the - * PRPL is unable to send the message for another reason, return - * some other negative value. You can use one of the valid - * errno values, or just big something. If the message should - * not be echoed to the conversation window, return 0. - */ - int (*send_im)(PurpleConnection *, const char *who, - const char *message, - PurpleMessageFlags flags); - - void (*set_info)(PurpleConnection *, const char *info); - - /** - * @return If this protocol requires the PURPLE_TYPING message to - * be sent repeatedly to signify that the user is still - * typing, then the PRPL should return the number of - * seconds to wait before sending a subsequent notification. - * Otherwise the PRPL should return 0. - */ - unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleTypingState state); - - /** - * Should arrange for purple_notify_userinfo() to be called with - * @a who's user info. - */ - void (*get_info)(PurpleConnection *, const char *who); - void (*set_status)(PurpleAccount *account, PurpleStatus *status); - - void (*set_idle)(PurpleConnection *, int idletime); - void (*change_passwd)(PurpleConnection *, const char *old_pass, - const char *new_pass); - /** - * Add a buddy to a group on the server. - * - * This PRPL function may be called in situations in which the buddy is - * already in the specified group. If the protocol supports - * authorization and the user is not already authorized to see the - * status of \a buddy, \a add_buddy should request authorization. - */ - void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); - void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups); - void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); - void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups); - void (*add_permit)(PurpleConnection *, const char *name); - void (*add_deny)(PurpleConnection *, const char *name); - void (*rem_permit)(PurpleConnection *, const char *name); - void (*rem_deny)(PurpleConnection *, const char *name); - void (*set_permit_deny)(PurpleConnection *); - - /** - * Called when the user requests joining a chat. Should arrange for - * #serv_got_joined_chat to be called. - * - * @param components A hashtable containing information required to - * join the chat as described by the entries returned - * by #chat_info. It may also be called when accepting - * an invitation, in which case this matches the - * data parameter passed to #serv_got_chat_invite. - */ - void (*join_chat)(PurpleConnection *, GHashTable *components); - - /** - * Called when the user refuses a chat invitation. - * - * @param components A hashtable containing information required to - * join the chat as passed to #serv_got_chat_invite. - */ - void (*reject_chat)(PurpleConnection *, GHashTable *components); - - /** - * Returns a chat name based on the information in components. Use - * #chat_info_defaults if you instead need to generate a hashtable - * from a chat name. - * - * @param components A hashtable containing information about the chat. - */ - char *(*get_chat_name)(GHashTable *components); - - /** - * Invite a user to join a chat. - * - * @param id The id of the chat to invite the user to. - * @param message A message displayed to the user when the invitation - * is received. - * @param who The name of the user to send the invation to. - */ - void (*chat_invite)(PurpleConnection *, int id, - const char *message, const char *who); - /** - * Called when the user requests leaving a chat. - * - * @param id The id of the chat to leave - */ - void (*chat_leave)(PurpleConnection *, int id); - - /** - * Send a whisper to a user in a chat. - * - * @param id The id of the chat. - * @param who The name of the user to send the whisper to. - * @param message The message of the whisper. - */ - void (*chat_whisper)(PurpleConnection *, int id, - const char *who, const char *message); - - /** - * Send a message to a chat. - * This PRPL function should return a positive value on success. - * If the message is too big to be sent, return -E2BIG. If - * the account is not connected, return -ENOTCONN. If the - * PRPL is unable to send the message for another reason, return - * some other negative value. You can use one of the valid - * errno values, or just big something. If the message should - * not be echoed to the conversation window, return 0. - * - * @param id The id of the chat to send the message to. - * @param message The message to send to the chat. - * @param flags A bitwise OR of #PurpleMessageFlags representing - * message flags. - * @return A positive number or 0 in case of succes, - * a negative error number in case of failure. - */ - int (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags); - - /** If implemented, this will be called regularly for this prpl's - * active connections. You'd want to do this if you need to repeatedly - * send some kind of keepalive packet to the server to avoid being - * disconnected. ("Regularly" is defined by - * KEEPALIVE_INTERVAL in libpurple/connection.c.) - */ - void (*keepalive)(PurpleConnection *); - - /** new user registration */ - void (*register_user)(PurpleAccount *); - - /** - * @deprecated Use #PurplePluginProtocolInfo.get_info instead. - */ - void (*get_cb_info)(PurpleConnection *, int, const char *who); - /** - * @deprecated Use #PurplePluginProtocolInfo.get_cb_real_name and - * #PurplePluginProtocolInfo.status_text instead. - */ - void (*get_cb_away)(PurpleConnection *, int, const char *who); - - /** save/store buddy's alias on server list/roster */ - void (*alias_buddy)(PurpleConnection *, const char *who, - const char *alias); - - /** change a buddy's group on a server list/roster */ - void (*group_buddy)(PurpleConnection *, const char *who, - const char *old_group, const char *new_group); - - /** rename a group on a server list/roster */ - void (*rename_group)(PurpleConnection *, const char *old_name, - PurpleGroup *group, GList *moved_buddies); - - void (*buddy_free)(PurpleBuddy *); - - void (*convo_closed)(PurpleConnection *, const char *who); - - /** - * Convert the username @a who to its canonical form. (For example, - * AIM treats "fOo BaR" and "foobar" as the same user; this function - * should return the same normalized string for both of those.) - */ - const char *(*normalize)(const PurpleAccount *, const char *who); - - /** - * Set the buddy icon for the given connection to @a img. The prpl - * does NOT own a reference to @a img; if it needs one, it must - * #purple_imgstore_ref(@a img) itself. - */ - void (*set_buddy_icon)(PurpleConnection *, PurpleStoredImage *img); - - void (*remove_group)(PurpleConnection *gc, PurpleGroup *group); - - /** Gets the real name of a participant in a chat. For example, on - * XMPP this turns a chat room nick foo into - * room\@server/foo - * @param gc the connection on which the room is. - * @param id the ID of the chat room. - * @param who the nickname of the chat participant. - * @return the real name of the participant. This string must be - * freed by the caller. - */ - char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); - - void (*set_chat_topic)(PurpleConnection *gc, int id, const char *topic); - - PurpleChat *(*find_blist_chat)(PurpleAccount *account, const char *name); - - /* room listing prpl callbacks */ - PurpleRoomlist *(*roomlist_get_list)(PurpleConnection *gc); - void (*roomlist_cancel)(PurpleRoomlist *list); - void (*roomlist_expand_category)(PurpleRoomlist *list, PurpleRoomlistRoom *category); - - /* file transfer callbacks */ - gboolean (*can_receive_file)(PurpleConnection *, const char *who); - void (*send_file)(PurpleConnection *, const char *who, const char *filename); - PurpleXfer *(*new_xfer)(PurpleConnection *, const char *who); - - /** Checks whether offline messages to @a buddy are supported. - * @return @c TRUE if @a buddy can be sent messages while they are - * offline, or @c FALSE if not. - */ - gboolean (*offline_message)(const PurpleBuddy *buddy); - - PurpleWhiteboardPrplOps *whiteboard_prpl_ops; - - /** For use in plugins that may understand the underlying protocol */ - int (*send_raw)(PurpleConnection *gc, const char *buf, int len); - - /* room list serialize */ - char *(*roomlist_room_serialize)(PurpleRoomlistRoom *room); - - /** Remove the user from the server. The account can either be - * connected or disconnected. After the removal is finished, the - * connection will stay open and has to be closed! - */ - /* This is here rather than next to register_user for API compatibility - * reasons. - */ - void (*unregister_user)(PurpleAccount *, PurpleAccountUnregistrationCb cb, void *user_data); - - /* Attention API for sending & receiving zaps/nudges/buzzes etc. */ - gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); - GList *(*get_attention_types)(PurpleAccount *acct); - - /** - * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). - * This allows adding more functions to this struct without requiring a major version bump. - */ - unsigned long struct_size; - - /* NOTE: - * If more functions are added, they should accessed using the following syntax: - * - * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) - * prpl->new_function(...); - * - * instead of - * - * if (prpl->new_function != NULL) - * prpl->new_function(...); - * - * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member - * functions (e.g. login, send_im etc.) too. - */ - - /** This allows protocols to specify additional strings to be used for - * various purposes. The idea is to stuff a bunch of strings in this hash - * table instead of expanding the struct for every addition. This hash - * table is allocated every call and MUST be unrefed by the caller. - * - * @param account The account to specify. This can be NULL. - * @return The protocol's string hash table. The hash table should be - * destroyed by the caller when it's no longer needed. - */ - GHashTable *(*get_account_text_table)(PurpleAccount *account); - - /** - * Initiate a media session with the given contact. - * - * @param account The account to initiate the media session on. - * @param who The remote user to initiate the session with. - * @param type The type of media session to initiate. - * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media session or stream will be successfully created) - */ - gboolean (*initiate_media)(PurpleAccount *account, const char *who, - PurpleMediaSessionType type); - - /** - * Checks to see if the given contact supports the given type of media session. - * - * @param account The account the contact is on. - * @param who The remote user to check for media capability with. - * @return The media caps the contact supports. - */ - PurpleMediaCaps (*get_media_caps)(PurpleAccount *account, - const char *who); -}; - -#define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ - (((G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < G_STRUCT_OFFSET(PurplePluginProtocolInfo, struct_size)) \ - || (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size)) && \ - prpl->member != NULL) - - -#define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \ - ((plugin)->info->type == PURPLE_PLUGIN_PROTOCOL) - -#define PURPLE_PLUGIN_PROTOCOL_INFO(plugin) \ - ((PurplePluginProtocolInfo *)(plugin)->info->extra_info) - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Attention Type API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new #PurpleAttentionType object and sets its mandatory parameters. - * - * @param ulname A non-localized string that can be used by UIs in need of such - * non-localized strings. This should be the same as @a name, - * without localization. - * @param name A localized string that the UI may display for the event. This - * should be the same string as @a ulname, with localization. - * @param inc_desc A localized description shown when the event is received. - * @param out_desc A localized description shown when the event is sent. - * @return A pointer to the new object. - * @since 2.4.0 - */ -PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *name, - const char *inc_desc, const char *out_desc); - -/** - * Sets the displayed name of the attention-demanding event. - * - * @param type The attention type. - * @param name The localized name that will be displayed by UIs. This should be - * the same string given as the unlocalized name, but with - * localization. - * @since 2.4.0 - */ -void purple_attention_type_set_name(PurpleAttentionType *type, const char *name); - -/** - * Sets the description of the attention-demanding event shown in conversations - * when the event is received. - * - * @param type The attention type. - * @param desc The localized description for incoming events. - * @since 2.4.0 - */ -void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc); - -/** - * Sets the description of the attention-demanding event shown in conversations - * when the event is sent. - * - * @param type The attention type. - * @param desc The localized description for outgoing events. - * @since 2.4.0 - */ -void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc); - -/** - * Sets the name of the icon to display for the attention event; this is optional. - * - * @param type The attention type. - * @param name The icon's name. - * @note Icons are optional for attention events. - * @since 2.4.0 - */ -void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name); - -/** - * Sets the unlocalized name of the attention event; some UIs may need this, - * thus it is required. - * - * @param type The attention type. - * @param ulname The unlocalized name. This should be the same string given as - * the localized name, but without localization. - * @since 2.4.0 - */ -void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname); - -/** - * Get the attention type's name as displayed by the UI. - * - * @param type The attention type. - * @return The name. - * @since 2.4.0 - */ -const char *purple_attention_type_get_name(const PurpleAttentionType *type); - -/** - * Get the attention type's description shown when the event is received. - * - * @param type The attention type. - * @return The description. - * @since 2.4.0 - */ -const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *type); - -/** - * Get the attention type's description shown when the event is sent. - * - * @param type The attention type. - * @return The description. - * @since 2.4.0 - */ -const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type); - -/** - * Get the attention type's icon name. - * - * @param type The attention type. - * @return The icon name or @c NULL if unset/empty. - * @note Icons are optional for attention events. - * @since 2.4.0 - */ -const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type); - -/** - * Get the attention type's unlocalized name; this is useful for some UIs. - * - * @param type The attention type - * @return The unlocalized name. - * @since 2.4.0 - */ -const char *purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type); - -/*@}*/ - -/**************************************************************************/ -/** @name Protocol Plugin API */ -/**************************************************************************/ -/*@{*/ - -/** - * Notifies Purple that our account's idle state and time have changed. - * - * This is meant to be called from protocol plugins. - * - * @param account The account. - * @param idle The user's idle state. - * @param idle_time The user's idle time. - */ -void purple_prpl_got_account_idle(PurpleAccount *account, gboolean idle, - time_t idle_time); - -/** - * Notifies Purple of our account's log-in time. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param login_time The user's log-in time. - */ -void purple_prpl_got_account_login_time(PurpleAccount *account, time_t login_time); - -/** - * Notifies Purple that our account's status has changed. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param status_id The status ID. - * @param ... A NULL-terminated list of attribute IDs and values, - * beginning with the value for @a attr_id. - */ -void purple_prpl_got_account_status(PurpleAccount *account, - const char *status_id, ...) G_GNUC_NULL_TERMINATED; - -/** - * Notifies Purple that our account's actions have changed. This is only - * called after the initial connection. Emits the account-actions-changed - * signal. - * - * This is meant to be called from protocol plugins. - * - * @param account The account. - * - * @see account-actions-changed - * @since 2.6.0 - */ -void purple_prpl_got_account_actions(PurpleAccount *account); - -/** - * Notifies Purple that a buddy's idle state and time have changed. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param idle The user's idle state. - * @param idle_time The user's idle time. This is the time at - * which the user became idle, in seconds since - * the epoch. If the PRPL does not know this value - * then it should pass 0. - */ -void purple_prpl_got_user_idle(PurpleAccount *account, const char *name, - gboolean idle, time_t idle_time); - -/** - * Notifies Purple of a buddy's log-in time. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param login_time The user's log-in time. - */ -void purple_prpl_got_user_login_time(PurpleAccount *account, const char *name, - time_t login_time); - -/** - * Notifies Purple that a buddy's status has been activated. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param status_id The status ID. - * @param ... A NULL-terminated list of attribute IDs and values, - * beginning with the value for @a attr_id. - */ -void purple_prpl_got_user_status(PurpleAccount *account, const char *name, - const char *status_id, ...) G_GNUC_NULL_TERMINATED; - -/** - * Notifies libpurple that a buddy's status has been deactivated - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param status_id The status ID. - */ -void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name, - const char *status_id); - -/** - * Informs the server that our account's status changed. - * - * @param account The account the user is on. - * @param old_status The previous status. - * @param new_status The status that was activated, or deactivated - * (in the case of independent statuses). - */ -void purple_prpl_change_account_status(PurpleAccount *account, - PurpleStatus *old_status, - PurpleStatus *new_status); - -/** - * Retrieves the list of stock status types from a prpl. - * - * @param account The account the user is on. - * @param presence The presence for which we're going to get statuses - * - * @return List of statuses - */ -GList *purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence); - -/** - * Send an attention request message. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - * - * @since 2.5.0 - */ -void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** - * Process an incoming attention message. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - * - * @since 2.5.0 - */ -void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** - * Process an incoming attention message in a chat. - * - * @param gc The connection that received the attention message. - * @param id The chat id. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - * - * @since 2.5.0 - */ -void purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code); - -/** - * Determines if the contact supports the given media session type. - * - * @param account The account the user is on. - * @param who The name of the contact to check capabilities for. - * - * @return The media caps the contact supports. - */ -PurpleMediaCaps purple_prpl_get_media_caps(PurpleAccount *account, - const char *who); - -/** - * Initiates a media session with the given contact. - * - * @param account The account the user is on. - * @param who The name of the contact to start a session with. - * @param type The type of media session to start. - * - * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media session or stream will be successfully created) - */ -gboolean purple_prpl_initiate_media(PurpleAccount *account, - const char *who, - PurpleMediaSessionType type); - -/*@}*/ - -/**************************************************************************/ -/** @name Protocol Plugin Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Finds a protocol plugin structure of the specified type. - * - * @param id The protocol plugin; - */ -PurplePlugin *purple_find_prpl(const char *id); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PRPL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -#ifndef DBUS_API_SUBJECT_TO_CHANGE -#define DBUS_API_SUBJECT_TO_CHANGE -#endif - -#include -#include -#include - -#include "dbus-purple.h" -#include "purple-client.h" - -static DBusGConnection *bus; -static DBusGProxy *purple_proxy; - -static GList *garray_int_to_glist(GArray *array) -{ - GList *list = NULL; - int i; - - for (i = 0; i < array->len; i++) - list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - - g_array_free(array, TRUE); - return list; -} - -static GSList *garray_int_to_gslist(GArray *array) -{ - GSList *list = NULL; - int i; - - for (i = 0; i < array->len; i++) - list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - - g_array_free(array, TRUE); - return list; -} - -#include "purple-client-bindings.c" - -static void lose(const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); -static void lose_gerror(const char *prefix, GError *error) G_GNUC_NORETURN; - -static void -lose(const char *str, ...) -{ - va_list args; - - va_start(args, str); - - vfprintf(stderr, str, args); - fputc('\n', stderr); - - va_end(args); - - exit(1); -} - -static void -lose_gerror(const char *prefix, GError *error) -{ - lose("%s: %s", prefix, error->message); -} - -void purple_init(void) -{ - GError *error = NULL; - - g_type_init (); - - bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); - if (!bus) - lose_gerror ("Couldn't connect to session bus", error); - - purple_proxy = dbus_g_proxy_new_for_name (bus, - DBUS_SERVICE_PURPLE, - DBUS_PATH_PURPLE, - DBUS_INTERFACE_PURPLE); - - if (!purple_proxy) - lose_gerror ("Couldn't connect to the Purple Service", error); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client-example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client-example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client-example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client-example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -#ifndef DBUS_API_SUBJECT_TO_CHANGE -#define DBUS_API_SUBJECT_TO_CHANGE -#endif - -#include -#include - -#include "purple-client.h" - -/* - This example demonstrates how to use libpurple-client to communicate - with purple. The names and signatures of functions provided by - libpurple-client are the same as those in purple. However, all - structures (such as PurpleAccount) are opaque, that is, you can only - use pointer to them. In fact, these pointers DO NOT actually point - to anything, they are just integer identifiers of assigned to these - structures by purple. So NEVER try to dereference these pointers. - Integer ids as disguised as pointers to provide type checking and - prevent mistakes such as passing an id of PurpleAccount when an id of - PurpleBuddy is expected. According to glib manual, this technique is - portable. -*/ - -int main (int argc, char **argv) -{ - GList *alist, *node; - - purple_init(); - - alist = purple_accounts_get_all(); - for (node = alist; node != NULL; node = node->next) - { - PurpleAccount *account = (PurpleAccount*) node->data; - char *name = purple_account_get_username(account); - g_print("Name: %s\n", name); - g_free(name); - } - g_list_free(alist); - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-client.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#ifndef _PURPLE_CLIENT_H_INCLUDED_ -#define _PURPLE_CLIENT_H_INCLUDED_ - -#include -#include "purple-client-bindings.h" - -G_BEGIN_DECLS - -void purple_init(void); - -G_END_DECLS - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file purple.h Header files and defines - * This file contains all the necessary preprocessor directives to include - * libpurple's headers and other preprocessor directives required for plugins - * or UIs to build. Including this file eliminates the need to directly - * include any other libpurple files. - * - * @ingroup core libpurple - * @since 2.3.0 - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_PURPLE_H_ -#define _PURPLE_PURPLE_H_ - -#include - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -#define PURPLE_PLUGINS 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.h.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file purple.h Header files and defines - * This file contains all the necessary preprocessor directives to include - * libpurple's headers and other preprocessor directives required for plugins - * or UIs to build. Including this file eliminates the need to directly - * include any other libpurple files. - * - * @ingroup core libpurple - * @since 2.3.0 - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_PURPLE_H_ -#define _PURPLE_PURPLE_H_ - -#include - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -@PLUGINS_DEFINE@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-notifications-example qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-notifications-example --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-notifications-example 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-notifications-example 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -#!/usr/bin/env python - -# This is a simple purple notification server. -# It shows notifications when your buddy signs on or you get an IM message. -# -# This script requires Python 2.4 and PyGTK bindings -# -# Note that all function names are resolved dynamically, no -# purple-specific library is needed. - -import dbus -import dbus.glib -import dbus.decorators -import gobject -import os - -def ensureimconversation(conversation, account, name): - if conversation != 0: - return conversation - else: - # 1 = PURPLE_CONV_IM - return purple.PurpleConversationNew(1, account, name) - -def receivedimmsg(account, name, message, conversation, flags): - buddy = purple.PurpleFindBuddy(account, name) - if buddy != 0: - alias = purple.PurpleBuddyGetAlias(buddy) - else: - alias = name - - text = "%s says %s" % (alias, message) - code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", - "'So what?','Show me',Close,Abuse", text) - - if code == 101: # so what? - pass - else: - conversation = ensureimconversation(conversation, account, name) - - if code == 102: # show me - window = purple.PurpleConversationGetWindow(conversation) - purple.PurpleConvWindowRaise(window) - - if code == 103: # close - purple.PurpleConversationDestroy(conversation) - - if code == 104: # abuse - im = purple.PurpleConversationGetImData(conversation) - purple.PurpleConvImSend(im, "Go away you f...") - - -def buddysignedon(buddyid): - alias = purple.PurpleBuddyGetAlias(buddyid) - text = "%s is online" % alias - - code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", - "'So what?','Let's talk'", text) - - if code == 101: # so what? - pass - - if code == 102: # talk - name = purple.PurpleBuddyGetName(buddyid) - account = purple.PurpleBuddyGetAccount(buddyid) - purple.PurpleConversationNew(1, account, name) - - -bus = dbus.SessionBus() -obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") -purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - -bus.add_signal_receiver(receivedimmsg, - dbus_interface = "im.pidgin.purple.PurpleInterface", - signal_name = "ReceivedImMsg") - -bus.add_signal_receiver(buddysignedon, - dbus_interface = "im.pidgin.purple.PurpleInterface", - signal_name = "BuddySignedOn") - -print "This is a simple purple notification server." -print "It shows notifications when your buddy signs on or you get an IM message." - -loop = gobject.MainLoop() -loop.run() - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.pc.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.pc.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.pc.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple.pc.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -Name: libpurple -Description: libpurple is a GLib-based instant messenger library. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${includedir}/libpurple -Libs: -L${libdir} -lpurple diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-remote qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-remote --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-remote 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-remote 1970-01-01 00:00:00.000000000 +0000 @@ -1,239 +0,0 @@ -#!/usr/bin/env python - -import dbus -import re -import urllib -import sys - -import xml.dom.minidom - -xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName - -obj = None -try: - obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") -except: - pass - -purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - -class CheckedObject: - def __init__(self, obj): - self.obj = obj - - def __getattr__(self, attr): - return CheckedAttribute(self, attr) - -class CheckedAttribute: - def __init__(self, cobj, attr): - self.cobj = cobj - self.attr = attr - - def __call__(self, *args): - result = self.cobj.obj.__getattr__(self.attr)(*args) - if result == 0: - raise "Error: " + self.attr + " " + str(args) + " returned " + str(result) - return result - -def show_help(requested=False): - print """This program uses D-Bus to communicate with purple. - -Usage: - - %s "command1" "command2" ... - -Each command is of one of the three types: - - [protocol:]commandname?param1=value1¶m2=value2&... - FunctionName?param1=value1¶m2=value2&... - FunctionName(value1,value2,...) - -The second and third form are provided for completeness but their use -is not recommended; use purple-send or purple-send-async instead. The -second form uses introspection to find out the parameter names and -their types, therefore it is rather slow. - -Examples of commands: - - jabber:goim?screenname=testone@localhost&message=hi - jabber:gochat?room=TestRoom&server=conference.localhost - jabber:getinfo?screenname=testone@localhost - jabber:addbuddy?screenname=my friend - - setstatus?status=away&message=don't disturb - getstatus - getstatusmessage - quit - - PurpleAccountsFindConnected?name=&protocol=prpl-jabber - PurpleAccountsFindConnected(,prpl-jabber) -""" % sys.argv[0] - if (requested): - sys.exit(0) - else: - sys.exit(1) - -cpurple = CheckedObject(purple) - -urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" - -def extendlist(list, length, fill): - if len(list) < length: - return list + [fill] * (length - len(list)) - else: - return list - -def convert(value): - try: - return int(value) - except: - return value - -def findaccount(accountname, protocolname): - try: - # prefer connected accounts - account = cpurple.PurpleAccountsFindConnected(accountname, protocolname) - return account - except: - # try to get any account and connect it - account = cpurple.PurpleAccountsFindAny(accountname, protocolname) - purple.PurpleAccountSetStatusVargs(account, "online", 1) - purple.PurpleAccountConnect(account) - return account - - -def execute(uri): - match = re.match(urlregexp, uri) - protocol = match.group(2) - if protocol == "xmpp": - protocol = "jabber" - if protocol is not None: - protocol = "prpl-" + protocol - command = match.group(5) - paramstring = match.group(7) - params = {} - if paramstring is not None: - for param in paramstring.split("&"): - key, value = extendlist(param.split("=",1), 2, "") - params[key] = urllib.unquote(value) - - accountname = params.get("account", "") - - if command == "goim": - account = findaccount(accountname, protocol) - conversation = cpurple.PurpleConversationNew(1, account, params["screenname"]) - if "message" in params: - im = cpurple.PurpleConversationGetImData(conversation) - purple.PurpleConvImSend(im, params["message"]) - return None - - elif command == "gochat": - account = findaccount(accountname, protocol) - connection = cpurple.PurpleAccountGetConnection(account) - return purple.ServJoinChat(connection, params) - - elif command == "addbuddy": - account = findaccount(accountname, protocol) - return cpurple.PurpleBlistRequestAddBuddy(account, params["screenname"], - params.get("group", ""), "") - - elif command == "setstatus": - current = purple.PurpleSavedstatusGetCurrent() - - if "status" in params: - status_id = params["status"] - status_type = purple.PurplePrimitiveGetTypeFromId(status_id) - else: - status_type = purple.PurpleSavedstatusGetType(current) - status_id = purple.PurplePrimitiveGetIdFromType(status_type) - - if "message" in params: - message = params["message"]; - else: - message = purple.PurpleSavedstatusGetMessage(current) - - if "account" in params: - accounts = [cpurple.PurpleAccountsFindAny(accountname, protocol)] - - for account in accounts: - status = purple.PurpleAccountGetStatus(account, status_id) - type = purple.PurpleStatusGetType(status) - purple.PurpleSavedstatusSetSubstatus(current, account, type, message) - purple.PurpleSavedstatusActivateForAccount(current, account) - else: - saved = purple.PurpleSavedstatusNew("", status_type) - purple.PurpleSavedstatusSetMessage(saved, message) - purple.PurpleSavedstatusActivate(saved) - - return None - - elif command == "getstatus": - current = purple.PurpleSavedstatusGetCurrent() - status_type = purple.PurpleSavedstatusGetType(current) - status_id = purple.PurplePrimitiveGetIdFromType(status_type) - return status_id - - elif command == "getstatusmessage": - current = purple.PurpleSavedstatusGetCurrent() - return purple.PurpleSavedstatusGetMessage(current) - - elif command == "getinfo": - account = findaccount(accountname, protocol) - connection = cpurple.PurpleAccountGetConnection(account) - return purple.ServGetInfo(connection, params["screenname"]) - - elif command == "quit": - return purple.PurpleCoreQuit() - - elif command == "uri": - return None - - else: - match = re.match(r"(\w+)\s*\(([^)]*)\)", command) - if match is not None: - name = match.group(1) - argstr = match.group(2) - if argstr == "": - args = [] - else: - args = argstr.split(",") - fargs = [] - for arg in args: - fargs.append(convert(arg.strip())) - return purple.__getattr__(name)(*fargs) - else: - # introspect the object to get parameter names and types - # this is slow because the entire introspection info must be downloaded - data = dbus.Interface(obj, "org.freedesktop.DBus.Introspectable").\ - Introspect() - introspect = xml.dom.minidom.parseString(data).documentElement - for method in introspect.all("method"): - if command == method.getAttribute("name"): - methodparams = [] - for arg in method.all("arg"): - if arg.getAttribute("direction") == "in": - value = params[arg.getAttribute("name")] - type = arg.getAttribute("type") - if type == "s": - methodparams.append(value) - elif type == "i": - methodparams.append(int(value)) - else: - raise "Don't know how to handle type \"%s\"" % type - return purple.__getattr__(command)(*methodparams) - show_help() - -if len(sys.argv) == 1: - show_help() -elif (sys.argv[1] == "--help" or sys.argv[1] == "-h"): - show_help(True) -elif (obj == None): - print "No existing libpurple instance detected." - sys.exit(1); - -for arg in sys.argv[1:]: - output = execute(arg) - - if (output != None): - print output - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-send qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-send --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-send 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/purple-send 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -#!/bin/sh - -METHOD_NAME=$1 - -if test -z "$METHOD_NAME" -then - cat <fields = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - return fields; -} - -void -purple_request_fields_destroy(PurpleRequestFields *fields) -{ - g_return_if_fail(fields != NULL); - - g_list_foreach(fields->groups, (GFunc)purple_request_field_group_destroy, NULL); - g_list_free(fields->groups); - g_list_free(fields->required_fields); - g_hash_table_destroy(fields->fields); - g_free(fields); -} - -void -purple_request_fields_add_group(PurpleRequestFields *fields, - PurpleRequestFieldGroup *group) -{ - GList *l; - PurpleRequestField *field; - - g_return_if_fail(fields != NULL); - g_return_if_fail(group != NULL); - - fields->groups = g_list_append(fields->groups, group); - - group->fields_list = fields; - - for (l = purple_request_field_group_get_fields(group); - l != NULL; - l = l->next) { - - field = l->data; - - g_hash_table_insert(fields->fields, - g_strdup(purple_request_field_get_id(field)), field); - - if (purple_request_field_is_required(field)) { - fields->required_fields = - g_list_append(fields->required_fields, field); - } - - } -} - -GList * -purple_request_fields_get_groups(const PurpleRequestFields *fields) -{ - g_return_val_if_fail(fields != NULL, NULL); - - return fields->groups; -} - -gboolean -purple_request_fields_exists(const PurpleRequestFields *fields, const char *id) -{ - g_return_val_if_fail(fields != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - return (g_hash_table_lookup(fields->fields, id) != NULL); -} - -GList * -purple_request_fields_get_required(const PurpleRequestFields *fields) -{ - g_return_val_if_fail(fields != NULL, NULL); - - return fields->required_fields; -} - -gboolean -purple_request_fields_is_field_required(const PurpleRequestFields *fields, - const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return FALSE; - - return purple_request_field_is_required(field); -} - -gpointer -purple_request_field_get_ui_data(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->ui_data; -} - -void -purple_request_field_set_ui_data(PurpleRequestField *field, - gpointer ui_data) -{ - g_return_if_fail(field != NULL); - - field->ui_data = ui_data; -} - -gboolean -purple_request_fields_all_required_filled(const PurpleRequestFields *fields) -{ - GList *l; - - g_return_val_if_fail(fields != NULL, FALSE); - - for (l = fields->required_fields; l != NULL; l = l->next) - { - PurpleRequestField *field = (PurpleRequestField *)l->data; - - switch (purple_request_field_get_type(field)) - { - case PURPLE_REQUEST_FIELD_STRING: - if (purple_request_field_string_get_value(field) == NULL || - *(purple_request_field_string_get_value(field)) == '\0') - return FALSE; - - break; - - default: - break; - } - } - - return TRUE; -} - -PurpleRequestField * -purple_request_fields_get_field(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - field = g_hash_table_lookup(fields->fields, id); - - g_return_val_if_fail(field != NULL, NULL); - - return field; -} - -const char * -purple_request_fields_get_string(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return NULL; - - return purple_request_field_string_get_value(field); -} - -int -purple_request_fields_get_integer(const PurpleRequestFields *fields, - const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, 0); - g_return_val_if_fail(id != NULL, 0); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return 0; - - return purple_request_field_int_get_value(field); -} - -gboolean -purple_request_fields_get_bool(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return FALSE; - - return purple_request_field_bool_get_value(field); -} - -int -purple_request_fields_get_choice(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, -1); - g_return_val_if_fail(id != NULL, -1); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return -1; - - return purple_request_field_choice_get_value(field); -} - -PurpleAccount * -purple_request_fields_get_account(const PurpleRequestFields *fields, - const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return NULL; - - return purple_request_field_account_get_value(field); -} - -PurpleRequestFieldGroup * -purple_request_field_group_new(const char *title) -{ - PurpleRequestFieldGroup *group; - - group = g_new0(PurpleRequestFieldGroup, 1); - - group->title = g_strdup(title); - - return group; -} - -void -purple_request_field_group_destroy(PurpleRequestFieldGroup *group) -{ - g_return_if_fail(group != NULL); - - g_free(group->title); - - g_list_foreach(group->fields, (GFunc)purple_request_field_destroy, NULL); - g_list_free(group->fields); - - g_free(group); -} - -void -purple_request_field_group_add_field(PurpleRequestFieldGroup *group, - PurpleRequestField *field) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(field != NULL); - - group->fields = g_list_append(group->fields, field); - - if (group->fields_list != NULL) - { - g_hash_table_insert(group->fields_list->fields, - g_strdup(purple_request_field_get_id(field)), field); - - if (purple_request_field_is_required(field)) - { - group->fields_list->required_fields = - g_list_append(group->fields_list->required_fields, field); - } - } - - field->group = group; - -} - -const char * -purple_request_field_group_get_title(const PurpleRequestFieldGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->title; -} - -GList * -purple_request_field_group_get_fields(const PurpleRequestFieldGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->fields; -} - -PurpleRequestField * -purple_request_field_new(const char *id, const char *text, - PurpleRequestFieldType type) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(type != PURPLE_REQUEST_FIELD_NONE, NULL); - - field = g_new0(PurpleRequestField, 1); - - field->id = g_strdup(id); - field->type = type; - - purple_request_field_set_label(field, text); - purple_request_field_set_visible(field, TRUE); - - return field; -} - -void -purple_request_field_destroy(PurpleRequestField *field) -{ - g_return_if_fail(field != NULL); - - g_free(field->id); - g_free(field->label); - g_free(field->type_hint); - - if (field->type == PURPLE_REQUEST_FIELD_STRING) - { - g_free(field->u.string.default_value); - g_free(field->u.string.value); - } - else if (field->type == PURPLE_REQUEST_FIELD_CHOICE) - { - if (field->u.choice.labels != NULL) - { - g_list_foreach(field->u.choice.labels, (GFunc)g_free, NULL); - g_list_free(field->u.choice.labels); - } - } - else if (field->type == PURPLE_REQUEST_FIELD_LIST) - { - if (field->u.list.items != NULL) - { - g_list_foreach(field->u.list.items, (GFunc)g_free, NULL); - g_list_free(field->u.list.items); - } - - if (field->u.list.selected != NULL) - { - g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL); - g_list_free(field->u.list.selected); - } - - g_hash_table_destroy(field->u.list.item_data); - g_hash_table_destroy(field->u.list.selected_table); - } - - g_free(field); -} - -void -purple_request_field_set_label(PurpleRequestField *field, const char *label) -{ - g_return_if_fail(field != NULL); - - g_free(field->label); - field->label = g_strdup(label); -} - -void -purple_request_field_set_visible(PurpleRequestField *field, gboolean visible) -{ - g_return_if_fail(field != NULL); - - field->visible = visible; -} - -void -purple_request_field_set_type_hint(PurpleRequestField *field, - const char *type_hint) -{ - g_return_if_fail(field != NULL); - - g_free(field->type_hint); - field->type_hint = g_strdup(type_hint); -} - -void -purple_request_field_set_required(PurpleRequestField *field, gboolean required) -{ - g_return_if_fail(field != NULL); - - if (field->required == required) - return; - - field->required = required; - - if (field->group != NULL) - { - if (required) - { - field->group->fields_list->required_fields = - g_list_append(field->group->fields_list->required_fields, - field); - } - else - { - field->group->fields_list->required_fields = - g_list_remove(field->group->fields_list->required_fields, - field); - } - } -} - -PurpleRequestFieldType -purple_request_field_get_type(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, PURPLE_REQUEST_FIELD_NONE); - - return field->type; -} - -PurpleRequestFieldGroup * -purple_request_field_get_group(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->group; -} - -const char * -purple_request_field_get_id(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->id; -} - -const char * -purple_request_field_get_label(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->label; -} - -gboolean -purple_request_field_is_visible(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - - return field->visible; -} - -const char * -purple_request_field_get_type_hint(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->type_hint; -} - -gboolean -purple_request_field_is_required(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - - return field->required; -} - -PurpleRequestField * -purple_request_field_string_new(const char *id, const char *text, - const char *default_value, gboolean multiline) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_STRING); - - field->u.string.multiline = multiline; - field->u.string.editable = TRUE; - - purple_request_field_string_set_default_value(field, default_value); - purple_request_field_string_set_value(field, default_value); - - return field; -} - -void -purple_request_field_string_set_default_value(PurpleRequestField *field, - const char *default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - g_free(field->u.string.default_value); - field->u.string.default_value = g_strdup(default_value); -} - -void -purple_request_field_string_set_value(PurpleRequestField *field, const char *value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - g_free(field->u.string.value); - field->u.string.value = g_strdup(value); -} - -void -purple_request_field_string_set_masked(PurpleRequestField *field, gboolean masked) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - field->u.string.masked = masked; -} - -void -purple_request_field_string_set_editable(PurpleRequestField *field, - gboolean editable) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - field->u.string.editable = editable; -} - -const char * -purple_request_field_string_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, NULL); - - return field->u.string.default_value; -} - -const char * -purple_request_field_string_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, NULL); - - return field->u.string.value; -} - -gboolean -purple_request_field_string_is_multiline(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE); - - return field->u.string.multiline; -} - -gboolean -purple_request_field_string_is_masked(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE); - - return field->u.string.masked; -} - -gboolean -purple_request_field_string_is_editable(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE); - - return field->u.string.editable; -} - -PurpleRequestField * -purple_request_field_int_new(const char *id, const char *text, - int default_value) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_INTEGER); - - purple_request_field_int_set_default_value(field, default_value); - purple_request_field_int_set_value(field, default_value); - - return field; -} - -void -purple_request_field_int_set_default_value(PurpleRequestField *field, - int default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER); - - field->u.integer.default_value = default_value; -} - -void -purple_request_field_int_set_value(PurpleRequestField *field, int value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER); - - field->u.integer.value = value; -} - -int -purple_request_field_int_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER, 0); - - return field->u.integer.default_value; -} - -int -purple_request_field_int_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER, 0); - - return field->u.integer.value; -} - -PurpleRequestField * -purple_request_field_bool_new(const char *id, const char *text, - gboolean default_value) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_BOOLEAN); - - purple_request_field_bool_set_default_value(field, default_value); - purple_request_field_bool_set_value(field, default_value); - - return field; -} - -void -purple_request_field_bool_set_default_value(PurpleRequestField *field, - gboolean default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN); - - field->u.boolean.default_value = default_value; -} - -void -purple_request_field_bool_set_value(PurpleRequestField *field, gboolean value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN); - - field->u.boolean.value = value; -} - -gboolean -purple_request_field_bool_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN, FALSE); - - return field->u.boolean.default_value; -} - -gboolean -purple_request_field_bool_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN, FALSE); - - return field->u.boolean.value; -} - -PurpleRequestField * -purple_request_field_choice_new(const char *id, const char *text, - int default_value) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_CHOICE); - - purple_request_field_choice_set_default_value(field, default_value); - purple_request_field_choice_set_value(field, default_value); - - return field; -} - -void -purple_request_field_choice_add(PurpleRequestField *field, const char *label) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(label != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE); - - field->u.choice.labels = g_list_append(field->u.choice.labels, - g_strdup(label)); -} - -void -purple_request_field_choice_set_default_value(PurpleRequestField *field, - int default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE); - - field->u.choice.default_value = default_value; -} - -void -purple_request_field_choice_set_value(PurpleRequestField *field, - int value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE); - - field->u.choice.value = value; -} - -int -purple_request_field_choice_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, -1); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE, -1); - - return field->u.choice.default_value; -} - -int -purple_request_field_choice_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, -1); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE, -1); - - return field->u.choice.value; -} - -GList * -purple_request_field_choice_get_labels(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE, NULL); - - return field->u.choice.labels; -} - -PurpleRequestField * -purple_request_field_list_new(const char *id, const char *text) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_LIST); - - field->u.list.item_data = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - field->u.list.selected_table = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - return field; -} - -void -purple_request_field_list_set_multi_select(PurpleRequestField *field, - gboolean multi_select) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - field->u.list.multiple_selection = multi_select; -} - -gboolean -purple_request_field_list_get_multi_select(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, FALSE); - - return field->u.list.multiple_selection; -} - -void * -purple_request_field_list_get_data(const PurpleRequestField *field, - const char *text) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, NULL); - - return g_hash_table_lookup(field->u.list.item_data, text); -} - -void -purple_request_field_list_add(PurpleRequestField *field, const char *item, - void *data) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(item != NULL); - g_return_if_fail(data != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - field->u.list.items = g_list_append(field->u.list.items, g_strdup(item)); - - g_hash_table_insert(field->u.list.item_data, g_strdup(item), data); -} - -void -purple_request_field_list_add_selected(PurpleRequestField *field, const char *item) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(item != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - if (!purple_request_field_list_get_multi_select(field) && - field->u.list.selected != NULL) - { - purple_debug_warning("request", - "More than one item added to non-multi-select " - "field %s\n", - purple_request_field_get_id(field)); - return; - } - - field->u.list.selected = g_list_append(field->u.list.selected, - g_strdup(item)); - - g_hash_table_insert(field->u.list.selected_table, g_strdup(item), NULL); -} - -void -purple_request_field_list_clear_selected(PurpleRequestField *field) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - if (field->u.list.selected != NULL) - { - g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL); - g_list_free(field->u.list.selected); - field->u.list.selected = NULL; - } - - g_hash_table_destroy(field->u.list.selected_table); - - field->u.list.selected_table = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); -} - -void -purple_request_field_list_set_selected(PurpleRequestField *field, GList *items) -{ - GList *l; - - g_return_if_fail(field != NULL); - g_return_if_fail(items != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - purple_request_field_list_clear_selected(field); - - if (!purple_request_field_list_get_multi_select(field) && - items && items->next) - { - purple_debug_warning("request", - "More than one item added to non-multi-select " - "field %s\n", - purple_request_field_get_id(field)); - return; - } - - for (l = items; l != NULL; l = l->next) - { - field->u.list.selected = g_list_append(field->u.list.selected, - g_strdup(l->data)); - g_hash_table_insert(field->u.list.selected_table, - g_strdup((char *)l->data), NULL); - } -} - -gboolean -purple_request_field_list_is_selected(const PurpleRequestField *field, - const char *item) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(item != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, FALSE); - - return g_hash_table_lookup_extended(field->u.list.selected_table, - item, NULL, NULL); -} - -GList * -purple_request_field_list_get_selected(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, NULL); - - return field->u.list.selected; -} - -GList * -purple_request_field_list_get_items(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, NULL); - - return field->u.list.items; -} - -PurpleRequestField * -purple_request_field_label_new(const char *id, const char *text) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_LABEL); - - return field; -} - -PurpleRequestField * -purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - g_return_val_if_fail(buf != NULL, NULL); - g_return_val_if_fail(size > 0, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_IMAGE); - - field->u.image.buffer = g_memdup(buf, size); - field->u.image.size = size; - field->u.image.scale_x = 1; - field->u.image.scale_y = 1; - - return field; -} - -void -purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE); - - field->u.image.scale_x = x; - field->u.image.scale_y = y; -} - -const char * -purple_request_field_image_get_buffer(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, NULL); - - return field->u.image.buffer; -} - -gsize -purple_request_field_image_get_size(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, 0); - - return field->u.image.size; -} - -unsigned int -purple_request_field_image_get_scale_x(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, 0); - - return field->u.image.scale_x; -} - -unsigned int -purple_request_field_image_get_scale_y(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, 0); - - return field->u.image.scale_y; -} - -PurpleRequestField * -purple_request_field_account_new(const char *id, const char *text, - PurpleAccount *account) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_ACCOUNT); - - if (account == NULL && purple_connections_get_all() != NULL) - { - account = purple_connection_get_account( - (PurpleConnection *)purple_connections_get_all()->data); - } - - purple_request_field_account_set_default_value(field, account); - purple_request_field_account_set_value(field, account); - - return field; -} - -void -purple_request_field_account_set_default_value(PurpleRequestField *field, - PurpleAccount *default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - field->u.account.default_account = default_value; -} - -void -purple_request_field_account_set_value(PurpleRequestField *field, - PurpleAccount *value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - field->u.account.account = value; -} - -void -purple_request_field_account_set_show_all(PurpleRequestField *field, - gboolean show_all) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - if (field->u.account.show_all == show_all) - return; - - field->u.account.show_all = show_all; - - if (!show_all) - { - if (purple_account_is_connected(field->u.account.default_account)) - { - purple_request_field_account_set_default_value(field, - (PurpleAccount *)purple_connections_get_all()->data); - } - - if (purple_account_is_connected(field->u.account.account)) - { - purple_request_field_account_set_value(field, - (PurpleAccount *)purple_connections_get_all()->data); - } - } -} - -void -purple_request_field_account_set_filter(PurpleRequestField *field, - PurpleFilterAccountFunc filter_func) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - field->u.account.filter_func = filter_func; -} - -PurpleAccount * -purple_request_field_account_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, NULL); - - return field->u.account.default_account; -} - -PurpleAccount * -purple_request_field_account_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, NULL); - - return field->u.account.account; -} - -gboolean -purple_request_field_account_get_show_all(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, FALSE); - - return field->u.account.show_all; -} - -PurpleFilterAccountFunc -purple_request_field_account_get_filter(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, FALSE); - - return field->u.account.filter_func; -} - -/* -- */ - -void * -purple_request_input(void *handle, const char *title, const char *primary, - const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_input != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_INPUT; - info->handle = handle; - info->ui_handle = ops->request_input(title, primary, secondary, - default_value, - multiline, masked, hint, - ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, - user_data); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_choice(void *handle, const char *title, const char *primary, - const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, ...) -{ - void *ui_handle; - va_list args; - - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - - va_start(args, user_data); - ui_handle = purple_request_choice_varg(handle, title, primary, secondary, - default_value, ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, user_data, args); - va_end(args); - - return ui_handle; -} - -void * -purple_request_choice_varg(void *handle, const char *title, - const char *primary, const char *secondary, - int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, va_list choices) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - g_return_val_if_fail(cancel_text != NULL, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_choice != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_CHOICE; - info->handle = handle; - info->ui_handle = ops->request_choice(title, primary, secondary, - default_value, - ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, - user_data, choices); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_action(void *handle, const char *title, const char *primary, - const char *secondary, int default_action, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, size_t action_count, ...) -{ - void *ui_handle; - va_list args; - - g_return_val_if_fail(action_count > 0, NULL); - - va_start(args, action_count); - ui_handle = purple_request_action_varg(handle, title, primary, secondary, - default_action, account, who, conv, - user_data, action_count, args); - va_end(args); - - return ui_handle; -} - -void * -purple_request_action_varg(void *handle, const char *title, - const char *primary, const char *secondary, - int default_action, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, size_t action_count, va_list actions) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(action_count > 0, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_action != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_ACTION; - info->handle = handle; - info->ui_handle = ops->request_action(title, primary, secondary, - default_action, account, who, conv, - user_data, action_count, actions); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_fields(void *handle, const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - g_return_val_if_fail(cancel_text != NULL, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_fields != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_FIELDS; - info->handle = handle; - info->ui_handle = ops->request_fields(title, primary, secondary, - fields, ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, - user_data); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_file(void *handle, const char *title, const char *filename, - gboolean savedialog, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_file != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_FILE; - info->handle = handle; - info->ui_handle = ops->request_file(title, filename, savedialog, - ok_cb, cancel_cb, - account, who, conv, user_data); - handles = g_list_append(handles, info); - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_folder(void *handle, const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_file != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_FOLDER; - info->handle = handle; - info->ui_handle = ops->request_folder(title, dirname, - ok_cb, cancel_cb, - account, who, conv, - user_data); - handles = g_list_append(handles, info); - return info->ui_handle; - } - - return NULL; -} - -static void -purple_request_close_info(PurpleRequestInfo *info) -{ - PurpleRequestUiOps *ops; - - ops = purple_request_get_ui_ops(); - - purple_notify_close_with_handle(info->ui_handle); - purple_request_close_with_handle(info->ui_handle); - - if (ops != NULL && ops->close_request != NULL) - ops->close_request(info->type, info->ui_handle); - - g_free(info); -} - -void -purple_request_close(PurpleRequestType type, void *ui_handle) -{ - GList *l; - - g_return_if_fail(ui_handle != NULL); - - for (l = handles; l != NULL; l = l->next) { - PurpleRequestInfo *info = l->data; - - if (info->ui_handle == ui_handle) { - handles = g_list_remove(handles, info); - purple_request_close_info(info); - break; - } - } -} - -void -purple_request_close_with_handle(void *handle) -{ - GList *l, *l_next; - - g_return_if_fail(handle != NULL); - - for (l = handles; l != NULL; l = l_next) { - PurpleRequestInfo *info = l->data; - - l_next = l->next; - - if (info->handle == handle) { - handles = g_list_remove(handles, info); - purple_request_close_info(info); - } - } -} - -void -purple_request_set_ui_ops(PurpleRequestUiOps *ops) -{ - request_ui_ops = ops; -} - -PurpleRequestUiOps * -purple_request_get_ui_ops(void) -{ - return request_ui_ops; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/request.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/request.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/request.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/request.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1538 +0,0 @@ -/** - * @file request.h Request API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_REQUEST_H_ -#define _PURPLE_REQUEST_H_ - -#include -#include -#include - -/** @copydoc _PurpleRequestField */ -typedef struct _PurpleRequestField PurpleRequestField; - -#include "account.h" - -#define PURPLE_DEFAULT_ACTION_NONE -1 - -/** - * Request types. - */ -typedef enum -{ - PURPLE_REQUEST_INPUT = 0, /**< Text input request. */ - PURPLE_REQUEST_CHOICE, /**< Multiple-choice request. */ - PURPLE_REQUEST_ACTION, /**< Action request. */ - PURPLE_REQUEST_FIELDS, /**< Multiple fields request. */ - PURPLE_REQUEST_FILE, /**< File open or save request. */ - PURPLE_REQUEST_FOLDER /**< Folder selection request. */ - -} PurpleRequestType; - -/** - * A type of field. - */ -typedef enum -{ - PURPLE_REQUEST_FIELD_NONE, - PURPLE_REQUEST_FIELD_STRING, - PURPLE_REQUEST_FIELD_INTEGER, - PURPLE_REQUEST_FIELD_BOOLEAN, - PURPLE_REQUEST_FIELD_CHOICE, - PURPLE_REQUEST_FIELD_LIST, - PURPLE_REQUEST_FIELD_LABEL, - PURPLE_REQUEST_FIELD_IMAGE, - PURPLE_REQUEST_FIELD_ACCOUNT - -} PurpleRequestFieldType; - -/** - * Multiple fields request data. - */ -typedef struct -{ - GList *groups; - - GHashTable *fields; - - GList *required_fields; - - void *ui_data; - -} PurpleRequestFields; - -/** - * A group of fields with a title. - */ -typedef struct -{ - PurpleRequestFields *fields_list; - - char *title; - - GList *fields; - -} PurpleRequestFieldGroup; - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_) -/** - * A request field. - */ -struct _PurpleRequestField -{ - PurpleRequestFieldType type; - PurpleRequestFieldGroup *group; - - char *id; - char *label; - char *type_hint; - - gboolean visible; - gboolean required; - - union - { - struct - { - gboolean multiline; - gboolean masked; - gboolean editable; - char *default_value; - char *value; - - } string; - - struct - { - int default_value; - int value; - - } integer; - - struct - { - gboolean default_value; - gboolean value; - - } boolean; - - struct - { - int default_value; - int value; - - GList *labels; - - } choice; - - struct - { - GList *items; - GHashTable *item_data; - GList *selected; - GHashTable *selected_table; - - gboolean multiple_selection; - - } list; - - struct - { - PurpleAccount *default_account; - PurpleAccount *account; - gboolean show_all; - - PurpleFilterAccountFunc filter_func; - - } account; - - struct - { - unsigned int scale_x; - unsigned int scale_y; - const char *buffer; - gsize size; - } image; - - } u; - - void *ui_data; - -}; -#endif - -/** - * Request UI operations. - */ -typedef struct -{ - /** @see purple_request_input(). */ - void *(*request_input)(const char *title, const char *primary, - const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data); - - /** @see purple_request_choice_varg(). */ - void *(*request_choice)(const char *title, const char *primary, - const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data, - va_list choices); - - /** @see purple_request_action_varg(). */ - void *(*request_action)(const char *title, const char *primary, - const char *secondary, int default_action, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data, - size_t action_count, va_list actions); - - /** @see purple_request_fields(). */ - void *(*request_fields)(const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data); - - /** @see purple_request_file(). */ - void *(*request_file)(const char *title, const char *filename, - gboolean savedialog, GCallback ok_cb, - GCallback cancel_cb, PurpleAccount *account, - const char *who, PurpleConversation *conv, - void *user_data); - - void (*close_request)(PurpleRequestType type, void *ui_handle); - - /** @see purple_request_folder(). */ - void *(*request_folder)(const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleRequestUiOps; - -typedef void (*PurpleRequestInputCb)(void *, const char *); - -/** The type of callbacks passed to purple_request_action(). The first - * argument is the @a user_data parameter; the second is the index in the list - * of actions of the one chosen. - */ -typedef void (*PurpleRequestActionCb)(void *, int); -typedef void (*PurpleRequestChoiceCb)(void *, int); -typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields); -typedef void (*PurpleRequestFileCb)(void *, const char *filename); - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Field List API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a list of fields to pass to purple_request_fields(). - * - * @return A PurpleRequestFields structure. - */ -PurpleRequestFields *purple_request_fields_new(void); - -/** - * Destroys a list of fields. - * - * @param fields The list of fields to destroy. - */ -void purple_request_fields_destroy(PurpleRequestFields *fields); - -/** - * Adds a group of fields to the list. - * - * @param fields The fields list. - * @param group The group to add. - */ -void purple_request_fields_add_group(PurpleRequestFields *fields, - PurpleRequestFieldGroup *group); - -/** - * Returns a list of all groups in a field list. - * - * @param fields The fields list. - * - * @constreturn A list of groups. - */ -GList *purple_request_fields_get_groups(const PurpleRequestFields *fields); - -/** - * Returns whether or not the field with the specified ID exists. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return TRUE if the field exists, or FALSE. - */ -gboolean purple_request_fields_exists(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns a list of all required fields. - * - * @param fields The fields list. - * - * @constreturn The list of required fields. - */ -GList *purple_request_fields_get_required(const PurpleRequestFields *fields); - -/** - * Returns whether or not a field with the specified ID is required. - * - * @param fields The fields list. - * @param id The field ID. - * - * @return TRUE if the specified field is required, or FALSE. - */ -gboolean purple_request_fields_is_field_required(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns whether or not all required fields have values. - * - * @param fields The fields list. - * - * @return TRUE if all required fields have values, or FALSE. - */ -gboolean purple_request_fields_all_required_filled( - const PurpleRequestFields *fields); - -/** - * Return the field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The field, if found. - */ -PurpleRequestField *purple_request_fields_get_field( - const PurpleRequestFields *fields, const char *id); - -/** - * Returns the string value of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The string value, if found, or @c NULL otherwise. - */ -const char *purple_request_fields_get_string(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the integer value of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The integer value, if found, or 0 otherwise. - */ -int purple_request_fields_get_integer(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the boolean value of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The boolean value, if found, or @c FALSE otherwise. - */ -gboolean purple_request_fields_get_bool(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the choice index of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The choice index, if found, or -1 otherwise. - */ -int purple_request_fields_get_choice(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the account of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The account value, if found, or NULL otherwise. - */ -PurpleAccount *purple_request_fields_get_account(const PurpleRequestFields *fields, - const char *id); - -/*@}*/ - -/**************************************************************************/ -/** @name Fields Group API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a fields group with an optional title. - * - * @param title The optional title to give the group. - * - * @return A new fields group - */ -PurpleRequestFieldGroup *purple_request_field_group_new(const char *title); - -/** - * Destroys a fields group. - * - * @param group The group to destroy. - */ -void purple_request_field_group_destroy(PurpleRequestFieldGroup *group); - -/** - * Adds a field to the group. - * - * @param group The group to add the field to. - * @param field The field to add to the group. - */ -void purple_request_field_group_add_field(PurpleRequestFieldGroup *group, - PurpleRequestField *field); - -/** - * Returns the title of a fields group. - * - * @param group The group. - * - * @return The title, if set. - */ -const char *purple_request_field_group_get_title( - const PurpleRequestFieldGroup *group); - -/** - * Returns a list of all fields in a group. - * - * @param group The group. - * - * @constreturn The list of fields in the group. - */ -GList *purple_request_field_group_get_fields( - const PurpleRequestFieldGroup *group); - -/*@}*/ - -/**************************************************************************/ -/** @name Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a field of the specified type. - * - * @param id The field ID. - * @param text The text label of the field. - * @param type The type of field. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_new(const char *id, const char *text, - PurpleRequestFieldType type); - -/** - * Destroys a field. - * - * @param field The field to destroy. - */ -void purple_request_field_destroy(PurpleRequestField *field); - -/** - * Sets the label text of a field. - * - * @param field The field. - * @param label The text label. - */ -void purple_request_field_set_label(PurpleRequestField *field, const char *label); - -/** - * Sets whether or not a field is visible. - * - * @param field The field. - * @param visible TRUE if visible, or FALSE if not. - */ -void purple_request_field_set_visible(PurpleRequestField *field, gboolean visible); - -/** - * Sets the type hint for the field. - * - * This is optionally used by the UIs to provide such features as - * auto-completion for type hints like "account" and "screenname". - * - * @param field The field. - * @param type_hint The type hint. - */ -void purple_request_field_set_type_hint(PurpleRequestField *field, - const char *type_hint); - -/** - * Sets whether or not a field is required. - * - * @param field The field. - * @param required TRUE if required, or FALSE. - */ -void purple_request_field_set_required(PurpleRequestField *field, - gboolean required); - -/** - * Returns the type of a field. - * - * @param field The field. - * - * @return The field's type. - */ -PurpleRequestFieldType purple_request_field_get_type(const PurpleRequestField *field); - -/** - * Returns the group for the field. - * - * @param field The field. - * - * @return The UI data. - * - * @since 2.6.0 - */ -PurpleRequestFieldGroup *purple_request_field_get_group(const PurpleRequestField *field); - -/** - * Returns the ID of a field. - * - * @param field The field. - * - * @return The ID - */ -const char *purple_request_field_get_id(const PurpleRequestField *field); - -/** - * Returns the label text of a field. - * - * @param field The field. - * - * @return The label text. - */ -const char *purple_request_field_get_label(const PurpleRequestField *field); - -/** - * Returns whether or not a field is visible. - * - * @param field The field. - * - * @return TRUE if the field is visible. FALSE otherwise. - */ -gboolean purple_request_field_is_visible(const PurpleRequestField *field); - -/** - * Returns the field's type hint. - * - * @param field The field. - * - * @return The field's type hint. - */ -const char *purple_request_field_get_type_hint(const PurpleRequestField *field); - -/** - * Returns whether or not a field is required. - * - * @param field The field. - * - * @return TRUE if the field is required, or FALSE. - */ -gboolean purple_request_field_is_required(const PurpleRequestField *field); - -/** - * Returns the ui_data for a field. - * - * @param field The field. - * - * @return The UI data. - * - * @since 2.6.0 - */ -gpointer purple_request_field_get_ui_data(const PurpleRequestField *field); - -/** - * Sets the ui_data for a field. - * - * @param field The field. - * @param ui_data The UI data. - * - * @return The UI data. - * - * @since 2.6.0 - */ -void purple_request_field_set_ui_data(PurpleRequestField *field, - gpointer ui_data); - -/*@}*/ - -/**************************************************************************/ -/** @name String Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a string request field. - * - * @param id The field ID. - * @param text The text label of the field. - * @param default_value The optional default value. - * @param multiline Whether or not this should be a multiline string. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_string_new(const char *id, - const char *text, - const char *default_value, - gboolean multiline); - -/** - * Sets the default value in a string field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_string_set_default_value(PurpleRequestField *field, - const char *default_value); - -/** - * Sets the value in a string field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_string_set_value(PurpleRequestField *field, - const char *value); - -/** - * Sets whether or not a string field is masked - * (commonly used for password fields). - * - * @param field The field. - * @param masked The masked value. - */ -void purple_request_field_string_set_masked(PurpleRequestField *field, - gboolean masked); - -/** - * Sets whether or not a string field is editable. - * - * @param field The field. - * @param editable The editable value. - */ -void purple_request_field_string_set_editable(PurpleRequestField *field, - gboolean editable); - -/** - * Returns the default value in a string field. - * - * @param field The field. - * - * @return The default value. - */ -const char *purple_request_field_string_get_default_value( - const PurpleRequestField *field); - -/** - * Returns the user-entered value in a string field. - * - * @param field The field. - * - * @return The value. - */ -const char *purple_request_field_string_get_value(const PurpleRequestField *field); - -/** - * Returns whether or not a string field is multi-line. - * - * @param field The field. - * - * @return @c TRUE if the field is mulit-line, or @c FALSE otherwise. - */ -gboolean purple_request_field_string_is_multiline(const PurpleRequestField *field); - -/** - * Returns whether or not a string field is masked. - * - * @param field The field. - * - * @return @c TRUE if the field is masked, or @c FALSE otherwise. - */ -gboolean purple_request_field_string_is_masked(const PurpleRequestField *field); - -/** - * Returns whether or not a string field is editable. - * - * @param field The field. - * - * @return @c TRUE if the field is editable, or @c FALSE otherwise. - */ -gboolean purple_request_field_string_is_editable(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Integer Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates an integer field. - * - * @param id The field ID. - * @param text The text label of the field. - * @param default_value The default value. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_int_new(const char *id, - const char *text, - int default_value); - -/** - * Sets the default value in an integer field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_int_set_default_value(PurpleRequestField *field, - int default_value); - -/** - * Sets the value in an integer field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_int_set_value(PurpleRequestField *field, int value); - -/** - * Returns the default value in an integer field. - * - * @param field The field. - * - * @return The default value. - */ -int purple_request_field_int_get_default_value(const PurpleRequestField *field); - -/** - * Returns the user-entered value in an integer field. - * - * @param field The field. - * - * @return The value. - */ -int purple_request_field_int_get_value(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Boolean Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a boolean field. - * - * This is often represented as a checkbox. - * - * @param id The field ID. - * @param text The text label of the field. - * @param default_value The default value. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_bool_new(const char *id, - const char *text, - gboolean default_value); - -/** - * Sets the default value in an boolean field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_bool_set_default_value(PurpleRequestField *field, - gboolean default_value); - -/** - * Sets the value in an boolean field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_bool_set_value(PurpleRequestField *field, - gboolean value); - -/** - * Returns the default value in an boolean field. - * - * @param field The field. - * - * @return The default value. - */ -gboolean purple_request_field_bool_get_default_value( - const PurpleRequestField *field); - -/** - * Returns the user-entered value in an boolean field. - * - * @param field The field. - * - * @return The value. - */ -gboolean purple_request_field_bool_get_value(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Choice Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a multiple choice field. - * - * This is often represented as a group of radio buttons. - * - * @param id The field ID. - * @param text The optional label of the field. - * @param default_value The default choice. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_choice_new(const char *id, - const char *text, - int default_value); - -/** - * Adds a choice to a multiple choice field. - * - * @param field The choice field. - * @param label The choice label. - */ -void purple_request_field_choice_add(PurpleRequestField *field, - const char *label); - -/** - * Sets the default value in an choice field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_choice_set_default_value(PurpleRequestField *field, - int default_value); - -/** - * Sets the value in an choice field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_choice_set_value(PurpleRequestField *field, int value); - -/** - * Returns the default value in an choice field. - * - * @param field The field. - * - * @return The default value. - */ -int purple_request_field_choice_get_default_value(const PurpleRequestField *field); - -/** - * Returns the user-entered value in an choice field. - * - * @param field The field. - * - * @return The value. - */ -int purple_request_field_choice_get_value(const PurpleRequestField *field); - -/** - * Returns a list of labels in a choice field. - * - * @param field The field. - * - * @constreturn The list of labels. - */ -GList *purple_request_field_choice_get_labels(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name List Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a multiple list item field. - * - * @param id The field ID. - * @param text The optional label of the field. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_list_new(const char *id, const char *text); - -/** - * Sets whether or not a list field allows multiple selection. - * - * @param field The list field. - * @param multi_select TRUE if multiple selection is enabled, - * or FALSE otherwise. - */ -void purple_request_field_list_set_multi_select(PurpleRequestField *field, - gboolean multi_select); - -/** - * Returns whether or not a list field allows multiple selection. - * - * @param field The list field. - * - * @return TRUE if multiple selection is enabled, or FALSE otherwise. - */ -gboolean purple_request_field_list_get_multi_select( - const PurpleRequestField *field); - -/** - * Returns the data for a particular item. - * - * @param field The list field. - * @param text The item text. - * - * @return The data associated with the item. - */ -void *purple_request_field_list_get_data(const PurpleRequestField *field, - const char *text); - -/** - * Adds an item to a list field. - * - * @param field The list field. - * @param item The list item. - * @param data The associated data. - */ -void purple_request_field_list_add(PurpleRequestField *field, - const char *item, void *data); - -/** - * Adds a selected item to the list field. - * - * @param field The field. - * @param item The item to add. - */ -void purple_request_field_list_add_selected(PurpleRequestField *field, - const char *item); - -/** - * Clears the list of selected items in a list field. - * - * @param field The field. - */ -void purple_request_field_list_clear_selected(PurpleRequestField *field); - -/** - * Sets a list of selected items in a list field. - * - * @param field The field. - * @param items The list of selected items, which is not modified or freed. - */ -void purple_request_field_list_set_selected(PurpleRequestField *field, - GList *items); - -/** - * Returns whether or not a particular item is selected in a list field. - * - * @param field The field. - * @param item The item. - * - * @return TRUE if the item is selected. FALSE otherwise. - */ -gboolean purple_request_field_list_is_selected(const PurpleRequestField *field, - const char *item); - -/** - * Returns a list of selected items in a list field. - * - * To retrieve the data for each item, use - * purple_request_field_list_get_data(). - * - * @param field The field. - * - * @constreturn The list of selected items. - */ -GList *purple_request_field_list_get_selected( - const PurpleRequestField *field); - -/** - * Returns a list of items in a list field. - * - * @param field The field. - * - * @constreturn The list of items. - */ -GList *purple_request_field_list_get_items(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Label Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a label field. - * - * @param id The field ID. - * @param text The label of the field. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_label_new(const char *id, - const char *text); - -/*@}*/ - -/**************************************************************************/ -/** @name Image Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates an image field. - * - * @param id The field ID. - * @param text The label of the field. - * @param buf The image data. - * @param size The size of the data in @a buffer. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_image_new(const char *id, const char *text, - const char *buf, gsize size); - -/** - * Sets the scale factors of an image field. - * - * @param field The image field. - * @param x The x scale factor. - * @param y The y scale factor. - */ -void purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y); - -/** - * Returns pointer to the image. - * - * @param field The image field. - * - * @return Pointer to the image. - */ -const char *purple_request_field_image_get_buffer(PurpleRequestField *field); - -/** - * Returns size (in bytes) of the image. - * - * @param field The image field. - * - * @return Size of the image. - */ -gsize purple_request_field_image_get_size(PurpleRequestField *field); - -/** - * Returns X scale coefficient of the image. - * - * @param field The image field. - * - * @return X scale coefficient of the image. - */ -unsigned int purple_request_field_image_get_scale_x(PurpleRequestField *field); - -/** - * Returns Y scale coefficient of the image. - * - * @param field The image field. - * - * @return Y scale coefficient of the image. - */ -unsigned int purple_request_field_image_get_scale_y(PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Account Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates an account field. - * - * By default, this field will not show offline accounts. - * - * @param id The field ID. - * @param text The text label of the field. - * @param account The optional default account. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_account_new(const char *id, - const char *text, - PurpleAccount *account); - -/** - * Sets the default account on an account field. - * - * @param field The account field. - * @param default_value The default account. - */ -void purple_request_field_account_set_default_value(PurpleRequestField *field, - PurpleAccount *default_value); - -/** - * Sets the account in an account field. - * - * @param field The account field. - * @param value The account. - */ -void purple_request_field_account_set_value(PurpleRequestField *field, - PurpleAccount *value); - -/** - * Sets whether or not to show all accounts in an account field. - * - * If TRUE, all accounts, online or offline, will be shown. If FALSE, - * only online accounts will be shown. - * - * @param field The account field. - * @param show_all Whether or not to show all accounts. - */ -void purple_request_field_account_set_show_all(PurpleRequestField *field, - gboolean show_all); - -/** - * Sets the account filter function in an account field. - * - * This function will determine which accounts get displayed and which - * don't. - * - * @param field The account field. - * @param filter_func The account filter function. - */ -void purple_request_field_account_set_filter(PurpleRequestField *field, - PurpleFilterAccountFunc filter_func); - -/** - * Returns the default account in an account field. - * - * @param field The field. - * - * @return The default account. - */ -PurpleAccount *purple_request_field_account_get_default_value( - const PurpleRequestField *field); - -/** - * Returns the user-entered account in an account field. - * - * @param field The field. - * - * @return The user-entered account. - */ -PurpleAccount *purple_request_field_account_get_value( - const PurpleRequestField *field); - -/** - * Returns whether or not to show all accounts in an account field. - * - * If TRUE, all accounts, online or offline, will be shown. If FALSE, - * only online accounts will be shown. - * - * @param field The account field. - * @return Whether or not to show all accounts. - */ -gboolean purple_request_field_account_get_show_all( - const PurpleRequestField *field); - -/** - * Returns the account filter function in an account field. - * - * This function will determine which accounts get displayed and which - * don't. - * - * @param field The account field. - * - * @return The account filter function. - */ -PurpleFilterAccountFunc purple_request_field_account_get_filter( - const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Request API */ -/**************************************************************************/ -/*@{*/ - -/** - * Prompts the user for text input. - * - * @param handle The plugin or connection handle. For some - * things this is extremely important. The - * handle is used to programmatically close the request - * dialog when it is no longer needed. For PRPLs this - * is often a pointer to the #PurpleConnection - * instance. For plugins this should be a similar, - * unique memory location. This value is important - * because it allows a request to be closed with - * purple_request_close_with_handle() when, for - * example, you sign offline. If the request is - * not closed it is very - * likely to cause a crash whenever the callback - * handler functions are triggered. - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param default_value The default value. - * @param multiline @c TRUE if the inputted text can span multiple lines. - * @param masked @c TRUE if the inputted text should be masked in some - * way (such as by displaying characters as stars). This - * might be because the input is some kind of password. - * @param hint Optionally suggest how the input box should appear. - * Use "html", for example, to allow the user to enter - * HTML. - * @param ok_text The text for the @c OK button, which may not be @c NULL. - * @param ok_cb The callback for the @c OK button, which may not be @c - * NULL. - * @param cancel_text The text for the @c Cancel button, which may not be @c - * NULL. - * @param cancel_cb The callback for the @c Cancel button, which may be - * @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is. - * @param who The username of the buddy associated with this request, - * or @c NULL if none is. - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_input(void *handle, const char *title, const char *primary, - const char *secondary, const char *default_value, gboolean multiline, - gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/** - * Prompts the user for multiple-choice input. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param default_value The default choice; this should be one of the values - * listed in the varargs. - * @param ok_text The text for the @c OK button, which may not be @c NULL. - * @param ok_cb The callback for the @c OK button, which may not be @c - * NULL. - * @param cancel_text The text for the @c Cancel button, which may not be @c - * NULL. - * @param cancel_cb The callback for the @c Cancel button, or @c NULL to - * do nothing. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is. - * @param who The username of the buddy associated with this request, - * or @c NULL if none is. - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is. - * @param user_data The data to pass to the callback. - * @param ... The choices, which should be pairs of char * - * descriptions and int values, terminated with a - * @c NULL parameter. - * - * @return A UI-specific handle. - */ -void *purple_request_choice(void *handle, const char *title, const char *primary, - const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, ...) G_GNUC_NULL_TERMINATED; - -/** - * va_list version of purple_request_choice(); see its documentation. - */ -void *purple_request_choice_varg(void *handle, const char *title, - const char *primary, const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, va_list choices); - -/** - * Prompts the user for an action. - * - * This is often represented as a dialog with a button for each action. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param default_action The default action, zero-indexed; if the third action - * supplied should be the default, supply 2. - * The should be the action that users are most likely - * to select. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is. - * @param who The username of the buddy associated with this request, - * or @c NULL if none is. - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is. - * @param user_data The data to pass to the callback. - * @param action_count The number of actions. - * @param ... A list of actions. These are pairs of - * arguments. The first of each pair is the - * char * label that appears on the button. It - * should have an underscore before the letter you want - * to use as the accelerator key for the button. The - * second of each pair is the #PurpleRequestActionCb - * function to use when the button is clicked. - * - * @return A UI-specific handle. - */ -void *purple_request_action(void *handle, const char *title, const char *primary, - const char *secondary, int default_action, PurpleAccount *account, - const char *who, PurpleConversation *conv, void *user_data, - size_t action_count, ...); - -/** - * va_list version of purple_request_action(); see its documentation. - */ -void *purple_request_action_varg(void *handle, const char *title, - const char *primary, const char *secondary, int default_action, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, size_t action_count, va_list actions); - -/** - * Displays groups of fields for the user to fill in. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param fields The list of fields. - * @param ok_text The text for the @c OK button, which may not be @c NULL. - * @param ok_cb The callback for the @c OK button, which may not be @c - * NULL. - * @param cancel_text The text for the @c Cancel button, which may not be @c - * NULL. - * @param cancel_cb The callback for the @c Cancel button, which may be - * @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is - * @param who The username of the buddy associated with this request, - * or @c NULL if none is - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_fields(void *handle, const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/** - * Closes a request. - * - * @param type The request type. - * @param uihandle The request UI handle. - */ -void purple_request_close(PurpleRequestType type, void *uihandle); - -/** - * Closes all requests registered with the specified handle. - * - * @param handle The handle, as supplied as the @a handle parameter to one of the - * purple_request_* functions. - * - * @see purple_request_input(). - */ -void purple_request_close_with_handle(void *handle); - -/** - * A wrapper for purple_request_action() that uses @c Yes and @c No buttons. - */ -#define purple_request_yes_no(handle, title, primary, secondary, \ - default_action, account, who, conv, \ - user_data, yes_cb, no_cb) \ - purple_request_action((handle), (title), (primary), (secondary), \ - (default_action), account, who, conv, (user_data), 2, \ - _("_Yes"), (yes_cb), _("_No"), (no_cb)) - -/** - * A wrapper for purple_request_action() that uses @c OK and @c Cancel buttons. - */ -#define purple_request_ok_cancel(handle, title, primary, secondary, \ - default_action, account, who, conv, \ - user_data, ok_cb, cancel_cb) \ - purple_request_action((handle), (title), (primary), (secondary), \ - (default_action), account, who, conv, (user_data), 2, \ - _("_OK"), (ok_cb), _("_Cancel"), (cancel_cb)) - -/** - * A wrapper for purple_request_action() that uses Accept and Cancel buttons. - */ -#define purple_request_accept_cancel(handle, title, primary, secondary, \ - default_action, account, who, conv, \ - user_data, accept_cb, cancel_cb) \ - purple_request_action((handle), (title), (primary), (secondary), \ - (default_action), account, who, conv, (user_data), 2, \ - _("_Accept"), (accept_cb), _("_Cancel"), (cancel_cb)) - -/** - * Displays a file selector request dialog. Returns the selected filename to - * the callback. Can be used for either opening a file or saving a file. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param filename The default filename (may be @c NULL) - * @param savedialog True if this dialog is being used to save a file. - * False if it is being used to open a file. - * @param ok_cb The callback for the @c OK button. - * @param cancel_cb The callback for the @c Cancel button, which may be @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is - * @param who The username of the buddy associated with this request, - * or @c NULL if none is - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_file(void *handle, const char *title, const char *filename, - gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/** - * Displays a folder select dialog. Returns the selected filename to - * the callback. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param dirname The default directory name (may be @c NULL) - * @param ok_cb The callback for the @c OK button. - * @param cancel_cb The callback for the @c Cancel button, which may be @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is - * @param who The username of the buddy associated with this request, - * or @c NULL if none is - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_folder(void *handle, const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used when displaying a - * request. - * - * @param ops The UI operations structure. - */ -void purple_request_set_ui_ops(PurpleRequestUiOps *ops); - -/** - * Returns the UI operations structure to be used when displaying a - * request. - * - * @return The UI operations structure. - */ -PurpleRequestUiOps *purple_request_get_ui_ops(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_REQUEST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,396 +0,0 @@ -/** - * @file roomlist.c Room List API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "account.h" -#include "connection.h" -#include "debug.h" -#include "roomlist.h" -#include "server.h" - - -static PurpleRoomlistUiOps *ops = NULL; - -/**************************************************************************/ -/** @name Room List API */ -/**************************************************************************/ -/*@{*/ - -void purple_roomlist_show_with_account(PurpleAccount *account) -{ - if (ops && ops->show_with_account) - ops->show_with_account(account); -} - -PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) -{ - PurpleRoomlist *list; - - g_return_val_if_fail(account != NULL, NULL); - - list = g_new0(PurpleRoomlist, 1); - list->account = account; - list->rooms = NULL; - list->fields = NULL; - list->ref = 1; - - if (ops && ops->create) - ops->create(list); - - return list; -} - -void purple_roomlist_ref(PurpleRoomlist *list) -{ - g_return_if_fail(list != NULL); - - list->ref++; - purple_debug_misc("roomlist", "reffing list, ref count now %d\n", list->ref); -} - -static void purple_roomlist_room_destroy(PurpleRoomlist *list, PurpleRoomlistRoom *r) -{ - GList *l, *j; - - for (l = list->fields, j = r->fields; l && j; l = l->next, j = j->next) { - PurpleRoomlistField *f = l->data; - if (f->type == PURPLE_ROOMLIST_FIELD_STRING) - g_free(j->data); - } - - g_list_free(r->fields); - g_free(r->name); - g_free(r); -} - -static void purple_roomlist_field_destroy(PurpleRoomlistField *f) -{ - g_free(f->label); - g_free(f->name); - g_free(f); -} - -static void purple_roomlist_destroy(PurpleRoomlist *list) -{ - GList *l; - - purple_debug_misc("roomlist", "destroying list %p\n", list); - - if (ops && ops->destroy) - ops->destroy(list); - - for (l = list->rooms; l; l = l->next) { - PurpleRoomlistRoom *r = l->data; - purple_roomlist_room_destroy(list, r); - } - g_list_free(list->rooms); - - g_list_foreach(list->fields, (GFunc)purple_roomlist_field_destroy, NULL); - g_list_free(list->fields); - - g_free(list); -} - -void purple_roomlist_unref(PurpleRoomlist *list) -{ - g_return_if_fail(list != NULL); - g_return_if_fail(list->ref > 0); - - list->ref--; - - purple_debug_misc("roomlist", "unreffing list, ref count now %d\n", list->ref); - if (list->ref == 0) - purple_roomlist_destroy(list); -} - -void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) -{ - g_return_if_fail(list != NULL); - - list->fields = fields; - - if (ops && ops->set_fields) - ops->set_fields(list, fields); -} - -void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) -{ - g_return_if_fail(list != NULL); - - list->in_progress = in_progress; - - if (ops && ops->in_progress) - ops->in_progress(list, in_progress); -} - -gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) -{ - g_return_val_if_fail(list != NULL, FALSE); - - return list->in_progress; -} - -void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) -{ - g_return_if_fail(list != NULL); - g_return_if_fail(room != NULL); - - list->rooms = g_list_append(list->rooms, room); - - if (ops && ops->add_room) - ops->add_room(list, room); -} - -PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); - - prpl = purple_connection_get_prpl(gc); - - if(prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(prpl_info && prpl_info->roomlist_get_list) - return prpl_info->roomlist_get_list(gc); - - return NULL; -} - -void purple_roomlist_cancel_get_list(PurpleRoomlist *list) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - - gc = purple_account_get_connection(list->account); - - g_return_if_fail(gc != NULL); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(prpl_info && prpl_info->roomlist_cancel) - prpl_info->roomlist_cancel(list); -} - -void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - g_return_if_fail(category != NULL); - g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); - - gc = purple_account_get_connection(list->account); - g_return_if_fail(gc != NULL); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(prpl_info && prpl_info->roomlist_expand_category) - prpl_info->roomlist_expand_category(list, category); -} - -GList * purple_roomlist_get_fields(PurpleRoomlist *list) -{ - return list->fields; -} - -/*@}*/ - -/**************************************************************************/ -/** @name Room API */ -/**************************************************************************/ -/*@{*/ - -PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, - PurpleRoomlistRoom *parent) -{ - PurpleRoomlistRoom *room; - - g_return_val_if_fail(name != NULL, NULL); - - room = g_new0(PurpleRoomlistRoom, 1); - room->type = type; - room->name = g_strdup(name); - room->parent = parent; - - return room; -} - -void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) -{ - PurpleRoomlistField *f; - - g_return_if_fail(list != NULL); - g_return_if_fail(room != NULL); - g_return_if_fail(list->fields != NULL); - - /* If this is the first call for this room, grab the first field in - * the Roomlist's fields. Otherwise, grab the field that is one - * more than the number of fields already present for the room. - * (This works because g_list_nth_data() is zero-indexed and - * g_list_length() is one-indexed.) */ - if (!room->fields) - f = list->fields->data; - else - f = g_list_nth_data(list->fields, g_list_length(room->fields)); - - g_return_if_fail(f != NULL); - - switch(f->type) { - case PURPLE_ROOMLIST_FIELD_STRING: - room->fields = g_list_append(room->fields, g_strdup(field)); - break; - case PURPLE_ROOMLIST_FIELD_BOOL: - case PURPLE_ROOMLIST_FIELD_INT: - room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); - break; - } -} - -void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) -{ - GHashTable *components; - GList *l, *j; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - g_return_if_fail(room != NULL); - - gc = purple_account_get_connection(list->account); - if (!gc) - return; - - components = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_replace(components, "name", room->name); - for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) { - PurpleRoomlistField *f = l->data; - - g_hash_table_replace(components, f->name, j->data); - } - - serv_join_chat(gc, components); - - g_hash_table_destroy(components); -} - -PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room) -{ - return room->type; -} - -const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room) -{ - return room->name; -} - -PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) -{ - return room->parent; -} - -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) -{ - return room->fields; -} - -/*@}*/ - -/**************************************************************************/ -/** @name Room Field API */ -/**************************************************************************/ -/*@{*/ - -PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, - const gchar *label, const gchar *name, - gboolean hidden) -{ - PurpleRoomlistField *f; - - g_return_val_if_fail(label != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - f = g_new0(PurpleRoomlistField, 1); - - f->type = type; - f->label = g_strdup(label); - f->name = g_strdup(name); - f->hidden = hidden; - - return f; -} - -PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field) -{ - return field->type; -} - -const char * purple_roomlist_field_get_label(PurpleRoomlistField *field) -{ - return field->label; -} - -gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field) -{ - return field->hidden; -} - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - - -void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) -{ - ops = ui_ops; -} - -PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) -{ - return ops; -} - -/*@}*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/roomlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ -/** - * @file roomlist.h Room List API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_ROOMLIST_H_ -#define _PURPLE_ROOMLIST_H_ - -typedef struct _PurpleRoomlist PurpleRoomlist; -typedef struct _PurpleRoomlistRoom PurpleRoomlistRoom; -typedef struct _PurpleRoomlistField PurpleRoomlistField; -/** @copydoc _PurpleRoomlistUiOps */ -typedef struct _PurpleRoomlistUiOps PurpleRoomlistUiOps; - -/** - * The types of rooms. - * - * These are ORable flags. - */ -typedef enum -{ - PURPLE_ROOMLIST_ROOMTYPE_CATEGORY = 0x01, /**< It's a category, but not a room you can join. */ - PURPLE_ROOMLIST_ROOMTYPE_ROOM = 0x02 /**< It's a room, like the kind you can join. */ - -} PurpleRoomlistRoomType; - -/** - * The types of fields. - */ -typedef enum -{ - PURPLE_ROOMLIST_FIELD_BOOL, - PURPLE_ROOMLIST_FIELD_INT, - PURPLE_ROOMLIST_FIELD_STRING /**< We do a g_strdup on the passed value if it's this type. */ - -} PurpleRoomlistFieldType; - -#include "account.h" -#include "glib.h" - -/**************************************************************************/ -/** Data Structures */ -/**************************************************************************/ - -/** - * Represents a list of rooms for a given connection on a given protocol. - */ -struct _PurpleRoomlist { - PurpleAccount *account; /**< The account this list belongs to. */ - GList *fields; /**< The fields. */ - GList *rooms; /**< The list of rooms. */ - gboolean in_progress; /**< The listing is in progress. */ - gpointer ui_data; /**< UI private data. */ - gpointer proto_data; /** Prpl private data. */ - guint ref; /**< The reference count. */ -}; - -/** - * Represents a room. - */ -struct _PurpleRoomlistRoom { - PurpleRoomlistRoomType type; /**< The type of room. */ - gchar *name; /**< The name of the room. */ - GList *fields; /**< Other fields. */ - PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ - gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ -}; - -/** - * A field a room might have. - */ -struct _PurpleRoomlistField { - PurpleRoomlistFieldType type; /**< The type of field. */ - gchar *label; /**< The i18n user displayed name of the field. */ - gchar *name; /**< The internal name of the field. */ - gboolean hidden; /**< Hidden? */ -}; - -/** - * The room list ops to be filled out by the UI. - */ -struct _PurpleRoomlistUiOps { - void (*show_with_account)(PurpleAccount *account); /**< Force the ui to pop up a dialog and get the list */ - void (*create)(PurpleRoomlist *list); /**< A new list was created. */ - void (*set_fields)(PurpleRoomlist *list, GList *fields); /**< Sets the columns. */ - void (*add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room); /**< Add a room to the list. */ - void (*in_progress)(PurpleRoomlist *list, gboolean flag); /**< Are we fetching stuff still? */ - void (*destroy)(PurpleRoomlist *list); /**< We're destroying list. */ - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Room List API */ -/**************************************************************************/ -/*@{*/ - -/** - * This is used to get the room list on an account, asking the UI - * to pop up a dialog with the specified account already selected, - * and pretend the user clicked the get list button. - * While we're pretending, predend I didn't say anything about dialogs - * or buttons, since this is the core. - * - * @param account The account to get the list on. - */ -void purple_roomlist_show_with_account(PurpleAccount *account); - -/** - * Returns a newly created room list object. - * - * It has an initial reference count of 1. - * - * @param account The account that's listing rooms. - * @return The new room list handle. - */ -PurpleRoomlist *purple_roomlist_new(PurpleAccount *account); - -/** - * Increases the reference count on the room list. - * - * @param list The object to ref. - */ -void purple_roomlist_ref(PurpleRoomlist *list); - -/** - * Decreases the reference count on the room list. - * - * The room list will be destroyed when this reaches 0. - * - * @param list The room list object to unref and possibly - * destroy. - */ -void purple_roomlist_unref(PurpleRoomlist *list); - -/** - * Set the different field types and their names for this protocol. - * - * This must be called before purple_roomlist_room_add(). - * - * @param list The room list. - * @param fields A GList of PurpleRoomlistField's. UI's are encouraged - * to default to displaying them in the order given. - */ -void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields); - -/** - * Set the "in progress" state of the room list. - * - * The UI is encouraged to somehow hint to the user - * whether or not we're busy downloading a room list or not. - * - * @param list The room list. - * @param in_progress We're downloading it, or we're not. - */ -void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress); - -/** - * Gets the "in progress" state of the room list. - * - * The UI is encouraged to somehow hint to the user - * whether or not we're busy downloading a room list or not. - * - * @param list The room list. - * @return True if we're downloading it, or false if we're not. - */ -gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list); - -/** - * Adds a room to the list of them. - * - * @param list The room list. - * @param room The room to add to the list. The GList of fields must be in the same - order as was given in purple_roomlist_set_fields(). -*/ -void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room); - -/** - * Returns a PurpleRoomlist structure from the prpl, and - * instructs the prpl to start fetching the list. - * - * @param gc The PurpleConnection to have get a list. - * - * @return A PurpleRoomlist* or @c NULL if the protocol - * doesn't support that. - */ -PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc); - -/** - * Tells the prpl to stop fetching the list. - * If this is possible and done, the prpl will - * call set_in_progress with @c FALSE and possibly - * unref the list if it took a reference. - * - * @param list The room list to cancel a get_list on. - */ -void purple_roomlist_cancel_get_list(PurpleRoomlist *list); - -/** - * Tells the prpl that a category was expanded. - * - * On some protocols, the rooms in the category - * won't be fetched until this is called. - * - * @param list The room list. - * @param category The category that was expanded. The expression - * (category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) - * must be true. - */ -void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); - -/** - * Get the list of fields for a roomlist. - * - * @param roomlist The roomlist, which must not be @c NULL. - * @constreturn A list of fields - * @since 2.4.0 - */ -GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); - -/*@}*/ - -/**************************************************************************/ -/** @name Room API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new room, to be added to the list. - * - * @param type The type of room. - * @param name The name of the room. - * @param parent The room's parent, if any. - * - * @return A new room. - */ -PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, - PurpleRoomlistRoom *parent); - -/** - * Adds a field to a room. - * - * @param list The room list the room belongs to. - * @param room The room. - * @param field The field to append. Strings get g_strdup'd internally. - */ -void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field); - -/** - * Join a room, given a PurpleRoomlistRoom and it's associated PurpleRoomlist. - * - * @param list The room list the room belongs to. - * @param room The room to join. - */ -void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room); - -/** - * Get the type of a room. - * @param room The room, which must not be @c NULL. - * @return The type of the room. - * @since 2.4.0 - */ -PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); - -/** - * Get the name of a room. - * @param room The room, which must not be @c NULL. - * @return The name of the room. - * @since 2.4.0 - */ -const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); - -/** - * Get the parent of a room. - * @param room The room, which must not be @c NULL. - * @return The parent of the room, which can be @c NULL. - * @since 2.4.0 - */ -PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); - -/** - * Get the list of fields for a room. - * - * @param room The room, which must not be @c NULL. - * @constreturn A list of fields - * @since 2.4.0 - */ -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room); - -/*@}*/ - -/**************************************************************************/ -/** @name Room Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new field. - * - * @param type The type of the field. - * @param label The i18n'ed, user displayable name. - * @param name The internal name of the field. - * @param hidden Hide the field. - * - * @return A new PurpleRoomlistField, ready to be added to a GList and passed to - * purple_roomlist_set_fields(). - */ -PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, - const gchar *label, const gchar *name, - gboolean hidden); - -/** - * Get the type of a field. - * - * @param field A PurpleRoomlistField, which must not be @c NULL. - * - * @return The type of the field. - * @since 2.4.0 - */ -PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field); - -/** - * Get the label of a field. - * - * @param field A PurpleRoomlistField, which must not be @c NULL. - * - * @return The label of the field. - * @since 2.4.0 - */ -const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); - -/** - * Check whether a roomlist-field is hidden. - * @param field A PurpleRoomlistField, which must not be @c NULL. - * - * @return @c TRUE if the field is hidden, @c FALSE otherwise. - * @since 2.4.0 - */ -gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used in all purple room lists. - * - * @param ops The UI operations structure. - */ -void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops); - -/** - * Returns the purple window UI operations structure to be used in - * new windows. - * - * @return A filled-out PurpleRoomlistUiOps structure. - */ -PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_ROOMLIST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1261 +0,0 @@ -/** - * @file savedstatuses.c Saved Status API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "debug.h" -#include "idle.h" -#include "notify.h" -#include "savedstatuses.h" -#include "dbus-maybe.h" -#include "request.h" -#include "status.h" -#include "util.h" -#include "xmlnode.h" - -/** - * The maximum number of transient statuses to save. This - * is used during the shutdown process to clean out old - * transient statuses. - */ -#define MAX_TRANSIENTS 5 - -/** - * The default message to use when the user becomes auto-away. - */ -#define DEFAULT_AUTOAWAY_MESSAGE _("I'm not here right now") - -/** - * The information stores a snap-shot of the statuses of all - * your accounts. Basically these are your saved away messages. - * There is an overall status and message that applies to - * all your accounts, and then each individual account can - * optionally have a different custom status and message. - * - * The changes to status.xml caused by the new status API - * are fully backward compatible. The new status API just - * adds the optional sub-statuses to the XML file. - */ -struct _PurpleSavedStatus -{ - char *title; - PurpleStatusPrimitive type; - char *message; - - /** The timestamp when this saved status was created. This must be unique. */ - time_t creation_time; - - time_t lastused; - - unsigned int usage_count; - - GList *substatuses; /**< A list of PurpleSavedStatusSub's. */ -}; - -/* - * TODO: If a PurpleStatusType is deleted, need to also delete any - * associated PurpleSavedStatusSub's? - */ -struct _PurpleSavedStatusSub -{ - PurpleAccount *account; - const PurpleStatusType *type; - char *message; -}; - -static GList *saved_statuses = NULL; -static guint save_timer = 0; -static gboolean statuses_loaded = FALSE; - -/* - * This hash table keeps track of which timestamps we've - * used so that we don't have two saved statuses with the - * same 'creation_time' timestamp. The 'created' timestamp - * is used as a unique identifier. - * - * So the key in this hash table is the creation_time and - * the value is a pointer to the PurpleSavedStatus. - */ -static GHashTable *creation_times; - -static void schedule_save(void); - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static void -free_saved_status_sub(PurpleSavedStatusSub *substatus) -{ - g_return_if_fail(substatus != NULL); - - g_free(substatus->message); - purple_request_close_with_handle(substatus); - PURPLE_DBUS_UNREGISTER_POINTER(substatus); - g_free(substatus); -} - -static void -free_saved_status(PurpleSavedStatus *status) -{ - g_return_if_fail(status != NULL); - - g_free(status->title); - g_free(status->message); - - while (status->substatuses != NULL) - { - PurpleSavedStatusSub *substatus = status->substatuses->data; - status->substatuses = g_list_remove(status->substatuses, substatus); - free_saved_status_sub(substatus); - } - purple_request_close_with_handle(status); - PURPLE_DBUS_UNREGISTER_POINTER(status); - g_free(status); -} - -/* - * Set the timestamp for when this saved status was created, and - * make sure it is unique. - */ -static void -set_creation_time(PurpleSavedStatus *status, time_t creation_time) -{ - g_return_if_fail(status != NULL); - - /* Avoid using 0 because it's an invalid hash key */ - status->creation_time = creation_time != 0 ? creation_time : 1; - - while (g_hash_table_lookup(creation_times, (gconstpointer)status->creation_time) != NULL) - status->creation_time++; - - g_hash_table_insert(creation_times, - (gpointer)status->creation_time, - status); -} - -/** - * A magic number is calculated for each status, and then the - * statuses are ordered by the magic number. The magic number - * is the date the status was last used offset by one day for - * each time the status has been used (but only by 10 days at - * the most). - * - * The goal is to have recently used statuses at the top of - * the list, but to also keep frequently used statuses near - * the top. - */ -static gint -saved_statuses_sort_func(gconstpointer a, gconstpointer b) -{ - const PurpleSavedStatus *saved_status_a = a; - const PurpleSavedStatus *saved_status_b = b; - time_t time_a = saved_status_a->lastused + - (MIN(saved_status_a->usage_count, 10) * 86400); - time_t time_b = saved_status_b->lastused + - (MIN(saved_status_b->usage_count, 10) * 86400); - if (time_a > time_b) - return -1; - if (time_a < time_b) - return 1; - return 0; -} - -/** - * Transient statuses are added and removed automatically by - * Purple. If they're not used for a certain length of time then - * they'll expire and be automatically removed. This function - * does the expiration. - */ -static void -remove_old_transient_statuses(void) -{ - GList *l, *next; - PurpleSavedStatus *saved_status, *current_status; - int count; - time_t creation_time; - - current_status = purple_savedstatus_get_current(); - - /* - * Iterate through the list of saved statuses. Delete all - * transient statuses except for the first MAX_TRANSIENTS - * (remember, the saved statuses are already sorted by popularity). - */ - count = 0; - for (l = saved_statuses; l != NULL; l = next) - { - next = l->next; - saved_status = l->data; - if (purple_savedstatus_is_transient(saved_status)) - { - if (count == MAX_TRANSIENTS) - { - if (saved_status != current_status) - { - saved_statuses = g_list_remove(saved_statuses, saved_status); - creation_time = purple_savedstatus_get_creation_time(saved_status); - g_hash_table_remove(creation_times, (gconstpointer)creation_time); - free_saved_status(saved_status); - } - } - else - count++; - } - } - - if (count == MAX_TRANSIENTS) - schedule_save(); -} - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static xmlnode * -substatus_to_xmlnode(PurpleSavedStatusSub *substatus) -{ - xmlnode *node, *child; - - node = xmlnode_new("substatus"); - - child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(substatus->account)); - xmlnode_insert_data(child, - purple_normalize(substatus->account, - purple_account_get_username(substatus->account)), -1); - - child = xmlnode_new_child(node, "state"); - xmlnode_insert_data(child, purple_status_type_get_id(substatus->type), -1); - - if (substatus->message != NULL) - { - child = xmlnode_new_child(node, "message"); - xmlnode_insert_data(child, substatus->message, -1); - } - - return node; -} - -static xmlnode * -status_to_xmlnode(PurpleSavedStatus *status) -{ - xmlnode *node, *child; - char buf[21]; - GList *cur; - - node = xmlnode_new("status"); - if (status->title != NULL) - { - xmlnode_set_attrib(node, "name", status->title); - } - else - { - /* - * Purple 1.5.0 and earlier require a name to be set, so we - * do this little hack to maintain backward compatability - * in the status.xml file. Eventually this should be removed - * and we should determine if a status is transient by - * whether the "name" attribute is set to something or if - * it does not exist at all. - */ - xmlnode_set_attrib(node, "name", "Auto-Cached"); - xmlnode_set_attrib(node, "transient", "true"); - } - - g_snprintf(buf, sizeof(buf), "%lu", status->creation_time); - xmlnode_set_attrib(node, "created", buf); - - g_snprintf(buf, sizeof(buf), "%lu", status->lastused); - xmlnode_set_attrib(node, "lastused", buf); - - g_snprintf(buf, sizeof(buf), "%u", status->usage_count); - xmlnode_set_attrib(node, "usage_count", buf); - - child = xmlnode_new_child(node, "state"); - xmlnode_insert_data(child, purple_primitive_get_id_from_type(status->type), -1); - - if (status->message != NULL) - { - child = xmlnode_new_child(node, "message"); - xmlnode_insert_data(child, status->message, -1); - } - - for (cur = status->substatuses; cur != NULL; cur = cur->next) - { - child = substatus_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static xmlnode * -statuses_to_xmlnode(void) -{ - xmlnode *node, *child; - GList *cur; - - node = xmlnode_new("statuses"); - xmlnode_set_attrib(node, "version", "1.0"); - - for (cur = saved_statuses; cur != NULL; cur = cur->next) - { - child = status_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static void -sync_statuses(void) -{ - xmlnode *node; - char *data; - - if (!statuses_loaded) - { - purple_debug_error("status", "Attempted to save statuses before they " - "were read!\n"); - return; - } - - node = statuses_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("status.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_statuses(); - save_timer = 0; - return FALSE; -} - -static void -schedule_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static PurpleSavedStatusSub * -parse_substatus(xmlnode *substatus) -{ - PurpleSavedStatusSub *ret; - xmlnode *node; - char *data; - - ret = g_new0(PurpleSavedStatusSub, 1); - - /* Read the account */ - node = xmlnode_get_child(substatus, "account"); - if (node != NULL) - { - char *acct_name; - const char *protocol; - acct_name = xmlnode_get_data(node); - protocol = xmlnode_get_attrib(node, "protocol"); - protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ - if ((acct_name != NULL) && (protocol != NULL)) - ret->account = purple_accounts_find(acct_name, protocol); - g_free(acct_name); - } - - if (ret->account == NULL) - { - g_free(ret); - return NULL; - } - - /* Read the state */ - node = xmlnode_get_child(substatus, "state"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->type = purple_status_type_find_with_id( - ret->account->status_types, data); - g_free(data); - } - - if (ret->type == NULL) - { - g_free(ret); - return NULL; - } - - /* Read the message */ - node = xmlnode_get_child(substatus, "message"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->message = data; - } - - PURPLE_DBUS_REGISTER_POINTER(ret, PurpleSavedStatusSub); - return ret; -} - -/** - * Parse a saved status and add it to the saved_statuses linked list. - * - * Here's an example of the XML for a saved status: - * - * away - * I like the way that they walk - * And it's chill to hear them talk - * And I can always make them smile - * From White Castle to the Nile - * - * markdoliner - * available - * The ladies man is here to answer your queries. - * - * - * giantgraypanda - * away - * A.C. ain't in charge no more. - * - * - * - * I know. Moving, huh? - */ -static PurpleSavedStatus * -parse_status(xmlnode *status) -{ - PurpleSavedStatus *ret; - xmlnode *node; - const char *attrib; - char *data; - int i; - - ret = g_new0(PurpleSavedStatus, 1); - - attrib = xmlnode_get_attrib(status, "transient"); - if (!purple_strequal(attrib, "true")) - { - /* Read the title */ - attrib = xmlnode_get_attrib(status, "name"); - ret->title = g_strdup(attrib); - } - - if (ret->title != NULL) - { - /* Ensure the title is unique */ - i = 2; - while (purple_savedstatus_find(ret->title) != NULL) - { - g_free(ret->title); - ret->title = g_strdup_printf("%s %d", attrib, i); - i++; - } - } - - /* Read the creation time */ - attrib = xmlnode_get_attrib(status, "created"); - set_creation_time(ret, (attrib != NULL ? atol(attrib) : 0)); - - /* Read the last used time */ - attrib = xmlnode_get_attrib(status, "lastused"); - ret->lastused = (attrib != NULL ? atol(attrib) : 0); - - /* Read the usage count */ - attrib = xmlnode_get_attrib(status, "usage_count"); - ret->usage_count = (attrib != NULL ? atol(attrib) : 0); - - /* Read the primitive status type */ - node = xmlnode_get_child(status, "state"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->type = purple_primitive_get_type_from_id(data); - g_free(data); - } - - /* Read the message */ - node = xmlnode_get_child(status, "message"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->message = data; - } - - /* Read substatuses */ - for (node = xmlnode_get_child(status, "substatus"); node != NULL; - node = xmlnode_get_next_twin(node)) - { - PurpleSavedStatusSub *new; - new = parse_substatus(node); - if (new != NULL) - ret->substatuses = g_list_prepend(ret->substatuses, new); - } - - PURPLE_DBUS_REGISTER_POINTER(ret, PurpleSavedStatus); - return ret; -} - -/** - * Read the saved statuses from a file in the Purple user dir. - * - * @return TRUE on success, FALSE on failure (if the file can not - * be opened, or if it contains invalid XML). - */ -static void -load_statuses(void) -{ - xmlnode *statuses, *status; - - statuses_loaded = TRUE; - - statuses = purple_util_read_xml_from_file("status.xml", _("saved statuses")); - - if (statuses == NULL) - return; - - for (status = xmlnode_get_child(statuses, "status"); status != NULL; - status = xmlnode_get_next_twin(status)) - { - PurpleSavedStatus *new; - new = parse_status(status); - saved_statuses = g_list_prepend(saved_statuses, new); - } - saved_statuses = g_list_sort(saved_statuses, saved_statuses_sort_func); - - xmlnode_free(statuses); -} - - -/************************************************************************** -* Saved status API -**************************************************************************/ -PurpleSavedStatus * -purple_savedstatus_new(const char *title, PurpleStatusPrimitive type) -{ - PurpleSavedStatus *status; - - /* Make sure we don't already have a saved status with this title. */ - if (title != NULL) - g_return_val_if_fail(purple_savedstatus_find(title) == NULL, NULL); - - status = g_new0(PurpleSavedStatus, 1); - PURPLE_DBUS_REGISTER_POINTER(status, PurpleSavedStatus); - status->title = g_strdup(title); - status->type = type; - set_creation_time(status, time(NULL)); - - saved_statuses = g_list_insert_sorted(saved_statuses, status, saved_statuses_sort_func); - - schedule_save(); - - purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-added", - status); - - return status; -} - -void -purple_savedstatus_set_title(PurpleSavedStatus *status, const char *title) -{ - g_return_if_fail(status != NULL); - - /* Make sure we don't already have a saved status with this title. */ - g_return_if_fail(purple_savedstatus_find(title) == NULL); - - g_free(status->title); - status->title = g_strdup(title); - - schedule_save(); - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", status); -} - -void -purple_savedstatus_set_type(PurpleSavedStatus *status, PurpleStatusPrimitive type) -{ - g_return_if_fail(status != NULL); - - status->type = type; - - schedule_save(); - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", status); -} - -void -purple_savedstatus_set_message(PurpleSavedStatus *status, const char *message) -{ - g_return_if_fail(status != NULL); - - g_free(status->message); - if ((message != NULL) && (*message == '\0')) - status->message = NULL; - else - status->message = g_strdup(message); - - schedule_save(); - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", status); -} - -void -purple_savedstatus_set_substatus(PurpleSavedStatus *saved_status, - const PurpleAccount *account, - const PurpleStatusType *type, - const char *message) -{ - PurpleSavedStatusSub *substatus; - - g_return_if_fail(saved_status != NULL); - g_return_if_fail(account != NULL); - g_return_if_fail(type != NULL); - - /* Find an existing substatus or create a new one */ - substatus = purple_savedstatus_get_substatus(saved_status, account); - if (substatus == NULL) - { - substatus = g_new0(PurpleSavedStatusSub, 1); - PURPLE_DBUS_REGISTER_POINTER(substatus, PurpleSavedStatusSub); - substatus->account = (PurpleAccount *)account; - saved_status->substatuses = g_list_prepend(saved_status->substatuses, substatus); - } - - substatus->type = type; - g_free(substatus->message); - substatus->message = g_strdup(message); - - schedule_save(); - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", saved_status); -} - -void -purple_savedstatus_unset_substatus(PurpleSavedStatus *saved_status, - const PurpleAccount *account) -{ - GList *iter; - PurpleSavedStatusSub *substatus; - - g_return_if_fail(saved_status != NULL); - g_return_if_fail(account != NULL); - - for (iter = saved_status->substatuses; iter != NULL; iter = iter->next) - { - substatus = iter->data; - if (substatus->account == account) - { - saved_status->substatuses = g_list_delete_link(saved_status->substatuses, iter); - g_free(substatus->message); - g_free(substatus); - return; - } - } - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", saved_status); -} - -/* - * This gets called when an account is deleted. We iterate through - * all of our saved statuses and delete any substatuses that may - * exist for this account. - */ -static void -purple_savedstatus_unset_all_substatuses(const PurpleAccount *account, - gpointer user_data) -{ - GList *iter; - PurpleSavedStatus *status; - - g_return_if_fail(account != NULL); - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - purple_savedstatus_unset_substatus(status, account); - } -} - -void -purple_savedstatus_delete_by_status(PurpleSavedStatus *status) -{ - time_t creation_time, current, idleaway; - - g_return_if_fail(status != NULL); - - saved_statuses = g_list_remove(saved_statuses, status); - creation_time = purple_savedstatus_get_creation_time(status); - g_hash_table_remove(creation_times, (gconstpointer)creation_time); - free_saved_status(status); - - schedule_save(); - - /* - * If we just deleted our current status or our idleaway status, - * then set the appropriate pref back to 0. - */ - current = purple_prefs_get_int("/purple/savedstatus/default"); - if (current == creation_time) - purple_prefs_set_int("/purple/savedstatus/default", 0); - - idleaway = purple_prefs_get_int("/purple/savedstatus/idleaway"); - if (idleaway == creation_time) - purple_prefs_set_int("/purple/savedstatus/idleaway", 0); - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-deleted", status); -} - -gboolean -purple_savedstatus_delete(const char *title) -{ - PurpleSavedStatus *status; - - status = purple_savedstatus_find(title); - - if (status == NULL) - return FALSE; - - if (purple_savedstatus_get_current() == status) - return FALSE; - - purple_savedstatus_delete_by_status(status); - - return TRUE; -} - -GList * -purple_savedstatuses_get_all(void) -{ - return saved_statuses; -} - -GList * -purple_savedstatuses_get_popular(unsigned int how_many) -{ - GList *popular = NULL; - GList *cur; - unsigned int i; - PurpleSavedStatus *next; - - /* Copy 'how_many' elements to a new list. If 'how_many' is 0, then copy all of 'em. */ - if (how_many == 0) - how_many = (unsigned int) -1; - - i = 0; - cur = saved_statuses; - while ((i < how_many) && (cur != NULL)) - { - next = cur->data; - if ((!purple_savedstatus_is_transient(next) - || purple_savedstatus_get_message(next) != NULL)) - { - popular = g_list_prepend(popular, next); - i++; - } - cur = cur->next; - } - - popular = g_list_reverse(popular); - - return popular; -} - -PurpleSavedStatus * -purple_savedstatus_get_current(void) -{ - if (purple_savedstatus_is_idleaway()) - return purple_savedstatus_get_idleaway(); - else - return purple_savedstatus_get_default(); -} - -PurpleSavedStatus * -purple_savedstatus_get_default() -{ - time_t creation_time; - PurpleSavedStatus *saved_status = NULL; - - creation_time = purple_prefs_get_int("/purple/savedstatus/default"); - - if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); - - if (saved_status == NULL) - { - /* - * We don't have a current saved status! This is either a new - * Purple user or someone upgrading from Purple 1.5.0 or older, or - * possibly someone who deleted the status they were currently - * using? In any case, add a default status. - */ - saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); - purple_prefs_set_int("/purple/savedstatus/default", - purple_savedstatus_get_creation_time(saved_status)); - } - - return saved_status; -} - -PurpleSavedStatus * -purple_savedstatus_get_idleaway() -{ - time_t creation_time; - PurpleSavedStatus *saved_status = NULL; - - creation_time = purple_prefs_get_int("/purple/savedstatus/idleaway"); - - if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); - - if (saved_status == NULL) - { - /* We don't have a specified "idle" status! Weird. */ - saved_status = purple_savedstatus_find_transient_by_type_and_message( - PURPLE_STATUS_AWAY, DEFAULT_AUTOAWAY_MESSAGE); - - if (saved_status == NULL) - { - saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY); - purple_savedstatus_set_message(saved_status, DEFAULT_AUTOAWAY_MESSAGE); - purple_prefs_set_int("/purple/savedstatus/idleaway", - purple_savedstatus_get_creation_time(saved_status)); - } - } - - return saved_status; -} - -gboolean -purple_savedstatus_is_idleaway() -{ - return purple_prefs_get_bool("/purple/savedstatus/isidleaway"); -} - -void -purple_savedstatus_set_idleaway(gboolean idleaway) -{ - GList *accounts, *node; - PurpleSavedStatus *old, *saved_status; - - if (purple_savedstatus_is_idleaway() == idleaway) - /* Don't need to do anything */ - return; - - old = purple_savedstatus_get_current(); - saved_status = idleaway ? purple_savedstatus_get_idleaway() - : purple_savedstatus_get_default(); - purple_prefs_set_bool("/purple/savedstatus/isidleaway", idleaway); - - /* Changing our status makes us un-idle */ - if (!idleaway) - purple_idle_touch(); - - if (idleaway && (purple_savedstatus_get_type(old) != PURPLE_STATUS_AVAILABLE)) - /* Our global status is already "away," so don't change anything */ - return; - - accounts = purple_accounts_get_all_active(); - for (node = accounts; node != NULL; node = node->next) - { - PurpleAccount *account; - PurplePresence *presence; - PurpleStatus *status; - - account = node->data; - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - - if (!idleaway || purple_status_is_available(status)) - purple_savedstatus_activate_for_account(saved_status, account); - } - - g_list_free(accounts); - - purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed", - saved_status, old); -} - -PurpleSavedStatus * -purple_savedstatus_get_startup() -{ - time_t creation_time; - PurpleSavedStatus *saved_status = NULL; - - creation_time = purple_prefs_get_int("/purple/savedstatus/startup"); - - if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); - - if (saved_status == NULL) - { - /* - * We don't have a status to apply. - * This may be the first login, or the user wants to - * restore the "current" status. - */ - saved_status = purple_savedstatus_get_current(); - } - - return saved_status; -} - - -PurpleSavedStatus * -purple_savedstatus_find(const char *title) -{ - GList *iter; - PurpleSavedStatus *status; - - g_return_val_if_fail(title != NULL, NULL); - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - if (purple_strequal(status->title, title)) - return status; - } - - return NULL; -} - -PurpleSavedStatus * -purple_savedstatus_find_by_creation_time(time_t creation_time) -{ - GList *iter; - PurpleSavedStatus *status; - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - if (status->creation_time == creation_time) - return status; - } - - return NULL; -} - -PurpleSavedStatus * -purple_savedstatus_find_transient_by_type_and_message(PurpleStatusPrimitive type, - const char *message) -{ - GList *iter; - PurpleSavedStatus *status; - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - if ((status->type == type) && purple_savedstatus_is_transient(status) && - !purple_savedstatus_has_substatuses(status) && - purple_strequal(status->message, message)) - { - return status; - } - } - - return NULL; -} - -gboolean -purple_savedstatus_is_transient(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, TRUE); - - return (saved_status->title == NULL); -} - -const char * -purple_savedstatus_get_title(const PurpleSavedStatus *saved_status) -{ - const char *message; - - g_return_val_if_fail(saved_status != NULL, NULL); - - /* If we have a title then return it */ - if (saved_status->title != NULL) - return saved_status->title; - - /* Otherwise, this is a transient status and we make up a title on the fly */ - message = purple_savedstatus_get_message(saved_status); - - if ((message == NULL) || (*message == '\0')) - { - PurpleStatusPrimitive primitive; - primitive = purple_savedstatus_get_type(saved_status); - return purple_primitive_get_name_from_type(primitive); - } - else - { - char *stripped; - static char buf[64]; - stripped = purple_markup_strip_html(message); - purple_util_chrreplace(stripped, '\n', ' '); - strncpy(buf, stripped, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; - if ((strlen(stripped) + 1) > sizeof(buf)) - { - /* Truncate and ellipsize */ - char *tmp = g_utf8_find_prev_char(buf, &buf[sizeof(buf) - 4]); - strcpy(tmp, "..."); - } - g_free(stripped); - return buf; - } -} - -PurpleStatusPrimitive -purple_savedstatus_get_type(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, PURPLE_STATUS_OFFLINE); - - return saved_status->type; -} - -const char * -purple_savedstatus_get_message(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, NULL); - - return saved_status->message; -} - -time_t -purple_savedstatus_get_creation_time(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, 0); - - return saved_status->creation_time; -} - -gboolean -purple_savedstatus_has_substatuses(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, FALSE); - - return (saved_status->substatuses != NULL); -} - -PurpleSavedStatusSub * -purple_savedstatus_get_substatus(const PurpleSavedStatus *saved_status, - const PurpleAccount *account) -{ - GList *iter; - PurpleSavedStatusSub *substatus; - - g_return_val_if_fail(saved_status != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - for (iter = saved_status->substatuses; iter != NULL; iter = iter->next) - { - substatus = iter->data; - if (substatus->account == account) - return substatus; - } - - return NULL; -} - -const PurpleStatusType * -purple_savedstatus_substatus_get_type(const PurpleSavedStatusSub *substatus) -{ - g_return_val_if_fail(substatus != NULL, NULL); - - return substatus->type; -} - -const char * -purple_savedstatus_substatus_get_message(const PurpleSavedStatusSub *substatus) -{ - g_return_val_if_fail(substatus != NULL, NULL); - - return substatus->message; -} - -void -purple_savedstatus_activate(PurpleSavedStatus *saved_status) -{ - GList *accounts, *node; - PurpleSavedStatus *old = purple_savedstatus_get_current(); - - g_return_if_fail(saved_status != NULL); - - /* Make sure our list of saved statuses remains sorted */ - saved_status->lastused = time(NULL); - saved_status->usage_count++; - saved_statuses = g_list_remove(saved_statuses, saved_status); - saved_statuses = g_list_insert_sorted(saved_statuses, saved_status, saved_statuses_sort_func); - purple_prefs_set_int("/purple/savedstatus/default", - purple_savedstatus_get_creation_time(saved_status)); - - accounts = purple_accounts_get_all_active(); - for (node = accounts; node != NULL; node = node->next) - { - PurpleAccount *account; - - account = node->data; - - purple_savedstatus_activate_for_account(saved_status, account); - } - - g_list_free(accounts); - - if (purple_savedstatus_is_idleaway()) { - purple_savedstatus_set_idleaway(FALSE); - } else { - purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed", - saved_status, old); - } -} - -void -purple_savedstatus_activate_for_account(const PurpleSavedStatus *saved_status, - PurpleAccount *account) -{ - const PurpleStatusType *status_type; - const PurpleSavedStatusSub *substatus; - const char *message = NULL; - - g_return_if_fail(saved_status != NULL); - g_return_if_fail(account != NULL); - - substatus = purple_savedstatus_get_substatus(saved_status, account); - if (substatus != NULL) - { - status_type = substatus->type; - message = substatus->message; - } - else - { - status_type = purple_account_get_status_type_with_primitive(account, saved_status->type); - if (status_type == NULL) - return; - message = saved_status->message; - } - - if ((message != NULL) && - (purple_status_type_get_attr(status_type, "message"))) - { - purple_account_set_status(account, purple_status_type_get_id(status_type), - TRUE, "message", message, NULL); - } - else - { - purple_account_set_status(account, purple_status_type_get_id(status_type), - TRUE, NULL); - } -} - -void * -purple_savedstatuses_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_savedstatuses_init(void) -{ - void *handle = purple_savedstatuses_get_handle(); - - creation_times = g_hash_table_new(g_direct_hash, g_direct_equal); - - /* - * Using 0 as the creation_time is a special case. - * If someone calls purple_savedstatus_get_current() or - * purple_savedstatus_get_idleaway() and either of those functions - * sees a creation_time of 0, then it will create a default - * saved status and return that to the user. - */ - purple_prefs_add_none("/purple/savedstatus"); - purple_prefs_add_int("/purple/savedstatus/default", 0); - purple_prefs_add_int("/purple/savedstatus/startup", 0); - purple_prefs_add_bool("/purple/savedstatus/startup_current_status", TRUE); - purple_prefs_add_int("/purple/savedstatus/idleaway", 0); - purple_prefs_add_bool("/purple/savedstatus/isidleaway", FALSE); - - load_statuses(); - - purple_signal_register(handle, "savedstatus-changed", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_register(handle, "savedstatus-added", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_register(handle, "savedstatus-deleted", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_register(handle, "savedstatus-modified", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_connect(purple_accounts_get_handle(), "account-removed", - handle, - PURPLE_CALLBACK(purple_savedstatus_unset_all_substatuses), - NULL); -} - -void -purple_savedstatuses_uninit(void) -{ - gpointer handle = purple_savedstatuses_get_handle(); - - remove_old_transient_statuses(); - - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_statuses(); - } - - while (saved_statuses != NULL) { - PurpleSavedStatus *saved_status = saved_statuses->data; - saved_statuses = g_list_remove(saved_statuses, saved_status); - free_saved_status(saved_status); - } - - g_hash_table_destroy(creation_times); - creation_times = NULL; - - purple_signals_unregister_by_instance(handle); - purple_signals_disconnect_by_handle(handle); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/savedstatuses.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,425 +0,0 @@ -/** - * @file savedstatuses.h Saved Status API - * @ingroup core - * @see @ref savedstatus-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SAVEDSTATUSES_H_ -#define _PURPLE_SAVEDSTATUSES_H_ - -/** - * Saved statuses don't really interact much with the rest of Purple. It - * could really be a plugin. It's just a list of away states. When - * a user chooses one of the saved states, their Purple accounts are set - * to the settings of that state. - * - * In the savedstatus API, there is the concept of a 'transient' - * saved status. A transient saved status is one that is not - * permanent. Purple will removed it automatically if it isn't - * used for a period of time. Transient saved statuses don't - * have titles and they don't show up in the list of saved - * statuses. In fact, if a saved status does not have a title - * then it is transient. If it does have a title, then it is not - * transient. - * - * What good is a transient status, you ask? They can be used to - * keep track of the user's 5 most recently used statuses, for - * example. Basically if they just set a message on the fly, - * we'll cache it for them in case they want to use it again. If - * they don't use it again, we'll just delete it. - */ - -/* - * TODO: Hmm. We should probably just be saving PurplePresences. That's - * something we should look into once the status box gets fleshed - * out more. - */ - -typedef struct _PurpleSavedStatus PurpleSavedStatus; -typedef struct _PurpleSavedStatusSub PurpleSavedStatusSub; - -#include "status.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Saved status subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Create a new saved status. This will add the saved status to the - * list of saved statuses and writes the revised list to status.xml. - * - * @param title The title of the saved status. This must be - * unique. Or, if you want to create a transient - * saved status, then pass in NULL. - * @param type The type of saved status. - * - * @return The newly created saved status, or NULL if the title you - * used was already taken. - */ -PurpleSavedStatus *purple_savedstatus_new(const char *title, - PurpleStatusPrimitive type); - -/** - * Set the title for the given saved status. - * - * @param status The saved status. - * @param title The title of the saved status. - */ -void purple_savedstatus_set_title(PurpleSavedStatus *status, - const char *title); - -/** - * Set the type for the given saved status. - * - * @param status The saved status. - * @param type The type of saved status. - */ -void purple_savedstatus_set_type(PurpleSavedStatus *status, - PurpleStatusPrimitive type); - -/** - * Set the message for the given saved status. - * - * @param status The saved status. - * @param message The message, or NULL if you want to unset the - * message for this status. - */ -void purple_savedstatus_set_message(PurpleSavedStatus *status, - const char *message); - -/** - * Set a substatus for an account in a saved status. - * - * @param status The saved status. - * @param account The account. - * @param type The status type for the account in the staved - * status. - * @param message The message for the account in the substatus. - */ -void purple_savedstatus_set_substatus(PurpleSavedStatus *status, - const PurpleAccount *account, - const PurpleStatusType *type, - const char *message); - -/** - * Unset a substatus for an account in a saved status. This clears - * the previosly set substatus for the PurpleSavedStatus. If this - * saved status is activated then this account will use the default - * status type and message. - * - * @param saved_status The saved status. - * @param account The account. -*/ -void purple_savedstatus_unset_substatus(PurpleSavedStatus *saved_status, - const PurpleAccount *account); - -/** - * Delete a saved status. This removes the saved status from the list - * of saved statuses, and writes the revised list to status.xml. - * - * @param title The title of the saved status. - * - * @return TRUE if the status was successfully deleted. FALSE if the - * status could not be deleted because no saved status exists - * with the given title. - */ -gboolean purple_savedstatus_delete(const char *title); - -/** - * Delete a saved status. This removes the saved status from the list - * of saved statuses, and writes the revised list to status.xml. - * - * @param saved_status the status to delete, the pointer is invalid after - * the call - * - */ -void purple_savedstatus_delete_by_status(PurpleSavedStatus *saved_status); - -/** - * Returns all saved statuses. - * - * @constreturn A list of saved statuses. - */ -GList *purple_savedstatuses_get_all(void); - -/** - * Returns the n most popular saved statuses. "Popularity" is - * determined by when the last time a saved_status was used and - * how many times it has been used. Transient statuses without - * messages are not included in the list. - * - * @param how_many The maximum number of saved statuses - * to return, or '0' to get all saved - * statuses sorted by popularity. - * @return A linked list containing at most how_many - * PurpleSavedStatuses. This list should be - * g_list_free'd by the caller (but the - * PurpleSavedStatuses must not be free'd). - */ -GList *purple_savedstatuses_get_popular(unsigned int how_many); - -/** - * Returns the currently selected saved status. If we are idle - * then this returns purple_savedstatus_get_idleaway(). Otherwise - * it returns purple_savedstatus_get_default(). - * - * @return A pointer to the in-use PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_current(void); - -/** - * Returns the default saved status that is used when our - * accounts are not idle-away. - * - * @return A pointer to the in-use PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_default(void); - -/** - * Returns the saved status that is used when your - * accounts become idle-away. - * - * @return A pointer to the idle-away PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_idleaway(void); - -/** - * Return TRUE if we are currently idle-away. Otherwise - * returns FALSE. - * - * @return TRUE if our accounts have been set to idle-away. - */ -gboolean purple_savedstatus_is_idleaway(void); - -/** - * Set whether accounts in Purple are idle-away or not. - * - * @param idleaway TRUE if accounts should be switched to use the - * idle-away saved status. FALSE if they should - * be switched to use the default status. - */ -void purple_savedstatus_set_idleaway(gboolean idleaway); - -/** - * Returns the status to be used when purple is starting up - * - * @return A pointer to the startup PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_startup(void); - -/** - * Finds a saved status with the specified title. - * - * @param title The name of the saved status. - * - * @return The saved status if found, or NULL. - */ -PurpleSavedStatus *purple_savedstatus_find(const char *title); - -/** - * Finds a saved status with the specified creation time. - * - * @param creation_time The timestamp when the saved - * status was created. - * - * @return The saved status if found, or NULL. - */ -PurpleSavedStatus *purple_savedstatus_find_by_creation_time(time_t creation_time); - -/** - * Finds a saved status with the specified primitive and message. - * - * @param type The PurpleStatusPrimitive for the status you're trying - * to find. - * @param message The message for the status you're trying - * to find. - * - * @return The saved status if found, or NULL. - */ -PurpleSavedStatus *purple_savedstatus_find_transient_by_type_and_message(PurpleStatusPrimitive type, const char *message); - -/** - * Determines if a given saved status is "transient." - * A transient saved status is one that was not - * explicitly added by the user. Transient statuses - * are automatically removed if they are not used - * for a period of time. - * - * A transient saved statuses is automatically - * created by the status box when the user sets himself - * to one of the generic primitive statuses. The reason - * we need to save this status information is so we can - * restore it when Purple restarts. - * - * @param saved_status The saved status. - * - * @return TRUE if the saved status is transient. - */ -gboolean purple_savedstatus_is_transient(const PurpleSavedStatus *saved_status); - -/** - * Return the name of a given saved status. - * - * @param saved_status The saved status. - * - * @return The title. This value may be a static buffer which may - * be overwritten on subsequent calls to this function. If - * you need a reference to the title for prolonged use then - * you should make a copy of it. - */ -const char *purple_savedstatus_get_title(const PurpleSavedStatus *saved_status); - -/** - * Return the type of a given saved status. - * - * @param saved_status The saved status. - * - * @return The name. - */ -PurpleStatusPrimitive purple_savedstatus_get_type(const PurpleSavedStatus *saved_status); - -/** - * Return the default message of a given saved status. - * - * @param saved_status The saved status. - * - * @return The message. This will return NULL if the saved - * status does not have a message. This will - * contain the normal markup that is created by - * Purple's IMHTML (basically HTML markup). - */ -const char *purple_savedstatus_get_message(const PurpleSavedStatus *saved_status); - -/** - * Return the time in seconds-since-the-epoch when this - * saved status was created. Note: For any status created - * by Purple 1.5.0 or older this value will be invalid and - * very small (close to 0). This is because Purple 1.5.0 - * and older did not record the timestamp when the status - * was created. - * - * However, this value is guaranteed to be a unique - * identifier for the given saved status. - * - * @param saved_status The saved status. - * - * @return The timestamp when this saved status was created. - */ -time_t purple_savedstatus_get_creation_time(const PurpleSavedStatus *saved_status); - -/** - * Determine if a given saved status has "substatuses," - * or if it is a simple status (the same for all - * accounts). - * - * @param saved_status The saved status. - * - * @return TRUE if the saved_status has substatuses. - * FALSE otherwise. - */ -gboolean purple_savedstatus_has_substatuses(const PurpleSavedStatus *saved_status); - -/** - * Get the substatus for an account in a saved status. - * - * @param saved_status The saved status. - * @param account The account. - * - * @return The PurpleSavedStatusSub for the account, or NULL if - * the given account does not have a substatus that - * differs from the default status of this PurpleSavedStatus. - */ -PurpleSavedStatusSub *purple_savedstatus_get_substatus( - const PurpleSavedStatus *saved_status, - const PurpleAccount *account); - -/** - * Get the status type of a given substatus. - * - * @param substatus The substatus. - * - * @return The status type. - */ -const PurpleStatusType *purple_savedstatus_substatus_get_type(const PurpleSavedStatusSub *substatus); - -/** - * Get the message of a given substatus. - * - * @param substatus The substatus. - * - * @return The message of the substatus, or NULL if this substatus does - * not have a message. - */ -const char *purple_savedstatus_substatus_get_message(const PurpleSavedStatusSub *substatus); - -/** - * Sets the statuses for all your accounts to those specified - * by the given saved_status. This function calls - * purple_savedstatus_activate_for_account() for all your accounts. - * - * @param saved_status The status you want to set your accounts to. - */ -void purple_savedstatus_activate(PurpleSavedStatus *saved_status); - -/** - * Sets the statuses for a given account to those specified - * by the given saved_status. - * - * @param saved_status The status you want to set your accounts to. - * @param account The account whose statuses you want to change. - */ -void purple_savedstatus_activate_for_account(const PurpleSavedStatus *saved_status, PurpleAccount *account); - -/** - * Get the handle for the status subsystem. - * - * @return the handle to the status subsystem - */ -void *purple_savedstatuses_get_handle(void); - -/** - * Initializes the status subsystem. - */ -void purple_savedstatuses_init(void); - -/** - * Uninitializes the status subsystem. - */ -void purple_savedstatuses_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SAVEDSTATUSES_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,975 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* This file is the fullcrap */ - -#include "internal.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "log.h" -#include "notify.h" -#include "prefs.h" -#include "privacy.h" -#include "prpl.h" -#include "request.h" -#include "signals.h" -#include "server.h" -#include "status.h" -#include "util.h" - -#define SECS_BEFORE_RESENDING_AUTORESPONSE 600 -#define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" - -unsigned int -serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->send_typing) - return prpl_info->send_typing(gc, name, state); - } - - return 0; -} - -static GSList *last_auto_responses = NULL; -struct last_auto_response { - PurpleConnection *gc; - char name[80]; - time_t sent; -}; - -static gboolean -expire_last_auto_responses(gpointer data) -{ - GSList *tmp, *cur; - struct last_auto_response *lar; - - tmp = last_auto_responses; - - while (tmp) { - cur = tmp; - tmp = tmp->next; - lar = (struct last_auto_response *)cur->data; - - if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) { - last_auto_responses = g_slist_remove(last_auto_responses, lar); - g_free(lar); - } - } - - return FALSE; /* do not run again */ -} - -static struct last_auto_response * -get_last_auto_response(PurpleConnection *gc, const char *name) -{ - GSList *tmp; - struct last_auto_response *lar; - - /* because we're modifying or creating a lar, schedule the - * function to expire them as the pref dictates */ - purple_timeout_add_seconds((SECS_BEFORE_RESENDING_AUTORESPONSE + 1), expire_last_auto_responses, NULL); - - tmp = last_auto_responses; - - while (tmp) { - lar = (struct last_auto_response *)tmp->data; - - if (gc == lar->gc && !strncmp(name, lar->name, sizeof(lar->name))) - return lar; - - tmp = tmp->next; - } - - lar = (struct last_auto_response *)g_new0(struct last_auto_response, 1); - g_snprintf(lar->name, sizeof(lar->name), "%s", name); - lar->gc = gc; - lar->sent = 0; - last_auto_responses = g_slist_prepend(last_auto_responses, lar); - - return lar; -} - -int serv_send_im(PurpleConnection *gc, const char *name, const char *message, - PurpleMessageFlags flags) -{ - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - PurplePresence *presence = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - int val = -EINVAL; - const gchar *auto_reply_pref = NULL; - - g_return_val_if_fail(gc != NULL, val); - - prpl = purple_connection_get_prpl(gc); - - g_return_val_if_fail(prpl != NULL, val); - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); - - if (prpl_info->send_im) - val = prpl_info->send_im(gc, name, message, flags); - - /* - * XXX - If "only auto-reply when away & idle" is set, then shouldn't - * this only reset lar->sent if we're away AND idle? - */ - auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); - if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && - !purple_presence_is_available(presence) && - !purple_strequal(auto_reply_pref, "never")) { - - struct last_auto_response *lar; - lar = get_last_auto_response(gc, name); - lar->sent = time(NULL); - } - - if(conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv))) - purple_conv_im_stop_send_typed_timeout(PURPLE_CONV_IM(conv)); - - return val; -} - -void serv_get_info(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->get_info) - prpl_info->get_info(gc, name); - } -} - -void serv_set_info(PurpleConnection *gc, const char *info) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - PurpleAccount *account; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->set_info) { - account = purple_connection_get_account(gc); - - if (purple_signal_emit_return_1(purple_accounts_get_handle(), - "account-setting-info", account, info)) - return; - - prpl_info->set_info(gc, info); - - purple_signal_emit(purple_accounts_get_handle(), - "account-set-info", account, info); - } - } -} - -/* - * Set buddy's alias on server roster/list - */ -void serv_alias_buddy(PurpleBuddy *b) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (b) { - account = purple_buddy_get_account(b); - - if (account) { - gc = purple_account_get_connection(account); - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->alias_buddy) - prpl_info->alias_buddy(gc, - purple_buddy_get_name(b), - purple_buddy_get_local_buddy_alias(b)); - } - } - } -} - -void -serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) -{ - PurpleAccount *account; - GSList *buddies; - PurpleBuddy *b; - PurpleConversation *conv; - - account = purple_connection_get_account(gc); - buddies = purple_find_buddies(account, who); - - while (buddies != NULL) - { - const char *server_alias; - - b = buddies->data; - buddies = g_slist_delete_link(buddies, buddies); - - server_alias = purple_buddy_get_server_alias(b); - - if (purple_strequal(server_alias, alias)) - continue; - - purple_blist_server_alias_buddy(b, alias); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(b), account); - if (conv != NULL && alias != NULL && !purple_strequal(alias, who)) - { - char *escaped = g_markup_escape_text(who, -1); - char *escaped2 = g_markup_escape_text(alias, -1); - char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), - escaped, escaped2); - - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, - time(NULL)); - - g_free(tmp); - g_free(escaped2); - g_free(escaped); - } - } -} - -void -purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias) -{ - PurpleAccount *account = NULL; - GSList *buddies = NULL; - PurpleBuddy *b = NULL; - - account = purple_connection_get_account(gc); - buddies = purple_find_buddies(account, who); - - while(buddies != NULL) { - const char *balias; - b = buddies->data; - - buddies = g_slist_delete_link(buddies, buddies); - - balias = purple_buddy_get_local_buddy_alias(b); - if (purple_strequal(balias, alias)) - continue; - - purple_blist_alias_buddy(b, alias); - } -} - - -PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code) -{ - PurplePlugin *prpl; - PurpleAttentionType* attn; - GList *(*get_attention_types)(PurpleAccount *); - - g_return_val_if_fail(account != NULL, NULL); - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - - /* Lookup the attention type in the protocol's attention_types list, if any. */ - get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->get_attention_types; - if (get_attention_types) { - GList *attention_types; - - attention_types = get_attention_types(account); - attn = (PurpleAttentionType *)g_list_nth_data(attention_types, type_code); - } else { - attn = NULL; - } - - return attn; -} - -void -serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_send_attention(gc, who, type_code); -} - -void -serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_got_attention(gc, who, type_code); -} - - -/* - * Move a buddy from one group to another on server. - * - * Note: For now we'll not deal with changing gc's at the same time, but - * it should be possible. Probably needs to be done, someday. Although, - * the UI for that would be difficult, because groups are Purple-wide. - */ -void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - g_return_if_fail(b != NULL); - g_return_if_fail(og != NULL); - g_return_if_fail(ng != NULL); - - account = purple_buddy_get_account(b); - gc = purple_account_get_connection(account); - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->group_buddy) - prpl_info->group_buddy(gc, purple_buddy_get_name(b), - purple_group_get_name(og), - purple_group_get_name(ng)); - } -} - -void serv_add_permit(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->add_permit) - prpl_info->add_permit(gc, name); - } -} - -void serv_add_deny(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->add_deny) - prpl_info->add_deny(gc, name); - } -} - -void serv_rem_permit(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->rem_permit) - prpl_info->rem_permit(gc, name); - } -} - -void serv_rem_deny(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->rem_deny) - prpl_info->rem_deny(gc, name); - } -} - -void serv_set_permit_deny(PurpleConnection *gc) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - /* - * this is called when either you import a buddy list, and make lots - * of changes that way, or when the user toggles the permit/deny mode - * in the prefs. In either case you should probably be resetting and - * resending the permit/deny info when you get this. - */ - if (prpl_info->set_permit_deny) - prpl_info->set_permit_deny(gc); - } -} - -void serv_join_chat(PurpleConnection *gc, GHashTable *data) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->join_chat) - prpl_info->join_chat(gc, data); - } -} - - -void serv_reject_chat(PurpleConnection *gc, GHashTable *data) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->reject_chat) - prpl_info->reject_chat(gc, data); - } -} - -void serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConversation *conv; - char *buffy = message && *message ? g_strdup(message) : NULL; - - conv = purple_find_chat(gc, id); - - if(conv == NULL) - return; - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user", - conv, name, &buffy); - - if (prpl_info && prpl_info->chat_invite) - prpl_info->chat_invite(gc, id, buffy, name); - - purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user", - conv, name, buffy); - - g_free(buffy); -} - -/* Ya know, nothing uses this except purple_conversation_destroy(), - * I think I'll just merge it into that later... - * Then again, something might want to use this, from outside prpl-land - * to leave a chat without destroying the conversation. - */ -void serv_chat_leave(PurpleConnection *gc, int id) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_leave) - prpl_info->chat_leave(gc, id); -} - -void serv_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_whisper) - prpl_info->chat_whisper(gc, id, who, message); - } -} - -int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_send) - return prpl_info->chat_send(gc, id, message, flags); - - return -EINVAL; -} - -/* - * woo. i'm actually going to comment this function. isn't that fun. make - * sure to follow along, kids - */ -void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags, time_t mtime) -{ - PurpleAccount *account; - PurpleConversation *conv; - char *message, *name; - char *angel, *buffy; - int plugin_return; - - g_return_if_fail(msg != NULL); - - account = purple_connection_get_account(gc); - - /* - * XXX: Should we be setting this here, or relying on prpls to set it? - */ - flags |= PURPLE_MESSAGE_RECV; - - if (!purple_privacy_check(account, who)) { - purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", - account, who, msg, flags, (unsigned int)mtime); - return; - } - - /* - * We should update the conversation window buttons and menu, - * if it exists. - */ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account); - - /* - * Make copies of the message and the sender in case plugins want - * to free these strings and replace them with a modifed version. - */ - buffy = g_strdup(msg); - angel = g_strdup(who); - - plugin_return = GPOINTER_TO_INT( - purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-im-msg", gc->account, - &angel, &buffy, conv, &flags)); - - if (!buffy || !angel || plugin_return) { - g_free(buffy); - g_free(angel); - return; - } - - name = angel; - message = buffy; - - purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account, - name, message, conv, flags); - - /* search for conversation again in case it was created by received-im-msg handler */ - if (conv == NULL) - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); - - purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); - g_free(message); - - /* - * Don't autorespond if: - * - * - it's not supported on this connection - * - we are available - * - or it's disabled - * - or we're not idle and the 'only auto respond if idle' pref - * is set - */ - if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) - { - PurplePresence *presence; - PurpleStatus *status; - PurpleStatusType *status_type; - PurpleStatusPrimitive primitive; - const gchar *auto_reply_pref; - const char *away_msg = NULL; - gboolean mobile = FALSE; - - auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - status_type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(status_type); - mobile = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE); - if ((primitive == PURPLE_STATUS_AVAILABLE) || - (primitive == PURPLE_STATUS_INVISIBLE) || - mobile || - purple_strequal(auto_reply_pref, "never") || - (!purple_presence_is_idle(presence) && purple_strequal(auto_reply_pref, "awayidle"))) - { - g_free(name); - return; - } - - away_msg = purple_value_get_string( - purple_status_get_attr_value(status, "message")); - - if ((away_msg != NULL) && (*away_msg != '\0')) { - struct last_auto_response *lar; - time_t now = time(NULL); - - /* - * This used to be based on the conversation window. But um, if - * you went away, and someone sent you a message and got your - * auto-response, and then you closed the window, and then they - * sent you another one, they'd get the auto-response back too - * soon. Besides that, we need to keep track of this even if we've - * got a queue. So the rest of this block is just the auto-response, - * if necessary. - */ - lar = get_last_auto_response(gc, name); - if ((now - lar->sent) >= SECS_BEFORE_RESENDING_AUTORESPONSE) - { - /* - * We don't want to send an autoresponse in response to the other user's - * autoresponse. We do, however, not want to then send one in response to the - * _next_ message, so we still set lar->sent to now. - */ - lar->sent = now; - - if (!(flags & PURPLE_MESSAGE_AUTO_RESP)) - { - serv_send_im(gc, name, away_msg, PURPLE_MESSAGE_AUTO_RESP); - - purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, away_msg, - PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP, - mtime); - } - } - } - } - - g_free(name); -} - -void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, - PurpleTypingState state) { - PurpleConversation *conv; - PurpleConvIm *im = NULL; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - if (conv != NULL) { - im = PURPLE_CONV_IM(conv); - - purple_conv_im_set_typing_state(im, state); - } else { - switch (state) - { - case PURPLE_TYPING: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing", gc->account, name); - break; - case PURPLE_TYPED: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typed", gc->account, name); - break; - case PURPLE_NOT_TYPING: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); - break; - } - } - - if (conv != NULL && timeout > 0) - purple_conv_im_start_typing_timeout(im, timeout); -} - -void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { - - PurpleConversation *conv; - PurpleConvIm *im; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - if (conv != NULL) - { - im = PURPLE_CONV_IM(conv); - - if (im->typing_state == PURPLE_NOT_TYPING) - return; - - purple_conv_im_stop_typing_timeout(im); - purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); - } - else - { - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); - } -} - -struct chat_invite_data { - PurpleConnection *gc; - GHashTable *components; -}; - -static void chat_invite_data_free(struct chat_invite_data *cid) -{ - if (cid->components) - g_hash_table_destroy(cid->components); - g_free(cid); -} - - -static void chat_invite_reject(struct chat_invite_data *cid) -{ - serv_reject_chat(cid->gc, cid->components); - chat_invite_data_free(cid); -} - - -static void chat_invite_accept(struct chat_invite_data *cid) -{ - serv_join_chat(cid->gc, cid->components); - chat_invite_data_free(cid); -} - - - -void serv_got_chat_invite(PurpleConnection *gc, const char *name, - const char *who, const char *message, GHashTable *data) -{ - PurpleAccount *account; - char buf2[BUF_LONG]; - struct chat_invite_data *cid; - int plugin_return; - - g_return_if_fail(name != NULL); - g_return_if_fail(who != NULL); - - account = purple_connection_get_account(gc); - if (!purple_privacy_check(account, who)) { - purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked", - account, who, name, message, data); - return; - } - - cid = g_new0(struct chat_invite_data, 1); - - plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( - purple_conversations_get_handle(), - "chat-invited", account, who, name, message, data)); - - cid->gc = gc; - cid->components = data; - - if (plugin_return == 0) - { - if (message != NULL) - { - g_snprintf(buf2, sizeof(buf2), - _("%s has invited %s to the chat room %s:\n%s"), - who, purple_account_get_username(account), name, message); - } - else - g_snprintf(buf2, sizeof(buf2), - _("%s has invited %s to the chat room %s\n"), - who, purple_account_get_username(account), name); - - - purple_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2, - PURPLE_DEFAULT_ACTION_NONE, account, who, NULL, - cid, G_CALLBACK(chat_invite_accept), - G_CALLBACK(chat_invite_reject)); - } - else if (plugin_return > 0) - chat_invite_accept(cid); - else - chat_invite_reject(cid); -} - -PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, - int id, const char *name) -{ - PurpleConversation *conv; - PurpleConvChat *chat; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); - g_return_val_if_fail(conv != NULL, NULL); - - chat = PURPLE_CONV_CHAT(conv); - - if (!g_slist_find(gc->buddy_chats, conv)) - gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); - - purple_conv_chat_set_id(chat, id); - - purple_signal_emit(purple_conversations_get_handle(), "chat-joined", conv); - - return conv; -} - -void serv_got_chat_left(PurpleConnection *g, int id) -{ - GSList *bcs; - PurpleConversation *conv = NULL; - PurpleConvChat *chat = NULL; - - for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { - conv = (PurpleConversation *)bcs->data; - - chat = PURPLE_CONV_CHAT(conv); - - if (purple_conv_chat_get_id(chat) == id) - break; - - conv = NULL; - } - - if (!conv) - return; - - purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n", - purple_conversation_get_name(conv)); - - g->buddy_chats = g_slist_remove(g->buddy_chats, conv); - - purple_conv_chat_left(PURPLE_CONV_CHAT(conv)); - - purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv); -} - -void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data) -{ - purple_signal_emit(purple_conversations_get_handle(), "chat-join-failed", - gc, data); -} - -void serv_got_chat_in(PurpleConnection *g, int id, const char *who, - PurpleMessageFlags flags, const char *message, time_t mtime) -{ - GSList *bcs; - PurpleConversation *conv = NULL; - PurpleConvChat *chat = NULL; - char *buffy, *angel; - int plugin_return; - - g_return_if_fail(who != NULL); - g_return_if_fail(message != NULL); - - for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { - conv = (PurpleConversation *)bcs->data; - - chat = PURPLE_CONV_CHAT(conv); - - if (purple_conv_chat_get_id(chat) == id) - break; - - conv = NULL; - } - - if (!conv) - return; - - /* Did I send the message? */ - if (purple_strequal(purple_conv_chat_get_nick(chat), - purple_normalize(purple_conversation_get_account(conv), who))) { - flags |= PURPLE_MESSAGE_SEND; - flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */ - } else { - flags |= PURPLE_MESSAGE_RECV; - } - - /* - * Make copies of the message and the sender in case plugins want - * to free these strings and replace them with a modifed version. - */ - buffy = g_strdup(message); - angel = g_strdup(who); - - plugin_return = GPOINTER_TO_INT( - purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-chat-msg", g->account, - &angel, &buffy, conv, &flags)); - - if (!buffy || !angel || plugin_return) { - g_free(buffy); - g_free(angel); - return; - } - - who = angel; - message = buffy; - - purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account, - who, message, conv, flags); - - purple_conv_chat_write(chat, who, message, flags, mtime); - - g_free(angel); - g_free(buffy); -} - -void serv_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->send_file && - (!prpl_info->can_receive_file - || prpl_info->can_receive_file(gc, who))) - prpl_info->send_file(gc, who, file); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/server.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -/** - * @file server.h Server API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SERVER_H_ -#define _PURPLE_SERVER_H_ - -#include "account.h" -#include "conversation.h" -#include "prpl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Send a typing message to a given user over a given connection. - * - * TODO: Could probably move this into the conversation API. - * - * @param gc The connection over which to send the typing notification. - * @param name The user to send the typing notification to. - * @param state One of PURPLE_TYPING, PURPLE_TYPED, or PURPLE_NOT_TYPING. - * @return A quiet-period, specified in seconds, where Purple will not - * send any additional typing notification messages. Most - * protocols should return 0, which means that no additional - * PURPLE_TYPING messages need to be sent. If this is 5, for - * example, then Purple will wait five seconds, and if the Purple - * user is still typing then Purple will send another PURPLE_TYPING - * message. - */ -unsigned int serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); - -void serv_move_buddy(PurpleBuddy *, PurpleGroup *, PurpleGroup *); -int serv_send_im(PurpleConnection *, const char *, const char *, PurpleMessageFlags flags); - -/** Get information about an account's attention commands, from the prpl. - * - * @return The attention command numbered 'code' from the prpl's attention_types, or NULL. - */ -PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code); - -/** Send an attention request message. - * - * @deprecated Use purple_prpl_send_attention() instead. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - */ -void serv_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** Process an incoming attention message. - * - * @deprecated Use purple_prpl_got_attention() instead. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - */ -void serv_got_attention(PurpleConnection *gc, const char *who, guint type_code); - -void serv_get_info(PurpleConnection *, const char *); -void serv_set_info(PurpleConnection *, const char *); - -void serv_add_permit(PurpleConnection *, const char *); -void serv_add_deny(PurpleConnection *, const char *); -void serv_rem_permit(PurpleConnection *, const char *); -void serv_rem_deny(PurpleConnection *, const char *); -void serv_set_permit_deny(PurpleConnection *); -void serv_chat_invite(PurpleConnection *, int, const char *, const char *); -void serv_chat_leave(PurpleConnection *, int); -void serv_chat_whisper(PurpleConnection *, int, const char *, const char *); -int serv_chat_send(PurpleConnection *, int, const char *, PurpleMessageFlags flags); -void serv_alias_buddy(PurpleBuddy *); -void serv_got_alias(PurpleConnection *gc, const char *who, const char *alias); - -/** - * A protocol plugin should call this when it retrieves a private alias from - * the server. Private aliases are the aliases the user sets, while public - * aliases are the aliases or display names that buddies set for themselves. - * - * @param gc The connection on which the alias was received. - * @param who The name of the buddy whose alias was received. - * @param alias The alias that was received. - */ -void purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias); - - -/** - * Receive a typing message from a remote user. Either PURPLE_TYPING - * or PURPLE_TYPED. If the user has stopped typing then use - * serv_got_typing_stopped instead. - * - * TODO: Could probably move this into the conversation API. - * - * @param gc The connection on which the typing message was received. - * @param name The name of the remote user. - * @param timeout If this is a number greater than 0, then - * Purple will wait this number of seconds and then - * set this buddy to the PURPLE_NOT_TYPING state. This - * is used by protocols that send repeated typing messages - * while the user is composing the message. - * @param state The typing state received - */ -void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, - PurpleTypingState state); - -/** - * TODO: Could probably move this into the conversation API. - */ -void serv_got_typing_stopped(PurpleConnection *gc, const char *name); - -void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags, time_t mtime); - -/** - * @param data The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void serv_join_chat(PurpleConnection *, GHashTable *data); - -/** - * @param data The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void serv_reject_chat(PurpleConnection *, GHashTable *data); - -/** - * Called by a prpl when an account is invited into a chat. - * - * @param gc The connection on which the invite arrived. - * @param name The name of the chat you're being invited to. - * @param who The username of the person inviting the account. - * @param message The optional invite message. - * @param data The components necessary if you want to call serv_join_chat(). - * The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void serv_got_chat_invite(PurpleConnection *gc, const char *name, - const char *who, const char *message, - GHashTable *data); - -/** - * Called by a prpl when an account has joined a chat. - * - * @param gc The connection on which the chat was joined. - * @param id The id of the chat, assigned by the prpl. - * @param name The name of the chat. - * @return The resulting conversation - */ -PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, - int id, const char *name); -/** - * Called by a prpl when an attempt to join a chat via serv_join_chat() - * fails. - * - * @param gc The connection on which chat joining failed - * @param data The components passed to serv_join_chat() originally. - * The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data); - -/** - * Called by a prpl when an account has left a chat. - * - * @param g The connection on which the chat was left. - * @param id The id of the chat, as assigned by the prpl. - */ -void serv_got_chat_left(PurpleConnection *g, int id); - -/** - * Called by a prpl when a message has been received in a chat. - * - * @param g The connection on which the message was received. - * @param id The id of the chat, as assigned by the prpl. - * @param who The name of the user who sent the message. - * @param flags The flags of the message. - * @param message The message received in the chat. - * @param mtime The time when the message was received. - */ -void serv_got_chat_in(PurpleConnection *g, int id, const char *who, - PurpleMessageFlags flags, const char *message, time_t mtime); -void serv_send_file(PurpleConnection *gc, const char *who, const char *file); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SERVER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1085 +0,0 @@ -/** - * @file signals.c Signal API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "dbus-maybe.h" -#include "debug.h" -#include "signals.h" -#include "value.h" - -/* must include this to use G_VA_COPY */ -#include - -typedef struct -{ - void *instance; - - GHashTable *signals; - size_t signal_count; - - gulong next_signal_id; - -} PurpleInstanceData; - -typedef struct -{ - gulong id; - - PurpleSignalMarshalFunc marshal; - - int num_values; - PurpleValue **values; - PurpleValue *ret_value; - - GList *handlers; - size_t handler_count; - - gulong next_handler_id; -} PurpleSignalData; - -typedef struct -{ - gulong id; - PurpleCallback cb; - void *handle; - void *data; - gboolean use_vargs; - int priority; - -} PurpleSignalHandlerData; - -static GHashTable *instance_table = NULL; - -static void -destroy_instance_data(PurpleInstanceData *instance_data) -{ - g_hash_table_destroy(instance_data->signals); - - g_free(instance_data); -} - -static void -destroy_signal_data(PurpleSignalData *signal_data) -{ - g_list_foreach(signal_data->handlers, (GFunc)g_free, NULL); - g_list_free(signal_data->handlers); - - if (signal_data->values != NULL) - { - int i; - - for (i = 0; i < signal_data->num_values; i++) - purple_value_destroy((PurpleValue *)signal_data->values[i]); - - g_free(signal_data->values); - } - - if (signal_data->ret_value != NULL) - purple_value_destroy(signal_data->ret_value); - g_free(signal_data); -} - -gulong -purple_signal_register(void *instance, const char *signal, - PurpleSignalMarshalFunc marshal, - PurpleValue *ret_value, int num_values, ...) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - va_list args; - - g_return_val_if_fail(instance != NULL, 0); - g_return_val_if_fail(signal != NULL, 0); - g_return_val_if_fail(marshal != NULL, 0); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - if (instance_data == NULL) - { - instance_data = g_new0(PurpleInstanceData, 1); - - instance_data->instance = instance; - instance_data->next_signal_id = 1; - - instance_data->signals = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)destroy_signal_data); - - g_hash_table_insert(instance_table, instance, instance_data); - } - - signal_data = g_new0(PurpleSignalData, 1); - signal_data->id = instance_data->next_signal_id; - signal_data->marshal = marshal; - signal_data->next_handler_id = 1; - signal_data->ret_value = ret_value; - signal_data->num_values = num_values; - - if (num_values > 0) - { - int i; - - signal_data->values = g_new0(PurpleValue *, num_values); - - va_start(args, num_values); - - for (i = 0; i < num_values; i++) - signal_data->values[i] = va_arg(args, PurpleValue *); - - va_end(args); - } - - g_hash_table_insert(instance_data->signals, - g_strdup(signal), signal_data); - - instance_data->next_signal_id++; - instance_data->signal_count++; - - return signal_data->id; -} - -void -purple_signal_unregister(void *instance, const char *signal) -{ - PurpleInstanceData *instance_data; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - g_hash_table_remove(instance_data->signals, signal); - - instance_data->signal_count--; - - if (instance_data->signal_count == 0) - { - /* Unregister the instance. */ - g_hash_table_remove(instance_table, instance); - } -} - -void -purple_signals_unregister_by_instance(void *instance) -{ - gboolean found; - - g_return_if_fail(instance != NULL); - - found = g_hash_table_remove(instance_table, instance); - - /* - * Makes things easier (more annoying?) for developers who don't have - * things registering and unregistering in the right order :) - */ - g_return_if_fail(found); -} - -void -purple_signal_get_values(void *instance, const char *signal, - PurpleValue **ret_value, - int *num_values, PurpleValue ***values) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - g_return_if_fail(num_values != NULL); - g_return_if_fail(values != NULL); - - /* Get the instance data */ - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - /* Get the signal data */ - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - g_return_if_fail(signal_data != NULL); - - *num_values = signal_data->num_values; - *values = signal_data->values; - - if (ret_value != NULL) - *ret_value = signal_data->ret_value; -} - -static gint handler_priority(void * a, void * b) { - PurpleSignalHandlerData *ah = (PurpleSignalHandlerData*)a; - PurpleSignalHandlerData *bh = (PurpleSignalHandlerData*)b; - if (ah->priority > bh->priority) return 1; - if (ah->priority < bh->priority) return -1; - return 0; -} - -static gulong -signal_connect_common(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data, int priority, gboolean use_vargs) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - - g_return_val_if_fail(instance != NULL, 0); - g_return_val_if_fail(signal != NULL, 0); - g_return_val_if_fail(handle != NULL, 0); - g_return_val_if_fail(func != NULL, 0); - - /* Get the instance data */ - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - if (instance_data == NULL) - { - purple_debug_warning("signals", "Something tried to register a callback " - "for the '%s' signal, but we do not have any signals " - "registered with the given handle\n", signal); - g_return_val_if_reached(0); - } - - /* Get the signal data */ - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return 0; - } - - /* Create the signal handler data */ - handler_data = g_new0(PurpleSignalHandlerData, 1); - handler_data->id = signal_data->next_handler_id; - handler_data->cb = func; - handler_data->handle = handle; - handler_data->data = data; - handler_data->use_vargs = use_vargs; - handler_data->priority = priority; - - signal_data->handlers = g_list_insert_sorted(signal_data->handlers, handler_data, (GCompareFunc)handler_priority); - signal_data->handler_count++; - signal_data->next_handler_id++; - - return handler_data->id; -} - -gulong -purple_signal_connect_priority(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data, int priority) -{ - return signal_connect_common(instance, signal, handle, func, data, priority, FALSE); -} - -gulong -purple_signal_connect(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data) -{ - return signal_connect_common(instance, signal, handle, func, data, PURPLE_SIGNAL_PRIORITY_DEFAULT, FALSE); -} - -gulong -purple_signal_connect_priority_vargs(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data, int priority) -{ - return signal_connect_common(instance, signal, handle, func, data, priority, TRUE); -} - -gulong -purple_signal_connect_vargs(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data) -{ - return signal_connect_common(instance, signal, handle, func, data, PURPLE_SIGNAL_PRIORITY_DEFAULT, TRUE); -} - -void -purple_signal_disconnect(void *instance, const char *signal, - void *handle, PurpleCallback func) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - GList *l; - gboolean found = FALSE; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - g_return_if_fail(handle != NULL); - g_return_if_fail(func != NULL); - - /* Get the instance data */ - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - /* Get the signal data */ - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return; - } - - /* Find the handler data. */ - for (l = signal_data->handlers; l != NULL; l = l->next) - { - handler_data = (PurpleSignalHandlerData *)l->data; - - if (handler_data->handle == handle && handler_data->cb == func) - { - g_free(handler_data); - - signal_data->handlers = g_list_delete_link(signal_data->handlers, - l); - signal_data->handler_count--; - - found = TRUE; - - break; - } - } - - /* See note somewhere about this actually helping developers.. */ - g_return_if_fail(found); -} - -/* - * TODO: Make this all more efficient by storing a list of handlers, keyed - * to a handle. - */ -static void -disconnect_handle_from_signals(const char *signal, - PurpleSignalData *signal_data, void *handle) -{ - GList *l, *l_next; - PurpleSignalHandlerData *handler_data; - - for (l = signal_data->handlers; l != NULL; l = l_next) - { - handler_data = (PurpleSignalHandlerData *)l->data; - l_next = l->next; - - if (handler_data->handle == handle) - { - g_free(handler_data); - - signal_data->handler_count--; - signal_data->handlers = g_list_delete_link(signal_data->handlers, - l); - } - } -} - -static void -disconnect_handle_from_instance(void *instance, - PurpleInstanceData *instance_data, - void *handle) -{ - g_hash_table_foreach(instance_data->signals, - (GHFunc)disconnect_handle_from_signals, handle); -} - -void -purple_signals_disconnect_by_handle(void *handle) -{ - g_return_if_fail(handle != NULL); - - g_hash_table_foreach(instance_table, - (GHFunc)disconnect_handle_from_instance, handle); -} - -void -purple_signal_emit(void *instance, const char *signal, ...) -{ - va_list args; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - - va_start(args, signal); - purple_signal_emit_vargs(instance, signal, args); - va_end(args); -} - -void -purple_signal_emit_vargs(void *instance, const char *signal, va_list args) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - GList *l, *l_next; - va_list tmp; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return; - } - - for (l = signal_data->handlers; l != NULL; l = l_next) - { - l_next = l->next; - - handler_data = (PurpleSignalHandlerData *)l->data; - - /* This is necessary because a va_list may only be - * evaluated once */ - G_VA_COPY(tmp, args); - - if (handler_data->use_vargs) - { - ((void (*)(va_list, void *))handler_data->cb)(tmp, - handler_data->data); - } - else - { - signal_data->marshal(handler_data->cb, tmp, - handler_data->data, NULL); - } - - va_end(tmp); - } - -#ifdef HAVE_DBUS - purple_dbus_signal_emit_purple(signal, signal_data->num_values, - signal_data->values, args); -#endif /* HAVE_DBUS */ - -} - -void * -purple_signal_emit_return_1(void *instance, const char *signal, ...) -{ - void *ret_val; - va_list args; - - g_return_val_if_fail(instance != NULL, NULL); - g_return_val_if_fail(signal != NULL, NULL); - - va_start(args, signal); - ret_val = purple_signal_emit_vargs_return_1(instance, signal, args); - va_end(args); - - return ret_val; -} - -void * -purple_signal_emit_vargs_return_1(void *instance, const char *signal, - va_list args) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - GList *l, *l_next; - va_list tmp; - - g_return_val_if_fail(instance != NULL, NULL); - g_return_val_if_fail(signal != NULL, NULL); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_val_if_fail(instance_data != NULL, NULL); - - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return 0; - } - -#ifdef HAVE_DBUS - G_VA_COPY(tmp, args); - purple_dbus_signal_emit_purple(signal, signal_data->num_values, - signal_data->values, tmp); - va_end(tmp); -#endif /* HAVE_DBUS */ - - for (l = signal_data->handlers; l != NULL; l = l_next) - { - void *ret_val = NULL; - - l_next = l->next; - - handler_data = (PurpleSignalHandlerData *)l->data; - - G_VA_COPY(tmp, args); - if (handler_data->use_vargs) - { - ret_val = ((void *(*)(va_list, void *))handler_data->cb)( - tmp, handler_data->data); - } - else - { - signal_data->marshal(handler_data->cb, tmp, - handler_data->data, &ret_val); - } - va_end(tmp); - - if (ret_val != NULL) - return ret_val; - } - - return NULL; -} - -void -purple_signals_init() -{ - g_return_if_fail(instance_table == NULL); - - instance_table = - g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify)destroy_instance_data); -} - -void -purple_signals_uninit() -{ - g_return_if_fail(instance_table != NULL); - - g_hash_table_destroy(instance_table); - instance_table = NULL; -} - -/************************************************************************** - * Marshallers - **************************************************************************/ -void -purple_marshal_VOID(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - ((void (*)(void *))cb)(data); -} - -void -purple_marshal_VOID__INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint arg1 = va_arg(args, gint); - - ((void (*)(gint, void *))cb)(arg1, data); -} - -void -purple_marshal_VOID__INT_INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint arg1 = va_arg(args, gint); - gint arg2 = va_arg(args, gint); - - ((void (*)(gint, gint, void *))cb)(arg1, arg2, data); -} - -void -purple_marshal_VOID__POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - - ((void (*)(void *, void *))cb)(arg1, data); -} - -void -purple_marshal_VOID__POINTER_UINT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - guint arg2 = va_arg(args, guint); - - ((void (*)(void *, guint, void *))cb)(arg1, arg2, data); -} - -void purple_marshal_VOID__POINTER_INT_INT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - gint arg3 = va_arg(args, gint); - - ((void (*)(void *, gint, gint, void *))cb)(arg1, arg2, arg3, data); -} - -void purple_marshal_VOID__POINTER_INT_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - void *arg3 = va_arg(args, void *); - - ((void (*)(void *, gint, void *, void *))cb)(arg1, arg2, arg3, data); -} - -void -purple_marshal_VOID__POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ((void (*)(void *, void *, void *))cb)(arg1, arg2, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_UINT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - guint arg3 = va_arg(args, guint); - - ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_UINT_UINT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - guint arg3 = va_arg(args, guint); - guint arg4 = va_arg(args, guint); - - ((void (*)(void *, void *, guint, guint, void *))cb)(arg1, arg2, arg3, arg4, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - - ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - - ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - - ((void (*)(void *, void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - guint arg4 = va_arg(args, guint); - - ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - guint arg5 = va_arg(args, guint); - - ((void (*)(void *, void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - guint arg4 = va_arg(args, guint); - guint arg5 = va_arg(args, guint); - - ((void (*)(void *, void *, void *, guint, guint, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); -} - -void -purple_marshal_INT__INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint ret_val; - gint arg1 = va_arg(args, gint); - - ret_val = ((gint (*)(gint, void *))cb)(arg1, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_INT__INT_INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint ret_val; - gint arg1 = va_arg(args, gint); - gint arg2 = va_arg(args, gint); - - ret_val = ((gint (*)(gint, gint, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_INT__POINTER_POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ret_val = ((gint (*)(void *, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gint ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - - ret_val = - ((gint (*)(void *, void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2, - arg3, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - guint arg3 = va_arg(args, guint); - - ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)( - arg1, arg2, arg3, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - guint arg4 = va_arg(args, guint); - - ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)( - arg1, arg2, arg3, arg4, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - - ret_val = - ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - guint arg5 = va_arg(args, guint); - - ret_val = - ((gboolean (*)(void *, void *, void *, void *, guint, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - void *arg6 = va_arg(args, void *); - - ret_val = - ((gboolean (*)(void *, void *, void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, arg5, arg6, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__INT_POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gboolean ret_val; - gint arg1 = va_arg(args, gint); - void *arg2 = va_arg(args, void *); - - ret_val = ((gboolean (*)(gint, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_POINTER__POINTER_INT( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - - ret_val = ((gpointer(*)(void *, gint, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_INT64( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint64 arg2 = va_arg(args, gint64); - - ret_val = ((gpointer(*)(void *, gint64, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_INT_BOOLEAN( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - gboolean arg3 = va_arg(args, gboolean); - - ret_val = ((gpointer(*)(void *, gint, gboolean, void *))cb)(arg1, arg2, arg3, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_INT64_BOOLEAN( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint64 arg2 = va_arg(args, gint64); - gboolean arg3 = va_arg(args, gboolean); - - ret_val = ((gpointer(*)(void *, gint64, gboolean, void *))cb)(arg1, arg2, arg3, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ret_val = ((gpointer (*)(void *, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = ret_val; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/signals.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,374 +0,0 @@ -/** - * @file signals.h Signal API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SIGNALS_H_ -#define _PURPLE_SIGNALS_H_ - -#include -#include "value.h" - -#define PURPLE_CALLBACK(func) ((PurpleCallback)func) - -typedef void (*PurpleCallback)(void); -typedef void (*PurpleSignalMarshalFunc)(PurpleCallback cb, va_list args, - void *data, void **return_val); - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Signal API */ -/**************************************************************************/ -/*@{*/ - -/** The priority of a signal connected using purple_signal_connect(). - * - * @see purple_signal_connect_priority() - */ -#define PURPLE_SIGNAL_PRIORITY_DEFAULT 0 -/** The largest signal priority; signals with this priority will be called - * last. (This is highest as in numerical value, not as in order of - * importance.) - * - * @see purple_signal_connect_priority(). - */ -#define PURPLE_SIGNAL_PRIORITY_HIGHEST 9999 -/** The smallest signal priority; signals with this priority will be called - * first. (This is lowest as in numerical value, not as in order of - * importance.) - * - * @see purple_signal_connect_priority(). - */ -#define PURPLE_SIGNAL_PRIORITY_LOWEST -9999 - -/** - * Registers a signal in an instance. - * - * @param instance The instance to register the signal for. - * @param signal The signal name. - * @param marshal The marshal function. - * @param ret_value The return value type, or NULL for no return value. - * @param num_values The number of values to be passed to the callbacks. - * @param ... The values to pass to the callbacks. - * - * @return The signal ID local to that instance, or 0 if the signal - * couldn't be registered. - * - * @see PurpleValue - */ -gulong purple_signal_register(void *instance, const char *signal, - PurpleSignalMarshalFunc marshal, - PurpleValue *ret_value, int num_values, ...); - -/** - * Unregisters a signal in an instance. - * - * @param instance The instance to unregister the signal for. - * @param signal The signal name. - */ -void purple_signal_unregister(void *instance, const char *signal); - -/** - * Unregisters all signals in an instance. - * - * @param instance The instance to unregister the signal for. - */ -void purple_signals_unregister_by_instance(void *instance); - -/** - * Returns a list of value types used for a signal. - * - * @param instance The instance the signal is registered to. - * @param signal The signal. - * @param ret_value The return value from the last signal handler. - * @param num_values The returned number of values. - * @param values The returned list of values. - */ -void purple_signal_get_values(void *instance, const char *signal, - PurpleValue **ret_value, - int *num_values, PurpleValue ***values); - -/** - * Connects a signal handler to a signal for a particular object. - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * @param priority The priority with which the handler should be called. Signal - * handlers are called in ascending numerical order of @a - * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to - * #PURPLE_SIGNAL_PRIORITY_HIGHEST. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect_priority(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data, int priority); - -/** - * Connects a signal handler to a signal for a particular object. - * (Its priority defaults to 0, aka #PURPLE_SIGNAL_PRIORITY_DEFAULT.) - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data); - -/** - * Connects a signal handler to a signal for a particular object. - * - * The signal handler will take a va_args of arguments, instead of - * individual arguments. - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * @param priority The priority with which the handler should be called. Signal - * handlers are called in ascending numerical order of @a - * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to - * #PURPLE_SIGNAL_PRIORITY_HIGHEST. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect_priority_vargs(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data, int priority); - -/** - * Connects a signal handler to a signal for a particular object. - * (Its priority defaults to 0, aka #PURPLE_SIGNAL_PRIORITY_DEFAULT.) - * - * The signal handler will take a va_args of arguments, instead of - * individual arguments. - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect_vargs(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data); - -/** - * Disconnects a signal handler from a signal on an object. - * - * @param instance The instance to disconnect from. - * @param signal The name of the signal to disconnect. - * @param handle The handle of the receiver. - * @param func The registered function to disconnect. - * - * @see purple_signal_connect() - */ -void purple_signal_disconnect(void *instance, const char *signal, - void *handle, PurpleCallback func); - -/** - * Removes all callbacks associated with a receiver handle. - * - * @param handle The receiver handle. - */ -void purple_signals_disconnect_by_handle(void *handle); - -/** - * Emits a signal. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * - * @see purple_signal_connect() - * @see purple_signal_disconnect() - */ -void purple_signal_emit(void *instance, const char *signal, ...); - -/** - * Emits a signal, using a va_list of arguments. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * @param args The arguments list. - * - * @see purple_signal_connect() - * @see purple_signal_disconnect() - */ -void purple_signal_emit_vargs(void *instance, const char *signal, va_list args); - -/** - * Emits a signal and returns the first non-NULL return value. - * - * Further signal handlers are NOT called after a handler returns - * something other than NULL. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * - * @return The first non-NULL return value - */ -void *purple_signal_emit_return_1(void *instance, const char *signal, ...); - -/** - * Emits a signal and returns the first non-NULL return value. - * - * Further signal handlers are NOT called after a handler returns - * something other than NULL. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * @param args The arguments list. - * - * @return The first non-NULL return value - */ -void *purple_signal_emit_vargs_return_1(void *instance, const char *signal, - va_list args); - -/** - * Initializes the signals subsystem. - */ -void purple_signals_init(void); - -/** - * Uninitializes the signals subsystem. - */ -void purple_signals_uninit(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Marshal Functions */ -/**************************************************************************/ -/*@{*/ - -void purple_marshal_VOID( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__INT_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_INT_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_INT_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_UINT_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_INT__INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_INT__INT_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_INT__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_BOOLEAN__POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_BOOLEAN__INT_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_POINTER__POINTER_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_INT64( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_INT_BOOLEAN( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_INT64_BOOLEAN( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SIGNALS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,902 +0,0 @@ -/** - * @file smiley.c Simley API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "imgstore.h" -#include "smiley.h" -#include "util.h" -#include "xmlnode.h" - -/**************************************************************************/ -/* Main structures, members and constants */ -/**************************************************************************/ - -struct _PurpleSmiley -{ - GObject parent; - PurpleStoredImage *img; /**< The id of the stored image with the - the smiley data. */ - char *shortcut; /**< Shortcut associated with the custom - smiley. This field will work as a - unique key by this API. */ - char *checksum; /**< The smiley checksum. */ -}; - -struct _PurpleSmileyClass -{ - GObjectClass parent_class; -}; - -static GHashTable *smiley_shortcut_index = NULL; /* shortcut (char *) => smiley (PurpleSmiley*) */ -static GHashTable *smiley_checksum_index = NULL; /* checksum (char *) => smiley (PurpleSmiley*) */ - -static guint save_timer = 0; -static gboolean smileys_loaded = FALSE; -static char *smileys_dir = NULL; - -#define SMILEYS_DEFAULT_FOLDER "custom_smiley" -#define SMILEYS_LOG_ID "smileys" - -#define XML_FILE_NAME "smileys.xml" - -#define XML_ROOT_TAG "smileys" -#define XML_PROFILE_TAG "profile" -#define XML_PROFILE_NAME_ATTRIB_TAG "name" -#define XML_ACCOUNT_TAG "account" -#define XML_ACCOUNT_USERID_ATTRIB_TAG "userid" -#define XML_SMILEY_SET_TAG "smiley_set" -#define XML_SMILEY_TAG "smiley" -#define XML_SHORTCUT_ATTRIB_TAG "shortcut" -#define XML_CHECKSUM_ATRIB_TAG "checksum" -#define XML_FILENAME_ATRIB_TAG "filename" - - -/****************************************************************************** - * XML descriptor file layout * - ****************************************************************************** - * - * Although we are creating the profile XML structure here, now we - * won't handle it. - * So, we just add one profile named "default" that has no associated - * account elements, and have only the smiley_set that will contain - * all existent custom smiley. - * - * It's our "Highlander Profile" :-) - * - ****************************************************************************** - * - * - * - * - * - * - * - * - * - * - * - * - *****************************************************************************/ - - -/********************************************************************* - * Forward declarations * - *********************************************************************/ - -static gboolean read_smiley_file(const char *path, guchar **data, size_t *len); - -static char *get_file_full_path(const char *filename); - -static PurpleSmiley *purple_smiley_create(const char *shortcut); - -static PurpleSmiley *purple_smiley_load_file(const char *shortcut, const char *checksum, - const char *filename); - -static void -purple_smiley_set_data_impl(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len); - -static void -purple_smiley_data_store(PurpleStoredImage *stored_img); - -static void -purple_smiley_data_unstore(const char *filename); - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static xmlnode * -smiley_to_xmlnode(PurpleSmiley *smiley) -{ - xmlnode *smiley_node = NULL; - - smiley_node = xmlnode_new(XML_SMILEY_TAG); - - if (!smiley_node) - return NULL; - - xmlnode_set_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG, - smiley->shortcut); - - xmlnode_set_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG, - smiley->checksum); - - xmlnode_set_attrib(smiley_node, XML_FILENAME_ATRIB_TAG, - purple_imgstore_get_filename(smiley->img)); - - return smiley_node; -} - -static void -add_smiley_to_main_node(gpointer key, gpointer value, gpointer user_data) -{ - xmlnode *child_node; - - child_node = smiley_to_xmlnode(value); - xmlnode_insert_child((xmlnode*)user_data, child_node); -} - -static xmlnode * -smileys_to_xmlnode(void) -{ - xmlnode *root_node, *profile_node, *smileyset_node; - - root_node = xmlnode_new(XML_ROOT_TAG); - xmlnode_set_attrib(root_node, "version", "1.0"); - - /* See the top comments above to understand why initial tag elements - * are not being considered by now. */ - profile_node = xmlnode_new(XML_PROFILE_TAG); - if (profile_node) { - xmlnode_set_attrib(profile_node, XML_PROFILE_NAME_ATTRIB_TAG, "Default"); - xmlnode_insert_child(root_node, profile_node); - - smileyset_node = xmlnode_new(XML_SMILEY_SET_TAG); - if (smileyset_node) { - xmlnode_insert_child(profile_node, smileyset_node); - g_hash_table_foreach(smiley_shortcut_index, add_smiley_to_main_node, smileyset_node); - } - } - - return root_node; -} - -static void -sync_smileys(void) -{ - xmlnode *root_node; - char *data; - - if (!smileys_loaded) { - purple_debug_error(SMILEYS_LOG_ID, "Attempted to save smileys before it " - "was read!\n"); - return; - } - - root_node = smileys_to_xmlnode(); - data = xmlnode_to_formatted_str(root_node, NULL); - purple_util_write_data_to_file(XML_FILE_NAME, data, -1); - - g_free(data); - xmlnode_free(root_node); -} - -static gboolean -save_smileys_cb(gpointer data) -{ - sync_smileys(); - save_timer = 0; - return FALSE; -} - -static void -purple_smileys_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_smileys_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static PurpleSmiley * -parse_smiley(xmlnode *smiley_node) -{ - PurpleSmiley *smiley; - const char *shortcut = NULL; - const char *checksum = NULL; - const char *filename = NULL; - - shortcut = xmlnode_get_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG); - checksum = xmlnode_get_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG); - filename = xmlnode_get_attrib(smiley_node, XML_FILENAME_ATRIB_TAG); - - if ((shortcut == NULL) || (checksum == NULL) || (filename == NULL)) - return NULL; - - smiley = purple_smiley_load_file(shortcut, checksum, filename); - - return smiley; -} - -static void -purple_smileys_load(void) -{ - xmlnode *root_node, *profile_node; - xmlnode *smileyset_node = NULL; - xmlnode *smiley_node; - - smileys_loaded = TRUE; - - root_node = purple_util_read_xml_from_file(XML_FILE_NAME, - _(SMILEYS_LOG_ID)); - - if (root_node == NULL) - return; - - /* See the top comments above to understand why initial tag elements - * are not being considered by now. */ - profile_node = xmlnode_get_child(root_node, XML_PROFILE_TAG); - if (profile_node) - smileyset_node = xmlnode_get_child(profile_node, XML_SMILEY_SET_TAG); - - if (smileyset_node) { - smiley_node = xmlnode_get_child(smileyset_node, XML_SMILEY_TAG); - for (; smiley_node != NULL; - smiley_node = xmlnode_get_next_twin(smiley_node)) { - PurpleSmiley *smiley; - - smiley = parse_smiley(smiley_node); - } - } - - xmlnode_free(root_node); -} - -/********************************************************************* - * GObject Stuff * - *********************************************************************/ -enum -{ - PROP_0, - PROP_SHORTCUT, - PROP_IMGSTORE -}; - -#define PROP_SHORTCUT_S "shortcut" -#define PROP_IMGSTORE_S "image" - -enum -{ - SIG_DESTROY, - SIG_LAST -}; - -static guint signals[SIG_LAST]; -static GObjectClass *parent_class; - -static void -purple_smiley_init(GTypeInstance *instance, gpointer klass) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(instance); - PURPLE_DBUS_REGISTER_POINTER(smiley, PurpleSmiley); -} - -static void -purple_smiley_get_property(GObject *object, guint param_id, GValue *value, - GParamSpec *spec) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(object); - switch (param_id) { - case PROP_SHORTCUT: - g_value_set_string(value, smiley->shortcut); - break; - case PROP_IMGSTORE: - g_value_set_pointer(value, smiley->img); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, spec); - break; - } -} - -static void -purple_smiley_set_property(GObject *object, guint param_id, const GValue *value, - GParamSpec *spec) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(object); - switch (param_id) { - case PROP_SHORTCUT: - { - const char *shortcut = g_value_get_string(value); - purple_smiley_set_shortcut(smiley, shortcut); - } - break; - case PROP_IMGSTORE: - { - PurpleStoredImage *img = g_value_get_pointer(value); - - purple_imgstore_unref(smiley->img); - g_free(smiley->checksum); - - smiley->img = img; - if (img) { - smiley->checksum = purple_util_get_image_checksum( - purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_smiley_data_store(img); - } else { - smiley->checksum = NULL; - } - - g_object_notify(object, PROP_IMGSTORE_S); - } - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, spec); - break; - } -} - -static void -purple_smiley_finalize(GObject *obj) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(obj); - - if (g_hash_table_lookup(smiley_shortcut_index, smiley->shortcut)) { - g_hash_table_remove(smiley_shortcut_index, smiley->shortcut); - g_hash_table_remove(smiley_checksum_index, smiley->checksum); - } - - g_free(smiley->shortcut); - g_free(smiley->checksum); - if (smiley->img) - purple_smiley_data_unstore(purple_imgstore_get_filename(smiley->img)); - purple_imgstore_unref(smiley->img); - - PURPLE_DBUS_UNREGISTER_POINTER(smiley); - - purple_smileys_save(); -} - -static void -purple_smiley_dispose(GObject *gobj) -{ - g_signal_emit(gobj, signals[SIG_DESTROY], 0); - parent_class->dispose(gobj); -} - -static void -purple_smiley_class_init(PurpleSmileyClass *klass) -{ - GObjectClass *gobj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - gobj_class->get_property = purple_smiley_get_property; - gobj_class->set_property = purple_smiley_set_property; - gobj_class->finalize = purple_smiley_finalize; - gobj_class->dispose = purple_smiley_dispose; - - /* Shortcut */ - pspec = g_param_spec_string(PROP_SHORTCUT_S, _("Shortcut"), - _("The text-shortcut for the smiley"), - NULL, - G_PARAM_READWRITE); - g_object_class_install_property(gobj_class, PROP_SHORTCUT, pspec); - - /* Stored Image */ - pspec = g_param_spec_pointer(PROP_IMGSTORE_S, _("Stored Image"), - _("Stored Image. (that'll have to do for now)"), - G_PARAM_READWRITE); - g_object_class_install_property(gobj_class, PROP_IMGSTORE, pspec); - - signals[SIG_DESTROY] = g_signal_new("destroy", - G_OBJECT_CLASS_TYPE(klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); -} - -GType -purple_smiley_get_type(void) -{ - static GType type = 0; - - if(type == 0) { - static const GTypeInfo info = { - sizeof(PurpleSmileyClass), - NULL, - NULL, - (GClassInitFunc)purple_smiley_class_init, - NULL, - NULL, - sizeof(PurpleSmiley), - 0, - purple_smiley_init, - NULL, - }; - - type = g_type_register_static(G_TYPE_OBJECT, - "PurpleSmiley", - &info, 0); - } - - return type; -} - -/********************************************************************* - * Other Stuff * - *********************************************************************/ - -static char *get_file_full_path(const char *filename) -{ - char *path; - - path = g_build_filename(purple_smileys_get_storing_dir(), filename, NULL); - - if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - g_free(path); - return NULL; - } - - return path; -} - -static PurpleSmiley * -purple_smiley_load_file(const char *shortcut, const char *checksum, const char *filename) -{ - PurpleSmiley *smiley = NULL; - guchar *smiley_data; - size_t smiley_data_len; - char *fullpath = NULL; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(checksum != NULL, NULL); - g_return_val_if_fail(filename != NULL, NULL); - - fullpath = get_file_full_path(filename); - if (!fullpath) - return NULL; - - smiley = purple_smiley_create(shortcut); - if (!smiley) { - g_free(fullpath); - return NULL; - } - - smiley->checksum = g_strdup(checksum); - - if (read_smiley_file(fullpath, &smiley_data, &smiley_data_len)) - purple_smiley_set_data_impl(smiley, smiley_data, - smiley_data_len); - else - purple_smiley_delete(smiley); - - g_free(fullpath); - - return smiley; -} - -static void -purple_smiley_data_store(PurpleStoredImage *stored_img) -{ - const char *dirname; - char *path; - FILE *file = NULL; - - g_return_if_fail(stored_img != NULL); - - if (!smileys_loaded) - return; - - dirname = purple_smileys_get_storing_dir(); - path = g_build_filename(dirname, purple_imgstore_get_filename(stored_img), NULL); - - if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { - purple_debug_info(SMILEYS_LOG_ID, "Creating smileys directory.\n"); - - if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) { - purple_debug_error(SMILEYS_LOG_ID, - "Unable to create directory %s: %s\n", - dirname, g_strerror(errno)); - } - } - - if ((file = g_fopen(path, "wb")) != NULL) { - if (!fwrite(purple_imgstore_get_data(stored_img), - purple_imgstore_get_size(stored_img), 1, file)) { - purple_debug_error(SMILEYS_LOG_ID, "Error writing %s: %s\n", - path, g_strerror(errno)); - } else { - purple_debug_info(SMILEYS_LOG_ID, "Wrote cache file: %s\n", path); - } - - fclose(file); - } else { - purple_debug_error(SMILEYS_LOG_ID, "Unable to create file %s: %s\n", - path, g_strerror(errno)); - g_free(path); - - return; - } - - g_free(path); -} - -static void -purple_smiley_data_unstore(const char *filename) -{ - const char *dirname; - char *path; - - g_return_if_fail(filename != NULL); - - dirname = purple_smileys_get_storing_dir(); - path = g_build_filename(dirname, filename, NULL); - - if (g_file_test(path, G_FILE_TEST_EXISTS)) { - if (g_unlink(path)) - purple_debug_error(SMILEYS_LOG_ID, "Failed to delete %s: %s\n", - path, g_strerror(errno)); - else - purple_debug_info(SMILEYS_LOG_ID, "Deleted cache file: %s\n", path); - } - - g_free(path); -} - -static gboolean -read_smiley_file(const char *path, guchar **data, size_t *len) -{ - GError *err = NULL; - - if (!g_file_get_contents(path, (gchar **)data, len, &err)) { - purple_debug_error(SMILEYS_LOG_ID, "Error reading %s: %s\n", - path, err->message); - g_error_free(err); - - return FALSE; - } - - return TRUE; -} - -static PurpleStoredImage * -purple_smiley_data_new(guchar *smiley_data, size_t smiley_data_len) -{ - char *filename; - PurpleStoredImage *stored_img; - - g_return_val_if_fail(smiley_data != NULL, NULL); - g_return_val_if_fail(smiley_data_len > 0, NULL); - - filename = purple_util_get_image_filename(smiley_data, smiley_data_len); - - if (filename == NULL) { - g_free(smiley_data); - return NULL; - } - - stored_img = purple_imgstore_add(smiley_data, smiley_data_len, filename); - - g_free(filename); - - return stored_img; -} - -static void -purple_smiley_set_data_impl(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len) -{ - PurpleStoredImage *old_img, *new_img; - const char *old_filename = NULL; - const char *new_filename = NULL; - - g_return_if_fail(smiley != NULL); - g_return_if_fail(smiley_data != NULL); - g_return_if_fail(smiley_data_len > 0); - - old_img = smiley->img; - - new_img = purple_smiley_data_new(smiley_data, smiley_data_len); - - g_object_set(G_OBJECT(smiley), PROP_IMGSTORE_S, new_img, NULL); - - /* If the old and new image files have different names we need - * to unstore old image file. */ - if (!old_img) - return; - - old_filename = purple_imgstore_get_filename(old_img); - new_filename = purple_imgstore_get_filename(smiley->img); - - if (g_ascii_strcasecmp(old_filename, new_filename)) - purple_smiley_data_unstore(old_filename); - purple_imgstore_unref(old_img); -} - - -/***************************************************************************** - * Public API functions * - *****************************************************************************/ - -static PurpleSmiley * -purple_smiley_create(const char *shortcut) -{ - PurpleSmiley *smiley; - - smiley = PURPLE_SMILEY(g_object_new(PURPLE_TYPE_SMILEY, PROP_SHORTCUT_S, shortcut, NULL)); - - return smiley; -} - -PurpleSmiley * -purple_smiley_new(PurpleStoredImage *img, const char *shortcut) -{ - PurpleSmiley *smiley = NULL; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(img != NULL, NULL); - - smiley = purple_smileys_find_by_shortcut(shortcut); - if (smiley) - return smiley; - - smiley = purple_smiley_create(shortcut); - if (!smiley) - return NULL; - - g_object_set(G_OBJECT(smiley), PROP_IMGSTORE_S, img, NULL); - - return smiley; -} - -static PurpleSmiley * -purple_smiley_new_from_stream(const char *shortcut, guchar *smiley_data, - size_t smiley_data_len) -{ - PurpleSmiley *smiley; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(smiley_data != NULL, NULL); - g_return_val_if_fail(smiley_data_len > 0, NULL); - - smiley = purple_smileys_find_by_shortcut(shortcut); - if (smiley) - return smiley; - - /* purple_smiley_create() sets shortcut */ - smiley = purple_smiley_create(shortcut); - if (!smiley) - return NULL; - - purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len); - - purple_smiley_data_store(smiley->img); - - return smiley; -} - -PurpleSmiley * -purple_smiley_new_from_file(const char *shortcut, const char *filepath) -{ - PurpleSmiley *smiley = NULL; - guchar *smiley_data; - size_t smiley_data_len; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(filepath != NULL, NULL); - - if (read_smiley_file(filepath, &smiley_data, &smiley_data_len)) { - smiley = purple_smiley_new_from_stream(shortcut, smiley_data, - smiley_data_len); - } - - return smiley; -} - -void -purple_smiley_delete(PurpleSmiley *smiley) -{ - g_return_if_fail(smiley != NULL); - - g_object_unref(smiley); -} - -gboolean -purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut) -{ - g_return_val_if_fail(smiley != NULL, FALSE); - g_return_val_if_fail(shortcut != NULL, FALSE); - - /* Check out whether the new shortcut is already being used. */ - if (g_hash_table_lookup(smiley_shortcut_index, shortcut)) - return FALSE; - - /* Remove the old shortcut. */ - if (smiley->shortcut) - g_hash_table_remove(smiley_shortcut_index, smiley->shortcut); - - /* Insert the new shortcut. */ - g_hash_table_insert(smiley_shortcut_index, g_strdup(shortcut), smiley); - - g_free(smiley->shortcut); - smiley->shortcut = g_strdup(shortcut); - - g_object_notify(G_OBJECT(smiley), PROP_SHORTCUT_S); - - purple_smileys_save(); - - return TRUE; -} - -void -purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len) -{ - g_return_if_fail(smiley != NULL); - g_return_if_fail(smiley_data != NULL); - g_return_if_fail(smiley_data_len > 0); - - /* Remove the previous entry */ - g_hash_table_remove(smiley_checksum_index, smiley->checksum); - - /* Update the file data. This also updates the checksum. */ - purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len); - - /* Reinsert the index item. */ - g_hash_table_insert(smiley_checksum_index, g_strdup(smiley->checksum), smiley); - - purple_smileys_save(); -} - -PurpleStoredImage * -purple_smiley_get_stored_image(const PurpleSmiley *smiley) -{ - return purple_imgstore_ref(smiley->img); -} - -const char *purple_smiley_get_shortcut(const PurpleSmiley *smiley) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - return smiley->shortcut; -} - -const char * -purple_smiley_get_checksum(const PurpleSmiley *smiley) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - return smiley->checksum; -} - -gconstpointer -purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - if (smiley->img) { - if (len != NULL) - *len = purple_imgstore_get_size(smiley->img); - - return purple_imgstore_get_data(smiley->img); - } - - return NULL; -} - -const char * -purple_smiley_get_extension(const PurpleSmiley *smiley) -{ - if (smiley->img != NULL) - return purple_imgstore_get_extension(smiley->img); - - return NULL; -} - -char *purple_smiley_get_full_path(PurpleSmiley *smiley) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - if (smiley->img == NULL) - return NULL; - - return get_file_full_path(purple_imgstore_get_filename(smiley->img)); -} - -static void add_smiley_to_list(gpointer key, gpointer value, gpointer user_data) -{ - GList** returninglist = (GList**)user_data; - - *returninglist = g_list_append(*returninglist, value); -} - -GList * -purple_smileys_get_all(void) -{ - GList *returninglist = NULL; - - g_hash_table_foreach(smiley_shortcut_index, add_smiley_to_list, &returninglist); - - return returninglist; -} - -PurpleSmiley * -purple_smileys_find_by_shortcut(const char *shortcut) -{ - g_return_val_if_fail(shortcut != NULL, NULL); - - return g_hash_table_lookup(smiley_shortcut_index, shortcut); -} - -PurpleSmiley * -purple_smileys_find_by_checksum(const char *checksum) -{ - g_return_val_if_fail(checksum != NULL, NULL); - - return g_hash_table_lookup(smiley_checksum_index, checksum); -} - -const char * -purple_smileys_get_storing_dir(void) -{ - return smileys_dir; -} - -void -purple_smileys_init(void) -{ - smiley_shortcut_index = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - smiley_checksum_index = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - smileys_dir = g_build_filename(purple_user_dir(), SMILEYS_DEFAULT_FOLDER, NULL); - - purple_smileys_load(); -} - -void -purple_smileys_uninit(void) -{ - if (save_timer != 0) { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_smileys(); - } - - g_hash_table_destroy(smiley_shortcut_index); - g_hash_table_destroy(smiley_checksum_index); - g_free(smileys_dir); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/smiley.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,262 +0,0 @@ -/** - * @file smiley.h Smiley API - * @ingroup core - * @since 2.5.0 - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _PURPLE_SMILEY_H_ -#define _PURPLE_SMILEY_H_ - -#include - -#include "imgstore.h" -#include "util.h" - -/** - * A custom smiley. - * This contains everything Purple will ever need to know about a custom smiley. - * Everything. - * - * PurpleSmiley is a GObject. - */ -typedef struct _PurpleSmiley PurpleSmiley; -typedef struct _PurpleSmileyClass PurpleSmileyClass; - -#define PURPLE_TYPE_SMILEY (purple_smiley_get_type ()) -#define PURPLE_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_CAST ((smiley), PURPLE_TYPE_SMILEY, PurpleSmiley)) -#define PURPLE_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SMILEY, PurpleSmileyClass)) -#define PURPLE_IS_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_TYPE ((smiley), PURPLE_TYPE_SMILEY)) -#define PURPLE_IS_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY)) -#define PURPLE_SMILEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass)) - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Custom Smiley API */ -/**************************************************************************/ -/*@{*/ - -/** - * GObject-fu. - * @internal. - */ -GType purple_smiley_get_type(void); - -/** - * Creates a new custom smiley from a PurpleStoredImage. - * - * If a custom smiley with the given shortcut already exists, it - * will be automaticaly returned. - * - * @param img The image associated with the smiley. - * @param shortcut The associated shortcut (e.g. "(homer)"). - * - * @return The custom smiley. - */ -PurpleSmiley * -purple_smiley_new(PurpleStoredImage *img, const char *shortcut); - -/** - * Creates a new custom smiley, reading the image data from a file. - * - * If a custom smiley with the given shortcut already exists, it - * will be automaticaly returned. - * - * @param shortcut The associated shortcut (e.g. "(homer)"). - * @param filepath The image file. - * - * @return The custom smiley. - */ -PurpleSmiley * -purple_smiley_new_from_file(const char *shortcut, const char *filepath); - -/** - * Destroys the custom smiley and releases the associated resources. - * - * @param smiley The custom smiley. - */ -void -purple_smiley_delete(PurpleSmiley *smiley); - -/** - * Changes the custom smiley's shortcut. - * - * @param smiley The custom smiley. - * @param shortcut The new shortcut. A custom smiley with this shortcut - * cannot already be in use. - * - * @return TRUE if the shortcut was changed. FALSE otherwise. - */ -gboolean -purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut); - -/** - * Changes the custom smiley's image data. - * - * @param smiley The custom smiley. - * @param smiley_data The custom smiley data, which the smiley code - * takes ownership of and will free. - * @param smiley_data_len The length of the data in @a smiley_data. - */ -void -purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len); - -/** - * Returns the custom smiley's associated shortcut (e.g. "(homer)"). - * - * @param smiley The custom smiley. - * - * @return The shortcut. - */ -const char *purple_smiley_get_shortcut(const PurpleSmiley *smiley); - -/** - * Returns the custom smiley data's checksum. - * - * @param smiley The custom smiley. - * - * @return The checksum. - */ -const char *purple_smiley_get_checksum(const PurpleSmiley *smiley); - -/** - * Returns the PurpleStoredImage with the reference counter incremented. - * - * The returned PurpleStoredImage reference counter must be decremented - * when the caller is done using it. - * - * @param smiley The custom smiley. - * - * @return A PurpleStoredImage. - */ -PurpleStoredImage *purple_smiley_get_stored_image(const PurpleSmiley *smiley); - -/** - * Returns the custom smiley's data. - * - * @param smiley The custom smiley. - * @param len If not @c NULL, the length of the image data returned - * will be set in the location pointed to by this. - * - * @return A pointer to the custom smiley data. - */ -gconstpointer purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len); - -/** - * Returns an extension corresponding to the custom smiley's file type. - * - * @param smiley The custom smiley. - * - * @return The custom smiley's extension, "icon" if unknown, or @c NULL if - * the image data has disappeared. - */ -const char *purple_smiley_get_extension(const PurpleSmiley *smiley); - -/** - * Returns a full path to an custom smiley. - * - * If the custom smiley has data and the file exists in the cache, this - * will return a full path to the cached file. - * - * In general, it is not appropriate to be poking in the file cache - * directly. If you find yourself wanting to use this function, think - * very long and hard about it, and then don't. - * - * Think some more. - * - * @param smiley The custom smiley. - * - * @return A full path to the file, or @c NULL under various conditions. - * The caller should use g_free to free the returned string. - */ -char *purple_smiley_get_full_path(PurpleSmiley *smiley); - -/*@}*/ - - -/**************************************************************************/ -/** @name Custom Smiley Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns a list of all custom smileys. The caller is responsible for freeing - * the list. - * - * @return A list of all custom smileys. - */ -GList * -purple_smileys_get_all(void); - -/** - * Returns a custom smiley given its shortcut. - * - * @param shortcut The custom smiley's shortcut. - * - * @return The custom smiley if found, or @c NULL if not found. - */ -PurpleSmiley * -purple_smileys_find_by_shortcut(const char *shortcut); - -/** - * Returns a custom smiley given its checksum. - * - * @param checksum The custom smiley's checksum. - * - * @return The custom smiley if found, or @c NULL if not found. - */ -PurpleSmiley * -purple_smileys_find_by_checksum(const char *checksum); - -/** - * Returns the directory used to store custom smiley cached files. - * - * The default directory is PURPLEDIR/custom_smiley. - * - * @return The directory in which to store custom smileys cached files. - */ -const char *purple_smileys_get_storing_dir(void); - -/** - * Initializes the custom smiley subsystem. - */ -void purple_smileys_init(void); - -/** - * Uninitializes the custom smiley subsystem. - */ -void purple_smileys_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SMILEY_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "blist.h" -#include "prefs.h" -#include "sound.h" -#include "sound-theme-loader.h" -#include "theme-manager.h" - -static PurpleSoundUiOps *sound_ui_ops = NULL; - -#define STATUS_AVAILABLE 1 -#define STATUS_AWAY 2 - -static time_t last_played[PURPLE_NUM_SOUNDS]; - -static gboolean -purple_sound_play_required(const PurpleAccount *account) -{ - gint pref_status = purple_prefs_get_int("/purple/sound/while_status"); - - if (pref_status == 3) - { - /* Play sounds: Always */ - return TRUE; - } - - if (account != NULL) - { - PurpleStatus *status = purple_account_get_active_status(account); - - if (purple_status_is_online(status)) - { - gboolean available = purple_status_is_available(status); - return (( available && pref_status == STATUS_AVAILABLE) || - (!available && pref_status == STATUS_AWAY)); - } - } - - /* We get here a couple of ways. Either the request has been OK'ed - * by purple_sound_play_event() and we're here because the UI has - * called purple_sound_play_file(), or we're here for something - * not related to an account (like testing a sound). */ - return TRUE; -} - -void -purple_sound_play_file(const char *filename, const PurpleAccount *account) -{ - if (!purple_sound_play_required(account)) - return; - - if(sound_ui_ops && sound_ui_ops->play_file) - sound_ui_ops->play_file(filename); -} - -void -purple_sound_play_event(PurpleSoundEventID event, const PurpleAccount *account) -{ - if (!purple_sound_play_required(account)) - return; - - if (time(NULL) - last_played[event] < 2) - return; - last_played[event] = time(NULL); - - if(sound_ui_ops && sound_ui_ops->play_event) { - int plugin_return; - - plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( - purple_sounds_get_handle(), "playing-sound-event", - event, account)); - - if (plugin_return) - return; - else - sound_ui_ops->play_event(event); - } -} - -void -purple_sound_set_ui_ops(PurpleSoundUiOps *ops) -{ - if(sound_ui_ops && sound_ui_ops->uninit) - sound_ui_ops->uninit(); - - sound_ui_ops = ops; - - if(sound_ui_ops && sound_ui_ops->init) - sound_ui_ops->init(); -} - -PurpleSoundUiOps * -purple_sound_get_ui_ops(void) -{ - return sound_ui_ops; -} - -void -purple_sound_init() -{ - void *handle = purple_sounds_get_handle(); - - /********************************************************************** - * Register signals - **********************************************************************/ - - purple_signal_register(handle, "playing-sound-event", - purple_marshal_BOOLEAN__INT_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 2, - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT)); - - purple_prefs_add_none("/purple/sound"); - purple_prefs_add_int("/purple/sound/while_status", STATUS_AVAILABLE); - memset(last_played, 0, sizeof(last_played)); - - purple_theme_manager_register_type(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL)); -} - -void -purple_sound_uninit() -{ - if(sound_ui_ops && sound_ui_ops->uninit) - sound_ui_ops->uninit(); - - purple_signals_unregister_by_instance(purple_sounds_get_handle()); -} - -void * -purple_sounds_get_handle() -{ - static int handle; - - return &handle; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -/** - * @file sound.h Sound API - * @ingroup core - * @see @ref sound-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SOUND_H_ -#define _PURPLE_SOUND_H_ - -#include "account.h" - -/**************************************************************************/ -/** Data Structures */ -/**************************************************************************/ - - -/** - * A type of sound. - */ - -typedef enum _PurpleSoundEventID -{ - PURPLE_SOUND_BUDDY_ARRIVE = 0, /**< Buddy signs on. */ - PURPLE_SOUND_BUDDY_LEAVE, /**< Buddy signs off. */ - PURPLE_SOUND_RECEIVE, /**< Receive an IM. */ - PURPLE_SOUND_FIRST_RECEIVE, /**< Receive an IM that starts a conv. */ - PURPLE_SOUND_SEND, /**< Send an IM. */ - PURPLE_SOUND_CHAT_JOIN, /**< Someone joins a chat. */ - PURPLE_SOUND_CHAT_LEAVE, /**< Someone leaves a chat. */ - PURPLE_SOUND_CHAT_YOU_SAY, /**< You say something in a chat. */ - PURPLE_SOUND_CHAT_SAY, /**< Someone else says somthing in a chat. */ - PURPLE_SOUND_POUNCE_DEFAULT, /**< Default sound for a buddy pounce. */ - PURPLE_SOUND_CHAT_NICK, /**< Someone says your name in a chat. */ - PURPLE_NUM_SOUNDS /**< Total number of sounds. */ - -} PurpleSoundEventID; - -/** Operations used by the core to request that particular sound files, or the - * sound associated with a particular event, should be played. - */ -typedef struct _PurpleSoundUiOps -{ - void (*init)(void); - void (*uninit)(void); - void (*play_file)(const char *filename); - void (*play_event)(PurpleSoundEventID event); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleSoundUiOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Sound API */ -/**************************************************************************/ -/*@{*/ - -/** - * Plays the specified sound file. - * - * @param filename The file to play. - * @param account The account that this sound is associated with, or - * NULL if the sound is not associated with any specific - * account. This is needed for the "sounds while away?" - * preference to work correctly. - */ -void purple_sound_play_file(const char *filename, const PurpleAccount *account); - -/** - * Plays the sound associated with the specified event. - * - * @param event The event. - * @param account The account that this sound is associated with, or - * NULL if the sound is not associated with any specific - * account. This is needed for the "sounds while away?" - * preference to work correctly. - */ -void purple_sound_play_event(PurpleSoundEventID event, const PurpleAccount *account); - -/** - * Sets the UI sound operations - * - * @param ops The UI sound operations structure. - */ -void purple_sound_set_ui_ops(PurpleSoundUiOps *ops); - -/** - * Gets the UI sound operations - * - * @return The UI sound operations structure. - */ -PurpleSoundUiOps *purple_sound_get_ui_ops(void); - -/** - * Initializes the sound subsystem - */ -void purple_sound_init(void); - -/** - * Shuts down the sound subsystem - */ -void purple_sound_uninit(void); - -/** - * Returns the sound subsystem handle. - * - * @return The sound subsystem handle. - */ -void *purple_sounds_get_handle(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SOUND_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* - * Sound Themes for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "sound-theme.h" - -#define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \ - ((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv)) - -/****************************************************************************** - * Structs - *****************************************************************************/ - -typedef struct { - /* used to store filenames of diffrent sounds */ - GHashTable *sound_files; -} PurpleSoundThemePrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * Enums - *****************************************************************************/ - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -purple_sound_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleSoundThemePrivate *priv; - - (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1); - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance); - - priv->sound_files = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_free); -} - -static void -purple_sound_theme_finalize(GObject *obj) -{ - PurpleSoundThemePrivate *priv; - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(obj); - - g_hash_table_destroy(priv->sound_files); - - parent_class->finalize(obj); -} - -static void -purple_sound_theme_class_init(PurpleSoundThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - - parent_class = g_type_class_peek_parent(klass); - - obj_class->finalize = purple_sound_theme_finalize; -} - -GType -purple_sound_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleSoundThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_sound_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleSoundTheme), - 0, /* n_preallocs */ - purple_sound_theme_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(PURPLE_TYPE_THEME, - "PurpleSoundTheme", &info, 0); - } - return type; -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -const gchar * -purple_sound_theme_get_file(PurpleSoundTheme *theme, - const gchar *event) -{ - PurpleSoundThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL); - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme); - - return g_hash_table_lookup(priv->sound_files, event); -} - -gchar * -purple_sound_theme_get_file_full(PurpleSoundTheme *theme, - const gchar *event) -{ - const gchar *filename; - - g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL); - - filename = purple_sound_theme_get_file(theme, event); - - g_return_val_if_fail(filename, NULL); - - return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL); -} - -void -purple_sound_theme_set_file(PurpleSoundTheme *theme, - const gchar *event, - const gchar *filename) -{ - PurpleSoundThemePrivate *priv; - g_return_if_fail(PURPLE_IS_SOUND_THEME(theme)); - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme); - - if (filename != NULL) - g_hash_table_replace(priv->sound_files, - g_strdup(event), g_strdup(filename)); - else - g_hash_table_remove(priv->sound_files, event); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/** - * @file sound-theme.h Purple Sound Theme Abstact Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_SOUND_THEME_H -#define PURPLE_SOUND_THEME_H - -#include -#include -#include "theme.h" -#include "sound.h" - -/** - * extends PurpleTheme (theme.h) - * A purple sound theme. - * This is an object for Purple to represent a sound theme. - * - * PurpleSoundTheme is a PurpleTheme Object. - */ -typedef struct _PurpleSoundTheme PurpleSoundTheme; -typedef struct _PurpleSoundThemeClass PurpleSoundThemeClass; - -#define PURPLE_TYPE_SOUND_THEME (purple_sound_theme_get_type()) -#define PURPLE_SOUND_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundTheme)) -#define PURPLE_SOUND_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemeClass)) -#define PURPLE_IS_SOUND_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_SOUND_THEME)) -#define PURPLE_IS_SOUND_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_SOUND_THEME)) -#define PURPLE_SOUND_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemeClass)) - -struct _PurpleSoundTheme -{ - PurpleTheme parent; - gpointer priv; -}; - -struct _PurpleSoundThemeClass -{ - PurpleThemeClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Sound Theme API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_sound_theme_get_type(void); - -/** - * Returns a copy of the filename for the sound event. - * - * @param theme The theme. - * @param event The purple sound event to look up. - * - * @returns The filename of the sound event. - */ -const gchar *purple_sound_theme_get_file(PurpleSoundTheme *theme, - const gchar *event); - -/** - * Returns a copy of the directory and filename for the sound event - * - * @param theme The theme. - * @param event The purple sound event to look up - * - * @returns The directory + '/' + filename of the sound event. This is - * a newly allocated string that should be freed with g_free. - */ -gchar *purple_sound_theme_get_file_full(PurpleSoundTheme *theme, - const gchar *event); - -/** - * Sets the filename for a given sound event - * - * @param theme The theme. - * @param event the purple sound event to look up - * @param filename the name of the file to be used for the event - */ -void purple_sound_theme_set_file(PurpleSoundTheme *theme, - const gchar *event, - const gchar *filename); - -G_END_DECLS -#endif /* PURPLE_SOUND_THEME_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * SoundThemeLoader for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "sound-theme-loader.h" -#include "sound-theme.h" -#include "util.h" -#include "xmlnode.h" -#include "debug.h" - -/***************************************************************************** - * Sound Theme Builder - *****************************************************************************/ - -static PurpleTheme * -purple_sound_loader_build(const gchar *dir) -{ - xmlnode *root_node = NULL, *sub_node; - gchar *filename_full, *data = NULL; - PurpleSoundTheme *theme = NULL; - const gchar *name; - - /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); - filename_full = g_build_filename(dir, "theme.xml", NULL); - - if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); - - g_free(filename_full); - if (root_node == NULL) - return NULL; - - name = xmlnode_get_attrib(root_node, "name"); - - if (name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "sound")) { - /* Parse the tree */ - sub_node = xmlnode_get_child(root_node, "description"); - data = xmlnode_get_data(sub_node); - - if (xmlnode_get_attrib(root_node, "name") != NULL) { - theme = g_object_new(PURPLE_TYPE_SOUND_THEME, - "type", "sound", - "name", name, - "author", xmlnode_get_attrib(root_node, "author"), - "image", xmlnode_get_attrib(root_node, "image"), - "directory", dir, - "description", data, NULL); - - sub_node = xmlnode_get_child(root_node, "event"); - - while (sub_node) { - purple_sound_theme_set_file(theme, - xmlnode_get_attrib(sub_node, "name"), - xmlnode_get_attrib(sub_node, "file")); - sub_node = xmlnode_get_next_twin(sub_node); - } - } - } else purple_debug_warning("sound-theme-loader", "Missing attribute or problem with the root element\n"); - - xmlnode_free(root_node); - g_free(data); - return PURPLE_THEME(theme); -} - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -purple_sound_theme_loader_class_init(PurpleSoundThemeLoaderClass *klass) -{ - PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); - - loader_klass->purple_theme_loader_build = purple_sound_loader_build; -} - -GType -purple_sound_theme_loader_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleSoundThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_sound_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleSoundThemeLoader), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(PURPLE_TYPE_THEME_LOADER, - "PurpleSoundThemeLoader", &info, 0); - } - return type; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sound-theme-loader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/** - * @file sound-theme-loader.h Purple Sound Theme Loader Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_SOUND_THEME_LOADER_H -#define PURPLE_SOUND_THEME_LOADER_H - -#include -#include -#include "theme-loader.h" - -/** - * A purple sound theme loader. extends PurpleThemeLoader (theme-loader.h) - * This is a class designed to build sound themes - * - * PurpleSoundThemeLoader is a GObject. - */ -typedef struct _PurpleSoundThemeLoader PurpleSoundThemeLoader; -typedef struct _PurpleSoundThemeLoaderClass PurpleSoundThemeLoaderClass; - -#define PURPLE_TYPE_SOUND_THEME_LOADER (purple_sound_theme_loader_get_type()) -#define PURPLE_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoader)) -#define PURPLE_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass)) -#define PURPLE_IS_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_SOUND_THEME_LOADER)) -#define PURPLE_IS_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_SOUND_THEME_LOADER)) -#define PURPLE_SOUND_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass)) - -struct _PurpleSoundThemeLoader -{ - PurpleThemeLoader parent; -}; - -struct _PurpleSoundThemeLoaderClass -{ - PurpleThemeLoaderClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_sound_theme_loader_get_type(void); - -G_END_DECLS -#endif /* PURPLE_SOUND_THEME_LOADER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,333 +0,0 @@ -/** - * @file sslconn.c SSL API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_SSLCONN_C_ - -#include "internal.h" - -#include "certificate.h" -#include "debug.h" -#include "request.h" -#include "sslconn.h" - -static gboolean _ssl_initialized = FALSE; -static PurpleSslOps *_ssl_ops = NULL; - -static gboolean -ssl_init(void) -{ - PurplePlugin *plugin; - PurpleSslOps *ops; - - if (_ssl_initialized) - return FALSE; - - plugin = purple_plugins_find_with_id("core-ssl"); - - if (plugin != NULL && !purple_plugin_is_loaded(plugin)) - purple_plugin_load(plugin); - - ops = purple_ssl_get_ops(); - if ((ops == NULL) || (ops->init == NULL) || (ops->uninit == NULL) || - (ops->connectfunc == NULL) || (ops->close == NULL) || - (ops->read == NULL) || (ops->write == NULL)) - { - return FALSE; - } - - return (_ssl_initialized = ops->init()); -} - -gboolean -purple_ssl_is_supported(void) -{ -#ifdef HAVE_SSL - ssl_init(); - return (purple_ssl_get_ops() != NULL); -#else - return FALSE; -#endif -} - -static void -purple_ssl_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleSslConnection *gsc; - PurpleSslOps *ops; - - gsc = data; - gsc->connect_data = NULL; - - if (source < 0) - { - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); - - purple_ssl_close(gsc); - return; - } - - gsc->fd = source; - - ops = purple_ssl_get_ops(); - ops->connectfunc(gsc); -} - -PurpleSslConnection * -purple_ssl_connect(PurpleAccount *account, const char *host, int port, - PurpleSslInputFunction func, PurpleSslErrorFunction error_func, - void *data) -{ - return purple_ssl_connect_with_ssl_cn(account, host, port, func, error_func, - NULL, data); -} - -PurpleSslConnection * -purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int port, - PurpleSslInputFunction func, PurpleSslErrorFunction error_func, - const char *ssl_cn, void *data) -{ - PurpleSslConnection *gsc; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port != 0 && port != -1, NULL); - g_return_val_if_fail(func != NULL, NULL); - g_return_val_if_fail(purple_ssl_is_supported(), NULL); - - if (!_ssl_initialized) - { - if (!ssl_init()) - return NULL; - } - - gsc = g_new0(PurpleSslConnection, 1); - - gsc->fd = -1; - gsc->host = ssl_cn ? g_strdup(ssl_cn) : g_strdup(host); - gsc->port = port; - gsc->connect_cb_data = data; - gsc->connect_cb = func; - gsc->error_cb = error_func; - - /* TODO: Move this elsewhere */ - gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); - - gsc->connect_data = purple_proxy_connect(NULL, account, host, port, purple_ssl_connect_cb, gsc); - - if (gsc->connect_data == NULL) - { - g_free(gsc->host); - g_free(gsc); - - return NULL; - } - - return (PurpleSslConnection *)gsc; -} - -static void -recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleSslConnection *gsc = data; - - gsc->recv_cb(gsc->recv_cb_data, gsc, cond); -} - -void -purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, - void *data) -{ - g_return_if_fail(func != NULL); - g_return_if_fail(purple_ssl_is_supported()); - - gsc->recv_cb_data = data; - gsc->recv_cb = func; - - gsc->inpa = purple_input_add(gsc->fd, PURPLE_INPUT_READ, recv_cb, gsc); -} - -const gchar * -purple_ssl_strerror(PurpleSslErrorType error) -{ - switch(error) { - case PURPLE_SSL_CONNECT_FAILED: - return _("SSL Connection Failed"); - case PURPLE_SSL_HANDSHAKE_FAILED: - return _("SSL Handshake Failed"); - case PURPLE_SSL_CERTIFICATE_INVALID: - return _("SSL peer presented an invalid certificate"); - default: - purple_debug_warning("sslconn", "Unknown SSL error code %d\n", error); - return _("Unknown SSL error"); - } -} - -PurpleSslConnection * -purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data) -{ - return purple_ssl_connect_with_host_fd(account, fd, func, error_func, NULL, data); -} - -PurpleSslConnection * -purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - const char *host, - void *data) -{ - PurpleSslConnection *gsc; - PurpleSslOps *ops; - - g_return_val_if_fail(fd != -1, NULL); - g_return_val_if_fail(func != NULL, NULL); - g_return_val_if_fail(purple_ssl_is_supported(), NULL); - - if (!_ssl_initialized) - { - if (!ssl_init()) - return NULL; - } - - gsc = g_new0(PurpleSslConnection, 1); - - gsc->connect_cb_data = data; - gsc->connect_cb = func; - gsc->error_cb = error_func; - gsc->fd = fd; - if(host) - gsc->host = g_strdup(host); - - /* TODO: Move this elsewhere */ - gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); - - - ops = purple_ssl_get_ops(); - ops->connectfunc(gsc); - - return (PurpleSslConnection *)gsc; -} - -void -purple_ssl_close(PurpleSslConnection *gsc) -{ - PurpleSslOps *ops; - - g_return_if_fail(gsc != NULL); - - purple_request_close_with_handle(gsc); - purple_notify_close_with_handle(gsc); - - ops = purple_ssl_get_ops(); - (ops->close)(gsc); - - if (gsc->connect_data != NULL) - purple_proxy_connect_cancel(gsc->connect_data); - - if (gsc->inpa > 0) - purple_input_remove(gsc->inpa); - - if (gsc->fd >= 0) - close(gsc->fd); - - g_free(gsc->host); - g_free(gsc); -} - -size_t -purple_ssl_read(PurpleSslConnection *gsc, void *data, size_t len) -{ - PurpleSslOps *ops; - - g_return_val_if_fail(gsc != NULL, 0); - g_return_val_if_fail(data != NULL, 0); - g_return_val_if_fail(len > 0, 0); - - ops = purple_ssl_get_ops(); - return (ops->read)(gsc, data, len); -} - -size_t -purple_ssl_write(PurpleSslConnection *gsc, const void *data, size_t len) -{ - PurpleSslOps *ops; - - g_return_val_if_fail(gsc != NULL, 0); - g_return_val_if_fail(data != NULL, 0); - g_return_val_if_fail(len > 0, 0); - - ops = purple_ssl_get_ops(); - return (ops->write)(gsc, data, len); -} - -GList * -purple_ssl_get_peer_certificates(PurpleSslConnection *gsc) -{ - PurpleSslOps *ops; - - g_return_val_if_fail(gsc != NULL, NULL); - - ops = purple_ssl_get_ops(); - return (ops->get_peer_certificates)(gsc); -} - -void -purple_ssl_set_ops(PurpleSslOps *ops) -{ - _ssl_ops = ops; -} - -PurpleSslOps * -purple_ssl_get_ops(void) -{ - return _ssl_ops; -} - -void -purple_ssl_init(void) -{ - /* Although purple_ssl_is_supported will do the initialization on - command, SSL plugins tend to register CertificateSchemes as well - as providing SSL ops. */ - if (!ssl_init()) { - purple_debug_error("sslconn", "Unable to initialize SSL.\n"); - } -} - -void -purple_ssl_uninit(void) -{ - PurpleSslOps *ops; - - if (!_ssl_initialized) - return; - - ops = purple_ssl_get_ops(); - ops->uninit(); - - _ssl_initialized = FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/sslconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,343 +0,0 @@ -/** - * @file sslconn.h SSL API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SSLCONN_H_ -#define _PURPLE_SSLCONN_H_ - -/** Possible SSL errors. */ -typedef enum -{ - PURPLE_SSL_HANDSHAKE_FAILED = 1, - PURPLE_SSL_CONNECT_FAILED = 2, - PURPLE_SSL_CERTIFICATE_INVALID = 3 -} PurpleSslErrorType; - -#include "certificate.h" -#include "proxy.h" - -#define PURPLE_SSL_DEFAULT_PORT 443 - -/** @copydoc _PurpleSslConnection */ -typedef struct _PurpleSslConnection PurpleSslConnection; - -typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, - PurpleInputCondition); -typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, - gpointer); - -struct _PurpleSslConnection -{ - /** Hostname to which the SSL connection will be made */ - char *host; - /** Port to connect to */ - int port; - /** Data to pass to PurpleSslConnection::connect_cb() */ - void *connect_cb_data; - /** Callback triggered once the SSL handshake is complete */ - PurpleSslInputFunction connect_cb; - /** Callback triggered if there is an error during connection */ - PurpleSslErrorFunction error_cb; - /** Data passed to PurpleSslConnection::recv_cb() */ - void *recv_cb_data; - /** User-defined callback executed when the SSL connection receives data */ - PurpleSslInputFunction recv_cb; - - /** File descriptor used to refer to the socket */ - int fd; - /** Glib event source ID; used to refer to the received data callback - * in the glib eventloop */ - guint inpa; - /** Data related to the underlying TCP connection */ - PurpleProxyConnectData *connect_data; - - /** Internal connection data managed by the SSL backend (GnuTLS/LibNSS/whatever) */ - void *private_data; - - /** Verifier to use in authenticating the peer */ - PurpleCertificateVerifier *verifier; -}; - -/** - * SSL implementation operations structure. - * - * Every SSL implementation must provide all of these and register it via purple_ssl_set_ops() - * These should not be called directly! Instead, use the purple_ssl_* functions. - */ -typedef struct -{ - /** Initializes the SSL system provided. - * @return @a TRUE if initialization succeeded - * @see purple_ssl_init - */ - gboolean (*init)(void); - /** Unloads the SSL system. Inverse of PurpleSslOps::init. - * @see purple_ssl_uninit - */ - void (*uninit)(void); - /** Sets up the SSL connection for a #PurpleSslConnection once - * the TCP connection has been established - * @see purple_ssl_connect - */ - void (*connectfunc)(PurpleSslConnection *gsc); - /** Destroys the internal data of the SSL connection provided. - * Freeing gsc itself is left to purple_ssl_close() - * @see purple_ssl_close - */ - void (*close)(PurpleSslConnection *gsc); - /** Reads data from a connection (like POSIX read()) - * @param gsc Connection context - * @param data Pointer to buffer to drop data into - * @param len Maximum number of bytes to read - * @return Number of bytes actually written into @a data (which may be - * less than @a len), or <0 on error - * @see purple_ssl_read - */ - size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len); - /** Writes data to a connection (like POSIX send()) - * @param gsc Connection context - * @param data Data buffer to send data from - * @param len Number of bytes to send from buffer - * @return The number of bytes written to @a data (may be less than - * @a len) or <0 on error - * @see purple_ssl_write - */ - size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); - /** Obtains the certificate chain provided by the peer - * - * @param gsc Connection context - * @return A newly allocated list containing the certificates - * the peer provided. - * @see PurpleCertificate - * @todo Decide whether the ordering of certificates in this - * list can be guaranteed. - */ - GList * (* get_peer_certificates)(PurpleSslConnection * gsc); - - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleSslOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name SSL API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns whether or not SSL is currently supported. - * - * @return @a TRUE if SSL is supported, or @a FALSE otherwise. - */ -gboolean purple_ssl_is_supported(void); - -/** - * Returns a human-readable string for an SSL error. - * - * @param error Error code - * @return Human-readable error explanation - */ -const gchar * purple_ssl_strerror(PurpleSslErrorType error); - -/** - * Makes a SSL connection to the specified host and port. The caller - * should keep track of the returned value and use it to cancel the - * connection, if needed. - * - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. This function - * should NOT call purple_ssl_close(). In - * the event of an error the #PurpleSslConnection will be - * destroyed for you. - * @param data User-defined data. - * - * @return The SSL connection handle. - */ -PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host, - int port, PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data); - -/** - * Makes a SSL connection to the specified host and port, using the separate - * name to verify with the certificate. The caller should keep track of the - * returned value and use it to cancel the connection, if needed. - * - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. This function - * should NOT call purple_ssl_close(). In - * the event of an error the #PurpleSslConnection will be - * destroyed for you. - * @param ssl_host The hostname of the other peer (to verify the CN) - * @param data User-defined data. - * - * @return The SSL connection handle. - * @since 2.6.0 - */ -PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, - int port, PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - const char *ssl_host, - void *data); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_SSLCONN_C_) -/** - * Makes a SSL connection using an already open file descriptor. - * - * @deprecated Use purple_ssl_connect_with_host_fd() instead. - * - * @param account The account making the connection. - * @param fd The file descriptor. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. - * @param data User-defined data. - * - * @return The SSL connection handle. - */ -PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data); -#endif - -/** - * Makes a SSL connection using an already open file descriptor. - * - * @param account The account making the connection. - * @param fd The file descriptor. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. - * @param host The hostname of the other peer (to verify the CN) - * @param data User-defined data. - * - * @return The SSL connection handle. - * - * @since 2.2.0 - */ -PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - const char *host, - void *data); - -/** - * Adds an input watcher for the specified SSL connection. - * Once the SSL handshake is complete, use this to watch for actual data across it. - * - * @param gsc The SSL connection handle. - * @param func The callback function. - * @param data User-defined data. - */ -void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, - void *data); - -/** - * Closes a SSL connection. - * - * @param gsc The SSL connection to close. - */ -void purple_ssl_close(PurpleSslConnection *gsc); - -/** - * Reads data from an SSL connection. - * - * @param gsc The SSL connection handle. - * @param buffer The destination buffer. - * @param len The maximum number of bytes to read. - * - * @return The number of bytes read. - */ -size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len); - -/** - * Writes data to an SSL connection. - * - * @param gsc The SSL connection handle. - * @param buffer The buffer to write. - * @param len The length of the data to write. - * - * @return The number of bytes written. - */ -size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len); - -/** - * Obtains the peer's presented certificates - * - * @param gsc The SSL connection handle - * - * @return The peer certificate chain, in the order of certificate, issuer, - * issuer's issuer, etc. @a NULL if no certificates have been provided, - * - * @since 2.2.0 - */ -GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); - -/*@}*/ - -/**************************************************************************/ -/** @name Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the current SSL operations structure. - * - * @param ops The SSL operations structure to assign. - */ -void purple_ssl_set_ops(PurpleSslOps *ops); - -/** - * Returns the current SSL operations structure. - * - * @return The SSL operations structure. - */ -PurpleSslOps *purple_ssl_get_ops(void); - -/** - * Initializes the SSL subsystem. - */ -void purple_ssl_init(void); - -/** - * Uninitializes the SSL subsystem. - */ -void purple_ssl_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SSLCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1718 +0,0 @@ -/** - * @file status.c Status API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_STATUS_C_ - -#include "internal.h" - -#include "blist.h" -#include "core.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "status.h" - -/** - * A type of status. - */ -struct _PurpleStatusType -{ - PurpleStatusPrimitive primitive; - - char *id; - char *name; - char *primary_attr_id; - - gboolean saveable; - gboolean user_settable; - gboolean independent; - - GList *attrs; -}; - -/** - * A status attribute. - */ -struct _PurpleStatusAttr -{ - char *id; - char *name; - PurpleValue *value_type; -}; - -/** - * A list of statuses. - */ -struct _PurplePresence -{ - PurplePresenceContext context; - - gboolean idle; - time_t idle_time; - time_t login_time; - - GList *statuses; - GHashTable *status_table; - - PurpleStatus *active_status; - - union - { - PurpleAccount *account; - - struct - { - PurpleConversation *conv; - char *user; - - } chat; - - struct - { - PurpleAccount *account; - char *name; - PurpleBuddy *buddy; - - } buddy; - - } u; -}; - -/** - * An active status. - */ -struct _PurpleStatus -{ - PurpleStatusType *type; - PurplePresence *presence; - - gboolean active; - - /* - * The current values of the attributes for this status. The - * key is a string containing the name of the attribute. It is - * a borrowed reference from the list of attrs in the - * PurpleStatusType. The value is a PurpleValue. - */ - GHashTable *attr_values; -}; - -typedef struct -{ - PurpleAccount *account; - char *name; -} PurpleStatusBuddyKey; - -static int primitive_scores[] = -{ - 0, /* unset */ - -500, /* offline */ - 100, /* available */ - -75, /* unavailable */ - -50, /* invisible */ - -100, /* away */ - -200, /* extended away */ - -400, /* mobile */ - 0, /* tune */ - -10, /* idle, special case. */ - -5, /* idle time, special case. */ - 10 /* Offline messageable */ -}; - -#define SCORE_IDLE 9 -#define SCORE_IDLE_TIME 10 -#define SCORE_OFFLINE_MESSAGE 11 - -/************************************************************************** - * PurpleStatusPrimitive API - **************************************************************************/ -static struct PurpleStatusPrimitiveMap -{ - PurpleStatusPrimitive type; - const char *id; - const char *name; - -} const status_primitive_map[] = -{ - { PURPLE_STATUS_UNSET, "unset", N_("Unset") }, - { PURPLE_STATUS_OFFLINE, "offline", N_("Offline") }, - { PURPLE_STATUS_AVAILABLE, "available", N_("Available") }, - { PURPLE_STATUS_UNAVAILABLE, "unavailable", N_("Do not disturb") }, - { PURPLE_STATUS_INVISIBLE, "invisible", N_("Invisible") }, - { PURPLE_STATUS_AWAY, "away", N_("Away") }, - { PURPLE_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended away") }, - { PURPLE_STATUS_MOBILE, "mobile", N_("Mobile") }, - { PURPLE_STATUS_TUNE, "tune", N_("Listening to music") } -}; - -const char * -purple_primitive_get_id_from_type(PurpleStatusPrimitive type) -{ - int i; - - for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) - { - if (type == status_primitive_map[i].type) - return status_primitive_map[i].id; - } - - return status_primitive_map[0].id; -} - -const char * -purple_primitive_get_name_from_type(PurpleStatusPrimitive type) -{ - int i; - - for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) - { - if (type == status_primitive_map[i].type) - return _(status_primitive_map[i].name); - } - - return _(status_primitive_map[0].name); -} - -PurpleStatusPrimitive -purple_primitive_get_type_from_id(const char *id) -{ - int i; - - g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET); - - for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) - { - if (purple_strequal(id, status_primitive_map[i].id)) - return status_primitive_map[i].type; - } - - return status_primitive_map[0].type; -} - - -/************************************************************************** - * PurpleStatusType API - **************************************************************************/ -PurpleStatusType * -purple_status_type_new_full(PurpleStatusPrimitive primitive, const char *id, - const char *name, gboolean saveable, - gboolean user_settable, gboolean independent) -{ - PurpleStatusType *status_type; - - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); - - status_type = g_new0(PurpleStatusType, 1); - PURPLE_DBUS_REGISTER_POINTER(status_type, PurpleStatusType); - - status_type->primitive = primitive; - status_type->saveable = saveable; - status_type->user_settable = user_settable; - status_type->independent = independent; - - if (id != NULL) - status_type->id = g_strdup(id); - else - status_type->id = g_strdup(purple_primitive_get_id_from_type(primitive)); - - if (name != NULL) - status_type->name = g_strdup(name); - else - status_type->name = g_strdup(purple_primitive_get_name_from_type(primitive)); - - return status_type; -} - -PurpleStatusType * -purple_status_type_new(PurpleStatusPrimitive primitive, const char *id, - const char *name, gboolean user_settable) -{ - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); - - return purple_status_type_new_full(primitive, id, name, TRUE, - user_settable, FALSE); -} - -PurpleStatusType * -purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, - const char *id, const char *name, - gboolean saveable, gboolean user_settable, - gboolean independent, const char *attr_id, - const char *attr_name, PurpleValue *attr_value, - ...) -{ - PurpleStatusType *status_type; - va_list args; - - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); - g_return_val_if_fail(attr_id != NULL, NULL); - g_return_val_if_fail(attr_name != NULL, NULL); - g_return_val_if_fail(attr_value != NULL, NULL); - - status_type = purple_status_type_new_full(primitive, id, name, saveable, - user_settable, independent); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, attr_id, attr_name, attr_value); - - va_start(args, attr_value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); - - return status_type; -} - -void -purple_status_type_destroy(PurpleStatusType *status_type) -{ - g_return_if_fail(status_type != NULL); - - g_free(status_type->id); - g_free(status_type->name); - g_free(status_type->primary_attr_id); - - g_list_foreach(status_type->attrs, (GFunc)purple_status_attr_destroy, NULL); - g_list_free(status_type->attrs); - - PURPLE_DBUS_UNREGISTER_POINTER(status_type); - g_free(status_type); -} - -void -purple_status_type_set_primary_attr(PurpleStatusType *status_type, const char *id) -{ - g_return_if_fail(status_type != NULL); - - g_free(status_type->primary_attr_id); - status_type->primary_attr_id = g_strdup(id); -} - -void -purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value) -{ - PurpleStatusAttr *attr; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - attr = purple_status_attr_new(id, name, value); - - status_type->attrs = g_list_append(status_type->attrs, attr); -} - -void -purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) -{ - const char *id, *name; - PurpleValue *value; - - g_return_if_fail(status_type != NULL); - - while ((id = va_arg(args, const char *)) != NULL) - { - name = va_arg(args, const char *); - g_return_if_fail(name != NULL); - - value = va_arg(args, PurpleValue *); - g_return_if_fail(value != NULL); - - purple_status_type_add_attr(status_type, id, name, value); - } -} - -void -purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) -{ - va_list args; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, id, name, value); - - va_start(args, value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); -} - -PurpleStatusPrimitive -purple_status_type_get_primitive(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, PURPLE_STATUS_UNSET); - - return status_type->primitive; -} - -const char * -purple_status_type_get_id(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->id; -} - -const char * -purple_status_type_get_name(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->name; -} - -gboolean -purple_status_type_is_saveable(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return status_type->saveable; -} - -gboolean -purple_status_type_is_user_settable(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return status_type->user_settable; -} - -gboolean -purple_status_type_is_independent(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return status_type->independent; -} - -gboolean -purple_status_type_is_exclusive(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return !status_type->independent; -} - -gboolean -purple_status_type_is_available(const PurpleStatusType *status_type) -{ - PurpleStatusPrimitive primitive; - - g_return_val_if_fail(status_type != NULL, FALSE); - - primitive = purple_status_type_get_primitive(status_type); - - return (primitive == PURPLE_STATUS_AVAILABLE); -} - -const char * -purple_status_type_get_primary_attr(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->primary_attr_id; -} - -PurpleStatusAttr * -purple_status_type_get_attr(const PurpleStatusType *status_type, const char *id) -{ - GList *l; - - g_return_val_if_fail(status_type != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - for (l = status_type->attrs; l != NULL; l = l->next) - { - PurpleStatusAttr *attr = (PurpleStatusAttr *)l->data; - - if (purple_strequal(purple_status_attr_get_id(attr), id)) - return attr; - } - - return NULL; -} - -GList * -purple_status_type_get_attrs(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->attrs; -} - -const PurpleStatusType * -purple_status_type_find_with_id(GList *status_types, const char *id) -{ - PurpleStatusType *status_type; - - g_return_val_if_fail(id != NULL, NULL); - - while (status_types != NULL) - { - status_type = status_types->data; - - if (purple_strequal(id, status_type->id)) - return status_type; - - status_types = status_types->next; - } - - return NULL; -} - - -/************************************************************************** -* PurpleStatusAttr API -**************************************************************************/ -PurpleStatusAttr * -purple_status_attr_new(const char *id, const char *name, PurpleValue *value_type) -{ - PurpleStatusAttr *attr; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(value_type != NULL, NULL); - - attr = g_new0(PurpleStatusAttr, 1); - PURPLE_DBUS_REGISTER_POINTER(attr, PurpleStatusAttr); - - attr->id = g_strdup(id); - attr->name = g_strdup(name); - attr->value_type = value_type; - - return attr; -} - -void -purple_status_attr_destroy(PurpleStatusAttr *attr) -{ - g_return_if_fail(attr != NULL); - - g_free(attr->id); - g_free(attr->name); - - purple_value_destroy(attr->value_type); - - PURPLE_DBUS_UNREGISTER_POINTER(attr); - g_free(attr); -} - -const char * -purple_status_attr_get_id(const PurpleStatusAttr *attr) -{ - g_return_val_if_fail(attr != NULL, NULL); - - return attr->id; -} - -const char * -purple_status_attr_get_name(const PurpleStatusAttr *attr) -{ - g_return_val_if_fail(attr != NULL, NULL); - - return attr->name; -} - -PurpleValue * -purple_status_attr_get_value(const PurpleStatusAttr *attr) -{ - g_return_val_if_fail(attr != NULL, NULL); - - return attr->value_type; -} - - -/************************************************************************** -* PurpleStatus API -**************************************************************************/ -PurpleStatus * -purple_status_new(PurpleStatusType *status_type, PurplePresence *presence) -{ - PurpleStatus *status; - GList *l; - - g_return_val_if_fail(status_type != NULL, NULL); - g_return_val_if_fail(presence != NULL, NULL); - - status = g_new0(PurpleStatus, 1); - PURPLE_DBUS_REGISTER_POINTER(status, PurpleStatus); - - status->type = status_type; - status->presence = presence; - - status->attr_values = - g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - (GDestroyNotify)purple_value_destroy); - - for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) - { - PurpleStatusAttr *attr = (PurpleStatusAttr *)l->data; - PurpleValue *value = purple_status_attr_get_value(attr); - PurpleValue *new_value = purple_value_dup(value); - - g_hash_table_insert(status->attr_values, - (char *)purple_status_attr_get_id(attr), - new_value); - } - - return status; -} - -/* - * TODO: If the PurpleStatus is in a PurplePresence, then - * remove it from the PurplePresence? - */ -void -purple_status_destroy(PurpleStatus *status) -{ - g_return_if_fail(status != NULL); - - g_hash_table_destroy(status->attr_values); - - PURPLE_DBUS_UNREGISTER_POINTER(status); - g_free(status); -} - -static void -notify_buddy_status_update(PurpleBuddy *buddy, PurplePresence *presence, - PurpleStatus *old_status, PurpleStatus *new_status) -{ - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - time_t current_time = time(NULL); - const char *buddy_alias = purple_buddy_get_alias(buddy); - char *tmp, *logtmp; - PurpleLog *log; - - if (old_status != NULL) - { - tmp = g_strdup_printf(_("%s (%s) changed status from %s to %s"), buddy_alias, - purple_buddy_get_name(buddy), - purple_status_get_name(old_status), - purple_status_get_name(new_status)); - logtmp = g_markup_escape_text(tmp, -1); - } - else - { - /* old_status == NULL when an independent status is toggled. */ - - if (purple_status_is_active(new_status)) - { - tmp = g_strdup_printf(_("%s (%s) is now %s"), buddy_alias, - purple_buddy_get_name(buddy), - purple_status_get_name(new_status)); - logtmp = g_markup_escape_text(tmp, -1); - } - else - { - tmp = g_strdup_printf(_("%s (%s) is no longer %s"), buddy_alias, - purple_buddy_get_name(buddy), - purple_status_get_name(new_status)); - logtmp = g_markup_escape_text(tmp, -1); - } - } - - log = purple_account_get_log(purple_buddy_get_account(buddy), FALSE); - if (log != NULL) - { - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, buddy_alias, - current_time, logtmp); - } - - g_free(tmp); - g_free(logtmp); - } -} - -static void -notify_status_update(PurplePresence *presence, PurpleStatus *old_status, - PurpleStatus *new_status) -{ - PurplePresenceContext context = purple_presence_get_context(presence); - - if (context == PURPLE_PRESENCE_CONTEXT_ACCOUNT) - { - PurpleAccount *account = purple_presence_get_account(presence); - PurpleAccountUiOps *ops = purple_accounts_get_ui_ops(); - - if (purple_account_get_enabled(account, purple_core_get_ui())) - purple_prpl_change_account_status(account, old_status, new_status); - - if (ops != NULL && ops->status_changed != NULL) - { - ops->status_changed(account, new_status); - } - } - else if (context == PURPLE_PRESENCE_CONTEXT_BUDDY) - { - notify_buddy_status_update(purple_presence_get_buddy(presence), presence, - old_status, new_status); - } -} - -static void -status_has_changed(PurpleStatus *status) -{ - PurplePresence *presence; - PurpleStatus *old_status; - - presence = purple_status_get_presence(status); - - /* - * If this status is exclusive, then we must be setting it to "active." - * Since we are setting it to active, we want to set the currently - * active status to "inactive." - */ - if (purple_status_is_exclusive(status)) - { - old_status = purple_presence_get_active_status(presence); - if (old_status != NULL && (old_status != status)) - old_status->active = FALSE; - presence->active_status = status; - } - else - old_status = NULL; - - notify_status_update(presence, old_status, status); -} - -void -purple_status_set_active(PurpleStatus *status, gboolean active) -{ - purple_status_set_active_with_attrs_list(status, active, NULL); -} - -/* - * This used to parse the va_list directly, but now it creates a GList - * and passes it to purple_status_set_active_with_attrs_list(). That - * function was created because accounts.c needs to pass a GList of - * attributes to the status API. - */ -void -purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, va_list args) -{ - GList *attrs = NULL; - const gchar *id; - gpointer data; - - while ((id = va_arg(args, const char *)) != NULL) - { - attrs = g_list_append(attrs, (char *)id); - data = va_arg(args, void *); - attrs = g_list_append(attrs, data); - } - purple_status_set_active_with_attrs_list(status, active, attrs); - g_list_free(attrs); -} - -void -purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, - GList *attrs) -{ - gboolean changed = FALSE; - GList *l; - GList *specified_attr_ids = NULL; - PurpleStatusType *status_type; - - g_return_if_fail(status != NULL); - - if (!active && purple_status_is_exclusive(status)) - { - purple_debug_error("status", - "Cannot deactivate an exclusive status (%s).\n", - purple_status_get_id(status)); - return; - } - - if (status->active != active) - { - changed = TRUE; - } - - status->active = active; - - /* Set any attributes */ - l = attrs; - while (l != NULL) - { - const gchar *id; - PurpleValue *value; - - id = l->data; - l = l->next; - value = purple_status_get_attr_value(status, id); - if (value == NULL) - { - purple_debug_warning("status", "The attribute \"%s\" on the status \"%s\" is " - "not supported.\n", id, status->type->name); - /* Skip over the data and move on to the next attribute */ - l = l->next; - continue; - } - - specified_attr_ids = g_list_prepend(specified_attr_ids, (gpointer)id); - - if (value->type == PURPLE_TYPE_STRING) - { - const gchar *string_data = l->data; - l = l->next; - if (purple_strequal(string_data, value->data.string_data)) - continue; - purple_status_set_attr_string(status, id, string_data); - changed = TRUE; - } - else if (value->type == PURPLE_TYPE_INT) - { - int int_data = GPOINTER_TO_INT(l->data); - l = l->next; - if (int_data == value->data.int_data) - continue; - purple_status_set_attr_int(status, id, int_data); - changed = TRUE; - } - else if (value->type == PURPLE_TYPE_BOOLEAN) - { - gboolean boolean_data = GPOINTER_TO_INT(l->data); - l = l->next; - if (boolean_data == value->data.boolean_data) - continue; - purple_status_set_attr_boolean(status, id, boolean_data); - changed = TRUE; - } - else - { - /* We don't know what the data is--skip over it */ - l = l->next; - } - } - - /* Reset any unspecified attributes to their default value */ - status_type = purple_status_get_type(status); - l = purple_status_type_get_attrs(status_type); - while (l != NULL) { - PurpleStatusAttr *attr; - - attr = l->data; - l = l->next; - - if (!g_list_find_custom(specified_attr_ids, attr->id, (GCompareFunc)strcmp)) { - PurpleValue *default_value; - default_value = purple_status_attr_get_value(attr); - if (default_value->type == PURPLE_TYPE_STRING) { - const char *cur = purple_status_get_attr_string(status, attr->id); - const char *def = purple_value_get_string(default_value); - if ((cur == NULL && def == NULL) - || (cur != NULL && def != NULL - && !strcmp(cur, def))) { - continue; - } - - purple_status_set_attr_string(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_INT) { - int cur = purple_status_get_attr_int(status, attr->id); - int def = purple_value_get_int(default_value); - if (cur == def) - continue; - - purple_status_set_attr_int(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_BOOLEAN) { - gboolean cur = purple_status_get_attr_boolean(status, attr->id); - gboolean def = purple_value_get_boolean(default_value); - if (cur == def) - continue; - - purple_status_set_attr_boolean(status, attr->id, def); - } - changed = TRUE; - } - } - g_list_free(specified_attr_ids); - - if (!changed) - return; - status_has_changed(status); -} - -void -purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); - - purple_value_set_boolean(attr_value, value); -} - -void -purple_status_set_attr_int(PurpleStatus *status, const char *id, int value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); - - purple_value_set_int(attr_value, value); -} - -void -purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - /* This used to be g_return_if_fail, but it's failing a LOT, so - * let's generate a log error for now. */ - /* g_return_if_fail(attr_value != NULL); */ - if (attr_value == NULL) { - purple_debug_error("status", - "Attempted to set status attribute '%s' for " - "status '%s', which is not legal. Fix " - "this!\n", id, - purple_status_type_get_name(purple_status_get_type(status))); - return; - } - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); - - /* XXX: Check if the value has actually changed. If it has, and the status - * is active, should this trigger 'status_has_changed'? */ - purple_value_set_string(attr_value, value); -} - -PurpleStatusType * -purple_status_get_type(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return status->type; -} - -PurplePresence * -purple_status_get_presence(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return status->presence; -} - -const char * -purple_status_get_id(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return purple_status_type_get_id(purple_status_get_type(status)); -} - -const char * -purple_status_get_name(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return purple_status_type_get_name(purple_status_get_type(status)); -} - -gboolean -purple_status_is_independent(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return purple_status_type_is_independent(purple_status_get_type(status)); -} - -gboolean -purple_status_is_exclusive(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return purple_status_type_is_exclusive(purple_status_get_type(status)); -} - -gboolean -purple_status_is_available(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return purple_status_type_is_available(purple_status_get_type(status)); -} - -gboolean -purple_status_is_active(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return status->active; -} - -gboolean -purple_status_is_online(const PurpleStatus *status) -{ - PurpleStatusPrimitive primitive; - - g_return_val_if_fail( status != NULL, FALSE); - - primitive = purple_status_type_get_primitive(purple_status_get_type(status)); - - return (primitive != PURPLE_STATUS_UNSET && - primitive != PURPLE_STATUS_OFFLINE); -} - -PurpleValue * -purple_status_get_attr_value(const PurpleStatus *status, const char *id) -{ - g_return_val_if_fail(status != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - return (PurpleValue *)g_hash_table_lookup(status->attr_values, id); -} - -gboolean -purple_status_get_attr_boolean(const PurpleStatus *status, const char *id) -{ - const PurpleValue *value; - - g_return_val_if_fail(status != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - if ((value = purple_status_get_attr_value(status, id)) == NULL) - return FALSE; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN, FALSE); - - return purple_value_get_boolean(value); -} - -int -purple_status_get_attr_int(const PurpleStatus *status, const char *id) -{ - const PurpleValue *value; - - g_return_val_if_fail(status != NULL, 0); - g_return_val_if_fail(id != NULL, 0); - - if ((value = purple_status_get_attr_value(status, id)) == NULL) - return 0; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_INT, 0); - - return purple_value_get_int(value); -} - -const char * -purple_status_get_attr_string(const PurpleStatus *status, const char *id) -{ - const PurpleValue *value; - - g_return_val_if_fail(status != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - if ((value = purple_status_get_attr_value(status, id)) == NULL) - return NULL; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_STRING, NULL); - - return purple_value_get_string(value); -} - -gint -purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2) -{ - PurpleStatusType *type1, *type2; - int score1 = 0, score2 = 0; - - if ((status1 == NULL && status2 == NULL) || - (status1 == status2)) - { - return 0; - } - else if (status1 == NULL) - return 1; - else if (status2 == NULL) - return -1; - - type1 = purple_status_get_type(status1); - type2 = purple_status_get_type(status2); - - if (purple_status_is_active(status1)) - score1 = primitive_scores[purple_status_type_get_primitive(type1)]; - - if (purple_status_is_active(status2)) - score2 = primitive_scores[purple_status_type_get_primitive(type2)]; - - if (score1 > score2) - return -1; - else if (score1 < score2) - return 1; - - return 0; -} - - -/************************************************************************** -* PurplePresence API -**************************************************************************/ -PurplePresence * -purple_presence_new(PurplePresenceContext context) -{ - PurplePresence *presence; - - g_return_val_if_fail(context != PURPLE_PRESENCE_CONTEXT_UNSET, NULL); - - presence = g_new0(PurplePresence, 1); - PURPLE_DBUS_REGISTER_POINTER(presence, PurplePresence); - - presence->context = context; - - presence->status_table = - g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - return presence; -} - -PurplePresence * -purple_presence_new_for_account(PurpleAccount *account) -{ - PurplePresence *presence = NULL; - g_return_val_if_fail(account != NULL, NULL); - - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_ACCOUNT); - presence->u.account = account; - presence->statuses = purple_prpl_get_statuses(account, presence); - - return presence; -} - -PurplePresence * -purple_presence_new_for_conv(PurpleConversation *conv) -{ - PurplePresence *presence; - - g_return_val_if_fail(conv != NULL, NULL); - - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_CONV); - presence->u.chat.conv = conv; - /* presence->statuses = purple_prpl_get_statuses(conv->account, presence); ? */ - - return presence; -} - -PurplePresence * -purple_presence_new_for_buddy(PurpleBuddy *buddy) -{ - PurplePresence *presence; - PurpleAccount *account; - - g_return_val_if_fail(buddy != NULL, NULL); - account = purple_buddy_get_account(buddy); - - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_BUDDY); - - presence->u.buddy.name = g_strdup(purple_buddy_get_name(buddy)); - presence->u.buddy.account = account; - presence->statuses = purple_prpl_get_statuses(account, presence); - - presence->u.buddy.buddy = buddy; - - return presence; -} - -void -purple_presence_destroy(PurplePresence *presence) -{ - g_return_if_fail(presence != NULL); - - if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY) - { - g_free(presence->u.buddy.name); - } - else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_CONV) - { - g_free(presence->u.chat.user); - } - - g_list_foreach(presence->statuses, (GFunc)purple_status_destroy, NULL); - g_list_free(presence->statuses); - - g_hash_table_destroy(presence->status_table); - - PURPLE_DBUS_UNREGISTER_POINTER(presence); - g_free(presence); -} - -void -purple_presence_add_status(PurplePresence *presence, PurpleStatus *status) -{ - g_return_if_fail(presence != NULL); - g_return_if_fail(status != NULL); - - presence->statuses = g_list_append(presence->statuses, status); - - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); -} - -void -purple_presence_add_list(PurplePresence *presence, GList *source_list) -{ - GList *l; - - g_return_if_fail(presence != NULL); - g_return_if_fail(source_list != NULL); - - for (l = source_list; l != NULL; l = l->next) - purple_presence_add_status(presence, (PurpleStatus *)l->data); -} - -void -purple_presence_set_status_active(PurplePresence *presence, const char *status_id, - gboolean active) -{ - PurpleStatus *status; - - g_return_if_fail(presence != NULL); - g_return_if_fail(status_id != NULL); - - status = purple_presence_get_status(presence, status_id); - - g_return_if_fail(status != NULL); - /* TODO: Should we do the following? */ - /* g_return_if_fail(active == status->active); */ - - if (purple_status_is_exclusive(status)) - { - if (!active) - { - purple_debug_warning("status", - "Attempted to set a non-independent status " - "(%s) inactive. Only independent statuses " - "can be specifically marked inactive.", - status_id); - return; - } - } - - purple_status_set_active(status, active); -} - -void -purple_presence_switch_status(PurplePresence *presence, const char *status_id) -{ - purple_presence_set_status_active(presence, status_id, TRUE); -} - -static void -update_buddy_idle(PurpleBuddy *buddy, PurplePresence *presence, - time_t current_time, gboolean old_idle, gboolean idle) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleAccount *account = purple_buddy_get_account(buddy); - - if (!old_idle && idle) - { - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *tmp, *tmp2; - tmp = g_strdup_printf(_("%s became idle"), - purple_buddy_get_alias(buddy)); - tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_buddy_get_alias(buddy), current_time, tmp2); - g_free(tmp2); - } - } - } - else if (old_idle && !idle) - { - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *tmp, *tmp2; - tmp = g_strdup_printf(_("%s became unidle"), - purple_buddy_get_alias(buddy)); - tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_buddy_get_alias(buddy), current_time, tmp2); - g_free(tmp2); - } - } - } - - if (old_idle != idle) - purple_signal_emit(purple_blist_get_handle(), "buddy-idle-changed", buddy, - old_idle, idle); - - purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); - - /* Should this be done here? It'd perhaps make more sense to - * connect to buddy-[un]idle signals and update from there - */ - - if (ops != NULL && ops->update != NULL) - ops->update(purple_get_blist(), (PurpleBlistNode *)buddy); -} - -void -purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_time) -{ - gboolean old_idle; - time_t current_time; - - g_return_if_fail(presence != NULL); - - if (presence->idle == idle && presence->idle_time == idle_time) - return; - - old_idle = presence->idle; - presence->idle = idle; - presence->idle_time = (idle ? idle_time : 0); - - current_time = time(NULL); - - if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY) - { - update_buddy_idle(purple_presence_get_buddy(presence), presence, current_time, - old_idle, idle); - } - else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT) - { - PurpleAccount *account; - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - account = purple_presence_get_account(presence); - - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *msg, *tmp; - - if (idle) - tmp = g_strdup_printf(_("+++ %s became idle"), purple_account_get_username(account)); - else - tmp = g_strdup_printf(_("+++ %s became unidle"), purple_account_get_username(account)); - - msg = g_markup_escape_text(tmp, -1); - g_free(tmp); - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_account_get_username(account), - (idle ? idle_time : current_time), msg); - g_free(msg); - } - } - - gc = purple_account_get_connection(account); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(PURPLE_CONNECTION_IS_CONNECTED(gc) && prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && prpl_info->set_idle) - prpl_info->set_idle(gc, (idle ? (current_time - idle_time) : 0)); - } -} - -void -purple_presence_set_login_time(PurplePresence *presence, time_t login_time) -{ - g_return_if_fail(presence != NULL); - - if (presence->login_time == login_time) - return; - - presence->login_time = login_time; -} - -PurplePresenceContext -purple_presence_get_context(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, PURPLE_PRESENCE_CONTEXT_UNSET); - - return presence->context; -} - -PurpleAccount * -purple_presence_get_account(const PurplePresence *presence) -{ - PurplePresenceContext context; - - g_return_val_if_fail(presence != NULL, NULL); - - context = purple_presence_get_context(presence); - - g_return_val_if_fail(context == PURPLE_PRESENCE_CONTEXT_ACCOUNT || - context == PURPLE_PRESENCE_CONTEXT_BUDDY, NULL); - - return presence->u.account; -} - -PurpleConversation * -purple_presence_get_conversation(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(purple_presence_get_context(presence) == - PURPLE_PRESENCE_CONTEXT_CONV, NULL); - - return presence->u.chat.conv; -} - -const char * -purple_presence_get_chat_user(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(purple_presence_get_context(presence) == - PURPLE_PRESENCE_CONTEXT_CONV, NULL); - - return presence->u.chat.user; -} - -PurpleBuddy * -purple_presence_get_buddy(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(purple_presence_get_context(presence) == - PURPLE_PRESENCE_CONTEXT_BUDDY, NULL); - - return presence->u.buddy.buddy; -} - -GList * -purple_presence_get_statuses(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - - return presence->statuses; -} - -PurpleStatus * -purple_presence_get_status(const PurplePresence *presence, const char *status_id) -{ - PurpleStatus *status; - GList *l = NULL; - - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(status_id != NULL, NULL); - - /* What's the purpose of this hash table? */ - status = (PurpleStatus *)g_hash_table_lookup(presence->status_table, - status_id); - - if (status == NULL) { - for (l = purple_presence_get_statuses(presence); - l != NULL && status == NULL; l = l->next) - { - PurpleStatus *temp_status = l->data; - - if (purple_strequal(status_id, purple_status_get_id(temp_status))) - status = temp_status; - } - - if (status != NULL) - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); - } - - return status; -} - -PurpleStatus * -purple_presence_get_active_status(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - - return presence->active_status; -} - -gboolean -purple_presence_is_available(const PurplePresence *presence) -{ - PurpleStatus *status; - - g_return_val_if_fail(presence != NULL, FALSE); - - status = purple_presence_get_active_status(presence); - - return ((status != NULL && purple_status_is_available(status)) && - !purple_presence_is_idle(presence)); -} - -gboolean -purple_presence_is_online(const PurplePresence *presence) -{ - PurpleStatus *status; - - g_return_val_if_fail(presence != NULL, FALSE); - - if ((status = purple_presence_get_active_status(presence)) == NULL) - return FALSE; - - return purple_status_is_online(status); -} - -gboolean -purple_presence_is_status_active(const PurplePresence *presence, - const char *status_id) -{ - PurpleStatus *status; - - g_return_val_if_fail(presence != NULL, FALSE); - g_return_val_if_fail(status_id != NULL, FALSE); - - status = purple_presence_get_status(presence, status_id); - - return (status != NULL && purple_status_is_active(status)); -} - -gboolean -purple_presence_is_status_primitive_active(const PurplePresence *presence, - PurpleStatusPrimitive primitive) -{ - GList *l; - - g_return_val_if_fail(presence != NULL, FALSE); - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, FALSE); - - for (l = purple_presence_get_statuses(presence); - l != NULL; l = l->next) - { - PurpleStatus *temp_status = l->data; - PurpleStatusType *type = purple_status_get_type(temp_status); - - if (purple_status_type_get_primitive(type) == primitive && - purple_status_is_active(temp_status)) - return TRUE; - } - return FALSE; -} - -gboolean -purple_presence_is_idle(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, FALSE); - - return purple_presence_is_online(presence) && presence->idle; -} - -time_t -purple_presence_get_idle_time(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, 0); - - return presence->idle_time; -} - -time_t -purple_presence_get_login_time(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, 0); - - return purple_presence_is_online(presence) ? presence->login_time : 0; -} - -static int -purple_presence_compute_score(const PurplePresence *presence) -{ - GList *l; - int score = 0; - - for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) { - PurpleStatus *status = (PurpleStatus *)l->data; - PurpleStatusType *type = purple_status_get_type(status); - - if (purple_status_is_active(status)) { - score += primitive_scores[purple_status_type_get_primitive(type)]; - if (!purple_status_is_online(status)) { - PurpleBuddy *b = purple_presence_get_buddy(presence); - if (b && purple_account_supports_offline_message(purple_buddy_get_account(b), b)) - score += primitive_scores[SCORE_OFFLINE_MESSAGE]; - } - } - } - score += purple_account_get_int(purple_presence_get_account(presence), "score", 0); - if (purple_presence_is_idle(presence)) - score += primitive_scores[SCORE_IDLE]; - return score; -} - -gint -purple_presence_compare(const PurplePresence *presence1, - const PurplePresence *presence2) -{ - time_t idle_time_1, idle_time_2; - int score1 = 0, score2 = 0; - - if (presence1 == presence2) - return 0; - else if (presence1 == NULL) - return 1; - else if (presence2 == NULL) - return -1; - - if (purple_presence_is_online(presence1) && - !purple_presence_is_online(presence2)) - return -1; - else if (purple_presence_is_online(presence2) && - !purple_presence_is_online(presence1)) - return 1; - - /* Compute the score of the first set of statuses. */ - score1 = purple_presence_compute_score(presence1); - - /* Compute the score of the second set of statuses. */ - score2 = purple_presence_compute_score(presence2); - - idle_time_1 = time(NULL) - purple_presence_get_idle_time(presence1); - idle_time_2 = time(NULL) - purple_presence_get_idle_time(presence2); - - if (idle_time_1 > idle_time_2) - score1 += primitive_scores[SCORE_IDLE_TIME]; - else if (idle_time_1 < idle_time_2) - score2 += primitive_scores[SCORE_IDLE_TIME]; - - if (score1 < score2) - return 1; - else if (score1 > score2) - return -1; - - return 0; -} - - -/************************************************************************** -* Status subsystem -**************************************************************************/ -static void -score_pref_changed_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - int index = GPOINTER_TO_INT(data); - - primitive_scores[index] = GPOINTER_TO_INT(value); -} - -void * -purple_status_get_handle(void) { - static int handle; - - return &handle; -} - -void -purple_status_init(void) -{ - void *handle = purple_status_get_handle(); - - purple_prefs_add_none("/purple/status"); - purple_prefs_add_none("/purple/status/scores"); - - purple_prefs_add_int("/purple/status/scores/offline", - primitive_scores[PURPLE_STATUS_OFFLINE]); - purple_prefs_add_int("/purple/status/scores/available", - primitive_scores[PURPLE_STATUS_AVAILABLE]); - purple_prefs_add_int("/purple/status/scores/invisible", - primitive_scores[PURPLE_STATUS_INVISIBLE]); - purple_prefs_add_int("/purple/status/scores/away", - primitive_scores[PURPLE_STATUS_AWAY]); - purple_prefs_add_int("/purple/status/scores/extended_away", - primitive_scores[PURPLE_STATUS_EXTENDED_AWAY]); - purple_prefs_add_int("/purple/status/scores/idle", - primitive_scores[SCORE_IDLE]); - purple_prefs_add_int("/purple/status/scores/offline_msg", - primitive_scores[SCORE_OFFLINE_MESSAGE]); - - purple_prefs_connect_callback(handle, "/purple/status/scores/offline", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_OFFLINE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/available", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/invisible", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/away", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_AWAY)); - purple_prefs_connect_callback(handle, "/purple/status/scores/extended_away", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_EXTENDED_AWAY)); - purple_prefs_connect_callback(handle, "/purple/status/scores/idle", - score_pref_changed_cb, - GINT_TO_POINTER(SCORE_IDLE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg", - score_pref_changed_cb, - GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE)); - - purple_prefs_trigger_callback("/purple/status/scores/offline"); - purple_prefs_trigger_callback("/purple/status/scores/available"); - purple_prefs_trigger_callback("/purple/status/scores/invisible"); - purple_prefs_trigger_callback("/purple/status/scores/away"); - purple_prefs_trigger_callback("/purple/status/scores/extended_away"); - purple_prefs_trigger_callback("/purple/status/scores/idle"); - purple_prefs_trigger_callback("/purple/status/scores/offline_msg"); -} - -void -purple_status_uninit(void) -{ - purple_prefs_disconnect_by_handle(purple_prefs_get_handle()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/status.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1094 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_STATUS_H_ -#define _PURPLE_STATUS_H_ - -/** - * @file status.h Status API - * @ingroup core - * - * A brief explanation of the status API: - * - * PurpleStatusType's are created by each PRPL. They outline the - * available statuses of the protocol. AIM, for example, supports - * an available state with an optional available message, an away - * state with a mandatory message, and an invisible state (which is - * technically "independent" of the other two, but we'll get into - * that later). PurpleStatusTypes are very permanent. They are - * hardcoded in each PRPL and will not change often. And because - * they are hardcoded, they do not need to be saved to any XML file. - * - * A PurpleStatus can be thought of as an "instance" of a PurpleStatusType. - * If you're familiar with object-oriented programming languages - * then this should be immediately clear. Say, for example, that - * one of your AIM buddies has set himself as "away." You have a - * PurpleBuddy node for this person in your buddy list. Purple wants - * to mark this buddy as "away," so it creates a new PurpleStatus. - * The PurpleStatus has its PurpleStatusType set to the "away" state - * for the oscar PRPL. The PurpleStatus also contains the buddy's - * away message. PurpleStatuses are sometimes saved, depending on - * the context. The current PurpleStatuses associated with each of - * your accounts are saved so that the next time you start Purple, - * your accounts will be set to their last known statuses. There - * is also a list of saved statuses that are written to the - * status.xml file. Also, each PurpleStatus has a "saveable" boolean. - * If "saveable" is set to FALSE then the status is NEVER saved. - * All PurpleStatuses should be inside a PurplePresence. - * - * - * A PurpleStatus is either "independent" or "exclusive." - * Independent statuses can be active or inactive and they don't - * affect anything else. However, you can only have one exclusive - * status per PurplePresence. If you activate one exclusive status, - * then the previous exclusive status is automatically deactivated. - * - * A PurplePresence is like a collection of PurpleStatuses (plus some - * other random info). For any buddy, or for any one of your accounts, - * or for any person with which you're chatting, you may know various - * amounts of information. This information is all contained in - * one PurplePresence. If one of your buddies is away and idle, - * then the presence contains the PurpleStatus for their awayness, - * and it contains their current idle time. PurplePresences are - * never saved to disk. The information they contain is only relevant - * for the current PurpleSession. - */ - -/** - * PurpleStatusType's are created by each PRPL. They outline the - * available statuses of the protocol. AIM, for example, supports - * an available state with an optional available message, an away - * state with a mandatory message, and an invisible state (which is - * technically "independent" of the other two, but we'll get into - * that later). PurpleStatusTypes are very permanent. They are - * hardcoded in each PRPL and will not change often. And because - * they are hardcoded, they do not need to be saved to any XML file. - */ -typedef struct _PurpleStatusType PurpleStatusType; -typedef struct _PurpleStatusAttr PurpleStatusAttr; -typedef struct _PurplePresence PurplePresence; -typedef struct _PurpleStatus PurpleStatus; - -/** - * A context for a presence. - * - * The context indicates to what the presence applies. - */ -typedef enum -{ - PURPLE_PRESENCE_CONTEXT_UNSET = 0, - PURPLE_PRESENCE_CONTEXT_ACCOUNT, - PURPLE_PRESENCE_CONTEXT_CONV, - PURPLE_PRESENCE_CONTEXT_BUDDY - -} PurplePresenceContext; - -/** - * A primitive defining the basic structure of a status type. - */ -/* - * If you add a value to this enum, make sure you update - * the status_primitive_map array in status.c and the special-cases for idle - * and offline-messagable just below it. - */ -typedef enum -{ - PURPLE_STATUS_UNSET = 0, - PURPLE_STATUS_OFFLINE, - PURPLE_STATUS_AVAILABLE, - PURPLE_STATUS_UNAVAILABLE, - PURPLE_STATUS_INVISIBLE, - PURPLE_STATUS_AWAY, - PURPLE_STATUS_EXTENDED_AWAY, - PURPLE_STATUS_MOBILE, - PURPLE_STATUS_TUNE, - PURPLE_STATUS_NUM_PRIMITIVES -} PurpleStatusPrimitive; - -#include "account.h" -#include "blist.h" -#include "conversation.h" -#include "value.h" - -#define PURPLE_TUNE_ARTIST "tune_artist" -#define PURPLE_TUNE_TITLE "tune_title" -#define PURPLE_TUNE_ALBUM "tune_album" -#define PURPLE_TUNE_GENRE "tune_genre" -#define PURPLE_TUNE_COMMENT "tune_comment" -#define PURPLE_TUNE_TRACK "tune_track" -#define PURPLE_TUNE_TIME "tune_time" -#define PURPLE_TUNE_YEAR "tune_year" -#define PURPLE_TUNE_URL "tune_url" -#define PURPLE_TUNE_FULL "tune_full" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name PurpleStatusPrimitive API */ -/**************************************************************************/ -/*@{*/ - -/** - * Lookup the id of a primitive status type based on the type. This - * ID is a unique plain-text name of the status, without spaces. - * - * @param type A primitive status type. - * - * @return The unique ID for this type. - */ -const char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type); - -/** - * Lookup the name of a primitive status type based on the type. This - * name is the plain-English name of the status type. It is usually one - * or two words. - * - * @param type A primitive status type. - * - * @return The name of this type, suitable for users to see. - */ -const char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type); - -/** - * Lookup the value of a primitive status type based on the id. The - * ID is a unique plain-text name of the status, without spaces. - * - * @param id The unique ID of a primitive status type. - * - * @return The PurpleStatusPrimitive value. - */ -PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id); - -/*@}*/ - -/**************************************************************************/ -/** @name PurpleStatusType API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new status type. - * - * @param primitive The primitive status type. - * @param id The ID of the status type, or @c NULL to use the id of - * the primitive status type. - * @param name The name presented to the user, or @c NULL to use the - * name of the primitive status type. - * @param saveable TRUE if the information set for this status by the - * user can be saved for future sessions. - * @param user_settable TRUE if this is a status the user can manually set. - * @param independent TRUE if this is an independent (non-exclusive) - * status type. - * - * @return A new status type. - */ -PurpleStatusType *purple_status_type_new_full(PurpleStatusPrimitive primitive, - const char *id, const char *name, - gboolean saveable, - gboolean user_settable, - gboolean independent); - -/** - * Creates a new status type with some default values ( - * saveable and not independent). - * - * @param primitive The primitive status type. - * @param id The ID of the status type, or @c NULL to use the id of - * the primitive status type. - * @param name The name presented to the user, or @c NULL to use the - * name of the primitive status type. - * @param user_settable TRUE if this is a status the user can manually set. - * - * @return A new status type. - */ -PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive, - const char *id, const char *name, - gboolean user_settable); - -/** - * Creates a new status type with attributes. - * - * @param primitive The primitive status type. - * @param id The ID of the status type, or @c NULL to use the id of - * the primitive status type. - * @param name The name presented to the user, or @c NULL to use the - * name of the primitive status type. - * @param saveable TRUE if the information set for this status by the - * user can be saved for future sessions. - * @param user_settable TRUE if this is a status the user can manually set. - * @param independent TRUE if this is an independent (non-exclusive) - * status type. - * @param attr_id The ID of the first attribute. - * @param attr_name The name of the first attribute. - * @param attr_value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @return A new status type. - */ -PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, - const char *id, - const char *name, - gboolean saveable, - gboolean user_settable, - gboolean independent, - const char *attr_id, - const char *attr_name, - PurpleValue *attr_value, ...) G_GNUC_NULL_TERMINATED; - -/** - * Destroys a status type. - * - * @param status_type The status type to destroy. - */ -void purple_status_type_destroy(PurpleStatusType *status_type); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets a status type's primary attribute. - * - * The value for the primary attribute is used as the description for - * the particular status type. An example is an away message. The message - * would be the primary attribute. - * - * @param status_type The status type. - * @param attr_id The ID of the primary attribute. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_status_type_set_primary_attr(PurpleStatusType *status_type, - const char *attr_id); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds an attribute to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value The value type of this attribute. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the first attribute. - * @param name The description of the first attribute. - * @param value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED; -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type using a va_list. - * - * @param status_type The status type to add the attribute to. - * @param args The va_list of attributes. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, - va_list args); -#endif - -/** - * Returns the primitive type of a status type. - * - * @param status_type The status type. - * - * @return The primitive type of the status type. - */ -PurpleStatusPrimitive purple_status_type_get_primitive( - const PurpleStatusType *status_type); - -/** - * Returns the ID of a status type. - * - * @param status_type The status type. - * - * @return The ID of the status type. - */ -const char *purple_status_type_get_id(const PurpleStatusType *status_type); - -/** - * Returns the name of a status type. - * - * @param status_type The status type. - * - * @return The name of the status type. - */ -const char *purple_status_type_get_name(const PurpleStatusType *status_type); - -/** - * Returns whether or not the status type is saveable. - * - * @param status_type The status type. - * - * @return TRUE if user-defined statuses based off this type are saveable. - * FALSE otherwise. - */ -gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type); - -/** - * Returns whether or not the status type can be set or modified by the - * user. - * - * @param status_type The status type. - * - * @return TRUE if the status type can be set or modified by the user. - * FALSE if it's a protocol-set setting. - */ -gboolean purple_status_type_is_user_settable(const PurpleStatusType *status_type); - -/** - * Returns whether or not the status type is independent. - * - * Independent status types are non-exclusive. If other status types on - * the same hierarchy level are set, this one will not be affected. - * - * @param status_type The status type. - * - * @return TRUE if the status type is independent, or FALSE otherwise. - */ -gboolean purple_status_type_is_independent(const PurpleStatusType *status_type); - -/** - * Returns whether the status type is exclusive. - * - * @param status_type The status type. - * - * @return TRUE if the status type is exclusive, FALSE otherwise. - */ -gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type); - -/** - * Returns whether or not a status type is available. - * - * Available status types are online and possibly invisible, but not away. - * - * @param status_type The status type. - * - * @return TRUE if the status is available, or FALSE otherwise. - */ -gboolean purple_status_type_is_available(const PurpleStatusType *status_type); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Returns a status type's primary attribute ID. - * - * @param type The status type. - * - * @return The primary attribute's ID. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -const char *purple_status_type_get_primary_attr(const PurpleStatusType *type); -#endif - -/** - * Returns the attribute with the specified ID. - * - * @param status_type The status type containing the attribute. - * @param id The ID of the desired attribute. - * - * @return The attribute, if found. NULL otherwise. - */ -PurpleStatusAttr *purple_status_type_get_attr(const PurpleStatusType *status_type, - const char *id); - -/** - * Returns a list of all attributes in a status type. - * - * @param status_type The status type. - * - * @constreturn The list of attributes. - */ -GList *purple_status_type_get_attrs(const PurpleStatusType *status_type); - -/** - * Find the PurpleStatusType with the given id. - * - * @param status_types A list of status types. Often account->status_types. - * @param id The unique ID of the status type you wish to find. - * - * @return The status type with the given ID, or NULL if one could - * not be found. - */ -const PurpleStatusType *purple_status_type_find_with_id(GList *status_types, - const char *id); - -/*@}*/ - -/**************************************************************************/ -/** @name PurpleStatusAttr API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new status attribute. - * - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value_type The type of data contained in the attribute. - * - * @return A new status attribute. - */ -PurpleStatusAttr *purple_status_attr_new(const char *id, const char *name, - PurpleValue *value_type); - -/** - * Destroys a status attribute. - * - * @param attr The status attribute to destroy. - */ -void purple_status_attr_destroy(PurpleStatusAttr *attr); - -/** - * Returns the ID of a status attribute. - * - * @param attr The status attribute. - * - * @return The status attribute's ID. - */ -const char *purple_status_attr_get_id(const PurpleStatusAttr *attr); - -/** - * Returns the name of a status attribute. - * - * @param attr The status attribute. - * - * @return The status attribute's name. - */ -const char *purple_status_attr_get_name(const PurpleStatusAttr *attr); - -/** - * Returns the value of a status attribute. - * - * @param attr The status attribute. - * - * @return The status attribute's value. - */ -PurpleValue *purple_status_attr_get_value(const PurpleStatusAttr *attr); - -/*@}*/ - -/**************************************************************************/ -/** @name PurpleStatus API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new status. - * - * @param status_type The type of status. - * @param presence The parent presence. - * - * @return The new status. - */ -PurpleStatus *purple_status_new(PurpleStatusType *status_type, - PurplePresence *presence); - -/** - * Destroys a status. - * - * @param status The status to destroy. - */ -void purple_status_destroy(PurpleStatus *status); - -/** - * Sets whether or not a status is active. - * - * This should only be called by the account, conversation, and buddy APIs. - * - * @param status The status. - * @param active The active state. - */ -void purple_status_set_active(PurpleStatus *status, gboolean active); - -/** - * Sets whether or not a status is active. - * - * This should only be called by the account, conversation, and buddy APIs. - * - * @param status The status. - * @param active The active state. - * @param args A list of attributes to set on the status. This list is - * composed of key/value pairs, where each key is a valid - * attribute name for this PurpleStatusType. The list should - * be NULL terminated. - */ -void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, - va_list args); - -/** - * Sets whether or not a status is active. - * - * This should only be called by the account, conversation, and buddy APIs. - * - * @param status The status. - * @param active The active state. - * @param attrs A list of attributes to set on the status. This list is - * composed of key/value pairs, where each key is a valid - * attribute name for this PurpleStatusType. The list is - * not modified or freed by this function. - */ -void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, - GList *attrs); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The boolean value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The integer value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_int(PurpleStatus *status, const char *id, - int value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The string value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value); -#endif - -/** - * Returns the status's type. - * - * @param status The status. - * - * @return The status's type. - */ -PurpleStatusType *purple_status_get_type(const PurpleStatus *status); - -/** - * Returns the status's presence. - * - * @param status The status. - * - * @return The status's presence. - */ -PurplePresence *purple_status_get_presence(const PurpleStatus *status); - -/** - * Returns the status's type ID. - * - * This is a convenience method for - * purple_status_type_get_id(purple_status_get_type(status)). - * - * @param status The status. - * - * @return The status's ID. - */ -const char *purple_status_get_id(const PurpleStatus *status); - -/** - * Returns the status's name. - * - * This is a convenience method for - * purple_status_type_get_name(purple_status_get_type(status)). - * - * @param status The status. - * - * @return The status's name. - */ -const char *purple_status_get_name(const PurpleStatus *status); - -/** - * Returns whether or not a status is independent. - * - * This is a convenience method for - * purple_status_type_is_independent(purple_status_get_type(status)). - * - * @param status The status. - * - * @return TRUE if the status is independent, or FALSE otherwise. - */ -gboolean purple_status_is_independent(const PurpleStatus *status); - -/** - * Returns whether or not a status is exclusive. - * - * This is a convenience method for - * purple_status_type_is_exclusive(purple_status_get_type(status)). - * - * @param status The status. - * - * @return TRUE if the status is exclusive, FALSE otherwise. - */ -gboolean purple_status_is_exclusive(const PurpleStatus *status); - -/** - * Returns whether or not a status is available. - * - * Available statuses are online and possibly invisible, but not away or idle. - * - * This is a convenience method for - * purple_status_type_is_available(purple_status_get_type(status)). - * - * @param status The status. - * - * @return TRUE if the status is available, or FALSE otherwise. - */ -gboolean purple_status_is_available(const PurpleStatus *status); - -/** - * Returns the active state of a status. - * - * @param status The status. - * - * @return The active state of the status. - */ -gboolean purple_status_is_active(const PurpleStatus *status); - -/** - * Returns whether or not a status is considered 'online' - * - * @param status The status. - * - * @return TRUE if the status is considered online, FALSE otherwise - */ -gboolean purple_status_is_online(const PurpleStatus *status); - -/** - * Returns the value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The value of the attribute. - */ -PurpleValue *purple_status_get_attr_value(const PurpleStatus *status, - const char *id); - -/** - * Returns the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The boolean value of the attribute. - */ -gboolean purple_status_get_attr_boolean(const PurpleStatus *status, - const char *id); - -/** - * Returns the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The integer value of the attribute. - */ -int purple_status_get_attr_int(const PurpleStatus *status, const char *id); - -/** - * Returns the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The string value of the attribute. - */ -const char *purple_status_get_attr_string(const PurpleStatus *status, - const char *id); - -/** - * Compares two statuses for availability. - * - * @param status1 The first status. - * @param status2 The second status. - * - * @return -1 if @a status1 is more available than @a status2. - * 0 if @a status1 is equal to @a status2. - * 1 if @a status2 is more available than @a status1. - */ -gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2); - -/*@}*/ - -/**************************************************************************/ -/** @name PurplePresence API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new presence. - * - * @param context The presence context. - * - * @return A new presence. - */ -PurplePresence *purple_presence_new(PurplePresenceContext context); - -/** - * Creates a presence for an account. - * - * @param account The account. - * - * @return The new presence. - */ -PurplePresence *purple_presence_new_for_account(PurpleAccount *account); - -/** - * Creates a presence for a conversation. - * - * @param conv The conversation. - * - * @return The new presence. - */ -PurplePresence *purple_presence_new_for_conv(PurpleConversation *conv); - -/** - * Creates a presence for a buddy. - * - * @param buddy The buddy. - * - * @return The new presence. - */ -PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy); - -/** - * Destroys a presence. - * - * All statuses added to this list will be destroyed along with - * the presence. - * - * @param presence The presence to destroy. - */ -void purple_presence_destroy(PurplePresence *presence); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a status to a presence. - * - * @param presence The presence. - * @param status The status to add. - * - * @deprecated This function is only used by purple_presence_add_list, - * and both should be removed in 3.0.0. - */ -void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a list of statuses to the presence. - * - * @param presence The presence. - * @param source_list The source list of statuses to add, which is not - * modified or freed by this function. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_presence_add_list(PurplePresence *presence, GList *source_list); -#endif - -/** - * Sets the active state of a status in a presence. - * - * Only independent statuses can be set unactive. Normal statuses can only - * be set active, so if you wish to disable a status, set another - * non-independent status to active, or use purple_presence_switch_status(). - * - * @param presence The presence. - * @param status_id The ID of the status. - * @param active The active state. - */ -void purple_presence_set_status_active(PurplePresence *presence, - const char *status_id, gboolean active); - -/** - * Switches the active status in a presence. - * - * This is similar to purple_presence_set_status_active(), except it won't - * activate independent statuses. - * - * @param presence The presence. - * @param status_id The status ID to switch to. - */ -void purple_presence_switch_status(PurplePresence *presence, - const char *status_id); - -/** - * Sets the idle state and time on a presence. - * - * @param presence The presence. - * @param idle The idle state. - * @param idle_time The idle time, if @a idle is TRUE. This - * is the time at which the user became idle, - * in seconds since the epoch. If this value is - * unknown then 0 should be used. - */ -void purple_presence_set_idle(PurplePresence *presence, gboolean idle, - time_t idle_time); - -/** - * Sets the login time on a presence. - * - * @param presence The presence. - * @param login_time The login time. - */ -void purple_presence_set_login_time(PurplePresence *presence, time_t login_time); - - -/** - * Returns the presence's context. - * - * @param presence The presence. - * - * @return The presence's context. - */ -PurplePresenceContext purple_presence_get_context(const PurplePresence *presence); - -/** - * Returns a presence's account. - * - * @param presence The presence. - * - * @return The presence's account. - */ -PurpleAccount *purple_presence_get_account(const PurplePresence *presence); - -/** - * Returns a presence's conversation. - * - * @param presence The presence. - * - * @return The presence's conversation. - */ -PurpleConversation *purple_presence_get_conversation(const PurplePresence *presence); - -/** - * Returns a presence's chat user. - * - * @param presence The presence. - * - * @return The chat's user. - */ -const char *purple_presence_get_chat_user(const PurplePresence *presence); - -/** - * Returns the presence's buddy. - * - * @param presence The presence. - * - * @return The presence's buddy. - */ -PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence); - -/** - * Returns all the statuses in a presence. - * - * @param presence The presence. - * - * @constreturn The statuses. - */ -GList *purple_presence_get_statuses(const PurplePresence *presence); - -/** - * Returns the status with the specified ID from a presence. - * - * @param presence The presence. - * @param status_id The ID of the status. - * - * @return The status if found, or NULL. - */ -PurpleStatus *purple_presence_get_status(const PurplePresence *presence, - const char *status_id); - -/** - * Returns the active exclusive status from a presence. - * - * @param presence The presence. - * - * @return The active exclusive status. - */ -PurpleStatus *purple_presence_get_active_status(const PurplePresence *presence); - -/** - * Returns whether or not a presence is available. - * - * Available presences are online and possibly invisible, but not away or idle. - * - * @param presence The presence. - * - * @return TRUE if the presence is available, or FALSE otherwise. - */ -gboolean purple_presence_is_available(const PurplePresence *presence); - -/** - * Returns whether or not a presence is online. - * - * @param presence The presence. - * - * @return TRUE if the presence is online, or FALSE otherwise. - */ -gboolean purple_presence_is_online(const PurplePresence *presence); - -/** - * Returns whether or not a status in a presence is active. - * - * A status is active if itself or any of its sub-statuses are active. - * - * @param presence The presence. - * @param status_id The ID of the status. - * - * @return TRUE if the status is active, or FALSE. - */ -gboolean purple_presence_is_status_active(const PurplePresence *presence, - const char *status_id); - -/** - * Returns whether or not a status with the specified primitive type - * in a presence is active. - * - * A status is active if itself or any of its sub-statuses are active. - * - * @param presence The presence. - * @param primitive The status primitive. - * - * @return TRUE if the status is active, or FALSE. - */ -gboolean purple_presence_is_status_primitive_active( - const PurplePresence *presence, PurpleStatusPrimitive primitive); - -/** - * Returns whether or not a presence is idle. - * - * @param presence The presence. - * - * @return TRUE if the presence is idle, or FALSE otherwise. - * If the presence is offline (purple_presence_is_online() - * returns FALSE) then FALSE is returned. - */ -gboolean purple_presence_is_idle(const PurplePresence *presence); - -/** - * Returns the presence's idle time. - * - * @param presence The presence. - * - * @return The presence's idle time. - */ -time_t purple_presence_get_idle_time(const PurplePresence *presence); - -/** - * Returns the presence's login time. - * - * @param presence The presence. - * - * @return The presence's login time. - */ -time_t purple_presence_get_login_time(const PurplePresence *presence); - -/** - * Compares two presences for availability. - * - * @param presence1 The first presence. - * @param presence2 The second presence. - * - * @return -1 if @a presence1 is more available than @a presence2. - * 0 if @a presence1 is equal to @a presence2. - * 1 if @a presence1 is less available than @a presence2. - */ -gint purple_presence_compare(const PurplePresence *presence1, - const PurplePresence *presence2); - -/*@}*/ - -/**************************************************************************/ -/** @name Status subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Get the handle for the status subsystem. - * - * @return the handle to the status subsystem - */ -void *purple_status_get_handle(void); - -/** - * Initializes the status subsystem. - */ -void purple_status_init(void); - -/** - * Uninitializes the status subsystem. - */ -void purple_status_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_STATUS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -/** - * @file stringref.c Reference-counted immutable strings - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include -#include - -#include "debug.h" -#include "eventloop.h" -#include "stringref.h" - -/** - * The internal representation of a stringref. - * - * @note For this structure to be useful, the string contained within - * it must be immutable -- for this reason, do _not_ access it - * directly! - */ -struct _PurpleStringref { - guint32 ref; /**< The reference count of this string. - * Note that reference counts are only - * 31 bits, and the high-order bit - * indicates whether this string is up - * for GC at the next idle handler... - * But you aren't going to touch this - * anyway, right? */ - char value[1]; /**< The string contained in this ref. - * Notice that it is simply "hanging - * off the end" of the ref ... this - * is to save an allocation. */ -}; - -#define REFCOUNT(x) ((x) & 0x7fffffff) - -static GList *gclist = NULL; - -static void stringref_free(PurpleStringref *stringref); -static gboolean gs_idle_cb(gpointer data); - -PurpleStringref *purple_stringref_new(const char *value) -{ - PurpleStringref *newref; - - if (value == NULL) - return NULL; - - newref = g_malloc(sizeof(PurpleStringref) + strlen(value)); - strcpy(newref->value, value); - newref->ref = 1; - - return newref; -} - -PurpleStringref *purple_stringref_new_noref(const char *value) -{ - PurpleStringref *newref; - - if (value == NULL) - return NULL; - - newref = g_malloc(sizeof(PurpleStringref) + strlen(value)); - strcpy(newref->value, value); - newref->ref = 0x80000000; - - if (gclist == NULL) - purple_timeout_add(0, gs_idle_cb, NULL); - gclist = g_list_prepend(gclist, newref); - - return newref; -} - -PurpleStringref *purple_stringref_printf(const char *format, ...) -{ - PurpleStringref *newref; - va_list ap; - - if (format == NULL) - return NULL; - - va_start(ap, format); - newref = g_malloc(sizeof(PurpleStringref) + g_printf_string_upper_bound(format, ap)); - vsprintf(newref->value, format, ap); - va_end(ap); - newref->ref = 1; - - return newref; -} - -PurpleStringref *purple_stringref_ref(PurpleStringref *stringref) -{ - if (stringref == NULL) - return NULL; - stringref->ref++; - return stringref; -} - -void purple_stringref_unref(PurpleStringref *stringref) -{ - if (stringref == NULL) - return; - if (REFCOUNT(--(stringref->ref)) == 0) { - if (stringref->ref & 0x80000000) - gclist = g_list_remove(gclist, stringref); - stringref_free(stringref); - } -} - -const char *purple_stringref_value(const PurpleStringref *stringref) -{ - return (stringref == NULL ? NULL : stringref->value); -} - -int purple_stringref_cmp(const PurpleStringref *s1, const PurpleStringref *s2) -{ - return (s1 == s2 ? 0 : strcmp(purple_stringref_value(s1), purple_stringref_value(s2))); -} - -size_t purple_stringref_len(const PurpleStringref *stringref) -{ - return strlen(purple_stringref_value(stringref)); -} - -static void stringref_free(PurpleStringref *stringref) -{ -#ifdef DEBUG - if (REFCOUNT(stringref->ref) != 0) { - purple_debug(PURPLE_DEBUG_ERROR, "stringref", "Free of nonzero (%d) ref stringref!\n", REFCOUNT(stringref->ref)); - return; - } -#endif /* DEBUG */ - g_free(stringref); -} - -static gboolean gs_idle_cb(gpointer data) -{ - PurpleStringref *ref; - GList *del; - - while (gclist != NULL) { - ref = gclist->data; - if (REFCOUNT(ref->ref) == 0) { - stringref_free(ref); - } - del = gclist; - gclist = gclist->next; - g_list_free_1(del); - } - - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stringref.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/* TODO: Can we just replace this whole thing with a GCache */ - -/** - * @file stringref.h Reference-counted immutable strings - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _PURPLE_STRINGREF_H_ -#define _PURPLE_STRINGREF_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _PurpleStringref PurpleStringref; - -/** - * Creates an immutable reference-counted string object. The newly - * created object will have a reference count of 1. - * - * @param value This will be the value of the string; it will be - * duplicated. - * - * @return A newly allocated string reference object with a refcount - * of 1. - */ -PurpleStringref *purple_stringref_new(const char *value); - -/** - * Creates an immutable reference-counted string object. The newly - * created object will have a reference count of zero, and if it is - * not referenced before the next iteration of the mainloop it will - * be freed at that time. - * - * @param value This will be the value of the string; it will be - * duplicated. - * - * @return A newly allocated string reference object with a refcount - * of zero. - */ -PurpleStringref *purple_stringref_new_noref(const char *value); - -/** - * Creates an immutable reference-counted string object from a printf - * format specification and arguments. The created object will have a - * reference count of 1. - * - * @param format A printf-style format specification. - * - * @return A newly allocated string reference object with a refcount - * of 1. - */ -PurpleStringref *purple_stringref_printf(const char *format, ...); - -/** - * Increase the reference count of the given stringref. - * - * @param stringref String to be referenced. - * - * @return A pointer to the referenced string. - */ -PurpleStringref *purple_stringref_ref(PurpleStringref *stringref); - -/** - * Decrease the reference count of the given stringref. If this - * reference count reaches zero, the stringref will be freed; thus - * you MUST NOT use this string after dereferencing it. - * - * @param stringref String to be dereferenced. - */ -void purple_stringref_unref(PurpleStringref *stringref); - -/** - * Retrieve the value of a stringref. - * - * @note This value should not be cached or stored in a local variable. - * While there is nothing inherently incorrect about doing so, it - * is easy to forget that the cached value is in fact a - * reference-counted object and accidentally use it after - * dereferencing. This is more problematic for a reference- - * counted object than a heap-allocated object, as it may seem to - * be valid or invalid nondeterministically based on how many - * other references to it exist. - * - * @param stringref String reference from which to retrieve the value. - * - * @return The contents of the string reference. - */ -const char *purple_stringref_value(const PurpleStringref *stringref); - -/** - * Compare two stringrefs for string equality. This returns the same - * value as strcmp would, where <0 indicates that s1 is "less than" s2 - * in the ASCII lexicography, 0 indicates equality, etc. - * - * @param s1 The reference string. - * - * @param s2 The string to compare against the reference. - * - * @return An ordering indication on s1 and s2. - */ -int purple_stringref_cmp(const PurpleStringref *s1, const PurpleStringref *s2); - -/** - * Find the length of the string inside a stringref. - * - * @param stringref The string in whose length we are interested. - * - * @return The length of the string in stringref - */ -size_t purple_stringref_len(const PurpleStringref *stringref); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_STRINGREF_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,437 +0,0 @@ -/** - * @file stun.c STUN (RFC3489) Implementation - * @ingroup core - */ - -/* purple - * - * STUN implementation inspired by jstun [http://jstun.javawi.de/] - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#ifndef _WIN32 -#include -#include -#endif - -/* Solaris */ -#if defined (__SVR4) && defined (__sun) -#include -#endif - -#include "debug.h" -#include "account.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "network.h" -#include "proxy.h" -#include "stun.h" -#include "prefs.h" - -#define MSGTYPE_BINDINGREQUEST 0x0001 -#define MSGTYPE_BINDINGRESPONSE 0x0101 - -#define ATTRIB_MAPPEDADDRESS 0x0001 - -struct stun_header { - guint16 type; - guint16 len; - guint32 transid[4]; -}; - -struct stun_attrib { - guint16 type; - guint16 len; -}; - -#ifdef NOTYET -struct stun_change { - struct stun_header hdr; - struct stun_attrib attrib; - char value[4]; -}; -#endif - -struct stun_conn { - int fd; - struct sockaddr_in addr; - int test; - int retry; - guint incb; - guint timeout; - struct stun_header *packet; - size_t packetsize; -}; - -static PurpleStunNatDiscovery nattype = { - PURPLE_STUN_STATUS_UNDISCOVERED, - PURPLE_STUN_NAT_TYPE_PUBLIC_IP, - "\0", NULL, 0}; - -static GSList *callbacks = NULL; - -static void close_stun_conn(struct stun_conn *sc) { - - if (sc->incb) - purple_input_remove(sc->incb); - - if (sc->timeout) - purple_timeout_remove(sc->timeout); - - if (sc->fd) - close(sc->fd); - - g_free(sc); -} - -static void do_callbacks(void) { - while(callbacks) { - StunCallback cb = callbacks->data; - if(cb) - cb(&nattype); - callbacks = g_slist_remove(callbacks, cb); - } -} - -static gboolean timeoutfunc(gpointer data) { - struct stun_conn *sc = data; - if(sc->retry >= 2) { - purple_debug_warning("stun", "request timed out, giving up.\n"); - if(sc->test == 2) - nattype.type = PURPLE_STUN_NAT_TYPE_SYMMETRIC; - - /* set unknown */ - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - - nattype.lookup_time = time(NULL); - - /* callbacks */ - do_callbacks(); - - /* we don't need to remove the timeout (returning FALSE) */ - sc->timeout = 0; - close_stun_conn(sc); - - return FALSE; - } - purple_debug_info("stun", "request timed out, retrying.\n"); - sc->retry++; - sendto(sc->fd, sc->packet, sc->packetsize, 0, - (struct sockaddr *)&(sc->addr), sizeof(struct sockaddr_in)); - return TRUE; -} - -#ifdef NOTYET -static void do_test2(struct stun_conn *sc) { - struct stun_change data; - data.hdr.type = htons(0x0001); - data.hdr.len = 0; - data.hdr.transid[0] = rand(); - data.hdr.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m'); - data.hdr.transid[2] = rand(); - data.hdr.transid[3] = rand(); - data.attrib.type = htons(0x003); - data.attrib.len = htons(4); - data.value[3] = 6; - sc->packet = (struct stun_header*)&data; - sc->packetsize = sizeof(struct stun_change); - sc->retry = 0; - sc->test = 2; - sendto(sc->fd, sc->packet, sc->packetsize, 0, (struct sockaddr *)&(sc->addr), sizeof(struct sockaddr_in)); - sc->timeout = purple_timeout_add(500, (GSourceFunc) timeoutfunc, sc); -} -#endif - -static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) { - struct stun_conn *sc = data; - char buffer[65536]; - char *tmp; - int len; - struct in_addr in; - struct stun_attrib *attrib; - struct stun_header *hdr; - struct ifconf ifc; - struct ifreq *ifr; - struct sockaddr_in *sinptr; - - len = recv(source, buffer, sizeof(buffer) - 1, 0); - if (!len) { - purple_debug_warning("stun", "unable to read stun response\n"); - return; - } - buffer[len] = '\0'; - - if (len < sizeof(struct stun_header)) { - purple_debug_warning("stun", "got invalid response\n"); - return; - } - - hdr = (struct stun_header*) buffer; - if (len != (ntohs(hdr->len) + sizeof(struct stun_header))) { - purple_debug_warning("stun", "got incomplete response\n"); - return; - } - - /* wrong transaction */ - if(hdr->transid[0] != sc->packet->transid[0] - || hdr->transid[1] != sc->packet->transid[1] - || hdr->transid[2] != sc->packet->transid[2] - || hdr->transid[3] != sc->packet->transid[3]) { - purple_debug_warning("stun", "got wrong transid\n"); - return; - } - - if(sc->test==1) { - if (hdr->type != MSGTYPE_BINDINGRESPONSE) { - purple_debug_warning("stun", - "Expected Binding Response, got %d\n", - hdr->type); - return; - } - - tmp = buffer + sizeof(struct stun_header); - while((buffer + len) > (tmp + sizeof(struct stun_attrib))) { - attrib = (struct stun_attrib*) tmp; - tmp += sizeof(struct stun_attrib); - - if (!((buffer + len) > (tmp + ntohs(attrib->len)))) - break; - - if(attrib->type == htons(ATTRIB_MAPPEDADDRESS) - && ntohs(attrib->len) == 8) { - char *ip; - /* Skip the first unused byte, - * the family(1 byte), and the port(2 bytes); - * then read the 4 byte IPv4 address */ - memcpy(&in.s_addr, tmp + 4, 4); - ip = inet_ntoa(in); - if(ip) - strcpy(nattype.publicip, ip); - } - - tmp += ntohs(attrib->len); - } - purple_debug_info("stun", "got public ip %s\n", nattype.publicip); - nattype.status = PURPLE_STUN_STATUS_DISCOVERED; - nattype.type = PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT; - nattype.lookup_time = time(NULL); - - /* is it a NAT? */ - - ifc.ifc_len = sizeof(buffer); - ifc.ifc_req = (struct ifreq *) buffer; - ioctl(source, SIOCGIFCONF, &ifc); - - tmp = buffer; - while(tmp < buffer + ifc.ifc_len) { - ifr = (struct ifreq *) tmp; - - tmp += sizeof(struct ifreq); - - if(ifr->ifr_addr.sa_family == AF_INET) { - /* we only care about ipv4 interfaces */ - sinptr = (struct sockaddr_in *) &ifr->ifr_addr; - if(sinptr->sin_addr.s_addr == in.s_addr) { - /* no NAT */ - purple_debug_info("stun", "no nat\n"); - nattype.type = PURPLE_STUN_NAT_TYPE_PUBLIC_IP; - } - } - } - -#ifndef NOTYET - close_stun_conn(sc); - do_callbacks(); -#else - purple_timeout_remove(sc->timeout); - sc->timeout = 0; - - do_test2(sc); - } else if(sc->test == 2) { - close_stun_conn(sc); - nattype.type = PURPLE_STUN_NAT_TYPE_FULL_CONE; - do_callbacks(); -#endif - } -} - - -static void hbn_listen_cb(int fd, gpointer data) { - GSList *hosts = data; - struct stun_conn *sc; - static struct stun_header hdr_data; - int ret; - - if(fd < 0) { - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - do_callbacks(); - return; - } - - sc = g_new0(struct stun_conn, 1); - sc->fd = fd; - - sc->addr.sin_family = AF_INET; - sc->addr.sin_port = htons(purple_network_get_port_from_fd(fd)); - sc->addr.sin_addr.s_addr = INADDR_ANY; - - sc->incb = purple_input_add(fd, PURPLE_INPUT_READ, reply_cb, sc); - - ret = GPOINTER_TO_INT(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - memcpy(&(sc->addr), hosts->data, sizeof(struct sockaddr_in)); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - hdr_data.type = htons(MSGTYPE_BINDINGREQUEST); - hdr_data.len = 0; - hdr_data.transid[0] = rand(); - hdr_data.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m'); - hdr_data.transid[2] = rand(); - hdr_data.transid[3] = rand(); - - if(sendto(sc->fd, &hdr_data, sizeof(struct stun_header), 0, - (struct sockaddr *)&(sc->addr), - sizeof(struct sockaddr_in)) < sizeof(struct stun_header)) { - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - do_callbacks(); - close_stun_conn(sc); - return; - } - sc->test = 1; - sc->packet = &hdr_data; - sc->packetsize = sizeof(struct stun_header); - sc->timeout = purple_timeout_add(500, (GSourceFunc) timeoutfunc, sc); -} - -static void hbn_cb(GSList *hosts, gpointer data, const char *error_message) { - - if(!hosts || !hosts->data) { - nattype.status = PURPLE_STUN_STATUS_UNDISCOVERED; - nattype.lookup_time = time(NULL); - do_callbacks(); - return; - } - - if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - do_callbacks(); - return; - } - - -} - -static void do_test1(PurpleSrvResponse *resp, int results, gpointer sdata) { - const char *servername = sdata; - int port = 3478; - - if(results) { - servername = resp[0].hostname; - port = resp[0].port; - } - purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", - results, servername, port); - - purple_dnsquery_a(servername, port, hbn_cb, NULL); - g_free(resp); -} - -static gboolean call_callback(gpointer data) { - StunCallback cb = data; - cb(&nattype); - return FALSE; -} - -PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb) { - const char *servername = purple_prefs_get_string("/purple/network/stun_server"); - - purple_debug_info("stun", "using server %s\n", servername); - - if(nattype.status == PURPLE_STUN_STATUS_DISCOVERING) { - if(cb) - callbacks = g_slist_append(callbacks, cb); - return &nattype; - } - - if(nattype.status != PURPLE_STUN_STATUS_UNDISCOVERED) { - gboolean use_cached_result = TRUE; - - /** Deal with the server name having changed since we did the - lookup */ - if (servername && strlen(servername) > 1 - && !purple_strequal(servername, nattype.servername)) { - use_cached_result = FALSE; - } - - /* If we don't have a successful status and it has been 5 - minutes since we last did a lookup, redo the lookup */ - if (nattype.status != PURPLE_STUN_STATUS_DISCOVERED - && (time(NULL) - nattype.lookup_time) > 300) { - use_cached_result = FALSE; - } - - if (use_cached_result) { - if(cb) - purple_timeout_add(10, call_callback, cb); - return &nattype; - } - } - - if(!servername || (strlen(servername) < 2)) { - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - if(cb) - purple_timeout_add(10, call_callback, cb); - return &nattype; - } - - nattype.status = PURPLE_STUN_STATUS_DISCOVERING; - nattype.publicip[0] = '\0'; - g_free(nattype.servername); - nattype.servername = g_strdup(servername); - - callbacks = g_slist_append(callbacks, cb); - purple_srv_resolve("stun", "udp", servername, do_test1, - (gpointer) servername); - - return &nattype; -} - -void purple_stun_init() { - purple_prefs_add_string("/purple/network/stun_server", ""); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/stun.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/** - * @file stun.h STUN API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_STUN_H_ -#define _PURPLE_STUN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name STUN API */ -/**************************************************************************/ -/*@{*/ - -typedef struct _PurpleStunNatDiscovery PurpleStunNatDiscovery; - -typedef enum { - PURPLE_STUN_STATUS_UNDISCOVERED = -1, - PURPLE_STUN_STATUS_UNKNOWN, /* no STUN server reachable */ - PURPLE_STUN_STATUS_DISCOVERING, - PURPLE_STUN_STATUS_DISCOVERED -} PurpleStunStatus; - -typedef enum { - PURPLE_STUN_NAT_TYPE_PUBLIC_IP, - PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT, - PURPLE_STUN_NAT_TYPE_FULL_CONE, - PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE, - PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE, - PURPLE_STUN_NAT_TYPE_SYMMETRIC -} PurpleStunNatType; - -struct _PurpleStunNatDiscovery { - PurpleStunStatus status; - PurpleStunNatType type; - char publicip[16]; - char *servername; - time_t lookup_time; -}; - -typedef void (*StunCallback) (PurpleStunNatDiscovery *); - -/** - * Starts a NAT discovery. It returns a PurpleStunNatDiscovery if the discovery - * is already done. Otherwise the callback is called when the discovery is over - * and NULL is returned. - * - * @param cb The callback to call when the STUN discovery is finished if the - * discovery would block. If the discovery is done, this is NOT - * called. - * - * @return a PurpleStunNatDiscovery which includes the public IP and the type - * of NAT or NULL is discovery would block - */ -PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb); - -void purple_stun_init(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_STUN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/check_libpurple.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/check_libpurple.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/check_libpurple.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/check_libpurple.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -#include -#include - -#include "tests.h" - -#include "../core.h" -#include "../eventloop.h" -#include "../util.h" - - -/****************************************************************************** - * libpurple goodies - *****************************************************************************/ -static guint -purple_check_input_add(gint fd, PurpleInputCondition condition, - PurpleInputFunction function, gpointer data) -{ - /* this is a no-op for now, feel free to implement it */ - return 0; -} - -static PurpleEventLoopUiOps eventloop_ui_ops = { - g_timeout_add, - g_source_remove, - purple_check_input_add, - g_source_remove, - NULL, /* input_get_error */ -#if GLIB_CHECK_VERSION(2,14,0) - g_timeout_add_seconds, -#else - NULL, -#endif - NULL, - NULL, - NULL -}; - -static void -purple_check_init(void) { - gchar *home_dir; - - g_type_init(); - - purple_eventloop_set_ui_ops(&eventloop_ui_ops); - - /* build our fake home directory */ - home_dir = g_build_path(BUILDDIR, "libpurple", "tests", "home", NULL); - purple_util_set_user_dir(home_dir); - g_free(home_dir); - - purple_core_init("check"); -} - -/****************************************************************************** - * Check meat and potatoes - *****************************************************************************/ -Suite* -master_suite(void) -{ - Suite *s = suite_create("Master Suite"); - - return s; -} - -int main(void) -{ - int number_failed; - SRunner *sr; - - /* Make g_return_... functions fatal, ALWAYS. - * As this is the test code, this is NOT controlled - * by PURPLE_FATAL_ASSERTS. */ - g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); - - sr = srunner_create (master_suite()); - - srunner_add_suite(sr, cipher_suite()); - srunner_add_suite(sr, jabber_jutil_suite()); - srunner_add_suite(sr, qq_suite()); - srunner_add_suite(sr, yahoo_util_suite()); - srunner_add_suite(sr, util_suite()); - - /* make this a libpurple "ui" */ - purple_check_init(); - - srunner_run_all (sr, CK_NORMAL); - number_failed = srunner_ntests_failed (sr); - srunner_free (sr); - - purple_core_quit(); - - return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -if HAVE_CHECK -TESTS=check_libpurple - -clean-local: - -rm -rf libpurple.. - -check_PROGRAMS=check_libpurple - -check_libpurple_SOURCES=\ - check_libpurple.c \ - tests.h \ - test_cipher.c \ - test_jabber_jutil.c \ - test_qq.c \ - test_yahoo_util.c \ - test_util.c \ - $(top_builddir)/libpurple/util.h - -check_libpurple_CFLAGS=\ - @CHECK_CFLAGS@ \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(LIBXML_CFLAGS) \ - -I.. \ - -I$(top_srcdir)/libpurple \ - -DBUILDDIR=\"$(top_builddir)\" - -check_libpurple_LDADD=\ - @CHECK_LIBS@ \ - $(GLIB_LIBS) \ - $(top_builddir)/libpurple/protocols/jabber/libjabber.la \ - $(top_builddir)/libpurple/protocols/qq/libqq.la \ - $(top_builddir)/libpurple/protocols/yahoo/libymsg.la \ - $(top_builddir)/libpurple/libpurple.la - -endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,870 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@HAVE_CHECK_TRUE@check_PROGRAMS = check_libpurple$(EXEEXT) -subdir = libpurple/tests -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__check_libpurple_SOURCES_DIST = check_libpurple.c tests.h \ - test_cipher.c test_jabber_jutil.c test_qq.c test_yahoo_util.c \ - test_util.c $(top_builddir)/libpurple/util.h -@HAVE_CHECK_TRUE@am_check_libpurple_OBJECTS = \ -@HAVE_CHECK_TRUE@ check_libpurple-check_libpurple.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_cipher.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_jabber_jutil.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_qq.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_yahoo_util.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_util.$(OBJEXT) -check_libpurple_OBJECTS = $(am_check_libpurple_OBJECTS) -am__DEPENDENCIES_1 = -@HAVE_CHECK_TRUE@check_libpurple_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/jabber/libjabber.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/qq/libqq.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/yahoo/libymsg.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/libpurple.la -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(check_libpurple_SOURCES) -DIST_SOURCES = $(am__check_libpurple_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -F77 = @F77@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FFLAGS = @FFLAGS@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -@HAVE_CHECK_TRUE@TESTS = check_libpurple -@HAVE_CHECK_TRUE@check_libpurple_SOURCES = \ -@HAVE_CHECK_TRUE@ check_libpurple.c \ -@HAVE_CHECK_TRUE@ tests.h \ -@HAVE_CHECK_TRUE@ test_cipher.c \ -@HAVE_CHECK_TRUE@ test_jabber_jutil.c \ -@HAVE_CHECK_TRUE@ test_qq.c \ -@HAVE_CHECK_TRUE@ test_yahoo_util.c \ -@HAVE_CHECK_TRUE@ test_util.c \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/util.h - -@HAVE_CHECK_TRUE@check_libpurple_CFLAGS = \ -@HAVE_CHECK_TRUE@ @CHECK_CFLAGS@ \ -@HAVE_CHECK_TRUE@ $(GLIB_CFLAGS) \ -@HAVE_CHECK_TRUE@ $(DEBUG_CFLAGS) \ -@HAVE_CHECK_TRUE@ $(LIBXML_CFLAGS) \ -@HAVE_CHECK_TRUE@ -I.. \ -@HAVE_CHECK_TRUE@ -I$(top_srcdir)/libpurple \ -@HAVE_CHECK_TRUE@ -DBUILDDIR=\"$(top_builddir)\" - -@HAVE_CHECK_TRUE@check_libpurple_LDADD = \ -@HAVE_CHECK_TRUE@ @CHECK_LIBS@ \ -@HAVE_CHECK_TRUE@ $(GLIB_LIBS) \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/jabber/libjabber.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/qq/libqq.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/yahoo/libymsg.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/libpurple.la - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/tests/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -check_libpurple$(EXEEXT): $(check_libpurple_OBJECTS) $(check_libpurple_DEPENDENCIES) - @rm -f check_libpurple$(EXEEXT) - $(LINK) $(check_libpurple_LDFLAGS) $(check_libpurple_OBJECTS) $(check_libpurple_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-check_libpurple.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_cipher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_jabber_jutil.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_qq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_util.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_yahoo_util.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -check_libpurple-check_libpurple.o: check_libpurple.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-check_libpurple.o -MD -MP -MF "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" -c -o check_libpurple-check_libpurple.o `test -f 'check_libpurple.c' || echo '$(srcdir)/'`check_libpurple.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" "$(DEPDIR)/check_libpurple-check_libpurple.Po"; else rm -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check_libpurple.c' object='check_libpurple-check_libpurple.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-check_libpurple.o `test -f 'check_libpurple.c' || echo '$(srcdir)/'`check_libpurple.c - -check_libpurple-check_libpurple.obj: check_libpurple.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-check_libpurple.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" -c -o check_libpurple-check_libpurple.obj `if test -f 'check_libpurple.c'; then $(CYGPATH_W) 'check_libpurple.c'; else $(CYGPATH_W) '$(srcdir)/check_libpurple.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" "$(DEPDIR)/check_libpurple-check_libpurple.Po"; else rm -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check_libpurple.c' object='check_libpurple-check_libpurple.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-check_libpurple.obj `if test -f 'check_libpurple.c'; then $(CYGPATH_W) 'check_libpurple.c'; else $(CYGPATH_W) '$(srcdir)/check_libpurple.c'; fi` - -check_libpurple-test_cipher.o: test_cipher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_cipher.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_cipher.Tpo" -c -o check_libpurple-test_cipher.o `test -f 'test_cipher.c' || echo '$(srcdir)/'`test_cipher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo" "$(DEPDIR)/check_libpurple-test_cipher.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cipher.c' object='check_libpurple-test_cipher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_cipher.o `test -f 'test_cipher.c' || echo '$(srcdir)/'`test_cipher.c - -check_libpurple-test_cipher.obj: test_cipher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_cipher.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_cipher.Tpo" -c -o check_libpurple-test_cipher.obj `if test -f 'test_cipher.c'; then $(CYGPATH_W) 'test_cipher.c'; else $(CYGPATH_W) '$(srcdir)/test_cipher.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo" "$(DEPDIR)/check_libpurple-test_cipher.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cipher.c' object='check_libpurple-test_cipher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_cipher.obj `if test -f 'test_cipher.c'; then $(CYGPATH_W) 'test_cipher.c'; else $(CYGPATH_W) '$(srcdir)/test_cipher.c'; fi` - -check_libpurple-test_jabber_jutil.o: test_jabber_jutil.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_jabber_jutil.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" -c -o check_libpurple-test_jabber_jutil.o `test -f 'test_jabber_jutil.c' || echo '$(srcdir)/'`test_jabber_jutil.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" "$(DEPDIR)/check_libpurple-test_jabber_jutil.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_jabber_jutil.c' object='check_libpurple-test_jabber_jutil.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_jabber_jutil.o `test -f 'test_jabber_jutil.c' || echo '$(srcdir)/'`test_jabber_jutil.c - -check_libpurple-test_jabber_jutil.obj: test_jabber_jutil.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_jabber_jutil.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" -c -o check_libpurple-test_jabber_jutil.obj `if test -f 'test_jabber_jutil.c'; then $(CYGPATH_W) 'test_jabber_jutil.c'; else $(CYGPATH_W) '$(srcdir)/test_jabber_jutil.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" "$(DEPDIR)/check_libpurple-test_jabber_jutil.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_jabber_jutil.c' object='check_libpurple-test_jabber_jutil.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_jabber_jutil.obj `if test -f 'test_jabber_jutil.c'; then $(CYGPATH_W) 'test_jabber_jutil.c'; else $(CYGPATH_W) '$(srcdir)/test_jabber_jutil.c'; fi` - -check_libpurple-test_qq.o: test_qq.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_qq.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_qq.Tpo" -c -o check_libpurple-test_qq.o `test -f 'test_qq.c' || echo '$(srcdir)/'`test_qq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_qq.Tpo" "$(DEPDIR)/check_libpurple-test_qq.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_qq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_qq.c' object='check_libpurple-test_qq.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_qq.o `test -f 'test_qq.c' || echo '$(srcdir)/'`test_qq.c - -check_libpurple-test_qq.obj: test_qq.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_qq.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_qq.Tpo" -c -o check_libpurple-test_qq.obj `if test -f 'test_qq.c'; then $(CYGPATH_W) 'test_qq.c'; else $(CYGPATH_W) '$(srcdir)/test_qq.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_qq.Tpo" "$(DEPDIR)/check_libpurple-test_qq.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_qq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_qq.c' object='check_libpurple-test_qq.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_qq.obj `if test -f 'test_qq.c'; then $(CYGPATH_W) 'test_qq.c'; else $(CYGPATH_W) '$(srcdir)/test_qq.c'; fi` - -check_libpurple-test_yahoo_util.o: test_yahoo_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_yahoo_util.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" -c -o check_libpurple-test_yahoo_util.o `test -f 'test_yahoo_util.c' || echo '$(srcdir)/'`test_yahoo_util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" "$(DEPDIR)/check_libpurple-test_yahoo_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_yahoo_util.c' object='check_libpurple-test_yahoo_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_yahoo_util.o `test -f 'test_yahoo_util.c' || echo '$(srcdir)/'`test_yahoo_util.c - -check_libpurple-test_yahoo_util.obj: test_yahoo_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_yahoo_util.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" -c -o check_libpurple-test_yahoo_util.obj `if test -f 'test_yahoo_util.c'; then $(CYGPATH_W) 'test_yahoo_util.c'; else $(CYGPATH_W) '$(srcdir)/test_yahoo_util.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" "$(DEPDIR)/check_libpurple-test_yahoo_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_yahoo_util.c' object='check_libpurple-test_yahoo_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_yahoo_util.obj `if test -f 'test_yahoo_util.c'; then $(CYGPATH_W) 'test_yahoo_util.c'; else $(CYGPATH_W) '$(srcdir)/test_yahoo_util.c'; fi` - -check_libpurple-test_util.o: test_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_util.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_util.Tpo" -c -o check_libpurple-test_util.o `test -f 'test_util.c' || echo '$(srcdir)/'`test_util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_util.Tpo" "$(DEPDIR)/check_libpurple-test_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_util.c' object='check_libpurple-test_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_util.o `test -f 'test_util.c' || echo '$(srcdir)/'`test_util.c - -check_libpurple-test_util.obj: test_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_util.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_util.Tpo" -c -o check_libpurple-test_util.obj `if test -f 'test_util.c'; then $(CYGPATH_W) 'test_util.c'; else $(CYGPATH_W) '$(srcdir)/test_util.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_util.Tpo" "$(DEPDIR)/check_libpurple-test_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_util.c' object='check_libpurple-test_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_util.obj `if test -f 'test_util.c'; then $(CYGPATH_W) 'test_util.c'; else $(CYGPATH_W) '$(srcdir)/test_util.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list='$(TESTS)'; \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ - ;; \ - *) \ - echo "PASS: $$tst"; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ - else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -@HAVE_CHECK_FALSE@clean-local: -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am - - -@HAVE_CHECK_TRUE@clean-local: -@HAVE_CHECK_TRUE@ -rm -rf libpurple.. -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_cipher.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_cipher.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_cipher.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_cipher.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,860 +0,0 @@ -#include -#include -#include -#include - -#undef HAVE_DBUS - -#include "tests.h" - -#include "../cipher.h" - -/****************************************************************************** - * MD4 Tests - *****************************************************************************/ -#define MD4_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[33]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("md4"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_md4_empty_string) { - MD4_TEST("", "31d6cfe0d16ae931b73c59d7e0c089c0"); -} -END_TEST - -START_TEST(test_md4_a) { - MD4_TEST("a", "bde52cb31de33e46245e05fbdbd6fb24"); -} -END_TEST - -START_TEST(test_md4_abc) { - MD4_TEST("abc", "a448017aaf21d8525fc10ae87aa6729d"); -} -END_TEST - -START_TEST(test_md4_message_digest) { - MD4_TEST("message digest", "d9130a8164549fe818874806e1c7014b"); -} -END_TEST - -START_TEST(test_md4_a_to_z) { - MD4_TEST("abcdefghijklmnopqrstuvwxyz", - "d79e1c308aa5bbcdeea8ed63df412da9"); -} -END_TEST - -START_TEST(test_md4_A_to_Z_a_to_z_0_to_9) { - MD4_TEST("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "043f8582f241db351ce627e153e7f0e4"); -} -END_TEST - -START_TEST(test_md4_1_to_0_8_times) { - MD4_TEST("123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890", - "e33b4ddc9c38f2199c3e7b164fcc0536"); -} -END_TEST - - -/****************************************************************************** - * MD5 Tests - *****************************************************************************/ -#define MD5_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[33]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("md5"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_md5_empty_string) { - MD5_TEST("", "d41d8cd98f00b204e9800998ecf8427e"); -} -END_TEST - -START_TEST(test_md5_a) { - MD5_TEST("a", "0cc175b9c0f1b6a831c399e269772661"); -} -END_TEST - -START_TEST(test_md5_abc) { - MD5_TEST("abc", "900150983cd24fb0d6963f7d28e17f72"); -} -END_TEST - -START_TEST(test_md5_message_digest) { - MD5_TEST("message digest", "f96b697d7cb7938d525a2f31aaf161d0"); -} -END_TEST - -START_TEST(test_md5_a_to_z) { - MD5_TEST("abcdefghijklmnopqrstuvwxyz", - "c3fcd3d76192e4007dfb496cca67e13b"); -} -END_TEST - -START_TEST(test_md5_A_to_Z_a_to_z_0_to_9) { - MD5_TEST("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "d174ab98d277d9f5a5611c2c9f419d9f"); -} -END_TEST - -START_TEST(test_md5_1_to_0_8_times) { - MD5_TEST("123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890", - "57edf4a22be3c955ac49da2e2107b67a"); -} -END_TEST - -/****************************************************************************** - * SHA-1 Tests - *****************************************************************************/ -#define SHA1_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[41]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("sha1"); \ - context = purple_cipher_context_new(cipher, NULL); \ - \ - if((data)) { \ - purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ - } else { \ - gint j; \ - guchar buff[1000]; \ - \ - memset(buff, 'a', 1000); \ - \ - for(j = 0; j < 1000; j++) \ - purple_cipher_context_append(context, buff, 1000); \ - } \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_sha1_empty_string) { - SHA1_TEST("", "da39a3ee5e6b4b0d3255bfef95601890afd80709"); -} -END_TEST - -START_TEST(test_sha1_a) { - SHA1_TEST("a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"); -} -END_TEST - -START_TEST(test_sha1_abc) { - SHA1_TEST("abc", "a9993e364706816aba3e25717850c26c9cd0d89d"); -} -END_TEST - -START_TEST(test_sha1_abcd_gibberish) { - SHA1_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); -} -END_TEST - -START_TEST(test_sha1_1000_as_1000_times) { - SHA1_TEST(NULL, "34aa973cd4c4daa4f61eeb2bdbad27316534016f"); -} -END_TEST - -/****************************************************************************** - * SHA-256 Tests - *****************************************************************************/ -#define SHA256_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[65]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("sha256"); \ - context = purple_cipher_context_new(cipher, NULL); \ - \ - if((data)) { \ - purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ - } else { \ - gint j; \ - guchar buff[1000]; \ - \ - memset(buff, 'a', 1000); \ - \ - for(j = 0; j < 1000; j++) \ - purple_cipher_context_append(context, buff, 1000); \ - } \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_sha256_empty_string) { - SHA256_TEST("", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); -} -END_TEST - -START_TEST(test_sha256_a) { - SHA256_TEST("a", "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"); -} -END_TEST - -START_TEST(test_sha256_abc) { - SHA256_TEST("abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); -} -END_TEST - -START_TEST(test_sha256_abcd_gibberish) { - SHA256_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"); -} -END_TEST - -START_TEST(test_sha256_1000_as_1000_times) { - SHA256_TEST(NULL, "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"); -} -END_TEST - -/****************************************************************************** - * DES Tests - *****************************************************************************/ -#define DES_TEST(in, keyz, out, len) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - guchar answer[len+1]; \ - gint ret = 0; \ - guchar decrypt[len+1] = in; \ - guchar key[8+1] = keyz;\ - guchar encrypt[len+1] = out;\ - size_t outlen; \ - \ - cipher = purple_ciphers_find_cipher("des"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_set_key(context, key); \ - \ - ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \ - \ - ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_des_12345678) { - DES_TEST("12345678", - "\x3b\x38\x98\x37\x15\x20\xf7\x5e", - "\x06\x22\x05\xac\x6a\x0d\x55\xdd", - 8); -} -END_TEST - -START_TEST(test_des_abcdefgh) { - DES_TEST("abcdefgh", - "\x3b\x38\x98\x37\x15\x20\xf7\x5e", - "\x62\xe0\xc6\x8c\x48\xe4\x75\xed", - 8); -} -END_TEST - -/****************************************************************************** - * DES3 Tests - * See http://csrc.nist.gov/groups/ST/toolkit/examples.html - * and some NULL things I made up - *****************************************************************************/ - -#define DES3_TEST(in, key, iv, out, len, mode) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - guchar answer[len+1]; \ - guchar decrypt[len+1] = in; \ - guchar encrypt[len+1] = out; \ - size_t outlen; \ - gint ret = 0; \ - \ - cipher = purple_ciphers_find_cipher("des3"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_set_key(context, (guchar *)key); \ - purple_cipher_context_set_batch_mode(context, (mode)); \ - purple_cipher_context_set_iv(context, (guchar *)iv, 8); \ - \ - ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \ - \ - ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_des3_ecb_nist1) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x45\x67\x89\xAB\xCD\xEF\x01\x23", - "00000000", /* ignored */ - "\x71\x47\x72\xF3\x39\x84\x1D\x34\x26\x7F\xCC\x4B\xD2\x94\x9C\xC3" - "\xEE\x11\xC2\x2A\x57\x6A\x30\x38\x76\x18\x3F\x99\xC0\xB6\xDE\x87", - 32, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_nist2) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x01\x23\x45\x67\x89\xAB\xCD\xEF", - "00000000", /* ignored */ - "\x06\xED\xE3\xD8\x28\x84\x09\x0A\xFF\x32\x2C\x19\xF0\x51\x84\x86" - "\x73\x05\x76\x97\x2A\x66\x6E\x58\xB6\xC8\x8C\xF1\x07\x34\x0D\x3D", - 32, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_null_key) { - DES3_TEST( - "\x16\xf4\xb3\x77\xfd\x4b\x9e\xca", - "\x38\x00\x88\x6a\xef\xcb\x00\xad" - "\x5d\xe5\x29\x00\x7d\x98\x64\x4c" - "\x86\x00\x7b\xd3\xc7\x00\x7b\x32", - "00000000", /* ignored */ - "\xc0\x60\x30\xa1\xb7\x25\x42\x44", - 8, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_null_text) { - DES3_TEST( - "\x65\x73\x34\xc1\x19\x00\x79\x65", - "\x32\x64\xda\x10\x13\x6a\xfe\x1e" - "\x37\x54\xd1\x2c\x41\x04\x10\x40" - "\xaf\x1c\x75\x2b\x51\x3a\x03\xf5", - "00000000", /* ignored */ - "\xe5\x80\xf6\x12\xf8\x4e\xd9\x6c", - 8, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_null_key_and_text) { - DES3_TEST( - "\xdf\x7f\x00\x92\xe7\xc1\x49\xd2", - "\x0e\x41\x00\xc4\x8b\xf0\x6e\xa1" - "\x66\x49\x42\x63\x22\x00\xf0\x99" - "\x6b\x22\xc1\x37\x9c\x00\xe4\x8f", - "00000000", /* ignored */ - "\x73\xd8\x1f\x1f\x50\x01\xe4\x79", - 8, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_cbc_nist1) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x45\x67\x89\xAB\xCD\xEF\x01\x23", - "\xF6\x9F\x24\x45\xDF\x4F\x9B\x17", - "\x20\x79\xC3\xD5\x3A\xA7\x63\xE1\x93\xB7\x9E\x25\x69\xAB\x52\x62" - "\x51\x65\x70\x48\x1F\x25\xB5\x0F\x73\xC0\xBD\xA8\x5C\x8E\x0D\xA7", - 32, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_nist2) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x01\x23\x45\x67\x89\xAB\xCD\xEF", - "\xF6\x9F\x24\x45\xDF\x4F\x9B\x17", - "\x74\x01\xCE\x1E\xAB\x6D\x00\x3C\xAF\xF8\x4B\xF4\x7B\x36\xCC\x21" - "\x54\xF0\x23\x8F\x9F\xFE\xCD\x8F\x6A\xCF\x11\x83\x92\xB4\x55\x81", - 32, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_null_key) { - DES3_TEST( - "\x16\xf4\xb3\x77\xfd\x4b\x9e\xca", - "\x38\x00\x88\x6a\xef\xcb\x00\xad" - "\x5d\xe5\x29\x00\x7d\x98\x64\x4c" - "\x86\x00\x7b\xd3\xc7\x00\x7b\x32", - "\x31\x32\x33\x34\x35\x36\x37\x38", - "\x52\xe7\xde\x96\x39\x87\x87\xdb", - 8, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_null_text) { - DES3_TEST( - "\x65\x73\x34\xc1\x19\x00\x79\x65", - "\x32\x64\xda\x10\x13\x6a\xfe\x1e" - "\x37\x54\xd1\x2c\x41\x04\x10\x40" - "\xaf\x1c\x75\x2b\x51\x3a\x03\xf5", - "\x7C\xAF\x0D\x57\x1E\x57\x10\xDA", - "\x40\x12\x0e\x00\x85\xff\x6c\xc2", - 8, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_null_key_and_text) { - DES3_TEST( - "\xdf\x7f\x00\x92\xe7\xc1\x49\xd2", - "\x0e\x41\x00\xc4\x8b\xf0\x6e\xa1" - "\x66\x49\x42\x63\x22\x00\xf0\x99" - "\x6b\x22\xc1\x37\x9c\x00\xe4\x8f", - "\x01\x19\x0D\x2c\x40\x67\x89\x67", - "\xa7\xc1\x10\xbe\x9b\xd5\x8a\x67", - 8, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -/****************************************************************************** - * HMAC Tests - * See RFC2202 and some other NULL tests I made up - *****************************************************************************/ - -#define HMAC_TEST(data, data_len, key, key_len, type, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[41]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("hmac"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_set_option(context, "hash", type); \ - purple_cipher_context_set_key_with_len(context, (guchar *)key, (key_len)); \ - \ - purple_cipher_context_append(context, (guchar *)(data), (data_len)); \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -/* HMAC MD5 */ - -START_TEST(test_hmac_md5_Hi) { - HMAC_TEST("Hi There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 16, - "md5", - "9294727a3638bb1c13f48ef8158bfc9d"); -} -END_TEST - -START_TEST(test_hmac_md5_what) { - HMAC_TEST("what do ya want for nothing?", - 28, - "Jefe", - 4, - "md5", - "750c783e6ab0b503eaa86e310a5db738"); -} -END_TEST - -START_TEST(test_hmac_md5_dd) { - HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", - 50, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 16, - "md5", - "56be34521d144c88dbb8c733f0e8b3f6"); -} -END_TEST - -START_TEST(test_hmac_md5_cd) { - HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", - 50, - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a" - "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" - "\x15\x16\x17\x18\x19", - 25, - "md5", - "697eaf0aca3a3aea3a75164746ffaa79"); -} -END_TEST - -START_TEST(test_hmac_md5_truncation) { - HMAC_TEST("Test With Truncation", - 20, - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", - 16, - "md5", - "56461ef2342edc00f9bab995690efd4c"); -} -END_TEST - -START_TEST(test_hmac_md5_large_key) { - HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First", - 54, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "md5", - "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"); -} -END_TEST - -START_TEST(test_hmac_md5_large_key_and_data) { - HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", - 73, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "md5", - "6f630fad67cda0ee1fb1f562db3aa53e"); -} -END_TEST - -START_TEST(test_hmac_md5_null_key) { - HMAC_TEST("Hi There", - 8, - "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "md5", - "597bfd644b797a985561eeb03a169e59"); -} -END_TEST - -START_TEST(test_hmac_md5_null_text) { - HMAC_TEST("Hi\x00There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 20, - "md5", - "70be8e1b7b50dfcc335d6cd7992c564f"); -} -END_TEST - -START_TEST(test_hmac_md5_null_key_and_text) { - HMAC_TEST("Hi\x00Th\x00re", - 8, - "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "md5", - "b31bcbba35a33a067cbba9131cba4889"); -} -END_TEST - -/* HMAC SHA1 */ - -START_TEST(test_hmac_sha1_Hi) { - HMAC_TEST("Hi There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 20, - "sha1", - "b617318655057264e28bc0b6fb378c8ef146be00"); -} -END_TEST - -START_TEST(test_hmac_sha1_what) { - HMAC_TEST("what do ya want for nothing?", - 28, - "Jefe", - 4, - "sha1", - "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"); -} -END_TEST - -START_TEST(test_hmac_sha1_dd) { - HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", - 50, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 20, - "sha1", - "125d7342b9ac11cd91a39af48aa17b4f63f175d3"); -} -END_TEST - -START_TEST(test_hmac_sha1_cd) { - HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", - 50, - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a" - "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" - "\x15\x16\x17\x18\x19", - 25, - "sha1", - "4c9007f4026250c6bc8414f9bf50c86c2d7235da"); -} -END_TEST - -START_TEST(test_hmac_sha1_truncation) { - HMAC_TEST("Test With Truncation", - 20, - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c" - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", - 20, - "sha1", - "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"); -} -END_TEST - -START_TEST(test_hmac_sha1_large_key) { - HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First", - 54, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "sha1", - "aa4ae5e15272d00e95705637ce8a3b55ed402112"); -} -END_TEST - -START_TEST(test_hmac_sha1_large_key_and_data) { - HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", - 73, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "sha1", - "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"); -} -END_TEST - -START_TEST(test_hmac_sha1_null_key) { - HMAC_TEST("Hi There", - 8, - "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "sha1", - "eb62a2e0e33d300be669c52aab3f591bc960aac5"); -} -END_TEST - -START_TEST(test_hmac_sha1_null_text) { - HMAC_TEST("Hi\x00There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 20, - "sha1", - "31ca58d849e971e418e3439de2c6f83144b6abb7"); -} -END_TEST - -START_TEST(test_hmac_sha1_null_key_and_text) { - HMAC_TEST("Hi\x00Th\x00re", - 8, - "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "sha1", - "e6b8e2fede87aa09dcb13e554df1435e056eae36"); -} -END_TEST - -/****************************************************************************** - * Suite - *****************************************************************************/ -Suite * -cipher_suite(void) { - Suite *s = suite_create("Cipher Suite"); - TCase *tc = NULL; - - /* md4 tests */ - tc = tcase_create("MD4"); - tcase_add_test(tc, test_md4_empty_string); - tcase_add_test(tc, test_md4_a); - tcase_add_test(tc, test_md4_abc); - tcase_add_test(tc, test_md4_message_digest); - tcase_add_test(tc, test_md4_a_to_z); - tcase_add_test(tc, test_md4_A_to_Z_a_to_z_0_to_9); - tcase_add_test(tc, test_md4_1_to_0_8_times); - suite_add_tcase(s, tc); - - /* md5 tests */ - tc = tcase_create("MD5"); - tcase_add_test(tc, test_md5_empty_string); - tcase_add_test(tc, test_md5_a); - tcase_add_test(tc, test_md5_abc); - tcase_add_test(tc, test_md5_message_digest); - tcase_add_test(tc, test_md5_a_to_z); - tcase_add_test(tc, test_md5_A_to_Z_a_to_z_0_to_9); - tcase_add_test(tc, test_md5_1_to_0_8_times); - suite_add_tcase(s, tc); - - /* sha1 tests */ - tc = tcase_create("SHA1"); - tcase_add_test(tc, test_sha1_empty_string); - tcase_add_test(tc, test_sha1_a); - tcase_add_test(tc, test_sha1_abc); - tcase_add_test(tc, test_sha1_abcd_gibberish); - tcase_add_test(tc, test_sha1_1000_as_1000_times); - suite_add_tcase(s, tc); - - /* sha256 tests */ - tc = tcase_create("SHA256"); - tcase_add_test(tc, test_sha256_empty_string); - tcase_add_test(tc, test_sha256_a); - tcase_add_test(tc, test_sha256_abc); - tcase_add_test(tc, test_sha256_abcd_gibberish); - tcase_add_test(tc, test_sha256_1000_as_1000_times); - suite_add_tcase(s, tc); - - /* des tests */ - tc = tcase_create("DES"); - tcase_add_test(tc, test_des_12345678); - tcase_add_test(tc, test_des_abcdefgh); - suite_add_tcase(s, tc); - - /* des3 ecb tests */ - tc = tcase_create("DES3 ECB"); - tcase_add_test(tc, test_des3_ecb_nist1); - tcase_add_test(tc, test_des3_ecb_nist2); - tcase_add_test(tc, test_des3_ecb_null_key); - tcase_add_test(tc, test_des3_ecb_null_text); - tcase_add_test(tc, test_des3_ecb_null_key_and_text); - suite_add_tcase(s, tc); - /* des3 cbc tests */ - tc = tcase_create("DES3 CBC"); - tcase_add_test(tc, test_des3_cbc_nist1); - tcase_add_test(tc, test_des3_cbc_nist2); - tcase_add_test(tc, test_des3_cbc_null_key); - tcase_add_test(tc, test_des3_cbc_null_text); - tcase_add_test(tc, test_des3_cbc_null_key_and_text); - suite_add_tcase(s, tc); - - /* hmac tests */ - tc = tcase_create("HMAC"); - tcase_add_test(tc, test_hmac_md5_Hi); - tcase_add_test(tc, test_hmac_md5_what); - tcase_add_test(tc, test_hmac_md5_dd); - tcase_add_test(tc, test_hmac_md5_cd); - tcase_add_test(tc, test_hmac_md5_truncation); - tcase_add_test(tc, test_hmac_md5_large_key); - tcase_add_test(tc, test_hmac_md5_large_key_and_data); - tcase_add_test(tc, test_hmac_md5_null_key); - tcase_add_test(tc, test_hmac_md5_null_text); - tcase_add_test(tc, test_hmac_md5_null_key_and_text); - tcase_add_test(tc, test_hmac_sha1_Hi); - tcase_add_test(tc, test_hmac_sha1_what); - tcase_add_test(tc, test_hmac_sha1_dd); - tcase_add_test(tc, test_hmac_sha1_cd); - tcase_add_test(tc, test_hmac_sha1_truncation); - tcase_add_test(tc, test_hmac_sha1_large_key); - tcase_add_test(tc, test_hmac_sha1_large_key_and_data); - tcase_add_test(tc, test_hmac_sha1_null_key); - tcase_add_test(tc, test_hmac_sha1_null_text); - tcase_add_test(tc, test_hmac_sha1_null_key_and_text); - suite_add_tcase(s, tc); - - return s; -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_jabber_jutil.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_jabber_jutil.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_jabber_jutil.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_jabber_jutil.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -#include - -#include "tests.h" -#include "../account.h" -#include "../conversation.h" -#include "../xmlnode.h" -#include "../protocols/jabber/jutil.h" - -START_TEST(test_get_resource) -{ - assert_string_equal_free("baz", jabber_get_resource("foo@bar/baz")); - assert_string_equal_free("baz", jabber_get_resource("bar/baz")); - assert_string_equal_free("baz/bat", jabber_get_resource("foo@bar/baz/bat")); - assert_string_equal_free("baz/bat", jabber_get_resource("bar/baz/bat")); -} -END_TEST - -START_TEST(test_get_resource_no_resource) -{ - - fail_unless(NULL == jabber_get_resource("foo@bar")); - fail_unless(NULL == jabber_get_resource("bar")); -} -END_TEST - -START_TEST(test_get_bare_jid) -{ - assert_string_equal_free("foo@bar", jabber_get_bare_jid("foo@bar")); - assert_string_equal_free("foo@bar", jabber_get_bare_jid("foo@bar/baz")); - assert_string_equal_free("bar", jabber_get_bare_jid("bar")); - assert_string_equal_free("bar", jabber_get_bare_jid("bar/baz")); -} -END_TEST - -START_TEST(test_nodeprep_validate) -{ - char *longnode; - - fail_unless(jabber_nodeprep_validate(NULL)); - fail_unless(jabber_nodeprep_validate("foo")); - fail_unless(jabber_nodeprep_validate("%d")); - fail_unless(jabber_nodeprep_validate("y\\z")); - fail_unless(jabber_nodeprep_validate("a=")); - fail_unless(jabber_nodeprep_validate("a,")); - - longnode = g_strnfill(1023, 'a'); - fail_unless(jabber_nodeprep_validate(longnode)); - g_free(longnode); - - longnode = g_strnfill(1024, 'a'); - fail_if(jabber_nodeprep_validate(longnode)); - g_free(longnode); -} -END_TEST - -START_TEST(test_nodeprep_validate_illegal_chars) -{ - fail_if(jabber_nodeprep_validate("don't")); - fail_if(jabber_nodeprep_validate("m@ke")); - fail_if(jabber_nodeprep_validate("\"me\"")); - fail_if(jabber_nodeprep_validate("&ngry")); - fail_if(jabber_nodeprep_validate("c:")); - fail_if(jabber_nodeprep_validate("a/b")); - fail_if(jabber_nodeprep_validate("4>2")); - fail_if(jabber_nodeprep_validate("4<7")); -} -END_TEST - -START_TEST(test_nodeprep_validate_too_long) -{ - char *longnode = g_strnfill(1024, 'a'); - fail_if(jabber_nodeprep_validate(longnode)); - g_free(longnode); -} -END_TEST - -#define assert_valid_jid(str) { \ - JabberID *jid = jabber_id_new(str); \ - fail_if(jid == NULL, "JID '%s' is valid but jabber_id_new() rejected it", str); \ - jabber_id_free(jid); \ -} - -#define assert_invalid_jid(str) { \ - JabberID *jid = jabber_id_new(str); \ - fail_if(jid != NULL, "JID '%s' is invalid but jabber_id_new() allowed it", str); \ - jabber_id_free(jid); \ -} - -#define assert_jid_parts(expect_node, expect_domain, str) { \ - JabberID *jid = jabber_id_new(str); \ - fail_if(jid == NULL, "JID '%s' is valid but jabber_id_new() rejected it", str); \ - fail_if(jid->node == NULL, "JID '%s' is valid but jabber_id_new() didn't return a node", str); \ - fail_if(jid->domain == NULL, "JID '%s' is valid but jabber_id_new() didn't return a domain", str); \ - fail_if(jid->resource != NULL, "JID '%s' doesn't contain a resource", str); \ - assert_string_equal(expect_node, jid->node); \ - assert_string_equal(expect_domain, jid->domain); \ - jabber_id_free(jid); \ -} - -START_TEST(test_jabber_id_new) -{ - assert_valid_jid("gmail.com"); - assert_valid_jid("gmail.com/Test"); - assert_valid_jid("gmail.com/Test@"); - assert_valid_jid("gmail.com/@"); - assert_valid_jid("gmail.com/Test@alkjaweflkj"); - assert_valid_jid("mark.doliner@gmail.com"); - assert_valid_jid("mark.doliner@gmail.com/Test12345"); - assert_valid_jid("mark.doliner@gmail.com/Test@12345"); - assert_valid_jid("mark.doliner@gmail.com/Te/st@12@//345"); - assert_valid_jid("わいど@conference.jabber.org"); - assert_valid_jid("まりるーむ@conference.jabber.org"); - assert_valid_jid("mark.doliner@gmail.com/まりるーむ"); - assert_valid_jid("mark.doliner@gmail/stuff.org"); - assert_valid_jid("stuart@nödåtXäYZ.se"); - assert_valid_jid("stuart@nödåtXäYZ.se/まりるーむ"); - assert_valid_jid("mark.doliner@わいど.org"); - assert_valid_jid("nick@まつ.おおかみ.net"); - assert_valid_jid("paul@10.0.42.230/s"); - assert_valid_jid("paul@[::1]"); /* IPv6 */ - assert_valid_jid("paul@[2001:470:1f05:d58::2]"); - assert_valid_jid("paul@[2001:470:1f05:d58::2]/foo"); - assert_valid_jid("pa=ul@10.0.42.230"); - assert_valid_jid("pa,ul@10.0.42.230"); - - assert_invalid_jid("@gmail.com"); - assert_invalid_jid("@@gmail.com"); - assert_invalid_jid("mark.doliner@@gmail.com/Test12345"); - assert_invalid_jid("mark@doliner@gmail.com/Test12345"); - assert_invalid_jid("@gmail.com/Test@12345"); - assert_invalid_jid("/Test@12345"); - assert_invalid_jid("mark.doliner@"); - assert_invalid_jid("mark.doliner/"); - assert_invalid_jid("mark.doliner@gmail_stuff.org"); - assert_invalid_jid("mark.doliner@gmail[stuff.org"); - assert_invalid_jid("mark.doliner@gmail\\stuff.org"); - assert_invalid_jid("paul@[::1]124"); - assert_invalid_jid("paul@2[::1]124/as"); - assert_invalid_jid("paul@まつ.おおかみ/\x01"); - - /* - * RFC 3454 Section 6 reads, in part, - * "If a string contains any RandALCat character, the - * string MUST NOT contain any LCat character." - * The character is U+066D (ARABIC FIVE POINTED STAR). - */ - assert_invalid_jid("foo@example.com/٭simplexe٭"); - - /* Ensure that jabber_id_new is properly lowercasing node and domains */ - assert_jid_parts("paul", "darkrain42.org", "PaUL@darkrain42.org"); - assert_jid_parts("paul", "darkrain42.org", "paul@DaRkRaIn42.org"); - - /* These case-mapping tests culled from examining RFC3454 B.2 */ - - /* Cyrillic capital EF (U+0424) maps to lowercase EF (U+0444) */ - assert_jid_parts("ф", "darkrain42.org", "Ф@darkrain42.org"); - -#ifdef USE_IDN - /* - * These character (U+A664 and U+A665) are not mapped to anything in - * RFC3454 B.2. This first test *fails* when not using IDN because glib's - * case-folding/utf8_strdown improperly (for XMPP) lowercases the character. - * - * This is known, but not (very?) likely to actually cause a problem, so - * this test is commented out when using glib's functions. - */ - assert_jid_parts("Ꙥ", "darkrain42.org", "Ꙥ@darkrain42.org"); - assert_jid_parts("ꙥ", "darkrain42.org", "ꙥ@darkrain42.org"); -#endif - - /* U+04E9 to U+04E9 */ - assert_jid_parts("paul", "өarkrain42.org", "paul@Өarkrain42.org"); -} -END_TEST - -START_TEST(test_jabber_normalize) -{ - assert_string_equal("paul@darkrain42.org", jabber_normalize(NULL, "PaUL@DaRkRain42.org")); - assert_string_equal("paul@darkrain42.org", jabber_normalize(NULL, "PaUL@DaRkRain42.org/")); - assert_string_equal("paul@darkrain42.org", jabber_normalize(NULL, "PaUL@DaRkRain42.org/resource")); -} -END_TEST - -Suite * -jabber_jutil_suite(void) -{ - Suite *s = suite_create("Jabber Utility Functions"); - - TCase *tc = tcase_create("Get Resource"); - tcase_add_test(tc, test_get_resource); - tcase_add_test(tc, test_get_resource_no_resource); - suite_add_tcase(s, tc); - - tc = tcase_create("Get Bare JID"); - tcase_add_test(tc, test_get_bare_jid); - suite_add_tcase(s, tc); - - tc = tcase_create("JID validate"); - tcase_add_test(tc, test_nodeprep_validate); - tcase_add_test(tc, test_nodeprep_validate_illegal_chars); - tcase_add_test(tc, test_nodeprep_validate_too_long); - tcase_add_test(tc, test_jabber_id_new); - tcase_add_test(tc, test_jabber_normalize); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_qq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_qq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_qq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_qq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -#include - -#include "tests.h" -#include "../protocols/qq/qq_crypt.h" - -START_TEST(test_qq_encrypt) -{ - const guint8 * const key = (guint8 *)"hamburger"; - guint8 crypted[80]; - gint ret; - - ret = qq_encrypt(crypted, (const guint8 * const)"a", 1, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aa", 2, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaa", 3, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaa", 4, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaa", 5, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaa", 6, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaa", 7, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaa", 8, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaaa", 9, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaaaa", 10, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaa", 11, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaa", 12, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaa", 13, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaa", 14, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaa", 15, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaa", 16, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaaa", 17, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaaaa", 18, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaaaaa", 19, key); - assert_int_equal(32, ret); - - /* - fprintf(stderr, "crypted=%s\n", crypted); - assert_string_equal_free("plain", - yahoo_codes_to_html("plain")); - */ -} -END_TEST - -START_TEST(test_qq_decrypt) -{ -} -END_TEST - -Suite * -qq_suite(void) -{ - Suite *s; - TCase *tc; - - s = suite_create("QQ"); - - tc = tcase_create("QQ Crypt Functions"); - tcase_add_test(tc, test_qq_encrypt); - tcase_add_test(tc, test_qq_decrypt); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/tests.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/tests.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/tests.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/tests.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -#ifndef TESTS_H -# define TESTS_H - -#include "../purple.h" - -#include - -/* define the test suites here */ -/* remember to add the suite to the runner in check_libpurple.c */ -Suite * master_suite(void); -Suite * cipher_suite(void); -Suite * jabber_jutil_suite(void); -Suite * qq_suite(void); -Suite * yahoo_util_suite(void); -Suite * util_suite(void); - -/* helper macros */ -#define assert_int_equal(expected, actual) { \ - fail_if(expected != actual, "Expected '%d' but got '%d'", expected, actual); \ -} - -#define assert_string_equal(expected, actual) { \ - const gchar *a = actual; \ - fail_unless(strcmp(expected, a) == 0, "Expected '%s' but got '%s'", expected, a); \ -} - -#define assert_string_equal_free(expected, actual) { \ - gchar *b = actual; \ - assert_string_equal(expected, b); \ - g_free(b); \ -} - - -#endif /* ifndef TESTS_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -#include - -#include "tests.h" -#include "../util.h" - -START_TEST(test_util_base16_encode) -{ - assert_string_equal_free("68656c6c6f2c20776f726c642100", purple_base16_encode((const unsigned char *)"hello, world!", 14)); -} -END_TEST - -START_TEST(test_util_base16_decode) -{ - gsize sz = 0; - guchar *out = purple_base16_decode("21646c726f77202c6f6c6c656800", &sz); - fail_unless(sz == 14, NULL); - assert_string_equal_free("!dlrow ,olleh", (char *)out); -} -END_TEST - -START_TEST(test_util_base64_encode) -{ - assert_string_equal_free("Zm9ydHktdHdvAA==", purple_base64_encode((const unsigned char *)"forty-two", 10)); -} -END_TEST - -START_TEST(test_util_base64_decode) -{ - gsize sz; - guchar *out = purple_base64_decode("b3d0LXl0cm9mAA==", &sz); - fail_unless(sz == 10, NULL); - assert_string_equal_free("owt-ytrof", (char *)out); -} -END_TEST - -START_TEST(test_util_escape_filename) -{ - assert_string_equal("foo", purple_escape_filename("foo")); - assert_string_equal("@oo", purple_escape_filename("@oo")); - assert_string_equal("#oo", purple_escape_filename("#oo")); - assert_string_equal("-oo", purple_escape_filename("-oo")); - assert_string_equal("_oo", purple_escape_filename("_oo")); - assert_string_equal(".oo", purple_escape_filename(".oo")); - assert_string_equal("%25oo", purple_escape_filename("%oo")); - assert_string_equal("%21oo", purple_escape_filename("!oo")); -} -END_TEST - -START_TEST(test_util_unescape_filename) -{ - assert_string_equal("bar", purple_unescape_filename("bar")); - assert_string_equal("@ar", purple_unescape_filename("@ar")); - assert_string_equal("!ar", purple_unescape_filename("!ar")); - assert_string_equal("!ar", purple_unescape_filename("%21ar")); - assert_string_equal("%ar", purple_unescape_filename("%25ar")); -} -END_TEST - - -START_TEST(test_util_text_strip_mnemonic) -{ - assert_string_equal_free("", purple_text_strip_mnemonic("")); - assert_string_equal_free("foo", purple_text_strip_mnemonic("foo")); - assert_string_equal_free("foo", purple_text_strip_mnemonic("_foo")); - -} -END_TEST - -START_TEST(test_util_email_is_valid) -{ - fail_unless(purple_email_is_valid("purple-devel@lists.sf.net")); - fail_if(purple_email_is_valid("purple-devel@@lists.sf.net")); - fail_if(purple_email_is_valid("purple@devel@lists.sf.net")); - fail_if(purple_email_is_valid("purple-devel@list..sf.net")); - fail_if(purple_email_is_valid("purple-devel")); - fail_if(purple_email_is_valid("purple-devel@")); - fail_if(purple_email_is_valid("@lists.sf.net")); - fail_if(purple_email_is_valid("")); - fail_if(purple_email_is_valid("totally bogus")); -} -END_TEST - -START_TEST(test_util_ipv6_is_valid) -{ - fail_unless(purple_ipv6_address_is_valid("2001:0db8:85a3:0000:0000:8a2e:0370:7334")); - fail_unless(purple_ipv6_address_is_valid("2001:db8:85a3:0:0:8a2e:370:7334")); - fail_unless(purple_ipv6_address_is_valid("2001:db8:85a3::8a2e:370:7334")); - fail_unless(purple_ipv6_address_is_valid("2001:0db8:0:0::1428:57ab")); - fail_unless(purple_ipv6_address_is_valid("::1")); - fail_unless(purple_ipv6_address_is_valid("1::")); - fail_unless(purple_ipv6_address_is_valid("1::1")); - fail_unless(purple_ipv6_address_is_valid("::")); - fail_if(purple_ipv6_address_is_valid("")); - fail_if(purple_ipv6_address_is_valid(":")); - fail_if(purple_ipv6_address_is_valid("1.2.3.4")); - fail_if(purple_ipv6_address_is_valid("2001::FFD3::57ab")); - fail_if(purple_ipv6_address_is_valid("200000000::1")); - fail_if(purple_ipv6_address_is_valid("QWERTY::1")); -} -END_TEST - -START_TEST(test_util_str_to_time) -{ - fail_unless(377182200 == purple_str_to_time("19811214T12:50:00", TRUE, NULL, NULL, NULL)); - fail_unless(1175919261 == purple_str_to_time("20070407T04:14:21", TRUE, NULL, NULL, NULL)); -} -END_TEST - -START_TEST(test_markup_html_to_xhtml) -{ - gchar *xhtml = NULL; - gchar *plaintext = NULL; - purple_markup_html_to_xhtml("", &xhtml, &plaintext); - assert_string_equal_free("", xhtml); - assert_string_equal_free("", plaintext); -} -END_TEST - -START_TEST(test_mime_decode_field) -{ - gchar *result = purple_mime_decode_field("=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?="); - assert_string_equal_free("Keld Jørn Simonsen", result); -} -END_TEST - -Suite * -util_suite(void) -{ - Suite *s = suite_create("Utility Functions"); - - TCase *tc = tcase_create("Base16"); - tcase_add_test(tc, test_util_base16_encode); - tcase_add_test(tc, test_util_base16_decode); - suite_add_tcase(s, tc); - - tc = tcase_create("Base64"); - tcase_add_test(tc, test_util_base64_encode); - tcase_add_test(tc, test_util_base64_decode); - suite_add_tcase(s, tc); - - tc = tcase_create("Filenames"); - tcase_add_test(tc, test_util_escape_filename); - tcase_add_test(tc, test_util_unescape_filename); - suite_add_tcase(s, tc); - - tc = tcase_create("Strip Mnemonic"); - tcase_add_test(tc, test_util_text_strip_mnemonic); - suite_add_tcase(s, tc); - - tc = tcase_create("Email"); - tcase_add_test(tc, test_util_email_is_valid); - suite_add_tcase(s, tc); - - tc = tcase_create("IPv6"); - tcase_add_test(tc, test_util_ipv6_is_valid); - suite_add_tcase(s, tc); - - tc = tcase_create("Time"); - tcase_add_test(tc, test_util_str_to_time); - suite_add_tcase(s, tc); - - tc = tcase_create("Markup"); - tcase_add_test(tc, test_markup_html_to_xhtml); - suite_add_tcase(s, tc); - - tc = tcase_create("MIME"); - tcase_add_test(tc, test_mime_decode_field); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_yahoo_util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_yahoo_util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_yahoo_util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/tests/test_yahoo_util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -#include - -#include "tests.h" -#include "../protocols/yahoo/libymsg.h" - -static void setup_codes_to_html(void) -{ - yahoo_init_colorht(); -} - -static void teardown_codes_to_html(void) -{ - yahoo_dest_colorht(); -} - -START_TEST(test_codes_to_html) -{ - assert_string_equal_free("", - yahoo_codes_to_html("")); - assert_string_equal_free("", - yahoo_codes_to_html("\x1B[12345m")); - assert_string_equal_free("plain", - yahoo_codes_to_html("plain")); - assert_string_equal_free("unknown ansi code", - yahoo_codes_to_html("unknown \x1B[12345m ansi code")); - assert_string_equal_free("plain <peanut>", - yahoo_codes_to_html("plain ")); - assert_string_equal_free("plain <peanut", - yahoo_codes_to_html("plain peanut")); - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("<font face='inva>lid", - yahoo_codes_to_html("blue
", - yahoo_codes_to_html("\x1B[31mblue")); - assert_string_equal_free("custom color", - yahoo_codes_to_html("\x1B[#70ea15mcustom color")); - - /* font face */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - - /* font size */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("size 32", - yahoo_codes_to_html("size 32")); - - /* combinations */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("test", - yahoo_codes_to_html("\x1B[35mtest")); -#else - /* font color */ - assert_string_equal_free("blue", - yahoo_codes_to_html("\x1B[31mblue")); - assert_string_equal_free("custom color", - yahoo_codes_to_html("\x1B[#70ea15mcustom color")); - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - - /* font face */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - - /* font size */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("size 32", - yahoo_codes_to_html("size 32")); - - /* combinations */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("test", - yahoo_codes_to_html("\x1B[35mtest")); - assert_string_equal_free(":<", - yahoo_codes_to_html(":<")); -#endif /* !USE_CSS_FORMATTING */ -} -END_TEST - -START_TEST(test_html_to_codes) -{ - assert_string_equal_free("plain", - yahoo_html_to_codes("plain")); - assert_string_equal_free("plain ", - yahoo_html_to_codes("plain <peanut>")); - assert_string_equal_free("plain peanut", - yahoo_html_to_codes("plain> peanut")); - assert_string_equal_free("plain >", - yahoo_html_to_codes("plain >")); - assert_string_equal_free("plain > ", - yahoo_html_to_codes("plain > ")); - assert_string_equal_free("plain <", - yahoo_html_to_codes("plain <")); - assert_string_equal_free("plain < ", - yahoo_html_to_codes("plain < ")); - assert_string_equal_free("plain <", - yahoo_html_to_codes("plain <")); - assert_string_equal_free("plain &", - yahoo_html_to_codes("plain &")); - - /* bold/italic/underline */ - assert_string_equal_free("\x1B[1mbold\x1B[x1m", - yahoo_html_to_codes("bold")); - assert_string_equal_free("\x1B[2mitalic\x1B[x2m", - yahoo_html_to_codes("italic")); - assert_string_equal_free("\x1B[4munderline\x1B[x4m", - yahoo_html_to_codes("underline")); - assert_string_equal_free("no markup", - yahoo_html_to_codes("no markup")); - assert_string_equal_free("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline\x1B[x4m", - yahoo_html_to_codes("bold italic underline")); - assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m italic\x1B[x2m", - yahoo_html_to_codes("bold bolditalic italic")); - assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m \x1B[4mitalicunderline\x1B[x4m\x1B[x2m", - yahoo_html_to_codes("bold bolditalic italicunderline")); - - /* link */ - assert_string_equal_free("http://pidgin.im/", - yahoo_html_to_codes("http://pidgin.im/")); - assert_string_equal_free("mark@example.com", - yahoo_html_to_codes("mark@example.com")); -#if 0 - assert_string_equal_free("Pidgin (http://pidgin.im/)", - yahoo_html_to_codes("Pidgin")); -#endif - - /* font nothing */ - assert_string_equal_free("nothing", - yahoo_html_to_codes("nothing")); - - /* font color */ - assert_string_equal_free("\x1B[#E71414mred\x1B[#000000m", - yahoo_html_to_codes("red")); - assert_string_equal_free("\x1B[#FF0000mred\x1B[#000000m \x1B[#0000FFmblue\x1B[#000000m black", - yahoo_html_to_codes("red blue black")); - - /* font size */ - assert_string_equal_free("test", - yahoo_html_to_codes("test")); - assert_string_equal_free("test", - yahoo_html_to_codes("test")); - - /* combinations */ - assert_string_equal_free("\x1B[#FF0000mredsmall rednormal\x1B[#000000m", - yahoo_html_to_codes("redsmall rednormal")); - - assert_string_equal_free("\x1B[#FF0000mredsmall \x1B[#00FF00mgreennormal\x1B[#FF0000m rednormal\x1B[#000000m", - yahoo_html_to_codes("redsmall greennormal rednormal")); - - assert_string_equal_free("\x1B[1mbold \x1B[#FF0000mred larger \x1B[#000000mbacktoblack normalsize\x1B[#FF0000m\x1B[#000000m\x1B[x1m", - yahoo_html_to_codes("bold red larger backtoblack normalsize")); - - /* buzz/unknown tags */ - assert_string_equal_free("", - yahoo_html_to_codes("")); - assert_string_equal_free("Unknown ", - yahoo_html_to_codes("Unknown ")); -} -END_TEST - -Suite * -yahoo_util_suite(void) -{ - Suite *s; - TCase *tc; - - s = suite_create("Yahoo Utility Functions"); - - tc = tcase_create("Convert IM from network format to HTML"); - tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html); - tcase_add_test(tc, test_codes_to_html); - suite_add_tcase(s, tc); - - tc = tcase_create("Convert IM from HTML to network format"); - tcase_add_test(tc, test_html_to_codes); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -/* - * Themes for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "theme.h" -#include "util.h" - -#define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \ - ((PurpleThemePrivate *) ((PurpleTheme)->priv)) - -void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type); - -/****************************************************************************** - * Structs - *****************************************************************************/ - -typedef struct { - gchar *name; - gchar *description; - gchar *author; - gchar *type; - gchar *dir; - gchar *img; -} PurpleThemePrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * Enums - *****************************************************************************/ - -enum { - PROP_ZERO = 0, - PROP_NAME, - PROP_DESCRIPTION, - PROP_AUTHOR, - PROP_TYPE, - PROP_DIR, - PROP_IMAGE -}; - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -purple_theme_get_property(GObject *obj, guint param_id, GValue *value, - GParamSpec *psec) -{ - PurpleTheme *theme = PURPLE_THEME(obj); - - switch (param_id) { - case PROP_NAME: - g_value_set_string(value, purple_theme_get_name(theme)); - break; - case PROP_DESCRIPTION: - g_value_set_string(value, purple_theme_get_description(theme)); - break; - case PROP_AUTHOR: - g_value_set_string(value, purple_theme_get_author(theme)); - break; - case PROP_TYPE: - g_value_set_string(value, purple_theme_get_type_string(theme)); - break; - case PROP_DIR: - g_value_set_string(value, purple_theme_get_dir(theme)); - break; - case PROP_IMAGE: - g_value_set_string(value, purple_theme_get_image(theme)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_set_property(GObject *obj, guint param_id, const GValue *value, - GParamSpec *psec) -{ - PurpleTheme *theme = PURPLE_THEME(obj); - - switch (param_id) { - case PROP_NAME: - purple_theme_set_name(theme, g_value_get_string(value)); - break; - case PROP_DESCRIPTION: - purple_theme_set_description(theme, g_value_get_string(value)); - break; - case PROP_AUTHOR: - purple_theme_set_author(theme, g_value_get_string(value)); - break; - case PROP_TYPE: - purple_theme_set_type_string(theme, g_value_get_string(value)); - break; - case PROP_DIR: - purple_theme_set_dir(theme, g_value_get_string(value)); - break; - case PROP_IMAGE: - purple_theme_set_image(theme, g_value_get_string(value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleTheme *theme = PURPLE_THEME(instance); - theme->priv = g_new0(PurpleThemePrivate, 1); -} - -static void -purple_theme_finalize(GObject *obj) -{ - PurpleTheme *theme = PURPLE_THEME(obj); - PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->name); - g_free(priv->description); - g_free(priv->author); - g_free(priv->type); - g_free(priv->dir); - g_free(priv->img); - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -purple_theme_class_init(PurpleThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - obj_class->get_property = purple_theme_get_property; - obj_class->set_property = purple_theme_set_property; - obj_class->finalize = purple_theme_finalize; - - /* NAME */ - pspec = g_param_spec_string("name", "Name", - "The name of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_NAME, pspec); - - /* DESCRIPTION */ - pspec = g_param_spec_string("description", "Description", - "The description of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_DESCRIPTION, pspec); - - /* AUTHOR */ - pspec = g_param_spec_string("author", "Author", - "The author of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_AUTHOR, pspec); - - /* TYPE STRING (read only) */ - pspec = g_param_spec_string("type", "Type", - "The string representing the type of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property(obj_class, PROP_TYPE, pspec); - - /* DIRECTORY */ - pspec = g_param_spec_string("directory", "Directory", - "The directory that contains the theme and all its files", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_DIR, pspec); - - /* PREVIEW IMAGE */ - pspec = g_param_spec_string("image", "Image", - "A preview image of the theme", - NULL, - G_PARAM_READWRITE); - g_object_class_install_property(obj_class, PROP_IMAGE, pspec); -} - - -GType -purple_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleTheme), - 0, /* n_preallocs */ - purple_theme_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static (G_TYPE_OBJECT, - "PurpleTheme", &info, G_TYPE_FLAG_ABSTRACT); - } - return type; -} - -/****************************************************************************** - * Helper Functions - *****************************************************************************/ - -static gchar * -theme_clean_text(const gchar *text) -{ - gchar *clean_text = NULL; - if (text != NULL) { - clean_text = g_markup_escape_text(text, -1); - g_strdelimit(clean_text, "\n", ' '); - purple_str_strip_char(clean_text, '\r'); - } - return clean_text; -} - -/***************************************************************************** - * Public API function - *****************************************************************************/ - -const gchar * -purple_theme_get_name(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->name; -} - -void -purple_theme_set_name(PurpleTheme *theme, const gchar *name) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->name); - priv->name = theme_clean_text(name); -} - -const gchar * -purple_theme_get_description(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->description; -} - -void -purple_theme_set_description(PurpleTheme *theme, const gchar *description) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->description); - priv->description = theme_clean_text(description); -} - -const gchar * -purple_theme_get_author(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->author; -} - -void -purple_theme_set_author(PurpleTheme *theme, const gchar *author) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->author); - priv->author = theme_clean_text(author); -} - -const gchar * -purple_theme_get_type_string(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->type; -} - -/* < private > */ -void -purple_theme_set_type_string(PurpleTheme *theme, const gchar *type) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->type); - priv->type = g_strdup(type); -} - -const gchar * -purple_theme_get_dir(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->dir; -} - -void -purple_theme_set_dir(PurpleTheme *theme, const gchar *dir) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->dir); - priv->dir = g_strdup(dir); -} - -const gchar * -purple_theme_get_image(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - return priv->img; -} - -gchar * -purple_theme_get_image_full(PurpleTheme *theme) -{ - const gchar *filename = purple_theme_get_image(theme); - - if (filename) - return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL); - else - return NULL; -} - -void -purple_theme_set_image(PurpleTheme *theme, const gchar *img) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->img); - priv->img = g_strdup(img); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -/** - * @file theme.h Purple Theme Abstact Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_THEME_H -#define PURPLE_THEME_H - -#include -#include -#include "imgstore.h" - -/** - * A purple theme. - * This is an abstract class for Purple to use with the Purple theme manager. - * - * PurpleTheme is a GObject. - */ -typedef struct _PurpleTheme PurpleTheme; -typedef struct _PurpleThemeClass PurpleThemeClass; - -#define PURPLE_TYPE_THEME (purple_theme_get_type ()) -#define PURPLE_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PURPLE_TYPE_THEME, PurpleTheme)) -#define PURPLE_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_THEME, PurpleThemeClass)) -#define PURPLE_IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PURPLE_TYPE_THEME)) -#define PURPLE_IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_THEME)) -#define PURPLE_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_THEME, PurpleThemeClass)) - -struct _PurpleTheme -{ - GObject parent; - gpointer priv; -}; - -struct _PurpleThemeClass -{ - GObjectClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Theme API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_theme_get_type(void); - -/** - * Returns the name of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The string representing the name of the theme. - */ -const gchar *purple_theme_get_name(PurpleTheme *theme); - -/** - * Sets the name of the PurpleTheme object. - * - * @param theme The purple theme. - * @param name The name of the PurpleTheme object. - */ -void purple_theme_set_name(PurpleTheme *theme, const gchar *name); - -/** - * Returns the description of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return A short description of the theme. - */ -const gchar *purple_theme_get_description(PurpleTheme *theme); - -/** - * Sets the description of the PurpleTheme object. - * - * @param theme The purple theme. - * @param description The description of the PurpleTheme object. - */ -void purple_theme_set_description(PurpleTheme *theme, const gchar *description); - -/** - * Returns the author of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The author of the theme. - */ -const gchar *purple_theme_get_author(PurpleTheme *theme); - -/** - * Sets the author of the PurpleTheme object. - * - * @param theme The purple theme. - * @param author The author of the PurpleTheme object. - */ -void purple_theme_set_author(PurpleTheme *theme, const gchar *author); - -/** - * Returns the type (string) of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The string representing the type. - */ -const gchar *purple_theme_get_type_string(PurpleTheme *theme); - -/** - * Returns the directory of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The string representing the theme directory. - */ -const gchar *purple_theme_get_dir(PurpleTheme *theme); - -/** - * Sets the directory of the PurpleTheme object. - * - * @param theme The purple theme. - * @param dir The directory of the PurpleTheme object. - */ -void purple_theme_set_dir(PurpleTheme *theme, const gchar *dir); - -/** - * Returns the image preview of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The image preview of the PurpleTheme object. - */ -const gchar *purple_theme_get_image(PurpleTheme *theme); - -/** - * Returns the image preview and directory of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The image preview of the PurpleTheme object. - */ -gchar *purple_theme_get_image_full(PurpleTheme *theme); - -/** - * Sets the directory of the PurpleTheme object. - * - * @param theme The purple theme. - * @param img The image preview of the PurpleTheme object. - */ -void purple_theme_set_image(PurpleTheme *theme, const gchar *img); - -G_END_DECLS -#endif /* PURPLE_THEME_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* - * ThemeLoaders for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "theme-loader.h" - -#define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \ - ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv)) - -void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type); - -/****************************************************************************** - * Structs - *****************************************************************************/ -typedef struct { - gchar *type; -} PurpleThemeLoaderPrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * Enums - *****************************************************************************/ - -enum { - PROP_ZERO = 0, - PROP_TYPE, -}; - -/****************************************************************************** - * GObject Stuff * - *****************************************************************************/ - -static void -purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value, - GParamSpec *psec) -{ - PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj); - - switch (param_id) { - case PROP_TYPE: - g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader)); - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value, - GParamSpec *psec) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); - - switch (param_id) { - case PROP_TYPE: - purple_theme_loader_set_type_string(loader, g_value_get_string(value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_loader_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance); - loader->priv = g_new0(PurpleThemeLoaderPrivate, 1); -} - -static void -purple_theme_loader_finalize(GObject *obj) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); - PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); - - g_free(priv->type); - g_free(priv); - - parent_class->finalize(obj); -} - -static void -purple_theme_loader_class_init(PurpleThemeLoaderClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - obj_class->get_property = purple_theme_loader_get_property; - obj_class->set_property = purple_theme_loader_set_property; - obj_class->finalize = purple_theme_loader_finalize; - - /* TYPE STRING (read only) */ - pspec = g_param_spec_string("type", "Type", - "The string representing the type of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property(obj_class, PROP_TYPE, pspec); -} - -GType -purple_theme_loader_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleThemeLoader), - 0, /* n_preallocs */ - purple_theme_loader_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(G_TYPE_OBJECT, - "PurpleThemeLoader", &info, G_TYPE_FLAG_ABSTRACT); - } - return type; -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -const gchar * -purple_theme_loader_get_type_string(PurpleThemeLoader *theme_loader) -{ - PurpleThemeLoaderPrivate *priv = NULL; - - g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL); - - priv = PURPLE_THEME_LOADER_GET_PRIVATE(theme_loader); - return priv->type; -} - -/* < private > */ -void -purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type) -{ - PurpleThemeLoaderPrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); - - priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); - - g_free(priv->type); - priv->type = g_strdup(type); -} - -PurpleTheme * -purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir) -{ - return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-loader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file theme-loader.h Purple Theme Loader Abstact Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_THEME_LOADER_H -#define PURPLE_THEME_LOADER_H - -#include -#include -#include "theme.h" - -/** - * A purple theme loader. - * This is an abstract class for Purple to use with the Purple theme manager. - * The loader is responsible for building each type of theme - * - * PurpleThemeLoader is a GObject. - */ -typedef struct _PurpleThemeLoader PurpleThemeLoader; -typedef struct _PurpleThemeLoaderClass PurpleThemeLoaderClass; - -#define PURPLE_TYPE_THEME_LOADER (purple_theme_loader_get_type()) -#define PURPLE_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoader)) -#define PURPLE_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderClass)) -#define PURPLE_IS_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_THEME_LOADER)) -#define PURPLE_IS_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_THEME_LOADER)) -#define PURPLE_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderClass)) - -struct _PurpleThemeLoader -{ - GObject parent; - gpointer priv; -}; - -struct _PurpleThemeLoaderClass -{ - GObjectClass parent_class; - PurpleTheme *((*purple_theme_loader_build)(const gchar*)); -}; - -/**************************************************************************/ -/** @name Purple Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_theme_loader_get_type(void); - -/** - * Returns the string representing the type of the theme loader - * - * @param self The theme loader - * - * @returns The string representing this type - */ -const gchar *purple_theme_loader_get_type_string(PurpleThemeLoader *self); - -/** - * Creates a new PurpleTheme - * - * @param loader The theme loader - * @param dir The directory containing the theme - * - * @returns A PurpleTheme containing the information from the directory - */ -PurpleTheme *purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir); - -G_END_DECLS -#endif /* PURPLE_THEME_LOADER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,306 +0,0 @@ -/* - * Themes for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "theme-manager.h" -#include "util.h" - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GHashTable *theme_table = NULL; - -/***************************************************************************** - * GObject Stuff - ****************************************************************************/ - -GType -purple_theme_manager_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleThemeManagerClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleThemeManager), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* Value Table */ - }; - type = g_type_register_static(G_TYPE_OBJECT, - "PurpleThemeManager", &info, 0); - } - return type; -} - -/****************************************************************************** - * Helpers - *****************************************************************************/ - -/* makes a key of + '/' + */ -static gchar * -purple_theme_manager_make_key(const gchar *name, const gchar *type) -{ - g_return_val_if_fail(name && *name, NULL); - g_return_val_if_fail(type && *type, NULL); - return g_strconcat(type, "/", name, NULL); -} - -/* returns TRUE if theme is of type "user_data" */ -static gboolean -purple_theme_manager_is_theme_type(gchar *key, - gpointer value, - gchar *user_data) -{ - return g_str_has_prefix(key, g_strconcat(user_data, "/", NULL)); -} - -static gboolean -purple_theme_manager_is_theme(gchar *key, - gpointer value, - gchar *user_data) -{ - return PURPLE_IS_THEME(value); -} - -static void -purple_theme_manager_function_wrapper(gchar *key, - gpointer value, - PTFunc user_data) -{ - if (PURPLE_IS_THEME(value)) - (* user_data)(value); -} - -static void -purple_theme_manager_build_dir(const gchar *root) -{ - gchar *purple_dir, *theme_dir; - const gchar *name = NULL, *type = NULL; - GDir *rdir, *tdir; - PurpleThemeLoader *loader; - - rdir = g_dir_open(root, 0, NULL); - - if (!rdir) - return; - - /* Parses directory by root/name/purple/type */ - while ((name = g_dir_read_name(rdir))) { - purple_dir = g_build_filename(root, name, "purple", NULL); - tdir = g_dir_open(purple_dir, 0, NULL); - - if (!tdir) { - g_free(purple_dir); - - continue; - } - - while ((type = g_dir_read_name(tdir))) { - if ((loader = g_hash_table_lookup(theme_table, type))) { - PurpleTheme *theme = NULL; - - theme_dir = g_build_filename(purple_dir, type, NULL); - - theme = purple_theme_loader_build(loader, theme_dir); - g_free(theme_dir); - - if (PURPLE_IS_THEME(theme)) - purple_theme_manager_add_theme(theme); - } - } - - g_dir_close(tdir); - g_free(purple_dir); - } - - g_dir_close(rdir); -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -void -purple_theme_manager_init(void) -{ - theme_table = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_object_unref); -} - -void -purple_theme_manager_refresh(void) -{ - gchar *path = NULL; - const gchar *xdg = NULL; - gint i = 0; - - g_hash_table_foreach_remove(theme_table, - (GHRFunc) purple_theme_manager_is_theme, NULL); - - /* Add themes from ~/.purple */ - path = g_build_filename(purple_user_dir(), "themes", NULL); - purple_theme_manager_build_dir(path); - g_free(path); - - /* look for XDG_DATA_HOME. If we don't have it use ~/.local, and add it */ - if ((xdg = g_getenv("XDG_DATA_HOME")) != NULL) - path = g_build_filename(xdg, "themes", NULL); - else - path = g_build_filename(purple_home_dir(), ".local", "themes", NULL); - - purple_theme_manager_build_dir(path); - g_free(path); - - /* now dig through XDG_DATA_DIRS and add those too */ - xdg = g_getenv("XDG_DATA_DIRS"); - if (xdg) { - gchar **xdg_dirs = g_strsplit(xdg, G_SEARCHPATH_SEPARATOR_S, 0); - - for (i = 0; xdg_dirs[i]; i++) { - path = g_build_filename(xdg_dirs[i], "themes", NULL); - purple_theme_manager_build_dir(path); - g_free(path); - } - - g_strfreev(xdg_dirs); - } -} - -void -purple_theme_manager_uninit(void) -{ - g_hash_table_destroy(theme_table); -} - -void -purple_theme_manager_register_type(PurpleThemeLoader *loader) -{ - gchar *type; - - g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); - - type = g_strdup(purple_theme_loader_get_type_string(loader)); - g_return_if_fail(type); - - /* if something is already there do nothing */ - if (!g_hash_table_lookup(theme_table, type)) - g_hash_table_insert(theme_table, type, loader); -} - -void -purple_theme_manager_unregister_type(PurpleThemeLoader *loader) -{ - const gchar *type; - - g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); - - type = purple_theme_loader_get_type_string(loader); - g_return_if_fail(type); - - if (g_hash_table_lookup(theme_table, type) == loader) - { - g_hash_table_remove(theme_table, type); - - g_hash_table_foreach_remove(theme_table, - (GHRFunc)purple_theme_manager_is_theme_type, (gpointer)type); - } /* only free if given registered loader */ -} - -PurpleTheme * -purple_theme_manager_find_theme(const gchar *name, - const gchar *type) -{ - gchar *key; - PurpleTheme *theme; - - key = purple_theme_manager_make_key(name, type); - - g_return_val_if_fail(key, NULL); - - theme = g_hash_table_lookup(theme_table, key); - - g_free(key); - - return theme; -} - -void -purple_theme_manager_add_theme(PurpleTheme *theme) -{ - gchar *key; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - key = purple_theme_manager_make_key(purple_theme_get_name(theme), - purple_theme_get_type_string(theme)); - - g_return_if_fail(key); - - /* if something is already there do nothing */ - if (g_hash_table_lookup(theme_table, key) == NULL) - g_hash_table_insert(theme_table, key, theme); -} - -void -purple_theme_manager_remove_theme(PurpleTheme *theme) -{ - gchar *key; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - key = purple_theme_manager_make_key(purple_theme_get_name(theme), - purple_theme_get_type_string(theme)); - - g_return_if_fail(key); - - g_hash_table_remove(theme_table, key); - - g_free(key); -} - -void -purple_theme_manager_for_each_theme(PTFunc func) -{ - g_return_if_fail(func); - - g_hash_table_foreach(theme_table, - (GHFunc) purple_theme_manager_function_wrapper, func); -} - -PurpleTheme * -purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type) -{ - PurpleThemeLoader *loader; - - g_return_val_if_fail(theme_dir != NULL && type != NULL, NULL); - - loader = g_hash_table_lookup(theme_table, type); - g_return_val_if_fail(PURPLE_IS_THEME_LOADER(loader), NULL); - - return purple_theme_loader_build(loader, theme_dir); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/theme-manager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/** - * @file theme-manager.h Theme Manager API - */ - -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_THEME_MANAGER_H -#define PURPLE_THEME_MANAGER_H - -#include -#include -#include "theme.h" -#include "theme-loader.h" - -typedef void (*PTFunc) (PurpleTheme *); - -typedef struct _PurpleThemeManager PurpleThemeManager; -typedef struct _PurpleThemeManagerClass PurpleThemeManagerClass; - -#define PURPLE_TYPE_THEME_MANAGER (purple_theme_manager_get_type()) -#define PURPLE_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManager)) -#define PURPLE_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass)) -#define PURPLE_IS_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_THEME_MANAGER)) -#define PURPLE_IS_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_THEME_MANAGER)) -#define PURPLE_GET_THEME_MANAGER_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass)) - -struct _PurpleThemeManager { - GObject parent; -}; - -struct _PurpleThemeManagerClass { - GObjectClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Theme Manager API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * - * @internal. - */ -GType purple_theme_manager_get_type(void); - -/** - * Initalizes the theme manager. - */ -void purple_theme_manager_init(void); - -/** - * Uninitalizes the manager then frees all the themes and loaders it is - * responsible for. - */ -void purple_theme_manager_uninit(void); - -/** - * Rebuilds all the themes in the theme manager. - * (Removes all current themes but keeps the added loaders.) - */ -void purple_theme_manager_refresh(void); - -/** - * Finds the PurpleTheme object stored by the theme manager. - * - * @param name The name of the PurpleTheme. - * @param type The type of the PurpleTheme. - * - * @returns The PurpleTheme, or NULL if it wasn't found. - */ -PurpleTheme *purple_theme_manager_find_theme(const gchar *name, const gchar *type); - -/** - * Adds a PurpleTheme to the theme manager. If the theme already exists - * then this function does nothing. - * - * @param theme The PurpleTheme to add to the manager. - */ -void purple_theme_manager_add_theme(PurpleTheme *theme); - -/** - * Removes a PurpleTheme from the theme manager and frees the theme. - * - * @param theme The PurpleTheme to remove from the manager. - */ -void purple_theme_manager_remove_theme(PurpleTheme *theme); - -/** - * Adds a loader to the theme manager so it knows how to build themes. - * - * @param loader The PurpleThemeLoader to add. - */ -void purple_theme_manager_register_type(PurpleThemeLoader *loader); - -/** - * Removes the loader and all themes of the same type from the loader. - * - * @param loader The PurpleThemeLoader to be removed. - */ -void purple_theme_manager_unregister_type(PurpleThemeLoader *loader); - -/** - * Calls the given function on each purple theme. - * - * @param func The PTFunc to be applied to each theme. - */ -void purple_theme_manager_for_each_theme(PTFunc func); - -/** - * Loads a theme of the given type without adding it to the manager - * - * @param theme_dir the directory of the theme to load - * @param type the type of theme to load - */ -PurpleTheme *purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type); - -G_END_DECLS -#endif /* PURPLE_THEME_MANAGER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1062 +0,0 @@ -/** - * @file upnp.c UPnP Implementation - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "upnp.h" - -#include "debug.h" -#include "eventloop.h" -#include "network.h" -#include "proxy.h" -#include "signals.h" -#include "util.h" -#include "xmlnode.h" - -/*************************************************************** -** General Defines * -****************************************************************/ -#define HTTP_OK "200 OK" -#define DEFAULT_HTTP_PORT 80 -#define DISCOVERY_TIMEOUT 1000 -/* limit UPnP-triggered http downloads to 128k */ -#define MAX_UPNP_DOWNLOAD (128 * 1024) - -/*************************************************************** -** Discovery/Description Defines * -****************************************************************/ -#define NUM_UDP_ATTEMPTS 2 - -/* Address and port of an SSDP request used for discovery */ -#define HTTPMU_HOST_ADDRESS "239.255.255.250" -#define HTTPMU_HOST_PORT 1900 - -#define SEARCH_REQUEST_DEVICE "urn:schemas-upnp-org:service:%s" - -#define SEARCH_REQUEST_STRING \ - "M-SEARCH * HTTP/1.1\r\n" \ - "MX: 2\r\n" \ - "HOST: 239.255.255.250:1900\r\n" \ - "MAN: \"ssdp:discover\"\r\n" \ - "ST: urn:schemas-upnp-org:service:%s\r\n" \ - "\r\n" - -#define WAN_IP_CONN_SERVICE "WANIPConnection:1" -#define WAN_PPP_CONN_SERVICE "WANPPPConnection:1" - -/****************************************************************** -** Action Defines * -*******************************************************************/ -#define HTTP_HEADER_ACTION \ - "POST /%s HTTP/1.1\r\n" \ - "HOST: %s:%d\r\n" \ - "SOAPACTION: \"urn:schemas-upnp-org:service:%s#%s\"\r\n" \ - "CONTENT-TYPE: text/xml ; charset=\"utf-8\"\r\n" \ - "CONTENT-LENGTH: %" G_GSIZE_FORMAT "\r\n\r\n" - -#define SOAP_ACTION \ - "\r\n" \ - "\r\n" \ - "\r\n" \ - "\r\n" \ - "%s" \ - "\r\n" \ - "\r\n" \ - "" - -#define PORT_MAPPING_LEASE_TIME "0" -#define PORT_MAPPING_DESCRIPTION "PURPLE_UPNP_PORT_FORWARD" - -#define ADD_PORT_MAPPING_PARAMS \ - "\r\n" \ - "%i\r\n" \ - "%s\r\n" \ - "%i\r\n" \ - "%s\r\n" \ - "1\r\n" \ - "" \ - PORT_MAPPING_DESCRIPTION \ - "\r\n" \ - "" \ - PORT_MAPPING_LEASE_TIME \ - "\r\n" - -#define DELETE_PORT_MAPPING_PARAMS \ - "\r\n" \ - "%i\r\n" \ - "%s\r\n" - -typedef enum { - PURPLE_UPNP_STATUS_UNDISCOVERED = -1, - PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER, - PURPLE_UPNP_STATUS_DISCOVERING, - PURPLE_UPNP_STATUS_DISCOVERED -} PurpleUPnPStatus; - -typedef struct { - PurpleUPnPStatus status; - gchar* control_url; - gchar service_type[20]; - char publicip[16]; - char internalip[16]; - time_t lookup_time; -} PurpleUPnPControlInfo; - -typedef struct { - guint inpa; /* purple_input_add handle */ - guint tima; /* purple_timeout_add handle */ - int fd; - struct sockaddr_in server; - gchar service_type[20]; - int retry_count; - gchar *full_url; -} UPnPDiscoveryData; - -struct _UPnPMappingAddRemove -{ - unsigned short portmap; - gchar protocol[4]; - gboolean add; - PurpleUPnPCallback cb; - gpointer cb_data; - guint tima; /* purple_timeout_add handle */ - PurpleUtilFetchUrlData *gfud; -}; - -static PurpleUPnPControlInfo control_info = { - PURPLE_UPNP_STATUS_UNDISCOVERED, - NULL, "\0", "\0", "\0", 0}; - -static GSList *discovery_callbacks = NULL; - -static void purple_upnp_discover_send_broadcast(UPnPDiscoveryData *dd); -static void lookup_public_ip(void); -static void lookup_internal_ip(void); - -static void -fire_discovery_callbacks(gboolean success) -{ - while(discovery_callbacks) { - gpointer data; - PurpleUPnPCallback cb = discovery_callbacks->data; - discovery_callbacks = g_slist_remove(discovery_callbacks, cb); - data = discovery_callbacks->data; - discovery_callbacks = g_slist_remove(discovery_callbacks, data); - cb(success, data); - } -} - -static gboolean -purple_upnp_compare_device(const xmlnode* device, const gchar* deviceType) -{ - xmlnode* deviceTypeNode = xmlnode_get_child(device, "deviceType"); - char *tmp; - gboolean ret; - - if(deviceTypeNode == NULL) { - return FALSE; - } - - tmp = xmlnode_get_data(deviceTypeNode); - ret = !g_ascii_strcasecmp(tmp, deviceType); - g_free(tmp); - - return ret; -} - -static gboolean -purple_upnp_compare_service(const xmlnode* service, const gchar* serviceType) -{ - xmlnode* serviceTypeNode; - char *tmp; - gboolean ret; - - if(service == NULL) { - return FALSE; - } - - serviceTypeNode = xmlnode_get_child(service, "serviceType"); - - if(serviceTypeNode == NULL) { - return FALSE; - } - - tmp = xmlnode_get_data(serviceTypeNode); - ret = !g_ascii_strcasecmp(tmp, serviceType); - g_free(tmp); - - return ret; -} - -static gchar* -purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, - const gchar* httpURL, const gchar* serviceType) -{ - gchar *xmlRoot, *baseURL, *controlURL, *service; - xmlnode *xmlRootNode, *serviceTypeNode, *controlURLNode, *baseURLNode; - char *tmp; - - /* make sure we have a valid http response */ - if(g_strstr_len(httpResponse, len, HTTP_OK) == NULL) { - purple_debug_error("upnp", - "parse_description_response(): Failed In HTTP_OK\n"); - return NULL; - } - - /* find the root of the xml document */ - if((xmlRoot = g_strstr_len(httpResponse, len, " 0) - control_url = purple_upnp_parse_description_response( - httpResponse, len, dd->full_url, dd->service_type); - - g_free(dd->full_url); - - if(control_url == NULL) { - purple_debug_error("upnp", - "purple_upnp_parse_description(): control URL is NULL\n"); - } - - control_info.status = control_url ? PURPLE_UPNP_STATUS_DISCOVERED - : PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER; - control_info.lookup_time = time(NULL); - control_info.control_url = control_url; - strncpy(control_info.service_type, dd->service_type, - sizeof(control_info.service_type)); - - fire_discovery_callbacks(control_url != NULL); - - /* Look up the public and internal IPs */ - if(control_url != NULL) { - lookup_public_ip(); - lookup_internal_ip(); - } - - g_free(dd); -} - -static void -purple_upnp_parse_description(const gchar* descriptionURL, UPnPDiscoveryData *dd) -{ - gchar* httpRequest; - gchar* descriptionXMLAddress; - gchar* descriptionAddress; - int port = 0; - - /* parse the 4 above variables out of the descriptionURL - example description URL: http://192.168.1.1:5678/rootDesc.xml */ - - /* parse the url into address, port, path variables */ - if(!purple_url_parse(descriptionURL, &descriptionAddress, - &port, &descriptionXMLAddress, NULL, NULL)) { - return; - } - if(port == 0 || port == -1) { - port = DEFAULT_HTTP_PORT; - } - - /* for example... - GET /rootDesc.xml HTTP/1.1\r\nHost: 192.168.1.1:5678\r\n\r\n */ - httpRequest = g_strdup_printf( - "GET /%s HTTP/1.1\r\n" - "Connection: close\r\n" - "Host: %s:%d\r\n\r\n", - descriptionXMLAddress, descriptionAddress, port); - - g_free(descriptionXMLAddress); - - dd->full_url = g_strdup_printf("http://%s:%d", - descriptionAddress, port); - g_free(descriptionAddress); - - /* Remove the timeout because everything it is waiting for has - * successfully completed */ - purple_timeout_remove(dd->tima); - dd->tima = 0; - - purple_util_fetch_url_request_len(descriptionURL, TRUE, NULL, TRUE, httpRequest, - TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); - - g_free(httpRequest); - -} - -static void -purple_upnp_parse_discover_response(const gchar* buf, unsigned int buf_len, - UPnPDiscoveryData *dd) -{ - gchar* startDescURL; - gchar* endDescURL; - gchar* descURL; - - if(g_strstr_len(buf, buf_len, HTTP_OK) == NULL) { - purple_debug_error("upnp", - "parse_discover_response(): Failed In HTTP_OK\n"); - return; - } - - if((startDescURL = g_strstr_len(buf, buf_len, "http://")) == NULL) { - purple_debug_error("upnp", - "parse_discover_response(): Failed In finding http://\n"); - return; - } - - endDescURL = g_strstr_len(startDescURL, buf_len - (startDescURL - buf), - "\r"); - if(endDescURL == NULL) { - endDescURL = g_strstr_len(startDescURL, - buf_len - (startDescURL - buf), "\n"); - if(endDescURL == NULL) { - purple_debug_error("upnp", - "parse_discover_response(): Failed In endDescURL\n"); - return; - } - } - - /* XXX: I'm not sure how this could ever happen */ - if(endDescURL == startDescURL) { - purple_debug_error("upnp", - "parse_discover_response(): endDescURL == startDescURL\n"); - return; - } - - descURL = g_strndup(startDescURL, endDescURL - startDescURL); - - purple_upnp_parse_description(descURL, dd); - - g_free(descURL); - -} - -static gboolean -purple_upnp_discover_timeout(gpointer data) -{ - UPnPDiscoveryData* dd = data; - - if (dd->inpa) - purple_input_remove(dd->inpa); - dd->inpa = 0; - dd->tima = 0; - - if (dd->retry_count < NUM_UDP_ATTEMPTS) { - /* TODO: We probably shouldn't be incrementing retry_count in two places */ - dd->retry_count++; - purple_upnp_discover_send_broadcast(dd); - } else { - if (dd->fd) - close(dd->fd); - - control_info.status = PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER; - control_info.lookup_time = time(NULL); - control_info.service_type[0] = '\0'; - g_free(control_info.control_url); - control_info.control_url = NULL; - - fire_discovery_callbacks(FALSE); - - g_free(dd); - } - - return FALSE; -} - -static void -purple_upnp_discover_udp_read(gpointer data, gint sock, PurpleInputCondition cond) -{ - int len; - UPnPDiscoveryData *dd = data; - gchar buf[65536]; - - do { - len = recv(dd->fd, buf, - sizeof(buf) - 1, 0); - - if(len > 0) { - buf[len] = '\0'; - break; - } else if(errno != EINTR) { - /* We'll either get called again, or time out */ - return; - } - } while (errno == EINTR); - - purple_input_remove(dd->inpa); - dd->inpa = 0; - - close(dd->fd); - dd->fd = -1; - - /* parse the response, and see if it was a success */ - purple_upnp_parse_discover_response(buf, len, dd); - - /* We'll either time out or continue successfully */ -} - -static void -purple_upnp_discover_send_broadcast(UPnPDiscoveryData *dd) -{ - gchar *sendMessage = NULL; - size_t totalSize; - gboolean sentSuccess; - - /* because we are sending over UDP, if there is a failure - we should retry the send NUM_UDP_ATTEMPTS times. Also, - try different requests for WANIPConnection and WANPPPConnection*/ - for(; dd->retry_count < NUM_UDP_ATTEMPTS; dd->retry_count++) { - sentSuccess = FALSE; - - if((dd->retry_count % 2) == 0) { - strncpy(dd->service_type, WAN_IP_CONN_SERVICE, sizeof(dd->service_type)); - } else { - strncpy(dd->service_type, WAN_PPP_CONN_SERVICE, sizeof(dd->service_type)); - } - - sendMessage = g_strdup_printf(SEARCH_REQUEST_STRING, dd->service_type); - - totalSize = strlen(sendMessage); - - do { - if(sendto(dd->fd, sendMessage, totalSize, 0, - (struct sockaddr*) &(dd->server), - sizeof(struct sockaddr_in) - ) == totalSize) { - sentSuccess = TRUE; - break; - } - } while (errno == EINTR || errno == EAGAIN); - - g_free(sendMessage); - - if(sentSuccess) { - dd->tima = purple_timeout_add(DISCOVERY_TIMEOUT, - purple_upnp_discover_timeout, dd); - dd->inpa = purple_input_add(dd->fd, PURPLE_INPUT_READ, - purple_upnp_discover_udp_read, dd); - - return; - } - } - - /* We have already done all our retries. Make sure that the callback - * doesn't get called before the original function returns */ - purple_timeout_add(10, purple_upnp_discover_timeout, dd); -} - -void -purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data) -{ - /* Socket Setup Variables */ - int sock; - struct hostent* hp; - - /* UDP RECEIVE VARIABLES */ - UPnPDiscoveryData *dd; - - if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) { - if (cb) { - discovery_callbacks = g_slist_append( - discovery_callbacks, cb); - discovery_callbacks = g_slist_append( - discovery_callbacks, cb_data); - } - return; - } - - dd = g_new0(UPnPDiscoveryData, 1); - if (cb) { - discovery_callbacks = g_slist_append(discovery_callbacks, cb); - discovery_callbacks = g_slist_append(discovery_callbacks, - cb_data); - } - - /* Set up the sockets */ - sock = socket(AF_INET, SOCK_DGRAM, 0); - if(sock == -1) { - purple_debug_error("upnp", - "purple_upnp_discover(): Failed In sock creation\n"); - /* Short circuit the retry attempts */ - dd->retry_count = NUM_UDP_ATTEMPTS; - purple_timeout_add(10, purple_upnp_discover_timeout, dd); - return; - } - - dd->fd = sock; - - /* TODO: Non-blocking! */ - if((hp = gethostbyname(HTTPMU_HOST_ADDRESS)) == NULL) { - purple_debug_error("upnp", - "purple_upnp_discover(): Failed In gethostbyname\n"); - /* Short circuit the retry attempts */ - dd->retry_count = NUM_UDP_ATTEMPTS; - purple_timeout_add(10, purple_upnp_discover_timeout, dd); - return; - } - - memset(&(dd->server), 0, sizeof(struct sockaddr)); - dd->server.sin_family = AF_INET; - memcpy(&(dd->server.sin_addr), hp->h_addr_list[0], hp->h_length); - dd->server.sin_port = htons(HTTPMU_HOST_PORT); - - control_info.status = PURPLE_UPNP_STATUS_DISCOVERING; - - purple_upnp_discover_send_broadcast(dd); -} - -static PurpleUtilFetchUrlData* -purple_upnp_generate_action_message_and_send(const gchar* actionName, - const gchar* actionParams, PurpleUtilFetchUrlCallback cb, - gpointer cb_data) -{ - PurpleUtilFetchUrlData* gfud; - gchar* soapMessage; - gchar* totalSendMessage; - gchar* pathOfControl; - gchar* addressOfControl; - int port = 0; - - /* parse the url into address, port, path variables */ - if(!purple_url_parse(control_info.control_url, &addressOfControl, - &port, &pathOfControl, NULL, NULL)) { - purple_debug_error("upnp", - "generate_action_message_and_send(): Failed In Parse URL\n"); - /* XXX: This should probably be async */ - if(cb) - cb(NULL, cb_data, NULL, 0, NULL); - return NULL; - } - if(port == 0 || port == -1) { - port = DEFAULT_HTTP_PORT; - } - - /* set the soap message */ - soapMessage = g_strdup_printf(SOAP_ACTION, actionName, - control_info.service_type, actionParams, actionName); - - /* set the HTTP Header, and append the body to it */ - totalSendMessage = g_strdup_printf(HTTP_HEADER_ACTION "%s", - pathOfControl, addressOfControl, port, - control_info.service_type, actionName, - strlen(soapMessage), soapMessage); - g_free(pathOfControl); - g_free(soapMessage); - - gfud = purple_util_fetch_url_request_len(control_info.control_url, FALSE, NULL, TRUE, - totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); - - g_free(totalSendMessage); - g_free(addressOfControl); - - return gfud; -} - -const gchar * -purple_upnp_get_public_ip() -{ - if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED - && control_info.publicip - && strlen(control_info.publicip) > 0) - return control_info.publicip; - - /* Trigger another UPnP discovery if 5 minutes have elapsed since the - * last one, and it wasn't successful */ - if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING - && (time(NULL) - control_info.lookup_time) > 300) - purple_upnp_discover(NULL, NULL); - - return NULL; -} - -static void -looked_up_public_ip_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *httpResponse, gsize len, const gchar *error_message) -{ - gchar* temp, *temp2; - - if ((error_message != NULL) || (httpResponse == NULL)) - return; - - /* extract the ip, or see if there is an error */ - if((temp = g_strstr_len(httpResponse, len, - ""))) { - purple_debug_error("upnp", - "looked_up_public_ip_cb(): Failed In Finding >\n"); - return; - } - if(!(temp2 = g_strstr_len(temp, len - (temp - httpResponse), "<"))) { - purple_debug_error("upnp", - "looked_up_public_ip_cb(): Failed In Finding <\n"); - return; - } - *temp2 = '\0'; - - strncpy(control_info.publicip, temp + 1, - sizeof(control_info.publicip)); - - purple_debug_info("upnp", "NAT Returned IP: %s\n", control_info.publicip); -} - -static void -lookup_public_ip() -{ - purple_upnp_generate_action_message_and_send("GetExternalIPAddress", "", - looked_up_public_ip_cb, NULL); -} - -/* TODO: This could be exported */ -static const gchar * -purple_upnp_get_internal_ip(void) -{ - if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED - && control_info.internalip - && strlen(control_info.internalip) > 0) - return control_info.internalip; - - /* Trigger another UPnP discovery if 5 minutes have elapsed since the - * last one, and it wasn't successful */ - if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING - && (time(NULL) - control_info.lookup_time) > 300) - purple_upnp_discover(NULL, NULL); - - return NULL; -} - -static void -looked_up_internal_ip_cb(gpointer data, gint source, const gchar *error_message) -{ - if (source) { - strncpy(control_info.internalip, - purple_network_get_local_system_ip(source), - sizeof(control_info.internalip)); - purple_debug_info("upnp", "Local IP: %s\n", - control_info.internalip); - close(source); - } else - purple_debug_error("upnp", "Unable to look up local IP\n"); - -} - -static void -lookup_internal_ip() -{ - gchar* addressOfControl; - int port = 0; - - if(!purple_url_parse(control_info.control_url, &addressOfControl, &port, - NULL, NULL, NULL)) { - purple_debug_error("upnp", - "lookup_internal_ip(): Failed In Parse URL\n"); - return; - } - if(port == 0 || port == -1) { - port = DEFAULT_HTTP_PORT; - } - - if(purple_proxy_connect(NULL, NULL, addressOfControl, port, - looked_up_internal_ip_cb, NULL) == NULL) - { - purple_debug_error("upnp", "Get Local IP Connect Failed: Address: %s @@@ Port %d\n", - addressOfControl, port); - } - - g_free(addressOfControl); -} - -static void -done_port_mapping_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *httpResponse, gsize len, const gchar *error_message) -{ - UPnPMappingAddRemove *ar = user_data; - - gboolean success = TRUE; - - /* determine if port mapping was a success */ - if ((error_message != NULL) || (httpResponse == NULL) || - (g_strstr_len(httpResponse, len, HTTP_OK) == NULL)) - { - purple_debug_error("upnp", - "purple_upnp_set_port_mapping(): Failed HTTP_OK\n%s\n", - httpResponse ? httpResponse : "(null)"); - success = FALSE; - } else - purple_debug_info("upnp", "Successfully completed port mapping operation\n"); - - if (ar->cb) - ar->cb(success, ar->cb_data); - g_free(ar); -} - -static void -do_port_mapping_cb(gboolean has_control_mapping, gpointer data) -{ - UPnPMappingAddRemove *ar = data; - - if (has_control_mapping) { - gchar action_name[25]; - gchar *action_params; - if(ar->add) { - const gchar *internal_ip; - /* get the internal IP */ - if(!(internal_ip = purple_upnp_get_internal_ip())) { - purple_debug_error("upnp", - "purple_upnp_set_port_mapping(): couldn't get local ip\n"); - /* UGLY */ - if (ar->cb) - ar->cb(FALSE, ar->cb_data); - g_free(ar); - return; - } - strncpy(action_name, "AddPortMapping", - sizeof(action_name)); - action_params = g_strdup_printf( - ADD_PORT_MAPPING_PARAMS, - ar->portmap, ar->protocol, ar->portmap, - internal_ip); - } else { - strncpy(action_name, "DeletePortMapping", sizeof(action_name)); - action_params = g_strdup_printf( - DELETE_PORT_MAPPING_PARAMS, - ar->portmap, ar->protocol); - } - - ar->gfud = purple_upnp_generate_action_message_and_send(action_name, - action_params, done_port_mapping_cb, ar); - - g_free(action_params); - return; - } - - - if (ar->cb) - ar->cb(FALSE, ar->cb_data); - g_free(ar); -} - -static gboolean -fire_port_mapping_failure_cb(gpointer data) -{ - do_port_mapping_cb(FALSE, data); - return FALSE; -} - -void purple_upnp_cancel_port_mapping(UPnPMappingAddRemove *ar) -{ - GSList *l; - - /* Remove ar from discovery_callbacks if present; it was inserted after a cb. - * The same cb may be in the list multple times, so be careful to remove the one assocaited with ar. */ - l = discovery_callbacks; - while (l) - { - if (l->next && (l->next->data == ar)) { - discovery_callbacks = g_slist_delete_link(discovery_callbacks, l->next); - discovery_callbacks = g_slist_delete_link(discovery_callbacks, l); - } - - l = l->next; - } - - if (ar->tima > 0) - purple_timeout_remove(ar->tima); - - if (ar->gfud) - purple_util_fetch_url_cancel(ar->gfud); - - g_free(ar); -} - -UPnPMappingAddRemove * -purple_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, - PurpleUPnPCallback cb, gpointer cb_data) -{ - UPnPMappingAddRemove *ar; - - ar = g_new0(UPnPMappingAddRemove, 1); - ar->cb = cb; - ar->cb_data = cb_data; - ar->add = TRUE; - ar->portmap = portmap; - strncpy(ar->protocol, protocol, sizeof(ar->protocol)); - - /* If we're waiting for a discovery, add to the callbacks list */ - if(control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) { - /* TODO: This will fail because when this cb is triggered, - * the internal IP lookup won't be complete */ - discovery_callbacks = g_slist_append( - discovery_callbacks, do_port_mapping_cb); - discovery_callbacks = g_slist_append( - discovery_callbacks, ar); - return ar; - } - - /* If we haven't had a successful UPnP discovery, check if 5 minutes has - * elapsed since the last try, try again */ - if(control_info.status == PURPLE_UPNP_STATUS_UNDISCOVERED || - (control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER - && (time(NULL) - control_info.lookup_time) > 300)) { - purple_upnp_discover(do_port_mapping_cb, ar); - return ar; - } else if(control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER) { - if (cb) { - /* Asynchronously trigger a failed response */ - ar->tima = purple_timeout_add(10, fire_port_mapping_failure_cb, ar); - } else { - /* No need to do anything if nobody expects a response*/ - g_free(ar); - ar = NULL; - } - return ar; - } - - do_port_mapping_cb(TRUE, ar); - return ar; -} - -UPnPMappingAddRemove * -purple_upnp_remove_port_mapping(unsigned short portmap, const char* protocol, - PurpleUPnPCallback cb, gpointer cb_data) -{ - UPnPMappingAddRemove *ar; - - ar = g_new0(UPnPMappingAddRemove, 1); - ar->cb = cb; - ar->cb_data = cb_data; - ar->add = FALSE; - ar->portmap = portmap; - strncpy(ar->protocol, protocol, sizeof(ar->protocol)); - - /* If we're waiting for a discovery, add to the callbacks list */ - if(control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) { - discovery_callbacks = g_slist_append( - discovery_callbacks, do_port_mapping_cb); - discovery_callbacks = g_slist_append( - discovery_callbacks, ar); - return ar; - } - - /* If we haven't had a successful UPnP discovery, check if 5 minutes has - * elapsed since the last try, try again */ - if(control_info.status == PURPLE_UPNP_STATUS_UNDISCOVERED || - (control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER - && (time(NULL) - control_info.lookup_time) > 300)) { - purple_upnp_discover(do_port_mapping_cb, ar); - return ar; - } else if(control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER) { - if (cb) { - /* Asynchronously trigger a failed response */ - ar->tima = purple_timeout_add(10, fire_port_mapping_failure_cb, ar); - } else { - /* No need to do anything if nobody expects a response*/ - g_free(ar); - ar = NULL; - } - return ar; - } - - do_port_mapping_cb(TRUE, ar); - return ar; -} - -static void -purple_upnp_network_config_changed_cb(void *data) -{ - /* Reset the control_info to default values */ - control_info.status = PURPLE_UPNP_STATUS_UNDISCOVERED; - g_free(control_info.control_url); - control_info.control_url = NULL; - control_info.service_type[0] = '\0'; - control_info.publicip[0] = '\0'; - control_info.internalip[0] = '\0'; - control_info.lookup_time = 0; -} - -static void* -purple_upnp_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_upnp_init() -{ - purple_signal_connect(purple_network_get_handle(), "network-configuration-changed", - purple_upnp_get_handle(), PURPLE_CALLBACK(purple_upnp_network_config_changed_cb), - NULL); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/upnp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file upnp.h Universal Plug N Play API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_UPNP_H_ -#define _PURPLE_UPNP_H_ - -typedef struct _UPnPMappingAddRemove UPnPMappingAddRemove; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name UPnP API */ -/**************************************************************************/ -/*@{*/ - -/* typedef struct _PurpleUPnPRequestData PurpleUPnPRequestData; */ - -typedef void (*PurpleUPnPCallback) (gboolean success, gpointer data); - - -/** - * Initialize UPnP - */ -void purple_upnp_init(void); - - -/** - * Sends a discovery request to search for a UPnP enabled IGD that - * contains the WANIPConnection service that will allow us to recieve the - * public IP address of the IGD, and control it for forwarding ports. - * The result will be cached for further use. - * - * @param cb an optional callback function to be notified when the UPnP - * discovery is complete - * @param cb_data Extra data to be passed to the callback - */ -void purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data); - -#if 0 -/** - * Retrieve the current UPnP control info, if there is any available. - * This will only be filled in if purple_upnp_discover() had been called, - * and finished discovering. - * - * @return The control URL for the IGD we'll use to use the IGD services - */ -const PurpleUPnPControlInfo* purple_upnp_get_control_info(void); -#endif - -/** - * Gets the IP address from a UPnP enabled IGD that sits on the local - * network, so when getting the network IP, instead of returning the - * local network IP, the public IP is retrieved. This is a cached value from - * the time of the UPnP discovery. - * - * @return The IP address of the network, or NULL if something went wrong - */ -const gchar* purple_upnp_get_public_ip(void); - -/** - * Cancel a pending port mapping request initiated with either - * purple_upnp_set_port_mapping() or purple_upnp_remove_port_mapping(). - * - * @param mapping_data The data returned when you initiated the UPnP mapping request. - */ -void purple_upnp_cancel_port_mapping(UPnPMappingAddRemove *mapping_data); - -/** - * Maps Ports in a UPnP enabled IGD that sits on the local network to - * this purple client. Essentially, this function takes care of the port - * forwarding so things like file transfers can work behind NAT firewalls - * - * @param portmap The port to map to this client - * @param protocol The protocol to map, either "TCP" or "UDP" - * @param cb an optional callback function to be notified when the mapping - * addition is complete - * @param cb_data Extra data to be passed to the callback - * - * @return Data which can be passed to purple_upnp_port_mapping_cancel() to cancel - */ -UPnPMappingAddRemove *purple_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, - PurpleUPnPCallback cb, gpointer cb_data); - -/** - * Deletes a port mapping in a UPnP enabled IGD that sits on the local network - * to this purple client. Essentially, this function takes care of deleting the - * port forwarding after they have completed a connection so another client on - * the local network can take advantage of the port forwarding - * - * @param portmap The port to delete the mapping for - * @param protocol The protocol to map to. Either "TCP" or "UDP" - * @param cb an optional callback function to be notified when the mapping - * removal is complete - * @param cb_data Extra data to be passed to the callback - * - * @return Data which can be passed to purple_upnp_port_mapping_cancel() to cancel - */ -UPnPMappingAddRemove *purple_upnp_remove_port_mapping(unsigned short portmap, - const gchar* protocol, PurpleUPnPCallback cb, gpointer cb_data); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_UPNP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.5/libpurple/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5155 +0,0 @@ -/* - * @file util.h Utility Functions - * @ingroup core - */ - -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "cipher.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "prefs.h" -#include "util.h" - -struct _PurpleUtilFetchUrlData -{ - PurpleUtilFetchUrlCallback callback; - void *user_data; - - struct - { - char *user; - char *passwd; - char *address; - int port; - char *page; - - } website; - - char *url; - int num_times_redirected; - gboolean full; - char *user_agent; - gboolean http11; - char *request; - gsize request_written; - gboolean include_headers; - - gboolean is_ssl; - PurpleSslConnection *ssl_connection; - PurpleProxyConnectData *connect_data; - int fd; - guint inpa; - - gboolean got_headers; - gboolean has_explicit_data_len; - char *webdata; - gsize len; - unsigned long data_len; - gssize max_len; - gboolean chunked; -}; - -static char *custom_user_dir = NULL; -static char *user_dir = NULL; - - -PurpleMenuAction * -purple_menu_action_new(const char *label, PurpleCallback callback, gpointer data, - GList *children) -{ - PurpleMenuAction *act = g_new0(PurpleMenuAction, 1); - act->label = g_strdup(label); - act->callback = callback; - act->data = data; - act->children = children; - return act; -} - -void -purple_menu_action_free(PurpleMenuAction *act) -{ - g_return_if_fail(act != NULL); - - g_free(act->label); - g_free(act); -} - -void -purple_util_init(void) -{ - /* This does nothing right now. It exists for symmetry with - * purple_util_uninit() and forwards compatibility. */ -} - -void -purple_util_uninit(void) -{ - /* Free these so we don't have leaks at shutdown. */ - - g_free(custom_user_dir); - custom_user_dir = NULL; - - g_free(user_dir); - user_dir = NULL; -} - -/************************************************************************** - * Base16 Functions - **************************************************************************/ -gchar * -purple_base16_encode(const guchar *data, gsize len) -{ - int i; - gchar *ascii = NULL; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(len > 0, NULL); - - ascii = g_malloc(len * 2 + 1); - - for (i = 0; i < len; i++) - g_snprintf(&ascii[i * 2], 3, "%02hhx", data[i]); - - return ascii; -} - -guchar * -purple_base16_decode(const char *str, gsize *ret_len) -{ - int len, i, accumulator = 0; - guchar *data; - - g_return_val_if_fail(str != NULL, NULL); - - len = strlen(str); - - g_return_val_if_fail(strlen(str) > 0, 0); - g_return_val_if_fail(len % 2 == 0, 0); - - data = g_malloc(len / 2); - - for (i = 0; i < len; i++) - { - if ((i % 2) == 0) - accumulator = 0; - else - accumulator <<= 4; - - if (isdigit(str[i])) - accumulator |= str[i] - 48; - else - { - switch(tolower(str[i])) - { - case 'a': accumulator |= 10; break; - case 'b': accumulator |= 11; break; - case 'c': accumulator |= 12; break; - case 'd': accumulator |= 13; break; - case 'e': accumulator |= 14; break; - case 'f': accumulator |= 15; break; - } - } - - if (i % 2) - data[(i - 1) / 2] = accumulator; - } - - if (ret_len != NULL) - *ret_len = len / 2; - - return data; -} - -gchar * -purple_base16_encode_chunked(const guchar *data, gsize len) -{ - int i; - gchar *ascii = NULL; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(len > 0, NULL); - - /* For each byte of input, we need 2 bytes for the hex representation - * and 1 for the colon. - * The final colon will be replaced by a terminating NULL - */ - ascii = g_malloc(len * 3 + 1); - - for (i = 0; i < len; i++) - g_snprintf(&ascii[i * 3], 4, "%02hhx:", data[i]); - - /* Replace the final colon with NULL */ - ascii[len * 3 - 1] = 0; - - return ascii; -} - - -/************************************************************************** - * Base64 Functions - **************************************************************************/ -static const char alphabet[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - -static const char xdigits[] = - "0123456789abcdef"; - -gchar * -purple_base64_encode(const guchar *data, gsize len) -{ -#if GLIB_CHECK_VERSION(2,12,0) - return g_base64_encode(data, len); -#else - char *out, *rv; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(len > 0, NULL); - - rv = out = g_malloc(((len/3)+1)*4 + 1); - - for (; len >= 3; len -= 3) - { - *out++ = alphabet[data[0] >> 2]; - *out++ = alphabet[((data[0] << 4) & 0x30) | (data[1] >> 4)]; - *out++ = alphabet[((data[1] << 2) & 0x3c) | (data[2] >> 6)]; - *out++ = alphabet[data[2] & 0x3f]; - data += 3; - } - - if (len > 0) - { - unsigned char fragment; - - *out++ = alphabet[data[0] >> 2]; - fragment = (data[0] << 4) & 0x30; - - if (len > 1) - fragment |= data[1] >> 4; - - *out++ = alphabet[fragment]; - *out++ = (len < 2) ? '=' : alphabet[(data[1] << 2) & 0x3c]; - *out++ = '='; - } - - *out = '\0'; - - return rv; -#endif /* GLIB < 2.12.0 */ -} - -guchar * -purple_base64_decode(const char *str, gsize *ret_len) -{ -#if GLIB_CHECK_VERSION(2,12,0) - /* - * We want to allow ret_len to be NULL for backward compatibility, - * but g_base64_decode() requires a valid length variable. So if - * ret_len is NULL then pass in a dummy variable. - */ - gsize unused; - return g_base64_decode(str, ret_len != NULL ? ret_len : &unused); -#else - guchar *out = NULL; - char tmp = 0; - const char *c; - gint32 tmp2 = 0; - int len = 0, n = 0; - - g_return_val_if_fail(str != NULL, NULL); - - c = str; - - while (*c) { - if (*c >= 'A' && *c <= 'Z') { - tmp = *c - 'A'; - } else if (*c >= 'a' && *c <= 'z') { - tmp = 26 + (*c - 'a'); - } else if (*c >= '0' && *c <= 57) { - tmp = 52 + (*c - '0'); - } else if (*c == '+') { - tmp = 62; - } else if (*c == '/') { - tmp = 63; - } else if (*c == '\r' || *c == '\n') { - c++; - continue; - } else if (*c == '=') { - if (n == 3) { - out = g_realloc(out, len + 2); - out[len] = (guchar)(tmp2 >> 10) & 0xff; - len++; - out[len] = (guchar)(tmp2 >> 2) & 0xff; - len++; - } else if (n == 2) { - out = g_realloc(out, len + 1); - out[len] = (guchar)(tmp2 >> 4) & 0xff; - len++; - } - break; - } - tmp2 = ((tmp2 << 6) | (tmp & 0xff)); - n++; - if (n == 4) { - out = g_realloc(out, len + 3); - out[len] = (guchar)((tmp2 >> 16) & 0xff); - len++; - out[len] = (guchar)((tmp2 >> 8) & 0xff); - len++; - out[len] = (guchar)(tmp2 & 0xff); - len++; - tmp2 = 0; - n = 0; - } - c++; - } - - out = g_realloc(out, len + 1); - out[len] = 0; - - if (ret_len != NULL) - *ret_len = len; - - return out; -#endif /* GLIB < 2.12.0 */ -} - -/************************************************************************** - * Quoted Printable Functions (see RFC 2045). - **************************************************************************/ -guchar * -purple_quotedp_decode(const char *str, gsize *ret_len) -{ - char *n, *new; - const char *end, *p; - - n = new = g_malloc(strlen (str) + 1); - end = str + strlen(str); - - for (p = str; p < end; p++, n++) { - if (*p == '=') { - if (p[1] == '\r' && p[2] == '\n') { /* 5.1 #5 */ - n -= 1; - p += 2; - } else if (p[1] == '\n') { /* fuzzy case for 5.1 #5 */ - n -= 1; - p += 1; - } else if (p[1] && p[2]) { - char *nibble1 = strchr(xdigits, tolower(p[1])); - char *nibble2 = strchr(xdigits, tolower(p[2])); - if (nibble1 && nibble2) { /* 5.1 #1 */ - *n = ((nibble1 - xdigits) << 4) | (nibble2 - xdigits); - p += 2; - } else { /* This should never happen */ - *n = *p; - } - } else { /* This should never happen */ - *n = *p; - } - } - else if (*p == '_') - *n = ' '; - else - *n = *p; - } - - *n = '\0'; - - if (ret_len != NULL) - *ret_len = n - new; - - /* Resize to take less space */ - /* new = realloc(new, n - new); */ - - return (guchar *)new; -} - -/************************************************************************** - * MIME Functions - **************************************************************************/ -char * -purple_mime_decode_field(const char *str) -{ - /* - * This is wing's version, partially based on revo/shx's version - * See RFC2047 [which apparently obsoletes RFC1342] - */ - typedef enum { - state_start, state_equal1, state_question1, - state_charset, state_question2, - state_encoding, state_question3, - state_encoded_text, state_question4, state_equal2 = state_start - } encoded_word_state_t; - encoded_word_state_t state = state_start; - const char *cur, *mark; - const char *charset0 = NULL, *encoding0 = NULL, *encoded_text0 = NULL; - GString *new; - - /* token can be any CHAR (supposedly ISO8859-1/ISO2022), not just ASCII */ - #define token_char_p(c) \ - (c != ' ' && !iscntrl(c) && !strchr("()<>@,;:\"/[]?.=", c)) - - /* But encoded-text must be ASCII; alas, isascii() may not exist */ - #define encoded_text_char_p(c) \ - ((c & 0x80) == 0 && c != '?' && c != ' ' && isgraph(c)) - - g_return_val_if_fail(str != NULL, NULL); - - new = g_string_new(NULL); - - /* Here we will be looking for encoded words and if they seem to be - * valid then decode them. - * They are of this form: =?charset?encoding?text?= - */ - - for (cur = str, mark = NULL; *cur; cur += 1) { - switch (state) { - case state_equal1: - if (*cur == '?') { - state = state_question1; - } else { - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question1: - if (token_char_p(*cur)) { - charset0 = cur; - state = state_charset; - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_charset: - if (*cur == '?') { - state = state_question2; - } else if (!token_char_p(*cur)) { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question2: - if (token_char_p(*cur)) { - encoding0 = cur; - state = state_encoding; - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_encoding: - if (*cur == '?') { - state = state_question3; - } else if (!token_char_p(*cur)) { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question3: - if (encoded_text_char_p(*cur)) { - encoded_text0 = cur; - state = state_encoded_text; - } else if (*cur == '?') { /* empty string */ - encoded_text0 = cur; - state = state_question4; - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_encoded_text: - if (*cur == '?') { - state = state_question4; - } else if (!encoded_text_char_p(*cur)) { - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question4: - if (*cur == '=') { /* Got the whole encoded-word */ - char *charset = g_strndup(charset0, encoding0 - charset0 - 1); - char *encoding = g_strndup(encoding0, encoded_text0 - encoding0 - 1); - char *encoded_text = g_strndup(encoded_text0, cur - encoded_text0 - 1); - guchar *decoded = NULL; - gsize dec_len; - if (g_ascii_strcasecmp(encoding, "Q") == 0) - decoded = purple_quotedp_decode(encoded_text, &dec_len); - else if (g_ascii_strcasecmp(encoding, "B") == 0) - decoded = purple_base64_decode(encoded_text, &dec_len); - else - decoded = NULL; - if (decoded) { - gsize len; - char *converted = g_convert((const gchar *)decoded, dec_len, "utf-8", charset, NULL, &len, NULL); - - if (converted) { - g_string_append_len(new, converted, len); - g_free(converted); - } - g_free(decoded); - } - g_free(charset); - g_free(encoding); - g_free(encoded_text); - state = state_equal2; /* Restart the FSM */ - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - default: - if (*cur == '=') { - mark = cur; - state = state_equal1; - } else { - /* Some unencoded text. */ - g_string_append_c(new, *cur); - } - break; - } /* switch */ - } /* for */ - - if (state != state_start) - g_string_append_len(new, mark, cur - mark + 1); - - return g_string_free(new, FALSE);; -} - - -/************************************************************************** - * Date/Time Functions - **************************************************************************/ - -const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso) -{ - static char buf[7]; - long off; - gint8 min; - gint8 hrs; - struct tm new_tm = *tm; - - mktime(&new_tm); - - if (new_tm.tm_isdst < 0) - g_return_val_if_reached(""); - -#ifdef _WIN32 - if ((off = wpurple_get_tz_offset()) == -1) - return ""; -#else -# ifdef HAVE_TM_GMTOFF - off = new_tm.tm_gmtoff; -# else -# ifdef HAVE_TIMEZONE - tzset(); - off = -1 * timezone; -# endif /* HAVE_TIMEZONE */ -# endif /* !HAVE_TM_GMTOFF */ -#endif /* _WIN32 */ - - min = (off / 60) % 60; - hrs = ((off / 60) - min) / 60; - - if(iso) { - if (0 == off) { - strcpy(buf, "Z"); - } else { - /* please leave the colons...they're optional for iso, but jabber - * wants them */ - if(g_snprintf(buf, sizeof(buf), "%+03d:%02d", hrs, ABS(min)) > 6) - g_return_val_if_reached(""); - } - } else { - if (g_snprintf(buf, sizeof(buf), "%+03d%02d", hrs, ABS(min)) > 5) - g_return_val_if_reached(""); - } - - return buf; -} - -/* Windows doesn't HAVE_STRFTIME_Z_FORMAT, but this seems clearer. -- rlaager */ -#if !defined(HAVE_STRFTIME_Z_FORMAT) || defined(_WIN32) -static size_t purple_internal_strftime(char *s, size_t max, const char *format, const struct tm *tm) -{ - const char *start; - const char *c; - char *fmt = NULL; - - /* Yes, this is checked in purple_utf8_strftime(), - * but better safe than sorry. -- rlaager */ - g_return_val_if_fail(format != NULL, 0); - - /* This is fairly efficient, and it only gets - * executed on Windows or if the underlying - * system doesn't support the %z format string, - * for strftime() so I think it's good enough. - * -- rlaager */ - for (c = start = format; *c ; c++) - { - if (*c != '%') - continue; - - c++; - -#ifndef HAVE_STRFTIME_Z_FORMAT - if (*c == 'z') - { - char *tmp = g_strdup_printf("%s%.*s%s", - fmt ? fmt : "", - c - start - 1, - start, - purple_get_tzoff_str(tm, FALSE)); - g_free(fmt); - fmt = tmp; - start = c + 1; - } -#endif -#ifdef _WIN32 - if (*c == 'Z') - { - char *tmp = g_strdup_printf("%s%.*s%s", - fmt ? fmt : "", - c - start - 1, - start, - wpurple_get_timezone_abbreviation(tm)); - g_free(fmt); - fmt = tmp; - start = c + 1; - } -#endif - } - - if (fmt != NULL) - { - size_t ret; - - if (*start) - { - char *tmp = g_strconcat(fmt, start, NULL); - g_free(fmt); - fmt = tmp; - } - - ret = strftime(s, max, fmt, tm); - g_free(fmt); - - return ret; - } - - return strftime(s, max, format, tm); -} -#else /* HAVE_STRFTIME_Z_FORMAT && !_WIN32 */ -#define purple_internal_strftime strftime -#endif - -const char * -purple_utf8_strftime(const char *format, const struct tm *tm) -{ - static char buf[128]; - char *locale; - GError *err = NULL; - int len; - char *utf8; - - g_return_val_if_fail(format != NULL, NULL); - - if (tm == NULL) - { - time_t now = time(NULL); - tm = localtime(&now); - } - - locale = g_locale_from_utf8(format, -1, NULL, NULL, &err); - if (err != NULL) - { - purple_debug_error("util", "Format conversion failed in purple_utf8_strftime(): %s\n", err->message); - g_error_free(err); - locale = g_strdup(format); - } - - /* A return value of 0 is either an error (in - * which case, the contents of the buffer are - * undefined) or the empty string (in which - * case, no harm is done here). */ - if ((len = purple_internal_strftime(buf, sizeof(buf), locale, tm)) == 0) - { - g_free(locale); - return ""; - } - - g_free(locale); - - utf8 = g_locale_to_utf8(buf, len, NULL, NULL, &err); - if (err != NULL) - { - purple_debug_error("util", "Result conversion failed in purple_utf8_strftime(): %s\n", err->message); - g_error_free(err); - } - else - { - purple_strlcpy(buf, utf8); - g_free(utf8); - } - - return buf; -} - -const char * -purple_date_format_short(const struct tm *tm) -{ - return purple_utf8_strftime("%x", tm); -} - -const char * -purple_date_format_long(const struct tm *tm) -{ - /* - * This string determines how some dates are displayed. The default - * string "%x %X" shows the date then the time. Translators can - * change this to "%X %x" if they want the time to be shown first, - * followed by the date. - */ - return purple_utf8_strftime(_("%x %X"), tm); -} - -const char * -purple_date_format_full(const struct tm *tm) -{ - return purple_utf8_strftime("%c", tm); -} - -const char * -purple_time_format(const struct tm *tm) -{ - return purple_utf8_strftime("%X", tm); -} - -time_t -purple_time_build(int year, int month, int day, int hour, int min, int sec) -{ - struct tm tm; - - tm.tm_year = year - 1900; - tm.tm_mon = month - 1; - tm.tm_mday = day; - tm.tm_hour = hour; - tm.tm_min = min; - tm.tm_sec = sec >= 0 ? sec : time(NULL) % 60; - - return mktime(&tm); -} - -time_t -purple_str_to_time(const char *timestamp, gboolean utc, - struct tm *tm, long *tz_off, const char **rest) -{ - time_t retval = 0; - static struct tm t; - const char *c = timestamp; - int year = 0; - long tzoff = PURPLE_NO_TZ_OFF; - - time(&retval); - localtime_r(&retval, &t); - - if (rest != NULL) - *rest = NULL; - - /* 4 digit year */ - if (sscanf(c, "%04d", &year) && year > 1900) - { - c += 4; - if (*c == '-') - c++; - t.tm_year = year - 1900; - } - - /* 2 digit month */ - if (!sscanf(c, "%02d", &t.tm_mon)) - { - if (rest != NULL && *c != '\0') - *rest = c; - return 0; - } - c += 2; - if (*c == '-' || *c == '/') - c++; - t.tm_mon -= 1; - - /* 2 digit day */ - if (!sscanf(c, "%02d", &t.tm_mday)) - { - if (rest != NULL && *c != '\0') - *rest = c; - return 0; - } - c += 2; - if (*c == '/') - { - c++; - - if (!sscanf(c, "%04d", &t.tm_year)) - { - if (rest != NULL && *c != '\0') - *rest = c; - return 0; - } - t.tm_year -= 1900; - } - else if (*c == 'T' || *c == '.') - { - c++; - /* we have more than a date, keep going */ - - /* 2 digit hour */ - if ((sscanf(c, "%02d:%02d:%02d", &t.tm_hour, &t.tm_min, &t.tm_sec) == 3 && (c = c + 8)) || - (sscanf(c, "%02d%02d%02d", &t.tm_hour, &t.tm_min, &t.tm_sec) == 3 && (c = c + 6))) - { - gboolean offset_positive = FALSE; - int tzhrs; - int tzmins; - - t.tm_isdst = -1; - - if (*c == '.') { - do { - c++; - } while (*c >= '0' && *c <= '9'); /* dealing with precision we don't care about */ - } - if (*c == '+') - offset_positive = TRUE; - if (((*c == '+' || *c == '-') && (c = c + 1)) && - ((sscanf(c, "%02d:%02d", &tzhrs, &tzmins) == 2 && (c = c + 5)) || - (sscanf(c, "%02d%02d", &tzhrs, &tzmins) == 2 && (c = c + 4)))) - { - tzoff = tzhrs*60*60 + tzmins*60; - if (offset_positive) - tzoff *= -1; - } - else if ((*c == 'Z') && (c = c + 1)) - { - /* 'Z' = Zulu = UTC */ - tzoff = 0; - } - else if (utc) - { - static struct tm tmptm; - time_t tmp; - tmp = mktime(&t); - /* we care about whether it *was* dst, and the offset, here on this - * date, not whether we are currently observing dst locally *now*. - * This isn't perfect, because we would need to know in advance the - * offset we are trying to work out in advance to be sure this - * works for times around dst transitions but it'll have to do. */ - localtime_r(&tmp, &tmptm); - t.tm_isdst = tmptm.tm_isdst; -#ifdef HAVE_TM_GMTOFF - t.tm_gmtoff = tmptm.tm_gmtoff; -#endif - } - - if (rest != NULL && *c != '\0') - { - if (*c == ' ') - c++; - if (*c != '\0') - *rest = c; - } - - if (tzoff != PURPLE_NO_TZ_OFF || utc) - { -#if defined(_WIN32) - long sys_tzoff; -#endif - -#if defined(_WIN32) || defined(HAVE_TM_GMTOFF) || defined (HAVE_TIMEZONE) - if (tzoff == PURPLE_NO_TZ_OFF) - tzoff = 0; -#endif - -#ifdef _WIN32 - if ((sys_tzoff = wpurple_get_tz_offset()) == -1) - tzoff = PURPLE_NO_TZ_OFF; - else - tzoff += sys_tzoff; -#else -#ifdef HAVE_TM_GMTOFF - tzoff += t.tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); /* making sure */ - tzoff -= timezone; -# endif -#endif -#endif /* _WIN32 */ - } - } - else - { - if (rest != NULL && *c != '\0') - *rest = c; - } - } - - retval = mktime(&t); - - if (tm != NULL) - *tm = t; - - if (tzoff != PURPLE_NO_TZ_OFF) - retval += tzoff; - - if (tz_off != NULL) - *tz_off = tzoff; - - return retval; -} - -/************************************************************************** - * Markup Functions - **************************************************************************/ - -/* - * This function is stolen from glib's gmarkup.c and modified to not - * replace ' with ' - */ -static void append_escaped_text(GString *str, - const gchar *text, gssize length) -{ - const gchar *p; - const gchar *end; - gunichar c; - - p = text; - end = text + length; - - while (p != end) - { - const gchar *next; - next = g_utf8_next_char (p); - - switch (*p) - { - case '&': - g_string_append (str, "&"); - break; - - case '<': - g_string_append (str, "<"); - break; - - case '>': - g_string_append (str, ">"); - break; - - case '"': - g_string_append (str, """); - break; - - default: - c = g_utf8_get_char (p); - if ((0x1 <= c && c <= 0x8) || - (0xb <= c && c <= 0xc) || - (0xe <= c && c <= 0x1f) || - (0x7f <= c && c <= 0x84) || - (0x86 <= c && c <= 0x9f)) - g_string_append_printf (str, "&#x%x;", c); - else - g_string_append_len (str, p, next - p); - break; - } - - p = next; - } -} - -/* This function is stolen from glib's gmarkup.c */ -gchar *purple_markup_escape_text(const gchar *text, gssize length) -{ - GString *str; - - g_return_val_if_fail(text != NULL, NULL); - - if (length < 0) - length = strlen(text); - - /* prealloc at least as long as original text */ - str = g_string_sized_new(length); - append_escaped_text(str, text, length); - - return g_string_free(str, FALSE); -} - -const char * -purple_markup_unescape_entity(const char *text, int *length) -{ - const char *pln; - int len, pound; - char temp[2]; - - if (!text || *text != '&') - return NULL; - -#define IS_ENTITY(s) (!g_ascii_strncasecmp(text, s, (len = sizeof(s) - 1))) - - if(IS_ENTITY("&")) - pln = "&"; - else if(IS_ENTITY("<")) - pln = "<"; - else if(IS_ENTITY(">")) - pln = ">"; - else if(IS_ENTITY(" ")) - pln = " "; - else if(IS_ENTITY("©")) - pln = "\302\251"; /* or use g_unichar_to_utf8(0xa9); */ - else if(IS_ENTITY(""")) - pln = "\""; - else if(IS_ENTITY("®")) - pln = "\302\256"; /* or use g_unichar_to_utf8(0xae); */ - else if(IS_ENTITY("'")) - pln = "\'"; - else if(*(text+1) == '#' && - (sscanf(text, "&#%u%1[;]", £, temp) == 2 || - sscanf(text, "&#x%x%1[;]", £, temp) == 2) && - pound != 0) { - static char buf[7]; - int buflen = g_unichar_to_utf8((gunichar)pound, buf); - buf[buflen] = '\0'; - pln = buf; - - len = (*(text+2) == 'x' ? 3 : 2); - while(isxdigit((gint) text[len])) len++; - if(text[len] == ';') len++; - } - else - return NULL; - - if (length) - *length = len; - return pln; -} - -char * -purple_markup_get_css_property(const gchar *style, - const gchar *opt) -{ - const gchar *css_str = style; - const gchar *css_value_start; - const gchar *css_value_end; - gchar *tmp; - gchar *ret; - - g_return_val_if_fail(opt != NULL, NULL); - - if (!css_str) - return NULL; - - /* find the CSS property */ - while (1) - { - /* skip whitespace characters */ - while (*css_str && g_ascii_isspace(*css_str)) - css_str++; - if (!g_ascii_isalpha(*css_str)) - return NULL; - if (g_ascii_strncasecmp(css_str, opt, strlen(opt))) - { - /* go to next css property positioned after the next ';' */ - while (*css_str && *css_str != '"' && *css_str != ';') - css_str++; - if(*css_str != ';') - return NULL; - css_str++; - } - else - break; - } - - /* find the CSS value position in the string */ - css_str += strlen(opt); - while (*css_str && g_ascii_isspace(*css_str)) - css_str++; - if (*css_str != ':') - return NULL; - css_str++; - while (*css_str && g_ascii_isspace(*css_str)) - css_str++; - if (*css_str == '\0' || *css_str == '"' || *css_str == ';') - return NULL; - - /* mark the CSS value */ - css_value_start = css_str; - while (*css_str && *css_str != '"' && *css_str != ';') - css_str++; - css_value_end = css_str - 1; - - /* Removes trailing whitespace */ - while (css_value_end > css_value_start && g_ascii_isspace(*css_value_end)) - css_value_end--; - - tmp = g_strndup(css_value_start, css_value_end - css_value_start + 1); - ret = purple_unescape_html(tmp); - g_free(tmp); - - return ret; -} - -gboolean purple_markup_is_rtl(const char *html) -{ - GData *attributes; - const gchar *start, *end; - gboolean res = FALSE; - - if (purple_markup_find_tag("span", html, &start, &end, &attributes)) - { - /* tmp is a member of attributes and is free with g_datalist_clear call */ - const char *tmp = g_datalist_get_data(&attributes, "dir"); - if (tmp && !g_ascii_strcasecmp(tmp, "RTL")) - res = TRUE; - if (!res) - { - tmp = g_datalist_get_data(&attributes, "style"); - if (tmp) - { - char *tmp2 = purple_markup_get_css_property(tmp, "direction"); - if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL")) - res = TRUE; - g_free(tmp2); - } - - } - g_datalist_clear(&attributes); - } - return res; -} - -gboolean -purple_markup_find_tag(const char *needle, const char *haystack, - const char **start, const char **end, GData **attributes) -{ - GData *attribs; - const char *cur = haystack; - char *name = NULL; - gboolean found = FALSE; - gboolean in_tag = FALSE; - gboolean in_attr = FALSE; - const char *in_quotes = NULL; - size_t needlelen; - - g_return_val_if_fail( needle != NULL, FALSE); - g_return_val_if_fail( *needle != '\0', FALSE); - g_return_val_if_fail( haystack != NULL, FALSE); - g_return_val_if_fail( start != NULL, FALSE); - g_return_val_if_fail( end != NULL, FALSE); - g_return_val_if_fail(attributes != NULL, FALSE); - - needlelen = strlen(needle); - g_datalist_init(&attribs); - - while (*cur && !found) { - if (in_tag) { - if (in_quotes) { - const char *close = cur; - - while (*close && *close != *in_quotes) - close++; - - /* if we got the close quote, store the value and carry on from * - * after it. if we ran to the end of the string, point to the NULL * - * and we're outta here */ - if (*close) { - /* only store a value if we have an attribute name */ - if (name) { - size_t len = close - cur; - char *val = g_strndup(cur, len); - - g_datalist_set_data_full(&attribs, name, val, g_free); - g_free(name); - name = NULL; - } - - in_quotes = NULL; - cur = close + 1; - } else { - cur = close; - } - } else if (in_attr) { - const char *close = cur; - - while (*close && *close != '>' && *close != '"' && - *close != '\'' && *close != ' ' && *close != '=') - close++; - - /* if we got the equals, store the name of the attribute. if we got - * the quote, save the attribute and go straight to quote mode. - * otherwise the tag closed or we reached the end of the string, - * so we can get outta here */ - switch (*close) { - case '"': - case '\'': - in_quotes = close; - case '=': - { - size_t len = close - cur; - - /* don't store a blank attribute name */ - if (len) { - g_free(name); - name = g_ascii_strdown(cur, len); - } - - in_attr = FALSE; - cur = close + 1; - break; - } - case ' ': - case '>': - in_attr = FALSE; - default: - cur = close; - break; - } - } else { - switch (*cur) { - case ' ': - /* swallow extra spaces inside tag */ - while (*cur && *cur == ' ') cur++; - in_attr = TRUE; - break; - case '>': - found = TRUE; - *end = cur; - break; - case '"': - case '\'': - in_quotes = cur; - default: - cur++; - break; - } - } - } else { - /* if we hit a < followed by the name of our tag... */ - if (*cur == '<' && !g_ascii_strncasecmp(cur + 1, needle, needlelen)) { - *start = cur; - cur = cur + needlelen + 1; - - /* if we're pointing at a space or a >, we found the right tag. if * - * we're not, we've found a longer tag, so we need to skip to the * - * >, but not being distracted by >s inside quotes. */ - if (*cur == ' ' || *cur == '>') { - in_tag = TRUE; - } else { - while (*cur && *cur != '"' && *cur != '\'' && *cur != '>') { - if (*cur == '"') { - cur++; - while (*cur && *cur != '"') - cur++; - } else if (*cur == '\'') { - cur++; - while (*cur && *cur != '\'') - cur++; - } else { - cur++; - } - } - } - } else { - cur++; - } - } - } - - /* clean up any attribute name from a premature termination */ - g_free(name); - - if (found) { - *attributes = attribs; - } else { - *start = NULL; - *end = NULL; - *attributes = NULL; - } - - return found; -} - -gboolean -purple_markup_extract_info_field(const char *str, int len, PurpleNotifyUserInfo *user_info, - const char *start_token, int skip, - const char *end_token, char check_value, - const char *no_value_token, - const char *display_name, gboolean is_link, - const char *link_prefix, - PurpleInfoFieldFormatCallback format_cb) -{ - const char *p, *q; - - g_return_val_if_fail(str != NULL, FALSE); - g_return_val_if_fail(user_info != NULL, FALSE); - g_return_val_if_fail(start_token != NULL, FALSE); - g_return_val_if_fail(end_token != NULL, FALSE); - g_return_val_if_fail(display_name != NULL, FALSE); - - p = strstr(str, start_token); - - if (p == NULL) - return FALSE; - - p += strlen(start_token) + skip; - - if (p >= str + len) - return FALSE; - - if (check_value != '\0' && *p == check_value) - return FALSE; - - q = strstr(p, end_token); - - /* Trim leading blanks */ - while (*p != '\n' && g_ascii_isspace(*p)) { - p += 1; - } - - /* Trim trailing blanks */ - while (q > p && g_ascii_isspace(*(q - 1))) { - q -= 1; - } - - /* Don't bother with null strings */ - if (p == q) - return FALSE; - - if (q != NULL && (!no_value_token || - (no_value_token && strncmp(p, no_value_token, - strlen(no_value_token))))) - { - GString *dest = g_string_new(""); - - if (is_link) - { - g_string_append(dest, ""); - - if (link_prefix) - g_string_append(dest, link_prefix); - - g_string_append_len(dest, p, q - p); - g_string_append(dest, ""); - } - else - { - if (format_cb != NULL) - { - char *reformatted = format_cb(p, q - p); - g_string_append(dest, reformatted); - g_free(reformatted); - } - else - g_string_append_len(dest, p, q - p); - } - - purple_notify_user_info_add_pair(user_info, display_name, dest->str); - g_string_free(dest, TRUE); - - return TRUE; - } - - return FALSE; -} - -struct purple_parse_tag { - char *src_tag; - char *dest_tag; - gboolean ignore; -}; - -/* NOTE: Do not put `do {} while(0)` around this macro (as this is the method - recommended in the GCC docs). It contains 'continue's that should - affect the while-loop in purple_markup_html_to_xhtml and doing the - above would break that. - Also, remember to put braces in constructs that require them for - multiple statements when using this macro. */ -#define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ - const char *o = c + strlen("<" x); \ - const char *p = NULL, *q = NULL, *r = NULL; \ - GString *innards = g_string_new(""); \ - while(o && *o) { \ - if(!q && (*o == '\"' || *o == '\'') ) { \ - q = o; \ - } else if(q) { \ - if(*o == *q) { \ - char *unescaped = g_strndup(q+1, o-q-1); \ - char *escaped = g_markup_escape_text(unescaped, -1); \ - g_string_append_printf(innards, "%c%s%c", *q, escaped, *q); \ - g_free(unescaped); \ - g_free(escaped); \ - q = NULL; \ - } else if(*c == '\\') { \ - o++; \ - } \ - } else if(*o == '<') { \ - r = o; \ - } else if(*o == '>') { \ - p = o; \ - break; \ - } else { \ - innards = g_string_append_c(innards, *o); \ - } \ - o++; \ - } \ - if(p && !r) { \ - if(*(p-1) != '/') { \ - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ - pt->src_tag = x; \ - pt->dest_tag = y; \ - tags = g_list_prepend(tags, pt); \ - } \ - if(xhtml) { \ - xhtml = g_string_append(xhtml, "<" y); \ - xhtml = g_string_append(xhtml, innards->str); \ - xhtml = g_string_append_c(xhtml, '>'); \ - } \ - c = p + 1; \ - } else { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "<"); \ - if(plain) \ - plain = g_string_append_c(plain, '<'); \ - c++; \ - } \ - g_string_free(innards, TRUE); \ - continue; \ - } \ - if(!g_ascii_strncasecmp(c, "<" x, strlen("<" x)) && \ - (*(c+strlen("<" x)) == '>' || \ - !g_ascii_strncasecmp(c+strlen("<" x), "/>", 2))) { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "<" y); \ - c += strlen("<" x); \ - if(*c != '/') { \ - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ - pt->src_tag = x; \ - pt->dest_tag = y; \ - tags = g_list_prepend(tags, pt); \ - if(xhtml) \ - xhtml = g_string_append_c(xhtml, '>'); \ - } else { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "/>");\ - } \ - c = strchr(c, '>') + 1; \ - continue; \ - } -/* Don't forget to check the note above for ALLOW_TAG_ALT. */ -#define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x) -void -purple_markup_html_to_xhtml(const char *html, char **xhtml_out, - char **plain_out) -{ - GString *xhtml = NULL; - GString *plain = NULL; - GString *url = NULL; - GString *cdata = NULL; - GList *tags = NULL, *tag; - const char *c = html; - char quote = '\0'; - -#define CHECK_QUOTE(ptr) if (*(ptr) == '\'' || *(ptr) == '\"') \ - quote = *(ptr++); \ - else \ - quote = '\0'; - -#define VALID_CHAR(ptr) (*(ptr) && *(ptr) != quote && (quote || (*(ptr) != ' ' && *(ptr) != '>'))) - - g_return_if_fail(xhtml_out != NULL || plain_out != NULL); - - if(xhtml_out) - xhtml = g_string_new(""); - if(plain_out) - plain = g_string_new(""); - - while(c && *c) { - if(*c == '<') { - if(*(c+1) == '/') { /* closing tag */ - tag = tags; - while(tag) { - struct purple_parse_tag *pt = tag->data; - if(!g_ascii_strncasecmp((c+2), pt->src_tag, strlen(pt->src_tag)) && *(c+strlen(pt->src_tag)+2) == '>') { - c += strlen(pt->src_tag) + 3; - break; - } - tag = tag->next; - } - if(tag) { - while(tags) { - struct purple_parse_tag *pt = tags->data; - if(xhtml) - g_string_append_printf(xhtml, "", pt->dest_tag); - if(plain && purple_strequal(pt->src_tag, "a")) { - /* if this is a link, we have to add the url to the plaintext, too */ - if (cdata && url && - (!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 || - g_utf8_collate(url->str + 7, cdata->str) != 0))) - g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); - if (cdata) { - g_string_free(cdata, TRUE); - cdata = NULL; - } - - } - if(tags == tag) - break; - tags = g_list_remove(tags, pt); - g_free(pt); - } - g_free(tag->data); - tags = g_list_remove(tags, tag->data); - } else { - /* a closing tag we weren't expecting... - * we'll let it slide, if it's really a tag...if it's - * just a ') { - c = end+1; - } else { - if(xhtml) - xhtml = g_string_append(xhtml, "<"); - if(plain) - plain = g_string_append_c(plain, '<'); - c++; - } - } - } else { /* opening tag */ - ALLOW_TAG("blockquote"); - ALLOW_TAG("cite"); - ALLOW_TAG("div"); - ALLOW_TAG("em"); - ALLOW_TAG("h1"); - ALLOW_TAG("h2"); - ALLOW_TAG("h3"); - ALLOW_TAG("h4"); - ALLOW_TAG("h5"); - ALLOW_TAG("h6"); - /* we only allow html to start the message */ - if(c == html) { - ALLOW_TAG("html"); - } - ALLOW_TAG_ALT("i", "em"); - ALLOW_TAG_ALT("italic", "em"); - ALLOW_TAG("li"); - ALLOW_TAG("ol"); - ALLOW_TAG("p"); - ALLOW_TAG("pre"); - ALLOW_TAG("q"); - ALLOW_TAG("span"); - ALLOW_TAG("ul"); - - - /* we skip
because it's not legal in XHTML-IM. However, - * we still want to send something sensible, so we put a - * linebreak in its place.
also needs special handling - * because putting a
to close it would just be dumb. */ - if((!g_ascii_strncasecmp(c, "' || - !g_ascii_strncasecmp(c+3, "/>", 2) || - !g_ascii_strncasecmp(c+3, " />", 3))) { - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, "
"); - if(plain && *c != '\n') - plain = g_string_append_c(plain, '\n'); - continue; - } - if(!g_ascii_strncasecmp(c, "", 3) || !g_ascii_strncasecmp(c, "", strlen("")) || !g_ascii_strncasecmp(c, "", strlen(""))) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - if (*(c+2) == '>') - pt->src_tag = "b"; - else if (*(c+2) == 'o') - pt->src_tag = "bold"; - else - pt->src_tag = "strong"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 3) || !g_ascii_strncasecmp(c, "", strlen(""))) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = *(c+2) == '>' ? "u" : "underline"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if (xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 3) || !g_ascii_strncasecmp(c, "", strlen(""))) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = *(c+2) == '>' ? "s" : "strike"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 5)) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "sub"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 5)) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "sup"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if (!g_ascii_strncasecmp(c, "' || *(c+4) == ' ')) { - const char *p = c + 4; - GString *src = NULL, *alt = NULL; - while (*p && *p != '>') { - if (!g_ascii_strncasecmp(p, "src=", 4)) { - const char *q = p + 4; - if (src) - g_string_free(src, TRUE); - src = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - src = g_string_append_c(src, *q); - q++; - } - p = q; - } else if (!g_ascii_strncasecmp(p, "alt=", 4)) { - const char *q = p + 4; - if (alt) - g_string_free(alt, TRUE); - alt = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - alt = g_string_append_c(alt, *q); - q++; - } - p = q; - } else { - p++; - } - } - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - /* src and alt are required! */ - if(src && xhtml) - g_string_append_printf(xhtml, "%s", g_strstrip(src->str), alt ? alt->str : ""); - if(alt) { - if(plain) - plain = g_string_append(plain, alt->str); - if(!src && xhtml) - xhtml = g_string_append(xhtml, alt->str); - g_string_free(alt, TRUE); - } - g_string_free(src, TRUE); - continue; - } - if (!g_ascii_strncasecmp(c, "' || *(c+2) == ' ')) { - const char *p = c + 2; - struct purple_parse_tag *pt; - while (*p && *p != '>') { - if (!g_ascii_strncasecmp(p, "href=", 5)) { - const char *q = p + 5; - if (url) - g_string_free(url, TRUE); - url = g_string_new(""); - if (cdata) - g_string_free(cdata, TRUE); - cdata = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - int len; - if ((*q == '&') && (purple_markup_unescape_entity(q, &len) == NULL)) - url = g_string_append(url, "&"); - else - url = g_string_append_c(url, *q); - q++; - } - p = q; - } else { - p++; - } - } - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "a"; - pt->dest_tag = "a"; - tags = g_list_prepend(tags, pt); - if(xhtml) - g_string_append_printf(xhtml, "", url ? g_strstrip(url->str) : ""); - continue; - } - if(!g_ascii_strncasecmp(c, "' || *(c+5) == ' ')) { - const char *p = c + 5; - GString *style = g_string_new(""); - struct purple_parse_tag *pt; - while (*p && *p != '>') { - if (!g_ascii_strncasecmp(p, "back=", 5)) { - const char *q = p + 5; - GString *color = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - color = g_string_append_c(color, *q); - q++; - } - g_string_append_printf(style, "background: %s; ", color->str); - g_string_free(color, TRUE); - p = q; - } else if (!g_ascii_strncasecmp(p, "color=", 6)) { - const char *q = p + 6; - GString *color = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - color = g_string_append_c(color, *q); - q++; - } - g_string_append_printf(style, "color: %s; ", color->str); - g_string_free(color, TRUE); - p = q; - } else if (!g_ascii_strncasecmp(p, "face=", 5)) { - const char *q = p + 5; - GString *face = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - face = g_string_append_c(face, *q); - q++; - } - g_string_append_printf(style, "font-family: %s; ", g_strstrip(face->str)); - g_string_free(face, TRUE); - p = q; - } else if (!g_ascii_strncasecmp(p, "size=", 5)) { - const char *q = p + 5; - int sz; - const char *size = "medium"; - CHECK_QUOTE(q); - sz = atoi(q); - switch (sz) - { - case 1: - size = "xx-small"; - break; - case 2: - size = "small"; - break; - case 3: - size = "medium"; - break; - case 4: - size = "large"; - break; - case 5: - size = "x-large"; - break; - case 6: - case 7: - size = "xx-large"; - break; - default: - break; - } - g_string_append_printf(style, "font-size: %s; ", size); - p = q; - } else { - p++; - } - } - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "font"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - if(style->len && xhtml) - g_string_append_printf(xhtml, "", g_strstrip(style->str)); - else - pt->ignore = TRUE; - g_string_free(style, TRUE); - continue; - } - if (!g_ascii_strncasecmp(c, "", g_strstrip(color->str)); - g_string_free(color, TRUE); - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - pt->src_tag = "body"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - did_something = TRUE; - break; - } - p++; - } - if (did_something) continue; - } - /* this has to come after the special case for bgcolor */ - ALLOW_TAG("body"); - if(!g_ascii_strncasecmp(c, ""); - if(p) { - if(xhtml) - xhtml = g_string_append(xhtml, "IP address does not respect - * the TTL returned by the DNS server. We should expire things - * from the cache after some amount of time. - */ - if (!is_proxy && !(method & FB_METHOD_SSL)) - { - /* Don't do this for proxy connections, since proxies do the DNS lookup */ - gchar *host_ip; - - host_ip = g_hash_table_lookup(fba->hostname_ip_cache, host); - if (host_ip != NULL) { - host = host_ip; - } else if (fba->account && !fba->account->disconnecting) { - GSList *host_lookup_list = NULL; - PurpleDnsQueryData *query; - - host_lookup_list = g_slist_prepend( - host_lookup_list, g_strdup(host)); - host_lookup_list = g_slist_prepend( - host_lookup_list, fba); - - query = purple_dnsquery_a(host, 80, - fb_host_lookup_cb, host_lookup_list); - fba->dns_queries = g_slist_prepend(fba->dns_queries, query); - host_lookup_list = g_slist_append(host_lookup_list, query); - } - } - - fbconn = g_new0(FacebookConnection, 1); - fbconn->fba = fba; - fbconn->url = real_url; - fbconn->method = method; - fbconn->hostname = g_strdup(host); - fbconn->request = request; - fbconn->callback = callback_func; - fbconn->user_data = user_data; - fbconn->fd = -1; - fbconn->connection_keepalive = keepalive; - fbconn->request_time = time(NULL); - fba->conns = g_slist_prepend(fba->conns, fbconn); - - fb_attempt_connection(fbconn); -} - -static void fb_attempt_connection(FacebookConnection *fbconn) -{ - FacebookAccount *fba = fbconn->fba; - -#if 0 - /* Connection to attempt retries. This code doesn't work perfectly, but - * remains here for future reference if needed */ - if (time(NULL) - fbconn->request_time > 5) { - /* We've continuously tried to remake this connection for a - * bit now. It isn't happening, sadly. Time to die. */ - purple_debug_error("facebook", "could not connect after retries\n"); - fb_fatal_connection_cb(fbconn); - return; - } - - purple_debug_info("facebook", "making connection attempt\n"); - - /* TODO: If we're retrying the connection, consider clearing the cached - * DNS value. This will require some juggling with the hostname param */ - /* TODO/FIXME: This retries almost instantenously, which in some cases - * runs at blinding speed. Slow it down. */ - /* TODO/FIXME: this doesn't retry properly on non-ssl connections */ -#endif - - if (fbconn->method & FB_METHOD_SSL) { - fbconn->ssl_conn = purple_ssl_connect(fba->account, fbconn->hostname, - 443, fb_post_or_get_ssl_connect_cb, - fb_ssl_connection_error, fbconn); - } else { - fbconn->connect_data = purple_proxy_connect(NULL, fba->account, - fbconn->hostname, 80, fb_post_or_get_connect_cb, fbconn); - } - - return; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_connection.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_connection.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_connection.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_connection.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_CONNECTION_H -#define FACEBOOK_CONNECTION_H - -#include "libfacebook.h" - -/* - * This is a bitmask. - */ -typedef enum -{ - FB_METHOD_GET = 0x0001, - FB_METHOD_POST = 0x0002, - FB_METHOD_SSL = 0x0004 -} FacebookMethod; - -typedef struct _FacebookConnection FacebookConnection; -struct _FacebookConnection { - FacebookAccount *fba; - FacebookMethod method; - gchar *hostname; - gchar *url; - GString *request; - FacebookProxyCallbackFunc callback; - gpointer user_data; - char *rx_buf; - size_t rx_len; - PurpleProxyConnectData *connect_data; - PurpleSslConnection *ssl_conn; - int fd; - guint input_watcher; - gboolean connection_keepalive; - time_t request_time; -}; - -void fb_connection_destroy(FacebookConnection *fbconn); -void fb_post_or_get(FacebookAccount *fba, FacebookMethod method, - const gchar *host, const gchar *url, const gchar *postdata, - FacebookProxyCallbackFunc callback_func, gpointer user_data, - gboolean keepalive); - -#endif /* FACEBOOK_CONNECTION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,263 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#include "fb_conversation.h" -#include "fb_connection.h" -#include "fb_util.h" - -#include "fb_json.h" - -#include "conversation.h" -#include "signals.h" - -/***************************************************************************** - * MESSAGE PROCESSING * - *****************************************************************************/ -void fb_conversation_handle_message(FacebookAccount *fba, const char *from, - const char *to, gint64 message_time, const gchar *message_orig, - gboolean log) -{ - gchar *tmp, *message_text; - - if (!log) { - purple_debug_info("facebook", "message with no logging\n"); - } - - // Process message. - message_text = fb_strdup_withhtml(message_orig); - tmp = message_text; - message_text = fb_replace_styled_text(message_text); - g_free(tmp); - - if (fba->uid != atoll(from) || fba->uid == atoll(to)) { - purple_debug_info("facebook", - "displaying received message %lld: %s\n", - (long long int) message_time, message_text); - // TODO/FIXME: cheat here by changing formatting colors. - // Or add an option to just disable history on conv open. TBD. - serv_got_im(fba->pc, from, message_text, - log? - PURPLE_MESSAGE_RECV : - PURPLE_MESSAGE_RECV, - message_time / 1000); - if (message_time > fba->last_message_time) { - fba->last_message_time = message_time; - } else { - purple_debug_warning("facebook", - "displaying message out of sync\n"); - } - } else if (!g_hash_table_remove( - fba->sent_messages_hash, message_orig)) - { - purple_debug_info("facebook", - "displaying sent message %lld: %s\n", - (long long int) message_time, message_text); - - serv_got_im(fba->pc, to, message_text, - log? - PURPLE_MESSAGE_SEND : - PURPLE_MESSAGE_SEND, - message_time / 1000); - if (message_time > fba->last_message_time) { - fba->last_message_time = message_time; - } else { - purple_debug_warning("facebook", - "displaying message out of sync\n"); - } - } - - // Cleanup. - g_free(message_text); -} - - -/***************************************************************************** - * HISTORY CODE * - *****************************************************************************/ - -static void fb_history_fetch_cb(FacebookAccount *fba, gchar *data, - gsize data_len, gpointer userdata) -{ - JsonParser *parser; - JsonObject *object, *payload; - JsonArray *history; - guint i; - gint64 min_time; - - parser = fb_get_parser(data, data_len); - - if (!parser) { - // We didn't get data, but this isn't necessarily fatal. - purple_debug_warning("facebook", - "bad data while fetching history\n"); - return; - } - - min_time = atoll((char *) userdata); - g_free(userdata); - purple_debug_info("facebook", "history fetch with min time of %lld\n", - (long long int) min_time); - - object = fb_get_json_object(parser, NULL); - payload = json_node_get_object( - json_object_get_member(object, "payload")); - history = json_node_get_array( - json_object_get_member(payload, "history")); - - purple_debug_info("facebook", - "found %d history items to possibly render\n", - json_array_get_length(history)); - - for (i = 0; i < json_array_get_length(history); i++) { - const gchar *type; - JsonObject *message_obj; - - message_obj = json_node_get_object( - json_array_get_element(history, i)); - type = json_node_get_string(json_object_get_member( - message_obj, "type")); - - if (g_str_equal(type, "msg")) { - gint64 message_time; - const gchar *message; - gchar *from; - gchar *to; - JsonObject *text_obj; - - from = g_strdup_printf("%" G_GINT64_FORMAT, (gint64)json_node_get_int( - json_object_get_member(message_obj, "from"))); - to = g_strdup_printf("%" G_GINT64_FORMAT, (gint64)json_node_get_int( - json_object_get_member(message_obj, "to"))); - - text_obj = json_node_get_object( - json_object_get_member(message_obj, "msg")); - message = json_node_get_string( - json_object_get_member(text_obj, "text")); - - message_time = fb_time_kludge(json_node_get_int( - json_object_get_member(message_obj, "time"))); - - if (message_time > min_time) { - purple_debug_info("facebook", - "displaying history message %lld\n", - (long long int) message_time); - fb_conversation_handle_message( - fba, from, to, message_time, message, - min_time != 0); - } - - g_free(from); - g_free(to); - } - } - - json_parser_free(parser); -} - -void fb_history_fetch(FacebookAccount *fba, const char *who, - gboolean display_all) -{ - gint64 min_time;//VOXOX - CJC - 2009.07.06 - gchar *url;//VOXOX - CJC - 2009.07.06 - g_return_if_fail(fba != NULL); - - purple_debug_info("facebook", "fetching history with %s\n", who); - - min_time = fba->last_message_time; - if (display_all) { - min_time = 0; - } - - url = g_strdup_printf("/ajax/chat/history.php?id=%s", who); - fb_post_or_get( - fba, FB_METHOD_GET, NULL, url, NULL, fb_history_fetch_cb, - g_strdup_printf("%lld", (long long int) min_time), FALSE); - g_free(url); -} - -/***************************************************************************** - * GENERAL EVENTS CODE * - *****************************************************************************/ - -void fb_conversation_closed(PurpleConnection *gc, const char *who) -{ - FacebookAccount *fba = gc->proto_data; - gchar *postdata; - - g_return_if_fail(fba->post_form_id != NULL); - - /* notify server that we closed the chat window */ - /* close_chat=589039771&window_id=3168919846& - * post_form_id=c258fe42460c7e8b61e242a37ef05afc */ - postdata = g_strdup_printf("close_chat=%s&post_form_id=%s&fb_dtsg=%s&" - "post_form_id_source=AsyncRequest&__a=1", who, - fba->post_form_id, fba->dtsg); - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/chat/settings.php", - postdata, NULL, NULL, FALSE); - g_free(postdata); -} - -static void fb_conversation_created(PurpleConversation *conv) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - - if (!fb_conversation_is_fb(conv)) { - return; - } - - purple_debug_info("facebook", "conversation created with %s\n", - conv->name); - - /*if (purple_account_get_bool(account, "facebook_show_history", TRUE)) - { - fb_history_fetch(account->gc->proto_data, conv->name, TRUE); //VOXOX - CJC - 2009.07.06 Dont get status messages - }*/ -} - -gboolean fb_conversation_is_fb(PurpleConversation *conv) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - const gchar *prpl = purple_account_get_protocol_id(account); - return g_str_equal(prpl, FACEBOOK_PLUGIN_ID); -} - -void fb_conversation_init(FacebookAccount *fba) -{ - fba->last_message_time = 0; - - purple_signal_connect( - purple_conversations_get_handle(), - "conversation-created", - fba, - PURPLE_CALLBACK(fb_conversation_created), - NULL); -} - -void fb_conversation_destroy(FacebookAccount *fba) -{ - purple_signal_disconnect( - purple_conversations_get_handle(), - "conversation-created", - fba, - PURPLE_CALLBACK(fb_conversation_created)); -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_conversation.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_CONVERSATION_H -#define FACEBOOK_CONVERSATION_H - -#include "libfacebook.h" - -void fb_conversation_init(FacebookAccount *fba); -void fb_conversation_destroy(FacebookAccount *fba); - -void fb_conversation_closed(PurpleConnection *gc, const char *who); -gboolean fb_conversation_is_fb(PurpleConversation *conv); - -void fb_history_fetch(FacebookAccount *fba, const char *who, - gboolean display_all); -void fb_conversation_handle_message(FacebookAccount *fba, const char *from, - const char *to, gint64 message_time, const gchar *message_orig, - gboolean log); - -#endif /* FACEBOOK_CONVERSATION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,518 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_friendlist.h" -#include "fb_connection.h" -#include "libfacebook.h" -#include "fb_util.h" - -typedef struct _MoveRequest MoveRequest; -struct _MoveRequest { - char *old_group; - char *new_group; - char *who; -}; - -/******************************************************************************/ -/* Friend list modification methods */ -/******************************************************************************/ -static void handle_move_request(FacebookAccount *fba, MoveRequest *request) -{ - const gchar *old_list_id; - const gchar *new_list_id; - gchar *postdata; - gboolean remove_flist, no_original_list; - const gchar *command; - - g_return_if_fail(fba->post_form_id != NULL); //VOXOX - JRT - 2009.08.05 - empty post_form_id causing crashes. - - purple_debug_info("facebook", - "handling movement of %s from %s to %s\n", - request->who, request->old_group, request->new_group); - - old_list_id = fb_get_list_id(fba, request->old_group); - new_list_id = fb_get_list_id(fba, request->new_group); - - remove_flist = !new_list_id || g_str_equal(new_list_id, "-1"); - no_original_list = !old_list_id || g_str_equal(old_list_id, "-1"); - - if (remove_flist) { - command = "&remove_fl=true"; - } else if (no_original_list) { - command = "&add_fl=true"; - } else { - command = "&move_fl=true"; - } - - postdata = g_strdup_printf( - "post_form_id=%s&drag_uid=%s&user=%" G_GINT64_FORMAT - "&new_flid=%s&old_flid=%s%s", - fba->post_form_id, - request->who, - fba->uid, - remove_flist ? "" : new_list_id, - no_original_list ? "" : old_list_id, - command); - - fb_post_or_get(fba, FB_METHOD_POST, NULL, - "/ajax/chat/buddy_list_settings.php", - postdata, NULL, NULL, FALSE); - - g_free(postdata); - - g_free(request->who); - g_free(request->old_group); - g_free(request->new_group); - g_free(request); -} - -static void create_list_cb(FacebookAccount *fba, gchar *data, - gsize data_len, gpointer userdata) -{ - // NOTE: this method can also be used for movements between - // friend lists if necessary. - - JsonParser *parser; - JsonObject *objnode; - MoveRequest *request; - - // Parse out old data. - parser = fb_get_parser(data, data_len); - if (parser == NULL) { - return; - } - - objnode = fb_get_json_object(parser, NULL); - if (!objnode || - !json_object_has_member(objnode, "payload")) - { - json_parser_free(parser); - return; - } - - objnode = json_node_get_object(json_object_get_member( - objnode, "payload")); - fb_process_friend_lists(fba, objnode); - - json_parser_free(parser); - - // Move Friend - request = (MoveRequest *) userdata; - if (request) { - handle_move_request(fba, request); - } -} - -static void create_friend_list(FacebookAccount *fba, const gchar *new_group, - MoveRequest *request) -{ - gchar *postdata; - gchar *new_group_escaped; - - g_return_if_fail(fba->post_form_id != NULL); //VOXOX - JRT - 2009.08.05 - empty post_form_id causing crashes. - - purple_debug_info("facebook", "creating friend list %s\n", new_group); - - new_group_escaped = fb_strdup_withhtml(new_group); - - postdata = g_strdup_printf( - "post_form_id=%s&create=%s&user=%" G_GINT64_FORMAT, - fba->post_form_id, - new_group_escaped, - fba->uid); - - fb_post_or_get(fba, FB_METHOD_POST, NULL, - "/ajax/chat/buddy_list_settings.php", - postdata, create_list_cb, request, FALSE); - - g_free(postdata); - g_free(new_group_escaped); -} - -void fb_group_buddy_move(PurpleConnection *pc, const char *who, - const char *old_group, const char *new_group) -{ - FacebookAccount *fba; - MoveRequest *request; - const gchar *new_list_id; - - if (!purple_account_get_bool(pc->account, "facebook_use_groups", TRUE)) - { - //Dont do anything if we're ignoring groups - return; - } - fba = pc->proto_data; - - purple_debug_info("facebook", "handling move of %s from %s to %s\n", - who, old_group, new_group); - - // Don't do anything if groups are not actually changing. - if (!purple_utf8_strcasecmp(old_group, new_group)) { - purple_debug_info("facebook", "groups are same, not moving\n"); - return; - } - - // Facebook doesn't support moving yourself because you can't be in a - // friend list. Let buddy list be updated as appropriate. - if (atoll(who) == fba->uid) { - purple_debug_info("facebook", - "moving self, do not update server\n"); - return; - } - - request = g_new0(MoveRequest, 1); - request->old_group = g_utf8_strdown(old_group, -1); - request->new_group = g_utf8_strdown(new_group, -1); - request->who = g_strdup(who); - - new_list_id = fb_get_list_id(fba, request->new_group); - if (new_list_id) { - handle_move_request(fba, request); - } else { - create_friend_list(fba, new_group, request); - } -} - -void fb_buddy_remove(PurpleConnection *pc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - // This method should only remove a buddy from a friend list. - // Nothing more. It should not defriend a user ever. See issue - // #185 for a good explaination of why this is a bad idea. - // - // Moreover, defriending is such a rare operation that we should - // never make it easy. Facebook intentionally hides such a action - // behind multiple layers of links and dialogs. - // - // If the plugin is ever to perform an actual defriending, it needs - // to provide a dialog and user prompt at the absolute bare minimum. - FacebookAccount *fba; - if (!purple_account_get_bool(pc->account, "facebook_use_groups", TRUE)) - { - //Dont do anything if we're ignoring groups - return; - } - - purple_debug_info("facebook", "handing removal of buddy %s\n", - buddy->name); - - fba = pc->proto_data; - - fb_group_buddy_move(pc, buddy->name, purple_group_get_name(group), - DEFAULT_GROUP_NAME); -} - -void fb_group_rename(PurpleConnection *pc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - if (!purple_account_get_bool(pc->account, "facebook_use_groups", TRUE)) - { - //Dont do anything if we're ignoring groups - return; - } - purple_debug_info("facebook", - "handling group rename of %s to %s\n", - old_name, purple_group_get_name(group)); - - // We don't do anything here. Facebook's AJAX API for renaming groups - // is horribly, horribly overcomplicated. There is no simple rename - // call, instead you must also pass in all the current data about the - // friend list and port it over. While it is possible to implement - // this, it is risky and could potentially destroy a friend list if - // the API changes. That's a Bad Thing(tm). Given the risk involved - // with this operation and how rare it is, it's not worth it. - // - // The problem is compounded by the fact that renaming groups triggers - // all sorts of weird behaviors in Pidgin. Renaming to a new name is - // simple. Renaming to an existing group name (hence a merge) - // triggers completely different behavior with calls to group_buddy - // before the call to rename. This completely defeats the purpose of - // having a rename function because group_buddy is called instead. - // - // Thus, the final decision is to use the buddy_move call. - - // TODO: warn users that renaming has no effect here. -} - -void fb_group_remove(PurpleConnection *pc, PurpleGroup *group) -{ - if (!purple_account_get_bool(pc->account, "facebook_use_groups", TRUE)) - { - //Dont do anything if we're ignoring groups - return; - } - purple_debug_info("facebook", "got group removal of %s\n", - purple_group_get_name(group)); - - // We don't do anything here. This is because a group rename also - // fires a group removal event. This assumes that the new group is - // equivalent to the old group, but Facebook friend lists are much more - // than simple groups- they are privacy control lists too. There is - // no easy way to port the settings between groups. Better off not - // deleting, and the user can do the cleanup with their browser. -} - -/******************************************************************************/ -/* Friend list fetch methods */ -/******************************************************************************/ - -const gchar *fb_get_list_id(FacebookAccount *fba, const gchar *list_name) -{ - if (!purple_utf8_strcasecmp(list_name, DEFAULT_GROUP_NAME)) { - return "-1"; - } - - return g_hash_table_lookup(fba->friend_lists_reverse, purple_normalize_nocase(NULL, list_name)); -} - -gboolean fb_process_friend_lists(FacebookAccount *fba, - JsonObject *buddy_list) -{ - JsonObject *fl_obj; - GList *friend_list_ids, *cur; - - purple_debug_info("facebook", "processing friend list data\n"); - - if (!json_object_has_member(buddy_list, "flData")) - { - purple_debug_info("facebook", "no friend list data\n"); - return FALSE; - } - - - fl_obj = json_node_get_object(json_object_get_member( - buddy_list, "flData")); - friend_list_ids = json_object_get_members(fl_obj); - for (cur = friend_list_ids; cur != NULL; cur = cur->next) - { - gchar *id; - const gchar *name; - JsonObject *data; - - id = (gchar *) cur->data; - data = json_node_get_object(json_object_get_member( - fl_obj, id)); - name = json_node_get_string(json_object_get_member( - data, "n")); - if (name) { - // Either -1 isnt a valid JSON string or JSON-glib does - // this wrong. I'm too tired to tell the difference. - if (g_str_equal(id, "_1")) { - id = "-1"; - } - purple_debug_info("facebook", - "got friend list %s with id %s\n", - name, id); - g_hash_table_insert(fba->friend_lists, - g_strdup(id), g_strdup(name)); - g_hash_table_insert(fba->friend_lists_reverse, - g_utf8_strdown(name, -1), g_strdup(id)); - } - } - - g_list_free(friend_list_ids); - - return TRUE; -} - -static void destroy_buddy(gpointer key, gpointer value, gpointer data) -{ - PurpleBuddy *buddy; - gchar *group_name; - FacebookAccount *fba; - - buddy = (PurpleBuddy *) value; - group_name = (gchar *) key; - fba = (FacebookAccount *) data; - - purple_debug_info("facebook", "removing %s from group %s\n", - buddy->name, group_name); - if (atoll(buddy->name) == fba->uid) { - purple_debug_info("facebook", "not removing self from %s\n", - group_name); - return; - } - - purple_blist_remove_buddy(buddy); -} - -static PurpleBuddy *add_buddy(FacebookAccount *fba, - const gchar *friend_list_id, const gchar *uid, GHashTable *cur_groups) -{ - const gchar *group_name; - PurpleGroup *fb_group; - PurpleBuddy *buddy; - - group_name = g_hash_table_lookup(fba->friend_lists, purple_normalize_nocase(NULL, friend_list_id)); - if (!group_name || group_name[0] == '\0') { - purple_debug_info("facebook", - "did not find name of list %s\n", - friend_list_id); - group_name = DEFAULT_GROUP_NAME; - } - - // Initialize group as necessary. - fb_group = purple_find_group(group_name); - if (fb_group == NULL) - { - purple_debug_info("facebook", "adding friend list %s\n", - group_name); - fb_group = purple_group_new(group_name); - purple_blist_add_group(fb_group, NULL); - } - - buddy = (PurpleBuddy *)g_hash_table_lookup(cur_groups, purple_normalize_nocase(NULL, group_name)); - if (!buddy) { - purple_debug_info("facebook", "adding %s to %s\n", - uid, group_name); - buddy = purple_buddy_new(fba->account, uid, NULL); - purple_blist_add_buddy(buddy, NULL, fb_group, NULL); - g_hash_table_remove(cur_groups, purple_normalize_nocase(NULL, group_name)); - } - - return buddy; -} - - -GList *fb_get_buddies_friend_list (FacebookAccount *fba, - const gchar *uid, JsonArray *friend_list_ids) -{ - GSList *buddies; - GSList *cur; - GHashTable *cur_groups; - int i; - GList *final_buddies, *cur_buddy; - PurpleGroup *fb_group; - PurpleBuddy *buddy; - - final_buddies = NULL; - buddies = purple_find_buddies(fba->account, uid); - - // If we're already in the buddy list, stop. Ignore FB info because - // it will be incorrect. - if (atoll(uid) == fba->uid && buddies != NULL) { - purple_debug_info("facebook", - "already have buddies for self, not adding\n"); - for (cur = buddies; cur != NULL; cur = cur->next) - { - final_buddies = g_list_append( - final_buddies, cur->data); - } - g_slist_free(buddies); - return final_buddies; - } - - //Do we want to ignore groups? - if (!purple_account_get_bool(fba->account, "facebook_use_groups", TRUE)) - { - if (buddies != NULL) { - //Copy the slist into the list - for (cur = buddies; cur != NULL; cur = cur->next) - { - final_buddies = g_list_append( - final_buddies, cur->data); - } - g_slist_free(buddies); - return final_buddies; - } else { - buddy = purple_buddy_new(fba->account, uid, NULL); - fb_group = purple_find_group(DEFAULT_GROUP_NAME); - if (fb_group == NULL) - { - fb_group = purple_group_new(DEFAULT_GROUP_NAME); - purple_blist_add_group(fb_group, NULL); - } - purple_blist_add_buddy(buddy, NULL, fb_group, NULL); - final_buddies = g_list_append(final_buddies, buddy); - return final_buddies; - } - } - // Determine what buddies exist and what groups they are in. - cur_groups = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - for (cur = buddies; cur != NULL; cur = cur->next) - { - const gchar *group_name; - - group_name = purple_group_get_name(purple_buddy_get_group( - (PurpleBuddy *)cur->data)); - - g_hash_table_insert(cur_groups, g_utf8_strdown(group_name, -1), cur->data); - } - g_slist_free(buddies); - - // Create/insert necessary buddies - if (friend_list_ids) { - for (i = 0; i < json_array_get_length(friend_list_ids); i++) - { - const gchar *friend_list_id; - - - friend_list_id = json_node_get_string( - json_array_get_element(friend_list_ids, i)); - - buddy = add_buddy(fba, friend_list_id, uid, cur_groups); - - final_buddies = g_list_append(final_buddies, buddy); - } - } else { - // No friend list data, so we use the default group. - final_buddies = g_list_append(final_buddies, - add_buddy(fba, "-1", uid, cur_groups)); - } - - // Figure out which groups/buddies are not represented. - for (cur_buddy = final_buddies; cur_buddy != NULL; - cur_buddy = cur_buddy->next) - { - g_hash_table_remove(cur_groups, purple_normalize_nocase(NULL, - purple_group_get_name(purple_buddy_get_group( - (PurpleBuddy *)cur_buddy->data)))); - } - - // Delete remaining buddies to maintain sync state with server. - g_hash_table_foreach(cur_groups, destroy_buddy, fba); - - // Cleanup! - g_hash_table_destroy(cur_groups); - - return final_buddies; -} - -void fb_friendlist_init(FacebookAccount *fba) -{ - /* data structure mapping friend list id to name. libpurple only - * recognizes name, does not have group aliases */ - fba->friend_lists = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - /* structure mapping names to list id for speed. */ - fba->friend_lists_reverse = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_free); -} - -void fb_friendlist_destroy(FacebookAccount *fba) -{ - if (fba->friend_lists) { - g_hash_table_destroy(fba->friend_lists); - } - if (fba->friend_lists_reverse) { - g_hash_table_destroy(fba->friend_lists_reverse); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_friendlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_FRIENDLIST_H -#define FACEBOOK_FRIENDLIST_H - -#include "libfacebook.h" - -#include "fb_json.h" - -#define DEFAULT_GROUP_NAME "Facebook" - -/* Friend list modification methods */ -void fb_group_buddy_move(PurpleConnection *pc, const char *who, - const char *old_group, const char *new_group); -void fb_group_rename(PurpleConnection *pc, const char *old_name, - PurpleGroup *group, GList *moved_buddies); -void fb_group_remove(PurpleConnection *pc, PurpleGroup *group); -void fb_buddy_remove(PurpleConnection *pc, PurpleBuddy *buddy, - PurpleGroup *group); - -/* Friend list fetch methods */ -const gchar *fb_get_list_id(FacebookAccount *fba, const gchar *list_name); -gboolean fb_process_friend_lists(FacebookAccount *fba, JsonObject *buddy_list); -GList *fb_get_buddies_friend_list (FacebookAccount *fba, - const gchar *uid, JsonArray *friend_list_ids); - -void fb_friendlist_init(FacebookAccount *fba); -void fb_friendlist_destroy(FacebookAccount *fba); - -#endif /* FACEBOOK_FRIENDLIST_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,245 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_connection.h" -#include "fb_info.h" -#include "fb_blist.h" - -/* - * TODO: Do we really want to do this? Maybe we could just set a - * flag that says that this protocol supports HTML? - */ -static gchar *fb_remove_useless_stripped_links(const gchar *input) -{ - /* removes stripped links like "(/s.php? ... )" from user info */ - /* as an artifact of purple_markup_strip_html */ - - gchar *output = g_strdup(input); - gchar *i = output; - gchar *end; - - while ((i = strstr(i, " (/"))) - { - end = strchr(i, ')'); - if (end) - { - end += 1; - /* overwrite everything after the brackets to before it */ - g_stpcpy(i, end); - } - } - - return output; -} - -static void fb_get_info_cb(FacebookAccount *fba, gchar *data, gsize data_len, gpointer user_data) -{ - PurpleNotifyUserInfo *user_info; - PurpleBuddyIcon *buddy_icon; - size_t image_size; - gconstpointer image_pointer; - int icon_id = -1; - gchar *uid = user_data; - gchar *label_tmp; - gchar *value_tmp; - gchar *value_tmp2; - gchar *search_start; - gchar *search_end; - PurpleBuddy *buddy = NULL; - FacebookBuddy *fbuddy = NULL; - - purple_debug_info("facebook", "get_info_cb\n"); - purple_debug_info("facebook", "%s\n", data); - - buddy = purple_find_buddy(fba->account, uid); - if (buddy) - { - fbuddy = buddy->proto_data; - } - - user_info = purple_notify_user_info_new(); - - /* Insert link to profile at top */ - value_tmp = g_strdup_printf("%s", - uid, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, value_tmp); - purple_notify_user_info_add_section_break(user_info); - g_free(value_tmp); - - /* look from
*/ - /* until
*/ - search_start = g_strstr_len(data, data_len, "
"); - if (search_start == NULL) - { - search_start = g_strstr_len(data, data_len, "http:\\/\\/"); - if (search_start) - { - search_end = strstr(search_start, "\""); - value_tmp = g_strndup(search_start, search_end - search_start); - value_tmp2 = value_tmp; - if (value_tmp) { - char * buf = g_new(char, strlen(value_tmp) + 1); - char * url = buf; - while(*value_tmp) { - if (*value_tmp=='\\') { - // skip escape char - *buf++ = value_tmp[1]; - value_tmp += 2; - } else { - *buf++ = *value_tmp++; - } - } - *buf = 0; - purple_debug_info("facebook", "info url: %s\n", url); - fb_post_or_get(fba->pc->proto_data, FB_METHOD_GET, NULL, url, NULL, fb_get_info_cb, g_strdup(uid), FALSE); - g_free(uid); - g_free(url); - g_free(value_tmp2); - return; - } - } - purple_debug_warning("facebook", - "could not find user info, showing default"); - purple_notify_userinfo(fba->pc, uid, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - g_free(uid); - return; - } - search_end = strstr(search_start, "
"); - - value_tmp = g_strstr_len(data, data_len, "Facebook | "); - if (value_tmp) - { - value_tmp = strchr(value_tmp, '|')+2; - value_tmp2 = g_strndup(value_tmp, strstr(value_tmp, "")-value_tmp); - value_tmp = g_strchomp(purple_markup_strip_html(value_tmp2)); - purple_notify_user_info_add_pair(user_info, _("Name"), value_tmp); - fb_blist_set_alias(fba, uid, value_tmp); - g_free(value_tmp); - g_free(value_tmp2); - } - - value_tmp = g_strstr_len(data, data_len, ""); - if (value_tmp2) - { - value_tmp = strchr(value_tmp, '>')+1; - value_tmp2 = g_strndup(value_tmp, strchr(value_tmp, '<')-value_tmp); - purple_debug_info("facebook", "status: %s\n", value_tmp2); - value_tmp = g_strchomp(purple_markup_strip_html(value_tmp2)); - if (*value_tmp == '\0') - { - //For some reason their status message disappeared - //Try using their status message from the buddy list - if (fbuddy) - { - g_free(value_tmp); - value_tmp = g_strdup(fbuddy->status); - } - } - purple_notify_user_info_add_pair(user_info, _("Status"), value_tmp); - g_free(value_tmp); - g_free(value_tmp2); - } - } - - buddy_icon = purple_buddy_icons_find(fba->account, uid); - if (buddy_icon) - { - image_pointer = purple_buddy_icon_get_data(buddy_icon, &image_size); - icon_id = purple_imgstore_add_with_id(g_memdup(image_pointer, image_size), image_size, NULL); - value_tmp = g_strdup_printf("", icon_id); - purple_debug_info("facebook", "user info pic: '%s'\n", value_tmp); - purple_notify_user_info_add_pair(user_info, NULL, value_tmp); - g_free(value_tmp); - } - - while ((search_start = strstr(search_start, "
")) && search_start < search_end) - { - search_start += 4; - if (search_start[0] == '<' && search_start[1] == '/' && search_start[2] == 'd' && search_start[3] == 't') - { - /* the tag closes as soon as it opens (bad xhtml) */ - continue; - } - - label_tmp = g_strndup(search_start, strchr(search_start, ':')-search_start); - if (!*label_tmp) - { - g_free(label_tmp); - continue; - } - - search_start = strstr(search_start, "
"); - if (!search_start) - { - g_free(label_tmp); - break; - } - - search_start += 4; - value_tmp = g_strndup(search_start, strstr(search_start, "
")-search_start); - if (!*value_tmp) - { - g_free(label_tmp); - g_free(value_tmp); - continue; - } - - /* turn html to plaintext */ - if (strcmp(label_tmp, "AIM")) { - value_tmp2 = g_strchomp(purple_markup_strip_html(value_tmp)); - g_free(value_tmp); - value_tmp = value_tmp2; - - /* remove the silly links */ - value_tmp2 = fb_remove_useless_stripped_links(value_tmp); - g_free(value_tmp); - value_tmp = value_tmp2; - } - - purple_debug_info("facebook", "label: %s\n", label_tmp); - purple_debug_info("facebook", "value: %s\n", value_tmp); - purple_notify_user_info_add_pair(user_info, label_tmp, value_tmp); - g_free(label_tmp); - g_free(value_tmp); - } - - purple_notify_userinfo(fba->pc, uid, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - if (icon_id >= 0) - purple_imgstore_unref_by_id(icon_id); - - g_free(uid); -} - -void fb_get_info(PurpleConnection *pc, const gchar *uid) -{ - gchar *profile_url; - - profile_url = g_strdup_printf("/profile.php?id=%s&v=info", uid); - - fb_post_or_get(pc->proto_data, FB_METHOD_GET, NULL, profile_url, NULL, fb_get_info_cb, g_strdup(uid), FALSE); - - g_free(profile_url); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_info.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_INFO_H -#define FACEBOOK_INFO_H - -#include "libfacebook.h" - -void fb_get_info(PurpleConnection *pc, const gchar *uid); - -#endif /* FACEBOOK_INFO_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_json.h" - -#ifdef USE_JSONC - -JsonParser * -json_parser_new(void) -{ - JsonParser *parser; - - parser = g_new0(JsonParser, 1); - parser->tok = json_tokener_new(); - - return parser; -} - -gboolean -json_parser_load_from_data(JsonParser *parser, const gchar *data, - gssize length, GError **error) -{ - if (parser->tok == NULL) - return FALSE; - - parser->root = json_tokener_parse_ex(parser->tok, (char*)data, (int)length); - - if (parser->tok->err != json_tokener_success) - { - json_object_put(parser->root); - parser->root = NULL; - return FALSE; - } - - return TRUE; -} - -void -json_parser_free(JsonParser *parser) -{ - json_tokener_free(parser->tok); - json_object_put(parser->root); - g_free(parser); -} - -JsonNode * -json_parser_get_root(JsonParser *parser) -{ - return parser->root; -} - -GList * -json_object_get_members(JsonObject *obj) -{ - GList *keys = NULL; - struct lh_entry *entry; - - for (entry = json_object_get_object(obj)->head; - entry; - entry = entry->next) - { - keys = g_list_prepend(keys, entry->k); - } - - keys = g_list_reverse(keys); - - return keys; -} - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_json.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_JSON_H -#define FACEBOOK_JSON_H - -#ifndef USE_JSONC -# include "json-glib/json-glib.h" -#define json_parser_free(parser) g_object_unref(parser) -#else /* USE_JSONC */ -# include -# include -typedef struct json_object JsonNode; -typedef struct json_object JsonObject; -typedef struct json_object JsonArray; -typedef struct { - struct json_tokener *tok; - struct json_object *root; -} JsonParser; - -gboolean json_parser_load_from_data(JsonParser *parser, - const gchar *data, - gssize length, - GError **error); - -JsonNode* json_parser_get_root(JsonParser *parser); -JsonParser* json_parser_new(void); -void json_parser_free(JsonParser *parser); - -#define json_object_has_member(obj, key) ((gboolean)json_object_object_get(obj, key)) -#define json_object_get_member(obj, key) json_object_object_get(obj, key) -GList* json_object_get_members(JsonObject *object); - -#define json_node_get_array(node) (node) -#define json_node_get_object(node) (node) -#define json_node_get_boolean(node) json_object_get_boolean(node) -#define json_node_get_double(node) json_object_get_double(node) -#define json_node_get_int(node) json_object_get_int(node) -#define json_node_get_string(node) json_object_get_string(node) - -#define json_array_get_element(array, index) json_object_array_get_idx(array, index) -#define json_array_get_length(array) json_object_array_length(array) - -#endif /* USE_JSONC */ - -#endif /* FACEBOOK_JSON_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,235 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_managefriends.h" -#include "fb_connection.h" - -static void fb_auth_accept_cb(gpointer data) -{ - FacebookBuddy *fbuddy = data; - FacebookAccount *fba = fbuddy->fba; - gchar *buddy_uid; - gchar *postdata; - - g_return_if_fail(fba != NULL); - g_return_if_fail(fba->post_form_id != NULL); - g_return_if_fail(fbuddy->uid != 0); - - buddy_uid = g_strdup_printf("%" G_GINT64_FORMAT, fbuddy->uid); - - postdata = g_strdup_printf( - "type=friend_connect&id=%s&action=accept&" - "params[verify_age]=0¶ms[lists]=&" - "post_form_id=%s&fb_dtsg=%s&" - "post_form_id_source=AsyncRequest&__a=1", - buddy_uid, fba->post_form_id, fba->dtsg); - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/profile/reqs.php", - postdata, NULL, NULL, FALSE); - - g_hash_table_remove(fba->auth_buddies, buddy_uid); - - g_free(postdata); - g_free(fbuddy); - g_free(buddy_uid); -} - -static void fb_auth_reject_cb(gpointer data) -{ - FacebookBuddy *fbuddy = data; - FacebookAccount *fba = fbuddy->fba; - gchar *buddy_uid; - gchar *postdata; - - g_return_if_fail(fba != NULL); - g_return_if_fail(fba->post_form_id != NULL); - g_return_if_fail(fbuddy->uid != 0); - - buddy_uid = g_strdup_printf("%" G_GINT64_FORMAT, fbuddy->uid); - - postdata = g_strdup_printf( - "type=friend_connect&id=%s&action=reject&" - "params[verify_age]=0¶ms[lists]=&" - "post_form_id=%s&fb_dtsg=%s&" - "post_form_id_source=AsyncRequest&__a=1", - buddy_uid, fba->post_form_id, fba->dtsg); - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/profile/reqs.php", - postdata, NULL, NULL, FALSE); - - g_hash_table_remove(fba->auth_buddies, buddy_uid); - - g_free(postdata); - g_free(fbuddy); - g_free(buddy_uid); -} - -static void fb_check_friend_request_cb(FacebookAccount *fba, gchar *data, - gsize data_len, gpointer user_data) -{ - const char *uid_pre_text = "class=\"confirm\" id=\"friend_connect_"; - const char *name_pre_text = ""; - gchar *uid; - gint32 uid_int; - gchar *name; - gchar *msg; - gchar *msg_plain; - FacebookBuddy *buddy; - gchar *search_start = data; - - g_return_if_fail(data_len > 0); - g_return_if_fail(data != NULL); - - /* loop through the data and look for confirm_friend_add_([0-9]*)" */ - while ((search_start = strstr(search_start, uid_pre_text))) - { - search_start += strlen(uid_pre_text); - uid = g_strndup(search_start, - strchr(search_start, '"') - search_start); - purple_debug_info("facebook", "uid: %s\n", uid); - - uid_int = atoll(uid); - - if (g_hash_table_lookup_extended(fba->auth_buddies, - uid, NULL, NULL)) - { - /* we've already notified the user of this friend request */ - g_free(uid); - continue; - } - - name = strstr(search_start, name_pre_text); - if (name != NULL) - { - name += strlen(name_pre_text); - name = strchr(name, '>') + 1; - name = g_strndup(name, strchr(name, '<') - name); - purple_debug_info("facebook", "name: %s\n", name); - } else { - name = NULL; - } - - msg = strstr(search_start, msg_pre_text); - if (msg != NULL) - { - msg += strlen(msg_pre_text); - msg = g_strndup(msg, strstr(msg, "") - msg); - msg_plain = purple_markup_strip_html(msg); - g_free(msg); - purple_debug_info("facebook", "msg: %s\n", msg_plain); - } else { - msg_plain = NULL; - } - - buddy = g_new0(FacebookBuddy, 1); - buddy->fba = fba; - buddy->uid = uid_int; - purple_account_request_authorization( - fba->account, uid, NULL, - name, msg_plain, TRUE, - fb_auth_accept_cb, fb_auth_reject_cb, buddy); - - /* Don't display an auth request for this buddy again */ - g_hash_table_insert(fba->auth_buddies, uid, NULL); - - g_free(name); - g_free(uid); - g_free(msg_plain); - } -} - -gboolean fb_check_friend_requests(gpointer data) -{ - FacebookAccount *fba; - - fba = data; - - if (purple_account_get_bool( - fba->account, "facebook_manage_friends", FALSE)) { - fb_post_or_get(fba, FB_METHOD_GET, NULL, "/reqs.php", NULL, - fb_check_friend_request_cb, NULL, FALSE); - } - - return TRUE; -} - -void fb_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) -{ - gchar *postdata; - FacebookAccount *fba = pc->proto_data; - gchar *buddy_tmp; - - if (!purple_account_get_bool( - fba->account, "facebook_manage_friends", FALSE)) { - /* - * We used to pop up dialogs here but if a user renamed a group, - * this would spawn message for each person in the buddy list. Bad! - purple_notify_info(fba->pc, _("Friend not added"), - _("Adding Facebook friends via Pidgin is disabled"), - _("Either add a friend via Facebook.com or edit your account preferences")); - */ - purple_debug_warning("facebook", "attempted to add %s but was blocked\n", buddy->name); - return; - } - - if (atoll(buddy->name) == fba->uid) - { - purple_account_set_bool(fba->account, - "facebook_hide_self", FALSE); - return; - } - - buddy_tmp = g_strdup(purple_url_encode(buddy->name)); - postdata = g_strdup_printf( - "user=%" G_GINT64_FORMAT "&profile_id=%s&message=&" - "source=&submit=1&post_form_id=%s&fb_dtsg=%s&" - "post_form_id_source=AsyncRequest&__a=1", - fba->uid, buddy_tmp, fba->post_form_id, fba->dtsg); - g_free(buddy_tmp); - - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/profile/connect.php", - postdata, NULL, NULL, FALSE); - - g_free(postdata); -} -void fb_buddy_delete(PurpleConnection *pc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - FacebookAccount *fba = pc->proto_data; - gchar *buddy_tmp, *postdata; - - //This function removes a buddy from our friends list on facebook - //and shouldn't really be used - if (!purple_account_get_bool(fba->account, "facebook_manage_friends", FALSE)) { - purple_debug_warning("facebook", "attempted to add %s but was blocked\n", buddy->name); - return; - } - - buddy_tmp = g_strdup(purple_url_encode(buddy->name)); - postdata = g_strdup_printf( - "uid=%s&post_form_id=%s&fb_dtsg=%s&" - "post_form_id_source=AsyncRequest&__a=1", - buddy_tmp, fba->post_form_id, fba->dtsg); - g_free(buddy_tmp); - - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/profile/removefriend.php", - postdata, NULL, NULL, FALSE); - - g_free(postdata); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_managefriends.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_MANAGEFRIENDS_H -#define FACEBOOK_MANAGEFRIENDS_H - -#include "libfacebook.h" - -gboolean fb_check_friend_requests(gpointer data); -void fb_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group); -void fb_buddy_delete(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group); - -#endif /* FACEBOOK_MANAGEFRIENDS_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,541 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_messages.h" -#include "fb_connection.h" -#include "fb_conversation.h" -#include "fb_blist.h" -#include "fb_util.h" - -#include "conversation.h" - -typedef struct _FacebookOutgoingMessage FacebookOutgoingMessage; - -struct _FacebookOutgoingMessage { - FacebookAccount *fba; - gchar *who; - GTimeVal time; - gchar *message; - gint msg_id; - guint retry_count; - guint resend_timer; -}; - -static gboolean fb_send_im_fom(FacebookOutgoingMessage *msg); -static gboolean fb_resend_im_fom(FacebookOutgoingMessage *msg); -static gboolean fb_get_new_messages(FacebookAccount *fba); - -static FacebookOutgoingMessage *fb_msg_create(FacebookAccount *fba) -{ - FacebookOutgoingMessage *msg; - - msg = g_new0(FacebookOutgoingMessage, 1); - msg->fba = fba; - - return msg; -} - -static void fb_msg_destroy(FacebookOutgoingMessage *msg) -{ - if (msg->resend_timer) { - purple_timeout_remove(msg->resend_timer); - } - g_free(msg->who); - g_free(msg->message); - g_free(msg); -} - -void fb_cancel_resending_messages(FacebookAccount *fba) -{ - while (fba->resending_messages != NULL) { - FacebookOutgoingMessage *msg = fba->resending_messages->data; - fba->resending_messages = g_slist_remove(fba->resending_messages, msg); - fb_msg_destroy(msg); - } -} - -static void parse_message(PurpleConnection *pc, FacebookAccount *fba, - JsonObject *messageObj, const char* from, const char* to) -{ - gint64 message_time; - const gchar *message; - - purple_debug_info("facebook", "message from %s to %s\n", from, to); - - message = json_node_get_string( - json_object_get_member(messageObj, "text")); - - message_time = fb_time_kludge(json_node_get_int( - json_object_get_member(messageObj, "time"))); - - fb_conversation_handle_message(fba, from, to, message_time, message, TRUE); -} - -static void parse_new_messages(PurpleConnection *pc, FacebookAccount *fba, JsonArray *messages) -{ - int i; - PurpleBuddy *buddy; - gint typing;//VOXOX - CJC - 2009.07.06 - purple_debug_info("facebook", "parsing new messages\n"); - - for (i = 0; i < json_array_get_length(messages); i++) { - const gchar *type; - gchar *from, *to; - - JsonObject *object = json_node_get_object(json_array_get_element(messages, i)); - type = json_node_get_string(json_object_get_member(object, "type")); - - from = g_strdup_printf("%" G_GINT64_FORMAT, (gint64)json_node_get_int(json_object_get_member(object, "from"))); - to = g_strdup_printf("%" G_GINT64_FORMAT, (gint64)json_node_get_int(json_object_get_member(object, "to"))); - - /* Use the in-line buddy name if the buddy list hasn't been downloaded yet */ - buddy = purple_find_buddy(pc->account, from); - if (buddy == NULL || buddy->server_alias == NULL || buddy->alias == NULL) - { - if (json_object_has_member(object, "from_name")) - { - const gchar *from_name = json_node_get_string(json_object_get_member( - object, "from_name")); - fb_blist_set_alias(fba, from, from_name); - } - } - - if (from && to && g_str_equal(type, "msg")) { - JsonObject *messageObj = json_node_get_object(json_object_get_member(object, "msg")); - parse_message(pc, fba, messageObj, from, to); - } else if (from && g_str_equal(type, "typ")) { - purple_debug_info("facebook", "handling typing notification\n"); - - typing = json_node_get_int(json_object_get_member(object, "st")); - if (typing == 0) { - serv_got_typing(pc, from, 10, PURPLE_NOT_TYPING); - } else { - serv_got_typing(pc, from, 10, PURPLE_TYPING); - } - } - - /* - * we've received something from a buddy, assume they're online - * only if it's not from ourselves - */ - if (from && fba->uid != atoll(from)) { - purple_prpl_got_user_status( - fba->account, from, - purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE), NULL); - - } - - g_free(from); - g_free(to); - - fba->message_fetch_sequence++; - } -} - -static void got_new_messages(FacebookAccount *fba, gchar *data, - gsize data_len, gpointer userdata) -{ - PurpleConnection *pc;//VOXOX - CJC - 2009.07.06 - JsonParser *parser; - GList *conversations;//VOXOX - CJC - 2009.07.06 - JsonObject *objnode;//VOXOX - CJC - 2009.07.06 - - pc= userdata;//VOXOX - CJC - 2009.07.06 - - purple_debug_misc("facebook", "got new messages:\n%s\n", data); - - /* for (;;);{"t":"msg","c":"p_800753867","ms":[{"type":"msg", - "msg":{"text":"yes","time":1211176515861,"clientTime":1211176514750, - "msgID":"367146364"},"from":596176850,"to":800753867, - "from_name":"Jeremy Lawson","to_name":"Eion Robb", - "from_first_name":"Jeremy","to_first_name":"Eion"}]} */ - /* for (;;);{"t":"refresh"} */ - /* for (;;);{"t":"msg","c":"p_800753867","ms":[{"type":"msg", - "msg":{"text":"porn head","time":1211177326689,"clientTime":1211177325, - "msgID":"-1992480367"},"from":800753867,"to":596176850, - "from_name":"Eion Robb","to_name":"Jeremy Lawson", - "from_first_name":"Eion","to_first_name":"Jeremy"}]} */ - /* for (;;);{"t":"msg","c":"p_800753867","ms":[{"type":"typ","st":1, - "from":596176850,"to":800753867},{"type":"msg","msg":{"text":"nubile!", - "time":1211177334019,"clientTime":1211177326690,"msgID":"696260545"}, - "from":596176850,"to":800753867,"from_name":"Jeremy Lawson", - "to_name":"Eion Robb","from_first_name":"Jeremy","to_first_name":"Eion"}, - {"type":"msg","msg":{"text":"test2","time":1211177336688, - "clientTime":1211177326691,"msgID":"1527815367"},"from":596176850, - "to":800753867,"from_name":"Jeremy Lawson","to_name":"Eion Robb", - "from_first_name":"Jeremy","to_first_name":"Eion"},{"type":"msg", - "msg":{"text":"ahhhhhhh!","time":1211177344361,"clientTime":1211177326692, - "msgID":"4028916254"},"from":596176850,"to":800753867, - "from_name":"Jeremy Lawson","to_name":"Eion Robb", - "from_first_name":"Jeremy","to_first_name":"Eion"}]} */ - /* for (;;);{"t":"msg","c":"p_800753867","ms":[{"type":"msg", - "msg":{"text":"2","time":1211178167261,"clientTime":1211178164656, - "msgID":"3382240259"},"from":596176850,"to":800753867, - "from_name":"Jeremy Lawson","to_name":"Eion Robb", - "from_first_name":"Jeremy","to_first_name":"Eion"}]} */ - /* for (;;);{"t":"refresh", "seq":1} */ - - parser = fb_get_parser(data, data_len); - if (!parser) - { - /* Sometimes proxies will return incorrect data, so we just shrug - * it off. - * TODO: Only do this for proxies. And when we do it, keep track - * of consecutive failures in the case something is actually - * wrong with Facebook. Eventually this condition should cause - * failure */ - /* Continue looping, waiting for more messages */ - purple_debug_error("facebook", - "got data back, but it's not even json\n"); - - fb_get_new_messages(fba); - return; - } - - objnode = fb_get_json_object(parser, NULL); - - if (json_object_has_member(objnode, "t")) { - const gchar* command = json_node_get_string(json_object_get_member(objnode, "t")); - if (g_str_equal(command, "refresh")) { - if (json_object_has_member(objnode, "seq")) { - fba->message_fetch_sequence = json_node_get_int( - json_object_get_member(objnode, "seq")); - } - - /* grab history items for all open conversations */ - conversations = purple_get_conversations(); - while (conversations != NULL) { - PurpleConversation *conv = - (PurpleConversation *)conversations->data; - if (fb_conversation_is_fb(conv)) { - purple_debug_info("facebook", - "checking for dropped messages with %s\n", - conv->name); - fb_history_fetch(fba, conv->name, FALSE); - } - conversations = conversations->next; - } - - /* refresh means that the channel is invalid */ - fb_reconnect(fba); - json_parser_free(parser); - return; - } else if (g_str_equal(command, "continue")) { - /* continue means that the server wants us to remake the connection. - * continue the loop and wait for messages. noop. */ - } else if (g_str_equal(command, "msg")) { - parse_new_messages(pc, fba, - json_node_get_array(json_object_get_member(objnode, "ms"))); - } - } - - json_parser_free(parser); - - /* Continue looping, waiting for more messages */ - fb_get_new_messages(fba); -} - -/* Message fetch loop. An invariant here is that get_new_messages() - * is the only function which can create a new timer for - * new_messages_check_timer. The timer always calls got_new_messages(), - * and got_new_messages always calls get_new_messages (either directly - * or indirectly). To start the loops off, get_new_messages should be - * called ONCE and only ONCE. After that the timers will take care of - * themselves until final cleanup. - */ -static gboolean fb_get_new_messages(FacebookAccount *fba) -{ - time_t now; - gchar *fetch_url; - gchar *fetch_server; - const gchar *channel_number; - - fba->new_messages_check_timer = 0; - - now = time(NULL); - if (fba->last_messages_download_time > now - 3) { - /* - * Wait a bit before fetching more messages, to make sure we - * never hammer their servers. - * - * TODO: This could be smarter. Like, allow 3 requests per - * 10 seconds or something. - */ - fba->new_messages_check_timer = purple_timeout_add_seconds( - 3 - (now - fba->last_messages_download_time), - (GSourceFunc)fb_get_new_messages, fba); - return FALSE; - } - - if (fba->channel_number == NULL) - { - return FALSE; - } else { - channel_number = fba->channel_number; - } - - purple_debug_info("facebook", "getting new messages\n"); - - fetch_server = g_strdup_printf("%d.%s.facebook.com", 0, channel_number); - /* use the current time in the url to get past any transparent proxy caches */ - fetch_url = g_strdup_printf("/x/%lu/%s/p_%" G_GINT64_FORMAT "=%d", (gulong)time(NULL), (fba->is_idle?"false":"true"), fba->uid, fba->message_fetch_sequence); - - fb_post_or_get(fba, FB_METHOD_GET, fetch_server, fetch_url, NULL, got_new_messages, fba->pc, TRUE); - fba->last_messages_download_time = now; - - g_free(fetch_url); - g_free(fetch_server); - - return FALSE; -} - -static void fb_send_im_cb(FacebookAccount *fba, gchar *data, gsize data_len, gpointer user_data) -{ - FacebookOutgoingMessage *msg = user_data; - JsonParser *parser; - JsonObject *object; - PurpleConversation *conv; - gchar *error = NULL; - - purple_debug_misc("facebook", "sent im response: %s\n", data); - - parser = fb_get_parser(data, data_len); - if (!parser) { - // We didn't get data, but this isn't necessarily fatal. - purple_debug_warning("facebook", "bad data while parsing sent IM\n"); - return; - } - object = fb_get_json_object(parser, &error); - - if (error) - { - purple_debug_error("facebook", "sent im error: %s\n", error); - /* there was an error, either report it or retry */ - if (msg->retry_count++ < FB_MAX_MSG_RETRY) - { - msg->resend_timer = purple_timeout_add_seconds(1, (GSourceFunc)fb_resend_im_fom, msg); - fba->resending_messages = g_slist_prepend(fba->resending_messages, msg); - json_parser_free(parser); - return; - } - else - { - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, - fba->account, msg->who); - purple_conversation_write(conv, NULL, error, - PURPLE_MESSAGE_ERROR, msg->time.tv_sec); - } - - g_hash_table_remove(fba->sent_messages_hash, msg->message); - } - - json_parser_free(parser); - fb_msg_destroy(msg); -} - -static gboolean fb_send_im_fom(FacebookOutgoingMessage *msg) -{ - gchar *encoded_message; - gchar *postdata; - gchar *jstime; - - jstime = g_strdup_printf("%ld%ld", msg->time.tv_sec, (msg->time.tv_usec/1000)); - - encoded_message = g_strdup(purple_url_encode(msg->message)); - postdata = g_strdup_printf("msg_text=%s&msg_id=%d&to=%s&client_time=%s&post_form_id=%s", - encoded_message, msg->msg_id, msg->who, jstime, - msg->fba->post_form_id ? msg->fba->post_form_id : "0"); - g_free(encoded_message); - g_free(jstime); - - fb_post_or_get(msg->fba, FB_METHOD_POST, NULL, "/ajax/chat/send.php", postdata, fb_send_im_cb, msg, FALSE); - g_free(postdata); - - return FALSE; -} - -static gboolean fb_resend_im_fom(FacebookOutgoingMessage *msg) -{ - msg->fba->resending_messages = g_slist_remove(msg->fba->resending_messages, msg); - - return fb_send_im_fom(msg); -} - -int fb_send_im(PurpleConnection *pc, const gchar *who, const gchar *message, PurpleMessageFlags flags) -{ - FacebookOutgoingMessage *msg; - FacebookAccount *fba = pc->proto_data; - - msg = fb_msg_create(fba); - - /* convert html to plaintext, removing trailing spaces */ - msg->message = purple_markup_strip_html(message); - if (strlen(msg->message) > 999) - { - fb_msg_destroy(msg); - return -E2BIG; - } - - msg->msg_id = g_random_int(); - msg->who = g_strdup(who); - g_get_current_time(&msg->time); - msg->retry_count = 0; - - //save that we're sending the message - g_hash_table_insert(fba->sent_messages_hash, strdup(msg->message), NULL); - - fb_send_im_fom(msg); - - /* Return 1 so UI will display message */ - return 1; -} - -void got_reconnect_json(FacebookAccount *fba, gchar *data, gsize data_len, gpointer userdata) -{ - gchar *new_channel_number; - const gchar *new_channel_host; - JsonParser *parser; - JsonObject *objnode; - gint new_seq;//VOXOX - CJC - 2009.07.06 - JsonObject *payload;//VOXOX - CJC - 2009.07.06 - parser = fb_get_parser(data, data_len); - - if (!parser) { - purple_debug_error("facebook", "couldn't parse reconnect data\n"); - purple_debug_info("facebook", "page content: %s\n", data); - purple_connection_error_reason(fba->pc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Chat service currently unavailable")); - return; - } - - objnode = fb_get_json_object(parser, NULL); - - payload = json_node_get_object(json_object_get_member(objnode, "payload"));//VOXOX - CJC - 2009.07.06 - - /* eg {"host":"channel01"} */ - new_channel_host = json_node_get_string(json_object_get_member(payload, "host")); - - if (new_channel_host == NULL) - { - purple_debug_error("facebook", "couldn't find new channel number\n"); - purple_debug_info("facebook", "page content: %s\n", data); - purple_connection_error_reason(fba->pc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error fetching channel; did you log in elsewhere?")); - json_parser_free(parser); - return; - } - - g_free(fba->channel_number); - fba->channel_number = g_strdup(new_channel_host); - - new_seq = json_node_get_int(json_object_get_member(payload, "seq")); - fba->message_fetch_sequence = new_seq; - - /* - * Now that we have a channel number we can start looping and - * waiting for messages - */ - fb_get_new_messages(fba); - json_parser_free(parser); -} - -gboolean fb_reconnect(FacebookAccount *fba) -{ - gchar *url = g_strdup_printf("/ajax/presence/reconnect.php?reason=7&post_form_id=%s&__a=1", fba->post_form_id); - fb_post_or_get(fba, FB_METHOD_GET, NULL, url, NULL, got_reconnect_json, NULL, FALSE); - g_free(url); - - return FALSE; -} - -static void got_form_id_page(FacebookAccount *fba, gchar *data, gsize data_len, gpointer userdata) -{ - const gchar *start_text = "id=\"post_form_id\" name=\"post_form_id\" value=\""; - const gchar *dtsg_start = "fb_dtsg:\""; - const gchar *channel_start = "js\", \"channel"; - const gchar *channel_start2 = "js\",\"channel"; - gchar *post_form_id; - gchar *channel = NULL; - gchar *tmp = NULL; - - /* NULL data crashes on Windows */ - if (data == NULL) - data = "(null)"; - - tmp = g_strstr_len(data, data_len, start_text); - if (tmp == NULL) - { - purple_debug_error("facebook", "couldn't find post_form_id\n"); - purple_debug_info("facebook", "page content: %s\n", data); - /* Maybe they changed their HTML slightly? */ - purple_connection_error_reason(fba->pc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Error getting info from Facebook.")); - return; - } - tmp += strlen(start_text); - post_form_id = g_strndup(tmp, strchr(tmp, '"') - tmp); - - g_free(fba->post_form_id); - fba->post_form_id = post_form_id; - tmp = g_strstr_len(data, data_len, dtsg_start); - if (tmp != NULL) - { - tmp += strlen(dtsg_start); - g_free(fba->dtsg); - fba->dtsg = g_strndup(tmp, strchr(tmp, '"') - tmp); - } - - tmp = g_strstr_len(data, data_len, channel_start); - if (tmp != NULL) - { - tmp += 6; - } else { - tmp = g_strstr_len(data, data_len, channel_start2); - if (tmp != NULL) - tmp += 5; - } - if (tmp != NULL) - { - channel = g_strndup(tmp, strchr(tmp, '"') - tmp); - g_free(fba->channel_number); - fba->channel_number = channel; - } - - tmp = g_strdup_printf("visibility=true&post_form_id=%s", post_form_id); - fb_post_or_get(fba, FB_METHOD_POST, "apps.facebook.com", "/ajax/chat/settings.php", tmp, NULL, NULL, FALSE); - g_free(tmp); - - if (channel == NULL) - { - /* Grab new channel number */ - fb_reconnect(fba); - } else { - fb_get_new_messages(fba); - } -} - -gboolean fb_get_post_form_id(FacebookAccount *fba) -{ - fb_post_or_get(fba, FB_METHOD_GET, NULL, "/presence/popout.php", NULL, got_form_id_page, NULL, FALSE); - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_messages.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_MESSAGES_H -#define FACEBOOK_MESSAGES_H - -#include "libfacebook.h" - -gboolean fb_get_post_form_id(FacebookAccount *fba); -gboolean fb_reconnect(FacebookAccount *fba); -int fb_send_im(PurpleConnection *pc, const gchar *who, const gchar *message, - PurpleMessageFlags flags); - -void fb_cancel_resending_messages(FacebookAccount *fba); - -#endif /* FACEBOOK_MESSAGES_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,204 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_notifications.h" -#include "fb_connection.h" - -static void fb_got_notifications_cb(FacebookAccount *fba, gchar *url_text, gsize len, gpointer userdata) -{ - gchar *salvaged; - time_t last_fetch_time; - time_t time_of_message; - time_t newest_message = 0; - xmlnode *channel;//VOXOX - CJC - 2009.07.06 - xmlnode *rss_root;//VOXOX - CJC - 2009.07.06 - xmlnode *item;//VOXOX - CJC - 2009.07.06 - xmlnode *link;//VOXOX - CJC - 2009.07.06 - xmlnode *title;//VOXOX - CJC - 2009.07.06 - gchar *tmp; - gchar month_string[4], weekday[4]; - guint year, month, day, hour, minute, second; - long timezone; - gchar *subject, *url; - - month_string[3] = weekday[3] = '\0'; - year = month = day = hour = minute = second = 0; - - if (!url_text || !len) - return; - - last_fetch_time = purple_account_get_int(fba->account, "facebook_notifications_last_fetch", 0); - /* purple_debug_info("facebook", "last fetch time: %zu\n", last_fetch_time); */ - - salvaged = purple_utf8_salvage(url_text); - rss_root = xmlnode_from_str(salvaged, -1); - g_free(salvaged); - - if (rss_root == NULL) - { - purple_debug_error("facebook", "Could not load RSS file\n"); - return; - } - channel = xmlnode_get_child(rss_root, "channel"); - if (channel == NULL) - { - purple_debug_warning("facebook", "Invalid RSS feed\n"); - xmlnode_free(rss_root); - return; - } - item = xmlnode_get_child(channel, "item"); - if (item == NULL) - { - purple_debug_info("facebook", "No new notifications\n"); - } - for (; item != NULL; item = xmlnode_get_next_twin(item)) - { - xmlnode *pubDate = xmlnode_get_child(item, "pubDate"); - if (!pubDate) - continue; - tmp = xmlnode_get_data_unescaped(pubDate); - /* rss times are in Thu, 19 Jun 2008 15:51:25 -1100 format */ - sscanf(tmp, "%3s, %2u %3s %4u %2u:%2u:%2u %5ld", (char*)&weekday, &day, (char*)&month_string, &year, &hour, &minute, &second, &timezone); - if (g_str_equal(month_string, "Jan")) month = 0; - else if (g_str_equal(month_string, "Feb")) month = 1; - else if (g_str_equal(month_string, "Mar")) month = 2; - else if (g_str_equal(month_string, "Apr")) month = 3; - else if (g_str_equal(month_string, "May")) month = 4; - else if (g_str_equal(month_string, "Jun")) month = 5; - else if (g_str_equal(month_string, "Jul")) month = 6; - else if (g_str_equal(month_string, "Aug")) month = 7; - else if (g_str_equal(month_string, "Sep")) month = 8; - else if (g_str_equal(month_string, "Oct")) month = 9; - else if (g_str_equal(month_string, "Nov")) month = 10; - else if (g_str_equal(month_string, "Dec")) month = 11; - g_free(tmp); - - /* try using pidgin's functions */ - tmp = g_strdup_printf("%04u%02u%02uT%02u%02u%02u%05ld", year, month, day, hour, minute, second, timezone); - time_of_message = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - g_free(tmp); - - if (time_of_message <= 0) - { - /* there's no cross-platform, portable way of converting string to time - which doesn't need a new version of glib, so just cheat */ - time_of_message = second + 60*minute + 3600*hour + 86400*day + 2592000*month + 31536000*(year-1970); - } - - if (time_of_message > newest_message) - { - /* we'll keep the newest message to save */ - newest_message = time_of_message; - } - - if (time_of_message <= last_fetch_time) - { - /* fortunatly, rss messages are ordered from newest to oldest */ - /* so if this message is older than the last one, ignore rest */ - break; - } - - link = xmlnode_get_child(item, "link"); - if (link) - { - url = xmlnode_get_data_unescaped(link); - } else { - url = g_strdup(""); - } - - title = xmlnode_get_child(item, "title"); - if (title) - { - subject = xmlnode_get_data_unescaped(title); - } else { - subject = g_strdup(""); - } - - purple_notify_email(fba->pc, subject, NULL, fba->account->username, url, NULL, NULL); - g_free(subject); - g_free(url); - } - xmlnode_free(rss_root); - - if (newest_message > last_fetch_time) - { - /* update the last fetched time if we had newer messages */ - purple_account_set_int(fba->account, "facebook_notifications_last_fetch", newest_message); - } -} - -static void find_feed_url_cb(FacebookAccount *fba, gchar *data, gsize data_len, gpointer userdata) -{ - const gchar *search_string = "/feeds/notifications.php"; - gchar *feed_url; - gchar *stripped; - - purple_debug_info("facebook", "find_feed_url_cb\n"); - - if (!data) - data = "(null)"; - - feed_url = g_strstr_len(data, data_len, search_string); - if (!feed_url) - { - purple_debug_error("facebook", "received data, but could not find url on page\n"); - return; - } - - feed_url = g_strndup(feed_url, strchr(feed_url, '"') - feed_url); - - /* convert & to & */ - stripped = purple_unescape_html(feed_url); - g_free(feed_url); - feed_url = stripped; - - purple_debug_info("facebook", "parsed feed url %s\n", feed_url); - - if (feed_url && *feed_url) - { - purple_account_set_string(fba->account, "notifications_feed_url", feed_url); - fb_get_notifications_feed(fba); - } -} - -static void fb_find_feed_url(FacebookAccount *fba) -{ - fb_post_or_get(fba, FB_METHOD_GET, NULL, "/notifications.php", NULL, - find_feed_url_cb, NULL, FALSE); -} - -gboolean fb_get_notifications_feed(FacebookAccount *fba) -{ - const gchar *feed_url; - - if (purple_account_get_bool(fba->account, "facebook_get_notifications", TRUE)) { - feed_url = purple_account_get_string(fba->account, "notifications_feed_url", NULL); - if (!feed_url) - { - purple_debug_info("facebook", "no notifications feed url available, searching for it\n"); - fb_find_feed_url(fba); - return TRUE; - } - - fb_post_or_get(fba, FB_METHOD_GET, NULL, feed_url, NULL, fb_got_notifications_cb, NULL, FALSE); - } - - return TRUE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_notifications.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_NOTIFICATIONS_H -#define FACEBOOK_NOTIFICATIONS_H - -#include "libfacebook.h" - -gboolean fb_get_notifications_feed(FacebookAccount *fba); - -#endif /* FACEBOOK_NOTIFICATIONS_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,199 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "libfacebook.h" -#include "fb_connection.h" -#include "fb_info.h" -#include "fb_search.h" - -static void fb_searchresults_add_buddy(PurpleConnection *pc, GList *row, - void *user_data) -{ - PurpleAccount *account = purple_connection_get_account(pc); - - if (!purple_find_buddy(account, g_list_nth_data(row, 0))) - purple_blist_request_add_buddy(account, - g_list_nth_data(row, 0), NULL, NULL); -} - -static void fb_searchresults_info_buddy(PurpleConnection *pc, GList *row, - void *user_data) -{ - /* PurpleAccount *account = purple_connection_get_account(pc); */ - - /* if (purple_find_buddy(account, g_list_nth_data(row, 0))) */ - fb_get_info(pc, g_list_nth_data(row, 0)); -} - -static void fb_found_friends(FacebookAccount *fba, gchar *data, - gsize data_len, gpointer user_data) -{ - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - gchar *id, *tmp, *stripped, *last_id_pos = 0, *id_pos = data; - gchar *search_term = user_data; - const gchar *id_search_term = - "facebook.com/inbox/?compose&id="; /* " */ - const gchar *name_search_term = "class=\"url fn\""; /* < */ - const gchar *network_search_term = "class=\"result_network\">"; /* < */ - - if (!g_strstr_len(data, data_len, id_search_term)) - { - /* there's no friends found; notify as such */ - tmp = g_strdup_printf(_("No results found for %s"), - search_term); - purple_notify_error(fba->pc, NULL, tmp, NULL); - g_free(tmp); - g_free(search_term); - return; - } - - results = purple_notify_searchresults_new(); - if (results == NULL) - { - g_free(search_term); - return; - } - - /* columns: Facebook ID, Name, Network */ - column = purple_notify_searchresults_column_new(_("ID")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Network")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("In List?")); - purple_notify_searchresults_column_add(results, column); - - if (purple_account_get_bool(fba->account, "facebook_manage_friends", - FALSE)) { - purple_notify_searchresults_button_add(results, - PURPLE_NOTIFY_BUTTON_ADD, - fb_searchresults_add_buddy); - } - purple_notify_searchresults_button_add(results, - PURPLE_NOTIFY_BUTTON_INFO, - fb_searchresults_info_buddy); - - purple_debug_info("facebook", "found_friends\n"); - while ((id_pos = strstr(id_pos, id_search_term))) - { - /* the row in the search results table */ - /* prepend to it backwards then reverse to speed up adds */ - GList *row = NULL; - - /* grab id */ - id_pos += strlen(id_search_term); - if (strchr(id_pos, '&') < strchr(id_pos, '"')) - { - /* new layout repeats the id */ - continue; - } - id = g_strndup(id_pos, strchr(id_pos, '"')-id_pos); - purple_debug_info("facebook", "Found user with id: %s\n", id); - row = g_list_prepend(row, id); - - /* look for name */ - tmp = g_strrstr_len(data, id_pos-data, name_search_term); - if (tmp && tmp > last_id_pos) - { - tmp += strlen(name_search_term); - tmp = strchr(tmp, '>') + 1; - tmp = g_strndup(tmp, strchr(tmp, '<')-tmp); - stripped = purple_unescape_html(tmp); - g_free(tmp); - purple_debug_info("facebook", "With name: %s\n", - stripped); - row = g_list_prepend(row, stripped); - } else { - row = g_list_prepend(row, NULL); - } - - /* look for network */ - tmp = g_strrstr_len(data, id_pos-data, network_search_term); - if (tmp && tmp > last_id_pos) - { - tmp += strlen(network_search_term); - tmp = g_strndup(tmp, strchr(tmp, '<')-tmp); - stripped = purple_unescape_html(tmp); - g_free(tmp); - purple_debug_info("facebook", "With network: %s\n", - stripped); - row = g_list_prepend(row, stripped); - } else { - row = g_list_prepend(row, NULL); - } - - if (purple_find_buddy(fba->account, id)) - row = g_list_prepend(row, g_strdup(_("Yes"))); - else - row = g_list_prepend(row, g_strdup(_("No"))); - - row = g_list_reverse(row); - purple_notify_searchresults_row_add(results, row); - - last_id_pos = id_pos; - } - purple_debug_info("facebook", "dumping search results\n"); - purple_notify_searchresults(fba->pc, NULL, search_term, NULL, - results, NULL, NULL); - - g_free(search_term); -} - -static void fb_search_users_search_cb(gpointer connection, - const gchar *search_text) -{ - PurpleConnection *pc = connection; - FacebookAccount *fba = pc->proto_data; - gchar *search_url; - gchar *search_tmp; - gchar *sid_cookie_value; - - if (!search_text || !*search_text) - return; - - search_tmp = g_strdup(purple_url_encode(search_text)); - sid_cookie_value = g_hash_table_lookup(fba->cookie_table, "sid"); - if (sid_cookie_value == NULL) - sid_cookie_value = "1"; - search_url = g_strdup_printf("/s.php?q=%s&init=q&sid=%s", - search_tmp, sid_cookie_value); - g_free(search_tmp); - - fb_post_or_get(fba, FB_METHOD_GET, NULL, search_url, NULL, - fb_found_friends, g_strdup(search_text), FALSE); - - g_free(search_url); -} - -void fb_search_users(PurplePluginAction *action) -{ - PurpleConnection *pc = (PurpleConnection *) action->context; - - purple_request_input(pc, _("Search for Friends"), - _("Search for Facebook Friends"), - _("Type the full name or e-mail address of the friend you are searching for."), - NULL, FALSE, FALSE, NULL, - _("_Search"), G_CALLBACK(fb_search_users_search_cb), - _("_Cancel"), NULL, - purple_connection_get_account(pc), NULL, NULL, - pc); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_search.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_SEARCH_H -#define FACEBOOK_SEARCH_H - -#include "libfacebook.h" - -void fb_search_users(PurplePluginAction *action); - -#endif /* FACEBOOK_SEARCH_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,285 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "fb_util.h" -/***************************************************************************** - * UTILITY CODE * - *****************************************************************************/ - -gchar *fb_convert_unicode(const gchar *input) -{ - /* \u00e9t\u00e9 should be été */ - - gunichar unicode_char; - gchar unicode_char_str[6]; - gint unicode_char_len; - gchar *next_pos; - gchar *input_string; - gchar *output_string; - - if (input == NULL) - return NULL; - - next_pos = input_string = g_strdup(input); - - /* purple_debug_info("facebook", "unicode convert: in: %s\n", input); */ - while ((next_pos = strstr(next_pos, "\\u"))) - { - /* grab the unicode */ - sscanf(next_pos, "\\u%4x", &unicode_char); - /* turn it to a char* */ - unicode_char_len = g_unichar_to_utf8(unicode_char, unicode_char_str); - /* shove it back into the string */ - g_memmove(next_pos, unicode_char_str, unicode_char_len); - /* move all the data after the \u0000 along */ - g_stpcpy(next_pos + unicode_char_len, next_pos + 6); - } - - /* purple_debug_info("facebook", "unicode convert: out: %s\n", input); */ - output_string = g_strcompress(input_string); - g_free(input_string); - - return output_string; -} - -/* Like purple_strdup_withhtml, but escapes htmlentities too */ -gchar *fb_strdup_withhtml(const gchar *src) -{ - gulong destsize, i, j; - gchar *dest; - - g_return_val_if_fail(src != NULL, NULL); - - /* New length is (length of src) + (number of \n's * 3) + (number of &'s * 5) + - (number of <'s * 4) + (number of >'s *4) + (number of "'s * 6) - - (number of \r's) + 1 */ - destsize = 1; - for (i = 0; src[i] != '\0'; i++) - { - if (src[i] == '\n' || src[i] == '<' || src[i] == '>') - destsize += 4; - else if (src[i] == '&') - destsize += 5; - else if (src[i] == '"') - destsize += 6; - else if (src[i] != '\r') - destsize++; - } - - dest = g_malloc(destsize); - - /* Copy stuff, ignoring \r's, because they are dumb */ - for (i = 0, j = 0; src[i] != '\0'; i++) { - if (src[i] == '\n') { - strcpy(&dest[j], "
"); - j += 4; - } else if (src[i] == '<') { - strcpy(&dest[j], "<"); - j += 4; - } else if (src[i] == '>') { - strcpy(&dest[j], ">"); - j += 4; - } else if (src[i] == '&') { - strcpy(&dest[j], "&"); - j += 5; - } else if (src[i] == '"') { - strcpy(&dest[j], """); - j += 6; - } else if (src[i] != '\r') - dest[j++] = src[i]; - } - - dest[destsize-1] = '\0'; - - return dest; -} -static gboolean is_json_64bit_safe() -{ - //Cache the result to try make this function quick - static gint result = -1; - gint64 largeint = G_MAXINT64; - - if (result == 1) - return TRUE; - if (result == 0) - return FALSE; - - if (sizeof(gint) >= sizeof(gint64)) - { - result = 1; - return TRUE; - } - -//#ifndef USE_JSONC -// JsonNode *node; -// -// node = json_node_new(JSON_NODE_VALUE); -// json_node_set_int(node, largeint); -// if(json_node_get_int(node) == largeint) -// { -// result = 1; -// } else { -// result = 0; -// } -// json_node_free(node); -// return result ? TRUE : FALSE; -// -//#endif /* !USE_JSONC */ - - result = 0; - return FALSE; -} - -gint64 fb_time_kludge(gint64 initial_time) -{ - gint64 now_millis;//VOXOX - CJC - 2009.07.17 - gint64 final_time;//VOXOX - CJC - 2009.07.17 - if (is_json_64bit_safe()) - return initial_time; - - now_millis = (gint64) time(NULL); - now_millis *= 1000; - now_millis &= 0xFFFFFFFF00000000LL; - final_time = now_millis | ((guint)initial_time); - - return final_time; -} - -JsonParser *fb_get_parser(const gchar *data, gsize data_len) -{ - JsonParser *parser; - - if (data == NULL) { - return NULL; - } - - data = g_strstr_len(data, data_len, "for (;;);"); - if (!data) { - return NULL; - } else { - data += strlen("for (;;);"); - } - - parser = json_parser_new(); - if (!json_parser_load_from_data(parser, data, -1, NULL)) { - json_parser_free(parser); - return NULL; - } - - return parser; -} - -JsonObject *fb_get_json_object(JsonParser *parser, char **error_message) -{ - JsonNode *root;//VOXOX - CJC - 2009.07.17 - JsonObject *objnode;//VOXOX - CJC - 2009.07.17 - root = json_parser_get_root(parser); - objnode = json_node_get_object(root); - - /* Sample error messages */ - /* for (;;);{"error":1357001,"errorSummary":"Not Logged In", - "errorDescription":"You must be logged in to do that.", - "payload":null,"bootload":[{"name":"js\/common.js.pkg.php", - "type":"js","src":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/pkg\/59\ - /98561\/js\/common.js.pkg.php"}]} */ - if (json_object_has_member(objnode, "error")) - { - guint32 error_number; - const char *summary; - const char *description; - - error_number = json_node_get_int( - json_object_get_member(objnode, "error")); - summary = json_node_get_string( - json_object_get_member(objnode, "errorSummary")); - description = json_node_get_string( - json_object_get_member(objnode, "errorDescription")); - - if (error_number) - { - purple_debug_error("facebook", - "got error from facebook of %s (%s)", - summary, description); - // Pass error message to calling function if they asked for it. - if (error_message) { - *error_message = g_strdup(description); - } - } - } - - return objnode; -} - -/* Converts *text* into text and _text_ into text */ -gchar *fb_replace_styled_text(const gchar *text) -{ -#ifdef __ARM_EABI__ - return g_strdup(text); -#else /*__ARM_EABI__*/ -#if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 14 - if (glib_check_version(2, 14, 0)) - { - return g_strdup(text); - } else { - static GRegex *underline_regex = NULL; - static GRegex *bold_regex = NULL; - gchar *dup_text; - gchar *midway_string; - gchar *output_string; - - if (underline_regex == NULL) - { - underline_regex = g_regex_new( - "\\b_([^_\\*]+)_\\b", G_REGEX_OPTIMIZE, - 0, NULL); - } - if (bold_regex == NULL) - { - bold_regex = g_regex_new( - "(\\s|^)\\*([^_\\*]+)\\*(?=$|\\s)", - G_REGEX_OPTIMIZE, 0, NULL); - } - - dup_text = g_strdup(text); - midway_string = g_regex_replace(underline_regex, dup_text, - strlen(dup_text), 0, "\\1", 0, NULL); - if (midway_string == NULL) - { - purple_debug_warning("facebook", "regex failed for underline\n"); - return dup_text; - } - g_free(dup_text); - output_string = g_regex_replace(bold_regex, midway_string, - strlen(midway_string), 0, "\\1\\2", 0, NULL); - if (output_string == NULL) - { - purple_debug_warning("facebook", "regex failed for bold\n"); - return midway_string; - } - g_free(midway_string); - - return output_string; - } -#else /* GLIB check */ - return g_strdup(text); -#endif /* GLIB check */ -#endif /*__ARM_EABI__*/ -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/fb_util.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef FACEBOOK_UTIL_H -#define FACEBOOK_UTIL_H - -#include "libfacebook.h" - -#include "fb_json.h" - - -JsonParser *fb_get_parser(const gchar *data, gsize data_len); -JsonObject *fb_get_json_object(JsonParser *parser, char **error_message); - -gchar *fb_replace_styled_text(const gchar *text); -gchar *fb_strdup_withhtml(const gchar *src); -gchar *fb_convert_unicode(const gchar *input); -gint64 fb_time_kludge(gint64 initial_time); - -#endif /* FACEBOOK_UTIL_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-array.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-array.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-array.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-array.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,701 +0,0 @@ -/* json-array.c - JSON array implementation - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "json-types-private.h" - -/** - * SECTION:json-array - * @short_description: a JSON array representation - * - * #JsonArray is the representation of the array type inside JSON. It contains - * #JsonNodes, which may contain fundamental types, other arrays or - * objects. - * - * Since arrays can be expensive, they are reference counted. You can control - * the lifetime of a #JsonArray using json_array_ref() and json_array_unref(). - * - * To append an element, use json_array_add_element(). - * To extract an element at a given index, use json_array_get_element(). - * To retrieve the entire array in list form, use json_array_get_elements(). - * To retrieve the length of the array, use json_array_get_length(). - */ - -GType -json_array_get_type (void) -{ - static GType array_type = 0; - - if (G_UNLIKELY (!array_type)) - array_type = g_boxed_type_register_static (g_intern_static_string ("JsonArray"), - (GBoxedCopyFunc) json_array_ref, - (GBoxedFreeFunc) json_array_unref); - - return array_type; -} - -/** - * json_array_new: - * - * Creates a new #JsonArray. - * - * Return value: the newly created #JsonArray - */ -JsonArray * -json_array_new (void) -{ - JsonArray *array; - - array = g_slice_new (JsonArray); - - array->ref_count = 1; - array->elements = g_ptr_array_new (); - - return array; -} - -/** - * json_array_sized_new: - * @n_elements: number of slots to pre-allocate - * - * Creates a new #JsonArray with @n_elements slots already allocated. - * - * Return value: the newly created #JsonArray - */ -JsonArray * -json_array_sized_new (guint n_elements) -{ - JsonArray *array; - - array = g_slice_new (JsonArray); - - array->ref_count = 1; - array->elements = g_ptr_array_sized_new (n_elements); - - return array; -} - -/** - * json_array_ref: - * @array: a #JsonArray - * - * Increase by one the reference count of a #JsonArray. - * - * Return value: the passed #JsonArray, with the reference count - * increased by one. - */ -JsonArray * -json_array_ref (JsonArray *array) -{ - g_return_val_if_fail (array != NULL, NULL); - g_return_val_if_fail (array->ref_count > 0, NULL); - - g_atomic_int_exchange_and_add (&array->ref_count, 1); - - return array; -} - -/** - * json_array_unref: - * @array: a #JsonArray - * - * Decreases by one the reference count of a #JsonArray. If the - * reference count reaches zero, the array is destroyed and all - * its allocated resources are freed. - */ -void -json_array_unref (JsonArray *array) -{ - gint old_ref; - - g_return_if_fail (array != NULL); - g_return_if_fail (array->ref_count > 0); - - old_ref = g_atomic_int_get (&array->ref_count); - if (old_ref > 1) - g_atomic_int_compare_and_exchange (&array->ref_count, old_ref, old_ref - 1); - else - { - guint i; - - for (i = 0; i < array->elements->len; i++) - json_node_free (g_ptr_array_index (array->elements, i)); - - g_ptr_array_free (array->elements, TRUE); - array->elements = NULL; - - g_slice_free (JsonArray, array); - } -} - -/** - * json_array_get_elements: - * @array: a #JsonArray - * - * Gets the elements of a #JsonArray as a list of #JsonNodes. - * - * Return value: a #GList containing the elements of the array. The - * contents of the list are owned by the array and should never be - * modified or freed. Use g_list_free() on the returned list when - * done using it - */ -GList * -json_array_get_elements (JsonArray *array) -{ - GList *retval; - guint i; - - g_return_val_if_fail (array != NULL, NULL); - - retval = NULL; - for (i = 0; i < array->elements->len; i++) - retval = g_list_prepend (retval, - g_ptr_array_index (array->elements, i)); - - return g_list_reverse (retval); -} - -/** - * json_array_dup_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Retrieves a copy of the #JsonNode containing the value of the - * element at @index_ inside a #JsonArray - * - * Return value: a copy of the #JsonNode at the requested index. - * Use json_node_free() when done. - * - * Since: 0.6 - */ -JsonNode * -json_array_dup_element (JsonArray *array, - guint index_) -{ - JsonNode *retval; - - g_return_val_if_fail (array != NULL, NULL); - g_return_val_if_fail (index_ < array->elements->len, NULL); - - retval = json_array_get_element (array, index_); - if (!retval) - return NULL; - - return json_node_copy (retval); -} - -/** - * json_array_get_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Retrieves the #JsonNode containing the value of the element at @index_ - * inside a #JsonArray. - * - * Return value: a pointer to the #JsonNode at the requested index - */ -JsonNode * -json_array_get_element (JsonArray *array, - guint index_) -{ - g_return_val_if_fail (array != NULL, NULL); - g_return_val_if_fail (index_ < array->elements->len, NULL); - - return g_ptr_array_index (array->elements, index_); -} - -/** - * json_array_get_int_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves the integer value of the element at @index_ - * inside @array - * - * See also: json_array_get_element(), json_node_get_int() - * - * Return value: the integer value - * - * Since: 0.8 - */ -gint64 -json_array_get_int_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, 0); - g_return_val_if_fail (index_ < array->elements->len, 0); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, 0); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, 0); - - return json_node_get_int (node); -} - -/** - * json_array_get_double_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves the floating point value of the element at - * @index_ inside @array - * - * See also: json_array_get_element(), json_node_get_double() - * - * Return value: the floating point value - * - * Since: 0.8 - */ -gdouble -json_array_get_double_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, 0.0); - g_return_val_if_fail (index_ < array->elements->len, 0.0); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, 0.0); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, 0.0); - - return json_node_get_double (node); -} - -/** - * json_array_get_boolean_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves the boolean value of the element at @index_ - * inside @array - * - * See also: json_array_get_element(), json_node_get_boolean() - * - * Return value: the integer value - * - * Since: 0.8 - */ -gboolean -json_array_get_boolean_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, FALSE); - g_return_val_if_fail (index_ < array->elements->len, FALSE); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, FALSE); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, FALSE); - - return json_node_get_boolean (node); -} - -/** - * json_array_get_string_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves the string value of the element at @index_ - * inside @array - * - * See also: json_array_get_element(), json_node_get_string() - * - * Return value: the string value; the returned string is owned by - * the #JsonArray and should not be modified or freed - * - * Since: 0.8 - */ -G_CONST_RETURN gchar * -json_array_get_string_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, NULL); - g_return_val_if_fail (index_ < array->elements->len, NULL); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, NULL); - - return json_node_get_string (node); -} - -/** - * json_array_get_null_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves whether the element at @index_ is set to null - * - * See also: json_array_get_element(), JSON_NODE_TYPE(), %JSON_NODE_NULL - * - * Return value: %TRUE if the element is null - * - * Since: 0.8 - */ -gboolean -json_array_get_null_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, FALSE); - g_return_val_if_fail (index_ < array->elements->len, FALSE); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, FALSE); - - return JSON_NODE_TYPE (node) == JSON_NODE_NULL; -} - -/** - * json_array_get_array_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves the array from the element at @index_ - * inside @array - * - * See also: json_array_get_element(), json_node_get_array() - * - * Return value: the array - * - * Since: 0.8 - */ -JsonArray * -json_array_get_array_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, NULL); - g_return_val_if_fail (index_ < array->elements->len, NULL); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_ARRAY, NULL); - - return json_node_get_array (node); -} - -/** - * json_array_get_object_element: - * @array: a #JsonArray - * @index_: the index of the element to retrieve - * - * Conveniently retrieves the object from the element at @index_ - * inside @array - * - * See also: json_array_get_element(), json_node_get_object() - * - * Return value: the object - * - * Since: 0.8 - */ -JsonObject * -json_array_get_object_element (JsonArray *array, - guint index_) -{ - JsonNode *node; - - g_return_val_if_fail (array != NULL, NULL); - g_return_val_if_fail (index_ < array->elements->len, NULL); - - node = g_ptr_array_index (array->elements, index_); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_OBJECT, NULL); - - return json_node_get_object (node); -} - -/** - * json_array_get_length: - * @array: a #JsonArray - * - * Retrieves the length of a #JsonArray - * - * Return value: the length of the array - */ -guint -json_array_get_length (JsonArray *array) -{ - g_return_val_if_fail (array != NULL, 0); - - return array->elements->len; -} - -/** - * json_array_add_element: - * @array: a #JsonArray - * @node: a #JsonNode - * - * Appends @node inside @array. The array will take ownership of the - * #JsonNode. - */ -void -json_array_add_element (JsonArray *array, - JsonNode *node) -{ - g_return_if_fail (array != NULL); - g_return_if_fail (node != NULL); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_int_element: - * @array: a #JsonArray - * @value: an integer value - * - * Conveniently adds an integer @value into @array - * - * See also: json_array_add_element(), json_node_set_int() - * - * Since: 0.8 - */ -void -json_array_add_int_element (JsonArray *array, - gint64 value) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_int (node, value); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_double_element: - * @array: a #JsonArray - * @value: a floating point value - * - * Conveniently adds a floating point @value into @array - * - * See also: json_array_add_element(), json_node_set_double() - * - * Since: 0.8 - */ -void -json_array_add_double_element (JsonArray *array, - gdouble value) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_double (node, value); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_boolean_element: - * @array: a #JsonArray - * @value: a boolean value - * - * Conveniently adds a boolean @value into @array - * - * See also: json_array_add_element(), json_node_set_boolean() - * - * Since: 0.8 - */ -void -json_array_add_boolean_element (JsonArray *array, - gboolean value) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_boolean (node, value); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_string_element: - * @array: a #JsonArray - * @value: a string value - * - * Conveniently adds a string @value into @array - * - * See also: json_array_add_element(), json_node_set_string() - * - * Since: 0.8 - */ -void -json_array_add_string_element (JsonArray *array, - const gchar *value) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - g_return_if_fail (value != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_string (node, value); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_null_element: - * @array: a #JsonArray - * - * Conveniently adds a null element into @array - * - * See also: json_array_add_element(), %JSON_NODE_NULL - * - * Since: 0.8 - */ -void -json_array_add_null_element (JsonArray *array) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - - node = json_node_new (JSON_NODE_NULL); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_array_element: - * @array: a #JsonArray - * @value: a #JsonArray - * - * Conveniently adds an array into @array. The @array takes ownership - * of the newly added #JsonArray - * - * See also: json_array_add_element(), json_node_take_array() - * - * Since: 0.8 - */ -void -json_array_add_array_element (JsonArray *array, - JsonArray *value) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - g_return_if_fail (value != NULL); - - node = json_node_new (JSON_NODE_ARRAY); - json_node_take_array (node, value); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_add_object_element: - * @array: a #JsonArray - * @value: a #JsonObject - * - * Conveniently adds an object into @array. The @array takes ownership - * of the newly added #JsonObject - * - * See also: json_array_add_element(), json_node_take_object() - * - * Since: 0.8 - */ -void -json_array_add_object_element (JsonArray *array, - JsonObject *value) -{ - JsonNode *node; - - g_return_if_fail (array != NULL); - g_return_if_fail (value != NULL); - - node = json_node_new (JSON_NODE_OBJECT); - json_node_take_object (node, value); - - g_ptr_array_add (array->elements, node); -} - -/** - * json_array_remove_element: - * @array: a #JsonArray - * @index_: the position of the element to be removed - * - * Removes the #JsonNode inside @array at @index_ freeing its allocated - * resources. - */ -void -json_array_remove_element (JsonArray *array, - guint index_) -{ - g_return_if_fail (array != NULL); - g_return_if_fail (index_ < array->elements->len); - - json_node_free (g_ptr_array_remove_index (array->elements, index_)); -} - -/** - * json_array_foreach_element: - * @array: a #JsonArray - * @func: the function to be called on each element - * @data: data to be passed to the function - * - * Iterates over all elements of @array and calls @func on - * each one of them. - * - * It is safe to change the value of a #JsonNode of the @array - * from within the iterator @func, but it is not safe to add or - * remove elements from the @array. - * - * Since: 0.8 - */ -void -json_array_foreach_element (JsonArray *array, - JsonArrayForeach func, - gpointer data) -{ - gint i; - - g_return_if_fail (array != NULL); - g_return_if_fail (func != NULL); - - for (i = 0; i < array->elements->len; i++) - { - JsonNode *element_node; - - element_node = g_ptr_array_index (array->elements, i); - - (* func) (array, i, element_node, data); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ - -/* Generated data (by glib-mkenums) */ - -#include "json-enum-types.h" -/* enumerations from "../json-glib/json-parser.h" */ -#include "../json-glib/json-parser.h" -GType -json_parser_error_get_type(void) { - static GType etype = 0; - if (G_UNLIKELY (!etype)) - { - const GEnumValue values[] = { - { JSON_PARSER_ERROR_PARSE, "JSON_PARSER_ERROR_PARSE", "parse" }, - { JSON_PARSER_ERROR_UNKNOWN, "JSON_PARSER_ERROR_UNKNOWN", "unknown" }, - { 0, NULL, NULL } - }; - etype = g_enum_register_static (g_intern_static_string ("JsonParserError"), values); - } - return etype; -} - -/* enumerations from "../json-glib/json-types.h" */ -#include "../json-glib/json-types.h" -GType -json_node_type_get_type(void) { - static GType etype = 0; - if (G_UNLIKELY (!etype)) - { - const GEnumValue values[] = { - { JSON_NODE_OBJECT, "JSON_NODE_OBJECT", "object" }, - { JSON_NODE_ARRAY, "JSON_NODE_ARRAY", "array" }, - { JSON_NODE_VALUE, "JSON_NODE_VALUE", "value" }, - { JSON_NODE_NULL, "JSON_NODE_NULL", "null" }, - { 0, NULL, NULL } - }; - etype = g_enum_register_static (g_intern_static_string ("JsonNodeType"), values); - } - return etype; -} - - -/* Generated data ends here */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.c.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/*** BEGIN file-header ***/ -#include "json-enum-types.h" -/*** END file-header ***/ - -/*** BEGIN file-production ***/ - -/* enumerations from "@filename@" */ -#include "@filename@" - -/*** END file-production ***/ - -/*** BEGIN value-header ***/ -GType -@enum_name@_get_type(void) { - static volatile gsize g_enum_type_id__volatile = 0; - - if (g_once_init_enter (&g_enum_type_id__volatile)) - { - const G@Type@Value values[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, -/*** END value-production ***/ - -/*** BEGIN value-tail ***/ - { 0, NULL, NULL } - }; - GType g_enum_type_id; - - g_enum_type_id = - g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); - - g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); - } - - return g_enum_type_id__volatile; -} -/*** END value-tail ***/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ - -/* Generated data (by glib-mkenums) */ - -#ifndef __JSON_ENUM_TYPES_H__ -#define __JSON_ENUM_TYPES_H__ - -#include - -G_BEGIN_DECLS - -/* enumerations from "../json-glib/json-parser.h" */ -GType json_parser_error_get_type (void) G_GNUC_CONST; -#define JSON_TYPE_PARSER_ERROR (json_parser_error_get_type()) - -/* enumerations from "../json-glib/json-types.h" */ -GType json_node_type_get_type (void) G_GNUC_CONST; -#define JSON_TYPE_NODE_TYPE (json_node_type_get_type()) - -G_END_DECLS - -#endif /* !__JSON_ENUM_TYPES_H__ */ - -/* Generated data ends here */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-enum-types.h.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/*** BEGIN file-header ***/ -#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __JSON_ENUM_TYPES_H__ -#define __JSON_ENUM_TYPES_H__ - -#include - -G_BEGIN_DECLS - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -/*** END file-production ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* !__JSON_ENUM_TYPES_H__ */ -/*** END file-tail ***/ - -/*** BEGIN value-header ***/ -GType @enum_name@_get_type (void) G_GNUC_CONST; -#define JSON_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) - -/*** END value-header ***/ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,641 +0,0 @@ -/* json-generator.c - JSON streams generator - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -/** - * SECTION:json-generator - * @short_description: Generates JSON data streams - * - * #JsonGenerator provides an object for generating a JSON data stream and - * put it into a buffer or a file. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "json-types-private.h" - -#include "json-marshal.h" -#include "json-generator.h" - -#define JSON_GENERATOR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), JSON_TYPE_GENERATOR, JsonGeneratorPrivate)) - -struct _JsonGeneratorPrivate -{ - JsonNode *root; - - guint indent; - gunichar indent_char; - - guint pretty : 1; -}; - -enum -{ - PROP_0, - - PROP_PRETTY, - PROP_INDENT, - PROP_ROOT, - PROP_INDENT_CHAR -}; - -static gchar *dump_value (JsonGenerator *generator, - gint level, - const gchar *name, - JsonNode *node); -static gchar *dump_array (JsonGenerator *generator, - gint level, - const gchar *name, - JsonArray *array, - gsize *length); -static gchar *dump_object (JsonGenerator *generator, - gint level, - const gchar *name, - JsonObject *object, - gsize *length); - -/* non-ASCII characters can't be escaped, otherwise UTF-8 - * chars will break, so we just pregenerate this table of - * high characters and then we feed it to g_strescape() - */ -static const char json_exceptions[] = { - 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, - 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, - 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, - 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, - 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, - 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, - 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, - 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, - 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, - 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, - 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, - 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, - 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, - 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, - 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, - 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, - 0xff, - '\0' /* g_strescape() expects a NUL-terminated string */ -}; - -G_DEFINE_TYPE (JsonGenerator, json_generator, G_TYPE_OBJECT); - -static gchar * -json_strescape (const gchar *str) -{ - return g_strescape (str, json_exceptions); -} - -static void -json_generator_finalize (GObject *gobject) -{ - JsonGeneratorPrivate *priv = JSON_GENERATOR_GET_PRIVATE (gobject); - - if (priv->root) - json_node_free (priv->root); - - G_OBJECT_CLASS (json_generator_parent_class)->finalize (gobject); -} - -static void -json_generator_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - JsonGeneratorPrivate *priv = JSON_GENERATOR_GET_PRIVATE (gobject); - - switch (prop_id) - { - case PROP_PRETTY: - priv->pretty = g_value_get_boolean (value); - break; - case PROP_INDENT: - priv->indent = g_value_get_uint (value); - break; - case PROP_INDENT_CHAR: - priv->indent_char = g_value_get_uint (value); - break; - case PROP_ROOT: - json_generator_set_root (JSON_GENERATOR (gobject), - g_value_get_boxed (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -json_generator_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - JsonGeneratorPrivate *priv = JSON_GENERATOR_GET_PRIVATE (gobject); - - switch (prop_id) - { - case PROP_PRETTY: - g_value_set_boolean (value, priv->pretty); - break; - case PROP_INDENT: - g_value_set_uint (value, priv->indent); - break; - case PROP_INDENT_CHAR: - g_value_set_uint (value, priv->indent_char); - break; - case PROP_ROOT: - g_value_set_boxed (value, priv->root); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -json_generator_class_init (JsonGeneratorClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (JsonGeneratorPrivate)); - - gobject_class->set_property = json_generator_set_property; - gobject_class->get_property = json_generator_get_property; - gobject_class->finalize = json_generator_finalize; - - /** - * JsonGenerator:pretty: - * - * Whether the output should be "pretty-printed", with indentation and - * newlines. The indentation level can be controlled by using the - * JsonGenerator:indent property - */ - g_object_class_install_property (gobject_class, - PROP_PRETTY, - g_param_spec_boolean ("pretty", - "Pretty", - "Pretty-print the output", - FALSE, - G_PARAM_READWRITE)); - /** - * JsonGenerator:indent: - * - * Number of spaces to be used to indent when pretty printing. - */ - g_object_class_install_property (gobject_class, - PROP_INDENT, - g_param_spec_uint ("indent", - "Indent", - "Number of indentation spaces", - 0, G_MAXUINT, - 2, - G_PARAM_READWRITE)); - /** - * JsonGenerator:root: - * - * The root #JsonNode to be used when constructing a JSON data - * stream. - * - * Since: 0.4 - */ - g_object_class_install_property (gobject_class, - PROP_ROOT, - g_param_spec_boxed ("root", - "Root", - "Root of the JSON data tree", - JSON_TYPE_NODE, - G_PARAM_READWRITE)); - /** - * JsonGenerator:indent-char: - * - * The character that should be used when indenting in pretty print. - * - * Since: 0.6 - */ - g_object_class_install_property (gobject_class, - PROP_INDENT_CHAR, - g_param_spec_unichar ("indent-char", - "Indent Char", - "Character that should be used when indenting", - ' ', - G_PARAM_READWRITE)); -} - -static void -json_generator_init (JsonGenerator *generator) -{ - JsonGeneratorPrivate *priv; - - generator->priv = priv = JSON_GENERATOR_GET_PRIVATE (generator); - - priv->pretty = FALSE; - priv->indent = 2; - priv->indent_char = ' '; -} - -static gchar * -dump_value (JsonGenerator *generator, - gint level, - const gchar *name, - JsonNode *node) -{ - JsonGeneratorPrivate *priv = generator->priv; - gboolean pretty = priv->pretty; - guint indent = priv->indent; - GValue value = { 0, }; - GString *buffer; - - buffer = g_string_new (""); - - if (pretty) - { - guint i; - - for (i = 0; i < (level * indent); i++) - g_string_append_c (buffer, priv->indent_char); - } - - if (name && name[0] != '\0') - g_string_append_printf (buffer, "\"%s\" : ", name); - - json_node_get_value (node, &value); - - switch (G_VALUE_TYPE (&value)) - { - case G_TYPE_INT64: - g_string_append_printf (buffer, "%" G_GINT64_FORMAT, g_value_get_int64 (&value)); - break; - - case G_TYPE_STRING: - { - gchar *tmp; - - tmp = json_strescape (g_value_get_string (&value)); - g_string_append_printf (buffer, "\"%s\"", tmp); - - g_free (tmp); - } - break; - - case G_TYPE_DOUBLE: - g_string_append_printf (buffer, "%f", g_value_get_double (&value)); - break; - - case G_TYPE_BOOLEAN: - g_string_append_printf (buffer, "%s", - g_value_get_boolean (&value) ? "true" : "false"); - break; - - default: - break; - } - - g_value_unset (&value); - - return g_string_free (buffer, FALSE); -} - -static gchar * -dump_array (JsonGenerator *generator, - gint level, - const gchar *name, - JsonArray *array, - gsize *length) -{ - JsonGeneratorPrivate *priv = generator->priv; - guint array_len = json_array_get_length (array); - guint i; - GString *buffer; - gboolean pretty = priv->pretty; - guint indent = priv->indent; - - buffer = g_string_new (""); - - if (pretty) - { - for (i = 0; i < (level * indent); i++) - g_string_append_c (buffer, priv->indent_char); - } - - if (name && name[0] != '\0') - g_string_append_printf (buffer, "\"%s\" : ", name); - - g_string_append_c (buffer, '['); - - if (pretty) - g_string_append_c (buffer, '\n'); - else - g_string_append_c (buffer, ' '); - - for (i = 0; i < array_len; i++) - { - JsonNode *cur = json_array_get_element (array, i); - guint sub_level = level + 1; - guint j; - gchar *value; - - switch (JSON_NODE_TYPE (cur)) - { - case JSON_NODE_NULL: - if (pretty) - { - for (j = 0; j < (sub_level * indent); j++) - g_string_append_c (buffer, priv->indent_char); - } - g_string_append (buffer, "null"); - break; - - case JSON_NODE_VALUE: - value = dump_value (generator, sub_level, NULL, cur); - g_string_append (buffer, value); - g_free (value); - break; - - case JSON_NODE_ARRAY: - value = dump_array (generator, sub_level, NULL, json_node_get_array (cur), NULL); - g_string_append (buffer, value); - g_free (value); - break; - - case JSON_NODE_OBJECT: - value = dump_object (generator, sub_level, NULL, json_node_get_object (cur), NULL); - g_string_append (buffer, value); - g_free (value); - break; - } - - if ((i + 1) != array_len) - g_string_append_c (buffer, ','); - - if (pretty) - g_string_append_c (buffer, '\n'); - else - g_string_append_c (buffer, ' '); - } - - if (pretty) - { - for (i = 0; i < (level * indent); i++) - g_string_append_c (buffer, priv->indent_char); - } - - g_string_append_c (buffer, ']'); - - if (length) - *length = buffer->len; - - return g_string_free (buffer, FALSE); -} - -static gchar * -dump_object (JsonGenerator *generator, - gint level, - const gchar *name, - JsonObject *object, - gsize *length) -{ - JsonGeneratorPrivate *priv = generator->priv; - GList *members, *l; - GString *buffer; - gboolean pretty = priv->pretty; - guint indent = priv->indent; - guint i; - - buffer = g_string_new (""); - - if (pretty) - { - for (i = 0; i < (level * indent); i++) - g_string_append_c (buffer, priv->indent_char); - } - - if (name && name[0] != '\0') - g_string_append_printf (buffer, "\"%s\" : ", name); - - g_string_append_c (buffer, '{'); - - if (pretty) - g_string_append_c (buffer, '\n'); - else - g_string_append_c (buffer, ' '); - - members = json_object_get_members (object); - - for (l = members; l != NULL; l = l->next) - { - const gchar *member_name = l->data; - JsonNode *cur = json_object_get_member (object, member_name); - guint sub_level = level + 1; - guint j; - gchar *value; - - switch (JSON_NODE_TYPE (cur)) - { - case JSON_NODE_NULL: - if (pretty) - { - for (j = 0; j < (sub_level * indent); j++) - g_string_append_c (buffer, priv->indent_char); - } - g_string_append_printf (buffer, "\"%s\" : null", member_name); - break; - - case JSON_NODE_VALUE: - value = dump_value (generator, sub_level, member_name, cur); - g_string_append (buffer, value); - g_free (value); - break; - - case JSON_NODE_ARRAY: - value = dump_array (generator, sub_level, member_name, - json_node_get_array (cur), NULL); - g_string_append (buffer, value); - g_free (value); - break; - - case JSON_NODE_OBJECT: - value = dump_object (generator, sub_level, member_name, - json_node_get_object (cur), NULL); - g_string_append (buffer, value); - g_free (value); - break; - } - - if (l->next != NULL) - g_string_append_c (buffer, ','); - - if (pretty) - g_string_append_c (buffer, '\n'); - else - g_string_append_c (buffer, ' '); - } - - g_list_free (members); - - if (pretty) - { - for (i = 0; i < (level * indent); i++) - g_string_append_c (buffer, priv->indent_char); - } - - g_string_append_c (buffer, '}'); - - if (length) - *length = buffer->len; - - return g_string_free (buffer, FALSE); -} - -/** - * json_generator_new: - * - * Creates a new #JsonGenerator. You can use this object to generate a - * JSON data stream starting from a data object model composed by - * #JsonNodes. - * - * Return value: the newly created #JsonGenerator instance - */ -JsonGenerator * -json_generator_new (void) -{ - return g_object_new (JSON_TYPE_GENERATOR, NULL); -} - -/** - * json_generator_to_data: - * @generator: a #JsonGenerator - * @length: (out): return location for the length of the returned - * buffer, or %NULL - * - * Generates a JSON data stream from @generator and returns it as a - * buffer. - * - * Return value: a newly allocated buffer holding a JSON data stream. - * Use g_free() to free the allocated resources. - */ -gchar * -json_generator_to_data (JsonGenerator *generator, - gsize *length) -{ - JsonNode *root; - gchar *retval = NULL; - - g_return_val_if_fail (JSON_IS_GENERATOR (generator), NULL); - - root = generator->priv->root; - if (!root) - { - if (length) - *length = 0; - - return NULL; - } - - switch (JSON_NODE_TYPE (root)) - { - case JSON_NODE_ARRAY: - retval = dump_array (generator, 0, NULL, json_node_get_array (root), length); - break; - - case JSON_NODE_OBJECT: - retval = dump_object (generator, 0, NULL, json_node_get_object (root), length); - break; - - case JSON_NODE_NULL: - retval = g_strdup ("null"); - if (length) - *length = 4; - break; - - case JSON_NODE_VALUE: - retval = NULL; - break; - } - - return retval; -} - -/** - * json_generator_to_file: - * @generator: a #JsonGenerator - * @filename: path to the target file - * @error: return location for a #GError, or %NULL - * - * Creates a JSON data stream and puts it inside @filename, overwriting the - * current file contents. This operation is atomic. - * - * Return value: %TRUE if saving was successful. - */ -gboolean -json_generator_to_file (JsonGenerator *generator, - const gchar *filename, - GError **error) -{ - gchar *buffer; - gsize len; - gboolean retval; - - g_return_val_if_fail (JSON_IS_GENERATOR (generator), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - - buffer = json_generator_to_data (generator, &len); - retval = g_file_set_contents (filename, buffer, len, error); - g_free (buffer); - - return retval; -} - -/** - * json_generator_set_root: - * @generator: a #JsonGenerator - * @node: a #JsonNode - * - * Sets @node as the root of the JSON data stream to be serialized by - * the #JsonGenerator. - * - * The node is copied by the generator object, so it can be safely - * freed after calling this function. - */ -void -json_generator_set_root (JsonGenerator *generator, - JsonNode *node) -{ - g_return_if_fail (JSON_IS_GENERATOR (generator)); - - if (generator->priv->root) - { - json_node_free (generator->priv->root); - generator->priv->root = NULL; - } - - if (node) - generator->priv->root = json_node_copy (node); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-generator.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -/* json-generator.h - JSON streams generator - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) -//#error "Only can be included directly." -#endif - -#ifndef __JSON_GENERATOR_H__ -#define __JSON_GENERATOR_H__ - -#include "json-types.h" - -G_BEGIN_DECLS - -#define JSON_TYPE_GENERATOR (json_generator_get_type ()) -#define JSON_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_GENERATOR, JsonGenerator)) -#define JSON_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_GENERATOR)) -#define JSON_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_GENERATOR, JsonGeneratorClass)) -#define JSON_IS_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_GENERATOR)) -#define JSON_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_GENERATOR, JsonGeneratorClass)) - -typedef struct _JsonGenerator JsonGenerator; -typedef struct _JsonGeneratorPrivate JsonGeneratorPrivate; -typedef struct _JsonGeneratorClass JsonGeneratorClass; - -/** - * JsonGenerator: - * - * JSON data streams generator. The contents of the #JsonGenerator structure - * are private and should only be accessed via the provided API. - */ -struct _JsonGenerator -{ - /*< private >*/ - GObject parent_instance; - - JsonGeneratorPrivate *priv; -}; - -/** - * JsonGeneratorClass: - * - * #JsonGenerator class - */ -struct _JsonGeneratorClass -{ - /*< private >*/ - GObjectClass parent_class; - - /* padding, for future expansion */ - void (* _json_reserved1) (void); - void (* _json_reserved2) (void); - void (* _json_reserved3) (void); - void (* _json_reserved4) (void); -}; - -GType json_generator_get_type (void) G_GNUC_CONST; - -JsonGenerator *json_generator_new (void); -gchar * json_generator_to_data (JsonGenerator *generator, - gsize *length); -gboolean json_generator_to_file (JsonGenerator *generator, - const gchar *filename, - GError **error); -void json_generator_set_root (JsonGenerator *generator, - JsonNode *node); - -G_END_DECLS - -#endif /* __JSON_GENERATOR_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-glib.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-glib.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-glib.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-glib.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* json-glib.h: Main header - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#ifndef __JSON_GLIB_H__ -#define __JSON_GLIB_H__ - -#define __JSON_GLIB_INSIDE__ - -#include "json-types.h" -#include "json-generator.h" -#include "json-parser.h" -#include "json-version.h" -#include "json-enum-types.h" - -#include "json-gobject.h" - -#undef __JSON_GLIB_INSIDE__ - -#endif /* __JSON_GLIB_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,779 +0,0 @@ -/* json-gobject.h - JSON GObject integration - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * Author: - * Emmanuele Bassi - */ - -/** - * SECTION:json-gobject - * @short_description: Serialize and deserialize GObjects - * - * JSON-GLib provides API for serializing and deserializing #GObjects - * to and from JSON data streams. - * - * Simple #GObject classes can be (de)serialized into JSON objects, if the - * properties have compatible types with the native JSON types (integers, - * booleans, strings, string vectors). If the class to be (de)serialized has - * complex data types for properties (like boxed types or other objects) - * then the class should implement the provided #JsonSerializable interface - * and its virtual functions. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include "json-types-private.h" - -#include "json-gobject.h" -#include "json-parser.h" -#include "json-generator.h" - -static gboolean -enum_from_string (GType type, - const gchar *string, - gint *enum_value) -{ - GEnumClass *eclass; - GEnumValue *ev; - gchar *endptr; - gint value; - gboolean retval = TRUE; - - g_return_val_if_fail (G_TYPE_IS_ENUM (type), 0); - g_return_val_if_fail (string != NULL, 0); - - value = strtoul (string, &endptr, 0); - if (endptr != string) /* parsed a number */ - *enum_value = value; - else - { - eclass = g_type_class_ref (type); - ev = g_enum_get_value_by_name (eclass, string); - if (!ev) - ev = g_enum_get_value_by_nick (eclass, string); - - if (ev) - *enum_value = ev->value; - else - retval = FALSE; - - g_type_class_unref (eclass); - } - - return retval; -} - -static gboolean -flags_from_string (GType type, - const gchar *string, - gint *flags_value) -{ - GFlagsClass *fclass; - gchar *endptr, *prevptr; - guint i, j, ret, value; - gchar *flagstr; - GFlagsValue *fv; - const gchar *flag; - gunichar ch; - gboolean eos; - - g_return_val_if_fail (G_TYPE_IS_FLAGS (type), 0); - g_return_val_if_fail (string != 0, 0); - - ret = TRUE; - - value = strtoul (string, &endptr, 0); - if (endptr != string) /* parsed a number */ - *flags_value = value; - else - { - fclass = g_type_class_ref (type); - - flagstr = g_strdup (string); - for (value = i = j = 0; ; i++) - { - eos = flagstr[i] == '\0'; - - if (!eos && flagstr[i] != '|') - continue; - - flag = &flagstr[j]; - endptr = &flagstr[i]; - - if (!eos) - { - flagstr[i++] = '\0'; - j = i; - } - - /* trim spaces */ - for (;;) - { - ch = g_utf8_get_char (flag); - if (!g_unichar_isspace (ch)) - break; - flag = g_utf8_next_char (flag); - } - - while (endptr > flag) - { - prevptr = g_utf8_prev_char (endptr); - ch = g_utf8_get_char (prevptr); - if (!g_unichar_isspace (ch)) - break; - endptr = prevptr; - } - - if (endptr > flag) - { - *endptr = '\0'; - fv = g_flags_get_value_by_name (fclass, flag); - - if (!fv) - fv = g_flags_get_value_by_nick (fclass, flag); - - if (fv) - value |= fv->value; - else - { - ret = FALSE; - break; - } - } - - if (eos) - { - *flags_value = value; - break; - } - } - - g_free (flagstr); - - g_type_class_unref (fclass); - } - - return ret; -} - -static gboolean -json_deserialize_pspec (GValue *value, - GParamSpec *pspec, - JsonNode *node) -{ - GValue node_value = { 0, }; - gboolean retval = FALSE; - - switch (JSON_NODE_TYPE (node)) - { - case JSON_NODE_OBJECT: - return FALSE; - - case JSON_NODE_ARRAY: - if (G_VALUE_HOLDS (value, G_TYPE_STRV)) - { - JsonArray *array = json_node_get_array (node); - guint i, array_len = json_array_get_length (array); - GPtrArray *str_array = g_ptr_array_sized_new (array_len + 1); - - for (i = 0; i < array_len; i++) - { - JsonNode *val = json_array_get_element (array, i); - - if (JSON_NODE_TYPE (val) != JSON_NODE_VALUE) - continue; - - if (json_node_get_string (val) != NULL); - g_ptr_array_add (str_array, (gpointer) json_node_get_string (val)); - } - - g_ptr_array_add (str_array, NULL); - - g_value_set_boxed (value, str_array->pdata); - - g_ptr_array_free (str_array, TRUE); - - retval = TRUE; - } - break; - - case JSON_NODE_VALUE: - json_node_get_value (node, &node_value); -#if 0 - { - gchar *node_str = g_strdup_value_contents (&node_value); - g_debug ("%s: value type '%s' := node value type '%s' -> '%s'", - G_STRLOC, - g_type_name (G_VALUE_TYPE (value)), - g_type_name (G_VALUE_TYPE (&node_value)), - node_str); - g_free (node_str); - } -#endif - - switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value))) - { - case G_TYPE_BOOLEAN: - case G_TYPE_INT64: - case G_TYPE_DOUBLE: - case G_TYPE_STRING: - g_value_copy (&node_value, value); - retval = TRUE; - break; - - case G_TYPE_INT: - g_value_set_int (value, (gint) g_value_get_int64 (&node_value)); - retval = TRUE; - break; - - case G_TYPE_CHAR: - g_value_set_char (value, (gchar) g_value_get_int64 (&node_value)); - retval = TRUE; - break; - - case G_TYPE_UINT: - g_value_set_uint (value, (guint) g_value_get_int64 (&node_value)); - retval = TRUE; - break; - - case G_TYPE_UCHAR: - g_value_set_uchar (value, (guchar) g_value_get_int64 (&node_value)); - retval = TRUE; - break; - - case G_TYPE_FLOAT: - g_value_set_float (value, (gfloat) g_value_get_double (&node_value)); - retval = TRUE; - break; - - case G_TYPE_ENUM: - { - gint enum_value; - - if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64)) - { - enum_value = g_value_get_int64 (&node_value); - retval = TRUE; - } - else if (G_VALUE_HOLDS (&node_value, G_TYPE_STRING)) - { - retval = enum_from_string (G_VALUE_TYPE (value), - g_value_get_string (&node_value), - &enum_value); - } - - if (retval) - g_value_set_enum (value, enum_value); - } - break; - - case G_TYPE_FLAGS: - { - gint flags_value; - - if (G_VALUE_HOLDS (&node_value, G_TYPE_INT64)) - { - flags_value = g_value_get_int64 (&node_value); - retval = TRUE; - } - else if (G_VALUE_HOLDS (&node_value, G_TYPE_STRING)) - { - retval = flags_from_string (G_VALUE_TYPE (value), - g_value_get_string (&node_value), - &flags_value); - } - - if (retval) - g_value_set_flags (value, flags_value); - } - break; - - default: - retval = FALSE; - break; - } - - g_value_unset (&node_value); - break; - - case JSON_NODE_NULL: - retval = FALSE; - break; - } - - return retval; -} - -static JsonNode * -json_serialize_pspec (const GValue *real_value, - GParamSpec *pspec) -{ - JsonNode *retval = NULL; - GValue value = { 0, }; - - switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (real_value))) - { - case G_TYPE_INT64: - case G_TYPE_BOOLEAN: - case G_TYPE_DOUBLE: - /* JSON native types */ - retval = json_node_new (JSON_NODE_VALUE); - g_value_init (&value, G_VALUE_TYPE (real_value)); - g_value_copy (real_value, &value); - json_node_set_value (retval, &value); - g_value_unset (&value); - break; - - case G_TYPE_STRING: - /* strings might be NULL */ - if (!g_value_get_string (real_value)) - retval = json_node_new (JSON_NODE_NULL); - else - { - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_string (retval, g_value_get_string (real_value)); - break; - } - break; - - case G_TYPE_INT: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_int (real_value)); - break; - - case G_TYPE_FLOAT: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_double (retval, g_value_get_float (real_value)); - break; - - case G_TYPE_BOXED: - if (G_VALUE_HOLDS (real_value, G_TYPE_STRV)) - { - gchar **strv = g_value_get_boxed (real_value); - gint i, strv_len; - JsonArray *array; - - strv_len = g_strv_length (strv); - array = json_array_sized_new (strv_len); - - for (i = 0; i < strv_len; i++) - { - JsonNode *str = json_node_new (JSON_NODE_VALUE); - - json_node_set_string (str, strv[i]); - json_array_add_element (array, str); - } - - retval = json_node_new (JSON_NODE_ARRAY); - json_node_take_array (retval, array); - } - else - { - g_warning ("Unsupported type `%s'", - g_type_name (G_VALUE_TYPE (real_value))); - } - break; - - case G_TYPE_UINT: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_uint (real_value)); - break; - - case G_TYPE_LONG: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_long (real_value)); - break; - - case G_TYPE_ULONG: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_long (real_value)); - break; - - case G_TYPE_CHAR: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_char (real_value)); - break; - - case G_TYPE_UCHAR: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_uchar (real_value)); - break; - - case G_TYPE_ENUM: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_enum (real_value)); - break; - - case G_TYPE_FLAGS: - retval = json_node_new (JSON_NODE_VALUE); - json_node_set_int (retval, g_value_get_flags (real_value)); - break; - - case G_TYPE_NONE: - retval = json_node_new (JSON_NODE_NULL); - break; - - default: - g_warning ("Unsupported type `%s'", - g_type_name (G_VALUE_TYPE (real_value))); - break; - } - - return retval; -} - -/** - * json_serializable_serialize_property: - * @serializable: a #JsonSerializable object - * @property_name: the name of the property - * @value: the value of the property - * @pspec: a #GParamSpec - * - * Asks a #JsonSerializable implementation to serialize a #GObject - * property into a #JsonNode object. - * - * Return value: a #JsonNode containing the serialized property - */ -JsonNode * -json_serializable_serialize_property (JsonSerializable *serializable, - const gchar *property_name, - const GValue *value, - GParamSpec *pspec) -{ - JsonSerializableIface *iface; - - g_return_val_if_fail (JSON_IS_SERIALIZABLE (serializable), NULL); - g_return_val_if_fail (property_name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - g_return_val_if_fail (pspec != NULL, NULL); - - iface = JSON_SERIALIZABLE_GET_IFACE (serializable); - - return iface->serialize_property (serializable, property_name, value, pspec); -} - -/** - * json_serializable_deserialize_property: - * @serializable: a #JsonSerializable - * @property_name: the name of the property - * @value: a pointer to an uninitialized #GValue - * @pspec: a #GParamSpec - * @property_node: a #JsonNode containing the serialized property - * - * Asks a #JsonSerializable implementation to deserialize the - * property contained inside @property_node into @value. - * - * Return value: %TRUE if the property was successfully deserialized. - */ -gboolean -json_serializable_deserialize_property (JsonSerializable *serializable, - const gchar *property_name, - GValue *value, - GParamSpec *pspec, - JsonNode *property_node) -{ - JsonSerializableIface *iface; - - g_return_val_if_fail (JSON_IS_SERIALIZABLE (serializable), FALSE); - g_return_val_if_fail (property_name != NULL, FALSE); - g_return_val_if_fail (value != NULL, FALSE); - g_return_val_if_fail (pspec != NULL, FALSE); - g_return_val_if_fail (property_node != NULL, FALSE); - - iface = JSON_SERIALIZABLE_GET_IFACE (serializable); - - return iface->deserialize_property (serializable, - property_name, - value, - pspec, - property_node); -} - -static gboolean -json_serializable_real_deserialize (JsonSerializable *serializable, - const gchar *name, - GValue *value, - GParamSpec *pspec, - JsonNode *node) -{ - return json_deserialize_pspec (value, pspec, node); -} - -static JsonNode * -json_serializable_real_serialize (JsonSerializable *serializable, - const gchar *name, - const GValue *value, - GParamSpec *pspec) -{ - return json_serialize_pspec (value, pspec); -} - -static void -json_serializable_base_init (gpointer g_class, - gpointer data) -{ - static gboolean is_initialized = FALSE; - - if (G_UNLIKELY (!is_initialized)) - { - JsonSerializableIface *iface = g_class; - - iface->serialize_property = json_serializable_real_serialize; - iface->deserialize_property = json_serializable_real_deserialize; - - is_initialized = TRUE; - } -} - -GType -json_serializable_get_type (void) -{ - static GType iface_type = 0; - - if (!iface_type) - iface_type = - g_type_register_static_simple (G_TYPE_INTERFACE, - g_intern_static_string ("JsonSerializable"), - sizeof (JsonSerializableIface), - json_serializable_base_init, - 0, NULL, 0); - - return iface_type; -} - -/** - * json_construct_gobject: - * @gtype: the #GType of object to construct - * @data: a JSON data stream - * @length: length of the data stream, or -1 if it is NUL-terminated - * @error: return location for a #GError, or %NULL - * - * Deserializes a JSON data stream and creates the corresponding - * #GObject class. If @gtype implements the #JsonSerializableIface - * interface, it will be asked to deserialize all the JSON members - * into the respective properties; otherwise, the default implementation - * will be used to translate the compatible JSON native types. - * - * Note: the JSON data stream must be an object declaration. - * - * Return value: a #GObject or %NULL - * - * Since: 0.4 - */ -GObject * -json_construct_gobject (GType gtype, - const gchar *data, - gsize length, - GError **error) -{ - JsonSerializableIface *iface = NULL; - JsonSerializable *serializable = NULL; - gboolean deserialize_property; - JsonParser *parser; - JsonNode *root; - JsonObject *object; - GError *parse_error; - GList *members, *l; - guint n_members; - GObjectClass *klass; - GObject *retval; - - g_return_val_if_fail (gtype != G_TYPE_INVALID, NULL); - g_return_val_if_fail (data != NULL, NULL); - - if (length < 0) - length = strlen (data); - - parser = json_parser_new (); - - parse_error = NULL; - json_parser_load_from_data (parser, data, length, &parse_error); - if (parse_error) - { - g_propagate_error (error, parse_error); - g_object_unref (parser); - return NULL; - } - - root = json_parser_get_root (parser); - if (root == NULL || JSON_NODE_TYPE (root) != JSON_NODE_OBJECT) - { - g_set_error (error, JSON_PARSER_ERROR, - JSON_PARSER_ERROR_PARSE, - "Expecting a JSON object, but the root node " - "is of type `%s'", - json_node_type_name (root)); - g_object_unref (parser); - return NULL; - } - - klass = g_type_class_ref (gtype); - retval = g_object_new (gtype, NULL); - - if (g_type_is_a (gtype, JSON_TYPE_SERIALIZABLE)) - { - serializable = JSON_SERIALIZABLE (retval); - iface = JSON_SERIALIZABLE_GET_IFACE (serializable); - deserialize_property = (iface->deserialize_property != NULL); - } - else - deserialize_property = FALSE; - - object = json_node_get_object (root); - - g_object_freeze_notify (retval); - - n_members = json_object_get_size (object); - members = json_object_get_members (object); - - for (l = members; l != NULL; l = l->next) - { - const gchar *member_name = l->data; - GParamSpec *pspec; - JsonNode *val; - GValue value = { 0, }; - gboolean res = FALSE; - - pspec = g_object_class_find_property (klass, member_name); - if (!pspec) - continue; - - if (pspec->flags & G_PARAM_CONSTRUCT_ONLY) - continue; - - if (!(pspec->flags & G_PARAM_WRITABLE)) - continue; - - g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - - val = json_object_get_member (object, member_name); - - if (deserialize_property) - { - res = iface->deserialize_property (serializable, pspec->name, - &value, - pspec, - val); - } - - if (!res) - res = json_deserialize_pspec (&value, pspec, val); - - if (res) - g_object_set_property (retval, pspec->name, &value); - - g_value_unset (&value); - } - - g_list_free (members); - - g_object_thaw_notify (retval); - - g_type_class_unref (klass); - g_object_unref (parser); - - return retval; -} - -/** - * json_serialize_gobject: - * @gobject: a #GObject - * @length: (out): return value for the length of the buffer, or %NULL - * - * Serializes a #GObject into a JSON data stream. If @gobject implements - * the #JsonSerializableIface interface, it will be asked to serizalize all - * its properties; otherwise, the default implementation will be use to - * translate the compatible types into JSON native types. - * - * Return value: a JSON data stream representing the passed #GObject - */ -gchar * -json_serialize_gobject (GObject *gobject, - gsize *length) -{ - JsonSerializableIface *iface = NULL; - JsonSerializable *serializable = NULL; - gboolean serialize_property = FALSE; - JsonGenerator *gen; - JsonNode *root; - JsonObject *object; - GParamSpec **pspecs; - guint n_pspecs, i; - gchar *data; - - g_return_val_if_fail (G_OBJECT (gobject), NULL); - - if (JSON_IS_SERIALIZABLE (gobject)) - { - serializable = JSON_SERIALIZABLE (gobject); - iface = JSON_SERIALIZABLE_GET_IFACE (gobject); - serialize_property = (iface->serialize_property != NULL); - } - - object = json_object_new (); - - root = json_node_new (JSON_NODE_OBJECT); - json_node_take_object (root, object); - - pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (gobject), - &n_pspecs); - for (i = 0; i < n_pspecs; i++) - { - GParamSpec *pspec = pspecs[i]; - GValue value = { 0, }; - JsonNode *node = NULL; - - /* read only what we can */ - if (!(pspec->flags & G_PARAM_READABLE)) - continue; - - g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - g_object_get_property (gobject, pspec->name, &value); - - if (serialize_property) - { - node = iface->serialize_property (serializable, pspec->name, - &value, - pspec); - } - - if (!node) - node = json_serialize_pspec (&value, pspec); - - if (node) - json_object_set_member (object, pspec->name, node); - - g_value_unset (&value); - } - - g_free (pspecs); - - gen = g_object_new (JSON_TYPE_GENERATOR, - "root", root, - "pretty", TRUE, - "indent", 2, - NULL); - - data = json_generator_to_data (gen, length); - g_object_unref (gen); - json_node_free (root); - - return data; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-gobject.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/* json-gobject.h - JSON GObject integration - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#ifndef __JSON_GOBJECT_H__ -#define __JSON_GOBJECT_H__ - -#include "json-types.h" -#include - -G_BEGIN_DECLS - -#define JSON_TYPE_SERIALIZABLE (json_serializable_get_type ()) -#define JSON_SERIALIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_SERIALIZABLE, JsonSerializable)) -#define JSON_IS_SERIALIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_SERIALIZABLE)) -#define JSON_SERIALIZABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), JSON_TYPE_SERIALIZABLE, JsonSerializableIface)) - -typedef struct _JsonSerializable JsonSerializable; /* dummy */ -typedef struct _JsonSerializableIface JsonSerializableIface; - -/** - * JsonSerializableIface: - * @serialize_property: virtual function for serializing a #GObject property - * into a #JsonNode - * @deserialize_property: virtual function for deserializing a #JsonNode - * into a #GObject property - * - * Interface that allows serializing and deserializing #GObjects - * with properties storing complex data types. The json_serialize_gobject() - * function will check if the passed #GObject implements this interface, - * so it can also be used to override the default property serialization - * sequence. - */ -struct _JsonSerializableIface -{ - /*< private >*/ - GTypeInterface g_iface; - - /*< public >*/ - JsonNode *(* serialize_property) (JsonSerializable *serializable, - const gchar *property_name, - const GValue *value, - GParamSpec *pspec); - gboolean (* deserialize_property) (JsonSerializable *serializable, - const gchar *property_name, - GValue *value, - GParamSpec *pspec, - JsonNode *property_node); -}; - -GType json_serializable_get_type (void) G_GNUC_CONST; - -JsonNode *json_serializable_serialize_property (JsonSerializable *serializable, - const gchar *property_name, - const GValue *value, - GParamSpec *pspec); -gboolean json_serializable_deserialize_property (JsonSerializable *serializable, - const gchar *property_name, - GValue *value, - GParamSpec *pspec, - JsonNode *property_node); - - -GObject *json_construct_gobject (GType gtype, - const gchar *data, - gsize length, - GError **error); -gchar * json_serialize_gobject (GObject *gobject, - gsize *length) G_GNUC_MALLOC; - -G_END_DECLS - -#endif /* __JSON_GOBJECT_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -#include "json-marshal.h" - -#include - - -#ifdef G_ENABLE_DEBUG -#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) -#define g_marshal_value_peek_char(v) g_value_get_char (v) -#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) -#define g_marshal_value_peek_int(v) g_value_get_int (v) -#define g_marshal_value_peek_uint(v) g_value_get_uint (v) -#define g_marshal_value_peek_long(v) g_value_get_long (v) -#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) -#define g_marshal_value_peek_int64(v) g_value_get_int64 (v) -#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) -#define g_marshal_value_peek_enum(v) g_value_get_enum (v) -#define g_marshal_value_peek_flags(v) g_value_get_flags (v) -#define g_marshal_value_peek_float(v) g_value_get_float (v) -#define g_marshal_value_peek_double(v) g_value_get_double (v) -#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) -#define g_marshal_value_peek_param(v) g_value_get_param (v) -#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) -#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) -#define g_marshal_value_peek_object(v) g_value_get_object (v) -#else /* !G_ENABLE_DEBUG */ -/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. - * Do not access GValues directly in your code. Instead, use the - * g_value_get_*() functions - */ -#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int -#define g_marshal_value_peek_char(v) (v)->data[0].v_int -#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint -#define g_marshal_value_peek_int(v) (v)->data[0].v_int -#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint -#define g_marshal_value_peek_long(v) (v)->data[0].v_long -#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 -#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 -#define g_marshal_value_peek_enum(v) (v)->data[0].v_long -#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong -#define g_marshal_value_peek_float(v) (v)->data[0].v_float -#define g_marshal_value_peek_double(v) (v)->data[0].v_double -#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer -#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer -#endif /* !G_ENABLE_DEBUG */ - - -/* VOID:VOID (./json-marshal.list:1) */ - -/* VOID:BOXED (./json-marshal.list:2) */ - -/* VOID:BOXED,STRING (./json-marshal.list:3) */ -void -_json_marshal_VOID__BOXED_STRING (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__BOXED_STRING) (gpointer data1, - gpointer arg_1, - gpointer arg_2, - gpointer data2); - register GMarshalFunc_VOID__BOXED_STRING callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__BOXED_STRING) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_boxed (param_values + 1), - g_marshal_value_peek_string (param_values + 2), - data2); -} - -/* VOID:BOXED,INT (./json-marshal.list:4) */ -void -_json_marshal_VOID__BOXED_INT (GClosure *closure, - GValue *return_value G_GNUC_UNUSED, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint G_GNUC_UNUSED, - gpointer marshal_data) -{ - typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, - gpointer arg_1, - gint arg_2, - gpointer data2); - register GMarshalFunc_VOID__BOXED_INT callback; - register GCClosure *cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__BOXED_INT) (marshal_data ? marshal_data : cc->callback); - - callback (data1, - g_marshal_value_peek_boxed (param_values + 1), - g_marshal_value_peek_int (param_values + 2), - data2); -} - -/* VOID:POINTER (./json-marshal.list:5) */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ - -#ifndef ___json_marshal_MARSHAL_H__ -#define ___json_marshal_MARSHAL_H__ - -#include - -G_BEGIN_DECLS - -/* VOID:VOID (./json-marshal.list:1) */ -#define _json_marshal_VOID__VOID g_cclosure_marshal_VOID__VOID - -/* VOID:BOXED (./json-marshal.list:2) */ -#define _json_marshal_VOID__BOXED g_cclosure_marshal_VOID__BOXED - -/* VOID:BOXED,STRING (./json-marshal.list:3) */ -extern void _json_marshal_VOID__BOXED_STRING (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:BOXED,INT (./json-marshal.list:4) */ -extern void _json_marshal_VOID__BOXED_INT (GClosure *closure, - GValue *return_value, - guint n_param_values, - const GValue *param_values, - gpointer invocation_hint, - gpointer marshal_data); - -/* VOID:POINTER (./json-marshal.list:5) */ -#define _json_marshal_VOID__POINTER g_cclosure_marshal_VOID__POINTER - -G_END_DECLS - -#endif /* ___json_marshal_MARSHAL_H__ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.list qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.list --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.list 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-marshal.list 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -VOID:VOID -VOID:BOXED -VOID:BOXED,STRING -VOID:BOXED,INT -VOID:POINTER diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-node.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-node.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-node.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-node.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,788 +0,0 @@ -/* json-node.c - JSON object model node - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "json-types-private.h" - -/** - * SECTION:json-node - * @short_description: Node in a JSON object model - * - * A #JsonNode is a generic container of elements inside a JSON stream. - * It can contain fundamental types (integers, booleans, floating point - * numbers, strings) and complex types (arrays and objects). - * - * When parsing a JSON data stream you extract the root node and walk - * the node tree by retrieving the type of data contained inside the - * node with the %JSON_NODE_TYPE macro. If the node contains a fundamental - * type you can retrieve a copy of the #GValue holding it with the - * json_node_get_value() function, and then use the #GValue API to extract - * the data; if the node contains a complex type you can retrieve the - * #JsonObject or the #JsonArray using json_node_get_object() or - * json_node_get_array() respectively, and then retrieve the nodes - * they contain. - */ - -GType -json_node_get_type (void) -{ - static GType node_type = 0; - - if (G_UNLIKELY (node_type == 0)) - node_type = g_boxed_type_register_static (g_intern_static_string ("JsonNode"), - (GBoxedCopyFunc) json_node_copy, - (GBoxedFreeFunc) json_node_free); - - return node_type; -} - -/** - * json_node_get_value_type: - * @node: a #JsonNode - * - * Returns the #GType of the payload of the node. - * - * Return value: a #GType for the payload. - * - * Since: 0.4 - */ -GType -json_node_get_value_type (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, G_TYPE_INVALID); - - switch (node->type) - { - case JSON_NODE_OBJECT: - return JSON_TYPE_OBJECT; - - case JSON_NODE_ARRAY: - return JSON_TYPE_ARRAY; - - case JSON_NODE_NULL: - return G_TYPE_INVALID; - - case JSON_NODE_VALUE: - return G_VALUE_TYPE (&(node->data.value)); - - default: - g_assert_not_reached (); - return G_TYPE_INVALID; - } -} - -/** - * json_node_new: - * @type: a #JsonNodeType - * - * Creates a new #JsonNode of @type. - * - * Return value: the newly created #JsonNode - */ -JsonNode * -json_node_new (JsonNodeType type) -{ - JsonNode *data; - - g_return_val_if_fail (type >= JSON_NODE_OBJECT && - type <= JSON_NODE_NULL, NULL); - - data = g_slice_new0 (JsonNode); - data->type = type; - - return data; -} - -/** - * json_node_copy: - * @node: a #JsonNode - * - * Copies @node. If the node contains complex data types then the reference - * count of the objects is increased. - * - * Return value: the copied #JsonNode - */ -JsonNode * -json_node_copy (JsonNode *node) -{ - JsonNode *copy; - - g_return_val_if_fail (node != NULL, NULL); - - copy = g_slice_new0 (JsonNode); - copy->type = node->type; - - switch (copy->type) - { - case JSON_NODE_OBJECT: - if (node->data.object) - copy->data.object = json_object_ref (node->data.object); - break; - - case JSON_NODE_ARRAY: - if (node->data.array) - copy->data.array = json_array_ref (node->data.array); - break; - - case JSON_NODE_VALUE: - if (G_VALUE_TYPE (&(node->data.value)) != G_TYPE_INVALID) - { - g_value_init (&(copy->data.value), G_VALUE_TYPE (&(node->data.value))); - g_value_copy (&(node->data.value), &(copy->data.value)); - } - break; - - case JSON_NODE_NULL: - break; - - default: - g_assert_not_reached (); - } - - return copy; -} - -/** - * json_node_set_object: - * @node: a #JsonNode - * @object: a #JsonObject - * - * Sets @objects inside @node. The reference count of @object is increased. - */ -void -json_node_set_object (JsonNode *node, - JsonObject *object) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_OBJECT); - - if (node->data.object) - json_object_unref (node->data.object); - - if (object) - node->data.object = json_object_ref (object); - else - node->data.object = NULL; -} - -/** - * json_node_take_object: - * @node: a #JsonNode - * @object: a #JsonObject - * - * Sets @object inside @node. The reference count of @object is not increased. - */ -void -json_node_take_object (JsonNode *node, - JsonObject *object) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_OBJECT); - - if (node->data.object) - { - json_object_unref (node->data.object); - node->data.object = NULL; - } - - if (object) - node->data.object = object; -} - -/** - * json_node_get_object: - * @node: a #JsonNode - * - * Retrieves the #JsonObject stored inside a #JsonNode - * - * Return value: the #JsonObject - */ -JsonObject * -json_node_get_object (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_OBJECT, NULL); - - return node->data.object; -} - -/** - * json_node_dup_object: - * @node: a #JsonNode - * - * Retrieves the #JsonObject inside @node. The reference count of - * the returned object is increased. - * - * Return value: the #JsonObject - */ -JsonObject * -json_node_dup_object (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_OBJECT, NULL); - - if (node->data.object) - return json_object_ref (node->data.object); - - return NULL; -} - -/** - * json_node_set_array: - * @node: a #JsonNode - * @array: a #JsonArray - * - * Sets @array inside @node and increases the #JsonArray reference count - */ -void -json_node_set_array (JsonNode *node, - JsonArray *array) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_ARRAY); - - if (node->data.array) - json_array_unref (node->data.array); - - if (array) - node->data.array = json_array_ref (array); - else - node->data.array = NULL; -} - -/** - * json_node_take_array: - * @node: a #JsonNode - * @array: a #JsonArray - * - * Sets @array into @node without increasing the #JsonArray reference count. - */ -void -json_node_take_array (JsonNode *node, - JsonArray *array) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_ARRAY); - - if (node->data.array) - { - json_array_unref (node->data.array); - node->data.array = NULL; - } - - if (array) - node->data.array = array; -} - -/** - * json_node_get_array: - * @node: a #JsonNode - * - * Retrieves the #JsonArray stored inside a #JsonNode - * - * Return value: the #JsonArray - */ -JsonArray * -json_node_get_array (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_ARRAY, NULL); - - return node->data.array; -} - -/** - * json_node_dup_array - * @node: a #JsonNode - * - * Retrieves the #JsonArray stored inside a #JsonNode and returns it - * with its reference count increased by one. - * - * Return value: the #JsonArray with its reference count increased. - */ -JsonArray * -json_node_dup_array (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_ARRAY, NULL); - - if (node->data.array) - return json_array_ref (node->data.array); - - return NULL; -} - -/** - * json_node_get_value: - * @node: a #JsonNode - * @value: return location for an uninitialized value - * - * Retrieves a value from a #JsonNode and copies into @value. When done - * using it, call g_value_unset() on the #GValue. - */ -void -json_node_get_value (JsonNode *node, - GValue *value) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE); - - if (G_VALUE_TYPE (&(node->data.value)) != G_TYPE_INVALID) - { - g_value_init (value, G_VALUE_TYPE (&(node->data.value))); - g_value_copy (&(node->data.value), value); - } -} - -static void inline -node_value_unset (JsonNode *node) -{ - if (G_VALUE_TYPE (&(node->data.value)) != G_TYPE_INVALID) - g_value_unset (&(node->data.value)); -} - -/** - * json_node_set_value: - * @node: a #JsonNode - * @value: the #GValue to set - * - * Sets @value inside @node. The passed #GValue is copied into the #JsonNode - */ -void -json_node_set_value (JsonNode *node, - const GValue *value) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE); - g_return_if_fail (G_VALUE_TYPE (value) != G_TYPE_INVALID); - - switch (G_VALUE_TYPE (value)) - { - /* direct copy for the types we use */ - case G_TYPE_INT64: - case G_TYPE_BOOLEAN: - case G_TYPE_DOUBLE: - case G_TYPE_STRING: - node_value_unset (node); - g_value_init (&(node->data.value), G_VALUE_TYPE (value)); - g_value_copy (value, &(node->data.value)); - break; - - /* auto-promote ints to long longs */ - case G_TYPE_INT: - node_value_unset (node); - g_value_init (&(node->data.value), G_TYPE_INT64); - g_value_set_int64 (&(node->data.value), - g_value_get_int (value)); - break; - - /* auto-promote single precision to double precision */ - case G_TYPE_FLOAT: - node_value_unset (node); - g_value_init (&(node->data.value), G_TYPE_DOUBLE); - g_value_set_double (&(node->data.value), - g_value_get_float (value)); - break; - - default: - g_warning ("Invalid value of type '%s'", - g_type_name (G_VALUE_TYPE (value))); - return; - } - -} - -/** - * json_node_free: - * @node: a #JsonNode - * - * Frees the resources allocated by @node. - */ -void -json_node_free (JsonNode *node) -{ - if (G_LIKELY (node)) - { - switch (node->type) - { - case JSON_NODE_OBJECT: - if (node->data.object) - json_object_unref (node->data.object); - break; - - case JSON_NODE_ARRAY: - if (node->data.array) - json_array_unref (node->data.array); - break; - - case JSON_NODE_VALUE: - g_value_unset (&(node->data.value)); - break; - - case JSON_NODE_NULL: - break; - } - - g_slice_free (JsonNode, node); - } -} - -/** - * json_node_type_name: - * @node: a #JsonNode - * - * Retrieves the user readable name of the data type contained by @node. - * - * Return value: a string containing the name of the type. The returned string - * is owned by the node and should never be modified or freed - */ -G_CONST_RETURN gchar * -json_node_type_name (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, "(null)"); - - switch (node->type) - { - case JSON_NODE_OBJECT: - return "JsonObject"; - - case JSON_NODE_ARRAY: - return "JsonArray"; - - case JSON_NODE_NULL: - return "NULL"; - - case JSON_NODE_VALUE: - return g_type_name (G_VALUE_TYPE (&(node->data.value))); - } - - return "unknown"; -} - -/** - * json_node_set_parent: - * @node: a #JsonNode - * @parent: the parent #JsonNode of @node - * - * Sets the parent #JsonNode of @node - * - * Since: 0.8 - */ -void -json_node_set_parent (JsonNode *node, - JsonNode *parent) -{ - g_return_if_fail (node != NULL); - - node->parent = parent; -} - -/** - * json_node_get_parent: - * @node: a #JsonNode - * - * Retrieves the parent #JsonNode of @node. - * - * Return value: the parent node, or %NULL if @node is the root node - */ -JsonNode * -json_node_get_parent (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - - return node->parent; -} - -/** - * json_node_set_string: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * @value: a string value - * - * Sets @value as the string content of the @node, replacing any existing - * content. - */ -void -json_node_set_string (JsonNode *node, - const gchar *value) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE); - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_STRING) - g_value_set_string (&(node->data.value), value); - else - { - GValue copy = { 0, }; - - g_value_init (©, G_TYPE_STRING); - g_value_set_string (©, value); - - json_node_set_value (node, ©); - - g_value_unset (©); - } -} - -/** - * json_node_get_string: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * - * Gets the string value stored inside a #JsonNode - * - * Return value: a string value. - */ -G_CONST_RETURN gchar * -json_node_get_string (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - - if (JSON_NODE_TYPE (node) == JSON_NODE_NULL) - return NULL; - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_STRING) - return g_value_get_string (&(node->data.value)); - - return NULL; -} - -/** - * json_node_dup_string: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * - * Gets a copy of the string value stored inside a #JsonNode - * - * Return value: a newly allocated string containing a copy of - * the #JsonNode contents - */ -gchar * -json_node_dup_string (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, NULL); - - if (JSON_NODE_TYPE (node) == JSON_NODE_NULL) - return NULL; - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_STRING) - return g_value_dup_string (&(node->data.value)); - - return NULL; -} - -/** - * json_node_set_int: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * @value: an integer value - * - * Sets @value as the integer content of the @node, replacing any existing - * content. - */ -void -json_node_set_int (JsonNode *node, - gint64 value) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE); - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_INT64) - g_value_set_int64 (&(node->data.value), value); - else - { - GValue copy = { 0, }; - - g_value_init (©, G_TYPE_INT64); - g_value_set_int64 (©, value); - - json_node_set_value (node, ©); - - g_value_unset (©); - } -} - -/** - * json_node_get_int: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * - * Gets the integer value stored inside a #JsonNode - * - * Return value: an integer value. - */ -gint64 -json_node_get_int (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, 0); - - if (JSON_NODE_TYPE (node) == JSON_NODE_NULL) - return 0; - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_INT64) - return g_value_get_int64 (&(node->data.value)); - - return 0; -} - -/** - * json_node_set_double: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * @value: a double value - * - * Sets @value as the double content of the @node, replacing any existing - * content. - */ -void -json_node_set_double (JsonNode *node, - gdouble value) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE); - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_DOUBLE) - g_value_set_double (&(node->data.value), value); - else - { - GValue copy = { 0, }; - - g_value_init (©, G_TYPE_DOUBLE); - g_value_set_double (©, value); - - json_node_set_value (node, ©); - - g_value_unset (©); - } -} - -/** - * json_node_get_double: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * - * Gets the double value stored inside a #JsonNode - * - * Return value: a double value. - */ -gdouble -json_node_get_double (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, 0.0); - - if (JSON_NODE_TYPE (node) == JSON_NODE_NULL) - return 0; - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_DOUBLE) - return g_value_get_double (&(node->data.value)); - - return 0.0; -} - -/** - * json_node_set_boolean: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * @value: a boolean value - * - * Sets @value as the boolean content of the @node, replacing any existing - * content. - */ -void -json_node_set_boolean (JsonNode *node, - gboolean value) -{ - g_return_if_fail (node != NULL); - g_return_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE); - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_BOOLEAN) - g_value_set_boolean (&(node->data.value), value); - else - { - GValue copy = { 0, }; - - g_value_init (©, G_TYPE_BOOLEAN); - g_value_set_boolean (©, value); - - json_node_set_value (node, ©); - - g_value_unset (©); - } -} - -/** - * json_node_get_boolean: - * @node: a #JsonNode of type %JSON_NODE_VALUE - * - * Gets the boolean value stored inside a #JsonNode - * - * Return value: a boolean value. - */ -gboolean -json_node_get_boolean (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, FALSE); - - if (JSON_NODE_TYPE (node) == JSON_NODE_NULL) - return FALSE; - - if (G_VALUE_TYPE (&(node->data.value)) == G_TYPE_BOOLEAN) - return g_value_get_boolean (&(node->data.value)); - - return FALSE; -} - -/** - * json_node_get_node_type: - * @node: a #JsonNode - * - * Retrieves the #JsonNodeType of @node - * - * Return value: the type of the node - * - * Since: 0.8 - */ -JsonNodeType -json_node_get_node_type (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, JSON_NODE_NULL); - - return node->type; -} - -/** - * json_node_is_null: - * @node: a #JsonNode - * - * Checks whether @node is a %JSON_NODE_NULL - * - * A null node is not the same as a %NULL #JsonNode - * - * Return value: %TRUE if the node is null - * - * Since: 0.8 - */ -gboolean -json_node_is_null (JsonNode *node) -{ - g_return_val_if_fail (node != NULL, TRUE); - - return node->type == JSON_NODE_NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-object.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-object.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-object.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-object.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,857 +0,0 @@ -/* json-object.c - JSON object implementation - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "json-types-private.h" - -/** - * SECTION:json-object - * @short_description: a JSON object representation - * - * #JsonArray is the representation of the object type inside JSON. It contains - * #JsonNodes, which may contain fundamental types, arrays or other - * objects. Each member of an object is accessed using its name. - * - * Since objects can be expensive, they are reference counted. You can control - * the lifetime of a #JsonObject using json_object_ref() and json_object_unref(). - * - * To add or overwrite a member with a given name, use json_object_set_member(). - * To extract a member with a given name, use json_object_get_member(). - * To retrieve the list of members, use json_object_get_members(). - * To retrieve the size of the object (that is, the number of members it has), - * use json_object_get_size(). - */ - -GType -json_object_get_type (void) -{ - static GType object_type = 0; - - if (G_UNLIKELY (!object_type)) - object_type = g_boxed_type_register_static (g_intern_static_string ("JsonObject"), - (GBoxedCopyFunc) json_object_ref, - (GBoxedFreeFunc) json_object_unref); - - return object_type; -} - -/** - * json_object_new: - * - * Creates a new #JsonObject, an JSON object type representation. - * - * Return value: the newly created #JsonObject - */ -JsonObject * -json_object_new (void) -{ - JsonObject *object; - - object = g_slice_new (JsonObject); - - object->ref_count = 1; - object->members = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, - (GDestroyNotify) json_node_free); - - return object; -} - -/** - * json_object_ref: - * @object: a #JsonObject - * - * Increase by one the reference count of a #JsonObject. - * - * Return value: the passed #JsonObject, with the reference count - * increased by one. - */ -JsonObject * -json_object_ref (JsonObject *object) -{ - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (object->ref_count > 0, NULL); - - g_atomic_int_exchange_and_add (&object->ref_count, 1); - - return object; -} - -/** - * json_object_unref: - * @object: a #JsonObject - * - * Decreases by one the reference count of a #JsonObject. If the - * reference count reaches zero, the object is destroyed and all - * its allocated resources are freed. - */ -void -json_object_unref (JsonObject *object) -{ - gint old_ref; - - g_return_if_fail (object != NULL); - g_return_if_fail (object->ref_count > 0); - - old_ref = g_atomic_int_get (&object->ref_count); - if (old_ref > 1) - g_atomic_int_compare_and_exchange (&object->ref_count, old_ref, old_ref - 1); - else - { - g_hash_table_destroy (object->members); - object->members = NULL; - - g_slice_free (JsonObject, object); - } -} - -static inline void -object_set_member_internal (JsonObject *object, - const gchar *member_name, - JsonNode *node) -{ - g_hash_table_replace (object->members, - g_strdup (member_name), - node); -} - -/** - * json_object_add_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @node: the value of the member - * - * Adds a member named @member_name and containing @node into a #JsonObject. - * The object will take ownership of the #JsonNode. - * - * This function will return if the @object already contains a member - * @member_name. - * - * Deprecated: 0.8: Use json_object_set_member() instead - */ -void -json_object_add_member (JsonObject *object, - const gchar *member_name, - JsonNode *node) -{ - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - g_return_if_fail (node != NULL); - - if (json_object_has_member (object, member_name)) - { - g_warning ("JsonObject already has a `%s' member of type `%s'", - member_name, - json_node_type_name (node)); - return; - } - - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @node: the value of the member - * - * Sets @node as the value of @member_name inside @object. - * - * If @object already contains a member called @member_name then - * the member's current value is overwritten. Otherwise, a new - * member is added to @object. - * - * Since: 0.8 - */ -void -json_object_set_member (JsonObject *object, - const gchar *member_name, - JsonNode *node) -{ - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - g_return_if_fail (node != NULL); - - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_int_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @value: the value of the member - * - * Convenience function for setting an integer @value of - * @member_name inside @object. - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_int_member (JsonObject *object, - const gchar *member_name, - gint64 value) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_int (node, value); - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_double_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @value: the value of the member - * - * Convenience function for setting a floating point @value - * of @member_name inside @object. - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_double_member (JsonObject *object, - const gchar *member_name, - gdouble value) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_double (node, value); - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_boolean_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @value: the value of the member - * - * Convenience function for setting a boolean @value of - * @member_name inside @object. - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_boolean_member (JsonObject *object, - const gchar *member_name, - gboolean value) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_boolean (node, value); - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_string_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @value: the value of the member - * - * Convenience function for setting a string @value of - * @member_name inside @object. - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_string_member (JsonObject *object, - const gchar *member_name, - const gchar *value) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_VALUE); - json_node_set_string (node, value); - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_null_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function for setting a null @value of - * @member_name inside @object. - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_null_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_NULL); - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_array_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @value: the value of the member - * - * Convenience function for setting an array @value of - * @member_name inside @object. - * - * The @object will take ownership of the passed #JsonArray - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_array_member (JsonObject *object, - const gchar *member_name, - JsonArray *value) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_ARRAY); - json_node_take_array (node, value); - object_set_member_internal (object, member_name, node); -} - -/** - * json_object_set_object_member: - * @object: a #JsonObject - * @member_name: the name of the member - * @value: the value of the member - * - * Convenience function for setting an object @value of - * @member_name inside @object. - * - * The @object will take ownership of the passed #JsonObject - * - * See also: json_object_set_member() - * - * Since: 0.8 - */ -void -json_object_set_object_member (JsonObject *object, - const gchar *member_name, - JsonObject *value) -{ - JsonNode *node; - - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - node = json_node_new (JSON_NODE_OBJECT); - json_node_take_object (node, value); - object_set_member_internal (object, member_name, node); -} - -/* FIXME: yuck */ -#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 14 -static void -get_keys (gpointer key, - gpointer value, - gpointer user_data) -{ - GList **keys = user_data; - - *keys = g_list_prepend (*keys, key); -} - -static void -get_values (gpointer key, - gpointer value, - gpointer user_data) -{ - GList **values = user_data; - - *values = g_list_prepend (*values, value); -} - -static GList * -g_hash_table_get_keys (GHashTable *hash_table) -{ - GList *retval = NULL; - - g_return_val_if_fail (hash_table != NULL, NULL); - - g_hash_table_foreach (hash_table, get_keys, &retval); - - return retval; -} - -static GList * -g_hash_table_get_values (GHashTable *hash_table) -{ - GList *retval = NULL; - - g_return_val_if_fail (hash_table != NULL, NULL); - - g_hash_table_foreach (hash_table, get_values, &retval); - - return retval; -} -#endif /* GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 14 */ - -/** - * json_object_get_members: - * @object: a #JsonObject - * - * Retrieves all the names of the members of a #JsonObject. You can - * obtain the value for each member using json_object_get_member(). - * - * Return value: a #GList of member names. The content of the list - * is owned by the #JsonObject and should never be modified or - * freed. When you have finished using the returned list, use - * g_list_free() to free the resources it has allocated. - */ -GList * -json_object_get_members (JsonObject *object) -{ - g_return_val_if_fail (object != NULL, NULL); - - return g_hash_table_get_keys (object->members); -} - -/** - * json_object_get_values: - * @object: a #JsonObject - * - * Retrieves all the values of the members of a #JsonObject. - * - * Return value: a #GList of #JsonNodes. The content of the - * list is owned by the #JsonObject and should never be modified - * or freed. When you have finished using the returned list, use - * g_list_free() to free the resources it has allocated. - */ -GList * -json_object_get_values (JsonObject *object) -{ - g_return_val_if_fail (object != NULL, NULL); - - return g_hash_table_get_values (object->members); -} - -/** - * json_object_dup_member: - * @object: a #JsonObject - * @member_name: the name of the JSON object member to access - * - * Retrieves a copy of the #JsonNode containing the value of @member_name - * inside a #JsonObject - * - * Return value: a copy of the node for the requested object member - * or %NULL. Use json_node_free() when done. - * - * Since: 0.6 - */ -JsonNode * -json_object_dup_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *retval; - - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (member_name != NULL, NULL); - - retval = json_object_get_member (object, member_name); - if (!retval) - return NULL; - - return json_node_copy (retval); -} - -static inline JsonNode * -object_get_member_internal (JsonObject *object, - const gchar *member_name) -{ - return g_hash_table_lookup (object->members, member_name); -} - -/** - * json_object_get_member: - * @object: a #JsonObject - * @member_name: the name of the JSON object member to access - * - * Retrieves the #JsonNode containing the value of @member_name inside - * a #JsonObject. - * - * Return value: a pointer to the node for the requested object - * member, or %NULL - */ -JsonNode * -json_object_get_member (JsonObject *object, - const gchar *member_name) -{ - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (member_name != NULL, NULL); - - return object_get_member_internal (object, member_name); -} - -/** - * json_object_get_int_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that retrieves the integer value - * stored in @member_name of @object - * - * See also: json_object_get_member() - * - * Return value: the integer value of the object's member - * - * Since: 0.8 - */ -gint64 -json_object_get_int_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, 0); - g_return_val_if_fail (member_name != NULL, 0); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, 0); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, 0); - - return json_node_get_int (node); -} - -/** - * json_object_get_double_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that retrieves the floating point value - * stored in @member_name of @object - * - * See also: json_object_get_member() - * - * Return value: the floating point value of the object's member - * - * Since: 0.8 - */ -gdouble -json_object_get_double_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, 0.0); - g_return_val_if_fail (member_name != NULL, 0.0); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, 0.0); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, 0.0); - - return json_node_get_double (node); -} - -/** - * json_object_get_boolean_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that retrieves the boolean value - * stored in @member_name of @object - * - * See also: json_object_get_member() - * - * Return value: the boolean value of the object's member - * - * Since: 0.8 - */ -gboolean -json_object_get_boolean_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, FALSE); - g_return_val_if_fail (member_name != NULL, FALSE); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, FALSE); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, FALSE); - - return json_node_get_boolean (node); -} - -/** - * json_object_get_null_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that checks whether the value - * stored in @member_name of @object is null - * - * See also: json_object_get_member() - * - * Return value: %TRUE if the value is null - * - * Since: 0.8 - */ -gboolean -json_object_get_null_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, FALSE); - g_return_val_if_fail (member_name != NULL, FALSE); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, FALSE); - - return JSON_NODE_TYPE (node) == JSON_NODE_NULL; -} - -/** - * json_object_get_string_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that retrieves the string value - * stored in @member_name of @object - * - * See also: json_object_get_member() - * - * Return value: the string value of the object's member - * - * Since: 0.8 - */ -G_CONST_RETURN gchar * -json_object_get_string_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (member_name != NULL, NULL); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_VALUE, NULL); - - return json_node_get_string (node); -} - -/** - * json_object_get_array_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that retrieves the array - * stored in @member_name of @object - * - * See also: json_object_get_member() - * - * Return value: the array inside the object's member - * - * Since: 0.8 - */ -JsonArray * -json_object_get_array_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (member_name != NULL, NULL); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_ARRAY, NULL); - - return json_node_get_array (node); -} - -/** - * json_object_get_object_member: - * @object: a #JsonObject - * @member_name: the name of the member - * - * Convenience function that retrieves the object - * stored in @member_name of @object - * - * See also: json_object_get_member() - * - * Return value: the object inside the object's member - * - * Since: 0.8 - */ -JsonObject * -json_object_get_object_member (JsonObject *object, - const gchar *member_name) -{ - JsonNode *node; - - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (member_name != NULL, NULL); - - node = object_get_member_internal (object, member_name); - g_return_val_if_fail (node != NULL, NULL); - g_return_val_if_fail (JSON_NODE_TYPE (node) == JSON_NODE_OBJECT, NULL); - - return json_node_get_object (node); -} - -/** - * json_object_has_member: - * @object: a #JsonObject - * @member_name: the name of a JSON object member - * - * Checks whether @object has a member named @member_name. - * - * Return value: %TRUE if the JSON object has the requested member - */ -gboolean -json_object_has_member (JsonObject *object, - const gchar *member_name) -{ - g_return_val_if_fail (object != NULL, FALSE); - g_return_val_if_fail (member_name != NULL, FALSE); - - return (g_hash_table_lookup (object->members, member_name) != NULL); -} - -/** - * json_object_get_size: - * @object: a #JsonObject - * - * Retrieves the number of members of a #JsonObject. - * - * Return value: the number of members - */ -guint -json_object_get_size (JsonObject *object) -{ - g_return_val_if_fail (object != NULL, 0); - - return g_hash_table_size (object->members); -} - -/** - * json_object_remove_member: - * @object: a #JsonObject - * @member_name: the name of the member to remove - * - * Removes @member_name from @object, freeing its allocated resources. - */ -void -json_object_remove_member (JsonObject *object, - const gchar *member_name) -{ - g_return_if_fail (object != NULL); - g_return_if_fail (member_name != NULL); - - g_hash_table_remove (object->members, member_name); -} - -typedef struct _ForeachClosure ForeachClosure; - -struct _ForeachClosure -{ - JsonObject *object; - - JsonObjectForeach func; - gpointer data; -}; - -static void -json_object_foreach_internal (gpointer key, - gpointer value, - gpointer data) -{ - ForeachClosure *clos = data; - const gchar *member_name = key; - JsonNode *member_node = value; - - clos->func (clos->object, member_name, member_node, clos->data); -} - -/** - * json_object_foreach_member: - * @object: a #JsonObject - * @func: the function to be called on each member - * @data: data to be passed to the function - * - * Iterates over all members of @object and calls @func on - * each one of them. - * - * It is safe to change the value of a #JsonNode of the @object - * from within the iterator @func, but it is not safe to add or - * remove members from the @object. - * - * Since: 0.8 - */ -void -json_object_foreach_member (JsonObject *object, - JsonObjectForeach func, - gpointer data) -{ - ForeachClosure clos; - - g_return_if_fail (object != NULL); - g_return_if_fail (func != NULL); - - clos.object = object; - clos.func = func; - clos.data = data; - g_hash_table_foreach (object->members, - json_object_foreach_internal, - &clos); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1211 +0,0 @@ -/* json-parser.c - JSON streams parser - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -/** - * SECTION:json-parser - * @short_description: Parse JSON data streams - * - * #JsonParser provides an object for parsing a JSON data stream, either - * inside a file or inside a static buffer. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "json-types-private.h" - -#include "json-marshal.h" -#include "json-parser.h" -#include "json-scanner.h" - -GQuark -json_parser_error_quark (void) -{ - return g_quark_from_static_string ("json-parser-error"); -} - -#define JSON_PARSER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), JSON_TYPE_PARSER, JsonParserPrivate)) - -struct _JsonParserPrivate -{ - JsonNode *root; - JsonNode *current_node; - - JsonScanner *scanner; - - GError *last_error; - - guint has_assignment : 1; - guint is_filename : 1; - - gchar *variable_name; - gchar *filename; -}; - -static const gchar symbol_names[] = - "true\0" - "false\0" - "null\0" - "var\0"; - -static const struct -{ - guint name_offset; - guint token; -} symbols[] = { - { 0, JSON_TOKEN_TRUE }, - { 5, JSON_TOKEN_FALSE }, - { 11, JSON_TOKEN_NULL }, - { 16, JSON_TOKEN_VAR } -}; - -static const guint n_symbols = G_N_ELEMENTS (symbols); - -enum -{ - PARSE_START, - OBJECT_START, - OBJECT_MEMBER, - OBJECT_END, - ARRAY_START, - ARRAY_ELEMENT, - ARRAY_END, - PARSE_END, - ERROR, - - LAST_SIGNAL -}; - -static guint parser_signals[LAST_SIGNAL] = { 0, }; - -G_DEFINE_TYPE (JsonParser, json_parser, G_TYPE_OBJECT); - -static guint json_parse_array (JsonParser *parser, - JsonScanner *scanner, - gboolean nested); -static guint json_parse_object (JsonParser *parser, - JsonScanner *scanner, - gboolean nested); - -static inline void -json_parser_clear (JsonParser *parser) -{ - JsonParserPrivate *priv = parser->priv; - - g_free (priv->variable_name); - priv->variable_name = NULL; - - if (priv->last_error) - { - g_error_free (priv->last_error); - priv->last_error = NULL; - } - - if (priv->root) - { - json_node_free (priv->root); - priv->root = NULL; - } -} - -static void -json_parser_dispose (GObject *gobject) -{ - json_parser_clear (JSON_PARSER (gobject)); - - G_OBJECT_CLASS (json_parser_parent_class)->dispose (gobject); -} - -static void -json_parser_finalize (GObject *gobject) -{ - JsonParserPrivate *priv = JSON_PARSER (gobject)->priv; - - g_free (priv->variable_name); - g_free (priv->filename); - - G_OBJECT_CLASS (json_parser_parent_class)->finalize (gobject); -} - -static void -json_parser_class_init (JsonParserClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (JsonParserPrivate)); - - gobject_class->dispose = json_parser_dispose; - gobject_class->finalize = json_parser_finalize; - - /** - * JsonParser::parse-start: - * @parser: the #JsonParser that received the signal - * - * The ::parse-start signal is emitted when the parser began parsing - * a JSON data stream. - */ - parser_signals[PARSE_START] = - g_signal_new ("parse-start", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, parse_start), - NULL, NULL, - _json_marshal_VOID__VOID, - G_TYPE_NONE, 0); - /** - * JsonParser::parse-end: - * @parser: the #JsonParser that received the signal - * - * The ::parse-end signal is emitted when the parser successfully - * finished parsing a JSON data stream - */ - parser_signals[PARSE_END] = - g_signal_new ("parse-end", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, parse_end), - NULL, NULL, - _json_marshal_VOID__VOID, - G_TYPE_NONE, 0); - /** - * JsonParser::object-start: - * @parser: the #JsonParser that received the signal - * - * The ::object-start signal is emitted each time the #JsonParser - * starts parsing a #JsonObject. - */ - parser_signals[OBJECT_START] = - g_signal_new ("object-start", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, object_start), - NULL, NULL, - _json_marshal_VOID__VOID, - G_TYPE_NONE, 0); - /** - * JsonParser::object-member: - * @parser: the #JsonParser that received the signal - * @object: a #JsonObject - * @member_name: the name of the newly parsed member - * - * The ::object-member signal is emitted each time the #JsonParser - * has successfully parsed a single member of a #JsonObject. The - * object and member are passed to the signal handlers. - */ - parser_signals[OBJECT_MEMBER] = - g_signal_new ("object-member", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, object_member), - NULL, NULL, - _json_marshal_VOID__BOXED_STRING, - G_TYPE_NONE, 2, - JSON_TYPE_OBJECT, - G_TYPE_STRING); - /** - * JsonParser::object-end: - * @parser: the #JsonParser that received the signal - * @object: the parsed #JsonObject - * - * The ::object-end signal is emitted each time the #JsonParser - * has successfully parsed an entire #JsonObject. - */ - parser_signals[OBJECT_END] = - g_signal_new ("object-end", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, object_end), - NULL, NULL, - _json_marshal_VOID__BOXED, - G_TYPE_NONE, 1, - JSON_TYPE_OBJECT); - /** - * JsonParser::array-start: - * @parser: the #JsonParser that received the signal - * - * The ::array-start signal is emitted each time the #JsonParser - * starts parsing a #JsonArray - */ - parser_signals[ARRAY_START] = - g_signal_new ("array-start", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, array_start), - NULL, NULL, - _json_marshal_VOID__VOID, - G_TYPE_NONE, 0); - /** - * JsonParser::array-element: - * @parser: the #JsonParser that received the signal - * @array: a #JsonArray - * @index_: the index of the newly parsed element - * - * The ::array-element signal is emitted each time the #JsonParser - * has successfully parsed a single element of a #JsonArray. The - * array and element index are passed to the signal handlers. - */ - parser_signals[ARRAY_ELEMENT] = - g_signal_new ("array-element", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, array_element), - NULL, NULL, - _json_marshal_VOID__BOXED_INT, - G_TYPE_NONE, 2, - JSON_TYPE_ARRAY, - G_TYPE_INT); - /** - * JsonParser::array-end: - * @parser: the #JsonParser that received the signal - * @array: the parsed #JsonArrary - * - * The ::array-end signal is emitted each time the #JsonParser - * has successfully parsed an entire #JsonArray - */ - parser_signals[ARRAY_END] = - g_signal_new ("array-end", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, array_end), - NULL, NULL, - _json_marshal_VOID__BOXED, - G_TYPE_NONE, 1, - JSON_TYPE_ARRAY); - /** - * JsonParser::error: - * @parser: the parser instance that received the signal - * @error: a pointer to the #GError - * - * The ::error signal is emitted each time a #JsonParser encounters - * an error in a JSON stream. - */ - parser_signals[ERROR] = - g_signal_new ("error", - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (JsonParserClass, error), - NULL, NULL, - _json_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); -} - -static void -json_parser_init (JsonParser *parser) -{ - JsonParserPrivate *priv; - - parser->priv = priv = JSON_PARSER_GET_PRIVATE (parser); - - priv->root = NULL; - priv->current_node = NULL; - - priv->has_assignment = FALSE; - priv->variable_name = NULL; - - priv->is_filename = FALSE; - priv->filename = FALSE; -} - -static guint -json_parse_value (JsonParser *parser, - JsonScanner *scanner, - guint token, - JsonNode **node) -{ - gboolean is_negative = FALSE; - - if (token == '-') - { - guint next_token = json_scanner_peek_next_token (scanner); - - if (next_token == G_TOKEN_INT || - next_token == G_TOKEN_FLOAT) - { - is_negative = TRUE; - token = json_scanner_get_next_token (scanner); - } - else - return G_TOKEN_INT; - } - - switch (token) - { - case G_TOKEN_INT: - *node = json_node_new (JSON_NODE_VALUE); - json_node_set_int (*node, is_negative ? scanner->value.v_int64 * -1 - : scanner->value.v_int64); - break; - - case G_TOKEN_FLOAT: - *node = json_node_new (JSON_NODE_VALUE); - json_node_set_double (*node, is_negative ? scanner->value.v_float * -1.0 - : scanner->value.v_float); - break; - - case G_TOKEN_STRING: - *node = json_node_new (JSON_NODE_VALUE); - json_node_set_string (*node, scanner->value.v_string); - break; - - case JSON_TOKEN_TRUE: - case JSON_TOKEN_FALSE: - *node = json_node_new (JSON_NODE_VALUE); - json_node_set_boolean (*node, token == JSON_TOKEN_TRUE ? TRUE : FALSE); - break; - - case JSON_TOKEN_NULL: - *node = json_node_new (JSON_NODE_NULL); - break; - - default: - *node = NULL; - return G_TOKEN_RIGHT_BRACE; - } - - return G_TOKEN_NONE; -} - -static guint -json_parse_array (JsonParser *parser, - JsonScanner *scanner, - gboolean nested) -{ - JsonParserPrivate *priv = parser->priv; - JsonArray *array; - guint token; - - if (!nested) - { - /* the caller already swallowed the opening '[' */ - token = json_scanner_get_next_token (scanner); - if (token != G_TOKEN_LEFT_BRACE) - return G_TOKEN_LEFT_BRACE; - } - - g_signal_emit (parser, parser_signals[ARRAY_START], 0); - - array = json_array_new (); - - token = json_scanner_get_next_token (scanner); - while (token != G_TOKEN_RIGHT_BRACE) - { - JsonNode *node = NULL; - - if (token == G_TOKEN_COMMA) - { - /* swallow the comma */ - token = json_scanner_get_next_token (scanner); - - continue; - } - - /* nested object */ - if (token == G_TOKEN_LEFT_CURLY) - { - JsonNode *old_node = priv->current_node; - - priv->current_node = json_node_new (JSON_NODE_OBJECT); - - token = json_parse_object (parser, scanner, TRUE); - - node = priv->current_node; - priv->current_node = old_node; - - if (token != G_TOKEN_NONE) - { - json_node_free (node); - json_array_unref (array); - - return token; - } - - json_array_add_element (array, node); - json_node_set_parent (node, priv->current_node); - - g_signal_emit (parser, parser_signals[ARRAY_ELEMENT], 0, - array, - json_array_get_length (array)); - - token = json_scanner_get_next_token (scanner); - if (token == G_TOKEN_RIGHT_BRACE) - break; - - if (token != G_TOKEN_COMMA) - { - json_array_unref (array); - - return G_TOKEN_RIGHT_BRACE; - } - - continue; - } - - /* nested array */ - if (token == G_TOKEN_LEFT_BRACE) - { - JsonNode *old_node = priv->current_node; - - priv->current_node = json_node_new (JSON_NODE_ARRAY); - - token = json_parse_array (parser, scanner, TRUE); - - node = priv->current_node; - priv->current_node = old_node; - - if (token != G_TOKEN_NONE) - { - json_node_free (node); - json_array_unref (array); - - return token; - } - - json_array_add_element (array, node); - json_node_set_parent (node, priv->current_node); - - g_signal_emit (parser, parser_signals[ARRAY_ELEMENT], 0, - array, - json_array_get_length (array)); - - token = json_scanner_get_next_token (scanner); - if (token == G_TOKEN_RIGHT_BRACE) - break; - - if (token != G_TOKEN_COMMA) - { - json_array_unref (array); - - return G_TOKEN_RIGHT_BRACE; - } - - continue; - } - - /* value */ - token = json_parse_value (parser, scanner, token, &node); - if (token != G_TOKEN_NONE || node == NULL) - { - json_array_unref (array); - return token; - } - - json_array_add_element (array, node); - json_node_set_parent (node, priv->current_node); - - g_signal_emit (parser, parser_signals[ARRAY_ELEMENT], 0, - array, - json_array_get_length (array)); - - token = json_scanner_get_next_token (scanner); - if (token != G_TOKEN_COMMA && token != G_TOKEN_RIGHT_BRACE) - { - json_array_unref (array); - - return G_TOKEN_RIGHT_BRACE; - } - } - - json_node_take_array (priv->current_node, array); - - g_signal_emit (parser, parser_signals[ARRAY_END], 0, array); - - return G_TOKEN_NONE; -} - -static guint -json_parse_object (JsonParser *parser, - JsonScanner *scanner, - gboolean nested) -{ - JsonParserPrivate *priv = parser->priv; - JsonObject *object; - guint token; - - if (!nested) - { - /* the caller already swallowed the opening '{' */ - token = json_scanner_get_next_token (scanner); - if (token != G_TOKEN_LEFT_CURLY) - return G_TOKEN_LEFT_CURLY; - } - - g_signal_emit (parser, parser_signals[OBJECT_START], 0); - - object = json_object_new (); - - token = json_scanner_get_next_token (scanner); - while (token != G_TOKEN_RIGHT_CURLY) - { - JsonNode *node = NULL; - gchar *name = NULL; - - if (token == G_TOKEN_COMMA) - { - /* swallow the comma */ - token = json_scanner_get_next_token (scanner); - - continue; - } - - if (token == G_TOKEN_STRING) - { - name = g_strdup (scanner->value.v_string); - - token = json_scanner_get_next_token (scanner); - if (token != ':') - { - g_free (name); - json_object_unref (object); - - return ':'; - } - else - { - /* swallow the colon */ - token = json_scanner_get_next_token (scanner); - } - } - - if (!name) - { - json_object_unref (object); - - return G_TOKEN_STRING; - } - - if (token == G_TOKEN_LEFT_CURLY) - { - JsonNode *old_node = priv->current_node; - - priv->current_node = json_node_new (JSON_NODE_OBJECT); - - token = json_parse_object (parser, scanner, TRUE); - - node = priv->current_node; - priv->current_node = old_node; - - if (token != G_TOKEN_NONE) - { - g_free (name); - - if (node) - json_node_free (node); - - json_object_unref (object); - - return token; - } - - json_object_set_member (object, name, node); - json_node_set_parent (node, priv->current_node); - - g_signal_emit (parser, parser_signals[OBJECT_MEMBER], 0, - object, - name); - - g_free (name); - - token = json_scanner_get_next_token (scanner); - if (token == G_TOKEN_RIGHT_CURLY) - break; - - if (token != G_TOKEN_COMMA) - { - json_object_unref (object); - - return G_TOKEN_RIGHT_CURLY; - } - - continue; - } - - if (token == G_TOKEN_LEFT_BRACE) - { - JsonNode *old_node = priv->current_node; - - priv->current_node = json_node_new (JSON_NODE_ARRAY); - - token = json_parse_array (parser, scanner, TRUE); - - node = priv->current_node; - priv->current_node = old_node; - - if (token != G_TOKEN_NONE) - { - g_free (name); - json_node_free (node); - json_object_unref (object); - - return token; - } - - json_object_set_member (object, name, node); - json_node_set_parent (node, priv->current_node); - - g_signal_emit (parser, parser_signals[OBJECT_MEMBER], 0, - object, - name); - - g_free (name); - - token = json_scanner_get_next_token (scanner); - if (token == G_TOKEN_RIGHT_CURLY) - break; - - if (token != G_TOKEN_COMMA) - { - json_object_unref (object); - - return G_TOKEN_RIGHT_CURLY; - } - - continue; - } - - /* value */ - token = json_parse_value (parser, scanner, token, &node); - if (token != G_TOKEN_NONE || node == NULL) - { - json_object_unref (object); - g_free (name); - return token; - } - - json_object_set_member (object, name, node); - json_node_set_parent (node, priv->current_node); - - g_signal_emit (parser, parser_signals[OBJECT_MEMBER], 0, - object, - name); - - g_free (name); - - token = json_scanner_get_next_token (scanner); - if (token != G_TOKEN_COMMA && token != G_TOKEN_RIGHT_CURLY) - return G_TOKEN_RIGHT_CURLY; - } - - json_node_take_object (priv->current_node, object); - - g_signal_emit (parser, parser_signals[OBJECT_END], 0, object); - - return G_TOKEN_NONE; -} - -static guint -json_parse_statement (JsonParser *parser, - JsonScanner *scanner) -{ - JsonParserPrivate *priv = parser->priv; - guint token; - - token = json_scanner_peek_next_token (scanner); - switch (token) - { - case G_TOKEN_LEFT_CURLY: - priv->root = priv->current_node = json_node_new (JSON_NODE_OBJECT); - return json_parse_object (parser, scanner, FALSE); - - case G_TOKEN_LEFT_BRACE: - priv->root = priv->current_node = json_node_new (JSON_NODE_ARRAY); - return json_parse_array (parser, scanner, FALSE); - - /* some web APIs are not only passing the data structures: they are - * also passing an assigment, which makes parsing horribly complicated - * only because web developers are lazy, and writing "var foo = " is - * evidently too much to request from them. - */ - case JSON_TOKEN_VAR: - { - guint next_token; - gchar *name; - - /* swallow the 'var' token... */ - token = json_scanner_get_next_token (scanner); - - /* ... swallow the variable name... */ - next_token = json_scanner_get_next_token (scanner); - if (next_token != G_TOKEN_IDENTIFIER) - return G_TOKEN_IDENTIFIER; - - name = g_strdup (scanner->value.v_identifier); - - /* ... and finally swallow the '=' */ - next_token = json_scanner_get_next_token (scanner); - if (next_token != '=') - return '='; - - priv->has_assignment = TRUE; - priv->variable_name = name; - - token = json_parse_statement (parser, scanner); - - /* remove the trailing semi-colon */ - next_token = json_scanner_peek_next_token (scanner); - if (next_token == ';') - { - token = json_scanner_get_next_token (scanner); - return G_TOKEN_NONE; - } - - return token; - } - break; - - case JSON_TOKEN_NULL: - priv->root = priv->current_node = json_node_new (JSON_NODE_NULL); - json_scanner_get_next_token (scanner); - return G_TOKEN_NONE; - - case JSON_TOKEN_TRUE: - case JSON_TOKEN_FALSE: - priv->root = priv->current_node = json_node_new (JSON_NODE_VALUE); - json_node_set_boolean (priv->current_node, - token == JSON_TOKEN_TRUE ? TRUE : FALSE); - json_scanner_get_next_token (scanner); - return G_TOKEN_NONE; - - case '-': - { - guint next_token; - - token = json_scanner_get_next_token (scanner); - next_token = json_scanner_peek_next_token (scanner); - - if (next_token == G_TOKEN_INT || next_token == G_TOKEN_FLOAT) - { - priv->root = priv->current_node = json_node_new (JSON_NODE_VALUE); - - token = json_scanner_get_next_token (scanner); - switch (token) - { - case G_TOKEN_INT: - json_node_set_int (priv->current_node, - scanner->value.v_int64 * -1); - break; - case G_TOKEN_FLOAT: - json_node_set_double (priv->current_node, - scanner->value.v_float * -1.0); - break; - default: - return G_TOKEN_INT; - } - - json_scanner_get_next_token (scanner); - return G_TOKEN_NONE; - } - else - return G_TOKEN_INT; - } - break; - - case G_TOKEN_INT: - case G_TOKEN_FLOAT: - case G_TOKEN_STRING: - priv->root = priv->current_node = json_node_new (JSON_NODE_VALUE); - - if (token == G_TOKEN_INT) - json_node_set_int (priv->current_node, scanner->value.v_int64); - else if (token == G_TOKEN_FLOAT) - json_node_set_double (priv->current_node, scanner->value.v_float); - else - json_node_set_string (priv->current_node, scanner->value.v_string); - - json_scanner_get_next_token (scanner); - return G_TOKEN_NONE; - - default: - json_scanner_get_next_token (scanner); - return G_TOKEN_SYMBOL; - } -} - -static void -json_scanner_msg_handler (JsonScanner *scanner, - gchar *message, - gboolean is_error) -{ - JsonParser *parser = scanner->user_data; - JsonParserPrivate *priv = parser->priv; - - if (is_error) - { - GError *error = NULL; - - g_set_error (&error, JSON_PARSER_ERROR, - JSON_PARSER_ERROR_PARSE, - "%s:%d: Parse error: %s", - priv->is_filename ? priv->filename : "", - scanner->line, - message); - - parser->priv->last_error = error; - g_signal_emit (parser, parser_signals[ERROR], 0, error); - } - else - g_warning ("%s:%d: Parse error: %s", - priv->is_filename ? priv->filename : "", - scanner->line, - message); -} - -static JsonScanner * -json_scanner_create (JsonParser *parser) -{ - JsonScanner *scanner; - gint i; - - scanner = json_scanner_new (); - scanner->msg_handler = json_scanner_msg_handler; - scanner->user_data = parser; - - for (i = 0; i < n_symbols; i++) - { - json_scanner_scope_add_symbol (scanner, 0, - symbol_names + symbols[i].name_offset, - GINT_TO_POINTER (symbols[i].token)); - } - - return scanner; -} - -/** - * json_parser_new: - * - * Creates a new #JsonParser instance. You can use the #JsonParser to - * load a JSON stream from either a file or a buffer and then walk the - * hierarchy using the data types API. - * - * Return value: the newly created #JsonParser. Use g_object_unref() - * to release all the memory it allocates. - */ -JsonParser * -json_parser_new (void) -{ - return g_object_new (JSON_TYPE_PARSER, NULL); -} - -static gboolean -json_parser_load (JsonParser *parser, - const gchar *data, - gsize length, - GError **error) -{ - JsonParserPrivate *priv = parser->priv; - JsonScanner *scanner; - gboolean done; - gboolean retval = TRUE; - gint i; - - json_parser_clear (parser); - - scanner = json_scanner_create (parser); - json_scanner_input_text (scanner, data, length); - - priv->scanner = scanner; - - g_signal_emit (parser, parser_signals[PARSE_START], 0); - - done = FALSE; - while (!done) - { - if (json_scanner_peek_next_token (scanner) == G_TOKEN_EOF) - done = TRUE; - else - { - guint expected_token; - - /* we try to show the expected token, if possible */ - expected_token = json_parse_statement (parser, scanner); - if (expected_token != G_TOKEN_NONE) - { - const gchar *symbol_name; - gchar *msg; - - msg = NULL; - symbol_name = NULL; - if (scanner->scope_id == 0) - { - if (expected_token > JSON_TOKEN_INVALID && - expected_token < JSON_TOKEN_LAST) - { - for (i = 0; i < n_symbols; i++) - if (symbols[i].token == expected_token) - symbol_name = symbol_names + symbols[i].name_offset; - - if (!msg) - msg = g_strconcat ("e.g. '", symbol_name, "'", NULL); - } - - if (scanner->token > JSON_TOKEN_INVALID && - scanner->token < JSON_TOKEN_LAST) - { - symbol_name = "???"; - - for (i = 0; i < n_symbols; i++) - if (symbols[i].token == scanner->token) - symbol_name = symbol_names + symbols[i].name_offset; - } - } - - /* this will emit the ::error signal via the custom - * message handler we install - */ - json_scanner_unexp_token (scanner, expected_token, - NULL, "keyword", - symbol_name, msg, - TRUE); - - /* and this will propagate the error we create in the - * same message handler - */ - if (priv->last_error) - { - g_propagate_error (error, priv->last_error); - priv->last_error = NULL; - } - - retval = FALSE; - - g_free (msg); - done = TRUE; - } - } - } - - g_signal_emit (parser, parser_signals[PARSE_END], 0); - - /* remove the scanner */ - json_scanner_destroy (scanner); - priv->scanner = NULL; - priv->current_node = NULL; - - return retval; -} - -/** - * json_parser_load_from_file: - * @parser: a #JsonParser - * @filename: the path for the file to parse - * @error: return location for a #GError, or %NULL - * - * Loads a JSON stream from the content of @filename and parses it. See - * json_parser_load_from_data(). - * - * Return value: %TRUE if the file was successfully loaded and parsed. - * In case of error, @error is set accordingly and %FALSE is returned - */ -gboolean -json_parser_load_from_file (JsonParser *parser, - const gchar *filename, - GError **error) -{ - JsonParserPrivate *priv; - GError *internal_error; - gchar *data; - gsize length; - gboolean retval = TRUE; - - g_return_val_if_fail (JSON_IS_PARSER (parser), FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - - priv = parser->priv; - - internal_error = NULL; - if (!g_file_get_contents (filename, &data, &length, &internal_error)) - { - g_propagate_error (error, internal_error); - return FALSE; - } - - g_free (priv->filename); - - priv->is_filename = TRUE; - priv->filename = g_strdup (filename); - - if (!json_parser_load (parser, data, length, &internal_error)) - { - g_propagate_error (error, internal_error); - retval = FALSE; - } - - g_free (data); - - return retval; -} - -/** - * json_parser_load_from_data: - * @parser: a #JsonParser - * @data: the buffer to parse - * @length: the length of the buffer, or -1 - * @error: return location for a #GError, or %NULL - * - * Loads a JSON stream from a buffer and parses it. You can call this function - * multiple times with the same #JsonParser object, but the contents of the - * parser will be destroyed each time. - * - * Return value: %TRUE if the buffer was succesfully parser. In case - * of error, @error is set accordingly and %FALSE is returned - */ -gboolean -json_parser_load_from_data (JsonParser *parser, - const gchar *data, - gssize length, - GError **error) -{ - JsonParserPrivate *priv; - GError *internal_error; - gboolean retval = TRUE; - - g_return_val_if_fail (JSON_IS_PARSER (parser), FALSE); - g_return_val_if_fail (data != NULL, FALSE); - - priv = parser->priv; - - if (length < 0) - length = strlen (data); - - priv->is_filename = FALSE; - g_free (priv->filename); - - internal_error = NULL; - if (!json_parser_load (parser, data, length, &internal_error)) - { - g_propagate_error (error, internal_error); - retval = FALSE; - } - - return retval; -} - -/** - * json_parser_get_root: - * @parser: a #JsonParser - * - * Retrieves the top level node from the parsed JSON stream. - * - * Return value: the root #JsonNode . The returned node is owned by - * the #JsonParser and should never be modified or freed. - */ -JsonNode * -json_parser_get_root (JsonParser *parser) -{ - g_return_val_if_fail (JSON_IS_PARSER (parser), NULL); - - return parser->priv->root; -} - -/** - * json_parser_get_current_line: - * @parser: a #JsonParser - * - * Retrieves the line currently parsed, starting from 1. - * - * This function has defined behaviour only while parsing; calling this - * function from outside the signal handlers emitted by #JsonParser will - * yield 0. - * - * Return value: the currently parsed line, or 0. - */ -guint -json_parser_get_current_line (JsonParser *parser) -{ - g_return_val_if_fail (JSON_IS_PARSER (parser), 0); - - if (parser->priv->scanner) - return json_scanner_cur_line (parser->priv->scanner); - - return 0; -} - -/** - * json_parser_get_current_pos: - * @parser: a #JsonParser - * - * Retrieves the current position inside the current line, starting - * from 0. - * - * This function has defined behaviour only while parsing; calling this - * function from outside the signal handlers emitted by #JsonParser will - * yield 0. - * - * Return value: the position in the current line, or 0. - */ -guint -json_parser_get_current_pos (JsonParser *parser) -{ - g_return_val_if_fail (JSON_IS_PARSER (parser), 0); - - if (parser->priv->scanner) - return json_scanner_cur_line (parser->priv->scanner); - - return 0; -} - -/** - * json_parser_has_assignment: - * @parser: a #JsonParser - * @variable_name: (out) (allow-none): Return location for the variable - * name, or %NULL - * - * A JSON data stream might sometimes contain an assignment, like: - * - * |[ - * var _json_data = { "member_name" : [ ... - * ]| - * - * even though it would technically constitute a violation of the RFC. - * - * #JsonParser will ignore the left hand identifier and parse the right - * hand value of the assignment. #JsonParser will record, though, the - * existence of the assignment in the data stream and the variable name - * used. - * - * Return value: %TRUE if there was an assignment, %FALSE otherwise. If - * @variable_name is not %NULL it will be set to the name of the variable - * used in the assignment. The string is owned by #JsonParser and should - * never be modified or freed. - * - * Since: 0.4 - */ -gboolean -json_parser_has_assignment (JsonParser *parser, - gchar **variable_name) -{ - JsonParserPrivate *priv; - - g_return_val_if_fail (JSON_IS_PARSER (parser), FALSE); - - priv = parser->priv; - - if (priv->has_assignment && variable_name) - *variable_name = priv->variable_name; - - return priv->has_assignment; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-parser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -/* json-parser.h - JSON streams parser - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) -//#error "Only can be included directly." -#endif - -#ifndef __JSON_PARSER_H__ -#define __JSON_PARSER_H__ - -#include -#include "json-types.h" - -G_BEGIN_DECLS - -#define JSON_TYPE_PARSER (json_parser_get_type ()) -#define JSON_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_PARSER, JsonParser)) -#define JSON_IS_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_PARSER)) -#define JSON_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_PARSER, JsonParserClass)) -#define JSON_IS_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_PARSER)) -#define JSON_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_PARSER, JsonParserClass)) - -#define JSON_PARSER_ERROR (json_parser_error_quark ()) - -typedef struct _JsonParser JsonParser; -typedef struct _JsonParserPrivate JsonParserPrivate; -typedef struct _JsonParserClass JsonParserClass; - -/** - * JsonParserError: - * @JSON_PARSER_ERROR_PARSE: parse error - * @JSON_PARSER_ERROR_UNKNOWN: unknown error - * - * Error enumeration for #JsonParser - */ -typedef enum { - JSON_PARSER_ERROR_PARSE, - - JSON_PARSER_ERROR_UNKNOWN -} JsonParserError; - -/** - * JsonParser: - * - * JSON data streams parser. The contents of the #JsonParser structure are - * private and should only be accessed via the provided API. - */ -struct _JsonParser -{ - /*< private >*/ - GObject parent_instance; - - JsonParserPrivate *priv; -}; - -/** - * JsonParserClass: - * @parse_start: class handler for the JsonParser::parse-start signal - * @object_start: class handler for the JsonParser::object-start signal - * @object_member: class handler for the JsonParser::object-member signal - * @object_end: class handler for the JsonParser::object-end signal - * @array_start: class handler for the JsonParser::array-start signal - * @array_element: class handler for the JsonParser::array-element signal - * @array_end: class handler for the JsonParser::array-end signal - * @parse_end: class handler for the JsonParser::parse-end signal - * @error: class handler for the JsonParser::error signal - * - * #JsonParser class. - */ -struct _JsonParserClass -{ - /*< private >*/ - GObjectClass parent_class; - - /*< public >*/ - void (* parse_start) (JsonParser *parser); - - void (* object_start) (JsonParser *parser); - void (* object_member) (JsonParser *parser, - JsonObject *object, - const gchar *member_name); - void (* object_end) (JsonParser *parser, - JsonObject *object); - - void (* array_start) (JsonParser *parser); - void (* array_element) (JsonParser *parser, - JsonArray *array, - gint index_); - void (* array_end) (JsonParser *parser, - JsonArray *array); - - void (* parse_end) (JsonParser *parser); - - void (* error) (JsonParser *parser, - const GError *error); - - /*< private >*/ - /* padding for future expansion */ - void (* _json_reserved1) (void); - void (* _json_reserved2) (void); - void (* _json_reserved3) (void); - void (* _json_reserved4) (void); - void (* _json_reserved5) (void); - void (* _json_reserved6) (void); - void (* _json_reserved7) (void); - void (* _json_reserved8) (void); -}; - -GQuark json_parser_error_quark (void); -GType json_parser_get_type (void) G_GNUC_CONST; - -JsonParser *json_parser_new (void); -gboolean json_parser_load_from_file (JsonParser *parser, - const gchar *filename, - GError **error); -gboolean json_parser_load_from_data (JsonParser *parser, - const gchar *data, - gssize length, - GError **error); - -JsonNode * json_parser_get_root (JsonParser *parser); - -guint json_parser_get_current_line (JsonParser *parser); -guint json_parser_get_current_pos (JsonParser *parser); -gboolean json_parser_has_assignment (JsonParser *parser, - gchar **variable_name); - -G_END_DECLS - -#endif /* __JSON_PARSER_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1847 +0,0 @@ -/* json-scanner.c: Tokenizer for JSON - * Copyright (C) 2008 OpenedHand - * - * Based on JsonScanner: Flexible lexical scanner for general purpose. - * Copyright (C) 1997, 1998 Tim Janik - * - * Modified by Emmanuele Bassi - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include - -#include "json-scanner.h" - -#ifdef G_OS_WIN32 -#include /* For _read() */ -#endif - -struct _JsonScannerConfig -{ - /* Character sets - */ - gchar *cset_skip_characters; /* default: " \t\n" */ - gchar *cset_identifier_first; - gchar *cset_identifier_nth; - gchar *cpair_comment_single; /* default: "#\n" */ - - /* Should symbol lookup work case sensitive? */ - guint case_sensitive : 1; - - /* Boolean values to be adjusted "on the fly" - * to configure scanning behaviour. - */ - guint skip_comment_multi : 1; /* C like comment */ - guint skip_comment_single : 1; /* single line comment */ - guint scan_comment_multi : 1; /* scan multi line comments? */ - guint scan_identifier : 1; - guint scan_identifier_1char : 1; - guint scan_identifier_NULL : 1; - guint scan_symbols : 1; - guint scan_binary : 1; - guint scan_octal : 1; - guint scan_float : 1; - guint scan_hex : 1; /* `0x0ff0' */ - guint scan_hex_dollar : 1; /* `$0ff0' */ - guint scan_string_sq : 1; /* string: 'anything' */ - guint scan_string_dq : 1; /* string: "\\-escapes!\n" */ - guint numbers_2_int : 1; /* bin, octal, hex => int */ - guint int_2_float : 1; /* int => G_TOKEN_FLOAT? */ - guint identifier_2_string : 1; - guint char_2_token : 1; /* return G_TOKEN_CHAR? */ - guint symbol_2_token : 1; - guint scope_0_fallback : 1; /* try scope 0 on lookups? */ - guint store_int64 : 1; /* use value.v_int64 rather than v_int */ - guint padding_dummy; -}; - -static JsonScannerConfig json_scanner_config_template = -{ - ( " \t\r\n" ) /* cset_skip_characters */, - ( - "_" - G_CSET_a_2_z - G_CSET_A_2_Z - ) /* cset_identifier_first */, - ( - G_CSET_DIGITS - "-_" - G_CSET_a_2_z - G_CSET_A_2_Z - ) /* cset_identifier_nth */, - ( "//\n" ) /* cpair_comment_single */, - TRUE /* case_sensitive */, - TRUE /* skip_comment_multi */, - TRUE /* skip_comment_single */, - FALSE /* scan_comment_multi */, - TRUE /* scan_identifier */, - TRUE /* scan_identifier_1char */, - FALSE /* scan_identifier_NULL */, - TRUE /* scan_symbols */, - TRUE /* scan_binary */, - TRUE /* scan_octal */, - TRUE /* scan_float */, - TRUE /* scan_hex */, - TRUE /* scan_hex_dollar */, - TRUE /* scan_string_sq */, - TRUE /* scan_string_dq */, - TRUE /* numbers_2_int */, - FALSE /* int_2_float */, - FALSE /* identifier_2_string */, - TRUE /* char_2_token */, - TRUE /* symbol_2_token */, - FALSE /* scope_0_fallback */, - TRUE /* store_int64 */ -}; - -/* --- defines --- */ -#define to_lower(c) ( \ - (guchar) ( \ - ( (((guchar)(c))>='A' && ((guchar)(c))<='Z') * ('a'-'A') ) | \ - ( (((guchar)(c))>=192 && ((guchar)(c))<=214) * (224-192) ) | \ - ( (((guchar)(c))>=216 && ((guchar)(c))<=222) * (248-216) ) | \ - ((guchar)(c)) \ - ) \ -) - -#define READ_BUFFER_SIZE (4000) - -static const gchar json_symbol_names[] = - "true\0" - "false\0" - "null\0" - "var\0"; - -static const struct -{ - guint name_offset; - guint token; -} json_symbols[] = { - { 0, JSON_TOKEN_TRUE }, - { 5, JSON_TOKEN_FALSE }, - { 11, JSON_TOKEN_NULL }, - { 16, JSON_TOKEN_VAR } -}; - -static const guint n_json_symbols = G_N_ELEMENTS (json_symbols); - -/* --- typedefs --- */ -typedef struct _JsonScannerKey JsonScannerKey; - -struct _JsonScannerKey -{ - guint scope_id; - gchar *symbol; - gpointer value; -}; - -/* --- prototypes --- */ -static gboolean json_scanner_key_equal (gconstpointer v1, - gconstpointer v2); -static guint json_scanner_key_hash (gconstpointer v); - -static inline -JsonScannerKey *json_scanner_lookup_internal (JsonScanner *scanner, - guint scope_id, - const gchar *symbol); -static void json_scanner_get_token_ll (JsonScanner *scanner, - GTokenType *token_p, - GTokenValue *value_p, - guint *line_p, - guint *position_p); -static void json_scanner_get_token_i (JsonScanner *scanner, - GTokenType *token_p, - GTokenValue *value_p, - guint *line_p, - guint *position_p); - -static guchar json_scanner_peek_next_char (JsonScanner *scanner); -static guchar json_scanner_get_char (JsonScanner *scanner, - guint *line_p, - guint *position_p); -static gunichar json_scanner_get_unichar (JsonScanner *scanner, - guint *line_p, - guint *position_p); -static void json_scanner_msg_handler (JsonScanner *scanner, - gchar *message, - gboolean is_error); - -/* --- functions --- */ -static inline gint -json_scanner_char_2_num (guchar c, - guchar base) -{ - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'A' && c <= 'Z') - c -= 'A' - 10; - else if (c >= 'a' && c <= 'z') - c -= 'a' - 10; - else - return -1; - - if (c < base) - return c; - - return -1; -} - -JsonScanner * -json_scanner_new (void) -{ - JsonScanner *scanner; - JsonScannerConfig *config_templ; - - config_templ = &json_scanner_config_template; - - scanner = g_new0 (JsonScanner, 1); - - scanner->user_data = NULL; - scanner->max_parse_errors = 1; - scanner->parse_errors = 0; - scanner->input_name = NULL; - g_datalist_init (&scanner->qdata); - - scanner->config = g_new0 (JsonScannerConfig, 1); - - scanner->config->case_sensitive = config_templ->case_sensitive; - scanner->config->cset_skip_characters = config_templ->cset_skip_characters; - if (!scanner->config->cset_skip_characters) - scanner->config->cset_skip_characters = ""; - scanner->config->cset_identifier_first = config_templ->cset_identifier_first; - scanner->config->cset_identifier_nth = config_templ->cset_identifier_nth; - scanner->config->cpair_comment_single = config_templ->cpair_comment_single; - scanner->config->skip_comment_multi = config_templ->skip_comment_multi; - scanner->config->skip_comment_single = config_templ->skip_comment_single; - scanner->config->scan_comment_multi = config_templ->scan_comment_multi; - scanner->config->scan_identifier = config_templ->scan_identifier; - scanner->config->scan_identifier_1char = config_templ->scan_identifier_1char; - scanner->config->scan_identifier_NULL = config_templ->scan_identifier_NULL; - scanner->config->scan_symbols = config_templ->scan_symbols; - scanner->config->scan_binary = config_templ->scan_binary; - scanner->config->scan_octal = config_templ->scan_octal; - scanner->config->scan_float = config_templ->scan_float; - scanner->config->scan_hex = config_templ->scan_hex; - scanner->config->scan_hex_dollar = config_templ->scan_hex_dollar; - scanner->config->scan_string_sq = config_templ->scan_string_sq; - scanner->config->scan_string_dq = config_templ->scan_string_dq; - scanner->config->numbers_2_int = config_templ->numbers_2_int; - scanner->config->int_2_float = config_templ->int_2_float; - scanner->config->identifier_2_string = config_templ->identifier_2_string; - scanner->config->char_2_token = config_templ->char_2_token; - scanner->config->symbol_2_token = config_templ->symbol_2_token; - scanner->config->scope_0_fallback = config_templ->scope_0_fallback; - scanner->config->store_int64 = config_templ->store_int64; - - scanner->token = G_TOKEN_NONE; - scanner->value.v_int64 = 0; - scanner->line = 1; - scanner->position = 0; - - scanner->next_token = G_TOKEN_NONE; - scanner->next_value.v_int64 = 0; - scanner->next_line = 1; - scanner->next_position = 0; - - scanner->symbol_table = g_hash_table_new (json_scanner_key_hash, - json_scanner_key_equal); - scanner->input_fd = -1; - scanner->text = NULL; - scanner->text_end = NULL; - scanner->buffer = NULL; - scanner->scope_id = 0; - - scanner->msg_handler = json_scanner_msg_handler; - - return scanner; -} - -static inline void -json_scanner_free_value (GTokenType *token_p, - GTokenValue *value_p) -{ - switch (*token_p) - { - case G_TOKEN_STRING: - case G_TOKEN_IDENTIFIER: - case G_TOKEN_IDENTIFIER_NULL: - case G_TOKEN_COMMENT_SINGLE: - case G_TOKEN_COMMENT_MULTI: - g_free (value_p->v_string); - break; - - default: - break; - } - - *token_p = G_TOKEN_NONE; -} - -static void -json_scanner_destroy_symbol_table_entry (gpointer _key, - gpointer _value, - gpointer _data) -{ - JsonScannerKey *key = _key; - - g_free (key->symbol); - g_slice_free (JsonScannerKey, key); -} - -void -json_scanner_destroy (JsonScanner *scanner) -{ - g_return_if_fail (scanner != NULL); - - g_datalist_clear (&scanner->qdata); - g_hash_table_foreach (scanner->symbol_table, - json_scanner_destroy_symbol_table_entry, - NULL); - g_hash_table_destroy (scanner->symbol_table); - json_scanner_free_value (&scanner->token, &scanner->value); - json_scanner_free_value (&scanner->next_token, &scanner->next_value); - g_free (scanner->config); - g_free (scanner->buffer); - g_free (scanner); -} - -static void -json_scanner_msg_handler (JsonScanner *scanner, - gchar *message, - gboolean is_error) -{ - g_return_if_fail (scanner != NULL); - - g_fprintf (stderr, "%s:%d: ", - scanner->input_name ? scanner->input_name : "", - scanner->line); - if (is_error) - g_fprintf (stderr, "error: "); - - g_fprintf (stderr, "%s\n", message); -} - -void -json_scanner_error (JsonScanner *scanner, - const gchar *format, - ...) -{ - g_return_if_fail (scanner != NULL); - g_return_if_fail (format != NULL); - - scanner->parse_errors++; - - if (scanner->msg_handler) - { - va_list args; - gchar *string; - - va_start (args, format); - string = g_strdup_vprintf (format, args); - va_end (args); - - scanner->msg_handler (scanner, string, TRUE); - - g_free (string); - } -} - -void -json_scanner_warn (JsonScanner *scanner, - const gchar *format, - ...) -{ - g_return_if_fail (scanner != NULL); - g_return_if_fail (format != NULL); - - if (scanner->msg_handler) - { - va_list args; - gchar *string; - - va_start (args, format); - string = g_strdup_vprintf (format, args); - va_end (args); - - scanner->msg_handler (scanner, string, FALSE); - - g_free (string); - } -} - -static gboolean -json_scanner_key_equal (gconstpointer v1, - gconstpointer v2) -{ - const JsonScannerKey *key1 = v1; - const JsonScannerKey *key2 = v2; - - return (key1->scope_id == key2->scope_id) && - (strcmp (key1->symbol, key2->symbol) == 0); -} - -static guint -json_scanner_key_hash (gconstpointer v) -{ - const JsonScannerKey *key = v; - gchar *c; - guint h; - - h = key->scope_id; - for (c = key->symbol; *c; c++) - h = (h << 5) - h + *c; - - return h; -} - -static inline JsonScannerKey * -json_scanner_lookup_internal (JsonScanner *scanner, - guint scope_id, - const gchar *symbol) -{ - JsonScannerKey *key_p; - JsonScannerKey key; - - key.scope_id = scope_id; - - if (!scanner->config->case_sensitive) - { - gchar *d; - const gchar *c; - - key.symbol = g_new (gchar, strlen (symbol) + 1); - for (d = key.symbol, c = symbol; *c; c++, d++) - *d = to_lower (*c); - *d = 0; - key_p = g_hash_table_lookup (scanner->symbol_table, &key); - g_free (key.symbol); - } - else - { - key.symbol = (gchar*) symbol; - key_p = g_hash_table_lookup (scanner->symbol_table, &key); - } - - return key_p; -} - -void -json_scanner_scope_add_symbol (JsonScanner *scanner, - guint scope_id, - const gchar *symbol, - gpointer value) -{ - JsonScannerKey *key; - - g_return_if_fail (scanner != NULL); - g_return_if_fail (symbol != NULL); - - key = json_scanner_lookup_internal (scanner, scope_id, symbol); - if (!key) - { - key = g_slice_new (JsonScannerKey); - key->scope_id = scope_id; - key->symbol = g_strdup (symbol); - key->value = value; - if (!scanner->config->case_sensitive) - { - gchar *c; - - c = key->symbol; - while (*c != 0) - { - *c = to_lower (*c); - c++; - } - } - - g_hash_table_insert (scanner->symbol_table, key, key); - } - else - key->value = value; -} - -void -json_scanner_scope_remove_symbol (JsonScanner *scanner, - guint scope_id, - const gchar *symbol) -{ - JsonScannerKey *key; - - g_return_if_fail (scanner != NULL); - g_return_if_fail (symbol != NULL); - - key = json_scanner_lookup_internal (scanner, scope_id, symbol); - if (key) - { - g_hash_table_remove (scanner->symbol_table, key); - g_free (key->symbol); - g_slice_free (JsonScannerKey, key); - } -} - -gpointer -json_scanner_lookup_symbol (JsonScanner *scanner, - const gchar *symbol) -{ - JsonScannerKey *key; - guint scope_id; - - g_return_val_if_fail (scanner != NULL, NULL); - - if (!symbol) - return NULL; - - scope_id = scanner->scope_id; - key = json_scanner_lookup_internal (scanner, scope_id, symbol); - if (!key && scope_id && scanner->config->scope_0_fallback) - key = json_scanner_lookup_internal (scanner, 0, symbol); - - if (key) - return key->value; - else - return NULL; -} - -gpointer -json_scanner_scope_lookup_symbol (JsonScanner *scanner, - guint scope_id, - const gchar *symbol) -{ - JsonScannerKey *key; - - g_return_val_if_fail (scanner != NULL, NULL); - - if (!symbol) - return NULL; - - key = json_scanner_lookup_internal (scanner, scope_id, symbol); - - if (key) - return key->value; - else - return NULL; -} - -guint -json_scanner_set_scope (JsonScanner *scanner, - guint scope_id) -{ - guint old_scope_id; - - g_return_val_if_fail (scanner != NULL, 0); - - old_scope_id = scanner->scope_id; - scanner->scope_id = scope_id; - - return old_scope_id; -} - -typedef struct { - GHFunc func; - gpointer data; - guint scope_id; -} ForeachClosure; - -static void -json_scanner_foreach_internal (gpointer _key, - gpointer _value, - gpointer _user_data) -{ - JsonScannerKey *key = _value; - ForeachClosure *closure = _user_data; - - if (key->scope_id == closure->scope_id) - closure->func (key->symbol, key->value, closure->data); -} - -void -json_scanner_scope_foreach_symbol (JsonScanner *scanner, - guint scope_id, - GHFunc func, - gpointer user_data) -{ - ForeachClosure closure; - - g_return_if_fail (scanner != NULL); - g_return_if_fail (func != NULL); - - closure.func = func; - closure.data = user_data; - closure.scope_id = scope_id; - - g_hash_table_foreach (scanner->symbol_table, - json_scanner_foreach_internal, - &closure); -} - -GTokenType -json_scanner_peek_next_token (JsonScanner *scanner) -{ - g_return_val_if_fail (scanner != NULL, G_TOKEN_EOF); - - if (scanner->next_token == G_TOKEN_NONE) - { - scanner->next_line = scanner->line; - scanner->next_position = scanner->position; - json_scanner_get_token_i (scanner, - &scanner->next_token, - &scanner->next_value, - &scanner->next_line, - &scanner->next_position); - } - - return scanner->next_token; -} - -GTokenType -json_scanner_get_next_token (JsonScanner *scanner) -{ - g_return_val_if_fail (scanner != NULL, G_TOKEN_EOF); - - if (scanner->next_token != G_TOKEN_NONE) - { - json_scanner_free_value (&scanner->token, &scanner->value); - - scanner->token = scanner->next_token; - scanner->value = scanner->next_value; - scanner->line = scanner->next_line; - scanner->position = scanner->next_position; - scanner->next_token = G_TOKEN_NONE; - } - else - json_scanner_get_token_i (scanner, - &scanner->token, - &scanner->value, - &scanner->line, - &scanner->position); - - return scanner->token; -} - -GTokenType -json_scanner_cur_token (JsonScanner *scanner) -{ - g_return_val_if_fail (scanner != NULL, G_TOKEN_EOF); - - return scanner->token; -} - -GTokenValue -json_scanner_cur_value (JsonScanner *scanner) -{ - GTokenValue v; - - v.v_int64 = 0; - - g_return_val_if_fail (scanner != NULL, v); - - /* MSC isn't capable of handling return scanner->value; ? */ - - v = scanner->value; - - return v; -} - -guint -json_scanner_cur_line (JsonScanner *scanner) -{ - g_return_val_if_fail (scanner != NULL, 0); - - return scanner->line; -} - -guint -json_scanner_cur_position (JsonScanner *scanner) -{ - g_return_val_if_fail (scanner != NULL, 0); - - return scanner->position; -} - -gboolean -json_scanner_eof (JsonScanner *scanner) -{ - g_return_val_if_fail (scanner != NULL, TRUE); - - return scanner->token == G_TOKEN_EOF || scanner->token == G_TOKEN_ERROR; -} - -void -json_scanner_input_file (JsonScanner *scanner, - gint input_fd) -{ - g_return_if_fail (scanner != NULL); - g_return_if_fail (input_fd >= 0); - - if (scanner->input_fd >= 0) - json_scanner_sync_file_offset (scanner); - - scanner->token = G_TOKEN_NONE; - scanner->value.v_int64 = 0; - scanner->line = 1; - scanner->position = 0; - scanner->next_token = G_TOKEN_NONE; - - scanner->input_fd = input_fd; - scanner->text = NULL; - scanner->text_end = NULL; - - if (!scanner->buffer) - scanner->buffer = g_new (gchar, READ_BUFFER_SIZE + 1); -} - -void -json_scanner_input_text (JsonScanner *scanner, - const gchar *text, - guint text_len) -{ - g_return_if_fail (scanner != NULL); - if (text_len) - g_return_if_fail (text != NULL); - else - text = NULL; - - if (scanner->input_fd >= 0) - json_scanner_sync_file_offset (scanner); - - scanner->token = G_TOKEN_NONE; - scanner->value.v_int64 = 0; - scanner->line = 1; - scanner->position = 0; - scanner->next_token = G_TOKEN_NONE; - - scanner->input_fd = -1; - scanner->text = text; - scanner->text_end = text + text_len; - - if (scanner->buffer) - { - g_free (scanner->buffer); - scanner->buffer = NULL; - } -} - -static guchar -json_scanner_peek_next_char (JsonScanner *scanner) -{ - if (scanner->text < scanner->text_end) - return *scanner->text; - else if (scanner->input_fd >= 0) - { - gint count; - gchar *buffer; - - buffer = scanner->buffer; - do - { - count = read (scanner->input_fd, buffer, READ_BUFFER_SIZE); - } - while (count == -1 && (errno == EINTR || errno == EAGAIN)); - - if (count < 1) - { - scanner->input_fd = -1; - - return 0; - } - else - { - scanner->text = buffer; - scanner->text_end = buffer + count; - - return *buffer; - } - } - else - return 0; -} - -void -json_scanner_sync_file_offset (JsonScanner *scanner) -{ - g_return_if_fail (scanner != NULL); - - /* for file input, rewind the filedescriptor to the current - * buffer position and blow the file read ahead buffer. useful - * for third party uses of our file descriptor, which hooks - * onto the current scanning position. - */ - - if (scanner->input_fd >= 0 && scanner->text_end > scanner->text) - { - gint buffered; - - buffered = scanner->text_end - scanner->text; - if (lseek (scanner->input_fd, - buffered, SEEK_CUR) >= 0) - { - /* we succeeded, blow our buffer's contents now */ - scanner->text = NULL; - scanner->text_end = NULL; - } - else - errno = 0; - } -} - -static guchar -json_scanner_get_char (JsonScanner *scanner, - guint *line_p, - guint *position_p) -{ - guchar fchar; - - if (scanner->text < scanner->text_end) - fchar = *(scanner->text++); - else if (scanner->input_fd >= 0) - { - gint count; - gchar *buffer; - - buffer = scanner->buffer; - do - { - count = read (scanner->input_fd, buffer, READ_BUFFER_SIZE); - } - while (count == -1 && (errno == EINTR || errno == EAGAIN)); - - if (count < 1) - { - scanner->input_fd = -1; - fchar = 0; - } - else - { - scanner->text = buffer + 1; - scanner->text_end = buffer + count; - fchar = *buffer; - if (!fchar) - { - json_scanner_sync_file_offset (scanner); - scanner->text_end = scanner->text; - scanner->input_fd = -1; - } - } - } - else - fchar = 0; - - if (fchar == '\n') - { - (*position_p) = 0; - (*line_p)++; - } - else if (fchar) - { - (*position_p)++; - } - - return fchar; -} - -#define is_hex_digit(c) (((c) >= '0' && (c) <= '9') || \ - ((c) >= 'a' && (c) <= 'f') || \ - ((c) >= 'A' && (c) <= 'F')) -#define to_hex_digit(c) (((c) <= '9') ? (c) - '0' : ((c) & 7) + 9) - -static gunichar -json_scanner_get_unichar (JsonScanner *scanner, - guint *line_p, - guint *position_p) -{ - gunichar uchar; - gchar ch; - gint i; - - uchar = 0; - for (i = 0; i < 4; i++) - { - ch = json_scanner_get_char (scanner, line_p, position_p); - - if (is_hex_digit (ch)) - uchar += ((gunichar) to_hex_digit (ch) << ((3 - i) * 4)); - else - break; - } - - g_assert (g_unichar_validate (uchar)); - - return uchar; -} - -void -json_scanner_unexp_token (JsonScanner *scanner, - GTokenType expected_token, - const gchar *identifier_spec, - const gchar *symbol_spec, - const gchar *symbol_name, - const gchar *message, - gint is_error) -{ - gchar *token_string; - guint token_string_len; - gchar *expected_string; - guint expected_string_len; - gchar *message_prefix; - gboolean print_unexp; - void (*msg_handler) (JsonScanner*, const gchar*, ...); - - g_return_if_fail (scanner != NULL); - - if (is_error) - msg_handler = json_scanner_error; - else - msg_handler = json_scanner_warn; - - if (!identifier_spec) - identifier_spec = "identifier"; - if (!symbol_spec) - symbol_spec = "symbol"; - - token_string_len = 56; - token_string = g_new (gchar, token_string_len + 1); - expected_string_len = 64; - expected_string = g_new (gchar, expected_string_len + 1); - print_unexp = TRUE; - - switch (scanner->token) - { - case G_TOKEN_EOF: - g_snprintf (token_string, token_string_len, "end of file"); - break; - - default: - if (scanner->token >= 1 && scanner->token <= 255) - { - if ((scanner->token >= ' ' && scanner->token <= '~') || - strchr (scanner->config->cset_identifier_first, scanner->token) || - strchr (scanner->config->cset_identifier_nth, scanner->token)) - g_snprintf (token_string, token_string_len, "character `%c'", scanner->token); - else - g_snprintf (token_string, token_string_len, "character `\\%o'", scanner->token); - break; - } - else if (!scanner->config->symbol_2_token) - { - g_snprintf (token_string, token_string_len, "(unknown) token <%d>", scanner->token); - break; - } - /* fall through */ - case G_TOKEN_SYMBOL: - if (expected_token == G_TOKEN_SYMBOL || - (scanner->config->symbol_2_token && - expected_token > G_TOKEN_LAST)) - print_unexp = FALSE; - if (symbol_name) - g_snprintf (token_string, token_string_len, - "%s%s `%s'", - print_unexp ? "" : "invalid ", - symbol_spec, - symbol_name); - else - g_snprintf (token_string, token_string_len, - "%s%s", - print_unexp ? "" : "invalid ", - symbol_spec); - break; - - case G_TOKEN_ERROR: - print_unexp = FALSE; - expected_token = G_TOKEN_NONE; - switch (scanner->value.v_error) - { - case G_ERR_UNEXP_EOF: - g_snprintf (token_string, token_string_len, "scanner: unexpected end of file"); - break; - - case G_ERR_UNEXP_EOF_IN_STRING: - g_snprintf (token_string, token_string_len, "scanner: unterminated string constant"); - break; - - case G_ERR_UNEXP_EOF_IN_COMMENT: - g_snprintf (token_string, token_string_len, "scanner: unterminated comment"); - break; - - case G_ERR_NON_DIGIT_IN_CONST: - g_snprintf (token_string, token_string_len, "scanner: non digit in constant"); - break; - - case G_ERR_FLOAT_RADIX: - g_snprintf (token_string, token_string_len, "scanner: invalid radix for floating constant"); - break; - - case G_ERR_FLOAT_MALFORMED: - g_snprintf (token_string, token_string_len, "scanner: malformed floating constant"); - break; - - case G_ERR_DIGIT_RADIX: - g_snprintf (token_string, token_string_len, "scanner: digit is beyond radix"); - break; - - case G_ERR_UNKNOWN: - default: - g_snprintf (token_string, token_string_len, "scanner: unknown error"); - break; - } - break; - - case G_TOKEN_CHAR: - g_snprintf (token_string, token_string_len, "character `%c'", scanner->value.v_char); - break; - - case G_TOKEN_IDENTIFIER: - case G_TOKEN_IDENTIFIER_NULL: - if (expected_token == G_TOKEN_IDENTIFIER || - expected_token == G_TOKEN_IDENTIFIER_NULL) - print_unexp = FALSE; - g_snprintf (token_string, token_string_len, - "%s%s `%s'", - print_unexp ? "" : "invalid ", - identifier_spec, - scanner->token == G_TOKEN_IDENTIFIER ? scanner->value.v_string : "null"); - break; - - case G_TOKEN_BINARY: - case G_TOKEN_OCTAL: - case G_TOKEN_INT: - case G_TOKEN_HEX: - if (scanner->config->store_int64) - g_snprintf (token_string, token_string_len, "number `%" G_GUINT64_FORMAT "'", scanner->value.v_int64); - else - g_snprintf (token_string, token_string_len, "number `%lu'", scanner->value.v_int); - break; - - case G_TOKEN_FLOAT: - g_snprintf (token_string, token_string_len, "number `%.3f'", scanner->value.v_float); - break; - - case G_TOKEN_STRING: - if (expected_token == G_TOKEN_STRING) - print_unexp = FALSE; - g_snprintf (token_string, token_string_len, - "%s%sstring constant \"%s\"", - print_unexp ? "" : "invalid ", - scanner->value.v_string[0] == 0 ? "empty " : "", - scanner->value.v_string); - token_string[token_string_len - 2] = '"'; - token_string[token_string_len - 1] = 0; - break; - - case G_TOKEN_COMMENT_SINGLE: - case G_TOKEN_COMMENT_MULTI: - g_snprintf (token_string, token_string_len, "comment"); - break; - - case G_TOKEN_NONE: - /* somehow the user's parsing code is screwed, there isn't much - * we can do about it. - * Note, a common case to trigger this is - * json_scanner_peek_next_token(); json_scanner_unexp_token(); - * without an intermediate json_scanner_get_next_token(). - */ - g_assert_not_reached (); - break; - } - - - switch (expected_token) - { - gboolean need_valid; - gchar *tstring; - case G_TOKEN_EOF: - g_snprintf (expected_string, expected_string_len, "end of file"); - break; - default: - if (expected_token >= 1 && expected_token <= 255) - { - if ((expected_token >= ' ' && expected_token <= '~') || - strchr (scanner->config->cset_identifier_first, expected_token) || - strchr (scanner->config->cset_identifier_nth, expected_token)) - g_snprintf (expected_string, expected_string_len, "character `%c'", expected_token); - else - g_snprintf (expected_string, expected_string_len, "character `\\%o'", expected_token); - break; - } - else if (!scanner->config->symbol_2_token) - { - g_snprintf (expected_string, expected_string_len, "(unknown) token <%d>", expected_token); - break; - } - /* fall through */ - case G_TOKEN_SYMBOL: - need_valid = (scanner->token == G_TOKEN_SYMBOL || - (scanner->config->symbol_2_token && - scanner->token > G_TOKEN_LAST)); - g_snprintf (expected_string, expected_string_len, - "%s%s", - need_valid ? "valid " : "", - symbol_spec); - /* FIXME: should we attempt to lookup the symbol_name for symbol_2_token? */ - break; - case G_TOKEN_CHAR: - g_snprintf (expected_string, expected_string_len, "%scharacter", - scanner->token == G_TOKEN_CHAR ? "valid " : ""); - break; - case G_TOKEN_BINARY: - tstring = "binary"; - g_snprintf (expected_string, expected_string_len, "%snumber (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_OCTAL: - tstring = "octal"; - g_snprintf (expected_string, expected_string_len, "%snumber (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_INT: - tstring = "integer"; - g_snprintf (expected_string, expected_string_len, "%snumber (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_HEX: - tstring = "hexadecimal"; - g_snprintf (expected_string, expected_string_len, "%snumber (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_FLOAT: - tstring = "float"; - g_snprintf (expected_string, expected_string_len, "%snumber (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_STRING: - g_snprintf (expected_string, - expected_string_len, - "%sstring constant", - scanner->token == G_TOKEN_STRING ? "valid " : ""); - break; - case G_TOKEN_IDENTIFIER: - case G_TOKEN_IDENTIFIER_NULL: - need_valid = (scanner->token == G_TOKEN_IDENTIFIER_NULL || - scanner->token == G_TOKEN_IDENTIFIER); - g_snprintf (expected_string, - expected_string_len, - "%s%s", - need_valid ? "valid " : "", - identifier_spec); - break; - case G_TOKEN_COMMENT_SINGLE: - tstring = "single-line"; - g_snprintf (expected_string, expected_string_len, "%scomment (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_COMMENT_MULTI: - tstring = "multi-line"; - g_snprintf (expected_string, expected_string_len, "%scomment (%s)", - scanner->token == expected_token ? "valid " : "", tstring); - break; - case G_TOKEN_NONE: - case G_TOKEN_ERROR: - /* this is handled upon printout */ - break; - } - - if (message && message[0] != 0) - message_prefix = " - "; - else - { - message_prefix = ""; - message = ""; - } - if (expected_token == G_TOKEN_ERROR) - { - msg_handler (scanner, - "failure around %s%s%s", - token_string, - message_prefix, - message); - } - else if (expected_token == G_TOKEN_NONE) - { - if (print_unexp) - msg_handler (scanner, - "unexpected %s%s%s", - token_string, - message_prefix, - message); - else - msg_handler (scanner, - "%s%s%s", - token_string, - message_prefix, - message); - } - else - { - if (print_unexp) - msg_handler (scanner, - "unexpected %s, expected %s%s%s", - token_string, - expected_string, - message_prefix, - message); - else - msg_handler (scanner, - "%s, expected %s%s%s", - token_string, - expected_string, - message_prefix, - message); - } - - g_free (token_string); - g_free (expected_string); -} - -static void -json_scanner_get_token_i (JsonScanner *scanner, - GTokenType *token_p, - GTokenValue *value_p, - guint *line_p, - guint *position_p) -{ - do - { - json_scanner_free_value (token_p, value_p); - json_scanner_get_token_ll (scanner, token_p, value_p, line_p, position_p); - } - while (((*token_p > 0 && *token_p < 256) && - strchr (scanner->config->cset_skip_characters, *token_p)) || - (*token_p == G_TOKEN_CHAR && - strchr (scanner->config->cset_skip_characters, value_p->v_char)) || - (*token_p == G_TOKEN_COMMENT_MULTI && - scanner->config->skip_comment_multi) || - (*token_p == G_TOKEN_COMMENT_SINGLE && - scanner->config->skip_comment_single)); - - switch (*token_p) - { - case G_TOKEN_IDENTIFIER: - if (scanner->config->identifier_2_string) - *token_p = G_TOKEN_STRING; - break; - - case G_TOKEN_SYMBOL: - if (scanner->config->symbol_2_token) - *token_p = (GTokenType) value_p->v_symbol; - break; - - case G_TOKEN_BINARY: - case G_TOKEN_OCTAL: - case G_TOKEN_HEX: - if (scanner->config->numbers_2_int) - *token_p = G_TOKEN_INT; - break; - - default: - break; - } - - if (*token_p == G_TOKEN_INT && - scanner->config->int_2_float) - { - *token_p = G_TOKEN_FLOAT; - if (scanner->config->store_int64) - { -#ifdef _MSC_VER - /* work around error C2520, see gvaluetransform.c */ - value_p->v_float = (__int64)value_p->v_int64; -#else - value_p->v_float = value_p->v_int64; -#endif - } - else - value_p->v_float = value_p->v_int; - } - - errno = 0; -} - -static void -json_scanner_get_token_ll (JsonScanner *scanner, - GTokenType *token_p, - GTokenValue *value_p, - guint *line_p, - guint *position_p) -{ - JsonScannerConfig *config; - GTokenType token; - gboolean in_comment_multi; - gboolean in_comment_single; - gboolean in_string_sq; - gboolean in_string_dq; - GString *gstring; - GTokenValue value; - guchar ch; - - config = scanner->config; - (*value_p).v_int64 = 0; - - if ((scanner->text >= scanner->text_end && scanner->input_fd < 0) || - scanner->token == G_TOKEN_EOF) - { - *token_p = G_TOKEN_EOF; - return; - } - - in_comment_multi = FALSE; - in_comment_single = FALSE; - in_string_sq = FALSE; - in_string_dq = FALSE; - gstring = NULL; - - do /* while (ch != 0) */ - { - gboolean dotted_float = FALSE; - - ch = json_scanner_get_char (scanner, line_p, position_p); - - value.v_int64 = 0; - token = G_TOKEN_NONE; - - /* this is *evil*, but needed ;( - * we first check for identifier first character, because it - * might interfere with other key chars like slashes or numbers - */ - if (config->scan_identifier && - ch && strchr (config->cset_identifier_first, ch)) - goto identifier_precedence; - - switch (ch) - { - case 0: - token = G_TOKEN_EOF; - (*position_p)++; - /* ch = 0; */ - break; - - case '/': - if (!config->scan_comment_multi || - json_scanner_peek_next_char (scanner) != '*') - goto default_case; - json_scanner_get_char (scanner, line_p, position_p); - token = G_TOKEN_COMMENT_MULTI; - in_comment_multi = TRUE; - gstring = g_string_new (NULL); - while ((ch = json_scanner_get_char (scanner, line_p, position_p)) != 0) - { - if (ch == '*' && json_scanner_peek_next_char (scanner) == '/') - { - json_scanner_get_char (scanner, line_p, position_p); - in_comment_multi = FALSE; - break; - } - else - gstring = g_string_append_c (gstring, ch); - } - ch = 0; - break; - - case '\'': - if (!config->scan_string_sq) - goto default_case; - token = G_TOKEN_STRING; - in_string_sq = TRUE; - gstring = g_string_new (NULL); - while ((ch = json_scanner_get_char (scanner, line_p, position_p)) != 0) - { - if (ch == '\'') - { - in_string_sq = FALSE; - break; - } - else - gstring = g_string_append_c (gstring, ch); - } - ch = 0; - break; - - case '"': - if (!config->scan_string_dq) - goto default_case; - token = G_TOKEN_STRING; - in_string_dq = TRUE; - gstring = g_string_new (NULL); - while ((ch = json_scanner_get_char (scanner, line_p, position_p)) != 0) - { - if (ch == '"') - { - in_string_dq = FALSE; - break; - } - else - { - if (ch == '\\') - { - ch = json_scanner_get_char (scanner, line_p, position_p); - switch (ch) - { - guint i; - guint fchar; - - case 0: - break; - - case '\\': - gstring = g_string_append_c (gstring, '\\'); - break; - - case 'n': - gstring = g_string_append_c (gstring, '\n'); - break; - - case 't': - gstring = g_string_append_c (gstring, '\t'); - break; - - case 'r': - gstring = g_string_append_c (gstring, '\r'); - break; - - case 'b': - gstring = g_string_append_c (gstring, '\b'); - break; - - case 'f': - gstring = g_string_append_c (gstring, '\f'); - break; - - case 'u': - fchar = json_scanner_peek_next_char (scanner); - if (is_hex_digit (fchar)) - { - gunichar ucs; - - ucs = json_scanner_get_unichar (scanner, line_p, position_p); - gstring = g_string_append_unichar (gstring, ucs); - } - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - i = ch - '0'; - fchar = json_scanner_peek_next_char (scanner); - if (fchar >= '0' && fchar <= '7') - { - ch = json_scanner_get_char (scanner, line_p, position_p); - i = i * 8 + ch - '0'; - fchar = json_scanner_peek_next_char (scanner); - if (fchar >= '0' && fchar <= '7') - { - ch = json_scanner_get_char (scanner, line_p, position_p); - i = i * 8 + ch - '0'; - } - } - gstring = g_string_append_c (gstring, i); - break; - - default: - gstring = g_string_append_c (gstring, ch); - break; - } - } - else - gstring = g_string_append_c (gstring, ch); - } - } - ch = 0; - break; - - case '.': - if (!config->scan_float) - goto default_case; - token = G_TOKEN_FLOAT; - dotted_float = TRUE; - ch = json_scanner_get_char (scanner, line_p, position_p); - goto number_parsing; - - case '$': - if (!config->scan_hex_dollar) - goto default_case; - token = G_TOKEN_HEX; - ch = json_scanner_get_char (scanner, line_p, position_p); - goto number_parsing; - - case '0': - if (config->scan_octal) - token = G_TOKEN_OCTAL; - else - token = G_TOKEN_INT; - ch = json_scanner_peek_next_char (scanner); - if (config->scan_hex && (ch == 'x' || ch == 'X')) - { - token = G_TOKEN_HEX; - json_scanner_get_char (scanner, line_p, position_p); - ch = json_scanner_get_char (scanner, line_p, position_p); - if (ch == 0) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_UNEXP_EOF; - (*position_p)++; - break; - } - if (json_scanner_char_2_num (ch, 16) < 0) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_DIGIT_RADIX; - ch = 0; - break; - } - } - else if (config->scan_binary && (ch == 'b' || ch == 'B')) - { - token = G_TOKEN_BINARY; - json_scanner_get_char (scanner, line_p, position_p); - ch = json_scanner_get_char (scanner, line_p, position_p); - if (ch == 0) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_UNEXP_EOF; - (*position_p)++; - break; - } - if (json_scanner_char_2_num (ch, 10) < 0) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_NON_DIGIT_IN_CONST; - ch = 0; - break; - } - } - else - ch = '0'; - /* fall through */ - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - number_parsing: - { - gboolean in_number = TRUE; - gchar *endptr; - - if (token == G_TOKEN_NONE) - token = G_TOKEN_INT; - - gstring = g_string_new (dotted_float ? "0." : ""); - gstring = g_string_append_c (gstring, ch); - - do /* while (in_number) */ - { - gboolean is_E; - - is_E = token == G_TOKEN_FLOAT && (ch == 'e' || ch == 'E'); - - ch = json_scanner_peek_next_char (scanner); - - if (json_scanner_char_2_num (ch, 36) >= 0 || - (config->scan_float && ch == '.') || - (is_E && (ch == '+' || ch == '-'))) - { - ch = json_scanner_get_char (scanner, line_p, position_p); - - switch (ch) - { - case '.': - if (token != G_TOKEN_INT && token != G_TOKEN_OCTAL) - { - value.v_error = token == G_TOKEN_FLOAT ? G_ERR_FLOAT_MALFORMED : G_ERR_FLOAT_RADIX; - token = G_TOKEN_ERROR; - in_number = FALSE; - } - else - { - token = G_TOKEN_FLOAT; - gstring = g_string_append_c (gstring, ch); - } - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - gstring = g_string_append_c (gstring, ch); - break; - - case '-': - case '+': - if (token != G_TOKEN_FLOAT) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_NON_DIGIT_IN_CONST; - in_number = FALSE; - } - else - gstring = g_string_append_c (gstring, ch); - break; - - case 'e': - case 'E': - if ((token != G_TOKEN_HEX && !config->scan_float) || - (token != G_TOKEN_HEX && - token != G_TOKEN_OCTAL && - token != G_TOKEN_FLOAT && - token != G_TOKEN_INT)) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_NON_DIGIT_IN_CONST; - in_number = FALSE; - } - else - { - if (token != G_TOKEN_HEX) - token = G_TOKEN_FLOAT; - gstring = g_string_append_c (gstring, ch); - } - break; - - default: - if (token != G_TOKEN_HEX) - { - token = G_TOKEN_ERROR; - value.v_error = G_ERR_NON_DIGIT_IN_CONST; - in_number = FALSE; - } - else - gstring = g_string_append_c (gstring, ch); - break; - } - } - else - in_number = FALSE; - } - while (in_number); - - endptr = NULL; - if (token == G_TOKEN_FLOAT) - value.v_float = g_strtod (gstring->str, &endptr); - else - { - guint64 ui64 = 0; - switch (token) - { - case G_TOKEN_BINARY: - ui64 = g_ascii_strtoull (gstring->str, &endptr, 2); - break; - case G_TOKEN_OCTAL: - ui64 = g_ascii_strtoull (gstring->str, &endptr, 8); - break; - case G_TOKEN_INT: - ui64 = g_ascii_strtoull (gstring->str, &endptr, 10); - break; - case G_TOKEN_HEX: - ui64 = g_ascii_strtoull (gstring->str, &endptr, 16); - break; - default: ; - } - if (scanner->config->store_int64) - value.v_int64 = ui64; - else - value.v_int = ui64; - } - if (endptr && *endptr) - { - token = G_TOKEN_ERROR; - if (*endptr == 'e' || *endptr == 'E') - value.v_error = G_ERR_NON_DIGIT_IN_CONST; - else - value.v_error = G_ERR_DIGIT_RADIX; - } - g_string_free (gstring, TRUE); - gstring = NULL; - ch = 0; - } /* number_parsing:... */ - break; - - default: - default_case: - { - if (config->cpair_comment_single && - ch == config->cpair_comment_single[0]) - { - token = G_TOKEN_COMMENT_SINGLE; - in_comment_single = TRUE; - gstring = g_string_new (NULL); - ch = json_scanner_get_char (scanner, line_p, position_p); - while (ch != 0) - { - if (ch == config->cpair_comment_single[1]) - { - in_comment_single = FALSE; - ch = 0; - break; - } - - gstring = g_string_append_c (gstring, ch); - ch = json_scanner_get_char (scanner, line_p, position_p); - } - /* ignore a missing newline at EOF for single line comments */ - if (in_comment_single && - config->cpair_comment_single[1] == '\n') - in_comment_single = FALSE; - } - else if (config->scan_identifier && ch && - strchr (config->cset_identifier_first, ch)) - { - identifier_precedence: - - if (config->cset_identifier_nth && ch && - strchr (config->cset_identifier_nth, - json_scanner_peek_next_char (scanner))) - { - token = G_TOKEN_IDENTIFIER; - gstring = g_string_new (NULL); - gstring = g_string_append_c (gstring, ch); - do - { - ch = json_scanner_get_char (scanner, line_p, position_p); - gstring = g_string_append_c (gstring, ch); - ch = json_scanner_peek_next_char (scanner); - } - while (ch && strchr (config->cset_identifier_nth, ch)); - ch = 0; - } - else if (config->scan_identifier_1char) - { - token = G_TOKEN_IDENTIFIER; - value.v_identifier = g_new0 (gchar, 2); - value.v_identifier[0] = ch; - ch = 0; - } - } - if (ch) - { - if (config->char_2_token) - token = ch; - else - { - token = G_TOKEN_CHAR; - value.v_char = ch; - } - ch = 0; - } - } /* default_case:... */ - break; - } - g_assert (ch == 0 && token != G_TOKEN_NONE); /* paranoid */ - } - while (ch != 0); - - if (in_comment_multi || in_comment_single || - in_string_sq || in_string_dq) - { - token = G_TOKEN_ERROR; - if (gstring) - { - g_string_free (gstring, TRUE); - gstring = NULL; - } - (*position_p)++; - if (in_comment_multi || in_comment_single) - value.v_error = G_ERR_UNEXP_EOF_IN_COMMENT; - else /* (in_string_sq || in_string_dq) */ - value.v_error = G_ERR_UNEXP_EOF_IN_STRING; - } - - if (gstring) - { - value.v_string = g_string_free (gstring, FALSE); - gstring = NULL; - } - - if (token == G_TOKEN_IDENTIFIER) - { - if (config->scan_symbols) - { - JsonScannerKey *key; - guint scope_id; - - scope_id = scanner->scope_id; - key = json_scanner_lookup_internal (scanner, scope_id, value.v_identifier); - if (!key && scope_id && scanner->config->scope_0_fallback) - key = json_scanner_lookup_internal (scanner, 0, value.v_identifier); - - if (key) - { - g_free (value.v_identifier); - token = G_TOKEN_SYMBOL; - value.v_symbol = key->value; - } - } - - if (token == G_TOKEN_IDENTIFIER && - config->scan_identifier_NULL && - strlen (value.v_identifier) == 4) - { - gchar *null_upper = "NULL"; - gchar *null_lower = "null"; - - if (scanner->config->case_sensitive) - { - if (value.v_identifier[0] == null_upper[0] && - value.v_identifier[1] == null_upper[1] && - value.v_identifier[2] == null_upper[2] && - value.v_identifier[3] == null_upper[3]) - token = G_TOKEN_IDENTIFIER_NULL; - } - else - { - if ((value.v_identifier[0] == null_upper[0] || - value.v_identifier[0] == null_lower[0]) && - (value.v_identifier[1] == null_upper[1] || - value.v_identifier[1] == null_lower[1]) && - (value.v_identifier[2] == null_upper[2] || - value.v_identifier[2] == null_lower[2]) && - (value.v_identifier[3] == null_upper[3] || - value.v_identifier[3] == null_lower[3])) - token = G_TOKEN_IDENTIFIER_NULL; - } - } - } - - *token_p = token; - *value_p = value; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-scanner.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -/* json-scanner.h: Tokenizer for JSON - * - * This file is part of JSON-GLib - * Copyright (C) 2008 OpenedHand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * JsonScanner is a specialized tokenizer for JSON adapted from - * the GScanner tokenizer in GLib; GScanner came with this notice: - * - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - * - * JsonScanner: modified by Emmanuele Bassi - */ - -#ifndef __JSON_SCANNER_H__ -#define __JSON_SCANNER_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -typedef struct _JsonScanner JsonScanner; -typedef struct _JsonScannerConfig JsonScannerConfig; - -typedef void (* JsonScannerMsgFunc) (JsonScanner *scanner, - gchar *message, - gboolean is_error); - -/** - * JsonTokenType: - * @JSON_TOKEN_INVALID: marker - * @JSON_TOKEN_TRUE: symbol for 'true' bareword - * @JSON_TOKEN_FALSE: symbol for 'false' bareword - * @JSON_TOKEN_NULL: symbol for 'null' bareword - * @JSON_TOKEN_VAR: symbol for 'var' bareword - * @JSON_TOKEN_LAST: marker - * - * Tokens for JsonScanner-based parser, extending #GTokenType. - */ -typedef enum { - JSON_TOKEN_INVALID = G_TOKEN_LAST, - - JSON_TOKEN_TRUE, - JSON_TOKEN_FALSE, - JSON_TOKEN_NULL, - JSON_TOKEN_VAR, - - JSON_TOKEN_LAST -} JsonTokenType; - -/** - * JsonScanner: - * - * Tokenizer scanner for JSON. See #GScanner - * - * Since: 0.6 - */ -struct _JsonScanner -{ - /*< private >*/ - /* unused fields */ - gpointer user_data; - guint max_parse_errors; - - /* json_scanner_error() increments this field */ - guint parse_errors; - - /* name of input stream, featured by the default message handler */ - const gchar *input_name; - - /* quarked data */ - GData *qdata; - - /* link into the scanner configuration */ - JsonScannerConfig *config; - - /* fields filled in after json_scanner_get_next_token() */ - GTokenType token; - GTokenValue value; - guint line; - guint position; - - /* fields filled in after json_scanner_peek_next_token() */ - GTokenType next_token; - GTokenValue next_value; - guint next_line; - guint next_position; - - /* to be considered private */ - GHashTable *symbol_table; - gint input_fd; - const gchar *text; - const gchar *text_end; - gchar *buffer; - guint scope_id; - - /* handler function for _warn and _error */ - JsonScannerMsgFunc msg_handler; -}; - -JsonScanner *json_scanner_new (void); -void json_scanner_destroy (JsonScanner *scanner); -void json_scanner_input_file (JsonScanner *scanner, - gint input_fd); -void json_scanner_sync_file_offset (JsonScanner *scanner); -void json_scanner_input_text (JsonScanner *scanner, - const gchar *text, - guint text_len); -GTokenType json_scanner_get_next_token (JsonScanner *scanner); -GTokenType json_scanner_peek_next_token (JsonScanner *scanner); -GTokenType json_scanner_cur_token (JsonScanner *scanner); -GTokenValue json_scanner_cur_value (JsonScanner *scanner); -guint json_scanner_cur_line (JsonScanner *scanner); -guint json_scanner_cur_position (JsonScanner *scanner); -gboolean json_scanner_eof (JsonScanner *scanner); -guint json_scanner_set_scope (JsonScanner *scanner, - guint scope_id); -void json_scanner_scope_add_symbol (JsonScanner *scanner, - guint scope_id, - const gchar *symbol, - gpointer value); -void json_scanner_scope_remove_symbol (JsonScanner *scanner, - guint scope_id, - const gchar *symbol); -gpointer json_scanner_scope_lookup_symbol (JsonScanner *scanner, - guint scope_id, - const gchar *symbol); -void json_scanner_scope_foreach_symbol (JsonScanner *scanner, - guint scope_id, - GHFunc func, - gpointer user_data); -gpointer json_scanner_lookup_symbol (JsonScanner *scanner, - const gchar *symbol); -void json_scanner_unexp_token (JsonScanner *scanner, - GTokenType expected_token, - const gchar *identifier_spec, - const gchar *symbol_spec, - const gchar *symbol_name, - const gchar *message, - gint is_error); -void json_scanner_error (JsonScanner *scanner, - const gchar *format, - ...) G_GNUC_PRINTF (2,3); -void json_scanner_warn (JsonScanner *scanner, - const gchar *format, - ...) G_GNUC_PRINTF (2,3); - -G_END_DECLS - -#endif /* __JSON_SCANNER_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -/* json-types.h - JSON data types - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) -//#error "Only can be included directly." -#endif - -#ifndef __JSON_TYPES_H__ -#define __JSON_TYPES_H__ - -#include - -G_BEGIN_DECLS - -/** - * JSON_NODE_TYPE: - * @node: a #JsonNode - * - * Evaluates to the #JsonNodeType contained by @node - */ -#define JSON_NODE_TYPE(node) (json_node_get_node_type ((node))) - -#define JSON_TYPE_NODE (json_node_get_type ()) -#define JSON_TYPE_OBJECT (json_object_get_type ()) -#define JSON_TYPE_ARRAY (json_array_get_type ()) - -/** - * JsonNode: - * @type: the type of node - * - * A generic container of JSON data types. The contents of the #JsonNode - * structure are private and should only be accessed via the provided - * functions and never directly. - */ -typedef struct _JsonNode JsonNode; - -/** - * JsonObject: - * - * A JSON object type. The contents of the #JsonObject structure are private - * and should only be accessed by the provided API - */ -typedef struct _JsonObject JsonObject; - -/** - * JsonArray: - * - * A JSON array type. The contents of the #JsonArray structure are private - * and should only be accessed by the provided API - */ -typedef struct _JsonArray JsonArray; - -/** - * JsonNodeType: - * @JSON_NODE_OBJECT: The node contains a #JsonObject - * @JSON_NODE_ARRAY: The node contains a #JsonArray - * @JSON_NODE_VALUE: The node contains a fundamental type - * @JSON_NODE_NULL: Special type, for nodes containing null - * - * Indicates the content of a #JsonNode. - */ -typedef enum { - JSON_NODE_OBJECT, - JSON_NODE_ARRAY, - JSON_NODE_VALUE, - JSON_NODE_NULL -} JsonNodeType; - -/** - * JsonObjectForeach: - * @object: the iterated #JsonObject - * @member_name: the name of the member - * @member_node: a #JsonNode containing the @member_name value - * @user_data: data passed to the function - * - * The function to be passed to json_object_foreach_member(). You - * should not add or remove members to and from @object within - * this function. It is safe to change the value of @member_node. - * - * Since: 0.8 - */ -typedef void (* JsonObjectForeach) (JsonObject *object, - const gchar *member_name, - JsonNode *member_node, - gpointer user_data); - -/** - * JsonArrayForeach: - * @array: the iterated #JsonArray - * @index_: the index of the element - * @element_node: a #JsonNode containing the value at @index_ - * @user_data: data passed to the function - * - * The function to be passed to json_array_foreach_element(). You - * should not add or remove elements to and from @array within - * this function. It is safe to change the value of @element_node. - * - * Since: 0.8 - */ -typedef void (* JsonArrayForeach) (JsonArray *array, - guint index_, - JsonNode *element_node, - gpointer user_data); - -/* - * JsonNode - */ -GType json_node_get_type (void) G_GNUC_CONST; -JsonNode * json_node_new (JsonNodeType type); -JsonNode * json_node_copy (JsonNode *node); -void json_node_free (JsonNode *node); -JsonNodeType json_node_get_node_type (JsonNode *node); -GType json_node_get_value_type (JsonNode *node); -void json_node_set_parent (JsonNode *node, - JsonNode *parent); -JsonNode * json_node_get_parent (JsonNode *node); -G_CONST_RETURN gchar *json_node_type_name (JsonNode *node); - -void json_node_set_object (JsonNode *node, - JsonObject *object); -void json_node_take_object (JsonNode *node, - JsonObject *object); -JsonObject * json_node_get_object (JsonNode *node); -JsonObject * json_node_dup_object (JsonNode *node); -void json_node_set_array (JsonNode *node, - JsonArray *array); -void json_node_take_array (JsonNode *node, - JsonArray *array); -JsonArray * json_node_get_array (JsonNode *node); -JsonArray * json_node_dup_array (JsonNode *node); -void json_node_set_value (JsonNode *node, - const GValue *value); -void json_node_get_value (JsonNode *node, - GValue *value); -void json_node_set_string (JsonNode *node, - const gchar *value); -G_CONST_RETURN gchar *json_node_get_string (JsonNode *node); -gchar * json_node_dup_string (JsonNode *node); -void json_node_set_int (JsonNode *node, - gint64 value); -gint64 json_node_get_int (JsonNode *node); -void json_node_set_double (JsonNode *node, - gdouble value); -gdouble json_node_get_double (JsonNode *node); -void json_node_set_boolean (JsonNode *node, - gboolean value); -gboolean json_node_get_boolean (JsonNode *node); -gboolean json_node_is_null (JsonNode *node); - -/* - * JsonObject - */ -GType json_object_get_type (void) G_GNUC_CONST; -JsonObject * json_object_new (void); -JsonObject * json_object_ref (JsonObject *object); -void json_object_unref (JsonObject *object); - -#ifndef JSON_DISABLE_DEPRECATED -void json_object_add_member (JsonObject *object, - const gchar *member_name, - JsonNode *node) G_GNUC_DEPRECATED; -#endif /* JSON_DISABLE_DEPRECATED */ - -void json_object_set_member (JsonObject *object, - const gchar *member_name, - JsonNode *node); -void json_object_set_int_member (JsonObject *object, - const gchar *member_name, - gint64 value); -void json_object_set_double_member (JsonObject *object, - const gchar *member_name, - gdouble value); -void json_object_set_boolean_member (JsonObject *object, - const gchar *member_name, - gboolean value); -void json_object_set_string_member (JsonObject *object, - const gchar *member_name, - const gchar *value); -void json_object_set_null_member (JsonObject *object, - const gchar *member_name); -void json_object_set_array_member (JsonObject *object, - const gchar *member_name, - JsonArray *value); -void json_object_set_object_member (JsonObject *object, - const gchar *member_name, - JsonObject *value); -GList * json_object_get_members (JsonObject *object); -JsonNode * json_object_get_member (JsonObject *object, - const gchar *member_name); -JsonNode * json_object_dup_member (JsonObject *object, - const gchar *member_name); -gint64 json_object_get_int_member (JsonObject *object, - const gchar *member_name); -gdouble json_object_get_double_member (JsonObject *object, - const gchar *member_name); -gboolean json_object_get_boolean_member (JsonObject *object, - const gchar *member_name); -G_CONST_RETURN gchar *json_object_get_string_member (JsonObject *object, - const gchar *member_name); -gboolean json_object_get_null_member (JsonObject *object, - const gchar *member_name); -JsonArray * json_object_get_array_member (JsonObject *object, - const gchar *member_name); -JsonObject * json_object_get_object_member (JsonObject *object, - const gchar *member_name); -gboolean json_object_has_member (JsonObject *object, - const gchar *member_name); -void json_object_remove_member (JsonObject *object, - const gchar *member_name); -GList * json_object_get_values (JsonObject *object); -guint json_object_get_size (JsonObject *object); -void json_object_foreach_member (JsonObject *object, - JsonObjectForeach func, - gpointer data); - -GType json_array_get_type (void) G_GNUC_CONST; -JsonArray * json_array_new (void); -JsonArray * json_array_sized_new (guint n_elements); -JsonArray * json_array_ref (JsonArray *array); -void json_array_unref (JsonArray *array); -void json_array_add_element (JsonArray *array, - JsonNode *node); -void json_array_add_int_element (JsonArray *array, - gint64 value); -void json_array_add_double_element (JsonArray *array, - gdouble value); -void json_array_add_boolean_element (JsonArray *array, - gboolean value); -void json_array_add_string_element (JsonArray *array, - const gchar *value); -void json_array_add_null_element (JsonArray *array); -void json_array_add_array_element (JsonArray *array, - JsonArray *value); -void json_array_add_object_element (JsonArray *array, - JsonObject *value); -GList * json_array_get_elements (JsonArray *array); -JsonNode * json_array_get_element (JsonArray *array, - guint index_); -gint64 json_array_get_int_element (JsonArray *array, - guint index_); -gdouble json_array_get_double_element (JsonArray *array, - guint index_); -gboolean json_array_get_boolean_element (JsonArray *array, - guint index_); -G_CONST_RETURN gchar *json_array_get_string_element (JsonArray *array, - guint index_); -gboolean json_array_get_null_element (JsonArray *array, - guint index_); -JsonArray * json_array_get_array_element (JsonArray *array, - guint index_); -JsonObject * json_array_get_object_element (JsonArray *array, - guint index_); -JsonNode * json_array_dup_element (JsonArray *array, - guint index_); -void json_array_remove_element (JsonArray *array, - guint index_); -guint json_array_get_length (JsonArray *array); -void json_array_foreach_element (JsonArray *array, - JsonArrayForeach func, - gpointer data); - -G_END_DECLS - -#endif /* __JSON_TYPES_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types-private.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types-private.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types-private.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-types-private.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* json-types-private.h - JSON data types private header - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#ifndef __JSON_TYPES_PRIVATE_H__ -#define __JSON_TYPES_PRIVATE_H__ - -#include "json-types.h" - -G_BEGIN_DECLS - -struct _JsonNode -{ - /*< private >*/ - JsonNodeType type; - - union { - JsonObject *object; - JsonArray *array; - GValue value; - } data; - - JsonNode *parent; -}; - -struct _JsonArray -{ - GPtrArray *elements; - - volatile gint ref_count; -}; - -struct _JsonObject -{ - GHashTable *members; - - volatile gint ref_count; -}; - -G_END_DECLS - -#endif /* __JSON_TYPES_PRIVATE_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/* json-version.h - JSON-GLib versioning information - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * Author: - * Emmanuele Bassi - */ - -#ifndef __JSON_VERSION_H__ -#define __JSON_VERSION_H__ - -/** - * SECTION:json-version - * @short_description: JSON-GLib version checking - * - * JSON-GLib provides macros to check the version of the library - * at compile-time - */ - -/** - * JSON_MAJOR_VERSION: - * - * Json major version component (e.g. 1 if %JSON_VERSION is 1.2.3) - */ -#define JSON_MAJOR_VERSION (0) - -/** - * JSON_MINOR_VERSION: - * - * Json minor version component (e.g. 2 if %JSON_VERSION is 1.2.3) - */ -#define JSON_MINOR_VERSION (6) - -/** - * JSON_MICRO_VERSION: - * - * Json micro version component (e.g. 3 if %JSON_VERSION is 1.2.3) - */ -#define JSON_MICRO_VERSION (2) - -/** - * JSON_VERSION - * - * Json version. - */ -#define JSON_VERSION (0.6.2) - -/** - * JSON_VERSION_S: - * - * Json version, encoded as a string, useful for printing and - * concatenation. - */ -#define JSON_VERSION_S "0.6.2" - -/** - * JSON_VERSION_HEX: - * - * Json version, encoded as an hexadecimal number, useful for - * integer comparisons. - */ -#define JSON_VERSION_HEX (JSON_MAJOR_VERSION << 24 | \ - JSON_MINOR_VERSION << 16 | \ - JSON_MICRO_VERSION << 8) - -/** - * JSON_CHECK_VERSION: - * @major: required major version - * @minor: required minor version - * @micro: required micro version - * - * Compile-time version checking. Evaluates to %TRUE if the version - * of Json is greater than the required one. - */ -#define JSON_CHECK_VERSION(major,minor,micro) \ - (JSON_MAJOR_VERSION > (major) || \ - (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION > (minor)) || \ - (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION == (minor) && \ - JSON_MICRO_VERSION >= (micro))) - -#endif /* __JSON_VERSION_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/json-version.h.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -/* json-version.h - JSON-GLib versioning information - * - * This file is part of JSON-GLib - * Copyright (C) 2007 OpenedHand Ltd. - * Copyright (C) 2009 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * Author: - * Emmanuele Bassi - */ - -#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __JSON_VERSION_H__ -#define __JSON_VERSION_H__ - -/** - * SECTION:json-version - * @short_description: JSON-GLib version checking - * - * JSON-GLib provides macros to check the version of the library - * at compile-time - */ - -/** - * JSON_MAJOR_VERSION: - * - * Json major version component (e.g. 1 if %JSON_VERSION is 1.2.3) - */ -#define JSON_MAJOR_VERSION (@JSON_MAJOR_VERSION@) - -/** - * JSON_MINOR_VERSION: - * - * Json minor version component (e.g. 2 if %JSON_VERSION is 1.2.3) - */ -#define JSON_MINOR_VERSION (@JSON_MINOR_VERSION@) - -/** - * JSON_MICRO_VERSION: - * - * Json micro version component (e.g. 3 if %JSON_VERSION is 1.2.3) - */ -#define JSON_MICRO_VERSION (@JSON_MICRO_VERSION@) - -/** - * JSON_VERSION - * - * Json version. - */ -#define JSON_VERSION (@JSON_VERSION@) - -/** - * JSON_VERSION_S: - * - * Json version, encoded as a string, useful for printing and - * concatenation. - */ -#define JSON_VERSION_S "@JSON_VERSION@" - -/** - * JSON_VERSION_HEX: - * - * Json version, encoded as an hexadecimal number, useful for - * integer comparisons. - */ -#define JSON_VERSION_HEX (JSON_MAJOR_VERSION << 24 | \ - JSON_MINOR_VERSION << 16 | \ - JSON_MICRO_VERSION << 8) - -/** - * JSON_CHECK_VERSION: - * @major: required major version - * @minor: required minor version - * @micro: required micro version - * - * Compile-time version checking. Evaluates to %TRUE if the version - * of Json is greater than the required one. - */ -#define JSON_CHECK_VERSION(major,minor,micro) \ - (JSON_MAJOR_VERSION > (major) || \ - (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION > (minor)) || \ - (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION == (minor) && \ - JSON_MICRO_VERSION >= (micro))) - -#endif /* __JSON_VERSION_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -include $(top_srcdir)/Makefile.decl - -if USE_SHAVE -QUIET_GEN = $(Q:@=@echo ' GEN '$@;) -else -QUIET_GEN = $(AM_V_GEN) -endif # USE_SHAVE - -if ENABLE_GLIB_TEST -SUBDIRS = . tests -endif - -DIST_SUBDIRS = tests - -NULL = - -INCLUDES = \ - -I$(top_srcdir) \ - -DPREFIX=\""$(prefix)"\" \ - -DLIBDIR=\""$(libdir)"\" \ - -DJSON_COMPILATION=1 \ - -DG_DISABLE_DEPRECATED \ - -DG_LOG_DOMAIN=\"Json\" \ - $(NULL) - -LDADD = \ - $(JSON_LT_LDFLAGS) \ - -export-dynamic \ - -export-symbols-regex "^json.*" \ - -rpath $(libdir) - -AM_CPPFLAGS = $(JSON_CFLAGS) $(JSON_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) - -BUILT_SOURCES = json-marshal.h json-marshal.c json-enum-types.h json-enum-types.c - -STAMP_FILES = stamp-json-marshal.h stamp-json-enum-types.h - -source_h = \ - $(top_srcdir)/json-glib/json-generator.h \ - $(top_srcdir)/json-glib/json-gobject.h \ - $(top_srcdir)/json-glib/json-parser.h \ - $(top_srcdir)/json-glib/json-types.h \ - $(NULL) - -source_h_private = \ - $(top_srcdir)/json-glib/json-scanner.h \ - $(top_srcdir)/json-glib/json-types-private.h \ - $(NULL) - -source_c = \ - $(srcdir)/json-array.c \ - $(srcdir)/json-generator.c \ - $(srcdir)/json-gobject.c \ - $(srcdir)/json-node.c \ - $(srcdir)/json-object.c \ - $(srcdir)/json-parser.c \ - $(srcdir)/json-scanner.c \ - $(NULL) - -json-marshal.h: stamp-json-marshal.h - @true -stamp-json-marshal.h: Makefile json-marshal.list - $(QUIET_GEN)$(GLIB_GENMARSHAL) \ - --prefix=_json_marshal \ - --header \ - $(srcdir)/json-marshal.list > xgen-jmh \ - && (cmp -s xgen-jmh json-marshal.h || cp -f xgen-jmh json-marshal.h) \ - && rm -f xgen-jmh \ - && echo timestamp > $(@F) - -json-marshal.c: Makefile json-marshal.list - $(QUIET_GEN)(echo "#include \"json-marshal.h\"" ; \ - $(GLIB_GENMARSHAL) \ - --prefix=_json_marshal \ - --body \ - $(srcdir)/json-marshal.list ) > xgen-jmc \ - && cp -f xgen-jmc json-marshal.c \ - && rm -f xgen-jmc - -json-enum-types.h: stamp-json-enum-types.h - @true -stamp-json-enum-types.h: $(source_h) Makefile - $(QUIET_GEN)$(GLIB_MKENUMS) \ - --template $(srcdir)/json-enum-types.h.in \ - $(source_h) > xgen-ceth \ - && (cmp -s xgen-ceth json-enum-types.h || cp xgen-ceth json-enum-types.h) \ - && rm -f xgen-ceth \ - && echo timestamp > $(@F) - -json-enum-types.c: json-enum-types.h - $(QUIET_GEN)$(GLIB_MKENUMS) \ - --template $(srcdir)/json-enum-types.c.in \ - $(source_h) > xgen-cetc \ - && cp xgen-cetc json-enum-types.c \ - && rm -f xgen-cetc - -lib_LTLIBRARIES = libjson-glib-1.0.la - -libjson_glib_1_0_la_LIBADD = $(JSON_LIBS) -libjson_glib_1_0_la_SOURCES = \ - $(source_c) \ - $(source_h) \ - $(source_h_priv) \ - $(BUILT_SOURCES) \ - $(NULL) -libjson_glib_1_0_la_LDFLAGS = $(LDADD) - -jsonincludedir = $(includedir)/json-glib-1.0/json-glib -jsoninclude_DATA = \ - $(source_h) \ - $(top_builddir)/json-glib/json-enum-types.h \ - $(top_builddir)/json-glib/json-version.h \ - $(top_srcdir)/json-glib/json-glib.h \ - $(NULL) - -CLEANFILES = $(STAMP_FILES) $(BUILT_SOURCES) - -DISTCLEANFILES = json-version.h - -EXTRA_DIST += \ - json-version.h.in \ - json-types-private.h \ - json-scanner.h \ - json-glib.h \ - json-marshal.list \ - json-enum-types.h.in \ - json-enum-types.c.in \ - $(NULL) - -TESTS_ENVIRONMENT = srcdir="$(srcdir)" json_all_c_sources="$(source_c)" - -if HAVE_INTROSPECTION -BUILT_GIRSOURCES = - -Json-1.0.gir: $(INTROSPECTION_SCANNER) libjson-glib-1.0.la - $(QUIET_GEN)$(INTROSPECTION_SCANNER) \ - -v --namespace Json --nsversion=1.0 \ - $(INCLUDES) \ - --c-include='json-glib/json-object.h' \ - --include=GObject-2.0 \ - --library=json-glib-1.0 \ - --libtool="$(top_builddir)/libtool" \ - --pkg gobject-2.0 \ - --output $@ \ - $(source_h) \ - $(source_c) - -BUILT_GIRSOURCES += Json-1.0.gir - -# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to -# install anything - we need to install inside our prefix. -girdir = $(datadir)/gir-1.0 -gir_DATA = $(BUILT_GIRSOURCES) - -typelibsdir = $(libdir)/girepository-1.0/ -typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) - -%.typelib: %.gir $(INTROSPECTION_COMPILER) - $(QUIET_GEN)$(DEBUG) $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F) - -CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA) -endif # HAVE_INTROSPECTION diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/json-glib/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,803 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# JSON-GLib - JSON reader and writer library - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/json-version.h.in $(top_srcdir)/Makefile.decl -subdir = json-glib -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = json-version.h -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(jsonincludedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -libjson_glib_1_0_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_1 = -am__objects_2 = json-array.lo json-generator.lo json-gobject.lo \ - json-node.lo json-object.lo json-parser.lo json-scanner.lo \ - $(am__objects_1) -am__objects_3 = $(am__objects_1) -am__objects_4 = json-marshal.lo json-enum-types.lo -am_libjson_glib_1_0_la_OBJECTS = $(am__objects_2) $(am__objects_3) \ - $(am__objects_4) $(am__objects_1) -libjson_glib_1_0_la_OBJECTS = $(am_libjson_glib_1_0_la_OBJECTS) -libjson_glib_1_0_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libjson_glib_1_0_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libjson_glib_1_0_la_SOURCES) -DIST_SOURCES = $(libjson_glib_1_0_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -jsonincludeDATA_INSTALL = $(INSTALL_DATA) -DATA = $(jsoninclude_DATA) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GLIB_PREFIX = @GLIB_PREFIX@ -GOBJECT_QUERY = @GOBJECT_QUERY@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -JSON_CFLAGS = @JSON_CFLAGS@ -JSON_DEBUG_CFLAGS = @JSON_DEBUG_CFLAGS@ -JSON_LIBS = @JSON_LIBS@ -JSON_LT_LDFLAGS = @JSON_LT_LDFLAGS@ -JSON_MAJOR_VERSION = @JSON_MAJOR_VERSION@ -JSON_MICRO_VERSION = @JSON_MICRO_VERSION@ -JSON_MINOR_VERSION = @JSON_MINOR_VERSION@ -JSON_VERSION = @JSON_VERSION@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -GTESTER = gtester -GTESTER_REPORT = gtester-report - -# initialize variables for unconditional += appending -EXTRA_DIST = json-version.h.in json-scanner.h json-glib.h \ - json-marshal.list json-enum-types.h.in json-enum-types.c.in -TEST_PROGS = -SUBDIRS = . tests -DIST_SUBDIRS = tests -NULL = -INCLUDES = \ - -I$(top_srcdir) \ - -DPREFIX=\""$(prefix)"\" \ - -DLIBDIR=\""$(libdir)"\" \ - -DG_DISABLE_DEPRECATED \ - -DG_LOG_DOMAIN=\"Json\" \ - $(JSON_CFLAGS) \ - $(JSON_DEBUG_CFLAGS) \ - $(NULL) - -LDADD = \ - $(JSON_LT_LDFLAGS) \ - -export-dynamic \ - -export-symbols-regex "^json.*" \ - -rpath $(libdir) - -BUILT_SOURCES = json-marshal.h json-marshal.c json-enum-types.h json-enum-types.c -STAMP_FILES = stamp-json-marshal.h stamp-json-enum-types.h -source_h = \ - $(top_srcdir)/json-glib/json-generator.h \ - $(top_srcdir)/json-glib/json-gobject.h \ - $(top_srcdir)/json-glib/json-parser.h \ - $(top_srcdir)/json-glib/json-types.h \ - $(top_srcdir)/json-glib/json-version.h \ - $(NULL) - -source_h_private = \ - $(top_srcdir)/json-glib/json-scanner.h \ - $(NULL) - -source_c = \ - json-array.c \ - json-generator.c \ - json-gobject.c \ - json-node.c \ - json-object.c \ - json-parser.c \ - json-scanner.c \ - $(NULL) - -lib_LTLIBRARIES = libjson-glib-1.0.la -libjson_glib_1_0_la_LIBADD = $(JSON_LIBS) -libjson_glib_1_0_la_SOURCES = \ - $(source_c) \ - $(source_h) \ - $(source_h_priv) \ - $(BUILT_SOURCES) \ - $(NULL) - -libjson_glib_1_0_la_LDFLAGS = $(LDADD) -jsonincludedir = $(includedir)/json-glib-1.0/json-glib -jsoninclude_DATA = \ - $(source_h) \ - $(top_srcdir)/json-glib/json-enum-types.h \ - $(top_srcdir)/json-glib/json-glib.h - -CLEANFILES = $(STAMP_FILES) $(BUILT_SOURCES) -DISTCLEANFILES = json-version.h -TESTS_ENVIRONMENT = srcdir="$(srcdir)" json_all_c_sources="$(source_c)" -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/Makefile.decl $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu json-glib/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu json-glib/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -json-version.h: $(top_builddir)/config.status $(srcdir)/json-version.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libjson-glib-1.0.la: $(libjson_glib_1_0_la_OBJECTS) $(libjson_glib_1_0_la_DEPENDENCIES) - $(libjson_glib_1_0_la_LINK) -rpath $(libdir) $(libjson_glib_1_0_la_OBJECTS) $(libjson_glib_1_0_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-array.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-enum-types.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-generator.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-gobject.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-marshal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-node.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-parser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json-scanner.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-jsonincludeDATA: $(jsoninclude_DATA) - @$(NORMAL_INSTALL) - test -z "$(jsonincludedir)" || $(MKDIR_P) "$(DESTDIR)$(jsonincludedir)" - @list='$(jsoninclude_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(jsonincludeDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(jsonincludedir)/$$f'"; \ - $(jsonincludeDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(jsonincludedir)/$$f"; \ - done - -uninstall-jsonincludeDATA: - @$(NORMAL_UNINSTALL) - @list='$(jsoninclude_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(jsonincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(jsonincludedir)/$$f"; \ - done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(LTLIBRARIES) $(DATA) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(jsonincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-recursive - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-jsonincludeDATA - -install-dvi: install-dvi-recursive - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-jsonincludeDATA uninstall-libLTLIBRARIES - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am check-local clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-jsonincludeDATA install-libLTLIBRARIES \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am \ - uninstall-jsonincludeDATA uninstall-libLTLIBRARIES - - -### testing rules - -# test: run all tests in cwd and subdirs -test: ${TEST_PROGS} - @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} - @ for subdir in $(SUBDIRS) . ; do \ - test "$$subdir" = "." -o "$$subdir" = "po" || \ - ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ - done -# test-report: run tests in subdirs and generate report -# perf-report: run tests in subdirs with -m perf and generate report -# full-report: like test-report: with -m perf and -m slow -test-report perf-report full-report: ${TEST_PROGS} - @test -z "${TEST_PROGS}" || { \ - case $@ in \ - test-report) test_options="-k";; \ - perf-report) test_options="-k -m=perf";; \ - full-report) test_options="-k -m=perf -m=slow";; \ - esac ; \ - if test -z "$$GTESTER_LOGDIR" ; then \ - ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ - elif test -n "${TEST_PROGS}" ; then \ - ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ - fi ; \ - } - @ ignore_logdir=true ; \ - if test -z "$$GTESTER_LOGDIR" ; then \ - GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ - ignore_logdir=false ; \ - fi ; \ - for subdir in $(SUBDIRS) . ; do \ - test "$$subdir" = "." -o "$$subdir" = "po" || \ - ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ - done ; \ - $$ignore_logdir || { \ - echo '' > $@.xml ; \ - echo '' >> $@.xml ; \ - echo '' >> $@.xml ; \ - echo ' $(PACKAGE)' >> $@.xml ; \ - echo ' $(VERSION)' >> $@.xml ; \ - echo '' >> $@.xml ; \ - for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ - sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ - done ; \ - echo >> $@.xml ; \ - echo '' >> $@.xml ; \ - rm -rf "$$GTESTER_LOGDIR"/ ; \ - ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ - } -.PHONY: test test-report perf-report full-report -# run make test as part of make check -check-local: test - -json-marshal.h: stamp-json-marshal.h - @true -stamp-json-marshal.h: Makefile json-marshal.list - $(GLIB_GENMARSHAL) \ - --prefix=_json_marshal \ - --header \ - $(srcdir)/json-marshal.list > xgen-jmh && \ - (cmp -s xgen-jmh json-marshal.h || cp -f xgen-jmh json-marshal.h) && \ - rm -f xgen-jmh && \ - echo timestamp > $(@F) - -json-marshal.c: Makefile json-marshal.list - (echo "#include \"json-marshal.h\"" ; \ - $(GLIB_GENMARSHAL) \ - --prefix=_json_marshal \ - --body \ - $(srcdir)/json-marshal.list ) > xgen-jmc && \ - cp -f xgen-jmc json-marshal.c && \ - rm -f xgen-jmc - -json-enum-types.h: stamp-json-enum-types.h - @true -stamp-json-enum-types.h: $(source_h) Makefile - ( cd $(top_srcdir)/json-glib && \ - $(GLIB_MKENUMS) \ - --template $(top_srcdir)/json-glib/json-enum-types.h.in \ - $(source_h) ) > xgen-ceth \ - && (cmp xgen-ceth json-enum-types.h || cp xgen-ceth json-enum-types.h) \ - && rm -f xgen-ceth \ - && echo timestamp > $(@F) - -json-enum-types.c: json-enum-types.h - ( cd $(top_srcdir)/json-glib && \ - $(GLIB_MKENUMS) \ - --template $(top_srcdir)/json-glib/json-enum-types.c.in \ - $(source_h) ) > xgen-cetc \ - && cp xgen-cetc json-enum-types.c \ - && rm -f xgen-cetc -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,911 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "libfacebook.h" -#include "fb_blist.h" -#include "fb_connection.h" -#include "fb_conversation.h" -#include "fb_info.h" -#include "fb_managefriends.h" -#include "fb_messages.h" -#include "fb_notifications.h" -#include "fb_search.h" -#include "fb_friendlist.h" - -static void fb_login_cb(FacebookAccount *fba, gchar *response, gsize len, - gpointer userdata); -static void fb_close(PurpleConnection *pc); -static void fb_buddy_free(PurpleBuddy *buddy); - -/******************************************************************************/ -/* PRPL functions */ -/******************************************************************************/ - -static const char *fb_list_icon(PurpleAccount *account, PurpleBuddy *buddy) -{ - return "facebook"; -} - -static gchar *fb_status_text(PurpleBuddy *buddy) -{ - FacebookBuddy *fbuddy = buddy->proto_data; - - if (fbuddy && fbuddy->status && *fbuddy->status != '\0') - return g_strdup(fbuddy->status); - - return NULL; -} - -static void fb_tooltip_text(PurpleBuddy *buddy, - PurpleNotifyUserInfo *userinfo, gboolean full) -{ - FacebookBuddy *fbuddy = buddy->proto_data; - gchar *status; - - g_return_if_fail(fbuddy); - - if (fbuddy->status && *fbuddy->status != '\0') - { - status = g_strdup_printf("%s %s", - fbuddy->name, fbuddy->status); - - purple_notify_user_info_add_pair(userinfo, - _("Status"), status); - g_free(status); - } -} - -static GList *fb_statuses(PurpleAccount *account) -{ - GList *types = NULL; - PurpleStatusType *status; - - /* Online people have a status message and also a date when it was set */ - status = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - NULL, _("Online"), FALSE, TRUE, FALSE, "message", - _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, status); - - /* Cave into feature requests and allow people to set themselves to be idle */ - status = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - NULL, _("Idle"), FALSE, TRUE, FALSE, "message", - _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, status); - - /* Offline people dont have messages */ - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, _("Offline"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - return types; -} - -static gboolean fb_get_messages_failsafe(FacebookAccount *fba) -{ - if (fba->last_messages_download_time < (time(NULL) - (60*5))) { - /* Messages haven't been downloaded in a while- - * something is probably wrong */ - purple_debug_warning("facebook", - "executing message check failsafe\n"); - fb_get_post_form_id(fba); - } - - return TRUE; -} - -void fb_login_captcha_cancel_cb(PurpleConnection *pc, PurpleRequestFields *fields) -{ - purple_connection_error_reason(pc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - "Could not authenticate captcha. Logging into the Facebook website may fix this."); -} -void fb_login_captcha_ok_cb(PurpleConnection *pc, PurpleRequestFields *fields) -{ - const gchar *captcha_response; - gchar *postdata, *encoded_username, *encoded_password, *encoded_charset_test, - *encoded_persist_data, *encoded_response, *encoded_extra_challenge, - *encoded_session; - FacebookAccount *fba = pc->proto_data; - - captcha_response = purple_request_fields_get_string(fields, "captcha_response"); - - encoded_response = g_strdup(purple_url_encode(captcha_response)); - encoded_username = g_strdup(purple_url_encode( - purple_account_get_username(fba->account))); - encoded_password = g_strdup(purple_url_encode( - purple_account_get_password(fba->account))); - encoded_extra_challenge = g_strdup(purple_url_encode( - fba->extra_challenge)); - encoded_persist_data = g_strdup(purple_url_encode( - fba->persist_data)); - encoded_session = g_strdup(purple_url_encode( - fba->captcha_session)); - encoded_charset_test = g_strdup(purple_url_encode("€,´,€,´,水,Д,Є")); - - postdata = g_strdup_printf("charset_test=%s&" - "version=1.0&" - "return_session=0&" - "charset_test=%s&" - "answered_captcha=1&" - "captcha_persist_data=%s&" - "captcha_session=%s&" - "extra_challenge_params=%s&" - "captcha_response=%s&" - "email=%s&pass=%s&" - "persistent=1", - encoded_charset_test, encoded_charset_test, - encoded_persist_data, encoded_session, - encoded_extra_challenge, encoded_response, - encoded_username, encoded_password); - g_free(encoded_username); - g_free(encoded_password); - g_free(encoded_charset_test); - g_free(encoded_extra_challenge); - g_free(encoded_persist_data); - g_free(encoded_response); - g_free(encoded_session); - - fb_post_or_get(fba, FB_METHOD_POST | FB_METHOD_SSL, "login.facebook.com", - "/login.php?login_attempt=1&_fb_noscript=1", postdata, fb_login_cb, NULL, FALSE); - g_free(postdata); - - g_free(fba->extra_challenge); - g_free(fba->persist_data); - g_free(fba->captcha_session); - fba->extra_challenge = NULL; - fba->persist_data = NULL; - fba->captcha_session = NULL; -} - -static void fb_login_captcha_image_cb(FacebookAccount *fba, gchar *response, - gsize len, gpointer userdata) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_image_new("captcha_image", "", response, len); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("captcha_response", "", "", FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(fba->pc, - _("Facebook Captcha"), _("Facebook Captcha"), - _("Enter both words below, separated by a space"), - fields, - _("OK"), G_CALLBACK(fb_login_captcha_ok_cb), - _("Logout"), G_CALLBACK(fb_login_captcha_cancel_cb), - fba->account, NULL, NULL, fba->pc - ); -} -static void fb_login_captcha_cb(FacebookAccount *fba, gchar *response, - gsize len, gpointer userdata) -{ - const gchar *challenge_start = "challenge : '"; - gchar *challenge; - gchar *image_url; - - challenge = g_strstr_len(response, len, challenge_start); - if (challenge) - { - challenge += strlen(challenge_start); - challenge = g_strndup(challenge, strchr(challenge, '\'') - challenge); - - image_url = g_strdup_printf("/image?c=%s", challenge); - - fb_post_or_get(fba, FB_METHOD_GET | FB_METHOD_SSL, "api-secure.recaptcha.net", - image_url, NULL, fb_login_captcha_image_cb, NULL, FALSE); - } -} -static void fb_login_cb(FacebookAccount *fba, gchar *response, gsize len, - gpointer userdata) -{ - gchar *user_cookie; - const gchar *persist_data_start; - gchar *persist_data; - const gchar *session_start; - gchar *session; - gchar *captcha_url; - const gchar *extra_challenge_params; - gchar *extra_challenge; - if (len && g_strstr_len(response, len, "captcha")) - { - purple_debug_info("facebook", "captcha page: %s\n", response); - - purple_connection_update_progress(fba->pc, _("Handling Captcha"), 2, 4); - - persist_data_start = "persist_data = g_strndup(persist_data, strchr(persist_data, '"') - persist_data); - } - - session_start = "captcha_session = g_strndup(session, strchr(session, '"') - session); - } - - - extra_challenge_params = "extra_challenge = g_strndup(extra_challenge, strchr(extra_challenge, '"') - extra_challenge); - extra_challenge = purple_unescape_html(fba->extra_challenge); - g_free(fba->extra_challenge); - fba->extra_challenge = extra_challenge; - } - - if (!fba->extra_challenge || !fba->persist_data || !fba->captcha_session) - { - purple_debug_info("facebook", "captcha response: %s\n", response); - g_free(fba->extra_challenge); - g_free(fba->persist_data); - g_free(fba->captcha_session); - fba->extra_challenge = NULL; - fba->persist_data = NULL; - fba->captcha_session = NULL; - purple_connection_error_reason(fba->pc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - "Could not authenticate captcha. Logging into the Facebook website may fix this."); - return; - } - - captcha_url = g_strdup_printf("/challenge?k=" FACEBOOK_CAPTCHA_SITE "&%s", - fba->extra_challenge?fba->extra_challenge:""); - - fb_post_or_get(fba, FB_METHOD_GET | FB_METHOD_SSL, "api-secure.recaptcha.net", - captcha_url, NULL, fb_login_captcha_cb, NULL, FALSE); - - g_free(captcha_url); - - return; - } - - purple_connection_update_progress(fba->pc, _("Authenticating"), 2, 3); - - /* Look for our uid */ - user_cookie = g_hash_table_lookup(fba->cookie_table, "c_user"); - if (user_cookie == NULL) { - /* - * Server didn't set the c_user cookie, so we must have given - * them a bad username or password - */ - purple_connection_error_reason(fba->pc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Incorrect username or password.")); - return; - } - fba->uid = atoll(user_cookie); - purple_debug_info("facebook", "uid %" G_GINT64_FORMAT "\n", fba->uid); - - /* ok, we're logged in now! */ - purple_connection_set_state(fba->pc, PURPLE_CONNECTED); - - /* This will kick off our long-poll message retrieval loop */ - fb_get_post_form_id(fba); - fb_check_friend_requests(fba); - - /* periodically check for people adding you to their facebook friend list */ - fba->friend_request_timer = purple_timeout_add_seconds(60 * 5, - fb_check_friend_requests, fba); - - /* periodically check for new notifications */ - fba->notifications_timer = purple_timeout_add_seconds(60, - (GSourceFunc)fb_get_notifications_feed, fba); - - /* Periodically check for new messages. NOTE: This MUST exist, - * regardless of other other mechanisms for checking messages. This - * is because the code needs a failsafe checker in case other one of - * the other retrieval mechanisms dies due to a bad request, etc. - * Without such a failsafe, a user will receive no messages, which is - * one of hardest bugs to debug and get reports about. Hence, the - * importance of this loop. - * That said, there is room for tweaking this loop and possibly even - * setting it such that it is the primary or only message checker. - * The key is that the method must NEVER die until logout. - */ - fba->perpetual_messages_timer = purple_timeout_add_seconds(15, - (GSourceFunc)fb_get_messages_failsafe, fba); - - /* init blist subsystem */ - fb_blist_init(fba); - - /* init conversation subsystem */ - fb_conversation_init(fba); -} - -static void fb_login(PurpleAccount *account) -{ - FacebookAccount *fba; - gchar *postdata, *encoded_username, *encoded_password, *encoded_charset_test; - const gchar* const *languages; - const gchar *locale; - - /* Create account and initialize state */ - fba = g_new0(FacebookAccount, 1); - fba->account = account; - fba->pc = purple_account_get_connection(account); - fba->uid = -1; - fba->last_messages_download_time = time(NULL) - 60; /* 60 secs is a safe buffer */ - fba->cookie_table = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - fba->hostname_ip_cache = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - fba->sent_messages_hash = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - fba->auth_buddies = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - g_hash_table_replace(fba->cookie_table, g_strdup("test_cookie"), - g_strdup("1")); - - account->gc->proto_data = fba; - - /* Error localized in libpurple jabber.c */ - if (!purple_ssl_is_supported()) { - purple_connection_error_reason (purple_account_get_connection(account), - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Server requires TLS/SSL for login. No TLS/SSL support found.")); - return; - } - - purple_connection_set_state(fba->pc, PURPLE_CONNECTING); - purple_connection_update_progress(fba->pc, _("Connecting"), 1, 3); - - encoded_username = g_strdup(purple_url_encode( - purple_account_get_username(fba->account))); - encoded_password = g_strdup(purple_url_encode( - purple_account_get_password(fba->account))); - encoded_charset_test = g_strdup(purple_url_encode("€,´,€,´,水,Д,Є")); - languages = g_get_language_names(); - locale = languages[0]; - if (locale == NULL || g_str_equal(locale, "C")) - locale = "en_US"; - - g_hash_table_replace(fba->cookie_table, g_strdup("lsd"), g_strdup("abcde")); - postdata = g_strdup_printf( - "charset_test=%s&locale=%s&email=%s&pass=%s&pass_placeHolder=Password&persistent=1&login=Login&charset_test=%s&lsd=abcde", - encoded_charset_test, locale, encoded_username, encoded_password, encoded_charset_test); - g_free(encoded_username); - g_free(encoded_password); - g_free(encoded_charset_test); - - fb_post_or_get(fba, FB_METHOD_POST | FB_METHOD_SSL, "login.facebook.com", - "/login.php?login_attempt=1&_fb_noscript=1", postdata, fb_login_cb, NULL, FALSE); - g_free(postdata); -} - -static void fb_close(PurpleConnection *pc) -{ - FacebookAccount *fba; - gchar *postdata; - GSList *buddies; - - purple_debug_info("facebook", "disconnecting account\n"); - - g_return_if_fail(pc != NULL); - g_return_if_fail(pc->proto_data != NULL); - - fba = pc->proto_data; - - if ( fba == NULL ) //VOXOX - JRT - 2009.10.12 - Prevent crash when network is lost or resuming from hibernation. - return; - - purple_debug_info("facebook", "unloading plugin\n"); - - /* destroy blist subsystem */ - fb_blist_destroy(fba); - - /* destroy conversation subsystem */ - fb_conversation_destroy(fba); - buddies = purple_find_buddies(fba->account, NULL); - while(buddies) { - PurpleBuddy *b = buddies->data; - fb_buddy_free(b); - buddies = g_slist_delete_link(buddies, buddies); - } - - /* Tell Facebook that we've logged out. */ - /* - * TODO - * This doesn't actually work because the request is non-blocking - * and we're in the process of logging out. So we start making a - * connection but then libpurple immediately cancels the attempt - * and frees everything. - * - * There are two ways to fix this: - * 1. We could make this request, but not pass in fba or reference - * any other data. The request could complete normally even - * after this account has logged out, since it really doesn't - * need access to the PurpleConnection or the FacebookAccount. - * - * 2. The close prpl callback could be changed in libpurple so that - * protocol plugins can have a chance to make network requests - * and do other long cleanup operations. So the call to - * prpl->close() would become asynchronous. It tells the - * protocol plugin to begin the shutdown sequence, and the - * protocol plugin tells the core when it's finished. - */ - if (fba->post_form_id) - postdata = g_strdup_printf( - "visibility=false&post_form_id=%s&" - "fb_dtsg=%s&post_form_id_source=AsyncRequest&" - "__a=1", - fba->post_form_id, fba->dtsg); - else - postdata = g_strdup("visibility=false"); - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/chat/settings.php", - postdata, NULL, NULL, FALSE); - g_free(postdata); - - if (fba->friend_request_timer) { - purple_timeout_remove(fba->friend_request_timer); - } - if (fba->notifications_timer) { - purple_timeout_remove(fba->notifications_timer); - } - if (fba->new_messages_check_timer) { - purple_timeout_remove(fba->new_messages_check_timer); - } - if (fba->perpetual_messages_timer) { - purple_timeout_remove(fba->perpetual_messages_timer); - } - - purple_debug_info("facebook", "destroying %d incomplete connections\n", - g_slist_length(fba->conns)); - - while (fba->conns != NULL) - fb_connection_destroy(fba->conns->data); - - while (fba->dns_queries != NULL) { - PurpleDnsQueryData *dns_query = fba->dns_queries->data; - purple_debug_info("facebook", "canceling dns query for %s\n", - purple_dnsquery_get_host(dns_query)); - fba->dns_queries = g_slist_remove(fba->dns_queries, dns_query); - purple_dnsquery_destroy(dns_query); - } - - if (fba->resending_messages != NULL) { - fb_cancel_resending_messages(fba); - } - - //VOXOX - JRT - 2009.10.13 - I know we are deleting fba anyway, but since other threads may also be accessing this, - // it helps reduce crashes due to freed memory ptrs. (There is no thread syncing to control this better). - g_hash_table_destroy(fba->cookie_table); - - g_hash_table_destroy(fba->hostname_ip_cache); - - g_hash_table_destroy(fba->auth_buddies); - - g_free(fba->post_form_id); - g_free(fba->dtsg); - g_free(fba->channel_number); - g_free(fba->last_status_message); - g_free(fba->extra_challenge); - g_free(fba->captcha_session); - g_free(fba->persist_data); - g_free(fba); - -} - -static unsigned int fb_send_typing(PurpleConnection *pc, const gchar *name, - PurpleTypingState state) -{ - int typing_state; - gchar *postdata; - FacebookAccount *fba = pc->proto_data; - gchar *encoded_name; - - g_return_val_if_fail(fba != NULL, 0); - g_return_val_if_fail(fba->post_form_id != NULL, 0); - - typing_state = (state == PURPLE_TYPING) ? 1 : 0; - - /* Don't send typing notifications to self */ - if (atoll(name) != fba->uid) - { - encoded_name = g_strdup(purple_url_encode(name)); - postdata = g_strdup_printf("typ=%d&to=%s&post_form_id=%s", - typing_state, encoded_name, fba->post_form_id); - g_free(encoded_name); - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/chat/typ.php", - postdata, NULL, NULL, FALSE); - g_free(postdata); - } else { - serv_got_typing(pc, name, 10, state); - } - - /* 7 is the number of seconds before sending the new typing state. It - * corresponds with the default value that Facebook waits. */ - return 7; -} - -static void fb_set_status_ok_cb(gpointer data, const gchar *status_text) -{ - PurpleConnection *pc = data; - FacebookAccount *fba = pc->proto_data; - gchar *postdata; - gchar *status_tmp; - gchar *status_text_new; - - g_return_if_fail(fba->post_form_id != NULL); - - status_text_new = g_strstrip(g_strdup(status_text)); - - /* don't set the status if it's idential to what we've already set */ - if (fba->last_status_message && g_str_equal(fba->last_status_message, - status_text_new)) { - g_free(status_text_new); - return; - } - - g_free(fba->last_status_message); - fba->last_status_message = status_text_new; - - if (*status_text_new != '\0') - { - status_tmp = g_strdup(purple_url_encode(status_text_new)); - postdata = g_strdup_printf("profile_id=%" G_GINT64_FORMAT "&status=%s&post_form_id=%s", - fba->uid, status_tmp, fba->post_form_id); - g_free(status_tmp); - } - else - postdata = g_strdup_printf("profile_id=%" G_GINT64_FORMAT "&clear=1&post_form_id=%s", - fba->uid, fba->post_form_id); - - fb_post_or_get(fba, FB_METHOD_POST, NULL, "/ajax/updatestatus.php", - postdata, NULL, NULL, FALSE); - - g_free(postdata); -} - -static void fb_set_status_p(PurpleAccount *account, PurpleStatus *status) -{ - const gchar *message; - gchar *stripped; - FacebookAccount *fba = account->gc->proto_data; - - /* if "away" set idle */ - if (fba && purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_AWAY) - { - fba->is_idle = TRUE; - } - //VOXOX - CJC - 2009.07.06 We always want to do this - ///* first check that we actually want to set this through Pidgin */ - //if (!purple_account_get_bool(account, - // "facebook_set_status_through_pidgin", FALSE)) - //{ - // return; - //} - - - - //message = purple_status_get_attr_string(status, "message"); - //if (message == NULL) - // message = ""; - message = purple_status_get_attr_string(status, "message"); - if (message == NULL) - //VOXOX CHANGE CJC DO NOT SET MESSAGE IF BLANK - return; - - stripped = purple_markup_strip_html(message); - fb_set_status_ok_cb(account->gc, stripped); - g_free(stripped); -} - -static void fb_buddy_free(PurpleBuddy *buddy) -{ - FacebookBuddy *fbuddy = buddy->proto_data; - if (fbuddy != NULL) - { - buddy->proto_data = NULL; - - g_free(fbuddy->name); - g_free(fbuddy->status); - g_free(fbuddy->thumb_url); - g_free(fbuddy); - } -} - -#if PURPLE_MAJOR_VERSION >= 2 && PURPLE_MINOR_VERSION >= 5 -static GHashTable *fb_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} -#endif - -/******************************************************************************/ -/* Plugin functions */ -/******************************************************************************/ - -static gboolean plugin_load(PurplePlugin *plugin) -{ - return TRUE; -} - -static gboolean plugin_unload(PurplePlugin *plugin) -{ - return TRUE; -} - -static void fb_set_status_cb(PurplePluginAction *action) -{ - PurpleConnection *pc = action->context; - FacebookAccount *fba = pc->proto_data; - gchar *uid_str; - - uid_str = g_strdup_printf("%" G_GINT64_FORMAT, fba->uid); - - purple_request_input(pc, NULL, _("Set your Facebook status"), - purple_account_get_alias(pc->account), "is ", - FALSE, FALSE, NULL, _("OK"), - G_CALLBACK(fb_set_status_ok_cb), _("Cancel"), - NULL, pc->account, uid_str, NULL, pc); - - g_free(uid_str); -} - -static void fb_display_plugin_info(PurplePluginAction *action) -{ - purple_notify_info(action->context, _("About Facebook for Pidgin"), - _("Version"), FACEBOOK_PLUGIN_VERSION); -} - -static void fb_refresh_blist(PurplePluginAction *action) -{ - PurpleConnection *pc; - FacebookAccount *fba; - - pc = (PurpleConnection *) action->context; - fba = pc->proto_data; - - fb_get_buddy_list(fba); -} - -static GList *fb_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("About Facebook for Pidgin"), - fb_display_plugin_info); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Facebook status..."), - fb_set_status_cb); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Search for buddies..."), - fb_search_users); - m = g_list_append(m, act); - - // TODO: remove, this is for testing. REMOVE. - act = purple_plugin_action_new(_("Refresh buddy list..."), - fb_refresh_blist); - m = g_list_append(m, act); - - return m; -} - -static GList *fb_node_menu(PurpleBlistNode *node) -{ - GList *m = NULL; - PurpleMenuAction *act; - PurpleBuddy *buddy; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - buddy = (PurpleBuddy *)node; - - act = purple_menu_action_new(_("_Poke"), - PURPLE_CALLBACK(fb_blist_poke_buddy), - NULL, NULL); - m = g_list_append(m, act); - } - return m; -} - -static void fb_set_idle(PurpleConnection *gc, int time) -{ - FacebookAccount *fba = gc->proto_data; - - g_return_if_fail(fba != NULL); - - if (time) - { - fba->is_idle = TRUE; - } else { - fba->is_idle = FALSE; - } -} - -static void plugin_init(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurplePluginInfo *info = plugin->info; - PurplePluginProtocolInfo *prpl_info = info->extra_info; - - /* Add options to the advanced screen in the account settings */ - option = purple_account_option_bool_new( - _("Show history in new conversations"), - "facebook_show_history", TRUE); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); - - option = purple_account_option_bool_new( - _("Use Facebook friend-lists as Pidgin groups"), - "facebook_use_groups", TRUE); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); - option = purple_account_option_bool_new( - _("Hide myself in the Buddy List"), - "facebook_hide_self", TRUE); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); - - option = purple_account_option_bool_new( - _("Set Facebook status through Pidgin status"), - "facebook_set_status_through_pidgin", FALSE); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); - - option = purple_account_option_bool_new( - _("Show Facebook notifications as e-mails in Pidgin"), - "facebook_get_notifications", TRUE); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); - - option = purple_account_option_string_new( - _("Notifications RSS Feed URL"), - "notifications_feed_url", ""); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); - - option = purple_account_option_bool_new( - _("Edit Facebook friends from Pidgin"), - "facebook_manage_friends", FALSE); - prpl_info->protocol_options = g_list_append( - prpl_info->protocol_options, option); -} - -static PurplePluginProtocolInfo prpl_info = { - /* options */ - OPT_PROTO_MAIL_CHECK, - - NULL, /* user_splits */ - NULL, /* protocol_options */ - /* NO_BUDDY_ICONS */ /* icon_spec */ - {"jpg", 0, 0, 50, 50, -1, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - fb_list_icon, /* list_icon */ - NULL, /* list_emblems */ - fb_status_text, /* status_text */ - fb_tooltip_text, /* tooltip_text */ - fb_statuses, /* status_types */ - fb_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - fb_login, /* login */ - fb_close, /* close */ - fb_send_im, /* send_im */ - NULL, /* set_info */ - fb_send_typing, /* send_typing */ - fb_get_info, /* get_info */ - fb_set_status_p, /* set_status */ - fb_set_idle, /* set_idle */ - NULL, /* change_passwd */ - fb_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - fb_buddy_remove, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - fb_group_buddy_move, /* group_buddy */ - fb_group_rename, /* rename_group */ - fb_buddy_free, /* buddy_free */ - fb_conversation_closed, /* convo_closed */ - purple_normalize_nocase,/* normalize */ - NULL, /* set_buddy_icon */ - fb_group_remove, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* attention_types */ -#if PURPLE_MAJOR_VERSION >= 2 && PURPLE_MINOR_VERSION >= 5 - sizeof(PurplePluginProtocolInfo), /* struct_size */ - fb_get_account_text_table, /* get_account_text_table */ -#else - (gpointer) sizeof(PurplePluginProtocolInfo) -#endif -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - 2, /* major_version */ - 3, /* minor version */ - PURPLE_PLUGIN_PROTOCOL, /* type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - FACEBOOK_PLUGIN_ID, /* id */ - "Facebook", /* name */ - FACEBOOK_PLUGIN_VERSION, /* version */ - N_("Facebook Protocol Plugin"), /* summary */ - N_("Facebook Protocol Plugin"), /* description */ - "Eion Robb ", /* author */ - "http://pidgin-facebookchat.googlecode.com/", /* homepage */ - plugin_load, /* load */ - plugin_unload, /* unload */ - NULL, /* destroy */ - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - fb_actions, /* actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -PURPLE_INIT_PLUGIN(facebook, plugin_init, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/libfacebook.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -/* - * libfacebook - * - * libfacebook is the property of its developers. See the COPYRIGHT file - * for more details. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef LIBFACEBOOK_H -#define LIBFACEBOOK_H - -#define FACEBOOK_PLUGIN_VERSION "1.63" -#define FACEBOOK_PLUGIN_ID "prpl-bigbrownchunx-facebookim" -#define FACEBOOK_CAPTCHA_SITE "6LezHAAAAAAAADqVjseQ3ctG3ocfQs2Elo1FTa_a" - -#include - -#include -#include -#include -#include -//VOXOX CHANGE CJC -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif /* __GNUC__ >= 4 */ -#endif /* G_GNUC_NULL_TERMINATED */ - -#ifdef _WIN32 -# include "win32dep.h" -# define dlopen(a,b) LoadLibrary(a) -# define RTLD_LAZY -# define dlsym(a,b) GetProcAddress(a,b) -# define dlclose(a) FreeLibrary(a) -#else -# include -# include -# include -# include -#endif - -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#include "accountopt.h" -#include "connection.h" -#include "debug.h" -#include "dnsquery.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "sslconn.h" -#include "version.h" - - -#if GLIB_MAJOR_VERSION >= 2 && GLIB_MINOR_VERSION >= 12 -# define atoll(a) g_ascii_strtoll(a, NULL, 0) -#endif - -#define FB_MAX_MSG_RETRY 2 - -typedef struct _FacebookAccount FacebookAccount; -typedef struct _FacebookBuddy FacebookBuddy; - -typedef void (*FacebookProxyCallbackFunc)(FacebookAccount *fba, gchar *data, gsize data_len, gpointer user_data); - -struct _FacebookAccount { - PurpleAccount *account; - PurpleConnection *pc; - GSList *conns; /**< A list of all active FacebookConnections */ - GSList *dns_queries; - GHashTable *cookie_table; - gchar *post_form_id; - gint64 uid; - guint buddy_list_timer; /* handled by fb_blist */ - GHashTable *friend_lists; /* handled by fb_friendlist */ - GHashTable *friend_lists_reverse; /* handled by fb_friendlist */ - guint friend_request_timer; - gchar *channel_number; - guint message_fetch_sequence; - gint64 last_message_time; /* handled by fb_conversation */ - GSList *resending_messages; - GHashTable *auth_buddies; - GHashTable *hostname_ip_cache; - guint notifications_timer; - time_t last_messages_download_time; - guint new_messages_check_timer; - guint perpetual_messages_timer; - gchar *last_status_message; - gboolean is_idle; - GHashTable *sent_messages_hash; - gint last_inbox_count; - gchar *extra_challenge; - gchar *persist_data; - gchar *captcha_session; - gint last_status_timestamp; - guint bad_buddy_list_count; - gchar *dtsg; -}; - -struct _FacebookBuddy { - FacebookAccount *fba; - PurpleBuddy *buddy; - gint64 uid; - gchar *name; - gchar *status; - gchar *thumb_url; -}; - -#endif /* LIBFACEBOOK_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/login.facebook.com.pem qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/login.facebook.com.pem --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/login.facebook.com.pem 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/login.facebook.com.pem 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDUTCCArqgAwIBAgIDBRtMMA0GCSqGSIb3DQEBBAUAMFoxCzAJBgNVBAYTAlVT -MRwwGgYDVQQKExNFcXVpZmF4IFNlY3VyZSBJbmMuMS0wKwYDVQQDEyRFcXVpZmF4 -IFNlY3VyZSBHbG9iYWwgZUJ1c2luZXNzIENBLTEwHhcNMDYxMjEzMDczMTQ5WhcN -MTAwMTEyMDczMTQ5WjCBwDELMAkGA1UEBhMCVVMxGzAZBgNVBAoTEmxvZ2luLmZh -Y2Vib29rLmNvbTETMBEGA1UECxMKR1QwNDQ4MjQ1MjExMC8GA1UECxMoU2VlIHd3 -dy5nZW90cnVzdC5jb20vcmVzb3VyY2VzL2NwcyAoYykwNjEvMC0GA1UECxMmRG9t -YWluIENvbnRyb2wgVmFsaWRhdGVkIC0gUXVpY2tTU0woUikxGzAZBgNVBAMTEmxv -Z2luLmZhY2Vib29rLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1R9N -IM5CJpFurag3pBa3ZOahUvLgh9sGa2Ur0MT3+5tWJYw5ay2r74WK6dYv2bcrqDLU -uyHWJWCeJewglGs2VZ3cOPxN9x68OPxuTP0IPpAJDpphFne3zTH5njkfitrV2oaW -UgzbkbUEaFnVOpeScy9U4Ks6uVTgV+KNsZFEsCkCAwEAAaOBvTCBujAOBgNVHQ8B -Af8EBAMCBPAwHQYDVR0OBBYEFM627PadoUPV4GdpPT8AbJOxchf+MDsGA1UdHwQ0 -MDIwMKAuoCyGKmh0dHA6Ly9jcmwuZ2VvdHJ1c3QuY29tL2NybHMvZ2xvYmFsY2Ex -LmNybDAfBgNVHSMEGDAWgBS+qKB0clBrRLfJI9j7qP+zV2tobDAdBgNVHSUEFjAU -BggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQQF -AAOBgQBRlplWgG9NU89FVKCDkUNCoTqkdPJw4Nl7Ypdpf6WhPk3dq57teOseTKCf -O3XxHLqz+EYslUO4K5l88RgF+dK+dlESmjmewAtADpkrSC4DHKg6fdFywObnD9b9 -TqibCw82YJ3b7v6G3Ec4ApD0sqiQqrz59pWjdFrZwagyT42YFw== ------END CERTIFICATE----- diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/Makefile qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/Makefile --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/Makefile 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -#Customisable stuff here -LINUX32_COMPILER = i686-pc-linux-gnu-gcc -LINUX64_COMPILER = x86_64-pc-linux-gnu-gcc -WIN32_COMPILER = /usr/bin/i586-mingw32-gcc -WIN32_WINDRES = i586-mingw32-windres -#LINUX_ARM_COMPILER = arm-pc-linux-gnu-gcc -LINUX_ARM_COMPILER = arm-none-linux-gnueabi-gcc -LINUX_PPC_COMPILER = powerpc-unknown-linux-gnu-gcc -FREEBSD60_COMPILER = i686-pc-freebsd6.0-gcc -MACPORT_COMPILER = i686-apple-darwin9-gcc-4.0.1 - -LIBPURPLE_CFLAGS = -I/usr/include/libpurple -I/usr/local/include/libpurple -DPURPLE_PLUGINS -DENABLE_NLS -DHAVE_ZLIB -GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I/usr/include/json-glib-1.0 -ljson-glib-1.0 -WIN32_DEV_DIR = /root/pidgin/win32-dev -WIN32_PIDGIN_DIR = /root/pidgin/pidgin-2.3.0_win32 -WIN32_CFLAGS = -I${WIN32_DEV_DIR}/gtk_2_0/include/glib-2.0 -I${WIN32_PIDGIN_DIR}/libpurple/win32 -I${WIN32_DEV_DIR}/gtk_2_0/include -I${WIN32_DEV_DIR}/gtk_2_0/include/glib-2.0 -I${WIN32_DEV_DIR}/gtk_2_0/lib/glib-2.0/include -I/usr/include/json-glib-1.0 -Wno-format -WIN32_LIBS = -L${WIN32_DEV_DIR}/gtk_2_0/lib -L${WIN32_PIDGIN_DIR}/libpurple -lglib-2.0 -lgobject-2.0 -lintl -lpurple -lws2_32 -L. -ljson-glib-1.0 -lzlib1 -MACPORT_CFLAGS = -I/opt/local/include/libpurple -DPURPLE_PLUGINS -DENABLE_NLS -DHAVE_ZLIB -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/json-glib-1.0 -arch i386 -arch ppc -dynamiclib -L/opt/local/lib -ljson-glib-1.0 -lpurple -lglib-2.0 -lgobject-2.0 -lintl -lz -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 - -DEB_PACKAGE_DIR = ./debdir - -FACEBOOK_SOURCES = \ - libfacebook.h \ - libfacebook.c \ - fb_blist.h \ - fb_blist.c \ - fb_connection.h \ - fb_connection.c \ - fb_conversation.h \ - fb_conversation.c \ - fb_info.h \ - fb_info.c \ - fb_managefriends.h \ - fb_managefriends.c \ - fb_messages.h \ - fb_messages.c \ - fb_notifications.h \ - fb_notifications.c \ - fb_search.h \ - fb_search.c \ - fb_util.h \ - fb_util.c \ - fb_friendlist.h \ - fb_friendlist.c - fb_json.h \ - fb_json.c - -#Standard stuff here -.PHONY: all clean install sourcepackage - -all: libfacebook.so libfacebook.dll libfacebook64.so libfacebookarm.so libfacebookppc.so installers sourcepackage - -install: - cp libfacebook.so /usr/lib/purple-2/ - cp libfacebook64.so /usr/lib64/purple-2/ - cp libfacebookarm.so /usr/lib/pidgin/ - cp libfacebookppc.so /usr/lib/purple-2/ - cp facebook16.png /usr/share/pixmaps/pidgin/protocols/16/facebook.png - cp facebook22.png /usr/share/pixmaps/pidgin/protocols/22/facebook.png - cp facebook48.png /usr/share/pixmaps/pidgin/protocols/48/facebook.png - -installers: pidgin-facebookchat.exe pidgin-facebookchat.deb pidgin-facebookchat.tar.bz2 - -clean: - rm -f libfacebook.so libfacebook.dll libfacebook64.so libfacebookarm.so libfacebookppc.so pidgin-facebookchat.exe pidgin-facebookchat.deb pidgin-facebookchat.tar.bz2 pidgin-facebookchat-source.tar.bz2 - rm -rf pidgin-facebookchat - -libfacebook.so: ${FACEBOOK_SOURCES} - ${LINUX32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall ${GLIB_CFLAGS} -I. -g -O2 -pipe ${FACEBOOK_SOURCES} -o libfacebook.so -shared -fPIC -DPIC - -libfacebookarm.so: ${FACEBOOK_SOURCES} - ${LINUX_ARM_COMPILER} ${LIBPURPLE_CFLAGS} -Wall ${GLIB_CFLAGS} -I. -g -O2 -pipe ${FACEBOOK_SOURCES} -o libfacebookarm.so -shared -fPIC -DPIC - -libfacebook64.so: ${FACEBOOK_SOURCES} - ${LINUX64_COMPILER} ${LIBPURPLE_CFLAGS} -Wall ${GLIB_CFLAGS} -I. -g -m64 -O2 -pipe ${FACEBOOK_SOURCES} -o libfacebook64.so -shared -fPIC -DPIC - -libfacebookppc.so: ${FACEBOOK_SOURCES} - ${LINUX_PPC_COMPILER} ${LIBPURPLE_CFLAGS} -Wall ${GLIB_CFLAGS} -I. -g -O2 -pipe ${FACEBOOK_SOURCES} -o libfacebookppc.so -shared -fPIC -DPIC - -libfacebookmacport.so: ${FACEBOOK_SOURCES} - ${MACPORT_COMPILER} ${MACPORT_CFLAGS} -Wall -I. -g -O2 -pipe ${FACEBOOK_SOURCES} -o libfacebookmacport.so -shared - -pidgin-facebookchat.res: pidgin-facebookchat.rc - ${WIN32_WINDRES} $< -O coff -o $@ - -libfacebook.dll: ${FACEBOOK_SOURCES} pidgin-facebookchat.res - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe ${FACEBOOK_SOURCES} pidgin-facebookchat.res -o $@ -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} -Wl,--strip-all - upx libfacebook.dll - -libfacebook-debug.dll: ${FACEBOOK_SOURCES} pidgin-facebookchat.res - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe ${FACEBOOK_SOURCES} pidgin-facebookchat.res -o $@ -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} - -libfacebookbsd60.so: ${FACEBOOK_SOURCES} - ${FREEBSD60_COMPILER} ${LIBPURPLE_CFLAGS} -Wall ${GLIB_CFLAGS} -I. -g -O2 -pipe ${FACEBOOK_SOURCES} -o libfacebook.so -shared -fPIC -DPIC - - -pidgin-facebookchat.exe: libfacebook.dll - echo "Dont forget to update version number" - makensis facebook.nsi > /dev/null - -pidgin-facebookchat.deb: libfacebook.so libfacebookarm.so libfacebook64.so libfacebookppc.so - echo "Dont forget to update version number" - cp libfacebook.so ${DEB_PACKAGE_DIR}/usr/lib/purple-2/ - cp libfacebookppc.so ${DEB_PACKAGE_DIR}/usr/lib/purple-2/ - cp libfacebook64.so ${DEB_PACKAGE_DIR}/usr/lib64/purple-2/ - cp libfacebookarm.so ${DEB_PACKAGE_DIR}/usr/lib/pidgin/ - cp facebook16.png ${DEB_PACKAGE_DIR}/usr/share/pixmaps/pidgin/protocols/16/facebook.png - cp facebook22.png ${DEB_PACKAGE_DIR}/usr/share/pixmaps/pidgin/protocols/22/facebook.png - cp facebook48.png ${DEB_PACKAGE_DIR}/usr/share/pixmaps/pidgin/protocols/48/facebook.png - chown -R root:root ${DEB_PACKAGE_DIR} - chmod -R 755 ${DEB_PACKAGE_DIR} - dpkg-deb --build ${DEB_PACKAGE_DIR} $@ > /dev/null - -pidgin-facebookchat.tar.bz2: pidgin-facebookchat.deb - tar --bzip2 --directory ${DEB_PACKAGE_DIR} -cf $@ usr/ - -sourcepackage: ${FACEBOOK_SOURCES} Makefile facebook16.png facebook22.png facebook48.png COPYING facebook.nsi - tar -cf tmp.tar $^ - mkdir pidgin-facebookchat - mv tmp.tar pidgin-facebookchat - tar xvf pidgin-facebookchat/tmp.tar -C pidgin-facebookchat - rm pidgin-facebookchat/tmp.tar - tar --bzip2 -cf pidgin-facebookchat-source.tar.bz2 pidgin-facebookchat - rm -rf pidgin-facebookchat diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/pidgin-facebookchat.rc qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/pidgin-facebookchat.rc --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/pidgin-facebookchat.rc 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/pidgin-facebookchat.rc 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - -1 VERSIONINFO -FILEVERSION 1,62,0,0 -PRODUCTVERSION 1,62,0,0 -FILEOS 0x40004 // VOS_NT_WINDOWS32 -FILETYPE 0x2 // VFT_DLL -{ -BLOCK "StringFileInfo" -{ - BLOCK "040904B0" // U.S. English, Unicode - { - VALUE "CompanyName", "Eion Robb\0" - VALUE "FileDescription", "Facebook Chat plugin for Pidgin\0" - VALUE "ProductName", "pidgin-facebookchat\0" - VALUE "FileVersion", "1.62\0" - VALUE "ProductVersion", "1.62\0" - VALUE "InternalName", "pidgin-facebookchat\0" - VALUE "OriginalFilename", "libfacebook.dll\0" - VALUE "Comments", "http://pidgin-facebookchat.googlecode.com/\0" - } -} - -BLOCK "VarFileInfo" -{ - VALUE "Translation", 0x0409, 0x04B0 // U.S. English, Unicode -} -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/rss.xml qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/rss.xml --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/rss.xml 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/facebook/rss.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ - - - - pidgin-facebookchat Changelog - - http://code.google.com/p/pidgin-facebookchat/wiki/Changelog - Recent updates for the Facebook plugin for Pidgin - en-NZ - - pidgin-facebookchat Changelog - http://pidgin-facebookchat.googlecode.com/svn/trunk/facebook48.png - http://code.google.com/p/pidgin-facebookchat/ - 4848 - - - Version 1.62 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c50 - - Fortunately, I've been hard at work to quickly push out a new version.
-
- Grab it from
-
http://code.google.com/p/pidgin-facebookchat/wiki/Downloads
- while it's still hot]]> - Wed, 4 November 2009 18:49:10 +1300 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c50 - - - Version 1.61 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c49 -
- Changelog:
- http://code.google.com/p/pidgin-facebookchat/wiki/Changelog
- Download:
- http://code.google.com/p/pidgin-facebookchat/downloads/list
]]>
- Tue, 8 September 2009 17:38:16 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c49 -
- - Version 1.60 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c48 - - Changelog:
- http://code.google.com/p/pidgin-facebookchat/wiki/Changelog
- Download:
- http://code.google.com/p/pidgin-facebookchat/downloads/list
- (apologies to you RSS readers out there who missed out on v1.54)]]>
- Fri, 17 July 2009 22:05:20 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c48 -
- - Version 1.53 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c46 - Pidgin 2.5.8 is available and so is 1.53 of pidgin-facebookchat. -

- We've fixed some important things such as no more missing messages, and buddy names working. You can see all the neat things we've done at:
- http://code.google.com/p/pidgin-facebookchat/wiki/Changelog -

- Thank you all for using the plugin! If you feel like helping me pay for my fiancées $300/month medication bills I'd really appreciate a donation. Even one or two dollars can go a long way. You can donate at:
- http://code.google.com/p/pidgin-facebookchat/wiki/Donate -

- Otherwise, go grab the update from the usual place:
- http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Mon, 29 June 2009 20:56:20 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c46 -
- - Version 1.52 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c45 -
- Download pidgin-facebookchat from:
- http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Mon, 22 June 2009 19:04:56 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c45 -
- - Version 1.51 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c44 - -
- Download (as usual) from:
- - http://code.google.com/p/pidgin-facebookchat/downloads/list
-
- A list of the changes to the plugin is at:
- - http://code.google.com/p/pidgin-facebookchat/wiki/Changelog
-
- If you're a package maintainer, you'll want to look at my blog post:
- - http://eion.robbmob.com/blog/2009/06/12/pidgin-facebookchat-v1-51-important-changes/
- (Shameless plug)
-
- And of course, if you like this plugin feel free to leave a comment or donation at
- - http://code.google.com/p/pidgin-facebookchat/wiki/Donate - ]]>
- Sat, 13 June 2009 19:24:19 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c44 -
- - Version 1.50 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c42 -
- This version should (hopefully) fix the bandwidth issues that people are having, as well as a crash-on-quit issue. -

- Oh, and some people may be interested to try setting their status to 'idle' when they set their status to 'away'. Maybe. Haven't tried it :) -

- Download v1.50 of the plugin from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Mon, 13 Apr 2009 00:03:29 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c42 -
- - Version 1.47 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c41 -
- Download v1.47 of the plugin from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Wed, 31 Dec 2008 18:18:18 +1300 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c41 -
- - Version 1.46 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c40 -
-We've added support for Pokes, we've made the idle/away stuff work properly, the buddy icons are larger for everyone, and aliases work better on buddies. -

-Just a bit of news: this Facebook plugin is now in Meebo, thanks to Mark Doliner from Meebo who is a "Project Member" of this plugin. Also, Casey Ho (who has been doing a fantastic job of triaging issues) has been promoted to "Project Owner" so that he can mess around with the page a bit. -

-I just wanted to say a big public thanks to both these people for their hard work. This plugin gets thousands of downloads and it's so exciting for me to see the plugin in Meebo so that thousands more people can enjoy the plugin :) -

-Without futher ado, grab v1.46 of the plugin from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Mon, 29 Dec 2008 23:00:00 +1300 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c40 -
- - Version 1.45 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c39 -
-Go get v1.45 from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Fri, 19 Dec 2008 00:00:00 +1300 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c39 -
- - Version 1.44 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c38 -
-Go get v1.44 from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list]]>
- Tue, 11 Dec 2008 00:00:00 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c38 -
- - Version 1.43 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c37 -
-It fixes 2 major crashes, and the status message now updates properly. Also, the .deb package should work for Finch or libpurple installs now, and not just Pidgin. -

-Go get v1.43 from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list -

-Send us developers some hard-earned love at:
-http://code.google.com/p/pidgin-facebookchat/wiki/Donate ]]>
- Mon, 8 Dec 2008 00:00:00 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c37 -
- - Version 1.41 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c35 -
-The only real reason for this update is to address a couple of minor bugs and some annoying crashes. That should be all of them. -Also new to the table is an RSS feed at http://pidgin-facebookchat.googlecode.com/svn/trunk/rss.xml. I'll keep updating the issue, so that you can still be kept up-to-date by email, but now you have another option. -

-From now on, the minimum version of Pidgin you'll need is 2.3.0. Also, the source package has changed slightly, so if you've got any automated build scripts you might want to update them. -

-Go download v1.41 from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list ]]>
- Wed, 3 Dec 2008 17:41:09 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c36 -
- - Version 1.40 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c35 -
-Go download v1.40 from:
-http://code.google.com/p/pidgin-facebookchat/downloads/list ]]>
- Wed, 3 Dec 2008 07:31:09 +1200 - http://code.google.com/p/pidgin-facebookchat/issues/detail?id=24#c35 -
- - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/filectl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/filectl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/filectl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/filectl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,270 +0,0 @@ -/** - * Send commands to Purple via ~/.purple/control - * - * Originally by Eric Warmenhoven - * Compile fixes/mini hacks Alex Bennee - * and Brian Tarricone - */ - -/* system includes */ -#include -#include -#include -#include -#include -#include -#include - -#include "account.h" -#include "config.h" -#include "core.h" -#include "conversation.h" -#include "debug.h" -#include "eventloop.h" -#include "internal.h" -#include "util.h" -#include "version.h" - -#define FILECTL_PLUGIN_ID "core-filectl" -static int check; -static time_t mtime; - -static void init_file(void); -static gboolean check_file(void); - -/* parse char * as if were word array */ -char *getarg(char *, int, int); - -/* go through file and run any commands */ -void -run_commands() -{ - struct stat finfo; - char filename[256]; - char buffer[1024]; - char *command, *arg1, *arg2; - FILE *file; - - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); - - file = g_fopen(filename, "r+"); - while (fgets(buffer, sizeof(buffer), file)) { - - /* Read the next command */ - if (buffer[strlen(buffer) - 1] == '\n') - buffer[strlen(buffer) - 1] = 0; - purple_debug_misc("filectl", "read: %s\n", buffer); - command = getarg(buffer, 0, 0); - - if (!g_ascii_strncasecmp(command, "login", 6)) { - PurpleAccount *account; - - arg1 = getarg(buffer, 1, 0); - arg2 = getarg(buffer, 2, 1); - - account = purple_accounts_find(arg1, arg2); - if (account != NULL) /* username found */ - purple_account_connect(account); - - free(arg1); - free(arg2); - - } else if (!g_ascii_strncasecmp(command, "logout", 7)) { - PurpleAccount *account; - - arg1 = getarg(buffer, 1, 1); - arg2 = getarg(buffer, 2, 1); - - account = purple_accounts_find(arg1, arg2); - if (account != NULL) - { - purple_account_disconnect(account); - } - else if (arg1 == NULL) - purple_connections_disconnect_all(); - - free(arg1); - free(arg2); - -/* purple_find_conversation() is gone in 2.0.0. */ -#if 0 - } else if (!g_ascii_strncasecmp(command, "send", 4)) { - PurpleConversation *conv; - - arg1 = getarg(buffer, 1, 0); - arg2 = getarg(buffer, 2, 1); - - conv = purple_find_conversation(PURPLE_CONV_TYPE_ANY, arg1); - if (conv != NULL) - { - /* - purple_conversation_write(conv, arg2, WFLAG_SEND, NULL, time(NULL), -1); - serv_send_im(conv->gc, arg1, arg2, 0); - */ - } - - free(arg1); - free(arg2); -#endif - - } else if (!g_ascii_strncasecmp(command, "away", 4)) { - arg1 = getarg(buffer, 1, 1); - /* serv_set_away_all(arg1); */ - free(arg1); - - } else if (!g_ascii_strncasecmp(command, "hide", 4)) { - purple_blist_set_visible(FALSE); - - } else if (!g_ascii_strncasecmp(command, "unhide", 6)) { - purple_blist_set_visible(TRUE); - - } else if (!g_ascii_strncasecmp(command, "back", 4)) { - /* do_im_back(); */ - - } else if (!g_ascii_strncasecmp(command, "quit", 4)) { - purple_core_quit(); - - } - - free(command); - } - - fclose(file); - - if (g_stat(filename, &finfo) != 0) - return; - mtime = finfo.st_mtime; -} - -/** - * Check to see if the size of the file is > 0. if so, run commands. - */ -void -init_file() -{ - /* most of this was taken from Bash v2.04 by the FSF */ - struct stat finfo; - char filename[256]; - - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); - - if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0)) - run_commands(); -} - -/** - * Check to see if we need to run commands from the file. - */ -gboolean -check_file() -{ - /* most of this was taken from Bash v2.04 by the FSF */ - struct stat finfo; - char filename[256]; - - sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", purple_user_dir()); - - if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0)) - { - if (mtime != finfo.st_mtime) { - purple_debug_info("filectl", "control changed, checking\n"); - run_commands(); - } - } - - return TRUE; -} - -char * -getarg(char *line, int which, int remain) -{ - char *arr; - char *val; - int count = -1; - int i; - int state = 0; - - for (i = 0; i < strlen(line) && count < which; i++) { - switch (state) { - case 0: /* in whitespace, expecting word */ - if (isalnum(line[i])) { - count++; - state = 1; - } - break; - case 1: /* inside word, waiting for whitespace */ - if (isspace(line[i])) { - state = 0; - } - break; - } - } - - arr = strdup(&line[i - 1]); - if (remain) - return arr; - - for (i = 0; i < strlen(arr) && isalnum(arr[i]); i++); - arr[i] = 0; - val = strdup(arr); - arr[i] = ' '; - free(arr); - return val; -} - -/* - * EXPORTED FUNCTIONS - */ - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - init_file(); - check = purple_timeout_add_seconds(5, (GSourceFunc)check_file, NULL); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - purple_timeout_remove(check); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - FILECTL_PLUGIN_ID, /**< id */ - N_("File Control"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Allows control by entering commands in a file."), - /** description */ - N_("Allows control by entering commands in a file."), - "Eric Warmenhoven ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL /**< extra_info */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(filectl, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/fortuneprofile.pl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/fortuneprofile.pl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/fortuneprofile.pl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/fortuneprofile.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -# FORTUNE PROFILE -# -# Sets your AIM profile to a fortune (with a header and footer of your -# choice). -# - -# By Sean Egan -# seanegan@gmail.com -# AIM: SeanEgn -# -# Updated by Nathan Conrad, 31 January 2002 -# Changes: -# * Fortunes have HTML tabs and newlines -# AIM: t98502 -# ICQ: 16106363 -# -# Updated by Mark Doliner, 15 October 2002 -# Changes: -# * Modified to work with the changed perl interface of gaim 0.60 -# * Fixed a bug where your info would be set to nothing if you had -# no pre and no post message -# AIM: lbdash -# -# Updated by Christian Hammond, 20 August 2003 -# Changes: -# * Modified to work with the changed perl interface of gaim 0.68 -# AIM: ChipX86 - -# Copyright (C) 2001 Sean Egan - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -use Gaim; - -%PLUGIN_INFO = ( - perl_api_version => 2, - name => "Fortune Profile", - version => "3.4", - summary => "Sets your AIM profile to a fortune (with a header and footer of your choice).", - description => "Sets your AIM profile to a fortune (with a header and footer of your choice).", - author => "Sean Egan ", - url => "http://gaim.sf.net/", - - load => "plugin_load" -); - -sub plugin_init { - return %PLUGIN_INFO; -} - -sub plugin_load { - $plugin = shift; - - $tab = " "; - $tab = $tab . $tab . $tab . $tab; - $nl = "
"; - - $seconds = 30; # Delay before updating away messages. - $max = 1020; # Max length of an profile. It should be - # 1024, but I am being safe - $pre_message = ""; # This gets added before the fortune - - $post_message =""; - - $len = 0; - if ($pre_message ne "") { - $len += length( $pre_message . "---$nl" ); - } - if ($post_message ne "") { - $len += length("---$nl" . $post_message); - } - - # Command to get dynamic message from - $command = "fortune -sn " . ($max - $len); - - # output the first message and start the timers... - # This is done as a timeout to prevent attempts to set the - # profile before logging in. - Gaim::timeout_add($plugin, $seconds, \&update_away, 0); -} - -sub update_away { - # The fortunes are expanded into HTML (the tabs and newlines) which - # causes the -s option of fortune to be a little bit meaningless. This - # will loop until it gets a fortune of a good size (after expansion). - - do { - do { #It's a while loop because it doesn't always work for some reason - $fortune = `$command`; - if ($? == -1) { - return; - } - } while ($fortune eq ""); - $fortune =~ s/\n/$nl/g; - $fortune =~ s/\t/$tab/g; - } while ((length($fortune) + $len ) > $max); - - $message = $fortune; - if ($pre_message ne "") { - $message = $pre_message . "---$nl" . $message; - } - if ($post_message ne "") { - $message = $message . "---$nl" . $post_message ; - } - - foreach $account (Gaim::accounts()) { - if ($account->is_connected()) { - $account->set_user_info($message); - } - } - - Gaim::timeout_add($plugin, $seconds, \&update_away, 0); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/helloworld.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/helloworld.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/helloworld.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/helloworld.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/* - * Hello World Plugin - * - * Copyright (C) 2004, Gary Kramlich , - * 2007, John Bailey - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -/* config.h may define PURPLE_PLUGINS; protect the definition here so that we - * don't get complaints about redefinition when it's not necessary. */ -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#include - -/* This will prevent compiler errors in some instances and is better explained in the - * how-to documents on the wiki */ -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -#include -#include -#include - -/* we're adding this here and assigning it in plugin_load because we need - * a valid plugin handle for our call to purple_notify_message() in the - * plugin_action_test_cb() callback function */ -PurplePlugin *helloworld_plugin = NULL; - -/* This function is the callback for the plugin action we added. All we're - * doing here is displaying a message. When the user selects the plugin - * action, this function is called. */ -static void -plugin_action_test_cb (PurplePluginAction * action) -{ - purple_notify_message (helloworld_plugin, PURPLE_NOTIFY_MSG_INFO, - "Plugin Actions Test", "This is a plugin actions test :)", NULL, NULL, - NULL); -} - -/* we tell libpurple in the PurplePluginInfo struct to call this function to - * get a list of plugin actions to use for the plugin. This function gives - * libpurple that list of actions. */ -static GList * -plugin_actions (PurplePlugin * plugin, gpointer context) -{ - /* some C89 (a.k.a. ANSI C) compilers will warn if any variable declaration - * includes an initilization that calls a function. To avoid that, we - * generally initialize our variables first with constant values like NULL - * or 0 and assign to them with function calls later */ - GList *list = NULL; - PurplePluginAction *action = NULL; - - /* The action gets created by specifying a name to show in the UI and a - * callback function to call. */ - action = purple_plugin_action_new ("Plugin Action Test", plugin_action_test_cb); - - /* libpurple requires a GList of plugin actions, even if there is only one - * action in the list. We append the action to a GList here. */ - list = g_list_append (list, action); - - /* Once the list is complete, we send it to libpurple. */ - return list; -} - -static gboolean -plugin_load (PurplePlugin * plugin) -{ - purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!", - "This is the Hello World! plugin :)", NULL, NULL, - NULL); - - helloworld_plugin = plugin; /* assign this here so we have a valid handle later */ - - return TRUE; -} - -/* For specific notes on the meanings of each of these members, consult the C Plugin Howto - * on the website. */ -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - - "core-hello_world", - "Hello World!", - DISPLAY_VERSION, /* This constant is defined in config.h, but you shouldn't use it for - your own plugins. We use it here because it's our plugin. And we're lazy. */ - - "Hello World Plugin", - "Hello World Plugin", - "John Bailey ", /* correct author */ - "http://helloworld.tld", - - - plugin_load, - NULL, - NULL, - - NULL, - NULL, - NULL, - plugin_actions, /* this tells libpurple the address of the function to call - to get the list of plugin actions. */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin (PurplePlugin * plugin) -{ -} - -PURPLE_INIT_PLUGIN (hello_world, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/idle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/idle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/idle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/idle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,346 +0,0 @@ -/* - * idle.c - I'dle Mak'er plugin for Purple - * - * This file is part of Purple. - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "plugin.h" -#include "request.h" -#include "server.h" -#include "status.h" -#include "version.h" - -/* This plugin no longer depends on gtk */ -#define IDLE_PLUGIN_ID "core-idle" - -static GList *idled_accts = NULL; - -static gboolean -unidle_filter(PurpleAccount *acct) -{ - if (g_list_find(idled_accts, acct)) - return TRUE; - - return FALSE; -} - -static gboolean -idleable_filter(PurpleAccount *account) -{ - PurplePlugin *prpl; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - g_return_val_if_fail(prpl != NULL, FALSE); - - return (PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->set_idle != NULL); -} - -static void -set_idle_time(PurpleAccount *acct, int mins_idle) -{ - time_t t; - PurpleConnection *gc = purple_account_get_connection(acct); - PurplePresence *presence = purple_account_get_presence(acct); - - if (!gc) - return; - - purple_debug_info("idle", - "setting idle time for %s to %d\n", - purple_account_get_username(acct), mins_idle); - - if (mins_idle) - t = time(NULL) - (60 * mins_idle); /* subtract seconds idle from current time */ - else - t = 0; /* time idle is irrelevant */ - - purple_presence_set_idle(presence, mins_idle ? TRUE : FALSE, t); -} - -static void -idle_action_ok(void *ignored, PurpleRequestFields *fields) -{ - int tm = purple_request_fields_get_integer(fields, "mins"); - PurpleAccount *acct = purple_request_fields_get_account(fields, "acct"); - - /* only add the account to the GList if it's not already been idled */ - if (!unidle_filter(acct)) - { - purple_debug_misc("idle", - "%s hasn't been idled yet; adding to list.\n", - purple_account_get_username(acct)); - idled_accts = g_list_append(idled_accts, acct); - } - - set_idle_time(acct, tm); -} - -static void -idle_all_action_ok(void *ignored, PurpleRequestFields *fields) -{ - PurpleAccount *acct = NULL; - GList *list, *iter; - int tm = purple_request_fields_get_integer(fields, "mins"); - const char *prpl_id = NULL; - - list = purple_accounts_get_all_active(); - for(iter = list; iter; iter = iter->next) { - acct = (PurpleAccount *)(iter->data); - - if(acct) - prpl_id = purple_account_get_protocol_id(acct); - - if(acct && idleable_filter(acct)) { - purple_debug_misc("idle", "Idling %s.\n", - purple_account_get_username(acct)); - - set_idle_time(acct, tm); - - if(!g_list_find(idled_accts, acct)) - idled_accts = g_list_append(idled_accts, acct); - } - } - - g_list_free(list); -} - -static void -unidle_action_ok(void *ignored, PurpleRequestFields *fields) -{ - PurpleAccount *acct = purple_request_fields_get_account(fields, "acct"); - - set_idle_time(acct, 0); /* unidle the account */ - - /* once the account has been unidled it shouldn't be in the list */ - idled_accts = g_list_remove(idled_accts, acct); -} - - -static void -idle_action(PurplePluginAction *action) -{ - /* Use the super fancy request API */ - - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_account_new("acct", _("Account"), NULL); - purple_request_field_account_set_filter(field, idleable_filter); - purple_request_field_account_set_show_all(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_int_new("mins", _("Minutes"), 10); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - N_("I'dle Mak'er"), - _("Set Account Idle Time"), - NULL, - request, - _("_Set"), G_CALLBACK(idle_action_ok), - _("_Cancel"), NULL, - NULL, NULL, NULL, - NULL); -} - -static void -unidle_action(PurplePluginAction *action) -{ - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - if (idled_accts == NULL) - { - purple_notify_info(NULL, NULL, _("None of your accounts are idle."), NULL); - return; - } - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_account_new("acct", _("Account"), NULL); - purple_request_field_account_set_filter(field, unidle_filter); - purple_request_field_account_set_show_all(field, FALSE); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - N_("I'dle Mak'er"), - _("Unset Account Idle Time"), - NULL, - request, - _("_Unset"), G_CALLBACK(unidle_action_ok), - _("_Cancel"), NULL, - NULL, NULL, NULL, - NULL); -} - -static void -idle_all_action(PurplePluginAction *action) -{ - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_int_new("mins", _("Minutes"), 10); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - N_("I'dle Mak'er"), - _("Set Idle Time for All Accounts"), - NULL, - request, - _("_Set"), G_CALLBACK(idle_all_action_ok), - _("_Cancel"), NULL, - NULL, NULL, NULL, - NULL); -} - -static void -unidle_all_action(PurplePluginAction *action) -{ - GList *l; - - /* freeing the list here will cause segfaults if the user idles an account - * after the list is freed */ - for (l = idled_accts; l; l = l->next) - { - PurpleAccount *account = l->data; - set_idle_time(account, 0); - } - - g_list_free(idled_accts); - idled_accts = NULL; -} - -static GList * -actions(PurplePlugin *plugin, gpointer context) -{ - GList *l = NULL; - PurplePluginAction *act = NULL; - - act = purple_plugin_action_new(_("Set Account Idle Time"), - idle_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Unset Account Idle Time"), - unidle_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Set Idle Time for All Accounts"), - idle_all_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new( - _("Unset Idle Time for All Idled Accounts"), unidle_all_action); - l = g_list_append(l, act); - - return l; -} - -static void -signing_off_cb(PurpleConnection *gc, void *data) -{ - PurpleAccount *account; - - account = purple_connection_get_account(gc); - idled_accts = g_list_remove(idled_accts, account); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_signal_connect(purple_connections_get_handle(), "signing-off", - plugin, - PURPLE_CALLBACK(signing_off_cb), NULL); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - unidle_all_action(NULL); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - IDLE_PLUGIN_ID, - - /* This is a cultural reference. Dy'er Mak'er is a song by Led Zeppelin. - If that doesn't translate well into your language, drop the 's before translating. */ - N_("I'dle Mak'er"), - DISPLAY_VERSION, - N_("Allows you to hand-configure how long you've been idle"), - N_("Allows you to hand-configure how long you've been idle"), - "Eric Warmenhoven ", - PURPLE_WEBSITE, - plugin_load, - plugin_unload, - NULL, - NULL, - NULL, - NULL, - actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - - -PURPLE_INIT_PLUGIN(idle, init_plugin, info) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-client.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-client.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-client.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-client.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -/* - * IPC test client plugin. - * - * Copyright (C) 2003 Christian Hammond. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -#define IPC_TEST_CLIENT_PLUGIN_ID "core-ipc-test-client" - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - PurplePlugin *server_plugin; - gboolean ok; - int result; - - server_plugin = purple_plugins_find_with_id("core-ipc-test-server"); - - if (server_plugin == NULL) - { - purple_debug_error("ipc-test-client", - "Unable to locate plugin core-ipc-test-server, " - "needed for IPC.\n"); - - return TRUE; - } - - result = (int)purple_plugin_ipc_call(server_plugin, "add", &ok, 36, 6); - - if (!ok) - { - purple_debug_error("ipc-test-client", - "Unable to call IPC function 'add' in " - "core-ipc-test-server plugin."); - - return TRUE; - } - - purple_debug_info("ipc-test-client", "36 + 6 = %d\n", result); - - result = (int)purple_plugin_ipc_call(server_plugin, "sub", &ok, 50, 8); - - if (!ok) - { - purple_debug_error("ipc-test-client", - "Unable to call IPC function 'sub' in " - "core-ipc-test-server plugin."); - - return TRUE; - } - - purple_debug_info("ipc-test-client", "50 - 8 = %d\n", result); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - IPC_TEST_CLIENT_PLUGIN_ID, /**< id */ - N_("IPC Test Client"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Test plugin IPC support, as a client."), - /** description */ - N_("Test plugin IPC support, as a client. This locates the server " - "plugin and calls the commands registered."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - info.dependencies = g_list_append(info.dependencies, - "core-ipc-test-server"); -} - -PURPLE_INIT_PLUGIN(ipctestclient, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-server.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-server.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-server.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ipc-test-server.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* - * IPC test server plugin. - * - * Copyright (C) 2003 Christian Hammond. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#define IPC_TEST_SERVER_PLUGIN_ID "core-ipc-test-server" - -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -static int -add_func(int i1, int i2) -{ - purple_debug_misc("ipc-test-server", "Got %d, %d, returning %d\n", - i1, i2, i1 + i2); - return i1 + i2; -} - -static int -sub_func(int i1, int i2) -{ - purple_debug_misc("ipc-test-server", "Got %d, %d, returning %d\n", - i1, i2, i1 - i2); - return i1 - i2; -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_plugin_ipc_register(plugin, "add", PURPLE_CALLBACK(add_func), - purple_marshal_INT__INT_INT, - purple_value_new(PURPLE_TYPE_INT), 2, - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_INT)); - - purple_plugin_ipc_register(plugin, "sub", PURPLE_CALLBACK(sub_func), - purple_marshal_INT__INT_INT, - purple_value_new(PURPLE_TYPE_INT), 2, - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_INT)); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - IPC_TEST_SERVER_PLUGIN_ID, /**< id */ - N_("IPC Test Server"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Test plugin IPC support, as a server."), - /** description */ - N_("Test plugin IPC support, as a server. This registers the IPC " - "commands."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ipctestserver, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/joinpart.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/joinpart.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/joinpart.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/joinpart.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,314 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "conversation.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -#define JOINPART_PLUGIN_ID "core-rlaager-joinpart" - - -/* Preferences */ - -/* The number of minutes before a person is considered - * to have stopped being part of active conversation. */ -#define DELAY_PREF "/plugins/core/joinpart/delay" -#define DELAY_DEFAULT 10 - -/* The number of people that must be in a room for this - * plugin to have any effect */ -#define THRESHOLD_PREF "/plugins/core/joinpart/threshold" -#define THRESHOLD_DEFAULT 20 - -/* Hide buddies */ -#define HIDE_BUDDIES_PREF "/plugins/core/joinpart/hide_buddies" -#define HIDE_BUDDIES_DEFAULT FALSE - -struct joinpart_key -{ - PurpleConversation *conv; - char *user; -}; - -static guint joinpart_key_hash(const struct joinpart_key *key) -{ - g_return_val_if_fail(key != NULL, 0); - - return g_direct_hash(key->conv) + g_str_hash(key->user); -} - -static gboolean joinpart_key_equal(const struct joinpart_key *a, const struct joinpart_key *b) -{ - if (a == NULL) - return (b == NULL); - else if (b == NULL) - return FALSE; - - return (a->conv == b->conv) && !strcmp(a->user, b->user); -} - -static void joinpart_key_destroy(struct joinpart_key *key) -{ - g_return_if_fail(key != NULL); - - g_free(key->user); - g_free(key); -} - -static gboolean should_hide_notice(PurpleConversation *conv, const char *name, - GHashTable *users) -{ - PurpleConvChat *chat; - int threshold; - struct joinpart_key key; - time_t *last_said; - - g_return_val_if_fail(conv != NULL, FALSE); - g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE); - - /* If the room is small, don't bother. */ - chat = PURPLE_CONV_CHAT(conv); - threshold = purple_prefs_get_int(THRESHOLD_PREF); - if (g_list_length(purple_conv_chat_get_users(chat)) < threshold) - return FALSE; - - if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) && - purple_find_buddy(purple_conversation_get_account(conv), name)) - return FALSE; - - /* Only show the notice if the user has spoken recently. */ - key.conv = conv; - key.user = (gchar *)name; - last_said = g_hash_table_lookup(users, &key); - if (last_said != NULL) - { - int delay = purple_prefs_get_int(DELAY_PREF); - if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL)) - return FALSE; - } - - return TRUE; -} - -static gboolean chat_buddy_leaving_cb(PurpleConversation *conv, const char *name, - const char *reason, GHashTable *users) -{ - return should_hide_notice(conv, name, users); -} - -static gboolean chat_buddy_joining_cb(PurpleConversation *conv, const char *name, - PurpleConvChatBuddyFlags flags, - GHashTable *users) -{ - return should_hide_notice(conv, name, users); -} - -static void received_chat_msg_cb(PurpleAccount *account, char *sender, - char *message, PurpleConversation *conv, - PurpleMessageFlags flags, GHashTable *users) -{ - struct joinpart_key key; - time_t *last_said; - - /* Most of the time, we'll already have tracked the user, - * so we avoid memory allocation here. */ - key.conv = conv; - key.user = sender; - last_said = g_hash_table_lookup(users, &key); - if (last_said != NULL) - { - /* They just said something, so update the time. */ - time(last_said); - } - else - { - struct joinpart_key *key2; - - key2 = g_new(struct joinpart_key, 1); - key2->conv = conv; - key2->user = g_strdup(sender); - - last_said = g_new(time_t, 1); - time(last_said); - - g_hash_table_insert(users, key2, last_said); - } -} - -static gboolean check_expire_time(struct joinpart_key *key, - time_t *last_said, time_t *limit) -{ - purple_debug_info("joinpart", "Removing key for %s\n", key->user); - return (*last_said < *limit); -} - -static gboolean clean_users_hash(GHashTable *users) -{ - int delay = purple_prefs_get_int(DELAY_PREF); - time_t limit = time(NULL) - (60 * delay); - - g_hash_table_foreach_remove(users, (GHRFunc)check_expire_time, &limit); - - return TRUE; -} - -static gboolean plugin_load(PurplePlugin *plugin) -{ - void *conv_handle; - GHashTable *users; - guint id; - gpointer *data; - - users = g_hash_table_new_full((GHashFunc)joinpart_key_hash, - (GEqualFunc)joinpart_key_equal, - (GDestroyNotify)joinpart_key_destroy, - g_free); - - conv_handle = purple_conversations_get_handle(); - purple_signal_connect(conv_handle, "chat-buddy-joining", plugin, - PURPLE_CALLBACK(chat_buddy_joining_cb), users); - purple_signal_connect(conv_handle, "chat-buddy-leaving", plugin, - PURPLE_CALLBACK(chat_buddy_leaving_cb), users); - purple_signal_connect(conv_handle, "received-chat-msg", plugin, - PURPLE_CALLBACK(received_chat_msg_cb), users); - - /* Cleanup every 5 minutes */ - id = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, users); - - data = g_new(gpointer, 2); - data[0] = users; - data[1] = GUINT_TO_POINTER(id); - plugin->extra = data; - - return TRUE; -} - -static gboolean plugin_unload(PurplePlugin *plugin) -{ - gpointer *data = plugin->extra; - - /* Destroy the hash table. The core plugin code will - * disconnect the signals, and since Purple is single-threaded, - * we don't have to worry one will be called after this. */ - g_hash_table_destroy((GHashTable *)data[0]); - - purple_timeout_remove(GPOINTER_TO_UINT(data[1])); - g_free(data); - - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - g_return_val_if_fail(plugin != NULL, FALSE); - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_label(_("Hide Joins/Parts")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label(THRESHOLD_PREF, - /* Translators: Followed by an input request a number of people */ - _("For rooms with more than this many people")); - purple_plugin_pref_set_bounds(ppref, 0, 1000); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label(DELAY_PREF, - _("If user has not spoken in this many minutes")); - purple_plugin_pref_set_bounds(ppref, 0, 8 * 60); /* 8 Hours */ - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label(HIDE_BUDDIES_PREF, - _("Apply hiding rules to buddies")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (reserved) */ - NULL, /* frame (reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - JOINPART_PLUGIN_ID, /**< id */ - N_("Join/Part Hiding"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Hides extraneous join/part messages."), - /** description */ - N_("This plugin hides join/part messages in large " - "rooms, except for those users actively taking " - "part in a conversation."), - "Richard Laager ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none("/plugins/core/joinpart"); - - purple_prefs_add_int(DELAY_PREF, DELAY_DEFAULT); - purple_prefs_add_int(THRESHOLD_PREF, THRESHOLD_DEFAULT); - purple_prefs_add_bool(HIDE_BUDDIES_PREF, HIDE_BUDDIES_DEFAULT); -} - -PURPLE_INIT_PLUGIN(joinpart, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/log_reader.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/log_reader.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/log_reader.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/log_reader.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2966 +0,0 @@ -#include "internal.h" - -#include - -#include "debug.h" -#include "log.h" -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" -#include "stringref.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -/* This must be the last Purple header included. */ -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* Where is the Windows partition mounted? */ -#ifndef PURPLE_LOG_READER_WINDOWS_MOUNT_POINT -#define PURPLE_LOG_READER_WINDOWS_MOUNT_POINT "/mnt/windows" -#endif - -enum name_guesses { - NAME_GUESS_UNKNOWN, - NAME_GUESS_ME, - NAME_GUESS_THEM -}; - -/* Some common functions. */ -static int get_month(const char *month) -{ - int iter; - const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL}; - for (iter = 0; months[iter]; iter++) { - if (strcmp(month, months[iter]) == 0) - break; - } - return iter; -} - - -/***************************************************************************** - * Adium Logger * - *****************************************************************************/ - -/* The adium logger doesn't write logs, only reads them. This is to include - * Adium logs in the log viewer transparently. - */ - -static PurpleLogLogger *adium_logger; - -enum adium_log_type { - ADIUM_HTML, - ADIUM_TEXT, -}; - -struct adium_logger_data { - char *path; - enum adium_log_type type; -}; - -static GList *adium_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - PurplePlugin *plugin; - PurplePluginProtocolInfo *prpl_info; - char *prpl_name; - char *temp; - char *path; - GDir *dir; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - logdir = purple_prefs_get_string("/plugins/core/log_reader/adium/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - plugin = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - - temp = g_strdup_printf("%s.%s", prpl_name, account->username); - path = g_build_filename(logdir, temp, sn, NULL); - g_free(temp); - - dir = g_dir_open(path, 0, NULL); - if (dir) { - const gchar *file; - - while ((file = g_dir_read_name(dir))) { - if (!purple_str_has_prefix(file, sn)) - continue; - if (purple_str_has_suffix(file, ".html") || purple_str_has_suffix(file, ".AdiumHTMLLog")) { - struct tm tm; - const char *date = file; - - date += strlen(sn) + 2; - if (sscanf(date, "%u|%u|%u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) { - - purple_debug_error("Adium log parse", - "Filename timestamp parsing error\n"); - } else { - char *filename = g_build_filename(path, file, NULL); - FILE *handle = g_fopen(filename, "rb"); - char contents[57]; /* XXX: This is really inflexible. */ - char *contents2; - struct adium_logger_data *data; - size_t rd; - PurpleLog *log; - - if (!handle) { - g_free(filename); - continue; - } - - rd = fread(contents, 1, 56, handle) == 0; - fclose(handle); - contents[rd] = '\0'; - - /* XXX: This is fairly inflexible. */ - contents2 = contents; - while (*contents2 && *contents2 != '>') - contents2++; - if (*contents2) - contents2++; - while (*contents2 && *contents2 != '>') - contents2++; - if (*contents2) - contents2++; - - if (sscanf(contents2, "%u.%u.%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) { - - purple_debug_error("Adium log parse", - "Contents timestamp parsing error\n"); - g_free(filename); - continue; - } - - data = g_new0(struct adium_logger_data, 1); - data->path = filename; - data->type = ADIUM_HTML; - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = adium_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - } else if (purple_str_has_suffix(file, ".adiumLog")) { - struct tm tm; - const char *date = file; - - date += strlen(sn) + 2; - if (sscanf(date, "%u|%u|%u", - &tm.tm_year, &tm.tm_mon, &tm.tm_mday) != 3) { - - purple_debug_error("Adium log parse", - "Filename timestamp parsing error\n"); - } else { - char *filename = g_build_filename(path, file, NULL); - FILE *handle = g_fopen(filename, "rb"); - char contents[14]; /* XXX: This is really inflexible. */ - char *contents2; - struct adium_logger_data *data; - PurpleLog *log; - size_t rd; - - if (!handle) { - g_free(filename); - continue; - } - - rd = fread(contents, 1, 13, handle); - fclose(handle); - contents[rd] = '\0'; - - contents2 = contents; - while (*contents2 && *contents2 != '(') - contents2++; - if (*contents2) - contents2++; - - if (sscanf(contents2, "%u.%u.%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 3) { - - purple_debug_error("Adium log parse", - "Contents timestamp parsing error\n"); - g_free(filename); - continue; - } - - tm.tm_year -= 1900; - tm.tm_mon -= 1; - - data = g_new0(struct adium_logger_data, 1); - data->path = filename; - data->type = ADIUM_TEXT; - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = adium_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - } - } - g_dir_close(dir); - } - - g_free(prpl_name); - g_free(path); - - return list; -} - -static char *adium_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct adium_logger_data *data; - GError *error = NULL; - gchar *read = NULL; - - /* XXX: TODO: We probably want to set PURPLE_LOG_READ_NO_NEWLINE - * XXX: TODO: for HTML logs. */ - if (flags != NULL) - *flags = 0; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - - purple_debug_info("Adium log read", "Reading %s\n", data->path); - if (!g_file_get_contents(data->path, &read, NULL, &error)) { - purple_debug_error("Adium log read", "Error reading log: %s\n", - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - return g_strdup(""); - } - - if (data->type != ADIUM_HTML) { - char *escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - } - -#ifdef WIN32 - /* This problem only seems to show up on Windows. - * The BOM is displaying as a space at the beginning of the log. - */ - if (purple_str_has_prefix(read, "\xef\xbb\xbf")) - { - /* FIXME: This feels so wrong... */ - char *temp = g_strdup(&(read[3])); - g_free(read); - read = temp; - } -#endif - - /* TODO: Apply formatting. - * Replace the above hack with something better, since we'll - * be looping over the entire log file contents anyway. - */ - - return read; -} - -static int adium_logger_size (PurpleLog *log) -{ - struct adium_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - struct stat st; - - if (!data->path || stat(data->path, &st)) - st.st_size = 0; - - return st.st_size; - } - - text = adium_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void adium_logger_finalize(PurpleLog *log) -{ - struct adium_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data); -} - - -/***************************************************************************** - * Fire Logger * - *****************************************************************************/ - -#if 0 -/* The fire logger doesn't write logs, only reads them. This is to include - * Fire logs in the log viewer transparently. - */ - -static PurpleLogLogger *fire_logger; - -struct fire_logger_data { -}; - -static GList *fire_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - /* TODO: Do something here. */ - return NULL; -} - -static char * fire_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct fire_logger_data *data; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - /* TODO: Do something here. */ - return g_strdup(""); -} - -static int fire_logger_size (PurpleLog *log) -{ - g_return_val_if_fail(log != NULL, 0); - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - /* TODO: Do something here. */ - return 0; -} - -static void fire_logger_finalize(PurpleLog *log) -{ - g_return_if_fail(log != NULL); - - /* TODO: Do something here. */ -} -#endif - - -/***************************************************************************** - * Messenger Plus! Logger * - *****************************************************************************/ - -#if 0 -/* The messenger_plus logger doesn't write logs, only reads them. This is to include - * Messenger Plus! logs in the log viewer transparently. - */ - -static PurpleLogLogger *messenger_plus_logger; - -struct messenger_plus_logger_data { -}; - -static GList *messenger_plus_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - /* TODO: Do something here. */ - return NULL; -} - -static char * messenger_plus_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct messenger_plus_logger_data *data = log->logger_data; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - /* TODO: Do something here. */ - return g_strdup(""); -} - -static int messenger_plus_logger_size (PurpleLog *log) -{ - g_return_val_if_fail(log != NULL, 0); - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - /* TODO: Do something here. */ - return 0; -} - -static void messenger_plus_logger_finalize(PurpleLog *log) -{ - g_return_if_fail(log != NULL); - - /* TODO: Do something here. */ -} -#endif - - -/***************************************************************************** - * MSN Messenger Logger * - *****************************************************************************/ - -/* The msn logger doesn't write logs, only reads them. This is to include - * MSN Messenger message histories in the log viewer transparently. - */ - -static PurpleLogLogger *msn_logger; - -struct msn_logger_data { - xmlnode *root; - xmlnode *message; - const char *session_id; - int last_log; - GString *text; -}; - -/* This function is really confusing. It makes baby rlaager cry... - In other news: "You lost a lot of blood but we found most of it." - */ -static time_t msn_logger_parse_timestamp(xmlnode *message, struct tm **tm_out) -{ - const char *datetime; - static struct tm tm2; - time_t stamp; - const char *date; - const char *time; - int month; - int day; - int year; - int hour; - int min; - int sec; - char am_pm; - char *str; - static struct tm tm; - time_t t; - time_t diff; - -#ifndef G_DISABLE_CHECKS - if (message != NULL) - { - *tm_out = NULL; - - /* Trigger the usual warning. */ - g_return_val_if_fail(message != NULL, (time_t)0); - } -#endif - - datetime = xmlnode_get_attrib(message, "DateTime"); - if (!(datetime && *datetime)) - { - purple_debug_error("MSN log timestamp parse", - "Attribute missing: %s\n", "DateTime"); - return (time_t)0; - } - - stamp = purple_str_to_time(datetime, TRUE, &tm2, NULL, NULL); -#ifdef HAVE_TM_GMTOFF - tm2.tm_gmtoff = 0; -#endif -#ifdef HAVE_STRUCT_TM_TM_ZONE - /* This is used in the place of a timezone abbreviation if the - * offset is way off. The user should never really see it, but - * it's here just in case. The parens are to make it clear it's - * not a real timezone. */ - tm2.tm_zone = _("(UTC)"); -#endif - - - date = xmlnode_get_attrib(message, "Date"); - if (!(date && *date)) - { - purple_debug_error("MSN log timestamp parse", - "Attribute missing: %s\n", "Date"); - *tm_out = &tm2; - return stamp; - } - - time = xmlnode_get_attrib(message, "Time"); - if (!(time && *time)) - { - purple_debug_error("MSN log timestamp parse", - "Attribute missing: %s\n", "Time"); - *tm_out = &tm2; - return stamp; - } - - if (sscanf(date, "%u/%u/%u", &month, &day, &year) != 3) - { - purple_debug_error("MSN log timestamp parse", - "%s parsing error\n", "Date"); - *tm_out = &tm2; - return stamp; - } - else - { - if (month > 12) - { - int tmp = day; - day = month; - month = tmp; - } - } - - if (sscanf(time, "%u:%u:%u %c", &hour, &min, &sec, &am_pm) != 4) - { - purple_debug_error("MSN log timestamp parse", - "%s parsing error\n", "Time"); - *tm_out = &tm2; - return stamp; - } - - if (am_pm == 'P') { - hour += 12; - } else if (hour == 12) { - /* 12 AM = 00 hr */ - hour = 0; - } - - str = g_strdup_printf("%04i-%02i-%02iT%02i:%02i:%02i", year, month, day, hour, min, sec); - t = purple_str_to_time(str, TRUE, &tm, NULL, NULL); - - - if (stamp > t) - diff = stamp - t; - else - diff = t - stamp; - - if (diff > (14 * 60 * 60)) - { - if (day <= 12) - { - /* Swap day & month variables, to see if it's a non-US date. */ - g_free(str); - str = g_strdup_printf("%04i-%02i-%02iT%02i:%02i:%02i", year, month, day, hour, min, sec); - t = purple_str_to_time(str, TRUE, &tm, NULL, NULL); - - if (stamp > t) - diff = stamp - t; - else - diff = t - stamp; - - if (diff > (14 * 60 * 60)) - { - /* We got a time, it's not impossible, but - * the diff is too large. Display the UTC time. */ - g_free(str); - *tm_out = &tm2; - return stamp; - } - else - { - /* Legal time */ - /* Fall out */ - } - } - else - { - /* We got a time, it's not impossible, but - * the diff is too large. Display the UTC time. */ - g_free(str); - *tm_out = &tm2; - return stamp; - } - } - - /* If we got here, the time is legal with a reasonable offset. - * Let's find out if it's in our TZ. */ - if (purple_str_to_time(str, FALSE, &tm, NULL, NULL) == stamp) - { - g_free(str); - *tm_out = &tm; - return stamp; - } - g_free(str); - - /* The time isn't in our TZ, but it's reasonable. */ -#ifdef HAVE_STRUCT_TM_TM_ZONE - tm.tm_zone = " "; -#endif - *tm_out = &tm; - return stamp; -} - -static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - char *username; - PurpleBuddy *buddy; - const char *logdir; - const char *savedfilename = NULL; - char *logfile; - char *path; - GError *error = NULL; - gchar *contents = NULL; - gsize length; - xmlnode *root; - xmlnode *message; - const char *old_session_id = ""; - struct msn_logger_data *data = NULL; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - if (strcmp(account->protocol_id, "prpl-msn")) - return NULL; - - logdir = purple_prefs_get_string("/plugins/core/log_reader/msn/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - buddy = purple_find_buddy(account, sn); - - if ((username = g_strdup(purple_account_get_string( - account, "log_reader_msn_log_folder", NULL)))) { - /* As a special case, we allow the null string to kill the parsing - * straight away. This would allow the user to deal with the case - * when two account have the same username at different domains and - * only one has logs stored. - */ - if (!*username) { - g_free(username); - return list; - } - } else { - username = g_strdup(purple_normalize(account, account->username)); - } - - if (buddy) { - savedfilename = purple_blist_node_get_string((PurpleBlistNode *)buddy, - "log_reader_msn_log_filename"); - } - - if (savedfilename) { - /* As a special case, we allow the null string to kill the parsing - * straight away. This would allow the user to deal with the case - * when two buddies have the same username at different domains and - * only one has logs stored. - */ - if (!*savedfilename) { - g_free(username); - return list; - } - - logfile = g_strdup(savedfilename); - } else { - logfile = g_strdup_printf("%s.xml", purple_normalize(account, sn)); - } - - path = g_build_filename(logdir, username, "History", logfile, NULL); - - if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - gboolean found = FALSE; - char *at_sign; - GDir *dir; - - g_free(path); - - if (savedfilename) { - /* We had a saved filename, but it doesn't exist. - * Returning now is the right course of action because we don't - * want to detect another file incorrectly. - */ - g_free(username); - g_free(logfile); - return list; - } - - /* Perhaps we're using a new version of MSN with the weird numbered folders. - * I don't know how the numbers are calculated, so I'm going to attempt to - * find logs by pattern matching... - */ - - at_sign = g_strrstr(username, "@"); - if (at_sign) - *at_sign = '\0'; - - dir = g_dir_open(logdir, 0, NULL); - if (dir) { - const gchar *name; - - while ((name = g_dir_read_name(dir))) { - const char *c = name; - - if (!purple_str_has_prefix(c, username)) - continue; - - c += strlen(username); - while (*c) { - if (!g_ascii_isdigit(*c)) - break; - - c++; - } - - path = g_build_filename(logdir, name, NULL); - /* The !c makes sure we got to the end of the while loop above. */ - if (!*c && g_file_test(path, G_FILE_TEST_IS_DIR)) { - char *history_path = g_build_filename( - path, "History", NULL); - if (g_file_test(history_path, G_FILE_TEST_IS_DIR)) { - purple_account_set_string(account, - "log_reader_msn_log_folder", name); - g_free(path); - path = history_path; - found = TRUE; - break; - } - g_free(path); - g_free(history_path); - } - else - g_free(path); - } - g_dir_close(dir); - } - g_free(username); - - if (!found) { - g_free(logfile); - return list; - } - - /* If we've reached this point, we've found a History folder. */ - - username = g_strdup(purple_normalize(account, sn)); - at_sign = g_strrstr(username, "@"); - if (at_sign) - *at_sign = '\0'; - - found = FALSE; - dir = g_dir_open(path, 0, NULL); - if (dir) { - const gchar *name; - - while ((name = g_dir_read_name(dir))) { - const char *c = name; - - if (!purple_str_has_prefix(c, username)) - continue; - - c += strlen(username); - while (*c) { - if (!g_ascii_isdigit(*c)) - break; - - c++; - } - - path = g_build_filename(path, name, NULL); - if (!strcmp(c, ".xml") && - g_file_test(path, G_FILE_TEST_EXISTS)) { - found = TRUE; - g_free(logfile); - logfile = g_strdup(name); - break; - } - else - g_free(path); - } - g_dir_close(dir); - } - g_free(username); - - if (!found) { - g_free(logfile); - return list; - } - } else { - g_free(username); - g_free(logfile); - logfile = NULL; /* No sense saving the obvious buddy@domain.com. */ - } - - purple_debug_info("MSN log read", "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - g_free(path); - purple_debug_error("MSN log read", "Error reading log\n"); - if (error) - g_error_free(error); - return list; - } - g_free(path); - - /* Reading the file was successful... - * Save its name if it involves the crazy numbers. The idea here is that you could - * then tweak the blist.xml file by hand if need be. This would be the case if two - * buddies have the same username at different domains. One set of logs would get - * detected for both buddies. - */ - if (buddy && logfile) { - PurpleBlistNode *node = (PurpleBlistNode *)buddy; - purple_blist_node_set_string(node, "log_reader_msn_log_filename", logfile); - g_free(logfile); - } - - root = xmlnode_from_str(contents, length); - g_free(contents); - if (!root) - return list; - - for (message = xmlnode_get_child(root, "Message"); message; - message = xmlnode_get_next_twin(message)) { - const char *session_id; - - session_id = xmlnode_get_attrib(message, "SessionID"); - if (!session_id) { - purple_debug_error("MSN log parse", - "Error parsing message: %s\n", "SessionID missing"); - continue; - } - - if (strcmp(session_id, old_session_id)) { - /* - * The session ID differs from the last message. - * Thus, this is the start of a new conversation. - */ - struct tm *tm; - time_t stamp; - PurpleLog *log; - - data = g_new0(struct msn_logger_data, 1); - data->root = root; - data->message = message; - data->session_id = session_id; - data->text = NULL; - data->last_log = FALSE; - - stamp = msn_logger_parse_timestamp(message, &tm); - - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, stamp, tm); - log->logger = msn_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - old_session_id = session_id; - } - - if (data) - data->last_log = TRUE; - - return g_list_reverse(list); -} - -static char * msn_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct msn_logger_data *data; - GString *text = NULL; - xmlnode *message; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - if (data->text) { - /* The GTK code which displays the logs g_free()s whatever is - * returned from this function. Thus, we can't reuse the str - * part of the GString. The only solution is to free it and - * start over. - */ - g_string_free(data->text, FALSE); - } - - text = g_string_new(""); - - if (!data->root || !data->message || !data->session_id) { - /* Something isn't allocated correctly. */ - purple_debug_error("MSN log parse", - "Error parsing message: %s\n", "Internal variables inconsistent"); - data->text = text; - - return text->str; - } - - for (message = data->message; message; - message = xmlnode_get_next_twin(message)) { - - const char *new_session_id; - xmlnode *text_node; - const char *from_name = NULL; - const char *to_name = NULL; - xmlnode *from; - xmlnode *to; - enum name_guesses name_guessed = NAME_GUESS_UNKNOWN; - const char *their_name; - time_t time_unix; - struct tm *tm; - char *timestamp; - char *tmp; - const char *style; - - new_session_id = xmlnode_get_attrib(message, "SessionID"); - - /* If this triggers, something is wrong with the XML. */ - if (!new_session_id) { - purple_debug_error("MSN log parse", - "Error parsing message: %s\n", "New SessionID missing"); - break; - } - - if (strcmp(new_session_id, data->session_id)) { - /* The session ID differs from the first message. - * Thus, this is the start of a new conversation. - */ - break; - } - - text_node = xmlnode_get_child(message, "Text"); - if (!text_node) - continue; - - from = xmlnode_get_child(message, "From"); - if (from) { - xmlnode *user = xmlnode_get_child(from, "User"); - - if (user) { - from_name = xmlnode_get_attrib(user, "FriendlyName"); - - /* This saves a check later. */ - if (!*from_name) - from_name = NULL; - } - } - - to = xmlnode_get_child(message, "To"); - if (to) { - xmlnode *user = xmlnode_get_child(to, "User"); - if (user) { - to_name = xmlnode_get_attrib(user, "FriendlyName"); - - /* This saves a check later. */ - if (!*to_name) - to_name = NULL; - } - } - - their_name = from_name; - if (from_name && purple_prefs_get_bool("/plugins/core/log_reader/use_name_heuristics")) { - const char *friendly_name = purple_connection_get_display_name(log->account->gc); - - if (friendly_name != NULL) { - int friendly_name_length = strlen(friendly_name); - const char *alias; - int alias_length; - PurpleBuddy *buddy = purple_find_buddy(log->account, log->name); - gboolean from_name_matches; - gboolean to_name_matches; - - if (buddy) - their_name = purple_buddy_get_alias(buddy); - - if (log->account->alias) - { - alias = log->account->alias; - alias_length = strlen(alias); - } - else - { - alias = ""; - alias_length = 0; - } - - /* Try to guess which user is me. - * The first step is to determine if either of the names matches either my - * friendly name or alias. For this test, "match" is defined as: - * ^(friendly_name|alias)([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (purple_str_has_prefix(from_name, friendly_name) && - !isalnum(*(from_name + friendly_name_length))) || - (purple_str_has_prefix(from_name, alias) && - !isalnum(*(from_name + alias_length))); - - to_name_matches = to_name != NULL && ( - (purple_str_has_prefix(to_name, friendly_name) && - !isalnum(*(to_name + friendly_name_length))) || - (purple_str_has_prefix(to_name, alias) && - !isalnum(*(to_name + alias_length)))); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_ME; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } else { - if (buddy) { - const char *server_alias = NULL; - char *alias = g_strdup(purple_buddy_get_alias(buddy)); - char *temp; - - /* "Truncate" the string at the first non-alphanumeric - * character. The idea is to relax the comparison. - */ - for (temp = alias; *temp ; temp++) { - if (!isalnum(*temp)) { - *temp = '\0'; - break; - } - } - alias_length = strlen(alias); - - /* Try to guess which user is them. - * The first step is to determine if either of the names - * matches their alias. For this test, "match" is - * defined as: ^alias([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (purple_str_has_prefix( - from_name, alias) && - !isalnum(*(from_name + - alias_length))); - - to_name_matches = to_name && (purple_str_has_prefix( - to_name, alias) && - !isalnum(*(to_name + - alias_length))); - - g_free(alias); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_ME; - } else if ((server_alias = purple_buddy_get_server_alias(buddy))) { - friendly_name_length = - strlen(server_alias); - - /* Try to guess which user is them. - * The first step is to determine if either of - * the names matches their friendly name. For - * this test, "match" is defined as: - * ^friendly_name([^a-zA-Z0-9].*)?$ - */ - from_name_matches = (purple_str_has_prefix( - from_name, - server_alias) && - !isalnum(*(from_name + - friendly_name_length))); - - to_name_matches = to_name && ( - (purple_str_has_prefix( - to_name, server_alias) && - !isalnum(*(to_name + - friendly_name_length)))); - - if (from_name_matches) { - if (!to_name_matches) { - name_guessed = NAME_GUESS_THEM; - } - } else if (to_name_matches) { - name_guessed = NAME_GUESS_ME; - } - } - } - } - } - } - - if (name_guessed != NAME_GUESS_UNKNOWN) { - text = g_string_append(text, ""); - } - - time_unix = msn_logger_parse_timestamp(message, &tm); - - timestamp = g_strdup_printf("(%02u:%02u:%02u) ", - tm->tm_hour, tm->tm_min, tm->tm_sec); - text = g_string_append(text, timestamp); - g_free(timestamp); - - if (from_name) { - text = g_string_append(text, ""); - - if (name_guessed == NAME_GUESS_ME) { - if (log->account->alias) - text = g_string_append(text, log->account->alias); - else - text = g_string_append(text, log->account->username); - } - else if (name_guessed == NAME_GUESS_THEM) - text = g_string_append(text, their_name); - else - text = g_string_append(text, from_name); - - text = g_string_append(text, ": "); - } - - if (name_guessed != NAME_GUESS_UNKNOWN) - text = g_string_append(text, ""); - - style = xmlnode_get_attrib(text_node, "Style"); - - tmp = xmlnode_get_data(text_node); - if (style && *style) { - text = g_string_append(text, ""); - text = g_string_append(text, tmp); - text = g_string_append(text, "
"); - } else { - text = g_string_append(text, tmp); - text = g_string_append(text, "
"); - } - g_free(tmp); - } - - data->text = text; - - return text->str; -} - -static int msn_logger_size (PurpleLog *log) -{ - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) - return 0; - - text = msn_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void msn_logger_finalize(PurpleLog *log) -{ - struct msn_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - if (data->last_log) - xmlnode_free(data->root); - - if (data->text) - g_string_free(data->text, FALSE); - - g_free(data); -} - - -/***************************************************************************** - * Trillian Logger * - *****************************************************************************/ - -/* The trillian logger doesn't write logs, only reads them. This is to include - * Trillian logs in the log viewer transparently. - */ - -static PurpleLogLogger *trillian_logger; -static void trillian_logger_finalize(PurpleLog *log); - -struct trillian_logger_data { - char *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list */ - int offset; - int length; - char *their_nickname; -}; - -static GList *trillian_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - PurplePlugin *plugin; - PurplePluginProtocolInfo *prpl_info; - char *prpl_name; - const char *buddy_name; - char *filename; - char *path; - GError *error = NULL; - gchar *contents = NULL; - gsize length; - gchar *line; - gchar *c; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - logdir = purple_prefs_get_string("/plugins/core/log_reader/trillian/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - plugin = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - prpl_name = g_ascii_strup(prpl_info->list_icon(account, NULL), -1); - - buddy_name = purple_normalize(account, sn); - - filename = g_strdup_printf("%s.log", buddy_name); - path = g_build_filename( - logdir, prpl_name, filename, NULL); - - purple_debug_info("Trillian log list", "Reading %s\n", path); - /* FIXME: There's really no need to read the entire file at once. - * See src/log.c:old_logger_list for a better approach. - */ - if (!g_file_get_contents(path, &contents, &length, &error)) { - if (error) { - g_error_free(error); - error = NULL; - } - g_free(path); - - path = g_build_filename( - logdir, prpl_name, "Query", filename, NULL); - purple_debug_info("Trillian log list", "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, &length, &error)) { - if (error) - g_error_free(error); - } - } - g_free(filename); - - if (contents) { - struct trillian_logger_data *data = NULL; - int offset = 0; - int last_line_offset = 0; - - line = contents; - c = contents; - while (*c) { - offset++; - - if (*c != '\n') { - c++; - continue; - } - - *c = '\0'; - if (purple_str_has_prefix(line, "Session Close ")) { - if (data && !data->length) { - if (!(data->length = last_line_offset - data->offset)) { - /* This log had no data, so we remove it. */ - GList *last = g_list_last(list); - - purple_debug_info("Trillian log list", - "Empty log. Offset %i\n", data->offset); - - trillian_logger_finalize((PurpleLog *)last->data); - list = g_list_delete_link(list, last); - } - } - } else if (line[0] && line[1] && line[2] && - purple_str_has_prefix(&line[3], "sion Start ")) { - /* The conditional is to make sure we're not reading off - * the end of the string. We don't want strlen(), as that'd - * have to count the whole string needlessly. - * - * The odd check here is because a Session Start at the - * beginning of the file can be overwritten with a UTF-8 - * byte order mark. Yes, it's weird. - */ - char *their_nickname = line; - char *timestamp; - - if (data && !data->length) - data->length = last_line_offset - data->offset; - - while (*their_nickname && (*their_nickname != ':')) - their_nickname++; - their_nickname++; - - /* This code actually has nothing to do with - * the timestamp YET. I'm simply using this - * variable for now to NUL-terminate the - * their_nickname string. - */ - timestamp = their_nickname; - while (*timestamp && *timestamp != ')') - timestamp++; - - if (*timestamp == ')') { - char *month; - struct tm tm; - - *timestamp = '\0'; - if (line[0] && line[1] && line[2]) - timestamp += 3; - - /* Now we start dealing with the timestamp. */ - - /* Skip over the day name. */ - while (*timestamp && (*timestamp != ' ')) - timestamp++; - *timestamp = '\0'; - timestamp++; - - /* Parse out the month. */ - month = timestamp; - while (*timestamp && (*timestamp != ' ')) - timestamp++; - *timestamp = '\0'; - timestamp++; - - /* Parse the day, time, and year. */ - if (sscanf(timestamp, "%u %u:%u:%u %u", - &tm.tm_mday, &tm.tm_hour, - &tm.tm_min, &tm.tm_sec, - &tm.tm_year) != 5) { - - purple_debug_error("Trillian log timestamp parse", - "Session Start parsing error\n"); - } else { - PurpleLog *log; - - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. - */ - tm.tm_isdst = -1; - tm.tm_mon = get_month(month); - - data = g_new0( - struct trillian_logger_data, 1); - data->path = g_strdup(path); - data->offset = offset; - data->length = 0; - data->their_nickname = - g_strdup(their_nickname); - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, - sn, account, NULL, mktime(&tm), NULL); - log->logger = trillian_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - } - } - } - c++; - line = c; - last_line_offset = offset; - } - - g_free(contents); - } - g_free(path); - - g_free(prpl_name); - - return g_list_reverse(list); -} - -static char * trillian_logger_read (PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct trillian_logger_data *data; - char *read; - FILE *file; - PurpleBuddy *buddy; - char *escaped; - GString *formatted; - char *c; - const char *line; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - g_return_val_if_fail(data->their_nickname != NULL, g_strdup("")); - - purple_debug_info("Trillian log read", "Reading %s\n", data->path); - - read = g_malloc(data->length + 2); - - file = g_fopen(data->path, "rb"); - fseek(file, data->offset, SEEK_SET); - data->length = fread(read, 1, data->length, file); - fclose(file); - - if (read[data->length-1] == '\n') { - read[data->length] = '\0'; - } else { - read[data->length] = '\n'; - read[data->length+1] = '\0'; - } - - /* Load miscellaneous data. */ - buddy = purple_find_buddy(log->account, log->name); - - escaped = g_markup_escape_text(read, -1); - g_free(read); - read = escaped; - - /* Apply formatting... */ - formatted = g_string_sized_new(strlen(read)); - c = read; - line = read; - while (c) - { - const char *link; - const char *footer = NULL; - GString *temp = NULL; - - if ((c = strstr(c, "\n"))) - { - *c = '\0'; - c++; - } - - /* Convert links. - * - * The format is (Link: URL)URL - * So, I want to find each occurance of "(Link: " and replace that chunk with: - * - * Then, replace the next " " (or add this if the end-of-line is reached) with: - * - * - * As implemented, this isn't perfect, but it should cover common cases. - */ - while (line && (link = strstr(line, "(Link: "))) - { - const char *tmp = link; - - link += 7; - if (*link) - { - char *end_paren; - char *space; - - if (!(end_paren = strstr(link, ")"))) - { - /* Something is not as we expect. Bail out. */ - break; - } - - if (!temp) - temp = g_string_sized_new(c ? (c - 1 - line) : strlen(line)); - - g_string_append_len(temp, line, (tmp - line)); - - /* Start an tag. */ - g_string_append(temp, " tag. */ - g_string_append(temp, "\">"); - - /* The \r is a bit of a hack to keep there from being a \r in - * the link text, which may not matter. */ - if ((space = strstr(end_paren, " ")) || (space = strstr(end_paren, "\r"))) - { - g_string_append_len(temp, end_paren + 1, space - end_paren - 1); - - /* Close the tag. */ - g_string_append(temp, ""); - - space++; - } - else - { - /* There is no space before the end of the line. */ - g_string_append(temp, end_paren + 1); - /* Close the tag. */ - g_string_append(temp, ""); - } - line = space; - } - else - { - /* Something is not as we expect. Bail out. */ - break; - } - } - - if (temp) - { - if (line) - g_string_append(temp, line); - line = temp->str; - } - - if (*line == '[') { - const char *timestamp; - - if ((timestamp = strstr(line, "]"))) { - line++; - /* TODO: Parse the timestamp and convert it to Purple's format. */ - g_string_append(formatted, "("); - g_string_append_len(formatted, line, (timestamp - line)); - g_string_append(formatted,") "); - line = timestamp + 1; - if (line[0] && line[1]) - line++; - } - - if (purple_str_has_prefix(line, "*** ")) { - line += (sizeof("*** ") - 1); - g_string_append(formatted, ""); - footer = ""; - if (purple_str_has_prefix(line, "NOTE: This user is offline.")) { - line = _("User is offline."); - } else if (purple_str_has_prefix(line, - "NOTE: Your status is currently set to ")) { - - line += (sizeof("NOTE: ") - 1); - } else if (purple_str_has_prefix(line, "Auto-response sent to ")) { - g_string_append(formatted, _("Auto-response sent:")); - while (*line && *line != ':') - line++; - if (*line) - line++; - g_string_append(formatted, "
"); - footer = NULL; - } else if (strstr(line, " signed off ")) { - const char *alias = NULL; - - if (buddy != NULL) - alias = purple_buddy_get_alias(buddy); - - if (alias != NULL) { - g_string_append_printf(formatted, - _("%s has signed off."), alias); - } else { - g_string_append_printf(formatted, - _("%s has signed off."), log->name); - } - line = ""; - } else if (strstr(line, " signed on ")) { - const char *alias = NULL; - - if (buddy != NULL) - alias = purple_buddy_get_alias(buddy); - - if (alias != NULL) - g_string_append(formatted, alias); - else - g_string_append(formatted, log->name); - - line = " logged in."; - } else if (purple_str_has_prefix(line, - "One or more messages may have been undeliverable.")) { - - g_string_append(formatted, - ""); - g_string_append(formatted, - _("One or more messages may have been " - "undeliverable.")); - line = ""; - footer = "
"; - } else if (purple_str_has_prefix(line, - "You have been disconnected.")) { - - g_string_append(formatted, - ""); - g_string_append(formatted, - _("You were disconnected from the server.")); - line = ""; - footer = ""; - } else if (purple_str_has_prefix(line, - "You are currently disconnected.")) { - - g_string_append(formatted, - ""); - line = _("You are currently disconnected. Messages " - "will not be received unless you are " - "logged in."); - footer = ""; - } else if (purple_str_has_prefix(line, - "Your previous message has not been sent.")) { - - g_string_append(formatted, - ""); - - if (purple_str_has_prefix(line, - "Your previous message has not been sent. " - "Reason: Maximum length exceeded.")) { - - g_string_append(formatted, - _("Message could not be sent because " - "the maximum length was exceeded.")); - line = ""; - } else { - g_string_append(formatted, - _("Message could not be sent.")); - line += (sizeof( - "Your previous message " - "has not been sent. ") - 1); - } - - footer = ""; - } - } else if (purple_str_has_prefix(line, data->their_nickname)) { - if (buddy != NULL) { - const char *alias = purple_buddy_get_alias(buddy); - - if (alias != NULL) { - line += strlen(data->their_nickname) + 2; - g_string_append_printf(formatted, - "" - "%s: ", alias); - } - } - } else { - const char *line2 = strstr(line, ":"); - if (line2) { - const char *acct_name; - line2++; - line = line2; - acct_name = purple_account_get_alias(log->account); - if (!acct_name) - acct_name = purple_account_get_username(log->account); - - g_string_append_printf(formatted, - "" - "%s:", acct_name); - } - } - } - - g_string_append(formatted, line); - - line = c; - if (temp) - g_string_free(temp, TRUE); - - if (footer) - g_string_append(formatted, footer); - - g_string_append(formatted, "
"); - } - - g_free(read); - - /* XXX: TODO: What can we do about removing \r characters? - * XXX: TODO: and will that allow us to avoid this - * XXX: TODO: g_strchomp(), or is that unrelated? */ - /* XXX: TODO: Avoid this g_strchomp() */ - return g_strchomp(g_string_free(formatted, FALSE)); -} - -static int trillian_logger_size (PurpleLog *log) -{ - struct trillian_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = trillian_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void trillian_logger_finalize(PurpleLog *log) -{ - struct trillian_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data->their_nickname); - g_free(data); -} - -/***************************************************************************** - * QIP Logger * - *****************************************************************************/ - -/* The QIP logger doesn't write logs, only reads them. This is to include - * QIP logs in the log viewer transparently. - */ -#define QIP_LOG_DELIMITER "--------------------------------------" -#define QIP_LOG_IN_MESSAGE (QIP_LOG_DELIMITER "<-") -#define QIP_LOG_OUT_MESSAGE (QIP_LOG_DELIMITER ">-") -#define QIP_LOG_IN_MESSAGE_ESC (QIP_LOG_DELIMITER "<-") -#define QIP_LOG_OUT_MESSAGE_ESC (QIP_LOG_DELIMITER ">-") -#define QIP_LOG_TIMEOUT (60*60) - -static PurpleLogLogger *qip_logger; - -struct qip_logger_data { - - char *path; /* FIXME: Change this to use PurpleStringref like log.c:old_logger_list */ - int offset; - int length; -}; - -static GList *qip_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - PurplePlugin *plugin; - PurplePluginProtocolInfo *prpl_info; - char *username; - char *filename; - char *path; - char *contents; - struct qip_logger_data *data = NULL; - struct tm prev_tm; - struct tm tm; - gboolean prev_tm_init = FALSE; - gboolean main_cycle = TRUE; - char *c; - char *start_log; - char *new_line = NULL; - int offset = 0; - GError *error; - - g_return_val_if_fail(sn != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - /* QIP only supports ICQ. */ - if (strcmp(account->protocol_id, "prpl-icq")) - return NULL; - - logdir = purple_prefs_get_string("/plugins/core/log_reader/qip/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - plugin = purple_find_prpl(purple_account_get_protocol_id(account)); - if (!plugin) - return NULL; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - if (!prpl_info->list_icon) - return NULL; - - username = g_strdup(purple_normalize(account, account->username)); - filename = g_strdup_printf("%s.txt", purple_normalize(account, sn)); - path = g_build_filename(logdir, username, "History", filename, NULL); - g_free(username); - g_free(filename); - - purple_debug_info("QIP logger", "Reading %s\n", path); - - error = NULL; - if (!g_file_get_contents(path, &contents, NULL, &error)) { - purple_debug_error("QIP logger", - "Couldn't read file %s: %s \n", path, - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - g_free(path); - return list; - } - - c = contents; - start_log = contents; - while (main_cycle) { - - gboolean add_new_log = FALSE; - - if (*c) { - if (purple_str_has_prefix(c, QIP_LOG_IN_MESSAGE) || - purple_str_has_prefix(c, QIP_LOG_OUT_MESSAGE)) { - - char *tmp; - - new_line = c; - - /* find EOL */ - c = strstr(c, "\n"); - c++; - - /* Find the last '(' character. */ - if ((tmp = strstr(c, "\n")) != NULL) { - while (*tmp && *tmp != '(') --tmp; - c = tmp; - } else { - while (*c) - c++; - c--; - c = g_strrstr(c, "("); - } - - if (c != NULL) { - const char *timestamp = ++c; - - /* Parse the time, day, month and year */ - if (sscanf(timestamp, "%u:%u:%u %u/%u/%u", - &tm.tm_hour, &tm.tm_min, &tm.tm_sec, - &tm.tm_mday, &tm.tm_mon, &tm.tm_year) != 6) { - - purple_debug_error("QIP logger list", - "Parsing timestamp error\n"); - } else { - tm.tm_mon -= 1; - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. */ - tm.tm_isdst = -1; - - if (!prev_tm_init) { - prev_tm = tm; - prev_tm_init = TRUE; - } else { - add_new_log = difftime(mktime(&tm), mktime(&prev_tm)) > QIP_LOG_TIMEOUT; - } - } - } - } - } else { - add_new_log = TRUE; - main_cycle = FALSE; - new_line = c; - } - - /* adding log */ - if (add_new_log && prev_tm_init) { - PurpleLog *log; - - /* filling data */ - data = g_new0(struct qip_logger_data, 1); - data->path = g_strdup(path); - data->length = new_line - start_log; - data->offset = offset; - offset += data->length; - purple_debug_info("QIP logger list", - "Creating log: path = (%s); length = (%d); offset = (%d)\n", - data->path, data->length, data->offset); - - /* XXX: Look into this later... Should we pass in a struct tm? */ - log = purple_log_new(PURPLE_LOG_IM, sn, account, - NULL, mktime(&prev_tm), NULL); - - log->logger = qip_logger; - log->logger_data = data; - - list = g_list_prepend(list, log); - - prev_tm = tm; - start_log = new_line; - } - - if (*c) { - /* find EOF */ - c = strstr(c, "\n"); - c++; - } - } - - g_free(contents); - g_free(path); - return g_list_reverse(list); -} - -static char *qip_logger_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct qip_logger_data *data; - PurpleBuddy *buddy; - GString *formatted; - char *c; - const char *line; - gchar *contents; - GError *error; - char *utf8_string; - FILE *file; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - - file = g_fopen(data->path, "rb"); - g_return_val_if_fail(file != NULL, g_strdup("")); - - contents = g_malloc(data->length + 2); - - fseek(file, data->offset, SEEK_SET); - data->length = fread(contents, 1, data->length, file); - fclose(file); - - contents[data->length] = '\n'; - contents[data->length + 1] = '\0'; - - /* Convert file contents from Cp1251 to UTF-8 codeset */ - error = NULL; - if (!(utf8_string = g_convert(contents, -1, "UTF-8", "Cp1251", NULL, NULL, &error))) { - purple_debug_error("QIP logger", - "Couldn't convert file %s to UTF-8: %s\n", data->path, - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - g_free(contents); - return g_strdup(""); - } - - g_free(contents); - contents = g_markup_escape_text(utf8_string, -1); - g_free(utf8_string); - - buddy = purple_find_buddy(log->account, log->name); - - /* Apply formatting... */ - formatted = g_string_sized_new(data->length + 2); - c = contents; - line = contents; - - while (c && *c) { - gboolean is_in_message = FALSE; - - if (purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC) || - purple_str_has_prefix(line, QIP_LOG_OUT_MESSAGE_ESC)) { - - char *tmp; - const char *buddy_name; - - is_in_message = purple_str_has_prefix(line, QIP_LOG_IN_MESSAGE_ESC); - - /* find EOL */ - c = strstr(c, "\n"); - - /* XXX: Do we need buddy_name when we have buddy->alias? */ - buddy_name = ++c; - - /* Find the last '(' character. */ - if ((tmp = strstr(c, "\n")) != NULL) { - while (*tmp && *tmp != '(') --tmp; - c = tmp; - } else { - while (*c) - c++; - c--; - c = g_strrstr(c, "("); - } - - if (c != NULL) { - const char *timestamp = c; - int hour; - int min; - int sec; - - timestamp++; - - /* Parse the time, day, month and year */ - if (sscanf(timestamp, "%u:%u:%u", - &hour, &min, &sec) != 3) { - purple_debug_error("QIP logger read", - "Parsing timestamp error\n"); - } else { - g_string_append(formatted, ""); - /* TODO: Figure out if we can do anything more locale-independent. */ - g_string_append_printf(formatted, - "(%u:%02u:%02u) %cM ", hour % 12, - min, sec, (hour >= 12) ? 'P': 'A'); - g_string_append(formatted, " "); - - if (is_in_message) { - const char *alias = NULL; - - if (buddy_name != NULL && buddy != NULL && - (alias = purple_buddy_get_alias(buddy))) - { - g_string_append_printf(formatted, - "" - "%s: ", alias); - } - } else { - const char *acct_name; - acct_name = purple_account_get_alias(log->account); - if (!acct_name) - acct_name = purple_account_get_username(log->account); - - g_string_append_printf(formatted, - "" - "%s: ", acct_name); - } - - /* find EOF */ - c = strstr(c, "\n"); - line = ++c; - } - } - } else { - if ((c = strstr(c, "\n"))) - *c = '\0'; - - if (line[0] != '\n' && line[0] != '\r') { - - g_string_append(formatted, line); - g_string_append(formatted, "
"); - } - - if (c) - line = ++c; - } - } - g_free(contents); - - /* XXX: TODO: Avoid this g_strchomp() */ - return g_strchomp(g_string_free(formatted, FALSE)); -} - -static int qip_logger_size (PurpleLog *log) -{ - struct qip_logger_data *data; - char *text; - size_t size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = qip_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void qip_logger_finalize(PurpleLog *log) -{ - struct qip_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - - g_free(data->path); - g_free(data); -} - -/************************************************************************* - * aMSN Logger * - *************************************************************************/ - -/* The aMSN logger doesn't write logs, only reads them. This is to include - * aMSN logs in the log viewer transparently. - */ - -static PurpleLogLogger *amsn_logger; - -struct amsn_logger_data { - char *path; - int offset; - int length; -}; - -#define AMSN_LOG_CONV_START "|\"LRED[Conversation started on " -#define AMSN_LOG_CONV_END "|\"LRED[You have closed the window on " -#define AMSN_LOG_CONV_EXTRA "01 Aug 2001 00:00:00]" - -static GList *amsn_logger_parse_file(char *filename, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - GError *error; - char *contents; - struct amsn_logger_data *data; - PurpleLog *log; - - purple_debug_info("aMSN logger", "Reading %s\n", filename); - error = NULL; - if (!g_file_get_contents(filename, &contents, NULL, &error)) { - purple_debug_error("aMSN logger", - "Couldn't read file %s: %s \n", filename, - (error && error->message) ? - error->message : "Unknown error"); - if (error) - g_error_free(error); - } else { - char *c = contents; - gboolean found_start = FALSE; - char *start_log = c; - int offset = 0; - struct tm tm; - while (c && *c) { - if (purple_str_has_prefix(c, AMSN_LOG_CONV_START)) { - char month[4]; - if (sscanf(c + strlen(AMSN_LOG_CONV_START), - "%u %3s %u %u:%u:%u", - &tm.tm_mday, (char*)&month, &tm.tm_year, - &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { - found_start = FALSE; - purple_debug_error("aMSN logger", - "Error parsing start date for %s\n", - filename); - } else { - tm.tm_year -= 1900; - - /* Let the C library deal with - * daylight savings time. - */ - tm.tm_isdst = -1; - tm.tm_mon = get_month(month); - - found_start = TRUE; - offset = c - contents; - start_log = c; - } - } else if (purple_str_has_prefix(c, AMSN_LOG_CONV_END) && found_start) { - data = g_new0(struct amsn_logger_data, 1); - data->path = g_strdup(filename); - data->offset = offset; - data->length = c - start_log - + strlen(AMSN_LOG_CONV_END) - + strlen(AMSN_LOG_CONV_EXTRA); - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = amsn_logger; - log->logger_data = data; - list = g_list_prepend(list, log); - found_start = FALSE; - - purple_debug_info("aMSN logger", - "Found log for %s:" - " path = (%s)," - " offset = (%d)," - " length = (%d)\n", - sn, data->path, data->offset, data->length); - } - c = strstr(c, "\n"); - c++; - } - - /* I've seen the file end without the AMSN_LOG_CONV_END bit */ - if (found_start) { - data = g_new0(struct amsn_logger_data, 1); - data->path = g_strdup(filename); - data->offset = offset; - data->length = c - start_log - + strlen(AMSN_LOG_CONV_END) - + strlen(AMSN_LOG_CONV_EXTRA); - log = purple_log_new(PURPLE_LOG_IM, sn, account, NULL, mktime(&tm), NULL); - log->logger = amsn_logger; - log->logger_data = data; - list = g_list_prepend(list, log); - found_start = FALSE; - - purple_debug_info("aMSN logger", - "Found log for %s:" - " path = (%s)," - " offset = (%d)," - " length = (%d)\n", - sn, data->path, data->offset, data->length); - } - g_free(contents); - } - - return list; -} - -/* `log_dir`/username@hotmail.com/logs/buddyname@hotmail.com.log */ -/* `log_dir`/username@hotmail.com/logs/Month Year/buddyname@hotmail.com.log */ -static GList *amsn_logger_list(PurpleLogType type, const char *sn, PurpleAccount *account) -{ - GList *list = NULL; - const char *logdir; - char *username; - char *log_path; - char *buddy_log; - char *filename; - GDir *dir; - const char *name; - - logdir = purple_prefs_get_string("/plugins/core/log_reader/amsn/log_directory"); - - /* By clearing the log directory path, this logger can be (effectively) disabled. */ - if (!logdir || !*logdir) - return NULL; - - /* aMSN only works with MSN/WLM */ - if (strcmp(account->protocol_id, "prpl-msn")) - return NULL; - - username = g_strdup(purple_normalize(account, account->username)); - buddy_log = g_strdup_printf("%s.log", purple_normalize(account, sn)); - log_path = g_build_filename(logdir, username, "logs", NULL); - - /* First check in the top-level */ - filename = g_build_filename(log_path, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = amsn_logger_parse_file(filename, sn, account); - else - g_free(filename); - - /* Check in previous months */ - dir = g_dir_open(log_path, 0, NULL); - if (dir) { - while ((name = g_dir_read_name(dir)) != NULL) { - filename = g_build_filename(log_path, name, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = g_list_concat(list, amsn_logger_parse_file(filename, sn, account)); - g_free(filename); - } - g_dir_close(dir); - } - - g_free(log_path); - - /* New versions use 'friendlier' directory names */ - purple_util_chrreplace(username, '@', '_'); - purple_util_chrreplace(username, '.', '_'); - - log_path = g_build_filename(logdir, username, "logs", NULL); - - /* First check in the top-level */ - filename = g_build_filename(log_path, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = g_list_concat(list, amsn_logger_parse_file(filename, sn, account)); - g_free(filename); - - /* Check in previous months */ - dir = g_dir_open(log_path, 0, NULL); - if (dir) { - while ((name = g_dir_read_name(dir)) != NULL) { - filename = g_build_filename(log_path, name, buddy_log, NULL); - if (g_file_test(filename, G_FILE_TEST_EXISTS)) - list = g_list_concat(list, amsn_logger_parse_file(filename, sn, account)); - g_free(filename); - } - g_dir_close(dir); - } - - g_free(log_path); - g_free(username); - g_free(buddy_log); - - return list; -} - -/* Really it's |"L, but the string's been escaped */ -#define AMSN_LOG_FORMAT_TAG "|"L" - -static char *amsn_logger_read(PurpleLog *log, PurpleLogReadFlags *flags) -{ - struct amsn_logger_data *data; - FILE *file; - char *contents; - char *escaped; - GString *formatted; - char *start; - gboolean in_span = FALSE; - - if (flags != NULL) - *flags = PURPLE_LOG_READ_NO_NEWLINE; - - g_return_val_if_fail(log != NULL, g_strdup("")); - - data = log->logger_data; - - g_return_val_if_fail(data->path != NULL, g_strdup("")); - g_return_val_if_fail(data->length > 0, g_strdup("")); - - contents = g_malloc(data->length + 2); - - file = g_fopen(data->path, "rb"); - g_return_val_if_fail(file != NULL, g_strdup("")); - - fseek(file, data->offset, SEEK_SET); - data->length = fread(contents, 1, data->length, file); - fclose(file); - - contents[data->length] = '\n'; - contents[data->length + 1] = '\0'; - - escaped = g_markup_escape_text(contents, -1); - g_free(contents); - contents = escaped; - - formatted = g_string_sized_new(data->length + 2); - - start = contents; - while (start && *start) { - char *end; - char *old_tag; - char *tag; - end = strstr(start, "\n"); - if (!end) - break; - *end = '\0'; - if (purple_str_has_prefix(start, AMSN_LOG_FORMAT_TAG) && in_span) { - /* New format for this line */ - g_string_append(formatted, "

"); - in_span = FALSE; - } else if (start != contents) { - /* Continue format from previous line */ - g_string_append(formatted, "
"); - } - old_tag = start; - tag = strstr(start, AMSN_LOG_FORMAT_TAG); - while (tag) { - g_string_append_len(formatted, old_tag, tag - old_tag); - tag += strlen(AMSN_LOG_FORMAT_TAG); - if (in_span) { - g_string_append(formatted, "
"); - in_span = FALSE; - } - if (*tag == 'C') { - /* |"LCxxxxxx is a hex colour */ - char colour[7]; - strncpy(colour, tag + 1, 6); - colour[6] = '\0'; - g_string_append_printf(formatted, "", colour); - /* This doesn't appear to work? */ - /* g_string_append_printf(formatted, "", tag + 1); */ - in_span = TRUE; - old_tag = tag + 7; /* C + xxxxxx */ - } else { - /* |"Lxxx is a 3-digit colour code */ - if (purple_str_has_prefix(tag, "RED")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "GRA")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "NOR")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "ITA")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else if (purple_str_has_prefix(tag, "GRE")) { - g_string_append(formatted, ""); - in_span = TRUE; - } else { - purple_debug_info("aMSN logger", "Unknown colour format: %3s\n", tag); - } - old_tag = tag + 3; - } - tag = strstr(tag, AMSN_LOG_FORMAT_TAG); - } - g_string_append(formatted, old_tag); - start = end + 1; - } - if (in_span) - g_string_append(formatted, ""); - - g_free(contents); - - return g_string_free(formatted, FALSE); -} - -static int amsn_logger_size(PurpleLog *log) -{ - struct amsn_logger_data *data; - char *text; - int size; - - g_return_val_if_fail(log != NULL, 0); - - data = log->logger_data; - - if (purple_prefs_get_bool("/plugins/core/log_reader/fast_sizes")) { - return data ? data->length : 0; - } - - text = amsn_logger_read(log, NULL); - size = strlen(text); - g_free(text); - - return size; -} - -static void amsn_logger_finalize(PurpleLog *log) -{ - struct amsn_logger_data *data; - - g_return_if_fail(log != NULL); - - data = log->logger_data; - g_free(data->path); - g_free(data); -} - -/***************************************************************************** - * Plugin Code * - *****************************************************************************/ - -static void -init_plugin(PurplePlugin *plugin) -{ - -} - -static void log_reader_init_prefs(void) { - char *path; -#ifdef _WIN32 - char *folder; - gboolean found = FALSE; -#endif - - purple_prefs_add_none("/plugins/core/log_reader"); - - - /* Add general preferences. */ - - purple_prefs_add_bool("/plugins/core/log_reader/fast_sizes", FALSE); - purple_prefs_add_bool("/plugins/core/log_reader/use_name_heuristics", TRUE); - - - /* Add Adium log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/adium"); - - /* Calculate default Adium log directory. */ -#ifdef _WIN32 - purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", ""); -#else - path = g_build_filename(purple_home_dir(), "Library", "Application Support", - "Adium 2.0", "Users", "Default", "Logs", NULL); - purple_prefs_add_string("/plugins/core/log_reader/adium/log_directory", path); - g_free(path); -#endif - - - /* Add Fire log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/fire"); - - /* Calculate default Fire log directory. */ -#ifdef _WIN32 - purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", ""); -#else - path = g_build_filename(purple_home_dir(), "Library", "Application Support", - "Fire", "Sessions", NULL); - purple_prefs_add_string("/plugins/core/log_reader/fire/log_directory", path); - g_free(path); -#endif - - - /* Add Messenger Plus! log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/messenger_plus"); - - /* Calculate default Messenger Plus! log directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PERSONAL); - if (folder) { - path = g_build_filename(folder, "My Chat Logs", NULL); - g_free(folder); - } -#else - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Documents and Settings", g_get_user_name(), - "My Documents", "My Chat Logs", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/messenger_plus/log_directory", path ? path : ""); - g_free(path); - - - /* Add MSN Messenger log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/msn"); - - /* Calculate default MSN message history directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PERSONAL); - if (folder) { - path = g_build_filename(folder, "My Received Files", NULL); - g_free(folder); - } -#else - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Documents and Settings", g_get_user_name(), - "My Documents", "My Received Files", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/msn/log_directory", path ? path : ""); - g_free(path); - - - /* Add Trillian log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/trillian"); - -#ifdef _WIN32 - /* XXX: While a major hack, this is the most reliable way I could - * think of to determine the Trillian installation directory. - */ - - path = NULL; - if ((folder = wpurple_read_reg_string(HKEY_CLASSES_ROOT, "Trillian.SkinZip\\shell\\Add\\command\\", NULL))) { - char *value = folder; - char *temp; - - /* Break apart buffer. */ - if (*value == '"') { - value++; - temp = value; - while (*temp && *temp != '"') - temp++; - } else { - temp = value; - while (*temp && *temp != ' ') - temp++; - } - *temp = '\0'; - - /* Set path. */ - if (purple_str_has_suffix(value, "trillian.exe")) { - value[strlen(value) - (sizeof("trillian.exe") - 1)] = '\0'; - path = g_build_filename(value, "users", "default", "talk.ini", NULL); - } - g_free(folder); - } - - if (!path) { - char *folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "Trillian", - "users", "default", "talk.ini", NULL); - g_free(folder); - } - } - - if (path) { - /* Read talk.ini file to find the log directory. */ - GError *error = NULL; - -#if 0 && GLIB_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ - GKeyFile *key_file; - - purple_debug_info("Trillian talk.ini read", "Reading %s\n", path); - - error = NULL; - if (!g_key_file_load_from_file(key_file, path, G_KEY_FILE_NONE, GError &error)) { - purple_debug_error("Trillian talk.ini read", - "Error reading talk.ini\n"); - if (error) - g_error_free(error); - } else { - char *logdir = g_key_file_get_string(key_file, "Logging", "Directory", &error); - if (error) { - purple_debug_error("Trillian talk.ini read", - "Error reading Directory value from Logging section\n"); - g_error_free(error); - } - - if (logdir) { - g_strchomp(logdir); - purple_prefs_add_string("/plugins/core/log_reader/trillian/log_directory", logdir); - found = TRUE; - } - - g_key_file_free(key_file); - } -#else /* !GLIB_CHECK_VERSION(2,6,0) */ - gchar *contents = NULL; - - purple_debug_info("Trillian talk.ini read", - "Reading %s\n", path); - if (!g_file_get_contents(path, &contents, NULL, &error)) { - purple_debug_error("Trillian talk.ini read", - "Error reading talk.ini: %s\n", - (error && error->message) ? error->message : "Unknown error"); - if (error) - g_error_free(error); - } else { - char *cursor, *line; - line = cursor = contents; - while (*cursor) { - if (*cursor == '\n') { - *cursor = '\0'; - - /* XXX: This assumes the first Directory key is under [Logging]. */ - if (purple_str_has_prefix(line, "Directory=")) { - line += (sizeof("Directory=") - 1); - g_strchomp(line); - purple_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", - line); - found = TRUE; - } - - cursor++; - line = cursor; - } else - cursor++; - } - g_free(contents); - } - g_free(path); -#endif /* !GTK_CHECK_VERSION(2,6,0) */ - } /* path */ - - if (!found) { - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "Trillian", "users", - "default", "logs", NULL); - g_free(folder); - } - - purple_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", path ? path : ""); - g_free(path); - } -#else /* !defined(_WIN32) */ - /* TODO: At some point, this could attempt to parse talk.ini - * TODO: from the default Trillian install directory on the - * TODO: Windows mount point. */ - - /* Calculate default Trillian log directory. */ - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Program Files", "Trillian", "users", - "default", "logs", NULL); - purple_prefs_add_string( - "/plugins/core/log_reader/trillian/log_directory", path); - g_free(path); -#endif - - /* Add QIP log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/qip"); - - /* Calculate default QIP log directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) { - path = g_build_filename(folder, "QIP", "Users", NULL); - g_free(folder); - } -#else - path = g_build_filename(PURPLE_LOG_READER_WINDOWS_MOUNT_POINT, - "Program Files", "QIP", "Users", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/qip/log_directory", path ? path : ""); - g_free(path); - - /* Add aMSN Messenger log directory preference. */ - purple_prefs_add_none("/plugins/core/log_reader/amsn"); - - /* Calculate default aMSN log directory. */ -#ifdef _WIN32 - path = NULL; - folder = wpurple_get_special_folder(CSIDL_PROFILE); /* Silly aMSN, not using CSIDL_APPDATA */ - if (folder) { - path = g_build_filename(folder, "amsn", NULL); - g_free(folder); - } -#else - path = g_build_filename(purple_home_dir(), ".amsn", NULL); -#endif - purple_prefs_add_string("/plugins/core/log_reader/amsn/log_directory", path ? path : ""); - g_free(path); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - log_reader_init_prefs(); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - adium_logger = purple_log_logger_new("adium", _("Adium"), 6, - NULL, - NULL, - adium_logger_finalize, - adium_logger_list, - adium_logger_read, - adium_logger_size); - purple_log_logger_add(adium_logger); - -#if 0 - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - fire_logger = purple_log_logger_new("fire", _("Fire"), 6, - NULL, - NULL, - fire_logger_finalize, - fire_logger_list, - fire_logger_read, - fire_logger_size); - purple_log_logger_add(fire_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - messenger_plus_logger = purple_log_logger_new("messenger_plus", _("Messenger Plus!"), 6, - NULL, - NULL, - messenger_plus_logger_finalize, - messenger_plus_logger_list, - messenger_plus_logger_read, - messenger_plus_logger_size); - purple_log_logger_add(messenger_plus_logger); - -#endif - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - qip_logger = purple_log_logger_new("qip", _("QIP"), 6, - NULL, - NULL, - qip_logger_finalize, - qip_logger_list, - qip_logger_read, - qip_logger_size); - purple_log_logger_add(qip_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - msn_logger = purple_log_logger_new("msn", _("MSN Messenger"), 6, - NULL, - NULL, - msn_logger_finalize, - msn_logger_list, - msn_logger_read, - msn_logger_size); - purple_log_logger_add(msn_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - trillian_logger = purple_log_logger_new("trillian", _("Trillian"), 6, - NULL, - NULL, - trillian_logger_finalize, - trillian_logger_list, - trillian_logger_read, - trillian_logger_size); - purple_log_logger_add(trillian_logger); - - /* The names of IM clients are marked for translation at the request of - translators who wanted to transliterate them. Many translators - choose to leave them alone. Choose what's best for your language. */ - amsn_logger = purple_log_logger_new("amsn", _("aMSN"), 6, - NULL, - NULL, - amsn_logger_finalize, - amsn_logger_list, - amsn_logger_read, - amsn_logger_size); - purple_log_logger_add(amsn_logger); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - g_return_val_if_fail(plugin != NULL, FALSE); - - purple_log_logger_remove(adium_logger); - purple_log_logger_free(adium_logger); - adium_logger = NULL; - -#if 0 - purple_log_logger_remove(fire_logger); - purple_log_logger_free(fire_logger); - fire_logger = NULL; - - purple_log_logger_remove(messenger_plus_logger); - purple_log_logger_free(messenger_plus_logger); - messenger_plus_logger = NULL; -#endif - - purple_log_logger_remove(msn_logger); - purple_log_logger_free(msn_logger); - msn_logger = NULL; - - purple_log_logger_remove(trillian_logger); - purple_log_logger_free(trillian_logger); - trillian_logger = NULL; - - purple_log_logger_remove(qip_logger); - purple_log_logger_free(qip_logger); - qip_logger = NULL; - - purple_log_logger_remove(amsn_logger); - purple_log_logger_free(amsn_logger); - amsn_logger = NULL; - - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - g_return_val_if_fail(plugin != NULL, FALSE); - - frame = purple_plugin_pref_frame_new(); - - - /* Add general preferences. */ - - ppref = purple_plugin_pref_new_with_label(_("General Log Reading Configuration")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/fast_sizes", _("Fast size calculations")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/use_name_heuristics", _("Use name heuristics")); - purple_plugin_pref_frame_add(frame, ppref); - - - /* Add Log Directory preferences. */ - - ppref = purple_plugin_pref_new_with_label(_("Log Directory")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/adium/log_directory", _("Adium")); - purple_plugin_pref_frame_add(frame, ppref); - -#if 0 - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/fire/log_directory", _("Fire")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/messenger_plus/log_directory", _("Messenger Plus!")); - purple_plugin_pref_frame_add(frame, ppref); -#endif - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/qip/log_directory", _("QIP")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/msn/log_directory", _("MSN Messenger")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/trillian/log_directory", _("Trillian")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/log_reader/amsn/log_directory", _("aMSN")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (reserved) */ - NULL, /* frame (reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "core-log_reader", /**< id */ - N_("Log Reader"), /**< name */ - DISPLAY_VERSION, /**< version */ - - /** summary */ - N_("Includes other IM clients' logs in the " - "log viewer."), - - /** description */ - N_("When viewing logs, this plugin will include " - "logs from other IM clients. Currently, this " - "includes Adium, MSN Messenger, aMSN, and " - "Trillian.\n\n" - "WARNING: This plugin is still alpha code and " - "may crash frequently. Use it at your own risk!"), - - "Richard Laager ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -PURPLE_INIT_PLUGIN(log_reader, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -DIST_SUBDIRS = mono perl ssl tcl - -if USE_PERL -PERL_DIR = perl -endif - -if USE_TCL -TCL_DIR = tcl -endif - -if ENABLE_DBUS -DBUS_LTLIB = dbus-example.la -endif - -if USE_MONO -MONO_DIR = mono -endif - -SUBDIRS = \ - $(MONO_DIR) \ - $(PERL_DIR) \ - ssl \ - $(TCL_DIR) - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -autoaccept_la_LDFLAGS = -module -avoid-version -buddynote_la_LDFLAGS = -module -avoid-version -ciphertest_la_LDFLAGS = -module -avoid-version -codeinline_la_LDFLAGS = -module -avoid-version -debug_example_la_LDFLAGS = -module -avoid-version -helloworld_la_LDFLAGS = -module -avoid-version -idle_la_LDFLAGS = -module -avoid-version -joinpart_la_LDFLAGS = -module -avoid-version -log_reader_la_LDFLAGS = -module -avoid-version -newline_la_LDFLAGS = -module -avoid-version -notify_example_la_LDFLAGS = -module -avoid-version -offlinemsg_la_LDFLAGS = -module -avoid-version -one_time_password_la_LDFLAGS = -module -avoid-version -pluginpref_example_la_LDFLAGS = -module -avoid-version -psychic_la_LDFLAGS = -module -avoid-version -signals_test_la_LDFLAGS = -module -avoid-version -simple_la_LDFLAGS = -module -avoid-version -statenotify_la_LDFLAGS = -module -avoid-version - -# this can't be in a conditional otherwise automake 1.4 yells -dbus_example_la_LDFLAGS = -module -avoid-version - -if PLUGINS - -plugin_LTLIBRARIES = \ - autoaccept.la \ - buddynote.la \ - idle.la \ - joinpart.la \ - log_reader.la \ - newline.la \ - offlinemsg.la \ - psychic.la \ - statenotify.la \ - $(DBUS_LTLIB) - -noinst_LTLIBRARIES = \ - ciphertest.la \ - codeinline.la \ - debug_example.la \ - helloworld.la \ - notify_example.la \ - one_time_password.la \ - pluginpref_example.la \ - signals_test.la \ - simple.la - -autoaccept_la_SOURCES = autoaccept.c -buddynote_la_SOURCES = buddynote.c -ciphertest_la_SOURCES = ciphertest.c -codeinline_la_SOURCES = codeinline.c -debug_example_la_SOURCES = debug_example.c -helloworld_la_SOURCES = helloworld.c -idle_la_SOURCES = idle.c -joinpart_la_SOURCES = joinpart.c -log_reader_la_SOURCES = log_reader.c -newline_la_SOURCES = newline.c -notify_example_la_SOURCES = notify_example.c -offlinemsg_la_SOURCES = offlinemsg.c -one_time_password_la_SOURCES = one_time_password.c -pluginpref_example_la_SOURCES = pluginpref_example.c -psychic_la_SOURCES = psychic.c -signals_test_la_SOURCES = signals-test.c -simple_la_SOURCES = simple.c -statenotify_la_SOURCES = statenotify.c - -autoaccept_la_LIBADD = $(GLIB_LIBS) -buddynote_la_LIBADD = $(GLIB_LIBS) -ciphertest_la_LIBADD = $(GLIB_LIBS) -codeinline_la_LIBADD = $(GLIB_LIBS) -idle_la_LIBADD = $(GLIB_LIBS) -joinpart_la_LIBADD = $(GLIB_LIBS) -log_reader_la_LIBADD = $(GLIB_LIBS) -newline_la_LIBADD = $(GLIB_LIBS) -notify_example_la_LIBADD = $(GLIB_LIBS) -offlinemsg_la_LIBADD = $(GLIB_LIBS) -one_time_password_la_LIBADD = $(GLIB_LIBS) -pluginpref_example_la_LIBADD = $(GLIB_LIBS) -psychic_la_LIBADD = $(GLIB_LIBS) -signals_test_la_LIBADD = $(GLIB_LIBS) -simple_la_LIBADD = $(GLIB_LIBS) -statenotify_la_LIBADD = $(GLIB_LIBS) - -if ENABLE_DBUS - -CLEANFILES = dbus-example-bindings.c -dbus_example_la_SOURCES = dbus-example.c - -dbus_example_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) - -.PHONY: always - -$(top_builddir)/libpurple/dbus-types.h: always - cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -dbus-example-bindings.c: $(top_srcdir)/libpurple/dbus-analyze-functions.py $(dbus_example_la_SOURCES) - cat $(srcdir)/$(dbus_example_la_SOURCES) | \ - $(PYTHON) $(top_srcdir)/libpurple/dbus-analyze-functions.py --export-only > $@ - -$(dbus_example_la_OBJECTS) dbus-example.so: dbus-example-bindings.c $(top_builddir)/libpurple/dbus-types.h - - -endif # ENABLE_DBUS - -endif # PLUGINS - -EXTRA_DIST = \ - Makefile.mingw \ - dbus-buddyicons-example.py \ - filectl.c \ - fortuneprofile.pl \ - ipc-test-client.c \ - ipc-test-server.c \ - startup.py - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(DBUS_CFLAGS) - -# -# This part allows people to build their own plugins in here. -# Yes, it's a mess. -# -SUFFIXES = .c .so -.c.so: - $(LIBTOOL) --mode=compile $(CC) -DHAVE_CONFIG_H -I$(top_builddir) $(AM_CPPFLAGS) $(CFLAGS) -c $< -o tmp$@.lo $(PLUGIN_CFLAGS) - $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o libtmp$@.la -rpath $(plugindir) tmp$@.lo $(LIBS) $(LDFLAGS) -module -avoid-version $(PLUGIN_LIBS) - @rm -f tmp$@.lo tmp$@.o libtmp$@.la - @cp .libs/libtmp$@*.so $@ - @rm -rf .libs/libtmp$@.* diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1129 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -@PLUGINS_TRUE@autoaccept_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__autoaccept_la_SOURCES_DIST = autoaccept.c -@PLUGINS_TRUE@am_autoaccept_la_OBJECTS = autoaccept.lo -autoaccept_la_OBJECTS = $(am_autoaccept_la_OBJECTS) -@PLUGINS_TRUE@am_autoaccept_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@buddynote_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__buddynote_la_SOURCES_DIST = buddynote.c -@PLUGINS_TRUE@am_buddynote_la_OBJECTS = buddynote.lo -buddynote_la_OBJECTS = $(am_buddynote_la_OBJECTS) -@PLUGINS_TRUE@am_buddynote_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@ciphertest_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__ciphertest_la_SOURCES_DIST = ciphertest.c -@PLUGINS_TRUE@am_ciphertest_la_OBJECTS = ciphertest.lo -ciphertest_la_OBJECTS = $(am_ciphertest_la_OBJECTS) -@PLUGINS_TRUE@am_ciphertest_la_rpath = -@PLUGINS_TRUE@codeinline_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__codeinline_la_SOURCES_DIST = codeinline.c -@PLUGINS_TRUE@am_codeinline_la_OBJECTS = codeinline.lo -codeinline_la_OBJECTS = $(am_codeinline_la_OBJECTS) -@PLUGINS_TRUE@am_codeinline_la_rpath = -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus_example_la_DEPENDENCIES = \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__dbus_example_la_SOURCES_DIST = dbus-example.c -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@am_dbus_example_la_OBJECTS = \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ dbus-example.lo -dbus_example_la_OBJECTS = $(am_dbus_example_la_OBJECTS) -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@am_dbus_example_la_rpath = -rpath \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(plugindir) -debug_example_la_LIBADD = -am__debug_example_la_SOURCES_DIST = debug_example.c -@PLUGINS_TRUE@am_debug_example_la_OBJECTS = debug_example.lo -debug_example_la_OBJECTS = $(am_debug_example_la_OBJECTS) -@PLUGINS_TRUE@am_debug_example_la_rpath = -helloworld_la_LIBADD = -am__helloworld_la_SOURCES_DIST = helloworld.c -@PLUGINS_TRUE@am_helloworld_la_OBJECTS = helloworld.lo -helloworld_la_OBJECTS = $(am_helloworld_la_OBJECTS) -@PLUGINS_TRUE@am_helloworld_la_rpath = -@PLUGINS_TRUE@idle_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__idle_la_SOURCES_DIST = idle.c -@PLUGINS_TRUE@am_idle_la_OBJECTS = idle.lo -idle_la_OBJECTS = $(am_idle_la_OBJECTS) -@PLUGINS_TRUE@am_idle_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@joinpart_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__joinpart_la_SOURCES_DIST = joinpart.c -@PLUGINS_TRUE@am_joinpart_la_OBJECTS = joinpart.lo -joinpart_la_OBJECTS = $(am_joinpart_la_OBJECTS) -@PLUGINS_TRUE@am_joinpart_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@log_reader_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__log_reader_la_SOURCES_DIST = log_reader.c -@PLUGINS_TRUE@am_log_reader_la_OBJECTS = log_reader.lo -log_reader_la_OBJECTS = $(am_log_reader_la_OBJECTS) -@PLUGINS_TRUE@am_log_reader_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@newline_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__newline_la_SOURCES_DIST = newline.c -@PLUGINS_TRUE@am_newline_la_OBJECTS = newline.lo -newline_la_OBJECTS = $(am_newline_la_OBJECTS) -@PLUGINS_TRUE@am_newline_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@notify_example_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__notify_example_la_SOURCES_DIST = notify_example.c -@PLUGINS_TRUE@am_notify_example_la_OBJECTS = notify_example.lo -notify_example_la_OBJECTS = $(am_notify_example_la_OBJECTS) -@PLUGINS_TRUE@am_notify_example_la_rpath = -@PLUGINS_TRUE@offlinemsg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__offlinemsg_la_SOURCES_DIST = offlinemsg.c -@PLUGINS_TRUE@am_offlinemsg_la_OBJECTS = offlinemsg.lo -offlinemsg_la_OBJECTS = $(am_offlinemsg_la_OBJECTS) -@PLUGINS_TRUE@am_offlinemsg_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@one_time_password_la_DEPENDENCIES = \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__one_time_password_la_SOURCES_DIST = one_time_password.c -@PLUGINS_TRUE@am_one_time_password_la_OBJECTS = one_time_password.lo -one_time_password_la_OBJECTS = $(am_one_time_password_la_OBJECTS) -@PLUGINS_TRUE@am_one_time_password_la_rpath = -@PLUGINS_TRUE@pluginpref_example_la_DEPENDENCIES = \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__pluginpref_example_la_SOURCES_DIST = pluginpref_example.c -@PLUGINS_TRUE@am_pluginpref_example_la_OBJECTS = \ -@PLUGINS_TRUE@ pluginpref_example.lo -pluginpref_example_la_OBJECTS = $(am_pluginpref_example_la_OBJECTS) -@PLUGINS_TRUE@am_pluginpref_example_la_rpath = -@PLUGINS_TRUE@psychic_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__psychic_la_SOURCES_DIST = psychic.c -@PLUGINS_TRUE@am_psychic_la_OBJECTS = psychic.lo -psychic_la_OBJECTS = $(am_psychic_la_OBJECTS) -@PLUGINS_TRUE@am_psychic_la_rpath = -rpath $(plugindir) -@PLUGINS_TRUE@signals_test_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__signals_test_la_SOURCES_DIST = signals-test.c -@PLUGINS_TRUE@am_signals_test_la_OBJECTS = signals-test.lo -signals_test_la_OBJECTS = $(am_signals_test_la_OBJECTS) -@PLUGINS_TRUE@am_signals_test_la_rpath = -@PLUGINS_TRUE@simple_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__simple_la_SOURCES_DIST = simple.c -@PLUGINS_TRUE@am_simple_la_OBJECTS = simple.lo -simple_la_OBJECTS = $(am_simple_la_OBJECTS) -@PLUGINS_TRUE@am_simple_la_rpath = -@PLUGINS_TRUE@statenotify_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__statenotify_la_SOURCES_DIST = statenotify.c -@PLUGINS_TRUE@am_statenotify_la_OBJECTS = statenotify.lo -statenotify_la_OBJECTS = $(am_statenotify_la_OBJECTS) -@PLUGINS_TRUE@am_statenotify_la_rpath = -rpath $(plugindir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(autoaccept_la_SOURCES) $(buddynote_la_SOURCES) \ - $(ciphertest_la_SOURCES) $(codeinline_la_SOURCES) \ - $(dbus_example_la_SOURCES) $(debug_example_la_SOURCES) \ - $(helloworld_la_SOURCES) $(idle_la_SOURCES) \ - $(joinpart_la_SOURCES) $(log_reader_la_SOURCES) \ - $(newline_la_SOURCES) $(notify_example_la_SOURCES) \ - $(offlinemsg_la_SOURCES) $(one_time_password_la_SOURCES) \ - $(pluginpref_example_la_SOURCES) $(psychic_la_SOURCES) \ - $(signals_test_la_SOURCES) $(simple_la_SOURCES) \ - $(statenotify_la_SOURCES) -DIST_SOURCES = $(am__autoaccept_la_SOURCES_DIST) \ - $(am__buddynote_la_SOURCES_DIST) \ - $(am__ciphertest_la_SOURCES_DIST) \ - $(am__codeinline_la_SOURCES_DIST) \ - $(am__dbus_example_la_SOURCES_DIST) \ - $(am__debug_example_la_SOURCES_DIST) \ - $(am__helloworld_la_SOURCES_DIST) $(am__idle_la_SOURCES_DIST) \ - $(am__joinpart_la_SOURCES_DIST) \ - $(am__log_reader_la_SOURCES_DIST) \ - $(am__newline_la_SOURCES_DIST) \ - $(am__notify_example_la_SOURCES_DIST) \ - $(am__offlinemsg_la_SOURCES_DIST) \ - $(am__one_time_password_la_SOURCES_DIST) \ - $(am__pluginpref_example_la_SOURCES_DIST) \ - $(am__psychic_la_SOURCES_DIST) \ - $(am__signals_test_la_SOURCES_DIST) \ - $(am__simple_la_SOURCES_DIST) \ - $(am__statenotify_la_SOURCES_DIST) -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -DIST_SUBDIRS = mono perl ssl tcl -@USE_PERL_TRUE@PERL_DIR = perl -@USE_TCL_TRUE@TCL_DIR = tcl -@ENABLE_DBUS_TRUE@DBUS_LTLIB = dbus-example.la -@USE_MONO_TRUE@MONO_DIR = mono -SUBDIRS = \ - $(MONO_DIR) \ - $(PERL_DIR) \ - ssl \ - $(TCL_DIR) - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -autoaccept_la_LDFLAGS = -module -avoid-version -buddynote_la_LDFLAGS = -module -avoid-version -ciphertest_la_LDFLAGS = -module -avoid-version -codeinline_la_LDFLAGS = -module -avoid-version -debug_example_la_LDFLAGS = -module -avoid-version -helloworld_la_LDFLAGS = -module -avoid-version -idle_la_LDFLAGS = -module -avoid-version -joinpart_la_LDFLAGS = -module -avoid-version -log_reader_la_LDFLAGS = -module -avoid-version -newline_la_LDFLAGS = -module -avoid-version -notify_example_la_LDFLAGS = -module -avoid-version -offlinemsg_la_LDFLAGS = -module -avoid-version -one_time_password_la_LDFLAGS = -module -avoid-version -pluginpref_example_la_LDFLAGS = -module -avoid-version -psychic_la_LDFLAGS = -module -avoid-version -signals_test_la_LDFLAGS = -module -avoid-version -simple_la_LDFLAGS = -module -avoid-version -statenotify_la_LDFLAGS = -module -avoid-version - -# this can't be in a conditional otherwise automake 1.4 yells -dbus_example_la_LDFLAGS = -module -avoid-version -@PLUGINS_TRUE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@ autoaccept.la \ -@PLUGINS_TRUE@ buddynote.la \ -@PLUGINS_TRUE@ idle.la \ -@PLUGINS_TRUE@ joinpart.la \ -@PLUGINS_TRUE@ log_reader.la \ -@PLUGINS_TRUE@ newline.la \ -@PLUGINS_TRUE@ offlinemsg.la \ -@PLUGINS_TRUE@ psychic.la \ -@PLUGINS_TRUE@ statenotify.la \ -@PLUGINS_TRUE@ $(DBUS_LTLIB) - -@PLUGINS_TRUE@noinst_LTLIBRARIES = \ -@PLUGINS_TRUE@ ciphertest.la \ -@PLUGINS_TRUE@ codeinline.la \ -@PLUGINS_TRUE@ debug_example.la \ -@PLUGINS_TRUE@ helloworld.la \ -@PLUGINS_TRUE@ notify_example.la \ -@PLUGINS_TRUE@ one_time_password.la \ -@PLUGINS_TRUE@ pluginpref_example.la \ -@PLUGINS_TRUE@ signals_test.la \ -@PLUGINS_TRUE@ simple.la - -@PLUGINS_TRUE@autoaccept_la_SOURCES = autoaccept.c -@PLUGINS_TRUE@buddynote_la_SOURCES = buddynote.c -@PLUGINS_TRUE@ciphertest_la_SOURCES = ciphertest.c -@PLUGINS_TRUE@codeinline_la_SOURCES = codeinline.c -@PLUGINS_TRUE@debug_example_la_SOURCES = debug_example.c -@PLUGINS_TRUE@helloworld_la_SOURCES = helloworld.c -@PLUGINS_TRUE@idle_la_SOURCES = idle.c -@PLUGINS_TRUE@joinpart_la_SOURCES = joinpart.c -@PLUGINS_TRUE@log_reader_la_SOURCES = log_reader.c -@PLUGINS_TRUE@newline_la_SOURCES = newline.c -@PLUGINS_TRUE@notify_example_la_SOURCES = notify_example.c -@PLUGINS_TRUE@offlinemsg_la_SOURCES = offlinemsg.c -@PLUGINS_TRUE@one_time_password_la_SOURCES = one_time_password.c -@PLUGINS_TRUE@pluginpref_example_la_SOURCES = pluginpref_example.c -@PLUGINS_TRUE@psychic_la_SOURCES = psychic.c -@PLUGINS_TRUE@signals_test_la_SOURCES = signals-test.c -@PLUGINS_TRUE@simple_la_SOURCES = simple.c -@PLUGINS_TRUE@statenotify_la_SOURCES = statenotify.c -@PLUGINS_TRUE@autoaccept_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@buddynote_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@ciphertest_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@codeinline_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@idle_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@joinpart_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@log_reader_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@newline_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@notify_example_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@offlinemsg_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@one_time_password_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@pluginpref_example_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@psychic_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@signals_test_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@simple_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@statenotify_la_LIBADD = $(GLIB_LIBS) -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@CLEANFILES = dbus-example-bindings.c -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus_example_la_SOURCES = dbus-example.c -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus_example_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) -EXTRA_DIST = \ - Makefile.mingw \ - dbus-buddyicons-example.py \ - filectl.c \ - fortuneprofile.pl \ - ipc-test-client.c \ - ipc-test-server.c \ - startup.py - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(DBUS_CFLAGS) - - -# -# This part allows people to build their own plugins in here. -# Yes, it's a mess. -# -SUFFIXES = .c .so -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .so .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -autoaccept.la: $(autoaccept_la_OBJECTS) $(autoaccept_la_DEPENDENCIES) - $(LINK) $(am_autoaccept_la_rpath) $(autoaccept_la_LDFLAGS) $(autoaccept_la_OBJECTS) $(autoaccept_la_LIBADD) $(LIBS) -buddynote.la: $(buddynote_la_OBJECTS) $(buddynote_la_DEPENDENCIES) - $(LINK) $(am_buddynote_la_rpath) $(buddynote_la_LDFLAGS) $(buddynote_la_OBJECTS) $(buddynote_la_LIBADD) $(LIBS) -ciphertest.la: $(ciphertest_la_OBJECTS) $(ciphertest_la_DEPENDENCIES) - $(LINK) $(am_ciphertest_la_rpath) $(ciphertest_la_LDFLAGS) $(ciphertest_la_OBJECTS) $(ciphertest_la_LIBADD) $(LIBS) -codeinline.la: $(codeinline_la_OBJECTS) $(codeinline_la_DEPENDENCIES) - $(LINK) $(am_codeinline_la_rpath) $(codeinline_la_LDFLAGS) $(codeinline_la_OBJECTS) $(codeinline_la_LIBADD) $(LIBS) -dbus-example.la: $(dbus_example_la_OBJECTS) $(dbus_example_la_DEPENDENCIES) - $(LINK) $(am_dbus_example_la_rpath) $(dbus_example_la_LDFLAGS) $(dbus_example_la_OBJECTS) $(dbus_example_la_LIBADD) $(LIBS) -debug_example.la: $(debug_example_la_OBJECTS) $(debug_example_la_DEPENDENCIES) - $(LINK) $(am_debug_example_la_rpath) $(debug_example_la_LDFLAGS) $(debug_example_la_OBJECTS) $(debug_example_la_LIBADD) $(LIBS) -helloworld.la: $(helloworld_la_OBJECTS) $(helloworld_la_DEPENDENCIES) - $(LINK) $(am_helloworld_la_rpath) $(helloworld_la_LDFLAGS) $(helloworld_la_OBJECTS) $(helloworld_la_LIBADD) $(LIBS) -idle.la: $(idle_la_OBJECTS) $(idle_la_DEPENDENCIES) - $(LINK) $(am_idle_la_rpath) $(idle_la_LDFLAGS) $(idle_la_OBJECTS) $(idle_la_LIBADD) $(LIBS) -joinpart.la: $(joinpart_la_OBJECTS) $(joinpart_la_DEPENDENCIES) - $(LINK) $(am_joinpart_la_rpath) $(joinpart_la_LDFLAGS) $(joinpart_la_OBJECTS) $(joinpart_la_LIBADD) $(LIBS) -log_reader.la: $(log_reader_la_OBJECTS) $(log_reader_la_DEPENDENCIES) - $(LINK) $(am_log_reader_la_rpath) $(log_reader_la_LDFLAGS) $(log_reader_la_OBJECTS) $(log_reader_la_LIBADD) $(LIBS) -newline.la: $(newline_la_OBJECTS) $(newline_la_DEPENDENCIES) - $(LINK) $(am_newline_la_rpath) $(newline_la_LDFLAGS) $(newline_la_OBJECTS) $(newline_la_LIBADD) $(LIBS) -notify_example.la: $(notify_example_la_OBJECTS) $(notify_example_la_DEPENDENCIES) - $(LINK) $(am_notify_example_la_rpath) $(notify_example_la_LDFLAGS) $(notify_example_la_OBJECTS) $(notify_example_la_LIBADD) $(LIBS) -offlinemsg.la: $(offlinemsg_la_OBJECTS) $(offlinemsg_la_DEPENDENCIES) - $(LINK) $(am_offlinemsg_la_rpath) $(offlinemsg_la_LDFLAGS) $(offlinemsg_la_OBJECTS) $(offlinemsg_la_LIBADD) $(LIBS) -one_time_password.la: $(one_time_password_la_OBJECTS) $(one_time_password_la_DEPENDENCIES) - $(LINK) $(am_one_time_password_la_rpath) $(one_time_password_la_LDFLAGS) $(one_time_password_la_OBJECTS) $(one_time_password_la_LIBADD) $(LIBS) -pluginpref_example.la: $(pluginpref_example_la_OBJECTS) $(pluginpref_example_la_DEPENDENCIES) - $(LINK) $(am_pluginpref_example_la_rpath) $(pluginpref_example_la_LDFLAGS) $(pluginpref_example_la_OBJECTS) $(pluginpref_example_la_LIBADD) $(LIBS) -psychic.la: $(psychic_la_OBJECTS) $(psychic_la_DEPENDENCIES) - $(LINK) $(am_psychic_la_rpath) $(psychic_la_LDFLAGS) $(psychic_la_OBJECTS) $(psychic_la_LIBADD) $(LIBS) -signals_test.la: $(signals_test_la_OBJECTS) $(signals_test_la_DEPENDENCIES) - $(LINK) $(am_signals_test_la_rpath) $(signals_test_la_LDFLAGS) $(signals_test_la_OBJECTS) $(signals_test_la_LIBADD) $(LIBS) -simple.la: $(simple_la_OBJECTS) $(simple_la_DEPENDENCIES) - $(LINK) $(am_simple_la_rpath) $(simple_la_LDFLAGS) $(simple_la_OBJECTS) $(simple_la_LIBADD) $(LIBS) -statenotify.la: $(statenotify_la_OBJECTS) $(statenotify_la_DEPENDENCIES) - $(LINK) $(am_statenotify_la_rpath) $(statenotify_la_LDFLAGS) $(statenotify_la_OBJECTS) $(statenotify_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/autoaccept.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddynote.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ciphertest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codeinline.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helloworld.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/joinpart.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_reader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newline.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/notify_example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offlinemsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/one_time_password.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pluginpref_example.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psychic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signals-test.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statenotify.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pluginLTLIBRARIES mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pluginLTLIBRARIES clean-recursive ctags ctags-recursive \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-recursive distclean-tags distdir \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@.PHONY: always - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@$(top_builddir)/libpurple/dbus-types.h: always -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@dbus-example-bindings.c: $(top_srcdir)/libpurple/dbus-analyze-functions.py $(dbus_example_la_SOURCES) -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ cat $(srcdir)/$(dbus_example_la_SOURCES) | \ -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@ $(PYTHON) $(top_srcdir)/libpurple/dbus-analyze-functions.py --export-only > $@ - -@ENABLE_DBUS_TRUE@@PLUGINS_TRUE@$(dbus_example_la_OBJECTS) dbus-example.so: dbus-example-bindings.c $(top_builddir)/libpurple/dbus-types.h -.c.so: - $(LIBTOOL) --mode=compile $(CC) -DHAVE_CONFIG_H -I$(top_builddir) $(AM_CPPFLAGS) $(CFLAGS) -c $< -o tmp$@.lo $(PLUGIN_CFLAGS) - $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o libtmp$@.la -rpath $(plugindir) tmp$@.lo $(LIBS) $(LDFLAGS) -module -avoid-version $(PLUGIN_LIBS) - @rm -f tmp$@.lo tmp$@.o libtmp$@.la - @cp .libs/libtmp$@*.so $@ - @rm -rf .libs/libtmp$@.* -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libpurple Plugins -# - -PIDGIN_TREE_TOP := ../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -PERL_PLUGIN := ./perl -TCL_PLUGIN := ./tcl -SSL_PLUGIN := ./ssl - -.SUFFIXES: -.SUFFIXES: .c .dll - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgobject-2.0 \ - -lgmodule-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -## -## TARGET DEFINITIONS -## -.PHONY: all clean plugins install - -all: $(PURPLE_DLL).a plugins - $(MAKE) -C $(PERL_PLUGIN) -f $(MINGW_MAKEFILE) - $(MAKE) -C $(TCL_PLUGIN) -f $(MINGW_MAKEFILE) - $(MAKE) -C $(SSL_PLUGIN) -f $(MINGW_MAKEFILE) - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) - $(MAKE) -C $(PERL_PLUGIN) -f $(MINGW_MAKEFILE) install - $(MAKE) -C $(TCL_PLUGIN) -f $(MINGW_MAKEFILE) install - $(MAKE) -C $(SSL_PLUGIN) -f $(MINGW_MAKEFILE) install - cp *.dll $(PURPLE_INSTALL_PLUGINS_DIR) - -.c.dll: - $(CC) $(CFLAGS) $(DEFINES) $(INCLUDE_PATHS) -o $@.o -c $< - $(CC) -shared $@.o $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $@ - -plugins: \ - autoaccept.dll \ - buddynote.dll \ - idle.dll \ - joinpart.dll \ - log_reader.dll \ - newline.dll \ - offlinemsg.dll \ - psychic.dll \ - statenotify.dll - -## -## CLEAN RULES -## -clean: - rm -f *.o *.dll - $(MAKE) -C $(PERL_PLUGIN) -f $(MINGW_MAKEFILE) clean - $(MAKE) -C $(TCL_PLUGIN) -f $(MINGW_MAKEFILE) clean - $(MAKE) -C $(SSL_PLUGIN) -f $(MINGW_MAKEFILE) clean - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BlistNode.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BlistNode.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BlistNode.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BlistNode.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -namespace Purple { - public abstract class BlistNode { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Buddy.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Buddy.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Buddy.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Buddy.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -namespace Purple { - public class Buddy : BlistNode { - private string name; - private string alias; - - public string Name { get { return name; } set { name = value; } } - public string Alias { get { return alias; } set { alias = value; } } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BuddyList.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BuddyList.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BuddyList.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/BuddyList.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -namespace Purple { - using System; - using System.Runtime.CompilerServices; - - public class BuddyList { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private static IntPtr _get_handle(); - - private static IntPtr handle = _get_handle(); - - public static Event OnBuddyStatusChanged = - new Event(handle, "buddy-status-changed"); - - public static IntPtr GetHandle() - { - return _get_handle(); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Contact.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Contact.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Contact.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Contact.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -namespace Purple { - public class Contact : BlistNode { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Debug.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Debug.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Debug.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Debug.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace Purple -{ - public class Debug - { - public static int ALL = 0; - public static int MISC = 1; - public static int INFO = 2; - public static int WARNING = 3; - public static int ERROR = 4; - public static int FATAL = 5; - - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private static void _debug(int type, string cat, string str); - - public static void debug(int type, string cat, string format) - { - _debug(type, cat, format); - } - - public static void debug(int type, string cat, string format, params object[] args) - { - _debug(type, cat, String.Format(format, args)); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Event.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Event.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Event.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Event.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -using System; - -namespace Purple -{ - public class Event - { - private IntPtr handle; - private string signal; - - public Event(IntPtr h, string s) - { - handle = h; - signal = s; - } - - public void connect(object plugin, Signal.Handler handler) - { - Signal.connect(handle, plugin, signal, handler); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Group.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Group.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Group.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Group.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -namespace Purple { - public class Group : BlistNode { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -monodir=$(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -mono_sources = \ - BlistNode.cs \ - BuddyList.cs \ - Buddy.cs \ - Contact.cs \ - Debug.cs \ - Event.cs \ - PurplePlugin.cs \ - Group.cs \ - Signal.cs \ - Status.cs - -EXTRA_DIST = $(mono_sources) - -mono_SCRIPTS = PurpleAPI.dll - -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) - -all: $(mono_SCRIPTS) - -$(mono_SCRIPTS): $(mono_build_sources) - mcs -t:library -out:$(mono_SCRIPTS) $(mono_build_sources) - -clean-local: - rm -rf $(mono_SCRIPTS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,607 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/mono/api -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(monodir)" -monoSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(mono_SCRIPTS) -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -mono_sources = \ - BlistNode.cs \ - BuddyList.cs \ - Buddy.cs \ - Contact.cs \ - Debug.cs \ - Event.cs \ - PurplePlugin.cs \ - Group.cs \ - Signal.cs \ - Status.cs - -EXTRA_DIST = $(mono_sources) -mono_SCRIPTS = PurpleAPI.dll -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/mono/api/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/mono/api/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-monoSCRIPTS: $(mono_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(monodir)" || $(mkdir_p) "$(DESTDIR)$(monodir)" - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(monoSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(monodir)/$$f'"; \ - $(monoSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(monodir)/$$f"; \ - else :; fi; \ - done - -uninstall-monoSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(monodir)/$$f'"; \ - rm -f "$(DESTDIR)$(monodir)/$$f"; \ - done - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: - for dir in "$(DESTDIR)$(monodir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-monoSCRIPTS - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-monoSCRIPTS - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local distclean distclean-generic distclean-libtool \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-monoSCRIPTS install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am uninstall-info-am \ - uninstall-monoSCRIPTS - - -all: $(mono_SCRIPTS) - -$(mono_SCRIPTS): $(mono_build_sources) - mcs -t:library -out:$(mono_SCRIPTS) $(mono_build_sources) - -clean-local: - rm -rf $(mono_SCRIPTS) -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/PurplePlugin.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/PurplePlugin.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/PurplePlugin.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/PurplePlugin.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -namespace Purple { - public class PluginInfo { - private string id; - private string name; - private string version; - private string summary; - private string description; - private string author; - private string homepage; - - public PluginInfo(string id, string name, string version, string summary, - string description, string author, string homepage) - { - this.id = id; - this.name = name; - this.version = version; - this.summary = summary; - this.description = description; - this.author = author; - this.homepage = homepage; - } - - public string Id { - get { return id; } - } - - public string Name { - get { return name; } - } - - public string Version { - get { return version; } - } - - public string Summary { - get { return summary; } - } - - public string Description { - get { return description; } - } - - public string Author { - get { return author; } - } - - public string Homepage { - get { return homepage; } - } - } - - abstract public class Plugin { - private PluginInfo info; - - public Plugin(PluginInfo info) { - this.info = info; - } - - public abstract void Load(); - public abstract void Unload(); - public abstract void Destroy(); - - public PluginInfo Info { - get { return info; } - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Signal.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Signal.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Signal.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Signal.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -using System; -using System.Runtime.CompilerServices; - -namespace Purple -{ - public class Signal - { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - extern private static int _connect(IntPtr handle, object plugin, string signal, object evnt); - - public delegate void Handler(object[] args); - - public static int connect(IntPtr handle, object plugin, string signal, object evnt) - { - return _connect(handle, plugin, signal, evnt); - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Status.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Status.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Status.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/api/Status.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -namespace Purple -{ - public class Status - { - private string id; - - public string Id { get { return id; } set { id = value; } } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/GetBuddyBack.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/GetBuddyBack.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/GetBuddyBack.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/GetBuddyBack.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -using Purple; - -public class GetBuddyBack : Plugin -{ - private static PluginInfo info = new PluginInfo("mono-buddyback", "C# Get Buddy Back", "0.1", "Prints when a Buddy returns", "Longer Description", "Eoin Coffey", "urled"); - - public GetBuddyBack() - : base (info) - { - } - - public void HandleSig(object[] args) - { - Buddy buddy = (Buddy)args[0]; - - Debug.debug(Debug.INFO, "buddyback", "buddy " + buddy.Name + " is back!\n"); - } - - public override void Load() - { - Debug.debug(Debug.INFO, "buddyback", "loading...\n"); - - /*Signal.connect(BuddyList.GetHandle(), this, "buddy-back", new Signal.Handler(HandleSig));*/ - BuddyList.OnBuddyStatusChanged.connect(this, new Signal.Handler(HandleSig)); - } - - public override void Unload() - { - } - - public override void Destroy() - { - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/blist-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/blist-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/blist-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/blist-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -#include -#include "blist.h" -#include "mono-helper.h" -#include "mono-glue.h" - -MonoObject* purple_blist_get_handle_glue(void) -{ - void *handle = purple_blist_get_handle(); - - return mono_value_box(ml_get_domain(), mono_get_intptr_class(), &handle); -} - -MonoObject* purple_blist_build_buddy_object(void* data) -{ - MonoObject *obj = NULL; - - PurpleBuddy *buddy = (PurpleBuddy*)data; - - obj = ml_create_api_object("Buddy"); - g_return_val_if_fail(obj != NULL, NULL); - - ml_set_prop_string(obj, "Name", (char*)purple_buddy_get_name(buddy)); - ml_set_prop_string(obj, "Alias", (char*)purple_buddy_get_alias(buddy)); - - return obj; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/debug-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/debug-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/debug-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/debug-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#include "mono-glue.h" -#include "debug.h" - -void purple_debug_glue(int type, MonoString *cat, MonoString *str) -{ - char *ccat; - char *cstr; - - ccat = mono_string_to_utf8(cat); - cstr = mono_string_to_utf8(str); - - purple_debug(type, ccat, "%s", cstr); - - g_free(ccat); - g_free(cstr); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -plugin_LTLIBRARIES = mono.la - -mono_la_SOURCES = \ - mono.c \ - mono-glue.h \ - mono-helper.c \ - mono-helper.h \ - debug-glue.c \ - signal-glue.c \ - blist-glue.c \ - status-glue.c - -mono_la_LDFLAGS = -module -avoid-version - -mono_la_LIBADD = $(MONO_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(MONO_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,722 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/mono/loader -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -mono_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_mono_la_OBJECTS = mono.lo mono-helper.lo debug-glue.lo \ - signal-glue.lo blist-glue.lo status-glue.lo -mono_la_OBJECTS = $(am_mono_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(mono_la_SOURCES) -DIST_SOURCES = $(mono_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -plugin_LTLIBRARIES = mono.la -mono_la_SOURCES = \ - mono.c \ - mono-glue.h \ - mono-helper.c \ - mono-helper.h \ - debug-glue.c \ - signal-glue.c \ - blist-glue.c \ - status-glue.c - -mono_la_LDFLAGS = -module -avoid-version -mono_la_LIBADD = $(MONO_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(MONO_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/mono/loader/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/mono/loader/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -mono.la: $(mono_la_OBJECTS) $(mono_la_DEPENDENCIES) - $(LINK) -rpath $(plugindir) $(mono_la_LDFLAGS) $(mono_la_OBJECTS) $(mono_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blist-glue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug-glue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-helper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal-glue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/status-glue.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Mono Plugin Loader - * - * -- Thanks to the perl plugin loader for all the great tips ;-) - * - * Eoin Coffey - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" -#include "mono-helper.h" - -#define MONO_PLUGIN_ID "core-mono" - -/****************************************************************************** - * Loader Stuff - *****************************************************************************/ -/* probes the given plugin to determine if its a plugin */ -static gboolean probe_mono_plugin(PurplePlugin *plugin) -{ - MonoAssembly *assm; - MonoMethod *m = NULL; - MonoObject *plugin_info; - gboolean found_load = FALSE, found_unload = FALSE, found_destroy = FALSE; - gpointer iter = NULL; - - PurplePluginInfo *info; - PurpleMonoPlugin *mplug; - - char *file = plugin->path; - - assm = mono_domain_assembly_open(ml_get_domain(), file); - - if (!assm) { - return FALSE; - } - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Probing plugin\n"); - - if (ml_is_api_dll(mono_assembly_get_image(assm))) { - purple_debug_info("mono", "Found our PurpleAPI.dll\n"); - mono_assembly_close(assm); - return FALSE; - } - - mplug = g_new0(PurpleMonoPlugin, 1); - - mplug->signal_data = NULL; - - mplug->assm = assm; - - mplug->klass = ml_find_plugin_class(mono_assembly_get_image(mplug->assm)); - if (!mplug->klass) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "no plugin class in \'%s\'\n", file); - mono_assembly_close(assm); - g_free(mplug); - return FALSE; - } - - mplug->obj = mono_object_new(ml_get_domain(), mplug->klass); - if (!mplug->obj) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "obj not valid\n"); - mono_assembly_close(assm); - g_free(mplug); - return FALSE; - } - - mono_runtime_object_init(mplug->obj); - - while ((m = mono_class_get_methods(mplug->klass, &iter))) { - purple_debug_info("mono", "plugin method: %s\n", mono_method_get_name(m)); - if (strcmp(mono_method_get_name(m), "Load") == 0) { - mplug->load = m; - found_load = TRUE; - } else if (strcmp(mono_method_get_name(m), "Unload") == 0) { - mplug->unload = m; - found_unload = TRUE; - } else if (strcmp(mono_method_get_name(m), "Destroy") == 0) { - mplug->destroy = m; - found_destroy = TRUE; - } - } - - if (!(found_load && found_unload && found_destroy)) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "did not find the required methods\n"); - mono_assembly_close(assm); - g_free(mplug); - return FALSE; - } - - plugin_info = ml_get_info_prop(mplug->obj); - - /* now that the methods are filled out we can populate - the info struct with all the needed info */ - - info = g_new0(PurplePluginInfo, 1); - info->id = ml_get_prop_string(plugin_info, "Id"); - info->name = ml_get_prop_string(plugin_info, "Name"); - info->version = ml_get_prop_string(plugin_info, "Version"); - info->summary = ml_get_prop_string(plugin_info, "Summary"); - info->description = ml_get_prop_string(plugin_info, "Description"); - info->author = ml_get_prop_string(plugin_info, "Author"); - info->homepage = ml_get_prop_string(plugin_info, "Homepage"); - - info->magic = PURPLE_PLUGIN_MAGIC; - info->major_version = PURPLE_MAJOR_VERSION; - info->minor_version = PURPLE_MINOR_VERSION; - info->type = PURPLE_PLUGIN_STANDARD; - - /* this plugin depends on us; duh */ - info->dependencies = g_list_append(info->dependencies, MONO_PLUGIN_ID); - mplug->plugin = plugin; - - plugin->info = info; - info->extra_info = mplug; - - ml_add_plugin(mplug); - - return purple_plugin_register(plugin); -} - -/* Loads a Mono Plugin by calling 'load' in the class */ -static gboolean load_mono_plugin(PurplePlugin *plugin) -{ - PurpleMonoPlugin *mplug; - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Loading plugin\n"); - - mplug = (PurpleMonoPlugin*)plugin->info->extra_info; - - ml_invoke(mplug->load, mplug->obj, NULL); - - return TRUE; -} - -/* Unloads a Mono Plugin by calling 'unload' in the class */ -static gboolean unload_mono_plugin(PurplePlugin *plugin) -{ - PurpleMonoPlugin *mplug; - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Unloading plugin\n"); - - mplug = (PurpleMonoPlugin*)plugin->info->extra_info; - - purple_signals_disconnect_by_handle((gpointer)mplug->klass); - g_list_foreach(mplug->signal_data, (GFunc)g_free, NULL); - g_list_free(mplug->signal_data); - mplug->signal_data = NULL; - - ml_invoke(mplug->unload, mplug->obj, NULL); - - return TRUE; -} - -static void destroy_mono_plugin(PurplePlugin *plugin) -{ - PurpleMonoPlugin *mplug; - - purple_debug(PURPLE_DEBUG_INFO, "mono", "Destroying plugin\n"); - - mplug = (PurpleMonoPlugin*)plugin->info->extra_info; - - ml_invoke(mplug->destroy, mplug->obj, NULL); - - if (plugin->info) { - g_free(plugin->info->name); - g_free(plugin->info->version); - g_free(plugin->info->summary); - g_free(plugin->info->description); - g_free(plugin->info->author); - g_free(plugin->info->homepage); - } - - if (mplug) { - if (mplug->assm) { - mono_assembly_close(mplug->assm); - } - - g_free(mplug); - mplug = NULL; - } -} - -/****************************************************************************** - * Plugin Stuff - *****************************************************************************/ -static void plugin_destroy(PurplePlugin *plugin) -{ - ml_uninit(); -} - -static PurplePluginLoaderInfo loader_info = -{ - NULL, - probe_mono_plugin, - load_mono_plugin, - unload_mono_plugin, - destroy_mono_plugin, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_LOADER, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - MONO_PLUGIN_ID, - N_("Mono Plugin Loader"), - DISPLAY_VERSION, - N_("Loads .NET plugins with Mono."), - N_("Loads .NET plugins with Mono."), - "Eoin Coffey ", - PURPLE_WEBSITE, - NULL, - NULL, - plugin_destroy, - NULL, - &loader_info, - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void init_plugin(PurplePlugin *plugin) -{ - ml_init(); - - loader_info.exts = g_list_append(loader_info.exts, "dll"); -} - -PURPLE_INIT_PLUGIN(mono, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-glue.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-glue.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-glue.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-glue.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#ifndef _PURPLE_MONO_LOADER_GLUE_H_ -#define _PURPLE_MONO_LOADER_GLUE_H_ - -#include -#include -#include -#include - -void purple_debug_glue(int type, MonoString *cat, MonoString *str); - -int purple_signal_connect_glue(MonoObject *h, MonoObject *plugin, MonoString *signal, MonoObject *func); - -MonoObject* purple_blist_get_handle_glue(void); - -MonoObject* purple_blist_build_buddy_object(void* buddy); - -MonoObject* purple_status_build_status_object(void* data); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/* - * Mono Plugin Loader - * - * -- Thanks to the perl plugin loader for all the great tips ;-) - * - * Eoin Coffey - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include "mono-helper.h" -#include "mono-glue.h" -#include "value.h" -#include "debug.h" - -static gboolean _runtime_active = FALSE; - -gboolean ml_init() -{ - MonoDomain *d; - - g_return_val_if_fail(_runtime_active == FALSE, TRUE); - - d = mono_jit_init("purple"); - - if (!d) { - ml_set_domain(NULL); - return FALSE; - } - - ml_set_domain(d); - - ml_init_internal_calls(); - - _runtime_active = TRUE; - - return TRUE; -} - -void ml_uninit() -{ - g_return_if_fail(_runtime_active == TRUE); - - mono_jit_cleanup(ml_get_domain()); - - ml_set_domain(NULL); - - _runtime_active = FALSE; -} - -MonoObject* ml_delegate_invoke(MonoObject *method, void **params) -{ - MonoObject *ret, *exception; - - ret = mono_runtime_delegate_invoke(method, params, &exception); - if (exception) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "caught exception: %s\n", mono_class_get_name(mono_object_get_class(exception))); - } - - return ret; -} - -MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params) -{ - MonoObject *ret, *exception; - - ret = mono_runtime_invoke(method, obj, params, &exception); - if (exception) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "caught exception: %s\n", mono_class_get_name(mono_object_get_class(exception))); - } - - return ret; -} - -MonoClass* ml_find_plugin_class(MonoImage *image) -{ - MonoClass *klass, *pklass = NULL; - int i, total; - - total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); - for (i = 1; i <= total; ++i) { - klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i); - - pklass = mono_class_get_parent(klass); - if (pklass) { - - if (strcmp("Plugin", mono_class_get_name(pklass)) == 0) - return klass; - } - } - - return NULL; -} - -void ml_set_prop_string(MonoObject *obj, char *field, char *data) -{ - MonoClass *klass; - MonoProperty *prop; - MonoString *str; - gpointer args[1]; - - klass = mono_object_get_class(obj); - - prop = mono_class_get_property_from_name(klass, field); - - str = mono_string_new(ml_get_domain(), data); - - args[0] = str; - - mono_property_set_value(prop, obj, args, NULL); -} - -gchar* ml_get_prop_string(MonoObject *obj, char *field) -{ - MonoClass *klass; - MonoProperty *prop; - MonoString *str; - - klass = mono_object_get_class(obj); - - prop = mono_class_get_property_from_name(klass, field); - - str = (MonoString*)mono_property_get_value(prop, obj, NULL, NULL); - - return mono_string_to_utf8(str); -} - -MonoObject* ml_get_info_prop(MonoObject *obj) -{ - MonoClass *klass; - MonoProperty *prop; - - klass = mono_class_get_parent(mono_object_get_class(obj)); - - prop = mono_class_get_property_from_name(klass, "Info"); - - return mono_property_get_value(prop, obj, NULL, NULL); -} - -gboolean ml_is_api_dll(MonoImage *image) -{ - MonoClass *klass; - int i, total; - - total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); - for (i = 1; i <= total; ++i) { - klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i); - if (strcmp(mono_class_get_name(klass), "Debug") == 0) - if (strcmp(mono_class_get_namespace(klass), "Purple") == 0) { - ml_set_api_image(image); - return TRUE; - } - } - - return FALSE; -} - -MonoObject* ml_object_from_purple_type(PurpleType type, gpointer data) -{ - return NULL; -} - -MonoObject* ml_object_from_purple_subtype(PurpleSubType type, gpointer data) -{ - MonoObject *obj = NULL; - - switch (type) { - case PURPLE_SUBTYPE_BLIST_BUDDY: - obj = purple_blist_build_buddy_object(data); - break; - case PURPLE_SUBTYPE_STATUS: - obj = purple_status_build_status_object(data); - break; - default: - break; - } - - return obj; -} - -MonoObject* ml_create_api_object(char *class_name) -{ - MonoObject *obj = NULL; - MonoClass *klass = NULL; - - klass = mono_class_from_name(ml_get_api_image(), "Purple", class_name); - if (!klass) { - purple_debug(PURPLE_DEBUG_FATAL, "mono", "couldn't find the '%s' class\n", class_name); - return NULL; - } - - obj = mono_object_new(ml_get_domain(), klass); - if (!obj) { - purple_debug(PURPLE_DEBUG_FATAL, "mono", "couldn't create the object from class '%s'\n", class_name); - return NULL; - } - - mono_runtime_object_init(obj); - - return obj; -} - -static MonoDomain *_domain = NULL; - -MonoDomain* ml_get_domain(void) -{ - return _domain; -} - -void ml_set_domain(MonoDomain *d) -{ - _domain = d; -} - -static MonoImage *_api_image = NULL; - -void ml_set_api_image(MonoImage *image) -{ - _api_image = image; -} - -MonoImage* ml_get_api_image() -{ - return _api_image; -} - -void ml_init_internal_calls(void) -{ - mono_add_internal_call("Purple.Debug::_debug", purple_debug_glue); - mono_add_internal_call("Purple.Signal::_connect", purple_signal_connect_glue); - mono_add_internal_call("Purple.BuddyList::_get_handle", purple_blist_get_handle_glue); -} - -static GHashTable *plugins_hash = NULL; - -void ml_add_plugin(PurpleMonoPlugin *plugin) -{ - if (!plugins_hash) - plugins_hash = g_hash_table_new(NULL, NULL); - - g_hash_table_insert(plugins_hash, plugin->klass, plugin); -} - -gboolean ml_remove_plugin(PurpleMonoPlugin *plugin) -{ - return g_hash_table_remove(plugins_hash, plugin->klass); -} - -gpointer ml_find_plugin(PurpleMonoPlugin *plugin) -{ - return g_hash_table_lookup(plugins_hash, plugin->klass); -} - -gpointer ml_find_plugin_by_class(MonoClass *klass) -{ - return g_hash_table_lookup(plugins_hash, klass); -} - -GHashTable* ml_get_plugin_hash() -{ - return plugins_hash; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/mono-helper.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -#ifndef _PURPLE_MONO_LOADER_MONO_HELPER_H_ -#define _PURPLE_MONO_LOADER_MONO_HELPER_H_ - -#include -#include -#include -#include -#include -#include -#include "plugin.h" -#include "value.h" -#include "debug.h" - -typedef struct { - PurplePlugin *plugin; - - MonoAssembly *assm; - MonoClass *klass; - MonoObject *obj; - - MonoMethod *init; - MonoMethod *load; - MonoMethod *unload; - MonoMethod *destroy; - - GList *signal_data; -} PurpleMonoPlugin; - -gboolean ml_init(void); - -void ml_uninit(void); - -MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params); - -MonoObject* ml_delegate_invoke(MonoObject *method, void **params); - -MonoClass* ml_find_plugin_class(MonoImage *image); - -gchar* ml_get_prop_string(MonoObject *obj, char *field); - -void ml_set_prop_string(MonoObject *obj, char *field, char *data); - -MonoObject* ml_get_info_prop(MonoObject *obj); - -gboolean ml_is_api_dll(MonoImage *image); - -MonoDomain* ml_get_domain(void); - -void ml_set_domain(MonoDomain *d); - -void ml_init_internal_calls(void); - -MonoObject* ml_object_from_purple_type(PurpleType type, gpointer data); - -MonoObject* ml_object_from_purple_subtype(PurpleSubType type, gpointer data); - -MonoObject* ml_create_api_object(char *class_name); - -void ml_set_api_image(MonoImage *image); - -MonoImage* ml_get_api_image(void); - -/* hash table stuff; probably don't need it anymore */ - -void ml_add_plugin(PurpleMonoPlugin *plugin); - -gboolean ml_remove_plugin(PurpleMonoPlugin *plugin); - -gpointer ml_find_plugin(PurpleMonoPlugin *plugin); - -gpointer ml_find_plugin_by_class(MonoClass *klass); - -GHashTable* ml_get_plugin_hash(void); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/signal-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/signal-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/signal-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/signal-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -#include "mono-glue.h" -#include "mono-helper.h" -#include "debug.h" -#include "blist.h" -#include "signals.h" -#include "value.h" - -typedef struct { - MonoObject *func; - char *signal; - PurpleValue **values; - PurpleValue *ret_value; - int num_vals; -} SignalData; - -static PurpleCallback get_callback(SignalData *sig_data); - -static gpointer dispatch_callback(SignalData *sig_data, int num_vals, ...) -{ - MonoArray *array; - MonoObject *obj; - int i; - gpointer meth_args[1]; - gpointer purple_obj; - - va_list args; - - va_start(args, num_vals); - - array = mono_array_new(ml_get_domain(), mono_get_object_class(), num_vals); - - for (i = 0; i < num_vals; i++) { - if (purple_value_get_type(sig_data->values[i]) == PURPLE_TYPE_SUBTYPE) { - purple_obj = va_arg(args, gpointer); - obj = ml_object_from_purple_subtype(purple_value_get_subtype(sig_data->values[i]), purple_obj); - mono_array_set(array, MonoObject*, i, obj); - } else { - purple_obj = va_arg(args, gpointer); - obj = ml_object_from_purple_type(purple_value_get_type(sig_data->values[i]), purple_obj); - mono_array_set(array, MonoObject*, i, obj); - } - } - - va_end(args); - - meth_args[0] = array; - - return ml_delegate_invoke(sig_data->func, meth_args); -} - -static void cb_void__pointer(void *arg1, void *data) -{ - dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1); -} - -static void cb_void__pointer_pointer_pointer(void *arg1, void *arg2, void *arg3, void *data) -{ - dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1, arg2, arg3); -} - - -int purple_signal_connect_glue(MonoObject* h, MonoObject *plugin, MonoString *signal, MonoObject *func) -{ - char *sig; - void **instance = NULL; - SignalData *sig_data; - PurpleMonoPlugin *mplug; - MonoClass *klass; - - sig = mono_string_to_utf8(signal); - purple_debug(PURPLE_DEBUG_INFO, "mono", "connecting signal: %s\n", sig); - - instance = (void*)mono_object_unbox(h); - - sig_data = g_new0(SignalData, 1); - - sig_data->func = func; - sig_data->signal = sig; - - purple_signal_get_values(*instance, sig, &sig_data->ret_value, &sig_data->num_vals, &sig_data->values); - - klass = mono_object_get_class(plugin); - - mplug = ml_find_plugin_by_class(klass); - - mplug->signal_data = g_list_append(mplug->signal_data, (gpointer)sig_data); - - return purple_signal_connect(*instance, sig, (gpointer)klass, get_callback(sig_data), (gpointer)sig_data); -} - -static int determine_index(PurpleType type) -{ - switch (type) { - case PURPLE_TYPE_SUBTYPE: - case PURPLE_TYPE_STRING: - case PURPLE_TYPE_OBJECT: - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_BOXED: - return 1; - break; - default: - return type; - break; - } -} - -static gpointer callbacks[]= { - NULL, - cb_void__pointer, - NULL, - cb_void__pointer_pointer_pointer - }; - -static int callbacks_array_size = sizeof(callbacks) / sizeof(PurpleCallback); - - -static PurpleCallback get_callback(SignalData *sig_data) -{ - int i, index = 0; - - if (sig_data->ret_value == NULL) - index = 0; - else - index = determine_index(purple_value_get_type(sig_data->ret_value)); - - for (i = 0; i < sig_data->num_vals; i++) { - index += determine_index(purple_value_get_type(sig_data->values[i])); - } - - purple_debug(PURPLE_DEBUG_INFO, "mono", "get_callback index = %d\n", index); - - if (index >= callbacks_array_size || callbacks[index] == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "mono", "couldn't find a callback function for signal: %s\n", sig_data->signal); - return NULL; - } - - purple_debug(PURPLE_DEBUG_MISC, "mono", "using callback at index: %d\n", index); - return PURPLE_CALLBACK(callbacks[index]); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/status-glue.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/status-glue.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/status-glue.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/loader/status-glue.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#include "status.h" -#include "mono-helper.h" -#include "mono-glue.h" - -MonoObject* purple_status_build_status_object(void* data) -{ - MonoObject *obj = NULL; - PurpleStatus *status = (PurpleStatus*)data; - - obj = ml_create_api_object("Status"); - g_return_val_if_fail(obj != NULL, NULL); - - ml_set_prop_string(obj, "Id", (char*)purple_status_get_id(status)); - - return obj; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -SUBDIRS = api loader - -mono_sources = GetBuddyBack.cs \ - MPlugin.cs - -EXTRA_DIST = $(mono_sources) - -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -mono_SCRIPTS = MPlugin.dll GetBuddyBack.dll -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) - -all: $(mono_SCRIPTS) - -SUFFIXES = .cs .dll -.cs.dll: api/PurpleAPI.dll $(mono_build_sources) - mcs -t:library -lib:./api -out:$@ -r:PurpleAPI.dll $< - -clean-local: - rm -f $(mono_SCRIPTS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,757 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/mono -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(monodir)" -monoSCRIPT_INSTALL = $(INSTALL_SCRIPT) -SCRIPTS = $(mono_SCRIPTS) -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -SUBDIRS = api loader -mono_sources = GetBuddyBack.cs \ - MPlugin.cs - -EXTRA_DIST = $(mono_sources) -monodir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -mono_SCRIPTS = MPlugin.dll GetBuddyBack.dll -mono_build_sources = $(addprefix $(srcdir)/, $(mono_sources)) -SUFFIXES = .cs .dll -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .cs .dll -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/mono/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/mono/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-monoSCRIPTS: $(mono_SCRIPTS) - @$(NORMAL_INSTALL) - test -z "$(monodir)" || $(mkdir_p) "$(DESTDIR)$(monodir)" - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f $$d$$p; then \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " $(monoSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(monodir)/$$f'"; \ - $(monoSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(monodir)/$$f"; \ - else :; fi; \ - done - -uninstall-monoSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(mono_SCRIPTS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ - echo " rm -f '$(DESTDIR)$(monodir)/$$f'"; \ - rm -f "$(DESTDIR)$(monodir)/$$f"; \ - done - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(SCRIPTS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(monodir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: install-monoSCRIPTS - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am uninstall-monoSCRIPTS - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-local clean-recursive \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-recursive distclean-tags distdir \ - dvi dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-monoSCRIPTS \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-monoSCRIPTS - - -all: $(mono_SCRIPTS) -.cs.dll: api/PurpleAPI.dll $(mono_build_sources) - mcs -t:library -lib:./api -out:$@ -r:PurpleAPI.dll $< - -clean-local: - rm -f $(mono_SCRIPTS) -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/MPlugin.cs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/MPlugin.cs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/MPlugin.cs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/mono/MPlugin.cs 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -using Purple; - -public class MPlugin : Plugin -{ - private static PluginInfo info = new PluginInfo("mono-mplugin", "C# Plugin", "0.1", "Test C# Plugin", "Longer Description", "Eoin Coffey", "urled"); - - public MPlugin() - : base(info) - { - } - - public void HandleSig(object[] args) - { - Buddy buddy = (Buddy)args[0]; - Status old_status = (Status)args[1]; - Status status = (Status)args[2]; - - Debug.debug(Debug.INFO, "mplug", "buddy " + buddy.Name + " went from " + old_status.Id + " to " + status.Id + "\n"); - } - - public override void Load() - { - Debug.debug(Debug.INFO, "mplug", "loading...\n"); - - /*Signal.connect(BuddyList.GetHandle(), this, "buddy-away", new Signal.Handler(HandleSig));*/ - BuddyList.OnBuddyStatusChanged.connect(this, new Signal.Handler(HandleSig)); - } - - public override void Unload() - { - Debug.debug(Debug.INFO, "mplug", "unloading...\n"); - } - - public override void Destroy() - { - Debug.debug(Debug.INFO, "mplug", "destroying...\n"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/newline.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/newline.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/newline.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/newline.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -/* - * Displays messages on a new line, below the nick - * Copyright (C) 2004 Stu Tomlinson - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ -#include "internal.h" - -#include - -#include -#include -#include -#include -#include -#include - -static gboolean -addnewline_msg_cb(PurpleAccount *account, char *sender, char **message, - PurpleConversation *conv, int *flags, void *data) -{ - if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && - !purple_prefs_get_bool("/plugins/core/newline/im")) || - ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && - !purple_prefs_get_bool("/plugins/core/newline/chat"))) - return FALSE; - - if (g_ascii_strncasecmp(*message, "/me ", strlen("/me "))) { - char *tmp = g_strdup_printf("
%s", *message); - g_free(*message); - *message = tmp; - } - - return FALSE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) { - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/newline/im", _("Add new line in IMs")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/newline/chat", _("Add new line in Chats")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *conversation = purple_conversations_get_handle(); - - purple_signal_connect(conversation, "writing-im-msg", - plugin, PURPLE_CALLBACK(addnewline_msg_cb), NULL); - purple_signal_connect(conversation, "writing-chat-msg", - plugin, PURPLE_CALLBACK(addnewline_msg_cb), NULL); - - return TRUE; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /**< magic */ - PURPLE_MAJOR_VERSION, /**< major version */ - PURPLE_MINOR_VERSION, /**< minor version */ - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "core-plugin_pack-newline", /**< id */ - N_("New Line"), /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Prepends a newline to displayed message."), /**< summary */ - N_("Prepends a newline to messages so that the " - "rest of the message appears below the " - "username in the conversation window."), /**< description */ - "Stu Tomlinson ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) { - purple_prefs_add_none("/plugins/core/newline"); - purple_prefs_add_bool("/plugins/core/newline/im", TRUE); - purple_prefs_add_bool("/plugins/core/newline/chat", TRUE); -} - -PURPLE_INIT_PLUGIN(newline, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/notify_example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/notify_example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/notify_example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/notify_example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * Notify API Example Plugin - * - * Copyright (C) 2007, John Bailey - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -/* This will prevent compiler errors in some instances and is better explained in the - * how-to documents on the wiki */ -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -/* This is the required definition of PURPLE_PLUGINS as required for a plugin, - * but we protect it with an #ifndef because config.h may define it for us - * already and this would cause an unneeded compiler warning. */ -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#define PLUGIN_ID "core-notifyexample" -#define PLUGIN_AUTHOR "John Bailey " - -#include -#include -#include - -static PurplePlugin *notify_example = NULL; - -/* The next four functions and the calls within them should cause dialog boxes to appear - * when you select the plugin action from the Tools->Notify Example menu */ -static void -notify_error_cb(PurplePluginAction *action) -{ - purple_notify_error(notify_example, "Test Notification", "Test Notification", - "This is a test error notification"); -} - -static void -notify_info_cb(PurplePluginAction *action) -{ - purple_notify_info(notify_example, "Test Notification", "Test Notification", - "This is a test informative notification"); -} - -static void -notify_warn_cb(PurplePluginAction *action) -{ - purple_notify_warning(notify_example, "Test Notification", "Test Notification", - "This is a test warning notification"); -} - -static void -notify_format_cb(PurplePluginAction *action) -{ - purple_notify_formatted(notify_example, "Test Notification", "Test Notification", - "Test Notification", - "This is a test notification with formatted text.", NULL, NULL); -} - -static void -notify_uri_cb(PurplePluginAction *action) -{ - /* This one should open your web browser of choice. */ - purple_notify_uri(notify_example, "http://www.pidgin.im/"); -} - -static GList * -plugin_actions(PurplePlugin *plugin, gpointer context) -{ - GList *actions = NULL; - - /* Here we take advantage of return values to avoid the need for a temp variable */ - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Error Notification", notify_error_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Info Notification", notify_info_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Warning Notification", notify_warn_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show Formatted Notification", notify_format_cb)); - - actions = g_list_prepend(actions, - purple_plugin_action_new("Show URI Notification", notify_uri_cb)); - - return g_list_reverse(actions); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - /* we need a handle for all the notify calls */ - notify_example = plugin; - - return TRUE; -} - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, /* magic number */ - PURPLE_MAJOR_VERSION, /* purple major */ - PURPLE_MINOR_VERSION, /* purple minor */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - NULL, /* UI requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* id */ - "Notify API Example", /* name */ - DISPLAY_VERSION, /* version */ - "Notify API Example", /* summary */ - "Notify API Example", /* description */ - PLUGIN_AUTHOR, /* author */ - "http://pidgin.im", /* homepage */ - - plugin_load, /* load */ - NULL, /* unload */ - NULL, /* destroy */ - - NULL, /* ui info */ - NULL, /* extra info */ - NULL, /* prefs info */ - plugin_actions, /* actions */ - NULL, /* reserved */ - NULL, /* reserved */ - NULL, /* reserved */ - NULL /* reserved */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(notifyexample, init_plugin, info) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/offlinemsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/offlinemsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/offlinemsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/offlinemsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,257 +0,0 @@ -/* - * Offline Message Emulation - Save messages sent to an offline user as pounce - * Copyright (C) 2004 - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" - -#define PLUGIN_ID "core-plugin_pack-offlinemsg" -#define PLUGIN_NAME N_("Offline Message Emulation") -#define PLUGIN_STATIC_NAME offlinemsg -#define PLUGIN_SUMMARY N_("Save messages sent to an offline user as pounce.") -#define PLUGIN_DESCRIPTION N_("Save messages sent to an offline user as pounce.") -#define PLUGIN_AUTHOR "Sadrul H Chowdhury " - -/* Purple headers */ -#include - -#include -#include -#include -#include -#include -#include - -#define PREF_PREFIX "/plugins/core/" PLUGIN_ID -#define PREF_ALWAYS PREF_PREFIX "/always" - -typedef struct _OfflineMsg OfflineMsg; - -typedef enum -{ - OFFLINE_MSG_NONE, - OFFLINE_MSG_YES, - OFFLINE_MSG_NO -} OfflineMessageSetting; - -struct _OfflineMsg -{ - PurpleAccount *account; - PurpleConversation *conv; - char *who; - char *message; -}; - -static void -discard_data(OfflineMsg *offline) -{ - g_free(offline->who); - g_free(offline->message); - g_free(offline); -} - -static void -cancel_poune(OfflineMsg *offline) -{ - purple_conversation_set_data(offline->conv, "plugin_pack:offlinemsg", - GINT_TO_POINTER(OFFLINE_MSG_NO)); - purple_conv_im_send_with_flags(PURPLE_CONV_IM(offline->conv), offline->message, 0); - discard_data(offline); -} - -static void -record_pounce(OfflineMsg *offline) -{ - PurplePounce *pounce; - PurplePounceEvent event; - PurplePounceOption option; - PurpleConversation *conv; - - event = PURPLE_POUNCE_SIGNON; - option = PURPLE_POUNCE_OPTION_NONE; - - pounce = purple_pounce_new(purple_core_get_ui(), offline->account, offline->who, - event, option); - - purple_pounce_action_set_enabled(pounce, "send-message", TRUE); - purple_pounce_action_set_attribute(pounce, "send-message", "message", offline->message); - - conv = offline->conv; - if (!purple_conversation_get_data(conv, "plugin_pack:offlinemsg")) - purple_conversation_write(conv, NULL, _("The rest of the messages will be saved " - "as pounces. You can edit/delete the pounce from the `Buddy " - "Pounce' dialog."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conversation_set_data(conv, "plugin_pack:offlinemsg", - GINT_TO_POINTER(OFFLINE_MSG_YES)); - - purple_conv_im_write(PURPLE_CONV_IM(conv), offline->who, offline->message, - PURPLE_MESSAGE_SEND, time(NULL)); - - discard_data(offline); -} - -static void -sending_msg_cb(PurpleAccount *account, const char *who, char **message, gpointer handle) -{ - PurpleBuddy *buddy; - OfflineMsg *offline; - PurpleConversation *conv; - OfflineMessageSetting setting; - - if (message == NULL || *message == NULL || - **message == '\0') - return; - - buddy = purple_find_buddy(account, who); - if (!buddy) - return; - - if (purple_presence_is_online(purple_buddy_get_presence(buddy))) - return; - - if (purple_account_supports_offline_message(account, buddy)) - { - purple_debug_info("offlinemsg", "Account \"%s\" supports offline messages.\n", - purple_account_get_username(account)); - return; - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - who, account); - - if (!conv) - return; - - setting = GPOINTER_TO_INT(purple_conversation_get_data(conv, "plugin_pack:offlinemsg")); - if (setting == OFFLINE_MSG_NO) - return; - - offline = g_new0(OfflineMsg, 1); - offline->conv = conv; - offline->account = account; - offline->who = g_strdup(who); - offline->message = *message; - *message = NULL; - - if (purple_prefs_get_bool(PREF_ALWAYS) || setting == OFFLINE_MSG_YES) - record_pounce(offline); - else if (setting == OFFLINE_MSG_NONE) - { - char *ask; - ask = g_strdup_printf(_("\"%s\" is currently offline. Do you want to save the " - "rest of the messages in a pounce and automatically send them " - "when \"%s\" logs back in?"), who, who); - - purple_request_action(handle, _("Offline Message"), ask, - _("You can edit/delete the pounce from the `Buddy Pounces' dialog"), - 0, - offline->account, offline->who, offline->conv, - offline, 2, - _("Yes"), record_pounce, - _("No"), cancel_poune); - g_free(ask); - } -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_signal_connect_priority(purple_conversations_get_handle(), "sending-im-msg", - plugin, PURPLE_CALLBACK(sending_msg_cb), plugin, PURPLE_SIGNAL_PRIORITY_HIGHEST); - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - return TRUE; -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - pref = purple_plugin_pref_new_with_label(_("Save offline messages in pounce")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name_and_label(PREF_ALWAYS, - _("Do not ask. Always save in pounce.")); - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /* Magic */ - PURPLE_MAJOR_VERSION, /* Purple Major Version */ - PURPLE_MINOR_VERSION, /* Purple Minor Version */ - PURPLE_PLUGIN_STANDARD, /* plugin type */ - NULL, /* ui requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - PLUGIN_ID, /* plugin id */ - PLUGIN_NAME, /* name */ - DISPLAY_VERSION, /* version */ - PLUGIN_SUMMARY, /* summary */ - PLUGIN_DESCRIPTION, /* description */ - PLUGIN_AUTHOR, /* author */ - PURPLE_WEBSITE, /* website */ - - plugin_load, /* load */ - plugin_unload, /* unload */ - NULL, /* destroy */ - - NULL, /* ui_info */ - NULL, /* extra_info */ - &prefs_info, /* prefs_info */ - NULL, /* actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none(PREF_PREFIX); - purple_prefs_add_bool(PREF_ALWAYS, FALSE); -} - -PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/one_time_password.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/one_time_password.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/one_time_password.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/one_time_password.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -/* - * One Time Password support plugin for libpurple - * - * Copyright (C) 2009, Daniel Atallah - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" -#include "account.h" -#include "accountopt.h" - -#define PLUGIN_ID "core-one_time_password" -#define PREF_NAME PLUGIN_ID "_enabled" - -static void -signed_on_cb(PurpleConnection *conn, void *data) -{ - PurpleAccount *account = purple_connection_get_account(conn); - - if (purple_account_get_bool(account, PREF_NAME, FALSE)) { - if(purple_account_get_remember_password(account)) - purple_debug_error("One Time Password", - "Unable to enforce one time password for account %s (%s).\n" - "Account is set to remember the password.\n", - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - else { - - purple_debug_info("One Time Password", "Clearing password for account %s (%s).\n", - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - purple_account_set_password(account, NULL); - /* TODO: Do we need to somehow clear conn->password ? */ - } - } -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - PurpleAccountOption *option; - GList *l; - - /* Register protocol preference. */ - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - prpl = (PurplePlugin *)l->data; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info != NULL && !(prpl_info->options & OPT_PROTO_NO_PASSWORD)) { - option = purple_account_option_bool_new(_("One Time Password"), - PREF_NAME, FALSE); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - } - } - - /* Register callback. */ - purple_signal_connect(purple_connections_get_handle(), "signed-on", - plugin, PURPLE_CALLBACK(signed_on_cb), NULL); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - PurpleAccountOption *option; - GList *l, *options; - - /* Remove protocol preference. */ - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - prpl = (PurplePlugin *)l->data; - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info != NULL && !(prpl_info->options & OPT_PROTO_NO_PASSWORD)) { - options = prpl_info->protocol_options; - while (options != NULL) { - option = (PurpleAccountOption *) options->data; - if (strcmp(PREF_NAME, purple_account_option_get_setting(option)) == 0) { - prpl_info->protocol_options = g_list_delete_link(prpl_info->protocol_options, options); - purple_account_option_destroy(option); - break; - } - options = options->next; - } - } - } - - /* Callback will be automagically unregistered */ - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - PLUGIN_ID, /**< id */ - N_("One Time Password Support"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Enforce that passwords are used only once."), - /** description */ - N_("Allows you to enforce on a per-account basis that passwords not " - "being saved are only used in a single successful connection.\n" - "Note: The account password must not be saved for this to work."), - "Daniel Atallah ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - NULL, /**< reserved 1 */ - NULL, /**< reserved 2 */ - NULL, /**< reserved 3 */ - NULL /**< reserved 4 */ -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(one_time_password, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/AccountOpts.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/AccountOpts.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/AccountOpts.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/AccountOpts.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -#include "module.h" - -MODULE = Purple::Account::Option PACKAGE = Purple::Account::Option PREFIX = purple_account_option_ -PROTOTYPES: ENABLE - -void -purple_account_option_destroy(option) - Purple::Account::Option option - -const char * -purple_account_option_get_default_string(option) - Purple::Account::Option option - -void -purple_account_option_add_list_item(option, key, value) - Purple::Account::Option option - const char * key - const char * value - -void -purple_account_option_set_default_string(option, value); - Purple::Account::Option option - const char * value - -void -purple_account_option_set_default_int(option, value); - Purple::Account::Option option - int value - -void -purple_account_option_set_default_bool(option, value); - Purple::Account::Option option - gboolean value - -Purple::Account::Option -purple_account_option_list_new(class, text, pref_name, values) - const char * text - const char * pref_name - SV * values -PREINIT: - GList *t_GL; - int i, t_len; -CODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(values)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0))); - - RETVAL = purple_account_option_list_new(text, pref_name, t_GL); -OUTPUT: - RETVAL - -Purple::Account::Option -purple_account_option_string_new(class, text, pref_name, default_value) - const char * text - const char * pref_name - const char * default_value - C_ARGS: - text, pref_name, default_value - -Purple::Account::Option -purple_account_option_int_new(class, text, pref_name, default_value) - const char * text - const char * pref_name - gboolean default_value - C_ARGS: - text, pref_name, default_value - -Purple::Account::Option -purple_account_option_bool_new(class, text, pref_name, default_value) - const char * text - const char * pref_name - gboolean default_value - C_ARGS: - text, pref_name, default_value - -Purple::Account::Option -purple_account_option_new(class, type, text, pref_name) - Purple::PrefType type - const char * text - const char * pref_name - C_ARGS: - type, text, pref_name - -void -purple_account_option_get_list(option) - Purple::Account::Option option -PREINIT: - GList *l; -PPCODE: - for (l = purple_account_option_get_list(option); l != NULL; l = l->next) { - /* XXX These are actually PurpleKeyValuePairs but we don't have a - * type for that and even if we did I don't think there's - * anything perl could do with them, so I'm just going to - * leave this as a Purple::ListEntry for now. */ - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -Purple::PrefType -purple_account_option_get_type(option) - Purple::Account::Option option - -gboolean -purple_account_option_get_masked(option) - Purple::Account::Option option - -int -purple_account_option_get_default_int(option) - Purple::Account::Option option; - -gboolean -purple_account_option_get_default_bool(option) - Purple::Account::Option option; - -const char * -purple_account_option_get_setting(option) - Purple::Account::Option option - -const char * -purple_account_option_get_text(option) - Purple::Account::Option option - -void -purple_account_option_set_list(option, values) - Purple::Account::Option option - SV * values -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(values)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0))); - - purple_account_option_set_list(option, t_GL); - -void -purple_account_option_set_masked(option, masked) - Purple::Account::Option option - gboolean masked - -MODULE = Purple::Account::Option PACKAGE = Purple::Account::UserSplit PREFIX = purple_account_user_split_ -PROTOTYPES: ENABLE - -Purple::Account::UserSplit -purple_account_user_split_new(class, text, default_value, sep) - const char * text - const char * default_value - char sep - C_ARGS: - text, default_value, sep - -char -purple_account_user_split_get_separator(split) - Purple::Account::UserSplit split - -const char * -purple_account_user_split_get_text(split) - Purple::Account::UserSplit split - -void -purple_account_user_split_destroy(split) - Purple::Account::UserSplit split diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Account.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Account.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Account.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Account.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,314 +0,0 @@ -#include "module.h" - -MODULE = Purple::Account PACKAGE = Purple::Account PREFIX = purple_account_ -PROTOTYPES: ENABLE - -Purple::Presence -purple_account_get_presence(account) - Purple::Account account - -Purple::Account -purple_account_new(class, username, protocol_id) - const char * username - const char * protocol_id - C_ARGS: - username, protocol_id - -void -purple_account_destroy(account) - Purple::Account account - -void -purple_account_connect(account) - Purple::Account account - -void -purple_account_register(account) - Purple::Account account - -void -purple_account_disconnect(account) - Purple::Account account - -void -purple_account_request_change_password(account) - Purple::Account account - -void -purple_account_request_change_user_info(account) - Purple::Account account - -void -purple_account_set_username(account, username) - Purple::Account account - const char * username - -void -purple_account_set_password(account, password) - Purple::Account account - const char * password - -void -purple_account_set_alias(account, alias) - Purple::Account account - const char * alias - -void -purple_account_set_user_info(account, user_info) - Purple::Account account - const char *user_info - -void -purple_account_set_buddy_icon_path(account, icon) - Purple::Account account - const char *icon - -void -purple_account_set_connection(account, gc) - Purple::Account account - Purple::Connection gc - -void -purple_account_set_remember_password(account, value) - Purple::Account account - gboolean value - -void -purple_account_set_check_mail(account, value) - Purple::Account account - gboolean value - -void purple_account_set_enabled(account, ui, value) - Purple::Account account - const char *ui - gboolean value - -void -purple_account_set_proxy_info(account, info) - Purple::Account account - Purple::ProxyInfo info - -void -purple_account_set_status(account, status_id, active) - Purple::Account account - const char *status_id - gboolean active -CODE: - purple_account_set_status(account, status_id, active, NULL); - -void -purple_account_set_status_types(account, status_types) - Purple::Account account - SV * status_types -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(status_types)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); - - purple_account_set_status_types(account, t_GL); - -void -purple_account_clear_settings(account) - Purple::Account account - -void -purple_account_set_int(account, name, value) - Purple::Account account - const char *name - int value - -gboolean -purple_account_is_connected(account) - Purple::Account account - -const char * -purple_account_get_username(account) - Purple::Account account - -const char * -purple_account_get_password(account) - Purple::Account account - -const char * -purple_account_get_alias(account) - Purple::Account account - -const char * -purple_account_get_user_info(account) - Purple::Account account - -const char * -purple_account_get_buddy_icon_path(account) - Purple::Account account - -const char * -purple_account_get_protocol_id(account) - Purple::Account account - -const char * -purple_account_get_protocol_name(account) - Purple::Account account - -Purple::Connection -purple_account_get_connection(account) - Purple::Account account - -gboolean -purple_account_get_remember_password(account) - Purple::Account account - -gboolean -purple_account_get_check_mail(account) - Purple::Account account - -gboolean -purple_account_get_enabled(account, ui) - Purple::Account account - const char *ui - -Purple::ProxyInfo -purple_account_get_proxy_info(account) - Purple::Account account - -Purple::Status -purple_account_get_active_status(account) - Purple::Account account - -void -purple_account_get_status_types(account) - Purple::Account account -PREINIT: - GList *l; -PPCODE: - for (l = purple_account_get_status_types(account); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusType"))); - } - -Purple::Log -purple_account_get_log(account, create) - Purple::Account account - gboolean create - -void -purple_account_destroy_log(account) - Purple::Account account - -void -purple_account_add_buddies(account, list) - Purple::Account account - SV * list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(list)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(list), i, 0))); - - purple_account_add_buddies(account, t_GL); - g_list_free(t_GL); - -void -purple_account_add_buddy(account, buddy) - Purple::Account account - Purple::BuddyList::Buddy buddy - -void -purple_account_change_password(account, a, b) - Purple::Account account - const char * a - const char * b - -void -purple_account_remove_buddies(account, A, B) - Purple::Account account - SV * A - SV * B -PREINIT: - GList *t_GL1, *t_GL2; - int i, t_len; -PPCODE: - t_GL1 = NULL; - t_len = av_len((AV *)SvRV(A)); - - for (i = 0; i <= t_len; i++) - t_GL1 = g_list_append(t_GL1, SvPVutf8_nolen(*av_fetch((AV *)SvRV(A), i, 0))); - - t_GL2 = NULL; - t_len = av_len((AV *)SvRV(B)); - - for (i = 0; i <= t_len; i++) - t_GL2 = g_list_append(t_GL2, SvPVutf8_nolen(*av_fetch((AV *)SvRV(B), i, 0))); - - purple_account_remove_buddies(account, t_GL1, t_GL2); - g_list_free(t_GL1); - g_list_free(t_GL2); - -void -purple_account_remove_buddy(account, buddy, group) - Purple::Account account - Purple::BuddyList::Buddy buddy - Purple::BuddyList::Group group - -void -purple_account_remove_group(account, group) - Purple::Account account - Purple::BuddyList::Group group - -MODULE = Purple::Account PACKAGE = Purple::Accounts PREFIX = purple_accounts_ -PROTOTYPES: ENABLE - -void -purple_accounts_add(account) - Purple::Account account - -void -purple_accounts_remove(account) - Purple::Account account - -void -purple_accounts_delete(account) - Purple::Account account - -void -purple_accounts_reorder(account, new_index) - Purple::Account account - size_t new_index - -void -purple_accounts_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_accounts_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account"))); - } - -void -purple_accounts_get_all_active() -PREINIT: - GList *list, *iter; -PPCODE: - list = purple_accounts_get_all_active(); - for (iter = list; iter != NULL; iter = iter->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(iter->data, "Purple::Account"))); - } - g_list_free(list); - -void -purple_accounts_restore_current_statuses() - -Purple::Account -purple_accounts_find(name, protocol) - const char * name - const char * protocol - -Purple::Handle -purple_accounts_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyIcon.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyIcon.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyIcon.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyIcon.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#include "module.h" - -MODULE = Purple::Buddy::Icon PACKAGE = Purple::Buddy::Icon PREFIX = purple_buddy_icon_ -PROTOTYPES: ENABLE - -Purple::Buddy::Icon -purple_buddy_icon_ref(icon) - Purple::Buddy::Icon icon - -Purple::Buddy::Icon -purple_buddy_icon_unref(icon) - Purple::Buddy::Icon icon - -void -purple_buddy_icon_update(icon) - Purple::Buddy::Icon icon - -void -purple_buddy_icon_set_data(icon, data, len, checksum) - Purple::Buddy::Icon icon - void * data - size_t len - char *checksum - -Purple::Account -purple_buddy_icon_get_account(icon) - Purple::Buddy::Icon icon - -const char * -purple_buddy_icon_get_username(icon) - Purple::Buddy::Icon icon - -const void * -purple_buddy_icon_get_data(icon, len) - Purple::Buddy::Icon icon - size_t &len - -const char * -purple_buddy_icon_get_extension(icon) - Purple::Buddy::Icon icon - -void -purple_buddy_icon_get_scale_size(spec, width, height) - Purple::Buddy::Icon::Spec spec - int *width - int *height - -gchar_own * -purple_buddy_icon_get_full_path(icon); - Purple::Buddy::Icon icon - -MODULE = Purple::Buddy::Icon PACKAGE = Purple::Buddy::Icons PREFIX = purple_buddy_icons_ -PROTOTYPES: ENABLE - -void -purple_buddy_icons_set_caching(caching) - gboolean caching - -gboolean -purple_buddy_icons_is_caching() - -void -purple_buddy_icons_set_cache_dir(cache_dir) - const char *cache_dir - -const char * -purple_buddy_icons_get_cache_dir(); - -Purple::Handle -purple_buddy_icons_get_handle(); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyList.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyList.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyList.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/BuddyList.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,418 +0,0 @@ -#undef PURPLE_DISABLE_DEPRECATED -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::BuddyList PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::BuddyList::Node", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_BLIST_##name##_NODE} - const_iv(GROUP), - const_iv(CONTACT), - const_iv(BUDDY), - const_iv(CHAT), - const_iv(OTHER), -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_BLIST_NODE_FLAG_##name} - const_iv(NO_SAVE), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::BuddyList -purple_get_blist() - -void -purple_set_blist(blist) - Purple::BuddyList blist - -MODULE = Purple::BuddyList PACKAGE = Purple::Find PREFIX = purple_find_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Buddy -purple_find_buddy(account, name) - Purple::Account account - const char * name - -void -purple_find_buddies(account, name) - Purple::Account account - const char * name -PREINIT: - GSList *l, *ll; -PPCODE: - ll = purple_find_buddies(account, name); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::BuddyList::Buddy"))); - } - g_slist_free(ll); - -Purple::BuddyList::Group -purple_find_group(name) - const char *name - -MODULE = Purple::BuddyList PACKAGE = Purple::Find PREFIX = purple_ -PROTOTYPES: ENABLE - -gboolean -purple_group_on_account(group, account) - Purple::BuddyList::Group group - Purple::Account account - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Contact PREFIX = purple_contact_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Contact -purple_contact_new(); - -Purple::BuddyList::Buddy -purple_contact_get_priority_buddy(contact) - Purple::BuddyList::Contact contact - -void -purple_contact_set_alias(contact, alias) - Purple::BuddyList::Contact contact - const char * alias - -const char * -purple_contact_get_alias(contact) - Purple::BuddyList::Contact contact - -gboolean -purple_contact_on_account(contact, account) - Purple::BuddyList::Contact contact - Purple::Account account - -void -purple_contact_invalidate_priority_buddy(contact) - Purple::BuddyList::Contact contact - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Group PREFIX = purple_group_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Group -purple_group_new(name) - const char *name - -void -purple_group_get_accounts(group) - Purple::BuddyList::Group group -PREINIT: - GSList *l, *ll; -PPCODE: - ll = purple_group_get_accounts(group); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account"))); - } - g_slist_free(ll); - -gboolean -purple_group_on_account(group, account) - Purple::BuddyList::Group group - Purple::Account account - -const char * -purple_group_get_name(group) - Purple::BuddyList::Group group - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList PREFIX = purple_blist_ -PROTOTYPES: ENABLE - -void -purple_blist_add_contact(contact, group, node) - Purple::BuddyList::Contact contact - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -void -purple_blist_merge_contact(source, node) - Purple::BuddyList::Contact source - Purple::BuddyList::Node node - -void -purple_blist_add_group(group, node) - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -void -purple_blist_add_buddy(buddy, contact, group, node) - Purple::BuddyList::Buddy buddy - Purple::BuddyList::Contact contact - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -void -purple_blist_remove_buddy(buddy) - Purple::BuddyList::Buddy buddy - -void -purple_blist_remove_contact(contact) - Purple::BuddyList::Contact contact - -void -purple_blist_remove_chat(chat) - Purple::BuddyList::Chat chat - -void -purple_blist_remove_group(group) - Purple::BuddyList::Group group - -Purple::BuddyList::Chat -purple_blist_find_chat(account, name) - Purple::Account account - const char *name - -void -purple_blist_add_chat(chat, group, node) - Purple::BuddyList::Chat chat - Purple::BuddyList::Group group - Purple::BuddyList::Node node - -Purple::BuddyList -purple_blist_new() - -void -purple_blist_show() - -void -purple_blist_destroy(); - -void -purple_blist_set_visible(show) - gboolean show - -void -purple_blist_update_buddy_status(buddy, old_status) - Purple::BuddyList::Buddy buddy - Purple::Status old_status - -void -purple_blist_update_buddy_icon(buddy) - Purple::BuddyList::Buddy buddy - -void -purple_blist_rename_buddy(buddy, name) - Purple::BuddyList::Buddy buddy - const char * name - -void -purple_blist_alias_buddy(buddy, alias) - Purple::BuddyList::Buddy buddy - const char * alias - -void -purple_blist_server_alias_buddy(buddy, alias) - Purple::BuddyList::Buddy buddy - const char * alias - -void -purple_blist_alias_chat(chat, alias) - Purple::BuddyList::Chat chat - const char * alias - -void -purple_blist_rename_group(group, name) - Purple::BuddyList::Group group - const char * name - -void -purple_blist_add_account(account) - Purple::Account account - -void -purple_blist_remove_account(account) - Purple::Account account - -int -purple_blist_get_group_size(group, offline) - Purple::BuddyList::Group group - gboolean offline - -int -purple_blist_get_group_online_count(group) - Purple::BuddyList::Group group - -void -purple_blist_load() - -void -purple_blist_schedule_save() - -void -purple_blist_request_add_group() - -Purple::Handle -purple_blist_get_handle() - -Purple::BuddyList::Node -purple_blist_get_root() - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Node PREFIX = purple_blist_node_ -PROTOTYPES: ENABLE - -void -purple_blist_node_get_extended_menu(node) - Purple::BuddyList::Node node -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_blist_node_get_extended_menu(node); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action"))); - } - /* We can free the list here but the script needs to free the - * Purple::Menu::Action 'objects' itself. */ - g_list_free(ll); - -void -purple_blist_node_set_bool(node, key, value) - Purple::BuddyList::Node node - const char * key - gboolean value - -gboolean -purple_blist_node_get_bool(node, key) - Purple::BuddyList::Node node - const char * key - -void -purple_blist_node_set_int(node, key, value) - Purple::BuddyList::Node node - const char * key - int value - -int -purple_blist_node_get_int(node, key) - Purple::BuddyList::Node node - const char * key - -const char * -purple_blist_node_get_string(node, key) - Purple::BuddyList::Node node - const char * key - -void -purple_blist_node_remove_setting(node, key) - Purple::BuddyList::Node node - const char * key - -void -purple_blist_node_set_flags(node, flags) - Purple::BuddyList::Node node - Purple::BuddyList::NodeFlags flags - -Purple::BuddyList::NodeFlags -purple_blist_node_get_flags(node) - Purple::BuddyList::Node node - -Purple::BuddyList::NodeType -purple_blist_node_get_type(node) - Purple::BuddyList::Node node - -Purple::BuddyList::Node -purple_blist_node_next(node, offline) - Purple::BuddyList::Node node - gboolean offline - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Chat PREFIX = purple_chat_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Group -purple_chat_get_group(chat) - Purple::BuddyList::Chat chat - -const char * -purple_chat_get_name(chat) - Purple::BuddyList::Chat chat - -Purple::BuddyList::Chat -purple_chat_new(account, alias, components) - Purple::Account account - const char * alias - SV * components -INIT: - HV * t_HV; - HE * t_HE; - SV * t_SV; - GHashTable * t_GHash; - I32 len; - char *t_key, *t_value; -CODE: - t_HV = (HV *)SvRV(components); - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - - RETVAL = purple_chat_new(account, alias, t_GHash); -OUTPUT: - RETVAL - -MODULE = Purple::BuddyList PACKAGE = Purple::BuddyList::Buddy PREFIX = purple_buddy_ -PROTOTYPES: ENABLE - -Purple::BuddyList::Buddy -purple_buddy_new(account, name, alias) - Purple::Account account - const char *name - const char *alias - -const char * -purple_buddy_get_server_alias(buddy) - Purple::BuddyList::Buddy buddy - -void -purple_buddy_set_icon(buddy, icon) - Purple::BuddyList::Buddy buddy - Purple::Buddy::Icon icon - -Purple::Account -purple_buddy_get_account(buddy) - Purple::BuddyList::Buddy buddy - -Purple::BuddyList::Group -purple_buddy_get_group(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_name(buddy) - Purple::BuddyList::Buddy buddy - -Purple::Buddy::Icon -purple_buddy_get_icon(buddy) - Purple::BuddyList::Buddy buddy - -Purple::BuddyList::Contact -purple_buddy_get_contact(buddy) - Purple::BuddyList::Buddy buddy - -Purple::Presence -purple_buddy_get_presence(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_alias_only(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_contact_alias(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_local_alias(buddy) - Purple::BuddyList::Buddy buddy - -const char * -purple_buddy_get_alias(buddy) - Purple::BuddyList::Buddy buddy diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Certificate.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Certificate.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Certificate.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Certificate.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ -#include "module.h" - -struct cb_data { - SV *cb; - SV *user_data; -}; - -static void cb_cert_verify(PurpleCertificateVerificationStatus st, struct cb_data *d) { - dSP; - - ENTER; - SAVETMPS; - - PUSHMARK(SP); - - XPUSHs(sv_2mortal(newSViv(st))); - XPUSHs(d->user_data); - - PUTBACK; - - call_sv(d->cb, G_VOID | G_EVAL); - - if(SvTRUE(ERRSV)) { - STRLEN l_a; - purple_debug_warning("perl", "Failed to run 'certificate verify' callback: %s\n", SvPV(ERRSV, l_a)); - } - - FREETMPS; - LEAVE; - - SvREFCNT_dec(d->cb); - SvREFCNT_dec(d->user_data); - - g_free(d); -} - -MODULE = Purple::Certificate PACKAGE = Purple::Certificate PREFIX = purple_certificate_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Certificate", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CERTIFICATE_##name} - const_iv(INVALID), - const_iv(VALID), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_certificate_add_ca_search_path(path) - const char* path - -gboolean -purple_certificate_check_subject_name(crt, name) - Purple::Certificate crt - const gchar* name - -Purple::Certificate -purple_certificate_copy(crt) - Purple::Certificate crt - -void -purple_certificate_destroy(crt) - Purple::Certificate crt - -void -purple_certificate_display_x509(crt) - Purple::Certificate crt - -## changed order of arguments, so that $cert->export($file) could be used -gboolean -purple_certificate_export(crt, filename) - const gchar* filename - Purple::Certificate crt - C_ARGS: - filename, crt - -Purple::Certificate::Pool -purple_certificate_find_pool(scheme_name, pool_name) - const gchar* scheme_name - const gchar* pool_name - -Purple::Certificate::Scheme -purple_certificate_find_scheme(name) - const gchar* name - -Purple::Certificate::Verifier -purple_certificate_find_verifier(scheme_name, ver_name) - const gchar* scheme_name - const gchar* ver_name - -Purple::Handle -purple_certificate_get_handle() - -gchar_own* -purple_certificate_get_issuer_unique_id(crt) - Purple::Certificate crt - -gchar_own* -purple_certificate_get_subject_name(crt) - Purple::Certificate crt - -gchar_own* -purple_certificate_get_unique_id(crt) - Purple::Certificate crt - -Purple::Certificate -purple_certificate_import(scheme, filename) - Purple::Certificate::Scheme scheme - const gchar* filename - -gboolean -purple_certificate_register_pool(pool) - Purple::Certificate::Pool pool - -gboolean -purple_certificate_register_scheme(scheme) - Purple::Certificate::Scheme scheme - -gboolean -purple_certificate_register_verifier(vr) - Purple::Certificate::Verifier vr - -gboolean -purple_certificate_signed_by(crt, issuer) - Purple::Certificate crt - Purple::Certificate issuer - -gboolean -purple_certificate_unregister_pool(pool) - Purple::Certificate::Pool pool - -gboolean -purple_certificate_unregister_scheme(scheme) - Purple::Certificate::Scheme scheme - -gboolean -purple_certificate_unregister_verifier(vr) - Purple::Certificate::Verifier vr - -void -purple_certificate_verify_complete(vrq, st) - Purple::Certificate::VerificationRequest vrq - Purple::Certificate::VerificationStatus st - -gboolean -purple_certificate_get_times(crt, OUTLIST time_t activation, OUTLIST time_t expiration) - Purple::Certificate crt - PROTOTYPE: $ - -void -purple_certificate_destroy_list(...) - PREINIT: - GList* l = NULL; - int i = 0; - CODE: - for(i = 0; i < items; i++) { /* PurpleCertificate */ - l = g_list_prepend(l, purple_perl_ref_object(ST(i))); - } - purple_certificate_destroy_list(l); - -void -purple_certificate_get_pools() - PREINIT: - GList *l; - PPCODE: - for(l = purple_certificate_get_pools(); l; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Pool"))); - } - -void -purple_certificate_get_schemes() - PREINIT: - GList *l; - PPCODE: - for(l = purple_certificate_get_schemes(); l; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Scheme"))); - } - -void -purple_certificate_get_verifiers() - PREINIT: - GList *l; - PPCODE: - for(l = purple_certificate_get_verifiers(); l; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Certificate::Verifier"))); - } - -void -purple_certificate_check_signature_chain(...) - PREINIT: - GList *l = NULL; - gboolean ret; - int i; - PPCODE: - for(i = 0; i < items; i++) { /* PurpleCertificate */ - l = g_list_prepend(l, purple_perl_ref_object(ST(i))); - } - l = g_list_reverse(l); - ret = purple_certificate_check_signature_chain(l); - g_list_free(l); - if(ret) XSRETURN_YES; - XSRETURN_NO; - -SV* -purple_certificate_get_fingerprint_sha1(crt) - Purple::Certificate crt - PREINIT: - GByteArray *gba = NULL; - CODE: - gba = purple_certificate_get_fingerprint_sha1(crt); - RETVAL = newSVpv((gchar *)gba->data, gba->len); - g_byte_array_free(gba, TRUE); - OUTPUT: - RETVAL - -void -purple_certificate_verify(verifier, subject_name, cert_chain, cb, cb_data) - Purple::Certificate::Verifier verifier - const gchar* subject_name - AV* cert_chain - CV *cb - SV *cb_data - PREINIT: - GList *l = NULL; - int len = 0, i = 0; - struct cb_data *d = NULL; - PPCODE: - len = av_len(cert_chain); - for(i = 0; i <= len; i++) { - SV **sv = av_fetch(cert_chain, i, 0); - if(!sv || !purple_perl_is_ref_object(*sv)) { - g_list_free(l); - warn("Purple::Certificate::verify: cert_chain: non-purple object in array..."); - XSRETURN_UNDEF; - } - l = g_list_prepend(l, purple_perl_ref_object(*sv)); - } - l = g_list_reverse(l); - - d = g_new0(struct cb_data, 1); - d->cb = newSVsv(ST(3)); - d->user_data = newSVsv(cb_data); - - purple_certificate_verify(verifier, subject_name, l, (PurpleCertificateVerifiedCallback) cb_cert_verify, d); - - g_list_free(l); - -MODULE = Purple::Certificate PACKAGE = Purple::Certificate::Pool PREFIX = purple_certificate_pool_ -PROTOTYPES: ENABLE - -void -purple_certificate_pool_get_idlist(pool) - Purple::Certificate::Pool pool - PREINIT: - GList *l, *b; - PPCODE: - b = purple_certificate_pool_get_idlist(pool); - for(l = b; l; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - purple_certificate_pool_destroy_idlist(b); - -gboolean -purple_certificate_pool_contains(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -gboolean -purple_certificate_pool_delete(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -Purple::Certificate::Scheme -purple_certificate_pool_get_scheme(pool) - Purple::Certificate::Pool pool - -gchar_own* -purple_certificate_pool_mkpath(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -Purple::Certificate -purple_certificate_pool_retrieve(pool, id) - Purple::Certificate::Pool pool - const gchar* id - -gboolean -purple_certificate_pool_store(pool, id, crt) - Purple::Certificate::Pool pool - const gchar* id - Purple::Certificate crt - -gboolean -purple_certificate_pool_usable(pool) - Purple::Certificate::Pool pool - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cipher.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cipher.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cipher.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cipher.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,308 +0,0 @@ -#include "module.h" - -MODULE = Purple::Cipher PACKAGE = Purple::Cipher PREFIX = purple_cipher_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Cipher::BatchMode", 1); - HV *cipher_caps = gv_stashpv("Purple::Cipher::Caps", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CIPHER_BATCH_MODE_##name} - const_iv(ECB), - const_iv(CBC), -#undef const_iv - }; - - static const constiv bm_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CIPHER_CAPS_##name} - const_iv(SET_OPT), - const_iv(GET_OPT), - const_iv(INIT), - const_iv(RESET), - const_iv(UNINIT), - const_iv(SET_IV), - const_iv(APPEND), - const_iv(DIGEST), - const_iv(ENCRYPT), - const_iv(DECRYPT), - const_iv(SET_SALT), - const_iv(GET_SALT_SIZE), - const_iv(SET_KEY), - const_iv(GET_KEY_SIZE), - const_iv(SET_BATCH_MODE), - const_iv(GET_BATCH_MODE), - const_iv(GET_BLOCK_SIZE), - const_iv(SET_KEY_WITH_LEN), - const_iv(UNKNOWN), -#undef const_iv - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = bm_const_iv + sizeof(bm_const_iv) / sizeof(bm_const_iv[0]); civ-- > bm_const_iv; ) - newCONSTSUB(cipher_caps, (char *)civ->name, newSViv(civ->iv)); -} - -const gchar * -purple_cipher_get_name(cipher) - Purple::Cipher cipher - -guint -purple_cipher_get_capabilities(cipher) - Purple::Cipher cipher - -size_t -purple_cipher_digest_region(name, data_sv, in_len, digest) - const gchar *name - SV *data_sv - size_t in_len - SV *digest - PREINIT: - gboolean ret; - guchar *buff = NULL; - guchar *data = NULL; - size_t data_len; - CODE: - data = (guchar *)SvPV(data_sv, data_len); - SvUPGRADE(digest, SVt_PV); - buff = (guchar *)SvGROW(digest, in_len); - ret = purple_cipher_digest_region(name, data, data_len, in_len, buff, &RETVAL); - if(!ret) { - SvSetSV_nosteal(digest, &PL_sv_undef); - XSRETURN_UNDEF; - } - SvCUR_set(digest, RETVAL); - SvPOK_only(digest); - OUTPUT: - RETVAL - -gchar_own* -purple_cipher_http_digest_calculate_response(algorithm, method, digest_uri, qop, entity, nonce, nonce_count, client_nonce, session_key) - const gchar* algorithm - const gchar* method - const gchar* digest_uri - const gchar* qop - const gchar* entity - const gchar* nonce - const gchar* nonce_count - const gchar* client_nonce - const gchar* session_key - -gchar_own* -purple_cipher_http_digest_calculate_session_key(algorithm, username, realm, password, nonce, client_nonce) - const gchar* algorithm - const gchar* username - const gchar* realm - const gchar* password - const gchar* nonce - const gchar* client_nonce - -MODULE = Purple::Cipher PACKAGE = Purple::Ciphers PREFIX = purple_ciphers_ -PROTOTYPES: ENABLE - -Purple::Cipher -purple_ciphers_find_cipher(name) - gchar * name - -Purple::Cipher -purple_ciphers_register_cipher(name, ops) - gchar * name - Purple::Cipher::Ops ops - -gboolean -purple_ciphers_unregister_cipher(cipher) - Purple::Cipher cipher - -void -purple_ciphers_get_ciphers() -PREINIT: - GList *l; -PPCODE: - for (l = purple_ciphers_get_ciphers(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Cipher"))); - } - -Purple::Handle -purple_ciphers_get_handle() - -MODULE = Purple::Cipher PACKAGE = Purple::Cipher::Context PREFIX = purple_cipher_context_ -PROTOTYPES: ENABLE - -void -purple_cipher_context_set_option(context, name, value) - Purple::Cipher::Context context - gchar *name - gpointer value - -gpointer -purple_cipher_context_get_option(context, name) - Purple::Cipher::Context context - gchar *name - -Purple::Cipher::Context -purple_cipher_context_new(klass, cipher, extra = NULL) - Purple::Cipher cipher - void *extra - C_ARGS: cipher, extra - -Purple::Cipher::Context -purple_cipher_context_new_by_name(klass, name, extra = NULL) - gchar *name - void *extra - C_ARGS: name, extra - -void -purple_cipher_context_reset(context, extra = NULL) - Purple::Cipher::Context context - gpointer extra - -void -purple_cipher_context_destroy(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_iv(Purple::Cipher::Context context, guchar *iv, size_t length(iv)) - PROTOTYPE: $$ - -void -purple_cipher_context_append(Purple::Cipher::Context context, guchar *data, size_t length(data)) - PROTOTYPE: $$ - -size_t -purple_cipher_context_digest(context, in_len, digest) - Purple::Cipher::Context context - size_t in_len - SV *digest - PREINIT: - gboolean ret; - guchar *buff = NULL; - CODE: - SvUPGRADE(digest, SVt_PV); - buff = (guchar *)SvGROW(digest, in_len); - ret = purple_cipher_context_digest(context, in_len, buff, &RETVAL); - if(!ret) { - SvSetSV_nosteal(digest, &PL_sv_undef); - XSRETURN_UNDEF; - } - SvCUR_set(digest, RETVAL); - SvPOK_only(digest); - OUTPUT: - RETVAL - -size_t -purple_cipher_context_digest_to_str(context, in_len, digest_s) - Purple::Cipher::Context context - size_t in_len - SV *digest_s - PREINIT: - gboolean ret; - gchar *buff = NULL; - CODE: - in_len += 1; /* perl shouldn't need to care about '\0' at the end */ - SvUPGRADE(digest_s, SVt_PV); - buff = SvGROW(digest_s, in_len); - ret = purple_cipher_context_digest_to_str(context, in_len, buff, &RETVAL); - if(!ret) { - SvSetSV_nosteal(digest_s, &PL_sv_undef); - XSRETURN_UNDEF; - } - SvCUR_set(digest_s, RETVAL); - SvPOK_only(digest_s); - OUTPUT: - RETVAL - -gint -purple_cipher_context_encrypt(context, data_sv, output, OUTLIST size_t outlen) - Purple::Cipher::Context context - SV *data_sv - SV *output - PROTOTYPE: $$$ - PREINIT: - size_t datalen; - guchar *buff = NULL; - guchar *data = NULL; - CODE: - data = (guchar *)SvPV(data_sv, datalen); - SvUPGRADE(output, SVt_PV); - buff = (guchar *)SvGROW(output, datalen); - RETVAL = purple_cipher_context_encrypt(context, data, datalen, buff, &outlen); - if(outlen != 0) { - SvPOK_only(output); - SvCUR_set(output, outlen); - } else { - SvSetSV_nosteal(output, &PL_sv_undef); - } - OUTPUT: - RETVAL - -gint -purple_cipher_context_decrypt(context, data_sv, output, OUTLIST size_t outlen) - Purple::Cipher::Context context - SV *data_sv - SV *output - PROTOTYPE: $$$ - PREINIT: - size_t datalen; - guchar *buff = NULL; - guchar *data = NULL; - CODE: - data = (guchar *)SvPV(data_sv, datalen); - SvUPGRADE(output, SVt_PV); - buff = (guchar *)SvGROW(output, datalen); - RETVAL = purple_cipher_context_decrypt(context, data, datalen, buff, &outlen); - if(outlen != 0) { - SvPOK_only(output); - SvCUR_set(output, outlen); - } else { - SvSetSV_nosteal(output, &PL_sv_undef); - } - OUTPUT: - RETVAL - -void -purple_cipher_context_set_salt(context, salt) - Purple::Cipher::Context context - guchar *salt - -size_t -purple_cipher_context_get_salt_size(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_key(context, key) - Purple::Cipher::Context context - guchar *key - -size_t -purple_cipher_context_get_key_size(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_data(context, data) - Purple::Cipher::Context context - gpointer data - -gpointer -purple_cipher_context_get_data(context) - Purple::Cipher::Context context - -Purple::Cipher::BatchMode -purple_cipher_context_get_batch_mode(context) - Purple::Cipher::Context context - -size_t -purple_cipher_context_get_block_size(context) - Purple::Cipher::Context context - -void -purple_cipher_context_set_batch_mode(context, mode) - Purple::Cipher::Context context - Purple::Cipher::BatchMode mode - -void -purple_cipher_context_set_key_with_len(Purple::Cipher::Context context, guchar *key, size_t length(key)) - PROTOTYPE: $$ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cmds.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cmds.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cmds.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Cmds.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::Cmd PACKAGE = Purple::Cmd PREFIX = purple_cmd_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *status_stash = gv_stashpv("Purple::Cmd::Status", 1); - HV *ret_stash = gv_stashpv("Purple::Cmd::Return", 1); - HV *p_stash = gv_stashpv("Purple::Cmd::Priority", 1); - HV *flag_stash = gv_stashpv("Purple::Cmd::Flag", 1); - - static const constiv *civ, status_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CMD_STATUS_##name} - const_iv(OK), - const_iv(FAILED), - const_iv(NOT_FOUND), - const_iv(WRONG_ARGS), - const_iv(WRONG_PRPL), - const_iv(WRONG_TYPE), - }; - static const constiv ret_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CMD_RET_##name} - const_iv(OK), - const_iv(FAILED), - const_iv(CONTINUE), - }; - static const constiv p_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CMD_P_##name} - const_iv(VERY_LOW), - const_iv(LOW), - const_iv(DEFAULT), - const_iv(PRPL), - const_iv(PLUGIN), - const_iv(ALIAS), - const_iv(HIGH), - const_iv(VERY_HIGH), - }; - static const constiv flag_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CMD_FLAG_##name} - const_iv(IM), - const_iv(CHAT), - const_iv(PRPL_ONLY), - const_iv(ALLOW_WRONG_ARGS), - }; - - for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_const_iv;) - newCONSTSUB(status_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = ret_const_iv + sizeof(ret_const_iv) / sizeof(ret_const_iv[0]); civ-- > ret_const_iv;) - newCONSTSUB(ret_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = p_const_iv + sizeof(p_const_iv) / sizeof(p_const_iv[0]); civ-- > p_const_iv;) - newCONSTSUB(p_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = flag_const_iv + sizeof(flag_const_iv) / sizeof(flag_const_iv[0]); civ-- > flag_const_iv;) - newCONSTSUB(flag_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_cmd_help(conv, command) - Purple::Conversation conv - const gchar *command -PREINIT: - GList *l, *ll; -PPCODE: - for (l = ll = purple_cmd_help(conv, command); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - g_list_free(ll); - -void -purple_cmd_list(conv) - Purple::Conversation conv -PREINIT: - GList *l, *ll; -PPCODE: - for (l = ll = purple_cmd_list(conv); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - g_list_free(ll); - -Purple::Cmd::Id -purple_cmd_register(plugin, command, args, priority, flag, prpl_id, func, helpstr, data = 0) - Purple::Plugin plugin - const gchar *command - const gchar *args - Purple::Cmd::Priority priority - Purple::Cmd::Flag flag - const gchar *prpl_id - SV *func - const gchar *helpstr - SV *data -CODE: - RETVAL = purple_perl_cmd_register(plugin, command, args, priority, flag, - prpl_id, func, helpstr, data); -OUTPUT: - RETVAL - -void -purple_cmd_unregister(id) - Purple::Cmd::Id id -CODE: - purple_perl_cmd_unregister(id); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Connection.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Connection.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Connection.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Connection.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -#include "module.h" - -MODULE = Purple::Connection PACKAGE = Purple::Connection PREFIX = purple_connection_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Connection::State", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_##name} - const_iv(DISCONNECTED), - const_iv(CONNECTED), - const_iv(CONNECTING), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Account -purple_connection_get_account(gc) - Purple::Connection gc - -const char * -purple_connection_get_password(gc) - Purple::Connection gc - -const char * -purple_connection_get_display_name(gc) - Purple::Connection gc - -void -purple_connection_notice(gc, text) - Purple::Connection gc - const char *text - -void -purple_connection_error(gc, reason) - Purple::Connection gc - const char *reason - -void -purple_connection_destroy(gc) - Purple::Connection gc - -void -purple_connection_set_state(gc, state) - Purple::Connection gc - Purple::ConnectionState state - -void -purple_connection_set_account(gc, account) - Purple::Connection gc - Purple::Account account - -void -purple_connection_set_display_name(gc, name) - Purple::Connection gc - const char *name - -Purple::ConnectionState -purple_connection_get_state(gc) - Purple::Connection gc - -MODULE = Purple::Connection PACKAGE = Purple::Connections PREFIX = purple_connections_ -PROTOTYPES: ENABLE - -void -purple_connections_disconnect_all() - -void -purple_connections_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_connections_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Connection"))); - } - -void -purple_connections_get_connecting() -PREINIT: - GList *l; -PPCODE: - for (l = purple_connections_get_connecting(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Connection"))); - } - -Purple::Handle -purple_connections_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Conversation.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Conversation.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Conversation.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Conversation.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,493 +0,0 @@ -#include "module.h" - -MODULE = Purple::Conversation PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Conversation::Type", 1); - HV *update_stash = gv_stashpv("Purple::Conversation::Update::Type", 1); - HV *typing_stash = gv_stashpv("Purple::Conversation::TypingState", 1); - HV *flags_stash = gv_stashpv("Purple::Conversation::Flags", 1); - HV *cbflags_stash = gv_stashpv("Purple::Conversation::ChatBuddy::Flags", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_CONV_TYPE_##name} - const_iv(UNKNOWN), - const_iv(IM), - const_iv(CHAT), - const_iv(MISC), - const_iv(ANY), - }; - static const constiv update_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CONV_UPDATE_##name} - const_iv(ADD), - const_iv(REMOVE), - const_iv(ACCOUNT), - const_iv(TYPING), - const_iv(UNSEEN), - const_iv(LOGGING), - const_iv(TOPIC), -/* - const_iv(ONLINE), - const_iv(OFFLINE), -*/ - const_iv(AWAY), - const_iv(ICON), - const_iv(TITLE), - const_iv(CHATLEFT), - const_iv(FEATURES), - }; - static const constiv typing_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_##name} - const_iv(NOT_TYPING), - const_iv(TYPING), - const_iv(TYPED), - }; - static const constiv flags_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_MESSAGE_##name} - const_iv(SEND), - const_iv(RECV), - const_iv(SYSTEM), - const_iv(AUTO_RESP), - const_iv(ACTIVE_ONLY), - const_iv(NICK), - const_iv(NO_LOG), - const_iv(WHISPER), - const_iv(ERROR), - const_iv(DELAYED), - const_iv(RAW), - const_iv(IMAGES), - const_iv(NOTIFY), - const_iv(NO_LINKIFY), - }; - static const constiv cbflags_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_CBFLAGS_##name} - const_iv(NONE), - const_iv(VOICE), - const_iv(HALFOP), - const_iv(OP), - const_iv(FOUNDER), - const_iv(TYPING), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = update_const_iv + sizeof(update_const_iv) / sizeof(update_const_iv[0]); civ-- > update_const_iv; ) - newCONSTSUB(update_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = typing_const_iv + sizeof(typing_const_iv) / sizeof(typing_const_iv[0]); civ-- > typing_const_iv; ) - newCONSTSUB(typing_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; ) - newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = cbflags_const_iv + sizeof(cbflags_const_iv) / sizeof(cbflags_const_iv[0]); civ-- > cbflags_const_iv; ) - newCONSTSUB(cbflags_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_get_ims() -PREINIT: - GList *l; -PPCODE: - for (l = purple_get_ims(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); - } - -void -purple_get_conversations() -PREINIT: - GList *l; -PPCODE: - for (l = purple_get_conversations(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); - } - -void -purple_get_chats() -PREINIT: - GList *l; -PPCODE: - for (l = purple_get_chats(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Conversation"))); - } - -MODULE = Purple::Conversation PACKAGE = Purple::Conversations PREFIX = purple_conversations_ -PROTOTYPES: ENABLE - -Purple::Handle -purple_conversations_get_handle() - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation PREFIX = purple_conversation_ -PROTOTYPES: ENABLE - -void -purple_conversation_destroy(conv) - Purple::Conversation conv - -Purple::ConversationType -purple_conversation_get_type(conv) - Purple::Conversation conv - -Purple::Account -purple_conversation_get_account(conv) - Purple::Conversation conv - -Purple::Connection -purple_conversation_get_gc(conv) - Purple::Conversation conv - -void -purple_conversation_set_title(conv, title); - Purple::Conversation conv - const char * title - -const char * -purple_conversation_get_title(conv) - Purple::Conversation conv - -void -purple_conversation_autoset_title(conv) - Purple::Conversation conv - -void -purple_conversation_set_name(conv, name) - Purple::Conversation conv - const char *name - -const char * -purple_conversation_get_name(conv) - Purple::Conversation conv - -void -purple_conversation_set_logging(conv, log) - Purple::Conversation conv - gboolean log - -gboolean -purple_conversation_is_logging(conv) - Purple::Conversation conv - -Purple::Conversation::IM -purple_conversation_get_im_data(conv) - Purple::Conversation conv - -Purple::Conversation::Chat -purple_conversation_get_chat_data(conv) - Purple::Conversation conv - -gpointer -purple_conversation_get_data(conv, key) - Purple::Conversation conv - const char * key - -Purple::ConnectionFlags -purple_conversation_get_features(conv) - Purple::Conversation conv - -gboolean -purple_conversation_has_focus(conv) - Purple::Conversation conv - -void -purple_conversation_update(conv, type) - Purple::Conversation conv - Purple::ConvUpdateType type - -Purple::Conversation -purple_conversation_new(class, type, account, name) - Purple::ConversationType type - Purple::Account account - const char *name - C_ARGS: - type, account, name - -void -purple_conversation_set_account(conv, account); - Purple::Conversation conv - Purple::Account account - -void -purple_conversation_write(conv, who, message, flags, mtime) - Purple::Conversation conv - const char *who - const char *message - Purple::MessageFlags flags - time_t mtime - -gboolean -purple_conversation_do_command(conv, cmdline, markup, error) - Purple::Conversation conv - const char *cmdline - const char *markup - char **error - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation::IM PREFIX = purple_conv_im_ -PROTOTYPES: ENABLE - -Purple::Conversation -purple_conv_im_get_conversation(im) - Purple::Conversation::IM im - -void -purple_conv_im_set_icon(im, icon) - Purple::Conversation::IM im - Purple::Buddy::Icon icon - -Purple::Buddy::Icon -purple_conv_im_get_icon(im) - Purple::Conversation::IM im - -void -purple_conv_im_set_typing_state(im, state) - Purple::Conversation::IM im - Purple::TypingState state - -Purple::TypingState -purple_conv_im_get_typing_state(im) - Purple::Conversation::IM im - -void -purple_conv_im_start_typing_timeout(im, timeout) - Purple::Conversation::IM im - int timeout - -void -purple_conv_im_stop_typing_timeout(im) - Purple::Conversation::IM im - -guint -purple_conv_im_get_typing_timeout(im) - Purple::Conversation::IM im - -void -purple_conv_im_set_type_again(im, val) - Purple::Conversation::IM im - time_t val - -time_t -purple_conv_im_get_type_again(im) - Purple::Conversation::IM im - -void -purple_conv_im_start_send_typed_timeout(im) - Purple::Conversation::IM im - -void -purple_conv_im_stop_send_typed_timeout(im) - Purple::Conversation::IM im - -guint -purple_conv_im_get_send_typed_timeout(im) - Purple::Conversation::IM im - -void -purple_conv_im_update_typing(im) - Purple::Conversation::IM im - -void -purple_conv_im_send(im, message) - Purple::Conversation::IM im - const char *message - -void -purple_conv_im_write(im, who, message, flags, mtime) - Purple::Conversation::IM im - const char *who - const char *message - Purple::MessageFlags flags - time_t mtime - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation PREFIX = purple_conv_ -PROTOTYPES: ENABLE - -gboolean -purple_conv_present_error(who, account, what) - const char *who - Purple::Account account - const char *what - -void -purple_conv_custom_smiley_close(conv, smile) - Purple::Conversation conv - const char *smile - -MODULE = Purple::Conversation PACKAGE = Purple::Conversation::Chat PREFIX = purple_conv_chat_ -PROTOTYPES: ENABLE - -Purple::Conversation -purple_conv_chat_get_conversation(chat) - Purple::Conversation::Chat chat - -void -purple_conv_chat_set_users(chat, users) - Purple::Conversation::Chat chat - SV * users -PREINIT: - GList *l, *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(users)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); - - for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -void -purple_conv_chat_get_users(chat) - Purple::Conversation::Chat chat -PREINIT: - GList *l; -PPCODE: - for (l = purple_conv_chat_get_users(chat); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -void -purple_conv_chat_ignore(chat, name) - Purple::Conversation::Chat chat - const char *name - -void -purple_conv_chat_unignore(chat, name) - Purple::Conversation::Chat chat - const char *name - -void -purple_conv_chat_set_ignored(chat, ignored) - Purple::Conversation::Chat chat - SV * ignored -PREINIT: - GList *l, *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(ignored)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0))); - - for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -void -purple_conv_chat_get_ignored(chat) - Purple::Conversation::Chat chat -PREINIT: - GList *l; -PPCODE: - for (l = purple_conv_chat_get_ignored(chat); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry"))); - } - -const char * -purple_conv_chat_get_topic(chat) - Purple::Conversation::Chat chat - -void -purple_conv_chat_set_id(chat, id) - Purple::Conversation::Chat chat - int id - -int -purple_conv_chat_get_id(chat) - Purple::Conversation::Chat chat - -void -purple_conv_chat_send(chat, message) - Purple::Conversation::Chat chat - const char * message - -void -purple_conv_chat_write(chat, who, message, flags, mtime) - Purple::Conversation::Chat chat - const char *who - const char *message - Purple::MessageFlags flags - time_t mtime - -void -purple_conv_chat_add_users(chat, users, extra_msgs, flags, new_arrivals) - Purple::Conversation::Chat chat - SV * users - SV * extra_msgs - SV * flags - gboolean new_arrivals -PREINIT: - GList *t_GL_users, *t_GL_extra_msgs, *t_GL_flags; - int i, t_len; -PPCODE: - t_GL_users = NULL; - t_len = av_len((AV *)SvRV(users)); - - for (i = 0; i <= t_len; i++) - t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); - - t_GL_flags = NULL; - t_len = av_len((AV *)SvRV(flags)); - - for (i = 0; i <= t_len; i++) - t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0))); - - t_GL_extra_msgs = NULL; - t_len = av_len((AV *)SvRV(extra_msgs)); - - for (i = 0; i <= t_len; i++) - t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0))); - - purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals); - - g_list_free(t_GL_users); - g_list_free(t_GL_extra_msgs); - g_list_free(t_GL_flags); - -gboolean -purple_conv_chat_find_user(chat, user) - Purple::Conversation::Chat chat - const char * user - -void purple_conv_chat_clear_users(chat) - Purple::Conversation::Chat chat - -void purple_conv_chat_set_nick(chat, nick) - Purple::Conversation::Chat chat - const char * nick - -const char * -purple_conv_chat_get_nick(chat) - Purple::Conversation::Chat chat - -Purple::Conversation -purple_find_chat(gc, id) - Purple::Connection gc - int id - -void purple_conv_chat_left(chat) - Purple::Conversation::Chat chat - -gboolean purple_conv_chat_has_left(chat) - Purple::Conversation::Chat chat - -Purple::Conversation::ChatBuddy -purple_conv_chat_cb_find(chat, name) - Purple::Conversation::Chat chat - const char *name - -const char * -purple_conv_chat_cb_get_name(cb) - Purple::Conversation::ChatBuddy cb - -void -purple_conv_chat_cb_destroy(cb); - Purple::Conversation::ChatBuddy cb diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Core.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Core.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Core.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Core.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -#include "module.h" - -MODULE = Purple::Core PACKAGE = Purple::Core PREFIX = purple_core_ -PROTOTYPES: ENABLE - -gboolean -purple_core_quit_cb() -PPCODE: - /* The argument to purple_core_quit_cb is not used, - * so there's little point in requiring it on the - * Perl side. */ - RETVAL = purple_core_quit_cb(NULL); - ST(0) = boolSV(RETVAL); - sv_2mortal(ST(0)); - -const char * -purple_core_get_version() - -const char * -purple_core_get_ui() - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Debug.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Debug.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Debug.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Debug.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -#include "module.h" - -MODULE = Purple::Debug PACKAGE = Purple::Debug PREFIX = purple_debug_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Debug", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_DEBUG_##name} - const_iv(ALL), - const_iv(MISC), - const_iv(INFO), - const_iv(WARNING), - const_iv(ERROR), - const_iv(FATAL), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_debug(level, category, string) - Purple::DebugLevel level - const char *category - const char *string -CODE: - purple_debug(level, category, "%s", string); - -void -purple_debug_misc(category, string) - const char *category - const char *string -CODE: - purple_debug_misc(category, "%s", string); - -void -purple_debug_info(category, string) - const char *category - const char *string -CODE: - purple_debug_info(category, "%s", string); - -void -purple_debug_warning(category, string) - const char *category - const char *string -CODE: - purple_debug_warning(category, "%s", string); - -void -purple_debug_error(category, string) - const char *category - const char *string -CODE: - purple_debug_error(category, "%s", string); - -void -purple_debug_fatal(category, string) - const char *category - const char *string -CODE: - purple_debug_fatal(category, "%s", string); - -void -purple_debug_set_enabled(enabled) - gboolean enabled - -gboolean -purple_debug_is_enabled() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/FT.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/FT.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/FT.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/FT.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -#include "module.h" - -MODULE = Purple::Xfer PACKAGE = Purple::Xfer PREFIX = purple_xfer_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Xfer::Type", 1); - HV *status_stash = gv_stashpv("Purple::Xfer::Status", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_XFER_##name} - const_iv(UNKNOWN), - const_iv(SEND), - const_iv(RECEIVE), - }; - static const constiv status_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_XFER_STATUS_##name} - const_iv(UNKNOWN), - const_iv(NOT_STARTED), - const_iv(ACCEPTED), - const_iv(STARTED), - const_iv(DONE), - const_iv(CANCEL_LOCAL), - const_iv(CANCEL_REMOTE), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = status_const_iv + sizeof(status_const_iv) / sizeof(status_const_iv[0]); civ-- > status_const_iv; ) - newCONSTSUB(status_stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Xfer -purple_xfer_new(class, account, type, who) - Purple::Account account - Purple::XferType type - const char *who - C_ARGS: - account, type, who - -void -purple_xfer_add(xfer) - Purple::Xfer xfer - -void -purple_xfer_cancel_local(xfer) - Purple::Xfer xfer - -void -purple_xfer_cancel_remote(xfer) - Purple::Xfer xfer - -void -purple_xfer_end(xfer) - Purple::Xfer xfer - -void -purple_xfer_error(type, account, who, msg) - Purple::XferType type - Purple::Account account - const char *who - const char *msg - -Purple::Account -purple_xfer_get_account(xfer) - Purple::Xfer xfer - -size_t -purple_xfer_get_bytes_remaining(xfer) - Purple::Xfer xfer - -size_t -purple_xfer_get_bytes_sent(xfer) - Purple::Xfer xfer - -const char * -purple_xfer_get_filename(xfer) - Purple::Xfer xfer - -const char * -purple_xfer_get_local_filename(xfer) - Purple::Xfer xfer - -unsigned int -purple_xfer_get_local_port(xfer) - Purple::Xfer xfer - -double -purple_xfer_get_progress(xfer) - Purple::Xfer xfer - -const char * -purple_xfer_get_remote_ip(xfer) - Purple::Xfer xfer - -unsigned int -purple_xfer_get_remote_port(xfer) - Purple::Xfer xfer - -size_t -purple_xfer_get_size(xfer) - Purple::Xfer xfer - -Purple::XferStatusType -purple_xfer_get_status(xfer) - Purple::Xfer xfer - -Purple::XferType -purple_xfer_get_type(xfer) - Purple::Xfer xfer - -gboolean -purple_xfer_is_canceled(xfer) - Purple::Xfer xfer - -gboolean -purple_xfer_is_completed(xfer) - Purple::Xfer xfer - -ssize_t -purple_xfer_read(xfer, buffer) - Purple::Xfer xfer - guchar **buffer - -void -purple_xfer_ref(xfer) - Purple::Xfer xfer - -void -purple_xfer_request(xfer) - Purple::Xfer xfer - -void -purple_xfer_request_accepted(xfer, filename) - Purple::Xfer xfer - const char *filename - -void -purple_xfer_request_denied(xfer) - Purple::Xfer xfer - -void -purple_xfer_set_completed(xfer, completed) - Purple::Xfer xfer - gboolean completed - -void -purple_xfer_set_filename(xfer, filename) - Purple::Xfer xfer - const char *filename - -void -purple_xfer_set_local_filename(xfer, filename) - Purple::Xfer xfer - const char *filename - -void -purple_xfer_set_message(xfer, message) - Purple::Xfer xfer - const char *message - -void -purple_xfer_set_size(xfer, size) - Purple::Xfer xfer - size_t size - -void -purple_xfer_unref(xfer) - Purple::Xfer xfer - -void -purple_xfer_update_progress(xfer) - Purple::Xfer xfer - -ssize_t -purple_xfer_write(xfer, buffer, size) - Purple::Xfer xfer - const guchar *buffer - size_t size - -MODULE = Purple::Xfer PACKAGE = Purple::Xfers PREFIX = purple_xfers_ -PROTOTYPES: ENABLE - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Idle.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Idle.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Idle.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Idle.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -#include "module.h" - -MODULE = Purple::Idle PACKAGE = Purple::Idle PREFIX = purple_idle_ -PROTOTYPES: ENABLE - -void -purple_idle_touch() - -void -purple_idle_set(time) - time_t time - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/ImgStore.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/ImgStore.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/ImgStore.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/ImgStore.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -#include "module.h" - -MODULE = Purple::ImgStore PACKAGE = Purple::ImgStore PREFIX = purple_imgstore_ -PROTOTYPES: ENABLE - -Purple::StoredImage -purple_imgstore_add(data, size, filename) - void *data - size_t size - const char *filename - -int -purple_imgstore_add_with_id(data, size, filename) - void *data - size_t size - const char *filename - -Purple::StoredImage -purple_imgstore_find_by_id(id) - int id - -gconstpointer -purple_imgstore_get_data(i) - Purple::StoredImage i - -const char * -purple_imgstore_get_filename(i) - Purple::StoredImage i - -size_t -purple_imgstore_get_size(i) - Purple::StoredImage i - -const char * -purple_imgstore_get_extension(i) - Purple::StoredImage i - -Purple::StoredImage -purple_imgstore_ref(id) - Purple::StoredImage id - -Purple::StoredImage -purple_imgstore_unref(id) - Purple::StoredImage id - -void -purple_imgstore_ref_by_id(id) - int id - -void -purple_imgstore_unref_by_id(id) - int id - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Log.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Log.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Log.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Log.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -#include "module.h" - -MODULE = Purple::Log PACKAGE = Purple::Log PREFIX = purple_log_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Log::Type", 1); - HV *flags_stash = gv_stashpv("Purple::Log::ReadFlags", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_LOG_##name} - const_iv(IM), - const_iv(CHAT), - const_iv(SYSTEM), - }; - static const constiv flags_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_LOG_READ_##name} - const_iv(NO_NEWLINE), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = flags_const_iv + sizeof(flags_const_iv) / sizeof(flags_const_iv[0]); civ-- > flags_const_iv; ) - newCONSTSUB(flags_stash, (char *)civ->name, newSViv(civ->iv)); -} - -int -purple_log_common_sizer(log) - Purple::Log log - -void -purple_log_common_writer(log, ext) - Purple::Log log - const char *ext - -gint -purple_log_compare(y, z) - gconstpointer y - gconstpointer z - -void -purple_log_free(log) - Purple::Log log - -gchar_own * -purple_log_get_log_dir(type, name, account) - Purple::LogType type - const char *name - Purple::Account account - -void -purple_log_get_log_sets() -PREINIT: - GHashTable *l; -PPCODE: - l = purple_log_get_log_sets(); - XPUSHs(sv_2mortal(purple_perl_bless_object(l, "GHashTable"))); - -void -purple_log_get_logs(type, name, account) - Purple::LogType type - const char *name - Purple::Account account -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_log_get_logs(type, name, account); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log"))); - } - /* We can free the list here but the script needs to free the - * Purple::Log 'objects' itself. */ - g_list_free(ll); - -int -purple_log_get_size(log) - Purple::Log log - -void -purple_log_get_system_logs(account) - Purple::Account account -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_log_get_system_logs(account); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log"))); - } - /* We can free the list here but the script needs to free the - * Purple::Log 'objects' itself. */ - g_list_free(ll); - -int -purple_log_get_total_size(type, name, account) - Purple::LogType type - const char *name - Purple::Account account - -void -purple_log_logger_free(logger) - Purple::Log::Logger logger - -void -purple_log_logger_get_options() -PREINIT: - GList *l, *ll; -PPCODE: - /* This might want to be massaged to a hash, since that's essentially - * what the key/value list is emulating. */ - for (l = ll = purple_log_logger_get_options(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - g_list_free(ll); - -gchar_own * -purple_log_read(log, flags) - Purple::Log log - Purple::Log::ReadFlags flags - -gint -purple_log_set_compare(y, z) - gconstpointer y - gconstpointer z diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for Purple perl module. -# - -PIDGIN_TREE_TOP := ../../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -GCCWARNINGS += -Wno-comment -Wno-unused -Wno-nested-externs - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = Purple -AUTOSPLIT = lib/auto/Purple/autosplit.ix -EXTUTILS ?= C:/perl/lib/ExtUtils -PERL_PLUGIN_TOP := .. - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PERL_LIB_TOP)/CORE - -LIB_PATHS += -L$(PERL_LIB_TOP) \ - -L$(PERL_PLUGIN_TOP) \ - -L$(PURPLE_TOP) \ - -L$(GTK_TOP)/lib - -## -## SOURCES, OBJECTS -## -XS_FILES = Account.xs \ - AccountOpts.xs \ - BuddyIcon.xs \ - BuddyList.xs \ - Cipher.xs \ - Cmds.xs \ - Certificate.xs \ - Connection.xs \ - Conversation.xs \ - Core.xs \ - Debug.xs \ - FT.xs \ - Idle.xs \ - Purple.xs \ - ImgStore.xs \ - Log.xs \ - Network.xs \ - Notify.xs \ - Plugin.xs \ - PluginPref.xs \ - Pounce.xs \ - Prefs.xs \ - Privacy.xs \ - Proxy.xs \ - Prpl.xs \ - Request.xs \ - Roomlist.xs \ - SSLConn.xs \ - SavedStatuses.xs \ - Server.xs \ - Signal.xs \ - Smiley.xs \ - Sound.xs \ - Status.xs \ - Stringref.xs \ - Util.xs \ - Whiteboard.xs \ - XMLNode.xs - -#FALLBACKS = const-c.inc const-xs.inc -C_FILES = $(XS_FILES:%.xs=%.c) -OBJECTS = $(C_FILES:%.c=%.o) - -## -## LIBRARIES -## -LIBS = -lperl510 \ - -lperl \ - -lpurple \ - -lglib-2.0 - -include $(PIDGIN_COMMON_RULES) - -%.inc: - cp fallback/$@ ./ - -## -## TARGETS -## -.PHONY: all install clean - -all: $(TARGET).dll $(AUTOSPLIT) - -install: all - rm -rf $(PURPLE_INSTALL_PERL_DIR) - mkdir -p $(PURPLE_INSTALL_PERL_DIR) - cp -R lib/* $(PURPLE_INSTALL_PERL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PERL_DIR)/auto/Purple - -$(C_FILES): $(PURPLE_CONFIG_H) - -$(AUTOSPLIT): - mkdir -p ./lib/auto - cp Purple.pm ./lib - $(PERL) -MAutoSplit -e 'autosplit("lib/Purple.pm")' - -$(TARGET).dll: $(PURPLE_DLL).a $(PURPLE_PERL_DLL).a $(FALLBACKS) $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) -o $(TARGET).dll - -## -## CLEAN -## -clean: - rm -rf $(TARGET).dll $(FALLBACKS) lib - rm -f *.o $(C_FILES) - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.PL.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.PL.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.PL.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Makefile.PL.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -use 5.006; -use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence the contents -# of the Makefile that is written. -WriteMakefile( - 'NAME' => 'Purple', - 'VERSION_FROM' => '@srcdir@/Purple.pm', # finds $VERSION - 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 - (ABSTRACT_FROM => '@srcdir@/Purple.pm', # finds $ABSTRACT - AUTHOR => 'Purple ') : ()), - 'DEFINE' => '@DEBUG_CFLAGS@', - 'INC' => '-I. -I@srcdir@ -I@top_srcdir@ -I@top_srcdir@/libpurple @GLIB_CFLAGS@', - 'OBJECT' => '$(O_FILES)', # link all the C files too -# 'OPTIMIZE' => '-g', # For debugging - 'INSTALLDIRS' => 'vendor', - 'INSTALL_BASE' => '$(prefix)', - 'INSTALLVENDORARCH' => '$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/perl', - 'INSTALLVENDORMAN3DIR' => '$(mandir)/man3', - 'macro' => { - 'prefix' => '@prefix@', - 'exec_prefix' => '@exec_prefix@', - 'libdir' => '@libdir@', - 'mandir' => '@mandir@', - 'datarootdir' => '@datarootdir@', - 'PURPLE_MAJOR_VERSION' => '@PURPLE_MAJOR_VERSION@', - }, -); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/module.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/module.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/module.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/module.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ -/* Allow the Perl code to see deprecated functions, so we can continue to - * export them to Perl plugins. */ -#undef PURPLE_DISABLE_DEPRECATED - -typedef struct group *Purple__Group; - -#define group perl_group - -#include -#ifdef _WIN32 -#undef pipe -#endif -#include -#include -#include - -#undef group - -#include "../perl-common.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "buddyicon.h" -#include "certificate.h" -#include "cipher.h" -#include "cmds.h" -#include "connection.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "desktopitem.h" -#include "eventloop.h" -#include "ft.h" -#ifdef PURPLE_GTKPERL -#include "gtkaccount.h" -#include "gtkblist.h" -#include "gtkconn.h" -#include "gtkconv.h" -#include "gtkutils.h" -#endif -#include "idle.h" -#include "imgstore.h" -#include "network.h" -#include "notify.h" -#include "plugin.h" -#include "pluginpref.h" -#include "pounce.h" -#include "prefs.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "roomlist.h" -#include "savedstatuses.h" -#include "server.h" -#include "signals.h" -#include "smiley.h" -#include "sound.h" -#include "sslconn.h" -#include "status.h" -#include "stringref.h" -/* Ewww. perl has it's own util.h which is in the include path :( */ -#include "libpurple/util.h" -#include "value.h" -#include "whiteboard.h" -#include "xmlnode.h" - -/* account.h */ -typedef PurpleAccount * Purple__Account; -typedef PurpleAccountOption * Purple__Account__Option; -typedef PurpleAccountUserSplit * Purple__Account__UserSplit; - -/* blist.h */ -typedef PurpleBlistNode * Purple__BuddyList__Node; -typedef PurpleBlistNodeFlags Purple__BuddyList__NodeFlags; -typedef PurpleBlistNodeType Purple__BuddyList__NodeType; -typedef PurpleBuddyList * Purple__BuddyList; -typedef PurpleBuddy * Purple__BuddyList__Buddy; -typedef PurpleChat * Purple__BuddyList__Chat; -typedef PurpleContact * Purple__BuddyList__Contact; -typedef PurpleGroup * Purple__BuddyList__Group; - -/* buddyicon.h */ -typedef PurpleBuddyIcon * Purple__Buddy__Icon; - -/* certificate.h */ -typedef PurpleCertificate * Purple__Certificate; -typedef PurpleCertificatePool * Purple__Certificate__Pool; -typedef PurpleCertificateScheme * Purple__Certificate__Scheme; -typedef PurpleCertificateVerifier * Purple__Certificate__Verifier; -typedef PurpleCertificateVerificationRequest * Purple__Certificate__VerificationRequest; -typedef PurpleCertificateVerificationStatus Purple__Certificate__VerificationStatus; - -/* cipher.h */ -typedef PurpleCipher * Purple__Cipher; -typedef PurpleCipherCaps Purple__CipherCaps; -typedef PurpleCipherContext * Purple__Cipher__Context; -typedef PurpleCipherOps * Purple__Cipher__Ops; -typedef PurpleCipherBatchMode Purple__Cipher__BatchMode; - -/* cmds.h */ -typedef PurpleCmdFlag Purple__Cmd__Flag; -typedef PurpleCmdId Purple__Cmd__Id; -typedef PurpleCmdPriority Purple__Cmd__Priority; -typedef PurpleCmdRet Purple__Cmd__Ret; - -/* connection.h */ -typedef PurpleConnection * Purple__Connection; -typedef PurpleConnectionFlags Purple__ConnectionFlags; -typedef PurpleConnectionState Purple__ConnectionState; - -/* conversation.h */ -typedef PurpleConversationType Purple__ConversationType; -typedef PurpleConvUpdateType Purple__ConvUpdateType; -typedef PurpleTypingState Purple__TypingState; -typedef PurpleMessageFlags Purple__MessageFlags; -typedef PurpleConvChatBuddyFlags Purple__ConvChatBuddyFlags; -typedef PurpleConversation * Purple__Conversation; -typedef PurpleConvIm * Purple__Conversation__IM; -typedef PurpleConvChat * Purple__Conversation__Chat; -typedef PurpleConvChatBuddy * Purple__Conversation__ChatBuddy; - -/* core.h */ - -typedef PurpleCore * Purple__Core; - -/* debug.h */ -typedef PurpleDebugLevel Purple__DebugLevel; - -/* desktopitem.h */ -typedef PurpleDesktopItem * Purple__DesktopItem; -typedef PurpleDesktopItemType Purple__DesktopItemType; - -/* eventloop.h */ -typedef PurpleInputCondition * Purple__InputCondition; - -/* ft.h */ -typedef PurpleXfer * Purple__Xfer; -typedef PurpleXferType Purple__XferType; -typedef PurpleXferStatusType Purple__XferStatusType; - - -#ifdef PURPLE_GTKPERL -/* gtkblish.h */ -typedef PurpleGtkBuddyList * Purple__GTK__BuddyList; -typedef PurpleStatusIconSize Purple__StatusIconSize; - -/* gtkutils.h */ -typedef PurpleButtonOrientation Purple__ButtonOrientation; -typedef PurpleButtonStyle Purple__ButtonStyle; -#ifndef _WIN32 -typedef PurpleBrowserPlace Purple__BrowserPlace; -#endif /* _WIN32 */ - -/* gtkconv.h */ -typedef PurpleUnseenState Purple__UnseenState; -typedef PurpleGtkConversation * Purple__GTK__Conversation; -typedef GdkPixbuf * Purple__GDK__Pixbuf; -typedef GtkWidget * Purple__GTK__Widget; - -/* gtkutils.h */ -typedef GtkFileSelection * Purple__GTK__FileSelection; -typedef GtkSelectionData * Purple__GTK__SelectionData; -typedef GtkTextView * Purple__GTK__TextView; - -/* gtkconn.h */ -#endif - -/* imgstore.h */ -typedef PurpleStoredImage * Purple__StoredImage; - -/* log.h */ -typedef PurpleLog * Purple__Log; -typedef PurpleLogCommonLoggerData * Purple__LogCommonLoggerData; -typedef PurpleLogLogger * Purple__Log__Logger; -typedef PurpleLogReadFlags * Purple__Log__ReadFlags; -typedef PurpleLogSet * Purple__LogSet; -typedef PurpleLogType Purple__LogType; - -/* network.h */ -typedef PurpleNetworkListenData * Purple__NetworkListenData; -typedef PurpleNetworkListenCallback Purple__NetworkListenCallback; - -/* notify.h */ -typedef PurpleNotifyCloseCallback Purple__NotifyCloseCallback; -typedef PurpleNotifyMsgType Purple__NotifyMsgType; -typedef PurpleNotifySearchButtonType Purple__NotifySearchButtonType; -typedef PurpleNotifySearchResults * Purple__NotifySearchResults; -typedef PurpleNotifySearchColumn * Purple__NotifySearchColumn; -typedef PurpleNotifySearchButton * Purple__NotifySearchButton; -typedef PurpleNotifyType Purple__NotifyType; -typedef PurpleNotifyUserInfo * Purple__NotifyUserInfo; -typedef PurpleNotifyUserInfoEntry * Purple__NotifyUserInfoEntry; - -/* plugin.h */ -typedef PurplePlugin * Purple__Plugin; -typedef PurplePluginAction * Purple__Plugin__Action; -typedef PurplePluginInfo * Purple__PluginInfo; -typedef PurplePluginLoaderInfo * Purple__PluginLoaderInfo; -typedef PurplePluginType Purple__PluginType; -typedef PurplePluginUiInfo * Purple__PluginUiInfo; - -/* pluginpref.h */ -typedef PurplePluginPref * Purple__PluginPref; -typedef PurplePluginPrefFrame * Purple__PluginPref__Frame; -typedef PurplePluginPrefType Purple__PluginPrefType; -typedef PurpleStringFormatType Purple__String__Format__Type; - -/* pounce.h */ -typedef PurplePounce * Purple__Pounce; -typedef PurplePounceEvent Purple__PounceEvent; - -/* prefs.h */ -typedef PurplePrefType Purple__PrefType; - -/* privacy.h */ -typedef PurplePrivacyType Purple__PrivacyType; - -/* proxy.h */ -typedef PurpleProxyInfo * Purple__ProxyInfo; -typedef PurpleProxyType Purple__ProxyType; - -/* prpl.h */ -typedef PurpleBuddyIconSpec * Purple__Buddy__Icon__Spec; -typedef PurpleIconScaleRules Purple__IconScaleRules; -typedef PurplePluginProtocolInfo * Purple__PluginProtocolInfo; -typedef PurpleProtocolOptions Purple__ProtocolOptions; - -/* request.h */ -typedef PurpleRequestField * Purple__Request__Field; -typedef PurpleRequestFields * Purple__Request__Fields; -typedef PurpleRequestFieldGroup * Purple__Request__Field__Group; -typedef PurpleRequestFieldType Purple__RequestFieldType; -typedef PurpleRequestType Purple__RequestType; - -/* roomlist.h */ -typedef PurpleRoomlist * Purple__Roomlist; -typedef PurpleRoomlistField * Purple__Roomlist__Field; -typedef PurpleRoomlistFieldType Purple__RoomlistFieldType; -typedef PurpleRoomlistRoom * Purple__Roomlist__Room; -typedef PurpleRoomlistRoomType Purple__RoomlistRoomType; - -/* savedstatuses.h */ -typedef PurpleSavedStatus * Purple__SavedStatus; -typedef PurpleSavedStatusSub * Purple__SavedStatus__Sub; - -/* smiley.h */ -typedef PurpleSmiley * Purple__Smiley; - -/* sound.h */ -typedef PurpleSoundEventID Purple__SoundEventID; - -/* sslconn.h */ -typedef PurpleInputCondition * Purple__Input__Condition; -typedef PurpleSslConnection * Purple__Ssl__Connection; -typedef PurpleSslErrorType Purple__SslErrorType; -typedef PurpleSslOps * Purple__Ssl__Ops; - -/* status.h */ -typedef PurplePresence * Purple__Presence; -typedef PurplePresenceContext Purple__PresenceContext; -typedef PurpleStatus * Purple__Status; -typedef PurpleStatusAttr * Purple__StatusAttr; -typedef PurpleStatusPrimitive Purple__StatusPrimitive; -typedef PurpleStatusType * Purple__StatusType; - -/* stringref.h */ -typedef PurpleStringref * Purple__Stringref; - -/* util.h */ -typedef PurpleInfoFieldFormatCallback Purple__Util__InfoFieldFormatCallback; -typedef PurpleUtilFetchUrlData Purple__Util__FetchUrlData; -typedef PurpleMenuAction * Purple__Menu__Action; - -/* value.h */ -typedef PurpleValue * Purple__Value; - -/* whiteboard.h */ -typedef PurpleWhiteboard * Purple__Whiteboard; - -/* xmlnode.h */ -typedef xmlnode * Purple__XMLNode; -typedef XMLNodeType XMLNode__Type; - -/* other */ -typedef void * Purple__Handle; - -typedef gchar gchar_own; - -typedef struct _constiv { - const char *name; - IV iv; -} constiv; - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Network.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Network.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Network.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Network.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#include "module.h" - -MODULE = Purple::Network PACKAGE = Purple::Network PREFIX = purple_network_ -PROTOTYPES: ENABLE - -const char * -purple_network_get_local_system_ip(fd) - int fd - -const char * -purple_network_get_my_ip(fd) - int fd - -unsigned short -purple_network_get_port_from_fd(fd) - int fd - -const char * -purple_network_get_public_ip() - -const unsigned char * -purple_network_ip_atoi(ip) - const char *ip - -Purple::NetworkListenData -purple_network_listen(port, socket_type, cb, cb_data) - unsigned short port - int socket_type - Purple::NetworkListenCallback cb - gpointer cb_data - -Purple::NetworkListenData -purple_network_listen_range(start, end, socket_type, cb, cb_data) - unsigned short start - unsigned short end - int socket_type - Purple::NetworkListenCallback cb - gpointer cb_data - -void -purple_network_set_public_ip(ip) - const char *ip diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Notify.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Notify.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Notify.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Notify.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,174 +0,0 @@ -#include "module.h" - -MODULE = Purple::Notify PACKAGE = Purple::Notify PREFIX = purple_notify_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *type_stash = gv_stashpv("Purple::Notify::Type", 1); - HV *msg_type_stash = gv_stashpv("Purple::Notify::Msg", 1); - HV *user_info_stash = gv_stashpv("Purple::NotifyUserInfo::Type", 1); - - static const constiv *civ, type_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_##name} - const_iv(MESSAGE), - const_iv(EMAIL), - const_iv(EMAILS), - const_iv(FORMATTED), - const_iv(SEARCHRESULTS), - const_iv(USERINFO), - const_iv(URI), - }; - static const constiv msg_type_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_MSG_##name} - const_iv(ERROR), - const_iv(WARNING), - const_iv(INFO), - }; - static const constiv user_info_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_NOTIFY_USER_INFO_ENTRY_##name} - const_iv(PAIR), - const_iv(SECTION_BREAK), - const_iv(SECTION_HEADER), - }; - - for (civ = type_const_iv + sizeof(type_const_iv) / sizeof(type_const_iv[0]); civ-- > type_const_iv; ) - newCONSTSUB(type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = msg_type_const_iv + sizeof(msg_type_const_iv) / sizeof(msg_type_const_iv[0]); civ-- > msg_type_const_iv; ) - newCONSTSUB(msg_type_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = user_info_const_iv + sizeof(user_info_const_iv) / sizeof(user_info_const_iv[0]); civ-- > user_info_const_iv; ) - newCONSTSUB(user_info_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_notify_close(type, ui_handle) - Purple::NotifyType type - void * ui_handle - -void -purple_notify_close_with_handle(handle) - void * handle - -void * -purple_notify_email(handle, subject, from, to, url, cb, user_data) - void * handle - const char *subject - const char *from - const char *to - const char *url - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_emails(handle, count, detailed, subjects, froms, tos, urls, cb, user_data) - void * handle - size_t count - gboolean detailed - const char **subjects - const char **froms - const char **tos - const char **urls - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_formatted(handle, title, primary, secondary, text, cb, user_data) - void * handle - const char *title - const char *primary - const char *secondary - const char *text - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_userinfo(gc, who, user_info, cb, user_data) - Purple::Connection gc - const char *who - Purple::NotifyUserInfo user_info - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_message(handle, type, title, primary, secondary, cb, user_data) - void * handle - Purple::NotifyMsgType type - const char *title - const char *primary - const char *secondary - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_searchresults(gc, title, primary, secondary, results, cb, user_data) - Purple::Connection gc - const char *title - const char *primary - const char *secondary - Purple::NotifySearchResults results - Purple::NotifyCloseCallback cb - gpointer user_data - -void * -purple_notify_uri(handle, uri) - void * handle - const char *uri - -MODULE = Purple::Notify PACKAGE = Purple::NotifyUserInfo PREFIX = purple_notify_user_info_ -PROTOTYPES: ENABLE - -Purple::NotifyUserInfo -purple_notify_user_info_new(class) - C_ARGS: /* void */ - -void -purple_notify_user_info_destroy(user_info) - Purple::NotifyUserInfo user_info - -void -purple_notify_user_info_get_entries(user_info) - Purple::NotifyUserInfo user_info -PREINIT: - GList *l; -PPCODE: - l = purple_notify_user_info_get_entries(user_info); - for (; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::NotifyUserInfoEntry"))); - } - -gchar_own * -purple_notify_user_info_get_text_with_newline(user_info, newline) - Purple::NotifyUserInfo user_info - const char *newline - -void purple_notify_user_info_add_pair(user_info, label, value) - Purple::NotifyUserInfo user_info - const char *label - const char *value - -void purple_notify_user_info_prepend_pair(user_info, label, value) - Purple::NotifyUserInfo user_info - const char *label - const char *value - -void purple_notify_user_info_add_section_break(user_info) - Purple::NotifyUserInfo user_info - -void purple_notify_user_info_add_section_header(user_info, label) - Purple::NotifyUserInfo user_info - const char *label - -void purple_notify_user_info_remove_last_item(user_info) - Purple::NotifyUserInfo user_info - -const gchar * -purple_notify_user_info_entry_get_label(user_info_entry) - Purple::NotifyUserInfoEntry user_info_entry - -const gchar * -purple_notify_user_info_entry_get_value(user_info_entry) - Purple::NotifyUserInfoEntry user_info_entry diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/PluginPref.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/PluginPref.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/PluginPref.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/PluginPref.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -#include "module.h" - -MODULE = Purple::PluginPref PACKAGE = Purple::PluginPref::Frame PREFIX = purple_plugin_pref_frame_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *string_format_stash = gv_stashpv("Purple::String::Format::Type", 1); - HV *plugin_pref_stash = gv_stashpv("Purple::PluginPref::Type", 1); - - static const constiv *civ, string_format_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_STRING_FORMAT_TYPE_##name} - const_iv(NONE), - const_iv(MULTILINE), - const_iv(HTML), - }; - static const constiv plugin_pref_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_PLUGIN_PREF_##name} - const_iv(NONE), - const_iv(CHOICE), - const_iv(INFO), - const_iv(STRING_FORMAT), - }; - - for (civ = string_format_const_iv + sizeof(string_format_const_iv) / sizeof(string_format_const_iv[0]); civ-- > string_format_const_iv; ) - newCONSTSUB(string_format_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = plugin_pref_const_iv + sizeof(plugin_pref_const_iv) / sizeof(plugin_pref_const_iv[0]); civ-- > plugin_pref_const_iv; ) - newCONSTSUB(plugin_pref_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_plugin_pref_frame_add(frame, pref) - Purple::PluginPref::Frame frame - Purple::PluginPref pref - -void -purple_plugin_pref_frame_destroy(frame) - Purple::PluginPref::Frame frame - -void -purple_plugin_pref_frame_get_prefs(frame) - Purple::PluginPref::Frame frame -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugin_pref_frame_get_prefs(frame); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::PluginPref"))); - } - -Purple::PluginPref::Frame -purple_plugin_pref_frame_new(class) - C_ARGS: /* void */ - -MODULE = Purple::PluginPref PACKAGE = Purple::PluginPref PREFIX = purple_plugin_pref_ -PROTOTYPES: ENABLE - -void -purple_plugin_pref_add_choice(pref, label, choice) - Purple::PluginPref pref - const char *label -# Do the appropriate conversion based on the perl type specified. -# Currently only Strings and Ints will work. - gpointer choice = (SvPOKp($arg) ? SvPVutf8_nolen($arg) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL)); - -void -purple_plugin_pref_destroy(pref) - Purple::PluginPref pref - - -void -purple_plugin_pref_get_bounds(pref, OUTLIST int min, OUTLIST int max) - Purple::PluginPref pref - # According to the perlxs manual page we shouldn't need to specify a - # prototype here because "[p]arameters preceded by OUTLIST keyword do - # not appear in the usage signature of the generated Perl function." - # however that appears to only work for the usage error message and - # not for the call to newXSproto. Since I can't find any documentation - # for newXSproto at the moment I have no idea if that matters so - # override the prototype here. - PROTOTYPE: $ - -void -purple_plugin_pref_get_choices(pref) - Purple::PluginPref pref -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugin_pref_get_choices(pref); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListItem"))); - } - -const char * -purple_plugin_pref_get_label(pref) - Purple::PluginPref pref - -gboolean -purple_plugin_pref_get_masked(pref) - Purple::PluginPref pref - -Purple::String::Format::Type -purple_plugin_pref_get_format_type(pref) - Purple::PluginPref pref - -unsigned int -purple_plugin_pref_get_max_length(pref) - Purple::PluginPref pref - -const char * -purple_plugin_pref_get_name(pref) - Purple::PluginPref pref - -Purple::PluginPrefType -purple_plugin_pref_get_type(pref) - Purple::PluginPref pref - -Purple::PluginPref -purple_plugin_pref_new(class) - C_ARGS: /* void */ - -Purple::PluginPref -purple_plugin_pref_new_with_label(class, label) - const char *label - C_ARGS: - label - -Purple::PluginPref -purple_plugin_pref_new_with_name(class, name) - const char *name - C_ARGS: - name - -Purple::PluginPref -purple_plugin_pref_new_with_name_and_label(class, name, label) - const char *name - const char *label - C_ARGS: - name, label - -void -purple_plugin_pref_set_bounds(pref, min, max) - Purple::PluginPref pref - int min - int max - -void -purple_plugin_pref_set_label(pref, label) - Purple::PluginPref pref - const char *label - -void -purple_plugin_pref_set_masked(pref, mask) - Purple::PluginPref pref - gboolean mask - -void -purple_plugin_pref_set_format_type(pref, format) - Purple::PluginPref pref - Purple::String::Format::Type format - -void -purple_plugin_pref_set_max_length(pref, max_length) - Purple::PluginPref pref - unsigned int max_length - -void -purple_plugin_pref_set_name(pref, name) - Purple::PluginPref pref - const char *name - -void -purple_plugin_pref_set_type(pref, type) - Purple::PluginPref pref - Purple::PluginPrefType type -PREINIT: - PurplePluginPrefType gpp_type; -CODE: - gpp_type = PURPLE_PLUGIN_PREF_NONE; - - if (type == 1) { - gpp_type = PURPLE_PLUGIN_PREF_CHOICE; - } else if (type == 2) { - gpp_type = PURPLE_PLUGIN_PREF_INFO; - } else if (type == 3) { - gpp_type = PURPLE_PLUGIN_PREF_STRING_FORMAT; - } - purple_plugin_pref_set_type(pref, gpp_type); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Plugin.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Plugin.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Plugin.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Plugin.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -#include "module.h" - -MODULE = Purple::Plugin PACKAGE = Purple::Plugin PREFIX = purple_plugin_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Plugin::Type", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PLUGIN_##name} - const_iv(UNKNOWN), - const_iv(STANDARD), - const_iv(LOADER), - const_iv(PROTOCOL), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Plugin -purple_plugin_new(native, path) - gboolean native - const char *path - -Purple::Plugin -purple_plugin_probe(filename) - const char *filename - -gboolean -purple_plugin_register(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_load(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_unload(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_reload(plugin) - Purple::Plugin plugin - -void -purple_plugin_destroy(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_is_loaded(plugin) - Purple::Plugin plugin - -gboolean -purple_plugin_is_unloadable(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_id(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_name(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_version(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_summary(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_description(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_author(plugin) - Purple::Plugin plugin - -const gchar * -purple_plugin_get_homepage(plugin) - Purple::Plugin plugin - -MODULE = Purple::Plugin PACKAGE = Purple::Plugin::IPC PREFIX = purple_plugin_ipc_ - -void -purple_plugin_ipc_unregister(plugin, command) - Purple::Plugin plugin - const char *command - -void -purple_plugin_ipc_unregister_all(plugin) - Purple::Plugin plugin - -MODULE = Purple::Plugin PACKAGE = Purple::Plugins PREFIX = purple_plugins_ -PROTOTYPES: ENABLE - -void -purple_plugins_add_search_path(path) - const char *path - -void -purple_plugins_unload_all() - -void -purple_plugins_destroy_all() - -void -purple_plugins_load_saved(key) - const char *key - -void -purple_plugins_probe(ext) - const char *ext - -gboolean -purple_plugins_enabled() - -Purple::Plugin -purple_plugins_find_with_name(name) - const char *name - -Purple::Plugin -purple_plugins_find_with_filename(filename) - const char *filename - -Purple::Plugin -purple_plugins_find_with_basename(basename) - const char *basename - -Purple::Plugin -purple_plugins_find_with_id(id) - const char *id - -void -purple_plugins_get_loaded() -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugins_get_loaded(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Plugin"))); - } - -void -purple_plugins_get_protocols() -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Plugin"))); - } - -void -purple_plugins_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_plugins_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Plugin"))); - } - -Purple::Handle -purple_plugins_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Pounce.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Pounce.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Pounce.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Pounce.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -#include "module.h" - -MODULE = Purple::Pounce PACKAGE = Purple::Pounce PREFIX = purple_pounce_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *event_stash = gv_stashpv("Purple::Pounce::Event", 1); - HV *option_stash = gv_stashpv("Purple::Pounce::Option", 1); - - static const constiv *civ, event_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_POUNCE_##name} - const_iv(NONE), - const_iv(SIGNON), - const_iv(SIGNOFF), - const_iv(AWAY), - const_iv(AWAY_RETURN), - const_iv(IDLE), - const_iv(IDLE_RETURN), - const_iv(TYPING), - const_iv(TYPED), - const_iv(TYPING_STOPPED), - const_iv(MESSAGE_RECEIVED), - }; - static const constiv option_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_POUNCE_OPTION_##name} - const_iv(NONE), - const_iv(AWAY), - }; - - for (civ = event_const_iv + sizeof(event_const_iv) / sizeof(event_const_iv[0]); civ-- > event_const_iv; ) - newCONSTSUB(event_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = option_const_iv + sizeof(option_const_iv) / sizeof(option_const_iv[0]); civ-- > option_const_iv; ) - newCONSTSUB(option_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_pounce_action_register(pounce, name) - Purple::Pounce pounce - const char *name - -void -purple_pounce_destroy(pounce) - Purple::Pounce pounce - -void -purple_pounce_destroy_all_by_account(account) - Purple::Account account - -void * -purple_pounce_get_data(pounce) - Purple::Pounce pounce - -Purple::PounceEvent -purple_pounce_get_events(pounce) - Purple::Pounce pounce - -const char * -purple_pounce_get_pouncee(pounce) - Purple::Pounce pounce - -Purple::Account -purple_pounce_get_pouncer(pounce) - Purple::Pounce pounce - -gboolean -purple_pounce_get_save(pounce) - Purple::Pounce pounce - -void -purple_pounce_set_data(pounce, data) - Purple::Pounce pounce - void * data - -void -purple_pounce_set_events(pounce, events) - Purple::Pounce pounce - Purple::PounceEvent events - -void -purple_pounce_set_pouncee(pounce, pouncee) - Purple::Pounce pounce - const char *pouncee - -void -purple_pounce_set_pouncer(pounce, pouncer) - Purple::Pounce pounce - Purple::Account pouncer - -void -purple_pounce_set_save(pounce, save) - Purple::Pounce pounce - gboolean save - -MODULE = Purple::Pounce PACKAGE = Purple::Pounces PREFIX = purple_pounces_ -PROTOTYPES: ENABLE - -void -purple_pounces_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_pounces_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce"))); - } - -void -purple_pounces_get_all_for_ui(ui) - const char *ui -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_pounces_get_all_for_ui(ui); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Pounce"))); - } - g_list_free(ll); - -Purple::Handle -purple_pounces_get_handle() - -gboolean -purple_pounces_load() - -void -purple_pounces_unregister_handler(ui) - const char *ui diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prefs.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prefs.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prefs.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prefs.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::Prefs PACKAGE = Purple::Prefs PREFIX = purple_prefs_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::Pref::Type", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PREF_##name} - const_iv(NONE), - const_iv(BOOLEAN), - const_iv(INT), - const_iv(STRING), - const_iv(STRING_LIST), - const_iv(PATH), - const_iv(PATH_LIST), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_prefs_add_bool(name, value) - const char *name - gboolean value - -void -purple_prefs_add_int(name, value) - const char *name - int value - -void -purple_prefs_add_none(name) - const char *name - -void -purple_prefs_add_string(name, value) - const char *name - const char *value - -void -purple_prefs_add_string_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_add_string_list(name, t_GL); - g_list_free(t_GL); - -void -purple_prefs_add_path(name, value) - const char *name - const char *value - -void -purple_prefs_add_path_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_add_path_list(name, t_GL); - g_list_free(t_GL); - -void -purple_prefs_destroy() - -guint -purple_prefs_connect_callback(plugin, name, callback, data = 0); - Purple::Plugin plugin - const char *name - SV *callback - SV *data -CODE: - RETVAL = purple_perl_prefs_connect_callback(plugin, name, callback, data); -OUTPUT: - RETVAL - -void -purple_prefs_disconnect_by_handle(plugin) - Purple::Plugin plugin -CODE: - purple_perl_pref_cb_clear_for_plugin(plugin); - -void -purple_prefs_disconnect_callback(callback_id) - guint callback_id -CODE: - purple_perl_prefs_disconnect_callback(callback_id); - -gboolean -purple_prefs_exists(name) - const char *name - -const char * -purple_prefs_get_path(name) - const char *name - -void -purple_prefs_get_path_list(name) - const char *name -PREINIT: - GList *l; -PPCODE: - for (l = purple_prefs_get_path_list(name); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - -gboolean -purple_prefs_get_bool(name) - const char *name - -Purple::Handle -purple_prefs_get_handle() - -int -purple_prefs_get_int(name) - const char *name - -const char * -purple_prefs_get_string(name) - const char *name - -void -purple_prefs_get_string_list(name) - const char *name -PREINIT: - GList *l; -PPCODE: - for (l = purple_prefs_get_string_list(name); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - -Purple::PrefType -purple_prefs_get_type(name) - const char *name - -gboolean -purple_prefs_load() - -void -purple_prefs_remove(name) - const char *name - -void -purple_prefs_rename(oldname, newname) - const char *oldname - const char *newname - -void -purple_prefs_rename_boolean_toggle(oldname, newname) - const char *oldname - const char *newname - -void -purple_prefs_set_bool(name, value) - const char *name - gboolean value - -void -purple_prefs_set_generic(name, value) - const char *name - gpointer value - -void -purple_prefs_set_int(name, value) - const char *name - int value - -void -purple_prefs_set_string(name, value) - const char *name - const char *value - -void -purple_prefs_set_string_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_set_string_list(name, t_GL); - g_list_free(t_GL); - -void -purple_prefs_set_path(name, value) - const char *name - const char *value - -void -purple_prefs_set_path_list(name, value) - const char *name - SV *value -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(value)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); - - purple_prefs_set_path_list(name, t_GL); - g_list_free(t_GL); - - -void -purple_prefs_trigger_callback(name) - const char *name - -void -purple_prefs_get_children_names(name) - const char *name -PREINIT: - GList *l; -PPCODE: - for (l = purple_prefs_get_children_names(name); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - -void -purple_prefs_update_old() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Privacy.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Privacy.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Privacy.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Privacy.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -#include "module.h" - -MODULE = Purple::Privacy PACKAGE = Purple::Privacy PREFIX = purple_privacy_ -PROTOTYPES: ENABLE - -gboolean -purple_privacy_permit_add(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_permit_remove(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_deny_add(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_deny_remove(account, name, local_only) - Purple::Account account - const char * name - gboolean local_only - -gboolean -purple_privacy_check(account, who) - Purple::Account account - const char * who diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Proxy.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Proxy.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Proxy.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Proxy.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -#include "module.h" - -MODULE = Purple::Proxy PACKAGE = Purple::Proxy PREFIX = purple_proxy_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::ProxyType", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PROXY_##name} - const_iv(USE_GLOBAL), - const_iv(NONE), - const_iv(HTTP), - const_iv(SOCKS4), - const_iv(SOCKS5), - const_iv(USE_ENVVAR), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -Purple::Handle -purple_proxy_get_handle() - -MODULE = Purple::Proxy PACKAGE = Purple::ProxyInfo PREFIX = purple_proxy_info_ -PROTOTYPES: ENABLE - -void -purple_proxy_info_destroy(info) - Purple::ProxyInfo info - -const char * -purple_proxy_info_get_host(info) - Purple::ProxyInfo info - -const char * -purple_proxy_info_get_password(info) - Purple::ProxyInfo info - -int -purple_proxy_info_get_port(info) - Purple::ProxyInfo info - -Purple::ProxyType -purple_proxy_info_get_type(info) - Purple::ProxyInfo info - -const char * -purple_proxy_info_get_username(info) - Purple::ProxyInfo info - -Purple::ProxyInfo -purple_proxy_info_new() - -void -purple_proxy_info_set_host(info, host) - Purple::ProxyInfo info - const char *host - -void -purple_proxy_info_set_password(info, password) - Purple::ProxyInfo info - const char *password - -void -purple_proxy_info_set_port(info, port) - Purple::ProxyInfo info - int port - -void -purple_proxy_info_set_type(info, type) - Purple::ProxyInfo info - Purple::ProxyType type - -void -purple_proxy_info_set_username(info, username) - Purple::ProxyInfo info - const char *username - -MODULE = Purple::Proxy PACKAGE = Purple::Proxy PREFIX = purple_ -PROTOTYPES: ENABLE - -Purple::ProxyInfo -purple_global_proxy_get_info() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prpl.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prpl.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prpl.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Prpl.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -#include "module.h" - -MODULE = Purple::Prpl PACKAGE = Purple::Find PREFIX = purple_find_ -PROTOTYPES: ENABLE - -Purple::Plugin -purple_find_prpl(id) - const char *id - -MODULE = Purple::Prpl PACKAGE = Purple::Prpl PREFIX = purple_prpl_ -PROTOTYPES: ENABLE - -void -purple_prpl_change_account_status(account, old_status, new_status) - Purple::Account account - Purple::Status old_status - Purple::Status new_status - -void -purple_prpl_get_statuses(account, presence) - Purple::Account account - Purple::Presence presence -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_prpl_get_statuses(account,presence); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status"))); - } - /* We can free the list here but the script needs to free the - * Purple::Status 'objects' itself. */ - g_list_free(ll); - -void -purple_prpl_got_account_idle(account, idle, idle_time) - Purple::Account account - gboolean idle - time_t idle_time - -void -purple_prpl_got_account_login_time(account, login_time) - Purple::Account account - time_t login_time - -void -purple_prpl_got_user_idle(account, name, idle, idle_time) - Purple::Account account - const char *name - gboolean idle - time_t idle_time - -void -purple_prpl_got_user_login_time(account, name, login_time) - Purple::Account account - const char *name - time_t login_time - -int -purple_prpl_send_raw(gc, str) - Purple::Connection gc - const char *str -PREINIT: - PurplePluginProtocolInfo *prpl_info; -CODE: - if (!gc) - RETVAL = 0; - else { - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - if (prpl_info && prpl_info->send_raw != NULL) { - RETVAL = prpl_info->send_raw(gc, str, strlen(str)); - } else { - RETVAL = 0; - } - } -OUTPUT: - RETVAL - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.pm qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.pm --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.pm 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.pm 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -package Purple; - -use 5.008; -use strict; -use warnings; -use Carp; - -require Exporter; -use AutoLoader; - -our @ISA = qw(Exporter); - -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. - -# This allows declaration use Purple ':all'; -# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK -# will save memory. -our %EXPORT_TAGS = ( 'all' => [ qw( - -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - -); - -our $VERSION = '0.01'; - -sub AUTOLOAD { - # This AUTOLOAD is used to 'autoload' constants from the constant() - # XS function. - - my $constname; - our $AUTOLOAD; - ($constname = $AUTOLOAD) =~ s/.*:://; - croak "&Purple::constant not defined" if $constname eq 'constant'; - my ($error, $val) = constant($constname); - if ($error) { croak $error; } - { - no strict 'refs'; - - *$AUTOLOAD = sub { $val }; - } - - goto &$AUTOLOAD; -} - -require XSLoader; -XSLoader::load('Purple', $VERSION); - -# Preloaded methods go here. - -1; -__END__ - -=head1 NAME - -Purple - Perl extension to the libpurple instant messenger library. - -=head1 SYNOPSIS - - use Purple; - -=head1 ABSTRACT - - This module provides the interface for using perl scripts as plugins - in libpurple. - -=head1 DESCRIPTION - -This module provides the interface for using perl scripts as plugins -in Purple. With this, developers can write perl scripts that can be -loaded in Purple as plugins. The scripts can interact with IMs, chats, -accounts, the buddy list, libpurple signals, and more. - -The API for the perl interface is very similar to that of the Purple C -API, which can be viewed at http://developer.pidgin.im/doxygen/ or in -the header files in the Purple source tree. - -=head1 FUNCTIONS - -=over - -=item @accounts = Purple::accounts - -Returns a list of all accounts, online or offline. - -=item @chats = Purple::chats - -Returns a list of all chats currently open. - -=item @connections = Purple::connections - -Returns a list of all active connections. - -=item @conversations = Purple::conversations - -Returns a list of all conversations, both IM and chat, currently open. - -=item @conv_windows = Purple::conv_windows - -Returns a list of all conversation windows currently open. - -=item @ims = Purple::ims - -Returns a list of all instant messages currently open. - -=back - -=head1 SEE ALSO - -Purple C API documentation - http://developer.pidgin.im/doxygen/ - -Purple website - http://pidgin.im/ - -=head1 AUTHOR - -Christian Hammond, Echipx86@gnupdate.orgE - -=head1 COPYRIGHT AND LICENSE - -Copyright 2003 by Christian Hammond - -This library is free software; you can redistribute it and/or modify -it under the terms of the General Public License (GPL). For -more information, see http://www.fsf.org/licenses/gpl.txt - -=cut diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Purple.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -/* Prototypes for the BOOT section below. */ -PURPLE_PERL_BOOT_PROTO(Account); -PURPLE_PERL_BOOT_PROTO(Account__Option); -PURPLE_PERL_BOOT_PROTO(Buddy__Icon); -PURPLE_PERL_BOOT_PROTO(BuddyList); -PURPLE_PERL_BOOT_PROTO(Certificate); -PURPLE_PERL_BOOT_PROTO(Cipher); -PURPLE_PERL_BOOT_PROTO(Cmd); -PURPLE_PERL_BOOT_PROTO(Connection); -PURPLE_PERL_BOOT_PROTO(Conversation); -PURPLE_PERL_BOOT_PROTO(Core); -PURPLE_PERL_BOOT_PROTO(Debug); -PURPLE_PERL_BOOT_PROTO(Xfer); -PURPLE_PERL_BOOT_PROTO(Idle); -PURPLE_PERL_BOOT_PROTO(ImgStore); -PURPLE_PERL_BOOT_PROTO(Log); -PURPLE_PERL_BOOT_PROTO(Network); -PURPLE_PERL_BOOT_PROTO(Notify); -PURPLE_PERL_BOOT_PROTO(Plugin); -PURPLE_PERL_BOOT_PROTO(PluginPref); -PURPLE_PERL_BOOT_PROTO(Pounce); -PURPLE_PERL_BOOT_PROTO(Prefs); -PURPLE_PERL_BOOT_PROTO(Privacy); -PURPLE_PERL_BOOT_PROTO(Proxy); -PURPLE_PERL_BOOT_PROTO(Prpl); -PURPLE_PERL_BOOT_PROTO(Request); -PURPLE_PERL_BOOT_PROTO(Roomlist); -PURPLE_PERL_BOOT_PROTO(SSL); -PURPLE_PERL_BOOT_PROTO(SavedStatus); -PURPLE_PERL_BOOT_PROTO(Serv); -PURPLE_PERL_BOOT_PROTO(Signal); -PURPLE_PERL_BOOT_PROTO(Smiley); -PURPLE_PERL_BOOT_PROTO(Sound); -PURPLE_PERL_BOOT_PROTO(Status); -PURPLE_PERL_BOOT_PROTO(Stringref); -PURPLE_PERL_BOOT_PROTO(Util); -PURPLE_PERL_BOOT_PROTO(Whiteboard); -PURPLE_PERL_BOOT_PROTO(XMLNode); - -MODULE = Purple PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -BOOT: - PURPLE_PERL_BOOT(Account); - PURPLE_PERL_BOOT(Account__Option); - PURPLE_PERL_BOOT(Buddy__Icon); - PURPLE_PERL_BOOT(BuddyList); - PURPLE_PERL_BOOT(Certificate); - PURPLE_PERL_BOOT(Cipher); - PURPLE_PERL_BOOT(Cmd); - PURPLE_PERL_BOOT(Connection); - PURPLE_PERL_BOOT(Conversation); - PURPLE_PERL_BOOT(Core); - PURPLE_PERL_BOOT(Debug); - PURPLE_PERL_BOOT(Xfer); - PURPLE_PERL_BOOT(Idle); - PURPLE_PERL_BOOT(ImgStore); - PURPLE_PERL_BOOT(Log); - PURPLE_PERL_BOOT(Network); - PURPLE_PERL_BOOT(Notify); - PURPLE_PERL_BOOT(Plugin); - PURPLE_PERL_BOOT(PluginPref); - PURPLE_PERL_BOOT(Pounce); - PURPLE_PERL_BOOT(Prefs); - PURPLE_PERL_BOOT(Privacy); - PURPLE_PERL_BOOT(Proxy); - PURPLE_PERL_BOOT(Prpl); - PURPLE_PERL_BOOT(Request); - PURPLE_PERL_BOOT(Roomlist); - PURPLE_PERL_BOOT(SSL); - PURPLE_PERL_BOOT(SavedStatus); - PURPLE_PERL_BOOT(Serv); - PURPLE_PERL_BOOT(Signal); - PURPLE_PERL_BOOT(Smiley); - PURPLE_PERL_BOOT(Sound); - PURPLE_PERL_BOOT(Status); - PURPLE_PERL_BOOT(Stringref); - PURPLE_PERL_BOOT(Util); - PURPLE_PERL_BOOT(Whiteboard); - PURPLE_PERL_BOOT(XMLNode); - -guint -timeout_add(plugin, seconds, callback, data = 0) - Purple::Plugin plugin - int seconds - SV *callback - SV *data -CODE: - RETVAL = purple_perl_timeout_add(plugin, seconds, callback, data); -OUTPUT: - RETVAL - -gboolean -timeout_remove(handle) - guint handle -CODE: - RETVAL = purple_perl_timeout_remove(handle); -OUTPUT: - RETVAL - -void -deinit() -CODE: - purple_perl_timeout_clear(); - - -MODULE = Purple PACKAGE = Purple PREFIX = purple_ -PROTOTYPES: ENABLE - -Purple::Core -purple_get_core() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Request.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Request.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Request.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Request.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,647 +0,0 @@ -#include "module.h" - -/* This breaks on faceprint's amd64 box -void * -purple_request_action_varg(handle, title, primary, secondary, default_action, user_data, action_count, actions) - void * handle - const char *title - const char *primary - const char *secondary - unsigned int default_action - void *user_data - size_t action_count - va_list actions - */ - - -typedef struct { - SV *ok_fun; - SV *cancel_fun; -} PurplePerlRequestData; - -static void -purple_perl_request_data_free(PurplePerlRequestData *ppr) -{ - if (ppr->ok_fun) - SvREFCNT_dec(ppr->ok_fun); - if (ppr->cancel_fun) - SvREFCNT_dec(ppr->cancel_fun); - g_free(ppr); -} - -/********************************************************/ -/* */ -/* Callback function that calls a perl subroutine */ -/* */ -/* The void * field data is being used as a way to hide */ -/* the perl sub's name in a PurplePerlRequestData */ -/* */ -/********************************************************/ -static void -purple_perl_request_ok_cb(void * data, PurpleRequestFields *fields) -{ - PurplePerlRequestData *gpr = (PurplePerlRequestData *)data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - XPUSHs(sv_2mortal(purple_perl_bless_object(fields, "Purple::Request::Fields"))); - PUTBACK; - call_sv(gpr->ok_fun, G_EVAL | G_SCALAR); - SPAGAIN; - - PUTBACK; - FREETMPS; - LEAVE; - - purple_perl_request_data_free(gpr); -} - -static void -purple_perl_request_cancel_cb(void * data, PurpleRequestFields *fields) -{ - PurplePerlRequestData *gpr = (PurplePerlRequestData *)data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - XPUSHs(sv_2mortal(purple_perl_bless_object(fields, "Purple::Request::Fields"))); - PUTBACK; - call_sv(gpr->cancel_fun, G_EVAL | G_SCALAR); - SPAGAIN; - - PUTBACK; - FREETMPS; - LEAVE; - - purple_perl_request_data_free(gpr); -} - -MODULE = Purple::Request PACKAGE = Purple::Request PREFIX = purple_request_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *request_stash = gv_stashpv("Purple::RequestType", 1); - HV *request_field_stash = gv_stashpv("Purple::RequestFieldType", 1); - - static const constiv *civ, request_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_REQUEST_##name} - const_iv(INPUT), - const_iv(CHOICE), - const_iv(ACTION), - const_iv(FIELDS), - const_iv(FILE), - const_iv(FOLDER), - }; - static const constiv request_field_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_REQUEST_FIELD_##name} - const_iv(NONE), - const_iv(STRING), - const_iv(INTEGER), - const_iv(BOOLEAN), - const_iv(CHOICE), - const_iv(LIST), - const_iv(LABEL), - const_iv(IMAGE), - const_iv(ACCOUNT), - }; - - for (civ = request_const_iv + sizeof(request_const_iv) / sizeof(request_const_iv[0]); civ-- > request_const_iv; ) - newCONSTSUB(request_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = request_field_const_iv + sizeof(request_field_const_iv) / sizeof(request_field_const_iv[0]); civ-- > request_field_const_iv; ) - newCONSTSUB(request_field_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void * -purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb) - Purple::Plugin handle - const char * title - const char * primary - const char * secondary - const char * default_value - gboolean multiline - gboolean masked - gchar * hint - const char * ok_text - SV * ok_cb - const char * cancel_text - SV * cancel_cb -CODE: - PurplePerlRequestData *gpr; - char *basename; - - basename = g_path_get_basename(handle->path); - purple_perl_normalize_script_name(basename); - gpr = g_new(PurplePerlRequestData, 1); - gpr->ok_fun = purple_perl_sv_from_fun(handle, ok_cb); - gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb); - g_free(basename); - - RETVAL = purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr); -OUTPUT: - RETVAL - -void * -purple_request_file(handle, title, filename, savedialog, ok_cb, cancel_cb) - Purple::Plugin handle - const char * title - const char * filename - gboolean savedialog - SV * ok_cb - SV * cancel_cb -CODE: - PurplePerlRequestData *gpr; - char *basename; - - basename = g_path_get_basename(handle->path); - purple_perl_normalize_script_name(basename); - gpr = g_new(PurplePerlRequestData, 1); - gpr->ok_fun = purple_perl_sv_from_fun(handle, ok_cb); - gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb); - g_free(basename); - - RETVAL = purple_request_file(handle, title, filename, savedialog, G_CALLBACK(purple_perl_request_ok_cb), G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr); -OUTPUT: - RETVAL - -void * -purple_request_fields(handle, title, primary, secondary, fields, ok_text, ok_cb, cancel_text, cancel_cb) - Purple::Plugin handle - const char * title - const char * primary - const char * secondary - Purple::Request::Fields fields - const char * ok_text - SV * ok_cb - const char * cancel_text - SV * cancel_cb -CODE: - PurplePerlRequestData *gpr; - char *basename; - - basename = g_path_get_basename(handle->path); - purple_perl_normalize_script_name(basename); - gpr = g_new(PurplePerlRequestData, 1); - gpr->ok_fun = purple_perl_sv_from_fun(handle, ok_cb); - gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb); - g_free(basename); - - RETVAL = purple_request_fields(handle, title, primary, secondary, fields, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr); -OUTPUT: - RETVAL - -void -purple_request_close(type, uihandle) - Purple::RequestType type - void * uihandle - -void -purple_request_close_with_handle(handle) - void * handle - - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_account_new(class, id, text, account = NULL) - const char *id - const char *text - Purple::Account account - C_ARGS: id, text, account - -Purple::Account -purple_request_field_account_get_default_value(field) - Purple::Request::Field field - -IV -purple_request_field_account_get_filter(field) - Purple::Request::Field field -CODE: - RETVAL = PTR2IV(purple_request_field_account_get_filter(field)); -OUTPUT: - RETVAL - -gboolean -purple_request_field_account_get_show_all(field) - Purple::Request::Field field - -Purple::Account -purple_request_field_account_get_value(field) - Purple::Request::Field field - -void -purple_request_field_account_set_default_value(field, default_value) - Purple::Request::Field field - Purple::Account default_value - -void -purple_request_field_account_set_show_all(field, show_all) - Purple::Request::Field field - gboolean show_all - -void -purple_request_field_account_set_value(field, value) - Purple::Request::Field field - Purple::Account value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_bool_new(class, id, text, default_value = TRUE) - const char *id - const char *text - gboolean default_value - C_ARGS: id, text, default_value - -gboolean -purple_request_field_bool_get_default_value(field) - Purple::Request::Field field - -gboolean -purple_request_field_bool_get_value(field) - Purple::Request::Field field - -void -purple_request_field_bool_set_default_value(field, default_value) - Purple::Request::Field field - gboolean default_value - -void -purple_request_field_bool_set_value(field, value) - Purple::Request::Field field - gboolean value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_choice_new(class, id, text, default_value = 0) - const char *id - const char *text - int default_value - C_ARGS: id, text, default_value - -void -purple_request_field_choice_add(field, label) - Purple::Request::Field field - const char *label - -int -purple_request_field_choice_get_default_value(field) - Purple::Request::Field field - -void -purple_request_field_choice_get_labels(field) - Purple::Request::Field field -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_choice_get_labels(field); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - -int -purple_request_field_choice_get_value(field) - Purple::Request::Field field - -void -purple_request_field_choice_set_default_value(field, default_value) - Purple::Request::Field field - int default_value - -void -purple_request_field_choice_set_value(field, value) - Purple::Request::Field field - int value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_int_new(clas, id, text, default_value = 0) - const char *id - const char *text - int default_value - C_ARGS: id, text, default_value - -int -purple_request_field_int_get_default_value(field) - Purple::Request::Field field - -int -purple_request_field_int_get_value(field) - Purple::Request::Field field - -void -purple_request_field_int_set_default_value(field, default_value) - Purple::Request::Field field - int default_value - -void -purple_request_field_int_set_value(field, value) - Purple::Request::Field field - int value - -gboolean -purple_request_field_is_required(field) - Purple::Request::Field field - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_label_new(class, id, text) - const char *id - const char *text - C_ARGS: id, text - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_list_new(class, id, text) - const char *id - const char *text - C_ARGS: id, text - -void -purple_request_field_list_add(field, item, data) - Purple::Request::Field field - const char *item - void * data - -void -purple_request_field_list_add_selected(field, item) - Purple::Request::Field field - const char *item - -void -purple_request_field_list_clear_selected(field) - Purple::Request::Field field - -void * -purple_request_field_list_get_data(field, text) - Purple::Request::Field field - const char *text - -void -purple_request_field_list_get_items(field) - Purple::Request::Field field -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_list_get_items(field); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - -gboolean -purple_request_field_list_get_multi_select(field) - Purple::Request::Field field - -void -purple_request_field_list_get_selected(field) - Purple::Request::Field field -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_list_get_selected(field); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - } - -gboolean -purple_request_field_list_is_selected(field, item) - Purple::Request::Field field - const char *item - -void -purple_request_field_list_set_multi_select(field, multi_select) - Purple::Request::Field field - gboolean multi_select - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_new(class, id, text, type) - const char *id - const char *text - Purple::RequestFieldType type - C_ARGS: id, text, type - -void -purple_request_field_set_label(field, label) - Purple::Request::Field field - const char *label - -void -purple_request_field_set_required(field, required) - Purple::Request::Field field - gboolean required - -void -purple_request_field_set_type_hint(field, type_hint) - Purple::Request::Field field - const char *type_hint - -void -purple_request_field_set_visible(field, visible) - Purple::Request::Field field - gboolean visible - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -Purple::Request::Field -purple_request_field_string_new(class, id, text, default_value, multiline) - const char *id - const char *text - const char *default_value - gboolean multiline - C_ARGS: id, text, default_value, multiline - -const char * -purple_request_field_string_get_default_value(field) - Purple::Request::Field field - -const char * -purple_request_field_string_get_value(field) - Purple::Request::Field field - -gboolean -purple_request_field_string_is_editable(field) - Purple::Request::Field field - -gboolean -purple_request_field_string_is_masked(field) - Purple::Request::Field field - -gboolean -purple_request_field_string_is_multiline(field) - Purple::Request::Field field - -void -purple_request_field_string_set_default_value(field, default_value) - Purple::Request::Field field - const char *default_value - -void -purple_request_field_string_set_editable(field, editable) - Purple::Request::Field field - gboolean editable - -void -purple_request_field_string_set_masked(field, masked) - Purple::Request::Field field - gboolean masked - -void -purple_request_field_string_set_value(field, value) - Purple::Request::Field field - const char *value - -MODULE = Purple::Request PACKAGE = Purple::Request::Field::Group PREFIX = purple_request_field_group_ -PROTOTYPES: ENABLE - -void -purple_request_field_group_add_field(group, field) - Purple::Request::Field::Group group - Purple::Request::Field field - -void -purple_request_field_group_destroy(group) - Purple::Request::Field::Group group - -void -purple_request_field_group_get_fields(group) - Purple::Request::Field::Group group -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_field_group_get_fields(group); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Request::Field"))); - } - -const char * -purple_request_field_group_get_title(group) - Purple::Request::Field::Group group - -Purple::Request::Field::Group -purple_request_field_group_new(class, title) - const char *title - C_ARGS: title - -MODULE = Purple::Request PACKAGE = Purple::Request::Field PREFIX = purple_request_field_ -PROTOTYPES: ENABLE - -void -purple_request_field_destroy(field) - Purple::Request::Field field - -const char * -purple_request_field_get_id(field) - Purple::Request::Field field - -const char * -purple_request_field_get_label(field) - Purple::Request::Field field - -Purple::RequestFieldType -purple_request_field_get_type(field) - Purple::Request::Field field - -const char * -purple_request_field_get_type_hint(field) - Purple::Request::Field field - -gboolean -purple_request_field_is_visible(field) - Purple::Request::Field field - -MODULE = Purple::Request PACKAGE = Purple::Request::Fields PREFIX = purple_request_fields_ -PROTOTYPES: ENABLE - -Purple::Request::Fields -purple_request_fields_new(class) - C_ARGS: /* void */ - -void -purple_request_fields_add_group(fields, group) - Purple::Request::Fields fields - Purple::Request::Field::Group group - -gboolean -purple_request_fields_all_required_filled(fields) - Purple::Request::Fields fields - -void -purple_request_fields_destroy(fields) - Purple::Request::Fields fields - -gboolean -purple_request_fields_exists(fields, id) - Purple::Request::Fields fields - const char *id - -Purple::Account -purple_request_fields_get_account(fields, id) - Purple::Request::Fields fields - const char *id - -gboolean -purple_request_fields_get_bool(fields, id) - Purple::Request::Fields fields - const char *id - -int -purple_request_fields_get_choice(fields, id) - Purple::Request::Fields fields - const char *id - -Purple::Request::Field -purple_request_fields_get_field(fields, id) - Purple::Request::Fields fields - const char *id - -void -purple_request_fields_get_groups(fields) - Purple::Request::Fields fields -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_fields_get_groups(fields); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Request::Field::Group"))); - } - -int -purple_request_fields_get_integer(fields, id) - Purple::Request::Fields fields - const char *id - -void -purple_request_fields_get_required(fields) - Purple::Request::Fields fields -PREINIT: - GList *l; -PPCODE: - for (l = purple_request_fields_get_required(fields); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Request::Field"))); - } - -const char * -purple_request_fields_get_string(fields, id) - Purple::Request::Fields fields - const char *id - -gboolean -purple_request_fields_is_field_required(fields, id) - Purple::Request::Fields fields - const char *id diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Roomlist.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Roomlist.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Roomlist.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Roomlist.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,100 +0,0 @@ -#include "module.h" - -MODULE = Purple::Roomlist PACKAGE = Purple::Roomlist PREFIX = purple_roomlist_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *room_stash = gv_stashpv("Purple::Roomlist::Room::Type", 1); - HV *field_stash = gv_stashpv("Purple::Roomlist::Field::Type", 1); - - static const constiv *civ, room_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_ROOMTYPE_##name} - const_iv(CATEGORY), - const_iv(ROOM), - }; - static const constiv field_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_ROOMLIST_FIELD_##name} - const_iv(BOOL), - const_iv(INT), - const_iv(STRING), - }; - - for (civ = room_const_iv + sizeof(room_const_iv) / sizeof(room_const_iv[0]); civ-- > room_const_iv; ) - newCONSTSUB(room_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = field_const_iv + sizeof(field_const_iv) / sizeof(field_const_iv[0]); civ-- > field_const_iv; ) - newCONSTSUB(field_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_roomlist_cancel_get_list(list) - Purple::Roomlist list - -void -purple_roomlist_expand_category(list, category) - Purple::Roomlist list - Purple::Roomlist::Room category - -gboolean -purple_roomlist_get_in_progress(list) - Purple::Roomlist list - -Purple::Roomlist -purple_roomlist_get_list(gc) - Purple::Connection gc - -Purple::Roomlist -purple_roomlist_new(account) - Purple::Account account - -void -purple_roomlist_ref(list) - Purple::Roomlist list - -void -purple_roomlist_room_add(list, room) - Purple::Roomlist list - Purple::Roomlist::Room room - -void -purple_roomlist_room_add_field(list, room, field) - Purple::Roomlist list - Purple::Roomlist::Room room - gconstpointer field - -void -purple_roomlist_room_join(list, room) - Purple::Roomlist list - Purple::Roomlist::Room room - -void -purple_roomlist_set_fields(list, fields) - Purple::Roomlist list - SV *fields -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(fields)); - - for (i = 0; i <= t_len; i++) - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(fields), i, 0))); - - purple_roomlist_set_fields(list, t_GL); - -void -purple_roomlist_set_in_progress(list, in_progress) - Purple::Roomlist list - gboolean in_progress - -void -purple_roomlist_show_with_account(account) - Purple::Account account - -void -purple_roomlist_unref(list) - Purple::Roomlist list - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SavedStatuses.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SavedStatuses.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SavedStatuses.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SavedStatuses.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -#include "module.h" - -/* I can't get this to work, both with and without the const on the return - * type I get errors from gcc. One way about ignoring types in a cast, and the - * other about assigning to read-only variables. -const Purple::StatusType -purple_savedstatus_substatus_get_type(substatus) - const Purple::SavedStatus::Sub substatus -*/ - -MODULE = Purple::SavedStatus PACKAGE = Purple::SavedStatus PREFIX = purple_savedstatus_ -PROTOTYPES: ENABLE - -Purple::SavedStatus -purple_savedstatus_new(title, type) - const char *title - Purple::StatusPrimitive type - -void -purple_savedstatus_set_title(status, title) - Purple::SavedStatus status - const char *title - -void -purple_savedstatus_set_type(status, type) - Purple::SavedStatus status - Purple::StatusPrimitive type - -void -purple_savedstatus_set_message(status, message) - Purple::SavedStatus status - const char *message - -void -purple_savedstatus_set_substatus(status, account, type, message) - Purple::SavedStatus status - Purple::Account account - Purple::StatusType type - const char *message - -void -purple_savedstatus_unset_substatus(status, account) - Purple::SavedStatus status - Purple::Account account - -gboolean -purple_savedstatus_delete(title) - const char *title - -Purple::SavedStatus -purple_savedstatus_get_current() - -Purple::SavedStatus -purple_savedstatus_get_default() - -Purple::SavedStatus -purple_savedstatus_get_idleaway() - -gboolean -purple_savedstatus_is_idleaway() - -void -purple_savedstatus_set_idleaway(idleaway) - gboolean idleaway - -Purple::SavedStatus -purple_savedstatus_get_startup() - -Purple::SavedStatus -purple_savedstatus_find(title) - const char *title - -Purple::SavedStatus -purple_savedstatus_find_by_creation_time(creation_time) - time_t creation_time - -Purple::SavedStatus -purple_savedstatus_find_transient_by_type_and_message(type, message) - Purple::StatusPrimitive type - const char *message - -gboolean -purple_savedstatus_is_transient(saved_status) - const Purple::SavedStatus saved_status - -const char * -purple_savedstatus_get_title(saved_status) - const Purple::SavedStatus saved_status - -Purple::StatusPrimitive -purple_savedstatus_get_type(saved_status) - const Purple::SavedStatus saved_status - -const char * -purple_savedstatus_get_message(saved_status) - const Purple::SavedStatus saved_status - -time_t -purple_savedstatus_get_creation_time(saved_status) - const Purple::SavedStatus saved_status - -gboolean -purple_savedstatus_has_substatuses(saved_status) - const Purple::SavedStatus saved_status - -Purple::SavedStatus::Sub -purple_savedstatus_get_substatus(saved_status, account) - Purple::SavedStatus saved_status - Purple::Account account - -void -purple_savedstatus_activate(saved_status) - Purple::SavedStatus saved_status - -void -purple_savedstatus_activate_for_account(saved_status, account) - const Purple::SavedStatus saved_status - Purple::Account account - -MODULE = Purple::SavedStatus::Sub PACKAGE = Purple::SavedStatus::Sub PREFIX = purple_savedstatus_substatus_ -PROTOTYPES: ENABLE - -const char * -purple_savedstatus_substatus_get_message(substatus) - const Purple::SavedStatus::Sub substatus - -MODULE = Purple::SavedStatus PACKAGE = Purple::SavedStatuses PREFIX = purple_savedstatuses_ -PROTOTYPES: ENABLE - -void -purple_savedstatuses_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_savedstatuses_get_all(); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus"))); - } - -void -purple_savedstatuses_get_popular(how_many) - unsigned int how_many -PREINIT: - GList *l, *ll; -PPCODE: - ll = purple_savedstatuses_get_popular(how_many); - for (l = ll; l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus"))); - } - g_list_free(ll); - -Purple::Handle -purple_savedstatuses_get_handle() diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Server.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Server.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Server.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Server.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -#include "module.h" - -MODULE = Purple::Serv PACKAGE = Purple::Serv PREFIX = serv_ -PROTOTYPES: ENABLE - - -void -serv_add_deny(con, a) - Purple::Connection con - const char * a - -void -serv_add_permit(a, b) - Purple::Connection a - const char * b - -void -serv_alias_buddy(buddy) - Purple::BuddyList::Buddy buddy - -void -serv_chat_invite(con, a, b, c) - Purple::Connection con - int a - const char * b - const char * c - -void -serv_chat_leave(a, b) - Purple::Connection a - int b - -int -serv_chat_send(con, a, b, flags) - Purple::Connection con - int a - const char * b - Purple::MessageFlags flags - -void -serv_chat_whisper(con, a, b, c) - Purple::Connection con - int a - const char * b - const char * c - -void -serv_get_info(con, a) - Purple::Connection con - const char * a - -void -serv_got_alias(gc, who, alias) - Purple::Connection gc - const char *who - const char *alias - -void -serv_got_chat_in(g, id, who, chatflags, message, mtime) - Purple::Connection g - int id - const char *who - Purple::MessageFlags chatflags - const char *message - time_t mtime - -void -serv_got_chat_invite(gc, name, who, message, components) - Purple::Connection gc - const char *name - const char *who - const char *message - SV * components -INIT: - HV * t_HV; - HE * t_HE; - SV * t_SV; - GHashTable * t_GHash; - I32 len; - char *t_key, *t_value; -CODE: - t_HV = (HV *)SvRV(components); - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - serv_got_chat_invite(gc, name, who, message, t_GHash); - -void -serv_got_chat_left(g, id) - Purple::Connection g - int id - -void -serv_got_im(gc, who, msg, imflags, mtime) - Purple::Connection gc - const char *who - const char *msg - Purple::MessageFlags imflags - time_t mtime - -Purple::Conversation -serv_got_joined_chat(gc, id, name) - Purple::Connection gc - int id - const char *name - -void -serv_got_typing(gc, name, timeout, state) - Purple::Connection gc - const char *name - int timeout - Purple::TypingState state - -void -serv_got_typing_stopped(gc, name) - Purple::Connection gc - const char *name - -void -serv_join_chat(conn, components) - Purple::Connection conn - HV * components -PREINIT: - HE *t_HE; - SV *t_SV; - I32 len; - GHashTable *t_GHash; - char *t_key, *t_value; -CODE: - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(components); t_HE != NULL; - t_HE = hv_iternext(components)) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(components, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - serv_join_chat(conn, t_GHash); - -void -serv_move_buddy(buddy, group1, group2) - Purple::BuddyList::Buddy buddy - Purple::BuddyList::Group group1 - Purple::BuddyList::Group group2 - -void -serv_reject_chat(con, components) - Purple::Connection con - SV * components -INIT: - HV * t_HV; - HE * t_HE; - SV * t_SV; - GHashTable * t_GHash; - I32 len; - char *t_key, *t_value; -CODE: - t_HV = (HV *)SvRV(components); - t_GHash = g_hash_table_new(g_str_hash, g_str_equal); - - for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) { - t_key = hv_iterkey(t_HE, &len); - t_SV = *hv_fetch(t_HV, t_key, len, 0); - t_value = SvPVutf8_nolen(t_SV); - - g_hash_table_insert(t_GHash, t_key, t_value); - } - serv_reject_chat(con, t_GHash); - -void -serv_rem_deny(con, a) - Purple::Connection con - const char * a - -void -serv_rem_permit(con, a) - Purple::Connection con - const char * a - -void -serv_send_file(gc, who, file) - Purple::Connection gc - const char *who - const char *file - -int -serv_send_im(con, a, b, flags ) - Purple::Connection con - const char * a - const char * b - Purple::MessageFlags flags - -int -serv_send_typing(con, a, state) - Purple::Connection con - const char * a - Purple::TypingState state - -void -serv_set_info(con, a) - Purple::Connection con - const char * a - -void -serv_set_permit_deny(con) - Purple::Connection con - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Signal.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Signal.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Signal.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Signal.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -#include "module.h" -#include "../perl-handlers.h" - -MODULE = Purple::Signal PACKAGE = Purple::Signal PREFIX = purple_signal_ -PROTOTYPES: ENABLE - -void -purple_signal_connect_priority(instance, signal, plugin, callback, priority, data = 0) - Purple::Handle instance - const char *signal - Purple::Plugin plugin - SV *callback - int priority - SV *data -CODE: - purple_perl_signal_connect(plugin, instance, signal, callback, data, priority); - -void -purple_signal_connect(instance, signal, plugin, callback, data = 0) - Purple::Handle instance - const char *signal - Purple::Plugin plugin - SV *callback - SV *data -CODE: - purple_perl_signal_connect(plugin, instance, signal, callback, data, PURPLE_SIGNAL_PRIORITY_DEFAULT); - -void -purple_signal_disconnect(instance, signal, plugin) - Purple::Handle instance - const char *signal - Purple::Plugin plugin -CODE: - purple_perl_signal_disconnect(plugin, instance, signal); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Smiley.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Smiley.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Smiley.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Smiley.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -#include "module.h" - -MODULE = Purple::Smiley PACKAGE = Purple::Smiley PREFIX = purple_smiley_ -PROTOTYPES: ENABLE - -Purple::Smiley -purple_smiley_new(img, shortcut) - Purple::StoredImage img - const char * shortcut - -Purple::Smiley -purple_smiley_new_from_file(shortcut, filepath) - const char * shortcut - const char * filepath - -void -purple_smiley_delete(smiley) - Purple::Smiley smiley - -gboolean -purple_smiley_set_shortcut(smiley, shortcut) - Purple::Smiley smiley - const char * shortcut - -void -purple_smiley_set_data(smiley, data, data_len) - Purple::Smiley smiley - guchar * data - size_t data_len - -const char * -purple_smiley_get_shortcut(smiley) - Purple::Smiley smiley - -const char * -purple_smiley_get_checksum(smiley) - Purple::Smiley smiley - -Purple::StoredImage -purple_smiley_get_stored_image(smiley) - Purple::Smiley smiley - -gconstpointer -purple_smiley_get_data(smiley, len) - Purple::Smiley smiley - size_t * len - -const char * -purple_smiley_get_extension(smiley) - Purple::Smiley smiley - - -gchar_own * -purple_smiley_get_full_path(smiley) - Purple::Smiley smiley - - -MODULE = Purple::Smiley PACKAGE = Purple::Smileys PREFIX = purple_smileys_ -PROTOTYPES: ENABLE - -void -purple_smileys_get_all() -PREINIT: - GList *l; -PPCODE: - for (l = purple_smileys_get_all(); l != NULL; l = g_list_delete_link(l, l)) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Smiley"))); - } - -Purple::Smiley -purple_smileys_find_by_shortcut(shortcut) - const char * shortcut - -Purple::Smiley -purple_smileys_find_by_checksum(checksum) - const char * checksum - -const char * -purple_smileys_get_storing_dir() - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Sound.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Sound.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Sound.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Sound.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#include "module.h" - -MODULE = Purple::Sound PACKAGE = Purple::Sound PREFIX = purple_sound_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *stash = gv_stashpv("Purple::SoundEventID", 1); - - static const constiv *civ, const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_SOUND_##name} - const_iv(BUDDY_ARRIVE), - const_iv(BUDDY_LEAVE), - const_iv(RECEIVE), - const_iv(FIRST_RECEIVE), - const_iv(SEND), - const_iv(CHAT_JOIN), - const_iv(CHAT_LEAVE), - const_iv(CHAT_YOU_SAY), - const_iv(CHAT_SAY), - const_iv(POUNCE_DEFAULT), - const_iv(CHAT_NICK), - }; - - for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) - newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_sound_play_event(event, account) - Purple::SoundEventID event - Purple::Account account - -void -purple_sound_play_file(filename, account) - const char *filename - Purple::Account account diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SSLConn.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SSLConn.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SSLConn.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/SSLConn.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -#include "module.h" - -/* TODO - - -Purple::Ssl::Connection -purple_ssl_connect(account, host, port, func, error_func, data) - Purple::Account account - const char *host - int port - PurpleSslInputFunction func - PurpleSslErrorFunction error_func - -void -purple_ssl_input_add(gsc, func, data) - Purple::Ssl::Connection gsc - Purple::SslInputFunction func - -Purple::Ssl::Connection -purple_ssl_connect_fd(account, fd, func, error_func, data) - Purple::Account account - int fd - PurpleSslInputFunction func - PurpleSslErrorFunction error_func - -*/ - -MODULE = Purple::SSL PACKAGE = Purple::SSL PREFIX = purple_ssl_ -PROTOTYPES: ENABLE - -void -purple_ssl_close(gsc) - Purple::Ssl::Connection gsc - -Purple::Ssl::Ops -purple_ssl_get_ops() - -gboolean -purple_ssl_is_supported() - -size_t -purple_ssl_read(gsc, buffer, len) - Purple::Ssl::Connection gsc - void * buffer - size_t len - -void -purple_ssl_set_ops(ops) - Purple::Ssl::Ops ops - -size_t -purple_ssl_write(gsc, buffer, len) - Purple::Ssl::Connection gsc - void * buffer - size_t len diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Status.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Status.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Status.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Status.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,447 +0,0 @@ -#include "module.h" - -/* TODO - -void -purple_status_type_add_attrs(status_type, id, name, value, purple_status_type_add_attrs) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - ... - -Purple::StatusType -purple_status_type_new_with_attrs(primitive, id, name, saveable, user_settable, independent, attr_id, attr_name, attr_value, purple_status_type_new_with_attrs) - Purple::StatusPrimitive primitive - const char *id - const char *name - gboolean saveable - gboolean user_settable - gboolean independent - const char *attr_id - const char *attr_name - Purple::Value attr_value - ... - -*/ - -/* These break on faceprint's amd64 box -void -purple_status_type_add_attrs_vargs(status_type, args) - Purple::StatusType status_type - va_list args - -void -purple_status_set_active_with_attrs(status, active, args) - Purple::Status status - gboolean active - va_list args - - */ - -MODULE = Purple::Status PACKAGE = Purple::Presence PREFIX = purple_presence_ -PROTOTYPES: ENABLE - -BOOT: -{ - HV *context_stash = gv_stashpv("Purple::Presence::Context", 1); - HV *primitive_stash = gv_stashpv("Purple::Status::Primitive", 1); - - static const constiv *civ, context_const_iv[] = { -#define const_iv(name) {#name, (IV)PURPLE_PRESENCE_CONTEXT_##name} - const_iv(UNSET), - const_iv(ACCOUNT), - const_iv(CONV), - const_iv(BUDDY), - }; - static const constiv primitive_const_iv[] = { -#undef const_iv -#define const_iv(name) {#name, (IV)PURPLE_STATUS_##name} - const_iv(UNSET), - const_iv(OFFLINE), - const_iv(AVAILABLE), - const_iv(UNAVAILABLE), - const_iv(INVISIBLE), - const_iv(AWAY), - const_iv(EXTENDED_AWAY), - const_iv(MOBILE), - }; - - for (civ = context_const_iv + sizeof(context_const_iv) / sizeof(context_const_iv[0]); civ-- > context_const_iv; ) - newCONSTSUB(context_stash, (char *)civ->name, newSViv(civ->iv)); - - for (civ = primitive_const_iv + sizeof(primitive_const_iv) / sizeof(primitive_const_iv[0]); civ-- > primitive_const_iv; ) - newCONSTSUB(primitive_stash, (char *)civ->name, newSViv(civ->iv)); -} - -void -purple_presence_add_list(presence, source_list) - Purple::Presence presence - SV *source_list -PREINIT: - GList *t_GL; - int i, t_len; -PPCODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(source_list)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); - } - purple_presence_add_list(presence, t_GL); - g_list_free(t_GL); - -void -purple_presence_add_status(presence, status) - Purple::Presence presence - Purple::Status status - -gint -purple_presence_compare(presence1, presence2) - Purple::Presence presence1 - Purple::Presence presence2 - -void -purple_presence_destroy(presence) - Purple::Presence presence - -Purple::Account -purple_presence_get_account(presence) - Purple::Presence presence - -Purple::Status -purple_presence_get_active_status(presence) - Purple::Presence presence - -const char * -purple_presence_get_chat_user(presence) - Purple::Presence presence - -Purple::PresenceContext -purple_presence_get_context(presence) - Purple::Presence presence - -Purple::Conversation -purple_presence_get_conversation(presence) - Purple::Presence presence - -time_t -purple_presence_get_idle_time(presence) - Purple::Presence presence - -time_t -purple_presence_get_login_time(presence) - Purple::Presence presence - -Purple::Status -purple_presence_get_status(presence, status_id) - Purple::Presence presence - const char *status_id - -void -purple_presence_get_statuses(presence) - Purple::Presence presence -PREINIT: - GList *l; -PPCODE: - for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status"))); - } - -gboolean -purple_presence_is_available(presence) - Purple::Presence presence - -gboolean -purple_presence_is_idle(presence) - Purple::Presence presence - -gboolean -purple_presence_is_online(presence) - Purple::Presence presence - -gboolean -purple_presence_is_status_active(presence, status_id) - Purple::Presence presence - const char *status_id - -gboolean -purple_presence_is_status_primitive_active(presence, primitive) - Purple::Presence presence - Purple::StatusPrimitive primitive - -Purple::Presence -purple_presence_new(context) - Purple::PresenceContext context - -Purple::Presence -purple_presence_new_for_account(account) - Purple::Account account - -Purple::Presence -purple_presence_new_for_buddy(buddy) - Purple::BuddyList::Buddy buddy - -Purple::Presence -purple_presence_new_for_conv(conv) - Purple::Conversation conv - -void -purple_presence_set_idle(presence, idle, idle_time) - Purple::Presence presence - gboolean idle - time_t idle_time - -void -purple_presence_set_login_time(presence, login_time) - Purple::Presence presence - time_t login_time - -void -purple_presence_set_status_active(presence, status_id, active) - Purple::Presence presence - const char *status_id - gboolean active - -void -purple_presence_switch_status(presence, status_id) - Purple::Presence presence - const char *status_id - -MODULE = Purple::Status PACKAGE = Purple::Primitive PREFIX = purple_primitive_ -PROTOTYPES: ENABLE - -const char * -purple_primitive_get_id_from_type(type) - Purple::StatusPrimitive type - -const char * -purple_primitive_get_name_from_type(type) - Purple::StatusPrimitive type - -Purple::StatusPrimitive -purple_primitive_get_type_from_id(id) - const char *id - -MODULE = Purple::Status PACKAGE = Purple::StatusAttr PREFIX = purple_status_attr_ -PROTOTYPES: ENABLE - -void -purple_status_attr_destroy(attr) - Purple::StatusAttr attr - -const char * -purple_status_attr_get_id(attr) - Purple::StatusAttr attr - -const char * -purple_status_attr_get_name(attr) - Purple::StatusAttr attr - -Purple::Value -purple_status_attr_get_value(attr) - Purple::StatusAttr attr - -Purple::StatusAttr -purple_status_attr_new(id, name, value_type) - const char *id - const char *name - Purple::Value value_type - -MODULE = Purple::Status PACKAGE = Purple::Status PREFIX = purple_status_ -PROTOTYPES: ENABLE - -gint -purple_status_compare(status1, status2) - Purple::Status status1 - Purple::Status status2 - -void -purple_status_destroy(status) - Purple::Status status - -gboolean -purple_status_get_attr_boolean(status, id) - Purple::Status status - const char *id - -int -purple_status_get_attr_int(status, id) - Purple::Status status - const char *id - -const char * -purple_status_get_attr_string(status, id) - Purple::Status status - const char *id - -Purple::Value -purple_status_get_attr_value(status, id) - Purple::Status status - const char *id - -Purple::Handle -purple_status_get_handle() - -const char * -purple_status_get_id(status) - Purple::Status status - -const char * -purple_status_get_name(status) - Purple::Status status - -Purple::Presence -purple_status_get_presence(status) - Purple::Status status - -Purple::StatusType -purple_status_get_type(status) - Purple::Status status - -gboolean -purple_status_is_active(status) - Purple::Status status - -gboolean -purple_status_is_available(status) - Purple::Status status - -gboolean -purple_status_is_exclusive(status) - Purple::Status status - -gboolean -purple_status_is_independent(status) - Purple::Status status - -gboolean -purple_status_is_online(status) - Purple::Status status - -Purple::Status -purple_status_new(status_type, presence) - Purple::StatusType status_type - Purple::Presence presence - -void -purple_status_set_active(status, active) - Purple::Status status - gboolean active - -void -purple_status_set_attr_boolean(status, id, value) - Purple::Status status - const char *id - gboolean value - -void -purple_status_set_attr_string(status, id, value) - Purple::Status status - const char *id - const char *value - -MODULE = Purple::Status PACKAGE = Purple::StatusType PREFIX = purple_status_type_ -PROTOTYPES: ENABLE - -void -purple_status_type_add_attr(status_type, id, name, value) - Purple::StatusType status_type - const char *id - const char *name - Purple::Value value - -void -purple_status_type_destroy(status_type) - Purple::StatusType status_type - -Purple::StatusAttr -purple_status_type_get_attr(status_type, id) - Purple::StatusType status_type - const char *id - -void -purple_status_type_get_attrs(status_type) - Purple::StatusType status_type -PREINIT: - GList *l; -PPCODE: - for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::StatusAttr"))); - } - -Purple::StatusType -purple_status_type_find_with_id(status_types, id) - SV *status_types - const char *id -PREINIT: - GList *t_GL; - int i, t_len; -CODE: - t_GL = NULL; - t_len = av_len((AV *)SvRV(status_types)); - - for (i = 0; i <= t_len; i++) { - t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); - } - RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id); - g_list_free(t_GL); -OUTPUT: - RETVAL - -const char * -purple_status_type_get_id(status_type) - Purple::StatusType status_type - -const char * -purple_status_type_get_name(status_type) - Purple::StatusType status_type - -const char * -purple_status_type_get_primary_attr(status_type) - Purple::StatusType status_type - -Purple::StatusPrimitive -purple_status_type_get_primitive(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_available(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_exclusive(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_independent(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_saveable(status_type) - Purple::StatusType status_type - -gboolean -purple_status_type_is_user_settable(status_type) - Purple::StatusType status_type - -Purple::StatusType -purple_status_type_new(primitive, id, name, user_settable) - Purple::StatusPrimitive primitive - const char *id - const char *name - gboolean user_settable - -Purple::StatusType -purple_status_type_new_full(primitive, id, name, saveable, user_settable, independent) - Purple::StatusPrimitive primitive - const char *id - const char *name - gboolean saveable - gboolean user_settable - gboolean independent - -void -purple_status_type_set_primary_attr(status_type, attr_id) - Purple::StatusType status_type - const char *attr_id diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Stringref.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Stringref.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Stringref.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Stringref.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#include "module.h" - -MODULE = Purple::Stringref PACKAGE = Purple::Stringref PREFIX = purple_stringref_ -PROTOTYPES: ENABLE - -int -purple_stringref_cmp(s1, s2) - Purple::Stringref s1 - Purple::Stringref s2 - -size_t -purple_stringref_len(stringref) - Purple::Stringref stringref - -Purple::Stringref -purple_stringref_new(class, value) - const char *value - C_ARGS: - value - -Purple::Stringref -purple_stringref_new_noref(class, value) - const char *value - C_ARGS: - value - -Purple::Stringref -purple_stringref_ref(stringref) - Purple::Stringref stringref - -void -purple_stringref_unref(stringref) - Purple::Stringref stringref - -const char * -purple_stringref_value(stringref) - Purple::Stringref stringref diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/typemap qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/typemap --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/typemap 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/typemap 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -TYPEMAP -guint T_IV -gint T_IV -const gint * T_PTR -const guint * T_PTR -const guint8 * T_PTR -guint8 T_IV -guint8 * T_PTR -time_t T_IV -gboolean T_BOOL -gpointer T_PurpleObj -gconstpointer T_PTR -const gchar * T_PV -const char * T_PV -const char ** T_PTR -char ** T_PTR -gchar T_IV -gchar * T_PV -gchar_own * T_GCHAR_OWN -guchar T_IV -guchar * T_PV -guchar ** T_PTR -const guchar * T_PV -char * T_PV -int * T_PTR -long * T_PTR -size_t * T_PTR -GCallback T_PTR -va_list T_PTR -GString * T_PTR -GData * T_PTR -GData ** T_PTR -const unsigned char * T_PV -struct tm * T_PTR -const struct tm * T_PTR -xmlnode * T_PTR -const xmlnode * T_PTR -gssize T_IV -const void * T_PTR - -Purple::Account T_PurpleObj -Purple::Account::Option T_PurpleObj -Purple::Account::UserSplit T_PurpleObj - -Purple::Buddy::Icon T_PurpleObj -Purple::Buddy::Icon::Spec T_PurpleObj -Purple::BuddyList T_PurpleObj -Purple::BuddyList::Buddy T_PurpleObj -Purple::BuddyList::Chat T_PurpleObj -Purple::BuddyList::Contact T_PurpleObj -Purple::BuddyList::Group T_PurpleObj -Purple::BuddyList::Node T_PurpleObj -Purple::BuddyList::NodeFlags T_IV -Purple::BuddyList::NodeType T_IV - -Purple::Cipher T_PurpleObj -Purple::CipherCaps T_IV -Purple::Cipher::Ops T_PurpleObj -Purple::Cipher::Context T_PurpleObj -Purple::Cmd::Flag T_IV -Purple::Cmd::Id T_IV -Purple::Cmd::Priority T_IV -Purple::Cmd::Ret T_IV -Purple::Connection T_PurpleObj -Purple::Conversation T_PurpleObj -Purple::Conversation::Chat T_PurpleObj -Purple::Conversation::ChatBuddy T_PurpleObj -Purple::Conversation::IM T_PurpleObj -Purple::Core T_PurpleObj - -Purple::Desktop::Item T_PurpleObj -Purple::DesktopItemType T_IV - -Purple::Handle T_PurpleObj - -Purple::IconScaleRules T_IV - -Purple::Log T_PurpleObj -Purple::LogType T_IV -Purple::Log::CommonLoggerData T_PurpleObj -Purple::Log::Logger T_PurpleObj -Purple::Log::ReadFlags T_PurpleObj -Purple::Log::Set T_PurpleObj - -Purple::Menu::Action T_PurpleObj - -Purple::NetworkListenData T_PurpleObj -Purple::NetworkListenCallback T_PTR - -Purple::NotifyCloseCallback T_PTR -Purple::NotifyMsgType T_IV -Purple::NotifySearchButtonType T_IV -Purple::NotifySearchResults T_PurpleObj -Purple::NotifySearchColumn T_PurpleObj -Purple::NotifySearchButton T_PurpleObj -Purple::NotifyType T_IV -Purple::NotifyUserInfo T_PurpleObj -Purple::NotifyUserInfoEntry T_PurpleObj - -Purple::Plugin T_PurpleObj -Purple::PluginType T_IV -Purple::PluginUiInfo T_PurpleObj -Purple::Plugin::Action T_PurpleObj -Purple::Plugin::Info T_PurpleObj -Purple::Plugin::Loader::Info T_PurpleObj -Purple::Plugin::Protocol::Info T_PurpleObj -Purple::PrefType T_IV -Purple::PluginPref T_PurpleObj -Purple::PluginPrefType T_IV -Purple::PluginPref::Frame T_PurpleObj -Purple::Pounce T_PurpleObj -Purple::PounceEvent T_IV -Purple::Presence T_PurpleObj -Purple::PrivacyType T_IV -Purple::ProtocolOptions T_IV -Purple::ProxyInfo T_PurpleObj -Purple::ProxyType T_IV - -Purple::RequestFieldType T_IV -Purple::RequestType T_IV -Purple::Request::Field T_PurpleObj -Purple::Request::Fields T_PurpleObj -Purple::Request::Field::Group T_PurpleObj - -Purple::Roomlist T_PurpleObj -Purple::Roomlist::Room T_PurpleObj -Purple::Roomlist::Field T_PurpleObj -Purple::RoomlistFieldType T_IV -Purple::RoomlistRoomType T_IV - -Purple::SavedStatus T_PurpleObj -const Purple::SavedStatus T_PurpleObj -Purple::SavedStatus::Sub T_PurpleObj -const Purple::SavedStatus::Sub T_PurpleObj -Purple::SoundEventID T_IV - -Purple::Input::Condition T_PurpleObj -Purple::SslErrorType T_IV -Purple::Ssl::Connection T_PurpleObj -Purple::Ssl::Ops T_PurpleObj - -Purple::Presence T_PurpleObj -Purple::PresenceContext T_IV -Purple::Smiley T_PurpleObj -Purple::Status T_PurpleObj -Purple::StatusAttr T_PurpleObj -Purple::StatusPrimitive T_IV -Purple::StatusType T_PurpleObj -const Purple::StatusType T_PurpleObj - -Purple::StoredImage T_PurpleObj -Purple::String::Format::Type T_IV -Purple::Stringref T_PurpleObj -Purple::Util::FetchUrlData T_PTR -Purple::Util::InfoFieldFormatCallback T_PTR -Purple::Value T_PurpleObj - -Purple::Xfer T_PurpleObj -Purple::XferType T_IV -Purple::XferStatusType T_IV - -Purple::XMLNode T_PurpleObj -XMLNode::Type T_IV - -/* enums */ - -/* certificate.h */ -Purple::Certificate T_PurpleObj -Purple::Certificate::Pool T_PurpleObj -Purple::Certificate::Scheme T_PurpleObj -Purple::Certificate::Verifier T_PurpleObj -Purple::Certificate::VerificationRequest T_PurpleObj -Purple::Certificate::VerificationStatus T_IV - -/* cipher.h */ -Purple::Cipher::BatchMode T_IV - -/* blist.h */ - -/* debug.h */ -Purple::DebugLevel T_IV - -/* conversation.h */ -Purple::ConvChatBuddyFlags T_IV -Purple::ConvUpdateType T_IV -Purple::ConversationType T_IV -Purple::MessageFlags T_IV -Purple::TypingState T_IV -Purple::UnseenState T_IV - -/* connection.h */ -Purple::ConnectionFlags T_IV -Purple::ConnectionState T_IV - -/* whiteboard.h */ -Purple::Whiteboard T_PurpleObj - -INPUT - -T_PurpleObj - $var = purple_perl_ref_object($arg) - -OUTPUT - -T_PurpleObj - $arg = purple_perl_bless_object($var, \"$type\"); - -T_GCHAR_OWN - /* used when we can directly own the returned string. */ - /* we have to copy in the case when perl's malloc != gtk's malloc, - * so best copy all the time. */ - sv_setpv ((SV*)$arg, $var); - SvUTF8_on ($arg); - g_free ($var); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Util.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Util.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Util.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Util.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,518 +0,0 @@ -#include "module.h" - -static void -purple_perl_util_url_cb(PurpleUtilFetchUrlData *url_data, void *user_data, - const gchar *url_text, size_t size, - const gchar *error_message) -{ - SV *sv = (SV *)user_data; - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - - XPUSHs(sv_2mortal(newSVpvn(url_text, size))); - PUTBACK; - - call_sv(sv, G_EVAL | G_SCALAR); - SPAGAIN; - - /* XXX Make sure this destroys it correctly and that we don't want - * something like sv_2mortal(sv) or something else here instead. */ - SvREFCNT_dec(sv); - - PUTBACK; - FREETMPS; - LEAVE; -} - -static void markup_find_tag_foreach(GQuark key_id, char *data, HV *hv) { - const char *key = NULL; - key = g_quark_to_string(key_id); - hv_store(hv, key, strlen(key), newSVpv(data, 0), 0); -} - -MODULE = Purple::Util PACKAGE = Purple::Util PREFIX = purple_ -PROTOTYPES: ENABLE - -gboolean -purple_running_gnome() - -gboolean -purple_running_kde() - -gboolean -purple_running_osx() - -int -purple_build_dir(path, mode) - const char *path - int mode - -gboolean -purple_email_is_valid(address) - const char *address - -const char * -purple_escape_filename(str) - const char *str - -gchar_own * -purple_fd_get_ip(fd) - int fd - -const gchar * -purple_home_dir() - -gchar_own* -purple_message_meify(SV *msg) - PREINIT: - char *message = NULL; - gboolean ret; - gsize len; - CODE: - message = SvPV(msg, len); - message = g_strndup(message, len); - ret = purple_message_meify(message, len); - if(ret) { - /* message will get g_free()'d later on, since RETVAL is gchar_own* */ - RETVAL = message; - } else { - RETVAL = NULL; - g_free(message); - } - OUTPUT: - RETVAL - -FILE * -purple_mkstemp(OUTLIST gchar_own *path, binary) - gboolean binary - PROTOTYPE: $ - -const char * -purple_normalize(account, str) - Purple::Account account - const char *str - -gboolean -purple_program_is_valid(program) - const char *program - -gchar_own * -purple_strdup_withhtml(src) - const gchar *src - -gchar_own * -purple_text_strip_mnemonic(in) - const char *in - -time_t -purple_time_build(year, month, day, hour, min, sec) - int year - int month - int day - int hour - int min - int sec - -const char * -purple_time_format(tm) - const struct tm *tm - -const char * -purple_unescape_filename(str) - const char *str - -gchar_own * -purple_unescape_html(html) - const char *html - -const char * -purple_url_decode(str) - const char *str - -const char * -purple_url_encode(str) - const char *str - - # XXX: this made perl assert()... - # - #gboolean - #purple_url_parse(url, OUTLIST gchar_own *ret_host, OUTLIST int ret_port, OUTLIST gchar_own *ret_path, OUTLIST gchar_own *ret_user, OUTLIST gchar_own *ret_passwd) - # const char *url - # PROTOTYPE: $ - -void -purple_url_parse(url) - const char *url - PREINIT: - char *ret_host; - int ret_port; - char *ret_path; - char *ret_user; - char *ret_passwd; - gboolean ret; - PPCODE: - ret = purple_url_parse(url, &ret_host, &ret_port, &ret_path, &ret_user, &ret_passwd); - XPUSHs(sv_2mortal(newSViv(ret))); - XPUSHs(ret_host ? sv_2mortal(newSVpv(ret_host, 0)) : sv_2mortal(newSV(0))); - XPUSHs(sv_2mortal(newSViv(ret_port))); - XPUSHs(ret_path ? sv_2mortal(newSVpv(ret_path, 0)) : sv_2mortal(newSV(0))); - XPUSHs(ret_user ? sv_2mortal(newSVpv(ret_user, 0)) : sv_2mortal(newSV(0))); - XPUSHs(ret_passwd ? sv_2mortal(newSVpv(ret_passwd, 0)) : sv_2mortal(newSV(0))); - g_free(ret_host); - g_free(ret_path); - g_free(ret_user); - g_free(ret_passwd); - - -const char * -purple_user_dir() - -const char * -purple_utf8_strftime(const char *format, const struct tm *tm); - -gboolean -purple_utf8_has_word(haystack, needle) - const char* haystack - const char* needle - -gchar_own* -purple_utf8_ncr_decode(in) - const char* in - -gchar_own* -purple_utf8_ncr_encode(in) - const char* in - -gchar_own* -purple_utf8_salvage(str) - const char* str - -int -purple_utf8_strcasecmp(a, b) - const char* a - const char* b - -gchar_own* -purple_utf8_try_convert(str) - const char* str - -gboolean -purple_ip_address_is_valid(ip) - const char* ip - -const char* -purple_normalize_nocase(account, str) - Purple::Account account - const char* str - -const gchar* -purple_gai_strerror(errnum) - gint errnum - -void -purple_got_protocol_handler_uri(uri) - const char* uri - -gchar_own* -purple_base16_encode(const guchar *data, gsize length(data)) - PROTOTYPE: $ - -gchar_own* -purple_base16_encode_chunked(const guchar *data, gsize length(data)) - PROTOTYPE: $ - -gchar_own* -purple_base64_encode(const guchar *data, gsize length(data)) - PROTOTYPE: $ - -void -purple_restore_default_signal_handlers() - -SV * -purple_base16_decode(str) - const char* str - PREINIT: - gsize len; - guchar *ret; - CODE: - ret = purple_base16_decode(str, &len); - if(len) { - RETVAL = newSVpv((gchar *)ret, len); - } else { - g_free(ret); - XSRETURN_UNDEF; - } - g_free(ret); - OUTPUT: - RETVAL - -SV* -purple_base64_decode(str) - const char* str - PREINIT: - gsize len; - guchar *ret; - CODE: - ret = purple_base64_decode(str, &len); - if(len) { - RETVAL = newSVpv((gchar *)ret, len); - } else { - g_free(ret); - XSRETURN_UNDEF; - } - g_free(ret); - OUTPUT: - RETVAL - -SV* -purple_quotedp_decode(str) - const char* str - PREINIT: - gsize len; - guchar *ret; - CODE: - ret = purple_quotedp_decode(str, &len); - if(len) { - RETVAL = newSVpv((gchar *)ret, len); - } else { - g_free(ret); - XSRETURN_UNDEF; - } - g_free(ret); - OUTPUT: - RETVAL - -void -purple_uri_list_extract_uris(uri_list) - const gchar* uri_list - PREINIT: - GList *l = NULL, *gl = NULL; - PPCODE: - gl = purple_uri_list_extract_uris(uri_list); - for(l = gl; l; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - g_list_free(gl); - -void -purple_uri_list_extract_filenames(uri_list) - const gchar* uri_list - PREINIT: - GList *l = NULL, *gl = NULL; - PPCODE: - gl = purple_uri_list_extract_filenames(uri_list); - for(l = gl; l; l = l->next) { - XPUSHs(sv_2mortal(newSVpv(l->data, 0))); - g_free(l->data); - } - g_list_free(gl); - -MODULE = Purple::Util PACKAGE = Purple::Util::Str PREFIX = purple_str_ -PROTOTYPES: ENABLE - -gchar_own * -purple_str_add_cr(str) - const char *str - -gchar_own * -purple_str_binary_to_ascii(const unsigned char *binary, guint length(binary)) - PROTOTYPE: $ - -gboolean -purple_str_has_prefix(s, p) - const char *s - const char *p - -gboolean -purple_str_has_suffix(s, x) - const char *s - const char *x - -gchar_own * -purple_str_seconds_to_string(sec) - guint sec - -gchar_own * -purple_str_size_to_units(size) - size_t size - -time_t -purple_str_to_time(timestamp, utc = FALSE, tm = NULL, OUTLIST long tz_off, OUTLIST const char *rest) - const char *timestamp - gboolean utc - struct tm *tm - PROTOTYPE: $;$$ - -MODULE = Purple::Util PACKAGE = Purple::Util::Date PREFIX = purple_date_ -PROTOTYPES: ENABLE - -const char * -purple_date_format_full(tm) - const struct tm *tm - -const char * -purple_date_format_long(tm) - const struct tm *tm - -const char * -purple_date_format_short(tm) - const struct tm *tm - -MODULE = Purple::Util PACKAGE = Purple::Util::Markup PREFIX = purple_markup_ -PROTOTYPES: ENABLE - -gboolean -purple_markup_extract_info_field(str, len, user_info, start_token, skip, end_token, check_value, no_value_token, display_name, is_link, link_prefix, format_cb) - const char *str - int len - Purple::NotifyUserInfo user_info - const char *start_token - int skip - const char *end_token - char check_value - const char *no_value_token - const char *display_name - gboolean is_link - const char *link_prefix - Purple::Util::InfoFieldFormatCallback format_cb - - # XXX: returning start/end to perl doesn't make a lot of sense... - # XXX: the actual tag data can be gotten with $start =~ s/$end//g; -void -purple_markup_find_tag(needle, haystack) - const char *needle - const char *haystack - PREINIT: - const char *start = NULL; - const char *end = NULL; - GData *attributes; - gboolean ret; - HV *hv = NULL; - PPCODE: - ret = purple_markup_find_tag(needle, haystack, &start, &end, &attributes); - if(!ret) XSRETURN_UNDEF; - - hv = newHV(); - g_datalist_foreach(&attributes, (GDataForeachFunc) markup_find_tag_foreach, hv); - g_datalist_clear(&attributes); - - XPUSHs(sv_2mortal(newSVpv(start, 0))); - XPUSHs(sv_2mortal(newSVpv(end, 0))); - XPUSHs(sv_2mortal(newRV_noinc((SV *) hv))); - -gchar_own * -purple_markup_get_tag_name(tag) - const char *tag - -void -purple_markup_html_to_xhtml(html, OUTLIST gchar_own *dest_xhtml, OUTLIST gchar_own *dest_plain) - const char *html - PROTOTYPE: $ - -gchar_own * -purple_markup_linkify(str) - const char *str - -gchar_own * -purple_markup_slice(str, x, y) - const char *str - guint x - guint y - -gchar_own * -purple_markup_strip_html(str) - const char *str - -gchar_own * -purple_markup_get_css_property(style, opt) - const gchar* style - const gchar* opt - -SV* -purple_markup_unescape_entity(text) - const char* text - PREINIT: - int length; - CODE: - { - const char *str = purple_markup_unescape_entity(text, &length); - if(length) { - RETVAL = newSVpv(str, length); - } else { - XSRETURN_UNDEF; - } - } - OUTPUT: - RETVAL - - -MODULE = Purple::Util PACKAGE = Purple::Util PREFIX = purple_util_ -PROTOTYPES: ENABLE - - #XXX: expand... -void -purple_util_fetch_url(plugin, url, full, user_agent, http11, cb) - Purple::Plugin plugin - const char *url - gboolean full - const char *user_agent - gboolean http11 - SV * cb -PREINIT: - PurpleUtilFetchUrlData *data; -PPCODE: - /* XXX: i don't like this... only plugins can use it... */ - SV *sv = purple_perl_sv_from_fun(plugin, cb); - - if (sv != NULL) { - data = purple_util_fetch_url(url, full, user_agent, http11, - purple_perl_util_url_cb, sv); - XPUSHs(sv_2mortal(purple_perl_bless_object(data, "Purple::Util::FetchUrlData"))); - } else { - purple_debug_warning("perl", "Callback not a valid type, only strings and coderefs allowed in purple_util_fetch_url.\n"); - XSRETURN_UNDEF; - } - -void -purple_util_set_user_dir(dir) - const char *dir - -gboolean -purple_util_write_data_to_file(filename, const char *data, size_t length(data)) - const char *filename - PROTOTYPE: $$ - -void -purple_util_set_current_song(title, artist, album) - const char *title - const char *artist - const char *album - -gchar_own* -purple_util_format_song_info(title, artist, album, unused) - const char* title - const char* artist - const char* album - gpointer unused - -const char* -purple_util_get_image_extension(const char *data, size_t length(data)) - PROTOTYPE: $ - -gchar_own* -purple_util_get_image_filename(const char *image_data, size_t length(image_data)) - PROTOTYPE: $ - -Purple::XMLNode -purple_util_read_xml_from_file(filename, description) - const char* filename - const char* description - -gboolean -purple_util_write_data_to_file_absolute(filename_full, char *data, gssize length(data)) - const char* filename_full - PROTOTYPE: $$ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Whiteboard.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Whiteboard.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Whiteboard.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/Whiteboard.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -#include "module.h" - -MODULE = Purple::Whiteboard PACKAGE = Purple::Whiteboard PREFIX = purple_whiteboard_ -PROTOTYPES: ENABLE - -void -purple_whiteboard_clear(wb) - Purple::Whiteboard wb - -Purple::Whiteboard -purple_whiteboard_create(account, who, state) - Purple::Account account - const char* who - int state - -void -purple_whiteboard_destroy(wb) - Purple::Whiteboard wb - -void -purple_whiteboard_draw_line(wb, x1, y1, x2, y2, color, size) - Purple::Whiteboard wb - int x1 - int y1 - int x2 - int y2 - int color - int size - -void -purple_whiteboard_draw_point(wb, x, y, color, size) - Purple::Whiteboard wb - int x - int y - int color - int size - -Purple::Whiteboard -purple_whiteboard_get_session(account, who) - Purple::Account account - const char* who - -void -purple_whiteboard_send_brush(wb, size, color) - Purple::Whiteboard wb - int size - int color - -void -purple_whiteboard_send_clear(wb) - Purple::Whiteboard wb - -void -purple_whiteboard_set_brush(wb, size, color) - Purple::Whiteboard wb - int size - int color - -void -purple_whiteboard_set_dimensions(wb, width, height) - Purple::Whiteboard wb - int width - int height - -gboolean -purple_whiteboard_get_brush(wb, OUTLIST int size, OUTLIST int color) - Purple::Whiteboard wb - PROTOTYPE: $ - -gboolean -purple_whiteboard_get_dimensions(wb, OUTLIST int width, OUTLIST int height) - Purple::Whiteboard wb - PROTOTYPE: $ - -void -purple_whiteboard_start(wb) - Purple::Whiteboard wb - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/XMLNode.xs qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/XMLNode.xs --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/XMLNode.xs 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/common/XMLNode.xs 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -#include "module.h" - -MODULE = Purple::XMLNode PACKAGE = Purple::XMLNode PREFIX = xmlnode_ -PROTOTYPES: ENABLE - -Purple::XMLNode -xmlnode_copy(src) - Purple::XMLNode src - -void -xmlnode_free(node) - Purple::XMLNode node - -Purple::XMLNode -xmlnode_from_str(const char *str, gssize length(str)) - PROTOTYPE: $ - -const char * -xmlnode_get_name(node) - Purple::XMLNode node - CODE: - RETVAL = node->name; - OUTPUT: - RETVAL - -const char * -xmlnode_get_attrib(node, attr) - Purple::XMLNode node - const char *attr - -Purple::XMLNode -xmlnode_get_child(parent, name) - Purple::XMLNode parent - const char *name -PREINIT: - xmlnode *tmp; -CODE: - if (!name || *name == '\0') { - tmp = parent->child; - while (tmp && tmp->type != XMLNODE_TYPE_TAG) - tmp = tmp->next; - RETVAL = tmp; - } else - RETVAL = xmlnode_get_child(parent, name); -OUTPUT: - RETVAL - -Purple::XMLNode -xmlnode_get_child_with_namespace(parent, name, xmlns) - Purple::XMLNode parent - const char *name - const char *xmlns - -gchar_own * -xmlnode_get_data(node) - Purple::XMLNode node - -Purple::XMLNode -xmlnode_get_next(node) - Purple::XMLNode node -PREINIT: - xmlnode *tmp; -CODE: - tmp = node->next; - while (tmp && tmp->type != XMLNODE_TYPE_TAG) - tmp = tmp->next; - RETVAL = tmp; -OUTPUT: - RETVAL - -Purple::XMLNode -xmlnode_get_next_twin(node) - Purple::XMLNode node - -void -xmlnode_insert_child(parent, child) - Purple::XMLNode parent - Purple::XMLNode child - -void -xmlnode_insert_data(node, data, size) - Purple::XMLNode node - const char *data - gssize size - -Purple::XMLNode -xmlnode_new(class, name) - const char *name - C_ARGS: - name - -Purple::XMLNode -xmlnode_new_child(parent, name) - Purple::XMLNode parent - const char *name - -void -xmlnode_remove_attrib(node, attr) - Purple::XMLNode node - const char *attr - -void -xmlnode_set_attrib(node, attr, value) - Purple::XMLNode node - const char *attr - const char *value - -gchar_own * -xmlnode_to_formatted_str(node) - Purple::XMLNode node - CODE: - RETVAL = xmlnode_to_formatted_str(node, NULL); - OUTPUT: - RETVAL - -gchar_own * -xmlnode_to_str(node) - Purple::XMLNode node - CODE: - RETVAL = xmlnode_to_str(node, NULL); - OUTPUT: - RETVAL diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -perl_dirs = common - -plugin_LTLIBRARIES = perl.la - -perl_la_LDFLAGS = -module -avoid-version -perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS) -perl_la_SOURCES = \ - perl.c \ - perl-common.c \ - perl-common.h \ - perl-handlers.c \ - perl-handlers.h - -perl_la_DEPENDENCIES = \ - .libs/libperl_orig.a \ - .libs/DynaLoader.a - -.libs/libperl_orig.a: - @mkdir -p .libs - @rm -f .libs/libperl_orig.a - @if [ x$(LIBPERL_A) = x ]; then \ - touch .libs/libperl_orig.a; \ - else \ - $(LN_S) $(LIBPERL_A) .libs/libperl_orig.a; \ - fi - -.libs/DynaLoader.a: - @mkdir -p .libs - @rm -f .libs/DynaLoader.a - @if [ x$(DYNALOADER_A) = x ]; then \ - touch .libs/DynaLoader.a; \ - else \ - $(LN_S) $(DYNALOADER_A) .libs/DynaLoader.a; \ - fi - -common_sources = \ - common/Account.xs \ - common/AccountOpts.xs \ - common/BuddyIcon.xs \ - common/BuddyList.xs \ - common/Certificate.xs \ - common/Cipher.xs \ - common/Cmds.xs \ - common/Core.xs \ - common/Connection.xs \ - common/Conversation.xs \ - common/Debug.xs \ - common/FT.xs \ - common/Idle.xs \ - common/ImgStore.xs \ - common/Log.xs \ - common/Makefile.PL.in \ - common/Network.xs \ - common/Notify.xs \ - common/Plugin.xs \ - common/PluginPref.xs \ - common/Pounce.xs \ - common/Prefs.xs \ - common/Privacy.xs \ - common/Proxy.xs \ - common/Prpl.xs \ - common/Purple.pm \ - common/Purple.xs \ - common/Request.xs \ - common/Roomlist.xs \ - common/SSLConn.xs \ - common/SavedStatuses.xs \ - common/Server.xs \ - common/Signal.xs \ - common/Smiley.xs \ - common/Sound.xs \ - common/Status.xs \ - common/Stringref.xs \ - common/Util.xs \ - common/Whiteboard.xs \ - common/XMLNode.xs \ - common/module.h \ - common/typemap -# common/fallback/const-c.inc \ -# common/fallback/const-xs.inc - -perl_scripts = \ - scripts/function_list.pl \ - scripts/signals-test.pl - -EXTRA_DIST = \ - Makefile.mingw \ - common/Makefile.mingw \ - $(common_sources) \ - $(perl_scripts) - -common/Makefile: common/Makefile.PL - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi - @cd common && $(perlpath) Makefile.PL - -common/Makefile.PL: common/Makefile.PL.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -all-local: common/Makefile - @for dir in $(perl_dirs); do \ - cd $$dir && \ - if [ ! -f Makefile ]; then \ - $(perlpath) Makefile.PL; \ - fi && \ - ($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \ - $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \ - cd ..; \ - done - -install-exec-local: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) install; \ - cd ..; \ - done - -# Evil Hack (TM) -# ... which doesn't work with DESTDIR installs. FIXME? -uninstall-local: - @for dir in $(perl_dirs); do \ - cd $$dir && \ - `$(MAKE) uninstall | grep unlink | sed -e 's#/usr#${prefix}#' -e 's#unlink#rm -f#'` && \ - cd ..; \ - done - -clean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) clean; \ - cd ..; \ - done - rm -f *.so - -distclean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) realclean; \ - rm -f Makefile.PL; \ - rm -f Makefile.old; \ - rm -f Makefile; \ - cd ..; \ - done - - @rm -f Makefile -# @rm -f common/const-c.inc common/const-xs.inc - - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(PERL_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,863 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/perl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -am_perl_la_OBJECTS = perl.lo perl-common.lo perl-handlers.lo -perl_la_OBJECTS = $(am_perl_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(perl_la_SOURCES) -DIST_SOURCES = $(perl_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -perl_dirs = common -plugin_LTLIBRARIES = perl.la -perl_la_LDFLAGS = -module -avoid-version -perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS) -perl_la_SOURCES = \ - perl.c \ - perl-common.c \ - perl-common.h \ - perl-handlers.c \ - perl-handlers.h - -perl_la_DEPENDENCIES = \ - .libs/libperl_orig.a \ - .libs/DynaLoader.a - -common_sources = \ - common/Account.xs \ - common/AccountOpts.xs \ - common/BuddyIcon.xs \ - common/BuddyList.xs \ - common/Certificate.xs \ - common/Cipher.xs \ - common/Cmds.xs \ - common/Core.xs \ - common/Connection.xs \ - common/Conversation.xs \ - common/Debug.xs \ - common/FT.xs \ - common/Idle.xs \ - common/ImgStore.xs \ - common/Log.xs \ - common/Makefile.PL.in \ - common/Network.xs \ - common/Notify.xs \ - common/Plugin.xs \ - common/PluginPref.xs \ - common/Pounce.xs \ - common/Prefs.xs \ - common/Privacy.xs \ - common/Proxy.xs \ - common/Prpl.xs \ - common/Purple.pm \ - common/Purple.xs \ - common/Request.xs \ - common/Roomlist.xs \ - common/SSLConn.xs \ - common/SavedStatuses.xs \ - common/Server.xs \ - common/Signal.xs \ - common/Smiley.xs \ - common/Sound.xs \ - common/Status.xs \ - common/Stringref.xs \ - common/Util.xs \ - common/Whiteboard.xs \ - common/XMLNode.xs \ - common/module.h \ - common/typemap - -# common/fallback/const-c.inc \ -# common/fallback/const-xs.inc -perl_scripts = \ - scripts/function_list.pl \ - scripts/signals-test.pl - -EXTRA_DIST = \ - Makefile.mingw \ - common/Makefile.mingw \ - $(common_sources) \ - $(perl_scripts) - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(PERL_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/perl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/perl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -perl.la: $(perl_la_OBJECTS) $(perl_la_DEPENDENCIES) - $(LINK) -rpath $(plugindir) $(perl_la_LDFLAGS) $(perl_la_OBJECTS) $(perl_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl-common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl-handlers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/common $(distdir)/scripts - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) all-local -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: install-exec-local - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-local \ - uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ - clean-generic clean-libtool clean-pluginLTLIBRARIES ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am \ - install-exec-local install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am uninstall-local \ - uninstall-pluginLTLIBRARIES - - -.libs/libperl_orig.a: - @mkdir -p .libs - @rm -f .libs/libperl_orig.a - @if [ x$(LIBPERL_A) = x ]; then \ - touch .libs/libperl_orig.a; \ - else \ - $(LN_S) $(LIBPERL_A) .libs/libperl_orig.a; \ - fi - -.libs/DynaLoader.a: - @mkdir -p .libs - @rm -f .libs/DynaLoader.a - @if [ x$(DYNALOADER_A) = x ]; then \ - touch .libs/DynaLoader.a; \ - else \ - $(LN_S) $(DYNALOADER_A) .libs/DynaLoader.a; \ - fi - -common/Makefile: common/Makefile.PL - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi - @cd common && $(perlpath) Makefile.PL - -common/Makefile.PL: common/Makefile.PL.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -all-local: common/Makefile - @for dir in $(perl_dirs); do \ - cd $$dir && \ - if [ ! -f Makefile ]; then \ - $(perlpath) Makefile.PL; \ - fi && \ - ($(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS) || \ - $(MAKE) CC="$(CC)" CCFLAGS="$(PERL_CFLAGS) $(CFLAGS)" $(PERL_EXTRA_OPTS)) && \ - cd ..; \ - done - -install-exec-local: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) install; \ - cd ..; \ - done - -# Evil Hack (TM) -# ... which doesn't work with DESTDIR installs. FIXME? -uninstall-local: - @for dir in $(perl_dirs); do \ - cd $$dir && \ - `$(MAKE) uninstall | grep unlink | sed -e 's#/usr#${prefix}#' -e 's#unlink#rm -f#'` && \ - cd ..; \ - done - -clean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) clean; \ - cd ..; \ - done - rm -f *.so - -distclean-generic: - @for dir in $(perl_dirs); do \ - cd $$dir; \ - $(MAKE) realclean; \ - rm -f Makefile.PL; \ - rm -f Makefile.old; \ - rm -f Makefile; \ - cd ..; \ - done - - @rm -f Makefile -# @rm -f common/const-c.inc common/const-xs.inc - - @if test "x${top_srcdir}" != "x${top_builddir}"; then \ - for f in ${common_sources}; do \ - srcloc=${srcdir}; \ - case $$srcloc in /*) ;; *) srcloc=../${srcdir} ;; esac; \ - ${LN_S} -f $$srcloc/$$f $$f; \ - done; \ - fi -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for perl plugin loader plugin. -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = perl - -# Perl headers with /* /* */ type comments.. Turn off warnings. -GCCWARNINGS += -Wno-comment - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PERL_LIB_TOP)/CORE - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(PERL_LIB_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = perl.c \ - perl-common.c \ - perl-handlers.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgmodule-2.0 \ - -lgobject-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lperl510 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - $(MAKE) -C ./common -f $(MINGW_MAKEFILE) - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PLUGINS_DIR) - $(MAKE) -C ./common -f $(MINGW_MAKEFILE) install - -$(OBJECTS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll $(TARGET).dll.a: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--export-all-symbols -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -rf $(OBJECTS) - rm -rf $(TARGET).dll $(TARGET).dll.a - $(MAKE) -C ./common -f $(MINGW_MAKEFILE) clean - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,719 +0,0 @@ -/* - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifdef HAVE_CONFIG_H -#include -# ifdef HAVE_LIMITS_H -# include -# ifndef NAME_MAX -# define NAME_MAX _POSIX_NAME_MAX -# endif -# endif -#endif - -#ifdef DEBUG -# undef DEBUG -#endif - -#undef PACKAGE - -#define group perl_group - -#ifdef _WIN32 -/* This took me an age to figure out.. without this __declspec(dllimport) - * will be ignored. - */ -# define HASATTRIBUTE -#endif - -#include - -#ifndef _SEM_SEMUN_UNDEFINED -# define HAS_UNION_SEMUN -#endif - -#include -#include - -#ifndef _WIN32 -# include -#endif - -#undef PACKAGE - -#ifndef _WIN32 -# include -#else - /* We're using perl's win32 port of this */ -# define dirent direct -#endif - -#undef group - -/* perl module support */ -#ifdef _WIN32 -EXTERN_C void boot_Win32CORE (pTHX_ CV* cv); -#endif - -#ifdef OLD_PERL -extern void boot_DynaLoader _((CV * cv)); -#else -extern void boot_DynaLoader _((pTHX_ CV * cv)); /* perl is so wacky */ -#endif - -#undef _ -#ifdef DEBUG -# undef DEBUG -#endif -#ifdef _WIN32 -# undef pipe -#endif - -#ifdef _WIN32 -#define _WIN32DEP_H_ -#endif -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "signals.h" -#include "version.h" - -#include "perl-common.h" -#include "perl-handlers.h" - -#include - -#define PERL_PLUGIN_ID "core-perl" - -PerlInterpreter *my_perl = NULL; - -static PurplePluginUiInfo ui_info = -{ - purple_perl_get_plugin_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -#ifdef PURPLE_GTKPERL -static PurpleGtkPluginUiInfo gtk_ui_info = -{ - purple_perl_gtk_get_plugin_frame, - 0 /* page_num (Reserved) */ -}; -#endif - -static void -#ifdef OLD_PERL -xs_init() -#else -xs_init(pTHX) -#endif -{ - char *file = __FILE__; - GList *search_paths = purple_plugins_get_search_paths(); - dXSUB_SYS; - - /* This one allows dynamic loading of perl modules in perl scripts by - * the 'use perlmod;' construction */ - newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); -#ifdef _WIN32 - newXS("Win32CORE::bootstrap", boot_Win32CORE, file); -#endif - - while (search_paths != NULL) { - gchar *uselib; - const gchar *search_path = search_paths->data; - search_paths = g_list_next(search_paths); - - uselib = g_strdup_printf("unshift @INC, q(%s%sperl);", - search_path, G_DIR_SEPARATOR_S); - eval_pv(uselib, TRUE); - g_free(uselib); - } -} - -static void -perl_init(void) -{ - /* changed the name of the variable from load_file to perl_definitions - * since now it does much more than defining the load_file sub. - * Moreover, deplaced the initialisation to the xs_init function. - * (TheHobbit) */ - char *perl_args[] = { "", "-e", "0", "-w" }; - char perl_definitions[] = - { - /* We use to function one to load a file the other to execute - * the string obtained from the first and holding the file - * contents. This allows to have a really local $/ without - * introducing temp variables to hold the old value. Just a - * question of style:) */ - "package Purple::PerlLoader;" - "use Symbol;" - - "sub load_file {" - "my $f_name=shift;" - "local $/=undef;" - "open FH,$f_name or return \"__FAILED__\";" - "$_=;" - "close FH;" - "return $_;" - "}" - - "sub destroy_package {" - "eval { $_[0]->UNLOAD() if $_[0]->can('UNLOAD'); };" - "Symbol::delete_package($_[0]);" - "}" - - "sub load_n_eval {" - "my ($f_name, $package) = @_;" - "destroy_package($package);" - "my $strin=load_file($f_name);" - "return 2 if($strin eq \"__FAILED__\");" - "my $eval = qq{package $package; $strin;};" - - "{" - " eval $eval;" - "}" - - "if($@) {" - /*" #something went wrong\n"*/ - "die(\"Errors loading file $f_name: $@\");" - "}" - - "return 0;" - "}" - }; - - my_perl = perl_alloc(); - PERL_SET_CONTEXT(my_perl); - PL_perl_destruct_level = 1; - perl_construct(my_perl); -#ifdef DEBUG - perl_parse(my_perl, xs_init, 4, perl_args, NULL); -#else - perl_parse(my_perl, xs_init, 3, perl_args, NULL); -#endif -#ifdef HAVE_PERL_EVAL_PV - eval_pv(perl_definitions, TRUE); -#else - perl_eval_pv(perl_definitions, TRUE); /* deprecated */ -#endif - perl_run(my_perl); -} - -static void -perl_end(void) -{ - if (my_perl == NULL) - return; - - PL_perl_destruct_level = 1; - PERL_SET_CONTEXT(my_perl); - perl_eval_pv( - "foreach my $lib (@DynaLoader::dl_modules) {" - "if ($lib =~ /^Purple\\b/) {" - "$lib .= '::deinit();';" - "eval $lib;" - "}" - "}", - TRUE); - - PL_perl_destruct_level = 1; - PERL_SET_CONTEXT(my_perl); - perl_destruct(my_perl); - perl_free(my_perl); - my_perl = NULL; -} - -void -purple_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark) -{ - dSP; - - PUSHMARK(mark); - (*subaddr)(aTHX_ cv); - - PUTBACK; -} - -static gboolean -probe_perl_plugin(PurplePlugin *plugin) -{ - - char *args[] = {"", plugin->path }; - char **argv = args; - int argc = 2, ret; - PerlInterpreter *prober; - gboolean status = TRUE; - HV *plugin_info; - - PERL_SYS_INIT(&argc, &argv); - - /* XXX This would be much faster if we didn't create a new - * PerlInterpreter every time we probe a plugin */ - prober = perl_alloc(); - - PERL_SET_CONTEXT(prober); - - PL_perl_destruct_level = 1; - perl_construct(prober); - -/* Fix IO redirection to match where pidgin's is going. - * Without this, we lose stdout/stderr unless we redirect to a file */ -#ifdef _WIN32 -{ - PerlIO* newprlIO = PerlIO_open("CONOUT$", "w"); - if (newprlIO) { - int stdout_fd = PerlIO_fileno(PerlIO_stdout()); - int stderr_fd = PerlIO_fileno(PerlIO_stderr()); - PerlIO_close(PerlIO_stdout()); - PerlIO_close(PerlIO_stderr()); - PerlLIO_dup2(PerlIO_fileno(newprlIO), stdout_fd); - PerlLIO_dup2(PerlIO_fileno(newprlIO), stderr_fd); - - PerlIO_close(newprlIO); - } -} -#endif - - ret = perl_parse(prober, xs_init, argc, argv, NULL); - - if (ret != 0) { - const char * errmsg = "Unknown error"; - if (SvTRUE(ERRSV)) - errmsg = SvPVutf8_nolen(ERRSV); - purple_debug_error("perl", "Unable to parse plugin %s (%d:%s)\n", - plugin->path, ret, errmsg); - status = FALSE; - goto cleanup; - } - - ret = perl_run(prober); - - if (ret != 0) { - const char * errmsg = "Unknown error"; - if (SvTRUE(ERRSV)) - errmsg = SvPVutf8_nolen(ERRSV); - purple_debug_error("perl", "Unable to run perl interpreter on plugin %s (%d:%s)\n", - plugin->path, ret, errmsg); - status = FALSE; - goto cleanup; - } - - plugin_info = perl_get_hv("PLUGIN_INFO", FALSE); - - if (plugin_info == NULL) - status = FALSE; - else if (!hv_exists(plugin_info, "perl_api_version", - strlen("perl_api_version")) || - !hv_exists(plugin_info, "name", strlen("name")) || - !hv_exists(plugin_info, "load", strlen("load"))) { - /* Not a valid plugin. */ - - status = FALSE; - } else { - SV **key; - int perl_api_ver; - - key = hv_fetch(plugin_info, "perl_api_version", - strlen("perl_api_version"), 0); - - perl_api_ver = SvIV(*key); - - if (perl_api_ver != 2) - status = FALSE; - else { - PurplePluginInfo *info; - PurplePerlScript *gps; - char *basename; - - info = g_new0(PurplePluginInfo, 1); - gps = g_new0(PurplePerlScript, 1); - - info->magic = PURPLE_PLUGIN_MAGIC; - info->major_version = PURPLE_MAJOR_VERSION; - info->minor_version = PURPLE_MINOR_VERSION; - info->type = PURPLE_PLUGIN_STANDARD; - - info->dependencies = g_list_append(info->dependencies, - PERL_PLUGIN_ID); - - gps->plugin = plugin; - - basename = g_path_get_basename(plugin->path); - purple_perl_normalize_script_name(basename); - gps->package = g_strdup_printf("Purple::Script::%s", - basename); - g_free(basename); - - /* We know this one exists. */ - key = hv_fetch(plugin_info, "name", strlen("name"), 0); - info->name = g_strdup(SvPVutf8_nolen(*key)); - /* Set id here in case we don't find one later. */ - info->id = g_strdup(info->name); - -#ifdef PURPLE_GTKPERL - if ((key = hv_fetch(plugin_info, "GTK_UI", - strlen("GTK_UI"), 0))) - info->ui_requirement = PURPLE_GTK_PLUGIN_TYPE; -#endif - - if ((key = hv_fetch(plugin_info, "url", - strlen("url"), 0))) - info->homepage = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "author", - strlen("author"), 0))) - info->author = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "summary", - strlen("summary"), 0))) - info->summary = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "description", - strlen("description"), 0))) - info->description = g_strdup(SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "version", - strlen("version"), 0))) - info->version = g_strdup(SvPVutf8_nolen(*key)); - - /* We know this one exists. */ - key = hv_fetch(plugin_info, "load", strlen("load"), 0); - gps->load_sub = g_strdup_printf("%s::%s", gps->package, - SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "unload", - strlen("unload"), 0))) - gps->unload_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - - if ((key = hv_fetch(plugin_info, "id", - strlen("id"), 0))) { - g_free(info->id); - info->id = g_strdup_printf("perl-%s", - SvPVutf8_nolen(*key)); - } - - /********************************************************/ - /* Only one of the next two options should be present */ - /* */ - /* prefs_info - Uses non-GUI (read GTK) purple API calls */ - /* and creates a PurplePluginPrefInfo type. */ - /* */ - /* gtk_prefs_info - Requires gtk2-perl be installed by */ - /* the user and he must create a */ - /* GtkWidget the user and he must */ - /* create a GtkWidget representing the */ - /* plugin preferences page. */ - /********************************************************/ - if ((key = hv_fetch(plugin_info, "prefs_info", - strlen("prefs_info"), 0))) { - /* key now is the name of the Perl sub that - * will create a frame for us */ - gps->prefs_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - info->prefs_info = &ui_info; - } - -#ifdef PURPLE_GTKPERL - if ((key = hv_fetch(plugin_info, "gtk_prefs_info", - strlen("gtk_prefs_info"), 0))) { - /* key now is the name of the Perl sub that - * will create a frame for us */ - gps->gtk_prefs_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - info->ui_info = >k_ui_info; - } -#endif - - if ((key = hv_fetch(plugin_info, "plugin_action_sub", - strlen("plugin_action_sub"), 0))) { - gps->plugin_action_sub = g_strdup_printf("%s::%s", - gps->package, - SvPVutf8_nolen(*key)); - info->actions = purple_perl_plugin_actions; - } - - plugin->info = info; - info->extra_info = gps; - - status = purple_plugin_register(plugin); - } - } - - cleanup: - PL_perl_destruct_level = 1; - PERL_SET_CONTEXT(prober); - perl_destruct(prober); - perl_free(prober); - return status; -} - -static gboolean -load_perl_plugin(PurplePlugin *plugin) -{ - PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info; - gboolean loaded = TRUE; - char *atmp[3] = { plugin->path, NULL, NULL }; - - if (gps == NULL || gps->load_sub == NULL) - return FALSE; - - purple_debug(PURPLE_DEBUG_INFO, "perl", "Loading perl script\n"); - - if (my_perl == NULL) - perl_init(); - - plugin->handle = gps; - - atmp[1] = gps->package; - - PERL_SET_CONTEXT(my_perl); - execute_perl("Purple::PerlLoader::load_n_eval", 2, atmp); - - { - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, - "Purple::Plugin"))); - PUTBACK; - - perl_call_pv(gps->load_sub, G_EVAL | G_SCALAR); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl function %s exited abnormally: %s\n", - gps->load_sub, SvPVutf8_nolen(ERRSV)); - loaded = FALSE; - } - - PUTBACK; - FREETMPS; - LEAVE; - } - - return loaded; -} - -static void -destroy_package(const char *package) -{ - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - - ENTER; - SAVETMPS; - - PUSHMARK(SP); - XPUSHs(sv_2mortal(newSVpv(package, 0))); - PUTBACK; - - perl_call_pv("Purple::PerlLoader::destroy_package", - G_VOID | G_EVAL | G_DISCARD); - - SPAGAIN; - - PUTBACK; - FREETMPS; - LEAVE; -} - -static gboolean -unload_perl_plugin(PurplePlugin *plugin) -{ - PurplePerlScript *gps = (PurplePerlScript *)plugin->info->extra_info; - - if (gps == NULL) - return FALSE; - - purple_debug(PURPLE_DEBUG_INFO, "perl", "Unloading perl script\n"); - - if (gps->unload_sub != NULL) { - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, - "Purple::Plugin"))); - PUTBACK; - - perl_call_pv(gps->unload_sub, G_EVAL | G_SCALAR); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl function %s exited abnormally: %s\n", - gps->unload_sub, SvPVutf8_nolen(ERRSV)); - } - - PUTBACK; - FREETMPS; - LEAVE; - } - - purple_perl_cmd_clear_for_plugin(plugin); - purple_perl_signal_clear_for_plugin(plugin); - purple_perl_timeout_clear_for_plugin(plugin); - purple_perl_pref_cb_clear_for_plugin(plugin); - - destroy_package(gps->package); - - return TRUE; -} - -static void -destroy_perl_plugin(PurplePlugin *plugin) -{ - if (plugin->info != NULL) { - PurplePerlScript *gps; - - g_free(plugin->info->name); - g_free(plugin->info->id); - g_free(plugin->info->homepage); - g_free(plugin->info->author); - g_free(plugin->info->summary); - g_free(plugin->info->description); - g_free(plugin->info->version); - - gps = (PurplePerlScript *)plugin->info->extra_info; - if (gps != NULL) { - g_free(gps->package); - g_free(gps->load_sub); - g_free(gps->unload_sub); - g_free(gps->prefs_sub); -#ifdef PURPLE_GTKPERL - g_free(gps->gtk_prefs_sub); -#endif - g_free(gps->plugin_action_sub); - g_free(gps); - plugin->info->extra_info = NULL; - } - - g_free(plugin->info); - plugin->info = NULL; - } -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - perl_end(); - - return TRUE; -} - -static PurplePluginLoaderInfo loader_info = -{ - NULL, /**< exts */ - probe_perl_plugin, /**< probe */ - load_perl_plugin, /**< load */ - unload_perl_plugin, /**< unload */ - destroy_perl_plugin, /**< destroy */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_LOADER, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - PERL_PLUGIN_ID, /**< id */ - N_("Perl Plugin Loader"), /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Provides support for loading perl plugins."), /**< summary */ - N_("Provides support for loading perl plugins."), /**< description */ - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &loader_info, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - loader_info.exts = g_list_append(loader_info.exts, "pl"); -} - -#ifdef __SUNPRO_C -#pragma init (my_init) -#else -void __attribute__ ((constructor)) my_init(void); -#endif - -void -my_init(void) -{ - /* Mostly evil hack... puts perl.so's symbols in the global table but - * does not create a circular dependency because g_module_open will - * only open the library once. */ - /* Do we need to keep track of the returned GModule here so that we - * can g_module_close it when this plugin gets unloaded? - * At the moment I don't think this plugin can ever get unloaded but - * in case that becomes possible this wants to get noted. */ - g_module_open("perl.so", 0); -} - -PURPLE_INIT_PLUGIN(perl, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,654 +0,0 @@ -#include "debug.h" -#include "value.h" - -#include "perl-common.h" - -extern PerlInterpreter *my_perl; - -static GHashTable *object_stashes = NULL; - -void purple_perl_normalize_script_name(char *name) -{ - char *c; - - c = strrchr(name, '.'); - - if (c != NULL) - *c = '\0'; - - for (c = name; *c != '\0'; c++) { - if (*c != '_' && !g_ascii_isalnum(*c)) - *c = '_'; - } -} - -static int -magic_free_object(pTHX_ SV *sv, MAGIC *mg) -{ - sv_setiv(sv, 0); - - return 0; -} - -static MGVTBL vtbl_free_object = -{ - 0, 0, 0, 0, magic_free_object, 0, 0 -#if PERL_API_REVISION > 5 || (PERL_API_REVISION == 5 && PERL_API_VERSION >= 10) - , 0 -#endif -}; - -static SV * -create_sv_ptr(void *object) -{ - SV *sv; - - sv = newSViv((IV)object); - - sv_magic(sv, NULL, '~', NULL, 0); - - SvMAGIC(sv)->mg_private = 0x1551; /* HF */ - SvMAGIC(sv)->mg_virtual = &vtbl_free_object; - - return sv; -} - -SV * -newSVGChar(const char *str) -{ - SV *sv; - - if (str == NULL) - return &PL_sv_undef; - - sv = newSVpv(str, 0); - SvUTF8_on(sv); - - return sv; -} - -SV * -purple_perl_bless_object(void *object, const char *stash_name) -{ - HV *stash; - HV *hv; - - if (object == NULL) - return NULL; - - if (object_stashes == NULL) { - object_stashes = g_hash_table_new(g_direct_hash, g_direct_equal); - } - - stash = gv_stashpv(stash_name, 1); - - hv = newHV(); - hv_store(hv, "_purple", 7, create_sv_ptr(object), 0); - - return sv_bless(newRV_noinc((SV *)hv), stash); -} - -gboolean -purple_perl_is_ref_object(SV *o) -{ - SV **sv; - HV *hv; - - hv = hvref(o); - - if (hv != NULL) { - sv = hv_fetch(hv, "_purple", 7, 0); - - if (sv != NULL) - return TRUE; - } - - return FALSE; -} - -void * -purple_perl_ref_object(SV *o) -{ - SV **sv; - HV *hv; - void *p; - - if (o == NULL) - return NULL; - - hv = hvref(o); - - if (hv == NULL) - return NULL; - - sv = hv_fetch(hv, "_purple", 7, 0); - - if (sv == NULL) - croak("variable is damaged"); - - p = GINT_TO_POINTER(SvIV(*sv)); - - return p; -} - -/* - 2003/02/06: execute_perl modified by Mark Doliner - Pass parameters by pushing them onto the stack rather than - passing an array of strings. This way, perl scripts can - modify the parameters and we can get the changed values - and then shoot ourselves. I mean, uh, use them. - - 2001/06/14: execute_perl replaced by Martin Persson - previous use of perl_eval leaked memory, replaced with - a version that uses perl_call instead - - 30/11/2002: execute_perl modified by Eric Timme - args changed to char** so that we can have preparsed - arguments again, and many headaches ensued! This essentially - means we replaced one hacked method with a messier hacked - method out of perceived necessity. Formerly execute_perl - required a single char_ptr, and it would insert it into an - array of character pointers and NULL terminate the new array. - Now we have to pass in pre-terminated character pointer arrays - to accomodate functions that want to pass in multiple arguments. - - Previously arguments were preparsed because an argument list - was constructed in the form 'arg one','arg two' and was - executed via a call like &funcname(arglist) (see .59.x), so - the arglist was magically pre-parsed because of the method. - With Martin Persson's change to perl_call we now need to - use a null terminated list of character pointers for arguments - if we wish them to be parsed. Lacking a better way to allow - for both single arguments and many I created a NULL terminated - array in every function that called execute_perl and passed - that list into the function. In the former version a single - character pointer was passed in, and was placed into an array - of character pointers with two elements, with a NULL element - tacked onto the back, but this method no longer seemed prudent. - - Enhancements in the future might be to get rid of pre-declaring - the array sizes? I am not comfortable enough with this - subject to attempt it myself and hope it to stand the test - of time. -*/ -int -execute_perl(const char *function, int argc, char **args) -{ - int count = 0, i, ret_value = 1; - SV *sv_args[argc]; - dSP; - PERL_SET_CONTEXT(my_perl); - /* - * Set up the perl environment, push arguments onto the - * perl stack, then call the given function - */ - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - for (i = 0; i < argc; i++) { - if (args[i]) { - sv_args[i] = sv_2mortal(newSVpv(args[i], 0)); - XPUSHs(sv_args[i]); - } - } - - PUTBACK; - PERL_SET_CONTEXT(my_perl); - count = call_pv(function, G_EVAL | G_SCALAR); - SPAGAIN; - - /* - * Check for "die," make sure we have 1 argument, and set our - * return value. - */ - if (SvTRUE(ERRSV)) { - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl function %s exited abnormally: %s\n", - function, SvPVutf8_nolen(ERRSV)); - (void)POPs; - } else if (count != 1) { - /* - * This should NEVER happen. G_SCALAR ensures that we WILL - * have 1 parameter. - */ - purple_debug(PURPLE_DEBUG_ERROR, "perl", - "Perl error from %s: expected 1 return value, " - "but got %d\n", function, count); - } else - ret_value = POPi; - - /* Check for changed arguments */ - for (i = 0; i < argc; i++) { - if (args[i] && strcmp(args[i], SvPVX(sv_args[i]))) { - /* - * Shizzel. So the perl script changed one of the parameters, - * and we want this change to affect the original parameters. - * args[i] is just a temporary little list of pointers. We don't - * want to free args[i] here because the new parameter doesn't - * overwrite the data that args[i] points to. That is done by - * the function that called execute_perl. I'm not explaining this - * very well. See, it's aggregate... Oh, but if 2 perl scripts - * both modify the data, _that's_ a memleak. This is really kind - * of hackish. I should fix it. Look how long this comment is. - * Holy crap. - */ - args[i] = g_strdup(SvPVutf8_nolen(sv_args[i])); - } - } - - PUTBACK; - FREETMPS; - LEAVE; - - return ret_value; -} - -#if 0 -gboolean -purple_perl_value_from_sv(PurpleValue *value, SV *sv) -{ - switch (purple_value_get_type(value)) - { - case PURPLE_TYPE_CHAR: - if ((tmp = SvGChar(sv)) != NULL) - purple_value_set_char(value, tmp[0]); - else - return FALSE; - break; - - case PURPLE_TYPE_UCHAR: - if ((tmp = SvPV_nolen(sv)) != NULL) - purple_value_set_uchar(value, tmp[0]); - else - return FALSE; - break; - - case PURPLE_TYPE_BOOLEAN: - purple_value_set_boolean(value, SvTRUE(sv)); - break; - - case PURPLE_TYPE_INT: - purple_value_set_int(value, SvIV(sv)); - break; - - case PURPLE_TYPE_UINT: - purple_value_set_uint(value, SvIV(sv)); - break; - - case PURPLE_TYPE_LONG: - purple_value_set_long(value, SvIV(sv)); - break; - - case PURPLE_TYPE_ULONG: - purple_value_set_ulong(value, SvIV(sv)); - break; - - case PURPLE_TYPE_INT64: - purple_value_set_int64(value, SvIV(sv)); - break; - - case PURPLE_TYPE_UINT64: - purple_value_set_uint64(value, SvIV(sv)); - break; - - case PURPLE_TYPE_STRING: - purple_value_set_string(value, SvGChar(sv)); - break; - - case PURPLE_TYPE_POINTER: - purple_value_set_pointer(value, (void *)SvIV(sv)); - break; - - case PURPLE_TYPE_BOXED: - if (!strcmp(purple_value_get_specific_type(value), "SV")) - purple_value_set_boxed(value, (sv == &PL_sv_undef ? NULL : sv)); - else - purple_value_set_boxed(value, sv); - break; - - default: - return FALSE; - } - - return TRUE; -} - -SV * -purple_perl_sv_from_value(const PurpleValue *value, va_list list) -{ - switch (purple_value_get_type(value)) - { - case PURPLE_TYPE_BOOLEAN: - return newSViv(purple_value_get_boolean(value)); - break; - - case PURPLE_TYPE_INT: - return newSViv(purple_value_get_int(value)); - break; - - case PURPLE_TYPE_UINT: - return newSVuv(purple_value_get_uint(value)); - break; - - case PURPLE_TYPE_LONG: - return newSViv(purple_value_get_long(value)); - break; - - case PURPLE_TYPE_ULONG: - return newSVuv(purple_value_get_ulong(value)); - break; - - case PURPLE_TYPE_INT64: - return newSViv(purple_value_get_int64(value)); - break; - - case PURPLE_TYPE_UINT64: - return newSVuv(purple_value_get_int64(value)); - break; - - case PURPLE_TYPE_STRING: - return newSVGChar(purple_value_get_string(value)); - break; - - case PURPLE_TYPE_POINTER: - return newSViv((IV)purple_value_get_pointer(value)); - break; - - case PURPLE_TYPE_BOXED: - if (!strcmp(purple_value_get_specific_type(value), "SV")) - { - SV *sv = (SV *)purple_perl_get_boxed(value); - - return (sv == NULL ? &PL_sv_undef : sv); - } - - /* Uh.. I dunno. Try this? */ - return sv_2mortal(purple_perl_bless_object( - purple_perl_get_boxed(value), - purple_value_get_specific_type(value))); - - default: - return FALSE; - } - - return TRUE; -} -#endif - -void * -purple_perl_data_from_sv(PurpleValue *value, SV *sv) -{ - - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: return (void *)SvIV(sv); - case PURPLE_TYPE_INT: return (void *)SvIV(sv); - case PURPLE_TYPE_UINT: return (void *)SvUV(sv); - case PURPLE_TYPE_LONG: return (void *)SvIV(sv); - case PURPLE_TYPE_ULONG: return (void *)SvUV(sv); - case PURPLE_TYPE_INT64: return (void *)SvIV(sv); - case PURPLE_TYPE_UINT64: return (void *)SvUV(sv); - case PURPLE_TYPE_STRING: return g_strdup(SvPVutf8_nolen(sv)); - case PURPLE_TYPE_POINTER: return (void *)SvIV(sv); - case PURPLE_TYPE_BOXED: return (void *)SvIV(sv); - - default: - return NULL; - } - - return NULL; -} - -static SV * -purple_perl_sv_from_subtype(const PurpleValue *value, void *arg) -{ - const char *stash = "Purple"; /* ? */ - - switch (purple_value_get_subtype(value)) { - case PURPLE_SUBTYPE_ACCOUNT: - stash = "Purple::Account"; - break; - case PURPLE_SUBTYPE_BLIST: - stash = "Purple::BuddyList"; - break; - case PURPLE_SUBTYPE_BLIST_BUDDY: - stash = "Purple::BuddyList::Buddy"; - break; - case PURPLE_SUBTYPE_BLIST_GROUP: - stash = "Purple::BuddyList::Group"; - break; - case PURPLE_SUBTYPE_BLIST_CHAT: - stash = "Purple::BuddyList::Chat"; - break; - case PURPLE_SUBTYPE_BUDDY_ICON: - stash = "Purple::Buddy::Icon"; - break; - case PURPLE_SUBTYPE_CONNECTION: - stash = "Purple::Connection"; - break; - case PURPLE_SUBTYPE_CONVERSATION: - stash = "Purple::Conversation"; - break; - case PURPLE_SUBTYPE_PLUGIN: - stash = "Purple::Plugin"; - break; - case PURPLE_SUBTYPE_BLIST_NODE: - stash = "Purple::BuddyList::Node"; - break; - case PURPLE_SUBTYPE_CIPHER: - stash = "Purple::Cipher"; - break; - case PURPLE_SUBTYPE_STATUS: - stash = "Purple::Status"; - break; - case PURPLE_SUBTYPE_SAVEDSTATUS: - stash = "Purple::SavedStatus"; - break; - case PURPLE_SUBTYPE_LOG: - stash = "Purple::Log"; - break; - case PURPLE_SUBTYPE_XFER: - stash = "Purple::Xfer"; - break; - case PURPLE_SUBTYPE_XMLNODE: - stash = "Purple::XMLNode"; - break; - case PURPLE_SUBTYPE_USERINFO: - stash = "Purple::NotifyUserInfo"; - break; - case PURPLE_SUBTYPE_STORED_IMAGE: - stash = "Purple::StoredImage"; - break; - case PURPLE_SUBTYPE_CERTIFICATEPOOL: - stash = "Purple::Certificate::Pool"; - break; - case PURPLE_SUBTYPE_UNKNOWN: - stash = "Purple::Unknown"; - break; - } - - return sv_2mortal(purple_perl_bless_object(arg, stash)); -} - -SV * -purple_perl_sv_from_vargs(const PurpleValue *value, va_list args, void ***copy_arg) -{ - if (purple_value_is_outgoing(value)) { - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_SUBTYPE: - if ((*copy_arg = va_arg(args, void **)) == NULL) - return &PL_sv_undef; - - return purple_perl_sv_from_subtype(value, *(void **)*copy_arg); - - case PURPLE_TYPE_BOOLEAN: - if ((*copy_arg = (void *)va_arg(args, gboolean *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(gboolean *)*copy_arg); - - case PURPLE_TYPE_INT: - if ((*copy_arg = (void *)va_arg(args, int *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(int *)*copy_arg); - - case PURPLE_TYPE_UINT: - if ((*copy_arg = (void *)va_arg(args, unsigned int *)) == NULL) - return &PL_sv_undef; - - return newSVuv(*(unsigned int *)*copy_arg); - - case PURPLE_TYPE_LONG: - if ((*copy_arg = (void *)va_arg(args, long *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(long *)*copy_arg); - - case PURPLE_TYPE_ULONG: - if ((*copy_arg = (void *)va_arg(args, - unsigned long *)) == NULL) - return &PL_sv_undef; - - return newSVuv(*(unsigned long *)*copy_arg); - - case PURPLE_TYPE_INT64: - if ((*copy_arg = (void *)va_arg(args, gint64 *)) == NULL) - return &PL_sv_undef; - - return newSViv(*(gint64 *)*copy_arg); - - case PURPLE_TYPE_UINT64: - if ((*copy_arg = (void *)va_arg(args, guint64 *)) == NULL) - return &PL_sv_undef; - - return newSVuv(*(guint64 *)*copy_arg); - - case PURPLE_TYPE_STRING: - if ((*copy_arg = (void *)va_arg(args, char **)) == NULL) - return &PL_sv_undef; - - return newSVGChar(*(char **)*copy_arg); - - case PURPLE_TYPE_POINTER: - if ((*copy_arg = va_arg(args, void **)) == NULL) - return &PL_sv_undef; - - return newSViv((IV)*(void **)*copy_arg); - - case PURPLE_TYPE_BOXED: - /* Uh.. I dunno. Try this? */ - if ((*copy_arg = va_arg(args, void **)) == NULL) - return &PL_sv_undef; - - return sv_2mortal(purple_perl_bless_object( - *(void **)*copy_arg, - purple_value_get_specific_type(value))); - - default: - /* If this happens, things are going to get screwed up... */ - return NULL; - } - } else { - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_SUBTYPE: - if ((*copy_arg = va_arg(args, void *)) == NULL) - return &PL_sv_undef; - - return purple_perl_sv_from_subtype(value, *copy_arg); - - case PURPLE_TYPE_BOOLEAN: - *copy_arg = GINT_TO_POINTER( va_arg(args, gboolean) ); - - return newSViv((gboolean)GPOINTER_TO_INT(*copy_arg)); - - case PURPLE_TYPE_INT: - *copy_arg = GINT_TO_POINTER( va_arg(args, int) ); - - return newSViv(GPOINTER_TO_INT(*copy_arg)); - - case PURPLE_TYPE_UINT: - *copy_arg = GUINT_TO_POINTER(va_arg(args, unsigned int)); - - return newSVuv(GPOINTER_TO_UINT(*copy_arg)); - - case PURPLE_TYPE_LONG: - *copy_arg = (void *)va_arg(args, long); - - return newSViv((long)*copy_arg); - - case PURPLE_TYPE_ULONG: - *copy_arg = (void *)va_arg(args, unsigned long); - - return newSVuv((unsigned long)*copy_arg); - - case PURPLE_TYPE_INT64: -#if 0 - /* XXX This yells and complains. */ - *copy_arg = va_arg(args, gint64); - - return newSViv(*copy_arg); -#endif - break; - - case PURPLE_TYPE_UINT64: - /* XXX This also yells and complains. */ -#if 0 - *copy_arg = (void *)va_arg(args, guint64); - - return newSVuv(*copy_arg); -#endif - break; - - case PURPLE_TYPE_STRING: - if ((*copy_arg = (void *)va_arg(args, char *)) == NULL) - return &PL_sv_undef; - - return newSVGChar((char *)*copy_arg); - - case PURPLE_TYPE_POINTER: - if ((*copy_arg = (void *)va_arg(args, void *)) == NULL) - return &PL_sv_undef; - - return newSViv((IV)*copy_arg); - - case PURPLE_TYPE_BOXED: - /* Uh.. I dunno. Try this? */ - if ((*copy_arg = (void *)va_arg(args, void *)) == NULL) - return &PL_sv_undef; - - return sv_2mortal(purple_perl_bless_object(*copy_arg, - purple_value_get_specific_type(value))); - - default: - /* If this happens, things are going to get screwed up... */ - return NULL; - } - } - - return NULL; -} - -SV *purple_perl_sv_from_fun(PurplePlugin *plugin, SV *callback) -{ - SV *sv = NULL; - - if (SvTYPE(callback) == SVt_RV) { - SV *cbsv = SvRV(callback); - - if (SvTYPE(cbsv) == SVt_PVCV) { - sv = newSVsv(callback); - } - } else if (SvTYPE(callback) == SVt_PV) { - PurplePerlScript *gps; - - gps = (PurplePerlScript *)PURPLE_PLUGIN_LOADER_INFO(plugin); - sv = newSVpvf("%s::%s", gps->package, SvPV_nolen(callback)); - } else { - purple_debug_warning("perl", "Callback not a valid type, only strings and coderefs allowed.\n"); - } - - return sv; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -#ifndef _PURPLE_PERL_COMMON_H_ -#define _PURPLE_PERL_COMMON_H_ - -#include -#ifdef _WIN32 -#undef pipe -#endif -#include -#include -#include - -/* XXX: perl defines it's own _ but I think it's safe to undef it */ -#undef _ -/* Dirty hack to prevent the win32 libc compat stuff from interfering with the Perl internal stuff */ -#ifdef _WIN32 -#define _WIN32DEP_H_ -#endif -#include "internal.h" -#ifdef _WIN32 -#undef _WIN32DEP_H_ -#endif -#include "plugin.h" -#include "value.h" - -#define is_hvref(o) \ - ((o) && SvROK(o) && SvRV(o) && (SvTYPE(SvRV(o)) == SVt_PVHV)) - -#define hvref(o) \ - (is_hvref(o) ? (HV *)SvRV(o) : NULL); - -#define PURPLE_PERL_BOOT_PROTO(x) \ - void boot_Purple__##x(pTHX_ CV *cv); - -#define PURPLE_PERL_BOOT(x) \ - purple_perl_callXS(boot_Purple__##x, cv, mark) - -typedef struct -{ - PurplePlugin *plugin; - char *package; - char *load_sub; - char *unload_sub; - char *prefs_sub; -#ifdef PURPLE_GTKPERL - char *gtk_prefs_sub; -#endif - char *plugin_action_sub; -} PurplePerlScript; - -void purple_perl_normalize_script_name(char *name); - -SV *newSVGChar(const char *str); - -void purple_perl_callXS(void (*subaddr)(pTHX_ CV *cv), CV *cv, SV **mark); -void purple_perl_bless_plain(const char *stash, void *object); -SV *purple_perl_bless_object(void *object, const char *stash); -gboolean purple_perl_is_ref_object(SV *o); -void *purple_perl_ref_object(SV *o); - -int execute_perl(const char *function, int argc, char **args); - -#if 0 -gboolean purple_perl_value_from_sv(PurpleValue *value, SV *sv); -SV *purple_perl_sv_from_value(const PurpleValue *value); -#endif - -void *purple_perl_data_from_sv(PurpleValue *value, SV *sv); -SV *purple_perl_sv_from_vargs(const PurpleValue *value, va_list args, - void ***copy_arg); -SV *purple_perl_sv_from_fun(PurplePlugin *plugin, SV *callback); -#endif /* _PURPLE_PERL_COMMON_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,843 +0,0 @@ -#include "perl-common.h" -#include "perl-handlers.h" - -#include "debug.h" -#include "signals.h" - -extern PerlInterpreter *my_perl; -static GSList *cmd_handlers = NULL; -static GSList *signal_handlers = NULL; -static GSList *timeout_handlers = NULL; -static GSList *pref_handlers = NULL; - -/* perl < 5.8.0 doesn't define PERL_MAGIC_ext */ -#ifndef PERL_MAGIC_ext -#define PERL_MAGIC_ext '~' -#endif - -void -purple_perl_plugin_action_cb(PurplePluginAction *action) -{ - SV **callback; - HV *hv = NULL; - gchar *hvname; - PurplePlugin *plugin; - PurplePerlScript *gps; - dSP; - - plugin = action->plugin; - gps = (PurplePerlScript *)plugin->info->extra_info; - hvname = g_strdup_printf("%s::plugin_actions", gps->package); - hv = get_hv(hvname, FALSE); - g_free(hvname); - - if (hv == NULL) - croak("No plugin_actions hash found in \"%s\" plugin.", purple_plugin_get_name(plugin)); - - ENTER; - SAVETMPS; - - callback = hv_fetch(hv, action->label, strlen(action->label), 0); - - if (callback == NULL || *callback == NULL) - croak("No plugin_action function named \"%s\" in \"%s\" plugin.", action->label, purple_plugin_get_name(plugin)); - - PUSHMARK(sp); - XPUSHs(purple_perl_bless_object(gps->plugin, "Purple::Plugin")); - PUTBACK; - - call_sv(*callback, G_EVAL | G_VOID | G_DISCARD); - - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin action function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - PUTBACK; - FREETMPS; - LEAVE; -} - -GList * -purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context) -{ - GList *l = NULL; - PurplePerlScript *gps; - int i = 0, count = 0; - dSP; - - gps = plugin->info->extra_info; - - ENTER; - SAVETMPS; - - PUSHMARK(SP); - XPUSHs(sv_2mortal(purple_perl_bless_object(plugin, "Purple::Plugin"))); - /* XXX This *will* cease working correctly if context gets changed to - * ever be able to hold anything other than a PurpleConnection */ - if (context != NULL) - XPUSHs(sv_2mortal(purple_perl_bless_object(context, - "Purple::Connection"))); - else - XPUSHs(&PL_sv_undef); - PUTBACK; - - count = call_pv(gps->plugin_action_sub, G_EVAL | G_ARRAY); - - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin actions lookup exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - if (count == 0) - croak("The plugin_actions sub didn't return anything.\n"); - - for (i = 0; i < count; i++) { - SV *sv; - PurplePluginAction *act; - - sv = POPs; - act = purple_plugin_action_new(SvPVutf8_nolen(sv), purple_perl_plugin_action_cb); - l = g_list_prepend(l, act); - } - - PUTBACK; - FREETMPS; - LEAVE; - - return l; -} - -#ifdef PURPLE_GTKPERL -GtkWidget * -purple_perl_gtk_get_plugin_frame(PurplePlugin *plugin) -{ - SV * sv; - int count; - MAGIC *mg; - GtkWidget *ret; - PurplePerlScript *gps; - dSP; - - gps = plugin->info->extra_info; - - ENTER; - SAVETMPS; - - count = call_pv(gps->gtk_prefs_sub, G_EVAL | G_SCALAR | G_NOARGS); - if (count != 1) - croak("call_pv: Did not return the correct number of values.\n"); - - /* the frame was created in a perl sub and is returned */ - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl gtk plugin frame init exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - /* We have a Gtk2::Frame on top of the stack */ - sv = POPs; - - /* The magic field hides the pointer to the actual GtkWidget */ - mg = mg_find(SvRV(sv), PERL_MAGIC_ext); - ret = (GtkWidget *)mg->mg_ptr; - - PUTBACK; - FREETMPS; - LEAVE; - - return ret; -} -#endif - -PurplePluginPrefFrame * -purple_perl_get_plugin_frame(PurplePlugin *plugin) -{ - /* Sets up the Perl Stack for our call back into the script to run the - * plugin_pref... sub */ - int count; - PurplePerlScript *gps; - PurplePluginPrefFrame *ret_frame; - dSP; - - gps = (PurplePerlScript *)plugin->info->extra_info; - - ENTER; - SAVETMPS; - /* Some perl magic to run perl_plugin_pref_frame_SV perl sub and - * return the frame */ - PUSHMARK(SP); - PUTBACK; - - count = call_pv(gps->prefs_sub, G_EVAL | G_SCALAR | G_NOARGS); - - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin prefs frame init exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - if (count != 1) - croak("call_pv: Did not return the correct number of values.\n"); - /* the frame was created in a perl sub and is returned */ - ret_frame = (PurplePluginPrefFrame *)purple_perl_ref_object(POPs); - - /* Tidy up the Perl stack */ - PUTBACK; - FREETMPS; - LEAVE; - - return ret_frame; -} - -static gboolean -destroy_timeout_handler(PurplePerlTimeoutHandler *handler) -{ - gboolean ret = FALSE; - - timeout_handlers = g_slist_remove(timeout_handlers, handler); - - if (handler->iotag > 0) - ret = purple_timeout_remove(handler->iotag); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler); - - return ret; -} - -static void -destroy_signal_handler(PurplePerlSignalHandler *handler) -{ - signal_handlers = g_slist_remove(signal_handlers, handler); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler->signal); - g_free(handler); -} - -static gboolean -perl_timeout_cb(gpointer data) -{ - PurplePerlTimeoutHandler *handler = data; - gboolean ret = FALSE; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs((SV *)handler->data); - PUTBACK; - call_sv(handler->callback, G_EVAL | G_SCALAR); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl timeout function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - ret = POPi; - - PUTBACK; - FREETMPS; - LEAVE; - - if (ret == FALSE) - destroy_timeout_handler(handler); - - return ret; -} - -typedef void *DATATYPE; - -static void * -perl_signal_cb(va_list args, void *data) -{ - PurplePerlSignalHandler *handler = data; - void *ret_val = NULL; - int i; - int count; - int value_count; - PurpleValue *ret_value, **values; - SV **sv_args; - DATATYPE **copy_args; - - dSP; - PERL_SET_CONTEXT(my_perl); - SPAGAIN; - ENTER; - SAVETMPS; - PUSHMARK(sp); - - purple_signal_get_values(handler->instance, handler->signal, - &ret_value, &value_count, &values); - - sv_args = g_new(SV *, value_count); - copy_args = g_new(void **, value_count); - - for (i = 0; i < value_count; i++) { - sv_args[i] = purple_perl_sv_from_vargs(values[i], - args, - ©_args[i]); - - XPUSHs(sv_args[i]); - } - - XPUSHs((SV *)handler->data); - - PUTBACK; - - if (ret_value != NULL) { - count = call_sv(handler->callback, G_EVAL | G_SCALAR); - - SPAGAIN; - - if (count != 1) - croak("Uh oh! call_sv returned %i != 1", i); - else - ret_val = purple_perl_data_from_sv(ret_value, POPs); - } else { - call_sv(handler->callback, G_EVAL | G_SCALAR); - - SPAGAIN; - } - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - /* See if any parameters changed. */ - for (i = 0; i < value_count; i++) { - if (purple_value_is_outgoing(values[i])) { - switch (purple_value_get_type(values[i])) { - case PURPLE_TYPE_BOOLEAN: - *((gboolean *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_INT: - *((int *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_UINT: - *((unsigned int *)copy_args[i]) = SvUV(sv_args[i]); - break; - - case PURPLE_TYPE_LONG: - *((long *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_ULONG: - *((unsigned long *)copy_args[i]) = SvUV(sv_args[i]); - break; - - case PURPLE_TYPE_INT64: - *((gint64 *)copy_args[i]) = SvIV(sv_args[i]); - break; - - case PURPLE_TYPE_UINT64: - *((guint64 *)copy_args[i]) = SvUV(sv_args[i]); - break; - - case PURPLE_TYPE_STRING: - if (!*((char **)copy_args[i]) || !SvPVX(sv_args[i]) || - strcmp(*((char **)copy_args[i]), SvPVX(sv_args[i]))) { - g_free(*((char **)copy_args[i])); - *((char **)copy_args[i]) = - g_strdup(SvPVutf8_nolen(sv_args[i])); - } - /* Clean up sv_args[i] - we're done with it */ - sv_2mortal(sv_args[i]); - break; - - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_BOXED: - *((void **)copy_args[i]) = (void *)SvIV(sv_args[i]); - break; - case PURPLE_TYPE_SUBTYPE: - *((void **)copy_args[i]) = purple_perl_ref_object(sv_args[i]); - break; - - default: - break; - } - - -#if 0 - *((void **)copy_args[i]) = purple_perl_data_from_sv(values[i], - sv_args[i]); -#endif - } - } - - PUTBACK; - FREETMPS; - LEAVE; - - g_free(sv_args); - g_free(copy_args); - - purple_debug_misc("perl", "ret_val = %p\n", ret_val); - - return ret_val; -} - -static PurplePerlSignalHandler * -find_signal_handler(PurplePlugin *plugin, void *instance, const char *signal) -{ - PurplePerlSignalHandler *handler; - GSList *l; - - for (l = signal_handlers; l != NULL; l = l->next) { - handler = l->data; - - if (handler->plugin == plugin && - handler->instance == instance && - !strcmp(handler->signal, signal)) { - return handler; - } - } - - return NULL; -} - -guint -purple_perl_timeout_add(PurplePlugin *plugin, int seconds, SV *callback, SV *data) -{ - PurplePerlTimeoutHandler *handler; - - if (plugin == NULL) { - croak("Invalid handle in adding perl timeout handler.\n"); - return 0; - } - - handler = g_new0(PurplePerlTimeoutHandler, 1); - - handler->plugin = plugin; - handler->callback = (callback != NULL && callback != &PL_sv_undef - ? newSVsv(callback) : NULL); - handler->data = (data != NULL && data != &PL_sv_undef - ? newSVsv(data) : NULL); - - timeout_handlers = g_slist_append(timeout_handlers, handler); - - handler->iotag = purple_timeout_add_seconds(seconds, perl_timeout_cb, handler); - - return handler->iotag; -} - -gboolean -purple_perl_timeout_remove(guint handle) -{ - PurplePerlTimeoutHandler *handler; - GSList *l, *l_next; - - for (l = timeout_handlers; l != NULL; l = l_next) { - handler = l->data; - l_next = l->next; - - if (handler->iotag == handle) - return destroy_timeout_handler(handler); - } - - purple_debug_info("perl", "No timeout handler found with handle %u.\n", - handle); - return FALSE; -} - -void -purple_perl_timeout_clear_for_plugin(PurplePlugin *plugin) -{ - PurplePerlTimeoutHandler *handler; - GSList *l, *l_next; - - for (l = timeout_handlers; l != NULL; l = l_next) { - handler = l->data; - l_next = l->next; - - if (handler->plugin == plugin) - destroy_timeout_handler(handler); - } -} - -void -purple_perl_timeout_clear(void) -{ - while (timeout_handlers != NULL) - destroy_timeout_handler(timeout_handlers->data); -} - -void -purple_perl_signal_connect(PurplePlugin *plugin, void *instance, - const char *signal, SV *callback, SV *data, - int priority) -{ - PurplePerlSignalHandler *handler; - - handler = g_new0(PurplePerlSignalHandler, 1); - handler->plugin = plugin; - handler->instance = instance; - handler->signal = g_strdup(signal); - handler->callback = (callback != NULL && - callback != &PL_sv_undef ? newSVsv(callback) - : NULL); - handler->data = (data != NULL && - data != &PL_sv_undef ? newSVsv(data) : NULL); - - signal_handlers = g_slist_append(signal_handlers, handler); - - purple_signal_connect_priority_vargs(instance, signal, plugin, - PURPLE_CALLBACK(perl_signal_cb), - handler, priority); -} - -void -purple_perl_signal_disconnect(PurplePlugin *plugin, void *instance, - const char *signal) -{ - PurplePerlSignalHandler *handler; - - handler = find_signal_handler(plugin, instance, signal); - - if (handler == NULL) { - croak("Invalid signal handler information in " - "disconnecting a perl signal handler.\n"); - return; - } - - destroy_signal_handler(handler); -} - -void -purple_perl_signal_clear_for_plugin(PurplePlugin *plugin) -{ - PurplePerlSignalHandler *handler; - GSList *l, *l_next; - - for (l = signal_handlers; l != NULL; l = l_next) { - l_next = l->next; - handler = l->data; - - if (handler->plugin == plugin) - destroy_signal_handler(handler); - } -} - -void -purple_perl_signal_clear(void) -{ - while (signal_handlers != NULL) - destroy_signal_handler(signal_handlers->data); -} - -static PurpleCmdRet -perl_cmd_cb(PurpleConversation *conv, const gchar *command, - gchar **args, gchar **error, void *data) -{ - int i = 0, count, ret_value = PURPLE_CMD_RET_OK; - SV *cmdSV, *tmpSV, *convSV; - PurplePerlCmdHandler *handler = data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(SP); - - /* Push the conversation onto the perl stack */ - convSV = sv_2mortal(purple_perl_bless_object(conv, "Purple::Conversation")); - XPUSHs(convSV); - - /* Push the command string onto the perl stack */ - cmdSV = newSVpv(command, 0); - cmdSV = sv_2mortal(cmdSV); - XPUSHs(cmdSV); - - /* Push the data onto the perl stack */ - XPUSHs((SV *)handler->data); - - /* Push any arguments we may have */ - for (i = 0; args[i] != NULL; i++) { - /* XXX The mortality of these created SV's should prevent - * memory issues, if I read/understood everything correctly... - */ - tmpSV = newSVpv(args[i], 0); - tmpSV = sv_2mortal(tmpSV); - XPUSHs(tmpSV); - } - - PUTBACK; - count = call_sv(handler->callback, G_EVAL | G_SCALAR); - - if (count != 1) - croak("call_sv: Did not return the correct number of values.\n"); - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl plugin command function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - SPAGAIN; - - ret_value = POPi; - - PUTBACK; - FREETMPS; - LEAVE; - - return ret_value; -} - -PurpleCmdId -purple_perl_cmd_register(PurplePlugin *plugin, const gchar *command, - const gchar *args, PurpleCmdPriority priority, - PurpleCmdFlag flag, const gchar *prpl_id, SV *callback, - const gchar *helpstr, SV *data) -{ - PurplePerlCmdHandler *handler; - - handler = g_new0(PurplePerlCmdHandler, 1); - handler->plugin = plugin; - handler->cmd = g_strdup(command); - handler->prpl_id = g_strdup(prpl_id); - - if (callback != NULL && callback != &PL_sv_undef) - handler->callback = newSVsv(callback); - else - handler->callback = NULL; - - if (data != NULL && data != &PL_sv_undef) - handler->data = newSVsv(data); - else - handler->data = NULL; - - cmd_handlers = g_slist_append(cmd_handlers, handler); - - handler->id = purple_cmd_register(command, args, priority, flag, prpl_id, - PURPLE_CMD_FUNC(perl_cmd_cb), helpstr, - handler); - - return handler->id; -} - -static void -destroy_cmd_handler(PurplePerlCmdHandler *handler) -{ - purple_cmd_unregister(handler->id); - cmd_handlers = g_slist_remove(cmd_handlers, handler); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler->cmd); - g_free(handler->prpl_id); - g_free(handler); -} - -void -purple_perl_cmd_clear_for_plugin(PurplePlugin *plugin) -{ - PurplePerlCmdHandler *handler; - GSList *l, *l_next; - - for (l = cmd_handlers; l != NULL; l = l_next) { - handler = l->data; - l_next = l->next; - - if (handler->plugin == plugin) - destroy_cmd_handler(handler); - } -} - -static PurplePerlCmdHandler * -find_cmd_handler(PurpleCmdId id) -{ - PurplePerlCmdHandler *handler; - GSList *l; - - for (l = cmd_handlers; l != NULL; l = l->next) { - handler = (PurplePerlCmdHandler *)l->data; - - if (handler->id == id) - return handler; - } - - return NULL; -} - -void -purple_perl_cmd_unregister(PurpleCmdId id) -{ - PurplePerlCmdHandler *handler; - - handler = find_cmd_handler(id); - - if (handler == NULL) { - croak("Invalid command id in removing a perl command handler.\n"); - return; - } - - destroy_cmd_handler(handler); -} - -static void -perl_pref_cb(const char *name, PurplePrefType type, gconstpointer value, - gpointer data) -{ - PurplePerlPrefsHandler *handler = data; - - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(newSVpv(name, 0))); - - XPUSHs(sv_2mortal(newSViv(type))); - - switch(type) { - case PURPLE_PREF_INT: - XPUSHs(sv_2mortal(newSViv(GPOINTER_TO_INT(value)))); - break; - case PURPLE_PREF_BOOLEAN: - XPUSHs((GPOINTER_TO_INT(value) == FALSE) ? &PL_sv_no : &PL_sv_yes); - break; - case PURPLE_PREF_STRING: - case PURPLE_PREF_PATH: - XPUSHs(sv_2mortal(newSVGChar(value))); - break; - case PURPLE_PREF_STRING_LIST: - case PURPLE_PREF_PATH_LIST: - { - AV* av = newAV(); - const GList *l = value; - - /* Append stuff backward to preserve order */ - while (l && l->next) l = l->next; - while (l) { - av_push(av, sv_2mortal(newSVGChar(l->data))); - l = l->prev; - } - XPUSHs(sv_2mortal(newRV_noinc((SV *) av))); - } break; - default: - case PURPLE_PREF_NONE: - XPUSHs(&PL_sv_undef); - break; - } - - XPUSHs((SV *)handler->data); - PUTBACK; - call_sv(handler->callback, G_EVAL | G_VOID | G_DISCARD); - SPAGAIN; - - if (SvTRUE(ERRSV)) { - purple_debug_error("perl", - "Perl prefs callback function exited abnormally: %s\n", - SvPVutf8_nolen(ERRSV)); - } - - PUTBACK; - FREETMPS; - LEAVE; -} - -guint -purple_perl_prefs_connect_callback(PurplePlugin *plugin, const char *name, - SV *callback, SV *data) -{ - PurplePerlPrefsHandler *handler; - - if (plugin == NULL) { - croak("Invalid handle in adding perl prefs handler.\n"); - return 0; - } - - handler = g_new0(PurplePerlPrefsHandler, 1); - - handler->plugin = plugin; - handler->callback = (callback != NULL && callback != &PL_sv_undef - ? newSVsv(callback) : NULL); - handler->data = (data != NULL && data != &PL_sv_undef - ? newSVsv(data) : NULL); - - pref_handlers = g_slist_prepend(pref_handlers, handler); - - handler->iotag = purple_prefs_connect_callback(plugin, name, perl_pref_cb, handler); - - return handler->iotag; -} - -static void -destroy_prefs_handler(PurplePerlPrefsHandler *handler) -{ - pref_handlers = g_slist_remove(pref_handlers, handler); - - if (handler->iotag > 0) - purple_prefs_disconnect_callback(handler->iotag); - - if (handler->callback != NULL) - SvREFCNT_dec(handler->callback); - - if (handler->data != NULL) - SvREFCNT_dec(handler->data); - - g_free(handler); -} - -void purple_perl_prefs_disconnect_callback(guint callback_id) -{ - GSList *l, *l_next; - PurplePerlPrefsHandler *handler; - - for (l = pref_handlers; l != NULL; l = l_next) { - l_next = l->next; - handler = l->data; - - if (handler->iotag == callback_id) { - destroy_prefs_handler(handler); - return; - } - } - - purple_debug_info("perl", "No prefs handler found with handle %u.\n", - callback_id); -} - -void purple_perl_pref_cb_clear_for_plugin(PurplePlugin *plugin) -{ - GSList *l, *l_next; - PurplePerlPrefsHandler *handler; - - for (l = pref_handlers; l != NULL; l = l_next) { - l_next = l->next; - handler = l->data; - - if (handler->plugin == plugin) - destroy_prefs_handler(handler); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/perl-handlers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -#ifndef _PURPLE_PERL_HANDLERS_H_ -#define _PURPLE_PERL_HANDLERS_H_ - -#include "cmds.h" -#include "plugin.h" -#include "prefs.h" -#include "pluginpref.h" -#ifdef PURPLE_GTKPERL -#include "gtkplugin.h" -#include "gtkutils.h" -#endif - -typedef struct -{ - PurpleCmdId id; - SV *callback; - SV *data; - gchar *prpl_id; - gchar *cmd; - PurplePlugin *plugin; -} PurplePerlCmdHandler; - -typedef struct -{ - SV *callback; - SV *data; - PurplePlugin *plugin; - int iotag; - -} PurplePerlTimeoutHandler; - -typedef struct -{ - gchar *signal; - SV *callback; - SV *data; - void *instance; - PurplePlugin *plugin; - -} PurplePerlSignalHandler; - -typedef struct -{ - SV *callback; - SV *data; - PurplePlugin *plugin; - int iotag; - -} PurplePerlPrefsHandler; - -void purple_perl_plugin_action_cb(PurplePluginAction * gpa); -GList *purple_perl_plugin_actions(PurplePlugin *plugin, gpointer context); - -PurplePluginPrefFrame *purple_perl_get_plugin_frame(PurplePlugin *plugin); - -#ifdef PURPLE_GTKPERL -GtkWidget *purple_perl_gtk_get_plugin_frame(PurplePlugin *plugin); -#endif - -guint purple_perl_timeout_add(PurplePlugin *plugin, int seconds, SV *callback, - SV *data); -gboolean purple_perl_timeout_remove(guint handle); -void purple_perl_timeout_clear_for_plugin(PurplePlugin *plugin); -void purple_perl_timeout_clear(void); - -void purple_perl_signal_connect(PurplePlugin *plugin, void *instance, - const char *signal, SV *callback, - SV *data, int priority); -void purple_perl_signal_disconnect(PurplePlugin *plugin, void *instance, - const char *signal); -void purple_perl_signal_clear_for_plugin(PurplePlugin *plugin); -void purple_perl_signal_clear(void); - -PurpleCmdId purple_perl_cmd_register(PurplePlugin *plugin, const gchar *cmd, - const gchar *args, PurpleCmdPriority priority, - PurpleCmdFlag flag, const gchar *prpl_id, - SV *callback, const gchar *helpstr, SV *data); -void purple_perl_cmd_unregister(PurpleCmdId id); -void purple_perl_cmd_clear_for_plugin(PurplePlugin *plugin); - -guint purple_perl_prefs_connect_callback(PurplePlugin *plugin, const char *name, SV *callback, SV *data); -void purple_perl_prefs_disconnect_callback(guint callback_id); -void purple_perl_pref_cb_clear_for_plugin(PurplePlugin *plugin); - -#endif /* _PURPLE_PERL_HANDLERS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/function_list.pl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/function_list.pl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/function_list.pl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/function_list.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -$MODULE_NAME = "List all Purple:: (and Pidgin::) functions"; -use Purple; -# Uncomment this to print the Pidgin:: functions as well. -#use Pidgin; - -# All the information Purple gets about our nifty plugin -%PLUGIN_INFO = ( - perl_api_version => 2, - name => "Perl: $MODULE_NAME", - version => "0.1", - summary => "Print to standard output all the functions under the Purple:: (and Pidgin::) packages", - description => "Print to standard output all the functions under the Purple:: (and Pidgin::) packages", - author => "Etan Reisner ", - url => "http://sourceforge.net/users/deryni9/", - id => "functionlist", - - load => "plugin_load", - unload => "plugin_unload" -); - -sub plugin_init { - return %PLUGIN_INFO; -} - -sub print_array { - my $array = shift; - - my @arr = sort @$array; - foreach $mod (@arr) { - my @sub; - - foreach $key (sort keys %{$mod}) { - if ($key =~ /::$/) { - push @sub, "$mod$key"; - } else { - print "$mod$key\n"; - } - } - print_array(\@sub); - } -} - -sub plugin_load { - my $plugin = shift; - my @purplearray; - my @pidginarray; - - foreach $key (sort keys %Purple::) { - if ($key =~ /::$/) { - push @purplearray, "Purple::$key"; - } else { - print "Purple::$key\n"; - } - } - print_array(\@purplearray); - - foreach $key (sort keys %Pidgin::) { - if ($key =~ /::$/) { - push @pidginarray, "Pidgin::$key"; - } else { - print "Pidgin::$key\n"; - } - } - print_array(\@pidginarray); -} - -sub plugin_unload { - my $plugin = shift; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/signals-test.pl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/signals-test.pl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/signals-test.pl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/perl/scripts/signals-test.pl 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -$MODULE_NAME = "Signals Test Script in Perl"; - -use Purple; - -%PLUGIN_INFO = ( - perl_api_version => 2, - name => "Perl: $MODULE_NAME", - version => "0.1", - summary => "Signals Test plugin for the Perl interpreter.", - description => "Demonstrate the use of purple signals from " . - "a perl plugin.", - author => "Sadrul Habib Chowdhury ", - url => "http://developer.pidgin.im/wiki/sadrul/", - - load => "plugin_load", - unload => "plugin_unload" -); - -# Accounts -sub account_connecting_cb -{ - my $account = shift; - Purple::Debug::misc("signals test in perl", "account-connecting (" . $account->get_username() . ")\n"); -} - -# Buddylist -sub buddy_signed_on -{ - my $buddy = shift; - Purple::Debug::misc("signals test in perl", "buddy-signed-on (" . $buddy->get_name() . ")\n"); -} - -# Connections -sub signed_on -{ - my $conn = shift; - Purple::Debug::misc("signals test in perl", "signed-on (" . $conn->get_account()->get_username() . ")\n"); -} - -# Conversations -sub conv_received_msg -{ - my ($account, $sender, $message, $conv, $flags, $data) = @_; - Purple::Debug::misc("signals test in perl", "$data (" . $account->get_username() . ", $sender, $message, $flags)\n"); -} - -sub plugin_load -{ - my $plugin = shift; - - # Hook to the signals - - # Accounts - $act_handle = Purple::Accounts::get_handle(); - Purple::Signal::connect($act_handle, "account-connecting", $plugin, - \&account_connecting_cb, 0); - - # Buddy List - $blist = Purple::BuddyList::get_handle(); - Purple::Signal::connect($blist, "buddy-signed-on", $plugin, - \&buddy_signed_on, 0); - - # Connections - $conn = Purple::Connections::get_handle(); - Purple::Signal::connect($conn, "signed-on", $plugin, - \&signed_on, 0); - - # Conversations - $conv = Purple::Conversations::get_handle(); - Purple::Signal::connect($conv, "received-im-msg", $plugin, - \&conv_received_msg, "received im message"); - Purple::Signal::connect($conv, "received-chat-msg", $plugin, - \&conv_received_msg, "received chat message"); -} - -sub plugin_unload -{ - # Nothing to do here for this plugin. -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/pluginpref_example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/pluginpref_example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/pluginpref_example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/pluginpref_example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -/* - * PluginPref Example Plugin - * - * Copyright (C) 2004, Gary Kramlich - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifndef PURPLE_PLUGINS -# define PURPLE_PLUGINS -#endif - -#include "internal.h" - -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" -#include "version.h" - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) { - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_label("boolean"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/bool", - "boolean pref"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_label("integer"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/int", - "integer pref"); - purple_plugin_pref_set_bounds(ppref, 0, 255); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/int_choice", - "integer choice"); - purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); - purple_plugin_pref_add_choice(ppref, "One", GINT_TO_POINTER(1)); - purple_plugin_pref_add_choice(ppref, "Two", GINT_TO_POINTER(2)); - purple_plugin_pref_add_choice(ppref, "Four", GINT_TO_POINTER(4)); - purple_plugin_pref_add_choice(ppref, "Eight", GINT_TO_POINTER(8)); - purple_plugin_pref_add_choice(ppref, "Sixteen", GINT_TO_POINTER(16)); - purple_plugin_pref_add_choice(ppref, "Thirty Two", GINT_TO_POINTER(32)); - purple_plugin_pref_add_choice(ppref, "Sixty Four", GINT_TO_POINTER(64)); - purple_plugin_pref_add_choice(ppref, "One Hundred Twenty Eight", GINT_TO_POINTER(128)); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_label("string"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/string", - "string pref"); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/masked_string", - "masked string"); - purple_plugin_pref_set_masked(ppref, TRUE); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/max_string", - "string pref\n(max length of 16)"); - purple_plugin_pref_set_max_length(ppref, 16); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label( - "/plugins/core/pluginpref_example/string_choice", - "string choice"); - purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); - purple_plugin_pref_add_choice(ppref, "red", "red"); - purple_plugin_pref_add_choice(ppref, "orange", "orange"); - purple_plugin_pref_add_choice(ppref, "yellow", "yellow"); - purple_plugin_pref_add_choice(ppref, "green", "green"); - purple_plugin_pref_add_choice(ppref, "blue", "blue"); - purple_plugin_pref_add_choice(ppref, "purple", "purple"); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "core-pluginpref_example", /**< id */ - "Pluginpref Example", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - "An example of how to use pluginprefs", - /** description */ - "An example of how to use pluginprefs", - "Gary Kramlich ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none("/plugins/core/pluginpref_example"); - purple_prefs_add_bool("/plugins/core/pluginpref_example/bool", TRUE); - purple_prefs_add_int("/plugins/core/pluginpref_example/int", 0); - purple_prefs_add_int("/plugins/core/pluginpref_example/int_choice", 1); - purple_prefs_add_string("/plugins/core/pluginpref_example/string", - "string"); - purple_prefs_add_string("/plugins/core/pluginpref_example/max_string", - "max length string"); - purple_prefs_add_string("/plugins/core/pluginpref_example/masked_string", "masked"); - purple_prefs_add_string("/plugins/core/pluginpref_example/string_choice", "red"); -} - -PURPLE_INIT_PLUGIN(ppexample, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/psychic.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/psychic.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/psychic.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/psychic.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,183 +0,0 @@ - - -#include "internal.h" - -#include "account.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "signals.h" -#include "status.h" -#include "version.h" -#include "privacy.h" - -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" - - -#define PLUGIN_ID "core-psychic" -#define PLUGIN_NAME N_("Psychic Mode") -#define PLUGIN_SUMMARY N_("Psychic mode for incoming conversation") -#define PLUGIN_DESC N_("Causes conversation windows to appear as other" \ - " users begin to message you. This works for" \ - " AIM, ICQ, XMPP, Sametime, and Yahoo!") -#define PLUGIN_AUTHOR "Christopher O'Brien " - - -#define PREFS_BASE "/plugins/core/psychic" -#define PREF_BUDDIES PREFS_BASE "/buddies_only" -#define PREF_NOTICE PREFS_BASE "/show_notice" -#define PREF_STATUS PREFS_BASE "/activate_online" -#define PREF_RAISE PREFS_BASE "/raise_conv" - - -static void -buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) { - PurpleConversation *gconv; - - if(purple_prefs_get_bool(PREF_STATUS) && - ! purple_status_is_available(purple_account_get_active_status(acct))) { - purple_debug_info("psychic", "not available, doing nothing\n"); - return; - } - - if(purple_prefs_get_bool(PREF_BUDDIES) && - ! purple_find_buddy(acct, name)) { - purple_debug_info("psychic", "not in blist, doing nothing\n"); - return; - } - - if(FALSE == purple_privacy_check(acct, name)) { - purple_debug_info("psychic", "user %s is blocked\n", name); - return; - } - - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, acct); - if(! gconv) { - purple_debug_info("psychic", "no previous conversation exists\n"); - gconv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, name); - - if(purple_prefs_get_bool(PREF_RAISE)) { - purple_conversation_present(gconv); - } - - if(purple_prefs_get_bool(PREF_NOTICE)) { - - /* This is a quote from Star Wars. You should probably not - translate it literally. If you can't find a fitting cultural - reference in your language, consider translating something - like this instead: "You feel a new message coming." */ - purple_conversation_write(gconv, NULL, - _("You feel a disturbance in the force..."), - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY, - time(NULL)); - } - - /* Necessary because we may be creating a new conversation window. */ - purple_conv_im_set_typing_state(PURPLE_CONV_IM(gconv), PURPLE_TYPING); - } -} - - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) { - - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - pref = purple_plugin_pref_new_with_name(PREF_BUDDIES); - purple_plugin_pref_set_label(pref, _("Only enable for users on" - " the buddy list")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name(PREF_STATUS); - purple_plugin_pref_set_label(pref, _("Disable when away")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name(PREF_NOTICE); - purple_plugin_pref_set_label(pref, _("Display notification message in" - " conversations")); - purple_plugin_pref_frame_add(frame, pref); - - pref = purple_plugin_pref_new_with_name(PREF_RAISE); - purple_plugin_pref_set_label(pref, _("Raise psychic conversations")); - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - - -static gboolean -plugin_load(PurplePlugin *plugin) { - - void *convs_handle; - convs_handle = purple_conversations_get_handle(); - - purple_signal_connect(convs_handle, "buddy-typing", plugin, - PURPLE_CALLBACK(buddy_typing_cb), NULL); - - return TRUE; -} - - -static PurplePluginUiInfo prefs_info = { - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - PLUGIN_ID, /**< id */ - PLUGIN_NAME, /**< name */ - DISPLAY_VERSION, /**< version */ - PLUGIN_SUMMARY, /**< summary */ - PLUGIN_DESC, /**< description */ - PLUGIN_AUTHOR, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void -init_plugin(PurplePlugin *plugin) { - purple_prefs_add_none(PREFS_BASE); - purple_prefs_add_bool(PREF_BUDDIES, FALSE); - purple_prefs_add_bool(PREF_NOTICE, TRUE); - purple_prefs_add_bool(PREF_STATUS, TRUE); -} - - -PURPLE_INIT_PLUGIN(psychic, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/signals-test.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/signals-test.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/signals-test.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/signals-test.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,957 +0,0 @@ -/* - * Signals test plugin. - * - * Copyright (C) 2003 Christian Hammond. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02111-1301, USA. - */ -#define SIGNAL_TEST_PLUGIN_ID "core-signals-test" - -#include "internal.h" - -#include - -#include "cipher.h" -#include "connection.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "ft.h" -#include "signals.h" -#include "version.h" -#include "status.h" -#include "sound.h" - -/************************************************************************** - * Account subsystem signal callbacks - **************************************************************************/ -static void -account_connecting_cb(PurpleAccount *account, void *data) -{ - purple_debug_misc("signals test", "account-connecting (%s)\n", - purple_account_get_username(account)); -} - -static void -account_setting_info_cb(PurpleAccount *account, const char *info, void *data) -{ - purple_debug_misc("signals test", "account-setting-info (%s, %s)\n", - purple_account_get_username(account), info); -} - -static void -account_set_info_cb(PurpleAccount *account, const char *info, void *data) -{ - purple_debug_misc("signals test", "account-set-info (%s, %s)\n", - purple_account_get_username(account), info); -} - -static void -account_status_changed(PurpleAccount *account, PurpleStatus *old, PurpleStatus *new, - gpointer data) -{ - purple_debug_misc("signals test", "account-status-changed (%s, %s, %s)\n", - purple_account_get_username(account), - purple_status_get_name(old), - purple_status_get_name(new)); -} - -static void -account_alias_changed(PurpleAccount *account, const char *old, gpointer data) -{ - purple_debug_misc("signals test", "account-alias-changed (%s, %s, %s)\n", - purple_account_get_username(account), - old, purple_account_get_alias(account)); -} - -static int -account_authorization_requested_cb(PurpleAccount *account, const char *user, gpointer data) -{ - purple_debug_misc("signals test", "account-authorization-requested (%s, %s)\n", - purple_account_get_username(account), user); - return 0; -} - -static void -account_authorization_granted_cb(PurpleAccount *account, const char *user, gpointer data) -{ - purple_debug_misc("signals test", "account-authorization-granted (%s, %s)\n", - purple_account_get_username(account), user); -} - -static void -account_authorization_denied_cb(PurpleAccount *account, const char *user, gpointer data) -{ - purple_debug_misc("signals test", "account-authorization-denied (%s, %s)\n", - purple_account_get_username(account), user); -} - -/************************************************************************** - * Buddy Icons signal callbacks - **************************************************************************/ -static void -buddy_icon_changed_cb(PurpleBuddy *buddy) -{ - purple_debug_misc("signals test", "buddy icon changed (%s)\n", - purple_buddy_get_name(buddy)); -} - -/************************************************************************** - * Buddy List subsystem signal callbacks - **************************************************************************/ -static void -buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, - PurpleStatus *status, void *data) -{ - purple_debug_misc("signals test", "buddy-status-changed (%s %s to %s)\n", - purple_buddy_get_name(buddy), - purple_status_get_id(old_status), - purple_status_get_id(status)); -} - -static void -buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, - void *data) -{ - purple_debug_misc("signals test", "buddy-idle-changed (%s %s)\n", - purple_buddy_get_name(buddy), - old_idle ? "unidled" : "idled"); -} - -static void -buddy_signed_on_cb(PurpleBuddy *buddy, void *data) -{ - purple_debug_misc("signals test", "buddy-signed-on (%s)\n", - purple_buddy_get_name(buddy)); -} - -static void -buddy_signed_off_cb(PurpleBuddy *buddy, void *data) -{ - purple_debug_misc("signals test", "buddy-signed-off (%s)\n", - purple_buddy_get_name(buddy)); -} - -static void -blist_node_added_cb(PurpleBlistNode *bnode, void *data) -{ - const char *name; - if (PURPLE_BLIST_NODE_IS_GROUP(bnode)) - name = purple_group_get_name(PURPLE_GROUP(bnode)); - else if (PURPLE_BLIST_NODE_IS_CONTACT(bnode)) - /* Close enough */ - name = purple_contact_get_alias(PURPLE_CONTACT(bnode)); - else if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - name = purple_buddy_get_name(PURPLE_BUDDY(bnode)); - else - name = "(unknown)"; - - purple_debug_misc("signals test", "blist_node_added_cb (%s)\n", - name ? name : "(null)"); -} - -static void -blist_node_removed_cb(PurpleBlistNode *bnode, void *data) -{ - const char *name; - if (PURPLE_BLIST_NODE_IS_GROUP(bnode)) - name = purple_group_get_name(PURPLE_GROUP(bnode)); - else if (PURPLE_BLIST_NODE_IS_CONTACT(bnode)) - /* Close enough */ - name = purple_contact_get_alias(PURPLE_CONTACT(bnode)); - else if (PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - name = purple_buddy_get_name(PURPLE_BUDDY(bnode)); - else - name = "(unknown)"; - - purple_debug_misc("signals test", "blist_node_removed_cb (%s)\n", - name ? name : "(null)"); -} - -static void -blist_node_aliased(PurpleBlistNode *node, const char *old_alias) -{ - PurpleContact *p = (PurpleContact *)node; - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleChat *c = (PurpleChat *)node; - PurpleGroup *g = (PurpleGroup *)node; - - if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Contact: %s, %s)\n", - purple_contact_get_alias(p), old_alias); - } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Buddy: %s, %s)\n", - purple_buddy_get_name(b), old_alias); - } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Chat: %s, %s)\n", - purple_chat_get_name(c), old_alias); - } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { - purple_debug_misc("signals test", - "blist-node-aliased (Group: %s, %s)\n", - purple_group_get_name(g), old_alias); - } else { - purple_debug_misc("signals test", - "blist-node-aliased (UNKNOWN: %d, %s)\n", - purple_blist_node_get_type(node), old_alias); - } -} - -static void -blist_node_extended_menu_cb(PurpleBlistNode *node, void *data) -{ - PurpleContact *p = (PurpleContact *)node; - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleChat *c = (PurpleChat *)node; - PurpleGroup *g = (PurpleGroup *)node; - - if (PURPLE_BLIST_NODE_IS_CONTACT(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Contact: %s)\n", - purple_contact_get_alias(p)); - } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Buddy: %s)\n", - purple_buddy_get_name(b)); - } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Chat: %s)\n", - purple_chat_get_name(c)); - } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) { - purple_debug_misc("signals test", - "blist-node-extended-menu (Group: %s)\n", - purple_group_get_name(g)); - } else { - purple_debug_misc("signals test", - "blist-node-extended-menu (UNKNOWN: %d)\n", - purple_blist_node_get_type(node)); - } -} - - -/************************************************************************** - * Connection subsystem signal callbacks - **************************************************************************/ -static void -signing_on_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signing-on (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -signed_on_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signed-on (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -signing_off_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signing-off (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -signed_off_cb(PurpleConnection *gc, void *data) -{ - purple_debug_misc("signals test", "signed-off (%s)\n", - purple_account_get_username(purple_connection_get_account(gc))); -} - -static void -connection_error_cb(PurpleConnection *gc, - PurpleConnectionError err, - const gchar *desc, - void *data) -{ - const gchar *username = - purple_account_get_username(purple_connection_get_account(gc)); - purple_debug_misc("signals test", "connection-error (%s, %u, %s)\n", - username, err, desc); -} - -/************************************************************************** - * Conversation subsystem signal callbacks - **************************************************************************/ -static gboolean -writing_im_msg_cb(PurpleAccount *account, const char *who, char **buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "writing-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), purple_conversation_get_name(conv), *buffer); - - return FALSE; - -} - -static void -wrote_im_msg_cb(PurpleAccount *account, const char *who, const char *buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "wrote-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), purple_conversation_get_name(conv), buffer); -} - -static void -sending_im_msg_cb(PurpleAccount *account, char *recipient, char **buffer, void *data) -{ - purple_debug_misc("signals test", "sending-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), recipient, *buffer); - -} - -static void -sent_im_msg_cb(PurpleAccount *account, const char *recipient, const char *buffer, void *data) -{ - purple_debug_misc("signals test", "sent-im-msg (%s, %s, %s)\n", - purple_account_get_username(account), recipient, buffer); -} - -static gboolean -receiving_im_msg_cb(PurpleAccount *account, char **sender, char **buffer, - PurpleConversation *conv, PurpleMessageFlags *flags, void *data) -{ - purple_debug_misc("signals test", "receiving-im-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), *sender, *buffer, - (conv != NULL) ? purple_conversation_get_name(conv) : "(null)", *flags); - - return FALSE; -} - -static void -received_im_msg_cb(PurpleAccount *account, char *sender, char *buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "received-im-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), sender, buffer, - (conv != NULL) ? purple_conversation_get_name(conv) : "(null)", flags); -} - -static gboolean -writing_chat_msg_cb(PurpleAccount *account, const char *who, char **buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "writing-chat-msg (%s, %s)\n", - purple_conversation_get_name(conv), *buffer); - - return FALSE; -} - -static void -wrote_chat_msg_cb(PurpleAccount *account, const char *who, const char *buffer, - PurpleConversation *conv, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", "wrote-chat-msg (%s, %s)\n", - purple_conversation_get_name(conv), buffer); -} - -static gboolean -sending_chat_msg_cb(PurpleAccount *account, char **buffer, int id, void *data) -{ - purple_debug_misc("signals test", "sending-chat-msg (%s, %s, %d)\n", - purple_account_get_username(account), *buffer, id); - - return FALSE; -} - -static void -sent_chat_msg_cb(PurpleAccount *account, const char *buffer, int id, void *data) -{ - purple_debug_misc("signals test", "sent-chat-msg (%s, %s, %d)\n", - purple_account_get_username(account), buffer, id); -} - -static gboolean -receiving_chat_msg_cb(PurpleAccount *account, char **sender, char **buffer, - PurpleConversation *chat, PurpleMessageFlags *flags, void *data) -{ - purple_debug_misc("signals test", - "receiving-chat-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), *sender, *buffer, - purple_conversation_get_name(chat), *flags); - - return FALSE; -} - -static void -received_chat_msg_cb(PurpleAccount *account, char *sender, char *buffer, - PurpleConversation *chat, PurpleMessageFlags flags, void *data) -{ - purple_debug_misc("signals test", - "received-chat-msg (%s, %s, %s, %s, %d)\n", - purple_account_get_username(account), sender, buffer, - purple_conversation_get_name(chat), flags); -} - -static void -conversation_created_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "conversation-created (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -deleting_conversation_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "deleting-conversation (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -buddy_typing_cb(PurpleAccount *account, const char *name, void *data) -{ - purple_debug_misc("signals test", "buddy-typing (%s, %s)\n", - purple_account_get_username(account), name); -} - -static void -buddy_typing_stopped_cb(PurpleAccount *account, const char *name, void *data) -{ - purple_debug_misc("signals test", "buddy-typing-stopped (%s, %s)\n", - purple_account_get_username(account), name); -} - -static gboolean -chat_buddy_joining_cb(PurpleConversation *conv, const char *user, - PurpleConvChatBuddyFlags flags, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-joining (%s, %s, %d)\n", - purple_conversation_get_name(conv), user, flags); - - return FALSE; -} - -static void -chat_buddy_joined_cb(PurpleConversation *conv, const char *user, - PurpleConvChatBuddyFlags flags, gboolean new_arrival, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-joined (%s, %s, %d, %d)\n", - purple_conversation_get_name(conv), user, flags, new_arrival); -} - -static void -chat_buddy_flags_cb(PurpleConversation *conv, const char *user, - PurpleConvChatBuddyFlags oldflags, PurpleConvChatBuddyFlags newflags, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-flags (%s, %s, %d, %d)\n", - purple_conversation_get_name(conv), user, oldflags, newflags); -} - -static gboolean -chat_buddy_leaving_cb(PurpleConversation *conv, const char *user, - const char *reason, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-leaving (%s, %s, %s)\n", - purple_conversation_get_name(conv), user, reason); - - return FALSE; -} - -static void -chat_buddy_left_cb(PurpleConversation *conv, const char *user, - const char *reason, void *data) -{ - purple_debug_misc("signals test", "chat-buddy-left (%s, %s, %s)\n", - purple_conversation_get_name(conv), user, reason); -} - -static void -chat_inviting_user_cb(PurpleConversation *conv, const char *name, - char **reason, void *data) -{ - purple_debug_misc("signals test", "chat-inviting-user (%s, %s, %s)\n", - purple_conversation_get_name(conv), name, *reason); -} - -static void -chat_invited_user_cb(PurpleConversation *conv, const char *name, - const char *reason, void *data) -{ - purple_debug_misc("signals test", "chat-invited-user (%s, %s, %s)\n", - purple_conversation_get_name(conv), name, reason); -} - -static gint -chat_invited_cb(PurpleAccount *account, const char *inviter, - const char *room_name, const char *message, - const GHashTable *components, void *data) -{ - purple_debug_misc("signals test", "chat-invited (%s, %s, %s, %s)\n", - purple_account_get_username(account), inviter, - room_name, message); - - return 0; -} - -static void -chat_joined_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "chat-joined (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -chat_left_cb(PurpleConversation *conv, void *data) -{ - purple_debug_misc("signals test", "chat-left (%s)\n", - purple_conversation_get_name(conv)); -} - -static void -chat_topic_changed_cb(PurpleConversation *conv, const char *who, - const char *topic, void *data) -{ - purple_debug_misc("signals test", - "chat-topic-changed (%s topic changed to: \"%s\" by %s)\n", - purple_conversation_get_name(conv), topic, - (who) ? who : "unknown"); -} -/************************************************************************** - * Ciphers signal callbacks - **************************************************************************/ -static void -cipher_added_cb(PurpleCipher *cipher, void *data) { - purple_debug_misc("signals test", "cipher %s added\n", - purple_cipher_get_name(cipher)); -} - -static void -cipher_removed_cb(PurpleCipher *cipher, void *data) { - purple_debug_misc("signals test", "cipher %s removed\n", - purple_cipher_get_name(cipher)); -} - -/************************************************************************** - * Core signal callbacks - **************************************************************************/ -static void -quitting_cb(void *data) -{ - purple_debug_misc("signals test", "quitting ()\n"); -} - -static void -printhash(gpointer key, gpointer value, gpointer data) -{ - char *a = (char *)key; - char *b = (char *)value; - GString *str = (GString *)data; - g_string_append_printf(str, " [%s] = [%s]\n", a, b ? b : "(null)"); -} - -static gboolean -uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - GString *str = g_string_new("\n{\n"); - g_hash_table_foreach(params, printhash, str); - g_string_append_c(str, '}'); - purple_debug_misc("signals test", "uri handler (%s, %s, %s)\n", proto, cmd, str->str); - g_string_free(str, TRUE); - return FALSE; -} - -/************************************************************************** - * File transfer signal callbacks - **************************************************************************/ -static void -ft_recv_accept_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive accepted\n"); -} - -static void -ft_send_accept_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send accepted\n"); -} - -static void -ft_recv_start_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive started\n"); -} - -static void -ft_send_start_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send started\n"); -} - -static void -ft_recv_cancel_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive canceled\n"); -} - -static void -ft_send_cancel_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send canceled\n"); -} - -static void -ft_recv_complete_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file receive completed\n"); -} - -static void -ft_send_complete_cb(PurpleXfer *xfer, gpointer data) { - purple_debug_misc("signals test", "file send completed\n"); -} - -/************************************************************************** - * Sound signal callbacks - **************************************************************************/ -static int -sound_playing_event_cb(PurpleSoundEventID event, const PurpleAccount *account) { - if (account != NULL) - purple_debug_misc("signals test", "sound playing event: %d for account: %s\n", - event, purple_account_get_username(account)); - else - purple_debug_misc("signals test", "sound playing event: %d\n", event); - - return 0; -} - -/************************************************************************** - * Notify signals callbacks - **************************************************************************/ -static void -notify_email_cb(char *subject, char *from, char *to, char *url) { - purple_debug_misc("signals test", "notify email: subject=%s, from=%s, to=%s, url=%s\n", - subject, from, to, url); -} - -static void -notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint count) { - int i; - purple_debug_misc("signals test", "notify emails: count=%d\n", count); - for(i=0; iname, - xmlnode_get_namespace(child)); - - if (g_str_equal(type, "get") || g_str_equal(type, "set")) { - /* Send the requisite reply */ - xmlnode *iq = xmlnode_new("iq"); - xmlnode_set_attrib(iq, "to", from); - xmlnode_set_attrib(iq, "id", id); - xmlnode_set_attrib(iq, "type", "result"); - - purple_signal_emit(purple_connection_get_prpl(pc), - "jabber-sending-xmlnode", pc, &iq); - if (iq != NULL) - xmlnode_free(iq); - } - - /* Cookie monster eats IQ stanzas; the prpl shouldn't keep processing */ - return TRUE; -} - -/************************************************************************** - * Plugin stuff - **************************************************************************/ -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *core_handle = purple_get_core(); - void *blist_handle = purple_blist_get_handle(); - void *conn_handle = purple_connections_get_handle(); - void *conv_handle = purple_conversations_get_handle(); - void *accounts_handle = purple_accounts_get_handle(); - void *ciphers_handle = purple_ciphers_get_handle(); - void *ft_handle = purple_xfers_get_handle(); - void *sound_handle = purple_sounds_get_handle(); - void *notify_handle = purple_notify_get_handle(); - void *jabber_handle = purple_plugins_find_with_id("prpl-jabber"); - - /* Accounts subsystem signals */ - purple_signal_connect(accounts_handle, "account-connecting", - plugin, PURPLE_CALLBACK(account_connecting_cb), NULL); - purple_signal_connect(accounts_handle, "account-setting-info", - plugin, PURPLE_CALLBACK(account_setting_info_cb), NULL); - purple_signal_connect(accounts_handle, "account-set-info", - plugin, PURPLE_CALLBACK(account_set_info_cb), NULL); - purple_signal_connect(accounts_handle, "account-status-changed", - plugin, PURPLE_CALLBACK(account_status_changed), NULL); - purple_signal_connect(accounts_handle, "account-alias-changed", - plugin, PURPLE_CALLBACK(account_alias_changed), NULL); - purple_signal_connect(accounts_handle, "account-authorization-requested", - plugin, PURPLE_CALLBACK(account_authorization_requested_cb), NULL); - purple_signal_connect(accounts_handle, "account-authorization-denied", - plugin, PURPLE_CALLBACK(account_authorization_denied_cb), NULL); - purple_signal_connect(accounts_handle, "account-authorization-granted", - plugin, PURPLE_CALLBACK(account_authorization_granted_cb), NULL); - - /* Buddy List subsystem signals */ - purple_signal_connect(blist_handle, "buddy-status-changed", - plugin, PURPLE_CALLBACK(buddy_status_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-idle-changed", - plugin, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-on", - plugin, PURPLE_CALLBACK(buddy_signed_on_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-off", - plugin, PURPLE_CALLBACK(buddy_signed_off_cb), NULL); - purple_signal_connect(blist_handle, "blist-node-added", - plugin, PURPLE_CALLBACK(blist_node_added_cb), NULL); - purple_signal_connect(blist_handle, "blist-node-removed", - plugin, PURPLE_CALLBACK(blist_node_removed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-icon-changed", - plugin, PURPLE_CALLBACK(buddy_icon_changed_cb), NULL); - purple_signal_connect(blist_handle, "blist-node-aliased", - plugin, PURPLE_CALLBACK(blist_node_aliased), NULL); - purple_signal_connect(blist_handle, "blist-node-extended-menu", - plugin, PURPLE_CALLBACK(blist_node_extended_menu_cb), NULL); - - /* Connection subsystem signals */ - purple_signal_connect(conn_handle, "signing-on", - plugin, PURPLE_CALLBACK(signing_on_cb), NULL); - purple_signal_connect(conn_handle, "signed-on", - plugin, PURPLE_CALLBACK(signed_on_cb), NULL); - purple_signal_connect(conn_handle, "signing-off", - plugin, PURPLE_CALLBACK(signing_off_cb), NULL); - purple_signal_connect(conn_handle, "signed-off", - plugin, PURPLE_CALLBACK(signed_off_cb), NULL); - purple_signal_connect(conn_handle, "connection-error", - plugin, PURPLE_CALLBACK(connection_error_cb), NULL); - - /* Conversations subsystem signals */ - purple_signal_connect(conv_handle, "writing-im-msg", - plugin, PURPLE_CALLBACK(writing_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "wrote-im-msg", - plugin, PURPLE_CALLBACK(wrote_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "sending-im-msg", - plugin, PURPLE_CALLBACK(sending_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "sent-im-msg", - plugin, PURPLE_CALLBACK(sent_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "receiving-im-msg", - plugin, PURPLE_CALLBACK(receiving_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "received-im-msg", - plugin, PURPLE_CALLBACK(received_im_msg_cb), NULL); - purple_signal_connect(conv_handle, "writing-chat-msg", - plugin, PURPLE_CALLBACK(writing_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "wrote-chat-msg", - plugin, PURPLE_CALLBACK(wrote_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "sending-chat-msg", - plugin, PURPLE_CALLBACK(sending_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "sent-chat-msg", - plugin, PURPLE_CALLBACK(sent_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "receiving-chat-msg", - plugin, PURPLE_CALLBACK(receiving_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "received-chat-msg", - plugin, PURPLE_CALLBACK(received_chat_msg_cb), NULL); - purple_signal_connect(conv_handle, "conversation-created", - plugin, PURPLE_CALLBACK(conversation_created_cb), NULL); - purple_signal_connect(conv_handle, "deleting-conversation", - plugin, PURPLE_CALLBACK(deleting_conversation_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typing", - plugin, PURPLE_CALLBACK(buddy_typing_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typing-stopped", - plugin, PURPLE_CALLBACK(buddy_typing_stopped_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-joining", - plugin, PURPLE_CALLBACK(chat_buddy_joining_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-joined", - plugin, PURPLE_CALLBACK(chat_buddy_joined_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-flags", - plugin, PURPLE_CALLBACK(chat_buddy_flags_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-leaving", - plugin, PURPLE_CALLBACK(chat_buddy_leaving_cb), NULL); - purple_signal_connect(conv_handle, "chat-buddy-left", - plugin, PURPLE_CALLBACK(chat_buddy_left_cb), NULL); - purple_signal_connect(conv_handle, "chat-inviting-user", - plugin, PURPLE_CALLBACK(chat_inviting_user_cb), NULL); - purple_signal_connect(conv_handle, "chat-invited-user", - plugin, PURPLE_CALLBACK(chat_invited_user_cb), NULL); - purple_signal_connect(conv_handle, "chat-invited", - plugin, PURPLE_CALLBACK(chat_invited_cb), NULL); - purple_signal_connect(conv_handle, "chat-joined", - plugin, PURPLE_CALLBACK(chat_joined_cb), NULL); - purple_signal_connect(conv_handle, "chat-left", - plugin, PURPLE_CALLBACK(chat_left_cb), NULL); - purple_signal_connect(conv_handle, "chat-topic-changed", - plugin, PURPLE_CALLBACK(chat_topic_changed_cb), NULL); - - /* Ciphers signals */ - purple_signal_connect(ciphers_handle, "cipher-added", - plugin, PURPLE_CALLBACK(cipher_added_cb), NULL); - purple_signal_connect(ciphers_handle, "cipher-removed", - plugin, PURPLE_CALLBACK(cipher_removed_cb), NULL); - - /* Core signals */ - purple_signal_connect(core_handle, "quitting", - plugin, PURPLE_CALLBACK(quitting_cb), NULL); - purple_signal_connect(core_handle, "uri-handler", - plugin, PURPLE_CALLBACK(uri_handler), NULL); - - /* File transfer signals */ - purple_signal_connect(ft_handle, "file-recv-accept", - plugin, PURPLE_CALLBACK(ft_recv_accept_cb), NULL); - purple_signal_connect(ft_handle, "file-recv-start", - plugin, PURPLE_CALLBACK(ft_recv_start_cb), NULL); - purple_signal_connect(ft_handle, "file-recv-cancel", - plugin, PURPLE_CALLBACK(ft_recv_cancel_cb), NULL); - purple_signal_connect(ft_handle, "file-recv-complete", - plugin, PURPLE_CALLBACK(ft_recv_complete_cb), NULL); - purple_signal_connect(ft_handle, "file-send-accept", - plugin, PURPLE_CALLBACK(ft_send_accept_cb), NULL); - purple_signal_connect(ft_handle, "file-send-start", - plugin, PURPLE_CALLBACK(ft_send_start_cb), NULL); - purple_signal_connect(ft_handle, "file-send-cancel", - plugin, PURPLE_CALLBACK(ft_send_cancel_cb), NULL); - purple_signal_connect(ft_handle, "file-send-complete", - plugin, PURPLE_CALLBACK(ft_send_complete_cb), NULL); - - /* Sound signals */ - purple_signal_connect(sound_handle, "playing-sound-event", plugin, - PURPLE_CALLBACK(sound_playing_event_cb), NULL); - - /* Notify signals */ - purple_signal_connect(notify_handle, "displaying-email-notification", - plugin, PURPLE_CALLBACK(notify_email_cb), NULL); - purple_signal_connect(notify_handle, "displaying-emails-notification", - plugin, PURPLE_CALLBACK(notify_emails_cb), NULL); - - /* Jabber signals */ - if (jabber_handle) { - purple_signal_connect(jabber_handle, "jabber-receiving-iq", plugin, - PURPLE_CALLBACK(jabber_iq_received), NULL); - purple_signal_connect(jabber_handle, "jabber-receiving-message", plugin, - PURPLE_CALLBACK(jabber_message_received), NULL); - purple_signal_connect(jabber_handle, "jabber-receiving-presence", plugin, - PURPLE_CALLBACK(jabber_presence_received), NULL); - - /* IQ namespace signals */ - purple_signal_emit(jabber_handle, "jabber-register-namespace-watcher", - "bogus_node", "super-duper-namespace"); - /* The above is equivalent to doing: - int result = GPOINTER_TO_INT(purple_plugin_ipc_call(jabber_handle, "register_namespace_watcher", &ok, "bogus_node", "super-duper-namespace")); - */ - - purple_signal_connect(jabber_handle, "jabber-watched-iq", plugin, - PURPLE_CALLBACK(jabber_watched_iq), NULL); - } - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - void *jabber_handle = purple_plugins_find_with_id("prpl-jabber"); - - purple_signals_disconnect_by_handle(plugin); - - if (jabber_handle) { - /* Unregister watched namespaces */ - purple_signal_emit(jabber_handle, "jabber-unregister-namespace-watcher", - "bogus_node", "super-duper-namespace"); - /* The above is equivalent to doing: - int result = GPOINTER_TO_INT(purple_plugin_ipc_call(jabber_handle, "unregister_namespace_watcher", &ok, "bogus_node", "super-duper-namespace")); - */ - } - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SIGNAL_TEST_PLUGIN_ID, /**< id */ - N_("Signals Test"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Test to see that all signals are working properly."), - /** description */ - N_("Test to see that all signals are working properly."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(signalstest, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/simple.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/simple.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/simple.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/simple.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "version.h" - -/** Plugin id : type-author-name (to guarantee uniqueness) */ -#define SIMPLE_PLUGIN_ID "core-ewarmenhoven-simple" - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin loaded.\n"); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - purple_debug(PURPLE_DEBUG_INFO, "simple", "simple plugin unloaded.\n"); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SIMPLE_PLUGIN_ID, /**< id */ - N_("Simple Plugin"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Tests to see that most things are working."), - /** description */ - N_("Tests to see that most things are working."), - "Eric Warmenhoven ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - /* Padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(simple, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/CHANGELOG.txt qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/CHANGELOG.txt --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/CHANGELOG.txt 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/CHANGELOG.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ -Changelog -========= - -24 July 2009 ------------- -* Another crash-on-startup fixed on Win & OSX. And thoroughly tested this time :) - -23 July 2009 ------------- -* Fix for crash-on-startup in newest versions of Skype for Windows and OSX - -20 July 2009 ------------- -* Fixes for a crash when message received in a closed conversation - -22 June 2009 ------------- -* Fixes some annoying crashes -* Shows buddy names in multi-user chats - -28 April 2009 -------------- -* Multi-user chat TLC, both Adium and Pidgin plugins -* IM's turning into Multi-user chats don't mess up any more -* 'Missed' messages downloaded - -4 April 2009 ------------- -* Fix buddy grouping and setting of status in Adium. - -1 April 2009 ------------- -* Last Adium version didn't work without Skype 2.8beta installed, has been fixed. - -27 March 2009 -------------- -* Important update for OSX users, workaround for bug in Skype which increased CPU load and missed messages -* Removes debug info from system.log on OSX - -21 January 2009 ---------------- -* Fixes statuses in Adium, can set your status to Invisible/DND/SkypeMe through Adium status menu - -4 January 2009 --------------- -* Fixed buddies not showing after suspend/disconnect in Adium plugin -* Fixed SkypeOut buddies not showing as online in Adium & Pidgin plugins - -19 November 2008 ----------------- -* Fixed that really annoying assert crash on X11 systems -* Some icons on buddys on buddylist -* Improvements to chats which are saved on buddy list -* Adium plugin brought up to date with the changes from Windows/Linux plugins - -20 October 2008 ---------------- -* Fix for chats coming through as IM's -* SMS sending, right-click on a SkypeOut buddy/buddy with a mobile to Send SMS -* Mobile phone authorisation -* SkypeMe status shows better in buddy list -* Some file transfer fixes for Windows - -25 September 2008 ------------------ -* Update for Adium 1.3 -* New location for files - -24 July 2008 ------------- -* Lots of speed improvements -* Buddy icons for Linux and Mac -* New No-Skype-Needed version of the plugin needs testing. Contact me if you're interested - -9 July 2008 ------------ -* No more annoying error in the Windows installer -* Added SkypeOut icons so that its easier to tell the difference between normal contacts and SkypeOut ones -* Dbus plugin on Pidgin won't say that it's Finch anymore - -3 July 2008 ------------ -* Portuguese translation thanks to Paulo Matos -* Polish translation should be in .deb now - -2 July 2008 ------------ -* Adium 1.2.x users will be able to use the latest version of the plugin -* Please send me a message if languages other than English work for you in Adium menus - -1 July 2008 ------------ -* Fix changing groups for buddies (sometimes crashed) -* New messaging code should reduce battery usage -* Adium plugin icons should line up properly now - -17 June 2008 ------------- -* Italian translation shouldn't be in Russian -* Group stuff: changing groups of buddies in Pidgin changes them in Skype -* Shouldn't come up with the "Skype not running" error message as often -* A few other minor bug fixes -* Oops, a big bugfix - if you already downloaded todays version, get it again - -5 June 2008 ------------ -* Polish translation thanks to Jakub Chrzanowski - -16 May 2008 ------------ -* Italian translation thanks to Roberto Agria -* Russian translation thanks to Petr Vasilyev -* Few minor tweaks to Pidgin plugin - -8 May 2008 ----------- -* Adium plugin updated to not crash on startup with 1.2.5 -* Pidgin plugin now has /kick commands and can handle users being kicked out of a multi-user chat - -28 April 2008 -------------- -* Adium plugin should hide Skype API window for languages other than English now -* Hungarian translations in Windows and Linux versions - -24 April 2008 -------------- -* At long last, translations for Windows versions of the plugin -* /me command is received properly now - -23 April 2008 -------------- -* Multi-user chats should be vastly better -* Joining and leaving messages should show properly in multi-user chats -* The /leave and /topic commands should work in multi-user chats -* The title of the window is now something more useful than a random pile of characters - -21 April 2008 -------------- -* Fixed startup crash on Linux systems -* Added D-Bus versions to .deb package -* D-Bus and X11 versions can now run at the same time -* Skype and SkypeOut groups aren't created at startup if not needed -* Changed Pidgin version number required, so that the plugin runs on older copies of Pidgin again - -20 April 2008 -------------- -* Updated Adium plugin so that it hopefully doesn't freeze Adium while starting Skype - -12 April 2008 -------------- -* Windows installer updated to not create a Program Files directory now -* German translations in Windows package - -26 March 2008 -------------- -* Added Japanese translations to Windows and Debian/Ubuntu packages. If you're interested in translating for your language, get in touch with me :) - -24 March 2008 -------------- -* Adium plugin should automatically allow API access (if access for assistive devices is enabled -- see http://images.apple.com/applescript/uiscripting/gfx/gui.03.jpg) - -11 March 2008 -------------- -* Adium plugin should work with the new 1.2.4b1 Adium Beta - -6 March 2008 ------------- -* Fixed the version numbering on the Debian/Ubuntu package -* Typing notifications (to other plugin users) - -5 March 2008 ------------- -* Windows installer .exe available, installs protocol icons and emote theme too - -4 March 2008 ------------- -* Adium plugin updated - -3 March 2008 ------------- -* Finch plugin available to download since the dbus interface is now working -* Different version numbering system on Debian/Ubuntu package -* Fix for adding extra users to a multi-user chat - -2 March 2008 ------------- -* Fixed Pidgin crash when opening Pidgin's Debug Window -* Skype options screen can be brought up by choosing the "Show Skype Options" menu in the accounts menu - -14 February 2008 ----------------- -* Debian/Ubuntu package has the skype emote theme in it now -* File transfers now correctly show the direction of transfer - -13 February 2008 ----------------- -* RSS Feed for changelog up and running? http://myjobspace.co.nz/images/pidgin/rss.php - -12 February 2008 ----------------- -* Windows plugin has far better connection/disconnection system now - -11 February 2008 ----------------- -* Linux plugin stability and speed increases - -10 February 2008 ----------------- -* Incomming calls calls can be accepted from a pop-up box -* Outgoing calls can be made to people not on your list through the accounts menu - -7 February 2008 ---------------- -* Multi-user chats, at last! - -1 February 2008 ---------------- -* Calls can now be made to offline contacts, allowing u to call peoples voicemail or call forwarding -* Adium plugin has the correct extension again - -31 January 2008 ---------------- -* Adium plugin will start Skype.app if it's not running - -30 January 2008 ---------------- -* Windows version will start up Skype.exe now if it's not running -* Debian/Ubuntu package no longer depends on skype package as this was causing problems -* You can now check your Skype credit balance through the Accounts menu - -29 January 2008 ---------------- -* Skype only automatically started if no other running copy of Skype is running - -22 January 2008 ---------------- -* Fixed bug where buddy display name can get mangled if their mood/status message contains a newline character - -18 January 2008 ---------------- -* Fixed an X11 error which caused pidgin to crash if skype hadn't been started during the current X session - -17 January 2008 ---------------- -* Fixed bug where Pidgin/Adium might lock up if Skype is taking too long to respond - -16 January 2008 ---------------- -* Cross-compile environment set up so there should be regular 64-bit linux builds -* .deb package now for both i686 and amd64 architectures -* .deb package now actually contains files and not just symlinks :) - -15 January 2008 ---------------- -* File transfers even better handled -* New Debian/Ubuntu package available -* Adium plugin hacks Adium a little to make file transfers appear - -14 January 2008 ---------------- -* Linux plugin shouldn't crash on disconnect/close now -* Linux plugin should be a little faster -* File transfers should be better handled -* Skype mood text shouldn't have messages in it any more - -10 January 2008 ---------------- -* Adium plugin doesn't hang when sending/receiving files -* Fixed a potential infinite loop when a buddy updated their status message/mood text - -9 January 2008 --------------- -* Fixed a DoS if status message contains HTML tags - -8 January 2008 --------------- -* Adium plugin doesn't hang on startup -* Adium plugin sets the right user name in the account options - -7 January 2008 --------------- -* Plugin works with Adium 1.2 (but not Adium 1.1 anymore) -* Adium plugin doesn't crash on disconnect -* Using newer Skype protocol version as a stepping-stone to multi-user chats (PROTOCOL 5) -* SkypeOut contacts are added to a SkypeOut group instead of Skype - -9 December 2007 ---------------- -* Buddy icons now refresh when people come online -* Updated the Skype protocol icons (thanks Cube!) -* Fixed buddies from being deleted if they had a particular status message - -4 December 2007 ---------------- -* Users have their status messages updated correctly when coming from online if they have voicemail/call forwarding - -2 December 2007 ---------------- -* Adium plugin doesn't lose messages -* Adium doesn't crash on suspend with plugin running - -25 November 2007 ----------------- -* Skype doesn't annoy with messages when minimising to try -* Setting your avatar icon works properly, and doesn't crash if you set an invalid filename - -22 November 2007 ----------------- -* Windows dll file now compiled from 2.1.1 Pidgin source, so it now works with PortablePidgin - -21 November 2007 ----------------- -* Adium plugin is now legally GPL - Skype.framework is no longer needed and I've created an open-source replacement. -* Adium plugin has changes from Linux/Windows versions ported over. -* Adium plugin crashes less at startup. -* Adium plugin will Hide Skype instead of just minimising it. - -19 November 2007 ----------------- -* X11 fixes for Linux version. The main one stops the 100% CPU crash. -* You can now search for new Skype users from the Account menu. -* More X11 fixes for Linux version. This one should make the plugin more stable and not crash on computers with memory protection. - -18 November 2007 ----------------- -* The plugin can now check for updates to itself and Skype, through the Account menu. - -14 November 2007 ----------------- -* Reconnecting to the Skype process after restarting Skype doesn't cause a crash in Windows -* The plugin can better detect if Skype closed in the background and disconnects (not perfect yet) - -13 November 2007 ----------------- -* Skype will now go offline when Pidgin/libpurple goes offline/unloads (set in account options) - -12 November 2007 ----------------- -* Removed a double free() error on Linux version -* Messages can now be sent to people who appear Offline/Invisible on your contact list -* SkypeOut buddies can now optionaly be Online (set in account options) - -11 November 2007 ----------------- -* Added more error handling on Linux version for dodgy X11 connections - -10 November 2007 ----------------- -* No crash when removing a buddy off your friends list on Skype -* You can now add yourself to your own buddylist (won't show on Skype's friend list) - -6 November 2007 ---------------- -* 'Last Online' information in 'Get Info' window now in a human readable format -* Windows plugin doesn't crash on quit now - -5 November 2007 ---------------- -* Adium plugin now handles UTF-8 characters properly. This time for real :) -* Windows plugin needed a recompile to work with Pidgin 2.2.2 for some reason - -31 October 2007 ---------------- -* Adium plugin should no longer need dependencies installed into weird places -* Adium plugin handles UTF-8 characters properly -* Adium plugin has a lot of debug error messages removed -* Adium plugin now shows the usernames without having to turn off "Show User Icons" - -30 October 2007 ---------------- -* File transfer progress show in Pidgin -* Timezone information in "Get Info" windows is relative to UMT/GMT -* Adium plugin and source are now in .zip files instead of .dmg's -* Skype doesn't need to be started before starting Pidgin/Adium - -24 October 2007 ---------------- -* Changelog has been started -* Long messages (>254 characters) no longer freeze everything -* Requests for contact authorisation should appear now -* Changing the display name of a buddy in libpurple updates it in Skype -* Multi-user chats can be initiated. No messages show up in the chat window yet. -* Incoming event handling re-written to be more responsive - -17 October 2007 ---------------- -* Buddies on libpurple/Skype contact lists are kept in sync with the contact list now -* When Skype syncs messages with another instance of Skype, messages from yourself now appear in the correct IM window -No messages show up in the chat window yet. -* Incoming event handling re-written to be more responsive - -17 October 2007 ---------------- -* Buddies on libpurple/Skype contact lists are kept in sync with the contact list now -* When Skype syncs messages with another instance of Skype, messages from yourself now appear in the correct IM window diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/COPYING.txt qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/COPYING.txt --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/COPYING.txt 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/COPYING.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/debug.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/debug.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/debug.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/debug.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include - -typedef struct -{ - PurpleDebugLevel level; - char *category; - char *message; -} SkypeDebugWrapper; - -void -skype_debug_vargs(PurpleDebugLevel level, const char *category, - const char *format, va_list args); -void skype_debug(PurpleDebugLevel level, const gchar *category, - const gchar *format, ...); - -void skype_debug_info(const gchar *category, const gchar *format, ...); -void skype_debug_warning(const gchar *category, const gchar *format, ...); -void skype_debug_error(const gchar *category, const gchar *format, ...); - -static gboolean skype_debug_cb(SkypeDebugWrapper *wrapper); - -void -skype_debug_info(const gchar *category, const gchar *format, ...) -{ - va_list args; - - va_start(args, format); - skype_debug_vargs(PURPLE_DEBUG_INFO, category, format, args); - va_end(args); - -} - -void -skype_debug_warning(const gchar *category, const gchar *format, ...) -{ - va_list args; - - va_start(args, format); - skype_debug_vargs(PURPLE_DEBUG_WARNING, category, format, args); - va_end(args); -} - -void -skype_debug_error(const gchar *category, const gchar *format, ...) -{ - va_list args; - - va_start(args, format); - skype_debug_vargs(PURPLE_DEBUG_ERROR, category, format, args); - va_end(args); -} - -void -skype_debug(PurpleDebugLevel level, const char *category, - const char *format, ...) -{ - va_list args; - - va_start(args, format); - skype_debug_vargs(level, category, format, args); - va_end(args); -} - -void -skype_debug_vargs(PurpleDebugLevel level, const char *category, - const char *format, va_list args) -{ - SkypeDebugWrapper *wrapper; - gchar *message; - - if (purple_eventloop_get_ui_ops() == NULL) - { - return; - } - - wrapper = g_new(SkypeDebugWrapper, 1); - wrapper->level = level; - wrapper->category = g_strdup(category); - message = g_strdup_vprintf(format, args); - wrapper->message = purple_strreplace(message, "%", "%%"); - g_free(message); - - purple_timeout_add(1, (GSourceFunc) skype_debug_cb, (gpointer)wrapper); -} - -static gboolean -skype_debug_cb(SkypeDebugWrapper *wrapper) -{ - if (wrapper != NULL) - { - purple_debug(wrapper->level, wrapper->category, wrapper->message); - g_free(wrapper->category); - g_free(wrapper->message); - g_free(wrapper); - } - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/libskype.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/libskype.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/libskype.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/libskype.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3246 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * Skype API Terms of Use: - * The following statement must be displayed in the documentation of this appliction: - * This plugin "uses Skype Software" to display contacts, and chat to Skype users from within Pidgin - * "This product uses the Skype API but is not endorsed, certified or otherwise approved in any way by Skype" - * - * The use of this plugin requries your acceptance of the Skype EULA (http://www.skype.com/intl/en/company/legal/eula/index.html) - * - * Skype is the trademark of Skype Limited - */ - -#define PURPLE_PLUGIN -#define DBUS_API_SUBJECT_TO_CHANGE -#define _GNU_SOURCE -#define GETTEXT_PACKAGE "skype4pidgin" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -//VOXOX CHANGE CJC -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -//#include - -#ifdef ENABLE_NLS -# ifdef _WIN32 -# include -# endif -# include -#else -# define _(a) a -#endif - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif /* __GNUC__ >= 4 */ -#endif /* G_GNUC_NULL_TERMINATED */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef USE_VV -#include -PurpleMedia *skype_media_initiate(PurpleConnection *gc, const char *who, PurpleMediaSessionType type); -PurpleMediaCaps skype_get_media_caps(PurpleConnection *gc, const char *who); -static void skype_handle_incoming_call(PurpleConnection *gc, char *callnumber_string); -static void skype_handle_call_got_ended(char *callnumber_string); -static void skype_send_call_end(char *callnumber_string); -static GHashTable *call_media_hash = NULL; -#endif - -typedef struct _SkypeBuddy { - PurpleBuddy *buddy; - - //this bit used in Get Info - gchar *handle; - gchar *fullname; - gchar *mood; - struct tm *birthday; - gchar *gender; - gchar *language; - gchar *country; - gboolean is_video_capable; - gboolean is_authorized; - gboolean is_blocked; - time_t last_online; - gdouble timezone_offset; - guint number_of_buddies; - gchar *about; - - //this bit not used yet - gchar *province; - gchar *city; - gchar *phone_home; - gchar *phone_office; - gchar *phone_mobile; - gchar *homepage; - gboolean has_call_equipment; - gboolean is_voicemail_capable; - gboolean is_callforward_active; - gboolean can_leave_voicemail; - - //libpurple buddy stuff - guint typing_stream; - - //whether we've populated all fields from skype - gboolean is_skypebuddy_complete; -} SkypeBuddy; - -typedef struct _SkypeChat { - PurpleAccount *account; - PurpleConversation *conv; - gint prpl_chat_id; - - gchar *name; - gchar **members; - gchar *partner_handle; - PurpleConversationType type; - gchar *topic; - gchar *friendlyname; - int type_request_count; //count the number of times we request the chat type -} SkypeChat; - -static GHashTable *chat_link_table = NULL; - -//This is used for incomming SMS status messages to be associated with a particular phone number -static GHashTable *sms_convo_link_table = NULL; - -#include "debug.c" -#include "skype_messaging.c" - -static void plugin_init(PurplePlugin *plugin); -gboolean plugin_load(PurplePlugin *plugin); -gboolean plugin_unload(PurplePlugin *plugin); -GList *skype_status_types(PurpleAccount *acct); -void skype_login(PurpleAccount *acct); -void skype_close(PurpleConnection *gc); -int skype_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags); - //VOXOX CHANGE CJC ADD METHOD TO CALL CONTACT -static void skype_buddy_call_voxox(PurpleConnection *gc, const char *info); //VOXOX CHANGE ASV 04-16-2009: added static to the beginning of the function declaration. -int skype_send_sms(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags); -static void hide_skype(); -void skype_get_info(PurpleConnection *gc, const gchar *username); -gchar *skype_get_user_info(const gchar *username, const gchar *property); -void skype_set_status(PurpleAccount *account, PurpleStatus *status); -void skype_set_idle(PurpleConnection *gc, int time); -void skype_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void skype_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void skype_add_deny(PurpleConnection *gc, const char *who); -void skype_rem_deny(PurpleConnection *gc, const char *who); -void skype_add_permit(PurpleConnection *gc, const char *who); -void skype_rem_permit(PurpleConnection *gc, const char *who); -void skype_keepalive(PurpleConnection *gc); -gboolean skype_set_buddies(PurpleAccount *acct); -void skype_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img); -GList *skype_actions(PurplePlugin *plugin, gpointer context); -void skype_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *userinfo, gboolean full); -char *skype_status_text(PurpleBuddy *buddy); -const char *skype_list_icon(PurpleAccount *account, PurpleBuddy *buddy); -const char *skype_normalize(const PurpleAccount *acct, const char *who); -void skype_update_buddy_alias(PurpleBuddy *buddy); -gboolean skype_update_buddy_status(PurpleBuddy *buddy); -void skype_get_account_alias(PurpleAccount *acct); -const char *skype_get_account_username(PurpleAccount *acct); -static PurpleAccount *skype_get_account(PurpleAccount *newaccount); -void skype_update_buddy_icon(PurpleBuddy *buddy); -static GList *skype_node_menu(PurpleBlistNode *node); -static void skype_silence(PurplePlugin *plugin, gpointer data); -void skype_slist_friend_check(gpointer buddy_pointer, gpointer friends_pointer); -int skype_slist_friend_search(gconstpointer buddy_pointer, gconstpointer buddyname_pointer); -static gboolean skype_check_missedmessages(PurpleAccount *account); -static int skype_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); -static void skype_chat_leave(PurpleConnection *gc, int id); -static void skype_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *who); -static void skype_initiate_chat(PurpleBlistNode *node, gpointer data); -static void skype_set_chat_topic(PurpleConnection *gc, int id, const char *topic); -gchar *skype_cb_real_name(PurpleConnection *gc, int id, const char *who); -GList *skype_join_chat_info(PurpleConnection *gc); -GHashTable *skype_join_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -void skype_alias_buddy(PurpleConnection *gc, const char *who, const char *alias); -gboolean skype_offline_msg(const PurpleBuddy *buddy); -//void skype_slist_remove_messages(gpointer buddy_pointer, gpointer unused); -static void skype_plugin_update_check(void); -void skype_plugin_update_callback(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); -gchar *timestamp_to_datetime(time_t timestamp); -void skype_show_search_users(PurplePluginAction *action); -static void skype_search_users(PurpleConnection *gc, const gchar *searchterm); -void skype_searchresults_add_buddy(PurpleConnection *gc, GList *row, void *user_data); -gchar *skype_strdup_withhtml(const gchar *src); -void skype_join_chat(PurpleConnection *, GHashTable *components); -gchar *skype_get_chat_name(GHashTable *components); -static void skype_display_skype_credit(PurplePluginAction *action); -unsigned int skype_send_typing(PurpleConnection *, const char *name, PurpleTypingState state); -static PurpleCmdRet skype_cmd_leave(PurpleConversation *, const gchar *, gchar **, gchar **, void *); -static PurpleCmdRet skype_cmd_topic(PurpleConversation *, const gchar *, gchar **, gchar **, void *); -static PurpleCmdRet skype_cmd_kick(PurpleConversation *, const gchar *, gchar **, gchar **, void *); -static PurpleCmdRet skype_cmd_kickban(PurpleConversation *, const gchar *, gchar **, gchar **, void *); -int skype_send_raw(PurpleConnection *, const char *, int); -void skype_group_buddy(PurpleConnection *, const char *who, const char *old_group, const char *new_group); -void skype_rename_group(PurpleConnection *, const char *old_name, PurpleGroup *group, GList *moved_buddies); -void skype_remove_group(PurpleConnection *, PurpleGroup *); -int skype_find_group_with_name(const char *group_name_in); -static gboolean skype_uri_handler(const char *proto, const char *cmd, GHashTable *params); -void skype_buddy_free(PurpleBuddy *buddy); -const char *skype_list_emblem(PurpleBuddy *buddy); -SkypeBuddy *skype_buddy_new(PurpleBuddy *buddy); -static void skype_open_sms_im(PurpleBlistNode *node, gpointer data); -void skype_got_buddy_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); -gboolean skype_check_keepalive(PurpleConnection *gc); -void skype_open_verify_mobile_number_step2(gpointer ignore, gchar *mobile_number); -static void skype_open_verify_mobile_number(PurplePlugin *plugin, gpointer data); -void skype_open_verify_mobile_number_step3(gpointer mobile_number, gchar *verification_code); -gchar *skype_set_next_sms_number_for_conversation(PurpleConversation *conv, const gchar *who); -gboolean skype_login_cb(gpointer acct); -void skype_put_buddies_in_groups(void); -gboolean groups_table_find_group(gpointer key, gpointer value, gpointer user_data); -PurpleChat *skype_find_blist_chat(PurpleAccount *account, const char *name); - -#ifndef SKYPENET -static void skype_open_skype_options(void); -void skype_call_number(gpointer ignore, gchar *number); -void skype_call_number_request(PurplePlugin *plugin, gpointer data); -void skype_program_update_callback(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message); -static void skype_program_update_check(void); -static void skype_send_file_from_blist(PurpleBlistNode *node, gpointer data); -static void skype_call_user_from_blist(PurpleBlistNode *node, gpointer data); -#endif - - - - -PurplePluginProtocolInfo prpl_info = { - /* options */ -#ifndef SKYPENET -#if _WIN32 || __APPLE__ || SKYPE_DBUS || !USE_XVFB_SERVER - OPT_PROTO_NO_PASSWORD| -#endif -#endif - OPT_PROTO_REGISTER_NOSCREENNAME|OPT_PROTO_CHAT_TOPIC|OPT_PROTO_SLASH_COMMANDS_NATIVE, - - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - skype_list_icon, /* list_icon */ - skype_list_emblem, /* list_emblem */ - skype_status_text, /* status_text */ - skype_tooltip_text, /* tooltip_text */ - skype_status_types, /* status_types */ - skype_node_menu, /* blist_node_menu */ - skype_join_chat_info,/* chat_info */ - skype_join_chat_info_defaults,/* chat_info_defaults */ - skype_login, /* login */ - skype_close, /* close */ - skype_send_im, /* send_im */ - //VOXOX CHANGE CJC, METHOD WAS NULL, CHANTE IT TO BE ABBLE TO CALL SKYPE CONTACTS FROM VOXOX, NOT THE PRITTIES WAY, BUT WORKS - skype_buddy_call_voxox,/* set_info */ - skype_send_typing, /* send_typing */ - skype_get_info, /* get_info */ - skype_set_status, /* set_status */ - skype_set_idle, /* set_idle */ - NULL, /* change_passwd */ - skype_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - skype_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - skype_add_permit, /* add_permit */ - skype_add_deny, /* add_deny */ - skype_rem_permit, /* rem_permit */ - skype_rem_deny, /* rem_deny */ - NULL, /* set_permit_deny */ - skype_join_chat, /* join_chat */ - NULL, /* reject chat invite */ - skype_get_chat_name, /* get_chat_name */ - skype_chat_invite, /* chat_invite */ - /*skype_chat_leave*/NULL, /* chat_leave */ - NULL, /* chat_whisper */ - skype_chat_send, /* chat_send */ - skype_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - skype_alias_buddy, /* alias_buddy */ - skype_group_buddy, /* group_buddy */ - skype_rename_group, /* rename_group */ - skype_buddy_free, /* buddy_free */ - NULL, /* convo_closed */ - skype_normalize, /* normalize */ - skype_set_buddy_icon,/* set_buddy_icon */ - skype_remove_group, /* remove_group */ - /*skype_cb_real_name*/NULL, /* get_cb_real_name */ - skype_set_chat_topic,/* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - skype_offline_msg, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - skype_send_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* attention_types */ -#if PURPLE_MAJOR_VERSION == 2 && PURPLE_MINOR_VERSION == 1 - (gpointer) -#endif - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ -#ifdef USE_VV - skype_media_initiate,/* initiate_media */ - skype_get_media_caps /* can_do_media */ -#endif -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, -/* PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, -*/ - 2, 1, - PURPLE_PLUGIN_PROTOCOL, /* type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ -#ifdef SKYPENET - "prpl-bigbrownchunx-skypenet", - "Skype (Network)", -#else -#ifdef SKYPE_DBUS - "prpl-bigbrownchunx-skype-dbus", /* id */ - "Skype (D-Bus)", -#else - "prpl-bigbrownchunx-skype", /* id */ - "Skype", /* name */ -#endif -#endif - "2.0", /* version */ - "Allows using Skype IM functions from within Pidgin", /* summary */ - "Allows using Skype IM functions from within Pidgin", /* description */ - "Eion Robb ", /* author */ - "http://eion.robbmob.com/", /* homepage */ - plugin_load, /* load */ - plugin_unload, /* unload */ - NULL, /* destroy */ - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - skype_actions, /* actions */ - NULL, /* padding */ - NULL, - NULL, - NULL -}; - -static PurplePlugin *this_plugin; - -static void -plugin_init(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - -#if _WIN32 && ENABLE_NLS - bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#endif - - if (!g_thread_supported ()) - g_thread_init (NULL); - this_plugin = plugin; - /* plugin's path at - this_plugin->path */ - -#ifdef SKYPENET - option = purple_account_option_string_new(_("Server"), "host", "skype.robbmob.com"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_int_new(_("Port"), "port", 5000); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - option = purple_account_option_bool_new(_("Show SkypeOut contacts as 'Online'"), "skypeout_online", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Make Skype online/offline when going online/offline"), "skype_sync", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Automatically check for updates"), "check_for_updates", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#ifndef SKYPENET - option = purple_account_option_bool_new(_("Auto-start Skype if not running"), "skype_autostart", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - //leave - purple_cmd_register("leave", "", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_IM | - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - plugin->info->id, skype_cmd_leave, - _("leave [channel]: Leave the chat"), NULL); - //topic - purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - plugin->info->id, skype_cmd_topic, - _("topic [<new topic>]: View or change the topic"), - NULL); - //call, as in call person - //kick - purple_cmd_register("kick", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - plugin->info->id, skype_cmd_kick, - _("kick <user> [room]: Kick a user from the room."), - NULL); - //kickban - purple_cmd_register("kickban", "s", PURPLE_CMD_P_PRPL, PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - plugin->info->id, skype_cmd_kickban, - _("kick <user> [room]: Kick a user from the room."), - NULL); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, PURPLE_CALLBACK(skype_uri_handler), NULL); -} - -static PurpleCmdRet -skype_cmd_leave(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - PurpleConnection *gc = NULL; - int id = -1; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == -1) - return PURPLE_CMD_RET_FAILED; - - skype_chat_leave(gc, id); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet -skype_cmd_topic(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - PurpleConnection *gc = NULL; - int id = -1; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == -1) - return PURPLE_CMD_RET_FAILED; - - skype_set_chat_topic(gc, id, args ? args[0] : NULL); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet -skype_cmd_kick(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - gchar *temp; - gchar *chat_id; - - chat_id = (gchar *)g_hash_table_lookup(conv->data, "chat_id"); - temp = skype_send_message("ALTER CHAT %s KICK %s", chat_id, args[0]); - if (!temp || !strlen(temp)) - { - if(temp) g_free(temp); - return PURPLE_CMD_RET_FAILED; - } - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet -skype_cmd_kickban(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - gchar *temp; - gchar *chat_id; - - chat_id = (gchar *)g_hash_table_lookup(conv->data, "chat_id"); - temp = skype_send_message("ALTER CHAT %s KICKBAN %s", chat_id, args[0]); - if (!temp || !strlen(temp)) - { - if(temp) g_free(temp); - return PURPLE_CMD_RET_FAILED; - } - return PURPLE_CMD_RET_OK; -} - -PURPLE_INIT_PLUGIN(skype, plugin_init, info); - - - -static PurpleAccount * -skype_get_account(PurpleAccount *newaccount) -{ - static PurpleAccount* account; - if (newaccount != NULL) - account = newaccount; - return account; -} - -#if 0 -void skype_ft_debug(PurpleXfer *xfer) {printf("%s\n", xfer->account->protocol_id);} -void skype_ft_new_xfer(PurpleXfer *xfer) {printf("skype_ft_new_xfer\n");skype_ft_debug(xfer);} -void skype_ft_destroy(PurpleXfer *xfer) {printf("skype_ft_destroy\n");skype_ft_debug(xfer);} -void skype_ft_add_xfer(PurpleXfer *xfer) {printf("skype_ft_add_xfer\n");skype_ft_debug(xfer);} -void skype_ft_update_progress(PurpleXfer *xfer, double percent) {printf("skype_ft_update_progress\n");skype_ft_debug(xfer);} -void skype_ft_cancel_local(PurpleXfer *xfer) {printf("skype_ft_cancel_local\n");skype_ft_debug(xfer);} -void skype_ft_cancel_remote(PurpleXfer *xfer) {printf("skype_ft_cancel_remote\n");skype_ft_debug(xfer);} - -gboolean -plugin_load(PurplePlugin *plugin) -{ - PurpleXferUiOps *ops = purple_xfers_get_ui_ops(); - ops->new_xfer = skype_ft_new_xfer; - ops->destroy = skype_ft_destroy; - ops->add_xfer = skype_ft_add_xfer; - ops->update_progress = skype_ft_update_progress; - ops->cancel_local = skype_ft_cancel_local; - ops->cancel_remote = skype_ft_cancel_remote; - return TRUE; -} -#else -gboolean -plugin_load(PurplePlugin *plugin) -{ - return TRUE; -} -#endif - -gboolean -plugin_unload(PurplePlugin *plugin) -{ - return TRUE; -} - -static GList * -skype_node_menu(PurpleBlistNode *node) -{ - GList *m = NULL; - PurpleMenuAction *act; - PurpleBuddy *buddy; - SkypeBuddy *sbuddy; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { -#ifndef SKYPENET -#ifndef __APPLE__ - act = purple_menu_action_new(_("_Send File"), - PURPLE_CALLBACK(skype_send_file_from_blist), - NULL, NULL); - m = g_list_append(m, act); -#endif -#ifndef USE_VV - act = purple_menu_action_new(_("Call..."), - PURPLE_CALLBACK(skype_call_user_from_blist), - NULL, NULL); - m = g_list_append(m, act); -#endif -#endif - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(skype_initiate_chat), - NULL, NULL); - m = g_list_append(m, act); - - buddy = (PurpleBuddy *)node; - sbuddy = (SkypeBuddy *)buddy->proto_data; - - if (buddy->name[0] == '+' || (sbuddy && sbuddy->phone_mobile)) - { - act = purple_menu_action_new(_("Send SMS"), - PURPLE_CALLBACK(skype_open_sms_im), - NULL, NULL); - m = g_list_append(m, act); - } - } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) - { - - } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) - { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(skype_initiate_chat), - NULL, NULL); - m = g_list_append(m, act); - } - return m; -} - -#ifndef SKYPENET -static void -skype_send_file_from_blist(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - buddy = (PurpleBuddy *) node; - if (PURPLE_BUDDY_IS_ONLINE(buddy)) - { - skype_send_message_nowait("OPEN FILETRANSFER %s", buddy->name); - } - } -} - -static void -skype_call_user_from_blist(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - buddy = (PurpleBuddy *) node; - skype_send_message_nowait("CALL %s", buddy->name); - } -} -#endif -//VOXOX CHANCE CJC CALL BUDDY FROM VOXOX -static void skype_buddy_call_voxox(PurpleConnection * gc, const char *info) -{ - skype_send_message_nowait("CALL %s", info); -} - -const char * -skype_normalize(const PurpleAccount *acct, const char *who) -{ - static gchar *last_normalize = NULL; - //VOXOX - JRT - 2009.10.07 - We get a lot of crashes here when user has changed networks (like moving from home to office). - // It looks like there is no way for the g_free to have bad data, but it has already been free'd. - // So, we will set ptr to NULL, so avoid. - if (last_normalize) - { - g_free(last_normalize); - last_normalize = NULL; //VOXOX - JRT - 2009.10.07 - } - last_normalize = g_utf8_strdown(who, -1); - return last_normalize; -} - -GList * -skype_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m = NULL; - PurpleMenuAction *act; - -#ifndef SKYPENET - act = purple_menu_action_new(_("Hide Skype"), - PURPLE_CALLBACK(skype_silence), - NULL, NULL); - m = g_list_append(m, act); - act = purple_menu_action_new(_("Check for Skype updates..."), - PURPLE_CALLBACK(skype_program_update_check), - NULL, NULL); - m = g_list_append(m, act); -#endif - if (this_plugin != NULL && this_plugin->path != NULL) - { - act = purple_menu_action_new(_("Check for plugin updates..."), - PURPLE_CALLBACK(skype_plugin_update_check), - NULL, NULL); - m = g_list_append(m, act); - } - - act = purple_menu_action_new(_("Search for buddies..."), - PURPLE_CALLBACK(skype_show_search_users), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Check Skype balance..."), - PURPLE_CALLBACK(skype_display_skype_credit), - NULL, NULL); - m = g_list_append(m, act); -#ifndef SKYPENET - act = purple_menu_action_new(_("Call..."), - PURPLE_CALLBACK(skype_call_number_request), - NULL, NULL); - m = g_list_append(m, act); - -#ifndef __APPLE__ - act = purple_menu_action_new(_("Open Skype Options..."), - PURPLE_CALLBACK(skype_open_skype_options), - NULL, NULL); - m = g_list_append(m, act); -#endif -#endif - - act = purple_menu_action_new(_("Verify mobile number..."), - PURPLE_CALLBACK(skype_open_verify_mobile_number), - NULL, NULL); - m = g_list_append(m, act); - - return m; -} - -#ifndef SKYPENET -static void -skype_open_skype_options(void) -{ - skype_send_message_nowait("OPEN OPTIONS"); -} -#endif - -static void -skype_silence(PurplePlugin *plugin, gpointer data) -{ - skype_send_message_nowait("SET SILENT_MODE ON"); - skype_send_message_nowait("MINIMIZE"); - hide_skype(); -} - -static void -skype_open_verify_mobile_number(PurplePlugin *plugin, gpointer data) -{ - purple_request_input(plugin, _("Verify mobile number..."), _("Enter the mobile phone number to send verification SMS to"), NULL, - NULL, FALSE, FALSE, NULL, _("OK"), G_CALLBACK(skype_open_verify_mobile_number_step2), _("_Cancel"), - NULL, NULL, NULL, NULL, plugin); -} - -void -skype_open_verify_mobile_number_step2(gpointer plugin, gchar *mobile_number) -{ - skype_send_message_nowait("CREATE SMS CONFIRMATION_CODE_REQUEST %s", mobile_number); - purple_request_input(plugin, _("Verify mobile number..."), _("Enter the verification code which was sent to your mobile"), NULL, - NULL, FALSE, FALSE, NULL, _("OK"), G_CALLBACK(skype_open_verify_mobile_number_step3), _("_Cancel"), - NULL, NULL, NULL, NULL, mobile_number); -} - -void -skype_open_verify_mobile_number_step3(gpointer mobile_number, gchar *verification_code) -{ - skype_send_message_nowait("CREATE SMS CONFIRMATION_CODE_SUBMIT %s", mobile_number); -} - -static void -skype_plugin_update_check(void) -{ - gchar *basename; - struct stat *filestat = g_new(struct stat, 1); - - //this_plugin is the PidginPlugin - if (this_plugin == NULL || this_plugin->path == NULL || filestat == NULL || g_stat(this_plugin->path, filestat) == -1) - { - purple_notify_warning(this_plugin, "Warning", "Could not check for updates", NULL); - } else { - basename = g_path_get_basename(this_plugin->path); - purple_util_fetch_url(g_strconcat("http://eion.robbmob.com/version?version=", basename, NULL), - TRUE, NULL, FALSE, skype_plugin_update_callback, (gpointer)filestat); - } -} - -void -skype_plugin_update_callback(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - time_t mtime = ((struct stat *) user_data)->st_mtime; - time_t servertime = atoi(url_text); - skype_debug_info("skype", "Server filemtime: %d, Local filemtime: %d\n", servertime, mtime); - if (servertime > mtime) - { - purple_notify_info(this_plugin, _("New Version Available"), _("There is a newer version of the Skype plugin available for download."), - g_strconcat(_("Your version"),": ",timestamp_to_datetime(mtime),"\n",_("Latest version"),": ",timestamp_to_datetime(servertime),"\nLatest version available from: ", this_plugin->info->homepage, NULL)); - } else { - purple_notify_info(this_plugin, _("No updates found"), _("No updates found"), _("You have the latest version of the Skype plugin")); - } -} - -#ifndef SKYPENET -static void -skype_program_update_check(void) -{ - /* - Windows: - http://ui.skype.com/ui/0/3.5.0.239/en/getnewestversion - - Linux: - http://ui.skype.com/ui/2/2.0.0.13/en/getnewestversion - - Mac: - http://ui.skype.com/ui/3/2.6.0.151/en/getnewestversion - - User-Agent: Skype - */ - - gchar *version; - gchar *temp; - gchar version_url[60]; - int platform_number; - -#ifdef _WIN32 - platform_number = 0; -#else -# ifdef __APPLE__ - platform_number = 3; -# else - platform_number = 2; -# endif -#endif - - temp = skype_send_message("GET SKYPEVERSION"); - version = g_strdup(&temp[13]); - g_free(temp); - - sprintf(version_url, "http://ui.skype.com/ui/%d/%s/en/getnewestversion", platform_number, version); - purple_util_fetch_url(version_url, TRUE, "Skype", TRUE, skype_program_update_callback, (gpointer)version); -} - -void -skype_program_update_callback(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - gchar *version = (gchar *)user_data; - int v1, v2, v3, v4; - int s1, s2, s3, s4; - gboolean newer_version = FALSE; - - sscanf(version, "%d.%d.%d.%d", &v1, &v2, &v3, &v4); - sscanf(url_text, "%d.%d.%d.%d", &s1, &s2, &s3, &s4); - - if (s1 > v1) - newer_version = TRUE; - else if (s1 == v1 && s2 > v2) - newer_version = TRUE; - else if (s1 == v1 && s2 == v2 && s3 > v3) - newer_version = TRUE; - else if (s1 == v1 && s2 == v2 && s3 == v3 && s4 > v4) - newer_version = TRUE; - - if (newer_version) - { - purple_notify_info(this_plugin, _("New Version Available"), _("There is a newer version of Skype available for download"), g_strconcat(_("Your version"),": ", version, "\n",_("Latest version"),": ", url_text, "\n\nhttp://www.skype.com/go/download", NULL)); - } else { - purple_notify_info(this_plugin, _("No updates found"), _("No updates found"), _("You have the latest version of Skype")); - } -} - -void -skype_call_number_request(PurplePlugin *plugin, gpointer data) -{ - //http://developer.pidgin.im/doxygen/dev/html/request_8h.html#80ea2f9ad3a45471e05f09a2b5abcd75 - purple_request_input(plugin, _("Call..."), _("Enter the phone number or Skype buddy name to call"), NULL, - NULL, FALSE, FALSE, NULL, _("Call..."), G_CALLBACK(skype_call_number), _("_Cancel"), - NULL, NULL, NULL, NULL, NULL); -} - -void -skype_call_number(gpointer ignore, gchar *number) -{ - skype_send_message_nowait("CALL %s", number); -} -#endif - -GList * -skype_status_types(PurpleAccount *acct) -{ - GList *types; - PurpleStatusType *status; - - skype_debug_info("skype", "returning status types\n"); - - types = NULL; - - /* Statuses are almost all the same. Define a macro to reduce code repetition. */ -#define _SKYPE_ADD_NEW_STATUS(prim,id,name) status = \ - purple_status_type_new_with_attrs( \ - prim, /* PurpleStatusPrimitive */ \ - id, /* id */ \ - _(name),/* name */ \ - FALSE, /* savable */ \ - TRUE, /* user_settable */ \ - FALSE, /* not independent */ \ - \ - /* Attributes - each status can have a message. */ \ - "message", \ - _("Message"), \ - purple_value_new(PURPLE_TYPE_STRING), \ - NULL); \ - \ - \ - types = g_list_append(types, status) - - - _SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_AVAILABLE, "ONLINE", "Online"); - _SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_AVAILABLE, "SKYPEME", "SkypeMe"); - _SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_AWAY, "AWAY", "Away"); - _SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_EXTENDED_AWAY, "NA", "Not Available"); - _SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_UNAVAILABLE, "DND", "Do Not Disturb"); - _SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_INVISIBLE, "INVISIBLE", "Invisible"); - //_SKYPE_ADD_NEW_STATUS(PURPLE_STATUS_OFFLINE, "Offline"); - - //User status could be 'logged out' - make not settable - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, "LOGGEDOUT", _("Logged out"), FALSE, FALSE, FALSE); - types = g_list_append(types, status); - - //User could be a SkypeOut contact - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, "SKYPEOUT", _("SkypeOut"), FALSE, FALSE, FALSE); - types = g_list_append(types, status); - - //Offline people shouldn't have status messages - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, "OFFLINE", _("Offline"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - return types; -} - -gboolean -skype_set_buddies(PurpleAccount *acct) -{ - char *friends_text; - gchar **mood_buddyname; - char **friends; - char **full_friends_list; - GSList *existing_friends; - PurpleBuddy *buddy; - SkypeBuddy *sbuddy; - PurpleGroup *skype_group = NULL; - PurpleGroup *skypeout_group = NULL; - int i; - - friends_text = skype_send_message("GET AUTH_CONTACTS_PROFILES"); - if (!friends_text || friends_text[0] == '\0') - { - g_free(friends_text); - } else { - full_friends_list = g_strsplit((strchr(friends_text, ' ')+1), ";", 0); - g_free(friends_text); - if (full_friends_list && full_friends_list[0]) - { - //in the format of: username;full name;phone;office phone;mobile phone; - // online status;friendly name;voicemail;mood - // (comma-seperated lines, usernames can have comma's) - - for (i=0; full_friends_list[i]; i+=8) - { - skype_debug_info("skype","Search buddy %s\n", full_friends_list[i]); - buddy = purple_find_buddy(acct, full_friends_list[i]); - if (buddy != NULL) - { - //the buddy was already in the list - sbuddy = buddy->proto_data = g_new0(SkypeBuddy, 1); - sbuddy->handle = buddy->name; - sbuddy->buddy = buddy; - skype_debug_info("skype","Buddy already in list: %s (%s)\n", buddy->name, full_friends_list[i]); - } else { - skype_debug_info("skype","Buddy not in list %s\n", full_friends_list[i]); - buddy = purple_buddy_new(acct, full_friends_list[i], NULL); - sbuddy = buddy->proto_data = g_new0(SkypeBuddy, 1); - sbuddy->handle = buddy->name; - sbuddy->buddy = buddy; - - //find out what group this buddy is in - //for now, dump them into a default group, until skype tells us where they belong - if (full_friends_list[i][0] == '+') - { - if (skypeout_group == NULL) - { - skypeout_group = purple_find_group("SkypeOut"); - if (skypeout_group == NULL) - { - skypeout_group = purple_group_new("SkypeOut"); - purple_blist_add_group(skypeout_group, NULL); - } - } - purple_blist_add_buddy(buddy, NULL, skypeout_group, NULL); - } - else - { - if (skype_group == NULL) - { - skype_group = purple_find_group("Skype"); - if (skype_group == NULL) - { - skype_group = purple_group_new("Skype"); - purple_blist_add_group(skype_group, NULL); - } - } - purple_blist_add_buddy(buddy, NULL, skype_group, NULL); - } - } - - //in the format of: username;full name;phone;office phone;mobile phone; - // online status;friendly name;voicemail;mood - sbuddy->fullname = g_strdup(full_friends_list[i+1]); - if (!purple_buddy_get_server_alias(buddy)) - purple_blist_server_alias_buddy(buddy, sbuddy->fullname); - sbuddy->phone_home = g_strdup(full_friends_list[i+2]); - sbuddy->phone_office = g_strdup(full_friends_list[i+3]); - sbuddy->phone_mobile = g_strdup(full_friends_list[i+4]); - - purple_blist_server_alias_buddy(buddy, full_friends_list[i+6]); - sbuddy->is_voicemail_capable = g_str_equal(full_friends_list[i+7], "TRUE")?TRUE:FALSE; - if (full_friends_list[i+8] == NULL) - { - sbuddy->mood = g_strdup(""); - } else { - mood_buddyname = g_strsplit(full_friends_list[i+8], ",", 2); - if (mood_buddyname[0] == NULL) - { - sbuddy->mood = g_strdup(""); - full_friends_list[i+8] = NULL; - } else { - sbuddy->mood = g_strdup(mood_buddyname[0]); - if (mood_buddyname[1] && mood_buddyname[1][0] != '\0' && full_friends_list[i+8]) - { - g_free(full_friends_list[i+8]); - full_friends_list[i+8] = g_strdup(mood_buddyname[1]); - } else { - full_friends_list[i+8] = NULL; - } - } - g_strfreev(mood_buddyname); - } - - //Do this one last to update buddy list - if (buddy->name[0] == '+') - purple_prpl_got_user_status(acct, buddy->name, "SKYPEOUT", NULL); - else - purple_prpl_got_user_status(acct, buddy->name, full_friends_list[i+5], NULL); - } - g_strfreev(full_friends_list); - return FALSE; - } - } - - friends_text = skype_send_message("SEARCH FRIENDS"); - if (strlen(friends_text) == 0) - { - g_free(friends_text); - return FALSE; - } - //skip first word (should be USERS) and seperate by comma-space - friends = g_strsplit((strchr(friends_text, ' ')+1), ", ", 0); - g_free(friends_text); - if (friends == NULL || friends[0] == NULL) - { - return FALSE; - } - - //Remove from libpurple buddy list if not in skype friends list - existing_friends = purple_find_buddies(acct, NULL); - g_slist_foreach(existing_friends, (GFunc)skype_slist_friend_check, friends); - - //grab the list of buddy's again since they could have changed - existing_friends = purple_find_buddies(acct, NULL); - - for (i=0; friends[i]; i++) - { - //If already in list, dont recreate, reuse - skype_debug_info("skype", "Searching for friend %s\n", friends[i]); - buddy = purple_find_buddy(acct, friends[i]); - - if (buddy != NULL) - { - //the buddy was already in the list - buddy->proto_data = skype_buddy_new(buddy); - skype_debug_info("skype","Buddy already in list: %s (%s)\n", buddy->name, friends[i]); - } else { - skype_debug_info("skype","Buddy not in list %s\n", friends[i]); - buddy = purple_buddy_new(acct, friends[i], NULL); - buddy->proto_data = skype_buddy_new(buddy); - - //find out what group this buddy is in - //for now, dump them into a default group, until skype tells us where they belong - if (friends[i][0] == '+') - { - if (skypeout_group == NULL) - { - skypeout_group = purple_find_group("SkypeOut"); - if (skypeout_group == NULL) - { - skypeout_group = purple_group_new("SkypeOut"); - purple_blist_add_group(skypeout_group, NULL); - } - } - purple_blist_add_buddy(buddy, NULL, skypeout_group, NULL); - } - else - { - if (skype_group == NULL) - { - skype_group = purple_find_group("Skype"); - if (skype_group == NULL) - { - skype_group = purple_group_new("Skype"); - purple_blist_add_group(skype_group, NULL); - } - } - purple_blist_add_buddy(buddy, NULL, skype_group, NULL); - } - } - skype_update_buddy_status(buddy); - skype_update_buddy_alias(buddy); - purple_prpl_got_user_idle(acct, buddy->name, FALSE, 0); - - //skype_update_buddy_icon(buddy); - } - - //special case, if we're on our own buddy list - if ((buddy = purple_find_buddy(acct, skype_get_account_username(acct)))) - { - skype_update_buddy_status(buddy); - skype_update_buddy_alias(buddy); - purple_prpl_got_user_idle(acct, buddy->name, FALSE, 0); - //skype_update_buddy_icon(buddy); - } - - skype_debug_info("skype", "Friends Count: %d\n", i); - g_strfreev(friends); - - skype_put_buddies_in_groups(); - - return FALSE; -} - -void -skype_slist_friend_check(gpointer buddy_pointer, gpointer friends_pointer) -{ - int i; - PurpleBuddy *buddy = (PurpleBuddy *)buddy_pointer; - char **friends = (char **)friends_pointer; - - if (g_str_equal(buddy->name, skype_get_account_username(buddy->account))) - { - //we must have put ourselves on our own list in pidgin, ignore - return; - } - - for(i=0; friends[i]; i++) - { - if (strlen(friends[i]) == 0) - continue; - if (g_str_equal(buddy->name, friends[i])) - return; - } - skype_debug_info("skype", "removing buddy %d with name %s\n", buddy, buddy->name); - purple_blist_remove_buddy(buddy); -} - -int -skype_slist_friend_search(gconstpointer buddy_pointer, gconstpointer buddyname_pointer) -{ - PurpleBuddy *buddy; - gchar *buddyname; - - if (buddy_pointer == NULL) - return -1; - if (buddyname_pointer == NULL) - return 1; - - buddy = (PurpleBuddy *)buddy_pointer; - buddyname = (gchar *)buddyname_pointer; - - if (buddy->name == NULL) - return -1; - - return strcmp(buddy->name, buddyname); -} - -//create the memmem() function for platforms that dont support it -#if __APPLE__ || _WIN32 -#ifndef _LIBC -# define __builtin_expect(expr, val) (expr) -#endif - -#undef memmem - -void *memmem (const void *, size_t, const void *, size_t); - -/* Return the first occurrence of NEEDLE in HAYSTACK. */ -void * -memmem (haystack, haystack_len, needle, needle_len) - const void *haystack; - size_t haystack_len; - const void *needle; - size_t needle_len; -{ - const char *begin; - const char *const last_possible - = (const char *) haystack + haystack_len - needle_len; - - if (needle_len == 0) - /* The first occurrence of the empty string is deemed to occur at - the beginning of the string. */ - return (void *) haystack; - - /* Sanity check, otherwise the loop might search through the whole - memory. */ - if (__builtin_expect (haystack_len < needle_len, 0)) - return NULL; - - for (begin = (const char *) haystack; begin <= last_possible; ++begin) - if (begin[0] == ((const char *) needle)[0] && - !memcmp ((const void *) &begin[1], - (const void *) ((const char *) needle + 1), - needle_len - 1)) - return (void *) begin; - - return NULL; -} -#endif - -void -skype_got_buddy_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - PurpleBuddy *buddy = user_data; - PurpleAccount *acct = buddy->account; - - if (error_message || !len || !url_text) - return; - - purple_buddy_icons_set_for_user(acct, buddy->name, g_memdup(url_text,len), len, NULL); -} - -void -skype_update_buddy_icon(PurpleBuddy *buddy) -{ - PurpleAccount *acct; - gchar *filename = NULL; - gchar *new_filename = NULL; - gchar *image_data = NULL; - gsize image_data_len = 0; - gchar *ret; - int fh; - GError *error; - /* -1 unknown, 0 none, 1 skype api, 2 dbb file, 3 url */ - static gint api_supports_avatar = -#ifndef SKYPENET -# ifdef _WIN32 - 1; -# else - 2; //OSX only supports GET AVATAR in beta -# endif -#else - 3; -#endif - - if (api_supports_avatar == 0) - { - return; - } - - skype_debug_info("skype", "Updating buddy icon for %s (%d)\n", buddy->name, api_supports_avatar); - - acct = purple_buddy_get_account(buddy); - - if (api_supports_avatar == 1 || api_supports_avatar == -1) - { - fh = g_file_open_tmp("skypeXXXXXX", &filename, &error); - close(fh); - - if (filename != NULL) - { - new_filename = g_strconcat(filename, ".jpg", NULL); - g_rename(filename, new_filename); - ret = skype_send_message("GET USER %s AVATAR 1 %s", buddy->name, new_filename); - if (strlen(ret) == 0) - { - skype_debug_warning("skype", "Error: Protocol doesn't suppot AVATAR\n"); - } else { - if (g_file_get_contents(new_filename, &image_data, &image_data_len, NULL)) - { - api_supports_avatar = 1; - purple_buddy_icons_set_for_user(acct, buddy->name, image_data, image_data_len, NULL); - } - } - g_free(ret); - g_unlink(new_filename); - g_free(filename); - g_free(new_filename); - } else { - skype_debug_warning("skype", "Error making temp file %s\n", error->message); - g_error_free(error); - } - } - if (api_supports_avatar == 2 || api_supports_avatar == -1) - { - const gchar *userfiles[] = {"user256", "user1024", "user4096", "user16384", "user32768", "user65536", - "profile256", "profile1024", "profile4096", "profile16384", "profile32768", - NULL}; - char *username = g_strdup_printf("\x03\x10%s", buddy->name); - for (fh = 0; userfiles[fh]; fh++) - { -#ifdef _WIN32 - filename = g_strconcat(purple_home_dir(), "\\Skype\\", acct->username, "\\", userfiles[fh], ".dbb", NULL); -#else -#ifdef __APPLE__ - filename = g_strconcat(purple_home_dir(), "/Library/Application Support/Skype/", acct->username, "/", userfiles[fh], ".dbb", NULL); -#else - filename = g_strconcat(purple_home_dir(), "/.Skype/", acct->username, "/", userfiles[fh], ".dbb", NULL); -#endif -#endif - if (g_file_get_contents(filename, &image_data, &image_data_len, NULL)) - { - char *start = (char *)memmem(image_data, image_data_len, username, strlen(username)+1); - api_supports_avatar = 2; - if (start != NULL) - { - char *next = image_data; - char *last = next; - //find last index of l33l - while ((next = (char *)memmem(next+4, start-next-4, "l33l", 4))) - { - last = next; - } - start = last; - if (start != NULL) - { - char *img_start; - //find end of l33l block - char *end = (char *)memmem(start+4, image_data+image_data_len-start-4, "l33l", 4); - if (!end) end = image_data+image_data_len; - - //look for start of JPEG block - img_start = (char *)memmem(start, end-start, "\xFF\xD8", 2); - if (img_start) - { - //look for end of JPEG block - char *img_end = (char *)memmem(img_start, end-img_start, "\xFF\xD9", 2); - if (img_end) - { - image_data_len = img_end - img_start + 2; - purple_buddy_icons_set_for_user(acct, buddy->name, g_memdup(img_start, image_data_len), image_data_len, NULL); - } - } - } - } - g_free(image_data); - } - g_free(filename); - } - g_free(username); - } - if (api_supports_avatar == 3) - { - filename = g_strconcat("http://", purple_account_get_string(acct, "host", "skype.robbmob.com"), "/avatars/", buddy->name, NULL); - purple_util_fetch_url(filename, TRUE, NULL, FALSE, skype_got_buddy_icon_cb, buddy); - g_free(filename); - return; - } - if (api_supports_avatar == -1) - { - api_supports_avatar = 0; - return; - } -} - -const char * -skype_list_emblem(PurpleBuddy *buddy) -{ - SkypeBuddy *sbuddy; - time_t now; - struct tm *today_tm; - - if (buddy->name[0] == '+') - { - return "mobile"; - } - if (buddy && buddy->proto_data) - { - sbuddy = buddy->proto_data; - if (sbuddy->birthday) - { - now = time(NULL); - today_tm = localtime(&now); - if (sbuddy->birthday->tm_mday == today_tm->tm_mday && - sbuddy->birthday->tm_mon == today_tm->tm_mon && - sbuddy->birthday->tm_year == today_tm->tm_year) - { - return "birthday"; - } - } - if (sbuddy->is_video_capable) - { - return "video"; - } - } - return NULL; -} - - -void -skype_update_buddy_alias(PurpleBuddy *buddy) -{ - skype_send_message_nowait("GET USER %s DISPLAYNAME", buddy->name); - skype_send_message_nowait("GET USER %s FULLNAME", buddy->name); -} - -gboolean -skype_update_buddy_status(PurpleBuddy *buddy) -{ - PurpleAccount *acct; - - if (buddy->name[0] == '+') - { - return FALSE; - } - - acct = purple_buddy_get_account(buddy); - if (purple_account_is_connected(acct) == FALSE) - { - return FALSE; - } - skype_send_message_nowait("GET USER %s ONLINESTATUS", buddy->name); - skype_send_message_nowait("GET USER %s MOOD_TEXT", buddy->name); - skype_send_message_nowait("GET USER %s RICH_MOOD_TEXT", buddy->name); - - /* if this function was called from another thread, don't loop over it */ - return FALSE; -} - -gboolean -skype_login_cb(gpointer acct) -{ - if (!is_skype_running()) - { - purple_timeout_add_seconds(1, skype_login_cb, acct); - return FALSE; - } - skype_login(acct); - return FALSE; -} - -void -skype_login(PurpleAccount *acct) -{ - PurpleConnection *gc; - gchar *reply; - - if (acct == NULL) - { - return; - } - - if (purple_get_blist() == NULL) - { - return; - } - - //set the account, with misleading function name :) - skype_get_account(acct); - - gc = purple_account_get_connection(acct); - - if (gc == NULL) - return; - - gc->flags = PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_URLDESC | - PURPLE_CONNECTION_NO_FONTSIZE | - PURPLE_CONNECTION_NO_IMAGES; - - /* 1. connect to server */ - /* TODO: Work out if a skype connection is already running */ - //purple_account_is_connected(acct) - if (FALSE) - { - purple_connection_error(gc, g_strconcat("\n",_("Only one Skype account allowed"), NULL)); - return; - } - - purple_connection_update_progress(gc, _("Connecting"), 0, 5); - - if (!skype_connect()) - { - if (purple_account_get_bool(acct, "skype_autostart", TRUE)) - { - skype_debug_info("skype", "Should I start Skype?\n"); - if (!is_skype_running()) - { - skype_debug_info("skype", "Yes, start Skype\n"); - if (!exec_skype()) - { - purple_connection_error(gc, g_strconcat("\n", _("Could not connect to Skype process.\nSkype not running?"), NULL)); - return; - } - purple_timeout_add_seconds(10, skype_login_cb, acct); - return; - } - gc->wants_to_die = FALSE; - } else { - gc->wants_to_die = TRUE; - } - purple_connection_error(gc, g_strconcat("\n", _("Could not connect to Skype process.\nSkype not running?"), NULL)); - return; - } - - purple_connection_update_progress(gc, _("Authorizing"), - 1, /* which connection step this is */ - 5); /* total number of steps */ - - - -#if SKYPENET || ! __APPLE__ -#ifdef __APPLE__ - reply = skype_send_message("NAME VoxOx"); //VOXOX CHANGE Alexander 04-13-09 -#else - reply = skype_send_message("NAME %s", g_get_application_name()); -#endif - if (reply == NULL || strlen(reply) == 0) - { - purple_connection_error(gc, g_strconcat("\n",_("Skype client not ready"), NULL)); - return; - } - if (g_str_equal(reply, "CONNSTATUS OFFLINE")) - { - //this happens if we connect before skype has connected to the network - purple_timeout_add_seconds(1, skype_login_cb, acct); - g_free(reply); - return; - } - g_free(reply); -#endif - purple_connection_update_progress(gc, _("Initializing"), 2, 5); - reply = skype_send_message("PROTOCOL 7"); - if (reply == NULL || strlen(reply) == 0) - { - purple_connection_error(gc, g_strconcat("\n",_("Skype client not ready"), NULL)); - return; - } - g_free(reply); - - purple_connection_update_progress(gc, _("Hide Skype"), 3, 5); - skype_silence(NULL, NULL); - purple_connection_update_progress(gc, _("Connected"), 4, 5); - - skype_get_account_alias(acct); - skype_get_account_username(acct); - if (purple_account_get_bool(acct, "skype_sync", TRUE)) - skype_set_status(acct, purple_account_get_active_status(acct)); - skype_send_message_nowait("CREATE APPLICATION libpurple_typing"); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - - //sync buddies after everything else has finished loading - purple_timeout_add_seconds(1, (GSourceFunc)skype_set_buddies, (gpointer)acct); - purple_timeout_add_seconds(30, (GSourceFunc)skype_check_missedmessages, (gpointer)acct); -} - -const char * -skype_get_account_username(PurpleAccount *acct) -{ -#ifdef SKYPENET - if (acct == NULL) - return NULL; - return acct->username; -#else - char *ret; - static char *username = NULL; - - if (username != NULL) - return username; - - if (!acct) - return "Skype"; - - ret = skype_send_message("GET CURRENTUSERHANDLE"); - if (!ret || !strlen(ret)) - { - g_free(ret); - return NULL; - } - username = g_strdup(&ret[18]); - g_free(ret); - - if (acct && !g_str_equal(acct->username, username)) - { - skype_debug_info("skype", "Setting username to %s\n", username); - purple_account_set_username(acct, username); - } - return username; -#endif -} - -void -skype_get_account_alias(PurpleAccount *acct) -{ - char *ret; - char *alias; - alias = (gchar *)purple_account_get_alias(acct); - if (alias != NULL && alias[0] != '\0') - { - //Alias already set, dont do anything - return; - } - - ret = skype_send_message("GET PROFILE FULLNAME"); - alias = g_strdup(&ret[17]); - g_free(ret); - purple_account_set_alias(acct, alias); - g_free(alias); -} - -void -skype_close(PurpleConnection *gc) -{ - GSList *buddies; - - skype_debug_info("skype", "logging out\n"); - - //Close notification boxes (if any) - purple_request_close_with_handle(gc); - - if (gc && purple_account_get_bool(gc->account, "skype_sync", TRUE)) - skype_send_message_nowait("SET USERSTATUS OFFLINE"); - skype_send_message_nowait("SET SILENT_MODE OFF"); - skype_debug_info("skype", "disconnecting...\n"); - skype_disconnect(); - if (gc) - { - //make all buddies offline - for(buddies = purple_find_buddies(gc->account, NULL); - buddies != NULL; - buddies = buddies->next) - { - PurpleBuddy *buddy = buddies->data; - purple_prpl_got_user_status(buddy->account, buddy->name, "OFFLINE", NULL); - } - } - - - g_hash_table_destroy(messages_table); - messages_table = NULL; - g_hash_table_destroy(groups_table); - groups_table = NULL; - g_hash_table_destroy(chat_link_table); - chat_link_table = NULL; - g_hash_table_destroy(sms_convo_link_table); - sms_convo_link_table = NULL; - -#ifdef USE_VV - g_hash_table_destroy(call_media_hash); - call_media_hash = NULL; -#endif -} - -int -skype_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, - PurpleMessageFlags flags) -{ - char *stripped; - char *chat_id; - PurpleConversation *conv; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, purple_connection_get_account(gc)); - - if (who[0] == '+' && conv && purple_conversation_get_data(conv, "sms_msg")) - { - return skype_send_sms(gc, who, message, flags); - } - - stripped = purple_markup_strip_html(message); - - if (conv == NULL || purple_conversation_get_data(conv, "chat_id") == NULL) - { - /*chat_id = g_new(char, 200); - char *temp; - temp = skype_send_message("CHAT CREATE %s", who); - sscanf(temp, "CHAT %s ", chat_id); - g_free(temp); - if (conv != NULL) - { - purple_conversation_set_data(conv, "chat_id", chat_id); - }*/ - skype_send_message_nowait("MESSAGE %s %s", who, stripped); - } else { - chat_id = purple_conversation_get_data(conv, "chat_id"); - skype_send_message_nowait("CHATMESSAGE %s %s", chat_id, stripped); - } - - -#ifdef USE_SKYPE_SENT - return 0; -#else - return 1; -#endif -} - - -unsigned int -skype_send_typing(PurpleConnection *gc, const gchar *name, PurpleTypingState state) -{ - gchar *string_state = NULL, *temp = NULL; - PurpleAccount *account; - account = purple_connection_get_account(gc); - - //Don't send typing messages to SkypeOut - if (name[0] == '+') - return 0; - - switch(state) - { - case PURPLE_NOT_TYPING: - string_state = "PURPLE_NOT_TYPING"; - break; - case PURPLE_TYPING: - string_state = "PURPLE_TYPING"; - break; - case PURPLE_TYPED: - string_state = "PURPLE_TYPED"; - break; - default: - string_state = ""; - break; - } - - temp = g_strconcat("stream-", name, NULL); - - if (purple_account_get_string(account, temp, NULL)) - { - skype_send_message_nowait( "ALTER APPLICATION libpurple_typing DATAGRAM %s:%s %s", name, - purple_account_get_string(account, temp, "1"), string_state); - } else { - //lets be dumb and try to connect without getting a stream - skype_send_message_nowait("CREATE APPLICATION libpurple_typing"); - skype_send_message_nowait( "ALTER APPLICATION libpurple_typing CONNECT %s", name); - } - - g_free(temp); - - return 4; -} - -gchar * -timestamp_to_datetime(time_t timestamp) -{ - return g_strdup(purple_date_format_long(localtime(×tamp))); -} - -void -set_skype_buddy_attribute(SkypeBuddy *sbuddy, const gchar *skype_buddy_property, const gchar *value) -{ - if (sbuddy == NULL) - return; - if (skype_buddy_property == NULL) - return; - - if (g_str_equal(skype_buddy_property, "FULLNAME")) - { - if (sbuddy->fullname) - g_free(sbuddy->fullname); - sbuddy->fullname = NULL; - if (value && strlen(value)) - sbuddy->fullname = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "MOOD_TEXT")) - { - if (sbuddy->mood) - g_free(sbuddy->mood); - sbuddy->mood = NULL; - if (value) - { - sbuddy->mood = g_strdup(value); - purple_util_chrreplace(sbuddy->mood, '\n', ' '); - } - } else if (g_str_equal(skype_buddy_property, "BIRTHDAY")) - { - if (sbuddy->birthday) - g_free(sbuddy->birthday); - sbuddy->birthday = NULL; - if (value && strlen(value) && !g_str_equal(value, "0")) - { - sbuddy->birthday = g_new(struct tm, 1); - purple_str_to_time(value, FALSE, sbuddy->birthday, NULL, NULL); - } - } else if (g_str_equal(skype_buddy_property, "SEX")) - { - if (sbuddy->gender) - g_free(sbuddy->gender); - sbuddy->gender = NULL; - if (value && strlen(value) && !g_str_equal(value, "UNKNOWN")) - sbuddy->gender = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "LANGUAGE")) - { - if (sbuddy->language) - g_free(sbuddy->language); - sbuddy->language = NULL; - if (value && strlen(value)) - sbuddy->language = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "COUNTRY")) - { - if (sbuddy->country) - g_free(sbuddy->country); - sbuddy->country = NULL; - if (value && strlen(value)) - sbuddy->country = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "IS_VIDEO_CAPABLE")) - { - if (value && strlen(value) && g_str_equal(value, "TRUE")) - sbuddy->is_video_capable = TRUE; - else - sbuddy->is_video_capable = FALSE; - } else if (g_str_equal(skype_buddy_property, "ISAUTHORIZED")) - { - if (value && strlen(value) && g_str_equal(value, "TRUE")) - sbuddy->is_authorized = TRUE; - else - sbuddy->is_authorized = FALSE; - } else if (g_str_equal(skype_buddy_property, "ISBLOCKED")) - { - if (value && strlen(value) && g_str_equal(value, "TRUE")) - sbuddy->is_blocked = TRUE; - else - sbuddy->is_blocked = FALSE; - } else if (g_str_equal(skype_buddy_property, "LASTONLINETIMESTAMP")) - { - sbuddy->last_online = 0; - if (value) - sbuddy->last_online = (time_t) atoi(value); - } else if (g_str_equal(skype_buddy_property, "TIMEZONE")) - { - sbuddy->timezone_offset = 0; - if (value) - sbuddy->timezone_offset = (g_ascii_strtod(value, NULL) / 3600) - 24; - } else if (g_str_equal(skype_buddy_property, "NROF_AUTHED_BUDDIES")) - { - sbuddy->number_of_buddies = 0; - if (value) - sbuddy->number_of_buddies = g_ascii_strtoull(value, NULL, 10); - } else if (g_str_equal(skype_buddy_property, "ABOUT")) - { - if (sbuddy->about) - g_free(sbuddy->about); - sbuddy->about = NULL; - if (value && strlen(value)) - { - sbuddy->about = g_strdup(value); - } - } else if (g_str_equal(skype_buddy_property, "PROVINCE")) - { - if (sbuddy->province) - g_free(sbuddy->province); - sbuddy->province = NULL; - if (value && strlen(value)) - { - sbuddy->province = g_strdup(value); - } - } else if (g_str_equal(skype_buddy_property, "CITY")) - { - if (sbuddy->city) - g_free(sbuddy->city); - sbuddy->city = NULL; - if (value && strlen(value)) - sbuddy->city = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "PHONE_HOME")) - { - if (sbuddy->phone_home) - g_free(sbuddy->phone_home); - sbuddy->phone_home = NULL; - if (value && strlen(value) && !g_str_equal(value, "N/A")) - sbuddy->phone_home = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "PHONE_OFFICE")) - { - if (sbuddy->phone_office) - g_free(sbuddy->phone_office); - sbuddy->phone_office = NULL; - if (value && strlen(value) && !g_str_equal(value, "N/A")) - sbuddy->phone_office = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "PHONE_MOBILE")) - { - if (sbuddy->phone_mobile) - g_free(sbuddy->phone_mobile); - sbuddy->phone_mobile = NULL; - if (value && strlen(value) && !g_str_equal(value, "N/A")) - sbuddy->phone_mobile = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "HOMEPAGE")) - { - if (sbuddy->homepage) - g_free(sbuddy->homepage); - sbuddy->homepage = NULL; - if (value && strlen(value)) - sbuddy->homepage = g_strdup(value); - } else if (g_str_equal(skype_buddy_property, "HASCALLEQUIPMENT")) - { - if (value && strlen(value) && g_str_equal(value, "TRUE")) - sbuddy->has_call_equipment = TRUE; - else - sbuddy->has_call_equipment = FALSE; - } else if (g_str_equal(skype_buddy_property, "IS_VOICEMAIL_CAPABLE")) - { - if (value && strlen(value) && g_str_equal(value, "TRUE")) - sbuddy->is_voicemail_capable = TRUE; - else - sbuddy->is_voicemail_capable = FALSE; - } else if (g_str_equal(skype_buddy_property, "CAN_LEAVE_VM")) - { - if (value && strlen(value) && g_str_equal(value, "TRUE")) - sbuddy->can_leave_voicemail = TRUE; - else - sbuddy->can_leave_voicemail = FALSE; - } -} - -SkypeBuddy * -skype_buddy_new(PurpleBuddy *buddy) -{ - SkypeBuddy *newbuddy = g_new0(SkypeBuddy, 1); - newbuddy->buddy = buddy; - buddy->proto_data = newbuddy; - - //this bit used in Get Info - newbuddy->handle = g_strdup(buddy->name); - - skype_send_message_nowait("GET USER %s FULLNAME", buddy->name); - if (buddy->name[0] != '+') - { - skype_send_message_nowait("GET USER %s MOOD_TEXT", buddy->name); - skype_send_message_nowait("GET USER %s BIRTHDAY", buddy->name); - skype_send_message_nowait("GET USER %s IS_VIDEO_CAPABLE", buddy->name); - skype_send_message_nowait("GET USER %s PHONE_MOBILE", buddy->name); - - /*skype_send_message_nowait("GET USER %s SEX", buddy->name); - skype_send_message_nowait("GET USER %s LANGUAGE", buddy->name); - skype_send_message_nowait("GET USER %s COUNTRY", buddy->name); - skype_send_message_nowait("GET USER %s ISAUTHORIZED", buddy->name); - skype_send_message_nowait("GET USER %s ISBLOCKED", buddy->name); - skype_send_message_nowait("GET USER %s LASTONLINETIMESTAMP", buddy->name); - skype_send_message_nowait("GET USER %s TIMEZONE", buddy->name); - skype_send_message_nowait("GET USER %s NROF_AUTHED_BUDDIES", buddy->name); - skype_send_message_nowait("GET USER %s ABOUT", buddy->name); - - skype_send_message_nowait("GET USER %s PROVINCE", buddy->name); - skype_send_message_nowait("GET USER %s CITY", buddy->name); - skype_send_message_nowait("GET USER %s PHONE_HOME", buddy->name); - skype_send_message_nowait("GET USER %s PHONE_OFFICE", buddy->name); - skype_send_message_nowait("GET USER %s PHONE_MOBILE", buddy->name); - skype_send_message_nowait("GET USER %s HOMEPAGE", buddy->name); - skype_send_message_nowait("GET USER %s HASCALLEQUIPMENT", buddy->name); - skype_send_message_nowait("GET USER %s IS_VIDEO_CAPABLE", buddy->name); - skype_send_message_nowait("GET USER %s IS_VOICEMAIL_CAPABLE", buddy->name); - skype_send_message_nowait("GET USER %s CAN_LEAVE_VM", buddy->name);*/ - } - - return newbuddy; -} - -void -skype_buddy_free(PurpleBuddy *buddy) -{ - SkypeBuddy *sbuddy; - gchar *temp; - - if (buddy->proto_data) - { - sbuddy = buddy->proto_data; - buddy->proto_data = NULL; - - if (sbuddy->handle) g_free(sbuddy->handle); - if (sbuddy->fullname) g_free(sbuddy->fullname); - if (sbuddy->mood) g_free(sbuddy->mood); - if (sbuddy->birthday) g_free(sbuddy->birthday); - if (sbuddy->gender) g_free(sbuddy->gender); - if (sbuddy->language) g_free(sbuddy->language); - if (sbuddy->country) g_free(sbuddy->country); - if (sbuddy->about) g_free(sbuddy->about); - if (sbuddy->province) g_free(sbuddy->province); - if (sbuddy->city) g_free(sbuddy->city); - if (sbuddy->phone_home) g_free(sbuddy->phone_home); - if (sbuddy->phone_office) g_free(sbuddy->phone_office); - if (sbuddy->phone_mobile) g_free(sbuddy->phone_mobile); - if (sbuddy->homepage) g_free(sbuddy->homepage); - - g_free(sbuddy); - } - - temp = g_strconcat("stream-", buddy->name, NULL); - if (purple_account_get_string(buddy->account, temp, NULL)) - purple_account_set_string(buddy->account, temp, NULL); - g_free(temp); -} - -void -skype_get_info(PurpleConnection *gc, const gchar *username) -{ - PurpleNotifyUserInfo *user_info; - double timezoneoffset = 0; - struct tm *birthday_time; - int time; - gchar *temp; - PurpleBuddy *buddy; - SkypeBuddy *sbuddy; - - buddy = purple_find_buddy(gc->account, username); - if (buddy && buddy->proto_data) - { - sbuddy = buddy->proto_data; - user_info = purple_notify_user_info_new(); - - purple_notify_user_info_add_section_header(user_info, _("Contact Info")); - purple_notify_user_info_add_pair(user_info, _("Skype Name"), buddy->name); - purple_notify_user_info_add_pair(user_info, _("Full Name"), sbuddy->fullname); - purple_notify_user_info_add_pair(user_info, _("Mood Text"), sbuddy->mood); - - purple_notify_user_info_add_section_break(user_info); - - purple_notify_user_info_add_section_header(user_info, _("Personal Information")); - purple_notify_user_info_add_pair(user_info, _("Birthday"), purple_date_format_short(sbuddy->birthday)); - purple_notify_user_info_add_pair(user_info, _("Gender"), sbuddy->gender); - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), sbuddy->language); - purple_notify_user_info_add_pair(user_info, _("Country"), sbuddy->country); - purple_notify_user_info_add_pair(user_info, _("Is Video Capable"), (sbuddy->is_video_capable?"TRUE":"FALSE")); - purple_notify_user_info_add_pair(user_info, _("Authorization Granted"), (sbuddy->is_authorized?"TRUE":"FALSE")); - purple_notify_user_info_add_pair(user_info, _("Blocked"), (sbuddy->is_blocked?"TRUE":"FALSE")); - if (sbuddy->timezone_offset) - { - purple_notify_user_info_add_pair(user_info, _("Timezone"), temp = g_strdup_printf("UMT %+.1f", sbuddy->timezone_offset)); - g_free(temp); - } else { - purple_notify_user_info_add_pair(user_info, _("Timezone"), NULL); - } - purple_notify_user_info_add_pair(user_info, _("Number of buddies"), temp = g_strdup_printf("%d", sbuddy->number_of_buddies)); - g_free(temp); - - purple_notify_user_info_add_section_break(user_info); - - purple_notify_user_info_add_pair(user_info, NULL, sbuddy->about); - - purple_notify_userinfo(gc, username, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - return; - } - - user_info = purple_notify_user_info_new(); -#define _SKYPE_USER_INFO(prop, key) \ - purple_notify_user_info_add_pair(user_info, _(key),\ - (skype_get_user_info(username, prop))); - - purple_notify_user_info_add_section_header(user_info, _("Contact Info")); - _SKYPE_USER_INFO("HANDLE", "Skype Name"); - _SKYPE_USER_INFO("FULLNAME", "Full Name"); - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_section_header(user_info, _("Personal Information")); - //_SKYPE_USER_INFO("BIRTHDAY", "Birthday"); - temp = skype_get_user_info(username, "BIRTHDAY"); - if (temp && strlen(temp) && !g_str_equal(temp, "0")) - { - birthday_time = g_new(struct tm, 1); - purple_str_to_time(temp, FALSE, birthday_time, NULL, NULL); - purple_notify_user_info_add_pair(user_info, _("Birthday"), g_strdup(purple_date_format_short(birthday_time))); - g_free(birthday_time); - } else { - purple_notify_user_info_add_pair(user_info, _("Birthday"), g_strdup("0")); - } - _SKYPE_USER_INFO("SEX", "Gender"); - _SKYPE_USER_INFO("LANGUAGE", "Preferred Language"); - _SKYPE_USER_INFO("COUNTRY", "Country"); - _SKYPE_USER_INFO("IS_VIDEO_CAPABLE", "Is Video Capable"); - _SKYPE_USER_INFO("ISAUTHORIZED", "Authorization Granted"); - _SKYPE_USER_INFO("ISBLOCKED", "Blocked"); - //_SKYPE_USER_INFO("LASTONLINETIMESTAMP", "Last online"); //timestamp - time = atoi(skype_get_user_info(username, "LASTONLINETIMESTAMP")); - skype_debug_info("skype", "time: %d\n", time); - purple_notify_user_info_add_pair(user_info, _("Last online"), - timestamp_to_datetime((time_t) time)); - // g_strdup(purple_date_format_long(localtime((time_t *)(void *)&time)))); - //_SKYPE_USER_INFO("TIMEZONE", "Timezone"); //in seconds - timezoneoffset = atof(skype_get_user_info(username, "TIMEZONE")) / 3600; - timezoneoffset -= 24; //timezones are offset by 24 hours to keep them valid and unsigned - purple_notify_user_info_add_pair(user_info, _("Timezone"), g_strdup_printf("UMT %+.1f", timezoneoffset)); - - _SKYPE_USER_INFO("NROF_AUTHED_BUDDIES", "Number of buddies"); - purple_notify_user_info_add_section_break(user_info); - //_SKYPE_USER_INFO("ABOUT", ""); - purple_notify_user_info_add_pair(user_info, NULL, (skype_get_user_info(username, "ABOUT"))); - - purple_notify_userinfo(gc, username, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - -} - -gchar * -skype_get_user_info(const gchar *username, const gchar *property) -{ - gchar *outstr; - gchar *return_str; - outstr = skype_send_message("GET USER %s %s", username, property); - if (strlen(outstr) == 0) - return outstr; - return_str = g_strdup(&outstr[7+strlen(username)+strlen(property)]); - g_free(outstr); - /* skype_debug_info("skype", "User %s's %s is %s", username, property, return_str); */ - if (return_str == NULL) - return NULL; - return return_str; -} - -void -skype_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleStatusType *type; - const char *message; - - type = purple_status_get_type(status); - skype_send_message_nowait("SET USERSTATUS %s", purple_status_type_get_id(type)); - - message = purple_status_get_attr_string(status, "message"); - if (message == NULL) - message = ""; - else - message = purple_markup_strip_html(message); - skype_send_message_nowait("SET PROFILE MOOD_TEXT %s", message); -} - -void -skype_set_idle(PurpleConnection *gc, int time) -{ - skype_send_message_nowait("SET AUTOAWAY OFF"); - skype_send_message_nowait("RESETIDLETIMER"); -} - - -void -skype_put_buddies_in_groups() -{ - skype_send_message_nowait("SEARCH GROUPS CUSTOM"); -} - -gboolean -groups_table_find_group(gpointer key, gpointer value, gpointer user_data) -{ - gchar *group_name = user_data; - gint group_number = GPOINTER_TO_INT(key); - PurpleGroup *group = value; - if (g_str_equal(group_name, group->name)) - { - purple_blist_node_set_int(&group->node, "skype_group_number", group_number); - return TRUE; - } - return FALSE; -} - -int -skype_find_group_with_name(const char *group_name_in) -{ - PurpleGroup *purple_group; - gint group_number; - - purple_group = purple_find_group(group_name_in); - if (purple_group != NULL) - { - group_number = purple_blist_node_get_int(&purple_group->node, "skype_group_number"); - if (group_number) - return group_number; - } - - if (groups_table == NULL) - { - skype_send_message_nowait("SEARCH GROUPS CUSTOM"); - return 0; - } - - purple_group = g_hash_table_find(groups_table, groups_table_find_group, (gpointer)group_name_in); - if (purple_group == NULL) - { - return 0; - } - return purple_blist_node_get_int(&purple_group->node, "skype_group_number"); -} - -//use this to try and regroup a buddy after a few seconds -struct _cheat_skype_group_buddy_struct { - PurpleConnection *gc; - const char *who; - const char *old_group; - const char *new_group; -}; - -gboolean skype_group_buddy_timeout(struct _cheat_skype_group_buddy_struct *cheat); - -gboolean -skype_group_buddy_timeout(struct _cheat_skype_group_buddy_struct *cheat) -{ - if (!cheat) - return FALSE; - - skype_group_buddy(cheat->gc, cheat->who, cheat->old_group, cheat->new_group); - g_free(cheat); - return FALSE; -} - -void -skype_group_buddy(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) -{ - int group_number = 0; - - //add to new group - group_number = skype_find_group_with_name(new_group); - if (!group_number) - { - struct _cheat_skype_group_buddy_struct *cheat = g_new(struct _cheat_skype_group_buddy_struct, 1); - skype_send_message_nowait("CREATE GROUP %s", new_group); - cheat->gc = gc; - cheat->who = who; - cheat->old_group = old_group; - cheat->new_group = new_group; - purple_timeout_add_seconds(5, (GSourceFunc)skype_group_buddy_timeout, cheat); - return; - } - - skype_send_message_nowait("ALTER GROUP %d ADDUSER %s", group_number, who); - - if (old_group == NULL) - return; - - //remove from old group - group_number = skype_find_group_with_name(old_group); - if (!group_number) - return; - skype_send_message_nowait("ALTER GROUP %d REMOVEUSER %s", group_number, who); -} - -void -skype_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) -{ - int group_number = 0; - - group_number = skype_find_group_with_name(old_name); - if (!group_number) - { - group->name = g_strdup(old_name); - return; - } - skype_send_message_nowait("SET GROUP %d DISPLAYNAME %s", group_number, group->name); -} - -void skype_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - int group_number = 0; - - group_number = skype_find_group_with_name(group->name); - skype_send_message_nowait("DELETE GROUP %d", group_number); -} - -void -skype_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - skype_send_message_nowait("SET USER %s BUDDYSTATUS 2 %s", buddy->name, _("Please authorize me so I can add you to my buddy list.")); - if (buddy->alias == NULL || strlen(buddy->alias) == 0) - skype_update_buddy_alias(buddy); - else - skype_alias_buddy(gc, buddy->name, buddy->alias); - if (group && group->name) - { - skype_group_buddy(gc, buddy->name, NULL, group->name); - } - skype_add_permit(gc, buddy->name); - skype_rem_deny(gc, buddy->name); - - skype_update_buddy_status(buddy); -} - -void -skype_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - skype_send_message_nowait("SET USER %s BUDDYSTATUS 1", buddy->name); -} - -void -skype_add_deny(PurpleConnection *gc, const char *who) -{ - skype_send_message_nowait("SET USER %s ISBLOCKED TRUE", who); -} - -void -skype_rem_deny(PurpleConnection *gc, const char *who) -{ - skype_send_message_nowait("SET USER %s ISBLOCKED FALSE", who); -} - -void -skype_add_permit(PurpleConnection *gc, const char *who) -{ - skype_send_message_nowait("SET USER %s ISAUTHORIZED TRUE", who); -} - -void -skype_rem_permit(PurpleConnection *gc, const char *who) -{ - skype_send_message_nowait("SET USER %s ISAUTHORIZED FALSE", who); -} - -static time_t last_ping = 0; - -gboolean -skype_check_keepalive(PurpleConnection *gc) -{ - if (last_pong < last_ping) - purple_connection_error(gc, _("\nSkype not responding")); - return FALSE; -} - -void -skype_keepalive(PurpleConnection *gc) -{ - last_ping = time(NULL); - skype_send_message_nowait("PING"); - purple_timeout_add_seconds(10, (GSourceFunc)skype_check_keepalive, gc); -} - -void -skype_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - gchar *path; - if (img != NULL) - { - path = g_build_filename(purple_buddy_icons_get_cache_dir(), purple_imgstore_get_filename(img), NULL); - skype_send_message_nowait("SET AVATAR 1 %s:1", path); - } - else - skype_send_message_nowait("SET AVATAR 1"); -} - -char * -skype_status_text(PurpleBuddy *buddy) -{ - char *mood_text; - PurplePresence *presence; - PurpleStatus *status; - PurpleStatusType *type; - SkypeBuddy *sbuddy = buddy->proto_data; - - if (sbuddy && sbuddy->mood != NULL && strlen(sbuddy->mood)) - return skype_strdup_withhtml(sbuddy->mood); - - if (sbuddy == NULL || sbuddy->mood == NULL) - { - if (buddy->name[0] != '+') - skype_send_message_nowait("GET USER %s MOOD_TEXT", buddy->name); - return NULL; - } - - //If we're at this point, they don't have a mood. - //Use away status instead - presence = purple_buddy_get_presence(buddy); - if (presence == NULL) - return NULL; - status = purple_presence_get_active_status(presence); - if (status == NULL) - return NULL; - type = purple_status_get_type(status); - if (type == NULL || g_str_equal(purple_status_type_get_id(type), "ONLINE") || - purple_status_type_get_primitive(type) == PURPLE_STATUS_OFFLINE) - return NULL; - mood_text = (char *)purple_status_type_get_name(type); - if (mood_text != NULL && strlen(mood_text)) - return skype_strdup_withhtml(mood_text); - - return NULL; -} - -void -skype_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *userinfo, gboolean full) -{ - PurplePresence *presence; - PurpleStatus *status; - SkypeBuddy *sbuddy = buddy->proto_data; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - purple_notify_user_info_add_pair(userinfo, _("Status"), purple_status_get_name(status)); - if (sbuddy && sbuddy->mood && strlen(sbuddy->mood)) - purple_notify_user_info_add_pair(userinfo, _("Message"), sbuddy->mood); -} - -const char * -skype_list_icon(PurpleAccount *account, PurpleBuddy *buddy) -{ - //when pidgin requests the icon for a skypeout buddy, it also requests the icon - //for the account, which overwrites the buddy's skypeout icon, so cheat - //and store it :) - static gboolean last_icon_was_skypeout = FALSE; - - if (last_icon_was_skypeout) - { - last_icon_was_skypeout = FALSE; - return "skypeout"; - } - - if (buddy && buddy->name[0] == '+') - { - last_icon_was_skypeout = TRUE; - return "skypeout"; - } - return "skype"; -} - -int -skype_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - gchar *newbuf = NULL; - int newlen = 0; - - newbuf = g_strndup(buf, len); - newlen = strlen(newbuf); - if (newbuf != NULL) - { - skype_send_message_nowait(newbuf); - g_free(newbuf); - } - - return newlen; -} - -static gboolean -skype_check_missedmessages(PurpleAccount *account) -{ - int i; - gchar **messages; - gchar *message; - gchar *messages_start; - - message = skype_send_message("SEARCH MISSEDCHATMESSAGES"); - if (!message || *message == '\0') - return FALSE; //there was an error - messages_start = strchr(message, ' '); - if (messages_start != NULL) - { - messages = g_strsplit(messages_start + 1, ", ", 0); - for (i = 0; messages[i]; i++) - { - skype_send_message_nowait("GET CHATMESSAGE %s STATUS", messages[i]); - } - g_strfreev(messages); - } - g_free(message); - - return FALSE; //dont keep looking for missed messages - //return TRUE; //keep looking for missed messages -} - -static void -skype_initiate_chat(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - //PurpleGroup *group; - PurpleConversation *conv; - gchar *msg; - gchar chat_id[200]; - static int chat_number = 1000; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - buddy = (PurpleBuddy *) node; - msg = skype_send_message("CHAT CREATE"); - printf("Chat create response: '%s'\n", msg); - sscanf(msg, "CHAT %s ", chat_id); - g_free(msg); - - conv = serv_got_joined_chat(purple_account_get_connection(purple_buddy_get_account(buddy)), chat_number, chat_id); - skype_send_message_nowait("ALTER CHAT %s ADDMEMBERS %s", chat_id, buddy->name); - skype_debug_info("skype", "Conv Hash Table: %d\n", conv->data); - skype_debug_info("skype", "chat_id: %s\n", chat_id); - purple_conversation_set_data(conv, "chat_id", g_strdup(chat_id)); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), - skype_get_account_username(buddy->account), NULL, PURPLE_CBFLAGS_NONE, FALSE); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), - buddy->name, NULL, PURPLE_CBFLAGS_NONE, FALSE); - purple_conv_chat_set_id(PURPLE_CONV_CHAT(conv), chat_number++); - } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) - { -/* group = (PurpleGroup *) node; - msg = skype_send_message("CHAT CREATE"); - sscanf(msg, "CHAT %s ", chat_id); - g_free(msg); - - conv = serv_got_joined_chat(purple_account_get_connection(purple_buddy_get_account(buddy)), chat_number, chat_id); - purple_conversation_set_data(conv, "chat_id", g_strdup(chat_id)); - purple_conv_chat_set_id(PURPLE_CONV_CHAT(conv), chat_number++); - - //loop through all the child nodes of the group - - //add buddy to the chat - - //add self to the chat -*/ } -} - -static void -skype_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *who) -{ - PurpleConversation *conv; - gchar *chat_id; - - conv = purple_find_chat(gc, id); - chat_id = (gchar *)g_hash_table_lookup(conv->data, "chat_id"); - - skype_send_message_nowait("ALTER CHAT %s ADDMEMBERS %s", chat_id, who); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), who, NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - -static void -skype_chat_leave(PurpleConnection *gc, int id) -{ - PurpleConversation *conv; - gchar* chat_id; - - conv = purple_find_chat(gc, id); - chat_id = (gchar *)g_hash_table_lookup(conv->data, "chat_id"); - - skype_send_message_nowait("ALTER CHAT %s LEAVE", chat_id); - - //once you leave a chat, you can't go back - //TODO delete chat from buddy-list, if it's not a public chat -} - -static int -skype_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - - PurpleConversation *conv; - gchar* chat_id; - char *stripped; - - stripped = purple_markup_strip_html(message); - conv = purple_find_chat(gc, id); - skype_debug_info("skype", "chat_send; conv: %d, conv->data: %d, id: %d\n", conv, conv->data, id); - chat_id = (gchar *)g_hash_table_lookup(conv->data, "chat_id"); - skype_debug_info("skype", "chat_id: %s\n", chat_id); - - skype_send_message_nowait("CHATMESSAGE %s %s", chat_id, stripped); - - serv_got_chat_in(gc, id, purple_account_get_username(purple_connection_get_account(gc)), PURPLE_MESSAGE_SEND, - message, time(NULL)); - - return 1; -} - -static void -skype_set_chat_topic(PurpleConnection *gc, int id, const char *topic) -{ - PurpleConversation *conv; - gchar* chat_id; - - conv = purple_find_chat(gc, id); - chat_id = (gchar *)g_hash_table_lookup(conv->data, "chat_id"); - - skype_send_message_nowait("ALTER CHAT %s SETTOPIC %s", chat_id, topic); - - //serv_got_chat_in(gc, id, purple_account_get_username(purple_connection_get_account(gc)), PURPLE_MESSAGE_SYSTEM, - // skype_strdup_withhtml(g_strdup_printf(_("%s has changed the topic to: %s"), purple_account_get_username(purple_connection_get_account(gc)), topic)), time(NULL)); - //purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic); -} - -/*PurpleChat * -skype_find_blist_chat(PurpleAccount *account, const char *name) -{ - GList *glist_temp = NULL; - PurpleConversation *conv = NULL; - PurpleChat *chat = NULL; - - glist_temp = g_list_find_custom(purple_get_conversations(), name, (GCompareFunc)skype_find_chat); - if (glist_temp && glist_temp->data) - { - conv = glist_temp->data; - chat = PURPLE_CONV_CHAT(conv); - } - - return chat; -}*/ - -void -skype_join_chat(PurpleConnection *gc, GHashTable *data) -{ - SkypeChat *chat; - PurpleConvChat *convchat; - - gchar *chat_id = (gchar *)g_hash_table_lookup(data, "chat_id"); - if (chat_id == NULL) - { - return; - } - chat = skype_find_chat(chat_id, gc->account); - skype_send_message_nowait("ALTER CHAT %s JOIN", chat_id); - if (!chat->conv) - { - chat->prpl_chat_id = g_str_hash(chat_id); - chat->conv = serv_got_joined_chat(gc, chat->prpl_chat_id, chat_id); - purple_conversation_set_data(chat->conv, "chat_id", g_strdup(chat_id)); - } else { - convchat = purple_conversation_get_chat_data(chat->conv); - convchat->left = FALSE; - } - skype_send_message_nowait("GET CHAT %s MEMBERS", chat_id); - - if (purple_blist_find_chat(gc->account, chat_id) != NULL) - { - skype_send_message_nowait("ALTER CHAT %s BOOKMARK", chat_id); - } -} - -gchar * -skype_get_chat_name(GHashTable *data) -{ - gchar *temp; - - if (data == NULL) - return g_strdup(""); - - temp = g_hash_table_lookup(data, "chat_id"); - - if (temp == NULL) - return g_strdup(""); - - return g_strdup(temp); -} - -gchar * -skype_cb_real_name(PurpleConnection *gc, int id, const char *who) -{ - PurpleBuddy *buddy; - SkypeBuddy *sbuddy; - - printf("CB Real name for %s in %d\n", who, id); - - buddy = purple_find_buddy(gc->account, who); - if (buddy && buddy->alias) - { - return g_strdup(buddy->alias); - } else if (buddy && buddy->server_alias) - { - return g_strdup(buddy->server_alias); - } else if (buddy && buddy->proto_data) - { - sbuddy = buddy->proto_data; - if (sbuddy->fullname) - return g_strdup(sbuddy->fullname); - } - - return NULL; -} - -GList * -skype_join_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Skype Name"); - pce->identifier = "chat_id"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - -GHashTable * -skype_join_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - if (chat_name != NULL) - { - g_hash_table_insert(defaults, "chat_id", g_strdup(chat_name)); - } - return defaults; -} - - -void -skype_alias_buddy(PurpleConnection *gc, const char *who, const char *alias) -{ - skype_send_message_nowait("SET USER %s DISPLAYNAME %s", who, alias); -} - -gboolean -skype_offline_msg(const PurpleBuddy *buddy) -{ - return TRUE; -} - -void -skype_get_chatmessage_info(int message) -{ - skype_send_message_nowait("GET CHATMESSAGE %d TYPE", message); - skype_send_message_nowait("GET CHATMESSAGE %d CHATNAME", message); - skype_send_message_nowait("GET CHATMESSAGE %d BODY", message); - skype_send_message_nowait("GET CHATMESSAGE %d FROM_HANDLE", message); - skype_send_message_nowait("GET CHATMESSAGE %d USERS", message); - skype_send_message_nowait("GET CHATMESSAGE %d LEAVEREASON", message); - skype_send_message_nowait("GET CHATMESSAGE %d TIMESTAMP", message); -} - -void -skype_show_search_users(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, _("Search for Skype Users"), - _("Search for Skype Users"), - _("Type the Skype Name, full name or e-mail address of the buddy you are " - "searching for."), - NULL, FALSE, FALSE, NULL, - _("_Search"), G_CALLBACK(skype_search_users), - _("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - -} - -static void -skype_search_users(PurpleConnection *gc, const gchar *searchterm) -{ - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - gchar *userlist; - gchar **list_of_users; - int i = 0; - - results = purple_notify_searchresults_new(); - if (results == NULL) - return; - - //columns: Full Name, Skype Name, Country/Region, Profile Link - column = purple_notify_searchresults_column_new(_("Full Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Skype Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Country/Region")); - purple_notify_searchresults_column_add(results, column); - - //buttons: Add Skype Contact, Close - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - skype_searchresults_add_buddy); - - userlist = skype_send_message("SEARCH USERS %s", searchterm); - list_of_users = g_strsplit(&userlist[6], ", ", -1); - while(list_of_users[i]) - { - GList *row = NULL; - row = g_list_append(row, skype_get_user_info(list_of_users[i], "FULLNAME")); - row = g_list_append(row, g_strdup(list_of_users[i])); - row = g_list_append(row, g_strconcat(skype_get_user_info(list_of_users[i], "CITY"), ", ", skype_get_user_info(list_of_users[i], "COUNTRY"), NULL)); - purple_notify_searchresults_row_add(results, row); - i++; - } - g_strfreev(list_of_users); - g_free(userlist); - - purple_notify_searchresults(gc, NULL, NULL, NULL, results, NULL, NULL); -} - -void -skype_searchresults_add_buddy(PurpleConnection *gc, GList *row, void *user_data) -{ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 1), NULL, NULL); -} - -/* Like purple_strdup_withhtml, but escapes htmlentities too */ -gchar * -skype_strdup_withhtml(const gchar *src) -{ - gulong destsize, i, j; - gchar *dest; - - g_return_val_if_fail(src != NULL, NULL); - - /* New length is (length of src) + (number of \n's * 3) + (number of &'s * 5) + (number of <'s * 4) + (number of >'s *4) + (number of "'s * 6) - (number of \r's) + 1 */ - destsize = 1; - for (i = 0; src[i] != '\0'; i++) - { - if (src[i] == '\n' || src[i] == '<' || src[i] == '>') - destsize += 4; - else if (src[i] == '&') - destsize += 5; - else if (src[i] == '"') - destsize += 6; - else if (src[i] != '\r') - destsize++; - } - - dest = g_malloc(destsize); - - /* Copy stuff, ignoring \r's, because they are dumb */ - for (i = 0, j = 0; src[i] != '\0'; i++) { - if (src[i] == '\n') { - strcpy(&dest[j], "
"); - j += 4; - } else if (src[i] == '<') { - strcpy(&dest[j], "<"); - j += 4; - } else if (src[i] == '>') { - strcpy(&dest[j], ">"); - j += 4; - } else if (src[i] == '&') { - strcpy(&dest[j], "&"); - j += 5; - } else if (src[i] == '"') { - strcpy(&dest[j], """); - j += 6; - } else if (src[i] != '\r') - dest[j++] = src[i]; - } - - dest[destsize-1] = '\0'; - - return dest; -} - -static void -skype_display_skype_credit(PurplePluginAction *action) -{ - gchar *temp, *currency; - double balance; - - temp = skype_send_message("GET PROFILE PSTN_BALANCE"); - balance = atol(&temp[21]); - g_free(temp); - balance = balance / 100; - - temp = skype_send_message("GET PROFILE PSTN_BALANCE_CURRENCY"); - currency = g_strdup(&temp[30]); - g_free(temp); - - temp = g_strdup_printf("%s %.2f", currency, balance); - - skype_debug_info("skype", "Balance: '%s'\n", temp); - purple_notify_info(this_plugin, _("Skype Balance"), _("Your current Skype credit balance is:"), temp); - g_free(temp); - g_free(currency); -} - -gchar * -skype_set_next_sms_number_for_conversation(PurpleConversation *conv, const gchar *who) -{ - gchar *sms_reply; - gchar skype_sms_number[10]; - - if (sms_convo_link_table == NULL) - { - skype_debug_info("skype", "Creating convo_link_table\n"); - sms_convo_link_table = g_hash_table_new(g_str_hash, g_str_equal); - } - - sms_reply = skype_send_message("CREATE SMS OUTGOING %s", who); - sscanf(sms_reply, "SMS %10s ", skype_sms_number); - g_free(sms_reply); - - sms_reply = g_strdup(skype_sms_number); - skype_debug_info("skype", "putting SMS number %s mobile number %s into the table\n", sms_reply, who); - g_hash_table_insert(sms_convo_link_table, sms_reply, g_strdup(who)); - purple_conversation_set_data(conv, "skype_next_sms_number", sms_reply); - - return sms_reply; -} - -static void -skype_open_sms_im(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - SkypeBuddy *sbuddy; - PurpleConversation *conv; - gchar *mobile_number = NULL; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) - return; - - buddy = (PurpleBuddy *)node; - sbuddy = (SkypeBuddy *)buddy->proto_data; - - if (buddy->name[0] == '+') - mobile_number = buddy->name; - else if (sbuddy && sbuddy->phone_mobile) - mobile_number = sbuddy->phone_mobile; - - if (mobile_number == NULL) - return; - - //Open a conversation window - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, mobile_number, buddy->account); - if (conv == NULL) - { - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, buddy->account, mobile_number); - } else { - purple_conversation_present(conv); - } - - purple_conversation_write(conv, NULL, _("This is an SMS message and will cost you money"), PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - //store the fact that it's an SMS convo in the conversation - purple_conversation_set_data(conv, "sms_msg", "TRUE"); - - skype_set_next_sms_number_for_conversation(conv, mobile_number); -} - -int -skype_send_sms(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags) -{ - PurpleConversation *conv; - gchar *sms_number; - gchar *stripped; - - if (who[0] != '+') - return -1; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, purple_connection_get_account(gc)); - if (purple_conversation_get_data(conv, "sms_msg") == NULL) - return -1; - - stripped = purple_markup_strip_html(message); - - sms_number = purple_conversation_get_data(conv, "skype_next_sms_number"); - if (sms_number == NULL) - { - sms_number = skype_set_next_sms_number_for_conversation(conv, who); - } - - skype_send_message_nowait("SET SMS %s BODY %s", sms_number, stripped); - skype_send_message_nowait("ALTER SMS %s SEND", sms_number); - - //delete the sms number from the conversation - skype_set_next_sms_number_for_conversation(conv, who); - - return 1; -} - - -static void -dump_hash_table(gchar *key, gchar *value, gpointer data) -{ - printf("'%s' = '%s'\n", key, value); -} - -/* copied from oscar.c to be libpurple 2.1 compatible */ -static PurpleAccount * -find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean -skype_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - PurpleAccount *acct; - gchar *temp; - - //only deal with skype: uri's - if (!g_str_equal(proto, "skype")) - return FALSE; - - /*uri's: - - skype: //does nothing - skype:{buddynames} //open im with {buddynames} - skype:{buddynames}?chat //open multi-user chat with {buddynames} - skype:?chat&blob={blob id} //open public multi-user chat with the blob id of {blob id} - skype:?chat&id={chat id} //open multi-user chat with the id of {chat id} - skype:{buddynames}?call //call {buddynames} - skype:{buddyname}?add //add user to buddy list - - //not sure about these ones - skype:{buddynames}?userinfo //get buddy's info? - skype:{buddynames}?voicemail //send a voice mail message? - skype:{buddynames}?sendfile //send a file? - */ - acct = find_acct(purple_plugin_get_id(this_plugin), g_hash_table_lookup(params, "account")); - - - //lets have a look at the hash table! - skype_debug_info("skype", "dumping uri handler hashtable\n"); - g_hash_table_foreach(params, (GHFunc)dump_hash_table, NULL); - - if (g_hash_table_lookup(params, "chat")) - { - if (!strlen(cmd)) - { - //probably a public multi-user chat? - if ((temp = g_hash_table_lookup(params, "blob"))) - { - temp = skype_send_message("CHAT CREATEUSINGBLOB %s", temp); - if (strlen(temp)) - { - g_free(temp); - return FALSE; - } - *strchr(strchr(temp, ' '), ' ') = '\0'; - skype_send_message("ALTER %s JOIN", temp); - g_free(temp); - return TRUE; - } - else if ((temp = g_hash_table_lookup(params, "id"))) - { - skype_send_message_nowait("ALTER CHAT %s JOIN", temp); - return TRUE; - } - } - } else if (g_hash_table_lookup(params, "add")) - { - purple_blist_request_add_buddy(skype_get_account(NULL), cmd, NULL, g_hash_table_lookup(params, "displayname")); - return TRUE; - } else if (g_hash_table_lookup(params, "call")) - { - skype_send_message_nowait("CALL %s", cmd); - return TRUE; - } else if (g_hash_table_lookup(params, "userinfo")) - { - skype_get_info(NULL, cmd); - return TRUE; - } else if (g_hash_table_lookup(params, "voicemail") || g_hash_table_lookup(params, "sendfile")) - { - //not sure? - } else if (strlen(cmd)) { - //there'll be a bunch of usernames, seperated by comma - skype_send_message_nowait("CHAT CREATE %s", cmd); - return TRUE; - } - - //we don't know how to handle this - return FALSE; -} - -#ifdef USE_VV -/* -Skype info from developer.skype.com and forum.skype.com: -Audio: -Audio format - -File: WAV PCM -Sockets: raw PCM samples -16 KHz mono, 16 bit -The 16-bit samples are stored as 2's-complement signed integers, ranging from -32768 to 32767. -there must be a call in progress when these API Audio calls are made to Skype to define the ports. -big-endian and it uses NO headers when using the Port form of the Audio API. - -ALTER CALL SET_INPUT SOUNDCARD="default" | PORT="port_no" | FILE="FILE_LOCATION" - -This enables you to set a port or a wav file as a source of your voice, instead of a microphone. - -ALTER CALL SET_OUTPUT SOUNDCARD="default" | PORT="port_no" | FILE="FILE_LOCATION" - -Redirects incoming transmission to a port or a wav file. - -With SET INPUT Skype acts like a Server, meaning, it waits to receive Audio Data from your application, so it does NOT act like a client. It will Open a Port and wait for your application to send Audio Data on the port defined, this is what a server does, a web server waits for a request on Port 80 for example. - -With SET OUTPUT Skype acts like a Client, meaning, it sends data to your application, your application is waiting for Skype to send Audio data, which means your application acts as a listener ("Server"). - - -Video: -SET VIDE0_IN [] - -Have to sniff for video window/object, very platform dependant - -*/ - - -//our call to someone else got ended -static void -skype_handle_call_got_ended(char *callnumber_string) -{ - PurpleMedia *media; - - if (call_media_hash == NULL) - { - return; - } - - media = g_hash_table_lookup(call_media_hash, callnumber_string); - if (media != NULL) - { - purple_media_end(media, NULL, NULL); - } -} - -//called when the user accepts an incomming call from the ui -static void -skype_send_call_accept(char *callnumber_string) -{ - char *temp; - - if (!callnumber_string || !strlen(callnumber_string)) - return; - temp = skype_send_message("ALTER CALL %s ANSWER", callnumber_string); - if (!temp || strlen(temp) == 0) - { - //there was an error, hang up the the call - return skype_handle_call_got_ended(callnumber_string); - } -} - -//called when the user rejects an incomming call from the ui -static void -skype_send_call_reject(char *callnumber_string) -{ - if (!callnumber_string || !strlen(callnumber_string)) - return; - skype_send_message_nowait("ALTER CALL %s END HANGUP", callnumber_string); -} - -//called when the user ends a call from the ui -static void -skype_send_call_end(char *callnumber_string) -{ - if (!callnumber_string || !strlen(callnumber_string)) - return; - skype_send_message_nowait("ALTER CALL %s HANGUP", callnumber_string); -} - -//purple_smarshal_VOID__ENUM_STRING_STRING -static void -skype_media_state_changed(PurpleMedia *media, PurpleMediaState state, gchar *session_id, gchar *participant, gchar *callnumber_string) -{ - if (state == PURPLE_MEDIA_STATE_END) - { - g_hash_table_remove(call_media_hash, callnumber_string); - } -} - -static void -skype_stream_info_changed(PurpleMedia *media, PurpleMediaInfoType type, gchar *session_id, gchar *participant, gboolean local, - gchar *callnumber_string) -{ - if (type == PURPLE_MEDIA_INFO_HANGUP) { - skype_send_call_end(callnumber_string); - } else if (type == PURPLE_MEDIA_INFO_REJECT) { - skype_send_call_reject(callnumber_string); - } -} - -//called by the UI to say, please start a media call -PurpleMedia * -skype_media_initiate(PurpleConnection *gc, const char *who, PurpleMediaSessionType type) -{ - PurpleMedia *media; - gchar *temp; - gchar *callnumber_string; - - if (call_media_hash == NULL) - call_media_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - //Use skype's own audio/video stuff for now - media = purple_media_manager_create_media(purple_media_manager_get(), purple_connection_get_account(gc), "fsrtpconference", who, TRUE); - - temp = skype_send_message("CALL %s", who); - if (!temp || !strlen(temp)) - { - g_free(temp); - return NULL; - } - callnumber_string = g_new(gchar, 10+1); - sscanf(temp, "CALL %s ", callnumber_string); - - if (media != NULL) - { - purple_media_set_prpl_data(media, callnumber_string); - g_hash_table_insert(call_media_hash, callnumber_string, media); - - g_signal_connect_swapped(G_OBJECT(media), "accepted", G_CALLBACK(skype_send_call_accept), callnumber_string); - g_signal_connect(G_OBJECT(media), "state-changed", G_CALLBACK(skype_media_state_changed), callnumber_string); - g_signal_connect(G_OBJECT(media), "stream-info", G_CALLBACK(skype_stream_info_changed), callnumber_string); - } else { - skype_debug_info("skype_media", "media is NULL\n"); - } - return media; -} - -PurpleMediaCaps -skype_get_media_caps(PurpleConnection *gc, const char *who) -{ - PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; - PurpleBuddy *buddy = NULL; - SkypeBuddy *sbuddy = NULL; - - buddy = purple_find_buddy(gc->account, who); - if (buddy != NULL) - sbuddy = buddy->proto_data; - - caps |= PURPLE_MEDIA_CAPS_AUDIO; - if (buddy && sbuddy && sbuddy->is_video_capable) - caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; - - return caps; -} - -//there's an incoming call... deal with it -static void -skype_handle_incoming_call(PurpleConnection *gc, char *callnumber_string) -{ - PurpleMedia *media; - gchar *temp; - gchar *who; - - if (call_media_hash == NULL) - { - call_media_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - } else { - media = g_hash_table_lookup(call_media_hash, callnumber_string); - if (media != NULL) - { - //we've already dealt with this - return; - } - } - - temp = skype_send_message("GET CALL %s PARTNER_HANDLE", callnumber_string); - if (!temp || !strlen(temp)) - return; - - who = g_strdup(&temp[21+strlen(callnumber_string)]); - g_free(temp); - - media = purple_media_manager_create_media(purple_media_manager_get(), purple_connection_get_account(gc), "fsrtpconference", who, FALSE); - - if (media != NULL) - { - //g_signal_emit(media, purple_media_signals[STATE_CHANGE], 0, PURPLE_MEDIA_STATE_CHANGED_NEW, "skype-audio", who); - purple_media_set_prpl_data(media, callnumber_string); - g_hash_table_insert(call_media_hash, callnumber_string, media); - - g_signal_connect_swapped(G_OBJECT(media), "accepted", G_CALLBACK(skype_send_call_accept), callnumber_string); - g_signal_connect(G_OBJECT(media), "state-changed", G_CALLBACK(skype_media_state_changed), callnumber_string); - g_signal_connect(G_OBJECT(media), "stream-info", G_CALLBACK(skype_stream_info_changed), callnumber_string); - } else { - skype_debug_info("skype_media", "purple_mmcm returned NULL\n"); - } -} -#endif - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/Makefile qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/Makefile --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/Makefile 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ - -#Customisable stuff here -LINUX32_COMPILER = i686-pc-linux-gnu-gcc -LINUX64_COMPILER = x86_64-pc-linux-gnu-gcc -WIN32_COMPILER = /usr/bin/i586-mingw32-gcc -LINUX_ARM_COMPILER = arm-none-linux-gnueabi-gcc - -LIBPURPLE_CFLAGS = -I/usr/include/libpurple -DPURPLE_PLUGINS -DENABLE_NLS -GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib64/glib-2.0/include -I/usr/include -DBUS_CFLAGS = -DSKYPE_DBUS -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/lib64/dbus-1.0/include -WIN32_DEV_DIR = /root/pidgin/win32-dev -WIN32_PIDGIN_DIR = /root/pidgin/pidgin-2.1.1 -WIN32_CFLAGS = -I${WIN32_DEV_DIR}/gtk_2_0/include/glib-2.0 -I${WIN32_PIDGIN_DIR}/libpurple/win32 -I${WIN32_DEV_DIR}/gtk_2_0/include -I${WIN32_DEV_DIR}/gtk_2_0/include/glib-2.0 -I${WIN32_DEV_DIR}/gtk_2_0/lib/glib-2.0/include -WIN32_LIBS = -L${WIN32_DEV_DIR}/gtk_2_0/lib -L${WIN32_PIDGIN_DIR}/libpurple -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lintl -lpurple - -VV_CFLAGS = -I/usr/include/gstreamer-0.10 -DUSE_VV -I/usr/include/libxml2 -WIN32_VV_CFLAGS = -I${WIN32_DEV_DIR}/gstreamer-0.10/include - -DEB_PACKAGE_DIR = /root/skypeplugin - -LOCALES = $(patsubst %.po, %.mo, $(wildcard po/*.po)) - -#Standard stuff here -.PHONY: all clean allarch install locales uninstall - -.DEPENDS: libskype.c skype_messaging.c skype_events.c debug.c - -allarch: skype4pidgin.deb skype4pidgin-installer.exe libskype_dbus.so libskype_dbus64.so libskypearm.so - -#By default, 'make' compiles X11 version on local platform -all: .DEPENDS skype_messaging_x11.c skype_messaging_dbus.c - gcc ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -O2 -pipe libskype.c -o libskype.so -shared -fPIC -DPIC - gcc ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -O2 -pipe libskype.c -o libskype_dbus.so -shared -fPIC -DPIC ${DBUS_CFLAGS} - -install: locales - mkdir -p $(DESTDIR)/usr/share/pixmaps/pidgin/emotes/skype - mkdir -p $(DESTDIR)/usr/share/pixmaps/pidgin/protocols - mkdir -p $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/16 - mkdir -p $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/22 - mkdir -p $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/48 - mkdir -p $(DESTDIR)/usr/lib/purple-2 - install -m 664 theme $(DESTDIR)/usr/share/pixmaps/pidgin/emotes/skype/ - install -m 664 icons/16/skypeout.png icons/16/skype.png $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/16 - install -m 664 icons/22/skypeout.png icons/22/skype.png $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/22 - install -m 664 icons/48/skypeout.png icons/48/skype.png $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/48 - install -m 664 libskype_dbus.so libskype.so $(DESTDIR)/usr/lib/purple-2/ - -uninstall: - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/emotes/skype - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/16/skypeout.png - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/16/skype.png - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/22/skypeout.png - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/22/skype.png - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/48/skypeout.png - rm -rf $(DESTDIR)/usr/share/pixmaps/pidgin/protocols/48/skype.png - rm -rf $(DESTDIR)/usr/lib/purple-2/libskype.so - rm -rf $(DESTDIR)/usr/lib/purple-2/libskype_dbus.so - -clean: - rm -f libskype.so libskype64.so libskype_dbus.so libskype_dbus64.so libskypearm.so libskype.dll skype4pidgin.deb skype4pidgin-installer.exe po/*.mo - -libskypenet.so: .DEPENDS skype_messaging_network.c - ${LINUX32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -march=athlon-xp -O2 -pipe libskype.c -o libskypenet.so -shared -fPIC -DPIC -DSKYPENET - -libskype.so: .DEPENDS skype_messaging_x11.c - ${LINUX32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -march=athlon-xp -O2 -pipe libskype.c -o libskype.so -shared -fPIC -DPIC - -libskype-vv.so: .DEPENDS skype_messaging_x11.c - ${LINUX32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -march=athlon-xp -O2 -pipe libskype.c -o libskype-vv.so -shared -fPIC -DPIC ${VV_CFLAGS} - -libskype64.so: .DEPENDS skype_messaging_x11.c - ${LINUX64_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -m32 -m64 -O2 -pipe libskype.c -o libskype64.so -shared -fPIC -DPIC - -libskypenet64.so: .DEPENDS skype_messaging_network.c - ${LINUX64_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -m32 -m64 -O2 -pipe libskype.c -o libskypenet64.so -shared -fPIC -DPIC -DSKYPENET - -libskypearm.so: .DEPENDS skype_messaging_x11.c - ${LINUX_ARM_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -O2 -pipe libskype.c -o libskypearm.so -shared -fPIC -DPIC - -libskype_dbus.so: .DEPENDS skype_messaging_dbus.c - ${LINUX32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -march=athlon-xp -O2 -pipe libskype.c -o libskype_dbus.so -shared -fPIC -DPIC ${DBUS_CFLAGS} - -libskype_dbus64.so: .DEPENDS skype_messaging_dbus.c - ${LINUX64_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -pthread ${GLIB_CFLAGS} -I. -g -m32 -m64 -O2 -pipe libskype.c -o libskype_dbus64.so -shared -fPIC -DPIC ${DBUS_CFLAGS} - -libskype-vv.dll: .DEPENDS skype_messaging_win32.c - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe libskype.c -o libskype-vv.dll -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} -Wl,--strip-all -DUSE_VV ${WIN32_VV_CFLAGS} - -libskype.dll: .DEPENDS skype_messaging_win32.c - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe libskype.c -o libskype.dll -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} -Wl,--strip-all - upx libskype.dll - -libskypenet.dll: .DEPENDS skype_messaging_network.c - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe libskype.c -o libskypenet.dll -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} -DSKYPENET -Wl,--strip-all - upx libskypenet.dll - -libskype-debug.dll: .DEPENDS skype_messaging_win32.c - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe libskype.c -o libskype-debug.dll -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} - -libskypenet-debug.dll: .DEPENDS skype_messaging_network.c - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe libskype.c -o libskypenet-debug.dll -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} -DSKYPENET - -po/%.mo: po/%.po - msgfmt -cf -o $@ $< - -locales: ${LOCALES} - -skype4pidgin-installer.exe: libskype.dll - date=`date +%d-%b-%Y` && sed "s/PRODUCT_VERSION \"[-a-z0-9A-Z]*\"/PRODUCT_VERSION \"$$date\"/" -i skype4pidgin.nsi - echo "Making .exe package" - makensis skype4pidgin.nsi > /dev/null - -skype4pidgin.deb: libskype.so libskype64.so libskype_dbus.so libskype_dbus64.so libskypearm.so - rm ${DEB_PACKAGE_DIR}/usr/lib/purple-2/libskype*.so - cp libskype.so libskype64.so libskype_dbus.so libskype_dbus64.so libskypearm.so ${DEB_PACKAGE_DIR}/usr/lib/purple-2/ - date=`date +%F` && sed "s/Version: [-a-z0-9A-Z]*/Version: $$date/" -i ${DEB_PACKAGE_DIR}/DEBIAN/control - echo "Making .deb package" - dpkg-deb --build ${DEB_PACKAGE_DIR} skype4pidgin.deb > /dev/null - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/de.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/de.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/de.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/de.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,219 +0,0 @@ -# German translation of skype4pidgin plugin -# Copyright © 2007-2008 Eion Robb -# Translated by Florian Dorn -# Florian Dorn <(null)>, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-04-02\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: (null)\n" -"PO-Revision-Date: 2008-04-02 20:44+0200\n" -"Last-Translator: Florian Dorn <(null)>\n" -"Language-Team: German \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Es ist eine neuere Version von des Skype Plugins zum Download verfügbar" - -msgid "There is a newer version of Skype available for download" -msgstr "Es gibt eine neuere Version von Skype zum Download" - -msgid "No updates found" -msgstr "Es wurden keine Aktualisierungen gefunden" - -msgid "You have the latest version of Skype" -msgstr "Sie haben die neueste Version von Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Sie haben die neueste Version des Skype Plugins" - -msgid "Your version:" -msgstr "Ihre Version:" - -msgid "Latest version:" -msgstr "Neueste Version:" - -msgid "Download from:" -msgstr "Herunterladen von:" - -msgid "Your current Skype credit balance is:" -msgstr "Ihre aktuelles Skype-Guthaben ist:" - -msgid "Skype Balance" -msgstr "Skype-Guthaben" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Geben Sie die Telefonnummer oder den Skype-Namen ein" - -msgid "Show SkypeOut contacts as 'Online'" -msgstr "SkypeOut Kontakte als 'Verfügbar' anzeigen" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Status von Skype ändern, wenn Sie online/offline gehen" - -msgid "Automatically check for updates" -msgstr "Automatisch auf Aktualisierungen prüfen" - -msgid "Auto-start Skype if not running" -msgstr "Skype automatisch starten wenn es nicht läuft" - -msgid "The user does not exist in Skype" -msgstr "Der Benutzer existiert nicht in Skype" - -msgid "Offline with Voicemail" -msgstr "Offline (Anrufbeantworter)" - -msgid "Offline with Call Forwarding" -msgstr "Offline (Anrufweiterleitung)" - -msgid "Only one Skype account allowed" -msgstr "Es ist nur ein Skype Account möglich" - -msgid "Skype not responding" -msgstr "Skype antwortet nicht" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Verbindung zu Skype konnte nicht hergestellt werden.\nIst Skype gestartet?" - -msgid "Skype client not ready" -msgstr "Skype-Client nicht bereit" - -msgid "Connected to Skype" -msgstr "Mit Skype verbunden" - -msgid "Skype program closed" -msgstr "Skype wurde geschlossen" - -msgid "%s is calling you." -msgstr "%s ruft an." - -msgid "Do you want to accept their call?" -msgstr "Anruf entgegennehmen?" - -msgid "Last online" -msgstr "Zuletzt gesehen" - -msgid "Number of buddies" -msgstr "Kontakte" - -msgid "Is Video Capable" -msgstr "Unterstützt Video" - -msgid "Hide Skype" -msgstr "Skype verstecken" - -msgid "Check for Skype updates..." -msgstr "Nach Skype Aktualisierungen suchen..." - -msgid "Check for plugin updates..." -msgstr "Nach Plugin Aktualisierungen suchen..." - -msgid "Search for buddies..." -msgstr "Nach Kontakten suchen..." - -msgid "Check Skype balance..." -msgstr "Skype Guthaben abfragen..." - -msgid "Call..." -msgstr "Anrufen..." - -msgid "Open Skype Options..." -msgstr "Skype Einstellungen öffnen..." - -msgid "Search for Skype Users" -msgstr "Nach Skype Benutzern suchen" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Suchen sie nach Kontakte über Skype-Namen, vollem Namen oder E-Mail-Adresse." - -msgid "Skype Name" -msgstr "Skype-Name" - -# Duplicate stuff from Pidgin -msgid "_Search" -msgstr "_Suchen" - -msgid "_Cancel" -msgstr "_Abbrechen" - -msgid "_Send File" -msgstr "Datei _senden" - -msgid "Initiate _Chat" -msgstr "_Chat beginnen" - -msgid "_Close" -msgstr "_Schließen" - -msgid "Full Name" -msgstr "Voller Name" - -msgid "Country/Region" -msgstr "Land/Region" - -msgid "_Add" -msgstr "_Hinzufügen" - -msgid "Full name" -msgstr "Voller Name" - -msgid "Personal Information" -msgstr "Persönliche Informationen" - -msgid "Birthday" -msgstr "Geburtstag" - -msgid "Gender" -msgstr "Geschlecht" - -msgid "Preferred Language" -msgstr "Sprache" - -msgid "Country" -msgstr "Land" - -msgid "Authorization Granted" -msgstr "Autorisiert" - -msgid "Blocked" -msgstr "Blockiert" - -msgid "Timezone" -msgstr "Zeitzone" - -msgid "_Accept" -msgstr "_Annehmen" - -msgid "_Reject" -msgstr "_Ablehnen" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Die Datei %s konnte nicht gesendet werden. Der Benutzer unterstützt keine Dateiübertragungen" - -msgid "Recipient Unavailable" -msgstr "Empfänger nicht verfügbar" - -msgid "Read Error" -msgstr "Lesefehler" - -msgid "Write error" -msgstr "Schreibfehler" - -msgid "Not Authorized" -msgstr "Nicht autorisiert" - -msgid "%s wants to send you a file" -msgstr "%s möchte ihnen eine Datei senden" - -msgid "File Transfers" -msgstr "Dateiübertragungen" - -msgid "%s has changed the topic to: %s" -msgstr "%s hat das Chat-Thema auf '%s' geändert" - -msgid "Contact Info" -msgstr "Kontaktinformationen" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/en_AU.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/en_AU.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/en_AU.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/en_AU.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -# English-Australian translation of skype4pidgin plugin -# Translated by Eion Robb -# Eion Robb, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-04-22\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-04-22 11:19+1200\n" -"Last-Translator: Eion Robb\n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "" - -msgid "There is a newer version of Skype available for download" -msgstr "" - -msgid "No updates found" -msgstr "" - -msgid "You have the latest version of Skype" -msgstr "" - -msgid "You have the latest version of the Skype plugin" -msgstr "" - -msgid "Your version:" -msgstr "" - -msgid "Latest version:" -msgstr "" - -msgid "Download from:" -msgstr "" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "" - -msgid "Skype Balance" -msgstr "" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "" - -msgid "Make Skype online/offline when going online/offline" -msgstr "" - -msgid "Automatically check for updates" -msgstr "" - -msgid "Auto-start Skype if not running" -msgstr "" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "" - -msgid "Offline with Call Forwarding" -msgstr "" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "" - -msgid "Skype not responding" -msgstr "" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "" - -msgid "Skype client not ready" -msgstr "" - -msgid "Connected to Skype" -msgstr "" - -msgid "Skype program closed" -msgstr "" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "" - -msgid "%s is calling you." -msgstr "" - -msgid "Do you want to accept their call?" -msgstr "" - -# Buddy information -msgid "Last online" -msgstr "" - -msgid "Number of buddies" -msgstr "" - -msgid "Is Video Capable" -msgstr "" - -# Plugin menu options -msgid "Hide Skype" -msgstr "" - -msgid "Check for Skype updates..." -msgstr "" - -msgid "Check for plugin updates..." -msgstr "" - -msgid "Search for buddies..." -msgstr "" - -msgid "Check Skype balance..." -msgstr "" - -msgid "Call..." -msgstr "" - -msgid "Open Skype Options..." -msgstr "" - -# User searching: -msgid "Search for Skype Users" -msgstr "" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "" - -msgid "The user does not exist in Skype" -msgstr "" - -msgid "Skype Name" -msgstr "" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "" - -msgid "_Cancel" -msgstr "" - -msgid "_Send File" -msgstr "" - -msgid "Initiate _Chat" -msgstr "" - -msgid "_Close" -msgstr "" - -msgid "Full Name" -msgstr "" - -msgid "Country/Region" -msgstr "" - -msgid "_Add" -msgstr "" - -msgid "Full name" -msgstr "" - -msgid "Personal Information" -msgstr "" - -msgid "Birthday" -msgstr "" - -msgid "Gender" -msgstr "" - -msgid "Preferred Language" -msgstr "" - -msgid "Country" -msgstr "" - -msgid "Authorization Granted" -msgstr "Authorisation Granted" - -msgid "Blocked" -msgstr "" - -msgid "Timezone" -msgstr "" - -msgid "_Accept" -msgstr "" - -msgid "_Reject" -msgstr "" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "" - -msgid "Recipient Unavailable" -msgstr "" - -msgid "Read Error" -msgstr "" - -msgid "Write error" -msgstr "" - -msgid "Not Authorized" -msgstr "Not Authorised" - -msgid "%s wants to send you a file" -msgstr "" - -msgid "File Transfers" -msgstr "" - -msgid "%s has changed the topic to: %s" -msgstr "" - -msgid "Contact Info" -msgstr "" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/es.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/es.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/es.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/es.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -# Spanish translation of skype4pidgin plugin -# Translated by JOHANNA SALCEDO WEEBER -# JOHANNA SALCEDO WEEBER, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 08.04.23\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-04-23 HO:MI+ZONE\n" -"Last-Translator: JOHANNA SALCEDO WEEBER \n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Existe una nueva versión del complemento para Skype disponible para descargar" - -msgid "There is a newer version of Skype available for download" -msgstr "Existe una nueva versión de Skype disponible para descargar" - -msgid "No updates found" -msgstr "No hay actualizaciones disponibles" - -msgid "You have the latest version of Skype" -msgstr "Usted tiene la versión mas reciente de Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Usted tiene la última versión del plugin para Skype" - -msgid "Your version:" -msgstr "Su versión:" - -msgid "Latest version:" -msgstr "Última versión disponible:" - -msgid "Download from:" -msgstr "Descargue desde:" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "El balance actual de su crédito de skype es:" - -msgid "Skype Balance" -msgstr "Balance de Skype" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Mostrar contactos de SkypeOut como 'Disponibles'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Hacer que Skype se conecte y se desconecte al conectarse/desconectarse" - -msgid "Automatically check for updates" -msgstr "Comprobar actualizaciones automáticamente" - -msgid "Auto-start Skype if not running" -msgstr "Auto-iniciar Skype si no está ejecutándose" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "Desconectado con Buzón de Voz" - -msgid "Offline with Call Forwarding" -msgstr "Desconectado con desvío de llamadas" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "Solo una cuenta de Skype permitida" - -msgid "Skype not responding" -msgstr "Skype no está respondiendo" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "No se pudo conectar al proceso de Skype.\n¿Skype no se está ejecutando?" - -msgid "Skype client not ready" -msgstr "El cliente de Skype no está listo" - -msgid "Connected to Skype" -msgstr "Conectado a Skype" - -msgid "Skype program closed" -msgstr "Programa de Skype cerrado" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Ingrese el número de teléfono o nombre de amigo a llamar" - -msgid "%s is calling you." -msgstr "%s está llamando." - -msgid "Do you want to accept their call?" -msgstr "¿Quiere aceptar la llamada?" - -# Buddy information -msgid "Last online" -msgstr "Última vez visto en línea" - -msgid "Number of buddies" -msgstr "Número de amigos" - -msgid "Is Video Capable" -msgstr "Soporta video" - -# Plugin menu options -msgid "Hide Skype" -msgstr "Esconder Skype" - -msgid "Check for Skype updates..." -msgstr "Comprobar por actualizaciones de Skype..." - -msgid "Check for plugin updates..." -msgstr "Comprobar por actualizaciones del plugin..." - -msgid "Search for buddies..." -msgstr "Buscar amigos..." - -msgid "Check Skype balance..." -msgstr "" - -msgid "Call..." -msgstr "Llamar..." - -msgid "Open Skype Options..." -msgstr "Abrir opciones de Skype..." - -# User searching: -msgid "Search for Skype Users" -msgstr "Buscar a usuarios de Skype" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Ingresa el Nombre de Skype, nombre completo o dirección de e-mail del amigo a quien busca." - -msgid "The user does not exist in Skype" -msgstr "Este usuario no existe en Skype" - -msgid "Skype Name" -msgstr "Nombre de Skype" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "_Buscar" - -msgid "_Cancel" -msgstr "_Cancelar" - -msgid "_Send File" -msgstr "_Enviar Archivo" - -msgid "Initiate _Chat" -msgstr "Iniciar _Chat" - -msgid "_Close" -msgstr "_Cerrar" - -msgid "Full Name" -msgstr "Nombre Completo" - -msgid "Country/Region" -msgstr "País/Región" - -msgid "_Add" -msgstr "_Agregar" - -msgid "Full name" -msgstr "Nombre completo" - -msgid "Personal Information" -msgstr "Información personal" - -msgid "Birthday" -msgstr "Cumpleaños" - -msgid "Gender" -msgstr "Género" - -msgid "Preferred Language" -msgstr "Idioma" - -msgid "Country" -msgstr "País" - -msgid "Authorization Granted" -msgstr "Autorización otorgada" - -msgid "Blocked" -msgstr "Bloqueado" - -msgid "Timezone" -msgstr "Zona horaria" - -msgid "_Accept" -msgstr "_Aceptar" - -msgid "_Reject" -msgstr "_Rechazar" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Imposible enviar archivos a %s, el usuario no soporta transferencias de archivo" - -msgid "Recipient Unavailable" -msgstr "Receptor no disponible" - -msgid "Read Error" -msgstr "Error de lectura" - -msgid "Write error" -msgstr "Error de escritura" - -msgid "Not Authorized" -msgstr "No autorizado" - -msgid "%s wants to send you a file" -msgstr "%s quiere enviarle un archivo" - -msgid "File Transfers" -msgstr "Transferencias de archivos" - -msgid "%s has changed the topic to: %s" -msgstr "%s ha cambiado el tema del chat a: %s" - -msgid "Contact Info" -msgstr "Información de contacto" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/fr.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/fr.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/fr.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/fr.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -# French translation of skype4pidgin plugin -# Translated by Yann Ricquebourg - -msgid "" -msgstr "" -"Project-Id-Version: 2008-03-26\n" -"PO-Revision-Date: 2008-03-26\n" -"Last-Translator: Yann Ricquebourg\n" -"Language-Team: Eion Robb\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Une nouvelle version du plugin Skype est disponible" - -msgid "There is a newer version of Skype available for download" -msgstr "Une nouvelle version de Skype est disponible" - -msgid "No updates found" -msgstr "Aucune mise à jour trouvée" - -msgid "You have the latest version of Skype" -msgstr "Votre version de Skype est la plus récente" - -msgid "You have the latest version of the Skype plugin" -msgstr "Votre version du plugin Skype est la plus récente" - -msgid "Your version:" -msgstr "Votre version :" - -msgid "Latest version:" -msgstr "Version à jour :" - -msgid "Download from:" -msgstr "Téléchargement depuis :" - -msgid "Your current Skype credit balance is:" -msgstr "Votre crédit Skype est :" - -msgid "Skype Balance" -msgstr "Crédit Skype" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Entrez un numéro de téléphone ou un nom d'ami Skype à appeler" - -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Montrer les contacts SkypeOut en 'Connecté'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Basculer Skype en connecté/déconnecté en se connectant/déconnectant" - -msgid "Automatically check for updates" -msgstr "Vérifier automatiquement les mises à jour" - -msgid "Auto-start Skype if not running" -msgstr "Démarrer automatiquement Skype si nécessaire" - -msgid "The user does not exist in Skype" -msgstr "Cet utilisateur n'existe pas dans Skype" - -msgid "Offline with Voicemail" -msgstr "Déconnecté avec Voicemail" - -msgid "Offline with Call Forwarding" -msgstr "Déconnecté avec renvoi d'appel" - -msgid "Only one Skype account allowed" -msgstr "Un seul compte Skype autorisé" - -msgid "Skype not responding" -msgstr "Skype ne répond pas" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Impossible de se connecter au processus Skype.\nSkype non lancé ?" - -msgid "Skype client not ready" -msgstr "Client Skype non prêt" - -msgid "Connected to Skype" -msgstr "Connecté à Skype" - -msgid "Skype program closed" -msgstr "Arrêt du programme Skype" - -msgid "%s is calling you." -msgstr "%s vous appelle." - -msgid "Do you want to accept their call?" -msgstr "Acceptez-vous l'appel ?" - -msgid "Last online" -msgstr "Dernière connexion" - -msgid "Number of buddies" -msgstr "Nombre de contacts" - -msgid "Is Video Capable" -msgstr "Avec vidéo" - -msgid "Hide Skype" -msgstr "Masquer Skype" - -msgid "Check for Skype updates..." -msgstr "Vérifier les mises à jour de Skype..." - -msgid "Check for plugin updates..." -msgstr "Vérifier les mises à jour du plugin Skype..." - -msgid "Search for buddies..." -msgstr "Recherche d'amis..." - -msgid "Check Skype balance..." -msgstr "Vérifier le compte Skype..." - -msgid "Call..." -msgstr "Appel..." - -msgid "Open Skype Options..." -msgstr "Ouvrir les préférences de Skype..." - -msgid "Search for Skype Users" -msgstr "Recherche d'utilisateurs Skype" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Entrez le nom Skype, le nom complet ou l'adresse de courriel d'un ami à rechercher" - -msgid "Skype Name" -msgstr "Nom Skype" - -# Duplicate stuff from Pidgin -msgid "_Search" -msgstr "_Rechercher" - -msgid "_Cancel" -msgstr "_Annuler" - -msgid "_Send File" -msgstr "_Envoyer un fichier" - -msgid "Initiate _Chat" -msgstr "Démarrer un _clavardage" - -msgid "_Close" -msgstr "_Fermer" - -msgid "Full Name" -msgstr "Nom Complet" - -msgid "Country/Region" -msgstr "Pays/Province" - -msgid "_Add" -msgstr "_Ajouter" - -msgid "Full name" -msgstr "Nom complet" - -msgid "Personal Information" -msgstr "Informations personnelles" - -msgid "Birthday" -msgstr "Date de naissance" - -msgid "Gender" -msgstr "Sexe" - -msgid "Preferred Language" -msgstr "Langue de prédilection" - -msgid "Country" -msgstr "Pays" - -msgid "Authorization Granted" -msgstr "Autorisation fournie" - -msgid "Blocked" -msgstr "Bloqué" - -msgid "Timezone" -msgstr "Fuseau horaire" - -msgid "_Accept" -msgstr "_Accepter" - -msgid "_Reject" -msgstr "_Refuser" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Impossible d'envoyer le fichier à %s, il ne peut recevoir les transferts" - -msgid "Recipient Unavailable" -msgstr "Destinataire non disponible" - -msgid "Read Error" -msgstr "Erreur de lecture" - -msgid "Write error" -msgstr "Erreur d'écriture" - -msgid "Not Authorized" -msgstr "Non autorisé" - -msgid "%s wants to send you a file" -msgstr "%s souhaite vous envoyer un fichier" - -msgid "File Transfers" -msgstr "Transferts de fichiers" - -msgid "%s has changed the topic to: %s" -msgstr "%s à changé le sujet en : %s" - -msgid "Contact Info" -msgstr "Info sur le contact" - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/hu.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/hu.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/hu.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/hu.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,245 +0,0 @@ -# Hungarian translation of skype4pidgin plugin -# Translated by Lipilee - -msgid "" -msgstr "" -"Project-Id-Version: 2008-04-28\n" -"PO-Revision-Date: 2008-04-28\n" -"Last-Translator: Lipilee\n" -"Language-Team: Eion Robb\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "There is a newer version of the Skype plugin available for download" -msgstr "A Skype bővítmény új verziója elérhető" - -msgid "There is a newer version of Skype available for download" -msgstr "Új Skype verzió elérhető" - -msgid "No updates found" -msgstr "Nincsenek frissítések" - -msgid "You have the latest version of Skype" -msgstr "A Skype legfrissebb verziója van telepítve" - -msgid "You have the latest version of the Skype plugin" -msgstr "A Skype bővítmény legfrissebb verziója van telepítve" - -msgid "Your version:" -msgstr "Aktuális verzió:" - -msgid "Latest version:" -msgstr "Legfrissebb verzió:" - -msgid "Download from:" -msgstr "Letöltés innen:" - -msgid "Your current Skype credit balance is:" -msgstr "Aktuális Skype egyenleg:" - -msgid "Skype Balance" -msgstr "Skype egyenleg" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Írja be a felhívni kívánt személy telefonszámát vagy Skype nevét" - -msgid "Show SkypeOut contacts as 'Online'" -msgstr "SkypeOut partnerek megjelenítése 'Elérhető' állapotúként" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Skype online/offline állapot váltása ki- és bejelentkezéskor" - -msgid "Automatically check for updates" -msgstr "Frissítések automatikus keresése" - -msgid "Auto-start Skype if not running" -msgstr "Skype automatikus indítása, ha nem fut" - -msgid "The user does not exist in Skype" -msgstr "A felhasználó nem létezik a Skype-ban" - -msgid "Offline with Voicemail" -msgstr "Offline, hangpostával" - -msgid "Offline with Call Forwarding" -msgstr "Offline, hívásátirányítással" - -msgid "Only one Skype account allowed" -msgstr "Csak egy Skype fiók engedélyezett" - -msgid "Skype not responding" -msgstr "A Skype nem válaszol" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Nem sikerült a Skype-hoz csatlakozni.\nLehet, hogy nem fut?" - -msgid "Skype client not ready" -msgstr "Skype kliens nincs kész" - -msgid "Connected to Skype" -msgstr "Csatlakoztatva a Skype-hoz" - -msgid "Skype program closed" -msgstr "A Skype bezáródott" - -msgid "%s is calling you." -msgstr "Bejövő hívás innen: %s" - -msgid "Do you want to accept their call?" -msgstr "Fogadja a hívást?" - -msgid "Last online" -msgstr "Legutóbb online" - -msgid "Number of buddies" -msgstr "Partnerek száma:" - -msgid "Is Video Capable" -msgstr "Videoképes" - -msgid "Hide Skype" -msgstr "Skype elrejtése" - -msgid "Check for Skype updates..." -msgstr "Skype frissítések keresése..." - -msgid "Check for plugin updates..." -msgstr "Bővítmény frissítések keresése..." - -msgid "Search for buddies..." -msgstr "Partnerek keresése..." - -msgid "Check Skype balance..." -msgstr "Skype egyenleg ellenőrzése..." - -msgid "Call..." -msgstr "Hívás..." - -msgid "Open Skype Options..." -msgstr "Skype opciók megnyitása..." - -msgid "Search for Skype Users" -msgstr "Skype felhasználók keresése" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Írja be a keresett partner Skype nevét, teljes nevét, vagy e-mail címét" - -msgid "Skype Name" -msgstr "Skype név" - -# Duplicate stuff from Pidgin - -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" - -msgstr "_Keresés" - -msgid "_Cancel" - -msgstr "Mé_gsem" - -msgid "_Send File" - -msgstr "_Fájl küldése" - -msgid "Initiate _Chat" - -msgstr "Csevegés ke_zdeményezése" - -msgid "_Close" - -msgstr "_Bezárás" - -msgid "Full Name" - -msgstr "Teljes név" - -msgid "Country/Region" - -msgstr "Ország/terület" - -msgid "_Add" - -msgstr "Hozzá_adás" - -msgid "Full name" - -msgstr "Teljes név" - -msgid "Personal Information" - -msgstr "Személyes információk" - -msgid "Birthday" - -msgstr "Születésnap" - -msgid "Gender" - -msgstr "Nem" - -msgid "Preferred Language" - -msgstr "Előnyben részesített nyelv" - -msgid "Country" - -msgstr "Ország" - -msgid "Authorization Granted" - -msgstr "Engedély kiadva" - -msgid "Blocked" - -msgstr "Tiltott" - -msgid "Timezone" - -msgstr "Időzóna" - -msgid "_Accept" - -msgstr "Elfog_adás" - -msgid "_Reject" - -msgstr "_Visszautasítás" - -msgid "Unable to send file to %s, user does not support file transfers" - -msgstr "Nem lehet fájlt küldeni a következőnek: %s, mert a felhasználó nem támogatja fájlok átvitelét" - -msgid "Recipient Unavailable" - -msgstr "A címzett nem érhető el" - -msgid "Read Error" - -msgstr "Olvasási hiba" - -msgid "Write error" - -msgstr "Írási hiba" - -msgid "Not Authorized" - -msgstr "Nem engedélyezett" - -msgid "%s wants to send you a file" - -msgstr "%s egy fájlt akar küldeni" - -msgid "File Transfers" - -msgstr "Fájlátvitel" - -msgid "%s has changed the topic to: %s" - -msgstr "%s megváltoztatta a témát a következőre: %s" - -msgid "Contact Info" - -msgstr "Kapcsolatinformációk" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/it.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/it.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/it.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/it.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,220 +0,0 @@ -# Italian translation of skype4pidgin plugin -# Translated by Roberto Agria -# Roberto Agria, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-04-02\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-05-15 10:51+1200\n" -"Last-Translator: Roberto Agria\n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Trovata una nuova versione del plugin per Skype pronta per il download" - -msgid "There is a newer version of Skype available for download" -msgstr "Trovata una nuova versione di Skype pronta per il download" - -msgid "No updates found" -msgstr "Nessun aggiornamento disponibile" - -msgid "You have the latest version of Skype" -msgstr "Hai già l'ultima versione di Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Hai già l'ultima versione del plugin per Skype" - -msgid "Your version:" -msgstr "La tua versione:" - -msgid "Latest version:" -msgstr "Ultima versione:" - -msgid "Download from:" -msgstr "Scarica da:" - -msgid "Your current Skype credit balance is:" -msgstr "Il tuo credito Skype è:" - -msgid "Skype Balance" -msgstr "Credito su Skype" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Digita il numero telefonico o il nome utente Skype da contattare" - -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Mostra i contatti SkypeOut come 'Online'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Connetti/Disconnetti Skype quando esegui la connessione/disconnessione" - -msgid "Automatically check for updates" -msgstr "Controllo automatico degli aggiornamenti" - -msgid "Auto-start Skype if not running" -msgstr "Esegui Skype se necessario" - -msgid "The user does not exist in Skype" -msgstr "L'utente non esiste in Skype" - -msgid "Offline with Voicemail" -msgstr "Disconnesso con VoiceMail" - -msgid "Offline with Call Forwarding" -msgstr "Disconnesso con trasferimento di chiamata" - -msgid "Only one Skype account allowed" -msgstr "E' permesso un solo account Skype" - -msgid "Skype not responding" -msgstr "Skype non risponde" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Impossibile collegarsi al processo Skype.\nSkype non è in esecuzione ?" - -msgid "Skype client not ready" -msgstr "Skype non è ancora operativo" - -msgid "Connected to Skype" -msgstr "Connesso a Skype" - -msgid "Skype program closed" -msgstr "Skype è stato chiuso" - -msgid "%s is calling you." -msgstr "%s ti sta chiamando" - -msgid "Do you want to accept their call?" -msgstr "Desideri accettare la chiamata ?" - -msgid "Last online" -msgstr "Ultima volta online" - -msgid "Number of buddies" -msgstr "Numero di contatti" - -msgid "Is Video Capable" -msgstr "Abilitato al video" - -msgid "Hide Skype" -msgstr "Nascondi Skype" - -msgid "Check for Skype updates..." -msgstr "Controllo per aggiornamenti Skype..." - -msgid "Check for plugin updates..." -msgstr "Controllo per aggiornamenti del plugin per Skype..." - -msgid "Search for buddies..." -msgstr "Cerca contatti..." - -msgid "Check Skype balance..." -msgstr "Controlla credito Skype" - -msgid "Call..." -msgstr "Chiama..." - -msgid "Open Skype Options..." -msgstr "Apri le opzioni di Skype..." - -msgid "Search for Skype Users" -msgstr "Cerca utenti Skype..." - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Digita il nome Skype, il nome completo o l'indirizzo email del contatto che desideri cercare." - -msgid "Skype Name" -msgstr "Nome Skype" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "_Cerca" - -msgid "_Cancel" -msgstr "_Annulla" - -msgid "_Send File" -msgstr "_Invia file" - -msgid "Initiate _Chat" -msgstr "Inizia una _chat" - -msgid "_Close" -msgstr "_Chiudi" - -msgid "Full Name" -msgstr "Nome" - -msgid "Country/Region" -msgstr "Paese" - -msgid "_Add" -msgstr "_Aggiungi" - -msgid "Full name" -msgstr "Nome" - -msgid "Personal Information" -msgstr "Informazioni personali" - -msgid "Birthday" -msgstr "Compleanno" - -msgid "Gender" -msgstr "Sesso" - -msgid "Preferred Language" -msgstr "Lingua preferita" - -msgid "Country" -msgstr "Paese" - -msgid "Authorization Granted" -msgstr "Autorizzazione concessa" - -msgid "Blocked" -msgstr "Bloccato" - -msgid "Timezone" -msgstr "Fuso orario" - -msgid "_Accept" -msgstr "_Accetta" - -msgid "_Reject" -msgstr "_Rifiuta" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Impossibile inviare il file a %s. L'utente non supporta il trasferimento file" - -msgid "Recipient Unavailable" -msgstr "Destinatario non disponibile" - -msgid "Read Error" -msgstr "Errore di lettura" - -msgid "Write error" -msgstr "Errore di scrittura" - -msgid "Not Authorized" -msgstr "Non autorizzato" - -msgid "%s wants to send you a file" -msgstr "%s vuole inviarti un file" - -msgid "File Transfers" -msgstr "Trasferimento file" - -msgid "%s has changed the topic to: %s" -msgstr "%s ha scelto come argomento: %s" - -msgid "Contact Info" -msgstr "Informazioni sul contatto" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ja.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ja.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ja.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ja.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,223 +0,0 @@ -# Japanese translation of skype4pidgin plugin -# Copyright © 2007-2008 Eion Robb -# Translated by Tim Fields - -msgid "" -msgstr "" -"Project-Id-Version: 2008-03-26\n" -"PO-Revision-Date: 2008-03-26\n" -"Last-Translator: Tim Fields\n" -"Language-Team: Eion Robb\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" - -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Skypeプラグインの更新版がダウンロードできます。" - -msgid "There is a newer version of Skype available for download" -msgstr "Skypeの更新版がダウンロードできます。" - -msgid "No updates found" -msgstr "只今さらのアップデートがありません。" - -msgid "You have the latest version of Skype" -msgstr "Skypeの最新版をご利用です。" - -msgid "You have the latest version of the Skype plugin" -msgstr "Skypeプラグインの最新版をご利用です。" - -msgid "Your version:" -msgstr "現在ご利用版:" - -msgid "Latest version:" -msgstr "最新版:" - -msgid "Download from:" -msgstr "ダウンロードはこちら:" - -msgid "Your current Skype credit balance is:" -msgstr "現在Skypeクレジット残高:" - -msgid "Skype Balance" -msgstr "Skypeクレジット残高" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "電話番号またはSkype名を入力" - -msgid "Show SkypeOut contacts as 'Online'" -msgstr "SkypeOutコンタクトを「オンライン」として表示" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Pidginにログイン・ログアウトする時、Skypeに自動的にログイン・ログアウト" - -msgid "Automatically check for updates" -msgstr "アップデートを自動的に確認" - -msgid "Auto-start Skype if not running" -msgstr "Skypeが起動されていない場合、自動的に起動" - -msgid "The user does not exist in Skype" -msgstr "Skypeユーザが存在していません。" - -msgid "Offline with Voicemail" -msgstr "オフライン(ボイスメール)" - -msgid "Offline with Call Forwarding" -msgstr "オフライン(通話転送)" - -msgid "Only one Skype account allowed" -msgstr "一つのSkypeアカウントしか登録できません。" - -msgid "Skype not responding" -msgstr "Skypeが接続できません" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Skypeが接続できません。\nSkypeが起動されていますか?" - -msgid "Skype client not ready" -msgstr "Skypeプログラムが起動中です。" - -msgid "Connected to Skype" -msgstr "Skypeに接続しました。" - -msgid "Skype program closed" -msgstr "Skypeが終了されました。" - -msgid "%s is calling you." -msgstr "%sから着信中です。" - -msgid "Do you want to accept their call?" -msgstr "応答しますか?" - -msgid "Last online" -msgstr "最終ログイン" - -msgid "Number of buddies" -msgstr "仲間数量" - -msgid "Is Video Capable" -msgstr "ビデオ可能" - -msgid "Hide Skype" -msgstr "Skypeを隠す" - -msgid "Check for Skype updates..." -msgstr "Skypeアップデートを確認..." - -msgid "Check for plugin updates..." -msgstr "Skypeプラグインのアップデートを確認..." - -msgid "Search for buddies..." -msgstr "仲間を検索..." - -msgid "Check Skype balance..." -msgstr "Skypeクレジット残高を確認..." - -msgid "Call..." -msgstr "発信..." - -msgid "Open Skype Options..." -msgstr "Skypeの設定..." - -msgid "Search for Skype Users" -msgstr "Skypeユーザを検索" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "検索したい仲間のSkype名、氏名またはメールアドレスを入力。" - -msgid "Skype Name" -msgstr "Skype名" - -# Duplicate stuff from Pidgin -msgid "_Search" -msgstr "検索(_S)" - -msgid "_Cancel" -msgstr "キャンセル(_C)" - -msgid "_Send File" -msgstr "ファイルの送信" - -msgid "Initiate _Chat" -msgstr "チャットの開始(_C)" - -msgid "_Close" -msgstr "閉じる(_C)" - -msgid "Full Name" -msgstr "氏名" - -msgid "Country/Region" -msgstr "国/地方" - -msgid "_Add" -msgstr "追加(_A)" - -msgid "Full name" -msgstr "氏名" - -msgid "Personal Information" -msgstr "個人情報" - -msgid "Birthday" -msgstr "誕生日" - -msgid "Gender" -msgstr "性別" - -msgid "Preferred Language" -msgstr "お好みの言語" - -msgid "Country" -msgstr "国" - -msgid "Authorization Granted" -msgstr "承認が得られました" - -msgid "Blocked" -msgstr "拒否しているか" - -msgid "Timezone" -msgstr "タイムゾーン" - -msgid "_Accept" -msgstr "許可する(_A)" - -msgid "_Reject" -msgstr "拒否する(_R)" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "" -"%s さんへファイルを送信できません (ユーザはファイル転送をサポートしていませ" -"ん)" - -msgid "Recipient Unavailable" -msgstr "受信者がいません" - -msgid "Read Error" -msgstr "読み込みエラー" - -msgid "Write error" -msgstr "書き込みエラー" - -msgid "Not Authorized" -msgstr "承認されていません" - -msgid "%s wants to send you a file" -msgstr "%s さんがファイルを転送したがっています" - -msgid "File Transfers" -msgstr "ファイルの転送" - -msgid "%s has changed the topic to: %s" -msgstr "%s さんがトピックを変更しました: %s" - -msgid "Contact Info" -msgstr "連絡先の情報" - -msgid "Status" -msgstr "状態" - -msgid "Message" -msgstr "メッセージ" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/mk.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/mk.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/mk.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/mk.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,239 +0,0 @@ -# MACEDONIAN translation of skype4pidgin plugin -# Translated by Damjan Dimitrioski -# This file is put in the public domain. -# -# Damjan Dimitrioski, 2009. -# -# -msgid "" -msgstr "" -"Project-Id-Version: skype4pidgin-mk\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2009-01-27 00:48+0100\n" -"Last-Translator: Damjan Dimitrioski \n" -"Language-Team: Macedonian \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Poedit-Language: Macedonian\n" -"X-Poedit-Country: MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF\n" -"X-Poedit-SourceCharset: utf-8\n" - - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Пронајдов надградба за додатоков" - -msgid "There is a newer version of Skype available for download" -msgstr "Пронајдов понов Скајп" - -msgid "No updates found" -msgstr "Нема надградби" - -msgid "You have the latest version of Skype" -msgstr "Ја користиш најновата верзија на Скајп" - -msgid "You have the latest version of the Skype plugin" -msgstr "Ја користиш најновата верзија на Додатоков" - -msgid "Your version:" -msgstr "Твоја верзија:" - -msgid "Latest version:" -msgstr "Најнова верзија" - -msgid "Download from:" -msgstr "Симни од:" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "Твојот Скајп кредит е:" - -msgid "Skype Balance" -msgstr "Скајп Биланс" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Прикажи SkypeOut контакти како 'Онлајн' " - -msgid "Make Skype online/offline when going online/offline" -msgstr "Синхронизирај го Скајп со статусот при онлајн/офлајн" - -msgid "Automatically check for updates" -msgstr "Автоматски проверувај за надградби" - -msgid "Auto-start Skype if not running" -msgstr "Автоматски приклучи Скајп ако не работи" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "Офлајн со Звучна Секретарка" - -msgid "Offline with Call Forwarding" -msgstr "Офлајн со Префрлување на повик" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "Само една Скајп сметка е дозволена" - -msgid "Skype not responding" -msgstr "Скајпи не реагира" - -msgid "" -"Could not connect to Skype process.\n" -"Skype not running?" -msgstr "" -"Неможам да се поврзам со процесот на Скајп.\n" -"Скајп не е вклучен?" - -msgid "Skype client not ready" -msgstr "Скајп клиентот не подготвен" - -msgid "Connected to Skype" -msgstr "Приклучен кон Скајп" - -msgid "Skype program closed" -msgstr "Скајп програмот исклучен" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Внеси го телефонскиот број од Скајп другарот кој му ѕвониш" - -msgid "%s is calling you." -msgstr "%s ти ѕвони." - -msgid "Do you want to accept their call?" -msgstr "Дали сакаш да го прифатиш нивниот повик?" - -# Buddy information -msgid "Last online" -msgstr "Последнот онлајн" - -msgid "Number of buddies" -msgstr "Број на другари" - -msgid "Is Video Capable" -msgstr "Со камера" - -# Plugin menu options -msgid "Hide Skype" -msgstr "Скриј Скајп" - -msgid "Check for Skype updates..." -msgstr "Провери за Скајп надградби..." - -msgid "Check for plugin updates..." -msgstr "Провери за надградба на додатоци..." - -msgid "Search for buddies..." -msgstr "Барај другари..." - -msgid "Check Skype balance..." -msgstr "Провери Скајп баланс" - -msgid "Call..." -msgstr "Повикај..." - -msgid "Open Skype Options..." -msgstr "Отвори Скајп Подесувања..." - -# User searching: -msgid "Search for Skype Users" -msgstr "Барај Скајп Корисници" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Пиши го Скајп името, целосно име или е-мејл адреса од другарот кој го бараш." - -msgid "The user does not exist in Skype" -msgstr "Корисникот не постои во Скајп" - -msgid "Skype Name" -msgstr "Скајп Име" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po -msgid "_Search" -msgstr "_Барај" - -msgid "_Cancel" -msgstr "_Откажи" - -msgid "_Send File" -msgstr "_Прати Датотека" - -msgid "Initiate _Chat" -msgstr "Започни _Разговор" - -msgid "_Close" -msgstr "_Затвори" - -msgid "Full Name" -msgstr "Целосно име" - -msgid "Country/Region" -msgstr "Земја/Регион" - -msgid "_Add" -msgstr "_Додади" - -msgid "Full name" -msgstr "Цело име" - -msgid "Personal Information" -msgstr "Лични Податоци" - -msgid "Birthday" -msgstr "Роденден" - -msgid "Gender" -msgstr "Пол" - -msgid "Preferred Language" -msgstr "Зборува на" - -msgid "Country" -msgstr "Земја" - -msgid "Authorization Granted" -msgstr "Авторизиран" - -msgid "Blocked" -msgstr "Блокиран" - -msgid "Timezone" -msgstr "Временска зона" - -msgid "_Accept" -msgstr "П_рифати" - -msgid "_Reject" -msgstr "_Одбиј" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Неможам да пратам датотека кај %s, корисникот не поддржува пренос на датотеки" - -msgid "Recipient Unavailable" -msgstr "Претплатникот е Недостапен" - -msgid "Read Error" -msgstr "Грешка во читање" - -msgid "Write error" -msgstr "Грешка во пишување" - -msgid "Not Authorized" -msgstr "Не Авторизиран" - -msgid "%s wants to send you a file" -msgstr "%s сака да ти прати датотека" - -msgid "File Transfers" -msgstr "Датотечен Пренос" - -msgid "%s has changed the topic to: %s" -msgstr "%s ја промени темата во: %s" - -msgid "Contact Info" -msgstr "Контакт Податоци" - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/nb.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/nb.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/nb.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/nb.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,219 +0,0 @@ -# Norwegian Bokmål translation of skype4pidgin plugin -# Translated by Thomas B -# Thomas B, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-04-22\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: (null)\n" -"PO-Revision-Date: 2008-04-22 08:24+1200\n" -"Last-Translator: Thomas B <(null)>\n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Det finnes en nyere versjon av Skype-innstikksprogrammet tilgjengelig for nedlasting" - -msgid "There is a newer version of Skype available for download" -msgstr "Det finnes en nyere versjon av Skype tilgjengelig for nedlasting" - -msgid "No updates found" -msgstr "Ingen oppdateringer funnet" - -msgid "You have the latest version of Skype" -msgstr "Du har siste versjon av Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Du har siste versjon av Skype-innstikksprogrammet" - -msgid "Your version:" -msgstr "Din versjon:" - -msgid "Latest version:" -msgstr "Siste versjon:" - -msgid "Download from:" -msgstr "Last ned fra:" - -msgid "Your current Skype credit balance is:" -msgstr "Din nåværende Skype-kredittbalanse er:" - -msgid "Skype Balance" -msgstr "Skype-balanse" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Tast inn telefonnummer eller Skype-kompis å ringe til" - -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Vis SkypeOut-kontakter som 'Pålogget'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Logg Skype av/på når du logger av/på" - -msgid "Automatically check for updates" -msgstr "Automatisk se etter oppdateringer" - -msgid "Auto-start Skype if not running" -msgstr "Start Skype automatisk hvis det ikke kjører" - -msgid "The user does not exist in Skype" -msgstr "Brukeren eksisterer ikke i Skype" - -msgid "Offline with Voicemail" -msgstr "Avlogget med telefonsvarer" - -msgid "Offline with Call Forwarding" -msgstr "Avlogget med viderekobling" - -msgid "Only one Skype account allowed" -msgstr "Kun en Skype-konto tillatt" - -msgid "Skype not responding" -msgstr "Skype svarer ikke" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Kunne ikke koble til Skype-prosessen.\nKjører ikke Skype ?" - -msgid "Skype client not ready" -msgstr "Skype-klienten er ikke klar" - -msgid "Connected to Skype" -msgstr "Tilkoblet Skype" - -msgid "Skype program closed" -msgstr "Skype-programmet er lukket" - -msgid "%s is calling you." -msgstr "%s ringer deg." - -msgid "Do you want to accept their call?" -msgstr "Ønsker du å besvare ?" - -msgid "Last online" -msgstr "Sist pålogget" - -msgid "Number of buddies" -msgstr "Antall kompiser" - -msgid "Is Video Capable" -msgstr "Har videokapabilitet" - -msgid "Hide Skype" -msgstr "Skjul Skype" - -msgid "Check for Skype updates..." -msgstr "Se etter Skype-oppdateringer..." - -msgid "Check for plugin updates..." -msgstr "Se etter oppdatering for Skype-innstikk.." - -msgid "Search for buddies..." -msgstr "Søke etter kompiser..." - -msgid "Check Skype balance..." -msgstr "Sjekke Skype-balanse..." - -msgid "Call..." -msgstr "Ringe..." - -msgid "Open Skype Options..." -msgstr "Åpne Skype-valg..." - -msgid "Search for Skype Users" -msgstr "Søk etter Skype-brukere" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Tast inn Skype-navnet, det fulle navnet eller e-postadressen til kompisen du vil søke etter." - -msgid "Skype Name" -msgstr "Skype-navn" - -# Duplicate stuff from Pidgin - -msgid "_Search" -msgstr "_Søk" - -msgid "_Cancel" -msgstr "_Avbryt" - -msgid "_Send File" -msgstr "_Send fil" - -msgid "Initiate _Chat" -msgstr "Start gruppesamtale" - -msgid "_Close" -msgstr "L_ukk" - -msgid "Full Name" -msgstr "Fullt navn" - -msgid "Country/Region" -msgstr "Land" - -msgid "_Add" -msgstr "_Legg til" - -msgid "Full name" -msgstr "Fullt navn" - -msgid "Personal Information" -msgstr "Personlig informasjon" - -msgid "Birthday" -msgstr "Fødselsdag" - -msgid "Gender" -msgstr "Kjønn" - -msgid "Preferred Language" -msgstr "Foretrukket språk" - -msgid "Country" -msgstr "Land" - -msgid "Authorization Granted" -msgstr "Godkjent" - -msgid "Blocked" -msgstr "Blokkert" - -msgid "Timezone" -msgstr "Tidssone" - -msgid "_Accept" -msgstr "_Godta" - -msgid "_Reject" -msgstr "_Avslå" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Klarte ikke sende fil til %s - brukeren støtter ikke filoverføringer" - -msgid "Recipient Unavailable" -msgstr "Mottager utilgjengelig" - -msgid "Read Error" -msgstr "Lesefeil" - -msgid "Write error" -msgstr "Feil ved skriving" - -msgid "Not Authorized" -msgstr "Ikke godkjent" - -msgid "%s wants to send you a file" -msgstr "%s ønsker å sende deg en fil" - -msgid "File Transfers" -msgstr "Filoverføringer" - -msgid "%s has changed the topic to: %s" -msgstr "%s har endret temaet til: %s" - -msgid "Contact Info" -msgstr "Kontaktinformasjon" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pl.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pl.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pl.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pl.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -# Polish translation of skype4pidgin plugin -# Translated by Jakub Chrzanowski -# Jakub Chrzanowski, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-05-18\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-05-20 12:56+1200\n" -"Last-Translator: Jakub Chrzanowski\n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Ukazała się nowa wersja pluginu Skype do pobrania" - -msgid "There is a newer version of Skype available for download" -msgstr "Ukazała się nowa wersja Skype do pobrania" - -msgid "No updates found" -msgstr "Nie znaleziono aktualizacji" - -msgid "You have the latest version of Skype" -msgstr "Posiadasz aktualną wersję Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Posiadasz aktualną wersję pluginu Skype" - -msgid "Your version:" -msgstr "Twoja wersja:" - -msgid "Latest version:" -msgstr "Ostatnia wersja" - -msgid "Download from:" -msgstr "Pobierz z:" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "Aktualny stan Twojego konta Skype wynosi:" - -msgid "Skype Balance" -msgstr "Środki Skype" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Pokaż kontakty SkypeOut jako 'Dostępne'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Ustaw status Skype na dostępny/niedostępny gdy staniesz się dostępny/niedostępny" - -msgid "Automatically check for updates" -msgstr "Automatycznie sprawdzaj aktualizacje" - -msgid "Auto-start Skype if not running" -msgstr "Automatycznie uruchom Skype jeśli wyłączony" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "Niedostępni z Pocztą głosową" - -msgid "Offline with Call Forwarding" -msgstr "Niedostępni z Przekierowaniem połączeń" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "Dozwolone tylko jedno konto Skype" - -msgid "Skype not responding" -msgstr "Skype nie odpowiada" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Nie można połączyć się z procesem Skype.\nSkype nie jest uruchomione ?" - -msgid "Skype client not ready" -msgstr "Klient Skype niegotowy" - -msgid "Connected to Skype" -msgstr "Podłączono do Skype" - -msgid "Skype program closed" -msgstr "Skype zostało zamknięte" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Wpisz numer telefonu lub nazwę użytkownika Skype aby zadzwonić" - -msgid "%s is calling you." -msgstr "%s dzwoni do Ciebie" - -msgid "Do you want to accept their call?" -msgstr "Czy chcesz zaakceptować ich rozmowę?" - -# Buddy information -msgid "Last online" -msgstr "Ostatnio dostępny" - -msgid "Number of buddies" -msgstr "Liczba znajomych" - -msgid "Is Video Capable" -msgstr "Czy obsługuje wideo" - -# Plugin menu options -msgid "Hide Skype" -msgstr "Ukryj Skype" - -msgid "Check for Skype updates..." -msgstr "Sprawdź aktualizacje Skype..." - -msgid "Check for plugin updates..." -msgstr "Sprawdź aktualizacje pluginu..." - -msgid "Search for buddies..." -msgstr "Szukaj znajomych..." - -msgid "Check Skype balance..." -msgstr "Sprawdź środki Skype..." - -msgid "Call..." -msgstr "Rozpocznij rozmowę..." - -msgid "Open Skype Options..." -msgstr "Otwórz opcje Skype..." - -# User searching: -msgid "Search for Skype Users" -msgstr "Szukaj Użytkowników Skype..." - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Wpisz nazwę użytkownika Skype, imię i nazwisko lub adres e-mail znajomego, którego szukasz:" - -msgid "The user does not exist in Skype" -msgstr "Użytkownik nie istnieje w Skype" - -msgid "Skype Name" -msgstr "Nazwa użytkownika Skype" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "Zn_ajdź" - -msgid "_Cancel" -msgstr "_Anuluj" - -msgid "_Send File" -msgstr "Wyślij _plik" - -msgid "Initiate _Chat" -msgstr "Rozpocznij _konferencję" - -msgid "_Close" -msgstr "_Zamknij" - -msgid "Full Name" -msgstr "Imię i nazwisko" - -msgid "Country/Region" -msgstr "Kraj/Region" - -msgid "_Add" -msgstr "_Dodaj" - -msgid "Full name" -msgstr "Imię i nazwisko" - -msgid "Personal Information" -msgstr "Informacje osobiste" - -msgid "Birthday" -msgstr "Data urodzenia" - -msgid "Gender" -msgstr "Płeć" - -msgid "Preferred Language" -msgstr "Preferowany język" - -msgid "Country" -msgstr "Kraj" - -msgid "Authorization Granted" -msgstr "Udzielono autoryzacji" - -msgid "Blocked" -msgstr "Zablokowane" - -msgid "Timezone" -msgstr "Strefa czasowa" - -msgid "_Accept" -msgstr "_Akceptuj" - -msgid "_Reject" -msgstr "_Odrzuć" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Nie można przesłać pliku do %s, użytkownik nie ma włączonej obsługi przesyłania plików" - -msgid "Recipient Unavailable" -msgstr "Odbiorca jest niedostępny" - -msgid "Read Error" -msgstr "Błąd oczytu" - -msgid "Write error" -msgstr "Błąd zapisu" - -msgid "Not Authorized" -msgstr "Brak autoryzacji" - -msgid "%s wants to send you a file" -msgstr "%s chce wysłać tobie plik" - -msgid "File Transfers" -msgstr "Transmisja plików" - -msgid "%s has changed the topic to: %s" -msgstr "%s zmieniła/zmienił temat na: %s" - -msgid "Contact Info" -msgstr "Informacje o kontakcie" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt_BR.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt_BR.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt_BR.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt_BR.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -# Brazilian Portuguese translation of skype4pidgin plugin -# Translated by Mauro José da Silva -# Mauro José da Silva, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-07-24\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-08-04 13:14-0300\n" -"Last-Translator: Mauro José da Silva \n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Há uma nova versão do plugin disponível" - -msgid "There is a newer version of Skype available for download" -msgstr "Há uma nova versão do Skype disponível" - -msgid "No updates found" -msgstr "Não há atualizações disponíveis" - -msgid "You have the latest version of Skype" -msgstr "Você tem a última versão do Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Você tem a última versão do plugin" - -msgid "Your version:" -msgstr "Sua versão:" - -msgid "Latest version:" -msgstr "Última versão:" - -msgid "Download from:" -msgstr "Baixar de:" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "Seu saldo de créditos no Skype é:" - -msgid "Skype Balance" -msgstr "Saldo de créditos" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Exibir contatos do SkypeOut como 'Disponíveis'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Conectar/desconetar no Skype automaticamente" - -msgid "Automatically check for updates" -msgstr "Procurar atualizações automaticamente" - -msgid "Auto-start Skype if not running" -msgstr "Iniciar o Skype automaticamente" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "Desconectado, mas com correio de voz" - -msgid "Offline with Call Forwarding" -msgstr "Desconectado, mas com transferência de chamada" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "Apenas uma conta do Skype é permitida" - -msgid "Skype not responding" -msgstr "O Skype não está respondendo" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Não é possível conectar no Skype.\nVerifique se o Skype foi iniciado." - -msgid "Skype client not ready" -msgstr "O Skype não está pronto" - -msgid "Connected to Skype" -msgstr "Conectado no Skype" - -msgid "Skype program closed" -msgstr "O Skype está fechado" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Digite o número de telefone ou o nome Skype do contato que você deseja chamar." - -msgid "%s is calling you." -msgstr "%s está chamando você." - -msgid "Do you want to accept their call?" -msgstr "Você quer aceitar esta chamada?" - -# Buddy information -msgid "Last online" -msgstr "Última vez online" - -msgid "Number of buddies" -msgstr "Número de contatos" - -msgid "Is Video Capable" -msgstr "Possui vídeo" - -# Plugin menu options -msgid "Hide Skype" -msgstr "Esconder o Skype" - -msgid "Check for Skype updates..." -msgstr "Procurar atualização do Skype..." - -msgid "Check for plugin updates..." -msgstr "Procurar atualização do plugin..." - -msgid "Search for buddies..." -msgstr "Procurar contatos..." - -msgid "Check Skype balance..." -msgstr "Verificar saldo de créditos..." - -msgid "Call..." -msgstr "Iniciar _chamada..." - -msgid "Open Skype Options..." -msgstr "Abrir opções do Skype..." - -# User searching: -msgid "Search for Skype Users" -msgstr "Procurar usuários do Skype" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Digite o nome Skype, o nome completo ou o endereço de e-mail da pessoa que você está procurando." - -msgid "The user does not exist in Skype" -msgstr "O usuário não existe no Skype" - -msgid "Skype Name" -msgstr "Nome Skype" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "_Procurar" - -msgid "_Cancel" -msgstr "_Cancelar" - -msgid "_Send File" -msgstr "_Enviar arquivo" - -msgid "Initiate _Chat" -msgstr "Iniciar _bate-papo" - -msgid "_Close" -msgstr "_Fechar" - -msgid "Full Name" -msgstr "Nome completo" - -msgid "Country/Region" -msgstr "País/Região" - -msgid "_Add" -msgstr "_Adicionar" - -msgid "Full name" -msgstr "Nome completo" - -msgid "Personal Information" -msgstr "Dados pessoais" - -msgid "Birthday" -msgstr "Data de nascimento" - -msgid "Gender" -msgstr "Sexo" - -msgid "Preferred Language" -msgstr "Idioma" - -msgid "Country" -msgstr "País" - -msgid "Authorization Granted" -msgstr "Autorizado" - -msgid "Blocked" -msgstr "Bloqueado" - -msgid "Timezone" -msgstr "Fuso horário" - -msgid "_Accept" -msgstr "_Aceitar" - -msgid "_Reject" -msgstr "_Rejeitar" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Não é possível enviar arquivo para %s, pois esse usuário não suporta transferências de arquivo" - -msgid "Recipient Unavailable" -msgstr "Destinatário indisponível" - -msgid "Read Error" -msgstr "Erro de leitura" - -msgid "Write error" -msgstr "Erro de gravação" - -msgid "Not Authorized" -msgstr "Não autorizado" - -msgid "%s wants to send you a file" -msgstr "%s quer enviar um arquivo para você" - -msgid "File Transfers" -msgstr "Transferência de arquivos" - -msgid "%s has changed the topic to: %s" -msgstr "%s alterou o tópico para: %s" - -msgid "Contact Info" -msgstr "Informações do Contato" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/pt.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -# Portuguese translation of skype4pidgin plugin -# Translated by Paulo Matos -# Paulo Matos, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-07-01\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-07-02 17:30+0100\n" -"Last-Translator: Paulo Matos \n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Existe uma nova versão do plugin do Skype disponível para download" - -msgid "There is a newer version of Skype available for download" -msgstr "Existe uma nova versão do Skype disponível para download" - -msgid "No updates found" -msgstr "Não há actualizações" - -msgid "You have the latest version of Skype" -msgstr "Tem a última versão do Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "Tem a última versão do plugin do Skype" - -msgid "Your version:" -msgstr "Versão:" - -msgid "Latest version:" -msgstr "Última versão:" - -msgid "Download from:" -msgstr "Download de:" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "O seu saldo Skype é:" - -msgid "Skype Balance" -msgstr "Saldo Skype" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Mostrar contactos SkypeOut como 'Online'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Ligar ou desligar o skype quando se liga/desliga" - -msgid "Automatically check for updates" -msgstr "Verificar actualizações automaticamente" - -msgid "Auto-start Skype if not running" -msgstr "Ligar o Skype automaticamente se não estiver ligado" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "Desligado com Atendedor de Chamadas" - -msgid "Offline with Call Forwarding" -msgstr "Desligado com Reenvio de Chamadas" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "Apenas uma conta Skype é permitida" - -msgid "Skype not responding" -msgstr "Skype não responde" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Não foi possível establecer ligação ao processo Skype.\nO Skype está a funcionar?" - -msgid "Skype client not ready" -msgstr "Cliente Skype ainda não está operacional" - -msgid "Connected to Skype" -msgstr "Ligado ao Skype" - -msgid "Skype program closed" -msgstr "Programa de Skype encerrado" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Introduza o número de telefone ou o nome SKype para efectuar a ligação" - -msgid "%s is calling you." -msgstr "%s está a ligar-lhe." - -msgid "Do you want to accept their call?" -msgstr "Deseja aceitar a ligação?" - -# Buddy information -msgid "Last online" -msgstr "Última vez online" - -msgid "Number of buddies" -msgstr "Número de amigos" - -msgid "Is Video Capable" -msgstr "Suporta vídeo" - -# Plugin menu options -msgid "Hide Skype" -msgstr "Esconder Skype" - -msgid "Check for Skype updates..." -msgstr "Verificar actualizações do Skype..." - -msgid "Check for plugin updates..." -msgstr "Verificar actualizações do plugin..." - -msgid "Search for buddies..." -msgstr "Pesquisar pessoas..." - -msgid "Check Skype balance..." -msgstr "Verificar Saldo Skype..." - -msgid "Call..." -msgstr "Ligar..." - -msgid "Open Skype Options..." -msgstr "Abrir Opções Skype..." - -# User searching: -msgid "Search for Skype Users" -msgstr "Pesquisa de Utilizadores Skype" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Escreva o Nome Skype, nome completo ou endereço de email da pessoa que pretende pesquisar." - -msgid "The user does not exist in Skype" -msgstr "O utilizador não existe no Skype" - -msgid "Skype Name" -msgstr "Nome Skype" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "_Pesquisa" -msgid "_Cancel" -msgstr "_Cancelar" -msgid "_Send File" -msgstr "_Enviar Ficheiro" -msgid "Initiate _Chat" -msgstr "Iniciar _Chat" -msgid "_Close" -msgstr "_Fechar" -msgid "Full Name" -msgstr "Nome Completo" -msgid "Country/Region" -msgstr "País/Região" -msgid "_Add" -msgstr "_Adicionar" -msgid "Full name" -msgstr "Nome completo" -msgid "Personal Information" -msgstr "Informação Pessoal" -msgid "Birthday" -msgstr "Aniversário" -msgid "Gender" -msgstr "Género" -msgid "Preferred Language" -msgstr "Idioma " -msgid "Country" -msgstr "País" -msgid "Authorization Granted" -msgstr "Autorização Concedida" -msgid "Blocked" -msgstr "Bloqueado" -msgid "Timezone" -msgstr "Zona horária" -msgid "_Accept" -msgstr "_Aceitar" -msgid "_Reject" -msgstr "_Rejeitar" -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Impossível o envio de ficheiros para %s, o utilizador não suporta transferência de ficheiros" -msgid "Recipient Unavailable" -msgstr "Receptor Indisponível" -msgid "Read Error" -msgstr "Erro de leitura" -msgid "Write error" -msgstr "Erro de escrita" -msgid "Not Authorized" -msgstr "Não Autorizado" -msgid "%s wants to send you a file" -msgstr "%s enviou-lhe um ficheiro" -msgid "File Transfers" -msgstr "Tranferências de Ficheiros" -msgid "%s has changed the topic to: %s" -msgstr "%s alterou o tópico para: %s" -msgid "Contact Info" -msgstr "Informação de Contacto" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ru.po qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ru.po --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ru.po 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/ru.po 1970-01-01 00:00:00.000000000 +0000 @@ -1,226 +0,0 @@ -# Russian translation of skype4pidgin plugin -# Translated by Petr Vasilyev -# Petr Vasilyev, 2008. -# -# -msgid "" -msgstr "" -"Project-Id-Version: 2008-04-22\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: 2008-05-16 09:52+1200\n" -"Last-Translator: Petr Vasilyev\n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "Доступно обновление Pidgin/Skype плагина" - -msgid "There is a newer version of Skype available for download" -msgstr "Доступна новая версия Skype" - -msgid "No updates found" -msgstr "Обновлений не найдено" - -msgid "You have the latest version of Skype" -msgstr "У Вас самая свежая версия Skype" - -msgid "You have the latest version of the Skype plugin" -msgstr "У Вас самая свежия версия Pidgin/Skype плагина" - -msgid "Your version:" -msgstr "Ваша версия:" - -msgid "Latest version:" -msgstr "Самая свежая версия:" - -msgid "Download from:" -msgstr "Скачать с:" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "На Вашем Skype счёте осталось:" - -msgid "Skype Balance" -msgstr "Skype счёт:" - -msgid "Enter the phone number or Skype buddy name to call" -msgstr "Введите телефонный номер или имя пользователя Skype" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "Показывать статус Skype Out контактов как 'Доступен'" - -msgid "Make Skype online/offline when going online/offline" -msgstr "Соединять/отсоединять Skype от сети вместе с Pidgin" - -msgid "Automatically check for updates" -msgstr "Автоматически проверять обновления" - -msgid "Auto-start Skype if not running" -msgstr "Запускать Skype, если он не запущен" - -msgid "The user does not exist in Skype" -msgstr "Такого пользователя Skype не существует" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "Не в сети, включена голосовая почта" - -msgid "Offline with Call Forwarding" -msgstr "Не в сети, включена переадресация вызова" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "Можно пользоваться только одной учётной записью Skype" - -msgid "Skype not responding" -msgstr "Skype не отвечает" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "Не могу соединиться с процессом Skype.\nSkype не запущен?" - -msgid "Skype client not ready" -msgstr "Skype не готов" - -msgid "Connected to Skype" -msgstr "Соединён со Skype" - -msgid "Skype program closed" -msgstr "Приложение Skype было закрыто" - -msgid "%s is calling you." -msgstr "Вам звонит %s" - -msgid "Do you want to accept their call?" -msgstr "Вы хотите принять звонок?" - -msgid "Last online" -msgstr "Последний раз был в сети" - -msgid "Number of buddies" -msgstr "Количество контактов" - -msgid "Is Video Capable" -msgstr "Доступен ли видео чат" - -msgid "Hide Skype" -msgstr "Скрыть Skype" - -msgid "Check for Skype updates..." -msgstr "Проверить обновления Skype..." - -msgid "Check for plugin updates..." -msgstr "Проверить обновления Pidgin/Skype плагина..." - -msgid "Search for buddies..." -msgstr "Поискать пользователей Skype..." - -msgid "Check Skype balance..." -msgstr "Проверить состояние счёта Skype..." - -msgid "Call..." -msgstr "Позвонить..." - -msgid "Open Skype Options..." -msgstr "Открыть окно настроек Skype..." - -msgid "Search for Skype Users" -msgstr "Искать пользователей Skype" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "Введите Skype имя, полное имя или почтовый адрес человека, которого Вы ищете." - -msgid "Skype Name" -msgstr "Skype имя" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "_Искать" - -msgid "_Cancel" -msgstr "О_тменить" - -msgid "_Send File" -msgstr "Отправить _файл" - -msgid "Initiate _Chat" -msgstr "Создать _чат" - -msgid "_Close" -msgstr "_Закрыть" - -msgid "Full Name" -msgstr "Полное имя" - -msgid "Country/Region" -msgstr "Страна/Регион" - -msgid "_Add" -msgstr "_Добавить" - -msgid "Full name" -msgstr "Полное Имя" - -msgid "Personal Information" -msgstr "Персональная информация" - -msgid "Birthday" -msgstr "Дата рождения" - -msgid "Gender" -msgstr "Пол" - -msgid "Preferred Language" -msgstr "Предпочитаемый язык" - -msgid "Country" -msgstr "Страна" - -msgid "Authorization Granted" -msgstr "Авторизация дана" - -msgid "Blocked" -msgstr "Заблокирован" - -msgid "Timezone" -msgstr "Часовой пояс" - -msgid "_Accept" -msgstr "_Принять" - -msgid "_Reject" -msgstr "_Отвергнуть" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "Не удаётся отправить файл для %s, пользователь не поддерживает приём файлов" - -msgid "Recipient Unavailable" -msgstr "Получатель недоступен" - -msgid "Read Error" -msgstr "Ошибка чтения" - -msgid "Write error" -msgstr "Ошибка записи" - -msgid "Not Authorized" -msgstr "Не авторизован" - -msgid "%s wants to send you a file" -msgstr "%s хочет отправить вам файл" - -msgid "File Transfers" -msgstr "Передача файлов" - -msgid "%s has changed the topic to: %s" -msgstr "%s сменил тему на: %s" - -msgid "Contact Info" -msgstr "Контактная информация" - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/skype4pidgin.pot qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/skype4pidgin.pot --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/skype4pidgin.pot 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/po/skype4pidgin.pot 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -# LANGUAGE translation of skype4pidgin plugin -# Translated by FULL NAME -# FULLNAME, YEAR. -# -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-04-22 10:53+1200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"MIME-Version: 1.0\n" -"Language-Team: \n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit" - -# Checking for updates: -msgid "There is a newer version of the Skype plugin available for download" -msgstr "" - -msgid "There is a newer version of Skype available for download" -msgstr "" - -msgid "No updates found" -msgstr "" - -msgid "You have the latest version of Skype" -msgstr "" - -msgid "You have the latest version of the Skype plugin" -msgstr "" - -msgid "Your version:" -msgstr "" - -msgid "Latest version:" -msgstr "" - -msgid "Download from:" -msgstr "" - -# Skype account balance stuff: -msgid "Your current Skype credit balance is:" -msgstr "" - -msgid "Skype Balance" -msgstr "" - -# Plugin options: -msgid "Show SkypeOut contacts as 'Online'" -msgstr "" - -msgid "Make Skype online/offline when going online/offline" -msgstr "" - -msgid "Automatically check for updates" -msgstr "" - -msgid "Auto-start Skype if not running" -msgstr "" - -# Buddy status: -msgid "Offline with Voicemail" -msgstr "" - -msgid "Offline with Call Forwarding" -msgstr "" - -# Connection messages: -msgid "Only one Skype account allowed" -msgstr "" - -msgid "Skype not responding" -msgstr "" - -msgid "Could not connect to Skype process.\nSkype not running?" -msgstr "" - -msgid "Skype client not ready" -msgstr "" - -msgid "Connected to Skype" -msgstr "" - -msgid "Skype program closed" -msgstr "" - -# Skype calling stuff -msgid "Enter the phone number or Skype buddy name to call" -msgstr "" - -msgid "%s is calling you." -msgstr "" - -msgid "Do you want to accept their call?" -msgstr "" - -# Buddy information -msgid "Last online" -msgstr "" - -msgid "Number of buddies" -msgstr "" - -msgid "Is Video Capable" -msgstr "" - -# Plugin menu options -msgid "Hide Skype" -msgstr "" - -msgid "Check for Skype updates..." -msgstr "" - -msgid "Check for plugin updates..." -msgstr "" - -msgid "Search for buddies..." -msgstr "" - -msgid "Check Skype balance..." -msgstr "" - -msgid "Call..." -msgstr "" - -msgid "Open Skype Options..." -msgstr "" - -# User searching: -msgid "Search for Skype Users" -msgstr "" - -msgid "Type the Skype Name, full name or e-mail address of the buddy you are searching for." -msgstr "" - -msgid "The user does not exist in Skype" -msgstr "" - -msgid "Skype Name" -msgstr "" - -# Duplicate stuff from Pidgin -# Copy from {pidginsource}/po/{languagecode}.po - -msgid "_Search" -msgstr "" - -msgid "_Cancel" -msgstr "" - -msgid "_Send File" -msgstr "" - -msgid "Initiate _Chat" -msgstr "" - -msgid "_Close" -msgstr "" - -msgid "Full Name" -msgstr "" - -msgid "Country/Region" -msgstr "" - -msgid "_Add" -msgstr "" - -msgid "Full name" -msgstr "" - -msgid "Personal Information" -msgstr "" - -msgid "Birthday" -msgstr "" - -msgid "Gender" -msgstr "" - -msgid "Preferred Language" -msgstr "" - -msgid "Country" -msgstr "" - -msgid "Authorization Granted" -msgstr "" - -msgid "Blocked" -msgstr "" - -msgid "Timezone" -msgstr "" - -msgid "_Accept" -msgstr "" - -msgid "_Reject" -msgstr "" - -msgid "Unable to send file to %s, user does not support file transfers" -msgstr "" - -msgid "Recipient Unavailable" -msgstr "" - -msgid "Read Error" -msgstr "" - -msgid "Write error" -msgstr "" - -msgid "Not Authorized" -msgstr "" - -msgid "%s wants to send you a file" -msgstr "" - -msgid "File Transfers" -msgstr "" - -msgid "%s has changed the topic to: %s" -msgstr "" - -msgid "Contact Info" -msgstr "" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/README.txt qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/README.txt --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/README.txt 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/README.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -Skype plugin for Pidgin/Adium/libpurple -======================================= - -If you've found this file then you'll probably realise that this is the Skype plugin for libpurple. Yes, it does require Skype to be running as it uses the Skype API to communicate with a running copy of Skype. The Windows and Linux versions were made by me in a week. The OS X version has taken lots longer, but it needed reverse engineering of the Skype.framework before it was GPL compatable. - - -History/Ramble -============== - -It seems people have wanted a Skype plugin for Gaim/Pidgin/Adium for a long time, however it seems to be rare to find a glib coder who uses Pidgin who also uses Skype. There seems to have been a lot of stigma over Skype being closed-source and evil, however there has still been a demand for this plugin and the end-user has suffered for long enough. That was kind of my motivation. Plus I enjoy both Pidgin and Skype and it made sense to me to combine the two. I know it's not the ideal solution (to still have Skype running), but if you're going to have it running, you might as well have your buddies in one place, right? - - -Installation -============ - -For the binary version of the plugin, either install the appropriate package or .exe for your distro or copy libskype to the appropriate plugins directory. On Windows its normally C:\Program Files\Pidgin\plugins, on Linux it's normally /usr/lib/purple-2/ or ~/.purple/plugins -On OSX, double click on SkypePlugin.AdiumPlugin to install (may need a restart of Adium). You may need to delete the old version which is at ~/Library/Application Support/Adium 2.0/Plugins. If upgrading to Adium 1.2, you will need to delete the account and re-add it. - -To install swanky looking icons, extract skype_icons.zip to the pixmaps/pidgin/protocols directory (on Windows, C:\Program Files\Pidgin\pixmaps\pidgin\protocols). -To have the right smilies/emotes in your Skype chat messages, copy themes into the pixmaps/pidgin/emotes/default folder. - -To compile from source, the easiest way is extract libskype.zip into the ${PIDGIN_SOURCE}/libpurple/plugins/ directory and compile using "make libpurple.so" or "make -f Makefile.mingw libpurple.dll" - - -Known Issues -============ - -* No notification popup on file being received/notificaitons (Windows) - -* Skype sounds still play even when it's hidden - -* Adium doesn't show file transfer progress (OS X) -* Unable to send file from within Adium (API Limitation) -* Send file doesn't use the built in libpurple methods. (API Limitation) -* Linux version still opens up Skype message windows. (API Limitation) -* No typing notifications with official Skype clients. (API Limitation) - - -FAQ -=== - -Q: Does this plugin require Skype to be running? -A: Yes. - -Q: Can you make a version that doesn't need Skype? -A: Not possible right now. - -Q: What version of Pidgin do I need to be able to run this plugin? -A: You need at least version 2.1.1 of Pidgin. You can download updates to Pidgin from www.pidgin.im - -Q: What version of Adium do I need to be able to run this plugin? -A: You need version 1.2 to run the latest version of the plugin or 1.1 to run the older version of the plugin. You can download updates to Adium from www.adiumx.com - -Q: Where can I get the protocol icons? -A: Download skype_icons.zip from this website and install the icons into the appropriate pixmaps/pidgin/protocols directory. - -Q: How can I hide the Skype icon from the tray? -A: I'm planning to automate and make this cross-platform. - -Q: How can I hide the Skype icon from the tray on Windows? -A: Right click on the taskbar, click Properties, click the Customize... button, find Skype in the list, click on it, choose 'Always Hide' from the drop-down box. - -Q: How can I hide Skype in OSX? -A: Focus (click on) the Skype window, press ⌘+H to hide the application. Alternativly, focus the Skype window and choose 'Hide Skype' from the 'Skype' menu. - -Q: How can I hide Skype in Linux? -A: A bit more tricky. What works well for me, is turning off message windows in the Notifications settings in Skype (Options->Chat->Display an event notification). Otherwise, you can leave the message window open, but move it to another workspace so that it doesn't bother you any more. - -Q: The Windows version has feature "X", but the Linux/OSX version doesn't -A: The API on Linux/OSX is more restrictive than the Windows API. Try keeping up to date with the latest versions of Skype to take advantage of these features as they are implemented by the Skype developers. - -Q: Why is "Send file..." not in the conversation menu, but in the "More..." menu instead? -A: The short answer is that Skype doesn't allow file sending in the way that libpurple wants, so it has to do it through a Skype popup instead of a Pidgin popup - -Q: I set my status to "Away" but Skype still shows me as "Online"? -A: For some reason the Skype tray icon isn't always what is being seen at the other end. Just ignore it :) - -Q: On OSX, I get bugged with the "Allow API Access" window from Skype every time Adium starts? -A: Turn on "access for assistive devices" See: http://images.apple.com/applescript/uiscripting/gfx/gui.03.jpg - -Contact -======= - -If you've got any questions/problems/comments with this plugin, feel free to flick me an email at eion@robbmob.com or chat message on Skype at bigbrownchunx. - - -Legal -===== -Skype is the trademark of Skype Limited - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype4pidgin.nsi qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype4pidgin.nsi --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype4pidgin.nsi 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype4pidgin.nsi 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -; Script based on Off-the-Record Messaging NSI file - - -SetCompress off - -; todo: SetBrandingImage -; HM NIS Edit Wizard helper defines -!define PRODUCT_NAME "skype4pidgin" -!define PRODUCT_VERSION "28-Apr-2009" -!define PRODUCT_PUBLISHER "Eion Robb" -!define PRODUCT_WEB_SITE "http://skype4pidgin.googlecode.com/" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" -!define PRODUCT_UNINST_ROOT_KEY "HKLM" - -; MUI 1.67 compatible ------ -!include "MUI.nsh" - -; MUI Settings -!define MUI_ABORTWARNING -!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" - -; Welcome page -!insertmacro MUI_PAGE_WELCOME -; License page -!insertmacro MUI_PAGE_LICENSE "COPYING.txt" -; Directory page -;!insertmacro MUI_PAGE_DIRECTORY -; Instfiles page -!insertmacro MUI_PAGE_INSTFILES -; Finish page -!define MUI_FINISHPAGE_SHOWREADME "http://myjobspace.co.nz/images/pidgin/README.txt" -!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED -!define MUI_FINISHPAGE_RUN -!define MUI_FINISHPAGE_RUN_TEXT "Run Pidgin" -!define MUI_FINISHPAGE_RUN_FUNCTION "RunPidgin" -!insertmacro MUI_PAGE_FINISH - -; Uninstaller pages -;!insertmacro MUI_UNPAGE_INSTFILES - -; Language files -!insertmacro MUI_LANGUAGE "English" - -; MUI end ------ - -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "${PRODUCT_NAME}-installer.exe" -;InstallDir "$PROGRAMFILES\skype4pidgin" -;InstallDirRegKey HKEY_LOCAL_MACHINE SOFTWARE\skype4pidgin "Install_Dir" -;WriteRegStr HKLM "SOFTWARE\skype4pidgin" "pidgindir" "" - -Var "PidginDir" - -ShowInstDetails show -ShowUnInstDetails show - -Section "MainSection" SEC01 - ;InstallDir "$PROGRAMFILES\Pidgin\plugins" - - ; uninstall previous install if found. - ;Call UnInstOld - ;Check for pidgin installation - Call GetPidginInstPath - ;WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "SOFTWARE\skype4pidgin" "pidgindir" "$PidginDir" - - SetOverwrite try - - SetOutPath "$PidginDir\pixmaps\pidgin" - File "/oname=protocols\16\skype.png" "icons\16\skype.png" - File "/oname=protocols\22\skype.png" "icons\22\skype.png" - File "/oname=protocols\48\skype.png" "icons\48\skype.png" - File "/oname=protocols\16\skypeout.png" "icons\16\skypeout.png" - File "/oname=protocols\22\skypeout.png" "icons\22\skypeout.png" - File "/oname=protocols\48\skypeout.png" "icons\48\skypeout.png" - - SetOutPath "$PidginDir\pixmaps\pidgin\emotes\skype" - File "theme" - - SetOutPath "$PidginDir\locale" - File /nonfatal "/oname=ja\LC_MESSAGES\skype4pidgin.mo" "po\ja.mo" - File /nonfatal "/oname=de\LC_MESSAGES\skype4pidgin.mo" "po\de.mo" - File /nonfatal "/oname=fr\LC_MESSAGES\skype4pidgin.mo" "po\fr.mo" - File /nonfatal "/oname=es\LC_MESSAGES\skype4pidgin.mo" "po\es.mo" - File /nonfatal "/oname=hu\LC_MESSAGES\skype4pidgin.mo" "po\hu.mo" - File /nonfatal "/oname=nb\LC_MESSAGES\skype4pidgin.mo" "po\nb.mo" - File /nonfatal "/oname=it\LC_MESSAGES\skype4pidgin.mo" "po\it.mo" - File /nonfatal "/oname=ru\LC_MESSAGES\skype4pidgin.mo" "po\ru.mo" - File /nonfatal "/oname=pl\LC_MESSAGES\skype4pidgin.mo" "po\pl.mo" - File /nonfatal "/oname=pt\LC_MESSAGES\skype4pidgin.mo" "po\pt.mo" - File /nonfatal "/oname=en_AU\LC_MESSAGES\skype4pidgin.mo" "po\en_AU.mo" - - SetOverwrite try - copy: - ClearErrors - Delete "$PidginDir\plugins\libskype.dll" - IfErrors dllbusy - SetOutPath "$PidginDir\plugins" - File "libskype.dll" - Goto after_copy - dllbusy: - MessageBox MB_RETRYCANCEL "libskype.dll is busy. Please close Pidgin (including tray icon) and try again" IDCANCEL cancel - Goto copy - cancel: - Abort "Installation of skype4pidgin aborted" - after_copy: - Call RegisterURIHandler - -SectionEnd - -Function RegisterURIHandler - DeleteRegKey HKCR "skype" - WriteRegStr HKCR "skype" "" "URL:skype" - WriteRegStr HKCR "skype" "URL Protocol" "" - WriteRegStr HKCR "skype\DefaultIcon" "" "$PidginDir\pidgin.exe" - WriteRegStr HKCR "skype\shell" "" "" - WriteRegStr HKCR "skype\shell\Open" "" "" - WriteRegStr HKCR "skype\shell\Open\command" "" "$PidginDir\pidgin.exe --protocolhandler=%1" -FunctionEnd - -Function GetPidginInstPath - Push $0 - ReadRegStr $0 HKLM "Software\pidgin" "" - IfFileExists "$0\pidgin.exe" cont - ReadRegStr $0 HKCU "Software\pidgin" "" - IfFileExists "$0\pidgin.exe" cont - MessageBox MB_OK|MB_ICONINFORMATION "Failed to find Pidgin installation." - Abort "Failed to find Pidgin installation. Please install Pidgin first." - cont: - StrCpy $PidginDir $0 -FunctionEnd - -Function RunPidgin - ExecShell "" "$PidginDir\pidgin.exe" -FunctionEnd - -Function UnInstOld - Push $0 - ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" - IfFileExists "$0" deinst cont - deinst: - ClearErrors - ;ExecWait '"$0" _?=$INSTDIR' - ExecWait '"$0" _?="$PROGRAMFILES\skype4pidgin"' - ;IfErrors 0 cont - ; MessageBox MB_OK|MB_ICONEXCLAMATION "Uninstall failed or aborted" - ; Abort "Uninstalling of the previous version gave an error. Install aborted." - - cont: - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" - -FunctionEnd diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_events.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_events.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_events.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_events.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1224 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -void skype_auth_allow(gpointer sender); -void skype_auth_deny(gpointer sender); -static gboolean skype_handle_received_message(char *message); -gint skype_find_filetransfer(PurpleXfer *transfer, char *skypeid); -void skype_accept_transfer(PurpleXfer *transfer); -void skype_decline_transfer(PurpleXfer *transfer); -SkypeChat *skype_find_chat(const gchar *chat_id, PurpleAccount *this_account); -gint skype_find_chat_compare_func(PurpleConversation *conv, char *chat_id); -static void purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status); -void skype_call_accept_cb(gchar *call); -void skype_call_reject_cb(gchar *call); -void skype_call_ignore_cb(gchar *call); -void skype_call_voicemail_cb(gchar *call); -void skype_call_forward_cb(gchar *call); -gboolean skype_sync_skype_close(PurpleConnection *gc); -gboolean handle_complete_message(int messagenumber); - -gboolean skype_update_buddy_status(PurpleBuddy *buddy); -void skype_update_buddy_alias(PurpleBuddy *buddy); -void skype_update_buddy_icon(PurpleBuddy *buddy); -static PurpleAccount *skype_get_account(PurpleAccount *account); -const char *skype_get_account_username(PurpleAccount *acct); -gchar *skype_get_user_info(const gchar *username, const gchar *property); -gchar *skype_strdup_withhtml(const gchar *src); -void skype_put_buddies_in_groups(); -void skype_get_chatmessage_info(int message); -void set_skype_buddy_attribute(SkypeBuddy *sbuddy, const gchar *skype_buddy_property, const gchar *value); -SkypeBuddy *skype_buddy_new(PurpleBuddy *buddy); - -char *skype_send_message(char *message, ...); -//dont use this unless you know what you're doing: -void skype_send_message_nowait(char *message, ...); - -static time_t last_pong = 0; -static GHashTable *messages_table = NULL; -static GHashTable *groups_table = NULL; - -typedef enum _SkypeMessageType { - SKYPE_MESSAGE_OTHER = 0, - SKYPE_MESSAGE_TEXT, - SKYPE_MESSAGE_EMOTE, - SKYPE_MESSAGE_ADD, - SKYPE_MESSAGE_LEFT, - SKYPE_MESSAGE_KICKED, - SKYPE_MESSAGE_TOPIC -} SkypeMessageType; - -typedef struct _SkypeMessage { - //Required properties - PurpleAccount *account; - SkypeMessageType type; - PurpleMessageFlags flags; //send or recv - gchar *chatname; - - //Optional properties - gchar *body; //topic, text, emote - gchar *from_handle; //topic, text, emote, left - gint timestamp; //text, emote - gchar **users; //add, kicked - gchar *leavereason; //left -} SkypeMessage; - -/* - This function must only be called from the main loop, using purple_timeout_add -*/ -static gboolean -skype_handle_received_message(char *message) -{ - char command[255]; - char **string_parts = NULL; - PurpleAccount *this_account; - PurpleConnection *gc; - const char *my_username; - PurpleBuddy *buddy; - SkypeBuddy *sbuddy; - SkypeChat *chat; - char *body; - char *body_html; - char *msg_num; - char *sender; - char *type; - int mtime; - char *chatname; - char *temp; - //char *chat_type; - char **chatusers = NULL; - PurpleXfer *transfer = NULL; - PurpleConversation *conv = NULL; - GList *glist_temp = NULL; - int i; - PurpleGroup *temp_group; - //PurpleStatusPrimitive primitive; - SkypeMessage *skypemessage; - - sscanf(message, "%s ", command); - this_account = skype_get_account(NULL); - if (this_account == NULL) - return FALSE; - gc = purple_account_get_connection(this_account); - my_username = skype_get_account_username(this_account); - string_parts = g_strsplit(message, " ", 4); - - if (g_str_equal(command, "PONG")) - { - last_pong = time(NULL); - } else if (g_str_equal(command, "USERSTATUS")) - { - - } else if (g_str_equal(command, "CONNSTATUS")) - { - if (g_str_equal(string_parts[1], "LOGGEDOUT")) - { - //need to make this synchronous :( - if (gc != NULL) - purple_connection_error(gc, _("\nSkype program closed")); - //purple_timeout_add(0, (GSourceFunc)skype_sync_skype_close, gc); - } - } else if (g_str_equal(command, "USER")) - { - buddy = purple_find_buddy(this_account, string_parts[1]); - if (buddy != NULL) - { - sbuddy = buddy->proto_data; - if (g_str_equal(string_parts[2], "ONLINESTATUS")) - { - //the status 'id' is in string_parts[3] - - //special cases: - if (g_str_equal(string_parts[3], "SKYPEOUT")) - { - set_skype_buddy_attribute(sbuddy, "MOOD_TEXT", _("SkypeOut")); - } - if (g_str_equal(string_parts[3], "UNKNOWN")) - { - //user doesn't exist - purple_blist_remove_buddy(buddy); - purple_notify_error(gc, "Error", "User does not exist", "The user does not exist in Skype"); - buddy = NULL; - } else { - PurpleStatus *status = purple_presence_get_active_status(purple_buddy_get_presence(buddy)); - //Dont say we got their status unless its changed - if (!status || !g_str_equal(purple_status_get_id(status), string_parts[3])) - { - purple_prpl_got_user_status(this_account, string_parts[1], string_parts[3], NULL); - } - //dont update buddy icon/mood for offline/skypeout users - if (!g_str_equal(string_parts[3], "OFFLINE") && !g_str_equal(string_parts[3], "SKYPEOUT")) - { - skype_send_message_nowait("GET USER %s MOOD_TEXT", string_parts[1]); - skype_update_buddy_icon(buddy); - } - } - } else if (g_str_equal(string_parts[2], "DISPLAYNAME")) - { - if (strlen(g_strstrip(string_parts[3]))) - purple_blist_server_alias_buddy(buddy, string_parts[3]); - } else if (g_str_equal(string_parts[2], "FULLNAME")) - { - if (strlen(g_strstrip(string_parts[3])) && (!purple_buddy_get_server_alias(buddy) || !strlen(purple_buddy_get_server_alias(buddy)))) - purple_blist_server_alias_buddy(buddy, string_parts[3]); - set_skype_buddy_attribute(sbuddy, "FULLNAME", string_parts[3]); - } else if ((g_str_equal(string_parts[2], "BUDDYSTATUS")) && - (g_str_equal(string_parts[3], "1"))) - { - purple_blist_remove_buddy(buddy); - } else if (g_str_equal(string_parts[2], "MOOD_TEXT")) - { - if (sbuddy && (!sbuddy->mood || !g_str_equal(sbuddy->mood, string_parts[3]))) - { - set_skype_buddy_attribute(sbuddy, string_parts[2], string_parts[3]); - } - } else { - set_skype_buddy_attribute(sbuddy, string_parts[2], string_parts[3]); - } - } else if (g_str_equal(string_parts[2], "BUDDYSTATUS")) - { - if (g_str_equal(string_parts[3], "3")) - { - skype_debug_info("skype", "Buddy %s just got added\n", string_parts[1]); - //buddy just got added.. handle it - if (purple_find_buddy(this_account, string_parts[1]) == NULL) - { - skype_debug_info("skype", "Buddy not in list\n"); - buddy = purple_buddy_new(this_account, g_strdup(string_parts[1]), NULL); - skype_buddy_new(buddy); - if (string_parts[1][0] == '+') - { - temp_group = purple_find_group("SkypeOut"); - if (temp_group == NULL) - { - temp_group = purple_group_new("SkypeOut"); - purple_blist_add_group(temp_group, NULL); - } - } else { - temp_group = purple_find_group("Skype"); - if (temp_group == NULL) - { - temp_group = purple_group_new("Skype"); - purple_blist_add_group(temp_group, NULL); - } - } - purple_blist_add_buddy(buddy, NULL, temp_group, NULL); - skype_update_buddy_status(buddy); - skype_update_buddy_alias(buddy); - purple_prpl_got_user_idle(this_account, buddy->name, FALSE, 0); - skype_update_buddy_icon(buddy); - skype_put_buddies_in_groups(); - } - } - } else if (g_str_equal(string_parts[2], "RECEIVEDAUTHREQUEST")) - { - //this event can be fired directly after authorising someone - temp = skype_get_user_info(string_parts[1], "ISAUTHORIZED"); - if (!g_str_equal(temp, "TRUE")) - { - skype_debug_info("skype", "User %s requested authorisation\n", string_parts[1]); - purple_account_request_authorization(this_account, string_parts[1], NULL, skype_get_user_info(string_parts[1], "FULLNAME"), - string_parts[3], (purple_find_buddy(this_account, string_parts[1]) != NULL), - skype_auth_allow, skype_auth_deny, (gpointer)g_strdup(string_parts[1])); - } - g_free(temp); - } - } else if (g_str_equal(command, "MESSAGE")) - { - if (g_str_equal(string_parts[3], "RECEIVED")) - { - msg_num = string_parts[1]; - temp = skype_send_message("GET MESSAGE %s TYPE", msg_num); - type = g_strdup(&temp[14+strlen(msg_num)]); - g_free(temp); - if (g_str_equal(type, "TEXT") || - g_str_equal(type, "AUTHREQUEST")) - { - temp = skype_send_message("GET MESSAGE %s PARTNER_HANDLE", msg_num); - sender = g_strdup(&temp[24+strlen(msg_num)]); - g_free(temp); - temp = skype_send_message("GET MESSAGE %s BODY", msg_num); - body = g_strdup(&temp[14+strlen(msg_num)]); - g_free(temp); - temp = skype_send_message("GET MESSAGE %s TIMESTAMP", msg_num); - mtime = atoi(&temp[19+strlen(msg_num)]); - g_free(temp); - - /* Escape the body to HTML */ - body_html = skype_strdup_withhtml(body); - g_free(body); - - if (g_str_equal(type, "TEXT")) - { - if (g_str_equal(sender, my_username)) - { - temp = skype_send_message("GET CHATMESSAGE %s CHATNAME", msg_num); - chatname = g_strdup(&temp[18+strlen(msg_num)]); - g_free(temp); - //skype_debug_info("skype", "Chatname: '%s'\n", chatname); - chatusers = g_strsplit_set(chatname, "/;", 3); - if (g_str_equal(&chatusers[0][1], my_username)) - sender = &chatusers[1][1]; - else - sender = &chatusers[0][1]; - serv_got_im(gc, sender, body_html, PURPLE_MESSAGE_SEND, mtime); - g_strfreev(chatusers); - } else { - serv_got_im(gc, sender, body_html, PURPLE_MESSAGE_RECV, mtime); - } - }/* else if (g_str_equal(type, "AUTHREQUEST") && !g_str_equal(sender, my_username)) - { - skype_debug_info("User %s requested alternate authorisation\n", sender); - purple_account_request_authorization(this_account, sender, NULL, skype_get_user_info(sender, "FULLNAME"), - body, (purple_find_buddy(this_account, sender) != NULL), - skype_auth_allow, skype_auth_deny, (gpointer)g_strdup(sender)); - }*/ - - skype_send_message("SET MESSAGE %s SEEN", msg_num); - } - } else if (g_str_equal(string_parts[3], "SENT")) - { - /* mark it as seen, to remove notification from skype ui */ - - /* dont async this -> infinite loop */ - skype_send_message("SET MESSAGE %s SEEN", string_parts[1]); - } - } else if (g_str_equal(command, "CHATMESSAGE")) - { - if ((g_str_equal(string_parts[3], "RECEIVED")) - || (g_str_equal(string_parts[3], "SENT")) - ) - { - if (messages_table == NULL) - { - messages_table = g_hash_table_new(NULL, NULL); - } - skypemessage = g_new0(SkypeMessage, 1); - skypemessage->account = this_account; - if (g_str_equal(string_parts[3], "RECEIVED")) - skypemessage->flags = PURPLE_MESSAGE_RECV; - else if (g_str_equal(string_parts[3], "SENT")) - skypemessage->flags = PURPLE_MESSAGE_SEND; - g_hash_table_insert(messages_table, GINT_TO_POINTER(atoi(string_parts[1])), skypemessage); -// printf("Message %s has int %d (%d)\n", string_parts[1], atoi(string_parts[1]), GINT_TO_POINTER(atoi(string_parts[1]))); - skype_get_chatmessage_info(atoi(string_parts[1])); - } else if (g_str_equal(string_parts[2], "TYPE")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - //try to keep these in order of most likely to least likely - if (g_str_equal(string_parts[3], "SAID") || - g_str_equal(string_parts[3], "TEXT")) - { - skypemessage->type = SKYPE_MESSAGE_TEXT; - } else if (g_str_equal(string_parts[3], "EMOTED")) - { - skypemessage->type = SKYPE_MESSAGE_EMOTE; - } else if (g_str_equal(string_parts[3], "ADDEDMEMBERS")) - { - skypemessage->type = SKYPE_MESSAGE_ADD; - } else if (g_str_equal(string_parts[3], "LEFT")) - { - skypemessage->type = SKYPE_MESSAGE_LEFT; - } else if (g_str_equal(string_parts[3], "KICKED") || - g_str_equal(string_parts[3], "KICKBANNED")) - { - skypemessage->type = SKYPE_MESSAGE_KICKED; - } else if (g_str_equal(string_parts[3], "SETTOPIC")) - { - skypemessage->type = SKYPE_MESSAGE_TOPIC; - } else { - skypemessage->type = SKYPE_MESSAGE_OTHER; - } - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } else if (g_str_equal(string_parts[2], "CHATNAME")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - skypemessage->chatname = g_strdup(string_parts[3]); - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } else if (g_str_equal(string_parts[2], "BODY")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - skypemessage->body = g_strdup(string_parts[3]); - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } else if (g_str_equal(string_parts[2], "FROM_HANDLE")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - skypemessage->from_handle = g_strdup(string_parts[3]); - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } else if (g_str_equal(string_parts[2], "USERS")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - skypemessage->users = g_strsplit(string_parts[3], " ", -1); - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } else if (g_str_equal(string_parts[2], "LEAVEREASON")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - skypemessage->leavereason = g_strdup(string_parts[3]); - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } else if (g_str_equal(string_parts[2], "TIMESTAMP")) - { - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (skypemessage != NULL) - { - skypemessage->timestamp = atoi(string_parts[3]); - } else { - skype_debug_info("skype", "Skype message %s not in hashtable\n", string_parts[1]); - } - } - - handle_complete_message(atoi(string_parts[1])); - } else if (g_str_equal(command, "CHAT")) - { - //find the matching chat to update - chat = skype_find_chat(string_parts[1], this_account); - if (g_str_equal(string_parts[2], "TYPE")) - { - if (g_str_equal(string_parts[3], "DIALOG") || g_str_equal(string_parts[3], "LEGACY_DIALOG")) - { - chat->type = PURPLE_CONV_TYPE_IM; - } else { - chat->type = PURPLE_CONV_TYPE_CHAT; - } - } else if (g_str_equal(string_parts[2], "MEMBERS")) - { - chatusers = g_strsplit(string_parts[3], " ", 0); - if (chat->members) - g_strfreev(chat->members); - chat->members = chatusers; - if (chat->type == PURPLE_CONV_TYPE_CHAT) - { - purple_conv_chat_clear_users(PURPLE_CONV_CHAT(chat->conv)); - for (i=0; chatusers[i]; i++) - { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), chatusers[i], NULL, PURPLE_CBFLAGS_NONE, FALSE); - } - } - } else if (chat->conv && g_str_equal(string_parts[2], "FRIENDLYNAME")) - { - if (chat->type == PURPLE_CONV_TYPE_CHAT) - { - purple_conversation_set_title(chat->conv, string_parts[3]); - purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_TITLE); - } - } else if (chat->conv && g_str_equal(string_parts[2], "TOPIC")) - { - if (chat->type == PURPLE_CONV_TYPE_CHAT) - { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(chat->conv), my_username, string_parts[3]); - purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_TOPIC); - } - } - chat = skype_find_chat(string_parts[1], this_account); - } else if (g_str_equal(command, "FILETRANSFER")) - { - //lookup current file transfers to see if there's already one there - glist_temp = g_list_find_custom(purple_xfers_get_all(), - string_parts[1], - (GCompareFunc)skype_find_filetransfer); - if (glist_temp == NULL && g_str_equal(string_parts[2], "TYPE")) - { - temp = skype_send_message("GET FILETRANSFER %s PARTNER_HANDLE", string_parts[1]); - sender = g_strdup(&temp[29+strlen(string_parts[1])]); - g_free(temp); - if (g_str_equal(string_parts[3], "INCOMING")) - { - transfer = purple_xfer_new(this_account, PURPLE_XFER_RECEIVE, sender); - } else { - transfer = purple_xfer_new(this_account, PURPLE_XFER_SEND, sender); - } - transfer->data = g_strdup(string_parts[1]); - purple_xfer_set_init_fnc(transfer, skype_accept_transfer); - purple_xfer_set_request_denied_fnc(transfer, skype_decline_transfer); - temp = skype_send_message("GET FILETRANSFER %s FILENAME", string_parts[1]); - skype_debug_info("skype", "Filename: '%s'\n", &temp[23+strlen(string_parts[1])]); - purple_xfer_set_filename(transfer, g_strdup(&temp[23+strlen(string_parts[1])])); - g_free(temp); - temp = skype_send_message("GET FILETRANSFER %s FILEPATH", string_parts[1]); - if (strlen(&temp[23+strlen(string_parts[1])])) - purple_xfer_set_local_filename(transfer, g_strdup(&temp[23+strlen(string_parts[1])])); - else - purple_xfer_set_local_filename(transfer, purple_xfer_get_filename(transfer)); - g_free(temp); - temp = skype_send_message("GET FILETRANSFER %s FILESIZE", string_parts[1]); - purple_xfer_set_size(transfer, atol(&temp[23+strlen(string_parts[1])])); - g_free(temp); - purple_xfer_add(transfer); - } else if (glist_temp != NULL) { - transfer = glist_temp->data; - } - if (transfer != NULL) - { - /*if (g_str_equal(string_parts[2], "TYPE")) - { - if (g_str_equal(string_parts[3], "INCOMING")) - { - transfer->type = PURPLE_XFER_RECEIVE; - } else { - transfer->type = PURPLE_XFER_SEND; - } - } else if (g_str_equal(string_parts[2], "PARTNER_HANDLE")) - { - transfer->who = g_strdup(string_parts[3]); - } else*/ if (g_str_equal(string_parts[2], "FILENAME")) - { - purple_xfer_set_filename(transfer, string_parts[3]); - } else if (g_str_equal(string_parts[2], "FILEPATH")) - { - if (strlen(string_parts[3])) - purple_xfer_set_local_filename(transfer, string_parts[3]); - } else if (g_str_equal(string_parts[2], "STATUS")) - { - if (g_str_equal(string_parts[3], "NEW") || - g_str_equal(string_parts[3], "WAITING_FOR_ACCEPT")) - { - //Skype API doesn't let us accept transfers - //purple_xfer_request(transfer); - if (purple_xfer_get_type(transfer) == PURPLE_XFER_RECEIVE) - { -# ifndef __APPLE__ - skype_send_message_nowait("OPEN FILETRANSFER"); -# else - purple_notify_info(this_account, _("File Transfers"), g_strdup_printf(_("%s wants to send you a file"), purple_xfer_get_remote_user(transfer)), NULL); -# endif - purple_xfer_conversation_write(transfer, g_strdup_printf(_("%s wants to send you a file"), purple_xfer_get_remote_user(transfer)), FALSE); - } - purple_xfer_set_status(transfer, PURPLE_XFER_STATUS_NOT_STARTED); - } else if (g_str_equal(string_parts[3], "COMPLETED")) - { - purple_xfer_set_completed(transfer, TRUE); - } else if (g_str_equal(string_parts[3], "CONNECTING") || - g_str_equal(string_parts[3], "TRANSFERRING") || - g_str_equal(string_parts[3], "TRANSFERRING_OVER_RELAY")) - { - purple_xfer_set_status(transfer, PURPLE_XFER_STATUS_STARTED); - transfer->start_time = time(NULL); - } else if (g_str_equal(string_parts[3], "CANCELLED")) - { - //transfer->end_time = time(NULL); - //transfer->bytes_remaining = 0; - //purple_xfer_set_status(transfer, PURPLE_XFER_STATUS_CANCEL_LOCAL); - purple_xfer_cancel_local(transfer); - }/* else if (g_str_equal(string_parts[3], "FAILED")) - { - //transfer->end_time = time(NULL); - //purple_xfer_set_status(transfer, PURPLE_XFER_STATUS_CANCEL_REMOTE); - purple_xfer_cancel_remote(transfer); - }*/ - purple_xfer_update_progress(transfer); - } else if (g_str_equal(string_parts[2], "STARTTIME")) - { - transfer->start_time = atol(string_parts[3]); - purple_xfer_update_progress(transfer); - /*} else if (g_str_equal(string_parts[2], "FINISHTIME")) - { - if (!g_str_equal(string_parts[3], "0")) - transfer->end_time = atol(string_parts[3]); - purple_xfer_update_progress(transfer);*/ - } else if (g_str_equal(string_parts[2], "BYTESTRANSFERRED")) - { - purple_xfer_set_bytes_sent(transfer, atol(string_parts[3])); - purple_xfer_update_progress(transfer); - } else if (g_str_equal(string_parts[2], "FILESIZE")) - { - purple_xfer_set_size(transfer, atol(string_parts[3])); - } else if (g_str_equal(string_parts[2], "FAILUREREASON") && - !g_str_equal(string_parts[3], "UNKNOWN")) - { - temp = NULL; - if (g_str_equal(string_parts[3], "SENDER_NOT_AUTHORIZED")) - { - temp = g_strdup(_("Not Authorized")); - } else if (g_str_equal(string_parts[3], "REMOTELY_CANCELLED")) - { - purple_xfer_cancel_remote(transfer); - purple_xfer_update_progress(transfer); - } else if (g_str_equal(string_parts[3], "FAILED_READ")) - { - temp = g_strdup(_("Read error")); - } else if (g_str_equal(string_parts[3], "FAILED_REMOTE_READ")) - { - temp = g_strdup(_("Read error")); - } else if (g_str_equal(string_parts[3], "FAILED_WRITE")) - { - temp = g_strdup(_("Write error")); - } else if (g_str_equal(string_parts[3], "FAILED_REMOTE_WRITE")) - { - temp = g_strdup(_("Write error")); - } else if (g_str_equal(string_parts[3], "REMOTE_DOES_NOT_SUPPORT_FT")) - { - temp = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), transfer->who); - } else if (g_str_equal(string_parts[3], "REMOTE_OFFLINE_FOR_TOO_LONG")) - { - temp = g_strdup(_("Recipient Unavailable")); - } - if (temp && strlen(temp)) - { - purple_xfer_error(transfer->type, this_account, transfer->who, temp); - g_free(temp); - } - } - } - } else if (g_str_equal(command, "WINDOWSTATE")) - { - if (g_str_equal(string_parts[1], "HIDDEN")) - { - skype_send_message_nowait("SET SILENT_MODE ON"); - } - } else if (g_str_equal(command, "PROFILE")) - { - if (g_str_equal(string_parts[1], "FULLNAME")) - { - temp = g_strconcat(string_parts[2], " ", string_parts[3], NULL); - //this is the full name of the logged in user... useful for the account name - g_free(temp); - } - } else if (g_str_equal(command, "CURRENTUSERHANDLE")) - { - //the currently logged in username is at string_parts[1] - } else if (g_str_equal(command, "GROUPS")) - { - if (groups_table == NULL) - groups_table = g_hash_table_new(NULL, NULL); - chatusers = g_strsplit(strchr(message, ' ')+1, ", ", 0); - for(i = 0; chatusers[i]; i++) - { - skype_send_message_nowait("GET GROUP %s DISPLAYNAME", chatusers[i]); - skype_send_message_nowait("GET GROUP %s USERS", chatusers[i]); - } - g_strfreev(chatusers); - } else if (g_str_equal(command, "GROUP")) - { - if (groups_table == NULL) - groups_table = g_hash_table_new(NULL, NULL); - //TODO Handle Group stuff: - // Messages from skype to move users in to/out of a group - if (g_str_equal(string_parts[2], "DISPLAYNAME")) - { - temp_group = g_hash_table_lookup(groups_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (!temp_group) - { - temp_group = purple_find_group(string_parts[3]); - if (!temp_group) - { - temp_group = purple_group_new(string_parts[3]); - purple_blist_add_group(temp_group, NULL); - } - purple_blist_node_set_int(&temp_group->node, "skype_group_number", atoi(string_parts[1])); - g_hash_table_insert(groups_table, GINT_TO_POINTER(atoi(string_parts[1])), temp_group); - } - } else if (g_str_equal(string_parts[2], "USERS")) - { - temp_group = g_hash_table_lookup(groups_table, GINT_TO_POINTER(atoi(string_parts[1]))); - if (temp_group) - { - chatusers = g_strsplit(string_parts[3], ", ", -1); - for (i = 0; chatusers[i]; i++) - { - buddy = purple_find_buddy(this_account, chatusers[i]); - if (buddy && temp_group != purple_buddy_get_group(buddy)) - purple_blist_add_buddy(buddy, NULL, temp_group, NULL); - } - g_strfreev(chatusers); - } - } - } else if (g_str_equal(command, "APPLICATION") && - g_str_equal(string_parts[1], "libpurple_typing")) - { - if (g_str_equal(string_parts[2], "DATAGRAM")) - { - chatusers = g_strsplit_set(string_parts[3], ": ", 3); - sender = chatusers[0]; - temp = chatusers[2]; - if (sender != NULL && temp != NULL) - { - sender = g_strdup(sender); - temp = g_strdup(temp); - if (g_str_equal(temp, "PURPLE_NOT_TYPING")) - serv_got_typing(gc, sender, 10, PURPLE_NOT_TYPING); - else if (g_str_equal(temp, "PURPLE_TYPING")) - serv_got_typing(gc, sender, 10, PURPLE_TYPING); - else if (g_str_equal(temp, "PURPLE_TYPED")) - serv_got_typing(gc, sender, 10, PURPLE_TYPED); - g_free(sender); - g_free(temp); - } - g_strfreev(chatusers); - } else if (g_str_equal(string_parts[2], "STREAMS")) - { - chatusers = g_strsplit_set(string_parts[3], ": ", -1); - for(i=0; chatusers[i] && chatusers[i+1]; i+=2) - { - temp = g_strconcat("stream-", chatusers[i], NULL); - purple_account_set_string(this_account, temp, chatusers[i+1]); - g_free(temp); - } - g_strfreev(chatusers); - } -#ifdef USE_VV - } else if (g_str_equal(command, "CALL")) - { - if (g_str_equal(string_parts[2], "STATUS")) - { - if (g_str_equal(string_parts[3], "RINGING")) - { - skype_handle_incoming_call(gc, string_parts[1]); - } else if (g_str_equal(string_parts[3], "FINISHED") || - g_str_equal(string_parts[3], "CANCELLED") || - g_str_equal(string_parts[3], "FAILED")) - { - skype_handle_call_got_ended(string_parts[1]); - } - } -#else - } else if (g_str_equal(command, "CALL")) - { - if (g_str_equal(string_parts[2], "STATUS") && - g_str_equal(string_parts[3], "RINGING")) - { - temp = skype_send_message("GET CALL %s TYPE", string_parts[1]); - type = g_new0(gchar, 9); - sscanf(temp, "CALL %*s TYPE %[^_]", type); - g_free(temp); - temp = skype_send_message("GET CALL %s PARTNER_HANDLE", string_parts[1]); - sender = g_strdup(&temp[21+strlen(string_parts[1])]); - g_free(temp); - if (g_str_equal(type, "INCOMING")) - { - temp = g_strdup_printf(_("%s is calling you."), sender); - /*purple_request_action(gc, _("Incoming Call"), temp, //VOXOX - CJC - 2009.10.28 Remove request action because is making calls been default to accept, without skype ringing and user knowing about it - _("Do you want to accept their call?"), - 0, this_account, sender, NULL, g_strdup(string_parts[1]), 2, - _("_Accept"), G_CALLBACK(skype_call_accept_cb), - _("_Reject"), G_CALLBACK(skype_call_reject_cb), - _("_Ignore"), G_CALLBACK(skype_call_ignore_cb), - _("Send to _Voicemail"), G_CALLBACK(skype_call_voicemail_cb), - _("_Forward"), G_CALLBACK(skype_call_forward_cb));*/ - g_free(temp); - } - g_free(sender); - g_free(type); - } -#endif - } else if (g_str_equal(command, "SMS")) - { - skype_debug_info("skype", "SMS lookup table %x\n", sms_convo_link_table); - if (sms_convo_link_table != NULL) - { - temp = g_hash_table_lookup(sms_convo_link_table, string_parts[1]); - skype_debug_info("skype", "Found mobile %s from SMS number %s\n", temp?temp:"null", string_parts[1]); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, temp, this_account); - skype_debug_info("skype", "Found conv %d\n", conv); - if (conv) - { - if (g_str_equal(string_parts[2], "STATUS")) - { - temp = g_strconcat(_("Status: "), string_parts[3], NULL); - purple_conversation_write(conv, NULL, temp, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(temp); - } else if (g_str_equal(string_parts[2], "FAILUREREASON")) - { - temp = g_strconcat(_("Failure Reason: "), string_parts[3], NULL); - purple_conversation_write(conv, NULL, temp, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(temp); - skype_send_message_nowait("SET SMS %s SEEN", string_parts[1]); - } else if (g_str_equal(string_parts[2], "PRICE")) - { - if (atoi(string_parts[3]) > 0 && - purple_conversation_get_data(conv, "price_precision") && - purple_conversation_get_data(conv, "price_currency")) - { - int exponenet = 1; - double d; - for (i = atoi(purple_conversation_get_data(conv, "price_precision")); - i > 0; i--) - { - exponenet *= 10; - } - d = atof(string_parts[3]) / exponenet; - temp = g_strdup_printf("%s %s %f", _("Price: "), - (char*)purple_conversation_get_data(conv, "price_currency"), - d); - purple_conversation_write(conv, NULL, temp, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(temp); - } - } else if (g_str_equal(string_parts[2], "PRICE_PRECISION")) - { - purple_conversation_set_data(conv, "price_precision", g_strdup(string_parts[3])); - } else if (g_str_equal(string_parts[2], "PRICE_CURRENCY")) - { - purple_conversation_set_data(conv, "price_currency", g_strdup(string_parts[3])); - } - } - } - } - if (string_parts) - { - g_strfreev(string_parts); - } - if (message) - { - g_free(message); - } - return FALSE; -} - -void -skype_call_accept_cb(gchar *call) -{ - skype_send_message_nowait("ALTER CALL %s ANSWER", call); - skype_send_message_nowait("SET CALL %s SEEN", call); - g_free(call); -} - -void -skype_call_reject_cb(gchar *call) -{ - skype_send_message_nowait("ALTER CALL %s END HANGUP", call); - skype_send_message_nowait("SET CALL %s SEEN", call); - g_free(call); -} - -void -skype_call_ignore_cb(gchar *call) -{ - skype_send_message_nowait("SET CALL %s SEEN", call); - g_free(call); -} - -void -skype_call_voicemail_cb(gchar *call) -{ - skype_send_message_nowait("ALTER CALL %s END REDIRECT_TO_VOICEMAIL", call); - skype_send_message_nowait("SET CALL %s SEEN", call); - g_free(call); -} - -void -skype_call_forward_cb(gchar *call) -{ - skype_send_message_nowait("ALTER CALL %s END FORWARD_CALL", call); - skype_send_message_nowait("SET CALL %s SEEN", call); - g_free(call); -} - -void -skype_auth_allow(gpointer sender) -{ - skype_send_message("SET USER %s ISAUTHORIZED TRUE", sender); -} - -void -skype_auth_deny(gpointer sender) -{ - skype_send_message("SET USER %s ISAUTHORIZED FALSE", sender); -} - -gint -skype_find_filetransfer(PurpleXfer *transfer, char *skypeid) -{ - if (transfer == NULL || transfer->data == NULL || skypeid == NULL) - return -1; - return strcmp(transfer->data, skypeid); -} - -void -skype_accept_transfer(PurpleXfer *transfer) -{ - //can't accept transfers -} - -void -skype_decline_transfer(PurpleXfer *transfer) -{ - //can't reject transfers -} - -SkypeChat* -skype_find_chat(const gchar *chat_id, PurpleAccount *this_account) -{ - SkypeChat *chat; - int i; - - if (chat_id == NULL) - return NULL; - - if(chat_link_table == NULL) - { - chat_link_table = g_hash_table_new(g_str_hash, g_str_equal); - } - - chat = g_hash_table_lookup(chat_link_table, chat_id); - if (chat == NULL) - { - chat = g_new0(SkypeChat, 1); - chat->name = g_strdup(chat_id); - chat->account = this_account; - g_hash_table_insert(chat_link_table, (char*)chat_id, chat); - - skype_send_message_nowait("GET CHAT %s TYPE", chat_id); - skype_send_message_nowait("GET CHAT %s MEMBERS", chat_id); - skype_send_message_nowait("GET CHAT %s FRIENDLYNAME", chat_id); - skype_send_message_nowait("GET CHAT %s TOPIC", chat_id); - } - - chat->conv = NULL; - - if (chat->type) - { - if (chat->type == PURPLE_CONV_TYPE_CHAT) - { - chat->conv = purple_find_conversation_with_account(chat->type, chat_id, this_account); - if (!chat->conv) - { - chat->prpl_chat_id = g_str_hash(chat_id); - chat->conv = serv_got_joined_chat(this_account->gc, chat->prpl_chat_id, chat_id); - } - } else if (chat->type == PURPLE_CONV_TYPE_IM) - { - if (!chat->partner_handle && chat->members) - { - for (i=0; chat->members[i]; i++) - { - if (*chat->members[i] != '\0' && !g_str_equal(chat->members[i], skype_get_account_username(chat->account))) - { - chat->partner_handle = g_strdup(chat->members[i]); - break; - } - } - } - if (chat->partner_handle) - { - chat->conv = purple_find_conversation_with_account(chat->type, chat->partner_handle, chat->account); - if (!chat->conv) - chat->conv = purple_conversation_new(chat->type, chat->account, chat->partner_handle); - } - } - if (chat->conv) - purple_conversation_set_data(chat->conv, "chat_id", g_strdup(chat_id)); - } - - - return chat; -} - -gint -skype_find_chat_compare_func(PurpleConversation *conv, char *chat_id) -{ - char *lookup; - if (chat_id == NULL || conv == NULL || conv->data == NULL) - return -1; - lookup = purple_conversation_get_data(conv, "chat_id"); - if (lookup == NULL) - return -1; - return strcmp(lookup, chat_id); -} - -/* Since this function isn't public, and we need it to be, redefine it here */ -static void -purple_xfer_set_status(PurpleXfer *xfer, PurpleXferStatusType status) -{ - g_return_if_fail(xfer != NULL); - - if(xfer->type == PURPLE_XFER_SEND) { - switch(status) { - case PURPLE_XFER_STATUS_ACCEPTED: - purple_signal_emit(purple_xfers_get_handle(), "file-send-accept", xfer); - break; - case PURPLE_XFER_STATUS_STARTED: - purple_signal_emit(purple_xfers_get_handle(), "file-send-start", xfer); - break; - case PURPLE_XFER_STATUS_DONE: - purple_signal_emit(purple_xfers_get_handle(), "file-send-complete", xfer); - break; - case PURPLE_XFER_STATUS_CANCEL_LOCAL: - case PURPLE_XFER_STATUS_CANCEL_REMOTE: - purple_signal_emit(purple_xfers_get_handle(), "file-send-cancel", xfer); - break; - default: - break; - } - } else if(xfer->type == PURPLE_XFER_RECEIVE) { - switch(status) { - case PURPLE_XFER_STATUS_ACCEPTED: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-accept", xfer); - break; - case PURPLE_XFER_STATUS_STARTED: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-start", xfer); - break; - case PURPLE_XFER_STATUS_DONE: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-complete", xfer); - break; - case PURPLE_XFER_STATUS_CANCEL_LOCAL: - case PURPLE_XFER_STATUS_CANCEL_REMOTE: - purple_signal_emit(purple_xfers_get_handle(), "file-recv-cancel", xfer); - break; - default: - break; - } - } - - xfer->status = status; -} -gboolean -skype_sync_skype_close(PurpleConnection *gc) -{ - if (gc != NULL) - purple_connection_error(gc, _("\nSkype program closed")); - return FALSE; -} - - - - -gboolean -handle_complete_message(int messagenumber) -{ - SkypeMessage *skypemessage = NULL; - SkypeChat *chat = NULL; - gchar *body_html = NULL; - int i; - - if (messages_table == NULL) - return FALSE; - - skypemessage = g_hash_table_lookup(messages_table, GINT_TO_POINTER(messagenumber)); - if (skypemessage == NULL) - return FALSE; //Message no longer exists, must have delt with it already - - if (!skypemessage->chatname || !skypemessage->type || !skypemessage->account) - return FALSE; //Haven't finished filling in all the required details - - chat = skype_find_chat(skypemessage->chatname, skypemessage->account); - if (!chat->type) - { - skype_debug_info("skype", "Chat %s has no type\n", skypemessage->chatname); - //dont know where to put this message - skype_send_message_nowait("GET CHAT %s TYPE", skypemessage->chatname); - chat->type_request_count++; - //Only try a maximum of 100 times to prevent an infinite loop (in case the chat name is unknown) - if (chat->type_request_count < 100) - { - //just wait for a second for the chat to be updated - purple_timeout_add_seconds(1, (GSourceFunc)handle_complete_message, GINT_TO_POINTER(messagenumber)); - } - return FALSE; - } - - switch(skypemessage->type) - { - case SKYPE_MESSAGE_OTHER: - return FALSE; - case SKYPE_MESSAGE_EMOTE: - if (!skypemessage->body) - return FALSE; - body_html = g_strdup_printf("/me %s", skypemessage->body); - g_free(skypemessage->body); - skypemessage->body = body_html; - skypemessage->type = SKYPE_MESSAGE_TEXT; - //fallthrough intentional - case SKYPE_MESSAGE_TEXT: - if (!skypemessage->body || !skypemessage->from_handle || !skypemessage->timestamp) - return FALSE; - body_html = skype_strdup_withhtml(skypemessage->body); - if (chat->type == PURPLE_CONV_TYPE_CHAT) - { - if (skypemessage->flags != PURPLE_MESSAGE_SEND) - { - if (chat->prpl_chat_id) - i = chat->prpl_chat_id; - else - i = g_str_hash(chat->name); - serv_got_chat_in(skypemessage->account->gc, i, skypemessage->from_handle, skypemessage->flags, body_html, skypemessage->timestamp); - } - } else if (chat->type == PURPLE_CONV_TYPE_IM) - { - if (skypemessage->flags != PURPLE_MESSAGE_SEND) - { - PurpleAccount *acct = skypemessage->account; - if (!g_str_equal(skypemessage->from_handle, skype_get_account_username(acct))) - { - serv_got_im(acct->gc, skypemessage->from_handle, body_html, skypemessage->flags, skypemessage->timestamp); - } else if (chat->partner_handle) - { - //if we're here, then we're receiving a message that we sent from a different computer - serv_got_im(acct->gc, chat->partner_handle, body_html, PURPLE_MESSAGE_SEND, skypemessage->timestamp); - } else { - //use the chat name to work out who it came from - //in format #username1/$username2;junktext for IM's - char *start, *end; - start = strchr(skypemessage->chatname, '#'); - if (start) - { - start += 1; - end = strchr(start, '/'); - if (end) - { - start = g_strndup(start, end-start); - if (!g_str_equal(skype_get_account_username(acct), start)) - { - serv_got_im(acct->gc, start, body_html, PURPLE_MESSAGE_SEND, skypemessage->timestamp); - g_free(start); - start = (char *) 1; - } - else - { - g_free(start); - start = NULL; - } - } else { - start = NULL; - } - } - if (!start) - { - start = strchr(skypemessage->chatname, '$'); - if (start) - { - start += 1; - end = strchr(start, ';'); - if (end) - { - start = g_strndup(start, end-start); - if (!g_str_equal(skype_get_account_username(acct), start)) - { - serv_got_im(acct->gc, start, body_html, PURPLE_MESSAGE_SEND, skypemessage->timestamp); - g_free(start); - } - } - } - } - } - } - } - break; - case SKYPE_MESSAGE_LEFT: - if (!skypemessage->from_handle || !skypemessage->leavereason) - return FALSE; - if (chat->conv && chat->type == PURPLE_CONV_TYPE_CHAT) - { - if (g_str_equal(skypemessage->from_handle, skype_get_account_username(skypemessage->account))) - purple_conv_chat_left(PURPLE_CONV_CHAT(chat->conv)); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), skypemessage->from_handle, skypemessage->leavereason); - } - break; - case SKYPE_MESSAGE_ADD: - if (!skypemessage->users) - return FALSE; - if (chat->conv && chat->type == PURPLE_CONV_TYPE_CHAT) - { - for (i=0; skypemessage->users[i]; i++) - if (!purple_conv_chat_find_user(PURPLE_CONV_CHAT(chat->conv), skypemessage->users[i])) - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), skypemessage->users[i], NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - break; - case SKYPE_MESSAGE_KICKED: - if (!skypemessage->users) - return FALSE; - if (chat->conv && chat->type == PURPLE_CONV_TYPE_CHAT) - { - for (i=0; skypemessage->users[i]; i++) - { - if (skypemessage->from_handle) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), skypemessage->users[i], g_strdup_printf("Kicked by %s", skypemessage->from_handle)); - else - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), skypemessage->users[i], g_strdup("Kicked")); - } - } - break; - case SKYPE_MESSAGE_TOPIC: - if (!skypemessage->body || !skypemessage->from_handle) - return FALSE; - if (chat->conv && chat->type == PURPLE_CONV_TYPE_CHAT) - { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(chat->conv), skypemessage->from_handle, skypemessage->body); - serv_got_chat_in(skypemessage->account->gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat->conv)), skypemessage->from_handle, PURPLE_MESSAGE_SYSTEM, skype_strdup_withhtml(g_strdup_printf(_("%s has changed the topic to: %s"), skypemessage->from_handle, skypemessage->body)), time(NULL)); - purple_conversation_update(chat->conv, PURPLE_CONV_UPDATE_TOPIC); - } - break; - } - - if (skypemessage->flags == PURPLE_MESSAGE_RECV) - skype_send_message_nowait("SET CHATMESSAGE %d SEEN", messagenumber); - if (g_hash_table_remove(messages_table, GINT_TO_POINTER(messagenumber))) - { - //free the message here - skypemessage->type = 0; - skypemessage->timestamp = 0; - if (skypemessage->chatname) - { - g_free(skypemessage->chatname); - skypemessage->chatname = NULL; - } - if (skypemessage->body) - { - g_free(skypemessage->body); - skypemessage->body = NULL; - } - if (skypemessage->from_handle) - { - g_free(skypemessage->from_handle); - skypemessage->from_handle = NULL; - } - if (skypemessage->users) - { - g_strfreev(skypemessage->users); - skypemessage->users = NULL; - } - if (skypemessage->leavereason) - { - g_free(skypemessage->leavereason); - skypemessage->leavereason = NULL; - } - - g_free(skypemessage); - } - - //can be used in eventloop - return FALSE; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include - -#include "skype_events.c" - -static gboolean skype_handle_received_message(char *message); - -static void skype_message_received(char *message); -static gboolean skype_connect(); -static void skype_disconnect(); -static void send_message(char* message); -static void hide_skype(); -static gboolean exec_skype(); - -gpointer send_messages_thread_func(gpointer data); -void skype_send_message_nowait(char *message, ...); -char *skype_send_message(char *message, ...); - -// Sort through the mess of different OS's to get the right proto - -#ifndef SKYPENET -# ifdef _WIN32 -# include "skype_messaging_win32.c" -# else /*if !win32 */ -# ifdef __APPLE__ -# include "skype_messaging_carbon.c" -# else /*if !apple */ -# ifndef SKYPE_DBUS -# include "skype_messaging_x11.c" -# else -# include "skype_messaging_dbus.c" -# endif /* !x11 */ -# endif /* !apple */ -# endif /* win32 */ -#else /* skypenet */ -# include "skype_messaging_network.c" -#endif - - -/*typedef struct { - gpointer sender; - gpointer body; - int time; - gpointer chatname; -} SkypeMessage;*/ - -static GHashTable *message_queue = NULL; -static GStaticMutex mutex = G_STATIC_MUTEX_INIT; -static GCond *condition = NULL; - -#ifdef _WIN32 -//these two #defines override g_static_mutex_lock and -// g_static_mutex_unlock so as to remove "strict-aliasing" -// compiler warnings -#define g_static_mutex_get_mutex2(mutex) \ - g_static_mutex_get_mutex ((GMutex **)(void*)mutex) -#define g_static_mutex_lock2(mutex) \ - g_mutex_lock (g_static_mutex_get_mutex2 (mutex)) -#define g_static_mutex_unlock2(mutex) \ - g_mutex_unlock (g_static_mutex_get_mutex2 (mutex)) -#else -#define g_static_mutex_get_mutex2 g_static_mutex_get_mutex -#define g_static_mutex_lock2 g_static_mutex_lock -#define g_static_mutex_unlock2 g_static_mutex_unlock -#endif - -static void -skype_message_received(char *orig_message) -{ - guint request_number; - guint *key; - int string_pos; - char *message; - - if (strlen(orig_message) == 0) - return; - - message = g_strdup(orig_message); - g_free(orig_message); - - skype_debug_info("skype", "Received: %s\n", message); - - if(message[0] == '#') - { - //It's a reply from a call we've made - update the hash table - sscanf(message, "#%u %n", &request_number, &string_pos); - key = g_new(guint, 1); - *key = request_number; - - g_static_mutex_lock2(&mutex); - g_hash_table_insert(message_queue, key, g_strdup(&message[string_pos])); - g_cond_broadcast(condition); - g_static_mutex_unlock2(&mutex); - - g_free(message); - } else { - purple_timeout_add(1, (GSourceFunc)skype_handle_received_message, (gpointer)message); - } -} - -static GThread *send_messages_thread = NULL; -static gboolean send_thread_state = FALSE; -static GAsyncQueue *send_messages_queue = NULL; - -gpointer -send_messages_thread_func(gpointer data) -{ - gchar *message; - - send_thread_state = TRUE; - while (send_thread_state) - { - //read from async queue - message = g_async_queue_pop(send_messages_queue); - //send the message - send_message(message); - } - g_async_queue_unref(send_messages_queue); - - return NULL; -} - -void -skype_send_message_nowait(char *message_format, ...) -{ - va_list args; - char* message; - - va_start(args, message_format); - message = g_strdup_vprintf(message_format, args); - va_end(args); - - skype_debug_info("skype", "Sending: '%s'\n", message); - - if (send_messages_queue == NULL) - send_messages_queue = g_async_queue_new(); - - if (send_messages_thread == NULL) - { - send_messages_thread = g_thread_create(send_messages_thread_func, NULL, FALSE, NULL); - } - - g_async_queue_push(send_messages_queue, message); - -} - -char *skype_send_message(char *message_format, ...) -{ - static guint next_message_num = 0; - guint cur_message_num; - char *message; - char *return_msg; - va_list args; -#ifdef __APPLE__ - guint timeout = 0; -#else -#ifdef _WIN32 - guint timeout = 0; -#else - gboolean condition_result; - GTimeVal endtime = {0,0}; -#endif -#endif - - va_start(args, message_format); - message = g_strdup_vprintf(message_format, args); - va_end(args); - - if (!message_queue) - message_queue = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL); - - g_static_mutex_lock2(&mutex); - if (!condition) - condition = g_cond_new(); - cur_message_num = next_message_num++; - if (next_message_num == G_MAXUINT) - next_message_num = 0; - g_static_mutex_unlock2(&mutex); - - //Send message asynchronously - skype_send_message_nowait("#%u %s", cur_message_num, message); - g_free(message); - - g_static_mutex_lock2(&mutex); - //Wait for a response - while(g_hash_table_lookup(message_queue, &cur_message_num) == NULL) - { - g_static_mutex_unlock2(&mutex); - g_thread_yield(); - -#ifdef __APPLE__ - RunCurrentEventLoop(0); - usleep(1000); - g_static_mutex_lock2(&mutex); - - if (timeout++ == 10000) -#else -#ifdef _WIN32 - Sleep(1); - g_static_mutex_lock2(&mutex); - - if (timeout++ == 10000) -#else - - //wait for message for a maximum of 10 seconds - g_get_current_time(&endtime); - g_time_val_add(&endtime, 10 * G_USEC_PER_SEC); - condition_result = g_cond_timed_wait(condition, g_static_mutex_get_mutex2(&mutex), &endtime); - - //g_cond_timed_wait already locks this mutex - //g_static_mutex_lock2(&mutex); - - if(!condition_result) -#endif -#endif - { - //we timed out while waiting - g_hash_table_remove(message_queue, &cur_message_num); - g_static_mutex_unlock2(&mutex); - return g_strdup(""); - } - } - return_msg = (char *)g_hash_table_lookup(message_queue, &cur_message_num); - g_hash_table_remove(message_queue, &cur_message_num); - g_static_mutex_unlock2(&mutex); - - if (strncmp(return_msg, "ERROR", 5) == 0) - { - g_free(return_msg); - return g_strdup(""); - } - return return_msg; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon2.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon2.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon2.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon2.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,420 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - - -#include -#include - - -typedef struct SkypeDelegate -{ - // Required member - CFStringRef clientApplicationName; - - // Optional members, can be NULL - void (*SkypeNotificationReceived)(CFStringRef aNotificationString); - void (*SkypeAttachResponse)(unsigned int aAttachResponseCode); // 0 - failed, 1 - success - void (*SkypeBecameAvailable)(CFPropertyListRef aNotification); - void (*SkypeBecameUnavailable)(CFPropertyListRef aNotification); -} SkypeDelegate; - -static SkypeDelegate *delegate = NULL; -static int isavailable = 0; -static int client_id = 0; - -char * -CFStringToCString(CFStringRef input) -{ - if (input == NULL) - return NULL; - int strlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(input), kCFStringEncodingUTF8); - char *output = NewPtr(strlen+1); - CFStringGetCString(input, output, strlen+1, kCFStringEncodingUTF8); - return output; -} - -int -CFNumberToCInt(CFNumberRef input) -{ - if (input == NULL) - return 0; - int output; - CFNumberGetValue(input, kCFNumberIntType, &output); - return output; -} - -void -availabilityUpdateCallback( - CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - CFNumberRef number = (CFNumberRef)CFDictionaryGetValue(userInfo, CFSTR("SKYPE_API_AVAILABILITY")); - isavailable = CFNumberToCInt(number); -} - -void -debugCallback( - CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - int i = 0; - - printf("Debug callback: %s\n", CFStringToCString(name)); - if (!userInfo) - return; - - CFIndex count = CFDictionaryGetCount(userInfo); - const void *keys[count]; - const void *values[count]; - CFDictionaryGetKeysAndValues(userInfo, keys, values); - for(i = 0; i < count; i++) - { - printf("For i=%d, key: %s\n", i, - CFStringToCString((CFStringRef)keys[i])); - } -} - - -void -apiNotificationCallback( - CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - CFNumberRef number = (CFNumberRef) CFDictionaryGetValue(userInfo, CFSTR("SKYPE_API_CLIENT_ID")); - int client_number = CFNumberToCInt(number); - if (client_number != 999 && (!client_id || client_id != client_number)) - { - return; - } - CFStringRef string = (CFStringRef) CFDictionaryGetValue(userInfo, CFSTR("SKYPE_API_NOTIFICATION_STRING")); - if (string && delegate && delegate->SkypeNotificationReceived) - { - delegate->SkypeNotificationReceived(string); - } -} - - -void -attachResponseCallback( - CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - CFNumberRef responseNumber = (CFNumberRef)CFDictionaryGetValue(userInfo, CFSTR("SKYPE_API_ATTACH_RESPONSE")); - int response = CFNumberToCInt(responseNumber); - client_id = response; - if (delegate && delegate->SkypeAttachResponse) - { - delegate->SkypeAttachResponse(response?1:0); - } -} - - -void -skypeQuitCallback( - CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - if (delegate && delegate->SkypeBecameAvailable) - delegate->SkypeBecameUnavailable(NULL); -} - - -void -skypeAvailableCallback( - CFNotificationCenterRef center, - void *observer, - CFStringRef name, - const void *object, - CFDictionaryRef userInfo) -{ - if (delegate && delegate->SkypeBecameAvailable) - delegate->SkypeBecameAvailable(NULL); -} - - -// STANDARD SKYPE.H BITS: -void RemoveSkypeDelegate(void); - -void -SetSkypeDelegate(SkypeDelegate *aDelegate) -{ - if (!aDelegate->clientApplicationName) - { - printf("Deletegate requires application name\n"); - delegate = NULL; - return; - } - - if (delegate) - { - RemoveSkypeDelegate(); - } - - delegate = aDelegate; - - CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - - CFNotificationCenterAddObserver( - center, - delegate->clientApplicationName, - apiNotificationCallback, - CFSTR("SKSkypeAPINotification"), - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); - - CFNotificationCenterAddObserver( - center, - delegate->clientApplicationName, - skypeQuitCallback, - CFSTR("SKSkypeWillQuit"), - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); - - CFNotificationCenterAddObserver( - center, - delegate->clientApplicationName, - skypeAvailableCallback, - CFSTR("SKSkypeBecameAvailable"), - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); - - CFNotificationCenterAddObserver( - center, - delegate->clientApplicationName, - availabilityUpdateCallback, - CFSTR("SKAvailabilityUpdate"), - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); - - CFNotificationCenterAddObserver( - center, - delegate->clientApplicationName, - attachResponseCallback, - CFSTR("SKSkypeAttachResponse"), - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); -} - -SkypeDelegate * -GetSkypeDelegate(void) -{ - return delegate; -} - -void -RemoveSkypeDelegate(void) -{ - if (delegate && delegate->clientApplicationName) - { - CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - - CFNotificationCenterRemoveObserver( - center, - delegate->clientApplicationName, - CFSTR("SKSkypeAPINotification"), - NULL); - - CFNotificationCenterRemoveObserver( - center, - delegate->clientApplicationName, - CFSTR("SKSkypeWillQuit"), - NULL); - - CFNotificationCenterRemoveObserver( - center, - delegate->clientApplicationName, - CFSTR("SKSkypeBecameAvailable"), - NULL); - - CFNotificationCenterRemoveObserver( - center, - delegate->clientApplicationName, - CFSTR("SKAvailabilityUpdate"), - NULL); - - CFNotificationCenterRemoveObserver( - center, - delegate->clientApplicationName, - CFSTR("SKSkypeAttachResponse"), - NULL); - } - delegate = NULL; -} - -int -IsSkypeAvailable(void) -{ - //is skype available? - isavailable = 0; - CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - - CFNotificationCenterPostNotification( - center, - CFSTR("SKSkypeAPIAvailabilityRequest"), - NULL, - NULL, - TRUE); - - //Should only take 1 second or less to reply - RunCurrentEventLoop(1); - int avail = isavailable; - isavailable = 0; - return avail; -} - -int -IsSkypeRunning(void) -{ - OSStatus status = noErr; - ProcessSerialNumber psn = {kNoProcess, kNoProcess}; - unsigned int procNameLength = 32; - unsigned char procName[procNameLength]; - unsigned int i = 0; - ProcessInfoRec info; - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = procName; - info.processAppSpec = NULL; - pid_t pid = 0; - - while(status == noErr) - { - for(i = 0; i < procNameLength; i++) - procName[i] = '\0'; - - status = GetNextProcess(&psn); - if (status == noErr) - { - if (GetProcessInformation(&psn, &info) == noErr) - { - //for some reason first character is poisioned - if (g_str_equal((char *)&procName[1], "Skype")) - { - if (GetProcessPID(&psn, &pid) == noErr) - { - return (int)pid; - } - } - } - } - } - return 0; -} - -void -ConnectToSkype(void) -{ - if (!delegate || !delegate->clientApplicationName) - { - printf("Error: Delegate not set\n"); - return; - } - - if (!IsSkypeAvailable()) - { - printf("Error: Skype not available\n"); - } - - CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - - //do the connect - CFNotificationCenterPostNotification( - center, - CFSTR("SKSkypeAPIAttachRequest"), - delegate->clientApplicationName, - NULL, - TRUE); -} - -void SendSkypeCommand(CFStringRef command) -{ - if (delegate == NULL) - { - printf("Can't send message, no delegate set\n"); - return; - } - if (command == NULL) - return; - if (!client_id) - { - printf("Can't send message, not connected\n"); - return; - } - - CFRetain(command); - - CFNumberRef id_number = CFNumberCreate(NULL, kCFNumberIntType, &client_id); - CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - const void *keys[] = {(void *)CFSTR("SKYPE_API_COMMAND"), (void *)CFSTR("SKYPE_API_CLIENT_ID")}; - const void *values[] = {command, id_number}; - CFDictionaryRef userInfo = CFDictionaryCreate(NULL, keys, values, 2, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - - //send message - CFNotificationCenterPostNotification( - center, - CFSTR("SKSkypeAPICommand"), - NULL, - userInfo, - FALSE); - - CFRelease(command); - CFRelease(id_number); - CFRelease(userInfo); -} - -void DisconnectFromSkype(void) -{ - CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); - - if (client_id) - { - CFNumberRef id_number = CFNumberCreate(NULL, kCFNumberIntType, &client_id); - const void *keys[] = {(void *)CFSTR("SKYPE_API_CLIENT_ID")}; - const void *values[] = {id_number}; - CFDictionaryRef userInfo = CFDictionaryCreate(NULL, keys, values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - - //disconnect - CFNotificationCenterPostNotification( - center, - CFSTR("SKSkypeAPIDetachRequest"), - NULL, - userInfo, - FALSE); - - client_id = 0; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_carbon.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,255 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -//#include -#include -#include - -//change this to 0 if using an old version of the Skype.framework -#define SENDSKYPERETURNS 0 - -#include "skype_messaging_carbon2.c" - -static gboolean connected_to_skype = FALSE; - - -static void allow_app_in_skype_api(void); - -void -SkypeNotificationReceived(CFStringRef input) -{ - char *output = NULL; - GError *error = NULL; - int strlen = CFStringGetMaximumSizeForEncoding(CFStringGetLength(input), kCFStringEncodingUTF8); - - output = (char *)CFStringGetCStringPtr(input, kCFStringEncodingUTF8); - if (!output) - { - output = NewPtr(strlen+1); - CFStringGetCString(input, output, strlen+1, kCFStringEncodingUTF8); - } - //printf("Message received %s\n", output); - skype_message_received(output); - if (error) - { - skype_debug_error("skype_osx", "Could not create new thread!!! %s\n", error->message); - g_error_free(error); - } -} - -void -SkypeAttachResponse(unsigned int aAttachResponseCode) -{ - if (aAttachResponseCode) - { - skype_debug_info("skype_osx", "Skype attached successfully :)\n"); - connected_to_skype = TRUE; - } - else - { - skype_debug_info("skype_osx", "Skype couldn't connect :(\n"); - connected_to_skype = FALSE; - } -} - -void -SkypeBecameAvailable(CFPropertyListRef aNotification) -{ - skype_debug_info("skype_osx", "Skype became available\n"); - //connected_to_skype = TRUE; - allow_app_in_skype_api(); -} - -void -SkypeBecameUnavailable(CFPropertyListRef aNotification) -{ - skype_debug_info("skype_osx", "Skype became unavailable\n"); - connected_to_skype = FALSE; - g_thread_create((GThreadFunc)skype_message_received, g_strdup("CONNSTATUS LOGGEDOUT"), FALSE, NULL); -} - -static struct SkypeDelegate skypeDelegate = { - CFSTR("VoxOx"), /* clientAppName */ - SkypeNotificationReceived, - SkypeAttachResponse, - SkypeBecameAvailable, - SkypeBecameUnavailable -}; - -static gboolean -skype_connect() -{ - gboolean is_skype_running = FALSE; - int timeout_count = 0; - - is_skype_running = IsSkypeRunning(); - - skype_debug_info("skype_osx", "Is Skype running? '%s'\n", (is_skype_running?"Yes":"No")); - if (!is_skype_running) - return FALSE; - - if (connected_to_skype) - skype_disconnect(); - - SetSkypeDelegate(&skypeDelegate); - RunCurrentEventLoop(1); - ConnectToSkype(); - - while(connected_to_skype == FALSE) - { - RunCurrentEventLoop(1); - allow_app_in_skype_api(); - if (timeout_count++ == 8) - return FALSE; - } - skype_debug_info("skype_osx", "Connected to skype\n"); - return TRUE; -} - -static void -skype_disconnect() -{ - connected_to_skype = FALSE; - DisconnectFromSkype(); - RemoveSkypeDelegate(); - RunCurrentEventLoop(1); -} - -static void -send_message(char* message) -{ - if (!connected_to_skype) - { - if (message[0] == '#') - { - int message_num; - //And we're expecting a response - sscanf(message, "#%d ", &message_num); - char *error_return = g_strdup_printf("#%d ERROR Carbon", message_num); - g_thread_create((GThreadFunc)skype_message_received, (void *)error_return, FALSE, NULL); - } - return; - } - - CFStringRef messageString = CFStringCreateWithCString(NULL, message, kCFStringEncodingUTF8); -#if SENDSKYPERETURNS - CFStringRef returnString = NULL; - returnString = SendSkypeCommand(messageString); - if (returnString) - SkypeNotificationReceived(returnString); -#else - SendSkypeCommand(messageString); -#endif - //printf("Skype send message %s\n", message); - CFRelease(messageString); -} - -static void -hide_skype() -{ - OSStatus status = noErr; - ProcessSerialNumber psn = {kNoProcess, kNoProcess}; - unsigned int procNameLength = 32; - unsigned char procName[procNameLength]; - unsigned int i = 0; - ProcessInfoRec info; - info.processInfoLength = sizeof(ProcessInfoRec); - info.processName = procName; - info.processAppSpec = NULL; - - while(status == noErr) - { - for(i = 0; i < procNameLength; i++) - procName[i] = '\0'; - - status = GetNextProcess(&psn); - if (status == noErr) - if (GetProcessInformation(&psn, &info) == noErr) - //for some reason first character is poisioned - if (g_str_equal((char *)&procName[1], "Skype")) - { - ShowHideProcess(&psn, FALSE); - return; - } - } -} - -static gboolean -exec_skype() -{ - gboolean success; - - success = g_spawn_command_line_async("/Applications/Skype.app/Contents/MacOS/Skype", NULL); - - return success; -} - -static gboolean -is_skype_running() -{ - return IsSkypeRunning(); -} - -static void -allow_app_in_skype_api() -{ - static const char *script_string = "tell application \"System Events\" to tell process \"Skype\"\n" - "set numWindows to count of windows\n" - "repeat with w from 1 to numWindows\n" - "if (name of window w contains \"Skype\" and name of window w contains \"API\")\n" - "tell window w\n" - "click radio button 1 of radio group 1\n" - "delay 0.1\n" - "click button 4\n" - "end tell\n" - "exit repeat\n" - "end if\n" - "end repeat\n" - "end tell"; - AEDesc script_data; - OSAID script_id = kOSANullScript; - OSAError err; - FILE *access_file = NULL; - - skype_debug_info("skype_osx", "Enabling universal access\n"); - access_file = fopen("/private/var/db/.AccessibilityAPIEnabled", "w"); - if (access_file != NULL) - { - fwrite("a\n", 1, 2, access_file); - fclose(access_file); - } - - ComponentInstance script = OpenDefaultComponent(kOSAComponentType, typeAppleScript); - AECreateDesc(typeChar, script_string, strlen(script_string), &script_data); - OSACompile(script, &script_data, kOSAModeNull, &script_id); - skype_debug_info("skype_osx", "Trying to run AppleScript code\n"); - err = OSAExecute(script, script_id, kOSANullScript, kOSAModeNull, &script_id); - if (err == -1753) - { - skype_debug_error("skype_osx", "Error: 'Access assistive devices' isn't enabled\n" - "see http://images.apple.com/applescript/uiscripting/gfx/gui.03.jpg for details.\n"); - } else { - skype_debug_info("skype_osx", "Error number %d\n", err); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_dbus.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_dbus.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_dbus.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_dbus.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#define DBUS_API_SUBJECT_TO_CHANGE -#include - -#define SKYPE_DBUS_BUS DBUS_BUS_SESSION - -static DBusGConnection *connection = NULL; -static DBusGProxy *proxy = NULL; - -static DBusHandlerResult -skype_notify_handler(DBusConnection *connection, DBusMessage *message, gpointer user_data) -{ - DBusMessageIter iterator; - gchar *message_temp; - DBusMessage *temp_message; - - temp_message = dbus_message_ref(message); - dbus_message_iter_init(temp_message, &iterator); - if (dbus_message_iter_get_arg_type(&iterator) != DBUS_TYPE_STRING) - { - return FALSE; - } - - do - { - dbus_message_iter_get_basic(&iterator, &message_temp); - skype_message_received(g_strdup(message_temp)); - } while(dbus_message_iter_has_next(&iterator) && dbus_message_iter_next(&iterator)); - - dbus_message_unref(message); - - return DBUS_HANDLER_RESULT_HANDLED; -} - -static gboolean -skype_connect() -{ - GError *error = NULL; - DBusObjectPathVTable vtable; - - //Initialise threading - dbus_threads_init_default(); - - if (connection == NULL) - { - connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); - if (connection == NULL && error != NULL) - { - skype_debug_info("skype_dbus", "Error: %s\n", error->message); - g_error_free(error); - return FALSE; - } - } - - if (proxy == NULL) - { - proxy = dbus_g_proxy_new_for_name (connection, - "com.Skype.API", - "/com/Skype", - "com.Skype.API"); - if (proxy == NULL) - return FALSE; - - vtable.message_function = &skype_notify_handler; - dbus_connection_register_object_path(dbus_g_connection_get_connection(connection), "/com/Skype/Client", &vtable, NULL); - } - - return TRUE; -} - -static void -skype_disconnect() -{ - /*if (connection != NULL) - g_free(connection); - if (proxy != NULL) - g_free(proxy); - if (proxy_receive != NULL) - g_free(proxy_receive);*/ -} - -static void -send_message(char* message) -{ - GError *error = NULL; - gchar *str = NULL; - int message_num; - gchar error_return[30]; - - if (!dbus_g_proxy_call (proxy, "Invoke", &error, G_TYPE_STRING, message, G_TYPE_INVALID, - G_TYPE_STRING, &str, G_TYPE_INVALID)) - { - if (error && error->message) - { - skype_debug_info("skype_dbus", "Error sending message: %s\n", error->message); - if (message[0] == '#') - { - //We're expecting a response - sscanf(message, "#%d ", &message_num); - sprintf(error_return, "#%d ERROR", message_num); - skype_message_received(g_strdup(error_return)); - } - } - else - skype_debug_info("skype_dbus", "no response\n"); - } - if (str != NULL) - { - skype_message_received(str); - } - - g_free(message); -} - -static gboolean -is_skype_running() -{ - const gchar *temp; - int pid; - gchar* stat_path; - FILE *fh; - gchar exec_name[15]; - struct stat *statobj = g_new(struct stat, 1); - //open /proc - GDir *procdir = g_dir_open("/proc", 0, NULL); - //go through directories that are numbers - while((temp = g_dir_read_name(procdir))) - { - pid = atoi(temp); - if (!pid) - continue; - // /proc/{pid}/stat contains lots of juicy info - stat_path = g_strdup_printf("/proc/%d/stat", pid); - fh = fopen(stat_path, "r"); - pid = fscanf(fh, "%*d (%15[^)]", exec_name); - fclose(fh); - if (!g_str_equal(exec_name, "skype")) - { - g_free(stat_path); - continue; - } - //get uid/owner of stat file by using fstat() - g_stat(stat_path, statobj); - g_free(stat_path); - //compare uid/owner of stat file (in g_stat->st_uid) to getuid(); - if (statobj->st_uid == getuid()) - { - //this copy of skype was started by us - g_dir_close(procdir); - g_free(statobj); - return TRUE; - } - } - g_dir_close(procdir); - g_free(statobj); - return FALSE; -} - -static void -hide_skype() -{ - -} - -static gboolean -exec_skype() -{ - GError *error; - if (g_spawn_command_line_async("skype --enable-dbus --use-session-dbus", &error)) - { - return TRUE; - } else { - skype_debug_error("skype", "Could not start skype: %s\n", error->message); - return FALSE; - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_network.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_network.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_network.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_network.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -//#include - -#ifdef _WIN32 -#define fsync(fd) _commit(fd) -#endif - -static guint input_timeout; -static gint source_sock = -1; -static gboolean connected = FALSE; -static gboolean in_progress = FALSE; -static gchar etb_string[2] = {23, 0}; - - -void -read_function_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - int len; - gchar response[3096]; - static GString *response_string = NULL; - gchar *reply; - gchar **reply_pieces; - int i; - - len = read(source, response, sizeof(response)-1); - if (len < 0) - { - if (errno != EAGAIN && errno != EWOULDBLOCK) - { - skype_disconnect(); - } - return; - } - - if (len == sizeof(response)-1) - { - if (response_string == NULL) - response_string = g_string_new_len(response, len); - else - response_string = g_string_append_len(response_string, response, len); - } - else - { - if (response_string) - { - if (len > 0) - response_string = g_string_append_len(response_string, response, len); - reply = g_string_free(response_string, FALSE); - response_string = NULL; - } - else if (len) - reply = g_strndup(response, len); - else - return; - reply = g_strstrip(reply); - reply_pieces = g_strsplit(reply, etb_string, -1); - g_free(reply); - for (i=0; reply_pieces[i+1]; i++) - { - reply = reply_pieces[i]; - if (g_str_equal(reply, "LOGIN")) - { - connected = TRUE; - in_progress = FALSE; - skype_debug_info("skype", "Received: LOGIN\n"); - } else { - g_thread_create((GThreadFunc)skype_message_received, g_strdup(reply), FALSE, NULL); - } - } - //check that we received part of a message - if (strlen(reply_pieces[i])) - { - skype_debug_info("skype", "Last piece: '%s'\n", reply_pieces[i]); - response_string = g_string_new(reply_pieces[i]); - } - g_strfreev(reply_pieces); - } -} - -gpointer -skype_read_thread(gpointer data) -{ - while(connected || in_progress) - { - read_function_cb(data, source_sock, PURPLE_INPUT_READ); - g_thread_yield(); - sleep(1); - } - return data; -} - -void -connect_function(gpointer data, gint source, const gchar *error_message) -{ - gchar *loginmsg; - PurpleAccount *acct = skype_get_account(NULL); - - if (error_message) - { - in_progress = FALSE; - g_thread_create((GThreadFunc)skype_message_received, g_strdup("CONNSTATUS LOGGEDOUT"), FALSE, NULL); - return; - } - source_sock = source; - - loginmsg = g_strdup_printf("LOGIN %s %s", acct->username, acct->password); - send_message(loginmsg); - skype_debug_info("skype", "Sending: 'LOGIN {username} {password}'\n"); - //send_message frees this - //g_free(loginmsg); - - g_thread_create((GThreadFunc)skype_read_thread, NULL, FALSE, NULL); -} - -static gboolean -skype_connect() -{ - return connected; -} - -static void -skype_disconnect() -{ - if (!connected) - return; - - send_message(g_strdup("QUIT")); - - connected = FALSE; - close(source_sock); - source_sock = -1; - purple_input_remove(input_timeout); - in_progress = FALSE; -} - -static void -send_message(char* message) -{ - int message_num; - char *error_return; - char *temp; - int msglen = -1; - int len = 0; - - if (message) - { - msglen = strlen(message) + 1; - temp = g_strdup_printf("%s%c", message, 23); - len = write(source_sock, temp, msglen); - fsync(source_sock); - g_free(temp); - } - - if (len != msglen) - { - //There was an error - if (message[0] == '#') - { - //And we're expecting a response - sscanf(message, "#%d ", &message_num); - error_return = g_strdup_printf("#%d ERROR NETWORK", message_num); - g_thread_create((GThreadFunc)skype_message_received, (void *)error_return, FALSE, NULL); - } - } - - g_free(message); -} - -static void -hide_skype() -{ - //don't need to since SILENT_MODE ON works - return; -} - -gboolean -connection_timeout(gpointer data) -{ - in_progress = FALSE; - return FALSE; -} - -static gboolean -exec_skype() -{ - if (!connected && !in_progress) - { - in_progress = TRUE; - PurpleAccount *acct = skype_get_account(NULL); - purple_proxy_connect(acct->gc, acct, purple_account_get_string(acct, "host", "skype.robbmob.com"), purple_account_get_int(acct, "port", 5000), connect_function, acct); - g_thread_create((GThreadFunc)skype_read_thread, acct, FALSE, NULL); - purple_timeout_add_seconds(10, connection_timeout, acct); - } - return TRUE; -} - -static gboolean -is_skype_running() -{ - return connected || in_progress; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_win32.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_win32.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_win32.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_win32.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,253 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include - -#define SKYPE_WIN32_CLASS_NAME "Skype-libpurple-Joiner" - -static LRESULT APIENTRY Skype_WindowProc(HWND hWindow, UINT uiMessage, - WPARAM uiParam, LPARAM ulParam); -static void win32_message_loop(void); - -HINSTANCE hInit_ProcessHandle = NULL; -static UINT uiGlobal_MsgID_SkypeControlAPIAttach = 0; -static UINT uiGlobal_MsgID_SkypeControlAPIDiscover = 0; -static HWND hInit_MainWindowHandle = NULL; -static HWND hGlobal_SkypeAPIWindowHandle = NULL; -HANDLE hEvent = NULL; - -static gboolean -skype_connect() -{ - int i = 0; - PDWORD_PTR sendMessageResult = NULL; - - if (!uiGlobal_MsgID_SkypeControlAPIAttach) - uiGlobal_MsgID_SkypeControlAPIAttach = RegisterWindowMessage("SkypeControlAPIAttach"); - if (!uiGlobal_MsgID_SkypeControlAPIDiscover) - uiGlobal_MsgID_SkypeControlAPIDiscover = RegisterWindowMessage("SkypeControlAPIDiscover"); - - if (!hInit_ProcessHandle) - hInit_ProcessHandle = (HINSTANCE)OpenProcess( PROCESS_DUP_HANDLE, FALSE, GetCurrentProcessId()); - skype_debug_info("skype_win32", "ProcessId %d\n", GetCurrentProcessId()); - skype_debug_info("skype_win32", "hInit_ProcessHandle %d\n", hInit_ProcessHandle); - - g_thread_create((GThreadFunc)win32_message_loop, NULL, FALSE, NULL); - while(hInit_MainWindowHandle == NULL) - { - Sleep(10); - } - - skype_debug_info("skype_win32", "hInit_MainWindowHandle %d\n", hInit_MainWindowHandle); - skype_debug_info("skype_win32", "Sending broadcast message\n"); - SendMessageTimeout( HWND_BROADCAST, uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM)hInit_MainWindowHandle, 0, SMTO_NORMAL, 1000, sendMessageResult); - skype_debug_info("skype_win32", "Broadcast message sent\n"); - - while(hGlobal_SkypeAPIWindowHandle == NULL && i < 100) - { - i++; - Sleep(10); - } - - if (hGlobal_SkypeAPIWindowHandle == NULL) - return FALSE; - - return TRUE; -} - -static void -win32_message_loop(void) -{ - MSG msg; - WNDCLASS oWindowClass; - int classRegistration; - static gboolean message_loop_started = FALSE; - - if (message_loop_started) - return; - message_loop_started = TRUE; - - oWindowClass.style = CS_HREDRAW|CS_VREDRAW; - oWindowClass.lpfnWndProc = (WNDPROC)&Skype_WindowProc; - oWindowClass.cbClsExtra = 0; - oWindowClass.cbWndExtra = 0; - oWindowClass.hInstance = hInit_ProcessHandle; - oWindowClass.hIcon = NULL; - oWindowClass.hCursor = NULL; - oWindowClass.hbrBackground = NULL; - oWindowClass.lpszMenuName = NULL; - oWindowClass.lpszClassName = SKYPE_WIN32_CLASS_NAME; - classRegistration = RegisterClass(&oWindowClass); - hInit_MainWindowHandle = CreateWindow(SKYPE_WIN32_CLASS_NAME, SKYPE_WIN32_CLASS_NAME, - WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, - NULL, NULL, hInit_ProcessHandle, NULL); - - ShowWindow(hInit_MainWindowHandle, SW_HIDE); - UpdateWindow(hInit_MainWindowHandle); - while (GetMessage(&msg, NULL, 0, 0) != 0) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - skype_debug_info("skype_win32", "Finished message loop\n"); - DestroyWindow(hInit_MainWindowHandle); - hInit_MainWindowHandle = NULL; - message_loop_started = FALSE; -} - -static void -skype_disconnect() -{ - UnregisterClass(SKYPE_WIN32_CLASS_NAME, hInit_ProcessHandle); - CloseHandle(hInit_ProcessHandle); - hInit_ProcessHandle = NULL; - - if (hInit_MainWindowHandle != NULL) - { - //tell win32_message_loop() thread to die gracefully - PostMessage(hInit_MainWindowHandle, WM_QUIT, 0, 0); - } -} - -static void -send_message(char* message) -{ - int message_num; - char *error_return; - - COPYDATASTRUCT oCopyData; - oCopyData.dwData = 0; - oCopyData.lpData = (void *)message; - oCopyData.cbData = strlen(message) + 1; - - if (SendMessage( hGlobal_SkypeAPIWindowHandle, WM_COPYDATA, - (WPARAM)hInit_MainWindowHandle, (LPARAM)&oCopyData) == FALSE) - { - hGlobal_SkypeAPIWindowHandle = NULL; - //There was an error - if (message[0] == '#') - { - //And we're expecting a response - sscanf(message, "#%d ", &message_num); - error_return = g_strdup_printf("#%d ERROR WIN32", message_num); - g_thread_create((GThreadFunc)skype_message_received, (void *)error_return, FALSE, NULL); - } - } -} - -static LRESULT CALLBACK -Skype_WindowProc(HWND hWindow, UINT uiMessage, WPARAM uiParam, LPARAM ulParam) -{ - - if(uiMessage == WM_COPYDATA && hGlobal_SkypeAPIWindowHandle == (HWND)uiParam) - { - PCOPYDATASTRUCT poCopyData = (PCOPYDATASTRUCT)ulParam; - g_thread_create((GThreadFunc)skype_message_received, (void *)g_strdup(poCopyData->lpData), FALSE, NULL); - return 1; - } else if (uiMessage == uiGlobal_MsgID_SkypeControlAPIAttach) { - hGlobal_SkypeAPIWindowHandle = (HWND)uiParam; - skype_debug_info("skype_win32", "Attached process %d %d\n", uiParam, ulParam); - if (ulParam == 0) - skype_debug_info("skype_win32", "Attach success\n"); - else if (ulParam == 1) - skype_debug_info("skype_win32", "Pending auth\n"); - else if (ulParam == 2) - skype_debug_info("skype_win32", "Refused\n"); - else if (ulParam == 3) - skype_debug_info("skype_win32", "Not ready\n"); - else if (ulParam == 0x8001) - skype_debug_info("skype_win32", "Skype became ready\n"); - return 1; - } - return DefWindowProc(hWindow, uiMessage, uiParam, ulParam); -} - -static void -hide_skype() -{ - //don't need to since SILENT_MODE ON works - return; -} - -static gboolean -exec_skype() -{ - DWORD size = 0; - gchar *path, *pathtemp; - HKEY regkey; - gboolean success = FALSE; - - //HKCU\Software\Skype\Phone\SkypePath or HKLM\Software\Skype\Phone\SkypePath - - RegOpenKey(HKEY_CURRENT_USER, "Software\\Skype\\Phone", ®key); - RegQueryValueEx(regkey, "SkypePath", NULL, NULL, NULL, &size); - if (size != 0) - { - path = g_new(gchar, size); - RegQueryValueEx(regkey, "SkypePath", NULL, NULL, (LPBYTE)path, &size); - } else { - RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Skype\\Phone", ®key); - RegQueryValueEx(regkey, "SkypePath", NULL, NULL, NULL, &size); - if (size != 0) - { - path = g_new(gchar, size); - RegQueryValueEx(regkey, "Software\\Skype\\Phone\\SkypePath", NULL, NULL, (LPBYTE)path, &size); - } else if (g_file_test("..\\Skype.Portable\\skype-start.exe", G_FILE_TEST_EXISTS)) - { - path = g_strdup("..\\Skype.Portable\\skype-start.exe"); - } else { - path = g_strdup("C:\\Program Files\\Skype\\Phone\\Skype.exe"); - } - } - - pathtemp = g_strconcat("\"", path, "\" /nosplash /minimized", NULL); - skype_debug_info("skype_win32", "Path to Skype: %s\n", pathtemp); - g_free(path); - - success = g_spawn_command_line_async(pathtemp, NULL); - g_free(pathtemp); - return success; -} - -static gboolean -is_skype_running() -{ -#ifdef _TLHELP32_H - HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - HANDLE temp = NULL; - PROCESSENTRY32 entry; - entry.dwSize = sizeof(PROCESSENTRY32); - Process32First(snapshot, &entry); - do { - if (g_str_equal("Skype.exe", entry.szExeFile)) - { - temp = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID); - CloseHandle(snapshot); - return TRUE; - } - } while (Process32Next(snapshot, &entry)); - CloseHandle(snapshot); -#endif - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_x11.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_x11.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_x11.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/skype_messaging_x11.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,358 +0,0 @@ -/* - * Skype plugin for libpurple/Pidgin/Adium - * Written by: Eion Robb - * - * This plugin uses the Skype API to show your contacts in libpurple, and send/receive - * chat messages. - * It requires the Skype program to be running. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include - -static Display *disp = NULL; -static Window win = (Window)-1; -Window skype_win = (Window)-1; -static GThread *receiving_thread = NULL; -Atom message_start, message_continue; -static gboolean run_loop = FALSE; -static unsigned char x11_error_code = 0; -static GStaticMutex x11_mutex = G_STATIC_MUTEX_INIT; - -static void receive_message_loop(void); -int x11_error_handler(Display *disp, XErrorEvent *error); - -static gboolean -skype_connect() -{ - Window root; - Atom skype_inst; - Atom type_ret; - int format_ret; - unsigned long nitems_ret; - unsigned long bytes_after_ret; - unsigned char *prop; - int status; - - x11_error_code = 0; - XSetErrorHandler(x11_error_handler); - if (getenv("SKYPEDISPLAY")) - disp = XOpenDisplay(getenv("SKYPEDISPLAY")); - else - disp = XOpenDisplay(getenv("DISPLAY")); - if (disp == NULL) - { - skype_debug_info("skype", "Couldn't open display\n"); - return FALSE; - } - message_start = XInternAtom( disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False ); - message_continue = XInternAtom( disp, "SKYPECONTROLAPI_MESSAGE", False ); - root = DefaultRootWindow( disp ); - win = XCreateSimpleWindow( disp, root, 0, 0, 1, 1, - 0, BlackPixel( disp, DefaultScreen( disp ) ), - BlackPixel( disp, DefaultScreen( disp ) )); - XFlush(disp); - if (win == -1) - { - skype_debug_info("skype", "Could not create X11 messaging window\n"); - return FALSE; - } - skype_inst = XInternAtom(disp, "_SKYPE_INSTANCE", True); - if (skype_inst == None) - { - skype_win = (Window)-1; - skype_debug_info("skype_x11", "Could not create skype Atom\n"); - return FALSE; - } - status = XGetWindowProperty(disp, root, skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop); - if(status != Success || format_ret != 32 || nitems_ret < 1) - { - XFree(prop); - skype_win = (Window)-1; - skype_debug_info("skype", "Skype instance not found\n"); - return FALSE; - } - skype_win = * (const unsigned long *) prop & 0xffffffff; - XFree(prop); - run_loop = TRUE; - - receiving_thread = g_thread_create((GThreadFunc)receive_message_loop, NULL, FALSE, NULL); - - return TRUE; -} - - -static void -skype_disconnect() -{ - XEvent *e; - - run_loop = FALSE; - skype_win = (Window)-1; - - if (disp != NULL) - { - if (win != -1) - { - e = g_new0(XEvent, 1); - e->xclient.type = DestroyNotify; - XSendEvent(disp, win, False, 0, e); - - //wait here for the event to be handled - XDestroyWindow(disp, win); - } - XCloseDisplay(disp); - } - - win = (Window)-1; - disp = NULL; -} - -int -x11_error_handler(Display *disp, XErrorEvent *error) -{ - x11_error_code = error->error_code; - return FALSE; -} - - -static void -send_message(char* message) -{ - unsigned int pos = 0; - unsigned int len = strlen( message ); - XEvent e; - int message_num; - char *error_return; - unsigned int i; - - if (skype_win == -1 || win == -1 || disp == NULL) - { - //There was an error - if (message[0] == '#') - { - //And we're expecting a response - sscanf(message, "#%d ", &message_num); - error_return = g_strdup_printf("#%d ERROR X11", message_num); - g_thread_create((GThreadFunc)skype_message_received, (void *)error_return, FALSE, NULL); - } - return; - } - - memset(&e, 0, sizeof(e)); - e.xclient.type = ClientMessage; - e.xclient.message_type = message_start; /* first message */ - e.xclient.display = disp; - e.xclient.window = win; - e.xclient.format = 8; /* 8-bit values */ - - do - { - for( i = 0; i < 20 && i + pos <= len; ++i ) - e.xclient.data.b[ i ] = message[ i + pos ]; - g_static_mutex_lock(&x11_mutex); - XSendEvent( disp, skype_win, False, 0, &e ); - g_static_mutex_unlock(&x11_mutex); - - e.xclient.message_type = message_continue; /* 2nd or greater message */ - pos += i; - } while( pos <= len ); - - //XFlush(disp); - - if (x11_error_code == BadWindow) - { - //There was an error - if (message[0] == '#') - { - //And we're expecting a response - sscanf(message, "#%d ", &message_num); - error_return = g_strdup_printf("#%d ERROR X11_2", message_num); - g_thread_create((GThreadFunc)skype_message_received, (void *)error_return, FALSE, NULL); - } - g_thread_create((GThreadFunc)skype_message_received, g_strdup("CONNSTATUS LOGGEDOUT"), FALSE, NULL); - return; - } -} - -static void -receive_message_loop(void) -{ - XEvent e; - GString *msg = NULL; - char msg_temp[21]; - size_t len; - - msg_temp[20] = '\0'; - XSetErrorHandler(x11_error_handler); - while(run_loop) - { - if (!disp) - { - skype_debug_error("skype_x11", "display has disappeared\n"); - g_thread_create((GThreadFunc)skype_message_received, g_strdup("CONNSTATUS LOGGEDOUT"), FALSE, NULL); - break; - } - - - Bool event_bool; - g_static_mutex_lock(&x11_mutex); - event_bool = XCheckTypedEvent(disp, ClientMessage, &e); - g_static_mutex_unlock(&x11_mutex); - if (!event_bool) - { - g_thread_yield(); - usleep(1000); - //XPeekEvent(disp, &e); - //sleep(1); - continue; - }/* - XNextEvent(disp, &e); - printf("skype event: %d (clientmessage: %d)\n", e.type, ClientMessage); - if (e.type != ClientMessage) - continue;*/ - - strncpy(msg_temp, e.xclient.data.b, 20); - len = strlen(msg_temp); - if (e.xclient.message_type == message_start) - msg = g_string_new_len(msg_temp, len); - else if (e.xclient.message_type == message_continue) - msg = g_string_append_len(msg, msg_temp, len); - else - { - skype_debug_info("skype_x11", "unknown message type: %d\n", e.xclient.message_type); - if (disp) - { - g_static_mutex_lock(&x11_mutex); - XFlush(disp); - g_static_mutex_unlock(&x11_mutex); - } - continue; - } - - if (len < 20) - { - g_thread_create((GThreadFunc)skype_message_received, (void *)g_string_free(msg, FALSE), FALSE, NULL); - if (disp) - { - g_static_mutex_lock(&x11_mutex); - XFlush(disp); - g_static_mutex_unlock(&x11_mutex); - } - } - } -} - -static void -hide_skype() -{ - -} - -static gboolean -exec_skype() -{ - GError *error; - -#ifdef USE_XVFB_SERVER - PurpleAccount *acct = NULL; - int skype_stdin; - gchar **skype_list; - - unsetenv("DBUS_SESSION_BUS_ADDRESS"); - if (g_spawn_command_line_async("Xvfb :25 -ac -terminate -tst -xinerama -render -shmem -screen 0 640x480x16", NULL)) - //if (g_spawn_command_line_async("Xnest :25 -ac -terminate -tst -xinerama", NULL)) - { - acct = skype_get_account(NULL); - skype_debug_info("skype_x11", "acct: %d\n", acct); - if (acct) - { - skype_debug_info("skype_x11", "login: %s %s\n", acct->username, acct->password); - } - if (acct && acct->username && strlen(acct->username) && - acct->password && strlen(acct->password)) - { - g_shell_parse_argv("skype --pipelogin -display :25", NULL, &skype_list, NULL); - if (g_spawn_async_with_pipes(NULL, skype_list, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &skype_stdin, NULL, NULL, NULL)) - { - g_strfreev(skype_list); - write(skype_stdin, acct->username, strlen(acct->username)); - write(skype_stdin, " ", 1); - write(skype_stdin, acct->password, strlen(acct->password)); - write(skype_stdin, "\n", 1); - fsync(skype_stdin); - skype_debug_info("skype_x11", "pipelogin worked\n"); - setenv("SKYPEDISPLAY", ":25", TRUE); - return TRUE; - } - g_strfreev(skype_list); - } - } -#endif - - if (g_spawn_command_line_async("skype", &error)) - { - return TRUE; - } else { - skype_debug_error("skype", "Could not start skype: %s\n", error->message); - return FALSE; - } -} - -static gboolean -is_skype_running() -{ - const gchar *temp; - int pid; - gchar* stat_path; - FILE *fh; - gchar exec_name[15]; - struct stat *statobj = g_new(struct stat, 1); - //open /proc - GDir *procdir = g_dir_open("/proc", 0, NULL); - //go through directories that are numbers - while((temp = g_dir_read_name(procdir))) - { - pid = atoi(temp); - if (!pid) - continue; - // /proc/{pid}/stat contains lots of juicy info - stat_path = g_strdup_printf("/proc/%d/stat", pid); - fh = fopen(stat_path, "r"); - pid = fscanf(fh, "%*d (%15[^)]", exec_name); - fclose(fh); - if (!g_str_equal(exec_name, "skype")) - { - g_free(stat_path); - continue; - } - //get uid/owner of stat file by using fstat() - g_stat(stat_path, statobj); - g_free(stat_path); - //compare uid/owner of stat file (in g_stat->st_uid) to getuid(); - if (statobj->st_uid == getuid()) - { - //this copy of skype was started by us - g_dir_close(procdir); - g_free(statobj); - return TRUE; - } - } - g_dir_close(procdir); - g_free(statobj); - return FALSE; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/theme qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/theme --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/theme 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/theme 1970-01-01 00:00:00.000000000 +0000 @@ -1,469 +0,0 @@ -#put this theme in its own emotes directory -#eg /usr/share/pixmaps/pidgin/emotes/skype -#or C:\Program Files\Pidgin\pixmaps\pidgin\emotes\skype - -Name=Default-with-Skype -Description=Pidgin smileys including Skype -Icon=../default/wink.png -Author=Eion Robb and Hylke Bons - -# Default smileys -[default] -../default/smile.png :) :-) -../default/smile-big.png :-D :-d :D :d -../default/sad.png :-( :( -../default/wink.png ;-) ;) -../default/tongue.png :P :-P :-p :p -../default/shock.png =-O =-o -../default/kiss.png :-* -../default/glasses-cool.png 8-) -../default/embarrassed.png :-[ -../default/crying.png :'( -../default/thinking.png :-/ :-\\ -../default/angel.png O:-) o:-) -../default/shut-mouth.png :-X -../default/moneymouth.png :-$ -../default/foot-in-mouth.png :-! -../default/shout.png >:o >:O -! ../default/skywalker.png C:-) c:-) C:) c:) -! ../default/monkey.png :-(|) :(|) 8-|) -! ../default/cyclops.png O-) o-) - -# Following AIM 6.1 -[AIM] -../default/smile.png :-) :) -../default/wink.png ;-) ;) -../default/sad.png :-( :( -../default/tongue.png :-P :P :-p :p -../default/shock.png =-O -../default/kiss.png :-* -../default/shout.png >:o -../default/smile-big.png :-D :D -../default/moneymouth.png :-$ -../default/foot-in-mouth.png :-! -../default/embarrassed.png :-[ -../default/angel.png O:-) -../default/thinking.png :-\\ :-/ -../default/crying.png :'( -../default/shut-mouth.png :-X -../default/glasses-cool.png 8-) -! ../default/skywalker.png C:-) c:-) C:) c:) -! ../default/monkey.png :-(|) :(|) - - -# Following Windows Live Messenger 8.1 -[MSN] -../default/smile.png :) :-) -../default/smile-big.png :D :d :-D :-d -../default/wink.png ;) ;-) -../default/shock.png :-O :-o :O :o -../default/tongue.png :P :p :-P :-p -../default/glasses-cool.png (H) (h) -../default/angry.png :@ :-@ -../default/embarrassed.png :$ :-$ -../default/confused.png :S :s :-S :-s -../default/sad.png :( :-( -../default/crying.png :'( -../default/neutral.png :| :-| -../default/devil.png (6) -../default/angel.png (A) (a) -../default/love.png (L) (l) -../default/love-over.png (U) (u) -../default/msn.png (M) (m) -../default/cat.png (@) -../default/dog.png (&) -../default/moon.png (S) -../default/star.png (*) -../default/film.png (~) -../default/musical-note.png (8) -../default/mail.png (E) (e) -../default/rose.png (F) (f) -../default/rose-dead.png (W) (w) -../default/clock.png (O) (o) -../default/kiss.png (K) (k) -../default/present.png (G) (g) -../default/cake.png (^) -../default/camera.png (P) (p) -../default/lamp.png (I) (i) -../default/coffee.png (C) (c) -../default/phone.png (T) (t) -../default/hug-left.png ({) -../default/hug-right.png (}) -../default/beer.png (B) (b) -../default/drink.png (D) (d) -../default/boy.png (Z) (z) -../default/girl.png (X) (x) -../default/good.png (Y) (y) -../default/bad.png (N) (n) -../default/vampire.png :[ :-[ -../default/goat.png (nah) -../default/sun.png (#) -../default/rainbow.png (R) (r) -../default/quiet.png :-# -../default/teeth.png 8o| -../default/glasses-nerdy.png 8-| -../default/sarcastic.png ^o) -../default/secret.png :-* -../default/sick.png +o( -../default/snail.png (sn) -../default/turtle.png (tu) -../default/plate.png (pl) -../default/bowl.png (||) -../default/pizza.png (pi) -../default/soccerball.png (so) -../default/car.png (au) -../default/airplane.png (ap) -../default/umbrella.png (um) -../default/island.png (ip) -../default/computer.png (co) -../default/mobile.png (mp) -../default/brb.png (brb) -../default/rain.png (st) -../default/highfive.png (h5) -../default/coins.png (mo) -../default/sheep.png (bah) -../default/dont-know.png :^) -../default/thinking.png *-) -../default/thunder.png (li) -../default/party.png <:o) -../default/eyeroll.png 8-) -../default/yawn.png |-) -! ../default/skywalker.png C:-) c:-) C:) c:) -! ../default/monkey.png :-(|) :(|) - -# Hidden MSN emotes -../default/sigarette.png (ci) (CI) -../default/handcuffs.png (%) -../default/console.png (xx) (XX) -../default/fingers-crossed.png (yn) (YN) - - -# Following QQ 2006 -[QQ] -../default/shock.png /:O /jy /surprised -../default/curl-lip.png /:~ /pz /curl_lip -../default/desire.png /:* /se /desire -../default/dazed.png /:| /dazed -../default/party.png /8-) /dy /revel -../default/crying.png /:< /ll /cry -../default/bashful.png /:$ /hx /bashful -../default/shut-mouth.png /:X /bz /shut_mouth -../default/sleepy.png /:Z /shui /sleep -../default/weep.png /:'( /dk /weep -../default/embarrassed.png /:-| /gg /embarassed -../default/pissed-off.png /:@ /fn /pissed_off -../default/act-up.png /:P /tp /act_up -../default/smile-big.png /:D /cy /toothy_smile -../default/smile.png /:) /wx /small_smile -../default/sad.png /:( /ng /sad -../default/glasses-cool.png /:+ /kuk /cool -../default/doctor.png /:# /feid /SARS -../default/silly.png /:Q /zk /crazy -../default/sick.png /:T /tu /vomit -../default/snicker.png /;p /tx /titter -../default/cute.png /;-D /ka /cute -../default/disdain.png /;d /by /disdain -../default/arrogant.png /;o /am /arrogant -../default/starving.png /:g /jie /starving -../default/yawn.png /|-) /kun /sleepy -../default/terror.png /:! /jk /terror -../default/sweat.png /:L /sweat -../default/smirk.png /:> /hanx /smirk -../default/soldier.png /:; /db /soldier -../default/struggle.png /;f /fendou /struggle -../default/curse.png /:-S /zhm /curse -../default/question.png /? /yiw /question -../default/quiet.png /;x /xu /shh -../default/hypnotized.png /;@ /yun /dizzy -../default/excruciating.png /:8 /zhem /excrutiating -../default/freaked-out.png /;! /shuai /freaked_out -../default/skeleton.png /!!! /kl /skeleton -../default/hammer.png /xx /qiao /hammer -../default/bye.png /bye /zj /bye -../default/go-away.png /go /shan /go -../default/tremble.png /shake /fad /shake -../default/in-love.png /love /aiq /love -../default/jump.png /jump /tiao /jump -../default/search.png /find /zhao /search -../default/lashes.png /& /mm /beautiful_eyebrows -../default/pig.png /pig /zt /pig -../default/cat.png /cat /mm /cat -../default/dog.png /dog /xg /dog -../default/hug-left.png /hug /yb /hug -../default/coins.png /$ /qianc /money -../default/lamp.png /! /dp /lightbulb -../default/bowl.png /cup /bei /cup -../default/cake.png /cake /dg /cake -../default/thunder.png /li /shd /lightning -../default/bomb.png /bome /zhd /bomb -../default/knife.png /kn /dao /knife -../default/soccerball.png /footb /zq /soccer -../default/musical-note.png /music /yy /music -../default/poop.png /shit /bb /shit -../default/coffee.png /coffee /kf /coffee -../default/eat.png /eat /fan /eat -../default/pill.png /pill /yw /pill -../default/rose.png /rose /mg /rose -../default/wilt.png /fade /dx /wilt -../default/kiss.png /kiss /wen /kiss -../default/love.png /heart /xin /heart -../default/love-over.png /break /xs /broken_heart -../default/meeting.png /meeting /hy /meeting -../default/present.png /gift /lw /gift -../default/phone.png /phone /dh /phone -../default/clock.png /time /sj /time -../default/mail.png /email /yj /email -../default/tv.png /TV /ds /TV -../default/sun.png /sun /ty /sun -../default/moon.png /moon /yl /moon -../default/good.png /strong /qiang /thumbs_up -../default/bad.png /weak /ruo /thumbs_down -../default/handshake.png /share /ws /handshake -../default/victory.png /v /shl /victory -../default/beauty.png / /mn /beauty -../default/qq.png / /qz /qq -../default/blowkiss.png / /fw /blow_kiss -../default/angry.png / /oh /angry -../default/liquor.png / /bj /baijiu -../default/can.png / /qsh /soda -../default/watermelon.png / /xigua /watermelon -../default/rain.png / /xy /rain -../default/cloudy.png /<~> /duoy /cloudy -../default/snowman.png / /xr /snowman -../default/star.png /<*> /xixing /star -../default/girl.png /<00> /nv /woman -../default/boy.png /<11> /nan /man -! ../default/skywalker.png C:-) c:-) C:) c:) -! ../default/monkey.png :-(|) :(|) - - -# Following ICQ 6.0 -[ICQ] -../default/smile.png :-) :) -../default/neutral.png :-$ -../default/sad.png :-( :( -../default/shock.png =-O -../default/wink.png ;-) ;) -../default/tongue.png :-P :P :-p :p -../default/music.png [:-} -../default/laugh.png *JOKINGLY* -../default/sleepy.png *TIRED* -../default/crying.png :'( :'-( -../default/sick.png :-! -../default/kissed.png *KISSED* -../default/stop.png *STOP* -../default/kiss.png :-{} :-* -../default/kissing.png *KISSING* -../default/embarrassed.png :-[ -../default/devil.png ]:-> -../default/angel.png O:-) -../default/rose.png @}->-- -../default/shut-mouth.png :-X :X :-x :x -../default/bomb.png @= -../default/thinking.png :-\\ :-/ -../default/good.png *THUMBS\ UP* -../default/shout.png >:o >:O :-@ -../default/beer.png *DRINK* -../default/smile-big.png :-D :D -../default/glasses-cool.png 8-) -../default/in-love.png *IN\ LOVE* -! ../default/skywalker.png C:-) c:-) C:) c:) -! ../default/monkey.png :-(|) :(|) - - -# Following Yahoo! Messenger 8.1 -[Yahoo] -../default/smile.png :) :-) -../default/question.png :-/ :-\\ -../default/shock.png :-O :O :-o :o -../default/devil.png >:) -../default/angel.png O:-) o:-) 0:-) -../default/sick.png :-& -../default/yawn.png (:| -../default/hypnotized.png @-) -../default/on-the-phone.png :)] -../default/sad.png :( :-( -../default/in-love.png :x :-x :X :-X -../default/angry.png X-( x-( X( x( -../default/crying.png :(( -../default/glasses-nerdy.png :-B :-b -../default/quiet.png :-$ -../default/drool.png =P~ =p~ -../default/lying.png :^O :^o -../default/call-me.png :-c -../default/wink.png ;) ;-) -../default/embarrassed.png :"> -../default/mean.png :-> :> -../default/laugh.png :)) :-)) -../default/bye.png =; -../default/arrogant.png [-( -../default/thinking.png :-? -../default/waiting.png :-w :-W -../default/at-wits-end.png ~x( ~X( -../default/smile-big.png :D :-D :d :-d -../default/tongue.png :-P :P :-p :p -../default/glasses-cool.png B-) b-) -../default/neutral.png :| :-| -../default/sleepy.png I-) i-) |-) -../default/clown.png :o) :O) -../default/doh.png #-o #-O -../default/weep.png :-< -../default/go-away.png :-h -../default/lashes.png ;;) -../default/kiss.png :-* :* -../default/confused.png :-S :-s -../default/sarcastic.png /:) -../default/eyeroll.png 8-| -../default/silly.png 8-} -../default/clap.png =D> =d> -../default/mad-tongue.png >:P >:p -../default/time-out.png :-t :-T -../default/hug-left.png >:D< >:d< -../default/love-over.png =(( -../default/sweat.png #:-S #:-s -../default/rotfl.png =)) :-j :-J -../default/loser.png L-) l-) -../default/party.png <:-P <:-p -../default/nailbiting.png :-SS :-Ss :-sS :-ss -../default/cowboy.png <):) -../default/desire.png 8-> -! ../default/skywalker.png C:-) c:-) C:) c:) -! ../default/monkey.png :-(|) :(|) - -# Hidden Yahoo emotes -../default/alien.png =:) >-) -../default/beat-up.png b-( B-( -../default/chicken.png ~:> -../default/coffee.png ~o) ~O) -../default/cow.png 3:-O 3:-o -../default/dance.png \\:D/ \\:d/ -../default/rose.png @};- -../default/dont-know.png :-L :-l -../default/skeleton.png 8-X 8-x -../default/lamp.png *-:) -../default/monkey.png :(|) -../default/coins.png $-) -../default/peace.png :)>- -../default/pig.png :@) -../default/pray.png [-o< [-O< -../default/pumpkin.png (~~) -../default/shame.png [-X [-x -../default/flag.png **== -../default/clover.png %%- -../default/musical-note.png :-" -../default/giggle.png ;)) -../default/worship.png ^:)^ -../default/star.png (*) -../default/waving.png >:/ -../default/talktohand.png :-@ - -# Only available after activating the Yahoo! Fighter IMVironment -../default/male-fighter1.png o-> O-> -../default/male-fighter2.png o=> O=> -../default/female-fighter.png o-+ O-+ -../default/yin-yang.png (%) - - -# Following MySpaceIM Beta 1.0.697.0 -[MySpaceIM] -../default/smile-big.png :D :-D -../default/devil.png }:) -../default/confused.png :Z -../default/glasses-nerdy.png B) -../default/bulgy-eyes.png %) -../default/freaked-out.png :E -../default/smile.png :) :-) -../default/in-love.png :X -../default/laugh.png :)) -../default/mohawk.png -: -../default/mad-tongue.png X( -../default/messed.png X) -../default/glasses-nerdy.png Q) -../default/doh.png :G -../default/pirate.png P) -../default/shock.png :O -../default/sidefrown.png :{ -../default/sinister.png :B -../default/smirk.png :, -../default/neutral.png :| -../default/tongue.png :P :p -../default/pissed-off.png B| -../default/wink.png ;-) ;) -../default/sad.png :[ -../default/kiss.png :x - -# Following Skype 2.0 for Linux -[Skype] -../default/smile.png :) :-) :=) (smile) -../default/sad.png :( :-( :=( (sad) -../default/smile-big.png :D :-D :=D :d :-d :=d (laugh) -../default/glasses-cool.png 8-) 8=) B) B-) B=) (cool) -../default/shock.png :O :-O :=O :o :-o :=o (surprised) -../default/wink.png ;) ;-) ;=) (wink) -../default/crying.png ;( ;-( ;=( (cry) -../default/sweat.png (sweat) (:| -../default/neutral.png :| :-| :=| (speechless) -../default/kiss.png :* :-* :=* (kiss) -../default/tongue.png :P :-P :=P :p :-p :=p (tongueout) -../default/embarrassed.png (blush) :$ :-$ :=$ :"> -../default/dont-know.png :^) (wonder) -../default/sleepy.png |-) I-) I=) (snooze) -../default/neutral.png |-( |( |=( (dull) -../default/in-love.png (inlove) -../default/mean.png ]:) >:) (grin) -../default/act-up.png (talk) -../default/yawn.png (yawn) |-() -../default/sick.png (puke) :& :-& :=& -../default/doh.png (doh) -../default/angry.png :@ :-@ :=@ x( x-( X( X-( x=( X=( (angry) -../default/go-away.png (wasntme) -../default/party.png (party) -../default/confused.png :S :s :-s :-S :=s :=S -../default/nailbiting.png (worry) -../default/snicker.png (mm) (mmm) (mmmm) -../default/glasses-nerdy.png 8-| B-| 8| B| 8=| B=| (nerd) -../default/quiet.png :x :-x :X :-X :# :-# :=x :=X :=# -../default/waving.png (hi) -../default/call-me.png (call) -../default/devil.png (devil) -../default/angel.png (angel) -../default/desire.png (envy) -../default/stop.png (wait) -../default/hug-left.png (hug) (bear) -../default/beauty.png (makeup) (kate) -../default/giggle.png (chuckle) (giggle) -../default/clap.png (clap) -../default/thinking.png (think) :-? :? :=? -../default/worship.png (bow) -../default/rotfl.png (rofl) -../default/smile-big.png (whew) -../default/curl-lip.png (happy) -../default/smirk.png (smirk) -../default/good.png (y) (Y) (ok) (yes) -../default/bad.png (n) (N) (no) -../default/handshake.png (handshake) -../default/love.png (h) (H) (l) (L) (heart) (love) -../default/love-over.png (u) (U) (brokenheart) -../default/mail.png (e) (m) (mail) -../default/rain.png (rain) (st) (london) -../default/sun.png (sun) -../default/clock.png (o) (O) (time) (clock) -../default/musical-note.png (music) -../default/film.png (~) (film) (movie) -../default/mobile.png (mp) (ph) (phone) -../default/coffee.png (coffee) -../default/pizza.png (pi) (pizza) -../default/cake.png (^) (cake) -../default/beer.png (beer) -../default/terror.png (bandit) -../default/at-wits-end.png (headbang) (banghead) -../default/curse.png (swear) -../default/rose.png (F) (f) (flower) -../default/drink.png (d) (D) (drink) -../default/dance.png (dance) \o/ \:D/ \:d/ -../default/star.png (*) (star) -../default/bulgy-eyes.png (drunk) -../default/sigarette.png (smoking) (smoke) (ci) -../default/male-fighter1.png (ninja) -../default/dazed.png (tmi) -../default/goat.png (emo) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/TODO.txt qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/TODO.txt --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/TODO.txt 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/skype/TODO.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -Todo: - -Show in multiuser chats if someone is offline with, eg "Eion Robb (offline)", or show a message saying when they went offline? -show a window of currently active chats/latest chats -show joining messages on new chat window creation -Enter profile info, similar to how XMPP does it \ No newline at end of file diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -ssl_la_LDFLAGS = -module -avoid-version -ssl_gnutls_la_LDFLAGS = -module -avoid-version -ssl_nss_la_LDFLAGS = -module -avoid-version - -if PLUGINS - -# I'm sorry to report that Automake Conditionals don't support -# if USE_GNUTLS && USE_NSS -# but only support testing a single variable. Hence: - -if USE_GNUTLS -if USE_NSS -plugin_LTLIBRARIES = \ - ssl.la \ - ssl-gnutls.la \ - ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la \ - ssl-gnutls.la -endif -else -if USE_NSS -plugin_LTLIBRARIES = \ - ssl.la \ - ssl-nss.la -else -plugin_LTLIBRARIES = \ - ssl.la -endif -endif - -ssl_la_SOURCES = ssl.c -ssl_gnutls_la_SOURCES = ssl-gnutls.c -ssl_nss_la_SOURCES = ssl-nss.c - -ssl_la_LIBADD = $(GLIB_LIBS) -ssl_gnutls_la_LIBADD = $(GLIB_LIBS) $(GNUTLS_LIBS) -ssl_nss_la_LIBADD = $(GLIB_LIBS) $(NSS_LIBS) - -endif # PLUGINS - -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/libpurple\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) - -ssl_gnutls_la_CFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -ssl_nss_la_CFLAGS = $(AM_CPPFLAGS) $(NSS_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,795 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/ssl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -@PLUGINS_TRUE@ssl_gnutls_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__ssl_gnutls_la_SOURCES_DIST = ssl-gnutls.c -@PLUGINS_TRUE@am_ssl_gnutls_la_OBJECTS = ssl_gnutls_la-ssl-gnutls.lo -ssl_gnutls_la_OBJECTS = $(am_ssl_gnutls_la_OBJECTS) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@am_ssl_gnutls_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@am_ssl_gnutls_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@ssl_nss_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@PLUGINS_TRUE@ $(am__DEPENDENCIES_1) -am__ssl_nss_la_SOURCES_DIST = ssl-nss.c -@PLUGINS_TRUE@am_ssl_nss_la_OBJECTS = ssl_nss_la-ssl-nss.lo -ssl_nss_la_OBJECTS = $(am_ssl_nss_la_OBJECTS) -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@am_ssl_nss_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@am_ssl_nss_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@ssl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__ssl_la_SOURCES_DIST = ssl.c -@PLUGINS_TRUE@am_ssl_la_OBJECTS = ssl.lo -ssl_la_OBJECTS = $(am_ssl_la_OBJECTS) -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@am_ssl_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@am_ssl_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@am_ssl_la_rpath = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ $(plugindir) -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@am_ssl_la_rpath = -rpath \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ $(plugindir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(ssl_gnutls_la_SOURCES) $(ssl_nss_la_SOURCES) \ - $(ssl_la_SOURCES) -DIST_SOURCES = $(am__ssl_gnutls_la_SOURCES_DIST) \ - $(am__ssl_nss_la_SOURCES_DIST) $(am__ssl_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -ssl_la_LDFLAGS = -module -avoid-version -ssl_gnutls_la_LDFLAGS = -module -avoid-version -ssl_nss_la_LDFLAGS = -module -avoid-version -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_FALSE@ ssl.la - -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ ssl.la \ -@PLUGINS_TRUE@@USE_GNUTLS_FALSE@@USE_NSS_TRUE@ ssl-nss.la - -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ ssl.la \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_FALSE@ ssl-gnutls.la - - -# I'm sorry to report that Automake Conditionals don't support -# if USE_GNUTLS && USE_NSS -# but only support testing a single variable. Hence: -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@plugin_LTLIBRARIES = \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ ssl.la \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ ssl-gnutls.la \ -@PLUGINS_TRUE@@USE_GNUTLS_TRUE@@USE_NSS_TRUE@ ssl-nss.la - -@PLUGINS_TRUE@ssl_la_SOURCES = ssl.c -@PLUGINS_TRUE@ssl_gnutls_la_SOURCES = ssl-gnutls.c -@PLUGINS_TRUE@ssl_nss_la_SOURCES = ssl-nss.c -@PLUGINS_TRUE@ssl_la_LIBADD = $(GLIB_LIBS) -@PLUGINS_TRUE@ssl_gnutls_la_LIBADD = $(GLIB_LIBS) $(GNUTLS_LIBS) -@PLUGINS_TRUE@ssl_nss_la_LIBADD = $(GLIB_LIBS) $(NSS_LIBS) -AM_CPPFLAGS = \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)/libpurple\" \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) - -ssl_gnutls_la_CFLAGS = $(AM_CPPFLAGS) $(GNUTLS_CFLAGS) -ssl_nss_la_CFLAGS = $(AM_CPPFLAGS) $(NSS_CFLAGS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/ssl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/ssl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -ssl-gnutls.la: $(ssl_gnutls_la_OBJECTS) $(ssl_gnutls_la_DEPENDENCIES) - $(LINK) $(am_ssl_gnutls_la_rpath) $(ssl_gnutls_la_LDFLAGS) $(ssl_gnutls_la_OBJECTS) $(ssl_gnutls_la_LIBADD) $(LIBS) -ssl-nss.la: $(ssl_nss_la_OBJECTS) $(ssl_nss_la_DEPENDENCIES) - $(LINK) $(am_ssl_nss_la_rpath) $(ssl_nss_la_LDFLAGS) $(ssl_nss_la_OBJECTS) $(ssl_nss_la_LIBADD) $(LIBS) -ssl.la: $(ssl_la_OBJECTS) $(ssl_la_DEPENDENCIES) - $(LINK) $(am_ssl_la_rpath) $(ssl_la_LDFLAGS) $(ssl_la_OBJECTS) $(ssl_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssl_nss_la-ssl-nss.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -ssl_gnutls_la-ssl-gnutls.lo: ssl-gnutls.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_gnutls_la_CFLAGS) $(CFLAGS) -MT ssl_gnutls_la-ssl-gnutls.lo -MD -MP -MF "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Tpo" -c -o ssl_gnutls_la-ssl-gnutls.lo `test -f 'ssl-gnutls.c' || echo '$(srcdir)/'`ssl-gnutls.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Tpo" "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Plo"; else rm -f "$(DEPDIR)/ssl_gnutls_la-ssl-gnutls.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssl-gnutls.c' object='ssl_gnutls_la-ssl-gnutls.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_gnutls_la_CFLAGS) $(CFLAGS) -c -o ssl_gnutls_la-ssl-gnutls.lo `test -f 'ssl-gnutls.c' || echo '$(srcdir)/'`ssl-gnutls.c - -ssl_nss_la-ssl-nss.lo: ssl-nss.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_nss_la_CFLAGS) $(CFLAGS) -MT ssl_nss_la-ssl-nss.lo -MD -MP -MF "$(DEPDIR)/ssl_nss_la-ssl-nss.Tpo" -c -o ssl_nss_la-ssl-nss.lo `test -f 'ssl-nss.c' || echo '$(srcdir)/'`ssl-nss.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ssl_nss_la-ssl-nss.Tpo" "$(DEPDIR)/ssl_nss_la-ssl-nss.Plo"; else rm -f "$(DEPDIR)/ssl_nss_la-ssl-nss.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ssl-nss.c' object='ssl_nss_la-ssl-nss.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ssl_nss_la_CFLAGS) $(CFLAGS) -c -o ssl_nss_la-ssl-nss.lo `test -f 'ssl-nss.c' || echo '$(srcdir)/'`ssl-nss.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for ssl plugin. -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -## -## VARIABLE DEFINITIONS -## -TARGET = ssl -TARGET_NSS = ssl-nss - -NEEDED_DLLS = \ - $(NSS_TOP)/lib/freebl3.dll \ - $(NSS_TOP)/lib/nss3.dll \ - $(NSS_TOP)/lib/nssckbi.dll \ - $(NSS_TOP)/lib/softokn3.dll \ - $(NSS_TOP)/lib/smime3.dll \ - $(NSS_TOP)/lib/ssl3.dll \ - $(NSPR_TOP)/lib/nspr4.dll \ - $(NSPR_TOP)/lib/plc4.dll \ - $(NSPR_TOP)/lib/plds4.dll - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(NSS_TOP)/include \ - -I$(NSPR_TOP)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(NSS_TOP)/lib \ - -L$(NSPR_TOP)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = ssl.c -C_SRC_NSS = ssl-nss.c -OBJECTS = $(C_SRC:%.c=%.o) -OBJECTS_NSS = $(C_SRC_NSS:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lnss3 \ - -lnspr4 \ - -lssl3 \ - -lsmime3 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll $(TARGET_NSS).dll - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(TARGET_NSS).dll $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS) $(OBJECTS_NSS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -$(TARGET_NSS).dll: $(PURPLE_DLL) $(OBJECTS_NSS) - $(CC) -shared $(OBJECTS_NSS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET_NSS).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(OBJECTS_NSS) $(TARGET).dll $(TARGET_NSS).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -/** - * @file ssl.c Main SSL plugin - * - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "plugin.h" -#include "sslconn.h" -#include "version.h" - -#define SSL_PLUGIN_ID "core-ssl" - -static PurplePlugin *ssl_plugin = NULL; - -static gboolean -probe_ssl_plugins(PurplePlugin *my_plugin) -{ - PurplePlugin *plugin; - GList *l; - - ssl_plugin = NULL; - - for (l = purple_plugins_get_all(); l != NULL; l = l->next) - { - plugin = (PurplePlugin *)l->data; - - if (plugin == my_plugin) - continue; - - if (plugin->info != NULL && plugin->info->id != NULL && - strncmp(plugin->info->id, "ssl-", 4) == 0) - { - if (purple_plugin_is_loaded(plugin) || purple_plugin_load(plugin)) - { - ssl_plugin = plugin; - - break; - } - } - } - - return (ssl_plugin != NULL); -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - return probe_ssl_plugins(plugin); -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - if (ssl_plugin != NULL && - g_list_find(purple_plugins_get_loaded(), ssl_plugin) != NULL) - { - purple_plugin_unload(ssl_plugin); - } - - ssl_plugin = NULL; - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SSL_PLUGIN_ID, /**< id */ - N_("SSL"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Provides a wrapper around SSL support libraries."), - /** description */ - N_("Provides a wrapper around SSL support libraries."), - "Christian Hammond ", - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ssl, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-gnutls.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-gnutls.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-gnutls.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-gnutls.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1061 +0,0 @@ -/** - * @file ssl-gnutls.c GNUTLS SSL plugin. - * - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "certificate.h" -#include "plugin.h" -#include "sslconn.h" -#include "version.h" -#include "util.h" - -#define SSL_GNUTLS_PLUGIN_ID "ssl-gnutls" - -#include -#include - -typedef struct -{ - gnutls_session session; - guint handshake_handler; -} PurpleSslGnutlsData; - -#define PURPLE_SSL_GNUTLS_DATA(gsc) ((PurpleSslGnutlsData *)gsc->private_data) - -static gnutls_certificate_client_credentials xcred; - -static void -ssl_gnutls_log(int level, const char *str) -{ - /* GnuTLS log messages include the '\n' */ - purple_debug_misc("gnutls", "lvl %d: %s", level, str); -} - -static void -ssl_gnutls_init_gnutls(void) -{ - const char *debug_level; - - /* Configure GnuTLS to use glib memory management */ - /* I expect that this isn't really necessary, but it may prevent - some bugs */ - /* TODO: It may be necessary to wrap this allocators for GnuTLS. - If there are strange bugs, perhaps look here (yes, I am a - hypocrite) */ - gnutls_global_set_mem_functions( - (gnutls_alloc_function) g_malloc, /* malloc */ - (gnutls_alloc_function) g_malloc, /* secure malloc */ - NULL, /* mem_is_secure */ - (gnutls_realloc_function) g_realloc, /* realloc */ - (gnutls_free_function) g_free /* free */ - ); - - debug_level = g_getenv("PURPLE_GNUTLS_DEBUG"); - if (debug_level) { - int level = atoi(debug_level); - if (level < 0) { - purple_debug_warning("gnutls", "Assuming log level 0 instead of %d\n", - level); - level = 0; - } - - /* "The level is an integer between 0 and 9. Higher values mean more verbosity." */ - gnutls_global_set_log_level(level); - gnutls_global_set_log_function(ssl_gnutls_log); - } - - gnutls_global_init(); - - gnutls_certificate_allocate_credentials(&xcred); - - /* TODO: I can likely remove this */ - gnutls_certificate_set_x509_trust_file(xcred, "ca.pem", - GNUTLS_X509_FMT_PEM); -} - -static gboolean -ssl_gnutls_init(void) -{ - return TRUE; -} - -static void -ssl_gnutls_uninit(void) -{ - gnutls_global_deinit(); - - gnutls_certificate_free_credentials(xcred); -} - -static void -ssl_gnutls_verified_cb(PurpleCertificateVerificationStatus st, - gpointer userdata) -{ - PurpleSslConnection *gsc = (PurpleSslConnection *) userdata; - - if (st == PURPLE_CERTIFICATE_VALID) { - /* Certificate valid? Good! Do the connection! */ - gsc->connect_cb(gsc->connect_cb_data, gsc, PURPLE_INPUT_READ); - } else { - /* Otherwise, signal an error */ - if(gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CERTIFICATE_INVALID, - gsc->connect_cb_data); - purple_ssl_close(gsc); - } -} - - - -static void ssl_gnutls_handshake_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleSslConnection *gsc = data; - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - ssize_t ret; - - /*purple_debug_info("gnutls", "Handshaking with %s\n", gsc->host);*/ - ret = gnutls_handshake(gnutls_data->session); - - if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) - return; - - purple_input_remove(gnutls_data->handshake_handler); - gnutls_data->handshake_handler = 0; - - if(ret != 0) { - purple_debug_error("gnutls", "Handshake failed. Error %s\n", - gnutls_strerror(ret)); - - if(gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_HANDSHAKE_FAILED, - gsc->connect_cb_data); - - purple_ssl_close(gsc); - } else { - /* Now we are cooking with gas! */ - PurpleSslOps *ops = purple_ssl_get_ops(); - GList * peers = ops->get_peer_certificates(gsc); - - PurpleCertificateScheme *x509 = - purple_certificate_find_scheme("x509"); - - GList * l; - - /* TODO: Remove all this debugging babble */ - purple_debug_info("gnutls", "Handshake complete\n"); - - for (l=peers; l; l = l->next) { - PurpleCertificate *crt = l->data; - GByteArray *z = - x509->get_fingerprint_sha1(crt); - gchar * fpr = - purple_base16_encode_chunked(z->data, - z->len); - - purple_debug_info("gnutls/x509", - "Key print: %s\n", - fpr); - - /* Kill the cert! */ - x509->destroy_certificate(crt); - - g_free(fpr); - g_byte_array_free(z, TRUE); - } - g_list_free(peers); - - { - const gnutls_datum *cert_list; - unsigned int cert_list_size = 0; - gnutls_session session=gnutls_data->session; - int i; - - cert_list = - gnutls_certificate_get_peers(session, &cert_list_size); - - purple_debug_info("gnutls", - "Peer provided %d certs\n", - cert_list_size); - for (i=0; iverifier) { - GList *peers; - /* First, get the peer cert chain */ - peers = purple_ssl_get_peer_certificates(gsc); - - /* Now kick off the verification process */ - purple_certificate_verify(gsc->verifier, - gsc->host, - peers, - ssl_gnutls_verified_cb, - gsc); - - purple_certificate_destroy_list(peers); - } else { - /* Otherwise, just call the "connection complete" - callback */ - gsc->connect_cb(gsc->connect_cb_data, gsc, cond); - } - } - -} - - -static void -ssl_gnutls_connect(PurpleSslConnection *gsc) -{ - PurpleSslGnutlsData *gnutls_data; - static const int cert_type_priority[2] = { GNUTLS_CRT_X509, 0 }; - - gnutls_data = g_new0(PurpleSslGnutlsData, 1); - gsc->private_data = gnutls_data; - - gnutls_init(&gnutls_data->session, GNUTLS_CLIENT); -#ifdef HAVE_GNUTLS_PRIORITY_FUNCS - if (gnutls_priority_set_direct(gnutls_data->session, - "NORMAL:%SSL3_RECORD_VERSION", NULL)) - gnutls_priority_set_direct(gnutls_data->session, "NORMAL", NULL); -#else - gnutls_set_default_priority(gnutls_data->session); -#endif - - gnutls_certificate_type_set_priority(gnutls_data->session, - cert_type_priority); - - gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE, - xcred); - - gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(gsc->fd)); - - gnutls_data->handshake_handler = purple_input_add(gsc->fd, - PURPLE_INPUT_READ, ssl_gnutls_handshake_cb, gsc); - - purple_debug_info("gnutls", "Starting handshake with %s\n", gsc->host); - - /* Orborde asks: Why are we configuring a callback, then - immediately calling it? - - Answer: gnutls_handshake (up in handshake_cb) needs to be called - once in order to get the ball rolling on the SSL connection. - Once it has done so, only then will the server reply, triggering - the callback. - - Since the logic driving gnutls_handshake is the same with the first - and subsequent calls, we'll just fire the callback immediately to - accomplish this. - */ - ssl_gnutls_handshake_cb(gsc, gsc->fd, PURPLE_INPUT_READ); -} - -static void -ssl_gnutls_close(PurpleSslConnection *gsc) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - - if(!gnutls_data) - return; - - if(gnutls_data->handshake_handler) - purple_input_remove(gnutls_data->handshake_handler); - - gnutls_bye(gnutls_data->session, GNUTLS_SHUT_RDWR); - - gnutls_deinit(gnutls_data->session); - - g_free(gnutls_data); - gsc->private_data = NULL; -} - -static size_t -ssl_gnutls_read(PurpleSslConnection *gsc, void *data, size_t len) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - ssize_t s; - - s = gnutls_record_recv(gnutls_data->session, data, len); - - if(s == GNUTLS_E_AGAIN || s == GNUTLS_E_INTERRUPTED) { - s = -1; - errno = EAGAIN; - } else if(s < 0) { - purple_debug_error("gnutls", "receive failed: %s\n", - gnutls_strerror(s)); - s = -1; - /* - * TODO: Set errno to something more appropriate. Or even - * better: allow ssl plugins to keep track of their - * own error message, then add a new ssl_ops function - * that returns the error message. - */ - errno = EIO; - } - - return s; -} - -static size_t -ssl_gnutls_write(PurpleSslConnection *gsc, const void *data, size_t len) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - ssize_t s = 0; - - /* XXX: when will gnutls_data be NULL? */ - if(gnutls_data) - s = gnutls_record_send(gnutls_data->session, data, len); - - if(s == GNUTLS_E_AGAIN || s == GNUTLS_E_INTERRUPTED) { - s = -1; - errno = EAGAIN; - } else if(s < 0) { - purple_debug_error("gnutls", "send failed: %s\n", - gnutls_strerror(s)); - s = -1; - /* - * TODO: Set errno to something more appropriate. Or even - * better: allow ssl plugins to keep track of their - * own error message, then add a new ssl_ops function - * that returns the error message. - */ - errno = EIO; - } - - return s; -} - -/* Forward declarations are fun! */ -static PurpleCertificate * -x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode); - -static GList * -ssl_gnutls_get_peer_certificates(PurpleSslConnection * gsc) -{ - PurpleSslGnutlsData *gnutls_data = PURPLE_SSL_GNUTLS_DATA(gsc); - - /* List of Certificate instances to return */ - GList * peer_certs = NULL; - - /* List of raw certificates as given by GnuTLS */ - const gnutls_datum *cert_list; - unsigned int cert_list_size = 0; - - unsigned int i; - - /* This should never, ever happen. */ - g_return_val_if_fail( gnutls_certificate_type_get (gnutls_data->session) == GNUTLS_CRT_X509, NULL); - - /* Get the certificate list from GnuTLS */ - /* TODO: I am _pretty sure_ this doesn't block or do other exciting things */ - cert_list = gnutls_certificate_get_peers(gnutls_data->session, - &cert_list_size); - - /* Convert each certificate to a Certificate and append it to the list */ - for (i = 0; i < cert_list_size; i++) { - PurpleCertificate * newcrt = x509_import_from_datum(cert_list[i], - GNUTLS_X509_FMT_DER); - /* Append is somewhat inefficient on linked lists, but is easy - to read. If someone complains, I'll change it. - TODO: Is anyone complaining? (Maybe elb?) */ - peer_certs = g_list_append(peer_certs, newcrt); - } - - /* cert_list doesn't need free()-ing */ - - return peer_certs; -} - -/************************************************************************/ -/* X.509 functionality */ -/************************************************************************/ -const gchar * SCHEME_NAME = "x509"; - -static PurpleCertificateScheme x509_gnutls; - -/** Refcounted GnuTLS certificate data instance */ -typedef struct { - gint refcount; - gnutls_x509_crt crt; -} x509_crtdata_t; - -/** Helper functions for reference counting */ -static x509_crtdata_t * -x509_crtdata_addref(x509_crtdata_t *cd) -{ - (cd->refcount)++; - return cd; -} - -static void -x509_crtdata_delref(x509_crtdata_t *cd) -{ - (cd->refcount)--; - - if (cd->refcount < 0) - g_critical("Refcount of x509_crtdata_t is %d, which is less " - "than zero!\n", cd->refcount); - - /* If the refcount reaches zero, kill the structure */ - if (cd->refcount <= 0) { - /* Kill the internal data */ - gnutls_x509_crt_deinit( cd->crt ); - /* And kill the struct */ - g_free( cd ); - } -} - -/** Helper macro to retrieve the GnuTLS crt_t from a PurpleCertificate */ -#define X509_GET_GNUTLS_DATA(pcrt) ( ((x509_crtdata_t *) (pcrt->data))->crt) - -/** Transforms a gnutls_datum containing an X.509 certificate into a Certificate instance under the x509_gnutls scheme - * - * @param dt Datum to transform - * @param mode GnuTLS certificate format specifier (GNUTLS_X509_FMT_PEM for - * reading from files, and GNUTLS_X509_FMT_DER for converting - * "over the wire" certs for SSL) - * - * @return A newly allocated Certificate structure of the x509_gnutls scheme - */ -static PurpleCertificate * -x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode) -{ - /* Internal certificate data structure */ - x509_crtdata_t *certdat; - /* New certificate to return */ - PurpleCertificate * crt; - - /* Allocate and prepare the internal certificate data */ - certdat = g_new0(x509_crtdata_t, 1); - gnutls_x509_crt_init(&(certdat->crt)); - certdat->refcount = 0; - - /* Perform the actual certificate parse */ - /* Yes, certdat->crt should be passed as-is */ - gnutls_x509_crt_import(certdat->crt, &dt, mode); - - /* Allocate the certificate and load it with data */ - crt = g_new0(PurpleCertificate, 1); - crt->scheme = &x509_gnutls; - crt->data = x509_crtdata_addref(certdat); - - return crt; -} - -/** Imports a PEM-formatted X.509 certificate from the specified file. - * @param filename Filename to import from. Format is PEM - * - * @return A newly allocated Certificate structure of the x509_gnutls scheme - */ -static PurpleCertificate * -x509_import_from_file(const gchar * filename) -{ - PurpleCertificate *crt; /* Certificate being constructed */ - gchar *buf; /* Used to load the raw file data */ - gsize buf_sz; /* Size of the above */ - gnutls_datum dt; /* Struct to pass down to GnuTLS */ - - purple_debug_info("gnutls", - "Attempting to load X.509 certificate from %s\n", - filename); - - /* Next, we'll simply yank the entire contents of the file - into memory */ - /* TODO: Should I worry about very large files here? */ - g_return_val_if_fail( - g_file_get_contents(filename, - &buf, - &buf_sz, - NULL /* No error checking for now */ - ), - NULL); - - /* Load the datum struct */ - dt.data = (unsigned char *) buf; - dt.size = buf_sz; - - /* Perform the conversion; files should be in PEM format */ - crt = x509_import_from_datum(dt, GNUTLS_X509_FMT_PEM); - - /* Cleanup */ - g_free(buf); - - return crt; -} - -/** - * Exports a PEM-formatted X.509 certificate to the specified file. - * @param filename Filename to export to. Format will be PEM - * @param crt Certificate to export - * - * @return TRUE if success, otherwise FALSE - */ -static gboolean -x509_export_certificate(const gchar *filename, PurpleCertificate *crt) -{ - gnutls_x509_crt crt_dat; /* GnuTLS cert struct */ - int ret; - gchar * out_buf; /* Data to output */ - size_t out_size; /* Output size */ - gboolean success = FALSE; - - /* Paranoia paranoia paranoia! */ - g_return_val_if_fail(filename, FALSE); - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - g_return_val_if_fail(crt->data, FALSE); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - /* Obtain the output size required */ - out_size = 0; - ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, - NULL, /* Provide no buffer yet */ - &out_size /* Put size here */ - ); - g_return_val_if_fail(ret == GNUTLS_E_SHORT_MEMORY_BUFFER, FALSE); - - /* Now allocate a buffer and *really* export it */ - out_buf = g_new0(gchar, out_size); - ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, - out_buf, /* Export to our new buffer */ - &out_size /* Put size here */ - ); - if (ret != 0) { - purple_debug_error("gnutls/x509", - "Failed to export cert to buffer with code %d\n", - ret); - g_free(out_buf); - return FALSE; - } - - /* Write it out to an actual file */ - success = purple_util_write_data_to_file_absolute(filename, - out_buf, out_size); - - g_free(out_buf); - return success; -} - -static PurpleCertificate * -x509_copy_certificate(PurpleCertificate *crt) -{ - x509_crtdata_t *crtdat; - PurpleCertificate *newcrt; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - crtdat = (x509_crtdata_t *) crt->data; - - newcrt = g_new0(PurpleCertificate, 1); - newcrt->scheme = &x509_gnutls; - newcrt->data = x509_crtdata_addref(crtdat); - - return newcrt; -} -/** Frees a Certificate - * - * Destroys a Certificate's internal data structures and frees the pointer - * given. - * @param crt Certificate instance to be destroyed. It WILL NOT be destroyed - * if it is not of the correct CertificateScheme. Can be NULL - * - */ -static void -x509_destroy_certificate(PurpleCertificate * crt) -{ - if (NULL == crt) return; - - /* Check that the scheme is x509_gnutls */ - if ( crt->scheme != &x509_gnutls ) { - purple_debug_error("gnutls", - "destroy_certificate attempted on certificate of wrong scheme (scheme was %s, expected %s)\n", - crt->scheme->name, - SCHEME_NAME); - return; - } - - g_return_if_fail(crt->data != NULL); - g_return_if_fail(crt->scheme != NULL); - - /* Use the reference counting system to free (or not) the - underlying data */ - x509_crtdata_delref((x509_crtdata_t *)crt->data); - - /* Kill the structure itself */ - g_free(crt); -} - -/** Determines whether one certificate has been issued and signed by another - * - * @param crt Certificate to check the signature of - * @param issuer Issuer's certificate - * - * @return TRUE if crt was signed and issued by issuer, otherwise FALSE - * @TODO Modify this function to return a reason for invalidity? - */ -static gboolean -x509_certificate_signed_by(PurpleCertificate * crt, - PurpleCertificate * issuer) -{ - gnutls_x509_crt crt_dat; - gnutls_x509_crt issuer_dat; - unsigned int verify; /* used to store result from GnuTLS verifier */ - int ret; - gchar *crt_id = NULL; - gchar *issuer_id = NULL; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(issuer, FALSE); - - /* Verify that both certs are the correct scheme */ - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - g_return_val_if_fail(issuer->scheme == &x509_gnutls, FALSE); - - /* TODO: check for more nullness? */ - - crt_dat = X509_GET_GNUTLS_DATA(crt); - issuer_dat = X509_GET_GNUTLS_DATA(issuer); - - /* First, let's check that crt.issuer is actually issuer */ - ret = gnutls_x509_crt_check_issuer(crt_dat, issuer_dat); - if (ret <= 0) { - - if (ret < 0) { - purple_debug_error("gnutls/x509", - "GnuTLS error %d while checking certificate issuer match.", - ret); - } else { - gchar *crt_id, *issuer_id, *crt_issuer_id; - crt_id = purple_certificate_get_unique_id(crt); - issuer_id = purple_certificate_get_unique_id(issuer); - crt_issuer_id = - purple_certificate_get_issuer_unique_id(crt); - purple_debug_info("gnutls/x509", - "Certificate %s is issued by " - "%s, which does not match %s.\n", - crt_id ? crt_id : "(null)", - crt_issuer_id ? crt_issuer_id : "(null)", - issuer_id ? issuer_id : "(null)"); - g_free(crt_id); - g_free(issuer_id); - g_free(crt_issuer_id); - } - - /* The issuer is not correct, or there were errors */ - return FALSE; - } - - /* Now, check the signature */ - /* The second argument is a ptr to an array of "trusted" issuer certs, - but we're only using one trusted one */ - ret = gnutls_x509_crt_verify(crt_dat, &issuer_dat, 1, - /* Permit signings by X.509v1 certs - (Verisign and possibly others have - root certificates that predate the - current standard) */ - GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT, - &verify); - - if (ret != 0) { - purple_debug_error("gnutls/x509", - "Attempted certificate verification caused a GnuTLS error code %d. I will just say the signature is bad, but you should look into this.\n", ret); - return FALSE; - } - -#ifdef HAVE_GNUTLS_CERT_INSECURE_ALGORITHM - if (verify & GNUTLS_CERT_INSECURE_ALGORITHM) { - /* - * A certificate in the chain is signed with an insecure - * algorithm. Put a warning into the log to make this error - * perfectly clear as soon as someone looks at the debug log is - * generated. - */ - crt_id = purple_certificate_get_unique_id(crt); - issuer_id = purple_certificate_get_issuer_unique_id(crt); - purple_debug_warning("gnutls/x509", - "Insecure hash algorithm used by %s to sign %s\n", - issuer_id, crt_id); - } -#endif - - if (verify & GNUTLS_CERT_INVALID) { - /* Signature didn't check out, but at least - there were no errors*/ - if (!crt_id) - crt_id = purple_certificate_get_unique_id(crt); - if (!issuer_id) - issuer_id = purple_certificate_get_issuer_unique_id(crt); - purple_debug_error("gnutls/x509", - "Bad signature from %s on %s\n", - issuer_id, crt_id); - g_free(crt_id); - g_free(issuer_id); - - return FALSE; - } /* if (ret, etc.) */ - - /* If we got here, the signature is good */ - return TRUE; -} - -static GByteArray * -x509_sha1sum(PurpleCertificate *crt) -{ - size_t hashlen = 20; /* SHA1 hashes are 20 bytes */ - size_t tmpsz = hashlen; /* Throw-away variable for GnuTLS to stomp on*/ - gnutls_x509_crt crt_dat; - GByteArray *hash; /**< Final hash container */ - guchar hashbuf[20]; /**< Temporary buffer to contain hash */ - - g_return_val_if_fail(crt, NULL); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - /* Extract the fingerprint */ - g_return_val_if_fail( - 0 == gnutls_x509_crt_get_fingerprint(crt_dat, GNUTLS_MAC_SHA, - hashbuf, &tmpsz), - NULL); - - /* This shouldn't happen */ - g_return_val_if_fail(tmpsz == hashlen, NULL); - - /* Okay, now create and fill hash array */ - hash = g_byte_array_new(); - g_byte_array_append(hash, hashbuf, hashlen); - - return hash; -} - -static gchar * -x509_cert_dn (PurpleCertificate *crt) -{ - gnutls_x509_crt cert_dat; - gchar *dn = NULL; - size_t dn_size; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - cert_dat = X509_GET_GNUTLS_DATA(crt); - - /* Figure out the length of the Distinguished Name */ - /* Claim that the buffer is size 0 so GnuTLS just tells us how much - space it needs */ - dn_size = 0; - gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size); - - /* Now allocate and get the Distinguished Name */ - /* Old versions of GnuTLS have an off-by-one error in reporting - the size of the needed buffer in some functions, so allocate - an extra byte */ - dn = g_new0(gchar, ++dn_size); - if (0 != gnutls_x509_crt_get_dn(cert_dat, dn, &dn_size)) { - purple_debug_error("gnutls/x509", - "Failed to get Distinguished Name\n"); - g_free(dn); - return NULL; - } - - return dn; -} - -static gchar * -x509_issuer_dn (PurpleCertificate *crt) -{ - gnutls_x509_crt cert_dat; - gchar *dn = NULL; - size_t dn_size; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - cert_dat = X509_GET_GNUTLS_DATA(crt); - - /* Figure out the length of the Distinguished Name */ - /* Claim that the buffer is size 0 so GnuTLS just tells us how much - space it needs */ - dn_size = 0; - gnutls_x509_crt_get_issuer_dn(cert_dat, dn, &dn_size); - - /* Now allocate and get the Distinguished Name */ - /* Old versions of GnuTLS have an off-by-one error in reporting - the size of the needed buffer in some functions, so allocate - an extra byte */ - dn = g_new0(gchar, ++dn_size); - if (0 != gnutls_x509_crt_get_issuer_dn(cert_dat, dn, &dn_size)) { - purple_debug_error("gnutls/x509", - "Failed to get issuer's Distinguished " - "Name\n"); - g_free(dn); - return NULL; - } - - return dn; -} - -static gchar * -x509_common_name (PurpleCertificate *crt) -{ - gnutls_x509_crt cert_dat; - gchar *cn = NULL; - size_t cn_size; - int ret; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_gnutls, NULL); - - cert_dat = X509_GET_GNUTLS_DATA(crt); - - /* Figure out the length of the Common Name */ - /* Claim that the buffer is size 0 so GnuTLS just tells us how much - space it needs */ - cn_size = 0; - gnutls_x509_crt_get_dn_by_oid(cert_dat, - GNUTLS_OID_X520_COMMON_NAME, - 0, /* First CN found, please */ - 0, /* Not in raw mode */ - cn, &cn_size); - - /* Now allocate and get the Common Name */ - /* Old versions of GnuTLS have an off-by-one error in reporting - the size of the needed buffer in some functions, so allocate - an extra byte */ - cn = g_new0(gchar, ++cn_size); - ret = gnutls_x509_crt_get_dn_by_oid(cert_dat, - GNUTLS_OID_X520_COMMON_NAME, - 0, /* First CN found, please */ - 0, /* Not in raw mode */ - cn, &cn_size); - if (ret != 0) { - purple_debug_error("gnutls/x509", - "Failed to get Common Name\n"); - g_free(cn); - return NULL; - } - - return cn; -} - -static gboolean -x509_check_name (PurpleCertificate *crt, const gchar *name) -{ - gnutls_x509_crt crt_dat; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - g_return_val_if_fail(name, FALSE); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - if (gnutls_x509_crt_check_hostname(crt_dat, name)) { - return TRUE; - } else { - return FALSE; - } -} - -static gboolean -x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) -{ - gnutls_x509_crt crt_dat; - /* GnuTLS time functions return this on error */ - const time_t errval = (time_t) (-1); - gboolean success = TRUE; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); - - crt_dat = X509_GET_GNUTLS_DATA(crt); - - if (activation) { - *activation = gnutls_x509_crt_get_activation_time(crt_dat); - if (*activation == errval) - success = FALSE; - } - if (expiration) { - *expiration = gnutls_x509_crt_get_expiration_time(crt_dat); - if (*expiration == errval) - success = FALSE; - } - - return success; -} - -/* X.509 certificate operations provided by this plugin */ -static PurpleCertificateScheme x509_gnutls = { - "x509", /* Scheme name */ - N_("X.509 Certificates"), /* User-visible scheme name */ - x509_import_from_file, /* Certificate import function */ - x509_export_certificate, /* Certificate export function */ - x509_copy_certificate, /* Copy */ - x509_destroy_certificate, /* Destroy cert */ - x509_certificate_signed_by, /* Signature checker */ - x509_sha1sum, /* SHA1 fingerprint */ - x509_cert_dn, /* Unique ID */ - x509_issuer_dn, /* Issuer Unique ID */ - x509_common_name, /* Subject name */ - x509_check_name, /* Check subject name */ - x509_times, /* Activation/Expiration time */ - - NULL, - NULL, - NULL, - NULL - -}; - -static PurpleSslOps ssl_ops = -{ - ssl_gnutls_init, - ssl_gnutls_uninit, - ssl_gnutls_connect, - ssl_gnutls_close, - ssl_gnutls_read, - ssl_gnutls_write, - ssl_gnutls_get_peer_certificates, - - /* padding */ - NULL, - NULL, - NULL -}; - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - if(!purple_ssl_get_ops()) { - purple_ssl_set_ops(&ssl_ops); - } - - /* Init GNUTLS now so others can use it even if sslconn never does */ - ssl_gnutls_init_gnutls(); - - /* Register that we're providing an X.509 CertScheme */ - purple_certificate_register_scheme( &x509_gnutls ); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - if(purple_ssl_get_ops() == &ssl_ops) { - purple_ssl_set_ops(NULL); - } - - purple_certificate_unregister_scheme( &x509_gnutls ); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SSL_GNUTLS_PLUGIN_ID, /**< id */ - N_("GNUTLS"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Provides SSL support through GNUTLS."), - /** description */ - N_("Provides SSL support through GNUTLS."), - "Christian Hammond ", - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ssl_gnutls, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-nss.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-nss.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-nss.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/ssl/ssl-nss.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,972 +0,0 @@ -/** - * @file ssl-nss.c Mozilla NSS SSL plugin. - * - * purple - * - * Copyright (C) 2003 Christian Hammond - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "debug.h" -#include "certificate.h" -#include "plugin.h" -#include "sslconn.h" -#include "util.h" -#include "version.h" - -#define SSL_NSS_PLUGIN_ID "ssl-nss" - -#undef HAVE_LONG_LONG /* Make Mozilla less angry. If angry, Mozilla SMASH! */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* This is defined in NSPR's , but to avoid including a - * private header we duplicate the prototype here */ -NSPR_API(PRFileDesc*) PR_ImportTCPSocket(PRInt32 osfd); - -typedef struct -{ - PRFileDesc *fd; - PRFileDesc *in; - guint handshake_handler; - -} PurpleSslNssData; - -#define PURPLE_SSL_NSS_DATA(gsc) ((PurpleSslNssData *)gsc->private_data) - -static const PRIOMethods *_nss_methods = NULL; -static PRDescIdentity _identity; -static PurpleCertificateScheme x509_nss; - -/* Thank you, Evolution */ -static void -set_errno(int code) -{ - /* FIXME: this should handle more. */ - switch (code) { - case PR_INVALID_ARGUMENT_ERROR: - errno = EINVAL; - break; - case PR_PENDING_INTERRUPT_ERROR: - errno = EINTR; - break; - case PR_IO_PENDING_ERROR: - errno = EAGAIN; - break; - case PR_WOULD_BLOCK_ERROR: - errno = EAGAIN; - /*errno = EWOULDBLOCK; */ - break; - case PR_IN_PROGRESS_ERROR: - errno = EINPROGRESS; - break; - case PR_ALREADY_INITIATED_ERROR: - errno = EALREADY; - break; - case PR_NETWORK_UNREACHABLE_ERROR: - errno = EHOSTUNREACH; - break; - case PR_CONNECT_REFUSED_ERROR: - errno = ECONNREFUSED; - break; - case PR_CONNECT_TIMEOUT_ERROR: - case PR_IO_TIMEOUT_ERROR: - errno = ETIMEDOUT; - break; - case PR_NOT_CONNECTED_ERROR: - errno = ENOTCONN; - break; - case PR_CONNECT_RESET_ERROR: - errno = ECONNRESET; - break; - case PR_IO_ERROR: - default: - errno = EIO; - break; - } -} - -static gchar *get_error_text(void) -{ - PRInt32 len = PR_GetErrorTextLength(); - gchar *ret = NULL; - - if (len > 0) { - ret = g_malloc(len + 1); - len = PR_GetErrorText(ret); - ret[len] = '\0'; - } - - return ret; -} - -static void -ssl_nss_init_nss(void) -{ - char *lib; - PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); - NSS_NoDB_Init("."); - - /* TODO: Fix this so autoconf does the work trying to find this lib. */ -#ifndef _WIN32 - lib = g_strdup(LIBDIR "/libnssckbi.so"); -#else - lib = g_strdup("nssckbi.dll"); -#endif - SECMOD_AddNewModule("Builtins", lib, 0, 0); - g_free(lib); - NSS_SetDomesticPolicy(); - - SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_256_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_256_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_256_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_RC4_128_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 1); - SSL_CipherPrefSetDefault(TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_RSA_WITH_RC4_128_SHA, 1); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_AES_128_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_RSA_WITH_DES_CBC_SHA, 1); - SSL_CipherPrefSetDefault(SSL_DHE_DSS_WITH_DES_CBC_SHA, 1); - - _identity = PR_GetUniqueIdentity("Purple"); - _nss_methods = PR_GetDefaultIOMethods(); -} - -static SECStatus -ssl_auth_cert(void *arg, PRFileDesc *socket, PRBool checksig, - PRBool is_server) -{ - return SECSuccess; - -#if 0 - CERTCertificate *cert; - void *pinArg; - SECStatus status; - - cert = SSL_PeerCertificate(socket); - pinArg = SSL_RevealPinArg(socket); - - status = CERT_VerifyCertNow((CERTCertDBHandle *)arg, cert, checksig, - certUsageSSLClient, pinArg); - - if (status != SECSuccess) { - purple_debug_error("nss", "CERT_VerifyCertNow failed\n"); - CERT_DestroyCertificate(cert); - return status; - } - - CERT_DestroyCertificate(cert); - return SECSuccess; -#endif -} - -#if 0 -static SECStatus -ssl_bad_cert(void *arg, PRFileDesc *socket) -{ - SECStatus status = SECFailure; - PRErrorCode err; - - if (arg == NULL) - return status; - - *(PRErrorCode *)arg = err = PORT_GetError(); - - switch (err) - { - case SEC_ERROR_INVALID_AVA: - case SEC_ERROR_INVALID_TIME: - case SEC_ERROR_BAD_SIGNATURE: - case SEC_ERROR_EXPIRED_CERTIFICATE: - case SEC_ERROR_UNKNOWN_ISSUER: - case SEC_ERROR_UNTRUSTED_CERT: - case SEC_ERROR_CERT_VALID: - case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE: - case SEC_ERROR_CRL_EXPIRED: - case SEC_ERROR_CRL_BAD_SIGNATURE: - case SEC_ERROR_EXTENSION_VALUE_INVALID: - case SEC_ERROR_CA_CERT_INVALID: - case SEC_ERROR_CERT_USAGES_INVALID: - case SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION: - status = SECSuccess; - break; - - default: - status = SECFailure; - break; - } - - purple_debug_error("nss", "Bad certificate: %d\n", err); - - return status; -} -#endif - -static gboolean -ssl_nss_init(void) -{ - return TRUE; -} - -static void -ssl_nss_uninit(void) -{ - PR_Cleanup(); - - _nss_methods = NULL; -} - -static void -ssl_nss_verified_cb(PurpleCertificateVerificationStatus st, - gpointer userdata) -{ - PurpleSslConnection *gsc = (PurpleSslConnection *) userdata; - - if (st == PURPLE_CERTIFICATE_VALID) { - /* Certificate valid? Good! Do the connection! */ - gsc->connect_cb(gsc->connect_cb_data, gsc, PURPLE_INPUT_READ); - } else { - /* Otherwise, signal an error */ - if(gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CERTIFICATE_INVALID, - gsc->connect_cb_data); - purple_ssl_close(gsc); - } -} - -/** Transforms an NSS containing an X.509 certificate into a Certificate instance - * - * @param cert Certificate to transform - * @return A newly allocated Certificate - */ -static PurpleCertificate * -x509_import_from_nss(CERTCertificate* cert) -{ - /* New certificate to return */ - PurpleCertificate * crt; - - /* Allocate the certificate and load it with data */ - crt = g_new0(PurpleCertificate, 1); - crt->scheme = &x509_nss; - crt->data = CERT_DupCertificate(cert); - - return crt; -} - -static GList * -ssl_nss_get_peer_certificates(PRFileDesc *socket, PurpleSslConnection * gsc) -{ - CERTCertificate *curcert; - CERTCertificate *issuerCert; - PurpleCertificate * newcrt; - - /* List of Certificate instances to return */ - GList * peer_certs = NULL; - int count; - int64 now = PR_Now(); - - curcert = SSL_PeerCertificate(socket); - if (curcert == NULL) { - purple_debug_error("nss", "could not DupCertificate\n"); - return NULL; - } - - for (count = 0 ; count < CERT_MAX_CERT_CHAIN ; count++) { - purple_debug_info("nss", "subject=%s issuer=%s\n", curcert->subjectName, - curcert->issuerName ? curcert->issuerName : "(null)"); - newcrt = x509_import_from_nss(curcert); - peer_certs = g_list_append(peer_certs, newcrt); - - if (curcert->isRoot) { - break; - } - issuerCert = CERT_FindCertIssuer(curcert, now, certUsageSSLServer); - if (!issuerCert) { - purple_debug_error("nss", "partial certificate chain\n"); - break; - } - CERT_DestroyCertificate(curcert); - curcert = issuerCert; - } - CERT_DestroyCertificate(curcert); - - return peer_certs; -} - -static void -ssl_nss_handshake_cb(gpointer data, int fd, PurpleInputCondition cond) -{ - PurpleSslConnection *gsc = (PurpleSslConnection *)data; - PurpleSslNssData *nss_data = gsc->private_data; - - /* I don't think this the best way to do this... - * It seems to work because it'll eventually use the cached value - */ - if(SSL_ForceHandshake(nss_data->in) != SECSuccess) { - gchar *error_txt; - set_errno(PR_GetError()); - if (errno == EAGAIN || errno == EWOULDBLOCK) - return; - - error_txt = get_error_text(); - purple_debug_error("nss", "Handshake failed %s (%d)\n", error_txt ? error_txt : "", PR_GetError()); - g_free(error_txt); - - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data); - - purple_ssl_close(gsc); - - return; - } - - purple_input_remove(nss_data->handshake_handler); - nss_data->handshake_handler = 0; - - /* If a Verifier was given, hand control over to it */ - if (gsc->verifier) { - GList *peers; - /* First, get the peer cert chain */ - peers = ssl_nss_get_peer_certificates(nss_data->in, gsc); - - /* Now kick off the verification process */ - purple_certificate_verify(gsc->verifier, - gsc->host, - peers, - ssl_nss_verified_cb, - gsc); - - purple_certificate_destroy_list(peers); - } else { - /* Otherwise, just call the "connection complete" - callback */ - gsc->connect_cb(gsc->connect_cb_data, gsc, cond); - } -} - -static void -ssl_nss_connect(PurpleSslConnection *gsc) -{ - PurpleSslNssData *nss_data = g_new0(PurpleSslNssData, 1); - PRSocketOptionData socket_opt; - - gsc->private_data = nss_data; - - nss_data->fd = PR_ImportTCPSocket(gsc->fd); - - if (nss_data->fd == NULL) - { - purple_debug_error("nss", "nss_data->fd == NULL!\n"); - - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); - - purple_ssl_close((PurpleSslConnection *)gsc); - - return; - } - - socket_opt.option = PR_SockOpt_Nonblocking; - socket_opt.value.non_blocking = PR_TRUE; - - if (PR_SetSocketOption(nss_data->fd, &socket_opt) != PR_SUCCESS) { - gchar *error_txt = get_error_text(); - purple_debug_warning("nss", "unable to set socket into non-blocking mode: %s (%d)\n", error_txt ? error_txt : "", PR_GetError()); - g_free(error_txt); - } - - nss_data->in = SSL_ImportFD(NULL, nss_data->fd); - - if (nss_data->in == NULL) - { - purple_debug_error("nss", "nss_data->in == NUL!\n"); - - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); - - purple_ssl_close((PurpleSslConnection *)gsc); - - return; - } - - SSL_OptionSet(nss_data->in, SSL_SECURITY, PR_TRUE); - SSL_OptionSet(nss_data->in, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE); - - SSL_AuthCertificateHook(nss_data->in, - (SSLAuthCertificate)ssl_auth_cert, - (void *)CERT_GetDefaultCertDB()); -#if 0 - /* No point in hooking BadCert, since ssl_auth_cert always succeeds */ - SSL_BadCertHook(nss_data->in, (SSLBadCertHandler)ssl_bad_cert, NULL); -#endif - - if(gsc->host) - SSL_SetURL(nss_data->in, gsc->host); - -#if 0 - /* This seems like it'd the be the correct way to implement the - nonblocking stuff, but it doesn't seem to work */ - SSL_HandshakeCallback(nss_data->in, - (SSLHandshakeCallback) ssl_nss_handshake_cb, gsc); -#endif - SSL_ResetHandshake(nss_data->in, PR_FALSE); - - nss_data->handshake_handler = purple_input_add(gsc->fd, - PURPLE_INPUT_READ, ssl_nss_handshake_cb, gsc); - - ssl_nss_handshake_cb(gsc, gsc->fd, PURPLE_INPUT_READ); -} - -static void -ssl_nss_close(PurpleSslConnection *gsc) -{ - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - - if(!nss_data) - return; - - if (nss_data->in) { - PR_Close(nss_data->in); - gsc->fd = -1; - } else if (nss_data->fd) { - PR_Close(nss_data->fd); - gsc->fd = -1; - } - - if (nss_data->handshake_handler) - purple_input_remove(nss_data->handshake_handler); - - g_free(nss_data); - gsc->private_data = NULL; -} - -static size_t -ssl_nss_read(PurpleSslConnection *gsc, void *data, size_t len) -{ - ssize_t ret; - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - - ret = PR_Read(nss_data->in, data, len); - - if (ret == -1) - set_errno(PR_GetError()); - - return ret; -} - -static size_t -ssl_nss_write(PurpleSslConnection *gsc, const void *data, size_t len) -{ - ssize_t ret; - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - - if(!nss_data) - return 0; - - ret = PR_Write(nss_data->in, data, len); - - if (ret == -1) - set_errno(PR_GetError()); - - return ret; -} - -static GList * -ssl_nss_peer_certs(PurpleSslConnection *gsc) -{ -#if 0 - PurpleSslNssData *nss_data = PURPLE_SSL_NSS_DATA(gsc); - CERTCertificate *cert; -/* - GList *chain = NULL; - void *pinArg; - SECStatus status; -*/ - - /* TODO: this is a blind guess */ - cert = SSL_PeerCertificate(nss_data->fd); - - if (cert) - CERT_DestroyCertificate(cert); -#endif - - - - return NULL; -} - -/************************************************************************/ -/* X.509 functionality */ -/************************************************************************/ -static PurpleCertificateScheme x509_nss; - -/** Helpr macro to retrieve the NSS certdata from a PurpleCertificate */ -#define X509_NSS_DATA(pcrt) ( (CERTCertificate * ) (pcrt->data) ) - -/** Imports a PEM-formatted X.509 certificate from the specified file. - * @param filename Filename to import from. Format is PEM - * - * @return A newly allocated Certificate structure of the x509_gnutls scheme - */ -static PurpleCertificate * -x509_import_from_file(const gchar *filename) -{ - gchar *rawcert; - gsize len = 0; - CERTCertificate *crt_dat; - PurpleCertificate *crt; - - g_return_val_if_fail(filename != NULL, NULL); - - purple_debug_info("nss/x509", - "Loading certificate from %s\n", - filename); - - /* Load the raw data up */ - if (!g_file_get_contents(filename, - &rawcert, &len, - NULL)) { - purple_debug_error("nss/x509", "Unable to read certificate file.\n"); - return NULL; - } - - if (len == 0) { - purple_debug_error("nss/x509", - "Certificate file has no contents!\n"); - if (rawcert) - g_free(rawcert); - return NULL; - } - - /* Decode the certificate */ - crt_dat = CERT_DecodeCertFromPackage(rawcert, len); - g_free(rawcert); - - g_return_val_if_fail(crt_dat != NULL, NULL); - - crt = g_new0(PurpleCertificate, 1); - crt->scheme = &x509_nss; - crt->data = crt_dat; - - return crt; -} - -/** - * Exports a PEM-formatted X.509 certificate to the specified file. - * @param filename Filename to export to. Format will be PEM - * @param crt Certificate to export - * - * @return TRUE if success, otherwise FALSE - */ -/* This function should not be so complicated, but NSS doesn't seem to have a - "convert yon certificate to PEM format" function. */ -static gboolean -x509_export_certificate(const gchar *filename, PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - SECItem *dercrt; - gchar *b64crt; - gchar *pemcrt; - gboolean ret = FALSE; - - g_return_val_if_fail(filename, FALSE); - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_nss, FALSE); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, FALSE); - - purple_debug_info("nss/x509", - "Exporting certificate to %s\n", filename); - - /* First, use NSS voodoo to create a DER-formatted certificate */ - dercrt = SEC_ASN1EncodeItem(NULL, NULL, crt_dat, - SEC_ASN1_GET(SEC_SignedCertificateTemplate)); - g_return_val_if_fail(dercrt != NULL, FALSE); - - /* Now encode it to b64 */ - b64crt = NSSBase64_EncodeItem(NULL, NULL, 0, dercrt); - SECITEM_FreeItem(dercrt, PR_TRUE); - g_return_val_if_fail(b64crt, FALSE); - - /* Wrap it in nice PEM header things */ - pemcrt = g_strdup_printf("-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n", b64crt); - PORT_Free(b64crt); /* Notice that b64crt was allocated by an NSS - function; hence, we'll let NSPR free it. */ - - /* Finally, dump the silly thing to a file. */ - ret = purple_util_write_data_to_file_absolute(filename, pemcrt, -1); - - g_free(pemcrt); - - return ret; -} - -static PurpleCertificate * -x509_copy_certificate(PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - PurpleCertificate *newcrt; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - /* Create the certificate copy */ - newcrt = g_new0(PurpleCertificate, 1); - newcrt->scheme = &x509_nss; - /* NSS does refcounting automatically */ - newcrt->data = CERT_DupCertificate(crt_dat); - - return newcrt; -} - -/** Frees a Certificate - * - * Destroys a Certificate's internal data structures and frees the pointer - * given. - * @param crt Certificate instance to be destroyed. It WILL NOT be destroyed - * if it is not of the correct CertificateScheme. Can be NULL - * - */ -static void -x509_destroy_certificate(PurpleCertificate * crt) -{ - CERTCertificate *crt_dat; - - g_return_if_fail(crt); - g_return_if_fail(crt->scheme == &x509_nss); - - crt_dat = X509_NSS_DATA(crt); - g_return_if_fail(crt_dat); - - /* Finally we have the certificate. So let's kill it */ - /* NSS does refcounting automatically */ - CERT_DestroyCertificate(crt_dat); - - /* Delete the PurpleCertificate as well */ - g_free(crt); -} - -/** Determines whether one certificate has been issued and signed by another - * - * @param crt Certificate to check the signature of - * @param issuer Issuer's certificate - * - * @return TRUE if crt was signed and issued by issuer, otherwise FALSE - * @TODO Modify this function to return a reason for invalidity? - */ -static gboolean -x509_signed_by(PurpleCertificate * crt, - PurpleCertificate * issuer) -{ - CERTCertificate *subjectCert; - CERTCertificate *issuerCert; - SECStatus st; - - issuerCert = X509_NSS_DATA(issuer); - g_return_val_if_fail(issuerCert, FALSE); - - subjectCert = X509_NSS_DATA(crt); - g_return_val_if_fail(subjectCert, FALSE); - - if (subjectCert->issuerName == NULL - || PORT_Strcmp(subjectCert->issuerName, issuerCert->subjectName) != 0) - return FALSE; - st = CERT_VerifySignedData(&subjectCert->signatureWrap, issuerCert, PR_Now(), NULL); - return st == SECSuccess; -} - -static GByteArray * -x509_sha1sum(PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - size_t hashlen = 20; /* Size of an sha1sum */ - GByteArray *sha1sum; - SECItem *derCert; /* DER representation of the cert */ - SECStatus st; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - /* Get the certificate DER representation */ - derCert = &(crt_dat->derCert); - - /* Make a hash! */ - sha1sum = g_byte_array_sized_new(hashlen); - /* glib leaves the size as 0 by default */ - sha1sum->len = hashlen; - - st = PK11_HashBuf(SEC_OID_SHA1, sha1sum->data, - derCert->data, derCert->len); - - /* Check for errors */ - if (st != SECSuccess) { - g_byte_array_free(sha1sum, TRUE); - purple_debug_error("nss/x509", - "Error: hashing failed!\n"); - return NULL; - } - - return sha1sum; -} - -static gchar * -x509_dn (PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - return g_strdup(crt_dat->subjectName); -} - -static gchar * -x509_issuer_dn (PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - return g_strdup(crt_dat->issuerName); -} - -static gchar * -x509_common_name (PurpleCertificate *crt) -{ - CERTCertificate *crt_dat; - char *nss_cn; - gchar *ret_cn; - - g_return_val_if_fail(crt, NULL); - g_return_val_if_fail(crt->scheme == &x509_nss, NULL); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, NULL); - - /* Q: - Why get a newly allocated string out of NSS, strdup it, and then - return the new copy? - - A: - The NSS LXR docs state that I should use the NSPR free functions on - the strings that the NSS cert functions return. Since the libpurple - API expects a g_free()-able string, we make our own copy and return - that. - - NSPR is something of a prima donna. */ - - nss_cn = CERT_GetCommonName( &(crt_dat->subject) ); - ret_cn = g_strdup(nss_cn); - PORT_Free(nss_cn); - - return ret_cn; -} - -static gboolean -x509_check_name (PurpleCertificate *crt, const gchar *name) -{ - CERTCertificate *crt_dat; - SECStatus st; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_nss, FALSE); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, FALSE); - - st = CERT_VerifyCertName(crt_dat, name); - - if (st == SECSuccess) { - return TRUE; - } - else if (st == SECFailure) { - return FALSE; - } - - /* If we get here...bad things! */ - purple_debug_error("nss/x509", - "x509_check_name fell through where it shouldn't " - "have.\n"); - return FALSE; -} - -static gboolean -x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration) -{ - CERTCertificate *crt_dat; - PRTime nss_activ, nss_expir; - - g_return_val_if_fail(crt, FALSE); - g_return_val_if_fail(crt->scheme == &x509_nss, FALSE); - - crt_dat = X509_NSS_DATA(crt); - g_return_val_if_fail(crt_dat, FALSE); - - /* Extract the times into ugly PRTime thingies */ - /* TODO: Maybe this shouldn't throw an error? */ - g_return_val_if_fail( - SECSuccess == CERT_GetCertTimes(crt_dat, - &nss_activ, &nss_expir), - FALSE); - - /* NSS's native PRTime type *almost* corresponds to time_t; however, - it measures *microseconds* since the epoch, not seconds. Hence - the funny conversion. */ - if (activation) { - *activation = nss_activ / 1000000; - } - if (expiration) { - *expiration = nss_expir / 1000000; - } - - return TRUE; -} - -static PurpleCertificateScheme x509_nss = { - "x509", /* Scheme name */ - N_("X.509 Certificates"), /* User-visible scheme name */ - x509_import_from_file, /* Certificate import function */ - x509_export_certificate, /* Certificate export function */ - x509_copy_certificate, /* Copy */ - x509_destroy_certificate, /* Destroy cert */ - x509_signed_by, /* Signed-by */ - x509_sha1sum, /* SHA1 fingerprint */ - x509_dn, /* Unique ID */ - x509_issuer_dn, /* Issuer Unique ID */ - x509_common_name, /* Subject name */ - x509_check_name, /* Check subject name */ - x509_times, /* Activation/Expiration time */ - - NULL, - NULL, - NULL, - NULL -}; - -static PurpleSslOps ssl_ops = -{ - ssl_nss_init, - ssl_nss_uninit, - ssl_nss_connect, - ssl_nss_close, - ssl_nss_read, - ssl_nss_write, - ssl_nss_peer_certs, - - /* padding */ - NULL, - NULL, - NULL -}; - - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - if (!purple_ssl_get_ops()) { - purple_ssl_set_ops(&ssl_ops); - } - - /* Init NSS now, so others can use it even if sslconn never does */ - ssl_nss_init_nss(); - - /* Register the X.509 functions we provide */ - purple_certificate_register_scheme(&x509_nss); - - return TRUE; -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - if (purple_ssl_get_ops() == &ssl_ops) { - purple_ssl_set_ops(NULL); - } - - /* Unregister our X.509 functions */ - purple_certificate_unregister_scheme(&x509_nss); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - PURPLE_PLUGIN_FLAG_INVISIBLE, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - SSL_NSS_PLUGIN_ID, /**< id */ - N_("NSS"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Provides SSL support through Mozilla NSS."), - /** description */ - N_("Provides SSL support through Mozilla NSS."), - "Christian Hammond ", - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, /**< actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ -} - -PURPLE_INIT_PLUGIN(ssl_nss, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/startup.py qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/startup.py --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/startup.py 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/startup.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -#!/usr/bin/env python -# -# Makes sure only one purple instance is running -# -# Purple is the legal property of its developers, whose names are too numerous -# to list here. Please refer to the COPYRIGHT file distributed with this -# source distribution. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -# - -import sys -import dbus -import os - -if len(sys.argv) == 1: - print "Usage:", sys.argv[0], """ [arguments] - -Example: - """, sys.argv[0], "pidgin -d -c /my/home" - sys.exit(1) - -home = os.path.expanduser('~/.purple/') -for arg in range(1, len(sys.argv[1:])): - if sys.argv[arg] == "-c": - home = os.path.expanduser(sys.argv[arg + 1]) - break - -bus = dbus.SessionBus() - -try: - obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") - purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - userdir = purple.PurpleUserDir() - if not os.path.isabs(userdir): - userdir = os.path.join(purple.PurpleHomeDir(), userdir) - if home == userdir: - print "Already running." - purple.PurpleBlistShow() - else: - print "Starting client from a different home directory." - raise -except: - os.execlp(sys.argv[1], " ".join(sys.argv[2:])) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/statenotify.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/statenotify.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/statenotify.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/statenotify.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,197 +0,0 @@ -#include "internal.h" - -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "signals.h" -#include "version.h" - -#include "plugin.h" -#include "pluginpref.h" -#include "prefs.h" - -#define STATENOTIFY_PLUGIN_ID "core-statenotify" - -static void -write_status(PurpleBuddy *buddy, const char *message) -{ - PurpleAccount *account = NULL; - PurpleConversation *conv; - const char *who; - char buf[256]; - char *escaped; - const gchar *buddy_name = NULL; - - account = purple_buddy_get_account(buddy); - buddy_name = purple_buddy_get_name(buddy); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - buddy_name, account); - - if (conv == NULL) - return; - g_return_if_fail(conv->type == PURPLE_CONV_TYPE_IM); - - /* Prevent duplicate notifications for buddies in multiple groups */ - if (buddy != purple_find_buddy(account, buddy_name)) - return; - - who = purple_buddy_get_alias(buddy); - escaped = g_markup_escape_text(who, -1); - - g_snprintf(buf, sizeof(buf), message, escaped); - g_free(escaped); - - purple_conv_im_write(conv->u.im, NULL, buf, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ACTIVE_ONLY | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); -} - -static void -buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, - PurpleStatus *status, void *data) -{ - gboolean available, old_available; - - if (!purple_status_is_exclusive(status) || - !purple_status_is_exclusive(old_status)) - return; - - available = purple_status_is_available(status); - old_available = purple_status_is_available(old_status); - - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_away")) { - if (available && !old_available) - write_status(buddy, _("%s is no longer away.")); - else if (!available && old_available) - write_status(buddy, _("%s has gone away.")); - } -} - -static void -buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, - void *data) -{ - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_idle")) { - if (idle && !old_idle) { - write_status(buddy, _("%s has become idle.")); - } else if (!idle && old_idle) { - write_status(buddy, _("%s is no longer idle.")); - } - } -} - -static void -buddy_signon_cb(PurpleBuddy *buddy, void *data) -{ - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_signon")) - write_status(buddy, _("%s has signed on.")); -} - -static void -buddy_signoff_cb(PurpleBuddy *buddy, void *data) -{ - if (purple_prefs_get_bool("/plugins/core/statenotify/notify_signon")) - write_status(buddy, _("%s has signed off.")); -} - -static PurplePluginPrefFrame * -get_plugin_pref_frame(PurplePlugin *plugin) -{ - PurplePluginPrefFrame *frame; - PurplePluginPref *ppref; - - frame = purple_plugin_pref_frame_new(); - - ppref = purple_plugin_pref_new_with_label(_("Notify When")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_away", _("Buddy Goes _Away")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_idle", _("Buddy Goes _Idle")); - purple_plugin_pref_frame_add(frame, ppref); - - ppref = purple_plugin_pref_new_with_name_and_label("/plugins/core/statenotify/notify_signon", _("Buddy _Signs On/Off")); - purple_plugin_pref_frame_add(frame, ppref); - - return frame; -} - -static gboolean -plugin_load(PurplePlugin *plugin) -{ - void *blist_handle = purple_blist_get_handle(); - - purple_signal_connect(blist_handle, "buddy-status-changed", plugin, - PURPLE_CALLBACK(buddy_status_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-idle-changed", plugin, - PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-on", plugin, - PURPLE_CALLBACK(buddy_signon_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-off", plugin, - PURPLE_CALLBACK(buddy_signoff_cb), NULL); - - return TRUE; -} - -static PurplePluginUiInfo prefs_info = -{ - get_plugin_pref_frame, - 0, /* page_num (Reserved) */ - NULL, /* frame (Reserved) */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_STANDARD, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - STATENOTIFY_PLUGIN_ID, /**< id */ - N_("Buddy State Notification"), /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Notifies in a conversation window when a buddy goes or returns from " - "away or idle."), - /** description */ - N_("Notifies in a conversation window when a buddy goes or returns from " - "away or idle."), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - plugin_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - NULL, /**< extra_info */ - &prefs_info, /**< prefs_info */ - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - purple_prefs_add_none("/plugins/core/statenotify"); - purple_prefs_add_bool("/plugins/core/statenotify/notify_away", TRUE); - purple_prefs_add_bool("/plugins/core/statenotify/notify_idle", TRUE); - purple_prefs_add_bool("/plugins/core/statenotify/notify_signon", TRUE); -} - -PURPLE_INIT_PLUGIN(statenotify, init_plugin, info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -tcl_la_LDFLAGS = -module -avoid-version - -plugin_LTLIBRARIES = tcl.la - -tcl_la_SOURCES = tcl.c tcl_glib.c tcl_glib.h tcl_cmds.c tcl_signals.c tcl_purple.h \ - tcl_ref.c tcl_cmd.c - -tcl_la_LIBADD = $(GLIB_LIBS) $(TCL_LIBS) $(TK_LIBS) - -EXTRA_DIST = signal-test.tcl Makefile.mingw - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(TK_CFLAGS) \ - $(TCL_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,720 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/plugins/tcl -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(plugindir)" -pluginLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(plugin_LTLIBRARIES) -am__DEPENDENCIES_1 = -tcl_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am_tcl_la_OBJECTS = tcl.lo tcl_glib.lo tcl_cmds.lo tcl_signals.lo \ - tcl_ref.lo tcl_cmd.lo -tcl_la_OBJECTS = $(am_tcl_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(tcl_la_SOURCES) -DIST_SOURCES = $(tcl_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -plugindir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -tcl_la_LDFLAGS = -module -avoid-version -plugin_LTLIBRARIES = tcl.la -tcl_la_SOURCES = tcl.c tcl_glib.c tcl_glib.h tcl_cmds.c tcl_signals.c tcl_purple.h \ - tcl_ref.c tcl_cmd.c - -tcl_la_LIBADD = $(GLIB_LIBS) $(TCL_LIBS) $(TK_LIBS) -EXTRA_DIST = signal-test.tcl Makefile.mingw -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(PLUGIN_CFLAGS) \ - $(TK_CFLAGS) \ - $(TCL_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/plugins/tcl/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/plugins/tcl/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(plugindir)" || $(mkdir_p) "$(DESTDIR)$(plugindir)" - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \ - else :; fi; \ - done - -uninstall-pluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \ - done - -clean-pluginLTLIBRARIES: - -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) - @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -tcl.la: $(tcl_la_OBJECTS) $(tcl_la_DEPENDENCIES) - $(LINK) -rpath $(plugindir) $(tcl_la_LDFLAGS) $(tcl_la_OBJECTS) $(tcl_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_cmd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_cmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_glib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_ref.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcl_signals.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(plugindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pluginLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for tcl plugin loader plugin. -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = tcl -TCL_INC_DIR := $(TCL_LIB_TOP)/include -DEFINES += -DHAVE_TK -DUSE_TCL_STUBS -DUSE_TK_STUBS - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(TCL_INC_DIR) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(TCL_LIB_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = tcl.c \ - tcl_cmd.c \ - tcl_cmds.c \ - tcl_glib.c \ - tcl_ref.c \ - tcl_signals.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -ltclstub84 \ - -ltkstub84 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(PURPLE_INSTALL_PLUGINS_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_PLUGINS_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -rf $(OBJECTS) - rm -rf $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/signal-test.tcl qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/signal-test.tcl --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/signal-test.tcl 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/signal-test.tcl 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -purple::signal connect [purple::account handle] account-away { account state message } { - purple::debug -info "tcl signal" "account-away [purple::account username $account] \"$state\" \"$message\"" -} - -purple::signal connect [purple::account handle] account-connecting { account } { - purple::debug -info "tcl signal" "account-connecting [purple::account username $account]" -} - -purple::signal connect [purple::account handle] account-set-info { account info } { - purple::debug -info "tcl signal" "account-set-info [purple::account username $account] $info" -} - -purple::signal connect [purple::account handle] account-setting-info { account info } { - purple::debug -info "tcl signal" "account-set-info [purple::account username $account] $info" -} - -purple::signal connect [purple::buddy handle] buddy-away { buddy } { - purple::debug -info "tcl signal" "buddy-away [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-back { buddy } { - purple::debug -info "tcl signal" "buddy-back [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-idle { buddy } { - purple::debug -info "tcl signal" "buddy-idle [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-unidle { buddy } { - purple::debug -info "tcl signal" "buddy-unidle [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-signed-on { buddy } { - purple::debug -info "tcl signal" "buddy-signed-on [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::buddy handle] buddy-signed-off { buddy } { - purple::debug -info "tcl signal" "buddy-signed-off [purple::account username [lindex $buddy 2]] [lindex $buddy 1]" -} - -purple::signal connect [purple::core handle] quitting {} { - purple::debug -info "tcl signal" "quitting" -} - -purple::signal connect [purple::conversation handle] receiving-chat-msg { account who what id flags } { - purple::debug -info "tcl signal" "receiving-chat-msg [purple::account username $account] $id $flags $who \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] receiving-im-msg { account who what id flags } { - purple::debug -info "tcl signal" "receiving-im-msg [purple::account username $account] $id $flags $who \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] received-chat-msg { account who what id flags } { - purple::debug -info "tcl signal" "received-chat-msg [purple::account username $account] $id $flags $who \"$what\"" -} - -purple::signal connect [purple::conversation handle] received-im-msg { account who what id flags } { - purple::debug -info "tcl signal" "received-im-msg [purple::account username $account] $id $flags $who \"$what\"" -} - -purple::signal connect [purple::conversation handle] sending-chat-msg { account what id } { - purple::debug -info "tcl signal" "sending-chat-msg [purple::account username $account] $id \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] sending-im-msg { account who what } { - purple::debug -info "tcl signal" "sending-im-msg [purple::account username $account] $who \"$what\"" - return 0 -} - -purple::signal connect [purple::conversation handle] sent-chat-msg { account id what } { - purple::debug -info "tcl signal" "sent-chat-msg [purple::account username $account] $id \"$what\"" -} - -purple::signal connect [purple::conversation handle] sent-im-msg { account who what } { - purple::debug -info "tcl signal" "sent-im-msg [purple::account username $account] $who \"$what\"" -} - -purple::signal connect [purple::connection handle] signed-on { gc } { - purple::debug -info "tcl signal" "signed-on [purple::account username [purple::connection account $gc]]" -} - -purple::signal connect [purple::connection handle] signed-off { gc } { - purple::debug -info "tcl signal" "signed-off [purple::account username [purple::connection account $gc]]" -} - -purple::signal connect [purple::connection handle] signing-on { gc } { - purple::debug -info "tcl signal" "signing-on [purple::account username [purple::connection account $gc]]" -} - -if { 0 } { -purple::signal connect signing-off { - purple::debug -info "tcl signal" "signing-off [purple::account username [purple::connection account $event::gc]]" -} - -purple::signal connect update-idle { - purple::debug -info "tcl signal" "update-idle" -} -} - -purple::signal connect [purple::plugins handle] plugin-load args { - purple::debug -info "tcl signal" "plugin-load [list $args]" -} - -purple::signal connect [purple::plugins handle] plugin-unload args { - purple::debug -info "tcl signal" "plugin-unload [list $args]" -} - -purple::signal connect [purple::savedstatuses handle] savedstatus-changed args { - purple::debug -info "tcl signal" "savedstatus-changed [list $args]" - purple::debug -info "tcl signal" "purple::savedstatus current = [purple::savedstatus current]" -} - -proc plugin_init { } { - list "Tcl Signal Test" \ - "$purple::version" \ - "Tests Tcl signal handlers" \ - "Debugs a ridiculous amount of signal information." \ - "Ethan Blanton " \ - "http://www.pidgin.im/" -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,555 +0,0 @@ -/** - * @file tcl.c Purple Tcl plugin bindings - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "config.h" - -#include - -#ifdef HAVE_TK -#include -#endif - -#include -#include -#include -#include -#include - -#include "tcl_glib.h" -#include "tcl_purple.h" - -#include "internal.h" -#include "connection.h" -#include "plugin.h" -#include "signals.h" -#include "debug.h" -#include "util.h" -#include "version.h" - -struct tcl_plugin_data { - PurplePlugin *plugin; - Tcl_Interp *interp; -}; - -PurpleStringref *PurpleTclRefAccount; -PurpleStringref *PurpleTclRefConnection; -PurpleStringref *PurpleTclRefConversation; -PurpleStringref *PurpleTclRefPointer; -PurpleStringref *PurpleTclRefPlugin; -PurpleStringref *PurpleTclRefPresence; -PurpleStringref *PurpleTclRefStatus; -PurpleStringref *PurpleTclRefStatusAttr; -PurpleStringref *PurpleTclRefStatusType; -PurpleStringref *PurpleTclRefXfer; -PurpleStringref *PurpleTclRefHandle; - -static GHashTable *tcl_plugins = NULL; - -PurplePlugin *_tcl_plugin; - -static gboolean tcl_loaded = FALSE; - -PurplePlugin *tcl_interp_get_plugin(Tcl_Interp *interp) -{ - struct tcl_plugin_data *data; - - if (tcl_plugins == NULL) - return NULL; - - data = g_hash_table_lookup(tcl_plugins, (gpointer)interp); - return data != NULL ? data->plugin : NULL; -} - -static int tcl_init_interp(Tcl_Interp *interp) -{ - char *rcfile; - char init[] = - "namespace eval ::purple {\n" - " namespace export account buddy connection conversation\n" - " namespace export core debug notify prefs send_im\n" - " namespace export signal unload\n" - " namespace eval _callback { }\n" - "\n" - " proc conv_send { account who text } {\n" - " set gc [purple::account connection $account]\n" - " set convo [purple::conversation new $account $who]\n" - " set myalias [purple::account alias $account]\n" - "\n" - " if {![string length $myalias]} {\n" - " set myalias [purple::account username $account]\n" - " }\n" - "\n" - " purple::send_im $gc $who $text\n" - " purple::conversation write $convo send $myalias $text\n" - " }\n" - "}\n" - "\n" - "proc bgerror { message } {\n" - " global errorInfo\n" - " purple::notify -error \"Tcl Error\" \"Tcl Error: $message\" \"$errorInfo\"\n" - "}\n"; - - if (Tcl_EvalEx(interp, init, -1, TCL_EVAL_GLOBAL) != TCL_OK) { - return 1; - } - - Tcl_SetVar(interp, "argc", "0", TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "argv0", "purple", TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); - rcfile = g_strdup_printf("%s" G_DIR_SEPARATOR_S "tclrc", purple_user_dir()); - Tcl_SetVar(interp, "tcl_rcFileName", rcfile, TCL_GLOBAL_ONLY); - g_free(rcfile); - - Tcl_SetVar(interp, "::purple::version", VERSION, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "::purple::user_dir", purple_user_dir(), TCL_GLOBAL_ONLY); -#ifdef HAVE_TK - Tcl_SetVar(interp, "::purple::tk_available", "1", TCL_GLOBAL_ONLY); -#else - Tcl_SetVar(interp, "::purple::tk_available", "0", TCL_GLOBAL_ONLY); -#endif /* HAVE_TK */ - - Tcl_CreateObjCommand(interp, "::purple::account", tcl_cmd_account, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::buddy", tcl_cmd_buddy, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::cmd", tcl_cmd_cmd, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::connection", tcl_cmd_connection, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::conversation", tcl_cmd_conversation, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::core", tcl_cmd_core, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::debug", tcl_cmd_debug, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::notify", tcl_cmd_notify, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::plugins", tcl_cmd_plugins, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::prefs", tcl_cmd_prefs, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::presence", tcl_cmd_presence, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::send_im", tcl_cmd_send_im, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::savedstatus", tcl_cmd_savedstatus, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::signal", tcl_cmd_signal, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::status", tcl_cmd_status, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::status_attr", tcl_cmd_status_attr, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::status_type", tcl_cmd_status_type, (ClientData)NULL, NULL); - Tcl_CreateObjCommand(interp, "::purple::unload", tcl_cmd_unload, (ClientData)NULL, NULL); - - return 0; -} - -static Tcl_Interp *tcl_create_interp(void) -{ - Tcl_Interp *interp; - - interp = Tcl_CreateInterp(); - if (Tcl_Init(interp) == TCL_ERROR) { - Tcl_DeleteInterp(interp); - return NULL; - } - - if (tcl_init_interp(interp)) { - Tcl_DeleteInterp(interp); - return NULL; - } - Tcl_StaticPackage(interp, "purple", tcl_init_interp, NULL); - - return interp; -} - -static gboolean tcl_probe_plugin(PurplePlugin *plugin) -{ - PurplePluginInfo *info; - Tcl_Interp *interp; - Tcl_Parse parse; - Tcl_Obj *result, **listitems; - struct stat st; - FILE *fp; - char *buf, *cur; - const char *next; - int len, found = 0, err = 0, nelems; - gboolean status = FALSE; - if ((fp = g_fopen(plugin->path, "r")) == NULL) - return FALSE; - if (fstat(fileno(fp), &st)) { - fclose(fp); - return FALSE; - } - len = st.st_size; - - buf = g_malloc(len + 1); - - cur = buf; - while (fgets(cur, GPOINTER_TO_INT(buf) - (buf - cur), fp)) { - cur += strlen(cur); - if (feof(fp)) - break; - } - - if (ferror(fp)) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error reading %s (%s)\n", plugin->path, g_strerror(errno)); - g_free(buf); - fclose(fp); - return FALSE; - } - - fclose(fp); - - if ((interp = tcl_create_interp()) == NULL) { - return FALSE; - } - - next = buf; - do { - if (Tcl_ParseCommand(interp, next, len, 0, &parse) == TCL_ERROR) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "parse error in %s: %s\n", plugin->path, - Tcl_GetString(Tcl_GetObjResult(interp))); - err = 1; - break; - } - if (parse.tokenPtr[0].type == TCL_TOKEN_SIMPLE_WORD - && !strncmp(parse.tokenPtr[0].start, "proc", parse.tokenPtr[0].size)) { - if (!strncmp(parse.tokenPtr[2].start, "plugin_init", parse.tokenPtr[2].size)) { - if (Tcl_EvalEx(interp, parse.commandStart, parse.commandSize, TCL_EVAL_GLOBAL) != TCL_OK) { - Tcl_FreeParse(&parse); - break; - } - found = 1; - /* We'll continue parsing the file, just in case */ - } - } - len -= (parse.commandStart + parse.commandSize) - next; - next = parse.commandStart + parse.commandSize; - Tcl_FreeParse(&parse); - } while (len); - - if (found && !err) { - if (Tcl_EvalEx(interp, "plugin_init", -1, TCL_EVAL_GLOBAL) == TCL_OK) { - result = Tcl_GetObjResult(interp); - if (Tcl_ListObjGetElements(interp, result, &nelems, &listitems) == TCL_OK) { - if ((nelems == 6) || (nelems == 7)) { - info = g_new0(PurplePluginInfo, 1); - - info->magic = PURPLE_PLUGIN_MAGIC; - info->major_version = PURPLE_MAJOR_VERSION; - info->minor_version = PURPLE_MINOR_VERSION; - info->type = PURPLE_PLUGIN_STANDARD; - info->dependencies = g_list_append(info->dependencies, "core-tcl"); - - info->name = g_strdup(Tcl_GetString(listitems[0])); - info->version = g_strdup(Tcl_GetString(listitems[1])); - info->summary = g_strdup(Tcl_GetString(listitems[2])); - info->description = g_strdup(Tcl_GetString(listitems[3])); - info->author = g_strdup(Tcl_GetString(listitems[4])); - info->homepage = g_strdup(Tcl_GetString(listitems[5])); - - if (nelems == 6) - info->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[0])); - else if (nelems == 7) - info->id = g_strdup_printf("tcl-%s", Tcl_GetString(listitems[6])); - - plugin->info = info; - - if (purple_plugin_register(plugin)) - status = TRUE; - } - } - } - } - - Tcl_DeleteInterp(interp); - g_free(buf); - return status; -} - -static gboolean tcl_load_plugin(PurplePlugin *plugin) -{ - struct tcl_plugin_data *data; - Tcl_Interp *interp; - Tcl_Obj *result; - - plugin->extra = NULL; - - if ((interp = tcl_create_interp()) == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Could not initialize Tcl interpreter\n"); - return FALSE; - } - - Tcl_SourceRCFile(interp); - - if (Tcl_EvalFile(interp, plugin->path) != TCL_OK) { - result = Tcl_GetObjResult(interp); - purple_debug(PURPLE_DEBUG_ERROR, "tcl", - "Error evaluating %s: %s\n", plugin->path, - Tcl_GetString(result)); - Tcl_DeleteInterp(interp); - return FALSE; - } - - Tcl_Preserve((ClientData)interp); - - data = g_new0(struct tcl_plugin_data, 1); - data->plugin = plugin; - data->interp = interp; - plugin->extra = data; - - g_hash_table_insert(tcl_plugins, (gpointer)interp, (gpointer)data); - - return TRUE; -} - -static gboolean tcl_unload_plugin(PurplePlugin *plugin) -{ - struct tcl_plugin_data *data; - - if (plugin == NULL) - return TRUE; - - data = plugin->extra; - - if (data != NULL) { - g_hash_table_remove(tcl_plugins, (gpointer)(data->interp)); - purple_signals_disconnect_by_handle(data->interp); - tcl_cmd_cleanup(data->interp); - tcl_signal_cleanup(data->interp); - Tcl_Release((ClientData)data->interp); - Tcl_DeleteInterp(data->interp); - g_free(data); - } - - return TRUE; -} - -static void tcl_destroy_plugin(PurplePlugin *plugin) -{ - if (plugin->info != NULL) { - g_free(plugin->info->id); - g_free(plugin->info->name); - g_free(plugin->info->version); - g_free(plugin->info->description); - g_free(plugin->info->author); - g_free(plugin->info->homepage); - } - - return; -} - -static gboolean tcl_load(PurplePlugin *plugin) -{ - if(!tcl_loaded) - return FALSE; - tcl_glib_init(); - tcl_cmd_init(); - tcl_signal_init(); - purple_tcl_ref_init(); - - PurpleTclRefAccount = purple_stringref_new("Account"); - PurpleTclRefConnection = purple_stringref_new("Connection"); - PurpleTclRefConversation = purple_stringref_new("Conversation"); - PurpleTclRefPointer = purple_stringref_new("Pointer"); - PurpleTclRefPlugin = purple_stringref_new("Plugin"); - PurpleTclRefPresence = purple_stringref_new("Presence"); - PurpleTclRefStatus = purple_stringref_new("Status"); - PurpleTclRefStatusAttr = purple_stringref_new("StatusAttr"); - PurpleTclRefStatusType = purple_stringref_new("StatusType"); - PurpleTclRefXfer = purple_stringref_new("Xfer"); - PurpleTclRefHandle = purple_stringref_new("Handle"); - - tcl_plugins = g_hash_table_new(g_direct_hash, g_direct_equal); - -#ifdef HAVE_TK - Tcl_StaticPackage(NULL, "Tk", Tk_Init, Tk_SafeInit); -#endif /* HAVE_TK */ - - return TRUE; -} - -static gboolean tcl_unload(PurplePlugin *plugin) -{ - g_hash_table_destroy(tcl_plugins); - tcl_plugins = NULL; - - purple_stringref_unref(PurpleTclRefAccount); - purple_stringref_unref(PurpleTclRefConnection); - purple_stringref_unref(PurpleTclRefConversation); - purple_stringref_unref(PurpleTclRefPointer); - purple_stringref_unref(PurpleTclRefPlugin); - purple_stringref_unref(PurpleTclRefPresence); - purple_stringref_unref(PurpleTclRefStatus); - purple_stringref_unref(PurpleTclRefStatusAttr); - purple_stringref_unref(PurpleTclRefStatusType); - purple_stringref_unref(PurpleTclRefXfer); - - return TRUE; -} - -static PurplePluginLoaderInfo tcl_loader_info = -{ - NULL, - tcl_probe_plugin, - tcl_load_plugin, - tcl_unload_plugin, - tcl_destroy_plugin, - - /* pidgin */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginInfo tcl_info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_LOADER, - NULL, - 0, - NULL, - PURPLE_PRIORITY_DEFAULT, - "core-tcl", - N_("Tcl Plugin Loader"), - DISPLAY_VERSION, - N_("Provides support for loading Tcl plugins"), - N_("Provides support for loading Tcl plugins"), - "Ethan Blanton ", - PURPLE_WEBSITE, - tcl_load, - tcl_unload, - NULL, - NULL, - &tcl_loader_info, - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -#ifdef _WIN32 -typedef Tcl_Interp* (CALLBACK* LPFNTCLCREATEINTERP)(void); -typedef void (CALLBACK* LPFNTKINIT)(Tcl_Interp*); - -LPFNTCLCREATEINTERP wtcl_CreateInterp = NULL; -LPFNTKINIT wtk_Init = NULL; -#undef Tcl_CreateInterp -#define Tcl_CreateInterp wtcl_CreateInterp -#undef Tk_Init -#define Tk_Init wtk_Init - -static gboolean tcl_win32_init() { - const char regkey[] = "SOFTWARE\\ActiveState\\ActiveTcl\\"; - char *version = NULL; - gboolean retval = FALSE; - - if ((version = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, regkey, "CurrentVersion")) - || (version = wpurple_read_reg_string(HKEY_CURRENT_USER, regkey, "CurrentVersion"))) { - char *path = NULL; - char *regkey2; - char **tokens; - int major = 0, minor = 0, micro = 0; - - tokens = g_strsplit(version, ".", 0); - if (tokens[0] && tokens[1] && tokens[2]) { - major = atoi(tokens[0]); - minor = atoi(tokens[1]); - micro = atoi(tokens[2]); - } - g_strfreev(tokens); - - regkey2 = g_strdup_printf("%s%s\\", regkey, version); - if (!(major == 8 && minor == 4 && micro >= 5)) - purple_debug(PURPLE_DEBUG_INFO, "tcl", "Unsupported ActiveTCL version %s found.\n", version); - else if ((path = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, regkey2, NULL)) || (path = wpurple_read_reg_string(HKEY_CURRENT_USER, regkey2, NULL))) { - char *tclpath; - char *tkpath; - - purple_debug(PURPLE_DEBUG_INFO, "tcl", "Loading ActiveTCL version %s from \"%s\"\n", version, path); - - tclpath = g_build_filename(path, "bin", "tcl84.dll", NULL); - tkpath = g_build_filename(path, "bin", "tk84.dll", NULL); - - if(!(wtcl_CreateInterp = (LPFNTCLCREATEINTERP) wpurple_find_and_loadproc(tclpath, "Tcl_CreateInterp"))) { - purple_debug(PURPLE_DEBUG_INFO, "tcl", "tcl_win32_init error loading Tcl_CreateInterp\n"); - } else { - if(!(wtk_Init = (LPFNTKINIT) wpurple_find_and_loadproc(tkpath, "Tk_Init"))) { - HMODULE mod; - purple_debug(PURPLE_DEBUG_INFO, "tcl", "tcl_win32_init error loading Tk_Init\n"); - if((mod = GetModuleHandle("tcl84.dll"))) - FreeLibrary(mod); - } else { - retval = TRUE; - } - } - g_free(tclpath); - g_free(tkpath); - } - g_free(path); - g_free(regkey2); - } - - g_free(version); - - if (!retval) - purple_debug(PURPLE_DEBUG_INFO, "tcl", _("Unable to detect ActiveTCL installation. If you wish to use TCL plugins, install ActiveTCL from http://www.activestate.com\n")); - - return retval; -} - -#endif /* _WIN32 */ - -static void tcl_init_plugin(PurplePlugin *plugin) -{ -#ifdef USE_TCL_STUBS - Tcl_Interp *interp = NULL; -#endif - _tcl_plugin = plugin; - -#ifdef USE_TCL_STUBS -#ifdef _WIN32 - if(!tcl_win32_init()) - return; -#endif - if(!(interp = Tcl_CreateInterp())) - return; - - if(!Tcl_InitStubs(interp, TCL_VERSION, 0)) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Tcl_InitStubs: %s\n", interp->result); - return; - } -#endif - - Tcl_FindExecutable("purple"); - -#if defined(USE_TK_STUBS) && defined(HAVE_TK) - Tk_Init(interp); - - if(!Tk_InitStubs(interp, TK_VERSION, 0)) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error Tk_InitStubs: %s\n", interp->result); - Tcl_DeleteInterp(interp); - return; - } -#endif - tcl_loaded = TRUE; -#ifdef USE_TCL_STUBS - Tcl_DeleteInterp(interp); -#endif - tcl_loader_info.exts = g_list_append(tcl_loader_info.exts, "tcl"); -} - -PURPLE_INIT_PLUGIN(tcl, tcl_init_plugin, tcl_info) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmd.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmd.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmd.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmd.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/** - * @file tcl_cmd.c Purple Tcl cmd API - * - * purple - * - * Copyright (C) 2006 Etan Reisner - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include - -#include "tcl_purple.h" - -#include "internal.h" -#include "cmds.h" -#include "debug.h" - -static GList *tcl_cmd_callbacks; - -static PurpleCmdRet tcl_cmd_callback(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **errors, - struct tcl_cmd_handler *handler); -static Tcl_Obj *new_cmd_cb_namespace(void); - -void tcl_cmd_init() -{ - tcl_cmd_callbacks = NULL; -} - -void tcl_cmd_handler_free(struct tcl_cmd_handler *handler) -{ - if (handler == NULL) - return; - - Tcl_DecrRefCount(handler->namespace); - g_free(handler); -} - -void tcl_cmd_cleanup(Tcl_Interp *interp) -{ - GList *cur; - struct tcl_cmd_handler *handler; - - for (cur = tcl_cmd_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp) { - purple_cmd_unregister(handler->id); - tcl_cmd_handler_free(handler); - cur->data = NULL; - } - } - tcl_cmd_callbacks = g_list_remove_all(tcl_cmd_callbacks, NULL); -} - -PurpleCmdId tcl_cmd_register(struct tcl_cmd_handler *handler) -{ - int id; - GString *proc; - - if ((id = purple_cmd_register(Tcl_GetString(handler->cmd), - handler->args, handler->priority, - handler->flags, handler->prpl_id, - PURPLE_CMD_FUNC(tcl_cmd_callback), - handler->helpstr, (void *)handler)) == 0) - return 0; - - handler->namespace = new_cmd_cb_namespace (); - Tcl_IncrRefCount(handler->namespace); - proc = g_string_new(""); - g_string_append_printf(proc, "namespace eval %s { proc cb { conv cmd arglist } { %s } }", - Tcl_GetString(handler->namespace), - Tcl_GetString(handler->proc)); - if (Tcl_Eval(handler->interp, proc->str) != TCL_OK) { - Tcl_DecrRefCount(handler->namespace); - g_string_free(proc, TRUE); - return 0; - } - g_string_free(proc, TRUE); - - tcl_cmd_callbacks = g_list_append(tcl_cmd_callbacks, (gpointer)handler); - - return id; -} - -void tcl_cmd_unregister(PurpleCmdId id, Tcl_Interp *interp) -{ - GList *cur; - GString *cmd; - gboolean found = FALSE; - struct tcl_cmd_handler *handler; - - for (cur = tcl_cmd_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp && handler->id == id) { - purple_cmd_unregister(id); - cmd = g_string_sized_new(64); - g_string_printf(cmd, "namespace delete %s", - Tcl_GetString(handler->namespace)); - Tcl_EvalEx(interp, cmd->str, -1, TCL_EVAL_GLOBAL); - tcl_cmd_handler_free(handler); - g_string_free(cmd, TRUE); - cur->data = NULL; - found = TRUE; - break; - } - } - - if (found) - tcl_cmd_callbacks = g_list_remove_all(tcl_cmd_callbacks, NULL); -} - -static PurpleCmdRet tcl_cmd_callback(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **errors, - struct tcl_cmd_handler *handler) -{ - int retval, error, i; - Tcl_Obj *command, *arg, *tclargs, *result; - - command = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(command); - - /* The callback */ - arg = Tcl_DuplicateObj(handler->namespace); - Tcl_AppendStringsToObj(arg, "::cb", NULL); - Tcl_ListObjAppendElement(handler->interp, command, arg); - - /* The conversation */ - arg = purple_tcl_ref_new(PurpleTclRefConversation, conv); - Tcl_ListObjAppendElement(handler->interp, command, arg); - - /* The command */ - arg = Tcl_NewStringObj(cmd, -1); - Tcl_ListObjAppendElement(handler->interp, command, arg); - - /* The args list */ - tclargs = Tcl_NewListObj(0, NULL); - for (i = 0; i < handler->nargs; i++) { - arg = Tcl_NewStringObj(args[i], -1); - - Tcl_ListObjAppendElement(handler->interp, tclargs, arg); - } - Tcl_ListObjAppendElement(handler->interp, command, tclargs); - - if ((error = Tcl_EvalObjEx(handler->interp, command, - TCL_EVAL_GLOBAL)) != TCL_OK) { - gchar *errorstr; - - errorstr = g_strdup_printf("error evaluating callback: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "%s", errorstr); - *errors = errorstr; - retval = PURPLE_CMD_RET_FAILED; - } else { - result = Tcl_GetObjResult(handler->interp); - if ((error = Tcl_GetIntFromObj(handler->interp, result, - &retval)) != TCL_OK) { - gchar *errorstr; - - errorstr = g_strdup_printf("Error retreiving procedure result: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "%s", errorstr); - *errors = errorstr; - retval = PURPLE_CMD_RET_FAILED; - } - } - - return retval; -} - -static Tcl_Obj *new_cmd_cb_namespace() -{ - char name[32]; - static int cbnum; - - g_snprintf(name, sizeof(name), "::purple::_cmd_callback::cb_%d", - cbnum++); - return Tcl_NewStringObj(name, -1); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_cmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1817 +0,0 @@ -/** - * @file tcl_cmds.c Commands for the Purple Tcl plugin bindings - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include - -#include "internal.h" -#include "conversation.h" -#include "connection.h" -#include "eventloop.h" -#include "account.h" -#include "server.h" -#include "notify.h" -#include "blist.h" -#include "savedstatuses.h" -#include "debug.h" -#include "prefs.h" -#include "core.h" - -#include "tcl_purple.h" - -static PurpleAccount *tcl_validate_account(Tcl_Obj *obj, Tcl_Interp *interp); -static PurpleConversation *tcl_validate_conversation(Tcl_Obj *obj, Tcl_Interp *interp); -static PurpleConnection *tcl_validate_gc(Tcl_Obj *obj, Tcl_Interp *interp); - -static PurpleAccount *tcl_validate_account(Tcl_Obj *obj, Tcl_Interp *interp) -{ - PurpleAccount *account; - GList *cur; - - account = purple_tcl_ref_get(interp, obj, PurpleTclRefAccount); - - if (account == NULL) - return NULL; - - for (cur = purple_accounts_get_all(); cur != NULL; cur = g_list_next(cur)) { - if (account == cur->data) - return account; - } - if (interp != NULL) - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid account", -1)); - return NULL; -} - -static PurpleConversation *tcl_validate_conversation(Tcl_Obj *obj, Tcl_Interp *interp) -{ - PurpleConversation *convo; - GList *cur; - - convo = purple_tcl_ref_get(interp, obj, PurpleTclRefConversation); - - if (convo == NULL) - return NULL; - - for (cur = purple_get_conversations(); cur != NULL; cur = g_list_next(cur)) { - if (convo == cur->data) - return convo; - } - if (interp != NULL) - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid conversation", -1)); - return NULL; -} - -static PurpleConnection *tcl_validate_gc(Tcl_Obj *obj, Tcl_Interp *interp) -{ - PurpleConnection *gc; - GList *cur; - - gc = purple_tcl_ref_get(interp, obj, PurpleTclRefConnection); - - if (gc == NULL) - return NULL; - - for (cur = purple_connections_get_all(); cur != NULL; cur = g_list_next(cur)) { - if (gc == cur->data) - return gc; - } - return NULL; -} - -int tcl_cmd_account(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *result, *list, *elem; - const char *cmds[] = { "alias", "connect", "connection", "disconnect", - "enabled", "find", "handle", "isconnected", - "list", "presence", "protocol", "status", - "status_type", "status_types", "username", - NULL }; - enum { CMD_ACCOUNT_ALIAS, - CMD_ACCOUNT_CONNECT, CMD_ACCOUNT_CONNECTION, - CMD_ACCOUNT_DISCONNECT, CMD_ACCOUNT_ENABLED, CMD_ACCOUNT_FIND, - CMD_ACCOUNT_HANDLE, CMD_ACCOUNT_ISCONNECTED, CMD_ACCOUNT_LIST, - CMD_ACCOUNT_PRESENCE, CMD_ACCOUNT_PROTOCOL, CMD_ACCOUNT_STATUS, - CMD_ACCOUNT_STATUS_TYPE, CMD_ACCOUNT_STATUS_TYPES, - CMD_ACCOUNT_USERNAME } cmd; - const char *listopts[] = { "-all", "-online", NULL }; - enum { CMD_ACCOUNTLIST_ALL, CMD_ACCOUNTLIST_ONLINE } listopt; - const char *alias; - GList *cur; - PurpleAccount *account; - PurpleStatus *status; - PurpleStatusType *status_type; - PurpleValue *value; - char *attr_id; - int error; - int b, i; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_ACCOUNT_ALIAS: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - alias = purple_account_get_alias(account); - Tcl_SetObjResult(interp, Tcl_NewStringObj(alias ? (char *)alias : "", -1)); - break; - case CMD_ACCOUNT_CONNECT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (!purple_account_is_connected(account)) - purple_account_connect(account); - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefConnection, - purple_account_get_connection(account))); - break; - case CMD_ACCOUNT_CONNECTION: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefConnection, - purple_account_get_connection(account))); - break; - case CMD_ACCOUNT_DISCONNECT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - purple_account_disconnect(account); - break; - case CMD_ACCOUNT_ENABLED: - if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "account ?enabled?"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_account_get_enabled(account, - purple_core_get_ui()))); - } else { - if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &b)) != TCL_OK) - return TCL_ERROR; - purple_account_set_enabled(account, purple_core_get_ui(), b); - } - break; - case CMD_ACCOUNT_FIND: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "username protocol"); - return TCL_ERROR; - } - account = purple_accounts_find(Tcl_GetString(objv[2]), - Tcl_GetString(objv[3])); - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefAccount, account)); - break; - case CMD_ACCOUNT_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_accounts_get_handle())); - break; - case CMD_ACCOUNT_ISCONNECTED: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_account_is_connected(account))); - break; - case CMD_ACCOUNT_LIST: - listopt = CMD_ACCOUNTLIST_ALL; - if (objc > 3) { - Tcl_WrongNumArgs(interp, 2, objv, "?option?"); - return TCL_ERROR; - } - if (objc == 3) { - if ((error = Tcl_GetIndexFromObj(interp, objv[2], listopts, "option", 0, (int *)&listopt)) != TCL_OK) - return error; - } - list = Tcl_NewListObj(0, NULL); - for (cur = purple_accounts_get_all(); cur != NULL; cur = g_list_next(cur)) { - account = cur->data; - if (listopt == CMD_ACCOUNTLIST_ONLINE && !purple_account_is_connected(account)) - continue; - elem = purple_tcl_ref_new(PurpleTclRefAccount, account); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_ACCOUNT_PRESENCE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefPresence, - purple_account_get_presence(account))); - break; - case CMD_ACCOUNT_PROTOCOL: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_NewStringObj((char *)purple_account_get_protocol_id(account), -1)); - break; - case CMD_ACCOUNT_STATUS: - if (objc < 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account ?status_id name value ...?"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatus, - purple_account_get_active_status(account))); - } else { - GList *l = NULL; - if (objc % 2) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("name without value setting status", -1)); - return TCL_ERROR; - } - status = purple_account_get_status(account, Tcl_GetString(objv[3])); - if (status == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid status for account", -1)); - return TCL_ERROR; - } - for (i = 4; i < objc; i += 2) { - attr_id = Tcl_GetString(objv[i]); - value = purple_status_get_attr_value(status, attr_id); - if (value == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("invalid attribute for account", -1)); - return TCL_ERROR; - } - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: - error = Tcl_GetBooleanFromObj(interp, objv[i + 1], &b); - if (error != TCL_OK) - return error; - l = g_list_append(l, attr_id); - l = g_list_append(l, GINT_TO_POINTER(b)); - break; - case PURPLE_TYPE_INT: - error = Tcl_GetIntFromObj(interp, objv[i + 1], &b); - if (error != TCL_OK) - return error; - l = g_list_append(l, attr_id); - l = g_list_append(l, GINT_TO_POINTER(b)); - break; - case PURPLE_TYPE_STRING: - l = g_list_append(l, attr_id); - l = g_list_append(l, Tcl_GetString(objv[i + 1])); - break; - default: - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown PurpleValue type", -1)); - return TCL_ERROR; - } - } - purple_account_set_status_list(account, Tcl_GetString(objv[3]), TRUE, l); - g_list_free(l); - } - break; - case CMD_ACCOUNT_STATUS_TYPE: - if (objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "account ?statustype? ?-primitive primitive?"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - if (objc == 4) { - status_type = purple_account_get_status_type(account, - Tcl_GetString(objv[3])); - } else { - PurpleStatusPrimitive primitive; - if (strcmp(Tcl_GetString(objv[3]), "-primitive")) { - result = Tcl_NewStringObj("bad option \"", -1); - Tcl_AppendObjToObj(result, objv[3]); - Tcl_AppendToObj(result, "\": should be -primitive", -1); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - primitive = purple_primitive_get_type_from_id(Tcl_GetString(objv[4])); - status_type = purple_account_get_status_type_with_primitive(account, - primitive); - } - if (status_type == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("status type not found", -1)); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatusType, - status_type)); - break; - case CMD_ACCOUNT_STATUS_TYPES: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - list = Tcl_NewListObj(0, NULL); - for (cur = purple_account_get_status_types(account); cur != NULL; - cur = g_list_next(cur)) { - Tcl_ListObjAppendElement(interp, list, - purple_tcl_ref_new(PurpleTclRefStatusType, - cur->data)); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_ACCOUNT_USERNAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "account"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_account_get_username(account), -1)); - break; - } - - return TCL_OK; -} - -static PurpleBlistNode *tcl_list_to_buddy(Tcl_Interp *interp, int count, Tcl_Obj **elems) -{ - PurpleBlistNode *node = NULL; - PurpleAccount *account; - char *name; - char *type; - - if (count < 3) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("list too short", -1)); - return NULL; - } - - type = Tcl_GetString(elems[0]); - name = Tcl_GetString(elems[1]); - if ((account = tcl_validate_account(elems[2], interp)) == NULL) - return NULL; - - if (!strcmp(type, "buddy")) { - node = PURPLE_BLIST_NODE(purple_find_buddy(account, name)); - } else if (!strcmp(type, "group")) { - node = PURPLE_BLIST_NODE(purple_blist_find_chat(account, name)); - } - - return node; -} - -int tcl_cmd_buddy(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *tclgroup, *tclgrouplist, *tclcontact, *tclcontactlist, *tclbud, **elems, *result; - const char *cmds[] = { "alias", "handle", "info", "list", NULL }; - enum { CMD_BUDDY_ALIAS, CMD_BUDDY_HANDLE, CMD_BUDDY_INFO, CMD_BUDDY_LIST } cmd; - PurpleBlistNodeType type; - PurpleBlistNode *node, *gnode, *bnode; - PurpleAccount *account; - PurpleBuddy *bud; - PurpleChat *cnode; - int error, all = 0, count; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_BUDDY_ALIAS: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "buddy"); - return TCL_ERROR; - } - if ((error = Tcl_ListObjGetElements(interp, objv[2], &count, &elems)) != TCL_OK) - return error; - if ((node = tcl_list_to_buddy(interp, count, elems)) == NULL) - return TCL_ERROR; - type = purple_blist_node_get_type(node); - if (type == PURPLE_BLIST_CHAT_NODE) - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); - else if (type == PURPLE_BLIST_BUDDY_NODE) - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_buddy_get_alias((PurpleBuddy *)node), -1)); - return TCL_OK; - break; - case CMD_BUDDY_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_blist_get_handle())); - break; - case CMD_BUDDY_INFO: - if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "( buddy | account username )"); - return TCL_ERROR; - } - if (objc == 3) { - if ((error = Tcl_ListObjGetElements(interp, objv[2], &count, &elems)) != TCL_OK) - return error; - if (count < 3) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("buddy too short", -1)); - return TCL_ERROR; - } - if (strcmp("buddy", Tcl_GetString(elems[0]))) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid buddy", -1)); - return TCL_ERROR; - } - if ((account = tcl_validate_account(elems[2], interp)) == NULL) - return TCL_ERROR; - serv_get_info(purple_account_get_connection(account), Tcl_GetString(elems[1])); - } else { - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - serv_get_info(purple_account_get_connection(account), Tcl_GetString(objv[3])); - } - break; - case CMD_BUDDY_LIST: - if (objc == 3) { - if (!strcmp("-all", Tcl_GetString(objv[2]))) { - all = 1; - } else { - result = Tcl_NewStringObj("",-1); - Tcl_AppendStringsToObj(result, "unknown option: ", Tcl_GetString(objv[2]), NULL); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - } - list = Tcl_NewListObj(0, NULL); - for (gnode = purple_blist_get_root(); gnode != NULL; gnode = purple_blist_node_get_sibling_next(gnode)) { - tclgroup = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, tclgroup, Tcl_NewStringObj("group", -1)); - Tcl_ListObjAppendElement(interp, tclgroup, - Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)gnode), -1)); - tclgrouplist = Tcl_NewListObj(0, NULL); - for (node = purple_blist_node_get_first_child(gnode); node != NULL; node = purple_blist_node_get_sibling_next(node)) { - PurpleAccount *account; - - type = purple_blist_node_get_type(node); - switch (type) { - case PURPLE_BLIST_CONTACT_NODE: - tclcontact = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(tclcontact); - Tcl_ListObjAppendElement(interp, tclcontact, Tcl_NewStringObj("contact", -1)); - tclcontactlist = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(tclcontactlist); - count = 0; - for (bnode = purple_blist_node_get_first_child(node); bnode != NULL; bnode = purple_blist_node_get_sibling_next(bnode)) { - if (purple_blist_node_get_type(bnode) != PURPLE_BLIST_BUDDY_NODE) - continue; - bud = (PurpleBuddy *)bnode; - account = purple_buddy_get_account(bud); - if (!all && !purple_account_is_connected(account)) - continue; - count++; - tclbud = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("buddy", -1)); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_buddy_get_name(bud), -1)); - Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); - Tcl_ListObjAppendElement(interp, tclcontactlist, tclbud); - } - if (count) { - Tcl_ListObjAppendElement(interp, tclcontact, tclcontactlist); - Tcl_ListObjAppendElement(interp, tclgrouplist, tclcontact); - } - Tcl_DecrRefCount(tclcontact); - Tcl_DecrRefCount(tclcontactlist); - break; - case PURPLE_BLIST_CHAT_NODE: - cnode = (PurpleChat *)node; - account = purple_chat_get_account(cnode); - if (!all && !purple_account_is_connected(account)) - continue; - tclbud = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj("chat", -1)); - Tcl_ListObjAppendElement(interp, tclbud, Tcl_NewStringObj(purple_chat_get_name(cnode), -1)); - Tcl_ListObjAppendElement(interp, tclbud, purple_tcl_ref_new(PurpleTclRefAccount, account)); - Tcl_ListObjAppendElement(interp, tclgrouplist, tclbud); - break; - default: - purple_debug(PURPLE_DEBUG_WARNING, "tcl", "Unexpected buddy type %d", type); - continue; - } - } - Tcl_ListObjAppendElement(interp, tclgroup, tclgrouplist); - Tcl_ListObjAppendElement(interp, list, tclgroup); - } - Tcl_SetObjResult(interp, list); - break; - } - - return TCL_OK; -} - -int tcl_cmd_cmd(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "do", "help", "list", "register", "unregister", NULL }; - enum { CMD_CMD_DO, CMD_CMD_HELP, CMD_CMD_LIST, CMD_CMD_REGISTER, CMD_CMD_UNREGISTER } cmd; - struct tcl_cmd_handler *handler; - Tcl_Obj *list, *elem; - PurpleConversation *convo; - PurpleCmdId id; - PurpleCmdStatus status; - int error; - GList *l, *cur; - gchar *escaped, *errstr = NULL; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CMD_DO: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation command"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - escaped = g_markup_escape_text(Tcl_GetString(objv[3]), -1); - status = purple_cmd_do_command(convo, Tcl_GetString(objv[3]), - escaped, &errstr); - g_free(escaped); - Tcl_SetObjResult(interp, - Tcl_NewStringObj(errstr ? (char *)errstr : "", -1)); - g_free(errstr); - if (status != PURPLE_CMD_STATUS_OK) { - return TCL_ERROR; - } - break; - case CMD_CMD_HELP: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation name"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - l = cur = purple_cmd_help(convo, Tcl_GetString(objv[3])); - list = Tcl_NewListObj(0, NULL); - while (cur != NULL) { - elem = Tcl_NewStringObj((char *)cur->data, -1); - Tcl_ListObjAppendElement(interp, list, elem); - cur = g_list_next(cur); - } - g_list_free(l); - Tcl_SetObjResult(interp, list); - break; - case CMD_CMD_LIST: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - l = cur = purple_cmd_list(convo); - list = Tcl_NewListObj(0, NULL); - while (cur != NULL) { - elem = Tcl_NewStringObj((char *)cur->data, -1); - Tcl_ListObjAppendElement(interp, list, elem); - cur = g_list_next(cur); - } - g_list_free(l); - Tcl_SetObjResult(interp, list); - break; - case CMD_CMD_REGISTER: - if (objc != 9) { - Tcl_WrongNumArgs(interp, 2, objv, "cmd arglist priority flags prpl_id proc helpstr"); - return TCL_ERROR; - } - handler = g_new0(struct tcl_cmd_handler, 1); - handler->cmd = objv[2]; - handler->args = Tcl_GetString(objv[3]); - handler->nargs = strlen(handler->args); - if ((error = Tcl_GetIntFromObj(interp, objv[4], - &handler->priority)) != TCL_OK) { - g_free(handler); - return error; - } - if ((error = Tcl_GetIntFromObj(interp, objv[5], - &handler->flags)) != TCL_OK) { - g_free(handler); - return error; - } - handler->prpl_id = Tcl_GetString(objv[6]); - handler->proc = objv[7]; - handler->helpstr = Tcl_GetString(objv[8]); - handler->interp = interp; - if ((id = tcl_cmd_register(handler)) == 0) { - tcl_cmd_handler_free(handler); - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); - } else { - handler->id = id; - Tcl_SetObjResult(interp, Tcl_NewIntObj(id)); - } - break; - case CMD_CMD_UNREGISTER: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "id"); - return TCL_ERROR; - } - if ((error = Tcl_GetIntFromObj(interp, objv[2], - (int *)&id)) != TCL_OK) - return error; - tcl_cmd_unregister(id, interp); - break; - } - - return TCL_OK; -} - -int tcl_cmd_connection(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *elem; - const char *cmds[] = { "account", "displayname", "handle", "list", "state", NULL }; - enum { CMD_CONN_ACCOUNT, CMD_CONN_DISPLAYNAME, CMD_CONN_HANDLE, - CMD_CONN_LIST, CMD_CONN_STATE } cmd; - int error; - GList *cur; - PurpleConnection *gc; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CONN_ACCOUNT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "gc"); - return TCL_ERROR; - } - if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefAccount, - purple_connection_get_account(gc))); - break; - case CMD_CONN_DISPLAYNAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "gc"); - return TCL_ERROR; - } - if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_connection_get_display_name(gc), -1)); - break; - case CMD_CONN_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefHandle, - purple_connections_get_handle())); - break; - case CMD_CONN_LIST: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - list = Tcl_NewListObj(0, NULL); - for (cur = purple_connections_get_all(); cur != NULL; cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefConnection, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_CONN_STATE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "gc"); - return TCL_ERROR; - } - if ((gc = tcl_validate_gc(objv[2], interp)) == NULL) - return TCL_ERROR; - switch (purple_connection_get_state(gc)) { - case PURPLE_DISCONNECTED: - Tcl_SetObjResult(interp, Tcl_NewStringObj("disconnected", -1)); - break; - case PURPLE_CONNECTED: - Tcl_SetObjResult(interp, Tcl_NewStringObj("connected", -1)); - break; - case PURPLE_CONNECTING: - Tcl_SetObjResult(interp, Tcl_NewStringObj("connecting", -1)); - break; - } - break; - } - - return TCL_OK; -} - -int tcl_cmd_conversation(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *elem; - const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", "send", NULL }; - enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE, CMD_CONV_SEND } cmd; - const char *styles[] = { "send", "recv", "system", NULL }; - enum { CMD_CONV_WRITE_SEND, CMD_CONV_WRITE_RECV, CMD_CONV_WRITE_SYSTEM } style; - const char *newopts[] = { "-chat", "-im" }; - enum { CMD_CONV_NEW_CHAT, CMD_CONV_NEW_IM } newopt; - PurpleConversation *convo; - PurpleAccount *account; - PurpleConversationType type; - GList *cur; - char *opt, *from, *what; - int error, argsused, flags = 0; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CONV_FIND: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "account name"); - return TCL_ERROR; - } - account = NULL; - if ((account = tcl_validate_account(objv[2], interp)) == NULL) - return TCL_ERROR; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - Tcl_GetString(objv[3]), - account); - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, convo)); - break; - case CMD_CONV_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_conversations_get_handle())); - break; - case CMD_CONV_LIST: - list = Tcl_NewListObj(0, NULL); - for (cur = purple_get_conversations(); cur != NULL; cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefConversation, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_CONV_NEW: - if (objc < 4) { - Tcl_WrongNumArgs(interp, 2, objv, "?options? account name"); - return TCL_ERROR; - } - argsused = 2; - type = PURPLE_CONV_TYPE_IM; - while (argsused < objc) { - opt = Tcl_GetString(objv[argsused]); - if (*opt == '-') { - if ((error = Tcl_GetIndexFromObj(interp, objv[argsused], newopts, - "option", 0, (int *)&newopt)) != TCL_OK) - return error; - argsused++; - switch (newopt) { - case CMD_CONV_NEW_CHAT: - type = PURPLE_CONV_TYPE_CHAT; - break; - case CMD_CONV_NEW_IM: - type = PURPLE_CONV_TYPE_IM; - break; - } - } else { - break; - } - } - if (objc - argsused != 2) { - Tcl_WrongNumArgs(interp, 2, objv, "?options? account name"); - return TCL_ERROR; - } - if ((account = tcl_validate_account(objv[argsused++], interp)) == NULL) - return TCL_ERROR; - convo = purple_conversation_new(type, account, Tcl_GetString(objv[argsused])); - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, convo)); - break; - case CMD_CONV_WRITE: - if (objc != 6) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation style from what"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - if ((error = Tcl_GetIndexFromObj(interp, objv[3], styles, "style", 0, (int *)&style)) != TCL_OK) - return error; - from = Tcl_GetString(objv[4]); - what = Tcl_GetString(objv[5]); - - switch (style) { - case CMD_CONV_WRITE_SEND: - flags = PURPLE_MESSAGE_SEND; - break; - case CMD_CONV_WRITE_RECV: - flags = PURPLE_MESSAGE_RECV; - break; - case CMD_CONV_WRITE_SYSTEM: - flags = PURPLE_MESSAGE_SYSTEM; - break; - } - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, what, flags, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), from, what, flags, time(NULL)); - break; - case CMD_CONV_NAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation"); - return TCL_ERROR; - } - - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_conversation_get_name(convo), -1)); - break; - case CMD_CONV_TITLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation"); - return TCL_ERROR; - } - - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_conversation_get_title(convo), -1)); - break; - case CMD_CONV_SEND: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "conversation message"); - return TCL_ERROR; - } - if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL) - return TCL_ERROR; - what = Tcl_GetString(objv[3]); - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_send(PURPLE_CONV_CHAT(convo), what); - else - purple_conv_im_send(PURPLE_CONV_IM(convo), what); - break; - } - - return TCL_OK; -} - -int tcl_cmd_core(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "handle", "quit", NULL }; - enum { CMD_CORE_HANDLE, CMD_CORE_QUIT } cmd; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_CORE_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_get_core())); - break; - case CMD_CORE_QUIT: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - purple_core_quit(); - break; - } - - return TCL_OK; -} - -int tcl_cmd_debug(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - char *category, *message; - int lev; - const char *levels[] = { "-misc", "-info", "-warning", "-error", NULL }; - PurpleDebugLevel levelind[] = { PURPLE_DEBUG_MISC, PURPLE_DEBUG_INFO, PURPLE_DEBUG_WARNING, PURPLE_DEBUG_ERROR }; - int error; - - if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "level category message"); - return TCL_ERROR; - } - - error = Tcl_GetIndexFromObj(interp, objv[1], levels, "debug level", 0, &lev); - if (error != TCL_OK) - return error; - - category = Tcl_GetString(objv[2]); - message = Tcl_GetString(objv[3]); - - purple_debug(levelind[lev], category, "%s\n", message); - - return TCL_OK; -} - -int tcl_cmd_notify(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - int error, type; - const char *opts[] = { "-error", "-warning", "-info", NULL }; - PurpleNotifyMsgType optind[] = { PURPLE_NOTIFY_MSG_ERROR, PURPLE_NOTIFY_MSG_WARNING, PURPLE_NOTIFY_MSG_INFO }; - char *title, *msg1, *msg2; - - if (objc < 4 || objc > 5) { - Tcl_WrongNumArgs(interp, 1, objv, "?type? title primary secondary"); - return TCL_ERROR; - } - - if (objc == 4) { - type = 1; /* Default to warning */ - title = Tcl_GetString(objv[1]); - msg1 = Tcl_GetString(objv[2]); - msg2 = Tcl_GetString(objv[3]); - } else { - error = Tcl_GetIndexFromObj(interp, objv[1], opts, "message type", 0, &type); - if (error != TCL_OK) - return error; - title = Tcl_GetString(objv[2]); - msg1 = Tcl_GetString(objv[3]); - msg2 = Tcl_GetString(objv[4]); - } - - purple_notify_message(_tcl_plugin, optind[type], title, msg1, msg2, NULL, NULL); - - return TCL_OK; -} - -int tcl_cmd_plugins(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "handle", NULL }; - enum { CMD_PLUGINS_HANDLE } cmd; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_PLUGINS_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_plugins_get_handle())); - break; - } - - return TCL_OK; -} - -int tcl_cmd_prefs(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *list, *elem, **elems; - const char *cmds[] = { "get", "set", "type", NULL }; - enum { CMD_PREFS_GET, CMD_PREFS_SET, CMD_PREFS_TYPE } cmd; - /* char *types[] = { "none", "boolean", "int", "string", "stringlist", NULL }; */ - /* enum { TCL_PREFS_NONE, TCL_PREFS_BOOL, TCL_PREFS_INT, TCL_PREFS_STRING, TCL_PREFS_STRINGLIST } type; */ - PurplePrefType preftype; - GList *cur; - int error, intval, nelem, i; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_PREFS_GET: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "path"); - return TCL_ERROR; - } - preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); - switch (preftype) { - case PURPLE_PREF_NONE: - Tcl_SetObjResult(interp, - Tcl_NewStringObj("pref type none", -1)); - return TCL_ERROR; - break; - case PURPLE_PREF_BOOLEAN: - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_prefs_get_bool(Tcl_GetString(objv[2])))); - break; - case PURPLE_PREF_INT: - Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_prefs_get_int(Tcl_GetString(objv[2])))); - break; - case PURPLE_PREF_STRING: - Tcl_SetObjResult(interp, - Tcl_NewStringObj((char *)purple_prefs_get_string(Tcl_GetString(objv[2])), -1)); - break; - case PURPLE_PREF_STRING_LIST: - cur = purple_prefs_get_string_list(Tcl_GetString(objv[2])); - list = Tcl_NewListObj(0, NULL); - while (cur != NULL) { - elem = Tcl_NewStringObj((char *)cur->data, -1); - Tcl_ListObjAppendElement(interp, list, elem); - cur = g_list_next(cur); - } - Tcl_SetObjResult(interp, list); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); - Tcl_SetObjResult(interp, - Tcl_NewStringObj("unknown pref type", -1)); - return TCL_ERROR; - } - break; - case CMD_PREFS_SET: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "path value"); - return TCL_ERROR; - } - preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); - switch (preftype) { - case PURPLE_PREF_NONE: - Tcl_SetObjResult(interp, - Tcl_NewStringObj("bad path or pref type none", -1)); - return TCL_ERROR; - break; - case PURPLE_PREF_BOOLEAN: - if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &intval)) != TCL_OK) - return error; - purple_prefs_set_bool(Tcl_GetString(objv[2]), intval); - break; - case PURPLE_PREF_INT: - if ((error = Tcl_GetIntFromObj(interp, objv[3], &intval)) != TCL_OK) - return error; - purple_prefs_set_int(Tcl_GetString(objv[2]), intval); - break; - case PURPLE_PREF_STRING: - purple_prefs_set_string(Tcl_GetString(objv[2]), Tcl_GetString(objv[3])); - break; - case PURPLE_PREF_STRING_LIST: - if ((error = Tcl_ListObjGetElements(interp, objv[3], &nelem, &elems)) != TCL_OK) - return error; - cur = NULL; - for (i = 0; i < nelem; i++) { - cur = g_list_append(cur, (gpointer)Tcl_GetString(elems[i])); - } - purple_prefs_set_string_list(Tcl_GetString(objv[2]), cur); - g_list_free(cur); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); - return TCL_ERROR; - } - break; - case CMD_PREFS_TYPE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 1, objv, "path"); - return TCL_ERROR; - } - preftype = purple_prefs_get_type(Tcl_GetString(objv[2])); - switch (preftype) { - case PURPLE_PREF_NONE: - Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); - break; - case PURPLE_PREF_BOOLEAN: - Tcl_SetObjResult(interp, Tcl_NewStringObj("boolean", -1)); - break; - case PURPLE_PREF_INT: - Tcl_SetObjResult(interp, Tcl_NewStringObj("int", -1)); - break; - case PURPLE_PREF_STRING: - Tcl_SetObjResult(interp, Tcl_NewStringObj("string", -1)); - break; - case PURPLE_PREF_STRING_LIST: - Tcl_SetObjResult(interp, Tcl_NewStringObj("stringlist", -1)); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "tcl does not know about pref type %d\n", preftype); - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown", -1)); - } - break; - } - - return TCL_OK; -} - -int tcl_cmd_presence(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "account", "active_status", "available", - "chat_user", "context", "conversation", "idle", - "login", "online", "status", "statuses", NULL }; - enum { CMD_PRESENCE_ACCOUNT, CMD_PRESENCE_ACTIVE_STATUS, - CMD_PRESENCE_AVAILABLE, CMD_PRESENCE_CHAT_USER, - CMD_PRESENCE_CONTEXT, CMD_PRESENCE_CONVERSATION, - CMD_PRESENCE_IDLE, CMD_PRESENCE_LOGIN, CMD_PRESENCE_ONLINE, - CMD_PRESENCE_STATUS, CMD_PRESENCE_STATUSES } cmd; - Tcl_Obj *result; - Tcl_Obj *list, *elem; - PurplePresence *presence; - GList *cur; - int error, idle, idle_time, login_time; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_PRESENCE_ACCOUNT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefAccount, - purple_presence_get_account(presence))); - break; - case CMD_PRESENCE_ACTIVE_STATUS: - if (objc != 3 && objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "presence [?status_id? | ?-primitive primitive?]"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatus, - purple_presence_get_active_status(presence))); - } else if (objc == 4) { - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_presence_is_status_active(presence, - Tcl_GetString(objv[3])))); - } else { - PurpleStatusPrimitive primitive; - if (strcmp(Tcl_GetString(objv[3]), "-primitive")) { - result = Tcl_NewStringObj("bad option \"", -1); - Tcl_AppendObjToObj(result, objv[3]); - Tcl_AppendToObj(result, - "\": should be -primitive", -1); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - primitive = purple_primitive_get_type_from_id(Tcl_GetString(objv[4])); - if (primitive == PURPLE_STATUS_UNSET) { - result = Tcl_NewStringObj("invalid primitive ", -1); - Tcl_AppendObjToObj(result, objv[4]); - Tcl_SetObjResult(interp,result); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_presence_is_status_primitive_active(presence, primitive))); - break; - } - break; - case CMD_PRESENCE_AVAILABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_presence_is_available(presence))); - break; - case CMD_PRESENCE_CHAT_USER: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_presence_get_chat_user(presence), -1)); - break; - case CMD_PRESENCE_CONTEXT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - switch (purple_presence_get_context(presence)) { - case PURPLE_PRESENCE_CONTEXT_UNSET: - Tcl_SetObjResult(interp, Tcl_NewStringObj("unset", -1)); - break; - case PURPLE_PRESENCE_CONTEXT_ACCOUNT: - Tcl_SetObjResult(interp, Tcl_NewStringObj("account", -1)); - break; - case PURPLE_PRESENCE_CONTEXT_CONV: - Tcl_SetObjResult(interp, Tcl_NewStringObj("conversation", -1)); - break; - case PURPLE_PRESENCE_CONTEXT_BUDDY: - Tcl_SetObjResult(interp, Tcl_NewStringObj("buddy", -1)); - break; - } - break; - case CMD_PRESENCE_CONVERSATION: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefConversation, - purple_presence_get_conversation(presence))); - break; - case CMD_PRESENCE_IDLE: - if (objc < 3 || objc > 5) { - Tcl_WrongNumArgs(interp, 2, objv, "presence ?idle? ?time?"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - if (objc == 3) { - if (purple_presence_is_idle(presence)) { - idle_time = purple_presence_get_idle_time (presence); - Tcl_SetObjResult(interp, Tcl_NewIntObj(idle_time)); - } else { - result = Tcl_NewListObj(0, NULL); - Tcl_SetObjResult(interp, result); - } - break; - } - if ((error = Tcl_GetBooleanFromObj(interp, objv[3], &idle)) != TCL_OK) - return TCL_ERROR; - if (objc == 4) { - purple_presence_set_idle(presence, idle, time(NULL)); - } else if (objc == 5) { - if ((error = Tcl_GetIntFromObj(interp, - objv[4], - &idle_time)) != TCL_OK) - return TCL_ERROR; - purple_presence_set_idle(presence, idle, idle_time); - } - break; - case CMD_PRESENCE_LOGIN: - if (objc != 3 && objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "presence ?time?"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - if (objc == 3) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_presence_get_login_time(presence))); - } else { - if ((error == Tcl_GetIntFromObj(interp, - objv[3], - &login_time)) != TCL_OK) - return TCL_ERROR; - purple_presence_set_login_time(presence, login_time); - } - break; - case CMD_PRESENCE_ONLINE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_presence_is_online(presence))); - break; - case CMD_PRESENCE_STATUS: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "presence status_id"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatus, - purple_presence_get_status(presence, - Tcl_GetString(objv[3])))); - break; - case CMD_PRESENCE_STATUSES: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "presence"); - return TCL_ERROR; - } - if ((presence = purple_tcl_ref_get(interp, objv[2], PurpleTclRefPresence)) == NULL) - return TCL_ERROR; - list = Tcl_NewListObj(0, NULL); - for (cur = purple_presence_get_statuses(presence); cur != NULL; - cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefStatus, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - } - - return TCL_OK; -} - -int tcl_cmd_savedstatus(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - Tcl_Obj *result; - const char *cmds[] = { "current", "handle", NULL }; - enum { CMD_SAVEDSTATUS_CURRENT, CMD_SAVEDSTATUS_HANDLE } cmd; - int error; - PurpleSavedStatus *saved_status; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_SAVEDSTATUS_CURRENT: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - if ((saved_status = purple_savedstatus_get_current()) == NULL) - return TCL_ERROR; - result = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(purple_savedstatus_get_title(saved_status), -1)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(purple_savedstatus_get_type(saved_status))); - Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(purple_savedstatus_get_message(saved_status), -1)); - Tcl_SetObjResult(interp,result); - break; - case CMD_SAVEDSTATUS_HANDLE: - if (objc != 2) { - Tcl_WrongNumArgs(interp, 2, objv, ""); - return TCL_ERROR; - } - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefHandle, - purple_savedstatuses_get_handle())); - break; - } - - return TCL_OK; -} - -int tcl_cmd_send_im(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - PurpleConnection *gc; - char *who, *text; - - if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "gc who text"); - return TCL_ERROR; - } - - if ((gc = tcl_validate_gc(objv[1], interp)) == NULL) - return TCL_ERROR; - - who = Tcl_GetString(objv[2]); - text = Tcl_GetString(objv[3]); - - serv_send_im(gc, who, text, 0); - - return TCL_OK; -} - -int tcl_cmd_signal(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "connect", "disconnect", NULL }; - enum { CMD_SIGNAL_CONNECT, CMD_SIGNAL_DISCONNECT } cmd; - struct tcl_signal_handler *handler; - void *instance; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_SIGNAL_CONNECT: - if (objc != 6) { - Tcl_WrongNumArgs(interp, 2, objv, "instance signal args proc"); - return TCL_ERROR; - } - handler = g_new0(struct tcl_signal_handler, 1); - if ((handler->instance = purple_tcl_ref_get(interp, objv[2],PurpleTclRefHandle)) == NULL) { - g_free(handler); - return error; - } - handler->signal = objv[3]; - Tcl_IncrRefCount(handler->signal); - handler->args = objv[4]; - handler->proc = objv[5]; - handler->interp = interp; - if (!tcl_signal_connect(handler)) { - tcl_signal_handler_free(handler); - Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); - } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); - } - break; - case CMD_SIGNAL_DISCONNECT: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "instance signal"); - return TCL_ERROR; - } - if ((instance = purple_tcl_ref_get(interp, objv[2],PurpleTclRefHandle)) == NULL) - return error; - tcl_signal_disconnect(instance, Tcl_GetString(objv[3]), interp); - break; - } - - return TCL_OK; -} - -int tcl_cmd_status(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "attr", "type", NULL }; - enum { CMD_STATUS_ATTR, CMD_STATUS_TYPE } cmd; - PurpleStatus *status; - PurpleStatusType *status_type; - int error; -#if !(defined PURPLE_DISABLE_DEPRECATED) - PurpleValue *value; - const char *attr; - int v; -#endif - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_STATUS_ATTR: -#if !(defined PURPLE_DISABLE_DEPRECATED) - if (objc != 4 && objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "status attr_id ?value?"); - return TCL_ERROR; - } - if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL) - return TCL_ERROR; - attr = Tcl_GetString(objv[3]); - value = purple_status_get_attr_value(status, attr); - if (value == NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("no such attribute", -1)); - return TCL_ERROR; - } - switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: - if (objc == 4) { - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_value_get_boolean(value))); - } else { - if ((error = Tcl_GetBooleanFromObj(interp, objv[4], &v)) != TCL_OK) - return error; - purple_status_set_attr_boolean(status, attr, v); - } - break; - case PURPLE_TYPE_INT: - if (objc == 4) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(purple_value_get_int(value))); - } else { - if ((error = Tcl_GetIntFromObj(interp, objv[4], &v)) != TCL_OK) - return error; - purple_status_set_attr_int(status, attr, v ); - } - break; - case PURPLE_TYPE_STRING: - if (objc == 4) - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_value_get_string(value), -1)); - else - purple_status_set_attr_string(status, attr, Tcl_GetString(objv[4])); - break; - default: - Tcl_SetObjResult(interp, - Tcl_NewStringObj("attribute has unknown type", -1)); - return TCL_ERROR; - } -#endif - break; - case CMD_STATUS_TYPE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "status"); - return TCL_ERROR; - } - if ((status = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatus)) == NULL) - return TCL_ERROR; - status_type = purple_status_get_type(status); - Tcl_SetObjResult(interp, purple_tcl_ref_new(PurpleTclRefStatusType, - status_type)); - break; - } - - return TCL_OK; -} - -int tcl_cmd_status_attr(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "id", "name", NULL }; - enum { CMD_STATUS_ATTR_ID, CMD_STATUS_ATTR_NAME } cmd; - PurpleStatusAttr *attr; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_STATUS_ATTR_ID: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "attr"); - return TCL_ERROR; - } - if ((attr = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusAttr)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_attr_get_id(attr), -1)); - break; - case CMD_STATUS_ATTR_NAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "attr"); - return TCL_ERROR; - } - if ((attr = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusAttr)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_attr_get_name(attr), -1)); - break; - } - - return TCL_OK; -} - -int tcl_cmd_status_type(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - const char *cmds[] = { "attr", "attrs", "available", "exclusive", "id", - "independent", "name", "primary_attr", - "primitive", "saveable", "user_settable", - NULL }; - enum { CMD_STATUS_TYPE_ATTR, CMD_STATUS_TYPE_ATTRS, - CMD_STATUS_TYPE_AVAILABLE, CMD_STATUS_TYPE_EXCLUSIVE, - CMD_STATUS_TYPE_ID, CMD_STATUS_TYPE_INDEPENDENT, - CMD_STATUS_TYPE_NAME, CMD_STATUS_TYPE_PRIMARY_ATTR, - CMD_STATUS_TYPE_PRIMITIVE, CMD_STATUS_TYPE_SAVEABLE, - CMD_STATUS_TYPE_USER_SETTABLE } cmd; - PurpleStatusType *status_type; - Tcl_Obj *list, *elem; - GList *cur; - int error; - - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?args?"); - return TCL_ERROR; - } - - if ((error = Tcl_GetIndexFromObj(interp, objv[1], cmds, "subcommand", 0, (int *)&cmd)) != TCL_OK) - return error; - - switch (cmd) { - case CMD_STATUS_TYPE_AVAILABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_status_type_is_available(status_type))); - break; - case CMD_STATUS_TYPE_ATTR: - if (objc != 4) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype attr"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - purple_tcl_ref_new(PurpleTclRefStatusAttr, - purple_status_type_get_attr(status_type, - Tcl_GetStringFromObj(objv[3], NULL)))); - break; - case CMD_STATUS_TYPE_ATTRS: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - list = Tcl_NewListObj(0, NULL); - for (cur = purple_status_type_get_attrs(status_type); - cur != NULL; cur = g_list_next(cur)) { - elem = purple_tcl_ref_new(PurpleTclRefStatusAttr, cur->data); - Tcl_ListObjAppendElement(interp, list, elem); - } - Tcl_SetObjResult(interp, list); - break; - case CMD_STATUS_TYPE_EXCLUSIVE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_status_type_is_exclusive(status_type))); - break; - case CMD_STATUS_TYPE_ID: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_id(status_type), -1)); - break; - case CMD_STATUS_TYPE_INDEPENDENT: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(purple_status_type_is_independent(status_type))); - break; - case CMD_STATUS_TYPE_NAME: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_name(status_type), -1)); - break; - case CMD_STATUS_TYPE_PRIMITIVE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_primitive_get_id_from_type - (purple_status_type_get_primitive(status_type)), -1)); - break; - case CMD_STATUS_TYPE_PRIMARY_ATTR: -#if !(defined PURPLE_DISABLE_DEPRECATED) - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewStringObj(purple_status_type_get_primary_attr(status_type), -1)); -#endif - break; - case CMD_STATUS_TYPE_SAVEABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_status_type_is_saveable(status_type))); - break; - case CMD_STATUS_TYPE_USER_SETTABLE: - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "statustype"); - return TCL_ERROR; - } - if ((status_type = purple_tcl_ref_get(interp, objv[2], PurpleTclRefStatusType)) == NULL) - return TCL_ERROR; - Tcl_SetObjResult(interp, - Tcl_NewBooleanObj( - purple_status_type_is_user_settable(status_type))); - break; - } - - return TCL_OK; -} - -static gboolean unload_self(gpointer data) -{ - PurplePlugin *plugin = data; - purple_plugin_unload(plugin); - return FALSE; -} - -int tcl_cmd_unload(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) -{ - PurplePlugin *plugin; - if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, ""); - return TCL_ERROR; - } - - if ((plugin = tcl_interp_get_plugin(interp)) == NULL) { - /* This isn't exactly OK, but heh. What do you do? */ - return TCL_OK; - } - /* We can't unload immediately, but we can unload at the first - * known safe opportunity. */ - purple_timeout_add(0, unload_self, (gpointer)plugin); - - return TCL_OK; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -/* - * Tcl/Glib glue - * - * Copyright (C) 2003, 2004, 2006 Ethan Blanton - * - * This file is dual-licensed under the two sets of terms below. You may - * use, redistribute, or modify it pursuant to either the set of conditions - * under "TERMS 1" or "TERMS 2", at your discretion. The DISCLAIMER - * applies to both sets of terms. - * - * TERMS 1 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - * TERMS 2 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must contain the above copyright - * notice and this comment block in their entirety. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice and the text of this comment block in their entirety in - * the documentation and/or other materials provided with the - * distribution. - * - * DISCLAIMER - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* - * NOTES - * - * This file was developed for the Purple project. It inserts the Tcl - * event loop into the glib2 event loop for the purposes of providing - * Tcl bindings in a glib2 (e.g. Gtk2) program. To use it, simply - * link it into your executable, include tcl_glib.h, and call the - * function tcl_glib_init() before creating or using any Tcl - * interpreters. Then go ahead and use Tcl, Tk, whatever to your - * heart's content. - * - * BUGS - * - * tcl_wait_for_event seems to have a bug that makes vwait not work so - * well... I'm not sure why, yet, but I haven't put much time into - * it. Hopefully I will figure it out soon. In the meantime, this - * means that Tk's bgerror function (which is called when there is an - * error in a callback function) causes some Bad Mojo -- you should - * override it with a function that does not use Tk - */ - -#include -#include -#include - -#include "tcl_glib.h" - -struct tcl_file_handler { - int source; - int fd; - int mask; - int pending; - Tcl_FileProc *proc; - ClientData data; -}; - -struct tcl_file_event { - Tcl_Event header; - int fd; -}; - -static guint tcl_timer; -static gboolean tcl_timer_pending; -static GHashTable *tcl_file_handlers; - -static void tcl_set_timer(Tcl_Time *timePtr); -static int tcl_wait_for_event(Tcl_Time *timePtr); -static void tcl_create_file_handler(int fd, int mask, Tcl_FileProc *proc, ClientData data); -static void tcl_delete_file_handler(int fd); - -static gboolean tcl_kick(gpointer data); -static gboolean tcl_file_callback(GIOChannel *source, GIOCondition condition, gpointer data); -static int tcl_file_event_callback(Tcl_Event *event, int flags); - -#undef Tcl_InitNotifier - -ClientData Tcl_InitNotifier() -{ - return NULL; -} - -void tcl_glib_init () -{ - Tcl_NotifierProcs notifier; - - memset(¬ifier, 0, sizeof(notifier)); - - notifier.createFileHandlerProc = tcl_create_file_handler; - notifier.deleteFileHandlerProc = tcl_delete_file_handler; - notifier.setTimerProc = tcl_set_timer; - notifier.waitForEventProc = tcl_wait_for_event; - - Tcl_SetNotifier(¬ifier); - Tcl_SetServiceMode(TCL_SERVICE_ALL); - - tcl_timer_pending = FALSE; - tcl_file_handlers = g_hash_table_new(g_direct_hash, g_direct_equal); -} - -static void tcl_set_timer(Tcl_Time *timePtr) -{ - guint interval; - - if (tcl_timer_pending) - g_source_remove(tcl_timer); - - if (timePtr == NULL) { - tcl_timer_pending = FALSE; - return; - } - - interval = timePtr->sec * 1000 + (timePtr->usec ? timePtr->usec / 1000 : 0); - tcl_timer = g_timeout_add(interval, tcl_kick, NULL); - tcl_timer_pending = TRUE; -} - -static int tcl_wait_for_event(Tcl_Time *timePtr) -{ - if (!timePtr || (timePtr->sec == 0 && timePtr->usec == 0)) { - g_main_context_iteration(NULL, FALSE); - return 1; - } else { - tcl_set_timer(timePtr); - } - - g_main_context_iteration(NULL, TRUE); - - return 1; -} - -static void tcl_create_file_handler(int fd, int mask, Tcl_FileProc *proc, ClientData data) -{ - struct tcl_file_handler *tfh = g_new0(struct tcl_file_handler, 1); - GIOChannel *channel; - GIOCondition cond = 0; - - if (g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fd))) - tcl_delete_file_handler(fd); - - if (mask & TCL_READABLE) - cond |= G_IO_IN; - if (mask & TCL_WRITABLE) - cond |= G_IO_OUT; - if (mask & TCL_EXCEPTION) - cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL; - - tfh->fd = fd; - tfh->mask = mask; - tfh->proc = proc; - tfh->data = data; - - channel = g_io_channel_unix_new(fd); - tfh->source = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, tcl_file_callback, tfh, g_free); - g_io_channel_unref(channel); - - g_hash_table_insert(tcl_file_handlers, GINT_TO_POINTER(fd), tfh); - - Tcl_ServiceAll(); -} - -static void tcl_delete_file_handler(int fd) -{ - struct tcl_file_handler *tfh = g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fd)); - - if (tfh == NULL) - return; - - g_source_remove(tfh->source); - g_hash_table_remove(tcl_file_handlers, GINT_TO_POINTER(fd)); - - Tcl_ServiceAll(); -} - -static gboolean tcl_kick(gpointer data) -{ - tcl_timer_pending = FALSE; - - Tcl_ServiceAll(); - - return FALSE; -} - -static gboolean tcl_file_callback(GIOChannel *source, GIOCondition condition, gpointer data) -{ - struct tcl_file_handler *tfh = data; - struct tcl_file_event *fev; - int mask = 0; - - if (condition & G_IO_IN) - mask |= TCL_READABLE; - if (condition & G_IO_OUT) - mask |= TCL_WRITABLE; - if (condition & (G_IO_ERR|G_IO_HUP|G_IO_NVAL)) - mask |= TCL_EXCEPTION; - - if (!(tfh->mask & (mask & ~tfh->pending))) - return TRUE; - - tfh->pending |= mask; - fev = (struct tcl_file_event *)ckalloc(sizeof(struct tcl_file_event)); - memset(fev, 0, sizeof(struct tcl_file_event)); - fev->header.proc = tcl_file_event_callback; - fev->fd = tfh->fd; - Tcl_QueueEvent((Tcl_Event *)fev, TCL_QUEUE_TAIL); - - Tcl_ServiceAll(); - - return TRUE; -} - -int tcl_file_event_callback(Tcl_Event *event, int flags) -{ - struct tcl_file_handler *tfh; - struct tcl_file_event *fev = (struct tcl_file_event *)event; - int mask; - - if (!(flags & TCL_FILE_EVENTS)) { - return 0; - } - - tfh = g_hash_table_lookup(tcl_file_handlers, GINT_TO_POINTER(fev->fd)); - if (tfh == NULL) - return 1; - - mask = tfh->mask & tfh->pending; - if (mask) - (*tfh->proc)(tfh->data, mask); - tfh->pending = 0; - - return 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_glib.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* - * Tcl/Glib glue - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_TCL_GLIB_H_ -#define _PURPLE_TCL_GLIB_H_ - -#include -#include - -void tcl_glib_init(void); - -#endif /* _PURPLE_TCL_GLIB_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_purple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_purple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_purple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_purple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file tcl_purple.h Purple Tcl definitions - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_TCL_PURPLE_H_ -#define _PURPLE_TCL_PURPLE_H_ - -#include - -#include "internal.h" -#include "cmds.h" -#include "plugin.h" -#include "value.h" -#include "stringref.h" - -struct tcl_signal_handler { - Tcl_Obj *signal; - Tcl_Interp *interp; - - void *instance; - Tcl_Obj *namespace; - /* These following two are temporary during setup */ - Tcl_Obj *args; - Tcl_Obj *proc; - - PurpleValue *returntype; - int nargs; - PurpleValue **argtypes; -}; - -struct tcl_cmd_handler { - int id; - Tcl_Obj *cmd; - Tcl_Interp *interp; - - Tcl_Obj *namespace; - /* These are temporary during setup */ - const char *args; - int priority; - int flags; - const char *prpl_id; - Tcl_Obj *proc; - const char *helpstr; - - int nargs; -}; - -extern PurplePlugin *_tcl_plugin; - -/* Capitalized this way because these are "types" */ -extern PurpleStringref *PurpleTclRefAccount; -extern PurpleStringref *PurpleTclRefConnection; -extern PurpleStringref *PurpleTclRefConversation; -extern PurpleStringref *PurpleTclRefPointer; -extern PurpleStringref *PurpleTclRefPlugin; -extern PurpleStringref *PurpleTclRefPresence; -extern PurpleStringref *PurpleTclRefStatus; -extern PurpleStringref *PurpleTclRefStatusAttr; -extern PurpleStringref *PurpleTclRefStatusType; -extern PurpleStringref *PurpleTclRefXfer; -extern PurpleStringref *PurpleTclRefHandle; - -PurplePlugin *tcl_interp_get_plugin(Tcl_Interp *interp); - -void tcl_signal_init(void); -void tcl_signal_handler_free(struct tcl_signal_handler *handler); -void tcl_signal_cleanup(Tcl_Interp *interp); -gboolean tcl_signal_connect(struct tcl_signal_handler *handler); -void tcl_signal_disconnect(void *instance, const char *signal, Tcl_Interp *interp); - -void tcl_cmd_init(void); -void tcl_cmd_handler_free(struct tcl_cmd_handler *handler); -void tcl_cmd_cleanup(Tcl_Interp *interp); -PurpleCmdId tcl_cmd_register(struct tcl_cmd_handler *handler); -void tcl_cmd_unregister(PurpleCmdId id, Tcl_Interp *interp); - -void purple_tcl_ref_init(void); -void *purple_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, PurpleStringref *type); -Tcl_Obj *purple_tcl_ref_new(PurpleStringref *type, void *value); - -Tcl_ObjCmdProc tcl_cmd_account; -Tcl_ObjCmdProc tcl_cmd_signal_connect; -Tcl_ObjCmdProc tcl_cmd_buddy; -Tcl_ObjCmdProc tcl_cmd_cmd; -Tcl_ObjCmdProc tcl_cmd_connection; -Tcl_ObjCmdProc tcl_cmd_conversation; -Tcl_ObjCmdProc tcl_cmd_core; -Tcl_ObjCmdProc tcl_cmd_debug; -Tcl_ObjCmdProc tcl_cmd_notify; -Tcl_ObjCmdProc tcl_cmd_plugins; -Tcl_ObjCmdProc tcl_cmd_prefs; -Tcl_ObjCmdProc tcl_cmd_presence; -Tcl_ObjCmdProc tcl_cmd_savedstatus; -Tcl_ObjCmdProc tcl_cmd_send_im; -Tcl_ObjCmdProc tcl_cmd_signal; -Tcl_ObjCmdProc tcl_cmd_status; -Tcl_ObjCmdProc tcl_cmd_status_attr; -Tcl_ObjCmdProc tcl_cmd_status_type; -Tcl_ObjCmdProc tcl_cmd_unload; - -#endif /* _PURPLE_TCL_PURPLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_ref.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_ref.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_ref.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_ref.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/** - * @file tcl_ref.c Purple Tcl typed references API - * - * purple - * - * Copyright (C) 2006 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include - -#include "tcl_purple.h" -#include "stringref.h" - -/* Instead of all that internal representation mumbo jumbo, use these - * macros to access the internal representation of a PurpleTclRef */ -#define OBJ_REF_TYPE(obj) (obj->internalRep.twoPtrValue.ptr1) -#define OBJ_REF_VALUE(obj) (obj->internalRep.twoPtrValue.ptr2) - -static Tcl_FreeInternalRepProc purple_tcl_ref_free; -static Tcl_DupInternalRepProc purple_tcl_ref_dup; -static Tcl_UpdateStringProc purple_tcl_ref_update; -static Tcl_SetFromAnyProc purple_tcl_ref_set; - -static Tcl_ObjType purple_tcl_ref = { - "PurpleTclRef", - purple_tcl_ref_free, - purple_tcl_ref_dup, - purple_tcl_ref_update, - purple_tcl_ref_set -}; - -void purple_tcl_ref_init() -{ - Tcl_RegisterObjType(&purple_tcl_ref); -} - -void *purple_tcl_ref_get(Tcl_Interp *interp, Tcl_Obj *obj, PurpleStringref *type) -{ - if (obj->typePtr != &purple_tcl_ref) { - if (Tcl_ConvertToType(interp, obj, &purple_tcl_ref) != TCL_OK) - return NULL; - } - if (strcmp(purple_stringref_value(OBJ_REF_TYPE(obj)), - purple_stringref_value(type))) { - if (interp) { - Tcl_Obj *error = Tcl_NewStringObj("Bad Purple reference type: expected ", -1); - Tcl_AppendToObj(error, purple_stringref_value(type), -1); - Tcl_AppendToObj(error, " but got ", -1); - Tcl_AppendToObj(error, purple_stringref_value(OBJ_REF_TYPE(obj)), -1); - Tcl_SetObjResult(interp, error); - } - return NULL; - } - return OBJ_REF_VALUE(obj); -} - -Tcl_Obj *purple_tcl_ref_new(PurpleStringref *type, void *value) -{ - Tcl_Obj *obj = Tcl_NewObj(); - obj->typePtr = &purple_tcl_ref; - OBJ_REF_TYPE(obj) = purple_stringref_ref(type); - OBJ_REF_VALUE(obj) = value; - Tcl_InvalidateStringRep(obj); - return obj; -} - -static void purple_tcl_ref_free(Tcl_Obj *obj) -{ - purple_stringref_unref(OBJ_REF_TYPE(obj)); -} - -static void purple_tcl_ref_dup(Tcl_Obj *obj1, Tcl_Obj *obj2) -{ - OBJ_REF_TYPE(obj2) = purple_stringref_ref(OBJ_REF_TYPE(obj1)); - OBJ_REF_VALUE(obj2) = OBJ_REF_VALUE(obj1); -} - -static void purple_tcl_ref_update(Tcl_Obj *obj) -{ - /* This is ugly on memory, but we pretty much have to either - * do this or guesstimate lengths or introduce a varargs - * function in here ... ugh. */ - char *bytes = g_strdup_printf("purple-%s:%p", - purple_stringref_value(OBJ_REF_TYPE(obj)), - OBJ_REF_VALUE(obj)); - - obj->length = strlen(bytes); - obj->bytes = ckalloc(obj->length + 1); - strcpy(obj->bytes, bytes); - g_free(bytes); -} - -/* This isn't as memory-efficient as setting could be, because we - * essentially have to synthesize the Stringref here, where we would - * really rather dup it. Oh, well. */ -static int purple_tcl_ref_set(Tcl_Interp *interp, Tcl_Obj *obj) -{ - char *bytes = Tcl_GetStringFromObj(obj, NULL); - char *ptr; - PurpleStringref *type; - void *value; - static const char prefix[] = "purple-"; - static const int prefixlen = sizeof(prefix) - 1; - - if (strlen(bytes) < prefixlen - || strncmp(bytes, prefix, prefixlen) - || (ptr = strchr(bytes, ':')) == NULL - || (ptr - bytes) == prefixlen) - goto badobject; - - /* Bad Ethan */ - *ptr = '\0'; - type = purple_stringref_new(bytes + prefixlen); - *ptr = ':'; - ptr++; - - if (sscanf(ptr, "%p", &value) == 0) { - purple_stringref_unref(type); - goto badobject; - } - - /* At this point we know we have a good object; free the old and - * install our internal representation. */ - if (obj->typePtr != NULL && obj->typePtr->freeIntRepProc != NULL) - obj->typePtr->freeIntRepProc(obj); - - obj->typePtr = &purple_tcl_ref; - OBJ_REF_TYPE(obj) = type; - OBJ_REF_VALUE(obj) = value; - - return TCL_OK; - -badobject: - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid PurpleTclRef representation", -1)); - } - return TCL_ERROR; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_signals.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_signals.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_signals.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/tcl/tcl_signals.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ -/** - * @file tcl_signals.c Purple Tcl signal API - * - * purple - * - * Copyright (C) 2003 Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include -#include - -#include "tcl_purple.h" - -#include "internal.h" -#include "connection.h" -#include "conversation.h" -#include "signals.h" -#include "debug.h" -#include "value.h" -#include "core.h" - -static GList *tcl_callbacks; - -static void *tcl_signal_callback(va_list args, struct tcl_signal_handler *handler); -static Tcl_Obj *new_cb_namespace (void); - -void tcl_signal_init() -{ - tcl_callbacks = NULL; -} - -void tcl_signal_handler_free(struct tcl_signal_handler *handler) -{ - if (handler == NULL) - return; - - Tcl_DecrRefCount(handler->signal); - if (handler->namespace) - { - Tcl_DecrRefCount(handler->namespace); - } - g_free(handler); -} - -void tcl_signal_cleanup(Tcl_Interp *interp) -{ - GList *cur; - struct tcl_signal_handler *handler; - - for (cur = tcl_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp) { - tcl_signal_handler_free(handler); - cur->data = NULL; - } - } - tcl_callbacks = g_list_remove_all(tcl_callbacks, NULL); -} - -gboolean tcl_signal_connect(struct tcl_signal_handler *handler) -{ - GString *proc; - - purple_signal_get_values(handler->instance, - Tcl_GetString(handler->signal), - &handler->returntype, &handler->nargs, - &handler->argtypes); - - tcl_signal_disconnect(handler->interp, Tcl_GetString(handler->signal), - handler->interp); - - if (!purple_signal_connect_vargs(handler->instance, - Tcl_GetString(handler->signal), - (void *)handler->interp, - PURPLE_CALLBACK(tcl_signal_callback), - (void *)handler)) - return FALSE; - - handler->namespace = new_cb_namespace (); - Tcl_IncrRefCount(handler->namespace); - proc = g_string_new(""); - g_string_append_printf(proc, "namespace eval %s { proc cb { %s } { %s } }", - Tcl_GetString(handler->namespace), - Tcl_GetString(handler->args), - Tcl_GetString(handler->proc)); - if (Tcl_Eval(handler->interp, proc->str) != TCL_OK) { - Tcl_DecrRefCount(handler->namespace); - g_string_free(proc, TRUE); - return FALSE; - } - g_string_free(proc, TRUE); - - tcl_callbacks = g_list_append(tcl_callbacks, (gpointer)handler); - - return TRUE; -} - -void tcl_signal_disconnect(void *instance, const char *signal, Tcl_Interp *interp) -{ - GList *cur; - struct tcl_signal_handler *handler; - gboolean found = FALSE; - GString *cmd; - - for (cur = tcl_callbacks; cur != NULL; cur = g_list_next(cur)) { - handler = cur->data; - if (handler->interp == interp && handler->instance == instance - && !strcmp(signal, Tcl_GetString(handler->signal))) { - purple_signal_disconnect(instance, signal, handler->interp, - PURPLE_CALLBACK(tcl_signal_callback)); - cmd = g_string_sized_new(64); - g_string_printf(cmd, "namespace delete %s", - Tcl_GetString(handler->namespace)); - Tcl_EvalEx(interp, cmd->str, -1, TCL_EVAL_GLOBAL); - tcl_signal_handler_free(handler); - g_string_free(cmd, TRUE); - cur->data = NULL; - found = TRUE; - break; - } - } - if (found) - tcl_callbacks = g_list_remove_all(tcl_callbacks, NULL); -} - -static PurpleStringref *ref_type(PurpleSubType type) -{ - switch (type) { - case PURPLE_SUBTYPE_ACCOUNT: - return PurpleTclRefAccount; - case PURPLE_SUBTYPE_CONNECTION: - return PurpleTclRefConnection; - case PURPLE_SUBTYPE_CONVERSATION: - return PurpleTclRefConversation; - case PURPLE_SUBTYPE_PLUGIN: - return PurpleTclRefPlugin; - case PURPLE_SUBTYPE_STATUS: - return PurpleTclRefStatus; - case PURPLE_SUBTYPE_XFER: - return PurpleTclRefXfer; - default: - return NULL; - } -} - -static void *tcl_signal_callback(va_list args, struct tcl_signal_handler *handler) -{ - GString *name, *val; - PurpleBlistNode *node; - int error, i; - void *retval = NULL; - Tcl_Obj *cmd, *arg, *result; - void **vals; /* Used for inout parameters */ - char ***strs; - - vals = g_new0(void *, handler->nargs); - strs = g_new0(char **, handler->nargs); - name = g_string_sized_new(32); - val = g_string_sized_new(32); - - cmd = Tcl_NewListObj(0, NULL); - Tcl_IncrRefCount(cmd); - - arg = Tcl_DuplicateObj(handler->namespace); - Tcl_AppendStringsToObj(arg, "::cb", NULL); - Tcl_ListObjAppendElement(handler->interp, cmd, arg); - - for (i = 0; i < handler->nargs; i++) { - if (purple_value_is_outgoing(handler->argtypes[i])) - g_string_printf(name, "%s::arg%d", - Tcl_GetString(handler->namespace), i); - - switch(purple_value_get_type(handler->argtypes[i])) { - case PURPLE_TYPE_UNKNOWN: /* What? I guess just pass the word ... */ - /* treat this as a pointer, but complain first */ - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "unknown PurpleValue type %d\n", - purple_value_get_type(handler->argtypes[i])); - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_OBJECT: - case PURPLE_TYPE_BOXED: - /* These are all "pointer" types to us */ - if (purple_value_is_outgoing(handler->argtypes[i])) - purple_debug_error("tcl", "pointer types do not currently support outgoing arguments\n"); - arg = purple_tcl_ref_new(PurpleTclRefPointer, va_arg(args, void *)); - break; - case PURPLE_TYPE_BOOLEAN: - if (purple_value_is_outgoing(handler->argtypes[i])) { - vals[i] = va_arg(args, gboolean *); - Tcl_LinkVar(handler->interp, name->str, - (char *)&vals[i], TCL_LINK_BOOLEAN); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewBooleanObj(va_arg(args, gboolean)); - } - break; - case PURPLE_TYPE_CHAR: - case PURPLE_TYPE_UCHAR: - case PURPLE_TYPE_SHORT: - case PURPLE_TYPE_USHORT: - case PURPLE_TYPE_INT: - case PURPLE_TYPE_UINT: - case PURPLE_TYPE_LONG: - case PURPLE_TYPE_ULONG: - case PURPLE_TYPE_ENUM: - /* I should really cast these individually to - * preserve as much information as possible ... - * but heh */ - if (purple_value_is_outgoing(handler->argtypes[i])) { - vals[i] = va_arg(args, int *); - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_INT); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewIntObj(va_arg(args, int)); - } - break; - case PURPLE_TYPE_INT64: - case PURPLE_TYPE_UINT64: - /* Tcl < 8.4 doesn't have wide ints, so we have ugly - * ifdefs in here */ - if (purple_value_is_outgoing(handler->argtypes[i])) { - vals[i] = (void *)va_arg(args, gint64 *); - #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 4) - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_WIDE_INT); - #else - /* This is going to cause weirdness at best, - * but what do you want ... we're losing - * precision */ - Tcl_LinkVar(handler->interp, name->str, - vals[i], TCL_LINK_INT); - #endif /* Tcl >= 8.4 */ - arg = Tcl_NewStringObj(name->str, -1); - } else { - #if (TCL_MAJOR_VERSION >= 8 && TCL_MINOR_VERSION >= 4) - arg = Tcl_NewWideIntObj(va_arg(args, gint64)); - #else - arg = Tcl_NewIntObj((int)va_arg(args, int)); - #endif /* Tcl >= 8.4 */ - } - break; - case PURPLE_TYPE_STRING: - if (purple_value_is_outgoing(handler->argtypes[i])) { - strs[i] = va_arg(args, char **); - if (strs[i] == NULL || *strs[i] == NULL) { - vals[i] = ckalloc(1); - *(char *)vals[i] = '\0'; - } else { - vals[i] = ckalloc(strlen(*strs[i]) + 1); - strcpy(vals[i], *strs[i]); - } - Tcl_LinkVar(handler->interp, name->str, - (char *)&vals[i], TCL_LINK_STRING); - arg = Tcl_NewStringObj(name->str, -1); - } else { - arg = Tcl_NewStringObj(va_arg(args, char *), -1); - } - break; - case PURPLE_TYPE_SUBTYPE: - switch (purple_value_get_subtype(handler->argtypes[i])) { - case PURPLE_SUBTYPE_UNKNOWN: - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "subtype unknown\n"); - case PURPLE_SUBTYPE_ACCOUNT: - case PURPLE_SUBTYPE_CONNECTION: - case PURPLE_SUBTYPE_CONVERSATION: - case PURPLE_SUBTYPE_STATUS: - case PURPLE_SUBTYPE_PLUGIN: - case PURPLE_SUBTYPE_XFER: - if (purple_value_is_outgoing(handler->argtypes[i])) - purple_debug_error("tcl", "pointer subtypes do not currently support outgoing arguments\n"); - arg = purple_tcl_ref_new(ref_type(purple_value_get_subtype(handler->argtypes[i])), va_arg(args, void *)); - break; - case PURPLE_SUBTYPE_BLIST: - case PURPLE_SUBTYPE_BLIST_BUDDY: - case PURPLE_SUBTYPE_BLIST_GROUP: - case PURPLE_SUBTYPE_BLIST_CHAT: - /* We're going to switch again for code-deduping */ - if (purple_value_is_outgoing(handler->argtypes[i])) - node = *va_arg(args, PurpleBlistNode **); - else - node = va_arg(args, PurpleBlistNode *); - switch (purple_blist_node_get_type(node)) { - case PURPLE_BLIST_GROUP_NODE: - arg = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj("group", -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(purple_group_get_name((PurpleGroup *)node), -1)); - break; - case PURPLE_BLIST_CONTACT_NODE: - /* g_string_printf(val, "contact {%s}", Contact Name? ); */ - arg = Tcl_NewStringObj("contact", -1); - break; - case PURPLE_BLIST_BUDDY_NODE: - arg = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj("buddy", -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(purple_buddy_get_name((PurpleBuddy *)node), -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - purple_tcl_ref_new(PurpleTclRefAccount, - purple_buddy_get_account((PurpleBuddy *)node))); - break; - case PURPLE_BLIST_CHAT_NODE: - arg = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj("chat", -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - Tcl_NewStringObj(purple_chat_get_name((PurpleChat *)node), -1)); - Tcl_ListObjAppendElement(handler->interp, arg, - purple_tcl_ref_new(PurpleTclRefAccount, - purple_chat_get_account((PurpleChat *)node))); - break; - case PURPLE_BLIST_OTHER_NODE: - arg = Tcl_NewStringObj("other", -1); - break; - } - break; - } - } - Tcl_ListObjAppendElement(handler->interp, cmd, arg); - } - - /* Call the friggin' procedure already */ - if ((error = Tcl_EvalObjEx(handler->interp, cmd, TCL_EVAL_GLOBAL)) != TCL_OK) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "error evaluating callback: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - } else { - result = Tcl_GetObjResult(handler->interp); - /* handle return values -- strings and words only */ - if (handler->returntype) { - if (purple_value_get_type(handler->returntype) == PURPLE_TYPE_STRING) { - retval = (void *)g_strdup(Tcl_GetString(result)); - } else { - if ((error = Tcl_GetIntFromObj(handler->interp, result, (int *)&retval)) != TCL_OK) { - purple_debug(PURPLE_DEBUG_ERROR, "tcl", "Error retrieving procedure result: %s\n", - Tcl_GetString(Tcl_GetObjResult(handler->interp))); - retval = NULL; - } - } - } - } - - /* And finally clean up */ - for (i = 0; i < handler->nargs; i++) { - g_string_printf(name, "%s::arg%d", - Tcl_GetString(handler->namespace), i); - if (purple_value_is_outgoing(handler->argtypes[i]) - && purple_value_get_type(handler->argtypes[i]) != PURPLE_TYPE_SUBTYPE) - Tcl_UnlinkVar(handler->interp, name->str); - - /* We basically only have to deal with strings on the - * way out */ - switch (purple_value_get_type(handler->argtypes[i])) { - case PURPLE_TYPE_STRING: - if (purple_value_is_outgoing(handler->argtypes[i])) { - if (vals[i] != NULL && *(char **)vals[i] != NULL) { - g_free(*strs[i]); - *strs[i] = g_strdup(vals[i]); - } - ckfree(vals[i]); - } - break; - default: - /* nothing */ - ; - } - } - - g_string_free(name, TRUE); - g_string_free(val, TRUE); - g_free(vals); - g_free(strs); - - return retval; -} - -static Tcl_Obj *new_cb_namespace () -{ - static int cbnum; - char name[32]; - - g_snprintf (name, sizeof(name), "::purple::_callback::cb_%d", cbnum++); - return Tcl_NewStringObj (name, -1); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/config.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/config.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/config.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif /* __GNUC__ >= 4 */ -#endif /* G_GNUC_NULL_TERMINATED */ - -#ifdef _WIN32 -# include -#endif - -#define TWITTER_PREF_REPLIES_TIMEOUT_NAME "twitter_replies_timeout" -#define TWITTER_PREF_REPLIES_TIMEOUT_DEFAULT 60 - -#define TWITTER_PREF_USER_STATUS_TIMEOUT_NAME "twitter_friends_timeout" -#define TWITTER_PREF_USER_STATUS_TIMEOUT_DEFAULT (60 * 5) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/global.mak qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/global.mak --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/global.mak 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/global.mak 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -# -# Global header for all makefile -# - --include version.mak - -# PIDGIN_TREE_TOP is only meaningful on Windows, point it to top directory of Pidgin. IT MUST BE A RELATIVE PATH -PIDGIN_TREE_TOP := ../../pidgin-2.5.4 - - -# For Linux -DESTDIR := -PREFIX := $(shell pkg-config --variable=prefix $(PIDGIN_NAME) 2> /dev/null || echo /usr) -LIBDIR := $(PREFIX)/lib - -# Is this WIN32? -IS_WIN32 = $(shell (uname -a | grep -q -i cygwin) && echo 1 || echo 0) - -# for override those attributes --include local.mak - -ifeq ($(strip $(IS_WIN32)), 1) -# WIN32 -# Use makefile and headers supplied by Pidgin - -PLUGIN_SUFFIX := .dll -EXE_SUFFIX := .exe - -#include global makefile for WIN32 build -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(PIDGIN_TOP) \ - -I$(GTK_TOP)/include/gtk-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ - -I$(GTK_TOP)/include/cairo \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(PIDGIN_TOP)/win32 \ - - -LIBS += -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple \ - $(PIDGIN_TOP)/pidgin$(PLUGIN_SUFFIX) - -PURPLE_LIBS = -L$(GTK_TOP)/lib -L$(PURPLE_TOP) $(LIBS) -PURPLE_CFLAGS = -DPURPLE_PLUGINS -DENABLE_NLS -Wall -DMBPURPLE_VERSION=\"$(VERSION)\" $(INCLUDE_PATHS) - -PURPLE_PROTOCOL_PIXMAP_DIR = $(PURPLE_INSTALL_DIR)/pixmaps/pidgin/protocols -PURPLE_PLUGIN_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) - - -#include $(PIDGIN_COMMON_RULES) - -else - -IS_PIDGIN = $(shell pkg-config --atleast-version=2.0 pidgin && echo 1 || echo 0) -IS_CARRIER = $(shell pkg-config --atleast-version=2.0 carrier && echo 1 || echo 0) - -ifeq ($(strip $(IS_PIDGIN)), 1) - PIDGIN_NAME := pidgin -else -ifeq ($(strip $(IS_CARRIER)), 1) - PIDGIN_NAME := carrier -endif -endif - -PREFIX := $(shell pkg-config --variable=prefix $(PIDGIN_NAME) 2> /dev/null || echo /usr) -LIBDIR := $(PREFIX)/lib - -# LINUX and others, use pkg-config -PURPLE_LIBS = $(shell pkg-config --libs purple) -PURPLE_CFLAGS = $(CFLAGS) -DPURPLE_PLUGINS -DENABLE_NLS -DMBPURPLE_VERSION=\"$(VERSION)\" -PURPLE_CFLAGS += $(shell pkg-config --cflags purple) -PURPLE_CFLAGS += $(shell pkg-config --cflags pidgin) -PURPLE_CFLAGS += -Wall -pthread -I. -g -O2 -pipe -fPIC -DPIC -PLUGIN_SUFFIX := .so -EXE_SUFFIX := - -PURPLE_PROTOCOL_PIXMAP_DIR := $(DESTDIR)$(PREFIX)/share/pixmaps/pidgin/protocols -PURPLE_PLUGIN_DIR := $(DESTDIR)$(LIBDIR)/purple-2 - -PIDGIN_LIBS = $(shell pkg-config --libs $(PIDGIN_NAME)) -PIDGIN_CFLAGS = $(CFLAGS) -DPIDGIN_PLUGINS -DENABLE_NLS -DMBPURPLE_VERSION=\"$(VERSION)\" -PIDGIN_CFLAGS += $(shell pkg-config --cflags $(PIDGIN_NAME)) -PIDGIN_CFLAGS += -Wall -pthread -I. -g -O2 -pipe -fPIC -DPIC - -LDFLAGS := $(shell (echo $(PIDGIN_CFLAGS) $(PURPLE_CFLAGS)| tr ' ' '\n' | awk '!a[$$0]++' | tr '\n' ' ')) -endif - -dist: $(DISTFILES) - mkdir -p ../$(PACKAGE)-$(VERSION) - cp -f $(DISTFILES) ../$(PACKAGE)-$(VERSION) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/Makefile qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/Makefile --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/Makefile 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -# -# Microblog protocol plug-in -# - -all: build - -include global.mak - -TARGETS = libpurple-twitter-protocol$(PLUGIN_SUFFIX) - -LD = $(CC) - -ifeq ($(strip $(IS_WIN32)), 1) -TWITTER_INC_PATHS += -I$(GTK_TOP)/include/gtk-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ - -I$(GTK_TOP)/include/cairo \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(PIDGIN_TOP)/win32 - - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(PIDGIN_TOP) - -LIBS = -lgtk-win32-2.0 \ - -lglib-2.0 \ - -lgdk-win32-2.0 \ - -lgobject-2.0 \ - -lintl \ - -lpurple \ - -lpidgin -CFLAGS := $(PURPLE_CFLAGS) $(TWITTER_INC_PATHS) -else -CFLAGS := $(PURPLE_CFLAGS) $(PIDGIN_CFLAGS) -LIB_PATHS = -LIBS = $(PIDGIN_LIBS) -endif - -TWITTER_C_SRC = twitter.c twitter_request.c twitter_api.c -TWITTER_H_SRC = $(TWITTER_C_SRC:%.c=%.h) config.h -TWITTER_OBJ = $(TWITTER_C_SRC:%.c=%.o) - -DISTFILES = $(TWITTER_C_SRC) $(TWITTER_H_SRC) Makefile global.mak version.mak - -OBJECTS = $(TWITTER_OBJ) - -.PHONY: clean install build - -build: $(TARGETS) - -install: $(TARGETS) - rm -f $(PURPLE_PLUGIN_DIR)/libpurple-twitter-protocol$(PLUGIN_SUFFIX) - install -m 0755 -d $(PURPLE_PLUGIN_DIR) - cp libpurple-twitter-protocol$(PLUGIN_SUFFIX) $(PURPLE_PLUGIN_DIR)/libpurple-twitter-protocol$(PLUGIN_SUFFIX) - -uninstall: - rm -f $(PURPLE_PLUGIN_DIR)/libpurple-twitter-protocol$(PLUGIN_SUFFIX) - -clean: - rm -f $(TARGETS) $(OBJECTS) - -libpurple-twitter-protocol$(PLUGIN_SUFFIX): $(TWITTER_OBJ) - $(LD) $(LDFLAGS) -shared $(TWITTER_OBJ) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o libpurple-twitter-protocol$(PLUGIN_SUFFIX) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/README 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -TODO diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -/** - * TODO: legal stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include - -/* If you're using this as the basis of a prpl that will be distributed - * separately from libpurple, remove the internal.h include below and replace - * it with code to include your own config.h or similar. If you're going to - * provide for translation, you'll also need to setup the gettext macros. */ -#include "config.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cmds.h" -#include "conversation.h" -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "roomlist.h" -#include "status.h" -#include "util.h" -#include "version.h" -#include "cipher.h" -#include "request.h" -#include "twitter_request.h" -#include "twitter_api.h" -//VOXOX - CJC - 2009.04.30 for voxox idenfifying when adding statuses -#define VOXOX_KEY "voxox" - - -void twitter_api_get_rate_limit_status(PurpleAccount *account, - TwitterSendRequestSuccessFunc success_func, - TwitterSendRequestErrorFunc error_func, - gpointer data) -{ - twitter_send_request(account, FALSE, - "/account/rate_limit_status.xml", NULL, - success_func, error_func, data); -} -void twitter_api_get_friends(PurpleAccount *account, - TwitterSendRequestMultiPageAllSuccessFunc success_func, - TwitterSendRequestMultiPageAllErrorFunc error_func, - gpointer data) -{ - twitter_send_request_multipage_all(account, - "/statuses/friends.xml", NULL, - success_func, error_func, - 100, data); -} - -void twitter_api_get_replies(PurpleAccount *account, - unsigned int since_id, - unsigned int count, - unsigned int page, - TwitterSendRequestSuccessFunc success_func, - TwitterSendRequestErrorFunc error_func, - gpointer data) -{ - //blah - char *query = since_id ? - g_strdup_printf("count=%d&page=%dsince_id=%d", count, page, since_id) : - g_strdup_printf("count=%d&page=%d", count, page); - - twitter_send_request(account, FALSE, - "/statuses/replies.xml", query, - success_func, error_func, data); - - g_free(query); -} -void twitter_api_get_replies_all(PurpleAccount *account, - unsigned int since_id, - TwitterSendRequestMultiPageAllSuccessFunc success_func, - TwitterSendRequestMultiPageAllErrorFunc error_func, - gpointer data) -{ - int count = 20; - //why strdup? - char *query = since_id ? - g_strdup_printf("since_id=%d", since_id) : - g_strdup(""); - - twitter_send_request_multipage_all(account, - "/statuses/replies.xml", query, - success_func, error_func, - count, NULL); - g_free(query); -} - -void twitter_api_set_status(PurpleAccount *acct, - const char *msg, - TwitterSendRequestSuccessFunc success_func, - TwitterSendRequestErrorFunc error_func, - gpointer data) -{ - if (msg != NULL && strcmp("", msg)) - { - char *query = g_strdup_printf("source=%s&status=%s",VOXOX_KEY, purple_url_encode(msg)); - twitter_send_request(acct, TRUE, - "/statuses/update.xml", query, - success_func, NULL, data); - g_free(query); - } else { - //SEND error? - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_api.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -void twitter_api_get_friends(PurpleAccount *account, - TwitterSendRequestMultiPageAllSuccessFunc success_func, - TwitterSendRequestMultiPageAllErrorFunc error_func, - gpointer data); - -void twitter_api_get_replies_all(PurpleAccount *account, - unsigned int since_id, - TwitterSendRequestMultiPageAllSuccessFunc success_func, - TwitterSendRequestMultiPageAllErrorFunc error_func, - gpointer data); - -void twitter_api_get_replies(PurpleAccount *account, - unsigned int since_id, - unsigned int count, - unsigned int page, - TwitterSendRequestSuccessFunc success_func, - TwitterSendRequestErrorFunc error_func, - gpointer data); - -void twitter_api_get_rate_limit_status(PurpleAccount *account, - TwitterSendRequestSuccessFunc success_func, - TwitterSendRequestErrorFunc error_func, - gpointer data); - -void twitter_api_set_status(PurpleAccount *acct, - const char *msg, - TwitterSendRequestSuccessFunc success_func, - TwitterSendRequestErrorFunc error_func, - gpointer data); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1427 +0,0 @@ -/** - * TODO: legal stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "twitter.h" - - -#define TWITTER_PROTOCOL_ID "prpl-twitter" -static PurplePlugin *_twitter_protocol = NULL; - -#define TWITTER_STATUS_ONLINE "online" -#define TWITTER_STATUS_OFFLINE "offline" - -#define MAX_TWEET_LENGTH 140 - -typedef struct _TwitterUserData TwitterUserData; -typedef struct _TwitterStatusData TwitterStatusData; - -struct _TwitterUserData -{ - PurpleAccount *account; - int id; - char *name; - char *screen_name; - char *profile_image_url; - char *description; -}; - -struct _TwitterStatusData -{ - char *text; - int id; - time_t created_at; -}; - -typedef struct -{ - TwitterStatusData *status; - TwitterUserData *user; -} TwitterBuddyData; - -typedef struct -{ - guint get_replies_timer; - guint get_friends_timer; - gint last_reply_id; - gint failed_get_replies_count; -} TwitterConnectionData; - -//VOXOX - JRT - 2009.08.26 - Prevent crash. -static TwitterConnectionData* twitter_get_proto_data( PurpleConnection *gc ) -{ - TwitterConnectionData *twitter = NULL; - - if ( gc ) - { - twitter = gc->proto_data; - } - - return twitter; -} - -static int twitter_account_get_last_reply_id(PurpleAccount *account) -{ - return purple_account_get_int(account, "twitter_last_reply_id", 0); -} - -static void twitter_account_set_last_reply_id(PurpleAccount *account, int reply_id) -{ - purple_account_set_int(account, "twitter_last_reply_id", reply_id); -} - -static int twitter_connection_get_last_reply_id(PurpleConnection *gc) -{ - int reply_id = 0; - TwitterConnectionData *connection_data = twitter_get_proto_data( gc ); //VOXOX - JRT - 2009.08.26 -// connection_data = gc->proto_data; - - if ( connection_data ) //VOXOX - JRT - 2009.08.26 - reply_id = connection_data->last_reply_id; - - return (reply_id ? reply_id : twitter_account_get_last_reply_id(purple_connection_get_account(gc))); -} - -static void twitter_connection_set_last_reply_id(PurpleConnection *gc, int reply_id) -{ - TwitterConnectionData *connection_data = gc->proto_data; - connection_data->last_reply_id = reply_id; - twitter_account_set_last_reply_id(purple_connection_get_account(gc), reply_id); -} - -//borrowed almost exactly from msn -//There's still something wrong here... -//Need to fix this for people who aren't in +0000 -static time_t twitter_status_parse_timestamp(const char *timestamp) -{ - //Sat Mar 07 18:12:10 +0000 2009 - char month_str[4], tz_str[6]; - char day_name[4]; - char *tz_ptr = tz_str; - static const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL - }; - time_t tval = 0; - struct tm t; - memset(&t, 0, sizeof(t)); - - time(&tval); - localtime_r(&tval, &t); - - if (sscanf(timestamp, "%03s %03s %02d %02d:%02d:%02d %05s %04d", - day_name, month_str, &t.tm_mday, - &t.tm_hour, &t.tm_min, &t.tm_sec, - tz_str, &t.tm_year) == 8) { - gboolean offset_positive = TRUE; - int tzhrs; - int tzmins; - - for (t.tm_mon = 0; - months[t.tm_mon] != NULL && - strcmp(months[t.tm_mon], month_str) != 0; t.tm_mon++); - if (months[t.tm_mon] != NULL) { - if (*tz_str == '-') { - offset_positive = FALSE; - tz_ptr++; - } else if (*tz_str == '+') { - tz_ptr++; - } - - if (sscanf(tz_ptr, "%02d%02d", &tzhrs, &tzmins) == 2) { - time_t tzoff = tzhrs * 60 * 60 + tzmins * 60; -#ifdef _WIN32 - long sys_tzoff; -#endif - - if (offset_positive) - tzoff *= -1; - - t.tm_year -= 1900; - -#ifdef _WIN32 - if ((sys_tzoff = wpurple_get_tz_offset()) != -1) - tzoff += sys_tzoff; -#else -#ifdef HAVE_TM_GMTOFF - tzoff += t.tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); /* making sure */ - tzoff -= timezone; -# endif -#endif -#endif /* _WIN32 */ - - return mktime(&t) + tzoff; - } - } - } - - purple_debug_info("twitter", "Can't parse timestamp %s\n", timestamp); - return tval; -} - -static char *xmlnode_get_child_data(const xmlnode *node, const char *name) -{ - xmlnode *child = xmlnode_get_child(node, name); - if (!child) - return NULL; - return xmlnode_get_data_unescaped(child); -} - - -static void twitter_user_data_free(TwitterUserData *user_data) -{ - if (!user_data) - return; - if (user_data->name) - g_free(user_data->name); - if (user_data->screen_name) - g_free(user_data->screen_name); - if (user_data->profile_image_url) - g_free(user_data->profile_image_url); - if (user_data->description) - g_free(user_data->description); - g_free(user_data); - user_data = NULL; -} - -static void twitter_status_data_free(TwitterStatusData *status) -{ - if (status == NULL) - return; - if (status->text != NULL) - g_free(status->text); - g_free(status); -} - -static TwitterBuddyData *twitter_buddy_get_buddy_data(PurpleBuddy *b) -{ - if (b->proto_data == NULL) - b->proto_data = g_new0(TwitterBuddyData, 1); - return b->proto_data; -} - -static const char *twitter_status_text_get_dst_user(const char *text) -{ - static char buf[MAX_TWEET_LENGTH + 1]; - char *space_pos; - if (text == NULL) - return NULL; - if (text[0] != '@') - return NULL; - space_pos = strchr(text, ' '); - if (space_pos == NULL) - return NULL; - if (space_pos - text > MAX_TWEET_LENGTH) - return NULL; //should never happen - strncpy(buf, text + 1, space_pos - text - 1); - buf[space_pos - text - 1] = '\0'; - return buf; -} - -static const char *twitter_status_text_get_text(const char *text) -{ - if (text[0] != '@') - { - return text; - } else { - return strchr(text, ' ') + 1; - } -} - -static void twitter_buddy_update_icon_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - PurpleBuddy *buddy = user_data; - TwitterBuddyData *buddy_data = buddy->proto_data; - if (buddy_data != NULL && buddy_data->user != NULL) - { - purple_buddy_icons_set_for_user(buddy->account, buddy->name, - g_memdup(url_text, len), len, buddy_data->user->profile_image_url); - } -} -static void twitter_buddy_update_icon(PurpleBuddy *buddy) -{ - const char *previous_url = purple_buddy_icons_get_checksum_for_user(buddy); - TwitterBuddyData *twitter_buddy_data = buddy->proto_data; - if (twitter_buddy_data == NULL || twitter_buddy_data->user == NULL) - { - return; - } else { - const char *url = twitter_buddy_data->user->profile_image_url; - if (url == NULL) - { - purple_buddy_icons_set_for_user(buddy->account, buddy->name, NULL, 0, NULL); - } else { - if (!previous_url || !g_str_equal(previous_url, url)) { - purple_util_fetch_url(url, TRUE, NULL, FALSE, twitter_buddy_update_icon_cb, buddy); - } - } - } -} - -static PurpleBuddy *twitter_buddy_new(PurpleAccount *account, const char *screenname, const char *alias) -{ - PurpleGroup *g; - PurpleBuddy *b = purple_find_buddy(account, screenname); - if (b != NULL) - { - if (b->proto_data == NULL) - b->proto_data = g_new0(TwitterBuddyData, 1); - return b; - } - - g = purple_find_group("twitter"); - if (g == NULL) - g = purple_group_new("twitter"); - b = purple_buddy_new(account, screenname, alias); - purple_blist_add_buddy(b, NULL, g, NULL); - b->proto_data = g_new0(TwitterBuddyData, 1); - return b; -} - -static void twitter_buddy_set_user_data(PurpleAccount *account, TwitterUserData *u, gboolean add_missing_buddy) -{ - PurpleBuddy *b; - TwitterBuddyData *buddy_data; - if (!u || !account) - return; - - if (!strcmp(u->screen_name, account->username)) - { - twitter_user_data_free(u); - return; - } - - b = purple_find_buddy(account, u->screen_name); - if (!b && add_missing_buddy) - { - b = twitter_buddy_new(account, u->screen_name, u->name); - } - - if (!b) - { - twitter_user_data_free(u); - return; - } - - buddy_data = twitter_buddy_get_buddy_data(b); - - if (buddy_data == NULL) - return; - if (buddy_data->user != NULL && u != buddy_data->user) - twitter_user_data_free(buddy_data->user); - buddy_data->user = u; - twitter_buddy_update_icon(b); -} -static void twitter_status_data_update_conv(PurpleAccount *account, char *src_user, TwitterStatusData *s) -{ - const char *dst_user; - PurpleConnection *gc = purple_account_get_connection(account); - - if ( gc == NULL ) //VOXOX - JRT - 2009.08.26 - prevent crash - return; - - if (!s || !s->text) - return; - - dst_user = twitter_status_text_get_dst_user(s->text); - - if (s->id && s->id > twitter_connection_get_last_reply_id(gc)) - { - twitter_connection_set_last_reply_id(gc, s->id); - } - - if (dst_user && !strcmp(dst_user, account->username)) - { - ////Account received an im - //serv_got_im(gc, src_user, - // twitter_status_text_get_text(s->text), - // PURPLE_MESSAGE_RECV, time(NULL)/*s->created_at*/); //TODO: once timestamp parsing is fixed...//VOXOX - CJC - 2009.07.11 Remove IM recieving - } -} -static void twitter_buddy_set_status_data(PurpleAccount *account, char *src_user, TwitterStatusData *s) -{ - PurpleBuddy *b; - TwitterBuddyData *buddy_data; - gboolean status_text_same = FALSE; - - if (!s) - return; - - if (!s->text) - { - twitter_status_data_free(s); - return; - } - - - b = purple_find_buddy(account, src_user); - if (!b) - { - twitter_status_data_free(s); - return; - } - - buddy_data = twitter_buddy_get_buddy_data(b); - - if (buddy_data->status && s->created_at < buddy_data->status->created_at) - { - twitter_status_data_free(s); - return; - } - - if (buddy_data->status != NULL && s != buddy_data->status) - { - status_text_same = (strcmp(buddy_data->status->text, s->text) == 0); - twitter_status_data_free(buddy_data->status); - } - - buddy_data->status = s; - - if (!status_text_same) - { - purple_prpl_got_user_status(b->account, b->name, "online", - "message", s ? s->text : NULL, NULL); - } -} - -static TwitterUserData *twitter_user_node_parse(xmlnode *user_node) -{ - TwitterUserData *user; - - if (user_node == NULL) - return NULL; - - user = g_new0(TwitterUserData, 1); - user->screen_name = xmlnode_get_child_data(user_node, "screen_name"); - - if (!user->screen_name) - { - g_free(user); - return NULL; - } - - user->name = xmlnode_get_child_data(user_node, "name"); - user->profile_image_url = xmlnode_get_child_data(user_node, "profile_image_url"); - user->description = xmlnode_get_child_data(user_node, "description"); - - return user; -} -static TwitterStatusData *twitter_status_node_parse(xmlnode *status_node) -{ - TwitterStatusData *status; - char *data; - - if (status_node == NULL) - return NULL; - - status = g_new0(TwitterStatusData, 1); - status->text = xmlnode_get_child_data(status_node, "text"); - - if ((data = xmlnode_get_child_data(status_node, "created_at"))) - { - time_t created_at = twitter_status_parse_timestamp(data); - status->created_at = created_at ? created_at : time(NULL); - g_free(data); - } - - if ((data = xmlnode_get_child_data(status_node, "id"))) - { - status->id =atoi(data); - g_free(data); - } - - return status; - -} - -static GList *twitter_users_node_parse(xmlnode *users_node) -{ - GList *users = NULL; - xmlnode *user_node; - for (user_node = users_node->child; user_node; user_node = user_node->next) - { - if (user_node->name && !strcmp(user_node->name, "user")) - { - TwitterBuddyData *data = g_new0(TwitterBuddyData, 1); - - xmlnode *status_node = xmlnode_get_child(user_node, "status"); - - data->user = twitter_user_node_parse(user_node); - data->status = twitter_status_node_parse(status_node); - - users = g_list_append(users, data); - } - } - return users; -} -static GList *twitter_users_nodes_parse(GList *nodes) -{ - GList *l_users_data = NULL; - GList *l; - for (l = nodes; l; l = l->next) - { - xmlnode *node = l->data; - l_users_data = g_list_concat(twitter_users_node_parse(node), l_users_data); - } - return l_users_data; -} - -static GList *twitter_statuses_node_parse(xmlnode *statuses_node) -{ - GList *statuses = NULL; - xmlnode *status_node; - for (status_node = statuses_node->child; status_node; status_node = status_node->next) - { - if (status_node->name && !strcmp(status_node->name, "status")) - { - TwitterBuddyData *data = g_new0(TwitterBuddyData, 1); - xmlnode *user_node = xmlnode_get_child(status_node, "user"); - data->user = twitter_user_node_parse(user_node); - data->status = twitter_status_node_parse(status_node); - statuses = g_list_prepend(statuses, data); - } - } - return statuses; -} -static GList *twitter_statuses_nodes_parse(GList *nodes) -{ - GList *l_users_data = NULL; - GList *l; - for (l = nodes; l; l = l->next) - { - xmlnode *node = l->data; - l_users_data = g_list_concat(twitter_statuses_node_parse(node), l_users_data); - } - return l_users_data; -} -static gboolean twitter_get_replies_timeout_error_cb(PurpleAccount *account, const TwitterRequestErrorData *error_data, gpointer user_data) -{ - PurpleConnection *gc = purple_account_get_connection(account); - TwitterConnectionData *twitter = twitter_get_proto_data( gc ); //VOXOX - JRT - 2009.08.26 -// twitter = gc->proto_data; - - if ( twitter ) //VOXOX - JRT - 2009.08.26 - { - twitter->failed_get_replies_count++; - - if (twitter->failed_get_replies_count >= 3) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Could not retrieve replies, giving up trying"); - } - } - - return FALSE; -} -static void twitter_verify_connection_error_handler(PurpleAccount *account, const TwitterRequestErrorData *error_data) -{ - const gchar *error_message; - PurpleConnectionError reason; - //purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_data->message); - switch (error_data->type) - { - case TWITTER_REQUEST_ERROR_SERVER: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - error_message = error_data->message; - break; - case TWITTER_REQUEST_ERROR_INVALID_XML: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - error_message = "Received Invalid XML"; - break; - case TWITTER_REQUEST_ERROR_TWITTER_GENERAL: - if (!strcmp(error_data->message, "This method requires authentication.")) - { - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - error_message = "Invalid password"; - break; - } - else if (!strcmp(error_data->message, "Could not authenticate you.")) //VOXOX - JRT - 2009.07.16 - { - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - error_message = "Invalid username or password"; - break; - } - else - { - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - error_message = error_data->message; - } - break; - default: - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - error_message = "Unknown error"; - break; - } - purple_connection_error_reason(purple_account_get_connection(account), reason, error_message); -} -static gboolean twitter_get_friends_verify_error_cb(PurpleAccount *account, - const TwitterRequestErrorData *error_data, - gpointer user_data) -{ - twitter_verify_connection_error_handler(account, error_data); - return FALSE; -} - -static void twitter_send_im_cb(PurpleAccount *account, xmlnode *node, gpointer user_data) -{ - //TODO: verify status was sent - return; - /* - TwitterStatusData *s = twitter_status_node_parse(node); - xmlnode *user_node = xmlnode_get_child(node, "user"); - TwitterUserData *u = twitter_user_node_parse(user_node); - - if (!s) - return; - - if (!u) - { - twitter_status_data_free(s); - return; - } - - twitter_buddy_set_status_data(account, u->screen_name, s, FALSE); - twitter_user_data_free(u); - */ -} - -static void twitter_buddy_datas_set_all(PurpleAccount *account, GList *buddy_datas) -{ - GList *l; - for (l = buddy_datas; l; l = l->next) - { - TwitterBuddyData *data = l->data; - TwitterUserData *user = data->user; - TwitterStatusData *status = data->status; - char *screen_name = g_strdup(user->screen_name); - - g_free(data); - - twitter_buddy_set_user_data(account, user, TRUE); - if (status != NULL) - twitter_buddy_set_status_data(account, screen_name, status); - - g_free(screen_name); - } - g_list_free(buddy_datas); -} - -static void twitter_get_friends_cb(PurpleAccount *account, GList *nodes, gpointer user_data) -{ - GList *buddy_datas = twitter_users_nodes_parse(nodes); - twitter_buddy_datas_set_all(account, buddy_datas); -} - -static void twitter_get_replies_cb(PurpleAccount *account, GList *nodes, gpointer user_data) -{ - PurpleConnection *gc = purple_account_get_connection(account); - TwitterConnectionData *twitter = twitter_get_proto_data( gc ); //VOXOX - JRT - 2009.08.26 - - GList *statuses = twitter_statuses_nodes_parse(nodes); - GList *l = statuses; -// twitter = gc->proto_data; - - if ( twitter == NULL ) //VOXOX - JRT - 2009.08.26 - return; - - for (l = statuses; l; l = l->next) - { - TwitterBuddyData *data = l->data; - TwitterStatusData *status = data->status; - TwitterUserData *user_data = data->user; - g_free(data); - - if (!user_data) - { - twitter_status_data_free(status); - } - else - { - char *screen_name = g_strdup(user_data->screen_name); - twitter_buddy_set_user_data(account, user_data, FALSE); - twitter_status_data_update_conv(account, screen_name, status); - twitter_buddy_set_status_data(account, screen_name, status); - g_free(screen_name); - } - } - g_list_free(statuses); - - twitter->failed_get_replies_count = 0; -} - -static gboolean twitter_get_replies_timeout(gpointer data) -{ - PurpleAccount *account = data; - twitter_api_get_replies_all(account, - twitter_connection_get_last_reply_id(purple_account_get_connection(account)), - twitter_get_replies_cb, twitter_get_replies_timeout_error_cb, - NULL); - return TRUE; -} -static gboolean twitter_get_friends_timeout(gpointer data) -{ - PurpleAccount *account = data; - //TODO handle errors - twitter_api_get_friends(account, twitter_get_friends_cb, NULL, NULL); - return TRUE; -} - -static void twitter_get_friends_verify_connection_cb(PurpleAccount *account, - GList *nodes, - gpointer user_data) -{ - PurpleConnection *gc = purple_account_get_connection(account); - TwitterConnectionData *twitter = twitter_get_proto_data( gc ); //VOXOX - JRT - 2009.08.26 -// twitter = gc->proto_data; - - GList *l_users_data = NULL; - GList *l; - - if ( twitter == NULL ) //VOXOX - JRT - 2009.08.26 - return; - - if (purple_connection_get_state(gc) == PURPLE_CONNECTING) - { - purple_connection_update_progress(gc, "Connected", - 2, /* which connection step this is */ - 3); /* total number of steps */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - l_users_data = twitter_users_nodes_parse(nodes); - - for (l = l_users_data; l; l = l->next) - { - TwitterBuddyData *data = l->data; - TwitterStatusData *status = data->status; - - if (status && status->created_at && status->id > twitter_connection_get_last_reply_id(gc)) - { - twitter_connection_set_last_reply_id(gc, status->id); - } - } - - twitter_buddy_datas_set_all(account, l_users_data); - twitter->get_replies_timer = purple_timeout_add( - 1000 * purple_account_get_int(account, TWITTER_PREF_REPLIES_TIMEOUT_NAME, TWITTER_PREF_REPLIES_TIMEOUT_DEFAULT), - twitter_get_replies_timeout, account); - twitter->get_friends_timer = purple_timeout_add( - 1000 * purple_account_get_int(account, TWITTER_PREF_USER_STATUS_TIMEOUT_NAME, TWITTER_PREF_USER_STATUS_TIMEOUT_DEFAULT), - twitter_get_friends_timeout, account); - } - -} - -static void twitter_get_rate_limit_status_cb(PurpleAccount *account, xmlnode *node, gpointer user_data) -{ - /* - * - * 1236529763 - * 100 - * 100 - * 2009-03-08T16:29:23+00:00 - * - */ - - xmlnode *child; - int remaining_hits = 0; - int hourly_limit = 0; - char *message; - for (child = node->child; child; child = child->next) - { - if (child->name) - { - if (!strcmp(child->name, "remaining-hits")) - { - char *data = xmlnode_get_data_unescaped(child); - remaining_hits = atoi(data); - g_free(data); - } - else if (!strcmp(child->name, "hourly-limit")) - { - char *data = xmlnode_get_data_unescaped(child); - hourly_limit = atoi(data); - g_free(data); - } - } - } - message = g_strdup_printf("%d/%d %s", remaining_hits, hourly_limit, "Remaining"); - purple_notify_info(NULL, /* plugin handle or PurpleConnection */ - ("Rate Limit Status"), - ("Rate Limit Status"), - (message)); - g_free(message); -} - -/* - * prpl functions - */ -static const char *twitter_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) -{ - /* shamelessly steal (er, borrow) the meanwhile protocol icon. it's cute! */ - return "meanwhile"; -} - -static char *twitter_status_text(PurpleBuddy *buddy) { - purple_debug_info("twitter", "getting %s's status text for %s\n", - buddy->name, buddy->account->username); - - if (purple_find_buddy(buddy->account, buddy->name)) { - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - const char *message = status ? purple_status_get_attr_string(status, "message") : NULL; - - if (message && strlen(message) > 0) - return g_strdup(g_markup_escape_text(message, -1)); - - } - return NULL; -} - -static void twitter_tooltip_text(PurpleBuddy *buddy, - PurpleNotifyUserInfo *info, - gboolean full) { - - if (PURPLE_BUDDY_IS_ONLINE(buddy)) - { - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - char *msg = twitter_status_text(buddy); - purple_notify_user_info_add_pair(info, purple_status_get_name(status), - msg); - g_free(msg); - - if (full) { - /*const char *user_info = purple_account_get_user_info(gc->account); - if (user_info) - purple_notify_user_info_add_pair(info, _("User info"), user_info);*/ - } - - purple_debug_info("twitter", "showing %s tooltip for %s\n", - (full) ? "full" : "short", buddy->name); - } -} - -/* everyone will be online - * Future: possibly have offline mode for people who haven't updated in a while - */ -static GList *twitter_status_types(PurpleAccount *acct) -{ - GList *types = NULL; - PurpleStatusType *type; - PurpleStatusPrimitive status_primitives[] = { - PURPLE_STATUS_UNAVAILABLE, - PURPLE_STATUS_INVISIBLE, - PURPLE_STATUS_AWAY, - PURPLE_STATUS_EXTENDED_AWAY - }; - int status_primitives_count = sizeof(status_primitives) / sizeof(status_primitives[0]); - int i; - - type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, TWITTER_STATUS_ONLINE, - TWITTER_STATUS_ONLINE, TRUE); - purple_status_type_add_attr(type, "message", ("Online"), - purple_value_new(PURPLE_TYPE_STRING)); - types = g_list_prepend(types, type); - - //This is a hack to get notified when another protocol goes into a different status. - //Eg aim goes "away", we still want to get notified - for (i = 0; i < status_primitives_count; i++) - { - type = purple_status_type_new(status_primitives[i], TWITTER_STATUS_ONLINE, - TWITTER_STATUS_ONLINE, FALSE); - purple_status_type_add_attr(type, "message", ("Online"), - purple_value_new(PURPLE_TYPE_STRING)); - types = g_list_prepend(types, type); - } - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, TWITTER_STATUS_OFFLINE, - TWITTER_STATUS_OFFLINE, TRUE); - types = g_list_prepend(types, type); - - return g_list_reverse(types); -} - - -/* - * UI callbacks - */ -static void twitter_action_get_user_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - PurpleAccount *acct = purple_connection_get_account(gc); - twitter_api_get_friends(acct, twitter_get_friends_cb, NULL, NULL); -} - -static void twitter_request_id_ok(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *acct = purple_connection_get_account(gc); - int id = purple_request_fields_get_integer(fields, "id"); - twitter_api_get_replies_all(acct, id, twitter_get_replies_cb, NULL, NULL); -} -static void twitter_action_get_replies(PurplePluginAction *action) -{ - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - PurpleConnection *gc = (PurpleConnection *)action->context; - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_int_new("id", ("Minutes"), twitter_connection_get_last_reply_id(gc)); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - ("Timeline"), - ("Set last time"), - NULL, - request, - ("_Set"), G_CALLBACK(twitter_request_id_ok), - ("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} -static void twitter_action_set_status_ok(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *acct = purple_connection_get_account(gc); - const char* status = purple_request_fields_get_string(fields, "status"); - purple_account_set_status(acct, "online", TRUE, "message", status, NULL); -} -static void twitter_action_set_status(PurplePluginAction *action) -{ - PurpleRequestFields *request; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - PurpleConnection *gc = (PurpleConnection *)action->context; - - group = purple_request_field_group_new(NULL); - - field = purple_request_field_string_new("status", ("Status"), "", FALSE); - purple_request_field_group_add_field(group, field); - - request = purple_request_fields_new(); - purple_request_fields_add_group(request, group); - - purple_request_fields(action->plugin, - ("Status"), - ("Set Account Status"), - NULL, - request, - ("_Set"), G_CALLBACK(twitter_action_set_status_ok), - ("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} -static void twitter_action_get_rate_limit_status(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - PurpleAccount *acct = purple_connection_get_account(gc); - twitter_api_get_rate_limit_status(acct, twitter_get_rate_limit_status_cb, NULL, NULL); -} - -/* this is set to the actions member of the PurplePluginInfo struct at the - * bottom. - */ -static GList *twitter_actions(PurplePlugin *plugin, gpointer context) -{ - GList *l = NULL; - PurplePluginAction *action; - - action = purple_plugin_action_new("Set status", twitter_action_set_status); - l = g_list_append(l, action); - - action = purple_plugin_action_new("Rate Limit Status", twitter_action_get_rate_limit_status); - l = g_list_append(l, action); - - l = g_list_append(l, NULL); - - action = purple_plugin_action_new("Debug - Retrieve users", twitter_action_get_user_info); - l = g_list_append(l, action); - - action = purple_plugin_action_new("Debug - Retrieve replies", twitter_action_get_replies); - l = g_list_append(l, action); - - return l; -} - - - -static void twitter_get_replies_verify_connection_cb(PurpleAccount *acct, xmlnode *node, gpointer user_data) -{ - PurpleConnection *gc = purple_account_get_connection(acct); - if (purple_connection_get_state(gc) == PURPLE_CONNECTING) - { - int id = 0; - xmlnode *status_node = xmlnode_get_child(node, "status"); - if (status_node != NULL) - { - TwitterStatusData *status_data = twitter_status_node_parse(status_node); - if (status_data != NULL) - { - id = status_data->id; - twitter_status_data_free(status_data); - if (id > twitter_account_get_last_reply_id(acct)) - twitter_account_set_last_reply_id(acct, id); - } - } - - purple_connection_update_progress(gc, "Connecting...", - 1, /* which connection step this is */ - 3); /* total number of steps */ - - } - twitter_api_get_friends(acct, - twitter_get_friends_verify_connection_cb, - twitter_get_friends_verify_error_cb, - NULL); -} -static void twitter_get_replies_verify_connection_error_cb(PurpleAccount *acct, const TwitterRequestErrorData *error_data, gpointer user_data) -{ - twitter_verify_connection_error_handler(acct, error_data); -} - -static void twitter_verify_connection(PurpleAccount *acct) -{ - //To verify the connection, we get the user's friends. - //With that we'll update the buddy list and set the last known reply id - twitter_api_get_replies(acct, - 0, 1, 1, - twitter_get_replies_verify_connection_cb, - twitter_get_replies_verify_connection_error_cb, - NULL); -} - -static void twitter_login(PurpleAccount *acct) -{ - PurpleConnection *gc = purple_account_get_connection(acct); - TwitterConnectionData *twitter = g_new0(TwitterConnectionData, 1); - - if ( gc == NULL ) //VOXOX - JRT - 2009.08.26 - prevent crash - return; - - gc->proto_data = twitter; - - purple_debug_info("twitter", "logging in %s\n", acct->username); - - /* purple wants a minimum of 2 steps */ - purple_connection_update_progress(gc, ("Connecting"), - 0, /* which connection step this is */ - 2); /* total number of steps */ - - twitter_verify_connection(acct); - - - -} - -static void twitter_close(PurpleConnection *gc) -{ - /* notify other twitter accounts */ - TwitterConnectionData *twitter = gc->proto_data; - - if ( twitter == NULL ) //VOXOX - JRT - 2009.10.12 - Prevent crash when network is lost or resuming from hibernation. - return; - - if (twitter->get_replies_timer) - purple_timeout_remove(twitter->get_replies_timer); - if (twitter->get_friends_timer) - purple_timeout_remove(twitter->get_friends_timer); - - g_free(twitter); - - gc->proto_data = NULL; //VOXOX - JRT - 2009.10.13 - Since twitter has been freed, let's make it NULL in PurpleConnection. -} - -static void twitter_set_status_error_cb(PurpleAccount *acct, const TwitterRequestErrorData *error_data, gpointer user_data) -{ - const char *message; - if (error_data->type == TWITTER_REQUEST_ERROR_SERVER || error_data->type == TWITTER_REQUEST_ERROR_TWITTER_GENERAL) - { - message = error_data->message; - } else if (error_data->type == TWITTER_REQUEST_ERROR_INVALID_XML) { - message = "Unknown reply by twitter server"; - } else { - message = "Unknown error"; - } - purple_notify_error(NULL, /* plugin handle or PurpleConnection */ - ("Twitter Set Status"), - ("Error setting Twitter Status"), - (message)); -} - -static int twitter_send_im(PurpleConnection *gc, const char *who, - const char *message, PurpleMessageFlags flags) -{ - if (strlen(who) + strlen(message) + 2 > MAX_TWEET_LENGTH) - { - purple_conv_present_error(who, purple_connection_get_account(gc), "Message is too long"); - return 0; - } - else - { - char *status = g_strdup_printf("@%s %s", who, message); - //TODO handle errors - twitter_api_set_status(purple_connection_get_account(gc), status, - twitter_send_im_cb, twitter_set_status_error_cb, NULL); - g_free(status); - return 1; - } - // const char *from_username = gc->account->username; - // PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) - // | PURPLE_MESSAGE_RECV); - // PurpleAccount *to_acct = purple_accounts_find(who, TWITTER_PROTOCOL_ID); - // PurpleConnection *to; - // - // purple_debug_info("twitter", "sending message from %s to %s: %s\n", - // from_username, who, message); - // - // /* is the sender blocked by the recipient's privacy settings? */ - // if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) { - // char *msg = g_strdup_printf( - // _("Your message was blocked by %s's privacy settings."), who); - // purple_debug_info("twitter", - // "discarding; %s is blocked by %s's privacy settings\n", - // from_username, who); - // purple_conv_present_error(who, gc->account, msg); - // g_free(msg); - // return 0; - // } - // - // /* is the recipient online? */ - // to = get_twitter_gc(who); - // if (to) { /* yes, send */ - // PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) - // | PURPLE_MESSAGE_RECV); - // serv_got_im(to, from_username, message, receive_flags, time(NULL)); - // - // } else { /* nope, store as an offline message */ - // GOfflineMessage *offline_message; - // GList *messages; - // - // purple_debug_info("twitter", - // "%s is offline, sending as offline message\n", who); - // offline_message = g_new0(GOfflineMessage, 1); - // offline_message->from = g_strdup(from_username); - // offline_message->message = g_strdup(message); - // offline_message->mtime = time(NULL); - // offline_message->flags = receive_flags; - // - // messages = g_hash_table_lookup(goffline_messages, who); - // messages = g_list_append(messages, offline_message); - // g_hash_table_insert(goffline_messages, g_strdup(who), messages); - // } - // - // return 1; -} - -static void twitter_set_info(PurpleConnection *gc, const char *info) { - purple_debug_info("twitter", "setting %s's user info to %s\n", - gc->account->username, info); -} - -static void twitter_get_info(PurpleConnection *gc, const char *username) { - //TODO: error check - PurpleBuddy *b = purple_find_buddy(purple_connection_get_account(gc), username); - TwitterBuddyData *data = twitter_buddy_get_buddy_data(b); - //VOXOX CHANGE CJC COMPILER DOES NOT LIKE DEFINED OBJECTS AFTER RETURN - //if (!data) - //{ - // //TODO? - // return; - //} - //TwitterUserData *user_data = data->user; - //TwitterStatusData *status_data = data->status; - - //PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - - TwitterUserData *user_data; - TwitterStatusData *status_data; - PurpleNotifyUserInfo *info; - if (!data) - { - //TODO? - return; - } - user_data = data->user; - status_data = data->status; - - info = purple_notify_user_info_new(); - - //body = _("No user info."); - if (user_data) - { - purple_notify_user_info_add_pair(info, "Description:", user_data->description); - } - if (status_data) - { - purple_notify_user_info_add_pair(info, "Status:", status_data->text); - } - - /* show a buddy's user info in a nice dialog box */ - purple_notify_userinfo(gc, /* connection the buddy info came through */ - username, /* buddy's username */ - info, /* body */ - NULL, /* callback called when dialog closed */ - NULL); /* userdata for callback */ -} - - -static void twitter_set_status(PurpleAccount *acct, PurpleStatus *status) { - const char *msg = purple_status_get_attr_string(status, "message"); - purple_debug_info("twitter", "setting %s's status to %s: %s\n", - acct->username, purple_status_get_name(status), msg); - - if (msg && strcmp("", msg)) - { - //TODO, sucecss && fail - twitter_api_set_status(acct, msg, - NULL, twitter_set_status_error_cb, NULL); - } -} - -static void twitter_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - //TODO -} - -static void twitter_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { - GList *buddy = buddies; - GList *group = groups; - - purple_debug_info("twitter", "adding multiple buddies\n"); - - while (buddy && group) { - twitter_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data); - buddy = g_list_next(buddy); - group = g_list_next(group); - } -} - -static void twitter_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - TwitterBuddyData *twitter_buddy_data = buddy->proto_data; - - purple_debug_info("twitter", "removing %s from %s's buddy list\n", - buddy->name, gc->account->username); - - if (!twitter_buddy_data) - return; - twitter_user_data_free(twitter_buddy_data->user); - twitter_status_data_free(twitter_buddy_data->status); - g_free(twitter_buddy_data); - buddy->proto_data = NULL; -} - -static void twitter_remove_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { - GList *buddy = buddies; - GList *group = groups; - - purple_debug_info("twitter", "removing multiple buddies\n"); - - while (buddy && group) { - twitter_remove_buddy(gc, (PurpleBuddy *)buddy->data, - (PurpleGroup *)group->data); - buddy = g_list_next(buddy); - group = g_list_next(group); - } -} - -static void twitter_get_cb_info(PurpleConnection *gc, int id, const char *who) { - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("twitter", - "retrieving %s's info for %s in chat room %s\n", who, - gc->account->username, conv->name); - - twitter_get_info(gc, who); -} - -/* normalize a username (e.g. remove whitespace, add default domain, etc.) - * for twitter, this is a noop. - */ -static const char *twitter_normalize(const PurpleAccount *acct, - const char *input) { - return NULL; -} - -static void twitter_set_buddy_icon(PurpleConnection *gc, - PurpleStoredImage *img) { - purple_debug_info("twitter", "setting %s's buddy icon to %s\n", - gc->account->username, purple_imgstore_get_filename(img)); -} - - -/* - * prpl stuff. see prpl.h for more information. - */ - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC, /* options */ - NULL, /* user_splits, initialized in twitter_init() */ - NULL, /* protocol_options, initialized in twitter_init() */ - //VOXOX CHANGE CJC LEST SEE IF WE GET BIGGER AND BETTER TWITTER AVATARS - { /* icon_spec, a PurpleBuddyIconSpec */ - "png,jpg,gif", /* format */ - 0, /* min_width */ - 0, /* min_height */ - 150, /* max_width */ - 150, /* max_height */ - -1, /* max_filesize */ - PURPLE_ICON_SCALE_SEND, /* scale_rules */ - }, - twitter_list_icon, /* list_icon */ //TODO - NULL, //twitter_list_emblem, /* list_emblem */ - twitter_status_text, /* status_text */ - twitter_tooltip_text, /* tooltip_text */ - twitter_status_types, /* status_types */ - NULL, //twitter_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - twitter_login, /* login */ - twitter_close, /* close */ - twitter_send_im, /* send_im */ - twitter_set_info, /* set_info */ - NULL, //twitter_send_typing, /* send_typing */ - twitter_get_info, /* get_info */ - twitter_set_status, /* set_status */ - NULL, /* set_idle */ - NULL,//TODO? /* change_passwd */ - twitter_add_buddy,//TODO /* add_buddy */ - twitter_add_buddies,//TODO /* add_buddies */ - twitter_remove_buddy,//TODO /* remove_buddy */ - twitter_remove_buddies,//TODO /* remove_buddies */ - NULL,//TODO? /* add_permit */ - NULL,//TODO? /* add_deny */ - NULL,//TODO? /* rem_permit */ - NULL,//TODO? /* rem_deny */ - NULL,//TODO? /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL,//twitter_chat_whisper, /* chat_whisper */ - NULL, /* chat_send */ - NULL,//TODO? /* keepalive */ - NULL, /* register_user */ - twitter_get_cb_info, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL,//TODO? /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - twitter_normalize, /* normalize */ - twitter_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL,//TODO? /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* padding... */ - NULL, - NULL, - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL -}; - -static void twitter_init(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - purple_debug_info("twitter", "starting up\n"); - - option = purple_account_option_bool_new( - ("Enable HTTPS"), /* text shown to user */ - "use_https", /* pref name */ - FALSE); /* default value */ - prpl_info.protocol_options = g_list_append(NULL, option); - - option = purple_account_option_int_new( - ("Check for new replies every (sec):"), /* text shown to user */ - TWITTER_PREF_REPLIES_TIMEOUT_NAME, /* pref name */ - TWITTER_PREF_REPLIES_TIMEOUT_DEFAULT); /* default value */ - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new( - ("Check for new user statuses every (sec):"), /* text shown to user */ - TWITTER_PREF_USER_STATUS_TIMEOUT_NAME, /* pref name */ - TWITTER_PREF_USER_STATUS_TIMEOUT_DEFAULT); /* default value */ - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - _twitter_protocol = plugin; -} - -static void twitter_destroy(PurplePlugin *plugin) { - purple_debug_info("twitter", "shutting down\n"); -} - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /* magic */ - PURPLE_MAJOR_VERSION, /* major_version */ - PURPLE_MINOR_VERSION, /* minor_version */ - PURPLE_PLUGIN_PROTOCOL, /* type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - TWITTER_PROTOCOL_ID, /* id */ - "Twitter Protocol", /* name */ - "0.1", /* version */ - "Twitter Protocol Plugin", /* summary */ - "Twitter Protocol Plugin", /* description */ - "neaveru ", /* author */ - "http://code.google.com/p/libpurple-twitter-protocol/", /* homepage */ - NULL, /* load */ - NULL, /* unload */ - twitter_destroy, /* destroy */ - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - twitter_actions, /* actions */ - NULL, /* padding... */ - NULL, - NULL, - NULL, -}; -//VOXOX CHANGE CJC ADD NAME TO TWITTER -//PURPLE_INIT_PLUGIN(null, twitter_init, info); -PURPLE_INIT_PLUGIN(twitter, twitter_init, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/** - * TODO: legal stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include - -/* If you're using this as the basis of a prpl that will be distributed - * separately from libpurple, remove the internal.h include below and replace - * it with code to include your own config.h or similar. If you're going to - * provide for translation, you'll also need to setup the gettext macros. */ -#include "config.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cmds.h" -#include "conversation.h" -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "roomlist.h" -#include "status.h" -#include "util.h" -#include "version.h" -#include "cipher.h" -#include "sslconn.h" -#include "request.h" -#include "twitter_request.h" -#include "twitter_api.h" diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ -/** - * TODO: legal stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include - -/* If you're using this as the basis of a prpl that will be distributed - * separately from libpurple, remove the internal.h include below and replace - * it with code to include your own config.h or similar. If you're going to - * provide for translation, you'll also need to setup the gettext macros. */ -#include "config.h" - -#include "debug.h" -#include "request.h" -#include "twitter_request.h" - -typedef struct { - PurpleAccount *account; - TwitterSendRequestSuccessFunc success_func; - TwitterSendRequestErrorFunc error_func; - gpointer user_data; -} TwitterSendRequestData; - -typedef struct -{ - gpointer user_data; - char *url; - char *query_string; - TwitterSendRequestMultiPageSuccessFunc success_callback; - TwitterSendRequestMultiPageErrorFunc error_callback; - int page; - int expected_count; -} TwitterMultiPageRequestData; - -typedef struct -{ - GList *nodes; - TwitterSendRequestMultiPageAllSuccessFunc success_callback; - TwitterSendRequestMultiPageAllErrorFunc error_callback; - gpointer user_data; -} TwitterMultiPageAllRequestData; - -void twitter_send_request_multipage_do(PurpleAccount *account, - TwitterMultiPageRequestData *request_data); - -void twitter_send_request_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, gsize len, - const gchar *server_error_message) -{ - TwitterSendRequestData *request_data = user_data; - const gchar *error_message = NULL; - gchar *error_node_text = NULL; - xmlnode *response_node = NULL; - TwitterRequestErrorType error_type = TWITTER_REQUEST_ERROR_NONE; - - purple_debug_info("twitter", "Response: %s\n", url_text); - - if (server_error_message) - { - error_type = TWITTER_REQUEST_ERROR_SERVER; - error_message = server_error_message; - } else { - response_node = xmlnode_from_str(url_text, len); - if (!response_node) - { - error_type = TWITTER_REQUEST_ERROR_INVALID_XML; - error_message = url_text; - } else { - xmlnode *error_node; - if ((error_node = xmlnode_get_child(response_node, "error")) != NULL) - { - error_type = TWITTER_REQUEST_ERROR_TWITTER_GENERAL; - error_node_text = xmlnode_get_data(error_node); - error_message = error_node_text; - } - } - } - - if (error_type != TWITTER_REQUEST_ERROR_NONE) - { - TwitterRequestErrorData *error_data = g_new0(TwitterRequestErrorData, 1); - error_data->type = error_type; - error_data->message = error_message; - //error_data->response_node = response_node; - if (request_data->error_func) - request_data->error_func(request_data->account, error_data, request_data->user_data); - - g_free(error_data); - } else { - if (request_data->success_func) - request_data->success_func(request_data->account, response_node, request_data->user_data); - } - - if (response_node != NULL) - xmlnode_free(response_node); - if (error_node_text != NULL) - g_free(error_node_text); - g_free(request_data); -} - -void twitter_send_request(PurpleAccount *account, gboolean post, - const char *url, const char *query_string, - TwitterSendRequestSuccessFunc success_callback, TwitterSendRequestErrorFunc error_callback, - gpointer data) -{ - gchar *request; - const char *pass = purple_connection_get_password(purple_account_get_connection(account)); - const char *sn = purple_account_get_username(account); - char *auth_text = g_strdup_printf("%s:%s", sn, pass); - char *auth_text_b64 = purple_base64_encode((guchar *) auth_text, strlen(auth_text)); - gboolean use_https = purple_account_get_bool(account, "use_https", FALSE) && purple_ssl_is_supported(); - char *host = "twitter.com"; - TwitterSendRequestData *request_data = g_new0(TwitterSendRequestData, 1); - char *full_url = g_strdup_printf("%s://%s%s", - use_https ? "https" : "http", - host, - url); - request_data->account = account; - request_data->user_data = data; - request_data->success_func = success_callback; - request_data->error_func = error_callback; - - g_free(auth_text); - - request = g_strdup_printf( - "%s %s%s%s HTTP/1.0\r\n" - "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" - "Host: %s\r\n" - "Authorization: Basic %s\r\n" - "Content-Length: %d\r\n\r\n" - "%s", - post ? "POST" : "GET", - full_url, - (!post && query_string ? "?" : ""), (!post && query_string ? query_string : ""), - host, - auth_text_b64, - query_string && post ? strlen(query_string) : 0, - query_string && post ? query_string : ""); - - g_free(auth_text_b64); - purple_util_fetch_url_request(full_url, TRUE, - "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE, - twitter_send_request_cb, request_data); - g_free(full_url); - g_free(request); -} - -void twitter_send_request_multipage_cb(PurpleAccount *account, xmlnode *node, gpointer user_data) -{ - TwitterMultiPageRequestData *request_data = user_data; - xmlnode *child = node->child; - int count = 0; - gboolean get_next_page; - gboolean last_page; - while ((child = child->next) != NULL) - if (child->name) - count++; - - last_page = count < request_data->expected_count; - if (!request_data->success_callback) - get_next_page = TRUE; - else - get_next_page = request_data->success_callback(account, node, last_page, request_data->user_data); - - if (last_page) - { - g_free(request_data->url); - if (request_data->query_string) - g_free(request_data->query_string); - } else { - request_data->page++; - twitter_send_request_multipage_do(account, request_data); - } -} -void twitter_send_request_multipage_error_cb(PurpleAccount *account, const TwitterRequestErrorData *error_data, gpointer user_data) -{ - TwitterMultiPageRequestData *request_data = user_data; - gboolean try_again; - - if (!request_data->error_callback) - try_again = FALSE; - else - try_again = request_data->error_callback(account, error_data, request_data->user_data); - - if (try_again) - twitter_send_request_multipage_do(account, request_data); -} - -void twitter_send_request_multipage_do(PurpleAccount *account, - TwitterMultiPageRequestData *request_data) -{ - char *full_query_string = g_strdup_printf("%s%spage=%d", - request_data->query_string ? request_data->query_string : "", - request_data->query_string && strlen(request_data->query_string) > 0 ? "&" : "", - request_data->page); - - twitter_send_request(account, FALSE, - request_data->url, full_query_string, - twitter_send_request_multipage_cb, twitter_send_request_multipage_error_cb, - request_data); - g_free(full_query_string); -} - -//don't include count in the query_string -void twitter_send_request_multipage(PurpleAccount *account, - const char *url, const char *query_string, - TwitterSendRequestMultiPageSuccessFunc success_callback, - TwitterSendRequestMultiPageErrorFunc error_callback, - int expected_count, gpointer data) -{ - TwitterMultiPageRequestData *request_data = g_new0(TwitterMultiPageRequestData, 1); - request_data->user_data = data; - request_data->url = g_strdup(url); - request_data->query_string = query_string ? g_strdup(query_string) : NULL; - request_data->success_callback = success_callback; - request_data->error_callback = error_callback; - request_data->page = 1; - request_data->expected_count = expected_count; - - twitter_send_request_multipage_do(account, request_data); -} - -static void twitter_multipage_all_request_data_free(TwitterMultiPageAllRequestData *request_data_all) -{ - GList *l = request_data_all->nodes; - for (l = request_data_all->nodes; l; l = l->next) - { - xmlnode_free(l->data); - } - g_list_free(request_data_all->nodes); - g_free(request_data_all); -} - -static gboolean twitter_send_request_multipage_all_success_cb(PurpleAccount *acct, xmlnode *node, gboolean last_page, gpointer user_data) -{ - TwitterMultiPageAllRequestData *request_data_all = user_data; - request_data_all->nodes = g_list_append(request_data_all->nodes, xmlnode_copy(node)); //TODO: update - if (last_page) - { - request_data_all->success_callback(acct, request_data_all->nodes, request_data_all->user_data); - twitter_multipage_all_request_data_free(request_data_all); - } - return TRUE; -} -static gboolean twitter_send_request_multipage_all_error_cb(PurpleAccount *acct, const TwitterRequestErrorData *error_data, gpointer user_data) -{ - TwitterMultiPageAllRequestData *request_data_all = user_data; - if (request_data_all->error_callback && request_data_all->error_callback(acct, error_data, request_data_all->user_data)) - return TRUE; - twitter_multipage_all_request_data_free(request_data_all); - return FALSE; -} - -void twitter_send_request_multipage_all(PurpleAccount *account, - const char *url, const char *query_string, - TwitterSendRequestMultiPageAllSuccessFunc success_callback, - TwitterSendRequestMultiPageAllErrorFunc error_callback, - int expected_count, gpointer data) -{ - TwitterMultiPageAllRequestData *request_data_all = g_new0(TwitterMultiPageAllRequestData, 1); - request_data_all->success_callback = success_callback; - request_data_all->error_callback = error_callback; - request_data_all->nodes = NULL; - request_data_all->user_data = data; - - twitter_send_request_multipage(account, - url, query_string, - twitter_send_request_multipage_all_success_cb, - twitter_send_request_multipage_all_error_cb, - expected_count, request_data_all); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/twitter_request.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/** - * TODO: legal stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include - -typedef enum -{ - TWITTER_REQUEST_ERROR_NONE, - TWITTER_REQUEST_ERROR_SERVER, - TWITTER_REQUEST_ERROR_TWITTER_GENERAL, - TWITTER_REQUEST_ERROR_INVALID_XML -} TwitterRequestErrorType; - -typedef struct -{ - TwitterRequestErrorType type; - /*const xmlnode *response_node;*/ - const gchar *message; -} TwitterRequestErrorData; - -typedef void (*TwitterSendRequestSuccessFunc)(PurpleAccount *acct, xmlnode *node, gpointer user_data); -typedef void (*TwitterSendRequestErrorFunc)(PurpleAccount *acct, const TwitterRequestErrorData *error_data, gpointer user_data); - -typedef gboolean (*TwitterSendRequestMultiPageSuccessFunc)(PurpleAccount *acct, xmlnode *node, gboolean last_page, gpointer user_data); -typedef gboolean (*TwitterSendRequestMultiPageErrorFunc)(PurpleAccount *acct, const TwitterRequestErrorData *error_data, gpointer user_data); - -typedef void (*TwitterSendRequestMultiPageAllSuccessFunc)(PurpleAccount *acct, GList *nodes, gpointer user_data); -typedef gboolean (*TwitterSendRequestMultiPageAllErrorFunc)(PurpleAccount *acct, const TwitterRequestErrorData *error_data, gpointer user_data); - -void twitter_send_request(PurpleAccount *account, gboolean post, - const char *url, const char *query_string, - TwitterSendRequestSuccessFunc success_callback, TwitterSendRequestErrorFunc error_callback, - gpointer data); - -//don't include count in the query_string -void twitter_send_request_multipage(PurpleAccount *account, - const char *url, const char *query_string, - TwitterSendRequestMultiPageSuccessFunc success_callback, TwitterSendRequestMultiPageErrorFunc error_callback, - int expected_count, gpointer data); - -void twitter_send_request_multipage_all(PurpleAccount *account, - const char *url, const char *query_string, - TwitterSendRequestMultiPageAllSuccessFunc success_callback, - TwitterSendRequestMultiPageAllErrorFunc error_callback, - int expected_count, gpointer data); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/version.mak qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/version.mak --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/version.mak 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/plugins/twitter/version.mak 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -PACKAGE := libpurple-twitter-protocol -VERSION := 0.1.3 diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1163 +0,0 @@ -/** - * @file pounce.c Buddy Pounce API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" -#include "conversation.h" -#include "debug.h" -#include "pounce.h" - -#include "debug.h" -#include "pounce.h" -#include "util.h" - -typedef struct -{ - GString *buffer; - - PurplePounce *pounce; - PurplePounceEvent events; - PurplePounceOption options; - - char *ui_name; - char *pouncee; - char *protocol_id; - char *event_type; - char *option_type; - char *action_name; - char *param_name; - char *account_name; - -} PounceParserData; - -typedef struct -{ - char *name; - - gboolean enabled; - - GHashTable *atts; - -} PurplePounceActionData; - -typedef struct -{ - char *ui; - PurplePounceCb cb; - void (*new_pounce)(PurplePounce *); - void (*free_pounce)(PurplePounce *); - -} PurplePounceHandler; - - -static GHashTable *pounce_handlers = NULL; -static GList *pounces = NULL; -static guint save_timer = 0; -static gboolean pounces_loaded = FALSE; - - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static PurplePounceActionData * -find_action_data(const PurplePounce *pounce, const char *name) -{ - PurplePounceActionData *action; - - g_return_val_if_fail(pounce != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - action = g_hash_table_lookup(pounce->actions, name); - - return action; -} - -static void -free_action_data(gpointer data) -{ - PurplePounceActionData *action_data = data; - - g_free(action_data->name); - - g_hash_table_destroy(action_data->atts); - - g_free(action_data); -} - - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static void -action_parameter_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *name, *param_value; - xmlnode *node, *child; - - name = (const char *)key; - param_value = (const char *)value; - node = (xmlnode *)user_data; - - child = xmlnode_new_child(node, "param"); - xmlnode_set_attrib(child, "name", name); - xmlnode_insert_data(child, param_value, -1); -} - -static void -action_parameter_list_to_xmlnode(gpointer key, gpointer value, gpointer user_data) -{ - const char *action; - PurplePounceActionData *action_data; - xmlnode *node, *child; - - action = (const char *)key; - action_data = (PurplePounceActionData *)value; - node = (xmlnode *)user_data; - - if (!action_data->enabled) - return; - - child = xmlnode_new_child(node, "action"); - xmlnode_set_attrib(child, "type", action); - - g_hash_table_foreach(action_data->atts, action_parameter_to_xmlnode, child); -} - -static void -add_event_to_xmlnode(xmlnode *node, const char *type) -{ - xmlnode *child; - - child = xmlnode_new_child(node, "event"); - xmlnode_set_attrib(child, "type", type); -} - -static void -add_option_to_xmlnode(xmlnode *node, const char *type) -{ - xmlnode *child; - - child = xmlnode_new_child(node, "option"); - xmlnode_set_attrib(child, "type", type); -} - -static xmlnode * -pounce_to_xmlnode(PurplePounce *pounce) -{ - xmlnode *node, *child; - PurpleAccount *pouncer; - PurplePounceEvent events; - PurplePounceOption options; - - pouncer = purple_pounce_get_pouncer(pounce); - events = purple_pounce_get_events(pounce); - options = purple_pounce_get_options(pounce); - - node = xmlnode_new("pounce"); - xmlnode_set_attrib(node, "ui", pounce->ui_type); - - child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", pouncer->protocol_id); - xmlnode_insert_data(child, - purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); - - child = xmlnode_new_child(node, "pouncee"); - xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); - - /* Write pounce options */ - child = xmlnode_new_child(node, "options"); - if (options & PURPLE_POUNCE_OPTION_AWAY) - add_option_to_xmlnode(child, "on-away"); - - /* Write pounce events */ - child = xmlnode_new_child(node, "events"); - if (events & PURPLE_POUNCE_SIGNON) - add_event_to_xmlnode(child, "sign-on"); - if (events & PURPLE_POUNCE_SIGNOFF) - add_event_to_xmlnode(child, "sign-off"); - if (events & PURPLE_POUNCE_AWAY) - add_event_to_xmlnode(child, "away"); - if (events & PURPLE_POUNCE_AWAY_RETURN) - add_event_to_xmlnode(child, "return-from-away"); - if (events & PURPLE_POUNCE_IDLE) - add_event_to_xmlnode(child, "idle"); - if (events & PURPLE_POUNCE_IDLE_RETURN) - add_event_to_xmlnode(child, "return-from-idle"); - if (events & PURPLE_POUNCE_TYPING) - add_event_to_xmlnode(child, "start-typing"); - if (events & PURPLE_POUNCE_TYPED) - add_event_to_xmlnode(child, "typed"); - if (events & PURPLE_POUNCE_TYPING_STOPPED) - add_event_to_xmlnode(child, "stop-typing"); - if (events & PURPLE_POUNCE_MESSAGE_RECEIVED) - add_event_to_xmlnode(child, "message-received"); - - /* Write pounce actions */ - child = xmlnode_new_child(node, "actions"); - g_hash_table_foreach(pounce->actions, action_parameter_list_to_xmlnode, child); - - if (purple_pounce_get_save(pounce)) - child = xmlnode_new_child(node, "save"); - - return node; -} - -static xmlnode * -pounces_to_xmlnode(void) -{ - xmlnode *node, *child; - GList *cur; - - node = xmlnode_new("pounces"); - xmlnode_set_attrib(node, "version", "1.0"); - - for (cur = purple_pounces_get_all(); cur != NULL; cur = cur->next) - { - child = pounce_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static void -sync_pounces(void) -{ - xmlnode *node; - char *data; - - if (!pounces_loaded) - { - purple_debug_error("pounce", "Attempted to save buddy pounces before " - "they were read!\n"); - return; - } - - node = pounces_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("pounces.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_pounces(); - save_timer = 0; - return FALSE; -} - -static void -schedule_pounces_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static void -free_parser_data(gpointer user_data) -{ - PounceParserData *data = user_data; - - if (data->buffer != NULL) - g_string_free(data->buffer, TRUE); - - g_free(data->ui_name); - g_free(data->pouncee); - g_free(data->protocol_id); - g_free(data->event_type); - g_free(data->option_type); - g_free(data->action_name); - g_free(data->param_name); - g_free(data->account_name); - - g_free(data); -} - -static void -start_element_handler(GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, GError **error) -{ - PounceParserData *data = user_data; - GHashTable *atts; - int i; - - atts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - for (i = 0; attribute_names[i] != NULL; i++) { - g_hash_table_insert(atts, g_strdup(attribute_names[i]), - g_strdup(attribute_values[i])); - } - - if (data->buffer != NULL) { - g_string_free(data->buffer, TRUE); - data->buffer = NULL; - } - - if (purple_strequal(element_name, "pounce")) { - const char *ui = g_hash_table_lookup(atts, "ui"); - - if (ui == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'ui' parameter for pounce!\n"); - } - else - data->ui_name = g_strdup(ui); - - data->events = 0; - } - else if (purple_strequal(element_name, "account")) { - const char *protocol_id = g_hash_table_lookup(atts, "protocol"); - - if (protocol_id == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'protocol' parameter for account!\n"); - } - else - data->protocol_id = g_strdup(protocol_id); - } - else if (purple_strequal(element_name, "option")) { - const char *type = g_hash_table_lookup(atts, "type"); - - if (type == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'type' parameter for option!\n"); - } - else - data->option_type = g_strdup(type); - } - else if (purple_strequal(element_name, "event")) { - const char *type = g_hash_table_lookup(atts, "type"); - - if (type == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'type' parameter for event!\n"); - } - else - data->event_type = g_strdup(type); - } - else if (purple_strequal(element_name, "action")) { - const char *type = g_hash_table_lookup(atts, "type"); - - if (type == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'type' parameter for action!\n"); - } - else - data->action_name = g_strdup(type); - } - else if (purple_strequal(element_name, "param")) { - const char *param_name = g_hash_table_lookup(atts, "name"); - - if (param_name == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Unset 'name' parameter for param!\n"); - } - else - data->param_name = g_strdup(param_name); - } - - g_hash_table_destroy(atts); -} - -static void -end_element_handler(GMarkupParseContext *context, const gchar *element_name, - gpointer user_data, GError **error) -{ - PounceParserData *data = user_data; - gchar *buffer = NULL; - - if (data->buffer != NULL) { - buffer = g_string_free(data->buffer, FALSE); - data->buffer = NULL; - } - - if (purple_strequal(element_name, "account")) { - char *tmp; - g_free(data->account_name); - data->account_name = g_strdup(buffer); - tmp = data->protocol_id; - data->protocol_id = g_strdup(_purple_oscar_convert(buffer, tmp)); - g_free(tmp); - } - else if (purple_strequal(element_name, "pouncee")) { - g_free(data->pouncee); - data->pouncee = g_strdup(buffer); - } - else if (purple_strequal(element_name, "option")) { - if (purple_strequal(data->option_type, "on-away")) - data->options |= PURPLE_POUNCE_OPTION_AWAY; - - g_free(data->option_type); - data->option_type = NULL; - } - else if (purple_strequal(element_name, "event")) { - if (purple_strequal(data->event_type, "sign-on")) - data->events |= PURPLE_POUNCE_SIGNON; - else if (purple_strequal(data->event_type, "sign-off")) - data->events |= PURPLE_POUNCE_SIGNOFF; - else if (purple_strequal(data->event_type, "away")) - data->events |= PURPLE_POUNCE_AWAY; - else if (purple_strequal(data->event_type, "return-from-away")) - data->events |= PURPLE_POUNCE_AWAY_RETURN; - else if (purple_strequal(data->event_type, "idle")) - data->events |= PURPLE_POUNCE_IDLE; - else if (purple_strequal(data->event_type, "return-from-idle")) - data->events |= PURPLE_POUNCE_IDLE_RETURN; - else if (purple_strequal(data->event_type, "start-typing")) - data->events |= PURPLE_POUNCE_TYPING; - else if (purple_strequal(data->event_type, "typed")) - data->events |= PURPLE_POUNCE_TYPED; - else if (purple_strequal(data->event_type, "stop-typing")) - data->events |= PURPLE_POUNCE_TYPING_STOPPED; - else if (purple_strequal(data->event_type, "message-received")) - data->events |= PURPLE_POUNCE_MESSAGE_RECEIVED; - - g_free(data->event_type); - data->event_type = NULL; - } - else if (purple_strequal(element_name, "action")) { - if (data->pounce != NULL) { - purple_pounce_action_register(data->pounce, data->action_name); - purple_pounce_action_set_enabled(data->pounce, data->action_name, TRUE); - } - - g_free(data->action_name); - data->action_name = NULL; - } - else if (purple_strequal(element_name, "param")) { - if (data->pounce != NULL) { - purple_pounce_action_set_attribute(data->pounce, data->action_name, - data->param_name, buffer); - } - - g_free(data->param_name); - data->param_name = NULL; - } - else if (purple_strequal(element_name, "events")) { - PurpleAccount *account; - - account = purple_accounts_find(data->account_name, data->protocol_id); - - g_free(data->account_name); - g_free(data->protocol_id); - - data->account_name = NULL; - data->protocol_id = NULL; - - if (account == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Account for pounce not found!\n"); - /* - * This pounce has effectively been removed, so make - * sure that we save the changes to pounces.xml - */ - schedule_pounces_save(); - } - else { - purple_debug(PURPLE_DEBUG_INFO, "pounce", - "Creating pounce: %s, %s\n", data->ui_name, - data->pouncee); - - data->pounce = purple_pounce_new(data->ui_name, account, - data->pouncee, data->events, - data->options); - } - - g_free(data->pouncee); - data->pouncee = NULL; - } - else if (purple_strequal(element_name, "save")) { - if (data->pounce != NULL) - purple_pounce_set_save(data->pounce, TRUE); - } - else if (purple_strequal(element_name, "pounce")) { - data->pounce = NULL; - data->events = 0; - data->options = 0; - - g_free(data->ui_name); - g_free(data->pouncee); - g_free(data->protocol_id); - g_free(data->event_type); - g_free(data->option_type); - g_free(data->action_name); - g_free(data->param_name); - g_free(data->account_name); - - data->ui_name = NULL; - data->pounce = NULL; - data->protocol_id = NULL; - data->event_type = NULL; - data->option_type = NULL; - data->action_name = NULL; - data->param_name = NULL; - data->account_name = NULL; - } - - g_free(buffer); -} - -static void -text_handler(GMarkupParseContext *context, const gchar *text, - gsize text_len, gpointer user_data, GError **error) -{ - PounceParserData *data = user_data; - - if (data->buffer == NULL) - data->buffer = g_string_new_len(text, text_len); - else - g_string_append_len(data->buffer, text, text_len); -} - -static GMarkupParser pounces_parser = -{ - start_element_handler, - end_element_handler, - text_handler, - NULL, - NULL -}; - -gboolean -purple_pounces_load(void) -{ - gchar *filename = g_build_filename(purple_user_dir(), "pounces.xml", NULL); - gchar *contents = NULL; - gsize length; - GMarkupParseContext *context; - GError *error = NULL; - PounceParserData *parser_data; - - if (filename == NULL) { - pounces_loaded = TRUE; - return FALSE; - } - - if (!g_file_get_contents(filename, &contents, &length, &error)) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", - "Error reading pounces: %s\n", error->message); - - g_free(filename); - g_error_free(error); - - pounces_loaded = TRUE; - return FALSE; - } - - parser_data = g_new0(PounceParserData, 1); - - context = g_markup_parse_context_new(&pounces_parser, 0, - parser_data, free_parser_data); - - if (!g_markup_parse_context_parse(context, contents, length, NULL)) { - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - - pounces_loaded = TRUE; - - return FALSE; - } - - if (!g_markup_parse_context_end_parse(context, NULL)) { - purple_debug(PURPLE_DEBUG_ERROR, "pounce", "Error parsing %s\n", - filename); - - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - pounces_loaded = TRUE; - - return FALSE; - } - - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - - pounces_loaded = TRUE; - - return TRUE; -} - - -PurplePounce * -purple_pounce_new(const char *ui_type, PurpleAccount *pouncer, - const char *pouncee, PurplePounceEvent event, - PurplePounceOption option) -{ - PurplePounce *pounce; - PurplePounceHandler *handler; - - g_return_val_if_fail(ui_type != NULL, NULL); - g_return_val_if_fail(pouncer != NULL, NULL); - g_return_val_if_fail(pouncee != NULL, NULL); - g_return_val_if_fail(event != 0, NULL); - - pounce = g_new0(PurplePounce, 1); - - pounce->ui_type = g_strdup(ui_type); - pounce->pouncer = pouncer; - pounce->pouncee = g_strdup(pouncee); - pounce->events = event; - pounce->options = option; - - pounce->actions = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, free_action_data); - - handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); - - if (handler != NULL && handler->new_pounce != NULL) - handler->new_pounce(pounce); - - pounces = g_list_append(pounces, pounce); - - schedule_pounces_save(); - - return pounce; -} - -void -purple_pounce_destroy(PurplePounce *pounce) -{ - PurplePounceHandler *handler; - - g_return_if_fail(pounce != NULL); - - handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); - - pounces = g_list_remove(pounces, pounce); - - g_free(pounce->ui_type); - g_free(pounce->pouncee); - - g_hash_table_destroy(pounce->actions); - - if (handler != NULL && handler->free_pounce != NULL) - handler->free_pounce(pounce); - - g_free(pounce); - - schedule_pounces_save(); -} - -void -purple_pounce_destroy_all_by_account(PurpleAccount *account) -{ - PurpleAccount *pouncer; - PurplePounce *pounce; - GList *l, *l_next; - - g_return_if_fail(account != NULL); - - for (l = purple_pounces_get_all(); l != NULL; l = l_next) - { - pounce = (PurplePounce *)l->data; - l_next = l->next; - - pouncer = purple_pounce_get_pouncer(pounce); - if (pouncer == account) - purple_pounce_destroy(pounce); - } -} - -void -purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events) -{ - g_return_if_fail(pounce != NULL); - g_return_if_fail(events != PURPLE_POUNCE_NONE); - - pounce->events = events; - - schedule_pounces_save(); -} - -void -purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options) -{ - g_return_if_fail(pounce != NULL); - - pounce->options = options; - - schedule_pounces_save(); -} - -void -purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer) -{ - g_return_if_fail(pounce != NULL); - g_return_if_fail(pouncer != NULL); - - pounce->pouncer = pouncer; - - schedule_pounces_save(); -} - -void -purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee) -{ - g_return_if_fail(pounce != NULL); - g_return_if_fail(pouncee != NULL); - - g_free(pounce->pouncee); - pounce->pouncee = g_strdup(pouncee); - - schedule_pounces_save(); -} - -void -purple_pounce_set_save(PurplePounce *pounce, gboolean save) -{ - g_return_if_fail(pounce != NULL); - - pounce->save = save; - - schedule_pounces_save(); -} - -void -purple_pounce_action_register(PurplePounce *pounce, const char *name) -{ - PurplePounceActionData *action_data; - - g_return_if_fail(pounce != NULL); - g_return_if_fail(name != NULL); - - if (g_hash_table_lookup(pounce->actions, name) != NULL) - return; - - action_data = g_new0(PurplePounceActionData, 1); - - action_data->name = g_strdup(name); - action_data->enabled = FALSE; - action_data->atts = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - g_hash_table_insert(pounce->actions, g_strdup(name), action_data); - - schedule_pounces_save(); -} - -void -purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action, - gboolean enabled) -{ - PurplePounceActionData *action_data; - - g_return_if_fail(pounce != NULL); - g_return_if_fail(action != NULL); - - action_data = find_action_data(pounce, action); - - g_return_if_fail(action_data != NULL); - - action_data->enabled = enabled; - - schedule_pounces_save(); -} - -void -purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action, - const char *attr, const char *value) -{ - PurplePounceActionData *action_data; - - g_return_if_fail(pounce != NULL); - g_return_if_fail(action != NULL); - g_return_if_fail(attr != NULL); - - action_data = find_action_data(pounce, action); - - g_return_if_fail(action_data != NULL); - - if (value == NULL) - g_hash_table_remove(action_data->atts, attr); - else - g_hash_table_insert(action_data->atts, g_strdup(attr), - g_strdup(value)); - - schedule_pounces_save(); -} - -void -purple_pounce_set_data(PurplePounce *pounce, void *data) -{ - g_return_if_fail(pounce != NULL); - - pounce->data = data; - - schedule_pounces_save(); -} - -PurplePounceEvent -purple_pounce_get_events(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, PURPLE_POUNCE_NONE); - - return pounce->events; -} - -PurplePounceOption -purple_pounce_get_options(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, PURPLE_POUNCE_OPTION_NONE); - - return pounce->options; -} - -PurpleAccount * -purple_pounce_get_pouncer(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, NULL); - - return pounce->pouncer; -} - -const char * -purple_pounce_get_pouncee(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, NULL); - - return pounce->pouncee; -} - -gboolean -purple_pounce_get_save(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, FALSE); - - return pounce->save; -} - -gboolean -purple_pounce_action_is_enabled(const PurplePounce *pounce, const char *action) -{ - PurplePounceActionData *action_data; - - g_return_val_if_fail(pounce != NULL, FALSE); - g_return_val_if_fail(action != NULL, FALSE); - - action_data = find_action_data(pounce, action); - - g_return_val_if_fail(action_data != NULL, FALSE); - - return action_data->enabled; -} - -const char * -purple_pounce_action_get_attribute(const PurplePounce *pounce, - const char *action, const char *attr) -{ - PurplePounceActionData *action_data; - - g_return_val_if_fail(pounce != NULL, NULL); - g_return_val_if_fail(action != NULL, NULL); - g_return_val_if_fail(attr != NULL, NULL); - - action_data = find_action_data(pounce, action); - - g_return_val_if_fail(action_data != NULL, NULL); - - return g_hash_table_lookup(action_data->atts, attr); -} - -void * -purple_pounce_get_data(const PurplePounce *pounce) -{ - g_return_val_if_fail(pounce != NULL, NULL); - - return pounce->data; -} - -void -purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee, - PurplePounceEvent events) -{ - PurplePounce *pounce; - PurplePounceHandler *handler; - PurplePresence *presence; - GList *l, *l_next; - char *norm_pouncee; - - g_return_if_fail(pouncer != NULL); - g_return_if_fail(pouncee != NULL); - g_return_if_fail(events != PURPLE_POUNCE_NONE); - - norm_pouncee = g_strdup(purple_normalize(pouncer, pouncee)); - - for (l = purple_pounces_get_all(); l != NULL; l = l_next) - { - pounce = (PurplePounce *)l->data; - l_next = l->next; - - presence = purple_account_get_presence(pouncer); - - if ((purple_pounce_get_events(pounce) & events) && - (purple_pounce_get_pouncer(pounce) == pouncer) && - !purple_utf8_strcasecmp(purple_normalize(pouncer, purple_pounce_get_pouncee(pounce)), - norm_pouncee) && - (pounce->options == PURPLE_POUNCE_OPTION_NONE || - (pounce->options & PURPLE_POUNCE_OPTION_AWAY && - !purple_presence_is_available(presence)))) - { - handler = g_hash_table_lookup(pounce_handlers, pounce->ui_type); - - if (handler != NULL && handler->cb != NULL) - { - handler->cb(pounce, events, purple_pounce_get_data(pounce)); - - if (!purple_pounce_get_save(pounce)) - purple_pounce_destroy(pounce); - } - } - } - - g_free(norm_pouncee); -} - -PurplePounce * -purple_find_pounce(const PurpleAccount *pouncer, const char *pouncee, - PurplePounceEvent events) -{ - PurplePounce *pounce = NULL; - GList *l; - char *norm_pouncee; - - g_return_val_if_fail(pouncer != NULL, NULL); - g_return_val_if_fail(pouncee != NULL, NULL); - g_return_val_if_fail(events != PURPLE_POUNCE_NONE, NULL); - - norm_pouncee = g_strdup(purple_normalize(pouncer, pouncee)); - - for (l = purple_pounces_get_all(); l != NULL; l = l->next) - { - pounce = (PurplePounce *)l->data; - - if ((purple_pounce_get_events(pounce) & events) && - (purple_pounce_get_pouncer(pounce) == pouncer) && - !purple_utf8_strcasecmp(purple_normalize(pouncer, purple_pounce_get_pouncee(pounce)), - norm_pouncee)) - { - break; - } - - pounce = NULL; - } - - g_free(norm_pouncee); - - return pounce; -} - -void -purple_pounces_register_handler(const char *ui, PurplePounceCb cb, - void (*new_pounce)(PurplePounce *pounce), - void (*free_pounce)(PurplePounce *pounce)) -{ - PurplePounceHandler *handler; - - g_return_if_fail(ui != NULL); - g_return_if_fail(cb != NULL); - - handler = g_new0(PurplePounceHandler, 1); - - handler->ui = g_strdup(ui); - handler->cb = cb; - handler->new_pounce = new_pounce; - handler->free_pounce = free_pounce; - - g_hash_table_insert(pounce_handlers, g_strdup(ui), handler); -} - -void -purple_pounces_unregister_handler(const char *ui) -{ - g_return_if_fail(ui != NULL); - - g_hash_table_remove(pounce_handlers, ui); -} - -GList * -purple_pounces_get_all(void) -{ - return pounces; -} - -GList *purple_pounces_get_all_for_ui(const char *ui) -{ - GList *list = NULL, *iter; - g_return_val_if_fail(ui != NULL, NULL); - - for (iter = pounces; iter; iter = iter->next) { - PurplePounce *pounce = iter->data; - if (purple_strequal(pounce->ui_type, ui)) - list = g_list_prepend(list, pounce); - } - list = g_list_reverse(list); - return list; -} - -static void -free_pounce_handler(gpointer user_data) -{ - PurplePounceHandler *handler = (PurplePounceHandler *)user_data; - - g_free(handler->ui); - g_free(handler); -} - -static void -buddy_state_cb(PurpleBuddy *buddy, PurplePounceEvent event) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - const gchar *name = purple_buddy_get_name(buddy); - - purple_pounce_execute(account, name, event); -} - -static void -buddy_status_changed_cb(PurpleBuddy *buddy, PurpleStatus *old_status, - PurpleStatus *status) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - const gchar *name = purple_buddy_get_name(buddy); - gboolean old_available, available; - - available = purple_status_is_available(status); - old_available = purple_status_is_available(old_status); - - if (available && !old_available) - purple_pounce_execute(account, name, PURPLE_POUNCE_AWAY_RETURN); - else if (!available && old_available) - purple_pounce_execute(account, name, PURPLE_POUNCE_AWAY); -} - -static void -buddy_idle_changed_cb(PurpleBuddy *buddy, gboolean old_idle, gboolean idle) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - const gchar *name = purple_buddy_get_name(buddy); - - if (idle && !old_idle) - purple_pounce_execute(account, name, PURPLE_POUNCE_IDLE); - else if (!idle && old_idle) - purple_pounce_execute(account, name, PURPLE_POUNCE_IDLE_RETURN); -} - -static void -buddy_typing_cb(PurpleAccount *account, const char *name, void *data) -{ - PurpleConversation *conv; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); - if (conv != NULL) - { - PurpleTypingState state; - PurplePounceEvent event; - - state = purple_conv_im_get_typing_state(PURPLE_CONV_IM(conv)); - if (state == PURPLE_TYPED) - event = PURPLE_POUNCE_TYPED; - else if (state == PURPLE_NOT_TYPING) - event = PURPLE_POUNCE_TYPING_STOPPED; - else - event = PURPLE_POUNCE_TYPING; - - purple_pounce_execute(account, name, event); - } -} - -static void -received_message_cb(PurpleAccount *account, const char *name, void *data) -{ - purple_pounce_execute(account, name, PURPLE_POUNCE_MESSAGE_RECEIVED); -} - -void * -purple_pounces_get_handle(void) -{ - static int pounce_handle; - - return &pounce_handle; -} - -void -purple_pounces_init(void) -{ - void *handle = purple_pounces_get_handle(); - void *blist_handle = purple_blist_get_handle(); - void *conv_handle = purple_conversations_get_handle(); - - pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, free_pounce_handler); - - purple_signal_connect(blist_handle, "buddy-idle-changed", - handle, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-status-changed", - handle, PURPLE_CALLBACK(buddy_status_changed_cb), NULL); - purple_signal_connect(blist_handle, "buddy-signed-on", - handle, PURPLE_CALLBACK(buddy_state_cb), - GINT_TO_POINTER(PURPLE_POUNCE_SIGNON)); - purple_signal_connect(blist_handle, "buddy-signed-off", - handle, PURPLE_CALLBACK(buddy_state_cb), - GINT_TO_POINTER(PURPLE_POUNCE_SIGNOFF)); - - purple_signal_connect(conv_handle, "buddy-typing", - handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typed", - handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); - purple_signal_connect(conv_handle, "buddy-typing-stopped", - handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); - - purple_signal_connect(conv_handle, "received-im-msg", - handle, PURPLE_CALLBACK(received_message_cb), NULL); -} - -void -purple_pounces_uninit() -{ - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_pounces(); - } - - purple_signals_disconnect_by_handle(purple_pounces_get_handle()); - - g_hash_table_destroy(pounce_handlers); - pounce_handlers = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/pounce.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,380 +0,0 @@ -/** - * @file pounce.h Buddy Pounce API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_POUNCE_H_ -#define _PURPLE_POUNCE_H_ - -typedef struct _PurplePounce PurplePounce; - -#include -#include "account.h" - -/** - * Events that trigger buddy pounces. - */ -typedef enum -{ - PURPLE_POUNCE_NONE = 0x000, /**< No events. */ - PURPLE_POUNCE_SIGNON = 0x001, /**< The buddy signed on. */ - PURPLE_POUNCE_SIGNOFF = 0x002, /**< The buddy signed off. */ - PURPLE_POUNCE_AWAY = 0x004, /**< The buddy went away. */ - PURPLE_POUNCE_AWAY_RETURN = 0x008, /**< The buddy returned from away. */ - PURPLE_POUNCE_IDLE = 0x010, /**< The buddy became idle. */ - PURPLE_POUNCE_IDLE_RETURN = 0x020, /**< The buddy is no longer idle. */ - PURPLE_POUNCE_TYPING = 0x040, /**< The buddy started typing. */ - PURPLE_POUNCE_TYPED = 0x080, /**< The buddy has entered text. */ - PURPLE_POUNCE_TYPING_STOPPED = 0x100, /**< The buddy stopped typing. */ - PURPLE_POUNCE_MESSAGE_RECEIVED = 0x200 /**< The buddy sent a message */ - -} PurplePounceEvent; - -typedef enum -{ - PURPLE_POUNCE_OPTION_NONE = 0x00, /**< No Option */ - PURPLE_POUNCE_OPTION_AWAY = 0x01 /**< Pounce only when away */ -} PurplePounceOption; - -/** A pounce callback. */ -typedef void (*PurplePounceCb)(PurplePounce *, PurplePounceEvent, void *); - -/** - * A buddy pounce structure. - * - * Buddy pounces are actions triggered by a buddy-related event. For - * example, a sound can be played or an IM window opened when a buddy - * signs on or returns from away. Such responses are handled in the - * UI. The events themselves are done in the core. - */ -struct _PurplePounce -{ - char *ui_type; /**< The type of UI. */ - - PurplePounceEvent events; /**< The event(s) to pounce on. */ - PurplePounceOption options; /**< The pounce options */ - PurpleAccount *pouncer; /**< The user who is pouncing. */ - - char *pouncee; /**< The buddy to pounce on. */ - - GHashTable *actions; /**< The registered actions. */ - - gboolean save; /**< Whether or not the pounce should - be saved after activation. */ - void *data; /**< Pounce-specific data. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Buddy Pounce API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new buddy pounce. - * - * @param ui_type The type of UI the pounce is for. - * @param pouncer The account that will pounce. - * @param pouncee The buddy to pounce on. - * @param event The event(s) to pounce on. - * @param option Pounce options. - * - * @return The new buddy pounce structure. - */ -PurplePounce *purple_pounce_new(const char *ui_type, PurpleAccount *pouncer, - const char *pouncee, PurplePounceEvent event, - PurplePounceOption option); - -/** - * Destroys a buddy pounce. - * - * @param pounce The buddy pounce. - */ -void purple_pounce_destroy(PurplePounce *pounce); - -/** - * Destroys all buddy pounces for the account - * - * @param account The account to remove all pounces from. - */ -void purple_pounce_destroy_all_by_account(PurpleAccount *account); - -/** - * Sets the events a pounce should watch for. - * - * @param pounce The buddy pounce. - * @param events The events to watch for. - */ -void purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events); - -/** - * Sets the options for a pounce. - * - * @param pounce The buddy pounce. - * @param options The options for the pounce. - */ -void purple_pounce_set_options(PurplePounce *pounce, PurplePounceOption options); - -/** - * Sets the account that will do the pouncing. - * - * @param pounce The buddy pounce. - * @param pouncer The account that will pounce. - */ -void purple_pounce_set_pouncer(PurplePounce *pounce, PurpleAccount *pouncer); - -/** - * Sets the buddy a pounce should pounce on. - * - * @param pounce The buddy pounce. - * @param pouncee The buddy to pounce on. - */ -void purple_pounce_set_pouncee(PurplePounce *pounce, const char *pouncee); - -/** - * Sets whether or not the pounce should be saved after execution. - * - * @param pounce The buddy pounce. - * @param save @c TRUE if the pounce should be saved, or @c FALSE otherwise. - */ -void purple_pounce_set_save(PurplePounce *pounce, gboolean save); - -/** - * Registers an action type for the pounce. - * - * @param pounce The buddy pounce. - * @param name The action name. - */ -void purple_pounce_action_register(PurplePounce *pounce, const char *name); - -/** - * Enables or disables an action for a pounce. - * - * @param pounce The buddy pounce. - * @param action The name of the action. - * @param enabled The enabled state. - */ -void purple_pounce_action_set_enabled(PurplePounce *pounce, const char *action, - gboolean enabled); - -/** - * Sets a value for an attribute in an action. - * - * If @a value is @c NULL, the value will be unset. - * - * @param pounce The buddy pounce. - * @param action The action name. - * @param attr The attribute name. - * @param value The value. - */ -void purple_pounce_action_set_attribute(PurplePounce *pounce, const char *action, - const char *attr, const char *value); - -/** - * Sets the pounce-specific data. - * - * @param pounce The buddy pounce. - * @param data Data specific to the pounce. - */ -void purple_pounce_set_data(PurplePounce *pounce, void *data); - -/** - * Returns the events a pounce should watch for. - * - * @param pounce The buddy pounce. - * - * @return The events the pounce is watching for. - */ -PurplePounceEvent purple_pounce_get_events(const PurplePounce *pounce); - -/** - * Returns the options for a pounce. - * - * @param pounce The buddy pounce. - * - * @return The options for the pounce. - */ -PurplePounceOption purple_pounce_get_options(const PurplePounce *pounce); - -/** - * Returns the account that will do the pouncing. - * - * @param pounce The buddy pounce. - * - * @return The account that will pounce. - */ -PurpleAccount *purple_pounce_get_pouncer(const PurplePounce *pounce); - -/** - * Returns the buddy a pounce should pounce on. - * - * @param pounce The buddy pounce. - * - * @return The buddy to pounce on. - */ -const char *purple_pounce_get_pouncee(const PurplePounce *pounce); - -/** - * Returns whether or not the pounce should save after execution. - * - * @param pounce The buddy pounce. - * - * @return @c TRUE if the pounce should be saved after execution, or - * @c FALSE otherwise. - */ -gboolean purple_pounce_get_save(const PurplePounce *pounce); - -/** - * Returns whether or not an action is enabled. - * - * @param pounce The buddy pounce. - * @param action The action name. - * - * @return @c TRUE if the action is enabled, or @c FALSE otherwise. - */ -gboolean purple_pounce_action_is_enabled(const PurplePounce *pounce, - const char *action); - -/** - * Returns the value for an attribute in an action. - * - * @param pounce The buddy pounce. - * @param action The action name. - * @param attr The attribute name. - * - * @return The attribute value, if it exists, or @c NULL. - */ -const char *purple_pounce_action_get_attribute(const PurplePounce *pounce, - const char *action, - const char *attr); - -/** - * Returns the pounce-specific data. - * - * @param pounce The buddy pounce. - * - * @return The data specific to a buddy pounce. - */ -void *purple_pounce_get_data(const PurplePounce *pounce); - -/** - * Executes a pounce with the specified pouncer, pouncee, and event type. - * - * @param pouncer The account that will do the pouncing. - * @param pouncee The buddy that is being pounced. - * @param events The events that triggered the pounce. - */ -void purple_pounce_execute(const PurpleAccount *pouncer, const char *pouncee, - PurplePounceEvent events); - -/*@}*/ - -/**************************************************************************/ -/** @name Buddy Pounce Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Finds a pounce with the specified event(s) and buddy. - * - * @param pouncer The account to match against. - * @param pouncee The buddy to match against. - * @param events The event(s) to match against. - * - * @return The pounce if found, or @c NULL otherwise. - */ -PurplePounce *purple_find_pounce(const PurpleAccount *pouncer, - const char *pouncee, PurplePounceEvent events); - - -/** - * Loads the pounces. - * - * @return @c TRUE if the pounces could be loaded. - */ -gboolean purple_pounces_load(void); - -/** - * Registers a pounce handler for a UI. - * - * @param ui The UI name. - * @param cb The callback function. - * @param new_pounce The function called when a pounce is created. - * @param free_pounce The function called when a pounce is freed. - */ -void purple_pounces_register_handler(const char *ui, PurplePounceCb cb, - void (*new_pounce)(PurplePounce *pounce), - void (*free_pounce)(PurplePounce *pounce)); - -/** - * Unregisters a pounce handle for a UI. - * - * @param ui The UI name. - */ -void purple_pounces_unregister_handler(const char *ui); - -/** - * Returns a list of all registered buddy pounces. - * - * @constreturn The list of buddy pounces. - */ -GList *purple_pounces_get_all(void); - -/** - * Returns a list of registered buddy pounces for the ui-type. - * - * @param ui The ID of the UI using the core. - * - * @return The list of buddy pounces. The list should be freed by - * the caller when it's no longer used. - * @since 2.1.0 - */ -GList *purple_pounces_get_all_for_ui(const char *ui); - -/** - * Returns the buddy pounce subsystem handle. - * - * @return The subsystem handle. - */ -void *purple_pounces_get_handle(void); - -/** - * Initializes the pounces subsystem. - */ -void purple_pounces_init(void); - -/** - * Uninitializes the pounces subsystem. - */ -void purple_pounces_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_POUNCE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1460 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include "internal.h" -#include "prefs.h" -#include "debug.h" -#include "util.h" - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -struct pref_cb { - PurplePrefCallback func; - gpointer data; - guint id; - void *handle; -}; - -/* TODO: This should use PurpleValues? */ -struct purple_pref { - PurplePrefType type; - char *name; - union { - gpointer generic; - gboolean boolean; - int integer; - char *string; - GList *stringlist; - } value; - GSList *callbacks; - struct purple_pref *parent; - struct purple_pref *sibling; - struct purple_pref *first_child; -}; - - -static struct purple_pref prefs = { - PURPLE_PREF_NONE, - NULL, - { NULL }, - NULL, - NULL, - NULL, - NULL -}; - -static GHashTable *prefs_hash = NULL; -static guint save_timer = 0; -static gboolean prefs_loaded = FALSE; - - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static struct -purple_pref *find_pref(const char *name) -{ - g_return_val_if_fail(name != NULL && name[0] == '/', NULL); - - if (name[1] == '\0') - return &prefs; - else - { - /* When we're initializing, the debug system is - * initialized before the prefs system, but debug - * calls will end up calling prefs functions, so we - * need to deal cleanly here. */ - if (prefs_hash) - return g_hash_table_lookup(prefs_hash, name); - else - return NULL; - } -} - - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -/* - * This function recursively creates the xmlnode tree from the prefs - * tree structure. Yay recursion! - */ -static void -pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref) -{ - xmlnode *node, *childnode; - struct purple_pref *child; - char buf[21]; - GList *cur; - - /* Create a new node */ - node = xmlnode_new_child(parent, "pref"); - xmlnode_set_attrib(node, "name", pref->name); - - /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */ - if (pref->type == PURPLE_PREF_INT) { - xmlnode_set_attrib(node, "type", "int"); - g_snprintf(buf, sizeof(buf), "%d", pref->value.integer); - xmlnode_set_attrib(node, "value", buf); - } - else if (pref->type == PURPLE_PREF_STRING) { - xmlnode_set_attrib(node, "type", "string"); - xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : ""); - } - else if (pref->type == PURPLE_PREF_STRING_LIST) { - xmlnode_set_attrib(node, "type", "stringlist"); - for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) - { - childnode = xmlnode_new_child(node, "item"); - xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : ""); - } - } - else if (pref->type == PURPLE_PREF_PATH) { - char *encoded = g_filename_to_utf8(pref->value.string ? pref->value.string : "", -1, NULL, NULL, NULL); - xmlnode_set_attrib(node, "type", "path"); - xmlnode_set_attrib(node, "value", encoded); - g_free(encoded); - } - else if (pref->type == PURPLE_PREF_PATH_LIST) { - xmlnode_set_attrib(node, "type", "pathlist"); - for (cur = pref->value.stringlist; cur != NULL; cur = cur->next) - { - char *encoded = g_filename_to_utf8(cur->data ? cur->data : "", -1, NULL, NULL, NULL); - childnode = xmlnode_new_child(node, "item"); - xmlnode_set_attrib(childnode, "value", encoded); - g_free(encoded); - } - } - else if (pref->type == PURPLE_PREF_BOOLEAN) { - xmlnode_set_attrib(node, "type", "bool"); - g_snprintf(buf, sizeof(buf), "%d", pref->value.boolean); - xmlnode_set_attrib(node, "value", buf); - } - - /* All My Children */ - for (child = pref->first_child; child != NULL; child = child->sibling) - pref_to_xmlnode(node, child); -} - -static xmlnode * -prefs_to_xmlnode(void) -{ - xmlnode *node; - struct purple_pref *pref, *child; - - pref = &prefs; - - /* Create the root preference node */ - node = xmlnode_new("pref"); - xmlnode_set_attrib(node, "version", "1"); - xmlnode_set_attrib(node, "name", "/"); - - /* All My Children */ - for (child = pref->first_child; child != NULL; child = child->sibling) - pref_to_xmlnode(node, child); - - return node; -} - -static void -sync_prefs(void) -{ - xmlnode *node; - char *data; - - if (!prefs_loaded) - { - /* - * TODO: Call schedule_prefs_save()? Ideally we wouldn't need to. - * (prefs.xml should be loaded when purple_prefs_init is called) - */ - purple_debug_error("prefs", "Attempted to save prefs before " - "they were read!\n"); - return; - } - - node = prefs_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("prefs.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_prefs(); - save_timer = 0; - return FALSE; -} - -static void -schedule_prefs_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static GList *prefs_stack = NULL; - -static void -prefs_start_element_handler (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) -{ - PurplePrefType pref_type = PURPLE_PREF_NONE; - int i; - const char *pref_name = NULL, *pref_value = NULL; - GString *pref_name_full; - GList *tmp; - - if(!purple_strequal(element_name, "pref") && - !purple_strequal(element_name, "item")) - return; - - for(i = 0; attribute_names[i]; i++) { - if(purple_strequal(attribute_names[i], "name")) { - pref_name = attribute_values[i]; - } else if(purple_strequal(attribute_names[i], "type")) { - if(purple_strequal(attribute_values[i], "bool")) - pref_type = PURPLE_PREF_BOOLEAN; - else if(purple_strequal(attribute_values[i], "int")) - pref_type = PURPLE_PREF_INT; - else if(purple_strequal(attribute_values[i], "string")) - pref_type = PURPLE_PREF_STRING; - else if(purple_strequal(attribute_values[i], "stringlist")) - pref_type = PURPLE_PREF_STRING_LIST; - else if(purple_strequal(attribute_values[i], "path")) - pref_type = PURPLE_PREF_PATH; - else if(purple_strequal(attribute_values[i], "pathlist")) - pref_type = PURPLE_PREF_PATH_LIST; - else - return; - } else if(purple_strequal(attribute_names[i], "value")) { - pref_value = attribute_values[i]; - } - } - - if(purple_strequal(element_name, "item")) { - struct purple_pref *pref; - - pref_name_full = g_string_new(""); - - for(tmp = prefs_stack; tmp; tmp = tmp->next) { - pref_name_full = g_string_prepend(pref_name_full, tmp->data); - pref_name_full = g_string_prepend_c(pref_name_full, '/'); - } - - pref = find_pref(pref_name_full->str); - - if(pref) { - if(pref->type == PURPLE_PREF_STRING_LIST) { - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_strdup(pref_value)); - } else if(pref->type == PURPLE_PREF_PATH_LIST) { - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_filename_from_utf8(pref_value, -1, NULL, NULL, NULL)); - } - } - g_string_free(pref_name_full, TRUE); - } else { - char *decoded; - - if(!pref_name || purple_strequal(pref_name, "/")) - return; - - pref_name_full = g_string_new(pref_name); - - for(tmp = prefs_stack; tmp; tmp = tmp->next) { - pref_name_full = g_string_prepend_c(pref_name_full, '/'); - pref_name_full = g_string_prepend(pref_name_full, tmp->data); - } - - pref_name_full = g_string_prepend_c(pref_name_full, '/'); - - switch(pref_type) { - case PURPLE_PREF_NONE: - purple_prefs_add_none(pref_name_full->str); - break; - case PURPLE_PREF_BOOLEAN: - purple_prefs_set_bool(pref_name_full->str, atoi(pref_value)); - break; - case PURPLE_PREF_INT: - purple_prefs_set_int(pref_name_full->str, atoi(pref_value)); - break; - case PURPLE_PREF_STRING: - purple_prefs_set_string(pref_name_full->str, pref_value); - break; - case PURPLE_PREF_STRING_LIST: - purple_prefs_set_string_list(pref_name_full->str, NULL); - break; - case PURPLE_PREF_PATH: - if (pref_value) { - decoded = g_filename_from_utf8(pref_value, -1, NULL, NULL, NULL); - purple_prefs_set_path(pref_name_full->str, decoded); - g_free(decoded); - } else { - purple_prefs_set_path(pref_name_full->str, NULL); - } - break; - case PURPLE_PREF_PATH_LIST: - purple_prefs_set_path_list(pref_name_full->str, NULL); - break; - } - prefs_stack = g_list_prepend(prefs_stack, g_strdup(pref_name)); - g_string_free(pref_name_full, TRUE); - } -} - -static void -prefs_end_element_handler(GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, GError **error) -{ - if(prefs_stack && purple_strequal(element_name, "pref")) { - g_free(prefs_stack->data); - prefs_stack = g_list_delete_link(prefs_stack, prefs_stack); - } -} - -static GMarkupParser prefs_parser = { - prefs_start_element_handler, - prefs_end_element_handler, - NULL, - NULL, - NULL -}; - -gboolean -purple_prefs_load() -{ - gchar *filename = g_build_filename(purple_user_dir(), "prefs.xml", NULL); - gchar *contents = NULL; - gsize length; - GMarkupParseContext *context; - GError *error = NULL; - - if (!filename) { - prefs_loaded = TRUE; - return FALSE; - } - - purple_debug_info("prefs", "Reading %s\n", filename); - - if(!g_file_get_contents(filename, &contents, &length, &error)) { -#ifdef _WIN32 - gchar *common_appdata = wpurple_get_special_folder(CSIDL_COMMON_APPDATA); -#endif - g_free(filename); - g_error_free(error); - - error = NULL; - -#ifdef _WIN32 - filename = g_build_filename(common_appdata ? common_appdata : "", "purple", "prefs.xml", NULL); - g_free(common_appdata); -#else - filename = g_build_filename(SYSCONFDIR, "purple", "prefs.xml", NULL); -#endif - - purple_debug_info("prefs", "Reading %s\n", filename); - - if (!g_file_get_contents(filename, &contents, &length, &error)) { - purple_debug_error("prefs", "Error reading prefs: %s\n", - error->message); - g_error_free(error); - g_free(filename); - prefs_loaded = TRUE; - - return FALSE; - } - } - - context = g_markup_parse_context_new(&prefs_parser, 0, NULL, NULL); - - if(!g_markup_parse_context_parse(context, contents, length, NULL)) { - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - prefs_loaded = TRUE; - - return FALSE; - } - - if(!g_markup_parse_context_end_parse(context, NULL)) { - purple_debug_error("prefs", "Error parsing %s\n", filename); - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - prefs_loaded = TRUE; - - return FALSE; - } - - purple_debug_info("prefs", "Finished reading %s\n", filename); - g_markup_parse_context_free(context); - g_free(contents); - g_free(filename); - prefs_loaded = TRUE; - - return TRUE; -} - - - -static void -prefs_save_cb(const char *name, PurplePrefType type, gconstpointer val, - gpointer user_data) -{ - - if(!prefs_loaded) - return; - - purple_debug_misc("prefs", "%s changed, scheduling save.\n", name); - - schedule_prefs_save(); -} - -static char * -get_path_dirname(const char *name) -{ - char *c, *str; - - str = g_strdup(name); - - if ((c = strrchr(str, '/')) != NULL) { - *c = '\0'; - - if (*str == '\0') { - g_free(str); - - str = g_strdup("/"); - } - } - else { - g_free(str); - - str = g_strdup("."); - } - - return str; -} - -static char * -get_path_basename(const char *name) -{ - const char *c; - - if ((c = strrchr(name, '/')) != NULL) - return g_strdup(c + 1); - - return g_strdup(name); -} - -static char * -pref_full_name(struct purple_pref *pref) -{ - GString *name; - struct purple_pref *parent; - - if(!pref) - return NULL; - - if(pref == &prefs) - return g_strdup("/"); - - name = g_string_new(pref->name); - parent = pref->parent; - - for(parent = pref->parent; parent && parent->name; parent = parent->parent) { - name = g_string_prepend_c(name, '/'); - name = g_string_prepend(name, parent->name); - } - name = g_string_prepend_c(name, '/'); - return g_string_free(name, FALSE); -} - -static struct purple_pref * -find_pref_parent(const char *name) -{ - char *parent_name = get_path_dirname(name); - struct purple_pref *ret = &prefs; - - if(!purple_strequal(parent_name, "/")) { - ret = find_pref(parent_name); - } - - g_free(parent_name); - return ret; -} - -static void -free_pref_value(struct purple_pref *pref) -{ - switch(pref->type) { - case PURPLE_PREF_BOOLEAN: - pref->value.boolean = FALSE; - break; - case PURPLE_PREF_INT: - pref->value.integer = 0; - break; - case PURPLE_PREF_STRING: - case PURPLE_PREF_PATH: - g_free(pref->value.string); - pref->value.string = NULL; - break; - case PURPLE_PREF_STRING_LIST: - case PURPLE_PREF_PATH_LIST: - { - g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); - g_list_free(pref->value.stringlist); - } break; - case PURPLE_PREF_NONE: - break; - } -} - -static struct purple_pref * -add_pref(PurplePrefType type, const char *name) -{ - struct purple_pref *parent; - struct purple_pref *me; - struct purple_pref *sibling; - char *my_name; - - parent = find_pref_parent(name); - - if(!parent) - return NULL; - - my_name = get_path_basename(name); - - for(sibling = parent->first_child; sibling; sibling = sibling->sibling) { - if(purple_strequal(sibling->name, my_name)) { - g_free(my_name); - return NULL; - } - } - - me = g_new0(struct purple_pref, 1); - me->type = type; - me->name = my_name; - - me->parent = parent; - if(parent->first_child) { - /* blatant abuse of a for loop */ - for(sibling = parent->first_child; sibling->sibling; - sibling = sibling->sibling); - sibling->sibling = me; - } else { - parent->first_child = me; - } - - g_hash_table_insert(prefs_hash, g_strdup(name), (gpointer)me); - - return me; -} - -void -purple_prefs_add_none(const char *name) -{ - add_pref(PURPLE_PREF_NONE, name); -} - -void -purple_prefs_add_bool(const char *name, gboolean value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_BOOLEAN, name); - - if(!pref) - return; - - pref->value.boolean = value; -} - -void -purple_prefs_add_int(const char *name, int value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_INT, name); - - if(!pref) - return; - - pref->value.integer = value; -} - -void -purple_prefs_add_string(const char *name, const char *value) -{ - struct purple_pref *pref; - - if(value != NULL && !g_utf8_validate(value, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_add_string: Cannot store invalid UTF8 for string pref %s\n", name); - return; - } - - pref = add_pref(PURPLE_PREF_STRING, name); - - if(!pref) - return; - - pref->value.string = g_strdup(value); -} - -void -purple_prefs_add_string_list(const char *name, GList *value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_STRING_LIST, name); - GList *tmp; - - if(!pref) - return; - - for(tmp = value; tmp; tmp = tmp->next) { - if(tmp->data != NULL && !g_utf8_validate(tmp->data, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_add_string_list: Skipping invalid UTF8 for string list pref %s\n", name); - continue; - } - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_strdup(tmp->data)); - } -} - -void -purple_prefs_add_path(const char *name, const char *value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_PATH, name); - - if(!pref) - return; - - pref->value.string = g_strdup(value); -} - -void -purple_prefs_add_path_list(const char *name, GList *value) -{ - struct purple_pref *pref = add_pref(PURPLE_PREF_PATH_LIST, name); - GList *tmp; - - if(!pref) - return; - - for(tmp = value; tmp; tmp = tmp->next) - pref->value.stringlist = g_list_append(pref->value.stringlist, - g_strdup(tmp->data)); -} - - -static void -remove_pref(struct purple_pref *pref) -{ - char *name; - GSList *l; - - if(!pref) - return; - - while(pref->first_child) - remove_pref(pref->first_child); - - if(pref == &prefs) - return; - - if(pref->parent->first_child == pref) { - pref->parent->first_child = pref->sibling; - } else { - struct purple_pref *sib = pref->parent->first_child; - while(sib && sib->sibling != pref) - sib = sib->sibling; - if(sib) - sib->sibling = pref->sibling; - } - - name = pref_full_name(pref); - - if (prefs_loaded) - purple_debug_info("prefs", "removing pref %s\n", name); - - g_hash_table_remove(prefs_hash, name); - g_free(name); - - free_pref_value(pref); - - while((l = pref->callbacks) != NULL) { - pref->callbacks = pref->callbacks->next; - g_free(l->data); - g_slist_free_1(l); - } - g_free(pref->name); - g_free(pref); -} - -void -purple_prefs_remove(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) - return; - - remove_pref(pref); -} - -void -purple_prefs_destroy() -{ - purple_prefs_remove("/"); -} - -static void -do_callbacks(const char* name, struct purple_pref *pref) -{ - GSList *cbs; - struct purple_pref *cb_pref; - for(cb_pref = pref; cb_pref; cb_pref = cb_pref->parent) { - for(cbs = cb_pref->callbacks; cbs; cbs = cbs->next) { - struct pref_cb *cb = cbs->data; - cb->func(name, pref->type, pref->value.generic, cb->data); - } - } -} - -void -purple_prefs_trigger_callback(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_trigger_callback: Unknown pref %s\n", name); - return; - } - - do_callbacks(name, pref); -} - -void -purple_prefs_set_generic(const char *name, gpointer value) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_set_generic: Unknown pref %s\n", name); - return; - } - - pref->value.generic = value; - do_callbacks(name, pref); -} - -void -purple_prefs_set_bool(const char *name, gboolean value) -{ - struct purple_pref *pref = find_pref(name); - - if(pref) { - if(pref->type != PURPLE_PREF_BOOLEAN) { - purple_debug_error("prefs", - "purple_prefs_set_bool: %s not a boolean pref\n", name); - return; - } - - if(pref->value.boolean != value) { - pref->value.boolean = value; - do_callbacks(name, pref); - } - } else { - purple_prefs_add_bool(name, value); - } -} - -void -purple_prefs_set_int(const char *name, int value) -{ - struct purple_pref *pref = find_pref(name); - - if(pref) { - if(pref->type != PURPLE_PREF_INT) { - purple_debug_error("prefs", - "purple_prefs_set_int: %s not an integer pref\n", name); - return; - } - - if(pref->value.integer != value) { - pref->value.integer = value; - do_callbacks(name, pref); - } - } else { - purple_prefs_add_int(name, value); - } -} - -void -purple_prefs_set_string(const char *name, const char *value) -{ - struct purple_pref *pref = find_pref(name); - - if(value != NULL && !g_utf8_validate(value, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_set_string: Cannot store invalid UTF8 for string pref %s\n", name); - return; - } - - if(pref) { - if(pref->type != PURPLE_PREF_STRING && pref->type != PURPLE_PREF_PATH) { - purple_debug_error("prefs", - "purple_prefs_set_string: %s not a string pref\n", name); - return; - } - - if (!purple_strequal(pref->value.string, value)) { - g_free(pref->value.string); - pref->value.string = g_strdup(value); - do_callbacks(name, pref); - } - } else { - purple_prefs_add_string(name, value); - } -} - -void -purple_prefs_set_string_list(const char *name, GList *value) -{ - struct purple_pref *pref = find_pref(name); - if(pref) { - GList *tmp; - - if(pref->type != PURPLE_PREF_STRING_LIST) { - purple_debug_error("prefs", - "purple_prefs_set_string_list: %s not a string list pref\n", - name); - return; - } - - g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); - g_list_free(pref->value.stringlist); - pref->value.stringlist = NULL; - - for(tmp = value; tmp; tmp = tmp->next) { - if(tmp->data != NULL && !g_utf8_validate(tmp->data, -1, NULL)) { - purple_debug_error("prefs", "purple_prefs_set_string_list: Skipping invalid UTF8 for string list pref %s\n", name); - continue; - } - pref->value.stringlist = g_list_prepend(pref->value.stringlist, - g_strdup(tmp->data)); - } - pref->value.stringlist = g_list_reverse(pref->value.stringlist); - - do_callbacks(name, pref); - - } else { - purple_prefs_add_string_list(name, value); - } -} - -void -purple_prefs_set_path(const char *name, const char *value) -{ - struct purple_pref *pref = find_pref(name); - - if(pref) { - if(pref->type != PURPLE_PREF_PATH) { - purple_debug_error("prefs", - "purple_prefs_set_path: %s not a path pref\n", name); - return; - } - - if (!purple_strequal(pref->value.string, value)) { - g_free(pref->value.string); - pref->value.string = g_strdup(value); - do_callbacks(name, pref); - } - } else { - purple_prefs_add_path(name, value); - } -} - -void -purple_prefs_set_path_list(const char *name, GList *value) -{ - struct purple_pref *pref = find_pref(name); - if(pref) { - GList *tmp; - - if(pref->type != PURPLE_PREF_PATH_LIST) { - purple_debug_error("prefs", - "purple_prefs_set_path_list: %s not a path list pref\n", - name); - return; - } - - g_list_foreach(pref->value.stringlist, (GFunc)g_free, NULL); - g_list_free(pref->value.stringlist); - pref->value.stringlist = NULL; - - for(tmp = value; tmp; tmp = tmp->next) - pref->value.stringlist = g_list_prepend(pref->value.stringlist, - g_strdup(tmp->data)); - pref->value.stringlist = g_list_reverse(pref->value.stringlist); - - do_callbacks(name, pref); - - } else { - purple_prefs_add_path_list(name, value); - } -} - - -gboolean -purple_prefs_exists(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if (pref != NULL) - return TRUE; - - return FALSE; -} - -PurplePrefType -purple_prefs_get_type(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if (pref == NULL) - return PURPLE_PREF_NONE; - - return (pref->type); -} - -gboolean -purple_prefs_get_bool(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_bool: Unknown pref %s\n", name); - return FALSE; - } else if(pref->type != PURPLE_PREF_BOOLEAN) { - purple_debug_error("prefs", - "purple_prefs_get_bool: %s not a boolean pref\n", name); - return FALSE; - } - - return pref->value.boolean; -} - -int -purple_prefs_get_int(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_int: Unknown pref %s\n", name); - return 0; - } else if(pref->type != PURPLE_PREF_INT) { - purple_debug_error("prefs", - "purple_prefs_get_int: %s not an integer pref\n", name); - return 0; - } - - return pref->value.integer; -} - -const char * -purple_prefs_get_string(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_string: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_STRING) { - purple_debug_error("prefs", - "purple_prefs_get_string: %s not a string pref\n", name); - return NULL; - } - - return pref->value.string; -} - -GList * -purple_prefs_get_string_list(const char *name) -{ - struct purple_pref *pref = find_pref(name); - GList *ret = NULL, *tmp; - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_string_list: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_STRING_LIST) { - purple_debug_error("prefs", - "purple_prefs_get_string_list: %s not a string list pref\n", name); - return NULL; - } - - for(tmp = pref->value.stringlist; tmp; tmp = tmp->next) - ret = g_list_prepend(ret, g_strdup(tmp->data)); - ret = g_list_reverse(ret); - - return ret; -} - -const char * -purple_prefs_get_path(const char *name) -{ - struct purple_pref *pref = find_pref(name); - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_path: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_PATH) { - purple_debug_error("prefs", - "purple_prefs_get_path: %s not a path pref\n", name); - return NULL; - } - - return pref->value.string; -} - -GList * -purple_prefs_get_path_list(const char *name) -{ - struct purple_pref *pref = find_pref(name); - GList *ret = NULL, *tmp; - - if(!pref) { - purple_debug_error("prefs", - "purple_prefs_get_path_list: Unknown pref %s\n", name); - return NULL; - } else if(pref->type != PURPLE_PREF_PATH_LIST) { - purple_debug_error("prefs", - "purple_prefs_get_path_list: %s not a path list pref\n", name); - return NULL; - } - - for(tmp = pref->value.stringlist; tmp; tmp = tmp->next) - ret = g_list_prepend(ret, g_strdup(tmp->data)); - ret = g_list_reverse(ret); - - return ret; -} - -static void -purple_prefs_rename_node(struct purple_pref *oldpref, struct purple_pref *newpref) -{ - struct purple_pref *child, *next; - char *oldname, *newname; - - /* if we're a parent, rename the kids first */ - for(child = oldpref->first_child; child != NULL; child = next) - { - struct purple_pref *newchild; - next = child->sibling; - for(newchild = newpref->first_child; newchild != NULL; newchild = newchild->sibling) - { - if(purple_strequal(child->name, newchild->name)) - { - purple_prefs_rename_node(child, newchild); - break; - } - } - if(newchild == NULL) { - /* no rename happened, we weren't able to find the new pref */ - char *tmpname = pref_full_name(child); - purple_debug_error("prefs", "Unable to find rename pref for %s\n", tmpname); - g_free(tmpname); - } - } - - oldname = pref_full_name(oldpref); - newname = pref_full_name(newpref); - - if (oldpref->type != newpref->type) - { - purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); - g_free(oldname); - g_free(newname); - return; - } - - purple_debug_info("prefs", "Renaming %s to %s\n", oldname, newname); - g_free(oldname); - - switch(oldpref->type) { - case PURPLE_PREF_NONE: - break; - case PURPLE_PREF_BOOLEAN: - purple_prefs_set_bool(newname, oldpref->value.boolean); - break; - case PURPLE_PREF_INT: - purple_prefs_set_int(newname, oldpref->value.integer); - break; - case PURPLE_PREF_STRING: - purple_prefs_set_string(newname, oldpref->value.string); - break; - case PURPLE_PREF_STRING_LIST: - purple_prefs_set_string_list(newname, oldpref->value.stringlist); - break; - case PURPLE_PREF_PATH: - purple_prefs_set_path(newname, oldpref->value.string); - break; - case PURPLE_PREF_PATH_LIST: - purple_prefs_set_path_list(newname, oldpref->value.stringlist); - break; - } - g_free(newname); - - remove_pref(oldpref); -} - -void -purple_prefs_rename(const char *oldname, const char *newname) -{ - struct purple_pref *oldpref, *newpref; - - oldpref = find_pref(oldname); - - /* it's already been renamed, call off the dogs */ - if(!oldpref) - return; - - newpref = find_pref(newname); - - if (newpref == NULL) - { - purple_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); - return; - } - - purple_prefs_rename_node(oldpref, newpref); -} - -void -purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname) -{ - struct purple_pref *oldpref, *newpref; - - oldpref = find_pref(oldname); - - /* it's already been renamed, call off the cats */ - if(!oldpref) - return; - - if (oldpref->type != PURPLE_PREF_BOOLEAN) - { - purple_debug_error("prefs", "Unable to rename %s to %s: old pref not a boolean\n", oldname, newname); - return; - } - - if (oldpref->first_child != NULL) /* can't rename parents */ - { - purple_debug_error("prefs", "Unable to rename %s to %s: can't rename parents\n", oldname, newname); - return; - } - - - newpref = find_pref(newname); - - if (newpref == NULL) - { - purple_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); - return; - } - - if (oldpref->type != newpref->type) - { - purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); - return; - } - - purple_debug_info("prefs", "Renaming and toggling %s to %s\n", oldname, newname); - purple_prefs_set_bool(newname, !(oldpref->value.boolean)); - - remove_pref(oldpref); -} - -guint -purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback func, gpointer data) -{ - struct purple_pref *pref; - struct pref_cb *cb; - static guint cb_id = 0; - - g_return_val_if_fail(name != NULL, 0); - g_return_val_if_fail(func != NULL, 0); - - pref = find_pref(name); - if (pref == NULL) { - purple_debug_error("prefs", "purple_prefs_connect_callback: Unknown pref %s\n", name); - return 0; - } - - cb = g_new0(struct pref_cb, 1); - - cb->func = func; - cb->data = data; - cb->id = ++cb_id; - cb->handle = handle; - - pref->callbacks = g_slist_append(pref->callbacks, cb); - - return cb->id; -} - -static gboolean -disco_callback_helper(struct purple_pref *pref, guint callback_id) -{ - GSList *cbs; - struct purple_pref *child; - - if(!pref) - return FALSE; - - for(cbs = pref->callbacks; cbs; cbs = cbs->next) { - struct pref_cb *cb = cbs->data; - if(cb->id == callback_id) { - pref->callbacks = g_slist_delete_link(pref->callbacks, cbs); - g_free(cb); - return TRUE; - } - } - - for(child = pref->first_child; child; child = child->sibling) { - if(disco_callback_helper(child, callback_id)) - return TRUE; - } - - return FALSE; -} - -void -purple_prefs_disconnect_callback(guint callback_id) -{ - disco_callback_helper(&prefs, callback_id); -} - -static void -disco_callback_helper_handle(struct purple_pref *pref, void *handle) -{ - GSList *cbs; - struct purple_pref *child; - - if(!pref) - return; - - cbs = pref->callbacks; - while (cbs != NULL) { - struct pref_cb *cb = cbs->data; - if(cb->handle == handle) { - pref->callbacks = g_slist_delete_link(pref->callbacks, cbs); - g_free(cb); - cbs = pref->callbacks; - } else - cbs = cbs->next; - } - - for(child = pref->first_child; child; child = child->sibling) - disco_callback_helper_handle(child, handle); -} - -void -purple_prefs_disconnect_by_handle(void *handle) -{ - g_return_if_fail(handle != NULL); - - disco_callback_helper_handle(&prefs, handle); -} - -GList * -purple_prefs_get_children_names(const char *name) -{ - GList * list = NULL; - struct purple_pref *pref = find_pref(name), *child; - char sep[2] = "\0\0";; - - if (pref == NULL) - return NULL; - - if (name[strlen(name) - 1] != '/') - sep[0] = '/'; - for (child = pref->first_child; child; child = child->sibling) { - list = g_list_append(list, g_strdup_printf("%s%s%s", name, sep, child->name)); - } - return list; -} - -void -purple_prefs_update_old() -{ - purple_prefs_rename("/core", "/purple"); - - /* Remove some no-longer-used prefs */ - purple_prefs_remove("/purple/away/auto_response/enabled"); - purple_prefs_remove("/purple/away/auto_response/idle_only"); - purple_prefs_remove("/purple/away/auto_response/in_active_conv"); - purple_prefs_remove("/purple/away/auto_response/sec_before_resend"); - purple_prefs_remove("/purple/away/auto_response"); - purple_prefs_remove("/purple/away/default_message"); - purple_prefs_remove("/purple/buddies/use_server_alias"); - purple_prefs_remove("/purple/conversations/away_back_on_send"); - purple_prefs_remove("/purple/conversations/send_urls_as_links"); - purple_prefs_remove("/purple/conversations/im/show_login"); - purple_prefs_remove("/purple/conversations/chat/show_join"); - purple_prefs_remove("/purple/conversations/chat/show_leave"); - purple_prefs_remove("/purple/conversations/combine_chat_im"); - purple_prefs_remove("/purple/conversations/use_alias_for_title"); - purple_prefs_remove("/purple/logging/log_signon_signoff"); - purple_prefs_remove("/purple/logging/log_idle_state"); - purple_prefs_remove("/purple/logging/log_away_state"); - purple_prefs_remove("/purple/logging/log_own_states"); - purple_prefs_remove("/purple/status/scores/hidden"); - purple_prefs_remove("/plugins/core/autorecon/hide_connected_error"); - purple_prefs_remove("/plugins/core/autorecon/hide_connecting_error"); - purple_prefs_remove("/plugins/core/autorecon/hide_reconnecting_dialog"); - purple_prefs_remove("/plugins/core/autorecon/restore_state"); - purple_prefs_remove("/plugins/core/autorecon"); - - /* Convert old sounds while_away pref to new 3-way pref. */ - if (purple_prefs_exists("/purple/sound/while_away") && - purple_prefs_get_bool("/purple/sound/while_away")) - { - purple_prefs_set_int("/purple/sound/while_status", 3); - } - purple_prefs_remove("/purple/sound/while_away"); -} - -void * -purple_prefs_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_prefs_init(void) -{ - void *handle = purple_prefs_get_handle(); - - prefs_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - purple_prefs_connect_callback(handle, "/", prefs_save_cb, NULL); - - purple_prefs_add_none("/purple"); - purple_prefs_add_none("/plugins"); - purple_prefs_add_none("/plugins/core"); - purple_prefs_add_none("/plugins/lopl"); - purple_prefs_add_none("/plugins/prpl"); - - /* Away */ - purple_prefs_add_none("/purple/away"); - purple_prefs_add_string("/purple/away/idle_reporting", "system"); - purple_prefs_add_bool("/purple/away/away_when_idle", TRUE); - purple_prefs_add_int("/purple/away/mins_before_away", 5); - - /* Away -> Auto-Reply */ - if (!purple_prefs_exists("/purple/away/auto_response/enabled") || - !purple_prefs_exists("/purple/away/auto_response/idle_only")) - { - purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); - } - else - { - if (!purple_prefs_get_bool("/purple/away/auto_response/enabled")) - { - purple_prefs_add_string("/purple/away/auto_reply", "never"); - } - else - { - if (purple_prefs_get_bool("/purple/away/auto_response/idle_only")) - { - purple_prefs_add_string("/purple/away/auto_reply", "awayidle"); - } - else - { - purple_prefs_add_string("/purple/away/auto_reply", "away"); - } - } - } - - /* Buddies */ - purple_prefs_add_none("/purple/buddies"); - - /* Contact Priority Settings */ - purple_prefs_add_none("/purple/contact"); - purple_prefs_add_bool("/purple/contact/last_match", FALSE); - purple_prefs_remove("/purple/contact/offline_score"); - purple_prefs_remove("/purple/contact/away_score"); - purple_prefs_remove("/purple/contact/idle_score"); - - purple_prefs_load(); - purple_prefs_update_old(); -} - -void -purple_prefs_uninit() -{ - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_prefs(); - } - - purple_prefs_disconnect_by_handle(purple_prefs_get_handle()); - - prefs_loaded = FALSE; - purple_prefs_destroy(); - g_hash_table_destroy(prefs_hash); - prefs_hash = NULL; - -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prefs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,371 +0,0 @@ -/** - * @file prefs.h Prefs API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _PURPLE_PREFS_H_ -#define _PURPLE_PREFS_H_ - -#include - -/** - * Preference data types. - */ -typedef enum _PurplePrefType -{ - PURPLE_PREF_NONE, /**< No type. */ - PURPLE_PREF_BOOLEAN, /**< Boolean. */ - PURPLE_PREF_INT, /**< Integer. */ - PURPLE_PREF_STRING, /**< String. */ - PURPLE_PREF_STRING_LIST, /**< List of strings. */ - PURPLE_PREF_PATH, /**< Path. */ - PURPLE_PREF_PATH_LIST /**< List of paths. */ - -} PurplePrefType; - -/** - * The type of callbacks for preference changes. - * - * @param name the name of the preference which has changed. - * @param type the type of the preferenced named @a name - * @param val the new value of the preferencs; should be cast to the correct - * type. For instance, to recover the value of a #PURPLE_PREF_INT - * preference, use GPOINTER_TO_INT(val). Alternatively, - * just call purple_prefs_get_int(), purple_prefs_get_string_list() - * etc. - * @param data Arbitrary data specified when the callback was connected with - * purple_prefs_connect_callback(). - * - * @see purple_prefs_connect_callback() - */ -typedef void (*PurplePrefCallback) (const char *name, PurplePrefType type, - gconstpointer val, gpointer data); - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Prefs API - Preferences are named according to a directory-like structure. - Example: "/plugins/core/potato/is_from_idaho" (probably a boolean) */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the prefs subsystem handle. - * - * @return The prefs subsystem handle. - */ -void *purple_prefs_get_handle(void); - -/** - * Initialize core prefs - */ -void purple_prefs_init(void); - -/** - * Uninitializes the prefs subsystem. - */ -void purple_prefs_uninit(void); - -/** - * Add a new typeless pref. - * - * @param name The name of the pref - */ -void purple_prefs_add_none(const char *name); - -/** - * Add a new boolean pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_bool(const char *name, gboolean value); - -/** - * Add a new integer pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_int(const char *name, int value); - -/** - * Add a new string pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_string(const char *name, const char *value); - -/** - * Add a new string list pref. - * - * @param name The name of the pref - * @param value The initial value to set - * @note This function takes a copy of the strings in the value list. The list - * itself and original copies of the strings are up to the caller to - * free. - */ -void purple_prefs_add_string_list(const char *name, GList *value); - -/** - * Add a new path pref. - * - * @param name The name of the pref - * @param value The initial value to set - */ -void purple_prefs_add_path(const char *name, const char *value); - -/** - * Add a new path list pref. - * - * @param name The name of the pref - * @param value The initial value to set - * @note This function takes a copy of the strings in the value list. The list - * itself and original copies of the strings are up to the caller to - * free. - */ -void purple_prefs_add_path_list(const char *name, GList *value); - - -/** - * Remove a pref. - * - * @param name The name of the pref - */ -void purple_prefs_remove(const char *name); - -/** - * Rename a pref - * - * @param oldname The old name of the pref - * @param newname The new name for the pref - */ -void purple_prefs_rename(const char *oldname, const char *newname); - -/** - * Rename a boolean pref, toggling it's value - * - * @param oldname The old name of the pref - * @param newname The new name for the pref - */ -void purple_prefs_rename_boolean_toggle(const char *oldname, const char *newname); - -/** - * Remove all prefs. - */ -void purple_prefs_destroy(void); - -/** - * Set raw pref value - * - * @param name The name of the pref - * @param value The value to set - * - * @deprecated We're not really sure what purpose this function serves, so it - * will be removed in 3.0.0. Preferences values set using this - * function aren't serialized to prefs.xml, which could be - * misleading. There is also no purple_prefs_get_generic, which - * means that if you can't really get the value (other in a - * connected callback). If you think you have a use for this then - * please let us know. - */ -/* TODO: When this is removed, also remove struct purple_pref->value.generic */ -void purple_prefs_set_generic(const char *name, gpointer value); - -/** - * Set boolean pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_bool(const char *name, gboolean value); - -/** - * Set integer pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_int(const char *name, int value); - -/** - * Set string pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_string(const char *name, const char *value); - -/** - * Set string list pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_string_list(const char *name, GList *value); - -/** - * Set path pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_path(const char *name, const char *value); - -/** - * Set path list pref value - * - * @param name The name of the pref - * @param value The value to set - */ -void purple_prefs_set_path_list(const char *name, GList *value); - - -/** - * Check if a pref exists - * - * @param name The name of the pref - * @return TRUE if the pref exists. Otherwise FALSE. - */ -gboolean purple_prefs_exists(const char *name); - -/** - * Get pref type - * - * @param name The name of the pref - * @return The type of the pref - */ -PurplePrefType purple_prefs_get_type(const char *name); - -/** - * Get boolean pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -gboolean purple_prefs_get_bool(const char *name); - -/** - * Get integer pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -int purple_prefs_get_int(const char *name); - -/** - * Get string pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -const char *purple_prefs_get_string(const char *name); - -/** - * Get string list pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -GList *purple_prefs_get_string_list(const char *name); - -/** - * Get path pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -const char *purple_prefs_get_path(const char *name); - -/** - * Get path list pref value - * - * @param name The name of the pref - * @return The value of the pref - */ -GList *purple_prefs_get_path_list(const char *name); - -/** - * Returns a list of children for a pref - * - * @param name The parent pref - * @return A list of newly allocated strings denoting the names of the children. - * Returns @c NULL if there are no children or if pref doesn't exist. - * The caller must free all the strings and the list. - * - * @since 2.1.0 - */ -GList *purple_prefs_get_children_names(const char *name); - -/** - * Add a callback to a pref (and its children) - * - * @param handle The handle of the receiver. - * @param name The name of the preference - * @param cb The callback function - * @param data The data to pass to the callback function. - * - * @return An id to disconnect the callback - * - * @see purple_prefs_disconnect_callback - */ -guint purple_prefs_connect_callback(void *handle, const char *name, PurplePrefCallback cb, - gpointer data); - -/** - * Remove a callback to a pref - */ -void purple_prefs_disconnect_callback(guint callback_id); - -/** - * Remove all pref callbacks by handle - */ -void purple_prefs_disconnect_by_handle(void *handle); - -/** - * Trigger callbacks as if the pref changed - */ -void purple_prefs_trigger_callback(const char *name); - -/** - * Read preferences - */ -gboolean purple_prefs_load(void); - -/** - * Rename legacy prefs and delete some that no longer exist. - */ -void purple_prefs_update_old(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PREFS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,411 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "account.h" -#include "privacy.h" -#include "server.h" -#include "util.h" - -static PurplePrivacyUiOps *privacy_ops = NULL; - -gboolean -purple_privacy_permit_add(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - char *name; - PurpleBuddy *buddy; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - name = g_strdup(purple_normalize(account, who)); - - for (l = account->permit; l != NULL; l = l->next) { - if (g_str_equal(name, l->data)) - /* This buddy already exists */ - break; - } - - if (l != NULL) - { - /* This buddy already exists, so bail out */ - g_free(name); - return FALSE; - } - - account->permit = g_slist_append(account->permit, name); - - if (!local_only && purple_account_is_connected(account)) - serv_add_permit(purple_account_get_connection(account), who); - - if (privacy_ops != NULL && privacy_ops->permit_added != NULL) - privacy_ops->permit_added(account, who); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - /* This lets the UI know a buddy has had its privacy setting changed */ - buddy = purple_find_buddy(account, name); - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - return TRUE; -} - -gboolean -purple_privacy_permit_remove(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - const char *name; - PurpleBuddy *buddy; - char *del; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - name = purple_normalize(account, who); - - for (l = account->permit; l != NULL; l = l->next) { - if (g_str_equal(name, l->data)) - /* We found the buddy we were looking for */ - break; - } - - if (l == NULL) - /* We didn't find the buddy we were looking for, so bail out */ - return FALSE; - - /* We should not free l->data just yet. There can be occasions where - * l->data == who. In such cases, freeing l->data here can cause crashes - * later when who is used. */ - del = l->data; - account->permit = g_slist_delete_link(account->permit, l); - - if (!local_only && purple_account_is_connected(account)) - serv_rem_permit(purple_account_get_connection(account), who); - - if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) - privacy_ops->permit_removed(account, who); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - buddy = purple_find_buddy(account, name); - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - g_free(del); - return TRUE; -} - -gboolean -purple_privacy_deny_add(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - char *name; - PurpleBuddy *buddy; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - name = g_strdup(purple_normalize(account, who)); - - for (l = account->deny; l != NULL; l = l->next) { - if (g_str_equal(name, l->data)) - /* This buddy already exists */ - break; - } - - if (l != NULL) - { - /* This buddy already exists, so bail out */ - g_free(name); - return FALSE; - } - - account->deny = g_slist_append(account->deny, name); - - if (!local_only && purple_account_is_connected(account)) - serv_add_deny(purple_account_get_connection(account), who); - - if (privacy_ops != NULL && privacy_ops->deny_added != NULL) - privacy_ops->deny_added(account, who); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - buddy = purple_find_buddy(account, name); - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - return TRUE; -} - -gboolean -purple_privacy_deny_remove(PurpleAccount *account, const char *who, - gboolean local_only) -{ - GSList *l; - const char *normalized; - char *name; - PurpleBuddy *buddy; - PurpleBlistUiOps *blist_ops; - - g_return_val_if_fail(account != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - normalized = purple_normalize(account, who); - - for (l = account->deny; l != NULL; l = l->next) { - if (g_str_equal(normalized, l->data)) - /* We found the buddy we were looking for */ - break; - } - - if (l == NULL) - /* We didn't find the buddy we were looking for, so bail out */ - return FALSE; - - buddy = purple_find_buddy(account, normalized); - - name = l->data; - account->deny = g_slist_delete_link(account->deny, l); - - if (!local_only && purple_account_is_connected(account)) - serv_rem_deny(purple_account_get_connection(account), name); - - if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) - privacy_ops->deny_removed(account, who); - - if (buddy != NULL) { - purple_signal_emit(purple_blist_get_handle(), - "buddy-privacy-changed", buddy); - } - - g_free(name); - - blist_ops = purple_blist_get_ui_ops(); - if (blist_ops != NULL && blist_ops->save_account != NULL) - blist_ops->save_account(account); - - return TRUE; -} - -/** - * This makes sure your permit list contains all buddies from your - * buddy list and ONLY buddies from your buddy list. - */ -static void -add_all_buddies_to_permit_list(PurpleAccount *account, gboolean local) -{ - GSList *list; - - /* Remove anyone in the permit list who is not in the buddylist */ - for (list = account->permit; list != NULL; ) { - char *person = list->data; - list = list->next; - if (!purple_find_buddy(account, person)) - purple_privacy_permit_remove(account, person, local); - } - - /* Now make sure everyone in the buddylist is in the permit list */ - list = purple_find_buddies(account, NULL); - while (list != NULL) - { - PurpleBuddy *buddy = list->data; - const gchar *name = purple_buddy_get_name(buddy); - - if (!g_slist_find_custom(account->permit, name, (GCompareFunc)g_utf8_collate)) - purple_privacy_permit_add(account, name, local); - list = g_slist_delete_link(list, list); - } -} - -/* - * TODO: All callers of this function pass in FALSE for local and - * restore and I don't understand when you would ever want to - * use TRUE for either of them. I think both parameters could - * safely be removed in the next major version bump. - */ -void -purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, - gboolean restore) -{ - GSList *list; - PurplePrivacyType type = account->perm_deny; - - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - return; - case PURPLE_PRIVACY_ALLOW_USERS: - purple_privacy_permit_add(account, who, local); - break; - case PURPLE_PRIVACY_DENY_USERS: - purple_privacy_deny_remove(account, who, local); - break; - case PURPLE_PRIVACY_DENY_ALL: - if (!restore) { - /* Empty the allow-list. */ - const char *norm = purple_normalize(account, who); - for (list = account->permit; list != NULL;) { - char *person = list->data; - list = list->next; - if (!purple_strequal(norm, person)) - purple_privacy_permit_remove(account, person, local); - } - } - purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - if (!purple_find_buddy(account, who)) { - add_all_buddies_to_permit_list(account, local); - purple_privacy_permit_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } - break; - default: - g_return_if_reached(); - } - - /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) - serv_set_permit_deny(purple_account_get_connection(account)); -} - -/* - * TODO: All callers of this function pass in FALSE for local and - * restore and I don't understand when you would ever want to - * use TRUE for either of them. I think both parameters could - * safely be removed in the next major version bump. - */ -void -purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, - gboolean restore) -{ - GSList *list; - PurplePrivacyType type = account->perm_deny; - - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - if (!restore) { - /* Empty the deny-list. */ - const char *norm = purple_normalize(account, who); - for (list = account->deny; list != NULL; ) { - char *person = list->data; - list = list->next; - if (!purple_strequal(norm, person)) - purple_privacy_deny_remove(account, person, local); - } - } - purple_privacy_deny_add(account, who, local); - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - break; - case PURPLE_PRIVACY_ALLOW_USERS: - purple_privacy_permit_remove(account, who, local); - break; - case PURPLE_PRIVACY_DENY_USERS: - purple_privacy_deny_add(account, who, local); - break; - case PURPLE_PRIVACY_DENY_ALL: - break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - if (purple_find_buddy(account, who)) { - add_all_buddies_to_permit_list(account, local); - purple_privacy_permit_remove(account, who, local); - account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } - break; - default: - g_return_if_reached(); - } - - /* Notify the server if the privacy setting was changed */ - if (type != account->perm_deny && purple_account_is_connected(account)) - serv_set_permit_deny(purple_account_get_connection(account)); -} - -gboolean -purple_privacy_check(PurpleAccount *account, const char *who) -{ - GSList *list; - - switch (account->perm_deny) { - case PURPLE_PRIVACY_ALLOW_ALL: - return TRUE; - - case PURPLE_PRIVACY_DENY_ALL: - return FALSE; - - case PURPLE_PRIVACY_ALLOW_USERS: - who = purple_normalize(account, who); - for (list=account->permit; list!=NULL; list=list->next) { - if (g_str_equal(who, list->data)) - return TRUE; - } - return FALSE; - - case PURPLE_PRIVACY_DENY_USERS: - who = purple_normalize(account, who); - for (list=account->deny; list!=NULL; list=list->next) { - if (g_str_equal(who, list->data)) - return FALSE; - } - return TRUE; - - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - return (purple_find_buddy(account, who) != NULL); - - default: - g_return_val_if_reached(TRUE); - } -} - -void -purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops) -{ - privacy_ops = ops; -} - -PurplePrivacyUiOps * -purple_privacy_get_ui_ops(void) -{ - return privacy_ops; -} - -void -purple_privacy_init(void) -{ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/privacy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/** - * @file privacy.h Privacy API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_PRIVACY_H_ -#define _PURPLE_PRIVACY_H_ - -/** - * Privacy data types. - */ -typedef enum _PurplePrivacyType -{ - PURPLE_PRIVACY_ALLOW_ALL = 1, - PURPLE_PRIVACY_DENY_ALL, - PURPLE_PRIVACY_ALLOW_USERS, - PURPLE_PRIVACY_DENY_USERS, - PURPLE_PRIVACY_ALLOW_BUDDYLIST -} PurplePrivacyType; - -#include "account.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Privacy core/UI operations. - */ -typedef struct -{ - void (*permit_added)(PurpleAccount *account, const char *name); - void (*permit_removed)(PurpleAccount *account, const char *name); - void (*deny_added)(PurpleAccount *account, const char *name); - void (*deny_removed)(PurpleAccount *account, const char *name); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurplePrivacyUiOps; - -/** - * Adds a user to the account's permit list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was added successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_permit_add(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Removes a user from the account's permit list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was removed successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_permit_remove(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Adds a user to the account's deny list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was added successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_deny_add(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Removes a user from the account's deny list. - * - * @param account The account. - * @param name The name of the user to add to the list. - * @param local_only If TRUE, only the local list is updated, and not - * the server. - * - * @return TRUE if the user was removed successfully, or @c FALSE otherwise. - */ -gboolean purple_privacy_deny_remove(PurpleAccount *account, const char *name, - gboolean local_only); - -/** - * Allow a user to send messages. If current privacy setting for the account is: - * PURPLE_PRIVACY_ALLOW_USERS: The user is added to the allow-list. - * PURPLE_PRIVACY_DENY_USERS : The user is removed from the deny-list. - * PURPLE_PRIVACY_ALLOW_ALL : No changes made. - * PURPLE_PRIVACY_DENY_ALL : The privacy setting is changed to - * PURPLE_PRIVACY_ALLOW_USERS and the user - * is added to the allow-list. - * PURPLE_PRIVACY_ALLOW_BUDDYLIST: No changes made if the user is already in - * the buddy-list. Otherwise the setting is - * changed to PURPLE_PRIVACY_ALLOW_USERS, all the - * buddies are added to the allow-list, and the - * user is also added to the allow-list. - * - * @param account The account. - * @param who The name of the user. - * @param local Whether the change is local-only. - * @param restore Should the previous allow/deny list be restored if the - * privacy setting is changed. - */ -void purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local, - gboolean restore); - -/** - * Block messages from a user. If current privacy setting for the account is: - * PURPLE_PRIVACY_ALLOW_USERS: The user is removed from the allow-list. - * PURPLE_PRIVACY_DENY_USERS : The user is added to the deny-list. - * PURPLE_PRIVACY_DENY_ALL : No changes made. - * PURPLE_PRIVACY_ALLOW_ALL : The privacy setting is changed to - * PURPLE_PRIVACY_DENY_USERS and the user is - * added to the deny-list. - * PURPLE_PRIVACY_ALLOW_BUDDYLIST: If the user is not in the buddy-list, - * then no changes made. Otherwise, the setting - * is changed to PURPLE_PRIVACY_ALLOW_USERS, all - * the buddies are added to the allow-list, and - * this user is removed from the list. - * - * @param account The account. - * @param who The name of the user. - * @param local Whether the change is local-only. - * @param restore Should the previous allow/deny list be restored if the - * privacy setting is changed. - */ -void purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, - gboolean restore); - -/** - * Check the privacy-setting for a user. - * - * @param account The account. - * @param who The name of the user. - * - * @return @c FALSE if the specified account's privacy settings block the user or @c TRUE otherwise. The meaning of "block" is protocol-dependent and generally relates to status and/or sending of messages. - */ -gboolean purple_privacy_check(PurpleAccount *account, const char *who); - -/** - * Sets the UI operations structure for the privacy subsystem. - * - * @param ops The UI operations structure. - */ -void purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops); - -/** - * Returns the UI operations structure for the privacy subsystem. - * - * @return The UI operations structure. - */ -PurplePrivacyUiOps *purple_privacy_get_ui_ops(void); - -/** - * Initializes the privacy subsystem. - */ -void purple_privacy_init(void); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PRIVACY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,750 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include -#ifndef _WIN32 -#include -#else -#define UNICODE -#include -#include -#include -#include "dns_sd_proxy.h" -#endif - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "debug.h" -#include "util.h" -#include "version.h" - -#include "bonjour.h" -#include "mdns_common.h" -#include "jabber.h" -#include "buddy.h" -#include "bonjour_ft.h" - -static char *default_firstname; -static char *default_lastname; -static char *default_hostname; - -static void -bonjour_removeallfromlocal(PurpleConnection *conn, PurpleGroup *bonjour_group) -{ - PurpleAccount *account = purple_connection_get_account(conn); - PurpleBlistNode *cnode, *cnodenext, *bnode, *bnodenext; - PurpleBuddy *buddy; - - if (bonjour_group == NULL) - return; - - /* Go through and remove all buddies that belong to this account */ - for (cnode = purple_blist_node_get_first_child((PurpleBlistNode *) bonjour_group); cnode; cnode = cnodenext) { - cnodenext = purple_blist_node_get_sibling_next(cnode); - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = bnodenext) { - bnodenext = purple_blist_node_get_sibling_next(bnode); - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *) bnode; - if (purple_buddy_get_account(buddy) != account) - continue; - purple_prpl_got_user_status(account, purple_buddy_get_name(buddy), "offline", NULL); - purple_account_remove_buddy(account, buddy, NULL); - purple_blist_remove_buddy(buddy); - } - } - -} - -static void -bonjour_login(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - BonjourData *bd; - PurpleStatus *status; - PurplePresence *presence; - -#ifdef _WIN32 - if (!dns_sd_available()) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to find Apple's \"Bonjour for Windows\" toolkit, see " - "http://d.pidgin.im/BonjourWindows for more information.")); - return; - } -#endif /* _WIN32 */ - - gc->flags |= PURPLE_CONNECTION_HTML; - gc->proto_data = bd = g_new0(BonjourData, 1); - - /* Start waiting for jabber connections (iChat style) */ - bd->jabber_data = g_new0(BonjourJabber, 1); - bd->jabber_data->port = purple_account_get_int(account, "port", BONJOUR_DEFAULT_PORT); - bd->jabber_data->account = account; - - if (bonjour_jabber_start(bd->jabber_data) == -1) { - /* Send a message about the connection error */ - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to listen for incoming IM connections")); - return; - } - - /* Connect to the mDNS daemon looking for buddies in the LAN */ - bd->dns_sd_data = bonjour_dns_sd_new(); - bd->dns_sd_data->first = g_strdup(purple_account_get_string(account, "first", default_firstname)); - bd->dns_sd_data->last = g_strdup(purple_account_get_string(account, "last", default_lastname)); - bd->dns_sd_data->port_p2pj = bd->jabber_data->port; - /* Not engaged in AV conference */ - bd->dns_sd_data->vc = g_strdup("!"); - - status = purple_account_get_active_status(account); - presence = purple_account_get_presence(account); - if (purple_presence_is_available(presence)) - bd->dns_sd_data->status = g_strdup("avail"); - else if (purple_presence_is_idle(presence)) - bd->dns_sd_data->status = g_strdup("away"); - else - bd->dns_sd_data->status = g_strdup("dnd"); - bd->dns_sd_data->msg = g_strdup(purple_status_get_attr_string(status, "message")); - - bd->dns_sd_data->account = account; - if (!bonjour_dns_sd_start(bd->dns_sd_data)) - { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to establish connection with the local mDNS server. Is it running?")); - return; - } - - bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); - - /* Show the buddy list by telling Purple we have already connected */ - purple_connection_set_state(gc, PURPLE_CONNECTED); -} - -static void -bonjour_close(PurpleConnection *connection) -{ - PurpleGroup *bonjour_group; - BonjourData *bd = connection->proto_data; - - bonjour_group = purple_find_group(BONJOUR_GROUP_NAME); - - /* Remove all the bonjour buddies */ - bonjour_removeallfromlocal(connection, bonjour_group); - - /* Stop looking for buddies in the LAN */ - if (bd != NULL && bd->dns_sd_data != NULL) - { - bonjour_dns_sd_stop(bd->dns_sd_data); - bonjour_dns_sd_free(bd->dns_sd_data); - } - - if (bd != NULL && bd->jabber_data != NULL) - { - /* Stop waiting for conversations */ - bonjour_jabber_stop(bd->jabber_data); - g_free(bd->jabber_data); - } - - /* Delete the bonjour group */ - if (bonjour_group != NULL) - purple_blist_remove_group(bonjour_group); - - /* Cancel any file transfers */ - while (bd != NULL && bd->xfer_lists) { - purple_xfer_cancel_local(bd->xfer_lists->data); - } - - g_free(bd); - connection->proto_data = NULL; -} - -static const char * -bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy) -{ - return BONJOUR_ICON_NAME; -} - -static int -bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags) -{ - if(!to || !msg) - return 0; - - return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg); -} - -static void -bonjour_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - BonjourData *bd; - gboolean disconnected; - PurpleStatusType *type; - int primitive; - PurplePresence *presence; - const char *message, *bonjour_status; - gchar *stripped; - - gc = purple_account_get_connection(account); - bd = gc->proto_data; - disconnected = purple_account_is_disconnected(account); - type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(type); - presence = purple_account_get_presence(account); - - message = purple_status_get_attr_string(status, "message"); - if (message == NULL) - message = ""; - stripped = purple_markup_strip_html(message); - - /* - * The three possible status for Bonjour are - * -available ("avail") - * -idle ("away") - * -away ("dnd") - * Each of them can have an optional message. - */ - if (purple_presence_is_available(presence)) - bonjour_status = "avail"; - else if (purple_presence_is_idle(presence)) - bonjour_status = "away"; - else - bonjour_status = "dnd"; - - bonjour_dns_sd_send_status(bd->dns_sd_data, bonjour_status, stripped); - g_free(stripped); -} - -/* - * The add_buddy callback removes the buddy from the local list. - * Bonjour manages buddies for you, and adding someone locally by - * hand is stupid. Perhaps we should change libpurple not to allow adding - * if there is no add_buddy callback. - */ -static void -bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { - purple_debug_error("bonjour", "Buddy '%s' manually added; removing. " - "Bonjour buddies must be discovered and not manually added.\n", - purple_buddy_get_name(buddy)); - - /* I suppose we could alert the user here, but it seems unnecessary. */ - - /* If this causes problems, it can be moved to an idle callback */ - purple_blist_remove_buddy(buddy); -} - - -static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy); - if (bb) { - bonjour_buddy_delete(bb); - purple_buddy_set_protocol_data(buddy, NULL); - } -} - -static GList * -bonjour_status_types(PurpleAccount *account) -{ - GList *status_types = NULL; - PurpleStatusType *type; - - g_return_val_if_fail(account != NULL, NULL); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - BONJOUR_STATUS_ID_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - BONJOUR_STATUS_ID_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - BONJOUR_STATUS_ID_OFFLINE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - return status_types; -} - -static void -bonjour_convo_closed(PurpleConnection *connection, const char *who) -{ - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); - BonjourBuddy *bb; - - if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) - { - /* - * This buddy is not in our buddy list, and therefore does not really - * exist, so we won't have any data about them. - */ - return; - } - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; -} - -static -void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img) -{ - BonjourData *bd = conn->proto_data; - bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); -} - - -static char * -bonjour_status_text(PurpleBuddy *buddy) -{ - const PurplePresence *presence; - const PurpleStatus *status; - const char *message; - gchar *ret = NULL; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - message = purple_status_get_attr_string(status, "message"); - - if (message != NULL) { - ret = g_markup_escape_text(message, -1); - purple_util_chrreplace(ret, '\n', ' '); - } - - return ret; -} - -static void -bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurplePresence *presence; - PurpleStatus *status; - BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy); - const char *status_description; - const char *message; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - message = purple_status_get_attr_string(status, "message"); - - if (purple_presence_is_available(presence)) - status_description = purple_status_get_name(status); - else if (purple_presence_is_idle(presence)) - status_description = _("Idle"); - else - status_description = purple_status_get_name(status); - - purple_notify_user_info_add_pair(user_info, _("Status"), status_description); - if (message != NULL) - purple_notify_user_info_add_pair(user_info, _("Message"), message); - - if (bb == NULL) { - purple_debug_error("bonjour", "Got tooltip request for a buddy without protocol data.\n"); - return; - } - - /* Only show first/last name if there is a nickname set (to avoid duplication) */ - if (bb->nick != NULL && *bb->nick != '\0') { - if (bb->first != NULL && *bb->first != '\0') - purple_notify_user_info_add_pair(user_info, _("First name"), bb->first); - if (bb->last != NULL && *bb->last != '\0') - purple_notify_user_info_add_pair(user_info, _("Last name"), bb->last); - } - - if (bb->email != NULL && *bb->email != '\0') - purple_notify_user_info_add_pair(user_info, _("Email"), bb->email); - - if (bb->AIM != NULL && *bb->AIM != '\0') - purple_notify_user_info_add_pair(user_info, _("AIM Account"), bb->AIM); - - if (bb->jid != NULL && *bb->jid != '\0') - purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid); -} - -static void bonjour_do_group_change(PurpleBuddy *buddy, const char *new_group) { - PurpleBlistNodeFlags oldflags; - - if (buddy == NULL) - return; - - oldflags = purple_blist_node_get_flags((PurpleBlistNode *)buddy); - - /* If we're moving them out of the bonjour group, make them persistent */ - if (purple_strequal(new_group, BONJOUR_GROUP_NAME)) - purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags | PURPLE_BLIST_NODE_FLAG_NO_SAVE); - else - purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags ^ PURPLE_BLIST_NODE_FLAG_NO_SAVE); - -} - -static void -bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group) -{ - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); - - bonjour_do_group_change(buddy, new_group); - -} - -static void -bonjour_rename_group(PurpleConnection *connection, const char *old_name, PurpleGroup *group, GList *moved_buddies) -{ - GList *cur; - const char *new_group; - PurpleBuddy *buddy; - - new_group = purple_group_get_name(group); - - for (cur = moved_buddies; cur; cur = cur->next) { - buddy = cur->data; - bonjour_do_group_change(buddy, new_group); - } - -} - -static gboolean -bonjour_can_receive_file(PurpleConnection *connection, const char *who) -{ - PurpleBuddy *buddy = purple_find_buddy(connection->account, who); - - return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL); -} - -static gboolean -plugin_unload(PurplePlugin *plugin) -{ - /* These shouldn't happen here because they are allocated in _init() */ - - g_free(default_firstname); - g_free(default_lastname); - g_free(default_hostname); - - return TRUE; -} - -static PurplePlugin *my_protocol = NULL; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_NO_PASSWORD, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - bonjour_list_icon, /* list_icon */ - NULL, /* list_emblem */ - bonjour_status_text, /* status_text */ - bonjour_tooltip_text, /* tooltip_text */ - bonjour_status_types, /* status_types */ - NULL, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - bonjour_login, /* login */ - bonjour_close, /* close */ - bonjour_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - NULL, /* get_info */ - bonjour_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - bonjour_fake_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - bonjour_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - bonjour_group_buddy, /* group_buddy */ - bonjour_rename_group, /* rename_group */ - NULL, /* buddy_free */ - bonjour_convo_closed, /* convo_closed */ - NULL, /* normalize */ - bonjour_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - bonjour_can_receive_file, /* can_receive_file */ - bonjour_send_file, /* send_file */ - bonjour_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-bonjour", /**< id */ - "Bonjour", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Bonjour Protocol Plugin"), - /** description */ - N_("Bonjour Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - plugin_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -#ifdef WIN32 -static gboolean _set_default_name_cb(gpointer data) { - gchar *fullname = data; - const char *splitpoint; - GList *tmp = prpl_info.protocol_options; - PurpleAccountOption *option; - - if (!fullname) { - purple_debug_info("bonjour", "Unable to look up First and Last name or Username from system; using defaults.\n"); - return FALSE; - } - - g_free(default_firstname); - g_free(default_lastname); - - /* Split the real name into a first and last name */ - splitpoint = strchr(fullname, ' '); - if (splitpoint != NULL) { - default_firstname = g_strndup(fullname, splitpoint - fullname); - default_lastname = g_strdup(&splitpoint[1]); - } else { - default_firstname = g_strdup(fullname); - default_lastname = g_strdup(""); - } - g_free(fullname); - - - for(; tmp != NULL; tmp = tmp->next) { - option = tmp->data; - if (strcmp("first", purple_account_option_get_setting(option)) == 0) - purple_account_option_set_default_string(option, default_firstname); - else if (strcmp("last", purple_account_option_get_setting(option)) == 0) - purple_account_option_set_default_string(option, default_lastname); - } - - return FALSE; -} - -static gpointer _win32_name_lookup_thread(gpointer data) { - gchar *fullname = NULL; - wchar_t username[UNLEN + 1]; - DWORD dwLenUsername = UNLEN + 1; - - GetUserNameW((LPWSTR) &username, &dwLenUsername); - - if (username != NULL && *username != '\0') { - LPBYTE servername = NULL; - LPBYTE info = NULL; - - NetGetDCName(NULL, NULL, &servername); - - /* purple_debug_info("bonjour", "Looking up the full name from the %s.\n", (servername ? "domain controller" : "local machine")); */ - - if (NetUserGetInfo((LPCWSTR) servername, username, 10, &info) == NERR_Success - && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL - && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') { - fullname = g_utf16_to_utf8( - ((LPUSER_INFO_10) info)->usri10_full_name, - -1, NULL, NULL, NULL); - } - /* Fall back to the local machine if we didn't get the full name from the domain controller */ - else if (servername != NULL) { - /* purple_debug_info("bonjour", "Looking up the full name from the local machine"); */ - - if (info != NULL) NetApiBufferFree(info); - info = NULL; - - if (NetUserGetInfo(NULL, username, 10, &info) == NERR_Success - && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL - && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') { - fullname = g_utf16_to_utf8( - ((LPUSER_INFO_10) info)->usri10_full_name, - -1, NULL, NULL, NULL); - } - } - - if (info != NULL) NetApiBufferFree(info); - if (servername != NULL) NetApiBufferFree(servername); - - if (!fullname) - fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL); - } - - purple_timeout_add(0, _set_default_name_cb, fullname); - - return NULL; -} -#endif - -static void -initialize_default_account_values(void) -{ -#ifndef _WIN32 - struct passwd *info; -#endif - const char *fullname = NULL, *splitpoint, *tmp; - gchar *conv = NULL; - -#ifndef _WIN32 - /* Try to figure out the user's real name */ - info = getpwuid(getuid()); - if ((info != NULL) && (info->pw_gecos != NULL) && (info->pw_gecos[0] != '\0')) - fullname = info->pw_gecos; - else if ((info != NULL) && (info->pw_name != NULL) && (info->pw_name[0] != '\0')) - fullname = info->pw_name; - else if (((fullname = getlogin()) != NULL) && (fullname[0] == '\0')) - fullname = NULL; -#else - /* The Win32 username lookup functions are synchronous so we do it in a thread */ - g_thread_create(_win32_name_lookup_thread, NULL, FALSE, NULL); -#endif - - /* Make sure fullname is valid UTF-8. If not, try to convert it. */ - if (fullname != NULL && !g_utf8_validate(fullname, -1, NULL)) { - fullname = conv = g_locale_to_utf8(fullname, -1, NULL, NULL, NULL); - if (conv == NULL || *conv == '\0') - fullname = NULL; - } - - if (fullname == NULL) - fullname = _("Purple Person"); - - /* Split the real name into a first and last name */ - splitpoint = strchr(fullname, ' '); - if (splitpoint != NULL) { - default_firstname = g_strndup(fullname, splitpoint - fullname); - tmp = &splitpoint[1]; - - /* The last name may be followed by a comma and additional data. - * Only use the last name itself. - */ - splitpoint = strchr(tmp, ','); - if (splitpoint != NULL) - default_lastname = g_strndup(tmp, splitpoint - tmp); - else - default_lastname = g_strdup(tmp); - } else { - default_firstname = g_strdup(fullname); - default_lastname = g_strdup(""); - } - - g_free(conv); - - /* Try to figure out a good host name to use */ - /* TODO: Avoid 'localhost,' if possible */ - default_hostname = g_strdup(purple_get_host_name()); -} - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - initialize_default_account_values(); - - /* Creating the user splits */ - split = purple_account_user_split_new(_("Hostname"), default_hostname, '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Creating the options for the protocol */ - option = purple_account_option_int_new(_("Local Port"), "port", BONJOUR_DEFAULT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("First name"), "first", default_firstname); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Last name"), "last", default_lastname); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Email"), "email", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("AIM Account"), "AIM", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("XMPP Account"), "jid", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - my_protocol = plugin; -} - -PURPLE_INIT_PLUGIN(bonjour, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,897 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#include "internal.h" -#include "util.h" -#include "debug.h" -#include "notify.h" -#include "proxy.h" -#include "ft.h" -#include "buddy.h" -#include "bonjour.h" -#include "bonjour_ft.h" -#include "cipher.h" - -static void -bonjour_bytestreams_init(PurpleXfer *xfer); -static void -bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb); -static void -bonjour_xfer_init(PurpleXfer *xfer); -static void -bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option); -static void bonjour_free_xfer(PurpleXfer *xfer); - -/* Look for specific xfer handle */ -static unsigned int next_id = 0; - -static void -xep_ft_si_reject(BonjourData *bd, const char *id, const char *to, const char *error_code, const char *error_type) -{ - xmlnode *error_node; - XepIq *iq; - - g_return_if_fail(error_code != NULL); - g_return_if_fail(error_type != NULL); - - if(!to || !id) - return; - - purple_debug_info("bonjour", "xep file transfer stream initialization error.\n"); - iq = xep_iq_new(bd, XEP_IQ_ERROR, to, purple_account_get_username(bd->jabber_data->account), id); - if(iq == NULL) - return; - - error_node = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error_node, "code", error_code); - xmlnode_set_attrib(error_node, "type", error_type); - - /* TODO: Make this better */ - if (!strcmp(error_code, "403")) { - xmlnode *tmp_node = xmlnode_new_child(error_node, "forbidden"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - - tmp_node = xmlnode_new_child(error_node, "text"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - xmlnode_insert_data(tmp_node, "Offer Declined", -1); - } else if (!strcmp(error_code, "404")) { - xmlnode *tmp_node = xmlnode_new_child(error_node, "item-not-found"); - xmlnode_set_namespace(tmp_node, "urn:ietf:params:xml:ns:xmpp-stanzas"); - } - - xep_iq_send_and_free(iq); -} - -static void bonjour_xfer_cancel_send(PurpleXfer *xfer) -{ - purple_debug_info("bonjour", "Bonjour-xfer-cancel-send.\n"); - bonjour_free_xfer(xfer); -} - -static void bonjour_xfer_request_denied(PurpleXfer *xfer) -{ - XepXfer *xf = xfer->data; - - purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n"); - - if(xf) - xep_ft_si_reject(xf->data, xf->sid, xfer->who, "403", "cancel"); - - bonjour_free_xfer(xfer); -} - -static void bonjour_xfer_cancel_recv(PurpleXfer *xfer) -{ - purple_debug_info("bonjour", "Bonjour-xfer-cancel-recv.\n"); - bonjour_free_xfer(xfer); -} - -struct socket_cleanup { - int fd; - guint handle; -}; - -static void -_wait_for_socket_close(gpointer data, gint source, PurpleInputCondition cond) -{ - struct socket_cleanup *sc = data; - char buf[1]; - int ret; - - ret = recv(source, buf, 1, 0); - - if (ret == 0 || (ret == -1 && !(errno == EAGAIN || errno == EWOULDBLOCK))) { - purple_debug_info("bonjour", "Client completed recieving; closing server socket.\n"); - purple_input_remove(sc->handle); - close(sc->fd); - g_free(sc); - } -} - -static void bonjour_xfer_end(PurpleXfer *xfer) -{ - purple_debug_info("bonjour", "Bonjour-xfer-end.\n"); - - /* We can't allow the server side to close the connection until the client is complete, - * otherwise there is a RST resulting in an error on the client side */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && purple_xfer_is_completed(xfer)) { - struct socket_cleanup *sc = g_new0(struct socket_cleanup, 1); - sc->fd = xfer->fd; - xfer->fd = -1; - sc->handle = purple_input_add(sc->fd, PURPLE_INPUT_READ, - _wait_for_socket_close, sc); - } - - bonjour_free_xfer(xfer); -} - -static PurpleXfer* -bonjour_si_xfer_find(BonjourData *bd, const char *sid, const char *from) -{ - GSList *xfers; - PurpleXfer *xfer; - XepXfer *xf; - - if(!sid || !from || !bd) - return NULL; - - purple_debug_info("bonjour", "Look for sid=%s from=%s xferlists.\n", - sid, from); - - for(xfers = bd->xfer_lists; xfers; xfers = xfers->next) { - xfer = xfers->data; - if(xfer == NULL) - break; - xf = xfer->data; - if(xf == NULL) - break; - if(xf->sid && xfer->who && !strcmp(xf->sid, sid) && - !strcmp(xfer->who, from)) - return xfer; - } - - purple_debug_info("bonjour", "Look for xfer list fail\n"); - - return NULL; -} - -static void -xep_ft_si_offer(PurpleXfer *xfer, const gchar *to) -{ - xmlnode *si_node, *feature, *field, *file, *x; - XepIq *iq; - XepXfer *xf = xfer->data; - BonjourData *bd = NULL; - char buf[32]; - - if(!xf) - return; - - bd = xf->data; - if(!bd) - return; - - purple_debug_info("bonjour", "xep file transfer stream initialization offer-id=%d.\n", next_id); - - /* Assign stream id. */ - g_free(xf->iq_id); - xf->iq_id = g_strdup_printf("%u", next_id++); - iq = xep_iq_new(xf->data, XEP_IQ_SET, to, purple_account_get_username(bd->jabber_data->account), xf->iq_id); - if(iq == NULL) - return; - - /*Construct Stream initialization offer message.*/ - si_node = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); - xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer"); - g_free(xf->sid); - xf->sid = g_strdup(xf->iq_id); - xmlnode_set_attrib(si_node, "id", xf->sid); - - file = xmlnode_new_child(si_node, "file"); - xmlnode_set_namespace(file, "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); - xmlnode_set_attrib(file, "size", buf); - - feature = xmlnode_new_child(si_node, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "form"); - - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - xmlnode_set_attrib(field, "type", "list-single"); - - if (xf->mode & XEP_BYTESTREAMS) { - xmlnode *option = xmlnode_new_child(field, "option"); - xmlnode *value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); - } - if (xf->mode & XEP_IBB) { - xmlnode *option = xmlnode_new_child(field, "option"); - xmlnode *value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/ibb", -1); - } - - xep_iq_send_and_free(iq); -} - -static void -xep_ft_si_result(PurpleXfer *xfer, char *to) -{ - xmlnode *si_node, *feature, *field, *value, *x; - XepIq *iq; - XepXfer *xf; - BonjourData *bd; - - if(!to || !xfer) - return; - xf = xfer->data; - if(!xf) - return; - - bd = xf->data; - - purple_debug_info("bonjour", "xep file transfer stream initialization result.\n"); - iq = xep_iq_new(bd, XEP_IQ_RESULT, to, purple_account_get_username(bd->jabber_data->account), xf->iq_id); - if(iq == NULL) - return; - - si_node = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si_node, "http://jabber.org/protocol/si"); - /*xmlnode_set_attrib(si_node, "profile", "http://jabber.org/protocol/si/profile/file-transfer");*/ - - feature = xmlnode_new_child(si_node, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, "http://jabber.org/protocol/bytestreams", -1); - - xep_iq_send_and_free(iq); -} - -static void -bonjour_free_xfer(PurpleXfer *xfer) -{ - XepXfer *xf; - - if(xfer == NULL) { - purple_debug_info("bonjour", "bonjour-free-xfer-null.\n"); - return; - } - - purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer); - - xf = (XepXfer*)xfer->data; - if(xf != NULL) { - BonjourData *bd = (BonjourData*)xf->data; - if(bd != NULL) { - bd->xfer_lists = g_slist_remove(bd->xfer_lists, xfer); - purple_debug_info("bonjour", "B free xfer from lists(%p).\n", bd->xfer_lists); - } - if (xf->proxy_connection != NULL) - purple_proxy_connect_cancel(xf->proxy_connection); - if (xf->proxy_info != NULL) - purple_proxy_info_destroy(xf->proxy_info); - if (xf->listen_data != NULL) - purple_network_listen_cancel(xf->listen_data); - g_free(xf->iq_id); - g_free(xf->jid); - g_free(xf->proxy_host); - g_free(xf->buddy_ip); - g_free(xf->sid); - g_free(xf); - xfer->data = NULL; - } - - purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd); -} - -PurpleXfer * -bonjour_new_xfer(PurpleConnection *gc, const char *who) -{ - PurpleXfer *xfer; - XepXfer *xep_xfer; - BonjourData *bd; - - if(who == NULL || gc == NULL) - return NULL; - - purple_debug_info("bonjour", "Bonjour-new-xfer to %s.\n", who); - bd = (BonjourData*) gc->proto_data; - if(bd == NULL) - return NULL; - - /* Build the file transfer handle */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - xfer->data = xep_xfer = g_new0(XepXfer, 1); - xep_xfer->data = bd; - - purple_debug_info("bonjour", "Bonjour-new-xfer bd=%p data=%p.\n", bd, xep_xfer->data); - - /* We don't support IBB yet */ - /*xep_xfer->mode = XEP_BYTESTREAMS | XEP_IBB;*/ - xep_xfer->mode = XEP_BYTESTREAMS; - xep_xfer->sid = NULL; - - purple_xfer_set_init_fnc(xfer, bonjour_xfer_init); - purple_xfer_set_cancel_send_fnc(xfer, bonjour_xfer_cancel_send); - purple_xfer_set_end_fnc(xfer, bonjour_xfer_end); - - bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer); - - return xfer; -} - -void -bonjour_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer; - - g_return_if_fail(gc != NULL); - g_return_if_fail(who != NULL); - - purple_debug_info("bonjour", "Bonjour-send-file to=%s.\n", who); - - xfer = bonjour_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); - -} - -static void -bonjour_xfer_init(PurpleXfer *xfer) -{ - PurpleBuddy *buddy; - BonjourBuddy *bb; - XepXfer *xf; - - xf = (XepXfer*)xfer->data; - if(xf == NULL) - return; - - purple_debug_info("bonjour", "Bonjour-xfer-init.\n"); - - buddy = purple_find_buddy(xfer->account, xfer->who); - /* this buddy is offline. */ - if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL) - return; - - /* Assume it is the first IP. We could do something like keep track of which one is in use or something. */ - if (bb->ips) - xf->buddy_ip = g_strdup(bb->ips->data); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - /* initiate file transfer, send SI offer. */ - purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_SEND.\n"); - xep_ft_si_offer(xfer, xfer->who); - } else { - /* accept file transfer request, send SI result. */ - xep_ft_si_result(xfer, xfer->who); - purple_debug_info("bonjour", "Bonjour xfer type is PURPLE_XFER_RECEIVE.\n"); - } -} - -void -xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) -{ - const char *type, *id; - BonjourData *bd; - PurpleXfer *xfer; - const gchar *name = NULL; - - g_return_if_fail(pc != NULL); - g_return_if_fail(packet != NULL); - g_return_if_fail(pb != NULL); - - bd = (BonjourData*) pc->proto_data; - if(bd == NULL) - return; - - purple_debug_info("bonjour", "xep-si-parse.\n"); - - name = purple_buddy_get_name(pb); - - type = xmlnode_get_attrib(packet, "type"); - id = xmlnode_get_attrib(packet, "id"); - if(type) { - if(!strcmp(type, "set")) { - const char *profile; - xmlnode *si; - gboolean parsed_receive = FALSE; - - si = xmlnode_get_child(packet, "si"); - - purple_debug_info("bonjour", "si offer Message type - SET.\n"); - if (si && (profile = xmlnode_get_attrib(si, "profile")) - && !strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) { - const char *filename = NULL, *filesize_str = NULL; - int filesize = 0; - xmlnode *file; - - const char *sid = xmlnode_get_attrib(si, "id"); - - if ((file = xmlnode_get_child(si, "file"))) { - filename = xmlnode_get_attrib(file, "name"); - if((filesize_str = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_str); - } - - /* TODO: Make sure that it is advertising a bytestreams transfer */ - - if (filename) { - bonjour_xfer_receive(pc, id, sid, name, filesize, filename, XEP_BYTESTREAMS); - - parsed_receive = TRUE; - } - } - - if (!parsed_receive) { - BonjourData *bd = purple_connection_get_protocol_data(pc); - - purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n"); - xep_ft_si_reject(bd, id, name, "403", "cancel"); - /*TODO: Send Cancel (501) */ - } - } else if(!strcmp(type, "result")) { - purple_debug_info("bonjour", "si offer Message type - RESULT.\n"); - - xfer = bonjour_si_xfer_find(bd, id, name); - - if(xfer == NULL) { - BonjourData *bd = purple_connection_get_protocol_data(pc); - purple_debug_info("bonjour", "xfer find fail.\n"); - xep_ft_si_reject(bd, id, name, "403", "cancel"); - } else - bonjour_bytestreams_init(xfer); - - } else if(!strcmp(type, "error")) { - purple_debug_info("bonjour", "si offer Message type - ERROR.\n"); - - xfer = bonjour_si_xfer_find(bd, id, name); - - if(xfer == NULL) - purple_debug_info("bonjour", "xfer find fail.\n"); - else - purple_xfer_cancel_remote(xfer); - } else - purple_debug_info("bonjour", "si offer Message type - Unknown-%s.\n", type); - } -} - -void -xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb) -{ - const char *type, *from; - xmlnode *query; - BonjourData *bd; - - g_return_if_fail(pc != NULL); - g_return_if_fail(packet != NULL); - g_return_if_fail(pb != NULL); - - bd = (BonjourData*) pc->proto_data; - if(bd == NULL) - return; - - purple_debug_info("bonjour", "xep-bytestreams-parse.\n"); - - type = xmlnode_get_attrib(packet, "type"); - from = purple_buddy_get_name(pb); - query = xmlnode_get_child(packet,"query"); - if(type) { - if(!strcmp(type, "set")) { - const char *iq_id, *sid; - gboolean found = FALSE; - PurpleXfer *xfer; - - purple_debug_info("bonjour", "bytestream offer Message type - SET.\n"); - - iq_id = xmlnode_get_attrib(packet, "id"); - - sid = xmlnode_get_attrib(query, "sid"); - xfer = bonjour_si_xfer_find(bd, sid, from); - - if(xfer) { - const char *jid, *host, *port; - xmlnode *streamhost; - int portnum; - XepXfer *xf = NULL; - - xf = (XepXfer*)xfer->data; - for(streamhost = xmlnode_get_child(query, "streamhost"); - streamhost; - streamhost = xmlnode_get_next_twin(streamhost)) { - - if((jid = xmlnode_get_attrib(streamhost, "jid")) && - (host = xmlnode_get_attrib(streamhost, "host")) && - (port = xmlnode_get_attrib(streamhost, "port")) && - (portnum = atoi(port))) { - - if(!strcmp(host, xf->buddy_ip)) { - g_free(xf->iq_id); - xf->iq_id = g_strdup(iq_id); - xf->jid = g_strdup(jid); - xf->proxy_host = g_strdup(host); - xf->proxy_port = portnum; - purple_debug_info("bonjour", "bytestream offer parse" - "jid=%s host=%s port=%d.\n", jid, host, portnum); - bonjour_bytestreams_connect(xfer, pb); - found = TRUE; - break; - } - } else { - purple_debug_info("bonjour", "bytestream offer Message parse error.\n"); - } - } - } else { - - } - - if (!found) { - purple_debug_error("bonjour", "Didn't find an acceptable streamhost.\n"); - - if (iq_id && xfer != NULL) - xep_ft_si_reject(bd, iq_id, xfer->who, "404", "cancel"); - } - - } else { - purple_debug_info("bonjour", "bytestream offer Message type - Unknown-%s.\n", type); - } - } -} - -static void -bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from, - const int filesize, const char *filename, int option) -{ - PurpleXfer *xfer; - XepXfer *xf; - BonjourData *bd; - - if(pc == NULL || id == NULL || from == NULL) - return; - - bd = (BonjourData*) pc->proto_data; - if(bd == NULL) - return; - - purple_debug_info("bonjour", "bonjour-xfer-receive.\n"); - - /* Build the file transfer handle */ - xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from); - xfer->data = xf = g_new0(XepXfer, 1); - xf->data = bd; - purple_xfer_set_filename(xfer, filename); - xf->iq_id = g_strdup(id); - xf->sid = g_strdup(sid); - - if(filesize > 0) - purple_xfer_set_size(xfer, filesize); - purple_xfer_set_init_fnc(xfer, bonjour_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, bonjour_xfer_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer, bonjour_xfer_cancel_recv); - purple_xfer_set_end_fnc(xfer, bonjour_xfer_end); - - bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer); - - purple_xfer_request(xfer); -} - -static void -bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; - int acceptfd; - int len = 0; - - if(xf == NULL) - return; - - purple_debug_info("bonjour", "bonjour_sock5_request_cb - req_state = 0x%x\n", xf->sock5_req_state); - - switch(xf->sock5_req_state){ - case 0x00: - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { - - } else if(acceptfd == -1) { - /* This should cancel the ft */ - purple_debug_error("bonjour", "Error accepting incoming SOCKS5 connection. (%d)\n", errno); - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - int flags; - - purple_debug_info("bonjour", "Accepted SOCKS5 ft connection - fd=%d\n", acceptfd); - - flags = fcntl(acceptfd, F_GETFL); - fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(acceptfd, F_SETFD, FD_CLOEXEC); -#endif - - purple_input_remove(xfer->watcher); - close(source); - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - } - break; - case 0x01: - xfer->fd = source; - len = read(source, xf->rx_buf + xf->rxlen, 3); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0){ - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); - } - break; - case 0x02: - xf->tx_buf[0] = 0x05; - xf->tx_buf[1] = 0x00; - len = write(source, xf->tx_buf, 2); - if (len < 0 && errno == EAGAIN) - return; - else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - } - break; - case 0x03: - len = read(source, xf->rx_buf + xf->rxlen, 20); - if(len<=0){ - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - bonjour_sock5_request_cb, xfer); - xf->sock5_req_state++; - xf->rxlen = 0; - bonjour_sock5_request_cb(xfer, source, PURPLE_INPUT_WRITE); - } - break; - case 0x04: - xf->tx_buf[0] = 0x05; - xf->tx_buf[1] = 0x00; - xf->tx_buf[2] = 0x00; - xf->tx_buf[3] = 0x03; - xf->tx_buf[4] = strlen(xf->buddy_ip); - memcpy(xf->tx_buf + 5, xf->buddy_ip, strlen(xf->buddy_ip)); - xf->tx_buf[5+strlen(xf->buddy_ip)] = 0x00; - xf->tx_buf[6+strlen(xf->buddy_ip)] = 0x00; - len = write(source, xf->tx_buf, 7 + strlen(xf->buddy_ip)); - if (len < 0 && errno == EAGAIN) { - return; - } else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - xf->rxlen = 0; - /*close(source);*/ - purple_xfer_start(xfer, source, NULL, -1); - } - break; - default: - break; - } - return; -} - -static void -bonjour_bytestreams_listen(int sock, gpointer data) -{ - PurpleXfer *xfer = data; - XepXfer *xf; - XepIq *iq; - xmlnode *query, *streamhost; - gchar *port; - const char *next_ip, *local_ip; - const char token [] = ";"; - BonjourData *bd; - - purple_debug_info("bonjour", "Bonjour-bytestreams-listen. sock=%d.\n", sock); - if (sock < 0 || xfer == NULL) { - /*purple_xfer_cancel_local(xfer);*/ - return; - } - - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - bonjour_sock5_request_cb, xfer); - xf = (XepXfer*)xfer->data; - xf->listen_data = NULL; - - bd = xf->data; - - iq = xep_iq_new(bd, XEP_IQ_SET, xfer->who, purple_account_get_username(bd->jabber_data->account), xf->sid); - - query = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(query, "http://jabber.org/protocol/bytestreams"); - xmlnode_set_attrib(query, "sid", xf->sid); - xmlnode_set_attrib(query, "mode", "tcp"); - - xfer->local_port = purple_network_get_port_from_fd(sock); - - local_ip = purple_network_get_my_ip_ext2(sock); - /* cheat a little here - the intent of the "const" attribute is to make it clear that the string doesn't need to be freed */ - next_ip = strtok((char *)local_ip, token); - - port = g_strdup_printf("%hu", xfer->local_port); - while(next_ip != NULL) { - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", xf->sid); - xmlnode_set_attrib(streamhost, "host", next_ip); - xmlnode_set_attrib(streamhost, "port", port); - next_ip = strtok(NULL, token); - } - g_free(port); - - xep_iq_send_and_free(iq); -} - -static void -bonjour_bytestreams_init(PurpleXfer *xfer) -{ - XepXfer *xf; - if(xfer == NULL) - return; - purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n"); - xf = xfer->data; - purple_network_listen_map_external(FALSE); - xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, - bonjour_bytestreams_listen, xfer); - purple_network_listen_map_external(TRUE); - if (xf->listen_data == NULL) { - purple_xfer_cancel_local(xfer); - } - return; -} - -static void -bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer = data; - XepXfer *xf = xfer->data; - XepIq *iq; - xmlnode *q_node, *tmp_node; - BonjourData *bd; - - xf->proxy_connection = NULL; - - if(source < 0) { - purple_debug_error("bonjour", "Error connecting via SOCKS5 - %s\n", - error_message ? error_message : "(null)"); - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); - /* Cancel the connection */ - purple_xfer_cancel_local(xfer); - return; - } - - purple_debug_info("bonjour", "Connected successfully via SOCKS5, starting transfer.\n"); - - bd = xf->data; - - /* Here, start the file transfer.*/ - - /* Notify Initiator of Connection */ - iq = xep_iq_new(bd, XEP_IQ_RESULT, xfer->who, purple_account_get_username(bd->jabber_data->account), xf->iq_id); - q_node = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(q_node, "http://jabber.org/protocol/bytestreams"); - tmp_node = xmlnode_new_child(q_node, "streamhost-used"); - xmlnode_set_attrib(tmp_node, "jid", xf->jid); - xep_iq_send_and_free(iq); - - purple_xfer_start(xfer, source, NULL, -1); -} - -static void -bonjour_bytestreams_connect(PurpleXfer *xfer, PurpleBuddy *pb) -{ - PurpleAccount *account = NULL; - XepXfer *xf; - char dstaddr[41]; - const gchar *name = NULL; - unsigned char hashval[20]; - char *p; - int i; - - if(xfer == NULL) - return; - - purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n"); - - xf = (XepXfer*)xfer->data; - if(!xf) - return; - - name = purple_buddy_get_name(pb); - account = purple_buddy_get_account(pb); - - p = g_strdup_printf("%s%s%s", xf->sid, name, purple_account_get_username(account)); - purple_cipher_digest_region("sha1", (guchar *)p, strlen(p), - sizeof(hashval), hashval, NULL); - g_free(p); - - memset(dstaddr, 0, 41); - p = dstaddr; - for(i = 0; i < 20; i++, p += 2) - snprintf(p, 3, "%02x", hashval[i]); - - xf->proxy_info = purple_proxy_info_new(); - purple_proxy_info_set_type(xf->proxy_info, PURPLE_PROXY_SOCKS5); - purple_proxy_info_set_host(xf->proxy_info, xf->proxy_host); - purple_proxy_info_set_port(xf->proxy_info, xf->proxy_port); - xf->proxy_connection = purple_proxy_connect_socks5( - purple_account_get_connection(account), - xf->proxy_info, - dstaddr, 0, - bonjour_bytestreams_connect_cb, xfer); - - if(xf->proxy_connection == NULL) { - xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel"); - /* Cancel the connection */ - purple_xfer_cancel_local(xfer); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour_ft.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef _BONJOUR_FT_H_ -#define _BONJOUR_FT_H_ -#include "network.h" -#include "proxy.h" -typedef struct _XepXfer XepXfer; -typedef enum { - XEP_BYTESTREAMS = 1, - XEP_IBB = 2, - XEP_UNKNOWN = 4 -} XepSiMode; - -struct _XepXfer -{ - void *data; - char *filename; - int filesize; - char *iq_id; - char *sid; - char *recv_id; - char *buddy_ip; - int mode; - PurpleNetworkListenData *listen_data; - int sock5_req_state; - int rxlen; - char rx_buf[0x500]; - char tx_buf[0x500]; - PurpleProxyInfo *proxy_info; - PurpleProxyConnectData *proxy_connection; - char *jid; - char *proxy_host; - int proxy_port; -}; - -/** - * Create a new PurpleXfer - * - * @param gc The PurpleConnection handle. - * @param who Who will we be sending it to? - */ -PurpleXfer *bonjour_new_xfer(PurpleConnection *gc, const char *who); - -/** - * Send a file. - * - * @param gc The PurpleConnection handle. - * @param who Who are we sending it to? - * @param file What file? If NULL, user will choose after this call. - */ -void bonjour_send_file(PurpleConnection *gc, const char *who, const char *file); - -void xep_si_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb); -void -xep_bytestreams_parse(PurpleConnection *pc, xmlnode *packet, PurpleBuddy *pb); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/bonjour.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file bonjour.h The Purple interface to mDNS and peer to peer Jabber. - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _BONJOUR_H_ -#define _BONJOUR_H_ - -#include "mdns_common.h" -#include "internal.h" -#include "jabber.h" - -#define BONJOUR_GROUP_NAME _("Bonjour") -#define BONJOUR_PROTOCOL_NAME "bonjour" -#define BONJOUR_ICON_NAME "bonjour" - -#define BONJOUR_STATUS_ID_OFFLINE "offline" -#define BONJOUR_STATUS_ID_AVAILABLE "available" -#define BONJOUR_STATUS_ID_AWAY "away" - -#define BONJOUR_DEFAULT_PORT 5298 - -typedef struct _BonjourData -{ - BonjourDnsSd *dns_sd_data; - BonjourJabber *jabber_data; - GSList *xfer_lists; -} BonjourData; - -#endif /* _BONJOUR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,283 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include -#include - -#include "internal.h" -#include "buddy.h" -#include "account.h" -#include "blist.h" -#include "bonjour.h" -#include "mdns_interface.h" -#include "debug.h" - -/** - * Creates a new buddy. - */ -BonjourBuddy * -bonjour_buddy_new(const gchar *name, PurpleAccount* account) -{ - BonjourBuddy *buddy = g_new0(BonjourBuddy, 1); - - buddy->account = account; - buddy->name = g_strdup(name); - - _mdns_init_buddy(buddy); - - return buddy; -} - -#define _B_CLR(x) g_free(x); x = NULL; - -void clear_bonjour_buddy_values(BonjourBuddy *buddy) { - - _B_CLR(buddy->first) - _B_CLR(buddy->email); - _B_CLR(buddy->ext); - _B_CLR(buddy->jid); - _B_CLR(buddy->last); - _B_CLR(buddy->msg); - _B_CLR(buddy->nick); - _B_CLR(buddy->node); - _B_CLR(buddy->phsh); - _B_CLR(buddy->status); - _B_CLR(buddy->vc); - _B_CLR(buddy->ver); - _B_CLR(buddy->AIM); - -} - -void -set_bonjour_buddy_value(BonjourBuddy* buddy, const char *record_key, const char *value, guint32 len){ - gchar **fld = NULL; - - g_return_if_fail(record_key != NULL); - - if (!strcmp(record_key, "1st")) - fld = &buddy->first; - else if(!strcmp(record_key, "email")) - fld = &buddy->email; - else if(!strcmp(record_key, "ext")) - fld = &buddy->ext; - else if(!strcmp(record_key, "jid")) - fld = &buddy->jid; - else if(!strcmp(record_key, "last")) - fld = &buddy->last; - else if(!strcmp(record_key, "msg")) - fld = &buddy->msg; - else if(!strcmp(record_key, "nick")) - fld = &buddy->nick; - else if(!strcmp(record_key, "node")) - fld = &buddy->node; - else if(!strcmp(record_key, "phsh")) - fld = &buddy->phsh; - else if(!strcmp(record_key, "status")) - fld = &buddy->status; - else if(!strcmp(record_key, "vc")) - fld = &buddy->vc; - else if(!strcmp(record_key, "ver")) - fld = &buddy->ver; - else if(!strcmp(record_key, "AIM")) - fld = &buddy->AIM; - - if(fld == NULL) - return; - - g_free(*fld); - *fld = NULL; - *fld = g_strndup(value, len); -} - -/** - * Check if all the compulsory buddy data is present. - */ -gboolean -bonjour_buddy_check(BonjourBuddy *buddy) -{ - if (buddy->account == NULL) - return FALSE; - - if (buddy->name == NULL) - return FALSE; - - return TRUE; -} - -/** - * If the buddy does not yet exist, then create it and add it to - * our buddy list. In either case we set the correct status for - * the buddy. - */ -void -bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy, PurpleBuddy *buddy) -{ - PurpleGroup *group; - PurpleAccount *account = bonjour_buddy->account; - const char *status_id, *old_hash, *new_hash, *name; - - /* Translate between the Bonjour status and the Purple status */ - if (bonjour_buddy->status != NULL && g_ascii_strcasecmp("dnd", bonjour_buddy->status) == 0) - status_id = BONJOUR_STATUS_ID_AWAY; - else - status_id = BONJOUR_STATUS_ID_AVAILABLE; - - /* - * TODO: Figure out the idle time by getting the "away" - * field from the DNS SD. - */ - - /* Make sure the Bonjour group exists in our buddy list */ - group = purple_find_group(BONJOUR_GROUP_NAME); /* Use the buddy's domain, instead? */ - if (group == NULL) { - group = purple_group_new(BONJOUR_GROUP_NAME); - purple_blist_add_group(group, NULL); - } - - /* Make sure the buddy exists in our buddy list */ - if (buddy == NULL) - buddy = purple_find_buddy(account, bonjour_buddy->name); - - if (buddy == NULL) { - buddy = purple_buddy_new(account, bonjour_buddy->name, NULL); - purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); - purple_blist_add_buddy(buddy, NULL, group, NULL); - } - - name = purple_buddy_get_name(buddy); - purple_buddy_set_protocol_data(buddy, bonjour_buddy); - - /* Create the alias for the buddy using the first and the last name */ - if (bonjour_buddy->nick && *bonjour_buddy->nick) - serv_got_alias(purple_account_get_connection(account), name, bonjour_buddy->nick); - else { - gchar *alias = NULL; - const char *first, *last; - first = bonjour_buddy->first; - last = bonjour_buddy->last; - if ((first && *first) || (last && *last)) - alias = g_strdup_printf("%s%s%s", - (first && *first ? first : ""), - (first && *first && last && *last ? " " : ""), - (last && *last ? last : "")); - serv_got_alias(purple_account_get_connection(account), name, alias); - g_free(alias); - } - - /* Set the user's status */ - if (bonjour_buddy->msg != NULL) - purple_prpl_got_user_status(account, name, status_id, - "message", bonjour_buddy->msg, NULL); - else - purple_prpl_got_user_status(account, name, status_id, NULL); - - purple_prpl_got_user_idle(account, name, FALSE, 0); - - /* TODO: Because we don't save Bonjour buddies in blist.xml, - * we will always have to look up the buddy icon at login time. - * I think we should figure out a way to do something about this. */ - - /* Deal with the buddy icon */ - old_hash = purple_buddy_icons_get_checksum_for_user(buddy); - new_hash = (bonjour_buddy->phsh && *(bonjour_buddy->phsh)) ? bonjour_buddy->phsh : NULL; - if (new_hash && (!old_hash || strcmp(old_hash, new_hash) != 0)) { - /* Look up the new icon data */ - /* TODO: Make sure the hash assigned to the retrieved buddy icon is the same - * as what we looked up. */ - bonjour_dns_sd_retrieve_buddy_icon(bonjour_buddy); - } else if (!new_hash) - purple_buddy_icons_set_for_user(account, name, NULL, 0, NULL); -} - -/** - * The buddy has signed off Bonjour. - * If the buddy is being saved, mark as offline, otherwise delete - */ -void bonjour_buddy_signed_off(PurpleBuddy *pb) { - if (PURPLE_BLIST_NODE_SHOULD_SAVE(pb)) { - purple_prpl_got_user_status(purple_buddy_get_account(pb), - purple_buddy_get_name(pb), "offline", NULL); - bonjour_buddy_delete(purple_buddy_get_protocol_data(pb)); - purple_buddy_set_protocol_data(pb, NULL); - } else { - purple_account_remove_buddy(purple_buddy_get_account(pb), pb, NULL); - purple_blist_remove_buddy(pb); - } -} - -/** - * We got the buddy icon data; deal with it - */ -void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len) { - /* Recalculate the hash instead of using the current phsh to make sure it is accurate for the icon. */ - char *p, *hash; - - if (data == NULL || len == 0) - return; - - /* Take advantage of the fact that we use a SHA-1 hash of the data as the filename. */ - hash = purple_util_get_image_filename(data, len); - - /* Get rid of the extension */ - if (!(p = strchr(hash, '.'))) { - g_free(hash); - return; - } - - *p = '\0'; - - purple_debug_info("bonjour", "Got buddy icon for %s icon hash='%s' phsh='%s'.\n", buddy->name, - hash, buddy->phsh ? buddy->phsh : "(null)"); - - purple_buddy_icons_set_for_user(buddy->account, buddy->name, - g_memdup(data, len), len, hash); - - g_free(hash); -} - -/** - * Deletes a buddy from memory. - */ -void -bonjour_buddy_delete(BonjourBuddy *buddy) -{ - g_free(buddy->name); - while (buddy->ips != NULL) { - g_free(buddy->ips->data); - buddy->ips = g_slist_delete_link(buddy->ips, buddy->ips); - } - g_free(buddy->first); - g_free(buddy->phsh); - g_free(buddy->status); - g_free(buddy->email); - g_free(buddy->last); - g_free(buddy->jid); - g_free(buddy->AIM); - g_free(buddy->vc); - g_free(buddy->msg); - g_free(buddy->ext); - g_free(buddy->nick); - g_free(buddy->node); - g_free(buddy->ver); - - bonjour_jabber_close_conversation(buddy->conversation); - buddy->conversation = NULL; - - /* Clean up any mdns implementation data */ - _mdns_delete_buddy(buddy); - - g_free(buddy); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/buddy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_BUDDY -#define _BONJOUR_BUDDY - -#include - -#include "account.h" -#include "jabber.h" - -typedef struct _BonjourBuddy -{ - PurpleAccount *account; - - gchar *name; - GSList *ips; - gint port_p2pj; - - gchar *first; - gchar *phsh; - gchar *status; - gchar *email; - gchar *last; - gchar *jid; - gchar *AIM; - gchar *vc; - gchar *msg; - gchar *ext; - gchar *nick; - gchar *node; - gchar *ver; - - BonjourJabberConversation *conversation; - - gpointer mdns_impl_data; -} BonjourBuddy; - -static const char *const buddy_TXT_records[] = { - "1st", - "email", - "ext", - "jid", - "last", - "msg", - "nick", - "node", - "phsh", -/* "port.p2pj", Deprecated - MUST ignore */ - "status", -/* "txtvers", Deprecated - hardcoded to 1 */ - "vc", - "ver", - "AIM", /* non standard */ - NULL -}; - -/** - * Creates a new buddy. - */ -BonjourBuddy *bonjour_buddy_new(const gchar *name, PurpleAccount *account); - -/** - * Clear any existing values from the buddy. - * This is called before updating so that we can notice removals - */ -void clear_bonjour_buddy_values(BonjourBuddy *buddy); - -/** - * Sets a value in the BonjourBuddy struct, destroying the old value - */ -void set_bonjour_buddy_value(BonjourBuddy *buddy, const char *record_key, const char *value, guint32 len); - -/** - * Check if all the compulsory buddy data is present. - */ -gboolean bonjour_buddy_check(BonjourBuddy *buddy); - -/** - * If the buddy doesn't previously exists, it is created. Else, its data is changed (???) - * purple_buddy is optional; it saves an additional lookup if we already have it - */ -void bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy, PurpleBuddy *purple_buddy); - -/** - * The buddy has signed off Bonjour. - * If the buddy is being saved, mark as offline, otherwise delete - */ -void bonjour_buddy_signed_off(PurpleBuddy *purple_buddy); - -/** - * We got the buddy icon data; deal with it - */ -void bonjour_buddy_got_buddy_icon(BonjourBuddy *buddy, gconstpointer data, gsize len); - -/** - * Deletes a buddy from memory. - */ -void bonjour_buddy_delete(BonjourBuddy *buddy); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -/* - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include "win32dep.h" -#include "dns_sd_proxy.h" - -#ifndef LINK_DNS_SD_DIRECTLY -static DNSServiceErrorType (DNSSD_API* _DNSServiceAddRecord)(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags, - uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl); -static DNSServiceErrorType (DNSSD_API* _DNSServiceBrowse)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *regtype, const char *domain, DNSServiceBrowseReply callBack, void *context); -static int (DNSSD_API* _DNSServiceConstructFullName)(char *fullName, const char *service, const char *regtype, const char *domain); -static DNSServiceErrorType (DNSSD_API* _DNSServiceProcessResult)(DNSServiceRef sdRef); -static DNSServiceErrorType (DNSSD_API* _DNSServiceQueryRecord)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context); -static void (DNSSD_API* _DNSServiceRefDeallocate)(DNSServiceRef sdRef); -static int (DNSSD_API* _DNSServiceRefSockFD)(DNSServiceRef sdRef); -static DNSServiceErrorType (DNSSD_API* _DNSServiceRegister)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *name, const char *regtype, const char *domain, const char *host, uint16_t port, uint16_t txtLen, - const void *txtRecord, DNSServiceRegisterReply callBack, void *context); -static DNSServiceErrorType (DNSSD_API* _DNSServiceResolve)(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, - const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context); -static DNSServiceErrorType (DNSSD_API* _DNSServiceRemoveRecord)(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags); -static DNSServiceErrorType (DNSSD_API* _DNSServiceUpdateRecord)(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, - uint16_t rdlen, const void *rdata, uint32_t ttl); -static void (DNSSD_API* _TXTRecordCreate)(TXTRecordRef *txtRecord, uint16_t bufferLen, void *buffer); -static void (DNSSD_API* _TXTRecordDeallocate)(TXTRecordRef *txtRecord); -static const void * (DNSSD_API* _TXTRecordGetBytesPtr)(const TXTRecordRef *txtRecord); -static int16_t (DNSSD_API* _TXTRecordGetLength)(const TXTRecordRef *txtRecord); -static const void * (DNSSD_API* _TXTRecordGetValuePtr)(uint16_t txtLen, const void *txtRecord, const char *key, uint8_t *valueLen); -static DNSServiceErrorType (DNSSD_API* _TXTRecordSetValue)(TXTRecordRef *txtRecord, const char *key, uint8_t valueSize, const void *value); -#endif - -gboolean dns_sd_available(void) { -#ifndef LINK_DNS_SD_DIRECTLY - static gboolean initialized = FALSE; - static gboolean loaded = FALSE; - - if (!initialized) { - initialized = TRUE; - if ((_DNSServiceAddRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceAddRecord")) - && (_DNSServiceBrowse = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceBrowse")) - && (_DNSServiceConstructFullName = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceConstructFullName")) - && (_DNSServiceProcessResult = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceProcessResult")) - && (_DNSServiceQueryRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceQueryRecord")) - && (_DNSServiceRefDeallocate = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRefDeallocate")) - && (_DNSServiceRefSockFD = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRefSockFD")) - && (_DNSServiceRegister = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRegister")) - && (_DNSServiceResolve = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceResolve")) - && (_DNSServiceRemoveRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceRemoveRecord")) - && (_DNSServiceUpdateRecord = (void *) wpurple_find_and_loadproc("dnssd.dll", "DNSServiceUpdateRecord")) - && (_TXTRecordCreate = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordCreate")) - && (_TXTRecordDeallocate = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordDeallocate")) - && (_TXTRecordGetBytesPtr = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordGetBytesPtr")) - && (_TXTRecordGetLength = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordGetLength")) - && (_TXTRecordGetValuePtr = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordGetValuePtr")) - && (_TXTRecordSetValue = (void *) wpurple_find_and_loadproc("dnssd.dll", "TXTRecordSetValue"))) { - loaded = TRUE; - } - } - return loaded; -#else - return TRUE; -#endif -} - -#ifndef LINK_DNS_SD_DIRECTLY - -DNSServiceErrorType _wpurple_DNSServiceAddRecord(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags, - uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl) { - g_return_val_if_fail(_DNSServiceAddRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceAddRecord)(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl); -} - -DNSServiceErrorType _wpurple_DNSServiceBrowse(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *regtype, const char *domain, DNSServiceBrowseReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceBrowse != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceBrowse)(sdRef, flags, interfaceIndex, regtype, domain, callBack, context); -} - -int _wpurple_DNSServiceConstructFullName(char *fullName, const char *service, const char *regtype, const char *domain) { - g_return_val_if_fail(_DNSServiceConstructFullName != NULL, 0); - return (_DNSServiceConstructFullName)(fullName, service, regtype, domain); -} - -DNSServiceErrorType _wpurple_DNSServiceProcessResult(DNSServiceRef sdRef) { - g_return_val_if_fail(_DNSServiceProcessResult != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceProcessResult)(sdRef); -} - - -DNSServiceErrorType _wpurple_DNSServiceQueryRecord(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceQueryRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceQueryRecord)(sdRef, flags, interfaceIndex, fullname, rrtype, rrclass, callBack, context); -} - -void _wpurple_DNSServiceRefDeallocate(DNSServiceRef sdRef) { - g_return_if_fail(_DNSServiceRefDeallocate != NULL); - (_DNSServiceRefDeallocate)(sdRef); -} - -int _wpurple_DNSServiceRefSockFD(DNSServiceRef sdRef) { - g_return_val_if_fail(_DNSServiceRefSockFD != NULL, -1); - return (_DNSServiceRefSockFD)(sdRef); -} - -DNSServiceErrorType _wpurple_DNSServiceRegister(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *name, const char *regtype, const char *domain, const char *host, uint16_t port, uint16_t txtLen, - const void *txtRecord, DNSServiceRegisterReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceRegister != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceRegister)(sdRef, flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, callBack, context); -} - -DNSServiceErrorType _wpurple_DNSServiceResolve(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, - const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context) { - g_return_val_if_fail(_DNSServiceResolve != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceResolve)(sdRef, flags, interfaceIndex, name, regtype, domain, callBack, context); -} - -DNSServiceErrorType _wpurple_DNSServiceRemoveRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags) { - g_return_val_if_fail(_DNSServiceRemoveRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceRemoveRecord)(sdRef, RecordRef, flags); -} - -DNSServiceErrorType _wpurple_DNSServiceUpdateRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, - uint16_t rdlen, const void *rdata, uint32_t ttl) { - g_return_val_if_fail(_DNSServiceUpdateRecord != NULL, kDNSServiceErr_Unknown); - return (_DNSServiceUpdateRecord)(sdRef, RecordRef, flags, rdlen, rdata, ttl); -} - -void _wpurple_TXTRecordCreate(TXTRecordRef *txtRecord, uint16_t bufferLen, void *buffer) { - g_return_if_fail(_TXTRecordCreate != NULL); - (_TXTRecordCreate)(txtRecord, bufferLen, buffer); -} - -void _wpurple_TXTRecordDeallocate(TXTRecordRef *txtRecord) { - g_return_if_fail(_TXTRecordDeallocate != NULL); - (_TXTRecordDeallocate)(txtRecord); -} - -const void * _wpurple_TXTRecordGetBytesPtr(const TXTRecordRef *txtRecord) { - g_return_val_if_fail(_TXTRecordGetBytesPtr != NULL, NULL); - return (_TXTRecordGetBytesPtr)(txtRecord); -} - -uint16_t _wpurple_TXTRecordGetLength(const TXTRecordRef *txtRecord) { - g_return_val_if_fail(_TXTRecordGetLength != NULL, 0); - return (_TXTRecordGetLength)(txtRecord); -} - -const void * _wpurple_TXTRecordGetValuePtr(uint16_t txtLen, const void *txtRecord, const char *key, uint8_t *valueLen) { - g_return_val_if_fail(_TXTRecordGetValuePtr != NULL, NULL); - return (_TXTRecordGetValuePtr)(txtLen, txtRecord, key, valueLen); -} - -DNSServiceErrorType _wpurple_TXTRecordSetValue(TXTRecordRef *txtRecord, const char *key, uint8_t valueSize, const void *value) { - g_return_val_if_fail(_TXTRecordSetValue != NULL, kDNSServiceErr_Unknown); - return (_TXTRecordSetValue)(txtRecord, key, valueSize, value); -} - -#endif /*LINK_DNS_SD_DIRECTLY*/ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/dns_sd_proxy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ -#ifndef _DNS_SD_PROXY -#define _DNS_SD_PROXY - - -#ifndef _MSC_VER -#include -#endif - -/* fixup to make pidgin compile against win32 bonjour */ -#if defined(_WIN32) && !defined(_MSC_VER) -#define _MSL_STDINT_H -#endif - -#include - -gboolean dns_sd_available(void); - -#ifndef LINK_DNS_SD_DIRECTLY - -DNSServiceErrorType _wpurple_DNSServiceAddRecord(DNSServiceRef sdRef, DNSRecordRef *RecordRef, DNSServiceFlags flags, - uint16_t rrtype, uint16_t rdlen, const void *rdata, uint32_t ttl); -#define DNSServiceAddRecord(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl) \ - _wpurple_DNSServiceAddRecord(sdRef, RecordRef, flags, rrtype, rdlen, rdata, ttl) - -DNSServiceErrorType _wpurple_DNSServiceBrowse(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *regtype, const char *domain, DNSServiceBrowseReply callBack, void *context); -#define DNSServiceBrowse(sdRef, flags, interfaceIndex, regtype, domain, callBack, context) \ - _wpurple_DNSServiceBrowse(sdRef, flags, interfaceIndex, regtype, domain, callBack, context) - -int _wpurple_DNSServiceConstructFullName(char *fullName, const char *service, const char *regtype, const char *domain); -#define DNSServiceConstructFullName(fullName, service, regtype, domain) \ - _wpurple_DNSServiceConstructFullName(fullName, service, regtype, domain) - -DNSServiceErrorType _wpurple_DNSServiceProcessResult(DNSServiceRef sdRef); -#define DNSServiceProcessResult(sdRef) \ - _wpurple_DNSServiceProcessResult(sdRef); - -DNSServiceErrorType _wpurple_DNSServiceQueryRecord(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *fullname, uint16_t rrtype, uint16_t rrclass, DNSServiceQueryRecordReply callBack, void *context); -#define DNSServiceQueryRecord(sdRef, flags, interfaceIndex, fullname, rrtype, rrclass, callBack, context) \ - _wpurple_DNSServiceQueryRecord(sdRef, flags, interfaceIndex, fullname, rrtype, rrclass, callBack, context) - -void _wpurple_DNSServiceRefDeallocate(DNSServiceRef sdRef); -#define DNSServiceRefDeallocate(sdRef) \ - _wpurple_DNSServiceRefDeallocate(sdRef) - -int _wpurple_DNSServiceRefSockFD(DNSServiceRef sdRef); -#define DNSServiceRefSockFD(sdRef) \ - _wpurple_DNSServiceRefSockFD(sdRef) - -DNSServiceErrorType _wpurple_DNSServiceRegister(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - const char *name, const char *regtype, const char *domain, const char *host, uint16_t port, uint16_t txtLen, - const void *txtRecord, DNSServiceRegisterReply callBack, void *context); -#define DNSServiceRegister(sdRef, flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, callBack, context) \ - _wpurple_DNSServiceRegister(sdRef, flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, callBack, context) - -DNSServiceErrorType _wpurple_DNSServiceResolve(DNSServiceRef *sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, const char *name, - const char *regtype, const char *domain, DNSServiceResolveReply callBack, void *context); -#define DNSServiceResolve(sdRef, flags, interfaceIndex, name, regtype, domain, callBack, context) \ - _wpurple_DNSServiceResolve(sdRef, flags, interfaceIndex, name, regtype, domain, callBack, context) - -DNSServiceErrorType _wpurple_DNSServiceRemoveRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags); -#define DNSServiceRemoveRecord(sdRef, RecordRef, flags) \ - _wpurple_DNSServiceRemoveRecord(sdRef, RecordRef, flags) - -DNSServiceErrorType _wpurple_DNSServiceUpdateRecord(DNSServiceRef sdRef, DNSRecordRef RecordRef, DNSServiceFlags flags, - uint16_t rdlen, const void *rdata, uint32_t ttl); -#define DNSServiceUpdateRecord(sdRef, RecordRef, flags, rdlen, rdata, ttl) \ - _wpurple_DNSServiceUpdateRecord(sdRef, RecordRef, flags, rdlen, rdata, ttl) - -void _wpurple_TXTRecordCreate(TXTRecordRef *txtRecord, uint16_t bufferLen, void *buffer); -#define TXTRecordCreate(txtRecord, bufferLen, buffer) \ - _wpurple_TXTRecordCreate(txtRecord, bufferLen, buffer) - -void _wpurple_TXTRecordDeallocate(TXTRecordRef *txtRecord); -#define TXTRecordDeallocate(txtRecord) \ - _wpurple_TXTRecordDeallocate(txtRecord) - -const void * _wpurple_TXTRecordGetBytesPtr(const TXTRecordRef *txtRecord); -#define TXTRecordGetBytesPtr(txtRecord) \ - _wpurple_TXTRecordGetBytesPtr(txtRecord) - -uint16_t _wpurple_TXTRecordGetLength(const TXTRecordRef *txtRecord); -#define TXTRecordGetLength(txtRecord) \ - _wpurple_TXTRecordGetLength(txtRecord) - -const void * _wpurple_TXTRecordGetValuePtr(uint16_t txtLen, const void *txtRecord, const char *key, uint8_t *valueLen); -#define TXTRecordGetValuePtr(txtLen, txtRecord, key, valueLen) \ - _wpurple_TXTRecordGetValuePtr(txtLen, txtRecord, key, valueLen) - -DNSServiceErrorType _wpurple_TXTRecordSetValue(TXTRecordRef *txtRecord, const char *key, uint8_t valueSize, const void *value); -#define TXTRecordSetValue(txtRecord, key, valueSize, value) \ - _wpurple_TXTRecordSetValue(txtRecord, key, valueSize, value) - -#endif /*LINK_DNS_SD_DIRECTLY*/ - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1291 +0,0 @@ -/* - * purple - Bonjour Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#else -#include "libc_interface.h" -#endif -#include - -/* Solaris */ -#if defined (__SVR4) && defined (__sun) -#include -#endif - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -#include "network.h" -#include "eventloop.h" -#include "connection.h" -#include "blist.h" -#include "xmlnode.h" -#include "debug.h" -#include "notify.h" -#include "util.h" - -#include "jabber.h" -#include "parser.h" -#include "bonjour.h" -#include "buddy.h" -#include "bonjour_ft.h" - -#ifdef _SIZEOF_ADDR_IFREQ -# define HX_SIZE_OF_IFREQ(a) _SIZEOF_ADDR_IFREQ(a) -#else -# define HX_SIZE_OF_IFREQ(a) sizeof(a) -#endif - -#define STREAM_END "
" -/* TODO: specify version='1.0' and send stream features */ -#define DOCTYPE "\n" \ - "" - -enum sent_stream_start_types { - NOT_SENT = 0, - PARTIALLY_SENT = 1, - FULLY_SENT = 2 -}; - -static void -xep_iq_parse(xmlnode *packet, PurpleBuddy *pb); - -static BonjourJabberConversation * -bonjour_jabber_conv_new(PurpleBuddy *pb, PurpleAccount *account, const char *ip) { - - BonjourJabberConversation *bconv = g_new0(BonjourJabberConversation, 1); - bconv->socket = -1; - bconv->tx_buf = purple_circ_buffer_new(512); - bconv->tx_handler = 0; - bconv->rx_handler = 0; - bconv->pb = pb; - bconv->account = account; - bconv->ip = g_strdup(ip); - - bonjour_parser_setup(bconv); - - return bconv; -} - -static const char * -_font_size_ichat_to_purple(int size) -{ - if (size > 24) { - return "7"; - } else if (size >= 21) { - return "6"; - } else if (size >= 17) { - return "5"; - } else if (size >= 14) { - return "4"; - } else if (size >= 12) { - return "3"; - } else if (size >= 10) { - return "2"; - } - - return "1"; -} - -static gchar * -get_xmlnode_contents(xmlnode *node) -{ - gchar *contents; - - contents = xmlnode_to_str(node, NULL); - - /* we just want the stuff inside - * There isn't stuff exposed in xmlnode.c to do this more cleanly. */ - - if (contents) { - char *bodystart = strchr(contents, '>'); - char *bodyend = bodystart ? strrchr(bodystart, '<') : NULL; - if (bodystart && bodyend && (bodystart + 1) != bodyend) { - *bodyend = '\0'; - memmove(contents, bodystart + 1, (bodyend - bodystart)); - } - } - - return contents; -} - -static void -_jabber_parse_and_write_message_to_ui(xmlnode *message_node, PurpleBuddy *pb) -{ - xmlnode *body_node, *html_node, *events_node; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(pb)); - gchar *body = NULL; - gboolean composing_event = FALSE; - - body_node = xmlnode_get_child(message_node, "body"); - html_node = xmlnode_get_child(message_node, "html"); - - if (body_node == NULL && html_node == NULL) { - purple_debug_error("bonjour", "No body or html node found, discarding message.\n"); - return; - } - - events_node = xmlnode_get_child_with_namespace(message_node, "x", "jabber:x:event"); - if (events_node != NULL) { - if (xmlnode_get_child(events_node, "composing") != NULL) - composing_event = TRUE; - if (xmlnode_get_child(events_node, "id") != NULL) { - /* The user is just typing */ - /* TODO: Deal with typing notification */ - return; - } - } - - if (html_node != NULL) { - xmlnode *html_body_node; - - html_body_node = xmlnode_get_child(html_node, "body"); - if (html_body_node != NULL) { - xmlnode *html_body_font_node; - - html_body_font_node = xmlnode_get_child(html_body_node, "font"); - /* Types of messages sent by iChat */ - if (html_body_font_node != NULL) { - gchar *html_body; - const char *font_face, *font_size, *font_color, - *ichat_balloon_color, *ichat_text_color; - - font_face = xmlnode_get_attrib(html_body_font_node, "face"); - /* The absolute iChat font sizes should be converted to 1..7 range */ - font_size = xmlnode_get_attrib(html_body_font_node, "ABSZ"); - if (font_size != NULL) - font_size = _font_size_ichat_to_purple(atoi(font_size)); - font_color = xmlnode_get_attrib(html_body_font_node, "color"); - ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor"); - ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor"); - - html_body = get_xmlnode_contents(html_body_font_node); - - if (html_body == NULL) - /* This is the kind of formatted messages that Purple creates */ - html_body = xmlnode_to_str(html_body_font_node, NULL); - - if (html_body != NULL) { - GString *str = g_string_new("%s", html_body); - - body = g_string_free(str, FALSE); - - g_free(html_body); - } - } - } - } - - /* Compose the message */ - if (body == NULL && body_node != NULL) - body = xmlnode_get_data(body_node); - - if (body == NULL) { - purple_debug_error("bonjour", "No html body or regular body found.\n"); - return; - } - - /* Send the message to the UI */ - serv_got_im(gc, purple_buddy_get_name(pb), body, 0, time(NULL)); - - g_free(body); -} - -struct _match_buddies_by_address_t { - const char *address; - GSList *matched_buddies; -}; - -static void -_match_buddies_by_address(gpointer value, gpointer data) -{ - PurpleBuddy *pb = value; - BonjourBuddy *bb = NULL; - struct _match_buddies_by_address_t *mbba = data; - - bb = purple_buddy_get_protocol_data(pb); - - /* - * If the current PurpleBuddy's data is not null, then continue to determine - * whether one of the buddies IPs matches the target IP. - */ - if (bb != NULL) - { - const char *ip; - GSList *tmp = bb->ips; - - while(tmp) { - ip = tmp->data; - if (ip != NULL && g_ascii_strcasecmp(ip, mbba->address) == 0) { - mbba->matched_buddies = g_slist_prepend(mbba->matched_buddies, pb); - break; - } - tmp = tmp->next; - } - } -} - -static void -_send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleBuddy *pb = data; - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - BonjourJabberConversation *bconv = bb->conversation; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(bconv->tx_buf); - - if (writelen == 0) { - purple_input_remove(bconv->tx_handler); - bconv->tx_handler = 0; - return; - } - - ret = send(bconv->socket, bconv->tx_buf->outptr, writelen, 0); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - const char *error = g_strerror(errno); - - purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", - purple_buddy_get_name(pb), error ? error : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send message."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return; - } - - purple_circ_buffer_mark_read(bconv->tx_buf, ret); -} - -static gint -_send_data(PurpleBuddy *pb, char *message) -{ - gint ret; - int len = strlen(message); - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - BonjourJabberConversation *bconv = bb->conversation; - - /* If we're not ready to actually send, append it to the buffer */ - if (bconv->tx_handler != 0 - || bconv->connect_data != NULL - || bconv->sent_stream_start != FULLY_SENT - || !bconv->recv_stream_start - || purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { - ret = -1; - errno = EAGAIN; - } else { - ret = send(bconv->socket, message, len, 0); - } - - if (ret == -1 && errno == EAGAIN) - ret = 0; - else if (ret <= 0) { - PurpleConversation *conv; - PurpleAccount *account; - const char *error = g_strerror(errno); - - purple_debug_error("bonjour", "Error sending message to buddy %s error: %s\n", - purple_buddy_get_name(pb), error ? error : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send message."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return -1; - } - - if (ret < len) { - /* Don't interfere with the stream starting */ - if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start && bconv->tx_handler == 0) - bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, - _send_data_write_cb, pb); - purple_circ_buffer_append(bconv->tx_buf, message + ret, len - ret); - } - - return ret; -} - -void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet) { - - g_return_if_fail(packet != NULL); - g_return_if_fail(pb != NULL); - - if (!strcmp(packet->name, "message")) - _jabber_parse_and_write_message_to_ui(packet, pb); - else if(!strcmp(packet->name, "iq")) - xep_iq_parse(packet, pb); - else - purple_debug_warning("bonjour", "Unknown packet: %s\n", packet->name ? packet->name : "(null)"); -} - -static void bonjour_jabber_stream_ended(BonjourJabberConversation *bconv) { - - /* Inform the user that the conversation has been closed */ - BonjourBuddy *bb = NULL; - const gchar *name = bconv->pb ? purple_buddy_get_name(bconv->pb) : "(unknown)"; - - purple_debug_info("bonjour", "Recieved conversation close notification from %s.\n", name); - - if(bconv->pb != NULL) - bb = purple_buddy_get_protocol_data(bconv->pb); -#if 0 - if(bconv->pb != NULL) { - PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bconv->pb->name, bconv->pb->account); - if (conv != NULL) { - char *tmp = g_strdup_printf(_("%s has closed the conversation."), bconv->pb->name); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - } -#endif - /* Close the socket, clear the watcher and free memory */ - bonjour_jabber_close_conversation(bconv); - if(bb) - bb->conversation = NULL; -} - -static void -_client_socket_handler(gpointer data, gint socket, PurpleInputCondition condition) -{ - BonjourJabberConversation *bconv = data; - gint len, message_length; - static char message[4096]; - - /* Read the data from the socket */ - if ((len = recv(socket, message, sizeof(message) - 1, 0)) == -1) { - /* There have been an error reading from the socket */ - if (errno != EAGAIN) { - const char *err = g_strerror(errno); - - purple_debug_warning("bonjour", "receive error: %s\n", err ? err : "(null)"); - - bonjour_jabber_close_conversation(bconv); - if (bconv->pb != NULL) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(bconv->pb); - - if(bb != NULL) - bb->conversation = NULL; - } - - /* I guess we really don't need to notify the user. - * If they try to send another message it'll reconnect */ - } - return; - } else if (len == 0) { /* The other end has closed the socket */ - const gchar *name = purple_buddy_get_name(bconv->pb); - purple_debug_warning("bonjour", "Connection closed (without stream end) by %s.\n", (name) ? name : "(unknown)"); - bonjour_jabber_stream_ended(bconv); - return; - } else { - message_length = len; - message[message_length] = '\0'; - - while (message_length > 0 && g_ascii_iscntrl(message[message_length - 1])) { - message[message_length - 1] = '\0'; - message_length--; - } - } - - purple_debug_info("bonjour", "Receive: -%s- %d bytes\n", message, len); - - bonjour_parser_process(bconv, message, message_length); -} - -struct _stream_start_data { - char *msg; -}; - - -static void -_start_stream(gpointer data, gint source, PurpleInputCondition condition) -{ - BonjourJabberConversation *bconv = data; - struct _stream_start_data *ss = bconv->stream_data; - int len, ret; - - len = strlen(ss->msg); - - /* Start Stream */ - ret = send(source, ss->msg, len, 0); - - if (ret == -1 && errno == EAGAIN) - return; - else if (ret <= 0) { - const char *err = g_strerror(errno); - PurpleConversation *conv; - const char *bname = bconv->buddy_name; - BonjourBuddy *bb = NULL; - - if(bconv->pb) { - bb = purple_buddy_get_protocol_data(bconv->pb); - bname = purple_buddy_get_name(bconv->pb); - } - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", - bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bconv); - if(bb != NULL) - bb->conversation = NULL; - - return; - } - - /* This is EXTREMELY unlikely to happen */ - if (ret < len) { - char *tmp = g_strdup(ss->msg + ret); - g_free(ss->msg); - ss->msg = tmp; - return; - } - - g_free(ss->msg); - g_free(ss); - bconv->stream_data = NULL; - - /* Stream started; process the send buffer if there is one */ - purple_input_remove(bconv->tx_handler); - bconv->tx_handler = 0; - bconv->sent_stream_start = FULLY_SENT; - - bonjour_jabber_stream_started(bconv); -} - -static gboolean bonjour_jabber_send_stream_init(BonjourJabberConversation *bconv, int client_socket) -{ - int ret, len; - char *stream_start; - const char *bname = bconv->buddy_name; - - if (bconv->pb != NULL) - bname = purple_buddy_get_name(bconv->pb); - - /* If we have no idea who "to" is, use an empty string. - * If we don't know now, it is because the other side isn't playing nice, so they can't complain. */ - if (bname == NULL) - bname = ""; - - stream_start = g_strdup_printf(DOCTYPE, purple_account_get_username(bconv->account), bname); - len = strlen(stream_start); - - bconv->sent_stream_start = PARTIALLY_SENT; - - /* Start the stream */ - ret = send(client_socket, stream_start, len, 0); - - if (ret == -1 && errno == EAGAIN) - ret = 0; - else if (ret <= 0) { - const char *err = g_strerror(errno); - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", - (*bname) ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - - if (bconv->pb) { - PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - close(client_socket); - g_free(stream_start); - - return FALSE; - } - - /* This is unlikely to happen */ - if (ret < len) { - struct _stream_start_data *ss = g_new(struct _stream_start_data, 1); - ss->msg = g_strdup(stream_start + ret); - bconv->stream_data = ss; - /* Finish sending the stream start */ - bconv->tx_handler = purple_input_add(client_socket, - PURPLE_INPUT_WRITE, _start_stream, bconv); - } else - bconv->sent_stream_start = FULLY_SENT; - - g_free(stream_start); - - return TRUE; -} - -/* This gets called when we've successfully sent our - * AND when we've recieved a */ -void bonjour_jabber_stream_started(BonjourJabberConversation *bconv) { - - if (bconv->sent_stream_start == NOT_SENT && !bonjour_jabber_send_stream_init(bconv, bconv->socket)) { - const char *err = g_strerror(errno); - const char *bname = bconv->buddy_name; - - if (bconv->pb) - bname = purple_buddy_get_name(bconv->pb); - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s error: %s\n", - bname ? bname : "(unknown)", bconv->ip, err ? err : "(null)"); - - if (bconv->pb) { - PurpleConversation *conv; - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bname, bconv->account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - /* We don't want to recieve anything else */ - close(bconv->socket); - bconv->socket = -1; - - /* This must be asynchronous because it destroys the parser and we - * may be in the middle of parsing. - */ - async_bonjour_jabber_close_conversation(bconv); - return; - } - - /* If the stream has been completely started and we know who we're talking to, we can start doing stuff. */ - /* I don't think the circ_buffer can actually contain anything without a buddy being associated, but lets be explicit. */ - if (bconv->sent_stream_start == FULLY_SENT && bconv->recv_stream_start - && bconv->pb && purple_circ_buffer_get_max_read(bconv->tx_buf) > 0) { - /* Watch for when we can write the buffered messages */ - bconv->tx_handler = purple_input_add(bconv->socket, PURPLE_INPUT_WRITE, - _send_data_write_cb, bconv->pb); - /* We can probably write the data right now. */ - _send_data_write_cb(bconv->pb, bconv->socket, PURPLE_INPUT_WRITE); - } - -} - -static void -_server_socket_handler(gpointer data, int server_socket, PurpleInputCondition condition) -{ - BonjourJabber *jdata = data; - struct sockaddr_in their_addr; /* connector's address information */ - socklen_t sin_size = sizeof(struct sockaddr); - int client_socket; - int flags; - char *address_text = NULL; - struct _match_buddies_by_address_t *mbba; - BonjourJabberConversation *bconv; - GSList *buddies; - - /* Check that it is a read condition */ - if (condition != PURPLE_INPUT_READ) - return; - - if ((client_socket = accept(server_socket, (struct sockaddr *)&their_addr, &sin_size)) == -1) - return; - - flags = fcntl(client_socket, F_GETFL); - fcntl(client_socket, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(client_socket, F_SETFD, FD_CLOEXEC); -#endif - - /* Look for the buddy that has opened the conversation and fill information */ - address_text = inet_ntoa(their_addr.sin_addr); - purple_debug_info("bonjour", "Received incoming connection from %s.\n", address_text); - mbba = g_new0(struct _match_buddies_by_address_t, 1); - mbba->address = address_text; - - buddies = purple_find_buddies(jdata->account, NULL); - g_slist_foreach(buddies, _match_buddies_by_address, mbba); - g_slist_free(buddies); - - if (mbba->matched_buddies == NULL) { - purple_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n"); - g_free(mbba); - close(client_socket); - return; - } - - g_slist_free(mbba->matched_buddies); - g_free(mbba); - - /* We've established that this *could* be from one of our buddies. - * Wait for the stream open to see if that matches too before assigning it. - */ - bconv = bonjour_jabber_conv_new(NULL, jdata->account, address_text); - - /* We wait for the stream start before doing anything else */ - bconv->socket = client_socket; - bconv->rx_handler = purple_input_add(client_socket, PURPLE_INPUT_READ, _client_socket_handler, bconv); - -} - -gint -bonjour_jabber_start(BonjourJabber *jdata) -{ - struct sockaddr_in my_addr; - - /* Open a listening socket for incoming conversations */ - jdata->socket = socket(PF_INET, SOCK_STREAM, 0); - if (jdata->socket < 0) { - gchar *buf = g_strdup_printf(_("Unable to create socket: %s"), - g_strerror(errno)); - purple_connection_error_reason(jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, buf); - g_free(buf); - return -1; - } - - memset(&my_addr, 0, sizeof(struct sockaddr_in)); - my_addr.sin_family = AF_INET; - - /* Try to use the specified port - if it isn't available, use a random port */ - my_addr.sin_port = htons(jdata->port); - if (bind(jdata->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0) - { - purple_debug_info("bonjour", "Unable to bind to specified " - "port %i: %s\n", jdata->port, g_strerror(errno)); - my_addr.sin_port = 0; - if (bind(jdata->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0) - { - gchar *buf = g_strdup_printf(_("Unable to bind socket " - "to port: %s"), g_strerror(errno)); - purple_connection_error_reason(jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, buf); - g_free(buf); - return -1; - } - jdata->port = purple_network_get_port_from_fd(jdata->socket); - } - - /* Attempt to listen on the bound socket */ - if (listen(jdata->socket, 10) != 0) - { - gchar *buf = g_strdup_printf(_("Unable to listen on socket: %s"), - g_strerror(errno)); - purple_connection_error_reason(jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, buf); - g_free(buf); - return -1; - } - -#if 0 - /* TODO: Why isn't this being used? */ - data->socket = purple_network_listen(jdata->port, SOCK_STREAM); - - if (jdata->socket == -1) - { - purple_debug_error("bonjour", "No se ha podido crear el socket\n"); - } -#endif - - /* Open a watcher in the socket we have just opened */ - jdata->watcher_id = purple_input_add(jdata->socket, PURPLE_INPUT_READ, _server_socket_handler, jdata); - - return jdata->port; -} - -static void -_connected_to_buddy(gpointer data, gint source, const gchar *error) -{ - PurpleBuddy *pb = data; - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - - bb->conversation->connect_data = NULL; - - if (source < 0) { - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - - purple_debug_error("bonjour", "Error connecting to buddy %s at %s:%d error: %s\n", - purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, error ? error : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return; - } - - if (!bonjour_jabber_send_stream_init(bb->conversation, source)) { - const char *err = g_strerror(errno); - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - - purple_debug_error("bonjour", "Error starting stream with buddy %s at %s:%d error: %s\n", - purple_buddy_get_name(pb), bb->conversation->ip, bb->port_p2pj, err ? err : "(null)"); - - account = purple_buddy_get_account(pb); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, bb->name, account); - if (conv != NULL) - purple_conversation_write(conv, NULL, - _("Unable to send the message, the conversation couldn't be started."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - close(source); - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - return; - } - - /* Start listening for the stream acknowledgement */ - bb->conversation->socket = source; - bb->conversation->rx_handler = purple_input_add(source, - PURPLE_INPUT_READ, _client_socket_handler, bb->conversation); -} - -void -bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv) { - PurpleBuddy *pb = NULL; - BonjourBuddy *bb = NULL; - - g_return_if_fail(bconv->ip != NULL); - g_return_if_fail(bconv->pb == NULL); - - pb = purple_find_buddy(bconv->account, bconv->buddy_name); - if (pb && (bb = purple_buddy_get_protocol_data(pb))) { - const char *ip; - GSList *tmp = bb->ips; - - purple_debug_info("bonjour", "Found buddy %s for incoming conversation \"from\" attrib.\n", - purple_buddy_get_name(pb)); - - /* Check that one of the buddy's IPs matches */ - while(tmp) { - ip = tmp->data; - if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; - - purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n", - purple_buddy_get_name(pb), bconv->ip); - - /* Attach conv. to buddy and remove from pending list */ - jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); - - /* Check if the buddy already has a conversation and, if so, replace it */ - if(bb->conversation != NULL && bb->conversation != bconv) - bonjour_jabber_close_conversation(bb->conversation); - - bconv->pb = pb; - bb->conversation = bconv; - - break; - } - tmp = tmp->next; - } - } - - /* We've failed to match a buddy - give up */ - if (bconv->pb == NULL) { - /* This must be asynchronous because it destroys the parser and we - * may be in the middle of parsing. - */ - async_bonjour_jabber_close_conversation(bconv); - } -} - - -void -bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; - struct _match_buddies_by_address_t *mbba; - GSList *buddies; - - mbba = g_new0(struct _match_buddies_by_address_t, 1); - mbba->address = bconv->ip; - - buddies = purple_find_buddies(jdata->account, NULL); - g_slist_foreach(buddies, _match_buddies_by_address, mbba); - g_slist_free(buddies); - - /* If there is exactly one match, use it */ - if(mbba->matched_buddies != NULL) { - if(mbba->matched_buddies->next != NULL) - purple_debug_error("bonjour", "More than one buddy matched for ip %s.\n", bconv->ip); - else { - PurpleBuddy *pb = mbba->matched_buddies->data; - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - - purple_debug_info("bonjour", "Matched buddy %s to incoming conversation using IP (%s)\n", - purple_buddy_get_name(pb), bconv->ip); - - /* Attach conv. to buddy and remove from pending list */ - jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); - - /* Check if the buddy already has a conversation and, if so, replace it */ - if (bb->conversation != NULL && bb->conversation != bconv) - bonjour_jabber_close_conversation(bb->conversation); - - bconv->pb = pb; - bb->conversation = bconv; - } - } else - purple_debug_error("bonjour", "No buddies matched for ip %s.\n", bconv->ip); - - /* We've failed to match a buddy - give up */ - if (bconv->pb == NULL) { - /* This must be asynchronous because it destroys the parser and we - * may be in the middle of parsing. - */ - async_bonjour_jabber_close_conversation(bconv); - } - - g_slist_free(mbba->matched_buddies); - g_free(mbba); -} - -static PurpleBuddy * -_find_or_start_conversation(BonjourJabber *jdata, const gchar *to) -{ - PurpleBuddy *pb = NULL; - BonjourBuddy *bb = NULL; - - g_return_val_if_fail(jdata != NULL, NULL); - g_return_val_if_fail(to != NULL, NULL); - - pb = purple_find_buddy(jdata->account, to); - if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) - /* You can not send a message to an offline buddy */ - return NULL; - - /* Check if there is a previously open conversation */ - if (bb->conversation == NULL) - { - PurpleProxyConnectData *connect_data; - PurpleProxyInfo *proxy_info; - /* For better or worse, use the first IP*/ - const char *ip = bb->ips->data; - - purple_debug_info("bonjour", "Starting conversation with %s\n", to); - - /* Make sure that the account always has a proxy of "none". - * This is kind of dirty, but proxy_connect_none() isn't exposed. */ - proxy_info = purple_account_get_proxy_info(jdata->account); - if (proxy_info == NULL) { - proxy_info = purple_proxy_info_new(); - purple_account_set_proxy_info(jdata->account, proxy_info); - } - purple_proxy_info_set_type(proxy_info, PURPLE_PROXY_NONE); - - connect_data = purple_proxy_connect( - purple_account_get_connection(jdata->account), - jdata->account, - ip, bb->port_p2pj, _connected_to_buddy, pb); - - if (connect_data == NULL) { - purple_debug_error("bonjour", "Unable to connect to buddy (%s).\n", to); - return NULL; - } - - bb->conversation = bonjour_jabber_conv_new(pb, jdata->account, ip); - bb->conversation->connect_data = connect_data; - /* We don't want _send_data() to register the tx_handler; - * that neeeds to wait until we're actually connected. */ - bb->conversation->tx_handler = 0; - } - return pb; -} - -int -bonjour_jabber_send_message(BonjourJabber *jdata, const gchar *to, const gchar *body) -{ - xmlnode *message_node, *node, *node2; - gchar *message, *xhtml; - PurpleBuddy *pb; - BonjourBuddy *bb; - int ret; - - pb = _find_or_start_conversation(jdata, to); - if (pb == NULL || (bb = purple_buddy_get_protocol_data(pb)) == NULL) { - purple_debug_info("bonjour", "Can't send a message to an offline buddy (%s).\n", to); - /* You can not send a message to an offline buddy */ - return -10000; - } - - purple_markup_html_to_xhtml(body, &xhtml, &message); - - message_node = xmlnode_new("message"); - xmlnode_set_attrib(message_node, "to", bb->name); - xmlnode_set_attrib(message_node, "from", purple_account_get_username(jdata->account)); - xmlnode_set_attrib(message_node, "type", "chat"); - - /* Enclose the message from the UI within a "font" node */ - node = xmlnode_new_child(message_node, "body"); - xmlnode_insert_data(node, message, strlen(message)); - g_free(message); - - node = xmlnode_new_child(message_node, "html"); - xmlnode_set_namespace(node, "http://www.w3.org/1999/xhtml"); - - node = xmlnode_new_child(node, "body"); - message = g_strdup_printf("%s", xhtml); - node2 = xmlnode_from_str(message, strlen(message)); - g_free(xhtml); - g_free(message); - xmlnode_insert_child(node, node2); - - node = xmlnode_new_child(message_node, "x"); - xmlnode_set_namespace(node, "jabber:x:event"); - xmlnode_insert_child(node, xmlnode_new("composing")); - - message = xmlnode_to_str(message_node, NULL); - xmlnode_free(message_node); - - ret = _send_data(pb, message) >= 0; - - g_free(message); - - return ret; -} - -static gboolean -_async_bonjour_jabber_close_conversation_cb(gpointer data) { - BonjourJabberConversation *bconv = data; - bonjour_jabber_close_conversation(bconv); - return FALSE; -} - -void -async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) { - BonjourJabber *jdata = ((BonjourData*) bconv->account->gc->proto_data)->jabber_data; - - jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv); - - /* Disconnect this conv. from the buddy here so it can't be disposed of twice.*/ - if(bconv->pb != NULL) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(bconv->pb); - if (bb->conversation == bconv) - bb->conversation = NULL; - } - - bconv->close_timeout = purple_timeout_add(0, _async_bonjour_jabber_close_conversation_cb, bconv); -} - -void -bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) -{ - if (bconv != NULL) { - BonjourData *bd = NULL; - - if(PURPLE_CONNECTION_IS_VALID(bconv->account->gc)) { - bd = bconv->account->gc->proto_data; - bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv); - } - - /* Cancel any file transfers that are waiting to begin */ - /* There wont be any transfers if it hasn't been attached to a buddy */ - if (bconv->pb != NULL && bd != NULL) { - GSList *xfers, *tmp_next; - xfers = bd->xfer_lists; - while(xfers != NULL) { - PurpleXfer *xfer = xfers->data; - tmp_next = xfers->next; - /* We only need to cancel this if it hasn't actually started transferring. */ - /* This will change if we ever support IBB transfers. */ - if (strcmp(xfer->who, purple_buddy_get_name(bconv->pb)) == 0 - && (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_NOT_STARTED - || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_UNKNOWN)) { - purple_xfer_cancel_remote(xfer); - } - xfers = tmp_next; - } - } - - /* Close the socket and remove the watcher */ - if (bconv->socket >= 0) { - /* Send the end of the stream to the other end of the conversation */ - if (bconv->sent_stream_start == FULLY_SENT) - send(bconv->socket, STREAM_END, strlen(STREAM_END), 0); - /* TODO: We're really supposed to wait for "" before closing the socket */ - close(bconv->socket); - } - if (bconv->rx_handler != 0) - purple_input_remove(bconv->rx_handler); - if (bconv->tx_handler > 0) - purple_input_remove(bconv->tx_handler); - - /* Free all the data related to the conversation */ - purple_circ_buffer_destroy(bconv->tx_buf); - if (bconv->connect_data != NULL) - purple_proxy_connect_cancel(bconv->connect_data); - if (bconv->stream_data != NULL) { - struct _stream_start_data *ss = bconv->stream_data; - g_free(ss->msg); - g_free(ss); - } - - if (bconv->context != NULL) - bonjour_parser_setup(bconv); - - if (bconv->close_timeout != 0) - purple_timeout_remove(bconv->close_timeout); - - g_free(bconv->buddy_name); - g_free(bconv->ip); - g_free(bconv); - } -} - -void -bonjour_jabber_stop(BonjourJabber *jdata) -{ - /* Close the server socket and remove the watcher */ - if (jdata->socket >= 0) - close(jdata->socket); - if (jdata->watcher_id > 0) - purple_input_remove(jdata->watcher_id); - - /* Close all the conversation sockets and remove all the watchers after sending end streams */ - if (jdata->account->gc != NULL) { - GSList *buddies, *l; - - buddies = purple_find_buddies(jdata->account, NULL); - for (l = buddies; l; l = l->next) { - BonjourBuddy *bb = purple_buddy_get_protocol_data((PurpleBuddy*) l->data); - if (bb != NULL) { - bonjour_jabber_close_conversation(bb->conversation); - bb->conversation = NULL; - } - } - - g_slist_free(buddies); - } - - while (jdata->pending_conversations != NULL) { - bonjour_jabber_close_conversation(jdata->pending_conversations->data); - jdata->pending_conversations = g_slist_delete_link(jdata->pending_conversations, jdata->pending_conversations); - } -} - -XepIq * -xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id) -{ - xmlnode *iq_node = NULL; - XepIq *iq = NULL; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(to != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - iq_node = xmlnode_new("iq"); - - xmlnode_set_attrib(iq_node, "to", to); - xmlnode_set_attrib(iq_node, "from", from); - xmlnode_set_attrib(iq_node, "id", id); - switch (type) { - case XEP_IQ_SET: - xmlnode_set_attrib(iq_node, "type", "set"); - break; - case XEP_IQ_GET: - xmlnode_set_attrib(iq_node, "type", "get"); - break; - case XEP_IQ_RESULT: - xmlnode_set_attrib(iq_node, "type", "result"); - break; - case XEP_IQ_ERROR: - xmlnode_set_attrib(iq_node, "type", "error"); - break; - case XEP_IQ_NONE: - default: - xmlnode_set_attrib(iq_node, "type", "none"); - break; - } - - iq = g_new0(XepIq, 1); - iq->node = iq_node; - iq->type = type; - iq->data = ((BonjourData*)data)->jabber_data; - iq->to = (char*)to; - - return iq; -} - -static gboolean -check_if_blocked(PurpleBuddy *pb) -{ - gboolean blocked = FALSE; - GSList *l = NULL; - PurpleAccount *acc = purple_buddy_get_account(pb); - - if(acc == NULL) - return FALSE; - - acc = purple_buddy_get_account(pb); - - for(l = acc->deny; l != NULL; l = l->next) { - const gchar *name = purple_buddy_get_name(pb); - const gchar *username = purple_account_get_username(acc); - - if(!purple_utf8_strcasecmp(name, (char *)l->data)) { - purple_debug_info("bonjour", "%s has been blocked by %s.\n", name, username); - blocked = TRUE; - break; - } - } - return blocked; -} - -static void -xep_iq_parse(xmlnode *packet, PurpleBuddy *pb) -{ - xmlnode *child; - PurpleAccount *account; - PurpleConnection *gc; - - if(check_if_blocked(pb)) - return; - - account = purple_buddy_get_account(pb); - gc = purple_account_get_connection(account); - - if ((child = xmlnode_get_child(packet, "si")) || (child = xmlnode_get_child(packet, "error"))) - xep_si_parse(gc, packet, pb); - else - xep_bytestreams_parse(gc, packet, pb); -} - -int -xep_iq_send_and_free(XepIq *iq) -{ - int ret = -1; - PurpleBuddy *pb = NULL; - - /* start the talk, reuse the message socket */ - pb = _find_or_start_conversation((BonjourJabber*) iq->data, iq->to); - /* Send the message */ - if (pb != NULL) { - /* Convert xml node into stream */ - gchar *msg = xmlnode_to_str(iq->node, NULL); - ret = _send_data(pb, msg); - g_free(msg); - } - - xmlnode_free(iq->node); - iq->node = NULL; - g_free(iq); - - return (ret >= 0) ? 0 : -1; -} - -/* This returns a ';' delimited string containing all non-localhost IPs */ -const char * -purple_network_get_my_ip_ext2(int fd) -{ - char buffer[1024]; - static char ip_ext[17 * 10]; - char *tmp; - char *tip; - struct ifconf ifc; - struct ifreq *ifr; - struct sockaddr_in *sinptr; - guint32 lhost = htonl(127 * 256 * 256 * 256 + 1); - long unsigned int add; - int source = fd; - int len, count = 0; - - if (fd < 0) - source = socket(PF_INET, SOCK_STREAM, 0); - - ifc.ifc_len = sizeof(buffer); - ifc.ifc_req = (struct ifreq *)buffer; - ioctl(source, SIOCGIFCONF, &ifc); - - if (fd < 0) - close(source); - - memset(ip_ext, 0, sizeof(ip_ext)); - memcpy(ip_ext, "0.0.0.0", 7); - tmp = buffer; - tip = ip_ext; - while (tmp < buffer + ifc.ifc_len && count < 10) - { - ifr = (struct ifreq *)tmp; - tmp += HX_SIZE_OF_IFREQ(*ifr); - - if (ifr->ifr_addr.sa_family == AF_INET) - { - sinptr = (struct sockaddr_in *)&ifr->ifr_addr; - if (sinptr->sin_addr.s_addr != lhost) - { - add = ntohl(sinptr->sin_addr.s_addr); - len = g_snprintf(tip, 17, "%lu.%lu.%lu.%lu;", - ((add >> 24) & 255), - ((add >> 16) & 255), - ((add >> 8) & 255), - add & 255); - tip = &tip[len]; - count++; - continue; - } - } - } - - return ip_ext; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/jabber.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/** - * @file jabber.h The Purple interface to mDNS and peer to peer Jabber. - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _BONJOUR_JABBER_H_ -#define _BONJOUR_JABBER_H_ - -#include - -#include "xmlnode.h" - -#include "account.h" -#include "circbuffer.h" - -typedef struct _BonjourJabber -{ - gint port; - gint socket; - gint watcher_id; - PurpleAccount *account; - GSList *pending_conversations; -} BonjourJabber; - -typedef struct _BonjourJabberConversation -{ - gint socket; - guint rx_handler; - guint tx_handler; - guint close_timeout; - PurpleCircBuffer *tx_buf; - int sent_stream_start; /* 0 = Unsent, 1 = Partial, 2 = Complete */ - gboolean recv_stream_start; - PurpleProxyConnectData *connect_data; - gpointer stream_data; - xmlParserCtxt *context; - xmlnode *current; - PurpleBuddy *pb; - PurpleAccount *account; - - /* The following are only needed before attaching to a PurpleBuddy */ - gchar *buddy_name; - gchar *ip; -} BonjourJabberConversation; - -/** - * Start listening for jabber connections. - * - * @return -1 if there was a problem, else returns the listening - * port number. - */ -gint bonjour_jabber_start(BonjourJabber *data); - -int bonjour_jabber_send_message(BonjourJabber *data, const char *to, const char *body); - -void bonjour_jabber_close_conversation(BonjourJabberConversation *bconv); - -void async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv); - -void bonjour_jabber_stream_started(BonjourJabberConversation *bconv); - -void bonjour_jabber_process_packet(PurpleBuddy *pb, xmlnode *packet); - -void bonjour_jabber_stop(BonjourJabber *data); - -void bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv); - -void bonjour_jabber_conv_match_by_name(BonjourJabberConversation *bconv); - -typedef enum { - XEP_IQ_SET, - XEP_IQ_GET, - XEP_IQ_RESULT, - XEP_IQ_ERROR, - XEP_IQ_NONE -} XepIqType; - -typedef struct _XepIq { - XepIqType type; - char *id; - xmlnode *node; - char *to; - void *data; -} XepIq; - -XepIq *xep_iq_new(void *data, XepIqType type, const char *to, const char *from, const char *id); -int xep_iq_send_and_free(XepIq *iq); -const char *purple_network_get_my_ip_ext2(int fd); - -#endif /* _BONJOUR_JABBER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -EXTRA_DIST = \ - mdns_win32.c \ - dns_sd_proxy.c \ - dns_sd_proxy.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -BONJOURSOURCES = \ - bonjour.c \ - bonjour.h \ - buddy.c \ - buddy.h \ - jabber.c \ - jabber.h \ - mdns_avahi.c \ - mdns_common.c \ - mdns_common.h \ - mdns_interface.h \ - mdns_types.h \ - parser.c \ - parser.h \ - bonjour_ft.c \ - bonjour_ft.h - -AM_CFLAGS = $(st) - -libbonjour_la_LDFLAGS = -module -avoid-version - -if STATIC_BONJOUR - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libbonjour.la -libbonjour_la_SOURCES = $(BONJOURSOURCES) -libbonjour_la_CFLAGS = $(AM_CFLAGS) -libbonjour_la_LIBADD = $(AVAHI_LIBS) - -else - -st = -pkg_LTLIBRARIES = libbonjour.la -libbonjour_la_SOURCES = $(BONJOURSOURCES) -libbonjour_la_LIBADD = $(GLIB_LIBS) $(LIBXML_LIBS) $(AVAHI_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(LIBXML_CFLAGS) \ - $(AVAHI_CFLAGS) \ No newline at end of file diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,818 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/bonjour -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_BONJOUR_FALSE@libbonjour_la_DEPENDENCIES = \ -@STATIC_BONJOUR_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_BONJOUR_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_BONJOUR_FALSE@ $(am__DEPENDENCIES_1) -@STATIC_BONJOUR_TRUE@libbonjour_la_DEPENDENCIES = \ -@STATIC_BONJOUR_TRUE@ $(am__DEPENDENCIES_1) -am__libbonjour_la_SOURCES_DIST = bonjour.c bonjour.h buddy.c buddy.h \ - jabber.c jabber.h mdns_avahi.c mdns_common.c mdns_common.h \ - mdns_interface.h mdns_types.h parser.c parser.h bonjour_ft.c \ - bonjour_ft.h -am__objects_1 = libbonjour_la-bonjour.lo libbonjour_la-buddy.lo \ - libbonjour_la-jabber.lo libbonjour_la-mdns_avahi.lo \ - libbonjour_la-mdns_common.lo libbonjour_la-parser.lo \ - libbonjour_la-bonjour_ft.lo -@STATIC_BONJOUR_FALSE@am_libbonjour_la_OBJECTS = $(am__objects_1) -@STATIC_BONJOUR_TRUE@am_libbonjour_la_OBJECTS = $(am__objects_1) -libbonjour_la_OBJECTS = $(am_libbonjour_la_OBJECTS) -@STATIC_BONJOUR_FALSE@am_libbonjour_la_rpath = -rpath $(pkgdir) -@STATIC_BONJOUR_TRUE@am_libbonjour_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libbonjour_la_SOURCES) -DIST_SOURCES = $(am__libbonjour_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - mdns_win32.c \ - dns_sd_proxy.c \ - dns_sd_proxy.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -BONJOURSOURCES = \ - bonjour.c \ - bonjour.h \ - buddy.c \ - buddy.h \ - jabber.c \ - jabber.h \ - mdns_avahi.c \ - mdns_common.c \ - mdns_common.h \ - mdns_interface.h \ - mdns_types.h \ - parser.c \ - parser.h \ - bonjour_ft.c \ - bonjour_ft.h - -AM_CFLAGS = $(st) -libbonjour_la_LDFLAGS = -module -avoid-version -@STATIC_BONJOUR_FALSE@st = -@STATIC_BONJOUR_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_BONJOUR_TRUE@noinst_LTLIBRARIES = libbonjour.la -@STATIC_BONJOUR_FALSE@libbonjour_la_SOURCES = $(BONJOURSOURCES) -@STATIC_BONJOUR_TRUE@libbonjour_la_SOURCES = $(BONJOURSOURCES) -@STATIC_BONJOUR_TRUE@libbonjour_la_CFLAGS = $(AM_CFLAGS) -@STATIC_BONJOUR_FALSE@libbonjour_la_LIBADD = $(GLIB_LIBS) $(LIBXML_LIBS) $(AVAHI_LIBS) -@STATIC_BONJOUR_TRUE@libbonjour_la_LIBADD = $(AVAHI_LIBS) -@STATIC_BONJOUR_FALSE@pkg_LTLIBRARIES = libbonjour.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(LIBXML_CFLAGS) \ - $(AVAHI_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/bonjour/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/bonjour/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libbonjour.la: $(libbonjour_la_OBJECTS) $(libbonjour_la_DEPENDENCIES) - $(LINK) $(am_libbonjour_la_rpath) $(libbonjour_la_LDFLAGS) $(libbonjour_la_OBJECTS) $(libbonjour_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-bonjour.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-bonjour_ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-jabber.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-mdns_avahi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-mdns_common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbonjour_la-parser.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libbonjour_la-bonjour.lo: bonjour.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-bonjour.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-bonjour.Tpo" -c -o libbonjour_la-bonjour.lo `test -f 'bonjour.c' || echo '$(srcdir)/'`bonjour.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-bonjour.Tpo" "$(DEPDIR)/libbonjour_la-bonjour.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-bonjour.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bonjour.c' object='libbonjour_la-bonjour.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-bonjour.lo `test -f 'bonjour.c' || echo '$(srcdir)/'`bonjour.c - -libbonjour_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-buddy.Tpo" -c -o libbonjour_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-buddy.Tpo" "$(DEPDIR)/libbonjour_la-buddy.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libbonjour_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libbonjour_la-jabber.lo: jabber.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-jabber.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-jabber.Tpo" -c -o libbonjour_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-jabber.Tpo" "$(DEPDIR)/libbonjour_la-jabber.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-jabber.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jabber.c' object='libbonjour_la-jabber.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c - -libbonjour_la-mdns_avahi.lo: mdns_avahi.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-mdns_avahi.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-mdns_avahi.Tpo" -c -o libbonjour_la-mdns_avahi.lo `test -f 'mdns_avahi.c' || echo '$(srcdir)/'`mdns_avahi.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-mdns_avahi.Tpo" "$(DEPDIR)/libbonjour_la-mdns_avahi.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-mdns_avahi.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mdns_avahi.c' object='libbonjour_la-mdns_avahi.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-mdns_avahi.lo `test -f 'mdns_avahi.c' || echo '$(srcdir)/'`mdns_avahi.c - -libbonjour_la-mdns_common.lo: mdns_common.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-mdns_common.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-mdns_common.Tpo" -c -o libbonjour_la-mdns_common.lo `test -f 'mdns_common.c' || echo '$(srcdir)/'`mdns_common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-mdns_common.Tpo" "$(DEPDIR)/libbonjour_la-mdns_common.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-mdns_common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mdns_common.c' object='libbonjour_la-mdns_common.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-mdns_common.lo `test -f 'mdns_common.c' || echo '$(srcdir)/'`mdns_common.c - -libbonjour_la-parser.lo: parser.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-parser.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-parser.Tpo" -c -o libbonjour_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-parser.Tpo" "$(DEPDIR)/libbonjour_la-parser.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-parser.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parser.c' object='libbonjour_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c - -libbonjour_la-bonjour_ft.lo: bonjour_ft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -MT libbonjour_la-bonjour_ft.lo -MD -MP -MF "$(DEPDIR)/libbonjour_la-bonjour_ft.Tpo" -c -o libbonjour_la-bonjour_ft.lo `test -f 'bonjour_ft.c' || echo '$(srcdir)/'`bonjour_ft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libbonjour_la-bonjour_ft.Tpo" "$(DEPDIR)/libbonjour_la-bonjour_ft.Plo"; else rm -f "$(DEPDIR)/libbonjour_la-bonjour_ft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bonjour_ft.c' object='libbonjour_la-bonjour_ft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbonjour_la_CFLAGS) $(CFLAGS) -c -o libbonjour_la-bonjour_ft.lo `test -f 'bonjour_ft.c' || echo '$(srcdir)/'`bonjour_ft.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libbonjour -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libbonjour -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -CFLAGS += -DUSE_BONJOUR_APPLE - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(BONJOUR_TOP)/Include \ - -I$(LIBXML2_TOP)/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(LIBXML2_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = bonjour.c \ - bonjour_ft.c \ - buddy.c \ - dns_sd_proxy.c \ - jabber.c \ - mdns_common.c \ - mdns_win32.c \ - parser.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lnetapi32 \ - -lxml2 \ - -lpurple - -ifeq ($(LINK_DNS_SD_DIRECTLY), 1) - CFLAGS += -DLINK_DNS_SD_DIRECTLY - LIB_PATHS += -L$(BONJOUR_TOP)/lib/win32 -L$(BONJOUR_TOP)/lib - LIBS += -ldnssd -endif - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_avahi.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_avahi.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_avahi.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_avahi.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,636 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include "internal.h" - -#include "mdns_interface.h" -#include "debug.h" -#include "buddy.h" -#include "bonjour.h" - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -/* Avahi only defines the types that it actually uses (which at this time doesn't include NULL) */ -#ifndef AVAHI_DNS_TYPE_NULL -#define AVAHI_DNS_TYPE_NULL 0x0A -#endif - -/* data used by avahi bonjour implementation */ -typedef struct _avahi_session_impl_data { - AvahiClient *client; - AvahiGLibPoll *glib_poll; - AvahiServiceBrowser *sb; - AvahiEntryGroup *group; - AvahiEntryGroup *buddy_icon_group; -} AvahiSessionImplData; - -typedef struct _avahi_buddy_service_resolver_data { - AvahiServiceResolver *resolver; - AvahiIfIndex interface; - AvahiProtocol protocol; - gchar *name; - gchar *type; - gchar *domain; - /* This is a reference to the entry in BonjourBuddy->ips */ - const char *ip; -} AvahiSvcResolverData; - -typedef struct _avahi_buddy_impl_data { - GSList *resolvers; - AvahiRecordBrowser *buddy_icon_rec_browser; -} AvahiBuddyImplData; - -static gint -_find_resolver_data(gconstpointer a, gconstpointer b) { - const AvahiSvcResolverData *rd_a = a; - const AvahiSvcResolverData *rd_b = b; - gint ret = 1; - - if(rd_a->interface == rd_b->interface - && rd_a->protocol == rd_b->protocol - && !strcmp(rd_a->name, rd_b->name) - && !strcmp(rd_a->type, rd_b->type) - && !strcmp(rd_a->domain, rd_b->domain)) { - ret = 0; - } - - return ret; -} - -static gint -_find_resolver_data_by_resolver(gconstpointer a, gconstpointer b) { - const AvahiSvcResolverData *rd_a = a; - const AvahiServiceResolver *resolver = b; - gint ret = 1; - - if(rd_a->resolver == resolver) - ret = 0; - - return ret; -} - -static void -_cleanup_resolver_data(AvahiSvcResolverData *rd) { - if (rd->resolver) - avahi_service_resolver_free(rd->resolver); - g_free(rd->name); - g_free(rd->type); - g_free(rd->domain); - g_free(rd); -} - - -static void -_resolver_callback(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, - AvahiResolverEvent event, const char *name, const char *type, const char *domain, - const char *host_name, const AvahiAddress *a, uint16_t port, AvahiStringList *txt, - AvahiLookupResultFlags flags, void *userdata) { - - PurpleBuddy *pb; - BonjourBuddy *bb; - PurpleAccount *account = userdata; - AvahiStringList *l; - size_t size; - char *key, *value; - int ret; - char ip[AVAHI_ADDRESS_STR_MAX]; - AvahiBuddyImplData *b_impl; - AvahiSvcResolverData *rd; - GSList *res; - - g_return_if_fail(r != NULL); - - pb = purple_find_buddy(account, name); - bb = (pb != NULL) ? purple_buddy_get_protocol_data(pb) : NULL; - - switch (event) { - case AVAHI_RESOLVER_FAILURE: - purple_debug_error("bonjour", "_resolve_callback - Failure: %s\n", - avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r)))); - - avahi_service_resolver_free(r); - if (bb != NULL) { - b_impl = bb->mdns_impl_data; - res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver); - if (res != NULL) { - rd = res->data; - b_impl->resolvers = g_slist_remove_link(b_impl->resolvers, res); - - /* We've already freed the resolver */ - rd->resolver = NULL; - _cleanup_resolver_data(rd); - - /* If this was the last resolver, remove the buddy */ - if (b_impl->resolvers == NULL) - bonjour_buddy_signed_off(pb); - } - } - break; - case AVAHI_RESOLVER_FOUND: - - purple_debug_info("bonjour", "_resolve_callback - name:%s account:%p bb:%p\n", - name, account, bb); - - /* create a buddy record */ - if (bb == NULL) - bb = bonjour_buddy_new(name, account); - b_impl = bb->mdns_impl_data; - - /* If we're reusing an existing buddy, it may be a new resolver or an existing one. */ - res = g_slist_find_custom(b_impl->resolvers, r, _find_resolver_data_by_resolver); - if (res != NULL) - rd = res->data; - else { - rd = g_new0(AvahiSvcResolverData, 1); - rd->resolver = r; - rd->interface = interface; - rd->protocol = protocol; - rd->name = g_strdup(name); - rd->type = g_strdup(type); - rd->domain = g_strdup(domain); - - b_impl->resolvers = g_slist_prepend(b_impl->resolvers, rd); - } - - - /* Get the ip as a string */ - ip[0] = '\0'; - avahi_address_snprint(ip, AVAHI_ADDRESS_STR_MAX, a); - - purple_debug_info("bonjour", "_resolve_callback - name:%s ip:%s prev_ip:%s\n", - name, ip, rd->ip); - - if (rd->ip == NULL || strcmp(rd->ip, ip) != 0) { - /* We store duplicates in bb->ips, so we always remove the one */ - if (rd->ip != NULL) { - bb->ips = g_slist_remove(bb->ips, rd->ip); - g_free((gchar *) rd->ip); - } - bb->ips = g_slist_prepend(bb->ips, g_strdup(ip)); - rd->ip = bb->ips->data; - } - - bb->port_p2pj = port; - - /* Obtain the parameters from the text_record */ - clear_bonjour_buddy_values(bb); - for(l = txt; l != NULL; l = l->next) { - if ((ret = avahi_string_list_get_pair(l, &key, &value, &size)) < 0) - continue; - set_bonjour_buddy_value(bb, key, value, size); - /* TODO: Since we're using the glib allocator, I think we - * can use the values instead of re-copying them */ - avahi_free(key); - avahi_free(value); - } - - if (!bonjour_buddy_check(bb)) { - b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd); - _cleanup_resolver_data(rd); - /* If this was the last resolver, remove the buddy */ - if (b_impl->resolvers == NULL) { - if (pb != NULL) - bonjour_buddy_signed_off(pb); - else - bonjour_buddy_delete(bb); - } - } else - /* Add or update the buddy in our buddy list */ - bonjour_buddy_add_to_purple(bb, pb); - - break; - default: - purple_debug_info("bonjour", "Unrecognized Service Resolver event: %d.\n", event); - } - -} - -static void -_browser_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, - AvahiProtocol protocol, AvahiBrowserEvent event, - const char *name, const char *type, const char *domain, - AvahiLookupResultFlags flags, void *userdata) { - - PurpleAccount *account = userdata; - PurpleBuddy *pb = NULL; - - switch (event) { - case AVAHI_BROWSER_FAILURE: - purple_debug_error("bonjour", "_browser_callback - Failure: %s\n", - avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); - /* TODO: This is an error that should be handled. */ - break; - case AVAHI_BROWSER_NEW: - /* A new peer has joined the network and uses iChat bonjour */ - purple_debug_info("bonjour", "_browser_callback - new service\n"); - /* Make sure it isn't us */ - if (purple_utf8_strcasecmp(name, account->username) != 0) { - if (!avahi_service_resolver_new(avahi_service_browser_get_client(b), - interface, protocol, name, type, domain, AVAHI_PROTO_INET, - 0, _resolver_callback, account)) { - purple_debug_warning("bonjour", "_browser_callback -- Error initiating resolver: %s\n", - avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b)))); - } - } - break; - case AVAHI_BROWSER_REMOVE: - purple_debug_info("bonjour", "_browser_callback - Remove service\n"); - pb = purple_find_buddy(account, name); - if (pb != NULL) { - BonjourBuddy *bb = purple_buddy_get_protocol_data(pb); - AvahiBuddyImplData *b_impl; - GSList *l; - AvahiSvcResolverData *rd_search; - - g_return_if_fail(bb != NULL); - - b_impl = bb->mdns_impl_data; - - /* There may be multiple presences, we should only get rid of this one */ - - rd_search = g_new0(AvahiSvcResolverData, 1); - rd_search->interface = interface; - rd_search->protocol = protocol; - rd_search->name = (gchar *) name; - rd_search->type = (gchar *) type; - rd_search->domain = (gchar *) domain; - - l = g_slist_find_custom(b_impl->resolvers, rd_search, _find_resolver_data); - - g_free(rd_search); - - if (l != NULL) { - AvahiSvcResolverData *rd = l->data; - b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd); - /* This IP is no longer available */ - if (rd->ip != NULL) { - bb->ips = g_slist_remove(bb->ips, rd->ip); - g_free((gchar *) rd->ip); - } - _cleanup_resolver_data(rd); - - /* If this was the last resolver, remove the buddy */ - if (b_impl->resolvers == NULL) - bonjour_buddy_signed_off(pb); - } - } - break; - case AVAHI_BROWSER_ALL_FOR_NOW: - case AVAHI_BROWSER_CACHE_EXHAUSTED: - break; - default: - purple_debug_info("bonjour", "Unrecognized Service browser event: %d.\n", event); - } -} - -static void -_buddy_icon_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { - BonjourDnsSd *data = userdata; - AvahiSessionImplData *idata = data->mdns_impl_data; - - g_return_if_fail(g == idata->buddy_icon_group || idata->buddy_icon_group == NULL); - - switch(state) { - case AVAHI_ENTRY_GROUP_ESTABLISHED: - purple_debug_info("bonjour", "Successfully registered buddy icon data.\n"); - break; - case AVAHI_ENTRY_GROUP_COLLISION: - purple_debug_error("bonjour", "Collision registering buddy icon data.\n"); - break; - case AVAHI_ENTRY_GROUP_FAILURE: - purple_debug_error("bonjour", "Error registering buddy icon data: %s.\n", - avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); - break; - case AVAHI_ENTRY_GROUP_UNCOMMITED: - case AVAHI_ENTRY_GROUP_REGISTERING: - break; - } - -} - -static void -_entry_group_cb(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { - AvahiSessionImplData *idata = userdata; - - g_return_if_fail(g == idata->group || idata->group == NULL); - - switch(state) { - case AVAHI_ENTRY_GROUP_ESTABLISHED: - purple_debug_info("bonjour", "Successfully registered service.\n"); - break; - case AVAHI_ENTRY_GROUP_COLLISION: - purple_debug_error("bonjour", "Collision registering entry group.\n"); - /* TODO: Handle error - this should log out the account. (Possibly with "wants to die")*/ - break; - case AVAHI_ENTRY_GROUP_FAILURE: - purple_debug_error("bonjour", "Error registering entry group: %s\n.", - avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g)))); - /* TODO: Handle error - this should log out the account.*/ - break; - case AVAHI_ENTRY_GROUP_UNCOMMITED: - case AVAHI_ENTRY_GROUP_REGISTERING: - break; - } - -} - -static void -_buddy_icon_record_cb(AvahiRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, - AvahiBrowserEvent event, const char *name, uint16_t clazz, uint16_t type, - const void *rdata, size_t size, AvahiLookupResultFlags flags, void *userdata) { - BonjourBuddy *buddy = userdata; - AvahiBuddyImplData *idata = buddy->mdns_impl_data; - - switch (event) { - case AVAHI_BROWSER_CACHE_EXHAUSTED: - case AVAHI_BROWSER_ALL_FOR_NOW: - /* Ignore these "meta" informational events */ - return; - case AVAHI_BROWSER_NEW: - bonjour_buddy_got_buddy_icon(buddy, rdata, size); - break; - case AVAHI_BROWSER_REMOVE: - case AVAHI_BROWSER_FAILURE: - purple_debug_error("bonjour", "Error retrieving buddy icon record: %s\n", - avahi_strerror(avahi_client_errno(avahi_record_browser_get_client(b)))); - break; - } - - /* Stop listening */ - avahi_record_browser_free(b); - if (idata->buddy_icon_rec_browser == b) { - idata->buddy_icon_rec_browser = NULL; - } -} - -/**************************** - * mdns_interface functions * - ****************************/ - -gboolean _mdns_init_session(BonjourDnsSd *data) { - AvahiSessionImplData *idata = g_new0(AvahiSessionImplData, 1); - const AvahiPoll *poll_api; - int error; - - /* Tell avahi to use g_malloc and g_free */ - avahi_set_allocator (avahi_glib_allocator ()); - - /* This currently depends on the glib mainloop, - * we should make it use the libpurple abstraction */ - - idata->glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT); - - poll_api = avahi_glib_poll_get(idata->glib_poll); - - idata->client = avahi_client_new(poll_api, 0, NULL, data, &error); - - if (idata->client == NULL) { - purple_debug_error("bonjour", "Error initializing Avahi: %s\n", avahi_strerror(error)); - avahi_glib_poll_free(idata->glib_poll); - g_free(idata); - return FALSE; - } - - data->mdns_impl_data = idata; - - return TRUE; -} - -gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records) { - int publish_result = 0; - AvahiSessionImplData *idata = data->mdns_impl_data; - AvahiStringList *lst = NULL; - - g_return_val_if_fail(idata != NULL, FALSE); - - if (!idata->group) { - idata->group = avahi_entry_group_new(idata->client, - _entry_group_cb, idata); - if (!idata->group) { - purple_debug_error("bonjour", - "Unable to initialize the data for the mDNS (%s).\n", - avahi_strerror(avahi_client_errno(idata->client))); - return FALSE; - } - } - - while (records) { - PurpleKeyValuePair *kvp = records->data; - lst = avahi_string_list_add_pair(lst, kvp->key, kvp->value); - records = records->next; - } - - /* Publish the service */ - switch (type) { - case PUBLISH_START: - publish_result = avahi_entry_group_add_service_strlst( - idata->group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, 0, - purple_account_get_username(data->account), - LINK_LOCAL_RECORD_NAME, NULL, NULL, data->port_p2pj, lst); - break; - case PUBLISH_UPDATE: - publish_result = avahi_entry_group_update_service_txt_strlst( - idata->group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, 0, - purple_account_get_username(data->account), - LINK_LOCAL_RECORD_NAME, NULL, lst); - break; - } - - /* Free the memory used by temp data */ - avahi_string_list_free(lst); - - if (publish_result < 0) { - purple_debug_error("bonjour", - "Failed to add the " LINK_LOCAL_RECORD_NAME " service. Error: %s\n", - avahi_strerror(publish_result)); - return FALSE; - } - - if (type == PUBLISH_START - && (publish_result = avahi_entry_group_commit(idata->group)) < 0) { - purple_debug_error("bonjour", - "Failed to commit " LINK_LOCAL_RECORD_NAME " service. Error: %s\n", - avahi_strerror(publish_result)); - return FALSE; - } - - return TRUE; -} - -gboolean _mdns_browse(BonjourDnsSd *data) { - AvahiSessionImplData *idata = data->mdns_impl_data; - - g_return_val_if_fail(idata != NULL, FALSE); - - idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, LINK_LOCAL_RECORD_NAME, NULL, 0, _browser_callback, data->account); - if (!idata->sb) { - - purple_debug_error("bonjour", - "Unable to initialize service browser. Error: %s.\n", - avahi_strerror(avahi_client_errno(idata->client))); - return FALSE; - } - - return TRUE; -} - -gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) { - AvahiSessionImplData *idata = data->mdns_impl_data; - - if (idata == NULL || idata->client == NULL) - return FALSE; - - if (avatar_data != NULL) { - gboolean new_group = FALSE; - gchar *svc_name; - int ret; - AvahiPublishFlags flags = 0; - - if (idata->buddy_icon_group == NULL) { - purple_debug_info("bonjour", "Setting new buddy icon.\n"); - new_group = TRUE; - - idata->buddy_icon_group = avahi_entry_group_new(idata->client, - _buddy_icon_group_cb, data); - } else { - purple_debug_info("bonjour", "Updating existing buddy icon.\n"); - flags |= AVAHI_PUBLISH_UPDATE; - } - - if (idata->buddy_icon_group == NULL) { - purple_debug_error("bonjour", - "Unable to initialize the buddy icon group (%s).\n", - avahi_strerror(avahi_client_errno(idata->client))); - return FALSE; - } - - svc_name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", - purple_account_get_username(data->account)); - - ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, flags, svc_name, - AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 120, avatar_data, avatar_len); - - g_free(svc_name); - - if (ret < 0) { - purple_debug_error("bonjour", - "Failed to register buddy icon. Error: %s\n", avahi_strerror(ret)); - if (new_group) { - avahi_entry_group_free(idata->buddy_icon_group); - idata->buddy_icon_group = NULL; - } - return FALSE; - } - - if (new_group && (ret = avahi_entry_group_commit(idata->buddy_icon_group)) < 0) { - purple_debug_error("bonjour", - "Failed to commit buddy icon group. Error: %s\n", avahi_strerror(ret)); - if (new_group) { - avahi_entry_group_free(idata->buddy_icon_group); - idata->buddy_icon_group = NULL; - } - return FALSE; - } - } else if (idata->buddy_icon_group != NULL) { - purple_debug_info("bonjour", "Removing existing buddy icon.\n"); - avahi_entry_group_free(idata->buddy_icon_group); - idata->buddy_icon_group = NULL; - } - - return TRUE; -} - -void _mdns_stop(BonjourDnsSd *data) { - AvahiSessionImplData *idata = data->mdns_impl_data; - - if (idata == NULL || idata->client == NULL) - return; - - if (idata->sb != NULL) - avahi_service_browser_free(idata->sb); - - avahi_client_free(idata->client); - avahi_glib_poll_free(idata->glib_poll); - - g_free(idata); - - data->mdns_impl_data = NULL; -} - -void _mdns_init_buddy(BonjourBuddy *buddy) { - buddy->mdns_impl_data = g_new0(AvahiBuddyImplData, 1); -} - -void _mdns_delete_buddy(BonjourBuddy *buddy) { - AvahiBuddyImplData *idata = buddy->mdns_impl_data; - - g_return_if_fail(idata != NULL); - - if (idata->buddy_icon_rec_browser != NULL) - avahi_record_browser_free(idata->buddy_icon_rec_browser); - - while(idata->resolvers != NULL) { - AvahiSvcResolverData *rd = idata->resolvers->data; - _cleanup_resolver_data(rd); - idata->resolvers = g_slist_delete_link(idata->resolvers, idata->resolvers); - } - - g_free(idata); - - buddy->mdns_impl_data = NULL; -} - -void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { - PurpleConnection *conn = purple_account_get_connection(buddy->account); - BonjourData *bd = conn->proto_data; - AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data; - AvahiBuddyImplData *idata = buddy->mdns_impl_data; - gchar *name; - - g_return_if_fail(idata != NULL); - - if (idata->buddy_icon_rec_browser != NULL) - avahi_record_browser_free(idata->buddy_icon_rec_browser); - - purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name); - - name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", buddy->name); - idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC, - AVAHI_PROTO_INET, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0, - _buddy_icon_record_cb, buddy); - g_free(name); - - if (!idata->buddy_icon_rec_browser) { - purple_debug_error("bonjour", - "Unable to initialize buddy icon record browser. Error: %s.\n", - avahi_strerror(avahi_client_errno(session_idata->client))); - } - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,254 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include - -#include "internal.h" -#include "debug.h" - -#include "mdns_common.h" -#include "mdns_interface.h" -#include "bonjour.h" -#include "buddy.h" - - -/** - * Allocate space for the dns-sd data. - */ -BonjourDnsSd * bonjour_dns_sd_new() { - BonjourDnsSd *data = g_new0(BonjourDnsSd, 1); - return data; -} - -/** - * Deallocate the space of the dns-sd data. - */ -void bonjour_dns_sd_free(BonjourDnsSd *data) { - g_free(data->first); - g_free(data->last); - g_free(data->phsh); - g_free(data->status); - g_free(data->vc); - g_free(data->msg); - g_free(data); -} - -#define MAX_TXT_CONSTITUENT_LEN 255 - -/* Make sure that the value isn't longer than it is supposed to be */ -static const char* -get_max_txt_record_value(const char *key, const char *value) -{ - /* "each constituent string of a DNS TXT record is limited to 255 bytes" - * This includes the key and the '=' - */ - static char buffer[MAX_TXT_CONSTITUENT_LEN + 1]; - gchar *end_valid = NULL; - int len = MIN(strlen(value), MAX_TXT_CONSTITUENT_LEN - (strlen(key) + 2)); - - strncpy(buffer, value, len); - - buffer[len] = '\0'; - - /* If we've cut part of a utf-8 character, kill it */ - if (!g_utf8_validate(buffer, -1, (const gchar **)&end_valid)) - *end_valid = '\0'; - - return buffer; -} - -static GSList *generate_presence_txt_records(BonjourDnsSd *data) { - GSList *ret = NULL; - PurpleKeyValuePair *kvp; - char portstring[6]; - const char *jid, *aim, *email; - - /* Convert the port to a string */ - snprintf(portstring, sizeof(portstring), "%d", data->port_p2pj); - - jid = purple_account_get_string(data->account, "jid", NULL); - aim = purple_account_get_string(data->account, "AIM", NULL); - email = purple_account_get_string(data->account, "email", NULL); - -#define _M_ADD_R(k, v) \ - kvp = g_new0(PurpleKeyValuePair, 1); \ - kvp->key = g_strdup(k); \ - kvp->value = g_strdup(get_max_txt_record_value(k, v)); \ - ret = g_slist_prepend(ret, kvp); \ - - /* We should try to follow XEP-0174, but some clients have "issues", so we humor them. - * See http://telepathy.freedesktop.org/wiki/SalutInteroperability - */ - - /* Large TXT records are problematic. - * While it is technically possible for this to exceed a standard 512-byte - * DNS message, it shouldn't happen unless we get wacky data entered for - * some of the freeform fields. It is even less likely to exceed the - * recommended maximum of 1300 bytes. - */ - - /* Needed by iChat */ - _M_ADD_R("txtvers", "1") - /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ - _M_ADD_R("1st", data->first) - /* Needed by Gaim/Pidgin <= 2.0.1 (remove at some point) */ - _M_ADD_R("last", data->last) - /* Needed by Adium */ - _M_ADD_R("port.p2pj", portstring) - /* Needed by iChat, Gaim/Pidgin <= 2.0.1 */ - _M_ADD_R("status", data->status) - _M_ADD_R("node", "libpurple") - _M_ADD_R("ver", VERSION) - /* Currently always set to "!" since we don't support AV and wont ever be in a conference */ - _M_ADD_R("vc", data->vc) - if (email != NULL && *email != '\0') { - _M_ADD_R("email", email) - } - if (jid != NULL && *jid != '\0') { - _M_ADD_R("jid", jid) - } - /* Nonstandard, but used by iChat */ - if (aim != NULL && *aim != '\0') { - _M_ADD_R("AIM", aim) - } - if (data->msg != NULL && *data->msg != '\0') { - _M_ADD_R("msg", data->msg) - } - if (data->phsh != NULL && *data->phsh != '\0') { - _M_ADD_R("phsh", data->phsh) - } - - /* TODO: ext, nick */ - return ret; -} - -static void free_presence_txt_records(GSList *lst) { - PurpleKeyValuePair *kvp; - while(lst) { - kvp = lst->data; - g_free(kvp->key); - g_free(kvp->value); - g_free(kvp); - lst = g_slist_remove(lst, lst->data); - } -} - -static gboolean publish_presence(BonjourDnsSd *data, PublishType type) { - GSList *txt_records; - gboolean ret; - - txt_records = generate_presence_txt_records(data); - ret = _mdns_publish(data, type, txt_records); - free_presence_txt_records(txt_records); - - return ret; -} - -/** - * Send a new dns-sd packet updating our status. - */ -void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message) { - g_free(data->status); - g_free(data->msg); - - data->status = g_strdup(status); - data->msg = g_strdup(status_message); - - /* Update our text record with the new status */ - publish_presence(data, PUBLISH_UPDATE); -} - -/** - * Retrieve the buddy icon blob - */ -void bonjour_dns_sd_retrieve_buddy_icon(BonjourBuddy* buddy) { - _mdns_retrieve_buddy_icon(buddy); -} - -void bonjour_dns_sd_update_buddy_icon(BonjourDnsSd *data) { - PurpleStoredImage *img; - - if ((img = purple_buddy_icons_find_account_icon(data->account))) { - gconstpointer avatar_data; - gsize avatar_len; - - avatar_data = purple_imgstore_get_data(img); - avatar_len = purple_imgstore_get_size(img); - - if (_mdns_set_buddy_icon_data(data, avatar_data, avatar_len)) { - /* The filename is a SHA-1 hash of the data (conveniently what we need) */ - const char *p, *filename = purple_imgstore_get_filename(img); - - g_free(data->phsh); - data->phsh = NULL; - - /* Get rid of the extension */ - p = strchr(filename, '.'); - if (p) - data->phsh = g_strndup(filename, p - filename); - else - purple_debug_error("bonjour", "account buddy icon returned unexpected filename (%s)" - "; unable to extract hash. Clearing buddy icon\n", filename); - - /* Update our TXT record */ - publish_presence(data, PUBLISH_UPDATE); - } - - purple_imgstore_unref(img); - } else { - /* We need to do this regardless of whether data->phsh is set so that we - * cancel any icons that are currently in the process of being set */ - _mdns_set_buddy_icon_data(data, NULL, 0); - if (data->phsh != NULL) { - /* Clear the buddy icon */ - g_free(data->phsh); - data->phsh = NULL; - /* Update our TXT record */ - publish_presence(data, PUBLISH_UPDATE); - } - } -} - -/** - * Advertise our presence within the dns-sd daemon and start browsing - * for other bonjour peers. - */ -gboolean bonjour_dns_sd_start(BonjourDnsSd *data) { - - /* Initialize the dns-sd data and session */ - if (!_mdns_init_session(data)) - return FALSE; - - /* Publish our bonjour IM client at the mDNS daemon */ - if (!publish_presence(data, PUBLISH_START)) - return FALSE; - - /* Advise the daemon that we are waiting for connections */ - if (!_mdns_browse(data)) { - purple_debug_error("bonjour", "Unable to get service.\n"); - return FALSE; - } - - return TRUE; -} - -/** - * Unregister the "_presence._tcp" service at the mDNS daemon. - */ - -void bonjour_dns_sd_stop(BonjourDnsSd *data) { - _mdns_stop(data); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_common.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_MDNS_COMMON -#define _BONJOUR_MDNS_COMMON - -#include "mdns_types.h" - -#include "buddy.h" - -/** - * Allocate space for the dns-sd data. - */ -BonjourDnsSd *bonjour_dns_sd_new(void); - -/** - * Deallocate the space of the dns-sd data. - */ -void bonjour_dns_sd_free(BonjourDnsSd *data); - -/** - * Send a new dns-sd packet updating our status. - */ -void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message); - -/** - * Retrieve the buddy icon blob - */ -void bonjour_dns_sd_retrieve_buddy_icon(BonjourBuddy* buddy); - -/** - * Deal with a buddy icon update - */ -void bonjour_dns_sd_update_buddy_icon(BonjourDnsSd *data); - -/** - * Advertise our presence within the dns-sd daemon and start - * browsing for other bonjour peers. - */ -gboolean bonjour_dns_sd_start(BonjourDnsSd *data); - -/** - * Unregister the "_presence._tcp" service at the mDNS daemon. - */ -void bonjour_dns_sd_stop(BonjourDnsSd *data); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_interface.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_interface.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_interface.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_interface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_MDNS_INTERFACE -#define _BONJOUR_MDNS_INTERFACE - -#include "mdns_types.h" -#include "buddy.h" - -gboolean _mdns_init_session(BonjourDnsSd *data); - -gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records); - -gboolean _mdns_browse(BonjourDnsSd *data); - -void _mdns_stop(BonjourDnsSd *data); - -gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len); - -void _mdns_init_buddy(BonjourBuddy *buddy); - -void _mdns_delete_buddy(BonjourBuddy *buddy); - -void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_types.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_types.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_types.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_types.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#ifndef _BONJOUR_MDNS_TYPES -#define _BONJOUR_MDNS_TYPES - -#include -#include "account.h" - -#define LINK_LOCAL_RECORD_NAME "_presence._tcp." - -/** - * Data to be used by the dns-sd connection. - */ -typedef struct _BonjourDnsSd { - gpointer mdns_impl_data; - PurpleAccount *account; - gchar *first; - gchar *last; - gint port_p2pj; - gchar *phsh; - gchar *status; - gchar *vc; - gchar *msg; -} BonjourDnsSd; - -typedef enum _PublishType { - PUBLISH_START, - PUBLISH_UPDATE -} PublishType; - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_win32.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_win32.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_win32.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/mdns_win32.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,653 +0,0 @@ -/* - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -#include "internal.h" -#include "debug.h" - -#include "buddy.h" -#include "mdns_interface.h" -#include "dns_sd_proxy.h" -#include "dnsquery.h" -#include "mdns_common.h" - -static GSList *pending_buddies = NULL; - -typedef struct _dnssd_service_ref_handler { - DNSServiceRef sdRef; - PurpleAccount *account; - guint input_handler; -} DnsSDServiceRefHandlerData; - -/* data used by win32 bonjour implementation */ -typedef struct _win32_session_impl_data { - DnsSDServiceRefHandlerData *presence_query; - DnsSDServiceRefHandlerData *browser_query; - DNSRecordRef buddy_icon_rec; -} Win32SessionImplData; - -typedef struct _win32_buddy_service_resolver_data { - DnsSDServiceRefHandlerData *txt_query; - uint32_t if_idx; - gchar *name; - gchar *type; - gchar *domain; - /* This is a reference to the entry in BonjourBuddy->ips */ - const char *ip; -} Win32SvcResolverData; - -typedef struct _win32_buddy_impl_data { - GSList *resolvers; - DnsSDServiceRefHandlerData *null_query; -} Win32BuddyImplData; - -/* data structure for the resolve callback */ -typedef struct _ResolveCallbackArgs { - DnsSDServiceRefHandlerData *resolver_query; - PurpleAccount *account; - BonjourBuddy *bb; - Win32SvcResolverData *res_data; - gchar *full_service_name; - PurpleDnsQueryData *dns_query; -} ResolveCallbackArgs; - - -static gint -_find_resolver_data(gconstpointer a, gconstpointer b) { - const Win32SvcResolverData *rd_a = a; - const Win32SvcResolverData *rd_b = b; - gint ret = 1; - - if(rd_a->if_idx == rd_b->if_idx - && !strcmp(rd_a->name, rd_b->name) - && !strcmp(rd_a->type, rd_b->type) - && !strcmp(rd_a->domain, rd_b->domain)) { - ret = 0; - } - - return ret; -} - -static void -_cleanup_resolver_data(Win32SvcResolverData *rd) { - if (rd->txt_query != NULL) { - purple_input_remove(rd->txt_query->input_handler); - DNSServiceRefDeallocate(rd->txt_query->sdRef); - g_free(rd->txt_query); - } - g_free(rd->name); - g_free(rd->type); - g_free(rd->domain); - g_free(rd); -} - -static void -_mdns_handle_event(gpointer data, gint source, PurpleInputCondition condition) { - DnsSDServiceRefHandlerData *srh = data; - DNSServiceErrorType errorCode = DNSServiceProcessResult(srh->sdRef); - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Error (%d) handling mDNS response.\n", errorCode); - /* This happens when the mDNSResponder goes down, I haven't seen it happen any other time (in my limited testing) */ - if (errorCode == kDNSServiceErr_Unknown) { - purple_connection_error_reason(srh->account->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error communicating with local mDNSResponder.")); - } - } -} - -static void -_mdns_parse_text_record(BonjourBuddy *buddy, const char *record, uint16_t record_len) -{ - const char *txt_entry; - uint8_t txt_len; - int i; - - clear_bonjour_buddy_values(buddy); - for (i = 0; buddy_TXT_records[i] != NULL; i++) { - txt_entry = TXTRecordGetValuePtr(record_len, record, buddy_TXT_records[i], &txt_len); - if (txt_entry != NULL) - set_bonjour_buddy_value(buddy, buddy_TXT_records[i], txt_entry, txt_len); - } -} - -static void DNSSD_API -_mdns_record_query_callback(DNSServiceRef DNSServiceRef, DNSServiceFlags flags, - uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullname, - uint16_t rrtype, uint16_t rrclass, uint16_t rdlen, const void *rdata, - uint32_t ttl, void *context) -{ - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "record query - callback error.\n"); - /* TODO: Probably should remove the buddy when this happens */ - } else if (flags & kDNSServiceFlagsAdd) { - if (rrtype == kDNSServiceType_TXT) { - /* New Buddy */ - BonjourBuddy *bb = (BonjourBuddy*) context; - _mdns_parse_text_record(bb, rdata, rdlen); - bonjour_buddy_add_to_purple(bb, NULL); - } else if (rrtype == kDNSServiceType_NULL) { - /* Buddy Icon response */ - BonjourBuddy *bb = (BonjourBuddy*) context; - Win32BuddyImplData *idata = bb->mdns_impl_data; - - g_return_if_fail(idata != NULL); - - bonjour_buddy_got_buddy_icon(bb, rdata, rdlen); - - /* We've got what we need; stop listening */ - purple_input_remove(idata->null_query->input_handler); - DNSServiceRefDeallocate(idata->null_query->sdRef); - g_free(idata->null_query); - idata->null_query = NULL; - } - } -} - -static void -_mdns_resolve_host_callback(GSList *hosts, gpointer data, const char *error_message) -{ - ResolveCallbackArgs *args = (ResolveCallbackArgs*) data; - Win32BuddyImplData *idata = args->bb->mdns_impl_data; - gboolean delete_buddy = FALSE; - PurpleBuddy *pb = NULL; - - if ((pb = purple_find_buddy(args->account, args->res_data->name))) { - if (pb->proto_data != args->bb) { - purple_debug_error("bonjour", "Found purple buddy for %s not matching bonjour buddy record.", - args->res_data->name); - goto cleanup; - } - /* Make sure that the BonjourBuddy associated with this request is still around */ - } else if (g_slist_find(pending_buddies, args->bb) == NULL) { - purple_debug_error("bonjour", "host resolution - complete, but buddy no longer pending.\n"); - goto cleanup; - } - - if (!hosts || !hosts->data) { - purple_debug_error("bonjour", "host resolution - callback error.\n"); - delete_buddy = TRUE; - } else { - struct sockaddr_in *addr = g_slist_nth_data(hosts, 1); - DNSServiceErrorType errorCode; - DNSServiceRef txt_query_sr; - - /* finally, set up the continuous txt record watcher, and add the buddy to purple */ - errorCode = DNSServiceQueryRecord(&txt_query_sr, kDNSServiceFlagsLongLivedQuery, - kDNSServiceInterfaceIndexAny, args->full_service_name, kDNSServiceType_TXT, - kDNSServiceClass_IN, _mdns_record_query_callback, args->bb); - if (errorCode == kDNSServiceErr_NoError) { - const char *ip = inet_ntoa(addr->sin_addr); - - purple_debug_info("bonjour", "Found buddy %s at %s:%d\n", args->bb->name, ip, args->bb->port_p2pj); - - args->bb->ips = g_slist_prepend(args->bb->ips, g_strdup(ip)); - args->res_data->ip = args->bb->ips->data; - - args->res_data->txt_query = g_new(DnsSDServiceRefHandlerData, 1); - args->res_data->txt_query->sdRef = txt_query_sr; - args->res_data->txt_query->account = args->account; - - args->res_data->txt_query->input_handler = purple_input_add(DNSServiceRefSockFD(txt_query_sr), - PURPLE_INPUT_READ, _mdns_handle_event, args->res_data->txt_query); - - bonjour_buddy_add_to_purple(args->bb, NULL); - } else { - purple_debug_error("bonjour", "Unable to set up record watcher for buddy %s (%d)\n", args->bb->name, errorCode); - delete_buddy = TRUE; - } - - } - - cleanup: - - /* free the hosts list*/ - while (hosts != NULL) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - if (delete_buddy) { - idata->resolvers = g_slist_remove(idata->resolvers, args->res_data); - _cleanup_resolver_data(args->res_data); - - /* If this was the last resolver, remove the buddy */ - if (idata->resolvers == NULL) { - if (pb) - bonjour_buddy_signed_off(pb); - else - bonjour_buddy_delete(args->bb); - - /* Remove from the pending list */ - pending_buddies = g_slist_remove(pending_buddies, args->bb); - } - } else { - /* Remove from the pending list */ - pending_buddies = g_slist_remove(pending_buddies, args->bb); - } - - /* free the remaining args memory */ - g_free(args->full_service_name); - g_free(args); -} - -static void DNSSD_API -_mdns_service_resolve_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, - const char *fullname, const char *hosttarget, uint16_t port, uint16_t txtLen, const char *txtRecord, void *context) -{ - ResolveCallbackArgs *args = (ResolveCallbackArgs*) context; - Win32BuddyImplData *idata = args->bb->mdns_impl_data; - - /* remove the input fd and destroy the service ref */ - purple_input_remove(args->resolver_query->input_handler); - DNSServiceRefDeallocate(args->resolver_query->sdRef); - g_free(args->resolver_query); - args->resolver_query = NULL; - - if (errorCode != kDNSServiceErr_NoError) - purple_debug_error("bonjour", "service resolver - callback error.\n"); - else { - /* set more arguments, and start the host resolver */ - - if ((args->dns_query = - purple_dnsquery_a(hosttarget, port, _mdns_resolve_host_callback, args)) != NULL) { - - args->full_service_name = g_strdup(fullname); - - /* TODO: Should this be per resolver? */ - args->bb->port_p2pj = ntohs(port); - - /* We don't want to hit the cleanup code */ - return; - } else - purple_debug_error("bonjour", "service resolver - host resolution failed.\n"); - } - - /* If we get this far, clean up */ - - idata->resolvers = g_slist_remove(idata->resolvers, args->res_data); - _cleanup_resolver_data(args->res_data); - - /* If this was the last resolver, remove the buddy */ - if (idata->resolvers == NULL) { - PurpleBuddy *pb; - /* See if this is now attached to a PurpleBuddy */ - if ((pb = purple_find_buddy(args->account, args->bb->name))) - bonjour_buddy_signed_off(pb); - else { - /* Remove from the pending list */ - pending_buddies = g_slist_remove(pending_buddies, args->bb); - bonjour_buddy_delete(args->bb); - } - } - - g_free(args); - -} - -static void DNSSD_API -_mdns_service_register_callback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, - const char *name, const char *regtype, const char *domain, void *context) { - - /* TODO: deal with collision */ - if (errorCode != kDNSServiceErr_NoError) - purple_debug_error("bonjour", "service advertisement - callback error (%d).\n", errorCode); - else - purple_debug_info("bonjour", "service advertisement - callback.\n"); -} - -static void DNSSD_API -_mdns_service_browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, - DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) -{ - PurpleAccount *account = (PurpleAccount*)context; - - if (errorCode != kDNSServiceErr_NoError) - purple_debug_error("bonjour", "service browser - callback error (%d)\n", errorCode); - else if (flags & kDNSServiceFlagsAdd) { - /* A presence service instance has been discovered... check it isn't us! */ - if (purple_utf8_strcasecmp(serviceName, account->username) != 0) { - DNSServiceErrorType resErrorCode; - /* OK, lets go ahead and resolve it to add to the buddy list */ - ResolveCallbackArgs *args = g_new0(ResolveCallbackArgs, 1); - DNSServiceRef resolver_sr; - - purple_debug_info("bonjour", "Received new record for '%s' on iface %u (%s, %s)\n", - serviceName, interfaceIndex, regtype ? regtype : "", - replyDomain ? replyDomain : ""); - - resErrorCode = DNSServiceResolve(&resolver_sr, 0, 0, serviceName, regtype, - replyDomain, _mdns_service_resolve_callback, args); - if (resErrorCode == kDNSServiceErr_NoError) { - GSList *tmp = pending_buddies; - PurpleBuddy *pb; - BonjourBuddy* bb = NULL; - Win32SvcResolverData *rd; - Win32BuddyImplData *idata; - - /* Is there an existing buddy? */ - if ((pb = purple_find_buddy(account, serviceName))) - bb = pb->proto_data; - /* Is there a pending buddy? */ - else { - while (tmp) { - BonjourBuddy *bb_tmp = tmp->data; - if (!strcmp(bb_tmp->name, serviceName)) { - bb = bb_tmp; - break; - } - tmp = tmp->next; - } - } - - if (bb == NULL) { - bb = bonjour_buddy_new(serviceName, account); - - /* This is only necessary for the wacky case where someone previously manually added a buddy. */ - if (pb == NULL) - pending_buddies = g_slist_prepend(pending_buddies, bb); - else - pb->proto_data = bb; - } - - rd = g_new0(Win32SvcResolverData, 1); - rd->if_idx = interfaceIndex; - rd->name = g_strdup(serviceName); - rd->type = g_strdup(regtype); - rd->domain = g_strdup(replyDomain); - - idata = bb->mdns_impl_data; - idata->resolvers = g_slist_prepend(idata->resolvers, rd); - - args->bb = bb; - args->res_data = rd; - args->account = account; - - args->resolver_query = g_new(DnsSDServiceRefHandlerData, 1); - args->resolver_query->sdRef = resolver_sr; - args->resolver_query->account = account; - /* get a file descriptor for this service ref, and add it to the input list */ - args->resolver_query->input_handler = purple_input_add(DNSServiceRefSockFD(resolver_sr), - PURPLE_INPUT_READ, _mdns_handle_event, args->resolver_query); - } else { - purple_debug_error("bonjour", "service browser - failed to resolve service. (%d)\n", resErrorCode); - g_free(args); - } - } - } else { - PurpleBuddy *pb = NULL; - - /* A peer has sent a goodbye packet, remove them from the buddy list */ - purple_debug_info("bonjour", "Received remove notification for '%s' on iface %u (%s, %s)\n", - serviceName, interfaceIndex, regtype ? regtype : "", - replyDomain ? replyDomain : ""); - - pb = purple_find_buddy(account, serviceName); - if (pb != NULL) { - GSList *l; - /* There may be multiple presences, we should only get rid of this one */ - Win32SvcResolverData *rd_search; - BonjourBuddy *bb = pb->proto_data; - Win32BuddyImplData *idata; - - g_return_if_fail(bb != NULL); - - idata = bb->mdns_impl_data; - - rd_search = g_new0(Win32SvcResolverData, 1); - rd_search->if_idx = interfaceIndex; - rd_search->name = (gchar *) serviceName; - rd_search->type = (gchar *) regtype; - rd_search->domain = (gchar *) replyDomain; - - l = g_slist_find_custom(idata->resolvers, rd_search, _find_resolver_data); - - g_free(rd_search); - - if (l != NULL) { - Win32SvcResolverData *rd = l->data; - idata->resolvers = g_slist_delete_link(idata->resolvers, l); - /* This IP is no longer available */ - if (rd->ip != NULL) { - bb->ips = g_slist_remove(bb->ips, rd->ip); - g_free((gchar *) rd->ip); - } - _cleanup_resolver_data(rd); - - /* If this was the last resolver, remove the buddy */ - if (idata->resolvers == NULL) { - purple_debug_info("bonjour", "Removed last presence for buddy '%s'; signing off buddy.\n", - serviceName); - bonjour_buddy_signed_off(pb); - } - } - } else { - purple_debug_warning("bonjour", "Unable to find buddy (%s) to remove\n", serviceName ? serviceName : "(null)"); - /* TODO: Should we look in the pending buddies list? */ - } - } -} - -/**************************** - * mdns_interface functions * - ****************************/ - -gboolean _mdns_init_session(BonjourDnsSd *data) { - data->mdns_impl_data = g_new0(Win32SessionImplData, 1); - return TRUE; -} - -gboolean _mdns_publish(BonjourDnsSd *data, PublishType type, GSList *records) { - TXTRecordRef dns_data; - gboolean ret = TRUE; - DNSServiceErrorType errorCode = kDNSServiceErr_NoError; - Win32SessionImplData *idata = data->mdns_impl_data; - - g_return_val_if_fail(idata != NULL, FALSE); - - TXTRecordCreate(&dns_data, 256, NULL); - - while (records) { - PurpleKeyValuePair *kvp = records->data; - errorCode = TXTRecordSetValue(&dns_data, kvp->key, strlen(kvp->value), kvp->value); - if (errorCode != kDNSServiceErr_NoError) - break; - records = records->next; - } - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Unable to allocate memory for text record.(%d)\n", errorCode); - ret = FALSE; - } else { - /* OK, we're done constructing the text record, (re)publish the service */ - DNSServiceRef presence_sr; - - switch (type) { - case PUBLISH_START: - purple_debug_info("bonjour", "Registering presence on port %d\n", data->port_p2pj); - errorCode = DNSServiceRegister(&presence_sr, 0, 0, purple_account_get_username(data->account), LINK_LOCAL_RECORD_NAME, - NULL, NULL, htons(data->port_p2pj), TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), - _mdns_service_register_callback, NULL); - break; - - case PUBLISH_UPDATE: - purple_debug_info("bonjour", "Updating presence.\n"); - errorCode = DNSServiceUpdateRecord(idata->presence_query->sdRef, NULL, 0, TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data), 0); - break; - } - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Failed to publish presence service.(%d)\n", errorCode); - ret = FALSE; - } else if (type == PUBLISH_START) { - /* We need to do this because according to the Apple docs: - * "the client is responsible for ensuring that DNSServiceProcessResult() is called - * whenever there is a reply from the daemon - the daemon may terminate its connection - * with a client that does not process the daemon's responses */ - idata->presence_query = g_new(DnsSDServiceRefHandlerData, 1); - idata->presence_query->sdRef = presence_sr; - idata->presence_query->account = data->account; - idata->presence_query->input_handler = purple_input_add(DNSServiceRefSockFD(presence_sr), - PURPLE_INPUT_READ, _mdns_handle_event, idata->presence_query); - } - } - - /* Free the memory used by temp data */ - TXTRecordDeallocate(&dns_data); - return ret; -} - -gboolean _mdns_browse(BonjourDnsSd *data) { - DNSServiceErrorType errorCode; - Win32SessionImplData *idata = data->mdns_impl_data; - DNSServiceRef browser_sr; - - g_return_val_if_fail(idata != NULL, FALSE); - - errorCode = DNSServiceBrowse(&browser_sr, 0, 0, LINK_LOCAL_RECORD_NAME, NULL, - _mdns_service_browse_callback, data->account); - if (errorCode == kDNSServiceErr_NoError) { - idata->browser_query = g_new(DnsSDServiceRefHandlerData, 1); - idata->browser_query->sdRef = browser_sr; - idata->browser_query->account = data->account; - idata->browser_query->input_handler = purple_input_add(DNSServiceRefSockFD(browser_sr), - PURPLE_INPUT_READ, _mdns_handle_event, idata->browser_query); - return TRUE; - } else - purple_debug_error("bonjour", "Error registering Local Link presence browser. (%d)\n", errorCode); - - - return FALSE; -} - -void _mdns_stop(BonjourDnsSd *data) { - Win32SessionImplData *idata = data->mdns_impl_data; - - if (idata == NULL) - return; - - if (idata->presence_query != NULL) { - purple_input_remove(idata->presence_query->input_handler); - DNSServiceRefDeallocate(idata->presence_query->sdRef); - g_free(idata->presence_query); - } - - if (idata->browser_query != NULL) { - purple_input_remove(idata->browser_query->input_handler); - DNSServiceRefDeallocate(idata->browser_query->sdRef); - g_free(idata->browser_query); - } - - g_free(idata); - - data->mdns_impl_data = NULL; -} - -gboolean _mdns_set_buddy_icon_data(BonjourDnsSd *data, gconstpointer avatar_data, gsize avatar_len) { - Win32SessionImplData *idata = data->mdns_impl_data; - DNSServiceErrorType errorCode = kDNSServiceErr_NoError; - - g_return_val_if_fail(idata != NULL, FALSE); - - if (avatar_data != NULL && idata->buddy_icon_rec == NULL) { - purple_debug_info("bonjour", "Setting new buddy icon.\n"); - errorCode = DNSServiceAddRecord(idata->presence_query->sdRef, &idata->buddy_icon_rec, - 0, kDNSServiceType_NULL, avatar_len, avatar_data, 0); - } else if (avatar_data != NULL) { - purple_debug_info("bonjour", "Updating existing buddy icon.\n"); - errorCode = DNSServiceUpdateRecord(idata->presence_query->sdRef, idata->buddy_icon_rec, - 0, avatar_len, avatar_data, 0); - } else if (idata->buddy_icon_rec != NULL) { - purple_debug_info("bonjour", "Removing existing buddy icon.\n"); - errorCode = DNSServiceRemoveRecord(idata->presence_query->sdRef, idata->buddy_icon_rec, 0); - idata->buddy_icon_rec = NULL; - } - - if (errorCode != kDNSServiceErr_NoError) { - purple_debug_error("bonjour", "Error (%d) setting buddy icon record.\n", errorCode); - return FALSE; - } - - return TRUE; -} - -void _mdns_init_buddy(BonjourBuddy *buddy) { - buddy->mdns_impl_data = g_new0(Win32BuddyImplData, 1); -} - -void _mdns_delete_buddy(BonjourBuddy *buddy) { - Win32BuddyImplData *idata = buddy->mdns_impl_data; - - g_return_if_fail(idata != NULL); - - while (idata->resolvers) { - Win32SvcResolverData *rd = idata->resolvers->data; - _cleanup_resolver_data(rd); - idata->resolvers = g_slist_delete_link(idata->resolvers, idata->resolvers); - } - - if (idata->null_query != NULL) { - purple_input_remove(idata->null_query->input_handler); - DNSServiceRefDeallocate(idata->null_query->sdRef); - g_free(idata->null_query); - } - - g_free(idata); - - buddy->mdns_impl_data = NULL; -} - -void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) { - Win32BuddyImplData *idata = buddy->mdns_impl_data; - char svc_name[kDNSServiceMaxDomainName]; - - g_return_if_fail(idata != NULL); - - /* Cancel any existing query */ - if (idata->null_query != NULL) { - purple_input_remove(idata->null_query->input_handler); - DNSServiceRefDeallocate(idata->null_query->sdRef); - g_free(idata->null_query); - idata->null_query = NULL; - } - - if (DNSServiceConstructFullName(svc_name, buddy->name, LINK_LOCAL_RECORD_NAME, "local") != 0) - purple_debug_error("bonjour", "Unable to construct full name to retrieve buddy icon for %s.\n", buddy->name); - else { - DNSServiceRef null_query_sr; - - DNSServiceErrorType errorCode = DNSServiceQueryRecord(&null_query_sr, 0, kDNSServiceInterfaceIndexAny, - svc_name, kDNSServiceType_NULL, kDNSServiceClass_IN, _mdns_record_query_callback, buddy); - - if (errorCode == kDNSServiceErr_NoError) { - idata->null_query = g_new(DnsSDServiceRefHandlerData, 1); - - idata->null_query->sdRef = null_query_sr; - idata->null_query->account = buddy->account; - - idata->null_query->input_handler = purple_input_add(DNSServiceRefSockFD(null_query_sr), - PURPLE_INPUT_READ, _mdns_handle_event, idata->null_query); - } else - purple_debug_error("bonjour", "Unable to query buddy icon record for %s. (%d)\n", buddy->name, errorCode); - } - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,257 +0,0 @@ -/* - * purple - Bonjour Jabber XML parser stuff - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include - -#include "connection.h" -#include "debug.h" -#include "jabber.h" -#include "parser.h" -#include "util.h" -#include "xmlnode.h" - -static gboolean -parse_from_attrib_and_find_buddy(BonjourJabberConversation *bconv, int nb_attributes, const xmlChar **attributes) { - int i; - - /* If the "from" attribute is specified, attach it to the conversation. */ - for(i=0; i < nb_attributes * 5; i+=5) { - if(!xmlStrcmp(attributes[i], (xmlChar*) "from")) { - int len = attributes[i+4] - attributes[i+3]; - bconv->buddy_name = g_strndup((char *)attributes[i+3], len); - bonjour_jabber_conv_match_by_name(bconv); - - return (bconv->pb != NULL); - } - } - - return FALSE; -} - -static char *purple_unescape_text(const char *in) -{ - GString *ret; - const char *c = in; - - if (in == NULL) - return NULL; - - ret = g_string_new(""); - while (*c) { - int len; - const char *ent; - - if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { - g_string_append(ret, ent); - c += len; - } else { - g_string_append_c(ret, *c); - c++; - } - } - - return g_string_free(ret, FALSE); -} - -static void -bonjour_parser_element_start_libxml(void *user_data, - const xmlChar *element_name, const xmlChar *prefix, const xmlChar *namespace, - int nb_namespaces, const xmlChar **namespaces, - int nb_attributes, int nb_defaulted, const xmlChar **attributes) -{ - BonjourJabberConversation *bconv = user_data; - - xmlnode *node; - int i; - - g_return_if_fail(element_name != NULL); - - if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { - if(!bconv->recv_stream_start) { - bconv->recv_stream_start = TRUE; - - if (bconv->pb == NULL) - parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes); - - bonjour_jabber_stream_started(bconv); - } - } else { - - /* If we haven't yet attached a buddy and this isn't "", - * try to get a "from" attribute as a last resort to match our buddy. */ - if(bconv->pb == NULL - && !(prefix && !xmlStrcmp(prefix, (xmlChar*) "stream") - && !xmlStrcmp(element_name, (xmlChar*) "features")) - && !parse_from_attrib_and_find_buddy(bconv, nb_attributes, attributes)) - /* We've run out of options for finding who the conversation is from - using explicitly specified stuff; see if we can make a good match - by using the IP */ - bonjour_jabber_conv_match_by_ip(bconv); - - if(bconv->current) - node = xmlnode_new_child(bconv->current, (const char*) element_name); - else - node = xmlnode_new((const char*) element_name); - xmlnode_set_namespace(node, (const char*) namespace); - - for(i=0; i < nb_attributes * 5; i+=5) { - const char *name = (const char *)attributes[i]; - const char *prefix = (const char *)attributes[i+1]; - const char *attrib_ns = (const char *)attributes[i+2]; - char *txt; - int attrib_len = attributes[i+4] - attributes[i+3]; - char *attrib = g_malloc(attrib_len + 1); - - memcpy(attrib, attributes[i+3], attrib_len); - attrib[attrib_len] = '\0'; - - txt = attrib; - attrib = purple_unescape_text(txt); - g_free(txt); - xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); - g_free(attrib); - } - - bconv->current = node; - } -} - -static void -bonjour_parser_element_end_libxml(void *user_data, const xmlChar *element_name, - const xmlChar *prefix, const xmlChar *namespace) -{ - BonjourJabberConversation *bconv = user_data; - - if(!bconv->current) { - /* We don't keep a reference to the start stream xmlnode, - * so we have to check for it here to close the conversation */ - if(!xmlStrcmp(element_name, (xmlChar*) "stream")) - /* Asynchronously close the conversation to prevent bonjour_parser_setup() - * being called from within this context */ - async_bonjour_jabber_close_conversation(bconv); - return; - } - - if(bconv->current->parent) { - if(!xmlStrcmp((xmlChar*) bconv->current->name, element_name)) - bconv->current = bconv->current->parent; - } else { - xmlnode *packet = bconv->current; - bconv->current = NULL; - bonjour_jabber_process_packet(bconv->pb, packet); - xmlnode_free(packet); - } -} - -static void -bonjour_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) -{ - BonjourJabberConversation *bconv = user_data; - - if(!bconv->current) - return; - - if(!text || !text_len) - return; - - xmlnode_insert_data(bconv->current, (const char*) text, text_len); -} - -static void -bonjour_parser_structured_error_handler(void *user_data, xmlErrorPtr error) -{ - BonjourJabberConversation *bconv = user_data; - - purple_debug_error("jabber", "XML parser error for BonjourJabberConversation %p: " - "Domain %i, code %i, level %i: %s", - bconv, - error->domain, error->code, error->level, - (error->message ? error->message : "(null)\n")); -} - -static xmlSAXHandler bonjour_parser_libxml = { - NULL, /*internalSubset*/ - NULL, /*isStandalone*/ - NULL, /*hasInternalSubset*/ - NULL, /*hasExternalSubset*/ - NULL, /*resolveEntity*/ - NULL, /*getEntity*/ - NULL, /*entityDecl*/ - NULL, /*notationDecl*/ - NULL, /*attributeDecl*/ - NULL, /*elementDecl*/ - NULL, /*unparsedEntityDecl*/ - NULL, /*setDocumentLocator*/ - NULL, /*startDocument*/ - NULL, /*endDocument*/ - NULL, /*startElement*/ - NULL, /*endElement*/ - NULL, /*reference*/ - bonjour_parser_element_text_libxml, /*characters*/ - NULL, /*ignorableWhitespace*/ - NULL, /*processingInstruction*/ - NULL, /*comment*/ - NULL, /*warning*/ - NULL, /*error*/ - NULL, /*fatalError*/ - NULL, /*getParameterEntity*/ - NULL, /*cdataBlock*/ - NULL, /*externalSubset*/ - XML_SAX2_MAGIC, /*initialized*/ - NULL, /*_private*/ - bonjour_parser_element_start_libxml, /*startElementNs*/ - bonjour_parser_element_end_libxml, /*endElementNs*/ - bonjour_parser_structured_error_handler /*serror*/ -}; - -void -bonjour_parser_setup(BonjourJabberConversation *bconv) -{ - - /* This seems backwards, but it makes sense. The libxml code creates - * the parser context when you try to use it (this way, it can figure - * out the encoding at creation time. So, setting up the parser is - * just a matter of destroying any current parser. */ - if (bconv->context) { - xmlParseChunk(bconv->context, NULL,0,1); - xmlFreeParserCtxt(bconv->context); - bconv->context = NULL; - } -} - - -void bonjour_parser_process(BonjourJabberConversation *bconv, const char *buf, int len) -{ - - if (bconv->context == NULL) { - /* libxml inconsistently starts parsing on creating the - * parser, so do a ParseChunk right afterwards to force it. */ - bconv->context = xmlCreatePushParserCtxt(&bonjour_parser_libxml, bconv, buf, len, NULL); - xmlParseChunk(bconv->context, "", 0, 0); - } else if (xmlParseChunk(bconv->context, buf, len, 0) < 0) - /* TODO: What should we do here - I assume we should display an error or something (maybe just print something to the conv?) */ - purple_debug_error("bonjour", "Error parsing xml.\n"); - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/bonjour/parser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/** - * @file parser.h Bonjour Jabber XML parser functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_BONJOUR_PARSER_H_ -#define _PURPLE_BONJOUR_PARSER_H_ - -#include "buddy.h" -#include "jabber.h" - -void bonjour_parser_setup(BonjourJabberConversation *bconv); -void bonjour_parser_process(BonjourJabberConversation *bconv, const char *buf, int len); - -#endif /* _PURPLE_BONJOUR_PARSER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -/** - * @file buddylist.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include - -#include "gg.h" -#include "gg-utils.h" -#include "buddylist.h" - -#define F_FIRSTNAME 0 -#define F_LASTNAME 1 -/* #define F_ 2 */ -#define F_NICKNAME 3 -#define F_PHONE 4 -#define F_GROUP 5 -#define F_UIN 6 - -/* void ggp_buddylist_send(PurpleConnection *gc) {{{ */ -void ggp_buddylist_send(PurpleConnection *gc) -{ - GGPInfo *info = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - GSList *buddies; - uin_t *userlist; - gchar *types; - int i = 0, ret = 0; - int size; - - buddies = purple_find_buddies(account, NULL); - - size = g_slist_length(buddies); - userlist = g_new(uin_t, size); - types = g_new(gchar, size); - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies), ++i) - { - PurpleBuddy *buddy = buddies->data; - const gchar *name = purple_buddy_get_name(buddy); - - userlist[i] = ggp_str_to_uin(name); - types[i] = GG_USER_NORMAL; - purple_debug_info("gg", "ggp_buddylist_send: adding %d\n", - userlist[i]); - } - - ret = gg_notify_ex(info->session, userlist, types, size); - purple_debug_info("gg", "send: ret=%d; size=%d\n", ret, size); - - if (userlist) { - g_free(userlist); - g_free(types); - } -} -/* }}} */ - -/* void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) {{{ */ -void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) -{ - PurpleBuddy *buddy; - PurpleGroup *group; - gchar **users_tbl; - int i; - char *utf8buddylist = charset_convert(buddylist, "CP1250", "UTF-8"); - - /* Don't limit the number of records in a buddylist. */ - users_tbl = g_strsplit(utf8buddylist, "\r\n", -1); - - for (i = 0; users_tbl[i] != NULL; i++) { - gchar **data_tbl; - gchar *name, *show, *g; - - if (strlen(users_tbl[i]) == 0) - continue; - - data_tbl = g_strsplit(users_tbl[i], ";", 8); - if (ggp_array_size(data_tbl) < 8) { - purple_debug_warning("gg", - "Something is wrong on line %d of the buddylist. Skipping.\n", - i + 1); - continue; - } - - show = data_tbl[F_NICKNAME]; - name = data_tbl[F_UIN]; - if ('\0' == *name || !atol(name)) { - purple_debug_warning("gg", - "Identifier on line %d of the buddylist is not a number. Skipping.\n", - i + 1); - continue; - } - - if ('\0' == *show) { - show = name; - } - - purple_debug_info("gg", "got buddy: name=%s; show=%s\n", name, show); - - if (purple_find_buddy(purple_connection_get_account(gc), name)) { - g_strfreev(data_tbl); - continue; - } - - g = g_strdup("Gadu-Gadu"); - - if ('\0' != data_tbl[F_GROUP]) { - /* XXX: Probably buddy should be added to all the groups. */ - /* Hard limit to at most 50 groups */ - gchar **group_tbl = g_strsplit(data_tbl[F_GROUP], ",", 50); - if (ggp_array_size(group_tbl) > 0) { - g_free(g); - g = g_strdup(group_tbl[0]); - } - g_strfreev(group_tbl); - } - - buddy = purple_buddy_new(purple_connection_get_account(gc), name, - strlen(show) ? show : NULL); - - if (!(group = purple_find_group(g))) { - group = purple_group_new(g); - purple_blist_add_group(group, NULL); - } - - purple_blist_add_buddy(buddy, NULL, group, NULL); - g_free(g); - - g_strfreev(data_tbl); - } - g_strfreev(users_tbl); - g_free(utf8buddylist); - - ggp_buddylist_send(gc); -} -/* }}} */ - -/* char *ggp_buddylist_dump(PurpleAccount *account) {{{ */ -char *ggp_buddylist_dump(PurpleAccount *account) -{ - GSList *buddies; - GString *buddylist = g_string_sized_new(1024); - char *ptr; - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *buddy = buddies->data; - PurpleGroup *group = purple_buddy_get_group(buddy); - const char *bname = purple_buddy_get_name(buddy); - const char *gname = purple_group_get_name(group); - const char *alias = purple_buddy_get_alias(buddy); - - if (alias == NULL) - alias = bname; - - g_string_append_printf(buddylist, - "%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", - alias, alias, alias, alias, - "", gname, bname, "", ""); - } - - ptr = charset_convert(buddylist->str, "UTF-8", "CP1250"); - g_string_free(buddylist, TRUE); - return ptr; -} -/* }}} */ - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/buddylist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file buddylist.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_BUDDYLIST_H -#define _PURPLE_GG_BUDDYLIST_H - -#include "connection.h" -#include "account.h" - -void -ggp_buddylist_send(PurpleConnection *gc); - -/** - * Load buddylist from server into the roster. - * - * @param gc PurpleConnection - * @param buddylist Pointer to the buddylist that will be loaded. - */ -/* void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) {{{ */ -void -ggp_buddylist_load(PurpleConnection *gc, char *buddylist); - -/** - * Get all the buddies in the current account. - * - * @param account Current account. - * - * @return List of buddies. - */ -char * -ggp_buddylist_dump(PurpleAccount *account); - - -#endif /* _PURPLE_GG_BUDDYLIST_H */ - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -/** - * @file confer.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include -#include "gg.h" -#include "gg-utils.h" -#include "confer.h" - -/* PurpleConversation *ggp_confer_find_by_name(PurpleConnection *gc, const gchar *name) {{{ */ -PurpleConversation *ggp_confer_find_by_name(PurpleConnection *gc, const gchar *name) -{ - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - return purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name, - purple_connection_get_account(gc)); -} -/* }}} */ - -/* void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_name, const uin_t uin) {{{ */ -void ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_name, - const uin_t uin) -{ - PurpleConversation *conv; - GGPInfo *info = gc->proto_data; - GGPChat *chat; - GList *l; - gchar *str_uin; - - for (l = info->chats; l != NULL; l = l->next) { - chat = l->data; - - if (g_utf8_collate(chat->name, chat_name) != 0) - continue; - - if (g_list_find(chat->participants, GINT_TO_POINTER(uin)) == NULL) { - chat->participants = g_list_append( - chat->participants, GINT_TO_POINTER(uin)); - - str_uin = g_strdup_printf("%lu", (unsigned long int)uin); - conv = ggp_confer_find_by_name(gc, chat_name); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), str_uin, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - - g_free(str_uin); - } - break; - } -} -/* }}} */ - -/* void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, const uin_t *recipients, int count) {{{ */ -void ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, - const uin_t *recipients, int count) -{ - GGPInfo *info = gc->proto_data; - GList *l; - gchar *str_uin; - - for (l = info->chats; l != NULL; l = l->next) { - GGPChat *chat = l->data; - int i; - - if (g_utf8_collate(chat->name, chat_name) != 0) - continue; - - for (i = 0; i < count; i++) { - PurpleConversation *conv; - - if (g_list_find(chat->participants, - GINT_TO_POINTER(recipients[i])) != NULL) { - continue; - } - - chat->participants = g_list_append(chat->participants, - GINT_TO_POINTER(recipients[i])); - - str_uin = g_strdup_printf("%lu", (unsigned long int)recipients[i]); - conv = ggp_confer_find_by_name(gc, chat_name); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), - str_uin, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - g_free(str_uin); - } - break; - } -} -/* }}} */ - -/* const char *ggp_confer_find_by_participants(PurpleConnection *gc, const uin_t *recipients, int count) {{{ */ -const char *ggp_confer_find_by_participants(PurpleConnection *gc, - const uin_t *recipients, int count) -{ - GGPInfo *info = gc->proto_data; - GGPChat *chat = NULL; - GList *l; - int matches; - - g_return_val_if_fail(info->chats != NULL, NULL); - - for (l = info->chats; l != NULL; l = l->next) { - GList *m; - - chat = l->data; - matches = 0; - - for (m = chat->participants; m != NULL; m = m->next) { - uin_t uin = GPOINTER_TO_INT(m->data); - int i; - - for (i = 0; i < count; i++) - if (uin == recipients[i]) - matches++; - } - - if (matches == count) - break; - - chat = NULL; - } - - if (chat == NULL) - return NULL; - else - return chat->name; -} -/* }}} */ - -/* const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) {{{ */ -const char *ggp_confer_add_new(PurpleConnection *gc, const char *name) -{ - GGPInfo *info = gc->proto_data; - GGPChat *chat; - - chat = g_new0(GGPChat, 1); - - if (name == NULL) - chat->name = g_strdup_printf("conf#%d", info->chats_count++); - else - chat->name = g_strdup(name); - - chat->participants = NULL; - - info->chats = g_list_append(info->chats, chat); - - return chat->name; -} -/* }}} */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/confer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file confer.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_CONFER_H -#define _PURPLE_GG_CONFER_H - -#include "gg.h" - -/** - * Finds a CHAT conversation for the current account with the specified name. - * - * @param gc PurpleConnection instance. - * @param name Name of the conversation. - * - * @return PurpleConversation or NULL if not found. - */ -PurpleConversation * -ggp_confer_find_by_name(PurpleConnection *gc, const gchar *name); - -/** - * Adds the specified UIN to the specified conversation. - * - * @param gc PurpleConnection. - * @param chat_name Name of the conversation. - */ -void -ggp_confer_participants_add_uin(PurpleConnection *gc, const gchar *chat_name, - const uin_t uin); - -/** - * Add the specified UINs to the specified conversation. - * - * @param gc PurpleConnection. - * @param chat_name Name of the conversation. - * @param recipients List of the UINs. - * @param count Number of the UINs. - */ -void -ggp_confer_participants_add(PurpleConnection *gc, const gchar *chat_name, - const uin_t *recipients, int count); - -/** - * Finds a conversation in which all the specified recipients participate. - * - * TODO: This function should be rewritten to better handle situations when - * somebody adds more people to the converation. - * - * @param gc PurpleConnection. - * @param recipients List of the people in the conversation. - * @param count Number of people. - * - * @return Name of the conversation. - */ -const char* -ggp_confer_find_by_participants(PurpleConnection *gc, const uin_t *recipients, - int count); - -/** - * Adds a new conversation to the internal list of conversations. - * If name is NULL then it will be automagically generated. - * - * @param gc PurpleConnection. - * @param name Name of the conversation. - * - * @return Name of the conversation. - */ -const char* -ggp_confer_add_new(PurpleConnection *gc, const char *name); - - -#endif /* _PURPLE_GG_CONFER_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2550 +0,0 @@ -/** - * @file gg.c Gadu-Gadu protocol plugin - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * Some parts of the code are adapted or taken from the previous implementation - * of this plugin written by Arkadiusz Miskiewicz - * Some parts Copyright (C) 2009 Krzysztof Klinikowski - * - * Thanks to Google's Summer of Code Program. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "plugin.h" -#include "version.h" -#include "notify.h" -#include "status.h" -#include "blist.h" -#include "accountopt.h" -#include "debug.h" -#include "util.h" -#include "request.h" -#include "xmlnode.h" - -#include - -#include "gg.h" -#include "confer.h" -#include "search.h" -#include "buddylist.h" -#include "gg-utils.h" - -static PurplePlugin *my_protocol = NULL; - -/* ---------------------------------------------------------------------- */ -/* ----- EXTERNAL CALLBACKS --------------------------------------------- */ -/* ---------------------------------------------------------------------- */ - - -/* ----- HELPERS -------------------------------------------------------- */ - -/** - * Set up libgadu's proxy. - * - * @param account Account for which to set up the proxy. - * - * @return Zero if proxy setup is valid, otherwise -1. - */ -static int ggp_setup_proxy(PurpleAccount *account) -{ - PurpleProxyInfo *gpi; - - gpi = purple_proxy_get_setup(account); - - if ((purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) && - (purple_proxy_info_get_host(gpi) == NULL || - purple_proxy_info_get_port(gpi) <= 0)) { - - gg_proxy_enabled = 0; - purple_notify_error(NULL, NULL, _("Invalid proxy settings"), - _("Either the host name or port number specified for your given proxy type is invalid.")); - return -1; - } else if (purple_proxy_info_get_type(gpi) != PURPLE_PROXY_NONE) { - gg_proxy_enabled = 1; - gg_proxy_host = g_strdup(purple_proxy_info_get_host(gpi)); - gg_proxy_port = purple_proxy_info_get_port(gpi); - gg_proxy_username = g_strdup(purple_proxy_info_get_username(gpi)); - gg_proxy_password = g_strdup(purple_proxy_info_get_password(gpi)); - } else { - gg_proxy_enabled = 0; - } - - return 0; -} - -static void ggp_async_token_handler(gpointer _gc, gint fd, PurpleInputCondition cond) -{ - PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - GGPTokenCallback cb; - - struct gg_token *t = NULL; - - purple_debug_info("gg", "token_handler: token->req: check = %d; state = %d;\n", - token->req->check, token->req->state); - - if (gg_token_watch_fd(token->req) == -1 || token->req->state == GG_STATE_ERROR) { - purple_debug_error("gg", "token error (1): %d\n", token->req->error); - purple_input_remove(token->inpa); - gg_token_free(token->req); - token->req = NULL; - - purple_notify_error(purple_connection_get_account(gc), - _("Token Error"), - _("Unable to fetch the token.\n"), NULL); - return; - } - - if (token->req->state != GG_STATE_DONE) { - purple_input_remove(token->inpa); - token->inpa = purple_input_add(token->req->fd, - (token->req->check == 1) - ? PURPLE_INPUT_WRITE - : PURPLE_INPUT_READ, - ggp_async_token_handler, gc); - return; - } - - if (!(t = token->req->data) || !token->req->body) { - purple_debug_error("gg", "token error (2): %d\n", token->req->error); - purple_input_remove(token->inpa); - gg_token_free(token->req); - token->req = NULL; - - purple_notify_error(purple_connection_get_account(gc), - _("Token Error"), - _("Unable to fetch the token.\n"), NULL); - return; - } - - purple_input_remove(token->inpa); - - token->id = g_strdup(t->tokenid); - token->size = token->req->body_size; - token->data = g_new0(char, token->size); - memcpy(token->data, token->req->body, token->size); - - purple_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n", - token->id, token->size); - - gg_token_free(token->req); - token->req = NULL; - token->inpa = 0; - - cb = token->cb; - token->cb = NULL; - cb(gc); -} - -static void ggp_token_request(PurpleConnection *gc, GGPTokenCallback cb) -{ - PurpleAccount *account; - struct gg_http *req; - GGPInfo *info; - - account = purple_connection_get_account(gc); - - if (ggp_setup_proxy(account) == -1) - return; - - info = gc->proto_data; - - if ((req = gg_token(1)) == NULL) { - purple_notify_error(account, - _("Token Error"), - _("Unable to fetch the token.\n"), NULL); - return; - } - - info->token = g_new(GGPToken, 1); - info->token->cb = cb; - - info->token->req = req; - info->token->inpa = purple_input_add(req->fd, PURPLE_INPUT_READ, - ggp_async_token_handler, gc); -} -/* }}} */ - -/* ---------------------------------------------------------------------- */ - -/** - * Request buddylist from the server. - * Buddylist is received in the ggp_callback_recv(). - * - * @param Current action handler. - */ -static void ggp_action_buddylist_get(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; - - purple_debug_info("gg", "Downloading...\n"); - - gg_userlist_request(info->session, GG_USERLIST_GET, NULL); -} - -/** - * Upload the buddylist to the server. - * - * @param action Current action handler. - */ -static void ggp_action_buddylist_put(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; - - char *buddylist = ggp_buddylist_dump(purple_connection_get_account(gc)); - - purple_debug_info("gg", "Uploading...\n"); - - if (buddylist == NULL) - return; - - gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist); - g_free(buddylist); -} - -/** - * Delete buddylist from the server. - * - * @param action Current action handler. - */ -static void ggp_action_buddylist_delete(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - GGPInfo *info = gc->proto_data; - - purple_debug_info("gg", "Deleting...\n"); - - gg_userlist_request(info->session, GG_USERLIST_PUT, NULL); -} - -static void ggp_callback_buddylist_save_ok(PurpleConnection *gc, const char *filename) -{ - PurpleAccount *account = purple_connection_get_account(gc); - - char *buddylist = ggp_buddylist_dump(account); - - purple_debug_info("gg", "Saving...\n"); - purple_debug_info("gg", "file = %s\n", filename); - - if (buddylist == NULL) { - purple_notify_info(account, _("Save Buddylist..."), - _("Your buddylist is empty, nothing was written to the file."), - NULL); - return; - } - - if(purple_util_write_data_to_file_absolute(filename, buddylist, -1)) { - purple_notify_info(account, _("Save Buddylist..."), - _("Buddylist saved successfully!"), NULL); - } else { - gchar *primary = g_strdup_printf( - _("Couldn't write buddy list for %s to %s"), - purple_account_get_username(account), filename); - purple_notify_error(account, _("Save Buddylist..."), - primary, NULL); - g_free(primary); - } - - g_free(buddylist); -} - -static void ggp_callback_buddylist_load_ok(PurpleConnection *gc, gchar *file) -{ - PurpleAccount *account = purple_connection_get_account(gc); - GError *error = NULL; - char *buddylist = NULL; - gsize length; - - purple_debug_info("gg", "file_name = %s\n", file); - - if (!g_file_get_contents(file, &buddylist, &length, &error)) { - purple_notify_error(account, - _("Couldn't load buddylist"), - _("Couldn't load buddylist"), - error->message); - - purple_debug_error("gg", - "Couldn't load buddylist. file = %s; error = %s\n", - file, error->message); - - g_error_free(error); - - return; - } - - ggp_buddylist_load(gc, buddylist); - g_free(buddylist); - - purple_notify_info(account, - _("Load Buddylist..."), - _("Buddylist loaded successfully!"), NULL); -} -/* }}} */ - -/* - */ -/* static void ggp_action_buddylist_save(PurplePluginAction *action) {{{ */ -static void ggp_action_buddylist_save(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - purple_request_file(action, _("Save buddylist..."), NULL, TRUE, - G_CALLBACK(ggp_callback_buddylist_save_ok), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void ggp_action_buddylist_load(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - purple_request_file(action, _("Load buddylist from file..."), NULL, - FALSE, - G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void ggp_callback_register_account_ok(PurpleConnection *gc, - PurpleRequestFields *fields) -{ - PurpleAccount *account; - GGPInfo *info = gc->proto_data; - struct gg_http *h = NULL; - struct gg_pubdir *s; - uin_t uin; - gchar *email, *p1, *p2, *t; - GGPToken *token = info->token; - - email = charset_convert(purple_request_fields_get_string(fields, "email"), - "UTF-8", "CP1250"); - p1 = charset_convert(purple_request_fields_get_string(fields, "password1"), - "UTF-8", "CP1250"); - p2 = charset_convert(purple_request_fields_get_string(fields, "password2"), - "UTF-8", "CP1250"); - t = charset_convert(purple_request_fields_get_string(fields, "token"), - "UTF-8", "CP1250"); - - account = purple_connection_get_account(gc); - - if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || - *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("You must fill in all registration fields")); - goto exit_err; - } - - if (g_utf8_collate(p1, p2) != 0) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Passwords do not match")); - goto exit_err; - } - - purple_debug_info("gg", "register_account_ok: token_id = %s; t = %s\n", - token->id, t); - h = gg_register3(email, p1, token->id, t, 0); - if (h == NULL || !(s = h->data) || !s->success) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to register new account. An unknown error occurred.")); - goto exit_err; - } - - uin = s->uin; - purple_debug_info("gg", "registered uin: %d\n", uin); - - g_free(t); - t = g_strdup_printf("%u", uin); - purple_account_set_username(account, t); - /* Save the password if remembering passwords for the account */ - purple_account_set_password(account, p1); - - purple_notify_info(NULL, _("New Gadu-Gadu Account Registered"), - _("Registration completed successfully!"), NULL); - - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - /* TODO: the currently open Accounts Window will not be updated withthe - * new username and etc, we need to somehow have it refresh at this - * point - */ - - /* Need to disconnect or actually log in. For now, we disconnect. */ - purple_account_disconnect(account); - -exit_err: - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - - gg_register_free(h); - g_free(email); - g_free(p1); - g_free(p2); - g_free(t); - g_free(token->id); - g_free(token); -} - -static void ggp_callback_register_account_cancel(PurpleConnection *gc, - PurpleRequestFields *fields) -{ - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - - purple_account_disconnect(gc->account); - - g_free(token->id); - g_free(token->data); - g_free(token); - -} - -static void ggp_register_user_dialog(PurpleConnection *gc) -{ - PurpleAccount *account; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - - - account = purple_connection_get_account(gc); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("email", - _("Email"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password1", - _("Password"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password2", - _("Password (again)"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("token", - _("Enter captcha text"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - /* original size: 60x24 */ - field = purple_request_field_image_new("token_img", - _("Captcha"), token->data, token->size); - purple_request_field_group_add_field(group, field); - - purple_request_fields(account, - _("Register New Gadu-Gadu Account"), - _("Register New Gadu-Gadu Account"), - _("Please, fill in the following fields"), - fields, - _("OK"), G_CALLBACK(ggp_callback_register_account_ok), - _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel), - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -/* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */ - -static void ggp_callback_show_next(PurpleConnection *gc, GList *row, gpointer user_data) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form = user_data; - guint32 seq; - - g_free(form->offset); - form->offset = g_strdup(form->last_uin); - - ggp_search_remove(info->searches, form->seq); - purple_debug_info("gg", "ggp_callback_show_next(): Removed seq %u", form->seq); - - seq = ggp_search_start(gc, form); - ggp_search_add(info->searches, seq, form); - purple_debug_info("gg", "ggp_callback_show_next(): Added seq %u", seq); -} - -static void ggp_callback_add_buddy(PurpleConnection *gc, GList *row, gpointer user_data) -{ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 0), NULL, NULL); -} - -static void ggp_callback_im(PurpleConnection *gc, GList *row, gpointer user_data) -{ - PurpleAccount *account; - PurpleConversation *conv; - char *name; - - account = purple_connection_get_account(gc); - - name = g_list_nth_data(row, 0); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); - purple_conversation_present(conv); -} - -static void ggp_callback_find_buddies(PurpleConnection *gc, PurpleRequestFields *fields) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form; - guint32 seq; - - form = ggp_search_form_new(GGP_SEARCH_TYPE_FULL); - - form->user_data = info; - form->lastname = charset_convert( - purple_request_fields_get_string(fields, "lastname"), - "UTF-8", "CP1250"); - form->firstname = charset_convert( - purple_request_fields_get_string(fields, "firstname"), - "UTF-8", "CP1250"); - form->nickname = charset_convert( - purple_request_fields_get_string(fields, "nickname"), - "UTF-8", "CP1250"); - form->city = charset_convert( - purple_request_fields_get_string(fields, "city"), - "UTF-8", "CP1250"); - form->birthyear = charset_convert( - purple_request_fields_get_string(fields, "year"), - "UTF-8", "CP1250"); - - switch (purple_request_fields_get_choice(fields, "gender")) { - case 1: - form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE); - break; - case 2: - form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE); - break; - default: - form->gender = NULL; - break; - } - - form->active = purple_request_fields_get_bool(fields, "active") - ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL; - - form->offset = g_strdup("0"); - - seq = ggp_search_start(gc, form); - ggp_search_add(info->searches, seq, form); - purple_debug_info("gg", "ggp_callback_find_buddies(): Added seq %u", seq); -} - -static void ggp_find_buddies(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("lastname", - _("Last name"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("firstname", - _("First name"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("nickname", - _("Nickname"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("city", - _("City"), NULL, FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("year", - _("Year of birth"), NULL, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_choice_new("gender", _("Gender"), 0); - purple_request_field_choice_add(field, _("Male or female")); - purple_request_field_choice_add(field, _("Male")); - purple_request_field_choice_add(field, _("Female")); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_bool_new("active", - _("Only online"), FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(gc, - _("Find buddies"), - _("Find buddies"), - _("Please, enter your search criteria below"), - fields, - _("OK"), G_CALLBACK(ggp_callback_find_buddies), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -/* ----- CHANGE PASSWORD ------------------------------------------------ */ - -static void ggp_callback_change_passwd_ok(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *account; - GGPInfo *info = gc->proto_data; - struct gg_http *h; - gchar *cur, *p1, *p2, *t; - - cur = charset_convert( - purple_request_fields_get_string(fields, "password_cur"), - "UTF-8", "CP1250"); - p1 = charset_convert( - purple_request_fields_get_string(fields, "password1"), - "UTF-8", "CP1250"); - p2 = charset_convert( - purple_request_fields_get_string(fields, "password2"), - "UTF-8", "CP1250"); - t = charset_convert( - purple_request_fields_get_string(fields, "token"), - "UTF-8", "CP1250"); - - account = purple_connection_get_account(gc); - - if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || - *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { - purple_notify_error(account, NULL, _("Fill in the fields."), NULL); - goto exit_err; - } - - if (g_utf8_collate(p1, p2) != 0) { - purple_notify_error(account, NULL, - _("New passwords do not match."), NULL); - goto exit_err; - } - - if (g_utf8_collate(cur, purple_account_get_password(account)) != 0) { - purple_notify_error(account, NULL, - _("Your current password is different from the one that you specified."), - NULL); - goto exit_err; - } - - purple_debug_info("gg", "Changing password\n"); - - /* XXX: this email should be a pref... */ - h = gg_change_passwd4(ggp_get_uin(account), - "user@example.net", purple_account_get_password(account), - p1, info->token->id, t, 0); - - if (h == NULL) { - purple_notify_error(account, NULL, - _("Unable to change password. Error occurred.\n"), - NULL); - goto exit_err; - } - - purple_account_set_password(account, p1); - - gg_change_passwd_free(h); - - purple_notify_info(account, _("Change password for the Gadu-Gadu account"), - _("Password was changed successfully!"), NULL); - -exit_err: - g_free(cur); - g_free(p1); - g_free(p2); - g_free(t); - g_free(info->token->id); - g_free(info->token->data); - g_free(info->token); -} - -static void ggp_change_passwd_dialog(PurpleConnection *gc) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - GGPInfo *info = gc->proto_data; - GGPToken *token = info->token; - - char *msg; - - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("password_cur", - _("Current password"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password1", - _("Password"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password2", - _("Password (retype)"), "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("token", - _("Enter current token"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - /* original size: 60x24 */ - field = purple_request_field_image_new("token_img", - _("Current token"), token->data, token->size); - purple_request_field_group_add_field(group, field); - - msg = g_strdup_printf("%s %d", - _("Please, enter your current password and your new password for UIN: "), - ggp_get_uin(purple_connection_get_account(gc))); - - purple_request_fields(gc, - _("Change Gadu-Gadu Password"), - _("Change Gadu-Gadu Password"), - msg, - fields, _("OK"), G_CALLBACK(ggp_callback_change_passwd_ok), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - - g_free(msg); -} - -static void ggp_change_passwd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - - ggp_token_request(gc, ggp_change_passwd_dialog); -} - -/* ----- CONFERENCES ---------------------------------------------------- */ - -static void ggp_callback_add_to_chat_ok(PurpleBuddy *buddy, PurpleRequestFields *fields) -{ - GGPInfo *info; - PurpleConnection *conn; - PurpleRequestField *field; - GList *sel; - - conn = purple_account_get_connection(purple_buddy_get_account(buddy)); - - g_return_if_fail(conn != NULL); - - info = conn->proto_data; - - field = purple_request_fields_get_field(fields, "name"); - sel = purple_request_field_list_get_selected(field); - - if (sel == NULL) { - purple_debug_error("gg", "No chat selected\n"); - return; - } - - ggp_confer_participants_add_uin(conn, sel->data, - ggp_str_to_uin(purple_buddy_get_name(buddy))); -} - -static void ggp_bmenu_add_to_chat(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - GGPInfo *info; - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - GList *l; - gchar *msg; - - buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - info = gc->proto_data; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_list_new("name", "Chat name"); - for (l = info->chats; l != NULL; l = l->next) { - GGPChat *chat = l->data; - purple_request_field_list_add(field, chat->name, chat->name); - } - purple_request_field_group_add_field(group, field); - - msg = g_strdup_printf(_("Select a chat for buddy: %s"), - purple_buddy_get_alias(buddy)); - purple_request_fields(gc, - _("Add to chat..."), - _("Add to chat..."), - msg, - fields, - _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - buddy); - g_free(msg); -} - -/* ----- BLOCK BUDDIES -------------------------------------------------- */ - -static void ggp_bmenu_block(PurpleBlistNode *node, gpointer ignored) -{ - PurpleConnection *gc; - PurpleBuddy *buddy; - GGPInfo *info; - uin_t uin; - - buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - info = gc->proto_data; - - uin = ggp_str_to_uin(purple_buddy_get_name(buddy)); - - if (purple_blist_node_get_bool(node, "blocked")) { - purple_blist_node_set_bool(node, "blocked", FALSE); - gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); - gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); - purple_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); - } else { - purple_blist_node_set_bool(node, "blocked", TRUE); - gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); - gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); - purple_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); - } -} - -/* ---------------------------------------------------------------------- */ -/* ----- INTERNAL CALLBACKS --------------------------------------------- */ -/* ---------------------------------------------------------------------- */ - -/* Prototypes */ -static void ggp_set_status(PurpleAccount *account, PurpleStatus *status); -static int ggp_to_gg_status(PurpleStatus *status, char **msg); - -struct gg_fetch_avatar_data -{ - PurpleConnection *gc; - gchar *uin; - gchar *avatar_url; -}; - - -static void gg_fetch_avatar_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *data, size_t len, const gchar *error_message) { - struct gg_fetch_avatar_data *d = user_data; - PurpleAccount *account; - PurpleBuddy *buddy; - gpointer buddy_icon_data; - - /* FIXME: This shouldn't be necessary */ - if (!PURPLE_CONNECTION_IS_VALID(d->gc)) { - g_free(d->uin); - g_free(d->avatar_url); - g_free(d); - g_return_if_reached(); - } - - account = purple_connection_get_account(d->gc); - buddy = purple_find_buddy(account, d->uin); - - if (buddy == NULL) - goto out; - - buddy_icon_data = g_memdup(data, len); - - purple_buddy_icons_set_for_user(account, purple_buddy_get_name(buddy), - buddy_icon_data, len, d->avatar_url); - purple_debug_info("gg", "UIN: %s should have avatar now\n", d->uin); - -out: - g_free(d->uin); - g_free(d->avatar_url); - g_free(d); -} - -static void gg_get_avatar_url_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) { - struct gg_fetch_avatar_data *data; - PurpleConnection *gc = user_data; - PurpleAccount *account; - PurpleBuddy *buddy; - const char *uin; - const char *is_blank; - const char *checksum; - - gchar *bigavatar = NULL; - xmlnode *xml = NULL; - xmlnode *xmlnode_users; - xmlnode *xmlnode_user; - xmlnode *xmlnode_avatars; - xmlnode *xmlnode_avatar; - xmlnode *xmlnode_bigavatar; - - g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - account = purple_connection_get_account(gc); - - if (error_message != NULL) - purple_debug_error("gg", "gg_get_avatars_cb error: %s\n", error_message); - else if (len > 0 && url_text && *url_text) { - xml = xmlnode_from_str(url_text, -1); - if (xml == NULL) - goto out; - - xmlnode_users = xmlnode_get_child(xml, "users"); - if (xmlnode_users == NULL) - goto out; - - xmlnode_user = xmlnode_get_child(xmlnode_users, "user"); - if (xmlnode_user == NULL) - goto out; - - uin = xmlnode_get_attrib(xmlnode_user, "uin"); - - xmlnode_avatars = xmlnode_get_child(xmlnode_user, "avatars"); - if (xmlnode_avatars == NULL) - goto out; - - xmlnode_avatar = xmlnode_get_child(xmlnode_avatars, "avatar"); - if (xmlnode_avatar == NULL) - goto out; - - xmlnode_bigavatar = xmlnode_get_child(xmlnode_avatar, "originBigAvatar"); - if (xmlnode_bigavatar == NULL) - goto out; - - is_blank = xmlnode_get_attrib(xmlnode_avatar, "blank"); - bigavatar = xmlnode_get_data(xmlnode_bigavatar); - - purple_debug_info("gg", "gg_get_avatar_url_cb: UIN %s, IS_BLANK %s, " - "URL %s\n", - uin ? uin : "(null)", is_blank ? is_blank : "(null)", - bigavatar ? bigavatar : "(null)"); - - if (uin != NULL && bigavatar != NULL) { - buddy = purple_find_buddy(account, uin); - if (buddy == NULL) - goto out; - - checksum = purple_buddy_icons_get_checksum_for_user(buddy); - - if (purple_strequal(is_blank, "1")) { - purple_buddy_icons_set_for_user(account, - purple_buddy_get_name(buddy), NULL, 0, NULL); - } else if (!purple_strequal(checksum, bigavatar)) { - data = g_new0(struct gg_fetch_avatar_data, 1); - data->gc = gc; - data->uin = g_strdup(uin); - data->avatar_url = g_strdup(bigavatar); - - url_data = purple_util_fetch_url_request_len_with_account(account, - bigavatar, TRUE, "Mozilla/4.0 (compatible; MSIE 5.0)", - FALSE, NULL, FALSE, -1, gg_fetch_avatar_cb, data); - } - } - } - -out: - if (xml) - xmlnode_free(xml); - g_free(bigavatar); -} - -/** - * Handle change of the status of the buddy. - * - * @param gc PurpleConnection - * @param uin UIN of the buddy. - * @param status ID of the status. - * @param descr Description. - */ -static void ggp_generic_status_handler(PurpleConnection *gc, uin_t uin, - int status, const char *descr) -{ - gchar *from; - const char *st; - gchar *msg; - gchar *avatarurl; - PurpleUtilFetchUrlData *url_data; - - from = g_strdup_printf("%u", uin); - avatarurl = g_strdup_printf("http://api.gadu-gadu.pl/avatars/%s/0.xml", from); - - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), avatarurl, TRUE, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, NULL, FALSE, -1, - gg_get_avatar_url_cb, gc); - - g_free(avatarurl); - - switch (status) { - case GG_STATUS_NOT_AVAIL: - case GG_STATUS_NOT_AVAIL_DESCR: - st = "offline"; - break; - case GG_STATUS_AVAIL: - case GG_STATUS_AVAIL_DESCR: - st = "available"; - break; - case GG_STATUS_BUSY: - case GG_STATUS_BUSY_DESCR: - st = "away"; - break; - case GG_STATUS_BLOCKED: - /* user is blocking us.... */ - st = "blocked"; - break; - default: - st = "available"; - purple_debug_info("gg", - "GG_EVENT_NOTIFY: Unknown status: %d\n", status); - break; - } - - purple_debug_info("gg", "st = %s\n", st); - msg = charset_convert(descr, "CP1250", "UTF-8"); - purple_prpl_got_user_status(purple_connection_get_account(gc), - from, st, "message", msg, NULL); - g_free(from); - g_free(msg); -} - -static void ggp_sr_close_cb(gpointer user_data) -{ - GGPSearchForm *form = user_data; - GGPInfo *info = form->user_data; - - ggp_search_remove(info->searches, form->seq); - purple_debug_info("gg", "ggp_sr_close_cb(): Removed seq %u", form->seq); - ggp_search_form_destroy(form); -} - -/** - * Translate a status' ID to a more user-friendly name. - * - * @param id The ID of the status. - * - * @return The user-friendly name of the status. - */ -static const char *ggp_status_by_id(unsigned int id) -{ - const char *st; - - purple_debug_info("gg", "ggp_status_by_id: %d\n", id); - switch (id) { - case GG_STATUS_NOT_AVAIL: - case GG_STATUS_NOT_AVAIL_DESCR: - st = _("Offline"); - break; - case GG_STATUS_AVAIL: - case GG_STATUS_AVAIL_DESCR: - st = _("Available"); - break; - case GG_STATUS_BUSY: - case GG_STATUS_BUSY_DESCR: - st = _("Away"); - break; - default: - st = _("Unknown"); - break; - } - - return st; -} - -static void ggp_pubdir_handle_info(PurpleConnection *gc, gg_pubdir50_t req, - GGPSearchForm *form) -{ - PurpleNotifyUserInfo *user_info; - PurpleBuddy *buddy; - char *val, *who; - - user_info = purple_notify_user_info_new(); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS); - /* XXX: Use of ggp_str_to_uin() is an ugly hack! */ - purple_notify_user_info_add_pair(user_info, _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); - g_free(val); - - who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); - purple_notify_user_info_add_pair(user_info, _("UIN"), who); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); - purple_notify_user_info_add_pair(user_info, _("First Name"), val); - g_free(val); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); - purple_notify_user_info_add_pair(user_info, _("Nickname"), val); - g_free(val); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); - purple_notify_user_info_add_pair(user_info, _("City"), val); - g_free(val); - - val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); - if (strncmp(val, "0", 1)) { - purple_notify_user_info_add_pair(user_info, _("Birth Year"), val); - } - g_free(val); - - /* - * Include a status message, if exists and buddy is in the blist. - */ - buddy = purple_find_buddy(purple_connection_get_account(gc), who); - if (NULL != buddy) { - PurpleStatus *status; - const char *msg; - char *text; - - status = purple_presence_get_active_status(purple_buddy_get_presence(buddy)); - msg = purple_status_get_attr_string(status, "message"); - - if (msg != NULL) { - text = g_markup_escape_text(msg, -1); - purple_notify_user_info_add_pair(user_info, _("Message"), text); - g_free(text); - } - } - - purple_notify_userinfo(gc, who, user_info, ggp_sr_close_cb, form); - g_free(who); - purple_notify_user_info_destroy(user_info); -} - -static void ggp_pubdir_handle_full(PurpleConnection *gc, gg_pubdir50_t req, - GGPSearchForm *form) -{ - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - int res_count; - int start; - int i; - - g_return_if_fail(form != NULL); - - res_count = gg_pubdir50_count(req); - res_count = (res_count > PUBDIR_RESULTS_MAX) ? PUBDIR_RESULTS_MAX : res_count; - - results = purple_notify_searchresults_new(); - - if (results == NULL) { - purple_debug_error("gg", "ggp_pubdir_reply_handler: " - "Unable to display the search results.\n"); - purple_notify_error(gc, NULL, - _("Unable to display the search results."), - NULL); - ggp_sr_close_cb(form); - return; - } - - column = purple_notify_searchresults_column_new(_("UIN")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("First Name")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("Nickname")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("City")); - purple_notify_searchresults_column_add(results, column); - - column = purple_notify_searchresults_column_new(_("Birth Year")); - purple_notify_searchresults_column_add(results, column); - - purple_debug_info("gg", "Going with %d entries\n", res_count); - - start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START)); - purple_debug_info("gg", "start = %d\n", start); - - for (i = 0; i < res_count; i++) { - GList *row = NULL; - char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR); - - /* TODO: Status will be displayed as an icon. */ - /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */ - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_UIN)); - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_FIRSTNAME)); - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_NICKNAME)); - row = g_list_append(row, ggp_search_get_result(req, i, - GG_PUBDIR50_CITY)); - row = g_list_append(row, - (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-")); - - purple_notify_searchresults_row_add(results, row); - - if (i == res_count - 1) { - g_free(form->last_uin); - form->last_uin = ggp_search_get_result(req, i, GG_PUBDIR50_UIN); - } - } - - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_CONTINUE, - ggp_callback_show_next); - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - ggp_callback_add_buddy); - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_IM, - ggp_callback_im); - - if (form->window == NULL) { - void *h = purple_notify_searchresults(gc, - _("Gadu-Gadu Public Directory"), - _("Search results"), NULL, results, - (PurpleNotifyCloseCallback)ggp_sr_close_cb, - form); - - if (h == NULL) { - purple_debug_error("gg", "ggp_pubdir_reply_handler: " - "Unable to display the search results.\n"); - purple_notify_error(gc, NULL, - _("Unable to display the search results."), - NULL); - return; - } - - form->window = h; - } else { - purple_notify_searchresults_new_rows(gc, results, form->window); - } -} - -static void ggp_pubdir_reply_handler(PurpleConnection *gc, gg_pubdir50_t req) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form; - int res_count; - guint32 seq; - - seq = gg_pubdir50_seq(req); - form = ggp_search_get(info->searches, seq); - purple_debug_info("gg", "ggp_pubdir_reply_handler(): seq %u --> form %p", seq, form); - /* - * this can happen when user will request more results - * and close the results window before they arrive. - */ - g_return_if_fail(form != NULL); - - res_count = gg_pubdir50_count(req); - if (res_count < 1) { - purple_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n"); - purple_notify_error(gc, NULL, - _("No matching users found"), - _("There are no users matching your search criteria.")); - ggp_sr_close_cb(form); - return; - } - - switch (form->search_type) { - case GGP_SEARCH_TYPE_INFO: - ggp_pubdir_handle_info(gc, req, form); - break; - case GGP_SEARCH_TYPE_FULL: - ggp_pubdir_handle_full(gc, req, form); - break; - default: - purple_debug_warning("gg", "Unknown search_type!\n"); - break; - } -} - -static void ggp_recv_image_handler(PurpleConnection *gc, const struct gg_event *ev) -{ - gint imgid = 0; - GGPInfo *info = gc->proto_data; - GList *entry = g_list_first(info->pending_richtext_messages); - gchar *handlerid = g_strdup_printf("IMGID_HANDLER-%i", ev->event.image_reply.crc32); - - imgid = purple_imgstore_add_with_id( - g_memdup(ev->event.image_reply.image, ev->event.image_reply.size), - ev->event.image_reply.size, - ev->event.image_reply.filename); - - purple_debug_info("gg", "ggp_recv_image_handler: got image with crc32: %u\n", ev->event.image_reply.crc32); - - while(entry) { - if (strstr((gchar *)entry->data, handlerid) != NULL) { - gchar **split = g_strsplit((gchar *)entry->data, handlerid, 3); - gchar *text = g_strdup_printf("%s%i%s", split[0], imgid, split[1]); - purple_debug_info("gg", "ggp_recv_image_handler: found message matching crc32: %s\n", (gchar *)entry->data); - g_strfreev(split); - info->pending_richtext_messages = g_list_remove(info->pending_richtext_messages, entry->data); - /* We don't have any more images to download */ - if (strstr(text, "event.msg.sender); - serv_got_im(gc, buf, text, PURPLE_MESSAGE_IMAGES, ev->event.msg.time); - g_free(buf); - purple_debug_info("gg", "ggp_recv_image_handler: richtext message: %s\n", text); - g_free(text); - break; - } - info->pending_richtext_messages = g_list_append(info->pending_richtext_messages, text); - break; - } - entry = g_list_next(entry); - } - g_free(handlerid); - - return; -} - - -/** - * Dispatch a message received from a buddy. - * - * @param gc PurpleConnection. - * @param ev Gadu-Gadu event structure. - * - * Image receiving, some code borrowed from Kadu http://www.kadu.net - */ -static void ggp_recv_message_handler(PurpleConnection *gc, const struct gg_event *ev) -{ - GGPInfo *info = gc->proto_data; - PurpleConversation *conv; - gchar *from; - gchar *msg; - gchar *tmp; - - from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); - - tmp = charset_convert((const char *)ev->event.msg.message, - "CP1250", "UTF-8"); - purple_str_strip_char(tmp, '\r'); - msg = g_markup_escape_text(tmp, -1); - g_free(tmp); - - /* We got richtext message */ - if (ev->event.msg.formats_length) - { - gboolean got_image = FALSE, bold = FALSE, italic = FALSE, under = FALSE; - char *cformats = (char *)ev->event.msg.formats; - char *cformats_end = cformats + ev->event.msg.formats_length; - gint increased_len = 0; - struct gg_msg_richtext_format *actformat; - struct gg_msg_richtext_image *actimage; - GString *message = g_string_new(msg); - gchar *handlerid; - - purple_debug_info("gg", "ggp_recv_message_handler: richtext msg from (%s): %s %i formats\n", from, msg, ev->event.msg.formats_length); - - while (cformats < cformats_end) - { - gint byteoffset; - actformat = (struct gg_msg_richtext_format *)cformats; - cformats += sizeof(struct gg_msg_richtext_format); - byteoffset = g_utf8_offset_to_pointer(message->str, actformat->position + increased_len) - message->str; - - if(actformat->position == 0 && actformat->font == 0) { - purple_debug_warning("gg", "ggp_recv_message_handler: bogus formatting (inc: %i)\n", increased_len); - continue; - } - purple_debug_info("gg", "ggp_recv_message_handler: format at pos: %i, image:%i, bold:%i, italic: %i, under:%i (inc: %i)\n", - actformat->position, - (actformat->font & GG_FONT_IMAGE) != 0, - (actformat->font & GG_FONT_BOLD) != 0, - (actformat->font & GG_FONT_ITALIC) != 0, - (actformat->font & GG_FONT_UNDERLINE) != 0, - increased_len); - - if (actformat->font & GG_FONT_IMAGE) { - got_image = TRUE; - actimage = (struct gg_msg_richtext_image*)(cformats); - cformats += sizeof(struct gg_msg_richtext_image); - purple_debug_info("gg", "ggp_recv_message_handler: image received, size: %d, crc32: %i\n", actimage->size, actimage->crc32); - - /* Checking for errors, image size shouldn't be - * larger than 255.000 bytes */ - if (actimage->size > 255000) { - purple_debug_warning("gg", "ggp_recv_message_handler: received image large than 255 kb\n"); - continue; - } - - gg_image_request(info->session, ev->event.msg.sender, - actimage->size, actimage->crc32); - - handlerid = g_strdup_printf("", actimage->crc32); - g_string_insert(message, byteoffset, handlerid); - increased_len += strlen(handlerid); - g_free(handlerid); - continue; - } - - if (actformat->font & GG_FONT_BOLD) { - if (bold == FALSE) { - g_string_insert(message, byteoffset, ""); - increased_len += 3; - bold = TRUE; - } - } else if (bold) { - g_string_insert(message, byteoffset, ""); - increased_len += 4; - bold = FALSE; - } - - if (actformat->font & GG_FONT_ITALIC) { - if (italic == FALSE) { - g_string_insert(message, byteoffset, ""); - increased_len += 3; - italic = TRUE; - } - } else if (italic) { - g_string_insert(message, byteoffset, ""); - increased_len += 4; - italic = FALSE; - } - - if (actformat->font & GG_FONT_UNDERLINE) { - if (under == FALSE) { - g_string_insert(message, byteoffset, ""); - increased_len += 3; - under = TRUE; - } - } else if (under) { - g_string_insert(message, byteoffset, ""); - increased_len += 4; - under = FALSE; - } - } - - msg = message->str; - g_string_free(message, FALSE); - - if (got_image) { - info->pending_richtext_messages = g_list_append(info->pending_richtext_messages, msg); - return; - } - } - - purple_debug_info("gg", "ggp_recv_message_handler: msg from (%s): %s (class = %d; rcpt_count = %d)\n", - from, msg, ev->event.msg.msgclass, - ev->event.msg.recipients_count); - - if (ev->event.msg.recipients_count == 0) { - serv_got_im(gc, from, msg, 0, ev->event.msg.time); - } else { - const char *chat_name; - int chat_id; - char *buddy_name; - - chat_name = ggp_confer_find_by_participants(gc, - ev->event.msg.recipients, - ev->event.msg.recipients_count); - - if (chat_name == NULL) { - chat_name = ggp_confer_add_new(gc, NULL); - serv_got_joined_chat(gc, info->chats_count, chat_name); - - ggp_confer_participants_add_uin(gc, chat_name, - ev->event.msg.sender); - - ggp_confer_participants_add(gc, chat_name, - ev->event.msg.recipients, - ev->event.msg.recipients_count); - } - conv = ggp_confer_find_by_name(gc, chat_name); - chat_id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); - serv_got_chat_in(gc, chat_id, buddy_name, - PURPLE_MESSAGE_RECV, msg, ev->event.msg.time); - g_free(buddy_name); - } - g_free(msg); - g_free(from); -} - -static void ggp_send_image_handler(PurpleConnection *gc, const struct gg_event *ev) -{ - GGPInfo *info = gc->proto_data; - PurpleStoredImage *image; - gint imgid = GPOINTER_TO_INT(g_hash_table_lookup(info->pending_images, &ev->event.image_request.crc32)); - - purple_debug_info("gg", "ggp_send_image_handler: image request received, crc32: %u\n", ev->event.image_request.crc32); - - if(imgid) - { - if((image = purple_imgstore_find_by_id(imgid))) { - gint image_size = purple_imgstore_get_size(image); - gconstpointer image_bin = purple_imgstore_get_data(image); - const char *image_filename = purple_imgstore_get_filename(image); - - purple_debug_info("gg", "ggp_send_image_handler: sending image imgid: %i, crc: %u\n", imgid, ev->event.image_request.crc32); - gg_image_reply(info->session, (unsigned long int)ev->event.image_request.sender, image_filename, image_bin, image_size); - purple_imgstore_unref(image); - } else { - purple_debug_error("gg", "ggp_send_image_handler: image imgid: %i, crc: %u in hash but not found in imgstore!\n", imgid, ev->event.image_request.crc32); - } - g_hash_table_remove(info->pending_images, &ev->event.image_request.crc32); - } -} - -static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) -{ - PurpleConnection *gc = _gc; - GGPInfo *info = gc->proto_data; - struct gg_event *ev; - int i; - - if (!(ev = gg_watch_fd(info->session))) { - purple_debug_error("gg", - "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to read from socket")); - return; - } - gc->last_received = time(NULL); - switch (ev->type) { - case GG_EVENT_NONE: - /* Nothing happened. */ - break; - case GG_EVENT_MSG: - ggp_recv_message_handler(gc, ev); - break; - case GG_EVENT_ACK: - /* Changing %u to %i fixes compiler warning */ - purple_debug_info("gg", - "ggp_callback_recv: message sent to: %i, delivery status=%d, seq=%d\n", - ev->event.ack.recipient, ev->event.ack.status, - ev->event.ack.seq); - break; - case GG_EVENT_IMAGE_REPLY: - ggp_recv_image_handler(gc, ev); - break; - case GG_EVENT_IMAGE_REQUEST: - ggp_send_image_handler(gc, ev); - break; - case GG_EVENT_NOTIFY: - case GG_EVENT_NOTIFY_DESCR: - { - struct gg_notify_reply *n; - char *descr; - - purple_debug_info("gg", "notify_pre: (%d) status: %d\n", - ev->event.notify->uin, - ev->event.notify->status); - - n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify - : ev->event.notify_descr.notify; - - for (; n->uin; n++) { - descr = (ev->type == GG_EVENT_NOTIFY) ? NULL - : ev->event.notify_descr.descr; - - purple_debug_info("gg", - "notify: (%d) status: %d; descr: %s\n", - n->uin, n->status, descr ? descr : "(null)"); - - ggp_generic_status_handler(gc, - n->uin, n->status, descr); - } - } - break; - case GG_EVENT_NOTIFY60: - purple_debug_info("gg", - "notify60_pre: (%d) status=%d; version=%d; descr=%s\n", - ev->event.notify60->uin, ev->event.notify60->status, - ev->event.notify60->version, - ev->event.notify60->descr ? ev->event.notify60->descr : "(null)"); - - for (i = 0; ev->event.notify60[i].uin; i++) { - purple_debug_info("gg", - "notify60: (%d) status=%d; version=%d; descr=%s\n", - ev->event.notify60[i].uin, - ev->event.notify60[i].status, - ev->event.notify60[i].version, - ev->event.notify60[i].descr ? ev->event.notify60[i].descr : "(null)"); - - ggp_generic_status_handler(gc, ev->event.notify60[i].uin, - ev->event.notify60[i].status, - ev->event.notify60[i].descr); - } - break; - case GG_EVENT_STATUS: - purple_debug_info("gg", "status: (%d) status=%d; descr=%s\n", - ev->event.status.uin, ev->event.status.status, - ev->event.status.descr ? ev->event.status.descr : "(null)"); - - ggp_generic_status_handler(gc, ev->event.status.uin, - ev->event.status.status, ev->event.status.descr); - break; - case GG_EVENT_STATUS60: - purple_debug_info("gg", - "status60: (%d) status=%d; version=%d; descr=%s\n", - ev->event.status60.uin, ev->event.status60.status, - ev->event.status60.version, - ev->event.status60.descr ? ev->event.status60.descr : "(null)"); - - ggp_generic_status_handler(gc, ev->event.status60.uin, - ev->event.status60.status, ev->event.status60.descr); - break; - case GG_EVENT_USERLIST: - if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) { - purple_debug_info("gg", "GG_USERLIST_GET_REPLY\n"); - purple_notify_info(gc, NULL, - _("Buddy list downloaded"), - _("Your buddy list was downloaded from the server.")); - if (ev->event.userlist.reply != NULL) { - ggp_buddylist_load(gc, ev->event.userlist.reply); - } - } else { - purple_debug_info("gg", "GG_USERLIST_PUT_REPLY\n"); - purple_notify_info(gc, NULL, - _("Buddy list uploaded"), - _("Your buddy list was stored on the server.")); - } - break; - case GG_EVENT_PUBDIR50_SEARCH_REPLY: - ggp_pubdir_reply_handler(gc, ev->event.pubdir50); - break; - default: - purple_debug_error("gg", - "unsupported event type=%d\n", ev->type); - break; - } - - gg_free_event(ev); -} - -static void ggp_async_login_handler(gpointer _gc, gint fd, PurpleInputCondition cond) -{ - PurpleConnection *gc = _gc; - GGPInfo *info; - struct gg_event *ev; - - g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - - info = gc->proto_data; - - purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", - info->session->check, info->session->state); - - switch (info->session->state) { - case GG_STATE_RESOLVING: - purple_debug_info("gg", "GG_STATE_RESOLVING\n"); - break; - case GG_STATE_CONNECTING_HUB: - purple_debug_info("gg", "GG_STATE_CONNECTING_HUB\n"); - break; - case GG_STATE_READING_DATA: - purple_debug_info("gg", "GG_STATE_READING_DATA\n"); - break; - case GG_STATE_CONNECTING_GG: - purple_debug_info("gg", "GG_STATE_CONNECTING_GG\n"); - break; - case GG_STATE_READING_KEY: - purple_debug_info("gg", "GG_STATE_READING_KEY\n"); - break; - case GG_STATE_READING_REPLY: - purple_debug_info("gg", "GG_STATE_READING_REPLY\n"); - break; - default: - purple_debug_error("gg", "unknown state = %d\n", - info->session->state); - break; - } - - if (!(ev = gg_watch_fd(info->session))) { - purple_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to read from socket")); - return; - } - purple_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); - purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", - info->session->check, info->session->state); - - purple_input_remove(gc->inpa); - - /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ - gc->inpa = purple_input_add(info->session->fd, - (info->session->check == 1) ? PURPLE_INPUT_WRITE - : PURPLE_INPUT_READ, - ggp_async_login_handler, gc); - - switch (ev->type) { - case GG_EVENT_NONE: - /* Nothing happened. */ - purple_debug_info("gg", "GG_EVENT_NONE\n"); - break; - case GG_EVENT_CONN_SUCCESS: - { - purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(info->session->fd, - PURPLE_INPUT_READ, - ggp_callback_recv, gc); - - ggp_buddylist_send(gc); - purple_connection_update_progress(gc, _("Connected"), 2, 2); - purple_connection_set_state(gc, PURPLE_CONNECTED); - } - break; - case GG_EVENT_CONN_FAILED: - purple_input_remove(gc->inpa); - gc->inpa = 0; - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - break; - default: - purple_debug_error("gg", "strange event: %d\n", ev->type); - break; - } - - gg_free_event(ev); -} - -/* ---------------------------------------------------------------------- */ -/* ----- PurplePluginProtocolInfo ----------------------------------------- */ -/* ---------------------------------------------------------------------- */ - -static const char *ggp_list_icon(PurpleAccount *account, PurpleBuddy *buddy) -{ - return "gadu-gadu"; -} - -static char *ggp_status_text(PurpleBuddy *b) -{ - PurpleStatus *status; - const char *msg; - char *text; - char *tmp; - - status = purple_presence_get_active_status(purple_buddy_get_presence(b)); - - msg = purple_status_get_attr_string(status, "message"); - - if (msg != NULL) { - tmp = purple_markup_strip_html(msg); - text = g_markup_escape_text(tmp, -1); - g_free(tmp); - - return text; - } else { - tmp = purple_utf8_salvage(purple_status_get_name(status)); - text = g_markup_escape_text(tmp, -1); - g_free(tmp); - - return text; - } -} - -static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurpleStatus *status; - char *text, *tmp; - const char *msg, *name, *alias; - - g_return_if_fail(b != NULL); - - status = purple_presence_get_active_status(purple_buddy_get_presence(b)); - msg = purple_status_get_attr_string(status, "message"); - name = purple_status_get_name(status); - alias = purple_buddy_get_alias(b); - - purple_notify_user_info_add_pair (user_info, _("Alias"), alias); - - if (msg != NULL) { - text = g_markup_escape_text(msg, -1); - if (PURPLE_BUDDY_IS_ONLINE(b)) { - tmp = g_strdup_printf("%s: %s", name, text); - purple_notify_user_info_add_pair(user_info, _("Status"), tmp); - g_free(tmp); - } else { - purple_notify_user_info_add_pair(user_info, _("Message"), text); - } - g_free(text); - /* We don't want to duplicate 'Status: Offline'. */ - } else if (PURPLE_BUDDY_IS_ONLINE(b)) { - purple_notify_user_info_add_pair(user_info, _("Status"), name); - } -} - -static GList *ggp_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - /* - * Without this selecting Invisible as own status doesn't - * work. It's not used and not needed to show status of buddies. - */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - /* - * This status is necessary to display guys who are blocking *us*. - */ - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - return types; -} - -static GList *ggp_blist_node_menu(PurpleBlistNode *node) -{ - PurpleMenuAction *act; - GList *m = NULL; - PurpleAccount *account; - GGPInfo *info; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) - return NULL; - - account = purple_buddy_get_account((PurpleBuddy *) node); - info = purple_account_get_connection(account)->proto_data; - if (info->chats) { - act = purple_menu_action_new(_("Add to chat"), - PURPLE_CALLBACK(ggp_bmenu_add_to_chat), - NULL, NULL); - m = g_list_append(m, act); - } - - /* Using a blist node boolean here is also wrong. - * Once the Block and Unblock actions are added to the core, - * this will have to go. -- rlaager */ - if (purple_blist_node_get_bool(node, "blocked")) { - act = purple_menu_action_new(_("Unblock"), - PURPLE_CALLBACK(ggp_bmenu_block), - NULL, NULL); - } else { - act = purple_menu_action_new(_("Block"), - PURPLE_CALLBACK(ggp_bmenu_block), - NULL, NULL); - } - m = g_list_append(m, act); - - return m; -} - -static GList *ggp_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Chat _name:"); - pce->identifier = "name"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - -static void ggp_login(PurpleAccount *account) -{ - PurpleConnection *gc; - PurplePresence *presence; - PurpleStatus *status; - struct gg_login_params *glp; - GGPInfo *info; - const char *address; - - if (ggp_setup_proxy(account) == -1) - return; - - gc = purple_account_get_connection(account); - glp = g_new0(struct gg_login_params, 1); - info = g_new0(GGPInfo, 1); - - /* Probably this should be moved to *_new() function. */ - info->session = NULL; - info->chats = NULL; - info->chats_count = 0; - info->token = NULL; - info->searches = ggp_search_new(); - info->pending_richtext_messages = NULL; - info->pending_images = g_hash_table_new(g_int_hash, g_int_equal); - - gc->proto_data = info; - - glp->uin = ggp_get_uin(account); - glp->password = (char *)purple_account_get_password(account); - glp->image_size = 255; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - - glp->async = 1; - glp->status = ggp_to_gg_status(status, &glp->status_descr); - glp->tls = 0; - - address = purple_account_get_string(account, "gg_server", ""); - if (address && *address) { - /* TODO: Make this non-blocking */ - struct in_addr *addr = gg_gethostbyname(address); - - purple_debug_info("gg", "Using gg server given by user (%s)\n", address); - - if (addr == NULL) { - gchar *tmp = g_strdup_printf(_("Unable to resolve hostname '%s': %s"), - address, g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, /* should this be a settings error? */ - tmp); - g_free(tmp); - return; - } - - glp->server_addr = inet_addr(inet_ntoa(*addr)); - glp->server_port = 8074; - } else - purple_debug_info("gg", "Trying to retrieve address from gg appmsg service\n"); - - info->session = gg_login(glp); - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - if (info->session == NULL) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - g_free(glp); - return; - } - gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ, - ggp_async_login_handler, gc); -} - -static void ggp_close(PurpleConnection *gc) -{ - - if (gc == NULL) { - purple_debug_info("gg", "gc == NULL\n"); - return; - } - - if (gc->proto_data) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStatus *status; - GGPInfo *info = gc->proto_data; - - status = purple_account_get_active_status(account); - - if (info->session != NULL) { - ggp_set_status(account, status); - gg_logoff(info->session); - gg_free_session(info->session); - } - - /* Immediately close any notifications on this handle since that process depends - * upon the contents of info->searches, which we are about to destroy. - */ - purple_notify_close_with_handle(gc); - - ggp_search_destroy(info->searches); - g_list_free(info->pending_richtext_messages); - g_hash_table_destroy(info->pending_images); - g_free(info); - gc->proto_data = NULL; - } - - if (gc->inpa > 0) - purple_input_remove(gc->inpa); - - purple_debug_info("gg", "Connection closed.\n"); -} - -static int ggp_send_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags) -{ - GGPInfo *info = gc->proto_data; - char *tmp, *plain; - int ret = 1; - unsigned char format[1024]; - unsigned int format_length = sizeof(struct gg_msg_richtext); - gint pos = 0; - GData *attribs; - const char *start, *end = NULL, *last; - - if (msg == NULL || *msg == '\0') { - return 0; - } - - last = msg; - - /* Check if the message is richtext */ - /* TODO: Check formatting, too */ - if(purple_markup_find_tag("img", last, &start, &end, &attribs)) { - - GString *string_buffer = g_string_new(NULL); - struct gg_msg_richtext fmt; - - do { - PurpleStoredImage *image; - const char *id; - - /* Add text before the image */ - if(start - last) { - pos = pos + g_utf8_strlen(last, start - last); - g_string_append_len(string_buffer, last, start - last); - } - - if((id = g_datalist_get_data(&attribs, "id")) && (image = purple_imgstore_find_by_id(atoi(id)))) { - struct gg_msg_richtext_format actformat; - struct gg_msg_richtext_image actimage; - gint image_size = purple_imgstore_get_size(image); - gconstpointer image_bin = purple_imgstore_get_data(image); - const char *image_filename = purple_imgstore_get_filename(image); - uint32_t crc32 = gg_crc32(0, image_bin, image_size); - - g_hash_table_insert(info->pending_images, &crc32, GINT_TO_POINTER(atoi(id))); - purple_imgstore_ref(image); - purple_debug_info("gg", "ggp_send_im_richtext: got crc: %i for imgid: %i\n", crc32, atoi(id)); - - actformat.font = GG_FONT_IMAGE; - actformat.position = pos; - - actimage.unknown1 = 0x0109; - actimage.size = gg_fix32(image_size); - actimage.crc32 = gg_fix32(crc32); - - if (actimage.size > 255000) { - purple_debug_warning("gg", "ggp_send_im_richtext: image over 255kb!\n"); - continue; - } - - purple_debug_info("gg", "ggp_send_im_richtext: adding images to richtext, size: %i, crc32: %u, name: %s\n", actimage.size, actimage.crc32, image_filename); - - memcpy(format + format_length, &actformat, sizeof(actformat)); - format_length += sizeof(actformat); - memcpy(format + format_length, &actimage, sizeof(actimage)); - format_length += sizeof(actimage); - } else { - purple_debug_error("gg", "ggp_send_im_richtext: image not found in the image store!"); - } - - last = end + 1; - g_datalist_clear(&attribs); - - } while(purple_markup_find_tag("img", last, &start, &end, &attribs)); - - /* Add text after the images */ - if(last && *last) { - pos = pos + g_utf8_strlen(last, -1); - g_string_append(string_buffer, last); - } - - fmt.flag = 2; - fmt.length = format_length - sizeof(fmt); - memcpy(format, &fmt, sizeof(fmt)); - - purple_debug_info("gg", "ggp_send_im: richtext msg = %s\n", string_buffer->str); - plain = purple_unescape_html(string_buffer->str); - g_string_free(string_buffer, TRUE); - } else { - purple_debug_info("gg", "ggp_send_im: msg = %s\n", msg); - plain = purple_unescape_html(msg); - } - - tmp = charset_convert(plain, "UTF-8", "CP1250"); - - if (tmp && (format_length - sizeof(struct gg_msg_richtext))) { - if(gg_send_message_richtext(info->session, GG_CLASS_CHAT, ggp_str_to_uin(who), (unsigned char *)tmp, format, format_length) < 0) { - ret = -1; - } else { - ret = 1; - } - } else if (NULL == tmp || *tmp == 0) { - ret = 0; - } else if (strlen(tmp) > GG_MSG_MAXSIZE) { - ret = -E2BIG; - } else if (gg_send_message(info->session, GG_CLASS_CHAT, - ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { - ret = -1; - } else { - ret = 1; - } - - g_free(plain); - g_free(tmp); - - return ret; -} - -static void ggp_get_info(PurpleConnection *gc, const char *name) -{ - GGPInfo *info = gc->proto_data; - GGPSearchForm *form; - guint32 seq; - - form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO); - - form->user_data = info; - form->uin = g_strdup(name); - form->offset = g_strdup("0"); - form->last_uin = g_strdup("0"); - - seq = ggp_search_start(gc, form); - ggp_search_add(info->searches, seq, form); - purple_debug_info("gg", "ggp_get_info(): Added seq %u", seq); -} - -static int ggp_to_gg_status(PurpleStatus *status, char **msg) -{ - const char *status_id = purple_status_get_id(status); - int new_status, new_status_descr; - const char *new_msg; - - g_return_val_if_fail(msg != NULL, 0); - - purple_debug_info("gg", "ggp_to_gg_status: Requested status = %s\n", - status_id); - - if (strcmp(status_id, "available") == 0) { - new_status = GG_STATUS_AVAIL; - new_status_descr = GG_STATUS_AVAIL_DESCR; - } else if (strcmp(status_id, "away") == 0) { - new_status = GG_STATUS_BUSY; - new_status_descr = GG_STATUS_BUSY_DESCR; - } else if (strcmp(status_id, "invisible") == 0) { - new_status = GG_STATUS_INVISIBLE; - new_status_descr = GG_STATUS_INVISIBLE_DESCR; - } else if (strcmp(status_id, "offline") == 0) { - new_status = GG_STATUS_NOT_AVAIL; - new_status_descr = GG_STATUS_NOT_AVAIL_DESCR; - } else { - new_status = GG_STATUS_AVAIL; - new_status_descr = GG_STATUS_AVAIL_DESCR; - purple_debug_info("gg", - "ggp_set_status: unknown status requested (status_id=%s)\n", - status_id); - } - - new_msg = purple_status_get_attr_string(status, "message"); - - if(new_msg) { - char *tmp = purple_markup_strip_html(new_msg); - *msg = charset_convert(tmp, "UTF-8", "CP1250"); - g_free(tmp); - - return new_status_descr; - } else { - *msg = NULL; - return new_status; - } -} - -static void ggp_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - GGPInfo *info; - int new_status; - char *new_msg = NULL; - - if (!purple_status_is_active(status)) - return; - - gc = purple_account_get_connection(account); - info = gc->proto_data; - - new_status = ggp_to_gg_status(status, &new_msg); - - if (new_msg == NULL) { - gg_change_status(info->session, new_status); - } else { - gg_change_status_descr(info->session, new_status, new_msg); - g_free(new_msg); - } - - ggp_status_fake_to_self(account); - -} - -static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - PurpleAccount *account; - GGPInfo *info = gc->proto_data; - const gchar *name = purple_buddy_get_name(buddy); - - gg_add_notify(info->session, ggp_str_to_uin(name)); - - account = purple_connection_get_account(gc); - if (strcmp(purple_account_get_username(account), name) == 0) { - ggp_status_fake_to_self(account); - } -} - -static void ggp_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - GGPInfo *info = gc->proto_data; - - gg_remove_notify(info->session, ggp_str_to_uin(purple_buddy_get_name(buddy))); -} - -static void ggp_join_chat(PurpleConnection *gc, GHashTable *data) -{ - GGPInfo *info = gc->proto_data; - GGPChat *chat; - char *chat_name; - GList *l; - PurpleConversation *conv; - PurpleAccount *account = purple_connection_get_account(gc); - - chat_name = g_hash_table_lookup(data, "name"); - - if (chat_name == NULL) - return; - - purple_debug_info("gg", "joined %s chat\n", chat_name); - - for (l = info->chats; l != NULL; l = l->next) { - chat = l->data; - - if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) { - purple_notify_error(gc, _("Chat error"), - _("This chat name is already in use"), NULL); - return; - } - } - - ggp_confer_add_new(gc, chat_name); - conv = serv_got_joined_chat(gc, info->chats_count, chat_name); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(conv), - purple_account_get_username(account), NULL, - PURPLE_CBFLAGS_NONE, TRUE); -} - -static char *ggp_get_chat_name(GHashTable *data) { - return g_strdup(g_hash_table_lookup(data, "name")); -} - -static int ggp_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurpleConversation *conv; - GGPInfo *info = gc->proto_data; - GGPChat *chat = NULL; - GList *l; - char *msg, *plain; - uin_t *uins; - int count = 0; - - if ((conv = purple_find_chat(gc, id)) == NULL) - return -EINVAL; - - for (l = info->chats; l != NULL; l = l->next) { - chat = l->data; - - if (g_utf8_collate(chat->name, conv->name) == 0) { - break; - } - - chat = NULL; - } - - if (chat == NULL) { - purple_debug_error("gg", - "ggp_chat_send: Hm... that's strange. No such chat?\n"); - return -EINVAL; - } - - uins = g_new0(uin_t, g_list_length(chat->participants)); - - for (l = chat->participants; l != NULL; l = l->next) { - uin_t uin = GPOINTER_TO_INT(l->data); - - uins[count++] = uin; - } - - plain = purple_unescape_html(message); - msg = charset_convert(plain, "UTF-8", "CP1250"); - g_free(plain); - gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, - (unsigned char *)msg); - g_free(msg); - g_free(uins); - - serv_got_chat_in(gc, id, - purple_account_get_username(purple_connection_get_account(gc)), - flags, message, time(NULL)); - - return 0; -} - -static void ggp_keepalive(PurpleConnection *gc) -{ - GGPInfo *info = gc->proto_data; - - /* purple_debug_info("gg", "Keeping connection alive....\n"); */ - - if (gg_ping(info->session) < 0) { - purple_debug_info("gg", "Not connected to the server " - "or gg_session is not correct\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Not connected to the server")); - } -} - -static void ggp_register_user(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - GGPInfo *info; - - info = gc->proto_data = g_new0(GGPInfo, 1); - - ggp_token_request(gc, ggp_register_user_dialog); -} - -static GList *ggp_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Find buddies..."), - ggp_find_buddies); - m = g_list_append(m, act); - - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Change password..."), - ggp_change_passwd); - m = g_list_append(m, act); - - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Upload buddylist to Server"), - ggp_action_buddylist_put); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Download buddylist from Server"), - ggp_action_buddylist_get); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Delete buddylist from Server"), - ggp_action_buddylist_delete); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Save buddylist to file..."), - ggp_action_buddylist_save); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Load buddylist from file..."), - ggp_action_buddylist_load); - m = g_list_append(m, act); - - return m; -} - -static gboolean ggp_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_IM_IMAGE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - ggp_list_icon, /* list_icon */ - NULL, /* list_emblem */ - ggp_status_text, /* status_text */ - ggp_tooltip_text, /* tooltip_text */ - ggp_status_types, /* status_types */ - ggp_blist_node_menu, /* blist_node_menu */ - ggp_chat_info, /* chat_info */ - NULL, /* chat_info_defaults */ - ggp_login, /* login */ - ggp_close, /* close */ - ggp_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - ggp_get_info, /* get_info */ - ggp_set_status, /* set_away */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - ggp_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - ggp_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - ggp_join_chat, /* join_chat */ - NULL, /* reject_chat */ - ggp_get_chat_name, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - ggp_chat_send, /* chat_send */ - ggp_keepalive, /* keepalive */ - ggp_register_user, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - ggp_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, /* magic */ - PURPLE_MAJOR_VERSION, /* major_version */ - PURPLE_MINOR_VERSION, /* minor_version */ - PURPLE_PLUGIN_PROTOCOL, /* plugin type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - - "prpl-gg", /* id */ - "Gadu-Gadu", /* name */ - DISPLAY_VERSION, /* version */ - - N_("Gadu-Gadu Protocol Plugin"), /* summary */ - N_("Polish popular IM"), /* description */ - "boler@sourceforge.net", /* author */ - PURPLE_WEBSITE, /* homepage */ - - NULL, /* load */ - NULL, /* unload */ - NULL, /* destroy */ - - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - ggp_actions, /* actions */ - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void purple_gg_debug_handler(int level, const char * format, va_list args) { - PurpleDebugLevel purple_level; - char *msg = g_strdup_vprintf(format, args); - - /* This is pretty pointless since the GG_DEBUG levels don't correspond to - * the purple ones */ - switch (level) { - case GG_DEBUG_FUNCTION: - purple_level = PURPLE_DEBUG_INFO; - break; - case GG_DEBUG_MISC: - case GG_DEBUG_NET: - case GG_DEBUG_DUMP: - case GG_DEBUG_TRAFFIC: - default: - purple_level = PURPLE_DEBUG_MISC; - break; - } - - purple_debug(purple_level, "gg", "%s", msg); - g_free(msg); -} - -static void init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Nickname"), - "nick", _("Gadu-Gadu User")); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("GG server"), - "gg_server", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - my_protocol = plugin; - - gg_debug_handler = purple_gg_debug_handler; -} - -PURPLE_INIT_PLUGIN(gg, init_plugin, info); - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/** - * @file gg.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_H -#define _PURPLE_GG_H - -#include -#include "internal.h" -#include "search.h" -#include "connection.h" - - -#define PUBDIR_RESULTS_MAX 20 - - -typedef struct -{ - char *name; - GList *participants; - -} GGPChat; - -typedef void (*GGPTokenCallback)(PurpleConnection *); - -typedef struct -{ - char *id; - char *data; - unsigned int size; - - struct gg_http *req; - guint inpa; - - GGPTokenCallback cb; - -} GGPToken; - -typedef struct { - - struct gg_session *session; - GGPToken *token; - GList *chats; - GGPSearches *searches; - int chats_count; - GList *pending_richtext_messages; - GHashTable *pending_images; -} GGPInfo; - -#endif /* _PURPLE_GG_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/** - * @file gg-utils.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include "gg-utils.h" - - -/* uin_t ggp_str_to_uin(const char *str) {{{ */ -uin_t ggp_str_to_uin(const char *str) -{ - char *tmp; - long num; - - if (!str) - return 0; - - errno = 0; - num = strtol(str, &tmp, 10); - - if (*str == '\0' || *tmp != '\0') - return 0; - - if ((errno == ERANGE || (num == LONG_MAX || num == LONG_MIN)) -#if (LONG_MAX > UINT_MAX) - || num > (long)UINT_MAX -#endif - || num < 0) - return 0; - - return (uin_t) num; -} -/* }}} */ - -/* unsigned int ggp_array_size(char **array) {{{ */ -unsigned int ggp_array_size(char **array) -{ - unsigned int i; - - for (i = 0; array[i] != NULL && i < UINT_MAX; i++) - {} - - return i; -} -/* }}} */ - -/* char *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) {{{ */ -char *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) -{ - gchar *msg; - GError *err = NULL; - - if (locstr == NULL) - return NULL; - - msg = g_convert_with_fallback(locstr, strlen(locstr), encdst, encsrc, - "?", NULL, NULL, &err); - if (err != NULL) { - purple_debug_error("gg", "Error converting from %s to %s: %s\n", - encsrc, encdst, err->message); - g_error_free(err); - } - - /* Just in case? */ - if (msg == NULL) - msg = g_strdup(locstr); - - return msg; -} -/* }}} */ - -/* ggp_get_uin(PurpleAccount *account) {{{ */ -uin_t ggp_get_uin(PurpleAccount *account) -{ - return ggp_str_to_uin(purple_account_get_username(account)); -} -/* }}} */ - -/* char *ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin) {{{ */ -char *ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin) -{ - PurpleBuddy *buddy; - gchar *str_uin; - - str_uin = g_strdup_printf("%lu", (unsigned long int)uin); - - buddy = purple_find_buddy(purple_connection_get_account(gc), str_uin); - if (buddy != NULL) { - g_free(str_uin); - return g_strdup(purple_buddy_get_alias(buddy)); - } else { - return str_uin; - } -} -/* }}} */ - -void ggp_status_fake_to_self(PurpleAccount *account) -{ - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - const char *msg; - - if (! purple_find_buddy(account, purple_account_get_username(account))) - return; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - msg = purple_status_get_attr_string(status, "message"); - if (msg && !*msg) - msg = NULL; - - status_id = purple_status_get_id(status); - if (strcmp(status_id, "invisible") == 0) { - status_id = "offline"; - } - - if (msg) { - if (strlen(msg) > GG_STATUS_DESCR_MAXSIZE) { - msg = purple_markup_slice(msg, 0, GG_STATUS_DESCR_MAXSIZE); - } - } - purple_prpl_got_user_status(account, purple_account_get_username(account), - status_id, - msg ? "message" : NULL, msg, NULL); -} - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/gg-utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/** - * @file gg-utils.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_GG_UTILS_H -#define _PURPLE_GG_UTILS_H - -#include "internal.h" - -#include "plugin.h" -#include "version.h" -#include "notify.h" -#include "status.h" -#include "blist.h" -#include "accountopt.h" -#include "debug.h" -#include "util.h" -#include "request.h" - -#include "gg.h" - - -/** - * Convert a base 10 string to a UIN. - * - * @param str The string to convert - * - * @return UIN or 0 if an error occurred. - */ -uin_t -ggp_str_to_uin(const char *str); - -/** - * Calculate size of a NULL-terminated array. - * - * @param array The array. - * - * @return Size of the array. - */ -unsigned int -ggp_array_size(char **array); - -/** - * Convert enconding of a given string. - * - * @param locstr Input string. - * @param encsrc Current encoding of the string. - * @param encdst Target encoding of the string. - * - * @return Converted string (it must be g_free()ed when not used. Or NULL if - * locstr is NULL. - */ -char * -charset_convert(const gchar *locstr, const char *encsrc, const char *encdst); - -/** - * Get UIN of a given account. - * - * @param account Current account. - * - * @return UIN of an account. - */ -uin_t -ggp_get_uin(PurpleAccount *account); - -/** - * Returns the best name of a buddy from the buddylist. - * - * @param gc PurpleConnection instance. - * @param uin UIN of the buddy. - * - * @return Name of the buddy, or UIN converted to string. - */ -char * -ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin); - -/** - * Manages the display of account's status in the buddylist. - * - * @param account Current account. - */ -void -ggp_status_fake_to_self(PurpleAccount *account); - - -#endif /* _PURPLE_GG_UTILS_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/common.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/common.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/common.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/common.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,826 +0,0 @@ -/* $Id: common.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Robert J. Wony - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#ifdef sun -# include -#endif -#endif - -#include -#include -#ifndef _WIN32 -#include -#endif -#include -#include -#include -#include -#include - -FILE *gg_debug_file = NULL; - -#ifndef GG_DEBUG_DISABLE - -/* - * gg_debug() // funkcja wewntrzna - * - * wywietla komunikat o danym poziomie, o ile uytkownik sobie tego yczy. - * - * - level - poziom wiadomoci - * - format... - tre wiadomoci (kompatybilna z printf()) - */ -void gg_debug(int level, const char *format, ...) -{ - va_list ap; - int old_errno = errno; - - if (gg_debug_handler) { - va_start(ap, format); - (*gg_debug_handler)(level, format, ap); - va_end(ap); - - goto cleanup; - } - - if ((gg_debug_level & level)) { - va_start(ap, format); - vfprintf((gg_debug_file) ? gg_debug_file : stderr, format, ap); - va_end(ap); - } - -cleanup: - errno = old_errno; -} - -#endif - -/* - * gg_vsaprintf() // funkcja pomocnicza - * - * robi dokadnie to samo, co vsprintf(), tyle e alokuje sobie wczeniej - * miejsce na dane. powinno dziaa na tych maszynach, ktre maj funkcj - * vsnprintf() zgodn z C99, jak i na wczeniejszych. - * - * - format - opis wywietlanego tekstu jak dla printf() - * - ap - lista argumentw dla printf() - * - * zaalokowany bufor, ktry naley pniej zwolni, lub NULL - * jeli nie udao si wykona zadania. - */ -char *gg_vsaprintf(const char *format, va_list ap) -{ - int size = 0; - const char *start; - char *buf = NULL; - -#ifdef __GG_LIBGADU_HAVE_VA_COPY - va_list aq; - - va_copy(aq, ap); -#else -# ifdef __GG_LIBGADU_HAVE___VA_COPY - va_list aq; - - __va_copy(aq, ap); -# endif -#endif - - start = format; - -#ifndef __GG_LIBGADU_HAVE_C99_VSNPRINTF - { - int res; - char *tmp; - - size = 128; - do { - size *= 2; - if (!(tmp = realloc(buf, size))) { - free(buf); - return NULL; - } - buf = tmp; - res = vsnprintf(buf, size, format, ap); - } while (res == size - 1 || res == -1); - } -#else - { - char tmp[2]; - - /* libce Solarisa przy buforze NULL zawsze zwracaj -1, wic - * musimy poda co istniejcego jako cel printf()owania. */ - size = vsnprintf(tmp, sizeof(tmp), format, ap); - if (!(buf = malloc(size + 1))) - return NULL; - } -#endif - - format = start; - -#ifdef __GG_LIBGADU_HAVE_VA_COPY - vsnprintf(buf, size + 1, format, aq); - va_end(aq); -#else -# ifdef __GG_LIBGADU_HAVE___VA_COPY - vsnprintf(buf, size + 1, format, aq); - va_end(aq); -# else - vsnprintf(buf, size + 1, format, ap); -# endif -#endif - - return buf; -} - -/* - * gg_saprintf() // funkcja pomocnicza - * - * robi dokadnie to samo, co sprintf(), tyle e alokuje sobie wczeniej - * miejsce na dane. powinno dziaa na tych maszynach, ktre maj funkcj - * vsnprintf() zgodn z C99, jak i na wczeniejszych. - * - * - format... - tre taka sama jak w funkcji printf() - * - * zaalokowany bufor, ktry naley pniej zwolni, lub NULL - * jeli nie udao si wykona zadania. - */ -char *gg_saprintf(const char *format, ...) -{ - va_list ap; - char *res; - - va_start(ap, format); - res = gg_vsaprintf(format, ap); - va_end(ap); - - return res; -} - -/* - * gg_get_line() // funkcja pomocnicza - * - * podaje kolejn lini z bufora tekstowego. niszczy go bezpowrotnie, dzielc - * na kolejne stringi. zdarza si, nie ma potrzeby pisania funkcji dublujcej - * bufor eby tylko mie nieruszone dane wejciowe, skoro i tak nie bd nam - * poniej potrzebne. obcina `\r\n'. - * - * - ptr - wskanik do zmiennej, ktra przechowuje aktualn pozycj - * w przemiatanym buforze - * - * wskanik do kolejnej linii tekstu lub NULL, jeli to ju koniec bufora. - */ -char *gg_get_line(char **ptr) -{ - char *foo, *res; - - if (!ptr || !*ptr || !strcmp(*ptr, "")) - return NULL; - - res = *ptr; - - if (!(foo = strchr(*ptr, '\n'))) - *ptr += strlen(*ptr); - else { - *ptr = foo + 1; - *foo = 0; - if (strlen(res) > 1 && res[strlen(res) - 1] == '\r') - res[strlen(res) - 1] = 0; - } - - return res; -} - -/* - * gg_connect() // funkcja pomocnicza - * - * czy si z serwerem. pierwszy argument jest typu (void *), eby nie - * musie niczego inkludowa w libgadu.h i nie psu jaki gupich zalenoci - * na dziwnych systemach. - * - * - addr - adres serwera (struct in_addr *) - * - port - port serwera - * - async - asynchroniczne poczenie - * - * deskryptor gniazda lub -1 w przypadku bdu (kod bdu w zmiennej errno). - */ -int gg_connect(void *addr, int port, int async) -{ - int sock, one = 1, errno2; - struct sockaddr_in sin; - struct in_addr *a = addr; - struct sockaddr_in myaddr; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_connect(%s, %d, %d);\n", inet_ntoa(*a), port, async); - - if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_connect() socket() failed (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - - memset(&myaddr, 0, sizeof(myaddr)); - myaddr.sin_family = AF_INET; - - myaddr.sin_addr.s_addr = gg_local_ip; - - if (bind(sock, (struct sockaddr *) &myaddr, sizeof(myaddr)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_connect() bind() failed (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - -#ifdef ASSIGN_SOCKETS_TO_THREADS - gg_win32_thread_socket(0, sock); -#endif - - if (async) { -#ifdef FIONBIO - if (ioctl(sock, FIONBIO, &one) == -1) { -#else - if (fcntl(sock, F_SETFL, O_NONBLOCK) == -1) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_connect() ioctl() failed (errno=%d, %s)\n", errno, strerror(errno)); - errno2 = errno; - close(sock); - errno = errno2; - return -1; - } - } - - sin.sin_port = htons(port); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = a->s_addr; - - if (connect(sock, (struct sockaddr*) &sin, sizeof(sin)) == -1) { - if (errno && (!async || errno != EINPROGRESS)) { - gg_debug(GG_DEBUG_MISC, "// gg_connect() connect() failed (errno=%d, %s)\n", errno, strerror(errno)); - errno2 = errno; - close(sock); - errno = errno2; - return -1; - } - gg_debug(GG_DEBUG_MISC, "// gg_connect() connect() in progress\n"); - } - - return sock; -} - -/* - * gg_read_line() // funkcja pomocnicza - * - * czyta jedn lini tekstu z gniazda. - * - * - sock - deskryptor gniazda - * - buf - wskanik do bufora - * - length - dugo bufora - * - * jeli trafi na bd odczytu lub podano nieprawidowe parametry, zwraca NULL. - * inaczej zwraca buf. - */ -char *gg_read_line(int sock, char *buf, int length) -{ - int ret; - - if (!buf || length < 0) - return NULL; - - for (; length > 1; buf++, length--) { - do { - if ((ret = read(sock, buf, 1)) == -1 && errno != EINTR) { - gg_debug(GG_DEBUG_MISC, "// gg_read_line() error on read (errno=%d, %s)\n", errno, strerror(errno)); - *buf = 0; - return NULL; - } else if (ret == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_read_line() eof reached\n"); - *buf = 0; - return NULL; - } - } while (ret == -1 && errno == EINTR); - - if (*buf == '\n') { - buf++; - break; - } - } - - *buf = 0; - return buf; -} - -/* - * gg_chomp() // funkcja pomocnicza - * - * ucina "\r\n" lub "\n" z koca linii. - * - * - line - linia do przycicia - */ -void gg_chomp(char *line) -{ - int len; - - if (!line) - return; - - len = strlen(line); - - if (len > 0 && line[len - 1] == '\n') - line[--len] = 0; - if (len > 0 && line[len - 1] == '\r') - line[--len] = 0; -} - -/* - * gg_urlencode() // funkcja wewntrzna - * - * zamienia podany tekst na cig znakw do formularza http. przydaje si - * przy rnych usugach katalogu publicznego. - * - * - str - cig znakw do zakodowania - * - * zaalokowany bufor, ktry naley pniej zwolni albo NULL - * w przypadku bdu. - */ -char *gg_urlencode(const char *str) -{ - char *q, *buf, hex[] = "0123456789abcdef"; - const char *p; - unsigned int size = 0; - - if (!str) - str = ""; - - for (p = str; *p; p++, size++) { - if (!((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') || *p == ' ') || (*p == '@') || (*p == '.') || (*p == '-')) - size += 2; - } - - if (!(buf = malloc(size + 1))) - return NULL; - - for (p = str, q = buf; *p; p++, q++) { - if ((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') || (*p == '@') || (*p == '.') || (*p == '-')) - *q = *p; - else { - if (*p == ' ') - *q = '+'; - else { - *q++ = '%'; - *q++ = hex[*p >> 4 & 15]; - *q = hex[*p & 15]; - } - } - } - - *q = 0; - - return buf; -} - -/* - * gg_http_hash() // funkcja wewntrzna - * - * funkcja liczca hash dla adresu e-mail, hasa i paru innych. - * - * - format... - format kolejnych parametrw ('s' jeli dany parametr jest - * cigiem znakw lub 'u' jeli numerem GG) - * - * hash wykorzystywany przy rejestracji i wszelkich manipulacjach wasnego - * wpisu w katalogu publicznym. - */ -int gg_http_hash(const char *format, ...) -{ - unsigned int a, c, i, j; - va_list ap; - int b = -1; - - va_start(ap, format); - - for (j = 0; j < strlen(format); j++) { - char *arg, buf[16]; - - if (format[j] == 'u') { - snprintf(buf, sizeof(buf), "%d", va_arg(ap, uin_t)); - arg = buf; - } else { - if (!(arg = va_arg(ap, char*))) - arg = ""; - } - - i = 0; - while ((c = (unsigned char) arg[i++]) != 0) { - a = (c ^ b) + (c << 8); - b = (a >> 24) | (a << 8); - } - } - - va_end(ap); - - return (b < 0 ? -b : b); -} - -/* - * gg_gethostbyname() // funkcja pomocnicza - * - * odpowiednik gethostbyname() troszczcy si o wspbieno, gdy mamy do - * dyspozycji funkcj gethostbyname_r(). - * - * - hostname - nazwa serwera - * - * zwraca wskanik na struktur in_addr, ktr naley zwolni. - */ -struct in_addr *gg_gethostbyname(const char *hostname) -{ - struct in_addr *addr = NULL; - -#ifdef HAVE_GETHOSTBYNAME_R - char *tmpbuf = NULL, *buf = NULL; - struct hostent *hp = NULL, *hp2 = NULL; - int h_errnop, ret; - size_t buflen = 1024; - int new_errno; - - new_errno = ENOMEM; - - if (!(addr = malloc(sizeof(struct in_addr)))) - goto cleanup; - - if (!(hp = calloc(1, sizeof(*hp)))) - goto cleanup; - - if (!(buf = malloc(buflen))) - goto cleanup; - - tmpbuf = buf; - - while ((ret = gethostbyname_r(hostname, hp, buf, buflen, &hp2, &h_errnop)) == ERANGE) { - buflen *= 2; - - if (!(tmpbuf = realloc(buf, buflen))) - break; - - buf = tmpbuf; - } - - if (ret) - new_errno = h_errnop; - - if (ret || !hp2 || !tmpbuf) - goto cleanup; - - memcpy(addr, hp->h_addr, sizeof(struct in_addr)); - - free(buf); - free(hp); - - return addr; - -cleanup: - errno = new_errno; - - if (addr) - free(addr); - if (hp) - free(hp); - if (buf) - free(buf); - - return NULL; -#else - struct hostent *hp; - - if (!(addr = malloc(sizeof(struct in_addr)))) { - goto cleanup; - } - - if (!(hp = gethostbyname(hostname))) - goto cleanup; - - memcpy(addr, hp->h_addr, sizeof(struct in_addr)); - - return addr; - -cleanup: - if (addr) - free(addr); - - return NULL; -#endif -} - -#ifdef ASSIGN_SOCKETS_TO_THREADS - -typedef struct gg_win32_thread { - int id; - int socket; - struct gg_win32_thread *next; -} gg_win32_thread; - -struct gg_win32_thread *gg_win32_threads = 0; - -/* - * gg_win32_thread_socket() // funkcja pomocnicza, tylko dla win32 - * - * zwraca deskryptor gniazda, ktre byo ostatnio tworzone dla wtku - * o podanym identyfikatorze. - * - * jeli na win32 przy poczeniach synchronicznych zapamitamy w jakim - * wtku uruchomilimy funkcj, ktra si z czymkolwiek czy, to z osobnego - * wtku moemy anulowa poczenie poprzez gg_win32_thread_socket(watek, -1); - * - * - thread_id - id wtku. jeli jest rwne 0, brany jest aktualny wtek, - * jeli rwne -1, usuwa wpis o podanym sockecie. - * - socket - deskryptor gniazda. jeli rwne 0, zwraca deskryptor gniazda - * dla podanego wtku, jeli rwne -1, usuwa wpis, jeli co - * innego, ustawia dla podanego wtku dany numer deskryptora. - * - * jeli socket jest rwne 0, zwraca deskryptor gniazda dla podanego wtku. - */ -int gg_win32_thread_socket(int thread_id, int socket) -{ - char close = (thread_id == -1) || socket == -1; - gg_win32_thread *wsk = gg_win32_threads; - gg_win32_thread **p_wsk = &gg_win32_threads; - - if (!thread_id) - thread_id = GetCurrentThreadId(); - - while (wsk) { - if ((thread_id == -1 && wsk->socket == socket) || wsk->id == thread_id) { - if (close) { - /* socket zostaje usuniety */ - closesocket(wsk->socket); - *p_wsk = wsk->next; - free(wsk); - return 1; - } else if (!socket) { - /* socket zostaje zwrocony */ - return wsk->socket; - } else { - /* socket zostaje ustawiony */ - wsk->socket = socket; - return socket; - } - } - p_wsk = &(wsk->next); - wsk = wsk->next; - } - - if (close && socket != -1) - closesocket(socket); - if (close || !socket) - return 0; - - /* Dodaje nowy element */ - wsk = malloc(sizeof(gg_win32_thread)); - wsk->id = thread_id; - wsk->socket = socket; - wsk->next = 0; - *p_wsk = wsk; - - return socket; -} - -#endif /* ASSIGN_SOCKETS_TO_THREADS */ - -static char gg_base64_charset[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -/* - * gg_base64_encode() - * - * zapisuje cig znakw w base64. - * - * - buf - cig znakw. - * - * zaalokowany bufor. - */ -char *gg_base64_encode(const char *buf) -{ - char *out, *res; - unsigned int i = 0, j = 0, k = 0, len = strlen(buf); - - res = out = malloc((len / 3 + 1) * 4 + 2); - - if (!res) - return NULL; - - while (j <= len) { - switch (i % 4) { - case 0: - k = (buf[j] & 252) >> 2; - break; - case 1: - if (j < len) - k = ((buf[j] & 3) << 4) | ((buf[j + 1] & 240) >> 4); - else - k = (buf[j] & 3) << 4; - - j++; - break; - case 2: - if (j < len) - k = ((buf[j] & 15) << 2) | ((buf[j + 1] & 192) >> 6); - else - k = (buf[j] & 15) << 2; - - j++; - break; - case 3: - k = buf[j++] & 63; - break; - } - *out++ = gg_base64_charset[k]; - i++; - } - - if (i % 4) - for (j = 0; j < 4 - (i % 4); j++, out++) - *out = '='; - - *out = 0; - - return res; -} - -/* - * gg_base64_decode() - * - * dekoduje cig znakw z base64. - * - * - buf - cig znakw. - * - * zaalokowany bufor. - */ -char *gg_base64_decode(const char *buf) -{ - char *res, *save, *foo, val; - const char *end; - unsigned int index = 0; - - if (!buf) - return NULL; - - save = res = calloc(1, (strlen(buf) / 4 + 1) * 3 + 2); - - if (!save) - return NULL; - - end = buf + strlen(buf); - - while (*buf && buf < end) { - if (*buf == '\r' || *buf == '\n') { - buf++; - continue; - } - if (!(foo = strchr(gg_base64_charset, *buf))) - foo = gg_base64_charset; - val = (int)(foo - gg_base64_charset); - buf++; - switch (index) { - case 0: - *res |= val << 2; - break; - case 1: - *res++ |= val >> 4; - *res |= val << 4; - break; - case 2: - *res++ |= val >> 2; - *res |= val << 6; - break; - case 3: - *res++ |= val; - break; - } - index++; - index %= 4; - } - *res = 0; - - return save; -} - -/* - * gg_proxy_auth() // funkcja wewntrzna - * - * tworzy nagwek autoryzacji dla proxy. - * - * zaalokowany tekst lub NULL, jeli proxy nie jest wczone lub nie wymaga - * autoryzacji. - */ -char *gg_proxy_auth() -{ - char *tmp, *enc, *out; - unsigned int tmp_size; - - if (!gg_proxy_enabled || !gg_proxy_username || !gg_proxy_password) - return NULL; - - if (!(tmp = malloc((tmp_size = strlen(gg_proxy_username) + strlen(gg_proxy_password) + 2)))) - return NULL; - - snprintf(tmp, tmp_size, "%s:%s", gg_proxy_username, gg_proxy_password); - - if (!(enc = gg_base64_encode(tmp))) { - free(tmp); - return NULL; - } - - free(tmp); - - if (!(out = malloc(strlen(enc) + 40))) { - free(enc); - return NULL; - } - - snprintf(out, strlen(enc) + 40, "Proxy-Authorization: Basic %s\r\n", enc); - - free(enc); - - return out; -} - -static uint32_t gg_crc32_table[256]; -static int gg_crc32_initialized = 0; - -/* - * gg_crc32_make_table() // funkcja wewntrzna - */ -static void gg_crc32_make_table() -{ - uint32_t h = 1; - unsigned int i, j; - - memset(gg_crc32_table, 0, sizeof(gg_crc32_table)); - - for (i = 128; i; i >>= 1) { - h = (h >> 1) ^ ((h & 1) ? 0xedb88320L : 0); - - for (j = 0; j < 256; j += 2 * i) - gg_crc32_table[i + j] = gg_crc32_table[j] ^ h; - } - - gg_crc32_initialized = 1; -} - -/* - * gg_crc32() - * - * wyznacza sum kontroln CRC32 danego bloku danych. - * - * - crc - suma kontrola poprzedniego bloku danych lub 0 jeli pierwszy - * - buf - bufor danych - * - size - ilo danych - * - * suma kontrolna CRC32. - */ -uint32_t gg_crc32(uint32_t crc, const unsigned char *buf, int len) -{ - if (!gg_crc32_initialized) - gg_crc32_make_table(); - - if (!buf || len < 0) - return crc; - - crc ^= 0xffffffffL; - - while (len--) - crc = (crc >> 8) ^ gg_crc32_table[(crc ^ *buf++) & 0xff]; - - return crc ^ 0xffffffffL; -} - - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/compat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/compat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/compat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/compat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* $Id: compat.h 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Robert J. Wony - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#ifndef __COMPAT_H -#define __COMPAT_H - -#ifdef sun -# define INADDR_NONE ((in_addr_t) 0xffffffff) -#endif - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/COPYING qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/COPYING --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/COPYING 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/dcc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/dcc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/dcc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/dcc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1301 +0,0 @@ -/* $Id: dcc.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Tomasz Chiliski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#include -#include -#ifndef _WIN32 -#include -#include -#include -#include -#ifdef sun -# include -#endif -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "compat.h" -#ifndef GG_DEBUG_DISABLE -/* - * gg_dcc_debug_data() // funkcja wewntrzna - * - * wywietla zrzut pakietu w hexie. - * - * - prefix - prefiks zrzutu pakietu - * - fd - deskryptor gniazda - * - buf - bufor z danymi - * - size - rozmiar danych - */ -static void gg_dcc_debug_data(const char *prefix, int fd, const void *buf, unsigned int size) -{ - unsigned int i; - - gg_debug(GG_DEBUG_MISC, "++ gg_dcc %s (fd=%d,len=%d)", prefix, fd, size); - - for (i = 0; i < size; i++) - gg_debug(GG_DEBUG_MISC, " %.2x", ((unsigned char*) buf)[i]); - - gg_debug(GG_DEBUG_MISC, "\n"); -} -#else -#define gg_dcc_debug_data(a,b,c,d) do { } while (0) -#endif - -/* - * gg_dcc_request() - * - * wysya informacj o tym, e dany klient powinien si z nami poczy. - * wykorzystywane, kiedy druga strona, ktrej chcemy co wysa jest za - * maskarad. - * - * - sess - struktura opisujca sesj GG - * - uin - numerek odbiorcy - * - * patrz gg_send_message_ctcp(). - */ -int gg_dcc_request(struct gg_session *sess, uin_t uin) -{ - return gg_send_message_ctcp(sess, GG_CLASS_CTCP, uin, (const unsigned char *)"\002", 1); -} - -/* - * gg_dcc_fill_filetime() // funkcja wewntrzna - * - * zamienia czas w postaci unixowej na windowsowy. - * - * - unix - czas w postaci unixowej - * - filetime - czas w postaci windowsowej - */ -static void gg_dcc_fill_filetime(uint32_t ut, uint32_t *ft) -{ -#ifdef __GG_LIBGADU_HAVE_LONG_LONG - unsigned long long tmp; - - tmp = ut; - tmp += 11644473600LL; - tmp *= 10000000LL; - -#ifndef __GG_LIBGADU_BIGENDIAN - ft[0] = (uint32_t) tmp; - ft[1] = (uint32_t) (tmp >> 32); -#else - ft[0] = gg_fix32((uint32_t) (tmp >> 32)); - ft[1] = gg_fix32((uint32_t) tmp); -#endif - -#endif -} - -/* - * gg_dcc_fill_file_info() - * - * wypenia pola struct gg_dcc niezbdne do wysania pliku. - * - * - d - struktura opisujca poczenie DCC - * - filename - nazwa pliku - * - * 0, -1. - */ -int gg_dcc_fill_file_info(struct gg_dcc *d, const char *filename) -{ - return gg_dcc_fill_file_info2(d, filename, filename); -} - -/* - * gg_dcc_fill_file_info2() - * - * wypenia pola struct gg_dcc niezbdne do wysania pliku. - * - * - d - struktura opisujca poczenie DCC - * - filename - nazwa pliku - * - local_filename - nazwa na lokalnym systemie plikw - * - * 0, -1. - */ -int gg_dcc_fill_file_info2(struct gg_dcc *d, const char *filename, const char *local_filename) -{ - struct stat st; - const char *name, *ext, *p; - unsigned char *q; - int i, j; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_fill_file_info2(%p, \"%s\", \"%s\");\n", d, filename, local_filename); - - if (!d || d->type != GG_SESSION_DCC_SEND) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() invalid arguments\n"); - errno = EINVAL; - return -1; - } - - if (stat(local_filename, &st) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() stat() failed (%s)\n", strerror(errno)); - return -1; - } - - if ((st.st_mode & S_IFDIR)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() that's a directory\n"); - errno = EINVAL; - return -1; - } - - if ((d->file_fd = open(local_filename, O_RDONLY)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() open() failed (%s)\n", strerror(errno)); - return -1; - } - - memset(&d->file_info, 0, sizeof(d->file_info)); - - if (!(st.st_mode & S_IWUSR)) - d->file_info.mode |= gg_fix32(GG_DCC_FILEATTR_READONLY); - - gg_dcc_fill_filetime(st.st_atime, d->file_info.atime); - gg_dcc_fill_filetime(st.st_mtime, d->file_info.mtime); - gg_dcc_fill_filetime(st.st_ctime, d->file_info.ctime); - - d->file_info.size = gg_fix32(st.st_size); - d->file_info.mode = gg_fix32(0x20); /* FILE_ATTRIBUTE_ARCHIVE */ - - if (!(name = strrchr(filename, '/'))) - name = filename; - else - name++; - - if (!(ext = strrchr(name, '.'))) - ext = name + strlen(name); - - for (i = 0, p = name; i < 8 && p < ext; i++, p++) - d->file_info.short_filename[i] = toupper(name[i]); - - if (i == 8 && p < ext) { - d->file_info.short_filename[6] = '~'; - d->file_info.short_filename[7] = '1'; - } - - if (strlen(ext) > 0) { - for (j = 0; *ext && j < 4; j++, p++) - d->file_info.short_filename[i + j] = toupper(ext[j]); - } - - for (q = d->file_info.short_filename; *q; q++) { - if (*q == 185) { - *q = 165; - } else if (*q == 230) { - *q = 198; - } else if (*q == 234) { - *q = 202; - } else if (*q == 179) { - *q = 163; - } else if (*q == 241) { - *q = 209; - } else if (*q == 243) { - *q = 211; - } else if (*q == 156) { - *q = 140; - } else if (*q == 159) { - *q = 143; - } else if (*q == 191) { - *q = 175; - } - } - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_fill_file_info2() short name \"%s\", dos name \"%s\"\n", name, d->file_info.short_filename); - strncpy((char *)d->file_info.filename, name, sizeof(d->file_info.filename) - 1); - - return 0; -} - -/* - * gg_dcc_transfer() // funkcja wewntrzna - * - * inicjuje proces wymiany pliku z danym klientem. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - type - rodzaj wymiany (GG_SESSION_DCC_SEND lub GG_SESSION_DCC_GET) - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -static struct gg_dcc *gg_dcc_transfer(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin, int type) -{ - struct gg_dcc *d = NULL; - struct in_addr addr; - - addr.s_addr = ip; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_transfer(%s, %d, %ld, %ld, %s);\n", inet_ntoa(addr), port, my_uin, peer_uin, (type == GG_SESSION_DCC_SEND) ? "SEND" : "GET"); - - if (!ip || ip == INADDR_NONE || !port || !my_uin || !peer_uin) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() invalid arguments\n"); - errno = EINVAL; - return NULL; - } - - if (!(d = (void*) calloc(1, sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() not enough memory\n"); - return NULL; - } - - d->check = GG_CHECK_WRITE; - d->state = GG_STATE_CONNECTING; - d->type = type; - d->timeout = GG_DEFAULT_TIMEOUT; - d->file_fd = -1; - d->active = 1; - d->fd = -1; - d->uin = my_uin; - d->peer_uin = peer_uin; - - if ((d->fd = gg_connect(&addr, port, 1)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_transfer() connection failed\n"); - free(d); - return NULL; - } - - return d; -} - -/* - * gg_dcc_get_file() - * - * inicjuje proces odbierania pliku od danego klienta, gdy ten wysa do - * nas danie poczenia. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_get_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin) -{ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_get_file() handing over to gg_dcc_transfer()\n"); - - return gg_dcc_transfer(ip, port, my_uin, peer_uin, GG_SESSION_DCC_GET); -} - -/* - * gg_dcc_send_file() - * - * inicjuje proces wysyania pliku do danego klienta. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_send_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin) -{ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_send_file() handing over to gg_dcc_transfer()\n"); - - return gg_dcc_transfer(ip, port, my_uin, peer_uin, GG_SESSION_DCC_SEND); -} - -/* - * gg_dcc_voice_chat() - * - * prbuje nawiza poczenie gosowe. - * - * - ip - adres ip odbiorcy - * - port - port odbiorcy - * - my_uin - wasny numer - * - peer_uin - numer obiorcy - * - * zaalokowana struct gg_dcc lub NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_voice_chat(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin) -{ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_chat() handing over to gg_dcc_transfer()\n"); - - return gg_dcc_transfer(ip, port, my_uin, peer_uin, GG_SESSION_DCC_VOICE); -} - -/* - * gg_dcc_set_type() - * - * po zdarzeniu GG_EVENT_DCC_CALLBACK naley ustawi typ poczenia za - * pomoc tej funkcji. - * - * - d - struktura opisujca poczenie - * - type - typ poczenia (GG_SESSION_DCC_SEND lub GG_SESSION_DCC_VOICE) - */ -void gg_dcc_set_type(struct gg_dcc *d, int type) -{ - d->type = type; - d->state = (type == GG_SESSION_DCC_SEND) ? GG_STATE_SENDING_FILE_INFO : GG_STATE_SENDING_VOICE_REQUEST; -} - -/* - * gg_dcc_callback() // funkcja wewntrzna - * - * wywoywana z struct gg_dcc->callback, odpala gg_dcc_watch_fd i umieszcza - * rezultat w struct gg_dcc->event. - * - * - d - structura opisujca poczenie - * - * 0, -1. - */ -static int gg_dcc_callback(struct gg_dcc *d) -{ - struct gg_event *e = gg_dcc_watch_fd(d); - - d->event = e; - - return (e != NULL) ? 0 : -1; -} - -/* - * gg_dcc_socket_create() - * - * tworzy gniazdo dla bezporedniej komunikacji midzy klientami. - * - * - uin - wasny numer - * - port - preferowany port, jeli rwny 0 lub -1, prbuje domylnego - * - * zaalokowana struct gg_dcc, ktr poniej naley zwolni funkcj - * gg_dcc_free(), albo NULL jeli wystpi bd. - */ -struct gg_dcc *gg_dcc_socket_create(uin_t uin, uint16_t port) -{ - struct gg_dcc *c; - struct sockaddr_in sin; - int sock, bound = 0, errno2; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_create_dcc_socket(%d, %d);\n", uin, port); - - if (!uin) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() invalid arguments\n"); - errno = EINVAL; - return NULL; - } - - if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() can't create socket (%s)\n", strerror(errno)); - return NULL; - } - - if (!port) - port = GG_DEFAULT_DCC_PORT; - - while (!bound) { - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = INADDR_ANY; - sin.sin_port = htons(port); - - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() trying port %d\n", port); - if (!bind(sock, (struct sockaddr*) &sin, sizeof(sin))) - bound = 1; - else { - if (++port == 65535) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() no free port found\n"); - close(sock); - return NULL; - } - } - } - - if (listen(sock, 10)) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() unable to listen (%s)\n", strerror(errno)); - errno2 = errno; - close(sock); - errno = errno2; - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() bound to port %d\n", port); - - if (!(c = malloc(sizeof(*c)))) { - gg_debug(GG_DEBUG_MISC, "// gg_create_dcc_socket() not enough memory for struct\n"); - close(sock); - return NULL; - } - memset(c, 0, sizeof(*c)); - - c->port = c->id = port; - c->fd = sock; - c->type = GG_SESSION_DCC_SOCKET; - c->uin = uin; - c->timeout = -1; - c->state = GG_STATE_LISTENING; - c->check = GG_CHECK_READ; - c->callback = gg_dcc_callback; - c->destroy = gg_dcc_free; - - return c; -} - -/* - * gg_dcc_voice_send() - * - * wysya ramk danych dla rozmowy gosowej. - * - * - d - struktura opisujca poczenie dcc - * - buf - bufor z danymi - * - length - rozmiar ramki - * - * 0, -1. - */ -int gg_dcc_voice_send(struct gg_dcc *d, char *buf, int length) -{ - struct packet_s { - uint8_t type; - uint32_t length; - } GG_PACKED; - struct packet_s packet; - - gg_debug(GG_DEBUG_FUNCTION, "++ gg_dcc_voice_send(%p, %p, %d);\n", d, buf, length); - if (!d || !buf || length < 0 || d->type != GG_SESSION_DCC_VOICE) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() invalid argument\n"); - errno = EINVAL; - return -1; - } - - packet.type = 0x03; /* XXX */ - packet.length = gg_fix32(length); - - if (write(d->fd, &packet, sizeof(packet)) < (signed)sizeof(packet)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() write() failed\n"); - return -1; - } - gg_dcc_debug_data("write", d->fd, &packet, sizeof(packet)); - - if (write(d->fd, buf, length) < length) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_voice_send() write() failed\n"); - return -1; - } - gg_dcc_debug_data("write", d->fd, buf, length); - - return 0; -} - -#define gg_read(fd, buf, size) \ -{ \ - int tmp = read(fd, buf, size); \ - \ - if (tmp < (int) size) { \ - if (tmp == -1) { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed (errno=%d, %s)\n", errno, strerror(errno)); \ - } else if (tmp == 0) { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed, connection broken\n"); \ - } else { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed (%d bytes, %d needed)\n", tmp, size); \ - } \ - e->type = GG_EVENT_DCC_ERROR; \ - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; \ - return e; \ - } \ - gg_dcc_debug_data("read", fd, buf, size); \ -} - -#define gg_write(fd, buf, size) \ -{ \ - int tmp; \ - gg_dcc_debug_data("write", fd, buf, size); \ - tmp = write(fd, buf, size); \ - if (tmp < (int) size) { \ - if (tmp == -1) { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (errno=%d, %s)\n", errno, strerror(errno)); \ - } else { \ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (%d needed, %d done)\n", size, tmp); \ - } \ - e->type = GG_EVENT_DCC_ERROR; \ - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; \ - return e; \ - } \ -} - -/* - * gg_dcc_watch_fd() - * - * funkcja, ktr naley wywoa, gdy co si zmieni na gg_dcc->fd. - * - * - h - struktura zwrcona przez gg_create_dcc_socket() - * - * zaalokowana struct gg_event lub NULL, jeli zabrako pamici na ni. - */ -struct gg_event *gg_dcc_watch_fd(struct gg_dcc *h) -{ - struct gg_event *e; - int foo; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_watch_fd(%p);\n", h); - - if (!h || (h->type != GG_SESSION_DCC && h->type != GG_SESSION_DCC_SOCKET && h->type != GG_SESSION_DCC_SEND && h->type != GG_SESSION_DCC_GET && h->type != GG_SESSION_DCC_VOICE)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() invalid argument\n"); - errno = EINVAL; - return NULL; - } - - if (!(e = (void*) calloc(1, sizeof(*e)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory\n"); - return NULL; - } - - e->type = GG_EVENT_NONE; - - if (h->type == GG_SESSION_DCC_SOCKET) { - struct sockaddr_in sin; - struct gg_dcc *c; - int fd; - socklen_t sin_len = sizeof(sin); - int one = 1; - - if ((fd = accept(h->fd, (struct sockaddr*) &sin, &sin_len)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't accept() new connection (errno=%d, %s)\n", errno, strerror(errno)); - return e; - } - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() new direct connection from %s:%d\n", inet_ntoa(sin.sin_addr), htons(sin.sin_port)); - -#ifdef FIONBIO - if (ioctl(fd, FIONBIO, &one) == -1) { -#else - if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() can't set nonblocking (errno=%d, %s)\n", errno, strerror(errno)); - close(fd); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - return e; - } - - if (!(c = (void*) calloc(1, sizeof(*c)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() not enough memory for client data\n"); - - free(e); - close(fd); - return NULL; - } - - c->fd = fd; - c->check = GG_CHECK_READ; - c->state = GG_STATE_READING_UIN_1; - c->type = GG_SESSION_DCC; - c->timeout = GG_DEFAULT_TIMEOUT; - c->file_fd = -1; - c->remote_addr = sin.sin_addr.s_addr; - c->remote_port = ntohs(sin.sin_port); - - e->type = GG_EVENT_DCC_NEW; - e->event.dcc_new = c; - - return e; - } else { - struct gg_dcc_tiny_packet tiny; - struct gg_dcc_small_packet small; - struct gg_dcc_big_packet big; - int size, tmp, res; - socklen_t res_size = sizeof(res); - unsigned int utmp; - char buf[1024], ack[] = "UDAG"; - - struct gg_dcc_file_info_packet { - struct gg_dcc_big_packet big; - struct gg_file_info file_info; - } GG_PACKED; - struct gg_dcc_file_info_packet file_info_packet; - - switch (h->state) { - case GG_STATE_READING_UIN_1: - case GG_STATE_READING_UIN_2: - { - uin_t uin; - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_READING_UIN_%d\n", (h->state == GG_STATE_READING_UIN_1) ? 1 : 2); - - gg_read(h->fd, &uin, sizeof(uin)); - - if (h->state == GG_STATE_READING_UIN_1) { - h->state = GG_STATE_READING_UIN_2; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->peer_uin = gg_fix32(uin); - } else { - h->state = GG_STATE_SENDING_ACK; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - h->uin = gg_fix32(uin); - e->type = GG_EVENT_DCC_CLIENT_ACCEPT; - } - - return e; - } - - case GG_STATE_SENDING_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_SENDING_ACK\n"); - - gg_write(h->fd, ack, 4); - - h->state = GG_STATE_READING_TYPE; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_READING_TYPE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_TYPE\n"); - - gg_read(h->fd, &small, sizeof(small)); - - small.type = gg_fix32(small.type); - - switch (small.type) { - case 0x0003: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() callback\n"); - h->type = GG_SESSION_DCC_SEND; - h->state = GG_STATE_SENDING_FILE_INFO; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - e->type = GG_EVENT_DCC_CALLBACK; - - break; - - case 0x0002: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() dialin\n"); - h->type = GG_SESSION_DCC_GET; - h->state = GG_STATE_READING_REQUEST; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->incoming = 1; - - break; - - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() unknown dcc type (%.4x) from %ld\n", small.type, h->peer_uin); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - } - - return e; - - case GG_STATE_READING_REQUEST: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_REQUEST\n"); - - gg_read(h->fd, &small, sizeof(small)); - - small.type = gg_fix32(small.type); - - switch (small.type) { - case 0x0001: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() file transfer request\n"); - h->state = GG_STATE_READING_FILE_INFO; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - break; - - case 0x0003: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() voice chat request\n"); - h->state = GG_STATE_SENDING_VOICE_ACK; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DCC_TIMEOUT_VOICE_ACK; - h->type = GG_SESSION_DCC_VOICE; - e->type = GG_EVENT_DCC_NEED_VOICE_ACK; - - break; - - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() unknown dcc request (%.4x) from %ld\n", small.type, h->peer_uin); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - } - - return e; - - case GG_STATE_READING_FILE_INFO: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_FILE_INFO\n"); - - gg_read(h->fd, &file_info_packet, sizeof(file_info_packet)); - - memcpy(&h->file_info, &file_info_packet.file_info, sizeof(h->file_info)); - - h->file_info.mode = gg_fix32(h->file_info.mode); - h->file_info.size = gg_fix32(h->file_info.size); - - h->state = GG_STATE_SENDING_FILE_ACK; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DCC_TIMEOUT_FILE_ACK; - - e->type = GG_EVENT_DCC_NEED_FILE_ACK; - - return e; - - case GG_STATE_SENDING_FILE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE_ACK\n"); - - big.type = gg_fix32(0x0006); /* XXX */ - big.dunno1 = gg_fix32(h->offset); - big.dunno2 = 0; - - gg_write(h->fd, &big, sizeof(big)); - - h->state = GG_STATE_READING_FILE_HEADER; - h->chunk_size = sizeof(big); - h->chunk_offset = 0; - if (!(h->chunk_buf = malloc(sizeof(big)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n"); - free(e); - return NULL; - } - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_SENDING_VOICE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_VOICE_ACK\n"); - - tiny.type = 0x01; /* XXX */ - - gg_write(h->fd, &tiny, sizeof(tiny)); - - h->state = GG_STATE_READING_VOICE_HEADER; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - h->offset = 0; - - return e; - - case GG_STATE_READING_FILE_HEADER: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_FILE_HEADER\n"); - - tmp = read(h->fd, h->chunk_buf + h->chunk_offset, h->chunk_size - h->chunk_offset); - - if (tmp == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() read() failed (errno=%d, %s)\n", errno, strerror(errno)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - gg_dcc_debug_data("read", h->fd, h->chunk_buf + h->chunk_offset, h->chunk_size - h->chunk_offset); - - h->chunk_offset += tmp; - - if (h->chunk_offset < h->chunk_size) - return e; - - memcpy(&big, h->chunk_buf, sizeof(big)); - free(h->chunk_buf); - h->chunk_buf = NULL; - - big.type = gg_fix32(big.type); - h->chunk_size = gg_fix32(big.dunno1); - h->chunk_offset = 0; - - if (big.type == 0x0005) { /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() transfer refused\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_REFUSED; - return e; - } - - if (h->chunk_size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() empty chunk, EOF\n"); - e->type = GG_EVENT_DCC_DONE; - return e; - } - - h->state = GG_STATE_GETTING_FILE; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->established = 1; - - return e; - - case GG_STATE_READING_VOICE_HEADER: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_HEADER\n"); - - gg_read(h->fd, &tiny, sizeof(tiny)); - - switch (tiny.type) { - case 0x03: /* XXX */ - h->state = GG_STATE_READING_VOICE_SIZE; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - h->established = 1; - break; - case 0x04: /* XXX */ - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() peer breaking connection\n"); - /* XXX zwraca odpowiedni event */ - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() unknown request (%.2x)\n", tiny.type); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - } - - return e; - - case GG_STATE_READING_VOICE_SIZE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_SIZE\n"); - - gg_read(h->fd, &small, sizeof(small)); - - small.type = gg_fix32(small.type); - - if (small.type < 16 || small.type > sizeof(buf)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() invalid voice frame size (%d)\n", small.type); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - - return e; - } - - h->chunk_size = small.type; - h->chunk_offset = 0; - - if (!(h->voice_buf = malloc(h->chunk_size))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory for voice frame\n"); - return NULL; - } - - h->state = GG_STATE_READING_VOICE_DATA; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_READING_VOICE_DATA: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_DATA\n"); - - tmp = read(h->fd, h->voice_buf + h->chunk_offset, h->chunk_size - h->chunk_offset); - if (tmp < 1) { - if (tmp == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed (errno=%d, %s)\n", errno, strerror(errno)); - } else { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed, connection broken\n"); - } - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - gg_dcc_debug_data("read", h->fd, h->voice_buf + h->chunk_offset, tmp); - - h->chunk_offset += tmp; - - if (h->chunk_offset >= h->chunk_size) { - e->type = GG_EVENT_DCC_VOICE_DATA; - e->event.dcc_voice_data.data = h->voice_buf; - e->event.dcc_voice_data.length = h->chunk_size; - h->state = GG_STATE_READING_VOICE_HEADER; - h->voice_buf = NULL; - } - - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_CONNECTING: - { - uin_t uins[2]; - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_CONNECTING\n"); - - res = 0; - if ((foo = getsockopt(h->fd, SOL_SOCKET, SO_ERROR, &res, &res_size)) || res) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() connection failed (fd=%d,errno=%d(%s),foo=%d,res=%d(%s))\n", h->fd, errno, strerror(errno), foo, res, strerror(res)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - return e; - } - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() connected, sending uins\n"); - - uins[0] = gg_fix32(h->uin); - uins[1] = gg_fix32(h->peer_uin); - - gg_write(h->fd, uins, sizeof(uins)); - - h->state = GG_STATE_READING_ACK; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - } - - case GG_STATE_READING_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_ACK\n"); - - gg_read(h->fd, buf, 4); - - if (strncmp(buf, ack, 4)) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() did't get ack\n"); - - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - return e; - } - - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - h->state = GG_STATE_SENDING_REQUEST; - - return e; - - case GG_STATE_SENDING_VOICE_REQUEST: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_VOICE_REQUEST\n"); - - small.type = gg_fix32(0x0003); - - gg_write(h->fd, &small, sizeof(small)); - - h->state = GG_STATE_READING_VOICE_ACK; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - return e; - - case GG_STATE_SENDING_REQUEST: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_REQUEST\n"); - - small.type = (h->type == GG_SESSION_DCC_GET) ? gg_fix32(0x0003) : gg_fix32(0x0002); /* XXX */ - - gg_write(h->fd, &small, sizeof(small)); - - switch (h->type) { - case GG_SESSION_DCC_GET: - h->state = GG_STATE_READING_REQUEST; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - break; - - case GG_SESSION_DCC_SEND: - h->state = GG_STATE_SENDING_FILE_INFO; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - if (h->file_fd == -1) - e->type = GG_EVENT_DCC_NEED_FILE_INFO; - break; - - case GG_SESSION_DCC_VOICE: - h->state = GG_STATE_SENDING_VOICE_REQUEST; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - return e; - - case GG_STATE_SENDING_FILE_INFO: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE_INFO\n"); - - if (h->file_fd == -1) { - e->type = GG_EVENT_DCC_NEED_FILE_INFO; - return e; - } - - small.type = gg_fix32(0x0001); /* XXX */ - - gg_write(h->fd, &small, sizeof(small)); - - file_info_packet.big.type = gg_fix32(0x0003); /* XXX */ - file_info_packet.big.dunno1 = 0; - file_info_packet.big.dunno2 = 0; - - memcpy(&file_info_packet.file_info, &h->file_info, sizeof(h->file_info)); - - /* zostaj teraz u nas, wic odwracamy z powrotem */ - h->file_info.size = gg_fix32(h->file_info.size); - h->file_info.mode = gg_fix32(h->file_info.mode); - - gg_write(h->fd, &file_info_packet, sizeof(file_info_packet)); - - h->state = GG_STATE_READING_FILE_ACK; - h->check = GG_CHECK_READ; - h->timeout = GG_DCC_TIMEOUT_FILE_ACK; - - return e; - - case GG_STATE_READING_FILE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_FILE_ACK\n"); - - gg_read(h->fd, &big, sizeof(big)); - - /* XXX sprawdza wynik */ - h->offset = gg_fix32(big.dunno1); - - h->state = GG_STATE_SENDING_FILE_HEADER; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - e->type = GG_EVENT_DCC_ACK; - - return e; - - case GG_STATE_READING_VOICE_ACK: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_READING_VOICE_ACK\n"); - - gg_read(h->fd, &tiny, sizeof(tiny)); - - if (tiny.type != 0x01) { - gg_debug(GG_DEBUG_MISC, "// invalid reply (%.2x), connection refused\n", tiny.type); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_REFUSED; - return e; - } - - h->state = GG_STATE_READING_VOICE_HEADER; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - - e->type = GG_EVENT_DCC_ACK; - - return e; - - case GG_STATE_SENDING_FILE_HEADER: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE_HEADER\n"); - - h->chunk_offset = 0; - - if ((h->chunk_size = h->file_info.size - h->offset) > 4096) { - h->chunk_size = 4096; - big.type = gg_fix32(0x0003); /* XXX */ - } else - big.type = gg_fix32(0x0002); /* XXX */ - - big.dunno1 = gg_fix32(h->chunk_size); - big.dunno2 = 0; - - gg_write(h->fd, &big, sizeof(big)); - - h->state = GG_STATE_SENDING_FILE; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - h->established = 1; - - return e; - - case GG_STATE_SENDING_FILE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_SENDING_FILE\n"); - - if ((utmp = h->chunk_size - h->chunk_offset) > sizeof(buf)) - utmp = sizeof(buf); - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() offset=%d, size=%d\n", h->offset, h->file_info.size); - - /* koniec pliku? */ - if (h->file_info.size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof on empty file\n"); - e->type = GG_EVENT_DCC_DONE; - - return e; - } - - lseek(h->file_fd, h->offset, SEEK_SET); - - size = read(h->file_fd, buf, utmp); - - /* bd */ - if (size == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed. (errno=%d, %s)\n", errno, strerror(errno)); - - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_FILE; - - return e; - } - - /* koniec pliku? */ - if (size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_EOF; - - return e; - } - - /* jeli wczytalimy wicej, utnijmy. */ - if (h->offset + size > h->file_info.size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() too much (read=%d, ofs=%d, size=%d)\n", size, h->offset, h->file_info.size); - size = h->file_info.size - h->offset; - - if (size < 1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() reached EOF after cutting\n"); - e->type = GG_EVENT_DCC_DONE; - return e; - } - } - - tmp = write(h->fd, buf, size); - - if (tmp == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (%s)\n", strerror(errno)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - h->offset += size; - - if (h->offset >= h->file_info.size) { - e->type = GG_EVENT_DCC_DONE; - return e; - } - - h->chunk_offset += size; - - if (h->chunk_offset >= h->chunk_size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() chunk finished\n"); - h->state = GG_STATE_SENDING_FILE_HEADER; - h->timeout = GG_DEFAULT_TIMEOUT; - } else { - h->state = GG_STATE_SENDING_FILE; - h->timeout = GG_DCC_TIMEOUT_SEND; - } - - h->check = GG_CHECK_WRITE; - - return e; - - case GG_STATE_GETTING_FILE: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_GETTING_FILE\n"); - - if ((utmp = h->chunk_size - h->chunk_offset) > sizeof(buf)) - utmp = sizeof(buf); - - size = read(h->fd, buf, utmp); - - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() ofs=%d, size=%d, read()=%d\n", h->offset, h->file_info.size, size); - - /* bd */ - if (size == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() failed. (errno=%d, %s)\n", errno, strerror(errno)); - - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - - return e; - } - - /* koniec? */ - if (size == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() read() reached eof\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_EOF; - - return e; - } - - tmp = write(h->file_fd, buf, size); - - if (tmp == -1 || tmp < size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() write() failed (%d:fd=%d:res=%d:%s)\n", tmp, h->file_fd, size, strerror(errno)); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_NET; - return e; - } - - h->offset += size; - - if (h->offset >= h->file_info.size) { - e->type = GG_EVENT_DCC_DONE; - return e; - } - - h->chunk_offset += size; - - if (h->chunk_offset >= h->chunk_size) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() chunk finished\n"); - h->state = GG_STATE_READING_FILE_HEADER; - h->timeout = GG_DEFAULT_TIMEOUT; - h->chunk_offset = 0; - h->chunk_size = sizeof(big); - if (!(h->chunk_buf = malloc(sizeof(big)))) { - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() out of memory\n"); - free(e); - return NULL; - } - } else { - h->state = GG_STATE_GETTING_FILE; - h->timeout = GG_DCC_TIMEOUT_GET; - } - - h->check = GG_CHECK_READ; - - return e; - - default: - gg_debug(GG_DEBUG_MISC, "// gg_dcc_watch_fd() GG_STATE_???\n"); - e->type = GG_EVENT_DCC_ERROR; - e->event.dcc_error = GG_ERROR_DCC_HANDSHAKE; - - return e; - } - } - - return e; -} - -#undef gg_read -#undef gg_write - -/* - * gg_dcc_free() - * - * zwalnia pami po strukturze poczenia dcc. - * - * - d - zwalniana struktura - */ -void gg_dcc_free(struct gg_dcc *d) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_dcc_free(%p);\n", d); - - if (!d) - return; - - if (d->fd != -1) - close(d->fd); - - if (d->chunk_buf) { - free(d->chunk_buf); - d->chunk_buf = NULL; - } - - free(d); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/events.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/events.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/events.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/events.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1578 +0,0 @@ -/* $Id: events.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * Robert J. Wony - * Arkadiusz Mikiewicz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#include -#ifndef _WIN32 -#include -#include -#include -#include -#include -#endif - -#include "libgadu-config.h" - -#include -#ifdef __GG_LIBGADU_HAVE_PTHREAD -# include -#endif -#include -#include -#include -#include -#include -#ifdef __GG_LIBGADU_HAVE_OPENSSL -# include -# include -#endif - -#include "compat.h" - -/* - * gg_event_free() - * - * zwalnia pami zajmowan przez informacj o zdarzeniu. - * - * - e - wskanik do informacji o zdarzeniu - */ -void gg_event_free(struct gg_event *e) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_event_free(%p);\n", e); - - if (!e) - return; - - switch (e->type) { - case GG_EVENT_MSG: - free(e->event.msg.message); - free(e->event.msg.formats); - free(e->event.msg.recipients); - break; - - case GG_EVENT_NOTIFY: - free(e->event.notify); - break; - - case GG_EVENT_NOTIFY60: - { - int i; - - for (i = 0; e->event.notify60[i].uin; i++) - free(e->event.notify60[i].descr); - - free(e->event.notify60); - - break; - } - - case GG_EVENT_STATUS60: - free(e->event.status60.descr); - break; - - case GG_EVENT_STATUS: - free(e->event.status.descr); - break; - - case GG_EVENT_NOTIFY_DESCR: - free(e->event.notify_descr.notify); - free(e->event.notify_descr.descr); - break; - - case GG_EVENT_DCC_VOICE_DATA: - free(e->event.dcc_voice_data.data); - break; - - case GG_EVENT_PUBDIR50_SEARCH_REPLY: - case GG_EVENT_PUBDIR50_READ: - case GG_EVENT_PUBDIR50_WRITE: - gg_pubdir50_free(e->event.pubdir50); - break; - - case GG_EVENT_USERLIST: - free(e->event.userlist.reply); - break; - - case GG_EVENT_IMAGE_REPLY: - free(e->event.image_reply.filename); - free(e->event.image_reply.image); - break; - } - - free(e); -} - -/* - * gg_image_queue_remove() - * - * usuwa z kolejki dany wpis. - * - * - s - sesja - * - q - kolejka - * - freeq - czy zwolni kolejk - * - * 0/-1 - */ -int gg_image_queue_remove(struct gg_session *s, struct gg_image_queue *q, int freeq) -{ - if (!s || !q) { - errno = EFAULT; - return -1; - } - - if (s->images == q) - s->images = q->next; - else { - struct gg_image_queue *qq; - - for (qq = s->images; qq; qq = qq->next) { - if (qq->next == q) { - qq->next = q->next; - break; - } - } - } - - if (freeq) { - free(q->image); - free(q->filename); - free(q); - } - - return 0; -} - -/* - * gg_image_queue_parse() // funkcja wewntrzna - * - * parsuje przychodzcy pakiet z obrazkiem. - * - * - e - opis zdarzenia - * - - */ -static void gg_image_queue_parse(struct gg_event *e, char *p, unsigned int len, struct gg_session *sess, uin_t sender) -{ - struct gg_msg_image_reply *i = (void*) p; - struct gg_image_queue *q, *qq; - - if (!p || !sess || !e) { - errno = EFAULT; - return; - } - - /* znajd dany obrazek w kolejce danej sesji */ - - for (qq = sess->images, q = NULL; qq; qq = qq->next) { - if (sender == qq->sender && i->size == qq->size && i->crc32 == qq->crc32) { - q = qq; - break; - } - } - - if (!q) { - gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() unknown image from %d, size=%d, crc32=%.8x\n", sender, i->size, i->crc32); - return; - } - - if (p[0] == 0x05) { - unsigned int i, ok = 0; - - q->done = 0; - - len -= sizeof(struct gg_msg_image_reply); - p += sizeof(struct gg_msg_image_reply); - - /* sprawd, czy mamy tekst zakoczony \0 */ - - for (i = 0; i < len; i++) { - if (!p[i]) { - ok = 1; - break; - } - } - - if (!ok) { - gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() malformed packet from %d, unlimited filename\n", sender); - return; - } - - if (!(q->filename = strdup(p))) { - gg_debug(GG_DEBUG_MISC, "// gg_image_queue_parse() not enough memory for filename\n"); - return; - } - - len -= strlen(p) + 1; - p += strlen(p) + 1; - } else { - len -= sizeof(struct gg_msg_image_reply); - p += sizeof(struct gg_msg_image_reply); - } - - if (q->done + len > q->size) - len = q->size - q->done; - - memcpy(q->image + q->done, p, len); - q->done += len; - - /* jeli skoczono odbiera obrazek, wygeneruj zdarzenie */ - - if (q->done >= q->size) { - e->type = GG_EVENT_IMAGE_REPLY; - e->event.image_reply.sender = sender; - e->event.image_reply.size = q->size; - e->event.image_reply.crc32 = q->crc32; - e->event.image_reply.filename = q->filename; - e->event.image_reply.image = q->image; - - gg_image_queue_remove(sess, q, 0); - - free(q); - } -} - -/* - * gg_handle_recv_msg() // funkcja wewntrzna - * - * obsuguje pakiet z przychodzc wiadomoci, rozbijajc go na dodatkowe - * struktury (konferencje, kolorki) w razie potrzeby. - * - * - h - nagwek pakietu - * - e - opis zdarzenia - * - * 0, -1. - */ -static int gg_handle_recv_msg(struct gg_header *h, struct gg_event *e, struct gg_session *sess) -{ - struct gg_recv_msg *r = (struct gg_recv_msg*) ((char*) h + sizeof(struct gg_header)); - char *p, *packet_end = (char*) r + h->length; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_handle_recv_msg(%p, %p);\n", h, e); - - if (!r->seq && !r->msgclass) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() oops, silently ignoring the bait\n"); - e->type = GG_EVENT_NONE; - return 0; - } - - for (p = (char*) r + sizeof(*r); *p; p++) { - if (*p == 0x02 && p == packet_end - 1) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() received ctcp packet\n"); - break; - } - if (p >= packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() malformed packet, message out of bounds (0)\n"); - goto malformed; - } - } - - p++; - - /* przeanalizuj dodatkowe opcje */ - while (p < packet_end) { - switch (*p) { - case 0x01: /* konferencja */ - { - struct gg_msg_recipients *m = (void*) p; - uint32_t i, count; - - p += sizeof(*m); - - if (p > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (1)\n"); - goto malformed; - } - - count = gg_fix32(m->count); - - if (p + count * sizeof(uin_t) > packet_end || p + count * sizeof(uin_t) < p || count > 0xffff) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (1.5)\n"); - goto malformed; - } - - if (!(e->event.msg.recipients = (void*) malloc(count * sizeof(uin_t)))) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() not enough memory for recipients data\n"); - goto fail; - } - - for (i = 0; i < count; i++, p += sizeof(uint32_t)) { - uint32_t u; - memcpy(&u, p, sizeof(uint32_t)); - e->event.msg.recipients[i] = gg_fix32(u); - } - - e->event.msg.recipients_count = count; - - break; - } - - case 0x02: /* richtext */ - { - uint16_t len; - char *buf; - - if (p + 3 > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (2)\n"); - goto malformed; - } - - memcpy(&len, p + 1, sizeof(uint16_t)); - len = gg_fix16(len); - - if (!(buf = malloc(len))) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() not enough memory for richtext data\n"); - goto fail; - } - - p += 3; - - if (p + len > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (3)\n"); - free(buf); - goto malformed; - } - - memcpy(buf, p, len); - - e->event.msg.formats = buf; - e->event.msg.formats_length = len; - - p += len; - - break; - } - - case 0x04: /* image_request */ - { - struct gg_msg_image_request *i = (void*) p; - - if (p + sizeof(*i) > packet_end) { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (3)\n"); - goto malformed; - } - - e->event.image_request.sender = gg_fix32(r->sender); - e->event.image_request.size = gg_fix32(i->size); - e->event.image_request.crc32 = gg_fix32(i->crc32); - - e->type = GG_EVENT_IMAGE_REQUEST; - - return 0; - } - - case 0x05: /* image_reply */ - case 0x06: - { - struct gg_msg_image_reply *rep = (void*) p; - - if (p + sizeof(struct gg_msg_image_reply) == packet_end) { - - /* pusta odpowied - klient po drugiej stronie nie ma danego obrazka */ - - e->type = GG_EVENT_IMAGE_REPLY; - e->event.image_reply.sender = gg_fix32(r->sender); - e->event.image_reply.size = 0; - e->event.image_reply.crc32 = gg_fix32(rep->crc32); - e->event.image_reply.filename = NULL; - e->event.image_reply.image = NULL; - return 0; - - } else if (p + sizeof(struct gg_msg_image_reply) + 1 > packet_end) { - - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() packet out of bounds (4)\n"); - goto malformed; - } - - rep->size = gg_fix32(rep->size); - rep->crc32 = gg_fix32(rep->crc32); - gg_image_queue_parse(e, p, (unsigned int)(packet_end - p), sess, gg_fix32(r->sender)); - - return 0; - } - - default: - { - gg_debug(GG_DEBUG_MISC, "// gg_handle_recv_msg() unknown payload 0x%.2x\n", *p); - p = packet_end; - } - } - } - - e->type = GG_EVENT_MSG; - e->event.msg.msgclass = gg_fix32(r->msgclass); - e->event.msg.sender = gg_fix32(r->sender); - e->event.msg.time = gg_fix32(r->time); - e->event.msg.message = (unsigned char *)strdup((char*) r + sizeof(*r)); - - return 0; - -malformed: - e->type = GG_EVENT_NONE; - - free(e->event.msg.recipients); - free(e->event.msg.formats); - - return 0; - -fail: - free(e->event.msg.recipients); - free(e->event.msg.formats); - return -1; -} - -/* - * gg_watch_fd_connected() // funkcja wewntrzna - * - * patrzy na gniazdo, odbiera pakiet i wypenia struktur zdarzenia. - * - * - sess - struktura opisujca sesj - * - e - opis zdarzenia - * - * 0, -1. - */ -static int gg_watch_fd_connected(struct gg_session *sess, struct gg_event *e) -{ - struct gg_header *h = NULL; - char *p; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_watch_fd_connected(%p, %p);\n", sess, e); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (!(h = gg_recv_packet(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() gg_recv_packet failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - - p = (char*) h + sizeof(struct gg_header); - - switch (h->type) { - case GG_RECV_MSG: - { - if (h->length >= sizeof(struct gg_recv_msg)) - if (gg_handle_recv_msg(h, e, sess)) - goto fail; - - break; - } - - case GG_NOTIFY_REPLY: - { - struct gg_notify_reply *n = (void*) p; - unsigned int count, i; - char *tmp; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n"); - - if (h->length < sizeof(*n)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() incomplete packet\n"); - errno = EINVAL; - goto fail; - } - - if (gg_fix32(n->status) == GG_STATUS_BUSY_DESCR || gg_fix32(n->status) == GG_STATUS_NOT_AVAIL_DESCR || gg_fix32(n->status) == GG_STATUS_AVAIL_DESCR) { - e->type = GG_EVENT_NOTIFY_DESCR; - - if (!(e->event.notify_descr.notify = (void*) malloc(sizeof(*n) * 2))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - e->event.notify_descr.notify[1].uin = 0; - memcpy(e->event.notify_descr.notify, p, sizeof(*n)); - e->event.notify_descr.notify[0].uin = gg_fix32(e->event.notify_descr.notify[0].uin); - e->event.notify_descr.notify[0].status = gg_fix32(e->event.notify_descr.notify[0].status); - e->event.notify_descr.notify[0].remote_ip = e->event.notify_descr.notify[0].remote_ip; - e->event.notify_descr.notify[0].remote_port = gg_fix16(e->event.notify_descr.notify[0].remote_port); - - count = h->length - sizeof(*n); - if (!(tmp = malloc(count + 1))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - memcpy(tmp, p + sizeof(*n), count); - tmp[count] = 0; - e->event.notify_descr.descr = tmp; - - } else { - e->type = GG_EVENT_NOTIFY; - - if (!(e->event.notify = (void*) malloc(h->length + 2 * sizeof(*n)))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - - memcpy(e->event.notify, p, h->length); - count = h->length / sizeof(*n); - e->event.notify[count].uin = 0; - - for (i = 0; i < count; i++) { - e->event.notify[i].uin = gg_fix32(e->event.notify[i].uin); - e->event.notify[i].status = gg_fix32(e->event.notify[i].status); - e->event.notify[i].remote_ip = e->event.notify[i].remote_ip; - e->event.notify[i].remote_port = gg_fix16(e->event.notify[i].remote_port); - } - } - - break; - } - - case GG_STATUS: - { - struct gg_status *s = (void*) p; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n"); - - if (h->length >= sizeof(*s)) { - e->type = GG_EVENT_STATUS; - memcpy(&e->event.status, p, sizeof(*s)); - e->event.status.uin = gg_fix32(e->event.status.uin); - e->event.status.status = gg_fix32(e->event.status.status); - if (h->length > sizeof(*s)) { - int len = h->length - sizeof(*s); - char *buf = malloc(len + 1); - if (buf) { - memcpy(buf, p + sizeof(*s), len); - buf[len] = 0; - } - e->event.status.descr = buf; - } else - e->event.status.descr = NULL; - } - - break; - } - - case GG_NOTIFY_REPLY60: - { - struct gg_notify_reply60 *n = (void*) p; - unsigned int length = h->length, i = 0; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a notify reply\n"); - - e->type = GG_EVENT_NOTIFY60; - e->event.notify60 = malloc(sizeof(*e->event.notify60)); - - if (!e->event.notify60) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - - e->event.notify60[0].uin = 0; - - while (length >= sizeof(struct gg_notify_reply60)) { - uin_t uin = gg_fix32(n->uin); - char *tmp; - - e->event.notify60[i].uin = uin & 0x00ffffff; - e->event.notify60[i].status = n->status; - e->event.notify60[i].remote_ip = n->remote_ip; - e->event.notify60[i].remote_port = gg_fix16(n->remote_port); - e->event.notify60[i].version = n->version; - e->event.notify60[i].image_size = n->image_size; - e->event.notify60[i].descr = NULL; - e->event.notify60[i].time = 0; - - if (uin & 0x40000000) - e->event.notify60[i].version |= GG_HAS_AUDIO_MASK; - if (uin & 0x08000000) - e->event.notify60[i].version |= GG_ERA_OMNIX_MASK; - - if (GG_S_D(n->status)) { - unsigned char descr_len = *((char*) n + sizeof(struct gg_notify_reply60)); - - if (descr_len < length) { - if (!(e->event.notify60[i].descr = malloc(descr_len + 1))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - goto fail; - } - - memcpy(e->event.notify60[i].descr, (char*) n + sizeof(struct gg_notify_reply60) + 1, descr_len); - e->event.notify60[i].descr[descr_len] = 0; - - /* XXX czas */ - } - - length -= sizeof(struct gg_notify_reply60) + descr_len + 1; - n = (void*) ((char*) n + sizeof(struct gg_notify_reply60) + descr_len + 1); - } else { - length -= sizeof(struct gg_notify_reply60); - n = (void*) ((char*) n + sizeof(struct gg_notify_reply60)); - } - - if (!(tmp = realloc(e->event.notify60, (i + 2) * sizeof(*e->event.notify60)))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for notify data\n"); - free(e->event.notify60); - goto fail; - } - - e->event.notify60 = (void*) tmp; - e->event.notify60[++i].uin = 0; - } - - break; - } - - case GG_STATUS60: - { - struct gg_status60 *s = (void*) p; - uint32_t uin; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a status change\n"); - - if (h->length < sizeof(*s)) - break; - - uin = gg_fix32(s->uin); - - e->type = GG_EVENT_STATUS60; - e->event.status60.uin = uin & 0x00ffffff; - e->event.status60.status = s->status; - e->event.status60.remote_ip = s->remote_ip; - e->event.status60.remote_port = gg_fix16(s->remote_port); - e->event.status60.version = s->version; - e->event.status60.image_size = s->image_size; - e->event.status60.descr = NULL; - e->event.status60.time = 0; - - if (uin & 0x40000000) - e->event.status60.version |= GG_HAS_AUDIO_MASK; - if (uin & 0x08000000) - e->event.status60.version |= GG_ERA_OMNIX_MASK; - - if (h->length > sizeof(*s)) { - int len = h->length - sizeof(*s); - char *buf = malloc(len + 1); - - if (buf) { - memcpy(buf, (char*) p + sizeof(*s), len); - buf[len] = 0; - } - - e->event.status60.descr = buf; - - if (len > 4 && p[h->length - 5] == 0) { - uint32_t t; - memcpy(&t, p + h->length - 4, sizeof(uint32_t)); - e->event.status60.time = gg_fix32(t); - } - } - - break; - } - - case GG_SEND_MSG_ACK: - { - struct gg_send_msg_ack *s = (void*) p; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a message ack\n"); - - if (h->length < sizeof(*s)) - break; - - e->type = GG_EVENT_ACK; - e->event.ack.status = gg_fix32(s->status); - e->event.ack.recipient = gg_fix32(s->recipient); - e->event.ack.seq = gg_fix32(s->seq); - - break; - } - - case GG_PONG: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received a pong\n"); - - e->type = GG_EVENT_PONG; - sess->last_pong = time(NULL); - - break; - } - - case GG_DISCONNECTING: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received disconnection warning\n"); - e->type = GG_EVENT_DISCONNECT; - break; - } - - case GG_PUBDIR50_REPLY: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received pubdir/search reply\n"); - if (gg_pubdir50_handle_reply(e, p, h->length) == -1) - goto fail; - break; - } - - case GG_USERLIST_REPLY: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received userlist reply\n"); - - if (h->length < 1) - break; - - /* jeli odpowied na eksport, wywoaj zdarzenie tylko - * gdy otrzymano wszystkie odpowiedzi */ - if (p[0] == GG_USERLIST_PUT_REPLY || p[0] == GG_USERLIST_PUT_MORE_REPLY) { - if (--sess->userlist_blocks) - break; - - p[0] = GG_USERLIST_PUT_REPLY; - } - - if (h->length > 1) { - char *tmp; - unsigned int len = (sess->userlist_reply) ? strlen(sess->userlist_reply) : 0; - - gg_debug(GG_DEBUG_MISC, "userlist_reply=%p, len=%d\n", sess->userlist_reply, len); - - if (!(tmp = realloc(sess->userlist_reply, len + h->length))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() not enough memory for userlist reply\n"); - free(sess->userlist_reply); - sess->userlist_reply = NULL; - goto fail; - } - - sess->userlist_reply = tmp; - sess->userlist_reply[len + h->length - 1] = 0; - memcpy(sess->userlist_reply + len, p + 1, h->length - 1); - } - - if (p[0] == GG_USERLIST_GET_MORE_REPLY) - break; - - e->type = GG_EVENT_USERLIST; - e->event.userlist.type = p[0]; - e->event.userlist.reply = sess->userlist_reply; - sess->userlist_reply = NULL; - - break; - } - - default: - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd_connected() received unknown packet 0x%.2x\n", h->type); - } - - free(h); - return 0; - -fail: - free(h); - return -1; -} - -/* - * gg_watch_fd() - * - * funkcja, ktr naley wywoa, gdy co si stanie z obserwowanym - * deskryptorem. zwraca klientowi informacj o tym, co si dzieje. - * - * - sess - opis sesji - * - * wskanik do struktury gg_event, ktr trzeba zwolni pniej - * za pomoc gg_event_free(). jesli rodzaj zdarzenia jest rwny - * GG_EVENT_NONE, naley je zignorowa. jeli zwrcio NULL, - * stao si co niedobrego -- albo zabrako pamici albo zerwao - * poczenie. - */ -struct gg_event *gg_watch_fd(struct gg_session *sess) -{ - struct gg_event *e; - int res = 0; - int port = 0; - int errno2 = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_watch_fd(%p);\n", sess); - - if (!sess) { - errno = EFAULT; - return NULL; - } - - if (!(e = (void*) calloc(1, sizeof(*e)))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() not enough memory for event data\n"); - return NULL; - } - - e->type = GG_EVENT_NONE; - - switch (sess->state) { - case GG_STATE_RESOLVING: - { - struct in_addr addr; - int failed = 0; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_RESOLVING\n"); - - if (read(sess->fd, &addr, sizeof(addr)) < (signed)sizeof(addr) || addr.s_addr == INADDR_NONE) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() resolving failed\n"); - failed = 1; - errno2 = errno; - } - - close(sess->fd); - sess->fd = -1; - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (sess->resolver) { - pthread_cancel(*((pthread_t*) sess->resolver)); - free(sess->resolver); - sess->resolver = NULL; - } -#elif defined _WIN32 - if (sess->resolver) { - HANDLE h = sess->resolver; - TerminateThread(h, 0); - CloseHandle(h); - sess->resolver = NULL; - } -#else - waitpid(sess->pid, NULL, 0); - sess->pid = -1; -#endif - - if (failed) { - errno = errno2; - goto fail_resolving; - } - - /* jeli jestemy w resolverze i mamy ustawiony port - * proxy, znaczy, e resolvowalimy proxy. zatem - * wpiszmy jego adres. */ - if (sess->proxy_port) - sess->proxy_addr = addr.s_addr; - - /* zapiszmy sobie adres huba i adres serwera (do - * bezporedniego poczenia, jeli hub ley) - * z resolvera. */ - if (sess->proxy_addr && sess->proxy_port) - port = sess->proxy_port; - else { - sess->server_addr = sess->hub_addr = addr.s_addr; - port = GG_APPMSG_PORT; - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() resolved, connecting to %s:%d\n", inet_ntoa(addr), port); - - /* czymy si albo z hubem, albo z proxy, zalenie - * od tego, co resolvowalimy. */ - if ((sess->fd = gg_connect(&addr, port, sess->async)) == -1) { - /* jeli w trybie asynchronicznym gg_connect() - * zwrci bd, nie ma sensu prbowa dalej. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), critical\n", errno, strerror(errno)); - goto fail_connecting; - } - - /* jeli podano serwer i czmy si przez proxy, - * jest to bezporednie poczenie, inaczej jest - * do huba. */ - sess->state = (sess->proxy_addr && sess->proxy_port && sess->server_addr) ? GG_STATE_CONNECTING_GG : GG_STATE_CONNECTING_HUB; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - - case GG_STATE_CONNECTING_HUB: - { - char buf[1024], *client, *auth; - int res = 0; - socklen_t res_size = sizeof(res); - const char *host, *appmsg; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_HUB\n"); - - /* jeli asynchroniczne, sprawdzamy, czy nie wystpi - * przypadkiem jaki bd. */ - if (sess->async && (getsockopt(sess->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { - /* no tak, nie udao si poczy z proxy. nawet - * nie prbujemy dalej. */ - if (sess->proxy_addr && sess->proxy_port) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", res, strerror(res)); - goto fail_connecting; - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to hub failed (errno=%d, %s), trying direct connection\n", res, strerror(res)); - close(sess->fd); - - if ((sess->fd = gg_connect(&sess->hub_addr, GG_DEFAULT_PORT, sess->async)) == -1) { - /* przy asynchronicznych, gg_connect() - * zwraca -1 przy bdach socket(), - * ioctl(), braku routingu itd. dlatego - * nawet nie prbujemy dalej. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() direct connection failed (errno=%d, %s), critical\n", errno, strerror(errno)); - goto fail_connecting; - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connected to hub, sending query\n"); - - if (!(client = gg_urlencode((sess->client_version) ? sess->client_version : GG_DEFAULT_CLIENT_VERSION))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() out of memory for client version\n"); - goto fail_connecting; - } - - if (!gg_proxy_http_only && sess->proxy_addr && sess->proxy_port) - host = "http://" GG_APPMSG_HOST; - else - host = ""; - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) - appmsg = "appmsg3.asp"; - else -#endif - appmsg = "appmsg2.asp"; - - auth = gg_proxy_auth(); - - snprintf(buf, sizeof(buf) - 1, - "GET %s/appsvc/%s?fmnumber=%u&version=%s&lastmsg=%d HTTP/1.0\r\n" - "Host: " GG_APPMSG_HOST "\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Pragma: no-cache\r\n" - "%s" - "\r\n", host, appmsg, sess->uin, client, sess->last_sysmsg, (auth) ? auth : ""); - - if (auth) - free(auth); - - free(client); - - /* zwolnij pami po wersji klienta. */ - if (sess->client_version) { - free(sess->client_version); - sess->client_version = NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-QUERY-----\n%s\n=> -----END-HTTP-QUERY-----\n", buf); - - /* zapytanie jest krtkie, wic zawsze zmieci si - * do bufora gniazda. jeli write() zwrci mniej, - * stao si co zego. */ - if (write(sess->fd, buf, strlen(buf)) < (signed)strlen(buf)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() sending query failed\n"); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_WRITING; - sess->state = GG_STATE_IDLE; - close(sess->fd); - sess->fd = -1; - break; - } - - sess->state = GG_STATE_READING_DATA; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - - case GG_STATE_READING_DATA: - { - char buf[1024], *tmp, *host; - int port = GG_DEFAULT_PORT; - struct in_addr addr; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_DATA\n"); - - /* czytamy lini z gniazda i obcinamy \r\n. */ - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() received http header (%s)\n", buf); - - /* sprawdzamy, czy wszystko w porzdku. */ - if (strncmp(buf, "HTTP/1.", 7) || strncmp(buf + 9, "200", 3)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() that's not what we've expected, trying direct connection\n"); - - close(sess->fd); - - /* jeli otrzymalimy jakie dziwne informacje, - * prbujemy si czy z pominiciem huba. */ - if (sess->proxy_addr && sess->proxy_port) { - if ((sess->fd = gg_connect(&sess->proxy_addr, sess->proxy_port, sess->async)) == -1) { - /* trudno. nie wyszo. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - sess->port = GG_DEFAULT_PORT; - - /* czymy si na port 8074 huba. */ - if ((sess->fd = gg_connect(&sess->hub_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), trying https\n", errno, strerror(errno)); - - sess->port = GG_HTTPS_PORT; - - /* czymy si na port 443. */ - if ((sess->fd = gg_connect(&sess->hub_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - /* ignorujemy reszt nagwka. */ - while (strcmp(buf, "\r\n") && strcmp(buf, "")) - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - - /* czytamy pierwsz lini danych. */ - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - - /* jeli pierwsza liczba w linii nie jest rwna zeru, - * oznacza to, e mamy wiadomo systemow. */ - if (atoi(buf)) { - char tmp[1024], *foo, *sysmsg_buf = NULL; - int len = 0; - - while (gg_read_line(sess->fd, tmp, sizeof(tmp) - 1)) { - if (!(foo = realloc(sysmsg_buf, len + strlen(tmp) + 2))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() out of memory for system message, ignoring\n"); - break; - } - - sysmsg_buf = foo; - - if (!len) - strcpy(sysmsg_buf, tmp); - else - strcat(sysmsg_buf, tmp); - - len += strlen(tmp); - } - - e->type = GG_EVENT_MSG; - e->event.msg.msgclass = atoi(buf); - e->event.msg.sender = 0; - e->event.msg.message = (unsigned char *)sysmsg_buf; - } - - close(sess->fd); - - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() received http data (%s)\n", buf); - - /* analizujemy otrzymane dane. */ - tmp = buf; - - while (*tmp && *tmp != ' ') - tmp++; - while (*tmp && *tmp == ' ') - tmp++; - host = tmp; - while (*tmp && *tmp != ' ') - tmp++; - *tmp = 0; - - if ((tmp = strchr(host, ':'))) { - *tmp = 0; - port = atoi(tmp + 1); - } - - addr.s_addr = inet_addr(host); - sess->server_addr = addr.s_addr; - - if (!gg_proxy_http_only && sess->proxy_addr && sess->proxy_port) { - /* jeli mamy proxy, czymy si z nim. */ - if ((sess->fd = gg_connect(&sess->proxy_addr, sess->proxy_port, sess->async)) == -1) { - /* nie wyszo? trudno. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - break; - } - - sess->port = port; - - /* czymy si z waciwym serwerem. */ - if ((sess->fd = gg_connect(&addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), trying https\n", errno, strerror(errno)); - - sess->port = GG_HTTPS_PORT; - - /* nie wyszo? prbujemy portu 443. */ - if ((sess->fd = gg_connect(&addr, GG_HTTPS_PORT, sess->async)) == -1) { - /* ostatnia deska ratunku zawioda? - * w takim razie zwijamy manatki. */ - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - } - - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - - case GG_STATE_CONNECTING_GG: - { - int res = 0; - socklen_t res_size = sizeof(res); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTING_GG\n"); - - /* jeli wystpi bd podczas czenia si... */ - if (sess->async && (sess->timeout == 0 || getsockopt(sess->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { - /* jeli nie udao si poczenie z proxy, - * nie mamy czego prbowa wicej. */ - if (sess->proxy_addr && sess->proxy_port) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection to proxy failed (errno=%d, %s)\n", res, strerror(res)); - goto fail_connecting; - } - - close(sess->fd); - sess->fd = -1; - -#ifdef ETIMEDOUT - if (sess->timeout == 0) - errno = ETIMEDOUT; -#endif - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - /* jeli logujemy si po TLS, nie prbujemy - * si czy ju z niczym innym w przypadku - * bdu. nie do, e nie ma sensu, to i - * trzeba by si bawi w tworzenie na nowo - * SSL i SSL_CTX. */ - - if (sess->ssl) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", res, strerror(res)); - goto fail_connecting; - } -#endif - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s), trying https\n", res, strerror(res)); - - sess->port = GG_HTTPS_PORT; - - /* prbujemy na port 443. */ - if ((sess->fd = gg_connect(&sess->server_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail_connecting; - } - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() connected\n"); - - if (gg_proxy_http_only) - sess->proxy_port = 0; - - /* jeli mamy proxy, wylijmy zapytanie. */ - if (sess->proxy_addr && sess->proxy_port) { - char buf[100], *auth = gg_proxy_auth(); - struct in_addr addr; - - if (sess->server_addr) - addr.s_addr = sess->server_addr; - else - addr.s_addr = sess->hub_addr; - - snprintf(buf, sizeof(buf), "CONNECT %s:%d HTTP/1.0\r\n", inet_ntoa(addr), sess->port); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() proxy request:\n// %s", buf); - - /* wysyamy zapytanie. jest ono na tyle krtkie, - * e musi si zmieci w buforze gniazda. jeli - * write() zawiedzie, stao si co zego. */ - if (write(sess->fd, buf, strlen(buf)) < (signed)strlen(buf)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() can't send proxy request\n"); - goto fail_connecting; - } - - if (auth) { - gg_debug(GG_DEBUG_MISC, "// %s", auth); - if (write(sess->fd, auth, strlen(auth)) < (signed)strlen(auth)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() can't send proxy request\n"); - goto fail_connecting; - } - - free(auth); - } - - if (write(sess->fd, "\r\n", 2) < 2) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() can't send proxy request\n"); - goto fail_connecting; - } - } - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) { - SSL_set_fd(sess->ssl, sess->fd); - - sess->state = GG_STATE_TLS_NEGOTIATION; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } -#endif - - sess->state = GG_STATE_READING_KEY; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - case GG_STATE_TLS_NEGOTIATION: - { - int res; - X509 *peer; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_TLS_NEGOTIATION\n"); - - if ((res = SSL_connect(sess->ssl)) <= 0) { - int err = SSL_get_error(sess->ssl, res); - - if (res == 0) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() disconnected during TLS negotiation\n"); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_TLS; - sess->state = GG_STATE_IDLE; - close(sess->fd); - sess->fd = -1; - break; - } - - if (err == SSL_ERROR_WANT_READ) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() SSL_connect() wants to read\n"); - - sess->state = GG_STATE_TLS_NEGOTIATION; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } else if (err == SSL_ERROR_WANT_WRITE) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() SSL_connect() wants to write\n"); - - sess->state = GG_STATE_TLS_NEGOTIATION; - sess->check = GG_CHECK_WRITE; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } else { - char buf[1024]; - - ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() SSL_connect() bailed out: %s\n", buf); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_TLS; - sess->state = GG_STATE_IDLE; - close(sess->fd); - sess->fd = -1; - break; - } - } - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() TLS negotiation succeded:\n// cipher: %s\n", SSL_get_cipher_name(sess->ssl)); - - peer = SSL_get_peer_certificate(sess->ssl); - - if (!peer) - gg_debug(GG_DEBUG_MISC, "// WARNING! unable to get peer certificate!\n"); - else { - char buf[1024]; - - X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// cert subject: %s\n", buf); - - X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// cert issuer: %s\n", buf); - } - - sess->state = GG_STATE_READING_KEY; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - - break; - } -#endif - - case GG_STATE_READING_KEY: - { - struct gg_header *h; - struct gg_welcome *w; - struct gg_login60 l; - unsigned int hash; - char *password = sess->password; - int ret; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_KEY\n"); - - memset(&l, 0, sizeof(l)); - l.dunno2 = 0xbe; - - /* XXX bardzo, bardzo, bardzo gupi pomys na pozbycie - * si tekstu wrzucanego przez proxy. */ - if (sess->proxy_addr && sess->proxy_port) { - char buf[100]; - - strcpy(buf, ""); - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() proxy response:\n// %s\n", buf); - - while (strcmp(buf, "")) { - gg_read_line(sess->fd, buf, sizeof(buf) - 1); - gg_chomp(buf); - if (strcmp(buf, "")) - gg_debug(GG_DEBUG_MISC, "// %s\n", buf); - } - - /* XXX niech czeka jeszcze raz w tej samej - * fazie. gupio, ale dziaa. */ - sess->proxy_port = 0; - - break; - } - - /* czytaj pierwszy pakiet. */ - if (!(h = gg_recv_packet(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() didn't receive packet (errno=%d, %s)\n", errno, strerror(errno)); - - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_READING; - sess->state = GG_STATE_IDLE; - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - break; - } - - if (h->type != GG_WELCOME) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() invalid packet received\n"); - free(h); - close(sess->fd); - sess->fd = -1; - errno = EINVAL; - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_INVALID; - sess->state = GG_STATE_IDLE; - break; - } - - w = (struct gg_welcome*) ((char*) h + sizeof(struct gg_header)); - w->key = gg_fix32(w->key); - - hash = gg_login_hash((unsigned char *)password, w->key); - - gg_debug(GG_DEBUG_DUMP, "// gg_watch_fd() challenge %.4x --> hash %.8x\n", w->key, hash); - - free(h); - - free(sess->password); - sess->password = NULL; - - { - struct in_addr dcc_ip; - dcc_ip.s_addr = gg_dcc_ip; - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() gg_dcc_ip = %s\n", inet_ntoa(dcc_ip)); - } - - if (gg_dcc_ip == (unsigned long) inet_addr("255.255.255.255")) { - struct sockaddr_in sin; - socklen_t sin_len = sizeof(sin); - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detecting address\n"); - - if (!getsockname(sess->fd, (struct sockaddr*) &sin, &sin_len)) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() detected address to %s\n", inet_ntoa(sin.sin_addr)); - l.local_ip = sin.sin_addr.s_addr; - } else { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() unable to detect address\n"); - l.local_ip = 0; - } - } else - l.local_ip = gg_dcc_ip; - - l.uin = gg_fix32(sess->uin); - l.hash = gg_fix32(hash); - l.status = gg_fix32(sess->initial_status ? sess->initial_status : GG_STATUS_AVAIL); - l.version = gg_fix32(sess->protocol_version); - l.local_port = gg_fix16(gg_dcc_port); - l.image_size = sess->image_size; - - if (sess->external_addr && sess->external_port > 1023) { - l.external_ip = sess->external_addr; - l.external_port = gg_fix16(sess->external_port); - } - - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() sending GG_LOGIN60 packet\n"); - ret = gg_send_packet(sess, GG_LOGIN60, &l, sizeof(l), sess->initial_descr, (sess->initial_descr) ? strlen(sess->initial_descr) : 0, NULL); - - free(sess->initial_descr); - sess->initial_descr = NULL; - - if (ret == -1) { - gg_debug(GG_DEBUG_TRAFFIC, "// gg_watch_fd() sending packet failed. (errno=%d, %s)\n", errno, strerror(errno)); - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_WRITING; - sess->state = GG_STATE_IDLE; - break; - } - - sess->state = GG_STATE_READING_REPLY; - - break; - } - - case GG_STATE_READING_REPLY: - { - struct gg_header *h; - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_READING_REPLY\n"); - - if (!(h = gg_recv_packet(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() didn't receive packet (errno=%d, %s)\n", errno, strerror(errno)); - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_READING; - sess->state = GG_STATE_IDLE; - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - break; - } - - if (h->type == GG_LOGIN_OK) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() login succeded\n"); - e->type = GG_EVENT_CONN_SUCCESS; - sess->state = GG_STATE_CONNECTED; - sess->timeout = -1; - sess->status = (sess->initial_status) ? sess->initial_status : GG_STATUS_AVAIL; - free(h); - break; - } - - if (h->type == GG_LOGIN_FAILED) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() login failed\n"); - e->event.failure = GG_FAILURE_PASSWORD; - errno = EACCES; - } else if (h->type == GG_NEED_EMAIL) { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() email change needed\n"); - e->event.failure = GG_FAILURE_NEED_EMAIL; - errno = EACCES; - } else { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() invalid packet\n"); - e->event.failure = GG_FAILURE_INVALID; - errno = EINVAL; - } - - e->type = GG_EVENT_CONN_FAILED; - sess->state = GG_STATE_IDLE; - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - free(h); - - break; - } - - case GG_STATE_CONNECTED: - { - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() GG_STATE_CONNECTED\n"); - - sess->last_event = time(NULL); - - if ((res = gg_watch_fd_connected(sess, e)) == -1) { - - gg_debug(GG_DEBUG_MISC, "// gg_watch_fd() watch_fd_connected failed (errno=%d, %s)\n", errno, strerror(errno)); - - if (errno == EAGAIN) { - e->type = GG_EVENT_NONE; - res = 0; - } else - res = -1; - } - break; - } - } - -done: - if (res == -1) { - free(e); - e = NULL; - } - - return e; - -fail_connecting: - if (sess->fd != -1) { - errno2 = errno; - close(sess->fd); - errno = errno2; - sess->fd = -1; - } - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_CONNECTING; - sess->state = GG_STATE_IDLE; - goto done; - -fail_resolving: - e->type = GG_EVENT_CONN_FAILED; - e->event.failure = GG_FAILURE_RESOLVING; - sess->state = GG_STATE_IDLE; - goto done; -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/http.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/http.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/http.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/http.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,536 +0,0 @@ -/* $Id: http.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#include -#ifndef _WIN32 -#include -#include -#include -#include -#endif - -#include "libgadu-config.h" - -#include -#include -#ifndef _WIN32 -#include -#endif -#ifdef __GG_LIBGADU_HAVE_PTHREAD -# include -#endif -#include -#include -#include -#include -#include - -#include "compat.h" - -/* - * gg_http_connect() // funkcja pomocnicza - * - * rozpoczyna poczenie po http. - * - * - hostname - adres serwera - * - port - port serwera - * - async - asynchroniczne poczenie - * - method - metoda http (GET, POST, cokolwiek) - * - path - cieka do zasobu (musi by poprzedzona ,,/'') - * - header - nagwek zapytania plus ewentualne dane dla POST - * - * zaalokowana struct gg_http, ktr poniej naley - * zwolni funkcj gg_http_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_http_connect(const char *hostname, int port, int async, const char *method, const char *path, const char *header) -{ - struct gg_http *h; - - if (!hostname || !port || !method || !path || !header) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() invalid arguments\n"); - errno = EFAULT; - return NULL; - } - - if (!(h = malloc(sizeof(*h)))) - return NULL; - memset(h, 0, sizeof(*h)); - - h->async = async; - h->port = port; - h->fd = -1; - h->type = GG_SESSION_HTTP; - - if (gg_proxy_enabled) { - char *auth = gg_proxy_auth(); - - h->query = gg_saprintf("%s http://%s:%d%s HTTP/1.0\r\n%s%s", - method, hostname, port, path, (auth) ? auth : - "", header); - hostname = gg_proxy_host; - h->port = port = gg_proxy_port; - - if (auth) - free(auth); - } else { - h->query = gg_saprintf("%s %s HTTP/1.0\r\n%s", - method, path, header); - } - - if (!h->query) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() not enough memory for query\n"); - free(h); - errno = ENOMEM; - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-QUERY-----\n%s\n=> -----END-HTTP-QUERY-----\n", h->query); - - if (async) { -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (gg_resolve_pthread(&h->fd, &h->resolver, hostname)) { -#elif defined _WIN32 - if (gg_resolve_win32thread(&h->fd, &h->resolver, hostname)) { -#else - if (gg_resolve(&h->fd, &h->pid, hostname)) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() resolver failed\n"); - gg_http_free(h); - errno = ENOENT; - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() resolver = %p\n", h->resolver); - - h->state = GG_STATE_RESOLVING; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - } else { - struct in_addr *hn, a; - - if (!(hn = gg_gethostbyname(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() host not found\n"); - gg_http_free(h); - errno = ENOENT; - return NULL; - } else { - a.s_addr = hn->s_addr; - free(hn); - } - - if (!(h->fd = gg_connect(&a, port, 0)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - gg_http_free(h); - return NULL; - } - - h->state = GG_STATE_CONNECTING; - - while (h->state != GG_STATE_ERROR && h->state != GG_STATE_PARSING) { - if (gg_http_watch_fd(h) == -1) - break; - } - - if (h->state != GG_STATE_PARSING) { - gg_debug(GG_DEBUG_MISC, "// gg_http_connect() some strange error\n"); - gg_http_free(h); - return NULL; - } - } - - h->callback = gg_http_watch_fd; - h->destroy = gg_http_free; - - return h; -} - -#define gg_http_error(x) \ - close(h->fd); \ - h->fd = -1; \ - h->state = GG_STATE_ERROR; \ - h->error = x; \ - return 0; - -/* - * gg_http_watch_fd() - * - * przy asynchronicznej obsudze HTTP funkcj t naley wywoa, jeli - * zmienio si co na obserwowanym deskryptorze. - * - * - h - struktura opisujca poczenie - * - * jeli wszystko poszo dobrze to 0, inaczej -1. poczenie bdzie - * zakoczone, jeli h->state == GG_STATE_PARSING. jeli wystpi jaki - * bd, to bdzie tam GG_STATE_ERROR i odpowiedni kod bdu w h->error. - */ -int gg_http_watch_fd(struct gg_http *h) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_http_watch_fd(%p);\n", h); - - if (!h) { - gg_debug(GG_DEBUG_MISC, "// gg_http_watch_fd() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (h->state == GG_STATE_RESOLVING) { - struct in_addr a; - - gg_debug(GG_DEBUG_MISC, "=> http, resolving done\n"); - - if (read(h->fd, &a, sizeof(a)) < (signed)sizeof(a) || a.s_addr == INADDR_NONE) { - gg_debug(GG_DEBUG_MISC, "=> http, resolver thread failed\n"); - gg_http_error(GG_ERROR_RESOLVING); - } - - close(h->fd); - h->fd = -1; - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (h->resolver) { - pthread_cancel(*((pthread_t *) h->resolver)); - free(h->resolver); - h->resolver = NULL; - } -#elif defined _WIN32 - if (h->resolver) { - HANDLE hnd = h->resolver; - TerminateThread(hnd, 0); - CloseHandle(hnd); - h->resolver = NULL; - } -#else - waitpid(h->pid, NULL, 0); -#endif - - gg_debug(GG_DEBUG_MISC, "=> http, connecting to %s:%d\n", inet_ntoa(a), h->port); - - if ((h->fd = gg_connect(&a, h->port, h->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "=> http, connection failed (errno=%d, %s)\n", errno, strerror(errno)); - gg_http_error(GG_ERROR_CONNECTING); - } - - h->state = GG_STATE_CONNECTING; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - - return 0; - } - - if (h->state == GG_STATE_CONNECTING) { - int res = 0; - socklen_t res_size = sizeof(res); - - if (h->async && (getsockopt(h->fd, SOL_SOCKET, SO_ERROR, &res, &res_size) || res)) { - gg_debug(GG_DEBUG_MISC, "=> http, async connection failed (errno=%d, %s)\n", (res) ? res : errno , strerror((res) ? res : errno)); - close(h->fd); - h->fd = -1; - h->state = GG_STATE_ERROR; - h->error = GG_ERROR_CONNECTING; - if (res) - errno = res; - return 0; - } - - gg_debug(GG_DEBUG_MISC, "=> http, connected, sending request\n"); - - h->state = GG_STATE_SENDING_QUERY; - } - - if (h->state == GG_STATE_SENDING_QUERY) { - ssize_t res; - - if ((res = write(h->fd, h->query, strlen(h->query))) < 1) { - gg_debug(GG_DEBUG_MISC, "=> http, write() failed (len=%d, res=%d, errno=%d)\n", strlen(h->query), res, errno); - gg_http_error(GG_ERROR_WRITING); - } - - if (res < 0 || (size_t)res < strlen(h->query)) { - gg_debug(GG_DEBUG_MISC, "=> http, partial header sent (led=%d, sent=%d)\n", strlen(h->query), res); - - memmove(h->query, h->query + res, strlen(h->query) - res + 1); - h->state = GG_STATE_SENDING_QUERY; - h->check = GG_CHECK_WRITE; - h->timeout = GG_DEFAULT_TIMEOUT; - } else { - gg_debug(GG_DEBUG_MISC, "=> http, request sent (len=%d)\n", strlen(h->query)); - free(h->query); - h->query = NULL; - - h->state = GG_STATE_READING_HEADER; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - } - - return 0; - } - - if (h->state == GG_STATE_READING_HEADER) { - char buf[1024], *tmp; - int res; - - if ((res = read(h->fd, buf, sizeof(buf))) == -1) { - gg_debug(GG_DEBUG_MISC, "=> http, reading header failed (errno=%d)\n", errno); - if (h->header) { - free(h->header); - h->header = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - if (!res) { - gg_debug(GG_DEBUG_MISC, "=> http, connection reset by peer\n"); - if (h->header) { - free(h->header); - h->header = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - gg_debug(GG_DEBUG_MISC, "=> http, read %d bytes of header\n", res); - - if (!(tmp = realloc(h->header, h->header_size + res + 1))) { - gg_debug(GG_DEBUG_MISC, "=> http, not enough memory for header\n"); - free(h->header); - h->header = NULL; - gg_http_error(GG_ERROR_READING); - } - - h->header = tmp; - - memcpy(h->header + h->header_size, buf, res); - h->header_size += res; - - gg_debug(GG_DEBUG_MISC, "=> http, header_buf=%p, header_size=%d\n", h->header, h->header_size); - - h->header[h->header_size] = 0; - - if ((tmp = strstr(h->header, "\r\n\r\n")) || (tmp = strstr(h->header, "\n\n"))) { - int sep_len = (*tmp == '\r') ? 4 : 2; - unsigned int left; - char *line; - - left = h->header_size - ((long)(tmp) - (long)(h->header) + sep_len); - - gg_debug(GG_DEBUG_MISC, "=> http, got all header (%d bytes, %d left)\n", h->header_size - left, left); - - /* HTTP/1.1 200 OK */ - if (strlen(h->header) < 16 || strncmp(h->header + 9, "200", 3)) { - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-HEADER-----\n%s\n=> -----END-HTTP-HEADER-----\n", h->header); - - gg_debug(GG_DEBUG_MISC, "=> http, didn't get 200 OK -- no results\n"); - free(h->header); - h->header = NULL; - gg_http_error(GG_ERROR_CONNECTING); - } - - h->body_size = 0; - line = h->header; - *tmp = 0; - - gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-HEADER-----\n%s\n=> -----END-HTTP-HEADER-----\n", h->header); - - while (line) { - if (!strncasecmp(line, "Content-length: ", 16)) { - h->body_size = atoi(line + 16); - } - line = strchr(line, '\n'); - if (line) - line++; - } - - if (h->body_size <= 0) { - gg_debug(GG_DEBUG_MISC, "=> http, content-length not found\n"); - h->body_size = left; - } - - if (left > h->body_size) { - gg_debug(GG_DEBUG_MISC, "=> http, oversized reply (%d bytes needed, %d bytes left)\n", h->body_size, left); - h->body_size = left; - } - - gg_debug(GG_DEBUG_MISC, "=> http, body_size=%d\n", h->body_size); - - if (!(h->body = malloc(h->body_size + 1))) { - gg_debug(GG_DEBUG_MISC, "=> http, not enough memory (%d bytes for body_buf)\n", h->body_size + 1); - free(h->header); - h->header = NULL; - gg_http_error(GG_ERROR_READING); - } - - if (left) { - memcpy(h->body, tmp + sep_len, left); - h->body_done = left; - } - - h->body[left] = 0; - - h->state = GG_STATE_READING_DATA; - h->check = GG_CHECK_READ; - h->timeout = GG_DEFAULT_TIMEOUT; - } - - return 0; - } - - if (h->state == GG_STATE_READING_DATA) { - char buf[1024]; - int res; - - if ((res = read(h->fd, buf, sizeof(buf))) == -1) { - gg_debug(GG_DEBUG_MISC, "=> http, reading body failed (errno=%d)\n", errno); - if (h->body) { - free(h->body); - h->body = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - if (!res) { - if (h->body_done >= h->body_size) { - gg_debug(GG_DEBUG_MISC, "=> http, we're done, closing socket\n"); - h->state = GG_STATE_PARSING; - close(h->fd); - h->fd = -1; - } else { - gg_debug(GG_DEBUG_MISC, "=> http, connection closed while reading (have %d, need %d)\n", h->body_done, h->body_size); - if (h->body) { - free(h->body); - h->body = NULL; - } - gg_http_error(GG_ERROR_READING); - } - - return 0; - } - - gg_debug(GG_DEBUG_MISC, "=> http, read %d bytes of body\n", res); - - if (h->body_done + res > h->body_size) { - char *tmp; - - gg_debug(GG_DEBUG_MISC, "=> http, too much data (%d bytes, %d needed), enlarging buffer\n", h->body_done + res, h->body_size); - - if (!(tmp = realloc(h->body, h->body_done + res + 1))) { - gg_debug(GG_DEBUG_MISC, "=> http, not enough memory for data (%d needed)\n", h->body_done + res + 1); - free(h->body); - h->body = NULL; - gg_http_error(GG_ERROR_READING); - } - - h->body = tmp; - h->body_size = h->body_done + res; - } - - h->body[h->body_done + res] = 0; - memcpy(h->body + h->body_done, buf, res); - h->body_done += res; - - gg_debug(GG_DEBUG_MISC, "=> body_done=%d, body_size=%d\n", h->body_done, h->body_size); - - return 0; - } - - if (h->fd != -1) - close(h->fd); - - h->fd = -1; - h->state = GG_STATE_ERROR; - h->error = 0; - - return -1; -} - -#undef gg_http_error - -/* - * gg_http_stop() - * - * jeli poczenie jest w trakcie, przerywa je. nie zwalnia h->data. - * - * - h - struktura opisujca poczenie - */ -void gg_http_stop(struct gg_http *h) -{ - if (!h) - return; - - if (h->state == GG_STATE_ERROR || h->state == GG_STATE_DONE) - return; - - if (h->fd != -1) - close(h->fd); - h->fd = -1; -} - -/* - * gg_http_free_fields() // funkcja wewntrzna - * - * zwalnia pola struct gg_http, ale nie zwalnia samej struktury. - */ -void gg_http_free_fields(struct gg_http *h) -{ - if (!h) - return; - - if (h->body) { - free(h->body); - h->body = NULL; - } - - if (h->query) { - free(h->query); - h->query = NULL; - } - - if (h->header) { - free(h->header); - h->header = NULL; - } -} - -/* - * gg_http_free() - * - * prbuje zamkn poczenie i zwalnia pami po nim. - * - * - h - struktura, ktr naley zlikwidowa - */ -void gg_http_free(struct gg_http *h) -{ - if (!h) - return; - - gg_http_stop(h); - gg_http_free_fields(h); - free(h); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2064 +0,0 @@ -/* $Id: libgadu.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * Robert J. Wony - * Arkadiusz Mikiewicz - * Tomasz Chiliski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#include -#ifndef _WIN32 -#include -#include -#include -#include -#ifdef sun -# include -#endif -#else -#include -#include -#include -#define SHUT_RDWR SD_BOTH -#endif - -#include "libgadu-config.h" - -#include -#ifndef _WIN32 -#include -#endif -#ifdef __GG_LIBGADU_HAVE_PTHREAD -# include -#endif -#include -#include -#include -#include -#include -#ifdef __GG_LIBGADU_HAVE_OPENSSL -# include -# include -#endif - -#include "compat.h" - -int gg_debug_level = 0; -void (*gg_debug_handler)(int level, const char *format, va_list ap) = NULL; - -int gg_dcc_port = 0; -unsigned long gg_dcc_ip = 0; - -unsigned long gg_local_ip = 0; -/* - * zmienne opisujce parametry proxy http. - */ -char *gg_proxy_host = NULL; -int gg_proxy_port = 0; -int gg_proxy_enabled = 0; -int gg_proxy_http_only = 0; -char *gg_proxy_username = NULL; -char *gg_proxy_password = NULL; - -#ifndef lint -static char rcsid[] -#ifdef __GNUC__ -__attribute__ ((unused)) -#endif -= "$Id: libgadu.c 16856 2006-08-19 01:13:25Z evands $"; -#endif - -#ifdef _WIN32 -/** - * Deal with the fact that you can't select() on a win32 file fd. - * This makes it practically impossible to tie into purple's event loop. - * - * -This is thanks to Tor Lillqvist. - * XXX - Move this to where the rest of the the win32 compatiblity stuff goes when we push the changes back to libgadu. - */ -static int -socket_pipe (int *fds) -{ - SOCKET temp, socket1 = -1, socket2 = -1; - struct sockaddr_in saddr; - int len; - u_long arg; - fd_set read_set, write_set; - struct timeval tv; - - temp = socket(AF_INET, SOCK_STREAM, 0); - - if (temp == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(temp, FIONBIO, &arg) == SOCKET_ERROR) { - goto out0; - } - - memset(&saddr, 0, sizeof(saddr)); - saddr.sin_family = AF_INET; - saddr.sin_port = 0; - saddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (bind(temp, (struct sockaddr *)&saddr, sizeof (saddr))) { - goto out0; - } - - if (listen(temp, 1) == SOCKET_ERROR) { - goto out0; - } - - len = sizeof(saddr); - if (getsockname(temp, (struct sockaddr *)&saddr, &len)) { - goto out0; - } - - socket1 = socket(AF_INET, SOCK_STREAM, 0); - - if (socket1 == INVALID_SOCKET) { - goto out0; - } - - arg = 1; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out1; - } - - if (connect(socket1, (struct sockaddr *)&saddr, len) != SOCKET_ERROR || - WSAGetLastError() != WSAEWOULDBLOCK) { - goto out1; - } - - FD_ZERO(&read_set); - FD_SET(temp, &read_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, &read_set, NULL, NULL, NULL) == SOCKET_ERROR) { - goto out1; - } - - if (!FD_ISSET(temp, &read_set)) { - goto out1; - } - - socket2 = accept(temp, (struct sockaddr *) &saddr, &len); - if (socket2 == INVALID_SOCKET) { - goto out1; - } - - FD_ZERO(&write_set); - FD_SET(socket1, &write_set); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - if (select(0, NULL, &write_set, NULL, NULL) == SOCKET_ERROR) { - goto out2; - } - - if (!FD_ISSET(socket1, &write_set)) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket1, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - arg = 0; - if (ioctlsocket(socket2, FIONBIO, &arg) == SOCKET_ERROR) { - goto out2; - } - - fds[0] = socket1; - fds[1] = socket2; - - closesocket (temp); - - return 0; - -out2: - closesocket (socket2); -out1: - closesocket (socket1); -out0: - closesocket (temp); - errno = EIO; /* XXX */ - - return -1; -} -#endif - -/* - * gg_libgadu_version() - * - * zwraca wersj libgadu. - * - * - brak - * - * wersja libgadu. - */ -const char *gg_libgadu_version() -{ - return GG_LIBGADU_VERSION; -} - -/* - * gg_fix32() - * - * zamienia kolejno bajtw w liczbie 32-bitowej tak, by odpowiadaa - * kolejnoci bajtw w protokole GG. ze wzgldu na LE-owo serwera, - * zamienia tylko na maszynach BE-wych. - * - * - x - liczba do zamiany - * - * liczba z odpowiedni kolejnoci bajtw. - */ -uint32_t gg_fix32(uint32_t x) -{ -#ifndef __GG_LIBGADU_BIGENDIAN - return x; -#else - return (uint32_t) - (((x & (uint32_t) 0x000000ffU) << 24) | - ((x & (uint32_t) 0x0000ff00U) << 8) | - ((x & (uint32_t) 0x00ff0000U) >> 8) | - ((x & (uint32_t) 0xff000000U) >> 24)); -#endif -} - -/* - * gg_fix16() - * - * zamienia kolejno bajtw w liczbie 16-bitowej tak, by odpowiadaa - * kolejnoci bajtw w protokole GG. ze wzgldu na LE-owo serwera, - * zamienia tylko na maszynach BE-wych. - * - * - x - liczba do zamiany - * - * liczba z odpowiedni kolejnoci bajtw. - */ -uint16_t gg_fix16(uint16_t x) -{ -#ifndef __GG_LIBGADU_BIGENDIAN - return x; -#else - return (uint16_t) - (((x & (uint16_t) 0x00ffU) << 8) | - ((x & (uint16_t) 0xff00U) >> 8)); -#endif -} - -/* - * gg_login_hash() // funkcja wewntrzna - * - * liczy hash z hasa i danego seeda. - * - * - password - haso do hashowania - * - seed - warto podana przez serwer - * - * hash. - */ -unsigned int gg_login_hash(const unsigned char *password, unsigned int seed) -{ - unsigned int x, y, z; - - y = seed; - - for (x = 0; *password; password++) { - x = (x & 0xffffff00) | *password; - y ^= x; - y += x; - x <<= 8; - y ^= x; - x <<= 8; - y -= x; - x <<= 8; - y ^= x; - - z = y & 0x1F; - y = (y << z) | (y >> (32 - z)); - } - - return y; -} - -#ifndef _WIN32 - -/* - * gg_resolve() // funkcja wewntrzna - * - * tworzy potok, forkuje si i w drugim procesie zaczyna resolvowa - * podanego hosta. zapisuje w sesji deskryptor potoku. jeli co tam - * bdzie gotowego, znaczy, e mona wczyta struct in_addr. jeli - * nie znajdzie, zwraca INADDR_NONE. - * - * - fd - wskanik gdzie wrzuci deskryptor - * - pid - gdzie wrzuci pid procesu potomnego - * - hostname - nazwa hosta do zresolvowania - * - * 0, -1. - */ -int gg_resolve(int *fd, int *pid, const char *hostname) -{ - int pipes[2], res; - struct in_addr a; - int errno2; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve(%p, %p, \"%s\");\n", fd, pid, hostname); - - if (!fd || !pid) { - errno = EFAULT; - return -1; - } - - if (pipe(pipes) == -1) - return -1; - - if ((res = fork()) == -1) { - errno2 = errno; - close(pipes[0]); - close(pipes[1]); - errno = errno2; - return -1; - } - - if (!res) { - if ((a.s_addr = inet_addr(hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(hostname))) - a.s_addr = INADDR_NONE; - else { - a.s_addr = hn->s_addr; - free(hn); - } - } - - write(pipes[1], &a, sizeof(a)); - - _exit(0); - } - - close(pipes[1]); - - *fd = pipes[0]; - *pid = res; - - return 0; -} -#endif - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - -struct gg_resolve_pthread_data { - char *hostname; - int fd; -}; - -static void *gg_resolve_pthread_thread(void *arg) -{ - struct gg_resolve_pthread_data *d = arg; - struct in_addr a; - - pthread_detach(pthread_self()); - - if ((a.s_addr = inet_addr(d->hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(d->hostname))) - a.s_addr = INADDR_NONE; - else { - a.s_addr = hn->s_addr; - free(hn); - } - } - - write(d->fd, &a, sizeof(a)); - close(d->fd); - - free(d->hostname); - d->hostname = NULL; - - free(d); - - pthread_exit(NULL); - - return NULL; /* eby kompilator nie marudzi */ -} - -/* - * gg_resolve_pthread() // funkcja wewntrzna - * - * tworzy potok, nowy wtek i w nim zaczyna resolvowa podanego hosta. - * zapisuje w sesji deskryptor potoku. jeli co tam bdzie gotowego, - * znaczy, e mona wczyta struct in_addr. jeli nie znajdzie, zwraca - * INADDR_NONE. - * - * - fd - wskanik do zmiennej przechowujcej desktyptor resolvera - * - resolver - wskanik do wskanika resolvera - * - hostname - nazwa hosta do zresolvowania - * - * 0, -1. - */ -int gg_resolve_pthread(int *fd, void **resolver, const char *hostname) -{ - struct gg_resolve_pthread_data *d = NULL; - pthread_t *tmp; - int pipes[2], new_errno; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_pthread(%p, %p, \"%s\");\n", fd, resolver, hostname); - - if (!resolver || !fd || !hostname) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (!(tmp = malloc(sizeof(pthread_t)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory for pthread id\n"); - return -1; - } - - if (pipe(pipes) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); - free(tmp); - return -1; - } - - if (!(d = malloc(sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->hostname = NULL; - - if (!(d->hostname = strdup(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() out of memory\n"); - new_errno = errno; - goto cleanup; - } - - d->fd = pipes[1]; - - if (pthread_create(tmp, NULL, gg_resolve_pthread_thread, d)) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_phread() unable to create thread\n"); - new_errno = errno; - goto cleanup; - } - - gg_debug(GG_DEBUG_MISC, "// gg_resolve_pthread() %p\n", tmp); - - *resolver = tmp; - - *fd = pipes[0]; - - return 0; - -cleanup: - if (d) { - free(d->hostname); - free(d); - } - - close(pipes[0]); - close(pipes[1]); - - free(tmp); - - errno = new_errno; - - return -1; -} - -#elif defined _WIN32 - -struct gg_resolve_win32thread_data { - char *hostname; - int fd; -}; - -static DWORD WINAPI gg_resolve_win32thread_thread(LPVOID arg) -{ - struct gg_resolve_win32thread_data *d = arg; - struct in_addr a; - - if ((a.s_addr = inet_addr(d->hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(d->hostname))) - a.s_addr = INADDR_NONE; - else { - a.s_addr = hn->s_addr; - free(hn); - } - } - - write(d->fd, &a, sizeof(a)); - close(d->fd); - - free(d->hostname); - d->hostname = NULL; - - free(d); - - return 0; -} - - -int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname) -{ - struct gg_resolve_win32thread_data *d = NULL; - HANDLE h; - DWORD dwTId; - int pipes[2], new_errno; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_resolve_win32thread(%p, %p, \"%s\");\n", fd, resolver, hostname); - - if (!resolver || !fd || !hostname) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (socket_pipe(pipes) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create pipes (errno=%d, %s)\n", errno, strerror(errno)); - return -1; - } - - if (!(d = malloc(sizeof(*d)))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = GetLastError(); - goto cleanup; - } - - d->hostname = NULL; - - if (!(d->hostname = strdup(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() out of memory\n"); - new_errno = GetLastError(); - goto cleanup; - } - - d->fd = pipes[1]; - - h = CreateThread(NULL, 0, gg_resolve_win32thread_thread, - d, 0, &dwTId); - - if (h == NULL) { - gg_debug(GG_DEBUG_MISC, "// gg_resolve_win32thread() unable to create thread\n"); - new_errno = GetLastError(); - goto cleanup; - } - - *resolver = h; - *fd = pipes[0]; - - return 0; - -cleanup: - if (d) { - free(d->hostname); - free(d); - } - - close(pipes[0]); - close(pipes[1]); - - errno = new_errno; - - return -1; - -} -#endif - -/* - * gg_read() // funkcja pomocnicza - * - * czyta z gniazda okrelon ilo bajtw. bierze pod uwag, czy mamy - * poczenie zwyke czy TLS. - * - * - sess - sesja, - * - buf - bufor, - * - length - ilo bajtw, - * - * takie same wartoci jak read(). - */ -int gg_read(struct gg_session *sess, char *buf, int length) -{ - int res; - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) { - int err; - - res = SSL_read(sess->ssl, buf, length); - - if (res < 0) { - err = SSL_get_error(sess->ssl, res); - - if (err == SSL_ERROR_WANT_READ) - errno = EAGAIN; - - return -1; - } - } else -#endif - res = read(sess->fd, buf, length); - - return res; -} - -/* - * gg_write() // funkcja pomocnicza - * - * zapisuje do gniazda okrelon ilo bajtw. bierze pod uwag, czy mamy - * poczenie zwyke czy TLS. - * - * - sess - sesja, - * - buf - bufor, - * - length - ilo bajtw, - * - * takie same wartoci jak write(). - */ -int gg_write(struct gg_session *sess, const char *buf, int length) -{ - int res = 0; - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) { - int err; - - res = SSL_write(sess->ssl, buf, length); - - if (res < 0) { - err = SSL_get_error(sess->ssl, res); - - if (err == SSL_ERROR_WANT_WRITE) - errno = EAGAIN; - - return -1; - } - } else -#endif - { - int written = 0; - - while (written < length) { - res = write(sess->fd, buf + written, length - written); - - if (res == -1) { - if (errno == EAGAIN) - continue; - else - break; - } else { - written += res; - res = written; - } - } - } - - return res; -} - -/* - * gg_recv_packet() // funkcja wewntrzna - * - * odbiera jeden pakiet i zwraca wskanik do niego. pami po nim - * naley zwolni za pomoc free(). - * - * - sess - opis sesji - * - * w przypadku bdu NULL, kod bdu w errno. naley zwrci uwag, e gdy - * poczenie jest nieblokujce, a kod bdu wynosi EAGAIN, nie udao si - * odczyta caego pakietu i nie naley tego traktowa jako bd. - */ -void *gg_recv_packet(struct gg_session *sess) -{ - struct gg_header h; - char *buf = NULL; - int ret = 0, offset, size = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_recv_packet(%p);\n", sess); - - if (!sess) { - errno = EFAULT; - return NULL; - } - - if (sess->recv_left < 1) { - if (sess->header_buf) { - memcpy(&h, sess->header_buf, sess->header_done); - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv: resuming last read (%d bytes left)\n", sizeof(h) - sess->header_done); - free(sess->header_buf); - sess->header_buf = NULL; - } else - sess->header_done = 0; - - while (sess->header_done < sizeof(h)) { - ret = gg_read(sess, (char*) &h + sess->header_done, sizeof(h) - sess->header_done); - - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv(%d,%p,%d) = %d\n", sess->fd, &h + sess->header_done, sizeof(h) - sess->header_done, ret); - - if (!ret) { - errno = ECONNRESET; - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() failed: connection broken\n"); - return NULL; - } - - if (ret == -1) { - if (errno == EINTR) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() interrupted system call, resuming\n"); - continue; - } - - if (errno == EAGAIN) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() incomplete header received\n"); - - if (!(sess->header_buf = malloc(sess->header_done))) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() not enough memory\n"); - return NULL; - } - - memcpy(sess->header_buf, &h, sess->header_done); - - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() header recv() failed: errno=%d, %s\n", errno, strerror(errno)); - - return NULL; - } - - sess->header_done += ret; - - } - - h.type = gg_fix32(h.type); - h.length = gg_fix32(h.length); - } else - memcpy(&h, sess->recv_buf, sizeof(h)); - - /* jakie sensowne limity na rozmiar pakietu */ - if (h.length > 65535) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() invalid packet length (%d)\n", h.length); - errno = ERANGE; - return NULL; - } - - if (sess->recv_left > 0) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() resuming last gg_recv_packet()\n"); - size = sess->recv_left; - offset = sess->recv_done; - buf = sess->recv_buf; - } else { - if (!(buf = malloc(sizeof(h) + h.length + 1))) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() not enough memory for packet data\n"); - return NULL; - } - - memcpy(buf, &h, sizeof(h)); - - offset = 0; - size = h.length; - } - - while (size > 0) { - ret = gg_read(sess, buf + sizeof(h) + offset, size); - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv(%d,%p,%d) = %d\n", sess->fd, buf + sizeof(h) + offset, size, ret); - if (!ret) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv() failed: connection broken\n"); - free(buf); - errno = ECONNRESET; - return NULL; - } - if (ret > -1 && ret <= size) { - offset += ret; - size -= ret; - } else if (ret == -1) { - int errno2 = errno; - - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() body recv() failed (errno=%d, %s)\n", errno, strerror(errno)); - errno = errno2; - - if (errno == EAGAIN) { - gg_debug(GG_DEBUG_MISC, "// gg_recv_packet() %d bytes received, %d left\n", offset, size); - sess->recv_buf = buf; - sess->recv_left = size; - sess->recv_done = offset; - return NULL; - } - if (errno != EINTR) { - free(buf); - return NULL; - } - } - } - - sess->recv_left = 0; - - if ((gg_debug_level & GG_DEBUG_DUMP)) { - unsigned int i; - - gg_debug(GG_DEBUG_DUMP, "// gg_recv_packet(%.2x)", h.type); - for (i = 0; i < sizeof(h) + h.length; i++) - gg_debug(GG_DEBUG_DUMP, " %.2x", (unsigned char) buf[i]); - gg_debug(GG_DEBUG_DUMP, "\n"); - } - - return buf; -} - -/* - * gg_send_packet() // funkcja wewntrzna - * - * konstruuje pakiet i wysya go do serwera. - * - * - sock - deskryptor gniazda - * - type - typ pakietu - * - payload_1 - pierwsza cz pakietu - * - payload_length_1 - dugo pierwszej czci - * - payload_2 - druga cz pakietu - * - payload_length_2 - dugo drugiej czci - * - ... - kolejne czci pakietu i ich dugoci - * - NULL - kocowym parametr (konieczny!) - * - * jeli si powiodo, zwraca 0, w przypadku bdu -1. jeli errno == ENOMEM, - * zabrako pamici. inaczej by bd przy wysyaniu pakietu. dla errno == 0 - * nie wysano caego pakietu. - */ -int gg_send_packet(struct gg_session *sess, int type, ...) -{ - struct gg_header *h; - char *tmp; - int tmp_length; - void *payload; - unsigned int payload_length; - va_list ap; - int res; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_packet(%p, 0x%.2x, ...)\n", sess, type); - - tmp_length = sizeof(struct gg_header); - - if (!(tmp = malloc(tmp_length))) { - gg_debug(GG_DEBUG_MISC, "// gg_send_packet() not enough memory for packet header\n"); - return -1; - } - - va_start(ap, type); - - payload = va_arg(ap, void *); - - while (payload) { - char *tmp2; - - payload_length = va_arg(ap, unsigned int); - - if (!(tmp2 = realloc(tmp, tmp_length + payload_length))) { - gg_debug(GG_DEBUG_MISC, "// gg_send_packet() not enough memory for payload\n"); - free(tmp); - va_end(ap); - return -1; - } - - tmp = tmp2; - - memcpy(tmp + tmp_length, payload, payload_length); - tmp_length += payload_length; - - payload = va_arg(ap, void *); - } - - va_end(ap); - - h = (struct gg_header*) tmp; - h->type = gg_fix32(type); - h->length = gg_fix32(tmp_length - sizeof(struct gg_header)); - - if ((gg_debug_level & GG_DEBUG_DUMP)) { - int i; - - gg_debug(GG_DEBUG_DUMP, "// gg_send_packet(0x%.2x)", gg_fix32(h->type)); - for (i = 0; i < tmp_length; ++i) - gg_debug(GG_DEBUG_DUMP, " %.2x", (unsigned char) tmp[i]); - gg_debug(GG_DEBUG_DUMP, "\n"); - } - - if ((res = gg_write(sess, tmp, tmp_length)) < tmp_length) { - gg_debug(GG_DEBUG_MISC, "// gg_send_packet() write() failed. res = %d, errno = %d (%s)\n", res, errno, strerror(errno)); - free(tmp); - return -1; - } - - free(tmp); - return 0; -} - -/* - * gg_session_callback() // funkcja wewntrzna - * - * wywoywany z gg_session->callback, wykonuje gg_watch_fd() i pakuje - * do gg_session->event jego wynik. - */ -static int gg_session_callback(struct gg_session *s) -{ - if (!s) { - errno = EFAULT; - return -1; - } - - return ((s->event = gg_watch_fd(s)) != NULL) ? 0 : -1; -} - -/* - * gg_login() - * - * rozpoczyna procedur czenia si z serwerem. reszt obsuguje si przez - * gg_watch_fd(). - * - * UWAGA! program musi obsuy SIGCHLD, jeli czy si asynchronicznie, - * eby poprawnie zamkn proces resolvera. - * - * - p - struktura opisujca pocztkowy stan. wymagane pola: uin, - * password - * - * w przypadku bdu NULL, jeli idzie dobrze (async) albo poszo - * dobrze (sync), zwrci wskanik do zaalokowanej struct gg_session. - */ -struct gg_session *gg_login(const struct gg_login_params *p) -{ - struct gg_session *sess = NULL; - char *hostname; - int port; - - if (!p) { - gg_debug(GG_DEBUG_FUNCTION, "** gg_login(%p);\n", p); - errno = EFAULT; - return NULL; - } - - gg_debug(GG_DEBUG_FUNCTION, "** gg_login(%p: [uin=%u, async=%d, ...]);\n", p, p->uin, p->async); - - if (!(sess = malloc(sizeof(struct gg_session)))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for session data\n"); - goto fail; - } - - memset(sess, 0, sizeof(struct gg_session)); - - if (!p->password || !p->uin) { - gg_debug(GG_DEBUG_MISC, "// gg_login() invalid arguments. uin and password needed\n"); - errno = EFAULT; - goto fail; - } - - if (!(sess->password = strdup(p->password))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for password\n"); - goto fail; - } - - if (p->status_descr && !(sess->initial_descr = strdup(p->status_descr))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() not enough memory for status\n"); - goto fail; - } - - sess->uin = p->uin; - sess->state = GG_STATE_RESOLVING; - sess->check = GG_CHECK_READ; - sess->timeout = GG_DEFAULT_TIMEOUT; - sess->async = p->async; - sess->type = GG_SESSION_GG; - sess->initial_status = p->status; - sess->callback = gg_session_callback; - sess->destroy = gg_free_session; - sess->port = (p->server_port) ? p->server_port : ((gg_proxy_enabled) ? GG_HTTPS_PORT : GG_DEFAULT_PORT); - sess->server_addr = p->server_addr; - sess->external_port = p->external_port; - sess->external_addr = p->external_addr; - sess->protocol_version = (p->protocol_version) ? p->protocol_version : GG_DEFAULT_PROTOCOL_VERSION; - if (p->era_omnix) - sess->protocol_version |= GG_ERA_OMNIX_MASK; - if (p->has_audio) - sess->protocol_version |= GG_HAS_AUDIO_MASK; - sess->client_version = (p->client_version) ? strdup(p->client_version) : NULL; - sess->last_sysmsg = p->last_sysmsg; - sess->image_size = p->image_size; - sess->pid = -1; - - if (p->tls == 1) { -#ifdef __GG_LIBGADU_HAVE_OPENSSL - char buf[1024]; - - OpenSSL_add_ssl_algorithms(); - - if (!RAND_status()) { - char rdata[1024]; - struct { - time_t time; - void *ptr; - } rstruct; - - time(&rstruct.time); - rstruct.ptr = (void *) &rstruct; - - RAND_seed((void *) rdata, sizeof(rdata)); - RAND_seed((void *) &rstruct, sizeof(rstruct)); - } - - sess->ssl_ctx = SSL_CTX_new(TLSv1_client_method()); - - if (!sess->ssl_ctx) { - ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// gg_login() SSL_CTX_new() failed: %s\n", buf); - goto fail; - } - - SSL_CTX_set_verify(sess->ssl_ctx, SSL_VERIFY_NONE, NULL); - - sess->ssl = SSL_new(sess->ssl_ctx); - - if (!sess->ssl) { - ERR_error_string_n(ERR_get_error(), buf, sizeof(buf)); - gg_debug(GG_DEBUG_MISC, "// gg_login() SSL_new() failed: %s\n", buf); - goto fail; - } -#else - gg_debug(GG_DEBUG_MISC, "// gg_login() client requested TLS but no support compiled in\n"); -#endif - } - - if (gg_proxy_enabled) { - hostname = gg_proxy_host; - sess->proxy_port = port = gg_proxy_port; - } else { - hostname = GG_APPMSG_HOST; - port = GG_APPMSG_PORT; - } - - if (!p->async) { - struct in_addr a; - - if (!p->server_addr || !p->server_port) { - if ((a.s_addr = inet_addr(hostname)) == INADDR_NONE) { - struct in_addr *hn; - - if (!(hn = gg_gethostbyname(hostname))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() host \"%s\" not found\n", hostname); - goto fail; - } else { - a.s_addr = hn->s_addr; - free(hn); - } - } - } else { - a.s_addr = p->server_addr; - port = p->server_port; - } - - sess->hub_addr = a.s_addr; - - if (gg_proxy_enabled) - sess->proxy_addr = a.s_addr; - - if ((sess->fd = gg_connect(&a, port, 0)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_login() connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - - if (p->server_addr && p->server_port) - sess->state = GG_STATE_CONNECTING_GG; - else - sess->state = GG_STATE_CONNECTING_HUB; - - while (sess->state != GG_STATE_CONNECTED) { - struct gg_event *e; - - if (!(e = gg_watch_fd(sess))) { - gg_debug(GG_DEBUG_MISC, "// gg_login() critical error in gg_watch_fd()\n"); - goto fail; - } - - if (e->type == GG_EVENT_CONN_FAILED) { - errno = EACCES; - gg_debug(GG_DEBUG_MISC, "// gg_login() could not login\n"); - gg_event_free(e); - goto fail; - } - - gg_event_free(e); - } - - return sess; - } - - if (!sess->server_addr || gg_proxy_enabled) { -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (gg_resolve_pthread(&sess->fd, &sess->resolver, hostname)) { -#elif defined _WIN32 - if (gg_resolve_win32thread(&sess->fd, &sess->resolver, hostname)) { -#else - if (gg_resolve(&sess->fd, &sess->pid, hostname)) { -#endif - gg_debug(GG_DEBUG_MISC, "// gg_login() resolving failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - } else { - if ((sess->fd = gg_connect(&sess->server_addr, sess->port, sess->async)) == -1) { - gg_debug(GG_DEBUG_MISC, "// gg_login() direct connection failed (errno=%d, %s)\n", errno, strerror(errno)); - goto fail; - } - sess->state = GG_STATE_CONNECTING_GG; - sess->check = GG_CHECK_WRITE; - } - - return sess; - -fail: - if (sess) { - if (sess->password) - free(sess->password); - if (sess->initial_descr) - free(sess->initial_descr); - free(sess); - } - - return NULL; -} - -/* - * gg_free_session() - * - * prbuje zamkn poczenia i zwalnia pami zajmowan przez sesj. - * - * - sess - opis sesji - */ -void gg_free_session(struct gg_session *sess) -{ - if (!sess) - return; - - /* XXX dopisa zwalnianie i zamykanie wszystkiego, co mogo zosta */ - - if (sess->password) - free(sess->password); - - if (sess->initial_descr) - free(sess->initial_descr); - - if (sess->client_version) - free(sess->client_version); - - if (sess->header_buf) - free(sess->header_buf); - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) - SSL_free(sess->ssl); - - if (sess->ssl_ctx) - SSL_CTX_free(sess->ssl_ctx); -#endif - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (sess->resolver) { - pthread_cancel(*((pthread_t*) sess->resolver)); - free(sess->resolver); - sess->resolver = NULL; - } -#elif defined _WIN32 - if (sess->resolver) { - HANDLE h = sess->resolver; - TerminateThread(h, 0); - CloseHandle(h); - sess->resolver = NULL; - } -#else - if (sess->pid != -1) - waitpid(sess->pid, NULL, WNOHANG); -#endif - - if (sess->fd != -1) - close(sess->fd); - - while (sess->images) - gg_image_queue_remove(sess, sess->images, 1); - - free(sess); -} - -/* - * gg_change_status() - * - * zmienia status uytkownika. przydatne do /away i /busy oraz /quit. - * - * - sess - opis sesji - * - status - nowy status uytkownika - * - * 0, -1. - */ -int gg_change_status(struct gg_session *sess, int status) -{ - struct gg_new_status p; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_change_status(%p, %d);\n", sess, status); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - p.status = gg_fix32(status); - - sess->status = status; - - return gg_send_packet(sess, GG_NEW_STATUS, &p, sizeof(p), NULL); -} - -/* - * gg_change_status_descr() - * - * zmienia status uytkownika na opisowy. - * - * - sess - opis sesji - * - status - nowy status uytkownika - * - descr - opis statusu - * - * 0, -1. - */ -int gg_change_status_descr(struct gg_session *sess, int status, const char *descr) -{ - struct gg_new_status p; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_change_status_descr(%p, %d, \"%s\");\n", sess, status, descr); - - if (!sess || !descr) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - p.status = gg_fix32(status); - - sess->status = status; - - return gg_send_packet(sess, GG_NEW_STATUS, &p, sizeof(p), descr, (strlen(descr) > GG_STATUS_DESCR_MAXSIZE) ? GG_STATUS_DESCR_MAXSIZE : strlen(descr), NULL); -} - -/* - * gg_change_status_descr_time() - * - * zmienia status uytkownika na opisowy z godzin powrotu. - * - * - sess - opis sesji - * - status - nowy status uytkownika - * - descr - opis statusu - * - time - czas w formacie uniksowym - * - * 0, -1. - */ -int gg_change_status_descr_time(struct gg_session *sess, int status, const char *descr, int time) -{ - struct gg_new_status p; - uint32_t newtime; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_change_status_descr_time(%p, %d, \"%s\", %d);\n", sess, status, descr, time); - - if (!sess || !descr || !time) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - p.status = gg_fix32(status); - - sess->status = status; - - newtime = gg_fix32(time); - - return gg_send_packet(sess, GG_NEW_STATUS, &p, sizeof(p), descr, (strlen(descr) > GG_STATUS_DESCR_MAXSIZE) ? GG_STATUS_DESCR_MAXSIZE : strlen(descr), &newtime, sizeof(newtime), NULL); -} - -/* - * gg_logoff() - * - * wylogowuje uytkownika i zamyka poczenie, ale nie zwalnia pamici. - * - * - sess - opis sesji - */ -void gg_logoff(struct gg_session *sess) -{ - if (!sess) - return; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_logoff(%p);\n", sess); - - if (GG_S_NA(sess->status & ~GG_STATUS_FRIENDS_MASK)) - gg_change_status(sess, GG_STATUS_NOT_AVAIL); - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - if (sess->ssl) - SSL_shutdown(sess->ssl); -#endif - -#ifdef __GG_LIBGADU_HAVE_PTHREAD - if (sess->resolver) { - pthread_cancel(*((pthread_t*) sess->resolver)); - free(sess->resolver); - sess->resolver = NULL; - } -#elif defined _WIN32 - if (sess->resolver) { - HANDLE h = sess->resolver; - TerminateThread(h, 0); - CloseHandle(h); - sess->resolver = NULL; - } -#else - if (sess->pid != -1) { - waitpid(sess->pid, NULL, WNOHANG); - sess->pid = -1; - } -#endif - - if (sess->fd != -1) { - shutdown(sess->fd, SHUT_RDWR); - close(sess->fd); - sess->fd = -1; - } -} - -/* - * gg_image_request() - * - * wysya danie wysania obrazka o podanych parametrach. - * - * - sess - opis sesji - * - recipient - numer adresata - * - size - rozmiar obrazka - * - crc32 - suma kontrolna obrazka - * - * 0/-1 - */ -int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_t crc32) -{ - struct gg_send_msg s; - struct gg_msg_image_request r; - char dummy = 0; - int res; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_image_request(%p, %d, %u, 0x%.4x);\n", sess, recipient, size, crc32); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (size < 0) { - errno = EINVAL; - return -1; - } - - s.recipient = gg_fix32(recipient); - s.seq = gg_fix32(0); - s.msgclass = gg_fix32(GG_CLASS_MSG); - - r.flag = 0x04; - r.size = gg_fix32(size); - r.crc32 = gg_fix32(crc32); - - res = gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), &dummy, 1, &r, sizeof(r), NULL); - - if (!res) { - struct gg_image_queue *q = malloc(sizeof(*q)); - char *buf; - - if (!q) { - gg_debug(GG_DEBUG_MISC, "// gg_image_request() not enough memory for image queue\n"); - return -1; - } - - buf = malloc(size); - if (size && !buf) - { - gg_debug(GG_DEBUG_MISC, "// gg_image_request() not enough memory for image\n"); - free(q); - return -1; - } - - memset(q, 0, sizeof(*q)); - - q->sender = recipient; - q->size = size; - q->crc32 = crc32; - q->image = buf; - - if (!sess->images) - sess->images = q; - else { - struct gg_image_queue *qq; - - for (qq = sess->images; qq->next; qq = qq->next) - ; - - qq->next = q; - } - } - - return res; -} - -/* - * gg_image_reply() - * - * wysya dany obrazek. - * - * - sess - opis sesji - * - recipient - numer adresata - * - filename - nazwa pliku - * - image - bufor z obrazkiem - * - size - rozmiar obrazka - * - * 0/-1 - */ -int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size) -{ - struct gg_msg_image_reply *r; - struct gg_send_msg s; - const char *tmp; - char buf[1910]; - int res = -1; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_image_reply(%p, %d, \"%s\", %p, %d);\n", sess, recipient, filename, image, size); - - if (!sess || !filename || !image) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (size < 0) { - errno = EINVAL; - return -1; - } - - /* wytnij cieki, zostaw tylko nazw pliku */ - while ((tmp = strrchr(filename, '/')) || (tmp = strrchr(filename, '\\'))) - filename = tmp + 1; - - if (strlen(filename) < 1 || strlen(filename) > 1024) { - errno = EINVAL; - return -1; - } - - s.recipient = gg_fix32(recipient); - s.seq = gg_fix32(0); - s.msgclass = gg_fix32(GG_CLASS_MSG); - - buf[0] = 0; - r = (void*) &buf[1]; - - r->flag = 0x05; - r->size = gg_fix32(size); - r->crc32 = gg_fix32(gg_crc32(0, image, size)); - - while (size > 0) { - size_t buflen, chunklen; - - /* \0 + struct gg_msg_image_reply */ - buflen = sizeof(struct gg_msg_image_reply) + 1; - - /* w pierwszym kawaku jest nazwa pliku */ - if (r->flag == 0x05) { - strcpy(buf + buflen, filename); - buflen += strlen(filename) + 1; - } - - chunklen = ((size_t)size >= sizeof(buf) - buflen) ? (sizeof(buf) - buflen) : (size_t)size; - - memcpy(buf + buflen, image, chunklen); - size -= chunklen; - image += chunklen; - - res = gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), buf, buflen + chunklen, NULL); - - if (res == -1) - break; - - r->flag = 0x06; - } - - return res; -} - -/* - * gg_send_message_ctcp() - * - * wysya wiadomo do innego uytkownika. zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipient - numer adresata - * - message - tre wiadomoci - * - message_len - dugo - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_ctcp(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, int message_len) -{ - struct gg_send_msg s; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_ctcp(%p, %d, %u, ...);\n", sess, msgclass, recipient); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - s.recipient = gg_fix32(recipient); - s.seq = gg_fix32(0); - s.msgclass = gg_fix32(msgclass); - - return gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, message_len, NULL); -} - -/* - * gg_send_message() - * - * wysya wiadomo do innego uytkownika. zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipient - numer adresata - * - message - tre wiadomoci - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message(%p, %d, %u, %p)\n", sess, msgclass, recipient, message); - - return gg_send_message_richtext(sess, msgclass, recipient, message, NULL, 0); -} - -/* - * gg_send_message_richtext() - * - * wysya kolorow wiadomo do innego uytkownika. zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipient - numer adresata - * - message - tre wiadomoci - * - format - informacje o formatowaniu - * - formatlen - dugo informacji o formatowaniu - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_richtext(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, const unsigned char *format, int formatlen) -{ - struct gg_send_msg s; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_richtext(%p, %d, %u, %p, %p, %d);\n", sess, msgclass, recipient, message, format, formatlen); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!message) { - errno = EFAULT; - return -1; - } - - s.recipient = gg_fix32(recipient); - if (!sess->seq) - sess->seq = 0x01740000 | (rand() & 0xffff); - s.seq = gg_fix32(sess->seq); - s.msgclass = gg_fix32(msgclass); - sess->seq += (rand() % 0x300) + 0x300; - - if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen((const char *)message) + 1, format, formatlen, NULL) == -1) - return -1; - - return gg_fix32(s.seq); -} - -/* - * gg_send_message_confer() - * - * wysya wiadomo do kilku uytkownikow (konferencja). zwraca losowy numer - * sekwencyjny, ktry mona zignorowa albo wykorzysta do potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipients_count - ilo adresatw - * - recipients - numerki adresatw - * - message - tre wiadomoci - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_confer(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_confer(%p, %d, %d, %p, %p);\n", sess, msgclass, recipients_count, recipients, message); - - return gg_send_message_confer_richtext(sess, msgclass, recipients_count, recipients, message, NULL, 0); -} - -/* - * gg_send_message_confer_richtext() - * - * wysya kolorow wiadomo do kilku uytkownikow (konferencja). zwraca - * losowy numer sekwencyjny, ktry mona zignorowa albo wykorzysta do - * potwierdzenia. - * - * - sess - opis sesji - * - msgclass - rodzaj wiadomoci - * - recipients_count - ilo adresatw - * - recipients - numerki adresatw - * - message - tre wiadomoci - * - format - informacje o formatowaniu - * - formatlen - dugo informacji o formatowaniu - * - * numer sekwencyjny wiadomoci lub -1 w przypadku bdu. - */ -int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message, const unsigned char *format, int formatlen) -{ - struct gg_send_msg s; - struct gg_msg_recipients r; - int i, j, k; - uin_t *recps; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_send_message_confer_richtext(%p, %d, %d, %p, %p, %p, %d);\n", sess, msgclass, recipients_count, recipients, message, format, formatlen); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!message || recipients_count <= 0 || recipients_count > 0xffff || !recipients) { - errno = EINVAL; - return -1; - } - - r.flag = 0x01; - r.count = gg_fix32(recipients_count - 1); - - if (!sess->seq) - sess->seq = 0x01740000 | (rand() & 0xffff); - s.seq = gg_fix32(sess->seq); - s.msgclass = gg_fix32(msgclass); - - recps = malloc(sizeof(uin_t) * recipients_count); - if (!recps) - return -1; - - for (i = 0; i < recipients_count; i++) { - - s.recipient = gg_fix32(recipients[i]); - - for (j = 0, k = 0; j < recipients_count; j++) - if (recipients[j] != recipients[i]) { - recps[k] = gg_fix32(recipients[j]); - k++; - } - - if (!i) - sess->seq += (rand() % 0x300) + 0x300; - - if (gg_send_packet(sess, GG_SEND_MSG, &s, sizeof(s), message, strlen((const char *)message) + 1, &r, sizeof(r), recps, (recipients_count - 1) * sizeof(uin_t), format, formatlen, NULL) == -1) { - free(recps); - return -1; - } - } - - free(recps); - - return gg_fix32(s.seq); -} - -/* - * gg_ping() - * - * wysya do serwera pakiet ping. - * - * - sess - opis sesji - * - * 0, -1. - */ -int gg_ping(struct gg_session *sess) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_ping(%p);\n", sess); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - return gg_send_packet(sess, GG_PING, NULL); -} - -/* - * gg_notify_ex() - * - * wysya serwerowi list kontaktw (wraz z odpowiadajcymi im typami userw), - * dziki czemu wie, czyj stan nas interesuje. - * - * - sess - opis sesji - * - userlist - wskanik do tablicy numerw - * - types - wskanik do tablicy typw uytkownikw - * - count - ilo numerkw - * - * 0, -1. - */ -int gg_notify_ex(struct gg_session *sess, uin_t *userlist, char *types, int count) -{ - struct gg_notify *n; - uin_t *u; - char *t; - int i, res = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_notify_ex(%p, %p, %p, %d);\n", sess, userlist, types, count); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!userlist || !count) - return gg_send_packet(sess, GG_LIST_EMPTY, NULL); - - while (count > 0) { - int part_count, packet_type; - - if (count > 400) { - part_count = 400; - packet_type = GG_NOTIFY_FIRST; - } else { - part_count = count; - packet_type = GG_NOTIFY_LAST; - } - - if (!(n = (struct gg_notify*) malloc(sizeof(*n) * part_count))) - return -1; - - for (u = userlist, t = types, i = 0; i < part_count; u++, t++, i++) { - n[i].uin = gg_fix32(*u); - n[i].dunno1 = *t; - } - - if (gg_send_packet(sess, packet_type, n, sizeof(*n) * part_count, NULL) == -1) { - free(n); - res = -1; - break; - } - - count -= part_count; - userlist += part_count; - types += part_count; - - free(n); - } - - return res; -} - -/* - * gg_notify() - * - * wysya serwerowi list kontaktw, dziki czemu wie, czyj stan nas - * interesuje. - * - * - sess - opis sesji - * - userlist - wskanik do tablicy numerw - * - count - ilo numerkw - * - * 0, -1. - */ -int gg_notify(struct gg_session *sess, uin_t *userlist, int count) -{ - struct gg_notify *n; - uin_t *u; - int i, res = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_notify(%p, %p, %d);\n", sess, userlist, count); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!userlist || !count) - return gg_send_packet(sess, GG_LIST_EMPTY, NULL); - - while (count > 0) { - int part_count, packet_type; - - if (count > 400) { - part_count = 400; - packet_type = GG_NOTIFY_FIRST; - } else { - part_count = count; - packet_type = GG_NOTIFY_LAST; - } - - if (!(n = (struct gg_notify*) malloc(sizeof(*n) * part_count))) - return -1; - - for (u = userlist, i = 0; i < part_count; u++, i++) { - n[i].uin = gg_fix32(*u); - n[i].dunno1 = GG_USER_NORMAL; - } - - if (gg_send_packet(sess, packet_type, n, sizeof(*n) * part_count, NULL) == -1) { - res = -1; - free(n); - break; - } - - free(n); - - userlist += part_count; - count -= part_count; - } - - return res; -} - -/* - * gg_add_notify_ex() - * - * dodaje do listy kontaktw dany numer w trakcie poczenia. - * dodawanemu uytkownikowi okrelamy jego typ (patrz protocol.html) - * - * - sess - opis sesji - * - uin - numer - * - type - typ - * - * 0, -1. - */ -int gg_add_notify_ex(struct gg_session *sess, uin_t uin, char type) -{ - struct gg_add_remove a; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_add_notify_ex(%p, %u, %d);\n", sess, uin, type); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - a.uin = gg_fix32(uin); - a.dunno1 = type; - - return gg_send_packet(sess, GG_ADD_NOTIFY, &a, sizeof(a), NULL); -} - -/* - * gg_add_notify() - * - * dodaje do listy kontaktw dany numer w trakcie poczenia. - * - * - sess - opis sesji - * - uin - numer - * - * 0, -1. - */ -int gg_add_notify(struct gg_session *sess, uin_t uin) -{ - return gg_add_notify_ex(sess, uin, GG_USER_NORMAL); -} - -/* - * gg_remove_notify_ex() - * - * usuwa z listy kontaktw w trakcie poczenia. - * usuwanemu uytkownikowi okrelamy jego typ (patrz protocol.html) - * - * - sess - opis sesji - * - uin - numer - * - type - typ - * - * 0, -1. - */ -int gg_remove_notify_ex(struct gg_session *sess, uin_t uin, char type) -{ - struct gg_add_remove a; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_remove_notify_ex(%p, %u, %d);\n", sess, uin, type); - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - a.uin = gg_fix32(uin); - a.dunno1 = type; - - return gg_send_packet(sess, GG_REMOVE_NOTIFY, &a, sizeof(a), NULL); -} - -/* - * gg_remove_notify() - * - * usuwa z listy kontaktw w trakcie poczenia. - * - * - sess - opis sesji - * - uin - numer - * - * 0, -1. - */ -int gg_remove_notify(struct gg_session *sess, uin_t uin) -{ - return gg_remove_notify_ex(sess, uin, GG_USER_NORMAL); -} - -/* - * gg_userlist_request() - * - * wysya danie/zapytanie listy kontaktw na serwerze. - * - * - sess - opis sesji - * - type - rodzaj zapytania/dania - * - request - tre zapytania/dania (moe by NULL) - * - * 0, -1 - */ -int gg_userlist_request(struct gg_session *sess, char type, const char *request) -{ - int len; - - if (!sess) { - errno = EFAULT; - return -1; - } - - if (sess->state != GG_STATE_CONNECTED) { - errno = ENOTCONN; - return -1; - } - - if (!request) { - sess->userlist_blocks = 1; - return gg_send_packet(sess, GG_USERLIST_REQUEST, &type, sizeof(type), NULL); - } - - len = strlen(request); - - sess->userlist_blocks = 0; - - while (len > 2047) { - sess->userlist_blocks++; - - if (gg_send_packet(sess, GG_USERLIST_REQUEST, &type, sizeof(type), request, 2047, NULL) == -1) - return -1; - - if (type == GG_USERLIST_PUT) - type = GG_USERLIST_PUT_MORE; - - request += 2047; - len -= 2047; - } - - sess->userlist_blocks++; - - return gg_send_packet(sess, GG_USERLIST_REQUEST, &type, sizeof(type), request, len, NULL); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu-config.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu-config.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu-config.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu-config.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* Local libgadu configuration. */ - -#include "config.h" - -#ifndef __GG_LIBGADU_CONFIG_H -#define __GG_LIBGADU_CONFIG_H - -/* Defined if libgadu was compiled for bigendian machine. */ -#undef __GG_LIBGADU_BIGENDIAN -#ifdef WORDS_BIGENDIAN -#define __GG_LIBGADU_BIGENDIAN -#endif /* WORDS_BIGENDIAN */ - -/* Defined if this machine has va_copy(). */ -#define __GG_LIBGADU_HAVE_VA_COPY - -/* Defined if this machine has __va_copy(). */ -#define __GG_LIBGADU_HAVE___VA_COPY - -/* Defined if this machine supports long long. */ -#undef __GG_LIBGADU_HAVE_LONG_LONG -#ifdef HAVE_LONG_LONG -#define __GG_LIBGADU_HAVE_LONG_LONG -#endif /* HAVE_LONG_LONG */ - -/* Defined if libgadu was compiled and linked with pthread support. */ -/* We don't like pthreads. */ -#undef __GG_LIBGADU_HAVE_PTHREAD - -/* Defined if libgadu was compiled and linked with TLS support. */ -/* Always undefined in Purple. */ -#undef __GG_LIBGADU_HAVE_OPENSSL - -/* Include file containing uintXX_t declarations. */ -#if HAVE_STDINT_H -#include -#endif - -/* Defined if this machine has C99-compiliant vsnprintf(). */ -#ifndef _WIN32 -#define __GG_LIBGADU_HAVE_C99_VSNPRINTF -#else -#undef __GG_LIBGADU_HAVE_C99_VSNPRINTF -#endif - -#define vnsprintf g_vnsprintf - -#ifdef _WIN32 -#define random (long) rand -#endif - -#endif /* __GG_LIBGADU_CONFIG_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/libgadu.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1310 +0,0 @@ -/* $Id: libgadu.h 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * Robert J. Wony - * Arkadiusz Mikiewicz - * Tomasz Chiliski - * Piotr Wysocki - * Dawid Jarosz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#ifndef __GG_LIBGADU_H -#define __GG_LIBGADU_H - -#ifdef __cplusplus -#ifdef _MSC_VER -#pragma pack(push, 1) -#endif -extern "C" { -#endif - -#include -#include -#include -#include - -#ifdef __GG_LIBGADU_HAVE_OPENSSL -#include -#endif - -/* - * typedef uin_t - * - * typ reprezentujcy numer osoby. - */ -typedef uint32_t uin_t; - -/* - * oglna struktura opisujca rne sesje. przydatna w klientach. - */ -#define gg_common_head(x) \ - int fd; /* podgldany deskryptor */ \ - int check; /* sprawdzamy zapis czy odczyt */ \ - int state; /* aktualny stan maszynki */ \ - int error; /* kod bdu dla GG_STATE_ERROR */ \ - int type; /* rodzaj sesji */ \ - int id; /* identyfikator */ \ - int timeout; /* sugerowany timeout w sekundach */ \ - int (*callback)(x*); /* callback przy zmianach */ \ - void (*destroy)(x*); /* funkcja niszczenia */ - -struct gg_common { - gg_common_head(struct gg_common) -}; - -struct gg_image_queue; - -/* - * struct gg_session - * - * struktura opisujca dan sesj. tworzona przez gg_login(), zwalniana - * przez gg_free_session(). - */ -struct gg_session { - gg_common_head(struct gg_session) - - int async; /* czy poczenie jest asynchroniczne */ - int pid; /* pid procesu resolvera */ - int port; /* port, z ktrym si czymy */ - int seq; /* numer sekwencyjny ostatniej wiadomoci */ - int last_pong; /* czas otrzymania ostatniego ping/pong */ - int last_event; /* czas otrzymania ostatniego pakietu */ - - struct gg_event *event; /* zdarzenie po ->callback() */ - - uint32_t proxy_addr; /* adres proxy, keszowany */ - uint16_t proxy_port; /* port proxy */ - - uint32_t hub_addr; /* adres huba po resolvniciu */ - uint32_t server_addr; /* adres serwera, od huba */ - - uint32_t client_addr; /* adres klienta */ - uint16_t client_port; /* port, na ktrym klient sucha */ - - uint32_t external_addr; /* adres zewnetrzny klienta */ - uint16_t external_port; /* port zewnetrzny klienta */ - - uin_t uin; /* numerek klienta */ - char *password; /* i jego haso. zwalniane automagicznie */ - - int initial_status; /* pocztkowy stan klienta */ - int status; /* aktualny stan klienta */ - - char *recv_buf; /* bufor na otrzymywane pakiety */ - int recv_done; /* ile ju wczytano do bufora */ - int recv_left; /* i ile jeszcze trzeba wczyta */ - - int protocol_version; /* wersja uywanego protokou */ - char *client_version; /* wersja uywanego klienta */ - int last_sysmsg; /* ostatnia wiadomo systemowa */ - - char *initial_descr; /* pocztkowy opis stanu klienta */ - - void *resolver; /* wskanik na informacje resolvera */ - - char *header_buf; /* bufor na pocztek nagwka */ - unsigned int header_done;/* ile ju mamy */ - -#ifdef __GG_LIBGADU_HAVE_OPENSSL - SSL *ssl; /* sesja TLS */ - SSL_CTX *ssl_ctx; /* kontekst sesji? */ -#else - void *ssl; /* zachowujemy ABI */ - void *ssl_ctx; -#endif - - int image_size; /* maksymalny rozmiar obrazkw w KiB */ - - char *userlist_reply; /* fragment odpowiedzi listy kontaktw */ - - int userlist_blocks; /* na ile kawakw podzielono list kontaktw */ - - struct gg_image_queue *images; /* aktualnie wczytywane obrazki */ -}; - -/* - * struct gg_http - * - * oglna struktura opisujca stan wszystkich operacji HTTP. tworzona - * przez gg_http_connect(), zwalniana przez gg_http_free(). - */ -struct gg_http { - gg_common_head(struct gg_http) - - int async; /* czy poczenie asynchroniczne */ - int pid; /* pid procesu resolvera */ - int port; /* port, z ktrym si czymy */ - - char *query; /* bufor zapytania http */ - char *header; /* bufor nagwka */ - int header_size; /* rozmiar wczytanego nagwka */ - char *body; /* bufor otrzymanych informacji */ - unsigned int body_size; /* oczekiwana ilo informacji */ - - void *data; /* dane danej operacji http */ - - char *user_data; /* dane uytkownika, nie s zwalniane przez gg_http_free() */ - - void *resolver; /* wskanik na informacje resolvera */ - - unsigned int body_done; /* ile ju treci odebrano? */ -}; - -#ifdef __GNUC__ -#define GG_PACKED __attribute__ ((packed)) -#else -#define GG_PACKED -#endif - -#define GG_MAX_PATH 276 - -/* - * struct gg_file_info - * - * odpowiednik windowsowej struktury WIN32_FIND_DATA niezbdnej przy - * wysyaniu plikw. - */ -struct gg_file_info { - uint32_t mode; /* dwFileAttributes */ - uint32_t ctime[2]; /* ftCreationTime */ - uint32_t atime[2]; /* ftLastAccessTime */ - uint32_t mtime[2]; /* ftLastWriteTime */ - uint32_t size_hi; /* nFileSizeHigh */ - uint32_t size; /* nFileSizeLow */ - uint32_t reserved0; /* dwReserved0 */ - uint32_t reserved1; /* dwReserved1 */ - unsigned char filename[GG_MAX_PATH - 14]; /* cFileName */ - unsigned char short_filename[14]; /* cAlternateFileName */ -} GG_PACKED; - -/* - * struct gg_dcc - * - * struktura opisujca nasuchujce gniazdo pocze midzy klientami. - * tworzona przez gg_dcc_socket_create(), zwalniana przez gg_dcc_free(). - */ -struct gg_dcc { - gg_common_head(struct gg_dcc) - - struct gg_event *event; /* opis zdarzenia */ - - int active; /* czy to my si czymy? */ - int port; /* port, na ktrym siedzi */ - uin_t uin; /* uin klienta */ - uin_t peer_uin; /* uin drugiej strony */ - int file_fd; /* deskryptor pliku */ - unsigned int offset; /* offset w pliku */ - unsigned int chunk_size;/* rozmiar kawaka */ - unsigned int chunk_offset;/* offset w aktualnym kawaku */ - struct gg_file_info file_info; - /* informacje o pliku */ - int established; /* poczenie ustanowione */ - uint8_t *voice_buf; /* bufor na pakiet poczenia gosowego */ - int incoming; /* poczenie przychodzce */ - char *chunk_buf; /* bufor na kawaek danych */ - uint32_t remote_addr; /* adres drugiej strony */ - uint16_t remote_port; /* port drugiej strony */ -}; - -/* - * enum gg_session_t - * - * rodzaje sesji. - */ -enum gg_session_t { - GG_SESSION_GG = 1, /* poczenie z serwerem gg */ - GG_SESSION_HTTP, /* oglna sesja http */ - GG_SESSION_SEARCH, /* szukanie */ - GG_SESSION_REGISTER, /* rejestrowanie */ - GG_SESSION_REMIND, /* przypominanie hasa */ - GG_SESSION_PASSWD, /* zmiana hasa */ - GG_SESSION_CHANGE, /* zmiana informacji o sobie */ - GG_SESSION_DCC, /* oglne poczenie DCC */ - GG_SESSION_DCC_SOCKET, /* nasuchujcy socket */ - GG_SESSION_DCC_SEND, /* wysyanie pliku */ - GG_SESSION_DCC_GET, /* odbieranie pliku */ - GG_SESSION_DCC_VOICE, /* rozmowa gosowa */ - GG_SESSION_USERLIST_GET, /* pobieranie userlisty */ - GG_SESSION_USERLIST_PUT, /* wysyanie userlisty */ - GG_SESSION_UNREGISTER, /* usuwanie konta */ - GG_SESSION_USERLIST_REMOVE, /* usuwanie userlisty */ - GG_SESSION_TOKEN, /* pobieranie tokenu */ - - GG_SESSION_USER0 = 256, /* zdefiniowana dla uytkownika */ - GG_SESSION_USER1, /* j.w. */ - GG_SESSION_USER2, /* j.w. */ - GG_SESSION_USER3, /* j.w. */ - GG_SESSION_USER4, /* j.w. */ - GG_SESSION_USER5, /* j.w. */ - GG_SESSION_USER6, /* j.w. */ - GG_SESSION_USER7 /* j.w. */ -}; - -/* - * enum gg_state_t - * - * opisuje stan asynchronicznej maszyny. - */ -enum gg_state_t { - /* wsplne */ - GG_STATE_IDLE = 0, /* nie powinno wystpi. */ - GG_STATE_RESOLVING, /* wywoa gethostbyname() */ - GG_STATE_CONNECTING, /* wywoa connect() */ - GG_STATE_READING_DATA, /* czeka na dane http */ - GG_STATE_ERROR, /* wystpi bd. kod w x->error */ - - /* gg_session */ - GG_STATE_CONNECTING_HUB, /* wywoa connect() na huba */ - GG_STATE_CONNECTING_GG, /* wywoa connect() na serwer */ - GG_STATE_READING_KEY, /* czeka na klucz */ - GG_STATE_READING_REPLY, /* czeka na odpowied */ - GG_STATE_CONNECTED, /* poczy si */ - - /* gg_http */ - GG_STATE_SENDING_QUERY, /* wysya zapytanie http */ - GG_STATE_READING_HEADER, /* czeka na nagwek http */ - GG_STATE_PARSING, /* przetwarza dane */ - GG_STATE_DONE, /* skoczy */ - - /* gg_dcc */ - GG_STATE_LISTENING, /* czeka na poczenia */ - GG_STATE_READING_UIN_1, /* czeka na uin peera */ - GG_STATE_READING_UIN_2, /* czeka na swj uin */ - GG_STATE_SENDING_ACK, /* wysya potwierdzenie dcc */ - GG_STATE_READING_ACK, /* czeka na potwierdzenie dcc */ - GG_STATE_READING_REQUEST, /* czeka na komend */ - GG_STATE_SENDING_REQUEST, /* wysya komend */ - GG_STATE_SENDING_FILE_INFO, /* wysya informacje o pliku */ - GG_STATE_READING_PRE_FILE_INFO, /* czeka na pakiet przed file_info */ - GG_STATE_READING_FILE_INFO, /* czeka na informacje o pliku */ - GG_STATE_SENDING_FILE_ACK, /* wysya potwierdzenie pliku */ - GG_STATE_READING_FILE_ACK, /* czeka na potwierdzenie pliku */ - GG_STATE_SENDING_FILE_HEADER, /* wysya nagwek pliku */ - GG_STATE_READING_FILE_HEADER, /* czeka na nagwek */ - GG_STATE_GETTING_FILE, /* odbiera plik */ - GG_STATE_SENDING_FILE, /* wysya plik */ - GG_STATE_READING_VOICE_ACK, /* czeka na potwierdzenie voip */ - GG_STATE_READING_VOICE_HEADER, /* czeka na rodzaj bloku voip */ - GG_STATE_READING_VOICE_SIZE, /* czeka na rozmiar bloku voip */ - GG_STATE_READING_VOICE_DATA, /* czeka na dane voip */ - GG_STATE_SENDING_VOICE_ACK, /* wysya potwierdzenie voip */ - GG_STATE_SENDING_VOICE_REQUEST, /* wysya danie voip */ - GG_STATE_READING_TYPE, /* czeka na typ poczenia */ - - /* nowe. bez sensu jest to API. */ - GG_STATE_TLS_NEGOTIATION /* negocjuje poczenie TLS */ -}; - -/* - * enum gg_check_t - * - * informuje, co proces klienta powinien sprawdzi na deskryptorze danego - * poczenia. - */ -enum gg_check_t { - GG_CHECK_NONE = 0, /* nic. nie powinno wystpi */ - GG_CHECK_WRITE = 1, /* sprawdzamy moliwo zapisu */ - GG_CHECK_READ = 2 /* sprawdzamy moliwo odczytu */ -}; - -/* - * struct gg_login_params - * - * parametry gg_login(). przeniesiono do struktury, eby unikn problemw - * z cigymi zmianami API, gdy dodano co nowego do protokou. - */ -struct gg_login_params { - uin_t uin; /* numerek */ - char *password; /* haso */ - int async; /* asynchroniczne sockety? */ - int status; /* pocztkowy status klienta */ - char *status_descr; /* opis statusu */ - uint32_t server_addr; /* adres serwera gg */ - uint16_t server_port; /* port serwera gg */ - uint32_t client_addr; /* adres dcc klienta */ - uint16_t client_port; /* port dcc klienta */ - int protocol_version; /* wersja protokou */ - char *client_version; /* wersja klienta */ - int has_audio; /* czy ma dwik? */ - int last_sysmsg; /* ostatnia wiadomo systemowa */ - uint32_t external_addr; /* adres widziany na zewnatrz */ - uint16_t external_port; /* port widziany na zewnatrz */ - int tls; /* czy czymy po TLS? */ - int image_size; /* maksymalny rozmiar obrazka w KiB */ - int era_omnix; /* czy udawa klienta era omnix? */ - - char dummy[6 * sizeof(int)]; /* miejsce na kolejnych 6 zmiennych, - * eby z dodaniem parametru nie - * zmienia si rozmiar struktury */ -}; - -struct gg_session *gg_login(const struct gg_login_params *p); -void gg_free_session(struct gg_session *sess); -void gg_logoff(struct gg_session *sess); -int gg_change_status(struct gg_session *sess, int status); -int gg_change_status_descr(struct gg_session *sess, int status, const char *descr); -int gg_change_status_descr_time(struct gg_session *sess, int status, const char *descr, int time); -int gg_send_message(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message); -int gg_send_message_richtext(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, const unsigned char *format, int formatlen); -int gg_send_message_confer(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message); -int gg_send_message_confer_richtext(struct gg_session *sess, int msgclass, int recipients_count, uin_t *recipients, const unsigned char *message, const unsigned char *format, int formatlen); -int gg_send_message_ctcp(struct gg_session *sess, int msgclass, uin_t recipient, const unsigned char *message, int message_len); -int gg_ping(struct gg_session *sess); -int gg_userlist_request(struct gg_session *sess, char type, const char *request); -int gg_image_request(struct gg_session *sess, uin_t recipient, int size, uint32_t crc32); -int gg_image_reply(struct gg_session *sess, uin_t recipient, const char *filename, const unsigned char *image, int size); - -uint32_t gg_crc32(uint32_t crc, const unsigned char *buf, int len); - -struct gg_image_queue { - uin_t sender; /* nadawca obrazka */ - uint32_t size; /* rozmiar */ - uint32_t crc32; /* suma kontrolna */ - char *filename; /* nazwa pliku */ - char *image; /* bufor z obrazem */ - uint32_t done; /* ile ju wczytano */ - - struct gg_image_queue *next; /* nastpny na licie */ -}; - -/* - * enum gg_event_t - * - * rodzaje zdarze. - */ -enum gg_event_t { - GG_EVENT_NONE = 0, /* nic si nie wydarzyo */ - GG_EVENT_MSG, /* otrzymano wiadomo */ - GG_EVENT_NOTIFY, /* kto si pojawi */ - GG_EVENT_NOTIFY_DESCR, /* kto si pojawi z opisem */ - GG_EVENT_STATUS, /* kto zmieni stan */ - GG_EVENT_ACK, /* potwierdzenie wysania wiadomoci */ - GG_EVENT_PONG, /* pakiet pong */ - GG_EVENT_CONN_FAILED, /* poczenie si nie udao */ - GG_EVENT_CONN_SUCCESS, /* poczenie si powiodo */ - GG_EVENT_DISCONNECT, /* serwer zrywa poczenie */ - - GG_EVENT_DCC_NEW, /* nowe poczenie midzy klientami */ - GG_EVENT_DCC_ERROR, /* bd poczenia midzy klientami */ - GG_EVENT_DCC_DONE, /* zakoczono poczenie */ - GG_EVENT_DCC_CLIENT_ACCEPT, /* moment akceptacji klienta */ - GG_EVENT_DCC_CALLBACK, /* klient si poczy na danie */ - GG_EVENT_DCC_NEED_FILE_INFO, /* naley wypeni file_info */ - GG_EVENT_DCC_NEED_FILE_ACK, /* czeka na potwierdzenie pliku */ - GG_EVENT_DCC_NEED_VOICE_ACK, /* czeka na potwierdzenie rozmowy */ - GG_EVENT_DCC_VOICE_DATA, /* ramka danych rozmowy gosowej */ - - GG_EVENT_PUBDIR50_SEARCH_REPLY, /* odpowiedz wyszukiwania */ - GG_EVENT_PUBDIR50_READ, /* odczytano wasne dane z katalogu */ - GG_EVENT_PUBDIR50_WRITE, /* wpisano wasne dane do katalogu */ - - GG_EVENT_STATUS60, /* kto zmieni stan w GG 6.0 */ - GG_EVENT_NOTIFY60, /* kto si pojawi w GG 6.0 */ - GG_EVENT_USERLIST, /* odpowied listy kontaktw w GG 6.0 */ - GG_EVENT_IMAGE_REQUEST, /* proba o wysanie obrazka GG 6.0 */ - GG_EVENT_IMAGE_REPLY, /* podesany obrazek GG 6.0 */ - GG_EVENT_DCC_ACK /* potwierdzenie transmisji */ -}; - -#define GG_EVENT_SEARCH50_REPLY GG_EVENT_PUBDIR50_SEARCH_REPLY - -/* - * enum gg_failure_t - * - * okrela powd nieudanego poczenia. - */ -enum gg_failure_t { - GG_FAILURE_RESOLVING = 1, /* nie znaleziono serwera */ - GG_FAILURE_CONNECTING, /* nie mona si poczy */ - GG_FAILURE_INVALID, /* serwer zwrci nieprawidowe dane */ - GG_FAILURE_READING, /* zerwano poczenie podczas odczytu */ - GG_FAILURE_WRITING, /* zerwano poczenie podczas zapisu */ - GG_FAILURE_PASSWORD, /* nieprawidowe haso */ - GG_FAILURE_404, /* XXX nieuywane */ - GG_FAILURE_TLS, /* bd negocjacji TLS */ - GG_FAILURE_NEED_EMAIL /* serwer rozczy nas z prob o zmian emaila */ -}; - -/* - * enum gg_error_t - * - * okrela rodzaj bdu wywoanego przez dan operacj. nie zawiera - * przesadnie szczegowych informacji o powodzie bdu, by nie komplikowa - * obsugi bdw. jeli wymagana jest wiksza dokadno, naley sprawdzi - * zawarto zmiennej errno. - */ -enum gg_error_t { - GG_ERROR_RESOLVING = 1, /* bd znajdowania hosta */ - GG_ERROR_CONNECTING, /* bd aczenia si */ - GG_ERROR_READING, /* bd odczytu */ - GG_ERROR_WRITING, /* bd wysyania */ - - GG_ERROR_DCC_HANDSHAKE, /* bd negocjacji */ - GG_ERROR_DCC_FILE, /* bd odczytu/zapisu pliku */ - GG_ERROR_DCC_EOF, /* plik si skoczy? */ - GG_ERROR_DCC_NET, /* bd wysyania/odbierania */ - GG_ERROR_DCC_REFUSED /* poczenie odrzucone przez usera */ -}; - -/* - * struktury dotyczce wyszukiwania w GG 5.0. NIE NALEY SI DO NICH - * ODWOYWA BEZPOREDNIO! do dostpu do nich su funkcje gg_pubdir50_*() - */ -struct gg_pubdir50_entry { - int num; - char *field; - char *value; -}; - -struct gg_pubdir50_s { - int count; - uin_t next; - int type; - uint32_t seq; - struct gg_pubdir50_entry *entries; - int entries_count; -}; - -/* - * typedef gg_pubdir_50_t - * - * typ opisujcy zapytanie lub wynik zapytania katalogu publicznego - * z protokou GG 5.0. nie naley si odwoywa bezporednio do jego - * pl -- su do tego funkcje gg_pubdir50_*() - */ -typedef struct gg_pubdir50_s *gg_pubdir50_t; - -/* - * struct gg_event - * - * struktura opisujca rodzaj zdarzenia. wychodzi z gg_watch_fd() lub - * z gg_dcc_watch_fd() - */ -struct gg_event { - int type; /* rodzaj zdarzenia -- gg_event_t */ - union { /* @event */ - struct gg_notify_reply *notify; /* informacje o licie kontaktw -- GG_EVENT_NOTIFY */ - - enum gg_failure_t failure; /* bd poczenia -- GG_EVENT_FAILURE */ - - struct gg_dcc *dcc_new; /* nowe poczenie bezporednie -- GG_EVENT_DCC_NEW */ - - int dcc_error; /* bd poczenia bezporedniego -- GG_EVENT_DCC_ERROR */ - - gg_pubdir50_t pubdir50; /* wynik operacji zwizanej z katalogiem publicznym -- GG_EVENT_PUBDIR50_* */ - - struct { /* @msg odebrano wiadomo -- GG_EVENT_MSG */ - uin_t sender; /* numer nadawcy */ - int msgclass; /* klasa wiadomoci */ - time_t time; /* czas nadania */ - unsigned char *message; /* tre wiadomoci */ - - int recipients_count; /* ilo odbiorcw konferencji */ - uin_t *recipients; /* odbiorcy konferencji */ - - int formats_length; /* dugo informacji o formatowaniu tekstu */ - void *formats; /* informacje o formatowaniu tekstu */ - } msg; - - struct { /* @notify_descr informacje o licie kontaktw z opisami stanu -- GG_EVENT_NOTIFY_DESCR */ - struct gg_notify_reply *notify; /* informacje o licie kontaktw */ - char *descr; /* opis stanu */ - } notify_descr; - - struct { /* @status zmiana stanu -- GG_EVENT_STATUS */ - uin_t uin; /* numer */ - uint32_t status; /* nowy stan */ - char *descr; /* opis stanu */ - } status; - - struct { /* @status60 zmiana stanu -- GG_EVENT_STATUS60 */ - uin_t uin; /* numer */ - int status; /* nowy stan */ - uint32_t remote_ip; /* adres ip */ - uint16_t remote_port; /* port */ - int version; /* wersja klienta */ - int image_size; /* maksymalny rozmiar grafiki w KiB */ - char *descr; /* opis stanu */ - time_t time; /* czas powrotu */ - } status60; - - struct { /* @notify60 informacja o licie kontaktw -- GG_EVENT_NOTIFY60 */ - uin_t uin; /* numer */ - int status; /* stan */ - uint32_t remote_ip; /* adres ip */ - uint16_t remote_port; /* port */ - int version; /* wersja klienta */ - int image_size; /* maksymalny rozmiar grafiki w KiB */ - char *descr; /* opis stanu */ - time_t time; /* czas powrotu */ - } *notify60; - - struct { /* @ack potwierdzenie wiadomoci -- GG_EVENT_ACK */ - uin_t recipient; /* numer odbiorcy */ - int status; /* stan dorczenia wiadomoci */ - int seq; /* numer sekwencyjny wiadomoci */ - } ack; - - struct { /* @dcc_voice_data otrzymano dane dwikowe -- GG_EVENT_DCC_VOICE_DATA */ - uint8_t *data; /* dane dwikowe */ - int length; /* ilo danych dwikowych */ - } dcc_voice_data; - - struct { /* @userlist odpowied listy kontaktw serwera */ - char type; /* rodzaj odpowiedzi */ - char *reply; /* tre odpowiedzi */ - } userlist; - - struct { /* @image_request proba o obrazek */ - uin_t sender; /* nadawca proby */ - uint32_t size; /* rozmiar obrazka */ - uint32_t crc32; /* suma kontrolna */ - } image_request; - - struct { /* @image_reply odpowied z obrazkiem */ - uin_t sender; /* nadawca odpowiedzi */ - uint32_t size; /* rozmiar obrazka */ - uint32_t crc32; /* suma kontrolna */ - char *filename; /* nazwa pliku */ - char *image; /* bufor z obrazkiem */ - } image_reply; - } event; -}; - -struct gg_event *gg_watch_fd(struct gg_session *sess); -void gg_event_free(struct gg_event *e); -#define gg_free_event gg_event_free - -/* - * funkcje obsugi listy kontaktw. - */ -int gg_notify_ex(struct gg_session *sess, uin_t *userlist, char *types, int count); -int gg_notify(struct gg_session *sess, uin_t *userlist, int count); -int gg_add_notify_ex(struct gg_session *sess, uin_t uin, char type); -int gg_add_notify(struct gg_session *sess, uin_t uin); -int gg_remove_notify_ex(struct gg_session *sess, uin_t uin, char type); -int gg_remove_notify(struct gg_session *sess, uin_t uin); - -/* - * funkcje obsugi http. - */ -struct gg_http *gg_http_connect(const char *hostname, int port, int async, const char *method, const char *path, const char *header); -int gg_http_watch_fd(struct gg_http *h); -void gg_http_stop(struct gg_http *h); -void gg_http_free(struct gg_http *h); -void gg_http_free_fields(struct gg_http *h); -#define gg_free_http gg_http_free - -/* - * struktury opisujca kryteria wyszukiwania dla gg_search(). nieaktualne, - * zastpione przez gg_pubdir50_t. pozostawiono je dla zachowania ABI. - */ -struct gg_search_request { - int active; - unsigned int start; - char *nickname; - char *first_name; - char *last_name; - char *city; - int gender; - int min_birth; - int max_birth; - char *email; - char *phone; - uin_t uin; -}; - -struct gg_search { - int count; - struct gg_search_result *results; -}; - -struct gg_search_result { - uin_t uin; - char *first_name; - char *last_name; - char *nickname; - int born; - int gender; - char *city; - int active; -}; - -#define GG_GENDER_NONE 0 -#define GG_GENDER_FEMALE 1 -#define GG_GENDER_MALE 2 - -/* - * funkcje wyszukiwania. - */ -struct gg_http *gg_search(const struct gg_search_request *r, int async); -int gg_search_watch_fd(struct gg_http *f); -void gg_free_search(struct gg_http *f); -#define gg_search_free gg_free_search - -const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start); -const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start); -const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start); -const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start); -void gg_search_request_free(struct gg_search_request *r); - -/* - * funkcje obsugi katalogu publicznego zgodne z GG 5.0. tym razem funkcje - * zachowuj pewien poziom abstrakcji, eby unikn zmian ABI przy zmianach - * w protokole. - * - * NIE NALEY SI ODWOYWA DO PL gg_pubdir50_t BEZPOREDNIO! - */ -uint32_t gg_pubdir50(struct gg_session *sess, gg_pubdir50_t req); -gg_pubdir50_t gg_pubdir50_new(int type); -int gg_pubdir50_add(gg_pubdir50_t req, const char *field, const char *value); -int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq); -const char *gg_pubdir50_get(gg_pubdir50_t res, int num, const char *field); -int gg_pubdir50_type(gg_pubdir50_t res); -int gg_pubdir50_count(gg_pubdir50_t res); -uin_t gg_pubdir50_next(gg_pubdir50_t res); -uint32_t gg_pubdir50_seq(gg_pubdir50_t res); -void gg_pubdir50_free(gg_pubdir50_t res); - -#define GG_PUBDIR50_UIN "FmNumber" -#define GG_PUBDIR50_STATUS "FmStatus" -#define GG_PUBDIR50_FIRSTNAME "firstname" -#define GG_PUBDIR50_LASTNAME "lastname" -#define GG_PUBDIR50_NICKNAME "nickname" -#define GG_PUBDIR50_BIRTHYEAR "birthyear" -#define GG_PUBDIR50_CITY "city" -#define GG_PUBDIR50_GENDER "gender" -#define GG_PUBDIR50_GENDER_FEMALE "1" -#define GG_PUBDIR50_GENDER_MALE "2" -#define GG_PUBDIR50_GENDER_SET_FEMALE "2" -#define GG_PUBDIR50_GENDER_SET_MALE "1" -#define GG_PUBDIR50_ACTIVE "ActiveOnly" -#define GG_PUBDIR50_ACTIVE_TRUE "1" -#define GG_PUBDIR50_START "fmstart" -#define GG_PUBDIR50_FAMILYNAME "familyname" -#define GG_PUBDIR50_FAMILYCITY "familycity" - -int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length); - -/* - * struct gg_pubdir - * - * operacje na katalogu publicznym. - */ -struct gg_pubdir { - int success; /* czy si udao */ - uin_t uin; /* otrzymany numerek. 0 jeli bd */ -}; - -/* oglne funkcje, nie powinny by uywane */ -int gg_pubdir_watch_fd(struct gg_http *f); -void gg_pubdir_free(struct gg_http *f); -#define gg_free_pubdir gg_pubdir_free - -struct gg_token { - int width; /* szeroko obrazka */ - int height; /* wysoko obrazka */ - int length; /* ilo znakw w tokenie */ - char *tokenid; /* id tokenu */ -}; - -/* funkcje dotyczce tokenw */ -struct gg_http *gg_token(int async); -int gg_token_watch_fd(struct gg_http *h); -void gg_token_free(struct gg_http *h); - -/* rejestracja nowego numerka */ -struct gg_http *gg_register(const char *email, const char *password, int async); -struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async); -struct gg_http *gg_register3(const char *email, const char *password, const char *tokenid, const char *tokenval, int async); -#define gg_register_watch_fd gg_pubdir_watch_fd -#define gg_register_free gg_pubdir_free -#define gg_free_register gg_pubdir_free - -struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async); -struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async); -struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *tokenid, const char *tokenval, int async); -#define gg_unregister_watch_fd gg_pubdir_watch_fd -#define gg_unregister_free gg_pubdir_free - -/* przypomnienie hasa e-mailem */ -struct gg_http *gg_remind_passwd(uin_t uin, int async); -struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async); -struct gg_http *gg_remind_passwd3(uin_t uin, const char *email, const char *tokenid, const char *tokenval, int async); -#define gg_remind_passwd_watch_fd gg_pubdir_watch_fd -#define gg_remind_passwd_free gg_pubdir_free -#define gg_free_remind_passwd gg_pubdir_free - -/* zmiana hasa */ -struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async); -struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async); -struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async); -struct gg_http *gg_change_passwd4(uin_t uin, const char *email, const char *passwd, const char *newpasswd, const char *tokenid, const char *tokenval, int async); -#define gg_change_passwd_free gg_pubdir_free -#define gg_free_change_passwd gg_pubdir_free - -/* - * struct gg_change_info_request - * - * opis dania zmiany informacji w katalogu publicznym. - */ -struct gg_change_info_request { - char *first_name; /* imi */ - char *last_name; /* nazwisko */ - char *nickname; /* pseudonim */ - char *email; /* email */ - int born; /* rok urodzenia */ - int gender; /* pe */ - char *city; /* miasto */ -}; - -struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city); -void gg_change_info_request_free(struct gg_change_info_request *r); - -struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async); -#define gg_change_pubdir_watch_fd gg_pubdir_watch_fd -#define gg_change_pubdir_free gg_pubdir_free -#define gg_free_change_pubdir gg_pubdir_free - -/* - * funkcje dotyczce listy kontaktw na serwerze. - */ -struct gg_http *gg_userlist_get(uin_t uin, const char *password, int async); -int gg_userlist_get_watch_fd(struct gg_http *f); -void gg_userlist_get_free(struct gg_http *f); - -struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async); -int gg_userlist_put_watch_fd(struct gg_http *f); -void gg_userlist_put_free(struct gg_http *f); - -struct gg_http *gg_userlist_remove(uin_t uin, const char *password, int async); -int gg_userlist_remove_watch_fd(struct gg_http *f); -void gg_userlist_remove_free(struct gg_http *f); - - - -/* - * funkcje dotyczce komunikacji midzy klientami. - */ -extern int gg_dcc_port; /* port, na ktrym nasuchuje klient */ -extern unsigned long gg_dcc_ip; /* adres, na ktrym nasuchuje klient */ - -int gg_dcc_request(struct gg_session *sess, uin_t uin); - -struct gg_dcc *gg_dcc_send_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); -struct gg_dcc *gg_dcc_get_file(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); -struct gg_dcc *gg_dcc_voice_chat(uint32_t ip, uint16_t port, uin_t my_uin, uin_t peer_uin); -void gg_dcc_set_type(struct gg_dcc *d, int type); -int gg_dcc_fill_file_info(struct gg_dcc *d, const char *filename); -int gg_dcc_fill_file_info2(struct gg_dcc *d, const char *filename, const char *local_filename); -int gg_dcc_voice_send(struct gg_dcc *d, char *buf, int length); - -#define GG_DCC_VOICE_FRAME_LENGTH 195 -#define GG_DCC_VOICE_FRAME_LENGTH_505 326 - -struct gg_dcc *gg_dcc_socket_create(uin_t uin, uint16_t port); -#define gg_dcc_socket_free gg_free_dcc -#define gg_dcc_socket_watch_fd gg_dcc_watch_fd - -struct gg_event *gg_dcc_watch_fd(struct gg_dcc *d); - -void gg_dcc_free(struct gg_dcc *c); -#define gg_free_dcc gg_dcc_free - -/* - * jeli chcemy sobie podebugowa, wystarczy ustawi `gg_debug_level'. - * niestety w miar przybywania wpisw `gg_debug(...)' nie chciao mi - * si ustawia odpowiednich leveli, wic wikszo sza do _MISC. - */ -extern int gg_debug_level; /* poziom debugowania. mapa bitowa staych GG_DEBUG_* */ - -/* - * mona poda wskanik do funkcji obsugujcej wywoania gg_debug(). - * nieoficjalne, nieudokumentowane, moe si zmieni. jeli kto jest - * zainteresowany, niech da zna na ekg-devel. - */ -extern void (*gg_debug_handler)(int level, const char *format, va_list ap); - -/* - * mona poda plik, do ktrego bd zapisywane teksty z gg_debug(). - */ -extern FILE *gg_debug_file; - -#define GG_DEBUG_NET 1 -#define GG_DEBUG_TRAFFIC 2 -#define GG_DEBUG_DUMP 4 -#define GG_DEBUG_FUNCTION 8 -#define GG_DEBUG_MISC 16 - -#ifdef GG_DEBUG_DISABLE -#define gg_debug(x, y...) do { } while(0) -#else -void gg_debug(int level, const char *format, ...); -#endif - -const char *gg_libgadu_version(void); - -/* - * konfiguracja http proxy. - */ -extern int gg_proxy_enabled; /* wcza obsug proxy */ -extern char *gg_proxy_host; /* okrela adres serwera proxy */ -extern int gg_proxy_port; /* okrela port serwera proxy */ -extern char *gg_proxy_username; /* okrela nazw uytkownika przy autoryzacji serwera proxy */ -extern char *gg_proxy_password; /* okrela haso uytkownika przy autoryzacji serwera proxy */ -extern int gg_proxy_http_only; /* wcza obsug proxy wycznie dla usug HTTP */ - - -/* - * adres, z ktrego lemy pakiety (np czymy si z serwerem) - * uywany przy gg_connect() - */ -extern unsigned long gg_local_ip; -/* - * ------------------------------------------------------------------------- - * poniej znajduj si wewntrzne sprawy biblioteki. zwyky klient nie - * powinien ich w ogle rusza, bo i nie ma po co. wszystko mona zaatwi - * procedurami wyszego poziomu, ktrych definicje znajduj si na pocztku - * tego pliku. - * ------------------------------------------------------------------------- - */ - -#ifdef __GG_LIBGADU_HAVE_PTHREAD -int gg_resolve_pthread(int *fd, void **resolver, const char *hostname); -#elif defined _WIN32 -int gg_resolve_win32thread(int *fd, void **resolver, const char *hostname); -#endif - -#ifdef _WIN32 -int gg_thread_socket(int thread_id, int socket); -#endif - -int gg_resolve(int *fd, int *pid, const char *hostname); - -#if defined __GNUC__ && !defined _WIN32 -char *gg_saprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); -#else -char *gg_saprintf(const char *format, ...); -#endif - -char *gg_vsaprintf(const char *format, va_list ap); - -#define gg_alloc_sprintf gg_saprintf - -char *gg_get_line(char **ptr); - -int gg_connect(void *addr, int port, int async); -struct in_addr *gg_gethostbyname(const char *hostname); -char *gg_read_line(int sock, char *buf, int length); -void gg_chomp(char *line); -char *gg_urlencode(const char *str); -int gg_http_hash(const char *format, ...); -int gg_read(struct gg_session *sess, char *buf, int length); -int gg_write(struct gg_session *sess, const char *buf, int length); -void *gg_recv_packet(struct gg_session *sess); -int gg_send_packet(struct gg_session *sess, int type, ...); -unsigned int gg_login_hash(const unsigned char *password, unsigned int seed); -uint32_t gg_fix32(uint32_t x); -uint16_t gg_fix16(uint16_t x); -#define fix16 gg_fix16 -#define fix32 gg_fix32 -char *gg_proxy_auth(void); -char *gg_base64_encode(const char *buf); -char *gg_base64_decode(const char *buf); -int gg_image_queue_remove(struct gg_session *s, struct gg_image_queue *q, int freeq); - -#define GG_APPMSG_HOST "appmsg.gadu-gadu.pl" -#define GG_APPMSG_PORT 80 -#define GG_PUBDIR_HOST "pubdir.gadu-gadu.pl" -#define GG_PUBDIR_PORT 80 -#define GG_REGISTER_HOST "register.gadu-gadu.pl" -#define GG_REGISTER_PORT 80 -#define GG_REMIND_HOST "retr.gadu-gadu.pl" -#define GG_REMIND_PORT 80 - -#define GG_DEFAULT_PORT 8074 -#define GG_HTTPS_PORT 443 -#define GG_HTTP_USERAGENT "Mozilla/4.7 [en] (Win98; I)" - -#define GG_DEFAULT_CLIENT_VERSION "6, 1, 0, 158" -#define GG_DEFAULT_PROTOCOL_VERSION 0x24 -#define GG_DEFAULT_TIMEOUT 30 -#define GG_HAS_AUDIO_MASK 0x40000000 -#define GG_ERA_OMNIX_MASK 0x04000000 -#define GG_LIBGADU_VERSION "1.5.20050718" - -#define GG_DEFAULT_DCC_PORT 1550 - -struct gg_header { - uint32_t type; /* typ pakietu */ - uint32_t length; /* dugo reszty pakietu */ -} GG_PACKED; - -#define GG_WELCOME 0x0001 -#define GG_NEED_EMAIL 0x0014 - -struct gg_welcome { - uint32_t key; /* klucz szyfrowania hasa */ -} GG_PACKED; - -#define GG_LOGIN 0x000c - -struct gg_login { - uint32_t uin; /* mj numerek */ - uint32_t hash; /* hash hasa */ - uint32_t status; /* status na dzie dobry */ - uint32_t version; /* moja wersja klienta */ - uint32_t local_ip; /* mj adres ip */ - uint16_t local_port; /* port, na ktrym sucham */ -} GG_PACKED; - -#define GG_LOGIN_EXT 0x0013 - -struct gg_login_ext { - uint32_t uin; /* mj numerek */ - uint32_t hash; /* hash hasa */ - uint32_t status; /* status na dzie dobry */ - uint32_t version; /* moja wersja klienta */ - uint32_t local_ip; /* mj adres ip */ - uint16_t local_port; /* port, na ktrym sucham */ - uint32_t external_ip; /* zewntrzny adres ip */ - uint16_t external_port; /* zewntrzny port */ -} GG_PACKED; - -#define GG_LOGIN60 0x0015 - -struct gg_login60 { - uint32_t uin; /* mj numerek */ - uint32_t hash; /* hash hasa */ - uint32_t status; /* status na dzie dobry */ - uint32_t version; /* moja wersja klienta */ - uint8_t dunno1; /* 0x00 */ - uint32_t local_ip; /* mj adres ip */ - uint16_t local_port; /* port, na ktrym sucham */ - uint32_t external_ip; /* zewntrzny adres ip */ - uint16_t external_port; /* zewntrzny port */ - uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ - uint8_t dunno2; /* 0xbe */ -} GG_PACKED; - -#define GG_LOGIN_OK 0x0003 - -#define GG_LOGIN_FAILED 0x0009 - -#define GG_PUBDIR50_REQUEST 0x0014 - -#define GG_PUBDIR50_WRITE 0x01 -#define GG_PUBDIR50_READ 0x02 -#define GG_PUBDIR50_SEARCH 0x03 -#define GG_PUBDIR50_SEARCH_REQUEST GG_PUBDIR50_SEARCH -#define GG_PUBDIR50_SEARCH_REPLY 0x05 - -struct gg_pubdir50_request { - uint8_t type; /* GG_PUBDIR50_* */ - uint32_t seq; /* czas wysania zapytania */ -} GG_PACKED; - -#define GG_PUBDIR50_REPLY 0x000e - -struct gg_pubdir50_reply { - uint8_t type; /* GG_PUBDIR50_* */ - uint32_t seq; /* czas wysania zapytania */ -} GG_PACKED; - -#define GG_NEW_STATUS 0x0002 - -#define GG_STATUS_NOT_AVAIL 0x0001 /* niedostpny */ -#define GG_STATUS_NOT_AVAIL_DESCR 0x0015 /* niedostpny z opisem (4.8) */ -#define GG_STATUS_AVAIL 0x0002 /* dostpny */ -#define GG_STATUS_AVAIL_DESCR 0x0004 /* dostpny z opisem (4.9) */ -#define GG_STATUS_BUSY 0x0003 /* zajty */ -#define GG_STATUS_BUSY_DESCR 0x0005 /* zajty z opisem (4.8) */ -#define GG_STATUS_INVISIBLE 0x0014 /* niewidoczny (4.6) */ -#define GG_STATUS_INVISIBLE_DESCR 0x0016 /* niewidoczny z opisem (4.9) */ -#define GG_STATUS_BLOCKED 0x0006 /* zablokowany */ - -#define GG_STATUS_FRIENDS_MASK 0x8000 /* tylko dla znajomych (4.6) */ - -#define GG_STATUS_DESCR_MAXSIZE 70 - -/* - * makra do atwego i szybkiego sprawdzania stanu. - */ - -/* GG_S_F() tryb tylko dla znajomych */ -#define GG_S_F(x) (((x) & GG_STATUS_FRIENDS_MASK) != 0) - -/* GG_S() stan bez uwzgldnienia trybu tylko dla znajomych */ -#define GG_S(x) ((x) & ~GG_STATUS_FRIENDS_MASK) - -/* GG_S_A() dostpny */ -#define GG_S_A(x) (GG_S(x) == GG_STATUS_AVAIL || GG_S(x) == GG_STATUS_AVAIL_DESCR) - -/* GG_S_NA() niedostpny */ -#define GG_S_NA(x) (GG_S(x) == GG_STATUS_NOT_AVAIL || GG_S(x) == GG_STATUS_NOT_AVAIL_DESCR) - -/* GG_S_B() zajty */ -#define GG_S_B(x) (GG_S(x) == GG_STATUS_BUSY || GG_S(x) == GG_STATUS_BUSY_DESCR) - -/* GG_S_I() niewidoczny */ -#define GG_S_I(x) (GG_S(x) == GG_STATUS_INVISIBLE || GG_S(x) == GG_STATUS_INVISIBLE_DESCR) - -/* GG_S_D() stan opisowy */ -#define GG_S_D(x) (GG_S(x) == GG_STATUS_NOT_AVAIL_DESCR || GG_S(x) == GG_STATUS_AVAIL_DESCR || GG_S(x) == GG_STATUS_BUSY_DESCR || GG_S(x) == GG_STATUS_INVISIBLE_DESCR) - -/* GG_S_BL() blokowany lub blokujcy */ -#define GG_S_BL(x) (GG_S(x) == GG_STATUS_BLOCKED) - -struct gg_new_status { - uint32_t status; /* na jaki zmieni? */ -} GG_PACKED; - -#define GG_NOTIFY_FIRST 0x000f -#define GG_NOTIFY_LAST 0x0010 - -#define GG_NOTIFY 0x0010 - -struct gg_notify { - uint32_t uin; /* numerek danej osoby */ - uint8_t dunno1; /* rodzaj wpisu w licie */ -} GG_PACKED; - -#define GG_USER_OFFLINE 0x01 /* bdziemy niewidoczni dla uytkownika */ -#define GG_USER_NORMAL 0x03 /* zwyky uytkownik */ -#define GG_USER_BLOCKED 0x04 /* zablokowany uytkownik */ - -#define GG_LIST_EMPTY 0x0012 - -#define GG_NOTIFY_REPLY 0x000c /* tak, to samo co GG_LOGIN */ - -struct gg_notify_reply { - uint32_t uin; /* numerek */ - uint32_t status; /* status danej osoby */ - uint32_t remote_ip; /* adres ip delikwenta */ - uint16_t remote_port; /* port, na ktrym sucha klient */ - uint32_t version; /* wersja klienta */ - uint16_t dunno2; /* znowu port? */ -} GG_PACKED; - -#define GG_NOTIFY_REPLY60 0x0011 - -struct gg_notify_reply60 { - uint32_t uin; /* numerek plus flagi w MSB */ - uint8_t status; /* status danej osoby */ - uint32_t remote_ip; /* adres ip delikwenta */ - uint16_t remote_port; /* port, na ktrym sucha klient */ - uint8_t version; /* wersja klienta */ - uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ - uint8_t dunno1; /* 0x00 */ -} GG_PACKED; - -#define GG_STATUS60 0x000f - -struct gg_status60 { - uint32_t uin; /* numerek plus flagi w MSB */ - uint8_t status; /* status danej osoby */ - uint32_t remote_ip; /* adres ip delikwenta */ - uint16_t remote_port; /* port, na ktrym sucha klient */ - uint8_t version; /* wersja klienta */ - uint8_t image_size; /* maksymalny rozmiar grafiki w KiB */ - uint8_t dunno1; /* 0x00 */ -} GG_PACKED; - -#define GG_ADD_NOTIFY 0x000d -#define GG_REMOVE_NOTIFY 0x000e - -struct gg_add_remove { - uint32_t uin; /* numerek */ - uint8_t dunno1; /* bitmapa */ -} GG_PACKED; - -#define GG_STATUS 0x0002 - -struct gg_status { - uint32_t uin; /* numerek */ - uint32_t status; /* nowy stan */ -} GG_PACKED; - -#define GG_SEND_MSG 0x000b - -#define GG_CLASS_QUEUED 0x0001 -#define GG_CLASS_OFFLINE GG_CLASS_QUEUED -#define GG_CLASS_MSG 0x0004 -#define GG_CLASS_CHAT 0x0008 -#define GG_CLASS_CTCP 0x0010 -#define GG_CLASS_ACK 0x0020 -#define GG_CLASS_EXT GG_CLASS_ACK /* kompatybilno wstecz */ - -#define GG_MSG_MAXSIZE 2000 - -struct gg_send_msg { - uint32_t recipient; - uint32_t seq; - uint32_t msgclass; -} GG_PACKED; - -struct gg_msg_richtext { - uint8_t flag; - uint16_t length; -} GG_PACKED; - -struct gg_msg_richtext_format { - uint16_t position; - uint8_t font; -} GG_PACKED; - -struct gg_msg_richtext_image { - uint16_t unknown1; - uint32_t size; - uint32_t crc32; -} GG_PACKED; - -#define GG_FONT_BOLD 0x01 -#define GG_FONT_ITALIC 0x02 -#define GG_FONT_UNDERLINE 0x04 -#define GG_FONT_COLOR 0x08 -#define GG_FONT_IMAGE 0x80 - -struct gg_msg_richtext_color { - uint8_t red; - uint8_t green; - uint8_t blue; -} GG_PACKED; - -struct gg_msg_recipients { - uint8_t flag; - uint32_t count; -} GG_PACKED; - -struct gg_msg_image_request { - uint8_t flag; - uint32_t size; - uint32_t crc32; -} GG_PACKED; - -struct gg_msg_image_reply { - uint8_t flag; - uint32_t size; - uint32_t crc32; - /* char filename[]; */ - /* char image[]; */ -} GG_PACKED; - -#define GG_SEND_MSG_ACK 0x0005 - -#define GG_ACK_BLOCKED 0x0001 -#define GG_ACK_DELIVERED 0x0002 -#define GG_ACK_QUEUED 0x0003 -#define GG_ACK_MBOXFULL 0x0004 -#define GG_ACK_NOT_DELIVERED 0x0006 - -struct gg_send_msg_ack { - uint32_t status; - uint32_t recipient; - uint32_t seq; -} GG_PACKED; - -#define GG_RECV_MSG 0x000a - -struct gg_recv_msg { - uint32_t sender; - uint32_t seq; - uint32_t time; - uint32_t msgclass; -} GG_PACKED; - -#define GG_PING 0x0008 - -#define GG_PONG 0x0007 - -#define GG_DISCONNECTING 0x000b - -#define GG_USERLIST_REQUEST 0x0016 - -#define GG_USERLIST_PUT 0x00 -#define GG_USERLIST_PUT_MORE 0x01 -#define GG_USERLIST_GET 0x02 - -struct gg_userlist_request { - uint8_t type; -} GG_PACKED; - -#define GG_USERLIST_REPLY 0x0010 - -#define GG_USERLIST_PUT_REPLY 0x00 -#define GG_USERLIST_PUT_MORE_REPLY 0x02 -#define GG_USERLIST_GET_REPLY 0x06 -#define GG_USERLIST_GET_MORE_REPLY 0x04 - -struct gg_userlist_reply { - uint8_t type; -} GG_PACKED; - -/* - * pakiety, stae, struktury dla DCC - */ - -struct gg_dcc_tiny_packet { - uint8_t type; /* rodzaj pakietu */ -} GG_PACKED; - -struct gg_dcc_small_packet { - uint32_t type; /* rodzaj pakietu */ -} GG_PACKED; - -struct gg_dcc_big_packet { - uint32_t type; /* rodzaj pakietu */ - uint32_t dunno1; /* niewiadoma */ - uint32_t dunno2; /* niewiadoma */ -} GG_PACKED; - -/* - * pki co, nie znamy dokadnie protokou. nie wiemy, co czemu odpowiada. - * nazwy s niepowane i tymczasowe. - */ -#define GG_DCC_WANT_FILE 0x0003 /* peer chce plik */ -#define GG_DCC_HAVE_FILE 0x0001 /* wic mu damy */ -#define GG_DCC_HAVE_FILEINFO 0x0003 /* niech ma informacje o pliku */ -#define GG_DCC_GIMME_FILE 0x0006 /* peer jest pewny */ -#define GG_DCC_CATCH_FILE 0x0002 /* wysyamy plik */ - -#define GG_DCC_FILEATTR_READONLY 0x0020 - -#define GG_DCC_TIMEOUT_SEND 1800 /* 30 minut */ -#define GG_DCC_TIMEOUT_GET 1800 /* 30 minut */ -#define GG_DCC_TIMEOUT_FILE_ACK 300 /* 5 minut */ -#define GG_DCC_TIMEOUT_VOICE_ACK 300 /* 5 minut */ - -#ifdef __cplusplus -#ifdef _MSC_VER -#pragma pack(pop) -#endif -} -#endif - -#endif /* __GG_LIBGADU_H */ - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/obsolete.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/obsolete.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/obsolete.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/obsolete.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -/* $Id: obsolete.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2003 Wojtek Kaniewski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -/* - * Plik zawiera deklaracje funkcji, ktre s ju nieaktualne ze wzgldu - * na zmiany w protokole, ale s wymagane przez aplikacje linkowane ze - * starszymi wersjami bibliotek. - */ - -#include - -#include "libgadu.h" - -struct gg_http *gg_userlist_get(uin_t uin, const char *passwd, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_userlist_get() is obsolete. use gg_userlist_request() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_userlist_get_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_userlist_get_free(struct gg_http *h) -{ - -} - -struct gg_http *gg_userlist_put(uin_t uin, const char *password, const char *contacts, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_userlist_put() is obsolete. use gg_userlist_request() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_userlist_put_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_userlist_put_free(struct gg_http *h) -{ - -} - -struct gg_http *gg_userlist_remove(uin_t uin, const char *passwd, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_userlist_remove() is obsolete. use gg_userlist_request() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_userlist_remove_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_userlist_remove_free(struct gg_http *h) -{ - -} - -struct gg_http *gg_search(const struct gg_search_request *r, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_search() is obsolete. use gg_search50() instead!\n"); - errno = EINVAL; - return NULL; -} - -int gg_search_watch_fd(struct gg_http *h) -{ - errno = EINVAL; - return -1; -} - -void gg_search_free(struct gg_http *h) -{ - -} - -const struct gg_search_request *gg_search_request_mode_0(char *nickname, char *first_name, char *last_name, char *city, int gender, int min_birth, int max_birth, int active, int start) -{ - return NULL; -} - -const struct gg_search_request *gg_search_request_mode_1(char *email, int active, int start) -{ - return NULL; -} - -const struct gg_search_request *gg_search_request_mode_2(char *phone, int active, int start) -{ - return NULL; -} - -const struct gg_search_request *gg_search_request_mode_3(uin_t uin, int active, int start) -{ - return NULL; -} - -void gg_search_request_free(struct gg_search_request *r) -{ - -} - -struct gg_http *gg_register(const char *email, const char *password, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_register() is obsolete. use gg_register3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_register2(const char *email, const char *password, const char *qa, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_register2() is obsolete. use gg_register3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_unregister(uin_t uin, const char *password, const char *email, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_unregister() is obsolete. use gg_unregister3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_unregister2(uin_t uin, const char *password, const char *qa, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_unregister2() is obsolete. use gg_unregister3() instead!\n"); - errno = EINVAL; - return NULL; -} - - -struct gg_http *gg_change_passwd(uin_t uin, const char *passwd, const char *newpasswd, const char *newemail, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_passwd() is obsolete. use gg_change_passwd4() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_change_passwd2(uin_t uin, const char *passwd, const char *newpasswd, const char *email, const char *newemail, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_passwd2() is obsolete. use gg_change_passwd4() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_change_passwd3(uin_t uin, const char *passwd, const char *newpasswd, const char *qa, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_passwd3() is obsolete. use gg_change_passwd4() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_remind_passwd(uin_t uin, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_remind_passwd() is obsolete. use gg_remind_passwd3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_remind_passwd2(uin_t uin, const char *tokenid, const char *tokenval, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_remind_passwd2() is obsolete. use gg_remind_passwd3() instead!\n"); - errno = EINVAL; - return NULL; -} - -struct gg_http *gg_change_info(uin_t uin, const char *passwd, const struct gg_change_info_request *request, int async) -{ - gg_debug(GG_DEBUG_MISC, "// gg_change_info() is obsolete. use gg_pubdir50() instead\n"); - errno = EINVAL; - return NULL; -} - -struct gg_change_info_request *gg_change_info_request_new(const char *first_name, const char *last_name, const char *nickname, const char *email, int born, int gender, const char *city) -{ - return NULL; -} - -void gg_change_info_request_free(struct gg_change_info_request *r) -{ - -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir50.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir50.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir50.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir50.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,467 +0,0 @@ -/* $Id: pubdir50.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2003 Wojtek Kaniewski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#include -#include -#include -#include - -/* - * gg_pubdir50_new() - * - * tworzy now zmienn typu gg_pubdir50_t. - * - * zaalokowana zmienna lub NULL w przypadku braku pamici. - */ -gg_pubdir50_t gg_pubdir50_new(int type) -{ - gg_pubdir50_t res = malloc(sizeof(struct gg_pubdir50_s)); - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_new(%d);\n", type); - - if (!res) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_new() out of memory\n"); - return NULL; - } - - memset(res, 0, sizeof(struct gg_pubdir50_s)); - - res->type = type; - - return res; -} - -/* - * gg_pubdir50_add_n() // funkcja wewntrzna - * - * funkcja dodaje lub zastpuje istniejce pole do zapytania lub odpowiedzi. - * - * - req - wskanik opisu zapytania, - * - num - numer wyniku (0 dla zapytania), - * - field - nazwa pola, - * - value - warto pola, - * - * 0/-1 - */ -static int gg_pubdir50_add_n(gg_pubdir50_t req, int num, const char *field, const char *value) -{ - struct gg_pubdir50_entry *tmp = NULL, *entry; - char *dupfield, *dupvalue; - int i; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_add_n(%p, %d, \"%s\", \"%s\");\n", req, num, field, value); - - if (!(dupvalue = strdup(value))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); - return -1; - } - - for (i = 0; i < req->entries_count; i++) { - if (req->entries[i].num != num || strcmp(req->entries[i].field, field)) - continue; - - free(req->entries[i].value); - req->entries[i].value = dupvalue; - - return 0; - } - - if (!(dupfield = strdup(field))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); - free(dupvalue); - return -1; - } - - if (!(tmp = realloc(req->entries, sizeof(struct gg_pubdir50_entry) * (req->entries_count + 1)))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); - free(dupfield); - free(dupvalue); - return -1; - } - - req->entries = tmp; - - entry = &req->entries[req->entries_count]; - entry->num = num; - entry->field = dupfield; - entry->value = dupvalue; - - req->entries_count++; - - return 0; -} - -/* - * gg_pubdir50_add() - * - * funkcja dodaje pole do zapytania. - * - * - req - wskanik opisu zapytania, - * - field - nazwa pola, - * - value - warto pola, - * - * 0/-1 - */ -int gg_pubdir50_add(gg_pubdir50_t req, const char *field, const char *value) -{ - return gg_pubdir50_add_n(req, 0, field, value); -} - -/* - * gg_pubdir50_seq_set() - * - * ustawia numer sekwencyjny zapytania. - * - * - req - zapytanie, - * - seq - nowy numer sekwencyjny. - * - * 0/-1. - */ -int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq) -{ - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_seq_set(%p, %d);\n", req, seq); - - if (!req) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_seq_set() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - req->seq = seq; - - return 0; -} - -/* - * gg_pubdir50_free() - * - * zwalnia pami po zapytaniu lub rezultacie szukania uytkownika. - * - * - s - zwalniana zmienna, - */ -void gg_pubdir50_free(gg_pubdir50_t s) -{ - int i; - - if (!s) - return; - - for (i = 0; i < s->entries_count; i++) { - free(s->entries[i].field); - free(s->entries[i].value); - } - - free(s->entries); - free(s); -} - -/* - * gg_pubdir50() - * - * wysya zapytanie katalogu publicznego do serwera. - * - * - sess - sesja, - * - req - zapytanie. - * - * numer sekwencyjny wyszukiwania lub 0 w przypadku bdu. - */ -uint32_t gg_pubdir50(struct gg_session *sess, gg_pubdir50_t req) -{ - int i, size = 5; - uint32_t res; - char *buf, *p; - struct gg_pubdir50_request *r; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50(%p, %p);\n", sess, req); - - if (!sess || !req) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50() invalid arguments\n"); - errno = EFAULT; - return 0; - } - - if (sess->state != GG_STATE_CONNECTED) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50() not connected\n"); - errno = ENOTCONN; - return 0; - } - - for (i = 0; i < req->entries_count; i++) { - /* wyszukiwanie bierze tylko pierwszy wpis */ - if (req->entries[i].num) - continue; - - size += strlen(req->entries[i].field) + 1; - size += strlen(req->entries[i].value) + 1; - } - - if (!(buf = malloc(size))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50() out of memory (%d bytes)\n", size); - return 0; - } - - r = (struct gg_pubdir50_request*) buf; - res = time(NULL); - r->type = req->type; - r->seq = (req->seq) ? gg_fix32(req->seq) : gg_fix32(time(NULL)); - req->seq = gg_fix32(r->seq); - - for (i = 0, p = buf + 5; i < req->entries_count; i++) { - if (req->entries[i].num) - continue; - - strcpy(p, req->entries[i].field); - p += strlen(p) + 1; - - strcpy(p, req->entries[i].value); - p += strlen(p) + 1; - } - - if (gg_send_packet(sess, GG_PUBDIR50_REQUEST, buf, size, NULL, 0) == -1) - res = 0; - - free(buf); - - return res; -} - -/* - * gg_pubdir50_handle_reply() // funkcja wewntrzna - * - * analizuje przychodzcy pakiet odpowiedzi i zapisuje wynik w struct gg_event. - * - * - e - opis zdarzenia - * - packet - zawarto pakietu odpowiedzi - * - length - dugo pakietu odpowiedzi - * - * 0/-1 - */ -int gg_pubdir50_handle_reply(struct gg_event *e, const char *packet, int length) -{ - const char *end = packet + length, *p; - struct gg_pubdir50_reply *r = (struct gg_pubdir50_reply*) packet; - gg_pubdir50_t res; - int num = 0; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_handle_reply(%p, %p, %d);\n", e, packet, length); - - if (!e || !packet) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() invalid arguments\n"); - errno = EFAULT; - return -1; - } - - if (length < 5) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() packet too short\n"); - errno = EINVAL; - return -1; - } - - if (!(res = gg_pubdir50_new(r->type))) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() unable to allocate reply\n"); - return -1; - } - - e->event.pubdir50 = res; - - res->seq = gg_fix32(r->seq); - - switch (res->type) { - case GG_PUBDIR50_READ: - e->type = GG_EVENT_PUBDIR50_READ; - break; - - case GG_PUBDIR50_WRITE: - e->type = GG_EVENT_PUBDIR50_WRITE; - break; - - default: - e->type = GG_EVENT_PUBDIR50_SEARCH_REPLY; - break; - } - - /* brak wynikw? */ - if (length == 5) - return 0; - - /* pomi pocztek odpowiedzi */ - p = packet + 5; - - while (p < end) { - const char *field, *value; - - field = p; - - /* sprawd, czy nie mamy podziau na kolejne pole */ - if (!*field) { - num++; - field++; - } - - value = NULL; - - for (p = field; p < end; p++) { - /* jeli mamy koniec tekstu... */ - if (!*p) { - /* ...i jeszcze nie mielimy wartoci pola to - * wiemy, e po tym zerze jest warto... */ - if (!value) - value = p + 1; - else - /* ...w przeciwym wypadku koniec - * wartoci i moemy wychodzi - * grzecznie z ptli */ - break; - } - } - - /* sprawdmy, czy pole nie wychodzi poza pakiet, eby nie - * mie segfaultw, jeli serwer przestanie zakacza pakietw - * przez \0 */ - - if (p == end) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() premature end of packet\n"); - goto failure; - } - - p++; - - /* jeli dostalimy namier na nastpne wyniki, to znaczy e - * mamy koniec wynikw i nie jest to kolejna osoba. */ - if (!strcasecmp(field, "nextstart")) { - res->next = atoi(value); - num--; - } else { - if (gg_pubdir50_add_n(res, num, field, value) == -1) - goto failure; - } - } - - res->count = num + 1; - - return 0; - -failure: - gg_pubdir50_free(res); - return -1; -} - -/* - * gg_pubdir50_get() - * - * pobiera informacj z rezultatu wyszukiwania. - * - * - res - rezultat wyszukiwania, - * - num - numer odpowiedzi, - * - field - nazwa pola (wielko liter nie ma znaczenia). - * - * warto pola lub NULL, jeli nie znaleziono. - */ -const char *gg_pubdir50_get(gg_pubdir50_t res, int num, const char *field) -{ - char *value = NULL; - int i; - - gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_get(%p, %d, \"%s\");\n", res, num, field); - - if (!res || num < 0 || !field) { - gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_get() invalid arguments\n"); - errno = EINVAL; - return NULL; - } - - for (i = 0; i < res->entries_count; i++) { - if (res->entries[i].num == num && !strcasecmp(res->entries[i].field, field)) { - value = res->entries[i].value; - break; - } - } - - return value; -} - -/* - * gg_pubdir50_count() - * - * zwraca ilo wynikw danego zapytania. - * - * - res - odpowied - * - * ilo lub -1 w przypadku bdu. - */ -int gg_pubdir50_count(gg_pubdir50_t res) -{ - return (!res) ? -1 : res->count; -} - -/* - * gg_pubdir50_type() - * - * zwraca rodzaj zapytania lub odpowiedzi. - * - * - res - zapytanie lub odpowied - * - * ilo lub -1 w przypadku bdu. - */ -int gg_pubdir50_type(gg_pubdir50_t res) -{ - return (!res) ? -1 : res->type; -} - -/* - * gg_pubdir50_next() - * - * zwraca numer, od ktrego naley rozpocz kolejne wyszukiwanie, jeli - * zaley nam na kolejnych wynikach. - * - * - res - odpowied - * - * numer lub -1 w przypadku bdu. - */ -uin_t gg_pubdir50_next(gg_pubdir50_t res) -{ - return (!res) ? (unsigned) -1 : res->next; -} - -/* - * gg_pubdir50_seq() - * - * zwraca numer sekwencyjny zapytania lub odpowiedzi. - * - * - res - zapytanie lub odpowied - * - * numer lub -1 w przypadku bdu. - */ -uint32_t gg_pubdir50_seq(gg_pubdir50_t res) -{ - return (!res) ? (unsigned) -1 : res->seq; -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/lib/pubdir.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,684 +0,0 @@ -/* $Id: pubdir.c 16856 2006-08-19 01:13:25Z evands $ */ - -/* - * (C) Copyright 2001-2002 Wojtek Kaniewski - * Dawid Jarosz - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License Version - * 2.1 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - * USA. - */ - -#include "libgadu.h" - -#include -#include -#include -#include -#include -#include -#include - -/* - * gg_register3() - * - * rozpoczyna rejestracj uytkownika protokoem GG 6.0. wymaga wczeniejszego - * pobrania tokenu za pomoc funkcji gg_token(). - * - * - email - adres e-mail klienta - * - password - haso klienta - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - async - poczenie asynchroniczne - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_register_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_register3(const char *email, const char *password, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *__pwd, *__email, *__tokenid, *__tokenval, *form, *query; - - if (!email || !password || !tokenid || !tokenval) { - gg_debug(GG_DEBUG_MISC, "=> register, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __pwd = gg_urlencode(password); - __email = gg_urlencode(email); - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - - if (!__pwd || !__email || !__tokenid || !__tokenval) { - gg_debug(GG_DEBUG_MISC, "=> register, not enough memory for form fields\n"); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - return NULL; - } - - form = gg_saprintf("pwd=%s&email=%s&tokenid=%s&tokenval=%s&code=%u", - __pwd, __email, __tokenid, __tokenval, - gg_http_hash("ss", email, password)); - - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - - if (!form) { - gg_debug(GG_DEBUG_MISC, "=> register, not enough memory for form query\n"); - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> register, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> register, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/fmregister3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> register, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_REGISTER; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_unregister3() - * - * usuwa konto uytkownika z serwera protokoem GG 6.0 - * - * - uin - numerek GG - * - password - haso klienta - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - async - poczenie asynchroniczne - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_unregister_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_unregister3(uin_t uin, const char *password, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *__fmpwd, *__pwd, *__tokenid, *__tokenval, *form, *query; - - if (!password || !tokenid || !tokenval) { - gg_debug(GG_DEBUG_MISC, "=> unregister, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __pwd = gg_saprintf("%ld", random()); - __fmpwd = gg_urlencode(password); - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - - if (!__fmpwd || !__pwd || !__tokenid || !__tokenval) { - gg_debug(GG_DEBUG_MISC, "=> unregister, not enough memory for form fields\n"); - free(__pwd); - free(__fmpwd); - free(__tokenid); - free(__tokenval); - return NULL; - } - - form = gg_saprintf("fmnumber=%d&fmpwd=%s&delete=1&pwd=%s&email=deletedaccount@gadu-gadu.pl&tokenid=%s&tokenval=%s&code=%u", uin, __fmpwd, __pwd, __tokenid, __tokenval, gg_http_hash("ss", "deletedaccount@gadu-gadu.pl", __pwd)); - - free(__fmpwd); - free(__pwd); - free(__tokenid); - free(__tokenval); - - if (!form) { - gg_debug(GG_DEBUG_MISC, "=> unregister, not enough memory for form query\n"); - return NULL; - } - - gg_debug(GG_DEBUG_MISC, "=> unregister, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> unregister, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/fmregister3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> unregister, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_UNREGISTER; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_change_passwd4() - * - * wysya danie zmiany hasa zgodnie z protokoem GG 6.0. wymaga - * wczeniejszego pobrania tokenu za pomoc funkcji gg_token(). - * - * - uin - numer - * - email - adres e-mail - * - passwd - stare haso - * - newpasswd - nowe haso - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - async - poczenie asynchroniczne - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_change_passwd_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_change_passwd4(uin_t uin, const char *email, const char *passwd, const char *newpasswd, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *form, *query, *__email, *__fmpwd, *__pwd, *__tokenid, *__tokenval; - - if (!uin || !email || !passwd || !newpasswd || !tokenid || !tokenval) { - gg_debug(GG_DEBUG_MISC, "=> change, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __fmpwd = gg_urlencode(passwd); - __pwd = gg_urlencode(newpasswd); - __email = gg_urlencode(email); - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - - if (!__fmpwd || !__pwd || !__email || !__tokenid || !__tokenval) { - gg_debug(GG_DEBUG_MISC, "=> change, not enough memory for form fields\n"); - free(__fmpwd); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - return NULL; - } - - if (!(form = gg_saprintf("fmnumber=%d&fmpwd=%s&pwd=%s&email=%s&tokenid=%s&tokenval=%s&code=%u", uin, __fmpwd, __pwd, __email, __tokenid, __tokenval, gg_http_hash("ss", email, newpasswd)))) { - gg_debug(GG_DEBUG_MISC, "=> change, not enough memory for form fields\n"); - free(__fmpwd); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - - return NULL; - } - - free(__fmpwd); - free(__pwd); - free(__email); - free(__tokenid); - free(__tokenval); - - gg_debug(GG_DEBUG_MISC, "=> change, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> change, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/fmregister3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> change, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_PASSWD; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_remind_passwd3() - * - * wysya danie przypomnienia hasa e-mailem. - * - * - uin - numer - * - email - adres e-mail taki, jak ten zapisany na serwerze - * - async - poczenie asynchroniczne - * - tokenid - identyfikator tokenu - * - tokenval - warto tokenu - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_remind_passwd_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_remind_passwd3(uin_t uin, const char *email, const char *tokenid, const char *tokenval, int async) -{ - struct gg_http *h; - char *form, *query, *__tokenid, *__tokenval, *__email; - - if (!tokenid || !tokenval || !email) { - gg_debug(GG_DEBUG_MISC, "=> remind, NULL parameter\n"); - errno = EFAULT; - return NULL; - } - - __tokenid = gg_urlencode(tokenid); - __tokenval = gg_urlencode(tokenval); - __email = gg_urlencode(email); - - if (!__tokenid || !__tokenval || !__email) { - gg_debug(GG_DEBUG_MISC, "=> remind, not enough memory for form fields\n"); - free(__tokenid); - free(__tokenval); - free(__email); - return NULL; - } - - if (!(form = gg_saprintf("userid=%d&code=%u&tokenid=%s&tokenval=%s&email=%s", uin, gg_http_hash("u", uin), __tokenid, __tokenval, __email))) { - gg_debug(GG_DEBUG_MISC, "=> remind, not enough memory for form fields\n"); - free(__tokenid); - free(__tokenval); - free(__email); - return NULL; - } - - free(__tokenid); - free(__tokenval); - free(__email); - - gg_debug(GG_DEBUG_MISC, "=> remind, %s\n", form); - - query = gg_saprintf( - "Host: " GG_REMIND_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: %d\r\n" - "Pragma: no-cache\r\n" - "\r\n" - "%s", - (int) strlen(form), form); - - free(form); - - if (!query) { - gg_debug(GG_DEBUG_MISC, "=> remind, not enough memory for query\n"); - return NULL; - } - - if (!(h = gg_http_connect(GG_REMIND_HOST, GG_REMIND_PORT, async, "POST", "/appsvc/fmsendpwd3.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> remind, gg_http_connect() failed mysteriously\n"); - free(query); - return NULL; - } - - h->type = GG_SESSION_REMIND; - - free(query); - - h->callback = gg_pubdir_watch_fd; - h->destroy = gg_pubdir_free; - - if (!async) - gg_pubdir_watch_fd(h); - - return h; -} - -/* - * gg_pubdir_watch_fd() - * - * przy asynchronicznych operacjach na katalogu publicznym naley wywoywa - * t funkcj przy zmianach na obserwowanym deskryptorze. - * - * - h - struktura opisujca poczenie - * - * jeli wszystko poszo dobrze to 0, inaczej -1. operacja bdzie - * zakoczona, jeli h->state == GG_STATE_DONE. jeli wystpi jaki - * bd, to bdzie tam GG_STATE_ERROR i odpowiedni kod bdu w h->error. - */ -int gg_pubdir_watch_fd(struct gg_http *h) -{ - struct gg_pubdir *p; - char *tmp; - - if (!h) { - errno = EFAULT; - return -1; - } - - if (h->state == GG_STATE_ERROR) { - gg_debug(GG_DEBUG_MISC, "=> pubdir, watch_fd issued on failed session\n"); - errno = EINVAL; - return -1; - } - - if (h->state != GG_STATE_PARSING) { - if (gg_http_watch_fd(h) == -1) { - gg_debug(GG_DEBUG_MISC, "=> pubdir, http failure\n"); - errno = EINVAL; - return -1; - } - } - - if (h->state != GG_STATE_PARSING) - return 0; - - h->state = GG_STATE_DONE; - - if (!(h->data = p = malloc(sizeof(struct gg_pubdir)))) { - gg_debug(GG_DEBUG_MISC, "=> pubdir, not enough memory for results\n"); - return -1; - } - - p->success = 0; - p->uin = 0; - - gg_debug(GG_DEBUG_MISC, "=> pubdir, let's parse \"%s\"\n", h->body); - - if ((tmp = strstr(h->body, "success")) || (tmp = strstr(h->body, "results"))) { - p->success = 1; - if (tmp[7] == ':') - p->uin = strtol(tmp + 8, NULL, 0); - gg_debug(GG_DEBUG_MISC, "=> pubdir, success (uin=%d)\n", p->uin); - } else - gg_debug(GG_DEBUG_MISC, "=> pubdir, error.\n"); - - return 0; -} - -/* - * gg_pubdir_free() - * - * zwalnia pami po efektach operacji na katalogu publicznym. - * - * - h - zwalniana struktura - */ -void gg_pubdir_free(struct gg_http *h) -{ - if (!h) - return; - - free(h->data); - gg_http_free(h); -} - -/* - * gg_token() - * - * pobiera z serwera token do autoryzacji zakadania konta, usuwania - * konta i zmiany hasa. - * - * zaalokowana struct gg_http, ktr poniej naley zwolni - * funkcj gg_token_free(), albo NULL jeli wystpi bd. - */ -struct gg_http *gg_token(int async) -{ - struct gg_http *h; - const char *query; - - query = "Host: " GG_REGISTER_HOST "\r\n" - "Content-Type: application/x-www-form-urlencoded\r\n" - "User-Agent: " GG_HTTP_USERAGENT "\r\n" - "Content-Length: 0\r\n" - "Pragma: no-cache\r\n" - "\r\n"; - - if (!(h = gg_http_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, async, "POST", "/appsvc/regtoken.asp", query))) { - gg_debug(GG_DEBUG_MISC, "=> token, gg_http_connect() failed mysteriously\n"); - return NULL; - } - - h->type = GG_SESSION_TOKEN; - - h->callback = gg_token_watch_fd; - h->destroy = gg_token_free; - - if (!async) - gg_token_watch_fd(h); - - return h; -} - -/* - * gg_token_watch_fd() - * - * przy asynchronicznych operacjach zwizanych z tokenem naley wywoywa - * t funkcj przy zmianach na obserwowanym deskryptorze. - * - * - h - struktura opisujca poczenie - * - * jeli wszystko poszo dobrze to 0, inaczej -1. operacja bdzie - * zakoczona, jeli h->state == GG_STATE_DONE. jeli wystpi jaki - * bd, to bdzie tam GG_STATE_ERROR i odpowiedni kod bdu w h->error. - */ -int gg_token_watch_fd(struct gg_http *h) -{ - if (!h) { - errno = EFAULT; - return -1; - } - - if (h->state == GG_STATE_ERROR) { - gg_debug(GG_DEBUG_MISC, "=> token, watch_fd issued on failed session\n"); - errno = EINVAL; - return -1; - } - - if (h->state != GG_STATE_PARSING) { - if (gg_http_watch_fd(h) == -1) { - gg_debug(GG_DEBUG_MISC, "=> token, http failure\n"); - errno = EINVAL; - return -1; - } - } - - if (h->state != GG_STATE_PARSING) - return 0; - - /* jeli h->data jest puste, to cigalimy tokenid i url do niego, - * ale jeli co tam jest, to znaczy, e mamy drugi etap polegajcy - * na pobieraniu tokenu. */ - if (!h->data) { - int width, height, length; - char *url = NULL, *tokenid = NULL, *path, *headers; - const char *host; - struct gg_http *h2; - struct gg_token *t; - - gg_debug(GG_DEBUG_MISC, "=> token body \"%s\"\n", h->body); - - if (h->body && (!(url = malloc(strlen(h->body))) || !(tokenid = malloc(strlen(h->body))))) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for results\n"); - free(url); - return -1; - } - - if (!h->body || sscanf(h->body, "%d %d %d\r\n%s\r\n%s", &width, &height, &length, tokenid, url) != 5) { - gg_debug(GG_DEBUG_MISC, "=> token, parsing failed\n"); - free(url); - free(tokenid); - errno = EINVAL; - return -1; - } - - /* dostalimy tokenid i wszystkie niezbdne informacje, - * wic pobierzmy obrazek z tokenem */ - - if (strncmp(url, "http://", 7)) { - path = gg_saprintf("%s?tokenid=%s", url, tokenid); - host = GG_REGISTER_HOST; - } else { - char *slash = strchr(url + 7, '/'); - - if (slash) { - path = gg_saprintf("%s?tokenid=%s", slash, tokenid); - *slash = 0; - host = url + 7; - } else { - gg_debug(GG_DEBUG_MISC, "=> token, url parsing failed\n"); - free(url); - free(tokenid); - errno = EINVAL; - return -1; - } - } - - if (!path) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token url\n"); - free(url); - free(tokenid); - return -1; - } - - if (!(headers = gg_saprintf("Host: %s\r\nUser-Agent: " GG_HTTP_USERAGENT "\r\n\r\n", host))) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token url\n"); - free(path); - free(url); - free(tokenid); - return -1; - } - - if (!(h2 = gg_http_connect(host, GG_REGISTER_PORT, h->async, "GET", path, headers))) { - gg_debug(GG_DEBUG_MISC, "=> token, gg_http_connect() failed mysteriously\n"); - free(headers); - free(url); - free(path); - free(tokenid); - return -1; - } - - free(headers); - free(path); - free(url); - - memcpy(h, h2, sizeof(struct gg_http)); - free(h2); - - h->type = GG_SESSION_TOKEN; - - h->callback = gg_token_watch_fd; - h->destroy = gg_token_free; - - if (!h->async) - gg_token_watch_fd(h); - - if (!(h->data = t = malloc(sizeof(struct gg_token)))) { - gg_debug(GG_DEBUG_MISC, "=> token, not enough memory for token data\n"); - free(tokenid); - return -1; - } - - t->width = width; - t->height = height; - t->length = length; - t->tokenid = tokenid; - } else { - /* obrazek mamy w h->body */ - h->state = GG_STATE_DONE; - } - - return 0; -} - -/* - * gg_token_free() - * - * zwalnia pami po efektach pobierania tokenu. - * - * - h - zwalniana struktura - */ -void gg_token_free(struct gg_http *h) -{ - struct gg_token *t; - - if (!h) - return; - - if ((t = h->data)) - free(t->tokenid); - - free(h->data); - gg_http_free(h); -} - -/* - * Local variables: - * c-indentation-style: k&r - * c-basic-offset: 8 - * indent-tabs-mode: notnil - * End: - * - * vim: shiftwidth=8: - */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - lib/common.c \ - lib/compat.h \ - lib/COPYING \ - lib/dcc.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/libgadu-config.h \ - lib/libgadu.h \ - lib/obsolete.c \ - lib/pubdir50.c \ - lib/pubdir.c - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -if USE_INTERNAL_LIBGADU -INTGGSOURCES = \ - lib/common.c \ - lib/compat.h \ - lib/dcc.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/libgadu-config.h \ - lib/libgadu.h \ - lib/obsolete.c \ - lib/pubdir50.c \ - lib/pubdir.c - -INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib -endif - -GGSOURCES = \ - $(INTGGSOURCES) \ - gg-utils.h \ - gg-utils.c \ - confer.h \ - confer.c \ - search.h \ - search.c \ - buddylist.h \ - buddylist.c \ - gg.h \ - gg.c - -AM_CFLAGS = $(st) - -libgg_la_LDFLAGS = -module -avoid-version - -if STATIC_GG - -st = -DPURPLE_STATIC_PRPL $(GADU_CFLAGS) -noinst_LTLIBRARIES = libgg.la -libgg_la_SOURCES = $(GGSOURCES) -libgg_la_CFLAGS = $(AM_CFLAGS) -libgg_la_LIBADD = $(GADU_LIBS) - -else - -st = $(GADU_CFLAGS) -pkg_LTLIBRARIES = libgg.la -libgg_la_SOURCES = $(GGSOURCES) -libgg_la_LIBADD = $(GLIB_LIBS) $(GADU_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(INTGG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,889 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/gg -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_GG_FALSE@libgg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@STATIC_GG_FALSE@ $(am__DEPENDENCIES_1) -@STATIC_GG_TRUE@libgg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libgg_la_SOURCES_DIST = lib/common.c lib/compat.h lib/dcc.c \ - lib/events.c lib/http.c lib/libgadu.c lib/libgadu-config.h \ - lib/libgadu.h lib/obsolete.c lib/pubdir50.c lib/pubdir.c \ - gg-utils.h gg-utils.c confer.h confer.c search.h search.c \ - buddylist.h buddylist.c gg.h gg.c -@USE_INTERNAL_LIBGADU_TRUE@am__objects_1 = libgg_la-common.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-dcc.lo libgg_la-events.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-http.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-libgadu.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-obsolete.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-pubdir50.lo \ -@USE_INTERNAL_LIBGADU_TRUE@ libgg_la-pubdir.lo -am__objects_2 = $(am__objects_1) libgg_la-gg-utils.lo \ - libgg_la-confer.lo libgg_la-search.lo libgg_la-buddylist.lo \ - libgg_la-gg.lo -@STATIC_GG_FALSE@am_libgg_la_OBJECTS = $(am__objects_2) -@STATIC_GG_TRUE@am_libgg_la_OBJECTS = $(am__objects_2) -libgg_la_OBJECTS = $(am_libgg_la_OBJECTS) -@STATIC_GG_FALSE@am_libgg_la_rpath = -rpath $(pkgdir) -@STATIC_GG_TRUE@am_libgg_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libgg_la_SOURCES) -DIST_SOURCES = $(am__libgg_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - lib/common.c \ - lib/compat.h \ - lib/COPYING \ - lib/dcc.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/libgadu-config.h \ - lib/libgadu.h \ - lib/obsolete.c \ - lib/pubdir50.c \ - lib/pubdir.c - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -@USE_INTERNAL_LIBGADU_TRUE@INTGGSOURCES = \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/common.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/compat.h \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/dcc.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/events.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/http.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/libgadu.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/libgadu-config.h \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/libgadu.h \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/obsolete.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/pubdir50.c \ -@USE_INTERNAL_LIBGADU_TRUE@ lib/pubdir.c - -@USE_INTERNAL_LIBGADU_TRUE@INTGG_CFLAGS = -I$(top_srcdir)/libpurple/protocols/gg/lib -GGSOURCES = \ - $(INTGGSOURCES) \ - gg-utils.h \ - gg-utils.c \ - confer.h \ - confer.c \ - search.h \ - search.c \ - buddylist.h \ - buddylist.c \ - gg.h \ - gg.c - -AM_CFLAGS = $(st) -libgg_la_LDFLAGS = -module -avoid-version -@STATIC_GG_FALSE@st = $(GADU_CFLAGS) -@STATIC_GG_TRUE@st = -DPURPLE_STATIC_PRPL $(GADU_CFLAGS) -@STATIC_GG_TRUE@noinst_LTLIBRARIES = libgg.la -@STATIC_GG_FALSE@libgg_la_SOURCES = $(GGSOURCES) -@STATIC_GG_TRUE@libgg_la_SOURCES = $(GGSOURCES) -@STATIC_GG_TRUE@libgg_la_CFLAGS = $(AM_CFLAGS) -@STATIC_GG_FALSE@libgg_la_LIBADD = $(GLIB_LIBS) $(GADU_LIBS) -@STATIC_GG_TRUE@libgg_la_LIBADD = $(GADU_LIBS) -@STATIC_GG_FALSE@pkg_LTLIBRARIES = libgg.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(INTGG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/gg/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/gg/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libgg.la: $(libgg_la_OBJECTS) $(libgg_la_DEPENDENCIES) - $(LINK) $(am_libgg_la_rpath) $(libgg_la_LDFLAGS) $(libgg_la_OBJECTS) $(libgg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-buddylist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-confer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-dcc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-events.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-gg-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-gg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-http.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-libgadu.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-obsolete.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-pubdir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-pubdir50.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgg_la-search.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libgg_la-common.lo: lib/common.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-common.lo -MD -MP -MF "$(DEPDIR)/libgg_la-common.Tpo" -c -o libgg_la-common.lo `test -f 'lib/common.c' || echo '$(srcdir)/'`lib/common.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-common.Tpo" "$(DEPDIR)/libgg_la-common.Plo"; else rm -f "$(DEPDIR)/libgg_la-common.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/common.c' object='libgg_la-common.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-common.lo `test -f 'lib/common.c' || echo '$(srcdir)/'`lib/common.c - -libgg_la-dcc.lo: lib/dcc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-dcc.lo -MD -MP -MF "$(DEPDIR)/libgg_la-dcc.Tpo" -c -o libgg_la-dcc.lo `test -f 'lib/dcc.c' || echo '$(srcdir)/'`lib/dcc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-dcc.Tpo" "$(DEPDIR)/libgg_la-dcc.Plo"; else rm -f "$(DEPDIR)/libgg_la-dcc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/dcc.c' object='libgg_la-dcc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-dcc.lo `test -f 'lib/dcc.c' || echo '$(srcdir)/'`lib/dcc.c - -libgg_la-events.lo: lib/events.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-events.lo -MD -MP -MF "$(DEPDIR)/libgg_la-events.Tpo" -c -o libgg_la-events.lo `test -f 'lib/events.c' || echo '$(srcdir)/'`lib/events.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-events.Tpo" "$(DEPDIR)/libgg_la-events.Plo"; else rm -f "$(DEPDIR)/libgg_la-events.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/events.c' object='libgg_la-events.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-events.lo `test -f 'lib/events.c' || echo '$(srcdir)/'`lib/events.c - -libgg_la-http.lo: lib/http.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-http.lo -MD -MP -MF "$(DEPDIR)/libgg_la-http.Tpo" -c -o libgg_la-http.lo `test -f 'lib/http.c' || echo '$(srcdir)/'`lib/http.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-http.Tpo" "$(DEPDIR)/libgg_la-http.Plo"; else rm -f "$(DEPDIR)/libgg_la-http.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/http.c' object='libgg_la-http.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-http.lo `test -f 'lib/http.c' || echo '$(srcdir)/'`lib/http.c - -libgg_la-libgadu.lo: lib/libgadu.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-libgadu.lo -MD -MP -MF "$(DEPDIR)/libgg_la-libgadu.Tpo" -c -o libgg_la-libgadu.lo `test -f 'lib/libgadu.c' || echo '$(srcdir)/'`lib/libgadu.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-libgadu.Tpo" "$(DEPDIR)/libgg_la-libgadu.Plo"; else rm -f "$(DEPDIR)/libgg_la-libgadu.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/libgadu.c' object='libgg_la-libgadu.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-libgadu.lo `test -f 'lib/libgadu.c' || echo '$(srcdir)/'`lib/libgadu.c - -libgg_la-obsolete.lo: lib/obsolete.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-obsolete.lo -MD -MP -MF "$(DEPDIR)/libgg_la-obsolete.Tpo" -c -o libgg_la-obsolete.lo `test -f 'lib/obsolete.c' || echo '$(srcdir)/'`lib/obsolete.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-obsolete.Tpo" "$(DEPDIR)/libgg_la-obsolete.Plo"; else rm -f "$(DEPDIR)/libgg_la-obsolete.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/obsolete.c' object='libgg_la-obsolete.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-obsolete.lo `test -f 'lib/obsolete.c' || echo '$(srcdir)/'`lib/obsolete.c - -libgg_la-pubdir50.lo: lib/pubdir50.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-pubdir50.lo -MD -MP -MF "$(DEPDIR)/libgg_la-pubdir50.Tpo" -c -o libgg_la-pubdir50.lo `test -f 'lib/pubdir50.c' || echo '$(srcdir)/'`lib/pubdir50.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-pubdir50.Tpo" "$(DEPDIR)/libgg_la-pubdir50.Plo"; else rm -f "$(DEPDIR)/libgg_la-pubdir50.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/pubdir50.c' object='libgg_la-pubdir50.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-pubdir50.lo `test -f 'lib/pubdir50.c' || echo '$(srcdir)/'`lib/pubdir50.c - -libgg_la-pubdir.lo: lib/pubdir.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-pubdir.lo -MD -MP -MF "$(DEPDIR)/libgg_la-pubdir.Tpo" -c -o libgg_la-pubdir.lo `test -f 'lib/pubdir.c' || echo '$(srcdir)/'`lib/pubdir.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-pubdir.Tpo" "$(DEPDIR)/libgg_la-pubdir.Plo"; else rm -f "$(DEPDIR)/libgg_la-pubdir.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lib/pubdir.c' object='libgg_la-pubdir.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-pubdir.lo `test -f 'lib/pubdir.c' || echo '$(srcdir)/'`lib/pubdir.c - -libgg_la-gg-utils.lo: gg-utils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-gg-utils.lo -MD -MP -MF "$(DEPDIR)/libgg_la-gg-utils.Tpo" -c -o libgg_la-gg-utils.lo `test -f 'gg-utils.c' || echo '$(srcdir)/'`gg-utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-gg-utils.Tpo" "$(DEPDIR)/libgg_la-gg-utils.Plo"; else rm -f "$(DEPDIR)/libgg_la-gg-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gg-utils.c' object='libgg_la-gg-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-gg-utils.lo `test -f 'gg-utils.c' || echo '$(srcdir)/'`gg-utils.c - -libgg_la-confer.lo: confer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-confer.lo -MD -MP -MF "$(DEPDIR)/libgg_la-confer.Tpo" -c -o libgg_la-confer.lo `test -f 'confer.c' || echo '$(srcdir)/'`confer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-confer.Tpo" "$(DEPDIR)/libgg_la-confer.Plo"; else rm -f "$(DEPDIR)/libgg_la-confer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='confer.c' object='libgg_la-confer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-confer.lo `test -f 'confer.c' || echo '$(srcdir)/'`confer.c - -libgg_la-search.lo: search.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-search.lo -MD -MP -MF "$(DEPDIR)/libgg_la-search.Tpo" -c -o libgg_la-search.lo `test -f 'search.c' || echo '$(srcdir)/'`search.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-search.Tpo" "$(DEPDIR)/libgg_la-search.Plo"; else rm -f "$(DEPDIR)/libgg_la-search.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='search.c' object='libgg_la-search.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-search.lo `test -f 'search.c' || echo '$(srcdir)/'`search.c - -libgg_la-buddylist.lo: buddylist.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-buddylist.lo -MD -MP -MF "$(DEPDIR)/libgg_la-buddylist.Tpo" -c -o libgg_la-buddylist.lo `test -f 'buddylist.c' || echo '$(srcdir)/'`buddylist.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-buddylist.Tpo" "$(DEPDIR)/libgg_la-buddylist.Plo"; else rm -f "$(DEPDIR)/libgg_la-buddylist.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddylist.c' object='libgg_la-buddylist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-buddylist.lo `test -f 'buddylist.c' || echo '$(srcdir)/'`buddylist.c - -libgg_la-gg.lo: gg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -MT libgg_la-gg.lo -MD -MP -MF "$(DEPDIR)/libgg_la-gg.Tpo" -c -o libgg_la-gg.lo `test -f 'gg.c' || echo '$(srcdir)/'`gg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgg_la-gg.Tpo" "$(DEPDIR)/libgg_la-gg.Plo"; else rm -f "$(DEPDIR)/libgg_la-gg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gg.c' object='libgg_la-gg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgg_la_CFLAGS) $(CFLAGS) -c -o libgg_la-gg.lo `test -f 'gg.c' || echo '$(srcdir)/'`gg.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/lib - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libgg -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libgg -CFLAGS += -include win32dep.h -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I./lib \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -## -## SOURCES, OBJECTS -## -C_SRC = \ - lib/common.c \ - lib/events.c \ - lib/http.c \ - lib/libgadu.c \ - lib/obsolete.c \ - lib/pubdir.c \ - lib/pubdir50.c \ - buddylist.c \ - confer.c \ - gg.c \ - search.c \ - gg-utils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lpurple \ - -lws2_32 - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,217 +0,0 @@ -/** - * @file search.c - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include - -#include "gg-utils.h" -#include "search.h" - - -/* GGPSearchForm *ggp_search_form_new() {{{ */ -GGPSearchForm *ggp_search_form_new(GGPSearchType st) -{ - GGPSearchForm *form; - - form = g_new0(GGPSearchForm, 1); - - form->search_type = st; - form->window = NULL; - form->user_data = NULL; - form->seq = 0; - - form->uin = NULL; - form->lastname = NULL; - form->firstname = NULL; - form->nickname = NULL; - form->city = NULL; - form->birthyear = NULL; - form->gender = NULL; - form->active = NULL; - form->offset = NULL; - form->last_uin = NULL; - - return form; -} -/* }}} */ - -/* void ggp_search_form_destroy(GGPSearchForm *form) {{{ */ -void ggp_search_form_destroy(GGPSearchForm *form) -{ - g_return_if_fail(form != NULL); - - form->window = NULL; - form->user_data = NULL; - form->seq = 0; - - g_free(form->uin); - g_free(form->lastname); - g_free(form->firstname); - g_free(form->nickname); - g_free(form->city); - g_free(form->birthyear); - g_free(form->gender); - g_free(form->active); - g_free(form->offset); - g_free(form->last_uin); - g_free(form); -} -/* }}} */ - -/* void ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form) {{{ */ -void ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form) -{ - guint32 *tmp; - - g_return_if_fail(searches != NULL); - g_return_if_fail(form != NULL); - - tmp = g_new0(guint32, 1); - *tmp = seq; - form->seq = seq; - - g_hash_table_insert(searches, tmp, form); -} -/* }}} */ - -/* void ggp_search_remove(GGPSearches *searches, guint32 seq) {{{ */ -void ggp_search_remove(GGPSearches *searches, guint32 seq) -{ - g_return_if_fail(searches != NULL); - - g_hash_table_remove(searches, &seq); -} -/* }}} */ - -/* GGPSearchForm *ggp_search_get(GGPSearches *searches, seq) {{{ */ -GGPSearchForm *ggp_search_get(GGPSearches *searches, guint32 seq) -{ - g_return_val_if_fail(searches != NULL, NULL); - - return g_hash_table_lookup(searches, &seq); -} -/* }}} */ - -/* GGPSearches *ggp_search_new() {{{ */ -GGPSearches *ggp_search_new(void) -{ - GGPSearches *searches; - - searches = g_hash_table_new_full(g_int_hash, g_int_equal, - g_free, NULL); - - return searches; -} -/* }}} */ - -/* void ggp_search_destroy(GGPSearches *searches) {{{ */ -void ggp_search_destroy(GGPSearches *searches) -{ - g_return_if_fail(searches != NULL); - - g_hash_table_destroy(searches); -} -/* }}} */ - -/* guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) {{{ */ -guint32 ggp_search_start(PurpleConnection *gc, GGPSearchForm *form) -{ - GGPInfo *info = gc->proto_data; - gg_pubdir50_t req; - guint seq; - - purple_debug_info("gg", "It's time to perform a search...\n"); - - if ((req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)) == NULL) { - purple_debug_error("gg", - "ggp_bmenu_show_details: Unable to create req variable.\n"); - return 0; - } - - if (form->uin != NULL) { - purple_debug_info("gg", " uin: %s\n", form->uin); - gg_pubdir50_add(req, GG_PUBDIR50_UIN, form->uin); - } else { - if (form->lastname != NULL) { - purple_debug_info("gg", " lastname: %s\n", form->lastname); - gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, form->lastname); - } - - if (form->firstname != NULL) { - purple_debug_info("gg", " firstname: %s\n", form->firstname); - gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, form->firstname); - } - - if (form->nickname != NULL) { - purple_debug_info("gg", " nickname: %s\n", form->nickname); - gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, form->nickname); - } - - if (form->city != NULL) { - purple_debug_info("gg", " city: %s\n", form->city); - gg_pubdir50_add(req, GG_PUBDIR50_CITY, form->city); - } - - if (form->birthyear != NULL) { - purple_debug_info("gg", " birthyear: %s\n", form->birthyear); - gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, form->birthyear); - } - - if (form->gender != NULL) { - purple_debug_info("gg", " gender: %s\n", form->gender); - gg_pubdir50_add(req, GG_PUBDIR50_GENDER, form->gender); - } - - if (form->active != NULL) { - purple_debug_info("gg", " active: %s\n", form->active); - gg_pubdir50_add(req, GG_PUBDIR50_ACTIVE, form->active); - } - } - - purple_debug_info("gg", "offset: %s\n", form->offset); - gg_pubdir50_add(req, GG_PUBDIR50_START, g_strdup(form->offset)); - - if ((seq = gg_pubdir50(info->session, req)) == 0) { - purple_debug_warning("gg", "ggp_bmenu_show_details: Search failed.\n"); - return 0; - } - - purple_debug_info("gg", "search sequence number: %d\n", seq); - gg_pubdir50_free(req); - - return seq; -} -/* }}} */ - -/* char *ggp_search_get_result(gg_pubdir50_t res, int num, const char *field) {{{ */ -char *ggp_search_get_result(gg_pubdir50_t res, int num, const char *field) -{ - char *tmp; - - tmp = charset_convert(gg_pubdir50_get(res, num, field), "CP1250", "UTF-8"); - - return (tmp == NULL) ? g_strdup("") : tmp; -} -/* }}} */ - - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/gg/search.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,153 +0,0 @@ -/** - * @file search.h - * - * purple - * - * Copyright (C) 2005 Bartosz Oler - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _PURPLE_GG_SEARCH_H -#define _PURPLE_GG_SEARCH_H - -#include "connection.h" - -#include -#include "gg.h" - - -typedef enum { - GGP_SEARCH_TYPE_INFO, - GGP_SEARCH_TYPE_FULL - -} GGPSearchType; - -typedef struct { - - char *uin; - char *lastname; - char *firstname; - char *nickname; - char *city; - char *birthyear; - char *gender; - char *active; - char *offset; - - char *last_uin; - - GGPSearchType search_type; - guint32 seq; - - void *user_data; - void *window; -} GGPSearchForm; - -typedef GHashTable GGPSearches; - - -/** - * Create a new GGPSearchForm structure, and set the fields - * to the sane defaults. - * - * @return Newly allocated GGPSearchForm. - */ -GGPSearchForm * -ggp_search_form_new(GGPSearchType st); - -/** - * Destroy a Search Form. - * - * @param form Search Form to destroy. - */ -void -ggp_search_form_destroy(GGPSearchForm *form); - -/** - * Add a search to the list of searches. - * - * @param searches The list of searches. - * @param seq Search (form) ID number. - * @param form The search form to add. - */ -void -ggp_search_add(GGPSearches *searches, guint32 seq, GGPSearchForm *form); - -/** - * Remove a search from the list. - * - * If you want to destory the search completely also call: - * ggp_search_form_destroy(). - * - * @param searches The list of searches. - * @param seq ID number of the search. - */ -void -ggp_search_remove(GGPSearches *searches, guint32 seq); - -/** - * Return the search with the specified ID. - * - * @param searches The list of searches. - * @param seq ID number of the search. - */ -GGPSearchForm * -ggp_search_get(GGPSearches *searches, guint32 seq); - -/** - * Create a new GGPSearches structure. - * - * @return GGPSearches instance. - */ -GGPSearches * -ggp_search_new(void); - -/** - * Destroy GGPSearches instance. - * - * @param searches GGPSearches instance. - */ -void -ggp_search_destroy(GGPSearches *searches); - -/** - * Initiate a search in the public directory. - * - * @param gc PurpleConnection. - * @param form Filled in GGPSearchForm. - * - * @return Sequence number of a search or 0 if an error occurred. - */ -guint32 -ggp_search_start(PurpleConnection *gc, GGPSearchForm *form); - -/* - * Return converted to the UTF-8 value of the specified field. - * - * @param res Public directory look-up result. - * @param num Id of the record. - * @param fileld Name of the field. - * - * @return UTF-8 encoded value of the field. - */ -char * -ggp_search_get_result(gg_pubdir50_t res, int num, const char *field); - - -#endif /* _PURPLE_GG_SEARCH_H */ - -/* vim: set ts=8 sts=0 sw=8 noet: */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/cmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/cmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/cmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/cmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,642 +0,0 @@ -/** - * @file cmds.c - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "util.h" - -#include "irc.h" - - -static void irc_do_mode(struct irc_conn *irc, const char *target, const char *sign, char **ops); - -int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, target, irc->account); - char *buf; - - if (!convo) - return 1; - - buf = g_strdup_printf(_("Unknown command: %s"), cmd); - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_IM) - purple_conv_im_write(PURPLE_CONV_IM(convo), "", buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - return 1; -} - -int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf, *message; - - if (args[0] && strcmp(cmd, "back")) { - message = purple_markup_strip_html(args[0]); - purple_util_chrreplace(message, '\n', ' '); - buf = irc_format(irc, "v:", "AWAY", message); - g_free(message); - } else { - buf = irc_format(irc, "v", "AWAY"); - } - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_ctcp(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - /* we have defined args as args[0] is target and args[1] is ctcp command */ - char *buf; - GString *string; - - /* check if we have args */ - if (!args || !args[0] || !args[1]) - return 0; - - /* TODO:strip newlines or send each line as separate ctcp or something - * actually, this shouldn't be done here but somewhere else since irc should support escaping newlines */ - - string = g_string_new(args[1]); - g_string_prepend_c (string,'\001'); - g_string_append_c (string,'\001'); - buf = irc_format(irc, "vn:", "PRIVMSG", args[0], string->str); - g_string_free(string,TRUE); - - irc_send(irc, buf); - g_free(buf); - - return 1; -} - -int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *action, *escaped, *dst, **newargs; - const char *src; - PurpleConversation *convo; - - if (!args || !args[0] || !gc) - return 0; - - action = g_malloc(strlen(args[0]) + 10); - - sprintf(action, "\001ACTION "); - - src = args[0]; - dst = action + 8; - while (*src) { - if (*src == '\n') { - if (*(src + 1) == '\0') { - break; - } else { - *dst++ = ' '; - src++; - continue; - } - } - *dst++ = *src++; - } - *dst++ = '\001'; - *dst = '\0'; - - newargs = g_new0(char *, 2); - newargs[0] = g_strdup(target); - newargs[1] = action; - irc_cmd_privmsg(irc, cmd, target, (const char **)newargs); - g_free(newargs[0]); - g_free(newargs[1]); - g_free(newargs); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, target, irc->account); - if (convo) { - escaped = g_markup_escape_text(args[0], -1); - action = g_strdup_printf("/me %s", escaped); - g_free(escaped); - if (action[strlen(action) - 1] == '\n') - action[strlen(action) - 1] = '\0'; - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - purple_connection_get_display_name(gc), - PURPLE_MESSAGE_SEND, action, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - action, PURPLE_MESSAGE_SEND, time(NULL)); - g_free(action); - } - - return 1; -} - -int irc_cmd_ctcp_version(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "vn:", "PRIVMSG", args[0], "\001VERSION\001"); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0] || !(args[1] || target)) - return 0; - - buf = irc_format(irc, "vnc", "INVITE", args[0], args[1] ? args[1] : target); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (args[1]) - buf = irc_format(irc, "vcv", "JOIN", args[0], args[1]); - else - buf = irc_format(irc, "vc", "JOIN", args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - PurpleConversation *convo; - - if (!args || !args[0]) - return 0; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, target, irc->account); - if (!convo) - return 0; - - if (args[1]) - buf = irc_format(irc, "vcn:", "KICK", target, args[0], args[1]); - else - buf = irc_format(irc, "vcn", "KICK", target, args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - purple_roomlist_show_with_account(irc->account); - - return 0; -} - -int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConnection *gc; - char *buf; - - if (!args) - return 0; - - if (!strcmp(cmd, "mode")) { - if (!args[0] && irc_ischannel(target)) - buf = irc_format(irc, "vc", "MODE", target); - else if (args[0] && (*args[0] == '+' || *args[0] == '-')) - buf = irc_format(irc, "vcv", "MODE", target, args[0]); - else if (args[0]) - buf = irc_format(irc, "vv", "MODE", args[0]); - else - return 0; - } else if (!strcmp(cmd, "umode")) { - if (!args[0]) - return 0; - gc = purple_account_get_connection(irc->account); - buf = irc_format(irc, "vnv", "MODE", purple_connection_get_display_name(gc), args[0]); - } else { - return 0; - } - - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || (!args[0] && !irc_ischannel(target))) - return 0; - - buf = irc_format(irc, "vc", "NAMES", args[0] ? args[0] : target); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "v:", "NICK", args[0]); - g_free(irc->reqnick); - irc->reqnick = g_strdup(args[0]); - irc->nickused = FALSE; - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char **nicks, **ops, *sign, *mode; - int i = 0, used = 0; - - if (!args || !args[0] || !*args[0]) - return 0; - - if (!strcmp(cmd, "op")) { - sign = "+"; - mode = "o"; - } else if (!strcmp(cmd, "deop")) { - sign = "-"; - mode = "o"; - } else if (!strcmp(cmd, "voice")) { - sign = "+"; - mode = "v"; - } else if (!strcmp(cmd, "devoice")) { - sign = "-"; - mode = "v"; - } else { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid 'op' command '%s'\n", cmd); - return 0; - } - - nicks = g_strsplit(args[0], " ", -1); - - for (i = 0; nicks[i]; i++) - /* nothing */; - ops = g_new0(char *, i * 2 + 1); - - for (i = 0; nicks[i]; i++) { - if (*nicks[i]) { - ops[used++] = mode; - ops[used++] = nicks[i]; - } - } - - irc_do_mode(irc, target, sign, ops); - g_free(ops); - g_strfreev(nicks); - - return 0; -} - -int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args) - return 0; - - if (args[1]) - buf = irc_format(irc, "vc:", "PART", args[0] ? args[0] : target, args[1]); - else - buf = irc_format(irc, "vc", "PART", args[0] ? args[0] : target); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *stamp; - char *buf; - - if (args && args[0]) { - if (irc_ischannel(args[0])) - return 0; - stamp = g_strdup_printf("\001PING %lu\001", time(NULL)); - buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp); - g_free(stamp); - } else if (target) { - stamp = g_strdup_printf("%s %lu", target, time(NULL)); - buf = irc_format(irc, "v:", "PING", stamp); - g_free(stamp); - } else { - stamp = g_strdup_printf("%lu", time(NULL)); - buf = irc_format(irc, "vv", "PING", stamp); - g_free(stamp); - } - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - const char *cur, *end; - char *msg, *buf; - - if (!args || !args[0] || !args[1]) - return 0; - - cur = args[1]; - end = args[1]; - while (*end && *cur) { - end = strchr(cur, '\n'); - if (!end) - end = cur + strlen(cur); - msg = g_strndup(cur, end - cur); - - if(!strcmp(cmd, "notice")) - buf = irc_format(irc, "vt:", "NOTICE", args[0], msg); - else - buf = irc_format(irc, "vt:", "PRIVMSG", args[0], msg); - - irc_send(irc, buf); - g_free(msg); - g_free(buf); - cur = end + 1; - } - - return 0; -} - -int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!irc->quitting) { - /* - * Use purple_account_get_string(irc->account, "quitmsg", IRC_DEFAULT_QUIT) - * and uncomment the appropriate account preference in irc.c if we - * decide we want custom quit messages. - */ - buf = irc_format(irc, "v:", "QUIT", (args && args[0]) ? args[0] : IRC_DEFAULT_QUIT); - irc_send(irc, buf); - g_free(buf); - - irc->quitting = TRUE; - - if (!irc->account->disconnecting) - purple_account_set_status(irc->account, "offline", TRUE, NULL); - } - - return 0; -} - -int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "v", args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - PurpleConversation *convo; - PurpleConnection *gc; - - if (!args || !args[0]) - return 0; - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, irc->account, args[0]); - purple_conversation_present(convo); - - if (args[1]) { - gc = purple_account_get_connection(irc->account); - irc_cmd_privmsg(irc, cmd, target, args); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - return 0; -} - -int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (!irc_ischannel(target)) /* not a channel, punt */ - return 0; - - if (args[1]) - buf = irc_format(irc, "vcn:", "REMOVE", target, args[0], args[1]); - else - buf = irc_format(irc, "vcn", "REMOVE", target, args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_service(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *capital_cmd, *buf; - - if (!args || !args[0]) - return 0; - - /* cmd will be one of nickserv, chanserv, memoserv or operserv */ - capital_cmd = g_ascii_strup(cmd, -1); - buf = irc_format(irc, "v:", capital_cmd, args[0]); - irc_send(irc, buf); - g_free(capital_cmd); - g_free(buf); - - return 0; -} - -int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - buf = irc_format(irc, "v", "TIME"); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - const char *topic; - PurpleConversation *convo; - - if (!args) - return 0; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, target, irc->account); - if (!convo) - return 0; - - if (!args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(convo)); - - if (topic) { - char *tmp, *tmp2; - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), target, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - return 0; - } - - buf = irc_format(irc, "vt:", "TOPIC", target, args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (!strcmp(cmd, "wallops")) - buf = irc_format(irc, "v:", "WALLOPS", args[0]); - else if (!strcmp(cmd, "operwall")) - buf = irc_format(irc, "v:", "OPERWALL", args[0]); - else - return 0; - - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - if (args[1]) { - buf = irc_format(irc, "vvn", "WHOIS", args[0], args[1]); - irc->whois.nick = g_strdup(args[1]); - } else { - buf = irc_format(irc, "vn", "WHOIS", args[0]); - irc->whois.nick = g_strdup(args[0]); - } - - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -int irc_cmd_whowas(struct irc_conn *irc, const char *cmd, const char *target, const char **args) -{ - char *buf; - - if (!args || !args[0]) - return 0; - - buf = irc_format(irc, "vn", "WHOWAS", args[0]); - - irc->whois.nick = g_strdup(args[0]); - irc_send(irc, buf); - g_free(buf); - - return 0; -} - -static void irc_do_mode(struct irc_conn *irc, const char *target, const char *sign, char **ops) -{ - char *buf, mode[5]; - int i = 0; - - if (!sign) - return; - - while (ops[i]) { - if (ops[i + 2] && ops[i + 4]) { - g_snprintf(mode, sizeof(mode), "%s%s%s%s", sign, - ops[i], ops[i + 2], ops[i + 4]); - buf = irc_format(irc, "vcvnnn", "MODE", target, mode, - ops[i + 1], ops[i + 3], ops[i + 5]); - i += 6; - } else if (ops[i + 2]) { - g_snprintf(mode, sizeof(mode), "%s%s%s", - sign, ops[i], ops[i + 2]); - buf = irc_format(irc, "vcvnn", "MODE", target, mode, - ops[i + 1], ops[i + 3]); - i += 4; - } else { - g_snprintf(mode, sizeof(mode), "%s%s", sign, ops[i]); - buf = irc_format(irc, "vcvn", "MODE", target, mode, ops[i + 1]); - i += 2; - } - irc_send(irc, buf); - g_free(buf); - } - - return; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/dcc_send.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/dcc_send.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/dcc_send.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/dcc_send.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,388 +0,0 @@ -/** - * @file dcc_send.c Functions used in sending files with DCC SEND - * - * purple - * - * Copyright (C) 2004, Timothy T Ringenbach - * Copyright (C) 2003, Robbert Haarman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "irc.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "network.h" - -/*************************************************************************** - * Functions related to receiving files via DCC SEND - ***************************************************************************/ - -struct irc_xfer_rx_data { - gchar *ip; -}; - -static void irc_dccsend_recv_destroy(PurpleXfer *xfer) -{ - struct irc_xfer_rx_data *xd = xfer->data; - - g_free(xd->ip); - g_free(xd); -} - -/* - * This function is called whenever data is received. - * It sends the acknowledgement (in the form of a total byte count as an - * unsigned 4 byte integer in network byte order) - */ -static void irc_dccsend_recv_ack(PurpleXfer *xfer, const guchar *data, size_t size) { - guint32 l; - size_t result; - - l = htonl(xfer->bytes_sent); - result = write(xfer->fd, &l, sizeof(l)); - if (result != sizeof(l)) { - purple_debug_error("irc", "unable to send acknowledgement: %s\n", g_strerror(errno)); - /* TODO: We should probably close the connection here or something. */ - } -} - -static void irc_dccsend_recv_init(PurpleXfer *xfer) { - struct irc_xfer_rx_data *xd = xfer->data; - - purple_xfer_start(xfer, -1, xd->ip, xfer->remote_port); - g_free(xd->ip); - xd->ip = NULL; -} - -/* This function makes the necessary arrangements for receiving files */ -void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) { - PurpleXfer *xfer; - struct irc_xfer_rx_data *xd; - gchar **token; - struct in_addr addr; - GString *filename; - int i = 0; - guint32 nip; - - token = g_strsplit(msg, " ", 0); - if (!token[0] || !token[1] || !token[2]) { - g_strfreev(token); - return; - } - - filename = g_string_new(""); - if (token[0][0] == '"') { - if (!strchr(&(token[0][1]), '"')) { - g_string_append(filename, &(token[0][1])); - for (i = 1; token[i]; i++) - if (!strchr(token[i], '"')) { - g_string_append_printf(filename, " %s", token[i]); - } else { - g_string_append_len(filename, token[i], strlen(token[i]) - 1); - break; - } - } else { - g_string_append_len(filename, &(token[0][1]), strlen(&(token[0][1])) - 1); - } - } else { - g_string_append(filename, token[0]); - } - - if (!token[i] || !token[i+1] || !token[i+2]) { - g_strfreev(token); - g_string_free(filename, TRUE); - return; - } - i++; - - xfer = purple_xfer_new(irc->account, PURPLE_XFER_RECEIVE, from); - if (xfer) - { - xd = g_new0(struct irc_xfer_rx_data, 1); - xfer->data = xd; - - purple_xfer_set_filename(xfer, filename->str); - xfer->remote_port = atoi(token[i+1]); - - nip = strtoul(token[i], NULL, 10); - if (nip) { - addr.s_addr = htonl(nip); - xd->ip = g_strdup(inet_ntoa(addr)); - } else { - xd->ip = g_strdup(token[i]); - } - purple_debug(PURPLE_DEBUG_INFO, "irc", "Receiving file (%s) from %s\n", - filename->str, xd->ip); - purple_xfer_set_size(xfer, token[i+2] ? atoi(token[i+2]) : 0); - - purple_xfer_set_init_fnc(xfer, irc_dccsend_recv_init); - purple_xfer_set_ack_fnc(xfer, irc_dccsend_recv_ack); - - purple_xfer_set_end_fnc(xfer, irc_dccsend_recv_destroy); - purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_recv_destroy); - purple_xfer_set_cancel_recv_fnc(xfer, irc_dccsend_recv_destroy); - - purple_xfer_request(xfer); - } - g_strfreev(token); - g_string_free(filename, TRUE); -} - -/******************************************************************* - * Functions related to sending files via DCC SEND - *******************************************************************/ - -struct irc_xfer_send_data { - PurpleNetworkListenData *listen_data; - gint inpa; - int fd; - guchar *rxqueue; - guint rxlen; -}; - -static void irc_dccsend_send_destroy(PurpleXfer *xfer) -{ - struct irc_xfer_send_data *xd = xfer->data; - - if (xd == NULL) - return; - - if (xd->listen_data != NULL) - purple_network_listen_cancel(xd->listen_data); - if (xd->inpa > 0) - purple_input_remove(xd->inpa); - if (xd->fd != -1) - close(xd->fd); - - g_free(xd->rxqueue); - - g_free(xd); -} - -/* just in case you were wondering, this is why DCC is gay */ -static void irc_dccsend_send_read(gpointer data, int source, PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - struct irc_xfer_send_data *xd = xfer->data; - char buffer[64]; - int len; - - len = read(source, buffer, sizeof(buffer)); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - /* XXX: Shouldn't this be canceling the transfer? */ - purple_input_remove(xd->inpa); - xd->inpa = 0; - return; - } - - xd->rxqueue = g_realloc(xd->rxqueue, len + xd->rxlen); - memcpy(xd->rxqueue + xd->rxlen, buffer, len); - xd->rxlen += len; - - while (1) { - size_t acked; - - if (xd->rxlen < 4) - break; - - acked = ntohl(*((gint32 *)xd->rxqueue)); - - xd->rxlen -= 4; - if (xd->rxlen) { - unsigned char *tmp = g_memdup(xd->rxqueue + 4, xd->rxlen); - g_free(xd->rxqueue); - xd->rxqueue = tmp; - } else { - g_free(xd->rxqueue); - xd->rxqueue = NULL; - } - - if (acked >= purple_xfer_get_size(xfer)) { - purple_input_remove(xd->inpa); - xd->inpa = 0; - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - return; - } - } -} - -static gssize irc_dccsend_send_write(const guchar *buffer, size_t size, PurpleXfer *xfer) -{ - gssize s; - int ret; - - s = MIN(purple_xfer_get_bytes_remaining(xfer), size); - if (!s) - return 0; - - ret = write(xfer->fd, buffer, s); - - if (ret < 0 && errno == EAGAIN) - ret = 0; - - return ret; -} - -static void irc_dccsend_send_connected(gpointer data, int source, PurpleInputCondition cond) { - PurpleXfer *xfer = (PurpleXfer *) data; - struct irc_xfer_send_data *xd = xfer->data; - int conn, flags; - - conn = accept(xd->fd, NULL, 0); - if (conn == -1) { - /* Accepting the connection failed. This could just be related - * to the nonblocking nature of the listening socket, so we'll - * just try again next time */ - /* Let's print an error message anyway */ - purple_debug_warning("irc", "accept: %s\n", g_strerror(errno)); - return; - } - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(xd->fd); - xd->fd = -1; - - flags = fcntl(conn, F_GETFL); - fcntl(conn, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(conn, F_SETFD, FD_CLOEXEC); -#endif - - xd->inpa = purple_input_add(conn, PURPLE_INPUT_READ, irc_dccsend_send_read, xfer); - /* Start the transfer */ - purple_xfer_start(xfer, conn, NULL, 0); -} - -static void -irc_dccsend_network_listen_cb(int sock, gpointer data) -{ - PurpleXfer *xfer = data; - struct irc_xfer_send_data *xd; - PurpleConnection *gc; - struct irc_conn *irc; - const char *arg[2]; - char *tmp; - struct in_addr addr; - unsigned short int port; - - xd = xfer->data; - xd->listen_data = NULL; - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL - || purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE) { - purple_xfer_unref(xfer); - return; - } - - xd = xfer->data; - gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - irc = gc->proto_data; - - purple_xfer_unref(xfer); - - if (sock < 0) { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to open a listening port.")); - purple_xfer_cancel_local(xfer); - return; - } - - xd->fd = sock; - - port = purple_network_get_port_from_fd(sock); - purple_debug_misc("irc", "port is %hu\n", port); - /* Monitor the listening socket */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - irc_dccsend_send_connected, xfer); - - /* Send the intended recipient the DCC request */ - arg[0] = xfer->who; - inet_aton(purple_network_get_my_ip(irc->fd), &addr); - arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001", - xfer->filename, ntohl(addr.s_addr), - port, xfer->size); - - irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg); - g_free(tmp); -} - -/* - * This function is called after the user has selected a file to send. - */ -static void irc_dccsend_send_init(PurpleXfer *xfer) { - PurpleConnection *gc = purple_account_get_connection(purple_xfer_get_account(xfer)); - struct irc_xfer_send_data *xd = xfer->data; - - xfer->filename = g_path_get_basename(xfer->local_filename); - - purple_xfer_ref(xfer); - - /* Create a listening socket */ - xd->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, - irc_dccsend_network_listen_cb, xfer); - if (xd->listen_data == NULL) { - purple_xfer_unref(xfer); - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to open a listening port.")); - purple_xfer_cancel_local(xfer); - } - -} - -PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who) { - PurpleXfer *xfer; - struct irc_xfer_send_data *xd; - - /* Build the file transfer handle */ - xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who); - if (xfer) - { - xd = g_new0(struct irc_xfer_send_data, 1); - xd->fd = -1; - xfer->data = xd; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, irc_dccsend_send_init); - purple_xfer_set_write_fnc(xfer, irc_dccsend_send_write); - purple_xfer_set_end_fnc(xfer, irc_dccsend_send_destroy); - purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_send_destroy); - purple_xfer_set_cancel_send_fnc(xfer, irc_dccsend_send_destroy); - } - - return xfer; -} - -/** - * Purple calls this function when the user selects Send File from the - * buddy menu - * It sets up the PurpleXfer struct and tells Purple to go ahead - */ -void irc_dccsend_send_file(PurpleConnection *gc, const char *who, const char *file) { - PurpleXfer *xfer = irc_dccsend_new_xfer(gc, who); - - /* Perform the request */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1038 +0,0 @@ -/** - * @file irc.c - * - * purple - * - * Copyright (C) 2003, Robbert Haarman - * Copyright (C) 2003, Ethan Blanton - * Copyright (C) 2000-2003, Rob Flynn - * Copyright (C) 1998-1999, Mark Spencer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "plugin.h" -#include "util.h" -#include "version.h" - -#include "irc.h" - -#define PING_TIMEOUT 60 - -static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string); - -static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b); -static GList *irc_status_types(PurpleAccount *account); -static GList *irc_actions(PurplePlugin *plugin, gpointer context); -/* static GList *irc_chat_info(PurpleConnection *gc); */ -static void irc_login(PurpleAccount *account); -static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); -static void irc_login_cb(gpointer data, gint source, const gchar *error_message); -static void irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, gpointer data); -static void irc_close(PurpleConnection *gc); -static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags); -static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags); -static void irc_chat_join (PurpleConnection *gc, GHashTable *data); -static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond); -static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); - -static guint irc_nick_hash(const char *nick); -static gboolean irc_nick_equal(const char *nick1, const char *nick2); -static void irc_buddy_free(struct irc_buddy *ib); - -PurplePlugin *_irc_plugin = NULL; - -static void irc_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - struct irc_conn *irc; - char *title; - - if (gc == NULL || gc->proto_data == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n"); - return; - } - irc = gc->proto_data; - if (irc->motd == NULL) { - purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"), - _("There is no MOTD associated with this connection.")); - return; - } - title = g_strdup_printf(_("MOTD for %s"), irc->server); - purple_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); - g_free(title); -} - -static int do_send(struct irc_conn *irc, const char *buf, gsize len) -{ - int ret; - - if (irc->gsc) { - ret = purple_ssl_write(irc->gsc, buf, len); - } else { - ret = write(irc->fd, buf, len); - } - - return ret; -} - -static int irc_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - struct irc_conn *irc = (struct irc_conn*)gc->proto_data; - return do_send(irc, buf, len); -} - -static void -irc_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - struct irc_conn *irc = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(irc->outbuf); - - if (writelen == 0) { - purple_input_remove(irc->writeh); - irc->writeh = 0; - return; - } - - ret = do_send(irc, irc->outbuf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - PurpleConnection *gc = purple_account_get_connection(irc->account); - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(irc->outbuf, ret); - -#if 0 - /* We *could* try to write more if we wrote it all */ - if (ret == write_len) { - irc_send_cb(data, source, cond); - } -#endif -} - -int irc_send(struct irc_conn *irc, const char *buf) -{ - int ret, buflen; - char *tosend= g_strdup(buf); - - purple_signal_emit(_irc_plugin, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); - if (tosend == NULL) - return 0; - - buflen = strlen(tosend); - - - /* If we're not buffering writes, try to send immediately */ - if (!irc->writeh) - ret = do_send(irc, tosend, buflen); - else { - ret = -1; - errno = EAGAIN; - } - - /* purple_debug(PURPLE_DEBUG_MISC, "irc", "sent%s: %s", - irc->gsc ? " (ssl)" : "", tosend); */ - if (ret <= 0 && errno != EAGAIN) { - PurpleConnection *gc = purple_account_get_connection(irc->account); - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } else if (ret < buflen) { - if (ret < 0) - ret = 0; - if (!irc->writeh) - irc->writeh = purple_input_add( - irc->gsc ? irc->gsc->fd : irc->fd, - PURPLE_INPUT_WRITE, irc_send_cb, irc); - purple_circ_buffer_append(irc->outbuf, tosend + ret, - buflen - ret); - } - g_free(tosend); - return ret; -} - -/* XXX I don't like messing directly with these buddies */ -gboolean irc_blist_timeout(struct irc_conn *irc) -{ - GString *string; - char *list, *buf; - - if (irc->ison_outstanding) - return TRUE; - - string = g_string_sized_new(512); - - g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_append, (gpointer)string); - - list = g_string_free(string, FALSE); - if (!list || !strlen(list)) { - g_free(list); - return TRUE; - } - - buf = irc_format(irc, "vn", "ISON", list); - g_free(list); - irc_send(irc, buf); - g_free(buf); - - irc->ison_outstanding = TRUE; - - return TRUE; -} - -static void irc_buddy_append(char *name, struct irc_buddy *ib, GString *string) -{ - ib->flag = FALSE; - g_string_append_printf(string, "%s ", name); -} - -static void irc_ison_one(struct irc_conn *irc, struct irc_buddy *ib) -{ - char *buf; - - ib->flag = FALSE; - buf = irc_format(irc, "vn", "ISON", ib->name); - irc_send(irc, buf); - g_free(buf); -} - - -static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "irc"; -} - -static GList *irc_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); - types = g_list_append(types, type); - - return types; -} - -static GList *irc_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act = NULL; - - act = purple_plugin_action_new(_("View MOTD"), irc_view_motd); - list = g_list_append(list, act); - - return list; -} - -static GList *irc_chat_join_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Password:"); - pce->identifier = "password"; - pce->secret = TRUE; - m = g_list_append(m, pce); - - return m; -} - -static GHashTable *irc_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void irc_login(PurpleAccount *account) -{ - PurpleConnection *gc; - struct irc_conn *irc; - char **userparts; - const char *username = purple_account_get_username(account); - - gc = purple_account_get_connection(account); - gc->flags |= PURPLE_CONNECTION_NO_NEWLINES; - - if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("IRC nick and server may not contain whitespace")); - return; - } - - gc->proto_data = irc = g_new0(struct irc_conn, 1); - irc->fd = -1; - irc->account = account; - irc->outbuf = purple_circ_buffer_new(512); - - userparts = g_strsplit(username, "@", 2); - purple_connection_set_display_name(gc, userparts[0]); - irc->server = g_strdup(userparts[1]); - g_strfreev(userparts); - - irc->buddies = g_hash_table_new_full((GHashFunc)irc_nick_hash, (GEqualFunc)irc_nick_equal, - NULL, (GDestroyNotify)irc_buddy_free); - irc->cmds = g_hash_table_new(g_str_hash, g_str_equal); - irc_cmd_table_build(irc); - irc->msgs = g_hash_table_new(g_str_hash, g_str_equal); - irc_msg_table_build(irc); - - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - - if (purple_account_get_bool(account, "ssl", FALSE)) { - if (purple_ssl_is_supported()) { - irc->gsc = purple_ssl_connect(account, irc->server, - purple_account_get_int(account, "port", IRC_DEFAULT_SSL_PORT), - irc_login_cb_ssl, irc_ssl_connect_failure, gc); - } else { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - return; - } - } - - if (!irc->gsc) { - - if (purple_proxy_connect(gc, account, irc->server, - purple_account_get_int(account, "port", IRC_DEFAULT_PORT), - irc_login_cb, gc) == NULL) - { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - } -} - -static gboolean do_login(PurpleConnection *gc) { - char *buf, *tmp = NULL; - char *hostname, *server; - const char *hosttmp; - const char *username, *realname; - struct irc_conn *irc = gc->proto_data; - const char *pass = purple_connection_get_password(gc); - - if (pass && *pass) { - buf = irc_format(irc, "vv", "PASS", pass); - if (irc_send(irc, buf) < 0) { - g_free(buf); - return FALSE; - } - g_free(buf); - } - - realname = purple_account_get_string(irc->account, "realname", ""); - username = purple_account_get_string(irc->account, "username", ""); - - if (username == NULL || *username == '\0') { - username = g_get_user_name(); - } - - if (username != NULL && strchr(username, ' ') != NULL) { - tmp = g_strdup(username); - while ((buf = strchr(tmp, ' ')) != NULL) { - *buf = '_'; - } - } - - hosttmp = purple_get_host_name(); - if (*hosttmp == ':') { - /* This is either an IPv6 address, or something which - * doesn't belong here. Either way, we need to escape - * it. */ - hostname = g_strdup_printf("0%s", hosttmp); - } else { - /* Ugly, I know. */ - hostname = g_strdup(hosttmp); - } - - if (*irc->server == ':') { - /* Same as hostname, above. */ - server = g_strdup_printf("0%s", irc->server); - } else { - server = g_strdup(irc->server); - } - - buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, hostname, server, - strlen(realname) ? realname : IRC_DEFAULT_ALIAS); - g_free(tmp); - g_free(hostname); - g_free(server); - if (irc_send(irc, buf) < 0) { - g_free(buf); - return FALSE; - } - g_free(buf); - username = purple_connection_get_display_name(gc); - buf = irc_format(irc, "vn", "NICK", username); - irc->reqnick = g_strdup(username); - irc->nickused = FALSE; - if (irc_send(irc, buf) < 0) { - g_free(buf); - return FALSE; - } - g_free(buf); - - irc->recv_time = time(NULL); - - return TRUE; -} - -static void irc_login_cb_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - - if (do_login(gc)) { - purple_ssl_input_add(gsc, irc_input_cb_ssl, gc); - } -} - -static void irc_login_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - - if (source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - irc->fd = source; - - if (do_login(gc)) { - gc->inpa = purple_input_add(irc->fd, PURPLE_INPUT_READ, irc_input_cb, gc); - } -} - -static void -irc_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - - irc->gsc = NULL; - - purple_connection_ssl_error (gc, error); -} - -static void irc_close(PurpleConnection *gc) -{ - struct irc_conn *irc = gc->proto_data; - - if (irc == NULL) - return; - - if (irc->gsc || (irc->fd >= 0)) - irc_cmd_quit(irc, "quit", NULL, NULL); - - if (gc->inpa) - purple_input_remove(gc->inpa); - - g_free(irc->inbuf); - if (irc->gsc) { - purple_ssl_close(irc->gsc); - } else if (irc->fd >= 0) { - close(irc->fd); - } - if (irc->timer) - purple_timeout_remove(irc->timer); - g_hash_table_destroy(irc->cmds); - g_hash_table_destroy(irc->msgs); - g_hash_table_destroy(irc->buddies); - if (irc->motd) - g_string_free(irc->motd, TRUE); - g_free(irc->server); - - if (irc->writeh) - purple_input_remove(irc->writeh); - - purple_circ_buffer_destroy(irc->outbuf); - - g_free(irc->mode_chars); - g_free(irc->reqnick); - - g_free(irc); -} - -static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) -{ - struct irc_conn *irc = gc->proto_data; - char *plain; - const char *args[2]; - - args[0] = irc_nick_skip_mode(irc, who); - - purple_markup_html_to_xhtml(what, NULL, &plain); - args[1] = plain; - - irc_cmd_privmsg(irc, "msg", NULL, args); - g_free(plain); - return 1; -} - -static void irc_get_info(PurpleConnection *gc, const char *who) -{ - struct irc_conn *irc = gc->proto_data; - const char *args[2]; - args[0] = who; - args[1] = NULL; - irc_cmd_whois(irc, "whois", NULL, args); -} - -static void irc_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - struct irc_conn *irc; - const char *args[1]; - const char *status_id = purple_status_get_id(status); - - g_return_if_fail(gc != NULL); - irc = gc->proto_data; - - if (!purple_status_is_active(status)) - return; - - args[0] = NULL; - - if (!strcmp(status_id, "away")) { - args[0] = purple_status_get_attr_string(status, "message"); - if ((args[0] == NULL) || (*args[0] == '\0')) - args[0] = _("Away"); - irc_cmd_away(irc, "away", NULL, args); - } else if (!strcmp(status_id, "available")) { - irc_cmd_away(irc, "back", NULL, args); - } -} - -static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; - struct irc_buddy *ib; - const char *bname = purple_buddy_get_name(buddy); - - ib = g_hash_table_lookup(irc->buddies, bname); - if (ib != NULL) { - ib->ref++; - purple_prpl_got_user_status(irc->account, bname, - ib->online ? "available" : "offline", NULL); - } else { - ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(bname); - ib->ref = 1; - g_hash_table_replace(irc->buddies, ib->name, ib); - } - - /* if the timer isn't set, this is during signon, so we don't want to flood - * ourself off with ISON's, so we don't, but after that we want to know when - * someone's online asap */ - if (irc->timer) - irc_ison_one(irc, ib); -} - -static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - struct irc_conn *irc = (struct irc_conn *)gc->proto_data; - struct irc_buddy *ib; - - ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy)); - if (ib && --ib->ref == 0) { - g_hash_table_remove(irc->buddies, purple_buddy_get_name(buddy)); - } -} - -static void read_input(struct irc_conn *irc, int len) -{ - char *cur, *end; - - irc->account->gc->last_received = time(NULL); - irc->inbufused += len; - irc->inbuf[irc->inbufused] = '\0'; - - cur = irc->inbuf; - - /* This is a hack to work around the fact that marv gets messages - * with null bytes in them while using some weird irc server at work - */ - while ((cur < (irc->inbuf + irc->inbufused)) && !*cur) - cur++; - - while (cur < irc->inbuf + irc->inbufused && - ((end = strstr(cur, "\r\n")) || (end = strstr(cur, "\n")))) { - int step = (*end == '\r' ? 2 : 1); - *end = '\0'; - irc_parse_msg(irc, cur); - cur = end + step; - } - if (cur != irc->inbuf + irc->inbufused) { /* leftover */ - irc->inbufused -= (cur - irc->inbuf); - memmove(irc->inbuf, cur, irc->inbufused); - } else { - irc->inbufused = 0; - } -} - -static void irc_input_cb_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - int len; - - if(!g_list_find(purple_connections_get_all(), gc)) { - purple_ssl_close(gsc); - return; - } - - if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { - irc->inbuflen += IRC_INITIAL_BUFSIZE; - irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); - } - - len = purple_ssl_read(gsc, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); - - if (len < 0 && errno == EAGAIN) { - /* Try again later */ - return; - } else if (len < 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - read_input(irc, len); -} - -static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - struct irc_conn *irc = gc->proto_data; - int len; - - if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) { - irc->inbuflen += IRC_INITIAL_BUFSIZE; - irc->inbuf = g_realloc(irc->inbuf, irc->inbuflen); - } - - len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1); - if (len < 0 && errno == EAGAIN) { - return; - } else if (len < 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - read_input(irc, len); -} - -static void irc_chat_join (PurpleConnection *gc, GHashTable *data) -{ - struct irc_conn *irc = gc->proto_data; - const char *args[2]; - - args[0] = g_hash_table_lookup(data, "channel"); - args[1] = g_hash_table_lookup(data, "password"); - irc_cmd_join(irc, "join", NULL, args); -} - -static char *irc_get_chat_name(GHashTable *data) { - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) -{ - struct irc_conn *irc = gc->proto_data; - PurpleConversation *convo = purple_find_chat(gc, id); - const char *args[2]; - - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got chat invite request for bogus chat\n"); - return; - } - args[0] = name; - args[1] = purple_conversation_get_name(convo); - irc_cmd_invite(irc, "invite", purple_conversation_get_name(convo), args); -} - - -static void irc_chat_leave (PurpleConnection *gc, int id) -{ - struct irc_conn *irc = gc->proto_data; - PurpleConversation *convo = purple_find_chat(gc, id); - const char *args[2]; - - if (!convo) - return; - - args[0] = purple_conversation_get_name(convo); - args[1] = NULL; - irc_cmd_part(irc, "part", purple_conversation_get_name(convo), args); - serv_got_chat_left(gc, id); -} - -static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) -{ - struct irc_conn *irc = gc->proto_data; - PurpleConversation *convo = purple_find_chat(gc, id); - const char *args[2]; - char *tmp; - - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "chat send on nonexistent chat\n"); - return -EINVAL; - } -#if 0 - if (*what == '/') { - return irc_parse_cmd(irc, convo->name, what + 1); - } -#endif - purple_markup_html_to_xhtml(what, NULL, &tmp); - args[0] = convo->name; - args[1] = tmp; - - irc_cmd_privmsg(irc, "msg", NULL, args); - - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), flags, what, time(NULL)); - g_free(tmp); - return 0; -} - -static guint irc_nick_hash(const char *nick) -{ - char *lc; - guint bucket; - - lc = g_utf8_strdown(nick, -1); - bucket = g_str_hash(lc); - g_free(lc); - - return bucket; -} - -static gboolean irc_nick_equal(const char *nick1, const char *nick2) -{ - return (purple_utf8_strcasecmp(nick1, nick2) == 0); -} - -static void irc_buddy_free(struct irc_buddy *ib) -{ - g_free(ib->name); - g_free(ib); -} - -static void irc_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - char *buf; - const char *name = NULL; - struct irc_conn *irc; - - irc = gc->proto_data; - name = purple_conversation_get_name(purple_find_chat(gc, id)); - - if (name == NULL) - return; - - buf = irc_format(irc, "vt:", "TOPIC", name, topic); - irc_send(irc, buf); - g_free(buf); -} - -static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) -{ - struct irc_conn *irc; - GList *fields = NULL; - PurpleRoomlistField *f; - char *buf; - - irc = gc->proto_data; - - if (irc->roomlist) - purple_roomlist_unref(irc->roomlist); - - irc->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - - purple_roomlist_set_fields(irc->roomlist, fields); - - buf = irc_format(irc, "v", "LIST"); - irc_send(irc, buf); - g_free(buf); - - return irc->roomlist; -} - -static void irc_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - struct irc_conn *irc; - - if (gc == NULL) - return; - - irc = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - - if (irc->roomlist == list) { - irc->roomlist = NULL; - purple_roomlist_unref(list); - } -} - -static void irc_keepalive(PurpleConnection *gc) -{ - struct irc_conn *irc = gc->proto_data; - if ((time(NULL) - irc->recv_time) > PING_TIMEOUT) - irc_cmd_ping(irc, NULL, NULL, NULL); -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL | - OPT_PROTO_SLASH_COMMANDS_NATIVE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec */ - irc_blist_icon, /* list_icon */ - NULL, /* list_emblems */ - NULL, /* status_text */ - NULL, /* tooltip_text */ - irc_status_types, /* away_states */ - NULL, /* blist_node_menu */ - irc_chat_join_info, /* chat_info */ - irc_chat_info_defaults, /* chat_info_defaults */ - irc_login, /* login */ - irc_close, /* close */ - irc_im_send, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - irc_get_info, /* get_info */ - irc_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - irc_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - irc_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - irc_chat_join, /* join_chat */ - NULL, /* reject_chat */ - irc_get_chat_name, /* get_chat_name */ - irc_chat_invite, /* chat_invite */ - irc_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - irc_chat_send, /* chat_send */ - irc_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - irc_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - irc_roomlist_get_list, /* roomlist_get_list */ - irc_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - irc_dccsend_send_file, /* send_file */ - irc_dccsend_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - irc_send_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static gboolean load_plugin (PurplePlugin *plugin) { - - purple_signal_register(plugin, "irc-sending-text", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - purple_signal_register(plugin, "irc-receiving-text", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - return TRUE; -} - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-irc", /**< id */ - "IRC", /**< name */ - DISPLAY_VERSION, /**< version */ - N_("IRC Protocol Plugin"), /** summary */ - N_("The IRC Protocol Plugin that Sucks Less"), /** description */ - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - load_plugin, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - irc_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void _init_plugin(PurplePlugin *plugin) -{ - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - split = purple_account_user_split_new(_("Server"), IRC_DEFAULT_SERVER, '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_int_new(_("Port"), "port", IRC_DEFAULT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encodings"), "encoding", IRC_DEFAULT_CHARSET); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Auto-detect incoming UTF-8"), "autodetect_utf8", IRC_DEFAULT_AUTODETECT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Username"), "username", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Real name"), "realname", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - /* - option = purple_account_option_string_new(_("Quit message"), "quitmsg", IRC_DEFAULT_QUIT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - */ - - option = purple_account_option_bool_new(_("Use SSL"), "ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - _irc_plugin = plugin; - - purple_prefs_remove("/plugins/prpl/irc/quitmsg"); - purple_prefs_remove("/plugins/prpl/irc"); - - irc_register_commands(); -} - -PURPLE_INIT_PLUGIN(irc, _init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/irc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,199 +0,0 @@ -/** - * @file irc.h - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_IRC_H -#define _PURPLE_IRC_H - -#include - -#include "circbuffer.h" -#include "ft.h" -#include "roomlist.h" -#include "sslconn.h" - -#define IRC_DEFAULT_SERVER "irc.freenode.net" -#define IRC_DEFAULT_PORT 6667 -#define IRC_DEFAULT_SSL_PORT 994 - -#define IRC_DEFAULT_CHARSET "UTF-8" -#define IRC_DEFAULT_AUTODETECT FALSE -#define IRC_DEFAULT_ALIAS "purple" - -#define IRC_DEFAULT_QUIT "Leaving." - -#define IRC_INITIAL_BUFSIZE 1024 - -#define IRC_NAMES_FLAG "irc-namelist" - - -enum { IRC_USEROPT_SERVER, IRC_USEROPT_PORT, IRC_USEROPT_CHARSET }; -enum irc_state { IRC_STATE_NEW, IRC_STATE_ESTABLISHED }; - -struct irc_conn { - PurpleAccount *account; - GHashTable *msgs; - GHashTable *cmds; - char *server; - int fd; - guint timer; - GHashTable *buddies; - - gboolean ison_outstanding; - - char *inbuf; - int inbuflen; - int inbufused; - - GString *motd; - GString *names; - struct _whois { - char *nick; - char *away; - char *userhost; - char *name; - char *server; - char *serverinfo; - GString *channels; - int ircop; - int identified; - int idle; - time_t signon; - } whois; - PurpleRoomlist *roomlist; - PurpleSslConnection *gsc; - - gboolean quitting; - - PurpleCircBuffer *outbuf; - guint writeh; - - time_t recv_time; - - char *mode_chars; - char *reqnick; - gboolean nickused; -}; - -struct irc_buddy { - char *name; - gboolean online; - gboolean flag; - int ref; -}; - -typedef int (*IRCCmdCallback) (struct irc_conn *irc, const char *cmd, const char *target, const char **args); - -int irc_send(struct irc_conn *irc, const char *buf); -gboolean irc_blist_timeout(struct irc_conn *irc); - -char *irc_escape_privmsg(const char *text, gssize length); - -char *irc_mirc2html(const char *string); -char *irc_mirc2txt(const char *string); - -const char *irc_nick_skip_mode(struct irc_conn *irc, const char *string); - -gboolean irc_ischannel(const char *string); - -void irc_register_commands(void); -void irc_msg_table_build(struct irc_conn *irc); -void irc_parse_msg(struct irc_conn *irc, char *input); -char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice); -char *irc_format(struct irc_conn *irc, const char *format, ...); - -void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args); -void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args); - -void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args); - -void irc_cmd_table_build(struct irc_conn *irc); - -int irc_cmd_default(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_away(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ctcp(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ctcp_version(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_invite(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_join(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_kick(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_list(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_mode(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_names(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_nick(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_op(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_privmsg(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_part(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_ping(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_quit(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_quote(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_query(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_remove(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_service(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_time(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_topic(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_wallops(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_whois(struct irc_conn *irc, const char *cmd, const char *target, const char **args); -int irc_cmd_whowas(struct irc_conn *irc, const char *cmd, const char *target, const char **args); - -PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who); -void irc_dccsend_send_file(PurpleConnection *gc, const char *who, const char *file); -void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg); -#endif /* _PURPLE_IRC_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -IRCSOURCES = \ - cmds.c \ - dcc_send.c \ - irc.c \ - irc.h \ - msgs.c \ - parse.c - -AM_CFLAGS = $(st) - -libirc_la_LDFLAGS = -module -avoid-version - -if STATIC_IRC - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libirc.la -libirc_la_SOURCES = $(IRCSOURCES) -libirc_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libirc.la -libirc_la_SOURCES = $(IRCSOURCES) -libirc_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,778 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/irc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_IRC_FALSE@libirc_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libirc_la_SOURCES_DIST = cmds.c dcc_send.c irc.c irc.h msgs.c \ - parse.c -am__objects_1 = libirc_la-cmds.lo libirc_la-dcc_send.lo \ - libirc_la-irc.lo libirc_la-msgs.lo libirc_la-parse.lo -@STATIC_IRC_FALSE@am_libirc_la_OBJECTS = $(am__objects_1) -@STATIC_IRC_TRUE@am_libirc_la_OBJECTS = $(am__objects_1) -libirc_la_OBJECTS = $(am_libirc_la_OBJECTS) -@STATIC_IRC_FALSE@am_libirc_la_rpath = -rpath $(pkgdir) -@STATIC_IRC_TRUE@am_libirc_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libirc_la_SOURCES) -DIST_SOURCES = $(am__libirc_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -IRCSOURCES = \ - cmds.c \ - dcc_send.c \ - irc.c \ - irc.h \ - msgs.c \ - parse.c - -AM_CFLAGS = $(st) -libirc_la_LDFLAGS = -module -avoid-version -@STATIC_IRC_FALSE@st = -@STATIC_IRC_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_IRC_TRUE@noinst_LTLIBRARIES = libirc.la -@STATIC_IRC_FALSE@libirc_la_SOURCES = $(IRCSOURCES) -@STATIC_IRC_TRUE@libirc_la_SOURCES = $(IRCSOURCES) -@STATIC_IRC_TRUE@libirc_la_CFLAGS = $(AM_CFLAGS) -@STATIC_IRC_FALSE@pkg_LTLIBRARIES = libirc.la -@STATIC_IRC_FALSE@libirc_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/irc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/irc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libirc.la: $(libirc_la_OBJECTS) $(libirc_la_DEPENDENCIES) - $(LINK) $(am_libirc_la_rpath) $(libirc_la_LDFLAGS) $(libirc_la_OBJECTS) $(libirc_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-cmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-dcc_send.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-irc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-msgs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libirc_la-parse.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libirc_la-cmds.lo: cmds.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-cmds.lo -MD -MP -MF "$(DEPDIR)/libirc_la-cmds.Tpo" -c -o libirc_la-cmds.lo `test -f 'cmds.c' || echo '$(srcdir)/'`cmds.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-cmds.Tpo" "$(DEPDIR)/libirc_la-cmds.Plo"; else rm -f "$(DEPDIR)/libirc_la-cmds.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmds.c' object='libirc_la-cmds.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-cmds.lo `test -f 'cmds.c' || echo '$(srcdir)/'`cmds.c - -libirc_la-dcc_send.lo: dcc_send.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-dcc_send.lo -MD -MP -MF "$(DEPDIR)/libirc_la-dcc_send.Tpo" -c -o libirc_la-dcc_send.lo `test -f 'dcc_send.c' || echo '$(srcdir)/'`dcc_send.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-dcc_send.Tpo" "$(DEPDIR)/libirc_la-dcc_send.Plo"; else rm -f "$(DEPDIR)/libirc_la-dcc_send.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dcc_send.c' object='libirc_la-dcc_send.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-dcc_send.lo `test -f 'dcc_send.c' || echo '$(srcdir)/'`dcc_send.c - -libirc_la-irc.lo: irc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-irc.lo -MD -MP -MF "$(DEPDIR)/libirc_la-irc.Tpo" -c -o libirc_la-irc.lo `test -f 'irc.c' || echo '$(srcdir)/'`irc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-irc.Tpo" "$(DEPDIR)/libirc_la-irc.Plo"; else rm -f "$(DEPDIR)/libirc_la-irc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='irc.c' object='libirc_la-irc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-irc.lo `test -f 'irc.c' || echo '$(srcdir)/'`irc.c - -libirc_la-msgs.lo: msgs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-msgs.lo -MD -MP -MF "$(DEPDIR)/libirc_la-msgs.Tpo" -c -o libirc_la-msgs.lo `test -f 'msgs.c' || echo '$(srcdir)/'`msgs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-msgs.Tpo" "$(DEPDIR)/libirc_la-msgs.Plo"; else rm -f "$(DEPDIR)/libirc_la-msgs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msgs.c' object='libirc_la-msgs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-msgs.lo `test -f 'msgs.c' || echo '$(srcdir)/'`msgs.c - -libirc_la-parse.lo: parse.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -MT libirc_la-parse.lo -MD -MP -MF "$(DEPDIR)/libirc_la-parse.Tpo" -c -o libirc_la-parse.lo `test -f 'parse.c' || echo '$(srcdir)/'`parse.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libirc_la-parse.Tpo" "$(DEPDIR)/libirc_la-parse.Plo"; else rm -f "$(DEPDIR)/libirc_la-parse.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parse.c' object='libirc_la-parse.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libirc_la_CFLAGS) $(CFLAGS) -c -o libirc_la-parse.lo `test -f 'parse.c' || echo '$(srcdir)/'`parse.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libirc -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libirc -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = cmds.c \ - dcc_send.c \ - irc.c \ - msgs.c \ - parse.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/msgs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/msgs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/msgs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/msgs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1266 +0,0 @@ -/** - * @file msgs.c - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "blist.h" -#include "notify.h" -#include "util.h" -#include "debug.h" -#include "irc.h" - -#include -#include - -static char *irc_mask_nick(const char *mask); -static char *irc_mask_userhost(const char *mask); -static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]); -static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc); -static void irc_connected(struct irc_conn *irc, const char *nick); - -static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, - const char *from, const char *to, - const char *rawmsg, gboolean notice); - -static char *irc_mask_nick(const char *mask) -{ - char *end, *buf; - - end = strchr(mask, '!'); - if (!end) - buf = g_strdup(mask); - else - buf = g_strndup(mask, end - mask); - - return buf; -} - -static char *irc_mask_userhost(const char *mask) -{ - return g_strdup(strchr(mask, '!') + 1); -} - -static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2]) -{ - char *message, *stripped; - - stripped = data[1] ? irc_mirc2txt(data[1]) : NULL; - message = g_strdup_printf("quit: %s", stripped); - g_free(stripped); - - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), data[0])) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), data[0], message); - - g_free(message); -} - -static void irc_connected(struct irc_conn *irc, const char *nick) -{ - PurpleConnection *gc; - PurpleStatus *status; - GSList *buddies; - PurpleAccount *account; - - if ((gc = purple_account_get_connection(irc->account)) == NULL - || PURPLE_CONNECTION_IS_CONNECTED(gc)) - return; - - purple_connection_set_display_name(gc, nick); - purple_connection_set_state(gc, PURPLE_CONNECTED); - account = purple_connection_get_account(gc); - - /* If we're away then set our away message */ - status = purple_account_get_active_status(irc->account); - if (!purple_status_get_type(status) != PURPLE_STATUS_AVAILABLE) { - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); - prpl_info->set_status(irc->account, status); - } - - /* this used to be in the core, but it's not now */ - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) - { - PurpleBuddy *b = buddies->data; - struct irc_buddy *ib = g_new0(struct irc_buddy, 1); - ib->name = g_strdup(purple_buddy_get_name(b)); - ib->ref = 1; - g_hash_table_replace(irc->buddies, ib->name, ib); - } - - irc_blist_timeout(irc); - if (!irc->timer) - irc->timer = purple_timeout_add_seconds(45, (GSourceFunc)irc_blist_timeout, (gpointer)irc); -} - -void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *clean; - /* This, too, should be escaped somehow (smarter) */ - clean = purple_utf8_salvage(args[0]); - purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean); - g_free(clean); -} - -void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - gchar **features; - int i; - - if (!args || !args[0] || !args[1]) - return; - - features = g_strsplit(args[1], " ", -1); - for (i = 0; features[i]; i++) { - char *val; - if (!strncmp(features[i], "PREFIX=", 7)) { - if ((val = strchr(features[i] + 7, ')')) != NULL) - irc->mode_chars = g_strdup(val + 1); - } - } - - g_strfreev(features); -} - -void irc_msg_luser(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!args || !args[0]) - return; - - if (!strcmp(name, "251")) { - /* 251 is required, so we pluck our nick from here and - * finalize connection */ - irc_connected(irc, args[0]); - /* Some IRC servers seem to not send a 255 numeric, so - * I guess we can't require it; 251 will do. */ - /* } else if (!strcmp(name, "255")) { */ - } -} - -void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - char *msg; - - if (!args || !args[1]) - return; - - if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - /* We're doing a whois, show this in the whois dialog */ - irc_msg_whois(irc, name, from, args); - return; - } - - gc = purple_account_get_connection(irc->account); - if (gc) { - msg = g_markup_escape_text(args[2], -1); - serv_got_im(gc, args[1], msg, PURPLE_MESSAGE_AUTO_RESP, time(NULL)); - g_free(msg); - } -} - -void irc_msg_badmode(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[1] || !gc) - return; - - purple_notify_error(gc, NULL, _("Bad mode"), args[1]); -} - -void irc_msg_ban(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - - if (!args || !args[0] || !args[1]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - args[1], irc->account); - - if (!strcmp(name, "367")) { - char *msg = NULL; - /* Ban list entry */ - if (!args[2]) - return; - if (args[3] && args[4]) { - /* This is an extended syntax, not in RFC 1459 */ - int t1 = atoi(args[4]); - time_t t2 = time(NULL); - char *time = purple_str_seconds_to_string(t2 - t1); - msg = g_strdup_printf(_("Ban on %s by %s, set %s ago"), - args[2], args[3], time); - g_free(time); - } else { - msg = g_strdup_printf(_("Ban on %s"), args[2]); - } - if (convo) { - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, - time(NULL)); - } else { - purple_debug_info("irc", "%s\n", msg); - } - g_free(msg); - } else if (!strcmp(name, "368")) { - if (!convo) - return; - /* End of ban list */ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", - _("End of ban list"), - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, - time(NULL)); - } -} - -void irc_msg_banned(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *buf; - - if (!args || !args[1] || !gc) - return; - - buf = g_strdup_printf(_("You are banned from %s."), args[1]); - purple_notify_error(gc, _("Banned"), _("Banned"), buf); - g_free(buf); -} - -void irc_msg_banfull(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - char *buf, *nick; - - if (!args || !args[0] || !args[1] || !args[2]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (!convo) - return; - - nick = g_markup_escape_text(args[2], -1); - buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick); - g_free(nick); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, - time(NULL)); - g_free(buf); -} - -void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - char *buf, *escaped; - - if (!args || !args[1] || !args[2]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (!convo) /* XXX punt on channels we are not in for now */ - return; - - escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL; - buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(escaped); - g_free(buf); - - return; -} - -void irc_msg_whois(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!irc->whois.nick) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected %s reply for %s\n", !strcmp(name, "314") ? "WHOWAS" : "WHOIS" - , args[1]); - return; - } - - if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Got %s reply for %s while waiting for %s\n", !strcmp(name, "314") ? "WHOWAS" : "WHOIS" - , args[1], irc->whois.nick); - return; - } - - if (!strcmp(name, "301")) { - irc->whois.away = g_strdup(args[2]); - } else if (!strcmp(name, "311") || !strcmp(name, "314")) { - irc->whois.userhost = g_strdup_printf("%s@%s", args[2], args[3]); - irc->whois.name = g_strdup(args[5]); - } else if (!strcmp(name, "312")) { - irc->whois.server = g_strdup(args[2]); - irc->whois.serverinfo = g_strdup(args[3]); - } else if (!strcmp(name, "313")) { - irc->whois.ircop = 1; - } else if (!strcmp(name, "317")) { - irc->whois.idle = atoi(args[2]); - if (args[3]) - irc->whois.signon = (time_t)atoi(args[3]); - } else if (!strcmp(name, "319")) { - if (irc->whois.channels == NULL) { - irc->whois.channels = g_string_new(args[2]); - } else { - irc->whois.channels = g_string_append(irc->whois.channels, args[2]); - } - } else if (!strcmp(name, "320")) { - irc->whois.identified = 1; - } -} - -void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - char *tmp, *tmp2; - PurpleNotifyUserInfo *user_info; - - if (!irc->whois.nick) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unexpected End of %s for %s\n", !strcmp(name, "369") ? "WHOWAS" : "WHOIS" - , args[1]); - return; - } - if (purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Received end of %s for %s, expecting %s\n", !strcmp(name, "369") ? "WHOWAS" : "WHOIS" - , args[1], irc->whois.nick); - return; - } - - user_info = purple_notify_user_info_new(); - - tmp2 = g_markup_escape_text(args[1], -1); - tmp = g_strdup_printf("%s%s%s", tmp2, - (irc->whois.ircop ? _(" (ircop)") : ""), - (irc->whois.identified ? _(" (identified)") : "")); - purple_notify_user_info_add_pair(user_info, _("Nick"), tmp); - g_free(tmp2); - g_free(tmp); - - if (irc->whois.away) { - tmp = g_markup_escape_text(irc->whois.away, strlen(irc->whois.away)); - g_free(irc->whois.away); - purple_notify_user_info_add_pair(user_info, _("Away"), tmp); - g_free(tmp); - } - if (irc->whois.userhost) { - tmp = g_markup_escape_text(irc->whois.name, strlen(irc->whois.name)); - g_free(irc->whois.name); - purple_notify_user_info_add_pair(user_info, _("Username"), irc->whois.userhost); - purple_notify_user_info_add_pair(user_info, _("Real name"), tmp); - g_free(irc->whois.userhost); - g_free(tmp); - } - if (irc->whois.server) { - tmp = g_strdup_printf("%s (%s)", irc->whois.server, irc->whois.serverinfo); - purple_notify_user_info_add_pair(user_info, _("Server"), tmp); - g_free(tmp); - g_free(irc->whois.server); - g_free(irc->whois.serverinfo); - } - if (irc->whois.channels) { - purple_notify_user_info_add_pair(user_info, _("Currently on"), irc->whois.channels->str); - g_string_free(irc->whois.channels, TRUE); - } - if (irc->whois.idle) { - gchar *timex = purple_str_seconds_to_string(irc->whois.idle); - purple_notify_user_info_add_pair(user_info, _("Idle for"), timex); - g_free(timex); - purple_notify_user_info_add_pair(user_info, - _("Online since"), purple_date_format_full(localtime(&irc->whois.signon))); - } - if (!strcmp(irc->whois.nick, "Paco-Paco")) { - purple_notify_user_info_add_pair(user_info, - _("Defining adjective:"), _("Glorious")); - } - - gc = purple_account_get_connection(irc->account); - - purple_notify_userinfo(gc, irc->whois.nick, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(irc->whois.nick); - memset(&irc->whois, 0, sizeof(irc->whois)); -} - -void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!irc->roomlist) - return; - - if (!strcmp(name, "321")) { - purple_roomlist_set_in_progress(irc->roomlist, TRUE); - return; - } - - if (!strcmp(name, "323")) { - purple_roomlist_set_in_progress(irc->roomlist, FALSE); - purple_roomlist_unref(irc->roomlist); - irc->roomlist = NULL; - return; - } - - if (!strcmp(name, "322")) { - PurpleRoomlistRoom *room; - char *topic; - - if (!args[0] || !args[1] || !args[2] || !args[3]) - return; - - if (!purple_roomlist_get_in_progress(irc->roomlist)) { - purple_debug_warning("irc", "Buggy server didn't send RPL_LISTSTART.\n"); - purple_roomlist_set_in_progress(irc->roomlist, TRUE); - } - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL); - purple_roomlist_room_add_field(irc->roomlist, room, args[1]); - purple_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10))); - topic = irc_mirc2txt(args[3]); - purple_roomlist_room_add_field(irc->roomlist, room, topic); - g_free(topic); - purple_roomlist_room_add(irc->roomlist, room); - } -} - -void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *chan, *topic, *msg, *nick, *tmp, *tmp2; - PurpleConversation *convo; - - if (!strcmp(name, "topic")) { - if (!args[0] || !args[1]) - return; - chan = args[0]; - topic = irc_mirc2txt (args[1]); - } else { - if (!args[0] || !args[1] || !args[2]) - return; - chan = args[1]; - topic = irc_mirc2txt (args[2]); - } - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chan, irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); - g_free(topic); - return; - } - - /* If this is an interactive update, print it out */ - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - g_free(tmp); - if (!strcmp(name, "topic")) { - const char *current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(convo)); - if (!(current_topic != NULL && strcmp(tmp2, current_topic) == 0)) - { - char *nick_esc; - nick = irc_mask_nick(from); - nick_esc = g_markup_escape_text(nick, -1); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), nick, topic); - if (*tmp2) - msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2); - else - msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc); - g_free(nick_esc); - g_free(nick); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - } else { - char *chan_esc = g_markup_escape_text(chan, -1); - msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2); - g_free(chan_esc); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - g_free(tmp2); - g_free(topic); -} - -void irc_msg_unknown(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *buf; - - if (!args || !args[1] || !gc) - return; - - buf = g_strdup_printf(_("Unknown message '%s'"), args[1]); - purple_notify_error(gc, _("Unknown message"), buf, _("The IRC server received a message it did not understand.")); - g_free(buf); -} - -void irc_msg_names(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *names, *cur, *end, *tmp, *msg; - PurpleConversation *convo; - - if (!strcmp(name, "366")) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, args[1], irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[1]); - g_string_free(irc->names, TRUE); - irc->names = NULL; - return; - } - - names = cur = g_string_free(irc->names, FALSE); - irc->names = NULL; - if (purple_conversation_get_data(convo, IRC_NAMES_FLAG)) { - msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : ""); - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), "", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - } else { - GList *users = NULL; - GList *flags = NULL; - - while (*cur) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - end = strchr(cur, ' '); - if (!end) - end = cur + strlen(cur); - if (*cur == '@') { - f = PURPLE_CBFLAGS_OP; - cur++; - } else if (*cur == '%') { - f = PURPLE_CBFLAGS_HALFOP; - cur++; - } else if(*cur == '+') { - f = PURPLE_CBFLAGS_VOICE; - cur++; - } else if(irc->mode_chars - && strchr(irc->mode_chars, *cur)) { - if (*cur == '~') - f = PURPLE_CBFLAGS_FOUNDER; - cur++; - } - tmp = g_strndup(cur, end - cur); - users = g_list_prepend(users, tmp); - flags = g_list_prepend(flags, GINT_TO_POINTER(f)); - cur = end; - if (*cur) - cur++; - } - - if (users != NULL) { - GList *l; - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - - for (l = users; l != NULL; l = l->next) - g_free(l->data); - - g_list_free(users); - g_list_free(flags); - } - - purple_conversation_set_data(convo, IRC_NAMES_FLAG, - GINT_TO_POINTER(TRUE)); - } - g_free(names); - } else { - if (!irc->names) - irc->names = g_string_new(""); - - if (irc->names->len && irc->names->str[irc->names->len - 1] != ' ') - irc->names = g_string_append_c(irc->names, ' '); - irc->names = g_string_append(irc->names, args[3]); - } -} - -void irc_msg_motd(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *escaped; - - if (!args || !args[0]) - return; - - if (!irc->motd) - irc->motd = g_string_new(""); - - if (!strcmp(name, "375")) { - if (irc->motd) - g_string_free(irc->motd, TRUE); - irc->motd = g_string_new(""); - return; - } else if (!strcmp(name, "376")) { - /* dircproxy 1.0.5 does not send 251 on reconnection, so - * finalize the connection here if it is not already done. */ - irc_connected(irc, args[0]); - return; - } - - if (!irc->motd) { - purple_debug_error("irc", "IRC server sent MOTD without STARTMOTD\n"); - return; - } - - if (!args[1]) - return; - - escaped = g_markup_escape_text(args[1], -1); - g_string_append_printf(irc->motd, "%s
", escaped); - g_free(escaped); -} - -void irc_msg_time(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - - gc = purple_account_get_connection(irc->account); - if (gc == NULL || args == NULL || args[2] == NULL) - return; - - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, _("Time Response"), - _("The IRC server's local time is:"), - args[2], NULL, NULL); -} - -void irc_msg_nochan(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (gc == NULL || args == NULL || args[1] == NULL) - return; - - purple_notify_error(gc, NULL, _("No such channel"), args[1]); -} - -void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - PurpleConversation *convo; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, args[1], irc->account); - if (convo) { - if (purple_conversation_get_type(convo) == PURPLE_CONV_TYPE_CHAT) /* does this happen? */ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], _("no such channel"), - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), args[1], _("User is not logged in"), - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } else { - if ((gc = purple_account_get_connection(irc->account)) == NULL) - return; - purple_notify_error(gc, NULL, _("No such nick or channel"), args[1]); - } - - if (irc->whois.nick && !purple_utf8_strcasecmp(irc->whois.nick, args[1])) { - g_free(irc->whois.nick); - irc->whois.nick = NULL; - } -} - -void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc; - PurpleConversation *convo; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (convo) { - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } else { - if ((gc = purple_account_get_connection(irc->account)) == NULL) - return; - purple_notify_error(gc, NULL, _("Could not send"), args[2]); - } -} - -void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - - purple_debug(PURPLE_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); - if (convo) { - /*g_slist_remove(irc->gc->buddy_chats, convo); - purple_conversation_set_account(convo, NULL);*/ - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[1], args[2], PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } -} - -void irc_msg_notop(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - - if (!args || !args[1] || !args[2]) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (!convo) - return; - - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", args[2], PURPLE_MESSAGE_SYSTEM, time(NULL)); -} - -void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - GHashTable *components; - gchar *nick; - - if (!args || !args[1] || !gc) - return; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - nick = irc_mask_nick(from); - - g_hash_table_insert(components, g_strdup("channel"), g_strdup(args[1])); - - serv_got_chat_invite(gc, args[1], nick, NULL, components); - g_free(nick); -} - -void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *buf; - - if (!args || !args[1] || !gc) - return; - - buf = g_strdup_printf(_("Joining %s requires an invitation."), args[1]); - purple_notify_error(gc, _("Invitation only"), _("Invitation only"), buf); - g_free(buf); -} - -void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char **nicks; - struct irc_buddy *ib; - int i; - - if (!args || !args[1]) - return; - - nicks = g_strsplit(args[1], " ", -1); - - for (i = 0; nicks[i]; i++) { - if ((ib = g_hash_table_lookup(irc->buddies, (gconstpointer)nicks[i])) == NULL) { - continue; - } - ib->flag = TRUE; - } - - g_strfreev(nicks); - - g_hash_table_foreach(irc->buddies, (GHFunc)irc_buddy_status, (gpointer)irc); - irc->ison_outstanding = FALSE; -} - -static void irc_buddy_status(char *name, struct irc_buddy *ib, struct irc_conn *irc) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleBuddy *buddy = purple_find_buddy(irc->account, name); - - if (!gc || !buddy) - return; - - if (ib->online && !ib->flag) { - purple_prpl_got_user_status(irc->account, name, "offline", NULL); - ib->online = FALSE; - } else if (!ib->online && ib->flag) { - purple_prpl_got_user_status(irc->account, name, "available", NULL); - ib->online = TRUE; - } -} - -void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *nick = irc_mask_nick(from), *userhost; - struct irc_buddy *ib; - static int id = 1; - - if (!gc) { - g_free(nick); - return; - } - - if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { - /* We are joining a channel for the first time */ - serv_got_joined_chat(gc, id++, args[0]); - g_free(nick); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - args[0], - irc->account); - - if (convo == NULL) { - purple_debug_error("irc", "tried to join %s but couldn't\n", args[0]); - return; - } - purple_conversation_set_data(convo, IRC_NAMES_FLAG, - GINT_TO_POINTER(FALSE)); - /* Until purple_conversation_present does something that - * one would expect in Pidgin, this call produces buggy - * behavior both for the /join and auto-join cases. */ - /* purple_conversation_present(convo); */ - return; - } - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account); - if (convo == NULL) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); - g_free(nick); - return; - } - - userhost = irc_mask_userhost(from); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nick, userhost, PURPLE_CBFLAGS_NONE, TRUE); - - if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) { - ib->flag = TRUE; - irc_buddy_status(nick, ib, irc); - } - - g_free(userhost); - g_free(nick); -} - -void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account); - char *nick = irc_mask_nick(from), *buf; - - if (!gc) { - g_free(nick); - return; - } - - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]); - g_free(nick); - return; - } - - if (!purple_utf8_strcasecmp(purple_connection_get_display_name(gc), args[1])) { - buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(buf); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), args[1], buf); - g_free(buf); - } - - g_free(nick); - return; -} - -void irc_msg_mode(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - char *nick = irc_mask_nick(from), *buf; - - if (*args[0] == '#' || *args[0] == '&') { /* Channel */ - char *escaped; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); - g_free(nick); - return; - } - escaped = (args[2] != NULL) ? g_markup_escape_text(args[2], -1) : NULL; - buf = g_strdup_printf(_("mode (%s %s) by %s"), args[1], escaped ? escaped : "", nick); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(escaped); - g_free(buf); - if(args[2]) { - PurpleConvChatBuddyFlags newflag, flags; - char *mcur, *cur, *end, *user; - gboolean add = FALSE; - mcur = args[1]; - cur = args[2]; - while (*cur && *mcur) { - if ((*mcur == '+') || (*mcur == '-')) { - add = (*mcur == '+') ? TRUE : FALSE; - mcur++; - continue; - } - end = strchr(cur, ' '); - if (!end) - end = cur + strlen(cur); - user = g_strndup(cur, end - cur); - flags = purple_conv_chat_user_get_flags(PURPLE_CONV_CHAT(convo), user); - newflag = PURPLE_CBFLAGS_NONE; - if (*mcur == 'o') - newflag = PURPLE_CBFLAGS_OP; - else if (*mcur =='h') - newflag = PURPLE_CBFLAGS_HALFOP; - else if (*mcur == 'v') - newflag = PURPLE_CBFLAGS_VOICE; - else if(irc->mode_chars - && strchr(irc->mode_chars, '~') && (*mcur == 'q')) - newflag = PURPLE_CBFLAGS_FOUNDER; - if (newflag) { - if (add) - flags |= newflag; - else - flags &= ~newflag; - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), user, flags); - } - g_free(user); - cur = end; - if (*cur) - cur++; - if (*mcur) - mcur++; - } - } - } else { /* User */ - } - g_free(nick); -} - -void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *conv; - GSList *chats; - char *nick = irc_mask_nick(from); - - irc->nickused = FALSE; - - if (!gc) { - g_free(nick); - return; - } - chats = gc->buddy_chats; - - if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { - purple_connection_set_display_name(gc, args[0]); - } - - while (chats) { - PurpleConvChat *chat = PURPLE_CONV_CHAT(chats->data); - /* This is ugly ... */ - if (purple_conv_chat_find_user(chat, nick)) - purple_conv_chat_rename_user(chat, nick, args[0]); - chats = chats->next; - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, nick, - irc->account); - if (conv != NULL) - purple_conversation_set_name(conv, args[0]); - - g_free(nick); -} - -void irc_msg_badnick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - if (purple_connection_get_state(gc) == PURPLE_CONNECTED) { - purple_notify_error(gc, _("Invalid nickname"), - _("Invalid nickname"), - _("Your selected nickname was rejected by the server. It probably contains invalid characters.")); - - } else { - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Your selected account name was rejected by the server. It probably contains invalid characters.")); - } -} - -void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *newnick, *buf, *end; - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[1]) - return; - - if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) { - /* We only want to do the following dance if the connection - has not been successfully completed. If it has, just - notify the user that their /nick command didn't go. */ - buf = g_strdup_printf(_("The nickname \"%s\" is already being used."), - irc->reqnick); - purple_notify_error(gc, _("Nickname in use"), - _("Nickname in use"), buf); - g_free(buf); - g_free(irc->reqnick); - irc->reqnick = NULL; - return; - } - - if (strlen(args[1]) < strlen(irc->reqnick) || irc->nickused) - newnick = g_strdup(args[1]); - else - newnick = g_strdup_printf("%s0", args[1]); - end = newnick + strlen(newnick) - 1; - /* try fallbacks */ - if((*end < '9') && (*end >= '1')) { - *end = *end + 1; - } else *end = '1'; - - g_free(irc->reqnick); - irc->reqnick = newnick; - irc->nickused = TRUE; - - purple_connection_set_display_name( - purple_account_get_connection(irc->account), newnick); - - buf = irc_format(irc, "vn", "NICK", newnick); - irc_send(irc, buf); - g_free(buf); -} - -void irc_msg_notice(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!args || !args[0] || !args[1]) - return; - - irc_msg_handle_privmsg(irc, name, from, args[0], args[1], TRUE); -} - -void irc_msg_nochangenick(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[2] || !gc) - return; - - purple_notify_error(gc, _("Cannot change nick"), _("Could not change nick"), args[2]); -} - -void irc_msg_part(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *nick, *msg, *channel; - - if (!args || !args[0] || !gc) - return; - - /* Undernet likes to :-quote the channel name, for no good reason - * that I can see. This catches that. */ - channel = (args[0][0] == ':') ? &args[0][1] : args[0]; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, channel, irc->account); - if (!convo) { - purple_debug(PURPLE_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", channel); - return; - } - - nick = irc_mask_nick(from); - if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) { - char *escaped = args[1] ? g_markup_escape_text(args[1], -1) : NULL; - msg = g_strdup_printf(_("You have parted the channel%s%s"), - (args[1] && *args[1]) ? ": " : "", - (escaped && *escaped) ? escaped : ""); - g_free(escaped); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - msg = args[1] ? irc_mirc2txt(args[1]) : NULL; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nick, msg); - g_free(msg); - } - g_free(nick); -} - -void irc_msg_ping(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - char *buf; - if (!args || !args[0]) - return; - - buf = irc_format(irc, "v:", "PONG", args[0]); - irc_send(irc, buf); - g_free(buf); -} - -void irc_msg_pong(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConversation *convo; - PurpleConnection *gc; - char **parts, *msg; - time_t oldstamp; - - if (!args || !args[1]) - return; - - parts = g_strsplit(args[1], " ", 2); - - if (!parts[0] || !parts[1]) { - g_strfreev(parts); - return; - } - - if (sscanf(parts[1], "%lu", &oldstamp) != 1) { - msg = g_strdup(_("Error: invalid PONG from server")); - } else { - msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); - } - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, parts[0], irc->account); - g_strfreev(parts); - if (convo) { - if (purple_conversation_get_type (convo) == PURPLE_CONV_TYPE_CHAT) - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "PONG", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - else - purple_conv_im_write(PURPLE_CONV_IM(convo), "PONG", msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - } else { - gc = purple_account_get_connection(irc->account); - if (!gc) { - g_free(msg); - return; - } - purple_notify_info(gc, NULL, "PONG", msg); - } - g_free(msg); -} - -void irc_msg_privmsg(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - if (!args || !args[0] || !args[1]) - return; - - irc_msg_handle_privmsg(irc, name, from, args[0], args[1], FALSE); -} - -static void irc_msg_handle_privmsg(struct irc_conn *irc, const char *name, const char *from, const char *to, const char *rawmsg, gboolean notice) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *tmp; - char *msg; - char *nick; - - if (!gc) - return; - - nick = irc_mask_nick(from); - tmp = irc_parse_ctcp(irc, nick, to, rawmsg, notice); - if (!tmp) { - g_free(nick); - return; - } - - msg = irc_escape_privmsg(tmp, -1); - g_free(tmp); - - tmp = irc_mirc2html(msg); - g_free(msg); - msg = tmp; - if (notice) { - tmp = g_strdup_printf("(notice) %s", msg); - g_free(msg); - msg = tmp; - } - - if (!purple_utf8_strcasecmp(to, purple_connection_get_display_name(gc))) { - serv_got_im(gc, nick, msg, 0, time(NULL)); - } else { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, irc_nick_skip_mode(irc, to), irc->account); - if (convo) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); - else - purple_debug_error("irc", "Got a %s on %s, which does not exist\n", - notice ? "NOTICE" : "PRIVMSG", to); - } - g_free(msg); - g_free(nick); -} - -void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - PurpleConversation *convo; - char *msg; - - if (!args || !args[1] || !args[2] || !gc) - return; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account); - if (convo) { - /* This is a channel we're already in; for some reason, - * freenode feels the need to notify us that in some - * hypothetical other situation this might not have - * succeeded. Suppress that. */ - return; - } - - msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]); - purple_notify_error(gc, _("Cannot join channel"), msg, args[2]); - g_free(msg); -} - -void irc_msg_quit(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - struct irc_buddy *ib; - char *data[2]; - - if (!args || !args[0] || !gc) - return; - - data[0] = irc_mask_nick(from); - data[1] = args[0]; - /* XXX this should have an API, I shouldn't grab this directly */ - g_slist_foreach(gc->buddy_chats, (GFunc)irc_chat_remove_buddy, data); - - if ((ib = g_hash_table_lookup(irc->buddies, data[0])) != NULL) { - ib->flag = FALSE; - irc_buddy_status(data[0], ib, irc); - } - g_free(data[0]); - - return; -} - -void irc_msg_unavailable(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - - if (!args || !args[1]) - return; - - purple_notify_error(gc, NULL, _("Nick or channel is temporarily unavailable."), args[1]); -} - -void irc_msg_wallops(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - PurpleConnection *gc = purple_account_get_connection(irc->account); - char *nick, *msg; - - if (!args || !args[0] || !gc) - return; - - nick = irc_mask_nick(from); - msg = g_strdup_printf (_("Wallops from %s"), nick); - g_free(nick); - purple_notify_info(gc, NULL, msg, args[0]); - g_free(msg); -} - -void irc_msg_ignore(struct irc_conn *irc, const char *name, const char *from, char **args) -{ - return; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/parse.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/parse.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/parse.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/irc/parse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,750 +0,0 @@ -/** - * @file parse.c - * - * purple - * - * Copyright (C) 2003, Ethan Blanton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "conversation.h" -#include "notify.h" -#include "debug.h" -#include "util.h" -#include "cmds.h" -#include "irc.h" - -#include -#include -#include - -static char *irc_send_convert(struct irc_conn *irc, const char *string); -static char *irc_recv_convert(struct irc_conn *irc, const char *string); - -static void irc_parse_error_cb(struct irc_conn *irc, char *input); - -static char *irc_mirc_colors[16] = { - "white", "black", "blue", "dark green", "red", "brown", "purple", - "orange", "yellow", "green", "teal", "cyan", "light blue", - "pink", "grey", "light grey" }; - -extern PurplePlugin *_irc_plugin; - -/*typedef void (*IRCMsgCallback)(struct irc_conn *irc, char *from, char *name, char **args);*/ -static struct _irc_msg { - char *name; - char *format; - void (*cb)(struct irc_conn *irc, const char *name, const char *from, char **args); -} _irc_msgs[] = { - { "005", "n*", irc_msg_features }, /* Feature list */ - { "251", "n:", irc_msg_luser }, /* Client & Server count */ - { "255", "n:", irc_msg_luser }, /* Client & Server count Mk. II */ - { "301", "nn:", irc_msg_away }, /* User is away */ - { "303", "n:", irc_msg_ison }, /* ISON reply */ - { "311", "nnvvv:", irc_msg_whois }, /* Whois user */ - { "312", "nnv:", irc_msg_whois }, /* Whois server */ - { "313", "nn:", irc_msg_whois }, /* Whois ircop */ - { "317", "nnvv", irc_msg_whois }, /* Whois idle */ - { "318", "nt:", irc_msg_endwhois }, /* End of WHOIS */ - { "319", "nn:", irc_msg_whois }, /* Whois channels */ - { "320", "nn:", irc_msg_whois }, /* Whois (fn ident) */ - { "314", "nnnvv:", irc_msg_whois }, /* Whowas user */ - { "369", "nt:", irc_msg_endwhois }, /* End of WHOWAS */ - { "321", "*", irc_msg_list }, /* Start of list */ - { "322", "ncv:", irc_msg_list }, /* List. */ - { "323", ":", irc_msg_list }, /* End of list. */ - { "324", "ncv:", irc_msg_chanmode }, /* Channel modes */ - { "331", "nc:", irc_msg_topic }, /* No channel topic */ - { "332", "nc:", irc_msg_topic }, /* Channel topic */ - { "333", "*", irc_msg_ignore }, /* Topic setter stuff */ - { "353", "nvc:", irc_msg_names }, /* Names list */ - { "366", "nc:", irc_msg_names }, /* End of names */ - { "367", "ncnnv", irc_msg_ban }, /* Ban list */ - { "368", "nc:", irc_msg_ban }, /* End of ban list */ - { "372", "n:", irc_msg_motd }, /* MOTD */ - { "375", "n:", irc_msg_motd }, /* Start MOTD */ - { "376", "n:", irc_msg_motd }, /* End of MOTD */ - { "391", "nv:", irc_msg_time }, /* Time reply */ - { "401", "nt:", irc_msg_nonick }, /* No such nick/chan */ - { "406", "nt:", irc_msg_nonick }, /* No such nick for WHOWAS */ - { "403", "nc:", irc_msg_nochan }, /* No such channel */ - { "404", "nt:", irc_msg_nosend }, /* Cannot send to chan */ - { "421", "nv:", irc_msg_unknown }, /* Unknown command */ - { "432", "vn:", irc_msg_badnick }, /* Erroneous nickname */ - { "433", "vn:", irc_msg_nickused }, /* Nickname already in use */ - { "437", "nc:", irc_msg_unavailable }, /* Nick/channel is unavailable */ - { "438", "nn:", irc_msg_nochangenick }, /* Nick may not change */ - { "442", "nc:", irc_msg_notinchan }, /* Not in channel */ - { "473", "nc:", irc_msg_inviteonly }, /* Tried to join invite-only */ - { "474", "nc:", irc_msg_banned }, /* Banned from channel */ - { "477", "nc:", irc_msg_regonly }, /* Registration Required */ - { "478", "nct:", irc_msg_banfull }, /* Banlist is full */ - { "482", "nc:", irc_msg_notop }, /* Need to be op to do that */ - { "501", "n:", irc_msg_badmode }, /* Unknown mode flag */ - { "506", "nc:", irc_msg_nosend }, /* Must identify to send */ - { "515", "nc:", irc_msg_regonly }, /* Registration required */ - { "invite", "n:", irc_msg_invite }, /* Invited */ - { "join", ":", irc_msg_join }, /* Joined a channel */ - { "kick", "cn:", irc_msg_kick }, /* KICK */ - { "mode", "tv:", irc_msg_mode }, /* MODE for channel */ - { "nick", ":", irc_msg_nick }, /* Nick change */ - { "notice", "t:", irc_msg_notice }, /* NOTICE recv */ - { "part", "c:", irc_msg_part }, /* Parted a channel */ - { "ping", ":", irc_msg_ping }, /* Received PING from server */ - { "pong", "v:", irc_msg_pong }, /* Received PONG from server */ - { "privmsg", "t:", irc_msg_privmsg }, /* Received private message */ - { "topic", "c:", irc_msg_topic }, /* TOPIC command */ - { "quit", ":", irc_msg_quit }, /* QUIT notice */ - { "wallops", ":", irc_msg_wallops }, /* WALLOPS command */ - { NULL, NULL, NULL } -}; - -static struct _irc_user_cmd { - char *name; - char *format; - IRCCmdCallback cb; - char *help; -} _irc_cmds[] = { - { "action", ":", irc_cmd_ctcp_action, N_("action <action to perform>: Perform an action.") }, - { "away", ":", irc_cmd_away, N_("away [message]: Set an away message, or use no message to return from being away.") }, - { "ctcp", "t:", irc_cmd_ctcp, N_("ctcp : sends ctcp msg to nick.") }, - { "chanserv", ":", irc_cmd_service, N_("chanserv: Send a command to chanserv") }, - { "deop", ":", irc_cmd_op, N_("deop <nick1> [nick2] ...: Remove channel operator status from someone. You must be a channel operator to do this.") }, - { "devoice", ":", irc_cmd_op, N_("devoice <nick1> [nick2] ...: Remove channel voice status from someone, preventing them from speaking if the channel is moderated (+m). You must be a channel operator to do this.") }, - { "invite", ":", irc_cmd_invite, N_("invite <nick> [room]: Invite someone to join you in the specified channel, or the current channel.") }, - { "j", "cv", irc_cmd_join, N_("j <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed.") }, - { "join", "cv", irc_cmd_join, N_("join <room1>[,room2][,...] [key1[,key2][,...]]: Enter one or more channels, optionally providing a channel key for each if needed.") }, - { "kick", "n:", irc_cmd_kick, N_("kick <nick> [message]: Remove someone from a channel. You must be a channel operator to do this.") }, - { "list", ":", irc_cmd_list, N_("list: Display a list of chat rooms on the network. Warning, some servers may disconnect you upon doing this.") }, - { "me", ":", irc_cmd_ctcp_action, N_("me <action to perform>: Perform an action.") }, - { "memoserv", ":", irc_cmd_service, N_("memoserv: Send a command to memoserv") }, - { "mode", ":", irc_cmd_mode, N_("mode <+|-><A-Za-z> <nick|channel>: Set or unset a channel or user mode.") }, - { "msg", "t:", irc_cmd_privmsg, N_("msg <nick> <message>: Send a private message to a user (as opposed to a channel).") }, - { "names", "c", irc_cmd_names, N_("names [channel]: List the users currently in a channel.") }, - { "nick", "n", irc_cmd_nick, N_("nick <new nickname>: Change your nickname.") }, - { "nickserv", ":", irc_cmd_service, N_("nickserv: Send a command to nickserv") }, - { "notice", "t:", irc_cmd_privmsg, N_("notice <target<: Send a notice to a user or channel.") }, - { "op", ":", irc_cmd_op, N_("op <nick1> [nick2] ...: Grant channel operator status to someone. You must be a channel operator to do this.") }, - { "operwall", ":", irc_cmd_wallops, N_("operwall <message>: If you don't know what this is, you probably can't use it.") }, - { "operserv", ":", irc_cmd_service, N_("operserv: Send a command to operserv") }, - { "part", "c:", irc_cmd_part, N_("part [room] [message]: Leave the current channel, or a specified channel, with an optional message.") }, - { "ping", "n", irc_cmd_ping, N_("ping [nick]: Asks how much lag a user (or the server if no user specified) has.") }, - { "query", "n:", irc_cmd_query, N_("query <nick> <message>: Send a private message to a user (as opposed to a channel).") }, - { "quit", ":", irc_cmd_quit, N_("quit [message]: Disconnect from the server, with an optional message.") }, - { "quote", "*", irc_cmd_quote, N_("quote [...]: Send a raw command to the server.") }, - { "remove", "n:", irc_cmd_remove, N_("remove <nick> [message]: Remove someone from a room. You must be a channel operator to do this.") }, - { "time", "", irc_cmd_time, N_("time: Displays the current local time at the IRC server.") }, - { "topic", ":", irc_cmd_topic, N_("topic [new topic]: View or change the channel topic.") }, - { "umode", ":", irc_cmd_mode, N_("umode <+|-><A-Za-z>: Set or unset a user mode.") }, - { "version", ":", irc_cmd_ctcp_version, N_("version [nick]: send CTCP VERSION request to a user") }, - { "voice", ":", irc_cmd_op, N_("voice <nick1> [nick2] ...: Grant channel voice status to someone. You must be a channel operator to do this.") }, - { "wallops", ":", irc_cmd_wallops, N_("wallops <message>: If you don't know what this is, you probably can't use it.") }, - { "whois", "tt", irc_cmd_whois, N_("whois [server] <nick>: Get information on a user.") }, - { "whowas", "t", irc_cmd_whowas, N_("whowas <nick>: Get information on a user that has logged off.") }, - { NULL, NULL, NULL, NULL } -}; - -static PurpleCmdRet irc_parse_purple_cmd(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **error, void *data) -{ - PurpleConnection *gc; - struct irc_conn *irc; - struct _irc_user_cmd *cmdent; - - gc = purple_conversation_get_gc(conv); - if (!gc) - return PURPLE_CMD_RET_FAILED; - - irc = gc->proto_data; - - if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL) - return PURPLE_CMD_RET_FAILED; - - (cmdent->cb)(irc, cmd, purple_conversation_get_name(conv), (const char **)args); - - return PURPLE_CMD_RET_OK; -} - -static void irc_register_command(struct _irc_user_cmd *c) -{ - PurpleCmdFlag f; - char args[10]; - char *format; - size_t i; - - f = PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY - | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS; - - format = c->format; - - for (i = 0; (i < (sizeof(args) - 1)) && *format; i++, format++) - switch (*format) { - case 'v': - case 'n': - case 'c': - case 't': - args[i] = 'w'; - break; - case ':': - case '*': - args[i] = 's'; - break; - } - - args[i] = '\0'; - - purple_cmd_register(c->name, args, PURPLE_CMD_P_PRPL, f, "prpl-irc", - irc_parse_purple_cmd, _(c->help), NULL); -} - -void irc_register_commands(void) -{ - struct _irc_user_cmd *c; - - for (c = _irc_cmds; c && c->name; c++) - irc_register_command(c); -} - -static char *irc_send_convert(struct irc_conn *irc, const char *string) -{ - char *utf8; - GError *err = NULL; - gchar **encodings; - const gchar *enclist; - - enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); - encodings = g_strsplit(enclist, ",", 2); - - if (encodings[0] == NULL || !g_ascii_strcasecmp("UTF-8", encodings[0])) { - g_strfreev(encodings); - return NULL; - } - - utf8 = g_convert(string, strlen(string), encodings[0], "UTF-8", NULL, NULL, &err); - if (err) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Send conversion error: %s\n", err->message); - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Sending as UTF-8 instead of %s\n", encodings[0]); - utf8 = g_strdup(string); - g_error_free(err); - } - g_strfreev(encodings); - - return utf8; -} - -static char *irc_recv_convert(struct irc_conn *irc, const char *string) -{ - char *utf8 = NULL; - const gchar *charset, *enclist; - gchar **encodings; - gboolean autodetect; - int i; - - enclist = purple_account_get_string(irc->account, "encoding", IRC_DEFAULT_CHARSET); - encodings = g_strsplit(enclist, ",", -1); - - if (encodings[0] == NULL) { - g_strfreev(encodings); - return purple_utf8_salvage(string); - } - - autodetect = purple_account_get_bool(irc->account, "autodetect_utf8", IRC_DEFAULT_AUTODETECT); - - if (autodetect && g_utf8_validate(string, -1, NULL)) { - return g_strdup(string); - } - - for (i = 0; encodings[i] != NULL; i++) { - charset = encodings[i]; - while (*charset == ' ') - charset++; - - if (!g_ascii_strcasecmp("UTF-8", charset)) { - if (g_utf8_validate(string, -1, NULL)) - utf8 = g_strdup(string); - } else { - utf8 = g_convert(string, -1, "UTF-8", charset, NULL, NULL, NULL); - } - - if (utf8) { - g_strfreev(encodings); - return utf8; - } - } - g_strfreev(encodings); - - return purple_utf8_salvage(string); -} - -/* This function is shamelessly stolen from glib--it is an old version of the - * private function append_escaped_text, used by g_markup_escape_text, whose - * behavior changed in glib 2.12. */ -static void irc_append_escaped_text(GString *str, const char *text, gssize length) -{ - const char *p = text; - const char *end = text + length; - const char *next = NULL; - - while(p != end) { - next = g_utf8_next_char(p); - - switch(*p) { - case '&': - g_string_append(str, "&"); - break; - case '<': - g_string_append(str, "<"); - break; - case '>': - g_string_append(str, ">"); - break; - case '\'': - g_string_append(str, "'"); - break; - case '"': - g_string_append(str, """); - break; - default: - g_string_append_len(str, p, next - p); - break; - } - - p = next; - } -} - -/* This function is shamelessly stolen from glib--it is an old version of the - * function g_markup_escape_text, whose behavior changed in glib 2.12. */ -char *irc_escape_privmsg(const char *text, gssize length) -{ - GString *str; - - g_return_val_if_fail(text != NULL, NULL); - - if(length < 0) - length = strlen(text); - - str = g_string_sized_new(length); - - irc_append_escaped_text(str, text, length); - - return g_string_free(str, FALSE); -} - -/* XXX tag closings are not necessarily correctly nested here! If we - * get a ^O or reach the end of the string and there are open - * tags, they are closed in a fixed order ... this means, for - * example, you might see some text with - * various attributes (notice that B and FONT overlap - * and are not cleanly nested). This is imminently fixable but - * I am not fixing it right now. - */ -char *irc_mirc2html(const char *string) -{ - const char *cur, *end; - char fg[3] = "\0\0", bg[3] = "\0\0"; - int fgnum, bgnum; - int font = 0, bold = 0, underline = 0, italic = 0; - GString *decoded; - - if (string == NULL) - return NULL; - - decoded = g_string_sized_new(strlen(string)); - - cur = string; - do { - end = strpbrk(cur, "\002\003\007\017\026\037"); - - decoded = g_string_append_len(decoded, cur, end ? end - cur : strlen(cur)); - cur = end ? end : cur + strlen(cur); - - switch (*cur) { - case '\002': - cur++; - if (!bold) { - decoded = g_string_append(decoded, ""); - bold = TRUE; - } else { - decoded = g_string_append(decoded, ""); - bold = FALSE; - } - break; - case '\003': - cur++; - fg[0] = fg[1] = bg[0] = bg[1] = '\0'; - if (isdigit(*cur)) - fg[0] = *cur++; - if (isdigit(*cur)) - fg[1] = *cur++; - if (*cur == ',') { - cur++; - if (isdigit(*cur)) - bg[0] = *cur++; - if (isdigit(*cur)) - bg[1] = *cur++; - } - if (font) { - decoded = g_string_append(decoded, "
"); - font = FALSE; - } - - if (fg[0]) { - fgnum = atoi(fg); - if (fgnum < 0 || fgnum > 15) - continue; - font = TRUE; - g_string_append_printf(decoded, "= 0 && bgnum < 16) - g_string_append_printf(decoded, " BACK=\"%s\"", irc_mirc_colors[bgnum]); - } - decoded = g_string_append_c(decoded, '>'); - } - break; - case '\011': - cur++; - if (!italic) { - decoded = g_string_append(decoded, ""); - italic = TRUE; - } else { - decoded = g_string_append(decoded, ""); - italic = FALSE; - } - break; - case '\037': - cur++; - if (!underline) { - decoded = g_string_append(decoded, ""); - underline = TRUE; - } else { - decoded = g_string_append(decoded, ""); - underline = FALSE; - } - break; - case '\007': - case '\026': - cur++; - break; - case '\017': - cur++; - /* fallthrough */ - case '\000': - if (bold) - decoded = g_string_append(decoded, ""); - if (italic) - decoded = g_string_append(decoded, "
"); - if (underline) - decoded = g_string_append(decoded, ""); - if (font) - decoded = g_string_append(decoded, ""); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Unexpected mIRC formatting character %d\n", *cur); - } - } while (*cur); - - return g_string_free(decoded, FALSE); -} - -char *irc_mirc2txt (const char *string) -{ - char *result; - int i, j; - - if (string == NULL) - return NULL; - - result = g_strdup (string); - - for (i = 0, j = 0; result[i]; i++) { - switch (result[i]) { - case '\002': - case '\003': - /* Foreground color */ - if (isdigit(result[i + 1])) - i++; - if (isdigit(result[i + 1])) - i++; - /* Optional comma and background color */ - if (result[i + 1] == ',') { - i++; - if (isdigit(result[i + 1])) - i++; - if (isdigit(result[i + 1])) - i++; - } - /* Note that i still points to the last character - * of the color selection string. */ - continue; - case '\007': - case '\017': - case '\026': - case '\037': - continue; - default: - result[j++] = result[i]; - } - } - result[j] = '\0'; - return result; -} - -const char *irc_nick_skip_mode(struct irc_conn *irc, const char *nick) -{ - static const char *default_modes = "@+%&"; - const char *mode_chars; - - mode_chars = irc->mode_chars ? irc->mode_chars : default_modes; - - while (strchr(mode_chars, *nick) != NULL) - nick++; - - return nick; -} - -gboolean irc_ischannel(const char *string) -{ - return (string[0] == '#' || string[0] == '&'); -} - -char *irc_parse_ctcp(struct irc_conn *irc, const char *from, const char *to, const char *msg, int notice) -{ - PurpleConnection *gc; - const char *cur = msg + 1; - char *buf, *ctcp; - time_t timestamp; - - /* Note that this is NOT correct w.r.t. multiple CTCPs in one - * message and low-level quoting ... but if you want that crap, - * use a real IRC client. */ - - if (msg[0] != '\001' || msg[strlen(msg) - 1] != '\001') - return g_strdup(msg); - - if (!strncmp(cur, "ACTION ", 7)) { - cur += 7; - buf = g_strdup_printf("/me %s", cur); - buf[strlen(buf) - 1] = '\0'; - return buf; - } else if (!strncmp(cur, "PING ", 5)) { - if (notice) { /* reply */ - /* TODO: Should this read in the timestamp as a double? */ - sscanf(cur, "PING %lu", ×tamp); - gc = purple_account_get_connection(irc->account); - if (!gc) - return NULL; - buf = g_strdup_printf(_("Reply time from %s: %lu seconds"), from, time(NULL) - timestamp); - purple_notify_info(gc, _("PONG"), _("CTCP PING reply"), buf); - g_free(buf); - return NULL; - } else { - buf = irc_format(irc, "vt:", "NOTICE", from, msg); - irc_send(irc, buf); - g_free(buf); - } - } else if (!strncmp(cur, "VERSION", 7) && !notice) { - buf = irc_format(irc, "vt:", "NOTICE", from, "\001VERSION Purple IRC\001"); - irc_send(irc, buf); - g_free(buf); - } else if (!strncmp(cur, "DCC SEND ", 9)) { - irc_dccsend_recv(irc, from, msg + 10); - return NULL; - } - - ctcp = g_strdup(msg + 1); - ctcp[strlen(ctcp) - 1] = '\0'; - buf = g_strdup_printf("Received CTCP '%s' (to %s) from %s", ctcp, to, from); - g_free(ctcp); - return buf; -} - -void irc_msg_table_build(struct irc_conn *irc) -{ - int i; - - if (!irc || !irc->msgs) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a message table on a bogus structure\n"); - return; - } - - for (i = 0; _irc_msgs[i].name; i++) { - g_hash_table_insert(irc->msgs, (gpointer)_irc_msgs[i].name, (gpointer)&_irc_msgs[i]); - } -} - -void irc_cmd_table_build(struct irc_conn *irc) -{ - int i; - - if (!irc || !irc->cmds) { - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Attempt to build a command table on a bogus structure\n"); - return; - } - - for (i = 0; _irc_cmds[i].name ; i++) { - g_hash_table_insert(irc->cmds, (gpointer)_irc_cmds[i].name, (gpointer)&_irc_cmds[i]); - } -} - -char *irc_format(struct irc_conn *irc, const char *format, ...) -{ - GString *string = g_string_new(""); - char *tok, *tmp; - const char *cur; - va_list ap; - - va_start(ap, format); - for (cur = format; *cur; cur++) { - if (cur != format) - g_string_append_c(string, ' '); - - tok = va_arg(ap, char *); - switch (*cur) { - case 'v': - g_string_append(string, tok); - break; - case ':': - g_string_append_c(string, ':'); - /* no break! */ - case 't': - case 'n': - case 'c': - tmp = irc_send_convert(irc, tok); - g_string_append(string, tmp ? tmp : tok); - g_free(tmp); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "irc", "Invalid format character '%c'\n", *cur); - break; - } - } - va_end(ap); - g_string_append(string, "\r\n"); - return (g_string_free(string, FALSE)); -} - -void irc_parse_msg(struct irc_conn *irc, char *input) -{ - struct _irc_msg *msgent; - char *cur, *end, *tmp, *from, *msgname, *fmt, **args, *msg; - guint i; - PurpleConnection *gc = purple_account_get_connection(irc->account); - - irc->recv_time = time(NULL); - - /* - * The data passed to irc-receiving-text is the raw protocol data. - * TODO: It should be passed as an array of bytes and a length - * instead of a null terminated string. - */ - purple_signal_emit(_irc_plugin, "irc-receiving-text", gc, &input); - - if (!strncmp(input, "PING ", 5)) { - msg = irc_format(irc, "vv", "PONG", input + 5); - irc_send(irc, msg); - g_free(msg); - return; - } else if (!strncmp(input, "ERROR ", 6)) { - if (g_utf8_validate(input, -1, NULL)) { - char *tmp = g_strdup_printf("%s\n%s", _("Disconnected."), input); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } else - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected.")); - return; - } - - if (input[0] != ':' || (cur = strchr(input, ' ')) == NULL) { - irc_parse_error_cb(irc, input); - return; - } - - from = g_strndup(&input[1], cur - &input[1]); - cur++; - end = strchr(cur, ' '); - if (!end) - end = cur + strlen(cur); - - tmp = g_strndup(cur, end - cur); - msgname = g_ascii_strdown(tmp, -1); - g_free(tmp); - - if ((msgent = g_hash_table_lookup(irc->msgs, msgname)) == NULL) { - irc_msg_default(irc, "", from, &input); - g_free(msgname); - g_free(from); - return; - } - g_free(msgname); - - args = g_new0(char *, strlen(msgent->format)); - for (cur = end, fmt = msgent->format, i = 0; fmt[i] && *cur++; i++) { - switch (fmt[i]) { - case 'v': - if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); - args[i] = g_strndup(cur, end - cur); - cur += end - cur; - break; - case 't': - case 'n': - case 'c': - if (!(end = strchr(cur, ' '))) end = cur + strlen(cur); - tmp = g_strndup(cur, end - cur); - args[i] = irc_recv_convert(irc, tmp); - g_free(tmp); - cur += end - cur; - break; - case ':': - if (*cur == ':') cur++; - args[i] = irc_recv_convert(irc, cur); - cur = cur + strlen(cur); - break; - case '*': - args[i] = g_strdup(cur); - cur = cur + strlen(cur); - break; - default: - purple_debug(PURPLE_DEBUG_ERROR, "irc", "invalid message format character '%c'\n", fmt[i]); - break; - } - } - tmp = irc_recv_convert(irc, from); - (msgent->cb)(irc, msgent->name, tmp, args); - g_free(tmp); - for (i = 0; i < strlen(msgent->format); i++) { - g_free(args[i]); - } - g_free(args); - g_free(from); -} - -static void irc_parse_error_cb(struct irc_conn *irc, char *input) -{ - char *clean; - /* This really should be escaped somehow that you can tell what - * the junk was -- but as it is, it can crash glib. */ - clean = purple_utf8_salvage(input); - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", clean); - g_free(clean); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "adhoccommands.h" -#include -#include "internal.h" -#include "xdata.h" -#include "iq.h" -#include "request.h" - -static void do_adhoc_ignoreme(JabberStream *js, ...) { - /* we don't have to do anything */ -} - -typedef struct _JabberAdHocActionInfo { - char *sessionid; - char *who; - char *node; - GList *actionslist; -} JabberAdHocActionInfo; - -static void -jabber_adhoc_got_buddy_list(JabberStream *js, const char *from, xmlnode *query) -{ - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - xmlnode *item; - - if ((jid = jabber_id_new(from))) { - if (jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(!jbr) - return; - - if(jbr->commands) { - /* since the list we just received is complete, wipe the old one */ - while(jbr->commands) { - JabberAdHocCommands *cmd = jbr->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); - } - } - - for(item = query->child; item; item = item->next) { - JabberAdHocCommands *cmd; - if(item->type != XMLNODE_TYPE_TAG) - continue; - if(strcmp(item->name, "item")) - continue; - cmd = g_new0(JabberAdHocCommands, 1); - - cmd->jid = g_strdup(xmlnode_get_attrib(item,"jid")); - cmd->node = g_strdup(xmlnode_get_attrib(item,"node")); - cmd->name = g_strdup(xmlnode_get_attrib(item,"name")); - - jbr->commands = g_list_append(jbr->commands,cmd); - } -} - -void -jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query; - const char *node; - - if (type == JABBER_IQ_ERROR) - return; - - query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_ITEMS); - if (!query) - return; - node = xmlnode_get_attrib(query, "node"); - if (!purple_strequal(node, "http://jabber.org/protocol/commands")) - return; - - jabber_adhoc_got_buddy_list(js, from, query); -} - -static void jabber_adhoc_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -static void do_adhoc_action_cb(JabberStream *js, xmlnode *result, const char *actionhandle, gpointer user_data) { - xmlnode *command; - GList *action; - JabberAdHocActionInfo *actionInfo = user_data; - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - jabber_iq_set_callback(iq, jabber_adhoc_parse, NULL); - - xmlnode_set_attrib(iq->node, "to", actionInfo->who); - command = xmlnode_new_child(iq->node,"command"); - xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); - xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid); - xmlnode_set_attrib(command,"node",actionInfo->node); - - /* cancel is handled differently on ad-hoc commands than regular forms */ - if(!strcmp(xmlnode_get_namespace(result),"jabber:x:data") && !strcmp(xmlnode_get_attrib(result, "type"),"cancel")) { - xmlnode_set_attrib(command,"action","cancel"); - } else { - if(actionhandle) - xmlnode_set_attrib(command,"action",actionhandle); - xmlnode_insert_child(command,result); - } - - for(action = actionInfo->actionslist; action; action = g_list_next(action)) { - char *handle = action->data; - g_free(handle); - } - g_list_free(actionInfo->actionslist); - g_free(actionInfo->sessionid); - g_free(actionInfo->who); - g_free(actionInfo->node); - - jabber_iq_send(iq); -} - -static void -jabber_adhoc_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *command = xmlnode_get_child_with_namespace(packet, "command", "http://jabber.org/protocol/commands"); - const char *status = xmlnode_get_attrib(command,"status"); - xmlnode *xdata = xmlnode_get_child_with_namespace(command,"x","jabber:x:data"); - - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - if(!msg) - msg = g_strdup(_("Unknown Error")); - - purple_notify_error(NULL, _("Ad-Hoc Command Failed"), - _("Ad-Hoc Command Failed"), msg); - g_free(msg); - return; - } - - if(!status) - return; - - if(!strcmp(status,"completed")) { - /* display result */ - xmlnode *note = xmlnode_get_child(command,"note"); - - if(note) { - char *data = xmlnode_get_data(note); - purple_notify_info(NULL, from, data, NULL); - g_free(data); - } - - if(xdata) - jabber_x_data_request(js, xdata, (jabber_x_data_cb)do_adhoc_ignoreme, NULL); - return; - } - if(!strcmp(status,"executing")) { - /* this command needs more steps */ - xmlnode *actions, *action; - int actionindex = 0; - GList *actionslist = NULL; - JabberAdHocActionInfo *actionInfo; - if(!xdata) - return; /* shouldn't happen */ - - actions = xmlnode_get_child(command,"actions"); - if(!actions) { - JabberXDataAction *defaultaction = g_new0(JabberXDataAction, 1); - defaultaction->name = g_strdup(_("execute")); - defaultaction->handle = g_strdup("execute"); - actionslist = g_list_append(actionslist, defaultaction); - } else { - const char *defaultactionhandle = xmlnode_get_attrib(actions, "execute"); - int index = 0; - for(action = actions->child; action; action = action->next, ++index) { - if(action->type == XMLNODE_TYPE_TAG) { - JabberXDataAction *newaction = g_new0(JabberXDataAction, 1); - newaction->name = g_strdup(_(action->name)); - newaction->handle = g_strdup(action->name); - actionslist = g_list_append(actionslist, newaction); - if(defaultactionhandle && !strcmp(defaultactionhandle, action->name)) - actionindex = index; - } - } - } - - actionInfo = g_new0(JabberAdHocActionInfo, 1); - actionInfo->sessionid = g_strdup(xmlnode_get_attrib(command,"sessionid")); - actionInfo->who = g_strdup(from); - actionInfo->node = g_strdup(xmlnode_get_attrib(command,"node")); - actionInfo->actionslist = actionslist; - - jabber_x_data_request_with_actions(js,xdata,actionslist,actionindex,do_adhoc_action_cb,actionInfo); - } -} - -void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data) { - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - JabberAdHocCommands *cmd = data; - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleAccount *account = purple_buddy_get_account(buddy); - JabberStream *js = purple_account_get_connection(account)->proto_data; - - jabber_adhoc_execute(js, cmd); - } -} - -static void -jabber_adhoc_got_server_list(JabberStream *js, const char *from, xmlnode *query) -{ - xmlnode *item; - - if(!query) - return; - - /* clean current list (just in case there is one) */ - while(js->commands) { - JabberAdHocCommands *cmd = js->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - js->commands = g_list_delete_link(js->commands, js->commands); - } - - /* re-fill list */ - for(item = query->child; item; item = item->next) { - JabberAdHocCommands *cmd; - if(item->type != XMLNODE_TYPE_TAG) - continue; - if(strcmp(item->name, "item")) - continue; - cmd = g_new0(JabberAdHocCommands, 1); - cmd->jid = g_strdup(xmlnode_get_attrib(item,"jid")); - cmd->node = g_strdup(xmlnode_get_attrib(item,"node")); - cmd->name = g_strdup(xmlnode_get_attrib(item,"name")); - - js->commands = g_list_append(js->commands,cmd); - } - - if (js->state == JABBER_STREAM_CONNECTED) - purple_prpl_got_account_actions(purple_connection_get_account(js->gc)); -} - -static void -jabber_adhoc_server_got_list_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_DISCO_ITEMS); - - jabber_adhoc_got_server_list(js, from, query); - -} - -void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query) -{ - if (purple_strequal(from, js->user->domain)) { - jabber_adhoc_got_server_list(js, from, query); - } else { - jabber_adhoc_got_buddy_list(js, from, query); - } -} - -void jabber_adhoc_server_get_list(JabberStream *js) { - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", - NS_DISCO_ITEMS); - - xmlnode_set_attrib(iq->node,"to",js->user->domain); - xmlnode_set_attrib(query,"node","http://jabber.org/protocol/commands"); - - jabber_iq_set_callback(iq,jabber_adhoc_server_got_list_cb,NULL); - jabber_iq_send(iq); -} - -void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode *command = xmlnode_new_child(iq->node,"command"); - xmlnode_set_attrib(iq->node,"to",cmd->jid); - xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); - xmlnode_set_attrib(command,"node",cmd->node); - xmlnode_set_attrib(command,"action","execute"); - - jabber_iq_set_callback(iq,jabber_adhoc_parse,NULL); - - jabber_iq_send(iq); -} - -static void jabber_adhoc_server_execute(PurplePluginAction *action) { - JabberAdHocCommands *cmd = action->user_data; - if(cmd) { - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; - - jabber_adhoc_execute(js, cmd); - } -} - -void jabber_adhoc_init_server_commands(JabberStream *js, GList **m) { - GList *cmdlst; - JabberBuddy *jb; - - /* also add commands for other clients connected to the same account on another resource */ - char *accountname = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - if((jb = jabber_buddy_find(js, accountname, TRUE))) { - GList *iter; - for(iter = jb->resources; iter; iter = g_list_next(iter)) { - JabberBuddyResource *jbr = iter->data; - GList *riter; - for(riter = jbr->commands; riter; riter = g_list_next(riter)) { - JabberAdHocCommands *cmd = riter->data; - char *cmdname = g_strdup_printf("%s (%s)",cmd->name,jbr->name); - PurplePluginAction *act = purple_plugin_action_new(cmdname, jabber_adhoc_server_execute); - act->user_data = cmd; - *m = g_list_append(*m, act); - g_free(cmdname); - } - } - } - g_free(accountname); - - /* now add server commands */ - for(cmdlst = js->commands; cmdlst; cmdlst = g_list_next(cmdlst)) { - JabberAdHocCommands *cmd = cmdlst->data; - PurplePluginAction *act = purple_plugin_action_new(cmd->name, jabber_adhoc_server_execute); - act->user_data = cmd; - *m = g_list_append(*m, act); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/adhoccommands.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_ADHOCCOMMANDS_H_ -#define PURPLE_JABBER_ADHOCCOMMANDS_H_ - -#include "jabber.h" - -/* Implementation of XEP-0050 */ - -void jabber_adhoc_disco_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -void jabber_adhoc_execute(JabberStream *js, JabberAdHocCommands *cmd); - -void jabber_adhoc_execute_action(PurpleBlistNode *node, gpointer data); - -void jabber_adhoc_got_list(JabberStream *js, const char *from, xmlnode *query); - -void jabber_adhoc_server_get_list(JabberStream *js); - -void jabber_adhoc_init_server_commands(JabberStream *js, GList **m); - -#endif /* PURPLE_JABBER_ADHOCCOMMANDS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,545 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "debug.h" -#include "cipher.h" -#include "core.h" -#include "conversation.h" -#include "request.h" -#include "sslconn.h" -#include "util.h" -#include "xmlnode.h" - -#include "auth.h" -#include "disco.h" -#include "jabber.h" -#include "jutil.h" -#include "iq.h" -#include "notify.h" - -static GSList *auth_mechs = NULL; - -static void auth_old_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -gboolean -jabber_process_starttls(JabberStream *js, xmlnode *packet) -{ - PurpleAccount *account; - xmlnode *starttls; - - account = purple_connection_get_account(js->gc); - - if((starttls = xmlnode_get_child(packet, "starttls"))) { - if(purple_ssl_is_supported()) { - jabber_send_raw(js, - "", -1); - return TRUE; - } else if(xmlnode_get_child(starttls, "required")) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Server requires TLS/SSL, but no TLS/SSL support was found.")); - return TRUE; - } else if(purple_account_get_bool(account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("You require encryption, but no TLS/SSL support was found.")); - return TRUE; - } - } - - return FALSE; -} - -static void finish_plaintext_authentication(JabberStream *js) -{ - JabberIq *iq; - xmlnode *query, *x; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - x = xmlnode_new_child(query, "password"); - xmlnode_insert_data(x, purple_connection_get_password(js->gc), -1); - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - jabber_iq_send(iq); -} - -static void allow_plaintext_auth(PurpleAccount *account) -{ - PurpleConnection *gc; - JabberStream *js; - - purple_account_set_bool(account, "auth_plain_in_clear", TRUE); - - gc = purple_account_get_connection(account); - js = purple_connection_get_protocol_data(gc); - - finish_plaintext_authentication(js); -} - -static void disallow_plaintext_auth(PurpleAccount *account) -{ - purple_connection_error_reason(purple_account_get_connection(account), - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Server requires plaintext authentication over an unencrypted stream")); -} - -#ifdef HAVE_CYRUS_SASL -static void -auth_old_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *account; - JabberStream *js; - const char *entry; - gboolean remember; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - account = purple_connection_get_account(gc); - js = purple_connection_get_protocol_data(gc); - - entry = purple_request_fields_get_string(fields, "password"); - remember = purple_request_fields_get_bool(fields, "remember"); - - if (!entry || !*entry) - { - purple_notify_error(account, NULL, _("Password is required to sign on."), NULL); - return; - } - - if (remember) - purple_account_set_remember_password(account, TRUE); - - purple_account_set_password(account, entry); - - /* Restart our connection */ - jabber_auth_start_old(js); -} - -static void -auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - /* Disable the account as the user has canceled connecting */ - purple_account_set_enabled(purple_connection_get_account(gc), purple_core_get_ui(), FALSE); -} -#endif - -void -jabber_auth_start(JabberStream *js, xmlnode *packet) -{ - GSList *mechanisms = NULL; - GSList *l; - xmlnode *response = NULL; - xmlnode *mechs, *mechnode; - JabberSaslState state; - char *msg = NULL; - - if(js->registration) { - jabber_register_start(js); - return; - } - - mechs = xmlnode_get_child(packet, "mechanisms"); - if(!mechs) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - return; - } - - for(mechnode = xmlnode_get_child(mechs, "mechanism"); mechnode; - mechnode = xmlnode_get_next_twin(mechnode)) - { - char *mech_name = xmlnode_get_data(mechnode); - - if (mech_name && *mech_name) - mechanisms = g_slist_prepend(mechanisms, mech_name); - else if (mech_name) - g_free(mech_name); - - } - - for (l = auth_mechs; l; l = l->next) { - JabberSaslMech *possible = l->data; - - /* Is this the Cyrus SASL mechanism? */ - if (g_str_equal(possible->name, "*")) { - js->auth_mech = possible; - break; - } - - /* Can we find this mechanism in the server's list? */ - if (g_slist_find_custom(mechanisms, possible->name, (GCompareFunc)strcmp)) { - js->auth_mech = possible; - break; - } - } - - if (js->auth_mech == NULL) { - /* Found no good mechanisms... */ - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - _("Server does not use any supported authentication method")); - return; - } - - state = js->auth_mech->start(js, mechs, &response, &msg); - if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - msg ? msg : _("Unknown Error")); - } else if (response) { - jabber_send(js, response); - xmlnode_free(response); - } - - g_free(msg); -} - -static void auth_old_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) { - jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); - jabber_disco_items_server(js); - } else { - PurpleAccount *account; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - xmlnode *error; - const char *err_code; - - account = purple_connection_get_account(js->gc); - - /* FIXME: Why is this not in jabber_parse_error? */ - if((error = xmlnode_get_child(packet, "error")) && - (err_code = xmlnode_get_attrib(error, "code")) && - g_str_equal(err_code, "401")) { - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - /* Clear the pasword if it isn't being saved */ - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - } - - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } -} - -static void auth_old_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberIq *iq; - xmlnode *query, *x; - const char *pw = purple_connection_get_password(js->gc); - - if (type == JABBER_IQ_ERROR) { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } else if (type == JABBER_IQ_RESULT) { - query = xmlnode_get_child(packet, "query"); - if(js->stream_id && xmlnode_get_child(query, "digest")) { - char *s, *hash; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - - x = xmlnode_new_child(query, "digest"); - s = g_strdup_printf("%s%s", js->stream_id, pw); - hash = jabber_calculate_data_sha1sum(s, strlen(s)); - xmlnode_insert_data(x, hash, -1); - g_free(hash); - g_free(s); - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - jabber_iq_send(iq); - - } else if(js->stream_id && (x = xmlnode_get_child(query, "crammd5"))) { - const char *challenge; - gchar digest[33]; - PurpleCipherContext *hmac; - - /* Calculate the MHAC-MD5 digest */ - challenge = xmlnode_get_attrib(x, "challenge"); - hmac = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(hmac, "hash", "md5"); - purple_cipher_context_set_key(hmac, (guchar *)pw); - purple_cipher_context_append(hmac, (guchar *)challenge, strlen(challenge)); - purple_cipher_context_digest_to_str(hmac, 33, digest, NULL); - purple_cipher_context_destroy(hmac); - - /* Create the response query */ - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:auth"); - query = xmlnode_get_child(iq->node, "query"); - - x = xmlnode_new_child(query, "username"); - xmlnode_insert_data(x, js->user->node, -1); - x = xmlnode_new_child(query, "resource"); - xmlnode_insert_data(x, js->user->resource, -1); - - x = xmlnode_new_child(query, "crammd5"); - - xmlnode_insert_data(x, digest, 32); - - jabber_iq_set_callback(iq, auth_old_result_cb, NULL); - jabber_iq_send(iq); - - } else if(xmlnode_get_child(query, "password")) { - PurpleAccount *account = purple_connection_get_account(js->gc); - if(!jabber_stream_is_ssl(js) && !purple_account_get_bool(account, - "auth_plain_in_clear", FALSE)) { - char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), - purple_account_get_username(account)); - purple_request_yes_no(js->gc, _("Plaintext Authentication"), - _("Plaintext Authentication"), - msg, - 1, - account, NULL, NULL, - account, allow_plaintext_auth, - disallow_plaintext_auth); - g_free(msg); - return; - } - finish_plaintext_authentication(js); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - _("Server does not use any supported authentication method")); - return; - } - } -} - -void jabber_auth_start_old(JabberStream *js) -{ - PurpleAccount *account; - JabberIq *iq; - xmlnode *query, *username; - - account = purple_connection_get_account(js->gc); - - /* - * We can end up here without encryption if the server doesn't support - * and we're not using old-style SSL. If the user - * is requiring SSL/TLS, we need to enforce it. - */ - if (!jabber_stream_is_ssl(js) && - purple_account_get_bool(account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("You require encryption, but it is not available on this server.")); - return; - } - - if (js->registration) { - jabber_register_start(js); - return; - } - - /* - * IQ Auth doesn't have support for resource binding, so we need to pick a - * default resource so it will work properly. jabberd14 throws an error and - * iChat server just fails silently. - */ - if (!js->user->resource || *js->user->resource == '\0') { - g_free(js->user->resource); - js->user->resource = g_strdup("Home"); - } - -#ifdef HAVE_CYRUS_SASL - /* If we have Cyrus SASL, then passwords will have been set - * to OPTIONAL for this protocol. So, we need to do our own - * password prompting here - */ - - if (!purple_account_get_password(account)) { - purple_account_request_password(account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); - return; - } -#endif - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:auth"); - - query = xmlnode_get_child(iq->node, "query"); - username = xmlnode_new_child(query, "username"); - xmlnode_insert_data(username, js->user->node, -1); - - jabber_iq_set_callback(iq, auth_old_cb, NULL); - - jabber_iq_send(iq); -} - -void -jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet) -{ - const char *ns = xmlnode_get_namespace(packet); - - if (!purple_strequal(ns, NS_XMPP_SASL)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - return; - } - - if (js->auth_mech && js->auth_mech->handle_challenge) { - xmlnode *response = NULL; - char *msg = NULL; - JabberSaslState state = js->auth_mech->handle_challenge(js, packet, &response, &msg); - if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - msg ? msg : _("Invalid challenge from server")); - } else if (response) { - jabber_send(js, response); - xmlnode_free(response); - } - - g_free(msg); - } else - purple_debug_warning("jabber", "Received unexpected (and unhandled) \n"); -} - -void jabber_auth_handle_success(JabberStream *js, xmlnode *packet) -{ - const char *ns = xmlnode_get_namespace(packet); - - if (!purple_strequal(ns, NS_XMPP_SASL)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - return; - } - - if (js->auth_mech && js->auth_mech->handle_success) { - char *msg = NULL; - JabberSaslState state = js->auth_mech->handle_success(js, packet, &msg); - - if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - msg ? msg : _("Invalid response from server")); - return; - } else if (state == JABBER_SASL_STATE_CONTINUE) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - msg ? msg : _("Server thinks authentication is complete, but client does not")); - return; - } - - g_free(msg); - } - - /* - * The stream will be reinitialized later in jabber_recv_cb_ssl() or - * jabber_bosh_connection_send. - */ - js->reinit = TRUE; - jabber_stream_set_state(js, JABBER_STREAM_POST_AUTH); -} - -void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet) -{ - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = NULL; - - if (js->auth_mech && js->auth_mech->handle_failure) { - xmlnode *stanza = NULL; - JabberSaslState state = js->auth_mech->handle_failure(js, packet, &stanza, &msg); - - if (state != JABBER_SASL_STATE_FAIL) { - if (stanza) { - jabber_send(js, stanza); - xmlnode_free(stanza); - } - - return; - } - } - - if (!msg) - msg = jabber_parse_error(js, packet, &reason); - - if (!msg) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - } else { - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } -} - -static gint compare_mech(gconstpointer a, gconstpointer b) -{ - const JabberSaslMech *mech_a = a; - const JabberSaslMech *mech_b = b; - - /* higher priority comes *before* lower priority in the list */ - if (mech_a->priority > mech_b->priority) - return -1; - else if (mech_a->priority < mech_b->priority) - return 1; - /* This really shouldn't happen */ - return 0; -} - -void jabber_auth_init(void) -{ - JabberSaslMech **tmp; - gint count, i; - - auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_plain_mech(), compare_mech); - auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_digest_md5_mech(), compare_mech); -#ifdef HAVE_CYRUS_SASL - auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_cyrus_mech(), compare_mech); -#endif - - tmp = jabber_auth_get_scram_mechs(&count); - for (i = 0; i < count; ++i) - auth_mechs = g_slist_insert_sorted(auth_mechs, tmp[i], compare_mech); -} - -void jabber_auth_uninit(void) -{ - g_slist_free(auth_mechs); - auth_mechs = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_cyrus.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_cyrus.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_cyrus.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_cyrus.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,564 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "core.h" -#include "debug.h" -#include "request.h" - -#include "auth.h" -#include "jabber.h" - -static JabberSaslState jabber_auth_start_cyrus(JabberStream *js, xmlnode **reply, - char **error); -static void jabber_sasl_build_callbacks(JabberStream *); - -static void disallow_plaintext_auth(PurpleAccount *account) -{ - purple_connection_error_reason(purple_account_get_connection(account), - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Server requires plaintext authentication over an unencrypted stream")); -} - -static void start_cyrus_wrapper(JabberStream *js) -{ - char *error = NULL; - xmlnode *response = NULL; - JabberSaslState state = jabber_auth_start_cyrus(js, &response, &error); - - if (state == JABBER_SASL_STATE_FAIL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, - error); - g_free(error); - } else if (response) { - jabber_send(js, response); - xmlnode_free(response); - } -} - - -/* Callbacks for Cyrus SASL */ - -static int jabber_sasl_cb_realm(void *ctx, int id, const char **avail, const char **result) -{ - JabberStream *js = ctx; - - if (id != SASL_CB_GETREALM || !result) return SASL_BADPARAM; - - *result = js->user->domain; - - return SASL_OK; -} - -static int jabber_sasl_cb_simple(void *ctx, int id, const char **res, unsigned *len) -{ - JabberStream *js = ctx; - - switch(id) { - case SASL_CB_AUTHNAME: - *res = js->user->node; - break; - case SASL_CB_USER: - *res = ""; - break; - default: - return SASL_BADPARAM; - } - if (len) *len = strlen((char *)*res); - return SASL_OK; -} - -static int jabber_sasl_cb_secret(sasl_conn_t *conn, void *ctx, int id, sasl_secret_t **secret) -{ - JabberStream *js = ctx; - PurpleAccount *account; - const char *pw; - size_t len; - static sasl_secret_t *x = NULL; - - account = purple_connection_get_account(js->gc); - pw = purple_account_get_password(account); - - if (!conn || !secret || id != SASL_CB_PASS) - return SASL_BADPARAM; - - len = strlen(pw); - x = (sasl_secret_t *) realloc(x, sizeof(sasl_secret_t) + len); - - if (!x) - return SASL_NOMEM; - - x->len = len; - strcpy((char*)x->data, pw); - - *secret = x; - return SASL_OK; -} - -static void allow_cyrus_plaintext_auth(PurpleAccount *account) -{ - PurpleConnection *gc; - JabberStream *js; - - gc = purple_account_get_connection(account); - js = purple_connection_get_protocol_data(gc); - - purple_account_set_bool(account, "auth_plain_in_clear", TRUE); - - start_cyrus_wrapper(js); -} - -static void auth_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *account; - JabberStream *js; - const char *entry; - gboolean remember; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - account = purple_connection_get_account(gc); - js = purple_connection_get_protocol_data(gc); - - entry = purple_request_fields_get_string(fields, "password"); - remember = purple_request_fields_get_bool(fields, "remember"); - - if (!entry || !*entry) - { - purple_notify_error(account, NULL, _("Password is required to sign on."), NULL); - return; - } - - if (remember) - purple_account_set_remember_password(account, TRUE); - - purple_account_set_password(account, entry); - - /* Rebuild our callbacks as we now have a password to offer */ - jabber_sasl_build_callbacks(js); - - /* Restart our negotiation */ - start_cyrus_wrapper(js); -} - -static void -auth_no_pass_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - PurpleAccount *account; - JabberStream *js; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - account = purple_connection_get_account(gc); - js = purple_connection_get_protocol_data(gc); - - /* Disable the account as the user has canceled connecting */ - purple_account_set_enabled(account, purple_core_get_ui(), FALSE); -} - -static JabberSaslState -jabber_auth_start_cyrus(JabberStream *js, xmlnode **reply, char **error) -{ - PurpleAccount *account; - const char *clientout = NULL; - char *enc_out; - unsigned coutlen = 0; - sasl_security_properties_t secprops; - gboolean again; - gboolean plaintext = TRUE; - - /* Set up security properties and options */ - secprops.min_ssf = 0; - secprops.security_flags = SASL_SEC_NOANONYMOUS; - - account = purple_connection_get_account(js->gc); - - if (!jabber_stream_is_ssl(js)) { - secprops.max_ssf = -1; - secprops.maxbufsize = 4096; - plaintext = purple_account_get_bool(account, "auth_plain_in_clear", FALSE); - if (!plaintext) - secprops.security_flags |= SASL_SEC_NOPLAINTEXT; - } else { - secprops.max_ssf = 0; - secprops.maxbufsize = 0; - plaintext = TRUE; - } - secprops.property_names = 0; - secprops.property_values = 0; - - do { - again = FALSE; - - js->sasl_state = sasl_client_new("xmpp", js->serverFQDN, NULL, NULL, js->sasl_cb, 0, &js->sasl); - if (js->sasl_state==SASL_OK) { - sasl_setprop(js->sasl, SASL_SEC_PROPS, &secprops); - purple_debug_info("sasl", "Mechs found: %s\n", js->sasl_mechs->str); - js->sasl_state = sasl_client_start(js->sasl, js->sasl_mechs->str, NULL, &clientout, &coutlen, &js->current_mech); - } - switch (js->sasl_state) { - /* Success */ - case SASL_OK: - case SASL_CONTINUE: - break; - case SASL_NOMECH: - /* No mechanisms have offered to help */ - - /* Firstly, if we don't have a password try - * to get one - */ - - if (!purple_account_get_password(account)) { - purple_account_request_password(account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); - return JABBER_SASL_STATE_CONTINUE; - - /* If we've got a password, but aren't sending - * it in plaintext, see if we can turn on - * plaintext auth - */ - } else if (!plaintext) { - char *msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), - purple_account_get_username(account)); - purple_request_yes_no(js->gc, _("Plaintext Authentication"), - _("Plaintext Authentication"), - msg, - 1, account, NULL, NULL, account, - allow_cyrus_plaintext_auth, - disallow_plaintext_auth); - g_free(msg); - return JABBER_SASL_STATE_CONTINUE; - - } else { - /* We have no mechs which can work. - * Try falling back on the old jabber:iq:auth method. We get here if the server supports - * one or more sasl mechs, we are compiled with cyrus-sasl support, but we support or can connect with none of - * the offerred mechs. jabberd 2.0 w/ SASL and Apple's iChat Server 10.5 both handle and expect - * jabber:iq:auth in this situation. iChat Server in particular offers SASL GSSAPI by default, which is often - * not configured on the client side, and expects a fallback to jabber:iq:auth when it (predictably) fails. - * - * Note: xep-0078 points out that using jabber:iq:auth after a sasl failure is wrong. However, - * I believe this refers to actual authentication failure, not a simple lack of concordant mechanisms. - * Doing otherwise means that simply compiling with SASL support renders the client unable to connect to servers - * which would connect without issue otherwise. -evands - */ - js->auth_mech = NULL; - jabber_auth_start_old(js); - return JABBER_SASL_STATE_CONTINUE; - } - /* not reached */ - break; - - /* Fatal errors. Give up and go home */ - case SASL_BADPARAM: - case SASL_NOMEM: - break; - - /* For everything else, fail the mechanism and try again */ - default: - purple_debug_info("sasl", "sasl_state is %d, failing the mech and trying again\n", js->sasl_state); - - /* - * DAA: is this right? - * The manpage says that "mech" will contain the chosen mechanism on success. - * Presumably, if we get here that isn't the case and we shouldn't try again? - * I suspect that this never happens. - */ - /* - * SXW: Yes, this is right. What this handles is the situation where a - * mechanism, say GSSAPI, is tried. If that mechanism fails, it may be - * due to mechanism specific issues, so we want to try one of the other - * supported mechanisms. This code handles that case - */ - if (js->current_mech && *js->current_mech) { - char *pos; - if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { - g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); - } - /* Remove space which separated this mech from the next */ - if ((js->sasl_mechs->str)[0] == ' ') { - g_string_erase(js->sasl_mechs, 0, 1); - } - again = TRUE; - } - - sasl_dispose(&js->sasl); - } - } while (again); - - if (js->sasl_state == SASL_CONTINUE || js->sasl_state == SASL_OK) { - xmlnode *auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, NS_XMPP_SASL); - xmlnode_set_attrib(auth, "mechanism", js->current_mech); - - xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); - xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); - - if (clientout) { - if (coutlen == 0) { - xmlnode_insert_data(auth, "=", -1); - } else { - enc_out = purple_base64_encode((unsigned char*)clientout, coutlen); - xmlnode_insert_data(auth, enc_out, -1); - g_free(enc_out); - } - } - - *reply = auth; - return JABBER_SASL_STATE_CONTINUE; - } else { - *error = g_strdup(_("SASL authentication failed")); - return JABBER_SASL_STATE_FAIL; - } -} - -static int -jabber_sasl_cb_log(void *context, int level, const char *message) -{ - if(level <= SASL_LOG_TRACE) - purple_debug_info("sasl", "%s\n", message); - - return SASL_OK; -} - -static void -jabber_sasl_build_callbacks(JabberStream *js) -{ - PurpleAccount *account; - int id; - - /* Set up our callbacks structure */ - if (js->sasl_cb == NULL) - js->sasl_cb = g_new0(sasl_callback_t,6); - - id = 0; - js->sasl_cb[id].id = SASL_CB_GETREALM; - js->sasl_cb[id].proc = jabber_sasl_cb_realm; - js->sasl_cb[id].context = (void *)js; - id++; - - js->sasl_cb[id].id = SASL_CB_AUTHNAME; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; - js->sasl_cb[id].context = (void *)js; - id++; - - js->sasl_cb[id].id = SASL_CB_USER; - js->sasl_cb[id].proc = jabber_sasl_cb_simple; - js->sasl_cb[id].context = (void *)js; - id++; - - account = purple_connection_get_account(js->gc); - if (purple_account_get_password(account) != NULL ) { - js->sasl_cb[id].id = SASL_CB_PASS; - js->sasl_cb[id].proc = jabber_sasl_cb_secret; - js->sasl_cb[id].context = (void *)js; - id++; - } - - js->sasl_cb[id].id = SASL_CB_LOG; - js->sasl_cb[id].proc = jabber_sasl_cb_log; - js->sasl_cb[id].context = (void*)js; - id++; - - js->sasl_cb[id].id = SASL_CB_LIST_END; -} - -static JabberSaslState -jabber_cyrus_start(JabberStream *js, xmlnode *mechanisms, - xmlnode **reply, char **error) -{ - xmlnode *mechnode; - - js->sasl_mechs = g_string_new(""); - - for(mechnode = xmlnode_get_child(mechanisms, "mechanism"); mechnode; - mechnode = xmlnode_get_next_twin(mechnode)) - { - char *mech_name = xmlnode_get_data(mechnode); - - if (!mech_name || !*mech_name) { - g_free(mech_name); - continue; - } - - /* Don't include Google Talk's X-GOOGLE-TOKEN mechanism, as we will not - * support it and including it gives a false fall-back to other mechs offerred, - * leading to incorrect error handling. - */ - if (g_str_equal(mech_name, "X-GOOGLE-TOKEN")) { - g_free(mech_name); - continue; - } - - g_string_append(js->sasl_mechs, mech_name); - g_string_append_c(js->sasl_mechs, ' '); - g_free(mech_name); - } - - jabber_sasl_build_callbacks(js); - return jabber_auth_start_cyrus(js, reply, error); -} - -static JabberSaslState -jabber_cyrus_handle_challenge(JabberStream *js, xmlnode *packet, - xmlnode **reply, char **error) -{ - char *enc_in = xmlnode_get_data(packet); - unsigned char *dec_in; - char *enc_out; - const char *c_out; - unsigned int clen; - gsize declen; - - dec_in = purple_base64_decode(enc_in, &declen); - - js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen, - NULL, &c_out, &clen); - g_free(enc_in); - g_free(dec_in); - if (js->sasl_state != SASL_CONTINUE && js->sasl_state != SASL_OK) { - gchar *tmp = g_strdup_printf(_("SASL error: %s"), - sasl_errdetail(js->sasl)); - purple_debug_error("jabber", "Error is %d : %s\n", - js->sasl_state, sasl_errdetail(js->sasl)); - *error = tmp; - return JABBER_SASL_STATE_FAIL; - } else { - xmlnode *response = xmlnode_new("response"); - xmlnode_set_namespace(response, NS_XMPP_SASL); - if (clen > 0) { - /* Cyrus SASL 2.1.22 appears to contain code to add the charset - * to the response for DIGEST-MD5 but there is no possibility - * it will be executed. - * - * My reading of the digestmd5 plugin indicates the username and - * realm are always encoded in UTF-8 (they seem to be the values - * we pass in), so we need to ensure charset=utf-8 is set. - */ - if (!purple_strequal(js->current_mech, "DIGEST-MD5") || - strstr(c_out, ",charset=")) - /* If we're not using DIGEST-MD5 or Cyrus SASL is fixed */ - enc_out = purple_base64_encode((unsigned char*)c_out, clen); - else { - char *tmp = g_strdup_printf("%s,charset=utf-8", c_out); - enc_out = purple_base64_encode((unsigned char*)tmp, clen + 14); - g_free(tmp); - } - - xmlnode_insert_data(response, enc_out, -1); - g_free(enc_out); - } - - *reply = response; - return JABBER_SASL_STATE_CONTINUE; - } -} - -static JabberSaslState -jabber_cyrus_handle_success(JabberStream *js, xmlnode *packet, - char **error) -{ - const void *x; - - /* The SASL docs say that if the client hasn't returned OK yet, we - * should try one more round against it - */ - if (js->sasl_state != SASL_OK) { - char *enc_in = xmlnode_get_data(packet); - unsigned char *dec_in = NULL; - const char *c_out; - unsigned int clen; - gsize declen = 0; - - if(enc_in != NULL) - dec_in = purple_base64_decode(enc_in, &declen); - - js->sasl_state = sasl_client_step(js->sasl, (char*)dec_in, declen, NULL, &c_out, &clen); - - g_free(enc_in); - g_free(dec_in); - - if (js->sasl_state != SASL_OK) { - /* This should never happen! */ - *error = g_strdup(_("Invalid response from server")); - g_return_val_if_reached(JABBER_SASL_STATE_FAIL); - } - } - - /* If we've negotiated a security layer, we need to enable it */ - if (js->sasl) { - sasl_getprop(js->sasl, SASL_SSF, &x); - if (*(int *)x > 0) { - sasl_getprop(js->sasl, SASL_MAXOUTBUF, &x); - js->sasl_maxbuf = *(int *)x; - } - } - - return JABBER_SASL_STATE_OK; -} - -static JabberSaslState -jabber_cyrus_handle_failure(JabberStream *js, xmlnode *packet, - xmlnode **reply, char **error) -{ - if (js->auth_fail_count++ < 5) { - if (js->current_mech && *js->current_mech) { - char *pos; - if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { - g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); - } - /* Remove space which separated this mech from the next */ - if ((js->sasl_mechs->str)[0] == ' ') { - g_string_erase(js->sasl_mechs, 0, 1); - } - } - if (*js->sasl_mechs->str) { - /* If we have remaining mechs to try, do so */ - sasl_dispose(&js->sasl); - - return jabber_auth_start_cyrus(js, reply, error); - } - } - - /* Nothing to send */ - return JABBER_SASL_STATE_FAIL; -} - -static JabberSaslMech cyrus_mech = { - 100, /* priority */ - "*", /* name; Cyrus provides a bunch of mechanisms, so use an invalid - * mechanism name (per rfc4422 3.1). */ - jabber_cyrus_start, - jabber_cyrus_handle_challenge, - jabber_cyrus_handle_success, - jabber_cyrus_handle_failure, - NULL, -}; - -JabberSaslMech *jabber_auth_get_cyrus_mech(void) -{ - return &cyrus_mech; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_digest_md5.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_digest_md5.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_digest_md5.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_digest_md5.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,292 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "debug.h" -#include "cipher.h" -#include "util.h" -#include "xmlnode.h" - -#include "auth.h" -#include "jabber.h" - -static JabberSaslState -digest_md5_start(JabberStream *js, xmlnode *packet, xmlnode **response, - char **error) -{ - xmlnode *auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, NS_XMPP_SASL); - xmlnode_set_attrib(auth, "mechanism", "DIGEST-MD5"); - - *response = auth; - return JABBER_SASL_STATE_CONTINUE; -} - -/* Parts of this algorithm are inspired by stuff in libgsasl */ -static GHashTable* parse_challenge(const char *challenge) -{ - const char *token_start, *val_start, *val_end, *cur; - GHashTable *ret = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - cur = challenge; - while(*cur != '\0') { - /* Find the end of the token */ - gboolean in_quotes = FALSE; - char *name, *value = NULL; - token_start = cur; - while(*cur != '\0' && (in_quotes || (!in_quotes && *cur != ','))) { - if (*cur == '"') - in_quotes = !in_quotes; - cur++; - } - - /* Find start of value. */ - val_start = strchr(token_start, '='); - if (val_start == NULL || val_start > cur) - val_start = cur; - - if (token_start != val_start) { - name = g_strndup(token_start, val_start - token_start); - - if (val_start != cur) { - val_start++; - while (val_start != cur && (*val_start == ' ' || *val_start == '\t' - || *val_start == '\r' || *val_start == '\n' - || *val_start == '"')) - val_start++; - - val_end = cur; - while (val_end != val_start && (*val_end == ' ' || *val_end == ',' || *val_end == '\t' - || *val_end == '\r' || *val_end == '\n' - || *val_end == '"' || *val_end == '\0')) - val_end--; - - if (val_start != val_end) - value = g_strndup(val_start, val_end - val_start + 1); - } - - g_hash_table_replace(ret, name, value); - } - - /* Find the start of the next token, if there is one */ - if (*cur != '\0') { - cur++; - while (*cur == ' ' || *cur == ',' || *cur == '\t' - || *cur == '\r' || *cur == '\n') - cur++; - } - } - - return ret; -} - -static char * -generate_response_value(JabberID *jid, const char *passwd, const char *nonce, - const char *cnonce, const char *a2, const char *realm) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar result[16]; - size_t a1len; - - gchar *a1, *convnode=NULL, *convpasswd = NULL, *ha1, *ha2, *kd, *x, *z; - - if((convnode = g_convert(jid->node, -1, "iso-8859-1", "utf-8", - NULL, NULL, NULL)) == NULL) { - convnode = g_strdup(jid->node); - } - if(passwd && ((convpasswd = g_convert(passwd, -1, "iso-8859-1", - "utf-8", NULL, NULL, NULL)) == NULL)) { - convpasswd = g_strdup(passwd); - } - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - x = g_strdup_printf("%s:%s:%s", convnode, realm, convpasswd ? convpasswd : ""); - purple_cipher_context_append(context, (const guchar *)x, strlen(x)); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - - a1 = g_strdup_printf("xxxxxxxxxxxxxxxx:%s:%s", nonce, cnonce); - a1len = strlen(a1); - g_memmove(a1, result, 16); - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)a1, a1len); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - - ha1 = purple_base16_encode(result, 16); - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)a2, strlen(a2)); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - - ha2 = purple_base16_encode(result, 16); - - kd = g_strdup_printf("%s:%s:00000001:%s:auth:%s", ha1, nonce, cnonce, ha2); - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)kd, strlen(kd)); - purple_cipher_context_digest(context, sizeof(result), result, NULL); - purple_cipher_context_destroy(context); - - z = purple_base16_encode(result, 16); - - g_free(convnode); - g_free(convpasswd); - g_free(x); - g_free(a1); - g_free(ha1); - g_free(ha2); - g_free(kd); - - return z; -} - -static JabberSaslState -digest_md5_handle_challenge(JabberStream *js, xmlnode *packet, - xmlnode **response, char **msg) -{ - xmlnode *reply = NULL; - char *enc_in = xmlnode_get_data(packet); - char *dec_in; - char *enc_out; - GHashTable *parts; - JabberSaslState state = JABBER_SASL_STATE_CONTINUE; - - if (!enc_in) { - *msg = g_strdup(_("Invalid response from server")); - return JABBER_SASL_STATE_FAIL; - } - - dec_in = (char *)purple_base64_decode(enc_in, NULL); - purple_debug_misc("jabber", "decoded challenge (%" - G_GSIZE_FORMAT "): %s\n", strlen(dec_in), dec_in); - - parts = parse_challenge(dec_in); - - if (g_hash_table_lookup(parts, "rspauth")) { - char *rspauth = g_hash_table_lookup(parts, "rspauth"); - - if (rspauth && purple_strequal(rspauth, js->expected_rspauth)) { - reply = xmlnode_new("response"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - } else { - *msg = g_strdup(_("Invalid challenge from server")); - state = JABBER_SASL_STATE_FAIL; - } - g_free(js->expected_rspauth); - js->expected_rspauth = NULL; - } else { - /* assemble a response, and send it */ - /* see RFC 2831 */ - char *realm; - char *nonce; - - /* Make sure the auth string contains everything that should be there. - This isn't everything in RFC2831, but it is what we need. */ - - nonce = g_hash_table_lookup(parts, "nonce"); - - /* we're actually supposed to prompt the user for a realm if - * the server doesn't send one, but that really complicates things, - * so i'm not gonna worry about it until is poses a problem to - * someone, or I get really bored */ - realm = g_hash_table_lookup(parts, "realm"); - if(!realm) - realm = js->user->domain; - - if (nonce == NULL || realm == NULL) { - *msg = g_strdup(_("Invalid challenge from server")); - state = JABBER_SASL_STATE_FAIL; - } else { - GString *response = g_string_new(""); - char *a2; - char *auth_resp; - char *cnonce; - - cnonce = g_strdup_printf("%x%u%x", g_random_int(), (int)time(NULL), - g_random_int()); - - a2 = g_strdup_printf("AUTHENTICATE:xmpp/%s", realm); - auth_resp = generate_response_value(js->user, - purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); - g_free(a2); - - a2 = g_strdup_printf(":xmpp/%s", realm); - js->expected_rspauth = generate_response_value(js->user, - purple_connection_get_password(js->gc), nonce, cnonce, a2, realm); - g_free(a2); - - g_string_append_printf(response, "username=\"%s\"", js->user->node); - g_string_append_printf(response, ",realm=\"%s\"", realm); - g_string_append_printf(response, ",nonce=\"%s\"", nonce); - g_string_append_printf(response, ",cnonce=\"%s\"", cnonce); - g_string_append_printf(response, ",nc=00000001"); - g_string_append_printf(response, ",qop=auth"); - g_string_append_printf(response, ",digest-uri=\"xmpp/%s\"", realm); - g_string_append_printf(response, ",response=%s", auth_resp); - g_string_append_printf(response, ",charset=utf-8"); - - g_free(auth_resp); - g_free(cnonce); - - enc_out = purple_base64_encode((guchar *)response->str, response->len); - - purple_debug_misc("jabber", "decoded response (%" - G_GSIZE_FORMAT "): %s\n", - response->len, response->str); - - reply = xmlnode_new("response"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - xmlnode_insert_data(reply, enc_out, -1); - - g_free(enc_out); - - g_string_free(response, TRUE); - } - } - - g_free(enc_in); - g_free(dec_in); - g_hash_table_destroy(parts); - - *response = reply; - return state; -} - -static JabberSaslMech digest_md5_mech = { - 10, /* priority */ - "DIGEST-MD5", /* name */ - digest_md5_start, - digest_md5_handle_challenge, - NULL, /* handle_success */ - NULL, /* handle_failure */ - NULL /* handle_dispose */ -}; - -JabberSaslMech *jabber_auth_get_digest_md5_mech(void) -{ - return &digest_md5_mech; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/** - * @file auth.h Authentication routines - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_AUTH_H_ -#define PURPLE_JABBER_AUTH_H_ - -typedef struct _JabberSaslMech JabberSaslMech; - -#include "jabber.h" -#include "xmlnode.h" - -typedef enum { - JABBER_SASL_STATE_FAIL = -1, /* Abort, Retry, Fail? */ - JABBER_SASL_STATE_OK = 0, /* Hooray! */ - JABBER_SASL_STATE_CONTINUE = 1 /* More authentication required */ -} JabberSaslState; - -struct _JabberSaslMech { - gint8 priority; /* Higher priority will be tried before lower priority */ - const gchar *name; - JabberSaslState (*start)(JabberStream *js, xmlnode *mechanisms, xmlnode **reply, char **msg); - JabberSaslState (*handle_challenge)(JabberStream *js, xmlnode *packet, xmlnode **reply, char **msg); - JabberSaslState (*handle_success)(JabberStream *js, xmlnode *packet, char **msg); - JabberSaslState (*handle_failure)(JabberStream *js, xmlnode *packet, xmlnode **reply, char **msg); - void (*dispose)(JabberStream *js); -}; - -gboolean jabber_process_starttls(JabberStream *js, xmlnode *packet); -void jabber_auth_start(JabberStream *js, xmlnode *packet); -void jabber_auth_start_old(JabberStream *js); -void jabber_auth_handle_challenge(JabberStream *js, xmlnode *packet); -void jabber_auth_handle_success(JabberStream *js, xmlnode *packet); -void jabber_auth_handle_failure(JabberStream *js, xmlnode *packet); - -JabberSaslMech *jabber_auth_get_plain_mech(void); -JabberSaslMech *jabber_auth_get_digest_md5_mech(void); -JabberSaslMech **jabber_auth_get_scram_mechs(gint *count); -#ifdef HAVE_CYRUS_SASL -JabberSaslMech *jabber_auth_get_cyrus_mech(void); -#endif - -void jabber_auth_init(void); -void jabber_auth_uninit(void); - -#endif /* PURPLE_JABBER_AUTH_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_plain.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_plain.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_plain.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_plain.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "debug.h" -#include "request.h" -#include "util.h" -#include "xmlnode.h" - -#include "jabber.h" -#include "auth.h" - -static xmlnode *finish_plaintext_authentication(JabberStream *js) -{ - xmlnode *auth; - GString *response; - gchar *enc_out; - - auth = xmlnode_new("auth"); - xmlnode_set_namespace(auth, NS_XMPP_SASL); - - xmlnode_set_attrib(auth, "xmlns:ga", "http://www.google.com/talk/protocol/auth"); - xmlnode_set_attrib(auth, "ga:client-uses-full-bind-result", "true"); - - response = g_string_new(""); - response = g_string_append_len(response, "\0", 1); - response = g_string_append(response, js->user->node); - response = g_string_append_len(response, "\0", 1); - response = g_string_append(response, - purple_connection_get_password(js->gc)); - - enc_out = purple_base64_encode((guchar *)response->str, response->len); - - xmlnode_set_attrib(auth, "mechanism", "PLAIN"); - xmlnode_insert_data(auth, enc_out, -1); - g_free(enc_out); - g_string_free(response, TRUE); - - return auth; -} - -static void allow_plaintext_auth(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *response; - - purple_account_set_bool(account, "auth_plain_in_clear", TRUE); - - response = finish_plaintext_authentication(js); - jabber_send(js, response); - xmlnode_free(response); -} - -static void disallow_plaintext_auth(PurpleAccount *account) -{ - purple_connection_error_reason(purple_account_get_connection(account), - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Server requires plaintext authentication over an unencrypted stream")); -} - -static JabberSaslState -jabber_plain_start(JabberStream *js, xmlnode *packet, xmlnode **response, char **error) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - char *msg; - - if (jabber_stream_is_ssl(js) || purple_account_get_bool(account, "auth_plain_in_clear", FALSE)) { - *response = finish_plaintext_authentication(js); - return JABBER_SASL_STATE_OK; - } - - msg = g_strdup_printf(_("%s requires plaintext authentication over an unencrypted connection. Allow this and continue authentication?"), - purple_account_get_username(account)); - purple_request_yes_no(js->gc, _("Plaintext Authentication"), - _("Plaintext Authentication"), - msg, - 1, - account, NULL, NULL, - account, allow_plaintext_auth, disallow_plaintext_auth); - g_free(msg); - return JABBER_SASL_STATE_CONTINUE; -} - -static JabberSaslMech plain_mech = { - 0, /* priority */ - "PLAIN", /* name */ - jabber_plain_start, - NULL, /* handle_challenge */ - NULL, /* handle_success */ - NULL, /* handle_failure */ - NULL /* dispose */ -}; - -JabberSaslMech *jabber_auth_get_plain_mech(void) -{ - return &plain_mech; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,577 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "auth.h" -#include "auth_scram.h" - -#include "cipher.h" -#include "debug.h" - -static const JabberScramHash hashes[] = { - { "-SHA-1", "sha1", 20 }, -}; - -static const JabberScramHash *mech_to_hash(const char *mech) -{ - int i; - - g_return_val_if_fail(mech != NULL && *mech != '\0', NULL); - - for (i = 0; i < G_N_ELEMENTS(hashes); ++i) { - if (strstr(mech, hashes[i].mech_substr)) - return &(hashes[i]); - } - - purple_debug_error("jabber", "Unknown SCRAM mechanism %s\n", mech); - g_return_val_if_reached(NULL); -} - -guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str, - GString *salt, guint iterations) -{ - PurpleCipherContext *context; - guchar *result; - guint i; - guchar *prev, *tmp; - - g_return_val_if_fail(hash != NULL, NULL); - g_return_val_if_fail(str != NULL && str->len > 0, NULL); - g_return_val_if_fail(salt != NULL && salt->len > 0, NULL); - g_return_val_if_fail(iterations > 0, NULL); - - prev = g_new0(guint8, hash->size); - tmp = g_new0(guint8, hash->size); - result = g_new0(guint8, hash->size); - - context = purple_cipher_context_new_by_name("hmac", NULL); - - /* Append INT(1), a four-octet encoding of the integer 1, most significant - * octet first. */ - g_string_append_len(salt, "\0\0\0\1", 4); - - /* Compute U0 */ - purple_cipher_context_set_option(context, "hash", (gpointer)hash->name); - purple_cipher_context_set_key_with_len(context, (guchar *)str->str, str->len); - purple_cipher_context_append(context, (guchar *)salt->str, salt->len); - purple_cipher_context_digest(context, hash->size, result, NULL); - - memcpy(prev, result, hash->size); - - /* Compute U1...Ui */ - for (i = 1; i < iterations; ++i) { - guint j; - purple_cipher_context_set_option(context, "hash", (gpointer)hash->name); - purple_cipher_context_set_key_with_len(context, (guchar *)str->str, str->len); - purple_cipher_context_append(context, prev, hash->size); - purple_cipher_context_digest(context, hash->size, tmp, NULL); - - for (j = 0; j < hash->size; ++j) - result[j] ^= tmp[j]; - - memcpy(prev, tmp, hash->size); - } - - purple_cipher_context_destroy(context); - g_free(tmp); - g_free(prev); - return result; -} - -/* - * Helper functions for doing the SCRAM calculations. The first argument - * is the hash algorithm. All buffers must be of the appropriate size - * according to the JabberScramHash. - * - * "str" is a NULL-terminated string for hmac(). - * - * Needless to say, these are fragile. - */ -static void -hmac(const JabberScramHash *hash, guchar *out, const guchar *key, const gchar *str) -{ - PurpleCipherContext *context; - - context = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(context, "hash", (gpointer)hash->name); - purple_cipher_context_set_key_with_len(context, key, hash->size); - purple_cipher_context_append(context, (guchar *)str, strlen(str)); - purple_cipher_context_digest(context, hash->size, out, NULL); - purple_cipher_context_destroy(context); -} - -static void -hash(const JabberScramHash *hash, guchar *out, const guchar *data) -{ - PurpleCipherContext *context; - - context = purple_cipher_context_new_by_name(hash->name, NULL); - purple_cipher_context_append(context, data, hash->size); - purple_cipher_context_digest(context, hash->size, out, NULL); - purple_cipher_context_destroy(context); -} - -gboolean -jabber_scram_calc_proofs(JabberScramData *data, GString *salt, guint iterations) -{ - guint hash_len = data->hash->size; - guint i; - - GString *pass = g_string_new(data->password); - - guchar *salted_password; - guchar *client_key, *stored_key, *client_signature, *server_key; - - client_key = g_new0(guchar, hash_len); - stored_key = g_new0(guchar, hash_len); - client_signature = g_new0(guchar, hash_len); - server_key = g_new0(guchar, hash_len); - - data->client_proof = g_string_sized_new(hash_len); - data->client_proof->len = hash_len; - data->server_signature = g_string_sized_new(hash_len); - data->server_signature->len = hash_len; - - salted_password = jabber_scram_hi(data->hash, pass, salt, iterations); - - memset(pass->str, 0, pass->allocated_len); - g_string_free(pass, TRUE); - - if (!salted_password) - return FALSE; - - /* client_key = HMAC(salted_password, "Client Key") */ - hmac(data->hash, client_key, salted_password, "Client Key"); - /* server_key = HMAC(salted_password, "Server Key") */ - hmac(data->hash, server_key, salted_password, "Server Key"); - g_free(salted_password); - - /* stored_key = HASH(client_key) */ - hash(data->hash, stored_key, client_key); - - /* client_signature = HMAC(stored_key, auth_message) */ - hmac(data->hash, client_signature, stored_key, data->auth_message->str); - /* server_signature = HMAC(server_key, auth_message) */ - hmac(data->hash, (guchar *)data->server_signature->str, server_key, data->auth_message->str); - - /* client_proof = client_key XOR client_signature */ - for (i = 0; i < hash_len; ++i) - data->client_proof->str[i] = client_key[i] ^ client_signature[i]; - - g_free(server_key); - g_free(client_signature); - g_free(stored_key); - g_free(client_key); - - return TRUE; -} - -static gboolean -parse_server_step1(JabberScramData *data, const char *challenge, - gchar **out_nonce, GString **out_salt, guint *out_iterations) -{ - char **tokens; - char *token, *decoded, *tmp; - gsize len; - char *nonce = NULL; - GString *salt = NULL; - guint iterations; - - tokens = g_strsplit(challenge, ",", -1); - if (tokens == NULL) - return FALSE; - - token = tokens[0]; - if (token[0] != 'r' || token[1] != '=') - goto err; - - /* Ensure that the first cnonce_len bytes of the nonce are the original - * cnonce we sent to the server. - */ - if (0 != strncmp(data->cnonce, token + 2, strlen(data->cnonce))) - goto err; - - nonce = g_strdup(token + 2); - - /* The Salt, base64-encoded */ - token = tokens[1]; - if (token[0] != 's' || token[1] != '=') - goto err; - - decoded = (gchar *)purple_base64_decode(token + 2, &len); - if (!decoded || *decoded == '\0') { - g_free(decoded); - goto err; - } - salt = g_string_new_len(decoded, len); - g_free(decoded); - - /* The iteration count */ - token = tokens[2]; - if (token[0] != 'i' || token[1] != '=' || token[2] == '\0') - goto err; - - /* Validate the string */ - for (tmp = token + 2; *tmp; ++tmp) - if (!g_ascii_isdigit(*tmp)) - goto err; - - iterations = strtoul(token + 2, NULL, 10); - - g_strfreev(tokens); - *out_nonce = nonce; - *out_salt = salt; - *out_iterations = iterations; - return TRUE; - -err: - g_free(nonce); - if (salt) - g_string_free(salt, TRUE); - g_strfreev(tokens); - return FALSE; -} - -static gboolean -parse_server_step2(JabberScramData *data, const char *challenge, gchar **out_verifier) -{ - char **tokens; - char *token; - - tokens = g_strsplit(challenge, ",", -1); - if (tokens == NULL) - return FALSE; - - token = tokens[0]; - if (token[0] != 'v' || token[1] != '=' || token[2] == '\0') { - g_strfreev(tokens); - return FALSE; - } - - *out_verifier = g_strdup(token + 2); - g_strfreev(tokens); - return TRUE; -} - -gboolean -jabber_scram_feed_parser(JabberScramData *data, gchar *in, gchar **out) -{ - gboolean ret; - - g_return_val_if_fail(data != NULL, FALSE); - - g_string_append_c(data->auth_message, ','); - g_string_append(data->auth_message, in); - - if (data->step == 1) { - gchar *nonce, *proof; - GString *salt; - guint iterations; - - ret = parse_server_step1(data, in, &nonce, &salt, &iterations); - if (!ret) - return FALSE; - - g_string_append_c(data->auth_message, ','); - - /* "biws" is the base64 encoding of "n,,". I promise. */ - g_string_append_printf(data->auth_message, "c=%s,r=%s", "biws", nonce); -#ifdef CHANNEL_BINDING -#error fix this -#endif - - ret = jabber_scram_calc_proofs(data, salt, iterations); - if (!ret) - return FALSE; - - proof = purple_base64_encode((guchar *)data->client_proof->str, data->client_proof->len); - *out = g_strdup_printf("c=%s,r=%s,p=%s", "biws", nonce, proof); - g_free(proof); - } else if (data->step == 2) { - gchar *server_sig, *enc_server_sig; - gsize len; - - ret = parse_server_step2(data, in, &enc_server_sig); - if (!ret) - return FALSE; - - server_sig = (gchar *)purple_base64_decode(enc_server_sig, &len); - g_free(enc_server_sig); - - if (server_sig == NULL || len != data->server_signature->len) { - g_free(server_sig); - return FALSE; - } - - if (0 != memcmp(server_sig, data->server_signature->str, len)) { - g_free(server_sig); - return FALSE; - } - g_free(server_sig); - - *out = NULL; - } else { - purple_debug_error("jabber", "SCRAM: There is no step %d\n", data->step); - return FALSE; - } - - return TRUE; -} - -static gchar *escape_username(const gchar *in) -{ - gchar *tmp, *tmp2; - - tmp = purple_strreplace(in, "=", "=3D"); - tmp2 = purple_strreplace(tmp, ",", "=2D"); - g_free(tmp); - return tmp2; -} - -static JabberSaslState -scram_start(JabberStream *js, xmlnode *mechanisms, xmlnode **out, char **error) -{ - xmlnode *reply; - JabberScramData *data; - guint64 cnonce; -#ifdef CHANNEL_BINDING - gboolean binding_supported = TRUE; -#endif - gchar *dec_out, *enc_out; - gchar *prepped_node, *tmp; - gchar *prepped_pass; - - prepped_node = jabber_saslprep(js->user->node); - if (!prepped_node) { - *error = g_strdup(_("Unable to canonicalize username")); - return JABBER_SASL_STATE_FAIL; - } - - tmp = escape_username(prepped_node); - g_free(prepped_node); - prepped_node = tmp; - - prepped_pass = jabber_saslprep(purple_connection_get_password(js->gc)); - if (!prepped_pass) { - g_free(prepped_node); - *error = g_strdup(_("Unable to canonicalize password")); - return JABBER_SASL_STATE_FAIL; - } - - data = js->auth_mech_data = g_new0(JabberScramData, 1); - data->hash = mech_to_hash(js->auth_mech->name); - data->password = prepped_pass; - -#ifdef CHANNEL_BINDING - if (strstr(js->auth_mech_name, "-PLUS")) - data->channel_binding = TRUE; -#endif - cnonce = ((guint64)g_random_int() << 32) | g_random_int(); - data->cnonce = purple_base64_encode((guchar *)&cnonce, sizeof(cnonce)); - - data->auth_message = g_string_new(NULL); - g_string_printf(data->auth_message, "n=%s,r=%s", - prepped_node, data->cnonce); - g_free(prepped_node); - - data->step = 1; - - reply = xmlnode_new("auth"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - xmlnode_set_attrib(reply, "mechanism", js->auth_mech->name); - - /* TODO: Channel binding */ - dec_out = g_strdup_printf("%c,,%s", 'n', data->auth_message->str); - enc_out = purple_base64_encode((guchar *)dec_out, strlen(dec_out)); - purple_debug_misc("jabber", "initial SCRAM message '%s'\n", dec_out); - - xmlnode_insert_data(reply, enc_out, -1); - - g_free(enc_out); - g_free(dec_out); - - *out = reply; - return JABBER_SASL_STATE_CONTINUE; -} - -static JabberSaslState -scram_handle_challenge(JabberStream *js, xmlnode *challenge, xmlnode **out, char **error) -{ - JabberScramData *data = js->auth_mech_data; - xmlnode *reply; - gchar *enc_in, *dec_in; - gchar *enc_out = NULL, *dec_out = NULL; - gsize len; - JabberSaslState state = JABBER_SASL_STATE_FAIL; - - enc_in = xmlnode_get_data(challenge); - if (!enc_in || *enc_in == '\0') { - reply = xmlnode_new("abort"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - data->step = -1; - *error = g_strdup(_("Invalid challenge from server")); - goto out; - } - - dec_in = (gchar *)purple_base64_decode(enc_in, &len); - g_free(enc_in); - if (!dec_in || len != strlen(dec_in)) { - /* Danger afoot; SCRAM shouldn't contain NUL bytes */ - reply = xmlnode_new("abort"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - data->step = -1; - *error = g_strdup(_("Malicious challenge from server")); - goto out; - } - - purple_debug_misc("jabber", "decoded challenge: %s\n", dec_in); - - if (!jabber_scram_feed_parser(data, dec_in, &dec_out)) { - reply = xmlnode_new("abort"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - data->step = -1; - *error = g_strdup(_("Invalid challenge from server")); - goto out; - } - - data->step += 1; - - reply = xmlnode_new("response"); - xmlnode_set_namespace(reply, NS_XMPP_SASL); - - purple_debug_misc("jabber", "decoded response: %s\n", dec_out ? dec_out : "(null)"); - if (dec_out) { - enc_out = purple_base64_encode((guchar *)dec_out, strlen(dec_out)); - xmlnode_insert_data(reply, enc_out, -1); - } - - state = JABBER_SASL_STATE_CONTINUE; - -out: - g_free(enc_out); - g_free(dec_out); - - *out = reply; - return state; -} - -static JabberSaslState -scram_handle_success(JabberStream *js, xmlnode *packet, char **error) -{ - JabberScramData *data = js->auth_mech_data; - char *enc_in, *dec_in; - char *dec_out = NULL; - gsize len; - - enc_in = xmlnode_get_data(packet); - g_return_val_if_fail(enc_in != NULL && *enc_in != '\0', FALSE); - - if (data->step == 3) - return JABBER_SASL_STATE_OK; - - if (data->step != 2) { - *error = g_strdup(_("Unexpected response from server")); - return JABBER_SASL_STATE_FAIL; - } - - dec_in = (gchar *)purple_base64_decode(enc_in, &len); - g_free(enc_in); - if (!dec_in || len != strlen(dec_in)) { - /* Danger afoot; SCRAM shouldn't contain NUL bytes */ - g_free(dec_in); - *error = g_strdup(_("Invalid challenge from server")); - return JABBER_SASL_STATE_FAIL; - } - - purple_debug_misc("jabber", "decoded success: %s\n", dec_in); - - if (!jabber_scram_feed_parser(data, dec_in, &dec_out) || dec_out != NULL) { - g_free(dec_out); - *error = g_strdup(_("Invalid challenge from server")); - return JABBER_SASL_STATE_FAIL; - } - - /* Hooray */ - return JABBER_SASL_STATE_OK; -} - -void jabber_scram_data_destroy(JabberScramData *data) -{ - g_free(data->cnonce); - if (data->auth_message) - g_string_free(data->auth_message, TRUE); - if (data->client_proof) - g_string_free(data->client_proof, TRUE); - if (data->server_signature) - g_string_free(data->server_signature, TRUE); - if (data->password) { - memset(data->password, 0, strlen(data->password)); - g_free(data->password); - } - - g_free(data); -} - -static void scram_dispose(JabberStream *js) -{ - if (js->auth_mech_data) { - jabber_scram_data_destroy(js->auth_mech_data); - js->auth_mech_data = NULL; - } -} - -static JabberSaslMech scram_sha1_mech = { - 50, /* priority */ - "SCRAM-SHA-1", /* name */ - scram_start, - scram_handle_challenge, - scram_handle_success, - NULL, /* handle_failure */ - scram_dispose -}; - -#ifdef CHANNEL_BINDING -/* With channel binding */ -static JabberSaslMech scram_sha1_plus_mech = { - scram_sha1_mech.priority + 1, /* priority */ - "SCRAM-SHA-1-PLUS", /* name */ - scram_start, - scram_handle_challenge, - scram_handle_success, - NULL, /* handle_failure */ - scram_dispose -}; -#endif - -JabberSaslMech **jabber_auth_get_scram_mechs(gint *count) -{ - static JabberSaslMech *mechs[] = { - &scram_sha1_mech, -#ifdef CHANNEL_BINDING - &scram_sha1_plus_mech, -#endif - }; - - *count = G_N_ELEMENTS(mechs); - return mechs; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/auth_scram.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -/** - * @file auth_scram.h Implementation of SASL-SCRAM authentication - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_AUTH_SCRAM_H_ -#define PURPLE_JABBER_AUTH_SCRAM_H_ - -/* - * Every function in this file is ONLY exposed for tests. - * DO NOT USE ANYTHING HERE OR YOU WILL BE SENT TO THE PIT OF DESPAIR. - */ - -/* Per-connection state stored between messages. - * This is stored in js->auth_data_mech. - */ -typedef struct { - const char *mech_substr; - const char *name; - guint size; -} JabberScramHash; - -typedef struct { - const JabberScramHash *hash; - char *cnonce; - GString *auth_message; - - GString *client_proof; - GString *server_signature; - - gchar *password; - gboolean channel_binding; - int step; -} JabberScramData; - -#include "auth.h" - -/** - * Implements the Hi() function as described in the SASL-SCRAM I-D. - * - * @param hash The struct corresponding to the hash function to be used. - * @param str The string to perform the PBKDF2 operation on. - * @param salt The salt. - * @param iterations The number of iterations to perform. - * - * @returns A newly allocated string containing the result. The string is - * NOT null-terminated and its length is the length of the binary - * output of the hash function in-use. - */ -guchar *jabber_scram_hi(const JabberScramHash *hash, const GString *str, - GString *salt, guint iterations); - -/** - * Calculates the proofs as described in Section 3 of the SASL-SCRAM I-D. - * - * @param data A JabberScramData structure. hash and auth_message must be - * set. client_proof and server_signature will be set as a result - * of this function. - * @param salt The salt (as specified by the server) - * @param iterations The number of iterations to perform. - * - * @returns TRUE if the proofs were successfully calculated. FALSE otherwise. - */ -gboolean jabber_scram_calc_proofs(JabberScramData *data, GString *salt, - guint iterations); - -/** - * Feed the algorithm with the data from the server. - */ -gboolean jabber_scram_feed_parser(JabberScramData *data, gchar *in, gchar **out); - -/** - * Clean up and destroy the data struct - */ -void jabber_scram_data_destroy(JabberScramData *data); - -#endif /* PURPLE_JABBER_AUTH_SCRAM_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1028 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "circbuffer.h" -#include "core.h" -#include "cipher.h" -#include "debug.h" -#include "prpl.h" -#include "util.h" -#include "xmlnode.h" - -#include "bosh.h" - -/* The number of HTTP connections to use. This MUST be at least 2. */ -#define NUM_HTTP_CONNECTIONS 2 -/* How many failed connection attempts before it becomes a fatal error */ -#define MAX_FAILED_CONNECTIONS 3 -/* How long in seconds to queue up outgoing messages */ -#define BUFFER_SEND_IN_SECS 1 - -typedef struct _PurpleHTTPConnection PurpleHTTPConnection; - -typedef void (*PurpleBOSHConnectionConnectFunction)(PurpleBOSHConnection *conn); -typedef void (*PurpleBOSHConnectionReceiveFunction)(PurpleBOSHConnection *conn, xmlnode *node); - -static char *bosh_useragent = NULL; - -typedef enum { - PACKET_NORMAL, - PACKET_TERMINATE, - PACKET_FLUSH, -} PurpleBOSHPacketType; - -struct _PurpleBOSHConnection { - JabberStream *js; - PurpleHTTPConnection *connections[NUM_HTTP_CONNECTIONS]; - - PurpleCircBuffer *pending; - PurpleBOSHConnectionConnectFunction connect_cb; - PurpleBOSHConnectionReceiveFunction receive_cb; - - /* Must be big enough to hold 2^53 - 1 */ - char *sid; - guint64 rid; - - /* decoded URL */ - char *host; - char *path; - guint16 port; - - gboolean pipelining; - gboolean ssl; - - enum { - BOSH_CONN_OFFLINE, - BOSH_CONN_BOOTING, - BOSH_CONN_ONLINE - } state; - guint8 failed_connections; - - int max_inactivity; - int wait; - - int max_requests; - int requests; - - guint inactivity_timer; - guint send_timer; -}; - -struct _PurpleHTTPConnection { - PurpleBOSHConnection *bosh; - PurpleSslConnection *psc; - - PurpleCircBuffer *write_buf; - GString *read_buf; - - gsize handled_len; - gsize body_len; - - int fd; - guint readh; - guint writeh; - - enum { - HTTP_CONN_OFFLINE, - HTTP_CONN_CONNECTING, - HTTP_CONN_CONNECTED - } state; - int requests; /* number of outstanding HTTP requests */ - - gboolean headers_done; - -}; - -static void http_connection_connect(PurpleHTTPConnection *conn); -static void http_connection_send_request(PurpleHTTPConnection *conn, - const GString *req); -static gboolean send_timer_cb(gpointer data); - -void jabber_bosh_init(void) -{ - GHashTable *ui_info = purple_core_get_ui_info(); - const char *ui_name = NULL; - const char *ui_version = NULL; - - if (ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_version = g_hash_table_lookup(ui_info, "version"); - } - - if (ui_name) - bosh_useragent = g_strdup_printf("%s%s%s (libpurple " VERSION ")", - ui_name, ui_version ? " " : "", - ui_version ? ui_version : ""); - else - bosh_useragent = g_strdup("libpurple " VERSION); -} - -void jabber_bosh_uninit(void) -{ - g_free(bosh_useragent); - bosh_useragent = NULL; -} - -static PurpleHTTPConnection* -jabber_bosh_http_connection_init(PurpleBOSHConnection *bosh) -{ - PurpleHTTPConnection *conn = g_new0(PurpleHTTPConnection, 1); - conn->bosh = bosh; - conn->fd = -1; - conn->state = HTTP_CONN_OFFLINE; - - conn->write_buf = purple_circ_buffer_new(0 /* default grow size */); - - return conn; -} - -static void -jabber_bosh_http_connection_destroy(PurpleHTTPConnection *conn) -{ - if (conn->read_buf) - g_string_free(conn->read_buf, TRUE); - - if (conn->write_buf) - purple_circ_buffer_destroy(conn->write_buf); - if (conn->readh) - purple_input_remove(conn->readh); - if (conn->writeh) - purple_input_remove(conn->writeh); - if (conn->psc) - purple_ssl_close(conn->psc); - if (conn->fd >= 0) - close(conn->fd); - - purple_proxy_connect_cancel_with_handle(conn); - - g_free(conn); -} - -PurpleBOSHConnection* -jabber_bosh_connection_init(JabberStream *js, const char *url) -{ - PurpleBOSHConnection *conn; - char *host, *path, *user, *passwd; - int port; - - if (!purple_url_parse(url, &host, &port, &path, &user, &passwd)) { - purple_debug_info("jabber", "Unable to parse given URL.\n"); - return NULL; - } - - conn = g_new0(PurpleBOSHConnection, 1); - conn->host = host; - conn->port = port; - conn->path = g_strdup_printf("/%s", path); - g_free(path); - conn->pipelining = TRUE; - - if ((user && user[0] != '\0') || (passwd && passwd[0] != '\0')) { - purple_debug_info("jabber", "Ignoring unexpected username and password " - "in BOSH URL.\n"); - } - - g_free(user); - g_free(passwd); - - conn->js = js; - - /* - * Random 64-bit integer masked off by 2^52 - 1. - * - * This should produce a random integer in the range [0, 2^52). It's - * unlikely we'll send enough packets in one session to overflow the rid. - */ - conn->rid = ((guint64)g_random_int() << 32) | g_random_int(); - conn->rid &= 0xFFFFFFFFFFFFFLL; - - conn->pending = purple_circ_buffer_new(0 /* default grow size */); - - conn->state = BOSH_CONN_OFFLINE; - if (purple_strcasestr(url, "https://") != NULL) - conn->ssl = TRUE; - else - conn->ssl = FALSE; - - conn->connections[0] = jabber_bosh_http_connection_init(conn); - - return conn; -} - -void -jabber_bosh_connection_destroy(PurpleBOSHConnection *conn) -{ - int i; - - g_free(conn->host); - g_free(conn->path); - - if (conn->send_timer) - purple_timeout_remove(conn->send_timer); - if (conn->inactivity_timer) - purple_timeout_remove(conn->inactivity_timer); - - purple_circ_buffer_destroy(conn->pending); - - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (conn->connections[i]) - jabber_bosh_http_connection_destroy(conn->connections[i]); - } - - g_free(conn); -} - -gboolean jabber_bosh_connection_is_ssl(PurpleBOSHConnection *conn) -{ - return conn->ssl; -} - -static PurpleHTTPConnection * -find_available_http_connection(PurpleBOSHConnection *conn) -{ - int i; - - if (purple_debug_is_verbose()) { - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - PurpleHTTPConnection *httpconn = conn->connections[i]; - if (httpconn == NULL) - purple_debug_misc("jabber", "BOSH %p->connections[%d] = (nil)\n", - conn, i); - else - purple_debug_misc("jabber", "BOSH %p->connections[%d] = %p, state = %d" - ", requests = %d\n", conn, i, httpconn, - httpconn->state, httpconn->requests); - } - } - - /* Easy solution: Does everyone involved support pipelining? Hooray! Just use - * one TCP connection! */ - if (conn->pipelining) - return conn->connections[0]->state == HTTP_CONN_CONNECTED ? - conn->connections[0] : NULL; - - /* First loop, look for a connection that's ready */ - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (conn->connections[i] && - conn->connections[i]->state == HTTP_CONN_CONNECTED && - conn->connections[i]->requests == 0) - return conn->connections[i]; - } - - /* Second loop, is something currently connecting? If so, just queue up. */ - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (conn->connections[i] && - conn->connections[i]->state == HTTP_CONN_CONNECTING) - return NULL; - } - - /* Third loop, look for one that's NULL and create a new connection */ - for (i = 0; i < NUM_HTTP_CONNECTIONS; ++i) { - if (!conn->connections[i]) { - purple_debug_info("jabber", "bosh: Creating and connecting new httpconn\n"); - conn->connections[i] = jabber_bosh_http_connection_init(conn); - - http_connection_connect(conn->connections[i]); - return NULL; - } - } - - purple_debug_warning("jabber", "Could not find a HTTP connection!\n"); - - /* None available. */ - return NULL; -} - -static void -jabber_bosh_connection_send(PurpleBOSHConnection *conn, - const PurpleBOSHPacketType type, const char *data) -{ - PurpleHTTPConnection *chosen; - GString *packet = NULL; - - if (type != PACKET_FLUSH && type != PACKET_TERMINATE) { - /* - * Unless this is a flush (or session terminate, which needs to be - * sent immediately), queue up the data and start a timer to flush - * the buffer. - */ - if (data) { - int len = data ? strlen(data) : 0; - purple_circ_buffer_append(conn->pending, data, len); - } - - if (purple_debug_is_verbose()) - purple_debug_misc("jabber", "bosh: %p has %" G_GSIZE_FORMAT " bytes in " - "the buffer.\n", conn, conn->pending->bufused); - if (conn->send_timer == 0) - conn->send_timer = purple_timeout_add_seconds(BUFFER_SEND_IN_SECS, - send_timer_cb, conn); - return; - } - - chosen = find_available_http_connection(conn); - - if (!chosen) { - /* - * For non-ordinary traffic, we can't 'buffer' it, so use the - * first connection. - */ - chosen = conn->connections[0]; - - if (chosen->state != HTTP_CONN_CONNECTED) { - purple_debug_warning("jabber", "Unable to find a ready BOSH " - "connection. Ignoring send of type 0x%02x.\n", type); - return; - } - } - - /* We're flushing the send buffer, so remove the send timer */ - if (conn->send_timer != 0) { - purple_timeout_remove(conn->send_timer); - conn->send_timer = 0; - } - - packet = g_string_new(NULL); - - g_string_printf(packet, "rid, - conn->sid, - conn->js->user->domain); - - if (conn->js->reinit) { - packet = g_string_append(packet, " xmpp:restart='true'/>"); - /* TODO: Do we need to wait for a response? */ - conn->js->reinit = FALSE; - } else { - gsize read_amt; - if (type == PACKET_TERMINATE) - packet = g_string_append(packet, " type='terminate'"); - - packet = g_string_append_c(packet, '>'); - - while ((read_amt = purple_circ_buffer_get_max_read(conn->pending)) > 0) { - packet = g_string_append_len(packet, conn->pending->outptr, read_amt); - purple_circ_buffer_mark_read(conn->pending, read_amt); - } - - if (data) - packet = g_string_append(packet, data); - packet = g_string_append(packet, ""); - } - - http_connection_send_request(chosen, packet); -} - -void jabber_bosh_connection_close(PurpleBOSHConnection *conn) -{ - if (conn->state == BOSH_CONN_ONLINE) - jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL); -} - -static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, xmlnode *node) { - const char *type; - - type = xmlnode_get_attrib(node, "type"); - - if (type != NULL && !strcmp(type, "terminate")) { - conn->state = BOSH_CONN_OFFLINE; - purple_connection_error_reason(conn->js->gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("The BOSH connection manager terminated your session.")); - return TRUE; - } - return FALSE; -} - -static gboolean -send_timer_cb(gpointer data) -{ - PurpleBOSHConnection *bosh; - - bosh = data; - bosh->send_timer = 0; - - jabber_bosh_connection_send(bosh, PACKET_FLUSH, NULL); - - return FALSE; -} - -static gboolean -bosh_inactivity_cb(gpointer data) -{ - PurpleBOSHConnection *bosh = data; - bosh->inactivity_timer = 0; - - if (bosh->send_timer != 0) - purple_timeout_remove(bosh->send_timer); - - /* clears bosh->send_timer */ - send_timer_cb(bosh); - - return FALSE; -} - -static void -restart_inactivity_timer(PurpleBOSHConnection *conn) -{ - if (conn->inactivity_timer != 0) { - purple_timeout_remove(conn->inactivity_timer); - conn->inactivity_timer = 0; - } - - if (conn->max_inactivity != 0) { - conn->inactivity_timer = - purple_timeout_add_seconds(conn->max_inactivity - 5 /* rounding */, - bosh_inactivity_cb, conn); - } -} - -static void jabber_bosh_connection_received(PurpleBOSHConnection *conn, xmlnode *node) { - xmlnode *child; - JabberStream *js = conn->js; - - g_return_if_fail(node != NULL); - if (jabber_bosh_connection_error_check(conn, node)) - return; - - child = node->child; - while (child != NULL) { - /* jabber_process_packet might free child */ - xmlnode *next = child->next; - if (child->type == XMLNODE_TYPE_TAG) { - const char *xmlns = xmlnode_get_namespace(child); - /* - * Workaround for non-compliant servers that don't stamp - * the right xmlns on these packets. See #11315. - */ - if ((xmlns == NULL /* shouldn't happen, but is equally wrong */ || - g_str_equal(xmlns, NS_BOSH)) && - (g_str_equal(child->name, "iq") || - g_str_equal(child->name, "message") || - g_str_equal(child->name, "presence"))) { - xmlnode_set_namespace(child, NS_XMPP_CLIENT); - } - jabber_process_packet(js, &child); - } - - child = next; - } -} - -static void boot_response_cb(PurpleBOSHConnection *conn, xmlnode *node) { - JabberStream *js = conn->js; - const char *sid, *version; - const char *inactivity, *requests; - xmlnode *packet; - - g_return_if_fail(node != NULL); - if (jabber_bosh_connection_error_check(conn, node)) - return; - - sid = xmlnode_get_attrib(node, "sid"); - version = xmlnode_get_attrib(node, "ver"); - - inactivity = xmlnode_get_attrib(node, "inactivity"); - requests = xmlnode_get_attrib(node, "requests"); - - if (sid) { - conn->sid = g_strdup(sid); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("No session ID given")); - return; - } - - if (version) { - const char *dot = strstr(version, "."); - int major, minor = 0; - - purple_debug_info("jabber", "BOSH connection manager version %s\n", version); - - major = atoi(version); - if (dot) - minor = atoi(dot + 1); - - if (major != 1 || minor < 6) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unsupported version of BOSH protocol")); - return; - } - } else { - purple_debug_info("jabber", "Missing version in BOSH initiation\n"); - } - - if (inactivity) { - conn->max_inactivity = atoi(inactivity); - if (conn->max_inactivity <= 5) { - purple_debug_warning("jabber", "Ignoring bogusly small inactivity: %s\n", - inactivity); - conn->max_inactivity = 0; - } else { - /* TODO: Integrate this with jabber.c keepalive checks... */ - /* TODO: Can this check fail? It shouldn't */ - if (conn->inactivity_timer == 0) { - purple_debug_misc("jabber", "Starting BOSH inactivity timer " - "for %d secs (compensating for rounding)\n", - conn->max_inactivity - 5); - restart_inactivity_timer(conn); - } - } - } - - if (requests) - conn->max_requests = atoi(requests); - - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - - /* FIXME: Depending on receiving features might break with some hosts */ - packet = xmlnode_get_child(node, "features"); - conn->state = BOSH_CONN_ONLINE; - conn->receive_cb = jabber_bosh_connection_received; - jabber_stream_features_parse(js, packet); -} - -static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) { - GString *buf = g_string_new(NULL); - - g_string_printf(buf, "", - conn->js->user->domain, - ++conn->rid); - - purple_debug_misc("jabber", "SendBOSH Boot %s(%" G_GSIZE_FORMAT "): %s\n", - conn->ssl ? "(ssl)" : "", buf->len, buf->str); - conn->receive_cb = boot_response_cb; - http_connection_send_request(conn->connections[0], buf); - g_string_free(buf, TRUE); -} - -static void -http_received_cb(const char *data, int len, PurpleBOSHConnection *conn) -{ - if (conn->failed_connections) - /* We've got some data, so reset the number of failed connections */ - conn->failed_connections = 0; - - if (conn->receive_cb) { - xmlnode *node = xmlnode_from_str(data, len); - - purple_debug_info("jabber", "RecvBOSH %s(%d): %s\n", - conn->ssl ? "(ssl)" : "", len, data); - - if (node) { - conn->receive_cb(conn, node); - xmlnode_free(node); - } else { - purple_debug_warning("jabber", "BOSH: Received invalid XML\n"); - } - } else { - g_return_if_reached(); - } -} - -void jabber_bosh_connection_send_raw(PurpleBOSHConnection *conn, - const char *data) -{ - jabber_bosh_connection_send(conn, PACKET_NORMAL, data); -} - -static void -connection_common_established_cb(PurpleHTTPConnection *conn) -{ - /* Indicate we're ready and reset some variables */ - conn->state = HTTP_CONN_CONNECTED; - if (conn->requests != 0) - purple_debug_error("jabber", "bosh: httpconn %p has %d requests, != 0\n", - conn, conn->requests); - - conn->requests = 0; - if (conn->read_buf) { - g_string_free(conn->read_buf, TRUE); - conn->read_buf = NULL; - } - conn->headers_done = FALSE; - conn->handled_len = conn->body_len = 0; - - if (conn->bosh->js->reinit) - jabber_bosh_connection_send(conn->bosh, PACKET_NORMAL, NULL); - else if (conn->bosh->state == BOSH_CONN_ONLINE) { - purple_debug_info("jabber", "BOSH session already exists. Trying to reuse it.\n"); - if (conn->bosh->requests == 0 || conn->bosh->pending->bufused > 0) { - /* Send the pending data */ - jabber_bosh_connection_send(conn->bosh, PACKET_FLUSH, NULL); - } - } else - jabber_bosh_connection_boot(conn->bosh); -} - -static void http_connection_disconnected(PurpleHTTPConnection *conn) -{ - /* - * Well, then. Fine! I never liked you anyway, server! I was cheating on you - * with AIM! - */ - conn->state = HTTP_CONN_OFFLINE; - if (conn->psc) { - purple_ssl_close(conn->psc); - conn->psc = NULL; - } else if (conn->fd >= 0) { - close(conn->fd); - conn->fd = -1; - } - - if (conn->readh) { - purple_input_remove(conn->readh); - conn->readh = 0; - } - - if (conn->writeh) { - purple_input_remove(conn->writeh); - conn->writeh = 0; - } - - if (conn->requests > 0 && conn->read_buf->len == 0) { - purple_debug_error("jabber", "bosh: Adjusting BOSHconn requests (%d) to %d\n", - conn->bosh->requests, conn->bosh->requests - conn->requests); - conn->bosh->requests -= conn->requests; - conn->requests = 0; - } - - if (conn->bosh->pipelining) { - /* Hmmmm, fall back to multiple connections */ - conn->bosh->pipelining = FALSE; - if (conn->bosh->connections[1] == NULL) { - conn->bosh->connections[1] = jabber_bosh_http_connection_init(conn->bosh); - http_connection_connect(conn->bosh->connections[1]); - } - } - - if (++conn->bosh->failed_connections == MAX_FAILED_CONNECTIONS) { - purple_connection_error_reason(conn->bosh->js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to establish a connection with the server")); - } else { - /* No! Please! Take me back. It was me, not you! I was weak! */ - http_connection_connect(conn); - } -} - -void jabber_bosh_connection_connect(PurpleBOSHConnection *bosh) { - PurpleHTTPConnection *conn = bosh->connections[0]; - - g_return_if_fail(bosh->state == BOSH_CONN_OFFLINE); - bosh->state = BOSH_CONN_BOOTING; - - http_connection_connect(conn); -} - -static void -jabber_bosh_http_connection_process(PurpleHTTPConnection *conn) -{ - const char *cursor; - - cursor = conn->read_buf->str + conn->handled_len; - - if (!conn->headers_done) { - const char *content_length = purple_strcasestr(cursor, "\r\nContent-Length"); - const char *end_of_headers = strstr(cursor, "\r\n\r\n"); - - /* Make sure Content-Length is in headers, not body */ - if (content_length && (!end_of_headers || content_length < end_of_headers)) { - const char *sep; - const char *eol; - int len; - - if ((sep = strstr(content_length, ": ")) == NULL || - (eol = strstr(sep, "\r\n")) == NULL) - /* - * The packet ends in the middle of the Content-Length line. - * We'll try again later when we have more. - */ - return; - - len = atoi(sep + 2); - if (len == 0) - purple_debug_warning("jabber", "Found mangled Content-Length header.\n"); - - conn->body_len = len; - } - - if (end_of_headers) { - conn->headers_done = TRUE; - conn->handled_len = end_of_headers - conn->read_buf->str + 4; - cursor = end_of_headers + 4; - } else { - conn->handled_len = conn->read_buf->len; - return; - } - } - - /* Have we handled everything in the buffer? */ - if (conn->handled_len >= conn->read_buf->len) - return; - - /* Have we read all that the Content-Length promised us? */ - if (conn->read_buf->len - conn->handled_len < conn->body_len) - return; - - --conn->requests; - --conn->bosh->requests; - - http_received_cb(conn->read_buf->str + conn->handled_len, conn->body_len, - conn->bosh); - - if (conn->bosh->state == BOSH_CONN_ONLINE && - (conn->bosh->requests == 0 || conn->bosh->pending->bufused > 0)) { - purple_debug_misc("jabber", "BOSH: Sending an empty request\n"); - jabber_bosh_connection_send(conn->bosh, PACKET_NORMAL, NULL); - } - - g_string_free(conn->read_buf, TRUE); - conn->read_buf = NULL; - conn->headers_done = FALSE; - conn->handled_len = conn->body_len = 0; -} - -/* - * Common code for reading, called from http_connection_read_cb_ssl and - * http_connection_read_cb. - */ -static void -http_connection_read(PurpleHTTPConnection *conn) -{ - char buffer[1025]; - int cnt, count = 0; - - if (!conn->read_buf) - conn->read_buf = g_string_new(NULL); - - do { - if (conn->psc) - cnt = purple_ssl_read(conn->psc, buffer, sizeof(buffer)); - else - cnt = read(conn->fd, buffer, sizeof(buffer)); - - if (cnt > 0) { - count += cnt; - g_string_append_len(conn->read_buf, buffer, cnt); - } - } while (cnt > 0); - - if (cnt == 0 || (cnt < 0 && errno != EAGAIN)) { - if (cnt < 0) - purple_debug_info("jabber", "bosh read=%d, errno=%d, error=%s\n", - cnt, errno, g_strerror(errno)); - else - purple_debug_info("jabber", "bosh server closed the connection\n"); - - /* - * If the socket is closed, the processing really needs to know about - * it. Handle that now. - */ - http_connection_disconnected(conn); - - /* Process what we do have */ - } - - if (conn->read_buf->len > 0) - jabber_bosh_http_connection_process(conn); -} - -static void -http_connection_read_cb(gpointer data, gint fd, PurpleInputCondition condition) -{ - PurpleHTTPConnection *conn = data; - - http_connection_read(conn); -} - -static void -http_connection_read_cb_ssl(gpointer data, PurpleSslConnection *psc, - PurpleInputCondition cond) -{ - PurpleHTTPConnection *conn = data; - - http_connection_read(conn); -} - -static void -ssl_connection_established_cb(gpointer data, PurpleSslConnection *psc, - PurpleInputCondition cond) -{ - PurpleHTTPConnection *conn = data; - - purple_ssl_input_add(psc, http_connection_read_cb_ssl, conn); - connection_common_established_cb(conn); -} - -static void -ssl_connection_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - PurpleHTTPConnection *conn = data; - - /* sslconn frees the connection on error */ - conn->psc = NULL; - - purple_connection_ssl_error(conn->bosh->js->gc, error); -} - -static void -connection_established_cb(gpointer data, gint source, const gchar *error) -{ - PurpleHTTPConnection *conn = data; - PurpleConnection *gc = conn->bosh->js->gc; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to establish a connection with the server: %s"), - error); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - conn->fd = source; - conn->readh = purple_input_add(conn->fd, PURPLE_INPUT_READ, - http_connection_read_cb, conn); - connection_common_established_cb(conn); -} - -static void http_connection_connect(PurpleHTTPConnection *conn) -{ - PurpleBOSHConnection *bosh = conn->bosh; - PurpleConnection *gc = bosh->js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - conn->state = HTTP_CONN_CONNECTING; - - if (bosh->ssl) { - if (purple_ssl_is_supported()) { - conn->psc = purple_ssl_connect(account, bosh->host, bosh->port, - ssl_connection_established_cb, - ssl_connection_error_cb, - conn); - if (!conn->psc) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Unable to establish SSL connection")); - } - } else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - } - } else if (purple_proxy_connect(conn, account, bosh->host, bosh->port, - connection_established_cb, conn) == NULL) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } -} - -static int -http_connection_do_send(PurpleHTTPConnection *conn, const char *data, int len) -{ - int ret; - - if (conn->psc) - ret = purple_ssl_write(conn->psc, data, len); - else - ret = write(conn->fd, data, len); - - return ret; -} - -static void -http_connection_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleHTTPConnection *conn = data; - int ret; - int writelen = purple_circ_buffer_get_max_read(conn->write_buf); - - if (writelen == 0) { - purple_input_remove(conn->writeh); - conn->writeh = 0; - return; - } - - ret = http_connection_do_send(conn, conn->write_buf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - /* - * TODO: Handle this better. Probably requires a PurpleBOSHConnection - * buffer that stores what is "being sent" until the - * PurpleHTTPConnection reports it is fully sent. - */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(conn->bosh->js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(conn->write_buf, ret); -} - -static void -http_connection_send_request(PurpleHTTPConnection *conn, const GString *req) -{ - char *data; - int ret; - size_t len; - - /* Sending something to the server, restart the inactivity timer */ - restart_inactivity_timer(conn->bosh); - - data = g_strdup_printf("POST %s HTTP/1.1\r\n" - "Host: %s\r\n" - "User-Agent: %s\r\n" - "Content-Encoding: text/xml; charset=utf-8\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n" - "%s", - conn->bosh->path, conn->bosh->host, bosh_useragent, - req->len, req->str); - - len = strlen(data); - - ++conn->requests; - ++conn->bosh->requests; - - if (purple_debug_is_unsafe() && purple_debug_is_verbose()) - /* Will contain passwords for SASL PLAIN and is verbose */ - purple_debug_misc("jabber", "BOSH: Sending %s\n", data); - - if (conn->writeh == 0) - ret = http_connection_do_send(conn, data, len); - else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno != EAGAIN) { - /* - * TODO: Handle this better. Probably requires a PurpleBOSHConnection - * buffer that stores what is "being sent" until the - * PurpleHTTPConnection reports it is fully sent. - */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(conn->bosh->js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - return; - } else if (ret < len) { - if (ret < 0) - ret = 0; - if (conn->writeh == 0) - conn->writeh = purple_input_add(conn->psc ? conn->psc->fd : conn->fd, - PURPLE_INPUT_WRITE, http_connection_send_cb, conn); - purple_circ_buffer_append(conn->write_buf, data + ret, len - ret); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/bosh.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/** - * @file bosh.h Bidirectional-streams over Synchronous HTTP (BOSH) (XEP-0124 and XEP-0206) - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_BOSH_H_ -#define PURPLE_JABBER_BOSH_H_ - -typedef struct _PurpleBOSHConnection PurpleBOSHConnection; - -#include "jabber.h" - -void jabber_bosh_init(void); -void jabber_bosh_uninit(void); - -PurpleBOSHConnection* jabber_bosh_connection_init(JabberStream *js, const char *url); -void jabber_bosh_connection_destroy(PurpleBOSHConnection *conn); - -gboolean jabber_bosh_connection_is_ssl(PurpleBOSHConnection *conn); - -void jabber_bosh_connection_connect(PurpleBOSHConnection *conn); -void jabber_bosh_connection_close(PurpleBOSHConnection *conn); -void jabber_bosh_connection_send_raw(PurpleBOSHConnection *conn, const char *data); -#endif /* PURPLE_JABBER_BOSH_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2423 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "imgstore.h" -#include "prpl.h" -#include "notify.h" -#include "request.h" -#include "util.h" -#include "xmlnode.h" - -#include "buddy.h" -#include "chat.h" -#include "jabber.h" -#include "iq.h" -#include "presence.h" -#include "useravatar.h" -#include "xdata.h" -#include "pep.h" -#include "adhoccommands.h" -#include "google.h" - -typedef struct { - long idle_seconds; -} JabberBuddyInfoResource; - -typedef struct { - JabberStream *js; - JabberBuddy *jb; - char *jid; - GSList *ids; - GHashTable *resources; - guint timeout_handle; - GSList *vcard_imgids; - PurpleNotifyUserInfo *user_info; - long last_seconds; - gchar *last_message; -} JabberBuddyInfo; - -void jabber_buddy_free(JabberBuddy *jb) -{ - g_return_if_fail(jb != NULL); - - g_free(jb->error_msg); - while(jb->resources) - jabber_buddy_resource_free(jb->resources->data); - - g_free(jb); -} - -JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, - gboolean create) -{ - JabberBuddy *jb; - char *realname; - - if (js->buddies == NULL) - return NULL; - - if(!(realname = jabber_get_bare_jid(name))) - return NULL; - - jb = g_hash_table_lookup(js->buddies, realname); - - if(!jb && create) { - jb = g_new0(JabberBuddy, 1); - g_hash_table_insert(js->buddies, realname, jb); - } else - g_free(realname); - - return jb; -} - -static gint resource_compare_cb(gconstpointer a, gconstpointer b) -{ - const JabberBuddyResource *jbra = a; - const JabberBuddyResource *jbrb = b; - JabberBuddyState state_a, state_b; - - if (jbra->priority != jbrb->priority) - return jbra->priority > jbrb->priority ? 1 : -1; - - /* Fold the states for easier comparison */ - switch (jbra->state) { - case JABBER_BUDDY_STATE_ONLINE: - case JABBER_BUDDY_STATE_CHAT: - state_a = JABBER_BUDDY_STATE_ONLINE; - break; - case JABBER_BUDDY_STATE_AWAY: - case JABBER_BUDDY_STATE_DND: - state_a = JABBER_BUDDY_STATE_AWAY; - break; - case JABBER_BUDDY_STATE_XA: - state_a = JABBER_BUDDY_STATE_XA; - break; - case JABBER_BUDDY_STATE_UNAVAILABLE: - state_a = JABBER_BUDDY_STATE_UNAVAILABLE; - break; - default: - state_a = JABBER_BUDDY_STATE_UNKNOWN; - break; - } - - switch (jbrb->state) { - case JABBER_BUDDY_STATE_ONLINE: - case JABBER_BUDDY_STATE_CHAT: - state_b = JABBER_BUDDY_STATE_ONLINE; - break; - case JABBER_BUDDY_STATE_AWAY: - case JABBER_BUDDY_STATE_DND: - state_b = JABBER_BUDDY_STATE_AWAY; - break; - case JABBER_BUDDY_STATE_XA: - state_b = JABBER_BUDDY_STATE_XA; - break; - case JABBER_BUDDY_STATE_UNAVAILABLE: - state_b = JABBER_BUDDY_STATE_UNAVAILABLE; - break; - default: - state_b = JABBER_BUDDY_STATE_UNKNOWN; - break; - } - - if (state_a == state_b) { - if (jbra->idle == jbrb->idle) - return 0; - else if ((jbra->idle && !jbrb->idle) || - (jbra->idle && jbrb->idle && jbra->idle < jbrb->idle)) - return -1; - else - return 1; - } - - if (state_a == JABBER_BUDDY_STATE_ONLINE) - return 1; - else if (state_a == JABBER_BUDDY_STATE_AWAY && - (state_b == JABBER_BUDDY_STATE_XA || - state_b == JABBER_BUDDY_STATE_UNAVAILABLE || - state_b == JABBER_BUDDY_STATE_UNKNOWN)) - return 1; - else if (state_a == JABBER_BUDDY_STATE_XA && - (state_b == JABBER_BUDDY_STATE_UNAVAILABLE || - state_b == JABBER_BUDDY_STATE_UNKNOWN)) - return 1; - else if (state_a == JABBER_BUDDY_STATE_UNAVAILABLE && - state_b == JABBER_BUDDY_STATE_UNKNOWN) - return 1; - - return -1; -} - -JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, - const char *resource) -{ - JabberBuddyResource *jbr = NULL; - GList *l; - - if(!jb) - return NULL; - - for(l = jb->resources; l; l = l->next) - { - JabberBuddyResource *tmp = (JabberBuddyResource *) l->data; - if (!jbr && !resource) { - jbr = tmp; - } else if (!resource) { - if (resource_compare_cb(tmp, jbr) > 0) - jbr = tmp; - } else if(tmp->name) { - if(!strcmp(tmp->name, resource)) { - jbr = tmp; - break; - } - } - } - - return jbr; -} - -JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, - int priority, JabberBuddyState state, const char *status) -{ - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); - if(!jbr) { - jbr = g_new0(JabberBuddyResource, 1); - jbr->jb = jb; - jbr->name = g_strdup(resource); - jbr->capabilities = JABBER_CAP_NONE; - jbr->tz_off = PURPLE_NO_TZ_OFF; - jb->resources = g_list_append(jb->resources, jbr); - } - jbr->priority = priority; - jbr->state = state; - g_free(jbr->status); - jbr->status = g_strdup(status); - - return jbr; -} - -void jabber_buddy_resource_free(JabberBuddyResource *jbr) -{ - g_return_if_fail(jbr != NULL); - - jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); - - while(jbr->commands) { - JabberAdHocCommands *cmd = jbr->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); - } - - if (jbr->caps.exts) { - g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); - g_list_free(jbr->caps.exts); - } - g_free(jbr->name); - g_free(jbr->status); - g_free(jbr->thread_id); - g_free(jbr->client.name); - g_free(jbr->client.version); - g_free(jbr->client.os); - g_free(jbr); -} - -void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource) -{ - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); - - if(!jbr) - return; - - jabber_buddy_resource_free(jbr); -} - -/******* - * This is the old vCard stuff taken from the old prpl. vCards, by definition - * are a temporary thing until jabber can get its act together and come up - * with a format for user information, hence the namespace of 'vcard-temp' - * - * Since I don't feel like putting that much work into something that's - * _supposed_ to go away, i'm going to just copy the kludgy old code here, - * and make it purdy when jabber comes up with a standards-track JEP to - * replace vcard-temp - * --Nathan - *******/ - -/*---------------------------------------*/ -/* Jabber "set info" (vCard) support */ -/*---------------------------------------*/ - -/* - * V-Card format: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * <ROLE/> - * <DESC/> - * <BDAY/> - * </vCard> - * - * See also: - * - * http://docs.jabber.org/proto/html/vcard-temp.html - * http://www.vcard-xml.org/dtd/vCard-XML-v2-20010520.dtd - */ - -/* - * Cross-reference user-friendly V-Card entry labels to vCard XML tags - * and attributes. - * - * Order is (or should be) unimportant. For example: we have no way of - * knowing in what order real data will arrive. - * - * Format: Label, Pre-set text, "visible" flag, "editable" flag, XML tag - * name, XML tag's parent tag "path" (relative to vCard node). - * - * List is terminated by a NULL label pointer. - * - * Entries with no label text, but with XML tag and parent tag - * entries, are used by V-Card XML construction routines to - * "automagically" construct the appropriate XML node tree. - * - * Thoughts on future direction/expansion - * - * This is a "simple" vCard. - * - * It is possible for nodes other than the "vCard" node to have - * attributes. Should that prove necessary/desirable, add an - * "attributes" pointer to the vcard_template struct, create the - * necessary tag_attr structs, and add 'em to the vcard_dflt_data - * array. - * - * The above changes will (obviously) require changes to the vCard - * construction routines. - */ - -struct vcard_template { - char *label; /* label text pointer */ - char *tag; /* tag text */ - char *ptag; /* parent tag "path" text */ -} const vcard_template_data[] = { - {N_("Full Name"), "FN", NULL}, - {N_("Family Name"), "FAMILY", "N"}, - {N_("Given Name"), "GIVEN", "N"}, - {N_("Nickname"), "NICKNAME", NULL}, - {N_("URL"), "URL", NULL}, - {N_("Street Address"), "STREET", "ADR"}, - {N_("Extended Address"), "EXTADD", "ADR"}, - {N_("Locality"), "LOCALITY", "ADR"}, - {N_("Region"), "REGION", "ADR"}, - {N_("Postal Code"), "PCODE", "ADR"}, - {N_("Country"), "CTRY", "ADR"}, - {N_("Telephone"), "NUMBER", "TEL"}, - {N_("Email"), "USERID", "EMAIL"}, - {N_("Organization Name"), "ORGNAME", "ORG"}, - {N_("Organization Unit"), "ORGUNIT", "ORG"}, - {N_("Title"), "TITLE", NULL}, - {N_("Role"), "ROLE", NULL}, - {N_("Birthday"), "BDAY", NULL}, - {N_("Description"), "DESC", NULL}, - {"", "N", NULL}, - {"", "ADR", NULL}, - {"", "ORG", NULL}, - {NULL, NULL, NULL} -}; - -/* - * The "vCard" tag's attribute list... - */ -struct tag_attr { - char *attr; - char *value; -} const vcard_tag_attr_list[] = { - {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, - {"version", "2.0", }, - {"xmlns", "vcard-temp", }, - {NULL, NULL}, -}; - - -/* - * Insert a tag node into an xmlnode tree, recursively inserting parent tag - * nodes as necessary - * - * Returns pointer to inserted node - * - * Note to hackers: this code is designed to be re-entrant (it's recursive--it - * calls itself), so don't put any "static"s in here! - */ -static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, const char *new_tag) -{ - xmlnode *x = NULL; - - /* - * If the parent tag wasn't specified, see if we can get it - * from the vCard template struct. - */ - if(parent_tag == NULL) { - const struct vcard_template *vc_tp = vcard_template_data; - - while(vc_tp->label != NULL) { - if(strcmp(vc_tp->tag, new_tag) == 0) { - parent_tag = vc_tp->ptag; - break; - } - ++vc_tp; - } - } - - /* - * If we have a parent tag... - */ - if(parent_tag != NULL ) { - /* - * Try to get the parent node for a tag - */ - if((x = xmlnode_get_child(start, parent_tag)) == NULL) { - /* - * Descend? - */ - char *grand_parent = g_strdup(parent_tag); - char *parent; - - if((parent = strrchr(grand_parent, '/')) != NULL) { - *(parent++) = '\0'; - x = insert_tag_to_parent_tag(start, grand_parent, parent); - } else { - x = xmlnode_new_child(start, grand_parent); - } - g_free(grand_parent); - } else { - /* - * We found *something* to be the parent node. - * Note: may be the "root" node! - */ - xmlnode *y; - if((y = xmlnode_get_child(x, new_tag)) != NULL) { - return(y); - } - } - } - - /* - * insert the new tag into its parent node - */ - return(xmlnode_new_child((x == NULL? start : x), new_tag)); -} - -/* - * Send vCard info to Jabber server - */ -void jabber_set_info(PurpleConnection *gc, const char *info) -{ - PurpleStoredImage *img; - JabberIq *iq; - JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *vc_node; - const struct tag_attr *tag_attr; - - /* if we have't grabbed the remote vcard yet, we can't - * assume that what we have here is correct */ - if(!js->vcard_fetched) - return; - - if (js->vcard_timer) { - purple_timeout_remove(js->vcard_timer); - js->vcard_timer = 0; - } - - g_free(js->avatar_hash); - js->avatar_hash = NULL; - - /* - * Send only if there's actually any *information* to send - */ - vc_node = info ? xmlnode_from_str(info, -1) : NULL; - - if (vc_node && (!vc_node->name || - g_ascii_strncasecmp(vc_node->name, "vCard", 5))) { - xmlnode_free(vc_node); - vc_node = NULL; - } - - if ((img = purple_buddy_icons_find_account_icon(gc->account))) { - gconstpointer avatar_data; - gsize avatar_len; - xmlnode *photo, *binval, *type; - gchar *enc; - - if(!vc_node) { - vc_node = xmlnode_new("vCard"); - for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) - xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); - } - - avatar_data = purple_imgstore_get_data(img); - avatar_len = purple_imgstore_get_size(img); - /* Get rid of an old PHOTO if one exists. - * TODO: This may want to be modified to remove all old PHOTO - * children, at the moment some people have managed to get - * multiple PHOTO entries in their vCard. */ - if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { - xmlnode_free(photo); - } - photo = xmlnode_new_child(vc_node, "PHOTO"); - type = xmlnode_new_child(photo, "TYPE"); - xmlnode_insert_data(type, "image/png", -1); - binval = xmlnode_new_child(photo, "BINVAL"); - enc = purple_base64_encode(avatar_data, avatar_len); - - js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len); - - xmlnode_insert_data(binval, enc, -1); - g_free(enc); - purple_imgstore_unref(img); - } else if (vc_node) { - xmlnode *photo; - /* TODO: Remove all PHOTO children? (see above note) */ - if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) { - xmlnode_free(photo); - } - } - - if (vc_node != NULL) { - iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode_insert_child(iq->node, vc_node); - jabber_iq_send(iq); - - /* Send presence to update vcard-temp:x:update */ - jabber_presence_send(js, FALSE); - } -} - -void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - PurpleAccount *account = purple_connection_get_account(gc); - - /* Publish the avatar as specified in XEP-0084 */ - jabber_avatar_set(gc->proto_data, img); - /* Set the image in our vCard */ - jabber_set_info(gc, purple_account_get_user_info(account)); - - /* TODO: Fake image to ourselves, since a number of servers do not echo - * back our presence to us. To do this without uselessly copying the data - * of the image, we need purple_buddy_icons_set_for_user_image (i.e. takes - * an existing icon/stored image). */ -} - -/* - * This is the callback from the "ok clicked" for "set vCard" - * - * Sets the vCard with data from PurpleRequestFields. - */ -static void -jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) -{ - xmlnode *vc_node; - PurpleRequestField *field; - const char *text; - char *p; - const struct vcard_template *vc_tp; - const struct tag_attr *tag_attr; - - vc_node = xmlnode_new("vCard"); - - for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) - xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); - - for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { - if (*vc_tp->label == '\0') - continue; - - field = purple_request_fields_get_field(fields, vc_tp->tag); - text = purple_request_field_string_get_value(field); - - - if (text != NULL && *text != '\0') { - xmlnode *xp; - - purple_debug_info("jabber", "Setting %s to '%s'\n", vc_tp->tag, text); - - if ((xp = insert_tag_to_parent_tag(vc_node, - NULL, vc_tp->tag)) != NULL) { - - xmlnode_insert_data(xp, text, -1); - } - } - } - - p = xmlnode_to_str(vc_node, NULL); - xmlnode_free(vc_node); - - purple_account_set_user_info(purple_connection_get_account(gc), p); - serv_set_info(gc, p); - - g_free(p); -} - -/* - * This gets executed by the proto action - * - * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info - * string (if any) into GSLists for the (multi-entry) edit dialog and - * calls the set_vcard dialog. - */ -void jabber_setup_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - const struct vcard_template *vc_tp; - const char *user_info; - char *cdata = NULL; - xmlnode *x_vc_data = NULL; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - /* - * Get existing, XML-formatted, user info - */ - if((user_info = purple_account_get_user_info(gc->account)) != NULL) - x_vc_data = xmlnode_from_str(user_info, -1); - - /* - * Set up GSLists for edit with labels from "template," data from user info - */ - for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { - xmlnode *data_node; - if((vc_tp->label)[0] == '\0') - continue; - - if (x_vc_data != NULL) { - if(vc_tp->ptag == NULL) { - data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); - } else { - gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); - data_node = xmlnode_get_child(x_vc_data, tag); - g_free(tag); - } - if(data_node) - cdata = xmlnode_get_data(data_node); - } - - if(strcmp(vc_tp->tag, "DESC") == 0) { - field = purple_request_field_string_new(vc_tp->tag, - _(vc_tp->label), cdata, - TRUE); - } else { - field = purple_request_field_string_new(vc_tp->tag, - _(vc_tp->label), cdata, - FALSE); - } - - g_free(cdata); - cdata = NULL; - - purple_request_field_group_add_field(group, field); - } - - if(x_vc_data != NULL) - xmlnode_free(x_vc_data); - - purple_request_fields(gc, _("Edit XMPP vCard"), - _("Edit XMPP vCard"), - _("All items below are optional. Enter only the " - "information with which you feel comfortable."), - fields, - _("Save"), G_CALLBACK(jabber_format_info), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -/*---------------------------------------*/ -/* End Jabber "set info" (vCard) support */ -/*---------------------------------------*/ - -/****** - * end of that ancient crap that needs to die - ******/ - -static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) -{ - /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ - if (jbi->timeout_handle > 0) - purple_timeout_remove(jbi->timeout_handle); - - g_free(jbi->jid); - g_hash_table_destroy(jbi->resources); - g_free(jbi->last_message); - purple_notify_user_info_destroy(jbi->user_info); - g_free(jbi); -} - -static void -add_jbr_info(JabberBuddyInfo *jbi, const char *resource, - JabberBuddyResource *jbr) -{ - JabberBuddyInfoResource *jbir; - PurpleNotifyUserInfo *user_info; - - jbir = g_hash_table_lookup(jbi->resources, resource); - user_info = jbi->user_info; - - if (jbr && jbr->client.name) { - char *tmp = - g_strdup_printf("%s%s%s", jbr->client.name, - (jbr->client.version ? " " : ""), - (jbr->client.version ? jbr->client.version : "")); - purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); - g_free(tmp); - - if (jbr->client.os) - purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); - } - - if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { - time_t now_t; - struct tm *now; - char *timestamp; - time(&now_t); - now_t += jbr->tz_off; - now = gmtime(&now_t); - - timestamp = - g_strdup_printf("%s %c%02d%02d", purple_time_format(now), - jbr->tz_off < 0 ? '-' : '+', - abs(jbr->tz_off / (60*60)), - abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); - g_free(timestamp); - } - - if (jbir && jbir->idle_seconds > 0) { - char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); - g_free(idle); - } - - if (jbr) { - char *purdy = NULL; - char *tmp; - char priority[12]; - const char *status_name = jabber_buddy_state_get_name(jbr->state); - - if (jbr->status) { - tmp = purple_markup_escape_text(jbr->status, -1); - purdy = purple_strdup_withhtml(tmp); - g_free(tmp); - - if (purple_strequal(status_name, purdy)) - status_name = NULL; - } - - tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), - ((status_name && purdy) ? ": " : ""), - (purdy ? purdy : "")); - purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); - - g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); - - g_free(tmp); - g_free(purdy); - } else { - purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); - } -} - -static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) -{ - char *resource_name; - JabberBuddyResource *jbr; - GList *resources; - PurpleNotifyUserInfo *user_info; - - /* not yet */ - if (jbi->ids) - return; - - user_info = jbi->user_info; - resource_name = jabber_get_resource(jbi->jid); - - /* If we have one or more pairs from the vcard, put a section break above it */ - if (purple_notify_user_info_get_entries(user_info)) - purple_notify_user_info_prepend_section_break(user_info); - - /* Add the information about the user's resource(s) */ - if (resource_name) { - jbr = jabber_buddy_find_resource(jbi->jb, resource_name); - add_jbr_info(jbi, resource_name, jbr); - } else { - for (resources = jbi->jb->resources; resources; resources = resources->next) { - jbr = resources->data; - - /* put a section break between resources, this is not needed if - we are at the first, because one was already added for the vcard - section */ - if (resources != jbi->jb->resources) - purple_notify_user_info_prepend_section_break(user_info); - - add_jbr_info(jbi, jbr->name, jbr); - - if (jbr->name) - purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); - } - } - - if (!jbi->jb->resources) { - /* the buddy is offline */ - gboolean is_domain = jabber_jid_is_domain(jbi->jid); - - if (jbi->last_seconds > 0) { - char *last = purple_str_seconds_to_string(jbi->last_seconds); - gchar *message = NULL; - const gchar *title = NULL; - if (is_domain) { - title = _("Uptime"); - message = last; - last = NULL; - } else { - title = _("Logged Off"); - message = g_strdup_printf(_("%s ago"), last); - } - purple_notify_user_info_prepend_pair(user_info, title, message); - g_free(last); - g_free(message); - } - - if (!is_domain) { - gchar *status = - g_strdup_printf("%s%s%s", _("Offline"), - jbi->last_message ? ": " : "", - jbi->last_message ? jbi->last_message : ""); - purple_notify_user_info_prepend_pair(user_info, _("Status"), status); - g_free(status); - } - } - - g_free(resource_name); - - purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); - - while (jbi->vcard_imgids) { - purple_imgstore_unref_by_id(GPOINTER_TO_INT(jbi->vcard_imgids->data)); - jbi->vcard_imgids = g_slist_delete_link(jbi->vcard_imgids, jbi->vcard_imgids); - } - - jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); - - jabber_buddy_info_destroy(jbi); -} - -static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) -{ - GSList *l = jbi->ids; - char *comp_id; - - if(!id) - return; - - while(l) { - comp_id = l->data; - if(!strcmp(id, comp_id)) { - jbi->ids = g_slist_remove(jbi->ids, comp_id); - g_free(comp_id); - return; - } - l = l->next; - } -} - -static gboolean -set_own_vcard_cb(gpointer data) -{ - JabberStream *js = data; - PurpleAccount *account = purple_connection_get_account(js->gc); - - js->vcard_timer = 0; - - jabber_set_info(js->gc, purple_account_get_user_info(account)); - - return FALSE; -} - -static void jabber_vcard_save_mine(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *vcard, *photo, *binval; - char *txt, *vcard_hash = NULL; - PurpleAccount *account; - - if (type == JABBER_IQ_ERROR) { - xmlnode *error; - purple_debug_warning("jabber", "Server returned error while retrieving vCard\n"); - - error = xmlnode_get_child(packet, "error"); - if (!error || !xmlnode_get_child(error, "item-not-found")) - return; - } - - account = purple_connection_get_account(js->gc); - - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) - { - txt = xmlnode_to_str(vcard, NULL); - purple_account_set_user_info(account, txt); - g_free(txt); - } else { - /* if we have no vCard, then lets not overwrite what we might have locally */ - } - - js->vcard_fetched = TRUE; - - if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && - (binval = xmlnode_get_child(photo, "BINVAL"))) { - gsize size; - char *bintext = xmlnode_get_data(binval); - if (bintext) { - guchar *data = purple_base64_decode(bintext, &size); - g_free(bintext); - - if (data) { - vcard_hash = jabber_calculate_data_sha1sum(data, size); - g_free(data); - } - } - } - - /* Republish our vcard if the photo is different than the server's */ - if (js->initial_avatar_hash && !purple_strequal(vcard_hash, js->initial_avatar_hash)) { - /* - * Google Talk has developed the behavior that it will not accept - * a vcard set in the first 10 seconds (or so) of the connection; - * it returns an error (namespaces trimmed): - * <error code="500" type="wait"><internal-server-error/></error>. - */ - if (js->googletalk) - js->vcard_timer = purple_timeout_add_seconds(10, set_own_vcard_cb, - js); - else - jabber_set_info(js->gc, purple_account_get_user_info(account)); - } else if (vcard_hash) { - /* A photo is in the vCard. Advertise its hash */ - js->avatar_hash = vcard_hash; - vcard_hash = NULL; - - /* Send presence to update vcard-temp:x:update */ - jabber_presence_send(js, FALSE); - } - - g_free(vcard_hash); -} - -void jabber_vcard_fetch_mine(JabberStream *js) -{ - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - - xmlnode *vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); - jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); - - jabber_iq_send(iq); -} - -static void jabber_vcard_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - char *bare_jid; - char *text; - char *serverside_alias = NULL; - xmlnode *vcard; - PurpleAccount *account; - JabberBuddyInfo *jbi = data; - PurpleNotifyUserInfo *user_info; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if (type == JABBER_IQ_ERROR) { - purple_debug_info("jabber", "Got error response for vCard\n"); - jabber_buddy_info_show_if_ready(jbi); - return; - } - - user_info = jbi->user_info; - account = purple_connection_get_account(js->gc); - bare_jid = jabber_get_bare_jid(from ? from : purple_account_get_username(account)); - - /* TODO: Is the query xmlns='vcard-temp' version of this still necessary? */ - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { - xmlnode *child; - for(child = vcard->child; child; child = child->next) - { - xmlnode *child2; - - if(child->type != XMLNODE_TYPE_TAG) - continue; - - text = xmlnode_get_data(child); - if(text && !strcmp(child->name, "FN")) { - if (!serverside_alias) - serverside_alias = g_strdup(text); - - purple_notify_user_info_add_pair(user_info, _("Full Name"), text); - } else if(!strcmp(child->name, "N")) { - for(child2 = child->child; child2; child2 = child2->next) - { - char *text2; - - if(child2->type != XMLNODE_TYPE_TAG) - continue; - - text2 = xmlnode_get_data(child2); - if(text2 && !strcmp(child2->name, "FAMILY")) { - purple_notify_user_info_add_pair(user_info, _("Family Name"), text2); - } else if(text2 && !strcmp(child2->name, "GIVEN")) { - purple_notify_user_info_add_pair(user_info, _("Given Name"), text2); - } else if(text2 && !strcmp(child2->name, "MIDDLE")) { - purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); - } - g_free(text2); - } - } else if(text && !strcmp(child->name, "NICKNAME")) { - /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid. - * Ignore it if it's part of the jid. */ - if (strstr(bare_jid, text) == NULL) { - g_free(serverside_alias); - serverside_alias = g_strdup(text); - - purple_notify_user_info_add_pair(user_info, _("Nickname"), text); - } - } else if(text && !strcmp(child->name, "BDAY")) { - purple_notify_user_info_add_pair(user_info, _("Birthday"), text); - } else if(!strcmp(child->name, "ADR")) { - gboolean address_line_added = FALSE; - - for(child2 = child->child; child2; child2 = child2->next) - { - char *text2; - - if(child2->type != XMLNODE_TYPE_TAG) - continue; - - text2 = xmlnode_get_data(child2); - if (text2 == NULL) - continue; - - /* We do this here so that it's not added if all the child - * elements are empty. */ - if (!address_line_added) - { - purple_notify_user_info_add_section_header(user_info, _("Address")); - address_line_added = TRUE; - } - - if(!strcmp(child2->name, "POBOX")) { - purple_notify_user_info_add_pair(user_info, _("P.O. Box"), text2); - } else if (g_str_equal(child2->name, "EXTADD") || g_str_equal(child2->name, "EXTADR")) { - /* - * EXTADD is correct, EXTADR is generated by other - * clients. The next time someone reads this, remove - * EXTADR. - */ - purple_notify_user_info_add_pair(user_info, _("Extended Address"), text2); - } else if(!strcmp(child2->name, "STREET")) { - purple_notify_user_info_add_pair(user_info, _("Street Address"), text2); - } else if(!strcmp(child2->name, "LOCALITY")) { - purple_notify_user_info_add_pair(user_info, _("Locality"), text2); - } else if(!strcmp(child2->name, "REGION")) { - purple_notify_user_info_add_pair(user_info, _("Region"), text2); - } else if(!strcmp(child2->name, "PCODE")) { - purple_notify_user_info_add_pair(user_info, _("Postal Code"), text2); - } else if(!strcmp(child2->name, "CTRY") - || !strcmp(child2->name, "COUNTRY")) { - purple_notify_user_info_add_pair(user_info, _("Country"), text2); - } - g_free(text2); - } - - if (address_line_added) - purple_notify_user_info_add_section_break(user_info); - - } else if(!strcmp(child->name, "TEL")) { - char *number; - if((child2 = xmlnode_get_child(child, "NUMBER"))) { - /* show what kind of number it is */ - number = xmlnode_get_data(child2); - if(number) { - purple_notify_user_info_add_pair(user_info, _("Telephone"), number); - g_free(number); - } - } else if((number = xmlnode_get_data(child))) { - /* lots of clients (including purple) do this, but it's - * out of spec */ - purple_notify_user_info_add_pair(user_info, _("Telephone"), number); - g_free(number); - } - } else if(!strcmp(child->name, "EMAIL")) { - char *userid, *escaped; - if((child2 = xmlnode_get_child(child, "USERID"))) { - /* show what kind of email it is */ - userid = xmlnode_get_data(child2); - if(userid) { - char *mailto; - escaped = g_markup_escape_text(userid, -1); - mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); - purple_notify_user_info_add_pair(user_info, _("Email"), mailto); - - g_free(mailto); - g_free(escaped); - g_free(userid); - } - } else if((userid = xmlnode_get_data(child))) { - /* lots of clients (including purple) do this, but it's - * out of spec */ - char *mailto; - - escaped = g_markup_escape_text(userid, -1); - mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); - purple_notify_user_info_add_pair(user_info, _("Email"), mailto); - - g_free(mailto); - g_free(escaped); - g_free(userid); - } - } else if(!strcmp(child->name, "ORG")) { - for(child2 = child->child; child2; child2 = child2->next) - { - char *text2; - - if(child2->type != XMLNODE_TYPE_TAG) - continue; - - text2 = xmlnode_get_data(child2); - if(text2 && !strcmp(child2->name, "ORGNAME")) { - purple_notify_user_info_add_pair(user_info, _("Organization Name"), text2); - } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { - purple_notify_user_info_add_pair(user_info, _("Organization Unit"), text2); - } - g_free(text2); - } - } else if(text && !strcmp(child->name, "TITLE")) { - purple_notify_user_info_add_pair(user_info, _("Title"), text); - } else if(text && !strcmp(child->name, "ROLE")) { - purple_notify_user_info_add_pair(user_info, _("Role"), text); - } else if(text && !strcmp(child->name, "DESC")) { - purple_notify_user_info_add_pair(user_info, _("Description"), text); - } else if(!strcmp(child->name, "PHOTO") || - !strcmp(child->name, "LOGO")) { - char *bintext = NULL; - xmlnode *binval; - - if ((binval = xmlnode_get_child(child, "BINVAL")) && - (bintext = xmlnode_get_data(binval))) { - gsize size; - guchar *data; - gboolean photo = (strcmp(child->name, "PHOTO") == 0); - - data = purple_base64_decode(bintext, &size); - if (data) { - char *img_text; - char *hash; - - jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); - img_text = g_strdup_printf("<img id='%d'>", GPOINTER_TO_INT(jbi->vcard_imgids->data)); - - purple_notify_user_info_add_pair(user_info, (photo ? _("Photo") : _("Logo")), img_text); - - hash = jabber_calculate_data_sha1sum(data, size); - purple_buddy_icons_set_for_user(account, bare_jid, data, size, hash); - g_free(hash); - g_free(img_text); - } - g_free(bintext); - } - } - g_free(text); - } - } - - if (serverside_alias) { - PurpleBuddy *b; - /* If we found a serverside alias, set it and tell the core */ - serv_got_alias(js->gc, bare_jid, serverside_alias); - b = purple_find_buddy(account, bare_jid); - if (b) { - purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias); - } - - g_free(serverside_alias); - } - - g_free(bare_jid); - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_buddy_info_resource_free(gpointer data) -{ - JabberBuddyInfoResource *jbri = data; - g_free(jbri); -} - -static guint jbir_hash(gconstpointer v) -{ - if (v) - return g_str_hash(v); - else - return 0; -} - -static gboolean jbir_equal(gconstpointer v1, gconstpointer v2) -{ - const gchar *resource_1 = v1; - const gchar *resource_2 = v2; - - return purple_strequal(resource_1, resource_2); -} - -static void jabber_version_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - xmlnode *query; - char *resource_name; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if(!from) - return; - - resource_name = jabber_get_resource(from); - - if(resource_name) { - if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); - if(jbr) { - xmlnode *node; - if((node = xmlnode_get_child(query, "name"))) { - jbr->client.name = xmlnode_get_data(node); - } - if((node = xmlnode_get_child(query, "version"))) { - jbr->client.version = xmlnode_get_data(node); - } - if((node = xmlnode_get_child(query, "os"))) { - jbr->client.os = xmlnode_get_data(node); - } - } - } - } - g_free(resource_name); - } - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_last_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - xmlnode *query; - char *resource_name; - const char *seconds; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if(!from) - return; - - resource_name = jabber_get_resource(from); - - if(resource_name) { - if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - seconds = xmlnode_get_attrib(query, "seconds"); - if(seconds) { - char *end = NULL; - long sec = strtol(seconds, &end, 10); - JabberBuddy *jb = NULL; - char *resource = NULL; - char *buddy_name = NULL; - JabberBuddyResource *jbr = NULL; - - if(end != seconds) { - JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); - if(jbir) { - jbir->idle_seconds = sec; - } - } - /* Update the idle time of the buddy resource, if we got it. - This will correct the value when a server doesn't mark - delayed presence and we got the presence when signing on */ - jb = jabber_buddy_find(js, from, FALSE); - if (jb) { - resource = jabber_get_resource(from); - buddy_name = jabber_get_bare_jid(from); - /* if the resource already has an idle time set, we - must have gotten it originally from a presence. In - this case we update it. Otherwise don't update it, to - avoid setting an idle and not getting informed about - the resource getting unidle */ - if (resource && buddy_name) { - jbr = jabber_buddy_find_resource(jb, resource); - if (jbr) { - if (jbr->idle) { - if (sec) { - jbr->idle = time(NULL) - sec; - } else { - jbr->idle = 0; - } - - if (jbr == - jabber_buddy_find_resource(jb, NULL)) { - purple_prpl_got_user_idle(js->gc->account, - buddy_name, jbr->idle, jbr->idle); - } - } - } - } - g_free(resource); - g_free(buddy_name); - } - } - } - } - g_free(resource_name); - } - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_last_offline_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - xmlnode *query; - const char *seconds; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if (type == JABBER_IQ_RESULT) { - if((query = xmlnode_get_child(packet, "query"))) { - seconds = xmlnode_get_attrib(query, "seconds"); - if(seconds) { - char *end = NULL; - long sec = strtol(seconds, &end, 10); - if(end != seconds) { - jbi->last_seconds = sec; - } - } - jbi->last_message = xmlnode_get_data(query); - } - } - - jabber_buddy_info_show_if_ready(jbi); -} - -static void jabber_time_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBuddyInfo *jbi = data; - JabberBuddyResource *jbr; - char *resource_name; - - g_return_if_fail(jbi != NULL); - - jabber_buddy_info_remove_id(jbi, id); - - if (!from) - return; - - resource_name = jabber_get_resource(from); - jbr = resource_name ? jabber_buddy_find_resource(jbi->jb, resource_name) : NULL; - g_free(resource_name); - if (jbr) { - if (type == JABBER_IQ_RESULT) { - xmlnode *time = xmlnode_get_child(packet, "time"); - xmlnode *tzo = time ? xmlnode_get_child(time, "tzo") : NULL; - char *tzo_data = tzo ? xmlnode_get_data(tzo) : NULL; - if (tzo_data) { - char *c = tzo_data; - int hours, minutes; - if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') { - jbr->tz_off = 0; - } else { - gboolean offset_positive = (tzo_data[0] == '+'); - /* [+-]HH:MM */ - if (((*c == '+' || *c == '-') && (c = c + 1)) && - sscanf(c, "%02d:%02d", &hours, &minutes) == 2) { - jbr->tz_off = 60*60*hours + 60*minutes; - if (!offset_positive) - jbr->tz_off *= -1; - } else { - purple_debug_info("jabber", "Ignoring malformed timezone %s", - tzo_data); - } - } - - g_free(tzo_data); - } - } - } - - jabber_buddy_info_show_if_ready(jbi); -} - -void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) -{ - if (js->pending_buddy_info_requests) - { - JabberBuddyInfo *jbi; - GSList *l = js->pending_buddy_info_requests; - while (l) { - jbi = l->data; - - g_slist_free(jbi->ids); - jabber_buddy_info_destroy(jbi); - - l = l->next; - } - - g_slist_free(js->pending_buddy_info_requests); - js->pending_buddy_info_requests = NULL; - } -} - -static gboolean jabber_buddy_get_info_timeout(gpointer data) -{ - JabberBuddyInfo *jbi = data; - - /* remove the pending callbacks */ - while(jbi->ids) { - char *id = jbi->ids->data; - jabber_iq_remove_callback_by_id(jbi->js, id); - jbi->ids = g_slist_remove(jbi->ids, id); - g_free(id); - } - - jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); - jbi->timeout_handle = 0; - - jabber_buddy_info_show_if_ready(jbi); - - return FALSE; -} - -static gboolean _client_is_blacklisted(JabberBuddyResource *jbr, const char *ns) -{ - /* can't be blacklisted if we don't know what you're running yet */ - if(!jbr->client.name) - return FALSE; - - if(!strcmp(ns, NS_LAST_ACTIVITY)) { - if(!strcmp(jbr->client.name, "Trillian")) { - /* verified by nwalp 2007/05/09 */ - if(!strcmp(jbr->client.version, "3.1.0.121") || - /* verified by nwalp 2007/09/19 */ - !strcmp(jbr->client.version, "3.1.7.0")) { - return TRUE; - } - } - } - - return FALSE; -} - -static void -dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, - gboolean is_bare_jid, const char *jid, - JabberBuddyResource *jbr) -{ - JabberIq *iq; - JabberBuddyInfoResource *jbir; - char *full_jid = NULL; - const char *to; - - if (is_bare_jid && jbr->name) { - full_jid = g_strdup_printf("%s/%s", jid, jbr->name); - to = full_jid; - } else - to = jid; - - jbir = g_new0(JabberBuddyInfoResource, 1); - g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); - - if(!jbr->client.name) { - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); - xmlnode_set_attrib(iq->node, "to", to); - jabber_iq_set_callback(iq, jabber_version_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - /* this is to fix the feeling of irritation I get when trying - * to get info on a friend running Trillian, which doesn't - * respond (with an error or otherwise) to jabber:iq:last - * requests. There are a number of Trillian users in my - * office. */ - if(!_client_is_blacklisted(jbr, NS_LAST_ACTIVITY)) { - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); - xmlnode_set_attrib(iq->node, "to", to); - jabber_iq_set_callback(iq, jabber_last_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - if (jbr->tz_off == PURPLE_NO_TZ_OFF && - (!jbr->caps.info || - jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) { - xmlnode *child; - iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", to); - child = xmlnode_new_child(iq->node, "time"); - xmlnode_set_namespace(child, NS_ENTITY_TIME); - jabber_iq_set_callback(iq, jabber_time_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - - g_free(full_jid); -} - -static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) -{ - JabberIq *iq; - xmlnode *vcard; - GList *resources; - JabberBuddy *jb; - JabberBuddyInfo *jbi; - const char *slash; - gboolean is_bare_jid; - - jb = jabber_buddy_find(js, jid, TRUE); - - /* invalid JID */ - if(!jb) - return; - - slash = strchr(jid, '/'); - is_bare_jid = (slash == NULL); - - jbi = g_new0(JabberBuddyInfo, 1); - jbi->jid = g_strdup(jid); - jbi->js = js; - jbi->jb = jb; - jbi->resources = g_hash_table_new_full(jbir_hash, jbir_equal, g_free, jabber_buddy_info_resource_free); - jbi->user_info = purple_notify_user_info_new(); - - iq = jabber_iq_new(js, JABBER_IQ_GET); - - xmlnode_set_attrib(iq->node, "to", jid); - vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); - - jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - - jabber_iq_send(iq); - - if (is_bare_jid) { - if (jb->resources) { - for(resources = jb->resources; resources; resources = resources->next) { - JabberBuddyResource *jbr = resources->data; - dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); - } - } else { - /* user is offline, send a jabber:iq:last to find out last time online */ - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); - xmlnode_set_attrib(iq->node, "to", jid); - jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi); - jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); - jabber_iq_send(iq); - } - } else { - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, slash + 1); - if (jbr) - dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); - else - purple_debug_warning("jabber", "jabber_buddy_get_info_for_jid() " - "was passed JID %s, but there is no corresponding " - "JabberBuddyResource!\n", jid); - } - - js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); - jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); -} - -void jabber_buddy_get_info(PurpleConnection *gc, const char *who) -{ - JabberStream *js = purple_connection_get_protocol_data(gc); - JabberID *jid = jabber_id_new(who); - - if (!jid) - return; - - if (jid->node && jabber_chat_find(js, jid->node, jid->domain)) { - /* For a conversation, include the resource (indicates the user). */ - jabber_buddy_get_info_for_jid(js, who); - } else { - char *bare_jid = jabber_get_bare_jid(who); - jabber_buddy_get_info_for_jid(js, bare_jid); - g_free(bare_jid); - } - - jabber_id_free(jid); -} - -static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, - gboolean invisible) -{ - PurplePresence *gpresence; - PurpleAccount *account; - PurpleStatus *status; - JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); - xmlnode *presence; - JabberBuddyState state; - char *msg; - int priority; - - account = purple_connection_get_account(js->gc); - gpresence = purple_account_get_presence(account); - status = purple_presence_get_active_status(gpresence); - - purple_status_to_jabber(status, &state, &msg, &priority); - presence = jabber_presence_create_js(js, state, msg, priority); - - g_free(msg); - - xmlnode_set_attrib(presence, "to", who); - if(invisible) { - xmlnode_set_attrib(presence, "type", "invisible"); - jb->invisible |= JABBER_INVIS_BUDDY; - } else { - jb->invisible &= ~JABBER_INVIS_BUDDY; - } - - jabber_send(js, presence); - xmlnode_free(presence); -} - -static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); -} - -static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); -} - -static void cancel_presence_notification(gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - buddy = data; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); -} - -static void -jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, - gpointer data) -{ - PurpleBuddy *buddy; - PurpleAccount *account; - PurpleConnection *gc; - const gchar *name; - char *msg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - name = purple_buddy_get_name(buddy); - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - - msg = g_strdup_printf(_("%s will no longer be able to see your status " - "updates. Do you want to continue?"), name); - purple_request_yes_no(gc, NULL, _("Cancel Presence Notification"), - msg, 0 /* Yes */, account, name, NULL, buddy, - cancel_presence_notification, NULL /* Do nothing */); - g_free(msg); -} - -static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); -} - - -static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - js = purple_connection_get_protocol_data(gc); - - jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); -} - -static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* simply create a directed presence of the current status */ - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - JabberStream *js = purple_connection_get_protocol_data(gc); - PurpleAccount *account = purple_connection_get_account(gc); - PurplePresence *gpresence = purple_account_get_presence(account); - PurpleStatus *status = purple_presence_get_active_status(gpresence); - xmlnode *presence; - JabberBuddyState state; - char *msg; - int priority; - - purple_status_to_jabber(status, &state, &msg, &priority); - presence = jabber_presence_create_js(js, state, msg, priority); - - g_free(msg); - - xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); - - jabber_send(js, presence); - xmlnode_free(presence); - } -} - -static void jabber_buddy_logout(PurpleBlistNode *node, gpointer data) { - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* simply create a directed unavailable presence */ - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - JabberStream *js = purple_connection_get_protocol_data(gc); - xmlnode *presence; - - presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); - - xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); - - jabber_send(js, presence); - xmlnode_free(presence); - } -} - -static GList *jabber_buddy_menu(PurpleBuddy *buddy) -{ - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - JabberStream *js = purple_connection_get_protocol_data(gc); - const char *name = purple_buddy_get_name(buddy); - JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); - GList *jbrs; - - GList *m = NULL; - PurpleMenuAction *act; - - if(!jb) - return m; - - if (js->protocol_version == JABBER_PROTO_0_9 && jb != js->user_jb) { - if(jb->invisible & JABBER_INVIS_BUDDY) { - act = purple_menu_action_new(_("Un-hide From"), - PURPLE_CALLBACK(jabber_buddy_make_visible), - NULL, NULL); - } else { - act = purple_menu_action_new(_("Temporarily Hide From"), - PURPLE_CALLBACK(jabber_buddy_make_invisible), - NULL, NULL); - } - m = g_list_append(m, act); - } - - if(jb->subscription & JABBER_SUB_FROM && jb != js->user_jb) { - act = purple_menu_action_new(_("Cancel Presence Notification"), - PURPLE_CALLBACK(jabber_buddy_cancel_presence_notification), - NULL, NULL); - m = g_list_append(m, act); - } - - if(!(jb->subscription & JABBER_SUB_TO)) { - act = purple_menu_action_new(_("(Re-)Request authorization"), - PURPLE_CALLBACK(jabber_buddy_rerequest_auth), - NULL, NULL); - m = g_list_append(m, act); - - } else if (jb != js->user_jb) { - - /* shouldn't this just happen automatically when the buddy is - removed? */ - act = purple_menu_action_new(_("Unsubscribe"), - PURPLE_CALLBACK(jabber_buddy_unsubscribe), - NULL, NULL); - m = g_list_append(m, act); - } - - if (js->googletalk) { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(google_buddy_node_chat), - NULL, NULL); - m = g_list_append(m, act); - } - - /* - * This if-condition implements parts of XEP-0100: Gateway Interaction - * - * According to stpeter, there is no way to know if a jid on the roster is a gateway without sending a disco#info. - * However, since the gateway might appear offline to us, we cannot get that information. Therefore, I just assume - * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since - * people don't tend to have a server or other service there. - * - * TODO: Use disco#info... - */ - if (strchr(name, '@') == NULL) { - act = purple_menu_action_new(_("Log In"), - PURPLE_CALLBACK(jabber_buddy_login), - NULL, NULL); - m = g_list_append(m, act); - act = purple_menu_action_new(_("Log Out"), - PURPLE_CALLBACK(jabber_buddy_logout), - NULL, NULL); - m = g_list_append(m, act); - } - - /* add all ad hoc commands to the action menu */ - for(jbrs = jb->resources; jbrs; jbrs = g_list_next(jbrs)) { - JabberBuddyResource *jbr = jbrs->data; - GList *commands; - if (!jbr->commands) - continue; - for(commands = jbr->commands; commands; commands = g_list_next(commands)) { - JabberAdHocCommands *cmd = commands->data; - act = purple_menu_action_new(cmd->name, PURPLE_CALLBACK(jabber_adhoc_execute_action), cmd, NULL); - m = g_list_append(m, act); - } - } - - return m; -} - -GList * -jabber_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return jabber_buddy_menu((PurpleBuddy *) node); - } else { - return NULL; - } -} - - -const char * -jabber_buddy_state_get_name(JabberBuddyState state) -{ - switch(state) { - case JABBER_BUDDY_STATE_UNKNOWN: - return _("Unknown"); - case JABBER_BUDDY_STATE_ERROR: - return _("Error"); - case JABBER_BUDDY_STATE_UNAVAILABLE: - return _("Offline"); - case JABBER_BUDDY_STATE_ONLINE: - return _("Available"); - case JABBER_BUDDY_STATE_CHAT: - return _("Chatty"); - case JABBER_BUDDY_STATE_AWAY: - return _("Away"); - case JABBER_BUDDY_STATE_XA: - return _("Extended Away"); - case JABBER_BUDDY_STATE_DND: - return _("Do Not Disturb"); - } - - return _("Unknown"); -} - -JabberBuddyState jabber_buddy_status_id_get_state(const char *id) { - if(!id) - return JABBER_BUDDY_STATE_UNKNOWN; - if(!strcmp(id, "available")) - return JABBER_BUDDY_STATE_ONLINE; - if(!strcmp(id, "freeforchat")) - return JABBER_BUDDY_STATE_CHAT; - if(!strcmp(id, "away")) - return JABBER_BUDDY_STATE_AWAY; - if(!strcmp(id, "extended_away")) - return JABBER_BUDDY_STATE_XA; - if(!strcmp(id, "dnd")) - return JABBER_BUDDY_STATE_DND; - if(!strcmp(id, "offline")) - return JABBER_BUDDY_STATE_UNAVAILABLE; - if(!strcmp(id, "error")) - return JABBER_BUDDY_STATE_ERROR; - - return JABBER_BUDDY_STATE_UNKNOWN; -} - -const struct { - const char *name; - JabberBuddyState state; -} show_state_pairs[] = { - { "available", JABBER_BUDDY_STATE_ONLINE }, - { "chat", JABBER_BUDDY_STATE_CHAT }, - { "away", JABBER_BUDDY_STATE_AWAY }, - { "xa", JABBER_BUDDY_STATE_XA }, - { "dnd", JABBER_BUDDY_STATE_DND }, - { "offline", JABBER_BUDDY_STATE_UNAVAILABLE }, - { "error", JABBER_BUDDY_STATE_ERROR }, - { NULL, JABBER_BUDDY_STATE_UNKNOWN } -}; - -JabberBuddyState jabber_buddy_show_get_state(const char *id) -{ - int i; - - g_return_val_if_fail(id != NULL, JABBER_BUDDY_STATE_UNKNOWN); - - for (i = 0; show_state_pairs[i].name; ++i) - if (g_str_equal(id, show_state_pairs[i].name)) - return show_state_pairs[i].state; - - purple_debug_warning("jabber", "Invalid value of presence <show/> " - "attribute: %s\n", id); - return JABBER_BUDDY_STATE_UNKNOWN; -} - -const char * -jabber_buddy_state_get_show(JabberBuddyState state) -{ - int i; - - for (i = 0; show_state_pairs[i].name; ++i) - if (state == show_state_pairs[i].state) - return show_state_pairs[i].name; - -/* purple_debug_warning("jabber", "Unknown buddy state: %d\n", state); */ - return NULL; -} - -const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { - switch(state) { - case JABBER_BUDDY_STATE_CHAT: - return "freeforchat"; - case JABBER_BUDDY_STATE_AWAY: - return "away"; - case JABBER_BUDDY_STATE_XA: - return "extended_away"; - case JABBER_BUDDY_STATE_DND: - return "dnd"; - case JABBER_BUDDY_STATE_ONLINE: - return "available"; - case JABBER_BUDDY_STATE_UNKNOWN: - return "available"; - case JABBER_BUDDY_STATE_ERROR: - return "error"; - case JABBER_BUDDY_STATE_UNAVAILABLE: - return "offline"; - } - return NULL; -} - -static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) -{ - /* XXX find out the jid */ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 0), NULL, NULL); -} - -static void user_search_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - xmlnode *x, *query, *item, *field; - - /* XXX error checking? */ - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - results = purple_notify_searchresults_new(); - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - xmlnode *reported; - GSList *column_vars = NULL; - - purple_debug_info("jabber", "new-skool\n"); - - if((reported = xmlnode_get_child(x, "reported"))) { - xmlnode *field = xmlnode_get_child(reported, "field"); - while(field) { - const char *var = xmlnode_get_attrib(field, "var"); - const char *label = xmlnode_get_attrib(field, "label"); - if(var) { - column = purple_notify_searchresults_column_new(label ? label : var); - purple_notify_searchresults_column_add(results, column); - column_vars = g_slist_append(column_vars, (char *)var); - } - field = xmlnode_get_next_twin(field); - } - } - - item = xmlnode_get_child(x, "item"); - while(item) { - GList *row = NULL; - GSList *l; - xmlnode *valuenode; - const char *var; - - for (l = column_vars; l != NULL; l = l->next) { - /* - * Build a row containing the strings that correspond - * to each column of the search results. - */ - for (field = xmlnode_get_child(item, "field"); - field != NULL; - field = xmlnode_get_next_twin(field)) - { - if ((var = xmlnode_get_attrib(field, "var")) && - !strcmp(var, l->data) && - (valuenode = xmlnode_get_child(field, "value"))) - { - char *value = xmlnode_get_data(valuenode); - row = g_list_append(row, value); - break; - } - } - if (field == NULL) - /* No data for this column */ - row = g_list_append(row, NULL); - } - purple_notify_searchresults_row_add(results, row); - item = xmlnode_get_next_twin(item); - } - - g_slist_free(column_vars); - } else { - /* old skool */ - purple_debug_info("jabber", "old-skool\n"); - - column = purple_notify_searchresults_column_new(_("JID")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("First Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Last Name")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Nickname")); - purple_notify_searchresults_column_add(results, column); - column = purple_notify_searchresults_column_new(_("Email")); - purple_notify_searchresults_column_add(results, column); - - for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) { - const char *jid; - xmlnode *node; - GList *row = NULL; - - if(!(jid = xmlnode_get_attrib(item, "jid"))) - continue; - - row = g_list_append(row, g_strdup(jid)); - node = xmlnode_get_child(item, "first"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "last"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "nick"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - node = xmlnode_get_child(item, "email"); - row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); - purple_debug_info("jabber", "row=%p\n", row); - purple_notify_searchresults_row_add(results, row); - } - } - - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - user_search_result_add_buddy_cb); - - purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); -} - -static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - xmlnode *query; - JabberIq *iq; - char *dir_server = data; - const char *type; - - /* if they've cancelled the search, we're - * just going to get an error if we send - * a cancel, so skip it */ - type = xmlnode_get_attrib(result, "type"); - if(type && !strcmp(type, "cancel")) { - g_free(dir_server); - return; - } - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_insert_child(query, result); - - jabber_iq_set_callback(iq, user_search_result_cb, NULL); - xmlnode_set_attrib(iq->node, "to", dir_server); - jabber_iq_send(iq); - g_free(dir_server); -} - -struct user_search_info { - JabberStream *js; - char *directory_server; -}; - -static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) -{ - g_free(usi->directory_server); - g_free(usi); -} - -static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) -{ - JabberStream *js = usi->js; - JabberIq *iq; - xmlnode *query; - GList *groups, *flds; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); - query = xmlnode_get_child(iq->node, "query"); - - for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { - for(flds = purple_request_field_group_get_fields(groups->data); - flds; flds = flds->next) { - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - const char *value = purple_request_field_string_get_value(field); - - if(value && (!strcmp(id, "first") || !strcmp(id, "last") || !strcmp(id, "nick") || !strcmp(id, "email"))) { - xmlnode *y = xmlnode_new_child(query, id); - xmlnode_insert_data(y, value, -1); - } - } - } - - jabber_iq_set_callback(iq, user_search_result_cb, NULL); - xmlnode_set_attrib(iq->node, "to", usi->directory_server); - jabber_iq_send(iq); - - g_free(usi->directory_server); - g_free(usi); -} - -#if 0 -/* This is for gettext only -- it will see this even though there's an #if 0. */ - -/* - * An incomplete list of server generated original language search - * comments for Jabber User Directories - * - * See discussion thread "Search comment for Jabber is not translatable" - * in purple-i18n@lists.sourceforge.net (March 2006) - */ -static const char * jabber_user_dir_comments [] = { - /* current comment from Jabber User Directory users.jabber.org */ - N_("Find a contact by entering the search criteria in the given fields. " - "Note: Each field supports wild card searches (%)"), - NULL -}; -#endif - -static void user_search_fields_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *x; - - if (!from) - return; - - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - if(!msg) - msg = g_strdup(_("Unknown error")); - - purple_notify_error(js->gc, _("Directory Query Failed"), - _("Could not query the directory server."), msg); - g_free(msg); - - return; - } - - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); - return; - } else { - struct user_search_info *usi; - xmlnode *instnode; - char *instructions = NULL; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - /* old skool */ - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - if((instnode = xmlnode_get_child(query, "instructions"))) - { - char *tmp = xmlnode_get_data(instnode); - - if(tmp) - { - /* Try to translate the message (see static message - list in jabber_user_dir_comments[]) */ - instructions = g_strdup_printf(_("Server Instructions: %s"), _(tmp)); - g_free(tmp); - } - } - - if(!instructions) - { - instructions = g_strdup(_("Fill in one or more fields to search " - "for any matching XMPP users.")); - } - - if(xmlnode_get_child(query, "first")) { - field = purple_request_field_string_new("first", _("First Name"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - if(xmlnode_get_child(query, "last")) { - field = purple_request_field_string_new("last", _("Last Name"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - if(xmlnode_get_child(query, "nick")) { - field = purple_request_field_string_new("nick", _("Nickname"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - if(xmlnode_get_child(query, "email")) { - field = purple_request_field_string_new("email", _("Email Address"), - NULL, FALSE); - purple_request_field_group_add_field(group, field); - } - - usi = g_new0(struct user_search_info, 1); - usi->js = js; - usi->directory_server = g_strdup(from); - - purple_request_fields(js->gc, _("Search for XMPP users"), - _("Search for XMPP users"), instructions, fields, - _("Search"), G_CALLBACK(user_search_cb), - _("Cancel"), G_CALLBACK(user_search_cancel_cb), - purple_connection_get_account(js->gc), NULL, NULL, - usi); - - g_free(instructions); - } -} - -void jabber_user_search(JabberStream *js, const char *directory) -{ - JabberIq *iq; - - /* XXX: should probably better validate the directory we're given */ - if(!directory || !*directory) { - purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL); - return; - } - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); - xmlnode_set_attrib(iq->node, "to", directory); - - jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); - - jabber_iq_send(iq); -} - -void jabber_user_search_begin(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = purple_connection_get_protocol_data(gc); - - purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"), - _("Select a user directory to search"), - js->user_directories ? js->user_directories->data : NULL, - FALSE, FALSE, NULL, - _("Search Directory"), PURPLE_CALLBACK(jabber_user_search), - _("Cancel"), NULL, - NULL, NULL, NULL, - js); -} - -gboolean -jabber_resource_know_capabilities(const JabberBuddyResource *jbr) -{ - return jbr->caps.info != NULL; -} - -gboolean -jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap) -{ - const GList *node = NULL; - const JabberCapsNodeExts *exts; - - if (!jbr->caps.info) { - purple_debug_info("jabber", - "Unable to find caps: nothing known about buddy\n"); - return FALSE; - } - - node = g_list_find_custom(jbr->caps.info->features, cap, (GCompareFunc)strcmp); - if (!node && jbr->caps.exts && jbr->caps.info->exts) { - const GList *ext; - exts = jbr->caps.info->exts; - /* Walk through all the enabled caps, checking each list for the cap. - * Don't check it twice, though. */ - for (ext = jbr->caps.exts; ext && !node; ext = ext->next) { - GList *features = g_hash_table_lookup(exts->exts, ext->data); - if (features) - node = g_list_find_custom(features, cap, (GCompareFunc)strcmp); - } - } - - return (node != NULL); -} - -gboolean -jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap) -{ - JabberBuddyResource *jbr = jabber_buddy_find_resource((JabberBuddy*)jb, NULL); - - if (!jbr) { - purple_debug_info("jabber", - "Unable to find caps: buddy might be offline\n"); - return FALSE; - } - - return jabber_resource_has_capability(jbr, cap); -} - -const gchar * -jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr, - const gchar *category) -{ - const GList *iter = NULL; - - if (jbr->caps.info) { - for (iter = jbr->caps.info->identities ; iter ; iter = g_list_next(iter)) { - const JabberIdentity *identity = - (JabberIdentity *) iter->data; - - if (strcmp(identity->category, category) == 0) { - return identity->type; - } - } - } - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/buddy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -/** - * @file buddy.h Buddy handlers - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_BUDDY_H_ -#define PURPLE_JABBER_BUDDY_H_ - -typedef enum { - JABBER_BUDDY_STATE_UNKNOWN = -2, - JABBER_BUDDY_STATE_ERROR = -1, - JABBER_BUDDY_STATE_UNAVAILABLE = 0, - JABBER_BUDDY_STATE_ONLINE, - JABBER_BUDDY_STATE_CHAT, - JABBER_BUDDY_STATE_AWAY, - JABBER_BUDDY_STATE_XA, - JABBER_BUDDY_STATE_DND -} JabberBuddyState; - -typedef struct _JabberBuddy JabberBuddy; - -#include "jabber.h" -#include "caps.h" - -struct _JabberBuddy { - GList *resources; - char *error_msg; - enum { - JABBER_INVISIBLE_NONE = 0, - JABBER_INVISIBLE_SERVER = 1 << 1, - JABBER_INVIS_BUDDY = 1 << 2 - } invisible; - enum { - JABBER_SUB_NONE = 0, - JABBER_SUB_PENDING = 1 << 1, - JABBER_SUB_TO = 1 << 2, - JABBER_SUB_FROM = 1 << 3, - JABBER_SUB_BOTH = (JABBER_SUB_TO | JABBER_SUB_FROM), - JABBER_SUB_REMOVE = 1 << 4 - } subscription; -}; - -typedef struct _JabberAdHocCommands { - char *jid; - char *node; - char *name; -} JabberAdHocCommands; - -typedef struct _JabberBuddyResource { - JabberBuddy *jb; - char *name; - int priority; - JabberBuddyState state; - char *status; - time_t idle; - JabberCapabilities capabilities; - char *thread_id; - enum { - JABBER_CHAT_STATES_UNKNOWN, - JABBER_CHAT_STATES_UNSUPPORTED, - JABBER_CHAT_STATES_SUPPORTED - } chat_states; - struct { - char *version; - char *name; - char *os; - } client; - /* tz_off == PURPLE_NO_TZ_OFF when unset */ - long tz_off; - struct { - JabberCapsClientInfo *info; - GList *exts; - } caps; - GList *commands; - gboolean commands_fetched; -} JabberBuddyResource; - -void jabber_buddy_free(JabberBuddy *jb); -JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, - gboolean create); -JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, - const char *resource); -JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, - int priority, JabberBuddyState state, const char *status); -void jabber_buddy_resource_free(JabberBuddyResource *jbr); -void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource); -void jabber_buddy_get_info(PurpleConnection *gc, const char *who); - -GList *jabber_blist_node_menu(PurpleBlistNode *node); - -void jabber_set_info(PurpleConnection *gc, const char *info); -void jabber_setup_set_info(PurplePluginAction *action); -void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img); - -const char *jabber_buddy_state_get_name(JabberBuddyState state); -const char *jabber_buddy_state_get_status_id(JabberBuddyState state); -const char *jabber_buddy_state_get_show(JabberBuddyState state); -JabberBuddyState jabber_buddy_status_id_get_state(const char *id); -JabberBuddyState jabber_buddy_show_get_state(const char *id); - -void jabber_user_search(JabberStream *js, const char *directory); -void jabber_user_search_begin(PurplePluginAction *); - -void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js); - -void jabber_vcard_fetch_mine(JabberStream *js); - -gboolean jabber_resource_know_capabilities(const JabberBuddyResource *jbr); -gboolean jabber_resource_has_capability(const JabberBuddyResource *jbr, - const gchar *cap); -gboolean jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap); - -const gchar * -jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr, - const gchar *category); - -#endif /* PURPLE_JABBER_BUDDY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1002 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "debug.h" -#include "caps.h" -#include "cipher.h" -#include "iq.h" -#include "presence.h" -#include "util.h" - -#define JABBER_CAPS_FILENAME "xmpp-caps.xml" - -typedef struct _JabberDataFormField { - gchar *var; - GList *values; -} JabberDataFormField; - -static GHashTable *capstable = NULL; /* JabberCapsTuple -> JabberCapsClientInfo */ -static GHashTable *nodetable = NULL; /* char *node -> JabberCapsNodeExts */ -static guint save_timer = 0; - -/** - * Processes a query-node and returns a JabberCapsClientInfo object with all relevant info. - * - * @param query A query object. - * @return A JabberCapsClientInfo object. - */ -static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query); - -/* Free a GList of allocated char* */ -static void -free_string_glist(GList *list) -{ - g_list_foreach(list, (GFunc)g_free, NULL); - g_list_free(list); -} - -static JabberCapsNodeExts* -jabber_caps_node_exts_ref(JabberCapsNodeExts *exts) -{ - g_return_val_if_fail(exts != NULL, NULL); - - ++exts->ref; - return exts; -} - -static void -jabber_caps_node_exts_unref(JabberCapsNodeExts *exts) -{ - if (exts == NULL) - return; - - g_return_if_fail(exts->ref != 0); - - if (--exts->ref != 0) - return; - - g_hash_table_destroy(exts->exts); - g_free(exts); -} - -static guint jabber_caps_hash(gconstpointer data) { - const JabberCapsTuple *key = data; - guint nodehash = g_str_hash(key->node); - guint verhash = g_str_hash(key->ver); - /* - * 'hash' was optional in XEP-0115 v1.4 and g_str_hash crashes on NULL >:O. - * Okay, maybe I've played too much Zelda, but that looks like - * a Deku Shrub... - */ - guint hashhash = (key->hash ? g_str_hash(key->hash) : 0); - return nodehash ^ verhash ^ hashhash; -} - -static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { - const JabberCapsTuple *name1 = v1; - const JabberCapsTuple *name2 = v2; - - return g_str_equal(name1->node, name2->node) && - g_str_equal(name1->ver, name2->ver) && - purple_strequal(name1->hash, name2->hash); -} - -static void -jabber_caps_client_info_destroy(JabberCapsClientInfo *info) -{ - if (info == NULL) - return; - - while(info->identities) { - JabberIdentity *id = info->identities->data; - g_free(id->category); - g_free(id->type); - g_free(id->name); - g_free(id->lang); - g_free(id); - info->identities = g_list_delete_link(info->identities, info->identities); - } - - free_string_glist(info->features); - - while (info->forms) { - xmlnode_free(info->forms->data); - info->forms = g_list_delete_link(info->forms, info->forms); - } - - jabber_caps_node_exts_unref(info->exts); - - g_free((char *)info->tuple.node); - g_free((char *)info->tuple.ver); - g_free((char *)info->tuple.hash); - - g_free(info); -} - -/* NOTE: Takes a reference to the exts, unref it if you don't really want to - * keep it around. */ -static JabberCapsNodeExts* -jabber_caps_find_exts_by_node(const char *node) -{ - JabberCapsNodeExts *exts; - if (NULL == (exts = g_hash_table_lookup(nodetable, node))) { - exts = g_new0(JabberCapsNodeExts, 1); - exts->exts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)free_string_glist); - g_hash_table_insert(nodetable, g_strdup(node), jabber_caps_node_exts_ref(exts)); - } - - return jabber_caps_node_exts_ref(exts); -} - -static void -exts_to_xmlnode(gconstpointer key, gconstpointer value, gpointer user_data) -{ - const char *identifier = key; - const GList *features = value, *node; - xmlnode *client = user_data, *ext, *feature; - - ext = xmlnode_new_child(client, "ext"); - xmlnode_set_attrib(ext, "identifier", identifier); - - for (node = features; node; node = node->next) { - feature = xmlnode_new_child(ext, "feature"); - xmlnode_set_attrib(feature, "var", (const gchar *)node->data); - } -} - -static void jabber_caps_store_client(gpointer key, gpointer value, gpointer user_data) { - const JabberCapsTuple *tuple = key; - const JabberCapsClientInfo *props = value; - xmlnode *root = user_data; - xmlnode *client = xmlnode_new_child(root, "client"); - GList *iter; - - xmlnode_set_attrib(client, "node", tuple->node); - xmlnode_set_attrib(client, "ver", tuple->ver); - if (tuple->hash) - xmlnode_set_attrib(client, "hash", tuple->hash); - for(iter = props->identities; iter; iter = g_list_next(iter)) { - JabberIdentity *id = iter->data; - xmlnode *identity = xmlnode_new_child(client, "identity"); - xmlnode_set_attrib(identity, "category", id->category); - xmlnode_set_attrib(identity, "type", id->type); - if (id->name) - xmlnode_set_attrib(identity, "name", id->name); - if (id->lang) - xmlnode_set_attrib(identity, "lang", id->lang); - } - - for(iter = props->features; iter; iter = g_list_next(iter)) { - const char *feat = iter->data; - xmlnode *feature = xmlnode_new_child(client, "feature"); - xmlnode_set_attrib(feature, "var", feat); - } - - for(iter = props->forms; iter; iter = g_list_next(iter)) { - /* FIXME: See #7814 */ - xmlnode *xdata = iter->data; - xmlnode_insert_child(client, xmlnode_copy(xdata)); - } - - /* TODO: Ideally, only save this once-per-node... */ - if (props->exts) - g_hash_table_foreach(props->exts->exts, (GHFunc)exts_to_xmlnode, client); -} - -static gboolean -do_jabber_caps_store(gpointer data) -{ - char *str; - int length = 0; - xmlnode *root = xmlnode_new("capabilities"); - g_hash_table_foreach(capstable, jabber_caps_store_client, root); - str = xmlnode_to_formatted_str(root, &length); - xmlnode_free(root); - purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length); - g_free(str); - - save_timer = 0; - return FALSE; -} - -static void -schedule_caps_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, do_jabber_caps_store, NULL); -} - -static void -jabber_caps_load(void) -{ - xmlnode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache"); - xmlnode *client; - - if(!capsdata) - return; - - if (strcmp(capsdata->name, "capabilities") != 0) { - xmlnode_free(capsdata); - return; - } - - for(client = capsdata->child; client; client = client->next) { - if(client->type != XMLNODE_TYPE_TAG) - continue; - if(!strcmp(client->name, "client")) { - JabberCapsClientInfo *value = g_new0(JabberCapsClientInfo, 1); - JabberCapsTuple *key = (JabberCapsTuple*)&value->tuple; - xmlnode *child; - JabberCapsNodeExts *exts = NULL; - key->node = g_strdup(xmlnode_get_attrib(client,"node")); - key->ver = g_strdup(xmlnode_get_attrib(client,"ver")); - key->hash = g_strdup(xmlnode_get_attrib(client,"hash")); - - /* v1.3 capabilities */ - if (key->hash == NULL) - exts = jabber_caps_find_exts_by_node(key->node); - - for(child = client->child; child; child = child->next) { - if(child->type != XMLNODE_TYPE_TAG) - continue; - if(!strcmp(child->name,"feature")) { - const char *var = xmlnode_get_attrib(child, "var"); - if(!var) - continue; - value->features = g_list_append(value->features,g_strdup(var)); - } else if(!strcmp(child->name,"identity")) { - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - const char *name = xmlnode_get_attrib(child, "name"); - const char *lang = xmlnode_get_attrib(child, "lang"); - JabberIdentity *id; - - if (!category || !type) - continue; - - id = g_new0(JabberIdentity, 1); - id->category = g_strdup(category); - id->type = g_strdup(type); - id->name = g_strdup(name); - id->lang = g_strdup(lang); - - value->identities = g_list_append(value->identities,id); - } else if(!strcmp(child->name,"x")) { - /* TODO: See #7814 -- this might cause problems if anyone - * ever actually specifies forms. In fact, for this to - * work properly, that bug needs to be fixed in - * xmlnode_from_str, not the output version... */ - value->forms = g_list_append(value->forms, xmlnode_copy(child)); - } else if (!strcmp(child->name, "ext") && key->hash != NULL) { - purple_debug_warning("jabber", "Ignoring exts when reading new-style caps\n"); - } else if (!strcmp(child->name, "ext")) { - /* TODO: Do we care about reading in the identities listed here? */ - const char *identifier = xmlnode_get_attrib(child, "identifier"); - xmlnode *node; - GList *features = NULL; - - if (!identifier) - continue; - - for (node = child->child; node; node = node->next) { - if (node->type != XMLNODE_TYPE_TAG) - continue; - if (!strcmp(node->name, "feature")) { - const char *var = xmlnode_get_attrib(node, "var"); - if (!var) - continue; - features = g_list_prepend(features, g_strdup(var)); - } - } - - if (features) { - g_hash_table_insert(exts->exts, g_strdup(identifier), - features); - } else - purple_debug_warning("jabber", "Caps ext %s had no features.\n", - identifier); - } - } - - value->exts = exts; - g_hash_table_replace(capstable, key, value); - - } - } - xmlnode_free(capsdata); -} - -void jabber_caps_init(void) -{ - nodetable = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)jabber_caps_node_exts_unref); - capstable = g_hash_table_new_full(jabber_caps_hash, jabber_caps_compare, NULL, (GDestroyNotify)jabber_caps_client_info_destroy); - jabber_caps_load(); -} - -void jabber_caps_uninit(void) -{ - if (save_timer != 0) { - purple_timeout_remove(save_timer); - save_timer = 0; - do_jabber_caps_store(NULL); - } - g_hash_table_destroy(capstable); - g_hash_table_destroy(nodetable); - capstable = nodetable = NULL; -} - -gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info, - char **exts) -{ - int i; - g_return_val_if_fail(info != NULL, FALSE); - - if (!exts) - return TRUE; - - for (i = 0; exts[i]; ++i) { - /* Hack since we advertise the ext along with v1.5 caps but don't - * store any exts */ - if (g_str_equal(exts[i], "voice-v1") && !info->exts) - continue; - if (!info->exts || - !g_hash_table_lookup(info->exts->exts, exts[i])) - return FALSE; - } - - return TRUE; -} - -typedef struct _jabber_caps_cbplususerdata { - guint ref; - - jabber_caps_get_info_cb cb; - gpointer cb_data; - - char *who; - char *node; - char *ver; - char *hash; - - JabberCapsClientInfo *info; - - GList *exts; - guint extOutstanding; - JabberCapsNodeExts *node_exts; -} jabber_caps_cbplususerdata; - -static jabber_caps_cbplususerdata* -cbplususerdata_ref(jabber_caps_cbplususerdata *data) -{ - g_return_val_if_fail(data != NULL, NULL); - - ++data->ref; - return data; -} - -static void -cbplususerdata_unref(jabber_caps_cbplususerdata *data) -{ - if (data == NULL) - return; - - g_return_if_fail(data->ref != 0); - - if (--data->ref > 0) - return; - - g_free(data->who); - g_free(data->node); - g_free(data->ver); - g_free(data->hash); - - /* If we have info here, it's already in the capstable, so don't free it */ - if (data->exts) - free_string_glist(data->exts); - if (data->node_exts) - jabber_caps_node_exts_unref(data->node_exts); - g_free(data); -} - -static void -jabber_caps_get_info_complete(jabber_caps_cbplususerdata *userdata) -{ - if (userdata->cb) { - userdata->cb(userdata->info, userdata->exts, userdata->cb_data); - userdata->info = NULL; - userdata->exts = NULL; - } - - if (userdata->ref != 1) - purple_debug_warning("jabber", "Lost a reference to caps cbdata: %d\n", - userdata->ref); -} - -static void -jabber_caps_client_iqcb(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_DISCO_INFO); - jabber_caps_cbplususerdata *userdata = data; - JabberCapsClientInfo *info = NULL, *value; - JabberCapsTuple key; - - if (!query || type == JABBER_IQ_ERROR) { - /* Any outstanding exts will be dealt with via ref-counting */ - userdata->cb(NULL, NULL, userdata->cb_data); - cbplususerdata_unref(userdata); - return; - } - - /* check hash */ - info = jabber_caps_parse_client_info(query); - - /* Only validate if these are v1.5 capabilities */ - if (userdata->hash) { - gchar *hash = NULL; - /* - * TODO: If you add *any* hash here, make sure the checksum buffer - * size in jabber_caps_calculate_hash is large enough. The cipher API - * doesn't seem to offer a "Get the hash size" function(?). - */ - if (!strcmp(userdata->hash, "sha-1")) { - hash = jabber_caps_calculate_hash(info, "sha1"); - } else if (!strcmp(userdata->hash, "md5")) { - hash = jabber_caps_calculate_hash(info, "md5"); - } - - if (!hash || strcmp(hash, userdata->ver)) { - purple_debug_warning("jabber", "Could not validate caps info from " - "%s. Expected %s, got %s\n", - xmlnode_get_attrib(packet, "from"), - userdata->ver, hash ? hash : "(null)"); - - userdata->cb(NULL, NULL, userdata->cb_data); - jabber_caps_client_info_destroy(info); - cbplususerdata_unref(userdata); - g_free(hash); - return; - } - - g_free(hash); - } - - if (!userdata->hash && userdata->node_exts) { - /* If the ClientInfo doesn't have information about the exts, give them - * ours (along with our ref) */ - info->exts = userdata->node_exts; - userdata->node_exts = NULL; - } - - key.node = userdata->node; - key.ver = userdata->ver; - key.hash = userdata->hash; - - /* Use the copy of this data already in the table if it exists or insert - * a new one if we need to */ - if ((value = g_hash_table_lookup(capstable, &key))) { - jabber_caps_client_info_destroy(info); - info = value; - } else { - JabberCapsTuple *n_key = (JabberCapsTuple *)&info->tuple; - n_key->node = userdata->node; - n_key->ver = userdata->ver; - n_key->hash = userdata->hash; - userdata->node = userdata->ver = userdata->hash = NULL; - - /* The capstable gets a reference */ - g_hash_table_insert(capstable, n_key, info); - schedule_caps_save(); - } - - userdata->info = info; - - if (userdata->extOutstanding == 0) - jabber_caps_get_info_complete(userdata); - - cbplususerdata_unref(userdata); -} - -typedef struct { - const char *name; - jabber_caps_cbplususerdata *data; -} ext_iq_data; - -static void -jabber_caps_ext_iqcb(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_DISCO_INFO); - xmlnode *child; - ext_iq_data *userdata = data; - GList *features = NULL; - JabberCapsNodeExts *node_exts; - - if (!query || type == JABBER_IQ_ERROR) { - cbplususerdata_unref(userdata->data); - g_free(userdata); - return; - } - - node_exts = (userdata->data->info ? userdata->data->info->exts : - userdata->data->node_exts); - - /* TODO: I don't see how this can actually happen, but it crashed khc. */ - if (!node_exts) { - purple_debug_error("jabber", "Couldn't find JabberCapsNodeExts. If you " - "see this, please tell darkrain42 and save your debug log.\n" - "JabberCapsClientInfo = %p\n", userdata->data->info); - - - /* Try once more to find the exts and then fail */ - node_exts = jabber_caps_find_exts_by_node(userdata->data->node); - if (node_exts) { - purple_debug_info("jabber", "Found the exts on the second try.\n"); - if (userdata->data->info) - userdata->data->info->exts = node_exts; - else - userdata->data->node_exts = node_exts; - } else { - cbplususerdata_unref(userdata->data); - g_free(userdata); - g_return_if_reached(); - } - } - - /* So, we decrement this after checking for an error, which means that - * if there *is* an error, we'll never call the callback passed to - * jabber_caps_get_info. We will still free all of our data, though. - */ - --userdata->data->extOutstanding; - - for (child = xmlnode_get_child(query, "feature"); child; - child = xmlnode_get_next_twin(child)) { - const char *var = xmlnode_get_attrib(child, "var"); - if (var) - features = g_list_prepend(features, g_strdup(var)); - } - - g_hash_table_insert(node_exts->exts, g_strdup(userdata->name), features); - schedule_caps_save(); - - /* Are we done? */ - if (userdata->data->info && userdata->data->extOutstanding == 0) - jabber_caps_get_info_complete(userdata->data); - - cbplususerdata_unref(userdata->data); - g_free(userdata); -} - -void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, - const char *ver, const char *hash, char **exts, - jabber_caps_get_info_cb cb, gpointer user_data) -{ - JabberCapsClientInfo *info; - JabberCapsTuple key; - jabber_caps_cbplususerdata *userdata; - - if (exts && hash) { - purple_debug_misc("jabber", "Ignoring exts in new-style caps from %s\n", - who); - g_strfreev(exts); - exts = NULL; - } - - /* Using this in a read-only fashion, so the cast is OK */ - key.node = (char *)node; - key.ver = (char *)ver; - key.hash = (char *)hash; - - info = g_hash_table_lookup(capstable, &key); - if (info && hash) { - /* v1.5 - We already have all the information we care about */ - if (cb) - cb(info, NULL, user_data); - return; - } - - userdata = g_new0(jabber_caps_cbplususerdata, 1); - /* We start out with 0 references. Every query takes one */ - userdata->cb = cb; - userdata->cb_data = user_data; - userdata->who = g_strdup(who); - userdata->node = g_strdup(node); - userdata->ver = g_strdup(ver); - userdata->hash = g_strdup(hash); - - if (info) { - userdata->info = info; - } else { - /* If we don't have the basic information about the client, we need - * to fetch it. */ - JabberIq *iq; - xmlnode *query; - char *nodever; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - query = xmlnode_get_child_with_namespace(iq->node, "query", - NS_DISCO_INFO); - nodever = g_strdup_printf("%s#%s", node, ver); - xmlnode_set_attrib(query, "node", nodever); - g_free(nodever); - xmlnode_set_attrib(iq->node, "to", who); - - cbplususerdata_ref(userdata); - - jabber_iq_set_callback(iq, jabber_caps_client_iqcb, userdata); - jabber_iq_send(iq); - } - - /* Are there any exts that we don't recognize? */ - if (exts) { - JabberCapsNodeExts *node_exts; - int i; - - if (info) { - if (info->exts) - node_exts = info->exts; - else - node_exts = info->exts = jabber_caps_find_exts_by_node(node); - } else - /* We'll put it in later once we have the client info */ - node_exts = userdata->node_exts = jabber_caps_find_exts_by_node(node); - - for (i = 0; exts[i]; ++i) { - userdata->exts = g_list_prepend(userdata->exts, exts[i]); - /* Look it up if we don't already know what it means */ - if (!g_hash_table_lookup(node_exts->exts, exts[i])) { - JabberIq *iq; - xmlnode *query; - char *nodeext; - ext_iq_data *cbdata = g_new(ext_iq_data, 1); - - cbdata->name = exts[i]; - cbdata->data = cbplususerdata_ref(userdata); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - query = xmlnode_get_child_with_namespace(iq->node, "query", - NS_DISCO_INFO); - nodeext = g_strdup_printf("%s#%s", node, exts[i]); - xmlnode_set_attrib(query, "node", nodeext); - g_free(nodeext); - xmlnode_set_attrib(iq->node, "to", who); - - jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, cbdata); - jabber_iq_send(iq); - - ++userdata->extOutstanding; - } - exts[i] = NULL; - } - /* All the strings are now part of the GList, so don't need - * g_strfreev. */ - g_free(exts); - } - - if (userdata->info && userdata->extOutstanding == 0) { - /* Start with 1 ref so the below functions are happy */ - userdata->ref = 1; - - /* We have everything we need right now */ - jabber_caps_get_info_complete(userdata); - cbplususerdata_unref(userdata); - } -} - -static gint -jabber_identity_compare(gconstpointer a, gconstpointer b) -{ - const JabberIdentity *ac; - const JabberIdentity *bc; - gint cat_cmp; - gint typ_cmp; - - ac = a; - bc = b; - - if ((cat_cmp = strcmp(ac->category, bc->category)) == 0) { - if ((typ_cmp = strcmp(ac->type, bc->type)) == 0) { - if (!ac->lang && !bc->lang) { - return 0; - } else if (ac->lang && !bc->lang) { - return 1; - } else if (!ac->lang && bc->lang) { - return -1; - } else { - return strcmp(ac->lang, bc->lang); - } - } else { - return typ_cmp; - } - } else { - return cat_cmp; - } -} - -static gchar *jabber_caps_get_formtype(const xmlnode *x) { - xmlnode *formtypefield; - formtypefield = xmlnode_get_child(x, "field"); - while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield); - formtypefield = xmlnode_get_child(formtypefield, "value"); - return xmlnode_get_data(formtypefield);; -} - -static gint -jabber_xdata_compare(gconstpointer a, gconstpointer b) -{ - const xmlnode *aformtypefield = a; - const xmlnode *bformtypefield = b; - char *aformtype; - char *bformtype; - int result; - - aformtype = jabber_caps_get_formtype(aformtypefield); - bformtype = jabber_caps_get_formtype(bformtypefield); - - result = strcmp(aformtype, bformtype); - g_free(aformtype); - g_free(bformtype); - return result; -} - -static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) -{ - xmlnode *child; - JabberCapsClientInfo *info; - - if (!query || strcmp(query->xmlns, NS_DISCO_INFO)) - return 0; - - info = g_new0(JabberCapsClientInfo, 1); - - for(child = query->child; child; child = child->next) { - if (child->type != XMLNODE_TYPE_TAG) - continue; - if (!strcmp(child->name,"identity")) { - /* parse identity */ - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - const char *name = xmlnode_get_attrib(child, "name"); - const char *lang = xmlnode_get_attrib(child, "lang"); - JabberIdentity *id; - - if (!category || !type) - continue; - - id = g_new0(JabberIdentity, 1); - id->category = g_strdup(category); - id->type = g_strdup(type); - id->name = g_strdup(name); - id->lang = g_strdup(lang); - - info->identities = g_list_append(info->identities, id); - } else if (!strcmp(child->name, "feature")) { - /* parse feature */ - const char *var = xmlnode_get_attrib(child, "var"); - if (var) - info->features = g_list_prepend(info->features, g_strdup(var)); - } else if (!strcmp(child->name, "x")) { - if (child->xmlns && !strcmp(child->xmlns, "jabber:x:data")) { - /* x-data form */ - xmlnode *dataform = xmlnode_copy(child); - info->forms = g_list_append(info->forms, dataform); - } - } - } - return info; -} - -static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b) -{ - const JabberDataFormField *ac = a; - const JabberDataFormField *bc = b; - - return strcmp(ac->var, bc->var); -} - -static GList* jabber_caps_xdata_get_fields(const xmlnode *x) -{ - GList *fields = NULL; - xmlnode *field; - - if (!x) - return NULL; - - for (field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - xmlnode *value; - JabberDataFormField *xdatafield = g_new0(JabberDataFormField, 1); - xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var")); - - for (value = xmlnode_get_child(field, "value"); value; value = xmlnode_get_next_twin(value)) { - gchar *val = xmlnode_get_data(value); - xdatafield->values = g_list_append(xdatafield->values, val); - } - - xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp); - fields = g_list_append(fields, xdatafield); - } - - fields = g_list_sort(fields, jabber_caps_xdata_field_compare); - return fields; -} - -static GString* -jabber_caps_verification_append(GString *verification, const gchar *str) -{ - char *tmp = g_markup_escape_text(str, -1); - verification = g_string_append(verification, tmp); - g_free(tmp); - return g_string_append_c(verification, '<'); -} - -gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash) -{ - GList *node; - GString *verification; - PurpleCipherContext *context; - guint8 checksum[20]; - gsize checksum_size = 20; - gboolean success; - - if (!info || !(context = purple_cipher_context_new_by_name(hash, NULL))) - return NULL; - - /* sort identities, features and x-data forms */ - info->identities = g_list_sort(info->identities, jabber_identity_compare); - info->features = g_list_sort(info->features, (GCompareFunc)strcmp); - info->forms = g_list_sort(info->forms, jabber_xdata_compare); - - verification = g_string_new(""); - - /* concat identities to the verification string */ - for (node = info->identities; node; node = node->next) { - JabberIdentity *id = (JabberIdentity*)node->data; - char *category = g_markup_escape_text(id->category, -1); - char *type = g_markup_escape_text(id->type, -1); - char *lang = NULL; - char *name = NULL; - - if (id->lang) - lang = g_markup_escape_text(id->lang, -1); - if (id->name) - name = g_markup_escape_text(id->name, -1); - - g_string_append_printf(verification, "%s/%s/%s/%s<", category, - type, lang ? lang : "", name ? name : ""); - - g_free(category); - g_free(type); - g_free(lang); - g_free(name); - } - - /* concat features to the verification string */ - for (node = info->features; node; node = node->next) { - verification = jabber_caps_verification_append(verification, node->data); - } - - /* concat x-data forms to the verification string */ - for(node = info->forms; node; node = node->next) { - xmlnode *data = (xmlnode *)node->data; - gchar *formtype = jabber_caps_get_formtype(data); - GList *fields = jabber_caps_xdata_get_fields(data); - - /* append FORM_TYPE's field value to the verification string */ - verification = jabber_caps_verification_append(verification, formtype); - g_free(formtype); - - while (fields) { - GList *value; - JabberDataFormField *field = (JabberDataFormField*)fields->data; - - if (strcmp(field->var, "FORM_TYPE")) { - /* Append the "var" attribute */ - verification = jabber_caps_verification_append(verification, field->var); - /* Append <value/> elements' cdata */ - for(value = field->values; value; value = value->next) { - verification = jabber_caps_verification_append(verification, value->data); - g_free(value->data); - } - } - - g_free(field->var); - g_list_free(field->values); - - fields = g_list_delete_link(fields, fields); - } - } - - /* generate hash */ - purple_cipher_context_append(context, (guchar*)verification->str, verification->len); - - success = purple_cipher_context_digest(context, verification->len, - checksum, &checksum_size); - - g_string_free(verification, TRUE); - purple_cipher_context_destroy(context); - - return (success ? purple_base64_encode(checksum, checksum_size) : NULL); -} - -void jabber_caps_calculate_own_hash(JabberStream *js) { - JabberCapsClientInfo info; - GList *iter = 0; - GList *features = 0; - - if (!jabber_identities && !jabber_features) { - /* This really shouldn't ever happen */ - purple_debug_warning("jabber", "No features or identities, cannot calculate own caps hash.\n"); - g_free(js->caps_hash); - js->caps_hash = NULL; - return; - } - - /* build the currently-supported list of features */ - if (jabber_features) { - for (iter = jabber_features; iter; iter = iter->next) { - JabberFeature *feat = iter->data; - if(!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { - features = g_list_append(features, feat->namespace); - } - } - } - - info.features = features; - info.identities = g_list_copy(jabber_identities); - info.forms = NULL; - - g_free(js->caps_hash); - js->caps_hash = jabber_caps_calculate_hash(&info, "sha1"); - g_list_free(info.identities); - g_list_free(info.features); -} - -const gchar* jabber_caps_get_own_hash(JabberStream *js) -{ - if (!js->caps_hash) - jabber_caps_calculate_own_hash(js); - - return js->caps_hash; -} - -void jabber_caps_broadcast_change() -{ - GList *node, *accounts = purple_accounts_get_all_active(); - - for (node = accounts; node; node = node->next) { - PurpleAccount *account = node->data; - const char *prpl_id = purple_account_get_protocol_id(account); - if (!strcmp("prpl-jabber", prpl_id) && purple_account_is_connected(account)) { - PurpleConnection *gc = purple_account_get_connection(account); - jabber_presence_send(gc->proto_data, TRUE); - } - } - - g_list_free(accounts); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/caps.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_CAPS_H_ -#define PURPLE_JABBER_CAPS_H_ - -typedef struct _JabberCapsClientInfo JabberCapsClientInfo; - -#include "jabber.h" - -/* Implementation of XEP-0115 - Entity Capabilities */ - -typedef struct _JabberCapsNodeExts JabberCapsNodeExts; - -typedef struct _JabberCapsTuple { - const char *node; - const char *ver; - const char *hash; -} JabberCapsTuple; - -struct _JabberCapsClientInfo { - GList *identities; /* JabberIdentity */ - GList *features; /* char * */ - GList *forms; /* xmlnode * */ - JabberCapsNodeExts *exts; - - const JabberCapsTuple tuple; -}; - -/* - * This stores a set of exts "known" for a specific node (which indicates - * a specific client -- for reference, Pidgin, Finch, Meebo, et al share one - * node.) In XEP-0115 v1.3, exts are used for features that may or may not be - * present at a given time (PEP things, buzz might be disabled, etc). - * - * This structure is shared among all JabberCapsClientInfo instances matching - * a specific node (if the capstable key->hash == NULL, which indicates that - * the ClientInfo is using v1.3 caps as opposed to v1.5 caps). - * - * It's only exposed so that jabber_resource_has_capability can use it. - * Everyone else, STAY AWAY! - */ -struct _JabberCapsNodeExts { - guint ref; - GHashTable *exts; /* char *ext_name -> GList *features */ -}; - -typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, GList *exts, gpointer user_data); - -void jabber_caps_init(void); -void jabber_caps_uninit(void); - -/** - * Check whether all of the exts in a char* array are known to the given info. - */ -gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info, char **exts); - -/** - * Main entity capabilites function to get the capabilities of a contact. - * - * The callback will be called synchronously if we already have the - * capabilities for the specified (node,ver,hash) (and, if exts are specified, - * if we know what each means) - * - * @param exts A g_strsplit'd (NULL-terminated) array of strings. This - * function is responsible for freeing it. - */ -void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, - const char *ver, const char *hash, - char **exts, jabber_caps_get_info_cb cb, - gpointer user_data); - -/** - * Takes a JabberCapsClientInfo pointer and returns the caps hash according to - * XEP-0115 Version 1.5. - * - * @param info A JabberCapsClientInfo pointer. - * @param hash Hash cipher to be used. Either sha-1 or md5. - * @return The base64 encoded SHA-1 hash; must be freed by caller - */ -gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash); - -/** - * Calculate SHA1 hash for own featureset. - */ -void jabber_caps_calculate_own_hash(JabberStream *js); - -/** Get the current caps hash. - * @ret hash -**/ -const gchar* jabber_caps_get_own_hash(JabberStream *js); - -/** - * Broadcast a new calculated hash using a <presence> stanza. - */ -void jabber_caps_broadcast_change(void); - -#endif /* PURPLE_JABBER_CAPS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1289 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "prpl.h" /* for proto_chat_entry */ -#include "notify.h" -#include "request.h" -#include "roomlist.h" -#include "util.h" - -#include "chat.h" -#include "iq.h" -#include "message.h" -#include "presence.h" -#include "xdata.h" -#include "data.h" - -GList *jabber_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Room:"); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Server:"); - pce->identifier = "server"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Handle:"); - pce->identifier = "handle"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Password:"); - pce->identifier = "password"; - pce->secret = TRUE; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - JabberStream *js = gc->proto_data; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - g_hash_table_insert(defaults, "handle", g_strdup(js->user->node)); - - if (js->chat_servers) - g_hash_table_insert(defaults, "server", g_strdup(js->chat_servers->data)); - - if (chat_name != NULL) { - JabberID *jid = jabber_id_new(chat_name); - if(jid) { - g_hash_table_insert(defaults, "room", g_strdup(jid->node)); - if(jid->domain) - g_hash_table_replace(defaults, "server", g_strdup(jid->domain)); - if(jid->resource) - g_hash_table_replace(defaults, "handle", g_strdup(jid->resource)); - jabber_id_free(jid); - } - } - - return defaults; -} - -JabberChat *jabber_chat_find(JabberStream *js, const char *room, - const char *server) -{ - JabberChat *chat = NULL; - - g_return_val_if_fail(room != NULL, NULL); - g_return_val_if_fail(server != NULL, NULL); - - if(NULL != js->chats) - { - char *room_jid = g_strdup_printf("%s@%s", room, server); - - chat = g_hash_table_lookup(js->chats, room_jid); - g_free(room_jid); - } - - return chat; -} - -struct _find_by_id_data { - int id; - JabberChat *chat; -}; - -static void find_by_id_foreach_cb(gpointer key, gpointer value, gpointer user_data) -{ - JabberChat *chat = value; - struct _find_by_id_data *fbid = user_data; - - if(chat->id == fbid->id) - fbid->chat = chat; -} - -JabberChat *jabber_chat_find_by_id(JabberStream *js, int id) -{ - JabberChat *chat; - struct _find_by_id_data *fbid = g_new0(struct _find_by_id_data, 1); - fbid->id = id; - g_hash_table_foreach(js->chats, find_by_id_foreach_cb, fbid); - chat = fbid->chat; - g_free(fbid); - return chat; -} - -JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - int id; - if (!gc) - return NULL; - js = gc->proto_data; - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - return jabber_chat_find_by_id(js, id); -} - -void jabber_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat; - xmlnode *message, *body, *x, *invite; - char *room_jid; - - chat = jabber_chat_find_by_id(js, id); - if(!chat) - return; - - message = xmlnode_new("message"); - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - if(chat->muc) { - xmlnode_set_attrib(message, "to", room_jid); - x = xmlnode_new_child(message, "x"); - xmlnode_set_namespace(x, "http://jabber.org/protocol/muc#user"); - invite = xmlnode_new_child(x, "invite"); - xmlnode_set_attrib(invite, "to", name); - body = xmlnode_new_child(invite, "reason"); - xmlnode_insert_data(body, msg, -1); - } else { - xmlnode_set_attrib(message, "to", name); - /* - * Putting the reason into the body was an 'undocumented protocol, - * ...not part of "groupchat 1.0"'. - * http://xmpp.org/extensions/attic/jep-0045-1.16.html#invite - * - * Left here for compatibility. - */ - body = xmlnode_new_child(message, "body"); - xmlnode_insert_data(body, msg, -1); - - x = xmlnode_new_child(message, "x"); - xmlnode_set_attrib(x, "jid", room_jid); - - /* The better place for it! XEP-0249 style. */ - xmlnode_set_attrib(x, "reason", msg); - xmlnode_set_namespace(x, "jabber:x:conference"); - } - - jabber_send(js, message); - xmlnode_free(message); - g_free(room_jid); -} - -void jabber_chat_member_free(JabberChatMember *jcm); - -char *jabber_get_chat_name(GHashTable *data) { - char *room, *server, *chat_name = NULL; - - room = g_hash_table_lookup(data, "room"); - server = g_hash_table_lookup(data, "server"); - - if (room && server) { - chat_name = g_strdup_printf("%s@%s", room, server); - } - return chat_name; -} - -static void insert_in_hash_table(gpointer key, gpointer value, gpointer user_data) -{ - GHashTable *hash_table = (GHashTable *)user_data; - g_hash_table_insert(hash_table, g_strdup(key), g_strdup(value)); -} - -static JabberChat *jabber_chat_new(JabberStream *js, const char *room, - const char *server, const char *handle, - const char *password, GHashTable *data) -{ - JabberChat *chat; - char *jid; - - if (jabber_chat_find(js, room, server) != NULL) - return NULL; - - chat = g_new0(JabberChat, 1); - chat->js = js; - - chat->room = g_strdup(room); - chat->server = g_strdup(server); - chat->handle = g_strdup(handle); - - /* Copy the data hash table to chat->components */ - chat->components = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - if (data == NULL) { - g_hash_table_insert(chat->components, g_strdup("handle"), g_strdup(handle)); - g_hash_table_insert(chat->components, g_strdup("room"), g_strdup(room)); - g_hash_table_insert(chat->components, g_strdup("server"), g_strdup(server)); - /* g_hash_table_insert(chat->components, g_strdup("password"), g_strdup(server)); */ - } else { - g_hash_table_foreach(data, insert_in_hash_table, chat->components); - } - - chat->members = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - (GDestroyNotify)jabber_chat_member_free); - - jid = g_strdup_printf("%s@%s", room, server); - g_hash_table_insert(js->chats, jid, chat); - - return chat; -} - -JabberChat *jabber_join_chat(JabberStream *js, const char *room, - const char *server, const char *handle, - const char *password, GHashTable *data) -{ - JabberChat *chat; - - PurpleConnection *gc; - PurpleAccount *account; - PurpleStatus *status; - - xmlnode *presence, *x; - JabberBuddyState state; - char *msg; - int priority; - - char *jid; - - chat = jabber_chat_new(js, room, server, handle, password, data); - if (chat == NULL) - return NULL; - - gc = js->gc; - account = purple_connection_get_account(gc); - status = purple_account_get_active_status(account); - purple_status_to_jabber(status, &state, &msg, &priority); - - presence = jabber_presence_create_js(js, state, msg, priority); - g_free(msg); - - jid = g_strdup_printf("%s@%s/%s", room, server, handle); - xmlnode_set_attrib(presence, "to", jid); - g_free(jid); - - x = xmlnode_new_child(presence, "x"); - xmlnode_set_namespace(x, "http://jabber.org/protocol/muc"); - - if (password && *password) { - xmlnode *p = xmlnode_new_child(x, "password"); - xmlnode_insert_data(p, password, -1); - } - - jabber_send(js, presence); - xmlnode_free(presence); - - return chat; -} - -void jabber_chat_join(PurpleConnection *gc, GHashTable *data) -{ - char *room, *server, *handle, *passwd; - JabberID *jid; - JabberStream *js = gc->proto_data; - char *tmp; - - room = g_hash_table_lookup(data, "room"); - server = g_hash_table_lookup(data, "server"); - handle = g_hash_table_lookup(data, "handle"); - passwd = g_hash_table_lookup(data, "password"); - - if(!room || !server) - return; - - if(!handle) - handle = js->user->node; - - if(!jabber_nodeprep_validate(room)) { - char *buf = g_strdup_printf(_("%s is not a valid room name"), room); - purple_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), - buf); - purple_serv_got_join_chat_failed(gc, data); - g_free(buf); - return; - } else if(!jabber_domain_validate(server)) { - char *buf = g_strdup_printf(_("%s is not a valid server name"), server); - purple_notify_error(gc, _("Invalid Server Name"), - _("Invalid Server Name"), buf); - purple_serv_got_join_chat_failed(gc, data); - g_free(buf); - return; - } else if(!jabber_resourceprep_validate(handle)) { - char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); - purple_notify_error(gc, _("Invalid Room Handle"), - _("Invalid Room Handle"), buf); - purple_serv_got_join_chat_failed(gc, data); - g_free(buf); - return; - } - - /* Normalize the room and server parameters */ - tmp = g_strdup_printf("%s@%s", room, server); - jid = jabber_id_new(tmp); - g_free(tmp); - - if (jid == NULL) { - /* TODO: Error message */ - - g_return_if_reached(); - } - - /* - * Now that we've done all that nice core-interface stuff, let's join - * this room! - */ - jabber_join_chat(js, jid->node, jid->domain, handle, passwd, data); - jabber_id_free(jid); -} - -void jabber_chat_leave(PurpleConnection *gc, int id) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat = jabber_chat_find_by_id(js, id); - - - if(!chat) - return; - - jabber_chat_part(chat, NULL); - - chat->left = TRUE; -} - -void jabber_chat_destroy(JabberChat *chat) -{ - JabberStream *js = chat->js; - char *room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - g_hash_table_remove(js->chats, room_jid); - g_free(room_jid); -} - -void jabber_chat_free(JabberChat *chat) -{ - if(chat->config_dialog_handle) - purple_request_close(chat->config_dialog_type, chat->config_dialog_handle); - - g_free(chat->room); - g_free(chat->server); - g_free(chat->handle); - g_hash_table_destroy(chat->members); - g_hash_table_destroy(chat->components); - g_free(chat); -} - -gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name) -{ - return purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), name); -} - -char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who) -{ - JabberStream *js = gc->proto_data; - JabberChat *chat; - JabberChatMember *jcm; - - chat = jabber_chat_find_by_id(js, id); - - if(!chat) - return NULL; - - jcm = g_hash_table_lookup(chat->members, who); - if (jcm != NULL && jcm->jid) - return g_strdup(jcm->jid); - - - return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); -} - -static void jabber_chat_room_configure_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - JabberChat *chat = data; - xmlnode *query; - JabberIq *iq; - char *to = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_insert_child(query, result); - - jabber_iq_send(iq); -} - -static void jabber_chat_room_configure_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *x; - char *msg; - JabberChat *chat; - JabberID *jid; - - if (!from) - return; - - if (type == JABBER_IQ_RESULT) { - jid = jabber_id_new(from); - - if(!jid) - return; - - chat = jabber_chat_find(js, jid->node, jid->domain); - jabber_id_free(jid); - - if(!chat) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { - const char *xmlns; - if(!(xmlns = xmlnode_get_namespace(x))) - continue; - - if(!strcmp(xmlns, "jabber:x:data")) { - chat->config_dialog_type = PURPLE_REQUEST_FIELDS; - chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat); - return; - } - } - } else if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg); - - if(msg) - g_free(msg); - return; - } - - msg = g_strdup_printf("Unable to configure room %s", from); - - purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); - g_free(msg); - -} - -void jabber_chat_request_room_configure(JabberChat *chat) { - JabberIq *iq; - char *room_jid; - - if(!chat) - return; - - chat->config_dialog_handle = NULL; - - if(!chat->muc) { - purple_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"), - _("This room is not capable of being configured")); - return; - } - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, - "http://jabber.org/protocol/muc#owner"); - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - xmlnode_set_attrib(iq->node, "to", room_jid); - - jabber_iq_set_callback(iq, jabber_chat_room_configure_cb, NULL); - - jabber_iq_send(iq); - - g_free(room_jid); -} - -void jabber_chat_create_instant_room(JabberChat *chat) { - JabberIq *iq; - xmlnode *query, *x; - char *room_jid; - - if(!chat) - return; - - chat->config_dialog_handle = NULL; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#owner"); - query = xmlnode_get_child(iq->node, "query"); - x = xmlnode_new_child(query, "x"); - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - xmlnode_set_attrib(iq->node, "to", room_jid); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - - jabber_iq_send(iq); - - g_free(room_jid); -} - -static void -jabber_chat_register_x_data_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); - - if(msg) - g_free(msg); - return; - } -} - -static void jabber_chat_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - JabberChat *chat = data; - xmlnode *query; - JabberIq *iq; - char *to = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_insert_child(query, result); - - jabber_iq_set_callback(iq, jabber_chat_register_x_data_result_cb, NULL); - - jabber_iq_send(iq); -} - -static void jabber_chat_register_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *x; - char *msg; - JabberChat *chat; - JabberID *jid; - - if (!from) - return; - - if (type == JABBER_IQ_RESULT) { - jid = jabber_id_new(from); - - if(!jid) - return; - - chat = jabber_chat_find(js, jid->node, jid->domain); - jabber_id_free(jid); - - if(!chat) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - for(x = xmlnode_get_child(query, "x"); x; x = xmlnode_get_next_twin(x)) { - const char *xmlns; - - if(!(xmlns = xmlnode_get_namespace(x))) - continue; - - if(!strcmp(xmlns, "jabber:x:data")) { - jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat); - return; - } - } - } else if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); - - if(msg) - g_free(msg); - return; - } - - msg = g_strdup_printf("Unable to configure room %s", from); - - purple_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); - g_free(msg); - -} - -void jabber_chat_register(JabberChat *chat) -{ - JabberIq *iq; - char *room_jid; - - if(!chat) - return; - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", room_jid); - g_free(room_jid); - - jabber_iq_set_callback(iq, jabber_chat_register_cb, NULL); - - jabber_iq_send(iq); -} - -/* merge this with the function below when we get everyone on the same page wrt /commands */ -void jabber_chat_change_topic(JabberChat *chat, const char *topic) -{ - JabberMessage *jm; - - jm = g_new0(JabberMessage, 1); - jm->js = chat->js; - jm->type = JABBER_MESSAGE_GROUPCHAT; - jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); - - if (topic && *topic) - jm->subject = g_strdup(topic); - else - jm->subject = g_strdup(""); - - jabber_message_send(jm); - jabber_message_free(jm); -} - -void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - JabberStream *js = purple_connection_get_protocol_data(gc); - JabberChat *chat = jabber_chat_find_by_id(js, id); - - if(!chat) - return; - - jabber_chat_change_topic(chat, topic); -} - - -gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick) -{ - xmlnode *presence; - char *full_jid; - PurpleAccount *account; - PurpleStatus *status; - JabberBuddyState state; - char *msg; - int priority; - - if(!chat->muc) { - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", - _("Nick changing not supported in non-MUC chatrooms"), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - return FALSE; - } - - account = purple_connection_get_account(chat->js->gc); - status = purple_account_get_active_status(account); - - purple_status_to_jabber(status, &state, &msg, &priority); - - presence = jabber_presence_create_js(chat->js, state, msg, priority); - full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); - xmlnode_set_attrib(presence, "to", full_jid); - g_free(full_jid); - g_free(msg); - - jabber_send(chat->js, presence); - xmlnode_free(presence); - - return TRUE; -} - -void jabber_chat_part(JabberChat *chat, const char *msg) -{ - char *room_jid; - xmlnode *presence; - - room_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, - chat->handle); - presence = xmlnode_new("presence"); - xmlnode_set_attrib(presence, "to", room_jid); - xmlnode_set_attrib(presence, "type", "unavailable"); - if(msg) { - xmlnode *status = xmlnode_new_child(presence, "status"); - xmlnode_insert_data(status, msg, -1); - } - jabber_send(chat->js, presence); - - xmlnode_free(presence); - g_free(room_jid); -} - -static void roomlist_disco_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query; - xmlnode *item; - - if(!js->roomlist) - return; - - if (type == JABBER_IQ_ERROR) { - char *err = jabber_parse_error(js, packet, NULL); - purple_notify_error(js->gc, _("Error"), - _("Error retrieving room list"), err); - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; - g_free(err); - return; - } - - if(!(query = xmlnode_get_child(packet, "query"))) { - char *err = jabber_parse_error(js, packet, NULL); - purple_notify_error(js->gc, _("Error"), - _("Error retrieving room list"), err); - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; - g_free(err); - return; - } - - for(item = xmlnode_get_child(query, "item"); item; - item = xmlnode_get_next_twin(item)) { - const char *name; - PurpleRoomlistRoom *room; - JabberID *jid; - - if(!(jid = jabber_id_new(xmlnode_get_attrib(item, "jid")))) - continue; - name = xmlnode_get_attrib(item, "name"); - - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL); - purple_roomlist_room_add_field(js->roomlist, room, jid->node); - purple_roomlist_room_add_field(js->roomlist, room, jid->domain); - purple_roomlist_room_add_field(js->roomlist, room, name ? name : ""); - purple_roomlist_room_add(js->roomlist, room); - - jabber_id_free(jid); - } - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; -} - -static void roomlist_cancel_cb(JabberStream *js, const char *server) { - if(js->roomlist) { - purple_roomlist_set_in_progress(js->roomlist, FALSE); - purple_roomlist_unref(js->roomlist); - js->roomlist = NULL; - } -} - -static void roomlist_ok_cb(JabberStream *js, const char *server) -{ - JabberIq *iq; - - if(!js->roomlist) - return; - - if(!server || !*server) { - purple_notify_error(js->gc, _("Invalid Server"), _("Invalid Server"), NULL); - purple_roomlist_set_in_progress(js->roomlist, FALSE); - return; - } - - purple_roomlist_set_in_progress(js->roomlist, TRUE); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - - xmlnode_set_attrib(iq->node, "to", server); - - jabber_iq_set_callback(iq, roomlist_disco_result_cb, NULL); - - jabber_iq_send(iq); -} - -char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room) -{ - - return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data); -} - -PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - GList *fields = NULL; - PurpleRoomlistField *f; - - if(js->roomlist) - purple_roomlist_unref(js->roomlist); - - js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc)); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "server", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE); - fields = g_list_append(fields, f); - - purple_roomlist_set_fields(js->roomlist, fields); - - - purple_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), - _("Select a conference server to query"), - js->chat_servers ? js->chat_servers->data : NULL, - FALSE, FALSE, NULL, - _("Find Rooms"), PURPLE_CALLBACK(roomlist_ok_cb), - _("Cancel"), PURPLE_CALLBACK(roomlist_cancel_cb), - purple_connection_get_account(gc), NULL, NULL, - js); - - return js->roomlist; -} - -void jabber_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc; - JabberStream *js; - - gc = purple_account_get_connection(list->account); - js = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - - if (js->roomlist == list) { - js->roomlist = NULL; - purple_roomlist_unref(list); - } -} - -void jabber_chat_member_free(JabberChatMember *jcm) -{ - g_free(jcm->handle); - g_free(jcm->jid); - g_free(jcm); -} - -void jabber_chat_track_handle(JabberChat *chat, const char *handle, - const char *jid, const char *affiliation, const char *role) -{ - JabberChatMember *jcm = g_new0(JabberChatMember, 1); - - jcm->handle = g_strdup(handle); - jcm->jid = g_strdup(jid); - - g_hash_table_replace(chat->members, jcm->handle, jcm); - - /* XXX: keep track of role and affiliation */ -} - -void jabber_chat_remove_handle(JabberChat *chat, const char *handle) -{ - g_hash_table_remove(chat->members, handle); -} - -gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why) -{ - JabberChatMember *jcm; - const char *jid; - char *to; - JabberIq *iq; - xmlnode *query, *item, *reason; - - jcm = g_hash_table_lookup(chat->members, who); - if (jcm && jcm->jid) - jid = jcm->jid; - else if (strchr(who, '@') != NULL) - jid = who; - else - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jid); - xmlnode_set_attrib(item, "affiliation", "outcast"); - if(why) { - reason = xmlnode_new_child(item, "reason"); - xmlnode_insert_data(reason, why, -1); - } - - jabber_iq_send(iq); - - return TRUE; -} - -gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) -{ - JabberChatMember *jcm; - const char *jid; - char *to; - JabberIq *iq; - xmlnode *query, *item; - - jcm = g_hash_table_lookup(chat->members, who); - if (jcm && jcm->jid) - jid = jcm->jid; - else if (strchr(who, '@') != NULL) - jid = who; - else - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jid); - xmlnode_set_attrib(item, "affiliation", affiliation); - - jabber_iq_send(iq); - - return TRUE; -} - -static void -jabber_chat_affiliation_list_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberChat *chat; - xmlnode *query, *item; - int chat_id = GPOINTER_TO_INT(data); - GString *buf; - - if(!(chat = jabber_chat_find_by_id(js, chat_id))) - return; - - if (type == JABBER_IQ_ERROR) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - buf = g_string_new(_("Affiliations:")); - - item = xmlnode_get_child(query, "item"); - if (item) { - for( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *affiliation = xmlnode_get_attrib(item, "affiliation"); - if (jid && affiliation) - g_string_append_printf(buf, "\n%s %s", jid, affiliation); - } - } else { - buf = g_string_append_c(buf, '\n'); - buf = g_string_append_len(buf, _("No users found"), -1); - } - - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf->str, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - - g_string_free(buf, TRUE); -} - -gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation) -{ - JabberIq *iq; - char *room_jid; - xmlnode *query, *item; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, - "http://jabber.org/protocol/muc#admin"); - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "affiliation", affiliation); - - jabber_iq_set_callback(iq, jabber_chat_affiliation_list_cb, GINT_TO_POINTER(chat->id)); - jabber_iq_send(iq); - - return TRUE; -} - -gboolean jabber_chat_role_user(JabberChat *chat, const char *who, const char *role) -{ - char *to; - JabberIq *iq; - xmlnode *query, *item; - JabberChatMember *jcm; - - jcm = g_hash_table_lookup(chat->members, who); - - if (!jcm || !jcm->handle) - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "nick", jcm->handle); - xmlnode_set_attrib(item, "role", role); - - jabber_iq_send(iq); - - return TRUE; -} - -static void jabber_chat_role_list_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberChat *chat; - xmlnode *query, *item; - int chat_id = GPOINTER_TO_INT(data); - GString *buf; - - if(!(chat = jabber_chat_find_by_id(js, chat_id))) - return; - - if (type == JABBER_IQ_ERROR) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - buf = g_string_new(_("Roles:")); - - item = xmlnode_get_child(query, "item"); - if (item) { - for( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - const char *role = xmlnode_get_attrib(item, "role"); - if (jid && role) - g_string_append_printf(buf, "\n%s %s", jid, role); - } - } else { - buf = g_string_append_c(buf, '\n'); - buf = g_string_append_len(buf, _("No users found"), -1); - } - - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf->str, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - - g_string_free(buf, TRUE); -} - -gboolean jabber_chat_role_list(JabberChat *chat, const char *role) -{ - JabberIq *iq; - char *room_jid; - xmlnode *query, *item; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, - "http://jabber.org/protocol/muc#admin"); - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", room_jid); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "role", role); - - jabber_iq_set_callback(iq, jabber_chat_role_list_cb, GINT_TO_POINTER(chat->id)); - jabber_iq_send(iq); - - return TRUE; -} - -gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, const char *why) -{ - JabberIq *iq; - JabberChatMember *jcm = g_hash_table_lookup(chat->members, who); - char *to; - xmlnode *query, *item, *reason; - - if(!jcm || !jcm->jid) - return FALSE; - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, - "http://jabber.org/protocol/muc#admin"); - - to = g_strdup_printf("%s@%s", chat->room, chat->server); - xmlnode_set_attrib(iq->node, "to", to); - g_free(to); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jcm->jid); - xmlnode_set_attrib(item, "role", "none"); - if(why) { - reason = xmlnode_new_child(item, "reason"); - xmlnode_insert_data(reason, why, -1); - } - - jabber_iq_send(iq); - - return TRUE; -} - -static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberChat *chat; -#if 0 - xmlnode *query, *x; -#endif - int chat_id = GPOINTER_TO_INT(data); - - if(!(chat = jabber_chat_find_by_id(js, chat_id))) - return; - - /* defaults, in case the conference server doesn't - * support this request */ - chat->xhtml = TRUE; - - /* disabling this until more MUC servers support - * announcing this */ -#if 0 - if (type == JABBER_IQ_ERROR) { - return; - } - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - chat->xhtml = FALSE; - - for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) { - const char *var = xmlnode_get_attrib(x, "var"); - - if(var && !strcmp(var, NS_XHTML_IM)) { - chat->xhtml = TRUE; - } - } -#endif -} - -void jabber_chat_disco_traffic(JabberChat *chat) -{ - JabberIq *iq; - xmlnode *query; - char *room_jid; - - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - - iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, NS_DISCO_INFO); - - xmlnode_set_attrib(iq->node, "to", room_jid); - - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); - - jabber_iq_set_callback(iq, jabber_chat_disco_traffic_cb, GINT_TO_POINTER(chat->id)); - - jabber_iq_send(iq); - - g_free(room_jid); -} - -typedef struct { - const gchar *cap; - gboolean *all_support; - JabberBuddy *jb; -} JabberChatCapsData; - -static void -jabber_chat_all_participants_have_capability_foreach(gpointer key, - gpointer value, - gpointer user_data) -{ - const gchar *cap = ((JabberChatCapsData *) user_data)->cap; - gboolean *all_support = ((JabberChatCapsData *) user_data)->all_support; - JabberBuddy *jb = ((JabberChatCapsData *) user_data)->jb; - JabberChatMember *member = (JabberChatMember *) value; - const gchar *resource = member->handle; - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); - - if (jbr) { - *all_support &= jabber_resource_has_capability(jbr, cap); - } else { - *all_support = FALSE; - } -} - -gboolean -jabber_chat_all_participants_have_capability(const JabberChat *chat, - const gchar *cap) -{ - gchar *chat_jid = NULL; - JabberBuddy *jb = NULL; - gboolean all_support = TRUE; - JabberChatCapsData data; - - chat_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - jb = jabber_buddy_find(chat->js, chat_jid, FALSE); - - if (jb) { - data.cap = cap; - data.all_support = &all_support; - data.jb = jb; - - g_hash_table_foreach(chat->members, - jabber_chat_all_participants_have_capability_foreach, &data); - } else { - all_support = FALSE; - } - g_free(chat_jid); - return all_support; -} - -guint -jabber_chat_get_num_participants(const JabberChat *chat) -{ - return g_hash_table_size(chat->members); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/chat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file chat.h Chat stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_CHAT_H_ -#define PURPLE_JABBER_CHAT_H_ - -#include "internal.h" -#include "connection.h" -#include "conversation.h" -#include "request.h" -#include "roomlist.h" - -#include "jabber.h" - -typedef struct _JabberChatMember { - char *handle; - char *jid; -} JabberChatMember; - - -typedef struct _JabberChat { - JabberStream *js; - char *room; - char *server; - char *handle; - GHashTable *components; - int id; - PurpleConversation *conv; - gboolean muc; - gboolean xhtml; - PurpleRequestType config_dialog_type; - void *config_dialog_handle; - GHashTable *members; - gboolean left; -} JabberChat; - -GList *jabber_chat_info(PurpleConnection *gc); -GHashTable *jabber_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -char *jabber_get_chat_name(GHashTable *data); - -/** - * in-prpl function for joining a chat room. Doesn't require sticking goop - * into a hash table. - * - * @param room The room to join. This MUST be normalized already. - * @param server The server the room is on. This MUST be normalized already. - * @param password The password (if required) to join the room. May be NULL. - * @param data The chat hash table. May be NULL (it will be generated - * for current core<>prpl API interface.) - */ -JabberChat *jabber_join_chat(JabberStream *js, const char *room, - const char *server, const char *handle, - const char *password, GHashTable *data); - -void jabber_chat_join(PurpleConnection *gc, GHashTable *data); -JabberChat *jabber_chat_find(JabberStream *js, const char *room, - const char *server); -JabberChat *jabber_chat_find_by_id(JabberStream *js, int id); -JabberChat *jabber_chat_find_by_conv(PurpleConversation *conv); -void jabber_chat_destroy(JabberChat *chat); -void jabber_chat_free(JabberChat *chat); -gboolean jabber_chat_find_buddy(PurpleConversation *conv, const char *name); -void jabber_chat_invite(PurpleConnection *gc, int id, const char *message, - const char *name); -void jabber_chat_leave(PurpleConnection *gc, int id); -char *jabber_chat_buddy_real_name(PurpleConnection *gc, int id, const char *who); -void jabber_chat_request_room_configure(JabberChat *chat); -void jabber_chat_create_instant_room(JabberChat *chat); -void jabber_chat_register(JabberChat *chat); -void jabber_chat_change_topic(JabberChat *chat, const char *topic); -void jabber_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -gboolean jabber_chat_change_nick(JabberChat *chat, const char *nick); -void jabber_chat_part(JabberChat *chat, const char *msg); -void jabber_chat_track_handle(JabberChat *chat, const char *handle, - const char *jid, const char *affiliation, const char *role); -void jabber_chat_remove_handle(JabberChat *chat, const char *handle); -gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, - const char *why); -gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, - const char *affiliation); -gboolean jabber_chat_affiliation_list(JabberChat *chat, const char *affiliation); -gboolean jabber_chat_role_user(JabberChat *chat, const char *who, - const char *role); -gboolean jabber_chat_role_list(JabberChat *chat, const char *role); -gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, - const char *why); - -PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc); -void jabber_roomlist_cancel(PurpleRoomlist *list); - -void jabber_chat_disco_traffic(JabberChat *chat); - -char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room); - -gboolean jabber_chat_all_participants_have_capability(const JabberChat *chat, - const gchar *cap); -guint jabber_chat_get_num_participants(const JabberChat *chat); - -#endif /* PURPLE_JABBER_CHAT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include <stdlib.h> -#include <glib.h> -#include <string.h> - -#include "data.h" -#include "debug.h" -#include "xmlnode.h" -#include "util.h" -#include "iq.h" - -static GHashTable *local_data_by_alt = NULL; -static GHashTable *local_data_by_cid = NULL; -static GHashTable *remote_data_by_cid = NULL; - -JabberData * -jabber_data_create_from_data(gconstpointer rawdata, gsize size, const char *type, - JabberStream *js) -{ - JabberData *data = g_new0(JabberData, 1); - gchar *checksum = purple_util_get_image_checksum(rawdata, size); - gchar cid[256]; - - g_snprintf(cid, sizeof(cid), "sha1+%s@bob.xmpp.org", checksum); - g_free(checksum); - - data->cid = g_strdup(cid); - data->type = g_strdup(type); - data->size = size; - - data->data = g_memdup(rawdata, size); - - return data; -} - -JabberData * -jabber_data_create_from_xml(xmlnode *tag) -{ - JabberData *data; - gchar *raw_data = NULL; - const gchar *cid, *type; - - /* check if this is a "data" tag */ - if (strcmp(tag->name, "data") != 0) { - purple_debug_error("jabber", "Invalid data element\n"); - return NULL; - } - - cid = xmlnode_get_attrib(tag, "cid"); - type = xmlnode_get_attrib(tag, "type"); - - if (!cid || !type) { - purple_debug_error("jabber", "cid or type missing\n"); - return NULL; - } - - raw_data = xmlnode_get_data(tag); - - if (raw_data == NULL || *raw_data == '\0') { - purple_debug_error("jabber", "data element was empty"); - g_free(raw_data); - return NULL; - } - - data = g_new0(JabberData, 1); - data->data = purple_base64_decode(raw_data, &data->size); - g_free(raw_data); - - if (data->data == NULL) { - purple_debug_error("jabber", "Malformed base64 data\n"); - g_free(data); - return NULL; - } - - data->cid = g_strdup(cid); - data->type = g_strdup(type); - - return data; -} - - -static void -jabber_data_delete(gpointer cbdata) -{ - JabberData *data = cbdata; - g_free(data->cid); - g_free(data->type); - g_free(data->data); - g_free(data); -} - -const char * -jabber_data_get_cid(const JabberData *data) -{ - return data->cid; -} - - -const char * -jabber_data_get_type(const JabberData *data) -{ - return data->type; -} - -gsize -jabber_data_get_size(const JabberData *data) -{ - return data->size; -} - -gpointer -jabber_data_get_data(const JabberData *data) -{ - return data->data; -} - -xmlnode * -jabber_data_get_xml_definition(const JabberData *data) -{ - xmlnode *tag = xmlnode_new("data"); - char *base64data = purple_base64_encode(data->data, data->size); - - xmlnode_set_namespace(tag, NS_BOB); - xmlnode_set_attrib(tag, "cid", data->cid); - xmlnode_set_attrib(tag, "type", data->type); - - xmlnode_insert_data(tag, base64data, -1); - - g_free(base64data); - - return tag; -} - -xmlnode * -jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt) -{ - xmlnode *img = xmlnode_new("img"); - char src[128]; - - xmlnode_set_attrib(img, "alt", alt); - g_snprintf(src, sizeof(src), "cid:%s", data->cid); - xmlnode_set_attrib(img, "src", src); - - return img; -} - -xmlnode * -jabber_data_get_xml_request(const gchar *cid) -{ - xmlnode *tag = xmlnode_new("data"); - - xmlnode_set_namespace(tag, NS_BOB); - xmlnode_set_attrib(tag, "cid", cid); - - return tag; -} - -const JabberData * -jabber_data_find_local_by_alt(const gchar *alt) -{ - purple_debug_info("jabber", "looking up local smiley with alt = %s\n", alt); - return g_hash_table_lookup(local_data_by_alt, alt); -} - -const JabberData * -jabber_data_find_local_by_cid(const gchar *cid) -{ - purple_debug_info("jabber", "lookup local smiley with cid = %s\n", cid); - return g_hash_table_lookup(local_data_by_cid, cid); -} - -const JabberData * -jabber_data_find_remote_by_cid(const gchar *cid) -{ - purple_debug_info("jabber", "lookup remote smiley with cid = %s\n", cid); - - return g_hash_table_lookup(remote_data_by_cid, cid); -} - -void -jabber_data_associate_local(JabberData *data, const gchar *alt) -{ - purple_debug_info("jabber", "associating local smiley\n alt = %s, cid = %s\n", - alt, jabber_data_get_cid(data)); - g_hash_table_insert(local_data_by_alt, g_strdup(alt), data); - g_hash_table_insert(local_data_by_cid, g_strdup(jabber_data_get_cid(data)), - data); -} - -void -jabber_data_associate_remote(JabberData *data) -{ - purple_debug_info("jabber", "associating remote smiley, cid = %s\n", - jabber_data_get_cid(data)); - g_hash_table_insert(remote_data_by_cid, g_strdup(jabber_data_get_cid(data)), - data); -} - -void -jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *data_node) -{ - JabberIq *result = NULL; - const char *cid = xmlnode_get_attrib(data_node, "cid"); - const JabberData *data = cid ? jabber_data_find_local_by_cid(cid) : NULL; - - if (!data) { - xmlnode *item_not_found = xmlnode_new("item-not-found"); - - result = jabber_iq_new(js, JABBER_IQ_ERROR); - if (who) - xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); - xmlnode_insert_child(result->node, item_not_found); - } else { - result = jabber_iq_new(js, JABBER_IQ_RESULT); - if (who) - xmlnode_set_attrib(result->node, "to", who); - xmlnode_set_attrib(result->node, "id", id); - xmlnode_insert_child(result->node, - jabber_data_get_xml_definition(data)); - } - jabber_iq_send(result); -} - -void -jabber_data_init(void) -{ - purple_debug_info("jabber", "creating hash tables for data objects\n"); - local_data_by_alt = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - local_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, jabber_data_delete); - remote_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, jabber_data_delete); - - jabber_iq_register_handler("data", NS_BOB, jabber_data_parse); -} - -void -jabber_data_uninit(void) -{ - purple_debug_info("jabber", "destroying hash tables for data objects\n"); - g_hash_table_destroy(local_data_by_alt); - g_hash_table_destroy(local_data_by_cid); - g_hash_table_destroy(remote_data_by_cid); - local_data_by_alt = local_data_by_cid = remote_data_by_cid = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/data.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_DATA_H -#define PURPLE_JABBER_DATA_H - -#include "xmlnode.h" -#include "jabber.h" - -#include <glib.h> - -#define JABBER_DATA_MAX_SIZE 8192 - -typedef struct { - char *cid; - char *type; - gsize size; - gpointer data; -} JabberData; - -/* creates a JabberData instance from raw data */ -JabberData *jabber_data_create_from_data(gconstpointer data, gsize size, - const char *type, JabberStream *js); - -/* create a JabberData instance from an XML "data" element (as defined by - XEP 0231 */ -JabberData *jabber_data_create_from_xml(xmlnode *tag); - -const char *jabber_data_get_cid(const JabberData *data); -const char *jabber_data_get_type(const JabberData *data); - -gsize jabber_data_get_size(const JabberData *data); -gpointer jabber_data_get_data(const JabberData *data); - -/* returns the XML definition for the data element */ -xmlnode *jabber_data_get_xml_definition(const JabberData *data); - -/* returns an XHTML-IM "img" tag given a data instance */ -xmlnode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt); - -/* returns a data request element (to be included in an iq stanza) for requesting - data */ -xmlnode *jabber_data_get_xml_request(const gchar *cid); - -/* lookup functions */ -const JabberData *jabber_data_find_local_by_alt(const gchar *alt); -const JabberData *jabber_data_find_local_by_cid(const gchar *cid); -const JabberData *jabber_data_find_remote_by_cid(const gchar *cid); - -/* store data objects */ -void jabber_data_associate_local(JabberData *data, const gchar *alt); -void jabber_data_associate_remote(JabberData *data); - -/* handles iq requests */ -void jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *data_node); - -void jabber_data_init(void); -void jabber_data_uninit(void); - -#endif /* PURPLE_JABBER_DATA_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,657 +0,0 @@ -/* - * purple - Jabber Service Discovery - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "network.h" -#include "prefs.h" -#include "debug.h" -#include "request.h" - -#include "adhoccommands.h" -#include "buddy.h" -#include "disco.h" -#include "google.h" -#include "iq.h" -#include "jabber.h" -#include "jingle/jingle.h" -#include "pep.h" -#include "presence.h" -#include "roster.h" -#include "useravatar.h" - -struct _jabber_disco_info_cb_data { - gpointer data; - JabberDiscoInfoCallback *callback; -}; - -struct _jabber_disco_items_cb_data { - gpointer data; - JabberDiscoItemsCallback *callback; -}; - -#define SUPPORT_FEATURE(x) { \ - feature = xmlnode_new_child(query, "feature"); \ - xmlnode_set_attrib(feature, "var", x); \ -} - -static void -jabber_disco_bytestream_server_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberBytestreamsStreamhost *sh = data; - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_BYTESTREAMS); - - if (from && !strcmp(from, sh->jid) && query != NULL) { - xmlnode *sh_node = xmlnode_get_child(query, "streamhost"); - if (sh_node) { - const char *jid = xmlnode_get_attrib(sh_node, "jid"); - const char *port = xmlnode_get_attrib(sh_node, "port"); - - - if (jid == NULL || strcmp(jid, from) != 0) - purple_debug_error("jabber", "Invalid jid(%s) for bytestream.\n", - jid ? jid : "(null)"); - - sh->host = g_strdup(xmlnode_get_attrib(sh_node, "host")); - sh->zeroconf = g_strdup(xmlnode_get_attrib(sh_node, "zeroconf")); - if (port != NULL) - sh->port = atoi(port); - } - } - - purple_debug_info("jabber", "Discovered bytestream proxy server: " - "jid='%s' host='%s' port='%d' zeroconf='%s'\n", - from ? from : "", sh->host ? sh->host : "", - sh->port, sh->zeroconf ? sh->zeroconf : ""); - - /* TODO: When we support zeroconf proxies, fix this to handle them */ - if (!(sh->jid && sh->host && sh->port > 0)) { - js->bs_proxies = g_list_remove(js->bs_proxies, sh); - g_free(sh->jid); - g_free(sh->host); - g_free(sh->zeroconf); - g_free(sh); - } -} - - -void jabber_disco_info_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *in_query) -{ - if(type == JABBER_IQ_GET) { - xmlnode *query, *identity, *feature; - JabberIq *iq; - const char *node = xmlnode_get_attrib(in_query, "node"); - char *node_uri = NULL; - - /* create custom caps node URI */ - node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL); - - iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_DISCO_INFO); - - jabber_iq_set_id(iq, id); - - if (from) - xmlnode_set_attrib(iq->node, "to", from); - query = xmlnode_get_child(iq->node, "query"); - - if(node) - xmlnode_set_attrib(query, "node", node); - - if(!node || g_str_equal(node, node_uri)) { - GList *features, *identities; - for(identities = jabber_identities; identities; identities = identities->next) { - JabberIdentity *ident = (JabberIdentity*)identities->data; - identity = xmlnode_new_child(query, "identity"); - xmlnode_set_attrib(identity, "category", ident->category); - xmlnode_set_attrib(identity, "type", ident->type); - if (ident->lang) - xmlnode_set_attrib(identity, "xml:lang", ident->lang); - if (ident->name) - xmlnode_set_attrib(identity, "name", ident->name); - } - for(features = jabber_features; features; features = features->next) { - JabberFeature *feat = (JabberFeature*)features->data; - if (!feat->is_enabled || feat->is_enabled(js, feat->namespace)) { - feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", feat->namespace); - } - } -#ifdef USE_VV - } else if (g_str_equal(node, CAPS0115_NODE "#" "voice-v1")) { - /* - * HUGE HACK! We advertise this ext (see jabber_presence_create_js - * where we add <c/> to the <presence/>) for the Google Talk - * clients that don't actually check disco#info features. - * - * This specific feature is redundant but is what - * node='http://mail.google.com/xmpp/client/caps', ver='1.1' - * advertises as 'voice-v1'. - */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_VOICE); - } else if (g_str_equal(node, CAPS0115_NODE "#" "video-v1")) { - /* - * HUGE HACK! We advertise this ext (see jabber_presence_create_js - * where we add <c/> to the <presence/>) for the Google Talk - * clients that don't actually check disco#info features. - * - * This specific feature is redundant but is what - * node='http://mail.google.com/xmpp/client/caps', ver='1.1' - * advertises as 'video-v1'. - */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_VIDEO); - } else if (g_str_equal(node, CAPS0115_NODE "#" "camera-v1")) { - /* - * HUGE HACK! We advertise this ext (see jabber_presence_create_js - * where we add <c/> to the <presence/>) for the Google Talk - * clients that don't actually check disco#info features. - * - * This specific feature is redundant but is what - * node='http://mail.google.com/xmpp/client/caps', ver='1.1' - * advertises as 'camera-v1'. - */ - xmlnode *feature = xmlnode_new_child(query, "feature"); - xmlnode_set_attrib(feature, "var", NS_GOOGLE_CAMERA); -#endif - } else { - xmlnode *error, *inf; - - /* XXX: gross hack, implement jabber_iq_set_type or something */ - xmlnode_set_attrib(iq->node, "type", "error"); - iq->type = JABBER_IQ_ERROR; - - error = xmlnode_new_child(query, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, NS_XMPP_STANZAS); - } - g_free(node_uri); - jabber_iq_send(iq); - } else if (type == JABBER_IQ_SET) { - /* wtf? seriously. wtf‽ */ - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode *error, *bad_request; - - /* Free the <query/> */ - xmlnode_free(xmlnode_get_child(iq->node, "query")); - /* Add an error */ - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - bad_request = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(bad_request, NS_XMPP_STANZAS); - - jabber_iq_set_id(iq, id); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - - jabber_iq_send(iq); - } -} - -static void jabber_disco_info_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - struct _jabber_disco_info_cb_data *jdicd = data; - xmlnode *query; - - query = xmlnode_get_child_with_namespace(packet, "query", NS_DISCO_INFO); - - if (type == JABBER_IQ_RESULT && query) { - xmlnode *child; - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - JabberCapabilities capabilities = JABBER_CAP_NONE; - - if((jid = jabber_id_new(from))) { - if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(jbr) - capabilities = jbr->capabilities; - - for(child = query->child; child; child = child->next) { - if(child->type != XMLNODE_TYPE_TAG) - continue; - - if(!strcmp(child->name, "identity")) { - const char *category = xmlnode_get_attrib(child, "category"); - const char *type = xmlnode_get_attrib(child, "type"); - if(!category || !type) - continue; - - if(!strcmp(category, "conference") && !strcmp(type, "text")) { - /* we found a groupchat or MUC server, add it to the list */ - /* XXX: actually check for protocol/muc or gc-1.0 support */ - js->chat_servers = g_list_prepend(js->chat_servers, g_strdup(from)); - } else if(!strcmp(category, "directory") && !strcmp(type, "user")) { - /* we found a JUD */ - js->user_directories = g_list_prepend(js->user_directories, g_strdup(from)); - } else if(!strcmp(category, "proxy") && !strcmp(type, NS_BYTESTREAMS)) { - /* This is a bytestream proxy */ - JabberIq *iq; - JabberBytestreamsStreamhost *sh; - - purple_debug_info("jabber", "Found bytestream proxy server: %s\n", from); - - sh = g_new0(JabberBytestreamsStreamhost, 1); - sh->jid = g_strdup(from); - js->bs_proxies = g_list_prepend(js->bs_proxies, sh); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, - NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", sh->jid); - jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); - jabber_iq_send(iq); - } - - } else if(!strcmp(child->name, "feature")) { - const char *var = xmlnode_get_attrib(child, "var"); - if(!var) - continue; - - if(!strcmp(var, "http://jabber.org/protocol/si")) - capabilities |= JABBER_CAP_SI; - else if(!strcmp(var, "http://jabber.org/protocol/si/profile/file-transfer")) - capabilities |= JABBER_CAP_SI_FILE_XFER; - else if(!strcmp(var, NS_BYTESTREAMS)) - capabilities |= JABBER_CAP_BYTESTREAMS; - else if(!strcmp(var, "jabber:iq:search")) - capabilities |= JABBER_CAP_IQ_SEARCH; - else if(!strcmp(var, "jabber:iq:register")) - capabilities |= JABBER_CAP_IQ_REGISTER; - else if(!strcmp(var, NS_PING)) - capabilities |= JABBER_CAP_PING; - else if(!strcmp(var, NS_DISCO_ITEMS)) - capabilities |= JABBER_CAP_ITEMS; - else if(!strcmp(var, "http://jabber.org/protocol/commands")) { - capabilities |= JABBER_CAP_ADHOC; - } - else if(!strcmp(var, NS_IBB)) { - purple_debug_info("jabber", "remote supports IBB\n"); - capabilities |= JABBER_CAP_IBB; - } - } - } - - js->chat_servers = g_list_reverse(js->chat_servers); - - capabilities |= JABBER_CAP_RETRIEVED; - - if(jbr) - jbr->capabilities = capabilities; - - if (jdicd && jdicd->callback) - jdicd->callback(js, from, capabilities, jdicd->data); - } else { /* type == JABBER_IQ_ERROR or query == NULL */ - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - JabberCapabilities capabilities = JABBER_CAP_NONE; - - if((jid = jabber_id_new(from))) { - if(jid->resource && (jb = jabber_buddy_find(js, from, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(jbr) - capabilities = jbr->capabilities; - - if (jdicd && jdicd->callback) - jdicd->callback(js, from, capabilities, jdicd->data); - } - - g_free(jdicd); -} - -void jabber_disco_items_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *query) -{ - if(type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, - NS_DISCO_ITEMS); - - /* preserve node */ - xmlnode *iq_query = xmlnode_get_child(iq->node, "query"); - const char *node = xmlnode_get_attrib(query, "node"); - if(node) - xmlnode_set_attrib(iq_query,"node",node); - - jabber_iq_set_id(iq, id); - - if (from) - xmlnode_set_attrib(iq->node, "to", from); - jabber_iq_send(iq); - } -} - -static void -jabber_disco_finish_server_info_result_cb(JabberStream *js) -{ - const char *ft_proxies; - - /* - * This *should* happen only if the server supports vcard-temp, but there - * are apparently some servers that don't advertise it even though they - * support it. - */ - jabber_vcard_fetch_mine(js); - - if (js->pep) - jabber_avatar_fetch_mine(js); - - /* Yes, please! */ - jabber_roster_request(js); - - if (js->server_caps & JABBER_CAP_ADHOC) { - /* The server supports ad-hoc commands, so let's request the list */ - jabber_adhoc_server_get_list(js); - } - - /* If the server supports blocking, request the block list */ - if (js->server_caps & JABBER_CAP_BLOCKING) { - jabber_request_block_list(js); - } - - /* If there are manually specified bytestream proxies, query them */ - ft_proxies = purple_account_get_string(js->gc->account, "ft_proxies", NULL); - if (ft_proxies) { - JabberIq *iq; - JabberBytestreamsStreamhost *sh; - int i; - char *tmp; - gchar **ft_proxy_list = g_strsplit(ft_proxies, ",", 0); - - for(i = 0; ft_proxy_list[i]; i++) { - g_strstrip(ft_proxy_list[i]); - if(!(*ft_proxy_list[i])) - continue; - - /* We used to allow specifying a port directly here; get rid of it */ - if((tmp = strchr(ft_proxy_list[i], ':'))) - *tmp = '\0'; - - sh = g_new0(JabberBytestreamsStreamhost, 1); - sh->jid = g_strdup(ft_proxy_list[i]); - js->bs_proxies = g_list_prepend(js->bs_proxies, sh); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", sh->jid); - jabber_iq_set_callback(iq, jabber_disco_bytestream_server_cb, sh); - jabber_iq_send(iq); - } - - g_strfreev(ft_proxy_list); - } - -} - -/* should probably share this code with google.c, or maybe from 2.7.0 - introduce an abstracted hostname -> IP function in dns.c */ -static void -jabber_disco_stun_lookup_cb(GSList *hosts, gpointer data, - const char *error_message) -{ - JabberStream *js = (JabberStream *) data; - - if (error_message) { - purple_debug_error("jabber", "STUN lookup failed: %s\n", - error_message); - g_slist_free(hosts); - js->stun_query = NULL; - return; - } - - if (hosts && g_slist_next(hosts)) { - struct sockaddr *addr = g_slist_next(hosts)->data; - char dst[INET6_ADDRSTRLEN]; - int port; - - if (addr->sa_family == AF_INET6) { - inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); - } else { - inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in *) addr)->sin_port); - } - - if (js->stun_ip) - g_free(js->stun_ip); - js->stun_ip = g_strdup(dst); - js->stun_port = port; - - purple_debug_info("jabber", "set STUN IP/port address: " - "%s:%d\n", dst, port); - - /* unmark ongoing query */ - js->stun_query = NULL; - } - - while (hosts != NULL) { - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } -} - - -static void -jabber_disco_stun_srv_resolve_cb(PurpleSrvResponse *resp, int results, gpointer data) -{ - JabberStream *js = (JabberStream *) data; - - purple_debug_info("jabber", "got %d SRV responses for STUN.\n", results); - js->srv_query_data = NULL; - - if (results > 0) { - purple_debug_info("jabber", "looking up IP for %s:%d\n", - resp[0].hostname, resp[0].port); - js->stun_query = - purple_dnsquery_a(resp[0].hostname, resp[0].port, - jabber_disco_stun_lookup_cb, js); - } -} - - -static void -jabber_disco_server_info_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *child; - - if (!from || strcmp(from, js->user->domain)) { - jabber_disco_finish_server_info_result_cb(js); - return; - } - - if (type == JABBER_IQ_ERROR) { - /* A common way to get here is for the server not to support xmlns http://jabber.org/protocol/disco#info */ - jabber_disco_finish_server_info_result_cb(js); - return; - } - - query = xmlnode_get_child(packet, "query"); - - if (!query) { - jabber_disco_finish_server_info_result_cb(js); - return; - } - - for (child = xmlnode_get_child(query, "identity"); child; - child = xmlnode_get_next_twin(child)) { - const char *category, *type, *name; - category = xmlnode_get_attrib(child, "category"); - type = xmlnode_get_attrib(child, "type"); - if(category && type && !strcmp(category, "pubsub") && !strcmp(type,"pep")) - js->pep = TRUE; - if (!category || strcmp(category, "server")) - continue; - if (!type || strcmp(type, "im")) - continue; - - name = xmlnode_get_attrib(child, "name"); - if (!name) - continue; - - g_free(js->server_name); - js->server_name = g_strdup(name); - if (!strcmp(name, "Google Talk")) { - purple_debug_info("jabber", "Google Talk!\n"); - js->googletalk = TRUE; - - /* autodiscover stun and relays */ - if (purple_network_get_stun_ip() == NULL || - purple_strequal(purple_network_get_stun_ip(), "")) { - jabber_google_send_jingle_info(js); - } - } else if (purple_network_get_stun_ip() == NULL || - purple_strequal(purple_network_get_stun_ip(), "")) { - js->srv_query_data = - purple_srv_resolve("stun", "udp", js->user->domain, - jabber_disco_stun_srv_resolve_cb, js); - /* TODO: add TURN support later... */ - } - } - - for (child = xmlnode_get_child(query, "feature"); child; - child = xmlnode_get_next_twin(child)) { - const char *var; - var = xmlnode_get_attrib(child, "var"); - if (!var) - continue; - - if (!strcmp(NS_GOOGLE_MAIL_NOTIFY, var)) { - js->server_caps |= JABBER_CAP_GMAIL_NOTIFY; - jabber_gmail_init(js); - } else if (!strcmp(NS_GOOGLE_ROSTER, var)) { - js->server_caps |= JABBER_CAP_GOOGLE_ROSTER; - } else if (!strcmp("http://jabber.org/protocol/commands", var)) { - js->server_caps |= JABBER_CAP_ADHOC; - } else if (!strcmp(NS_SIMPLE_BLOCKING, var)) { - js->server_caps |= JABBER_CAP_BLOCKING; - } - } - - jabber_disco_finish_server_info_result_cb(js); -} - -static void -jabber_disco_server_items_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query, *child; - - if (!from || strcmp(from, js->user->domain) != 0) - return; - - if (type == JABBER_IQ_ERROR) - return; - - while(js->chat_servers) { - g_free(js->chat_servers->data); - js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); - } - - query = xmlnode_get_child(packet, "query"); - - for(child = xmlnode_get_child(query, "item"); child; - child = xmlnode_get_next_twin(child)) { - JabberIq *iq; - const char *jid, *node; - - if(!(jid = xmlnode_get_attrib(child, "jid"))) - continue; - - /* we don't actually care about the specific nodes, - * so we won't query them */ - if((node = xmlnode_get_attrib(child, "node"))) - continue; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", jid); - jabber_iq_set_callback(iq, jabber_disco_info_cb, NULL); - jabber_iq_send(iq); - } -} - -void jabber_disco_items_server(JabberStream *js) -{ - JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_ITEMS); - - xmlnode_set_attrib(iq->node, "to", js->user->domain); - - jabber_iq_set_callback(iq, jabber_disco_server_items_result_cb, NULL); - jabber_iq_send(iq); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", js->user->domain); - jabber_iq_set_callback(iq, jabber_disco_server_info_result_cb, NULL); - jabber_iq_send(iq); -} - -void jabber_disco_info_do(JabberStream *js, const char *who, JabberDiscoInfoCallback *callback, gpointer data) -{ - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - struct _jabber_disco_info_cb_data *jdicd; - JabberIq *iq; - - if((jid = jabber_id_new(who))) { - if(jid->resource && (jb = jabber_buddy_find(js, who, TRUE))) - jbr = jabber_buddy_find_resource(jb, jid->resource); - jabber_id_free(jid); - } - - if(jbr && jbr->capabilities & JABBER_CAP_RETRIEVED) { - callback(js, who, jbr->capabilities, data); - return; - } - - jdicd = g_new0(struct _jabber_disco_info_cb_data, 1); - jdicd->data = data; - jdicd->callback = callback; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO); - xmlnode_set_attrib(iq->node, "to", who); - - jabber_iq_set_callback(iq, jabber_disco_info_cb, jdicd); - jabber_iq_send(iq); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/disco.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/** - * @file disco.h Jabber Service Discovery - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_DISCO_H_ -#define PURPLE_JABBER_DISCO_H_ - -#include "jabber.h" - -typedef struct _JabberDiscoItem { - const char *jid; /* MUST */ - const char *node; /* SHOULD */ - const char *name; /* MAY */ -} JabberDiscoItem; - -typedef void (JabberDiscoInfoCallback)(JabberStream *js, const char *who, - JabberCapabilities capabilities, gpointer data); - -typedef void (JabberDiscoItemsCallback)(JabberStream *js, const char *jid, - const char *node, GSList *items, gpointer data); - -void jabber_disco_info_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *in_query); -void jabber_disco_items_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); - -void jabber_disco_items_server(JabberStream *js); - -void jabber_disco_info_do(JabberStream *js, const char *who, - JabberDiscoInfoCallback *callback, gpointer data); - -#endif /* PURPLE_JABBER_DISCO_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1441 +0,0 @@ -/** - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "mediamanager.h" -#include "util.h" -#include "privacy.h" -#include "dnsquery.h" -#include "network.h" - -#include "buddy.h" -#include "google.h" -#include "jabber.h" -#include "presence.h" -#include "roster.h" -#include "iq.h" -#include "chat.h" - -#include "jingle/jingle.h" - -#ifdef USE_VV - -typedef struct { - char *id; - char *initiator; -} GoogleSessionId; - -typedef enum { - UNINIT, - SENT_INITIATE, - RECEIVED_INITIATE, - IN_PRORESS, - TERMINATED -} GoogleSessionState; - -typedef struct { - GoogleSessionId id; - GoogleSessionState state; - PurpleMedia *media; - JabberStream *js; - char *remote_jid; - gboolean video; -} GoogleSession; - -static gboolean -google_session_id_equal(gconstpointer a, gconstpointer b) -{ - GoogleSessionId *c = (GoogleSessionId*)a; - GoogleSessionId *d = (GoogleSessionId*)b; - - return !strcmp(c->id, d->id) && !strcmp(c->initiator, d->initiator); -} - -static void -google_session_destroy(GoogleSession *session) -{ - g_free(session->id.id); - g_free(session->id.initiator); - g_free(session->remote_jid); - g_free(session); -} - -static xmlnode * -google_session_create_xmlnode(GoogleSession *session, const char *type) -{ - xmlnode *node = xmlnode_new("session"); - xmlnode_set_namespace(node, NS_GOOGLE_SESSION); - xmlnode_set_attrib(node, "id", session->id.id); - xmlnode_set_attrib(node, "initiator", session->id.initiator); - xmlnode_set_attrib(node, "type", type); - return node; -} - -static void -google_session_send_candidates(PurpleMedia *media, gchar *session_id, - gchar *participant, GoogleSession *session) -{ - GList *candidates = purple_media_get_local_candidates( - session->media, session_id, session->remote_jid), *iter; - PurpleMediaCandidate *transport; - gboolean video = FALSE; - - if (!strcmp(session_id, "google-video")) - video = TRUE; - - for (iter = candidates; iter; iter = iter->next) { - JabberIq *iq; - gchar *ip, *port, *username, *password; - gchar pref[16]; - PurpleMediaCandidateType type; - xmlnode *sess; - xmlnode *candidate; - guint component_id; - transport = PURPLE_MEDIA_CANDIDATE(iter->data); - component_id = purple_media_candidate_get_component_id( - transport); - - iq = jabber_iq_new(session->js, JABBER_IQ_SET); - sess = google_session_create_xmlnode(session, "candidates"); - xmlnode_insert_child(iq->node, sess); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - - candidate = xmlnode_new("candidate"); - - ip = purple_media_candidate_get_ip(transport); - port = g_strdup_printf("%d", - purple_media_candidate_get_port(transport)); - g_ascii_dtostr(pref, 16, - purple_media_candidate_get_priority(transport) / 1000.0); - username = purple_media_candidate_get_username(transport); - password = purple_media_candidate_get_password(transport); - type = purple_media_candidate_get_candidate_type(transport); - - xmlnode_set_attrib(candidate, "address", ip); - xmlnode_set_attrib(candidate, "port", port); - xmlnode_set_attrib(candidate, "name", - component_id == PURPLE_MEDIA_COMPONENT_RTP ? - video ? "video_rtp" : "rtp" : - component_id == PURPLE_MEDIA_COMPONENT_RTCP ? - video ? "video_rtcp" : "rtcp" : "none"); - xmlnode_set_attrib(candidate, "username", username); - /* - * As of this writing, Farsight 2 in Google compatibility - * mode doesn't provide a password. The Gmail client - * requires this to be set. - */ - xmlnode_set_attrib(candidate, "password", - password != NULL ? password : ""); - xmlnode_set_attrib(candidate, "preference", pref); - xmlnode_set_attrib(candidate, "protocol", - purple_media_candidate_get_protocol(transport) - == PURPLE_MEDIA_NETWORK_PROTOCOL_UDP ? - "udp" : "tcp"); - xmlnode_set_attrib(candidate, "type", type == - PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "local" : - type == - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "stun" : - type == - PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : - NULL); - xmlnode_set_attrib(candidate, "generation", "0"); - xmlnode_set_attrib(candidate, "network", "0"); - xmlnode_insert_child(sess, candidate); - - g_free(ip); - g_free(port); - g_free(username); - g_free(password); - - jabber_iq_send(iq); - } - purple_media_candidate_list_free(candidates); -} - -static void -google_session_ready(GoogleSession *session) -{ - PurpleMedia *media = session->media; - if (purple_media_codecs_ready(media, NULL) && - purple_media_candidates_prepared(media, NULL, NULL)) { - gchar *me = g_strdup_printf("%s@%s/%s", - session->js->user->node, - session->js->user->domain, - session->js->user->resource); - JabberIq *iq; - xmlnode *sess, *desc, *payload; - GList *codecs, *iter; - gboolean is_initiator = !strcmp(session->id.initiator, me); - - if (!is_initiator && - !purple_media_accepted(media, NULL, NULL)) { - g_free(me); - return; - } - - iq = jabber_iq_new(session->js, JABBER_IQ_SET); - - if (is_initiator) { - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - xmlnode_set_attrib(iq->node, "from", session->id.initiator); - sess = google_session_create_xmlnode(session, "initiate"); - } else { - google_session_send_candidates(session->media, - "google-voice", session->remote_jid, - session); - google_session_send_candidates(session->media, - "google-video", session->remote_jid, - session); - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - xmlnode_set_attrib(iq->node, "from", me); - sess = google_session_create_xmlnode(session, "accept"); - } - xmlnode_insert_child(iq->node, sess); - desc = xmlnode_new_child(sess, "description"); - if (session->video) - xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_VIDEO); - else - xmlnode_set_namespace(desc, NS_GOOGLE_SESSION_PHONE); - - codecs = purple_media_get_codecs(media, "google-video"); - - for (iter = codecs; iter; iter = g_list_next(iter)) { - PurpleMediaCodec *codec = (PurpleMediaCodec*)iter->data; - gchar *id = g_strdup_printf("%d", - purple_media_codec_get_id(codec)); - gchar *encoding_name = - purple_media_codec_get_encoding_name(codec); - payload = xmlnode_new_child(desc, "payload-type"); - xmlnode_set_attrib(payload, "id", id); - xmlnode_set_attrib(payload, "name", encoding_name); - xmlnode_set_attrib(payload, "width", "320"); - xmlnode_set_attrib(payload, "height", "200"); - xmlnode_set_attrib(payload, "framerate", "30"); - g_free(encoding_name); - g_free(id); - } - purple_media_codec_list_free(codecs); - - codecs = purple_media_get_codecs(media, "google-voice"); - - for (iter = codecs; iter; iter = g_list_next(iter)) { - PurpleMediaCodec *codec = (PurpleMediaCodec*)iter->data; - gchar *id = g_strdup_printf("%d", - purple_media_codec_get_id(codec)); - gchar *encoding_name = - purple_media_codec_get_encoding_name(codec); - gchar *clock_rate = g_strdup_printf("%d", - purple_media_codec_get_clock_rate(codec)); - payload = xmlnode_new_child(desc, "payload-type"); - if (session->video) - xmlnode_set_namespace(payload, NS_GOOGLE_SESSION_PHONE); - xmlnode_set_attrib(payload, "id", id); - /* - * Hack to make Gmail accept speex as the codec. - * It shouldn't have to be case sensitive. - */ - if (purple_strequal(encoding_name, "SPEEX")) - xmlnode_set_attrib(payload, "name", "speex"); - else - xmlnode_set_attrib(payload, "name", encoding_name); - xmlnode_set_attrib(payload, "clockrate", clock_rate); - g_free(clock_rate); - g_free(encoding_name); - g_free(id); - } - purple_media_codec_list_free(codecs); - - jabber_iq_send(iq); - - if (is_initiator) { - google_session_send_candidates(session->media, - "google-voice", session->remote_jid, - session); - google_session_send_candidates(session->media, - "google-video", session->remote_jid, - session); - } - - g_signal_handlers_disconnect_by_func(G_OBJECT(session->media), - G_CALLBACK(google_session_ready), session); - } -} - -static void -google_session_state_changed_cb(PurpleMedia *media, PurpleMediaState state, - gchar *sid, gchar *name, GoogleSession *session) -{ - if (sid == NULL && name == NULL) { - if (state == PURPLE_MEDIA_STATE_END) { - google_session_destroy(session); - } - } -} - -static void -google_session_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, - gchar *sid, gchar *name, gboolean local, - GoogleSession *session) -{ - if (sid != NULL || name != NULL) - return; - - if (type == PURPLE_MEDIA_INFO_HANGUP) { - xmlnode *sess; - JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET); - - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - sess = google_session_create_xmlnode(session, "terminate"); - xmlnode_insert_child(iq->node, sess); - - jabber_iq_send(iq); - } else if (type == PURPLE_MEDIA_INFO_REJECT) { - xmlnode *sess; - JabberIq *iq = jabber_iq_new(session->js, JABBER_IQ_SET); - - xmlnode_set_attrib(iq->node, "to", session->remote_jid); - sess = google_session_create_xmlnode(session, "reject"); - xmlnode_insert_child(iq->node, sess); - - jabber_iq_send(iq); - } else if (type == PURPLE_MEDIA_INFO_ACCEPT && local == TRUE) { - google_session_ready(session); - } -} - -static GParameter * -jabber_google_session_get_params(JabberStream *js, guint *num) -{ - guint num_params; - GParameter *params = jingle_get_params(js, &num_params); - GParameter *new_params = g_new0(GParameter, num_params + 1); - - memcpy(new_params, params, sizeof(GParameter) * num_params); - - purple_debug_info("jabber", "setting Google jingle compatibility param\n"); - new_params[num_params].name = "compatibility-mode"; - g_value_init(&new_params[num_params].value, G_TYPE_UINT); - g_value_set_uint(&new_params[num_params].value, 1); /* NICE_COMPATIBILITY_GOOGLE */ - - g_free(params); - *num = num_params + 1; - return new_params; -} - - -gboolean -jabber_google_session_initiate(JabberStream *js, const gchar *who, PurpleMediaSessionType type) -{ - GoogleSession *session; - JabberBuddy *jb; - JabberBuddyResource *jbr; - gchar *jid; - GParameter *params; - guint num_params; - - /* construct JID to send to */ - jb = jabber_buddy_find(js, who, FALSE); - if (!jb) { - purple_debug_error("jingle-rtp", - "Could not find Jabber buddy\n"); - return FALSE; - } - jbr = jabber_buddy_find_resource(jb, NULL); - if (!jbr) { - purple_debug_error("jingle-rtp", - "Could not find buddy's resource\n"); - } - - if ((strchr(who, '/') == NULL) && jbr && (jbr->name != NULL)) { - jid = g_strdup_printf("%s/%s", who, jbr->name); - } else { - jid = g_strdup(who); - } - - session = g_new0(GoogleSession, 1); - session->id.id = jabber_get_next_id(js); - session->id.initiator = g_strdup_printf("%s@%s/%s", js->user->node, - js->user->domain, js->user->resource); - session->state = SENT_INITIATE; - session->js = js; - session->remote_jid = jid; - - if (type & PURPLE_MEDIA_VIDEO) - session->video = TRUE; - - session->media = purple_media_manager_create_media( - purple_media_manager_get(), - purple_connection_get_account(js->gc), - "fsrtpconference", session->remote_jid, TRUE); - - purple_media_set_prpl_data(session->media, session); - - g_signal_connect_swapped(G_OBJECT(session->media), - "candidates-prepared", - G_CALLBACK(google_session_ready), session); - g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed", - G_CALLBACK(google_session_ready), session); - g_signal_connect(G_OBJECT(session->media), "state-changed", - G_CALLBACK(google_session_state_changed_cb), session); - g_signal_connect(G_OBJECT(session->media), "stream-info", - G_CALLBACK(google_session_stream_info_cb), session); - - params = jabber_google_session_get_params(js, &num_params); - - if (purple_media_add_stream(session->media, "google-voice", - session->remote_jid, PURPLE_MEDIA_AUDIO, - TRUE, "nice", num_params, params) == FALSE || - (session->video && purple_media_add_stream( - session->media, "google-video", - session->remote_jid, PURPLE_MEDIA_VIDEO, - TRUE, "nice", num_params, params) == FALSE)) { - purple_media_error(session->media, "Error adding stream."); - purple_media_end(session->media, NULL, NULL); - g_free(params); - return FALSE; - } - - g_free(params); - - return (session->media != NULL) ? TRUE : FALSE; -} - -static gboolean -google_session_handle_initiate(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - JabberIq *result; - GList *codecs = NULL, *video_codecs = NULL; - xmlnode *desc_element, *codec_element; - PurpleMediaCodec *codec; - const char *xmlns; - GParameter *params; - guint num_params; - - if (session->state != UNINIT) { - purple_debug_error("jabber", "Received initiate for active session.\n"); - return FALSE; - } - - desc_element = xmlnode_get_child(sess, "description"); - xmlns = xmlnode_get_namespace(desc_element); - - if (purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) - session->video = FALSE; - else if (purple_strequal(xmlns, NS_GOOGLE_SESSION_VIDEO)) - session->video = TRUE; - else { - purple_debug_error("jabber", "Received initiate with " - "invalid namespace %s.\n", xmlns); - return FALSE; - } - - session->media = purple_media_manager_create_media( - purple_media_manager_get(), - purple_connection_get_account(js->gc), - "fsrtpconference", session->remote_jid, FALSE); - - purple_media_set_prpl_data(session->media, session); - - g_signal_connect_swapped(G_OBJECT(session->media), - "candidates-prepared", - G_CALLBACK(google_session_ready), session); - g_signal_connect_swapped(G_OBJECT(session->media), "codecs-changed", - G_CALLBACK(google_session_ready), session); - g_signal_connect(G_OBJECT(session->media), "state-changed", - G_CALLBACK(google_session_state_changed_cb), session); - g_signal_connect(G_OBJECT(session->media), "stream-info", - G_CALLBACK(google_session_stream_info_cb), session); - - params = jabber_google_session_get_params(js, &num_params); - - if (purple_media_add_stream(session->media, "google-voice", - session->remote_jid, PURPLE_MEDIA_AUDIO, FALSE, - "nice", num_params, params) == FALSE || - (session->video && purple_media_add_stream( - session->media, "google-video", - session->remote_jid, PURPLE_MEDIA_VIDEO, - FALSE, "nice", num_params, params) == FALSE)) { - purple_media_error(session->media, "Error adding stream."); - purple_media_stream_info(session->media, - PURPLE_MEDIA_INFO_REJECT, NULL, NULL, TRUE); - g_free(params); - return FALSE; - } - - g_free(params); - - for (codec_element = xmlnode_get_child(desc_element, "payload-type"); - codec_element; codec_element = codec_element->next) { - const char *id, *encoding_name, *clock_rate, - *width, *height, *framerate; - gboolean video; - if (codec_element->name && - strcmp(codec_element->name, "payload-type")) - continue; - - xmlns = xmlnode_get_namespace(codec_element); - encoding_name = xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); - - if (!session->video || - (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_PHONE))) { - clock_rate = xmlnode_get_attrib( - codec_element, "clockrate"); - video = FALSE; - } else { - width = xmlnode_get_attrib(codec_element, "width"); - height = xmlnode_get_attrib(codec_element, "height"); - framerate = xmlnode_get_attrib( - codec_element, "framerate"); - clock_rate = "90000"; - video = TRUE; - } - - if (id) { - codec = purple_media_codec_new(atoi(id), encoding_name, - video ? PURPLE_MEDIA_VIDEO : - PURPLE_MEDIA_AUDIO, - clock_rate ? atoi(clock_rate) : 0); - if (video) - video_codecs = g_list_append( - video_codecs, codec); - else - codecs = g_list_append(codecs, codec); - } - } - - if (codecs) - purple_media_set_remote_codecs(session->media, "google-voice", - session->remote_jid, codecs); - if (video_codecs) - purple_media_set_remote_codecs(session->media, "google-video", - session->remote_jid, video_codecs); - - purple_media_codec_list_free(codecs); - purple_media_codec_list_free(video_codecs); - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); - jabber_iq_send(result); - - return TRUE; -} - -static void -google_session_handle_candidates(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - JabberIq *result; - GList *list = NULL, *video_list = NULL; - xmlnode *cand; - static int name = 0; - char n[4]; - - for (cand = xmlnode_get_child(sess, "candidate"); cand; - cand = xmlnode_get_next_twin(cand)) { - PurpleMediaCandidate *info; - const gchar *cname = xmlnode_get_attrib(cand, "name"); - const gchar *type = xmlnode_get_attrib(cand, "type"); - const gchar *protocol = xmlnode_get_attrib(cand, "protocol"); - const gchar *address = xmlnode_get_attrib(cand, "address"); - const gchar *port = xmlnode_get_attrib(cand, "port"); - guint component_id; - - if (cname && type && address && port) { - PurpleMediaCandidateType candidate_type; - - g_snprintf(n, sizeof(n), "S%d", name++); - - if (g_str_equal(type, "local")) - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST; - else if (g_str_equal(type, "stun")) - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX; - else if (g_str_equal(type, "relay")) - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_RELAY; - else - candidate_type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST; - - if (purple_strequal(cname, "rtcp") || - purple_strequal(cname, "video_rtcp")) - component_id = PURPLE_MEDIA_COMPONENT_RTCP; - else - component_id = PURPLE_MEDIA_COMPONENT_RTP; - - info = purple_media_candidate_new(n, component_id, - candidate_type, - purple_strequal(protocol, "udp") ? - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP : - PURPLE_MEDIA_NETWORK_PROTOCOL_TCP, - address, - atoi(port)); - g_object_set(info, "username", xmlnode_get_attrib(cand, "username"), - "password", xmlnode_get_attrib(cand, "password"), NULL); - if (!strncmp(cname, "video_", 6)) - video_list = g_list_append(video_list, info); - else - list = g_list_append(list, info); - } - } - - if (list) - purple_media_add_remote_candidates( - session->media, "google-voice", - session->remote_jid, list); - if (video_list) - purple_media_add_remote_candidates( - session->media, "google-video", - session->remote_jid, video_list); - purple_media_candidate_list_free(list); - purple_media_candidate_list_free(video_list); - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); - jabber_iq_send(result); -} - -static void -google_session_handle_accept(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - xmlnode *desc_element = xmlnode_get_child(sess, "description"); - xmlnode *codec_element = xmlnode_get_child( - desc_element, "payload-type"); - GList *codecs = NULL, *video_codecs = NULL; - JabberIq *result = NULL; - const gchar *xmlns = xmlnode_get_namespace(desc_element); - gboolean video = (xmlns && !strcmp(xmlns, NS_GOOGLE_SESSION_VIDEO)); - - for (; codec_element; codec_element = codec_element->next) { - const gchar *xmlns, *encoding_name, *id, - *clock_rate, *width, *height, *framerate; - gboolean video_codec = FALSE; - - if (!purple_strequal(codec_element->name, "payload-type")) - continue; - - xmlns = xmlnode_get_namespace(codec_element); - encoding_name = xmlnode_get_attrib(codec_element, "name"); - id = xmlnode_get_attrib(codec_element, "id"); - - if (!video || purple_strequal(xmlns, NS_GOOGLE_SESSION_PHONE)) - clock_rate = xmlnode_get_attrib( - codec_element, "clockrate"); - else { - clock_rate = "90000"; - width = xmlnode_get_attrib(codec_element, "width"); - height = xmlnode_get_attrib(codec_element, "height"); - framerate = xmlnode_get_attrib( - codec_element, "framerate"); - video_codec = TRUE; - } - - if (id && encoding_name) { - PurpleMediaCodec *codec = purple_media_codec_new( - atoi(id), encoding_name, - video_codec ? PURPLE_MEDIA_VIDEO : - PURPLE_MEDIA_AUDIO, - clock_rate ? atoi(clock_rate) : 0); - if (video_codec) - video_codecs = g_list_append( - video_codecs, codec); - else - codecs = g_list_append(codecs, codec); - } - } - - if (codecs) - purple_media_set_remote_codecs(session->media, "google-voice", - session->remote_jid, codecs); - if (video_codecs) - purple_media_set_remote_codecs(session->media, "google-video", - session->remote_jid, video_codecs); - - purple_media_stream_info(session->media, PURPLE_MEDIA_INFO_ACCEPT, - NULL, NULL, FALSE); - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(result, iq_id); - xmlnode_set_attrib(result->node, "to", session->remote_jid); - jabber_iq_send(result); -} - -static void -google_session_handle_reject(JabberStream *js, GoogleSession *session, xmlnode *sess) -{ - purple_media_end(session->media, NULL, NULL); -} - -static void -google_session_handle_terminate(JabberStream *js, GoogleSession *session, xmlnode *sess) -{ - purple_media_end(session->media, NULL, NULL); -} - -static void -google_session_parse_iq(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id) -{ - const char *type = xmlnode_get_attrib(sess, "type"); - - if (!strcmp(type, "initiate")) { - google_session_handle_initiate(js, session, sess, iq_id); - } else if (!strcmp(type, "accept")) { - google_session_handle_accept(js, session, sess, iq_id); - } else if (!strcmp(type, "reject")) { - google_session_handle_reject(js, session, sess); - } else if (!strcmp(type, "terminate")) { - google_session_handle_terminate(js, session, sess); - } else if (!strcmp(type, "candidates")) { - google_session_handle_candidates(js, session, sess, iq_id); - } -} - -void -jabber_google_session_parse(JabberStream *js, const char *from, - JabberIqType type, const char *iq_id, - xmlnode *session_node) -{ - GoogleSession *session = NULL; - GoogleSessionId id; - - xmlnode *desc_node; - - GList *iter = NULL; - - if (type != JABBER_IQ_SET) - return; - - id.id = (gchar*)xmlnode_get_attrib(session_node, "id"); - if (!id.id) - return; - - id.initiator = (gchar*)xmlnode_get_attrib(session_node, "initiator"); - if (!id.initiator) - return; - - iter = purple_media_manager_get_media_by_account( - purple_media_manager_get(), - purple_connection_get_account(js->gc)); - for (; iter; iter = g_list_delete_link(iter, iter)) { - GoogleSession *gsession = - purple_media_get_prpl_data(iter->data); - if (google_session_id_equal(&(gsession->id), &id)) { - session = gsession; - break; - } - } - if (iter != NULL) { - g_list_free(iter); - } - - if (session) { - google_session_parse_iq(js, session, session_node, iq_id); - return; - } - - /* If the session doesn't exist, this has to be an initiate message */ - if (strcmp(xmlnode_get_attrib(session_node, "type"), "initiate")) - return; - desc_node = xmlnode_get_child(session_node, "description"); - if (!desc_node) - return; - session = g_new0(GoogleSession, 1); - session->id.id = g_strdup(id.id); - session->id.initiator = g_strdup(id.initiator); - session->state = UNINIT; - session->js = js; - session->remote_jid = g_strdup(session->id.initiator); - - google_session_handle_initiate(js, session, session_node, iq_id); -} -#endif /* USE_VV */ - -static void -jabber_gmail_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer nul) -{ - xmlnode *child; - xmlnode *message; - const char *to, *url; - const char *in_str; - char *to_name; - - int i, count = 1, returned_count; - - const char **tos, **froms, **urls; - char **subjects; - - if (type == JABBER_IQ_ERROR) - return; - - child = xmlnode_get_child(packet, "mailbox"); - if (!child) - return; - - in_str = xmlnode_get_attrib(child, "total-matched"); - if (in_str && *in_str) - count = atoi(in_str); - - /* If Gmail doesn't tell us who the mail is to, let's use our JID */ - to = xmlnode_get_attrib(packet, "to"); - - message = xmlnode_get_child(child, "mail-thread-info"); - - if (count == 0 || !message) { - if (count > 0) { - char *bare_jid = jabber_get_bare_jid(to); - const char *default_tos[2] = { bare_jid }; - - purple_notify_emails(js->gc, count, FALSE, NULL, NULL, default_tos, NULL, NULL, NULL); - g_free(bare_jid); - } else { - purple_notify_emails(js->gc, count, FALSE, NULL, NULL, NULL, NULL, NULL, NULL); - } - - return; - } - - /* Loop once to see how many messages were returned so we can allocate arrays - * accordingly */ - for (returned_count = 0; message; returned_count++, message=xmlnode_get_next_twin(message)); - - froms = g_new0(const char* , returned_count + 1); - tos = g_new0(const char* , returned_count + 1); - subjects = g_new0(char* , returned_count + 1); - urls = g_new0(const char* , returned_count + 1); - - to = xmlnode_get_attrib(packet, "to"); - to_name = jabber_get_bare_jid(to); - url = xmlnode_get_attrib(child, "url"); - if (!url || !*url) - url = "http://www.gmail.com"; - - message= xmlnode_get_child(child, "mail-thread-info"); - for (i=0; message; message = xmlnode_get_next_twin(message), i++) { - xmlnode *sender_node, *subject_node; - const char *from, *tid; - char *subject; - - subject_node = xmlnode_get_child(message, "subject"); - sender_node = xmlnode_get_child(message, "senders"); - sender_node = xmlnode_get_child(sender_node, "sender"); - - while (sender_node && (!xmlnode_get_attrib(sender_node, "unread") || - !strcmp(xmlnode_get_attrib(sender_node, "unread"),"0"))) - sender_node = xmlnode_get_next_twin(sender_node); - - if (!sender_node) { - i--; - continue; - } - - from = xmlnode_get_attrib(sender_node, "name"); - if (!from || !*from) - from = xmlnode_get_attrib(sender_node, "address"); - subject = xmlnode_get_data(subject_node); - /* - * url = xmlnode_get_attrib(message, "url"); - */ - tos[i] = (to_name != NULL ? to_name : ""); - froms[i] = (from != NULL ? from : ""); - subjects[i] = (subject != NULL ? subject : g_strdup("")); - urls[i] = url; - - tid = xmlnode_get_attrib(message, "tid"); - if (tid && - (js->gmail_last_tid == NULL || strcmp(tid, js->gmail_last_tid) > 0)) { - g_free(js->gmail_last_tid); - js->gmail_last_tid = g_strdup(tid); - } - } - - if (i>0) - purple_notify_emails(js->gc, count, count == i, (const char**) subjects, froms, tos, - urls, NULL, NULL); - - g_free(to_name); - g_free(tos); - g_free(froms); - for (i = 0; i < returned_count; i++) - g_free(subjects[i]); - g_free(subjects); - g_free(urls); - - in_str = xmlnode_get_attrib(child, "result-time"); - if (in_str && *in_str) { - g_free(js->gmail_last_time); - js->gmail_last_time = g_strdup(in_str); - } -} - -void -jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *new_mail) -{ - xmlnode *query; - JabberIq *iq; - - /* bail if the user isn't interested */ - if (!purple_account_get_check_mail(js->gc->account)) - return; - - /* Is this an initial incoming mail notification? If so, send a request for more info */ - if (type != JABBER_IQ_SET) - return; - - /* Acknowledge the notification */ - iq = jabber_iq_new(js, JABBER_IQ_RESULT); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_set_attrib(iq->node, "id", id); - jabber_iq_send(iq); - - purple_debug_misc("jabber", - "Got new mail notification. Sending request for more info\n"); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); - jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - query = xmlnode_get_child(iq->node, "query"); - - if (js->gmail_last_time) - xmlnode_set_attrib(query, "newer-than-time", js->gmail_last_time); - if (js->gmail_last_tid) - xmlnode_set_attrib(query, "newer-than-tid", js->gmail_last_tid); - - jabber_iq_send(iq); - return; -} - -void jabber_gmail_init(JabberStream *js) { - JabberIq *iq; - xmlnode *usersetting, *mailnotifications; - - if (!purple_account_get_check_mail(purple_connection_get_account(js->gc))) - return; - - /* - * Quoting http://code.google.com/apis/talk/jep_extensions/usersettings.html: - * To ensure better compatibility with other clients, rather than - * setting this value to "false" to turn off notifications, it is - * recommended that a client set this to "true" and filter incoming - * email notifications itself. - */ - iq = jabber_iq_new(js, JABBER_IQ_SET); - usersetting = xmlnode_new_child(iq->node, "usersetting"); - xmlnode_set_namespace(usersetting, "google:setting"); - mailnotifications = xmlnode_new_child(usersetting, "mailnotifications"); - xmlnode_set_attrib(mailnotifications, "value", "true"); - jabber_iq_send(iq); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_MAIL_NOTIFY); - jabber_iq_set_callback(iq, jabber_gmail_parse, NULL); - jabber_iq_send(iq); -} - -void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - GSList *list = account->deny; - const char *jid = xmlnode_get_attrib(item, "jid"); - char *jid_norm = (char *)jabber_normalize(account, jid); - - while (list) { - if (!strcmp(jid_norm, (char*)list->data)) { - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); - xmlnode_set_attrib(item, "gr:t", "B"); - return; - } - list = list->next; - } -} - -gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - const char *jid = xmlnode_get_attrib(item, "jid"); - gboolean on_block_list = FALSE; - - char *jid_norm; - - const char *grt = xmlnode_get_attrib_with_namespace(item, "t", NS_GOOGLE_ROSTER); - const char *subscription = xmlnode_get_attrib(item, "subscription"); - const char *ask = xmlnode_get_attrib(item, "ask"); - - if ((!subscription || !strcmp(subscription, "none")) && !ask) { - /* The Google Talk servers will automatically add people from your Gmail address book - * with subscription=none. If we see someone with subscription=none, ignore them. - */ - return FALSE; - } - - jid_norm = g_strdup(jabber_normalize(account, jid)); - - on_block_list = NULL != g_slist_find_custom(account->deny, jid_norm, - (GCompareFunc)strcmp); - - if (grt && (*grt == 'H' || *grt == 'h')) { - /* Hidden; don't show this buddy. */ - GSList *buddies = purple_find_buddies(account, jid_norm); - if (buddies) - purple_debug_info("jabber", "Removing %s from local buddy list\n", - jid_norm); - - for ( ; buddies; buddies = g_slist_delete_link(buddies, buddies)) { - purple_blist_remove_buddy(buddies->data); - } - - g_free(jid_norm); - return FALSE; - } - - if (!on_block_list && (grt && (*grt == 'B' || *grt == 'b'))) { - purple_debug_info("jabber", "Blocking %s\n", jid_norm); - purple_privacy_deny_add(account, jid_norm, TRUE); - } else if (on_block_list && (!grt || (*grt != 'B' && *grt != 'b' ))){ - purple_debug_info("jabber", "Unblocking %s\n", jid_norm); - purple_privacy_deny_remove(account, jid_norm, TRUE); - } - - g_free(jid_norm); - return TRUE; -} - -void jabber_google_roster_add_deny(JabberStream *js, const char *who) -{ - PurpleAccount *account; - GSList *buddies; - JabberIq *iq; - xmlnode *query; - xmlnode *item; - xmlnode *group; - PurpleBuddy *b; - JabberBuddy *jb; - const char *balias; - - jb = jabber_buddy_find(js, who, TRUE); - - account = purple_connection_get_account(js->gc); - buddies = purple_find_buddies(account, who); - if(!buddies) - return; - - b = buddies->data; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - - while(buddies) { - PurpleGroup *g; - - b = buddies->data; - g = purple_buddy_get_group(b); - - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, purple_group_get_name(g), -1); - - buddies = buddies->next; - } - - balias = purple_buddy_get_local_buddy_alias(b); - xmlnode_set_attrib(item, "jid", who); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - xmlnode_set_attrib(item, "gr:t", "B"); - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); - - jabber_iq_send(iq); - - /* Synthesize a sign-off */ - if (jb) { - JabberBuddyResource *jbr; - GList *l = jb->resources; - while (l) { - jbr = l->data; - if (jbr && jbr->name) - { - purple_debug_misc("jabber", "Removing resource %s\n", jbr->name); - jabber_buddy_remove_resource(jb, jbr->name); - } - l = l->next; - } - } - - purple_prpl_got_user_status(account, who, "offline", NULL); -} - -void jabber_google_roster_rem_deny(JabberStream *js, const char *who) -{ - GSList *buddies; - JabberIq *iq; - xmlnode *query; - xmlnode *item; - xmlnode *group; - PurpleBuddy *b; - const char *balias; - - buddies = purple_find_buddies(purple_connection_get_account(js->gc), who); - if(!buddies) - return; - - b = buddies->data; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - - while(buddies) { - PurpleGroup *g; - - b = buddies->data; - g = purple_buddy_get_group(b); - - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, purple_group_get_name(g), -1); - - buddies = buddies->next; - } - - balias = purple_buddy_get_local_buddy_alias(b); - xmlnode_set_attrib(item, "jid", who); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); - - jabber_iq_send(iq); - - /* See if he's online */ - jabber_presence_subscription_set(js, who, "probe"); -} - -/* This does two passes on the string. The first pass goes through - * and determine if all the structured text is properly balanced, and - * how many instances of each there is. The second pass goes and converts - * everything to HTML, depending on what's figured out by the first pass. - * It will short circuit once it knows it has no more replacements to make - */ -char *jabber_google_format_to_html(const char *text) -{ - const char *p; - - /* The start of the screen may be consdiered a space for this purpose */ - gboolean preceding_space = TRUE; - - gboolean in_bold = FALSE, in_italic = FALSE; - gboolean in_tag = FALSE; - - gint bold_count = 0, italic_count = 0; - - GString *str; - - for (p = text; *p != '\0'; p = g_utf8_next_char(p)) { - gunichar c = g_utf8_get_char(p); - if (c == '*' && !in_tag) { - if (in_bold && (g_unichar_isspace(*(p+1)) || - *(p+1) == '\0' || - *(p+1) == '<')) { - bold_count++; - in_bold = FALSE; - } else if (preceding_space && !in_bold && !g_unichar_isspace(*(p+1))) { - bold_count++; - in_bold = TRUE; - } - preceding_space = TRUE; - } else if (c == '_' && !in_tag) { - if (in_italic && (g_unichar_isspace(*(p+1)) || - *(p+1) == '\0' || - *(p+1) == '<')) { - italic_count++; - in_italic = FALSE; - } else if (preceding_space && !in_italic && !g_unichar_isspace(*(p+1))) { - italic_count++; - in_italic = TRUE; - } - preceding_space = TRUE; - } else if (c == '<' && !in_tag) { - in_tag = TRUE; - } else if (c == '>' && in_tag) { - in_tag = FALSE; - } else if (!in_tag) { - if (g_unichar_isspace(c)) - preceding_space = TRUE; - else - preceding_space = FALSE; - } - } - - str = g_string_new(NULL); - in_bold = in_italic = in_tag = FALSE; - preceding_space = TRUE; - - for (p = text; *p != '\0'; p = g_utf8_next_char(p)) { - gunichar c = g_utf8_get_char(p); - - if (bold_count < 2 && italic_count < 2 && !in_bold && !in_italic) { - g_string_append(str, p); - return g_string_free(str, FALSE); - } - - - if (c == '*' && !in_tag) { - if (in_bold && - (g_unichar_isspace(*(p+1))||*(p+1)=='<')) { /* This is safe in UTF-8 */ - str = g_string_append(str, "</b>"); - in_bold = FALSE; - bold_count--; - } else if (preceding_space && bold_count > 1 && !g_unichar_isspace(*(p+1))) { - str = g_string_append(str, "<b>"); - bold_count--; - in_bold = TRUE; - } else { - str = g_string_append_unichar(str, c); - } - preceding_space = TRUE; - } else if (c == '_' && !in_tag) { - if (in_italic && - (g_unichar_isspace(*(p+1))||*(p+1)=='<')) { - str = g_string_append(str, "</i>"); - italic_count--; - in_italic = FALSE; - } else if (preceding_space && italic_count > 1 && !g_unichar_isspace(*(p+1))) { - str = g_string_append(str, "<i>"); - italic_count--; - in_italic = TRUE; - } else { - str = g_string_append_unichar(str, c); - } - preceding_space = TRUE; - } else if (c == '<' && !in_tag) { - str = g_string_append_unichar(str, c); - in_tag = TRUE; - } else if (c == '>' && in_tag) { - str = g_string_append_unichar(str, c); - in_tag = FALSE; - } else if (!in_tag) { - str = g_string_append_unichar(str, c); - if (g_unichar_isspace(c)) - preceding_space = TRUE; - else - preceding_space = FALSE; - } else { - str = g_string_append_unichar(str, c); - } - } - return g_string_free(str, FALSE); -} - -void jabber_google_presence_incoming(JabberStream *js, const char *user, JabberBuddyResource *jbr) -{ - if (!js->googletalk) - return; - if (jbr->status && purple_str_has_prefix(jbr->status, "♫ ")) { - purple_prpl_got_user_status(js->gc->account, user, "tune", - PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL); - g_free(jbr->status); - jbr->status = NULL; - } else { - purple_prpl_got_user_status_deactive(js->gc->account, user, "tune"); - } -} - -char *jabber_google_presence_outgoing(PurpleStatus *tune) -{ - const char *attr = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - return attr ? g_strdup_printf("♫ %s", attr) : g_strdup(""); -} - -static void -jabber_google_stun_lookup_cb(GSList *hosts, gpointer data, - const char *error_message) -{ - JabberStream *js = (JabberStream *) data; - - if (error_message) { - purple_debug_error("jabber", "Google STUN lookup failed: %s\n", - error_message); - g_slist_free(hosts); - js->stun_query = NULL; - return; - } - - if (hosts && g_slist_next(hosts)) { - struct sockaddr *addr = g_slist_next(hosts)->data; - char dst[INET6_ADDRSTRLEN]; - int port; - - if (addr->sa_family == AF_INET6) { - inet_ntop(addr->sa_family, &((struct sockaddr_in6 *) addr)->sin6_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port); - } else { - inet_ntop(addr->sa_family, &((struct sockaddr_in *) addr)->sin_addr, - dst, sizeof(dst)); - port = ntohs(((struct sockaddr_in *) addr)->sin_port); - } - - if (js->stun_ip) - g_free(js->stun_ip); - js->stun_ip = g_strdup(dst); - js->stun_port = port; - - purple_debug_info("jabber", "set Google STUN IP/port address: " - "%s:%d\n", dst, port); - - /* unmark ongoing query */ - js->stun_query = NULL; - } - - while (hosts != NULL) { - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } -} - -static void -jabber_google_jingle_info_common(JabberStream *js, const char *from, - JabberIqType type, xmlnode *query) -{ - const xmlnode *stun = xmlnode_get_child(query, "stun"); - gchar *my_bare_jid; - - /* - * Make sure that random people aren't sending us STUN servers. Per - * http://code.google.com/apis/talk/jep_extensions/jingleinfo.html, these - * stanzas are stamped from our bare JID. - */ - if (from) { - my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - if (!purple_strequal(from, my_bare_jid)) { - purple_debug_warning("jabber", "got google:jingleinfo with invalid from (%s)\n", - from); - g_free(my_bare_jid); - return; - } - - g_free(my_bare_jid); - } - - if (type == JABBER_IQ_ERROR || type == JABBER_IQ_GET) - return; - - purple_debug_info("jabber", "got google:jingleinfo\n"); - - if (stun) { - xmlnode *server = xmlnode_get_child(stun, "server"); - - if (server) { - const gchar *host = xmlnode_get_attrib(server, "host"); - const gchar *udp = xmlnode_get_attrib(server, "udp"); - - if (host && udp) { - int port = atoi(udp); - /* if there, would already be an ongoing query, - cancel it */ - if (js->stun_query) - purple_dnsquery_destroy(js->stun_query); - - js->stun_query = purple_dnsquery_a(host, port, - jabber_google_stun_lookup_cb, js); - } - } - } - /* should perhaps handle relays later on, or maybe wait until - Google supports a common standard... */ -} - -static void -jabber_google_jingle_info_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", - NS_GOOGLE_JINGLE_INFO); - - if (query) - jabber_google_jingle_info_common(js, from, type, query); - else - purple_debug_warning("jabber", "Got invalid google:jingleinfo\n"); -} - -void -jabber_google_handle_jingle_info(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child) -{ - jabber_google_jingle_info_common(js, from, type, child); -} - -void -jabber_google_send_jingle_info(JabberStream *js) -{ - JabberIq *jingle_info = - jabber_iq_new_query(js, JABBER_IQ_GET, NS_GOOGLE_JINGLE_INFO); - - jabber_iq_set_callback(jingle_info, jabber_google_jingle_info_cb, - NULL); - purple_debug_info("jabber", "sending google:jingleinfo query\n"); - jabber_iq_send(jingle_info); -} - -void google_buddy_node_chat(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - JabberStream *js; - JabberChat *chat; - gchar *room; - guint32 tmp, a, b; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = PURPLE_BUDDY(node); - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - g_return_if_fail(gc != NULL); - js = purple_connection_get_protocol_data(gc); - - /* Generate a version 4 UUID */ - tmp = g_random_int(); - a = 0x4000 | (tmp & 0xFFF); /* 0x4000 to 0x4FFF */ - tmp >>= 12; - b = ((1 << 3) << 12) | (tmp & 0x3FFF); /* 0x8000 to 0xBFFF */ - - tmp = g_random_int(); - room = g_strdup_printf("private-chat-%08x-%04x-%04x-%04x-%04x%08x", - g_random_int(), - tmp & 0xFFFF, - a, - b, - (tmp >> 16) & 0xFFFF, g_random_int()); - - chat = jabber_join_chat(js, room, GOOGLE_GROUPCHAT_SERVER, js->user->node, - NULL, NULL); - if (chat) { - chat->muc = TRUE; - jabber_chat_invite(gc, chat->id, "", buddy->name); - } - - g_free(room); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/google.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/** - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_GOOGLE_H_ -#define PURPLE_JABBER_GOOGLE_H_ - -/* This is a place for Google Talk-specific XMPP extensions to live - * such that they don't intermingle with code for the XMPP RFCs and XEPs :) */ - -#include "jabber.h" - -#define GOOGLE_GROUPCHAT_SERVER "groupchat.google.com" - -void jabber_gmail_init(JabberStream *js); -void jabber_gmail_poke(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *new_mail); - -void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item); - -/* Returns FALSE if this should short-circuit processing of this roster item, or TRUE - * if this roster item should continue to be processed - */ -gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item); - -void jabber_google_presence_incoming(JabberStream *js, const char *who, JabberBuddyResource *jbr); -char *jabber_google_presence_outgoing(PurpleStatus *tune); - -void jabber_google_roster_add_deny(JabberStream *js, const char *who); -void jabber_google_roster_rem_deny(JabberStream *js, const char *who); - -char *jabber_google_format_to_html(const char *text); - -gboolean jabber_google_session_initiate(JabberStream *js, const gchar *who, PurpleMediaSessionType type); -void jabber_google_session_parse(JabberStream *js, const char *from, JabberIqType type, const char *iq, xmlnode *session); - -void jabber_google_handle_jingle_info(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child); -void jabber_google_send_jingle_info(JabberStream *js); - -void google_buddy_node_chat(PurpleBlistNode *node, gpointer data); - -#endif /* PURPLE_JABBER_GOOGLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,524 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "ibb.h" -#include "debug.h" -#include "xmlnode.h" - -#define JABBER_IBB_SESSION_DEFAULT_BLOCK_SIZE 4096 - -static GHashTable *jabber_ibb_sessions = NULL; -static GList *open_handlers = NULL; - -JabberIBBSession * -jabber_ibb_session_create(JabberStream *js, const gchar *sid, const gchar *who, - gpointer user_data) -{ - JabberIBBSession *sess = g_new0(JabberIBBSession, 1); - sess->js = js; - if (sid) { - sess->sid = g_strdup(sid); - } else { - sess->sid = jabber_get_next_id(js); - } - sess->who = g_strdup(who); - sess->block_size = JABBER_IBB_SESSION_DEFAULT_BLOCK_SIZE; - sess->state = JABBER_IBB_SESSION_NOT_OPENED; - sess->user_data = user_data; - - g_hash_table_insert(jabber_ibb_sessions, sess->sid, sess); - - return sess; -} - -JabberIBBSession * -jabber_ibb_session_create_from_xmlnode(JabberStream *js, const char *from, - const char *id, xmlnode *open, gpointer user_data) -{ - JabberIBBSession *sess = NULL; - const gchar *sid = xmlnode_get_attrib(open, "sid"); - const gchar *block_size = xmlnode_get_attrib(open, "block-size"); - - if (!open) { - return NULL; - } - - if (!sid || !block_size) { - purple_debug_error("jabber", - "IBB session open tag requires sid and block-size attributes\n"); - g_free(sess); - return NULL; - } - - sess = jabber_ibb_session_create(js, sid, from, user_data); - sess->id = g_strdup(id); - sess->block_size = atoi(block_size); - /* if we create a session from an incoming <open/> request, it means the - session is immediatly open... */ - sess->state = JABBER_IBB_SESSION_OPENED; - - return sess; -} - -void -jabber_ibb_session_destroy(JabberIBBSession *sess) -{ - purple_debug_info("jabber", "IBB: destroying session %p %s\n", sess, - sess->sid); - - if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_OPENED) { - jabber_ibb_session_close(sess); - } - - if (sess->last_iq_id) { - purple_debug_info("jabber", "IBB: removing callback for <iq/> %s\n", - sess->last_iq_id); - jabber_iq_remove_callback_by_id(jabber_ibb_session_get_js(sess), - sess->last_iq_id); - g_free(sess->last_iq_id); - sess->last_iq_id = NULL; - } - - g_hash_table_remove(jabber_ibb_sessions, sess->sid); - g_free(sess->id); - g_free(sess->sid); - g_free(sess->who); - g_free(sess); -} - -const gchar * -jabber_ibb_session_get_sid(const JabberIBBSession *sess) -{ - return sess->sid; -} - -JabberStream * -jabber_ibb_session_get_js(JabberIBBSession *sess) -{ - return sess->js; -} - -const gchar * -jabber_ibb_session_get_who(const JabberIBBSession *sess) -{ - return sess->who; -} - -guint16 -jabber_ibb_session_get_send_seq(const JabberIBBSession *sess) -{ - return sess->send_seq; -} - -guint16 -jabber_ibb_session_get_recv_seq(const JabberIBBSession *sess) -{ - return sess->recv_seq; -} - -JabberIBBSessionState -jabber_ibb_session_get_state(const JabberIBBSession *sess) -{ - return sess->state; -} - -gsize -jabber_ibb_session_get_block_size(const JabberIBBSession *sess) -{ - return sess->block_size; -} - -void -jabber_ibb_session_set_block_size(JabberIBBSession *sess, gsize size) -{ - if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_NOT_OPENED) { - sess->block_size = size; - } else { - purple_debug_error("jabber", - "Can't set block size on an open IBB session\n"); - } -} - -gpointer -jabber_ibb_session_get_user_data(JabberIBBSession *sess) -{ - return sess->user_data; -} - -void -jabber_ibb_session_set_opened_callback(JabberIBBSession *sess, - JabberIBBOpenedCallback *cb) -{ - sess->opened_cb = cb; -} - -void -jabber_ibb_session_set_data_sent_callback(JabberIBBSession *sess, - JabberIBBSentCallback *cb) -{ - sess->data_sent_cb = cb; -} - -void -jabber_ibb_session_set_closed_callback(JabberIBBSession *sess, - JabberIBBClosedCallback *cb) -{ - sess->closed_cb = cb; -} - -void -jabber_ibb_session_set_data_received_callback(JabberIBBSession *sess, - JabberIBBDataCallback *cb) -{ - sess->data_received_cb = cb; -} - -void -jabber_ibb_session_set_error_callback(JabberIBBSession *sess, - JabberIBBErrorCallback *cb) -{ - sess->error_cb = cb; -} - -static void -jabber_ibb_session_opened_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberIBBSession *sess = (JabberIBBSession *) data; - - if (type == JABBER_IQ_ERROR) { - sess->state = JABBER_IBB_SESSION_ERROR; - } else { - sess->state = JABBER_IBB_SESSION_OPENED; - } - - if (sess->opened_cb) { - sess->opened_cb(sess); - } -} - -void -jabber_ibb_session_open(JabberIBBSession *sess) -{ - if (jabber_ibb_session_get_state(sess) != JABBER_IBB_SESSION_NOT_OPENED) { - purple_debug_error("jabber", - "jabber_ibb_session called on an already open stream\n"); - } else { - JabberIq *set = jabber_iq_new(sess->js, JABBER_IQ_SET); - xmlnode *open = xmlnode_new("open"); - gchar block_size[10]; - - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(open, NS_IBB); - xmlnode_set_attrib(open, "sid", jabber_ibb_session_get_sid(sess)); - g_snprintf(block_size, sizeof(block_size), "%" G_GSIZE_FORMAT, - jabber_ibb_session_get_block_size(sess)); - xmlnode_set_attrib(open, "block-size", block_size); - xmlnode_insert_child(set->node, open); - - jabber_iq_set_callback(set, jabber_ibb_session_opened_cb, sess); - - jabber_iq_send(set); - } -} - -void -jabber_ibb_session_close(JabberIBBSession *sess) -{ - JabberIBBSessionState state = jabber_ibb_session_get_state(sess); - - if (state != JABBER_IBB_SESSION_OPENED && state != JABBER_IBB_SESSION_ERROR) { - purple_debug_error("jabber", - "jabber_ibb_session_close called on a session that has not been" - "opened\n"); - } else { - JabberIq *set = jabber_iq_new(jabber_ibb_session_get_js(sess), - JABBER_IQ_SET); - xmlnode *close = xmlnode_new("close"); - - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(close, NS_IBB); - xmlnode_set_attrib(close, "sid", jabber_ibb_session_get_sid(sess)); - xmlnode_insert_child(set->node, close); - jabber_iq_send(set); - sess->state = JABBER_IBB_SESSION_CLOSED; - } -} - -void -jabber_ibb_session_accept(JabberIBBSession *sess) -{ - JabberIq *result = jabber_iq_new(jabber_ibb_session_get_js(sess), - JABBER_IQ_RESULT); - - xmlnode_set_attrib(result->node, "to", jabber_ibb_session_get_who(sess)); - jabber_iq_set_id(result, sess->id); - jabber_iq_send(result); - sess->state = JABBER_IBB_SESSION_OPENED; -} - -static void -jabber_ibb_session_send_acknowledge_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberIBBSession *sess = (JabberIBBSession *) data; - - if (sess) { - /* reset callback */ - if (sess->last_iq_id) { - g_free(sess->last_iq_id); - sess->last_iq_id = NULL; - } - - if (type == JABBER_IQ_ERROR) { - jabber_ibb_session_close(sess); - sess->state = JABBER_IBB_SESSION_ERROR; - - if (sess->error_cb) { - sess->error_cb(sess); - } - } else { - if (sess->data_sent_cb) { - sess->data_sent_cb(sess); - } - } - } else { - /* the session has gone away, it was probably cancelled */ - purple_debug_info("jabber", - "got response from send data, but IBB session is no longer active\n"); - } -} - -void -jabber_ibb_session_send_data(JabberIBBSession *sess, gconstpointer data, - gsize size) -{ - JabberIBBSessionState state = jabber_ibb_session_get_state(sess); - - purple_debug_info("jabber", "sending data block of %" G_GSIZE_FORMAT " bytes on IBB stream\n", - size); - - if (state != JABBER_IBB_SESSION_OPENED) { - purple_debug_error("jabber", - "trying to send data on a non-open IBB session\n"); - } else if (size > jabber_ibb_session_get_block_size(sess)) { - purple_debug_error("jabber", - "trying to send a too large packet in the IBB session\n"); - } else { - JabberIq *set = jabber_iq_new(jabber_ibb_session_get_js(sess), - JABBER_IQ_SET); - xmlnode *data_element = xmlnode_new("data"); - char *base64 = purple_base64_encode(data, size); - char seq[10]; - g_snprintf(seq, sizeof(seq), "%u", jabber_ibb_session_get_send_seq(sess)); - - xmlnode_set_attrib(set->node, "to", jabber_ibb_session_get_who(sess)); - xmlnode_set_namespace(data_element, NS_IBB); - xmlnode_set_attrib(data_element, "sid", jabber_ibb_session_get_sid(sess)); - xmlnode_set_attrib(data_element, "seq", seq); - xmlnode_insert_data(data_element, base64, -1); - - xmlnode_insert_child(set->node, data_element); - - purple_debug_info("jabber", - "IBB: setting send <iq/> callback for session %p %s\n", sess, - sess->sid); - jabber_iq_set_callback(set, jabber_ibb_session_send_acknowledge_cb, sess); - sess->last_iq_id = g_strdup(xmlnode_get_attrib(set->node, "id")); - purple_debug_info("jabber", "IBB: set sess->last_iq_id: %s\n", - sess->last_iq_id); - jabber_iq_send(set); - - g_free(base64); - (sess->send_seq)++; - } -} - -static void -jabber_ibb_send_error_response(JabberStream *js, const char *to, const char *id) -{ - JabberIq *result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode *error = xmlnode_new("error"); - xmlnode *item_not_found = xmlnode_new("item-not-found"); - - xmlnode_set_namespace(item_not_found, NS_XMPP_STANZAS); - xmlnode_set_attrib(error, "code", "440"); - xmlnode_set_attrib(error, "type", "cancel"); - jabber_iq_set_id(result, id); - xmlnode_set_attrib(result->node, "to", to); - xmlnode_insert_child(error, item_not_found); - xmlnode_insert_child(result->node, error); - - jabber_iq_send(result); -} - -void -jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *child) -{ - const char *name = child->name; - gboolean data = g_str_equal(name, "data"); - gboolean close = g_str_equal(name, "close"); - gboolean open = g_str_equal(name, "open"); - const gchar *sid = (data || close) ? - xmlnode_get_attrib(child, "sid") : NULL; - JabberIBBSession *sess = - sid ? g_hash_table_lookup(jabber_ibb_sessions, sid) : NULL; - - if (sess) { - - if (strcmp(who, jabber_ibb_session_get_who(sess)) != 0) { - /* the iq comes from a different JID than the remote JID of the - session, ignore it */ - purple_debug_error("jabber", - "Got IBB iq from wrong JID, ignoring\n"); - } else if (data) { - const gchar *seq_attr = xmlnode_get_attrib(child, "seq"); - guint16 seq = (seq_attr ? atoi(seq_attr) : 0); - - /* reject the data, and set the session in error if we get an - out-of-order packet */ - if (seq_attr && seq == jabber_ibb_session_get_recv_seq(sess)) { - /* sequence # is the expected... */ - JabberIq *result = jabber_iq_new(js, JABBER_IQ_RESULT); - - jabber_iq_set_id(result, id); - xmlnode_set_attrib(result->node, "to", who); - - if (sess->data_received_cb) { - gchar *base64 = xmlnode_get_data(child); - gsize size; - gpointer rawdata = purple_base64_decode(base64, &size); - - g_free(base64); - - if (rawdata) { - purple_debug_info("jabber", - "got %" G_GSIZE_FORMAT " bytes of data on IBB stream\n", - size); - if (size > jabber_ibb_session_get_block_size(sess)) { - purple_debug_error("jabber", - "IBB: received a too large packet\n"); - if (sess->error_cb) - sess->error_cb(sess); - g_free(rawdata); - return; - } else { - purple_debug_info("jabber", - "calling IBB callback for received data\n"); - sess->data_received_cb(sess, rawdata, size); - } - g_free(rawdata); - } else { - purple_debug_error("jabber", - "IBB: invalid BASE64 data received\n"); - if (sess->error_cb) - sess->error_cb(sess); - return; - - } - } - - (sess->recv_seq)++; - jabber_iq_send(result); - - } else { - purple_debug_error("jabber", - "Received an out-of-order/invalid IBB packet\n"); - sess->state = JABBER_IBB_SESSION_ERROR; - - if (sess->error_cb) { - sess->error_cb(sess); - } - } - } else if (close) { - sess->state = JABBER_IBB_SESSION_CLOSED; - purple_debug_info("jabber", "IBB: received close\n"); - - if (sess->closed_cb) { - purple_debug_info("jabber", "IBB: calling closed handler\n"); - sess->closed_cb(sess); - } - - } else { - /* this should never happen */ - purple_debug_error("jabber", "Received bogus iq for IBB session\n"); - } - } else if (open) { - JabberIq *result; - const GList *iterator; - - /* run all open handlers registered until one returns true */ - for (iterator = open_handlers ; iterator ; - iterator = g_list_next(iterator)) { - JabberIBBOpenHandler *handler = iterator->data; - - if (handler(js, who, id, child)) { - result = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "to", who); - jabber_iq_set_id(result, id); - jabber_iq_send(result); - return; - } - } - /* no open callback returned success, reject */ - jabber_ibb_send_error_response(js, who, id); - } else { - /* send error reply */ - jabber_ibb_send_error_response(js, who, id); - } -} - -void -jabber_ibb_register_open_handler(JabberIBBOpenHandler *cb) -{ - open_handlers = g_list_append(open_handlers, cb); -} - -void -jabber_ibb_unregister_open_handler(JabberIBBOpenHandler *cb) -{ - open_handlers = g_list_remove(open_handlers, cb); -} - -void -jabber_ibb_init(void) -{ - jabber_ibb_sessions = g_hash_table_new(g_str_hash, g_str_equal); - - jabber_add_feature(NS_IBB, NULL); - - jabber_iq_register_handler("close", NS_IBB, jabber_ibb_parse); - jabber_iq_register_handler("data", NS_IBB, jabber_ibb_parse); - jabber_iq_register_handler("open", NS_IBB, jabber_ibb_parse); -} - -void -jabber_ibb_uninit(void) -{ - g_hash_table_destroy(jabber_ibb_sessions); - g_list_free(open_handlers); - jabber_ibb_sessions = NULL; - open_handlers = NULL; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ibb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/* - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_IBB_H_ -#define PURPLE_JABBER_IBB_H_ - -#include "jabber.h" -#include "iq.h" - -typedef struct _JabberIBBSession JabberIBBSession; - -typedef void -(JabberIBBDataCallback)(JabberIBBSession *, const gpointer data, gsize size); - -typedef void (JabberIBBOpenedCallback)(JabberIBBSession *); -typedef void (JabberIBBClosedCallback)(JabberIBBSession *); -typedef void (JabberIBBErrorCallback)(JabberIBBSession *); -typedef void (JabberIBBSentCallback)(JabberIBBSession *); - -typedef gboolean (JabberIBBOpenHandler)(JabberStream *js, const char *from, - const char *id, xmlnode *open); - -typedef enum { - JABBER_IBB_SESSION_NOT_OPENED, - JABBER_IBB_SESSION_OPENED, - JABBER_IBB_SESSION_CLOSED, - JABBER_IBB_SESSION_ERROR -} JabberIBBSessionState; - -struct _JabberIBBSession { - JabberStream *js; - gchar *who; - gchar *sid; - gchar *id; - guint16 send_seq; - guint16 recv_seq; - gsize block_size; - - /* session state */ - JabberIBBSessionState state; - - /* user data (f.ex. a handle to a PurpleXfer) */ - gpointer user_data; - - /* callbacks */ - JabberIBBOpenedCallback *opened_cb; - JabberIBBSentCallback *data_sent_cb; - JabberIBBClosedCallback *closed_cb; - /* callback for receiving data */ - JabberIBBDataCallback *data_received_cb; - JabberIBBErrorCallback *error_cb; - - /* store the last sent IQ (to permit cancel of callback) */ - gchar *last_iq_id; -}; - -JabberIBBSession *jabber_ibb_session_create(JabberStream *js, const gchar *sid, - const gchar *who, gpointer user_data); -JabberIBBSession *jabber_ibb_session_create_from_xmlnode(JabberStream *js, - const gchar *from, const gchar *id, xmlnode *open, gpointer user_data); - -void jabber_ibb_session_destroy(JabberIBBSession *sess); - -void jabber_ibb_session_set_opened_callback(JabberIBBSession *sess, - JabberIBBOpenedCallback *cb); -void jabber_ibb_session_set_data_sent_callback(JabberIBBSession *sess, - JabberIBBSentCallback *cb); -void jabber_ibb_session_set_closed_callback(JabberIBBSession *sess, - JabberIBBClosedCallback *cb); -void jabber_ibb_session_set_data_received_callback(JabberIBBSession *sess, - JabberIBBDataCallback *cb); -void jabber_ibb_session_set_error_callback(JabberIBBSession *sess, - JabberIBBErrorCallback *cb); - -void jabber_ibb_session_open(JabberIBBSession *sess); -void jabber_ibb_session_close(JabberIBBSession *sess); -void jabber_ibb_session_accept(JabberIBBSession *sess); -void jabber_ibb_session_send_data(JabberIBBSession *sess, gconstpointer data, - gsize size); - -const gchar *jabber_ibb_session_get_sid(const JabberIBBSession *sess); -JabberStream *jabber_ibb_session_get_js(JabberIBBSession *sess); -const gchar *jabber_ibb_session_get_who(const JabberIBBSession *sess); - -guint16 jabber_ibb_session_get_send_seq(const JabberIBBSession *sess); -guint16 jabber_ibb_session_get_recv_seq(const JabberIBBSession *sess); - -JabberIBBSessionState jabber_ibb_session_get_state(const JabberIBBSession *sess); - -gsize jabber_ibb_session_get_block_size(const JabberIBBSession *sess); -void jabber_ibb_session_set_block_size(JabberIBBSession *sess, gsize size); - -gpointer jabber_ibb_session_get_user_data(JabberIBBSession *sess); - -/* handle incoming packet */ -void jabber_ibb_parse(JabberStream *js, const char *who, JabberIqType type, - const char *id, xmlnode *child); - -/* add a handler for open session */ -void jabber_ibb_register_open_handler(JabberIBBOpenHandler *cb); -void jabber_ibb_unregister_open_handler(JabberIBBOpenHandler *cb); - -void jabber_ibb_init(void); -void jabber_ibb_uninit(void); - -#endif /* PURPLE_JABBER_IBB_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,495 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "core.h" -#include "debug.h" -#include "prefs.h" -#include "util.h" - -#include "buddy.h" -#include "disco.h" -#include "google.h" -#include "iq.h" -#include "jingle/jingle.h" -#include "oob.h" -#include "roster.h" -#include "si.h" -#include "ping.h" -#include "adhoccommands.h" -#include "data.h" -#include "ibb.h" - -#ifdef _WIN32 -#include "utsname.h" -#endif - -GHashTable *iq_handlers = NULL; -GHashTable *signal_iq_handlers = NULL; - -JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type) -{ - JabberIq *iq; - - iq = g_new0(JabberIq, 1); - - iq->type = type; - - iq->node = xmlnode_new("iq"); - switch(iq->type) { - case JABBER_IQ_SET: - xmlnode_set_attrib(iq->node, "type", "set"); - break; - case JABBER_IQ_GET: - xmlnode_set_attrib(iq->node, "type", "get"); - break; - case JABBER_IQ_ERROR: - xmlnode_set_attrib(iq->node, "type", "error"); - break; - case JABBER_IQ_RESULT: - xmlnode_set_attrib(iq->node, "type", "result"); - break; - case JABBER_IQ_NONE: - /* this shouldn't ever happen */ - break; - } - - iq->js = js; - - if(type == JABBER_IQ_GET || type == JABBER_IQ_SET) { - iq->id = jabber_get_next_id(js); - xmlnode_set_attrib(iq->node, "id", iq->id); - } - - return iq; -} - -JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, - const char *xmlns) -{ - JabberIq *iq = jabber_iq_new(js, type); - xmlnode *query; - - query = xmlnode_new_child(iq->node, "query"); - xmlnode_set_namespace(query, xmlns); - - return iq; -} - -typedef struct _JabberCallbackData { - JabberIqCallback *callback; - gpointer data; -} JabberCallbackData; - -void -jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *callback, gpointer data) -{ - iq->callback = callback; - iq->callback_data = data; -} - -void jabber_iq_set_id(JabberIq *iq, const char *id) -{ - g_free(iq->id); - - if(id) { - xmlnode_set_attrib(iq->node, "id", id); - iq->id = g_strdup(id); - } else { - xmlnode_remove_attrib(iq->node, "id"); - iq->id = NULL; - } -} - -void jabber_iq_send(JabberIq *iq) -{ - JabberCallbackData *jcd; - g_return_if_fail(iq != NULL); - - jabber_send(iq->js, iq->node); - - if(iq->id && iq->callback) { - jcd = g_new0(JabberCallbackData, 1); - jcd->callback = iq->callback; - jcd->data = iq->callback_data; - g_hash_table_insert(iq->js->iq_callbacks, g_strdup(iq->id), jcd); - } - - jabber_iq_free(iq); -} - -void jabber_iq_free(JabberIq *iq) -{ - g_return_if_fail(iq != NULL); - - g_free(iq->id); - xmlnode_free(iq->node); - g_free(iq); -} - -static void jabber_iq_last_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet) -{ - JabberIq *iq; - xmlnode *query; - char *idle_time; - - if(type == JABBER_IQ_GET) { - iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, NS_LAST_ACTIVITY); - jabber_iq_set_id(iq, id); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - - query = xmlnode_get_child(iq->node, "query"); - - idle_time = g_strdup_printf("%ld", js->idle ? time(NULL) - js->idle : 0); - xmlnode_set_attrib(query, "seconds", idle_time); - g_free(idle_time); - - jabber_iq_send(iq); - } -} - -static void jabber_time_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child) -{ - JabberIq *iq; - time_t now_t; - struct tm *tm; - - time(&now_t); - - if(type == JABBER_IQ_GET) { - xmlnode *tzo, *utc; - const char *date, *tz; - - iq = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(iq, id); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - - child = xmlnode_new_child(iq->node, child->name); - xmlnode_set_namespace(child, NS_ENTITY_TIME); - - /* <tzo>-06:00</tzo> */ - tm = localtime(&now_t); - tz = purple_get_tzoff_str(tm, TRUE); - tzo = xmlnode_new_child(child, "tzo"); - xmlnode_insert_data(tzo, tz, -1); - - /* <utc>2006-12-19T17:58:35Z</utc> */ - tm = gmtime(&now_t); - date = purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm); - utc = xmlnode_new_child(child, "utc"); - xmlnode_insert_data(utc, date, -1); - - jabber_iq_send(iq); - } else { - /* TODO: Errors */ - } -} - -static void jabber_iq_version_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet) -{ - JabberIq *iq; - xmlnode *query; - - if(type == JABBER_IQ_GET) { - GHashTable *ui_info; - const char *ui_name = NULL, *ui_version = NULL; -#if 0 - char *os = NULL; - if(!purple_prefs_get_bool("/plugins/prpl/jabber/hide_os")) { - struct utsname osinfo; - - uname(&osinfo); - os = g_strdup_printf("%s %s %s", osinfo.sysname, osinfo.release, - osinfo.machine); - } -#endif - - iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, "jabber:iq:version"); - if (from) - xmlnode_set_attrib(iq->node, "to", from); - jabber_iq_set_id(iq, id); - - query = xmlnode_get_child(iq->node, "query"); - - ui_info = purple_core_get_ui_info(); - - if(NULL != ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_version = g_hash_table_lookup(ui_info, "version"); - } - - if(NULL != ui_name && NULL != ui_version) { - char *version_complete = g_strdup_printf("%s (libpurple " VERSION ")", ui_version); - xmlnode_insert_data(xmlnode_new_child(query, "name"), ui_name, -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), version_complete, -1); - g_free(version_complete); - } else { - xmlnode_insert_data(xmlnode_new_child(query, "name"), "libpurple", -1); - xmlnode_insert_data(xmlnode_new_child(query, "version"), VERSION, -1); - } - -#if 0 - if(os) { - xmlnode_insert_data(xmlnode_new_child(query, "os"), os, -1); - g_free(os); - } -#endif - - jabber_iq_send(iq); - } -} - -void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id) -{ - g_hash_table_remove(js->iq_callbacks, id); -} - -void jabber_iq_parse(JabberStream *js, xmlnode *packet) -{ - JabberCallbackData *jcd; - xmlnode *child, *error, *x; - const char *xmlns; - const char *iq_type, *id, *from; - JabberIqType type = JABBER_IQ_NONE; - gboolean signal_return; - - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - iq_type = xmlnode_get_attrib(packet, "type"); - - /* - * child will be either the first tag child or NULL if there is no child. - * Historically, we used just the 'query' subchild, but newer XEPs use - * differently named children. Grabbing the first child is (for the time - * being) sufficient. - */ - for (child = packet->child; child; child = child->next) { - if (child->type == XMLNODE_TYPE_TAG) - break; - } - - if (iq_type) { - if (!strcmp(iq_type, "get")) - type = JABBER_IQ_GET; - else if (!strcmp(iq_type, "set")) - type = JABBER_IQ_SET; - else if (!strcmp(iq_type, "result")) - type = JABBER_IQ_RESULT; - else if (!strcmp(iq_type, "error")) - type = JABBER_IQ_ERROR; - } - - if (type == JABBER_IQ_NONE) { - purple_debug_error("jabber", "IQ with invalid type ('%s') - ignoring.\n", - iq_type ? iq_type : "(null)"); - return; - } - - /* All IQs must have an ID, so send an error for a set/get that doesn't */ - if(!id || !*id) { - - if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - - xmlnode_free(iq->node); - iq->node = xmlnode_copy(packet); - if (from) { - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_remove_attrib(iq->node, "from"); - } - - xmlnode_set_attrib(iq->node, "type", "error"); - /* This id is clearly not useful, but we must put something there for a valid stanza */ - iq->id = jabber_get_next_id(js); - xmlnode_set_attrib(iq->node, "id", iq->id); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - x = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(iq); - } else - purple_debug_error("jabber", "IQ of type '%s' missing id - ignoring.\n", - iq_type); - - return; - } - - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), - "jabber-receiving-iq", js->gc, iq_type, id, from, packet)); - if (signal_return) - return; - - /* First, lets see if a special callback got registered */ - if(type == JABBER_IQ_RESULT || type == JABBER_IQ_ERROR) { - if((jcd = g_hash_table_lookup(js->iq_callbacks, id))) { - jcd->callback(js, from, type, id, packet, jcd->data); - jabber_iq_remove_callback_by_id(js, id); - return; - } - } - - /* - * Apparently not, so let's see if we have a pre-defined handler - * or if an outside plugin is interested. - */ - if(child && (xmlns = xmlnode_get_namespace(child))) { - char *key = g_strdup_printf("%s %s", child->name, xmlns); - JabberIqHandler *jih = g_hash_table_lookup(iq_handlers, key); - int signal_ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); - g_free(key); - - if (signal_ref > 0) { - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), "jabber-watched-iq", - js->gc, iq_type, id, from, child)); - if (signal_return) - return; - } - - if(jih) { - jih(js, from, type, id, child); - return; - } - } - - purple_debug_misc("jabber", "Unhandled IQ with id %s\n", id); - - /* If we get here, send the default error reply mandated by XMPP-CORE */ - if(type == JABBER_IQ_SET || type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_ERROR); - - xmlnode_free(iq->node); - iq->node = xmlnode_copy(packet); - if (from) { - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_remove_attrib(iq->node, "from"); - } - - xmlnode_set_attrib(iq->node, "type", "error"); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - xmlnode_set_attrib(error, "code", "501"); - x = xmlnode_new_child(error, "feature-not-implemented"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(iq); - } -} - -void jabber_iq_register_handler(const char *node, const char *xmlns, JabberIqHandler *handlerfunc) -{ - /* - * This is valid because nodes nor namespaces cannot have spaces in them - * (see http://www.w3.org/TR/2006/REC-xml-20060816/ and - * http://www.w3.org/TR/REC-xml-names/) - */ - char *key = g_strdup_printf("%s %s", node, xmlns); - g_hash_table_replace(iq_handlers, key, handlerfunc); -} - -void jabber_iq_signal_register(const gchar *node, const gchar *xmlns) -{ - gchar *key; - int ref; - - g_return_if_fail(node != NULL && *node != '\0'); - g_return_if_fail(xmlns != NULL && *xmlns != '\0'); - - key = g_strdup_printf("%s %s", node, xmlns); - ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); - if (ref == 0) { - g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(1)); - } else { - g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref + 1)); - g_free(key); - } -} - -void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns) -{ - gchar *key; - int ref; - - g_return_if_fail(node != NULL && *node != '\0'); - g_return_if_fail(xmlns != NULL && *xmlns != '\0'); - - key = g_strdup_printf("%s %s", node, xmlns); - ref = GPOINTER_TO_INT(g_hash_table_lookup(signal_iq_handlers, key)); - - if (ref == 1) { - g_hash_table_remove(signal_iq_handlers, key); - } else if (ref > 1) { - g_hash_table_insert(signal_iq_handlers, key, GINT_TO_POINTER(ref - 1)); - } - - g_free(key); -} - -void jabber_iq_init(void) -{ - iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - signal_iq_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - jabber_iq_register_handler("jingle", JINGLE, jingle_parse); - jabber_iq_register_handler("mailbox", NS_GOOGLE_MAIL_NOTIFY, - jabber_gmail_poke); - jabber_iq_register_handler("new-mail", NS_GOOGLE_MAIL_NOTIFY, - jabber_gmail_poke); - jabber_iq_register_handler("ping", NS_PING, jabber_ping_parse); - jabber_iq_register_handler("query", NS_GOOGLE_JINGLE_INFO, - jabber_google_handle_jingle_info); - jabber_iq_register_handler("query", NS_BYTESTREAMS, - jabber_bytestreams_parse); - jabber_iq_register_handler("query", NS_DISCO_INFO, jabber_disco_info_parse); - jabber_iq_register_handler("query", NS_DISCO_ITEMS, jabber_disco_items_parse); - jabber_iq_register_handler("query", NS_LAST_ACTIVITY, jabber_iq_last_parse); - jabber_iq_register_handler("query", NS_OOB_IQ_DATA, jabber_oob_parse); - jabber_iq_register_handler("query", "jabber:iq:register", - jabber_register_parse); - jabber_iq_register_handler("query", "jabber:iq:roster", - jabber_roster_parse); - jabber_iq_register_handler("query", "jabber:iq:version", - jabber_iq_version_parse); -#ifdef USE_VV - jabber_iq_register_handler("session", NS_GOOGLE_SESSION, - jabber_google_session_parse); -#endif - jabber_iq_register_handler("block", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); - jabber_iq_register_handler("unblock", NS_SIMPLE_BLOCKING, jabber_blocklist_parse_push); - jabber_iq_register_handler("time", NS_ENTITY_TIME, jabber_time_parse); - -} - -void jabber_iq_uninit(void) -{ - g_hash_table_destroy(iq_handlers); - g_hash_table_destroy(signal_iq_handlers); - iq_handlers = signal_iq_handlers = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/iq.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -/** - * @file iq.h JabberID handlers - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_IQ_H_ -#define PURPLE_JABBER_IQ_H_ - -typedef enum { - JABBER_IQ_SET, - JABBER_IQ_GET, - JABBER_IQ_RESULT, - JABBER_IQ_ERROR, - JABBER_IQ_NONE -} JabberIqType; - -#include "jabber.h" -#include "connection.h" - -typedef struct _JabberIq JabberIq; - -/** - * A JabberIqHandler is called to process an incoming IQ stanza. - * Handlers typically process unsolicited incoming GETs or SETs for their - * registered namespace, but may be called to handle the results of a - * GET or SET that we generated if no JabberIqCallback was generated - * The handler may be called for the results of a GET or SET (RESULT or ERROR) - * that we generated - * if the generating function did not register a JabberIqCallback. - * - * @param js The JabberStream object. - * @param from The remote entity (the from attribute on the <iq/> stanza) - * @param type The IQ type. - * @param id The IQ id (the id attribute on the <iq/> stanza) - * @param child The child element of the <iq/> stanza that matches the name - * and namespace registered with jabber_iq_register_handler. - * - * @see jabber_iq_register_handler() - * @see JabberIqCallback - */ -typedef void (JabberIqHandler)(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child); - -/** - * A JabberIqCallback is called to process the results of a GET or SET that - * we send to a remote entity. The callback is matched based on the id - * of the incoming stanza (which matches the one on the initial stanza). - * - * @param js The JabberStream object. - * @param from The remote entity (the from attribute on the <iq/> stanza) - * @param type The IQ type. The only possible values are JABBER_IQ_RESULT - * and JABBER_IQ_ERROR. - * @param id The IQ id (the id attribute on the <iq/> stanza) - * @param packet The <iq/> stanza - * @param data The callback data passed to jabber_iq_set_callback() - * - * @see jabber_iq_set_callback() - */ -typedef void (JabberIqCallback)(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data); - -struct _JabberIq { - JabberIqType type; - char *id; - xmlnode *node; - - JabberIqCallback *callback; - gpointer callback_data; - - JabberStream *js; -}; - -JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type); -JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, - const char *xmlns); - -void jabber_iq_parse(JabberStream *js, xmlnode *packet); - -void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id); -void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data); -void jabber_iq_set_id(JabberIq *iq, const char *id); - -void jabber_iq_send(JabberIq *iq); -void jabber_iq_free(JabberIq *iq); - -void jabber_iq_init(void); -void jabber_iq_uninit(void); - -void jabber_iq_register_handler(const char *node, const char *xmlns, - JabberIqHandler *func); - -/* Connected to namespace-handler registration signals */ -void jabber_iq_signal_register(const gchar *node, const gchar *xmlns); -void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns); - -#endif /* PURPLE_JABBER_IQ_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3563 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "core.h" -#include "cmds.h" -#include "connection.h" -#include "conversation.h" -#include "debug.h" -#include "dnssrv.h" -#include "imgstore.h" -#include "message.h" -#include "notify.h" -#include "pluginpref.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "server.h" -#include "status.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -#include "auth.h" -#include "buddy.h" -#include "caps.h" -#include "chat.h" -#include "data.h" -#include "disco.h" -#include "google.h" -#include "ibb.h" -#include "iq.h" -#include "jutil.h" -#include "message.h" -#include "parser.h" -#include "presence.h" -#include "jabber.h" -#include "roster.h" -#include "ping.h" -#include "si.h" -#include "xdata.h" -#include "pep.h" -#include "adhoccommands.h" - -#include "jingle/jingle.h" -#include "jingle/rtp.h" - -GList *jabber_features = NULL; -GList *jabber_identities = NULL; -static GSList *jabber_cmds = NULL; - -static void jabber_unregister_account_cb(JabberStream *js); -static void try_srv_connect(JabberStream *js); - -static void jabber_stream_init(JabberStream *js) -{ - char *open_stream; - - open_stream = g_strdup_printf("<stream:stream to='%s' " - "xmlns='" NS_XMPP_CLIENT "' " - "xmlns:stream='" NS_XMPP_STREAMS "' " - "version='1.0'>", - js->user->domain); - /* setup the parser fresh for each stream */ - jabber_parser_setup(js); - jabber_send_raw(js, open_stream, -1); - js->reinit = FALSE; - g_free(open_stream); -} - -static void -jabber_session_initialized_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) { - jabber_disco_items_server(js); - if(js->unregistration) - jabber_unregister_account_cb(js); - } else { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - ("Error initializing session")); - } -} - -static void jabber_session_init(JabberStream *js) -{ - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - xmlnode *session; - - jabber_iq_set_callback(iq, jabber_session_initialized_cb, NULL); - - session = xmlnode_new_child(iq->node, "session"); - xmlnode_set_namespace(session, NS_XMPP_SESSION); - - jabber_iq_send(iq); -} - -static void jabber_bind_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *bind; - - if (type == JABBER_IQ_RESULT && - (bind = xmlnode_get_child_with_namespace(packet, "bind", NS_XMPP_BIND))) { - xmlnode *jid; - char *full_jid; - if((jid = xmlnode_get_child(bind, "jid")) && (full_jid = xmlnode_get_data(jid))) { - jabber_id_free(js->user); - - js->user = jabber_id_new(full_jid); - if (js->user == NULL) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid response from server")); - g_free(full_jid); - return; - } - - js->user_jb = jabber_buddy_find(js, full_jid, TRUE); - js->user_jb->subscription |= JABBER_SUB_BOTH; - - purple_connection_set_display_name(js->gc, full_jid); - - g_free(full_jid); - } - } else { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - purple_connection_error_reason(js->gc, reason, msg); - g_free(msg); - } - - jabber_session_init(js); -} - -static char *jabber_prep_resource(char *input) { - char hostname[256], /* current hostname */ - *dot = NULL; - - /* Empty resource == don't send any */ - if (input == NULL || *input == '\0') - return NULL; - - if (strstr(input, "__HOSTNAME__") == NULL) - return g_strdup(input); - - /* Replace __HOSTNAME__ with hostname */ - if (gethostname(hostname, sizeof(hostname) - 1)) { - purple_debug_warning("jabber", "gethostname: %s\n", g_strerror(errno)); - /* according to glibc doc, the only time an error is returned - is if the hostname is longer than the buffer, in which case - glibc 2.2+ would still fill the buffer with partial - hostname, so maybe we want to detect that and use it - instead - */ - strcpy(hostname, "localhost"); - } - hostname[sizeof(hostname) - 1] = '\0'; - - /* We want only the short hostname, not the FQDN - this will prevent the - * resource string from being unreasonably long on systems which stuff the - * whole FQDN in the hostname */ - if((dot = strchr(hostname, '.'))) - dot = '\0'; - - return purple_strreplace(input, "__HOSTNAME__", hostname); -} - -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) -{ - if(xmlnode_get_child(packet, "starttls")) { - if(jabber_process_starttls(js, packet)) { - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); - return; - } - } else if(purple_account_get_bool(js->gc->account, "require_tls", JABBER_DEFAULT_REQUIRE_TLS) && !jabber_stream_is_ssl(js)) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("You require encryption, but it is not available on this server.")); - return; - } - - if(js->registration) { - jabber_register_start(js); - } else if(xmlnode_get_child(packet, "mechanisms")) { - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - jabber_auth_start(js, packet); - } else if(xmlnode_get_child(packet, "bind")) { - xmlnode *bind, *resource; - char *requested_resource; - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET); - bind = xmlnode_new_child(iq->node, "bind"); - xmlnode_set_namespace(bind, NS_XMPP_BIND); - requested_resource = jabber_prep_resource(js->user->resource); - - if (requested_resource != NULL) { - resource = xmlnode_new_child(bind, "resource"); - xmlnode_insert_data(resource, requested_resource, -1); - g_free(requested_resource); - } - - jabber_iq_set_callback(iq, jabber_bind_result_cb, NULL); - - jabber_iq_send(iq); - } else if (xmlnode_get_child_with_namespace(packet, "ver", NS_ROSTER_VERSIONING)) { - js->server_caps |= JABBER_CAP_ROSTER_VERSIONING; - } else /* if(xmlnode_get_child_with_namespace(packet, "auth")) */ { - /* If we get an empty stream:features packet, or we explicitly get - * an auth feature with namespace http://jabber.org/features/iq-auth - * we should revert back to iq:auth authentication, even though we're - * connecting to an XMPP server. */ - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - jabber_auth_start_old(js); - } -} - -static void jabber_stream_handle_error(JabberStream *js, xmlnode *packet) -{ - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - char *msg = jabber_parse_error(js, packet, &reason); - - purple_connection_error_reason(js->gc, reason, msg); - - g_free(msg); -} - -static void tls_init(JabberStream *js); - -void jabber_process_packet(JabberStream *js, xmlnode **packet) -{ - const char *xmlns; - - purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-receiving-xmlnode", js->gc, packet); - - /* if the signal leaves us with a null packet, we're done */ - if(NULL == *packet) - return; - - xmlns = xmlnode_get_namespace(*packet); - - if(!strcmp((*packet)->name, "iq")) { - jabber_iq_parse(js, *packet); - } else if(!strcmp((*packet)->name, "presence")) { - jabber_presence_parse(js, *packet); - } else if(!strcmp((*packet)->name, "message")) { - jabber_message_parse(js, *packet); - } else if(!strcmp((*packet)->name, "stream:features")) { - jabber_stream_features_parse(js, *packet); - } else if (!strcmp((*packet)->name, "features") && xmlns && - !strcmp(xmlns, NS_XMPP_STREAMS)) { - jabber_stream_features_parse(js, *packet); - } else if(!strcmp((*packet)->name, "stream:error") || - (!strcmp((*packet)->name, "error") && xmlns && - !strcmp(xmlns, NS_XMPP_STREAMS))) - { - jabber_stream_handle_error(js, *packet); - } else if(!strcmp((*packet)->name, "challenge")) { - if(js->state == JABBER_STREAM_AUTHENTICATING) - jabber_auth_handle_challenge(js, *packet); - } else if(!strcmp((*packet)->name, "success")) { - if(js->state == JABBER_STREAM_AUTHENTICATING) - jabber_auth_handle_success(js, *packet); - } else if(!strcmp((*packet)->name, "failure")) { - if(js->state == JABBER_STREAM_AUTHENTICATING) - jabber_auth_handle_failure(js, *packet); - } else if(!strcmp((*packet)->name, "proceed")) { - if (js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION && !js->gsc) - tls_init(js); - else - purple_debug_warning("jabber", "Ignoring spurious <proceed/>\n"); - } else { - purple_debug_warning("jabber", "Unknown packet: %s\n", (*packet)->name); - } -} - -static int jabber_do_send(JabberStream *js, const char *data, int len) -{ - int ret; - - if (js->gsc) - ret = purple_ssl_write(js->gsc, data, len); - else - ret = write(js->fd, data, len); - - return ret; -} - -static void jabber_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - JabberStream *js = data; - int ret, writelen; - writelen = purple_circ_buffer_get_max_read(js->write_buffer); - - if (writelen == 0) { - purple_input_remove(js->writeh); - js->writeh = 0; - return; - } - - ret = jabber_do_send(js, js->write_buffer->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(js->write_buffer, ret); -} - -static gboolean do_jabber_send_raw(JabberStream *js, const char *data, int len) -{ - int ret; - gboolean success = TRUE; - - if (len == -1) - len = strlen(data); - - if (js->writeh == 0) - ret = jabber_do_send(js, data, len); - else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno != EAGAIN) { - PurpleAccount *account = purple_connection_get_account(js->gc); - /* - * The server may have closed the socket (on a stream error), so if - * we're disconnecting, don't generate (possibly another) error that - * (for some UIs) would mask the first. - */ - if (!account->disconnecting) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } - - success = FALSE; - } else if (ret < len) { - if (ret < 0) - ret = 0; - if (js->writeh == 0) - js->writeh = purple_input_add( - js->gsc ? js->gsc->fd : js->fd, - PURPLE_INPUT_WRITE, jabber_send_cb, js); - purple_circ_buffer_append(js->write_buffer, - data + ret, len - ret); - } - - return success; -} - -void jabber_send_raw(JabberStream *js, const char *data, int len) -{ - /* because printing a tab to debug every minute gets old */ - if(strcmp(data, "\t")) { - const char *username; - char *text = NULL, *last_part = NULL, *tag_start = NULL; - - /* Because debug logs with plaintext passwords make me sad */ - if(js->state != JABBER_STREAM_CONNECTED && - /* Either <auth> or <query><password>... */ - (((tag_start = strstr(data, "<auth ")) && - strstr(data, "xmlns='" NS_XMPP_SASL "'")) || - ((tag_start = strstr(data, "<query ")) && - strstr(data, "xmlns='jabber:iq:auth'>") && - (tag_start = strstr(tag_start, "<password>"))))) { - char *data_start, *tag_end = strchr(tag_start, '>'); - text = g_strdup(data); - - /* Better to print out some wacky debugging than crash - * due to a plugin sending bad xml */ - if (tag_end == NULL) - tag_end = tag_start; - - data_start = text + (tag_end - data) + 1; - - last_part = strchr(data_start, '<'); - *data_start = '\0'; - } - - username = purple_connection_get_display_name(js->gc); - if (!username) - username = purple_account_get_username(purple_connection_get_account(js->gc)); - - purple_debug_misc("jabber", "Sending%s (%s): %s%s%s\n", - jabber_stream_is_ssl(js) ? " (ssl)" : "", username, - text ? text : data, - last_part ? "password removed" : "", - last_part ? last_part : ""); - - g_free(text); - } - - purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-sending-text", js->gc, &data); - if (data == NULL) - return; - - /* If we've got a security layer, we need to encode the data, - * splitting it on the maximum buffer length negotiated */ -#ifdef HAVE_CYRUS_SASL - if (js->sasl_maxbuf>0) { - int pos = 0; - - if (!js->gsc && js->fd<0) - return; - - if (len == -1) - len = strlen(data); - - while (pos < len) { - int towrite; - const char *out; - unsigned olen; - - towrite = MIN((len - pos), js->sasl_maxbuf); - - sasl_encode(js->sasl, &data[pos], towrite, &out, &olen); - pos += towrite; - - if (!do_jabber_send_raw(js, out, olen)) - break; - } - return; - } -#endif - - if (len == -1) - len = strlen(data); - - if (js->bosh) - jabber_bosh_connection_send_raw(js->bosh, data); - else - do_jabber_send_raw(js, data, len); -} - -int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - JabberStream *js = (JabberStream*)gc->proto_data; - jabber_send_raw(js, buf, len); - return len; -} - -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, - gpointer unused) -{ - JabberStream *js; - char *txt; - int len; - - if (NULL == packet) - return; - - if (!PURPLE_CONNECTION_IS_VALID(pc)) - return; - - js = purple_connection_get_protocol_data(pc); - - if (NULL == js) - return; - - if (js->bosh) - if (g_str_equal((*packet)->name, "message") || - g_str_equal((*packet)->name, "iq") || - g_str_equal((*packet)->name, "presence")) - xmlnode_set_namespace(*packet, NS_XMPP_CLIENT); - txt = xmlnode_to_str(*packet, &len); - jabber_send_raw(js, txt, len); - g_free(txt); -} - -void jabber_send(JabberStream *js, xmlnode *packet) -{ - purple_signal_emit(purple_connection_get_prpl(js->gc), "jabber-sending-xmlnode", js->gc, &packet); -} - -static gboolean jabber_keepalive_timeout(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Ping timed out")); - js->keepalive_timeout = 0; - return FALSE; -} - -void jabber_keepalive(PurpleConnection *gc) -{ - JabberStream *js = gc->proto_data; - - if (js->keepalive_timeout == 0) { - jabber_keepalive_ping(js); - js->keepalive_timeout = purple_timeout_add_seconds(120, - (GSourceFunc)(jabber_keepalive_timeout), gc); - } -} - -static void -jabber_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; - int len; - static char buf[4096]; - - /* TODO: It should be possible to make this check unnecessary */ - if(!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_ssl_close(gsc); - return; - } - - while((len = purple_ssl_read(gsc, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); - buf[len] = '\0'; - purple_debug_info("jabber", "Recv (ssl)(%d): %s\n", len, buf); - jabber_parser_process(js, buf, len); - if(js->reinit) - jabber_stream_init(js); - } - - if(len < 0 && errno == EAGAIN) - return; - else { - gchar *tmp; - if (len == 0) - tmp = g_strdup_printf(_("Server closed the connection")); - else - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } -} - -static void -jabber_recv_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleConnection *gc = data; - JabberStream *js = gc->proto_data; - int len; - static char buf[4096]; - - if(!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - if((len = read(js->fd, buf, sizeof(buf) - 1)) > 0) { - gc->last_received = time(NULL); -#ifdef HAVE_CYRUS_SASL - if (js->sasl_maxbuf>0) { - const char *out; - unsigned int olen; - sasl_decode(js->sasl, buf, len, &out, &olen); - if (olen>0) { - purple_debug_info("jabber", "RecvSASL (%u): %s\n", olen, out); - jabber_parser_process(js,out,olen); - if(js->reinit) - jabber_stream_init(js); - } - return; - } -#endif - buf[len] = '\0'; - purple_debug_info("jabber", "Recv (%d): %s\n", len, buf); - jabber_parser_process(js, buf, len); - if(js->reinit) - jabber_stream_init(js); - } else if(len < 0 && errno == EAGAIN) { - return; - } else { - gchar *tmp; - if (len == 0) - tmp = g_strdup_printf(_("Server closed the connection")); - else - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - } -} - -static void -jabber_login_callback_ssl(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - JabberStream *js; - - /* TODO: It should be possible to make this check unnecessary */ - if(!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_ssl_close(gsc); - return; - } - - js = gc->proto_data; - - if(js->state == JABBER_STREAM_CONNECTING) - jabber_send_raw(js, "<?xml version='1.0' ?>", -1); - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); - purple_ssl_input_add(gsc, jabber_recv_cb_ssl, gc); - - /* Tell the app that we're doing encryption */ - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING_ENCRYPTION); -} - -static void -txt_resolved_cb(GList *responses, gpointer data) -{ - JabberStream *js = data; - - js->srv_query_data = NULL; - - if (responses == NULL) { - purple_debug_warning("jabber", "Unable to find alternative XMPP connection " - "methods after failing to connect directly.\n"); - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - - while (responses) { - PurpleTxtResponse *resp = responses->data; - gchar **token; - token = g_strsplit(purple_txt_response_get_content(resp), "=", 2); - if (!strcmp(token[0], "_xmpp-client-xbosh")) { - purple_debug_info("jabber","Found alternative connection method using %s at %s.\n", token[0], token[1]); - js->bosh = jabber_bosh_connection_init(js, token[1]); - g_strfreev(token); - break; - } - g_strfreev(token); - purple_txt_response_destroy(resp); - responses = g_list_delete_link(responses, responses); - } - - if (js->bosh) { - jabber_bosh_connection_connect(js->bosh); - } else { - purple_debug_info("jabber","Didn't find an alternative connection method.\n"); - } - - if (responses) { - g_list_foreach(responses, (GFunc)purple_txt_response_destroy, NULL); - g_list_free(responses); - } -} - -static void -jabber_login_callback(gpointer data, gint source, const gchar *error) -{ - PurpleConnection *gc = data; - JabberStream *js = purple_connection_get_protocol_data(gc); - - if (source < 0) { - if (js->srv_rec != NULL) { - purple_debug_error("jabber", "Unable to connect to server: %s. Trying next SRV record or connecting directly.\n", error); - try_srv_connect(js); - } else { - purple_debug_info("jabber","Couldn't connect directly to %s. Trying to find alternative connection methods, like BOSH.\n", js->user->domain); - js->srv_query_data = purple_txt_resolve("_xmppconnect", - js->user->domain, txt_resolved_cb, js); - } - return; - } - - g_free(js->srv_rec); - js->srv_rec = NULL; - - js->fd = source; - - if(js->state == JABBER_STREAM_CONNECTING) - jabber_send_raw(js, "<?xml version='1.0' ?>", -1); - - jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); - gc->inpa = purple_input_add(js->fd, PURPLE_INPUT_READ, jabber_recv_cb, gc); -} - -static void -jabber_ssl_connect_failure(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - PurpleConnection *gc = data; - JabberStream *js; - - /* If the connection is already disconnected, we don't need to do anything else */ - if(!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - js = gc->proto_data; - js->gsc = NULL; - - purple_connection_ssl_error (gc, error); -} - -static void tls_init(JabberStream *js) -{ - purple_input_remove(js->gc->inpa); - js->gc->inpa = 0; - js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, - jabber_login_callback_ssl, jabber_ssl_connect_failure, js->certificate_CN, js->gc); - /* The fd is no longer our concern */ - js->fd = -1; -} - -static gboolean jabber_login_connect(JabberStream *js, const char *domain, const char *host, int port, - gboolean fatal_failure) -{ - /* host should be used in preference to domain to - * allow SASL authentication to work with FQDN of the server, - * but we use domain as fallback for when users enter IP address - * in connect server */ - g_free(js->serverFQDN); - if (purple_ip_address_is_valid(host)) - js->serverFQDN = g_strdup(domain); - else - js->serverFQDN = g_strdup(host); - - if (purple_proxy_connect(js->gc, purple_connection_get_account(js->gc), - host, port, jabber_login_callback, js->gc) == NULL) { - if (fatal_failure) { - purple_connection_error_reason(js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } - - return FALSE; - } - - return TRUE; -} - -static void try_srv_connect(JabberStream *js) -{ - while (js->srv_rec != NULL && js->srv_rec_idx < js->max_srv_rec_idx) { - PurpleSrvResponse *tmp_resp = js->srv_rec + (js->srv_rec_idx++); - if (jabber_login_connect(js, tmp_resp->hostname, tmp_resp->hostname, tmp_resp->port, FALSE)) - return; - } - - g_free(js->srv_rec); - js->srv_rec = NULL; - - /* Fall back to the defaults (I'm not sure if we should actually do this) */ - jabber_login_connect(js, js->user->domain, js->user->domain, - purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), - TRUE); -} - -static void srv_resolved_cb(PurpleSrvResponse *resp, int results, gpointer data) -{ - JabberStream *js = data; - js->srv_query_data = NULL; - - if(results) { - js->srv_rec = resp; - js->srv_rec_idx = 0; - js->max_srv_rec_idx = results; - try_srv_connect(js); - } else { - jabber_login_connect(js, js->user->domain, js->user->domain, - purple_account_get_int(purple_connection_get_account(js->gc), "port", 5222), - TRUE); - } -} - -static JabberStream * -jabber_stream_new(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - PurplePresence *presence; - gchar *user; - gchar *slash; - - js = gc->proto_data = g_new0(JabberStream, 1); - js->gc = gc; - js->fd = -1; - - user = g_strdup(purple_account_get_username(account)); - /* jabber_id_new doesn't accept "user@domain/" as valid */ - slash = strchr(user, '/'); - if (slash && *(slash + 1) == '\0') - *slash = '\0'; - js->user = jabber_id_new(user); - - if (!js->user) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Invalid XMPP ID")); - /* Destroying the connection will free the JabberStream */ - return NULL; - } - - if (!js->user->domain || *(js->user->domain) == '\0') { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Invalid XMPP ID. Domain must be set.")); - /* Destroying the connection will free the JabberStream */ - return NULL; - } - - js->buddies = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, (GDestroyNotify)jabber_buddy_free); - - js->user_jb = jabber_buddy_find(js, user, TRUE); - g_free(user); - if (!js->user_jb) { - /* This basically *can't* fail, but for good measure... */ - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Invalid XMPP ID")); - /* Destroying the connection will free the JabberStream */ - g_return_val_if_reached(NULL); - } - - js->user_jb->subscription |= JABBER_SUB_BOTH; - - js->iq_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - js->chats = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, (GDestroyNotify)jabber_chat_free); - js->next_id = g_random_int(); - js->write_buffer = purple_circ_buffer_new(512); - js->old_length = 0; - js->keepalive_timeout = 0; - /* Set the default protocol version to 1.0. Overridden in parser.c. */ - js->protocol_version = JABBER_PROTO_1_0; - js->sessions = NULL; - js->stun_ip = NULL; - js->stun_port = 0; - js->stun_query = NULL; - - /* if we are idle, set idle-ness on the stream (this could happen if we get - disconnected and the reconnects while being idle. I don't think it makes - sense to do this when registering a new account... */ - presence = purple_account_get_presence(account); - if (purple_presence_is_idle(presence)) - js->idle = purple_presence_get_idle_time(presence); - - return js; -} - -static void -jabber_stream_connect(JabberStream *js) -{ - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - const char *connect_server = purple_account_get_string(account, - "connect_server", ""); - const char *bosh_url = purple_account_get_string(account, - "bosh_url", ""); - - jabber_stream_set_state(js, JABBER_STREAM_CONNECTING); - - /* If both BOSH and a Connect Server are specified, we prefer BOSH. I'm not - * attached to that choice, though. - */ - if (*bosh_url) { - js->bosh = jabber_bosh_connection_init(js, bosh_url); - if (js->bosh) - jabber_bosh_connection_connect(js->bosh); - else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Malformed BOSH URL")); - } - - return; - } - - js->certificate_CN = g_strdup(connect_server[0] ? connect_server : js->user->domain); - - /* if they've got old-ssl mode going, we probably want to ignore SRV lookups */ - if(purple_account_get_bool(account, "old_ssl", FALSE)) { - if(purple_ssl_is_supported()) { - js->gsc = purple_ssl_connect(account, js->certificate_CN, - purple_account_get_int(account, "port", 5223), - jabber_login_callback_ssl, jabber_ssl_connect_failure, gc); - if (!js->gsc) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("Unable to establish SSL connection")); - } - } else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - } - - return; - } - - /* no old-ssl, so if they've specified a connect server, we'll use that, otherwise we'll - * invoke the magic of SRV lookups, to figure out host and port */ - if(connect_server[0]) { - jabber_login_connect(js, js->user->domain, connect_server, - purple_account_get_int(account, "port", 5222), TRUE); - } else { - js->srv_query_data = purple_srv_resolve("xmpp-client", - "tcp", js->user->domain, srv_resolved_cb, js); - } -} - -void -jabber_login(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - PurpleStoredImage *image; - - gc->flags |= PURPLE_CONNECTION_HTML | - PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; - js = jabber_stream_new(account); - if (js == NULL) - return; - - /* TODO: Remove this at some point. Added 2010-02-14 (v2.6.6) */ - if (g_str_equal("proxy.jabber.org", purple_account_get_string(account, "ft_proxies", ""))) - purple_account_set_string(account, "ft_proxies", JABBER_DEFAULT_FT_PROXIES); - - /* - * Calculate the avatar hash for our current image so we know (when we - * fetch our vCard and PEP avatar) if we should send our avatar to the - * server. - */ - image = purple_buddy_icons_find_account_icon(account); - if (image != NULL) { - js->initial_avatar_hash = - jabber_calculate_data_sha1sum(purple_imgstore_get_data(image), - purple_imgstore_get_size(image)); - purple_imgstore_unref(image); - } - - jabber_stream_connect(js); -} - - -static gboolean -conn_close_cb(gpointer data) -{ - JabberStream *js = data; - PurpleAccount *account = purple_connection_get_account(js->gc); - - jabber_parser_free(js); - - purple_account_disconnect(account); - - return FALSE; -} - -static void -jabber_connection_schedule_close(JabberStream *js) -{ - purple_timeout_add(0, conn_close_cb, js); -} - -static void -jabber_registration_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - char *buf; - char *to = data; - - if (type == JABBER_IQ_RESULT) { - if(js->registration) { - buf = g_strdup_printf(_("Registration of %s@%s successful"), - js->user->node, js->user->domain); - if(account->registration_cb) - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - } else { - g_return_if_fail(to != NULL); - buf = g_strdup_printf(_("Registration to %s successful"), - to); - } - purple_notify_info(NULL, _("Registration Successful"), - _("Registration Successful"), buf); - g_free(buf); - } else { - char *msg = jabber_parse_error(js, packet, NULL); - - if(!msg) - msg = g_strdup(_("Unknown Error")); - - purple_notify_error(NULL, _("Registration Failed"), - _("Registration Failed"), msg); - g_free(msg); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - } - g_free(to); - if(js->registration) - jabber_connection_schedule_close(js); -} - -static void -jabber_unregistration_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - char *buf; - char *to = data; - - /* This function is never called for unregistering our XMPP account from - * the server, so there should always be a 'to' address. */ - g_return_if_fail(to != NULL); - - if (type == JABBER_IQ_RESULT) { - buf = g_strdup_printf(_("Registration from %s successfully removed"), - to); - purple_notify_info(NULL, _("Unregistration Successful"), - _("Unregistration Successful"), buf); - g_free(buf); - } else { - char *msg = jabber_parse_error(js, packet, NULL); - - if(!msg) - msg = g_strdup(_("Unknown Error")); - - purple_notify_error(NULL, _("Unregistration Failed"), - _("Unregistration Failed"), msg); - g_free(msg); - } - g_free(to); -} - -typedef struct _JabberRegisterCBData { - JabberStream *js; - char *who; -} JabberRegisterCBData; - -static void -jabber_register_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) -{ - GList *groups, *flds; - xmlnode *query, *y; - JabberIq *iq; - char *username; - - iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); - if (cbdata->who) - xmlnode_set_attrib(iq->node, "to", cbdata->who); - - for(groups = purple_request_fields_get_groups(fields); groups; - groups = groups->next) { - for(flds = purple_request_field_group_get_fields(groups->data); - flds; flds = flds->next) { - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - if(!strcmp(id,"unregister")) { - gboolean value = purple_request_field_bool_get_value(field); - if(value) { - /* unregister from service. this doesn't include any of the fields, so remove them from the stanza by recreating it - (there's no "remove child" function for xmlnode) */ - jabber_iq_free(iq); - iq = jabber_iq_new_query(cbdata->js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); - if (cbdata->who) - xmlnode_set_attrib(iq->node,"to",cbdata->who); - xmlnode_new_child(query, "remove"); - - jabber_iq_set_callback(iq, jabber_unregistration_result_cb, cbdata->who); - - jabber_iq_send(iq); - g_free(cbdata); - return; - } - } else { - const char *ids[] = {"username", "password", "name", "email", "nick", "first", - "last", "address", "city", "state", "zip", "phone", "url", "date", - NULL}; - const char *value = purple_request_field_string_get_value(field); - int i; - for (i = 0; ids[i]; i++) { - if (!strcmp(id, ids[i])) - break; - } - - if (!ids[i]) - continue; - y = xmlnode_new_child(query, ids[i]); - xmlnode_insert_data(y, value, -1); - if(cbdata->js->registration && !strcmp(id, "username")) { - g_free(cbdata->js->user->node); - cbdata->js->user->node = g_strdup(value); - } - if(cbdata->js->registration && !strcmp(id, "password")) - purple_account_set_password(cbdata->js->gc->account, value); - } - } - } - - if(cbdata->js->registration) { - username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, - cbdata->js->user->resource ? "/" : "", - cbdata->js->user->resource ? cbdata->js->user->resource : ""); - purple_account_set_username(cbdata->js->gc->account, username); - g_free(username); - } - - jabber_iq_set_callback(iq, jabber_registration_result_cb, cbdata->who); - - jabber_iq_send(iq); - g_free(cbdata); -} - -static void -jabber_register_cancel_cb(JabberRegisterCBData *cbdata, PurpleRequestFields *fields) -{ - PurpleAccount *account = purple_connection_get_account(cbdata->js->gc); - if(account && cbdata->js->registration) { - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - jabber_connection_schedule_close(cbdata->js); - } - g_free(cbdata->who); - g_free(cbdata); -} - -static void jabber_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) -{ - xmlnode *query; - JabberIq *iq; - char *to = data; - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - query = xmlnode_get_child(iq->node, "query"); - if (to) - xmlnode_set_attrib(iq->node,"to",to); - - xmlnode_insert_child(query, result); - - jabber_iq_set_callback(iq, jabber_registration_result_cb, to); - jabber_iq_send(iq); -} - -static const struct { - const char *name; - const char *label; -} registration_fields[] = { - { "email", N_("Email") }, - { "nick", N_("Nickname") }, - { "first", N_("First name") }, - { "last", N_("Last name") }, - { "address", N_("Address") }, - { "city", N_("City") }, - { "state", N_("State") }, - { "zip", N_("Postal code") }, - { "phone", N_("Phone") }, - { "url", N_("URL") }, - { "date", N_("Date") }, - { NULL, NULL } -}; - -void jabber_register_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *query) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - xmlnode *x, *y, *node; - char *instructions; - JabberRegisterCBData *cbdata; - gboolean registered = FALSE; - int i; - - if (type != JABBER_IQ_RESULT) - return; - - if(js->registration) { - /* get rid of the login thingy */ - purple_connection_set_state(js->gc, PURPLE_CONNECTED); - } - - if(xmlnode_get_child(query, "registered")) { - registered = TRUE; - - if(js->registration) { - purple_notify_error(NULL, _("Already Registered"), - _("Already Registered"), NULL); - if(account->registration_cb) - (account->registration_cb)(account, FALSE, account->registration_cb_user_data); - jabber_connection_schedule_close(js); - return; - } - } - - if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { - jabber_x_data_request(js, x, jabber_register_x_data_cb, g_strdup(from)); - return; - - } else if((x = xmlnode_get_child_with_namespace(query, "x", NS_OOB_X_DATA))) { - xmlnode *url; - - if((url = xmlnode_get_child(x, "url"))) { - char *href; - if((href = xmlnode_get_data(url))) { - purple_notify_uri(NULL, href); - g_free(href); - - if(js->registration) { - js->gc->wants_to_die = TRUE; - if(account->registration_cb) /* succeeded, but we have no login info */ - (account->registration_cb)(account, TRUE, account->registration_cb_user_data); - jabber_connection_schedule_close(js); - } - return; - } - } - } - - /* as a last resort, use the old jabber:iq:register syntax */ - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - if((node = xmlnode_get_child(query, "username"))) { - char *data = xmlnode_get_data(node); - if(js->registration) - field = purple_request_field_string_new("username", _("Username"), data ? data : js->user->node, FALSE); - else - field = purple_request_field_string_new("username", _("Username"), data, FALSE); - - purple_request_field_group_add_field(group, field); - g_free(data); - } - if((node = xmlnode_get_child(query, "password"))) { - if(js->registration) - field = purple_request_field_string_new("password", _("Password"), - purple_connection_get_password(js->gc), FALSE); - else { - char *data = xmlnode_get_data(node); - field = purple_request_field_string_new("password", _("Password"), data, FALSE); - g_free(data); - } - - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - } - - if((node = xmlnode_get_child(query, "name"))) { - if(js->registration) - field = purple_request_field_string_new("name", _("Name"), - purple_account_get_alias(js->gc->account), FALSE); - else { - char *data = xmlnode_get_data(node); - field = purple_request_field_string_new("name", _("Name"), data, FALSE); - g_free(data); - } - purple_request_field_group_add_field(group, field); - } - - for (i = 0; registration_fields[i].name != NULL; ++i) { - if ((node = xmlnode_get_child(query, registration_fields[i].name))) { - char *data = xmlnode_get_data(node); - field = purple_request_field_string_new(registration_fields[i].name, - _(registration_fields[i].label), - data, FALSE); - purple_request_field_group_add_field(group, field); - g_free(data); - } - } - - if(registered) { - field = purple_request_field_bool_new("unregister", _("Unregister"), FALSE); - purple_request_field_group_add_field(group, field); - } - - if((y = xmlnode_get_child(query, "instructions"))) - instructions = xmlnode_get_data(y); - else if(registered) - instructions = g_strdup(_("Please fill out the information below " - "to change your account registration.")); - else - instructions = g_strdup(_("Please fill out the information below " - "to register your new account.")); - - cbdata = g_new0(JabberRegisterCBData, 1); - cbdata->js = js; - cbdata->who = g_strdup(from); - - if(js->registration) - purple_request_fields(js->gc, _("Register New XMPP Account"), - _("Register New XMPP Account"), instructions, fields, - _("Register"), G_CALLBACK(jabber_register_cb), - _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), - purple_connection_get_account(js->gc), NULL, NULL, - cbdata); - else { - char *title; - g_return_if_fail(from != NULL); - title = registered ? g_strdup_printf(_("Change Account Registration at %s"), from) - :g_strdup_printf(_("Register New Account at %s"), from); - purple_request_fields(js->gc, title, - title, instructions, fields, - (registered ? _("Change Registration") : _("Register")), G_CALLBACK(jabber_register_cb), - _("Cancel"), G_CALLBACK(jabber_register_cancel_cb), - purple_connection_get_account(js->gc), NULL, NULL, - cbdata); - g_free(title); - } - - g_free(instructions); -} - -void jabber_register_start(JabberStream *js) -{ - JabberIq *iq; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); - jabber_iq_send(iq); -} - -void jabber_register_gateway(JabberStream *js, const char *gateway) { - JabberIq *iq; - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:register"); - xmlnode_set_attrib(iq->node, "to", gateway); - jabber_iq_send(iq); -} - -void jabber_register_account(PurpleAccount *account) -{ - JabberStream *js; - - js = jabber_stream_new(account); - if (js == NULL) - return; - - js->registration = TRUE; - jabber_stream_connect(js); -} - -static void -jabber_unregister_account_iq_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleAccount *account = purple_connection_get_account(js->gc); - - if (type == JABBER_IQ_ERROR) { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Error unregistering account"), - _("Error unregistering account"), msg); - g_free(msg); - if(js->unregistration_cb) - js->unregistration_cb(account, FALSE, js->unregistration_user_data); - } else { - purple_notify_info(js->gc, _("Account successfully unregistered"), - _("Account successfully unregistered"), NULL); - if(js->unregistration_cb) - js->unregistration_cb(account, TRUE, js->unregistration_user_data); - } -} - -static void jabber_unregister_account_cb(JabberStream *js) { - JabberIq *iq; - xmlnode *query; - - g_return_if_fail(js->unregistration); - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - - query = xmlnode_get_child_with_namespace(iq->node, "query", "jabber:iq:register"); - - xmlnode_new_child(query, "remove"); - xmlnode_set_attrib(iq->node, "to", js->user->domain); - - jabber_iq_set_callback(iq, jabber_unregister_account_iq_cb, NULL); - jabber_iq_send(iq); -} - -void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data) { - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - - if(gc->state != PURPLE_CONNECTED) { - if(gc->state != PURPLE_CONNECTING) - jabber_login(account); - js = gc->proto_data; - js->unregistration = TRUE; - js->unregistration_cb = cb; - js->unregistration_user_data = user_data; - return; - } - - js = gc->proto_data; - - if (js->unregistration) { - purple_debug_error("jabber", "Unregistration in process; ignoring duplicate request.\n"); - return; - } - - js->unregistration = TRUE; - js->unregistration_cb = cb; - js->unregistration_user_data = user_data; - - jabber_unregister_account_cb(js); -} - -/* TODO: As Will pointed out in IRC, after being notified by the core to - * shutdown, we should async. wait for the server to send us the stream - * termination before destorying everything. That seems like it would require - * changing the semantics of prpl->close(), so it's a good idea for 3.0.0. - */ -void jabber_close(PurpleConnection *gc) -{ - JabberStream *js = purple_connection_get_protocol_data(gc); - - /* Close all of the open Jingle sessions on this stream */ - jingle_terminate_sessions(js); - - if (js->bosh) - jabber_bosh_connection_close(js->bosh); - else if ((js->gsc && js->gsc->fd > 0) || js->fd > 0) - jabber_send_raw(js, "</stream:stream>", -1); - - if (js->srv_query_data) - purple_srv_cancel(js->srv_query_data); - - if(js->gsc) { - purple_ssl_close(js->gsc); - } else if (js->fd > 0) { - if(js->gc->inpa) - purple_input_remove(js->gc->inpa); - close(js->fd); - } - - if (js->bosh) - jabber_bosh_connection_destroy(js->bosh); - - jabber_buddy_remove_all_pending_buddy_info_requests(js); - - jabber_parser_free(js); - - if(js->iq_callbacks) - g_hash_table_destroy(js->iq_callbacks); - if(js->buddies) - g_hash_table_destroy(js->buddies); - if(js->chats) - g_hash_table_destroy(js->chats); - - while(js->chat_servers) { - g_free(js->chat_servers->data); - js->chat_servers = g_list_delete_link(js->chat_servers, js->chat_servers); - } - - while(js->user_directories) { - g_free(js->user_directories->data); - js->user_directories = g_list_delete_link(js->user_directories, js->user_directories); - } - - while(js->bs_proxies) { - JabberBytestreamsStreamhost *sh = js->bs_proxies->data; - g_free(sh->jid); - g_free(sh->host); - g_free(sh->zeroconf); - g_free(sh); - js->bs_proxies = g_list_delete_link(js->bs_proxies, js->bs_proxies); - } - - while(js->url_datas) { - purple_util_fetch_url_cancel(js->url_datas->data); - js->url_datas = g_slist_delete_link(js->url_datas, js->url_datas); - } - - g_free(js->stream_id); - if(js->user) - jabber_id_free(js->user); - g_free(js->initial_avatar_hash); - g_free(js->avatar_hash); - g_free(js->caps_hash); - - purple_circ_buffer_destroy(js->write_buffer); - if(js->writeh) - purple_input_remove(js->writeh); - if (js->auth_mech && js->auth_mech->dispose) - js->auth_mech->dispose(js); -#ifdef HAVE_CYRUS_SASL - if(js->sasl) - sasl_dispose(&js->sasl); - if(js->sasl_mechs) - g_string_free(js->sasl_mechs, TRUE); - g_free(js->sasl_cb); -#endif - g_free(js->serverFQDN); - while(js->commands) { - JabberAdHocCommands *cmd = js->commands->data; - g_free(cmd->jid); - g_free(cmd->node); - g_free(cmd->name); - g_free(cmd); - js->commands = g_list_delete_link(js->commands, js->commands); - } - g_free(js->server_name); - g_free(js->certificate_CN); - g_free(js->gmail_last_time); - g_free(js->gmail_last_tid); - g_free(js->old_msg); - g_free(js->old_avatarhash); - g_free(js->old_artist); - g_free(js->old_title); - g_free(js->old_source); - g_free(js->old_uri); - g_free(js->old_track); - g_free(js->expected_rspauth); - - if (js->vcard_timer != 0) - purple_timeout_remove(js->vcard_timer); - - if (js->keepalive_timeout != 0) - purple_timeout_remove(js->keepalive_timeout); - - g_free(js->srv_rec); - js->srv_rec = NULL; - - g_free(js->stun_ip); - js->stun_ip = NULL; - - /* cancel DNS query for STUN, if one is ongoing */ - if (js->stun_query) { - purple_dnsquery_destroy(js->stun_query); - js->stun_query = NULL; - } - - g_free(js); - - gc->proto_data = NULL; -} - -void jabber_stream_set_state(JabberStream *js, JabberStreamState state) -{ -#define JABBER_CONNECT_STEPS ((js->gsc || js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION) ? 9 : 5) - - js->state = state; - switch(state) { - case JABBER_STREAM_OFFLINE: - break; - case JABBER_STREAM_CONNECTING: - purple_connection_update_progress(js->gc, _("Connecting"), 1, - JABBER_CONNECT_STEPS); - break; - case JABBER_STREAM_INITIALIZING: - purple_connection_update_progress(js->gc, _("Initializing Stream"), - js->gsc ? 5 : 2, JABBER_CONNECT_STEPS); - jabber_stream_init(js); - break; - case JABBER_STREAM_INITIALIZING_ENCRYPTION: - purple_connection_update_progress(js->gc, _("Initializing SSL/TLS"), - 6, JABBER_CONNECT_STEPS); - break; - case JABBER_STREAM_AUTHENTICATING: - purple_connection_update_progress(js->gc, _("Authenticating"), - js->gsc ? 7 : 3, JABBER_CONNECT_STEPS); - break; - case JABBER_STREAM_POST_AUTH: - purple_connection_update_progress(js->gc, _("Re-initializing Stream"), - (js->gsc ? 8 : 4), JABBER_CONNECT_STEPS); - - break; - case JABBER_STREAM_CONNECTED: - /* Send initial presence */ - jabber_presence_send(js, TRUE); - purple_connection_set_state(js->gc, PURPLE_CONNECTED); - break; - } - -#undef JABBER_CONNECT_STEPS -} - -char *jabber_get_next_id(JabberStream *js) -{ - return g_strdup_printf("purple%x", js->next_id++); -} - - -void jabber_idle_set(PurpleConnection *gc, int idle) -{ - JabberStream *js = gc->proto_data; - - js->idle = idle ? time(NULL) - idle : idle; - - /* send out an updated prescence */ - purple_debug_info("jabber", "sending updated presence for idle\n"); - jabber_presence_send(js, FALSE); -} - -void jabber_blocklist_parse_push(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child) -{ - JabberIq *result; - xmlnode *item; - PurpleAccount *account; - gboolean is_block; - - if (!jabber_is_own_account(js, from)) { - xmlnode *error, *x; - result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(result->node, "id", id); - if (from) - xmlnode_set_attrib(result->node, "to", from); - - error = xmlnode_new_child(result->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - x = xmlnode_new_child(error, "not-allowed"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(result); - return; - } - - account = purple_connection_get_account(js->gc); - is_block = g_str_equal(child->name, "block"); - - item = xmlnode_get_child(child, "item"); - if (!is_block && item == NULL) { - /* Unblock everyone */ - purple_debug_info("jabber", "Received unblock push. Unblocking everyone.\n"); - - while (account->deny != NULL) { - purple_privacy_deny_remove(account, account->deny->data, TRUE); - } - } else if (item == NULL) { - /* An empty <block/> is bogus */ - xmlnode *error, *x; - result = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(result->node, "id", id); - - error = xmlnode_new_child(result->node, "error"); - xmlnode_set_attrib(error, "type", "modify"); - x = xmlnode_new_child(error, "bad-request"); - xmlnode_set_namespace(x, NS_XMPP_STANZAS); - - jabber_iq_send(result); - return; - } else { - for ( ; item; item = xmlnode_get_next_twin(item)) { - const char *jid = xmlnode_get_attrib(item, "jid"); - if (jid == NULL || *jid == '\0') - continue; - - if (is_block) - purple_privacy_deny_add(account, jid, TRUE); - else - purple_privacy_deny_remove(account, jid, TRUE); - } - } - - result = jabber_iq_new(js, JABBER_IQ_RESULT); - xmlnode_set_attrib(result->node, "id", id); - jabber_iq_send(result); -} - -static void jabber_blocklist_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *blocklist, *item; - PurpleAccount *account; - - blocklist = xmlnode_get_child_with_namespace(packet, - "blocklist", NS_SIMPLE_BLOCKING); - account = purple_connection_get_account(js->gc); - - if (type == JABBER_IQ_ERROR || blocklist == NULL) - return; - - /* This is the only privacy method supported by XEP-0191 */ - if (account->perm_deny != PURPLE_PRIVACY_DENY_USERS) - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - - /* - * TODO: When account->deny is something more than a hash table, this can - * be re-written to find the set intersection and difference. - */ - while (account->deny) - purple_privacy_deny_remove(account, account->deny->data, TRUE); - - item = xmlnode_get_child(blocklist, "item"); - while (item != NULL) { - const char *jid = xmlnode_get_attrib(item, "jid"); - purple_privacy_deny_add(account, jid, TRUE); - item = xmlnode_get_next_twin(item); - } -} - -void jabber_request_block_list(JabberStream *js) -{ - JabberIq *iq; - xmlnode *blocklist; - - iq = jabber_iq_new(js, JABBER_IQ_GET); - - blocklist = xmlnode_new_child(iq->node, "blocklist"); - xmlnode_set_namespace(blocklist, NS_SIMPLE_BLOCKING); - - jabber_iq_set_callback(iq, jabber_blocklist_parse, NULL); - - jabber_iq_send(iq); -} - -void jabber_add_deny(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - JabberIq *iq; - xmlnode *block, *item; - - g_return_if_fail(who != NULL && *who != '\0'); - - js = purple_connection_get_protocol_data(gc); - if (js == NULL) - return; - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) - { - jabber_google_roster_add_deny(js, who); - return; - } - - if (!(js->server_caps & JABBER_CAP_BLOCKING)) - { - purple_notify_error(NULL, _("Server doesn't support blocking"), - _("Server doesn't support blocking"), NULL); - return; - } - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - block = xmlnode_new_child(iq->node, "block"); - xmlnode_set_namespace(block, NS_SIMPLE_BLOCKING); - - item = xmlnode_new_child(block, "item"); - xmlnode_set_attrib(item, "jid", who); - - jabber_iq_send(iq); -} - -void jabber_rem_deny(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - JabberIq *iq; - xmlnode *unblock, *item; - - g_return_if_fail(who != NULL && *who != '\0'); - - js = purple_connection_get_protocol_data(gc); - if (js == NULL) - return; - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) - { - jabber_google_roster_rem_deny(js, who); - return; - } - - if (!(js->server_caps & JABBER_CAP_BLOCKING)) - return; - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - unblock = xmlnode_new_child(iq->node, "unblock"); - xmlnode_set_namespace(unblock, NS_SIMPLE_BLOCKING); - - item = xmlnode_new_child(unblock, "item"); - xmlnode_set_attrib(item, "jid", who); - - jabber_iq_send(iq); -} - -void jabber_add_feature(const char *namespace, JabberFeatureEnabled cb) { - JabberFeature *feat; - - g_return_if_fail(namespace != NULL); - - feat = g_new0(JabberFeature,1); - feat->namespace = g_strdup(namespace); - feat->is_enabled = cb; - - /* try to remove just in case it already exists in the list */ - jabber_remove_feature(namespace); - - jabber_features = g_list_append(jabber_features, feat); -} - -void jabber_remove_feature(const char *namespace) { - GList *feature; - for(feature = jabber_features; feature; feature = feature->next) { - JabberFeature *feat = (JabberFeature*)feature->data; - if(!strcmp(feat->namespace, namespace)) { - g_free(feat->namespace); - g_free(feature->data); - jabber_features = g_list_delete_link(jabber_features, feature); - break; - } - } -} - -static void jabber_features_destroy(void) -{ - while (jabber_features) { - JabberFeature *feature = jabber_features->data; - g_free(feature->namespace); - g_free(feature); - jabber_features = g_list_delete_link(jabber_features, jabber_features); - } -} - -void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name) { - GList *identity; - JabberIdentity *ident; - /* both required according to XEP-0030 */ - g_return_if_fail(category != NULL); - g_return_if_fail(type != NULL); - - for(identity = jabber_identities; identity; identity = identity->next) { - JabberIdentity *ident = (JabberIdentity*)identity->data; - if (!strcmp(ident->category, category) && - !strcmp(ident->type, type) && - ((!ident->lang && !lang) || (ident->lang && lang && !strcmp(ident->lang, lang)))) { - return; - } - } - - ident = g_new0(JabberIdentity, 1); - ident->category = g_strdup(category); - ident->type = g_strdup(type); - ident->lang = g_strdup(lang); - ident->name = g_strdup(name); - jabber_identities = g_list_prepend(jabber_identities, ident); -} - -static void jabber_identities_destroy(void) -{ - while (jabber_identities) { - JabberIdentity *id = jabber_identities->data; - g_free(id->category); - g_free(id->type); - g_free(id->lang); - g_free(id->name); - g_free(id); - jabber_identities = g_list_delete_link(jabber_identities, jabber_identities); - } -} - -gboolean jabber_stream_is_ssl(JabberStream *js) -{ - return (js->bosh && jabber_bosh_connection_is_ssl(js->bosh)) || - (!js->bosh && js->gsc); -} - -const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "jabber"; -} - -const char* jabber_list_emblem(PurpleBuddy *b) -{ - JabberStream *js; - JabberBuddy *jb = NULL; - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(b)); - - if(!gc) - return NULL; - - js = gc->proto_data; - if(js) - jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE); - - if(!PURPLE_BUDDY_IS_ONLINE(b)) { - if(jb && (jb->subscription & JABBER_SUB_PENDING || - !(jb->subscription & JABBER_SUB_TO))) - return "not-authorized"; - } - - if (jb) { - JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); - if (jbr) { - const gchar *client_type = - jabber_resource_get_identity_category_type(jbr, "client"); - - if (client_type) { - if (strcmp(client_type, "phone") == 0) { - return "mobile"; - } else if (strcmp(client_type, "web") == 0) { - return "external"; - } else if (strcmp(client_type, "handheld") == 0) { - return "hiptop"; - } else if (strcmp(client_type, "bot") == 0) { - return "bot"; - } - /* the default value "pc" falls through and has no emblem */ - } - } - } - - return NULL; -} - -char *jabber_status_text(PurpleBuddy *b) -{ - char *ret = NULL; - JabberBuddy *jb = NULL; - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - - if (gc && gc->proto_data) - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); - - if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && (jb->subscription & JABBER_SUB_PENDING || !(jb->subscription & JABBER_SUB_TO))) { - ret = g_strdup(_("Not Authorized")); - } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { - ret = g_strdup(jb->error_msg); - } else { - PurplePresence *presence = purple_buddy_get_presence(b); - PurpleStatus *status = purple_presence_get_active_status(presence); - const char *message; - - if((message = purple_status_get_attr_string(status, "message"))) { - ret = g_markup_escape_text(message, -1); - } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - ret = purple_util_format_song_info(title, artist, album, NULL); - } - } - - return ret; -} - -static void -jabber_tooltip_add_resource_text(JabberBuddyResource *jbr, - PurpleNotifyUserInfo *user_info, gboolean multiple_resources) -{ - char *text = NULL; - char *res = NULL; - char *label, *value; - const char *state; - - if(jbr->status) { - text = g_markup_escape_text(jbr->status, -1); - } - - if(jbr->name) - res = g_strdup_printf(" (%s)", jbr->name); - - state = jabber_buddy_state_get_name(jbr->state); - if (text != NULL && !purple_utf8_strcasecmp(state, text)) { - g_free(text); - text = NULL; - } - - label = g_strdup_printf("%s%s", _("Status"), (res ? res : "")); - value = g_strdup_printf("%s%s%s", state, (text ? ": " : ""), (text ? text : "")); - - purple_notify_user_info_add_pair(user_info, label, value); - g_free(label); - g_free(value); - g_free(text); - - /* if the resource is idle, show that */ - /* only show it if there is more than one resource available for - the buddy, since the "general" idleness will be shown anyway, - this way we can see see the idleness of lower-priority resources */ - if (jbr->idle && multiple_resources) { - gchar *idle_str = - purple_str_seconds_to_string(time(NULL) - jbr->idle); - label = g_strdup_printf("%s%s", _("Idle"), (res ? res : "")); - purple_notify_user_info_add_pair(user_info, label, idle_str); - g_free(idle_str); - g_free(label); - } - g_free(res); -} - -void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - JabberBuddy *jb; - PurpleAccount *account; - PurpleConnection *gc; - - g_return_if_fail(b != NULL); - - account = purple_buddy_get_account(b); - g_return_if_fail(account != NULL); - - gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL); - g_return_if_fail(gc->proto_data != NULL); - - jb = jabber_buddy_find(gc->proto_data, purple_buddy_get_name(b), FALSE); - - if(jb) { - JabberBuddyResource *jbr = NULL; - PurplePresence *presence = purple_buddy_get_presence(b); - const char *sub; - GList *l; - const char *mood; - gboolean multiple_resources = - jb->resources && g_list_next(jb->resources); - JabberBuddyResource *top_jbr = jabber_buddy_find_resource(jb, NULL); - - /* resource-specific info for the top resource */ - if (top_jbr) { - jabber_tooltip_add_resource_text(top_jbr, user_info, - multiple_resources); - } - - for(l=jb->resources; l; l = l->next) { - jbr = l->data; - /* the remaining resources */ - if (jbr != top_jbr) { - jabber_tooltip_add_resource_text(jbr, user_info, - multiple_resources); - } - } - - if (full) { - PurpleStatus *status; - - status = purple_presence_get_active_status(presence); - mood = purple_status_get_attr_string(status, "mood"); - if(mood != NULL) { - const char *moodtext; - moodtext = purple_status_get_attr_string(status, "moodtext"); - if(moodtext != NULL) { - char *moodplustext = g_strdup_printf("%s (%s)", mood, moodtext); - - purple_notify_user_info_add_pair(user_info, _("Mood"), moodplustext); - g_free(moodplustext); - } else - purple_notify_user_info_add_pair(user_info, _("Mood"), mood); - } - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *tune = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - char *playing = purple_util_format_song_info(title, artist, album, NULL); - if (playing) { - purple_notify_user_info_add_pair(user_info, _("Now Listening"), playing); - g_free(playing); - } - } - - if(jb->subscription & JABBER_SUB_FROM) { - if(jb->subscription & JABBER_SUB_TO) - sub = _("Both"); - else if(jb->subscription & JABBER_SUB_PENDING) - sub = _("From (To pending)"); - else - sub = _("From"); - } else { - if(jb->subscription & JABBER_SUB_TO) - sub = _("To"); - else if(jb->subscription & JABBER_SUB_PENDING) - sub = _("None (To pending)"); - else - sub = _("None"); - } - - purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); - - } - - if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { - purple_notify_user_info_add_pair(user_info, _("Error"), jb->error_msg); - } - } -} - -GList *jabber_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - PurpleValue *priority_value; - PurpleValue *buzz_enabled; - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 1); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE), - NULL, TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 1); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT), - _("Chatty"), TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 0); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY), - NULL, TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 0); - buzz_enabled = purple_value_new(PURPLE_TYPE_BOOLEAN); - purple_value_set_boolean(buzz_enabled, TRUE); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA), - NULL, TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - "buzz", _("Allow Buzz"), buzz_enabled, - NULL); - types = g_list_append(types, type); - - priority_value = purple_value_new(PURPLE_TYPE_INT); - purple_value_set_int(priority_value, 0); - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND), - _("Do Not Disturb"), TRUE, TRUE, FALSE, - "priority", _("Priority"), priority_value, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - "mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING), - "moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING), - "nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - /* - if(js->protocol_version == JABBER_PROTO_0_9) - m = g_list_append(m, _("Invisible")); - */ - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, - jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE), - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, - "tune", NULL, FALSE, TRUE, TRUE, - PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT), - PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT), - PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - return types; -} - -static void -jabber_password_change_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) { - purple_notify_info(js->gc, _("Password Changed"), _("Password Changed"), - _("Your password has been changed.")); - - purple_account_set_password(js->gc->account, (char *)data); - } else { - char *msg = jabber_parse_error(js, packet, NULL); - - purple_notify_error(js->gc, _("Error changing password"), - _("Error changing password"), msg); - g_free(msg); - } - - g_free(data); -} - -static void jabber_password_change_cb(JabberStream *js, - PurpleRequestFields *fields) -{ - const char *p1, *p2; - JabberIq *iq; - xmlnode *query, *y; - - p1 = purple_request_fields_get_string(fields, "password1"); - p2 = purple_request_fields_get_string(fields, "password2"); - - if(strcmp(p1, p2)) { - purple_notify_error(js->gc, NULL, _("New passwords do not match."), NULL); - return; - } - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); - - xmlnode_set_attrib(iq->node, "to", js->user->domain); - - query = xmlnode_get_child(iq->node, "query"); - - y = xmlnode_new_child(query, "username"); - xmlnode_insert_data(y, js->user->node, -1); - y = xmlnode_new_child(query, "password"); - xmlnode_insert_data(y, p1, -1); - - jabber_iq_set_callback(iq, jabber_password_change_result_cb, g_strdup(p1)); - - jabber_iq_send(iq); -} - -static void jabber_password_change(PurplePluginAction *action) -{ - - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("password1", _("Password"), - "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("password2", _("Password (again)"), - "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(js->gc, _("Change XMPP Password"), - _("Change XMPP Password"), _("Please enter your new password"), - fields, _("OK"), G_CALLBACK(jabber_password_change_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - js); -} - -GList *jabber_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc = (PurpleConnection *) context; - JabberStream *js = gc->proto_data; - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set User Info..."), - jabber_setup_set_info); - m = g_list_append(m, act); - - /* if (js->protocol_options & CHANGE_PASSWORD) { */ - act = purple_plugin_action_new(_("Change Password..."), - jabber_password_change); - m = g_list_append(m, act); - /* } */ - - act = purple_plugin_action_new(_("Search for Users..."), - jabber_user_search_begin); - m = g_list_append(m, act); - - purple_debug_info("jabber", "jabber_actions: have pep: %s\n", js->pep?"YES":"NO"); - - if(js->pep) - jabber_pep_init_actions(&m); - - if(js->commands) - jabber_adhoc_init_server_commands(js, &m); - - return m; -} - -PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name) -{ - PurpleBlistNode *gnode, *cnode; - JabberID *jid; - - if(!(jid = jabber_id_new(name))) - return NULL; - - for(gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - for(cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - PurpleChat *chat = (PurpleChat*)cnode; - const char *room, *server; - GHashTable *components; - if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) - continue; - - if (purple_chat_get_account(chat) != account) - continue; - - components = purple_chat_get_components(chat); - if(!(room = g_hash_table_lookup(components, "room"))) - continue; - if(!(server = g_hash_table_lookup(components, "server"))) - continue; - - if(jid->node && jid->domain && - !g_utf8_collate(room, jid->node) && !g_utf8_collate(server, jid->domain)) { - jabber_id_free(jid); - return chat; - } - } - } - jabber_id_free(jid); - return NULL; -} - -void jabber_convo_closed(PurpleConnection *gc, const char *who) -{ - JabberStream *js = gc->proto_data; - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr; - - if(!(jid = jabber_id_new(who))) - return; - - if((jb = jabber_buddy_find(js, who, TRUE)) && - (jbr = jabber_buddy_find_resource(jb, jid->resource))) { - if(jbr->thread_id) { - g_free(jbr->thread_id); - jbr->thread_id = NULL; - } - } - - jabber_id_free(jid); -} - - -char *jabber_parse_error(JabberStream *js, - xmlnode *packet, - PurpleConnectionError *reason) -{ - xmlnode *error; - const char *code = NULL, *text = NULL; - const char *xmlns = xmlnode_get_namespace(packet); - char *cdata = NULL; - -#define SET_REASON(x) \ - if(reason != NULL) { *reason = x; } - - if((error = xmlnode_get_child(packet, "error"))) { - cdata = xmlnode_get_data(error); - code = xmlnode_get_attrib(error, "code"); - - /* Stanza errors */ - if(xmlnode_get_child(error, "bad-request")) { - text = _("Bad Request"); - } else if(xmlnode_get_child(error, "conflict")) { - text = _("Conflict"); - } else if(xmlnode_get_child(error, "feature-not-implemented")) { - text = _("Feature Not Implemented"); - } else if(xmlnode_get_child(error, "forbidden")) { - text = _("Forbidden"); - } else if(xmlnode_get_child(error, "gone")) { - text = _("Gone"); - } else if(xmlnode_get_child(error, "internal-server-error")) { - text = _("Internal Server Error"); - } else if(xmlnode_get_child(error, "item-not-found")) { - text = _("Item Not Found"); - } else if(xmlnode_get_child(error, "jid-malformed")) { - text = _("Malformed XMPP ID"); - } else if(xmlnode_get_child(error, "not-acceptable")) { - text = _("Not Acceptable"); - } else if(xmlnode_get_child(error, "not-allowed")) { - text = _("Not Allowed"); - } else if(xmlnode_get_child(error, "not-authorized")) { - text = _("Not Authorized"); - } else if(xmlnode_get_child(error, "payment-required")) { - text = _("Payment Required"); - } else if(xmlnode_get_child(error, "recipient-unavailable")) { - text = _("Recipient Unavailable"); - } else if(xmlnode_get_child(error, "redirect")) { - /* XXX */ - } else if(xmlnode_get_child(error, "registration-required")) { - text = _("Registration Required"); - } else if(xmlnode_get_child(error, "remote-server-not-found")) { - text = _("Remote Server Not Found"); - } else if(xmlnode_get_child(error, "remote-server-timeout")) { - text = _("Remote Server Timeout"); - } else if(xmlnode_get_child(error, "resource-constraint")) { - text = _("Server Overloaded"); - } else if(xmlnode_get_child(error, "service-unavailable")) { - text = _("Service Unavailable"); - } else if(xmlnode_get_child(error, "subscription-required")) { - text = _("Subscription Required"); - } else if(xmlnode_get_child(error, "unexpected-request")) { - text = _("Unexpected Request"); - } else if(xmlnode_get_child(error, "undefined-condition")) { - text = _("Unknown Error"); - } - } else if(xmlns && !strcmp(xmlns, NS_XMPP_SASL)) { - /* Most common reason can be the default */ - SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); - if(xmlnode_get_child(packet, "aborted")) { - text = _("Authorization Aborted"); - } else if(xmlnode_get_child(packet, "incorrect-encoding")) { - text = _("Incorrect encoding in authorization"); - } else if(xmlnode_get_child(packet, "invalid-authzid")) { - text = _("Invalid authzid"); - } else if(xmlnode_get_child(packet, "invalid-mechanism")) { - text = _("Invalid Authorization Mechanism"); - } else if(xmlnode_get_child(packet, "mechanism-too-weak")) { - SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); - text = _("Authorization mechanism too weak"); - } else if(xmlnode_get_child(packet, "not-authorized")) { - SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); - /* Clear the pasword if it isn't being saved */ - if (!purple_account_get_remember_password(js->gc->account)) - purple_account_set_password(js->gc->account, NULL); - text = _("Not Authorized"); - } else if(xmlnode_get_child(packet, "temporary-auth-failure")) { - text = _("Temporary Authentication Failure"); - } else { - SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); - text = _("Authentication Failure"); - } - } else if(!strcmp(packet->name, "stream:error") || - (!strcmp(packet->name, "error") && xmlns && - !strcmp(xmlns, NS_XMPP_STREAMS))) { - /* Most common reason as default: */ - SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); - if(xmlnode_get_child(packet, "bad-format")) { - text = _("Bad Format"); - } else if(xmlnode_get_child(packet, "bad-namespace-prefix")) { - text = _("Bad Namespace Prefix"); - } else if(xmlnode_get_child(packet, "conflict")) { - SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); - text = _("Resource Conflict"); - } else if(xmlnode_get_child(packet, "connection-timeout")) { - text = _("Connection Timeout"); - } else if(xmlnode_get_child(packet, "host-gone")) { - text = _("Host Gone"); - } else if(xmlnode_get_child(packet, "host-unknown")) { - text = _("Host Unknown"); - } else if(xmlnode_get_child(packet, "improper-addressing")) { - text = _("Improper Addressing"); - } else if(xmlnode_get_child(packet, "internal-server-error")) { - text = _("Internal Server Error"); - } else if(xmlnode_get_child(packet, "invalid-id")) { - text = _("Invalid ID"); - } else if(xmlnode_get_child(packet, "invalid-namespace")) { - text = _("Invalid Namespace"); - } else if(xmlnode_get_child(packet, "invalid-xml")) { - text = _("Invalid XML"); - } else if(xmlnode_get_child(packet, "nonmatching-hosts")) { - text = _("Non-matching Hosts"); - } else if(xmlnode_get_child(packet, "not-authorized")) { - text = _("Not Authorized"); - } else if(xmlnode_get_child(packet, "policy-violation")) { - text = _("Policy Violation"); - } else if(xmlnode_get_child(packet, "remote-connection-failed")) { - text = _("Remote Connection Failed"); - } else if(xmlnode_get_child(packet, "resource-constraint")) { - text = _("Resource Constraint"); - } else if(xmlnode_get_child(packet, "restricted-xml")) { - text = _("Restricted XML"); - } else if(xmlnode_get_child(packet, "see-other-host")) { - text = _("See Other Host"); - } else if(xmlnode_get_child(packet, "system-shutdown")) { - text = _("System Shutdown"); - } else if(xmlnode_get_child(packet, "undefined-condition")) { - text = _("Undefined Condition"); - } else if(xmlnode_get_child(packet, "unsupported-encoding")) { - text = _("Unsupported Encoding"); - } else if(xmlnode_get_child(packet, "unsupported-stanza-type")) { - text = _("Unsupported Stanza Type"); - } else if(xmlnode_get_child(packet, "unsupported-version")) { - text = _("Unsupported Version"); - } else if(xmlnode_get_child(packet, "xml-not-well-formed")) { - text = _("XML Not Well Formed"); - } else { - text = _("Stream Error"); - } - } - -#undef SET_REASON - - if(text || cdata) { - char *ret = g_strdup_printf("%s%s%s", code ? code : "", - code ? ": " : "", text ? text : cdata); - g_free(cdata); - return ret; - } else { - return NULL; - } -} - -static PurpleCmdRet jabber_cmd_chat_config(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_request_room_configure(chat); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_register(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_register(chat); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - if (args && args[0] && *args[0]) - jabber_chat_change_topic(chat, args[0]); - else { - const char *cur = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)); - char *buf, *tmp, *tmp2; - - if (cur) { - tmp = g_markup_escape_text(cur, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", buf, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_nick(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if (!jabber_resourceprep_validate(args[0])) { - *error = g_strdup(_("Invalid nickname")); - return PURPLE_CMD_RET_FAILED; - } - - if (jabber_chat_change_nick(chat, args[0])) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet jabber_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_part(chat, args ? args[0] : NULL); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_ban(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if(!jabber_chat_ban_user(chat, args[0], args[1])) { - *error = g_strdup_printf(_("Unable to ban user %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_affiliate(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if (strcmp(args[0], "owner") != 0 && - strcmp(args[0], "admin") != 0 && - strcmp(args[0], "member") != 0 && - strcmp(args[0], "outcast") != 0 && - strcmp(args[0], "none") != 0) { - *error = g_strdup_printf(_("Unknown affiliation: \"%s\""), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - if (args[1]) { - int i; - char **nicks = g_strsplit(args[1], " ", -1); - - for (i = 0; nicks[i]; ++i) - if (!jabber_chat_affiliate_user(chat, nicks[i], args[0])) { - *error = g_strdup_printf(_("Unable to affiliate user %s as \"%s\""), nicks[i], args[0]); - g_strfreev(nicks); - return PURPLE_CMD_RET_FAILED; - } - - g_strfreev(nicks); - } else { - jabber_chat_affiliation_list(chat, args[0]); - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_role(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if (!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if (strcmp(args[0], "moderator") != 0 && - strcmp(args[0], "participant") != 0 && - strcmp(args[0], "visitor") != 0 && - strcmp(args[0], "none") != 0) { - *error = g_strdup_printf(_("Unknown role: \"%s\""), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - if (args[1]) { - int i; - char **nicks = g_strsplit(args[1], " ", -1); - - for (i = 0; nicks[i]; i++) - if (!jabber_chat_role_user(chat, nicks[i], args[0])) { - *error = g_strdup_printf(_("Unable to set role \"%s\" for user: %s"), - args[0], nicks[i]); - return PURPLE_CMD_RET_FAILED; - } - - g_strfreev(nicks); - } else { - jabber_chat_role_list(chat, args[0]); - } - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_invite(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - jabber_chat_invite(purple_conversation_get_gc(conv), - purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), args[1] ? args[1] : "", - args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - GHashTable *components; - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(components, "room", args[0]); - g_hash_table_replace(components, "server", chat->server); - g_hash_table_replace(components, "handle", chat->handle); - if(args[1]) - g_hash_table_replace(components, "password", args[1]); - - jabber_chat_join(purple_conversation_get_gc(conv), components); - - g_hash_table_destroy(components); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_kick(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - - if(!chat || !args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - if(!jabber_chat_kick_user(chat, args[0], args[1])) { - *error = g_strdup_printf(_("Unable to kick user %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_chat_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberChat *chat = jabber_chat_find_by_conv(conv); - char *who; - - if (!chat) - return PURPLE_CMD_RET_FAILED; - - who = g_strdup_printf("%s@%s/%s", chat->room, chat->server, args[0]); - - jabber_message_send_im(purple_conversation_get_gc(conv), who, args[1], 0); - - g_free(who); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet jabber_cmd_ping(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleAccount *account; - PurpleConnection *pc; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - account = purple_conversation_get_account(conv); - pc = purple_account_get_connection(account); - - if(!jabber_ping_jid(purple_connection_get_protocol_data(pc), args[0])) { - *error = g_strdup_printf(_("Unable to ping user %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - -static gboolean _jabber_send_buzz(JabberStream *js, const char *username, char **error) { - - JabberBuddy *jb; - JabberBuddyResource *jbr; - PurpleConnection *gc = js->gc; - PurpleBuddy *buddy = - purple_find_buddy(purple_connection_get_account(gc), username); - const gchar *alias = - buddy ? purple_buddy_get_contact_alias(buddy) : username; - - if(!username) - return FALSE; - - jb = jabber_buddy_find(js, username, FALSE); - if(!jb) { - *error = g_strdup_printf(_("Unable to buzz, because there is nothing " - "known about %s."), alias); - return FALSE; - } - - jbr = jabber_buddy_find_resource(jb, NULL); - if (!jbr) { - *error = g_strdup_printf(_("Unable to buzz, because %s might be offline."), - alias); - return FALSE; - } - - if (jabber_resource_has_capability(jbr, NS_ATTENTION)) { - xmlnode *buzz, *msg = xmlnode_new("message"); - gchar *to; - - to = g_strdup_printf("%s/%s", username, jbr->name); - xmlnode_set_attrib(msg, "to", to); - g_free(to); - - /* avoid offline storage */ - xmlnode_set_attrib(msg, "type", "headline"); - - buzz = xmlnode_new_child(msg, "attention"); - xmlnode_set_namespace(buzz, NS_ATTENTION); - - jabber_send(js, msg); - xmlnode_free(msg); - - return TRUE; - } else { - *error = g_strdup_printf(_("Unable to buzz, because %s does " - "not support it or does not wish to receive buzzes now."), alias); - return FALSE; - } -} - -static PurpleCmdRet jabber_cmd_buzz(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - JabberStream *js = conv->account->gc->proto_data; - const gchar *who; - - if (!args || !args[0]) { - /* use the buddy from conversation, if it's a one-to-one conversation */ - if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - who = purple_conversation_get_name(conv); - } else { - return PURPLE_CMD_RET_FAILED; - } - } else { - who = args[0]; - } - - if (_jabber_send_buzz(js, who, error)) { - const gchar *alias; - gchar *str; - PurpleBuddy *buddy = - purple_find_buddy(purple_connection_get_account(conv->account->gc), - who); - - if (buddy != NULL) - alias = purple_buddy_get_contact_alias(buddy); - else - alias = who; - - str = g_strdup_printf(_("Buzzing %s..."), alias); - purple_conversation_write(conv, NULL, str, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); - g_free(str); - - return PURPLE_CMD_RET_OK; - } else { - return PURPLE_CMD_RET_FAILED; - } -} - -GList *jabber_attention_types(PurpleAccount *account) -{ - static GList *types = NULL; - - if (!types) { - types = g_list_append(types, purple_attention_type_new("Buzz", _("Buzz"), - _("%s has buzzed you!"), _("Buzzing %s..."))); - } - - return types; -} - -gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code) -{ - JabberStream *js = gc->proto_data; - gchar *error = NULL; - - if (!_jabber_send_buzz(js, username, &error)) { - purple_debug_error("jabber", "jabber_send_attention: jabber_cmd_buzz failed with error: %s\n", error ? error : "(NULL)"); - g_free(error); - return FALSE; - } - - return TRUE; -} - - -gboolean jabber_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -#ifdef USE_VV -gboolean -jabber_audio_enabled(JabberStream *js, const char *namespace) -{ - PurpleMediaManager *manager = purple_media_manager_get(); - PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); - - return (caps & (PURPLE_MEDIA_CAPS_AUDIO | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION)); -} - -gboolean -jabber_video_enabled(JabberStream *js, const char *namespace) -{ - PurpleMediaManager *manager = purple_media_manager_get(); - PurpleMediaCaps caps = purple_media_manager_get_ui_caps(manager); - - return (caps & (PURPLE_MEDIA_CAPS_VIDEO | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION)); -} - -typedef struct { - PurpleAccount *account; - gchar *who; - PurpleMediaSessionType type; - -} JabberMediaRequest; - -static void -jabber_media_cancel_cb(JabberMediaRequest *request, - PurpleRequestFields *fields) -{ - g_free(request->who); - g_free(request); -} - -static void -jabber_media_ok_cb(JabberMediaRequest *request, PurpleRequestFields *fields) -{ - PurpleRequestField *field = - purple_request_fields_get_field(fields, "resource"); - int selected_id = purple_request_field_choice_get_value(field); - GList *labels = purple_request_field_choice_get_labels(field); - gchar *who = g_strdup_printf("%s/%s", request->who, - (gchar*)g_list_nth_data(labels, selected_id)); - jabber_initiate_media(request->account, who, request->type); - - g_free(who); - g_free(request->who); - g_free(request); -} -#endif - -gboolean -jabber_initiate_media(PurpleAccount *account, const char *who, - PurpleMediaSessionType type) -{ -#ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - char *resource; - - if (!js) { - purple_debug_error("jabber", - "jabber_initiate_media: NULL stream\n"); - return FALSE; - } - - - if((resource = jabber_get_resource(who)) != NULL) { - /* they've specified a resource, no need to ask or - * default or anything, just do it */ - - jb = jabber_buddy_find(js, who, FALSE); - jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); - - if (type & PURPLE_MEDIA_AUDIO && - !jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_AUDIO) && - jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) - return jabber_google_session_initiate(js, who, type); - else - return jingle_rtp_initiate_media(js, who, type); - } - - jb = jabber_buddy_find(js, who, FALSE); - - if(!jb || !jb->resources) { - /* no resources online, we're trying to initiate with someone - * whose presence we're not subscribed to, or - * someone who is offline. Let's inform the user */ - char *msg; - - if(!jb) { - msg = g_strdup_printf(_("Unable to initiate media with %s: invalid JID"), who); - } else if(jb->subscription & JABBER_SUB_TO) { - msg = g_strdup_printf(_("Unable to initiate media with %s: user is not online"), who); - } else { - msg = g_strdup_printf(_("Unable to initiate media with %s: not subscribed to user presence"), who); - } - - purple_notify_error(account, _("Media Initiation Failed"), - _("Media Initiation Failed"), msg); - g_free(msg); - return FALSE; - } else if(!jb->resources->next) { - /* only 1 resource online (probably our most common case) - * so no need to ask who to initiate with */ - gchar *name; - gboolean result; - jbr = jb->resources->data; - name = g_strdup_printf("%s/%s", who, jbr->name); - result = jabber_initiate_media(account, name, type); - g_free(name); - return result; - } else { - /* we've got multiple resources, - * we need to pick one to initiate with */ - GList *l; - char *msg; - PurpleRequestFields *fields; - PurpleRequestField *field = purple_request_field_choice_new( - "resource", _("Resource"), 0); - PurpleRequestFieldGroup *group; - JabberMediaRequest *request; - - for(l = jb->resources; l; l = l->next) - { - JabberBuddyResource *ljbr = l->data; - PurpleMediaCaps caps; - gchar *name; - name = g_strdup_printf("%s/%s", who, ljbr->name); - caps = jabber_get_media_caps(account, name); - g_free(name); - - if ((type & PURPLE_MEDIA_AUDIO) && - (type & PURPLE_MEDIA_VIDEO)) { - if (caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO) { - jbr = ljbr; - purple_request_field_choice_add( - field, jbr->name); - } - } else if (type & (PURPLE_MEDIA_AUDIO) && - (caps & PURPLE_MEDIA_CAPS_AUDIO)) { - jbr = ljbr; - purple_request_field_choice_add( - field, jbr->name); - }else if (type & (PURPLE_MEDIA_VIDEO) && - (caps & PURPLE_MEDIA_CAPS_VIDEO)) { - jbr = ljbr; - purple_request_field_choice_add( - field, jbr->name); - } - } - - if (jbr == NULL) { - purple_debug_error("jabber", - "No resources available\n"); - return FALSE; - } - - if (g_list_length(purple_request_field_choice_get_labels( - field)) <= 1) { - gchar *name; - gboolean result; - purple_request_field_destroy(field); - name = g_strdup_printf("%s/%s", who, jbr->name); - result = jabber_initiate_media(account, name, type); - g_free(name); - return result; - } - - msg = g_strdup_printf(_("Please select the resource of %s with which you would like to start a media session."), who); - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - request = g_new0(JabberMediaRequest, 1); - request->account = account; - request->who = g_strdup(who); - request->type = type; - - purple_request_field_group_add_field(group, field); - purple_request_fields_add_group(fields, group); - purple_request_fields(account, _("Select a Resource"), msg, - NULL, fields, _("Initiate Media"), - G_CALLBACK(jabber_media_ok_cb), _("Cancel"), - G_CALLBACK(jabber_media_cancel_cb), - account, who, NULL, request); - - g_free(msg); - return TRUE; - } -#endif - return FALSE; -} - -PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who) -{ -#ifdef USE_VV - JabberStream *js = (JabberStream *) - purple_account_get_connection(account)->proto_data; - JabberBuddy *jb; - JabberBuddyResource *jbr; - PurpleMediaCaps total = PURPLE_MEDIA_CAPS_NONE; - gchar *resource; - GList *specific = NULL, *l; - - if (!js) { - purple_debug_info("jabber", - "jabber_can_do_media: NULL stream\n"); - return FALSE; - } - - jb = jabber_buddy_find(js, who, FALSE); - - if (!jb || !jb->resources) { - /* no resources online, we're trying to get caps for someone - * whose presence we're not subscribed to, or - * someone who is offline. */ - return total; - - } else if ((resource = jabber_get_resource(who)) != NULL) { - /* they've specified a resource, no need to ask or - * default or anything, just do it */ - jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); - - if (!jbr) { - purple_debug_error("jabber", "jabber_get_media_caps:" - " Can't find resource %s\n", who); - return total; - } - - l = specific = g_list_prepend(specific, jbr); - - } else { - /* we've got multiple resources, combine their caps */ - l = jb->resources; - } - - for (; l; l = l->next) { - PurpleMediaCaps caps = PURPLE_MEDIA_CAPS_NONE; - jbr = l->data; - - if (jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_AUDIO)) - caps |= PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | - PURPLE_MEDIA_CAPS_AUDIO; - if (jabber_resource_has_capability(jbr, - JINGLE_APP_RTP_SUPPORT_VIDEO)) - caps |= PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | - PURPLE_MEDIA_CAPS_VIDEO; - if (caps & PURPLE_MEDIA_CAPS_AUDIO && caps & - PURPLE_MEDIA_CAPS_VIDEO) - caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; - if (caps != PURPLE_MEDIA_CAPS_NONE) { - if (!jabber_resource_has_capability(jbr, - JINGLE_TRANSPORT_ICEUDP) && - !jabber_resource_has_capability(jbr, - JINGLE_TRANSPORT_RAWUDP)) { - purple_debug_info("jingle-rtp", "Buddy doesn't " - "support the same transport types\n"); - caps = PURPLE_MEDIA_CAPS_NONE; - } else - caps |= PURPLE_MEDIA_CAPS_MODIFY_SESSION | - PURPLE_MEDIA_CAPS_CHANGE_DIRECTION; - } - if (jabber_resource_has_capability(jbr, NS_GOOGLE_VOICE)) { - caps |= PURPLE_MEDIA_CAPS_AUDIO; - if (jabber_resource_has_capability(jbr, NS_GOOGLE_VIDEO)) - caps |= PURPLE_MEDIA_CAPS_AUDIO_VIDEO; - } - - total |= caps; - } - - if (specific) { - g_list_free(specific); - } - - return total; -#else - return PURPLE_MEDIA_CAPS_NONE; -#endif -} - -gboolean jabber_can_receive_file(PurpleConnection *gc, const char *who) -{ - JabberStream *js = gc->proto_data; - - if (js) { - JabberBuddy *jb = jabber_buddy_find(js, who, FALSE); - GList *iter; - gboolean has_resources_without_caps = FALSE; - - /* if we didn't find a JabberBuddy, we don't have presence for this - buddy, let's assume they can receive files, disco should tell us - when actually trying */ - if (jb == NULL) - return TRUE; - - /* find out if there is any resources without caps */ - for (iter = jb->resources; iter ; iter = g_list_next(iter)) { - JabberBuddyResource *jbr = (JabberBuddyResource *) iter->data; - - if (!jabber_resource_know_capabilities(jbr)) { - has_resources_without_caps = TRUE; - } - } - - if (has_resources_without_caps) { - /* there is at least one resource which we don't have caps for, - let's assume they can receive files... */ - return TRUE; - } else { - /* we have caps for all the resources, see if at least one has - right caps */ - for (iter = jb->resources; iter ; iter = g_list_next(iter)) { - JabberBuddyResource *jbr = (JabberBuddyResource *) iter->data; - - if (jabber_resource_has_capability(jbr, - "http://jabber.org/protocol/si/profile/file-transfer") - && (jabber_resource_has_capability(jbr, - NS_BYTESTREAMS) - || jabber_resource_has_capability(jbr, NS_IBB))) { - return TRUE; - } - } - return FALSE; - } - } else { - return TRUE; - } -} - -void jabber_register_commands(void) -{ - PurpleCmdId id; - id = purple_cmd_register("config", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_config, - _("config: Configure a chat room."), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("configure", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_config, - _("configure: Configure a chat room."), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("nick", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_nick, - _("nick <new nickname>: Change your nickname."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("part", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_part, _("part [message]: Leave the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("register", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_register, - _("register: Register with a chat room."), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - /* XXX: there needs to be a core /topic cmd, methinks */ - id = purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_topic, - _("topic [new topic]: View or change the topic."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("ban", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_ban, - _("ban <user> [reason]: Ban a user from the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("affiliate", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_affiliate, - _("affiliate <owner|admin|member|outcast|none> [nick1] [nick2] ...: Get the users with an affiliation or set users' affiliation with the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("role", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_role, - _("role <moderator|participant|visitor|none> [nick1] [nick2] ...: Get the users with a role or set users' role with the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_invite, - _("invite <user> [message]: Invite a user to the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_join, - _("join: <room> [password]: Join a chat on this server."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("kick", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-jabber", - jabber_cmd_chat_kick, - _("kick <user> [reason]: Kick a user from the room."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_chat_msg, - _("msg <user> <message>: Send a private message to another user."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("ping", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-jabber", jabber_cmd_ping, - _("ping <jid>: Ping a user/component/server."), - NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); - - id = purple_cmd_register("buzz", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-jabber", jabber_cmd_buzz, - _("buzz: Buzz a user to get their attention"), NULL); - jabber_cmds = g_slist_prepend(jabber_cmds, GUINT_TO_POINTER(id)); -} - -void jabber_unregister_commands(void) -{ - while (jabber_cmds != NULL) { - purple_cmd_unregister(GPOINTER_TO_UINT(jabber_cmds->data)); - jabber_cmds = g_slist_delete_link(jabber_cmds, jabber_cmds); - } -} - -/* IPC functions */ - -/** - * IPC function for determining if a contact supports a certain feature. - * - * @param account The PurpleAccount - * @param jid The full JID of the contact. - * @param feature The feature's namespace. - * - * @return TRUE if supports feature; else FALSE. - */ -static gboolean -jabber_ipc_contact_has_feature(PurpleAccount *account, const gchar *jid, - const gchar *feature) -{ - PurpleConnection *gc = purple_account_get_connection(account); - JabberStream *js; - JabberBuddy *jb; - JabberBuddyResource *jbr; - gchar *resource; - - if (!purple_account_is_connected(account)) - return FALSE; - js = gc->proto_data; - - if (!(resource = jabber_get_resource(jid)) || - !(jb = jabber_buddy_find(js, jid, FALSE)) || - !(jbr = jabber_buddy_find_resource(jb, resource))) { - g_free(resource); - return FALSE; - } - - g_free(resource); - - return jabber_resource_has_capability(jbr, feature); -} - -static void -jabber_ipc_add_feature(const gchar *feature) -{ - if (!feature) - return; - jabber_add_feature(feature, 0); - - /* send presence with new caps info for all connected accounts */ - jabber_caps_broadcast_change(); -} - -void -jabber_init_plugin(PurplePlugin *plugin) -{ - GHashTable *ui_info = purple_core_get_ui_info(); - const gchar *ui_type; - const gchar *type = "pc"; /* default client type, if unknown or - unspecified */ - const gchar *ui_name = NULL; - - ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; - if (ui_type) { - if (strcmp(ui_type, "pc") == 0 || - strcmp(ui_type, "console") == 0 || - strcmp(ui_type, "phone") == 0 || - strcmp(ui_type, "handheld") == 0 || - strcmp(ui_type, "web") == 0 || - strcmp(ui_type, "bot") == 0) { - type = ui_type; - } - } - - if (ui_info) - ui_name = g_hash_table_lookup(ui_info, "name"); - if (ui_name == NULL) - ui_name = PACKAGE; - - jabber_add_identity("client", type, NULL, ui_name); - - /* initialize jabber_features list */ - jabber_add_feature(NS_LAST_ACTIVITY, 0); - jabber_add_feature(NS_OOB_IQ_DATA, 0); - jabber_add_feature(NS_ENTITY_TIME, 0); - jabber_add_feature("jabber:iq:version", 0); - jabber_add_feature("jabber:x:conference", 0); - jabber_add_feature(NS_BYTESTREAMS, 0); - jabber_add_feature("http://jabber.org/protocol/caps", 0); - jabber_add_feature("http://jabber.org/protocol/chatstates", 0); - jabber_add_feature(NS_DISCO_INFO, 0); - jabber_add_feature(NS_DISCO_ITEMS, 0); - jabber_add_feature(NS_IBB, 0); - jabber_add_feature("http://jabber.org/protocol/muc", 0); - jabber_add_feature("http://jabber.org/protocol/muc#user", 0); - jabber_add_feature("http://jabber.org/protocol/si", 0); - jabber_add_feature("http://jabber.org/protocol/si/profile/file-transfer", 0); - jabber_add_feature(NS_XHTML_IM, 0); - jabber_add_feature(NS_PING, 0); - - /* Buzz/Attention */ - jabber_add_feature(NS_ATTENTION, jabber_buzz_isenabled); - - /* Bits Of Binary */ - jabber_add_feature(NS_BOB, 0); - - /* Jingle features! */ - jabber_add_feature(JINGLE, 0); - -#ifdef USE_VV - jabber_add_feature(NS_GOOGLE_PROTOCOL_SESSION, jabber_audio_enabled); - jabber_add_feature(NS_GOOGLE_VOICE, jabber_audio_enabled); - jabber_add_feature(NS_GOOGLE_VIDEO, jabber_video_enabled); - jabber_add_feature(NS_GOOGLE_CAMERA, jabber_video_enabled); - jabber_add_feature(JINGLE_APP_RTP, 0); - jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled); - jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled); - jabber_add_feature(JINGLE_TRANSPORT_RAWUDP, 0); - jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, 0); -#endif - - jabber_auth_init(); - - /* IPC functions */ - purple_plugin_ipc_register(plugin, "contact_has_feature", PURPLE_CALLBACK(jabber_ipc_contact_has_feature), - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 3, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_ACCOUNT), - purple_value_new(PURPLE_TYPE_STRING), - purple_value_new(PURPLE_TYPE_STRING)); - - purple_plugin_ipc_register(plugin, "add_feature", PURPLE_CALLBACK(jabber_ipc_add_feature), - purple_marshal_VOID__POINTER, - NULL, 1, - purple_value_new(PURPLE_TYPE_STRING)); - - /* Modifying these? Look at libxmpp.c:load_plugin for the signal versions */ - purple_plugin_ipc_register(plugin, "register_namespace_watcher", - PURPLE_CALLBACK(jabber_iq_signal_register), - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ - - purple_plugin_ipc_register(plugin, "unregister_namespace_watcher", - PURPLE_CALLBACK(jabber_iq_signal_unregister), - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ -} - -void -jabber_uninit_plugin(PurplePlugin *plugin) -{ - purple_plugin_ipc_unregister_all(plugin); - - jabber_auth_uninit(); - jabber_features_destroy(); - jabber_identities_destroy(); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jabber.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,380 +0,0 @@ -/** - * @file jabber.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_H_ -#define PURPLE_JABBER_H_ - -typedef enum { - JABBER_CAP_NONE = 0, -/* JABBER_CAP_XHTML = 1 << 0, */ -/* JABBER_CAP_COMPOSING = 1 << 1, */ - JABBER_CAP_SI = 1 << 2, - JABBER_CAP_SI_FILE_XFER = 1 << 3, - JABBER_CAP_BYTESTREAMS = 1 << 4, - JABBER_CAP_IBB = 1 << 5, - JABBER_CAP_CHAT_STATES = 1 << 6, - JABBER_CAP_IQ_SEARCH = 1 << 7, - JABBER_CAP_IQ_REGISTER = 1 << 8, - - /* Google Talk extensions: - * http://code.google.com/apis/talk/jep_extensions/extensions.html - */ - JABBER_CAP_GMAIL_NOTIFY = 1 << 9, - JABBER_CAP_GOOGLE_ROSTER = 1 << 10, - - JABBER_CAP_PING = 1 << 11, - JABBER_CAP_ADHOC = 1 << 12, - JABBER_CAP_BLOCKING = 1 << 13, - - JABBER_CAP_ITEMS = 1 << 14, - JABBER_CAP_ROSTER_VERSIONING = 1 << 15, - - JABBER_CAP_RETRIEVED = 1 << 31 -} JabberCapabilities; - -typedef struct _JabberStream JabberStream; - -#include <libxml/parser.h> -#include <glib.h> -#include "circbuffer.h" -#include "connection.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "media.h" -#include "mediamanager.h" -#include "roomlist.h" -#include "sslconn.h" - -#include "namespaces.h" - -#include "auth.h" -#include "iq.h" -#include "jutil.h" -#include "xmlnode.h" -#include "buddy.h" -#include "bosh.h" - -#ifdef HAVE_CYRUS_SASL -#include <sasl/sasl.h> -#endif - -#define CAPS0115_NODE "http://pidgin.im/" - -#define JABBER_DEFAULT_REQUIRE_TLS TRUE -#define JABBER_DEFAULT_FT_PROXIES "proxy.eu.jabber.org" - -/* Index into attention_types list */ -#define JABBER_BUZZ 0 - -typedef enum { - JABBER_STREAM_OFFLINE, - JABBER_STREAM_CONNECTING, - JABBER_STREAM_INITIALIZING, - JABBER_STREAM_INITIALIZING_ENCRYPTION, - JABBER_STREAM_AUTHENTICATING, - JABBER_STREAM_POST_AUTH, - JABBER_STREAM_CONNECTED -} JabberStreamState; - -struct _JabberStream -{ - int fd; - - PurpleSrvQueryData *srv_query_data; - - xmlParserCtxt *context; - xmlnode *current; - - enum { - JABBER_PROTO_0_9, - JABBER_PROTO_1_0 - } protocol_version; - - JabberSaslMech *auth_mech; - gpointer auth_mech_data; - char *stream_id; - JabberStreamState state; - - /* SASL authentication */ - char *expected_rspauth; - - GHashTable *buddies; - - /* - * This boolean was added to eliminate a heinous bug where we would - * get into a loop with the server and move a buddy back and forth - * from one group to another. - * - * The sequence goes something like this: - * 1. Our resource and another resource both approve an authorization - * request at the exact same time. We put the buddy in group A and - * the other resource put the buddy in group B. - * 2. The server receives the roster add for group B and sends us a - * roster push. - * 3. We receive this roster push and modify our local blist. This - * triggers us to send a roster add for group B. - * 4. The server recieves our earlier roster add for group A and sends - * us a roster push. - * 5. We receive this roster push and modify our local blist. This - * triggers us to send a roster add for group A. - * 6. The server receives our earlier roster add for group B and sends - * us a roster push. - * (repeat steps 3 through 6 ad infinitum) - * - * This boolean is used to short-circuit the sending of a roster add - * when we receive a roster push. - * - * See these bug reports: - * http://trac.adiumx.com/ticket/8834 - * http://developer.pidgin.im/ticket/5484 - * http://developer.pidgin.im/ticket/6188 - */ - gboolean currently_parsing_roster_push; - - GHashTable *chats; - GList *chat_servers; - PurpleRoomlist *roomlist; - GList *user_directories; - - GHashTable *iq_callbacks; - int next_id; - - GList *bs_proxies; - GList *oob_file_transfers; - GList *file_transfers; - - time_t idle; - time_t old_idle; - - JabberID *user; - JabberBuddy *user_jb; - - PurpleConnection *gc; - PurpleSslConnection *gsc; - - gboolean registration; - - char *initial_avatar_hash; - char *avatar_hash; - GSList *pending_avatar_requests; - - GSList *pending_buddy_info_requests; - - PurpleCircBuffer *write_buffer; - guint writeh; - - gboolean reinit; - - JabberCapabilities server_caps; - gboolean googletalk; - char *server_name; - - char *gmail_last_time; - char *gmail_last_tid; - - char *serverFQDN; - -#ifdef HAVE_CYRUS_SASL - sasl_conn_t *sasl; - sasl_callback_t *sasl_cb; - const char *current_mech; - int auth_fail_count; - - int sasl_state; - int sasl_maxbuf; - GString *sasl_mechs; -#endif - - gboolean unregistration; - PurpleAccountUnregistrationCb unregistration_cb; - void *unregistration_user_data; - - gboolean vcard_fetched; - /* Timer at login to push updated avatar */ - guint vcard_timer; - - /* Entity Capabilities hash */ - char *caps_hash; - - /* does the local server support PEP? */ - gboolean pep; - - /* Is Buzz enabled? */ - gboolean allowBuzz; - - /* A list of JabberAdHocCommands supported by the server */ - GList *commands; - - /* last presence update to check for differences */ - JabberBuddyState old_state; - char *old_msg; - int old_priority; - char *old_avatarhash; - - /* same for user tune */ - char *old_artist; - char *old_title; - char *old_source; - char *old_uri; - int old_length; - char *old_track; - - char *certificate_CN; - - /* A purple timeout tag for the keepalive */ - guint keepalive_timeout; - - PurpleSrvResponse *srv_rec; - guint srv_rec_idx; - guint max_srv_rec_idx; - - /* BOSH stuff */ - PurpleBOSHConnection *bosh; - - /** - * This linked list contains PurpleUtilFetchUrlData structs - * for when we lookup buddy icons from a url - */ - GSList *url_datas; - - /* keep a hash table of JingleSessions */ - GHashTable *sessions; - - /* maybe this should only be present when USE_VV? */ - gchar *stun_ip; - int stun_port; - PurpleDnsQueryData *stun_query; - /* later add stuff to handle TURN relays... */ -}; - -typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *namespace); - -typedef struct _JabberFeature -{ - gchar *namespace; - JabberFeatureEnabled *is_enabled; -} JabberFeature; - -typedef struct _JabberIdentity -{ - gchar *category; - gchar *type; - gchar *name; - gchar *lang; -} JabberIdentity; - -typedef struct _JabberBytestreamsStreamhost { - char *jid; - char *host; - int port; - char *zeroconf; -} JabberBytestreamsStreamhost; - -/* what kind of additional features as returned from disco#info are supported? */ -extern GList *jabber_features; -extern GList *jabber_identities; - -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet); -void jabber_process_packet(JabberStream *js, xmlnode **packet); -void jabber_send(JabberStream *js, xmlnode *data); -void jabber_send_raw(JabberStream *js, const char *data, int len); -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet, - gpointer unused); - -void jabber_stream_set_state(JabberStream *js, JabberStreamState state); - -void jabber_register_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); -void jabber_register_start(JabberStream *js); - -char *jabber_get_next_id(JabberStream *js); - -/** Parse an error into a human-readable string and optionally a disconnect - * reason. - * @param js the stream on which the error occurred. - * @param packet the error packet - * @param reason where to store the disconnection reason, or @c NULL if you - * don't care or you don't intend to close the connection. - */ -char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason); - -void jabber_add_feature(const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */ -void jabber_remove_feature(const gchar *namespace); - -/** Adds an identity to this jabber library instance. For list of valid values visit the - * website of the XMPP Registrar ( http://www.xmpp.org/registrar/disco-categories.html#client ). - * @param category the category of the identity. - * @param type the type of the identity. - * @param language the language localization of the name. Can be NULL. - * @param name the name of the identity. - */ -void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name); - -/** - * Returns true if this connection is over a secure (SSL) stream. Use this - * instead of checking js->gsc because BOSH stores its PurpleSslConnection - * members in its own data structure. - */ -gboolean jabber_stream_is_ssl(JabberStream *js); - -/** PRPL functions */ -const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); -const char* jabber_list_emblem(PurpleBuddy *b); -char *jabber_status_text(PurpleBuddy *b); -void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -GList *jabber_status_types(PurpleAccount *account); -void jabber_login(PurpleAccount *account); -void jabber_close(PurpleConnection *gc); -void jabber_idle_set(PurpleConnection *gc, int idle); -void jabber_blocklist_parse_push(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *child); -void jabber_request_block_list(JabberStream *js); -void jabber_add_deny(PurpleConnection *gc, const char *who); -void jabber_rem_deny(PurpleConnection *gc, const char *who); -void jabber_keepalive(PurpleConnection *gc); -void jabber_register_gateway(JabberStream *js, const char *gateway); -void jabber_register_account(PurpleAccount *account); -void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data); -gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code); -GList *jabber_attention_types(PurpleAccount *account); -void jabber_convo_closed(PurpleConnection *gc, const char *who); -PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name); -gboolean jabber_offline_message(const PurpleBuddy *buddy); -int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); -GList *jabber_actions(PurplePlugin *plugin, gpointer context); - -gboolean jabber_audio_enabled(JabberStream *js, const char *unused); -gboolean jabber_video_enabled(JabberStream *js, const char *unused); -gboolean jabber_initiate_media(PurpleAccount *account, const char *who, - PurpleMediaSessionType type); -PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who); -gboolean jabber_can_receive_file(PurpleConnection *gc, const gchar *who); - -void jabber_register_commands(void); -void jabber_unregister_commands(void); - -void jabber_init_plugin(PurplePlugin *plugin); -void jabber_uninit_plugin(PurplePlugin *plugin); - -#endif /* PURPLE_JABBER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,465 +0,0 @@ -/** - * @file content.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "content.h" -#include "jingle.h" - -#include <string.h> - -struct _JingleContentPrivate -{ - JingleSession *session; - gchar *description_type; - gchar *creator; - gchar *disposition; - gchar *name; - gchar *senders; - JingleTransport *transport; - JingleTransport *pending_transport; -}; - -#define JINGLE_CONTENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_CONTENT, JingleContentPrivate)) - -static void jingle_content_class_init (JingleContentClass *klass); -static void jingle_content_init (JingleContent *content); -static void jingle_content_finalize (GObject *object); -static void jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static xmlnode *jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); -static JingleContent *jingle_content_parse_internal(xmlnode *content); - -static GObjectClass *parent_class = NULL; - -enum { - PROP_0, - PROP_SESSION, - PROP_CREATOR, - PROP_DISPOSITION, - PROP_NAME, - PROP_SENDERS, - PROP_TRANSPORT, - PROP_PENDING_TRANSPORT, -}; - -GType -jingle_content_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleContentClass), - NULL, - NULL, - (GClassInitFunc) jingle_content_class_init, - NULL, - NULL, - sizeof(JingleContent), - 0, - (GInstanceInitFunc) jingle_content_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "JingleContent", &info, 0); - } - return type; -} - -static void -jingle_content_class_init (JingleContentClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_content_finalize; - gobject_class->set_property = jingle_content_set_property; - gobject_class->get_property = jingle_content_get_property; - klass->to_xml = jingle_content_to_xml_internal; - klass->parse = jingle_content_parse_internal; - - g_object_class_install_property(gobject_class, PROP_SESSION, - g_param_spec_object("session", - "Jingle Session", - "The jingle session parent of this content.", - JINGLE_TYPE_SESSION, - G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_CREATOR, - g_param_spec_string("creator", - "Creator", - "The participant that created this content.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_DISPOSITION, - g_param_spec_string("disposition", - "Disposition", - "The disposition of the content.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_NAME, - g_param_spec_string("name", - "Name", - "The name of this content.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_SENDERS, - g_param_spec_string("senders", - "Senders", - "The sender of this content.", - NULL, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_TRANSPORT, - g_param_spec_object("transport", - "transport", - "The transport of this content.", - JINGLE_TYPE_TRANSPORT, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_PENDING_TRANSPORT, - g_param_spec_object("pending-transport", - "Pending transport", - "The pending transport contained within this content", - JINGLE_TYPE_TRANSPORT, - G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(JingleContentPrivate)); -} - -static void -jingle_content_init (JingleContent *content) -{ - content->priv = JINGLE_CONTENT_GET_PRIVATE(content); - memset(content->priv, 0, sizeof(*content->priv)); -} - -static void -jingle_content_finalize (GObject *content) -{ - JingleContentPrivate *priv = JINGLE_CONTENT_GET_PRIVATE(content); - purple_debug_info("jingle","jingle_content_finalize\n"); - - g_free(priv->description_type); - g_free(priv->creator); - g_free(priv->disposition); - g_free(priv->name); - g_free(priv->senders); - g_object_unref(priv->transport); - if (priv->pending_transport) - g_object_unref(priv->pending_transport); - - parent_class->finalize(content); -} - -static void -jingle_content_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleContent *content; - g_return_if_fail(JINGLE_IS_CONTENT(object)); - - content = JINGLE_CONTENT(object); - - switch (prop_id) { - case PROP_SESSION: - content->priv->session = g_value_get_object(value); - break; - case PROP_CREATOR: - g_free(content->priv->creator); - content->priv->creator = g_value_dup_string(value); - break; - case PROP_DISPOSITION: - g_free(content->priv->disposition); - content->priv->disposition = g_value_dup_string(value); - break; - case PROP_NAME: - g_free(content->priv->name); - content->priv->name = g_value_dup_string(value); - break; - case PROP_SENDERS: - g_free(content->priv->senders); - content->priv->senders = g_value_dup_string(value); - break; - case PROP_TRANSPORT: - if (content->priv->transport) - g_object_unref(content->priv->transport); - content->priv->transport = g_value_get_object(value); - break; - case PROP_PENDING_TRANSPORT: - if (content->priv->pending_transport) - g_object_unref(content->priv->pending_transport); - content->priv->pending_transport = g_value_get_object(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_content_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleContent *content; - g_return_if_fail(JINGLE_IS_CONTENT(object)); - - content = JINGLE_CONTENT(object); - - switch (prop_id) { - case PROP_SESSION: - g_value_set_object(value, content->priv->session); - break; - case PROP_CREATOR: - g_value_set_string(value, content->priv->creator); - break; - case PROP_DISPOSITION: - g_value_set_string(value, content->priv->disposition); - break; - case PROP_NAME: - g_value_set_string(value, content->priv->name); - break; - case PROP_SENDERS: - g_value_set_string(value, content->priv->senders); - break; - case PROP_TRANSPORT: - g_value_set_object(value, content->priv->transport); - break; - case PROP_PENDING_TRANSPORT: - g_value_set_object(value, content->priv->pending_transport); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -JingleContent * -jingle_content_create(const gchar *type, const gchar *creator, - const gchar *disposition, const gchar *name, - const gchar *senders, JingleTransport *transport) -{ - - - JingleContent *content = g_object_new(jingle_get_type(type), - "creator", creator, - "disposition", disposition != NULL ? disposition : "session", - "name", name, - "senders", senders != NULL ? senders : "both", - "transport", transport, - NULL); - return content; -} - -JingleSession *jingle_content_get_session(JingleContent *content) -{ - JingleSession *session; - g_object_get(content, "session", &session, NULL); - return session; -} - -const gchar * -jingle_content_get_description_type(JingleContent *content) -{ - return JINGLE_CONTENT_GET_CLASS(content)->description_type; -} - -gchar * -jingle_content_get_creator(JingleContent *content) -{ - gchar *creator; - g_object_get(content, "creator", &creator, NULL); - return creator; -} - -gchar * -jingle_content_get_disposition(JingleContent *content) -{ - gchar *disposition; - g_object_get(content, "disposition", &disposition, NULL); - return disposition; -} - -gchar * -jingle_content_get_name(JingleContent *content) -{ - gchar *name; - g_object_get(content, "name", &name, NULL); - return name; -} - -gchar * -jingle_content_get_senders(JingleContent *content) -{ - gchar *senders; - g_object_get(content, "senders", &senders, NULL); - return senders; -} - -JingleTransport * -jingle_content_get_transport(JingleContent *content) -{ - JingleTransport *transport; - g_object_get(content, "transport", &transport, NULL); - return transport; -} - -void -jingle_content_set_session(JingleContent *content, JingleSession *session) -{ - g_return_if_fail(JINGLE_IS_CONTENT(content)); - g_return_if_fail(JINGLE_IS_SESSION(session)); - g_object_set(content, "session", session, NULL); -} - -JingleTransport * -jingle_content_get_pending_transport(JingleContent *content) -{ - JingleTransport *pending_transport; - g_object_get(content, "pending_transport", &pending_transport, NULL); - return pending_transport; -} - -void -jingle_content_set_pending_transport(JingleContent *content, JingleTransport *transport) -{ - g_object_set(content, "pending-transport", transport, NULL); -} - -void -jingle_content_accept_transport(JingleContent *content) -{ - if (content->priv->transport) - g_object_unref(content->priv->transport); - content->priv->transport = content->priv->pending_transport; - content->priv->pending_transport = NULL; -} - -void -jingle_content_remove_pending_transport(JingleContent *content) -{ - if (content->priv->pending_transport) { - g_object_unref(content->priv->pending_transport); - content->priv->pending_transport = NULL; - } -} - -void -jingle_content_modify(JingleContent *content, const gchar *senders) -{ - g_object_set(content, "senders", senders, NULL); -} - -static JingleContent * -jingle_content_parse_internal(xmlnode *content) -{ - xmlnode *description = xmlnode_get_child(content, "description"); - const gchar *type = xmlnode_get_namespace(description); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - const gchar *disposition = xmlnode_get_attrib(content, "disposition"); - const gchar *senders = xmlnode_get_attrib(content, "senders"); - const gchar *name = xmlnode_get_attrib(content, "name"); - JingleTransport *transport = - jingle_transport_parse(xmlnode_get_child(content, "transport")); - - if (senders == NULL) - senders = "both"; - - return jingle_content_create(type, creator, disposition, name, senders, transport); -} - -JingleContent * -jingle_content_parse(xmlnode *content) -{ - const gchar *type = xmlnode_get_namespace(xmlnode_get_child(content, "description")); - GType jingle_type = jingle_get_type(type); - - if (jingle_type != G_TYPE_NONE) { - return JINGLE_CONTENT_CLASS(g_type_class_ref(jingle_type))->parse(content); - } else { - return NULL; - } -} - -static xmlnode * -jingle_content_to_xml_internal(JingleContent *content, xmlnode *jingle, JingleActionType action) -{ - xmlnode *node = xmlnode_new_child(jingle, "content"); - gchar *creator = jingle_content_get_creator(content); - gchar *name = jingle_content_get_name(content); - gchar *senders = jingle_content_get_senders(content); - gchar *disposition = jingle_content_get_disposition(content); - - xmlnode_set_attrib(node, "creator", creator); - xmlnode_set_attrib(node, "name", name); - xmlnode_set_attrib(node, "senders", senders); - if (strcmp("session", disposition)) - xmlnode_set_attrib(node, "disposition", disposition); - - g_free(disposition); - g_free(senders); - g_free(name); - g_free(creator); - - if (action != JINGLE_CONTENT_REMOVE) { - JingleTransport *transport; - - if (action != JINGLE_TRANSPORT_ACCEPT && - action != JINGLE_TRANSPORT_INFO && - action != JINGLE_TRANSPORT_REJECT && - action != JINGLE_TRANSPORT_REPLACE) { - xmlnode *description = xmlnode_new_child(node, "description"); - - xmlnode_set_namespace(description, - jingle_content_get_description_type(content)); - } - - if (action != JINGLE_TRANSPORT_REJECT && action == JINGLE_TRANSPORT_REPLACE) - transport = jingle_content_get_pending_transport(content); - else - transport = jingle_content_get_transport(content); - - jingle_transport_to_xml(transport, node, action); - g_object_unref(transport); - } - - return node; -} - -xmlnode * -jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action) -{ - g_return_val_if_fail(JINGLE_IS_CONTENT(content), NULL); - return JINGLE_CONTENT_GET_CLASS(content)->to_xml(content, jingle, action); -} - -void -jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) -{ - g_return_if_fail(JINGLE_IS_CONTENT(content)); - JINGLE_CONTENT_GET_CLASS(content)->handle_action(content, xmlcontent, action); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/content.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,121 +0,0 @@ -/** - * @file content.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_CONTENT_H -#define PURPLE_JABBER_JINGLE_CONTENT_H - - -#include "jabber.h" -#include "jingle.h" -#include "session.h" -#include "transport.h" - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define JINGLE_TYPE_CONTENT (jingle_content_get_type()) -#define JINGLE_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_CONTENT, JingleContent)) -#define JINGLE_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_CONTENT, JingleContentClass)) -#define JINGLE_IS_CONTENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_CONTENT)) -#define JINGLE_IS_CONTENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_CONTENT)) -#define JINGLE_CONTENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_CONTENT, JingleContentClass)) - -/** @copydoc _JingleContent */ -typedef struct _JingleContent JingleContent; -/** @copydoc _JingleContentClass */ -typedef struct _JingleContentClass JingleContentClass; -/** @copydoc _JingleContentPrivate */ -typedef struct _JingleContentPrivate JingleContentPrivate; - -/** The content class */ -struct _JingleContentClass -{ - GObjectClass parent_class; /**< The parent class. */ - - xmlnode *(*to_xml) (JingleContent *content, xmlnode *jingle, JingleActionType action); - JingleContent *(*parse) (xmlnode *content); - void (*handle_action) (JingleContent *content, xmlnode *xmlcontent, JingleActionType action); - const gchar *description_type; -}; - -/** The content class's private data */ -struct _JingleContent -{ - GObject parent; /**< The parent of this object. */ - JingleContentPrivate *priv; /**< The private data of this object. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the content class's GType - * - * @return The content class's GType. - */ -GType jingle_content_get_type(void); - -JingleContent *jingle_content_create(const gchar *type, const gchar *creator, - const gchar *disposition, const gchar *name, - const gchar *senders, JingleTransport *transport); - -JingleSession *jingle_content_get_session(JingleContent *content); -const gchar *jingle_content_get_description_type(JingleContent *content); -gchar *jingle_content_get_creator(JingleContent *content); -gchar *jingle_content_get_disposition(JingleContent *content); -gchar *jingle_content_get_name(JingleContent *content); -gchar *jingle_content_get_senders(JingleContent *content); -JingleTransport *jingle_content_get_transport(JingleContent *content); -JingleTransport *jingle_content_get_pending_transport(JingleContent *content); - -void jingle_content_set_session(JingleContent *content, JingleSession *session); -void jingle_content_set_pending_transport(JingleContent *content, JingleTransport *transport); -void jingle_content_accept_transport(JingleContent *content); -void jingle_content_remove_pending_transport(JingleContent *content); -void jingle_content_modify(JingleContent *content, const gchar *senders); - -#define jingle_content_create_content_accept(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_ACCEPT) -#define jingle_content_create_content_add(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_ADD) -#define jingle_content_create_content_modify(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_MODIFY) -#define jingle_content_create_content_remove(session) \ - jingle_session_to_packet(session, JINGLE_CONTENT_REMOVE) - -JingleContent *jingle_content_parse(xmlnode *content); -xmlnode *jingle_content_to_xml(JingleContent *content, xmlnode *jingle, JingleActionType action); -void jingle_content_handle_action(JingleContent *content, xmlnode *xmlcontent, JingleActionType action); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_CONTENT_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,431 +0,0 @@ -/** - * @file iceudp.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "iceudp.h" -#include "jingle.h" -#include "debug.h" - -#include <string.h> - -struct _JingleIceUdpPrivate -{ - GList *local_candidates; - GList *remote_candidates; -}; - -#define JINGLE_ICEUDP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_ICEUDP, JingleIceUdpPrivate)) - -static void jingle_iceudp_class_init (JingleIceUdpClass *klass); -static void jingle_iceudp_init (JingleIceUdp *iceudp); -static void jingle_iceudp_finalize (GObject *object); -static void jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_iceudp_parse_internal(xmlnode *iceudp); -static xmlnode *jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); - -static JingleTransportClass *parent_class = NULL; - -enum { - PROP_0, - PROP_LOCAL_CANDIDATES, - PROP_REMOTE_CANDIDATES, -}; - -static JingleIceUdpCandidate * -jingle_iceudp_candidate_copy(JingleIceUdpCandidate *candidate) -{ - JingleIceUdpCandidate *new_candidate = g_new0(JingleIceUdpCandidate, 1); - new_candidate->component = candidate->component; - new_candidate->foundation = g_strdup(candidate->foundation); - new_candidate->generation = candidate->generation; - new_candidate->id = g_strdup(candidate->id); - new_candidate->ip = g_strdup(candidate->ip); - new_candidate->network = candidate->network; - new_candidate->port = candidate->port; - new_candidate->priority = candidate->priority; - new_candidate->protocol = g_strdup(candidate->protocol); - new_candidate->type = g_strdup(candidate->type); - - new_candidate->username = g_strdup(candidate->username); - new_candidate->password = g_strdup(candidate->password); - - new_candidate->rem_known = candidate->rem_known; - - return new_candidate; -} - -static void -jingle_iceudp_candidate_free(JingleIceUdpCandidate *candidate) -{ - g_free(candidate->foundation); - g_free(candidate->id); - g_free(candidate->ip); - g_free(candidate->protocol); - g_free(candidate->reladdr); - g_free(candidate->type); - - g_free(candidate->username); - g_free(candidate->password); -} - -GType -jingle_iceudp_candidate_get_type() -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static("JingleIceUdpCandidate", - (GBoxedCopyFunc)jingle_iceudp_candidate_copy, - (GBoxedFreeFunc)jingle_iceudp_candidate_free); - } - return type; -} - -JingleIceUdpCandidate * -jingle_iceudp_candidate_new(guint component, const gchar *foundation, - guint generation, const gchar *id, const gchar *ip, - guint network, guint port, guint priority, - const gchar *protocol, const gchar *type, - const gchar *username, const gchar *password) -{ - JingleIceUdpCandidate *candidate = g_new0(JingleIceUdpCandidate, 1); - candidate->component = component; - candidate->foundation = g_strdup(foundation); - candidate->generation = generation; - candidate->id = g_strdup(id); - candidate->ip = g_strdup(ip); - candidate->network = network; - candidate->port = port; - candidate->priority = priority; - candidate->protocol = g_strdup(protocol); - candidate->type = g_strdup(type); - - candidate->username = g_strdup(username); - candidate->password = g_strdup(password); - - candidate->rem_known = FALSE; - return candidate; -} - -GType -jingle_iceudp_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleIceUdpClass), - NULL, - NULL, - (GClassInitFunc) jingle_iceudp_class_init, - NULL, - NULL, - sizeof(JingleIceUdp), - 0, - (GInstanceInitFunc) jingle_iceudp_init, - NULL - }; - type = g_type_register_static(JINGLE_TYPE_TRANSPORT, "JingleIceUdp", &info, 0); - } - return type; -} - -static void -jingle_iceudp_class_init (JingleIceUdpClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_iceudp_finalize; - gobject_class->set_property = jingle_iceudp_set_property; - gobject_class->get_property = jingle_iceudp_get_property; - klass->parent_class.to_xml = jingle_iceudp_to_xml_internal; - klass->parent_class.parse = jingle_iceudp_parse_internal; - klass->parent_class.transport_type = JINGLE_TRANSPORT_ICEUDP; - - g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES, - g_param_spec_pointer("local-candidates", - "Local candidates", - "The local candidates for this transport.", - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES, - g_param_spec_pointer("remote-candidates", - "Remote candidates", - "The remote candidates for this transport.", - G_PARAM_READABLE)); - - g_type_class_add_private(klass, sizeof(JingleIceUdpPrivate)); -} - -static void -jingle_iceudp_init (JingleIceUdp *iceudp) -{ - iceudp->priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); - iceudp->priv->local_candidates = NULL; - iceudp->priv->remote_candidates = NULL; -} - -static void -jingle_iceudp_finalize (GObject *iceudp) -{ -/* JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); */ - purple_debug_info("jingle","jingle_iceudp_finalize\n"); - - G_OBJECT_CLASS(parent_class)->finalize(iceudp); -} - -static void -jingle_iceudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleIceUdp *iceudp; - g_return_if_fail(JINGLE_IS_ICEUDP(object)); - - iceudp = JINGLE_ICEUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - iceudp->priv->local_candidates = - g_value_get_pointer(value); - break; - case PROP_REMOTE_CANDIDATES: - iceudp->priv->remote_candidates = - g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_iceudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleIceUdp *iceudp; - g_return_if_fail(JINGLE_IS_ICEUDP(object)); - - iceudp = JINGLE_ICEUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - g_value_set_pointer(value, iceudp->priv->local_candidates); - break; - case PROP_REMOTE_CANDIDATES: - g_value_set_pointer(value, iceudp->priv->remote_candidates); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -jingle_iceudp_add_local_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate) -{ - GList *iter = iceudp->priv->local_candidates; - - for (; iter; iter = g_list_next(iter)) { - JingleIceUdpCandidate *c = iter->data; - if (!strcmp(c->id, candidate->id)) { - guint generation = c->generation + 1; - - g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, c); - iceudp->priv->local_candidates = g_list_delete_link( - iceudp->priv->local_candidates, iter); - - candidate->generation = generation; - - iceudp->priv->local_candidates = g_list_append( - iceudp->priv->local_candidates, candidate); - return; - } - } - - iceudp->priv->local_candidates = g_list_append( - iceudp->priv->local_candidates, candidate); -} - -GList * -jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp) -{ - return g_list_copy(iceudp->priv->remote_candidates); -} - -static JingleIceUdpCandidate * -jingle_iceudp_get_remote_candidate_by_id(JingleIceUdp *iceudp, - const gchar *id) -{ - GList *iter = iceudp->priv->remote_candidates; - for (; iter; iter = g_list_next(iter)) { - JingleIceUdpCandidate *candidate = iter->data; - if (!strcmp(candidate->id, id)) { - return candidate; - } - } - return NULL; -} - -static void -jingle_iceudp_add_remote_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate) -{ - JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(iceudp); - JingleIceUdpCandidate *iceudp_candidate = - jingle_iceudp_get_remote_candidate_by_id(iceudp, - candidate->id); - if (iceudp_candidate != NULL) { - priv->remote_candidates = g_list_remove( - priv->remote_candidates, iceudp_candidate); - g_boxed_free(JINGLE_TYPE_ICEUDP_CANDIDATE, iceudp_candidate); - } - priv->remote_candidates = g_list_append(priv->remote_candidates, candidate); -} - -static JingleTransport * -jingle_iceudp_parse_internal(xmlnode *iceudp) -{ - JingleTransport *transport = parent_class->parse(iceudp); - xmlnode *candidate = xmlnode_get_child(iceudp, "candidate"); - JingleIceUdpCandidate *iceudp_candidate = NULL; - - const gchar *username = xmlnode_get_attrib(iceudp, "ufrag"); - const gchar *password = xmlnode_get_attrib(iceudp, "pwd"); - - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *relport = xmlnode_get_attrib(candidate, "rel-port"); - const gchar *component = xmlnode_get_attrib(candidate, "component"); - const gchar *foundation = xmlnode_get_attrib(candidate, "foundation"); - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *id = xmlnode_get_attrib(candidate, "id"); - const gchar *ip = xmlnode_get_attrib(candidate, "ip"); - const gchar *network = xmlnode_get_attrib(candidate, "network"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); - const gchar *priority = xmlnode_get_attrib(candidate, "priority"); - const gchar *protocol = xmlnode_get_attrib(candidate, "protocol"); - const gchar *type = xmlnode_get_attrib(candidate, "type"); - - if (!component || !foundation || !generation || !id || !ip || - !network || !port || !priority || !protocol || !type) - continue; - - iceudp_candidate = jingle_iceudp_candidate_new( - atoi(component), - foundation, - atoi(generation), - id, - ip, - atoi(network), - atoi(port), - atoi(priority), - protocol, - type, - username, password); - iceudp_candidate->reladdr = g_strdup( - xmlnode_get_attrib(candidate, "rel-addr")); - iceudp_candidate->relport = - relport != NULL ? atoi(relport) : 0; - iceudp_candidate->rem_known = TRUE; - jingle_iceudp_add_remote_candidate(JINGLE_ICEUDP(transport), iceudp_candidate); - } - - return transport; -} - -static xmlnode * -jingle_iceudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - xmlnode *node = parent_class->to_xml(transport, content, action); - - if (action == JINGLE_SESSION_INITIATE || - action == JINGLE_SESSION_ACCEPT || - action == JINGLE_TRANSPORT_INFO || - action == JINGLE_CONTENT_ADD || - action == JINGLE_TRANSPORT_REPLACE) { - JingleIceUdpPrivate *priv = JINGLE_ICEUDP_GET_PRIVATE(transport); - GList *iter = priv->local_candidates; - gboolean used_candidate = FALSE; - - for (; iter; iter = g_list_next(iter)) { - JingleIceUdpCandidate *candidate = iter->data; - xmlnode *xmltransport; - gchar *component, *generation, *network, - *port, *priority; - - if (candidate->rem_known == TRUE) - continue; - - used_candidate = TRUE; - candidate->rem_known = TRUE; - - xmltransport = xmlnode_new_child(node, "candidate"); - component = g_strdup_printf("%d", candidate->component); - generation = g_strdup_printf("%d", - candidate->generation); - network = g_strdup_printf("%d", candidate->network); - port = g_strdup_printf("%d", candidate->port); - priority = g_strdup_printf("%d", candidate->priority); - - xmlnode_set_attrib(xmltransport, "component", component); - xmlnode_set_attrib(xmltransport, "foundation", candidate->foundation); - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "id", candidate->id); - xmlnode_set_attrib(xmltransport, "ip", candidate->ip); - xmlnode_set_attrib(xmltransport, "network", network); - xmlnode_set_attrib(xmltransport, "port", port); - xmlnode_set_attrib(xmltransport, "priority", priority); - xmlnode_set_attrib(xmltransport, "protocol", candidate->protocol); - - if (candidate->reladdr != NULL && - (strcmp(candidate->ip, candidate->reladdr) || - (candidate->port != candidate->relport))) { - gchar *relport = g_strdup_printf("%d", - candidate->relport); - xmlnode_set_attrib(xmltransport, "rel-addr", - candidate->reladdr); - xmlnode_set_attrib(xmltransport, "rel-port", - relport); - g_free(relport); - } - - xmlnode_set_attrib(xmltransport, "type", candidate->type); - - g_free(component); - g_free(generation); - g_free(network); - g_free(port); - g_free(priority); - } - - if (used_candidate == TRUE) { - JingleIceUdpCandidate *candidate = - priv->local_candidates->data; - xmlnode_set_attrib(node, "pwd", candidate->password); - xmlnode_set_attrib(node, "ufrag", candidate->username); - } - } - - return node; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/iceudp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/** - * @file iceudp.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_ICEUDP_H -#define PURPLE_JABBER_JINGLE_ICEUDP_H - -#include <glib.h> -#include <glib-object.h> - -#include "transport.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_ICEUDP (jingle_iceudp_get_type()) -#define JINGLE_TYPE_ICEUDP_CANDIDATE (jingle_iceudp_candidate_get_type()) -#define JINGLE_ICEUDP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_ICEUDP, JingleIceUdp)) -#define JINGLE_ICEUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_ICEUDP, JingleIceUdpClass)) -#define JINGLE_IS_ICEUDP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_ICEUDP)) -#define JINGLE_IS_ICEUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_ICEUDP)) -#define JINGLE_ICEUDP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_ICEUDP, JingleIceUdpClass)) - -/** @copydoc _JingleIceUdp */ -typedef struct _JingleIceUdp JingleIceUdp; -/** @copydoc _JingleIceUdpClass */ -typedef struct _JingleIceUdpClass JingleIceUdpClass; -/** @copydoc _JingleIceUdpPrivate */ -typedef struct _JingleIceUdpPrivate JingleIceUdpPrivate; -/** @copydoc _JingleIceUdpCandidate */ -typedef struct _JingleIceUdpCandidate JingleIceUdpCandidate; - -/** The iceudp class */ -struct _JingleIceUdpClass -{ - JingleTransportClass parent_class; /**< The parent class. */ - - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); -}; - -/** The iceudp class's private data */ -struct _JingleIceUdp -{ - JingleTransport parent; /**< The parent of this object. */ - JingleIceUdpPrivate *priv; /**< The private data of this object. */ -}; - -struct _JingleIceUdpCandidate -{ - guint component; - gchar *foundation; - guint generation; - gchar *id; - gchar *ip; - guint network; - guint port; - guint priority; - gchar *protocol; - gchar *reladdr; - guint relport; - gchar *type; - - gchar *username; - gchar *password; - - gboolean rem_known; /* TRUE if the remote side knows - * about this candidate */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -GType jingle_iceudp_candidate_get_type(void); - -/** - * Gets the iceudp class's GType - * - * @return The iceudp class's GType. - */ -GType jingle_iceudp_get_type(void); - -JingleIceUdpCandidate *jingle_iceudp_candidate_new(guint component, - const gchar *foundation, guint generation, const gchar *id, - const gchar *ip, guint network, guint port, guint priority, - const gchar *protocol, const gchar *type, - const gchar *username, const gchar *password); -void jingle_iceudp_add_local_candidate(JingleIceUdp *iceudp, JingleIceUdpCandidate *candidate); -GList *jingle_iceudp_get_remote_candidates(JingleIceUdp *iceudp); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_ICEUDP_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,462 +0,0 @@ -/* - * @file jingle.c - * - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "network.h" - -#include "content.h" -#include "debug.h" -#include "jingle.h" -#include "session.h" -#include "iceudp.h" -#include "rawudp.h" -#include "rtp.h" - -#include <string.h> - -GType -jingle_get_type(const gchar *type) -{ - if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) - return JINGLE_TYPE_RAWUDP; - else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) - return JINGLE_TYPE_ICEUDP; -#if 0 - else if (!strcmp(type, JINGLE_TRANSPORT_SOCKS)) - return JINGLE_TYPE_SOCKS; - else if (!strcmp(type, JINGLE_TRANSPORT_IBB)) - return JINGLE_TYPE_IBB; -#endif -#ifdef USE_VV - else if (!strcmp(type, JINGLE_APP_RTP)) - return JINGLE_TYPE_RTP; -#endif -#if 0 - else if (!strcmp(type, JINGLE_APP_FT)) - return JINGLE_TYPE_FT; - else if (!strcmp(type, JINGLE_APP_XML)) - return JINGLE_TYPE_XML; -#endif - else - return G_TYPE_NONE; -} - -static void -jingle_handle_unknown_type(JingleSession *session, xmlnode *jingle) -{ - /* Send error */ -} - -static void -jingle_handle_content_accept(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - jingle_session_accept_content(session, name, creator); - /* signal here */ - } -} - -static void -jingle_handle_content_add(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - JingleContent *pending_content = - jingle_content_parse(content); - if (pending_content == NULL) { - purple_debug_error("jingle", - "Error parsing \"content-add\" content.\n"); - /* XXX: send error here */ - } else { - jingle_session_add_pending_content(session, - pending_content); - } - } - - /* XXX: signal here */ -} - -static void -jingle_handle_content_modify(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *local_content = jingle_session_find_content(session, name, creator); - - if (local_content != NULL) { - const gchar *senders = xmlnode_get_attrib(content, "senders"); - gchar *local_senders = jingle_content_get_senders(local_content); - if (strcmp(senders, local_senders)) - jingle_content_modify(local_content, senders); - g_free(local_senders); - } else { - purple_debug_error("jingle", "content_modify: unknown content\n"); - /* XXX: send error */ - } - } -} - -static void -jingle_handle_content_reject(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - jingle_session_remove_pending_content(session, name, creator); - /* signal here */ - } -} - -static void -jingle_handle_content_remove(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - jingle_session_remove_content(session, name, creator); - } -} - -static void -jingle_handle_description_info(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - jingle_session_accept_session(session); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *parsed_content = - jingle_session_find_content(session, name, creator); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_content_handle_action(parsed_content, content, - JINGLE_DESCRIPTION_INFO); - } - } -} - -static void -jingle_handle_security_info(JingleSession *session, xmlnode *jingle) -{ - jabber_iq_send(jingle_session_create_ack(session, jingle)); -} - -static void -jingle_handle_session_accept(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - jingle_session_accept_session(session); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *parsed_content = - jingle_session_find_content(session, name, creator); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_content_handle_action(parsed_content, content, - JINGLE_SESSION_ACCEPT); - } - } -} - -static void -jingle_handle_session_info(JingleSession *session, xmlnode *jingle) -{ - jabber_iq_send(jingle_session_create_ack(session, jingle)); - /* XXX: call signal */ -} - -static void -jingle_handle_session_initiate(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - for (; content; content = xmlnode_get_next_twin(content)) { - JingleContent *parsed_content = jingle_content_parse(content); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_session_add_content(session, parsed_content); - jingle_content_handle_action(parsed_content, content, - JINGLE_SESSION_INITIATE); - } - } - - jabber_iq_send(jingle_session_create_ack(session, jingle)); -} - -static void -jingle_handle_session_terminate(JingleSession *session, xmlnode *jingle) -{ - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - jingle_session_handle_action(session, jingle, - JINGLE_SESSION_TERMINATE); - /* display reason? */ - g_object_unref(session); -} - -static void -jingle_handle_transport_accept(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *content = jingle_session_find_content(session, name, creator); - jingle_content_accept_transport(content); - } -} - -static void -jingle_handle_transport_info(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *parsed_content = - jingle_session_find_content(session, name, creator); - if (parsed_content == NULL) { - purple_debug_error("jingle", "Error parsing content\n"); - /* XXX: send error */ - } else { - jingle_content_handle_action(parsed_content, content, - JINGLE_TRANSPORT_INFO); - } - } -} - -static void -jingle_handle_transport_reject(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - JingleContent *content = jingle_session_find_content(session, name, creator); - jingle_content_remove_pending_transport(content); - } -} - -static void -jingle_handle_transport_replace(JingleSession *session, xmlnode *jingle) -{ - xmlnode *content = xmlnode_get_child(jingle, "content"); - - jabber_iq_send(jingle_session_create_ack(session, jingle)); - - for (; content; content = xmlnode_get_next_twin(content)) { - const gchar *name = xmlnode_get_attrib(content, "name"); - const gchar *creator = xmlnode_get_attrib(content, "creator"); - xmlnode *xmltransport = xmlnode_get_child(content, "transport"); - JingleTransport *transport = jingle_transport_parse(xmltransport); - JingleContent *content = jingle_session_find_content(session, name, creator); - - jingle_content_set_pending_transport(content, transport); - } -} - -typedef struct { - const char *name; - void (*handler)(JingleSession*, xmlnode*); -} JingleAction; - -static const JingleAction jingle_actions[] = { - {"unknown-type", jingle_handle_unknown_type}, - {"content-accept", jingle_handle_content_accept}, - {"content-add", jingle_handle_content_add}, - {"content-modify", jingle_handle_content_modify}, - {"content-reject", jingle_handle_content_reject}, - {"content-remove", jingle_handle_content_remove}, - {"description-info", jingle_handle_description_info}, - {"security-info", jingle_handle_security_info}, - {"session-accept", jingle_handle_session_accept}, - {"session-info", jingle_handle_session_info}, - {"session-initiate", jingle_handle_session_initiate}, - {"session-terminate", jingle_handle_session_terminate}, - {"transport-accept", jingle_handle_transport_accept}, - {"transport-info", jingle_handle_transport_info}, - {"transport-reject", jingle_handle_transport_reject}, - {"transport-replace", jingle_handle_transport_replace}, -}; - -const gchar * -jingle_get_action_name(JingleActionType action) -{ - return jingle_actions[action].name; -} - -JingleActionType -jingle_get_action_type(const gchar *action) -{ - static const int num_actions = - sizeof(jingle_actions)/sizeof(JingleAction); - /* Start at 1 to skip the unknown-action type */ - int i = 1; - for (; i < num_actions; ++i) { - if (!strcmp(action, jingle_actions[i].name)) - return i; - } - return JINGLE_UNKNOWN_TYPE; -} - -void -jingle_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *jingle) -{ - const gchar *action; - const gchar *sid; - JingleActionType action_type; - JingleSession *session; - - if (type != JABBER_IQ_SET) { - /* TODO: send iq error here */ - return; - } - - if (!(action = xmlnode_get_attrib(jingle, "action"))) { - /* TODO: send iq error here */ - return; - } - - action_type = jingle_get_action_type(action); - - purple_debug_info("jabber", "got Jingle package action = %s\n", - action); - - if (!(sid = xmlnode_get_attrib(jingle, "sid"))) { - /* send iq error here */ - return; - } - - if (!(session = jingle_session_find_by_sid(js, sid)) - && strcmp(action, "session-initiate")) { - purple_debug_error("jingle", "jabber_jingle_session_parse couldn't find session\n"); - /* send iq error here */ - return; - } - - if (action_type == JINGLE_SESSION_INITIATE) { - if (session) { - /* This should only happen if you start a session with yourself */ - purple_debug_error("jingle", "Jingle session with " - "id={%s} already exists\n", sid); - /* send iq error */ - return; - } else { - char *own_jid = g_strdup_printf("%s@%s/%s", js->user->node, - js->user->domain, js->user->resource); - session = jingle_session_create(js, sid, own_jid, from, FALSE); - g_free(own_jid); - } - } - - jingle_actions[action_type].handler(session, jingle); -} - -static void -jingle_terminate_sessions_gh(gpointer key, gpointer value, gpointer user_data) -{ - g_object_unref(value); -} - -void -jingle_terminate_sessions(JabberStream *js) -{ - if (js->sessions) - g_hash_table_foreach(js->sessions, - jingle_terminate_sessions_gh, NULL); -} - -GParameter * -jingle_get_params(JabberStream *js, guint *num) -{ - /* don't set a STUN server if one is set globally in prefs, in that case - this will be handled in media.c */ - gboolean has_account_stun = js->stun_ip && !purple_network_get_stun_ip(); - guint num_params = has_account_stun ? 2 : 0; - GParameter *params = NULL; - - if (num_params > 0) { - params = g_new0(GParameter, num_params); - - purple_debug_info("jabber", - "setting param stun-ip for stream using auto-discovered IP: %s\n", - js->stun_ip); - params[0].name = "stun-ip"; - g_value_init(¶ms[0].value, G_TYPE_STRING); - g_value_set_string(¶ms[0].value, js->stun_ip); - purple_debug_info("jabber", - "setting param stun-port for stream using auto-discovered port: %d\n", - js->stun_port); - params[1].name = "stun-port"; - g_value_init(¶ms[1].value, G_TYPE_UINT); - g_value_set_uint(¶ms[1].value, js->stun_port); - } - - *num = num_params; - return params; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/jingle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * @file jingle.h - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA - */ - -#ifndef PURPLE_JABBER_JINGLE_H -#define PURPLE_JABBER_JINGLE_H - -#include "jabber.h" - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#ifdef __cplusplus -extern "C" { -#endif - -#define JINGLE "urn:xmpp:jingle:1" -#define JINGLE_ERROR "urn:xmpp:jingle:errors:0" -#define JINGLE_APP_FT "urn:xmpp:jingle:apps:file-transfer:1" -#define JINGLE_APP_RTP "urn:xmpp:jingle:apps:rtp:1" -#define JINGLE_APP_RTP_ERROR "urn:xmpp:jingle:apps:rtp:errors:1" -#define JINGLE_APP_RTP_INFO "urn:xmpp:jingle:apps:rtp:info:1" -#define JINGLE_APP_RTP_SUPPORT_AUDIO "urn:xmpp:jingle:apps:rtp:audio" -#define JINGLE_APP_RTP_SUPPORT_VIDEO "urn:xmpp:jingle:apps:rtp:video" -#define JINGLE_APP_XML "urn:xmpp:tmp:jingle:apps:xmlstream" -#define JINGLE_DTMF "urn:xmpp:jingle:dtmf:0" -#define JINGLE_TRANSPORT_S5B "urn:xmpp:jingle:transports:s5b:0" -#define JINGLE_TRANSPORT_IBB "urn:xmpp:jingle:transports:ibb:0" -#define JINGLE_TRANSPORT_ICEUDP "urn:xmpp:jingle:transports:ice-udp:1" -#define JINGLE_TRANSPORT_RAWUDP "urn:xmpp:jingle:transports:raw-udp:1" - -typedef enum { - JINGLE_UNKNOWN_TYPE, - JINGLE_CONTENT_ACCEPT, - JINGLE_CONTENT_ADD, - JINGLE_CONTENT_MODIFY, - JINGLE_CONTENT_REJECT, - JINGLE_CONTENT_REMOVE, - JINGLE_DESCRIPTION_INFO, - JINGLE_SECURITY_INFO, - JINGLE_SESSION_ACCEPT, - JINGLE_SESSION_INFO, - JINGLE_SESSION_INITIATE, - JINGLE_SESSION_TERMINATE, - JINGLE_TRANSPORT_ACCEPT, - JINGLE_TRANSPORT_INFO, - JINGLE_TRANSPORT_REJECT, - JINGLE_TRANSPORT_REPLACE, -} JingleActionType; - -const gchar *jingle_get_action_name(JingleActionType action); -JingleActionType jingle_get_action_type(const gchar *action); - -GType jingle_get_type(const gchar *type); - -void jingle_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *child); - -void jingle_terminate_sessions(JabberStream *js); - -/* create a GParam array given autoconfigured STUN (and later perhaps TURN). - if google_talk is TRUE, set compatability mode to GOOGLE_TALK */ -GParameter *jingle_get_params(JabberStream *js, guint *num_params); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,355 +0,0 @@ -/** - * @file rawudp.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "rawudp.h" -#include "jingle.h" -#include "debug.h" - -#include <string.h> - -struct _JingleRawUdpPrivate -{ - GList *local_candidates; - GList *remote_candidates; -}; - -#define JINGLE_RAWUDP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RAWUDP, JingleRawUdpPrivate)) - -static void jingle_rawudp_class_init (JingleRawUdpClass *klass); -static void jingle_rawudp_init (JingleRawUdp *rawudp); -static void jingle_rawudp_finalize (GObject *object); -static void jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleTransport *jingle_rawudp_parse_internal(xmlnode *rawudp); -static xmlnode *jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); - -static JingleTransportClass *parent_class = NULL; - -enum { - PROP_0, - PROP_LOCAL_CANDIDATES, - PROP_REMOTE_CANDIDATES, -}; - -static JingleRawUdpCandidate * -jingle_rawudp_candidate_copy(JingleRawUdpCandidate *candidate) -{ - JingleRawUdpCandidate *new_candidate = g_new0(JingleRawUdpCandidate, 1); - new_candidate->generation = candidate->generation; - new_candidate->component = candidate->component; - new_candidate->id = g_strdup(candidate->id); - new_candidate->ip = g_strdup(candidate->ip); - new_candidate->port = candidate->port; - - new_candidate->rem_known = candidate->rem_known; - return new_candidate; -} - -static void -jingle_rawudp_candidate_free(JingleRawUdpCandidate *candidate) -{ - g_free(candidate->id); - g_free(candidate->ip); -} - -GType -jingle_rawudp_candidate_get_type() -{ - static GType type = 0; - - if (type == 0) { - type = g_boxed_type_register_static("JingleRawUdpCandidate", - (GBoxedCopyFunc)jingle_rawudp_candidate_copy, - (GBoxedFreeFunc)jingle_rawudp_candidate_free); - } - return type; -} - -JingleRawUdpCandidate * -jingle_rawudp_candidate_new(const gchar *id, guint generation, guint component, const gchar *ip, guint port) -{ - JingleRawUdpCandidate *candidate = g_new0(JingleRawUdpCandidate, 1); - candidate->generation = generation; - candidate->component = component; - candidate->id = g_strdup(id); - candidate->ip = g_strdup(ip); - candidate->port = port; - - candidate->rem_known = FALSE; - return candidate; -} - -GType -jingle_rawudp_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleRawUdpClass), - NULL, - NULL, - (GClassInitFunc) jingle_rawudp_class_init, - NULL, - NULL, - sizeof(JingleRawUdp), - 0, - (GInstanceInitFunc) jingle_rawudp_init, - NULL - }; - type = g_type_register_static(JINGLE_TYPE_TRANSPORT, "JingleRawUdp", &info, 0); - } - return type; -} - -static void -jingle_rawudp_class_init (JingleRawUdpClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_rawudp_finalize; - gobject_class->set_property = jingle_rawudp_set_property; - gobject_class->get_property = jingle_rawudp_get_property; - klass->parent_class.to_xml = jingle_rawudp_to_xml_internal; - klass->parent_class.parse = jingle_rawudp_parse_internal; - klass->parent_class.transport_type = JINGLE_TRANSPORT_RAWUDP; - - g_object_class_install_property(gobject_class, PROP_LOCAL_CANDIDATES, - g_param_spec_pointer("local-candidates", - "Local candidates", - "The local candidates for this transport.", - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_REMOTE_CANDIDATES, - g_param_spec_pointer("remote-candidates", - "Remote candidates", - "The remote candidates for this transport.", - G_PARAM_READABLE)); - - g_type_class_add_private(klass, sizeof(JingleRawUdpPrivate)); -} - -static void -jingle_rawudp_init (JingleRawUdp *rawudp) -{ - rawudp->priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); - rawudp->priv->local_candidates = NULL; - rawudp->priv->remote_candidates = NULL; -} - -static void -jingle_rawudp_finalize (GObject *rawudp) -{ -/* JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); */ - purple_debug_info("jingle","jingle_rawudp_finalize\n"); - - G_OBJECT_CLASS(parent_class)->finalize(rawudp); -} - -static void -jingle_rawudp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleRawUdp *rawudp; - g_return_if_fail(JINGLE_IS_RAWUDP(object)); - - rawudp = JINGLE_RAWUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - rawudp->priv->local_candidates = - g_value_get_pointer(value); - break; - case PROP_REMOTE_CANDIDATES: - rawudp->priv->remote_candidates = - g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_rawudp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleRawUdp *rawudp; - g_return_if_fail(JINGLE_IS_RAWUDP(object)); - - rawudp = JINGLE_RAWUDP(object); - - switch (prop_id) { - case PROP_LOCAL_CANDIDATES: - g_value_set_pointer(value, rawudp->priv->local_candidates); - break; - case PROP_REMOTE_CANDIDATES: - g_value_set_pointer(value, rawudp->priv->remote_candidates); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -void -jingle_rawudp_add_local_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate) -{ - GList *iter = rawudp->priv->local_candidates; - - for (; iter; iter = g_list_next(iter)) { - JingleRawUdpCandidate *c = iter->data; - if (!strcmp(c->id, candidate->id)) { - guint generation = c->generation + 1; - - g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, c); - rawudp->priv->local_candidates = g_list_delete_link( - rawudp->priv->local_candidates, iter); - - candidate->generation = generation; - - rawudp->priv->local_candidates = g_list_append( - rawudp->priv->local_candidates, candidate); - return; - } - } - - rawudp->priv->local_candidates = g_list_append( - rawudp->priv->local_candidates, candidate); -} - -GList * -jingle_rawudp_get_remote_candidates(JingleRawUdp *rawudp) -{ - return g_list_copy(rawudp->priv->remote_candidates); -} - -static JingleRawUdpCandidate * -jingle_rawudp_get_remote_candidate_by_id(JingleRawUdp *rawudp, gchar *id) -{ - GList *iter = rawudp->priv->remote_candidates; - for (; iter; iter = g_list_next(iter)) { - JingleRawUdpCandidate *candidate = iter->data; - if (!strcmp(candidate->id, id)) { - return candidate; - } - } - return NULL; -} - -static void -jingle_rawudp_add_remote_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate) -{ - JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(rawudp); - JingleRawUdpCandidate *rawudp_candidate = - jingle_rawudp_get_remote_candidate_by_id(rawudp, candidate->id); - if (rawudp_candidate != NULL) { - priv->remote_candidates = g_list_remove( - priv->remote_candidates, rawudp_candidate); - g_boxed_free(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate); - } - priv->remote_candidates = g_list_append(priv->remote_candidates, candidate); -} - -static JingleTransport * -jingle_rawudp_parse_internal(xmlnode *rawudp) -{ - JingleTransport *transport = parent_class->parse(rawudp); - JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); - xmlnode *candidate = xmlnode_get_child(rawudp, "candidate"); - JingleRawUdpCandidate *rawudp_candidate = NULL; - - for (; candidate; candidate = xmlnode_get_next_twin(candidate)) { - const gchar *id = xmlnode_get_attrib(candidate, "id"); - const gchar *generation = xmlnode_get_attrib(candidate, "generation"); - const gchar *component = xmlnode_get_attrib(candidate, "component"); - const gchar *ip = xmlnode_get_attrib(candidate, "ip"); - const gchar *port = xmlnode_get_attrib(candidate, "port"); - - if (!id || !generation || !component || !ip || !port) - continue; - - rawudp_candidate = jingle_rawudp_candidate_new( - id, - atoi(generation), - atoi(component), - ip, - atoi(port)); - rawudp_candidate->rem_known = TRUE; - jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); - } - - if (rawudp_candidate != NULL && - g_list_length(priv->remote_candidates) == 1) { - /* manufacture rtcp candidate */ - rawudp_candidate = g_boxed_copy(JINGLE_TYPE_RAWUDP_CANDIDATE, rawudp_candidate); - rawudp_candidate->component = 2; - rawudp_candidate->port = rawudp_candidate->port + 1; - rawudp_candidate->rem_known = TRUE; - jingle_rawudp_add_remote_candidate(JINGLE_RAWUDP(transport), rawudp_candidate); - } - - return transport; -} - -static xmlnode * -jingle_rawudp_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - xmlnode *node = parent_class->to_xml(transport, content, action); - - if (action == JINGLE_SESSION_INITIATE || - action == JINGLE_TRANSPORT_INFO || - action == JINGLE_SESSION_ACCEPT) { - JingleRawUdpPrivate *priv = JINGLE_RAWUDP_GET_PRIVATE(transport); - GList *iter = priv->local_candidates; - - for (; iter; iter = g_list_next(iter)) { - JingleRawUdpCandidate *candidate = iter->data; - xmlnode *xmltransport; - gchar *generation, *component, *port; - - if (candidate->rem_known == TRUE) - continue; - candidate->rem_known = TRUE; - - xmltransport = xmlnode_new_child(node, "candidate"); - generation = g_strdup_printf("%d", candidate->generation); - component = g_strdup_printf("%d", candidate->component); - port = g_strdup_printf("%d", candidate->port); - - xmlnode_set_attrib(xmltransport, "generation", generation); - xmlnode_set_attrib(xmltransport, "component", component); - xmlnode_set_attrib(xmltransport, "id", candidate->id); - xmlnode_set_attrib(xmltransport, "ip", candidate->ip); - xmlnode_set_attrib(xmltransport, "port", port); - - g_free(port); - g_free(generation); - } - } - - return node; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rawudp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file rawudp.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_RAWUDP_H -#define PURPLE_JABBER_JINGLE_RAWUDP_H - -#include <glib.h> -#include <glib-object.h> - -#include "transport.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_RAWUDP (jingle_rawudp_get_type()) -#define JINGLE_TYPE_RAWUDP_CANDIDATE (jingle_rawudp_candidate_get_type()) -#define JINGLE_RAWUDP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_RAWUDP, JingleRawUdp)) -#define JINGLE_RAWUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_RAWUDP, JingleRawUdpClass)) -#define JINGLE_IS_RAWUDP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_RAWUDP)) -#define JINGLE_IS_RAWUDP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_RAWUDP)) -#define JINGLE_RAWUDP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_RAWUDP, JingleRawUdpClass)) - -/** @copydoc _JingleRawUdp */ -typedef struct _JingleRawUdp JingleRawUdp; -/** @copydoc _JingleRawUdpClass */ -typedef struct _JingleRawUdpClass JingleRawUdpClass; -/** @copydoc _JingleRawUdpPrivate */ -typedef struct _JingleRawUdpPrivate JingleRawUdpPrivate; -/** @copydoc _JingleRawUdpCandidate */ -typedef struct _JingleRawUdpCandidate JingleRawUdpCandidate; - -/** The rawudp class */ -struct _JingleRawUdpClass -{ - JingleTransportClass parent_class; /**< The parent class. */ - - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); -}; - -/** The rawudp class's private data */ -struct _JingleRawUdp -{ - JingleTransport parent; /**< The parent of this object. */ - JingleRawUdpPrivate *priv; /**< The private data of this object. */ -}; - -struct _JingleRawUdpCandidate -{ - guint generation; - guint component; - gchar *id; - gchar *ip; - guint port; - - gboolean rem_known; /* TRUE if the remote side knows - * about this candidate */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -GType jingle_rawudp_candidate_get_type(void); - -/** - * Gets the rawudp class's GType - * - * @return The rawudp class's GType. - */ -GType jingle_rawudp_get_type(void); - -JingleRawUdpCandidate *jingle_rawudp_candidate_new(const gchar *id, - guint generation, guint component, const gchar *ip, guint port); -void jingle_rawudp_add_local_candidate(JingleRawUdp *rawudp, JingleRawUdpCandidate *candidate); -GList *jingle_rawudp_get_remote_candidates(JingleRawUdp *rawudp); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_RAWUDP_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,981 +0,0 @@ -/** - * @file rtp.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "config.h" - -#ifdef USE_VV - -#include "jabber.h" -#include "jingle.h" -#include "media.h" -#include "mediamanager.h" -#include "iceudp.h" -#include "rawudp.h" -#include "rtp.h" -#include "session.h" -#include "debug.h" - -#include <string.h> - -struct _JingleRtpPrivate -{ - gchar *media_type; - gchar *ssrc; -}; - -#define JINGLE_RTP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_RTP, JingleRtpPrivate)) - -static void jingle_rtp_class_init (JingleRtpClass *klass); -static void jingle_rtp_init (JingleRtp *rtp); -static void jingle_rtp_finalize (GObject *object); -static void jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static JingleContent *jingle_rtp_parse_internal(xmlnode *rtp); -static xmlnode *jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action); -static void jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *jingle, JingleActionType action); - -static PurpleMedia *jingle_rtp_get_media(JingleSession *session); - -static JingleContentClass *parent_class = NULL; -#if 0 -enum { - LAST_SIGNAL -}; -static guint jingle_rtp_signals[LAST_SIGNAL] = {0}; -#endif - -enum { - PROP_0, - PROP_MEDIA_TYPE, - PROP_SSRC, -}; - -GType -jingle_rtp_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleRtpClass), - NULL, - NULL, - (GClassInitFunc) jingle_rtp_class_init, - NULL, - NULL, - sizeof(JingleRtp), - 0, - (GInstanceInitFunc) jingle_rtp_init, - NULL - }; - type = g_type_register_static(JINGLE_TYPE_CONTENT, "JingleRtp", &info, 0); - } - return type; -} - -static void -jingle_rtp_class_init (JingleRtpClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_rtp_finalize; - gobject_class->set_property = jingle_rtp_set_property; - gobject_class->get_property = jingle_rtp_get_property; - klass->parent_class.to_xml = jingle_rtp_to_xml_internal; - klass->parent_class.parse = jingle_rtp_parse_internal; - klass->parent_class.description_type = JINGLE_APP_RTP; - klass->parent_class.handle_action = jingle_rtp_handle_action_internal; - - g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE, - g_param_spec_string("media-type", - "Media Type", - "The media type (\"audio\" or \"video\") for this rtp session.", - NULL, - G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, PROP_SSRC, - g_param_spec_string("ssrc", - "ssrc", - "The ssrc for this rtp session.", - NULL, - G_PARAM_READWRITE)); - - g_type_class_add_private(klass, sizeof(JingleRtpPrivate)); -} - -static void -jingle_rtp_init (JingleRtp *rtp) -{ - rtp->priv = JINGLE_RTP_GET_PRIVATE(rtp); - memset(rtp->priv, 0, sizeof(*rtp->priv)); -} - -static void -jingle_rtp_finalize (GObject *rtp) -{ - JingleRtpPrivate *priv = JINGLE_RTP_GET_PRIVATE(rtp); - purple_debug_info("jingle-rtp","jingle_rtp_finalize\n"); - - g_free(priv->media_type); - g_free(priv->ssrc); - - G_OBJECT_CLASS(parent_class)->finalize(rtp); -} - -static void -jingle_rtp_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleRtp *rtp; - g_return_if_fail(JINGLE_IS_RTP(object)); - - rtp = JINGLE_RTP(object); - - switch (prop_id) { - case PROP_MEDIA_TYPE: - g_free(rtp->priv->media_type); - rtp->priv->media_type = g_value_dup_string(value); - break; - case PROP_SSRC: - g_free(rtp->priv->ssrc); - rtp->priv->ssrc = g_value_dup_string(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_rtp_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleRtp *rtp; - g_return_if_fail(JINGLE_IS_RTP(object)); - - rtp = JINGLE_RTP(object); - - switch (prop_id) { - case PROP_MEDIA_TYPE: - g_value_set_string(value, rtp->priv->media_type); - break; - case PROP_SSRC: - g_value_set_string(value, rtp->priv->ssrc); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -gchar * -jingle_rtp_get_media_type(JingleContent *content) -{ - gchar *media_type; - g_object_get(content, "media-type", &media_type, NULL); - return media_type; -} - -gchar * -jingle_rtp_get_ssrc(JingleContent *content) -{ - gchar *ssrc; - g_object_get(content, "ssrc", &ssrc, NULL); - return ssrc; -} - -static PurpleMedia * -jingle_rtp_get_media(JingleSession *session) -{ - JabberStream *js = jingle_session_get_js(session); - PurpleMedia *media = NULL; - GList *iter = purple_media_manager_get_media_by_account( - purple_media_manager_get(), - purple_connection_get_account(js->gc)); - - for (; iter; iter = g_list_delete_link(iter, iter)) { - JingleSession *media_session = - purple_media_get_prpl_data(iter->data); - if (media_session == session) { - media = iter->data; - break; - } - } - if (iter != NULL) - g_list_free(iter); - - return media; -} - -static JingleRawUdpCandidate * -jingle_rtp_candidate_to_rawudp(JingleSession *session, guint generation, - PurpleMediaCandidate *candidate) -{ - gchar *id = jabber_get_next_id(jingle_session_get_js(session)); - gchar *ip = purple_media_candidate_get_ip(candidate); - JingleRawUdpCandidate *rawudp_candidate = - jingle_rawudp_candidate_new(id, generation, - purple_media_candidate_get_component_id(candidate), - ip, purple_media_candidate_get_port(candidate)); - g_free(ip); - g_free(id); - return rawudp_candidate; -} - -static JingleIceUdpCandidate * -jingle_rtp_candidate_to_iceudp(JingleSession *session, guint generation, - PurpleMediaCandidate *candidate) -{ - gchar *id = jabber_get_next_id(jingle_session_get_js(session)); - gchar *ip = purple_media_candidate_get_ip(candidate); - gchar *username = purple_media_candidate_get_username(candidate); - gchar *password = purple_media_candidate_get_password(candidate); - PurpleMediaCandidateType type = - purple_media_candidate_get_candidate_type(candidate); - - JingleIceUdpCandidate *iceudp_candidate = jingle_iceudp_candidate_new( - purple_media_candidate_get_component_id(candidate), - purple_media_candidate_get_foundation(candidate), - generation, id, ip, 0, - purple_media_candidate_get_port(candidate), - purple_media_candidate_get_priority(candidate), "udp", - type == PURPLE_MEDIA_CANDIDATE_TYPE_HOST ? "host" : - type == PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX ? "srflx" : - type == PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX ? "prflx" : - type == PURPLE_MEDIA_CANDIDATE_TYPE_RELAY ? "relay" : - "", username, password); - iceudp_candidate->reladdr = - purple_media_candidate_get_base_ip(candidate); - iceudp_candidate->relport = - purple_media_candidate_get_base_port(candidate); - g_free(password); - g_free(username); - g_free(ip); - g_free(id); - return iceudp_candidate; -} - -static JingleTransport * -jingle_rtp_candidates_to_transport(JingleSession *session, GType type, guint generation, GList *candidates) -{ - if (type == JINGLE_TYPE_RAWUDP) { - JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_RAWUDP); - JingleRawUdpCandidate *rawudp_candidate; - for (; candidates; candidates = g_list_next(candidates)) { - PurpleMediaCandidate *candidate = candidates->data; - rawudp_candidate = jingle_rtp_candidate_to_rawudp( - session, generation, candidate); - jingle_rawudp_add_local_candidate( - JINGLE_RAWUDP(transport), - rawudp_candidate); - } - return transport; - } else if (type == JINGLE_TYPE_ICEUDP) { - JingleTransport *transport = jingle_transport_create(JINGLE_TRANSPORT_ICEUDP); - JingleIceUdpCandidate *iceudp_candidate; - for (; candidates; candidates = g_list_next(candidates)) { - PurpleMediaCandidate *candidate = candidates->data; - iceudp_candidate = jingle_rtp_candidate_to_iceudp( - session, generation, candidate); - jingle_iceudp_add_local_candidate( - JINGLE_ICEUDP(transport), - iceudp_candidate); - } - return transport; - } else { - return NULL; - } -} - -static GList * -jingle_rtp_transport_to_candidates(JingleTransport *transport) -{ - const gchar *type = jingle_transport_get_transport_type(transport); - GList *ret = NULL; - if (!strcmp(type, JINGLE_TRANSPORT_RAWUDP)) { - GList *candidates = jingle_rawudp_get_remote_candidates(JINGLE_RAWUDP(transport)); - - for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { - JingleRawUdpCandidate *candidate = candidates->data; - ret = g_list_append(ret, purple_media_candidate_new( - "", candidate->component, - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX, - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - candidate->ip, candidate->port)); - } - - return ret; - } else if (!strcmp(type, JINGLE_TRANSPORT_ICEUDP)) { - GList *candidates = jingle_iceudp_get_remote_candidates(JINGLE_ICEUDP(transport)); - - for (; candidates; candidates = g_list_delete_link(candidates, candidates)) { - JingleIceUdpCandidate *candidate = candidates->data; - PurpleMediaCandidate *new_candidate = purple_media_candidate_new( - candidate->foundation, candidate->component, - !strcmp(candidate->type, "host") ? - PURPLE_MEDIA_CANDIDATE_TYPE_HOST : - !strcmp(candidate->type, "srflx") ? - PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX : - !strcmp(candidate->type, "prflx") ? - PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX : - !strcmp(candidate->type, "relay") ? - PURPLE_MEDIA_CANDIDATE_TYPE_RELAY : 0, - PURPLE_MEDIA_NETWORK_PROTOCOL_UDP, - candidate->ip, candidate->port); - g_object_set(new_candidate, - "base-ip", candidate->reladdr, - "base-port", candidate->relport, - "username", candidate->username, - "password", candidate->password, - "priority", candidate->priority, NULL); - ret = g_list_append(ret, new_candidate); - } - - return ret; - } else { - return NULL; - } -} - -static void jingle_rtp_ready(JingleSession *session); - -static void -jingle_rtp_candidates_prepared_cb(PurpleMedia *media, - gchar *sid, gchar *name, JingleSession *session) -{ - JingleContent *content = jingle_session_find_content( - session, sid, NULL); - JingleTransport *oldtransport, *transport; - GList *candidates; - - purple_debug_info("jingle-rtp", "jingle_rtp_candidates_prepared_cb\n"); - - if (content == NULL) { - purple_debug_error("jingle-rtp", - "jingle_rtp_candidates_prepared_cb: " - "Can't find session %s\n", sid); - return; - } - - oldtransport = jingle_content_get_transport(content); - candidates = purple_media_get_local_candidates(media, sid, name); - transport = JINGLE_TRANSPORT(jingle_rtp_candidates_to_transport( - session, JINGLE_IS_RAWUDP(oldtransport) ? - JINGLE_TYPE_RAWUDP : JINGLE_TYPE_ICEUDP, - 0, candidates)); - - g_list_free(candidates); - g_object_unref(oldtransport); - - jingle_content_set_pending_transport(content, transport); - jingle_content_accept_transport(content); - - jingle_rtp_ready(session); -} - -static void -jingle_rtp_codecs_changed_cb(PurpleMedia *media, gchar *sid, - JingleSession *session) -{ - purple_debug_info("jingle-rtp", "jingle_rtp_codecs_changed_cb: " - "session_id: %s jingle_session: %p\n", sid, session); - jingle_rtp_ready(session); -} - -static void -jingle_rtp_new_candidate_cb(PurpleMedia *media, gchar *sid, gchar *name, PurpleMediaCandidate *candidate, JingleSession *session) -{ - JingleContent *content = jingle_session_find_content( - session, sid, NULL); - JingleTransport *transport; - - purple_debug_info("jingle-rtp", "jingle_rtp_new_candidate_cb\n"); - - if (content == NULL) { - purple_debug_error("jingle-rtp", - "jingle_rtp_new_candidate_cb: " - "Can't find session %s\n", sid); - return; - } - - transport = jingle_content_get_transport(content); - - if (JINGLE_IS_ICEUDP(transport)) - jingle_iceudp_add_local_candidate(JINGLE_ICEUDP(transport), - jingle_rtp_candidate_to_iceudp( - session, 1, candidate)); - else if (JINGLE_IS_RAWUDP(transport)) - jingle_rawudp_add_local_candidate(JINGLE_RAWUDP(transport), - jingle_rtp_candidate_to_rawudp( - session, 1, candidate)); - - g_object_unref(transport); - - jabber_iq_send(jingle_session_to_packet(session, - JINGLE_TRANSPORT_INFO)); -} - -static void -jingle_rtp_initiate_ack_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JingleSession *session = data; - - if (type == JABBER_IQ_ERROR || xmlnode_get_child(packet, "error")) { - purple_media_end(jingle_rtp_get_media(session), NULL, NULL); - g_object_unref(session); - return; - } -} - -static void -jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaState state, - gchar *sid, gchar *name, JingleSession *session) -{ - purple_debug_info("jingle-rtp", "state-changed: state %d " - "id: %s name: %s\n", state, sid ? sid : "(null)", - name ? name : "(null)"); -} - -static void -jingle_rtp_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, - gchar *sid, gchar *name, gboolean local, - JingleSession *session) -{ - purple_debug_info("jingle-rtp", "stream-info: type %d " - "id: %s name: %s\n", type, sid ? sid : "(null)", - name ? name : "(null)"); - - g_return_if_fail(JINGLE_IS_SESSION(session)); - - if (type == PURPLE_MEDIA_INFO_HANGUP) { - jabber_iq_send(jingle_session_terminate_packet( - session, "success")); - g_object_unref(session); - } else if (type == PURPLE_MEDIA_INFO_REJECT) { - jabber_iq_send(jingle_session_terminate_packet( - session, "decline")); - g_object_unref(session); - } else if (type == PURPLE_MEDIA_INFO_ACCEPT && - jingle_session_is_initiator(session) == FALSE) { - jingle_rtp_ready(session); - } -} - -static void -jingle_rtp_ready(JingleSession *session) -{ - PurpleMedia *media = jingle_rtp_get_media(session); - - if (purple_media_candidates_prepared(media, NULL, NULL) && - purple_media_codecs_ready(media, NULL) && - (jingle_session_is_initiator(session) == TRUE || - purple_media_accepted(media, NULL, NULL))) { - if (jingle_session_is_initiator(session)) { - JabberIq *iq = jingle_session_to_packet( - session, JINGLE_SESSION_INITIATE); - jabber_iq_set_callback(iq, - jingle_rtp_initiate_ack_cb, session); - jabber_iq_send(iq); - } else { - jabber_iq_send(jingle_session_to_packet(session, - JINGLE_SESSION_ACCEPT)); - } - - g_signal_handlers_disconnect_by_func(G_OBJECT(media), - G_CALLBACK(jingle_rtp_candidates_prepared_cb), - session); - g_signal_handlers_disconnect_by_func(G_OBJECT(media), - G_CALLBACK(jingle_rtp_codecs_changed_cb), - session); - g_signal_connect(G_OBJECT(media), "new-candidate", - G_CALLBACK(jingle_rtp_new_candidate_cb), - session); - } -} - -static PurpleMedia * -jingle_rtp_create_media(JingleContent *content) -{ - JingleSession *session = jingle_content_get_session(content); - JabberStream *js = jingle_session_get_js(session); - gchar *remote_jid = jingle_session_get_remote_jid(session); - - PurpleMedia *media = purple_media_manager_create_media( - purple_media_manager_get(), - purple_connection_get_account(js->gc), - "fsrtpconference", remote_jid, - jingle_session_is_initiator(session)); - g_free(remote_jid); - - if (!media) { - purple_debug_error("jingle-rtp", "Couldn't create media session\n"); - return NULL; - } - - purple_media_set_prpl_data(media, session); - - /* connect callbacks */ - g_signal_connect(G_OBJECT(media), "candidates-prepared", - G_CALLBACK(jingle_rtp_candidates_prepared_cb), session); - g_signal_connect(G_OBJECT(media), "codecs-changed", - G_CALLBACK(jingle_rtp_codecs_changed_cb), session); - g_signal_connect(G_OBJECT(media), "state-changed", - G_CALLBACK(jingle_rtp_state_changed_cb), session); - g_signal_connect(G_OBJECT(media), "stream-info", - G_CALLBACK(jingle_rtp_stream_info_cb), session); - - g_object_unref(session); - return media; -} - -static gboolean -jingle_rtp_init_media(JingleContent *content) -{ - JingleSession *session = jingle_content_get_session(content); - PurpleMedia *media = jingle_rtp_get_media(session); - gchar *creator; - gchar *media_type; - gchar *remote_jid; - gchar *senders; - gchar *name; - const gchar *transmitter; - gboolean is_audio; - gboolean is_creator; - PurpleMediaSessionType type; - JingleTransport *transport; - GParameter *params = NULL; - guint num_params; - - /* maybe this create ought to just be in initiate and handle initiate */ - if (media == NULL) - media = jingle_rtp_create_media(content); - - if (media == NULL) - return FALSE; - - name = jingle_content_get_name(content); - media_type = jingle_rtp_get_media_type(content); - remote_jid = jingle_session_get_remote_jid(session); - senders = jingle_content_get_senders(content); - transport = jingle_content_get_transport(content); - - if (JINGLE_IS_RAWUDP(transport)) - transmitter = "rawudp"; - else if (JINGLE_IS_ICEUDP(transport)) - transmitter = "nice"; - else - transmitter = "notransmitter"; - g_object_unref(transport); - - is_audio = !strcmp(media_type, "audio"); - - if (!strcmp(senders, "both")) - type = is_audio == TRUE ? PURPLE_MEDIA_AUDIO - : PURPLE_MEDIA_VIDEO; - else if ((strcmp(senders, "initiator") == 0) == - jingle_session_is_initiator(session)) - type = is_audio == TRUE ? PURPLE_MEDIA_SEND_AUDIO - : PURPLE_MEDIA_SEND_VIDEO; - else - type = is_audio == TRUE ? PURPLE_MEDIA_RECV_AUDIO - : PURPLE_MEDIA_RECV_VIDEO; - - params = - jingle_get_params(jingle_session_get_js(session), &num_params); - - creator = jingle_content_get_creator(content); - if (!strcmp(creator, "initiator")) - is_creator = jingle_session_is_initiator(session); - else - is_creator = !jingle_session_is_initiator(session); - g_free(creator); - - if(!purple_media_add_stream(media, name, remote_jid, - type, is_creator, transmitter, num_params, params)) { - purple_media_end(media, NULL, NULL); - return FALSE; - } - - g_free(name); - g_free(media_type); - g_free(remote_jid); - g_free(senders); - g_free(params); - g_object_unref(session); - - return TRUE; -} - -static GList * -jingle_rtp_parse_codecs(xmlnode *description) -{ - GList *codecs = NULL; - xmlnode *codec_element = NULL; - const char *encoding_name,*id, *clock_rate; - PurpleMediaCodec *codec; - const gchar *media = xmlnode_get_attrib(description, "media"); - PurpleMediaSessionType type = - !strcmp(media, "video") ? PURPLE_MEDIA_VIDEO : - !strcmp(media, "audio") ? PURPLE_MEDIA_AUDIO : 0; - - for (codec_element = xmlnode_get_child(description, "payload-type") ; - codec_element ; - codec_element = xmlnode_get_next_twin(codec_element)) { - xmlnode *param; - gchar *codec_str; - encoding_name = xmlnode_get_attrib(codec_element, "name"); - - id = xmlnode_get_attrib(codec_element, "id"); - clock_rate = xmlnode_get_attrib(codec_element, "clockrate"); - - codec = purple_media_codec_new(atoi(id), encoding_name, - type, - clock_rate ? atoi(clock_rate) : 0); - - for (param = xmlnode_get_child(codec_element, "parameter"); - param; param = xmlnode_get_next_twin(param)) { - purple_media_codec_add_optional_parameter(codec, - xmlnode_get_attrib(param, "name"), - xmlnode_get_attrib(param, "value")); - } - - codec_str = purple_media_codec_to_string(codec); - purple_debug_info("jingle-rtp", "received codec: %s\n", codec_str); - g_free(codec_str); - - codecs = g_list_append(codecs, codec); - } - return codecs; -} - -static JingleContent * -jingle_rtp_parse_internal(xmlnode *rtp) -{ - JingleContent *content = parent_class->parse(rtp); - xmlnode *description = xmlnode_get_child(rtp, "description"); - const gchar *media_type = xmlnode_get_attrib(description, "media"); - const gchar *ssrc = xmlnode_get_attrib(description, "ssrc"); - purple_debug_info("jingle-rtp", "rtp parse\n"); - g_object_set(content, "media-type", media_type, NULL); - if (ssrc != NULL) - g_object_set(content, "ssrc", ssrc, NULL); - return content; -} - -static void -jingle_rtp_add_payloads(xmlnode *description, GList *codecs) -{ - for (; codecs ; codecs = codecs->next) { - PurpleMediaCodec *codec = (PurpleMediaCodec*)codecs->data; - GList *iter = purple_media_codec_get_optional_parameters(codec); - gchar *id, *name, *clockrate, *channels; - gchar *codec_str; - xmlnode *payload = xmlnode_new_child(description, "payload-type"); - - id = g_strdup_printf("%d", - purple_media_codec_get_id(codec)); - name = purple_media_codec_get_encoding_name(codec); - clockrate = g_strdup_printf("%d", - purple_media_codec_get_clock_rate(codec)); - channels = g_strdup_printf("%d", - purple_media_codec_get_channels(codec)); - - xmlnode_set_attrib(payload, "name", name); - xmlnode_set_attrib(payload, "id", id); - xmlnode_set_attrib(payload, "clockrate", clockrate); - xmlnode_set_attrib(payload, "channels", channels); - - g_free(channels); - g_free(clockrate); - g_free(name); - g_free(id); - - for (; iter; iter = g_list_next(iter)) { - PurpleKeyValuePair *mparam = iter->data; - xmlnode *param = xmlnode_new_child(payload, "parameter"); - xmlnode_set_attrib(param, "name", mparam->key); - xmlnode_set_attrib(param, "value", mparam->value); - } - - codec_str = purple_media_codec_to_string(codec); - purple_debug_info("jingle", "adding codec: %s\n", codec_str); - g_free(codec_str); - } -} - -static xmlnode * -jingle_rtp_to_xml_internal(JingleContent *rtp, xmlnode *content, JingleActionType action) -{ - xmlnode *node = parent_class->to_xml(rtp, content, action); - xmlnode *description = xmlnode_get_child(node, "description"); - if (description != NULL) { - JingleSession *session = jingle_content_get_session(rtp); - PurpleMedia *media = jingle_rtp_get_media(session); - gchar *media_type = jingle_rtp_get_media_type(rtp); - gchar *ssrc = jingle_rtp_get_ssrc(rtp); - gchar *name = jingle_content_get_name(rtp); - GList *codecs = purple_media_get_codecs(media, name); - - xmlnode_set_attrib(description, "media", media_type); - - if (ssrc != NULL) - xmlnode_set_attrib(description, "ssrc", ssrc); - - g_free(media_type); - g_free(name); - g_object_unref(session); - - jingle_rtp_add_payloads(description, codecs); - purple_media_codec_list_free(codecs); - } - return node; -} - -static void -jingle_rtp_handle_action_internal(JingleContent *content, xmlnode *xmlcontent, JingleActionType action) -{ - switch (action) { - case JINGLE_SESSION_ACCEPT: - case JINGLE_SESSION_INITIATE: { - JingleSession *session = jingle_content_get_session(content); - JingleTransport *transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); - xmlnode *description = xmlnode_get_child(xmlcontent, "description"); - GList *candidates = jingle_rtp_transport_to_candidates(transport); - GList *codecs = jingle_rtp_parse_codecs(description); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); - PurpleMedia *media; - - if (action == JINGLE_SESSION_INITIATE && - jingle_rtp_init_media(content) == FALSE) { - /* XXX: send error */ - jabber_iq_send(jingle_session_terminate_packet( - session, "general-error")); - g_object_unref(session); - break; - } - - media = jingle_rtp_get_media(session); - purple_media_set_remote_codecs(media, - name, remote_jid, codecs); - purple_media_add_remote_candidates(media, - name, remote_jid, candidates); - - if (action == JINGLE_SESSION_ACCEPT) - purple_media_stream_info(media, - PURPLE_MEDIA_INFO_ACCEPT, - name, remote_jid, FALSE); - - g_free(remote_jid); - g_free(name); - g_object_unref(session); - break; - } - case JINGLE_SESSION_TERMINATE: { - JingleSession *session = jingle_content_get_session(content); - PurpleMedia *media = jingle_rtp_get_media(session); - - if (media != NULL) { - purple_media_end(media, NULL, NULL); - } - - g_object_unref(session); - break; - } - case JINGLE_TRANSPORT_INFO: { - JingleSession *session = jingle_content_get_session(content); - JingleTransport *transport = jingle_transport_parse( - xmlnode_get_child(xmlcontent, "transport")); - GList *candidates = jingle_rtp_transport_to_candidates(transport); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); - - purple_media_add_remote_candidates( - jingle_rtp_get_media(session), - name, remote_jid, candidates); - - g_free(remote_jid); - g_free(name); - g_object_unref(session); - break; - } - case JINGLE_DESCRIPTION_INFO: { - JingleSession *session = - jingle_content_get_session(content); - xmlnode *description = xmlnode_get_child( - xmlcontent, "description"); - GList *codecs, *iter, *iter2, *remote_codecs = - jingle_rtp_parse_codecs(description); - gchar *name = jingle_content_get_name(content); - gchar *remote_jid = - jingle_session_get_remote_jid(session); - PurpleMedia *media; - - media = jingle_rtp_get_media(session); - - /* - * This may have problems if description-info is - * received without the optional parameters for a - * codec with configuration info (such as THEORA - * or H264). The local configuration info may be - * set for the remote codec. - * - * As of 2.6.3 there's no API to support getting - * the remote codecs specifically, just the - * intersection. Another option may be to cache - * the remote codecs received in initiate/accept. - */ - codecs = purple_media_get_codecs(media, name); - - for (iter = codecs; iter; iter = g_list_next(iter)) { - guint id; - - id = purple_media_codec_get_id(iter->data); - iter2 = remote_codecs; - - for (; iter2; iter2 = g_list_next(iter2)) { - if (purple_media_codec_get_id( - iter2->data) != id) - continue; - - g_object_unref(iter->data); - iter->data = iter2->data; - remote_codecs = g_list_delete_link( - remote_codecs, iter2); - break; - } - } - - codecs = g_list_concat(codecs, remote_codecs); - - purple_media_set_remote_codecs(media, - name, remote_jid, codecs); - - purple_media_codec_list_free (codecs); - g_free(remote_jid); - g_free(name); - g_object_unref(session); - break; - } - default: - break; - } -} - -gboolean -jingle_rtp_initiate_media(JabberStream *js, const gchar *who, - PurpleMediaSessionType type) -{ - /* create content negotiation */ - JingleSession *session; - JingleContent *content; - JingleTransport *transport; - JabberBuddy *jb; - JabberBuddyResource *jbr; - const gchar *transport_type; - - gchar *resource = NULL, *me = NULL, *sid = NULL; - - /* construct JID to send to */ - jb = jabber_buddy_find(js, who, FALSE); - if (!jb) { - purple_debug_error("jingle-rtp", "Could not find Jabber buddy\n"); - return FALSE; - } - - resource = jabber_get_resource(who); - jbr = jabber_buddy_find_resource(jb, resource); - g_free(resource); - - if (!jbr) { - purple_debug_error("jingle-rtp", "Could not find buddy's resource\n"); - } - - if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_ICEUDP)) { - transport_type = JINGLE_TRANSPORT_ICEUDP; - } else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_RAWUDP)) { - transport_type = JINGLE_TRANSPORT_RAWUDP; - } else { - purple_debug_error("jingle-rtp", "Resource doesn't support " - "the same transport types\n"); - return FALSE; - } - - /* set ourselves as initiator */ - me = g_strdup_printf("%s@%s/%s", js->user->node, js->user->domain, js->user->resource); - - sid = jabber_get_next_id(js); - session = jingle_session_create(js, sid, me, who, TRUE); - g_free(sid); - - - if (type & PURPLE_MEDIA_AUDIO) { - transport = jingle_transport_create(transport_type); - content = jingle_content_create(JINGLE_APP_RTP, "initiator", - "session", "audio-session", "both", transport); - jingle_session_add_content(session, content); - JINGLE_RTP(content)->priv->media_type = g_strdup("audio"); - jingle_rtp_init_media(content); - } - if (type & PURPLE_MEDIA_VIDEO) { - transport = jingle_transport_create(transport_type); - content = jingle_content_create(JINGLE_APP_RTP, "initiator", - "session", "video-session", "both", transport); - jingle_session_add_content(session, content); - JINGLE_RTP(content)->priv->media_type = g_strdup("video"); - jingle_rtp_init_media(content); - } - - g_free(me); - - if (jingle_rtp_get_media(session) == NULL) { - return FALSE; - } - - return TRUE; -} - -void -jingle_rtp_terminate_session(JabberStream *js, const gchar *who) -{ - JingleSession *session; -/* XXX: This may cause file transfers and xml sessions to stop as well */ - session = jingle_session_find_by_jid(js, who); - - if (session) { - PurpleMedia *media = jingle_rtp_get_media(session); - if (media) { - purple_debug_info("jingle-rtp", "hanging up media\n"); - purple_media_stream_info(media, - PURPLE_MEDIA_INFO_HANGUP, - NULL, NULL, TRUE); - } - } -} - -#endif /* USE_VV */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/rtp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/** - * @file rtp.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_RTP_H -#define PURPLE_JABBER_JINGLE_RTP_H - -#include "config.h" - -#ifdef USE_VV - -#include <glib.h> -#include <glib-object.h> - -#include "content.h" -#include "media.h" -#include "xmlnode.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_RTP (jingle_rtp_get_type()) -#define JINGLE_RTP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_RTP, JingleRtp)) -#define JINGLE_RTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_RTP, JingleRtpClass)) -#define JINGLE_IS_RTP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_RTP)) -#define JINGLE_IS_RTP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_RTP)) -#define JINGLE_RTP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_RTP, JingleRtpClass)) - -/** @copydoc _JingleRtp */ -typedef struct _JingleRtp JingleRtp; -/** @copydoc _JingleRtpClass */ -typedef struct _JingleRtpClass JingleRtpClass; -/** @copydoc _JingleRtpPrivate */ -typedef struct _JingleRtpPrivate JingleRtpPrivate; - -/** The rtp class */ -struct _JingleRtpClass -{ - JingleContentClass parent_class; /**< The parent class. */ -}; - -/** The rtp class's private data */ -struct _JingleRtp -{ - JingleContent parent; /**< The parent of this object. */ - JingleRtpPrivate *priv; /**< The private data of this object. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the rtp class's GType - * - * @return The rtp class's GType. - */ -GType jingle_rtp_get_type(void); - -gchar *jingle_rtp_get_media_type(JingleContent *content); -gchar *jingle_rtp_get_ssrc(JingleContent *content); - -gboolean jingle_rtp_initiate_media(JabberStream *js, - const gchar *who, - PurpleMediaSessionType type); -void jingle_rtp_terminate_session(JabberStream *js, const gchar *who); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* USE_VV */ - -#endif /* PURPLE_JABBER_JINGLE_RTP_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,688 +0,0 @@ -/** - * @file session.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "content.h" -#include "debug.h" -#include "session.h" -#include "jingle.h" - -#include <string.h> - -struct _JingleSessionPrivate -{ - gchar *sid; - JabberStream *js; - gchar *remote_jid; - gchar *local_jid; - gboolean is_initiator; - gboolean state; - GList *contents; - GList *pending_contents; -}; - -#define JINGLE_SESSION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_SESSION, JingleSessionPrivate)) - -static void jingle_session_class_init (JingleSessionClass *klass); -static void jingle_session_init (JingleSession *session); -static void jingle_session_finalize (GObject *object); -static void jingle_session_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_session_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); - -static GObjectClass *parent_class = NULL; - -enum { - PROP_0, - PROP_SID, - PROP_JS, - PROP_REMOTE_JID, - PROP_LOCAL_JID, - PROP_IS_INITIATOR, - PROP_STATE, - PROP_CONTENTS, - PROP_PENDING_CONTENTS, -}; - -GType -jingle_session_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleSessionClass), - NULL, - NULL, - (GClassInitFunc) jingle_session_class_init, - NULL, - NULL, - sizeof(JingleSession), - 0, - (GInstanceInitFunc) jingle_session_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "JingleSession", &info, 0); - } - return type; -} - -static void -jingle_session_class_init (JingleSessionClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_session_finalize; - gobject_class->set_property = jingle_session_set_property; - gobject_class->get_property = jingle_session_get_property; - - g_object_class_install_property(gobject_class, PROP_SID, - g_param_spec_string("sid", - "Session ID", - "The unique session ID of the Jingle Session.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_JS, - g_param_spec_pointer("js", - "JabberStream", - "The Jabber stream associated with this session.", - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_REMOTE_JID, - g_param_spec_string("remote-jid", - "Remote JID", - "The JID of the remote participant.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_LOCAL_JID, - g_param_spec_string("local-jid", - "Local JID", - "The JID of the local participant.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_IS_INITIATOR, - g_param_spec_boolean("is-initiator", - "Is Initiator", - "Whether or not the local JID is the initiator of the session.", - FALSE, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); - - g_object_class_install_property(gobject_class, PROP_STATE, - g_param_spec_boolean("state", - "State", - "The state of the session (PENDING=FALSE, ACTIVE=TRUE).", - FALSE, - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_CONTENTS, - g_param_spec_pointer("contents", - "Contents", - "The active contents contained within this session", - G_PARAM_READABLE)); - - g_object_class_install_property(gobject_class, PROP_PENDING_CONTENTS, - g_param_spec_pointer("pending-contents", - "Pending contents", - "The pending contents contained within this session", - G_PARAM_READABLE)); - - g_type_class_add_private(klass, sizeof(JingleSessionPrivate)); -} - -static void -jingle_session_init (JingleSession *session) -{ - session->priv = JINGLE_SESSION_GET_PRIVATE(session); - memset(session->priv, 0, sizeof(*session->priv)); -} - -static void -jingle_session_finalize (GObject *session) -{ - JingleSessionPrivate *priv = JINGLE_SESSION_GET_PRIVATE(session); - purple_debug_info("jingle","jingle_session_finalize\n"); - - g_hash_table_remove(priv->js->sessions, priv->sid); - - g_free(priv->sid); - g_free(priv->remote_jid); - g_free(priv->local_jid); - - for (; priv->contents; priv->contents = - g_list_delete_link(priv->contents, priv->contents)) { - g_object_unref(priv->contents->data); - } - for (; priv->pending_contents; priv->pending_contents = - g_list_delete_link(priv->pending_contents, priv->pending_contents)) { - g_object_unref(priv->pending_contents->data); - } - - parent_class->finalize(session); -} - -static void -jingle_session_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleSession *session; - g_return_if_fail(JINGLE_IS_SESSION(object)); - - session = JINGLE_SESSION(object); - - switch (prop_id) { - case PROP_SID: - g_free(session->priv->sid); - session->priv->sid = g_value_dup_string(value); - break; - case PROP_JS: - session->priv->js = g_value_get_pointer(value); - break; - case PROP_REMOTE_JID: - g_free(session->priv->remote_jid); - session->priv->remote_jid = g_value_dup_string(value); - break; - case PROP_LOCAL_JID: - g_free(session->priv->local_jid); - session->priv->local_jid = g_value_dup_string(value); - break; - case PROP_IS_INITIATOR: - session->priv->is_initiator = g_value_get_boolean(value); - break; - case PROP_STATE: - session->priv->state = g_value_get_boolean(value); - break; - case PROP_CONTENTS: - session->priv->contents = g_value_get_pointer(value); - break; - case PROP_PENDING_CONTENTS: - session->priv->pending_contents = g_value_get_pointer(value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_session_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleSession *session; - g_return_if_fail(JINGLE_IS_SESSION(object)); - - session = JINGLE_SESSION(object); - - switch (prop_id) { - case PROP_SID: - g_value_set_string(value, session->priv->sid); - break; - case PROP_JS: - g_value_set_pointer(value, session->priv->js); - break; - case PROP_REMOTE_JID: - g_value_set_string(value, session->priv->remote_jid); - break; - case PROP_LOCAL_JID: - g_value_set_string(value, session->priv->local_jid); - break; - case PROP_IS_INITIATOR: - g_value_set_boolean(value, session->priv->is_initiator); - break; - case PROP_STATE: - g_value_set_boolean(value, session->priv->state); - break; - case PROP_CONTENTS: - g_value_set_pointer(value, session->priv->contents); - break; - case PROP_PENDING_CONTENTS: - g_value_set_pointer(value, session->priv->pending_contents); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - - -JingleSession * -jingle_session_create(JabberStream *js, const gchar *sid, - const gchar *local_jid, const gchar *remote_jid, - gboolean is_initiator) -{ - JingleSession *session = g_object_new(jingle_session_get_type(), - "js", js, - "sid", sid, - "local-jid", local_jid, - "remote-jid", remote_jid, - "is_initiator", is_initiator, - NULL); - - /* insert it into the hash table */ - if (!js->sessions) { - purple_debug_info("jingle", - "Creating hash table for sessions\n"); - js->sessions = g_hash_table_new(g_str_hash, g_str_equal); - } - purple_debug_info("jingle", - "inserting session with key: %s into table\n", sid); - g_hash_table_insert(js->sessions, g_strdup(sid), session); - - return session; -} - -JabberStream * -jingle_session_get_js(JingleSession *session) -{ - JabberStream *js; - g_object_get(session, "js", &js, NULL); - return js; -} - -gchar * -jingle_session_get_sid(JingleSession *session) -{ - gchar *sid; - g_object_get(session, "sid", &sid, NULL); - return sid; -} - -gchar * -jingle_session_get_local_jid(JingleSession *session) -{ - gchar *local_jid; - g_object_get(session, "local-jid", &local_jid, NULL); - return local_jid; -} - -gchar * -jingle_session_get_remote_jid(JingleSession *session) -{ - gchar *remote_jid; - g_object_get(session, "remote-jid", &remote_jid, NULL); - return remote_jid; -} - -gboolean -jingle_session_is_initiator(JingleSession *session) -{ - gboolean is_initiator; - g_object_get(session, "is-initiator", &is_initiator, NULL); - return is_initiator; -} - -gboolean -jingle_session_get_state(JingleSession *session) -{ - gboolean state; - g_object_get(session, "state", &state, NULL); - return state; -} - -GList * -jingle_session_get_contents(JingleSession *session) -{ - GList *contents; - g_object_get(session, "contents", &contents, NULL); - return contents; -} - -GList * -jingle_session_get_pending_contents(JingleSession *session) -{ - GList *pending_contents; - g_object_get(session, "pending-contents", &pending_contents, NULL); - return pending_contents; -} - -JingleSession * -jingle_session_find_by_sid(JabberStream *js, const gchar *sid) -{ - JingleSession *session = NULL; - - if (js->sessions) - session = g_hash_table_lookup(js->sessions, sid); - - purple_debug_info("jingle", "find_by_id %s\n", sid); - purple_debug_info("jingle", "lookup: %p\n", session); - - return session; -} - -#if GLIB_CHECK_VERSION(2,4,0) -static gboolean find_by_jid_ghr(gpointer key, - gpointer value, gpointer user_data) -{ - JingleSession *session = (JingleSession *)value; - const gchar *jid = user_data; - gboolean use_bare = strchr(jid, '/') == NULL; - gchar *remote_jid = jingle_session_get_remote_jid(session); - gchar *cmp_jid = use_bare ? jabber_get_bare_jid(remote_jid) - : g_strdup(remote_jid); - g_free(remote_jid); - if (g_str_equal(jid, cmp_jid)) { - g_free(cmp_jid); - return TRUE; - } - g_free(cmp_jid); - - return FALSE; -} - -#else /* GLIB_CHECK_VERSION 2.4.0 */ - -/* Ugly code; g_hash_table_find version above is much nicer */ -struct session_find_jid -{ - const gchar *jid; - JingleSession *ret; - gboolean use_bare; -}; - -static void find_by_jid_ghr(gpointer key, gpointer value, gpointer user_data) -{ - JingleSession *session = (JingleSession *)value; - struct session_find_jid *data = user_data; - gchar *remote_jid; - gchar *cmp_jid; - - if (data->ret != NULL) - return; - - remote_jid = jingle_session_get_remote_jid(session); - cmp_jid = data->use_bare ? jabber_get_bare_jid(remote_jid) - : g_strdup(remote_jid); - g_free(remote_jid); - - if (g_str_equal(data->jid, cmp_jid)) - data->ret = session; - - g_free(cmp_jid); -} -#endif /* GLIB_CHECK_VERSION 2.4.0 */ - -JingleSession * -jingle_session_find_by_jid(JabberStream *js, const gchar *jid) -{ -#if GLIB_CHECK_VERSION(2,4,0) - return js->sessions != NULL ? - g_hash_table_find(js->sessions, - find_by_jid_ghr, (gpointer)jid) : NULL; -#else - struct session_find_jid data; - - if (js->sessions == NULL) - return NULL; - - data.jid = jid; - data.ret = NULL; - data.use_bare = strchr(jid, '/') == NULL; - - g_hash_table_foreach(js->sessions, find_by_jid_ghr, &data); - return data.ret; -#endif -} - -static xmlnode * -jingle_add_jingle_packet(JingleSession *session, - JabberIq *iq, JingleActionType action) -{ - xmlnode *jingle = iq ? - xmlnode_new_child(iq->node, "jingle") : - xmlnode_new("jingle"); - gchar *local_jid = jingle_session_get_local_jid(session); - gchar *remote_jid = jingle_session_get_remote_jid(session); - - xmlnode_set_namespace(jingle, JINGLE); - xmlnode_set_attrib(jingle, "action", jingle_get_action_name(action)); - - if (jingle_session_is_initiator(session)) { - xmlnode_set_attrib(jingle, "initiator", - jingle_session_get_local_jid(session)); - xmlnode_set_attrib(jingle, "responder", - jingle_session_get_remote_jid(session)); - } else { - xmlnode_set_attrib(jingle, "initiator", - jingle_session_get_remote_jid(session)); - xmlnode_set_attrib(jingle, "responder", - jingle_session_get_local_jid(session)); - } - - g_free(local_jid); - g_free(remote_jid); - - xmlnode_set_attrib(jingle, "sid", jingle_session_get_sid(session)); - - return jingle; -} - -JabberIq * -jingle_session_create_ack(JingleSession *session, const xmlnode *jingle) -{ - JabberIq *result = jabber_iq_new( - jingle_session_get_js(session), - JABBER_IQ_RESULT); - xmlnode *packet = xmlnode_get_parent(jingle); - jabber_iq_set_id(result, xmlnode_get_attrib(packet, "id")); - xmlnode_set_attrib(result->node, "from", xmlnode_get_attrib(packet, "to")); - xmlnode_set_attrib(result->node, "to", xmlnode_get_attrib(packet, "from")); - return result; -} - -static JabberIq * -jingle_create_iq(JingleSession *session) -{ - JabberStream *js = jingle_session_get_js(session); - JabberIq *result = jabber_iq_new(js, JABBER_IQ_SET); - gchar *from = jingle_session_get_local_jid(session); - gchar *to = jingle_session_get_remote_jid(session); - - xmlnode_set_attrib(result->node, "from", from); - xmlnode_set_attrib(result->node, "to", to); - - g_free(from); - g_free(to); - return result; -} - -xmlnode * -jingle_session_to_xml(JingleSession *session, xmlnode *jingle, JingleActionType action) -{ - if (action != JINGLE_SESSION_INFO && action != JINGLE_SESSION_TERMINATE) { - GList *iter; - if (action == JINGLE_CONTENT_ACCEPT - || action == JINGLE_CONTENT_ADD - || action == JINGLE_CONTENT_REMOVE) - iter = jingle_session_get_pending_contents(session); - else - iter = jingle_session_get_contents(session); - - for (; iter; iter = g_list_next(iter)) { - jingle_content_to_xml(iter->data, jingle, action); - } - } - return jingle; -} - -JabberIq * -jingle_session_to_packet(JingleSession *session, JingleActionType action) -{ - JabberIq *iq = jingle_create_iq(session); - xmlnode *jingle = jingle_add_jingle_packet(session, iq, action); - jingle_session_to_xml(session, jingle, action); - return iq; -} - -void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action) -{ - GList *iter; - if (action == JINGLE_CONTENT_ADD || action == JINGLE_CONTENT_REMOVE) - iter = jingle_session_get_pending_contents(session); - else - iter = jingle_session_get_contents(session); - - for (; iter; iter = g_list_next(iter)) { - jingle_content_handle_action(iter->data, jingle, action); - } -} - -JingleContent * -jingle_session_find_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - GList *iter = session->priv->contents; - for (; iter; iter = g_list_next(iter)) { - JingleContent *content = iter->data; - gchar *cname = jingle_content_get_name(content); - gboolean result = !strcmp(name, cname); - g_free(cname); - - if (creator != NULL) { - gchar *ccreator = jingle_content_get_creator(content); - result = (result && !strcmp(creator, ccreator)); - g_free(ccreator); - } - - if (result == TRUE) - return content; - } - return NULL; -} - -JingleContent * -jingle_session_find_pending_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - GList *iter = session->priv->pending_contents; - for (; iter; iter = g_list_next(iter)) { - JingleContent *content = iter->data; - gchar *cname = jingle_content_get_name(content); - gboolean result = !strcmp(name, cname); - g_free(cname); - - if (creator != NULL) { - gchar *ccreator = jingle_content_get_creator(content); - result = (result && !strcmp(creator, ccreator)); - g_free(ccreator); - } - - if (result == TRUE) - return content; - } - return NULL; -} - -void -jingle_session_add_content(JingleSession *session, JingleContent* content) -{ - session->priv->contents = - g_list_append(session->priv->contents, content); - jingle_content_set_session(content, session); -} - -void -jingle_session_remove_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - JingleContent *content = - jingle_session_find_content(session, name, creator); - - if (content) { - session->priv->contents = - g_list_remove(session->priv->contents, content); - g_object_unref(content); - } -} - -void -jingle_session_add_pending_content(JingleSession *session, JingleContent* content) -{ - session->priv->pending_contents = - g_list_append(session->priv->pending_contents, content); - jingle_content_set_session(content, session); -} - -void -jingle_session_remove_pending_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - JingleContent *content = jingle_session_find_pending_content(session, name, creator); - - if (content) { - session->priv->pending_contents = - g_list_remove(session->priv->pending_contents, content); - g_object_unref(content); - } -} - -void -jingle_session_accept_content(JingleSession *session, const gchar *name, const gchar *creator) -{ - JingleContent *content = jingle_session_find_pending_content(session, name, creator); - - if (content) { - g_object_ref(content); - jingle_session_remove_pending_content(session, name, creator); - jingle_session_add_content(session, content); - } -} - -void -jingle_session_accept_session(JingleSession *session) -{ - session->priv->state = TRUE; -} - -JabberIq * -jingle_session_terminate_packet(JingleSession *session, const gchar *reason) -{ - JabberIq *iq = jingle_session_to_packet(session, - JINGLE_SESSION_TERMINATE); - xmlnode *jingle = xmlnode_get_child(iq->node, "jingle"); - - if (reason != NULL) { - xmlnode *reason_node; - reason_node = xmlnode_new_child(jingle, "reason"); - xmlnode_new_child(reason_node, reason); - } - return iq; -} - -JabberIq * -jingle_session_redirect_packet(JingleSession *session, const gchar *sid) -{ - JabberIq *iq = jingle_session_terminate_packet(session, - "alternative-session"); - xmlnode *alt_session; - - if (sid == NULL) - return iq; - - alt_session = xmlnode_get_child(iq->node, - "jingle/reason/alternative-session"); - - if (alt_session != NULL) { - xmlnode *sid_node = xmlnode_new_child(alt_session, "sid"); - xmlnode_insert_data(sid_node, sid, -1); - } - return iq; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** - * @file session.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_SESSION_H -#define PURPLE_JABBER_JINGLE_SESSION_H - -#include "iq.h" -#include "jabber.h" - -#include <glib.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define JINGLE_TYPE_SESSION (jingle_session_get_type()) -#define JINGLE_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_SESSION, JingleSession)) -#define JINGLE_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_SESSION, JingleSessionClass)) -#define JINGLE_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_SESSION)) -#define JINGLE_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_SESSION)) -#define JINGLE_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_SESSION, JingleSessionClass)) - -/** @copydoc _JingleSession */ -typedef struct _JingleSession JingleSession; -/** @copydoc _JingleSessionClass */ -typedef struct _JingleSessionClass JingleSessionClass; -/** @copydoc _JingleSessionPrivate */ -typedef struct _JingleSessionPrivate JingleSessionPrivate; - -/** The session class */ -struct _JingleSessionClass -{ - GObjectClass parent_class; /**< The parent class. */ -}; - -/** The session class's private data */ -struct _JingleSession -{ - GObject parent; /**< The parent of this object. */ - JingleSessionPrivate *priv; /**< The private data of this object. */ -}; - -struct _JingleContent; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the session class's GType - * - * @return The session class's GType. - */ -GType jingle_session_get_type(void); - -JingleSession *jingle_session_create(JabberStream *js, const gchar *sid, - const gchar *local_jid, const gchar *remote_jid, - gboolean is_initiator); -JabberStream *jingle_session_get_js(JingleSession *session); -gchar *jingle_session_get_sid(JingleSession *session); -gchar *jingle_session_get_local_jid(JingleSession *session); -gchar *jingle_session_get_remote_jid(JingleSession *session); -gboolean jingle_session_is_initiator(JingleSession *session); -gboolean jingle_session_get_state(JingleSession *session); - -GList *jingle_session_get_contents(JingleSession *session); -GList *jingle_session_get_pending_contents(JingleSession *session); - -JingleSession *jingle_session_find_by_sid(JabberStream *js, const gchar *sid); -JingleSession *jingle_session_find_by_jid(JabberStream *js, const gchar *jid); - -JabberIq *jingle_session_create_ack(JingleSession *session, const xmlnode *jingle); -xmlnode *jingle_session_to_xml(JingleSession *session, xmlnode *parent, JingleActionType action); -JabberIq *jingle_session_to_packet(JingleSession *session, JingleActionType action); - -void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action); - -struct _JingleContent *jingle_session_find_content(JingleSession *session, - const gchar *name, const gchar *creator); -struct _JingleContent *jingle_session_find_pending_content(JingleSession *session, - const gchar *name, const gchar *creator); - -void jingle_session_add_content(JingleSession *session, struct _JingleContent* content); -void jingle_session_remove_content(JingleSession *session, const gchar *name, const gchar *creator); -void jingle_session_add_pending_content(JingleSession *session, struct _JingleContent* content); -void jingle_session_remove_pending_content(JingleSession *session, const gchar *name, const gchar *creator); -void jingle_session_accept_content(JingleSession *session, const gchar *name, const gchar *creator); -void jingle_session_accept_session(JingleSession *session); -JabberIq *jingle_session_terminate_packet(JingleSession *session, const gchar *reason); -JabberIq *jingle_session_redirect_packet(JingleSession *session, const gchar *sid); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_SESSION_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -/** - * @file transport.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "transport.h" -#include "jingle.h" -#include "debug.h" - -#include <string.h> - -struct _JingleTransportPrivate -{ - void *dummy; -}; - -#define JINGLE_TRANSPORT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), JINGLE_TYPE_TRANSPORT, JingleTransportPrivate)) - -static void jingle_transport_class_init (JingleTransportClass *klass); -static void jingle_transport_init (JingleTransport *transport); -static void jingle_transport_finalize (GObject *object); -static void jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -JingleTransport *jingle_transport_parse_internal(xmlnode *transport); -xmlnode *jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action); - -static GObjectClass *parent_class = NULL; - -enum { - PROP_0, -}; - -GType -jingle_transport_get_type() -{ - static GType type = 0; - - if (type == 0) { - static const GTypeInfo info = { - sizeof(JingleTransportClass), - NULL, - NULL, - (GClassInitFunc) jingle_transport_class_init, - NULL, - NULL, - sizeof(JingleTransport), - 0, - (GInstanceInitFunc) jingle_transport_init, - NULL - }; - type = g_type_register_static(G_TYPE_OBJECT, "JingleTransport", &info, 0); - } - return type; -} - -static void -jingle_transport_class_init (JingleTransportClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass*)klass; - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = jingle_transport_finalize; - gobject_class->set_property = jingle_transport_set_property; - gobject_class->get_property = jingle_transport_get_property; - klass->to_xml = jingle_transport_to_xml_internal; - klass->parse = jingle_transport_parse_internal; - - g_type_class_add_private(klass, sizeof(JingleTransportPrivate)); -} - -static void -jingle_transport_init (JingleTransport *transport) -{ - transport->priv = JINGLE_TRANSPORT_GET_PRIVATE(transport); - transport->priv->dummy = NULL; -} - -static void -jingle_transport_finalize (GObject *transport) -{ - /* JingleTransportPrivate *priv = JINGLE_TRANSPORT_GET_PRIVATE(transport); */ - purple_debug_info("jingle","jingle_transport_finalize\n"); - - parent_class->finalize(transport); -} - -static void -jingle_transport_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - JingleTransport *transport; - g_return_if_fail(JINGLE_IS_TRANSPORT(object)); - - transport = JINGLE_TRANSPORT(object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -jingle_transport_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - JingleTransport *transport; - g_return_if_fail(JINGLE_IS_TRANSPORT(object)); - - transport = JINGLE_TRANSPORT(object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -JingleTransport * -jingle_transport_create(const gchar *type) -{ - return g_object_new(jingle_get_type(type), NULL); -} - -const gchar * -jingle_transport_get_transport_type(JingleTransport *transport) -{ - return JINGLE_TRANSPORT_GET_CLASS(transport)->transport_type; -} - -JingleTransport * -jingle_transport_parse_internal(xmlnode *transport) -{ - const gchar *type = xmlnode_get_namespace(transport); - return jingle_transport_create(type); -} - -xmlnode * -jingle_transport_to_xml_internal(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - xmlnode *node = xmlnode_new_child(content, "transport"); - xmlnode_set_namespace(node, jingle_transport_get_transport_type(transport)); - return node; -} - -JingleTransport * -jingle_transport_parse(xmlnode *transport) -{ - const gchar *type = xmlnode_get_namespace(transport); - return JINGLE_TRANSPORT_CLASS(g_type_class_ref(jingle_get_type(type)))->parse(transport); -} - -xmlnode * -jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action) -{ - g_return_val_if_fail(JINGLE_IS_TRANSPORT(transport), NULL); - return JINGLE_TRANSPORT_GET_CLASS(transport)->to_xml(transport, content, action); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jingle/transport.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/** - * @file transport.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_JABBER_JINGLE_TRANSPORT_H -#define PURPLE_JABBER_JINGLE_TRANSPORT_H - -#include <glib.h> -#include <glib-object.h> - -#include "jingle.h" -#include "xmlnode.h" - -G_BEGIN_DECLS - -#define JINGLE_TYPE_TRANSPORT (jingle_transport_get_type()) -#define JINGLE_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_TRANSPORT, JingleTransport)) -#define JINGLE_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_TRANSPORT, JingleTransportClass)) -#define JINGLE_IS_TRANSPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_TRANSPORT)) -#define JINGLE_IS_TRANSPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_TRANSPORT)) -#define JINGLE_TRANSPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_TRANSPORT, JingleTransportClass)) - -/** @copydoc _JingleTransport */ -typedef struct _JingleTransport JingleTransport; -/** @copydoc _JingleTransportClass */ -typedef struct _JingleTransportClass JingleTransportClass; -/** @copydoc _JingleTransportPrivate */ -typedef struct _JingleTransportPrivate JingleTransportPrivate; - -/** The transport class */ -struct _JingleTransportClass -{ - GObjectClass parent_class; /**< The parent class. */ - - const gchar *transport_type; - xmlnode *(*to_xml) (JingleTransport *transport, xmlnode *content, JingleActionType action); - JingleTransport *(*parse) (xmlnode *transport); -}; - -/** The transport class's private data */ -struct _JingleTransport -{ - GObject parent; /**< The parent of this object. */ - JingleTransportPrivate *priv; /**< The private data of this object. */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Gets the transport class's GType - * - * @return The transport class's GType. - */ -GType jingle_transport_get_type(void); - -JingleTransport *jingle_transport_create(const gchar *type); -const gchar *jingle_transport_get_transport_type(JingleTransport *transport); -void jingle_transport_add_candidate(); - -JingleTransport *jingle_transport_parse(xmlnode *transport); -xmlnode *jingle_transport_to_xml(JingleTransport *transport, xmlnode *content, JingleActionType action); - -#ifdef __cplusplus -} -#endif - -G_END_DECLS - -#endif /* PURPLE_JABBER_JINGLE_TRANSPORT_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,679 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "account.h" -#include "cipher.h" -#include "conversation.h" -#include "debug.h" -#include "server.h" -#include "util.h" -#include "xmlnode.h" - -#include "chat.h" -#include "presence.h" -#include "jutil.h" - -#ifdef USE_IDN -#include <idna.h> -#include <stringprep.h> -static char idn_buffer[1024]; -#endif - -#ifdef USE_IDN -static gboolean jabber_nodeprep(char *str, size_t buflen) -{ - return stringprep_xmpp_nodeprep(str, buflen) == STRINGPREP_OK; -} - -static gboolean jabber_resourceprep(char *str, size_t buflen) -{ - return stringprep_xmpp_resourceprep(str, buflen) == STRINGPREP_OK; -} - -static JabberID* -jabber_idn_validate(const char *str, const char *at, const char *slash, - const char *null) -{ - const char *node = NULL; - const char *domain = NULL; - const char *resource = NULL; - int node_len = 0; - int domain_len = 0; - int resource_len = 0; - char *out; - JabberID *jid; - - /* Ensure no parts are > 1023 bytes */ - if (at) { - node = str; - node_len = at - str; - - domain = at + 1; - if (slash) { - domain_len = slash - (at + 1); - resource = slash + 1; - resource_len = null - (slash + 1); - } else { - domain_len = null - (at + 1); - } - } else { - domain = str; - - if (slash) { - domain_len = slash - str; - resource = slash; - resource_len = null - (slash + 1); - } else { - domain_len = null - (str + 1); - } - } - - if (node && node_len > 1023) - return NULL; - if (domain_len > 1023) - return NULL; - if (resource && resource_len > 1023) - return NULL; - - jid = g_new0(JabberID, 1); - - if (node) { - strncpy(idn_buffer, node, node_len); - idn_buffer[node_len] = '\0'; - - if (!jabber_nodeprep(idn_buffer, sizeof(idn_buffer))) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - - jid->node = g_strdup(idn_buffer); - } - - /* domain *must* be here */ - strncpy(idn_buffer, domain, domain_len); - idn_buffer[domain_len] = '\0'; - if (domain[0] == '[') { /* IPv6 address */ - gboolean valid = FALSE; - - if (idn_buffer[domain_len - 1] == ']') { - idn_buffer[domain_len - 1] = '\0'; - valid = purple_ipv6_address_is_valid(idn_buffer + 1); - } - - if (!valid) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - } else { - /* Apply nameprep */ - if (stringprep_nameprep(idn_buffer, sizeof(idn_buffer)) != STRINGPREP_OK) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - - /* And now ToASCII */ - if (idna_to_ascii_8z(idn_buffer, &out, IDNA_USE_STD3_ASCII_RULES) != IDNA_SUCCESS) { - jabber_id_free(jid); - jid = NULL; - goto out; - } - - /* This *MUST* be freed using 'free', not 'g_free' */ - free(out); - jid->domain = g_strdup(idn_buffer); - } - - if (resource) { - strncpy(idn_buffer, resource, resource_len); - idn_buffer[resource_len] = '\0'; - - if (!jabber_resourceprep(idn_buffer, sizeof(idn_buffer))) { - jabber_id_free(jid); - jid = NULL; - goto out; - } else - jid->resource = g_strdup(idn_buffer); - } - -out: - return jid; -} - -#endif /* USE_IDN */ - -gboolean jabber_nodeprep_validate(const char *str) -{ -#ifdef USE_IDN - gboolean result; -#else - const char *c; -#endif - - if(!str) - return TRUE; - - if(strlen(str) > 1023) - return FALSE; - -#ifdef USE_IDN - strncpy(idn_buffer, str, sizeof(idn_buffer) - 1); - idn_buffer[sizeof(idn_buffer) - 1] = '\0'; - result = jabber_nodeprep(idn_buffer, sizeof(idn_buffer)); - return result; -#else /* USE_IDN */ - c = str; - while(c && *c) { - gunichar ch = g_utf8_get_char(c); - if(ch == '\"' || ch == '&' || ch == '\'' || ch == '/' || ch == ':' || - ch == '<' || ch == '>' || ch == '@' || !g_unichar_isgraph(ch)) { - return FALSE; - } - c = g_utf8_next_char(c); - } - - return TRUE; -#endif /* USE_IDN */ -} - -gboolean jabber_domain_validate(const char *str) -{ - const char *c; - size_t len; - - if(!str) - return TRUE; - - len = strlen(str); - if (len > 1023) - return FALSE; - - c = str; - - if (*c == '[') { - /* Check if str is a valid IPv6 identifier */ - gboolean valid = FALSE; - - if (*(c + len - 1) != ']') - return FALSE; - - /* Ugly, but in-place */ - *(gchar *)(c + len - 1) = '\0'; - valid = purple_ipv6_address_is_valid(c + 1); - *(gchar *)(c + len - 1) = ']'; - - return valid; - } - - while(c && *c) { - gunichar ch = g_utf8_get_char(c); - /* The list of characters allowed in domain names is pretty small */ - if ((ch <= 0x7F && !( (ch >= 'a' && ch <= 'z') - || (ch >= '0' && ch <= '9') - || (ch >= 'A' && ch <= 'Z') - || ch == '.' - || ch == '-' )) || (ch >= 0x80 && !g_unichar_isgraph(ch))) - return FALSE; - - c = g_utf8_next_char(c); - } - - return TRUE; -} - -gboolean jabber_resourceprep_validate(const char *str) -{ -#ifdef USE_IDN - gboolean result; -#else - const char *c; -#endif - - if(!str) - return TRUE; - - if(strlen(str) > 1023) - return FALSE; - -#ifdef USE_IDN - strncpy(idn_buffer, str, sizeof(idn_buffer) - 1); - idn_buffer[sizeof(idn_buffer) - 1] = '\0'; - result = jabber_resourceprep(idn_buffer, sizeof(idn_buffer)); - return result; -#else /* USE_IDN */ - c = str; - while(c && *c) { - gunichar ch = g_utf8_get_char(c); - if(!g_unichar_isgraph(ch) && ch != ' ') - return FALSE; - - c = g_utf8_next_char(c); - } - - return TRUE; -#endif /* USE_IDN */ -} - -char *jabber_saslprep(const char *in) -{ -#ifdef USE_IDN - char *out; - - g_return_val_if_fail(in != NULL, NULL); - g_return_val_if_fail(strlen(in) <= sizeof(idn_buffer) - 1, NULL); - - strncpy(idn_buffer, in, sizeof(idn_buffer) - 1); - idn_buffer[sizeof(idn_buffer) - 1] = '\0'; - - if (STRINGPREP_OK != stringprep(idn_buffer, sizeof(idn_buffer), 0, - stringprep_saslprep)) { - memset(idn_buffer, 0, sizeof(idn_buffer)); - return NULL; - } - - out = g_strdup(idn_buffer); - memset(idn_buffer, 0, sizeof(idn_buffer)); - return out; -#else /* USE_IDN */ - /* TODO: Something better than disallowing all non-ASCII characters */ - /* TODO: Is this even correct? */ - const guchar *c; - - c = (const guchar *)in; - while (*c) { - if (*c > 0x7f || - (*c < 0x20 && *c != '\t' && *c != '\n' && *c != '\r')) - return NULL; - } - - return g_strdup(in); -#endif /* USE_IDN */ -} - -static JabberID* -jabber_id_new_internal(const char *str, gboolean allow_terminating_slash) -{ - const char *at = NULL; - const char *slash = NULL; - const char *c; - gboolean needs_validation = FALSE; -#if 0 - gboolean node_is_required = FALSE; -#endif -#ifndef USE_IDN - char *node = NULL; - char *domain; -#endif - JabberID *jid; - - if (!str) - return NULL; - - for (c = str; *c != '\0'; c++) - { - switch (*c) { - case '@': - if (!slash) { - if (at) { - /* Multiple @'s in the node/domain portion, not a valid JID! */ - return NULL; - } - if (c == str) { - /* JIDs cannot start with @ */ - return NULL; - } - if (c[1] == '\0') { - /* JIDs cannot end with @ */ - return NULL; - } - at = c; - } - break; - - case '/': - if (!slash) { - if (c == str) { - /* JIDs cannot start with / */ - return NULL; - } - if (c[1] == '\0' && !allow_terminating_slash) { - /* JIDs cannot end with / */ - return NULL; - } - slash = c; - } - break; - - default: - /* characters allowed everywhere */ - if ((*c >= 'a' && *c <= 'z') - || (*c >= '0' && *c <= '9') - || (*c >= 'A' && *c <= 'Z') - || *c == '.' || *c == '-') - /* We're good */ - break; - -#if 0 - if (slash != NULL) { - /* characters allowed only in the resource */ - if (implement_me) - /* We're good */ - break; - } - - /* characters allowed only in the node */ - if (implement_me) { - /* - * Ok, this character is valid, but only if it's a part - * of the node and not the domain. But we don't know - * if "c" is a part of the node or the domain until after - * we've found the @. So set a flag for now and check - * that we found an @ later. - */ - node_is_required = TRUE; - break; - } -#endif - - /* - * Hmm, this character is a bit more exotic. Better fall - * back to using the more expensive UTF-8 compliant - * stringprep functions. - */ - needs_validation = TRUE; - break; - } - } - -#if 0 - if (node_is_required && at == NULL) - /* Found invalid characters in the domain */ - return NULL; -#endif - - if (!needs_validation) { - /* JID is made of only ASCII characters--just lowercase and return */ - jid = g_new0(JabberID, 1); - - if (at) { - jid->node = g_ascii_strdown(str, at - str); - if (slash) { - jid->domain = g_ascii_strdown(at + 1, slash - (at + 1)); - if (*(slash + 1)) - jid->resource = g_strdup(slash + 1); - } else { - jid->domain = g_ascii_strdown(at + 1, -1); - } - } else { - if (slash) { - jid->domain = g_ascii_strdown(str, slash - str); - if (*(slash + 1)) - jid->resource = g_strdup(slash + 1); - } else { - jid->domain = g_ascii_strdown(str, -1); - } - } - return jid; - } - - /* - * If we get here, there are some non-ASCII chars in the string, so - * we'll need to validate it, normalize, and finally do a full jabber - * nodeprep on the jid. - */ - - if (!g_utf8_validate(str, -1, NULL)) - return NULL; - -#ifdef USE_IDN - return jabber_idn_validate(str, at, slash, c /* points to the null */); -#else /* USE_IDN */ - - jid = g_new0(JabberID, 1); - - /* normalization */ - if(at) { - node = g_utf8_casefold(str, at-str); - if(slash) { - domain = g_utf8_casefold(at+1, slash-(at+1)); - if (*(slash + 1)) - jid->resource = g_utf8_normalize(slash+1, -1, G_NORMALIZE_NFKC); - } else { - domain = g_utf8_casefold(at+1, -1); - } - } else { - if(slash) { - domain = g_utf8_casefold(str, slash-str); - if (*(slash + 1)) - jid->resource = g_utf8_normalize(slash+1, -1, G_NORMALIZE_NFKC); - } else { - domain = g_utf8_casefold(str, -1); - } - } - - if (node) { - jid->node = g_utf8_normalize(node, -1, G_NORMALIZE_NFKC); - g_free(node); - } - - if (domain) { - jid->domain = g_utf8_normalize(domain, -1, G_NORMALIZE_NFKC); - g_free(domain); - } - - /* and finally the jabber nodeprep */ - if(!jabber_nodeprep_validate(jid->node) || - !jabber_domain_validate(jid->domain) || - !jabber_resourceprep_validate(jid->resource)) { - jabber_id_free(jid); - return NULL; - } - - return jid; -#endif /* USE_IDN */ -} - -void -jabber_id_free(JabberID *jid) -{ - if(jid) { - if(jid->node) - g_free(jid->node); - if(jid->domain) - g_free(jid->domain); - if(jid->resource) - g_free(jid->resource); - g_free(jid); - } -} - -char *jabber_get_domain(const char *in) -{ - JabberID *jid = jabber_id_new(in); - char *out; - - if (!jid) - return NULL; - - out = g_strdup(jid->domain); - jabber_id_free(jid); - - return out; -} - -char *jabber_get_resource(const char *in) -{ - JabberID *jid = jabber_id_new(in); - char *out; - - if(!jid) - return NULL; - - out = g_strdup(jid->resource); - jabber_id_free(jid); - - return out; -} - -char * -jabber_get_bare_jid(const char *in) -{ - JabberID *jid = jabber_id_new(in); - char *out; - - if (!jid) - return NULL; - out = jabber_id_get_bare_jid(jid); - jabber_id_free(jid); - - return out; -} - -char * -jabber_id_get_bare_jid(const JabberID *jid) -{ - g_return_val_if_fail(jid != NULL, NULL); - - return g_strconcat(jid->node ? jid->node : "", - jid->node ? "@" : "", - jid->domain, - NULL); -} - -gboolean -jabber_jid_is_domain(const char *jid) -{ - const char *c; - - for (c = jid; *c; ++c) { - if (*c == '@' || *c == '/') - return FALSE; - } - - return TRUE; -} - - -JabberID * -jabber_id_new(const char *str) -{ - return jabber_id_new_internal(str, FALSE); -} - -const char *jabber_normalize(const PurpleAccount *account, const char *in) -{ - PurpleConnection *gc = account ? account->gc : NULL; - JabberStream *js = gc ? gc->proto_data : NULL; - static char buf[3072]; /* maximum legal length of a jabber jid */ - JabberID *jid; - - jid = jabber_id_new_internal(in, TRUE); - if(!jid) - return NULL; - - if(js && jid->node && jid->resource && - jabber_chat_find(js, jid->node, jid->domain)) - g_snprintf(buf, sizeof(buf), "%s@%s/%s", jid->node, jid->domain, - jid->resource); - else - g_snprintf(buf, sizeof(buf), "%s%s%s", jid->node ? jid->node : "", - jid->node ? "@" : "", jid->domain); - - jabber_id_free(jid); - - return buf; -} - -gboolean -jabber_is_own_server(JabberStream *js, const char *str) -{ - JabberID *jid; - gboolean equal; - - if (str == NULL) - return FALSE; - - g_return_val_if_fail(*str != '\0', FALSE); - - jid = jabber_id_new(str); - if (!jid) - return FALSE; - - equal = (jid->node == NULL && - g_str_equal(jid->domain, js->user->domain) && - jid->resource == NULL); - jabber_id_free(jid); - return equal; -} - -gboolean -jabber_is_own_account(JabberStream *js, const char *str) -{ - JabberID *jid; - gboolean equal; - - if (str == NULL) - return TRUE; - - g_return_val_if_fail(*str != '\0', FALSE); - - jid = jabber_id_new(str); - if (!jid) - return FALSE; - - equal = (purple_strequal(jid->node, js->user->node) && - g_str_equal(jid->domain, js->user->domain) && - (jid->resource == NULL || - g_str_equal(jid->resource, js->user->resource))); - jabber_id_free(jid); - return equal; -} - -/* The same as purple_util_get_image_checksum, but guaranteed to remain SHA1 */ -char * -jabber_calculate_data_sha1sum(gconstpointer data, size_t len) -{ - PurpleCipherContext *context; - static gchar digest[41]; - - context = purple_cipher_context_new_by_name("sha1", NULL); - if (context == NULL) - { - purple_debug_error("jabber", "Could not find sha1 cipher\n"); - g_return_val_if_reached(NULL); - } - - /* Hash the data */ - purple_cipher_context_append(context, data, len); - if (!purple_cipher_context_digest_to_str(context, sizeof(digest), digest, NULL)) - { - purple_debug_error("jabber", "Failed to get SHA-1 digest.\n"); - g_return_val_if_reached(NULL); - } - purple_cipher_context_destroy(context); - - return g_strdup(digest); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/jutil.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/** - * @file jutil.h utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_JUTIL_H_ -#define PURPLE_JABBER_JUTIL_H_ - -typedef struct _JabberID { - char *node; - char *domain; - char *resource; -} JabberID; - -#include "jabber.h" - -JabberID* jabber_id_new(const char *str); -void jabber_id_free(JabberID *jid); - -char *jabber_get_domain(const char *jid); -char *jabber_get_resource(const char *jid); -char *jabber_get_bare_jid(const char *jid); -char *jabber_id_get_bare_jid(const JabberID *jid); - -gboolean jabber_jid_is_domain(const char *jid); - -const char *jabber_normalize(const PurpleAccount *account, const char *in); - -/* Returns true if JID is the bare JID of our server. */ -gboolean jabber_is_own_server(JabberStream *js, const char *jid); - -/* Returns true if JID is the bare JID of our account. */ -gboolean jabber_is_own_account(JabberStream *js, const char *jid); - -gboolean jabber_nodeprep_validate(const char *); -gboolean jabber_domain_validate(const char *); -gboolean jabber_resourceprep_validate(const char *); - -/** - * Apply the SASLprep profile of stringprep to the string passed in. - * - * @returns A newly allocated string containing the normalized version - * of the input, or NULL if an error occurred (the string could - * not be normalized) - */ -char *jabber_saslprep(const char *); - -char *jabber_calculate_data_sha1sum(gconstpointer data, size_t len); -#endif /* PURPLE_JABBER_JUTIL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/libxmpp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/libxmpp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/libxmpp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/libxmpp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,444 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* libxmpp is the XMPP protocol plugin. It is linked against libjabbercommon, - * which may be used to support other protocols (Bonjour) which may need to - * share code. - */ - -#include "internal.h" - -#include "accountopt.h" -#include "core.h" -#include "debug.h" -#include "version.h" - -#include "iq.h" -#include "jabber.h" -#include "chat.h" -#include "disco.h" -#include "message.h" -#include "roster.h" -#include "si.h" -#include "message.h" -#include "presence.h" -#include "google.h" -#include "pep.h" -#include "usertune.h" -#include "caps.h" -#include "data.h" -#include "ibb.h" - -static PurplePlugin *my_protocol = NULL; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK | -#ifdef HAVE_CYRUS_SASL - OPT_PROTO_PASSWORD_OPTIONAL | -#endif - OPT_PROTO_SLASH_COMMANDS_NATIVE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 32, 32, 96, 96, 0, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - jabber_list_icon, /* list_icon */ - jabber_list_emblem, /* list_emblems */ - jabber_status_text, /* status_text */ - jabber_tooltip_text, /* tooltip_text */ - jabber_status_types, /* status_types */ - jabber_blist_node_menu, /* blist_node_menu */ - jabber_chat_info, /* chat_info */ - jabber_chat_info_defaults, /* chat_info_defaults */ - jabber_login, /* login */ - jabber_close, /* close */ - jabber_message_send_im, /* send_im */ - jabber_set_info, /* set_info */ - jabber_send_typing, /* send_typing */ - jabber_buddy_get_info, /* get_info */ - jabber_set_status, /* set_status */ - jabber_idle_set, /* set_idle */ - NULL, /* change_passwd */ - jabber_roster_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - jabber_roster_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - jabber_add_deny, /* add_deny */ - NULL, /* rem_permit */ - jabber_rem_deny, /* rem_deny */ - NULL, /* set_permit_deny */ - jabber_chat_join, /* join_chat */ - NULL, /* reject_chat */ - jabber_get_chat_name, /* get_chat_name */ - jabber_chat_invite, /* chat_invite */ - jabber_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - jabber_message_send_chat, /* chat_send */ - jabber_keepalive, /* keepalive */ - jabber_register_account, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - jabber_roster_alias_change, /* alias_buddy */ - jabber_roster_group_change, /* group_buddy */ - jabber_roster_group_rename, /* rename_group */ - NULL, /* buddy_free */ - jabber_convo_closed, /* convo_closed */ - jabber_normalize, /* normalize */ - jabber_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - jabber_chat_buddy_real_name, /* get_cb_real_name */ - jabber_chat_set_topic, /* set_chat_topic */ - jabber_find_blist_chat, /* find_blist_chat */ - jabber_roomlist_get_list, /* roomlist_get_list */ - jabber_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - jabber_can_receive_file, /* can_receive_file */ - jabber_si_xfer_send, /* send_file */ - jabber_si_new_xfer, /* new_xfer */ - jabber_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - jabber_prpl_send_raw, /* send_raw */ - jabber_roomlist_room_serialize, /* roomlist_room_serialize */ - jabber_unregister_account, /* unregister_user */ - jabber_send_attention, /* send_attention */ - jabber_attention_types, /* attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - jabber_initiate_media, /* initiate_media */ - jabber_get_media_caps, /* get_media_caps */ -}; - -static gboolean load_plugin(PurplePlugin *plugin) -{ - purple_signal_register(plugin, "jabber-receiving-xmlnode", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - purple_signal_register(plugin, "jabber-sending-xmlnode", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - /* - * Do not remove this or the plugin will fail. Completely. You have been - * warned! - */ - purple_signal_connect_priority(plugin, "jabber-sending-xmlnode", - plugin, PURPLE_CALLBACK(jabber_send_signal_cb), - NULL, PURPLE_SIGNAL_PRIORITY_HIGHEST); - - purple_signal_register(plugin, "jabber-sending-text", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new_outgoing(PURPLE_TYPE_STRING)); - - purple_signal_register(plugin, "jabber-receiving-message", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 6, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* id */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_STRING), /* to */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - purple_signal_register(plugin, "jabber-receiving-iq", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* id */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - purple_signal_register(plugin, "jabber-watched-iq", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 5, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* id */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); /* child */ - - /* Modifying these? Look at jabber_init_plugin for the ipc versions */ - purple_signal_register(plugin, "jabber-register-namespace-watcher", - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ - - purple_signal_register(plugin, "jabber-unregister-namespace-watcher", - purple_marshal_VOID__POINTER_POINTER, - NULL, 2, - purple_value_new(PURPLE_TYPE_STRING), /* node */ - purple_value_new(PURPLE_TYPE_STRING)); /* namespace */ - - purple_signal_connect(plugin, "jabber-register-namespace-watcher", - plugin, PURPLE_CALLBACK(jabber_iq_signal_register), NULL); - purple_signal_connect(plugin, "jabber-unregister-namespace-watcher", - plugin, PURPLE_CALLBACK(jabber_iq_signal_unregister), NULL); - - purple_signal_register(plugin, "jabber-receiving-presence", - purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 4, - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), - purple_value_new(PURPLE_TYPE_STRING), /* type */ - purple_value_new(PURPLE_TYPE_STRING), /* from */ - purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_XMLNODE)); - - return TRUE; -} - -static gboolean unload_plugin(PurplePlugin *plugin) -{ - purple_signals_unregister_by_instance(plugin); - - /* reverse order of init_plugin */ - jabber_bosh_uninit(); - jabber_data_uninit(); - jabber_si_uninit(); - jabber_ibb_uninit(); - /* PEP things should be uninit via jabber_pep_uninit, not here */ - jabber_pep_uninit(); - jabber_caps_uninit(); - jabber_iq_uninit(); - - jabber_unregister_commands(); - - /* Stay on target...stay on target... Almost there... */ - jabber_uninit_plugin(plugin); - - return TRUE; -} - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-jabber", /**< id */ - "XMPP", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("XMPP Protocol Plugin"), - /** description */ - N_("XMPP Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - load_plugin, /**< load */ - unload_plugin, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - jabber_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean xmpp_uri_handler(const char *proto, const char *user, GHashTable *params) -{ - char *acct_id = params ? g_hash_table_lookup(params, "account") : NULL; - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "xmpp")) - return FALSE; - - acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); - - if (!acct) - return FALSE; - - /* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message */ - /* params is NULL if the URI has no '?' (or anything after it) */ - if (!params || g_hash_table_lookup_extended(params, "message", NULL, NULL)) { - char *body = g_hash_table_lookup(params, "body"); - if (user && *user) { - PurpleConversation *conv = - purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, user); - purple_conversation_present(conv); - if (body && *body) - purple_conv_send_confirm(conv, body); - } - } else if (g_hash_table_lookup_extended(params, "roster", NULL, NULL)) { - char *name = g_hash_table_lookup(params, "name"); - if (user && *user) - purple_blist_request_add_buddy(acct, user, NULL, name); - } else if (g_hash_table_lookup_extended(params, "join", NULL, NULL)) { - PurpleConnection *gc = purple_account_get_connection(acct); - if (user && *user) { - GHashTable *params = jabber_chat_info_defaults(gc, user); - jabber_chat_join(gc, params); - } - return TRUE; - } - - return FALSE; -} - - -static void -init_plugin(PurplePlugin *plugin) -{ -#ifdef HAVE_CYRUS_SASL -#ifdef _WIN32 - UINT old_error_mode; - gchar *sasldir; -#endif - int ret; -#endif - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - /* Translators: 'domain' is used here in the context of Internet domains, e.g. pidgin.im */ - split = purple_account_user_split_new(_("Domain"), NULL, '@'); - purple_account_user_split_set_reverse(split, FALSE); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - split = purple_account_user_split_new(_("Resource"), NULL, '/'); - purple_account_user_split_set_reverse(split, FALSE); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_bool_new(_("Require SSL/TLS"), "require_tls", JABBER_DEFAULT_REQUIRE_TLS); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Force old (port 5223) SSL"), "old_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new( - _("Allow plaintext auth over unencrypted streams"), - "auth_plain_in_clear", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_int_new(_("Connect port"), "port", 5222); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("Connect server"), - "connect_server", NULL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("File transfer proxies"), - "ft_proxies", - /* TODO: Is this an acceptable default? - * Also, keep this in sync as they add more servers */ - JABBER_DEFAULT_FT_PROXIES); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("BOSH URL"), - "bosh_url", NULL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - /* this should probably be part of global smiley theme settings later on, - shared with MSN */ - option = purple_account_option_bool_new(_("Show Custom Smileys"), - "custom_smileys", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - my_protocol = plugin; - jabber_init_plugin(plugin); - - purple_prefs_remove("/plugins/prpl/jabber"); - - /* XXX - If any other plugin wants SASL this won't be good ... */ -#ifdef HAVE_CYRUS_SASL -#ifdef _WIN32 - sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL); - sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir); - g_free(sasldir); - /* Suppress error popups for failing to load sasl plugins */ - old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); -#endif - if ((ret = sasl_client_init(NULL)) != SASL_OK) { - purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret); - } -#ifdef _WIN32 - /* Restore the original error mode */ - SetErrorMode(old_error_mode); -#endif -#endif - jabber_register_commands(); - - /* reverse order of unload_plugin */ - jabber_iq_init(); - jabber_caps_init(); - /* PEP things should be init via jabber_pep_init, not here */ - jabber_pep_init(); - jabber_data_init(); - jabber_bosh_init(); - - /* TODO: Implement adding and retrieving own features via IPC API */ - - jabber_ibb_init(); - jabber_si_init(); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(xmpp_uri_handler), NULL); -} - - -PURPLE_INIT_PLUGIN(jabber, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,114 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - win32/posix.uname.c \ - win32/utsname.h - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -JABBERSOURCES = \ - adhoccommands.c \ - adhoccommands.h \ - auth.c \ - auth.h \ - auth_digest_md5.c \ - auth_plain.c \ - auth_scram.c \ - auth_scram.h \ - buddy.c \ - buddy.h \ - bosh.c \ - bosh.h \ - caps.c \ - caps.h \ - chat.c \ - chat.h \ - data.c \ - data.h \ - disco.c \ - disco.h \ - google.c \ - google.h \ - ibb.c \ - ibb.h \ - iq.c \ - iq.h \ - jabber.c \ - jabber.h \ - jingle/jingle.c \ - jingle/jingle.h \ - jingle/content.c \ - jingle/content.h \ - jingle/iceudp.c \ - jingle/iceudp.h \ - jingle/rawudp.c \ - jingle/rawudp.h \ - jingle/rtp.c \ - jingle/rtp.h \ - jingle/session.c \ - jingle/session.h \ - jingle/transport.c \ - jingle/transport.h \ - jutil.c \ - jutil.h \ - message.c \ - message.h \ - namespaces.h \ - oob.c \ - oob.h \ - parser.c \ - parser.h \ - pep.c \ - pep.h \ - ping.c \ - ping.h \ - presence.c \ - presence.h \ - roster.c \ - roster.h \ - si.c \ - si.h \ - useravatar.c \ - useravatar.h \ - usermood.c \ - usermood.h \ - usernick.c \ - usernick.h \ - usertune.c \ - usertune.h \ - xdata.c \ - xdata.h - -AM_CFLAGS = $(st) - -libxmpp_la_LDFLAGS = -module -avoid-version - -if USE_CYRUS_SASL -JABBERSOURCES += auth_cyrus.c -endif - -if STATIC_JABBER - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libjabber.la -libjabber_la_SOURCES = $(JABBERSOURCES) libxmpp.c -libjabber_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libjabber.la libxmpp.la -libjabber_la_SOURCES = $(JABBERSOURCES) -libjabber_la_LIBADD = $(GLIB_LIBS) $(SASL_LIBS) $(LIBXML_LIBS) $(IDN_LIBS) - -libxmpp_la_SOURCES = libxmpp.c -libxmpp_la_LIBADD = libjabber.la - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(IDN_CFLAGS) \ - $(LIBXML_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1098 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@USE_CYRUS_SASL_TRUE@am__append_1 = auth_cyrus.c -subdir = libpurple/protocols/jabber -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_JABBER_FALSE@libjabber_la_DEPENDENCIES = \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) \ -@STATIC_JABBER_FALSE@ $(am__DEPENDENCIES_1) -am__libjabber_la_SOURCES_DIST = adhoccommands.c adhoccommands.h auth.c \ - auth.h auth_digest_md5.c auth_plain.c auth_scram.c \ - auth_scram.h buddy.c buddy.h bosh.c bosh.h caps.c caps.h \ - chat.c chat.h data.c data.h disco.c disco.h google.c google.h \ - ibb.c ibb.h iq.c iq.h jabber.c jabber.h jingle/jingle.c \ - jingle/jingle.h jingle/content.c jingle/content.h \ - jingle/iceudp.c jingle/iceudp.h jingle/rawudp.c \ - jingle/rawudp.h jingle/rtp.c jingle/rtp.h jingle/session.c \ - jingle/session.h jingle/transport.c jingle/transport.h jutil.c \ - jutil.h message.c message.h namespaces.h oob.c oob.h parser.c \ - parser.h pep.c pep.h ping.c ping.h presence.c presence.h \ - roster.c roster.h si.c si.h useravatar.c useravatar.h \ - usermood.c usermood.h usernick.c usernick.h usertune.c \ - usertune.h xdata.c xdata.h auth_cyrus.c libxmpp.c -@USE_CYRUS_SASL_TRUE@am__objects_1 = libjabber_la-auth_cyrus.lo -am__objects_2 = libjabber_la-adhoccommands.lo libjabber_la-auth.lo \ - libjabber_la-auth_digest_md5.lo libjabber_la-auth_plain.lo \ - libjabber_la-auth_scram.lo libjabber_la-buddy.lo \ - libjabber_la-bosh.lo libjabber_la-caps.lo libjabber_la-chat.lo \ - libjabber_la-data.lo libjabber_la-disco.lo \ - libjabber_la-google.lo libjabber_la-ibb.lo libjabber_la-iq.lo \ - libjabber_la-jabber.lo libjabber_la-jingle.lo \ - libjabber_la-content.lo libjabber_la-iceudp.lo \ - libjabber_la-rawudp.lo libjabber_la-rtp.lo \ - libjabber_la-session.lo libjabber_la-transport.lo \ - libjabber_la-jutil.lo libjabber_la-message.lo \ - libjabber_la-oob.lo libjabber_la-parser.lo libjabber_la-pep.lo \ - libjabber_la-ping.lo libjabber_la-presence.lo \ - libjabber_la-roster.lo libjabber_la-si.lo \ - libjabber_la-useravatar.lo libjabber_la-usermood.lo \ - libjabber_la-usernick.lo libjabber_la-usertune.lo \ - libjabber_la-xdata.lo $(am__objects_1) -@STATIC_JABBER_FALSE@am_libjabber_la_OBJECTS = $(am__objects_2) -@STATIC_JABBER_TRUE@am_libjabber_la_OBJECTS = $(am__objects_2) \ -@STATIC_JABBER_TRUE@ libjabber_la-libxmpp.lo -libjabber_la_OBJECTS = $(am_libjabber_la_OBJECTS) -@STATIC_JABBER_FALSE@am_libjabber_la_rpath = -rpath $(pkgdir) -@STATIC_JABBER_TRUE@am_libjabber_la_rpath = -@STATIC_JABBER_FALSE@libxmpp_la_DEPENDENCIES = libjabber.la -am__libxmpp_la_SOURCES_DIST = libxmpp.c -@STATIC_JABBER_FALSE@am_libxmpp_la_OBJECTS = libxmpp.lo -libxmpp_la_OBJECTS = $(am_libxmpp_la_OBJECTS) -@STATIC_JABBER_FALSE@am_libxmpp_la_rpath = -rpath $(pkgdir) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libjabber_la_SOURCES) $(libxmpp_la_SOURCES) -DIST_SOURCES = $(am__libjabber_la_SOURCES_DIST) \ - $(am__libxmpp_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - win32/posix.uname.c \ - win32/utsname.h - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -JABBERSOURCES = adhoccommands.c adhoccommands.h auth.c auth.h \ - auth_digest_md5.c auth_plain.c auth_scram.c auth_scram.h \ - buddy.c buddy.h bosh.c bosh.h caps.c caps.h chat.c chat.h \ - data.c data.h disco.c disco.h google.c google.h ibb.c ibb.h \ - iq.c iq.h jabber.c jabber.h jingle/jingle.c jingle/jingle.h \ - jingle/content.c jingle/content.h jingle/iceudp.c \ - jingle/iceudp.h jingle/rawudp.c jingle/rawudp.h jingle/rtp.c \ - jingle/rtp.h jingle/session.c jingle/session.h \ - jingle/transport.c jingle/transport.h jutil.c jutil.h \ - message.c message.h namespaces.h oob.c oob.h parser.c parser.h \ - pep.c pep.h ping.c ping.h presence.c presence.h roster.c \ - roster.h si.c si.h useravatar.c useravatar.h usermood.c \ - usermood.h usernick.c usernick.h usertune.c usertune.h xdata.c \ - xdata.h $(am__append_1) -AM_CFLAGS = $(st) -libxmpp_la_LDFLAGS = -module -avoid-version -@STATIC_JABBER_FALSE@st = -@STATIC_JABBER_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_JABBER_TRUE@noinst_LTLIBRARIES = libjabber.la -@STATIC_JABBER_FALSE@libjabber_la_SOURCES = $(JABBERSOURCES) -@STATIC_JABBER_TRUE@libjabber_la_SOURCES = $(JABBERSOURCES) libxmpp.c -@STATIC_JABBER_TRUE@libjabber_la_CFLAGS = $(AM_CFLAGS) -@STATIC_JABBER_FALSE@pkg_LTLIBRARIES = libjabber.la libxmpp.la -@STATIC_JABBER_FALSE@libjabber_la_LIBADD = $(GLIB_LIBS) $(SASL_LIBS) $(LIBXML_LIBS) $(IDN_LIBS) -@STATIC_JABBER_FALSE@libxmpp_la_SOURCES = libxmpp.c -@STATIC_JABBER_FALSE@libxmpp_la_LIBADD = libjabber.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(IDN_CFLAGS) \ - $(LIBXML_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/jabber/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/jabber/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libjabber.la: $(libjabber_la_OBJECTS) $(libjabber_la_DEPENDENCIES) - $(LINK) $(am_libjabber_la_rpath) $(libjabber_la_LDFLAGS) $(libjabber_la_OBJECTS) $(libjabber_la_LIBADD) $(LIBS) -libxmpp.la: $(libxmpp_la_OBJECTS) $(libxmpp_la_DEPENDENCIES) - $(LINK) $(am_libxmpp_la_rpath) $(libxmpp_la_LDFLAGS) $(libxmpp_la_OBJECTS) $(libxmpp_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-adhoccommands.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-auth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-auth_cyrus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-auth_digest_md5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-auth_plain.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-auth_scram.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-bosh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-caps.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-content.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-data.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-disco.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-google.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-ibb.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-iceudp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-iq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-jabber.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-jingle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-jutil.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-libxmpp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-message.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-oob.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-parser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-pep.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-ping.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-presence.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-rawudp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-roster.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-rtp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-si.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-transport.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-useravatar.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-usermood.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-usernick.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-usertune.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libjabber_la-xdata.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxmpp.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libjabber_la-adhoccommands.lo: adhoccommands.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-adhoccommands.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-adhoccommands.Tpo" -c -o libjabber_la-adhoccommands.lo `test -f 'adhoccommands.c' || echo '$(srcdir)/'`adhoccommands.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-adhoccommands.Tpo" "$(DEPDIR)/libjabber_la-adhoccommands.Plo"; else rm -f "$(DEPDIR)/libjabber_la-adhoccommands.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='adhoccommands.c' object='libjabber_la-adhoccommands.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-adhoccommands.lo `test -f 'adhoccommands.c' || echo '$(srcdir)/'`adhoccommands.c - -libjabber_la-auth.lo: auth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-auth.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-auth.Tpo" -c -o libjabber_la-auth.lo `test -f 'auth.c' || echo '$(srcdir)/'`auth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-auth.Tpo" "$(DEPDIR)/libjabber_la-auth.Plo"; else rm -f "$(DEPDIR)/libjabber_la-auth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='auth.c' object='libjabber_la-auth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-auth.lo `test -f 'auth.c' || echo '$(srcdir)/'`auth.c - -libjabber_la-auth_digest_md5.lo: auth_digest_md5.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-auth_digest_md5.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-auth_digest_md5.Tpo" -c -o libjabber_la-auth_digest_md5.lo `test -f 'auth_digest_md5.c' || echo '$(srcdir)/'`auth_digest_md5.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-auth_digest_md5.Tpo" "$(DEPDIR)/libjabber_la-auth_digest_md5.Plo"; else rm -f "$(DEPDIR)/libjabber_la-auth_digest_md5.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='auth_digest_md5.c' object='libjabber_la-auth_digest_md5.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-auth_digest_md5.lo `test -f 'auth_digest_md5.c' || echo '$(srcdir)/'`auth_digest_md5.c - -libjabber_la-auth_plain.lo: auth_plain.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-auth_plain.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-auth_plain.Tpo" -c -o libjabber_la-auth_plain.lo `test -f 'auth_plain.c' || echo '$(srcdir)/'`auth_plain.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-auth_plain.Tpo" "$(DEPDIR)/libjabber_la-auth_plain.Plo"; else rm -f "$(DEPDIR)/libjabber_la-auth_plain.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='auth_plain.c' object='libjabber_la-auth_plain.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-auth_plain.lo `test -f 'auth_plain.c' || echo '$(srcdir)/'`auth_plain.c - -libjabber_la-auth_scram.lo: auth_scram.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-auth_scram.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-auth_scram.Tpo" -c -o libjabber_la-auth_scram.lo `test -f 'auth_scram.c' || echo '$(srcdir)/'`auth_scram.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-auth_scram.Tpo" "$(DEPDIR)/libjabber_la-auth_scram.Plo"; else rm -f "$(DEPDIR)/libjabber_la-auth_scram.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='auth_scram.c' object='libjabber_la-auth_scram.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-auth_scram.lo `test -f 'auth_scram.c' || echo '$(srcdir)/'`auth_scram.c - -libjabber_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-buddy.Tpo" -c -o libjabber_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-buddy.Tpo" "$(DEPDIR)/libjabber_la-buddy.Plo"; else rm -f "$(DEPDIR)/libjabber_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libjabber_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libjabber_la-bosh.lo: bosh.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-bosh.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-bosh.Tpo" -c -o libjabber_la-bosh.lo `test -f 'bosh.c' || echo '$(srcdir)/'`bosh.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-bosh.Tpo" "$(DEPDIR)/libjabber_la-bosh.Plo"; else rm -f "$(DEPDIR)/libjabber_la-bosh.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bosh.c' object='libjabber_la-bosh.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-bosh.lo `test -f 'bosh.c' || echo '$(srcdir)/'`bosh.c - -libjabber_la-caps.lo: caps.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-caps.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-caps.Tpo" -c -o libjabber_la-caps.lo `test -f 'caps.c' || echo '$(srcdir)/'`caps.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-caps.Tpo" "$(DEPDIR)/libjabber_la-caps.Plo"; else rm -f "$(DEPDIR)/libjabber_la-caps.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='caps.c' object='libjabber_la-caps.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-caps.lo `test -f 'caps.c' || echo '$(srcdir)/'`caps.c - -libjabber_la-chat.lo: chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-chat.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-chat.Tpo" -c -o libjabber_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-chat.Tpo" "$(DEPDIR)/libjabber_la-chat.Plo"; else rm -f "$(DEPDIR)/libjabber_la-chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chat.c' object='libjabber_la-chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c - -libjabber_la-data.lo: data.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-data.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-data.Tpo" -c -o libjabber_la-data.lo `test -f 'data.c' || echo '$(srcdir)/'`data.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-data.Tpo" "$(DEPDIR)/libjabber_la-data.Plo"; else rm -f "$(DEPDIR)/libjabber_la-data.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='data.c' object='libjabber_la-data.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-data.lo `test -f 'data.c' || echo '$(srcdir)/'`data.c - -libjabber_la-disco.lo: disco.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-disco.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-disco.Tpo" -c -o libjabber_la-disco.lo `test -f 'disco.c' || echo '$(srcdir)/'`disco.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-disco.Tpo" "$(DEPDIR)/libjabber_la-disco.Plo"; else rm -f "$(DEPDIR)/libjabber_la-disco.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='disco.c' object='libjabber_la-disco.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-disco.lo `test -f 'disco.c' || echo '$(srcdir)/'`disco.c - -libjabber_la-google.lo: google.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-google.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-google.Tpo" -c -o libjabber_la-google.lo `test -f 'google.c' || echo '$(srcdir)/'`google.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-google.Tpo" "$(DEPDIR)/libjabber_la-google.Plo"; else rm -f "$(DEPDIR)/libjabber_la-google.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='google.c' object='libjabber_la-google.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-google.lo `test -f 'google.c' || echo '$(srcdir)/'`google.c - -libjabber_la-ibb.lo: ibb.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-ibb.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-ibb.Tpo" -c -o libjabber_la-ibb.lo `test -f 'ibb.c' || echo '$(srcdir)/'`ibb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-ibb.Tpo" "$(DEPDIR)/libjabber_la-ibb.Plo"; else rm -f "$(DEPDIR)/libjabber_la-ibb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ibb.c' object='libjabber_la-ibb.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-ibb.lo `test -f 'ibb.c' || echo '$(srcdir)/'`ibb.c - -libjabber_la-iq.lo: iq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-iq.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-iq.Tpo" -c -o libjabber_la-iq.lo `test -f 'iq.c' || echo '$(srcdir)/'`iq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-iq.Tpo" "$(DEPDIR)/libjabber_la-iq.Plo"; else rm -f "$(DEPDIR)/libjabber_la-iq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='iq.c' object='libjabber_la-iq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-iq.lo `test -f 'iq.c' || echo '$(srcdir)/'`iq.c - -libjabber_la-jabber.lo: jabber.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-jabber.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-jabber.Tpo" -c -o libjabber_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-jabber.Tpo" "$(DEPDIR)/libjabber_la-jabber.Plo"; else rm -f "$(DEPDIR)/libjabber_la-jabber.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jabber.c' object='libjabber_la-jabber.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-jabber.lo `test -f 'jabber.c' || echo '$(srcdir)/'`jabber.c - -libjabber_la-jingle.lo: jingle/jingle.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-jingle.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-jingle.Tpo" -c -o libjabber_la-jingle.lo `test -f 'jingle/jingle.c' || echo '$(srcdir)/'`jingle/jingle.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-jingle.Tpo" "$(DEPDIR)/libjabber_la-jingle.Plo"; else rm -f "$(DEPDIR)/libjabber_la-jingle.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/jingle.c' object='libjabber_la-jingle.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-jingle.lo `test -f 'jingle/jingle.c' || echo '$(srcdir)/'`jingle/jingle.c - -libjabber_la-content.lo: jingle/content.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-content.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-content.Tpo" -c -o libjabber_la-content.lo `test -f 'jingle/content.c' || echo '$(srcdir)/'`jingle/content.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-content.Tpo" "$(DEPDIR)/libjabber_la-content.Plo"; else rm -f "$(DEPDIR)/libjabber_la-content.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/content.c' object='libjabber_la-content.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-content.lo `test -f 'jingle/content.c' || echo '$(srcdir)/'`jingle/content.c - -libjabber_la-iceudp.lo: jingle/iceudp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-iceudp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-iceudp.Tpo" -c -o libjabber_la-iceudp.lo `test -f 'jingle/iceudp.c' || echo '$(srcdir)/'`jingle/iceudp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-iceudp.Tpo" "$(DEPDIR)/libjabber_la-iceudp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-iceudp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/iceudp.c' object='libjabber_la-iceudp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-iceudp.lo `test -f 'jingle/iceudp.c' || echo '$(srcdir)/'`jingle/iceudp.c - -libjabber_la-rawudp.lo: jingle/rawudp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-rawudp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-rawudp.Tpo" -c -o libjabber_la-rawudp.lo `test -f 'jingle/rawudp.c' || echo '$(srcdir)/'`jingle/rawudp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-rawudp.Tpo" "$(DEPDIR)/libjabber_la-rawudp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-rawudp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/rawudp.c' object='libjabber_la-rawudp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-rawudp.lo `test -f 'jingle/rawudp.c' || echo '$(srcdir)/'`jingle/rawudp.c - -libjabber_la-rtp.lo: jingle/rtp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-rtp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-rtp.Tpo" -c -o libjabber_la-rtp.lo `test -f 'jingle/rtp.c' || echo '$(srcdir)/'`jingle/rtp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-rtp.Tpo" "$(DEPDIR)/libjabber_la-rtp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-rtp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/rtp.c' object='libjabber_la-rtp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-rtp.lo `test -f 'jingle/rtp.c' || echo '$(srcdir)/'`jingle/rtp.c - -libjabber_la-session.lo: jingle/session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-session.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-session.Tpo" -c -o libjabber_la-session.lo `test -f 'jingle/session.c' || echo '$(srcdir)/'`jingle/session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-session.Tpo" "$(DEPDIR)/libjabber_la-session.Plo"; else rm -f "$(DEPDIR)/libjabber_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/session.c' object='libjabber_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-session.lo `test -f 'jingle/session.c' || echo '$(srcdir)/'`jingle/session.c - -libjabber_la-transport.lo: jingle/transport.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-transport.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-transport.Tpo" -c -o libjabber_la-transport.lo `test -f 'jingle/transport.c' || echo '$(srcdir)/'`jingle/transport.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-transport.Tpo" "$(DEPDIR)/libjabber_la-transport.Plo"; else rm -f "$(DEPDIR)/libjabber_la-transport.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jingle/transport.c' object='libjabber_la-transport.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-transport.lo `test -f 'jingle/transport.c' || echo '$(srcdir)/'`jingle/transport.c - -libjabber_la-jutil.lo: jutil.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-jutil.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-jutil.Tpo" -c -o libjabber_la-jutil.lo `test -f 'jutil.c' || echo '$(srcdir)/'`jutil.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-jutil.Tpo" "$(DEPDIR)/libjabber_la-jutil.Plo"; else rm -f "$(DEPDIR)/libjabber_la-jutil.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='jutil.c' object='libjabber_la-jutil.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-jutil.lo `test -f 'jutil.c' || echo '$(srcdir)/'`jutil.c - -libjabber_la-message.lo: message.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-message.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-message.Tpo" -c -o libjabber_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-message.Tpo" "$(DEPDIR)/libjabber_la-message.Plo"; else rm -f "$(DEPDIR)/libjabber_la-message.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='message.c' object='libjabber_la-message.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c - -libjabber_la-oob.lo: oob.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-oob.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-oob.Tpo" -c -o libjabber_la-oob.lo `test -f 'oob.c' || echo '$(srcdir)/'`oob.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-oob.Tpo" "$(DEPDIR)/libjabber_la-oob.Plo"; else rm -f "$(DEPDIR)/libjabber_la-oob.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oob.c' object='libjabber_la-oob.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-oob.lo `test -f 'oob.c' || echo '$(srcdir)/'`oob.c - -libjabber_la-parser.lo: parser.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-parser.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-parser.Tpo" -c -o libjabber_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-parser.Tpo" "$(DEPDIR)/libjabber_la-parser.Plo"; else rm -f "$(DEPDIR)/libjabber_la-parser.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='parser.c' object='libjabber_la-parser.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-parser.lo `test -f 'parser.c' || echo '$(srcdir)/'`parser.c - -libjabber_la-pep.lo: pep.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-pep.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-pep.Tpo" -c -o libjabber_la-pep.lo `test -f 'pep.c' || echo '$(srcdir)/'`pep.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-pep.Tpo" "$(DEPDIR)/libjabber_la-pep.Plo"; else rm -f "$(DEPDIR)/libjabber_la-pep.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pep.c' object='libjabber_la-pep.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-pep.lo `test -f 'pep.c' || echo '$(srcdir)/'`pep.c - -libjabber_la-ping.lo: ping.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-ping.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-ping.Tpo" -c -o libjabber_la-ping.lo `test -f 'ping.c' || echo '$(srcdir)/'`ping.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-ping.Tpo" "$(DEPDIR)/libjabber_la-ping.Plo"; else rm -f "$(DEPDIR)/libjabber_la-ping.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ping.c' object='libjabber_la-ping.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-ping.lo `test -f 'ping.c' || echo '$(srcdir)/'`ping.c - -libjabber_la-presence.lo: presence.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-presence.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-presence.Tpo" -c -o libjabber_la-presence.lo `test -f 'presence.c' || echo '$(srcdir)/'`presence.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-presence.Tpo" "$(DEPDIR)/libjabber_la-presence.Plo"; else rm -f "$(DEPDIR)/libjabber_la-presence.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='presence.c' object='libjabber_la-presence.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-presence.lo `test -f 'presence.c' || echo '$(srcdir)/'`presence.c - -libjabber_la-roster.lo: roster.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-roster.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-roster.Tpo" -c -o libjabber_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-roster.Tpo" "$(DEPDIR)/libjabber_la-roster.Plo"; else rm -f "$(DEPDIR)/libjabber_la-roster.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='roster.c' object='libjabber_la-roster.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c - -libjabber_la-si.lo: si.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-si.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-si.Tpo" -c -o libjabber_la-si.lo `test -f 'si.c' || echo '$(srcdir)/'`si.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-si.Tpo" "$(DEPDIR)/libjabber_la-si.Plo"; else rm -f "$(DEPDIR)/libjabber_la-si.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='si.c' object='libjabber_la-si.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-si.lo `test -f 'si.c' || echo '$(srcdir)/'`si.c - -libjabber_la-useravatar.lo: useravatar.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-useravatar.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-useravatar.Tpo" -c -o libjabber_la-useravatar.lo `test -f 'useravatar.c' || echo '$(srcdir)/'`useravatar.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-useravatar.Tpo" "$(DEPDIR)/libjabber_la-useravatar.Plo"; else rm -f "$(DEPDIR)/libjabber_la-useravatar.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='useravatar.c' object='libjabber_la-useravatar.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-useravatar.lo `test -f 'useravatar.c' || echo '$(srcdir)/'`useravatar.c - -libjabber_la-usermood.lo: usermood.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-usermood.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-usermood.Tpo" -c -o libjabber_la-usermood.lo `test -f 'usermood.c' || echo '$(srcdir)/'`usermood.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-usermood.Tpo" "$(DEPDIR)/libjabber_la-usermood.Plo"; else rm -f "$(DEPDIR)/libjabber_la-usermood.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usermood.c' object='libjabber_la-usermood.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-usermood.lo `test -f 'usermood.c' || echo '$(srcdir)/'`usermood.c - -libjabber_la-usernick.lo: usernick.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-usernick.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-usernick.Tpo" -c -o libjabber_la-usernick.lo `test -f 'usernick.c' || echo '$(srcdir)/'`usernick.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-usernick.Tpo" "$(DEPDIR)/libjabber_la-usernick.Plo"; else rm -f "$(DEPDIR)/libjabber_la-usernick.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usernick.c' object='libjabber_la-usernick.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-usernick.lo `test -f 'usernick.c' || echo '$(srcdir)/'`usernick.c - -libjabber_la-usertune.lo: usertune.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-usertune.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-usertune.Tpo" -c -o libjabber_la-usertune.lo `test -f 'usertune.c' || echo '$(srcdir)/'`usertune.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-usertune.Tpo" "$(DEPDIR)/libjabber_la-usertune.Plo"; else rm -f "$(DEPDIR)/libjabber_la-usertune.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usertune.c' object='libjabber_la-usertune.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-usertune.lo `test -f 'usertune.c' || echo '$(srcdir)/'`usertune.c - -libjabber_la-xdata.lo: xdata.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-xdata.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-xdata.Tpo" -c -o libjabber_la-xdata.lo `test -f 'xdata.c' || echo '$(srcdir)/'`xdata.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-xdata.Tpo" "$(DEPDIR)/libjabber_la-xdata.Plo"; else rm -f "$(DEPDIR)/libjabber_la-xdata.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdata.c' object='libjabber_la-xdata.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-xdata.lo `test -f 'xdata.c' || echo '$(srcdir)/'`xdata.c - -libjabber_la-auth_cyrus.lo: auth_cyrus.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-auth_cyrus.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-auth_cyrus.Tpo" -c -o libjabber_la-auth_cyrus.lo `test -f 'auth_cyrus.c' || echo '$(srcdir)/'`auth_cyrus.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-auth_cyrus.Tpo" "$(DEPDIR)/libjabber_la-auth_cyrus.Plo"; else rm -f "$(DEPDIR)/libjabber_la-auth_cyrus.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='auth_cyrus.c' object='libjabber_la-auth_cyrus.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-auth_cyrus.lo `test -f 'auth_cyrus.c' || echo '$(srcdir)/'`auth_cyrus.c - -libjabber_la-libxmpp.lo: libxmpp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -MT libjabber_la-libxmpp.lo -MD -MP -MF "$(DEPDIR)/libjabber_la-libxmpp.Tpo" -c -o libjabber_la-libxmpp.lo `test -f 'libxmpp.c' || echo '$(srcdir)/'`libxmpp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libjabber_la-libxmpp.Tpo" "$(DEPDIR)/libjabber_la-libxmpp.Plo"; else rm -f "$(DEPDIR)/libjabber_la-libxmpp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libxmpp.c' object='libjabber_la-libxmpp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libjabber_la_CFLAGS) $(CFLAGS) -c -o libjabber_la-libxmpp.lo `test -f 'libxmpp.c' || echo '$(srcdir)/'`libxmpp.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/win32 - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libjabber -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libjabber -XMPP_TARGET = libxmpp -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I./win32 \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(LIBXML2_TOP)/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(LIBXML2_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L. - -## -## SOURCES, OBJECTS -## -C_SRC = \ - adhoccommands.c \ - auth.c \ - auth_cyrus.c \ - auth_digest_md5.c \ - auth_plain.c \ - auth_scram.c \ - buddy.c \ - bosh.c \ - caps.c \ - chat.c \ - data.c \ - disco.c \ - google.c \ - ibb.c \ - iq.c \ - jabber.c \ - jingle/jingle.c \ - jingle/content.c \ - jingle/iceudp.c \ - jingle/rawudp.c \ - jingle/rtp.c \ - jingle/session.c \ - jingle/transport.c \ - jutil.c \ - message.c \ - oob.c \ - parser.c \ - pep.c \ - ping.c \ - presence.c \ - roster.c \ - si.c \ - useravatar.c \ - usermood.c \ - usernick.c \ - usertune.c \ - xdata.c \ - win32/posix.uname.c - -OBJECTS = $(C_SRC:%.c=%.o) - -XMPP_C_SRC = libxmpp.c -XMPP_OBJECTS = $(XMPP_C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lgobject-2.0 \ - -lxml2 \ - -lws2_32 \ - -lintl \ - -lpurple - -ifeq ($(CYRUS_SASL), 1) -CYRUS_SASL_TOP := $(WIN32_DEV_TOP)/cyrus-sasl-2.1.22-daa1 -INCLUDE_PATHS += -I$(CYRUS_SASL_TOP)/include -LIB_PATHS += -L$(CYRUS_SASL_TOP)/bin -LIBS += -llibsasl -CYRUS_SASL_DLLS = \ - $(CYRUS_SASL_TOP)/bin/libsasl.dll - -CYRUS_SASL_PLUGINS = \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslANONYMOUS.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslCRAMMD5.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslDIGESTMD5.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslGSSAPI.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslLOGIN.dll \ - $(CYRUS_SASL_TOP)/bin/sasl2/saslPLAIN.dll - -endif - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll $(XMPP_TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(XMPP_TARGET).dll $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) -ifeq ($(CYRUS_SASL), 1) - mkdir -p $(PURPLE_INSTALL_DIR)/sasl2 - cp $(CYRUS_SASL_DLLS) $(PURPLE_INSTALL_DIR) - cp $(CYRUS_SASL_PLUGINS) $(PURPLE_INSTALL_DIR)/sasl2 -endif - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll $(TARGET).dll.a: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -$(XMPP_TARGET).dll: $(TARGET).dll.a $(XMPP_OBJECTS) - $(CC) -shared $(XMPP_OBJECTS) $(LIB_PATHS) $(LIBS) -ljabber $(DLL_LD_FLAGS) -o $(XMPP_TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a - rm -f $(XMPP_OBJECTS) $(XMPP_TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1324 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "debug.h" -#include "notify.h" -#include "server.h" -#include "util.h" -#include "adhoccommands.h" -#include "buddy.h" -#include "chat.h" -#include "data.h" -#include "google.h" -#include "message.h" -#include "xmlnode.h" -#include "pep.h" -#include "smiley.h" -#include "iq.h" - -#include <string.h> - -void jabber_message_free(JabberMessage *jm) -{ - g_free(jm->from); - g_free(jm->to); - g_free(jm->id); - g_free(jm->subject); - g_free(jm->body); - g_free(jm->xhtml); - g_free(jm->password); - g_free(jm->error); - g_free(jm->thread_id); - g_list_free(jm->etc); - g_list_free(jm->eventitems); - - g_free(jm); -} - -static void handle_chat(JabberMessage *jm) -{ - JabberID *jid = jabber_id_new(jm->from); - - PurpleConnection *gc; - PurpleAccount *account; - JabberBuddy *jb; - JabberBuddyResource *jbr; - - if(!jid) - return; - - gc = jm->js->gc; - account = purple_connection_get_account(gc); - - jb = jabber_buddy_find(jm->js, jm->from, TRUE); - jbr = jabber_buddy_find_resource(jb, jid->resource); - - if (jid->resource) { - /* - * We received a message from a specific resource, so we probably want a - * reply to go to this specific resource (i.e. bind/lock the - * conversation to this resource). - * - * This works because purple_conv_im_send gets the name from - * purple_conversation_get_name() - */ - PurpleConversation *conv; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, jm->from, account); - if (conv && !g_str_equal(jm->from, purple_conversation_get_name(conv))) { - purple_debug_info("jabber", "Binding conversation to %s\n", jm->from); - purple_conversation_set_name(conv, jm->from); - } - } - - if(!jm->xhtml && !jm->body) { - if (jbr) { - if (jm->chat_state != JM_STATE_NONE) - jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; - else - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; - } - - if(JM_STATE_COMPOSING == jm->chat_state) { - serv_got_typing(gc, jm->from, 0, PURPLE_TYPING); - } else if(JM_STATE_PAUSED == jm->chat_state) { - serv_got_typing(gc, jm->from, 0, PURPLE_TYPED); - } else if(JM_STATE_GONE == jm->chat_state) { - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - jm->from, account); - if (conv && jid->node && jid->domain) { - char buf[256]; - PurpleBuddy *buddy; - - g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain); - - if ((buddy = purple_find_buddy(account, buf))) { - const char *who; - char *escaped; - - who = purple_buddy_get_alias(buddy); - escaped = g_markup_escape_text(who, -1); - - g_snprintf(buf, sizeof(buf), - _("%s has left the conversation."), escaped); - g_free(escaped); - - /* At some point when we restructure PurpleConversation, - * this should be able to be implemented by removing the - * user from the conversation like we do with chats now. */ - purple_conversation_write(conv, "", buf, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - } - serv_got_typing_stopped(gc, jm->from); - - } else { - serv_got_typing_stopped(gc, jm->from); - } - } else { - if(jbr) { - if (jm->chat_state != JM_STATE_NONE) - jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; - else - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; - - if(jbr->thread_id) - g_free(jbr->thread_id); - jbr->thread_id = g_strdup(jbr->thread_id); - } - - if (jm->js->googletalk && jm->xhtml == NULL) { - char *tmp = jm->body; - jm->body = jabber_google_format_to_html(jm->body); - g_free(tmp); - } - serv_got_im(gc, jm->from, jm->xhtml ? jm->xhtml : jm->body, 0, jm->sent); - } - - jabber_id_free(jid); -} - -static void handle_headline(JabberMessage *jm) -{ - char *title; - GString *body; - GList *etc; - - if(!jm->xhtml && !jm->body) - return; /* ignore headlines without any content */ - - body = g_string_new(""); - title = g_strdup_printf(_("Message from %s"), jm->from); - - if(jm->xhtml) - g_string_append(body, jm->xhtml); - else if(jm->body) - g_string_append(body, jm->body); - - for(etc = jm->etc; etc; etc = etc->next) { - xmlnode *x = etc->data; - const char *xmlns = xmlnode_get_namespace(x); - if(xmlns && !strcmp(xmlns, NS_OOB_X_DATA)) { - xmlnode *url, *desc; - char *urltxt, *desctxt; - - url = xmlnode_get_child(x, "url"); - desc = xmlnode_get_child(x, "desc"); - - if(!url || !desc) - continue; - - urltxt = xmlnode_get_data(url); - desctxt = xmlnode_get_data(desc); - - /* I'm all about ugly hacks */ - if(body->len && jm->body && !strcmp(body->str, jm->body)) - g_string_printf(body, "<a href='%s'>%s</a>", - urltxt, desctxt); - else - g_string_append_printf(body, "<br/><a href='%s'>%s</a>", - urltxt, desctxt); - - g_free(urltxt); - g_free(desctxt); - } - } - - purple_notify_formatted(jm->js->gc, title, jm->subject ? jm->subject : title, - NULL, body->str, NULL, NULL); - - g_free(title); - g_string_free(body, TRUE); -} - -static void handle_groupchat(JabberMessage *jm) -{ - JabberID *jid = jabber_id_new(jm->from); - JabberChat *chat; - - if(!jid) - return; - - chat = jabber_chat_find(jm->js, jid->node, jid->domain); - - if(!chat) - return; - - if(jm->subject) { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(chat->conv), jid->resource, - jm->subject); - if(!jm->xhtml && !jm->body) { - char *msg, *tmp, *tmp2; - tmp = g_markup_escape_text(jm->subject, -1); - tmp2 = purple_markup_linkify(tmp); - if(jid->resource) - msg = g_strdup_printf(_("%s has set the topic to: %s"), jid->resource, tmp2); - else - msg = g_strdup_printf(_("The topic is: %s"), tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", msg, PURPLE_MESSAGE_SYSTEM, jm->sent); - g_free(tmp); - g_free(tmp2); - g_free(msg); - } - } - - if(jm->xhtml || jm->body) { - if(jid->resource) - serv_got_chat_in(jm->js->gc, chat->id, jid->resource, - jm->delayed ? PURPLE_MESSAGE_DELAYED : 0, - jm->xhtml ? jm->xhtml : jm->body, jm->sent); - else if(chat->muc) - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", - jm->xhtml ? jm->xhtml : jm->body, - PURPLE_MESSAGE_SYSTEM, jm->sent); - } - - jabber_id_free(jid); -} - -static void handle_groupchat_invite(JabberMessage *jm) -{ - GHashTable *components; - JabberID *jid = jabber_id_new(jm->to); - - if(!jid) - return; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - g_hash_table_replace(components, "room", g_strdup(jid->node)); - g_hash_table_replace(components, "server", g_strdup(jid->domain)); - g_hash_table_replace(components, "handle", g_strdup(jm->js->user->node)); - g_hash_table_replace(components, "password", g_strdup(jm->password)); - - jabber_id_free(jid); - serv_got_chat_invite(jm->js->gc, jm->to, jm->from, jm->body, components); -} - -static void handle_error(JabberMessage *jm) -{ - char *buf; - - if(!jm->body) - return; - - buf = g_strdup_printf(_("Message delivery to %s failed: %s"), - jm->from, jm->error ? jm->error : ""); - - purple_notify_formatted(jm->js->gc, _("XMPP Message Error"), _("XMPP Message Error"), buf, - jm->xhtml ? jm->xhtml : jm->body, NULL, NULL); - - g_free(buf); -} - -static void handle_buzz(JabberMessage *jm) { - PurpleBuddy *buddy; - PurpleAccount *account; - - /* Delayed buzz MUST NOT be accepted */ - if(jm->delayed) - return; - - /* Reject buzz when it's not enabled */ - if(!jm->js->allowBuzz) - return; - - account = purple_connection_get_account(jm->js->gc); - - if ((buddy = purple_find_buddy(account, jm->from)) == NULL) - return; /* Do not accept buzzes from unknown people */ - - /* xmpp only has 1 attention type, so index is 0 */ - purple_prpl_got_attention(jm->js->gc, jm->from, 0); -} - -/* used internally by the functions below */ -typedef struct { - gchar *cid; - gchar *alt; -} JabberSmileyRef; - - -static void -jabber_message_get_refs_from_xmlnode_internal(const xmlnode *message, - GHashTable *table) -{ - xmlnode *child; - - for (child = xmlnode_get_child(message, "img") ; child ; - child = xmlnode_get_next_twin(child)) { - const gchar *src = xmlnode_get_attrib(child, "src"); - - if (g_str_has_prefix(src, "cid:")) { - const gchar *cid = src + 4; - - /* if we haven't "fetched" this yet... */ - if (!g_hash_table_lookup(table, cid)) { - /* take a copy of the cid and let the SmileyRef own it... */ - gchar *temp_cid = g_strdup(cid); - JabberSmileyRef *ref = g_new0(JabberSmileyRef, 1); - const gchar *alt = xmlnode_get_attrib(child, "alt"); - ref->cid = temp_cid; - /* if there is no "alt" string, use the cid... - include the entire src, eg. "cid:.." to avoid linkification */ - if (alt && alt[0] != '\0') { - /* workaround for when "alt" is set to the value of the - CID (which Jabbim seems to do), to avoid it showing up - as an mailto: link */ - if (purple_email_is_valid(alt)) { - ref->alt = g_strdup_printf("smiley:%s", alt); - } else { - ref->alt = g_strdup(alt); - } - } else { - ref->alt = g_strdup(src); - } - g_hash_table_insert(table, temp_cid, ref); - } - } - } - - for (child = message->child ; child ; child = child->next) { - jabber_message_get_refs_from_xmlnode_internal(child, table); - } -} - -static gboolean -jabber_message_get_refs_steal(gpointer key, gpointer value, gpointer user_data) -{ - GList **refs = (GList **) user_data; - JabberSmileyRef *ref = (JabberSmileyRef *) value; - - *refs = g_list_append(*refs, ref); - - return TRUE; -} - -static GList * -jabber_message_get_refs_from_xmlnode(const xmlnode *message) -{ - GList *refs = NULL; - GHashTable *unique_refs = g_hash_table_new(g_str_hash, g_str_equal); - - jabber_message_get_refs_from_xmlnode_internal(message, unique_refs); - (void) g_hash_table_foreach_steal(unique_refs, - jabber_message_get_refs_steal, (gpointer) &refs); - g_hash_table_destroy(unique_refs); - return refs; -} - -static gchar * -jabber_message_xml_to_string_strip_img_smileys(xmlnode *xhtml) -{ - gchar *markup = xmlnode_to_str(xhtml, NULL); - int len = strlen(markup); - int pos = 0; - GString *out = g_string_new(NULL); - - while (pos < len) { - /* this is a bit cludgy, maybe there is a better way to do this... - we need to find all <img> tags within the XHTML and replace those - tags with the value of their "alt" attributes */ - if (g_str_has_prefix(&(markup[pos]), "<img")) { - xmlnode *img = NULL; - int pos2 = pos; - const gchar *src; - - for (; pos2 < len ; pos2++) { - if (g_str_has_prefix(&(markup[pos2]), "/>")) { - pos2 += 2; - break; - } else if (g_str_has_prefix(&(markup[pos2]), "</img>")) { - pos2 += 5; - break; - } - } - - /* note, if the above loop didn't find the end of the <img> tag, - it the parsed string will be until the end of the input string, - in which case xmlnode_from_str will bail out and return NULL, - in this case the "if" statement below doesn't trigger and the - text is copied unchanged */ - img = xmlnode_from_str(&(markup[pos]), pos2 - pos); - src = xmlnode_get_attrib(img, "src"); - - if (g_str_has_prefix(src, "cid:")) { - const gchar *alt = xmlnode_get_attrib(img, "alt"); - /* if the "alt" attribute is empty, put the cid as smiley string */ - if (alt && alt[0] != '\0') { - /* if the "alt" is the same as the CID, as Jabbim does, - this prevents linkification... */ - if (purple_email_is_valid(alt)) { - gchar *safe_alt = g_strdup_printf("smiley:%s", alt); - out = g_string_append(out, safe_alt); - g_free(safe_alt); - } else { - out = g_string_append(out, alt); - } - } else { - out = g_string_append(out, src); - } - pos += pos2 - pos; - } else { - out = g_string_append_c(out, markup[pos]); - pos++; - } - - xmlnode_free(img); - - } else { - out = g_string_append_c(out, markup[pos]); - pos++; - } - } - - g_free(markup); - return g_string_free(out, FALSE); -} - -static void -jabber_message_add_remote_smileys(const xmlnode *message) -{ - xmlnode *data_tag; - for (data_tag = xmlnode_get_child_with_namespace(message, "data", NS_BOB) ; - data_tag ; - data_tag = xmlnode_get_next_twin(data_tag)) { - const gchar *cid = xmlnode_get_attrib(data_tag, "cid"); - const JabberData *data = jabber_data_find_remote_by_cid(cid); - - if (!data && cid != NULL) { - /* we haven't cached this already, let's add it */ - JabberData *new_data = jabber_data_create_from_xml(data_tag); - jabber_data_associate_remote(new_data); - } - } -} - -/* used in the function below to supply a conversation and shortcut for a - smiley */ -typedef struct { - PurpleConversation *conv; - gchar *alt; -} JabberDataRef; - -static void -jabber_message_get_data_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - JabberDataRef *ref = (JabberDataRef *) data; - PurpleConversation *conv = ref->conv; - const gchar *alt = ref->alt; - xmlnode *data_element = xmlnode_get_child(packet, "data"); - xmlnode *item_not_found = xmlnode_get_child(packet, "item-not-found"); - - /* did we get a data element as result? */ - if (data_element && type == JABBER_IQ_RESULT) { - JabberData *data = jabber_data_create_from_xml(data_element); - - if (data) { - jabber_data_associate_remote(data); - purple_conv_custom_smiley_write(conv, alt, - jabber_data_get_data(data), - jabber_data_get_size(data)); - purple_conv_custom_smiley_close(conv, alt); - } - - } else if (item_not_found) { - purple_debug_info("jabber", - "Responder didn't recognize requested data\n"); - } else { - purple_debug_error("jabber", "Unknown response to data request\n"); - } - g_free(ref->alt); - g_free(ref); -} - -static void -jabber_message_send_data_request(JabberStream *js, PurpleConversation *conv, - const gchar *cid, const gchar *who, - const gchar *alt) -{ - JabberIq *request = jabber_iq_new(js, JABBER_IQ_GET); - JabberDataRef *ref = g_new0(JabberDataRef, 1); - xmlnode *data_request = jabber_data_get_xml_request(cid); - - xmlnode_set_attrib(request->node, "to", who); - ref->conv = conv; - ref->alt = g_strdup(alt); - jabber_iq_set_callback(request, jabber_message_get_data_cb, ref); - xmlnode_insert_child(request->node, data_request); - - jabber_iq_send(request); -} - - -void jabber_message_parse(JabberStream *js, xmlnode *packet) -{ - JabberMessage *jm; - const char *id, *from, *to, *type; - xmlnode *child; - gboolean signal_return; - - from = xmlnode_get_attrib(packet, "from"); - id = xmlnode_get_attrib(packet, "id"); - to = xmlnode_get_attrib(packet, "to"); - type = xmlnode_get_attrib(packet, "type"); - - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), - "jabber-receiving-message", js->gc, type, id, from, to, packet)); - if (signal_return) - return; - - jm = g_new0(JabberMessage, 1); - jm->js = js; - jm->sent = time(NULL); - jm->delayed = FALSE; - jm->chat_state = JM_STATE_NONE; - - if(type) { - if(!strcmp(type, "normal")) - jm->type = JABBER_MESSAGE_NORMAL; - else if(!strcmp(type, "chat")) - jm->type = JABBER_MESSAGE_CHAT; - else if(!strcmp(type, "groupchat")) - jm->type = JABBER_MESSAGE_GROUPCHAT; - else if(!strcmp(type, "headline")) - jm->type = JABBER_MESSAGE_HEADLINE; - else if(!strcmp(type, "error")) - jm->type = JABBER_MESSAGE_ERROR; - else - jm->type = JABBER_MESSAGE_OTHER; - } else { - jm->type = JABBER_MESSAGE_NORMAL; - } - - jm->from = g_strdup(from); - jm->to = g_strdup(to); - jm->id = g_strdup(id); - - for(child = packet->child; child; child = child->next) { - const char *xmlns = xmlnode_get_namespace(child); - if(child->type != XMLNODE_TYPE_TAG) - continue; - - if(!strcmp(child->name, "error")) { - const char *code = xmlnode_get_attrib(child, "code"); - char *code_txt = NULL; - char *text = xmlnode_get_data(child); - if (!text) { - xmlnode *enclosed_text_node; - - if ((enclosed_text_node = xmlnode_get_child(child, "text"))) - text = xmlnode_get_data(enclosed_text_node); - } - - if(code) - code_txt = g_strdup_printf(_("(Code %s)"), code); - - if(!jm->error) - jm->error = g_strdup_printf("%s%s%s", - text ? text : "", - text && code_txt ? " " : "", - code_txt ? code_txt : ""); - - g_free(code_txt); - g_free(text); - } else if (xmlns == NULL) { - /* QuLogic: Not certain this is correct, but it would have happened - with the previous code. */ - if(!strcmp(child->name, "x")) - jm->etc = g_list_append(jm->etc, child); - /* The following tests expect xmlns != NULL */ - continue; - } else if(!strcmp(child->name, "subject") && !strcmp(xmlns, NS_XMPP_CLIENT)) { - if(!jm->subject) { - jm->subject = xmlnode_get_data(child); - if(!jm->subject) - jm->subject = g_strdup(""); - } - } else if(!strcmp(child->name, "thread") && !strcmp(xmlns, NS_XMPP_CLIENT)) { - if(!jm->thread_id) - jm->thread_id = xmlnode_get_data(child); - } else if(!strcmp(child->name, "body") && !strcmp(xmlns, NS_XMPP_CLIENT)) { - if(!jm->body) { - char *msg = xmlnode_to_str(child, NULL); - jm->body = purple_strdup_withhtml(msg); - g_free(msg); - } - } else if(!strcmp(child->name, "html") && !strcmp(xmlns, NS_XHTML_IM)) { - if(!jm->xhtml && xmlnode_get_child(child, "body")) { - char *c; - - const PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = NULL; - GList *smiley_refs = NULL; - gchar *reformatted_xhtml; - - if (purple_account_get_bool(account, "custom_smileys", TRUE)) { - /* find a list of smileys ("cid" and "alt" text pairs) - occuring in the message */ - smiley_refs = jabber_message_get_refs_from_xmlnode(child); - purple_debug_info("jabber", "found %d smileys\n", - g_list_length(smiley_refs)); - - if (smiley_refs) { - if (jm->type == JABBER_MESSAGE_GROUPCHAT) { - JabberID *jid = jabber_id_new(jm->from); - JabberChat *chat = NULL; - - if (jid) { - chat = jabber_chat_find(js, jid->node, jid->domain); - if (chat) - conv = chat->conv; - jabber_id_free(jid); - } - } else if (jm->type == JABBER_MESSAGE_NORMAL || - jm->type == JABBER_MESSAGE_CHAT) { - conv = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - from, account); - if (!conv) { - /* we need to create the conversation here */ - conv = - purple_conversation_new(PURPLE_CONV_TYPE_IM, - account, from); - } - } - } - - /* process any newly provided smileys */ - jabber_message_add_remote_smileys(packet); - } - - /* reformat xhtml so that img tags with a "cid:" src gets - translated to the bare text of the emoticon (the "alt" attrib) */ - /* this is done also when custom smiley retrieval is turned off, - this way the receiver always sees the shortcut instead */ - reformatted_xhtml = - jabber_message_xml_to_string_strip_img_smileys(child); - - jm->xhtml = reformatted_xhtml; - - /* add known custom emoticons to the conversation */ - /* note: if there were no smileys in the incoming message, or - if receiving custom smileys is turned off, smiley_refs will - be NULL */ - for (; conv && smiley_refs ; smiley_refs = g_list_delete_link(smiley_refs, smiley_refs)) { - JabberSmileyRef *ref = (JabberSmileyRef *) smiley_refs->data; - const gchar *cid = ref->cid; - const gchar *alt = ref->alt; - - purple_debug_info("jabber", - "about to add custom smiley %s to the conv\n", alt); - if (purple_conv_custom_smiley_add(conv, alt, "cid", cid, - TRUE)) { - const JabberData *data = - jabber_data_find_remote_by_cid(cid); - /* if data is already known, we write it immediatly */ - if (data) { - purple_debug_info("jabber", - "data is already known\n"); - purple_conv_custom_smiley_write(conv, alt, - jabber_data_get_data(data), - jabber_data_get_size(data)); - purple_conv_custom_smiley_close(conv, alt); - } else { - /* we need to request the smiley (data) */ - purple_debug_info("jabber", - "data is unknown, need to request it\n"); - jabber_message_send_data_request(js, conv, cid, from, - alt); - } - } - g_free(ref->cid); - g_free(ref->alt); - g_free(ref); - } - - /* Convert all newlines to whitespace. Technically, even regular, non-XML HTML is supposed to ignore newlines, but Pidgin has, as convention - * treated \n as a newline for compatibility with other protocols - */ - for (c = jm->xhtml; *c != '\0'; c++) { - if (*c == '\n') - *c = ' '; - } - } - } else if(!strcmp(child->name, "active") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_ACTIVE; - } else if(!strcmp(child->name, "composing") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_COMPOSING; - } else if(!strcmp(child->name, "paused") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_PAUSED; - } else if(!strcmp(child->name, "inactive") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_INACTIVE; - } else if(!strcmp(child->name, "gone") && !strcmp(xmlns,"http://jabber.org/protocol/chatstates")) { - jm->chat_state = JM_STATE_GONE; - } else if(!strcmp(child->name, "event") && !strcmp(xmlns,"http://jabber.org/protocol/pubsub#event")) { - xmlnode *items; - jm->type = JABBER_MESSAGE_EVENT; - for(items = xmlnode_get_child(child,"items"); items; items = items->next) - jm->eventitems = g_list_append(jm->eventitems, items); - } else if(!strcmp(child->name, "attention") && !strcmp(xmlns, NS_ATTENTION)) { - jm->hasBuzz = TRUE; - } else if(!strcmp(child->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) { - const char *timestamp = xmlnode_get_attrib(child, "stamp"); - jm->delayed = TRUE; - if(timestamp) - jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); - } else if(!strcmp(child->name, "x")) { - if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) { - const char *timestamp = xmlnode_get_attrib(child, "stamp"); - jm->delayed = TRUE; - if(timestamp) - jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL); - } else if(!strcmp(xmlns, "jabber:x:conference") && - jm->type != JABBER_MESSAGE_GROUPCHAT_INVITE && - jm->type != JABBER_MESSAGE_ERROR) { - const char *jid = xmlnode_get_attrib(child, "jid"); - if(jid) { - const char *reason = xmlnode_get_attrib(child, "reason"); - const char *password = xmlnode_get_attrib(child, "password"); - - jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; - g_free(jm->to); - jm->to = g_strdup(jid); - - if (reason) { - g_free(jm->body); - jm->body = g_strdup(reason); - } - - if (password) { - g_free(jm->password); - jm->password = g_strdup(password); - } - } - } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user") && - jm->type != JABBER_MESSAGE_ERROR) { - xmlnode *invite = xmlnode_get_child(child, "invite"); - if(invite) { - xmlnode *reason, *password; - const char *jid = xmlnode_get_attrib(invite, "from"); - g_free(jm->to); - jm->to = jm->from; - jm->from = g_strdup(jid); - if((reason = xmlnode_get_child(invite, "reason"))) { - g_free(jm->body); - jm->body = xmlnode_get_data(reason); - } - if((password = xmlnode_get_child(child, "password"))) { - g_free(jm->password); - jm->password = xmlnode_get_data(password); - } - - jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; - } - } else { - jm->etc = g_list_append(jm->etc, child); - } - } else if (g_str_equal(child->name, "query")) { - const char *node = xmlnode_get_attrib(child, "node"); - if (purple_strequal(xmlns, NS_DISCO_ITEMS) - && purple_strequal(node, "http://jabber.org/protocol/commands")) { - jabber_adhoc_got_list(js, jm->from, child); - } - } - } - - if(jm->hasBuzz) - handle_buzz(jm); - - switch(jm->type) { - case JABBER_MESSAGE_OTHER: - purple_debug_info("jabber", - "Received message of unknown type: %s\n", type); - /* Fall-through is intentional */ - case JABBER_MESSAGE_NORMAL: - case JABBER_MESSAGE_CHAT: - handle_chat(jm); - break; - case JABBER_MESSAGE_HEADLINE: - handle_headline(jm); - break; - case JABBER_MESSAGE_GROUPCHAT: - handle_groupchat(jm); - break; - case JABBER_MESSAGE_GROUPCHAT_INVITE: - handle_groupchat_invite(jm); - break; - case JABBER_MESSAGE_EVENT: - jabber_handle_event(jm); - break; - case JABBER_MESSAGE_ERROR: - handle_error(jm); - break; - } - jabber_message_free(jm); -} - -static const gchar * -jabber_message_get_mimetype_from_ext(const gchar *ext) -{ - if (strcmp(ext, "png") == 0) { - return "image/png"; - } else if (strcmp(ext, "gif") == 0) { - return "image/gif"; - } else if (strcmp(ext, "jpg") == 0) { - return "image/jpeg"; - } else if (strcmp(ext, "tif") == 0) { - return "image/tif"; - } else { - return "image/x-icon"; /* or something... */ - } -} - -static GList * -jabber_message_xhtml_find_smileys(const char *xhtml) -{ - GList *smileys = purple_smileys_get_all(); - GList *found_smileys = NULL; - - for (; smileys ; smileys = g_list_delete_link(smileys, smileys)) { - PurpleSmiley *smiley = (PurpleSmiley *) smileys->data; - - const gchar *shortcut = purple_smiley_get_shortcut(smiley); - const gssize len = strlen(shortcut); - - gchar *escaped = g_markup_escape_text(shortcut, len); - const char *pos = strstr(xhtml, escaped); - - if (pos) { - found_smileys = g_list_append(found_smileys, smiley); - } - - g_free(escaped); - } - - return found_smileys; -} - -static gchar * -jabber_message_get_smileyfied_xhtml(const gchar *xhtml, const GList *smileys) -{ - /* create XML element for all smileys (img tags) */ - GString *result = g_string_new(NULL); - int pos = 0; - int length = strlen(xhtml); - - while (pos < length) { - const GList *iterator; - gboolean found_smiley = FALSE; - - for (iterator = smileys ; iterator ; - iterator = g_list_next(iterator)) { - const PurpleSmiley *smiley = (PurpleSmiley *) iterator->data; - const gchar *shortcut = purple_smiley_get_shortcut(smiley); - const gssize len = strlen(shortcut); - gchar *escaped = g_markup_escape_text(shortcut, len); - - if (g_str_has_prefix(&(xhtml[pos]), escaped)) { - /* we found the current smiley at this position */ - const JabberData *data = - jabber_data_find_local_by_alt(shortcut); - xmlnode *img = jabber_data_get_xhtml_im(data, shortcut); - int len; - gchar *img_text = xmlnode_to_str(img, &len); - - found_smiley = TRUE; - result = g_string_append(result, img_text); - g_free(img_text); - pos += strlen(escaped); - g_free(escaped); - xmlnode_free(img); - break; - } else { - /* cleanup from the before the next round... */ - g_free(escaped); - } - } - if (!found_smiley) { - /* there was no smiley here, just copy one byte */ - result = g_string_append_c(result, xhtml[pos]); - pos++; - } - } - - return g_string_free(result, FALSE); -} - -static gboolean -jabber_conv_support_custom_smileys(JabberStream *js, - PurpleConversation *conv, - const gchar *who) -{ - JabberBuddy *jb; - JabberChat *chat; - - switch (purple_conversation_get_type(conv)) { - case PURPLE_CONV_TYPE_IM: - jb = jabber_buddy_find(js, who, FALSE); - if (jb) { - return jabber_buddy_has_capability(jb, NS_BOB); - } else { - return FALSE; - } - break; - case PURPLE_CONV_TYPE_CHAT: - chat = jabber_chat_find_by_conv(conv); - if (chat) { - /* do not attempt to send custom smileys in a MUC with more than - 10 people, to avoid getting too many BoB requests */ - return jabber_chat_get_num_participants(chat) <= 10 && - jabber_chat_all_participants_have_capability(chat, - NS_BOB); - } else { - return FALSE; - } - break; - default: - return FALSE; - break; - } -} - -static char * -jabber_message_smileyfy_xhtml(JabberMessage *jm, const char *xhtml) -{ - PurpleAccount *account = purple_connection_get_account(jm->js->gc); - PurpleConversation *conv = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, jm->to, - account); - - if (jabber_conv_support_custom_smileys(jm->js, conv, jm->to)) { - GList *found_smileys = jabber_message_xhtml_find_smileys(xhtml); - - if (found_smileys) { - gchar *smileyfied_xhtml = NULL; - const GList *iterator; - GList *valid_smileys = NULL; - gboolean has_too_large_smiley = FALSE; - - for (iterator = found_smileys; iterator ; - iterator = g_list_next(iterator)) { - PurpleSmiley *smiley = (PurpleSmiley *) iterator->data; - const gchar *shortcut = purple_smiley_get_shortcut(smiley); - const JabberData *data = - jabber_data_find_local_by_alt(shortcut); - PurpleStoredImage *image = purple_smiley_get_stored_image(smiley); - - if (purple_imgstore_get_size(image) <= JABBER_DATA_MAX_SIZE) { - /* the object has not been sent before */ - if (!data) { - const gchar *ext = purple_imgstore_get_extension(image); - JabberStream *js = jm->js; - - JabberData *new_data = - jabber_data_create_from_data(purple_imgstore_get_data(image), - purple_imgstore_get_size(image), - jabber_message_get_mimetype_from_ext(ext), js); - purple_debug_info("jabber", - "cache local smiley alt = %s, cid = %s\n", - shortcut, jabber_data_get_cid(new_data)); - jabber_data_associate_local(new_data, shortcut); - } - valid_smileys = g_list_append(valid_smileys, smiley); - } else { - has_too_large_smiley = TRUE; - purple_debug_warning("jabber", "Refusing to send smiley %s " - "(too large, max is %d)\n", - purple_smiley_get_shortcut(smiley), - JABBER_DATA_MAX_SIZE); - } - } - - if (has_too_large_smiley) { - purple_conversation_write(conv, NULL, - _("A custom smiley in the message is too large to send."), - PURPLE_MESSAGE_ERROR, time(NULL)); - } - - smileyfied_xhtml = - jabber_message_get_smileyfied_xhtml(xhtml, valid_smileys); - g_list_free(found_smileys); - g_list_free(valid_smileys); - - return smileyfied_xhtml; - } - } - - return NULL; -} - -void jabber_message_send(JabberMessage *jm) -{ - xmlnode *message, *child; - const char *type = NULL; - - message = xmlnode_new("message"); - - switch(jm->type) { - case JABBER_MESSAGE_NORMAL: - type = "normal"; - break; - case JABBER_MESSAGE_CHAT: - case JABBER_MESSAGE_GROUPCHAT_INVITE: - type = "chat"; - break; - case JABBER_MESSAGE_HEADLINE: - type = "headline"; - break; - case JABBER_MESSAGE_GROUPCHAT: - type = "groupchat"; - break; - case JABBER_MESSAGE_ERROR: - type = "error"; - break; - case JABBER_MESSAGE_OTHER: - default: - type = NULL; - break; - } - - if(type) - xmlnode_set_attrib(message, "type", type); - - if (jm->id) - xmlnode_set_attrib(message, "id", jm->id); - - xmlnode_set_attrib(message, "to", jm->to); - - if(jm->thread_id) { - child = xmlnode_new_child(message, "thread"); - xmlnode_insert_data(child, jm->thread_id, -1); - } - - child = NULL; - switch(jm->chat_state) - { - case JM_STATE_ACTIVE: - child = xmlnode_new_child(message, "active"); - break; - case JM_STATE_COMPOSING: - child = xmlnode_new_child(message, "composing"); - break; - case JM_STATE_PAUSED: - child = xmlnode_new_child(message, "paused"); - break; - case JM_STATE_INACTIVE: - child = xmlnode_new_child(message, "inactive"); - break; - case JM_STATE_GONE: - child = xmlnode_new_child(message, "gone"); - break; - case JM_STATE_NONE: - /* yep, nothing */ - break; - } - if(child) - xmlnode_set_namespace(child, "http://jabber.org/protocol/chatstates"); - - if(jm->subject) { - child = xmlnode_new_child(message, "subject"); - xmlnode_insert_data(child, jm->subject, -1); - } - - if(jm->body) { - child = xmlnode_new_child(message, "body"); - xmlnode_insert_data(child, jm->body, -1); - } - - if(jm->xhtml) { - if ((child = xmlnode_from_str(jm->xhtml, -1))) { - xmlnode_insert_child(message, child); - } else { - purple_debug_error("jabber", - "XHTML translation/validation failed, returning: %s\n", - jm->xhtml); - } - } - - jabber_send(jm->js, message); - - xmlnode_free(message); -} - -/* - * Compare the XHTML and plain strings passed in for "equality". Any HTML markup - * other than <br/> (matches a newline) in the XHTML will cause this to return - * FALSE. - */ -static gboolean -jabber_xhtml_plain_equal(const char *xhtml_escaped, - const char *plain) -{ - int i = 0; - int j = 0; - gboolean ret; - char *xhtml = purple_unescape_html(xhtml_escaped); - - while (xhtml[i] && plain[j]) { - if (xhtml[i] == plain[j]) { - i += 1; - j += 1; - continue; - } - - if (plain[j] == '\n' && !strncmp(xhtml+i, "<br/>", 5)) { - i += 5; - j += 1; - continue; - } - - g_free(xhtml); - return FALSE; - } - - /* Are we at the end of both strings? */ - ret = (xhtml[i] == plain[j]) && (xhtml[i] == '\0'); - g_free(xhtml); - return ret; -} - -int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags) -{ - JabberMessage *jm; - JabberBuddy *jb; - JabberBuddyResource *jbr; - char *xhtml; - char *tmp; - char *resource; - - if(!who || !msg) - return 0; - - resource = jabber_get_resource(who); - - jb = jabber_buddy_find(gc->proto_data, who, TRUE); - jbr = jabber_buddy_find_resource(jb, resource); - - g_free(resource); - - jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; - jm->type = JABBER_MESSAGE_CHAT; - jm->chat_state = JM_STATE_ACTIVE; - jm->to = g_strdup(who); - jm->id = jabber_get_next_id(jm->js); - - if(jbr) { - if(jbr->thread_id) - jm->thread_id = jbr->thread_id; - - if (jbr->chat_states == JABBER_CHAT_STATES_UNSUPPORTED) - jm->chat_state = JM_STATE_NONE; - else { - /* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states) - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */ - } - } - - tmp = purple_utf8_strip_unprintables(msg); - purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body); - g_free(tmp); - - tmp = jabber_message_smileyfy_xhtml(jm, xhtml); - if (tmp) { - g_free(xhtml); - xhtml = tmp; - } - - /* - * For backward compatibility with user expectations or for those not on - * the user's roster, allow sending XHTML-IM markup. - */ - if (!jbr || !jbr->caps.info || - jabber_resource_has_capability(jbr, NS_XHTML_IM)) { - if (!jabber_xhtml_plain_equal(xhtml, jm->body)) - /* Wrap the message in <p/> for great interoperability justice. */ - jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'><p>%s</p></body></html>", xhtml); - } - - g_free(xhtml); - - jabber_message_send(jm); - jabber_message_free(jm); - return 1; -} - -int jabber_message_send_chat(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags) -{ - JabberChat *chat; - JabberMessage *jm; - JabberStream *js; - char *xhtml; - char *tmp; - - if(!msg || !gc) - return 0; - - js = gc->proto_data; - chat = jabber_chat_find_by_id(js, id); - - if(!chat) - return 0; - - jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; - jm->type = JABBER_MESSAGE_GROUPCHAT; - jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); - jm->id = jabber_get_next_id(jm->js); - - tmp = purple_utf8_strip_unprintables(msg); - purple_markup_html_to_xhtml(tmp, &xhtml, &jm->body); - g_free(tmp); - tmp = jabber_message_smileyfy_xhtml(jm, xhtml); - if (tmp) { - g_free(xhtml); - xhtml = tmp; - } - - if (chat->xhtml && !jabber_xhtml_plain_equal(xhtml, jm->body)) - /* Wrap the message in <p/> for greater interoperability justice. */ - jm->xhtml = g_strdup_printf("<html xmlns='" NS_XHTML_IM "'><body xmlns='" NS_XHTML "'><p>%s</p></body></html>", xhtml); - - g_free(xhtml); - - jabber_message_send(jm); - jabber_message_free(jm); - - return 1; -} - -unsigned int jabber_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - JabberMessage *jm; - JabberBuddy *jb; - JabberBuddyResource *jbr; - char *resource = jabber_get_resource(who); - - jb = jabber_buddy_find(gc->proto_data, who, TRUE); - jbr = jabber_buddy_find_resource(jb, resource); - - g_free(resource); - - if (!jbr || (jbr->chat_states == JABBER_CHAT_STATES_UNSUPPORTED)) - return 0; - - /* TODO: figure out threading */ - jm = g_new0(JabberMessage, 1); - jm->js = gc->proto_data; - jm->type = JABBER_MESSAGE_CHAT; - jm->to = g_strdup(who); - jm->id = jabber_get_next_id(jm->js); - - if(PURPLE_TYPING == state) - jm->chat_state = JM_STATE_COMPOSING; - else if(PURPLE_TYPED == state) - jm->chat_state = JM_STATE_PAUSED; - else - jm->chat_state = JM_STATE_ACTIVE; - - /* if(JABBER_CHAT_STATES_UNKNOWN == jbr->chat_states) - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; */ - - jabber_message_send(jm); - jabber_message_free(jm); - - return 0; -} - -gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace) { - return js->allowBuzz; -} - -gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *namespace) -{ - const PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - return purple_account_get_bool(account, "custom_smileys", TRUE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/message.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/** - * @file message.h Message handlers - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_MESSAGE_H_ -#define PURPLE_JABBER_MESSAGE_H_ - -#include "buddy.h" -#include "jabber.h" -#include "xmlnode.h" - -typedef struct _JabberMessage { - JabberStream *js; - enum { - JABBER_MESSAGE_NORMAL, - JABBER_MESSAGE_CHAT, - JABBER_MESSAGE_GROUPCHAT, - JABBER_MESSAGE_HEADLINE, - JABBER_MESSAGE_ERROR, - JABBER_MESSAGE_GROUPCHAT_INVITE, - JABBER_MESSAGE_EVENT, - JABBER_MESSAGE_OTHER - } type; - time_t sent; - gboolean delayed; - gboolean hasBuzz; - char *id; - char *from; - char *to; - char *subject; - char *body; - char *xhtml; - char *password; - char *error; - char *thread_id; - enum { - JM_STATE_NONE, - JM_STATE_ACTIVE, - JM_STATE_COMPOSING, - JM_STATE_PAUSED, - JM_STATE_INACTIVE, - JM_STATE_GONE - } chat_state; - GList *etc; - GList *eventitems; -} JabberMessage; - -void jabber_message_free(JabberMessage *jm); - -void jabber_message_send(JabberMessage *jm); - -void jabber_message_parse(JabberStream *js, xmlnode *packet); -int jabber_message_send_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags); -int jabber_message_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); - -unsigned int jabber_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state); - -gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace); - -gboolean jabber_custom_smileys_isenabled(JabberStream *js, const const gchar *namespace); - -#endif /* PURPLE_JABBER_MESSAGE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/namespaces.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/namespaces.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/namespaces.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/namespaces.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_NAMESPACES_H_ -#define PURPLE_JABBER_NAMESPACES_H_ - -#define NS_XMPP_BIND "urn:ietf:params:xml:ns:xmpp-bind" -#define NS_XMPP_CLIENT "jabber:client" -#define NS_XMPP_SASL "urn:ietf:params:xml:ns:xmpp-sasl" -#define NS_XMPP_SESSION "urn:ietf:params:xml:ns:xmpp-session" -#define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas" -#define NS_XMPP_STREAMS "http://etherx.jabber.org/streams" - -/* XEP-0012 Last Activity (and XEP-0256 Last Activity in Presence) */ -#define NS_LAST_ACTIVITY "jabber:iq:last" - -/* XEP-0030 Service Discovery */ -#define NS_DISCO_INFO "http://jabber.org/protocol/disco#info" -#define NS_DISCO_ITEMS "http://jabber.org/protocol/disco#items" - -/* XEP-0047 IBB (In-band bytestreams) */ -#define NS_IBB "http://jabber.org/protocol/ibb" - -/* XEP-0065 SOCKS5 Bytestreams */ -#define NS_BYTESTREAMS "http://jabber.org/protocol/bytestreams" - -/* XEP-0066 Out of Band Data (OOB) */ -#define NS_OOB_IQ_DATA "jabber:iq:oob" -#define NS_OOB_X_DATA "jabber:x:oob" - -/* XEP-0071 XHTML-IM (rich-text messages) */ -#define NS_XHTML_IM "http://jabber.org/protocol/xhtml-im" -#define NS_XHTML "http://www.w3.org/1999/xhtml" - -/* XEP-0084 v0.12 User Avatar */ -#define NS_AVATAR_0_12_DATA "http://www.xmpp.org/extensions/xep-0084.html#ns-data" -#define NS_AVATAR_0_12_METADATA "http://www.xmpp.org/extensions/xep-0084.html#ns-metadata" - -/* XEP-0084 v1.1 User Avatar */ -#define NS_AVATAR_1_1_DATA "urn:xmpp:avatar:data" -#define NS_AVATAR_1_1_METADATA "urn:xmpp:avatar:metadata" - -/* XEP-0124 Bidirectional-streams Over Synchronous HTTP (BOSH) */ -#define NS_BOSH "http://jabber.org/protocol/httpbind" - -/* XEP-0191 Simple Communications Blocking */ -#define NS_SIMPLE_BLOCKING "urn:xmpp:blocking" - -/* XEP-0199 Ping */ -#define NS_PING "urn:xmpp:ping" - -/* XEP-0202 Entity Time */ -#define NS_ENTITY_TIME "urn:xmpp:time" - -/* XEP-0203 Delayed Delivery (and legacy delayed delivery) */ -#define NS_DELAYED_DELIVERY "urn:xmpp:delay" -#define NS_DELAYED_DELIVERY_LEGACY "jabber:x:delay" - -/* XEP-0206 XMPP over BOSH */ -#define NS_XMPP_BOSH "urn:xmpp:xbosh" - -/* XEP-0224 Attention */ -#define NS_ATTENTION "urn:xmpp:attention:0" - -/* XEP-0231 BoB (Bits of Binary) */ -#define NS_BOB "urn:xmpp:bob" - -/* XEP-0237 Roster Versioning */ -#define NS_ROSTER_VERSIONING "urn:xmpp:features:rosterver" - -/* Google extensions */ -#define NS_GOOGLE_CAMERA "http://www.google.com/xmpp/protocol/camera/v1" -#define NS_GOOGLE_VIDEO "http://www.google.com/xmpp/protocol/video/v1" -#define NS_GOOGLE_VOICE "http://www.google.com/xmpp/protocol/voice/v1" -#define NS_GOOGLE_JINGLE_INFO "google:jingleinfo" - -#define NS_GOOGLE_MAIL_NOTIFY "google:mail:notify" -#define NS_GOOGLE_ROSTER "google:roster" - -#define NS_GOOGLE_PROTOCOL_SESSION "http://www.google.com/xmpp/protocol/session" -#define NS_GOOGLE_SESSION "http://www.google.com/session" -#define NS_GOOGLE_SESSION_PHONE "http://www.google.com/session/phone" -#define NS_GOOGLE_SESSION_VIDEO "http://www.google.com/session/video" - -#endif /* PURPLE_JABBER_NAMESPACES_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "ft.h" -#include "util.h" - -#include "jabber.h" -#include "iq.h" -#include "oob.h" - -typedef struct _JabberOOBXfer { - char *address; - int port; - char *page; - - GString *headers; - - char *iq_id; - - JabberStream *js; - - gchar *write_buffer; - gsize written_len; - guint writeh; - -} JabberOOBXfer; - -static void jabber_oob_xfer_init(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - purple_xfer_start(xfer, -1, jox->address, jox->port); -} - -static void jabber_oob_xfer_free(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - jox->js->oob_file_transfers = g_list_remove(jox->js->oob_file_transfers, - xfer); - - g_string_free(jox->headers, TRUE); - g_free(jox->address); - g_free(jox->page); - g_free(jox->iq_id); - g_free(jox->write_buffer); - if(jox->writeh) - purple_input_remove(jox->writeh); - g_free(jox); - - xfer->data = NULL; -} - -static void jabber_oob_xfer_end(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - JabberIq *iq; - - iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jox->iq_id); - - jabber_iq_send(iq); - - jabber_oob_xfer_free(xfer); -} - -static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInputCondition cond) { - PurpleXfer *xfer = data; - JabberOOBXfer *jox = xfer->data; - int len, total_len = strlen(jox->write_buffer); - - len = write(xfer->fd, jox->write_buffer + jox->written_len, - total_len - jox->written_len); - - if(len < 0 && errno == EAGAIN) - return; - else if(len < 0) { - purple_debug_error("jabber", "Write error on oob xfer!\n"); - purple_input_remove(jox->writeh); - purple_xfer_cancel_local(xfer); - } - jox->written_len += len; - - if(jox->written_len == total_len) { - purple_input_remove(jox->writeh); - g_free(jox->write_buffer); - jox->write_buffer = NULL; - } -} - -static void jabber_oob_xfer_start(PurpleXfer *xfer) -{ - JabberOOBXfer *jox = xfer->data; - - if(jox->write_buffer == NULL) { - jox->write_buffer = g_strdup_printf( - "GET /%s HTTP/1.1\r\nHost: %s\r\n\r\n", - jox->page, jox->address); - jox->written_len = 0; - } - - jox->writeh = purple_input_add(xfer->fd, PURPLE_INPUT_WRITE, - jabber_oob_xfer_request_send, xfer); - - jabber_oob_xfer_request_send(xfer, xfer->fd, PURPLE_INPUT_WRITE); -} - -static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) { - JabberOOBXfer *jox = xfer->data; - char test[2048]; - char *tmp, *lenstr; - int len; - - if((len = read(xfer->fd, test, sizeof(test))) > 0) { - jox->headers = g_string_append_len(jox->headers, test, len); - if((tmp = strstr(jox->headers->str, "\r\n\r\n"))) { - *tmp = '\0'; - lenstr = strstr(jox->headers->str, "Content-Length: "); - if(lenstr) { - int size; - sscanf(lenstr, "Content-Length: %d", &size); - purple_xfer_set_size(xfer, size); - } - purple_xfer_set_read_fnc(xfer, NULL); - - tmp += 4; - - *buffer = (unsigned char*) g_strdup(tmp); - return strlen(tmp); - } - return 0; - } else if (errno != EAGAIN) { - purple_debug_error("jabber", "Read error on oob xfer!\n"); - purple_xfer_cancel_local(xfer); - } - - return 0; -} - -static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) { - JabberOOBXfer *jox = xfer->data; - JabberIq *iq; - xmlnode *y, *z; - - iq = jabber_iq_new(jox->js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jox->iq_id); - y = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(y, "code", code); - if(!strcmp(code, "406")) { - z = xmlnode_new_child(y, "not-acceptable"); - xmlnode_set_attrib(y, "type", "modify"); - xmlnode_set_namespace(z, NS_XMPP_STANZAS); - } else if(!strcmp(code, "404")) { - z = xmlnode_new_child(y, "not-found"); - xmlnode_set_attrib(y, "type", "cancel"); - xmlnode_set_namespace(z, NS_XMPP_STANZAS); - } - jabber_iq_send(iq); - - jabber_oob_xfer_free(xfer); -} - -static void jabber_oob_xfer_recv_denied(PurpleXfer *xfer) { - jabber_oob_xfer_recv_error(xfer, "406"); -} - -static void jabber_oob_xfer_recv_canceled(PurpleXfer *xfer) { - jabber_oob_xfer_recv_error(xfer, "404"); -} - -void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *querynode) { - JabberOOBXfer *jox; - PurpleXfer *xfer; - char *filename; - char *url; - xmlnode *urlnode; - - if(type != JABBER_IQ_SET) - return; - - if(!from) - return; - - if(!(urlnode = xmlnode_get_child(querynode, "url"))) - return; - - url = xmlnode_get_data(urlnode); - - jox = g_new0(JabberOOBXfer, 1); - if (!purple_url_parse(url, &jox->address, &jox->port, &jox->page, NULL, NULL)) { - g_free(url); - return; - } - g_free(url); - jox->js = js; - jox->headers = g_string_new(""); - jox->iq_id = g_strdup(id); - - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); - if (xfer) - { - xfer->data = jox; - - if(!(filename = g_strdup(g_strrstr(jox->page, "/")))) - filename = g_strdup(jox->page); - - purple_xfer_set_filename(xfer, filename); - - g_free(filename); - - purple_xfer_set_init_fnc(xfer, jabber_oob_xfer_init); - purple_xfer_set_end_fnc(xfer, jabber_oob_xfer_end); - purple_xfer_set_request_denied_fnc(xfer, jabber_oob_xfer_recv_denied); - purple_xfer_set_cancel_recv_fnc(xfer, jabber_oob_xfer_recv_canceled); - purple_xfer_set_read_fnc(xfer, jabber_oob_xfer_read); - purple_xfer_set_start_fnc(xfer, jabber_oob_xfer_start); - - js->oob_file_transfers = g_list_append(js->oob_file_transfers, xfer); - - purple_xfer_request(xfer); - } -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/oob.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/** - * @file oob.h out-of-band transfer functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_OOB_H_ -#define PURPLE_JABBER_OOB_H_ - -#include "jabber.h" - -void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *querynode); - -#endif /* PURPLE_JABBER_OOB_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,295 +0,0 @@ -/* - * purple - Jabber XML parser stuff - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include <libxml/parser.h> - -#include "connection.h" -#include "debug.h" -#include "jabber.h" -#include "parser.h" -#include "util.h" -#include "xmlnode.h" - -static char *purple_unescape_text(const char *in) -{ - GString *ret; - const char *c = in; - - if (in == NULL) - return NULL; - - ret = g_string_new(""); - while (*c) { - int len; - const char *ent; - - if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { - g_string_append(ret, ent); - c += len; - } else { - g_string_append_c(ret, *c); - c++; - } - } - - return g_string_free(ret, FALSE); -} - -static void -jabber_parser_element_start_libxml(void *user_data, - const xmlChar *element_name, const xmlChar *prefix, const xmlChar *namespace, - int nb_namespaces, const xmlChar **namespaces, - int nb_attributes, int nb_defaulted, const xmlChar **attributes) -{ - JabberStream *js = user_data; - xmlnode *node; - int i, j; - - if(!element_name) { - return; - } else if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { - js->protocol_version = JABBER_PROTO_0_9; - for(i=0; i < nb_attributes * 5; i += 5) { - int attrib_len = attributes[i+4] - attributes[i+3]; - char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len); - - if(!xmlStrcmp(attributes[i], (xmlChar*) "version") - && !strcmp(attrib, "1.0")) { - js->protocol_version = JABBER_PROTO_1_0; - g_free(attrib); - } else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) { - g_free(js->stream_id); - js->stream_id = attrib; - } else { - g_free(attrib); - } - } - } else { - - if(js->current) - node = xmlnode_new_child(js->current, (const char*) element_name); - else - node = xmlnode_new((const char*) element_name); - xmlnode_set_namespace(node, (const char*) namespace); - xmlnode_set_prefix(node, (const char *)prefix); - - if (nb_namespaces != 0) { - node->namespace_map = g_hash_table_new_full( - g_str_hash, g_str_equal, g_free, g_free); - - for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { - const char *key = (const char *)namespaces[j]; - const char *val = (const char *)namespaces[j + 1]; - g_hash_table_insert(node->namespace_map, - g_strdup(key ? key : ""), g_strdup(val ? val : "")); - } - } - for(i=0; i < nb_attributes * 5; i+=5) { - const char *name = (const char *)attributes[i]; - const char *prefix = (const char *)attributes[i+1]; - const char *attrib_ns = (const char *)attributes[i+2]; - char *txt; - int attrib_len = attributes[i+4] - attributes[i+3]; - char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len); - - txt = attrib; - attrib = purple_unescape_text(txt); - g_free(txt); - xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); - g_free(attrib); - } - - js->current = node; - } -} - -static void -jabber_parser_element_end_libxml(void *user_data, const xmlChar *element_name, - const xmlChar *prefix, const xmlChar *namespace) -{ - JabberStream *js = user_data; - - if(!js->current) - return; - - if(js->current->parent) { - if(!xmlStrcmp((xmlChar*) js->current->name, element_name)) - js->current = js->current->parent; - } else { - xmlnode *packet = js->current; - js->current = NULL; - jabber_process_packet(js, &packet); - if (packet != NULL) - xmlnode_free(packet); - } -} - -static void -jabber_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) -{ - JabberStream *js = user_data; - - if(!js->current) - return; - - if(!text || !text_len) - return; - - xmlnode_insert_data(js->current, (const char*) text, text_len); -} - -static void -jabber_parser_structured_error_handler(void *user_data, xmlErrorPtr error) -{ - JabberStream *js = user_data; - - if (error->level == XML_ERR_WARNING && error->message != NULL - && g_str_equal(error->message, "xmlns: URI vcard-temp is not absolute\n")) - /* - * This message happens when parsing vcards, and is normal, so don't - * bother logging it because people scare easily. - */ - return; - - if (error->level == XML_ERR_FATAL && error->code == XML_ERR_DOCUMENT_END) - /* - * This is probably more annoying than the vcard-temp error; it occurs - * because we disconnect in most cases without waiting for the receiving - * </stream:stream> (limitations of libpurple) - */ - return; - - purple_debug_error("jabber", "XML parser error for JabberStream %p: " - "Domain %i, code %i, level %i: %s", - js, - error->domain, error->code, error->level, - (error->message ? error->message : "(null)\n")); -} - -static xmlSAXHandler jabber_parser_libxml = { - NULL, /*internalSubset*/ - NULL, /*isStandalone*/ - NULL, /*hasInternalSubset*/ - NULL, /*hasExternalSubset*/ - NULL, /*resolveEntity*/ - NULL, /*getEntity*/ - NULL, /*entityDecl*/ - NULL, /*notationDecl*/ - NULL, /*attributeDecl*/ - NULL, /*elementDecl*/ - NULL, /*unparsedEntityDecl*/ - NULL, /*setDocumentLocator*/ - NULL, /*startDocument*/ - NULL, /*endDocument*/ - NULL, /*startElement*/ - NULL, /*endElement*/ - NULL, /*reference*/ - jabber_parser_element_text_libxml, /*characters*/ - NULL, /*ignorableWhitespace*/ - NULL, /*processingInstruction*/ - NULL, /*comment*/ - NULL, /*warning*/ - NULL, /*error*/ - NULL, /*fatalError*/ - NULL, /*getParameterEntity*/ - NULL, /*cdataBlock*/ - NULL, /*externalSubset*/ - XML_SAX2_MAGIC, /*initialized*/ - NULL, /*_private*/ - jabber_parser_element_start_libxml, /*startElementNs*/ - jabber_parser_element_end_libxml, /*endElementNs*/ - jabber_parser_structured_error_handler /*serror*/ -}; - -void -jabber_parser_setup(JabberStream *js) -{ - /* This seems backwards, but it makes sense. The libxml code creates - * the parser context when you try to use it (this way, it can figure - * out the encoding at creation time. So, setting up the parser is - * just a matter of destroying any current parser. */ - jabber_parser_free(js); -} - -void jabber_parser_free(JabberStream *js) { - if (js->context) { - xmlParseChunk(js->context, NULL,0,1); - xmlFreeParserCtxt(js->context); - js->context = NULL; - } -} - -void jabber_parser_process(JabberStream *js, const char *buf, int len) -{ - int ret; - - if (js->context == NULL) { - /* libxml inconsistently starts parsing on creating the - * parser, so do a ParseChunk right afterwards to force it. */ - js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); - xmlParseChunk(js->context, "", 0, 0); - } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { - xmlError *err = xmlCtxtGetLastError(js->context); - /* - * libxml2 uses a global setting to determine whether or not to store - * warnings. Other libraries may set this, which causes err to be - * NULL. See #8136 for details. - */ - xmlErrorLevel level = XML_ERR_WARNING; - - if (err) - level = err->level; - - switch (level) { - case XML_ERR_NONE: - purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); - break; - case XML_ERR_WARNING: - purple_debug_warning("jabber", "xmlParseChunk returned warning %i\n", ret); - break; - case XML_ERR_ERROR: - purple_debug_error("jabber", "xmlParseChunk returned error %i\n", ret); - break; - case XML_ERR_FATAL: - purple_debug_error("jabber", "xmlParseChunk returned fatal %i\n", ret); - purple_connection_error_reason (js->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("XML Parse error")); - break; - } - } - - if (js->protocol_version == JABBER_PROTO_0_9 && !js->gc->disconnect_timeout && - (js->state == JABBER_STREAM_INITIALIZING || - js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)) { - /* - * Legacy servers don't advertise features, so if we've just gotten - * the opening <stream:stream> and there was no version, we need to - * immediately start legacy IQ auth. - */ - jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); - jabber_auth_start_old(js); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/parser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/** - * @file parser.h XML parser functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_PARSER_H_ -#define PURPLE_JABBER_PARSER_H_ - -#include "jabber.h" - -void jabber_parser_setup(JabberStream *js); -void jabber_parser_free(JabberStream *js); -void jabber_parser_process(JabberStream *js, const char *buf, int len); - -#endif /* PURPLE_JABBER_PARSER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "pep.h" -#include "iq.h" -#include <string.h> -#include "useravatar.h" -#include "usermood.h" -#include "usernick.h" -#include "usertune.h" - -static GHashTable *pep_handlers = NULL; - -void jabber_pep_init(void) { - if(!pep_handlers) { - pep_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - /* register PEP handlers */ - jabber_avatar_init(); - jabber_mood_init(); - jabber_tune_init(); - jabber_nick_init(); - } -} - -void jabber_pep_uninit(void) { - /* any PEP handlers that need to clean things up go here. The standard - * cleanup of removing the handler and feature are handled here and by - * jabber_features_destroy() in jabber.c - */ - g_hash_table_destroy(pep_handlers); - pep_handlers = NULL; -} - -void jabber_pep_init_actions(GList **m) { - /* register the PEP-specific actions */ - jabber_mood_init_action(m); - jabber_nick_init_action(m); -} - -void jabber_pep_register_handler(const char *xmlns, JabberPEPHandler handlerfunc) { - gchar *notifyns = g_strdup_printf("%s+notify", xmlns); - jabber_add_feature(notifyns, NULL); /* receiving PEPs is always supported */ - g_free(notifyns); - g_hash_table_replace(pep_handlers, g_strdup(xmlns), handlerfunc); -} - -static void -do_pep_iq_request_item_callback(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *pubsub; - xmlnode *items = NULL; - JabberPEPHandler *cb = data; - - if (type == JABBER_IQ_RESULT) { - pubsub = xmlnode_get_child_with_namespace(packet, "pubsub", "http://jabber.org/protocol/pubsub"); - if(pubsub) - items = xmlnode_get_child(pubsub, "items"); - } - - cb(js, from, items); -} - -void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode *pubsub, *items; - - xmlnode_set_attrib(iq->node,"to",to); - pubsub = xmlnode_new_child(iq->node,"pubsub"); - - xmlnode_set_namespace(pubsub,"http://jabber.org/protocol/pubsub"); - - items = xmlnode_new_child(pubsub, "items"); - xmlnode_set_attrib(items,"node",node); - - if (id) { - xmlnode *item = xmlnode_new_child(items, "item"); - xmlnode_set_attrib(item, "id", id); - } else - /* Most recent item */ - xmlnode_set_attrib(items, "max_items", "1"); - - jabber_iq_set_callback(iq,do_pep_iq_request_item_callback,(gpointer)cb); - - jabber_iq_send(iq); -} - -gboolean jabber_pep_namespace_only_when_pep_enabled_cb(JabberStream *js, const gchar *namespace) { - return js->pep; -} - -void jabber_handle_event(JabberMessage *jm) { - /* this may be called even when the own server doesn't support pep! */ - JabberPEPHandler *jph; - GList *itemslist; - char *jid; - - if (jm->type != JABBER_MESSAGE_EVENT) - return; - - jid = jabber_get_bare_jid(jm->from); - - for(itemslist = jm->eventitems; itemslist; itemslist = itemslist->next) { - xmlnode *items = (xmlnode*)itemslist->data; - const char *nodename = xmlnode_get_attrib(items,"node"); - - if(nodename && (jph = g_hash_table_lookup(pep_handlers, nodename))) - jph(jm->js, jid, items); - } - - /* discard items we don't have a handler for */ - g_free(jid); -} - -void jabber_pep_delete_node(JabberStream *js, const gchar *node) -{ - JabberIq *iq; - xmlnode *pubsub, *del; - - g_return_if_fail(node != NULL); - g_return_if_fail(js->pep); - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - pubsub = xmlnode_new_child(iq->node, "pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub#owner"); - - del = xmlnode_new_child(pubsub, "delete"); - xmlnode_set_attrib(del, "node", node); - - jabber_iq_send(iq); -} - -void jabber_pep_publish(JabberStream *js, xmlnode *publish) { - JabberIq *iq; - xmlnode *pubsub; - - if(js->pep != TRUE) { - /* ignore when there's no PEP support on the server */ - xmlnode_free(publish); - return; - } - - iq = jabber_iq_new(js, JABBER_IQ_SET); - - pubsub = xmlnode_new("pubsub"); - xmlnode_set_namespace(pubsub, "http://jabber.org/protocol/pubsub"); - - xmlnode_insert_child(pubsub, publish); - - xmlnode_insert_child(iq->node, pubsub); - - jabber_iq_send(iq); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/pep.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_PEP_H_ -#define PURPLE_JABBER_PEP_H_ - -#include "jabber.h" -#include "message.h" -#include "buddy.h" - -void jabber_pep_init(void); -void jabber_pep_uninit(void); - -void jabber_pep_init_actions(GList **m); - -/* - * Callback for receiving PEP events. - * - * @parameter js The JabberStream this item was received on - * @parameter items The <items/>-tag with the <item/>-children - */ -typedef void (JabberPEPHandler)(JabberStream *js, const char *from, xmlnode *items); - -/* - * Registers a callback for PEP events. Also automatically announces this receiving capability via disco#info. - * Don't forget to use jabber_add_feature when supporting the sending of PEP events of this type. - * - * @parameter xmlns The namespace for this event - * @parameter handlerfunc The callback to be used when receiving an event with this namespace - */ -void jabber_pep_register_handler(const char *xmlns, JabberPEPHandler handlerfunc); - -/* - * Request a specific item from another PEP node. - * - * @parameter js The JabberStream that should be used - * @parameter to The target PEP node - * @parameter node The node name of the item that is requested - * @parameter id The item id of the requested item (may be NULL) - * @parameter cb The callback to be used when this item is received - * - * The items element passed to the callback will be NULL if any error occurred (like a permission error, node doesn't exist etc.) - */ -void jabber_pep_request_item(JabberStream *js, const char *to, const char *node, const char *id, JabberPEPHandler cb); - -/* - * Default callback that can be used for namespaces which should only be enabled when PEP is supported - * - * @parameter js The JabberStream struct for this connection - * @parameter namespace The namespace that's queried, ignored. - * - * @returns TRUE when PEP is enabled, FALSE otherwise - */ -gboolean jabber_pep_namespace_only_when_pep_enabled_cb(JabberStream *js, const gchar *namespace); - -void jabber_handle_event(JabberMessage *jm); - -/** - * Delete the specified PEP node. - */ -void jabber_pep_delete_node(JabberStream *js, const gchar *node); - -/* - * Publishes PEP item(s) - * - * @parameter js The JabberStream associated with the connection this event should be published - * @parameter publish The publish node. This could be for example <publish node='http://jabber.org/protocol/tune'/> with an <item/> as subnode - */ -void jabber_pep_publish(JabberStream *js, xmlnode *publish); - -#endif /* PURPLE_JABBER_PEP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "debug.h" - -#include "jabber.h" -#include "ping.h" -#include "iq.h" - -static void jabber_keepalive_pong_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (js->keepalive_timeout != 0) { - purple_timeout_remove(js->keepalive_timeout); - js->keepalive_timeout = 0; - } -} - -void -jabber_ping_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *ping) -{ - if (type == JABBER_IQ_GET) { - JabberIq *iq = jabber_iq_new(js, JABBER_IQ_RESULT); - - if (from) - xmlnode_set_attrib(iq->node, "to", from); - xmlnode_set_attrib(iq->node, "id", id); - - jabber_iq_send(iq); - } else if (type == JABBER_IQ_SET) { - /* XXX: error */ - } -} - -static void jabber_ping_result_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - if (type == JABBER_IQ_RESULT) - purple_debug_info("jabber", "PONG!\n"); - else - purple_debug_info("jabber", "ping not supported\n"); -} - -void jabber_keepalive_ping(JabberStream *js) -{ - JabberIq *iq; - xmlnode *ping; - - iq = jabber_iq_new(js, JABBER_IQ_GET); - ping = xmlnode_new_child(iq->node, "ping"); - xmlnode_set_namespace(ping, NS_PING); - - jabber_iq_set_callback(iq, jabber_keepalive_pong_cb, NULL); - jabber_iq_send(iq); -} - -gboolean jabber_ping_jid(JabberStream *js, const char *jid) -{ - JabberIq *iq; - xmlnode *ping; - - iq = jabber_iq_new(js, JABBER_IQ_GET); - if (jid) - xmlnode_set_attrib(iq->node, "to", jid); - - ping = xmlnode_new_child(iq->node, "ping"); - xmlnode_set_namespace(ping, NS_PING); - - jabber_iq_set_callback(iq, jabber_ping_result_cb, NULL); - jabber_iq_send(iq); - - return TRUE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/ping.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/** - * @file ping.h ping functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_PING_H_ -#define PURPLE_JABBER_PING_H_ - -#include "jabber.h" -#include "iq.h" -#include "xmlnode.h" - -void jabber_ping_parse(JabberStream *js, const char *from, - JabberIqType, const char *id, xmlnode *child); -gboolean jabber_ping_jid(JabberStream *js, const char *jid); -void jabber_keepalive_ping(JabberStream *js); - -#endif /* PURPLE_JABBER_PING_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1128 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "account.h" -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "request.h" -#include "server.h" -#include "status.h" -#include "util.h" -#include "xmlnode.h" - -#include "buddy.h" -#include "chat.h" -#include "google.h" -#include "presence.h" -#include "iq.h" -#include "jutil.h" -#include "adhoccommands.h" - -#include "usertune.h" - - -static void chats_send_presence_foreach(gpointer key, gpointer val, - gpointer user_data) -{ - JabberChat *chat = val; - xmlnode *presence = user_data; - char *chat_full_jid; - - if(!chat->conv || chat->left) - return; - - chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, - chat->handle); - - xmlnode_set_attrib(presence, "to", chat_full_jid); - jabber_send(chat->js, presence); - g_free(chat_full_jid); -} - -void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status) -{ - PurpleAccount *account; - PurplePresence *presence; - JabberBuddy *jb; - JabberBuddyResource *jbr; - const char *username; - JabberBuddyState state; - char *msg; - int priority; - - g_return_if_fail(js->user != NULL); - - account = purple_connection_get_account(js->gc); - username = purple_connection_get_display_name(js->gc); - presence = purple_account_get_presence(account); - if (status == NULL) - status = purple_presence_get_active_status(presence); - purple_status_to_jabber(status, &state, &msg, &priority); - - jb = js->user_jb; - - if (state == JABBER_BUDDY_STATE_UNAVAILABLE || - state == JABBER_BUDDY_STATE_UNKNOWN) { - jabber_buddy_remove_resource(jb, js->user->resource); - } else { - jbr = jabber_buddy_track_resource(jb, js->user->resource, priority, - state, msg); - jbr->idle = purple_presence_is_idle(presence) ? - purple_presence_get_idle_time(presence) : 0; - } - - /* - * While we need to track the status of this resource, the core - * only cares if we're on our own buddy list. - */ - if (purple_find_buddy(account, username)) { - jbr = jabber_buddy_find_resource(jb, NULL); - if (jbr) { - purple_prpl_got_user_status(account, username, - jabber_buddy_state_get_status_id(jbr->state), - "priority", jbr->priority, - jbr->status ? "message" : NULL, jbr->status, - NULL); - purple_prpl_got_user_idle(account, username, jbr->idle, jbr->idle); - } else { - purple_prpl_got_user_status(account, username, "offline", - msg ? "message" : NULL, msg, - NULL); - } - } - g_free(msg); -} - -void jabber_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - JabberStream *js; - - if (!purple_account_is_connected(account)) - return; - - if (purple_status_is_exclusive(status) && !purple_status_is_active(status)) { - /* An exclusive status can't be deactivated. You should just - * activate some other exclusive status. */ - return; - } - - gc = purple_account_get_connection(account); - js = purple_connection_get_protocol_data(gc); - jabber_presence_send(js, FALSE); -} - -void jabber_presence_send(JabberStream *js, gboolean force) -{ - PurpleAccount *account; - xmlnode *presence, *x, *photo; - char *stripped = NULL; - JabberBuddyState state; - int priority; - const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; - int length = -1; - gboolean allowBuzz; - PurplePresence *p; - PurpleStatus *status, *tune; - - account = purple_connection_get_account(js->gc); - p = purple_account_get_presence(account); - status = purple_presence_get_active_status(p); - - /* we don't want to send presence before we've gotten our roster */ - if (js->state != JABBER_STREAM_CONNECTED) { - purple_debug_misc("jabber", "attempt to send presence before roster retrieved\n"); - return; - } - - purple_status_to_jabber(status, &state, &stripped, &priority); - - /* check for buzz support */ - allowBuzz = purple_status_get_attr_boolean(status,"buzz"); - /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */ - - tune = purple_presence_get_status(p, "tune"); - if (js->googletalk && !stripped && purple_status_is_active(tune)) { - stripped = jabber_google_presence_outgoing(tune); - } - -#define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \ - (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) - /* check if there are any differences to the <presence> and send them in that case */ - if (force || allowBuzz != js->allowBuzz || js->old_state != state || - CHANGED(js->old_msg, stripped) || js->old_priority != priority || - CHANGED(js->old_avatarhash, js->avatar_hash) || js->old_idle != js->idle) { - /* Need to update allowBuzz before creating the presence (with caps) */ - js->allowBuzz = allowBuzz; - - presence = jabber_presence_create_js(js, state, stripped, priority); - - /* Per XEP-0153 4.1, we must always send the <x> */ - x = xmlnode_new_child(presence, "x"); - xmlnode_set_namespace(x, "vcard-temp:x:update"); - /* - * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our - * image hash if another resource has logged in and updated the - * vcard avatar. Requires changes in jabber_presence_parse. - */ - if (js->vcard_fetched) { - /* Always publish a <photo>; it's empty if we have no image. */ - photo = xmlnode_new_child(x, "photo"); - if (js->avatar_hash) - xmlnode_insert_data(photo, js->avatar_hash, -1); - } - - jabber_send(js, presence); - - g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence); - xmlnode_free(presence); - - /* update old values */ - - if(js->old_msg) - g_free(js->old_msg); - if(js->old_avatarhash) - g_free(js->old_avatarhash); - js->old_msg = g_strdup(stripped); - js->old_avatarhash = g_strdup(js->avatar_hash); - js->old_state = state; - js->old_priority = priority; - js->old_idle = js->idle; - } - g_free(stripped); - - /* next, check if there are any changes to the tune values */ - if (purple_status_is_active(tune)) { - artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL); - track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK); - length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 : - purple_status_get_attr_int(tune, PURPLE_TUNE_TIME); - } - - if(CHANGED(artist, js->old_artist) || CHANGED(title, js->old_title) || CHANGED(source, js->old_source) || - CHANGED(uri, js->old_uri) || CHANGED(track, js->old_track) || (length != js->old_length)) { - PurpleJabberTuneInfo tuneinfo = { - (char*)artist, - (char*)title, - (char*)source, - (char*)track, - length, - (char*)uri - }; - jabber_tune_set(js->gc, &tuneinfo); - - /* update old values */ - g_free(js->old_artist); - g_free(js->old_title); - g_free(js->old_source); - g_free(js->old_uri); - g_free(js->old_track); - js->old_artist = g_strdup(artist); - js->old_title = g_strdup(title); - js->old_source = g_strdup(source); - js->old_uri = g_strdup(uri); - js->old_length = length; - js->old_track = g_strdup(track); - } - -#undef CHANGED - - jabber_presence_fake_to_self(js, status); -} - -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority) -{ - return jabber_presence_create_js(NULL, state, msg, priority); -} - -xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) -{ - xmlnode *show, *status, *presence, *pri, *c; - const char *show_string = NULL; -#ifdef USE_VV - gboolean audio_enabled, video_enabled; -#endif - - presence = xmlnode_new("presence"); - - if(state == JABBER_BUDDY_STATE_UNAVAILABLE) - xmlnode_set_attrib(presence, "type", "unavailable"); - else if(state != JABBER_BUDDY_STATE_ONLINE && - state != JABBER_BUDDY_STATE_UNKNOWN && - state != JABBER_BUDDY_STATE_ERROR) - show_string = jabber_buddy_state_get_show(state); - - if(show_string) { - show = xmlnode_new_child(presence, "show"); - xmlnode_insert_data(show, show_string, -1); - } - - if(msg) { - status = xmlnode_new_child(presence, "status"); - xmlnode_insert_data(status, msg, -1); - } - - if(priority) { - char *pstr = g_strdup_printf("%d", priority); - pri = xmlnode_new_child(presence, "priority"); - xmlnode_insert_data(pri, pstr, -1); - g_free(pstr); - } - - /* if we are idle and not offline, include idle */ - if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { - xmlnode *query = xmlnode_new_child(presence, "query"); - gchar seconds[10]; - g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); - - xmlnode_set_namespace(query, NS_LAST_ACTIVITY); - xmlnode_set_attrib(query, "seconds", seconds); - } - - /* JEP-0115 */ - /* calculate hash */ - jabber_caps_calculate_own_hash(js); - /* create xml */ - c = xmlnode_new_child(presence, "c"); - xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); - xmlnode_set_attrib(c, "node", CAPS0115_NODE); - xmlnode_set_attrib(c, "hash", "sha-1"); - xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js)); - -#ifdef USE_VV - /* - * MASSIVE HUGE DISGUSTING HACK - * This is a huge hack. As far as I can tell, Google Talk's gmail client - * doesn't bother to check the actual features we advertise; they - * just assume that if we specify a 'voice-v1' ext (ignoring that - * these are to be assigned no semantic value), we support receiving voice - * calls. - * - * Ditto for 'video-v1'. - */ - audio_enabled = jabber_audio_enabled(js, NULL /* unused */); - video_enabled = jabber_video_enabled(js, NULL /* unused */); - - if (audio_enabled && video_enabled) - xmlnode_set_attrib(c, "ext", "voice-v1 camera-v1 video-v1"); - else if (audio_enabled) - xmlnode_set_attrib(c, "ext", "voice-v1"); - else if (video_enabled) - xmlnode_set_attrib(c, "ext", "camera-v1 video-v1"); -#endif - - return presence; -} - -struct _jabber_add_permit { - PurpleConnection *gc; - JabberStream *js; - char *who; -}; - -static void authorize_add_cb(gpointer data) -{ - struct _jabber_add_permit *jap = data; - if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, - jap->who, "subscribed"); - g_free(jap->who); - g_free(jap); -} - -static void deny_add_cb(gpointer data) -{ - struct _jabber_add_permit *jap = data; - if(PURPLE_CONNECTION_IS_VALID(jap->gc)) - jabber_presence_subscription_set(jap->gc->proto_data, - jap->who, "unsubscribed"); - g_free(jap->who); - g_free(jap); -} - -static void -jabber_vcard_parse_avatar(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer blah) -{ - JabberBuddy *jb = NULL; - xmlnode *vcard, *photo, *binval, *fn, *nick; - char *text; - - if(!from) - return; - - jb = jabber_buddy_find(js, from, TRUE); - - js->pending_avatar_requests = g_slist_remove(js->pending_avatar_requests, jb); - - if((vcard = xmlnode_get_child(packet, "vCard")) || - (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { - /* The logic here regarding the nickname and full name is copied from - * buddy.c:jabber_vcard_parse. */ - gchar *nickname = NULL; - if ((fn = xmlnode_get_child(vcard, "FN"))) - nickname = xmlnode_get_data(fn); - - if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) { - char *tmp = xmlnode_get_data(nick); - char *bare_jid = jabber_get_bare_jid(from); - if (tmp && strstr(bare_jid, tmp) == NULL) { - g_free(nickname); - nickname = tmp; - } else if (tmp) - g_free(tmp); - - g_free(bare_jid); - } - - if (nickname) { - serv_got_alias(js->gc, from, nickname); - g_free(nickname); - } - - if ((photo = xmlnode_get_child(vcard, "PHOTO")) && - (binval = xmlnode_get_child(photo, "BINVAL")) && - (text = xmlnode_get_data(binval))) { - guchar *data; - gsize size; - - data = purple_base64_decode(text, &size); - if (data) { - gchar *hash = jabber_calculate_data_sha1sum(data, size); - purple_buddy_icons_set_for_user(js->gc->account, from, data, - size, hash); - g_free(hash); - } - - g_free(text); - } - } -} - -typedef struct _JabberPresenceCapabilities { - JabberStream *js; - JabberBuddy *jb; - char *from; -} JabberPresenceCapabilities; - -static void -jabber_presence_set_capabilities(JabberCapsClientInfo *info, GList *exts, - JabberPresenceCapabilities *userdata) -{ - JabberBuddyResource *jbr; - char *resource = strchr(userdata->from, '/'); - - if (resource) - resource += 1; - - jbr = jabber_buddy_find_resource(userdata->jb, resource); - if (!jbr) { - g_free(userdata->from); - g_free(userdata); - if (exts) { - g_list_foreach(exts, (GFunc)g_free, NULL); - g_list_free(exts); - } - return; - } - - /* Any old jbr->caps.info is owned by the caps code */ - if (jbr->caps.exts) { - g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); - g_list_free(jbr->caps.exts); - } - - jbr->caps.info = info; - jbr->caps.exts = exts; - - if (info == NULL) - goto out; - - if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) { - JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS); - xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS); - xmlnode_set_attrib(iq->node, "to", userdata->from); - xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); - jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); - jabber_iq_send(iq); - - jbr->commands_fetched = TRUE; - } - -#if 0 - /* - * Versions of libpurple before 2.6.0 didn't advertise this capability, so - * we can't yet use Entity Capabilities to determine whether or not the - * other client supports Chat States. - */ - if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/chatstates")) - jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; - else - jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; -#endif - -out: - g_free(userdata->from); - g_free(userdata); -} - -void jabber_presence_parse(JabberStream *js, xmlnode *packet) -{ - const char *from; - const char *type; - char *status = NULL; - int priority = 0; - JabberID *jid; - JabberChat *chat; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL, *found_jbr = NULL; - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - gboolean delayed = FALSE; - const gchar *stamp = NULL; /* from <delayed/> element */ - PurpleAccount *account; - PurpleBuddy *b = NULL; - char *buddy_name; - JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN; - xmlnode *y; - char *avatar_hash = NULL; - xmlnode *caps = NULL; - int idle = 0; - gchar *nickname = NULL; - gboolean signal_return; - - from = xmlnode_get_attrib(packet, "from"); - type = xmlnode_get_attrib(packet, "type"); - - jb = jabber_buddy_find(js, from, TRUE); - g_return_if_fail(jb != NULL); - - signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), - "jabber-receiving-presence", js->gc, type, from, packet)); - if (signal_return) - return; - - account = purple_connection_get_account(js->gc); - - jid = jabber_id_new(from); - if (jid == NULL) { - purple_debug_error("jabber", "Ignoring presence with malformed 'from' " - "JID: %s\n", from); - return; - } - - if(jb->error_msg) { - g_free(jb->error_msg); - jb->error_msg = NULL; - } - - if (type == NULL) { - xmlnode *show; - char *show_data = NULL; - - state = JABBER_BUDDY_STATE_ONLINE; - - show = xmlnode_get_child(packet, "show"); - if (show) { - show_data = xmlnode_get_data(show); - if (show_data) { - state = jabber_buddy_show_get_state(show_data); - g_free(show_data); - } else - purple_debug_warning("jabber", "<show/> present on presence, " - "but no contents!\n"); - } - } else if (g_str_equal(type, "error")) { - char *msg = jabber_parse_error(js, packet, NULL); - - state = JABBER_BUDDY_STATE_ERROR; - jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence")); - } else if (g_str_equal(type, "subscribe")) { - struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1); - gboolean onlist = FALSE; - PurpleBuddy *buddy; - JabberBuddy *jb = NULL; - xmlnode *nick; - - buddy = purple_find_buddy(account, from); - nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick"); - if (nick) - nickname = xmlnode_get_data(nick); - - if (buddy) { - jb = jabber_buddy_find(js, from, TRUE); - if ((jb->subscription & (JABBER_SUB_TO | JABBER_SUB_PENDING))) - onlist = TRUE; - } - - jap->gc = js->gc; - jap->who = g_strdup(from); - jap->js = js; - - purple_account_request_authorization(account, from, NULL, nickname, - NULL, onlist, authorize_add_cb, deny_add_cb, jap); - - g_free(nickname); - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "subscribed")) { - /* we've been allowed to see their presence, but we don't care */ - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "unsubscribe")) { - /* XXX I'm not sure this is the right way to handle this, it - * might be better to add "unsubscribe" to the presence status - * if lower down, but I'm not sure. */ - /* they are unsubscribing from our presence, we don't care */ - /* Well, maybe just a little, we might want/need to start - * acknowledging this (and the others) at some point. */ - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "probe")) { - purple_debug_warning("jabber", "Ignoring presence probe\n"); - jabber_id_free(jid); - return; - } else if (g_str_equal(type, "unavailable")) { - state = JABBER_BUDDY_STATE_UNAVAILABLE; - } else if (g_str_equal(type, "unsubscribed")) { - state = JABBER_BUDDY_STATE_UNKNOWN; - } else { - purple_debug_warning("jabber", "Ignoring presence with invalid type " - "'%s'\n", type); - jabber_id_free(jid); - return; - } - - - for(y = packet->child; y; y = y->next) { - const char *xmlns; - if(y->type != XMLNODE_TYPE_TAG) - continue; - xmlns = xmlnode_get_namespace(y); - - if(!strcmp(y->name, "status")) { - g_free(status); - status = xmlnode_get_data(y); - } else if(!strcmp(y->name, "priority")) { - char *p = xmlnode_get_data(y); - if(p) { - priority = atoi(p); - g_free(p); - } - } else if(xmlns == NULL) { - /* The rest of the cases used to check xmlns individually. */ - continue; - } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) { - /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ - delayed = TRUE; - stamp = xmlnode_get_attrib(y, "stamp"); - } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { - caps = y; /* store for later, when creating buddy resource */ - } else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) { - nickname = xmlnode_get_data(y); - } else if(!strcmp(y->name, "x")) { - if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) { - /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ - delayed = TRUE; - stamp = xmlnode_get_attrib(y, "stamp"); - } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { - } else if(!strcmp(xmlns, "vcard-temp:x:update")) { - xmlnode *photo = xmlnode_get_child(y, "photo"); - if(photo) { - g_free(avatar_hash); - avatar_hash = xmlnode_get_data(photo); - } - } - } else if (!strcmp(y->name, "query") && - !strcmp(xmlnode_get_namespace(y), NS_LAST_ACTIVITY)) { - /* resource has specified idle */ - const gchar *seconds = xmlnode_get_attrib(y, "seconds"); - if (seconds) { - /* we may need to take "delayed" into account here */ - idle = atoi(seconds); - } - } - } - - if (idle && delayed && stamp) { - /* if we have a delayed presence, we need to add the delay to the idle - value */ - time_t offset = time(NULL) - purple_str_to_time(stamp, TRUE, NULL, NULL, - NULL); - purple_debug_info("jabber", "got delay %s yielding %ld s offset\n", - stamp, offset); - idle += offset; - } - - /* DEALING WITH CHATS */ - if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) { - static int i = 1; - - if(state == JABBER_BUDDY_STATE_ERROR) { - char *title, *msg = jabber_parse_error(js, packet, NULL); - - if (!chat->conv) { - title = g_strdup_printf(_("Error joining chat %s"), from); - purple_serv_got_join_chat_failed(js->gc, chat->components); - } else { - title = g_strdup_printf(_("Error in chat %s"), from); - if (g_hash_table_size(chat->members) == 0) - serv_got_chat_left(js->gc, chat->id); - } - purple_notify_error(js->gc, title, title, msg); - g_free(title); - g_free(msg); - - if (g_hash_table_size(chat->members) == 0) - /* Only destroy the chat if the error happened while joining */ - jabber_chat_destroy(chat); - jabber_id_free(jid); - g_free(status); - g_free(avatar_hash); - g_free(nickname); - return; - } - - if (type == NULL) { - xmlnode *x; - const char *real_jid = NULL; - const char *affiliation = NULL; - const char *role = NULL; - gboolean is_our_resource = FALSE; /* Is the presence about us? */ - - /* - * XEP-0045 mandates the presence to include a resource (which is - * treated as the chat nick). Some non-compliant servers allow - * joining without a nick. - */ - if (!jid->resource) { - jabber_id_free(jid); - g_free(avatar_hash); - g_free(nickname); - g_free(status); - return; - } - - x = xmlnode_get_child_with_namespace(packet, "x", - "http://jabber.org/protocol/muc#user"); - if (x) { - xmlnode *status_node; - xmlnode *item_node; - - for (status_node = xmlnode_get_child(x, "status"); status_node; - status_node = xmlnode_get_next_twin(status_node)) { - const char *code = xmlnode_get_attrib(status_node, "code"); - if (!code) - continue; - - if (g_str_equal(code, "110")) { - is_our_resource = TRUE; - } else if (g_str_equal(code, "201")) { - if ((chat = jabber_chat_find(js, jid->node, jid->domain))) { - chat->config_dialog_type = PURPLE_REQUEST_ACTION; - chat->config_dialog_handle = - purple_request_action(js->gc, - _("Create New Room"), - _("Create New Room"), - _("You are creating a new room. Would" - " you like to configure it, or" - " accept the default settings?"), - /* Default Action */ 1, - account, NULL, chat->conv, - chat, 2, - _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure), - _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room)); - } - } else if (g_str_equal(code, "210")) { - /* server rewrote room-nick */ - if((chat = jabber_chat_find(js, jid->node, jid->domain))) { - g_free(chat->handle); - chat->handle = g_strdup(jid->resource); - } - } - } - - item_node = xmlnode_get_child(x, "item"); - if (item_node) { - real_jid = xmlnode_get_attrib(item_node, "jid"); - affiliation = xmlnode_get_attrib(item_node, "affiliation"); - role = xmlnode_get_attrib(item_node, "role"); - - if (purple_strequal(affiliation, "owner")) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (role) { - if (g_str_equal(role, "moderator")) - flags |= PURPLE_CBFLAGS_OP; - else if (g_str_equal(role, "participant")) - flags |= PURPLE_CBFLAGS_VOICE; - } - } - } - - if(!chat->conv) { - char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain); - chat->id = i++; - chat->muc = (x != NULL); - chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle); - - jabber_chat_disco_traffic(chat); - g_free(room_jid); - } - - jbr = jabber_buddy_track_resource(jb, jid->resource, priority, state, - status); - jbr->commands_fetched = TRUE; - - jabber_chat_track_handle(chat, jid->resource, real_jid, affiliation, role); - - if(!jabber_chat_find_buddy(chat->conv, jid->resource)) - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, - real_jid, flags, !delayed); - else - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), jid->resource, - flags); - } else if (g_str_equal(type, "unavailable")) { - xmlnode *x; - gboolean nick_change = FALSE; - gboolean kick = FALSE; - gboolean is_our_resource = FALSE; /* Is the presence about us? */ - - /* If the chat nick is invalid, we haven't yet joined, or we've - * already left (it was probably us leaving after we closed the - * chat), we don't care. - */ - if (!jid->resource || !chat->conv || chat->left) { - if (chat->left && - jid->resource && chat->handle && !strcmp(jid->resource, chat->handle)) - jabber_chat_destroy(chat); - jabber_id_free(jid); - g_free(status); - g_free(avatar_hash); - g_free(nickname); - return; - } - - is_our_resource = (0 == g_utf8_collate(jid->resource, chat->handle)); - - jabber_buddy_remove_resource(jb, jid->resource); - - x = xmlnode_get_child_with_namespace(packet, "x", - "http://jabber.org/protocol/muc#user"); - if (chat->muc && x) { - const char *nick; - const char *item_jid = NULL; - const char *to; - xmlnode *stat; - xmlnode *item; - - item = xmlnode_get_child(x, "item"); - if (item) - item_jid = xmlnode_get_attrib(item, "jid"); - - for (stat = xmlnode_get_child(x, "status"); stat; - stat = xmlnode_get_next_twin(stat)) { - const char *code = xmlnode_get_attrib(stat, "code"); - - if (!code) - continue; - - if (g_str_equal(code, "110")) { - is_our_resource = TRUE; - } else if(!strcmp(code, "301")) { - /* XXX: we got banned */ - } else if(!strcmp(code, "303") && item && - (nick = xmlnode_get_attrib(item, "nick"))) { - nick_change = TRUE; - if(!strcmp(jid->resource, chat->handle)) { - g_free(chat->handle); - chat->handle = g_strdup(nick); - } - - /* TODO: This should probably be moved out of the loop */ - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, nick); - jabber_chat_remove_handle(chat, jid->resource); - continue; - } else if(!strcmp(code, "307")) { - /* Someone was kicked from the room */ - xmlnode *reason = NULL, *actor = NULL; - const char *actor_name = NULL; - char *reason_text = NULL; - char *tmp; - - kick = TRUE; - - if (item) { - reason = xmlnode_get_child(item, "reason"); - actor = xmlnode_get_child(item, "actor"); - - if (reason != NULL) - reason_text = xmlnode_get_data(reason); - if (actor != NULL) - actor_name = xmlnode_get_attrib(actor, "jid"); - } - - if (reason_text == NULL) - reason_text = g_strdup(_("No reason")); - - if (is_our_resource) { - if (actor_name != NULL) - tmp = g_strdup_printf(_("You have been kicked by %s: (%s)"), - actor_name, reason_text); - else - tmp = g_strdup_printf(_("You have been kicked: (%s)"), - reason_text); - } else { - if (actor_name != NULL) - tmp = g_strdup_printf(_("Kicked by %s (%s)"), - actor_name, reason_text); - else - tmp = g_strdup_printf(_("Kicked (%s)"), - reason_text); - } - - g_free(reason_text); - g_free(status); - status = tmp; - } else if(!strcmp(code, "321")) { - /* XXX: removed due to an affiliation change */ - } else if(!strcmp(code, "322")) { - /* XXX: removed because room is now members-only */ - } else if(!strcmp(code, "332")) { - /* XXX: removed due to system shutdown */ - } - } - - /* - * Possibly another connected resource of our JID (see XEP-0045 - * v1.24 section 7.1.10) being disconnected. Should be - * distinguished by the item_jid. - * Also possibly works around bits of an Openfire bug. See - * #8319. - */ - to = xmlnode_get_attrib(packet, "to"); - if (is_our_resource && item_jid && !purple_strequal(to, item_jid)) { - /* TODO: When the above is a loop, this needs to still act - * sanely for all cases (this code is a little fragile). */ - if (!kick && !nick_change) - /* Presumably, kicks and nick changes also affect us. */ - is_our_resource = FALSE; - } - } - if(!nick_change) { - if (is_our_resource) { - if (kick) - purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), jid->resource, - status, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - serv_got_chat_left(js->gc, chat->id); - jabber_chat_destroy(chat); - } else { - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, - status); - jabber_chat_remove_handle(chat, jid->resource); - } - } - } else { - /* A type that isn't available or unavailable */ - purple_debug_error("jabber", "MUC presence with bad type: %s\n", - type); - - jabber_id_free(jid); - g_free(avatar_hash); - g_free(status); - g_free(nickname); - g_return_if_reached(); - } - /* End of DEALING WITH CHATS...about 5000 lines ago */ - } else { - /* DEALING WITH CONTACT (i.e. not a chat) */ - PurpleConversation *conv; - - buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "", - jid->node ? "@" : "", jid->domain); - - /* - * Unbind/unlock from sending messages to a specific resource on - * presence changes. This is locked to a specific resource when - * receiving a message (in message.c). - */ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - buddy_name, account); - if (conv) { - purple_debug_info("jabber", "Changed conversation binding from %s to %s\n", - purple_conversation_get_name(conv), buddy_name); - purple_conversation_set_name(conv, buddy_name); - } - - if((b = purple_find_buddy(account, buddy_name)) == NULL) { - if (jb != js->user_jb) { - purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n", - buddy_name, purple_account_get_username(account), account); - jabber_id_free(jid); - g_free(avatar_hash); - g_free(buddy_name); - g_free(nickname); - g_free(status); - return; - } else { - /* this is a different resource of our own account. Resume even when this account isn't on our blist */ - } - } - - if(b && avatar_hash) { - const char *avatar_hash2 = purple_buddy_icons_get_checksum_for_user(b); - if(!avatar_hash2 || strcmp(avatar_hash, avatar_hash2)) { - JabberIq *iq; - xmlnode *vcard; - - /* XXX this is a crappy way of trying to prevent - * someone from spamming us with presence packets - * and causing us to DoS ourselves...what we really - * need is a queue system that can throttle itself, - * but i'm too tired to write that right now */ - if(!g_slist_find(js->pending_avatar_requests, jb)) { - - js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb); - - iq = jabber_iq_new(js, JABBER_IQ_GET); - xmlnode_set_attrib(iq->node, "to", buddy_name); - vcard = xmlnode_new_child(iq->node, "vCard"); - xmlnode_set_namespace(vcard, "vcard-temp"); - - jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL); - jabber_iq_send(iq); - } - } - } - - if(state == JABBER_BUDDY_STATE_ERROR || - (type && (g_str_equal(type, "unavailable") || - g_str_equal(type, "unsubscribed")))) { - jabber_buddy_remove_resource(jb, jid->resource); - } else { - jbr = jabber_buddy_track_resource(jb, jid->resource, priority, - state, status); - if (idle) { - jbr->idle = time(NULL) - idle; - } else { - jbr->idle = 0; - } - } - - if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { - jabber_google_presence_incoming(js, buddy_name, found_jbr); - purple_prpl_got_user_status(account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL); - purple_prpl_got_user_idle(account, buddy_name, found_jbr->idle, found_jbr->idle); - if (nickname) - serv_got_alias(js->gc, buddy_name, nickname); - } else { - purple_prpl_got_user_status(account, buddy_name, "offline", status ? "message" : NULL, status, NULL); - } - g_free(buddy_name); - } - - if (caps && !type) { - /* handle Entity Capabilities (XEP-0115) */ - const char *node = xmlnode_get_attrib(caps, "node"); - const char *ver = xmlnode_get_attrib(caps, "ver"); - const char *hash = xmlnode_get_attrib(caps, "hash"); - const char *ext = xmlnode_get_attrib(caps, "ext"); - - /* v1.3 uses: node, ver, and optionally ext. - * v1.5 uses: node, ver, and hash. */ - if (node && *node && ver && *ver) { - gchar **exts = ext && *ext ? g_strsplit(ext, " ", -1) : NULL; - jbr = jabber_buddy_find_resource(jb, jid->resource); - - /* Look it up if we don't already have all this information */ - if (!jbr || !jbr->caps.info || - !g_str_equal(node, jbr->caps.info->tuple.node) || - !g_str_equal(ver, jbr->caps.info->tuple.ver) || - !purple_strequal(hash, jbr->caps.info->tuple.hash) || - !jabber_caps_exts_known(jbr->caps.info, (gchar **)exts)) { - JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1); - userdata->js = js; - userdata->jb = jb; - userdata->from = g_strdup(from); - jabber_caps_get_info(js, from, node, ver, hash, exts, - (jabber_caps_get_info_cb)jabber_presence_set_capabilities, - userdata); - } else { - if (exts) - g_strfreev(exts); - } - } - } - - g_free(nickname); - g_free(status); - jabber_id_free(jid); - g_free(avatar_hash); -} - -void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type) -{ - xmlnode *presence = xmlnode_new("presence"); - - xmlnode_set_attrib(presence, "to", who); - xmlnode_set_attrib(presence, "type", type); - - jabber_send(js, presence); - xmlnode_free(presence); -} - -void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority) -{ - const char *status_id = NULL; - const char *formatted_msg = NULL; - - if(state) *state = JABBER_BUDDY_STATE_UNKNOWN; - if(msg) *msg = NULL; - if(priority) *priority = 0; - - if(!status) { - if(state) *state = JABBER_BUDDY_STATE_UNAVAILABLE; - } else { - if(state) { - status_id = purple_status_get_id(status); - *state = jabber_buddy_status_id_get_state(status_id); - } - - if(msg) { - formatted_msg = purple_status_get_attr_string(status, "message"); - - /* if the message is blank, then there really isn't a message */ - if(formatted_msg && *formatted_msg) - *msg = purple_markup_strip_html(formatted_msg); - } - - if(priority) - *priority = purple_status_get_attr_int(status, "priority"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/presence.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file presence.h Presence - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_PRESENCE_H_ -#define PURPLE_JABBER_PRESENCE_H_ - -#include "buddy.h" -#include "jabber.h" -#include "xmlnode.h" - -void jabber_set_status(PurpleAccount *account, PurpleStatus *status); - -/** - * Send a full presence stanza. - * - * @param js A JabberStream object. - * @param force Force sending the presence stanza, irrespective of whether - * the contents seem to have changed. - */ -void jabber_presence_send(JabberStream *js, gboolean force); - -xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority); /* DEPRECATED */ -xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); -void jabber_presence_parse(JabberStream *js, xmlnode *packet); -void jabber_presence_subscription_set(JabberStream *js, const char *who, - const char *type); -void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status); -void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority); - -#endif /* PURPLE_JABBER_PRESENCE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,518 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "debug.h" -#include "server.h" -#include "util.h" - -#include "buddy.h" -#include "chat.h" -#include "google.h" -#include "presence.h" -#include "roster.h" -#include "iq.h" - -#include <string.h> - -/* Take a list of strings and join them with a ", " separator */ -static gchar *roster_groups_join(GSList *list) -{ - GString *out = g_string_new(NULL); - for ( ; list; list = list->next) { - out = g_string_append(out, (const char *)list->data); - if (list->next) - out = g_string_append(out, ", "); - } - - return g_string_free(out, FALSE); -} - -static void roster_request_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - xmlnode *query; - - if (type == JABBER_IQ_ERROR) { - /* - * This shouldn't happen in any real circumstances and - * likely constitutes a server-side misconfiguration (i.e. - * explicitly not loading mod_roster...) - */ - purple_debug_error("jabber", "Error retrieving roster!?\n"); - jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); - return; - } - - query = xmlnode_get_child(packet, "query"); - if (query == NULL) { - jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); - return; - } - - jabber_roster_parse(js, from, type, id, query); - jabber_stream_set_state(js, JABBER_STREAM_CONNECTED); -} - -void jabber_roster_request(JabberStream *js) -{ - PurpleAccount *account; - JabberIq *iq; - xmlnode *query; - - account = purple_connection_get_account(js->gc); - - iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster"); - query = xmlnode_get_child(iq->node, "query"); - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) { - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); - } - - jabber_iq_set_callback(iq, roster_request_cb, NULL); - jabber_iq_send(iq); -} - -static void remove_purple_buddies(JabberStream *js, const char *jid) -{ - GSList *buddies, *l; - - buddies = purple_find_buddies(js->gc->account, jid); - - for(l = buddies; l; l = l->next) - purple_blist_remove_buddy(l->data); - - g_slist_free(buddies); -} - -static void add_purple_buddy_to_groups(JabberStream *js, const char *jid, - const char *alias, GSList *groups) -{ - GSList *buddies, *l; - PurpleAccount *account = purple_connection_get_account(js->gc); - - buddies = purple_find_buddies(js->gc->account, jid); - - if(!groups) { - if(!buddies) - groups = g_slist_append(groups, g_strdup(_("Buddies"))); - else { - /* TODO: What should we do here? Removing the local buddies - * is wrong, but so is letting the group state get out of sync with - * the server. - */ - g_slist_free(buddies); - return; - } - } - - while(buddies) { - PurpleBuddy *b = buddies->data; - PurpleGroup *g = purple_buddy_get_group(b); - - buddies = g_slist_delete_link(buddies, buddies); - - /* XMPP groups are case-sensitive, but libpurple groups are - * case-insensitive. We treat a buddy in both "Friends" and "friends" - * as only being in one group, but if we push changes about the buddy - * to the server, the buddy will be dropped from one of the groups. - * Not optimal, but better than the alternative, I think. - */ - if((l = g_slist_find_custom(groups, purple_group_get_name(g), (GCompareFunc)purple_utf8_strcasecmp))) { - /* The buddy is already on the local list. Update info. */ - const char *servernick, *balias; - - /* Previously stored serverside / buddy-supplied alias */ - if((servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"))) - serv_got_alias(js->gc, jid, servernick); - - /* Alias from our roster retrieval */ - balias = purple_buddy_get_local_buddy_alias(b); - if(alias && !purple_strequal(alias, balias)) - purple_serv_got_private_alias(js->gc, jid, alias); - g_free(l->data); - groups = g_slist_delete_link(groups, l); - } else { - /* This buddy isn't in the group on the server anymore */ - purple_debug_info("jabber", "jabber_roster_parse(): Removing %s " - "from group '%s' on the local list\n", - purple_buddy_get_name(b), - purple_group_get_name(g)); - purple_blist_remove_buddy(b); - } - } - - if (groups) { - char *tmp = roster_groups_join(groups); - purple_debug_info("jabber", "jabber_roster_parse(): Adding %s to " - "groups: %s\n", jid, tmp); - g_free(tmp); - } - - while(groups) { - PurpleGroup *g = purple_find_group(groups->data); - PurpleBuddy *b = purple_buddy_new(account, jid, alias); - - if(!g) { - g = purple_group_new(groups->data); - purple_blist_add_group(g, NULL); - } - - purple_blist_add_buddy(b, NULL, g, NULL); - purple_blist_alias_buddy(b, alias); - - g_free(groups->data); - groups = g_slist_delete_link(groups, groups); - } - - g_slist_free(buddies); -} - -void jabber_roster_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query) -{ - xmlnode *item, *group; -#if 0 - const char *ver; -#endif - - if (!jabber_is_own_account(js, from)) { - purple_debug_warning("jabber", "Received bogon roster push from %s\n", - from); - return; - } - - js->currently_parsing_roster_push = TRUE; - - for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) - { - const char *jid, *name, *subscription, *ask; - JabberBuddy *jb; - - subscription = xmlnode_get_attrib(item, "subscription"); - jid = xmlnode_get_attrib(item, "jid"); - name = xmlnode_get_attrib(item, "name"); - ask = xmlnode_get_attrib(item, "ask"); - - if(!jid) - continue; - - if(!(jb = jabber_buddy_find(js, jid, TRUE))) - continue; - - if(subscription) { - if (g_str_equal(subscription, "remove")) - jb->subscription = JABBER_SUB_REMOVE; - else if (jb == js->user_jb) - jb->subscription = JABBER_SUB_BOTH; - else if (g_str_equal(subscription, "none")) - jb->subscription = JABBER_SUB_NONE; - else if (g_str_equal(subscription, "to")) - jb->subscription = JABBER_SUB_TO; - else if (g_str_equal(subscription, "from")) - jb->subscription = JABBER_SUB_FROM; - else if (g_str_equal(subscription, "both")) - jb->subscription = JABBER_SUB_BOTH; - } - - if(purple_strequal(ask, "subscribe")) - jb->subscription |= JABBER_SUB_PENDING; - else - jb->subscription &= ~JABBER_SUB_PENDING; - - if(jb->subscription & JABBER_SUB_REMOVE) { - remove_purple_buddies(js, jid); - } else { - GSList *groups = NULL; - gboolean seen_empty = FALSE; - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) - if (!jabber_google_roster_incoming(js, item)) - continue; - - for(group = xmlnode_get_child(item, "group"); group; group = xmlnode_get_next_twin(group)) { - char *group_name = xmlnode_get_data(group); - - if (!group_name && !seen_empty) { - group_name = g_strdup(""); - seen_empty = TRUE; - } - - /* - * See the note in add_purple_buddy_to_groups; the core handles - * names case-insensitively and this is required to not - * end up with duplicates if a buddy is in, e.g., - * 'XMPP' and 'xmpp' - */ - if (g_slist_find_custom(groups, group_name, (GCompareFunc)purple_utf8_strcasecmp)) - g_free(group_name); - else - groups = g_slist_prepend(groups, group_name); - } - - add_purple_buddy_to_groups(js, jid, name, groups); - if (jb == js->user_jb) - jabber_presence_fake_to_self(js, NULL); - } - } - -#if 0 - ver = xmlnode_get_attrib(query, "ver"); - if (ver) { - PurpleAccount *account = purple_connection_get_account(js->gc); - purple_account_set_string(account, "roster_ver", ver); - } -#endif - - if (type == JABBER_IQ_SET) { - JabberIq *ack = jabber_iq_new(js, JABBER_IQ_RESULT); - jabber_iq_set_id(ack, id); - jabber_iq_send(ack); - } - - js->currently_parsing_roster_push = FALSE; -} - -/* jabber_roster_update frees the GSList* passed in */ -static void jabber_roster_update(JabberStream *js, const char *name, - GSList *groups) -{ - PurpleBuddy *b; - PurpleGroup *g; - GSList *l; - JabberIq *iq; - xmlnode *query, *item, *group; - const char *balias; - - if (js->currently_parsing_roster_push) - return; - - if(!(b = purple_find_buddy(js->gc->account, name))) - return; - - if (groups) { - char *tmp = roster_groups_join(groups); - - purple_debug_info("jabber", "jabber_roster_update(%s): [Source: " - "groups]: groups: %s\n", name, tmp); - g_free(tmp); - } else { - GSList *buddies = purple_find_buddies(js->gc->account, name); - char *tmp; - - if(!buddies) - return; - while(buddies) { - b = buddies->data; - g = purple_buddy_get_group(b); - groups = g_slist_append(groups, (char *)purple_group_get_name(g)); - buddies = g_slist_remove(buddies, b); - } - - tmp = roster_groups_join(groups); - purple_debug_info("jabber", "jabber_roster_update(%s): [Source: local blist]: groups: %s\n", - name, tmp); - g_free(tmp); - } - - iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - - query = xmlnode_get_child(iq->node, "query"); - item = xmlnode_new_child(query, "item"); - - xmlnode_set_attrib(item, "jid", name); - - balias = purple_buddy_get_local_buddy_alias(b); - xmlnode_set_attrib(item, "name", balias ? balias : ""); - - for(l = groups; l; l = l->next) { - group = xmlnode_new_child(item, "group"); - xmlnode_insert_data(group, l->data, -1); - } - - g_slist_free(groups); - - if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) { - jabber_google_roster_outgoing(js, query, item); - xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER); - xmlnode_set_attrib(query, "gr:ext", "2"); - } - jabber_iq_send(iq); -} - -void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - JabberStream *js = gc->proto_data; - char *who; - JabberID *jid; - JabberBuddy *jb; - JabberBuddyResource *jbr; - const char *name; - - /* If we haven't received the roster yet, ignore any adds */ - if (js->state != JABBER_STREAM_CONNECTED) - return; - - name = purple_buddy_get_name(buddy); - jid = jabber_id_new(name); - if (jid == NULL) { - /* TODO: Remove the buddy from the list? */ - return; - } - - /* Adding a chat room or a chat buddy to the roster is *not* supported. */ - if (jid->node && jabber_chat_find(js, jid->node, jid->domain) != NULL) { - /* - * This is the same thing Bonjour does. If it causes problems, move - * it to an idle callback. - */ - purple_debug_warning("jabber", "Cowardly refusing to add a MUC user " - "to your buddy list and removing the buddy. " - "Buddies can only be added by real (non-MUC) " - "JID\n"); - purple_blist_remove_buddy(buddy); - jabber_id_free(jid); - return; - } - - who = jabber_id_get_bare_jid(jid); - if (jid->resource != NULL) { - /* - * If the buddy name added contains a resource, strip that off and - * rename the buddy. - */ - purple_blist_rename_buddy(buddy, who); - } - - jb = jabber_buddy_find(js, who, FALSE); - - purple_debug_info("jabber", "jabber_roster_add_buddy(): Adding %s\n", who); - - jabber_roster_update(js, who, NULL); - - if (jb == js->user_jb) { - jabber_presence_fake_to_self(js, NULL); - } else if(!jb || !(jb->subscription & JABBER_SUB_TO)) { - jabber_presence_subscription_set(js, who, "subscribe"); - } else if((jbr =jabber_buddy_find_resource(jb, NULL))) { - purple_prpl_got_user_status(gc->account, who, - jabber_buddy_state_get_status_id(jbr->state), - "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL); - } - - g_free(who); -} - -void jabber_roster_alias_change(PurpleConnection *gc, const char *name, const char *alias) -{ - PurpleBuddy *b = purple_find_buddy(gc->account, name); - - if(b != NULL) { - purple_blist_alias_buddy(b, alias); - - purple_debug_info("jabber", "jabber_roster_alias_change(): Aliased %s to %s\n", - name, alias ? alias : "(null)"); - - jabber_roster_update(gc->proto_data, name, NULL); - } -} - -void jabber_roster_group_change(PurpleConnection *gc, const char *name, - const char *old_group, const char *new_group) -{ - GSList *buddies, *groups = NULL; - PurpleBuddy *b; - PurpleGroup *g; - const char *gname; - - if(!old_group || !new_group || !strcmp(old_group, new_group)) - return; - - buddies = purple_find_buddies(gc->account, name); - while(buddies) { - b = buddies->data; - g = purple_buddy_get_group(b); - gname = purple_group_get_name(g); - if(!strcmp(gname, old_group)) - groups = g_slist_append(groups, (char*)new_group); /* ick */ - else - groups = g_slist_append(groups, (char*)gname); - buddies = g_slist_remove(buddies, b); - } - - purple_debug_info("jabber", "jabber_roster_group_change(): Moving %s from %s to %s\n", - name, old_group, new_group); - - jabber_roster_update(gc->proto_data, name, groups); -} - -void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - GList *l; - const char *gname = purple_group_get_name(group); - for(l = moved_buddies; l; l = l->next) { - PurpleBuddy *buddy = l->data; - jabber_roster_group_change(gc, purple_buddy_get_name(buddy), old_name, gname); - } -} - -void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) { - const char *name = purple_buddy_get_name(buddy); - GSList *buddies = purple_find_buddies(purple_connection_get_account(gc), name); - - buddies = g_slist_remove(buddies, buddy); - if(buddies != NULL) { - PurpleBuddy *tmpbuddy; - PurpleGroup *tmpgroup; - GSList *groups = NULL; - - while(buddies) { - tmpbuddy = buddies->data; - tmpgroup = purple_buddy_get_group(tmpbuddy); - groups = g_slist_append(groups, (char *)purple_group_get_name(tmpgroup)); - buddies = g_slist_remove(buddies, tmpbuddy); - } - - purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s from %s\n", - purple_buddy_get_name(buddy), purple_group_get_name(group)); - - jabber_roster_update(gc->proto_data, name, groups); - } else { - JabberIq *iq = jabber_iq_new_query(gc->proto_data, JABBER_IQ_SET, - "jabber:iq:roster"); - xmlnode *query = xmlnode_get_child(iq->node, "query"); - xmlnode *item = xmlnode_new_child(query, "item"); - - xmlnode_set_attrib(item, "jid", name); - xmlnode_set_attrib(item, "subscription", "remove"); - - purple_debug_info("jabber", "jabber_roster_remove_buddy(): Removing %s\n", - purple_buddy_get_name(buddy)); - - jabber_iq_send(iq); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/roster.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/** - * @file roster.h Roster manipulation - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_ROSTER_H_ -#define PURPLE_JABBER_ROSTER_H_ - -#include "jabber.h" - -void jabber_roster_request(JabberStream *js); - -void jabber_roster_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); - -void jabber_roster_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group); -void jabber_roster_alias_change(PurpleConnection *gc, const char *name, - const char *alias); -void jabber_roster_group_change(PurpleConnection *gc, const char *name, - const char *old_group, const char *new_group); -void jabber_roster_group_rename(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies); -void jabber_roster_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group); - -#endif /* PURPLE_JABBER_ROSTER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1742 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "blist.h" -#include "debug.h" -#include "ft.h" -#include "request.h" -#include "network.h" -#include "notify.h" - -#include "buddy.h" -#include "disco.h" -#include "jabber.h" -#include "ibb.h" -#include "iq.h" -#include "si.h" - -#define STREAMHOST_CONNECT_TIMEOUT 15 - -typedef struct _JabberSIXfer { - JabberStream *js; - - PurpleProxyConnectData *connect_data; - PurpleNetworkListenData *listen_data; - guint connect_timeout; - - gboolean accepted; - - char *stream_id; - char *iq_id; - - enum { - STREAM_METHOD_UNKNOWN = 0, - STREAM_METHOD_BYTESTREAMS = 2 << 1, - STREAM_METHOD_IBB = 2 << 2, - STREAM_METHOD_UNSUPPORTED = 2 << 31 - } stream_method; - - GList *streamhosts; - PurpleProxyInfo *gpi; - - char *rxqueue; - size_t rxlen; - gsize rxmaxlen; - int local_streamhost_fd; - - JabberIBBSession *ibb_session; - guint ibb_timeout_handle; - PurpleCircBuffer *ibb_buffer; -} JabberSIXfer; - -/* some forward declarations */ -static void jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer); - -static PurpleXfer* -jabber_si_xfer_find(JabberStream *js, const char *sid, const char *from) -{ - GList *xfers; - - if(!sid || !from) - return NULL; - - for(xfers = js->file_transfers; xfers; xfers = xfers->next) { - PurpleXfer *xfer = xfers->data; - JabberSIXfer *jsx = xfer->data; - if(jsx->stream_id && xfer->who && - !strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from)) - return xfer; - } - - return NULL; -} - -static void -jabber_si_free_streamhost(gpointer data, gpointer user_data) -{ - JabberBytestreamsStreamhost *sh = data; - - if(!data) - return; - - g_free(sh->jid); - g_free(sh->host); - g_free(sh->zeroconf); - g_free(sh); -} - - - -static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer); - -static void -jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - JabberIq *iq; - xmlnode *query, *su; - JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data; - - purple_proxy_info_destroy(jsx->gpi); - jsx->gpi = NULL; - jsx->connect_data = NULL; - - if (jsx->connect_timeout > 0) - purple_timeout_remove(jsx->connect_timeout); - jsx->connect_timeout = 0; - - if(source < 0) { - purple_debug_warning("jabber", - "si connection failed, jid was %s, host was %s, error was %s\n", - streamhost->jid, streamhost->host, - error_message ? error_message : "(null)"); - jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); - jabber_si_free_streamhost(streamhost, NULL); - jabber_si_bytestreams_attempt_connect(xfer); - return; - } - - /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) - { - xmlnode *activate; - iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", streamhost->jid); - query = xmlnode_get_child(iq->node, "query"); - xmlnode_set_attrib(query, "sid", jsx->stream_id); - activate = xmlnode_new_child(query, "activate"); - xmlnode_insert_data(activate, xfer->who, -1); - - /* TODO: We need to wait for an activation result before starting */ - } - else - { - iq = jabber_iq_new_query(jsx->js, JABBER_IQ_RESULT, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jsx->iq_id); - query = xmlnode_get_child(iq->node, "query"); - su = xmlnode_new_child(query, "streamhost-used"); - xmlnode_set_attrib(su, "jid", streamhost->jid); - } - - jabber_iq_send(iq); - - purple_xfer_start(xfer, source, NULL, -1); -} - -static gboolean -connect_timeout_cb(gpointer data) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - - purple_debug_info("jabber", "Streamhost connection timeout of %d seconds exceeded.\n", STREAMHOST_CONNECT_TIMEOUT); - - jsx->connect_timeout = 0; - - if (jsx->connect_data != NULL) - purple_proxy_connect_cancel(jsx->connect_data); - jsx->connect_data = NULL; - - /* Trigger the connect error manually */ - jabber_si_bytestreams_connect_cb(xfer, -1, "Timeout Exceeded."); - - return FALSE; -} - -static void -jabber_si_bytestreams_ibb_timeout_remove(JabberSIXfer *jsx) -{ - if (jsx->ibb_timeout_handle) { - purple_timeout_remove(jsx->ibb_timeout_handle); - jsx->ibb_timeout_handle = 0; - } -} - -static gboolean -jabber_si_bytestreams_ibb_timeout_cb(gpointer data) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = xfer->data; - - if (jsx && !jsx->ibb_session) { - purple_debug_info("jabber", - "jabber_si_bytestreams_ibb_timeout called and IBB session not set " - " up yet, cancel transfer"); - jabber_si_bytestreams_ibb_timeout_remove(jsx); - purple_xfer_cancel_local(xfer); - } - - return FALSE; -} - -static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - JabberBytestreamsStreamhost *streamhost; - JabberID *dstjid; - - if(!jsx->streamhosts) { - JabberIq *iq = jabber_iq_new(jsx->js, JABBER_IQ_ERROR); - xmlnode *error, *inf; - - if(jsx->iq_id) - jabber_iq_set_id(iq, jsx->iq_id); - - xmlnode_set_attrib(iq->node, "to", xfer->who); - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "code", "404"); - xmlnode_set_attrib(error, "type", "cancel"); - inf = xmlnode_new_child(error, "item-not-found"); - xmlnode_set_namespace(inf, NS_XMPP_STANZAS); - - jabber_iq_send(iq); - - /* if IBB is available, revert to that before giving up... */ - if (jsx->stream_method & STREAM_METHOD_IBB) { - /* if we are the initializer, init IBB */ - purple_debug_info("jabber", - "jabber_si_bytestreams_attempt_connect: " - "no streamhosts found, trying IBB\n"); - /* if we are the sender, open an IBB session, but not if we already - did it, since we could have received the error <iq/> from the - receiver already... */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND - && !jsx->ibb_session) { - jabber_si_xfer_ibb_send_init(jsx->js, xfer); - } else { - /* setup a timeout to cancel waiting for IBB open */ - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are the receiver, just wait for IBB open, callback is - already set up... */ - } else { - purple_xfer_cancel_local(xfer); - } - - return; - } - - streamhost = jsx->streamhosts->data; - - jsx->connect_data = NULL; - if (jsx->gpi != NULL) - purple_proxy_info_destroy(jsx->gpi); - jsx->gpi = NULL; - - dstjid = jabber_id_new(xfer->who); - - /* TODO: Deal with zeroconf */ - - if(dstjid != NULL && streamhost->host && streamhost->port > 0) { - char *dstaddr, *hash; - jsx->gpi = purple_proxy_info_new(); - purple_proxy_info_set_type(jsx->gpi, PURPLE_PROXY_SOCKS5); - purple_proxy_info_set_host(jsx->gpi, streamhost->host); - purple_proxy_info_set_port(jsx->gpi, streamhost->port); - - /* unknown file transfer type is assumed to be RECEIVE */ - if(xfer->type == PURPLE_XFER_SEND) - dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, jsx->js->user->node, jsx->js->user->domain, - jsx->js->user->resource, dstjid->node, dstjid->domain, dstjid->resource); - else - dstaddr = g_strdup_printf("%s%s@%s/%s%s@%s/%s", jsx->stream_id, dstjid->node, dstjid->domain, dstjid->resource, - jsx->js->user->node, jsx->js->user->domain, jsx->js->user->resource); - - /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ - hash = jabber_calculate_data_sha1sum(dstaddr, strlen(dstaddr)); - - jsx->connect_data = purple_proxy_connect_socks5(NULL, jsx->gpi, - hash, 0, - jabber_si_bytestreams_connect_cb, xfer); - g_free(hash); - g_free(dstaddr); - - /* When selecting a streamhost, timeout after STREAMHOST_CONNECT_TIMEOUT seconds, otherwise it takes forever */ - if (xfer->type != PURPLE_XFER_SEND && jsx->connect_data != NULL) - jsx->connect_timeout = purple_timeout_add_seconds( - STREAMHOST_CONNECT_TIMEOUT, connect_timeout_cb, xfer); - - jabber_id_free(dstjid); - } - - if (jsx->connect_data == NULL) - { - jsx->streamhosts = g_list_remove(jsx->streamhosts, streamhost); - jabber_si_free_streamhost(streamhost, NULL); - jabber_si_bytestreams_attempt_connect(xfer); - } -} - -void jabber_bytestreams_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query) -{ - PurpleXfer *xfer; - JabberSIXfer *jsx; - xmlnode *streamhost; - const char *sid; - - if(type != JABBER_IQ_SET) - return; - - if(!from) - return; - - if(!(sid = xmlnode_get_attrib(query, "sid"))) - return; - - if(!(xfer = jabber_si_xfer_find(js, sid, from))) - return; - - jsx = xfer->data; - - if(!jsx->accepted) - return; - - if(jsx->iq_id) - g_free(jsx->iq_id); - jsx->iq_id = g_strdup(id); - - for(streamhost = xmlnode_get_child(query, "streamhost"); streamhost; - streamhost = xmlnode_get_next_twin(streamhost)) { - const char *jid, *host = NULL, *port, *zeroconf; - int portnum = 0; - - if((jid = xmlnode_get_attrib(streamhost, "jid")) && - ((zeroconf = xmlnode_get_attrib(streamhost, "zeroconf")) || - ((host = xmlnode_get_attrib(streamhost, "host")) && - (port = xmlnode_get_attrib(streamhost, "port")) && - (portnum = atoi(port))))) { - JabberBytestreamsStreamhost *sh = g_new0(JabberBytestreamsStreamhost, 1); - sh->jid = g_strdup(jid); - sh->host = g_strdup(host); - sh->port = portnum; - sh->zeroconf = g_strdup(zeroconf); - /* If there were a lot of these, it'd be worthwhile to prepend and reverse. */ - jsx->streamhosts = g_list_append(jsx->streamhosts, sh); - } - } - - jabber_si_bytestreams_attempt_connect(xfer); -} - - -static void -jabber_si_xfer_bytestreams_send_read_again_resp_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int len; - - len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); - if (len < 0 && errno == EAGAIN) - return; - else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxlen += len; - - if (jsx->rxlen < jsx->rxmaxlen) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - - /* Before actually starting sending the file, we need to wait until the - * recipient sends the IQ result with <streamhost-used/> - */ - purple_debug_info("jabber", "SOCKS5 connection negotiation completed. " - "Waiting for IQ result to start file transfer.\n"); -} - -static void -jabber_si_xfer_bytestreams_send_read_again_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/ - int len; - char *dstaddr, *hash; - const char *host; - - purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_again_cb\n"); - - if(jsx->rxlen < 5) { - purple_debug_info("jabber", "reading the first 5 bytes\n"); - len = read(source, buffer, 5 - jsx->rxlen); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - return; - } else if(jsx->rxqueue[0] != 0x05 || jsx->rxqueue[1] != 0x01 || - jsx->rxqueue[3] != 0x03 || jsx->rxqueue[4] != 40) { - purple_debug_info("jabber", "Invalid socks5 conn req. header[0x%x,0x%x,0x%x,0x%x,0x%x]\n", - jsx->rxqueue[0], jsx->rxqueue[1], jsx->rxqueue[2], - jsx->rxqueue[3], jsx->rxqueue[4]); - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } else if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) { - /* Upper-bound of 257 (jsx->rxlen = 5, jsx->rxqueue[4] = 0xFF) */ - unsigned short to_read = jsx->rxqueue[4] + 2 - (jsx->rxlen - 5); - purple_debug_info("jabber", "reading %u bytes for DST.ADDR + port num (trying to read %hu now)\n", - jsx->rxqueue[4] + 2, to_read); - len = read(source, buffer, to_read); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - } - - /* Have we not read all of DST.ADDR and the following 2-byte port number? */ - if(jsx->rxlen - 5 < jsx->rxqueue[4] + 2) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - - dstaddr = g_strdup_printf("%s%s@%s/%s%s", jsx->stream_id, - jsx->js->user->node, jsx->js->user->domain, - jsx->js->user->resource, xfer->who); - - /* Per XEP-0065, the 'host' must be SHA1(SID + from JID + to JID) */ - hash = jabber_calculate_data_sha1sum(dstaddr, strlen(dstaddr)); - - if(strncmp(hash, jsx->rxqueue + 5, 40) || - jsx->rxqueue[45] != 0x00 || jsx->rxqueue[46] != 0x00) { - if (jsx->rxqueue[45] != 0x00 || jsx->rxqueue[46] != 0x00) - purple_debug_error("jabber", "Got SOCKS5 BS conn with the wrong DST.PORT" - " (must be 0 - got[0x%x,0x%x]).\n", - jsx->rxqueue[45], jsx->rxqueue[46]); - else - purple_debug_error("jabber", "Got SOCKS5 BS conn with the wrong DST.ADDR" - " (expected '%s' - got '%.40s').\n", - hash, jsx->rxqueue + 5); - close(source); - purple_xfer_cancel_remote(xfer); - g_free(hash); - g_free(dstaddr); - return; - } - - g_free(hash); - g_free(dstaddr); - - g_free(jsx->rxqueue); - host = purple_network_get_my_ip(jsx->js->fd); - - jsx->rxmaxlen = 5 + strlen(host) + 2; - jsx->rxqueue = g_malloc(jsx->rxmaxlen); - jsx->rxlen = 0; - - jsx->rxqueue[0] = 0x05; - jsx->rxqueue[1] = 0x00; - jsx->rxqueue[2] = 0x00; - jsx->rxqueue[3] = 0x03; - jsx->rxqueue[4] = strlen(host); - memcpy(jsx->rxqueue + 5, host, strlen(host)); - jsx->rxqueue[5+strlen(host)] = 0x00; - jsx->rxqueue[6+strlen(host)] = 0x00; - - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_again_resp_cb, xfer); - jabber_si_xfer_bytestreams_send_read_again_resp_cb(xfer, source, - PURPLE_INPUT_WRITE); -} - -static void -jabber_si_xfer_bytestreams_send_read_response_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int len; - - len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen); - if (len < 0 && errno == EAGAIN) - return; - else if (len < 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxlen += len; - - if (jsx->rxlen < jsx->rxmaxlen) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - - /* If we sent a "Success", wait for a response, otherwise give up and cancel */ - if (jsx->rxqueue[1] == 0x00) { - xfer->watcher = purple_input_add(source, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_again_cb, xfer); - g_free(jsx->rxqueue); - jsx->rxqueue = NULL; - jsx->rxlen = 0; - } else { - close(source); - purple_xfer_cancel_remote(xfer); - } -} - -static void -jabber_si_xfer_bytestreams_send_read_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int i; - int len; - char buffer[256]; - - purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_read_cb\n"); - - xfer->fd = source; - - /** Try to read the SOCKS5 header */ - if(jsx->rxlen < 2) { - purple_debug_info("jabber", "reading those first two bytes\n"); - len = read(source, buffer, 2 - jsx->rxlen); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - return; - } else if(jsx->rxlen - 2 < jsx->rxqueue[1]) { - /* Has a maximum value of 255 (jsx->rxlen = 2, jsx->rxqueue[1] = 0xFF) */ - unsigned short to_read = jsx->rxqueue[1] - (jsx->rxlen - 2); - purple_debug_info("jabber", "reading %u bytes for auth methods (trying to read %hu now)\n", - jsx->rxqueue[1], to_read); - len = read(source, buffer, to_read); - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - jsx->rxqueue = g_realloc(jsx->rxqueue, len + jsx->rxlen); - memcpy(jsx->rxqueue + jsx->rxlen, buffer, len); - jsx->rxlen += len; - } - - /* Have we not read all the auth. method bytes? */ - if(jsx->rxlen -2 < jsx->rxqueue[1]) - return; - - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - - purple_debug_info("jabber", "checking to make sure we're socks FIVE\n"); - - if(jsx->rxqueue[0] != 0x05) { - close(source); - purple_xfer_cancel_remote(xfer); - return; - } - - purple_debug_info("jabber", "going to test %hhu different methods\n", jsx->rxqueue[1]); - - for(i=0; i<jsx->rxqueue[1]; i++) { - - purple_debug_info("jabber", "testing %hhu\n", jsx->rxqueue[i+2]); - if(jsx->rxqueue[i+2] == 0x00) { - g_free(jsx->rxqueue); - jsx->rxlen = 0; - jsx->rxmaxlen = 2; - jsx->rxqueue = g_malloc(jsx->rxmaxlen); - jsx->rxqueue[0] = 0x05; - jsx->rxqueue[1] = 0x00; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_response_cb, - xfer); - jabber_si_xfer_bytestreams_send_read_response_cb(xfer, - source, PURPLE_INPUT_WRITE); - jsx->rxqueue = NULL; - jsx->rxlen = 0; - return; - } - } - - g_free(jsx->rxqueue); - jsx->rxlen = 0; - jsx->rxmaxlen = 2; - jsx->rxqueue = g_malloc(jsx->rxmaxlen); - jsx->rxqueue[0] = 0x05; - jsx->rxqueue[1] = 0xFF; - xfer->watcher = purple_input_add(source, PURPLE_INPUT_WRITE, - jabber_si_xfer_bytestreams_send_read_response_cb, xfer); - jabber_si_xfer_bytestreams_send_read_response_cb(xfer, - source, PURPLE_INPUT_WRITE); -} - -static gint -jabber_si_compare_jid(gconstpointer a, gconstpointer b) -{ - const JabberBytestreamsStreamhost *sh = a; - - if(!a) - return -1; - - return strcmp(sh->jid, (char *)b); -} - -static void -jabber_si_xfer_bytestreams_send_connected_cb(gpointer data, gint source, - PurpleInputCondition cond) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx = xfer->data; - int acceptfd, flags; - - purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n"); - - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) - return; - else if(acceptfd == -1) { - purple_debug_warning("jabber", "accept: %s\n", g_strerror(errno)); - /* Don't cancel the ft - allow it to fall to the next streamhost.*/ - return; - } - - purple_input_remove(xfer->watcher); - close(source); - jsx->local_streamhost_fd = -1; - - flags = fcntl(acceptfd, F_GETFL); - fcntl(acceptfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(acceptfd, F_SETFD, FD_CLOEXEC); -#endif - - xfer->watcher = purple_input_add(acceptfd, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_read_cb, xfer); -} - -static void -jabber_si_connect_proxy_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx; - xmlnode *query, *streamhost_used; - const char *jid; - GList *matched; - - /* TODO: This need to send errors if we don't see what we're looking for */ - - /* Make sure that the xfer is actually still valid and we're not just receiving an old iq response */ - if (!g_list_find(js->file_transfers, xfer)) { - purple_debug_error("jabber", "Got bytestreams response for no longer existing xfer (%p)\n", xfer); - return; - } - - /* In the case of a direct file transfer, this is expected to return */ - if(!xfer->data) - return; - - jsx = xfer->data; - - if(type != JABBER_IQ_RESULT) { - purple_debug_info("jabber", - "jabber_si_xfer_connect_proxy_cb: type = error\n"); - /* if IBB is available, open IBB session */ - purple_debug_info("jabber", - "jabber_si_xfer_connect_proxy_cb: got error, method: %d\n", - jsx->stream_method); - if (jsx->stream_method & STREAM_METHOD_IBB) { - purple_debug_info("jabber", "IBB is possible, try it\n"); - /* if we are the sender and haven't already opened an IBB - session, do so now (we might already have failed to open - the bytestream proxy ourselves when receiving this <iq/> */ - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND - && !jsx->ibb_session) { - jabber_si_xfer_ibb_send_init(js, xfer); - } else { - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are receiver, just wait for IBB open stanza, callback - is already set up */ - } else { - purple_xfer_cancel_remote(xfer); - } - return; - } - - if (!from) - return; - - if(!(query = xmlnode_get_child(packet, "query"))) - return; - - if(!(streamhost_used = xmlnode_get_child(query, "streamhost-used"))) - return; - - if(!(jid = xmlnode_get_attrib(streamhost_used, "jid"))) - return; - - purple_debug_info("jabber", "jabber_si_connect_proxy_cb() will be looking at jsx %p: jsx->streamhosts is %p and jid is %s\n", - jsx, jsx->streamhosts, jid); - - if(!(matched = g_list_find_custom(jsx->streamhosts, jid, jabber_si_compare_jid))) - { - gchar *my_jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, - jsx->js->user->domain, jsx->js->user->resource); - if (!strcmp(jid, my_jid)) { - purple_debug_info("jabber", "Got local SOCKS5 streamhost-used.\n"); - purple_xfer_start(xfer, xfer->fd, NULL, -1); - } else { - /* if available, try to revert to IBB... */ - if (jsx->stream_method & STREAM_METHOD_IBB) { - purple_debug_info("jabber", - "jabber_si_connect_proxy_cb: trying to revert to IBB\n"); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - jabber_si_xfer_ibb_send_init(jsx->js, xfer); - } else { - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are the receiver, we are already set up...*/ - } else { - purple_debug_info("jabber", - "streamhost-used does not match any proxy that was offered to target\n"); - purple_xfer_cancel_local(xfer); - } - } - g_free(my_jid); - return; - } - - /* Clean up the local streamhost - it isn't going to be used.*/ - if (xfer->watcher > 0) { - purple_input_remove(xfer->watcher); - xfer->watcher = 0; - } - if (jsx->local_streamhost_fd >= 0) { - close(jsx->local_streamhost_fd); - jsx->local_streamhost_fd = -1; - } - - jsx->streamhosts = g_list_remove_link(jsx->streamhosts, matched); - g_list_foreach(jsx->streamhosts, jabber_si_free_streamhost, NULL); - g_list_free(jsx->streamhosts); - - jsx->streamhosts = matched; - - jabber_si_bytestreams_attempt_connect(xfer); -} - -static void -jabber_si_xfer_bytestreams_listen_cb(int sock, gpointer data) -{ - PurpleXfer *xfer = data; - JabberSIXfer *jsx; - JabberIq *iq; - xmlnode *query, *streamhost; - char port[6]; - GList *tmp; - JabberBytestreamsStreamhost *sh, *sh2; - int streamhost_count = 0; - - jsx = xfer->data; - jsx->listen_data = NULL; - - /* I'm not sure under which conditions this can happen - * (it seems like it shouldn't be possible */ - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) { - purple_xfer_unref(xfer); - return; - } - - purple_xfer_unref(xfer); - - iq = jabber_iq_new_query(jsx->js, JABBER_IQ_SET, NS_BYTESTREAMS); - xmlnode_set_attrib(iq->node, "to", xfer->who); - query = xmlnode_get_child(iq->node, "query"); - - xmlnode_set_attrib(query, "sid", jsx->stream_id); - - /* If we successfully started listening locally */ - if (sock >= 0) { - gchar *jid; - const char *local_ip, *public_ip; - - jsx->local_streamhost_fd = sock; - - jid = g_strdup_printf("%s@%s/%s", jsx->js->user->node, - jsx->js->user->domain, jsx->js->user->resource); - xfer->local_port = purple_network_get_port_from_fd(sock); - g_snprintf(port, sizeof(port), "%hu", xfer->local_port); - - /* Include the localhost's IP (for in-network transfers) */ - local_ip = purple_network_get_local_system_ip(jsx->js->fd); - if (strcmp(local_ip, "0.0.0.0") != 0) { - streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", jid); - xmlnode_set_attrib(streamhost, "host", local_ip); - xmlnode_set_attrib(streamhost, "port", port); - } - - /* Include the public IP (assuming that there is a port mapped somehow) */ - public_ip = purple_network_get_my_ip(jsx->js->fd); - if (strcmp(public_ip, local_ip) != 0 && strcmp(public_ip, "0.0.0.0") != 0) { - streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", jid); - xmlnode_set_attrib(streamhost, "host", public_ip); - xmlnode_set_attrib(streamhost, "port", port); - } - - g_free(jid); - - /* The listener for the local proxy */ - xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ, - jabber_si_xfer_bytestreams_send_connected_cb, xfer); - } - - for (tmp = jsx->js->bs_proxies; tmp; tmp = tmp->next) { - sh = tmp->data; - - /* TODO: deal with zeroconf proxies */ - - if (!(sh->jid && sh->host && sh->port > 0)) - continue; - - purple_debug_info("jabber", "jabber_si_xfer_bytestreams_listen_cb() will be looking at jsx %p: jsx->streamhosts %p and sh->jid %p\n", - jsx, jsx->streamhosts, sh->jid); - if(g_list_find_custom(jsx->streamhosts, sh->jid, jabber_si_compare_jid) != NULL) - continue; - - streamhost_count++; - streamhost = xmlnode_new_child(query, "streamhost"); - xmlnode_set_attrib(streamhost, "jid", sh->jid); - xmlnode_set_attrib(streamhost, "host", sh->host); - g_snprintf(port, sizeof(port), "%hu", sh->port); - xmlnode_set_attrib(streamhost, "port", port); - - sh2 = g_new0(JabberBytestreamsStreamhost, 1); - sh2->jid = g_strdup(sh->jid); - sh2->host = g_strdup(sh->host); - /*sh2->zeroconf = g_strdup(sh->zeroconf);*/ - sh2->port = sh->port; - - jsx->streamhosts = g_list_prepend(jsx->streamhosts, sh2); - } - - /* We have no way of transferring, cancel the transfer */ - if (streamhost_count == 0) { - jabber_iq_free(iq); - - /* if available, revert to IBB */ - if (jsx->stream_method & STREAM_METHOD_IBB) { - purple_debug_info("jabber", - "jabber_si_xfer_bytestreams_listen_cb: trying to revert to IBB\n"); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - /* if we are the sender, init the IBB session... */ - jabber_si_xfer_ibb_send_init(jsx->js, xfer); - } else { - jsx->ibb_timeout_handle = purple_timeout_add_seconds(30, - jabber_si_bytestreams_ibb_timeout_cb, xfer); - } - /* if we are the receiver, we should just wait... the IBB open - handler has already been set up... */ - } else { - /* We should probably notify the target, - but this really shouldn't ever happen */ - purple_xfer_cancel_local(xfer); - } - - return; - } - - jabber_iq_set_callback(iq, jabber_si_connect_proxy_cb, xfer); - - jabber_iq_send(iq); - -} - -static void -jabber_si_xfer_bytestreams_send_init(PurpleXfer *xfer) -{ - JabberSIXfer *jsx; - - purple_xfer_ref(xfer); - - jsx = xfer->data; - - /* TODO: Should there be an option to not use the local host as a ft proxy? - * (to prevent revealing IP address, etc.) */ - jsx->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM, - jabber_si_xfer_bytestreams_listen_cb, xfer); - if (jsx->listen_data == NULL) { - /* We couldn't open a local port. Perhaps we can use a proxy. */ - jabber_si_xfer_bytestreams_listen_cb(-1, xfer); - } - -} - -static void -jabber_si_xfer_ibb_error_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberStream *js = jabber_ibb_session_get_js(sess); - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - purple_debug_error("jabber", "an error occurred during IBB file transfer\n"); - purple_xfer_error(purple_xfer_get_type(xfer), account, - jabber_ibb_session_get_who(sess), - _("An error occurred on the in-band bytestream transfer\n")); - purple_xfer_cancel_remote(xfer); -} - -static void -jabber_si_xfer_ibb_closed_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberStream *js = jabber_ibb_session_get_js(sess); - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - purple_debug_info("jabber", "the remote user closed the transfer\n"); - if (purple_xfer_get_bytes_remaining(xfer) > 0) { - purple_xfer_error(purple_xfer_get_type(xfer), account, - jabber_ibb_session_get_who(sess), _("Transfer was closed.")); - purple_xfer_cancel_remote(xfer); - } else { - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - } -} - -static void -jabber_si_xfer_ibb_recv_data_cb(JabberIBBSession *sess, gpointer data, - gsize size) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - if (size <= purple_xfer_get_bytes_remaining(xfer)) { - purple_debug_info("jabber", "about to write %" G_GSIZE_FORMAT " bytes from IBB stream\n", - size); - purple_circ_buffer_append(jsx->ibb_buffer, data, size); - purple_xfer_prpl_ready(xfer); - } else { - /* trying to write past size of file transfers negotiated size, - reject transfer to protect against malicious behaviour */ - purple_debug_error("jabber", - "IBB file transfer send more data than expected\n"); - purple_xfer_cancel_remote(xfer); - } - -} - -static gssize -jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - guchar *buffer; - gsize size; - gsize tmp; - - size = jsx->ibb_buffer->bufused; - *out_buffer = buffer = g_malloc(size); - while ((tmp = purple_circ_buffer_get_max_read(jsx->ibb_buffer))) { - memcpy(buffer, jsx->ibb_buffer->outptr, tmp); - buffer += tmp; - purple_circ_buffer_mark_read(jsx->ibb_buffer, tmp); - } - - return size; -} - -static gboolean -jabber_si_xfer_ibb_open_cb(JabberStream *js, const char *who, const char *id, - xmlnode *open) -{ - const gchar *sid = xmlnode_get_attrib(open, "sid"); - PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who); - if (xfer) { - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - JabberIBBSession *sess = - jabber_ibb_session_create_from_xmlnode(js, who, id, open, xfer); - - jabber_si_bytestreams_ibb_timeout_remove(jsx); - - if (sess) { - /* setup callbacks here...*/ - jabber_ibb_session_set_data_received_callback(sess, - jabber_si_xfer_ibb_recv_data_cb); - jabber_ibb_session_set_closed_callback(sess, - jabber_si_xfer_ibb_closed_cb); - jabber_ibb_session_set_error_callback(sess, - jabber_si_xfer_ibb_error_cb); - - jsx->ibb_session = sess; - jsx->ibb_buffer = - purple_circ_buffer_new(jabber_ibb_session_get_block_size(sess)); - - /* set up read function */ - purple_xfer_set_read_fnc(xfer, jabber_si_xfer_ibb_read); - - /* start the transfer */ - purple_xfer_start(xfer, -1, NULL, 0); - return TRUE; - } else { - /* failed to create IBB session */ - purple_debug_error("jabber", "failed to create IBB session\n"); - purple_xfer_cancel_remote(xfer); - return FALSE; - } - } else { - /* we got an IBB <open/> for an unknown file transfer, pass along... */ - purple_debug_info("jabber", - "IBB open did not match any SI file transfer\n"); - return FALSE; - } -} - -static gssize -jabber_si_xfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - JabberIBBSession *sess = jsx->ibb_session; - gsize packet_size = len < jabber_ibb_session_get_block_size(sess) ? - len : jabber_ibb_session_get_block_size(sess); - - jabber_ibb_session_send_data(sess, buffer, packet_size); - - return packet_size; -} - -static void -jabber_si_xfer_ibb_sent_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - gsize remaining = purple_xfer_get_bytes_remaining(xfer); - - if (remaining == 0) { - /* close the session */ - jabber_ibb_session_close(sess); - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - } else { - /* send more... */ - purple_xfer_prpl_ready(xfer); - } -} - -static void -jabber_si_xfer_ibb_opened_cb(JabberIBBSession *sess) -{ - PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess); - JabberStream *js = jabber_ibb_session_get_js(sess); - PurpleConnection *gc = js->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - if (jabber_ibb_session_get_state(sess) == JABBER_IBB_SESSION_OPENED) { - purple_xfer_start(xfer, -1, NULL, 0); - purple_xfer_prpl_ready(xfer); - } else { - /* error */ - purple_xfer_error(purple_xfer_get_type(xfer), account, - jabber_ibb_session_get_who(sess), - _("Failed to open in-band bytestream")); - purple_xfer_end(xfer); - } -} - -static void -jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - jsx->ibb_session = jabber_ibb_session_create(js, jsx->stream_id, - purple_xfer_get_remote_user(xfer), xfer); - - if (jsx->ibb_session) { - /* should set callbacks here... */ - jabber_ibb_session_set_opened_callback(jsx->ibb_session, - jabber_si_xfer_ibb_opened_cb); - jabber_ibb_session_set_data_sent_callback(jsx->ibb_session, - jabber_si_xfer_ibb_sent_cb); - jabber_ibb_session_set_closed_callback(jsx->ibb_session, - jabber_si_xfer_ibb_closed_cb); - jabber_ibb_session_set_error_callback(jsx->ibb_session, - jabber_si_xfer_ibb_error_cb); - - purple_xfer_set_write_fnc(xfer, jabber_si_xfer_ibb_write); - - jsx->ibb_buffer = - purple_circ_buffer_new(jabber_ibb_session_get_block_size(jsx->ibb_session)); - - /* open the IBB session */ - jabber_ibb_session_open(jsx->ibb_session); - - } else { - /* failed to create IBB session */ - purple_debug_error("jabber", - "failed to initiate IBB session for file transfer\n"); - purple_xfer_cancel_local(xfer); - } -} - -static void jabber_si_xfer_send_method_cb(JabberStream *js, const char *from, - JabberIqType type, const char *id, - xmlnode *packet, gpointer data) -{ - PurpleXfer *xfer = data; - xmlnode *si, *feature, *x, *field, *value; - gboolean found_method = FALSE; - - if(!(si = xmlnode_get_child_with_namespace(packet, "si", "http://jabber.org/protocol/si"))) { - purple_xfer_cancel_remote(xfer); - return; - } - - if(!(feature = xmlnode_get_child_with_namespace(si, "feature", "http://jabber.org/protocol/feature-neg"))) { - purple_xfer_cancel_remote(xfer); - return; - } - - if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) { - purple_xfer_cancel_remote(xfer); - return; - } - - for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - if(var && !strcmp(var, "stream-method")) { - if((value = xmlnode_get_child(field, "value"))) { - char *val = xmlnode_get_data(value); - if(val && !strcmp(val, NS_BYTESTREAMS)) { - jabber_si_xfer_bytestreams_send_init(xfer); - jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; - found_method = TRUE; - } else if (val && !strcmp(val, NS_IBB)) { - jsx->stream_method |= STREAM_METHOD_IBB; - if (!found_method) { - /* we haven't tried to init a bytestream session, yet - start IBB right away... */ - jabber_si_xfer_ibb_send_init(js, xfer); - found_method = TRUE; - } - } - g_free(val); - } - } - } - - if (!found_method) { - purple_xfer_cancel_remote(xfer); - } - -} - -static void jabber_si_xfer_send_request(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - JabberIq *iq; - xmlnode *si, *file, *feature, *x, *field, *option, *value; - char buf[32]; - - xfer->filename = g_path_get_basename(xfer->local_filename); - - iq = jabber_iq_new(jsx->js, JABBER_IQ_SET); - xmlnode_set_attrib(iq->node, "to", xfer->who); - si = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); - jsx->stream_id = jabber_get_next_id(jsx->js); - xmlnode_set_attrib(si, "id", jsx->stream_id); - xmlnode_set_attrib(si, "profile", - "http://jabber.org/protocol/si/profile/file-transfer"); - - file = xmlnode_new_child(si, "file"); - xmlnode_set_namespace(file, - "http://jabber.org/protocol/si/profile/file-transfer"); - xmlnode_set_attrib(file, "name", xfer->filename); - g_snprintf(buf, sizeof(buf), "%" G_GSIZE_FORMAT, xfer->size); - xmlnode_set_attrib(file, "size", buf); - /* maybe later we'll do hash and date attribs */ - - feature = xmlnode_new_child(si, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "form"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - xmlnode_set_attrib(field, "type", "list-single"); - /* maybe we should add an option to always skip bytestreams for people - behind troublesome firewalls */ - option = xmlnode_new_child(field, "option"); - value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, NS_BYTESTREAMS, -1); - option = xmlnode_new_child(field, "option"); - value = xmlnode_new_child(option, "value"); - xmlnode_insert_data(value, NS_IBB, -1); - - jabber_iq_set_callback(iq, jabber_si_xfer_send_method_cb, xfer); - - /* Store the IQ id so that we can cancel the callback */ - g_free(jsx->iq_id); - jsx->iq_id = g_strdup(iq->id); - - jabber_iq_send(iq); -} - -static void jabber_si_xfer_free(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - - if (jsx) { - JabberStream *js = jsx->js; - - js->file_transfers = g_list_remove(js->file_transfers, xfer); - - if (jsx->connect_data != NULL) - purple_proxy_connect_cancel(jsx->connect_data); - if (jsx->listen_data != NULL) - purple_network_listen_cancel(jsx->listen_data); - if (jsx->iq_id != NULL) - jabber_iq_remove_callback_by_id(js, jsx->iq_id); - if (jsx->local_streamhost_fd >= 0) - close(jsx->local_streamhost_fd); - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && - xfer->fd >= 0) { - purple_debug_info("jabber", "remove port mapping\n"); - purple_network_remove_port_mapping(xfer->fd); - } - if (jsx->connect_timeout > 0) - purple_timeout_remove(jsx->connect_timeout); - if (jsx->ibb_timeout_handle > 0) - purple_timeout_remove(jsx->ibb_timeout_handle); - - if (jsx->streamhosts) { - g_list_foreach(jsx->streamhosts, jabber_si_free_streamhost, NULL); - g_list_free(jsx->streamhosts); - } - - if (jsx->ibb_session) { - purple_debug_info("jabber", - "jabber_si_xfer_free: destroying IBB session\n"); - jabber_ibb_session_destroy(jsx->ibb_session); - } - - if (jsx->ibb_buffer) { - purple_circ_buffer_destroy(jsx->ibb_buffer); - } - - purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx); - - g_free(jsx->stream_id); - g_free(jsx->iq_id); - /* XXX: free other stuff */ - g_free(jsx->rxqueue); - g_free(jsx); - xfer->data = NULL; - } -} - -/* - * These four functions should only be called from the PurpleXfer functions - * (typically purple_xfer_cancel_(remote|local), purple_xfer_end, or - * purple_xfer_request_denied. - */ -static void jabber_si_xfer_cancel_send(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - /* if there is an IBB session active, send close on that */ - if (jsx->ibb_session) { - jabber_ibb_session_close(jsx->ibb_session); - } - jabber_si_xfer_free(xfer); - purple_debug_info("jabber", "in jabber_si_xfer_cancel_send\n"); -} - - -static void jabber_si_xfer_request_denied(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - JabberStream *js = jsx->js; - - /* - * TODO: It's probably an error if jsx->iq_id == NULL. g_return_if_fail - * might be warranted. - */ - if (jsx->iq_id && !jsx->accepted) { - JabberIq *iq; - xmlnode *error, *child; - iq = jabber_iq_new(js, JABBER_IQ_ERROR); - xmlnode_set_attrib(iq->node, "to", xfer->who); - jabber_iq_set_id(iq, jsx->iq_id); - - error = xmlnode_new_child(iq->node, "error"); - xmlnode_set_attrib(error, "type", "cancel"); - child = xmlnode_new_child(error, "forbidden"); - xmlnode_set_namespace(child, NS_XMPP_STANZAS); - child = xmlnode_new_child(error, "text"); - xmlnode_set_namespace(child, NS_XMPP_STANZAS); - xmlnode_insert_data(child, "Offer Declined", -1); - - jabber_iq_send(iq); - } - - jabber_si_xfer_free(xfer); - purple_debug_info("jabber", "in jabber_si_xfer_request_denied\n"); -} - - -static void jabber_si_xfer_cancel_recv(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - /* if there is an IBB session active, send close */ - if (jsx->ibb_session) { - jabber_ibb_session_close(jsx->ibb_session); - } - jabber_si_xfer_free(xfer); - purple_debug_info("jabber", "in jabber_si_xfer_cancel_recv\n"); -} - - -static void jabber_si_xfer_end(PurpleXfer *xfer) -{ - jabber_si_xfer_free(xfer); -} - - -static void jabber_si_xfer_send_disco_cb(JabberStream *js, const char *who, - JabberCapabilities capabilities, gpointer data) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - JabberSIXfer *jsx = (JabberSIXfer *) xfer->data; - - if (capabilities & JABBER_CAP_IBB) { - purple_debug_info("jabber", - "jabber_si_xfer_send_disco_cb: remote JID supports IBB\n"); - jsx->stream_method |= STREAM_METHOD_IBB; - } - - if (capabilities & JABBER_CAP_SI_FILE_XFER) { - jabber_si_xfer_send_request(xfer); - } else { - char *msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who); - purple_notify_error(js->gc, _("File Send Failed"), - _("File Send Failed"), msg); - g_free(msg); - purple_xfer_cancel_local(xfer); - } -} - -static void resource_select_cancel_cb(PurpleXfer *xfer, PurpleRequestFields *fields) -{ - purple_xfer_cancel_local(xfer); -} - -static void do_transfer_send(PurpleXfer *xfer, const char *resource) -{ - JabberSIXfer *jsx = xfer->data; - char **who_v = g_strsplit(xfer->who, "/", 2); - char *who; - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - - jb = jabber_buddy_find(jsx->js, who_v[0], FALSE); - if (jb) { - jbr = jabber_buddy_find_resource(jb, resource); - } - - who = g_strdup_printf("%s/%s", who_v[0], resource); - g_strfreev(who_v); - g_free(xfer->who); - xfer->who = who; - - if (jbr && jabber_resource_know_capabilities(jbr)) { - char *msg; - - if (jabber_resource_has_capability(jbr, NS_IBB)) - jsx->stream_method |= STREAM_METHOD_IBB; - if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/si/profile/file-transfer")) { - jabber_si_xfer_send_request(xfer); - return; - } - - msg = g_strdup_printf(_("Unable to send file to %s, user does not support file transfers"), who); - purple_notify_error(jsx->js->gc, _("File Send Failed"), - _("File Send Failed"), msg); - g_free(msg); - purple_xfer_cancel_local(xfer); - } else { - jabber_disco_info_do(jsx->js, who, - jabber_si_xfer_send_disco_cb, xfer); - } -} - -static void resource_select_ok_cb(PurpleXfer *xfer, PurpleRequestFields *fields) -{ - PurpleRequestField *field = purple_request_fields_get_field(fields, "resource"); - int selected_id = purple_request_field_choice_get_value(field); - GList *labels = purple_request_field_choice_get_labels(field); - - const char *selected_label = g_list_nth_data(labels, selected_id); - - do_transfer_send(xfer, selected_label); -} - -static void jabber_si_xfer_init(PurpleXfer *xfer) -{ - JabberSIXfer *jsx = xfer->data; - JabberIq *iq; - if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - JabberBuddy *jb; - JabberBuddyResource *jbr = NULL; - char *resource; - - if(NULL != (resource = jabber_get_resource(xfer->who))) { - /* they've specified a resource, no need to ask or - * default or anything, just do it */ - - do_transfer_send(xfer, resource); - g_free(resource); - return; - } - - jb = jabber_buddy_find(jsx->js, xfer->who, TRUE); - - if(!jb || !jb->resources) { - /* no resources online, we're trying to send to someone - * whose presence we're not subscribed to, or - * someone who is offline. Let's inform the user */ - char *msg; - - if(!jb) { - msg = g_strdup_printf(_("Unable to send file to %s, invalid JID"), xfer->who); - } else if(jb->subscription & JABBER_SUB_TO) { - msg = g_strdup_printf(_("Unable to send file to %s, user is not online"), xfer->who); - } else { - msg = g_strdup_printf(_("Unable to send file to %s, not subscribed to user presence"), xfer->who); - } - - purple_notify_error(jsx->js->gc, _("File Send Failed"), _("File Send Failed"), msg); - g_free(msg); - } else if(!jb->resources->next) { - /* only 1 resource online (probably our most common case) - * so no need to ask who to send to */ - jbr = jb->resources->data; - - do_transfer_send(xfer, jbr->name); - - } else { - /* we've got multiple resources, we need to pick one to send to */ - GList *l; - char *msg = g_strdup_printf(_("Please select the resource of %s to which you would like to send a file"), xfer->who); - PurpleRequestFields *fields = purple_request_fields_new(); - PurpleRequestField *field = purple_request_field_choice_new("resource", _("Resource"), 0); - PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL); - - for(l = jb->resources; l; l = l->next) - { - jbr = l->data; - - purple_request_field_choice_add(field, jbr->name); - } - - purple_request_field_group_add_field(group, field); - - purple_request_fields_add_group(fields, group); - - purple_request_fields(jsx->js->gc, _("Select a Resource"), msg, NULL, fields, - _("Send File"), G_CALLBACK(resource_select_ok_cb), _("Cancel"), G_CALLBACK(resource_select_cancel_cb), - jsx->js->gc->account, xfer->who, NULL, xfer); - - g_free(msg); - } - } else { - xmlnode *si, *feature, *x, *field, *value; - - iq = jabber_iq_new(jsx->js, JABBER_IQ_RESULT); - xmlnode_set_attrib(iq->node, "to", xfer->who); - if(jsx->iq_id) - jabber_iq_set_id(iq, jsx->iq_id); - else - purple_debug_error("jabber", "Sending SI result with new IQ id.\n"); - - jsx->accepted = TRUE; - - si = xmlnode_new_child(iq->node, "si"); - xmlnode_set_namespace(si, "http://jabber.org/protocol/si"); - - feature = xmlnode_new_child(si, "feature"); - xmlnode_set_namespace(feature, "http://jabber.org/protocol/feature-neg"); - - x = xmlnode_new_child(feature, "x"); - xmlnode_set_namespace(x, "jabber:x:data"); - xmlnode_set_attrib(x, "type", "submit"); - field = xmlnode_new_child(x, "field"); - xmlnode_set_attrib(field, "var", "stream-method"); - - /* we should maybe "remember" if bytestreams has failed before (in the - same session) with this JID, and only present IBB as an option to - avoid unnessesary timeout */ - /* maybe we should have an account option to always just try IBB - for people who know their firewalls are very restrictive */ - if (jsx->stream_method & STREAM_METHOD_BYTESTREAMS) { - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, NS_BYTESTREAMS, -1); - } else if(jsx->stream_method & STREAM_METHOD_IBB) { - value = xmlnode_new_child(field, "value"); - xmlnode_insert_data(value, NS_IBB, -1); - } - - jabber_iq_send(iq); - } -} - -PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who) -{ - JabberStream *js; - - PurpleXfer *xfer; - JabberSIXfer *jsx; - - js = gc->proto_data; - - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - if (xfer) - { - xfer->data = jsx = g_new0(JabberSIXfer, 1); - jsx->js = js; - jsx->local_streamhost_fd = -1; - - jsx->ibb_session = NULL; - - purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init); - purple_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send); - purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end); - - js->file_transfers = g_list_append(js->file_transfers, xfer); - } - - return xfer; -} - -void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file) -{ - JabberStream *js; - - PurpleXfer *xfer; - - js = gc->proto_data; - - xfer = jabber_si_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *si) -{ - JabberSIXfer *jsx; - PurpleXfer *xfer; - xmlnode *file, *feature, *x, *field, *option, *value; - const char *stream_id, *filename, *filesize_c, *profile; - size_t filesize = 0; - - if(!(profile = xmlnode_get_attrib(si, "profile")) || - strcmp(profile, "http://jabber.org/protocol/si/profile/file-transfer")) - return; - - if(!(stream_id = xmlnode_get_attrib(si, "id"))) - return; - - if(!(file = xmlnode_get_child(si, "file"))) - return; - - if(!(filename = xmlnode_get_attrib(file, "name"))) - return; - - if((filesize_c = xmlnode_get_attrib(file, "size"))) - filesize = atoi(filesize_c); - - if(!(feature = xmlnode_get_child(si, "feature"))) - return; - - if(!(x = xmlnode_get_child_with_namespace(feature, "x", "jabber:x:data"))) - return; - - if(!from) - return; - - /* if they've already sent us this file transfer with the same damn id - * then we're gonna ignore it, until I think of something better to do - * with it */ - if((xfer = jabber_si_xfer_find(js, stream_id, from))) - return; - - jsx = g_new0(JabberSIXfer, 1); - jsx->local_streamhost_fd = -1; - - jsx->ibb_session = NULL; - - for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { - const char *var = xmlnode_get_attrib(field, "var"); - if(var && !strcmp(var, "stream-method")) { - for(option = xmlnode_get_child(field, "option"); option; - option = xmlnode_get_next_twin(option)) { - if((value = xmlnode_get_child(option, "value"))) { - char *val; - if((val = xmlnode_get_data(value))) { - if(!strcmp(val, NS_BYTESTREAMS)) { - jsx->stream_method |= STREAM_METHOD_BYTESTREAMS; - } else if(!strcmp(val, NS_IBB)) { - jsx->stream_method |= STREAM_METHOD_IBB; - } - g_free(val); - } - } - } - } - } - - if(jsx->stream_method == STREAM_METHOD_UNKNOWN) { - g_free(jsx); - return; - } - - jsx->js = js; - jsx->stream_id = g_strdup(stream_id); - jsx->iq_id = g_strdup(id); - - xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from); - g_return_if_fail(xfer != NULL); - - xfer->data = jsx; - - purple_xfer_set_filename(xfer, filename); - if(filesize > 0) - purple_xfer_set_size(xfer, filesize); - - purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, jabber_si_xfer_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer, jabber_si_xfer_cancel_recv); - purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end); - - js->file_transfers = g_list_append(js->file_transfers, xfer); - - purple_xfer_request(xfer); -} - -void -jabber_si_init(void) -{ - jabber_iq_register_handler("si", "http://jabber.org/protocol/si", jabber_si_parse); - - jabber_ibb_register_open_handler(jabber_si_xfer_ibb_open_cb); -} - -void -jabber_si_uninit(void) -{ - jabber_ibb_unregister_open_handler(jabber_si_xfer_ibb_open_cb); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/si.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/** - * @file si.h SI transfer functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_SI_H_ -#define PURPLE_JABBER_SI_H_ - -#include "ft.h" - -#include "jabber.h" - -void jabber_bytestreams_parse(JabberStream *js, const char *from, - JabberIqType type, const char *id, xmlnode *query); -void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type, - const char *id, xmlnode *si); -PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who); -void jabber_si_xfer_send(PurpleConnection *gc, const char *who, const char *file); -void jabber_si_init(void); -void jabber_si_uninit(void); - -#endif /* PURPLE_JABBER_SI_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,396 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "useravatar.h" -#include "pep.h" -#include "debug.h" - -#define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) - -static void update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items); - -void jabber_avatar_init(void) -{ - jabber_add_feature(NS_AVATAR_1_1_METADATA, - jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_add_feature(NS_AVATAR_1_1_DATA, - jabber_pep_namespace_only_when_pep_enabled_cb); - - jabber_pep_register_handler(NS_AVATAR_1_1_METADATA, - update_buddy_metadata); -} - -static void -remove_avatar_0_12_nodes(JabberStream *js) -{ -#if 0 - /* See note below for why this is #if 0'd */ - - /* Publish an empty avatar according to the XEP-0084 v0.12 semantics */ - xmlnode *publish, *item, *metadata; - /* publish the metadata */ - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_0_12_METADATA); - - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", "stop"); - - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_0_12_METADATA); - - xmlnode_new_child(metadata, "stop"); - - /* publish */ - jabber_pep_publish(js, publish); -#endif - - /* - * This causes ejabberd 2.0.0 to kill the connection unceremoniously. - * See https://support.process-one.net/browse/EJAB-623. When adiumx.com - * was upgraded, the issue went away. - * - * I think it makes a lot of sense to not have an avatar at the old - * node instead of having something interpreted as "no avatar". When - * a contact with an older client logs in, in the latter situation, - * there's a race between interpreting the <presence/> vcard-temp:x:update - * avatar (non-empty) and the XEP-0084 v0.12 avatar (empty, so show no - * avatar for the buddy) which leads to unhappy and confused users. - * - * A deluge of frustrating "Read error" bug reports may change my mind - * about this. - * --darkrain42 - */ - jabber_pep_delete_node(js, NS_AVATAR_0_12_METADATA); - jabber_pep_delete_node(js, NS_AVATAR_0_12_DATA); -} - -void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img) -{ - xmlnode *publish, *metadata, *item; - - if (!js->pep) - return; - - /* Hmmm, not sure if this is worth the traffic, but meh */ - remove_avatar_0_12_nodes(js); - - if (!img) { - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); - - item = xmlnode_new_child(publish, "item"); - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); - - /* publish */ - jabber_pep_publish(js, publish); - } else { - /* - * TODO: This is pretty gross. The Jabber PRPL really shouldn't - * do voodoo to try to determine the image type, height - * and width. - */ - /* A PNG header, including the IHDR, but nothing else */ - const struct { - guchar signature[8]; /* must be hex 89 50 4E 47 0D 0A 1A 0A */ - struct { - guint32 length; /* must be 0x0d */ - guchar type[4]; /* must be 'I' 'H' 'D' 'R' */ - guint32 width; - guint32 height; - guchar bitdepth; - guchar colortype; - guchar compression; - guchar filter; - guchar interlace; - } ihdr; - } *png = purple_imgstore_get_data(img); /* ATTN: this is in network byte order! */ - - /* check if the data is a valid png file (well, at least to some extent) */ - if(png->signature[0] == 0x89 && - png->signature[1] == 0x50 && - png->signature[2] == 0x4e && - png->signature[3] == 0x47 && - png->signature[4] == 0x0d && - png->signature[5] == 0x0a && - png->signature[6] == 0x1a && - png->signature[7] == 0x0a && - ntohl(png->ihdr.length) == 0x0d && - png->ihdr.type[0] == 'I' && - png->ihdr.type[1] == 'H' && - png->ihdr.type[2] == 'D' && - png->ihdr.type[3] == 'R') { - /* parse PNG header to get the size of the image (yes, this is required) */ - guint32 width = ntohl(png->ihdr.width); - guint32 height = ntohl(png->ihdr.height); - xmlnode *data, *info; - char *lengthstring, *widthstring, *heightstring; - - /* compute the sha1 hash */ - char *hash = jabber_calculate_data_sha1sum(purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - char *base64avatar = purple_base64_encode(purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_DATA); - - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", hash); - - data = xmlnode_new_child(item, "data"); - xmlnode_set_namespace(data, NS_AVATAR_1_1_DATA); - - xmlnode_insert_data(data, base64avatar, -1); - /* publish the avatar itself */ - jabber_pep_publish(js, publish); - - g_free(base64avatar); - - lengthstring = g_strdup_printf("%" G_GSIZE_FORMAT, - purple_imgstore_get_size(img)); - widthstring = g_strdup_printf("%u", width); - heightstring = g_strdup_printf("%u", height); - - /* publish the metadata */ - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish, "node", NS_AVATAR_1_1_METADATA); - - item = xmlnode_new_child(publish, "item"); - xmlnode_set_attrib(item, "id", hash); - - metadata = xmlnode_new_child(item, "metadata"); - xmlnode_set_namespace(metadata, NS_AVATAR_1_1_METADATA); - - info = xmlnode_new_child(metadata, "info"); - xmlnode_set_attrib(info, "id", hash); - xmlnode_set_attrib(info, "type", "image/png"); - xmlnode_set_attrib(info, "bytes", lengthstring); - xmlnode_set_attrib(info, "width", widthstring); - xmlnode_set_attrib(info, "height", heightstring); - - jabber_pep_publish(js, publish); - - g_free(lengthstring); - g_free(widthstring); - g_free(heightstring); - g_free(hash); - } else { - purple_debug_error("jabber", "Cannot set PEP avatar to non-PNG data\n"); - } - } -} - -static void -do_got_own_avatar_0_12_cb(JabberStream *js, const char *from, xmlnode *items) -{ - if (items) - /* It wasn't an error (i.e. 'item-not-found') */ - remove_avatar_0_12_nodes(js); -} - -static void -do_got_own_avatar_cb(JabberStream *js, const char *from, xmlnode *items) -{ - xmlnode *item = NULL, *metadata = NULL, *info = NULL; - PurpleAccount *account = purple_connection_get_account(js->gc); - const char *server_hash = NULL; - - if (items && (item = xmlnode_get_child(items, "item")) && - (metadata = xmlnode_get_child(item, "metadata")) && - (info = xmlnode_get_child(metadata, "info"))) { - server_hash = xmlnode_get_attrib(info, "id"); - } - - /* - * If we have an avatar and the server returned an error/malformed data, - * push our avatar. If the server avatar doesn't match the local one, push - * our avatar. - */ - if ((!items || !metadata) || - !purple_strequal(server_hash, js->initial_avatar_hash)) { - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - jabber_avatar_set(js, img); - purple_imgstore_unref(img); - } -} - -void jabber_avatar_fetch_mine(JabberStream *js) -{ - char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - - if (js->initial_avatar_hash) { - jabber_pep_request_item(js, jid, NS_AVATAR_0_12_METADATA, NULL, - do_got_own_avatar_0_12_cb); - jabber_pep_request_item(js, jid, NS_AVATAR_1_1_METADATA, NULL, - do_got_own_avatar_cb); - } - - g_free(jid); -} - -typedef struct _JabberBuddyAvatarUpdateURLInfo { - JabberStream *js; - char *from; - char *id; -} JabberBuddyAvatarUpdateURLInfo; - -static void -do_buddy_avatar_update_fromurl(PurpleUtilFetchUrlData *url_data, - gpointer user_data, const gchar *url_text, - gsize len, const gchar *error_message) -{ - JabberBuddyAvatarUpdateURLInfo *info = user_data; - gpointer icon_data; - - if(!url_text) { - purple_debug_error("jabber", - "do_buddy_avatar_update_fromurl got error \"%s\"", - error_message); - goto out; - } - - icon_data = g_memdup(url_text, len); - purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, icon_data, len, info->id); - -out: - g_free(info->from); - g_free(info->id); - g_free(info); -} - -static void -do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) -{ - xmlnode *item, *data; - const char *checksum; - char *b64data; - void *img; - size_t size; - if(!items) - return; - - item = xmlnode_get_child(items, "item"); - if(!item) - return; - - data = xmlnode_get_child(item, "data"); - if(!data) - return; - - checksum = xmlnode_get_attrib(item,"id"); - if(!checksum) - return; - - b64data = xmlnode_get_data(data); - if(!b64data) - return; - - img = purple_base64_decode(b64data, &size); - if(!img) { - g_free(b64data); - return; - } - - purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum); - g_free(b64data); -} - -static void -update_buddy_metadata(JabberStream *js, const char *from, xmlnode *items) -{ - PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from); - const char *checksum; - xmlnode *item, *metadata; - if(!buddy) - return; - - if (!items) - return; - - item = xmlnode_get_child(items,"item"); - if (!item) - return; - - metadata = xmlnode_get_child(item, "metadata"); - if(!metadata) - return; - - checksum = purple_buddy_icons_get_checksum_for_user(buddy); - - /* <stop/> was the pre-v1.1 method of publishing an empty avatar */ - if(xmlnode_get_child(metadata, "stop")) { - purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); - } else { - xmlnode *info, *goodinfo = NULL; - gboolean has_children = FALSE; - - /* iterate over all info nodes to get one we can use */ - for(info = metadata->child; info; info = info->next) { - if(info->type == XMLNODE_TYPE_TAG) - has_children = TRUE; - if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { - const char *type = xmlnode_get_attrib(info,"type"); - const char *id = xmlnode_get_attrib(info,"id"); - - if(checksum && id && !strcmp(id, checksum)) { - /* we already have that avatar, so we don't have to do anything */ - goodinfo = NULL; - break; - } - /* We'll only pick the png one for now. It's a very nice image format anyways. */ - if(type && id && !goodinfo && !strcmp(type, "image/png")) - goodinfo = info; - } - } - if(has_children == FALSE) { - purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); - } else if(goodinfo) { - const char *url = xmlnode_get_attrib(goodinfo, "url"); - const char *id = xmlnode_get_attrib(goodinfo,"id"); - - /* the avatar might either be stored in a pep node, or on a HTTP(S) URL */ - if(!url) { - jabber_pep_request_item(js, from, NS_AVATAR_1_1_DATA, id, - do_buddy_avatar_update_data); - } else { - PurpleUtilFetchUrlData *url_data; - JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); - info->js = js; - - url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, - MAX_HTTP_BUDDYICON_BYTES, - do_buddy_avatar_update_fromurl, info); - if (url_data) { - info->from = g_strdup(from); - info->id = g_strdup(id); - js->url_datas = g_slist_prepend(js->url_datas, url_data); - } else - g_free(info); - - } - } - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/useravatar.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _PURPLE_JABBER_USERAVATAR_H_ -#define _PURPLE_JABBER_USERAVATAR_H_ - -#include "jabber.h" -#include "imgstore.h" - -/* Implementation of XEP-0084 */ - -void jabber_avatar_init(void); -void jabber_avatar_set(JabberStream *js, PurpleStoredImage *img); - -void jabber_avatar_fetch_mine(JabberStream *js); - -#endif /* _PURPLE_JABBER_USERAVATAR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "usermood.h" -#include "pep.h" -#include <string.h> -#include "internal.h" -#include "request.h" -#include "debug.h" - -static const char * const moodstrings[] = { - "afraid", - "amazed", - "amorous", - "angry", - "annoyed", - "anxious", - "aroused", - "ashamed", - "bored", - "brave", - "calm", - "cautious", - "cold", - "confident", - "confused", - "contemplative", - "contented", - "cranky", - "crazy", - "creative", - "curious", - "dejected", - "depressed", - "disappointed", - "disgusted", - "dismayed", - "distracted", - "embarrassed", - "envious", - "excited", - "flirtatious", - "frustrated", - "grumpy", - "guilty", - "happy", - "hopeful", - "hot", - "humbled", - "humiliated", - "hungry", - "hurt", - "impressed", - "in_awe", - "in_love", - "indignant", - "interested", - "intoxicated", - "invincible", - "jealous", - "lonely", - "lucky", - "mean", - "moody", - "nervous", - "neutral", - "offended", - "outraged", - "playful", - "proud", - "relaxed", - "relieved", - "remorseful", - "restless", - "sad", - "sarcastic", - "serious", - "shocked", - "shy", - "sick", - "sleepy", - "spontaneous", - "stressed", - "strong", - "surprised", - "thankful", - "thirsty", - "tired", - "weak", - "worried" -}; - -static void -jabber_mood_cb(JabberStream *js, const char *from, xmlnode *items) -{ - xmlnode *item; - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - const char *newmood = NULL; - char *moodtext = NULL; - xmlnode *child, *mood; - - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - item = xmlnode_get_child(items, "item"); - - /* ignore the mood of people not on our buddy list */ - if (!buddy || !item) - return; - - mood = xmlnode_get_child_with_namespace(item, "mood", "http://jabber.org/protocol/mood"); - if (!mood) - return; - for (child = mood->child; child; child = child->next) { - if (child->type != XMLNODE_TYPE_TAG) - continue; - - if (g_str_equal("text", child->name) && moodtext == NULL) - moodtext = xmlnode_get_data(child); - else { - int i; - for (i = 0; i < G_N_ELEMENTS(moodstrings); ++i) { - /* verify that the mood is known (valid) */ - if (g_str_equal(child->name, moodstrings[i])) { - newmood = moodstrings[i]; - break; - } - } - } - if (newmood != NULL && moodtext != NULL) - break; - } - if (newmood != NULL) { - PurpleAccount *account; - const char *status_id; - JabberBuddyResource *resource = jabber_buddy_find_resource(buddy, NULL); - if (!resource) { /* huh? */ - g_free(moodtext); - return; - } - status_id = jabber_buddy_state_get_status_id(resource->state); - - account = purple_connection_get_account(js->gc); - purple_prpl_got_user_status(account, from, status_id, "mood", - _(newmood), "moodtext", - moodtext ? moodtext : "", NULL); - } - g_free(moodtext); -} - -void jabber_mood_init(void) { - jabber_add_feature("http://jabber.org/protocol/mood", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/mood", jabber_mood_cb); -} - -static void do_mood_set_from_fields(PurpleConnection *gc, PurpleRequestFields *fields) { - JabberStream *js; - int selected_mood = purple_request_fields_get_choice(fields, "mood"); - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_debug_error("jabber", "Unable to set mood; account offline.\n"); - return; - } - - js = gc->proto_data; - - if (selected_mood < 0 || selected_mood >= G_N_ELEMENTS(moodstrings)) { - purple_debug_error("jabber", "Invalid mood index (%d) selected.\n", selected_mood); - return; - } - - jabber_mood_set(js, moodstrings[selected_mood], purple_request_fields_get_string(fields, "text")); -} - -static void do_mood_set_mood(PurplePluginAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - int i; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_choice_new("mood", - _("Mood"), 0); - - for(i = 0; i < G_N_ELEMENTS(moodstrings); ++i) - purple_request_field_choice_add(field, _(moodstrings[i])); - - purple_request_field_set_required(field, TRUE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("text", - _("Description"), NULL, - FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(gc, _("Edit User Mood"), - _("Edit User Mood"), - _("Please select your mood from the list."), - fields, - _("Set"), G_CALLBACK(do_mood_set_from_fields), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - -} - -void jabber_mood_init_action(GList **m) { - PurplePluginAction *act = purple_plugin_action_new(_("Set Mood..."), do_mood_set_mood); - *m = g_list_append(*m, act); -} - -void jabber_mood_set(JabberStream *js, const char *mood, const char *text) { - xmlnode *publish, *moodnode; - - g_return_if_fail(mood != NULL); - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/mood"); - moodnode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "mood"); - xmlnode_set_namespace(moodnode, "http://jabber.org/protocol/mood"); - xmlnode_new_child(moodnode, mood); - - if (text && text[0] != '\0') { - xmlnode *textnode = xmlnode_new_child(moodnode, "text"); - xmlnode_insert_data(textnode, text, -1); - } - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usermood.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERMOOD_H_ -#define PURPLE_JABBER_USERMOOD_H_ - -#include "jabber.h" - -/* Implementation of XEP-0107 */ - -void jabber_mood_init(void); - -void jabber_mood_init_action(GList **m); - -void jabber_mood_set(JabberStream *js, - const char *mood, /* must be one of the valid strings defined in the XEP */ - const char *text /* might be NULL */); - -#endif /* PURPLE_JABBER_USERMOOD_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "usernick.h" -#include "pep.h" -#include <string.h> -#include "internal.h" -#include "request.h" -#include "status.h" - -static void jabber_nick_cb(JabberStream *js, const char *from, xmlnode *items) { - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *nick; - char *nickname = NULL; - - /* ignore the nick of people not on our buddy list */ - if (!buddy || !item) - return; - - nick = xmlnode_get_child_with_namespace(item, "nick", "http://jabber.org/protocol/nick"); - if (!nick) - return; - nickname = xmlnode_get_data(nick); - serv_got_alias(js->gc, from, nickname); - g_free(nickname); -} - -static void do_nick_set(JabberStream *js, const char *nick) { - xmlnode *publish, *nicknode; - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/nick"); - nicknode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "nick"); - xmlnode_set_namespace(nicknode, "http://jabber.org/protocol/nick"); - - if(nick && nick[0] != '\0') - xmlnode_insert_data(nicknode, nick, -1); - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} - -static void do_nick_got_own_nick_cb(JabberStream *js, const char *from, xmlnode *items) { - char *oldnickname = NULL; - xmlnode *item = NULL; - - if (items) - item = xmlnode_get_child(items,"item"); - - if(item) { - xmlnode *nick = xmlnode_get_child_with_namespace(item,"nick","http://jabber.org/protocol/nick"); - if(nick) - oldnickname = xmlnode_get_data(nick); - } - - purple_request_input(js->gc, _("Set User Nickname"), _("Please specify a new nickname for you."), - _("This information is visible to all contacts on your contact list, so choose something appropriate."), - oldnickname, FALSE, FALSE, NULL, _("Set"), PURPLE_CALLBACK(do_nick_set), _("Cancel"), NULL, - purple_connection_get_account(js->gc), NULL, NULL, js); - g_free(oldnickname); -} - -static void do_nick_set_nick(PurplePluginAction *action) { - PurpleConnection *gc = (PurpleConnection *) action->context; - JabberStream *js = gc->proto_data; - char *jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain); - - /* since the nickname might have been changed by another resource of this account, we always have to request the old one - from the server to present as the default for the new one */ - jabber_pep_request_item(js, jid, "http://jabber.org/protocol/nick", NULL, do_nick_got_own_nick_cb); - g_free(jid); -} - -void jabber_nick_init(void) { - jabber_add_feature("http://jabber.org/protocol/nick", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/nick", jabber_nick_cb); -} - -void jabber_nick_init_action(GList **m) { - PurplePluginAction *act = purple_plugin_action_new(_("Set Nickname..."), do_nick_set_nick); - *m = g_list_append(*m, act); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usernick.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERNICK_H_ -#define PURPLE_JABBER_USERNICK_H_ - -#include "jabber.h" - -/* Implementation of XEP-0172 */ - -void jabber_nick_init(void); -void jabber_nick_init_action(GList **m); - -#endif /* PURPLE_JABBER_USERNICK_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "usertune.h" -#include "pep.h" -#include <string.h> -#include "internal.h" -#include "request.h" -#include "status.h" - -static void jabber_tune_cb(JabberStream *js, const char *from, xmlnode *items) { - /* it doesn't make sense to have more than one item here, so let's just pick the first one */ - xmlnode *item = xmlnode_get_child(items, "item"); - JabberBuddy *buddy = jabber_buddy_find(js, from, FALSE); - xmlnode *tuneinfo, *tune; - PurpleJabberTuneInfo tuneinfodata; - JabberBuddyResource *resource; - gboolean valid = FALSE; - - /* ignore the tune of people not on our buddy list */ - if (!buddy || !item) - return; - - tuneinfodata.artist = NULL; - tuneinfodata.title = NULL; - tuneinfodata.album = NULL; - tuneinfodata.track = NULL; - tuneinfodata.time = -1; - tuneinfodata.url = NULL; - - tune = xmlnode_get_child_with_namespace(item, "tune", "http://jabber.org/protocol/tune"); - if (!tune) - return; - resource = jabber_buddy_find_resource(buddy, NULL); - if(!resource) - return; /* huh? */ - for (tuneinfo = tune->child; tuneinfo; tuneinfo = tuneinfo->next) { - if (tuneinfo->type == XMLNODE_TYPE_TAG) { - if (!strcmp(tuneinfo->name, "artist")) { - if (tuneinfodata.artist == NULL) /* only pick the first one */ - tuneinfodata.artist = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "length")) { - if (tuneinfodata.time == -1) { - char *length = xmlnode_get_data(tuneinfo); - if (length) - tuneinfodata.time = strtol(length, NULL, 10); - g_free(length); - if (tuneinfodata.time > 0) - valid = TRUE; - } - } else if (!strcmp(tuneinfo->name, "source")) { - if (tuneinfodata.album == NULL) /* only pick the first one */ - tuneinfodata.album = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "title")) { - if (tuneinfodata.title == NULL) /* only pick the first one */ - tuneinfodata.title = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "track")) { - if (tuneinfodata.track == NULL) /* only pick the first one */ - tuneinfodata.track = xmlnode_get_data(tuneinfo); - valid = TRUE; - } else if (!strcmp(tuneinfo->name, "uri")) { - if (tuneinfodata.url == NULL) /* only pick the first one */ - tuneinfodata.url = xmlnode_get_data(tuneinfo); - valid = TRUE; - } - } - } - - if (valid) { - purple_prpl_got_user_status(js->gc->account, from, "tune", - PURPLE_TUNE_ARTIST, tuneinfodata.artist, - PURPLE_TUNE_TITLE, tuneinfodata.title, - PURPLE_TUNE_ALBUM, tuneinfodata.album, - PURPLE_TUNE_TRACK, tuneinfodata.track, - PURPLE_TUNE_TIME, tuneinfodata.time, - PURPLE_TUNE_URL, tuneinfodata.url, NULL); - } else { - purple_prpl_got_user_status_deactive(js->gc->account, from, "tune"); - } - - g_free(tuneinfodata.artist); - g_free(tuneinfodata.title); - g_free(tuneinfodata.album); - g_free(tuneinfodata.track); - g_free(tuneinfodata.url); -} - -void jabber_tune_init(void) { - jabber_add_feature("http://jabber.org/protocol/tune", jabber_pep_namespace_only_when_pep_enabled_cb); - jabber_pep_register_handler("http://jabber.org/protocol/tune", jabber_tune_cb); -} - -void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo) { - xmlnode *publish, *tunenode; - JabberStream *js = gc->proto_data; - - publish = xmlnode_new("publish"); - xmlnode_set_attrib(publish,"node","http://jabber.org/protocol/tune"); - tunenode = xmlnode_new_child(xmlnode_new_child(publish, "item"), "tune"); - xmlnode_set_namespace(tunenode, "http://jabber.org/protocol/tune"); - - if(tuneinfo) { - if(tuneinfo->artist && tuneinfo->artist[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "artist"),tuneinfo->artist,-1); - if(tuneinfo->title && tuneinfo->title[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "title"),tuneinfo->title,-1); - if(tuneinfo->album && tuneinfo->album[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "source"),tuneinfo->album,-1); - if(tuneinfo->url && tuneinfo->url[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1); - if(tuneinfo->time > 0) { - char *length = g_strdup_printf("%d", tuneinfo->time); - xmlnode_insert_data(xmlnode_new_child(tunenode, "length"),length,-1); - g_free(length); - } - if(tuneinfo->track && tuneinfo->track[0] != '\0') - xmlnode_insert_data(xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1); - } - - jabber_pep_publish(js, publish); - /* publish is freed by jabber_pep_publish -> jabber_iq_send -> jabber_iq_free - (yay for well-defined memory management rules) */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/usertune.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef PURPLE_JABBER_USERTUNE_H_ -#define PURPLE_JABBER_USERTUNE_H_ - -#include "jabber.h" - -/* Implementation of XEP-0118 */ - -typedef struct _PurpleJabberTuneInfo PurpleJabberTuneInfo; -struct _PurpleJabberTuneInfo { - char *artist; - char *title; - char *album; - char *track; /* either the index of the track in the album or the URL for a stream */ - int time; /* in seconds, -1 for unknown */ - char *url; -}; - -void jabber_tune_init(void); - -void jabber_tune_set(PurpleConnection *gc, const PurpleJabberTuneInfo *tuneinfo); - -#endif /* PURPLE_JABBER_USERTUNE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/posix.uname.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/posix.uname.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/posix.uname.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/posix.uname.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/* - posix.uname.c - version 1.1 - Copyright (C) 1999, 2000 - Earnie Boyd and assigns - - Fills the utsname structure with the appropriate values. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2.1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICUALR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. - */ - -/* - Send bug reports to Earnie Boyd <earnie_boyd@yahoo.com> - */ - -#include "utsname.h" -#include <string.h> -#include <stdio.h> - -/* ANONYMOUS unions and structs are used from the windows header definitions. - These need to be defined for them to work correctly with gcc2.95.2-mingw. */ -/*#define _ANONYMOUS_STRUCT*/ -/*#define _ANONYMOUS_UNION*/ -#include <windows.h> -#ifdef __MINGW32__ -#include <_mingw.h> -#endif - -int -jabber_win32_uname( struct utsname *uts ) -{ - DWORD sLength; - OSVERSIONINFO OS_version; - SYSTEM_INFO System_Info; - -/* XXX Should these be in the global runtime */ - enum WinOS {Win95, Win98, WinNT, unknown}; - int MingwOS; - - memset( uts, 0, sizeof ( *uts ) ); - OS_version.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); - - GetVersionEx ( &OS_version ); - GetSystemInfo ( &System_Info ); - - strcpy( uts->sysname, "WIN32_" ); - switch( OS_version.dwPlatformId ) - { - case VER_PLATFORM_WIN32_NT: - strcat( uts->sysname, "WinNT" ); - MingwOS = WinNT; - break; - case VER_PLATFORM_WIN32_WINDOWS: - switch ( OS_version.dwMinorVersion ) - { - case 0: - strcat( uts->sysname, "Win95" ); - MingwOS = Win95; - break; - case 10: - strcat( uts->sysname, "Win98" ); - MingwOS = Win98; - break; - default: - strcat( uts->sysname, "Win??" ); - MingwOS = unknown; - break; - } - break; - default: - strcat( uts->sysname, "Win??" ); - MingwOS = unknown; - break; - } - -#ifdef __MINGW32__ - sprintf( uts->version, "%i", __MINGW32_MAJOR_VERSION ); - sprintf( uts->release, "%i", __MINGW32_MINOR_VERSION ); -#endif - - switch( System_Info.wProcessorArchitecture ) - { - case PROCESSOR_ARCHITECTURE_PPC: - strcpy( uts->machine, "ppc" ); - break; - case PROCESSOR_ARCHITECTURE_ALPHA: - strcpy( uts->machine, "alpha" ); - break; - case PROCESSOR_ARCHITECTURE_MIPS: - strcpy( uts->machine, "mips" ); - break; - case PROCESSOR_ARCHITECTURE_INTEL: - /* dwProcessorType is only valid in Win95 and Win98 - wProcessorLevel is only valid in WinNT */ - switch( MingwOS ) - { - case Win95: - case Win98: - switch( System_Info.dwProcessorType ) - { - case PROCESSOR_INTEL_386: - case PROCESSOR_INTEL_486: - case PROCESSOR_INTEL_PENTIUM: - sprintf( uts->machine, "i%ld", System_Info.dwProcessorType ); - break; - default: - strcpy( uts->machine, "i386" ); - break; - } - break; - case WinNT: - sprintf( uts->machine, "i%d86", System_Info.wProcessorLevel ); - break; - default: - strcpy( uts->machine, "unknown" ); - break; - } - break; - default: - strcpy( uts->machine, "unknown" ); - break; - } - - sLength = sizeof ( uts->nodename ) - 1; - GetComputerNameA( uts->nodename, &sLength ); - return 1; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/utsname.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/utsname.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/utsname.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/win32/utsname.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct utsname -{ - char sysname[20]; - char nodename[20]; - char release[20]; - char version[20]; - char machine[20]; -}; - -int jabber_win32_uname (struct utsname *); -#define uname(utsname) jabber_win32_uname(utsname) - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,414 +0,0 @@ -/* - * purple - Jabber Protocol Plugin - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "request.h" -#include "server.h" - -#include "xdata.h" - -typedef enum { - JABBER_X_DATA_IGNORE = 0, - JABBER_X_DATA_TEXT_SINGLE, - JABBER_X_DATA_TEXT_MULTI, - JABBER_X_DATA_LIST_SINGLE, - JABBER_X_DATA_LIST_MULTI, - JABBER_X_DATA_BOOLEAN, - JABBER_X_DATA_JID_SINGLE -} jabber_x_data_field_type; - -struct jabber_x_data_data { - GHashTable *fields; - GSList *values; - jabber_x_data_action_cb cb; - gpointer user_data; - JabberStream *js; - GList *actions; - PurpleRequestFieldGroup *actiongroup; -}; - -static void jabber_x_data_ok_cb(struct jabber_x_data_data *data, PurpleRequestFields *fields) { - xmlnode *result = xmlnode_new("x"); - jabber_x_data_action_cb cb = data->cb; - gpointer user_data = data->user_data; - JabberStream *js = data->js; - GList *groups, *flds; - char *actionhandle = NULL; - gboolean hasActions = (data->actions != NULL); - - xmlnode_set_namespace(result, "jabber:x:data"); - xmlnode_set_attrib(result, "type", "submit"); - - for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { - if(groups->data == data->actiongroup) { - for(flds = purple_request_field_group_get_fields(groups->data); flds; flds = flds->next) { - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - int handleindex; - if(strcmp(id, "libpurple:jabber:xdata:actions")) - continue; - handleindex = purple_request_field_choice_get_value(field); - actionhandle = g_strdup(g_list_nth_data(data->actions, handleindex)); - break; - } - continue; - } - for(flds = purple_request_field_group_get_fields(groups->data); flds; flds = flds->next) { - xmlnode *fieldnode, *valuenode; - PurpleRequestField *field = flds->data; - const char *id = purple_request_field_get_id(field); - jabber_x_data_field_type type = GPOINTER_TO_INT(g_hash_table_lookup(data->fields, id)); - - switch(type) { - case JABBER_X_DATA_TEXT_SINGLE: - case JABBER_X_DATA_JID_SINGLE: - { - const char *value = purple_request_field_string_get_value(field); - if (value == NULL) - break; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - valuenode = xmlnode_new_child(fieldnode, "value"); - if(value) - xmlnode_insert_data(valuenode, value, -1); - break; - } - case JABBER_X_DATA_TEXT_MULTI: - { - char **pieces, **p; - const char *value = purple_request_field_string_get_value(field); - if (value == NULL) - break; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - - pieces = g_strsplit(value, "\n", -1); - for(p = pieces; *p != NULL; p++) { - valuenode = xmlnode_new_child(fieldnode, "value"); - xmlnode_insert_data(valuenode, *p, -1); - } - g_strfreev(pieces); - } - break; - case JABBER_X_DATA_LIST_SINGLE: - case JABBER_X_DATA_LIST_MULTI: - { - GList *selected = purple_request_field_list_get_selected(field); - char *value; - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - - while(selected) { - value = purple_request_field_list_get_data(field, selected->data); - valuenode = xmlnode_new_child(fieldnode, "value"); - if(value) - xmlnode_insert_data(valuenode, value, -1); - selected = selected->next; - } - } - break; - case JABBER_X_DATA_BOOLEAN: - fieldnode = xmlnode_new_child(result, "field"); - xmlnode_set_attrib(fieldnode, "var", id); - valuenode = xmlnode_new_child(fieldnode, "value"); - if(purple_request_field_bool_get_value(field)) - xmlnode_insert_data(valuenode, "1", -1); - else - xmlnode_insert_data(valuenode, "0", -1); - break; - case JABBER_X_DATA_IGNORE: - break; - } - } - } - - g_hash_table_destroy(data->fields); - while(data->values) { - g_free(data->values->data); - data->values = g_slist_delete_link(data->values, data->values); - } - if (data->actions) { - GList *action; - for(action = data->actions; action; action = g_list_next(action)) { - g_free(action->data); - } - g_list_free(data->actions); - } - g_free(data); - - if (hasActions) - cb(js, result, actionhandle, user_data); - else - ((jabber_x_data_cb)cb)(js, result, user_data); - - g_free(actionhandle); -} - -static void jabber_x_data_cancel_cb(struct jabber_x_data_data *data, PurpleRequestFields *fields) { - xmlnode *result = xmlnode_new("x"); - jabber_x_data_action_cb cb = data->cb; - gpointer user_data = data->user_data; - JabberStream *js = data->js; - gboolean hasActions = FALSE; - g_hash_table_destroy(data->fields); - while(data->values) { - g_free(data->values->data); - data->values = g_slist_delete_link(data->values, data->values); - } - if (data->actions) { - GList *action; - hasActions = TRUE; - for(action = data->actions; action; action = g_list_next(action)) { - g_free(action->data); - } - g_list_free(data->actions); - } - g_free(data); - - xmlnode_set_namespace(result, "jabber:x:data"); - xmlnode_set_attrib(result, "type", "cancel"); - - if (hasActions) - cb(js, result, NULL, user_data); - else - ((jabber_x_data_cb)cb)(js, result, user_data); -} - -void *jabber_x_data_request(JabberStream *js, xmlnode *packet, jabber_x_data_cb cb, gpointer user_data) -{ - return jabber_x_data_request_with_actions(js, packet, NULL, 0, (jabber_x_data_action_cb)cb, user_data); -} - -void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data) -{ - void *handle; - xmlnode *fn, *x; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field = NULL; - - char *title = NULL; - char *instructions = NULL; - - struct jabber_x_data_data *data = g_new0(struct jabber_x_data_data, 1); - - data->fields = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - data->user_data = user_data; - data->cb = cb; - data->js = js; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - for(fn = xmlnode_get_child(packet, "field"); fn; fn = xmlnode_get_next_twin(fn)) { - xmlnode *valuenode; - const char *type = xmlnode_get_attrib(fn, "type"); - const char *label = xmlnode_get_attrib(fn, "label"); - const char *var = xmlnode_get_attrib(fn, "var"); - char *value = NULL; - - if(!type) - type = "text-single"; - - if(!var && strcmp(type, "fixed")) - continue; - if(!label) - label = var; - - if(!strcmp(type, "text-private")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - field = purple_request_field_string_new(var, label, - value ? value : "", FALSE); - purple_request_field_string_set_masked(field, TRUE); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE)); - - g_free(value); - } else if(!strcmp(type, "text-multi") || !strcmp(type, "jid-multi")) { - GString *str = g_string_new(""); - - for(valuenode = xmlnode_get_child(fn, "value"); valuenode; - valuenode = xmlnode_get_next_twin(valuenode)) { - - if(!(value = xmlnode_get_data(valuenode))) - continue; - - g_string_append_printf(str, "%s\n", value); - g_free(value); - } - - field = purple_request_field_string_new(var, label, - str->str, TRUE); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_MULTI)); - - g_string_free(str, TRUE); - } else if(!strcmp(type, "list-single") || !strcmp(type, "list-multi")) { - xmlnode *optnode; - GList *selected = NULL; - - field = purple_request_field_list_new(var, label); - - if(!strcmp(type, "list-multi")) { - purple_request_field_list_set_multi_select(field, TRUE); - g_hash_table_replace(data->fields, g_strdup(var), - GINT_TO_POINTER(JABBER_X_DATA_LIST_MULTI)); - } else { - g_hash_table_replace(data->fields, g_strdup(var), - GINT_TO_POINTER(JABBER_X_DATA_LIST_SINGLE)); - } - - for(valuenode = xmlnode_get_child(fn, "value"); valuenode; - valuenode = xmlnode_get_next_twin(valuenode)) { - char *data = xmlnode_get_data(valuenode); - if (data != NULL) { - selected = g_list_prepend(selected, data); - } - } - - for(optnode = xmlnode_get_child(fn, "option"); optnode; - optnode = xmlnode_get_next_twin(optnode)) { - const char *lbl; - - if(!(valuenode = xmlnode_get_child(optnode, "value"))) - continue; - - if(!(value = xmlnode_get_data(valuenode))) - continue; - - if(!(lbl = xmlnode_get_attrib(optnode, "label"))) - lbl = value; - - data->values = g_slist_prepend(data->values, value); - - purple_request_field_list_add(field, lbl, value); - if(g_list_find_custom(selected, value, (GCompareFunc)strcmp)) - purple_request_field_list_add_selected(field, lbl); - } - purple_request_field_group_add_field(group, field); - - while(selected) { - g_free(selected->data); - selected = g_list_delete_link(selected, selected); - } - - } else if(!strcmp(type, "boolean")) { - gboolean def = FALSE; - - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - if(value && (!g_ascii_strcasecmp(value, "yes") || - !g_ascii_strcasecmp(value, "true") || !g_ascii_strcasecmp(value, "1"))) - def = TRUE; - - field = purple_request_field_bool_new(var, label, def); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_BOOLEAN)); - - g_free(value); - } else if(!strcmp(type, "fixed")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - if(value != NULL) { - field = purple_request_field_label_new("", value); - purple_request_field_group_add_field(group, field); - - g_free(value); - } - } else if(!strcmp(type, "hidden")) { - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - field = purple_request_field_string_new(var, "", value ? value : "", - FALSE); - purple_request_field_set_visible(field, FALSE); - purple_request_field_group_add_field(group, field); - - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE)); - - g_free(value); - } else { /* text-single, jid-single, and the default */ - if((valuenode = xmlnode_get_child(fn, "value"))) - value = xmlnode_get_data(valuenode); - - field = purple_request_field_string_new(var, label, - value ? value : "", FALSE); - purple_request_field_group_add_field(group, field); - - if(!strcmp(type, "jid-single")) { - purple_request_field_set_type_hint(field, "screenname"); - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_JID_SINGLE)); - } else { - g_hash_table_replace(data->fields, g_strdup(var), GINT_TO_POINTER(JABBER_X_DATA_TEXT_SINGLE)); - } - - g_free(value); - } - - if(field && xmlnode_get_child(fn, "required")) - purple_request_field_set_required(field,TRUE); - } - - if(actions != NULL) { - PurpleRequestField *actionfield; - GList *action; - data->actiongroup = group = purple_request_field_group_new(_("Actions")); - purple_request_fields_add_group(fields, group); - actionfield = purple_request_field_choice_new("libpurple:jabber:xdata:actions", _("Select an action"), defaultaction); - - for(action = actions; action; action = g_list_next(action)) { - JabberXDataAction *a = action->data; - - purple_request_field_choice_add(actionfield, a->name); - data->actions = g_list_append(data->actions, g_strdup(a->handle)); - } - purple_request_field_set_required(actionfield,TRUE); - purple_request_field_group_add_field(group, actionfield); - } - - if((x = xmlnode_get_child(packet, "title"))) - title = xmlnode_get_data(x); - - if((x = xmlnode_get_child(packet, "instructions"))) - instructions = xmlnode_get_data(x); - - handle = purple_request_fields(js->gc, title, title, instructions, fields, - _("OK"), G_CALLBACK(jabber_x_data_ok_cb), - _("Cancel"), G_CALLBACK(jabber_x_data_cancel_cb), - purple_connection_get_account(js->gc), /* XXX Do we have a who here? */ NULL, NULL, - data); - - g_free(title); - g_free(instructions); - - return handle; -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/jabber/xdata.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/** - * @file xdata.h utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef PURPLE_JABBER_XDATA_H_ -#define PURPLE_JABBER_XDATA_H_ - -#include "jabber.h" -#include "xmlnode.h" - -typedef struct _JabberXDataAction { - char *name; - char *handle; -} JabberXDataAction; - -typedef void (*jabber_x_data_cb)(JabberStream *js, xmlnode *result, gpointer user_data); -typedef void (*jabber_x_data_action_cb)(JabberStream *js, xmlnode *result, const char *actionhandle, gpointer user_data); -void *jabber_x_data_request(JabberStream *js, xmlnode *packet, jabber_x_data_cb cb, gpointer user_data); -void *jabber_x_data_request_with_actions(JabberStream *js, xmlnode *packet, GList *actions, int defaultaction, jabber_x_data_action_cb cb, gpointer user_data); - -#endif /* PURPLE_JABBER_XDATA_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -EXTRA_DIST = Makefile.mingw - -DIST_SUBDIRS = bonjour gg irc jabber msn msnp9 myspace mxit novell null oscar qq sametime silc silc10 simple yahoo zephyr - -SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,715 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = Makefile.mingw -DIST_SUBDIRS = bonjour gg irc jabber msn msnp9 myspace mxit novell null oscar qq sametime silc silc10 simple yahoo zephyr -SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-libtool \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -# Makefile.mingw -# -# Author: hermanator12002@yahoo.com -# Date 9/11/02 -# Description: Protocols Makefile for win32 (mingw) port of libpurple -# - -PIDGIN_TREE_TOP := ../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -SUBDIRS = gg irc jabber msn mxit novell null oscar qq sametime silc simple yahoo bonjour myspace - -.PHONY: all install clean - -all: - for subdir in $(SUBDIRS); do \ - $(MAKE) -C $$subdir -f $(MINGW_MAKEFILE) || exit 1; \ - done; - -install: all - for subdir in $(SUBDIRS); do \ - $(MAKE) -C $$subdir -f $(MINGW_MAKEFILE) install || exit 1; \ - done; - -clean: - for subdir in $(SUBDIRS); do \ - $(MAKE) -C $$subdir -f $(MINGW_MAKEFILE) clean || exit 1; \ - done; - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,384 +0,0 @@ -/** - * @file cmdproc.c MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "cmdproc.h" - -MsnCmdProc * -msn_cmdproc_new(MsnSession *session) -{ - MsnCmdProc *cmdproc; - - cmdproc = g_new0(MsnCmdProc, 1); - - cmdproc->session = session; - cmdproc->txqueue = g_queue_new(); - cmdproc->history = msn_history_new(); - - cmdproc->multiparts = g_hash_table_new_full(g_str_hash, g_str_equal, - NULL, (GDestroyNotify)msn_message_unref); - - return cmdproc; -} - -void -msn_cmdproc_destroy(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(cmdproc->txqueue); - - msn_history_destroy(cmdproc->history); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - g_hash_table_destroy(cmdproc->multiparts); - - g_free(cmdproc); -} - -void -msn_cmdproc_process_queue(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - g_queue_push_tail(cmdproc->txqueue, trans); -} - -static void -show_debug_cmd(MsnCmdProc *cmdproc, gboolean incoming, const char *command) -{ - MsnServConn *servconn; - const char *names[] = { "NS", "SB" }; - char *show; - char tmp; - size_t len; - - servconn = cmdproc->servconn; - len = strlen(command); - show = g_strdup(command); - - tmp = (incoming) ? 'S' : 'C'; - - if ((show[len - 1] == '\n') && (show[len - 2] == '\r')) - { - show[len - 2] = '\0'; - } - - purple_debug_misc("msn", "%c: %s %03d: %s\n", tmp, - names[servconn->type], servconn->num, show); - - g_free(show); -} - -void -msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnServConn *servconn; - char *data; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) { - /* TODO: Need to free trans */ - return; - } - - msn_history_add(cmdproc->history, trans); - - data = msn_transaction_to_string(trans); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - if (trans->callbacks == NULL) - trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds, - trans->command); - - if (trans->payload != NULL) - { - data = g_realloc(data, len + trans->payload_len); - memcpy(data + len, trans->payload, trans->payload_len); - len += trans->payload_len; - - /* - * We're done with trans->payload. Free it so that the memory - * doesn't sit around in cmdproc->history. - */ - g_free(trans->payload); - trans->payload = NULL; - trans->payload_len = 0; - } - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnServConn *servconn; - char *data; - char *params = NULL; - va_list arg; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - if (format != NULL) - { - va_start(arg, format); - params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - if (params != NULL) - data = g_strdup_printf("%s %s\r\n", command, params); - else - data = g_strdup_printf("%s\r\n", command); - - g_free(params); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - if (!cmdproc->servconn->connected) - return; - - trans = g_new0(MsnTransaction, 1); - - trans->cmdproc = cmdproc; - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload, - int payload_len) -{ - MsnCommand *last; - - g_return_if_fail(cmdproc != NULL); - - last = cmdproc->last_cmd; - last->payload = g_memdup(payload, payload_len); - last->payload_len = payload_len; - - if (last->payload_cb != NULL) - last->payload_cb(cmdproc, last, payload, payload_len); -} - -void -msn_cmdproc_process_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnMsgTypeCb cb; - const char *messageId = NULL; - - /* Multi-part messages */ - if ((messageId = msn_message_get_attr(msg, "Message-ID")) != NULL) { - const char *chunk_text = msn_message_get_attr(msg, "Chunks"); - guint chunk; - if (chunk_text != NULL) { - chunk = strtol(chunk_text, NULL, 10); - /* 1024 chunks of ~1300 bytes is ~1MB, which seems OK to prevent - some random client causing pidgin to hog a ton of memory. - Probably should figure out the maximum that the official client - actually supports, though. */ - if (chunk > 0 && chunk < 1024) { - msg->total_chunks = chunk; - msg->received_chunks = 1; - g_hash_table_insert(cmdproc->multiparts, (gpointer)messageId, msn_message_ref(msg)); - purple_debug_info("msn", "Received chunked message, messageId: '%s', total chunks: %d\n", - messageId, chunk); - } else { - purple_debug_error("msn", "MessageId '%s' has too many chunks: %d\n", messageId, chunk); - } - return; - } else { - chunk_text = msn_message_get_attr(msg, "Chunk"); - if (chunk_text != NULL) { - MsnMessage *first = g_hash_table_lookup(cmdproc->multiparts, messageId); - chunk = strtol(chunk_text, NULL, 10); - if (first == NULL) { - purple_debug_error("msn", - "Unable to find first chunk of messageId '%s' to correspond with chunk %d.\n", - messageId, chunk+1); - } else if (first->received_chunks == chunk) { - /* Chunk is from 1 to total-1 (doesn't count first one) */ - purple_debug_info("msn", "Received chunk %d of %d, messageId: '%s'\n", - chunk+1, first->total_chunks, messageId); - first->body = g_realloc(first->body, first->body_len + msg->body_len); - memcpy(first->body + first->body_len, msg->body, msg->body_len); - first->body_len += msg->body_len; - first->received_chunks++; - if (first->received_chunks != first->total_chunks) - return; - else - /* We're done! Send it along... The caller takes care of - freeing the old one. */ - msg = first; - } else { - /* TODO: Can you legitimately receive chunks out of order? */ - g_hash_table_remove(cmdproc->multiparts, messageId); - return; - } - } else { - purple_debug_error("msn", "Received MessageId '%s' with no chunk number!\n", messageId); - } - } - } - - if (msn_message_get_content_type(msg) == NULL) - { - purple_debug_misc("msn", "failed to find message content\n"); - return; - } - - cb = g_hash_table_lookup(cmdproc->cbs_table->msgs, - msn_message_get_content_type(msg)); - - if (cb != NULL) - cb(cmdproc, msg); - else - purple_debug_warning("msn", "Unhandled content-type '%s'\n", - msn_message_get_content_type(msg)); - - if (messageId != NULL) - g_hash_table_remove(cmdproc->multiparts, messageId); -} - -void -msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransCb cb = NULL; - MsnTransaction *trans = NULL; - - if (cmd->trId) - cmd->trans = trans = msn_history_find(cmdproc->history, cmd->trId); - - if (trans != NULL) - if (trans->timer) { - purple_timeout_remove(trans->timer); - trans->timer = 0; - } - - if (g_ascii_isdigit(cmd->command[0]) && trans != NULL) - { - MsnErrorCb error_cb; - int error; - - error = atoi(cmd->command); - - error_cb = trans->error_cb; - if (error_cb == NULL) - error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command); - - if (error_cb != NULL) - error_cb(cmdproc, trans, error); - else - msn_error_handle(cmdproc->session, error); - - return; - } - - cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command); - - if (cb == NULL && trans != NULL && trans->callbacks != NULL) - cb = g_hash_table_lookup(trans->callbacks, cmd->command); - - if (cb == NULL) - cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command); - - if (cb != NULL) - cb(cmdproc, cmd); - else - purple_debug_warning("msn", "Unhandled command '%s'\n", - cmd->command); - - if (trans != NULL && trans->pendent_cmd != NULL) - msn_transaction_unqueue_cmd(trans, cmdproc); -} - -void -msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command) -{ - show_debug_cmd(cmdproc, TRUE, command); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - cmdproc->last_cmd = msn_command_from_string(command); - - msn_cmdproc_process_cmd(cmdproc, cmdproc->last_cmd); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/cmdproc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/** - * @file cmdproc.h MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_CMDPROC_H -#define MSN_CMDPROC_H - -typedef struct _MsnCmdProc MsnCmdProc; - -#include "command.h" -#include "error.h" -#include "history.h" -#include "servconn.h" -#include "session.h" -#include "table.h" - -struct _MsnCmdProc -{ - MsnSession *session; - MsnServConn *servconn; - - GQueue *txqueue; - - MsnCommand *last_cmd; - - MsnTable *cbs_table; - - MsnHistory *history; - - GHashTable *multiparts; /**< Multi-part message ID's */ - - void *data; /**< Extra data, like the switchboard. */ -}; - -MsnCmdProc *msn_cmdproc_new(MsnSession *session); -void msn_cmdproc_destroy(MsnCmdProc *cmdproc); - -void msn_cmdproc_process_queue(MsnCmdProc *cmdproc); - -void msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); -void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, - MsnTransaction *trans); -void msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); -void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); - -void msn_cmdproc_process_msg(MsnCmdProc *cmdproc, - MsnMessage *msg); -void msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd); -void msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command); -void msn_cmdproc_process_payload(MsnCmdProc *cmdproc, - char *payload, int payload_len); - -#endif /* MSN_CMDPROC_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -/** - * @file command.c MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "command.h" - -static gboolean -is_num(const char *str) -{ - const char *c; - for (c = str; *c; c++) { - if (!(g_ascii_isdigit(*c))) - return FALSE; - } - - return TRUE; -} - -MsnCommand * -msn_command_from_string(const char *string) -{ - MsnCommand *cmd; - char *param_start; - - g_return_val_if_fail(string != NULL, NULL); - - cmd = g_new0(MsnCommand, 1); - cmd->command = g_strdup(string); - param_start = strchr(cmd->command, ' '); - - if (param_start) - { - *param_start++ = '\0'; - cmd->params = g_strsplit_set(param_start, " ", 0); - } - - if (cmd->params != NULL) - { - int c; - - for (c = 0; cmd->params[c] && cmd->params[c][0]; c++); - cmd->param_count = c; - - if (cmd->param_count) { - char *param = cmd->params[0]; - cmd->trId = is_num(param) ? atoi(param) : 0; - } else { - cmd->trId = 0; - } - } - else - { - cmd->trId = 0; - } - - msn_command_ref(cmd); - - return cmd; -} - -void -msn_command_destroy(MsnCommand *cmd) -{ - g_return_if_fail(cmd != NULL); - - if (cmd->ref_count > 0) - { - msn_command_unref(cmd); - return; - } - - if (cmd->payload != NULL) - g_free(cmd->payload); - - g_free(cmd->command); - g_strfreev(cmd->params); - g_free(cmd); -} - -MsnCommand * -msn_command_ref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - - cmd->ref_count++; - return cmd; -} - -MsnCommand * -msn_command_unref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - g_return_val_if_fail(cmd->ref_count > 0, NULL); - - cmd->ref_count--; - - if (cmd->ref_count == 0) - { - msn_command_destroy(cmd); - return NULL; - } - - return cmd; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/command.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/** - * @file command.h MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_COMMAND_H -#define MSN_COMMAND_H - -typedef struct _MsnCommand MsnCommand; - -#include "cmdproc.h" -#include "transaction.h" - -typedef void (*MsnPayloadCb)(MsnCmdProc *cmdproc, MsnCommand *cmd, - char *payload, size_t len); - -/** - * A received command. - */ -struct _MsnCommand -{ - unsigned int trId; - - char *command; - char **params; - int param_count; - - int ref_count; - - MsnTransaction *trans; - - char *payload; - size_t payload_len; - - MsnPayloadCb payload_cb; - void *payload_cbdata; -}; - -MsnCommand *msn_command_from_string(const char *string); -void msn_command_destroy(MsnCommand *cmd); -MsnCommand *msn_command_ref(MsnCommand *cmd); -MsnCommand *msn_command_unref(MsnCommand *cmd); - -#endif /* MSN_COMMAND_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1911 +0,0 @@ -/** - * @file contact.c - * get MSN contacts via SOAP request - * created by MaYuan<mayuan2006@gmail.com> - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "msn.h" -#include "contact.h" -#include "xmlnode.h" -#include "group.h" -#include "soap.h" -#include "nexus.h" - -const char *MsnSoapPartnerScenarioText[] = -{ - "Initial", - "ContactSave", - "MessengerPendingList", - "ContactMsgrAPI", - "BlockUnblock" -}; - -const char *MsnMemberRole[] = -{ - "Forward", - "Allow", - "Block", - "Reverse", - "Pending" -}; - -typedef struct { - MsnSession *session; - MsnSoapPartnerScenario which; -} GetContactListCbData; - -MsnCallbackState * -msn_callback_state_new(MsnSession *session) -{ - MsnCallbackState *state = g_new0(MsnCallbackState, 1); - - state->session = session; - - return state; -} - -MsnCallbackState * -msn_callback_state_dup(MsnCallbackState *state) -{ - MsnCallbackState *new_state = g_new0(MsnCallbackState, 1); - - new_state->session = state->session; - new_state->who = g_strdup(state->who); - new_state->uid = g_strdup(state->uid); - new_state->old_group_name = g_strdup(state->old_group_name); - new_state->new_group_name = g_strdup(state->new_group_name); - new_state->guid = g_strdup(state->guid); - /* The rest should be made new */ - - return new_state; -} - -void -msn_callback_state_free(MsnCallbackState *state) -{ - if (state == NULL) - return; - - g_free(state->who); - g_free(state->uid); - g_free(state->old_group_name); - g_free(state->new_group_name); - g_free(state->guid); - xmlnode_free(state->body); - - g_free(state); -} - -void -msn_callback_state_set_who(MsnCallbackState *state, const gchar *who) -{ - g_return_if_fail(state != NULL); - - g_free(state->who); - state->who = g_strdup(who); -} - -void -msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid) -{ - g_return_if_fail(state != NULL); - - g_free(state->uid); - state->uid = g_strdup(uid); -} - -void -msn_callback_state_set_old_group_name(MsnCallbackState *state, const gchar *old_group_name) -{ - g_return_if_fail(state != NULL); - - g_free(state->old_group_name); - state->old_group_name = g_strdup(old_group_name); -} - -void -msn_callback_state_set_new_group_name(MsnCallbackState *state, const gchar *new_group_name) -{ - g_return_if_fail(state != NULL); - - g_free(state->new_group_name); - state->new_group_name = g_strdup(new_group_name); -} - -void -msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid) -{ - g_return_if_fail(state != NULL); - - g_free(state->guid); - state->guid = g_strdup(guid); -} - - -void -msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id) -{ - g_return_if_fail(state != NULL); - - state->list_id = list_id; -} - -void -msn_callback_state_set_action(MsnCallbackState *state, MsnCallbackAction action) -{ - g_return_if_fail(state != NULL); - - state->action |= action; -} - -/*************************************************************** - * General SOAP handling - ***************************************************************/ - -static const char * -msn_contact_operation_str(MsnCallbackAction action) -{ - /* Make sure this is large enough when adding more */ - static char buf[BUF_LEN]; - buf[0] = '\0'; - - if (action & MSN_ADD_BUDDY) - strcat(buf, "Adding Buddy,"); - if (action & MSN_MOVE_BUDDY) - strcat(buf, "Moving Buddy,"); - if (action & MSN_ACCEPTED_BUDDY) - strcat(buf, "Accepted Buddy,"); - if (action & MSN_DENIED_BUDDY) - strcat(buf, "Denied Buddy,"); - if (action & MSN_ADD_GROUP) - strcat(buf, "Adding Group,"); - if (action & MSN_DEL_GROUP) - strcat(buf, "Deleting Group,"); - if (action & MSN_RENAME_GROUP) - strcat(buf, "Renaming Group,"); - if (action & MSN_UPDATE_INFO) - strcat(buf, "Updating Contact Info,"); - - return buf; -} - -static gboolean msn_contact_request(MsnCallbackState *state); - -static void -msn_contact_request_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - xmlnode *fault; - char *faultcode_str; - xmlnode *cachekey; - char *changed; - - if (resp == NULL) { - purple_debug_error("msn", - "Operation {%s} failed. No response received from server.\n", - msn_contact_operation_str(state->action)); - msn_session_set_error(state->session, MSN_ERROR_BAD_BLIST, NULL); - msn_callback_state_free(state); - return; - } - - /* Update CacheKey if necessary */ - cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKeyChanged"); - if (cachekey != NULL) { - changed = xmlnode_get_data(cachekey); - if (changed && !strcmp(changed, "true")) { - cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKey"); - g_free(state->session->abch_cachekey); - state->session->abch_cachekey = xmlnode_get_data(cachekey); - purple_debug_info("msn", "Updated CacheKey for %s to '%s'.\n", - purple_account_get_username(state->session->account), - state->session->abch_cachekey); - } - g_free(changed); - } - - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - - if (fault == NULL) { - /* No errors */ - if (state->cb) - state->cb(req, resp, data); - msn_callback_state_free(state); - return; - } - - faultcode_str = xmlnode_get_data(xmlnode_get_child(fault, "faultcode")); - - if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) { - purple_debug_info("msn", - "Contact Operation {%s} failed because of bad token." - " Updating token now and retrying operation.\n", - msn_contact_operation_str(state->action)); - /* Token has expired, so renew it, and try again later */ - msn_nexus_update_token(state->session->nexus, MSN_AUTH_CONTACTS, - (GSourceFunc)msn_contact_request, data); - } - else - { - if (state->cb) { - state->cb(req, resp, data); - } else { - /* We don't know how to respond to this faultcode, so log it */ - char *str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), str); - g_free(str); - } - msn_callback_state_free(state); - } - - g_free(faultcode_str); -} - -static gboolean -msn_contact_request(MsnCallbackState *state) -{ - xmlnode *cachekey = xmlnode_get_child(state->body, - "Header/ABApplicationHeader/CacheKey"); - if (cachekey != NULL) - xmlnode_free(cachekey); - if (state->session->abch_cachekey != NULL) { - cachekey = xmlnode_new_child(xmlnode_get_child(state->body, "Header/ABApplicationHeader"), "CacheKey"); - xmlnode_insert_data(cachekey, state->session->abch_cachekey, -1); - } - if (state->token == NULL) - state->token = xmlnode_get_child(state->body, - "Header/ABAuthHeader/TicketToken"); - /* delete old & replace with new token */ - xmlnode_free(state->token->child); - xmlnode_insert_data(state->token, - msn_nexus_get_token_str(state->session->nexus, MSN_AUTH_CONTACTS), -1); - msn_soap_message_send(state->session, - msn_soap_message_new(state->post_action, xmlnode_copy(state->body)), - MSN_CONTACT_SERVER, state->post_url, FALSE, - msn_contact_request_cb, state); - return FALSE; -} - -/*************************************************************** - * Address Book and Membership List Operations - ***************************************************************/ - -/*get MSN member role utility*/ -static MsnListId -msn_get_memberrole(const char *role) -{ - g_return_val_if_fail(role != NULL, 0); - - if (!strcmp(role,"Allow")) { - return MSN_LIST_AL; - } else if (!strcmp(role,"Block")) { - return MSN_LIST_BL; - } else if (!strcmp(role,"Reverse")) { - return MSN_LIST_RL; - } else if (!strcmp(role,"Pending")) { - return MSN_LIST_PL; - } - return 0; -} - -/* Create the AddressBook in the server, if we don't have one */ -static void -msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnCallbackState *state = data; - if (resp && xmlnode_get_child(resp->xml, "Body/Fault") == NULL) { - purple_debug_info("msn", "Address Book successfully created!\n"); - msn_get_address_book(state->session, MSN_PS_INITIAL, NULL, NULL); - } else { - purple_debug_info("msn", "Address Book creation failed!\n"); - } -} - -static void -msn_create_address_book(MsnSession *session) -{ - gchar *body; - MsnCallbackState *state; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->user != NULL); - g_return_if_fail(session->user->passport != NULL); - - purple_debug_info("msn", "Creating an Address Book.\n"); - - body = g_strdup_printf(MSN_ADD_ADDRESSBOOK_TEMPLATE, - session->user->passport); - - state = msn_callback_state_new(session); - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_ADD_ADDRESSBOOK_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_create_address_cb; - msn_contact_request(state); - - g_free(body); -} - -static void -msn_parse_each_member(MsnSession *session, xmlnode *member, const char *node, - MsnListId list) -{ - char *passport; - char *type; - char *member_id; - MsnUser *user; - xmlnode *annotation, *display; - guint nid = MSN_NETWORK_UNKNOWN; - char *invite = NULL; - char *display_text; - - passport = xmlnode_get_data(xmlnode_get_child(member, node)); - if (!msn_email_is_valid(passport)) { - g_free(passport); - return; - } - - type = xmlnode_get_data(xmlnode_get_child(member, "Type")); - member_id = xmlnode_get_data(xmlnode_get_child(member, "MembershipId")); - if ((display = xmlnode_get_child(member, "DisplayName"))) { - display_text = xmlnode_get_data(display); - } else { - display_text = NULL; - } - - user = msn_userlist_find_add_user(session->userlist, passport, display_text); - - for (annotation = xmlnode_get_child(member, "Annotations/Annotation"); - annotation; - annotation = xmlnode_get_next_twin(annotation)) { - char *name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); - char *value = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); - if (name && value) { - if (!strcmp(name, "MSN.IM.BuddyType")) { - nid = strtoul(value, NULL, 10); - } - else if (!strcmp(name, "MSN.IM.InviteMessage")) { - invite = value; - value = NULL; - } - } - g_free(name); - g_free(value); - } - - /* For EmailMembers, the network must be found in the annotations, above. - Otherwise, PassportMembers are on the Passport network. */ - if (!strcmp(node, "PassportName")) - nid = MSN_NETWORK_PASSPORT; - - purple_debug_info("msn", "CL: %s name: %s, Type: %s, MembershipID: %s, NetworkID: %u\n", - node, passport, type, member_id == NULL ? "(null)" : member_id, nid); - - msn_user_set_network(user, nid); - msn_user_set_invite_message(user, invite); - - if (list == MSN_LIST_PL && member_id) { - user->member_id_on_pending_list = atoi(member_id); - } - - msn_got_lst_user(session, user, 1 << list, NULL); - - g_free(passport); - g_free(type); - g_free(member_id); - g_free(invite); - g_free(display_text); -} - -static void -msn_parse_each_service(MsnSession *session, xmlnode *service) -{ - xmlnode *type; - - if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) { - char *type_str = xmlnode_get_data(type); - - if (g_str_equal(type_str, "Profile")) { - /* Process Windows Live 'Messenger Roaming Identity' */ - } else if (g_str_equal(type_str, "Messenger")) { - xmlnode *lastchange = xmlnode_get_child(service, "LastChange"); - char *lastchange_str = xmlnode_get_data(lastchange); - xmlnode *membership; - - purple_debug_info("msn", "CL last change: %s\n", lastchange_str); - purple_account_set_string(session->account, "CLLastChange", - lastchange_str); - - for (membership = xmlnode_get_child(service, - "Memberships/Membership"); - membership; membership = xmlnode_get_next_twin(membership)) { - - xmlnode *role = xmlnode_get_child(membership, "MemberRole"); - char *role_str = xmlnode_get_data(role); - MsnListId list = msn_get_memberrole(role_str); - xmlnode *member; - - purple_debug_info("msn", "CL MemberRole role: %s, list: %d\n", - role_str, list); - - for (member = xmlnode_get_child(membership, "Members/Member"); - member; member = xmlnode_get_next_twin(member)) { - const char *member_type = xmlnode_get_attrib(member, "type"); - if (g_str_equal(member_type, "PassportMember")) { - msn_parse_each_member(session, member, "PassportName", - list); - } else if (g_str_equal(member_type, "PhoneMember")) { - - } else if (g_str_equal(member_type, "EmailMember")) { - msn_parse_each_member(session, member, "Email", list); - } - } - - g_free(role_str); - } - - g_free(lastchange_str); - } - - g_free(type_str); - } -} - -/*parse contact list*/ -static void -msn_parse_contact_list(MsnSession *session, xmlnode *node) -{ - xmlnode *fault, *faultnode; - - /* we may get a response if our cache data is too old: - * - * <faultstring>Need to do full sync. Can't sync deltas Client - * has too old a copy for us to do a delta sync</faultstring> - * - * this is not handled yet - */ - if ((fault = xmlnode_get_child(node, "Body/Fault"))) { - if ((faultnode = xmlnode_get_child(fault, "faultstring"))) { - char *faultstring = xmlnode_get_data(faultnode); - purple_debug_info("msn", "Retrieving contact list failed: %s\n", - faultstring); - g_free(faultstring); - } - if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { - char *errorcode = xmlnode_get_data(faultnode); - - if (g_str_equal(errorcode, "ABDoesNotExist")) { - msn_create_address_book(session); - g_free(errorcode); - return; - } - - g_free(errorcode); - } - - msn_get_contact_list(session, MSN_PS_INITIAL, NULL); - } else { - xmlnode *service; - - for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/" - "FindMembershipResult/Services/Service"); - service; service = xmlnode_get_next_twin(service)) { - msn_parse_each_service(session, service); - } - } -} - -static void -msn_get_contact_list_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - - g_return_if_fail(session != NULL); - - if (resp != NULL) { - const char *abLastChange; - const char *dynamicItemLastChange; - - purple_debug_misc("msn", "Got the contact list!\n"); - - msn_parse_contact_list(session, resp->xml); - abLastChange = purple_account_get_string(session->account, - "ablastChange", NULL); - dynamicItemLastChange = purple_account_get_string(session->account, - "dynamicItemLastChange", NULL); - - if (state->partner_scenario == MSN_PS_INITIAL) { -#ifdef MSN_PARTIAL_LISTS - /* XXX: this should be enabled when we can correctly do partial - syncs with the server. Currently we need to retrieve the whole - list to detect sync issues */ - msn_get_address_book(session, MSN_PS_INITIAL, abLastChange, dynamicItemLastChange); -#else - msn_get_address_book(session, MSN_PS_INITIAL, NULL, NULL); -#endif - } - } -} - -/*SOAP get contact list*/ -void -msn_get_contact_list(MsnSession *session, - const MsnSoapPartnerScenario partner_scenario, const char *update_time) -{ - gchar *body = NULL; - gchar *update_str = NULL; - MsnCallbackState *state; - const gchar *partner_scenario_str = MsnSoapPartnerScenarioText[partner_scenario]; - - purple_debug_misc("msn", "Getting Contact List.\n"); - - if (update_time != NULL) { - purple_debug_info("msn", "CL Last update time: %s\n", update_time); - update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML, update_time); - } - - body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, - update_str ? update_str : ""); - - state = msn_callback_state_new(session); - state->partner_scenario = partner_scenario; - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GET_CONTACT_SOAP_ACTION; - state->post_url = MSN_GET_CONTACT_POST_URL; - state->cb = msn_get_contact_list_cb; - msn_contact_request(state); - - g_free(update_str); - g_free(body); -} - -static void -msn_parse_addressbook_groups(MsnSession *session, xmlnode *node) -{ - xmlnode *group; - - purple_debug_info("msn", "msn_parse_addressbook_groups()\n"); - - for(group = xmlnode_get_child(node, "Group"); group; - group = xmlnode_get_next_twin(group)){ - xmlnode *groupId, *groupInfo, *groupname; - char *group_id = NULL, *group_name = NULL; - - if ((groupId = xmlnode_get_child(group, "groupId"))) - group_id = xmlnode_get_data(groupId); - if ((groupInfo = xmlnode_get_child(group, "groupInfo")) && (groupname = xmlnode_get_child(groupInfo, "name"))) - group_name = xmlnode_get_data(groupname); - - if (group_id == NULL) { - /* Group of ungroupped buddies */ - g_free(group_name); - continue; - } - - msn_group_new(session->userlist, group_id, group_name); - - purple_debug_info("msn", "AB group_id: %s, name: %s\n", group_id, group_name ? group_name : "(null)"); - if ((purple_find_group(group_name)) == NULL) { - PurpleGroup *g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - } - g_free(group_id); - g_free(group_name); - } -} - -static gboolean -msn_parse_addressbook_mobile(xmlnode *contactInfo, char **inout_mobile_number) -{ - xmlnode *phones; - char *mobile_number = NULL; - gboolean mobile = FALSE; - - *inout_mobile_number = NULL; - - if ((phones = xmlnode_get_child(contactInfo, "phones"))) { - xmlnode *contact_phone; - char *phone_type = NULL; - - for (contact_phone = xmlnode_get_child(phones, "ContactPhone"); - contact_phone; - contact_phone = xmlnode_get_next_twin(contact_phone)) { - xmlnode *contact_phone_type; - - if (!(contact_phone_type = - xmlnode_get_child(contact_phone, "contactPhoneType"))) - continue; - - phone_type = xmlnode_get_data(contact_phone_type); - - if (phone_type && !strcmp(phone_type, "ContactPhoneMobile")) { - xmlnode *number; - - if ((number = xmlnode_get_child(contact_phone, "number"))) { - xmlnode *messenger_enabled; - char *is_messenger_enabled = NULL; - - g_free(mobile_number); - mobile_number = xmlnode_get_data(number); - - if (mobile_number && - (messenger_enabled = xmlnode_get_child(contact_phone, "isMessengerEnabled")) - && (is_messenger_enabled = xmlnode_get_data(messenger_enabled)) - && !strcmp(is_messenger_enabled, "true")) - mobile = TRUE; - - g_free(is_messenger_enabled); - } - } - - g_free(phone_type); - } - } - - *inout_mobile_number = mobile_number; - return mobile; -} - -static void -msn_parse_addressbook_contacts(MsnSession *session, xmlnode *node) -{ - xmlnode *contactNode; - char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL, *mobile_number = NULL, *alias = NULL; - gboolean mobile = FALSE; - PurpleConnection *pc = purple_account_get_connection(session->account); - - for(contactNode = xmlnode_get_child(node, "Contact"); contactNode; - contactNode = xmlnode_get_next_twin(contactNode)) { - xmlnode *contactId, *contactInfo, *contactType, *passportName, *displayName, *guid, *groupIds; - xmlnode *annotation; - MsnUser *user; - - if (!(contactId = xmlnode_get_child(contactNode,"contactId")) - || !(contactInfo = xmlnode_get_child(contactNode, "contactInfo")) - || !(contactType = xmlnode_get_child(contactInfo, "contactType"))) - continue; - - g_free(passport); - g_free(Name); - g_free(alias); - g_free(uid); - g_free(type); - g_free(mobile_number); - passport = Name = uid = type = mobile_number = alias = NULL; - mobile = FALSE; - - uid = xmlnode_get_data(contactId); - type = xmlnode_get_data(contactType); - - /*setup the Display Name*/ - if (type && !strcmp(type, "Me")) { - if (purple_connection_get_display_name(pc) == NULL) { - char *friendly = NULL; - if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) - friendly = xmlnode_get_data(displayName); - purple_connection_set_display_name(pc, - friendly ? purple_url_decode(friendly) : NULL); - g_free(friendly); - } - continue; /* Not adding own account as buddy to buddylist */ - } - - passportName = xmlnode_get_child(contactInfo, "passportName"); - if (passportName == NULL) { - xmlnode *emailsNode, *contactEmailNode, *emailNode; - xmlnode *messengerEnabledNode; - char *msnEnabled; - - /*TODO: add it to the non-instant Messenger group and recognize as email Membership*/ - /* Yahoo/Federated User? */ - emailsNode = xmlnode_get_child(contactInfo, "emails"); - if (emailsNode == NULL) { - /*TODO: need to support the Mobile type*/ - continue; - } - for (contactEmailNode = xmlnode_get_child(emailsNode, "ContactEmail"); - contactEmailNode; - contactEmailNode = xmlnode_get_next_twin(contactEmailNode)) { - if ((messengerEnabledNode = xmlnode_get_child(contactEmailNode, "isMessengerEnabled"))) { - - msnEnabled = xmlnode_get_data(messengerEnabledNode); - - if (msnEnabled && !strcmp(msnEnabled, "true")) { - if ((emailNode = xmlnode_get_child(contactEmailNode, "email"))) - passport = xmlnode_get_data(emailNode); - - /* Messenger enabled, Get the Passport*/ - purple_debug_info("msn", "AB Yahoo/Federated User %s\n", passport ? passport : "(null)"); - g_free(msnEnabled); - break; - } - - g_free(msnEnabled); - } - } - } else { - xmlnode *messenger_user; - /* ignore non-messenger contacts */ - if ((messenger_user = xmlnode_get_child(contactInfo, "isMessengerUser"))) { - char *is_messenger_user = xmlnode_get_data(messenger_user); - - if (is_messenger_user && !strcmp(is_messenger_user, "false")) { - g_free(is_messenger_user); - continue; - } - - g_free(is_messenger_user); - } - - passport = xmlnode_get_data(passportName); - } - - /* Couldn't find anything */ - if (passport == NULL) - continue; - - if (!msn_email_is_valid(passport)) - continue; - - if ((displayName = xmlnode_get_child(contactInfo, "displayName"))) - Name = xmlnode_get_data(displayName); - else - Name = g_strdup(passport); - - for (annotation = xmlnode_get_child(contactInfo, "annotations/Annotation"); - annotation; annotation = xmlnode_get_next_twin(annotation)) { - char *name; - name = xmlnode_get_data(xmlnode_get_child(annotation, "Name")); - if (!strcmp(name, "AB.NickName")) - alias = xmlnode_get_data(xmlnode_get_child(annotation, "Value")); - else if (!strcmp(name, "MSN.IM.HasSharedFolder")) - ; /* Do nothing yet... */ - else if (!strcmp(name, "AB.Spouse")) - ; /* Do nothing yet... */ - else if (!strcmp(name, "MSN.Mobile.ContactId")) - ; /* Do nothing yet... */ - else - purple_debug_info("msn", - "Unknown AB contact annotation: %s\n", name); - g_free(name); - } - - mobile = msn_parse_addressbook_mobile(contactInfo, &mobile_number); - - purple_debug_misc("msn", "AB passport:{%s} uid:{%s} display:{%s} alias: {%s} mobile:{%s} mobile number:{%s}\n", - passport, uid ? uid : "(null)", Name ? Name : "(null)", alias ? alias : "(null)", - mobile ? "true" : "false", mobile_number ? mobile_number : "(null)"); - - user = msn_userlist_find_add_user(session->userlist, passport, Name); - msn_user_set_uid(user, uid); - msn_user_set_mobile_phone(user, mobile_number); - - groupIds = xmlnode_get_child(contactInfo, "groupIds"); - if (groupIds) { - for (guid = xmlnode_get_child(groupIds, "guid"); guid; - guid = xmlnode_get_next_twin(guid)) { - char *group_id = xmlnode_get_data(guid); - msn_user_add_group_id(user, group_id); - purple_debug_misc("msn", "AB guid:%s\n", group_id ? group_id : "(null)"); - g_free(group_id); - } - } else { - purple_debug_info("msn", "User not in any groups, adding to default group.\n"); - /*not in any group,Then set default group*/ - msn_user_add_group_id(user, MSN_INDIVIDUALS_GROUP_ID); - } - - msn_got_lst_user(session, user, MSN_LIST_FL_OP, NULL); - - if (mobile && user) - { - user->mobile = TRUE; - purple_prpl_got_user_status(session->account, user->passport, "mobile", NULL); - purple_prpl_got_user_status(session->account, user->passport, "available", NULL); - } - if (alias) - purple_serv_got_private_alias(pc, passport, alias); - } - - g_free(passport); - g_free(Name); - g_free(uid); - g_free(type); - g_free(mobile_number); -} - -static gboolean -msn_parse_addressbook(MsnSession *session, xmlnode *node) -{ - xmlnode *result; - xmlnode *groups; - xmlnode *contacts; - xmlnode *abNode; - xmlnode *fault; - - if ((fault = xmlnode_get_child(node, "Body/Fault"))) { - xmlnode *faultnode; - - if ((faultnode = xmlnode_get_child(fault, "faultstring"))) { - gchar *faultstring = xmlnode_get_data(faultnode); - purple_debug_info("msn", "AB Faultstring: %s\n", faultstring); - g_free(faultstring); - } - - if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) { - gchar *errorcode = xmlnode_get_data(faultnode); - - purple_debug_info("msn", "AB Error Code: %s\n", errorcode); - - if (g_str_equal(errorcode, "ABDoesNotExist")) { - g_free(errorcode); - return TRUE; - } - g_free(errorcode); - } - - return FALSE; - } - - result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult"); - if (result == NULL) { - purple_debug_misc("msn", "Received no address book update\n"); - return TRUE; - } - - /* I don't see this "groups" tag documented on msnpiki, need to find out - if they are really there, and update msnpiki */ - /*Process Group List*/ - groups = xmlnode_get_child(result, "groups"); - if (groups != NULL) { - msn_parse_addressbook_groups(session, groups); - } - - /*add a default No group to set up the no group Membership*/ - msn_group_new(session->userlist, MSN_INDIVIDUALS_GROUP_ID, - MSN_INDIVIDUALS_GROUP_NAME); - purple_debug_misc("msn", "AB group_id:%s name:%s\n", - MSN_INDIVIDUALS_GROUP_ID, MSN_INDIVIDUALS_GROUP_NAME); - if ((purple_find_group(MSN_INDIVIDUALS_GROUP_NAME)) == NULL){ - PurpleGroup *g = purple_group_new(MSN_INDIVIDUALS_GROUP_NAME); - purple_blist_add_group(g, NULL); - } - - /*add a default No group to set up the no group Membership*/ - msn_group_new(session->userlist, MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); - purple_debug_misc("msn", "AB group_id:%s name:%s\n", MSN_NON_IM_GROUP_ID, MSN_NON_IM_GROUP_NAME); - if ((purple_find_group(MSN_NON_IM_GROUP_NAME)) == NULL) { - PurpleGroup *g = purple_group_new(MSN_NON_IM_GROUP_NAME); - purple_blist_add_group(g, NULL); - } - - /*Process contact List*/ - purple_debug_info("msn", "Process contact list...\n"); - contacts = xmlnode_get_child(result, "contacts"); - if (contacts != NULL) { - msn_parse_addressbook_contacts(session, contacts); - } - - abNode = xmlnode_get_child(result, "ab"); - if (abNode != NULL) { - xmlnode *node2; - char *tmp = NULL; - - if ((node2 = xmlnode_get_child(abNode, "lastChange"))) - tmp = xmlnode_get_data(node2); - purple_debug_info("msn", "AB lastchanged Time:{%s}\n", tmp ? tmp : "(null)"); - purple_account_set_string(session->account, "ablastChange", tmp); - - g_free(tmp); tmp = NULL; - if ((node2 = xmlnode_get_child(abNode, "DynamicItemLastChanged"))) - tmp = xmlnode_get_data(node2); - purple_debug_info("msn", "AB DynamicItemLastChanged :{%s}\n", tmp ? tmp : "(null)"); - purple_account_set_string(session->account, "DynamicItemLastChanged", tmp); - g_free(tmp); - } - - return TRUE; -} - -static void -msn_get_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - - g_return_if_fail(session != NULL); - - purple_debug_misc("msn", "Got the Address Book!\n"); - - if (msn_parse_addressbook(session, resp->xml)) { - msn_send_privacy(session->account->gc); - msn_notification_dump_contact(session); - } else { - /* This is making us loop infinitely when we fail to parse the - address book, disable for now (we should re-enable when we - send timestamps) - */ - /* - msn_get_address_book(session, NULL, NULL); - */ - msn_session_set_error(session, MSN_ERROR_BAD_BLIST, NULL); - } -} - -/*get the address book*/ -void -msn_get_address_book(MsnSession *session, - MsnSoapPartnerScenario partner_scenario, const char *LastChanged, - const char *dynamicItemLastChange) -{ - char *body, *update_str = NULL; - MsnCallbackState *state; - - purple_debug_misc("msn", "Getting Address Book\n"); - - /*build SOAP and POST it*/ - if (dynamicItemLastChange != NULL) - update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, dynamicItemLastChange); - else if (LastChanged != NULL) - update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged); - - body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE, - MsnSoapPartnerScenarioText[partner_scenario], - update_str ? update_str : ""); - - state = msn_callback_state_new(session); - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GET_ADDRESS_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_get_address_cb; - msn_contact_request(state); - - g_free(update_str); - g_free(body); -} - -/*************************************************************** - * Contact Operations - ***************************************************************/ - -static void -msn_add_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - - MsnUserList *userlist; - MsnUser *user; - xmlnode *guid; - - xmlnode *fault; - - g_return_if_fail(session != NULL); - userlist = session->userlist; - - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); - if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { - /* Do something special! */ - purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); - - } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) { - PurpleBuddy *buddy = purple_find_buddy(session->account, state->who); - char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who); - purple_notify_error(state->session, _("Buddy Add error"), str, - _("The username specified does not exist.")); - g_free(str); - msn_userlist_rem_buddy(userlist, state->who); - if (buddy != NULL) - purple_blist_remove_buddy(buddy); - - } else { - /* We don't know how to respond to this faultcode, so log it */ - char *fault_str = xmlnode_to_str(fault, NULL); - if (fault_str != NULL) { - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - } - } - return; - } - - purple_debug_info("msn", "Contact added successfully\n"); - - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); - - user = msn_userlist_find_add_user(userlist, state->who, state->who); - msn_user_add_group_id(user, state->guid); - - guid = xmlnode_get_child(resp->xml, - "Body/ABContactAddResponse/ABContactAddResult/guid"); - if (guid != NULL) { - char *uid = xmlnode_get_data(guid); - msn_user_set_uid(user, uid); - purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); - g_free(uid); - } -} - -/* add a Contact in MSN_INDIVIDUALS_GROUP */ -void -msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passport) -{ - MsnUser *user; - gchar *body = NULL; - gchar *contact_xml = NULL; - -#if 0 - gchar *escaped_displayname; - - - if (displayname != NULL) { - escaped_displayname = g_markup_decode_text(displayname, -1); - } else { - escaped_displayname = passport; - } - contact_xml = g_strdup_printf(MSN_XML_ADD_CONTACT, escaped_displayname, passport); -#endif - - purple_debug_info("msn", "Adding contact %s to contact list\n", passport); - - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) { - purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); - return; /* guess this never happened! */ - } - - if (user->networkid != MSN_NETWORK_PASSPORT) { - contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, - user->networkid == MSN_NETWORK_YAHOO ? - "Messenger2" : - "Messenger3", - passport, 0); - } else { - contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); - } - body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE, contact_xml); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_CONTACT_ADD_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_add_contact_read_cb; - msn_contact_request(state); - - g_free(contact_xml); - g_free(body); -} - -static void -msn_add_contact_to_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - MsnUserList *userlist; - xmlnode *fault; - - g_return_if_fail(session != NULL); - userlist = session->userlist; - - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *errorcode = xmlnode_get_data(xmlnode_get_child(fault, "detail/errorcode")); - if (errorcode && !strcmp(errorcode, "EmailDomainIsFederated")) { - /* Do something special! */ - purple_debug_error("msn", "Contact is from a federated domain, but don't know what to do yet!\n"); - - } else if (errorcode && !strcmp(errorcode, "InvalidPassportUser")) { - PurpleBuddy *buddy = purple_find_buddy(session->account, state->who); - char *str = g_strdup_printf(_("Unable to add \"%s\"."), state->who); - purple_notify_error(session, _("Buddy Add error"), str, - _("The username specified does not exist.")); - g_free(str); - msn_userlist_rem_buddy(userlist, state->who); - if (buddy != NULL) - purple_blist_remove_buddy(buddy); - - } else { - /* We don't know how to respond to this faultcode, so log it */ - char *fault_str = xmlnode_to_str(fault, NULL); - if (fault_str != NULL) { - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - } - } - return; - } - - if (msn_userlist_add_buddy_to_group(userlist, state->who, - state->new_group_name)) { - purple_debug_info("msn", "Contact %s added to group %s successfully!\n", state->who, state->new_group_name); - } else { - purple_debug_info("msn", "Contact %s added to group %s successfully on server, but failed in the local list\n", state->who, state->new_group_name); - } - - if (state->action & MSN_ADD_BUDDY) { - MsnUser *user = msn_userlist_find_user(userlist, state->who); - xmlnode *guid = xmlnode_get_child(resp->xml, - "Body/ABGroupContactAddResponse/ABGroupContactAddResult/guid"); - - if (guid != NULL) { - char *uid = xmlnode_get_data(guid); - msn_user_set_uid(user, uid); - purple_debug_info("msn", "Set %s guid to %s.\n", state->who, uid); - g_free(uid); - } - - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); - - if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) { - msn_del_contact_from_list(state->session, NULL, state->who, MSN_LIST_PL); - return; - } - } - - if (state->action & MSN_MOVE_BUDDY) { - msn_del_contact_from_group(state->session, state->who, state->old_group_name); - } -} - -void -msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, - const char *passport, const char *groupId) -{ - MsnUserList *userlist; - MsnUser *user; - gchar *body = NULL, *contact_xml, *invite; - - g_return_if_fail(passport != NULL); - g_return_if_fail(groupId != NULL); - - g_return_if_fail(session != NULL); - - userlist = session->userlist; - - if (!strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) { - - user = msn_userlist_find_add_user(userlist, passport, passport); - - if (state->action & MSN_ADD_BUDDY) { - msn_add_contact(session, state, passport); - return; - } - - if (state->action & MSN_MOVE_BUDDY) { - msn_user_add_group_id(user, groupId); - msn_del_contact_from_group(session, passport, state->old_group_name); - } - - return; - } - - purple_debug_info("msn", "Adding user %s to group %s\n", passport, - msn_userlist_find_group_name(userlist, groupId)); - - user = msn_userlist_find_user(userlist, passport); - if (user == NULL) { - purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); - msn_callback_state_free(state); - return; /* guess this never happened! */ - } - - if (user->uid != NULL) { - contact_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); - } else if (user->networkid != MSN_NETWORK_PASSPORT) { - contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, - user->networkid == MSN_NETWORK_YAHOO ? - "Messenger2" : - "Messenger3", - passport, 0); - } else { - contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); - } - - if (user->invite_message) { - char *tmp; - body = g_markup_escape_text(user->invite_message, -1); - - /* Ignore the cast, we treat it as const anyway. */ - tmp = (char *)purple_connection_get_display_name(session->account->gc); - tmp = tmp ? g_markup_escape_text(tmp, -1) : g_strdup(""); - - invite = g_strdup_printf(MSN_CONTACT_INVITE_MESSAGE_XML, body, tmp); - - g_free(body); - g_free(tmp); - - /* We can free this now */ - g_free(user->invite_message); - user->invite_message = NULL; - - } else { - invite = g_strdup(""); - } - - body = g_strdup_printf(MSN_ADD_CONTACT_GROUP_TEMPLATE, groupId, contact_xml, invite); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_ADD_CONTACT_GROUP_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_add_contact_to_group_read_cb; - msn_contact_request(state); - - g_free(invite); - g_free(contact_xml); - g_free(body); -} - -static void -msn_delete_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnUserList *userlist = state->session->userlist; - MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid); - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Delete contact successful\n"); - - if (user != NULL) { - msn_userlist_remove_user(userlist, user); - } -} - -/*delete a Contact*/ -void -msn_delete_contact(MsnSession *session, MsnUser *user) -{ - gchar *body = NULL; - gchar *contact_id_xml = NULL ; - MsnCallbackState *state; - - if (user->uid != NULL) { - contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); - purple_debug_info("msn", "Deleting contact with contactId: %s\n", user->uid); - } else { - purple_debug_info("msn", "Unable to delete contact %s without a ContactId\n", user->passport); - return; - } - - state = msn_callback_state_new(session); - msn_callback_state_set_uid(state, user->uid); - - /* build SOAP request */ - body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_CONTACT_DEL_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_delete_contact_read_cb; - msn_contact_request(state); - - g_free(contact_id_xml); - g_free(body); -} - -static void -msn_del_contact_from_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - if (msn_userlist_rem_buddy_from_group(state->session->userlist, - state->who, state->old_group_name)) { - purple_debug_info("msn", "Contact %s deleted successfully from group %s\n", state->who, state->old_group_name); - } else { - purple_debug_info("msn", "Contact %s deleted successfully from group %s in the server, but failed in the local list\n", state->who, state->old_group_name); - } -} - -void -msn_del_contact_from_group(MsnSession *session, const char *passport, const char *group_name) -{ - MsnUserList * userlist; - MsnUser *user; - MsnCallbackState *state; - gchar *body, *contact_id_xml; - const gchar *groupId; - - g_return_if_fail(passport != NULL); - g_return_if_fail(group_name != NULL); - g_return_if_fail(session != NULL); - - userlist = session->userlist; - - groupId = msn_userlist_find_group_id(userlist, group_name); - if (groupId != NULL) { - purple_debug_info("msn", "Deleting user %s from group %s\n", passport, group_name); - } else { - purple_debug_warning("msn", "Unable to retrieve group id from group %s !\n", group_name); - return; - } - - user = msn_userlist_find_user(userlist, passport); - - if (user == NULL) { - purple_debug_warning("msn", "Unable to retrieve user from passport %s!\n", passport); - return; - } - - if ( !strcmp(groupId, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(groupId, MSN_NON_IM_GROUP_ID)) { - msn_user_remove_group_id(user, groupId); - return; - } - - state = msn_callback_state_new(session); - msn_callback_state_set_who(state, passport); - msn_callback_state_set_guid(state, groupId); - msn_callback_state_set_old_group_name(state, group_name); - - if (user->uid != NULL) - contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); - else - contact_id_xml = g_strdup_printf(MSN_CONTACT_XML, passport); - body = g_strdup_printf(MSN_CONTACT_DEL_GROUP_TEMPLATE, contact_id_xml, groupId); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_CONTACT_DEL_GROUP_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_del_contact_from_group_read_cb; - msn_contact_request(state); - - g_free(contact_id_xml); - g_free(body); -} - - -static void -msn_update_contact_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = (MsnCallbackState *)data; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Contact updated successfully\n"); -} - -/* Update a contact's info */ -void -msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value) -{ - MsnCallbackState *state; - xmlnode *contact; - xmlnode *contact_info; - xmlnode *changes; - MsnUser *user = NULL; - - purple_debug_info("msn", "Update contact information for %s with new %s: %s\n", - passport ? passport : "(null)", - type == MSN_UPDATE_DISPLAY ? "display name" : "alias", - value ? value : "(null)"); - g_return_if_fail(passport != NULL); - - if (strcmp(passport, "Me") != 0) { - user = msn_userlist_find_user(session->userlist, passport); - if (!user) - return; - } - - contact_info = xmlnode_new("contactInfo"); - changes = xmlnode_new("propertiesChanged"); - - switch (type) { - xmlnode *annotations; - xmlnode *display; - xmlnode *a, *n, *v; - case MSN_UPDATE_DISPLAY: - display = xmlnode_new_child(contact_info, "displayName"); - xmlnode_insert_data(display, value, -1); - xmlnode_insert_data(changes, "DisplayName", -1); - break; - - case MSN_UPDATE_ALIAS: - annotations = xmlnode_new_child(contact_info, "annotations"); - xmlnode_insert_data(changes, "Annotation ", -1); - - a = xmlnode_new_child(annotations, "Annotation"); - n = xmlnode_new_child(a, "Name"); - xmlnode_insert_data(n, "AB.NickName", -1); - v = xmlnode_new_child(a, "Value"); - xmlnode_insert_data(v, value, -1); - break; - - default: - g_return_if_reached(); - } - - state = msn_callback_state_new(session); - - state->body = xmlnode_from_str(MSN_CONTACT_UPDATE_TEMPLATE, -1); - state->action = MSN_UPDATE_INFO; - state->post_action = MSN_CONTACT_UPDATE_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_update_contact_read_cb; - - contact = xmlnode_get_child(state->body, "Body/ABContactUpdate/contacts/Contact"); - xmlnode_insert_child(contact, contact_info); - xmlnode_insert_child(contact, changes); - - if (user) { - xmlnode *contactId = xmlnode_new_child(contact, "contactId"); - msn_callback_state_set_uid(state, user->uid); - xmlnode_insert_data(contactId, state->uid, -1); - } else { - xmlnode *contactType = xmlnode_new_child(contact_info, "contactType"); - xmlnode_insert_data(contactType, "Me", -1); - } - - msn_contact_request(state); -} - -static void -msn_del_contact_from_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session = state->session; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Contact %s deleted successfully from %s list on server!\n", state->who, MsnMemberRole[state->list_id]); - - if (state->list_id == MSN_LIST_PL) { - MsnUser *user = msn_userlist_find_user(session->userlist, state->who); - MsnCallbackState *new_state = msn_callback_state_dup(state); - - if (user != NULL) - msn_user_unset_op(user, MSN_LIST_PL_OP); - - msn_add_contact_to_list(session, new_state, state->who, MSN_LIST_RL); - return; - } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_remove(session->account, state->who, TRUE); - msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_BL); - } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_remove(session->account, state->who, TRUE); - msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_AL); - } - -} - -void -msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list) -{ - gchar *body = NULL, *member = NULL; - MsnSoapPartnerScenario partner_scenario; - MsnUser *user; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->userlist != NULL); - g_return_if_fail(passport != NULL); - g_return_if_fail(list < 5); - - purple_debug_info("msn", "Deleting contact %s from %s list\n", passport, MsnMemberRole[list]); - - if (state == NULL) { - state = msn_callback_state_new(session); - } - msn_callback_state_set_list_id(state, list); - msn_callback_state_set_who(state, passport); - - user = msn_userlist_find_user(session->userlist, passport); - - if (list == MSN_LIST_PL) { - partner_scenario = MSN_PS_CONTACT_API; - if (user && user->networkid != MSN_NETWORK_PASSPORT) - member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, - "EmailMember", "Email", - user->member_id_on_pending_list); - else - member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, - "PassportMember", "Passport", - user->member_id_on_pending_list); - } else { - /* list == MSN_LIST_AL || list == MSN_LIST_BL */ - partner_scenario = MSN_PS_BLOCK_UNBLOCK; - if (user && user->networkid != MSN_NETWORK_PASSPORT) - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "EmailMember", "Email", - "Email", passport, "Email"); - else - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "PassportMember", "Passport", - "PassportName", passport, "PassportName"); - } - - body = g_strdup_printf(MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE, - MsnSoapPartnerScenarioText[partner_scenario], - MsnMemberRole[list], member); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION; - state->post_url = MSN_SHARE_POST_URL; - state->cb = msn_del_contact_from_list_read_cb; - msn_contact_request(state); - - g_free(member); - g_free(body); -} - -static void -msn_add_contact_to_list_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, - gpointer data) -{ - MsnCallbackState *state = data; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - g_return_if_fail(state->session != NULL); - - purple_debug_info("msn", "Contact %s added successfully to %s list on server!\n", state->who, MsnMemberRole[state->list_id]); - - if (state->list_id == MSN_LIST_RL) { - MsnUser *user = msn_userlist_find_user(state->session->userlist, state->who); - - if (user != NULL) { - msn_user_set_op(user, MSN_LIST_RL_OP); - } - - if (state->action & MSN_DENIED_BUDDY) { - msn_add_contact_to_list(state->session, NULL, state->who, MSN_LIST_BL); - } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_add(state->session->account, state->who, TRUE); - } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_add(state->session->account, state->who, TRUE); - } - } -} - -void -msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list) -{ - gchar *body = NULL, *member = NULL; - MsnSoapPartnerScenario partner_scenario; - MsnUser *user; - - g_return_if_fail(session != NULL); - g_return_if_fail(passport != NULL); - g_return_if_fail(list < 5); - - purple_debug_info("msn", "Adding contact %s to %s list\n", passport, MsnMemberRole[list]); - - if (state == NULL) { - state = msn_callback_state_new(session); - } - msn_callback_state_set_list_id(state, list); - msn_callback_state_set_who(state, passport); - - user = msn_userlist_find_user(session->userlist, passport); - - partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK; - if (user && user->networkid != MSN_NETWORK_PASSPORT) - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "EmailMember", "Email", - "Email", state->who, "Email"); - else - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, - "PassportMember", "Passport", - "PassportName", state->who, "PassportName"); - - body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE, - MsnSoapPartnerScenarioText[partner_scenario], - MsnMemberRole[list], member); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION; - state->post_url = MSN_SHARE_POST_URL; - state->cb = msn_add_contact_to_list_read_cb; - msn_contact_request(state); - - g_free(member); - g_free(body); -} - -#if 0 -static void -msn_gleams_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - purple_debug_info("msn", "Gleams read done\n"); -} - -/*get the gleams info*/ -void -msn_get_gleams(MsnSession *session) -{ - MsnSoapReq *soap_request; - - purple_debug_info("msn", "msn get gleams info...\n"); - - state = msn_callback_state_new(session); - state->body = xmlnode_from_str(MSN_GLEAMS_TEMPLATE, -1); - state->post_action = MSN_GET_GLEAMS_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_gleams_read_cb; - msn_contact_request(state); -} -#endif - - -/*************************************************************** - * Group Operations - ***************************************************************/ - -static void -msn_group_read_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnCallbackState *state = data; - MsnSession *session; - MsnUserList *userlist; - xmlnode *fault; - - /* We don't know how to respond to this faultcode, so log it */ - fault = xmlnode_get_child(resp->xml, "Body/Fault"); - if (fault != NULL) { - char *fault_str = xmlnode_to_str(fault, NULL); - purple_debug_error("msn", "Operation {%s} Failed, SOAP Fault was: %s\n", - msn_contact_operation_str(state->action), fault_str); - g_free(fault_str); - return; - } - - purple_debug_info("msn", "Group request successful.\n"); - - g_return_if_fail(state->session != NULL); - g_return_if_fail(state->session->userlist != NULL); - - session = state->session; - userlist = session->userlist; - - if (state->action & MSN_RENAME_GROUP) { - msn_userlist_rename_group_id(session->userlist, - state->guid, - state->new_group_name); - } - - if (state->action & MSN_ADD_GROUP) { - /* the response is taken from - http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions - should copy it to msnpiki some day */ - xmlnode *guid_node = xmlnode_get_child(resp->xml, - "Body/ABGroupAddResponse/ABGroupAddResult/guid"); - - if (guid_node) { - char *guid = xmlnode_get_data(guid_node); - - /* create and add the new group to the userlist */ - purple_debug_info("msn", "Adding group %s with guid = %s to the userlist\n", state->new_group_name, guid); - msn_group_new(session->userlist, guid, state->new_group_name); - - if (state->action & MSN_ADD_BUDDY) { - msn_userlist_add_buddy(session->userlist, - state->who, - state->new_group_name); - } else if (state->action & MSN_MOVE_BUDDY) { - /* This will be freed when the add contact callback fires */ - MsnCallbackState *new_state = msn_callback_state_dup(state); - msn_add_contact_to_group(session, new_state, state->who, guid); - g_free(guid); - return; - } - g_free(guid); - } else { - purple_debug_info("msn", "Adding group %s failed\n", - state->new_group_name); - } - } - - if (state->action & MSN_DEL_GROUP) { - GList *l; - - msn_userlist_remove_group_id(session->userlist, state->guid); - for (l = userlist->users; l != NULL; l = l->next) { - msn_user_remove_group_id( (MsnUser *)l->data, state->guid); - } - } -} - -/* add group */ -void -msn_add_group(MsnSession *session, MsnCallbackState *state, const char* group_name) -{ - char *body = NULL; - char *escaped_group_name = NULL; - - g_return_if_fail(session != NULL); - g_return_if_fail(group_name != NULL); - - purple_debug_info("msn", "Adding group %s to contact list.\n", group_name); - - if (state == NULL) { - state = msn_callback_state_new(session); - } - - msn_callback_state_set_action(state, MSN_ADD_GROUP); - msn_callback_state_set_new_group_name(state, group_name); - - /* escape group name's html special chars so it can safely be sent - * in a XML SOAP request - */ - escaped_group_name = g_markup_escape_text(group_name, -1); - body = g_strdup_printf(MSN_GROUP_ADD_TEMPLATE, escaped_group_name); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GROUP_ADD_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_group_read_cb; - msn_contact_request(state); - - g_free(escaped_group_name); - g_free(body); -} - -/* delete group */ -void -msn_del_group(MsnSession *session, const gchar *group_name) -{ - MsnCallbackState *state; - char *body = NULL; - const gchar *guid; - - g_return_if_fail(session != NULL); - - g_return_if_fail(group_name != NULL); - purple_debug_info("msn", "Deleting group %s from contact list\n", group_name); - - guid = msn_userlist_find_group_id(session->userlist, group_name); - - /* if group uid we need to del is NULL, - * we need to delete nothing - */ - if (guid == NULL) { - purple_debug_info("msn", "Group %s guid not found, returning.\n", group_name); - return; - } - - if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) { - /* XXX add back PurpleGroup since it isn't really removed in the server? */ - return; - } - - state = msn_callback_state_new(session); - msn_callback_state_set_action(state, MSN_DEL_GROUP); - msn_callback_state_set_guid(state, guid); - - body = g_strdup_printf(MSN_GROUP_DEL_TEMPLATE, guid); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GROUP_DEL_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_group_read_cb; - msn_contact_request(state); - - g_free(body); -} - -/* rename group */ -void -msn_contact_rename_group(MsnSession *session, const char *old_group_name, const char *new_group_name) -{ - gchar *body = NULL; - const gchar * guid; - MsnCallbackState *state; - char *escaped_group_name; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->userlist != NULL); - g_return_if_fail(old_group_name != NULL); - g_return_if_fail(new_group_name != NULL); - - purple_debug_info("msn", "Renaming group %s to %s.\n", old_group_name, new_group_name); - - guid = msn_userlist_find_group_id(session->userlist, old_group_name); - if (guid == NULL) - return; - - state = msn_callback_state_new(session); - msn_callback_state_set_guid(state, guid); - msn_callback_state_set_new_group_name(state, new_group_name); - - if ( !strcmp(guid, MSN_INDIVIDUALS_GROUP_ID) || !strcmp(guid, MSN_NON_IM_GROUP_ID) ) { - MsnCallbackState *new_state = msn_callback_state_dup(state); - msn_add_group(session, new_state, new_group_name); - /* XXX move every buddy there (we probably need to fix concurrent SOAP reqs first) */ - } - - msn_callback_state_set_action(state, MSN_RENAME_GROUP); - - escaped_group_name = g_markup_escape_text(new_group_name, -1); - body = g_strdup_printf(MSN_GROUP_RENAME_TEMPLATE, guid, escaped_group_name); - - state->body = xmlnode_from_str(body, -1); - state->post_action = MSN_GROUP_RENAME_SOAP_ACTION; - state->post_url = MSN_ADDRESS_BOOK_POST_URL; - state->cb = msn_group_read_cb; - msn_contact_request(state); - - g_free(escaped_group_name); - g_free(body); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/contact.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,710 +0,0 @@ -/** - * @file contact.h Header file for contact.c - * Author - * MaYuan<mayuan2006@gmail.com> - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef MSN_CONTACT_H -#define MSN_CONTACT_H - -typedef struct _MsnCallbackState MsnCallbackState; - -typedef enum -{ - MSN_ADD_BUDDY = 0x01, - MSN_MOVE_BUDDY = 0x02, - MSN_ACCEPTED_BUDDY = 0x04, - MSN_DENIED_BUDDY = 0x08, - MSN_ADD_GROUP = 0x10, - MSN_DEL_GROUP = 0x20, - MSN_RENAME_GROUP = 0x40, - MSN_UPDATE_INFO = 0x80 -} MsnCallbackAction; - -typedef enum -{ - MSN_UPDATE_DISPLAY, /* Real display name */ - MSN_UPDATE_ALIAS, /* Aliased display name */ - MSN_UPDATE_COMMENT -} MsnContactUpdateType; - -typedef enum -{ - MSN_PS_INITIAL, - MSN_PS_SAVE_CONTACT, - MSN_PS_PENDING_LIST, - MSN_PS_CONTACT_API, - MSN_PS_BLOCK_UNBLOCK -} MsnSoapPartnerScenario; - -#include "session.h" -#include "soap.h" - -#define MSN_APPLICATION_ID "CFE80F9D-180F-4399-82AB-413F33A1FA11" - -#define MSN_CONTACT_SERVER "omega.contacts.msn.com" - -/* Get Contact List */ - -#define MSN_GET_CONTACT_POST_URL "/abservice/SharingService.asmx" -#define MSN_GET_CONTACT_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership" - -#define MSN_GET_CONTACT_UPDATE_XML \ - "<View>Full</View>"\ - "<deltasOnly>true</deltasOnly>"\ - "<lastChange>%s</lastChange>" - -#define MSN_GET_CONTACT_TEMPLATE "<?xml version='1.0' encoding='utf-8'?>"\ -"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ - "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>"\ - "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ - "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<Types xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType>"\ - "<ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType>"\ - "</Types>"\ - "</serviceFilter>"\ - "%s"\ - "</FindMembership>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/************************************************ - * Address Book SOAP - * *********************************************/ - -#define MSN_ADDRESS_BOOK_POST_URL "/abservice/abservice.asmx" - -/* Create AddressBook template */ -#define MSN_ADD_ADDRESSBOOK_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABAdd" - -#define MSN_ADD_ADDRESSBOOK_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Initial</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abInfo>"\ - "<name/>"\ - "<ownerPuid>0</ownerPuid>"\ - "<ownerEmail>%s</ownerEmail>"\ - "<fDefault>true</fDefault>"\ - "</abInfo>"\ - "</ABAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Get AddressBook */ -#define MSN_GET_ADDRESS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" -#define MSN_GET_ADDRESS_FULL_TIME "0001-01-01T00:00:00.0000000-08:00" -#define MSN_GET_ADDRESS_UPDATE_XML \ - "<deltasOnly>true</deltasOnly>"\ - "<lastChange>%s</lastChange>" - -#define MSN_GET_GLEAM_UPDATE_XML \ - "%s"\ - "<dynamicItemView>Gleam</dynamicItemView>"\ - "<dynamicItemLastChange>%s</dynamicItemLastChange>" - -#define MSN_GET_ADDRESS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<abView>Full</abView>"\ - "%s"\ - "</ABFindAll>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - -/*Gleams SOAP request template*/ -#define MSN_GET_GLEAMS_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll" -#define MSN_GLEAMS_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Initial</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<abView>Full</abView>"\ - "<dynamicItemView>Gleam</dynamicItemView>"\ - "<dynamicItemLastChange>0001-01-01T00:00:00.0000000-08:00</dynamicItemLastChange>"\ - "</ABFindAll>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - -/******************************************************* - * Contact Management SOAP actions - *******************************************************/ - -/* Add a new contact */ -#define MSN_CONTACT_ADD_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd" -#define MSN_CONTACT_LIVE_PENDING_XML \ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<contactInfo>"\ - "<contactType>LivePending</contactType>"\ - "<passportName>%s</passportName>"\ - "<isMessengerUser>true</isMessengerUser>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_XML \ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<contactInfo>"\ - "<passportName>%s</passportName>"\ - "<isSmtp>false</isSmtp>"\ - "<isMessengerUser>true</isMessengerUser>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_DISPLAYNAME_XML \ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<contactInfo>"\ - "<displayName>%s</displayName>"\ - "<passportName>%s</passportName>"\ - "<isMessengerUser>true</isMessengerUser>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_ID_XML \ - "<Contact>"\ - "<contactId>%s</contactId>"\ - "</Contact>" - -#define MSN_CONTACT_EMAIL_XML \ - "<Contact>"\ - "<contactInfo>"\ - "<emails>"\ - "<ContactEmail>"\ - "<contactEmailType>%s</contactEmailType>"\ - "<email>%s</email>"\ - "<isMessengerEnabled>true</isMessengerEnabled>"\ - "<Capability>%d</Capability>"\ - "<MessengerEnabledExternally>false</MessengerEnabledExternally>"\ - "<propertiesChanged/>"\ - "</ContactEmail>"\ - "</emails>"\ - "</contactInfo>"\ - "</Contact>" - -#define MSN_CONTACT_INVITE_MESSAGE_XML \ - "<MessengerMemberInfo>"\ - "<PendingAnnotations>"\ - "<Annotation>"\ - "<Name>MSN.IM.InviteMessage</Name>"\ - "<Value>%s</Value>"\ - "</Annotation>"\ - "</PendingAnnotations>"\ - "<DisplayName>%s</DisplayName>"\ - "</MessengerMemberInfo>" - -#define MSN_ADD_CONTACT_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>ContactSave</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>%s</contacts>"\ - "<options>"\ - "<EnableAllowListManagement>true</EnableAllowListManagement>"\ - "</options>"\ - "</ABContactAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Add a contact to a group */ -#define MSN_ADD_CONTACT_GROUP_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupContactAdd" -#define MSN_ADD_CONTACT_GROUP_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>ContactSave</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groupFilter>"\ - "<groupIds>"\ - "<guid>%s</guid>"\ - "</groupIds>"\ - "</groupFilter>"\ - "<contacts>%s</contacts>"\ - "<groupContactAddOptions>"\ - "<fGenerateMissingQuickName>true</fGenerateMissingQuickName>"\ - "<EnableAllowListManagement>true</EnableAllowListManagement>"\ - "</groupContactAddOptions>"\ - "%s"\ - "</ABGroupContactAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Delete a contact from the Contact List */ -#define MSN_CONTACT_DEL_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete" -#define MSN_DEL_CONTACT_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>%s</contacts>"\ - "</ABContactDelete>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* Remove a contact from a group */ -#define MSN_CONTACT_DEL_GROUP_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupContactDelete" -#define MSN_CONTACT_DEL_GROUP_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>%s</contacts>"\ - "<groupFilter>"\ - "<groupIds>"\ - "<guid>%s</guid>"\ - "</groupIds>"\ - "</groupFilter>"\ - "</ABGroupContactDelete>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - -/* Update Contact Information */ -#define MSN_CONTACT_UPDATE_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate" -#define MSN_CONTACT_UPDATE_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<contacts>"\ - "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - ""\ - "</Contact>"\ - "</contacts>"\ - "</ABContactUpdate>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/******************************************************* - * Add/Delete contact from lists SOAP actions - *******************************************************/ - -/* block means delete from allow list and add contact to block list */ -#define MSN_SHARE_POST_URL "/abservice/SharingService.asmx" - -#define MSN_ADD_MEMBER_TO_LIST_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/AddMember" -#define MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember" - -#define MSN_MEMBER_PASSPORT_XML \ - "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"%s\">"\ - "<Type>%s</Type>"\ - "<State>Accepted</State>"\ - "<%s>%s</%s>"\ - "</Member>" - -#define MSN_MEMBER_MEMBERSHIPID_XML \ - "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"%s\">"\ - "<Type>%s</Type>"\ - "<MembershipId>%u</MembershipId>"\ - "<State>Accepted</State>"\ - "</Member>" - -/* first delete contact from allow list */ - -#define MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<DeleteMember xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<serviceHandle>"\ - "<Id>0</Id>"\ - "<Type>Messenger</Type>"\ - "<ForeignId></ForeignId>"\ - "</serviceHandle>"\ - "<memberships>"\ - "<Membership>"\ - "<MemberRole>%s</MemberRole>"\ - "<Members>"\ - "%s"\ - "</Members>"\ - "</Membership>"\ - "</memberships>"\ - "</DeleteMember>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -#define MSN_CONTACT_ADD_TO_LIST_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>%s</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<AddMember xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<serviceHandle>"\ - "<Id>0</Id>"\ - "<Type>Messenger</Type>"\ - "<ForeignId></ForeignId>"\ - "</serviceHandle>"\ - "<memberships>"\ - "<Membership>"\ - "<MemberRole>%s</MemberRole>"\ - "<Members>"\ - "%s"\ - "</Members>"\ - "</Membership>"\ - "</memberships>"\ - "</AddMember>"\ - "</soap:Body>"\ -"</soap:Envelope>" - - - -/******************************************************* - * Group management SOAP actions - *******************************************************/ - -/* add a group */ -#define MSN_GROUP_ADD_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupAdd" -#define MSN_GROUP_ADD_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>GroupSave</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groupAddOptions>"\ - "<fRenameOnMsgrConflict>false</fRenameOnMsgrConflict>"\ - "</groupAddOptions>"\ - "<groupInfo>"\ - "<GroupInfo>"\ - "<name>%s</name>"\ - "<groupType>C8529CE2-6EAD-434d-881F-341E17DB3FF8</groupType>"\ - "<fMessenger>false</fMessenger>"\ - "<annotations>"\ - "<Annotation>"\ - "<Name>MSN.IM.Display</Name>"\ - "<Value>1</Value>"\ - "</Annotation>"\ - "</annotations>"\ - "</GroupInfo>"\ - "</groupInfo>"\ - "</ABGroupAdd>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* delete a group */ -#define MSN_GROUP_DEL_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupDelete" -#define MSN_GROUP_DEL_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groupFilter>"\ - "<groupIds>"\ - "<guid>%s</guid>"\ - "</groupIds>"\ - "</groupFilter>"\ - "</ABGroupDelete>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -/* change a group's name */ -#define MSN_GROUP_RENAME_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/ABGroupUpdate" -#define MSN_GROUP_RENAME_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ -"<soap:Envelope"\ - " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""\ - " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""\ - " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""\ - " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">"\ - "<soap:Header>"\ - "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ApplicationId>" MSN_APPLICATION_ID "</ApplicationId>"\ - "<IsMigration>false</IsMigration>"\ - "<PartnerScenario>Timer</PartnerScenario>"\ - "</ABApplicationHeader>"\ - "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<ManagedGroupRequest>false</ManagedGroupRequest>"\ - "<TicketToken>EMPTY</TicketToken>"\ - "</ABAuthHeader>"\ - "</soap:Header>"\ - "<soap:Body>"\ - "<ABGroupUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">"\ - "<abId>00000000-0000-0000-0000-000000000000</abId>"\ - "<groups>"\ - "<Group>"\ - "<groupId>%s</groupId>"\ - "<groupInfo>"\ - "<name>%s</name>"\ - "</groupInfo>"\ - "<propertiesChanged>GroupName </propertiesChanged>"\ - "</Group>"\ - "</groups>"\ - "</ABGroupUpdate>"\ - "</soap:Body>"\ -"</soap:Envelope>" - -struct _MsnCallbackState -{ - gchar * who; - gchar * uid; - gchar * old_group_name; - gchar * new_group_name; - gchar * guid; - MsnListId list_id; - MsnCallbackAction action; - MsnSession *session; - xmlnode *body; - xmlnode *token; - const gchar *post_action; - const gchar *post_url; - MsnSoapCallback cb; - /* For msn_get_contact_list only */ - MsnSoapPartnerScenario partner_scenario; -}; - -/************************************************ - * function prototype - ************************************************/ -MsnCallbackState * msn_callback_state_new(MsnSession *session); -MsnCallbackState * msn_callback_state_dup(MsnCallbackState *state); -void msn_callback_state_free(MsnCallbackState *state); -void msn_callback_state_set_who(MsnCallbackState *state, const gchar *who); -void msn_callback_state_set_uid(MsnCallbackState *state, const gchar *uid); -void msn_callback_state_set_old_group_name(MsnCallbackState *state, - const gchar *old_group_name); -void msn_callback_state_set_new_group_name(MsnCallbackState *state, - const gchar *new_group_name); -void msn_callback_state_set_guid(MsnCallbackState *state, const gchar *guid); -void msn_callback_state_set_list_id(MsnCallbackState *state, MsnListId list_id); -void msn_callback_state_set_action(MsnCallbackState *state, - MsnCallbackAction action); - -void msn_contact_connect(MsnSession *session); -void msn_get_contact_list(MsnSession *session, - const MsnSoapPartnerScenario partner_scenario, - const char *update); -void msn_get_address_book(MsnSession *session, - const MsnSoapPartnerScenario partner_scenario, - const char * update, const char * gupdate); - -/* contact SOAP operations */ -void msn_update_contact(MsnSession *session, const char *passport, MsnContactUpdateType type, const char* value); - -void msn_add_contact(MsnSession *session, MsnCallbackState *state, - const char *passport); -void msn_delete_contact(MsnSession *session, MsnUser *user); - -void msn_add_contact_to_group(MsnSession *session, MsnCallbackState *state, - const char *passport, const char *groupId); -void msn_del_contact_from_group(MsnSession *session, const char *passport, - const char *group_name); -/* group operations */ -void msn_add_group(MsnSession *session, MsnCallbackState *state, - const char* group_name); -void msn_del_group(MsnSession *session, const gchar *group_name); -void msn_contact_rename_group(MsnSession *session, const char *old_group_name, - const char *new_group_name); - -/* lists operations */ -void msn_add_contact_to_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list); -void msn_del_contact_from_list(MsnSession *session, MsnCallbackState *state, - const gchar *passport, const MsnListId list); - -#endif /* MSN_CONTACT_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/** - * @file dialog.c Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "msn.h" -#include "dialog.h" - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *group; - gboolean add; - -} MsnAddRemData; - -/* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed. - * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */ -/* Actually with our MSNP14 code that isn't true yet, he won't be added back :( */ -static void -msn_complete_sync_issue(MsnAddRemData *data) -{ - PurpleBuddy *buddy; - PurpleGroup *group = NULL; - - if (data->group != NULL) - group = purple_find_group(data->group); - - if (group != NULL) - buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group); - else - buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who); - - if (buddy != NULL) - purple_blist_remove_buddy(buddy); -} - - -static void -msn_add_cb(MsnAddRemData *data) -{ -#if 0 - /* this *should* be necessary !! */ - msn_complete_sync_issue(data); -#endif - - if (g_list_find(purple_connections_get_all(), data->gc) != NULL) - { - MsnSession *session = data->gc->proto_data; - MsnUserList *userlist = session->userlist; - - msn_userlist_add_buddy(userlist, data->who, data->group); - } - - g_free(data->group); - g_free(data->who); - g_free(data); -} - -static void -msn_rem_cb(MsnAddRemData *data) -{ - msn_complete_sync_issue(data); - - if (g_list_find(purple_connections_get_all(), data->gc) != NULL) - { - MsnSession *session = data->gc->proto_data; - MsnUserList *userlist = session->userlist; - - if (data->group == NULL) { - msn_userlist_rem_buddy_from_list(userlist, data->who, MSN_LIST_FL); - } else { - g_free(data->group); - } - } - - g_free(data->who); - g_free(data); -} - -void -msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name) -{ - PurpleConnection *gc; - PurpleAccount *account; - MsnAddRemData *data; - char *msg, *reason; - - account = session->account; - gc = purple_account_get_connection(account); - - data = g_new0(MsnAddRemData, 1); - data->who = g_strdup(passport); - data->group = g_strdup(group_name); - data->gc = gc; - - msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - if (group_name != NULL) - { - reason = g_strdup_printf(_("%s on the local list is " - "inside the group \"%s\" but not on " - "the server list. " - "Do you want this buddy to be added?"), - passport, group_name); - } - else - { - reason = g_strdup_printf(_("%s is on the local list but " - "not on the server list. " - "Do you want this buddy to be added?"), - passport); - } - - purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), data->who, NULL, - data, 2, - _("Yes"), G_CALLBACK(msn_add_cb), - _("No"), G_CALLBACK(msn_rem_cb)); - - g_free(reason); - g_free(msg); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/dialog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/** - * @file dialog.h Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_DIALOG_H -#define MSN_DIALOG_H - -void msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name); - -#endif /* MSN_DIALOG_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,505 +0,0 @@ -/** - * @file directconn.c MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "directconn.h" - -#include "slp.h" -#include "slpmsg.h" - -/************************************************************************** - * Directconn Specific - **************************************************************************/ - -void -msn_directconn_send_handshake(MsnDirectConn *directconn) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - g_return_if_fail(directconn != NULL); - - slplink = directconn->slplink; - - slpmsg = msn_slpmsg_new(slplink); - slpmsg->flags = 0x100; - - if (directconn->nonce != NULL) - { - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - sscanf (directconn->nonce, "%08X-%04hX-%04hX-%04hX-%012" G_GINT64_MODIFIER "X", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - slpmsg->ack_id = t1; - slpmsg->ack_sub_id = t2 | (t3 << 16); - slpmsg->ack_size = t4 | t5; - } - - g_free(directconn->nonce); - - msn_slplink_send_slpmsg(slplink, slpmsg); - - directconn->acked =TRUE; -} - -/************************************************************************** - * Connection Functions - **************************************************************************/ - -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} - -static gssize -msn_directconn_write(MsnDirectConn *directconn, - const char *data, size_t len) -{ - char *buffer, *tmp; - size_t buf_size; - gssize ret; - guint32 sent_len; - - g_return_val_if_fail(directconn != NULL, 0); - - buf_size = len + 4; - buffer = tmp = g_malloc(buf_size); - - sent_len = GUINT32_TO_LE(len); - - memcpy(tmp, &sent_len, 4); - tmp += 4; - memcpy(tmp, data, len); - tmp += len; - - ret = write(directconn->fd, buffer, buf_size); - -#ifdef DEBUG_DC - char *str; - str = g_strdup_printf("%s/msntest/w%.4d.bin", g_get_home_dir(), directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(buffer, 1, buf_size, tf); - fclose(tf); - - g_free(str); -#endif - - g_free(buffer); - - directconn->c++; - - return ret; -} - -#if 0 -void -msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce) -{ - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - g_return_if_fail(directconn != NULL); - g_return_if_fail(nonce != NULL); - - sscanf (nonce, "%08X-%04hX-%04hX-%04hX-%012llX", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - directconn->slpheader = g_new0(MsnSlpHeader, 1); - - directconn->slpheader->ack_id = t1; - directconn->slpheader->ack_sub_id = t2 | (t3 << 16); - directconn->slpheader->ack_size = t4 | t5; -} -#endif - -void -msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - char *body; - size_t body_len; - - body = msn_message_gen_slp_body(msg, &body_len); - - msn_directconn_write(directconn, body, body_len); -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - char *body; - size_t body_len; - gssize len; - - purple_debug_info("msn", "read_cb: %d, %d\n", source, cond); - - directconn = data; - - /* Let's read the length of the data. */ -#error This code is broken. See the note below. - /* - * TODO: This has problems! First of all, sizeof(body_len) will be - * different on 32bit systems and on 64bit systems (4 bytes - * vs. 8 bytes). - * Secondly, we're reading from a TCP stream. There is no - * guarantee that we have received the number of bytes we're - * trying to read. We need to read into a buffer. If read - * returns <0 then we need to check errno. If errno is EAGAIN - * then don't destroy anything, just exit and wait for more - * data. See every other function in libpurple that does this - * correctly for an example. - */ - len = read(directconn->fd, &body_len, sizeof(body_len)); - - if (len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - - msn_directconn_destroy(directconn); - - return; - } - - body_len = GUINT32_FROM_LE(body_len); - - purple_debug_info("msn", "body_len=%" G_GSIZE_FORMAT "\n", body_len); - - if (body_len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - - msn_directconn_destroy(directconn); - - return; - } - - body = g_try_malloc(body_len); - - if (body != NULL) - { - /* Let's read the data. */ - len = read(directconn->fd, body, body_len); - - purple_debug_info("msn", "len=%" G_GSIZE_FORMAT "\n", len); - } - else - { - purple_debug_error("msn", "Failed to allocate memory for read\n"); - len = 0; - } - - if (len > 0) - { - MsnMessage *msg; - -#ifdef DEBUG_DC - str = g_strdup_printf("%s/msntest/r%.4d.bin", g_get_home_dir(), directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(body, 1, len, tf); - fclose(tf); - - g_free(str); -#endif - - directconn->c++; - - msg = msn_message_new_msnslp(); - msn_message_parse_slp_body(msg, body, body_len); - - purple_debug_info("msn", "directconn: process_msg\n"); - msn_slplink_process_msg(directconn->slplink, msg); - } - else - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - - msn_directconn_destroy(directconn); - } - - g_free(body); -} - -static void -connect_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - int fd; - - purple_debug_misc("msn", "directconn: connect_cb: %d, %d.\n", source, cond); - - directconn = data; - directconn->connect_data = NULL; - - if (TRUE) - { - fd = source; - } - else - { - struct sockaddr_in client_addr; - socklen_t client; - fd = accept (source, (struct sockaddr *)&client_addr, &client); - } - - directconn->fd = fd; - - if (fd > 0) - { - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, read_cb, - directconn); - - if (TRUE) - { - /* Send foo. */ - msn_directconn_write(directconn, "foo", strlen("foo") + 1); - - /* Send Handshake */ - msn_directconn_send_handshake(directconn); - } - else - { - } - } - else - { - /* ERROR */ - purple_debug_error("msn", "could not add input\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - } -} - -static void -directconn_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - if (error_message) - purple_debug_error("msn", "Error making direct connection: %s\n", error_message); - - connect_cb(data, source, PURPLE_INPUT_READ); -} - -gboolean -msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) -{ - MsnSession *session; - - g_return_val_if_fail(directconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, TRUE); - g_return_val_if_fail(port > 0, FALSE); - - session = directconn->slplink->session; - -#if 0 - if (session->http_method) - { - servconn->http_data->gateway_host = g_strdup(host); - } -#endif - - directconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, directconn_connect_cb, directconn); - - return (directconn->connect_data != NULL); -} - -void -msn_directconn_listen(MsnDirectConn *directconn) -{ - int port; - int fd; - - port = 7000; - - for (fd = -1; fd < 0;) - fd = create_listener(++port); - - directconn->fd = fd; - - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, connect_cb, - directconn); - - directconn->port = port; - directconn->c = 0; -} - -MsnDirectConn* -msn_directconn_new(MsnSlpLink *slplink) -{ - MsnDirectConn *directconn; - - directconn = g_new0(MsnDirectConn, 1); - - directconn->slplink = slplink; - - if (slplink->directconn != NULL) - purple_debug_info("msn", "got_transresp: LEAK\n"); - - slplink->directconn = directconn; - - return directconn; -} - -void -msn_directconn_destroy(MsnDirectConn *directconn) -{ - if (directconn->connect_data != NULL) - purple_proxy_connect_cancel(directconn->connect_data); - - if (directconn->inpa != 0) - purple_input_remove(directconn->inpa); - - if (directconn->fd >= 0) - close(directconn->fd); - - if (directconn->nonce != NULL) - g_free(directconn->nonce); - - directconn->slplink->directconn = NULL; - - g_free(directconn); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/directconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/** - * @file directconn.h MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_DIRECTCONN_H -#define MSN_DIRECTCONN_H - -typedef struct _MsnDirectConn MsnDirectConn; - -#include "msg.h" -#include "slp.h" -#include "slplink.h" - -struct _MsnDirectConn -{ - MsnSlpLink *slplink; - MsnSlpCall *initial_call; - - PurpleProxyConnectData *connect_data; - - gboolean acked; - - char *nonce; - - int fd; - - int port; - int inpa; - - int c; -}; - -MsnDirectConn *msn_directconn_new(MsnSlpLink *slplink); -gboolean msn_directconn_connect(MsnDirectConn *directconn, - const char *host, int port); -void msn_directconn_listen(MsnDirectConn *directconn); -void msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg); -void msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce); -void msn_directconn_destroy(MsnDirectConn *directconn); -void msn_directconn_send_handshake(MsnDirectConn *directconn); - -#endif /* MSN_DIRECTCONN_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/** - * @file error.c Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "error.h" - -const char * -msn_error_get_text(unsigned int type, gboolean *debug) -{ - static char msg[256]; - const char *result; - *debug = FALSE; - - switch (type) { - case 0: - result = _("Unable to parse message"); - *debug = TRUE; - break; - case 200: - result = _("Syntax Error (probably a client bug)"); - *debug = TRUE; - break; - case 201: - result = _("Invalid email address"); - break; - case 205: - result = _("User does not exist"); - break; - case 206: - result = _("Fully qualified domain name missing"); - break; - case 207: - result = _("Already logged in"); - break; - case 208: - result = _("Invalid username"); - break; - case 209: - result = _("Invalid friendly name"); - break; - case 210: - result = _("List full"); - break; - case 215: - result = _("Already there"); - *debug = TRUE; - break; - case 216: - result = _("Not on list"); - break; - case 217: - result = _("User is offline"); - break; - case 218: - result = _("Already in the mode"); - *debug = TRUE; - break; - case 219: - result = _("Already in opposite list"); - *debug = TRUE; - break; - case 223: - result = _("Too many groups"); - break; - case 224: - result = _("Invalid group"); - break; - case 225: - result = _("User not in group"); - break; - case 229: - result = _("Group name too long"); - break; - case 230: - result = _("Cannot remove group zero"); - *debug = TRUE; - break; - case 231: - result = _("Tried to add a user to a group that doesn't exist"); - break; - case 280: - result = _("Switchboard failed"); - *debug = TRUE; - break; - case 281: - result = _("Notify transfer failed"); - *debug = TRUE; - break; - - case 300: - result = _("Required fields missing"); - *debug = TRUE; - break; - case 301: - result = _("Too many hits to a FND"); - *debug = TRUE; - break; - case 302: - result = _("Not logged in"); - break; - - case 500: - result = _("Service temporarily unavailable"); - break; - case 501: - result = _("Database server error"); - *debug = TRUE; - break; - case 502: - result = _("Command disabled"); - *debug = TRUE; - break; - case 510: - result = _("File operation error"); - *debug = TRUE; - break; - case 520: - result = _("Memory allocation error"); - *debug = TRUE; - break; - case 540: - result = _("Wrong CHL value sent to server"); - *debug = TRUE; - break; - - case 600: - result = _("Server busy"); - break; - case 601: - result = _("Server unavailable"); - break; - case 602: - result = _("Peer notification server down"); - *debug = TRUE; - break; - case 603: - result = _("Database connect error"); - *debug = TRUE; - break; - case 604: - result = _("Server is going down (abandon ship)"); - break; - case 605: - result = _("Server unavailable"); - break; - - case 707: - result = _("Error creating connection"); - *debug = TRUE; - break; - case 710: - result = _("CVR parameters are either unknown or not allowed"); - *debug = TRUE; - break; - case 711: - result = _("Unable to write"); - break; - case 712: - result = _("Session overload"); - *debug = TRUE; - break; - case 713: - result = _("User is too active"); - break; - case 714: - result = _("Too many sessions"); - break; - case 715: - result = _("Passport not verified"); - break; - case 717: - result = _("Bad friend file"); - *debug = TRUE; - break; - case 731: - result = _("Not expected"); - *debug = TRUE; - break; - - case 800: - result = _("Friendly name is changing too rapidly"); - break; - - case 910: - case 912: - case 918: - case 919: - case 921: - case 922: - result = _("Server too busy"); - break; - case 911: - case 917: - result = _("Authentication failed"); - break; - case 913: - result = _("Not allowed when offline"); - break; - case 914: - case 915: - case 916: - result = _("Server unavailable"); - break; - case 920: - result = _("Not accepting new users"); - break; - case 923: - result = _("Kids Passport without parental consent"); - break; - case 924: - result = _("Passport account not yet verified"); - break; - case 927: - result = _("Passport account suspended"); - break; - case 928: - result = _("Bad ticket"); - *debug = TRUE; - break; - - default: - g_snprintf(msg, sizeof(msg), - _("Unknown Error Code %d"), type); - *debug = TRUE; - result = msg; - break; - } - - return result; -} - -void -msn_error_handle(MsnSession *session, unsigned int type) -{ - char *buf; - gboolean debug; - - buf = g_strdup_printf(_("MSN Error: %s\n"), - msn_error_get_text(type, &debug)); - if (debug) - purple_debug_warning("msn", "error %d: %s\n", type, buf); - else - purple_notify_error(session->account->gc, NULL, buf, NULL); - g_free(buf); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/error.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - * @file error.h Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_ERROR_H -#define MSN_ERROR_H - -#include "session.h" - -/** - * Returns the string representation of an error type. - * - * @param type The error type. - * @param debug Whether this should be treated as a debug log message or a user-visible error - * - * @return The string representation of the error type. - */ -const char *msn_error_get_text(unsigned int type, gboolean *debug); - -/** - * Handles an error. - * - * @param session The current session. - * @param type The error type. - */ -void msn_error_handle(MsnSession *session, unsigned int type); - -#endif /* MSN_ERROR_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/** - * @file group.c Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "group.h" - -MsnGroup * -msn_group_new(MsnUserList *userlist, const char *id, const char *name) -{ - MsnGroup *group; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - group = g_new0(MsnGroup, 1); - - msn_userlist_add_group(userlist, group); - - group->id = g_strdup(id); - group->name = g_strdup(name); - - return group; -} - -void -msn_group_destroy(MsnGroup *group) -{ - g_return_if_fail(group != NULL); - - g_free(group->id); - g_free(group->name); - g_free(group); -} - -void -msn_group_set_id(MsnGroup *group, const char *id) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(id != NULL); - - g_free(group->id); - group->id = g_strdup(id); -} - -void -msn_group_set_name(MsnGroup *group, const char *name) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(name != NULL); - - g_free(group->name); - group->name = g_strdup(name); -} - -char* -msn_group_get_id(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->id; -} - -const char * -msn_group_get_name(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->name; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/** - * @file group.h Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_GROUP_H -#define MSN_GROUP_H - -typedef struct _MsnGroup MsnGroup; - -#include <stdio.h> - -#include "session.h" -#include "user.h" -#include "userlist.h" - -#define MSN_INDIVIDUALS_GROUP_ID "1983" -#define MSN_INDIVIDUALS_GROUP_NAME _("Other Contacts") - -#define MSN_NON_IM_GROUP_ID "email" -#define MSN_NON_IM_GROUP_NAME _("Non-IM Contacts") - -/** - * A group. - */ -struct _MsnGroup -{ - MsnSession *session; /**< The MSN session. */ - - char *id; /**< The group ID. */ - char *name; /**< The name of the group. */ -}; - -/************************************************************************** - ** @name Group API * - **************************************************************************/ -/*@{*/ - -/** - * Creates a new group structure. - * - * @param session The MSN session. - * @param id The group ID. - * @param name The name of the group. - * - * @return A new group structure. - */ -MsnGroup *msn_group_new(MsnUserList *userlist, const char *id, const char *name); - -/** - * Destroys a group structure. - * - * @param group The group to destroy. - */ -void msn_group_destroy(MsnGroup *group); - -/** - * Sets the ID for a group. - * - * @param group The group. - * @param id The ID. - */ -void msn_group_set_id(MsnGroup *group, const char *id); - -/** - * Sets the name for a group. - * - * @param group The group. - * @param name The name. - */ -void msn_group_set_name(MsnGroup *group, const char *name); - -/** - * Returns the ID for a group. - * - * @param group The group. - * - * @return The ID. - */ -char* msn_group_get_id(const MsnGroup *group); - -/** - * Returns the name for a group. - * - * @param group The group. - * - * @return The name. - */ -const char *msn_group_get_name(const MsnGroup *group); - -#endif /* MSN_GROUP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file history.c MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "history.h" - -MsnHistory * -msn_history_new(void) -{ - MsnHistory *history = g_new0(MsnHistory, 1); - - history->trId = 1; - - history->queue = g_queue_new(); - - return history; -} - -void -msn_history_destroy(MsnHistory *history) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(history->queue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(history->queue); - g_free(history); -} - -MsnTransaction * -msn_history_find(MsnHistory *history, unsigned int trId) -{ - MsnTransaction *trans; - GList *list; - - for (list = history->queue->head; list != NULL; list = list->next) - { - trans = list->data; - if (trans->trId == trId) - return trans; - } - - return NULL; -} - -void -msn_history_add(MsnHistory *history, MsnTransaction *trans) -{ - GQueue *queue; - int max_elems; - - g_return_if_fail(history != NULL); - g_return_if_fail(trans != NULL); - - queue = history->queue; - - trans->trId = history->trId++; - - g_queue_push_tail(queue, trans); - - if (trans->cmdproc->servconn->type == MSN_SERVCONN_NS) - max_elems = MSN_NS_HIST_ELEMS; - else - max_elems = MSN_SB_HIST_ELEMS; - - if (queue->length > max_elems) - { - trans = g_queue_pop_head(queue); - msn_transaction_destroy(trans); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/history.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file history.h MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_HISTORY_H -#define MSN_HISTORY_H - -typedef struct _MsnHistory MsnHistory; - -#include "transaction.h" - -#define MSN_NS_HIST_ELEMS 0x300 -#define MSN_SB_HIST_ELEMS 0x30 - -/** - * The history. - */ -struct _MsnHistory -{ - GQueue *queue; - unsigned int trId; -}; - -MsnHistory *msn_history_new(void); -void msn_history_destroy(MsnHistory *history); -MsnTransaction *msn_history_find(MsnHistory *history, unsigned int triId); -void msn_history_add(MsnHistory *history, MsnTransaction *trans); - -#endif /* MSN_HISTORY_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,737 +0,0 @@ -/** - * @file httpmethod.c HTTP connection method - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "debug.h" -#include "httpconn.h" - -typedef struct -{ - MsnHttpConn *httpconn; - char *body; - size_t body_len; -} MsnHttpQueueData; - -static void -msn_httpconn_process_queue(MsnHttpConn *httpconn) -{ - httpconn->waiting_response = FALSE; - - if (httpconn->queue != NULL) - { - MsnHttpQueueData *queue_data; - - queue_data = (MsnHttpQueueData *)httpconn->queue->data; - - httpconn->queue = g_list_remove(httpconn->queue, queue_data); - - msn_httpconn_write(queue_data->httpconn, - queue_data->body, - queue_data->body_len); - - g_free(queue_data->body); - g_free(queue_data); - } -} - -static gboolean -msn_httpconn_parse_data(MsnHttpConn *httpconn, const char *buf, - size_t size, char **ret_buf, size_t *ret_size, - gboolean *error) -{ - const char *s, *c; - char *header, *body; - const char *body_start; - char *tmp; - size_t body_len = 0; - - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(buf != NULL, FALSE); - g_return_val_if_fail(size > 0, FALSE); - g_return_val_if_fail(ret_buf != NULL, FALSE); - g_return_val_if_fail(ret_size != NULL, FALSE); - g_return_val_if_fail(error != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "HTTP: parsing data {%s}\n", buf); -#endif - - /* Healthy defaults. */ - body = NULL; - - *ret_buf = NULL; - *ret_size = 0; - *error = FALSE; - - /* First, some tests to see if we have a full block of stuff. */ - if (((strncmp(buf, "HTTP/1.1 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) != 0)) && - ((strncmp(buf, "HTTP/1.0 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.0 100 Continue\r\n", 23) != 0))) - { - *error = TRUE; - - return FALSE; - } - - if (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) == 0) - { - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - return FALSE; - - s += 4; - - if (*s == '\0') - { - *ret_buf = g_strdup(""); - *ret_size = 0; - - msn_httpconn_process_queue(httpconn); - - return TRUE; - } - - buf = s; - size -= (s - buf); - } - - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - /* Need to wait for the full HTTP header to arrive */ - return FALSE; - - s += 4; /* Skip \r\n\r\n */ - header = g_strndup(buf, s - buf); - body_start = s; - body_len = size - (body_start - buf); - - if ((s = purple_strcasestr(header, "Content-Length: ")) != NULL) - { - int tmp_len; - - s += strlen("Content-Length: "); - - if ((c = strchr(s, '\r')) == NULL) - { - g_free(header); - - return FALSE; - } - - tmp = g_strndup(s, c - s); - tmp_len = atoi(tmp); - g_free(tmp); - - if (body_len != tmp_len) - { - /* Need to wait for the full packet to arrive */ - - g_free(header); - -#if 0 - purple_debug_warning("msn", - "body length (%d) != content length (%d)\n", - body_len, tmp_len); -#endif - - return FALSE; - } - } - - body = g_malloc(body_len + 1); - memcpy(body, body_start, body_len); - body[body_len] = '\0'; - - if (purple_debug_is_verbose()) - purple_debug_misc("msn", "Incoming HTTP buffer (header): {%s}\n", - header); - - /* Now we should be able to process the data. */ - if ((s = purple_strcasestr(header, "X-MSN-Messenger: ")) != NULL) - { - gchar *full_session_id = NULL, *gw_ip = NULL, *session_action = NULL; - char *t, *session_id; - char **elems, **cur, **tokens; - - full_session_id = gw_ip = session_action = NULL; - - s += strlen("X-MSN-Messenger: "); - - if ((c = strchr(s, '\r')) == NULL) - { - msn_session_set_error(httpconn->session, - MSN_ERROR_HTTP_MALFORMED, NULL); - purple_debug_error("msn", "Malformed X-MSN-Messenger field.\n{%s}\n", - buf); - - g_free(header); - g_free(body); - return FALSE; - } - - tmp = g_strndup(s, c - s); - - elems = g_strsplit(tmp, "; ", 0); - - for (cur = elems; *cur != NULL; cur++) - { - tokens = g_strsplit(*cur, "=", 2); - - if (strcmp(tokens[0], "SessionID") == 0) { - g_free(full_session_id); - full_session_id = tokens[1]; - } else if (strcmp(tokens[0], "GW-IP") == 0) { - g_free(gw_ip); - gw_ip = tokens[1]; - } else if (strcmp(tokens[0], "Session") == 0) { - g_free(session_action); - session_action = tokens[1]; - } else - g_free(tokens[1]); - - g_free(tokens[0]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - g_free(tmp); - - t = strchr(full_session_id, '.'); - if (t != NULL) - session_id = g_strndup(full_session_id, t - full_session_id); - else { - purple_debug_error("msn", "Malformed full_session_id[%s]\n", - full_session_id ? full_session_id : NULL); - session_id = g_strdup(full_session_id); - } - - if (session_action == NULL || strcmp(session_action, "close") != 0) - { - g_free(httpconn->full_session_id); - httpconn->full_session_id = full_session_id; - - g_free(httpconn->session_id); - httpconn->session_id = session_id; - - g_free(httpconn->host); - httpconn->host = gw_ip; - } - else - { - MsnServConn *servconn; - - /* It's going to die. */ - /* poor thing */ - - servconn = httpconn->servconn; - - /* I'll be honest, I don't fully understand all this, but this - * causes crashes, Stu. */ - /* if (servconn != NULL) - servconn->wasted = TRUE; */ - - g_free(full_session_id); - g_free(session_id); - g_free(gw_ip); - } - - g_free(session_action); - } - - g_free(header); - - *ret_buf = body; - *ret_size = body_len; - - msn_httpconn_process_queue(httpconn); - - return TRUE; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - MsnServConn *servconn; - char buf[MSN_BUF_LEN]; - gssize len; - char *result_msg = NULL; - size_t result_len = 0; - gboolean error = FALSE; - - httpconn = data; - servconn = httpconn->servconn; - - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); - - len = read(httpconn->fd, buf, sizeof(buf) - 1); - if (len < 0 && errno == EAGAIN) - return; - if (len <= 0) { - purple_debug_error("msn", "HTTP: servconn %03d read error, " - "len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n", - servconn->num, len, error, g_strerror(errno)); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - buf[len] = '\0'; - - httpconn->rx_buf = g_realloc(httpconn->rx_buf, len + httpconn->rx_len + 1); - memcpy(httpconn->rx_buf + httpconn->rx_len, buf, len + 1); - httpconn->rx_len += len; - - if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len, - &result_msg, &result_len, &error)) - { - /* Either we must wait for more input, or something went wrong */ - if (error) - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - if (error) - { - purple_debug_error("msn", "HTTP: Special error\n"); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - if (result_len == 0) - { - /* Nothing to do here */ -#if 0 - purple_debug_info("msn", "HTTP: nothing to do here\n"); -#endif - g_free(result_msg); - return; - } - - g_free(servconn->rx_buf); - servconn->rx_buf = result_msg; - servconn->rx_len = result_len; - - msn_servconn_process_data(servconn); -} - -static void -httpconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - gssize ret; - int writelen; - - httpconn = data; - writelen = purple_circ_buffer_get_max_read(httpconn->tx_buf); - - if (writelen == 0) - { - purple_input_remove(httpconn->tx_handler); - httpconn->tx_handler = 0; - return; - } - - ret = write(httpconn->fd, httpconn->tx_buf->outptr, writelen); - if (ret <= 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - /* Error! */ - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - return; - } - - purple_circ_buffer_mark_read(httpconn->tx_buf, ret); - - /* TODO: I don't think these 2 lines are needed. Remove them? */ - if (ret == writelen) - httpconn_write_cb(data, source, cond); -} - -static gboolean -write_raw(MsnHttpConn *httpconn, const char *data, size_t data_len) -{ - gssize res; /* result of the write operation */ - - if (httpconn->tx_handler == 0) - res = write(httpconn->fd, data, data_len); - else - { - res = -1; - errno = EAGAIN; - } - - if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) - { - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - return FALSE; - } - - if (res < 0 || res < data_len) - { - if (res < 0) - res = 0; - if (httpconn->tx_handler == 0 && httpconn->fd) - httpconn->tx_handler = purple_input_add(httpconn->fd, - PURPLE_INPUT_WRITE, httpconn_write_cb, httpconn); - purple_circ_buffer_append(httpconn->tx_buf, data + res, - data_len - res); - } - - return TRUE; -} - -static char * -msn_httpconn_proxy_auth(MsnHttpConn *httpconn) -{ - PurpleAccount *account; - PurpleProxyInfo *gpi; - const char *username, *password; - char *auth = NULL; - - account = httpconn->session->account; - - gpi = purple_proxy_get_setup(account); - - if (gpi == NULL || !(purple_proxy_info_get_type(gpi) == PURPLE_PROXY_HTTP || - purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_ENVVAR)) - return NULL; - - username = purple_proxy_info_get_username(gpi); - password = purple_proxy_info_get_password(gpi); - - if (username != NULL) { - char *tmp; - auth = g_strdup_printf("%s:%s", username, password ? password : ""); - tmp = purple_base64_encode((const guchar *)auth, strlen(auth)); - g_free(auth); - auth = g_strdup_printf("Proxy-Authorization: Basic %s\r\n", tmp); - g_free(tmp); - } - - return auth; -} - -static gboolean -msn_httpconn_poll(gpointer data) -{ - MsnHttpConn *httpconn; - char *header; - char *auth; - - httpconn = data; - - g_return_val_if_fail(httpconn != NULL, FALSE); - - if ((httpconn->host == NULL) || (httpconn->full_session_id == NULL)) - { - /* There's no need to poll if the session is not fully established */ - return TRUE; - } - - if (httpconn->waiting_response) - { - /* There's no need to poll if we're already waiting for a response */ - return TRUE; - } - - auth = msn_httpconn_proxy_auth(httpconn); - - header = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?Action=poll&SessionID=%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: 0\r\n\r\n", - httpconn->host, - httpconn->full_session_id, - httpconn->host, - auth ? auth : ""); - - g_free(auth); - - if (write_raw(httpconn, header, strlen(header))) - httpconn->waiting_response = TRUE; - - g_free(header); - - return TRUE; -} - -gssize -msn_httpconn_write(MsnHttpConn *httpconn, const char *body, size_t body_len) -{ - char *params; - char *data; - int header_len; - char *auth; - const char *server_types[] = { "NS", "SB" }; - const char *server_type; - char *host; - MsnServConn *servconn; - - /* TODO: remove http data from servconn */ - - g_return_val_if_fail(httpconn != NULL, 0); - g_return_val_if_fail(body != NULL, 0); - g_return_val_if_fail(body_len > 0, 0); - - servconn = httpconn->servconn; - - if (httpconn->waiting_response) - { - MsnHttpQueueData *queue_data = g_new0(MsnHttpQueueData, 1); - - queue_data->httpconn = httpconn; - queue_data->body = g_memdup(body, body_len); - queue_data->body_len = body_len; - - httpconn->queue = g_list_append(httpconn->queue, queue_data); - - return body_len; - } - - server_type = server_types[servconn->type]; - - if (httpconn->virgin) - { - /* QuLogic: This doesn't look right to me, but it still seems to work */ - host = MSN_HTTPCONN_SERVER; - - /* The first time servconn->host is the host we should connect to. */ - params = g_strdup_printf("Action=open&Server=%s&IP=%s", - server_type, - servconn->host); - httpconn->virgin = FALSE; - } - else - { - /* The rest of the times servconn->host is the gateway host. */ - host = httpconn->host; - - if (host == NULL || httpconn->full_session_id == NULL) - { - purple_debug_warning("msn", "Attempted HTTP write before session is established\n"); - return -1; - } - - params = g_strdup_printf("SessionID=%s", - httpconn->full_session_id); - } - - auth = msn_httpconn_proxy_auth(httpconn); - - data = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: %d\r\n\r\n", - host, - params, - host, - auth ? auth : "", - (int) body_len); - - g_free(params); - - g_free(auth); - - header_len = strlen(data); - data = g_realloc(data, header_len + body_len); - memcpy(data + header_len, body, body_len); - - if (write_raw(httpconn, data, header_len + body_len)) - httpconn->waiting_response = TRUE; - - g_free(data); - - return body_len; -} - -MsnHttpConn * -msn_httpconn_new(MsnServConn *servconn) -{ - MsnHttpConn *httpconn; - - g_return_val_if_fail(servconn != NULL, NULL); - - httpconn = g_new0(MsnHttpConn, 1); - - purple_debug_info("msn", "new httpconn (%p)\n", httpconn); - - /* TODO: Remove this */ - httpconn->session = servconn->session; - - httpconn->servconn = servconn; - - httpconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - httpconn->tx_handler = 0; - - httpconn->fd = -1; - - return httpconn; -} - -void -msn_httpconn_destroy(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - purple_debug_info("msn", "destroy httpconn (%p)\n", httpconn); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - g_free(httpconn->full_session_id); - - g_free(httpconn->session_id); - - g_free(httpconn->host); - - while (httpconn->queue != NULL) { - MsnHttpQueueData *queue_data; - - queue_data = (MsnHttpQueueData *) httpconn->queue->data; - - httpconn->queue = g_list_delete_link(httpconn->queue, httpconn->queue); - - g_free(queue_data->body); - g_free(queue_data); - } - - purple_circ_buffer_destroy(httpconn->tx_buf); - if (httpconn->tx_handler > 0) - purple_input_remove(httpconn->tx_handler); - - g_free(httpconn); -} - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - MsnHttpConn *httpconn; - - httpconn = data; - httpconn->connect_data = NULL; - httpconn->fd = source; - - if (source >= 0) - { - httpconn->inpa = purple_input_add(httpconn->fd, PURPLE_INPUT_READ, - read_cb, data); - - httpconn->timer = purple_timeout_add_seconds(2, msn_httpconn_poll, httpconn); - - msn_httpconn_process_queue(httpconn); - } - else - { - purple_debug_error("msn", "HTTP: Connection error: %s\n", - error_message ? error_message : "(null)"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT, error_message); - } -} - -gboolean -msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port) -{ - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - httpconn->connect_data = purple_proxy_connect(NULL, httpconn->session->account, - host, 80, connect_cb, httpconn); - - if (httpconn->connect_data != NULL) - { - httpconn->waiting_response = TRUE; - httpconn->connected = TRUE; - } - - return httpconn->connected; -} - -void -msn_httpconn_disconnect(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - if (!httpconn->connected) - return; - - if (httpconn->connect_data != NULL) - { - purple_proxy_connect_cancel(httpconn->connect_data); - httpconn->connect_data = NULL; - } - - if (httpconn->timer) - { - purple_timeout_remove(httpconn->timer); - httpconn->timer = 0; - } - - if (httpconn->inpa > 0) - { - purple_input_remove(httpconn->inpa); - httpconn->inpa = 0; - } - - close(httpconn->fd); - httpconn->fd = -1; - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - httpconn->connected = FALSE; - - /* msn_servconn_disconnect(httpconn->servconn); */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/httpconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/** - * @file httpconn.h HTTP connection - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_HTTPCONN_H -#define MSN_HTTPCONN_H - -typedef struct _MsnHttpConn MsnHttpConn; - -#include "circbuffer.h" -#include "servconn.h" - -/** - * An HTTP Connection. - */ -struct _MsnHttpConn -{ - MsnSession *session; /**< The MSN Session. */ - MsnServConn *servconn; /**< The connection object. */ - - PurpleProxyConnectData *connect_data; - - char *full_session_id; /**< The full session id. */ - char *session_id; /**< The trimmed session id. */ - - int timer; /**< The timer for polling. */ - - gboolean waiting_response; /**< The flag that states if we are waiting - a response from the server. */ - gboolean connected; /**< The flag that states if the connection is on. */ - gboolean virgin; /**< The flag that states if this connection - should specify the host (not gateway) to - connect to. */ - - char *host; /**< The HTTP gateway host. */ - GList *queue; /**< The queue of data chunks to write. */ - - int fd; /**< The connection's file descriptor. */ - guint inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer length. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; -}; - -/** - * Creates a new HTTP connection object. - * - * @param servconn The connection object. - * - * @return The new object. - */ -MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); - -/** - * Destroys an HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_destroy(MsnHttpConn *httpconn); - -/** - * Writes a chunk of data to the HTTP connection. - * - * @param servconn The server connection. - * @param data The data to write. - * @param data_len The size of the data to write. - * - * @return The number of bytes written. - */ -gssize msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len); - -/** - * Connects the HTTP connection object to a host. - * - * @param httpconn The HTTP connection object. - * @param host The host to connect to. - * @param port The port to connect to. - */ -gboolean msn_httpconn_connect(MsnHttpConn *httpconn, - const char *host, int port); - -/** - * Disconnects the HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_disconnect(MsnHttpConn *httpconn); - -#endif /* MSN_HTTPCONN_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -EXTRA_DIST = \ - directconn.c \ - directconn.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MSNSOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - contact.c\ - contact.h\ - dialog.c \ - dialog.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - oim.c\ - oim.h\ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - soap.c \ - soap.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msnutils.c \ - msnutils.h - -AM_CFLAGS = $(st) - -libmsn_la_LDFLAGS = -module -avoid-version - -if STATIC_MSN - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNSOURCES) -libmsn_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNSOURCES) -libmsn_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1051 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/msn -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MSN_FALSE@libmsn_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libmsn_la_SOURCES_DIST = cmdproc.c cmdproc.h command.c command.h \ - contact.c contact.h dialog.c dialog.h error.c error.h group.c \ - group.h history.c history.h httpconn.c httpconn.h msg.c msg.h \ - msn.c msn.h nexus.c nexus.h notification.c notification.h \ - object.c object.h oim.c oim.h page.c page.h servconn.c \ - servconn.h session.c session.h slp.c slp.h slpcall.c slpcall.h \ - slplink.c slplink.h slpmsg.c slpmsg.h soap.c soap.h state.c \ - state.h switchboard.c switchboard.h sync.c sync.h table.c \ - table.h transaction.c transaction.h user.c user.h userlist.c \ - userlist.h msnutils.c msnutils.h -am__objects_1 = libmsn_la-cmdproc.lo libmsn_la-command.lo \ - libmsn_la-contact.lo libmsn_la-dialog.lo libmsn_la-error.lo \ - libmsn_la-group.lo libmsn_la-history.lo libmsn_la-httpconn.lo \ - libmsn_la-msg.lo libmsn_la-msn.lo libmsn_la-nexus.lo \ - libmsn_la-notification.lo libmsn_la-object.lo libmsn_la-oim.lo \ - libmsn_la-page.lo libmsn_la-servconn.lo libmsn_la-session.lo \ - libmsn_la-slp.lo libmsn_la-slpcall.lo libmsn_la-slplink.lo \ - libmsn_la-slpmsg.lo libmsn_la-soap.lo libmsn_la-state.lo \ - libmsn_la-switchboard.lo libmsn_la-sync.lo libmsn_la-table.lo \ - libmsn_la-transaction.lo libmsn_la-user.lo \ - libmsn_la-userlist.lo libmsn_la-msnutils.lo -@STATIC_MSN_FALSE@am_libmsn_la_OBJECTS = $(am__objects_1) -@STATIC_MSN_TRUE@am_libmsn_la_OBJECTS = $(am__objects_1) -libmsn_la_OBJECTS = $(am_libmsn_la_OBJECTS) -@STATIC_MSN_FALSE@am_libmsn_la_rpath = -rpath $(pkgdir) -@STATIC_MSN_TRUE@am_libmsn_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmsn_la_SOURCES) -DIST_SOURCES = $(am__libmsn_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - directconn.c \ - directconn.h \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MSNSOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - contact.c\ - contact.h\ - dialog.c \ - dialog.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - oim.c\ - oim.h\ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - soap.c \ - soap.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msnutils.c \ - msnutils.h - -AM_CFLAGS = $(st) -libmsn_la_LDFLAGS = -module -avoid-version -@STATIC_MSN_FALSE@st = -@STATIC_MSN_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MSN_TRUE@noinst_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_SOURCES = $(MSNSOURCES) -@STATIC_MSN_TRUE@libmsn_la_SOURCES = $(MSNSOURCES) -@STATIC_MSN_TRUE@libmsn_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MSN_FALSE@pkg_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/msn/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/msn/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmsn.la: $(libmsn_la_OBJECTS) $(libmsn_la_DEPENDENCIES) - $(LINK) $(am_libmsn_la_rpath) $(libmsn_la_LDFLAGS) $(libmsn_la_OBJECTS) $(libmsn_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-cmdproc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-command.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-contact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-dialog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-history.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-httpconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msnutils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-nexus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-notification.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-oim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-page.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-servconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpcall.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slplink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpmsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-soap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-state.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-switchboard.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-sync.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-table.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-transaction.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-userlist.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmsn_la-cmdproc.lo: cmdproc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-cmdproc.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-cmdproc.Tpo" -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo" "$(DEPDIR)/libmsn_la-cmdproc.Plo"; else rm -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdproc.c' object='libmsn_la-cmdproc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c - -libmsn_la-command.lo: command.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-command.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-command.Tpo" -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-command.Tpo" "$(DEPDIR)/libmsn_la-command.Plo"; else rm -f "$(DEPDIR)/libmsn_la-command.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='command.c' object='libmsn_la-command.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c - -libmsn_la-contact.lo: contact.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-contact.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-contact.Tpo" -c -o libmsn_la-contact.lo `test -f 'contact.c' || echo '$(srcdir)/'`contact.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-contact.Tpo" "$(DEPDIR)/libmsn_la-contact.Plo"; else rm -f "$(DEPDIR)/libmsn_la-contact.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='contact.c' object='libmsn_la-contact.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-contact.lo `test -f 'contact.c' || echo '$(srcdir)/'`contact.c - -libmsn_la-dialog.lo: dialog.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-dialog.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-dialog.Tpo" -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-dialog.Tpo" "$(DEPDIR)/libmsn_la-dialog.Plo"; else rm -f "$(DEPDIR)/libmsn_la-dialog.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dialog.c' object='libmsn_la-dialog.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c - -libmsn_la-error.lo: error.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-error.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-error.Tpo" -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-error.Tpo" "$(DEPDIR)/libmsn_la-error.Plo"; else rm -f "$(DEPDIR)/libmsn_la-error.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libmsn_la-error.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c - -libmsn_la-group.lo: group.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-group.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-group.Tpo" -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-group.Tpo" "$(DEPDIR)/libmsn_la-group.Plo"; else rm -f "$(DEPDIR)/libmsn_la-group.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group.c' object='libmsn_la-group.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c - -libmsn_la-history.lo: history.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-history.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-history.Tpo" -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-history.Tpo" "$(DEPDIR)/libmsn_la-history.Plo"; else rm -f "$(DEPDIR)/libmsn_la-history.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='history.c' object='libmsn_la-history.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c - -libmsn_la-httpconn.lo: httpconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-httpconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-httpconn.Tpo" -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-httpconn.Tpo" "$(DEPDIR)/libmsn_la-httpconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-httpconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='httpconn.c' object='libmsn_la-httpconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c - -libmsn_la-msg.lo: msg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msg.Tpo" -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msg.Tpo" "$(DEPDIR)/libmsn_la-msg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msg.c' object='libmsn_la-msg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c - -libmsn_la-msn.lo: msn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msn.Tpo" -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msn.Tpo" "$(DEPDIR)/libmsn_la-msn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msn.c' object='libmsn_la-msn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c - -libmsn_la-nexus.lo: nexus.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-nexus.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-nexus.Tpo" -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-nexus.Tpo" "$(DEPDIR)/libmsn_la-nexus.Plo"; else rm -f "$(DEPDIR)/libmsn_la-nexus.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nexus.c' object='libmsn_la-nexus.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c - -libmsn_la-notification.lo: notification.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-notification.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-notification.Tpo" -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-notification.Tpo" "$(DEPDIR)/libmsn_la-notification.Plo"; else rm -f "$(DEPDIR)/libmsn_la-notification.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='notification.c' object='libmsn_la-notification.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c - -libmsn_la-object.lo: object.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-object.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-object.Tpo" -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-object.Tpo" "$(DEPDIR)/libmsn_la-object.Plo"; else rm -f "$(DEPDIR)/libmsn_la-object.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='object.c' object='libmsn_la-object.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c - -libmsn_la-oim.lo: oim.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-oim.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-oim.Tpo" -c -o libmsn_la-oim.lo `test -f 'oim.c' || echo '$(srcdir)/'`oim.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-oim.Tpo" "$(DEPDIR)/libmsn_la-oim.Plo"; else rm -f "$(DEPDIR)/libmsn_la-oim.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oim.c' object='libmsn_la-oim.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-oim.lo `test -f 'oim.c' || echo '$(srcdir)/'`oim.c - -libmsn_la-page.lo: page.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-page.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-page.Tpo" -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-page.Tpo" "$(DEPDIR)/libmsn_la-page.Plo"; else rm -f "$(DEPDIR)/libmsn_la-page.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='page.c' object='libmsn_la-page.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c - -libmsn_la-servconn.lo: servconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-servconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-servconn.Tpo" -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-servconn.Tpo" "$(DEPDIR)/libmsn_la-servconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-servconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='servconn.c' object='libmsn_la-servconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c - -libmsn_la-session.lo: session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-session.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-session.Tpo" -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-session.Tpo" "$(DEPDIR)/libmsn_la-session.Plo"; else rm -f "$(DEPDIR)/libmsn_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='session.c' object='libmsn_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmsn_la-slp.lo: slp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slp.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slp.Tpo" -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slp.Tpo" "$(DEPDIR)/libmsn_la-slp.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slp.c' object='libmsn_la-slp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c - -libmsn_la-slpcall.lo: slpcall.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpcall.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpcall.Tpo" -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpcall.Tpo" "$(DEPDIR)/libmsn_la-slpcall.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpcall.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpcall.c' object='libmsn_la-slpcall.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c - -libmsn_la-slplink.lo: slplink.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slplink.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slplink.Tpo" -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slplink.Tpo" "$(DEPDIR)/libmsn_la-slplink.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slplink.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slplink.c' object='libmsn_la-slplink.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c - -libmsn_la-slpmsg.lo: slpmsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpmsg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpmsg.Tpo" -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo" "$(DEPDIR)/libmsn_la-slpmsg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpmsg.c' object='libmsn_la-slpmsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c - -libmsn_la-soap.lo: soap.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-soap.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-soap.Tpo" -c -o libmsn_la-soap.lo `test -f 'soap.c' || echo '$(srcdir)/'`soap.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-soap.Tpo" "$(DEPDIR)/libmsn_la-soap.Plo"; else rm -f "$(DEPDIR)/libmsn_la-soap.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='soap.c' object='libmsn_la-soap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-soap.lo `test -f 'soap.c' || echo '$(srcdir)/'`soap.c - -libmsn_la-state.lo: state.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-state.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-state.Tpo" -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-state.Tpo" "$(DEPDIR)/libmsn_la-state.Plo"; else rm -f "$(DEPDIR)/libmsn_la-state.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='state.c' object='libmsn_la-state.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c - -libmsn_la-switchboard.lo: switchboard.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-switchboard.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-switchboard.Tpo" -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-switchboard.Tpo" "$(DEPDIR)/libmsn_la-switchboard.Plo"; else rm -f "$(DEPDIR)/libmsn_la-switchboard.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='switchboard.c' object='libmsn_la-switchboard.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c - -libmsn_la-sync.lo: sync.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-sync.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-sync.Tpo" -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-sync.Tpo" "$(DEPDIR)/libmsn_la-sync.Plo"; else rm -f "$(DEPDIR)/libmsn_la-sync.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sync.c' object='libmsn_la-sync.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c - -libmsn_la-table.lo: table.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-table.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-table.Tpo" -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-table.Tpo" "$(DEPDIR)/libmsn_la-table.Plo"; else rm -f "$(DEPDIR)/libmsn_la-table.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='table.c' object='libmsn_la-table.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c - -libmsn_la-transaction.lo: transaction.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-transaction.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-transaction.Tpo" -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-transaction.Tpo" "$(DEPDIR)/libmsn_la-transaction.Plo"; else rm -f "$(DEPDIR)/libmsn_la-transaction.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transaction.c' object='libmsn_la-transaction.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c - -libmsn_la-user.lo: user.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-user.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-user.Tpo" -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-user.Tpo" "$(DEPDIR)/libmsn_la-user.Plo"; else rm -f "$(DEPDIR)/libmsn_la-user.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='user.c' object='libmsn_la-user.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c - -libmsn_la-userlist.lo: userlist.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-userlist.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-userlist.Tpo" -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-userlist.Tpo" "$(DEPDIR)/libmsn_la-userlist.Plo"; else rm -f "$(DEPDIR)/libmsn_la-userlist.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='userlist.c' object='libmsn_la-userlist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c - -libmsn_la-msnutils.lo: msnutils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msnutils.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msnutils.Tpo" -c -o libmsn_la-msnutils.lo `test -f 'msnutils.c' || echo '$(srcdir)/'`msnutils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msnutils.Tpo" "$(DEPDIR)/libmsn_la-msnutils.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msnutils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msnutils.c' object='libmsn_la-msnutils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msnutils.lo `test -f 'msnutils.c' || echo '$(srcdir)/'`msnutils.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmsn -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmsn -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = cmdproc.c \ - command.c \ - contact.c\ - dialog.c \ - error.c \ - group.c \ - history.c \ - httpconn.c \ - msg.c \ - msn.c \ - nexus.c \ - notification.c \ - object.c \ - oim.c\ - page.c \ - servconn.c \ - session.c \ - slp.c \ - slpcall.c \ - slplink.c \ - slpmsg.c \ - soap.c\ - state.c \ - switchboard.c \ - sync.c \ - table.c \ - transaction.c \ - user.c \ - userlist.c \ - msnutils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1204 +0,0 @@ -/** - * @file msg.c Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msg.h" -#include "msnutils.h" - -MsnMessage * -msn_message_new(MsnMsgType type) -{ - MsnMessage *msg; - - msg = g_new0(MsnMessage, 1); - msg->type = type; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); - - msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - msn_message_ref(msg); - - return msg; -} - -void -msn_message_destroy(MsnMessage *msg) -{ - g_return_if_fail(msg != NULL); - - if (msg->ref_count > 0) - { - msn_message_unref(msg); - - return; - } - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message destroy (%p)\n", msg); - - g_free(msg->remote_user); - g_free(msg->body); - g_free(msg->content_type); - g_free(msg->charset); - - g_hash_table_destroy(msg->attr_table); - g_list_free(msg->attr_list); - - g_free(msg); -} - -MsnMessage * -msn_message_ref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - msg->ref_count++; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message ref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); - - return msg; -} - -MsnMessage * -msn_message_unref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->ref_count > 0, NULL); - - msg->ref_count--; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "message unref (%p)[%" G_GSIZE_FORMAT "]\n", msg, msg->ref_count); - - if (msg->ref_count == 0) - { - msn_message_destroy(msg); - - return NULL; - } - - return msg; -} - -MsnMessage * -msn_message_new_plain(const char *message) -{ - MsnMessage *msg; - char *message_cr; - - msg = msn_message_new(MSN_MSG_TEXT); - msg->retries = 1; - msn_message_set_attr(msg, "User-Agent", PACKAGE_NAME "/" VERSION); - msn_message_set_content_type(msg, "text/plain"); - msn_message_set_charset(msg, "UTF-8"); - msn_message_set_flag(msg, 'A'); - msn_message_set_attr(msg, "X-MMS-IM-Format", - "FN=Segoe%20UI; EF=; CO=0; CS=1;PF=0"); - - message_cr = purple_str_add_cr(message); - msn_message_set_bin_data(msg, message_cr, strlen(message_cr)); - g_free(message_cr); - - return msg; -} - -MsnMessage * -msn_message_new_msnslp(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_SLP); - - msn_message_set_attr(msg, "User-Agent", NULL); - - msg->msnslp_message = TRUE; - - msn_message_set_flag(msg, 'D'); - msn_message_set_content_type(msg, "application/x-msnmsgrp2p"); - - return msg; -} - -MsnMessage * -msn_message_new_nudge(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_NUDGE); - msn_message_set_content_type(msg, "text/x-msnmsgr-datacast"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, "ID: 1\r\n", 7); - - return msg; -} - -void -msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) -{ - MsnSlpHeader header; - const char *tmp; - int body_len; - - tmp = body; - - if (len < sizeof(header)) { - g_return_if_reached(); - } - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - /* Import the body. */ - body_len = len - (tmp - body); - /* msg->body_len = msg->msnslp_header.length; */ - - if (body_len > 0) { - msg->body_len = len - (tmp - body); - msg->body = g_malloc(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - msg->body[msg->body_len] = '\0'; - tmp += body_len; - } -} - -void -msn_message_parse_payload(MsnMessage *msg, - const char *payload, size_t payload_len, - const char *line_dem,const char *body_dem) -{ - char *tmp_base, *tmp; - const char *content_type; - char *end; - char **elems, **cur, **tokens; - - g_return_if_fail(payload != NULL); - tmp_base = tmp = g_malloc(payload_len + 1); - memcpy(tmp_base, payload, payload_len); - tmp_base[payload_len] = '\0'; - - /* Parse the attributes. */ - end = strstr(tmp, body_dem); - /* TODO? some clients use \r delimiters instead of \r\n, the official client - * doesn't send such messages, but does handle receiving them. We'll just - * avoid crashing for now */ - if (end == NULL) { - g_free(tmp_base); - g_return_if_reached(); - } - *end = '\0'; - - elems = g_strsplit(tmp, line_dem, 0); - - for (cur = elems; *cur != NULL; cur++) - { - const char *key, *value; - - /* If this line starts with whitespace, it's been folded from the - previous line and won't have ':'. */ - if ((**cur == ' ') || (**cur == '\t')) { - tokens = g_strsplit(g_strchug(*cur), "=\"", 2); - key = tokens[0]; - value = tokens[1]; - - /* The only one I care about is 'boundary' (which is folded from - the key 'Content-Type'), so only process that. */ - if (!strcmp(key, "boundary")) { - char *end = strchr(value, '\"'); - *end = '\0'; - msn_message_set_attr(msg, key, value); - } - - g_strfreev(tokens); - continue; - } - - tokens = g_strsplit(*cur, ": ", 2); - - key = tokens[0]; - value = tokens[1]; - - /*if not MIME content ,then return*/ - if (!strcmp(key, "MIME-Version")) - { - g_strfreev(tokens); - continue; - } - - if (!strcmp(key, "Content-Type")) - { - char *charset, *c; - - if ((c = strchr(value, ';')) != NULL) - { - if ((charset = strchr(c, '=')) != NULL) - { - charset++; - msn_message_set_charset(msg, charset); - } - - *c = '\0'; - } - - msn_message_set_content_type(msg, value); - } - else - { - msn_message_set_attr(msg, key, value); - } - - g_strfreev(tokens); - } - - g_strfreev(elems); - - /* Proceed to the end of the "\r\n\r\n" */ - tmp = end + strlen(body_dem); - - /* Now we *should* be at the body. */ - content_type = msn_message_get_content_type(msg); - - if (content_type != NULL && - !strcmp(content_type, "application/x-msnmsgrp2p")) - { - MsnSlpHeader header; - MsnSlpFooter footer; - int body_len; - - if (payload_len - (tmp - tmp_base) < sizeof(header)) { - g_free(tmp_base); - g_return_if_reached(); - } - - msg->msnslp_message = TRUE; - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - body_len = payload_len - (tmp - tmp_base) - sizeof(footer); - - /* Import the body. */ - if (body_len > 0) { - msg->body_len = body_len; - g_free(msg->body); - msg->body = g_malloc(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - msg->body[msg->body_len] = '\0'; - tmp += body_len; - } - - /* Import the footer. */ - if (body_len >= 0) { - memcpy(&footer, tmp, sizeof(footer)); - tmp += sizeof(footer); - msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); - } - } - else - { - if (payload_len - (tmp - tmp_base) > 0) { - msg->body_len = payload_len - (tmp - tmp_base); - g_free(msg->body); - msg->body = g_malloc(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - msg->body[msg->body_len] = '\0'; - } - - if ((!content_type || !strcmp(content_type, "text/plain")) - && msg->charset == NULL) { - char *body = g_convert(msg->body, msg->body_len, "UTF-8", - "ISO-8859-1", NULL, &msg->body_len, NULL); - g_free(msg->body); - msg->body = body; - msg->charset = g_strdup("UTF-8"); - } - } - - g_free(tmp_base); -} - -MsnMessage * -msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd) -{ - MsnMessage *msg; - - g_return_val_if_fail(cmd != NULL, NULL); - - msg = msn_message_new(MSN_MSG_UNKNOWN); - - msg->remote_user = g_strdup(cmd->params[0]); - /* msg->size = atoi(cmd->params[2]); */ - msg->cmd = cmd; - - return msg; -} - -char * -msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) -{ - MsnSlpHeader header; - - char *tmp, *base; - const void *body; - size_t len, body_len; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = tmp = g_malloc(len + 1); - - body = msn_message_get_bin_data(msg, &body_len); - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(tmp, &header, 48); - tmp += 48; - - if (body != NULL) - { - memcpy(tmp, body, body_len); - tmp += body_len; - } - - if (ret_size != NULL) - *ret_size = tmp - base; - - return base; -} - -char * -msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) -{ - GList *l; - char *n, *base, *end; - int len; - size_t body_len = 0; - const void *body; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = n = end = g_malloc(len + 1); - end += len; - - /* Standard header. */ - if (msg->charset == NULL) - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - n += strlen(n); - - for (l = msg->attr_list; l != NULL; l = l->next) - { - const char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_snprintf(n, end - n, "%s: %s\r\n", key, value); - n += strlen(n); - } - - n += g_strlcpy(n, "\r\n", end - n); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - MsnSlpHeader header; - MsnSlpFooter footer; - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(n, &header, 48); - n += 48; - - if (body != NULL) - { - memcpy(n, body, body_len); - - n += body_len; - } - - footer.value = GUINT32_TO_BE(msg->msnslp_footer.value); - - memcpy(n, &footer, 4); - n += 4; - } - else - { - if (body != NULL) - { - memcpy(n, body, body_len); - n += body_len; - *n = '\0'; - } - } - - if (ret_size != NULL) - { - *ret_size = n - base; - - if (*ret_size > 1664) - *ret_size = 1664; - } - - return base; -} - -void -msn_message_set_flag(MsnMessage *msg, char flag) -{ - g_return_if_fail(msg != NULL); - g_return_if_fail(flag != 0); - - msg->flag = flag; -} - -char -msn_message_get_flag(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, 0); - - return msg->flag; -} - -void -msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len) -{ - g_return_if_fail(msg != NULL); - - /* There is no need to waste memory on data we cannot send anyway */ - if (len > 1664) - len = 1664; - - if (msg->body != NULL) - g_free(msg->body); - - if (data != NULL && len > 0) - { - msg->body = g_malloc(len + 1); - memcpy(msg->body, data, len); - msg->body[len] = '\0'; - msg->body_len = len; - } - else - { - msg->body = NULL; - msg->body_len = 0; - } -} - -const void * -msn_message_get_bin_data(const MsnMessage *msg, size_t *len) -{ - g_return_val_if_fail(msg != NULL, NULL); - - if (len) - *len = msg->body_len; - - return msg->body; -} - -void -msn_message_set_content_type(MsnMessage *msg, const char *type) -{ - g_return_if_fail(msg != NULL); - - g_free(msg->content_type); - msg->content_type = g_strdup(type); -} - -const char * -msn_message_get_content_type(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->content_type; -} - -void -msn_message_set_charset(MsnMessage *msg, const char *charset) -{ - g_return_if_fail(msg != NULL); - - g_free(msg->charset); - msg->charset = g_strdup(charset); -} - -const char * -msn_message_get_charset(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->charset; -} - -void -msn_message_set_attr(MsnMessage *msg, const char *attr, const char *value) -{ - const char *temp; - char *new_attr; - - g_return_if_fail(msg != NULL); - g_return_if_fail(attr != NULL); - - temp = msn_message_get_attr(msg, attr); - - if (value == NULL) - { - if (temp != NULL) - { - GList *l; - - for (l = msg->attr_list; l != NULL; l = l->next) - { - if (!g_ascii_strcasecmp(l->data, attr)) - { - msg->attr_list = g_list_remove(msg->attr_list, l->data); - - break; - } - } - - g_hash_table_remove(msg->attr_table, attr); - } - - return; - } - - new_attr = g_strdup(attr); - - g_hash_table_insert(msg->attr_table, new_attr, g_strdup(value)); - - if (temp == NULL) - msg->attr_list = g_list_append(msg->attr_list, new_attr); -} - -const char * -msn_message_get_attr(const MsnMessage *msg, const char *attr) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(attr != NULL, NULL); - - return g_hash_table_lookup(msg->attr_table, attr); -} - -GHashTable * -msn_message_get_hashtable_from_body(const MsnMessage *msg) -{ - GHashTable *table; - size_t body_len; - const char *body; - char **elems, **cur, **tokens, *body_str; - - g_return_val_if_fail(msg != NULL, NULL); - - table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - body = msn_message_get_bin_data(msg, &body_len); - - g_return_val_if_fail(body != NULL, NULL); - - body_str = g_strndup(body, body_len); - elems = g_strsplit(body_str, "\r\n", 0); - g_free(body_str); - - for (cur = elems; *cur != NULL; cur++) - { - if (**cur == '\0') - break; - - tokens = g_strsplit(*cur, ": ", 2); - - if (tokens[0] != NULL && tokens[1] != NULL) { - g_hash_table_insert(table, tokens[0], tokens[1]); - g_free(tokens); - } else - g_strfreev(tokens); - } - - g_strfreev(elems); - - return table; -} - -char * -msn_message_to_string(MsnMessage *msg) -{ - size_t body_len; - const char *body; - - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->type == MSN_MSG_TEXT, NULL); - - body = msn_message_get_bin_data(msg, &body_len); - - return g_strndup(body, body_len); -} - -void -msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body) -{ - GString *str; - size_t body_len; - const char *body; - GList *l; - - g_return_if_fail(msg != NULL); - - str = g_string_new(NULL); - - /* Standard header. */ - if (msg->charset == NULL) - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - for (l = msg->attr_list; l; l = l->next) - { - char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_string_append_printf(str, "%s: %s\r\n", key, value); - } - - g_string_append(str, "\r\n"); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - g_string_append_printf(str, "Session ID: %u\r\n", msg->msnslp_header.session_id); - g_string_append_printf(str, "ID: %u\r\n", msg->msnslp_header.id); - g_string_append_printf(str, "Offset: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.offset); - g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.total_size); - g_string_append_printf(str, "Length: %u\r\n", msg->msnslp_header.length); - g_string_append_printf(str, "Flags: 0x%x\r\n", msg->msnslp_header.flags); - g_string_append_printf(str, "ACK ID: %u\r\n", msg->msnslp_header.ack_id); - g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); - g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.ack_size); - - if (purple_debug_is_verbose() && body != NULL) - { - if (text_body) - { - g_string_append_len(str, body, body_len); - if (body[body_len - 1] == '\0') - { - str->len--; - g_string_append(str, " 0x00"); - } - g_string_append(str, "\r\n"); - } - else - { - int i; - for (i = 0; i < msg->body_len; i++) - { - g_string_append_printf(str, "%.2hhX ", body[i]); - if ((i % 16) == 15) - g_string_append(str, "\r\n"); - } - g_string_append(str, "\r\n"); - } - } - - g_string_append_printf(str, "Footer: %u\r\n", msg->msnslp_footer.value); - } - else - { - if (body != NULL) - { - g_string_append_len(str, body, body_len); - g_string_append(str, "\r\n"); - } - } - - purple_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); - - g_string_free(str, TRUE); -} - -/************************************************************************** - * Message Handlers - **************************************************************************/ -void -msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - const char *body; - char *body_str; - char *body_enc; - char *body_final; - size_t body_len; - const char *passport; - const char *value; - - gc = cmdproc->session->account->gc; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - passport = msg->remote_user; - - if (!strcmp(passport, "messenger@microsoft.com") && - strstr(body, "immediate security update")) - { - return; - } - -#if 0 - if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL) - { - purple_debug_misc("msn", "User-Agent = '%s'\n", value); - } -#endif - - if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) - { - char *pre, *post; - - msn_parse_format(value, &pre, &post); - - body_final = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - - g_free(pre); - g_free(post); - g_free(body_enc); - } - else - { - body_final = body_enc; - } - - if (cmdproc->servconn->type == MSN_SERVCONN_SB) { - MsnSwitchBoard *swboard = cmdproc->data; - - swboard->flag |= MSN_SB_FLAG_IM; - - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* If current_users is always ok as it should then there is no need to - * check if this is a chat. */ - if (swboard->current_users <= 1) - purple_debug_misc("msn", "plain_msg: current_users(%d)\n", - swboard->current_users); - - serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, - time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_chat(gc, swboard->chat_id); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - else - { - serv_got_im(gc, passport, body_final, 0, time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - passport, purple_connection_get_account(gc)); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - - } else { - serv_got_im(gc, passport, body_final, 0, time(NULL)); - } - - g_free(body_final); -} - -void -msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - char *passport; - - gc = cmdproc->session->account->gc; - passport = msg->remote_user; - - if (msn_message_get_attr(msg, "TypingUser") == NULL) - return; - - if (cmdproc->servconn->type == MSN_SERVCONN_SB) { - MsnSwitchBoard *swboard = cmdproc->data; - - if (swboard->current_users == 1) - { - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } - - } else { - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } -} - -static void -datacast_inform_user(MsnSwitchBoard *swboard, const char *who, - const char *msg, const char *filename) -{ - char *username, *str; - PurpleAccount *account; - PurpleBuddy *b; - - account = swboard->session->account; - - if ((b = purple_find_buddy(account, who)) != NULL) - username = g_markup_escape_text(purple_buddy_get_alias(b), -1); - else - username = g_markup_escape_text(who, -1); - str = g_strdup_printf(msg, username, filename); - g_free(username); - - if (swboard->conv == NULL) { - if (swboard->current_users > 1) - swboard->conv = purple_find_chat(account->gc, swboard->chat_id); - else { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - who, account); - if (swboard->conv == NULL) - swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, who); - } - } - swboard->flag |= MSN_SB_FLAG_IM; - - purple_conversation_write(swboard->conv, NULL, str, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - -} - -/* TODO: Make these not be such duplicates of each other */ -static void -got_wink_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) -{ - FILE *f; - char *path = NULL; - const char *who = slpcall->slplink->remote_user; - purple_debug_info("msn", "Received wink from %s\n", who); - - if ((f = purple_mkstemp(&path, TRUE))) { - fwrite(data, size, 1, f); - fclose(f); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a wink. <a href='msn-wink://%s'>Click here to play it</a>"), - path); - } else { - purple_debug_error("msn", "Couldn\'t create temp file to store wink\n"); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a wink, but it could not be saved"), - NULL); - } - g_free(path); -} - -static void -got_voiceclip_cb(MsnSlpCall *slpcall, const guchar *data, gsize size) -{ - FILE *f; - char *path = NULL; - const char *who = slpcall->slplink->remote_user; - purple_debug_info("msn", "Received voice clip from %s\n", who); - - if ((f = purple_mkstemp(&path, TRUE))) { - fwrite(data, size, 1, f); - fclose(f); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a voice clip. <a href='audio://%s'>Click here to play it</a>"), - path); - } else { - purple_debug_error("msn", "Couldn\'t create temp file to store sound\n"); - datacast_inform_user(slpcall->slplink->swboard, - who, - _("%s sent a voice clip, but it could not be saved"), - NULL); - } - g_free(path); -} - -void -msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *body; - const char *id; - body = msn_message_get_hashtable_from_body(msg); - - id = g_hash_table_lookup(body, "ID"); - - if (!strcmp(id, "1")) { - /* Nudge */ - PurpleAccount *account; - const char *user; - - account = cmdproc->session->account; - user = msg->remote_user; - - if (cmdproc->servconn->type == MSN_SERVCONN_SB) { - MsnSwitchBoard *swboard = cmdproc->data; - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - purple_prpl_got_attention_in_chat(account->gc, swboard->chat_id, user, MSN_NUDGE); - - else - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); - - } else { - purple_prpl_got_attention(account->gc, user, MSN_NUDGE); - } - - } else if (!strcmp(id, "2")) { - /* Wink */ - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *who; - const char *data; - - session = cmdproc->session; - - data = g_hash_table_lookup(body, "Data"); - obj = msn_object_new_from_string(data); - who = msn_object_get_creator(obj); - - slplink = msn_session_get_slplink(session, who); - msn_slplink_request_object(slplink, data, got_wink_cb, NULL, obj); - - msn_object_destroy(obj); - - - } else if (!strcmp(id, "3")) { - /* Voiceclip */ - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *who; - const char *data; - - session = cmdproc->session; - - data = g_hash_table_lookup(body, "Data"); - obj = msn_object_new_from_string(data); - who = msn_object_get_creator(obj); - - slplink = msn_session_get_slplink(session, who); - msn_slplink_request_object(slplink, data, got_voiceclip_cb, NULL, obj); - - msn_object_destroy(obj); - - } else if (!strcmp(id, "4")) { - /* Action */ - - } else { - purple_debug_warning("msn", "Got unknown datacast with ID %s.\n", id); - } - - g_hash_table_destroy(body); -} - -void -msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *body; - const gchar *guid; - gboolean accepted = FALSE; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(msg != NULL); - - body = msn_message_get_hashtable_from_body(msg); - - if (body == NULL) { - purple_debug_warning("msn", - "Unable to parse invite msg body.\n"); - return; - } - - guid = g_hash_table_lookup(body, "Application-GUID"); - - if (guid == NULL) { - const gchar *cmd = g_hash_table_lookup( - body, "Invitation-Command"); - - if (cmd && !strcmp(cmd, "CANCEL")) { - const gchar *code = g_hash_table_lookup( - body, "Cancel-Code"); - purple_debug_info("msn", - "MSMSGS invitation cancelled: %s.\n", - code ? code : "no reason given"); - } else - purple_debug_warning("msn", "Invite msg missing " - "Application-GUID.\n"); - - accepted = TRUE; - - } else if (!strcmp(guid, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { - purple_debug_info("msn", "Computer call\n"); - - if (cmdproc->session) { - PurpleConversation *conv = NULL; - gchar *from = msg->remote_user; - gchar *buf = NULL; - - if (from) - conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, from, - cmdproc->session->account); - if (conv) - buf = g_strdup_printf( - _("%s sent you a voice chat " - "invite, which is not yet " - "supported."), from); - if (buf) { - purple_conversation_write(conv, NULL, buf, - PURPLE_MESSAGE_SYSTEM | - PURPLE_MESSAGE_NOTIFY, - time(NULL)); - g_free(buf); - } - } - } else { - const gchar *application = g_hash_table_lookup(body, "Application-Name"); - purple_debug_warning("msn", "Unhandled invite msg with GUID %s: %s.\n", - guid, application ? application : "(null)"); - } - - if (!accepted) { - const gchar *cookie = g_hash_table_lookup(body, "Invitation-Cookie"); - if (cookie) { - MsnSwitchBoard *swboard = cmdproc->data; - char *text; - MsnMessage *cancel; - - cancel = msn_message_new(MSN_MSG_TEXT); - msn_message_set_content_type(cancel, "text/x-msmsgsinvite"); - msn_message_set_charset(cancel, "UTF-8"); - msn_message_set_flag(cancel, 'U'); - - text = g_strdup_printf("Invitation-Command: CANCEL\r\n" - "Invitation-Cookie: %s\r\n" - "Cancel-Code: REJECT_NOT_INSTALLED\r\n", - cookie); - msn_message_set_bin_data(cancel, text, strlen(text)); - g_free(text); - - msn_switchboard_send_msg(swboard, cancel, TRUE); - msn_message_destroy(cancel); - } - } - - g_hash_table_destroy(body); -} - -/* Only called from chats. Handwritten messages for IMs come as a SLP message */ -void -msn_handwritten_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - const char *body; - size_t body_len; - - body = msn_message_get_bin_data(msg, &body_len); - msn_switchboard_show_ink(cmdproc->data, msg->remote_user, body); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,344 +0,0 @@ -/** - * @file msg.h Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_MSG_H -#define MSN_MSG_H - -typedef struct _MsnMessage MsnMessage; - -/* -typedef enum -{ - MSN_MSG_NORMAL, - MSN_MSG_SLP_SB, - MSN_MSG_SLP_DC -} MsnMsgType; -*/ - -typedef enum -{ - MSN_MSG_UNKNOWN, - MSN_MSG_TEXT, - MSN_MSG_TYPING, - MSN_MSG_CAPS, - MSN_MSG_SLP, - MSN_MSG_NUDGE -} MsnMsgType; - -typedef enum -{ - MSN_MSG_ERROR_NONE, /**< No error. */ - MSN_MSG_ERROR_TIMEOUT, /**< The message timedout. */ - MSN_MSG_ERROR_NAK, /**< The message could not be sent. */ - MSN_MSG_ERROR_SB, /**< The error comes from the switchboard. */ - MSN_MSG_ERROR_UNKNOWN /**< An unknown error occurred. */ -} MsnMsgErrorType; - -#include "command.h" -#include "session.h" -#include "transaction.h" -#include "user.h" - -typedef void (*MsnMsgCb)(MsnMessage *, void *data); - -#define MSG_BODY_DEM "\r\n\r\n" -#define MSG_LINE_DEM "\r\n" - -#define MSG_OIM_BODY_DEM "\n\n" -#define MSG_OIM_LINE_DEM "\n" - -typedef struct -{ - guint32 session_id; - guint32 id; - guint64 offset; - guint64 total_size; - guint32 length; - guint32 flags; - guint32 ack_id; - guint32 ack_sub_id; - guint64 ack_size; -} MsnSlpHeader; - -typedef struct -{ - guint32 value; -} MsnSlpFooter; - -/** - * A message. - */ -struct _MsnMessage -{ - size_t ref_count; /**< The reference count. */ - - MsnMsgType type; - - gboolean msnslp_message; - - char *remote_user; - char flag; - - char *content_type; - char *charset; - char *body; - gsize body_len; - guint total_chunks; /**< How many chunks in this multi-part message */ - guint received_chunks; /**< How many chunks we've received so far */ - - MsnSlpHeader msnslp_header; - MsnSlpFooter msnslp_footer; - - GHashTable *attr_table; - GList *attr_list; - - gboolean ack_ref; /**< A flag that states if this message has - been ref'ed for using it in a callback. */ - - MsnCommand *cmd; - MsnTransaction *trans; - - MsnMsgCb ack_cb; /**< The callback to call when we receive an ACK of this - message. */ - MsnMsgCb nak_cb; /**< The callback to call when we receive a NAK of this - message. */ - void *ack_data; /**< The data used by callbacks. */ - - MsnMsgErrorType error; /**< The error of the message. */ - - guint32 retries; -}; - -/** - * Creates a new, empty message. - * - * @return A new message. - */ -MsnMessage *msn_message_new(MsnMsgType type); - -/** - * Creates a new, empty MSNSLP message. - * - * @return A new MSNSLP message. - */ -MsnMessage *msn_message_new_msnslp(void); - -/** - * Creates a new nudge message. - * - * @return A new nudge message. - */ -MsnMessage *msn_message_new_nudge(void); - -/** - * Creates a new plain message. - * - * @return A new plain message. - */ -MsnMessage *msn_message_new_plain(const char *message); - -/** - * Creates a MSNSLP ack message. - * - * @param acked_msg The message to acknowledge. - * - * @return A new MSNSLP ack message. - */ -MsnMessage *msn_message_new_msnslp_ack(MsnMessage *acked_msg); - -/** - * Creates a new message based off a command. - * - * @param session The MSN session. - * @param cmd The command. - * - * @return The new message. - */ -MsnMessage *msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd); - -/** - * Parses the payload of a message. - * - * @param msg The message. - * @param payload The payload. - * @param payload_len The length of the payload. - */ -void msn_message_parse_payload(MsnMessage *msg, const char *payload, - size_t payload_len, - const char *line_dem,const char *body_dem); - -/** - * Destroys a message. - * - * @param msg The message to destroy. - */ -void msn_message_destroy(MsnMessage *msg); - -/** - * Increments the reference count on a message. - * - * @param msg The message. - * - * @return @a msg - */ -MsnMessage *msn_message_ref(MsnMessage *msg); - -/** - * Decrements the reference count on a message. - * - * This will destroy the structure if the count hits 0. - * - * @param msg The message. - * - * @return @a msg, or @c NULL if the new count is 0. - */ -MsnMessage *msn_message_unref(MsnMessage *msg); - -/** - * Generates the payload data of a message. - * - * @param msg The message. - * @param ret_size The returned size of the payload. - * - * @return The payload data of the message. - */ -char *msn_message_gen_payload(MsnMessage *msg, size_t *ret_size); - -/** - * Sets the flag for an outgoing message. - * - * @param msg The message. - * @param flag The flag. - */ -void msn_message_set_flag(MsnMessage *msg, char flag); - -/** - * Returns the flag for an outgoing message. - * - * @param msg The message. - * - * @return The flag. - */ -char msn_message_get_flag(const MsnMessage *msg); - -/** - * Sets the binary content of the message. - * - * @param msg The message. - * @param data The binary data. - * @param len The length of the data. - */ -void msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len); - -/** - * Returns the binary content of the message. - * - * @param msg The message. - * @param len The returned length of the data. - * - * @return The binary data. - */ -const void *msn_message_get_bin_data(const MsnMessage *msg, size_t *len); - -/** - * Sets the content type in a message. - * - * @param msg The message. - * @param type The content-type. - */ -void msn_message_set_content_type(MsnMessage *msg, const char *type); - -/** - * Returns the content type in a message. - * - * @param msg The message. - * - * @return The content-type. - */ -const char *msn_message_get_content_type(const MsnMessage *msg); - -/** - * Sets the charset in a message. - * - * @param msg The message. - * @param charset The charset. - */ -void msn_message_set_charset(MsnMessage *msg, const char *charset); - -/** - * Returns the charset in a message. - * - * @param msg The message. - * - * @return The charset. - */ -const char *msn_message_get_charset(const MsnMessage *msg); - -/** - * Sets an attribute in a message. - * - * @param msg The message. - * @param attr The attribute name. - * @param value The attribute value. - */ -void msn_message_set_attr(MsnMessage *msg, const char *attr, - const char *value); - -/** - * Returns an attribute from a message. - * - * @param msg The message. - * @param attr The attribute. - * - * @return The value, or @c NULL if not found. - */ -const char *msn_message_get_attr(const MsnMessage *msg, const char *attr); - -/** - * Parses the body and returns it in the form of a hashtable. - * - * @param msg The message. - * - * @return The resulting hashtable. - */ -GHashTable *msn_message_get_hashtable_from_body(const MsnMessage *msg); - -void msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body); - -void msn_message_parse_slp_body(MsnMessage *msg, const char *body, - size_t len); - -char *msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size); - -char *msn_message_to_string(MsnMessage *msg); - -void msn_plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -void msn_control_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -void msn_datacast_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -void msn_handwritten_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -#endif /* MSN_MSG_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2813 +0,0 @@ -/** - * @file msn.c The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define PHOTO_SUPPORT 1 - -#include "msn.h" -#include "accountopt.h" -#include "contact.h" -#include "msg.h" -#include "page.h" -#include "pluginpref.h" -#include "prefs.h" -#include "session.h" -#include "smiley.h" -#include "state.h" -#include "util.h" -#include "cmds.h" -#include "core.h" -#include "prpl.h" -#include "msnutils.h" -#include "version.h" - -#include "msg.h" -#include "switchboard.h" -#include "notification.h" -#include "sync.h" -#include "slplink.h" - -#if PHOTO_SUPPORT -#define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) -#include "imgstore.h" -#endif - -typedef struct -{ - PurpleConnection *gc; - const char *passport; - -} MsnMobileData; - -typedef struct -{ - PurpleConnection *gc; - char *name; - -} MsnGetInfoData; - -typedef struct -{ - MsnGetInfoData *info_data; - char *stripped; - char *url_buffer; - PurpleNotifyUserInfo *user_info; - char *photo_url_text; - -} MsnGetInfoStepTwoData; - -typedef struct -{ - PurpleConnection *gc; - const char *who; - char *msg; - PurpleMessageFlags flags; - time_t when; -} MsnIMData; - -typedef struct -{ - char *smile; - PurpleSmiley *ps; - MsnObject *obj; -} MsnEmoticon; - -typedef struct -{ - PurpleConnection *pc; - PurpleBuddy *buddy; - PurpleGroup *group; -} MsnAddReqData; - -static const char * -msn_normalize(const PurpleAccount *account, const char *str) -{ - static char buf[BUF_LEN]; - char *tmp; - - g_return_val_if_fail(str != NULL, NULL); - - g_snprintf(buf, sizeof(buf), "%s%s", str, - (strchr(str, '@') ? "" : "@hotmail.com")); - - tmp = g_utf8_strdown(buf, -1); - strncpy(buf, tmp, sizeof(buf)); - g_free(tmp); - - return buf; -} - -gboolean -msn_email_is_valid(const char *passport) -{ - if (purple_email_is_valid(passport)) { - /* Special characters aren't allowed in domains, so only go to '@' */ - while (*passport != '@') { - if (*passport == '/') - return FALSE; - else if (*passport == '?') - return FALSE; - else if (*passport == '=') - return FALSE; - /* MSN also doesn't like colons, but that's checked already */ - - passport++; - } - - return TRUE; - } - - return FALSE; -} - -static gboolean -msn_send_attention(PurpleConnection *gc, const char *username, guint type) -{ - MsnMessage *msg; - MsnSession *session; - MsnSwitchBoard *swboard; - - msg = msn_message_new_nudge(); - session = gc->proto_data; - swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); - - return TRUE; -} - -static GList * -msn_attention_types(PurpleAccount *account) -{ - static GList *list = NULL; - - if (!list) { - list = g_list_append(list, purple_attention_type_new("Nudge", _("Nudge"), - _("%s has nudged you!"), _("Nudging %s..."))); - } - - return list; -} - -static GHashTable * -msn_get_account_text_table(PurpleAccount *unused) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} - -static PurpleCmdRet -msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - PurpleConnection *gc = purple_account_get_connection(account); - const gchar *username; - - username = purple_conversation_get_name(conv); - - purple_prpl_send_attention(gc, username, MSN_NUDGE); - - return PURPLE_CMD_RET_OK; -} - -void -msn_act_id(PurpleConnection *gc, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - const char *alias; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - account = purple_connection_get_account(gc); - - if (entry && *entry) - { - char *tmp = g_strdup(entry); - alias = purple_url_encode(g_strstrip(tmp)); - g_free(tmp); - } - else - alias = ""; - - if (strlen(alias) > BUDDY_ALIAS_MAXLEN) - { - purple_notify_error(gc, NULL, - _("Your new MSN friendly name is too long."), NULL); - return; - } - - if (*alias == '\0') { - alias = purple_url_encode(purple_account_get_username(account)); - } - - msn_cmdproc_send(cmdproc, "PRP", "MFN %s", alias); -} - -static void -msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (entry == NULL || *entry == '\0') - { - msn_cmdproc_send(cmdproc, "PRP", "%s", type); - } - else - { - msn_cmdproc_send(cmdproc, "PRP", "%s %s", type, - purple_url_encode(entry)); - } -} - -static void -msn_set_home_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHH", entry); -} - -static void -msn_set_work_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHW", entry); -} - -static void -msn_set_mobile_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHM", entry); -} - -static void -enable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "Y"); -} - -static void -disable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "N"); -} - -static void -send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) -{ - MsnTransaction *trans; - MsnSession *session; - MsnCmdProc *cmdproc; - MsnPage *page; - MsnMessage *msg; - MsnUser *user; - char *payload = NULL; - const char *mobile_number = NULL; - gsize payload_len; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - page = msn_page_new(); - msn_page_set_body(page, entry); - - payload = msn_page_gen_payload(page, &payload_len); - - if ((user = msn_userlist_find_user(session->userlist, who)) && - (mobile_number = msn_user_get_mobile_phone(user)) && - mobile_number[0] == '+') { - /* if msn_user_get_mobile_phone() has a + in front, it's a number - that from the buddy's contact card */ - trans = msn_transaction_new(cmdproc, "PGD", "tel:%s 1 %" G_GSIZE_FORMAT, - mobile_number, payload_len); - } else { - /* otherwise we send to whatever phone number the buddy registered - with msn */ - trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %" G_GSIZE_FORMAT, - who, payload_len); - } - - msn_transaction_set_payload(trans, payload, payload_len); - g_free(payload); - - msg = msn_message_new_plain(entry); - msn_transaction_set_data(trans, msg); - - msn_page_destroy(page); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -send_to_mobile_cb(MsnMobileData *data, const char *entry) -{ - send_to_mobile(data->gc, data->passport, entry); - g_free(data); -} - -static void -close_mobile_page_cb(MsnMobileData *data, const char *entry) -{ - g_free(data); -} - -/* -- */ - -static void -msn_show_set_friendly_name(PurplePluginAction *action) -{ - PurpleConnection *gc; - PurpleAccount *account; - char *tmp; - - gc = (PurpleConnection *) action->context; - account = purple_connection_get_account(gc); - - tmp = g_strdup_printf(_("Set friendly name for %s."), - purple_account_get_username(account)); - purple_request_input(gc, _("Set your friendly name."), tmp, - _("This is the name that other MSN buddies will " - "see you as."), - purple_connection_get_display_name(gc), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_act_id), - _("Cancel"), NULL, - account, NULL, NULL, - gc); - g_free(tmp); -} - -static void -msn_show_set_home_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your home phone number."), NULL, - msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_home_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_work_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your work phone number."), NULL, - msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_work_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, - msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_pages(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_action(gc, NULL, _("Allow MSN Mobile pages?"), - _("Do you want to allow or disallow people on " - "your buddy list to send you MSN Mobile pages " - "to your cell phone or other mobile device?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), NULL, NULL, - gc, 3, - _("Allow"), G_CALLBACK(enable_msn_pages_cb), - _("Disallow"), G_CALLBACK(disable_msn_pages_cb), - _("Cancel"), NULL); -} - -/* QuLogic: Disabled until confirmed correct. */ -#if 0 -static void -msn_show_blocked_text(PurplePluginAction *action) -{ - PurpleConnection *pc = (PurpleConnection *) action->context; - MsnSession *session; - char *title; - - session = pc->proto_data; - - title = g_strdup_printf(_("Blocked Text for %s"), session->account->username); - if (session->blocked_text == NULL) { - purple_notify_formatted(pc, title, title, NULL, _("No text is blocked for this account."), NULL, NULL); - } else { - char *blocked_text; - blocked_text = g_strdup_printf(_("MSN servers are currently blocking the following regular expressions:<br/>%s"), - session->blocked_text); - - purple_notify_formatted(pc, title, title, NULL, blocked_text, NULL, NULL); - g_free(blocked_text); - } - g_free(title); -} -#endif - -static void -msn_show_hotmail_inbox(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - if (!session->passport_info.email_enabled) { - purple_notify_error(gc, NULL, - _("This account does not have email enabled."), NULL); - return; - } - - /** apparently the correct value is 777, use 750 as a failsafe */ - if ((session->passport_info.mail_url == NULL) - || (time (NULL) - session->passport_info.mail_timestamp >= 750)) { - MsnTransaction *trans; - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_set_data(trans, GUINT_TO_POINTER(TRUE)); - - msn_cmdproc_send_trans(cmdproc, trans); - - } else - purple_notify_uri(gc, session->passport_info.mail_url); -} - -static void -show_send_to_mobile_cb(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - MsnSession *session; - MsnMobileData *data; - PurpleAccount *account; - const char *name; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - name = purple_buddy_get_name(buddy); - - session = gc->proto_data; - - data = g_new0(MsnMobileData, 1); - data->gc = gc; - data->passport = name; - - purple_request_input(gc, NULL, _("Send a mobile message."), NULL, - NULL, TRUE, FALSE, NULL, - _("Page"), G_CALLBACK(send_to_mobile_cb), - _("Close"), G_CALLBACK(close_mobile_page_cb), - account, name, NULL, - data); -} - -static gboolean -msn_offline_message(const PurpleBuddy *buddy) { - return TRUE; -} - -void -msn_send_privacy(PurpleConnection *gc) -{ - PurpleAccount *account; - MsnSession *session; - MsnCmdProc *cmdproc; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || - account->perm_deny == PURPLE_PRIVACY_DENY_USERS) - msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); - else - msn_cmdproc_send(cmdproc, "BLP", "%s", "BL"); -} - -static void -initiate_chat_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - PurpleAccount *account; - - MsnSession *session; - MsnSwitchBoard *swboard; - - const char *alias; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - - session = gc->proto_data; - - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, purple_buddy_get_name(buddy)); - - /* TODO: This might move somewhere else, after USR might be */ - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); - swboard->flag = MSN_SB_FLAG_IM; - - /* Local alias > Display name > Username */ - if ((alias = purple_account_get_alias(account)) == NULL) - if ((alias = purple_connection_get_display_name(gc)) == NULL) - alias = purple_account_get_username(account); - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - alias, NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - -static void -t_msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpLink *slplink = xfer->data; - msn_slplink_request_ft(slplink, xfer); -} - -static PurpleXfer* -msn_new_xfer(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - PurpleXfer *xfer; - - session = gc->proto_data; - - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->data = msn_session_get_slplink(session, who); - - purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); - - return xfer; -} - -static void -msn_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer = msn_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -static gboolean -msn_can_receive_file(PurpleConnection *gc, const char *who) -{ - PurpleAccount *account; - gchar *normal; - gboolean ret; - - account = purple_connection_get_account(gc); - - normal = g_strdup(msn_normalize(account, purple_account_get_username(account))); - ret = strcmp(normal, msn_normalize(account, who)); - g_free(normal); - - if (ret) { - MsnSession *session = gc->proto_data; - if (session) { - MsnUser *user = msn_userlist_find_user(session->userlist, who); - if (user) { - /* Include these too: MSN_CLIENT_CAP_MSNMOBILE|MSN_CLIENT_CAP_MSNDIRECT ? */ - if ((user->clientid & MSN_CLIENT_CAP_WEBMSGR) || - user->networkid == MSN_NETWORK_YAHOO) - ret = FALSE; - else - ret = TRUE; - } - } else - ret = FALSE; - } - - return ret; -} - -/************************************************************************** - * Protocol Plugin ops - **************************************************************************/ - -static const char * -msn_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "msn"; -} - -static const char * -msn_list_emblems(PurpleBuddy *b) -{ - MsnUser *user = purple_buddy_get_protocol_data(b); - - if (user != NULL) { - if (user->clientid & MSN_CLIENT_CAP_BOT) - return "bot"; - if (user->clientid & MSN_CLIENT_CAP_WIN_MOBILE) - return "mobile"; -#if 0 - /* XXX: Since we don't support this, there's no point in showing it just yet */ - if (user->clientid & MSN_CLIENT_CAP_SCHANNEL) - return "secure"; -#endif - if (user->clientid & MSN_CLIENT_CAP_WEBMSGR) - return "external"; - if (user->networkid == MSN_NETWORK_YAHOO) - return "yahoo"; - } - - return NULL; -} - -/* - * Set the User status text - */ -static char * -msn_status_text(PurpleBuddy *buddy) -{ - PurplePresence *presence; - PurpleStatus *status; - const char *msg; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - /* Official client says media takes precedence over message */ - /* I say message take precedence over media! Plus prpl-jabber agrees - too */ - msg = purple_status_get_attr_string(status, "message"); - if (msg && *msg) - return g_markup_escape_text(msg, -1); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - const char *title, *game, *office; - char *media, *esc; - status = purple_presence_get_status(presence, "tune"); - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - - game = purple_status_get_attr_string(status, "game"); - office = purple_status_get_attr_string(status, "office"); - - if (title && *title) { - const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - media = purple_util_format_song_info(title, artist, album, NULL); - return media; - } - else if (game && *game) - media = g_strdup_printf("Playing %s", game); - else if (office && *office) - media = g_strdup_printf("Editing %s", office); - else - return NULL; - esc = g_markup_escape_text(media, -1); - g_free(media); - return esc; - } - - return NULL; -} - -static void -msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) -{ - MsnUser *user; - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - - user = purple_buddy_get_protocol_data(buddy); - - if (purple_presence_is_online(presence)) - { - const char *psm, *name; - const char *mediatype = NULL; - char *currentmedia = NULL; - char *tmp; - - psm = purple_status_get_attr_string(status, "message"); - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *tune = purple_presence_get_status(presence, "tune"); - const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); - const char *game = purple_status_get_attr_string(tune, "game"); - const char *office = purple_status_get_attr_string(tune, "office"); - if (title && *title) { - const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); - mediatype = _("Now Listening"); - currentmedia = purple_util_format_song_info(title, artist, album, NULL); - } else if (game && *game) { - mediatype = _("Playing a game"); - currentmedia = g_strdup(game); - } else if (office && *office) { - mediatype = _("Working"); - currentmedia = g_strdup(office); - } - } - - if (!purple_status_is_available(status)) { - name = purple_status_get_name(status); - } else { - name = NULL; - } - - if (name != NULL && *name) { - char *tmp2; - - tmp2 = g_markup_escape_text(name, -1); - if (purple_presence_is_idle(presence)) { - char *idle; - char *tmp3; - /* Never know what those translations might end up like... */ - idle = g_markup_escape_text(_("Idle"), -1); - tmp3 = g_strdup_printf("%s/%s", tmp2, idle); - g_free(idle); - g_free(tmp2); - tmp2 = tmp3; - } - - if (psm != NULL && *psm) { - tmp = g_markup_escape_text(psm, -1); - purple_notify_user_info_add_pair(user_info, tmp2, tmp); - g_free(tmp); - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), tmp2); - } - - g_free(tmp2); - } else { - if (psm != NULL && *psm) { - tmp = g_markup_escape_text(psm, -1); - if (purple_presence_is_idle(presence)) { - purple_notify_user_info_add_pair(user_info, _("Idle"), tmp); - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), tmp); - } - g_free(tmp); - } else { - if (purple_presence_is_idle(presence)) { - purple_notify_user_info_add_pair(user_info, _("Status"), - _("Idle")); - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), - purple_status_get_name(status)); - } - } - } - - if (currentmedia) { - purple_notify_user_info_add_pair(user_info, mediatype, currentmedia); - g_free(currentmedia); - } - } - - /* XXX: This is being shown in non-full tooltips because the - * XXX: blocked icon overlay isn't always accurate for MSN. - * XXX: This can die as soon as purple_privacy_check() knows that - * XXX: this prpl always honors both the allow and deny lists. */ - /* While the above comment may be strictly correct (the privacy API needs - * rewriteing), purple_privacy_check() is going to be more accurate at - * indicating whether a particular buddy is going to be able to message - * you, which is the important information that this is trying to convey. - */ - if (full && user) - { - const char *phone; - - purple_notify_user_info_add_pair(user_info, _("Has you"), - ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No"))); - - purple_notify_user_info_add_pair(user_info, _("Blocked"), - ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No"))); - - phone = msn_user_get_home_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone); - - phone = msn_user_get_work_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone); - - phone = msn_user_get_mobile_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone); - } -} - -static GList * -msn_status_types(PurpleAccount *account) -{ - PurpleStatusType *status; - GList *types = NULL; - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, "brb", _("Be Right Back"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_UNAVAILABLE, "busy", _("Busy"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_UNAVAILABLE, "phone", _("On the Phone"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, "lunch", _("Out to Lunch"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - NULL, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - NULL, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, - "mobile", NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, status); - - status = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE, - "tune", NULL, FALSE, TRUE, TRUE, - PURPLE_TUNE_ARTIST, _("Artist"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_ALBUM, _("Album"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Title"), purple_value_new(PURPLE_TYPE_STRING), - "game", _("Game Title"), purple_value_new(PURPLE_TYPE_STRING), - "office", _("Office Title"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, status); - - return types; -} - -static GList * -msn_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set Friendly Name..."), - msn_show_set_friendly_name); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Set Home Phone Number..."), - msn_show_set_home_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Work Phone Number..."), - msn_show_set_work_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Mobile Phone Number..."), - msn_show_set_mobile_phone); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - -#if 0 - act = purple_plugin_action_new(_("Enable/Disable Mobile Devices..."), - msn_show_set_mobile_support); - m = g_list_append(m, act); -#endif - - act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."), - msn_show_set_mobile_pages); - m = g_list_append(m, act); - -/* QuLogic: Disabled until confirmed correct. */ -#if 0 - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("View Blocked Text..."), - msn_show_blocked_text); - m = g_list_append(m, act); -#endif - - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Hotmail Inbox"), - msn_show_hotmail_inbox); - m = g_list_append(m, act); - - return m; -} - -static GList * -msn_buddy_menu(PurpleBuddy *buddy) -{ - MsnUser *user; - - GList *m = NULL; - PurpleMenuAction *act; - - g_return_val_if_fail(buddy != NULL, NULL); - - user = purple_buddy_get_protocol_data(buddy); - - if (user != NULL) - { - if (user->mobile) - { - act = purple_menu_action_new(_("Send to Mobile"), - PURPLE_CALLBACK(show_send_to_mobile_cb), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (g_ascii_strcasecmp(purple_buddy_get_name(buddy), - purple_account_get_username(purple_buddy_get_account(buddy)))) - { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(initiate_chat_cb), - NULL, NULL); - m = g_list_append(m, act); - } - - return m; -} - -static GList * -msn_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - return msn_buddy_menu((PurpleBuddy *) node); - } - else - { - return NULL; - } -} - -static void -msn_login(PurpleAccount *account) -{ - PurpleConnection *gc; - MsnSession *session; - const char *username; - const char *host; - gboolean http_method = FALSE; - int port; - - gc = purple_account_get_connection(account); - - if (!purple_ssl_is_supported()) - { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support is needed for MSN. Please install a supported " - "SSL library.")); - return; - } - - http_method = purple_account_get_bool(account, "http_method", FALSE); - - if (http_method) - host = purple_account_get_string(account, "http_method_server", MSN_HTTPCONN_SERVER); - else - host = purple_account_get_string(account, "server", MSN_SERVER); - port = purple_account_get_int(account, "port", MSN_PORT); - - session = msn_session_new(account); - - gc->proto_data = session; - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_START); - - /* Hmm, I don't like this. */ - /* XXX shx: Me neither */ - username = msn_normalize(account, purple_account_get_username(account)); - - if (strcmp(username, purple_account_get_username(account))) - purple_account_set_username(account, username); - - username = purple_account_get_string(account, "display-name", NULL); - purple_connection_set_display_name(gc, username); - - if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); -} - -static void -msn_close(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - g_return_if_fail(session != NULL); - - msn_session_destroy(session); - - gc->proto_data = NULL; -} - -static gboolean -msn_send_me_im(gpointer data) -{ - MsnIMData *imdata = data; - serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when); - g_free(imdata->msg); - g_free(imdata); - return FALSE; -} - -static GString* -msn_msg_emoticon_add(GString *current, MsnEmoticon *emoticon) -{ - MsnObject *obj; - char *strobj; - - if (emoticon == NULL) - return current; - - obj = emoticon->obj; - - if (!obj) - return current; - - strobj = msn_object_to_string(obj); - - if (current) - g_string_append_printf(current, "\t%s\t%s", emoticon->smile, strobj); - else { - current = g_string_new(""); - g_string_printf(current, "%s\t%s", emoticon->smile, strobj); - } - - g_free(strobj); - - return current; -} - -static void -msn_send_emoticons(MsnSwitchBoard *swboard, GString *body) -{ - MsnMessage *msg; - - g_return_if_fail(body != NULL); - - msg = msn_message_new(MSN_MSG_SLP); - msn_message_set_content_type(msg, "text/x-mms-emoticon"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, body->str, body->len); - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); -} - -static void msn_emoticon_destroy(MsnEmoticon *emoticon) -{ - if (emoticon->obj) - msn_object_destroy(emoticon->obj); - g_free(emoticon->smile); - g_free(emoticon); -} - -static GSList* msn_msg_grab_emoticons(const char *msg, const char *username) -{ - GSList *list; - GList *smileys; - PurpleSmiley *smiley; - PurpleStoredImage *img; - char *ptr; - MsnEmoticon *emoticon; - int length; - - list = NULL; - smileys = purple_smileys_get_all(); - length = strlen(msg); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - smiley = smileys->data; - - ptr = g_strstr_len(msg, length, purple_smiley_get_shortcut(smiley)); - - if (!ptr) - continue; - - img = purple_smiley_get_stored_image(smiley); - - emoticon = g_new0(MsnEmoticon, 1); - emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); - emoticon->ps = smiley; - emoticon->obj = msn_object_new_from_image(img, - purple_imgstore_get_filename(img), - username, MSN_OBJECT_EMOTICON); - - purple_imgstore_unref(img); - list = g_slist_prepend(list, emoticon); - } - - return list; -} - -void -msn_send_im_message(MsnSession *session, MsnMessage *msg) -{ - MsnEmoticon *smile; - GSList *smileys; - GString *emoticons = NULL; - const char *username = purple_account_get_username(session->account); - MsnSwitchBoard *swboard = msn_session_get_swboard(session, msg->remote_user, MSN_SB_FLAG_IM); - - smileys = msn_msg_grab_emoticons(msg->body, username); - while (smileys) { - smile = (MsnEmoticon *)smileys->data; - emoticons = msn_msg_emoticon_add(emoticons, smile); - msn_emoticon_destroy(smile); - smileys = g_slist_delete_link(smileys, smileys); - } - - if (emoticons) { - msn_send_emoticons(swboard, emoticons); - g_string_free(emoticons, TRUE); - } - - msn_switchboard_send_msg(swboard, msg, TRUE); -} - -static int -msn_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - PurpleAccount *account; - PurpleBuddy *buddy = purple_find_buddy(gc->account, who); - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - char *msgformat; - char *msgtext; - size_t msglen; - const char *username; - - purple_debug_info("msn", "send IM {%s} to %s\n", message, who); - account = purple_connection_get_account(gc); - username = purple_account_get_username(account); - - session = gc->proto_data; - swboard = msn_session_find_swboard(session, who); - - if (!strncmp("tel:+", who, 5)) { - char *text = purple_markup_strip_html(message); - send_to_mobile(gc, who, text); - g_free(text); - return 1; - } - - if (buddy) { - PurplePresence *p = purple_buddy_get_presence(buddy); - if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) { - char *text = purple_markup_strip_html(message); - send_to_mobile(gc, who, text); - g_free(text); - return 1; - } - } - - msn_import_html(message, &msgformat, &msgtext); - msglen = strlen(msgtext); - if (msglen == 0) { - /* Stuff like <hr> will be ignored. Don't send an empty message - if that's all there is. */ - g_free(msgtext); - g_free(msgformat); - - return 0; - } - - if (msn_user_is_online(account, who) || - msn_user_is_yahoo(account, who) || - swboard != NULL) { - /*User online or have a swboard open because it's invisible - * and sent us a message,then send Online Instant Message*/ - - if (msglen + strlen(msgformat) + strlen(VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msg->remote_user = g_strdup(who); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - - g_free(msgformat); - g_free(msgtext); - - purple_debug_info("msn", "prepare to send online Message\n"); - if (g_ascii_strcasecmp(who, username)) - { - if (flags & PURPLE_MESSAGE_AUTO_RESP) { - msn_message_set_flag(msg, 'U'); - } - if (msn_user_is_yahoo(account, who)) { - /*we send the online and offline Message to Yahoo User via UBM*/ - purple_debug_info("msn", "send to Yahoo User\n"); - uum_send_msg(session, msg); - } else { - purple_debug_info("msn", "send via switchboard\n"); - msn_send_im_message(session, msg); - } - } - else - { - char *body_str, *body_enc, *pre, *post; - const char *format; - MsnIMData *imdata = g_new0(MsnIMData, 1); - /* - * In MSN, you can't send messages to yourself, so - * we'll fake like we received it ;) - */ - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - serv_got_typing_stopped(gc, who); - imdata->gc = gc; - imdata->who = who; - imdata->msg = body_str; - imdata->flags = flags & ~PURPLE_MESSAGE_SEND; - imdata->when = time(NULL); - purple_timeout_add(0, msn_send_me_im, imdata); - } - - msn_message_destroy(msg); - } else { - /*send Offline Instant Message,only to MSN Passport User*/ - char *friendname; - - purple_debug_info("msn", "prepare to send offline Message\n"); - - friendname = msn_encode_mime(account->username); - msn_oim_prep_send_msg_info(session->oim, - purple_account_get_username(account), - friendname, who, msgtext); - msn_oim_send_msg(session->oim); - - g_free(msgformat); - g_free(msgtext); - g_free(friendname); - } - - return 1; -} - -static unsigned int -msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - PurpleAccount *account; - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - - /* - * TODO: I feel like this should be "if (state != PURPLE_TYPING)" - * but this is how it was before, and I don't want to break - * anything. --KingAnt - */ - if (state == PURPLE_NOT_TYPING) - return 0; - - if (!g_ascii_strcasecmp(who, purple_account_get_username(account))) - { - /* We'll just fake it, since we're sending to ourself. */ - serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, PURPLE_TYPING); - - return MSN_TYPING_SEND_TIMEOUT; - } - - swboard = msn_session_find_swboard(session, who); - - if (swboard == NULL || !msn_switchboard_can_send(swboard)) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msg = msn_message_new(MSN_MSG_TYPING); - msn_message_set_content_type(msg, "text/x-msmsgscontrol"); - msn_message_set_flag(msg, 'U'); - msn_message_set_attr(msg, "TypingUser", - purple_account_get_username(account)); - msn_message_set_bin_data(msg, "\r\n", 2); - - msn_switchboard_send_msg(swboard, msg, FALSE); - - msn_message_destroy(msg); - - return MSN_TYPING_SEND_TIMEOUT; -} - -static void -msn_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = purple_account_get_connection(account); - - if (gc != NULL) - { - session = gc->proto_data; - msn_change_status(session); - } -} - -static void -msn_set_idle(PurpleConnection *gc, int idle) -{ - MsnSession *session; - - session = gc->proto_data; - - msn_change_status(session); -} - -/* - * Actually adds a buddy once we have the response from FQY - */ -static void -add_pending_buddy(MsnSession *session, - const char *who, - MsnNetwork network, - MsnUser *user) -{ - char *group; - - g_return_if_fail(user != NULL); - - group = msn_user_remove_pending_group(user); - - if (network != MSN_NETWORK_UNKNOWN) { - MsnUserList *userlist = session->userlist; - MsnUser *user2 = msn_userlist_find_user(userlist, who); - if (user2 != NULL) { - /* User already in userlist, so just update it. */ - msn_user_destroy(user); - user = user2; - } else { - msn_userlist_add_user(userlist, user); - } - - msn_user_set_network(user, network); - msn_userlist_add_buddy(userlist, who, group); - } - else - { - PurpleBuddy * buddy = purple_find_buddy(session->account, who); - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses."), who); - if (!purple_conv_present_error(who, session->account, buf)) - purple_notify_error(purple_account_get_connection(session->account), NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); - msn_user_destroy(user); - } - g_free(group); -} - -static void -finish_auth_request(MsnAddReqData *data, char *msg) -{ - PurpleConnection *pc; - PurpleBuddy *buddy; - PurpleGroup *group; - PurpleAccount *account; - MsnSession *session; - MsnUserList *userlist; - const char *who, *gname; - MsnUser *user; - - pc = data->pc; - buddy = data->buddy; - group = data->group; - g_free(data); - - account = purple_connection_get_account(pc); - session = pc->proto_data; - userlist = session->userlist; - - who = msn_normalize(account, purple_buddy_get_name(buddy)); - gname = group ? purple_group_get_name(group) : NULL; - purple_debug_info("msn", "Add user:%s to group:%s\n", who, gname ? gname : "(null)"); - if (!session->logged_in) - { - purple_debug_error("msn", "msn_add_buddy called before connected\n"); - - return; - } - - /* XXX - Would group ever be NULL here? I don't think so... - * shx: Yes it should; MSN handles non-grouped buddies, and this is only - * internal. */ - user = msn_userlist_find_user(userlist, who); - if ((user != NULL) && (user->networkid != MSN_NETWORK_UNKNOWN)) { - /* We already know this buddy and their network. This function knows - what to do with users already in the list and stuff... */ - msn_user_set_invite_message(user, msg); - msn_userlist_add_buddy(userlist, who, gname); - } else { - char **tokens; - char *fqy; - /* We need to check the network for this buddy first */ - user = msn_user_new(userlist, who, NULL); - msn_user_set_invite_message(user, msg); - msn_user_set_pending_group(user, gname); - msn_user_set_network(user, MSN_NETWORK_UNKNOWN); - tokens = g_strsplit(who, "@", 2); - fqy = g_strdup_printf("<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", - tokens[1], - tokens[0]); - msn_notification_send_fqy(session, fqy, strlen(fqy), - (MsnFqyCb)add_pending_buddy, user); - g_free(fqy); - g_strfreev(tokens); - } -} - -static void -cancel_auth_request(MsnAddReqData *data, char *msg) -{ - /* Remove from local list */ - purple_blist_remove_buddy(data->buddy); - - g_free(data); -} - -static void -msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - const char *bname; - MsnAddReqData *data; - MsnSession *session; - MsnUser *user; - - bname = purple_buddy_get_name(buddy); - - if (!msn_email_is_valid(bname)) { - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be valid email addresses."), bname); - if (!purple_conv_present_error(bname, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); - - return; - } - - data = g_new0(MsnAddReqData, 1); - data->pc = gc; - data->buddy = buddy; - data->group = group; - - session = purple_connection_get_protocol_data(gc); - user = msn_userlist_find_user(session->userlist, bname); - if (user && user->authorized) { - finish_auth_request(data, NULL); - } else { - purple_request_input(gc, NULL, _("Authorization Request Message:"), - NULL, _("Please authorize me!"), TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(finish_auth_request), - _("_Cancel"), G_CALLBACK(cancel_auth_request), - purple_connection_get_account(gc), bname, NULL, - data); - } -} - -static void -msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, purple_buddy_get_name(buddy)); -} - -static void -msn_add_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_BL_OP) { - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - - /* delete contact from Block list and add it to Allow in the callback */ - msn_del_contact_from_list(session, NULL, who, MSN_LIST_BL); - } else { - /* just add the contact to Allow list */ - msn_add_contact_to_list(session, NULL, who, MSN_LIST_AL); - } - - - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_AL); -} - -static void -msn_add_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_AL_OP) { - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_AL); - - /* delete contact from Allow list and add it to Block in the callback */ - msn_del_contact_from_list(session, NULL, who, MSN_LIST_AL); - } else { - /* just add the contact to Block list */ - msn_add_contact_to_list(session, NULL, who, MSN_LIST_BL); - } - - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_BL); -} - -static void -msn_rem_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_AL); - - msn_del_contact_from_list(session, NULL, who, MSN_LIST_AL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_BL); -} - -static void -msn_rem_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - - msn_del_contact_from_list(session, NULL, who, MSN_LIST_BL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy_to_list(userlist, who, MSN_LIST_AL); -} - -static void -msn_set_permit_deny(PurpleConnection *gc) -{ - msn_send_privacy(gc); -} - -static void -msn_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - { - /* if we have no switchboard, everyone else left the chat already */ - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - swboard->chat_id = id; - swboard->conv = purple_find_chat(gc, id); - } - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_switchboard_request_add_user(swboard, who); -} - -static void -msn_chat_leave(PurpleConnection *gc, int id) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - /* if swboard is NULL we were the only person left anyway */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - msn_switchboard_release(swboard, MSN_SB_FLAG_IM); - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static int -msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurpleAccount *account; - MsnSession *session; - const char *username; - MsnSwitchBoard *swboard; - MsnMessage *msg; - char *msgformat; - char *msgtext; - size_t msglen; - MsnEmoticon *smile; - GSList *smileys; - GString *emoticons = NULL; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - username = purple_account_get_username(account); - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - return -EINVAL; - - if (!swboard->ready) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_import_html(message, &msgformat, &msgtext); - msglen = strlen(msgtext); - - if ((msglen == 0) || (msglen + strlen(msgformat) + strlen(VERSION) > 1564)) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - - smileys = msn_msg_grab_emoticons(msg->body, username); - while (smileys) { - smile = (MsnEmoticon *)smileys->data; - emoticons = msn_msg_emoticon_add(emoticons, smile); - if (purple_conv_custom_smiley_add(swboard->conv, smile->smile, - "sha1", purple_smiley_get_checksum(smile->ps), - FALSE)) { - gconstpointer data; - size_t len; - data = purple_smiley_get_data(smile->ps, &len); - purple_conv_custom_smiley_write(swboard->conv, smile->smile, data, len); - purple_conv_custom_smiley_close(swboard->conv, smile->smile); - } - msn_emoticon_destroy(smile); - smileys = g_slist_delete_link(smileys, smileys); - } - - if (emoticons) { - msn_send_emoticons(swboard, emoticons); - g_string_free(emoticons, TRUE); - } - - msn_switchboard_send_msg(swboard, msg, FALSE); - msn_message_destroy(msg); - - g_free(msgformat); - g_free(msgtext); - - serv_got_chat_in(gc, id, purple_account_get_username(account), flags, - message, time(NULL)); - - return 0; -} - -static void -msn_keepalive(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - if (!session->http_method) - { - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL); - } -} - -static void msn_alias_buddy(PurpleConnection *pc, const char *name, const char *alias) -{ - MsnSession *session; - - session = pc->proto_data; - - msn_update_contact(session, name, MSN_UPDATE_ALIAS, alias); -} - -static void -msn_group_buddy(PurpleConnection *gc, const char *who, - const char *old_group_name, const char *new_group_name) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); -} - -static void -msn_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - MsnSession *session; - const char *gname; - - session = gc->proto_data; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->userlist != NULL); - - gname = purple_group_get_name(group); - if (msn_userlist_find_group_with_name(session->userlist, old_name) != NULL) - { - msn_contact_rename_group(session, old_name, gname); - } - else - { - /* not found */ - msn_add_group(session, NULL, gname); - } -} - -static void -msn_convo_closed(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard(session, who); - - /* - * Don't perform an assertion here. If swboard is NULL, then the - * switchboard was either closed by the other party, or the person - * is talking to himself. - */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - /* If we release the switchboard here, it may still have messages - pending ACK which would result in incorrect unsent message errors. - Just let it timeout... This is *so* going to screw with people who - use dumb clients that report "User has closed the conversation window" */ - /* msn_switchboard_release(swboard, MSN_SB_FLAG_IM); */ - swboard->conv = NULL; - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static void -msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - MsnSession *session; - MsnUser *user; - - session = gc->proto_data; - user = session->user; - - msn_user_set_buddy_icon(user, img); - - msn_change_status(session); -} - -static void -msn_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - MsnSession *session; - MsnCmdProc *cmdproc; - const char *gname; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - gname = purple_group_get_name(group); - - purple_debug_info("msn", "Remove group %s\n", gname); - /*we can't delete the default group*/ - if(!strcmp(gname, MSN_INDIVIDUALS_GROUP_NAME)|| - !strcmp(gname, MSN_NON_IM_GROUP_NAME)) - { - purple_debug_info("msn", "This group can't be removed, returning.\n"); - return ; - } - - msn_del_group(session, gname); -} - -/** - * Extract info text from info_data and add it to user_info - */ -static gboolean -msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *info_data) -{ - PurpleBuddy *b; - - b = purple_find_buddy(purple_connection_get_account(info_data->gc), - info_data->name); - - if (b) - { - char *tmp; - const char *alias; - - alias = purple_buddy_get_local_buddy_alias(b); - if (alias && alias[0]) - { - char *aliastext = g_markup_escape_text(alias, -1); - purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); - g_free(aliastext); - } - - if ((alias = purple_buddy_get_server_alias(b)) != NULL) - { - char *nicktext = g_markup_escape_text(alias, -1); - tmp = g_strdup_printf("<font sml=\"msn\">%s</font>", nicktext); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - g_free(nicktext); - } - - /* Add the tooltip information */ - msn_tooltip_text(b, user_info, TRUE); - - return TRUE; - } - - return FALSE; -} - -#if PHOTO_SUPPORT - -static char * -msn_get_photo_url(const char *url_text) -{ - char *p, *q; - - if ((p = strstr(url_text, PHOTO_URL)) != NULL) - { - p += strlen(PHOTO_URL); - } - if (p && (strncmp(p, "http://", strlen("http://")) == 0) && ((q = strchr(p, '"')) != NULL)) - return g_strndup(p, q - p); - - return NULL; -} - -static void msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, gsize len, const gchar *error_message); - -#endif - -#if 0 -static char *msn_info_date_reformat(const char *field, size_t len) -{ - char *tmp = g_strndup(field, len); - time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - - g_free(tmp); - return g_strdup(purple_date_format_short(localtime(&t))); -} -#endif - -#define MSN_GOT_INFO_GET_FIELD(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, NULL); \ - if (found) \ - sect_info = TRUE; - -#define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \ - if (found) \ - sect_info = TRUE; - -static char * -msn_info_strip_search_link(const char *field, size_t len) -{ - const char *c; - if ((c = strstr(field, " (http://")) == NULL) - return g_strndup(field, len); - return g_strndup(field, c - field); -} - -static void -msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - MsnGetInfoData *info_data = (MsnGetInfoData *)data; - PurpleNotifyUserInfo *user_info; - char *stripped, *p, *q, *tmp; - char *user_url = NULL; - gboolean found; - gboolean has_tooltip_text = FALSE; - gboolean has_info = FALSE; - gboolean sect_info = FALSE; - gboolean has_contact_info = FALSE; - char *url_buffer; - int stripped_len; -#if PHOTO_SUPPORT - char *photo_url_text = NULL; - MsnGetInfoStepTwoData *info2_data = NULL; -#endif - - purple_debug_info("msn", "In msn_got_info,url_text:{%s}\n",url_text); - - /* Make sure the connection is still valid */ - /* TODO: Instead of this, we should be canceling this when we disconnect */ - if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n"); - g_free(info_data->name); - g_free(info_data); - return; - } - - user_info = purple_notify_user_info_new(); - has_tooltip_text = msn_tooltip_extract_info_text(user_info, info_data); - - if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) - { - purple_notify_user_info_add_pair(user_info, - _("Error retrieving profile"), NULL); - - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(info_data->name); - g_free(info_data); - return; - } - - url_buffer = g_strdup(url_text); - - /* If they have a homepage link, MSN masks it such that we need to - * fetch the url out before purple_markup_strip_html() nukes it */ - /* I don't think this works with the new spaces profiles - Stu 3/2/06 */ - if ((p = strstr(url_text, - "Take a look at my </font><A class=viewDesc title=\"")) != NULL) - { - p += 50; - - if ((q = strchr(p, '"')) != NULL) - user_url = g_strndup(p, q - p); - } - - /* - * purple_markup_strip_html() doesn't strip out character entities like   - * and · - */ - while ((p = strstr(url_buffer, " ")) != NULL) - { - *p = ' '; /* Turn  's into ordinary blanks */ - p += 1; - memmove(p, p + 5, strlen(p + 5)); - url_buffer[strlen(url_buffer) - 5] = '\0'; - } - - while ((p = strstr(url_buffer, "·")) != NULL) - { - memmove(p, p + 6, strlen(p + 6)); - url_buffer[strlen(url_buffer) - 6] = '\0'; - } - - /* Nuke the nasty \r's that just get in the way */ - purple_str_strip_char(url_buffer, '\r'); - - /* MSN always puts in ' for apostrophes...replace them */ - while ((p = strstr(url_buffer, "'")) != NULL) - { - *p = '\''; - memmove(p + 1, p + 5, strlen(p + 5)); - url_buffer[strlen(url_buffer) - 4] = '\0'; - } - - /* Nuke the html, it's easier than trying to parse the horrid stuff */ - stripped = purple_markup_strip_html(url_buffer); - stripped_len = strlen(stripped); - - purple_debug_misc("msn", "stripped = %p\n", stripped); - purple_debug_misc("msn", "url_buffer = %p\n", url_buffer); - - /* General section header */ - if (has_tooltip_text) - purple_notify_user_info_add_section_break(user_info); - - purple_notify_user_info_add_section_header(user_info, _("General")); - - /* Extract their Name and put it in */ - MSN_GOT_INFO_GET_FIELD("Name", _("Name")); - - /* General */ - MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Age", _("Age")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Gender", _("Gender")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Occupation", _("Occupation")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Location", _("Location")); - - /* Extract their Interests and put it in */ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, - "\nInterests\t", 0, " (/default.aspx?page=searchresults", 0, - "Undisclosed", _("Hobbies and Interests") /* _("Interests") */, - 0, NULL, NULL); - - if (found) - sect_info = TRUE; - - MSN_GOT_INFO_GET_FIELD("More about me", _("A Little About Me")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - if (has_tooltip_text) - purple_notify_user_info_remove_last_item(user_info); - } - - /* Social */ - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_section_header(user_info, _("Social")); - - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Marital status", _("Marital Status")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Interested in", _("Interests")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Pets", _("Pets")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Hometown", _("Hometown")); - MSN_GOT_INFO_GET_FIELD("Places lived", _("Places Lived")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Fashion", _("Fashion")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Humor", _("Humor")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Music", _("Music")); - MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Favorite quote", _("Favorite Quote")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - purple_notify_user_info_remove_last_item(user_info); - } - - /* Contact Info */ - /* Personal */ - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_section_header(user_info, _("Contact Info")); - purple_notify_user_info_add_section_header(user_info, _("Personal")); - - MSN_GOT_INFO_GET_FIELD("Name", _("Name")); - MSN_GOT_INFO_GET_FIELD("Significant other", _("Significant Other")); - MSN_GOT_INFO_GET_FIELD("Home phone", _("Home Phone")); - MSN_GOT_INFO_GET_FIELD("Home phone 2", _("Home Phone 2")); - MSN_GOT_INFO_GET_FIELD("Home address", _("Home Address")); - MSN_GOT_INFO_GET_FIELD("Personal Mobile", _("Personal Mobile")); - MSN_GOT_INFO_GET_FIELD("Home fax", _("Home Fax")); - MSN_GOT_INFO_GET_FIELD("Personal email", _("Personal Email")); - MSN_GOT_INFO_GET_FIELD("Personal IM", _("Personal IM")); - MSN_GOT_INFO_GET_FIELD("Birthday", _("Birthday")); - MSN_GOT_INFO_GET_FIELD("Anniversary", _("Anniversary")); - MSN_GOT_INFO_GET_FIELD("Notes", _("Notes")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - has_contact_info = TRUE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - } - - /* Business */ - purple_notify_user_info_add_section_header(user_info, _("Work")); - MSN_GOT_INFO_GET_FIELD("Name", _("Name")); - MSN_GOT_INFO_GET_FIELD("Job title", _("Job Title")); - MSN_GOT_INFO_GET_FIELD("Company", _("Company")); - MSN_GOT_INFO_GET_FIELD("Department", _("Department")); - MSN_GOT_INFO_GET_FIELD("Profession", _("Profession")); - MSN_GOT_INFO_GET_FIELD("Work phone 1", _("Work Phone")); - MSN_GOT_INFO_GET_FIELD("Work phone 2", _("Work Phone 2")); - MSN_GOT_INFO_GET_FIELD("Work address", _("Work Address")); - MSN_GOT_INFO_GET_FIELD("Work mobile", _("Work Mobile")); - MSN_GOT_INFO_GET_FIELD("Work pager", _("Work Pager")); - MSN_GOT_INFO_GET_FIELD("Work fax", _("Work Fax")); - MSN_GOT_INFO_GET_FIELD("Work email", _("Work Email")); - MSN_GOT_INFO_GET_FIELD("Work IM", _("Work IM")); - MSN_GOT_INFO_GET_FIELD("Start date", _("Start Date")); - MSN_GOT_INFO_GET_FIELD("Notes", _("Notes")); - - if (sect_info) - { - has_info = TRUE; - sect_info = FALSE; - has_contact_info = TRUE; - } - else - { - /* Remove the section header */ - purple_notify_user_info_remove_last_item(user_info); - } - - if (!has_contact_info) - { - /* Remove the Contact Info section header */ - purple_notify_user_info_remove_last_item(user_info); - } - -#if 0 /* these probably don't show up any more */ - /* - * The fields, 'A Little About Me', 'Favorite Things', 'Hobbies - * and Interests', 'Favorite Quote', and 'My Homepage' may or may - * not appear, in any combination. However, they do appear in - * certain order, so we can successively search to pin down the - * distinct values. - */ - - /* Check if they have A Little About Me */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "Favorite Things", '\n', NULL, - _("A Little About Me"), 0, NULL, NULL); - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "Hobbies and Interests", '\n', - NULL, _("A Little About Me"), 0, NULL, NULL); - } - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "Favorite Quote", '\n', NULL, - _("A Little About Me"), 0, NULL, NULL); - } - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "My Homepage \n\nTake a look", - '\n', - NULL, _("A Little About Me"), 0, NULL, NULL); - } - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - " A Little About Me \n\n", 0, "last updated", '\n', NULL, - _("A Little About Me"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Check if they have Favorite Things */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "Hobbies and Interests", '\n', NULL, - _("Favorite Things"), 0, NULL, NULL); - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "Favorite Quote", '\n', NULL, - _("Favorite Things"), 0, NULL, NULL); - } - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "My Homepage \n\nTake a look", '\n', - NULL, _("Favorite Things"), 0, NULL, NULL); - } - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - " Favorite Things \n\n", 0, "last updated", '\n', NULL, - _("Favorite Things"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Check if they have Hobbies and Interests */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Hobbies and Interests \n\n", 0, "Favorite Quote", '\n', NULL, - _("Hobbies and Interests"), 0, NULL, NULL); - - if (!found) - { - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " Hobbies and Interests \n\n", 0, "My Homepage \n\nTake a look", - '\n', NULL, _("Hobbies and Interests"), 0, NULL, NULL); - } - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - " Hobbies and Interests \n\n", 0, "last updated", '\n', NULL, - _("Hobbies and Interests"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Check if they have Favorite Quote */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - "Favorite Quote \n\n", 0, "My Homepage \n\nTake a look", '\n', NULL, - _("Favorite Quote"), 0, NULL, NULL); - - if (!found) - { - purple_markup_extract_info_field(stripped, stripped_len, s, - "Favorite Quote \n\n", 0, "last updated", '\n', NULL, - _("Favorite Quote"), 0, NULL, NULL); - } - - if (found) - has_info = TRUE; - - /* Extract the last updated date and put it in */ - found = purple_markup_extract_info_field(stripped, stripped_len, s, - " last updated:", 1, "\n", 0, NULL, _("Last Updated"), 0, - NULL, msn_info_date_reformat); - - if (found) - has_info = TRUE; -#endif - - /* If we were able to fetch a homepage url earlier, stick it in there */ - if (user_url != NULL) - { - tmp = g_strdup_printf("<a href=\"%s\">%s</a>", user_url, user_url); - purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp); - g_free(tmp); - g_free(user_url); - - has_info = TRUE; - } - - if (!has_info) - { - /* MSN doesn't actually distinguish between "unknown member" and - * a known member with an empty profile. Try to explain this fact. - * Note that if we have a nonempty tooltip_text, we know the user - * exists. - */ - /* This doesn't work with the new spaces profiles - Stu 3/2/06 - char *p = strstr(url_buffer, "Unknown Member "); - * This might not work for long either ... */ - /* Nope, it failed some time before 5/2/07 :( - char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\""); - * Let's see how long this one holds out for ... */ - char *p = strstr(url_buffer, "
gc), info_data->name); - purple_notify_user_info_add_pair(user_info, - _("Error retrieving profile"), NULL); - purple_notify_user_info_add_pair(user_info, NULL, - ((p && b) ? _("The user has not created a public profile.") : - (p ? _("MSN reported not being able to find the user's profile. " - "This either means that the user does not exist, " - "or that the user exists " - "but has not created a public profile.") : - _("Could not find " /* This should never happen */ - "any information in the user's profile. " - "The user most likely does not exist.")))); - } - - /* put a link to the actual profile URL */ - purple_notify_user_info_add_section_break(user_info); - tmp = g_strdup_printf("%s", - PROFILE_URL, info_data->name, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - -#if PHOTO_SUPPORT - /* Find the URL to the photo; must be before the marshalling [Bug 994207] */ - photo_url_text = msn_get_photo_url(url_text); - purple_debug_info("msn", "photo url:{%s}\n", photo_url_text ? photo_url_text : "(null)"); - - /* Marshall the existing state */ - info2_data = g_new0(MsnGetInfoStepTwoData, 1); - info2_data->info_data = info_data; - info2_data->stripped = stripped; - info2_data->url_buffer = url_buffer; - info2_data->user_info = user_info; - info2_data->photo_url_text = photo_url_text; - - /* Try to put the photo in there too, if there's one */ - if (photo_url_text) - { - purple_util_fetch_url_len(photo_url_text, FALSE, NULL, FALSE, MAX_HTTP_BUDDYICON_BYTES, msn_got_photo, - info2_data); - } - else - { - /* Emulate a callback */ - /* TODO: Huh? */ - msn_got_photo(NULL, info2_data, NULL, 0, NULL); - } -} - -static void -msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, gsize len, const gchar *error_message) -{ - MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data; - int id = -1; - - /* Unmarshall the saved state */ - MsnGetInfoData *info_data = info2_data->info_data; - char *stripped = info2_data->stripped; - char *url_buffer = info2_data->url_buffer; - PurpleNotifyUserInfo *user_info = info2_data->user_info; - char *photo_url_text = info2_data->photo_url_text; - - /* Make sure the connection is still valid if we got here by fetching a photo url */ - /* TODO: Instead of this, we should be canceling this when we disconnect */ - if (url_text && (error_message != NULL || - g_list_find(purple_connections_get_all(), info_data->gc) == NULL)) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); - g_free(photo_url_text); - g_free(info2_data); - - return; - } - - /* Try to put the photo in there too, if there's one and is readable */ - if (user_data && url_text && len != 0) - { - if (strstr(url_text, "400 Bad Request") - || strstr(url_text, "403 Forbidden") - || strstr(url_text, "404 Not Found")) - { - - purple_debug_info("msn", "Error getting %s: %s\n", - photo_url_text, url_text); - } - else - { - char buf[1024]; - purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT " bytes\n", photo_url_text, len); - id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - g_snprintf(buf, sizeof(buf), "
", id); - purple_notify_user_info_prepend_pair(user_info, NULL, buf); - } - } - - /* We continue here from msn_got_info, as if nothing has happened */ -#endif - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); -#if PHOTO_SUPPORT - g_free(photo_url_text); - g_free(info2_data); - if (id != -1) - purple_imgstore_unref_by_id(id); -#endif -} - -static void -msn_get_info(PurpleConnection *gc, const char *name) -{ - MsnGetInfoData *data; - char *url; - - data = g_new0(MsnGetInfoData, 1); - data->gc = gc; - data->name = g_strdup(name); - - url = g_strdup_printf("%s%s", PROFILE_URL, name); - - purple_util_fetch_url(url, FALSE, - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); - - g_free(url); -} - -static gboolean msn_load(PurplePlugin *plugin) -{ - msn_notification_init(); - msn_switchboard_init(); - msn_sync_init(); - - return TRUE; -} - -static gboolean msn_unload(PurplePlugin *plugin) -{ - msn_notification_end(); - msn_switchboard_end(); - msn_sync_end(); - - return TRUE; -} - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "msnim")) - return FALSE; - - acct = find_acct("prpl-msn", acct_id); - - if (!acct) - return FALSE; - - /* msnim:chat?contact=user@domain.tld */ - if (!g_ascii_strcasecmp(cmd, "Chat")) { - char *sname = g_hash_table_lookup(params, "contact"); - if (sname) { - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, sname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); - purple_conversation_present(conv); - } - /*else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im();*/ - - return TRUE; - } - /* msnim:add?contact=user@domain.tld */ - else if (!g_ascii_strcasecmp(cmd, "Add")) { - char *name = g_hash_table_lookup(params, "contact"); - purple_blist_request_add_buddy(acct, name, NULL, NULL); - return TRUE; - } - - return FALSE; -} - - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - msn_list_icon, /* list_icon */ - msn_list_emblems, /* list_emblems */ - msn_status_text, /* status_text */ - msn_tooltip_text, /* tooltip_text */ - msn_status_types, /* away_states */ - msn_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - msn_login, /* login */ - msn_close, /* close */ - msn_send_im, /* send_im */ - NULL, /* set_info */ - msn_send_typing, /* send_typing */ - msn_get_info, /* get_info */ - msn_set_status, /* set_away */ - msn_set_idle, /* set_idle */ - NULL, /* change_passwd */ - msn_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - msn_rem_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - msn_add_permit, /* add_permit */ - msn_add_deny, /* add_deny */ - msn_rem_permit, /* rem_permit */ - msn_rem_deny, /* rem_deny */ - msn_set_permit_deny, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - msn_chat_invite, /* chat_invite */ - msn_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - msn_chat_send, /* chat_send */ - msn_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - msn_alias_buddy, /* alias_buddy */ - msn_group_buddy, /* group_buddy */ - msn_rename_group, /* rename_group */ - NULL, /* buddy_free */ - msn_convo_closed, /* convo_closed */ - msn_normalize, /* normalize */ - msn_set_buddy_icon, /* set_buddy_icon */ - msn_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - msn_can_receive_file, /* can_receive_file */ - msn_send_file, /* send_file */ - msn_new_xfer, /* new_xfer */ - msn_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - msn_send_attention, /* send_attention */ - msn_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - msn_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-msn", /**< id */ - "MSN", /**< name */ - DISPLAY_VERSION, /**< version */ - N_("Windows Live Messenger Protocol Plugin"), /**< summary */ - N_("Windows Live Messenger Protocol Plugin"), /**< description */ - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - msn_load, /**< load */ - msn_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - msn_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Server"), "server", - MSN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_int_new(_("Port"), "port", MSN_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Use HTTP Method"), - "http_method", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("HTTP Method Server"), - "http_method_server", MSN_HTTPCONN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Show custom smileys"), - "custom_smileys", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-msn", msn_cmd_nudge, - _("nudge: nudge a user to get their attention"), NULL); - - purple_prefs_remove("/plugins/prpl/msn"); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(msn_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(msn, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -/** - * @file msn.h The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_H -#define MSN_H - -typedef enum -{ - MSN_LIST_FL_OP = 0x01, - MSN_LIST_AL_OP = 0x02, - MSN_LIST_BL_OP = 0x04, - MSN_LIST_RL_OP = 0x08, - MSN_LIST_PL_OP = 0x10 -} MsnListOp; -#define MSN_LIST_OP_MASK 0x07 - -typedef enum -{ - MSN_CLIENT_CAP_WIN_MOBILE = 0x0000001, - MSN_CLIENT_CAP_INK_GIF = 0x0000004, - MSN_CLIENT_CAP_INK_ISF = 0x0000008, - MSN_CLIENT_CAP_VIDEO_CHAT = 0x0000010, - MSN_CLIENT_CAP_PACKET = 0x0000020, - MSN_CLIENT_CAP_MSNMOBILE = 0x0000040, - MSN_CLIENT_CAP_MSNDIRECT = 0x0000080, - MSN_CLIENT_CAP_WEBMSGR = 0x0000200, - MSN_CLIENT_CAP_TGW = 0x0000800, - MSN_CLIENT_CAP_SPACE = 0x0001000, - MSN_CLIENT_CAP_MCE = 0x0002000, - MSN_CLIENT_CAP_DIRECTIM = 0x0004000, - MSN_CLIENT_CAP_WINKS = 0x0008000, - MSN_CLIENT_CAP_SEARCH = 0x0010000, - MSN_CLIENT_CAP_BOT = 0x0020000, - MSN_CLIENT_CAP_VOICEIM = 0x0040000, - MSN_CLIENT_CAP_SCHANNEL = 0x0080000, - MSN_CLIENT_CAP_SIP_INVITE = 0x0100000, - MSN_CLIENT_CAP_SDRIVE = 0x0400000, - MSN_CLIENT_CAP_ONECARE = 0x1000000, - MSN_CLIENT_CAP_P2P_TURN = 0x2000000, - MSN_CLIENT_CAP_P2P_BOOTSTRAP_VIA_UUN = 0x4000000, -} MsnClientCaps; - -typedef enum -{ - MSN_CLIENT_EXT_CAP_RTC_VIDEO = 0x10, - MSN_CLIENT_EXT_CAP_P2PV2 = 0x20 -} MsnClientExtCaps; - -typedef enum -{ - MSN_CLIENT_VER_5_0 = 0x00, - MSN_CLIENT_VER_6_0 = 0x10, /* MSNC1 */ - MSN_CLIENT_VER_6_1 = 0x20, /* MSNC2 */ - MSN_CLIENT_VER_6_2 = 0x30, /* MSNC3 */ - MSN_CLIENT_VER_7_0 = 0x40, /* MSNC4 */ - MSN_CLIENT_VER_7_5 = 0x50, /* MSNC5 */ - MSN_CLIENT_VER_8_0 = 0x60, /* MSNC6 */ - MSN_CLIENT_VER_8_1 = 0x70, /* MSNC7 */ - MSN_CLIENT_VER_8_5 = 0x80, /* MSNC8 */ - MSN_CLIENT_VER_9_0 = 0x90, /* MSNC9 */ - MSN_CLIENT_VER_14_0 = 0xA0 /* MSNC10 */ -} MsnClientVerId; - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "connection.h" -#include "conversation.h" -#include "debug.h" -#include "cipher.h" -#include "notify.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "servconn.h" -#include "sslconn.h" -#include "util.h" - -#include "ft.h" - -#include "msg.h" - -#define MSN_BUF_LEN 8192 - -/* Windows Live Messenger Server*/ -#define MSN_SERVER "messenger.hotmail.com" -#define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com" -#define MSN_PORT 1863 -#define WLM_PROT_VER 15 - -#define WLM_MAX_PROTOCOL 15 -#define WLM_MIN_PROTOCOL 15 - -#define MSN_TYPING_RECV_TIMEOUT 6 -#define MSN_TYPING_SEND_TIMEOUT 4 - -#define PROFILE_URL "http://spaces.live.com/profile.aspx?mem=" -#define PHOTO_URL " contactparams:photopreauthurl=\"" - -#define BUDDY_ALIAS_MAXLEN 387 - -#define MSN_CAM_GUID "4BD96FC0-AB17-4425-A14A-439185962DC8" -#define MSN_CAM_REQUEST_GUID "1C9AA97E-9C05-4583-A3BD-908A196F1E92" -#define MSN_FT_GUID "5D3E02AB-6190-11D3-BBBB-00C04F795683" -#define MSN_OBJ_GUID "A4268EEC-FEC5-49E5-95C3-F126696BDBF6" - -#define MSN_CLIENTINFO \ - "Client-Name: Purple/" VERSION "\r\n" \ - "Chat-Logging: Y\r\n" - -/* Index into attention_types */ -#define MSN_NUDGE 0 - -#define MSN_CLIENT_ID_VERSION MSN_CLIENT_VER_7_0 -#define MSN_CLIENT_ID_CAPABILITIES (MSN_CLIENT_CAP_PACKET|MSN_CLIENT_CAP_INK_GIF|MSN_CLIENT_CAP_VOICEIM) - -#define MSN_CLIENT_ID \ - ((MSN_CLIENT_ID_VERSION << 24) | \ - (MSN_CLIENT_ID_CAPABILITIES)) - -#define MSN_CLIENT_EXT_ID 0 - -gboolean msn_email_is_valid(const char *passport); -void msn_act_id(PurpleConnection *gc, const char *entry); -void msn_send_privacy(PurpleConnection *gc); -void msn_send_im_message(MsnSession *session, MsnMessage *msg); - -#endif /* MSN_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,582 +0,0 @@ -/** - * @file msnutils.c Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msnutils.h" - -#include "cipher.h" - -char *rand_guid(void); - -/************************************************************************** - * Util - **************************************************************************/ -char * -rand_guid() -{ - return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X", - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111); -} - -void -msn_parse_format(const char *mime, char **pre_ret, char **post_ret) -{ - char *cur; - GString *pre = g_string_new(NULL); - GString *post = g_string_new(NULL); - unsigned int colors[3]; - - if (pre_ret != NULL) *pre_ret = NULL; - if (post_ret != NULL) *post_ret = NULL; - - cur = strstr(mime, "FN="); - - if (cur && (*(cur = cur + 3) != ';')) - { - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - - cur = strstr(mime, "EF="); - - if (cur && (*(cur = cur + 3) != ';')) - { - while (*cur && *cur != ';') - { - pre = g_string_append_c(pre, '<'); - pre = g_string_append_c(pre, *cur); - pre = g_string_append_c(pre, '>'); - post = g_string_prepend_c(post, '>'); - post = g_string_prepend_c(post, *cur); - post = g_string_prepend_c(post, '/'); - post = g_string_prepend_c(post, '<'); - cur++; - } - } - - cur = strstr(mime, "CO="); - - if (cur && (*(cur = cur + 3) != ';')) - { - int i; - - i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); - - if (i > 0) - { - char tag[64]; - - if (i == 1) - { - colors[1] = 0; - colors[2] = 0; - } - else if (i == 2) - { - unsigned int temp = colors[0]; - - colors[0] = colors[1]; - colors[1] = temp; - colors[2] = 0; - } - else if (i == 3) - { - unsigned int temp = colors[2]; - - colors[2] = colors[0]; - colors[0] = temp; - } - - g_snprintf(tag, sizeof(tag), - "", - colors[0], colors[1], colors[2]); - - pre = g_string_append(pre, tag); - post = g_string_prepend(post, ""); - } - } - - cur = strstr(mime, "RL="); - - if (cur && (*(cur = cur + 3) != ';')) - { - if (*cur == '1') - { - /* RTL text was received */ - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - } - - cur = g_strdup(purple_url_decode(pre->str)); - g_string_free(pre, TRUE); - - if (pre_ret != NULL) - *pre_ret = cur; - else - g_free(cur); - - cur = g_strdup(purple_url_decode(post->str)); - g_string_free(post, TRUE); - - if (post_ret != NULL) - *post_ret = cur; - else - g_free(cur); -} - -/*encode the str to RFC2047 style - * Currently only support the UTF-8 and base64 encode - */ -char * -msn_encode_mime(const char *str) -{ - gchar *base64, *retval; - - g_return_val_if_fail(str != NULL, NULL); - - base64 = purple_base64_encode((guchar *)str, strlen(str)); - retval = g_strdup_printf("=?utf-8?B?%s?=", base64); - g_free(base64); - - return retval; -} - -/* - * We need this because we're only supposed to encode spaces in the font - * names. purple_url_encode() isn't acceptable. - */ -static const char * -encode_spaces(const char *str) -{ - static char buf[BUF_LEN]; - const char *c; - char *d; - - g_return_val_if_fail(str != NULL, NULL); - - for (c = str, d = buf; *c != '\0'; c++) - { - if (*c == ' ') - { - *d++ = '%'; - *d++ = '2'; - *d++ = '0'; - } - else - *d++ = *c; - } - *d = '\0'; - - return buf; -} - -/* - * Taken from the zephyr plugin. - * This parses HTML formatting (put out by one of the gtkimhtml widgets - * and converts it to msn formatting. It doesn't deal with the tag closing, - * but gtkimhtml widgets give valid html. - * It currently deals properly with , , , , - * , , . - * It ignores and - */ -void -msn_import_html(const char *html, char **attributes, char **message) -{ - int len, retcount = 0; - const char *c; - char *msg; - char *fontface = NULL; - char fonteffect[5]; - char fontcolor[7]; - char direction = '0'; - - gboolean has_bold = FALSE; - gboolean has_italic = FALSE; - gboolean has_underline = FALSE; - gboolean has_strikethrough = FALSE; - - g_return_if_fail(html != NULL); - g_return_if_fail(attributes != NULL); - g_return_if_fail(message != NULL); - - len = strlen(html); - msg = g_malloc0(len + 1); - - memset(fontcolor, 0, sizeof(fontcolor)); - strcat(fontcolor, "0"); - memset(fonteffect, 0, sizeof(fonteffect)); - - for (c = html; *c != '\0';) - { - if (*c == '<') - { - if (!g_ascii_strncasecmp(c + 1, "br>", 3)) - { - msg[retcount++] = '\r'; - msg[retcount++] = '\n'; - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "i>", 2)) - { - if (!has_italic) - { - strcat(fonteffect, "I"); - has_italic = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "b>", 2)) - { - if (!has_bold) - { - strcat(fonteffect, "B"); - has_bold = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "u>", 2)) - { - if (!has_underline) - { - strcat(fonteffect, "U"); - has_underline = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "s>", 2)) - { - if (!has_strikethrough) - { - strcat(fonteffect, "S"); - has_strikethrough = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "a href=\"", 8)) - { - c += 9; - - if (!g_ascii_strncasecmp(c, "mailto:", 7)) - c += 7; - - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - msg[retcount++] = *c++; - - if (*c != '\0') - c += 2; - - /* ignore descriptive string */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "", 4)) - c++; - - if (*c != '\0') - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "span", 4)) - { - /* Bi-directional text support using CSS properties in span tags */ - c += 5; - - while (*c != '\0' && *c != '>') - { - while (*c == ' ') - c++; - if (!g_ascii_strncasecmp(c, "dir=\"rtl\"", 9)) - { - c += 9; - direction = '1'; - } - else if (!g_ascii_strncasecmp(c, "style=\"", 7)) - { - /* Parse inline CSS attributes */ - char *attributes; - int attr_len = 0; - c += 7; - while (*(c + attr_len) != '\0' && *(c + attr_len) != '"') - attr_len++; - if (*(c + attr_len) == '"') - { - char *attr_dir; - attributes = g_strndup(c, attr_len); - attr_dir = purple_markup_get_css_property(attributes, "direction"); - if (attr_dir && (!g_ascii_strncasecmp(attr_dir, "RTL", 3))) - direction = '1'; - g_free(attr_dir); - g_free(attributes); - } - - } - else - { - c++; - } - } - if (*c == '>') - c++; - } - else if (!g_ascii_strncasecmp(c + 1, "font", 4)) - { - c += 5; - - while ((*c != '\0') && !g_ascii_strncasecmp(c, " ", 1)) - c++; - - if (!g_ascii_strncasecmp(c, "color=\"#", 7)) - { - c += 8; - - fontcolor[0] = *(c + 4); - fontcolor[1] = *(c + 5); - fontcolor[2] = *(c + 2); - fontcolor[3] = *(c + 3); - fontcolor[4] = *c; - fontcolor[5] = *(c + 1); - - c += 8; - } - else if (!g_ascii_strncasecmp(c, "face=\"", 6)) - { - const char *end = NULL; - const char *comma = NULL; - unsigned int namelen = 0; - - c += 6; - end = strchr(c, '\"'); - comma = strchr(c, ','); - - if (comma == NULL || comma > end) - namelen = (unsigned int)(end - c); - else - namelen = (unsigned int)(comma - c); - - fontface = g_strndup(c, namelen); - c = end + 2; - } - else - { - /* Drop all unrecognized/misparsed font tags */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - c++; - - if (*c != '\0') - c += 2; - } - } - else - { - while ((*c != '\0') && (*c != '>')) - c++; - if (*c != '\0') - c++; - } - } - else if (*c == '&') - { - if (!g_ascii_strncasecmp(c, "<", 4)) - { - msg[retcount++] = '<'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, ">", 4)) - { - msg[retcount++] = '>'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, " ", 6)) - { - msg[retcount++] = ' '; - c += 6; - } - else if (!g_ascii_strncasecmp(c, """, 6)) - { - msg[retcount++] = '"'; - c += 6; - } - else if (!g_ascii_strncasecmp(c, "&", 5)) - { - msg[retcount++] = '&'; - c += 5; - } - else if (!g_ascii_strncasecmp(c, "'", 6)) - { - msg[retcount++] = '\''; - c += 6; - } - else - msg[retcount++] = *c++; - } - else - msg[retcount++] = *c++; - } - - if (fontface == NULL) - fontface = g_strdup("Segoe UI"); - - *attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0; RL=%c", - encode_spaces(fontface), - fonteffect, fontcolor, direction); - *message = msg; - - g_free(fontface); -} - -void -msn_parse_socket(const char *str, char **ret_host, int *ret_port) -{ - char *host; - char *c; - int port; - - host = g_strdup(str); - - if ((c = strchr(host, ':')) != NULL) { - *c = '\0'; - port = atoi(c + 1); - } else { - port = 1863; - } - - *ret_host = host; - *ret_port = port; -} - -/*************************************************************************** - * MSN Challenge Computing Function - ***************************************************************************/ - -/* - * Handle MSN Challenge computation - * This algorithm references - * http://imfreedom.org/wiki/index.php/MSN:NS/Challenges - */ -#define BUFSIZE 256 -void -msn_handle_chl(char *input, char *output) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - const guchar productKey[] = MSNP15_WLM_PRODUCT_KEY; - const guchar productID[] = MSNP15_WLM_PRODUCT_ID; - const char hexChars[] = "0123456789abcdef"; - char buf[BUFSIZE]; - unsigned char md5Hash[16]; - unsigned char *newHash; - unsigned int *md5Parts; - unsigned int *chlStringParts; - unsigned int newHashParts[5]; - - long long nHigh = 0, nLow = 0; - - int len; - int i; - - /* Create the MD5 hash by using Purple MD5 algorithm */ - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (guchar *)input, strlen(input)); - purple_cipher_context_append(context, productKey, sizeof(productKey) - 1); - purple_cipher_context_digest(context, sizeof(md5Hash), md5Hash, NULL); - purple_cipher_context_destroy(context); - - /* Split it into four integers */ - md5Parts = (unsigned int *)md5Hash; - for (i = 0; i < 4; i++) { - /* adjust endianess */ - md5Parts[i] = GUINT_TO_LE(md5Parts[i]); - - /* & each integer with 0x7FFFFFFF */ - /* and save one unmodified array for later */ - newHashParts[i] = md5Parts[i]; - md5Parts[i] &= 0x7FFFFFFF; - } - - /* make a new string and pad with '0' to length that's a multiple of 8 */ - snprintf(buf, BUFSIZE - 5, "%s%s", input, productID); - len = strlen(buf); - if ((len % 8) != 0) { - int fix = 8 - (len % 8); - memset(&buf[len], '0', fix); - buf[len + fix] = '\0'; - len += fix; - } - - /* split into integers */ - chlStringParts = (unsigned int *)buf; - - /* this is magic */ - for (i = 0; i < (strlen(buf) / 4); i += 2) { - long long temp; - - chlStringParts[i] = GUINT_TO_LE(chlStringParts[i]); - chlStringParts[i + 1] = GUINT_TO_LE(chlStringParts[i + 1]); - - temp = (0x0E79A9C1 * (long long)chlStringParts[i]) % 0x7FFFFFFF; - temp = (md5Parts[0] * (temp + nLow) + md5Parts[1]) % 0x7FFFFFFF; - nHigh += temp; - - temp = ((long long)chlStringParts[i + 1] + temp) % 0x7FFFFFFF; - nLow = (md5Parts[2] * temp + md5Parts[3]) % 0x7FFFFFFF; - nHigh += nLow; - } - nLow = (nLow + md5Parts[1]) % 0x7FFFFFFF; - nHigh = (nHigh + md5Parts[3]) % 0x7FFFFFFF; - - newHashParts[0] ^= nLow; - newHashParts[1] ^= nHigh; - newHashParts[2] ^= nLow; - newHashParts[3] ^= nHigh; - - /* adjust endianness */ - for(i = 0; i < 4; i++) - newHashParts[i] = GUINT_TO_LE(newHashParts[i]); - - /* make a string of the parts */ - newHash = (unsigned char *)newHashParts; - - /* convert to hexadecimal */ - for (i = 0; i < 16; i++) - { - output[i * 2] = hexChars[(newHash[i] >> 4) & 0xF]; - output[(i * 2) + 1] = hexChars[newHash[i] & 0xF]; - } - - output[32] = '\0'; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/msnutils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/** - * @file msnutils.h Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_UTILS_H -#define MSN_UTILS_H - -/*encode the str to RFC2047 style*/ -char *msn_encode_mime(const char *str); - -/** - * Generate the Random GUID - */ -char *rand_guid(void); - -/** - * Parses the MSN message formatting into a format compatible with Purple. - * - * @param mime The mime header with the formatting. - * @param pre_ret The returned prefix string. - * @param post_ret The returned postfix string. - * - * @return The new message. - */ -void msn_parse_format(const char *mime, char **pre_ret, char **post_ret); - -/** - * Parses the Purple message formatting (html) into the MSN format. - * - * @param html The html message to format. - * @param attributes The returned attributes string. - * @param message The returned message string. - * - * @return The new message. - */ -void msn_import_html(const char *html, char **attributes, char **message); - -void msn_parse_socket(const char *str, char **ret_host, int *ret_port); -void msn_handle_chl(char *input, char *output); - -#endif /* MSN_UTILS_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,679 +0,0 @@ -/** - * @file nexus.c MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "soap.h" -#include "nexus.h" -#include "notification.h" - -/************************************************************************** - * Valid Ticket Tokens - **************************************************************************/ - -#define SSO_VALID_TICKET_DOMAIN 0 -#define SSO_VALID_TICKET_POLICY 1 -static char *ticket_domains[][2] = { - /* http://msnpiki.msnfanatic.com/index.php/MSNP15:SSO */ - /* {"Domain", "Policy Ref URI"}, Purpose */ - {"messengerclear.live.com", NULL}, /* Authentication for messenger. */ - {"messenger.msn.com", "?id=507"}, /* Authentication for receiving OIMs. */ - {"contacts.msn.com", "MBI"}, /* Authentication for the Contact server. */ - {"messengersecure.live.com", "MBI_SSL"}, /* Authentication for sending OIMs. */ - {"spaces.live.com", "MBI"}, /* Authentication for the Windows Live Spaces */ - {"livecontacts.live.com", "MBI"}, /* Live Contacts API, a simplified version of the Contacts SOAP service */ - {"storage.live.com", "MBI"}, /* Storage REST API */ -}; - -/************************************************************************** - * Main - **************************************************************************/ - -MsnNexus * -msn_nexus_new(MsnSession *session) -{ - MsnNexus *nexus; - int i; - - nexus = g_new0(MsnNexus, 1); - nexus->session = session; - - nexus->token_len = sizeof(ticket_domains) / sizeof(char *[2]); - nexus->tokens = g_new0(MsnTicketToken, nexus->token_len); - - for (i = 0; i < nexus->token_len; i++) - nexus->tokens[i].token = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - return nexus; -} - -void -msn_nexus_destroy(MsnNexus *nexus) -{ - int i; - for (i = 0; i < nexus->token_len; i++) { - g_hash_table_destroy(nexus->tokens[i].token); - g_free(nexus->tokens[i].secret); - g_slist_free(nexus->tokens[i].updates); - } - - g_free(nexus->tokens); - g_free(nexus->policy); - g_free(nexus->nonce); - g_free(nexus->cipher); - g_free(nexus->secret); - g_free(nexus); -} - -/************************************************************************** - * RPS/SSO Authentication - **************************************************************************/ - -static char * -rps_create_key(const char *key, int key_len, const char *data, size_t data_len) -{ - const guchar magic[] = "WS-SecureConversation"; - const int magic_len = sizeof(magic) - 1; - - PurpleCipherContext *hmac; - guchar hash1[20], hash2[20], hash3[20], hash4[20]; - char *result; - - hmac = purple_cipher_context_new_by_name("hmac", NULL); - - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, magic, magic_len); - purple_cipher_context_append(hmac, (guchar *)data, data_len); - purple_cipher_context_digest(hmac, sizeof(hash1), hash1, NULL); - - purple_cipher_context_reset(hmac, NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, hash1, 20); - purple_cipher_context_append(hmac, magic, magic_len); - purple_cipher_context_append(hmac, (guchar *)data, data_len); - purple_cipher_context_digest(hmac, sizeof(hash2), hash2, NULL); - - purple_cipher_context_reset(hmac, NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, hash1, 20); - purple_cipher_context_digest(hmac, sizeof(hash3), hash3, NULL); - - purple_cipher_context_reset(hmac, NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, key_len); - purple_cipher_context_append(hmac, hash3, sizeof(hash3)); - purple_cipher_context_append(hmac, magic, magic_len); - purple_cipher_context_append(hmac, (guchar *)data, data_len); - purple_cipher_context_digest(hmac, sizeof(hash4), hash4, NULL); - - purple_cipher_context_destroy(hmac); - - result = g_malloc(24); - memcpy(result, hash2, sizeof(hash2)); - memcpy(result + sizeof(hash2), hash4, 4); - - return result; -} - -static char * -des3_cbc(const char *key, const char *iv, const char *data, int len, gboolean decrypt) -{ - PurpleCipherContext *des3; - char *out; - size_t outlen; - - des3 = purple_cipher_context_new_by_name("des3", NULL); - purple_cipher_context_set_key(des3, (guchar *)key); - purple_cipher_context_set_batch_mode(des3, PURPLE_CIPHER_BATCH_MODE_CBC); - purple_cipher_context_set_iv(des3, (guchar *)iv, 8); - - out = g_malloc(len); - if (decrypt) - purple_cipher_context_decrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); - else - purple_cipher_context_encrypt(des3, (guchar *)data, len, (guchar *)out, &outlen); - - purple_cipher_context_destroy(des3); - - return out; -} - -#define CRYPT_MODE_CBC 1 -#define CIPHER_TRIPLE_DES 0x6603 -#define HASH_SHA1 0x8004 -static char * -msn_rps_encrypt(MsnNexus *nexus) -{ - MsnUsrKey *usr_key; - const char magic1[] = "SESSION KEY HASH"; - const char magic2[] = "SESSION KEY ENCRYPTION"; - PurpleCipherContext *hmac; - size_t len; - guchar hash[20]; - char *key1, *key2, *key3; - gsize key1_len; - int *iv; - char *nonce_fixed; - char *cipher; - char *response; - - usr_key = g_malloc(sizeof(MsnUsrKey)); - usr_key->size = GUINT32_TO_LE(28); - usr_key->crypt_mode = GUINT32_TO_LE(CRYPT_MODE_CBC); - usr_key->cipher_type = GUINT32_TO_LE(CIPHER_TRIPLE_DES); - usr_key->hash_type = GUINT32_TO_LE(HASH_SHA1); - usr_key->iv_len = GUINT32_TO_LE(8); - usr_key->hash_len = GUINT32_TO_LE(20); - usr_key->cipher_len = GUINT32_TO_LE(72); - - key1 = (char *)purple_base64_decode((const char *)nexus->tokens[MSN_AUTH_MESSENGER].secret, &key1_len); - key2 = rps_create_key(key1, key1_len, magic1, sizeof(magic1) - 1); - key3 = rps_create_key(key1, key1_len, magic2, sizeof(magic2) - 1); - - iv = (int *)usr_key->iv; - iv[0] = rand(); - iv[1] = rand(); - - len = strlen(nexus->nonce); - hmac = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key2, 24); - purple_cipher_context_append(hmac, (guchar *)nexus->nonce, len); - purple_cipher_context_digest(hmac, 20, hash, NULL); - purple_cipher_context_destroy(hmac); - - /* We need to pad this to 72 bytes, apparently */ - nonce_fixed = g_malloc(len + 8); - memcpy(nonce_fixed, nexus->nonce, len); - memset(nonce_fixed + len, 0x08, 8); - cipher = des3_cbc(key3, usr_key->iv, nonce_fixed, len + 8, FALSE); - g_free(nonce_fixed); - - memcpy(usr_key->hash, hash, 20); - memcpy(usr_key->cipher, cipher, 72); - - g_free(key1); - g_free(key2); - g_free(key3); - g_free(cipher); - - response = purple_base64_encode((guchar *)usr_key, sizeof(MsnUsrKey)); - - g_free(usr_key); - - return response; -} - -/************************************************************************** - * Login - **************************************************************************/ - -/* Used to specify which token to update when only doing single updates */ -typedef struct _MsnNexusUpdateData MsnNexusUpdateData; -struct _MsnNexusUpdateData { - MsnNexus *nexus; - int id; -}; - -typedef struct _MsnNexusUpdateCallback MsnNexusUpdateCallback; -struct _MsnNexusUpdateCallback { - GSourceFunc cb; - gpointer data; -}; - -#if !GLIB_CHECK_VERSION(2, 12, 0) -static gboolean -nexus_remove_all_cb(gpointer key, gpointer val, gpointer data) -{ - return TRUE; -} -#endif - - -static gboolean -nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node) -{ - char *token_str, *expiry_str; - const char *id_str; - char **elems, **cur, **tokens; - xmlnode *token = xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken"); - xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); - xmlnode *expires = xmlnode_get_child(node, "LifeTime/Expires"); - - if (!token) - return FALSE; - - /* Use the ID that the server sent us */ - if (id == -1) { - id_str = xmlnode_get_attrib(token, "Id"); - if (id_str == NULL) - return FALSE; - - id = atol(id_str + 7) - 1; /* 'Compact#' or 'PPToken#' */ - if (id >= nexus->token_len) - return FALSE; /* Where did this come from? */ - } - - token_str = xmlnode_get_data(token); - if (token_str == NULL) - return FALSE; - -#if GLIB_CHECK_VERSION(2, 12, 0) - g_hash_table_remove_all(nexus->tokens[id].token); -#else - g_hash_table_foreach_remove(nexus->tokens[id].token, - nexus_remove_all_cb, NULL); -#endif - - elems = g_strsplit(token_str, "&", 0); - - for (cur = elems; *cur != NULL; cur++) { - tokens = g_strsplit(*cur, "=", 2); - g_hash_table_insert(nexus->tokens[id].token, tokens[0], tokens[1]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - g_strfreev(elems); - g_free(token_str); - - if (secret) - nexus->tokens[id].secret = xmlnode_get_data(secret); - else - nexus->tokens[id].secret = NULL; - - /* Yay for MS using ISO-8601 */ - expiry_str = xmlnode_get_data(expires); - nexus->tokens[id].expiry = purple_str_to_time(expiry_str, - FALSE, NULL, NULL, NULL); - g_free(expiry_str); - - purple_debug_info("msn", "Updated ticket for domain '%s', expires at %" G_GINT64_FORMAT ".\n", - ticket_domains[id][SSO_VALID_TICKET_DOMAIN], - (gint64)nexus->tokens[id].expiry); - return TRUE; -} - -static gboolean -nexus_parse_collection(MsnNexus *nexus, int id, xmlnode *collection) -{ - xmlnode *node; - gboolean result; - - node = xmlnode_get_child(collection, "RequestSecurityTokenResponse"); - - if (!node) - return FALSE; - - result = TRUE; - for (; node && result; node = node->next) { - xmlnode *endpoint = xmlnode_get_child(node, "AppliesTo/EndpointReference/Address"); - char *address = xmlnode_get_data(endpoint); - - if (g_str_equal(address, "http://Passport.NET/tb")) { - /* This node contains the stuff for updating tokens. */ - char *data; - xmlnode *cipher = xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue"); - xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret"); - - g_free(nexus->cipher); - nexus->cipher = xmlnode_get_data(cipher); - data = xmlnode_get_data(secret); - g_free(nexus->secret); - nexus->secret = (char *)purple_base64_decode(data, NULL); - g_free(data); - - } else { - result = nexus_parse_token(nexus, id, node); - } - g_free(address); - } - - return result; -} - -static void -nexus_got_response_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnNexus *nexus = data; - MsnSession *session = nexus->session; - const char *ticket; - char *response; - - if (resp == NULL) { - msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Unable to connect")); - return; - } - - if (!nexus_parse_collection(nexus, -1, - xmlnode_get_child(resp->xml, - "Body/RequestSecurityTokenResponseCollection"))) { - msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Windows Live ID authentication:Invalid response")); - return; - } - - ticket = msn_nexus_get_token_str(nexus, MSN_AUTH_MESSENGER); - response = msn_rps_encrypt(nexus); - msn_got_login_params(session, ticket, response); - g_free(response); -} - -/*when connect, do the SOAP Style windows Live ID authentication */ -void -msn_nexus_connect(MsnNexus *nexus) -{ - MsnSession *session = nexus->session; - const char *username; - const char *password; - char *password_xml; - GString *domains; - char *request; - int i; - - MsnSoapMessage *soap; - - purple_debug_info("msn", "Starting Windows Live ID authentication\n"); - msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); - - username = purple_account_get_username(session->account); - password = purple_connection_get_password(session->account->gc); - if (g_utf8_strlen(password, -1) > 16) { - /* max byte size for 16 utf8 characters is 64 + 1 for the null */ - gchar truncated[65]; - g_utf8_strncpy(truncated, password, 16); - password_xml = g_markup_escape_text(truncated, -1); - } else { - password_xml = g_markup_escape_text(password, -1); - } - - purple_debug_info("msn", "Logging on %s, with policy '%s', nonce '%s'\n", - username, nexus->policy, nexus->nonce); - - domains = g_string_new(NULL); - for (i = 0; i < nexus->token_len; i++) { - g_string_append_printf(domains, MSN_SSO_RST_TEMPLATE, - i+1, - ticket_domains[i][SSO_VALID_TICKET_DOMAIN], - ticket_domains[i][SSO_VALID_TICKET_POLICY] != NULL ? - ticket_domains[i][SSO_VALID_TICKET_POLICY] : - nexus->policy); - } - - request = g_strdup_printf(MSN_SSO_TEMPLATE, username, password_xml, domains->str); - g_free(password_xml); - g_string_free(domains, TRUE); - - soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); - g_free(request); - msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE, - nexus_got_response_cb, nexus); -} - -static void -nexus_got_update_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data) -{ - MsnNexusUpdateData *ud = data; - MsnNexus *nexus = ud->nexus; - char iv[8] = {0,0,0,0,0,0,0,0}; - xmlnode *enckey; - char *tmp; - char *nonce; - gsize len; - char *key; - GSList *updates; - -#if 0 - char *decrypted_pp; -#endif - char *decrypted_data; - - if (resp == NULL) - return; - - purple_debug_info("msn", "Got Update Response for %s.\n", ticket_domains[ud->id][SSO_VALID_TICKET_DOMAIN]); - - enckey = xmlnode_get_child(resp->xml, "Header/Security/DerivedKeyToken"); - while (enckey) { - if (g_str_equal(xmlnode_get_attrib(enckey, "Id"), "EncKey")) - break; - enckey = xmlnode_get_next_twin(enckey); - } - if (!enckey) { - purple_debug_error("msn", "Invalid response in token update.\n"); - return; - } - - tmp = xmlnode_get_data(xmlnode_get_child(enckey, "Nonce")); - nonce = (char *)purple_base64_decode(tmp, &len); - key = rps_create_key(nexus->secret, 24, nonce, len); - g_free(tmp); - g_free(nonce); - -#if 0 - /* Don't know what this is for yet */ - tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, - "Header/EncryptedPP/EncryptedData/CipherData/CipherValue")); - if (tmp) { - decrypted_pp = des3_cbc(key, iv, tmp, len, TRUE); - g_free(tmp); - purple_debug_info("msn", "Got Response Header EncryptedPP: %s\n", decrypted_pp); - g_free(decrypted_pp); - } -#endif - - tmp = xmlnode_get_data(xmlnode_get_child(resp->xml, - "Body/EncryptedData/CipherData/CipherValue")); - if (tmp) { - char *unescaped; - xmlnode *rstresponse; - - unescaped = (char *)purple_base64_decode(tmp, &len); - g_free(tmp); - - decrypted_data = des3_cbc(key, iv, unescaped, len, TRUE); - g_free(unescaped); - purple_debug_info("msn", "Got Response Body EncryptedData: %s\n", decrypted_data); - - rstresponse = xmlnode_from_str(decrypted_data, -1); - if (g_str_equal(rstresponse->name, "RequestSecurityTokenResponse")) - nexus_parse_token(nexus, ud->id, rstresponse); - else - nexus_parse_collection(nexus, ud->id, rstresponse); - g_free(decrypted_data); - } - - updates = nexus->tokens[ud->id].updates; - nexus->tokens[ud->id].updates = NULL; - while (updates != NULL) { - MsnNexusUpdateCallback *update = updates->data; - if (update->cb) - purple_timeout_add(0, update->cb, update->data); - g_free(update); - updates = g_slist_delete_link(updates, updates); - } - - g_free(ud); - g_free(key); -} - -void -msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data) -{ - MsnSession *session = nexus->session; - MsnNexusUpdateData *ud; - MsnNexusUpdateCallback *update; - PurpleCipherContext *sha1; - PurpleCipherContext *hmac; - - char *key; - - guchar digest[20]; - - struct tm *tm; - time_t now; - char *now_str; - char *timestamp; - char *timestamp_b64; - - char *domain; - char *domain_b64; - - char *signedinfo; - gint32 nonce[6]; - int i; - char *nonce_b64; - char *signature_b64; - guchar signature[20]; - - char *request; - MsnSoapMessage *soap; - - update = g_new0(MsnNexusUpdateCallback, 1); - update->cb = cb; - update->data = data; - - if (nexus->tokens[id].updates != NULL) { - /* Update already in progress. Just add to list and return. */ - purple_debug_info("msn", - "Ticket update for user '%s' on domain '%s' in progress. Adding request to queue.\n", - purple_account_get_username(session->account), - ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); - nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates, - update); - return; - } else { - purple_debug_info("msn", - "Updating ticket for user '%s' on domain '%s'\n", - purple_account_get_username(session->account), - ticket_domains[id][SSO_VALID_TICKET_DOMAIN]); - nexus->tokens[id].updates = g_slist_prepend(nexus->tokens[id].updates, - update); - } - - ud = g_new0(MsnNexusUpdateData, 1); - ud->nexus = nexus; - ud->id = id; - - sha1 = purple_cipher_context_new_by_name("sha1", NULL); - - domain = g_strdup_printf(MSN_SSO_RST_TEMPLATE, - id, - ticket_domains[id][SSO_VALID_TICKET_DOMAIN], - ticket_domains[id][SSO_VALID_TICKET_POLICY] != NULL ? - ticket_domains[id][SSO_VALID_TICKET_POLICY] : - nexus->policy); - purple_cipher_context_append(sha1, (guchar *)domain, strlen(domain)); - purple_cipher_context_digest(sha1, 20, digest, NULL); - domain_b64 = purple_base64_encode(digest, 20); - - now = time(NULL); - tm = gmtime(&now); - now_str = g_strdup(purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); - now += 5*60; - tm = gmtime(&now); - timestamp = g_strdup_printf(MSN_SSO_TIMESTAMP_TEMPLATE, - now_str, - purple_utf8_strftime("%Y-%m-%dT%H:%M:%SZ", tm)); - purple_cipher_context_reset(sha1, NULL); - purple_cipher_context_append(sha1, (guchar *)timestamp, strlen(timestamp)); - purple_cipher_context_digest(sha1, 20, digest, NULL); - timestamp_b64 = purple_base64_encode(digest, 20); - g_free(now_str); - - purple_cipher_context_destroy(sha1); - - signedinfo = g_strdup_printf(MSN_SSO_SIGNEDINFO_TEMPLATE, - id, - domain_b64, - timestamp_b64); - - for (i = 0; i < 6; i++) - nonce[i] = rand(); - nonce_b64 = purple_base64_encode((guchar *)&nonce, sizeof(nonce)); - - key = rps_create_key(nexus->secret, 24, (char *)nonce, sizeof(nonce)); - hmac = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(hmac, "hash", "sha1"); - purple_cipher_context_set_key_with_len(hmac, (guchar *)key, 24); - purple_cipher_context_append(hmac, (guchar *)signedinfo, strlen(signedinfo)); - purple_cipher_context_digest(hmac, 20, signature, NULL); - purple_cipher_context_destroy(hmac); - signature_b64 = purple_base64_encode(signature, 20); - - request = g_strdup_printf(MSN_SSO_TOKEN_UPDATE_TEMPLATE, - nexus->cipher, - nonce_b64, - timestamp, - signedinfo, - signature_b64, - domain); - - g_free(nonce_b64); - g_free(domain_b64); - g_free(timestamp_b64); - g_free(timestamp); - g_free(key); - g_free(signature_b64); - g_free(signedinfo); - g_free(domain); - - soap = msn_soap_message_new(NULL, xmlnode_from_str(request, -1)); - g_free(request); - msn_soap_message_send(session, soap, MSN_SSO_SERVER, SSO_POST_URL, TRUE, - nexus_got_update_cb, ud); -} - -GHashTable * -msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id) -{ - g_return_val_if_fail(nexus != NULL, NULL); - g_return_val_if_fail(id < nexus->token_len, NULL); - - return nexus->tokens[id].token; -} - -const char * -msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id) -{ - static char buf[1024]; - GHashTable *token = msn_nexus_get_token(nexus, id); - const char *msn_t; - const char *msn_p; - gint ret; - - g_return_val_if_fail(token != NULL, NULL); - - msn_t = g_hash_table_lookup(token, "t"); - msn_p = g_hash_table_lookup(token, "p"); - - g_return_val_if_fail(msn_t != NULL, NULL); - g_return_val_if_fail(msn_p != NULL, NULL); - - ret = g_snprintf(buf, sizeof(buf) - 1, "t=%s&p=%s", msn_t, msn_p); - g_return_val_if_fail(ret != -1, NULL); - - return buf; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/nexus.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,234 +0,0 @@ -/** - * @file nexus.h MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_NEXUS_H -#define MSN_NEXUS_H - -typedef struct _MsnNexus MsnNexus; -typedef struct _MsnTicketToken MsnTicketToken; -typedef struct _MsnUsrKey MsnUsrKey; - -/* Index into ticket_tokens in nexus.c Keep updated! */ -typedef enum -{ - MSN_AUTH_MESSENGER = 0, - MSN_AUTH_MESSENGER_WEB = 1, - MSN_AUTH_CONTACTS = 2, - MSN_AUTH_LIVE_SECURE = 3, - MSN_AUTH_SPACES = 4, - MSN_AUTH_LIVE_CONTACTS = 5, - MSN_AUTH_STORAGE = 6 -} MsnAuthDomains; - -#define MSN_SSO_SERVER "login.live.com" -#define SSO_POST_URL "/RST.srf" - -#define MSN_SSO_RST_TEMPLATE \ -""\ - "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue"\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ -"" - -#define MSN_SSO_TEMPLATE ""\ -""\ - "
"\ - ""\ - "{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}"\ - "4"\ - "1"\ - ""\ - "AQAAAAIAAABsYwQAAAAxMDMz"\ - ""\ - ""\ - ""\ - "%s"\ - "%s"\ - ""\ - ""\ - "
"\ - ""\ - ""\ - ""\ - "http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue"\ - ""\ - ""\ - "http://Passport.NET/tb"\ - ""\ - ""\ - ""\ - "%s" /* Other RSTn tokens */\ - ""\ - ""\ -"
" - -#define MSN_SSO_AUTHINFO_TEMPLATE \ -""\ - "{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}"\ - "4"\ - "1"\ - ""\ - "AQAAAAIAAABsYwQAAAA0MTA1"\ -"" -/* Not sure what's editable here, so I'll just hard-code the SHA1 hash */ -#define MSN_SSO_AUTHINFO_SHA1_BASE64 "d2IeTF4DAkPEa/tVETHznsivEpc=" - -#define MSN_SSO_TIMESTAMP_TEMPLATE \ -""\ - "%s"\ - "%s"\ -"" - -#define MSN_SSO_SIGNEDINFO_TEMPLATE \ -""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "" MSN_SSO_AUTHINFO_SHA1_BASE64 ""\ - ""\ -"" - -#define MSN_SSO_TOKEN_UPDATE_TEMPLATE ""\ -""\ - "
"\ - MSN_SSO_AUTHINFO_TEMPLATE /* ps:AuthInfo */ \ - ""\ - ""\ - ""\ - ""\ - "http://Passport.NET/STS"\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - "%s" /* wsu:Timestamp */\ - ""\ - "%s" /* SignedInfo */\ - "%s"\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "
"\ - ""\ - "%s" /* wst:RequestSecurityToken */ \ - ""\ -"" - -struct _MsnUsrKey -{ - int size; /* 28. Does not count data */ - int crypt_mode; /* CRYPT_MODE_CBC (1) */ - int cipher_type; /* TripleDES (0x6603) */ - int hash_type; /* SHA1 (0x8004) */ - int iv_len; /* 8 */ - int hash_len; /* 20 */ - int cipher_len; /* 72 */ - /* Data */ - char iv[8]; - char hash[20]; - char cipher[72]; -}; - -struct _MsnTicketToken { - GHashTable *token; - char *secret; - time_t expiry; - GSList *updates; -}; - -struct _MsnNexus -{ - MsnSession *session; - - /* From server via USR command */ - char *policy; - char *nonce; - - /* From server via SOAP stuff */ - char *cipher; - char *secret; - MsnTicketToken *tokens; - int token_len; -}; - -void msn_nexus_connect(MsnNexus *nexus); -MsnNexus *msn_nexus_new(MsnSession *session); -void msn_nexus_destroy(MsnNexus *nexus); -GHashTable *msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id); -const char *msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id); -void msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data); - -#endif /* MSN_NEXUS_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2240 +0,0 @@ -/** - * @file notification.c Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "notification.h" -#include "contact.h" -#include "state.h" -#include "error.h" -#include "msnutils.h" -#include "page.h" - -#include "userlist.h" -#include "sync.h" -#include "slplink.h" - -static MsnTable *cbs_table; - -/************************************************************************** - * Main - **************************************************************************/ - -static void -destroy_cb(MsnServConn *servconn) -{ - MsnNotification *notification; - - notification = servconn->cmdproc->data; - g_return_if_fail(notification != NULL); - - msn_notification_destroy(notification); -} - -MsnNotification * -msn_notification_new(MsnSession *session) -{ - MsnNotification *notification; - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - notification = g_new0(MsnNotification, 1); - - notification->session = session; - notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS); - msn_servconn_set_destroy_cb(servconn, destroy_cb); - - notification->cmdproc = servconn->cmdproc; - notification->cmdproc->data = notification; - notification->cmdproc->cbs_table = cbs_table; - - return notification; -} - -void -msn_notification_destroy(MsnNotification *notification) -{ - notification->cmdproc->data = NULL; - - msn_servconn_set_destroy_cb(notification->servconn, NULL); - - msn_servconn_destroy(notification->servconn); - - g_free(notification); -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(MsnServConn *servconn) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - GString *vers; - const char *ver_str; - int i; - - g_return_if_fail(servconn != NULL); - - cmdproc = servconn->cmdproc; - session = servconn->session; - account = session->account; - - vers = g_string_new(""); - - for (i = WLM_MAX_PROTOCOL; i >= WLM_MIN_PROTOCOL; i--) - g_string_append_printf(vers, " MSNP%d", i); - - g_string_append(vers, " CVR0"); - - if (session->login_step == MSN_LOGIN_STEP_START) - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); - else - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2); - - /* Skip the initial space */ - ver_str = (vers->str + 1); - msn_cmdproc_send(cmdproc, "VER", "%s", ver_str); - - g_string_free(vers, TRUE); -} - -gboolean -msn_notification_connect(MsnNotification *notification, const char *host, int port) -{ - MsnServConn *servconn; - - g_return_val_if_fail(notification != NULL, FALSE); - - servconn = notification->servconn; - - msn_servconn_set_connect_cb(servconn, connect_cb); - notification->in_use = msn_servconn_connect(servconn, host, port, TRUE); - - return notification->in_use; -} - -void -msn_notification_disconnect(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - g_return_if_fail(notification->in_use); - - msn_servconn_disconnect(notification->servconn); - - notification->in_use = FALSE; -} - -/************************************************************************** - * Login - **************************************************************************/ - -void -msn_got_login_params(MsnSession *session, const char *ticket, const char *response) -{ - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); - - msn_cmdproc_send(cmdproc, "USR", "SSO S %s %s", ticket, response); -} - -static void -cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - - account = cmdproc->session->account; - - msn_cmdproc_send(cmdproc, "USR", "SSO I %s", purple_account_get_username(account)); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - - session = cmdproc->session; - account = session->account; - - if (!g_ascii_strcasecmp(cmd->params[1], "OK")) - { - /* authenticate OK */ - msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); - } - else if (!g_ascii_strcasecmp(cmd->params[1], "SSO")) - { - /* RPS authentication */ - - session->nexus = msn_nexus_new(session); - - session->nexus->policy = g_strdup(cmd->params[3]); - session->nexus->nonce = g_strdup(cmd->params[4]); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); - - msn_nexus_connect(session->nexus); - } -} - -static void -usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnErrorType msnerr = 0; - - switch (error) - { - case 500: - case 601: - case 910: - case 921: - msnerr = MSN_ERROR_SERV_UNAVAILABLE; - break; - case 911: - msnerr = MSN_ERROR_AUTH; - break; - default: - return; - break; - } - - msn_session_set_error(cmdproc->session, msnerr, NULL); -} - -static void -ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - gboolean protocol_supported = FALSE; - char proto_str[8]; - size_t i; - - session = cmdproc->session; - account = session->account; - - g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); - - for (i = 1; i < cmd->param_count; i++) - { - if (!strcmp(cmd->params[i], proto_str)) - { - protocol_supported = TRUE; - break; - } - } - - if (!protocol_supported) - { - msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, - NULL); - return; - } - - /* - * Windows Live Messenger 8.5 - * Notice :CVR String discriminate! - * reference of http://www.microsoft.com/globaldev/reference/oslocversion.mspx - * to see the Local ID - */ - msn_cmdproc_send(cmdproc, "CVR", - "0x0409 winnt 5.1 i386 MSNMSGR 8.5.1302 BC01 %s", - purple_account_get_username(account)); -} - -/************************************************************************** - * Log out - **************************************************************************/ - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - if (cmd->param_count == 0) - msn_session_set_error(cmdproc->session, -1, NULL); - else if (!g_ascii_strcasecmp(cmd->params[0], "OTH")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER, - NULL); - else if (!g_ascii_strcasecmp(cmd->params[0], "SSD")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL); -} - -void -msn_notification_close(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - - if (!notification->in_use) - return; - - msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL); - - msn_notification_disconnect(notification); -} - -/************************************************************************** - * Messages - **************************************************************************/ - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len, MSG_LINE_DEM, MSG_BODY_DEM); - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, "Notification", TRUE); - - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_destroy(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing MSG... \n"); - - /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued - * command and we are processing it */ - if (cmd->payload == NULL) { - cmdproc->last_cmd->payload_cb = msg_cmd_post; - cmd->payload_len = atoi(cmd->params[2]); - } else { - g_return_if_fail(cmd->payload_cb != NULL); - -#if 0 /* glib on win32 doesn't correctly support precision modifiers for a string */ - purple_debug_info("msn", "MSG payload:{%.*s}\n", (guint)cmd->payload_len, cmd->payload); -#endif - cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); - } -} - -/*send Message to Yahoo Messenger*/ -void -uum_send_msg(MsnSession *session,MsnMessage *msg) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - gsize payload_len; - int type; - - cmdproc = session->notification->cmdproc; - g_return_if_fail(msg != NULL); - payload = msn_message_gen_payload(msg, &payload_len); - purple_debug_info("msn", - "send UUM, payload{%s}, strlen:%" G_GSIZE_FORMAT ", len:%" G_GSIZE_FORMAT "\n", - payload, strlen(payload), payload_len); - type = msg->type; - trans = msn_transaction_new(cmdproc, "UUM", "%s 32 %d %" G_GSIZE_FORMAT, - msg->remote_user, type, payload_len); - msn_transaction_set_payload(trans, payload, strlen(payload)); - msn_cmdproc_send_trans(cmdproc, trans); -} - -#if 0 -static void -ubm_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnMessage *msg; - PurpleConnection *gc; - const char *passport; - const char *content_type; - - purple_debug_info("msn", "Process UBM payload:%.*s\n", (guint)len, payload); - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len,MSG_LINE_DEM,MSG_BODY_DEM); - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, "Notification", TRUE); - - gc = cmdproc->session->account->gc; - passport = msg->remote_user; - - content_type = msn_message_get_content_type(msg); - purple_debug_info("msn", "type:%s\n", content_type); - if(!strcmp(content_type,"text/plain")){ - const char *value; - const char *body; - char *body_enc; - char *body_final = NULL; - size_t body_len; - - body = msn_message_get_bin_data(msg, &body_len); - body_enc = g_markup_escape_text(body, body_len); - - if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) { - char *pre, *post; - - msn_parse_format(value, &pre, &post); - body_final = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(pre); - g_free(post); - } - g_free(body_enc); - serv_got_im(gc, passport, body_final, 0, time(NULL)); - g_free(body_final); - } - if(!strcmp(content_type,"text/x-msmsgscontrol")){ - if(msn_message_get_attr(msg, "TypingUser") != NULL){ - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } - } - if(!strcmp(content_type,"text/x-msnmsgr-datacast")){ - char *username, *str; - PurpleAccount *account; - PurpleBuddy *buddy; - const char *user; - - account = cmdproc->session->account; - user = msg->remote_user; - - if ((buddy = purple_find_buddy(account, user)) != NULL){ - username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1); - }else{ - username = g_markup_escape_text(user, -1); - } - - str = g_strdup_printf(_("%s just sent you a Nudge!"), username); - g_free(username); - msn_session_report_user(cmdproc->session,user,str,PURPLE_MESSAGE_SYSTEM); - g_free(str); - } - msn_message_destroy(msg); -} -#endif - -/*Yahoo msg process*/ -static void -ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing UBM... \n"); - - /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued - * command and we are processing it */ - if (cmd->payload == NULL) { - cmdproc->last_cmd->payload_cb = msg_cmd_post; - cmd->payload_len = atoi(cmd->params[3]); - } else { - g_return_if_fail(cmd->payload_cb != NULL); - - purple_debug_info("msn", "UBM payload:{%.*s}\n", (guint)(cmd->payload_len), cmd->payload); - msg_cmd_post(cmdproc, cmd, cmd->payload, cmd->payload_len); - } -} - -/************************************************************************** - * Challenges - * we use MD5 to caculate the Challenges - **************************************************************************/ -static void -chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransaction *trans; - char buf[33]; - - msn_handle_chl(cmd->params[1], buf); - trans = msn_transaction_new(cmdproc, "QRY", "%s 32", MSNP15_WLM_PRODUCT_ID); - - msn_transaction_set_payload(trans, buf, 32); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -/************************************************************************** - * Buddy Lists - **************************************************************************/ - -typedef struct MsnFqyCbData { - MsnFqyCb cb; - gpointer data; -} MsnFqyCbData; - -/* add contact to xmlnode */ -static void -msn_add_contact_xml(MsnSession *session, xmlnode *mlNode,const char *passport, MsnListOp list_op, MsnNetwork networkId) -{ - xmlnode *d_node,*c_node; - char **tokens; - const char *email,*domain; - char fmt_str[3]; - - g_return_if_fail(passport != NULL); - - purple_debug_info("msn", "Passport: %s, type: %d\n", passport, networkId); - tokens = g_strsplit(passport, "@", 2); - email = tokens[0]; - domain = tokens[1]; - - if (email == NULL || domain == NULL) { - purple_debug_error("msn", "Invalid passport (%s) specified to add to contact xml.\n", passport); - g_strfreev(tokens); - g_return_if_reached(); - } - - /*find a domain Node*/ - for (d_node = xmlnode_get_child(mlNode, "d"); d_node; - d_node = xmlnode_get_next_twin(d_node)) { - const char *attr = xmlnode_get_attrib(d_node,"n"); - if (attr == NULL) - continue; - if (!strcmp(attr, domain)) - break; - } - - if (d_node == NULL) { - /*domain not found, create a new domain Node*/ - purple_debug_info("msn", "Didn't find existing domain node, adding one.\n"); - d_node = xmlnode_new("d"); - xmlnode_set_attrib(d_node, "n", domain); - xmlnode_insert_child(mlNode, d_node); - } - - /*create contact node*/ - c_node = xmlnode_new("c"); - xmlnode_set_attrib(c_node, "n", email); - - if (list_op != 0) { - purple_debug_info("msn", "list_op: %d\n", list_op); - g_snprintf(fmt_str, sizeof(fmt_str), "%d", list_op); - xmlnode_set_attrib(c_node, "l", fmt_str); - } - - if (networkId != MSN_NETWORK_UNKNOWN) { - g_snprintf(fmt_str, sizeof(fmt_str), "%d", networkId); - /*mobile*/ - /*type_str = g_strdup_printf("4");*/ - xmlnode_set_attrib(c_node, "t", fmt_str); - } - - xmlnode_insert_child(d_node, c_node); - - g_strfreev(tokens); -} - -static void -msn_notification_post_adl(MsnCmdProc *cmdproc, const char *payload, int payload_len) -{ - MsnTransaction *trans; - purple_debug_info("msn", "Sending ADL with payload: %s\n", payload); - trans = msn_transaction_new(cmdproc, "ADL", "%i", payload_len); - msn_transaction_set_payload(trans, payload, payload_len); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -msn_notification_post_rml(MsnCmdProc *cmdproc, const char *payload, int payload_len) -{ - MsnTransaction *trans; - purple_debug_info("msn", "Sending RML with payload: %s\n", payload); - trans = msn_transaction_new(cmdproc, "RML", "%i", payload_len); - msn_transaction_set_payload(trans, payload, payload_len); - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_notification_send_fqy(MsnSession *session, - const char *payload, int payload_len, - MsnFqyCb cb, - gpointer cb_data) -{ - MsnTransaction *trans; - MsnCmdProc *cmdproc; - MsnFqyCbData *data; - - cmdproc = session->notification->cmdproc; - - data = g_new(MsnFqyCbData, 1); - data->cb = cb; - data->data = cb_data; - - trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len); - msn_transaction_set_payload(trans, payload, payload_len); - msn_transaction_set_data(trans, data); - msn_transaction_set_data_free(trans, g_free); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -update_contact_network(MsnSession *session, const char *passport, MsnNetwork network, gpointer unused) -{ - MsnUser *user; - - if (network == MSN_NETWORK_UNKNOWN) - { - purple_debug_warning("msn", - "Ignoring user %s about which server knows nothing.\n", - passport); - /* Decrement the count for unknown results so that we'll continue login. - Also, need to finish the login process here as well, because ADL OK - will not be called. */ - if (purple_debug_is_verbose()) - purple_debug_info("msn", "ADL/FQY count is %d\n", session->adl_fqy); - if (--session->adl_fqy == 0) - msn_session_finish_login(session); - return; - } - - /* TODO: Also figure out how to update membership lists */ - user = msn_userlist_find_user(session->userlist, passport); - if (user) { - xmlnode *adl_node; - char *payload; - int payload_len; - - msn_user_set_network(user, network); - - adl_node = xmlnode_new("ml"); - xmlnode_set_attrib(adl_node, "l", "1"); - msn_add_contact_xml(session, adl_node, passport, - user->list_op & MSN_LIST_OP_MASK, network); - payload = xmlnode_to_str(adl_node, &payload_len); - msn_notification_post_adl(session->notification->cmdproc, payload, payload_len); - g_free(payload); - } else { - purple_debug_error("msn", - "Got FQY update for unknown user %s on network %d.\n", - passport, network); - } -} - -/*dump contact info to NS*/ -void -msn_notification_dump_contact(MsnSession *session) -{ - MsnUser *user; - GList *l; - xmlnode *adl_node; - xmlnode *fqy_node; - char *payload; - int payload_len; - int adl_count = 0; - int fqy_count = 0; - const char *display_name; - - adl_node = xmlnode_new("ml"); - adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); - fqy_node = xmlnode_new("ml"); - - /*get the userlist*/ - for (l = session->userlist->users; l != NULL; l = l->next) { - user = l->data; - - /* skip RL & PL during initial dump */ - if (!(user->list_op & MSN_LIST_OP_MASK)) - continue; - - if (user->passport && !strcmp(user->passport, "messenger@microsoft.com")) - continue; - - if ((user->list_op & MSN_LIST_OP_MASK & ~MSN_LIST_FL_OP) - == (MSN_LIST_AL_OP | MSN_LIST_BL_OP)) { - /* The server will complain if we send it a user on both the - Allow and Block lists. So assume they're on the Block list - and remove them from the Allow list in the membership lists to - stop this from happening again. */ - purple_debug_warning("msn", - "User %s is on both Allow and Block list; " - "removing from Allow list.\n", - user->passport); - msn_user_unset_op(user, MSN_LIST_AL_OP); - } - - if (user->networkid != MSN_NETWORK_UNKNOWN) { - msn_add_contact_xml(session, adl_node, user->passport, - user->list_op & MSN_LIST_OP_MASK, user->networkid); - - /* each ADL command may contain up to 150 contacts */ - if (++adl_count % 150 == 0) { - payload = xmlnode_to_str(adl_node, &payload_len); - - /* ADL's are returned all-together */ - session->adl_fqy++; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Posting ADL, count is %d\n", - session->adl_fqy); - - msn_notification_post_adl(session->notification->cmdproc, - payload, payload_len); - - g_free(payload); - xmlnode_free(adl_node); - - adl_node = xmlnode_new("ml"); - adl_node->child = NULL; - xmlnode_set_attrib(adl_node, "l", "1"); - } - } else { - /* FQY's are returned one-at-a-time */ - session->adl_fqy++; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Adding FQY address, count is %d\n", - session->adl_fqy); - - msn_add_contact_xml(session, fqy_node, user->passport, - 0, user->networkid); - - /* each FQY command may contain up to 150 contacts, probably */ - if (++fqy_count % 150 == 0) { - payload = xmlnode_to_str(fqy_node, &payload_len); - - msn_notification_send_fqy(session, payload, payload_len, - update_contact_network, NULL); - - g_free(payload); - xmlnode_free(fqy_node); - fqy_node = xmlnode_new("ml"); - } - } - } - - /* Send the rest, or just an empty one to let the server set us online */ - if (adl_count == 0 || adl_count % 150 != 0) { - payload = xmlnode_to_str(adl_node, &payload_len); - - /* ADL's are returned all-together */ - session->adl_fqy++; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Posting ADL, count is %d\n", - session->adl_fqy); - - msn_notification_post_adl(session->notification->cmdproc, payload, payload_len); - - g_free(payload); - } - - if (fqy_count % 150 != 0) { - payload = xmlnode_to_str(fqy_node, &payload_len); - - msn_notification_send_fqy(session, payload, payload_len, - update_contact_network, NULL); - - g_free(payload); - } - - xmlnode_free(adl_node); - xmlnode_free(fqy_node); - - display_name = purple_connection_get_display_name(session->account->gc); - if (display_name - && strcmp(display_name, - purple_account_get_username(session->account))) { - msn_act_id(session->account->gc, display_name); - } - -} - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -} - -static void -adl_cmd_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - xmlnode *root, *domain_node; - - purple_debug_misc("msn", "Parsing received ADL XML data\n"); - - g_return_if_fail(payload != NULL); - - root = xmlnode_from_str(payload, (gssize) len); - - if (root == NULL) { - purple_debug_info("msn", "Invalid XML in ADL!\n"); - return; - } - for (domain_node = xmlnode_get_child(root, "d"); - domain_node; - domain_node = xmlnode_get_next_twin(domain_node)) { - const gchar * domain = NULL; - xmlnode *contact_node = NULL; - - domain = xmlnode_get_attrib(domain_node, "n"); - - for (contact_node = xmlnode_get_child(domain_node, "c"); - contact_node; - contact_node = xmlnode_get_next_twin(contact_node)) { - const gchar *list; - gint list_op = 0; - - list = xmlnode_get_attrib(contact_node, "l"); - if (list != NULL) { - list_op = atoi(list); - } - - if (list_op & MSN_LIST_RL_OP) { - /* someone is adding us */ - msn_get_contact_list(cmdproc->session, MSN_PS_PENDING_LIST, NULL); - } - } - } - - xmlnode_free(root); -} - -static void -adl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(cmdproc->session != NULL); - g_return_if_fail(cmdproc->last_cmd != NULL); - g_return_if_fail(cmd != NULL); - - session = cmdproc->session; - - if (!strcmp(cmd->params[1], "OK")) { - /* ADL ack */ - if (purple_debug_is_verbose()) - purple_debug_info("msn", "ADL ACK, count is %d\n", - session->adl_fqy); - if (--session->adl_fqy == 0) - msn_session_finish_login(session); - } else { - cmdproc->last_cmd->payload_cb = adl_cmd_parse; - cmd->payload_len = atoi(cmd->params[1]); - } - - return; -} - -static void -adl_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - int error = GPOINTER_TO_INT(cmd->payload_cbdata); - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - if (error == 241) { - /* khc: some googling suggests that error 241 means the buddy is somehow - in the local list, but not the server list, and that we should add - those buddies to the addressbook. For now I will just notify the user - about the raw payload, because I am lazy */ - xmlnode *adl = xmlnode_from_str(payload, len); - GString *emails = g_string_new(NULL); - - xmlnode *domain = xmlnode_get_child(adl, "d"); - while (domain) { - const char *domain_str = xmlnode_get_attrib(domain, "n"); - xmlnode *contact = xmlnode_get_child(domain, "c"); - while (contact) { - g_string_append_printf(emails, "%s@%s\n", - xmlnode_get_attrib(contact, "n"), domain_str); - contact = xmlnode_get_next_twin(contact); - } - domain = xmlnode_get_next_twin(domain); - } - - purple_notify_error(gc, NULL, - _("The following users are missing from your addressbook"), - emails->str); - g_string_free(emails, TRUE); - xmlnode_free(adl); - } - else - { - char *adl = g_strndup(payload, len); - char *reason = g_strdup_printf(_("Unknown error (%d): %s"), - error, adl); - g_free(adl); - - purple_notify_error(gc, NULL, _("Unable to add user"), reason); - g_free(reason); - } -} - -static void -adl_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnCommand *cmd = cmdproc->last_cmd; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - purple_debug_error("msn", "ADL error\n"); - if (cmd->param_count > 1) { - cmd->payload_cb = adl_error_parse; - cmd->payload_len = atoi(cmd->params[1]); - cmd->payload_cbdata = GINT_TO_POINTER(error); - } else { - char *reason = g_strdup_printf(_("Unknown error (%d)"), error); - purple_notify_error(gc, NULL, _("Unable to add user"), reason); - g_free(reason); - } -} - -static void -rml_error_parse(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - char *adl, *reason; - int error = GPOINTER_TO_INT(cmd->payload_cbdata); - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - adl = g_strndup(payload, len); - reason = g_strdup_printf(_("Unknown error (%d): %s"), - error, adl); - g_free(adl); - - purple_notify_error(gc, NULL, _("Unable to remove user"), reason); - g_free(reason); -} - -static void -rml_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnCommand *cmd = cmdproc->last_cmd; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - purple_debug_error("msn", "RML error\n"); - if (cmd->param_count > 1) { - cmd->payload_cb = rml_error_parse; - cmd->payload_len = atoi(cmd->params[1]); - cmd->payload_cbdata = GINT_TO_POINTER(error); - } else { - char *reason = g_strdup_printf(_("Unknown error (%d)"), error); - purple_notify_error(gc, NULL, _("Unable to remove user"), reason); - g_free(reason); - } -} - -static void -fqy_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnSession *session; - xmlnode *ml, *d, *c; - const char *domain; - const char *local; - const char *type; - char *passport; - MsnNetwork network = MSN_NETWORK_PASSPORT; - - session = cmdproc->session; - - /* FQY response: - */ - ml = xmlnode_from_str(payload, len); - for (d = xmlnode_get_child(ml, "d"); - d != NULL; - d = xmlnode_get_next_twin(d)) { - domain = xmlnode_get_attrib(d, "n"); - for (c = xmlnode_get_child(d, "c"); - c != NULL; - c = xmlnode_get_next_twin(c)) { - local = xmlnode_get_attrib(c, "n"); - type = xmlnode_get_attrib(c, "t"); - - passport = g_strdup_printf("%s@%s", local, domain); - - if (g_ascii_isdigit(cmd->command[0])) - network = MSN_NETWORK_UNKNOWN; - else if (type != NULL) - network = (MsnNetwork)strtoul(type, NULL, 10); - - purple_debug_info("msn", "FQY response says %s is from network %d\n", - passport, network); - if (cmd->trans->data) { - MsnFqyCbData *fqy_data = cmd->trans->data; - fqy_data->cb(session, passport, network, fqy_data->data); - /* Don't free fqy_data yet since the server responds to FQY multiple times. - It will be freed when cmd->trans is freed. */ - } - - g_free(passport); - } - } - - xmlnode_free(ml); -} - -static void -fqy_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnCommand *cmd = cmdproc->last_cmd; - - purple_debug_warning("msn", "FQY error %d\n", error); - if (cmd->param_count > 1) { - cmd->payload_cb = fqy_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); - cmd->payload_cbdata = GINT_TO_POINTER(error); - } -#if 0 - /* If the server didn't send us a corresponding email address for this - FQY error, it's probably going to disconnect us. So it isn't necessary - to tell the handler about it. */ - else if (trans->data) - ((MsnFqyCb)trans->data)(session, NULL, MSN_NETWORK_UNKNOWN, NULL); -#endif -} - -static void -fqy_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Process FQY\n"); - cmdproc->last_cmd->payload_cb = fqy_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); -} - -static void -rml_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - if (payload != NULL) - purple_debug_info("msn", "Received RML:\n%s\n", payload); -} - -static void -rml_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Process RML\n"); - cmd->payload_len = atoi(cmd->params[1]); - cmdproc->last_cmd->payload_cb = rml_cmd_post; -} - -static void -qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - /* TODO: Call PNG after the timeout specified. */ -} - - -static void -fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSlpLink *slplink; - MsnUser *user; - - /* Tell libpurple that the user has signed off */ - user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]); - msn_user_set_state(user, NULL); - msn_user_update(user); - - /* If we have an open MsnSlpLink with the user then close it */ - slplink = msn_session_find_slplink(cmdproc->session, cmd->params[0]); - if (slplink != NULL) - msn_slplink_destroy(slplink); - -} - -static void -iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj = NULL; - unsigned long clientid; - int networkid = 0; - const char *state, *passport; - char *friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[1]; - passport = cmd->params[2]; - - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) - /* Where'd this come from? */ - return; - - if (cmd->param_count == 8) { - /* Yahoo! Buddy, looks like */ - networkid = atoi(cmd->params[3]); - friendly = g_strdup(purple_url_decode(cmd->params[4])); - clientid = strtoul(cmd->params[5], NULL, 10); - - /* cmd->params[7] seems to be a URL to a Yahoo! icon: - https://sec.yimg.com/i/us/nt/b/purpley.1.0.png - ... and it's purple, HAH! - */ - } else if (cmd->param_count == 7) { - /* MSNP14+ with Display Picture object */ - networkid = atoi(cmd->params[3]); - friendly = g_strdup(purple_url_decode(cmd->params[4])); - clientid = strtoul(cmd->params[5], NULL, 10); - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[6])); - } else if (cmd->param_count == 6) { - /* Yes, this is 5. The friendly name could start with a number, - but the display picture object can't... */ - if (isdigit(cmd->params[5][0])) { - /* MSNP14 without Display Picture object */ - networkid = atoi(cmd->params[3]); - friendly = g_strdup(purple_url_decode(cmd->params[4])); - clientid = strtoul(cmd->params[5], NULL, 10); - } else { - /* MSNP8+ with Display Picture object */ - friendly = g_strdup(purple_url_decode(cmd->params[3])); - clientid = strtoul(cmd->params[4], NULL, 10); - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); - } - } else if (cmd->param_count == 5) { - /* MSNP8+ without Display Picture object */ - friendly = g_strdup(purple_url_decode(cmd->params[3])); - clientid = strtoul(cmd->params[4], NULL, 10); - } else { - purple_debug_warning("msn", "Received ILN with unknown number of parameters.\n"); - return; - } - - if (msn_user_set_friendly_name(user, friendly)) { - msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly); - } - g_free(friendly); - - msn_user_set_object(user, msnobj); - - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+'); - msn_user_set_clientid(user, clientid); - msn_user_set_network(user, networkid); - - msn_user_set_state(user, state); - msn_user_update(user); -} - -static void -ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - PurpleConnection *gc; - MsnUserList *userlist; - const char *who = NULL; - char *text = NULL; - const char *id = NULL; - xmlnode *payloadNode, *from, *msg, *textNode; - - purple_debug_misc("msn", "Incoming Page: {%s}\n", payload); - - userlist = cmdproc->session->userlist; - gc = purple_account_get_connection(cmdproc->session->account); - - /* payload looks like this: - - - - - - - - - - - - Message was here - - - - */ - - /* This is the payload if your message was too long: - - - - - - - - - - - - - - - */ - - payloadNode = xmlnode_from_str(payload, len); - if (!payloadNode) - return; - - if (!(from = xmlnode_get_child(payloadNode, "FROM")) || - !(msg = xmlnode_get_child(payloadNode, "MSG")) || - !(textNode = xmlnode_get_child(msg, "BODY/TEXT"))) { - xmlnode_free(payloadNode); - return; - } - - who = xmlnode_get_attrib(from, "name"); - if (!who) return; - - text = xmlnode_get_data(textNode); - - /* Match number to user's mobile number, FROM is a phone number if the - other side page you using your phone number */ - if (!strncmp(who, "tel:+", 5)) { - MsnUser *user = - msn_userlist_find_user_with_mobile_phone(userlist, who + 4); - - if (user && user->passport) - who = user->passport; - } - - id = xmlnode_get_attrib(msg, "id"); - - if (id && !strcmp(id, "407")) { - PurpleConversation *conv - = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - who, gc->account); - if (conv != NULL) { - purple_conversation_write(conv, NULL, - _("Mobile message was not sent because it was too long."), - PURPLE_MESSAGE_ERROR, time(NULL)); - - if ((id = xmlnode_get_attrib(payloadNode, "id")) != NULL) { - unsigned int trId = atol(id); - MsnTransaction *trans; - MsnMessage *msg; - - trans = msn_history_find(cmdproc->history, trId); - msg = (MsnMessage *)trans->data; - - if (msg) { - char *body_str = msn_message_to_string(msg); - char *body_enc = g_markup_escape_text(body_str, -1); - - purple_conversation_write(conv, NULL, body_enc, - PURPLE_MESSAGE_RAW, time(NULL)); - - g_free(body_str); - g_free(body_enc); - msn_message_destroy(msg); - trans->data = NULL; - } - } - } - } else { - serv_got_im(gc, who, text, 0, time(NULL)); - } - - g_free(text); - xmlnode_free(payloadNode); -} - -static void -ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmd->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = ipg_cmd_post; -} - -static void -nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj; - unsigned long clientid; - int networkid; - const char *state, *passport, *friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[0]; - passport = cmd->params[1]; - networkid = atoi(cmd->params[2]); - friendly = purple_url_decode(cmd->params[3]); - - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) return; - - if (msn_user_set_friendly_name(user, friendly)) - { - msn_update_contact(session, passport, MSN_UPDATE_DISPLAY, friendly); - } - - if (cmd->param_count == 6) - { - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); - msn_user_set_object(user, msnobj); - } - else - { - msn_user_set_object(user, NULL); - } - - clientid = strtoul(cmd->params[4], NULL, 10); - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE) || (user->extinfo && user->extinfo->phone_mobile && user->extinfo->phone_mobile[0] == '+'); - - msn_user_set_clientid(user, clientid); - msn_user_set_network(user, networkid); - - msn_user_set_state(user, state); - msn_user_update(user); -} - -#if 0 -static void -chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *state = cmd->params[1]; - int state_id = 0; - - if (!strcmp(state, "NLN")) - state_id = MSN_ONLINE; - else if (!strcmp(state, "BSY")) - state_id = MSN_BUSY; - else if (!strcmp(state, "IDL")) - state_id = MSN_IDLE; - else if (!strcmp(state, "BRB")) - state_id = MSN_BRB; - else if (!strcmp(state, "AWY")) - state_id = MSN_AWAY; - else if (!strcmp(state, "PHN")) - state_id = MSN_PHONE; - else if (!strcmp(state, "LUN")) - state_id = MSN_LUNCH; - else if (!strcmp(state, "HDN")) - state_id = MSN_HIDDEN; - - cmdproc->session->state = state_id; -} -#endif - - -static void -not_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ -#if 0 - MSN_SET_PARAMS("NOT %d\r\n%s", cmdproc->servconn->payload, payload); - purple_debug_misc("msn", "Notification: {%s}\n", payload); -#endif -} - -static void -not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmd->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = not_cmd_post; -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value, *friendlyname; - - g_return_if_fail(cmd->param_count >= 3); - - type = cmd->params[2]; - - if (cmd->param_count == 4) - { - value = cmd->params[3]; - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - else { - type = cmd->params[1]; - if (!strcmp(type, "MFN")) { - friendlyname = purple_url_decode(cmd->params[2]); - - msn_update_contact(session, "Me", MSN_UPDATE_DISPLAY, friendlyname); - - purple_connection_set_display_name( - purple_account_get_connection(session->account), - friendlyname); - purple_account_set_string(session->account, "display-name", friendlyname); - } - } - } -} - -/************************************************************************** - * Misc commands - **************************************************************************/ - -static void -url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleConnection *gc; - PurpleAccount *account; - const char *rru; - const char *url; - PurpleCipherContext *cipher; - gchar creds[33]; - char *buf; - - gulong tmp_timestamp; - - session = cmdproc->session; - account = session->account; - gc = account->gc; - - rru = cmd->params[1]; - url = cmd->params[2]; - - session->passport_info.mail_timestamp = time(NULL); - tmp_timestamp = session->passport_info.mail_timestamp - session->passport_info.sl; - - buf = g_strdup_printf("%s%lu%s", - session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS", - tmp_timestamp, - purple_connection_get_password(gc)); - - cipher = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(cipher, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest_to_str(cipher, sizeof(creds), creds, NULL); - purple_cipher_context_destroy(cipher); - g_free(buf); - - g_free(session->passport_info.mail_url); - session->passport_info.mail_url = - g_strdup_printf("%s&auth=%s&creds=%s&sl=%ld&username=%s&mode=ttl&sid=%s&id=2&rru=%s&svc=mail&js=yes", - url, - session->passport_info.mspauth ? purple_url_encode(session->passport_info.mspauth) : "BOGUS", - creds, - tmp_timestamp, - msn_user_get_passport(session->user), - session->passport_info.sid, - rru); - - /* The user wants to check his or her email */ - if (cmd->trans && cmd->trans->data) - purple_notify_uri(purple_account_get_connection(account), session->passport_info.mail_url); -} -/************************************************************************** - * Switchboards - **************************************************************************/ - -static void -rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - const char *session_id; - char *host; - int port; - - session = cmdproc->session; - session_id = cmd->params[0]; - - msn_parse_socket(cmd->params[1], &host, &port); - - if (session->http_method) - port = 80; - - swboard = msn_switchboard_new(session); - - msn_switchboard_set_invited(swboard, TRUE); - msn_switchboard_set_session_id(swboard, cmd->params[0]); - msn_switchboard_set_auth_key(swboard, cmd->params[3]); - swboard->im_user = g_strdup(cmd->params[4]); - /* msn_switchboard_add_user(swboard, cmd->params[4]); */ - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *host; - int port; - - if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS")) - { - /* Maybe we can have a generic bad command error. */ - purple_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]); - return; - } - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!strcmp(cmd->params[1], "SB")) - { - purple_debug_error("msn", "This shouldn't be handled here.\n"); - } - else if (!strcmp(cmd->params[1], "NS")) - { - MsnSession *session; - - session = cmdproc->session; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); - - msn_notification_connect(session->notification, host, port); - } - - g_free(host); -} - -static void -gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ -/* QuLogic: Disabled until confirmed correct. */ -#if 0 - xmlnode *root; - xmlnode *policy; - - g_return_if_fail(cmd->payload != NULL); - - if ( (root = xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL) - { - purple_debug_error("msn", "Unable to parse GCF payload into a XML tree\n"); - return; - } - - - g_free(cmdproc->session->blocked_text); - cmdproc->session->blocked_text = NULL; - - /* We need a get_child with attrib... */ - policy = xmlnode_get_child(root, "Policy"); - while (policy) { - if (g_str_equal(xmlnode_get_attrib(policy, "type"), "SHIELDS")) - break; - policy = xmlnode_get_next_twin(policy); - } - - if (policy) { - GString *blocked = g_string_new(NULL); - xmlnode *imtext = xmlnode_get_child(policy, - "config/block/regexp/imtext"); - while (imtext) { - const char *value = xmlnode_get_attrib(imtext, "value"); - g_string_append_printf(blocked, "%s
\n", - purple_base64_decode(value, NULL)); - imtext = xmlnode_get_next_twin(imtext); - } - - cmdproc->session->blocked_text = g_string_free(blocked, FALSE); - } - - xmlnode_free(root); -#endif -} - -static void -gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing GCF command\n"); - - cmdproc->last_cmd->payload_cb = gcf_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); -} - -static void -sbs_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_info("msn", "Processing SBS... \n"); - /*get the payload content*/ -} - -static void parse_currentmedia(MsnUser *user, const char *cmedia) -{ - char **cmedia_array; - int strings = 0; - - if (!cmedia || cmedia[0] == '\0') { - purple_debug_info("msn", "No currentmedia string\n"); - return; - } - - purple_debug_info("msn", "Parsing currentmedia string: \"%s\"\n", cmedia); - - cmedia_array = g_strsplit(cmedia, "\\0", 0); - - /* - * 0: Application - * 1: 'Music'/'Games'/'Office' - * 2: '1' if enabled, '0' if not - * 3: Format (eg. {0} by {1}) - * 4: Title - * If 'Music': - * 5: Artist - * 6: Album - * 7: ? - */ -#if GLIB_CHECK_VERSION(2,6,0) - strings = g_strv_length(cmedia_array); -#else - while (cmedia_array[++strings] != NULL); -#endif - - if (strings >= 4 && !strcmp(cmedia_array[2], "1")) { - if (user->extinfo == NULL) - user->extinfo = g_new0(MsnUserExtendedInfo, 1); - else { - g_free(user->extinfo->media_album); - g_free(user->extinfo->media_artist); - g_free(user->extinfo->media_title); - } - - if (!strcmp(cmedia_array[1], "Music")) - user->extinfo->media_type = CURRENT_MEDIA_MUSIC; - else if (!strcmp(cmedia_array[1], "Games")) - user->extinfo->media_type = CURRENT_MEDIA_GAMES; - else if (!strcmp(cmedia_array[1], "Office")) - user->extinfo->media_type = CURRENT_MEDIA_OFFICE; - else - user->extinfo->media_type = CURRENT_MEDIA_UNKNOWN; - - user->extinfo->media_title = g_strdup(cmedia_array[strings == 4 ? 3 : 4]); - user->extinfo->media_artist = strings > 5 ? g_strdup(cmedia_array[5]) : NULL; - user->extinfo->media_album = strings > 6 ? g_strdup(cmedia_array[6]) : NULL; - } - - g_strfreev(cmedia_array); -} - -/* - * Get the UBX's PSM info - * Post it to the User status - * Thanks for Chris 's code - */ -static void -ubx_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnSession *session; - PurpleAccount *account; - MsnUser *user; - const char *passport; - char *psm_str, *str; - - session = cmdproc->session; - account = session->account; - - passport = cmd->params[0]; - user = msn_userlist_find_user(session->userlist, passport); - if (user == NULL) { - char *str = g_strndup(payload, len); - purple_debug_info("msn", "unknown user %s, payload is %s\n", - passport, str); - g_free(str); - return; - } - - /* Free any existing media info for this user */ - if (user->extinfo) { - g_free(user->extinfo->media_album); - g_free(user->extinfo->media_artist); - g_free(user->extinfo->media_title); - user->extinfo->media_album = NULL; - user->extinfo->media_artist = NULL; - user->extinfo->media_title = NULL; - } - - if (len != 0) { - psm_str = msn_get_psm(cmd->payload,len); - msn_user_set_statusline(user, psm_str); - g_free(psm_str); - - str = msn_get_currentmedia(cmd->payload, len); - parse_currentmedia(user, str); - g_free(str); - } else { - msn_user_set_statusline(user, NULL); - } - - msn_user_update(user); -} - -static void -ubx_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_misc("msn", "UBX received.\n"); - cmdproc->last_cmd->payload_cb = ubx_cmd_post; - cmd->payload_len = atoi(cmd->params[2]); -} - -static void -uux_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - /* Do Nothing, right now. */ - if (payload != NULL) - purple_debug_info("msn", "UUX payload:\n%s\n", payload); -} - -static void -uux_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_misc("msn", "UUX received.\n"); - cmdproc->last_cmd->payload_cb = uux_cmd_post; - cmd->payload_len = atoi(cmd->params[1]); -} - -/************************************************************************** - * Message Types - **************************************************************************/ - -static void -profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - const char *value; - const char *clLastChange; - - session = cmdproc->session; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if ((value = msn_message_get_attr(msg, "kv")) != NULL) - { - g_free(session->passport_info.kv); - session->passport_info.kv = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "sid")) != NULL) - { - g_free(session->passport_info.sid); - session->passport_info.sid = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) - { - g_free(session->passport_info.mspauth); - session->passport_info.mspauth = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) - { - g_free(session->passport_info.client_ip); - session->passport_info.client_ip = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) - { - session->passport_info.client_port = ntohs(atoi(value)); - } - - if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) - session->passport_info.sl = atol(value); - - if ((value = msn_message_get_attr(msg, "EmailEnabled")) != NULL) - session->passport_info.email_enabled = (gboolean)atol(value); - - /*starting retrieve the contact list*/ - clLastChange = purple_account_get_string(session->account, "CLLastChange", NULL); -#ifdef MSN_PARTIAL_LISTS - /* msn_userlist_load defeats all attempts at trying to detect blist sync issues */ - msn_userlist_load(session); - msn_get_contact_list(session, MSN_PS_INITIAL, clLastChange); -#else - /* always get the full list? */ - msn_get_contact_list(session, MSN_PS_INITIAL, NULL); -#endif -#if 0 - msn_contact_connect(session); -#endif -} - -static void -initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - const char *unread; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.mail_url == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - unread = g_hash_table_lookup(table, "Inbox-Unread"); - - if (unread != NULL) - { - int count = atoi(unread); - - if (count > 0) - { - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.mail_url }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, - passports, urls, NULL, NULL); - } - } - - g_hash_table_destroy(table); -} - -/*offline Message notification process*/ -static void -initial_mdata_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - const char *mdata, *unread; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - table = msn_message_get_hashtable_from_body(msg); - - mdata = g_hash_table_lookup(table, "Mail-Data"); - - if (mdata != NULL) - msn_parse_oim_msg(session->oim, mdata); - - if (g_hash_table_lookup(table, "Inbox-URL") == NULL) - { - g_hash_table_destroy(table); - return; - } - - if (session->passport_info.mail_url == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - g_hash_table_destroy(table); - return; - } - - if (!purple_account_get_check_mail(session->account)) - { - g_hash_table_destroy(table); - return; - } - - unread = g_hash_table_lookup(table, "Inbox-Unread"); - - if (unread != NULL) - { - int count = atoi(unread); - - if (count > 0) - { - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.mail_url }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, - passports, urls, NULL, NULL); - } - } - - g_hash_table_destroy(table); -} - -/*offline Message Notification*/ -static void -delete_oim_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - purple_debug_misc("msn", "Delete OIM message.\n"); -} - -static void -email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - char *from, *subject, *tmp; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.mail_url == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - from = subject = NULL; - - tmp = g_hash_table_lookup(table, "From"); - if (tmp != NULL) - from = purple_mime_decode_field(tmp); - - tmp = g_hash_table_lookup(table, "Subject"); - if (tmp != NULL) - subject = purple_mime_decode_field(tmp); - - purple_notify_email(gc, - (subject != NULL ? subject : ""), - (from != NULL ? from : ""), - msn_user_get_passport(session->user), - session->passport_info.mail_url, NULL, NULL); - - g_free(from); - g_free(subject); - - g_hash_table_destroy(table); -} - -static void -system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *table; - const char *type_s; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - table = msn_message_get_hashtable_from_body(msg); - - if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) - { - int type = atoi(type_s); - char buf[MSN_BUF_LEN]; - int minutes; - - switch (type) - { - case 1: - minutes = atoi(g_hash_table_lookup(table, "Arg1")); - g_snprintf(buf, sizeof(buf), dngettext(PACKAGE, - "The MSN server will shut down for maintenance " - "in %d minute. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", - "The MSN server will shut down for maintenance " - "in %d minutes. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", minutes), - minutes); - default: - break; - } - - if (*buf != '\0') - purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); - } - - g_hash_table_destroy(table); -} - -/************************************************************************** - * Dispatch server list management - **************************************************************************/ -typedef struct MsnAddRemoveListData { - MsnCmdProc *cmdproc; - MsnUser *user; - MsnListOp list_op; - gboolean add; -} MsnAddRemoveListData; - -static void -modify_unknown_buddy_on_list(MsnSession *session, const char *passport, - MsnNetwork network, gpointer data) -{ - MsnAddRemoveListData *addrem = data; - MsnCmdProc *cmdproc; - xmlnode *node; - char *payload; - int payload_len; - - cmdproc = addrem->cmdproc; - - /* Update user first */ - msn_user_set_network(addrem->user, network); - - node = xmlnode_new("ml"); - node->child = NULL; - - msn_add_contact_xml(session, node, passport, - addrem->list_op, network); - - payload = xmlnode_to_str(node, &payload_len); - xmlnode_free(node); - - if (addrem->add) - msn_notification_post_adl(cmdproc, payload, payload_len); - else - msn_notification_post_rml(cmdproc, payload, payload_len); - - g_free(payload); - g_free(addrem); -} - -void -msn_notification_add_buddy_to_list(MsnNotification *notification, MsnListId list_id, - MsnUser *user) -{ - MsnAddRemoveListData *addrem; - MsnCmdProc *cmdproc; - MsnListOp list_op = 1 << list_id; - xmlnode *adl_node; - char *payload; - int payload_len; - - cmdproc = notification->servconn->cmdproc; - - adl_node = xmlnode_new("ml"); - adl_node->child = NULL; - - msn_add_contact_xml(notification->session, adl_node, user->passport, - list_op, user->networkid); - - payload = xmlnode_to_str(adl_node, &payload_len); - xmlnode_free(adl_node); - - if (user->networkid != MSN_NETWORK_UNKNOWN) { - msn_notification_post_adl(cmdproc, payload, payload_len); - - } else { - addrem = g_new(MsnAddRemoveListData, 1); - addrem->cmdproc = cmdproc; - addrem->user = user; - addrem->list_op = list_op; - addrem->add = TRUE; - - msn_notification_send_fqy(notification->session, payload, payload_len, - modify_unknown_buddy_on_list, addrem); - } - - g_free(payload); -} - -void -msn_notification_rem_buddy_from_list(MsnNotification *notification, MsnListId list_id, - MsnUser *user) -{ - MsnAddRemoveListData *addrem; - MsnCmdProc *cmdproc; - MsnListOp list_op = 1 << list_id; - xmlnode *rml_node; - char *payload; - int payload_len; - - cmdproc = notification->servconn->cmdproc; - - rml_node = xmlnode_new("ml"); - rml_node->child = NULL; - - msn_add_contact_xml(notification->session, rml_node, user->passport, - list_op, user->networkid); - - payload = xmlnode_to_str(rml_node, &payload_len); - xmlnode_free(rml_node); - - if (user->networkid != MSN_NETWORK_UNKNOWN) { - msn_notification_post_rml(cmdproc, payload, payload_len); - - } else { - addrem = g_new(MsnAddRemoveListData, 1); - addrem->cmdproc = cmdproc; - addrem->user = user; - addrem->list_op = list_op; - addrem->add = FALSE; - - msn_notification_send_fqy(notification->session, payload, payload_len, - modify_unknown_buddy_on_list, addrem); - } - - g_free(payload); -} - -/************************************************************************** - * Init - **************************************************************************/ -void -msn_notification_init(void) -{ - cbs_table = msn_table_new(); - - /* Synchronous */ - msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL); - msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "ADL", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); - msn_table_add_cmd(cbs_table, "USR", "GCF", gcf_cmd); - msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); - msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); - msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); - - /* Asynchronous */ - msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "UBM", ubm_cmd); - msn_table_add_cmd(cbs_table, NULL, "GCF", gcf_cmd); - msn_table_add_cmd(cbs_table, NULL, "SBS", sbs_cmd); - msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); - - msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); - msn_table_add_cmd(cbs_table, NULL, "RML", rml_cmd); - msn_table_add_cmd(cbs_table, NULL, "ADL", adl_cmd); - msn_table_add_cmd(cbs_table, NULL, "FQY", fqy_cmd); - - msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); - msn_table_add_cmd(cbs_table, NULL, "QNG", qng_cmd); - msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd); - msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd); - msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); - - msn_table_add_cmd(cbs_table, NULL, "UBX", ubx_cmd); - msn_table_add_cmd(cbs_table, NULL, "UUX", uux_cmd); - - msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); - - msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); - - msn_table_add_error(cbs_table, "ADL", adl_error); - msn_table_add_error(cbs_table, "RML", rml_error); - msn_table_add_error(cbs_table, "FQY", fqy_error); - msn_table_add_error(cbs_table, "USR", usr_error); - - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsprofile", - profile_msg); - /*initial OIM notification*/ - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsinitialmdatanotification", - initial_mdata_msg); - /*OIM notification when user online*/ - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsoimnotification", - initial_mdata_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsinitialemailnotification", - initial_email_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsemailnotification", - email_msg); - /*delete an offline Message notification*/ - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsactivemailnotification", - delete_oim_msg); - msn_table_add_msg_type(cbs_table, - "application/x-msmsgssystemmessage", - system_msg); - /* generic message handlers */ - msn_table_add_msg_type(cbs_table, "text/plain", - msn_plain_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol", - msn_control_msg); - msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", - msn_datacast_msg); -} - -void -msn_notification_end(void) -{ - msn_table_destroy(cbs_table); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/notification.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/** - * @file notification.h Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_NOTIFICATION_H -#define MSN_NOTIFICATION_H - -typedef struct _MsnNotification MsnNotification; - -/* MSN protocol challenge info */ - -/* MSNP15 challenge: WLM 8.5.1288.816 */ -#define MSNP15_WLM_PRODUCT_KEY "ILTXC!4IXB5FB*PX" -#define MSNP15_WLM_PRODUCT_ID "PROD0119GSJUC$18" - -/* MSNP13 challenge */ -#define MSNP13_WLM_PRODUCT_KEY "O4BG@C7BWLYQX?5G" -#define MSNP13_WLM_PRODUCT_ID "PROD01065C%ZFN6F" - -#define MSNP10_PRODUCT_KEY "VT6PX?UQTM4WM%YR" -#define MSNP10_PRODUCT_ID "PROD0038W!61ZTF9" - -#include "cmdproc.h" -#include "msg.h" -#include "session.h" -#include "servconn.h" -#include "state.h" -#include "user.h" - -struct _MsnNotification -{ - MsnSession *session; - - /** - * This is a convenience pointer that always points to - * servconn->cmdproc - */ - MsnCmdProc *cmdproc; - MsnServConn *servconn; - - gboolean in_use; -}; - -typedef void (*MsnFqyCb)(MsnSession *session, const char *passport, MsnNetwork network, gpointer data); - -void uum_send_msg(MsnSession *session, MsnMessage *msg); - -void msn_notification_end(void); -void msn_notification_init(void); - -void msn_notification_add_buddy_to_list(MsnNotification *notification, - MsnListId list_id, MsnUser *user); -void msn_notification_rem_buddy_from_list(MsnNotification *notification, - MsnListId list_id, MsnUser *user); - -void msn_notification_send_fqy(MsnSession *session, - const char *payload, int payload_len, - MsnFqyCb cb, gpointer cb_data); - -MsnNotification *msn_notification_new(MsnSession *session); -void msn_notification_destroy(MsnNotification *notification); -gboolean msn_notification_connect(MsnNotification *notification, - const char *host, int port); -void msn_notification_disconnect(MsnNotification *notification); -void msn_notification_dump_contact(MsnSession *session); - -/** - * Closes a notification. - * - * It's first closed, and then disconnected. - * - * @param notification The notification object to close. - */ -void msn_notification_close(MsnNotification *notification); - -void msn_got_login_params(MsnSession *session, const char *ticket, const char *response); - -#endif /* MSN_NOTIFICATION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -/** - * @file object.c MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "msn.h" -#include "object.h" -#include "debug.h" -/* Sha1 stuff */ -#include "cipher.h" -/* Base64 stuff */ -#include "util.h" - -#define GET_STRING_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - if (obj->field != NULL) \ - g_free(obj->field); \ - obj->field = g_strndup(tag, c - tag); \ - } \ - } - -#define GET_INT_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - char buf[16]; \ - size_t offset; \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - memset(buf, 0, sizeof(buf)); \ - offset = c - tag; \ - if (offset >= sizeof(buf)) \ - offset = sizeof(buf) - 1; \ - strncpy(buf, tag, offset); \ - obj->field = atoi(buf); \ - } \ - } - -static GList *local_objs; - -MsnObject * -msn_object_new(void) -{ - MsnObject *obj; - - obj = g_new0(MsnObject, 1); - - msn_object_set_type(obj, MSN_OBJECT_UNKNOWN); - msn_object_set_friendly(obj, "AAA="); - - return obj; -} - -MsnObject * -msn_object_new_from_string(const char *str) -{ - MsnObject *obj; - char *tag, *c; - - g_return_val_if_fail(str != NULL, NULL); - - if (strncmp(str, "creator == NULL || obj->size == 0 || obj->type == 0 - || obj->location == NULL || obj->friendly == NULL - || obj->sha1d == NULL /*|| obj->sha1c == NULL*/) { - purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); - obj = NULL; - } - - return obj; -} - -MsnObject* -msn_object_new_from_image(PurpleStoredImage *img, const char *location, - const char *creator, MsnObjectType type) -{ - MsnObject *msnobj; - - PurpleCipherContext *ctx; - char *buf; - gconstpointer data; - size_t size; - char *base64; - unsigned char digest[20]; - - msnobj = NULL; - - if (img == NULL) - return msnobj; - - size = purple_imgstore_get_size(img); - data = purple_imgstore_get_data(img); - - /* New object */ - msnobj = msn_object_new(); - msn_object_set_local(msnobj); - msn_object_set_type(msnobj, type); - msn_object_set_location(msnobj, location); - msn_object_set_creator(msnobj, creator); - - msn_object_set_image(msnobj, img); - - /* Compute the SHA1D field. */ - memset(digest, 0, sizeof(digest)); - - ctx = purple_cipher_context_new_by_name("sha1", NULL); - purple_cipher_context_append(ctx, data, size); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1d(msnobj, base64); - g_free(base64); - - msn_object_set_size(msnobj, size); - - /* Compute the SHA1C field. */ - buf = g_strdup_printf( - "Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s", - msn_object_get_creator(msnobj), - msn_object_get_size(msnobj), - msn_object_get_type(msnobj), - msn_object_get_location(msnobj), - msn_object_get_friendly(msnobj), - msn_object_get_sha1d(msnobj)); - - memset(digest, 0, sizeof(digest)); - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(ctx); - g_free(buf); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1c(msnobj, base64); - g_free(base64); - - return msnobj; -} - -void -msn_object_destroy(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->creator); - g_free(obj->location); - g_free(obj->friendly); - g_free(obj->sha1d); - g_free(obj->sha1c); - - purple_imgstore_unref(obj->img); - - if (obj->local) - local_objs = g_list_remove(local_objs, obj); - - g_free(obj); -} - -char * -msn_object_to_string(const MsnObject *obj) -{ - char *str; - const char *sha1c; - - g_return_val_if_fail(obj != NULL, NULL); - - sha1c = msn_object_get_sha1c(obj); - - str = g_strdup_printf("", - msn_object_get_creator(obj), - msn_object_get_size(obj), - msn_object_get_type(obj), - msn_object_get_location(obj), - msn_object_get_friendly(obj), - msn_object_get_sha1d(obj), - sha1c ? " SHA1C=\"" : "", - sha1c ? sha1c : "", - sha1c ? "\"" : ""); - - return str; -} - -void -msn_object_set_creator(MsnObject *obj, const char *creator) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->creator); - obj->creator = g_strdup(creator); -} - -void -msn_object_set_size(MsnObject *obj, int size) -{ - g_return_if_fail(obj != NULL); - - obj->size = size; -} - -void -msn_object_set_type(MsnObject *obj, MsnObjectType type) -{ - g_return_if_fail(obj != NULL); - - obj->type = type; -} - -void -msn_object_set_location(MsnObject *obj, const char *location) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->location); - obj->location = g_strdup(location); -} - -void -msn_object_set_friendly(MsnObject *obj, const char *friendly) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->friendly); - obj->friendly = g_strdup(friendly); -} - -void -msn_object_set_sha1d(MsnObject *obj, const char *sha1d) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->sha1d); - obj->sha1d = g_strdup(sha1d); -} - -void -msn_object_set_sha1c(MsnObject *obj, const char *sha1c) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->sha1c); - obj->sha1c = g_strdup(sha1c); -} - -const char * -msn_object_get_creator(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->creator; -} - -int -msn_object_get_size(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, 0); - - return obj->size; -} - -MsnObjectType -msn_object_get_type(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, MSN_OBJECT_UNKNOWN); - - return obj->type; -} - -const char * -msn_object_get_location(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->location; -} - -const char * -msn_object_get_friendly(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->friendly; -} - -const char * -msn_object_get_sha1d(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1d; -} - -const char * -msn_object_get_sha1c(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1c; -} - -const char * -msn_object_get_sha1(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - if(obj->sha1c != NULL) { - return obj->sha1c; - } else { - return obj->sha1d; - } -} - -static MsnObject * -msn_object_find_local(const char *sha1) -{ - GList *l; - - g_return_val_if_fail(sha1 != NULL, NULL); - - for (l = local_objs; l != NULL; l = l->next) - { - MsnObject *local_obj = l->data; - - if (!strcmp(msn_object_get_sha1(local_obj), sha1)) - return local_obj; - } - - return NULL; - -} - -void -msn_object_set_local(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - obj->local = TRUE; - - local_objs = g_list_append(local_objs, obj); -} - -void -msn_object_set_image(MsnObject *obj, PurpleStoredImage *img) -{ - g_return_if_fail(obj != NULL); - g_return_if_fail(img != NULL); - - /* obj->local = TRUE; */ - - purple_imgstore_unref(obj->img); - obj->img = purple_imgstore_ref(img); -} - -PurpleStoredImage * -msn_object_get_image(const MsnObject *obj) -{ - MsnObject *local_obj; - - g_return_val_if_fail(obj != NULL, NULL); - - local_obj = msn_object_find_local(msn_object_get_sha1(obj)); - - if (local_obj != NULL) - return local_obj->img; - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/object.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ -/** - * @file object.h MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_OBJECT_H -#define MSN_OBJECT_H - -typedef enum -{ - MSN_OBJECT_UNKNOWN = -1, /**< Unknown object */ - MSN_OBJECT_RESERVED1 = 1, /**< Reserved */ - MSN_OBJECT_EMOTICON = 2, /**< Custom Emoticon */ - MSN_OBJECT_USERTILE = 3, /**< UserTile (buddy icon) */ - MSN_OBJECT_RESERVED2 = 4, /**< Reserved */ - MSN_OBJECT_BACKGROUND = 5 /**< Background */ -} MsnObjectType; - -#include "internal.h" - -#include "imgstore.h" - -typedef struct -{ - gboolean local; - - char *creator; - int size; - MsnObjectType type; - PurpleStoredImage *img; - char *location; - char *friendly; - char *sha1d; - char *sha1c; -} MsnObject; - -/** - * Creates a MsnObject structure. - * - * @return A new MsnObject structure. - */ -MsnObject *msn_object_new(void); - -/** - * Creates a MsnObject structure from a string. - * - * @param str The string. - * - * @return The new MsnObject structure. - */ -MsnObject *msn_object_new_from_string(const char *str); - -/** - * Creates a MsnObject structure from a stored image - * - * @param img The image associated to object - * @param location The object location as stored in MsnObject - * @param creator The creator of the object - * @param type The type of the object - * - * @return A new MsnObject structure - */ -MsnObject *msn_object_new_from_image(PurpleStoredImage *img, - const char *location, const char *creator, MsnObjectType type); - -/** - * Destroys an MsnObject structure. - * - * @param obj The object structure. - */ -void msn_object_destroy(MsnObject *obj); - -/** - * Outputs a string representation of an MsnObject. - * - * @param obj The object. - * - * @return The string representation. This must be freed. - */ -char *msn_object_to_string(const MsnObject *obj); - -/** - * Sets the creator field in a MsnObject. - * - * @param creator The creator value. - */ -void msn_object_set_creator(MsnObject *obj, const char *creator); - -/** - * Sets the size field in a MsnObject. - * - * @param size The size value. - */ -void msn_object_set_size(MsnObject *obj, int size); - -/** - * Sets the type field in a MsnObject. - * - * @param type The type value. - */ -void msn_object_set_type(MsnObject *obj, MsnObjectType type); - -/** - * Sets the location field in a MsnObject. - * - * @param location The location value. - */ -void msn_object_set_location(MsnObject *obj, const char *location); - -/** - * Sets the friendly name field in a MsnObject. - * - * @param friendly The friendly name value. - */ -void msn_object_set_friendly(MsnObject *obj, const char *friendly); - -/** - * Sets the SHA1D field in a MsnObject. - * - * @param sha1d The sha1d value. - */ -void msn_object_set_sha1d(MsnObject *obj, const char *sha1d); - -/** - * Sets the SHA1C field in a MsnObject. - * - * @param sha1c The sha1c value. - */ -void msn_object_set_sha1c(MsnObject *obj, const char *sha1c); - -/** - * Associates an image with a MsnObject. - * - * @param obj The object. - * @param img The image to associate. - */ -void msn_object_set_image(MsnObject *obj, PurpleStoredImage *img); - -/** - * Returns a MsnObject's creator value. - * - * @param obj The object. - * - * @return The creator value. - */ -const char *msn_object_get_creator(const MsnObject *obj); - -/** - * Returns a MsnObject's size value. - * - * @param obj The object. - * - * @return The size value. - */ -int msn_object_get_size(const MsnObject *obj); - -/** - * Returns a MsnObject's type. - * - * @param obj The object. - * - * @return The object type. - */ -MsnObjectType msn_object_get_type(const MsnObject *obj); - -/** - * Returns a MsnObject's location value. - * - * @param obj The object. - * - * @return The location value. - */ -const char *msn_object_get_location(const MsnObject *obj); - -/** - * Returns a MsnObject's friendly name value. - * - * @param obj The object. - * - * @return The friendly name value. - */ -const char *msn_object_get_friendly(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1D value. - * - * @param obj The object. - * - * @return The SHA1D value. - */ -const char *msn_object_get_sha1d(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1c(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value if it exists, otherwise SHA1D. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1(const MsnObject *obj); - -/** - * Returns the image associated with the MsnObject. - * - * @param obj The object. - * - * @return The associated image. - */ -PurpleStoredImage *msn_object_get_image(const MsnObject *obj); - -void msn_object_set_local(MsnObject *obj); - -#endif /* MSN_OBJECT_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,842 +0,0 @@ -/** - * @file oim.c - * get and send MSN offline Instant Message via SOAP request - * Author - * MaYuan - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#include "msn.h" -#include "soap.h" -#include "oim.h" -#include "msnutils.h" - -typedef struct _MsnOimSendReq { - char *from_member; - char *friendname; - char *to_member; - char *oim_msg; -} MsnOimSendReq; - -typedef struct { - MsnOim *oim; - char *msg_id; -} MsnOimRecvData; - -/*Local Function Prototype*/ -static void msn_parse_oim_xml(MsnOim *oim, xmlnode *node); -static void msn_oim_free_send_req(MsnOimSendReq *req); -static void msn_oim_recv_data_free(MsnOimRecvData *data); -static void msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data); - -/*new a OIM object*/ -MsnOim * -msn_oim_new(MsnSession *session) -{ - MsnOim *oim; - - oim = g_new0(MsnOim, 1); - oim->session = session; - oim->oim_list = NULL; - oim->run_id = rand_guid(); - oim->challenge = NULL; - oim->send_queue = g_queue_new(); - oim->send_seq = 1; - return oim; -} - -/*destroy the oim object*/ -void -msn_oim_destroy(MsnOim *oim) -{ - MsnOimSendReq *request; - - purple_debug_info("msn", "destroy the OIM %p\n", oim); - g_free(oim->run_id); - g_free(oim->challenge); - - while ((request = g_queue_pop_head(oim->send_queue)) != NULL) - msn_oim_free_send_req(request); - g_queue_free(oim->send_queue); - - while (oim->oim_list != NULL) - msn_oim_recv_data_free((MsnOimRecvData *)oim->oim_list->data); - - g_free(oim); -} - -static MsnOimSendReq * -msn_oim_new_send_req(const char *from_member, const char*friendname, - const char* to_member, const char *msg) -{ - MsnOimSendReq *request; - - request = g_new0(MsnOimSendReq, 1); - request->from_member = g_strdup(from_member); - request->friendname = g_strdup(friendname); - request->to_member = g_strdup(to_member); - request->oim_msg = g_strdup(msg); - return request; -} - -static void -msn_oim_free_send_req(MsnOimSendReq *req) -{ - g_return_if_fail(req != NULL); - - g_free(req->from_member); - g_free(req->friendname); - g_free(req->to_member); - g_free(req->oim_msg); - - g_free(req); -} - -static MsnOimRecvData * -msn_oim_recv_data_new(MsnOim *oim, char *msg_id) -{ - MsnOimRecvData *data; - - data = g_new0(MsnOimRecvData, 1); - data->oim = oim; - data->msg_id = msg_id; - - oim->oim_list = g_list_append(oim->oim_list, data); - - return data; -} - -/* Probably only good for g_list_find_custom */ -static gint -msn_recv_data_equal(MsnOimRecvData *a, const char *msg_id) -{ - return strcmp(a->msg_id, msg_id); -} - -static void -msn_oim_recv_data_free(MsnOimRecvData *data) -{ - data->oim->oim_list = g_list_remove(data->oim->oim_list, data); - g_free(data->msg_id); - - g_free(data); -} - -/**************************************** - * Manage OIM Tokens - ****************************************/ -typedef struct _MsnOimRequestData { - MsnOim *oim; - gboolean send; - const char *action; - const char *host; - const char *url; - xmlnode *body; - MsnSoapCallback cb; - gpointer cb_data; -} MsnOimRequestData; - -static gboolean msn_oim_request_helper(MsnOimRequestData *data); - -static void -msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer req_data) -{ - MsnOimRequestData *data = (MsnOimRequestData *)req_data; - xmlnode *fault = NULL; - xmlnode *faultcode = NULL; - - if (response == NULL) - return; - - fault = xmlnode_get_child(response->xml, "Body/Fault"); - if (fault) - faultcode = xmlnode_get_child(fault, "faultcode"); - - if (faultcode) { - gchar *faultcode_str = xmlnode_get_data(faultcode); - gboolean need_token_update = FALSE; - - if (faultcode_str) { - if (g_str_equal(faultcode_str, "q0:BadContextToken") || - g_str_equal(faultcode_str, "AuthenticationFailed")) - need_token_update = TRUE; - else if (g_str_equal(faultcode_str, "q0:AuthenticationFailed") && - xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) - need_token_update = TRUE; - } - - if (need_token_update) { - purple_debug_warning("msn", "OIM Request Error, Updating token now.\n"); - msn_nexus_update_token(data->oim->session->nexus, - data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB, - (GSourceFunc)msn_oim_request_helper, data); - g_free(faultcode_str); - return; - - } - - g_free(faultcode_str); - } - - if (data->cb) - data->cb(request, response, data->cb_data); - xmlnode_free(data->body); - g_free(data); -} - -static gboolean -msn_oim_request_helper(MsnOimRequestData *data) -{ - MsnSession *session = data->oim->session; - - if (data->send) { - /* The Sending of OIM's uses a different token for some reason. */ - xmlnode *ticket; - ticket = xmlnode_get_child(data->body, "Header/Ticket"); - xmlnode_set_attrib(ticket, "passport", - msn_nexus_get_token_str(session->nexus, MSN_AUTH_LIVE_SECURE)); - } - else - { - xmlnode *passport; - xmlnode *xml_t; - xmlnode *xml_p; - GHashTable *token; - const char *msn_t; - const char *msn_p; - - token = msn_nexus_get_token(session->nexus, MSN_AUTH_MESSENGER_WEB); - g_return_val_if_fail(token != NULL, FALSE); - - msn_t = g_hash_table_lookup(token, "t"); - msn_p = g_hash_table_lookup(token, "p"); - - g_return_val_if_fail(msn_t != NULL, FALSE); - g_return_val_if_fail(msn_p != NULL, FALSE); - - passport = xmlnode_get_child(data->body, "Header/PassportCookie"); - xml_t = xmlnode_get_child(passport, "t"); - xml_p = xmlnode_get_child(passport, "p"); - - /* frees old token text, or the 'EMPTY' text if first time */ - xmlnode_free(xml_t->child); - xmlnode_free(xml_p->child); - - xmlnode_insert_data(xml_t, msn_t, -1); - xmlnode_insert_data(xml_p, msn_p, -1); - } - - msn_soap_message_send(session, - msn_soap_message_new(data->action, xmlnode_copy(data->body)), - data->host, data->url, FALSE, - msn_oim_request_cb, data); - - return FALSE; -} - - -static void -msn_oim_make_request(MsnOim *oim, gboolean send, const char *action, - const char *host, const char *url, xmlnode *body, MsnSoapCallback cb, - gpointer cb_data) -{ - MsnOimRequestData *data = g_new0(MsnOimRequestData, 1); - data->oim = oim; - data->send = send; - data->action = action; - data->host = host; - data->url = url; - data->body = body; - data->cb = cb; - data->cb_data = cb_data; - - msn_oim_request_helper(data); -} - -/**************************************** - * OIM GetMetadata request - * **************************************/ -static void -msn_oim_get_metadata_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOim *oim = data; - - if (response) { - msn_parse_oim_xml(oim, - xmlnode_get_child(response->xml, "Body/GetMetadataResponse/MD")); - } -} - -/* Post to get the OIM Metadata */ -static void -msn_oim_get_metadata(MsnOim *oim) -{ - msn_oim_make_request(oim, FALSE, MSN_OIM_GET_METADATA_ACTION, - MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL, - xmlnode_from_str(MSN_OIM_GET_METADATA_TEMPLATE, -1), - msn_oim_get_metadata_cb, oim); -} - -/**************************************** - * OIM send SOAP request - * **************************************/ -/*encode the message to OIM Message Format*/ -static gchar * -msn_oim_msg_to_str(MsnOim *oim, const char *body) -{ - GString *oim_body; - char *oim_base64; - char *c; - int len; - size_t base64_len; - - purple_debug_info("msn", "Encoding OIM Message...\n"); - len = strlen(body); - c = oim_base64 = purple_base64_encode((const guchar *)body, len); - base64_len = strlen(oim_base64); - purple_debug_info("msn", "Encoded base64 body:{%s}\n", oim_base64); - - oim_body = g_string_new(NULL); - g_string_printf(oim_body, MSN_OIM_MSG_TEMPLATE, - oim->run_id, oim->send_seq); - -#define OIM_LINE_LEN 76 - while (base64_len > OIM_LINE_LEN) { - g_string_append_len(oim_body, c, OIM_LINE_LEN); - g_string_append_c(oim_body, '\n'); - c += OIM_LINE_LEN; - base64_len -= OIM_LINE_LEN; - } -#undef OIM_LINE_LEN - - g_string_append(oim_body, c); - - g_free(oim_base64); - - return g_string_free(oim_body, FALSE); -} - -/* - * Process the send return SOAP string - * If got SOAP Fault,get the lock key,and resend it. - */ -static void -msn_oim_send_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOim *oim = data; - MsnOimSendReq *msg = g_queue_pop_head(oim->send_queue); - - g_return_if_fail(msg != NULL); - - if (response == NULL) { - purple_debug_info("msn", "cannot send OIM: %s\n", msg->oim_msg); - } else { - xmlnode *faultNode = xmlnode_get_child(response->xml, "Body/Fault"); - - if (faultNode == NULL) { - /*Send OK! return*/ - purple_debug_info("msn", "sent OIM: %s\n", msg->oim_msg); - } else { - xmlnode *faultcode = xmlnode_get_child(faultNode, "faultcode"); - - if (faultcode) { - char *faultcode_str = xmlnode_get_data(faultcode); - - if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) { - xmlnode *challengeNode = xmlnode_get_child(faultNode, - "detail/LockKeyChallenge"); - - if (challengeNode == NULL) { - if (oim->challenge) { - g_free(oim->challenge); - oim->challenge = NULL; - - purple_debug_info("msn", "Resending OIM: %s\n", - msg->oim_msg); - g_queue_push_head(oim->send_queue, msg); - msn_oim_send_msg(oim); - msg = NULL; - } else { - purple_debug_info("msn", - "Can't find lock key for OIM: %s\n", - msg->oim_msg); - } - } else { - char buf[33]; - - char *challenge = xmlnode_get_data(challengeNode); - msn_handle_chl(challenge, buf); - - g_free(oim->challenge); - oim->challenge = g_strndup(buf, sizeof(buf)); - g_free(challenge); - purple_debug_info("msn", "Found lockkey:{%s}\n", oim->challenge); - - /*repost the send*/ - purple_debug_info("msn", "Resending OIM: %s\n", msg->oim_msg); - g_queue_push_head(oim->send_queue, msg); - msn_oim_send_msg(oim); - msg = NULL; - } - } else { - /* Report the error */ - const char *str_reason; - - if (g_str_equal(faultcode_str, "q0:SystemUnavailable")) { - str_reason = _("Message was not sent because the system is " - "unavailable. This normally happens when the " - "user is blocked or does not exist."); - - } else if (g_str_equal(faultcode_str, "q0:SenderThrottleLimitExceeded")) { - str_reason = _("Message was not sent because messages " - "are being sent too quickly."); - - } else if (g_str_equal(faultcode_str, "q0:InvalidContent")) { - str_reason = _("Message was not sent because an unknown " - "encoding error occurred."); - - } else { - str_reason = _("Message was not sent because an unknown " - "error occurred."); - } - - msn_session_report_user(oim->session, msg->to_member, - str_reason, PURPLE_MESSAGE_ERROR); - msn_session_report_user(oim->session, msg->to_member, - msg->oim_msg, PURPLE_MESSAGE_RAW); - } - - g_free(faultcode_str); - } - } - } - - if (msg) - msn_oim_free_send_req(msg); -} - -void -msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername, - const char* friendname, const char *tomember, - const char * msg) -{ - g_return_if_fail(oim != NULL); - - g_queue_push_tail(oim->send_queue, - msn_oim_new_send_req(membername, friendname, tomember, msg)); -} - -/*post send single message request to oim server*/ -void -msn_oim_send_msg(MsnOim *oim) -{ - MsnOimSendReq *oim_request; - char *soap_body; - char *msg_body; - - g_return_if_fail(oim != NULL); - oim_request = g_queue_peek_head(oim->send_queue); - g_return_if_fail(oim_request != NULL); - - purple_debug_info("msn", "Sending OIM: %s\n", oim_request->oim_msg); - - /* if we got the challenge lock key, we compute it - * else we go for the SOAP fault and resend it. - */ - if (oim->challenge == NULL){ - purple_debug_info("msn", "No lock key challenge, waiting for SOAP Fault and Resend\n"); - } - - msg_body = msn_oim_msg_to_str(oim, oim_request->oim_msg); - soap_body = g_strdup_printf(MSN_OIM_SEND_TEMPLATE, - oim_request->from_member, - oim_request->friendname, - oim_request->to_member, - MSNP15_WLM_PRODUCT_ID, - oim->challenge ? oim->challenge : "", - oim->send_seq, - msg_body); - - msn_oim_make_request(oim, TRUE, MSN_OIM_SEND_SOAP_ACTION, MSN_OIM_SEND_HOST, - MSN_OIM_SEND_URL, xmlnode_from_str(soap_body, -1), msn_oim_send_read_cb, - oim); - - /*increase the offline Sequence control*/ - if (oim->challenge != NULL) { - oim->send_seq++; - } - - g_free(msg_body); - g_free(soap_body); -} - -/**************************************** - * OIM delete SOAP request - * **************************************/ -static void -msn_oim_delete_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOimRecvData *rdata = data; - - if (response && xmlnode_get_child(response->xml, "Body/Fault") == NULL) - purple_debug_info("msn", "Delete OIM success\n"); - else - purple_debug_info("msn", "Delete OIM failed\n"); - - msn_oim_recv_data_free(rdata); -} - -/*Post to get the Offline Instant Message*/ -static void -msn_oim_post_delete_msg(MsnOimRecvData *rdata) -{ - MsnOim *oim = rdata->oim; - char *msgid = rdata->msg_id; - char *soap_body; - - purple_debug_info("msn", "Delete single OIM Message {%s}\n",msgid); - - soap_body = g_strdup_printf(MSN_OIM_DEL_TEMPLATE, msgid); - - msn_oim_make_request(oim, FALSE, MSN_OIM_DEL_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, - MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_delete_read_cb, rdata); - - g_free(soap_body); -} - -/**************************************** - * OIM get SOAP request - * **************************************/ -/* like purple_str_to_time, but different. The format of the timestamp - * is like this: 5 Sep 2007 21:42:12 -0700 */ -static time_t -msn_oim_parse_timestamp(const char *timestamp) -{ - char month_str[4], tz_str[6]; - char *tz_ptr = tz_str; - static const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL - }; - time_t tval = 0; - struct tm t; - memset(&t, 0, sizeof(t)); - - time(&tval); - localtime_r(&tval, &t); - - if (sscanf(timestamp, "%02d %03s %04d %02d:%02d:%02d %05s", - &t.tm_mday, month_str, &t.tm_year, - &t.tm_hour, &t.tm_min, &t.tm_sec, tz_str) == 7) { - gboolean offset_positive = TRUE; - int tzhrs; - int tzmins; - - for (t.tm_mon = 0; - months[t.tm_mon] != NULL && - strcmp(months[t.tm_mon], month_str) != 0; t.tm_mon++); - if (months[t.tm_mon] != NULL) { - if (*tz_str == '-') { - offset_positive = FALSE; - tz_ptr++; - } else if (*tz_str == '+') { - tz_ptr++; - } - - if (sscanf(tz_ptr, "%02d%02d", &tzhrs, &tzmins) == 2) { - time_t tzoff = tzhrs * 60 * 60 + tzmins * 60; -#ifdef _WIN32 - long sys_tzoff; -#endif - - if (offset_positive) - tzoff *= -1; - - t.tm_year -= 1900; - -#ifdef _WIN32 - if ((sys_tzoff = wpurple_get_tz_offset()) != -1) - tzoff += sys_tzoff; -#else -#ifdef HAVE_TM_GMTOFF - tzoff += t.tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); /* making sure */ - tzoff -= timezone; -# endif -#endif -#endif /* _WIN32 */ - - return mktime(&t) + tzoff; - } - } - } - - purple_debug_info("msn", "Can't parse timestamp %s\n", timestamp); - return tval; -} - -/*Post the Offline Instant Message to User Conversation*/ -static void -msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str) -{ - MsnMessage *message; - const char *date; - const char *from; - const char *boundary; - char *decode_msg = NULL; - gsize body_len; - char **tokens; - char *passport = NULL; - time_t stamp; - - message = msn_message_new(MSN_MSG_UNKNOWN); - - msn_message_parse_payload(message, msg_str, strlen(msg_str), - MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); - purple_debug_info("msn", "oim body:{%s}\n", message->body); - - boundary = msn_message_get_attr(message, "boundary"); - - if (boundary != NULL) { - char *bounds; - char **part; - - bounds = g_strdup_printf("--%s" MSG_OIM_LINE_DEM, boundary); - tokens = g_strsplit(message->body, bounds, 0); - - /* tokens+1 to skip the "This is a multipart message..." text */ - for (part = tokens+1; *part != NULL; part++) { - MsnMessage *multipart; - const char *type; - multipart = msn_message_new(MSN_MSG_UNKNOWN); - msn_message_parse_payload(multipart, *part, strlen(*part), - MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); - - type = msn_message_get_content_type(multipart); - if (type && !strcmp(type, "text/plain")) { - decode_msg = (char *)purple_base64_decode(multipart->body, &body_len); - msn_message_destroy(multipart); - break; - } - msn_message_destroy(multipart); - } - - g_strfreev(tokens); - g_free(bounds); - - if (decode_msg == NULL) { - purple_debug_error("msn", "Couldn't find text/plain OIM message.\n"); - msn_message_destroy(message); - return; - } - } else { - decode_msg = (char *)purple_base64_decode(message->body, &body_len); - } - - from = msn_message_get_attr(message, "X-OIM-originatingSource"); - - /* Match number to user's mobile number, FROM is a phone number - if the other side pages you using your phone number */ - if (from && !strncmp(from, "tel:+", 5)) { - MsnUser *user = msn_userlist_find_user_with_mobile_phone( - rdata->oim->session->userlist, from + 4); - - if (user && user->passport) - passport = g_strdup(user->passport); - } - - if (passport == NULL) { - char *start, *end; - - from = msn_message_get_attr(message, "From"); - - tokens = g_strsplit(from, " ", 2); - if (tokens[1] != NULL) - from = (const char *)tokens[1]; - - start = strchr(from, '<'); - if (start != NULL) { - start++; - end = strchr(from, '>'); - if (end != NULL) - passport = g_strndup(start, end - start); - } - if (passport == NULL) - passport = g_strdup(_("Unknown")); - - g_strfreev(tokens); - } - - date = msn_message_get_attr(message, "Date"); - stamp = msn_oim_parse_timestamp(date); - purple_debug_info("msn", "oim Date:{%s},passport{%s}\n", - date, passport); - - serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0, - stamp); - - /*Now get the oim message ID from the oim_list. - * and append to read list to prepare for deleting the Offline Message when sign out - */ - msn_oim_post_delete_msg(rdata); - - g_free(passport); - g_free(decode_msg); - msn_message_destroy(message); -} - -/* Parse the XML data, - * prepare to report the OIM to user - */ -static void -msn_oim_get_read_cb(MsnSoapMessage *request, MsnSoapMessage *response, - gpointer data) -{ - MsnOimRecvData *rdata = data; - - if (response != NULL) { - xmlnode *msg_node = xmlnode_get_child(response->xml, - "Body/GetMessageResponse/GetMessageResult"); - - if (msg_node) { - char *msg_str = xmlnode_get_data(msg_node); - msn_oim_report_to_user(rdata, msg_str); - g_free(msg_str); - } else { - char *str = xmlnode_to_str(response->xml, NULL); - purple_debug_info("msn", "Unknown OIM response: %s\n", str); - g_free(str); - msn_oim_recv_data_free(rdata); - } - } else { - purple_debug_info("msn", "Failed to get OIM\n"); - msn_oim_recv_data_free(rdata); - } - -} - -/* parse the oim XML data - * and post it to the soap server to get the Offline Message - * */ -void -msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg) -{ - xmlnode *node; - - purple_debug_info("msn", "%s\n", xmlmsg); - - if (!strcmp(xmlmsg, "too-large")) { - /* Too many OIM's to send via NS, so we need to request them via SOAP. */ - msn_oim_get_metadata(oim); - } else { - node = xmlnode_from_str(xmlmsg, -1); - msn_parse_oim_xml(oim, node); - xmlnode_free(node); - } -} - -static void -msn_parse_oim_xml(MsnOim *oim, xmlnode *node) -{ - xmlnode *mNode; - xmlnode *iu_node; - MsnSession *session = oim->session; - - g_return_if_fail(node != NULL); - - if (strcmp(node->name, "MD") != 0) { - char *xmlmsg = xmlnode_to_str(node, NULL); - purple_debug_info("msn", "WTF is this? %s\n", xmlmsg); - g_free(xmlmsg); - return; - } - - iu_node = xmlnode_get_child(node, "E/IU"); - - if (iu_node != NULL && purple_account_get_check_mail(session->account)) - { - char *unread = xmlnode_get_data(iu_node); - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.mail_url }; - int count = atoi(unread); - - /* XXX/khc: pretty sure this is wrong */ - if (count > 0) - purple_notify_emails(session->account->gc, count, FALSE, NULL, - NULL, passports, urls, NULL, NULL); - g_free(unread); - } - - for(mNode = xmlnode_get_child(node, "M"); mNode; - mNode = xmlnode_get_next_twin(mNode)){ - char *passport, *msgid, *nickname, *rtime = NULL; - xmlnode *e_node, *i_node, *n_node, *rt_node; - - e_node = xmlnode_get_child(mNode, "E"); - passport = xmlnode_get_data(e_node); - - i_node = xmlnode_get_child(mNode, "I"); - msgid = xmlnode_get_data(i_node); - - n_node = xmlnode_get_child(mNode, "N"); - nickname = xmlnode_get_data(n_node); - - rt_node = xmlnode_get_child(mNode, "RT"); - if (rt_node != NULL) { - rtime = xmlnode_get_data(rt_node); - } -/* purple_debug_info("msn", "E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */ - - if (!g_list_find_custom(oim->oim_list, msgid, (GCompareFunc)msn_recv_data_equal)) { - MsnOimRecvData *data = msn_oim_recv_data_new(oim, msgid); - msn_oim_post_single_get_msg(oim, data); - msgid = NULL; - } - - g_free(passport); - g_free(msgid); - g_free(rtime); - g_free(nickname); - } -} - -/*Post to get the Offline Instant Message*/ -static void -msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data) -{ - char *soap_body; - - purple_debug_info("msn", "Get single OIM Message\n"); - - soap_body = g_strdup_printf(MSN_OIM_GET_TEMPLATE, data->msg_id); - - msn_oim_make_request(oim, FALSE, MSN_OIM_GET_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, - MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_get_read_cb, - data); - - g_free(soap_body); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/oim.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -/** - * @file oim.h Header file for oim.c - * Author - * MaYuan - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef MSN_OIM_H -#define MSN_OIM_H - -typedef struct _MsnOim MsnOim; - -/* OIM Retrieval Info */ -#define MSN_OIM_RETRIEVE_HOST "rsi.hotmail.com" -#define MSN_OIM_RETRIEVE_URL "/rsi/rsi.asmx" - -/* OIM GetMetadata SOAP Template */ -#define MSN_OIM_GET_METADATA_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMetadata" - -#define MSN_OIM_GET_METADATA_TEMPLATE ""\ -""\ - ""\ - ""\ - "EMPTY"\ - "

EMPTY

"\ - "
"\ - "
"\ - ""\ - ""\ - ""\ -"" - -/*OIM GetMessage SOAP Template*/ -#define MSN_OIM_GET_SOAP_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage" - -#define MSN_OIM_GET_TEMPLATE ""\ -""\ - ""\ - ""\ - "EMPTY"\ - "

EMPTY

"\ - "
"\ - "
"\ - ""\ - ""\ - "%s"\ - "false"\ - ""\ - ""\ -"" - -/*OIM DeleteMessages SOAP Template*/ -#define MSN_OIM_DEL_SOAP_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages" - -#define MSN_OIM_DEL_TEMPLATE ""\ -""\ - ""\ - ""\ - "EMPTY"\ - "

EMPTY

"\ - "
"\ - "
"\ - ""\ - ""\ - ""\ - "%s"\ - ""\ - ""\ - ""\ -"" - -/*OIM Send SOAP Template*/ -#define MSN_OIM_MSG_TEMPLATE "MIME-Version: 1.0\n"\ - "Content-Type: text/plain; charset=UTF-8\n"\ - "Content-Transfer-Encoding: base64\n"\ - "X-OIM-Message-Type: OfflineMessage\n"\ - "X-OIM-Run-Id: {%s}\n"\ - "X-OIM-Sequence-Num: %d\n\n" - -#define MSN_OIM_SEND_HOST "ows.messenger.msn.com" -#define MSN_OIM_SEND_URL "/OimWS/oim.asmx" -#define MSN_OIM_SEND_SOAP_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2" -#define MSN_OIM_SEND_TEMPLATE ""\ -""\ - ""\ - ""\ - ""\ - ""\ - ""\ - "http://messenger.msn.com"\ - "%d"\ - ""\ - ""\ - ""\ - "text"\ - "%s"\ - ""\ -"" - -struct _MsnOim -{ - MsnSession *session; - - GList * oim_list; - - char *challenge; - char *run_id; - gint send_seq; - GQueue *send_queue; -}; - -/**************************************************** - * function prototype - * **************************************************/ -MsnOim * msn_oim_new(MsnSession *session); -void msn_oim_destroy(MsnOim *oim); - -void msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg); - -/*Send OIM Message*/ -void msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername, - const char *friendname, const char *tomember, - const char * msg); - -void msn_oim_send_msg(MsnOim *oim); - -#endif/* MSN_OIM_H*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/** - * @file page.c Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "page.h" - -MsnPage * -msn_page_new(void) -{ - MsnPage *page; - - page = g_new0(MsnPage, 1); - - return page; -} - -void -msn_page_destroy(MsnPage *page) -{ - g_return_if_fail(page != NULL); - - g_free(page->body); - g_free(page->from_location); - g_free(page->from_phone); - - g_free(page); -} - -char * -msn_page_gen_payload(const MsnPage *page, size_t *ret_size) -{ - char *str; - char *body; - - g_return_val_if_fail(page != NULL, NULL); - - body = g_markup_escape_text(msn_page_get_body(page), -1); - str = g_strdup_printf( - "%s", - body); - g_free(body); - - if (ret_size != NULL) - *ret_size = strlen(str); - - return str; -} - -void -msn_page_set_body(MsnPage *page, const char *body) -{ - g_return_if_fail(page != NULL); - g_return_if_fail(body != NULL); - - g_free(page->body); - page->body = g_strdup(body); -} - -const char * -msn_page_get_body(const MsnPage *page) -{ - g_return_val_if_fail(page != NULL, NULL); - - return page->body; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/page.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/** - * @file page.h Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_PAGE_H -#define MSN_PAGE_H - -typedef struct _MsnPage MsnPage; - -#include "session.h" - -/** - * A page. - */ -struct _MsnPage -{ - char *from_location; - char *from_phone; - - char *body; -}; - -/** - * Creates a new, empty page. - * - * @return A new page. - */ -MsnPage *msn_page_new(void); - -/** - * Destroys a page. - */ -void msn_page_destroy(MsnPage *page); - -/** - * Generates the payload data of a page. - * - * @param page The page. - * @param ret_size The returned size of the payload. - * - * @return The payload data of a page. - */ -char *msn_page_gen_payload(const MsnPage *page, size_t *ret_size); - -/** - * Sets the body of a page. - * - * @param page The page. - * @param body The body of the page. - */ -void msn_page_set_body(MsnPage *page, const char *body); - -/** - * Returns the body of the page. - * - * @param page The page. - * - * @return The body of the page. - */ -const char *msn_page_get_body(const MsnPage *page); - -#endif /* MSN_PAGE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -MSNP14 Implementation -by Ma Yuan - -1. Introduction -------------- - -MSNP14 Protocol, proposed by Windows Live Messenger, is new, and there is no available implementation except the official one on Windows Platform. - -It has introduced many new features attractable to many users, such as: -* Offline Instant Message - You can send the offline Message to the offline User, - The message will be posted to that user the next time when he is online. - -* Communicate with Yahoo User - U can chat with the Yahoo User in MSN, That's Fantastic! Till now , - you can send text/Nudge to Yahoo User. - -* Windows Live ID authentition - WLM use the Window Live ID Authentication process,Known as Passport 3.0, - The procedure is totally different to the previous Passport 2.0 - -* Video/Audio Conversation - U can communicate with other's via Video/Audio. -(Though very interesting, not implemented in this version) - -2.New Features Added ------------------ - -Till now, This project has implemented the following Feature: -* Windows Live ID authentication. - -* Offline Instant Message -Now can send and receive the Offline Instant Message to MSN user and Yahoo User. - -*contact management -Can add/delete Contact -Can add/delete Group - -* Communicate with Yahoo User -Can send/receive Message/Nudge to Yahoo User. - -*. Changes to made to fit MSNP14 Protocol - -3. Reference -------------- - -The very useful sites of MSN Protocol: -MSNpiki site: -reverse engineer of MSN Protocol.up to dated. -http://msnpiki.msnfanatic.com/index.php/MSN_Protocol_Version_13 - -hypothetic site: -old MSN Protocol Introduction,but very useful for basic idea of MSN protocol -http://www.hypothetic.org/docs/msn/index.php - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,605 +0,0 @@ -/** - * @file servconn.c Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "servconn.h" -#include "error.h" - -static void read_cb(gpointer data, gint source, PurpleInputCondition cond); -static void servconn_timeout_renew(MsnServConn *servconn); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnServConn * -msn_servconn_new(MsnSession *session, MsnServConnType type) -{ - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - servconn = g_new0(MsnServConn, 1); - - servconn->type = type; - - servconn->session = session; - servconn->cmdproc = msn_cmdproc_new(session); - servconn->cmdproc->servconn = servconn; - - servconn->httpconn = msn_httpconn_new(servconn); - - servconn->num = session->servconns_count++; - - servconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - servconn->tx_handler = 0; - servconn->timeout_sec = 0; - servconn->timeout_handle = 0; - - servconn->fd = -1; - - return servconn; -} - -void -msn_servconn_destroy(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->processing) - { - servconn->wasted = TRUE; - return; - } - - msn_servconn_disconnect(servconn); - - if (servconn->destroy_cb) - servconn->destroy_cb(servconn); - - if (servconn->httpconn != NULL) - msn_httpconn_destroy(servconn->httpconn); - - g_free(servconn->host); - - purple_circ_buffer_destroy(servconn->tx_buf); - if (servconn->tx_handler > 0) - purple_input_remove(servconn->tx_handler); - if (servconn->timeout_handle > 0) - purple_timeout_remove(servconn->timeout_handle); - - msn_cmdproc_destroy(servconn->cmdproc); - g_free(servconn); -} - -void -msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - servconn->connect_cb = connect_cb; -} - -void -msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->disconnect_cb = disconnect_cb; -} - -void -msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->destroy_cb = destroy_cb; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -void -msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error, - const char *reason) -{ - MsnSession *session = servconn->session; - MsnServConnType type = servconn->type; - - const char *names[] = { "Notification", "Switchboard" }; - const char *name; - - name = names[type]; - - if (reason == NULL) { - switch (error) - { - case MSN_SERVCONN_ERROR_CONNECT: - reason = _("Unable to connect"); break; - case MSN_SERVCONN_ERROR_WRITE: - reason = _("Writing error"); break; - case MSN_SERVCONN_ERROR_READ: - reason = _("Reading error"); break; - default: - reason = _("Unknown error"); break; - } - } - - purple_debug_error("msn", "Connection error from %s server (%s): %s\n", - name, servconn->host, reason); - - if (type == MSN_SERVCONN_SB) - { - MsnSwitchBoard *swboard; - swboard = servconn->cmdproc->data; - if (swboard != NULL) - swboard->error = MSN_SB_ERROR_CONNECTION; - } - - /* servconn->disconnect_cb may destroy servconn, so don't use it again */ - msn_servconn_disconnect(servconn); - - if (type == MSN_SERVCONN_NS) - { - char *tmp = g_strdup_printf(_("Connection error from %s server:\n%s"), - name, reason); - msn_session_set_error(session, MSN_ERROR_SERVCONN, tmp); - g_free(tmp); - } -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(gpointer data, gint source, const char *error_message) -{ - MsnServConn *servconn; - - servconn = data; - servconn->connect_data = NULL; - - servconn->fd = source; - - if (source >= 0) - { - servconn->connected = TRUE; - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - servconn->inpa = purple_input_add(servconn->fd, PURPLE_INPUT_READ, - read_cb, data); - servconn_timeout_renew(servconn); - } - else - { - purple_debug_error("msn", "Connection error: %s\n", error_message); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT, error_message); - } -} - -gboolean -msn_servconn_connect(MsnServConn *servconn, const char *host, int port, gboolean force) -{ - MsnSession *session; - - g_return_val_if_fail(servconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - session = servconn->session; - - if (servconn->connected) - msn_servconn_disconnect(servconn); - - g_free(servconn->host); - servconn->host = g_strdup(host); - - if (session->http_method) - { - /* HTTP Connection. */ - - if (!servconn->httpconn->connected || force) - if (!msn_httpconn_connect(servconn->httpconn, host, port)) - return FALSE; - - servconn->connected = TRUE; - servconn->httpconn->virgin = TRUE; - servconn_timeout_renew(servconn); - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - - return TRUE; - } - - servconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, connect_cb, servconn); - - return (servconn->connect_data != NULL); -} - -void -msn_servconn_disconnect(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->connect_data != NULL) - { - purple_proxy_connect_cancel(servconn->connect_data); - servconn->connect_data = NULL; - } - - if (!servconn->connected) - { - /* We could not connect. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->session->http_method) - { - /* Fake disconnection. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->inpa > 0) - { - purple_input_remove(servconn->inpa); - servconn->inpa = 0; - } - - if (servconn->timeout_handle > 0) - { - purple_timeout_remove(servconn->timeout_handle); - servconn->timeout_handle = 0; - } - - close(servconn->fd); - - servconn->rx_buf = NULL; - servconn->rx_len = 0; - servconn->payload_len = 0; - - servconn->connected = FALSE; - - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); -} - -static gboolean -servconn_idle_timeout_cb(MsnServConn *servconn) -{ - servconn->timeout_handle = 0; - msn_servconn_disconnect(servconn); - return FALSE; -} - -static void -servconn_timeout_renew(MsnServConn *servconn) -{ - if (servconn->timeout_handle) { - purple_timeout_remove(servconn->timeout_handle); - servconn->timeout_handle = 0; - } - - if (servconn->connected && servconn->timeout_sec) { - servconn->timeout_handle = purple_timeout_add_seconds( - servconn->timeout_sec, (GSourceFunc)servconn_idle_timeout_cb, servconn); - } -} - -void -msn_servconn_set_idle_timeout(MsnServConn *servconn, guint seconds) -{ - servconn->timeout_sec = seconds; - if (servconn->connected) - servconn_timeout_renew(servconn); -} - -static void -servconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn = data; - gssize ret; - int writelen; - - writelen = purple_circ_buffer_get_max_read(servconn->tx_buf); - - if (writelen == 0) { - purple_input_remove(servconn->tx_handler); - servconn->tx_handler = 0; - return; - } - - ret = write(servconn->fd, servconn->tx_buf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - return; - } - - purple_circ_buffer_mark_read(servconn->tx_buf, ret); - servconn_timeout_renew(servconn); -} - -gssize -msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len) -{ - gssize ret = 0; - - g_return_val_if_fail(servconn != NULL, 0); - - if (!servconn->session->http_method) - { - if (servconn->tx_handler == 0) { - switch (servconn->type) - { - case MSN_SERVCONN_NS: - case MSN_SERVCONN_SB: - ret = write(servconn->fd, buf, len); - break; -#if 0 - case MSN_SERVCONN_DC: - ret = write(servconn->fd, &buf, sizeof(len)); - ret = write(servconn->fd, buf, len); - break; -#endif - default: - ret = write(servconn->fd, buf, len); - break; - } - } else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno == EAGAIN) - ret = 0; - if (ret >= 0 && ret < len) { - if (servconn->tx_handler == 0) - servconn->tx_handler = purple_input_add( - servconn->fd, PURPLE_INPUT_WRITE, - servconn_write_cb, servconn); - purple_circ_buffer_append(servconn->tx_buf, buf + ret, - len - ret); - } - } - else - { - ret = msn_httpconn_write(servconn->httpconn, buf, len); - } - - if (ret == -1) - { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE, NULL); - } - - servconn_timeout_renew(servconn); - return ret; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn; - char buf[MSN_BUF_LEN]; - gssize len; - - servconn = data; - - if (servconn->type == MSN_SERVCONN_NS) - servconn->session->account->gc->last_received = time(NULL); - - len = read(servconn->fd, buf, sizeof(buf) - 1); - if (len < 0 && errno == EAGAIN) - return; - if (len <= 0) { - purple_debug_error("msn", "servconn %03d read error, " - "len: %" G_GSSIZE_FORMAT ", errno: %d, error: %s\n", - servconn->num, len, errno, g_strerror(errno)); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ, NULL); - - return; - } - - buf[len] = '\0'; - - servconn->rx_buf = g_realloc(servconn->rx_buf, len + servconn->rx_len + 1); - memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1); - servconn->rx_len += len; - - servconn = msn_servconn_process_data(servconn); - if (servconn) - servconn_timeout_renew(servconn); -} - -MsnServConn *msn_servconn_process_data(MsnServConn *servconn) -{ - char *cur, *end, *old_rx_buf; - int cur_len; - - end = old_rx_buf = servconn->rx_buf; - - servconn->processing = TRUE; - - do - { - cur = end; - - if (servconn->payload_len) - { - if (servconn->payload_len > servconn->rx_len) - /* The payload is still not complete. */ - break; - - cur_len = servconn->payload_len; - end += cur_len; - } - else - { - end = strstr(cur, "\r\n"); - - if (end == NULL) - /* The command is still not complete. */ - break; - - *end = '\0'; - end += 2; - cur_len = end - cur; - } - - servconn->rx_len -= cur_len; - - if (servconn->payload_len) - { - msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len); - servconn->payload_len = 0; - } - else - { - msn_cmdproc_process_cmd_text(servconn->cmdproc, cur); - servconn->payload_len = servconn->cmdproc->last_cmd->payload_len; - } - } while (servconn->connected && !servconn->wasted && servconn->rx_len > 0); - - if (servconn->connected && !servconn->wasted) - { - if (servconn->rx_len > 0) - servconn->rx_buf = g_memdup(cur, servconn->rx_len); - else - servconn->rx_buf = NULL; - } - - servconn->processing = FALSE; - - if (servconn->wasted) { - msn_servconn_destroy(servconn); - servconn = NULL; - } - - g_free(old_rx_buf); - return servconn; -} - -#if 0 -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/servconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -/** - * @file servconn.h Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SERVCONN_H -#define MSN_SERVCONN_H - -typedef struct _MsnServConn MsnServConn; - -/** - * Connection error types. - */ -typedef enum -{ - MSN_SERVCONN_ERROR_NONE, - MSN_SERVCONN_ERROR_CONNECT, - MSN_SERVCONN_ERROR_WRITE, - MSN_SERVCONN_ERROR_READ -} MsnServConnError; - -/** - * Connection types. - */ -typedef enum -{ - MSN_SERVCONN_NS, - MSN_SERVCONN_SB -} MsnServConnType; - -#include "proxy.h" - -#include "cmdproc.h" -#include "httpconn.h" -#include "session.h" - -/** - * A Connection. - */ -struct _MsnServConn -{ - MsnServConnType type; /**< The type of this connection. */ - MsnSession *session; /**< The MSN session of this connection. */ - MsnCmdProc *cmdproc; /**< The command processor of this connection. */ - - PurpleProxyConnectData *connect_data; - - gboolean connected; /**< A flag that states if it's connected. */ - gboolean processing; /**< A flag that states if something is working - with this connection. */ - gboolean wasted; /**< A flag that states if it should be destroyed. */ - - char *host; /**< The host this connection is connected or should be - connected to. */ - int num; /**< A number id of this connection. */ - - MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ - - int fd; /**< The connection's file descriptor. */ - int inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer lenght. */ - - size_t payload_len; /**< The length of the payload. - It's only set when we've received a command that - has a payload. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; - guint timeout_sec; - guint timeout_handle; - - void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ - void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ - void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ -}; - -/** - * Creates a new connection object. - * - * @param session The session. - * @param type The type of the connection. - */ -MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); - -/** - * Destroys a connection object. - * - * @param servconn The connection. - */ -void msn_servconn_destroy(MsnServConn *servconn); - -/** - * Connects to a host. - * - * @param servconn The connection. - * @param host The host. - * @param port The port. - * @param force Force this servconn to connect to a new server. - */ -gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port, - gboolean force); - -/** - * Disconnects. - * - * @param servconn The connection. - */ -void msn_servconn_disconnect(MsnServConn *servconn); - -/** - * Sets the connect callback. - * - * @param servconn The servconn. - * @param connect_cb The connect callback. - */ -void msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)); -/** - * Sets the disconnect callback. - * - * @param servconn The servconn. - * @param disconnect_cb The disconnect callback. - */ -void msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)); -/** - * Sets the destroy callback. - * - * @param servconn The servconn that's being destroyed. - * @param destroy_cb The destroy callback. - */ -void msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)); - -/** - * Writes a chunck of data to the servconn. - * - * @param servconn The servconn. - * @param buf The data to write. - * @param size The size of the data. - */ -gssize msn_servconn_write(MsnServConn *servconn, const char *buf, - size_t size); - -/** - * Function to call whenever an error related to a switchboard occurs. - * - * @param servconn The servconn. - * @param error The error that happened. - */ -void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error, - const char *reason); - -/** - * Process the data in servconn->rx_buf. This is called after reading - * data from the socket. - * - * @param servconn The servconn. - * - * @return @c NULL if servconn was destroyed, 'servconn' otherwise. - */ -MsnServConn *msn_servconn_process_data(MsnServConn *servconn); - -/** - * Set a idle timeout fot this servconn - * - * @param servconn The servconn - * @param seconds The idle timeout in seconds - */ -void msn_servconn_set_idle_timeout(MsnServConn *servconn, guint seconds); - -#endif /* MSN_SERVCONN_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,453 +0,0 @@ -/** - * @file session.c MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "session.h" -#include "notification.h" -#include "oim.h" - -#include "dialog.h" - -MsnSession * -msn_session_new(PurpleAccount *account) -{ - MsnSession *session; - - g_return_val_if_fail(account != NULL, NULL); - - session = g_new0(MsnSession, 1); - - session->account = account; - session->notification = msn_notification_new(session); - session->userlist = msn_userlist_new(session); - - session->user = msn_user_new(session->userlist, - purple_account_get_username(account), NULL); - session->oim = msn_oim_new(session); - - session->protocol_ver = WLM_PROT_VER; - - return session; -} - -void -msn_session_destroy(MsnSession *session) -{ - g_return_if_fail(session != NULL); - - session->destroying = TRUE; - - if (session->connected) - msn_session_disconnect(session); - - if (session->soap_cleanup_handle) - purple_timeout_remove(session->soap_cleanup_handle); - - if (session->soap_table != NULL) - g_hash_table_destroy(session->soap_table); - - while (session->slplinks != NULL) - msn_slplink_destroy(session->slplinks->data); - - while (session->switches != NULL) - msn_switchboard_destroy(session->switches->data); - - if (session->sync != NULL) - msn_sync_destroy(session->sync); - - if (session->oim != NULL) - msn_oim_destroy(session->oim); - - if (session->nexus != NULL) - msn_nexus_destroy(session->nexus); - - if (session->user != NULL) - msn_user_destroy(session->user); - - if (session->notification != NULL) - msn_notification_destroy(session->notification); - - msn_userlist_destroy(session->userlist); - - g_free(session->psm); - g_free(session->abch_cachekey); -#if 0 - g_free(session->blocked_text); -#endif - - g_free(session->passport_info.kv); - g_free(session->passport_info.sid); - g_free(session->passport_info.mspauth); - g_free(session->passport_info.client_ip); - g_free(session->passport_info.mail_url); - - g_free(session); -} - -gboolean -msn_session_connect(MsnSession *session, const char *host, int port, - gboolean http_method) -{ - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(!session->connected, TRUE); - - session->connected = TRUE; - session->http_method = http_method; - - if (session->notification == NULL) - { - purple_debug_error("msn", "This shouldn't happen\n"); - g_return_val_if_reached(FALSE); - } - - return msn_notification_connect(session->notification, host, port); -} - -void -msn_session_disconnect(MsnSession *session) -{ - g_return_if_fail(session != NULL); - - if (!session->connected) - return; - - session->connected = FALSE; - - while (session->switches != NULL) - msn_switchboard_close(session->switches->data); - - if (session->notification != NULL) - msn_notification_close(session->notification); -} - -/* TODO: This must go away when conversation is redesigned */ -MsnSwitchBoard * -msn_session_find_swboard(MsnSession *session, const char *username) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user)) - return swboard; - } - - return NULL; -} - -static PurpleConversation * -msn_session_get_conv(MsnSession *session,const char *passport) -{ - PurpleAccount *account; - PurpleConversation * conv; - - g_return_val_if_fail(session != NULL, NULL); - account = session->account; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - passport, account); - if(conv == NULL){ - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, passport); - } - return conv; -} - -/* put Message to User Conversation - * - * passport - the one want to talk to you - */ -void -msn_session_report_user(MsnSession *session,const char *passport,const char *msg,PurpleMessageFlags flags) -{ - PurpleConversation * conv; - - if ((conv = msn_session_get_conv(session,passport)) != NULL){ - purple_conversation_write(conv, NULL, msg, flags, time(NULL)); - } -} - -MsnSwitchBoard * -msn_session_find_swboard_with_conv(MsnSession *session, PurpleConversation *conv) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(conv != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->conv == conv) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_find_swboard_with_id(const MsnSession *session, int chat_id) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(chat_id >= 0, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->chat_id == chat_id) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_get_swboard(MsnSession *session, const char *username, - MsnSBFlag flag) -{ - MsnSwitchBoard *swboard; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = msn_session_find_swboard(session, username); - - if (swboard == NULL) - { - swboard = msn_switchboard_new(session); - swboard->im_user = g_strdup(username); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, username); - } - - swboard->flag |= flag; - - return swboard; -} - -static void -msn_session_sync_users(MsnSession *session) -{ - PurpleConnection *gc = purple_account_get_connection(session->account); - GList *to_remove = NULL; - GSList *buddies; - - g_return_if_fail(gc != NULL); - - /* The core used to use msn_add_buddy to add all buddies before - * being logged in. This no longer happens, so we manually iterate - * over the whole buddy list to identify sync issues. - */ - for (buddies = purple_find_buddies(session->account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *buddy = buddies->data; - const gchar *buddy_name = purple_buddy_get_name(buddy); - const gchar *group_name = purple_group_get_name(purple_buddy_get_group(buddy)); - MsnUser *remote_user; - gboolean found = FALSE; - - remote_user = msn_userlist_find_user(session->userlist, buddy_name); - if (remote_user && remote_user->list_op & MSN_LIST_FL_OP) { - GList *l; - for (l = remote_user->group_ids; l; l = l->next) { - const char *name = msn_userlist_find_group_name(remote_user->userlist, l->data); - if (name && !g_ascii_strcasecmp(group_name, name)) { - found = TRUE; - break; - } - } - - /* We don't care if they're in a different group, as long as they're on the - * list somewhere. If we check for the group, we cause pain, agony and - * suffering for people who decide to re-arrange their buddy list elsewhere. - */ - if (!found) { - if ((remote_user == NULL) || !(remote_user->list_op & MSN_LIST_FL_OP)) { - /* The user is not on the server list */ - msn_show_sync_issue(session, buddy_name, group_name); - } else { - /* The user is not in that group on the server list */ - to_remove = g_list_prepend(to_remove, buddy); - } - } - } - } - - if (to_remove != NULL) { - g_list_foreach(to_remove, (GFunc)purple_blist_remove_buddy, NULL); - g_list_free(to_remove); - } -} - -void -msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info) -{ - PurpleConnection *gc; - PurpleConnectionError reason; - char *msg; - - if (session->destroying) - return; - - gc = purple_account_get_connection(session->account); - - switch (error) - { - case MSN_ERROR_SERVCONN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(info); - break; - case MSN_ERROR_UNSUPPORTED_PROTOCOL: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Our protocol is not supported by the " - "server")); - break; - case MSN_ERROR_HTTP_MALFORMED: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Error parsing HTTP")); - break; - case MSN_ERROR_SIGN_OTHER: - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - msg = g_strdup(_("You have signed on from another location")); - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); - break; - case MSN_ERROR_SERV_UNAVAILABLE: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are temporarily " - "unavailable. Please wait and try " - "again.")); - break; - case MSN_ERROR_SERV_DOWN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are going down " - "temporarily")); - break; - case MSN_ERROR_AUTH: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - msg = g_strdup_printf(_("Unable to authenticate: %s"), - (info == NULL ) ? - _("Unknown error") : info); - break; - case MSN_ERROR_BAD_BLIST: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Your MSN buddy list is temporarily " - "unavailable. Please wait and try " - "again.")); - break; - default: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Unknown error")); - break; - } - - msn_session_disconnect(session); - - purple_connection_error_reason(gc, reason, msg); - - g_free(msg); -} - -static const char * -get_login_step_text(MsnSession *session) -{ - const char *steps_text[] = { - _("Connecting"), - _("Handshaking"), - _("Transferring"), - _("Handshaking"), - _("Starting authentication"), - _("Getting cookie"), - _("Authenticating"), - _("Sending cookie"), - _("Retrieving buddy list") - }; - - return steps_text[session->login_step]; -} - -void -msn_session_set_login_step(MsnSession *session, MsnLoginStep step) -{ - PurpleConnection *gc; - - /* Prevent the connection progress going backwards, eg. if we get - * transferred several times during login */ - if (session->login_step > step) - return; - - /* If we're already logged in, we're probably here because of a - * mid-session XFR from the notification server, so we don't want to - * popup the connection progress dialog */ - if (session->logged_in) - return; - - gc = session->account->gc; - - session->login_step = step; - - purple_connection_update_progress(gc, get_login_step_text(session), step, - MSN_LOGIN_STEPS); -} - -void -msn_session_finish_login(MsnSession *session) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurpleStoredImage *img; - - if (!session->logged_in) { - account = session->account; - gc = purple_account_get_connection(account); - - img = purple_buddy_icons_find_account_icon(session->account); - /* TODO: Do we really want to call this if img is NULL? */ - msn_user_set_buddy_icon(session->user, img); - if (img != NULL) - purple_imgstore_unref(img); - - session->logged_in = TRUE; - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Sync users */ - msn_session_sync_users(session); - } - - msn_change_status(session); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,234 +0,0 @@ -/** - * @file session.h MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SESSION_H -#define MSN_SESSION_H - -typedef struct _MsnSession MsnSession; - -/** - * Types of errors. - */ -typedef enum -{ - MSN_ERROR_SERVCONN, - MSN_ERROR_UNSUPPORTED_PROTOCOL, - MSN_ERROR_HTTP_MALFORMED, - MSN_ERROR_AUTH, - MSN_ERROR_BAD_BLIST, - MSN_ERROR_SIGN_OTHER, - MSN_ERROR_SERV_DOWN, - MSN_ERROR_SERV_UNAVAILABLE -} MsnErrorType; - -/** - * Login steps. - */ -typedef enum -{ - MSN_LOGIN_STEP_START, - MSN_LOGIN_STEP_HANDSHAKE, - MSN_LOGIN_STEP_TRANSFER, - MSN_LOGIN_STEP_HANDSHAKE2, - MSN_LOGIN_STEP_AUTH_START, - MSN_LOGIN_STEP_GET_COOKIE, - MSN_LOGIN_STEP_AUTH_END, - MSN_LOGIN_STEP_SYN, - MSN_LOGIN_STEP_END -} MsnLoginStep; - -#define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END - -#include "group.h" -#include "httpconn.h" -#include "nexus.h" -#include "notification.h" -#include "oim.h" -#include "slpcall.h" -#include "sslconn.h" -#include "switchboard.h" -#include "sync.h" -#include "user.h" -#include "userlist.h" - -struct _MsnSession -{ - PurpleAccount *account; - MsnUser *user; - - guint protocol_ver; - - MsnLoginStep login_step; /**< The current step in the login process. */ - - gboolean connected; - gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ - int adl_fqy; /**< A count of ADL/FQY so status is only changed once. */ - gboolean destroying; /**< A flag that states if the session is being destroyed. */ - gboolean http_method; - - MsnNotification *notification; - MsnNexus *nexus; - MsnOim *oim; - MsnSync *sync; - MsnUserList *userlist; - char *abch_cachekey; - - int servconns_count; /**< The count of server connections. */ - GList *switches; /**< The list of all the switchboards. */ - GList *slplinks; /**< The list of all the slplinks. */ - - /*psm info*/ - char *psm; - -#if 0 - char *blocked_text; -#endif - - struct - { - char *kv; - char *sid; - char *mspauth; - unsigned long sl; - char *client_ip; - int client_port; - char *mail_url; - gulong mail_timestamp; - gboolean email_enabled; - } passport_info; - - GHashTable *soap_table; - guint soap_cleanup_handle; -}; - -/** - * Creates an MSN session. - * - * @param account The account. - * - * @return The new MSN session. - */ -MsnSession *msn_session_new(PurpleAccount *account); - -/** - * Destroys an MSN session. - * - * @param session The MSN session to destroy. - */ -void msn_session_destroy(MsnSession *session); - -/** - * Connects to and initiates an MSN session. - * - * @param session The MSN session. - * @param host The dispatch server host. - * @param port The dispatch server port. - * @param http_method Whether to use or not http_method. - * - * @return @c TRUE on success, @c FALSE on failure. - */ -gboolean msn_session_connect(MsnSession *session, - const char *host, int port, - gboolean http_method); - -/** - * Disconnects from an MSN session. - * - * @param session The MSN session. - */ -void msn_session_disconnect(MsnSession *session); - - /** - * Finds a switchboard with the given username. - * - * @param session The MSN session. - * @param username The username to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, - const char *username); - - /** - * Finds a switchboard with the given conversation. - * - * @param session The MSN session. - * @param conv The conversation to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, - PurpleConversation *conv); -/** - * Finds a switchboard with the given chat ID. - * - * @param session The MSN session. - * @param chat_id The chat ID to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, - int chat_id); - -/** - * Returns a switchboard to communicate with certain username. - * - * @param session The MSN session. - * @param username The username to search for. - * @param flag The flag of the switchboard - * - * @return The switchboard. - */ -MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, - const char *username, MsnSBFlag flag); - -/** - * Sets an error for the MSN session. - * - * @param session The MSN session. - * @param error The error. - * @param info Extra information. - */ -void msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info); - -/** - * Sets the current step in the login proccess. - * - * @param session The MSN session. - * @param step The current step. - */ -void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); - -/** - * Finish the login proccess. - * - * @param session The MSN session. - */ -void msn_session_finish_login(MsnSession *session); - -/*post message to User*/ -void msn_session_report_user(MsnSession *session,const char *passport, - const char *msg,PurpleMessageFlags flags); - -#endif /* MSN_SESSION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1234 +0,0 @@ -/** - * @file msnslp.c MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slp.h" -#include "slpcall.h" -#include "slpmsg.h" - -#include "object.h" -#include "user.h" -#include "switchboard.h" - -#include "smiley.h" - -/* ms to delay between sending buddy icon requests to the server. */ -#define BUDDY_ICON_DELAY 20 - -static void send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -static void send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -static void request_user_display(MsnUser *user); - -/************************************************************************** - * Util - **************************************************************************/ - -static char * -get_token(const char *str, const char *start, const char *end) -{ - const char *c, *c2; - - if ((c = strstr(str, start)) == NULL) - return NULL; - - c += strlen(start); - - if (end != NULL) - { - if ((c2 = strstr(c, end)) == NULL) - return NULL; - - return g_strndup(c, c2 - c); - } - else - { - /* This has to be changed */ - return g_strdup(c); - } - -} - -/************************************************************************** - * Xfer - **************************************************************************/ - -static void -msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - /* MsnSlpLink *slplink; */ - char *content; - - purple_debug_info("msn", "xfer_init\n"); - - slpcall = xfer->data; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_send_queued_slpmsgs(slpcall->slplink); -} - -void -msn_xfer_cancel(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *content; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - - slpcall = xfer->data; - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) - { - if (slpcall->started) - { - msn_slpcall_close(slpcall); - } - else - { - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_send_queued_slpmsgs(slpcall->slplink); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) - slpcall->wasted = TRUE; - else - msn_slpcall_destroy(slpcall); - } - } -} - -gssize -msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - - g_return_val_if_fail(xfer != NULL, -1); - g_return_val_if_fail(data != NULL, -1); - g_return_val_if_fail(len > 0, -1); - - g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND, -1); - - slpcall = xfer->data; - /* Not sure I trust it'll be there */ - g_return_val_if_fail(slpcall != NULL, -1); - - g_return_val_if_fail(slpcall->xfer_msg != NULL, -1); - - slpcall->u.outgoing.len = len; - slpcall->u.outgoing.data = data; - msn_slplink_send_msgpart(slpcall->slplink, slpcall->xfer_msg); - return MIN(1202, len); -} - -gssize -msn_xfer_read(guchar **data, PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - gsize len; - - g_return_val_if_fail(xfer != NULL, -1); - g_return_val_if_fail(data != NULL, -1); - - g_return_val_if_fail(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE, -1); - - slpcall = xfer->data; - /* Not sure I trust it'll be there */ - g_return_val_if_fail(slpcall != NULL, -1); - - /* Just pass up the whole GByteArray. We'll make another. */ - *data = slpcall->u.incoming_data->data; - len = slpcall->u.incoming_data->len; - - g_byte_array_free(slpcall->u.incoming_data, FALSE); - slpcall->u.incoming_data = g_byte_array_new(); - - return len; -} - -void -msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session) -{ - if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL)) - { - purple_xfer_cancel_remote(slpcall->xfer); - } -} - -void -msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body, - gsize size) -{ - PurpleXfer *xfer = slpcall->xfer; - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); -} - -/************************************************************************** - * SLP Control - **************************************************************************/ - -#if 0 -static void -got_transresp(MsnSlpCall *slpcall, const char *nonce, - const char *ips_str, int port) -{ - MsnDirectConn *directconn; - char **ip_addrs, **c; - - directconn = msn_directconn_new(slpcall->slplink); - - directconn->initial_call = slpcall; - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - ip_addrs = g_strsplit(ips_str, " ", -1); - - for (c = ip_addrs; *c != NULL; c++) - { - purple_debug_info("msn", "ip_addr = %s\n", *c); - if (msn_directconn_connect(directconn, *c, port)) - break; - } - - g_strfreev(ip_addrs); -} -#endif - -static void -send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 200 OK */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 200 OK", - branch, type, content); - - slpmsg->info = "SLP 200 OK"; - slpmsg->text_body = TRUE; - - msn_slplink_queue_slpmsg(slplink, slpmsg); - - msn_slpcall_session_init(slpcall); -} - -static void -send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 603 Decline */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 603 Decline", - branch, type, content); - - slpmsg->info = "SLP 603 Decline"; - slpmsg->text_body = TRUE; - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -/* XXX: this could be improved if we tracked custom smileys - * per-protocol, per-account, per-session or (ideally) per-conversation - */ -static PurpleStoredImage * -find_valid_emoticon(PurpleAccount *account, const char *path) -{ - GList *smileys; - - if (!purple_account_get_bool(account, "custom_smileys", TRUE)) - return NULL; - - smileys = purple_smileys_get_all(); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - PurpleSmiley *smiley; - PurpleStoredImage *img; - - smiley = smileys->data; - img = purple_smiley_get_stored_image(smiley); - - if (purple_strequal(path, purple_imgstore_get_filename(img))) { - g_list_free(smileys); - return img; - } - - purple_imgstore_unref(img); - } - - purple_debug_error("msn", "Received illegal request for file %s\n", path); - return NULL; -} - -#define MAX_FILE_NAME_LEN 0x226 - -static void -got_sessionreq(MsnSlpCall *slpcall, const char *branch, - const char *euf_guid, const char *context) -{ - gboolean accepted = FALSE; - - if (!strcmp(euf_guid, MSN_OBJ_GUID)) - { - /* Emoticon or UserDisplay */ - char *content; - gsize len; - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - MsnObject *obj; - char *msnobj_data; - PurpleStoredImage *img = NULL; - int type; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - - slplink = slpcall->slplink; - - msnobj_data = (char *)purple_base64_decode(context, &len); - obj = msn_object_new_from_string(msnobj_data); - type = msn_object_get_type(obj); - g_free(msnobj_data); - if (type == MSN_OBJECT_EMOTICON) { - img = find_valid_emoticon(slplink->session->account, obj->location); - } else if (type == MSN_OBJECT_USERTILE) { - img = msn_object_get_image(obj); - if (img) - purple_imgstore_ref(img); - } - msn_object_destroy(obj); - - if (img != NULL) { - /* DATA PREP */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->session_id = slpcall->session_id; - msn_slpmsg_set_body(slpmsg, NULL, 4); - slpmsg->info = "SLP DATA PREP"; - msn_slplink_queue_slpmsg(slplink, slpmsg); - - /* DATA */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->flags = 0x20; - slpmsg->info = "SLP DATA"; - msn_slpmsg_set_image(slpmsg, img); - msn_slplink_queue_slpmsg(slplink, slpmsg); - purple_imgstore_unref(img); - - accepted = TRUE; - - } else { - purple_debug_error("msn", "Wrong object.\n"); - } - } - - else if (!strcmp(euf_guid, MSN_FT_GUID)) - { - /* File Transfer */ - PurpleAccount *account; - PurpleXfer *xfer; - char *bin; - gsize bin_len; - guint32 file_size; - char *file_name; - - account = slpcall->slplink->session->account; - - slpcall->end_cb = msn_xfer_end_cb; - slpcall->branch = g_strdup(branch); - - slpcall->pending = TRUE; - - xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, - slpcall->slplink->remote_user); - if (xfer) - { - bin = (char *)purple_base64_decode(context, &bin_len); - file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8)); - - file_name = g_convert(bin + 20, MAX_FILE_NAME_LEN, "UTF-8", "UTF-16LE", - NULL, NULL, NULL); - - g_free(bin); - - purple_xfer_set_filename(xfer, file_name ? file_name : ""); - g_free(file_name); - purple_xfer_set_size(xfer, file_size); - purple_xfer_set_init_fnc(xfer, msn_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); - purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); - purple_xfer_set_read_fnc(xfer, msn_xfer_read); - purple_xfer_set_write_fnc(xfer, msn_xfer_write); - - slpcall->u.incoming_data = g_byte_array_new(); - - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - xfer->data = slpcall; - - purple_xfer_request(xfer); - } - - accepted = TRUE; - - } else if (!strcmp(euf_guid, MSN_CAM_REQUEST_GUID)) { - purple_debug_info("msn", "Cam request.\n"); - if (slpcall && slpcall->slplink && - slpcall->slplink->session) { - PurpleConversation *conv; - gchar *from = slpcall->slplink->remote_user; - conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, from, - slpcall->slplink->session->account); - if (conv) { - char *buf; - buf = g_strdup_printf( - _("%s requests to view your " - "webcam, but this request is " - "not yet supported."), from); - purple_conversation_write(conv, NULL, buf, - PURPLE_MESSAGE_SYSTEM | - PURPLE_MESSAGE_NOTIFY, - time(NULL)); - g_free(buf); - } - } - - } else if (!strcmp(euf_guid, MSN_CAM_GUID)) { - purple_debug_info("msn", "Cam invite.\n"); - if (slpcall && slpcall->slplink && - slpcall->slplink->session) { - PurpleConversation *conv; - gchar *from = slpcall->slplink->remote_user; - conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, from, - slpcall->slplink->session->account); - if (conv) { - char *buf; - buf = g_strdup_printf( - _("%s invited you to view his/her webcam, but " - "this is not yet supported."), from); - purple_conversation_write(conv, NULL, buf, - PURPLE_MESSAGE_SYSTEM | - PURPLE_MESSAGE_NOTIFY, - time(NULL)); - g_free(buf); - } - } - - } else - purple_debug_warning("msn", "SLP SessionReq with unknown EUF-GUID: %s\n", euf_guid); - - if (!accepted) { - char *content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - send_decline(slpcall, branch, "application/x-msnmsgr-sessionreqbody", content); - g_free(content); - } -} - -void -send_bye(MsnSlpCall *slpcall, const char *type) -{ - MsnSlpLink *slplink; - PurpleAccount *account; - MsnSlpMessage *slpmsg; - char *header; - - slplink = slpcall->slplink; - - g_return_if_fail(slplink != NULL); - - account = slplink->session->account; - - header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0", - purple_account_get_username(account)); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, - "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32", - type, - "\r\n"); - g_free(header); - - slpmsg->info = "SLP BYE"; - slpmsg->text_body = TRUE; - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -static void -got_invite(MsnSlpCall *slpcall, - const char *branch, const char *type, const char *content) -{ - MsnSlpLink *slplink; - - slplink = slpcall->slplink; - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { - char *euf_guid, *context; - char *temp; - - euf_guid = get_token(content, "EUF-GUID: {", "}\r\n"); - - temp = get_token(content, "SessionID: ", "\r\n"); - if (temp != NULL) - slpcall->session_id = atoi(temp); - g_free(temp); - - temp = get_token(content, "AppID: ", "\r\n"); - if (temp != NULL) - slpcall->app_id = atoi(temp); - g_free(temp); - - context = get_token(content, "Context: ", "\r\n"); - - if (context != NULL) - got_sessionreq(slpcall, branch, euf_guid, context); - - g_free(context); - g_free(euf_guid); - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* A direct connection? */ - - char *listening, *nonce; - char *content; - - if (FALSE) - { -#if 0 - MsnDirectConn *directconn; - /* const char *ip_addr; */ - char *ip_port; - int port; - - /* ip_addr = purple_prefs_get_string("/purple/ft/public_ip"); */ - ip_port = "5190"; - listening = "true"; - nonce = rand_guid(); - - directconn = msn_directconn_new(slplink); - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - msn_directconn_listen(directconn); - - port = directconn->port; - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "Ipv4Internal-Addrs: 192.168.0.82\r\n" - "Ipv4Internal-Port: %d\r\n" - "\r\n", - listening, - nonce, - port); -#endif - } - else - { - listening = "false"; - nonce = g_strdup("00000000-0000-0000-0000-000000000000"); - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "\r\n", - listening, - nonce); - } - - send_ok(slpcall, branch, - "application/x-msnmsgr-transrespbody", content); - - g_free(content); - g_free(nonce); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - if (ip_addrs == NULL) - return; - - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -static void -got_ok(MsnSlpCall *slpcall, - const char *type, const char *content) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(type != NULL); - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { -#if 0 - if (slpcall->type == MSN_SLPCALL_DC) - { - /* First let's try a DirectConnection. */ - - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - char *branch; - - slplink = slpcall->slplink; - - branch = rand_guid(); - - content = g_strdup_printf( - "Bridges: TRUDPv1 TCPv1\r\n" - "NetID: 0\r\n" - "Conn-Type: Direct-Connect\r\n" - "UPnPNat: false\r\n" - "ICF: false\r\n" - ); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch, - "application/x-msnmsgr-transreqbody", - content); - - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); - - g_free(branch); - } - else - { - msn_slpcall_session_init(slpcall); - } -#else - msn_slpcall_session_init(slpcall); -#endif - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* Do we get this? */ - purple_debug_info("msn", "OK with transreqbody\n"); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - if (ip_addrs == NULL) - return; - - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -MsnSlpCall * -msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) -{ - MsnSlpCall *slpcall; - - if (body == NULL) - { - purple_debug_warning("msn", "received bogus message\n"); - return NULL; - } - - if (!strncmp(body, "INVITE", strlen("INVITE"))) - { - char *branch; - char *call_id; - char *content; - char *content_type; - - /* From: */ -#if 0 - slpcall->remote_user = get_token(body, "From: \r\n"); -#endif - - branch = get_token(body, ";branch={", "}"); - - call_id = get_token(body, "Call-ID: {", "}"); - -#if 0 - long content_len = -1; - - temp = get_token(body, "Content-Length: ", "\r\n"); - if (temp != NULL) - content_len = atoi(temp); - g_free(temp); -#endif - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - if (branch && call_id && content_type && content) - { - slpcall = msn_slpcall_new(slplink); - slpcall->id = call_id; - got_invite(slpcall, branch, content_type, content); - } - else - { - g_free(call_id); - slpcall = NULL; - } - - g_free(branch); - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 "))) - { - char *content; - char *content_type; - /* Make sure this is "OK" */ - const char *status = body + strlen("MSNSLP/1.0 "); - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - g_return_val_if_fail(slpcall != NULL, NULL); - - if (strncmp(status, "200 OK", 6)) - { - /* It's not valid. Kill this off. */ - char temp[32]; - const char *c; - - /* Eww */ - if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) || - (c = strchr(status, '\0'))) - { - size_t offset = c - status; - if (offset >= sizeof(temp)) - offset = sizeof(temp) - 1; - - strncpy(temp, status, offset); - temp[offset] = '\0'; - } - - purple_debug_error("msn", "Received non-OK result: %s\n", temp); - - slpcall->wasted = TRUE; - - /* msn_slpcall_destroy(slpcall); */ - return slpcall; - } - - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - got_ok(slpcall, content_type, content); - - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "BYE", strlen("BYE"))) - { - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - if (slpcall != NULL) - slpcall->wasted = TRUE; - - /* msn_slpcall_destroy(slpcall); */ - } - else - slpcall = NULL; - - return slpcall; -} - -/************************************************************************** - * Msg Callbacks - **************************************************************************/ - -void -msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - - session = cmdproc->servconn->session; - slplink = msn_session_get_slplink(session, msg->remote_user); - - if (slplink->swboard == NULL) - { - /* - * We will need swboard in order to change its flags. If its - * NULL, something has probably gone wrong earlier on. I - * didn't want to do this, but MSN 7 is somehow causing us - * to crash here, I couldn't reproduce it to debug more, - * and people are reporting bugs. Hopefully this doesn't - * cause more crashes. Stu. - */ - if (cmdproc->data == NULL) - g_warning("msn_p2p_msg cmdproc->data was NULL\n"); - else { - slplink->swboard = (MsnSwitchBoard *)cmdproc->data; - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - } - - msn_slplink_process_msg(slplink, msg); -} - -static void -got_emoticon(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - PurpleConversation *conv; - MsnSwitchBoard *swboard; - - swboard = slpcall->slplink->swboard; - conv = swboard->conv; - - if (conv) { - /* FIXME: it would be better if we wrote the data as we received it - instead of all at once, calling write multiple times and - close once at the very end - */ - purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); - purple_conv_custom_smiley_close(conv, slpcall->data_info ); - } - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); -} - -void -msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - MsnSwitchBoard *swboard; - MsnObject *obj; - char **tokens; - char *smile, *body_str; - const char *body, *who, *sha1; - guint tok; - size_t body_len; - - PurpleConversation *conv; - - session = cmdproc->servconn->session; - - if (!purple_account_get_bool(session->account, "custom_smileys", TRUE)) - return; - - swboard = cmdproc->data; - conv = swboard->conv; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - - /* MSN Messenger 7 may send more than one MSNObject in a single message... - * Maybe 10 tokens is a reasonable max value. */ - tokens = g_strsplit(body_str, "\t", 10); - - g_free(body_str); - - for (tok = 0; tok < 9; tok += 2) { - if (tokens[tok] == NULL || tokens[tok + 1] == NULL) { - break; - } - - smile = tokens[tok]; - obj = msn_object_new_from_string(purple_url_decode(tokens[tok + 1])); - - if (obj == NULL) - break; - - who = msn_object_get_creator(obj); - sha1 = msn_object_get_sha1(obj); - - slplink = msn_session_get_slplink(session, who); - if (slplink->swboard != swboard) { - if (slplink->swboard != NULL) - /* - * Apparently we're using a different switchboard now or - * something? I don't know if this is normal, but it - * definitely happens. So make sure the old switchboard - * doesn't still have a reference to us. - */ - slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); - slplink->swboard = swboard; - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - - /* If the conversation doesn't exist then this is a custom smiley - * used in the first message in a MSN conversation: we need to create - * the conversation now, otherwise the custom smiley won't be shown. - * This happens because every GtkIMHtml has its own smiley tree: if - * the conversation doesn't exist then we cannot associate the new - * smiley with its GtkIMHtml widget. */ - if (!conv) { - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, who); - } - - if (purple_conv_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) { - msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); - } - - msn_object_destroy(obj); - obj = NULL; - who = NULL; - sha1 = NULL; - } - g_strfreev(tokens); -} - -static gboolean -buddy_icon_cached(PurpleConnection *gc, MsnObject *obj) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - const char *old; - const char *new; - - g_return_val_if_fail(obj != NULL, FALSE); - - account = purple_connection_get_account(gc); - - buddy = purple_find_buddy(account, msn_object_get_creator(obj)); - if (buddy == NULL) - return FALSE; - - old = purple_buddy_icons_get_checksum_for_user(buddy); - new = msn_object_get_sha1(obj); - - if (new == NULL) - return FALSE; - - /* If the old and new checksums are the same, and the file actually exists, - * then return TRUE */ - if (old != NULL && !strcmp(old, new)) - return TRUE; - - return FALSE; -} - -static void -msn_release_buddy_icon_request(MsnUserList *userlist) -{ - MsnUser *user; - - g_return_if_fail(userlist != NULL); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Releasing buddy icon request\n"); - - if (userlist->buddy_icon_window > 0) - { - GQueue *queue; - PurpleAccount *account; - const char *username; - - queue = userlist->buddy_icon_requests; - - if (g_queue_is_empty(userlist->buddy_icon_requests)) - return; - - user = g_queue_pop_head(queue); - - account = userlist->session->account; - username = user->passport; - - userlist->buddy_icon_window--; - request_user_display(user); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", - "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", - userlist->buddy_icon_window); - } -} - -/* - * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next - * buddy icon request if there is one. - */ -static gboolean -msn_release_buddy_icon_request_timeout(gpointer data) -{ - MsnUserList *userlist = (MsnUserList *)data; - - /* Free one window slot */ - userlist->buddy_icon_window++; - - /* Clear the tag for our former request timer */ - userlist->buddy_icon_request_timer = 0; - - msn_release_buddy_icon_request(userlist); - - return FALSE; -} - -void -msn_queue_buddy_icon_request(MsnUser *user) -{ - PurpleAccount *account; - MsnObject *obj; - GQueue *queue; - - g_return_if_fail(user != NULL); - - account = user->userlist->session->account; - - obj = msn_user_get_object(user); - - if (obj == NULL) - { - purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); - return; - } - - if (!buddy_icon_cached(account->gc, obj)) - { - MsnUserList *userlist; - - userlist = user->userlist; - queue = userlist->buddy_icon_requests; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", - user->passport, userlist->buddy_icon_window); - - g_queue_push_tail(queue, user); - - if (userlist->buddy_icon_window > 0) - msn_release_buddy_icon_request(userlist); - } -} - -static void -got_user_display(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - MsnUserList *userlist; - const char *info; - PurpleAccount *account; - - g_return_if_fail(slpcall != NULL); - - info = slpcall->data_info; - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); - - userlist = slpcall->slplink->session->userlist; - account = slpcall->slplink->session->account; - - purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, - g_memdup(data, size), size, info); - -#if 0 - /* Free one window slot */ - userlist->buddy_icon_window++; - - purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n", - userlist->buddy_icon_window); - - msn_release_buddy_icon_request(userlist); -#endif -} - -static void -end_user_display(MsnSlpCall *slpcall, MsnSession *session) -{ - MsnUserList *userlist; - - g_return_if_fail(session != NULL); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "End User Display\n"); - - userlist = session->userlist; - - /* If the session is being destroyed we better stop doing anything. */ - if (session->destroying) - return; - - /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. - * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will - * send us an error 800 like so: - * - * C: NS 000: XFR 21 SB - * S: NS 000: 800 21 - */ - if (userlist->buddy_icon_request_timer) { - /* Free the window slot used by this previous request */ - userlist->buddy_icon_window++; - - /* Clear our pending timeout */ - purple_timeout_remove(userlist->buddy_icon_request_timer); - } - - /* Wait BUDDY_ICON_DELAY s before freeing our window slot and requesting the next icon. */ - userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, - msn_release_buddy_icon_request_timeout, userlist); -} - -static void -request_user_display(MsnUser *user) -{ - PurpleAccount *account; - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *info; - - session = user->userlist->session; - account = session->account; - - slplink = msn_session_get_slplink(session, user->passport); - - obj = msn_user_get_object(user); - - info = msn_object_get_sha1(obj); - - if (g_ascii_strcasecmp(user->passport, - purple_account_get_username(account))) - { - msn_slplink_request_object(slplink, info, got_user_display, - end_user_display, obj); - } - else - { - MsnObject *my_obj = NULL; - gconstpointer data = NULL; - size_t len = 0; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "Requesting our own user display\n"); - - my_obj = msn_user_get_object(session->user); - - if (my_obj != NULL) - { - PurpleStoredImage *img = msn_object_get_image(my_obj); - data = purple_imgstore_get_data(img); - len = purple_imgstore_get_size(img); - } - - purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info); - - /* Free one window slot */ - session->userlist->buddy_icon_window++; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "request_user_display(): buddy_icon_window++ yields =%d\n", - session->userlist->buddy_icon_window); - - msn_release_buddy_icon_request(session->userlist); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,302 +0,0 @@ -/** - * @file slpcall.c SLP Call Functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msnutils.h" -#include "slpcall.h" - -#include "slp.h" - -/************************************************************************** - * Main - **************************************************************************/ - -static gboolean -msn_slpcall_timeout(gpointer data) -{ - MsnSlpCall *slpcall; - - slpcall = data; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); - - if (!slpcall->pending && !slpcall->progress) - { - msn_slpcall_destroy(slpcall); - return TRUE; - } - - slpcall->progress = FALSE; - - return TRUE; -} - -MsnSlpCall * -msn_slpcall_new(MsnSlpLink *slplink) -{ - MsnSlpCall *slpcall; - - g_return_val_if_fail(slplink != NULL, NULL); - - slpcall = g_new0(MsnSlpCall, 1); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); - - slpcall->slplink = slplink; - - msn_slplink_add_slpcall(slplink, slpcall); - - slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slpcall_timeout, slpcall); - - return slpcall; -} - -void -msn_slpcall_destroy(MsnSlpCall *slpcall) -{ - GList *e; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); - - g_return_if_fail(slpcall != NULL); - - if (slpcall->timer) - purple_timeout_remove(slpcall->timer); - - for (e = slpcall->slplink->slp_msgs; e != NULL; ) - { - MsnSlpMessage *slpmsg = e->data; - e = e->next; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", - slpmsg); - - if (slpmsg->slpcall == slpcall) - { - msn_slpmsg_destroy(slpmsg); - } - } - - if (slpcall->end_cb != NULL) - slpcall->end_cb(slpcall, slpcall->slplink->session); - - if (slpcall->xfer != NULL) { - if (purple_xfer_get_type(slpcall->xfer) == PURPLE_XFER_RECEIVE) - g_byte_array_free(slpcall->u.incoming_data, TRUE); - slpcall->xfer->data = NULL; - purple_xfer_unref(slpcall->xfer); - } - - - msn_slplink_remove_slpcall(slpcall->slplink, slpcall); - - g_free(slpcall->id); - g_free(slpcall->branch); - g_free(slpcall->data_info); - - g_free(slpcall); -} - -void -msn_slpcall_init(MsnSlpCall *slpcall, MsnSlpCallType type) -{ - slpcall->session_id = rand() % 0xFFFFFF00 + 4; - slpcall->id = rand_guid(); - slpcall->type = type; -} - -void -msn_slpcall_session_init(MsnSlpCall *slpcall) -{ - if (slpcall->session_init_cb) - slpcall->session_init_cb(slpcall); - - slpcall->started = TRUE; -} - -void -msn_slpcall_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - - g_return_if_fail(slpcall != NULL); - g_return_if_fail(context != NULL); - - slplink = slpcall->slplink; - - slpcall->branch = rand_guid(); - - content = g_strdup_printf( - "EUF-GUID: {%s}\r\n" - "SessionID: %lu\r\n" - "AppID: %d\r\n" - "Context: %s\r\n\r\n", - euf_guid, - slpcall->session_id, - app_id, - context); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, - "application/x-msnmsgr-sessionreqbody", content); - - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; - - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); -} - -void -msn_slpcall_close(MsnSlpCall *slpcall) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(slpcall->slplink != NULL); - - send_bye(slpcall, "application/x-msnmsgr-sessionclosebody"); - msn_slplink_send_queued_slpmsgs(slpcall->slplink); - msn_slpcall_destroy(slpcall); -} - -MsnSlpCall * -msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnSlpCall *slpcall; - const guchar *body; - gsize body_len; - - slpcall = NULL; - body = slpmsg->buffer; - body_len = slpmsg->offset; - - if (slpmsg->flags == 0x0 || slpmsg->flags == 0x1000000) - { - char *body_str; - - if (slpmsg->session_id == 64) - { - /* This is for handwritten messages (Ink) */ - GError *error = NULL; - gsize bytes_read, bytes_written; - - body_str = g_convert((const gchar *)body, body_len / 2, - "UTF-8", "UTF-16LE", - &bytes_read, &bytes_written, &error); - body_len -= bytes_read + 2; - body += bytes_read + 2; - if (body_str == NULL - || body_len <= 0 - || strstr(body_str, "image/gif") == NULL) - { - if (error != NULL) { - purple_debug_error("msn", - "Unable to convert Ink header from UTF-16 to UTF-8: %s\n", - error->message); - g_error_free(error); - } - else - purple_debug_error("msn", - "Received Ink in unknown format\n"); - g_free(body_str); - return NULL; - } - g_free(body_str); - - body_str = g_convert((const gchar *)body, body_len / 2, - "UTF-8", "UTF-16LE", - &bytes_read, &bytes_written, &error); - if (!body_str) - { - if (error != NULL) { - purple_debug_error("msn", - "Unable to convert Ink body from UTF-16 to UTF-8: %s\n", - error->message); - g_error_free(error); - } - else - purple_debug_error("msn", - "Received Ink in unknown format\n"); - return NULL; - } - - msn_switchboard_show_ink(slpmsg->slplink->swboard, - slplink->remote_user, - body_str); - } - else - { - body_str = g_strndup((const char *)body, body_len); - slpcall = msn_slp_sip_recv(slplink, body_str); - } - g_free(body_str); - } - else if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) - { - slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpcall != NULL) - { - if (slpcall->timer) { - purple_timeout_remove(slpcall->timer); - slpcall->timer = 0; - } - - if (slpcall->cb) - slpcall->cb(slpcall, body, body_len); - - slpcall->wasted = TRUE; - } - } -#if 0 - else if (slpmsg->flags == 0x100) - { - slpcall = slplink->directconn->initial_call; - - if (slpcall != NULL) - msn_slpcall_session_init(slpcall); - } -#endif - else if (slpmsg->flags == 0x2) - { - /* Acknowledgement of previous message. Don't do anything currently. */ - } - else - purple_debug_warning("msn", "Unprocessed SLP message with flags 0x%08lx\n", - slpmsg->flags); - - return slpcall; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpcall.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/** - * @file slpcall.h SLP Call functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SLPCALL_H -#define MSN_SLPCALL_H - -typedef struct _MsnSlpCall MsnSlpCall; - -typedef enum -{ - MSN_SLPCALL_ANY, - MSN_SLPCALL_DC -} MsnSlpCallType; - -#include "internal.h" - -#include "ft.h" - -#include "slplink.h" - -/* The official client seems to timeout slp calls after 5 minutes */ -#define MSN_SLPCALL_TIMEOUT 300 - -struct _MsnSlpCall -{ - /* Our parent slplink */ - MsnSlpLink *slplink; - - MsnSlpCallType type; - - /* Call-ID */ - char *id; - char *branch; - - long session_id; - long app_id; - - gboolean pending; /**< A flag that states if we should wait for this - slpcall to start and do not time out. */ - gboolean progress; /**< A flag that states if there has been progress since - the last time out. */ - gboolean wasted; /**< A flag that states if this slpcall is going to be - destroyed. */ - gboolean started; /**< A flag that states if this slpcall's session has - been initiated. */ - - void (*progress_cb)(MsnSlpCall *slpcall, - gsize total_length, gsize len, gsize offset); - void (*session_init_cb)(MsnSlpCall *slpcall); - - /* Can be checksum, or smile */ - char *data_info; - - PurpleXfer *xfer; - union { - GByteArray *incoming_data; - struct { - gsize len; - const guchar *data; - } outgoing; - } u; - MsnSlpMessage *xfer_msg; /* A dirty hack */ - - MsnSlpCb cb; - void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session); - - guint timer; -}; - -MsnSlpCall *msn_slpcall_new(MsnSlpLink *slplink); -void msn_slpcall_init(MsnSlpCall *slpcall, MsnSlpCallType type); -void msn_slpcall_session_init(MsnSlpCall *slpcall); -void msn_slpcall_destroy(MsnSlpCall *slpcall); -void msn_slpcall_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context); -void msn_slpcall_close(MsnSlpCall *slpcall); - -#endif /* MSN_SLPCALL_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/** - * @file slp.h MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SLP_H -#define MSN_SLP_H - -#include "internal.h" - -#include "ft.h" -#include "session.h" -#include "slpcall.h" - -MsnSlpCall * msn_slp_sip_recv(MsnSlpLink *slplink, - const char *body); - -void send_bye(MsnSlpCall *slpcall, const char *type); - -void msn_xfer_completed_cb(MsnSlpCall *slpcall, - const guchar *body, gsize size); - -void msn_xfer_cancel(PurpleXfer *xfer); -gssize msn_xfer_write(const guchar *data, gsize len, PurpleXfer *xfer); -gssize msn_xfer_read(guchar **data, PurpleXfer *xfer); - -void msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session); - -void msn_queue_buddy_icon_request(MsnUser *user); - -#endif /* MSN_SLP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,798 +0,0 @@ -/** - * @file slplink.c MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slplink.h" - -#include "switchboard.h" -#include "slp.h" - -#ifdef MSN_DEBUG_SLP_FILES -static int m_sc = 0; -static int m_rc = 0; - -static void -debug_msg_to_file(MsnMessage *msg, gboolean send) -{ - char *tmp; - char *dir; - char *pload; - int c; - gsize pload_size; - - dir = send ? "send" : "recv"; - c = send ? m_sc++ : m_rc++; - tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c); - pload = msn_message_gen_payload(msg, &pload_size); - if (!purple_util_write_data_to_file_absolute(tmp, pload, pload_size)) - { - purple_debug_error("msn", "could not save debug file\n"); - } - g_free(tmp); -} -#endif - -/************************************************************************** - * Main - **************************************************************************/ - -static MsnSlpLink * -msn_slplink_new(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - - slplink = g_new0(MsnSlpLink, 1); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); - - slplink->session = session; - slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; - - slplink->remote_user = g_strdup(username); - - slplink->slp_msg_queue = g_queue_new(); - - session->slplinks = - g_list_append(session->slplinks, slplink); - - return slplink; -} - -void -msn_slplink_destroy(MsnSlpLink *slplink) -{ - MsnSession *session; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); - - g_return_if_fail(slplink != NULL); - - if (slplink->swboard != NULL) - slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); - - session = slplink->session; - -#if 0 - if (slplink->directconn != NULL) - msn_directconn_destroy(slplink->directconn); -#endif - - while (slplink->slp_calls != NULL) - msn_slpcall_destroy(slplink->slp_calls->data); - - g_queue_free(slplink->slp_msg_queue); - - session->slplinks = - g_list_remove(session->slplinks, slplink); - - g_free(slplink->remote_user); - - g_free(slplink); -} - -MsnSlpLink * -msn_session_find_slplink(MsnSession *session, const char *who) -{ - GList *l; - - for (l = session->slplinks; l != NULL; l = l->next) - { - MsnSlpLink *slplink; - - slplink = l->data; - - if (!strcmp(slplink->remote_user, who)) - return slplink; - } - - return NULL; -} - -MsnSlpLink * -msn_session_get_slplink(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - slplink = msn_session_find_slplink(session, username); - - if (slplink == NULL) - slplink = msn_slplink_new(session, username); - - return slplink; -} - -void -msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - if (slplink->swboard != NULL) - slplink->swboard->flag |= MSN_SB_FLAG_FT; - - slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); -} - -void -msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall); - - /* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT. - * If nothing else is using it then this might cause swboard to be - * destroyed. */ - if (slplink->slp_calls == NULL && slplink->swboard != NULL) - msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT); -} - -MsnSlpCall * -msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id) -{ - GList *l; - MsnSlpCall *slpcall; - - if (!id) - return NULL; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->id && !strcmp(slpcall->id, id)) - return slpcall; - } - - return NULL; -} - -MsnSlpCall * -msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id) -{ - GList *l; - MsnSlpCall *slpcall; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->session_id == id) - return slpcall; - } - - return NULL; -} - -static void -msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ -#if 0 - if (slplink->directconn != NULL) - { - msn_directconn_send_msg(slplink->directconn, msg); - } - else -#endif - { - if (slplink->swboard == NULL) - { - slplink->swboard = msn_session_get_swboard(slplink->session, - slplink->remote_user, MSN_SB_FLAG_FT); - - g_return_if_fail(slplink->swboard != NULL); - - /* If swboard is destroyed we will be too */ - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - - msn_switchboard_send_msg(slplink->swboard, msg, TRUE); - } -} - -void -msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - long long real_size; - size_t len = 0; - - /* Maybe we will want to create a new msg for this slpmsg instead of - * reusing the same one all the time. */ - msg = slpmsg->msg; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - if (slpmsg->offset < real_size) - { - if (slpmsg->slpcall && slpmsg->slpcall->xfer && purple_xfer_get_type(slpmsg->slpcall->xfer) == PURPLE_XFER_SEND && - purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) - { - len = MIN(1202, slpmsg->slpcall->u.outgoing.len); - msn_message_set_bin_data(msg, slpmsg->slpcall->u.outgoing.data, len); - } - else - { - len = slpmsg->size - slpmsg->offset; - - if (len > 1202) - len = 1202; - - msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len); - } - - msg->msnslp_header.offset = slpmsg->offset; - msg->msnslp_header.length = len; - } - - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, TRUE); -#endif - - slpmsg->msgs = - g_list_append(slpmsg->msgs, msg); - msn_slplink_send_msg(slplink, msg); - - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, slpmsg->offset); - } - } - - /* slpmsg->offset += len; */ -} - -/* We have received the message ack */ -static void -msg_ack(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - long long real_size; - - slpmsg = data; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - slpmsg->offset += msg->msnslp_header.length; - - if (slpmsg->offset < real_size) - { - if (slpmsg->slpcall->xfer && purple_xfer_get_status(slpmsg->slpcall->xfer) == PURPLE_XFER_STATUS_STARTED) - { - slpmsg->slpcall->xfer_msg = slpmsg; - purple_xfer_prpl_ready(slpmsg->slpcall->xfer); - } - else - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - } - else - { - /* The whole message has been sent */ - if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) - { - if (slpmsg->slpcall != NULL) - { - if (slpmsg->slpcall->cb) - slpmsg->slpcall->cb(slpmsg->slpcall, - NULL, 0); - } - } - } - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -/* We have received the message nak. */ -static void -msg_nak(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - - slpmsg = data; - - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -static void -msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - - slpmsg->msg = msg = msn_message_new_msnslp(); - - if (slpmsg->flags == 0x0) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x2) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - } - else if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) - { - MsnSlpCall *slpcall; - slpcall = slpmsg->slpcall; - - g_return_if_fail(slpcall != NULL); - msg->msnslp_header.session_id = slpcall->session_id; - msg->msnslp_footer.value = slpcall->app_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x100) - { - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - } - - msg->msnslp_header.id = slpmsg->id; - msg->msnslp_header.flags = slpmsg->flags; - - msg->msnslp_header.total_size = slpmsg->size; - - msn_message_set_attr(msg, "P2P-Dest", slplink->remote_user); - - msg->ack_cb = msg_ack; - msg->nak_cb = msg_nak; - msg->ack_data = slpmsg; - - msn_slplink_send_msgpart(slplink, slpmsg); - - msn_message_destroy(msg); -} - -void -msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - g_return_if_fail(slpmsg != NULL); - - slpmsg->id = slplink->slp_seq_id++; - - g_queue_push_tail(slplink->slp_msg_queue, slpmsg); -} - -void -msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - slpmsg->id = slplink->slp_seq_id++; - - msn_slplink_release_slpmsg(slplink, slpmsg); -} - -void -msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - /* Send the queued msgs in the order they were created */ - while ((slpmsg = g_queue_pop_head(slplink->slp_msg_queue)) != NULL) - { - msn_slplink_release_slpmsg(slplink, slpmsg); - } -} - -static void -msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - - slpmsg = msn_slpmsg_new(slplink); - - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = 0x02; - slpmsg->ack_id = msg->msnslp_header.id; - slpmsg->ack_sub_id = msg->msnslp_header.ack_id; - slpmsg->ack_size = msg->msnslp_header.total_size; - slpmsg->info = "SLP ACK"; - - msn_slplink_send_slpmsg(slplink, slpmsg); - msn_slpmsg_destroy(slpmsg); -} - -static void -send_file_cb(MsnSlpCall *slpcall) -{ - MsnSlpMessage *slpmsg; - PurpleXfer *xfer; - - xfer = (PurpleXfer *)slpcall->xfer; - purple_xfer_ref(xfer); - purple_xfer_start(xfer, -1, NULL, 0); - if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_STARTED) { - purple_xfer_unref(xfer); - return; - } - purple_xfer_unref(xfer); - - slpmsg = msn_slpmsg_new(slpcall->slplink); - slpmsg->slpcall = slpcall; - slpmsg->flags = 0x1000030; - slpmsg->info = "SLP FILE"; - slpmsg->size = purple_xfer_get_size(xfer); - - msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); -} - -static MsnSlpMessage * -msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) -{ - GList *e; - - for (e = slplink->slp_msgs; e != NULL; e = e->next) - { - MsnSlpMessage *slpmsg = e->data; - - if ((slpmsg->session_id == session_id) && (slpmsg->id == id)) - return slpmsg; - } - - return NULL; -} - -void -msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - const char *data; - guint64 offset; - gsize len; - PurpleXfer *xfer = NULL; - - if (purple_debug_is_verbose()) - msn_slpmsg_show(msg); - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, FALSE); -#endif - - if (msg->msnslp_header.total_size < msg->msnslp_header.length) - { - purple_debug_error("msn", "This can't be good\n"); - g_return_if_reached(); - } - - data = msn_message_get_bin_data(msg, &len); - - offset = msg->msnslp_header.offset; - - if (offset == 0) - { - slpmsg = msn_slpmsg_new(slplink); - slpmsg->id = msg->msnslp_header.id; - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = msg->msnslp_header.flags; - - if (slpmsg->session_id) - { - if (slpmsg->slpcall == NULL) - slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpmsg->slpcall != NULL) - { - if (slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) - { - xfer = slpmsg->slpcall->xfer; - if (xfer != NULL) - { - slpmsg->ft = TRUE; - slpmsg->slpcall->xfer_msg = slpmsg; - - purple_xfer_ref(xfer); - purple_xfer_start(xfer, -1, NULL, 0); - - if (xfer->data == NULL) { - purple_xfer_unref(xfer); - msn_slpmsg_destroy(slpmsg); - g_return_if_reached(); - } else { - purple_xfer_unref(xfer); - } - } - } - } - } - if (!slpmsg->ft && slpmsg->size) - { - slpmsg->buffer = g_try_malloc(slpmsg->size); - if (slpmsg->buffer == NULL) - { - purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); - msn_slpmsg_destroy(slpmsg); - return; - } - } - } - else - { - slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.session_id, msg->msnslp_header.id); - if (slpmsg == NULL) - { - /* Probably the transfer was canceled */ - purple_debug_error("msn", "Couldn't find slpmsg\n"); - return; - } - } - - if (slpmsg->ft) - { - xfer = slpmsg->slpcall->xfer; - slpmsg->slpcall->u.incoming_data = - g_byte_array_append(slpmsg->slpcall->u.incoming_data, (const guchar *)data, len); - purple_xfer_prpl_ready(xfer); - } - else if (slpmsg->size && slpmsg->buffer) - { - if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size || slpmsg->offset != offset) - { - purple_debug_error("msn", - "Oversized slpmsg - msgsize=%lld offset=%" G_GUINT64_FORMAT " len=%" G_GSIZE_FORMAT "\n", - slpmsg->size, offset, len); - g_return_if_reached(); - } else { - memcpy(slpmsg->buffer + offset, data, len); - slpmsg->offset += len; - } - } - - if ((slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000020 || slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, offset); - } - } - -#if 0 - if (slpmsg->buffer == NULL) - return; -#endif - - if (msg->msnslp_header.offset + msg->msnslp_header.length - >= msg->msnslp_header.total_size) - { - /* All the pieces of the slpmsg have been received */ - MsnSlpCall *slpcall; - - slpcall = msn_slp_process_msg(slplink, slpmsg); - - if (slpcall == NULL) { - msn_slpmsg_destroy(slpmsg); - return; - } - - if (!slpcall->wasted) { - if (slpmsg->flags == 0x100) - { - MsnDirectConn *directconn; - - directconn = slplink->directconn; -#if 0 - if (!directconn->acked) - msn_directconn_send_handshake(directconn); -#endif - } - else if (slpmsg->flags == 0x00 || slpmsg->flags == 0x1000000 || - slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || - slpmsg->flags == 0x1000030) - { - /* Release all the messages and send the ACK */ - - msn_slplink_send_ack(slplink, msg); - msn_slplink_send_queued_slpmsgs(slplink); - } - - } - - msn_slpmsg_destroy(slpmsg); - - if (slpcall->wasted) - msn_slpcall_destroy(slpcall); - } -} - -typedef struct -{ - guint32 length; - guint32 unk1; - guint32 file_size; - guint32 unk2; - guint32 unk3; -} MsnContextHeader; - -#define MAX_FILE_NAME_LEN 0x226 - -static gchar * -gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path) -{ - gsize size = 0; - MsnContextHeader header; - gchar *u8 = NULL; - guchar *base; - guchar *n; - gchar *ret; - gunichar2 *uni = NULL; - glong currentChar = 0; - glong uni_len = 0; - gsize len; - - size = purple_xfer_get_size(xfer); - - if(!file_name) { - gchar *basename = g_path_get_basename(file_path); - u8 = purple_utf8_try_convert(basename); - g_free(basename); - file_name = u8; - } - - uni = g_utf8_to_utf16(file_name, -1, NULL, &uni_len, NULL); - - if(u8) { - g_free(u8); - file_name = NULL; - u8 = NULL; - } - - len = sizeof(MsnContextHeader) + MAX_FILE_NAME_LEN + 4; - - header.length = GUINT32_TO_LE(len); - header.unk1 = GUINT32_TO_LE(2); - header.file_size = GUINT32_TO_LE(size); - header.unk2 = GUINT32_TO_LE(0); - header.unk3 = GUINT32_TO_LE(0); - - base = g_malloc(len + 1); - n = base; - - memcpy(n, &header, sizeof(MsnContextHeader)); - n += sizeof(MsnContextHeader); - - memset(n, 0x00, MAX_FILE_NAME_LEN); - for(currentChar = 0; currentChar < uni_len; currentChar++) { - *((gunichar2 *)n + currentChar) = GUINT16_TO_LE(uni[currentChar]); - } - n += MAX_FILE_NAME_LEN; - - memset(n, 0xFF, 4); - n += 4; - - g_free(uni); - ret = purple_base64_encode(base, len); - g_free(base); - return ret; -} - -void -msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *context; - const char *fn; - const char *fp; - - fn = purple_xfer_get_filename(xfer); - fp = purple_xfer_get_local_filename(xfer); - - g_return_if_fail(slplink != NULL); - g_return_if_fail(fp != NULL); - - slpcall = msn_slpcall_new(slplink); - msn_slpcall_init(slpcall, MSN_SLPCALL_DC); - - slpcall->session_init_cb = send_file_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->cb = msn_xfer_completed_cb; - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - slpcall->pending = TRUE; - - purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); - purple_xfer_set_read_fnc(xfer, msn_xfer_read); - purple_xfer_set_write_fnc(xfer, msn_xfer_write); - - xfer->data = slpcall; - - context = gen_context(xfer, fn, fp); - - msn_slpcall_invite(slpcall, MSN_FT_GUID, 2, context); - - g_free(context); -} - -void -msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj) -{ - MsnSlpCall *slpcall; - char *msnobj_data; - char *msnobj_base64; - - g_return_if_fail(slplink != NULL); - g_return_if_fail(obj != NULL); - - msnobj_data = msn_object_to_string(obj); - msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); - g_free(msnobj_data); - - slpcall = msn_slpcall_new(slplink); - msn_slpcall_init(slpcall, MSN_SLPCALL_ANY); - - slpcall->data_info = g_strdup(info); - slpcall->cb = cb; - slpcall->end_cb = end_cb; - - msn_slpcall_invite(slpcall, MSN_OBJ_GUID, 1, msnobj_base64); - - g_free(msnobj_base64); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slplink.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/** - * @file slplink.h MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SLPLINK_H -#define MSN_SLPLINK_H - -typedef struct _MsnSlpLink MsnSlpLink; - -#include "ft.h" - -#include "directconn.h" -#include "session.h" -#include "slpcall.h" -#include "slpmsg.h" -#include "switchboard.h" - -typedef void (*MsnSlpCb)(MsnSlpCall *slpcall, - const guchar *data, gsize size); -typedef void (*MsnSlpEndCb)(MsnSlpCall *slpcall, MsnSession *session); - -struct _MsnSlpLink -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - char *remote_user; - - int slp_seq_id; - - MsnDirectConn *directconn; - - GList *slp_calls; - GList *slp_msgs; - - GQueue *slp_msg_queue; -}; - -void msn_slplink_destroy(MsnSlpLink *slplink); - -/** - * @return An MsnSlpLink for the given user, or NULL if there is no - * existing MsnSlpLink. - */ -MsnSlpLink *msn_session_find_slplink(MsnSession *session, - const char *who); - -/** - * @return An MsnSlpLink for the given user. One will be created if - * it does not already exist. - */ -MsnSlpLink *msn_session_get_slplink(MsnSession *session, const char *username); - -void msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -void msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink, - const char *id); -MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id); -void msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); -void msn_slplink_send_slpmsg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_send_queued_slpmsgs(MsnSlpLink *slplink); -void msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg); -void msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer); - -/* Only exported for msn_xfer_write */ -void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -void msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj); - -MsnSlpCall *msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -#endif /* MSN_SLPLINK_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,208 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slpmsg.h" -#include "slplink.h" - -/************************************************************************** - * SLP Message - **************************************************************************/ - -MsnSlpMessage * -msn_slpmsg_new(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - slpmsg = g_new0(MsnSlpMessage, 1); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); - - slpmsg->slplink = slplink; - - slplink->slp_msgs = - g_list_append(slplink->slp_msgs, slpmsg); - - return slpmsg; -} - -void -msn_slpmsg_destroy(MsnSlpMessage *slpmsg) -{ - MsnSlpLink *slplink; - GList *cur; - - g_return_if_fail(slpmsg != NULL); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); - - slplink = slpmsg->slplink; - - purple_imgstore_unref(slpmsg->img); - - /* We don't want to free the data of the PurpleStoredImage, - * but to avoid code duplication, it's sharing buffer. */ - if (slpmsg->img == NULL) - g_free(slpmsg->buffer); - - for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) - { - /* Something is pointing to this slpmsg, so we should remove that - * pointer to prevent a crash. */ - /* Ex: a user goes offline and after that we receive an ACK */ - - MsnMessage *msg = cur->data; - - msg->ack_cb = NULL; - msg->nak_cb = NULL; - msg->ack_data = NULL; - } - g_list_free(slpmsg->msgs); - - slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); - - g_free(slpmsg); -} - -void -msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->ft == FALSE); - - if (body != NULL) - slpmsg->buffer = g_memdup(body, size); - else - slpmsg->buffer = g_new0(guchar, size); - - slpmsg->size = size; -} - -void -msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->ft == FALSE); - - slpmsg->img = purple_imgstore_ref(img); - slpmsg->buffer = (guchar *)purple_imgstore_get_data(img); - slpmsg->size = purple_imgstore_get_size(img); -} - -void -msn_slpmsg_show(MsnMessage *msg) -{ - const char *info; - gboolean text; - guint32 flags; - - text = FALSE; - - flags = GUINT32_TO_LE(msg->msnslp_header.flags); - - switch (flags) - { - case 0x0: - info = "SLP CONTROL"; - text = TRUE; - break; - case 0x2: - info = "SLP ACK"; break; - case 0x20: - case 0x1000030: - info = "SLP DATA"; break; - default: - info = "SLP UNKNOWN"; break; - } - - msn_message_show_readable(msg, info, text); -} - -MsnSlpMessage * -msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, const char *branch, - const char *content_type, const char *content) -{ - MsnSlpLink *slplink; - PurpleAccount *account; - MsnSlpMessage *slpmsg; - char *body; - gsize body_len; - gsize content_len; - - g_return_val_if_fail(slpcall != NULL, NULL); - g_return_val_if_fail(header != NULL, NULL); - - slplink = slpcall->slplink; - account = slplink->session->account; - - /* Let's remember that "content" should end with a 0x00 */ - - content_len = (content != NULL) ? strlen(content) + 1 : 0; - - body = g_strdup_printf( - "%s\r\n" - "To: \r\n" - "From: \r\n" - "Via: MSNSLP/1.0/TLP ;branch={%s}\r\n" - "CSeq: %d\r\n" - "Call-ID: {%s}\r\n" - "Max-Forwards: 0\r\n" - "Content-Type: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "\r\n", - header, - slplink->remote_user, - purple_account_get_username(account), - branch, - cseq, - slpcall->id, - content_type, - content_len); - - body_len = strlen(body); - - if (content_len > 0) - { - body_len += content_len; - body = g_realloc(body, body_len); - g_strlcat(body, content, body_len); - } - - slpmsg = msn_slpmsg_new(slplink); - msn_slpmsg_set_body(slpmsg, body, body_len); - - slpmsg->sip = TRUE; - slpmsg->slpcall = slpcall; - - g_free(body); - - return slpmsg; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/slpmsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPMSG_H_ -#define _MSN_SLPMSG_H_ - -typedef struct _MsnSlpMessage MsnSlpMessage; - -#include "imgstore.h" - -#include "slpcall.h" -#include "slplink.h" -#include "session.h" -#include "msg.h" - -#include "slp.h" - -/** - * A SLP Message This contains everything that we will need to send a SLP - * Message even if has to be sent in several parts. - */ -struct _MsnSlpMessage -{ - MsnSlpCall *slpcall; /**< The slpcall to which this slp message belongs (if applicable). */ - MsnSlpLink *slplink; /**< The slplink through which this slp message is being sent. */ - MsnSession *session; - - long session_id; - long id; - long ack_id; - long ack_sub_id; - long long ack_size; - - gboolean sip; /**< A flag that states if this is a SIP slp message. */ - long flags; - - gboolean ft; - PurpleStoredImage *img; - guchar *buffer; - - /** - * For outgoing messages this is the number of bytes from buffer that - * have already been sent out. For incoming messages this is the - * number of bytes that have been written to buffer. - */ - long long offset; - - /** - * This is the size of buffer, unless this is an outgoing file transfer, - * in which case this is the size of the file. - */ - long long size; - - GList *msgs; /**< The real messages. */ - -#if 1 - MsnMessage *msg; /**< The temporary real message that will be sent. */ -#endif - - const char *info; - gboolean text_body; -}; - -/** - * Creates a new slp message - * - * @param slplink The slplink through which this slp message will be sent. - * @return The created slp message. - */ -MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink); - -/** - * Destroys a slp message - * - * @param slpmsg The slp message to destory. - */ -void msn_slpmsg_destroy(MsnSlpMessage *slpmsg); - -void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size); -void msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img); -void msn_slpmsg_open_file(MsnSlpMessage *slpmsg, - const char *file_name); -MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, - const char *branch, - const char *content_type, - const char *content); - -void msn_slpmsg_show(MsnMessage *msg); - -#endif /* _MSN_SLPMSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,691 +0,0 @@ -/** - * @file soap.c - * Functions relating to SOAP connections. - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "internal.h" - -#include "soap.h" - -#include "session.h" - -#include "debug.h" -#include "xmlnode.h" - -#include -#if !defined(_WIN32) || !defined(_WINERROR_) -#include -#endif - -#define SOAP_TIMEOUT (5 * 60) - -typedef struct _MsnSoapRequest { - char *path; - MsnSoapMessage *message; - gboolean secure; - MsnSoapCallback cb; - gpointer cb_data; -} MsnSoapRequest; - -typedef struct _MsnSoapConnection { - MsnSession *session; - char *host; - - time_t last_used; - PurpleSslConnection *ssl; - gboolean connected; - - guint event_handle; - guint run_timer; - GString *buf; - gsize handled_len; - gsize body_len; - int response_code; - gboolean headers_done; - gboolean close_when_done; - - MsnSoapMessage *message; - - GQueue *queue; - MsnSoapRequest *current_request; - gboolean unsafe_debug; -} MsnSoapConnection; - -static gboolean msn_soap_connection_run(gpointer data); - -static MsnSoapConnection * -msn_soap_connection_new(MsnSession *session, const char *host) -{ - MsnSoapConnection *conn = g_new0(MsnSoapConnection, 1); - conn->session = session; - conn->host = g_strdup(host); - conn->queue = g_queue_new(); - conn->unsafe_debug = purple_debug_is_unsafe(); - return conn; -} - -static void -msn_soap_message_destroy(MsnSoapMessage *message) -{ - g_slist_foreach(message->headers, (GFunc)g_free, NULL); - g_slist_free(message->headers); - g_free(message->action); - if (message->xml) - xmlnode_free(message->xml); - g_free(message); -} - -static void -msn_soap_request_destroy(MsnSoapRequest *req, gboolean keep_message) -{ - g_free(req->path); - if (!keep_message) - msn_soap_message_destroy(req->message); - g_free(req); -} - -static void -msn_soap_connection_sanitize(MsnSoapConnection *conn, gboolean disconnect) -{ - if (conn->event_handle) { - purple_input_remove(conn->event_handle); - conn->event_handle = 0; - } - - if (conn->run_timer) { - purple_timeout_remove(conn->run_timer); - conn->run_timer = 0; - } - - if (conn->message) { - msn_soap_message_destroy(conn->message); - conn->message = NULL; - } - - if (conn->buf) { - g_string_free(conn->buf, TRUE); - conn->buf = NULL; - } - - if (conn->ssl && (disconnect || conn->close_when_done)) { - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - } - - if (conn->current_request) { - msn_soap_request_destroy(conn->current_request, FALSE); - conn->current_request = NULL; - } -} - -static void -msn_soap_connection_destroy_foreach_cb(gpointer item, gpointer data) -{ - MsnSoapRequest *req = item; - - if (req->cb) - req->cb(req->message, NULL, req->cb_data); - - msn_soap_request_destroy(req, FALSE); -} - -static void -msn_soap_connection_destroy(MsnSoapConnection *conn) -{ - if (conn->current_request) { - MsnSoapRequest *req = conn->current_request; - conn->current_request = NULL; - msn_soap_connection_destroy_foreach_cb(req, conn); - } - - msn_soap_connection_sanitize(conn, TRUE); - g_queue_foreach(conn->queue, msn_soap_connection_destroy_foreach_cb, conn); - g_queue_free(conn->queue); - - g_free(conn->host); - g_free(conn); -} - -static gboolean -msn_soap_cleanup_each(gpointer key, gpointer value, gpointer data) -{ - MsnSoapConnection *conn = value; - time_t *t = data; - - if ((*t - conn->last_used) > SOAP_TIMEOUT * 2) { - purple_debug_info("soap", "cleaning up soap conn %p\n", conn); - return TRUE; - } - - return FALSE; -} - -static gboolean -msn_soap_cleanup_for_session(gpointer data) -{ - MsnSession *sess = data; - time_t t = time(NULL); - - purple_debug_info("soap", "session cleanup timeout\n"); - - if (sess->soap_table) { - g_hash_table_foreach_remove(sess->soap_table, msn_soap_cleanup_each, - &t); - - if (g_hash_table_size(sess->soap_table) != 0) - return TRUE; - } - - sess->soap_cleanup_handle = 0; - return FALSE; -} - -static MsnSoapConnection * -msn_soap_get_connection(MsnSession *session, const char *host) -{ - MsnSoapConnection *conn = NULL; - - if (session->soap_table) { - conn = g_hash_table_lookup(session->soap_table, host); - } else { - session->soap_table = g_hash_table_new_full(g_str_hash, g_str_equal, - NULL, (GDestroyNotify)msn_soap_connection_destroy); - } - - if (session->soap_cleanup_handle == 0) - session->soap_cleanup_handle = purple_timeout_add_seconds(SOAP_TIMEOUT, - msn_soap_cleanup_for_session, session); - - if (conn == NULL) { - conn = msn_soap_connection_new(session, host); - g_hash_table_insert(session->soap_table, conn->host, conn); - } - - conn->last_used = time(NULL); - - return conn; -} - -static void -msn_soap_connection_handle_next(MsnSoapConnection *conn) -{ - msn_soap_connection_sanitize(conn, FALSE); - - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn); - - if (conn->current_request) { - MsnSoapRequest *req = conn->current_request; - conn->current_request = NULL; - msn_soap_connection_destroy_foreach_cb(req, conn); - } -} - -static void -msn_soap_message_send_internal(MsnSession *session, MsnSoapMessage *message, - const char *host, const char *path, gboolean secure, - MsnSoapCallback cb, gpointer cb_data, gboolean first) -{ - MsnSoapConnection *conn = msn_soap_get_connection(session, host); - MsnSoapRequest *req = g_new0(MsnSoapRequest, 1); - - req->path = g_strdup(path); - req->message = message; - req->secure = secure; - req->cb = cb; - req->cb_data = cb_data; - - if (first) { - g_queue_push_head(conn->queue, req); - } else { - g_queue_push_tail(conn->queue, req); - } - - if (conn->run_timer == 0) - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, - conn); -} - -void -msn_soap_message_send(MsnSession *session, MsnSoapMessage *message, - const char *host, const char *path, gboolean secure, - MsnSoapCallback cb, gpointer cb_data) -{ - g_return_if_fail(message != NULL); - - msn_soap_message_send_internal(session, message, host, path, secure, - cb, cb_data, FALSE); -} - -static gboolean -msn_soap_handle_redirect(MsnSoapConnection *conn, const char *url) -{ - char *host; - char *path; - - if (purple_url_parse(url, &host, NULL, &path, NULL, NULL)) { - msn_soap_message_send_internal(conn->session, conn->current_request->message, - host, path, conn->current_request->secure, - conn->current_request->cb, conn->current_request->cb_data, TRUE); - - msn_soap_request_destroy(conn->current_request, TRUE); - conn->current_request = NULL; - - g_free(host); - g_free(path); - - return TRUE; - } - - return FALSE; -} - -static gboolean -msn_soap_handle_body(MsnSoapConnection *conn, MsnSoapMessage *response) -{ - xmlnode *body = xmlnode_get_child(response->xml, "Body"); - xmlnode *fault = xmlnode_get_child(response->xml, "Fault"); - - if (fault) { - xmlnode *faultcode = xmlnode_get_child(fault, "faultcode"); - - if (faultcode != NULL) { - char *faultdata = xmlnode_get_data(faultcode); - - if (g_str_equal(faultdata, "psf:Redirect")) { - xmlnode *url = xmlnode_get_child(fault, "redirectUrl"); - - if (url) { - char *urldata = xmlnode_get_data(url); - msn_soap_handle_redirect(conn, urldata); - g_free(urldata); - } - - g_free(faultdata); - msn_soap_message_destroy(response); - return TRUE; - } else if (g_str_equal(faultdata, "wsse:FailedAuthentication")) { - xmlnode *reason = xmlnode_get_child(fault, "faultstring"); - char *reasondata = xmlnode_get_data(reason); - - msn_soap_connection_sanitize(conn, TRUE); - msn_session_set_error(conn->session, MSN_ERROR_AUTH, - reasondata); - - g_free(reasondata); - g_free(faultdata); - msn_soap_message_destroy(response); - return FALSE; - } - - g_free(faultdata); - } - } - - if (fault || body) { - if (conn->current_request) { - MsnSoapRequest *request = conn->current_request; - conn->current_request = NULL; - request->cb(request->message, response, - request->cb_data); - msn_soap_request_destroy(request, FALSE); - } - msn_soap_message_destroy(response); - } - - return TRUE; -} - -static void -msn_soap_message_add_header(MsnSoapMessage *message, - const char *name, const char *value) -{ - char *header = g_strdup_printf("%s: %s\r\n", name, value); - - message->headers = g_slist_prepend(message->headers, header); -} - -static void -msn_soap_process(MsnSoapConnection *conn) -{ - gboolean handled = FALSE; - char *cursor; - char *linebreak; - - cursor = conn->buf->str + conn->handled_len; - - if (!conn->headers_done) { - while ((linebreak = strstr(cursor, "\r\n")) != NULL) { - conn->handled_len = linebreak - conn->buf->str + 2; - - if (conn->response_code == 0) { - if (sscanf(cursor, "HTTP/1.1 %d", &conn->response_code) != 1) { - /* something horribly wrong */ - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - msn_soap_connection_handle_next(conn); - handled = TRUE; - break; - } else if (conn->response_code == 503 && conn->session->login_step < MSN_LOGIN_STEP_END) { - msn_soap_connection_sanitize(conn, TRUE); - msn_session_set_error(conn->session, MSN_ERROR_SERV_UNAVAILABLE, NULL); - return; - } - } else if (cursor == linebreak) { - /* blank line */ - conn->headers_done = TRUE; - cursor = conn->buf->str + conn->handled_len; - break; - } else { - char *line = g_strndup(cursor, linebreak - cursor); - char *sep = strstr(line, ": "); - char *key = line; - char *value; - - if (sep == NULL) { - purple_debug_info("soap", "ignoring malformed line: %s\n", line); - g_free(line); - goto loop_end; - } - - value = sep + 2; - *sep = '\0'; - msn_soap_message_add_header(conn->message, key, value); - - if ((conn->response_code == 301 || conn->response_code == 300) - && strcmp(key, "Location") == 0) { - - msn_soap_handle_redirect(conn, value); - - handled = TRUE; - g_free(line); - break; - } else if (conn->response_code == 401 && - strcmp(key, "WWW-Authenticate") == 0) { - char *error = strstr(value, "cbtxt="); - - if (error) { - error += strlen("cbtxt="); - } - - msn_soap_connection_sanitize(conn, TRUE); - msn_session_set_error(conn->session, MSN_ERROR_AUTH, - error ? purple_url_decode(error) : NULL); - - g_free(line); - return; - } else if (strcmp(key, "Content-Length") == 0) { - sscanf(value, "%" G_GSIZE_FORMAT, &(conn->body_len)); - } else if (strcmp(key, "Connection") == 0) { - if (strcmp(value, "close") == 0) { - conn->close_when_done = TRUE; - } - } - g_free(line); - } - - loop_end: - cursor = conn->buf->str + conn->handled_len; - } - } - - if (!handled && conn->headers_done) { - if (conn->buf->len - conn->handled_len >= - conn->body_len) { - xmlnode *node = xmlnode_from_str(cursor, conn->body_len); - - if (node == NULL) { - purple_debug_info("soap", "Malformed SOAP response: %s\n", - cursor); - } else { - MsnSoapMessage *message = conn->message; - conn->message = NULL; - message->xml = node; - - if (!msn_soap_handle_body(conn, message)) { - return; - } - } - - msn_soap_connection_handle_next(conn); - } - - return; - } - - if (handled) { - msn_soap_connection_handle_next(conn); - } -} - -static void -msn_soap_read_cb(gpointer data, gint fd, PurpleInputCondition cond) -{ - MsnSoapConnection *conn = data; - int count = 0, cnt, perrno; - /* This buffer needs to be larger than any packets received from - login.live.com or Adium will fail to receive the packet - (something weird with the login.live.com server). With NSS it works - fine, so I believe it's some bug with OS X */ - char buf[16 * 1024]; - gsize cursor; - - if (conn->message == NULL) { - conn->message = msn_soap_message_new(NULL, NULL); - } - - if (conn->buf == NULL) { - conn->buf = g_string_new_len(buf, 0); - } - - cursor = conn->buf->len; - while ((cnt = purple_ssl_read(conn->ssl, buf, sizeof(buf))) > 0) { - purple_debug_info("soap", "read %d bytes\n", cnt); - count += cnt; - g_string_append_len(conn->buf, buf, cnt); - } - - perrno = errno; - if (cnt < 0 && perrno != EAGAIN) - purple_debug_info("soap", "read: %s\n", g_strerror(perrno)); - - if (conn->current_request && conn->current_request->secure && - !conn->unsafe_debug) - purple_debug_misc("soap", "Received secure request.\n"); - else if (count != 0) - purple_debug_misc("soap", "current %s\n", conn->buf->str + cursor); - - /* && count is necessary for Adium, on OS X the last read always - return an error, so we want to proceed anyway. See #5212 for - discussion on this and the above buffer size issues */ - if(cnt < 0 && errno == EAGAIN && count == 0) - return; - - /* msn_soap_process could alter errno */ - msn_soap_process(conn); - - if ((cnt < 0 && perrno != EAGAIN) || cnt == 0) { - /* It's possible msn_soap_process closed the ssl connection */ - if (conn->ssl) { - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - msn_soap_connection_handle_next(conn); - } - } -} - -static gboolean -msn_soap_write_cb_internal(gpointer data, gint fd, PurpleInputCondition cond, - gboolean initial) -{ - MsnSoapConnection *conn = data; - int written; - - if (cond != PURPLE_INPUT_WRITE) - return TRUE; - - written = purple_ssl_write(conn->ssl, conn->buf->str + conn->handled_len, - conn->buf->len - conn->handled_len); - - if (written < 0 && errno == EAGAIN) - return TRUE; - else if (written <= 0) { - purple_ssl_close(conn->ssl); - conn->ssl = NULL; - if (!initial) - msn_soap_connection_handle_next(conn); - return FALSE; - } - - conn->handled_len += written; - - if (conn->handled_len < conn->buf->len) - return TRUE; - - /* we are done! */ - g_string_free(conn->buf, TRUE); - conn->buf = NULL; - conn->handled_len = 0; - conn->body_len = 0; - conn->response_code = 0; - conn->headers_done = FALSE; - conn->close_when_done = FALSE; - - purple_input_remove(conn->event_handle); - conn->event_handle = purple_input_add(conn->ssl->fd, PURPLE_INPUT_READ, - msn_soap_read_cb, conn); - return TRUE; -} - -static void -msn_soap_write_cb(gpointer data, gint fd, PurpleInputCondition cond) -{ - msn_soap_write_cb_internal(data, fd, cond, FALSE); -} - -static void -msn_soap_error_cb(PurpleSslConnection *ssl, PurpleSslErrorType error, - gpointer data) -{ - MsnSoapConnection *conn = data; - - /* sslconn already frees the connection in case of error */ - conn->ssl = NULL; - - g_hash_table_remove(conn->session->soap_table, conn->host); -} - -static void -msn_soap_connected_cb(gpointer data, PurpleSslConnection *ssl, - PurpleInputCondition cond) -{ - MsnSoapConnection *conn = data; - - conn->connected = TRUE; - - if (conn->run_timer == 0) - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn); -} - -MsnSoapMessage * -msn_soap_message_new(const char *action, xmlnode *xml) -{ - MsnSoapMessage *message = g_new0(MsnSoapMessage, 1); - - message->action = g_strdup(action); - message->xml = xml; - - return message; -} - -static gboolean -msn_soap_connection_run(gpointer data) -{ - MsnSoapConnection *conn = data; - MsnSoapRequest *req = g_queue_peek_head(conn->queue); - - conn->run_timer = 0; - - if (req) { - if (conn->ssl == NULL) { - conn->ssl = purple_ssl_connect(conn->session->account, conn->host, - 443, msn_soap_connected_cb, msn_soap_error_cb, conn); - } else if (conn->connected) { - int len = -1; - char *body = xmlnode_to_str(req->message->xml, &len); - GSList *iter; - - g_queue_pop_head(conn->queue); - - conn->buf = g_string_new(""); - - g_string_append_printf(conn->buf, - "POST /%s HTTP/1.1\r\n" - "SOAPAction: %s\r\n" - "Content-Type:text/xml; charset=utf-8\r\n" - "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n" - "Accept: */*\r\n" - "Host: %s\r\n" - "Content-Length: %d\r\n" - "Connection: Keep-Alive\r\n" - "Cache-Control: no-cache\r\n", - req->path, req->message->action ? req->message->action : "", - conn->host, len); - - for (iter = req->message->headers; iter; iter = iter->next) { - g_string_append(conn->buf, (char *)iter->data); - g_string_append(conn->buf, "\r\n"); - } - - g_string_append(conn->buf, "\r\n"); - g_string_append(conn->buf, body); - - if (req->secure && !conn->unsafe_debug) - purple_debug_misc("soap", "Sending secure request.\n"); - else - purple_debug_misc("soap", "%s\n", conn->buf->str); - - conn->handled_len = 0; - conn->current_request = req; - - if (conn->event_handle) - purple_input_remove(conn->event_handle); - conn->event_handle = purple_input_add(conn->ssl->fd, - PURPLE_INPUT_WRITE, msn_soap_write_cb, conn); - if (!msn_soap_write_cb_internal(conn, conn->ssl->fd, PURPLE_INPUT_WRITE, TRUE)) { - /* Not connected => reconnect and retry */ - purple_debug_info("soap", "not connected, reconnecting\n"); - - conn->connected = FALSE; - conn->current_request = NULL; - msn_soap_connection_sanitize(conn, FALSE); - - g_queue_push_head(conn->queue, req); - conn->run_timer = purple_timeout_add(0, msn_soap_connection_run, conn); - } - - g_free(body); - } - } - - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/soap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/** - * @file soap.h - * header file for SOAP connection related process - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ -#ifndef MSN_SOAP_H -#define MSN_SOAP_H - -typedef struct _MsnSoapMessage MsnSoapMessage; - -#include - -#include "xmlnode.h" - -#include "session.h" -#include "sslconn.h" - -typedef void (*MsnSoapCallback)(MsnSoapMessage *request, - MsnSoapMessage *response, gpointer cb_data); - -struct _MsnSoapMessage { - char *action; - xmlnode *xml; - GSList *headers; -}; - -MsnSoapMessage *msn_soap_message_new(const char *action, xmlnode *xml); - -void msn_soap_message_send(MsnSession *session, MsnSoapMessage *message, - const char *host, const char *path, gboolean secure, - MsnSoapCallback cb, gpointer cb_data); - -#endif /* MSN_SOAP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,327 +0,0 @@ -/** - * @file state.c State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "core.h" - -#include "msn.h" -#include "state.h" - -static const char *away_text[] = -{ - N_("Available"), - N_("Available"), - N_("Busy"), - N_("Idle"), - N_("Be Right Back"), - N_("Away From Computer"), - N_("On The Phone"), - N_("Out To Lunch"), - N_("Available"), - N_("Available") -}; - -/* Local Function Prototype*/ -static char *msn_build_psm(const char *psmstr,const char *mediastr, - const char *guidstr); - -/* - * WLM media PSM info build prcedure - * - * Result can like: - * \0Music\01\0{0} - {1}\0Song Title\0Song Artist\0Song Album\0\0\ - * \0Games\01\0Playing {0}\0Game Name\0\ - * \0Office\01\0Office Message\0Office App Name\0" - */ -static char * -msn_build_psm(const char *psmstr,const char *mediastr, const char *guidstr) -{ - xmlnode *dataNode,*psmNode,*mediaNode,*guidNode; - char *result; - int length; - - dataNode = xmlnode_new("Data"); - - psmNode = xmlnode_new("PSM"); - if(psmstr != NULL){ - xmlnode_insert_data(psmNode, psmstr, -1); - } - xmlnode_insert_child(dataNode, psmNode); - - mediaNode = xmlnode_new("CurrentMedia"); - if(mediastr != NULL){ - xmlnode_insert_data(mediaNode, mediastr, -1); - } - xmlnode_insert_child(dataNode, mediaNode); - - guidNode = xmlnode_new("MachineGuid"); - if(guidstr != NULL){ - xmlnode_insert_data(guidNode, guidstr, -1); - } - xmlnode_insert_child(dataNode, guidNode); - - result = xmlnode_to_str(dataNode, &length); - xmlnode_free(dataNode); - return result; -} - -/* get the CurrentMedia info from the XML string */ -char * -msn_get_currentmedia(char *xml_str, gsize len) -{ - xmlnode *payloadNode, *currentmediaNode; - char *currentmedia; - - purple_debug_info("msn", "Get CurrentMedia\n"); - payloadNode = xmlnode_from_str(xml_str, len); - if (!payloadNode) { - purple_debug_error("msn", "PSM XML parse Error!\n"); - return NULL; - } - currentmediaNode = xmlnode_get_child(payloadNode, "CurrentMedia"); - if (currentmediaNode == NULL) { - purple_debug_info("msn", "No CurrentMedia Node\n"); - xmlnode_free(payloadNode); - return NULL; - } - currentmedia = xmlnode_get_data(currentmediaNode); - - xmlnode_free(payloadNode); - - return currentmedia; -} - -/*get the PSM info from the XML string*/ -char * -msn_get_psm(char *xml_str, gsize len) -{ - xmlnode *payloadNode, *psmNode; - char *psm; - - purple_debug_info("msn", "msn get PSM\n"); - payloadNode = xmlnode_from_str(xml_str, len); - if (!payloadNode) { - purple_debug_error("msn", "PSM XML parse Error!\n"); - return NULL; - } - psmNode = xmlnode_get_child(payloadNode, "PSM"); - if (psmNode == NULL) { - purple_debug_info("msn", "No PSM status Node\n"); - xmlnode_free(payloadNode); - return NULL; - } - psm = xmlnode_get_data(psmNode); - - xmlnode_free(payloadNode); - - return psm; -} - -static char * -create_media_string(PurplePresence *presence) -{ - const char *title, *game, *office; - char *ret; - PurpleStatus *status = purple_presence_get_status(presence, "tune"); - if (!status || !purple_status_is_active(status)) - return NULL; - - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - game = purple_status_get_attr_string(status, "game"); - office = purple_status_get_attr_string(status, "office"); - - if (title && *title) { - const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM); - ret = g_strdup_printf("WMP\\0Music\\01\\0{0}%s%s\\0%s\\0%s\\0%s\\0", - artist ? " - {1}" : "", - album ? " ({2})" : "", - title, - artist ? artist : "", - album ? album : ""); - } - else if (game && *game) - ret = g_strdup_printf("\\0Games\\01\\0Playing {0}\\0%s\\0", game); - else if (office && *office) - ret = g_strdup_printf("\\0Office\\01\\0Editing {0}\\0%s\\0", office); - else - ret = NULL; - - return ret; -} - -/* set the MSN's PSM info,Currently Read from the status Line - * Thanks for Cris Code - */ -void -msn_set_psm(MsnSession *session) -{ - PurpleAccount *account; - PurplePresence *presence; - PurpleStatus *status; - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - const char *statusline; - gchar *statusline_stripped, *media = NULL; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->notification != NULL); - - account = session->account; - cmdproc = session->notification->cmdproc; - - /* Get the PSM string from Purple's Status Line */ - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - statusline = purple_status_get_attr_string(status, "message"); - - /* MSN expects plain text, not HTML */ - statusline_stripped = purple_markup_strip_html(statusline); - media = create_media_string(presence); - g_free(session->psm); - session->psm = msn_build_psm(statusline_stripped, media, NULL); - - payload = session->psm; - purple_debug_misc("msn", "Sending UUX command with payload: %s\n", payload); - trans = msn_transaction_new(cmdproc, "UUX", "%" G_GSIZE_FORMAT, strlen(payload)); - msn_transaction_set_payload(trans, payload, strlen(payload)); - msn_cmdproc_send_trans(cmdproc, trans); - - g_free(statusline_stripped); - g_free(media); -} - -void -msn_change_status(MsnSession *session) -{ - PurpleAccount *account; - MsnCmdProc *cmdproc; - MsnUser *user; - MsnObject *msnobj; - const char *state_text; - GHashTable *ui_info = purple_core_get_ui_info(); - MsnClientCaps caps = MSN_CLIENT_ID; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->notification != NULL); - - /* set client caps based on what the UI tells us it is... */ - if (ui_info) { - const gchar *client_type = g_hash_table_lookup(ui_info, "client_type"); - if (client_type) { - if (strcmp(client_type, "phone") == 0 || - strcmp(client_type, "handheld") == 0) { - caps |= MSN_CLIENT_CAP_WIN_MOBILE; - } else if (strcmp(client_type, "web") == 0) { - caps |= MSN_CLIENT_CAP_WEBMSGR; - } else if (strcmp(client_type, "bot") == 0) { - caps |= MSN_CLIENT_CAP_BOT; - } - /* MSN doesn't a "console" type... - What, they have no ncurses UI? :-) */ - } - } - - account = session->account; - cmdproc = session->notification->cmdproc; - user = session->user; - state_text = msn_state_get_text(msn_state_from_account(account)); - - /* If we're not logged in yet, don't send the status to the server, - * it will be sent when login completes - */ - if (!session->logged_in) - return; - - msnobj = msn_user_get_object(user); - - if (msnobj == NULL) - { - msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, caps); - } - else - { - char *msnobj_str; - - msnobj_str = msn_object_to_string(msnobj); - - msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text, - caps, purple_url_encode(msnobj_str)); - - g_free(msnobj_str); - } - msn_set_psm(session); -} - -const char * -msn_away_get_text(MsnAwayType type) -{ - g_return_val_if_fail(type <= MSN_HIDDEN, NULL); - - return _(away_text[type]); -} - -const char * -msn_state_get_text(MsnAwayType state) -{ - static char *status_text[] = - { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" }; - - return status_text[state]; -} - -MsnAwayType -msn_state_from_account(PurpleAccount *account) -{ - MsnAwayType msnstatus; - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); - - if (!strcmp(status_id, "away")) - msnstatus = MSN_AWAY; - else if (!strcmp(status_id, "brb")) - msnstatus = MSN_BRB; - else if (!strcmp(status_id, "busy")) - msnstatus = MSN_BUSY; - else if (!strcmp(status_id, "phone")) - msnstatus = MSN_PHONE; - else if (!strcmp(status_id, "lunch")) - msnstatus = MSN_LUNCH; - else if (!strcmp(status_id, "invisible")) - msnstatus = MSN_HIDDEN; - else - msnstatus = MSN_ONLINE; - - if ((msnstatus == MSN_ONLINE) && purple_presence_is_idle(presence)) - msnstatus = MSN_IDLE; - - return msnstatus; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/state.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/** - * @file state.h State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_STATE_H -#define MSN_STATE_H - -/** - * Away types. - */ -typedef enum -{ - MSN_ONLINE = 1, - MSN_BUSY = 2, - MSN_IDLE = 3, - MSN_BRB = 4, - MSN_AWAY = 5, - MSN_PHONE = 6, - MSN_LUNCH = 7, - MSN_OFFLINE = 8, - MSN_HIDDEN = 9 -} MsnAwayType; - -/** - * Changes the status of the user. - * - * @param session The MSN session. - */ -void msn_change_status(MsnSession *session); - -/** - * Returns the string representation of an away type. - * - * @param type The away type. - * - * @return The string representation of the away type. - */ -const char *msn_away_get_text(MsnAwayType type); - -const char *msn_state_get_text(MsnAwayType state); - -void msn_set_psm(MsnSession *session); - -/* Get the CurrentMedia info from the XML string */ -char *msn_get_currentmedia(char *xml_str, gsize len); - -/*get the PSM info from the XML string*/ -char *msn_get_psm(char *xml_str, gsize len); - -MsnAwayType msn_state_from_account(PurpleAccount *account); - -#endif /* MSN_STATE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1296 +0,0 @@ -/** - * @file switchboard.c MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "prefs.h" -#include "switchboard.h" -#include "notification.h" -#include "msnutils.h" - -#include "error.h" - -static MsnTable *cbs_table; - -static void msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, - MsnMsgErrorType error); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSwitchBoard * -msn_switchboard_new(MsnSession *session) -{ - MsnSwitchBoard *swboard; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = g_new0(MsnSwitchBoard, 1); - - swboard->session = session; - swboard->servconn = msn_servconn_new(session, MSN_SERVCONN_SB); - msn_servconn_set_idle_timeout(swboard->servconn, 60); - swboard->cmdproc = swboard->servconn->cmdproc; - - swboard->msg_queue = g_queue_new(); - swboard->empty = TRUE; - - swboard->cmdproc->data = swboard; - swboard->cmdproc->cbs_table = cbs_table; - - session->switches = g_list_prepend(session->switches, swboard); - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "switchboard new: swboard(%p)\n", swboard); - - return swboard; -} - -void -msn_switchboard_destroy(MsnSwitchBoard *swboard) -{ - MsnSession *session; - MsnMessage *msg; - GList *l; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "switchboard destroy: swboard(%p)\n", swboard); - - g_return_if_fail(swboard != NULL); - - if (swboard->destroying) - return; - - swboard->destroying = TRUE; - - if (swboard->reconn_timeout_h > 0) - purple_timeout_remove(swboard->reconn_timeout_h); - - /* If it linked us is because its looking for trouble */ - while (swboard->slplinks != NULL) - msn_slplink_destroy(swboard->slplinks->data); - - /* Destroy the message queue */ - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - if (swboard->error != MSN_SB_ERROR_NONE) - { - /* The messages could not be sent due to a switchboard error */ - msg_error_helper(swboard->cmdproc, msg, - MSN_MSG_ERROR_SB); - } - msn_message_unref(msg); - } - - g_queue_free(swboard->msg_queue); - - /* msg_error_helper will both remove the msg from ack_list and - unref it, so we don't need to do either here */ - while ((l = swboard->ack_list) != NULL) - msg_error_helper(swboard->cmdproc, l->data, MSN_MSG_ERROR_SB); - - g_free(swboard->im_user); - g_free(swboard->auth_key); - g_free(swboard->session_id); - - for (; swboard->users; swboard->users = g_list_delete_link(swboard->users, swboard->users)) - g_free(swboard->users->data); - - session = swboard->session; - session->switches = g_list_remove(session->switches, swboard); - - for (l = session->slplinks; l; l = l->next) { - MsnSlpLink *slplink = l->data; - if (slplink->swboard == swboard) slplink->swboard = NULL; - } - -#if 0 - /* This should never happen or we are in trouble. */ - if (swboard->servconn != NULL) - msn_servconn_destroy(swboard->servconn); -#endif - - swboard->cmdproc->data = NULL; - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_servconn_destroy(swboard->servconn); - - g_free(swboard); -} - -void -msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(key != NULL); - - swboard->auth_key = g_strdup(key); -} - -const char * -msn_switchboard_get_auth_key(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->auth_key; -} - -void -msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(id != NULL); - - g_free(swboard->session_id); - swboard->session_id = g_strdup(id); -} - -const char * -msn_switchboard_get_session_id(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->session_id; -} - -int -msn_switchboard_get_chat_id(void) -{ - static int chat_id = 1; - - return chat_id++; -} - -void -msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited) -{ - g_return_if_fail(swboard != NULL); - - swboard->invited = invited; -} - -gboolean -msn_switchboard_is_invited(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - return swboard->invited; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -static void -send_clientcaps(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_CAPS); - msn_message_set_content_type(msg, "text/x-clientcaps"); - msn_message_set_flag(msg, 'U'); - msn_message_set_bin_data(msg, MSN_CLIENTINFO, strlen(MSN_CLIENTINFO)); - - msn_switchboard_send_msg(swboard, msg, TRUE); - - msn_message_destroy(msg); -} - -static void -msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnCmdProc *cmdproc; - PurpleAccount *account; - char *semicolon; - char *passport; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - account = cmdproc->session->account; - - semicolon = strchr(user, ';'); - /* We don't really care about the machine ID. */ - if (semicolon) - passport = g_strndup(user, semicolon - user); - else - passport = g_strdup(user); - - /* Don't add multiple endpoints to the conversation. */ - if (g_list_find_custom(swboard->users, passport, (GCompareFunc)strcmp)) { - g_free(passport); - return; - } - - swboard->users = g_list_prepend(swboard->users, passport); - swboard->current_users++; - swboard->empty = FALSE; - - if (purple_debug_is_verbose()) - purple_debug_info("msn", "user=[%s], total=%d\n", - user, swboard->current_users); - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - { - /* This is a helper switchboard. */ - purple_debug_error("msn", "switchboard_add_user: conv != NULL\n"); - return; - } - - if ((swboard->conv != NULL) && - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - msn_servconn_set_idle_timeout(swboard->servconn, 0); - } - else if (swboard->current_users > 1 || swboard->total_users > 1) - { - msn_servconn_set_idle_timeout(swboard->servconn, 0); - if (swboard->conv == NULL || - purple_conversation_get_type(swboard->conv) != PURPLE_CONV_TYPE_CHAT) - { - GList *l; - -#if 0 - /* this is bad - it causes msn_switchboard_close to be called on the - * switchboard we're in the middle of using :( */ - if (swboard->conv != NULL) - purple_conversation_destroy(swboard->conv); -#endif - - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->flag |= MSN_SB_FLAG_IM; - swboard->conv = serv_got_joined_chat(account->gc, - swboard->chat_id, - "MSN Chat"); - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *tmp_user; - - tmp_user = l->data; - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - tmp_user, NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - purple_account_get_username(account), - NULL, PURPLE_CBFLAGS_NONE, TRUE); - - g_free(swboard->im_user); - swboard->im_user = NULL; - } - } - else if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - user, account); - } - else - { - purple_debug_warning("msn", "switchboard_add_user: This should not happen!\n"); - } -} - -static PurpleConversation * -msn_switchboard_get_conv(MsnSwitchBoard *swboard) -{ - PurpleAccount *account; - - g_return_val_if_fail(swboard != NULL, NULL); - - if (swboard->conv != NULL) - return swboard->conv; - - purple_debug_error("msn", "Switchboard with unassigned conversation\n"); - - account = swboard->session->account; - - return (swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, - account, swboard->im_user)); -} - -static void -msn_switchboard_report_user(MsnSwitchBoard *swboard, PurpleMessageFlags flags, const char *msg) -{ - PurpleConversation *conv; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - if ((conv = msn_switchboard_get_conv(swboard)) != NULL) - { - purple_conversation_write(conv, NULL, msg, flags, time(NULL)); - } -} - -static void -swboard_error_helper(MsnSwitchBoard *swboard, int reason, const char *passport) -{ - g_return_if_fail(swboard != NULL); - - purple_debug_warning("msn", "Error: Unable to call the user %s for reason %i\n", - passport ? passport : "(null)", reason); - - /* TODO: if current_users > 0, this is probably a chat and an invite failed, - * we should report that in the chat or something */ - if (swboard->current_users == 0) - { - swboard->error = reason; - msn_switchboard_close(swboard); - } -} - -static void -cal_error_helper(MsnTransaction *trans, int reason) -{ - MsnSwitchBoard *swboard; - const char *passport; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - passport = params[0]; - - swboard = trans->data; - - purple_debug_warning("msn", "cal_error_helper: command %s failed for reason %i\n",trans->command,reason); - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static gboolean -msg_resend_cb(gpointer data) -{ - MsnSwitchBoard *swboard = data; - - purple_debug_info("msn", "unqueuing unsent message to %s\n", swboard->im_user); - - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, swboard->im_user); - swboard->reconn_timeout_h = 0; - return FALSE; -} - -static void -msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, MsnMsgErrorType error) -{ - MsnSwitchBoard *swboard; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(msg != NULL); - - if ((error != MSN_MSG_ERROR_SB) && (msg->nak_cb != NULL)) - msg->nak_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - - /* This is not good, and should be fixed somewhere else. */ - g_return_if_fail(swboard != NULL); - - if (msg->type == MSN_MSG_TEXT) - { - const char *format, *str_reason; - char *body_str, *body_enc, *pre, *post; - -#if 0 - if (swboard->conv == NULL) - { - if (msg->ack_ref) - msn_message_unref(msg); - - return; - } -#endif - - if (error == MSN_MSG_ERROR_TIMEOUT) - { - str_reason = _("Message may have not been sent " - "because a timeout occurred:"); - } - else if (error == MSN_MSG_ERROR_SB) - { - MsnSession *session = swboard->session; - - if (!session->destroying && msg->retries && swboard->im_user && - (swboard->error == MSN_SB_ERROR_CONNECTION || - swboard->error == MSN_SB_ERROR_UNKNOWN)) { - MsnSwitchBoard *new_sw = msn_session_find_swboard(session, - swboard->im_user); - - if (new_sw == NULL || new_sw->reconn_timeout_h == 0) { - new_sw = msn_switchboard_new(session); - new_sw->im_user = g_strdup(swboard->im_user); - new_sw->reconn_timeout_h = purple_timeout_add_seconds(3, msg_resend_cb, new_sw); - new_sw->flag |= MSN_SB_FLAG_IM; - } - - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - purple_debug_info("msn", "queuing unsent message to %s: %s\n", - swboard->im_user, body_enc); - g_free(body_enc); - msn_send_im_message(session, msg); - msg->retries--; - - return; - } - - switch (swboard->error) - { - case MSN_SB_ERROR_OFFLINE: - str_reason = _("Message could not be sent, " - "not allowed while invisible:"); - break; - case MSN_SB_ERROR_USER_OFFLINE: - str_reason = _("Message could not be sent " - "because the user is offline:"); - break; - case MSN_SB_ERROR_CONNECTION: - str_reason = _("Message could not be sent " - "because a connection error occurred:"); - break; - case MSN_SB_ERROR_TOO_FAST: - str_reason = _("Message could not be sent " - "because we are sending too quickly:"); - break; - case MSN_SB_ERROR_AUTHFAILED: - str_reason = _("Message could not be sent " - "because we were unable to establish a " - "session with the server. This is " - "likely a server problem, try again in " - "a few minutes:"); - break; - default: - str_reason = _("Message could not be sent " - "because an error with " - "the switchboard occurred:"); - break; - } - } - else - { - str_reason = _("Message may have not been sent " - "because an unknown error occurred:"); - } - - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_ERROR, - str_reason); - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_RAW, - body_str); - - g_free(body_str); - } - - /* If a timeout occures we will want the msg around just in case we - * receive the ACK after the timeout. */ - if (msg->ack_ref && error != MSN_MSG_ERROR_TIMEOUT) - { - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); - } -} - -/************************************************************************** - * Message Stuff - **************************************************************************/ - -/** Called when a message times out. */ -static void -msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnMessage *msg; - - msg = trans->data; - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT); -} - -/** Called when we receive an error of a message. */ -static void -msg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - msg_error_helper(cmdproc, trans->data, MSN_MSG_ERROR_UNKNOWN); -} - -#if 0 -/** Called when we receive an ack of a special message. */ -static void -msg_ack(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg->ack_data); - - msn_message_unref(msg); -} - -/** Called when we receive a nak of a special message. */ -static void -msg_nak(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - msn_message_unref(msg); -} -#endif - -static void -release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - gsize payload_len; - char flag; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - cmdproc = swboard->cmdproc; - - payload = msn_message_gen_payload(msg, &payload_len); - - if (purple_debug_is_verbose()) { - purple_debug_info("msn", "SB length:{%" G_GSIZE_FORMAT "}\n", payload_len); - msn_message_show_readable(msg, "SB SEND", FALSE); - } - - flag = msn_message_get_flag(msg); - trans = msn_transaction_new(cmdproc, "MSG", "%c %" G_GSIZE_FORMAT, - flag, payload_len); - - /* Data for callbacks */ - msn_transaction_set_data(trans, msg); - - if (flag != 'U') { - if (msg->type == MSN_MSG_TEXT) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); - } - else if (msg->type == MSN_MSG_SLP) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); -#if 0 - if (msg->ack_cb != NULL) - { - msn_transaction_add_cb(trans, "ACK", msg_ack); - msn_transaction_add_cb(trans, "NAK", msg_nak); - } -#endif - } - } - - trans->payload = payload; - trans->payload_len = payload_len; - - msg->trans = trans; - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - purple_debug_info("msn", "Appending message to queue.\n"); - - g_queue_push_tail(swboard->msg_queue, msg); - - msn_message_ref(msg); -} - -static void -process_queue(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - g_return_if_fail(swboard != NULL); - - purple_debug_info("msn", "Processing queue\n"); - - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - purple_debug_info("msn", "Sending message\n"); - release_msg(swboard, msg); - msn_message_unref(msg); - } -} - -gboolean -msn_switchboard_can_send(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - if (swboard->empty || !g_queue_is_empty(swboard->msg_queue)) - return FALSE; - - return TRUE; -} - -void -msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - purple_debug_info("msn", "switchboard send msg..\n"); - if (msn_switchboard_can_send(swboard)) - release_msg(swboard, msg); - else if (queue) - queue_msg(swboard, msg); -} - -/************************************************************************** - * Switchboard Commands - **************************************************************************/ - -static void -ans_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - swboard->ready = TRUE; -} - -static void -bye_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - user = cmd->params[0]; - - /* cmdproc->data is set to NULL when the switchboard is destroyed; - * we may get a bye shortly thereafter. */ - g_return_if_fail(swboard != NULL); - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - purple_debug_error("msn", "bye_cmd: helper bug\n"); - - if (swboard->conv == NULL) - { - /* This is a helper switchboard */ - msn_switchboard_destroy(swboard); - } - else if ((swboard->current_users > 1) || - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* This is a switchboard used for a chat */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL); - swboard->current_users--; - if (swboard->current_users == 0) - msn_switchboard_destroy(swboard); - } - else - { - /* This is a switchboard used for a im session */ - msn_switchboard_destroy(swboard); - } -} - -static void -iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - account = cmdproc->session->account; - gc = account->gc; - swboard = cmdproc->data; - - swboard->total_users = atoi(cmd->params[2]); - - msn_switchboard_add_user(swboard, cmd->params[3]); -} - -static void -joi_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - const char *passport; - - passport = cmd->params[0]; - - session = cmdproc->session; - account = session->account; - gc = account->gc; - swboard = cmdproc->data; - - msn_switchboard_add_user(swboard, passport); - - process_queue(swboard); - - if (!session->http_method) - send_clientcaps(swboard); - - if (swboard->closed) - msn_switchboard_close(swboard); -} - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len, - MSG_LINE_DEM,MSG_BODY_DEM); - if (purple_debug_is_verbose()) - msn_message_show_readable(msg, "SB RECV", FALSE); - - g_free (msg->remote_user); - msg->remote_user = g_strdup(cmd->params[0]); - - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_unref(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmd->payload_len = atoi(cmd->params[2]); - cmdproc->last_cmd->payload_cb = msg_cmd_post; -} - -static void -ubm_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - purple_debug_misc("msn", "get UBM...\n"); - cmd->payload_len = atoi(cmd->params[3]); - cmdproc->last_cmd->payload_cb = msg_cmd_post; -} - -static void -nak_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - g_return_if_fail(msg != NULL); - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_NAK); -} - -static void -ack_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - if (swboard) - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); -} - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - - if (swboard->current_users > 1) - serv_got_chat_left(gc, swboard->chat_id); - - msn_switchboard_disconnect(swboard); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - -#if 0 - GList *l; - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *user; - user = l->data; - - msn_cmdproc_send(cmdproc, "CAL", "%s", user); - } -#endif - - swboard->ready = TRUE; - msn_cmdproc_process_queue(cmdproc); -} - -/************************************************************************** - * Message Handlers - **************************************************************************/ -static void -clientcaps_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ -#if 0 - MsnSession *session; - MsnSwitchBoard *swboard; - MsnUser *user; - GHashTable *clientcaps; - const char *value; - - char *passport = msg->sender; - - session = cmdproc->session; - swboard = cmdproc->servconn->swboard; - - clientcaps = msn_message_get_hashtable_from_body(msg); -#endif -} - -void -msn_switchboard_show_ink(MsnSwitchBoard *swboard, const char *passport, - const char *data) -{ - PurpleConnection *gc; - guchar *image_data; - size_t image_len; - int imgid; - char *image_msg; - - if (!purple_str_has_prefix(data, "base64:")) - { - purple_debug_error("msn", "Ignoring Ink not in Base64 format.\n"); - return; - } - - gc = purple_account_get_connection(swboard->session->account); - - data += sizeof("base64:") - 1; - image_data = purple_base64_decode(data, &image_len); - if (!image_data || !image_len) - { - purple_debug_error("msn", "Unable to decode Ink from Base64 format.\n"); - return; - } - - imgid = purple_imgstore_add_with_id(image_data, image_len, NULL); - image_msg = g_strdup_printf("", imgid); - - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - serv_got_chat_in(gc, swboard->chat_id, passport, 0, image_msg, - time(NULL)); - else - serv_got_im(gc, passport, image_msg, 0, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - g_free(image_msg); -} - -/************************************************************************** - * Connect stuff - **************************************************************************/ -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error); - -static void -connect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - MsnTransaction *trans; - MsnCmdProc *cmdproc; - PurpleAccount *account; - - cmdproc = servconn->cmdproc; - g_return_if_fail(cmdproc != NULL); - - account = cmdproc->session->account; - swboard = cmdproc->data; - g_return_if_fail(swboard != NULL); - - if (msn_switchboard_is_invited(swboard)) - { - swboard->empty = FALSE; - - trans = msn_transaction_new(cmdproc, "ANS", "%s %s %s", - purple_account_get_username(account), - swboard->auth_key, swboard->session_id); - } - else - { - trans = msn_transaction_new(cmdproc, "USR", "%s %s", - purple_account_get_username(account), - swboard->auth_key); - } - - msn_transaction_set_error_cb(trans, ans_usr_error); - msn_transaction_set_data(trans, swboard); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - char **params; - char *passport; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 911) - { - reason = MSN_SB_ERROR_AUTHFAILED; - } - - purple_debug_warning("msn", "ans_usr_error: command %s gave error %i\n", trans->command, error); - - params = g_strsplit(trans->params, " ", 0); - passport = params[0]; - swboard = trans->data; - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static void -disconnect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - - swboard = servconn->cmdproc->data; - g_return_if_fail(swboard != NULL); - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_switchboard_destroy(swboard); -} - -gboolean -msn_switchboard_connect(MsnSwitchBoard *swboard, const char *host, int port) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - msn_servconn_set_connect_cb(swboard->servconn, connect_cb); - msn_servconn_set_disconnect_cb(swboard->servconn, disconnect_cb); - - return msn_servconn_connect(swboard->servconn, host, port, FALSE); -} - -void -msn_switchboard_disconnect(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - msn_servconn_disconnect(swboard->servconn); -} - -/************************************************************************** - * Call stuff - **************************************************************************/ -static void -got_cal(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -#if 0 - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - - user = cmd->params[0]; - - msn_switchboard_add_user(swboard, user); -#endif -} - -static void -cal_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - purple_debug_warning("msn", "cal_timeout: command %s timed out\n", trans->command); - - cal_error_helper(trans, MSN_SB_ERROR_UNKNOWN); -} - -static void -cal_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int reason = MSN_SB_ERROR_UNKNOWN; - MsnMessage *msg; - MsnSwitchBoard *swboard = trans->data; - - if (error == 215) - { - purple_debug_info("msn", "Invited user already in switchboard\n"); - return; - } - else if (error == 217) - { - reason = MSN_SB_ERROR_USER_OFFLINE; - } - - purple_debug_warning("msn", "cal_error: command %s gave error %i\n", trans->command, error); - - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL){ - purple_debug_warning("msn", "Unable to send msg: {%s}\n", msg->body); - /* The messages could not be sent due to a switchboard error */ - swboard->error = MSN_SB_ERROR_USER_OFFLINE; - msg_error_helper(swboard->cmdproc, msg, - MSN_MSG_ERROR_SB); - } - cal_error_helper(trans, reason); -} - -void -msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnTransaction *trans; - MsnCmdProc *cmdproc; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - - trans = msn_transaction_new(cmdproc, "CAL", "%s", user); - /* this doesn't do anything, but users seem to think that - * 'Unhandled command' is some kind of error, so we don't report it */ - msn_transaction_add_cb(trans, "CAL", got_cal); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_timeout_cb(trans, cal_timeout); - - if (swboard->ready) - msn_cmdproc_send_trans(cmdproc, trans); - else - msn_cmdproc_queue_trans(cmdproc, trans); -} - -/************************************************************************** - * Create & Transfer stuff - **************************************************************************/ - -static void -got_swboard(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - char *host; - int port; - swboard = cmd->trans->data; - - if (g_list_find(cmdproc->session->switches, swboard) == NULL) - /* The conversation window was closed. */ - return; - - purple_debug_info("msn", "Switchboard:auth:{%s} socket:{%s}\n", cmd->params[4], cmd->params[2]); - msn_switchboard_set_auth_key(swboard, cmd->params[4]); - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 913) - reason = MSN_SB_ERROR_OFFLINE; - else if (error == 800) - reason = MSN_SB_ERROR_TOO_FAST; - - swboard = trans->data; - - purple_debug_info("msn", - "xfr_error %i for %s: trans %p, command %s, reason %i\n", - error, (swboard->im_user ? swboard->im_user : "(null)"), trans, - (trans->command ? trans->command : "(null)"), reason); - - swboard_error_helper(swboard, reason, swboard->im_user); -} - -void -msn_switchboard_request(MsnSwitchBoard *swboard) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->session->notification->cmdproc; - - trans = msn_transaction_new(cmdproc, "XFR", "%s", "SB"); - msn_transaction_add_cb(trans, "XFR", got_swboard); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_error_cb(trans, xfr_error); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_switchboard_close(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - if (swboard->error != MSN_SB_ERROR_NONE) - { - msn_switchboard_destroy(swboard); - } - else if (g_queue_is_empty(swboard->msg_queue) || - !swboard->session->connected) - { - MsnCmdProc *cmdproc; - cmdproc = swboard->cmdproc; - msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL); - - msn_switchboard_destroy(swboard); - } - else - { - swboard->closed = TRUE; - } -} - -void -msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag) -{ - g_return_if_fail(swboard != NULL); - - swboard->flag &= ~flag; - - if (flag == MSN_SB_FLAG_IM) - /* Forget any conversation that used to be associated with this - * swboard. */ - swboard->conv = NULL; - - if (swboard->flag == 0) - /* Nothing else is using this switchboard, so close it */ - msn_switchboard_close(swboard); -} - -/************************************************************************** - * Init stuff - **************************************************************************/ - -void -msn_switchboard_init(void) -{ - cbs_table = msn_table_new(); - - msn_table_add_cmd(cbs_table, "ANS", "ANS", ans_cmd); - msn_table_add_cmd(cbs_table, "ANS", "IRO", iro_cmd); - - msn_table_add_cmd(cbs_table, "MSG", "ACK", ack_cmd); - msn_table_add_cmd(cbs_table, "MSG", "NAK", nak_cmd); - - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "UBM", ubm_cmd); - msn_table_add_cmd(cbs_table, NULL, "JOI", joi_cmd); - msn_table_add_cmd(cbs_table, NULL, "BYE", bye_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - -#if 0 - /* They might skip the history */ - msn_table_add_cmd(cbs_table, NULL, "ACK", NULL); -#endif - - msn_table_add_error(cbs_table, "MSG", msg_error); - msn_table_add_error(cbs_table, "CAL", cal_error); - - /* Register the message type callbacks. */ - msn_table_add_msg_type(cbs_table, "text/plain", - msn_plain_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol", - msn_control_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientcaps", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientinfo", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "application/x-msnmsgrp2p", - msn_p2p_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-emoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-animemoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", - msn_datacast_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgsinvite", - msn_invite_msg); - msn_table_add_msg_type(cbs_table, "image/gif", - msn_handwritten_msg); -} - -void -msn_switchboard_end(void) -{ - msn_table_destroy(cbs_table); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/switchboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,289 +0,0 @@ -/** - * @file switchboard.h MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SWITCHBOARD_H -#define MSN_SWITCHBOARD_H - -typedef struct _MsnSwitchBoard MsnSwitchBoard; - -/** - * A switchboard error. - */ -typedef enum -{ - MSN_SB_ERROR_NONE, /**< No error. */ - MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */ - MSN_SB_ERROR_OFFLINE, /**< The account is offline. */ - MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */ - MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */ - MSN_SB_ERROR_TOO_FAST, /**< We are sending too fast */ - MSN_SB_ERROR_AUTHFAILED, /**< Authentication failed joining the switchboard session */ - MSN_SB_ERROR_UNKNOWN /**< An unknown error occurred. */ -} MsnSBErrorType; - -/** - * A switchboard flag. - */ -typedef enum -{ - MSN_SB_FLAG_IM = 0x01, /**< This switchboard is being used for a conversation. */ - MSN_SB_FLAG_FT = 0x02 /**< This switchboard is being used for file transfer. */ -} MsnSBFlag; - -#include "conversation.h" - -#include "msg.h" -#include "servconn.h" -#include "slplink.h" -#include "user.h" - -/** - * A switchboard. - * - * A place where a bunch of users send messages to the rest of the users. - */ -struct _MsnSwitchBoard -{ - MsnSession *session; /**< Our parent session. */ - MsnServConn *servconn; /**< The physical connection for this switchboard. */ - MsnCmdProc *cmdproc; /**< Convenience variable for servconn->cmdproc. */ - char *im_user; - - MsnSBFlag flag; - char *auth_key; - char *session_id; - - PurpleConversation *conv; /**< The conversation that displays the - messages of this switchboard, or @c NULL if - this is a helper switchboard. */ - - gboolean empty; /**< A flag that states if the swithcboard has no - users in it. */ - gboolean invited; /**< A flag that states if we were invited to the - switchboard. */ - gboolean ready; /**< A flag that states if this switchboard is - ready to be used. */ - gboolean closed; /**< A flag that states if the switchboard has - been closed by the user. */ - gboolean destroying; /**< A flag that states if the switchboard is - alredy on the process of destruction. */ - - int current_users; - int total_users; - GList *users; - - int chat_id; - - GQueue *msg_queue; /**< Queue of messages to send. */ - GList *ack_list; /**< List of messages waiting for an ack. */ - - MsnSBErrorType error; /**< The error that occurred in this switchboard - (if applicable). */ - GList *slplinks; /**< The list of slplinks that are using this switchboard. */ - guint reconn_timeout_h; -}; - -/** - * Initialize the variables for switchboard creation. - */ -void msn_switchboard_init(void); - -/** - * Destroy the variables for switchboard creation. - */ -void msn_switchboard_end(void); - -/** - * Creates a new switchboard. - * - * @param session The MSN session. - * - * @return The new switchboard. - */ -MsnSwitchBoard *msn_switchboard_new(MsnSession *session); - -/** - * Destroys a switchboard. - * - * @param swboard The switchboard to destroy. - */ -void msn_switchboard_destroy(MsnSwitchBoard *swboard); - -/** - * Sets the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param key The auth key. - */ -void msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key); - -/** - * Returns the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The auth key. - */ -const char *msn_switchboard_get_auth_key(MsnSwitchBoard *swboard); - -/** - * Sets the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param id The session ID. - */ -void msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id); - -/** - * Returns the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The session ID. - */ -const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard); - -/** - * Returns the next chat ID for use by a switchboard. - * - * @return The chat ID. - */ -int msn_switchboard_get_chat_id(void); - -/** - * Sets whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * @param invite @c TRUE if invited, @c FALSE otherwise. - */ -void msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited); - -/** - * Returns whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if invited, @c FALSE otherwise. - */ -gboolean msn_switchboard_is_invited(MsnSwitchBoard *swboard); - -/** - * Connects to a switchboard. - * - * @param swboard The switchboard. - * @param host The switchboard server host. - * @param port The switcbharod server port. - * - * @return @c TRUE if able to connect, or @c FALSE otherwise. - */ -gboolean msn_switchboard_connect(MsnSwitchBoard *swboard, - const char *host, int port); - -/** - * Disconnects from a switchboard. - * - * @param swboard The switchboard to disconnect from. - */ -void msn_switchboard_disconnect(MsnSwitchBoard *swboard); - -/** - * Closes the switchboard. - * - * Called when a conversation is closed. - * - * @param swboard The switchboard to close. - */ -void msn_switchboard_close(MsnSwitchBoard *swboard); - -/** - * Release a switchboard from a certain function. - * - * @param swboard The switchboard to release. - * @param flag The flag that states the function. - */ -void msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag); - -/** - * Returns whether or not we currently can send a message through this - * switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -gboolean msn_switchboard_can_send(MsnSwitchBoard *swboard); - -/** - * Sends a message through this switchboard. - * - * @param swboard The switchboard. - * @param msg The message. - * @param queue A flag that states if we want this message to be queued (in - * the case it cannot currently be sent). - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue); - -gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard); -gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who); - -void msn_switchboard_request(MsnSwitchBoard *swboard); -void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user); - -/** - * Processes peer to peer messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes emoticon messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes INVITE messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Shows an ink message from this switchboard. - * - * @param swboard The switchboard. - * @param passport The user that sent the ink. - * @param data The ink data. - */ -void msn_switchboard_show_ink(MsnSwitchBoard *swboard, const char *passport, - const char *data); - -#endif /* MSN_SWITCHBOARD_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,253 +0,0 @@ -/** - * @file sync.c MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "sync.h" -#include "state.h" - -static MsnTable *cbs_table; - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc = cmdproc->session->account->gc; - const char *list_name; - - list_name = cmd->params[0]; - - if (!g_ascii_strcasecmp(list_name, "AL")) - { - /* - * If the current setting is AL, messages from users who - * are not in BL will be delivered. - * - * In other words, deny some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - else - { - /* If the current setting is BL, only messages from people - * who are in the AL will be delivered. - * - * In other words, permit some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - type = cmd->params[0]; - value = cmd->params[1]; - - if (cmd->param_count == 2) - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *name; - const char *group_id; - - group_id = cmd->params[0]; - name = purple_url_decode(cmd->params[1]); - - msn_group_new(session->userlist, group_id, name); - - /* HACK */ - if (group_id == 0) - { - /* Group of ungroupped buddies */ - if (session->sync->total_users == 0) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } - return; - } - - if ((purple_find_group(name)) == NULL) - { - PurpleGroup *g = purple_group_new(name); - purple_blist_add_group(g, NULL); - } -} - -static void -lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - char *passport = NULL; - const char *friend = NULL; - int list_op; - MsnUser *user; - - passport = cmd->params[0]; - friend = purple_url_decode(cmd->params[1]); - list_op = atoi(cmd->params[2]); - - user = msn_user_new(session->userlist, passport, friend); - - msn_userlist_add_user(session->userlist, user); - - session->sync->last_user = user; - - /* TODO: This can be improved */ - - if (list_op & MSN_LIST_FL_OP) - { - char **c; - char **tokens; - const char *group_nums; - GSList *group_ids; - - group_nums = cmd->params[3]; - - group_ids = NULL; - - tokens = g_strsplit(group_nums, ",", -1); - - for (c = tokens; *c != NULL; c++) - { - group_ids = g_slist_append(group_ids, *c); - } - - - msn_got_lst_user(session, user, list_op, group_ids); - - g_strfreev(tokens); - g_slist_free(group_ids); - } - else - { - msn_got_lst_user(session, user, list_op, NULL); - } - - session->sync->num_users++; - - if (session->sync->num_users == session->sync->total_users) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSync *sync = cmdproc->session->sync; - const char *type, *value; - MsnUser *user; - - user = sync->last_user; - - g_return_if_fail(user != NULL); - - type = cmd->params[0]; - value = cmd->params[1]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -void -msn_sync_init(void) -{ - cbs_table = msn_table_new(); - - /* Syncing */ - msn_table_add_cmd(cbs_table, NULL, "GTC", NULL); - msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd); - msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); -} - -void -msn_sync_end(void) -{ - msn_table_destroy(cbs_table); -} - -MsnSync * -msn_sync_new(MsnSession *session) -{ - MsnSync *sync; - - sync = g_new0(MsnSync, 1); - - sync->session = session; - sync->cbs_table = cbs_table; - - return sync; -} - -void -msn_sync_destroy(MsnSync *sync) -{ - g_free(sync); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/sync.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file sync.h MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_SYNC_H -#define MSN_SYNC_H - -typedef struct _MsnSync MsnSync; - -#include "session.h" -#include "table.h" -#include "user.h" - -struct _MsnSync -{ - MsnSession *session; - MsnTable *cbs_table; - - /* - * TODO: What is the intended purpose of old_cbs_table? Nothing - * sets it and it is only read in two places. - */ - MsnTable *old_cbs_table; - - int num_users; - int total_users; - int num_groups; - int total_groups; - MsnUser *last_user; -}; - -void msn_sync_init(void); -void msn_sync_end(void); - -MsnSync *msn_sync_new(MsnSession *session); -void msn_sync_destroy(MsnSync *sync); - -#endif /* MSN_SYNC_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file table.c MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "table.h" - -static void -null_cmd_cb(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -} - -static void -null_error_cb(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ -} - -MsnTable * -msn_table_new() -{ - MsnTable *table; - - table = g_new0(MsnTable, 1); - - table->cmds = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_hash_table_destroy); - table->msgs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->errors = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - table->async = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->fallback = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - return table; -} - -void -msn_table_destroy(MsnTable *table) -{ - g_return_if_fail(table != NULL); - - g_hash_table_destroy(table->cmds); - g_hash_table_destroy(table->msgs); - g_hash_table_destroy(table->errors); - - g_hash_table_destroy(table->async); - g_hash_table_destroy(table->fallback); - - g_free(table); -} - -void -msn_table_add_cmd(MsnTable *table, - char *command, char *answer, MsnTransCb cb) -{ - GHashTable *cbs; - - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - cbs = NULL; - - if (command == NULL) - { - cbs = table->async; - } - else if (strcmp(command, "fallback") == 0) - { - cbs = table->fallback; - } - else - { - cbs = g_hash_table_lookup(table->cmds, command); - - if (cbs == NULL) - { - cbs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - g_hash_table_insert(table->cmds, command, cbs); - } - } - - if (cb == NULL) - cb = null_cmd_cb; - - g_hash_table_insert(cbs, answer, cb); -} - -void -msn_table_add_error(MsnTable *table, - char *answer, MsnErrorCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - if (cb == NULL) - cb = null_error_cb; - - g_hash_table_insert(table->errors, answer, cb); -} - -void -msn_table_add_msg_type(MsnTable *table, - char *type, MsnMsgTypeCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(type != NULL); - g_return_if_fail(cb != NULL); - -#if 0 - if (cb == NULL) - cb = null_msg_cb; -#endif - - g_hash_table_insert(table->msgs, type, cb); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/** - * @file table.h MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_TABLE_H -#define MSN_TABLE_H - -typedef struct _MsnTable MsnTable; - -#include "cmdproc.h" -#include "transaction.h" -#include "msg.h" - -typedef void (*MsnMsgTypeCb)(MsnCmdProc *cmdproc, MsnMessage *msg); - -struct _MsnTable -{ - GHashTable *cmds; - GHashTable *msgs; - GHashTable *errors; - - GHashTable *async; - GHashTable *fallback; -}; - -MsnTable *msn_table_new(void); -void msn_table_destroy(MsnTable *table); - -void msn_table_add_cmd(MsnTable *table, char *command, char *answer, - MsnTransCb cb); -void msn_table_add_error(MsnTable *table, char *answer, MsnErrorCb cb); -void msn_table_add_msg_type(MsnTable *table, char *type, MsnMsgTypeCb cb); - -#endif /* MSN_TABLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,231 +0,0 @@ -/** - * @file transaction.c MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "transaction.h" - -MsnTransaction * -msn_transaction_new(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_val_if_fail(command != NULL, NULL); - - trans = g_new0(MsnTransaction, 1); - - trans->cmdproc = cmdproc; - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - /* trans->queue = g_queue_new(); */ - - return trans; -} - -void -msn_transaction_destroy(MsnTransaction *trans) -{ - g_return_if_fail(trans != NULL); - - g_free(trans->command); - g_free(trans->params); - g_free(trans->payload); - - if (trans->data_free) - trans->data_free(trans->data); - -#if 0 - if (trans->pendent_cmd != NULL) - msn_message_unref(trans->pendent_msg); -#endif - -#if 0 - MsnTransaction *elem; - if (trans->queue != NULL) - { - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_transaction_destroy(elem); - - g_queue_free(trans->queue); - } -#endif - - if (trans->callbacks != NULL && trans->has_custom_callbacks) - g_hash_table_destroy(trans->callbacks); - - if (trans->timer) - purple_timeout_remove(trans->timer); - - g_free(trans); -} - -char * -msn_transaction_to_string(MsnTransaction *trans) -{ - char *str; - - g_return_val_if_fail(trans != NULL, FALSE); - - if (trans->params != NULL) - str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params); - else - str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId); - - return str; -} - -void -msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd) -{ - purple_debug_info("msn", "queueing command.\n"); - trans->pendent_cmd = cmd; - msn_command_ref(cmd); -} - -void -msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnCommand *cmd; - - if (!cmdproc->servconn->connected) - return; - - purple_debug_info("msn", "unqueueing command.\n"); - cmd = trans->pendent_cmd; - - g_return_if_fail(cmd != NULL); - - msn_cmdproc_process_cmd(cmdproc, cmd); - msn_command_unref(cmd); - - trans->pendent_cmd = NULL; -} - -#if 0 -void -msn_transaction_queue(MsnTransaction *trans, MsnTransaction *elem) -{ - if (trans->queue == NULL) - trans->queue = g_queue_new(); - - g_queue_push_tail(trans->queue, elem); -} - -void -msn_transaction_unqueue(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnTransaction *elem; - - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_cmdproc_send_trans(cmdproc, elem); -} -#endif - -void -msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(payload != NULL); - - trans->payload = g_strdup(payload); - trans->payload_len = payload_len ? payload_len : strlen(trans->payload); -} - -void -msn_transaction_set_data(MsnTransaction *trans, void *data) -{ - g_return_if_fail(trans != NULL); - - trans->data = data; -} - -void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn) -{ - g_return_if_fail(trans != NULL); - trans->data_free = fn; -} - -void -msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(answer != NULL); - - if (trans->callbacks == NULL) - { - trans->has_custom_callbacks = TRUE; - trans->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - NULL); - } - else if (trans->has_custom_callbacks != TRUE) - g_return_if_reached (); - - g_hash_table_insert(trans->callbacks, answer, cb); -} - -static gboolean -transaction_timeout(gpointer data) -{ - MsnTransaction *trans; - - trans = data; - g_return_val_if_fail(trans != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "timed out: %s %d %s\n", trans->command, trans->trId, trans->params); -#endif - - if (trans->timeout_cb != NULL) - trans->timeout_cb(trans->cmdproc, trans); - - trans->timer = 0; - return FALSE; -} - -void -msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb) -{ - if (trans->timer) - { - purple_debug_error("msn", "This shouldn't be happening\n"); - purple_timeout_remove(trans->timer); - } - trans->timeout_cb = cb; - trans->timer = purple_timeout_add_seconds(60, transaction_timeout, trans); -} - -void -msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb) -{ - trans->error_cb = cb; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/transaction.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/** - * @file transaction.h MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_TRANSACTION_H -#define MSN_TRANSACTION_H - -typedef struct _MsnTransaction MsnTransaction; - -#include "cmdproc.h" -#include "command.h" - -typedef void (*MsnTransCb)(MsnCmdProc *cmdproc, MsnCommand *cmd); -typedef void (*MsnTimeoutCb)(MsnCmdProc *cmdproc, MsnTransaction *trans); -typedef void (*MsnErrorCb)(MsnCmdProc *cmdproc, MsnTransaction *trans, - int error); - -/** - * A transaction. A sending command that will initiate the transaction. - */ -struct _MsnTransaction -{ - MsnCmdProc *cmdproc; - unsigned int trId; - - char *command; - char *params; - - guint timer; - - void *data; /**< The data to be used on the different callbacks. */ - GDestroyNotify data_free; /**< The function to free 'data', or @c NULL */ - - GHashTable *callbacks; - gboolean has_custom_callbacks; - MsnErrorCb error_cb; - MsnTimeoutCb timeout_cb; - - char *payload; - size_t payload_len; - - GQueue *queue; - MsnCommand *pendent_cmd; /**< The command that is waiting for the result of - this transaction. */ -}; - -MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) G_GNUC_PRINTF(3, 4); -void msn_transaction_destroy(MsnTransaction *trans); - -char *msn_transaction_to_string(MsnTransaction *trans); -void msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd); -void msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc); -void msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len); -void msn_transaction_set_data(MsnTransaction *trans, void *data); -void msn_transaction_set_data_free(MsnTransaction *trans, GDestroyNotify fn); -void msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb); -void msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb); -void msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb); - -#endif /* MSN_TRANSACTION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -/** - * @file user.c User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "user.h" -#include "slp.h" - -/*new a user object*/ -MsnUser * -msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name) -{ - MsnUser *user; - - user = g_new0(MsnUser, 1); - - user->userlist = userlist; - - msn_user_set_passport(user, passport); - msn_user_set_friendly_name(user, friendly_name); - - return user; -} - -/*destroy a user object*/ -void -msn_user_destroy(MsnUser *user) -{ - g_return_if_fail(user != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - if (user->group_ids != NULL) - { - GList *l; - for (l = user->group_ids; l != NULL; l = l->next) - { - g_free(l->data); - } - g_list_free(user->group_ids); - } - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - g_free(user->passport); - g_free(user->friendly_name); - g_free(user->uid); - if (user->extinfo) { - g_free(user->extinfo->media_album); - g_free(user->extinfo->media_artist); - g_free(user->extinfo->media_title); - g_free(user->extinfo->phone_home); - g_free(user->extinfo->phone_mobile); - g_free(user->extinfo->phone_work); - g_free(user->extinfo); - } - g_free(user->statusline); - g_free(user->invite_message); - - g_free(user); -} - -void -msn_user_update(MsnUser *user) -{ - PurpleAccount *account; - gboolean offline; - - g_return_if_fail(user != NULL); - - account = user->userlist->session->account; - - offline = (user->status == NULL); - - if (!offline) { - purple_prpl_got_user_status(account, user->passport, user->status, - "message", user->statusline, NULL); - } else { - if (user->mobile) { - purple_prpl_got_user_status(account, user->passport, "mobile", NULL); - purple_prpl_got_user_status(account, user->passport, "available", NULL); - } else { - purple_prpl_got_user_status(account, user->passport, "offline", NULL); - } - } - - if (!offline || !user->mobile) { - purple_prpl_got_user_status_deactive(account, user->passport, "mobile"); - } - - if (!offline && user->extinfo && user->extinfo->media_type != CURRENT_MEDIA_UNKNOWN) { - if (user->extinfo->media_type == CURRENT_MEDIA_MUSIC) { - purple_prpl_got_user_status(account, user->passport, "tune", - PURPLE_TUNE_ARTIST, user->extinfo->media_artist, - PURPLE_TUNE_ALBUM, user->extinfo->media_album, - PURPLE_TUNE_TITLE, user->extinfo->media_title, - NULL); - } else if (user->extinfo->media_type == CURRENT_MEDIA_GAMES) { - purple_prpl_got_user_status(account, user->passport, "tune", - "game", user->extinfo->media_title, - NULL); - } else if (user->extinfo->media_type == CURRENT_MEDIA_OFFICE) { - purple_prpl_got_user_status(account, user->passport, "tune", - "office", user->extinfo->media_title, - NULL); - } else { - purple_debug_warning("msn", "Got CurrentMedia with unknown type %d.\n", - user->extinfo->media_type); - } - } else { - purple_prpl_got_user_status_deactive(account, user->passport, "tune"); - } - - if (user->idle) - purple_prpl_got_user_idle(account, user->passport, TRUE, -1); - else - purple_prpl_got_user_idle(account, user->passport, FALSE, 0); -} - -void -msn_user_set_state(MsnUser *user, const char *state) -{ - const char *status; - - g_return_if_fail(user != NULL); - - if (state == NULL) { - user->status = NULL; - return; - } - - if (!g_ascii_strcasecmp(state, "BSY")) - status = "busy"; - else if (!g_ascii_strcasecmp(state, "BRB")) - status = "brb"; - else if (!g_ascii_strcasecmp(state, "AWY")) - status = "away"; - else if (!g_ascii_strcasecmp(state, "PHN")) - status = "phone"; - else if (!g_ascii_strcasecmp(state, "LUN")) - status = "lunch"; - else - status = "available"; - - if (!g_ascii_strcasecmp(state, "IDL")) - user->idle = TRUE; - else - user->idle = FALSE; - - user->status = status; -} - -void -msn_user_set_passport(MsnUser *user, const char *passport) -{ - g_return_if_fail(user != NULL); - - g_free(user->passport); - user->passport = g_strdup(passport); -} - -gboolean -msn_user_set_friendly_name(MsnUser *user, const char *name) -{ - g_return_val_if_fail(user != NULL, FALSE); - - if (user->friendly_name && name && (!strcmp(user->friendly_name, name) || - !strcmp(user->passport, name))) - return FALSE; - - g_free(user->friendly_name); - user->friendly_name = g_strdup(name); - - serv_got_alias(purple_account_get_connection(user->userlist->session->account), - user->passport, name); - return TRUE; -} - -void -msn_user_set_statusline(MsnUser *user, const char *statusline) -{ - g_return_if_fail(user != NULL); - - g_free(user->statusline); - user->statusline = g_strdup(statusline); -} - -void -msn_user_set_uid(MsnUser *user, const char *uid) -{ - g_return_if_fail(user != NULL); - - g_free(user->uid); - user->uid = g_strdup(uid); -} - -void -msn_user_set_op(MsnUser *user, MsnListOp list_op) -{ - g_return_if_fail(user != NULL); - - user->list_op |= list_op; -} - -void -msn_user_unset_op(MsnUser *user, MsnListOp list_op) -{ - g_return_if_fail(user != NULL); - - user->list_op &= ~list_op; -} - -void -msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img) -{ - MsnObject *msnobj; - - g_return_if_fail(user != NULL); - - msnobj = msn_object_new_from_image(img, "TFR2C2.tmp", - user->passport, MSN_OBJECT_USERTILE); - - if (!msnobj) - purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport); - - msn_user_set_object(user, msnobj); -} - -/*add group id to User object*/ -void -msn_user_add_group_id(MsnUser *user, const char* group_id) -{ - MsnUserList *userlist; - PurpleAccount *account; - PurpleBuddy *b; - PurpleGroup *g; - const char *passport; - const char *group_name; - - g_return_if_fail(user != NULL); - g_return_if_fail(group_id != NULL); - - user->group_ids = g_list_append(user->group_ids, g_strdup(group_id)); - - userlist = user->userlist; - account = userlist->session->account; - passport = msn_user_get_passport(user); - - group_name = msn_userlist_find_group_name(userlist, group_id); - - purple_debug_info("msn", "User: group id:%s,name:%s,user:%s\n", group_id, group_name, passport); - - g = purple_find_group(group_name); - - if ((group_id == NULL) && (g == NULL)) - { - g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - } - - b = purple_find_buddy_in_group(account, passport, g); - if (b == NULL) - { - b = purple_buddy_new(account, passport, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - purple_buddy_set_protocol_data(b, user); - /*Update the blist Node info*/ -} - -/*check if the msn user is online*/ -gboolean -msn_user_is_online(PurpleAccount *account, const char *name) -{ - PurpleBuddy *buddy; - - buddy = purple_find_buddy(account, name); - return PURPLE_BUDDY_IS_ONLINE(buddy); -} - -gboolean -msn_user_is_yahoo(PurpleAccount *account, const char *name) -{ - MsnSession *session = NULL; - MsnUser *user; - PurpleConnection *gc; - - gc = purple_account_get_connection(account); - if (gc != NULL) - session = gc->proto_data; - - if ((session != NULL) && (user = msn_userlist_find_user(session->userlist, name)) != NULL) - { - return (user->networkid == MSN_NETWORK_YAHOO); - } - return (strstr(name,"@yahoo.") != NULL); -} - -void -msn_user_remove_group_id(MsnUser *user, const char *id) -{ - GList *l; - - g_return_if_fail(user != NULL); - g_return_if_fail(id != NULL); - - l = g_list_find_custom(user->group_ids, id, (GCompareFunc)strcmp); - - if (l == NULL) - return; - - g_free(l->data); - user->group_ids = g_list_delete_link(user->group_ids, l); -} - -void -msn_user_set_pending_group(MsnUser *user, const char *group) -{ - user->pending_group = g_strdup(group); -} - -char * -msn_user_remove_pending_group(MsnUser *user) -{ - char *group = user->pending_group; - user->pending_group = NULL; - return group; -} - -void -msn_user_set_home_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (!number && !user->extinfo) - return; - - if (user->extinfo) - g_free(user->extinfo->phone_home); - else - user->extinfo = g_new0(MsnUserExtendedInfo, 1); - - user->extinfo->phone_home = g_strdup(number); -} - -void -msn_user_set_work_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (!number && !user->extinfo) - return; - - if (user->extinfo) - g_free(user->extinfo->phone_work); - else - user->extinfo = g_new0(MsnUserExtendedInfo, 1); - - user->extinfo->phone_work = g_strdup(number); -} - -void -msn_user_set_mobile_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (!number && !user->extinfo) - return; - - if (user->extinfo) - g_free(user->extinfo->phone_mobile); - else - user->extinfo = g_new0(MsnUserExtendedInfo, 1); - - user->extinfo->phone_mobile = g_strdup(number); -} - -void -msn_user_set_clientid(MsnUser *user, guint clientid) -{ - g_return_if_fail(user != NULL); - - user->clientid = clientid; -} - -void -msn_user_set_network(MsnUser *user, MsnNetwork network) -{ - g_return_if_fail(user != NULL); - - user->networkid = network; -} - -void -msn_user_set_object(MsnUser *user, MsnObject *obj) -{ - g_return_if_fail(user != NULL); - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - user->msnobj = obj; - - if (user->list_op & MSN_LIST_FL_OP) - msn_queue_buddy_icon_request(user); -} - -void -msn_user_set_client_caps(MsnUser *user, GHashTable *info) -{ - g_return_if_fail(user != NULL); - g_return_if_fail(info != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - user->clientcaps = info; -} - -void -msn_user_set_invite_message(MsnUser *user, const char *message) -{ - g_return_if_fail(user != NULL); - - g_free(user->invite_message); - user->invite_message = g_strdup(message); -} - -const char * -msn_user_get_passport(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->passport; -} - -const char * -msn_user_get_friendly_name(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->friendly_name; -} - -const char * -msn_user_get_home_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->extinfo ? user->extinfo->phone_home : NULL; -} - -const char * -msn_user_get_work_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->extinfo ? user->extinfo->phone_work : NULL; -} - -const char * -msn_user_get_mobile_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->extinfo ? user->extinfo->phone_mobile : NULL; -} - -guint -msn_user_get_clientid(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, 0); - - return user->clientid; -} - -MsnObject * -msn_user_get_object(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->msnobj; -} - -GHashTable * -msn_user_get_client_caps(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->clientcaps; -} - -const char * -msn_user_get_invite_message(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->invite_message; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,408 +0,0 @@ -/** - * @file user.h User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_USER_H -#define MSN_USER_H - -typedef struct _MsnUser MsnUser; - -typedef enum -{ - MSN_NETWORK_UNKNOWN = 0x00, - MSN_NETWORK_PASSPORT = 0x01, - MSN_NETWORK_COMMUNICATOR = 0x02, - MSN_NETWORK_MOBILE = 0x04, - MSN_NETWORK_MNI = 0x08, - MSN_NETWORK_SMTP = 0x10, - MSN_NETWORK_YAHOO = 0x20 -} MsnNetwork; - -/** - * Current media. - */ -typedef enum -{ - CURRENT_MEDIA_UNKNOWN, - CURRENT_MEDIA_MUSIC, - CURRENT_MEDIA_GAMES, - CURRENT_MEDIA_OFFICE -} CurrentMediaType; - -#include "object.h" -#include "session.h" -#include "userlist.h" - -/** - * Contains optional info about a user that is fairly uncommon. We - * put this info in in a separate struct to save memory because we - * allocate an MsnUser struct for each buddy, but we generally only - * need this information for a small percentage of our buddies - * (usually less than 1%). Putting it in a separate struct saves - * makes MsnUser smaller by the size of a few pointers. - */ -typedef struct _MsnUserExtendedInfo -{ - CurrentMediaType media_type; /**< Type of the user's current media. */ - char *media_title; /**< Title of the user's current media. */ - char *media_artist; /**< Artist of the user's current media. */ - char *media_album; /**< Album of the user's current media. */ - - char *phone_home; /**< E.T. uses this. */ - char *phone_work; /**< Work phone number. */ - char *phone_mobile; /**< Mobile phone number. */ -} MsnUserExtendedInfo; - -/** - * A user. - */ -struct _MsnUser -{ - MsnUserList *userlist; - - char *passport; /**< The passport account. */ - char *friendly_name; /**< The friendly name. */ - - char *uid; /*< User ID */ - - const char *status; /**< The state of the user. */ - char *statusline; /**< The state of the user. */ - - gboolean idle; /**< The idle state of the user. */ - - MsnUserExtendedInfo *extinfo; /**< Extended info for the user. */ - - gboolean authorized; /**< Authorized to add this user. */ - gboolean mobile; /**< Signed up with MSN Mobile. */ - - GList *group_ids; /**< The group IDs. */ - char *pending_group; /**< A pending group to add. */ - - MsnObject *msnobj; /**< The user's MSN Object. */ - - GHashTable *clientcaps; /**< The client's capabilities. */ - - guint clientid; /**< The client's ID */ - - MsnNetwork networkid; /**< The user's network */ - - MsnListOp list_op; /**< Which lists the user is in */ - - /** - * The membershipId for this buddy on our pending list. Sent by - * the contact's server - */ - guint member_id_on_pending_list; - - char *invite_message; /**< Invite message of user request */ -}; - -/************************************************************************** - ** @name User API * - **************************************************************************/ -/*@{*/ - -/** - * Creates a new user structure. - * - * @param session The MSN session. - * @param passport The initial passport. - * @param stored_name The initial stored name. - * - * @return A new user structure. - */ -MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name); - -/** - * Destroys a user structure. - * - * @param user The user to destroy. - */ -void msn_user_destroy(MsnUser *user); - - -/** - * Updates the user. - * - * Communicates with the core to update the ui, etc. - * - * @param user The user to update. - */ -void msn_user_update(MsnUser *user); - - /** - * Sets the new statusline of user. - * - * @param user The user. - * @param state The statusline string. - */ -void msn_user_set_statusline(MsnUser *user, const char *statusline); - -/** - * Sets the new state of user. - * - * @param user The user. - * @param state The state string. - */ -void msn_user_set_state(MsnUser *user, const char *state); - -/** - * Sets the passport account for a user. - * - * @param user The user. - * @param passport The passport account. - */ -void msn_user_set_passport(MsnUser *user, const char *passport); - -/** - * Sets the friendly name for a user. - * - * @param user The user. - * @param name The friendly name. - * - * @returns TRUE is name actually changed, FALSE otherwise. - */ -gboolean msn_user_set_friendly_name(MsnUser *user, const char *name); - -/** - * Sets the buddy icon for a local user. - * - * @param user The user. - * @param img The buddy icon image - */ -void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img); - -/** - * Sets the group ID list for a user. - * - * @param user The user. - * @param ids The group ID list. - */ -void msn_user_set_group_ids(MsnUser *user, GList *ids); - -/** - * Adds the group ID for a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_add_group_id(MsnUser *user, const char * id); - -/** - * Removes the group ID from a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_remove_group_id(MsnUser *user, const char * id); - -/** - * Sets the pending group for a user. - * - * @param user The user. - * @param group The group name. - */ -void msn_user_set_pending_group(MsnUser *user, const char *group); - -/** - * Removes the pending group from a user. - * - * @param user The user. - * - * @return Returns the pending group name. - */ -char *msn_user_remove_pending_group(MsnUser *user); - -/** - * Sets the home phone number for a user. - * - * @param user The user. - * @param number The home phone number. - */ -void msn_user_set_home_phone(MsnUser *user, const char *number); - -/** - * Sets the work phone number for a user. - * - * @param user The user. - * @param number The work phone number. - */ -void msn_user_set_work_phone(MsnUser *user, const char *number); - -void msn_user_set_uid(MsnUser *user, const char *uid); - -/** - * Sets the client id for a user. - * - * @param user The user. - * @param clientid The client id. - */ -void msn_user_set_clientid(MsnUser *user, guint clientid); - -/** - * Sets the network id for a user. - * - * @param user The user. - * @param network The network id. - */ -void msn_user_set_network(MsnUser *user, MsnNetwork network); - -/** - * Sets the mobile phone number for a user. - * - * @param user The user. - * @param number The mobile phone number. - */ -void msn_user_set_mobile_phone(MsnUser *user, const char *number); - -/** - * Sets the MSNObject for a user. - * - * @param user The user. - * @param obj The MSNObject. - */ -void msn_user_set_object(MsnUser *user, MsnObject *obj); - -/** - * Sets the client information for a user. - * - * @param user The user. - * @param info The client information. - */ -void msn_user_set_client_caps(MsnUser *user, GHashTable *info); - -/** - * Sets the invite message for a user. - * - * @param user The user. - * @param message The invite message for a user. - */ -void msn_user_set_invite_message(MsnUser *user, const char *message); - - -/** - * Returns the passport account for a user. - * - * @param user The user. - * - * @return The passport account. - */ -const char *msn_user_get_passport(const MsnUser *user); - -/** - * Returns the friendly name for a user. - * - * @param user The user. - * - * @return The friendly name. - */ -const char *msn_user_get_friendly_name(const MsnUser *user); - -/** - * Returns the home phone number for a user. - * - * @param user The user. - * - * @return The user's home phone number. - */ -const char *msn_user_get_home_phone(const MsnUser *user); - -/** - * Returns the work phone number for a user. - * - * @param user The user. - * - * @return The user's work phone number. - */ -const char *msn_user_get_work_phone(const MsnUser *user); - -/** - * Returns the mobile phone number for a user. - * - * @param user The user. - * - * @return The user's mobile phone number. - */ -const char *msn_user_get_mobile_phone(const MsnUser *user); - -/** - * Returns the client id for a user. - * - * @param user The user. - * - * @return The user's client id. - */ -guint msn_user_get_clientid(const MsnUser *user); - -/** - * Returns the network id for a user. - * - * @param user The user. - * - * @return The user's network id. - */ -MsnNetwork msn_user_get_network(const MsnUser *user); - -/** - * Returns the MSNObject for a user. - * - * @param user The user. - * - * @return The MSNObject. - */ -MsnObject *msn_user_get_object(const MsnUser *user); - -/** - * Returns the client information for a user. - * - * @param user The user. - * - * @return The client information. - */ -GHashTable *msn_user_get_client_caps(const MsnUser *user); - -/** - * Returns the invite message for a user. - * - * @param user The user. - * - * @return The user's invite message. - */ -const char *msn_user_get_invite_message(const MsnUser *user); - -/** - * check to see if user is online - */ -gboolean msn_user_is_online(PurpleAccount *account, const char *name); - -/** - * check to see if user is Yahoo User - */ -gboolean msn_user_is_yahoo(PurpleAccount *account ,const char *name); - -void msn_user_set_op(MsnUser *user, MsnListOp list_op); -void msn_user_unset_op(MsnUser *user, MsnListOp list_op); - -/*@}*/ - -#endif /* MSN_USER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,743 +0,0 @@ -/** - * @file userlist.c MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "userlist.h" - -#include "contact.h" - -const char *lists[] = { "FL", "AL", "BL", "RL" }; - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *friendly; - -} MsnPermitAdd; - -/************************************************************************** - * Callbacks - **************************************************************************/ -static void -msn_accept_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - - purple_debug_misc("msn", "Accepted the new buddy: %s\n", pa->who); - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) - { - MsnSession *session = pa->gc->proto_data; - MsnUserList *userlist = session->userlist; - PurpleAccount *account = purple_connection_get_account(pa->gc); - - msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL); - purple_privacy_deny_remove(account, pa->who, TRUE); - purple_privacy_permit_add(account, pa->who, TRUE); - - msn_del_contact_from_list(session, NULL, pa->who, MSN_LIST_PL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -msn_cancel_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - - purple_debug_misc("msn", "Denied the new buddy: %s\n", pa->who); - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) - { - MsnSession *session = pa->gc->proto_data; - MsnUserList *userlist = session->userlist; - MsnCallbackState *state = msn_callback_state_new(session); - - msn_callback_state_set_action(state, MSN_DENIED_BUDDY); - - msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_BL); - msn_del_contact_from_list(session, state, pa->who, MSN_LIST_PL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -got_new_entry(PurpleConnection *gc, const char *passport, const char *friendly, const char *message) -{ - PurpleAccount *acct; - MsnPermitAdd *pa; - - pa = g_new0(MsnPermitAdd, 1); - pa->who = g_strdup(passport); - pa->friendly = g_strdup(friendly); - pa->gc = gc; - - acct = purple_connection_get_account(gc); - purple_account_request_authorization(acct, passport, NULL, friendly, message, - purple_find_buddy(acct, passport) != NULL, - msn_accept_add_cb, msn_cancel_add_cb, pa); - -} - -/************************************************************************** - * Utility functions - **************************************************************************/ - -gboolean -msn_userlist_user_is_in_group(MsnUser *user, const char * group_id) -{ - if (user == NULL) - return FALSE; - - if (group_id == NULL) - return FALSE; - - return (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) != NULL; -} - -gboolean -msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id) -{ - if (user == NULL) - return FALSE; - - return (user->list_op & (1 << list_id)); -} - -/************************************************************************** - * Server functions - **************************************************************************/ - -void -msn_got_lst_user(MsnSession *session, MsnUser *user, - MsnListOp list_op, GSList *group_ids) -{ - PurpleConnection *gc; - PurpleAccount *account; - const char *passport; - const char *store; - const char *message; - - account = session->account; - gc = purple_account_get_connection(account); - - passport = msn_user_get_passport(user); - store = msn_user_get_friendly_name(user); - message = msn_user_get_invite_message(user); - - msn_user_set_op(user, list_op); - - if (list_op & MSN_LIST_FL_OP) - { - GSList *c; - for (c = group_ids; c != NULL; c = g_slist_next(c)) - { - char *group_id = c->data; - msn_user_add_group_id(user, group_id); - } - - /* FIXME: It might be a real alias */ - /* Umm, what? This might fix bug #1385130 */ - serv_got_alias(gc, passport, store); - } - - if (list_op & MSN_LIST_AL_OP) - { - /* These are users who are allowed to see our status. */ - purple_privacy_deny_remove(account, passport, TRUE); - purple_privacy_permit_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_BL_OP) - { - /* These are users who are not allowed to see our status. */ - purple_privacy_permit_remove(account, passport, TRUE); - purple_privacy_deny_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_RL_OP) - { - /* These are users who have us on their buddy list. */ - /* - * TODO: What is store name set to when this happens? - * For one of my accounts "something@hotmail.com" - * the store name was "something." Maybe we - * should use the friendly name, instead? --KingAnt - */ - - if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) - { -/* got_new_entry(gc, passport, store, NULL); */ - } - } - - if (list_op & MSN_LIST_PL_OP) - { - user->authorized = TRUE; - got_new_entry(gc, passport, store, message); - } -} - -/************************************************************************** - * UserList functions - **************************************************************************/ - -MsnUserList* -msn_userlist_new(MsnSession *session) -{ - MsnUserList *userlist; - - userlist = g_new0(MsnUserList, 1); - - userlist->session = session; - userlist->buddy_icon_requests = g_queue_new(); - - /* buddy_icon_window is the number of allowed simultaneous buddy icon requests. - * XXX With smarter rate limiting code, we could allow more at once... 5 was the limit set when - * we weren't retrieiving any more than 5 per MSN session. */ - userlist->buddy_icon_window = 1; - - return userlist; -} - -void -msn_userlist_destroy(MsnUserList *userlist) -{ - GList *l; - - /*destroy userlist*/ - for (l = userlist->users; l != NULL; l = l->next) - { - msn_user_destroy(l->data); - } - g_list_free(userlist->users); - - /*destroy group list*/ - for (l = userlist->groups; l != NULL; l = l->next) - { - msn_group_destroy(l->data); - } - g_list_free(userlist->groups); - - g_queue_free(userlist->buddy_icon_requests); - - if (userlist->buddy_icon_request_timer) - purple_timeout_remove(userlist->buddy_icon_request_timer); - - g_free(userlist); -} - -MsnUser * -msn_userlist_find_add_user(MsnUserList *userlist,const char *passport,const char *userName) -{ - MsnUser *user; - - user = msn_userlist_find_user(userlist, passport); - if (user == NULL) - { - user = msn_user_new(userlist, passport, userName); - msn_userlist_add_user(userlist, user); - } else { - msn_user_set_friendly_name(user, userName); - } - return user; -} - -void -msn_userlist_add_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_prepend(userlist->users, user); -} - -void -msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_remove(userlist->users, user); -} - -MsnUser * -msn_userlist_find_user(MsnUserList *userlist, const char *passport) -{ - GList *l; - - g_return_val_if_fail(passport != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) - { - MsnUser *user = (MsnUser *)l->data; - - g_return_val_if_fail(user->passport != NULL, NULL); - - if (!g_ascii_strcasecmp(passport, user->passport)){ - return user; - } - } - - return NULL; -} - -MsnUser * -msn_userlist_find_user_with_id(MsnUserList *userlist, const char *uid) -{ - GList *l; - - g_return_val_if_fail(uid != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) { - MsnUser *user = (MsnUser *)l->data; - - if (user->uid == NULL) { - continue; - } - - if ( !g_ascii_strcasecmp(uid, user->uid) ) { - return user; - } - } - - return NULL; -} - -MsnUser * -msn_userlist_find_user_with_mobile_phone(MsnUserList *userlist, const char *number) -{ - GList *l; - - g_return_val_if_fail(number != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) { - MsnUser *user = (MsnUser *)l->data; - const char *user_number = msn_user_get_mobile_phone(user); - - if (user_number && !g_ascii_strcasecmp(number, user_number)) - return user; - } - - return NULL; -} - -void -msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_append(userlist->groups, group); -} - -void -msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_remove(userlist->groups, group); -} - -MsnGroup * -msn_userlist_find_group_with_id(MsnUserList *userlist, const char * id) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if (!g_ascii_strcasecmp(group->id,id)) - return group; - } - - return NULL; -} - -MsnGroup * -msn_userlist_find_group_with_name(MsnUserList *userlist, const char *name) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if ((group->name != NULL) && !g_ascii_strcasecmp(name, group->name)) - return group; - } - - return NULL; -} - -const char * -msn_userlist_find_group_id(MsnUserList *userlist, const char *group_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_name(userlist, group_name); - - if (group != NULL) - return msn_group_get_id(group); - else - return NULL; -} - -const char * -msn_userlist_find_group_name(MsnUserList *userlist, const char * group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - return msn_group_get_name(group); - else - return NULL; -} - -void -msn_userlist_rename_group_id(MsnUserList *userlist, const char * group_id, - const char *new_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - msn_group_set_name(group, new_name); -} - -void -msn_userlist_remove_group_id(MsnUserList *userlist, const char * group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - { - msn_userlist_remove_group(userlist, group); - msn_group_destroy(group); - } -} - -typedef struct { - MsnSession *session; - char *uid; -} MsnUserlistABData; - -static void -userlist_ab_delete_cb(void *data, int choice) -{ - MsnUserlistABData *ab = (MsnUserlistABData *)data; - - /* msn_delete_contact(ab->session, ab->uid, (gboolean)choice); */ - - g_free(ab->uid); - g_free(ab); -} - -void -msn_userlist_rem_buddy(MsnUserList *userlist, const char *who) -{ - MsnUser *user = NULL; - - g_return_if_fail(userlist != NULL); - g_return_if_fail(userlist->session != NULL); - g_return_if_fail(who != NULL); - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_FL); - - /* delete the contact from address book via soap action */ - if (user != NULL) { - if (0 /*not ready yet*/ && userlist->session->passport_info.email_enabled) { - MsnUserlistABData *ab = g_new0(MsnUserlistABData, 1); - ab->session = userlist->session; - ab->uid = g_strdup(user->uid); /* Not necessary? */ - purple_request_yes_no(userlist->session->account, - _("Delete Buddy from Address Book?"), - _("Do you want to delete this buddy from your address book as well?"), - user->passport, 0, userlist->session->account, user->passport, - NULL, ab, - G_CALLBACK(userlist_ab_delete_cb), G_CALLBACK(userlist_ab_delete_cb)); - } else - msn_delete_contact(userlist->session, user); - } -} - -void -msn_userlist_rem_buddy_from_list(MsnUserList *userlist, const char *who, - MsnListId list_id) -{ - MsnUser *user; - const gchar *list; - MsnListOp list_op = 1 << list_id; - - user = msn_userlist_find_user(userlist, who); - - g_return_if_fail(user != NULL); - - if ( !msn_userlist_user_is_in_list(user, list_id)) { - list = lists[list_id]; - purple_debug_info("msn", "User %s is not in list %s, not removing.\n", who, list); - return; - } - - msn_user_unset_op(user, list_op); - - msn_notification_rem_buddy_from_list(userlist->session->notification, list_id, user); -} - -/*add buddy*/ -void -msn_userlist_add_buddy(MsnUserList *userlist, const char *who, const char *group_name) -{ - MsnUser *user; - MsnCallbackState *state = NULL; - const char *group_id = NULL, *new_group_name; - - new_group_name = group_name == NULL ? MSN_INDIVIDUALS_GROUP_NAME : group_name; - - g_return_if_fail(userlist != NULL); - g_return_if_fail(userlist->session != NULL); - - purple_debug_info("msn", "Add user: %s to group: %s\n", who, new_group_name); - - if (!msn_email_is_valid(who)) - { - /* only notify the user about problems adding to the friends list - * maybe we should do something else for other lists, but it probably - * won't cause too many problems if we just ignore it */ - - char *str = g_strdup_printf(_("Unable to add \"%s\"."), who); - - purple_notify_error(NULL, NULL, str, - _("The username specified is invalid.")); - g_free(str); - - return; - } - - state = msn_callback_state_new(userlist->session); - msn_callback_state_set_who(state, who); - msn_callback_state_set_new_group_name(state, new_group_name); - - group_id = msn_userlist_find_group_id(userlist, new_group_name); - - if (group_id == NULL) - { - /* Whoa, we must add that group first. */ - purple_debug_info("msn", "Adding user %s to a new group, creating group %s first\n", who, new_group_name); - - msn_callback_state_set_action(state, MSN_ADD_BUDDY); - - msn_add_group(userlist->session, state, new_group_name); - return; - } else { - msn_callback_state_set_guid(state, group_id); - } - - /* XXX: adding user here may not be correct (should add them in the - * ACK to the ADL command), but for now we need to make sure they exist - * early enough that the ILN command doesn't screw us up */ - - user = msn_userlist_find_add_user(userlist, who, who); - - if ( msn_userlist_user_is_in_list(user, MSN_LIST_FL) ) { - - purple_debug_info("msn", "User %s already exists\n", who); - - msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - - if (msn_userlist_user_is_in_group(user, group_id)) { - purple_debug_info("msn", "User %s is already in group %s, returning\n", who, new_group_name); - msn_callback_state_free(state); - return; - } - } - - purple_debug_info("msn", "Adding user: %s to group id: %s\n", who, group_id); - - msn_callback_state_set_action(state, MSN_ADD_BUDDY); - - /* Add contact in the Contact server with a SOAP request and if - successful, send ADL with MSN_LIST_AL and MSN_LIST_FL and a FQY */ - msn_add_contact_to_group(userlist->session, state, who, group_id); -} - -void -msn_userlist_add_buddy_to_list(MsnUserList *userlist, const char *who, - MsnListId list_id) -{ - MsnUser *user = NULL; - const gchar *list; - MsnListOp list_op = 1 << list_id; - - g_return_if_fail(userlist != NULL); - - user = msn_userlist_find_add_user(userlist, who, who); - - /* First we're going to check if it's already there. */ - if (msn_userlist_user_is_in_list(user, list_id)) - { - list = lists[list_id]; - purple_debug_info("msn", "User '%s' is already in list: %s\n", who, list); - return; - } - - /* XXX: see XXX above, this should really be done when we get the response from - the server */ - - msn_user_set_op(user, list_op); - - msn_notification_add_buddy_to_list(userlist->session->notification, list_id, user); -} - -gboolean -msn_userlist_add_buddy_to_group(MsnUserList *userlist, const char *who, - const char *group_name) -{ - MsnUser *user; - gchar * group_id; - - g_return_val_if_fail(userlist != NULL, FALSE); - g_return_val_if_fail(group_name != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - purple_debug_info("msn", "Adding buddy with passport %s to group %s\n", who, group_name); - - if ( (group_id = (gchar *)msn_userlist_find_group_id(userlist, group_name)) == NULL) { - purple_debug_error("msn", "Group %s has no guid!\n", group_name); - return FALSE; - } - - if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { - purple_debug_error("msn", "User %s not found!\n", who); - return FALSE; - } - - msn_user_add_group_id(user, group_id); - - return TRUE; -} - - -gboolean -msn_userlist_rem_buddy_from_group(MsnUserList *userlist, const char *who, - const char *group_name) -{ - const gchar * group_id; - MsnUser *user; - - g_return_val_if_fail(userlist != NULL, FALSE); - g_return_val_if_fail(group_name != NULL, FALSE); - g_return_val_if_fail(who != NULL, FALSE); - - purple_debug_info("msn", "Removing buddy with passport %s from group %s\n", who, group_name); - - if ( (group_id = msn_userlist_find_group_id(userlist, group_name)) == NULL) { - purple_debug_error("msn", "Group %s has no guid!\n", group_name); - return FALSE; - } - - if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { - purple_debug_error("msn", "User %s not found!\n", who); - return FALSE; - } - - msn_user_remove_group_id(user, group_id); - - return TRUE; -} - -void -msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, const char *new_group_name) -{ - const char *new_group_id; - MsnCallbackState *state; - - g_return_if_fail(userlist != NULL); - g_return_if_fail(userlist->session != NULL); - - state = msn_callback_state_new(userlist->session); - msn_callback_state_set_who(state, who); - msn_callback_state_set_action(state, MSN_MOVE_BUDDY); - msn_callback_state_set_old_group_name(state, old_group_name); - msn_callback_state_set_new_group_name(state, new_group_name); - - new_group_id = msn_userlist_find_group_id(userlist, new_group_name); - - if (new_group_id == NULL) - { - msn_add_group(userlist->session, state, new_group_name); - return; - } - - /* add the contact to the new group, and remove it from the old one in - * the callback - */ - msn_add_contact_to_group(userlist->session, state, who, new_group_id); -} - -/*load userlist from the Blist file cache*/ -void -msn_userlist_load(MsnSession *session) -{ - PurpleAccount *account = session->account; - PurpleConnection *gc = purple_account_get_connection(account); - GSList *l; - MsnUser * user; - - g_return_if_fail(gc != NULL); - - for (l = purple_find_buddies(account, NULL); l != NULL; - l = g_slist_delete_link(l, l)) { - PurpleBuddy *buddy = l->data; - - user = msn_userlist_find_add_user(session->userlist, - purple_buddy_get_name(buddy), NULL); - purple_buddy_set_protocol_data(buddy, user); - msn_user_set_op(user, MSN_LIST_FL_OP); - } - for (l = session->account->permit; l != NULL; l = l->next) - { - user = msn_userlist_find_add_user(session->userlist, - (char *)l->data,NULL); - msn_user_set_op(user, MSN_LIST_AL_OP); - } - for (l = session->account->deny; l != NULL; l = l->next) - { - user = msn_userlist_find_add_user(session->userlist, - (char *)l->data,NULL); - msn_user_set_op(user, MSN_LIST_BL_OP); - } - -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msn/userlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/** - * @file userlist.h MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef MSN_USERLIST_H -#define MSN_USERLIST_H - -typedef struct _MsnUserList MsnUserList; - -typedef enum -{ - MSN_LIST_FL, /**< Forward list */ - MSN_LIST_AL, /**< Allow list */ - MSN_LIST_BL, /**< Block list */ - MSN_LIST_RL, /**< Reverse list */ - MSN_LIST_PL /**< Pending list */ -} MsnListId; - -#include "group.h" -#include "msn.h" -#include "user.h" - -struct _MsnUserList -{ - MsnSession *session; - - GList *users; /* Contains MsnUsers */ - GList *groups; /* Contains MsnGroups */ - - GQueue *buddy_icon_requests; - int buddy_icon_window; - guint buddy_icon_request_timer; - -}; - -gboolean msn_userlist_user_is_in_group(MsnUser *user, const char * group_id); -gboolean msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id); - -void msn_got_lst_user(MsnSession *session, MsnUser *user, - MsnListOp list_op, GSList *group_ids); - -MsnUserList *msn_userlist_new(MsnSession *session); -void msn_userlist_destroy(MsnUserList *userlist); - -void msn_userlist_add_user(MsnUserList *userlist, MsnUser *user); -void msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user); - -MsnUser * msn_userlist_find_user(MsnUserList *userlist, const char *passport); -MsnUser * msn_userlist_find_add_user(MsnUserList *userlist, - const char *passport, const char *userName); -MsnUser * msn_userlist_find_user_with_id(MsnUserList *userlist, const char *uid); -MsnUser * msn_userlist_find_user_with_mobile_phone(MsnUserList *userlist, const char *number); - -void msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group); -void msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group); -MsnGroup *msn_userlist_find_group_with_id(MsnUserList *userlist, const char *id); -MsnGroup *msn_userlist_find_group_with_name(MsnUserList *userlist, const char *name); -const char * msn_userlist_find_group_id(MsnUserList *userlist, - const char *group_name); -const char *msn_userlist_find_group_name(MsnUserList *userlist, const char *group_id); -void msn_userlist_rename_group_id(MsnUserList *userlist, const char *group_id, - const char *new_name); -void msn_userlist_remove_group_id(MsnUserList *userlist, const char *group_id); - -void msn_userlist_rem_buddy(MsnUserList *userlist, const char *who); -void msn_userlist_add_buddy(MsnUserList *userlist, - const char *who, const char *group_name); -void msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, - const char *new_group_name); - -gboolean msn_userlist_add_buddy_to_group(MsnUserList *userlist, const char *who, - const char *group_name); -gboolean msn_userlist_rem_buddy_from_group(MsnUserList *userlist, - const char *who, - const char *group_name); - -void msn_userlist_add_buddy_to_list(MsnUserList *userlist, const char *who, - MsnListId list_id); -void msn_userlist_rem_buddy_from_list(MsnUserList *userlist, const char *who, - MsnListId list_id); - -void msn_userlist_load(MsnSession *session); - -#endif /* MSN_USERLIST_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,344 +0,0 @@ -/** - * @file cmdproc.c MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "cmdproc.h" - -MsnCmdProc * -msn_cmdproc_new(MsnSession *session) -{ - MsnCmdProc *cmdproc; - - cmdproc = g_new0(MsnCmdProc, 1); - - cmdproc->session = session; - cmdproc->txqueue = g_queue_new(); - cmdproc->history = msn_history_new(); - - return cmdproc; -} - -void -msn_cmdproc_destroy(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(cmdproc->txqueue); - - msn_history_destroy(cmdproc->history); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - g_free(cmdproc); -} - -void -msn_cmdproc_process_queue(MsnCmdProc *cmdproc) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(cmdproc->txqueue)) != NULL) - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - g_queue_push_tail(cmdproc->txqueue, trans); -} - -static void -show_debug_cmd(MsnCmdProc *cmdproc, gboolean incoming, const char *command) -{ - MsnServConn *servconn; - const char *names[] = { "NS", "SB" }; - char *show; - char tmp; - size_t len; - - servconn = cmdproc->servconn; - len = strlen(command); - show = g_strdup(command); - - tmp = (incoming) ? 'S' : 'C'; - - if ((show[len - 1] == '\n') && (show[len - 2] == '\r')) - { - show[len - 2] = '\0'; - } - - purple_debug_misc("msn", "%c: %s %03d: %s\n", tmp, - names[servconn->type], servconn->num, show); - - g_free(show); -} - -void -msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnServConn *servconn; - char *data; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - msn_history_add(cmdproc->history, trans); - - data = msn_transaction_to_string(trans); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - if (trans->callbacks == NULL) - trans->callbacks = g_hash_table_lookup(cmdproc->cbs_table->cmds, - trans->command); - - if (trans->payload != NULL) - { - data = g_realloc(data, len + trans->payload_len); - memcpy(data + len, trans->payload, trans->payload_len); - len += trans->payload_len; - - /* - * We're done with trans->payload. Free it so that the memory - * doesn't sit around in cmdproc->history. - */ - g_free(trans->payload); - trans->payload = NULL; - trans->payload_len = 0; - } - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnServConn *servconn; - char *data; - char *params = NULL; - va_list arg; - size_t len; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - servconn = cmdproc->servconn; - - if (!servconn->connected) - return; - - if (format != NULL) - { - va_start(arg, format); - params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - if (params != NULL) - data = g_strdup_printf("%s %s\r\n", command, params); - else - data = g_strdup_printf("%s\r\n", command); - - g_free(params); - - len = strlen(data); - - show_debug_cmd(cmdproc, FALSE, data); - - msn_servconn_write(servconn, data, len); - - g_free(data); -} - -void -msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(command != NULL); - - if (!cmdproc->servconn->connected) - return; - - trans = g_new0(MsnTransaction, 1); - - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_cmdproc_process_payload(MsnCmdProc *cmdproc, char *payload, - int payload_len) -{ - MsnCommand *last; - - g_return_if_fail(cmdproc != NULL); - - last = cmdproc->last_cmd; - last->payload = g_memdup(payload, payload_len); - last->payload_len = payload_len; - - if (last->payload_cb != NULL) - last->payload_cb(cmdproc, last, payload, payload_len); -} - -void -msn_cmdproc_process_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnMsgTypeCb cb; - - if (msn_message_get_content_type(msg) == NULL) - { - purple_debug_misc("msn", "failed to find message content\n"); - return; - } - - cb = g_hash_table_lookup(cmdproc->cbs_table->msgs, - msn_message_get_content_type(msg)); - - if (cb == NULL) - { - purple_debug_warning("msn", "Unhandled content-type '%s'\n", - msn_message_get_content_type(msg)); - - return; - } - - cb(cmdproc, msg); -} - -void -msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransCb cb = NULL; - MsnTransaction *trans = NULL; - - if (cmd->trId) - trans = msn_history_find(cmdproc->history, cmd->trId); - - if (trans != NULL) - if (trans->timer) - purple_timeout_remove(trans->timer); - - if (g_ascii_isdigit(cmd->command[0])) - { - if (trans != NULL) - { - MsnErrorCb error_cb = NULL; - int error; - - error = atoi(cmd->command); - - if (trans->error_cb != NULL) - error_cb = trans->error_cb; - - if (error_cb == NULL && cmdproc->cbs_table->errors != NULL) - error_cb = g_hash_table_lookup(cmdproc->cbs_table->errors, trans->command); - - if (error_cb != NULL) - { - error_cb(cmdproc, trans, error); - } - else - { -#if 1 - msn_error_handle(cmdproc->session, error); -#else - purple_debug_warning("msn", "Unhandled error '%s'\n", - cmd->command); -#endif - } - - return; - } - } - - if (cmdproc->cbs_table->async != NULL) - cb = g_hash_table_lookup(cmdproc->cbs_table->async, cmd->command); - - if (cb == NULL && trans != NULL) - { - cmd->trans = trans; - - if (trans->callbacks != NULL) - cb = g_hash_table_lookup(trans->callbacks, cmd->command); - } - - if (cb == NULL && cmdproc->cbs_table->fallback != NULL) - cb = g_hash_table_lookup(cmdproc->cbs_table->fallback, cmd->command); - - if (cb != NULL) - { - cb(cmdproc, cmd); - } - else - { - purple_debug_warning("msn", "Unhandled command '%s'\n", - cmd->command); - } - - if (trans != NULL && trans->pendent_cmd != NULL) - msn_transaction_unqueue_cmd(trans, cmdproc); -} - -void -msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command) -{ - show_debug_cmd(cmdproc, TRUE, command); - - if (cmdproc->last_cmd != NULL) - msn_command_destroy(cmdproc->last_cmd); - - cmdproc->last_cmd = msn_command_from_string(command); - - msn_cmdproc_process_cmd(cmdproc, cmdproc->last_cmd); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/cmdproc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/** - * @file cmdproc.h MSN command processor functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_CMDPROC_H_ -#define _MSN_CMDPROC_H_ - -typedef struct _MsnCmdProc MsnCmdProc; - -#include "session.h" -#include "servconn.h" -#include "error.h" -#include "command.h" -#include "table.h" -#include "history.h" - -struct _MsnCmdProc -{ - MsnSession *session; - MsnServConn *servconn; - - GQueue *txqueue; - - MsnCommand *last_cmd; - - MsnTable *cbs_table; - - MsnHistory *history; - - void *data; /**< Extra data, like the switchboard. */ -}; - -MsnCmdProc *msn_cmdproc_new(MsnSession *session); -void msn_cmdproc_destroy(MsnCmdProc *cmdproc); - -void msn_cmdproc_process_queue(MsnCmdProc *cmdproc); - -void msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); -void msn_cmdproc_queue_trans(MsnCmdProc *cmdproc, - MsnTransaction *trans); -void msn_cmdproc_send(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); -void msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, - const char *format, ...); - -void msn_cmdproc_process_msg(MsnCmdProc *cmdproc, - MsnMessage *msg); -void msn_cmdproc_process_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd); -void msn_cmdproc_process_cmd_text(MsnCmdProc *cmdproc, const char *command); -void msn_cmdproc_process_payload(MsnCmdProc *cmdproc, - char *payload, int payload_len); - -void msn_cmdproc_disconnect(MsnCmdProc *cmdproc); - -#endif /* _MSN_CMDPROC_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -/** - * @file command.c MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "command.h" - -static gboolean -is_num(char *str) -{ - char *c; - for (c = str; *c; c++) { - if (!(g_ascii_isdigit(*c))) - return FALSE; - } - - return TRUE; -} - -MsnCommand * -msn_command_from_string(const char *string) -{ - MsnCommand *cmd; - char *tmp; - char *param_start; - - g_return_val_if_fail(string != NULL, NULL); - - tmp = g_strdup(string); - param_start = strchr(tmp, ' '); - - cmd = g_new0(MsnCommand, 1); - cmd->command = tmp; - - if (param_start) - { - *param_start++ = '\0'; - cmd->params = g_strsplit(param_start, " ", 0); - } - - if (cmd->params != NULL) - { - int c; - - for (c = 0; cmd->params[c]; c++); - cmd->param_count = c; - - if (cmd->param_count) { - char *param = cmd->params[0]; - cmd->trId = is_num(param) ? atoi(param) : 0; - } else { - cmd->trId = 0; - } - } - else - cmd->trId = 0; - - msn_command_ref(cmd); - - return cmd; -} - -void -msn_command_destroy(MsnCommand *cmd) -{ - g_return_if_fail(cmd != NULL); - - if (cmd->ref_count > 0) - { - msn_command_unref(cmd); - return; - } - - if (cmd->payload != NULL) - g_free(cmd->payload); - - g_free(cmd->command); - g_strfreev(cmd->params); - g_free(cmd); -} - -MsnCommand * -msn_command_ref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - - cmd->ref_count++; - return cmd; -} - -MsnCommand * -msn_command_unref(MsnCommand *cmd) -{ - g_return_val_if_fail(cmd != NULL, NULL); - g_return_val_if_fail(cmd->ref_count > 0, NULL); - - cmd->ref_count--; - - if (cmd->ref_count == 0) - { - msn_command_destroy(cmd); - return NULL; - } - - return cmd; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/command.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/** - * @file command.h MSN command functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_COMMAND_H -#define _MSN_COMMAND_H - -typedef struct _MsnCommand MsnCommand; - -#include "cmdproc.h" -#include "transaction.h" - -typedef void (*MsnPayloadCb)(MsnCmdProc *cmdproc, MsnCommand *cmd, - char *payload, size_t len); - -/** - * A received command. - */ -struct _MsnCommand -{ - unsigned int trId; - - char *command; - char **params; - int param_count; - - int ref_count; - - MsnTransaction *trans; - - char *payload; - size_t payload_len; - - MsnPayloadCb payload_cb; -}; - -MsnCommand *msn_command_from_string(const char *string); -void msn_command_destroy(MsnCommand *cmd); -MsnCommand *msn_command_ref(MsnCommand *cmd); -MsnCommand *msn_command_unref(MsnCommand *cmd); - -#endif /* _MSN_COMMAND_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/** - * @file dialog.c Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "msn.h" -#include "dialog.h" - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *group; - gboolean add; - -} MsnAddRemData; - -/* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed. - * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */ -static void -msn_complete_sync_issue(MsnAddRemData *data) -{ - PurpleBuddy *buddy; - PurpleGroup *group = NULL; - - if (data->group != NULL) - group = purple_find_group(data->group); - - if (group != NULL) - buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group); - else - buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who); - - if (buddy != NULL) - purple_blist_remove_buddy(buddy); -} - -static void -msn_add_cb(MsnAddRemData *data) -{ - MsnSession *session; - MsnUserList *userlist; - - msn_complete_sync_issue(data); - - session = data->gc->proto_data; - userlist = session->userlist; - - msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group); - - g_free(data->group); - g_free(data->who); - g_free(data); -} - -static void -msn_rem_cb(MsnAddRemData *data) -{ - MsnSession *session; - MsnUserList *userlist; - - msn_complete_sync_issue(data); - - session = data->gc->proto_data; - userlist = session->userlist; - - msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group); - - g_free(data->group); - g_free(data->who); - g_free(data); -} - -void -msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name) -{ - PurpleConnection *gc; - PurpleAccount *account; - MsnAddRemData *data; - char *msg, *reason; - - account = session->account; - gc = purple_account_get_connection(account); - - data = g_new0(MsnAddRemData, 1); - data->who = g_strdup(passport); - data->group = g_strdup(group_name); - data->gc = gc; - - msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - if (group_name != NULL) - { - reason = g_strdup_printf(_("%s on the local list is " - "inside the group \"%s\" but not on " - "the server list. " - "Do you want this buddy to be added?"), - passport, group_name); - } - else - { - reason = g_strdup_printf(_("%s is on the local list but " - "not on the server list. " - "Do you want this buddy to be added?"), - passport); - } - - purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), data->who, NULL, - data, 2, - _("Yes"), G_CALLBACK(msn_add_cb), - _("No"), G_CALLBACK(msn_rem_cb)); - - g_free(reason); - g_free(msg); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/dialog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/** - * @file dialog.h Dialog functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_DIALOG_H_ -#define _MSN_DIALOG_H_ - -void msn_show_sync_issue(MsnSession *session, const char *passport, - const char *group_name); - -#endif /* _MSN_DIALOG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,505 +0,0 @@ -/** - * @file directconn.c MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "directconn.h" - -#include "slp.h" -#include "slpmsg.h" - -/************************************************************************** - * Directconn Specific - **************************************************************************/ - -void -msn_directconn_send_handshake(MsnDirectConn *directconn) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - g_return_if_fail(directconn != NULL); - - slplink = directconn->slplink; - - slpmsg = msn_slpmsg_new(slplink); - slpmsg->flags = 0x100; - - if (directconn->nonce != NULL) - { - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - sscanf (directconn->nonce, "%08X-%04hX-%04hX-%04hX-%012" G_GINT64_MODIFIER "X", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - slpmsg->ack_id = t1; - slpmsg->ack_sub_id = t2 | (t3 << 16); - slpmsg->ack_size = t4 | t5; - } - - g_free(directconn->nonce); - - msn_slplink_send_slpmsg(slplink, slpmsg); - - directconn->acked =TRUE; -} - -/************************************************************************** - * Connection Functions - **************************************************************************/ - -#if 0 -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} -#endif - -static size_t -msn_directconn_write(MsnDirectConn *directconn, - const char *data, size_t len) -{ - char *buffer, *tmp; - size_t buf_size; - size_t ret; - guint32 sent_len; - - g_return_val_if_fail(directconn != NULL, 0); - - buf_size = len + 4; - buffer = tmp = g_malloc(buf_size); - - sent_len = GUINT32_TO_LE(len); - - memcpy(tmp, &sent_len, 4); - tmp += 4; - memcpy(tmp, data, len); - tmp += len; - - ret = write(directconn->fd, buffer, buf_size); - -#ifdef DEBUG_DC - char *str; - str = g_strdup_printf("%s/msntest/w%.4d.bin", g_get_home_dir(), directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(buffer, 1, buf_size, tf); - fclose(tf); - - g_free(str); -#endif - - g_free(buffer); - -#if 0 - /* Let's write the length of the data. */ - ret = write(directconn->fd, &len, sizeof(len)); - - /* Let's write the data. */ - ret = write(directconn->fd, data, len); - - char *str; - str = g_strdup_printf("/home/revo/msntest/w%.4d.bin", directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(&len, 1, sizeof(len), tf); - fwrite(data, 1, len, tf); - fclose(tf); - - g_free(str); -#endif - - directconn->c++; - - return ret; -} - -#if 0 -void -msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce) -{ - guint32 t1; - guint16 t2; - guint16 t3; - guint16 t4; - guint64 t5; - - g_return_if_fail(directconn != NULL); - g_return_if_fail(nonce != NULL); - - sscanf (nonce, "%08X-%04hX-%04hX-%04hX-%012llX", &t1, &t2, &t3, &t4, &t5); - - t1 = GUINT32_TO_LE(t1); - t2 = GUINT16_TO_LE(t2); - t3 = GUINT16_TO_LE(t3); - t4 = GUINT16_TO_BE(t4); - t5 = GUINT64_TO_BE(t5); - - directconn->slpheader = g_new0(MsnSlpHeader, 1); - - directconn->slpheader->ack_id = t1; - directconn->slpheader->ack_sub_id = t2 | (t3 << 16); - directconn->slpheader->ack_size = t4 | t5; -} -#endif - -void -msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - char *body; - size_t body_len; - - body = msn_message_gen_slp_body(msg, &body_len); - - msn_directconn_write(directconn, body, body_len); -} - -static void -msn_directconn_process_msg(MsnDirectConn *directconn, MsnMessage *msg) -{ - purple_debug_info("msn", "directconn: process_msg\n"); - - msn_slplink_process_msg(directconn->slplink, msg); -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - char *body; - size_t len, body_len; - - purple_debug_info("msn", "read_cb: %d, %d\n", source, cond); - - directconn = data; - - /* Let's read the length of the data. */ - len = read(directconn->fd, &body_len, sizeof(body_len)); - - if (len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - msn_directconn_destroy(directconn); - - return; - } - - body_len = GUINT32_FROM_LE(body_len); - - purple_debug_info("msn", "body_len=%" G_GSIZE_FORMAT "\n", body_len); - - if (body_len <= 0) - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - msn_directconn_destroy(directconn); - - return; - } - - body = g_try_malloc(body_len); - - if (body != NULL) - { - /* Let's read the data. */ - len = read(directconn->fd, body, body_len); - - purple_debug_info("msn", "len=%" G_GSIZE_FORMAT "\n", len); - } - else - { - purple_debug_error("msn", "Failed to allocate memory for read\n"); - len = 0; - } - - if (len > 0) - { - MsnMessage *msg; - -#ifdef DEBUG_DC - str = g_strdup_printf("/home/revo/msntest/r%.4d.bin", directconn->c); - - FILE *tf = g_fopen(str, "w"); - fwrite(body, 1, len, tf); - fclose(tf); - - g_free(str); -#endif - - directconn->c++; - - msg = msn_message_new_msnslp(); - msn_message_parse_slp_body(msg, body, body_len); - - msn_directconn_process_msg(directconn, msg); - } - else - { - /* ERROR */ - purple_debug_error("msn", "error reading\n"); - - msn_directconn_destroy(directconn); - } - - g_free(body); -} - -static void -connect_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnDirectConn* directconn; - int fd; - - purple_debug_misc("msn", "directconn: connect_cb: %d\n", source); - - directconn = data; - directconn->connect_data = NULL; - - if (TRUE) - { - fd = source; - } - else - { - struct sockaddr_in client_addr; - socklen_t client; - fd = accept (source, (struct sockaddr *)&client_addr, &client); - } - - directconn->fd = fd; - - if (fd > 0) - { - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, read_cb, - directconn); - - if (TRUE) - { - /* Send foo. */ - msn_directconn_write(directconn, "foo", strlen("foo") + 1); - - /* Send Handshake */ - msn_directconn_send_handshake(directconn); - } - else - { - } - } - else - { - /* ERROR */ - purple_debug_error("msn", "could not add input\n"); - - if (directconn->inpa) - purple_input_remove(directconn->inpa); - - close(directconn->fd); - } -} - -static void -directconn_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - if (error_message) - purple_debug_error("msn", "Error making direct connection: %s\n", error_message); - - connect_cb(data, source, PURPLE_INPUT_READ); -} - -gboolean -msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) -{ - MsnSession *session; - - g_return_val_if_fail(directconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, TRUE); - g_return_val_if_fail(port > 0, FALSE); - - session = directconn->slplink->session; - -#if 0 - if (session->http_method) - { - servconn->http_data->gateway_host = g_strdup(host); - } -#endif - - directconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, directconn_connect_cb, directconn); - - return (directconn->connect_data != NULL); -} - -#if 0 -void -msn_directconn_listen(MsnDirectConn *directconn) -{ - int port; - int fd; - - port = 7000; - - for (fd = -1; fd < 0;) - fd = create_listener(++port); - - directconn->fd = fd; - - directconn->inpa = purple_input_add(fd, PURPLE_INPUT_READ, connect_cb, - directconn); - - directconn->port = port; - directconn->c = 0; -} -#endif - -MsnDirectConn* -msn_directconn_new(MsnSlpLink *slplink) -{ - MsnDirectConn *directconn; - - directconn = g_new0(MsnDirectConn, 1); - - directconn->slplink = slplink; - - if (slplink->directconn != NULL) - purple_debug_info("msn", "got_transresp: LEAK\n"); - - slplink->directconn = directconn; - - return directconn; -} - -void -msn_directconn_destroy(MsnDirectConn *directconn) -{ - if (directconn->connect_data != NULL) - purple_proxy_connect_cancel(directconn->connect_data); - - if (directconn->inpa != 0) - purple_input_remove(directconn->inpa); - - if (directconn->fd >= 0) - close(directconn->fd); - - if (directconn->nonce != NULL) - g_free(directconn->nonce); - - directconn->slplink->directconn = NULL; - - g_free(directconn); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/directconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/** - * @file directconn.h MSN direct connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_DIRECTCONN_H_ -#define _MSN_DIRECTCONN_H_ - -typedef struct _MsnDirectConn MsnDirectConn; - -#include "slplink.h" -#include "slp.h" -#include "msg.h" - -struct _MsnDirectConn -{ - MsnSlpLink *slplink; - MsnSlpCall *initial_call; - - PurpleProxyConnectData *connect_data; - - gboolean acked; - - char *nonce; - - int fd; - - int port; - int inpa; - - int c; -}; - -MsnDirectConn *msn_directconn_new(MsnSlpLink *slplink); -gboolean msn_directconn_connect(MsnDirectConn *directconn, - const char *host, int port); -#if 0 -void msn_directconn_listen(MsnDirectConn *directconn); -#endif -void msn_directconn_send_msg(MsnDirectConn *directconn, MsnMessage *msg); -void msn_directconn_parse_nonce(MsnDirectConn *directconn, const char *nonce); -void msn_directconn_destroy(MsnDirectConn *directconn); -void msn_directconn_send_handshake(MsnDirectConn *directconn); - -#endif /* _MSN_DIRECTCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/** - * @file error.c Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "error.h" - -const char * -msn_error_get_text(unsigned int type, gboolean *debug) -{ - static char msg[MSN_BUF_LEN]; - *debug = FALSE; - - switch (type) { - case 0: - g_snprintf(msg, sizeof(msg), - _("Unable to parse message")); - *debug = TRUE; - break; - case 200: - g_snprintf(msg, sizeof(msg), - _("Syntax Error (probably a client bug)")); - *debug = TRUE; - break; - case 201: - g_snprintf(msg, sizeof(msg), - _("Invalid email address")); - break; - case 205: - g_snprintf(msg, sizeof(msg), _("User does not exist")); - break; - case 206: - g_snprintf(msg, sizeof(msg), - _("Fully qualified domain name missing")); - break; - case 207: - g_snprintf(msg, sizeof(msg), _("Already logged in")); - break; - case 208: - g_snprintf(msg, sizeof(msg), _("Invalid username")); - break; - case 209: - g_snprintf(msg, sizeof(msg), _("Invalid friendly name")); - break; - case 210: - g_snprintf(msg, sizeof(msg), _("List full")); - break; - case 215: - g_snprintf(msg, sizeof(msg), _("Already there")); - *debug = TRUE; - break; - case 216: - g_snprintf(msg, sizeof(msg), _("Not on list")); - break; - case 217: - g_snprintf(msg, sizeof(msg), _("User is offline")); - break; - case 218: - g_snprintf(msg, sizeof(msg), _("Already in the mode")); - *debug = TRUE; - break; - case 219: - g_snprintf(msg, sizeof(msg), _("Already in opposite list")); - *debug = TRUE; - break; - case 223: - g_snprintf(msg, sizeof(msg), _("Too many groups")); - break; - case 224: - g_snprintf(msg, sizeof(msg), _("Invalid group")); - break; - case 225: - g_snprintf(msg, sizeof(msg), _("User not in group")); - break; - case 229: - g_snprintf(msg, sizeof(msg), _("Group name too long")); - break; - case 230: - g_snprintf(msg, sizeof(msg), _("Cannot remove group zero")); - *debug = TRUE; - break; - case 231: - g_snprintf(msg, sizeof(msg), - _("Tried to add a user to a group " - "that doesn't exist")); - break; - case 280: - g_snprintf(msg, sizeof(msg), _("Switchboard failed")); - *debug = TRUE; - break; - case 281: - g_snprintf(msg, sizeof(msg), _("Notify transfer failed")); - *debug = TRUE; - break; - - case 300: - g_snprintf(msg, sizeof(msg), _("Required fields missing")); - *debug = TRUE; - break; - case 301: - g_snprintf(msg, sizeof(msg), _("Too many hits to a FND")); - *debug = TRUE; - break; - case 302: - g_snprintf(msg, sizeof(msg), _("Not logged in")); - break; - - case 500: - g_snprintf(msg, sizeof(msg), _("Service temporarily unavailable")); - break; - case 501: - g_snprintf(msg, sizeof(msg), _("Database server error")); - *debug = TRUE; - break; - case 502: - g_snprintf(msg, sizeof(msg), _("Command disabled")); - *debug = TRUE; - break; - case 510: - g_snprintf(msg, sizeof(msg), _("File operation error")); - *debug = TRUE; - break; - case 520: - g_snprintf(msg, sizeof(msg), _("Memory allocation error")); - *debug = TRUE; - break; - case 540: - g_snprintf(msg, sizeof(msg), _("Wrong CHL value sent to server")); - *debug = TRUE; - break; - - case 600: - g_snprintf(msg, sizeof(msg), _("Server busy")); - break; - case 601: - g_snprintf(msg, sizeof(msg), _("Server unavailable")); - break; - case 602: - g_snprintf(msg, sizeof(msg), _("Peer notification server down")); - *debug = TRUE; - break; - case 603: - g_snprintf(msg, sizeof(msg), _("Database connect error")); - *debug = TRUE; - break; - case 604: - g_snprintf(msg, sizeof(msg), - _("Server is going down (abandon ship)")); - break; - case 605: - g_snprintf(msg, sizeof(msg), _("Server unavailable")); - break; - - case 707: - g_snprintf(msg, sizeof(msg), _("Error creating connection")); - *debug = TRUE; - break; - case 710: - g_snprintf(msg, sizeof(msg), - _("CVR parameters are either unknown or not allowed")); - *debug = TRUE; - break; - case 711: - g_snprintf(msg, sizeof(msg), _("Unable to write")); - break; - case 712: - g_snprintf(msg, sizeof(msg), _("Session overload")); - *debug = TRUE; - break; - case 713: - g_snprintf(msg, sizeof(msg), _("User is too active")); - break; - case 714: - g_snprintf(msg, sizeof(msg), _("Too many sessions")); - break; - case 715: - g_snprintf(msg, sizeof(msg), _("Passport not verified")); - break; - case 717: - g_snprintf(msg, sizeof(msg), _("Bad friend file")); - *debug = TRUE; - break; - case 731: - g_snprintf(msg, sizeof(msg), _("Not expected")); - *debug = TRUE; - break; - - case 800: - g_snprintf(msg, sizeof(msg), - _("Friendly name changes too rapidly")); - break; - - case 910: - case 912: - case 918: - case 919: - case 921: - case 922: - g_snprintf(msg, sizeof(msg), _("Server too busy")); - break; - case 911: - case 917: - g_snprintf(msg, sizeof(msg), _("Authentication failed")); - break; - case 913: - g_snprintf(msg, sizeof(msg), _("Not allowed when offline")); - break; - case 914: - case 915: - case 916: - g_snprintf(msg, sizeof(msg), _("Server unavailable")); - break; - case 920: - g_snprintf(msg, sizeof(msg), _("Not accepting new users")); - break; - case 923: - g_snprintf(msg, sizeof(msg), - _("Kids Passport without parental consent")); - break; - case 924: - g_snprintf(msg, sizeof(msg), - _("Passport account not yet verified")); - break; - case 928: - g_snprintf(msg, sizeof(msg), _("Bad ticket")); - *debug = TRUE; - break; - - default: - g_snprintf(msg, sizeof(msg), _("Unknown Error Code %d"), type); - *debug = TRUE; - break; - } - - return msg; -} - -void -msn_error_handle(MsnSession *session, unsigned int type) -{ - char buf[MSN_BUF_LEN]; - gboolean debug; - - g_snprintf(buf, sizeof(buf), _("MSN Error: %s\n"), - msn_error_get_text(type, &debug)); - if (debug) - purple_debug_warning("msn", "error %d: %s\n", type, buf); - else - purple_notify_error(session->account->gc, NULL, buf, NULL); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/error.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - * @file error.h Error functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_ERROR_H_ -#define _MSN_ERROR_H_ - -#include "session.h" - -/** - * Returns the string representation of an error type. - * - * @param type The error type. - * @param debug Whether this should be treated as a debug log message or a user-visible error - * - * @return The string representation of the error type. - */ -const char *msn_error_get_text(unsigned int type, gboolean *debug); - -/** - * Handles an error. - * - * @param session The current session. - * @param type The error type. - */ -void msn_error_handle(MsnSession *session, unsigned int type); - -#endif /* _MSN_ERROR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/** - * @file group.c Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "group.h" - -MsnGroup * -msn_group_new(MsnUserList *userlist, int id, const char *name) -{ - MsnGroup *group; - - g_return_val_if_fail(id >= 0, NULL); - g_return_val_if_fail(name != NULL, NULL); - - group = g_new0(MsnGroup, 1); - - msn_userlist_add_group(userlist, group); - - group->id = id; - group->name = g_strdup(name); - - return group; -} - -void -msn_group_destroy(MsnGroup *group) -{ - g_return_if_fail(group != NULL); - - g_free(group->name); - g_free(group); -} - -void -msn_group_set_id(MsnGroup *group, int id) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(id >= 0); - - group->id = id; -} - -void -msn_group_set_name(MsnGroup *group, const char *name) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(name != NULL); - - if (group->name != NULL) - g_free(group->name); - - group->name = g_strdup(name); -} - -int -msn_group_get_id(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, -1); - - return group->id; -} - -const char * -msn_group_get_name(const MsnGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->name; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/** - * @file group.h Group functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_GROUP_H_ -#define _MSN_GROUP_H_ - -typedef struct _MsnGroup MsnGroup; - -#include - -#include "session.h" -#include "user.h" - -#include "userlist.h" - -/** - * A group. - */ -struct _MsnGroup -{ - MsnSession *session; /**< The MSN session. */ - - int id; /**< The group ID. */ - char *name; /**< The name of the group. */ -}; - -/**************************************************************************/ -/** @name Group API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new group structure. - * - * @param session The MSN session. - * @param id The group ID. - * @param name The name of the group. - * - * @return A new group structure. - */ -MsnGroup *msn_group_new(MsnUserList *userlist, int id, const char *name); - -/** - * Destroys a group structure. - * - * @param group The group to destroy. - */ -void msn_group_destroy(MsnGroup *group); - -/** - * Sets the ID for a group. - * - * @param group The group. - * @param id The ID. - */ -void msn_group_set_id(MsnGroup *group, int id); - -/** - * Sets the name for a group. - * - * @param group The group. - * @param name The name. - */ -void msn_group_set_name(MsnGroup *group, const char *name); - -/** - * Returns the ID for a group. - * - * @param group The group. - * - * @return The ID. - */ -int msn_group_get_id(const MsnGroup *group); - -/** - * Returns the name for a group. - * - * @param group The group. - * - * @return The name. - */ -const char *msn_group_get_name(const MsnGroup *group); -#endif /* _MSN_GROUP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/** - * @file history.c MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "history.h" - -MsnHistory * -msn_history_new(void) -{ - MsnHistory *history = g_new0(MsnHistory, 1); - - history->trId = 1; - - history->queue = g_queue_new(); - - return history; -} - -void -msn_history_destroy(MsnHistory *history) -{ - MsnTransaction *trans; - - while ((trans = g_queue_pop_head(history->queue)) != NULL) - msn_transaction_destroy(trans); - - g_queue_free(history->queue); - g_free(history); -} - -MsnTransaction * -msn_history_find(MsnHistory *history, unsigned int trId) -{ - MsnTransaction *trans; - GList *list; - - for (list = history->queue->head; list != NULL; list = list->next) - { - trans = list->data; - if (trans->trId == trId) - return trans; - } - - return NULL; -} - -void -msn_history_add(MsnHistory *history, MsnTransaction *trans) -{ - GQueue *queue; - - g_return_if_fail(history != NULL); - g_return_if_fail(trans != NULL); - - queue = history->queue; - - trans->trId = history->trId++; - - g_queue_push_tail(queue, trans); - - if (queue->length > MSN_HIST_ELEMS) - { - trans = g_queue_pop_head(queue); - msn_transaction_destroy(trans); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/history.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - * @file history.h MSN history functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_HISTORY_H -#define _MSN_HISTORY_H - -#define MSN_HIST_ELEMS 0x30 - -typedef struct _MsnHistory MsnHistory; - -#include "transaction.h" - -/** - * The history. - */ -struct _MsnHistory -{ - GQueue *queue; - unsigned int trId; -}; - -MsnHistory *msn_history_new(void); -void msn_history_destroy(MsnHistory *history); -MsnTransaction *msn_history_find(MsnHistory *history, unsigned int triId); -void msn_history_add(MsnHistory *history, MsnTransaction *trans); - -#endif /* _MSN_HISTORY_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,775 +0,0 @@ -/** - * @file httpmethod.c HTTP connection method - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "debug.h" -#include "httpconn.h" - -typedef struct -{ - MsnHttpConn *httpconn; - char *body; - size_t body_len; -} MsnHttpQueueData; - -static void -msn_httpconn_process_queue(MsnHttpConn *httpconn) -{ - httpconn->waiting_response = FALSE; - - if (httpconn->queue != NULL) - { - MsnHttpQueueData *queue_data; - - queue_data = (MsnHttpQueueData *)httpconn->queue->data; - - httpconn->queue = g_list_remove(httpconn->queue, queue_data); - - msn_httpconn_write(queue_data->httpconn, - queue_data->body, - queue_data->body_len); - - g_free(queue_data->body); - g_free(queue_data); - } -} - -static gboolean -msn_httpconn_parse_data(MsnHttpConn *httpconn, const char *buf, - size_t size, char **ret_buf, size_t *ret_size, - gboolean *error) -{ - const char *s, *c; - char *header, *body; - const char *body_start; - char *tmp; - size_t body_len = 0; - gboolean wasted = FALSE; - - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(buf != NULL, FALSE); - g_return_val_if_fail(size > 0, FALSE); - g_return_val_if_fail(ret_buf != NULL, FALSE); - g_return_val_if_fail(ret_size != NULL, FALSE); - g_return_val_if_fail(error != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "HTTP: parsing data {%s}\n", buf); -#endif - - /* Healthy defaults. */ - body = NULL; - - *ret_buf = NULL; - *ret_size = 0; - *error = FALSE; - - /* First, some tests to see if we have a full block of stuff. */ - if (((strncmp(buf, "HTTP/1.1 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) != 0)) && - ((strncmp(buf, "HTTP/1.0 200 OK\r\n", 17) != 0) && - (strncmp(buf, "HTTP/1.0 100 Continue\r\n", 23) != 0))) - { - *error = TRUE; - - return FALSE; - } - - if (strncmp(buf, "HTTP/1.1 100 Continue\r\n", 23) == 0) - { - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - return FALSE; - - s += 4; - - if (*s == '\0') - { - *ret_buf = g_strdup(""); - *ret_size = 0; - - msn_httpconn_process_queue(httpconn); - - return TRUE; - } - - buf = s; - size -= (s - buf); - } - - if ((s = strstr(buf, "\r\n\r\n")) == NULL) - /* Need to wait for the full HTTP header to arrive */ - return FALSE; - - s += 4; /* Skip \r\n */ - header = g_strndup(buf, s - buf); - body_start = s; - body_len = size - (body_start - buf); - - if ((s = purple_strcasestr(header, "Content-Length: ")) != NULL) - { - int tmp_len; - - s += strlen("Content-Length: "); - - if ((c = strchr(s, '\r')) == NULL) - { - g_free(header); - - return FALSE; - } - - tmp = g_strndup(s, c - s); - tmp_len = atoi(tmp); - g_free(tmp); - - if (body_len != tmp_len) - { - /* Need to wait for the full packet to arrive */ - - g_free(header); - -#if 0 - purple_debug_warning("msn", - "body length (%d) != content length (%d)\n", - body_len, tmp_len); -#endif - - return FALSE; - } - } - - body = g_malloc0(body_len + 1); - memcpy(body, body_start, body_len); - -#ifdef MSN_DEBUG_HTTP - purple_debug_misc("msn", "Incoming HTTP buffer (header): {%s\r\n}\n", - header); -#endif - - /* Now we should be able to process the data. */ - if ((s = purple_strcasestr(header, "X-MSN-Messenger: ")) != NULL) - { - char *full_session_id, *gw_ip, *session_action; - char *t, *session_id; - char **elems, **cur, **tokens; - - full_session_id = gw_ip = session_action = NULL; - - s += strlen("X-MSN-Messenger: "); - - if ((c = strchr(s, '\r')) == NULL) - { - msn_session_set_error(httpconn->session, - MSN_ERROR_HTTP_MALFORMED, NULL); - purple_debug_error("msn", "Malformed X-MSN-Messenger field.\n{%s}\n", - buf); - - g_free(body); - return FALSE; - } - - tmp = g_strndup(s, c - s); - - elems = g_strsplit(tmp, "; ", 0); - - for (cur = elems; *cur != NULL; cur++) - { - tokens = g_strsplit(*cur, "=", 2); - - if (strcmp(tokens[0], "SessionID") == 0) - full_session_id = tokens[1]; - else if (strcmp(tokens[0], "GW-IP") == 0) - gw_ip = tokens[1]; - else if (strcmp(tokens[0], "Session") == 0) - session_action = tokens[1]; - else - g_free(tokens[1]); - - g_free(tokens[0]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - g_free(tmp); - - if ((session_action != NULL) && (strcmp(session_action, "close") == 0)) - wasted = TRUE; - - g_free(session_action); - - t = strchr(full_session_id, '.'); - session_id = g_strndup(full_session_id, t - full_session_id); - - if (!wasted) - { - g_free(httpconn->full_session_id); - httpconn->full_session_id = full_session_id; - - g_free(httpconn->session_id); - httpconn->session_id = session_id; - - g_free(httpconn->host); - httpconn->host = gw_ip; - } - else - { - MsnServConn *servconn; - - /* It's going to die. */ - /* poor thing */ - - servconn = httpconn->servconn; - - /* I'll be honest, I don't fully understand all this, but this - * causes crashes, Stu. */ - /* if (servconn != NULL) - servconn->wasted = TRUE; */ - - g_free(full_session_id); - g_free(session_id); - g_free(gw_ip); - } - } - - g_free(header); - - *ret_buf = body; - *ret_size = body_len; - - msn_httpconn_process_queue(httpconn); - - return TRUE; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - MsnServConn *servconn; - MsnSession *session; - char buf[MSN_BUF_LEN]; - char *cur, *end, *old_rx_buf; - int len, cur_len; - char *result_msg = NULL; - size_t result_len = 0; - gboolean error = FALSE; - - httpconn = data; - servconn = NULL; - session = httpconn->session; - - len = read(httpconn->fd, buf, sizeof(buf) - 1); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) - { - purple_debug_error("msn", "HTTP: Read error\n"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - buf[len] = '\0'; - - httpconn->rx_buf = g_realloc(httpconn->rx_buf, len + httpconn->rx_len + 1); - memcpy(httpconn->rx_buf + httpconn->rx_len, buf, len + 1); - httpconn->rx_len += len; - - if (!msn_httpconn_parse_data(httpconn, httpconn->rx_buf, httpconn->rx_len, - &result_msg, &result_len, &error)) - { - /* Either we must wait for more input, or something went wrong */ - if (error) - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - httpconn->servconn->processing = FALSE; - - servconn = httpconn->servconn; - - if (error) - { - purple_debug_error("msn", "HTTP: Special error\n"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - if (result_len == 0) - { - /* Nothing to do here */ -#if 0 - purple_debug_info("msn", "HTTP: nothing to do here\n"); -#endif - g_free(result_msg); - return; - } - - g_free(servconn->rx_buf); - servconn->rx_buf = result_msg; - servconn->rx_len = result_len; - - end = old_rx_buf = servconn->rx_buf; - - servconn->processing = TRUE; - - do - { - cur = end; - - if (servconn->payload_len) - { - if (servconn->payload_len > servconn->rx_len) - /* The payload is still not complete. */ - break; - - cur_len = servconn->payload_len; - end += cur_len; - } - else - { - end = strstr(cur, "\r\n"); - - if (end == NULL) - /* The command is still not complete. */ - break; - - *end = '\0'; - end += 2; - cur_len = end - cur; - } - - servconn->rx_len -= cur_len; - - if (servconn->payload_len) - { - msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len); - servconn->payload_len = 0; - } - else - { - msn_cmdproc_process_cmd_text(servconn->cmdproc, cur); - } - } while (servconn->connected && servconn->rx_len > 0); - - if (servconn->connected) - { - if (servconn->rx_len > 0) - servconn->rx_buf = g_memdup(cur, servconn->rx_len); - else - servconn->rx_buf = NULL; - } - - servconn->processing = FALSE; - - if (servconn->wasted) - msn_servconn_destroy(servconn); - - g_free(old_rx_buf); -} - -static void -httpconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnHttpConn *httpconn; - int ret, writelen; - - httpconn = data; - writelen = purple_circ_buffer_get_max_read(httpconn->tx_buf); - - if (writelen == 0) - { - purple_input_remove(httpconn->tx_handler); - httpconn->tx_handler = 0; - return; - } - - ret = write(httpconn->fd, httpconn->tx_buf->outptr, writelen); - if (ret <= 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - /* Error! */ - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE); - return; - } - - purple_circ_buffer_mark_read(httpconn->tx_buf, ret); - - /* TODO: I don't think these 2 lines are needed. Remove them? */ - if (ret == writelen) - httpconn_write_cb(data, source, cond); -} - -static gboolean -write_raw(MsnHttpConn *httpconn, const char *data, size_t data_len) -{ - ssize_t res; /* result of the write operation */ - - if (httpconn->tx_handler == 0) - res = write(httpconn->fd, data, data_len); - else - { - res = -1; - errno = EAGAIN; - } - - if ((res <= 0) && ((errno != EAGAIN) && (errno != EWOULDBLOCK))) - { - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_WRITE); - return FALSE; - } - - if (res < 0 || res < data_len) - { - if (res < 0) - res = 0; - if (httpconn->tx_handler == 0 && httpconn->fd) - httpconn->tx_handler = purple_input_add(httpconn->fd, - PURPLE_INPUT_WRITE, httpconn_write_cb, httpconn); - purple_circ_buffer_append(httpconn->tx_buf, data + res, - data_len - res); - } - - return TRUE; -} - -static char * -msn_httpconn_proxy_auth(MsnHttpConn *httpconn) -{ - PurpleAccount *account; - PurpleProxyInfo *gpi; - const char *username, *password; - char *auth = NULL; - - account = httpconn->session->account; - - gpi = purple_proxy_get_setup(account); - - if (gpi == NULL || !(purple_proxy_info_get_type(gpi) == PURPLE_PROXY_HTTP || - purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_ENVVAR)) - return NULL; - - username = purple_proxy_info_get_username(gpi); - password = purple_proxy_info_get_password(gpi); - - if (username != NULL) { - char *tmp; - auth = g_strdup_printf("%s:%s", username, password ? password : ""); - tmp = purple_base64_encode((const guchar *)auth, strlen(auth)); - g_free(auth); - auth = g_strdup_printf("Proxy-Authorization: Basic %s\r\n", tmp); - g_free(tmp); - } - - return auth; -} - -static gboolean -msn_httpconn_poll(gpointer data) -{ - MsnHttpConn *httpconn; - char *header; - char *auth; - - httpconn = data; - - g_return_val_if_fail(httpconn != NULL, FALSE); - - if ((httpconn->host == NULL) || (httpconn->full_session_id == NULL)) - { - /* There's no need to poll if the session is not fully established */ - return TRUE; - } - - if (httpconn->waiting_response) - { - /* There's no need to poll if we're already waiting for a response */ - return TRUE; - } - - auth = msn_httpconn_proxy_auth(httpconn); - - header = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?Action=poll&SessionID=%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: 0\r\n\r\n", - httpconn->host, - httpconn->full_session_id, - httpconn->host, - auth ? auth : ""); - - g_free(auth); - - if (write_raw(httpconn, header, strlen(header))) - httpconn->waiting_response = TRUE; - - g_free(header); - - return TRUE; -} - -ssize_t -msn_httpconn_write(MsnHttpConn *httpconn, const char *body, size_t body_len) -{ - char *params; - char *data; - int header_len; - char *auth; - const char *server_types[] = { "NS", "SB" }; - const char *server_type; - char *host; - MsnServConn *servconn; - - /* TODO: remove http data from servconn */ - - g_return_val_if_fail(httpconn != NULL, 0); - g_return_val_if_fail(body != NULL, 0); - g_return_val_if_fail(body_len > 0, 0); - - servconn = httpconn->servconn; - - if (httpconn->waiting_response) - { - MsnHttpQueueData *queue_data = g_new0(MsnHttpQueueData, 1); - - queue_data->httpconn = httpconn; - queue_data->body = g_memdup(body, body_len); - queue_data->body_len = body_len; - - httpconn->queue = g_list_append(httpconn->queue, queue_data); - - return body_len; - } - - server_type = server_types[servconn->type]; - - if (httpconn->virgin) - { - host = "gateway.messenger.hotmail.com"; - - /* The first time servconn->host is the host we should connect to. */ - params = g_strdup_printf("Action=open&Server=%s&IP=%s", - server_type, - servconn->host); - httpconn->virgin = FALSE; - } - else - { - /* The rest of the times servconn->host is the gateway host. */ - host = httpconn->host; - - if (host == NULL || httpconn->full_session_id == NULL) - { - purple_debug_warning("msn", "Attempted HTTP write before session is established\n"); - return -1; - } - - params = g_strdup_printf("SessionID=%s", - httpconn->full_session_id); - } - - auth = msn_httpconn_proxy_auth(httpconn); - - data = g_strdup_printf( - "POST http://%s/gateway/gateway.dll?%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Accept-Language: en-us\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Proxy-Connection: Keep-Alive\r\n" - "%s" /* Proxy auth */ - "Connection: Keep-Alive\r\n" - "Pragma: no-cache\r\n" - "Content-Type: application/x-msn-messenger\r\n" - "Content-Length: %d\r\n\r\n", - host, - params, - host, - auth ? auth : "", - (int) body_len); - - g_free(params); - - g_free(auth); - - header_len = strlen(data); - data = g_realloc(data, header_len + body_len); - memcpy(data + header_len, body, body_len); - - if (write_raw(httpconn, data, header_len + body_len)) - httpconn->waiting_response = TRUE; - - g_free(data); - - return body_len; -} - -MsnHttpConn * -msn_httpconn_new(MsnServConn *servconn) -{ - MsnHttpConn *httpconn; - - g_return_val_if_fail(servconn != NULL, NULL); - - httpconn = g_new0(MsnHttpConn, 1); - - purple_debug_info("msn", "new httpconn (%p)\n", httpconn); - - /* TODO: Remove this */ - httpconn->session = servconn->session; - - httpconn->servconn = servconn; - - httpconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - httpconn->tx_handler = 0; - - return httpconn; -} - -void -msn_httpconn_destroy(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - purple_debug_info("msn", "destroy httpconn (%p)\n", httpconn); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - g_free(httpconn->full_session_id); - - g_free(httpconn->session_id); - - g_free(httpconn->host); - - purple_circ_buffer_destroy(httpconn->tx_buf); - if (httpconn->tx_handler > 0) - purple_input_remove(httpconn->tx_handler); - - g_free(httpconn); -} - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - MsnHttpConn *httpconn; - - httpconn = data; - httpconn->connect_data = NULL; - httpconn->fd = source; - - if (source >= 0) - { - httpconn->inpa = purple_input_add(httpconn->fd, PURPLE_INPUT_READ, - read_cb, data); - - httpconn->timer = purple_timeout_add_seconds(3, msn_httpconn_poll, httpconn); - - msn_httpconn_process_queue(httpconn); - } - else - { - purple_debug_error("msn", "HTTP: Connection error\n"); - msn_servconn_got_error(httpconn->servconn, MSN_SERVCONN_ERROR_CONNECT); - } -} - -gboolean -msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port) -{ - g_return_val_if_fail(httpconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - if (httpconn->connected) - msn_httpconn_disconnect(httpconn); - - httpconn->connect_data = purple_proxy_connect(NULL, httpconn->session->account, - host, 80, connect_cb, httpconn); - - if (httpconn->connect_data != NULL) - { - httpconn->waiting_response = TRUE; - httpconn->connected = TRUE; - } - - return httpconn->connected; -} - -void -msn_httpconn_disconnect(MsnHttpConn *httpconn) -{ - g_return_if_fail(httpconn != NULL); - - if (!httpconn->connected) - return; - - if (httpconn->connect_data != NULL) - { - purple_proxy_connect_cancel(httpconn->connect_data); - httpconn->connect_data = NULL; - } - - if (httpconn->timer) - { - purple_timeout_remove(httpconn->timer); - httpconn->timer = 0; - } - - if (httpconn->inpa > 0) - { - purple_input_remove(httpconn->inpa); - httpconn->inpa = 0; - } - - close(httpconn->fd); - httpconn->fd = -1; - - g_free(httpconn->rx_buf); - httpconn->rx_buf = NULL; - httpconn->rx_len = 0; - - httpconn->connected = FALSE; - - /* msn_servconn_disconnect(httpconn->servconn); */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/httpconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/** - * @file httpconn.h HTTP connection - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_HTTPCONN_H_ -#define _MSN_HTTPCONN_H_ - -typedef struct _MsnHttpConn MsnHttpConn; - -#include "circbuffer.h" -#include "servconn.h" - -/** - * An HTTP Connection. - */ -struct _MsnHttpConn -{ - MsnSession *session; /**< The MSN Session. */ - MsnServConn *servconn; /**< The connection object. */ - - PurpleProxyConnectData *connect_data; - - char *full_session_id; /**< The full session id. */ - char *session_id; /**< The trimmed session id. */ - - int timer; /**< The timer for polling. */ - - gboolean waiting_response; /**< The flag that states if we are waiting - a response from the server. */ - gboolean connected; /**< The flag that states if the connection is on. */ - gboolean virgin; /**< The flag that states if this connection - should specify the host (not gateway) to - connect to. */ - - char *host; /**< The HTTP gateway host. */ - GList *queue; /**< The queue of data chunks to write. */ - - int fd; /**< The connection's file descriptor. */ - guint inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer length. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; -}; - -/** - * Creates a new HTTP connection object. - * - * @param servconn The connection object. - * - * @return The new object. - */ -MsnHttpConn *msn_httpconn_new(MsnServConn *servconn); - -/** - * Destroys an HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_destroy(MsnHttpConn *httpconn); - -/** - * Writes a chunk of data to the HTTP connection. - * - * @param servconn The server connection. - * @param data The data to write. - * @param data_len The size of the data to write. - * - * @return The number of bytes written. - */ -ssize_t msn_httpconn_write(MsnHttpConn *httpconn, const char *data, size_t data_len); - -/** - * Connects the HTTP connection object to a host. - * - * @param httpconn The HTTP connection object. - * @param host The host to connect to. - * @param port The port to connect to. - */ -gboolean msn_httpconn_connect(MsnHttpConn *httpconn, - const char *host, int port); - -/** - * Disconnects the HTTP connection object. - * - * @param httpconn The HTTP connection object. - */ -void msn_httpconn_disconnect(MsnHttpConn *httpconn); - -#endif /* _MSN_HTTPCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MSNP9SOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - dialog.c \ - dialog.h \ - directconn.c \ - directconn.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - slpsession.c \ - slpsession.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msn-utils.c \ - msn-utils.h - -AM_CFLAGS = $(st) - -libmsn_la_LDFLAGS = -module -avoid-version - -if STATIC_MSN - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNP9SOURCES) -libmsn_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmsn.la -libmsn_la_SOURCES = $(MSNP9SOURCES) -libmsn_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1039 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/msnp9 -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MSN_FALSE@libmsn_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libmsn_la_SOURCES_DIST = cmdproc.c cmdproc.h command.c command.h \ - dialog.c dialog.h directconn.c directconn.h error.c error.h \ - group.c group.h history.c history.h httpconn.c httpconn.h \ - msg.c msg.h msn.c msn.h nexus.c nexus.h notification.c \ - notification.h object.c object.h page.c page.h servconn.c \ - servconn.h session.c session.h slp.c slp.h slpcall.c slpcall.h \ - slplink.c slplink.h slpmsg.c slpmsg.h slpsession.c \ - slpsession.h state.c state.h switchboard.c switchboard.h \ - sync.c sync.h table.c table.h transaction.c transaction.h \ - user.c user.h userlist.c userlist.h msn-utils.c msn-utils.h -am__objects_1 = libmsn_la-cmdproc.lo libmsn_la-command.lo \ - libmsn_la-dialog.lo libmsn_la-directconn.lo libmsn_la-error.lo \ - libmsn_la-group.lo libmsn_la-history.lo libmsn_la-httpconn.lo \ - libmsn_la-msg.lo libmsn_la-msn.lo libmsn_la-nexus.lo \ - libmsn_la-notification.lo libmsn_la-object.lo \ - libmsn_la-page.lo libmsn_la-servconn.lo libmsn_la-session.lo \ - libmsn_la-slp.lo libmsn_la-slpcall.lo libmsn_la-slplink.lo \ - libmsn_la-slpmsg.lo libmsn_la-slpsession.lo libmsn_la-state.lo \ - libmsn_la-switchboard.lo libmsn_la-sync.lo libmsn_la-table.lo \ - libmsn_la-transaction.lo libmsn_la-user.lo \ - libmsn_la-userlist.lo libmsn_la-msn-utils.lo -@STATIC_MSN_FALSE@am_libmsn_la_OBJECTS = $(am__objects_1) -@STATIC_MSN_TRUE@am_libmsn_la_OBJECTS = $(am__objects_1) -libmsn_la_OBJECTS = $(am_libmsn_la_OBJECTS) -@STATIC_MSN_FALSE@am_libmsn_la_rpath = -rpath $(pkgdir) -@STATIC_MSN_TRUE@am_libmsn_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmsn_la_SOURCES) -DIST_SOURCES = $(am__libmsn_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MSNP9SOURCES = \ - cmdproc.c \ - cmdproc.h \ - command.c \ - command.h \ - dialog.c \ - dialog.h \ - directconn.c \ - directconn.h \ - error.c \ - error.h \ - group.c \ - group.h \ - history.c \ - history.h \ - httpconn.c \ - httpconn.h \ - msg.c \ - msg.h \ - msn.c \ - msn.h \ - nexus.c \ - nexus.h \ - notification.c \ - notification.h \ - object.c \ - object.h \ - page.c \ - page.h \ - servconn.c \ - servconn.h \ - session.c \ - session.h \ - slp.c \ - slp.h \ - slpcall.c \ - slpcall.h \ - slplink.c \ - slplink.h \ - slpmsg.c \ - slpmsg.h \ - slpsession.c \ - slpsession.h \ - state.c \ - state.h \ - switchboard.c \ - switchboard.h \ - sync.c \ - sync.h \ - table.c \ - table.h \ - transaction.c \ - transaction.h \ - user.c \ - user.h \ - userlist.c \ - userlist.h \ - msn-utils.c \ - msn-utils.h - -AM_CFLAGS = $(st) -libmsn_la_LDFLAGS = -module -avoid-version -@STATIC_MSN_FALSE@st = -@STATIC_MSN_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MSN_TRUE@noinst_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_SOURCES = $(MSNP9SOURCES) -@STATIC_MSN_TRUE@libmsn_la_SOURCES = $(MSNP9SOURCES) -@STATIC_MSN_TRUE@libmsn_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MSN_FALSE@pkg_LTLIBRARIES = libmsn.la -@STATIC_MSN_FALSE@libmsn_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/msnp9/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/msnp9/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmsn.la: $(libmsn_la_OBJECTS) $(libmsn_la_DEPENDENCIES) - $(LINK) $(am_libmsn_la_rpath) $(libmsn_la_LDFLAGS) $(libmsn_la_OBJECTS) $(libmsn_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-cmdproc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-command.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-dialog.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-directconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-history.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-httpconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msn-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-msn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-nexus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-notification.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-page.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-servconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpcall.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slplink.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpmsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-slpsession.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-state.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-switchboard.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-sync.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-table.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-transaction.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmsn_la-userlist.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmsn_la-cmdproc.lo: cmdproc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-cmdproc.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-cmdproc.Tpo" -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo" "$(DEPDIR)/libmsn_la-cmdproc.Plo"; else rm -f "$(DEPDIR)/libmsn_la-cmdproc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdproc.c' object='libmsn_la-cmdproc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-cmdproc.lo `test -f 'cmdproc.c' || echo '$(srcdir)/'`cmdproc.c - -libmsn_la-command.lo: command.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-command.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-command.Tpo" -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-command.Tpo" "$(DEPDIR)/libmsn_la-command.Plo"; else rm -f "$(DEPDIR)/libmsn_la-command.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='command.c' object='libmsn_la-command.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c - -libmsn_la-dialog.lo: dialog.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-dialog.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-dialog.Tpo" -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-dialog.Tpo" "$(DEPDIR)/libmsn_la-dialog.Plo"; else rm -f "$(DEPDIR)/libmsn_la-dialog.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dialog.c' object='libmsn_la-dialog.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-dialog.lo `test -f 'dialog.c' || echo '$(srcdir)/'`dialog.c - -libmsn_la-directconn.lo: directconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-directconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-directconn.Tpo" -c -o libmsn_la-directconn.lo `test -f 'directconn.c' || echo '$(srcdir)/'`directconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-directconn.Tpo" "$(DEPDIR)/libmsn_la-directconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-directconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='directconn.c' object='libmsn_la-directconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-directconn.lo `test -f 'directconn.c' || echo '$(srcdir)/'`directconn.c - -libmsn_la-error.lo: error.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-error.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-error.Tpo" -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-error.Tpo" "$(DEPDIR)/libmsn_la-error.Plo"; else rm -f "$(DEPDIR)/libmsn_la-error.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error.c' object='libmsn_la-error.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-error.lo `test -f 'error.c' || echo '$(srcdir)/'`error.c - -libmsn_la-group.lo: group.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-group.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-group.Tpo" -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-group.Tpo" "$(DEPDIR)/libmsn_la-group.Plo"; else rm -f "$(DEPDIR)/libmsn_la-group.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group.c' object='libmsn_la-group.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c - -libmsn_la-history.lo: history.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-history.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-history.Tpo" -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-history.Tpo" "$(DEPDIR)/libmsn_la-history.Plo"; else rm -f "$(DEPDIR)/libmsn_la-history.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='history.c' object='libmsn_la-history.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-history.lo `test -f 'history.c' || echo '$(srcdir)/'`history.c - -libmsn_la-httpconn.lo: httpconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-httpconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-httpconn.Tpo" -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-httpconn.Tpo" "$(DEPDIR)/libmsn_la-httpconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-httpconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='httpconn.c' object='libmsn_la-httpconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-httpconn.lo `test -f 'httpconn.c' || echo '$(srcdir)/'`httpconn.c - -libmsn_la-msg.lo: msg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msg.Tpo" -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msg.Tpo" "$(DEPDIR)/libmsn_la-msg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msg.c' object='libmsn_la-msg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msg.lo `test -f 'msg.c' || echo '$(srcdir)/'`msg.c - -libmsn_la-msn.lo: msn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msn.Tpo" -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msn.Tpo" "$(DEPDIR)/libmsn_la-msn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msn.c' object='libmsn_la-msn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msn.lo `test -f 'msn.c' || echo '$(srcdir)/'`msn.c - -libmsn_la-nexus.lo: nexus.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-nexus.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-nexus.Tpo" -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-nexus.Tpo" "$(DEPDIR)/libmsn_la-nexus.Plo"; else rm -f "$(DEPDIR)/libmsn_la-nexus.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nexus.c' object='libmsn_la-nexus.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-nexus.lo `test -f 'nexus.c' || echo '$(srcdir)/'`nexus.c - -libmsn_la-notification.lo: notification.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-notification.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-notification.Tpo" -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-notification.Tpo" "$(DEPDIR)/libmsn_la-notification.Plo"; else rm -f "$(DEPDIR)/libmsn_la-notification.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='notification.c' object='libmsn_la-notification.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-notification.lo `test -f 'notification.c' || echo '$(srcdir)/'`notification.c - -libmsn_la-object.lo: object.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-object.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-object.Tpo" -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-object.Tpo" "$(DEPDIR)/libmsn_la-object.Plo"; else rm -f "$(DEPDIR)/libmsn_la-object.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='object.c' object='libmsn_la-object.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-object.lo `test -f 'object.c' || echo '$(srcdir)/'`object.c - -libmsn_la-page.lo: page.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-page.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-page.Tpo" -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-page.Tpo" "$(DEPDIR)/libmsn_la-page.Plo"; else rm -f "$(DEPDIR)/libmsn_la-page.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='page.c' object='libmsn_la-page.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-page.lo `test -f 'page.c' || echo '$(srcdir)/'`page.c - -libmsn_la-servconn.lo: servconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-servconn.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-servconn.Tpo" -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-servconn.Tpo" "$(DEPDIR)/libmsn_la-servconn.Plo"; else rm -f "$(DEPDIR)/libmsn_la-servconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='servconn.c' object='libmsn_la-servconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-servconn.lo `test -f 'servconn.c' || echo '$(srcdir)/'`servconn.c - -libmsn_la-session.lo: session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-session.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-session.Tpo" -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-session.Tpo" "$(DEPDIR)/libmsn_la-session.Plo"; else rm -f "$(DEPDIR)/libmsn_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='session.c' object='libmsn_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmsn_la-slp.lo: slp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slp.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slp.Tpo" -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slp.Tpo" "$(DEPDIR)/libmsn_la-slp.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slp.c' object='libmsn_la-slp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slp.lo `test -f 'slp.c' || echo '$(srcdir)/'`slp.c - -libmsn_la-slpcall.lo: slpcall.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpcall.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpcall.Tpo" -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpcall.Tpo" "$(DEPDIR)/libmsn_la-slpcall.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpcall.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpcall.c' object='libmsn_la-slpcall.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpcall.lo `test -f 'slpcall.c' || echo '$(srcdir)/'`slpcall.c - -libmsn_la-slplink.lo: slplink.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slplink.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slplink.Tpo" -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slplink.Tpo" "$(DEPDIR)/libmsn_la-slplink.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slplink.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slplink.c' object='libmsn_la-slplink.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slplink.lo `test -f 'slplink.c' || echo '$(srcdir)/'`slplink.c - -libmsn_la-slpmsg.lo: slpmsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpmsg.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpmsg.Tpo" -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo" "$(DEPDIR)/libmsn_la-slpmsg.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpmsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpmsg.c' object='libmsn_la-slpmsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpmsg.lo `test -f 'slpmsg.c' || echo '$(srcdir)/'`slpmsg.c - -libmsn_la-slpsession.lo: slpsession.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-slpsession.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-slpsession.Tpo" -c -o libmsn_la-slpsession.lo `test -f 'slpsession.c' || echo '$(srcdir)/'`slpsession.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-slpsession.Tpo" "$(DEPDIR)/libmsn_la-slpsession.Plo"; else rm -f "$(DEPDIR)/libmsn_la-slpsession.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='slpsession.c' object='libmsn_la-slpsession.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-slpsession.lo `test -f 'slpsession.c' || echo '$(srcdir)/'`slpsession.c - -libmsn_la-state.lo: state.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-state.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-state.Tpo" -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-state.Tpo" "$(DEPDIR)/libmsn_la-state.Plo"; else rm -f "$(DEPDIR)/libmsn_la-state.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='state.c' object='libmsn_la-state.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-state.lo `test -f 'state.c' || echo '$(srcdir)/'`state.c - -libmsn_la-switchboard.lo: switchboard.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-switchboard.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-switchboard.Tpo" -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-switchboard.Tpo" "$(DEPDIR)/libmsn_la-switchboard.Plo"; else rm -f "$(DEPDIR)/libmsn_la-switchboard.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='switchboard.c' object='libmsn_la-switchboard.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-switchboard.lo `test -f 'switchboard.c' || echo '$(srcdir)/'`switchboard.c - -libmsn_la-sync.lo: sync.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-sync.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-sync.Tpo" -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-sync.Tpo" "$(DEPDIR)/libmsn_la-sync.Plo"; else rm -f "$(DEPDIR)/libmsn_la-sync.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sync.c' object='libmsn_la-sync.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-sync.lo `test -f 'sync.c' || echo '$(srcdir)/'`sync.c - -libmsn_la-table.lo: table.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-table.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-table.Tpo" -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-table.Tpo" "$(DEPDIR)/libmsn_la-table.Plo"; else rm -f "$(DEPDIR)/libmsn_la-table.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='table.c' object='libmsn_la-table.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-table.lo `test -f 'table.c' || echo '$(srcdir)/'`table.c - -libmsn_la-transaction.lo: transaction.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-transaction.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-transaction.Tpo" -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-transaction.Tpo" "$(DEPDIR)/libmsn_la-transaction.Plo"; else rm -f "$(DEPDIR)/libmsn_la-transaction.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='transaction.c' object='libmsn_la-transaction.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-transaction.lo `test -f 'transaction.c' || echo '$(srcdir)/'`transaction.c - -libmsn_la-user.lo: user.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-user.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-user.Tpo" -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-user.Tpo" "$(DEPDIR)/libmsn_la-user.Plo"; else rm -f "$(DEPDIR)/libmsn_la-user.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='user.c' object='libmsn_la-user.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c - -libmsn_la-userlist.lo: userlist.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-userlist.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-userlist.Tpo" -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-userlist.Tpo" "$(DEPDIR)/libmsn_la-userlist.Plo"; else rm -f "$(DEPDIR)/libmsn_la-userlist.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='userlist.c' object='libmsn_la-userlist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-userlist.lo `test -f 'userlist.c' || echo '$(srcdir)/'`userlist.c - -libmsn_la-msn-utils.lo: msn-utils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -MT libmsn_la-msn-utils.lo -MD -MP -MF "$(DEPDIR)/libmsn_la-msn-utils.Tpo" -c -o libmsn_la-msn-utils.lo `test -f 'msn-utils.c' || echo '$(srcdir)/'`msn-utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmsn_la-msn-utils.Tpo" "$(DEPDIR)/libmsn_la-msn-utils.Plo"; else rm -f "$(DEPDIR)/libmsn_la-msn-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msn-utils.c' object='libmsn_la-msn-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmsn_la_CFLAGS) $(CFLAGS) -c -o libmsn_la-msn-utils.lo `test -f 'msn-utils.c' || echo '$(srcdir)/'`msn-utils.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmsn -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmsn -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = cmdproc.c \ - command.c \ - dialog.c \ - directconn.c \ - error.c \ - group.c \ - history.c \ - httpconn.c \ - msg.c \ - msn.c \ - nexus.c \ - notification.c \ - object.c \ - page.c \ - servconn.c \ - session.c \ - slp.c \ - slpcall.c \ - slplink.c \ - slpmsg.c \ - slpsession.c \ - state.c \ - switchboard.c \ - sync.c \ - table.c \ - transaction.c \ - user.c \ - userlist.c \ - msn-utils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,787 +0,0 @@ -/** - * @file msg.c Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msg.h" - -MsnMessage * -msn_message_new(MsnMsgType type) -{ - MsnMessage *msg; - - msg = g_new0(MsnMessage, 1); - msg->type = type; - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message new (%p)(%d)\n", msg, type); -#endif - - msg->attr_table = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, g_free); - - msn_message_ref(msg); - - return msg; -} - -void -msn_message_destroy(MsnMessage *msg) -{ - g_return_if_fail(msg != NULL); - - if (msg->ref_count > 0) - { - msn_message_unref(msg); - - return; - } - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message destroy (%p)\n", msg); -#endif - - if (msg->remote_user != NULL) - g_free(msg->remote_user); - - if (msg->body != NULL) - g_free(msg->body); - - if (msg->content_type != NULL) - g_free(msg->content_type); - - if (msg->charset != NULL) - g_free(msg->charset); - - g_hash_table_destroy(msg->attr_table); - g_list_free(msg->attr_list); - - g_free(msg); -} - -MsnMessage * -msn_message_ref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - msg->ref_count++; - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message ref (%p)[%d]\n", msg, msg->ref_count); -#endif - - return msg; -} - -MsnMessage * -msn_message_unref(MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->ref_count > 0, NULL); - - msg->ref_count--; - -#ifdef MSN_DEBUG_MSG - purple_debug_info("msn", "message unref (%p)[%d]\n", msg, msg->ref_count); -#endif - - if (msg->ref_count == 0) - { - msn_message_destroy(msg); - - return NULL; - } - - return msg; -} - -MsnMessage * -msn_message_new_plain(const char *message) -{ - MsnMessage *msg; - char *message_cr; - - msg = msn_message_new(MSN_MSG_TEXT); - msn_message_set_attr(msg, "User-Agent", PACKAGE_NAME "/" DISPLAY_VERSION); - msn_message_set_content_type(msg, "text/plain"); - msn_message_set_charset(msg, "UTF-8"); - msn_message_set_flag(msg, 'A'); - msn_message_set_attr(msg, "X-MMS-IM-Format", - "FN=MS%20Sans%20Serif; EF=; CO=0; PF=0"); - - message_cr = purple_str_add_cr(message); - msn_message_set_bin_data(msg, message_cr, strlen(message_cr)); - g_free(message_cr); - - return msg; -} - -MsnMessage * -msn_message_new_msnslp(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_SLP); - - msn_message_set_attr(msg, "User-Agent", NULL); - - msg->msnslp_message = TRUE; - - msn_message_set_flag(msg, 'D'); - msn_message_set_content_type(msg, "application/x-msnmsgrp2p"); - - return msg; -} - -MsnMessage * -msn_message_new_nudge(void) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_NUDGE); - msn_message_set_content_type(msg, "text/x-msnmsgr-datacast"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, "ID: 1\r\n", 7); - - return msg; -} - -void -msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) -{ - MsnSlpHeader header; - const char *tmp; - int body_len; - - tmp = body; - - if (len < sizeof(header)) { - g_return_if_reached(); - } - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - /* Import the body. */ - body_len = len - (tmp - body); - /* msg->body_len = msg->msnslp_header.length; */ - - if (body_len > 0) { - msg->body_len = len - (tmp - body); - msg->body = g_malloc0(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - tmp += body_len; - } -} - -void -msn_message_parse_payload(MsnMessage *msg, - const char *payload, size_t payload_len) -{ - char *tmp_base, *tmp; - const char *content_type; - char *end; - char **elems, **cur, **tokens; - - g_return_if_fail(payload != NULL); - - tmp_base = tmp = g_malloc0(payload_len + 1); - memcpy(tmp_base, payload, payload_len); - - /* Parse the attributes. */ - end = strstr(tmp, "\r\n\r\n"); - /* TODO? some clients use \r delimiters instead of \r\n, the official client - * doesn't send such messages, but does handle receiving them. We'll just - * avoid crashing for now */ - if (end == NULL) { - g_free(tmp_base); - g_return_if_reached(); - } - *end = '\0'; - - elems = g_strsplit(tmp, "\r\n", 0); - - for (cur = elems; *cur != NULL; cur++) - { - const char *key, *value; - - tokens = g_strsplit(*cur, ": ", 2); - - key = tokens[0]; - value = tokens[1]; - - if (!strcmp(key, "MIME-Version")) - { - g_strfreev(tokens); - continue; - } - - if (!strcmp(key, "Content-Type")) - { - char *charset, *c; - - if ((c = strchr(value, ';')) != NULL) - { - if ((charset = strchr(c, '=')) != NULL) - { - charset++; - msn_message_set_charset(msg, charset); - } - - *c = '\0'; - } - - msn_message_set_content_type(msg, value); - } - else - { - msn_message_set_attr(msg, key, value); - } - - g_strfreev(tokens); - } - - g_strfreev(elems); - - /* Proceed to the end of the "\r\n\r\n" */ - tmp = end + 4; - - /* Now we *should* be at the body. */ - content_type = msn_message_get_content_type(msg); - - if (content_type != NULL && - !strcmp(content_type, "application/x-msnmsgrp2p")) - { - MsnSlpHeader header; - MsnSlpFooter footer; - int body_len; - - if (payload_len - (tmp - tmp_base) < sizeof(header)) { - g_free(tmp_base); - g_return_if_reached(); - } - - msg->msnslp_message = TRUE; - - /* Import the header. */ - memcpy(&header, tmp, sizeof(header)); - tmp += sizeof(header); - - msg->msnslp_header.session_id = GUINT32_FROM_LE(header.session_id); - msg->msnslp_header.id = GUINT32_FROM_LE(header.id); - msg->msnslp_header.offset = GUINT64_FROM_LE(header.offset); - msg->msnslp_header.total_size = GUINT64_FROM_LE(header.total_size); - msg->msnslp_header.length = GUINT32_FROM_LE(header.length); - msg->msnslp_header.flags = GUINT32_FROM_LE(header.flags); - msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); - msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); - msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); - - body_len = payload_len - (tmp - tmp_base) - sizeof(footer); - - /* Import the body. */ - if (body_len > 0) { - msg->body_len = body_len; - msg->body = g_malloc0(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - tmp += body_len; - } - - /* Import the footer. */ - if (body_len >= 0) { - memcpy(&footer, tmp, sizeof(footer)); - tmp += sizeof(footer); - msg->msnslp_footer.value = GUINT32_FROM_BE(footer.value); - } - } - else - { - if (payload_len - (tmp - tmp_base) > 0) { - msg->body_len = payload_len - (tmp - tmp_base); - msg->body = g_malloc0(msg->body_len + 1); - memcpy(msg->body, tmp, msg->body_len); - } - } - - g_free(tmp_base); -} - -MsnMessage * -msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd) -{ - MsnMessage *msg; - - g_return_val_if_fail(cmd != NULL, NULL); - - msg = msn_message_new(MSN_MSG_UNKNOWN); - - msg->remote_user = g_strdup(cmd->params[0]); - /* msg->size = atoi(cmd->params[2]); */ - msg->cmd = cmd; - - return msg; -} - -char * -msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size) -{ - MsnSlpHeader header; - - char *tmp, *base; - const void *body; - size_t len, body_len; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = tmp = g_malloc(len + 1); - - body = msn_message_get_bin_data(msg, &body_len); - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(tmp, &header, 48); - tmp += 48; - - if (body != NULL) - { - memcpy(tmp, body, body_len); - tmp += body_len; - } - - if (ret_size != NULL) - *ret_size = tmp - base; - - return base; -} - -char * -msn_message_gen_payload(MsnMessage *msg, size_t *ret_size) -{ - GList *l; - char *n, *base, *end; - int len; - size_t body_len = 0; - const void *body; - - g_return_val_if_fail(msg != NULL, NULL); - - len = MSN_BUF_LEN; - - base = n = end = g_malloc(len + 1); - end += len; - - /* Standard header. */ - if (msg->charset == NULL) - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_snprintf(n, len, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - n += strlen(n); - - for (l = msg->attr_list; l != NULL; l = l->next) - { - const char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_snprintf(n, end - n, "%s: %s\r\n", key, value); - n += strlen(n); - } - - n += g_strlcpy(n, "\r\n", end - n); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - MsnSlpHeader header; - MsnSlpFooter footer; - - header.session_id = GUINT32_TO_LE(msg->msnslp_header.session_id); - header.id = GUINT32_TO_LE(msg->msnslp_header.id); - header.offset = GUINT64_TO_LE(msg->msnslp_header.offset); - header.total_size = GUINT64_TO_LE(msg->msnslp_header.total_size); - header.length = GUINT32_TO_LE(msg->msnslp_header.length); - header.flags = GUINT32_TO_LE(msg->msnslp_header.flags); - header.ack_id = GUINT32_TO_LE(msg->msnslp_header.ack_id); - header.ack_sub_id = GUINT32_TO_LE(msg->msnslp_header.ack_sub_id); - header.ack_size = GUINT64_TO_LE(msg->msnslp_header.ack_size); - - memcpy(n, &header, 48); - n += 48; - - if (body != NULL) - { - memcpy(n, body, body_len); - - n += body_len; - } - - footer.value = GUINT32_TO_BE(msg->msnslp_footer.value); - - memcpy(n, &footer, 4); - n += 4; - } - else - { - if (body != NULL) - { - memcpy(n, body, body_len); - n += body_len; - } - } - - if (ret_size != NULL) - { - *ret_size = n - base; - - if (*ret_size > 1664) - *ret_size = 1664; - } - - return base; -} - -void -msn_message_set_flag(MsnMessage *msg, char flag) -{ - g_return_if_fail(msg != NULL); - g_return_if_fail(flag != 0); - - msg->flag = flag; -} - -char -msn_message_get_flag(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, 0); - - return msg->flag; -} - -void -msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len) -{ - g_return_if_fail(msg != NULL); - - /* There is no need to waste memory on data we cannot send anyway */ - if (len > 1664) - len = 1664; - - if (msg->body != NULL) - g_free(msg->body); - - if (data != NULL && len > 0) - { - msg->body = g_malloc0(len + 1); - memcpy(msg->body, data, len); - msg->body_len = len; - } - else - { - msg->body = NULL; - msg->body_len = 0; - } -} - -const void * -msn_message_get_bin_data(const MsnMessage *msg, size_t *len) -{ - g_return_val_if_fail(msg != NULL, NULL); - - if (len) - *len = msg->body_len; - - return msg->body; -} - -void -msn_message_set_content_type(MsnMessage *msg, const char *type) -{ - g_return_if_fail(msg != NULL); - - if (msg->content_type != NULL) - g_free(msg->content_type); - - msg->content_type = (type != NULL) ? g_strdup(type) : NULL; -} - -const char * -msn_message_get_content_type(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->content_type; -} - -void -msn_message_set_charset(MsnMessage *msg, const char *charset) -{ - g_return_if_fail(msg != NULL); - - if (msg->charset != NULL) - g_free(msg->charset); - - msg->charset = (charset != NULL) ? g_strdup(charset) : NULL; -} - -const char * -msn_message_get_charset(const MsnMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msg->charset; -} - -void -msn_message_set_attr(MsnMessage *msg, const char *attr, const char *value) -{ - const char *temp; - char *new_attr; - - g_return_if_fail(msg != NULL); - g_return_if_fail(attr != NULL); - - temp = msn_message_get_attr(msg, attr); - - if (value == NULL) - { - if (temp != NULL) - { - GList *l; - - for (l = msg->attr_list; l != NULL; l = l->next) - { - if (!g_ascii_strcasecmp(l->data, attr)) - { - msg->attr_list = g_list_remove(msg->attr_list, l->data); - - break; - } - } - - g_hash_table_remove(msg->attr_table, attr); - } - - return; - } - - new_attr = g_strdup(attr); - - g_hash_table_insert(msg->attr_table, new_attr, g_strdup(value)); - - if (temp == NULL) - msg->attr_list = g_list_append(msg->attr_list, new_attr); -} - -const char * -msn_message_get_attr(const MsnMessage *msg, const char *attr) -{ - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(attr != NULL, NULL); - - return g_hash_table_lookup(msg->attr_table, attr); -} - -GHashTable * -msn_message_get_hashtable_from_body(const MsnMessage *msg) -{ - GHashTable *table; - size_t body_len; - const char *body; - char **elems, **cur, **tokens, *body_str; - - g_return_val_if_fail(msg != NULL, NULL); - - table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - body = msn_message_get_bin_data(msg, &body_len); - - g_return_val_if_fail(body != NULL, NULL); - - body_str = g_strndup(body, body_len); - elems = g_strsplit(body_str, "\r\n", 0); - g_free(body_str); - - for (cur = elems; *cur != NULL; cur++) - { - if (**cur == '\0') - break; - - tokens = g_strsplit(*cur, ": ", 2); - - if (tokens[0] != NULL && tokens[1] != NULL) - g_hash_table_insert(table, tokens[0], tokens[1]); - - g_free(tokens); - } - - g_strfreev(elems); - - return table; -} - -char * -msn_message_to_string(MsnMessage *msg) -{ - size_t body_len; - const char *body; - - g_return_val_if_fail(msg != NULL, NULL); - g_return_val_if_fail(msg->type == MSN_MSG_TEXT, NULL); - - body = msn_message_get_bin_data(msg, &body_len); - - return g_strndup(body, body_len); -} - -void -msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body) -{ - GString *str; - size_t body_len; - const char *body; - GList *l; - - g_return_if_fail(msg != NULL); - - str = g_string_new(NULL); - - /* Standard header. */ - if (msg->charset == NULL) - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s\r\n", - msg->content_type); - } - else - { - g_string_append_printf(str, - "MIME-Version: 1.0\r\n" - "Content-Type: %s; charset=%s\r\n", - msg->content_type, msg->charset); - } - - for (l = msg->attr_list; l; l = l->next) - { - char *key; - const char *value; - - key = l->data; - value = msn_message_get_attr(msg, key); - - g_string_append_printf(str, "%s: %s\r\n", key, value); - } - - g_string_append(str, "\r\n"); - - body = msn_message_get_bin_data(msg, &body_len); - - if (msg->msnslp_message) - { - g_string_append_printf(str, "Session ID: %u\r\n", msg->msnslp_header.session_id); - g_string_append_printf(str, "ID: %u\r\n", msg->msnslp_header.id); - g_string_append_printf(str, "Offset: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.offset); - g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.total_size); - g_string_append_printf(str, "Length: %u\r\n", msg->msnslp_header.length); - g_string_append_printf(str, "Flags: 0x%x\r\n", msg->msnslp_header.flags); - g_string_append_printf(str, "ACK ID: %u\r\n", msg->msnslp_header.ack_id); - g_string_append_printf(str, "SUB ID: %u\r\n", msg->msnslp_header.ack_sub_id); - g_string_append_printf(str, "ACK Size: %" G_GUINT64_FORMAT "\r\n", msg->msnslp_header.ack_size); - -#ifdef MSN_DEBUG_SLP_VERBOSE - if (body != NULL) - { - if (text_body) - { - g_string_append_len(str, body, body_len); - if (body[body_len - 1] == '\0') - { - str->len--; - g_string_append(str, " 0x00"); - } - g_string_append(str, "\r\n"); - } - else - { - int i; - for (i = 0; i < msg->body_len; i++) - { - g_string_append_printf(str, "%.2hhX ", body[i]); - if ((i % 16) == 15) - g_string_append(str, "\r\n"); - } - g_string_append(str, "\r\n"); - } - } -#endif - - g_string_append_printf(str, "Footer: %u\r\n", msg->msnslp_footer.value); - } - else - { - if (body != NULL) - { - g_string_append_len(str, body, body_len); - g_string_append(str, "\r\n"); - } - } - - purple_debug_info("msn", "Message %s:\n{%s}\n", info, str->str); - - g_string_free(str, TRUE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,349 +0,0 @@ -/** - * @file msg.h Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_MSG_H_ -#define _MSN_MSG_H_ - -typedef struct _MsnMessage MsnMessage; - -#include "session.h" -#include "user.h" - -#include "command.h" -#include "transaction.h" - -typedef void (*MsnMsgCb)(MsnMessage *, void *data); - -/* -typedef enum -{ - MSN_MSG_NORMAL, - MSN_MSG_SLP_SB, - MSN_MSG_SLP_DC - -} MsnMsgType; -*/ - -typedef enum -{ - MSN_MSG_UNKNOWN, - MSN_MSG_TEXT, - MSN_MSG_TYPING, - MSN_MSG_CAPS, - MSN_MSG_SLP, - MSN_MSG_NUDGE - -} MsnMsgType; - -typedef enum -{ - MSN_MSG_ERROR_NONE, /**< No error. */ - MSN_MSG_ERROR_TIMEOUT, /**< The message timedout. */ - MSN_MSG_ERROR_NAK, /**< The message could not be sent. */ - MSN_MSG_ERROR_SB, /**< The error comes from the switchboard. */ - MSN_MSG_ERROR_UNKNOWN /**< An unknown error occurred. */ - -} MsnMsgErrorType; - -typedef struct -{ - guint32 session_id; - guint32 id; - guint64 offset; - guint64 total_size; - guint32 length; - guint32 flags; - guint32 ack_id; - guint32 ack_sub_id; - guint64 ack_size; - -} MsnSlpHeader; - -typedef struct -{ - guint32 value; - -} MsnSlpFooter; - -/** - * A message. - */ -struct _MsnMessage -{ - size_t ref_count; /**< The reference count. */ - - MsnMsgType type; - - gboolean msnslp_message; - - char *remote_user; - char flag; - - char *content_type; - char *charset; - char *body; - gsize body_len; - - MsnSlpHeader msnslp_header; - MsnSlpFooter msnslp_footer; - - GHashTable *attr_table; - GList *attr_list; - - gboolean ack_ref; /**< A flag that states if this message has - been ref'ed for using it in a callback. */ - - MsnCommand *cmd; - MsnTransaction *trans; - - MsnMsgCb ack_cb; /**< The callback to call when we receive an ACK of this - message. */ - MsnMsgCb nak_cb; /**< The callback to call when we receive a NAK of this - message. */ - void *ack_data; /**< The data used by callbacks. */ - - MsnMsgErrorType error; /**< The error of the message. */ -}; - -/** - * Creates a new, empty message. - * - * @return A new message. - */ -MsnMessage *msn_message_new(MsnMsgType type); - -/** - * Creates a new, empty MSNSLP message. - * - * @return A new MSNSLP message. - */ -MsnMessage *msn_message_new_msnslp(void); - -/** - * Creates a new nudge message. - * - * @return A new nudge message. - */ -MsnMessage *msn_message_new_nudge(void); - -/** - * Creates a new plain message. - * - * @return A new plain message. - */ -MsnMessage *msn_message_new_plain(const char *message); - -/** - * Creates a MSNSLP ack message. - * - * @param acked_msg The message to acknowledge. - * - * @return A new MSNSLP ack message. - */ -MsnMessage *msn_message_new_msnslp_ack(MsnMessage *acked_msg); - -/** - * Creates a new message based off a command. - * - * @param session The MSN session. - * @param cmd The command. - * - * @return The new message. - */ -MsnMessage *msn_message_new_from_cmd(MsnSession *session, MsnCommand *cmd); - -/** - * Parses the payload of a message. - * - * @param msg The message. - * @param payload The payload. - * @param payload_len The length of the payload. - */ -void msn_message_parse_payload(MsnMessage *msg, const char *payload, - size_t payload_len); - -/** - * Destroys a message. - * - * @param msg The message to destroy. - */ -void msn_message_destroy(MsnMessage *msg); - -/** - * Increments the reference count on a message. - * - * @param msg The message. - * - * @return @a msg - */ -MsnMessage *msn_message_ref(MsnMessage *msg); - -/** - * Decrements the reference count on a message. - * - * This will destroy the structure if the count hits 0. - * - * @param msg The message. - * - * @return @a msg, or @c NULL if the new count is 0. - */ -MsnMessage *msn_message_unref(MsnMessage *msg); - -/** - * Generates the payload data of a message. - * - * @param msg The message. - * @param ret_size The returned size of the payload. - * - * @return The payload data of the message. - */ -char *msn_message_gen_payload(MsnMessage *msg, size_t *ret_size); - -/** - * Sets the flag for an outgoing message. - * - * @param msg The message. - * @param flag The flag. - */ -void msn_message_set_flag(MsnMessage *msg, char flag); - -/** - * Returns the flag for an outgoing message. - * - * @param msg The message. - * - * @return The flag. - */ -char msn_message_get_flag(const MsnMessage *msg); - -#if 0 -/** - * Sets the body of a message. - * - * @param msg The message. - * @param body The body of the message. - */ -void msn_message_set_body(MsnMessage *msg, const char *body); - -/** - * Returns the body of the message. - * - * @param msg The message. - * - * @return The body of the message. - */ -const char *msn_message_get_body(const MsnMessage *msg); -#endif -/** - * Sets the binary content of the message. - * - * @param msg The message. - * @param data The binary data. - * @param len The length of the data. - */ -void msn_message_set_bin_data(MsnMessage *msg, const void *data, size_t len); - -/** - * Returns the binary content of the message. - * - * @param msg The message. - * @param len The returned length of the data. - * - * @return The binary data. - */ -const void *msn_message_get_bin_data(const MsnMessage *msg, size_t *len); - -/** - * Sets the content type in a message. - * - * @param msg The message. - * @param type The content-type. - */ -void msn_message_set_content_type(MsnMessage *msg, const char *type); - -/** - * Returns the content type in a message. - * - * @param msg The message. - * - * @return The content-type. - */ -const char *msn_message_get_content_type(const MsnMessage *msg); - -/** - * Sets the charset in a message. - * - * @param msg The message. - * @param charset The charset. - */ -void msn_message_set_charset(MsnMessage *msg, const char *charset); - -/** - * Returns the charset in a message. - * - * @param msg The message. - * - * @return The charset. - */ -const char *msn_message_get_charset(const MsnMessage *msg); - -/** - * Sets an attribute in a message. - * - * @param msg The message. - * @param attr The attribute name. - * @param value The attribute value. - */ -void msn_message_set_attr(MsnMessage *msg, const char *attr, - const char *value); - -/** - * Returns an attribute from a message. - * - * @param msg The message. - * @param attr The attribute. - * - * @return The value, or @c NULL if not found. - */ -const char *msn_message_get_attr(const MsnMessage *msg, const char *attr); - -/** - * Parses the body and returns it in the form of a hashtable. - * - * @param msg The message. - * - * @return The resulting hashtable. - */ -GHashTable *msn_message_get_hashtable_from_body(const MsnMessage *msg); - -void msn_message_show_readable(MsnMessage *msg, const char *info, - gboolean text_body); - -void msn_message_parse_slp_body(MsnMessage *msg, const char *body, - size_t len); - -char *msn_message_gen_slp_body(MsnMessage *msg, size_t *ret_size); - -char *msn_message_to_string(MsnMessage *msg); - -#endif /* _MSN_MSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2362 +0,0 @@ -/** - * @file msn.c The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define PHOTO_SUPPORT 1 - -#include - -#include "msn.h" -#include "accountopt.h" -#include "eventloop.h" -#include "msg.h" -#include "page.h" -#include "pluginpref.h" -#include "prefs.h" -#include "session.h" -#include "smiley.h" -#include "state.h" -#include "util.h" -#include "cmds.h" -#include "core.h" -#include "prpl.h" -#include "msn-utils.h" -#include "version.h" - -#include "switchboard.h" -#include "notification.h" -#include "sync.h" -#include "slplink.h" - -#if PHOTO_SUPPORT -#include "imgstore.h" -#endif - -typedef struct -{ - PurpleConnection *gc; - const char *passport; - -} MsnMobileData; - -typedef struct -{ - PurpleConnection *gc; - char *name; - -} MsnGetInfoData; - -typedef struct -{ - MsnGetInfoData *info_data; - char *stripped; - char *url_buffer; - PurpleNotifyUserInfo *user_info; - char *photo_url_text; - -} MsnGetInfoStepTwoData; - -typedef struct -{ - PurpleConnection *gc; - const char *who; - char *msg; - PurpleMessageFlags flags; - time_t when; -} MsnIMData; - -typedef struct -{ - char *smile; - MsnObject *obj; -} MsnEmoticon; - -static const char * -msn_normalize(const PurpleAccount *account, const char *str) -{ - static char buf[BUF_LEN]; - char *tmp; - - g_return_val_if_fail(str != NULL, NULL); - - g_snprintf(buf, sizeof(buf), "%s%s", str, - (strchr(str, '@') ? "" : "@hotmail.com")); - - tmp = g_utf8_strdown(buf, -1); - strncpy(buf, tmp, sizeof(buf)); - g_free(tmp); - - return buf; -} - -static gboolean -msn_send_attention(PurpleConnection *gc, const char *username, guint type) -{ - MsnMessage *msg; - MsnSession *session; - MsnSwitchBoard *swboard; - - msg = msn_message_new_nudge(); - session = gc->proto_data; - swboard = msn_session_get_swboard(session, username, MSN_SB_FLAG_IM); - - if (swboard == NULL) - return FALSE; - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); - - return TRUE; -} - -static GList * -msn_attention_types(PurpleAccount *account) -{ - static GList *list = NULL; - - if (!list) { - list = g_list_append(list, purple_attention_type_new("Nudge", _("Nudge"), - _("%s has nudged you!"), _("Nudging %s..."))); - } - - return list; -} - -static GHashTable * -msn_get_account_text_table(PurpleAccount *unused) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} - -static PurpleCmdRet -msn_cmd_nudge(PurpleConversation *conv, const gchar *cmd, gchar **args, gchar **error, void *data) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - PurpleConnection *gc = purple_account_get_connection(account); - const gchar *username; - - username = purple_conversation_get_name(conv); - - purple_prpl_send_attention(gc, username, MSN_NUDGE); - - return PURPLE_CMD_RET_OK; -} - -static void -msn_act_id(PurpleConnection *gc, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - const char *alias; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - account = purple_connection_get_account(gc); - - if(entry && strlen(entry)) - alias = purple_url_encode(entry); - else - alias = ""; - - if (strlen(alias) > BUDDY_ALIAS_MAXLEN) - { - purple_notify_error(gc, NULL, - _("Your new MSN friendly name is too long."), NULL); - return; - } - - msn_cmdproc_send(cmdproc, "REA", "%s %s", - purple_account_get_username(account), - alias); -} - -static void -msn_set_prp(PurpleConnection *gc, const char *type, const char *entry) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (entry == NULL || *entry == '\0') - { - msn_cmdproc_send(cmdproc, "PRP", "%s", type); - } - else - { - msn_cmdproc_send(cmdproc, "PRP", "%s %s", type, - purple_url_encode(entry)); - } -} - -static void -msn_set_home_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHH", entry); -} - -static void -msn_set_work_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHW", entry); -} - -static void -msn_set_mobile_phone_cb(PurpleConnection *gc, const char *entry) -{ - msn_set_prp(gc, "PHM", entry); -} - -static void -enable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "Y"); -} - -static void -disable_msn_pages_cb(PurpleConnection *gc) -{ - msn_set_prp(gc, "MOB", "N"); -} - -static void -send_to_mobile(PurpleConnection *gc, const char *who, const char *entry) -{ - MsnTransaction *trans; - MsnSession *session; - MsnCmdProc *cmdproc; - MsnPage *page; - char *payload; - size_t payload_len; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - page = msn_page_new(); - msn_page_set_body(page, entry); - - payload = msn_page_gen_payload(page, &payload_len); - - trans = msn_transaction_new(cmdproc, "PGD", "%s 1 %d", who, payload_len); - - msn_transaction_set_payload(trans, payload, payload_len); - - msn_page_destroy(page); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -send_to_mobile_cb(MsnMobileData *data, const char *entry) -{ - send_to_mobile(data->gc, data->passport, entry); - g_free(data); -} - -static void -close_mobile_page_cb(MsnMobileData *data, const char *entry) -{ - g_free(data); -} - -/* -- */ - -static void -msn_show_set_friendly_name(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_input(gc, NULL, _("Set your friendly name."), - _("This is the name that other MSN buddies will " - "see you as."), - purple_connection_get_display_name(gc), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_act_id), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_home_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your home phone number."), NULL, - msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_home_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_work_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your work phone number."), NULL, - msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_work_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_phone(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - purple_request_input(gc, NULL, _("Set your mobile phone number."), NULL, - msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void -msn_show_set_mobile_pages(PurplePluginAction *action) -{ - PurpleConnection *gc; - - gc = (PurpleConnection *) action->context; - - purple_request_action(gc, NULL, _("Allow MSN Mobile pages?"), - _("Do you want to allow or disallow people on " - "your buddy list to send you MSN Mobile pages " - "to your cell phone or other mobile device?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), NULL, NULL, - gc, 3, - _("Allow"), G_CALLBACK(enable_msn_pages_cb), - _("Disallow"), G_CALLBACK(disable_msn_pages_cb), - _("Cancel"), NULL); -} - -static void -msn_show_hotmail_inbox(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = (PurpleConnection *) action->context; - session = gc->proto_data; - - if (session->passport_info.file == NULL) - { - purple_notify_error(gc, NULL, - _("This Hotmail account may not be active."), NULL); - return; - } - - purple_notify_uri(gc, session->passport_info.file); -} - -static void -show_send_to_mobile_cb(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - MsnSession *session; - MsnMobileData *data; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - session = gc->proto_data; - - data = g_new0(MsnMobileData, 1); - data->gc = gc; - data->passport = buddy->name; - - purple_request_input(gc, NULL, _("Send a mobile message."), NULL, - NULL, TRUE, FALSE, NULL, - _("Page"), G_CALLBACK(send_to_mobile_cb), - _("Close"), G_CALLBACK(close_mobile_page_cb), - purple_connection_get_account(gc), purple_buddy_get_name(buddy), NULL, - data); -} - -static gboolean -msn_offline_message(const PurpleBuddy *buddy) { - MsnUser *user; - if (buddy == NULL) - return FALSE; - user = buddy->proto_data; - return user && user->mobile; -} - -static void -initiate_chat_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - MsnSession *session; - MsnSwitchBoard *swboard; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - session = gc->proto_data; - - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, buddy->name); - - /* TODO: This might move somewhere else, after USR might be */ - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->conv = serv_got_joined_chat(gc, swboard->chat_id, "MSN Chat"); - swboard->flag = MSN_SB_FLAG_IM; - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - purple_account_get_username(buddy->account), NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - -static void -t_msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpLink *slplink = xfer->data; - msn_slplink_request_ft(slplink, xfer); -} - -static PurpleXfer* -msn_new_xfer(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnSlpLink *slplink; - PurpleXfer *xfer; - - session = gc->proto_data; - - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - if (xfer) - { - slplink = msn_session_get_slplink(session, who); - - xfer->data = slplink; - - purple_xfer_set_init_fnc(xfer, t_msn_xfer_init); - } - - return xfer; -} - -static void -msn_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer = msn_new_xfer(gc, who); - - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -static gboolean -msn_can_receive_file(PurpleConnection *gc, const char *who) -{ - PurpleAccount *account; - char *normal; - gboolean ret; - - account = purple_connection_get_account(gc); - - normal = g_strdup(msn_normalize(account, purple_account_get_username(account))); - - ret = strcmp(normal, msn_normalize(account, who)); - - g_free(normal); - - return ret; -} - -/************************************************************************** - * Protocol Plugin ops - **************************************************************************/ - -static const char * -msn_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "msn"; -} - -static char * -msn_status_text(PurpleBuddy *buddy) -{ - PurplePresence *presence; - PurpleStatus *status; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - if (!purple_presence_is_available(presence) && !purple_presence_is_idle(presence)) - { - return g_strdup(purple_status_get_name(status)); - } - - return NULL; -} - -static void -msn_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) -{ - MsnUser *user; - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - - user = buddy->proto_data; - - - if (purple_presence_is_online(presence)) - { - purple_notify_user_info_add_pair(user_info, _("Status"), - (purple_presence_is_idle(presence) ? _("Idle") : purple_status_get_name(status))); - } - - if (full && user) - { - purple_notify_user_info_add_pair(user_info, _("Has you"), - ((user->list_op & (1 << MSN_LIST_RL)) ? _("Yes") : _("No"))); - } - - /* XXX: This is being shown in non-full tooltips because the - * XXX: blocked icon overlay isn't always accurate for MSN. - * XXX: This can die as soon as purple_privacy_check() knows that - * XXX: this prpl always honors both the allow and deny lists. */ - /* While the above comment may be strictly correct (the privacy API needs - * rewriteing), purple_privacy_check() is going to be more accurate at - * indicating whether a particular buddy is going to be able to message - * you, which is the important information that this is trying to convey. */ - if (full && user) - { - const char *phone; - - purple_notify_user_info_add_pair(user_info, _("Blocked"), - ((user->list_op & (1 << MSN_LIST_BL)) ? _("Yes") : _("No"))); - - phone = msn_user_get_home_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Home Phone Number"), phone); - - phone = msn_user_get_work_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Work Phone Number"), phone); - - phone = msn_user_get_mobile_phone(user); - if (phone != NULL) - purple_notify_user_info_add_pair(user_info, _("Mobile Phone Number"), phone); - } -} - -static GList * -msn_status_types(PurpleAccount *account) -{ - PurpleStatusType *status; - GList *types = NULL; - - status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - "brb", _("Be Right Back"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "busy", _("Busy"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "phone", _("On the Phone"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - "lunch", _("Out to Lunch"), FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - NULL, NULL, FALSE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, - "mobile", NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, status); - - return types; -} - -static GList * -msn_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc = (PurpleConnection *)context; - PurpleAccount *account; - const char *user; - - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set Friendly Name..."), - msn_show_set_friendly_name); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - - act = purple_plugin_action_new(_("Set Home Phone Number..."), - msn_show_set_home_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Work Phone Number..."), - msn_show_set_work_phone); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Set Mobile Phone Number..."), - msn_show_set_mobile_phone); - m = g_list_append(m, act); - m = g_list_append(m, NULL); - -#if 0 - act = purple_plugin_action_new(_("Enable/Disable Mobile Devices..."), - msn_show_set_mobile_support); - m = g_list_append(m, act); -#endif - - act = purple_plugin_action_new(_("Allow/Disallow Mobile Pages..."), - msn_show_set_mobile_pages); - m = g_list_append(m, act); - - account = purple_connection_get_account(gc); - user = msn_normalize(account, purple_account_get_username(account)); - - if ((strstr(user, "@hotmail.") != NULL) || - (strstr(user, "@msn.com") != NULL)) - { - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Hotmail Inbox"), - msn_show_hotmail_inbox); - m = g_list_append(m, act); - } - - return m; -} - -static GList * -msn_buddy_menu(PurpleBuddy *buddy) -{ - MsnUser *user; - - GList *m = NULL; - PurpleMenuAction *act; - - g_return_val_if_fail(buddy != NULL, NULL); - - user = buddy->proto_data; - - if (user != NULL) - { - if (user->mobile) - { - act = purple_menu_action_new(_("Send to Mobile"), - PURPLE_CALLBACK(show_send_to_mobile_cb), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (g_ascii_strcasecmp(buddy->name, - purple_account_get_username(buddy->account))) - { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(initiate_chat_cb), - NULL, NULL); - m = g_list_append(m, act); - } - - return m; -} - -static GList * -msn_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - { - return msn_buddy_menu((PurpleBuddy *) node); - } - else - { - return NULL; - } -} - -static void -msn_login(PurpleAccount *account) -{ - PurpleConnection *gc; - MsnSession *session; - const char *username; - const char *host; - gboolean http_method = FALSE; - int port; - - gc = purple_account_get_connection(account); - - if (!purple_ssl_is_supported()) - { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - - _("SSL support is needed for MSN. Please install a supported " - "SSL library.")); - return; - } - - http_method = purple_account_get_bool(account, "http_method", FALSE); - - if (http_method) - host = purple_account_get_string(account, "http_method_server", MSN_HTTPCONN_SERVER); - else - host = purple_account_get_string(account, "server", MSN_SERVER); - port = purple_account_get_int(account, "port", MSN_PORT); - - session = msn_session_new(account); - - gc->proto_data = session; - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR | - PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_START); - - /* Hmm, I don't like this. */ - /* XXX shx: Me neither */ - username = msn_normalize(account, purple_account_get_username(account)); - - if (strcmp(username, purple_account_get_username(account))) - purple_account_set_username(account, username); - - if (!msn_session_connect(session, host, port, http_method)) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); -} - -static void -msn_close(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - g_return_if_fail(session != NULL); - - msn_session_destroy(session); - - gc->proto_data = NULL; -} - -static gboolean -msn_send_me_im(gpointer data) -{ - MsnIMData *imdata = data; - serv_got_im(imdata->gc, imdata->who, imdata->msg, imdata->flags, imdata->when); - g_free(imdata->msg); - g_free(imdata); - return FALSE; -} - -static GString* -msn_msg_emoticon_add(GString *current, MsnEmoticon *emoticon) -{ - MsnObject *obj; - char *strobj; - - if (emoticon == NULL) - return current; - - obj = emoticon->obj; - - if (!obj) - return current; - - strobj = msn_object_to_string(obj); - - if (current) - g_string_append_printf(current, "\t%s\t%s", - emoticon->smile, strobj); - else { - current = g_string_new(""); - g_string_printf(current,"%s\t%s", - emoticon->smile, strobj); - } - - g_free(strobj); - - return current; -} - -static void -msn_send_emoticons(MsnSwitchBoard *swboard, GString *body) -{ - MsnMessage *msg; - - g_return_if_fail(body != NULL); - - msg = msn_message_new(MSN_MSG_SLP); - msn_message_set_content_type(msg, "text/x-mms-emoticon"); - msn_message_set_flag(msg, 'N'); - msn_message_set_bin_data(msg, body->str, body->len); - - msn_switchboard_send_msg(swboard, msg, TRUE); - msn_message_destroy(msg); -} - -static void msn_emoticon_destroy(MsnEmoticon *emoticon) -{ - if (emoticon->obj) - msn_object_destroy(emoticon->obj); - g_free(emoticon->smile); - g_free(emoticon); -} - -static GSList* msn_msg_grab_emoticons(const char *msg, const char *username) -{ - GSList *list; - GList *smileys; - PurpleSmiley *smiley; - PurpleStoredImage *img; - char *ptr; - MsnEmoticon *emoticon; - int length; - - list = NULL; - smileys = purple_smileys_get_all(); - length = strlen(msg); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - smiley = (PurpleSmiley*)smileys->data; - - ptr = g_strstr_len(msg, length, purple_smiley_get_shortcut(smiley)); - - if (!ptr) - continue; - - img = purple_smiley_get_stored_image(smiley); - - emoticon = g_new0(MsnEmoticon, 1); - emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); - emoticon->obj = msn_object_new_from_image(img, - purple_imgstore_get_filename(img), - username, MSN_OBJECT_EMOTICON); - - purple_imgstore_unref(img); - list = g_slist_prepend(list, emoticon); - } - - return list; -} - -static int -msn_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - PurpleAccount *account; - PurpleBuddy *buddy = purple_find_buddy(gc->account, who); - MsnMessage *msg; - char *msgformat; - char *msgtext; - const char *username; - - account = purple_connection_get_account(gc); - username = purple_account_get_username(account); - - if (buddy) { - PurplePresence *p = purple_buddy_get_presence(buddy); - if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) { - char *text = purple_markup_strip_html(message); - send_to_mobile(gc, who, text); - g_free(text); - return 1; - } - } - - msn_import_html(message, &msgformat, &msgtext); - - if (strlen(msgtext) + strlen(msgformat) + strlen(DISPLAY_VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - - g_free(msgformat); - g_free(msgtext); - - if (g_ascii_strcasecmp(who, username)) - { - MsnSession *session; - MsnSwitchBoard *swboard; - MsnEmoticon *smile; - GSList *smileys; - GString *emoticons = NULL; - - session = gc->proto_data; - swboard = msn_session_get_swboard(session, who, MSN_SB_FLAG_IM); - smileys = msn_msg_grab_emoticons(message, username); - - while (smileys) { - smile = (MsnEmoticon*)smileys->data; - emoticons = msn_msg_emoticon_add(emoticons,smile); - msn_emoticon_destroy(smile); - smileys = g_slist_delete_link(smileys, smileys); - } - - if (emoticons) { - msn_send_emoticons(swboard, emoticons); - g_string_free(emoticons, TRUE); - } - - msn_switchboard_send_msg(swboard, msg, TRUE); - } - else - { - char *body_str, *body_enc, *pre, *post; - const char *format; - MsnIMData *imdata = g_new0(MsnIMData, 1); - /* - * In MSN, you can't send messages to yourself, so - * we'll fake like we received it ;) - */ - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - serv_got_typing_stopped(gc, who); - imdata->gc = gc; - imdata->who = who; - imdata->msg = body_str; - imdata->flags = flags; - imdata->when = time(NULL); - purple_timeout_add(0, msn_send_me_im, imdata); - } - - msn_message_destroy(msg); - - return 1; -} - -static unsigned int -msn_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - PurpleAccount *account; - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - - /* - * TODO: I feel like this should be "if (state != PURPLE_TYPING)" - * but this is how it was before, and I don't want to break - * anything. --KingAnt - */ - if (state == PURPLE_NOT_TYPING) - return 0; - - if (!g_ascii_strcasecmp(who, purple_account_get_username(account))) - { - /* We'll just fake it, since we're sending to ourself. */ - serv_got_typing(gc, who, MSN_TYPING_RECV_TIMEOUT, PURPLE_TYPING); - - return MSN_TYPING_SEND_TIMEOUT; - } - - swboard = msn_session_find_swboard(session, who); - - if (swboard == NULL || !msn_switchboard_can_send(swboard)) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msg = msn_message_new(MSN_MSG_TYPING); - msn_message_set_content_type(msg, "text/x-msmsgscontrol"); - msn_message_set_flag(msg, 'U'); - msn_message_set_attr(msg, "TypingUser", - purple_account_get_username(account)); - msn_message_set_bin_data(msg, "\r\n", 2); - - msn_switchboard_send_msg(swboard, msg, FALSE); - - msn_message_destroy(msg); - - return MSN_TYPING_SEND_TIMEOUT; -} - -static void -msn_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - MsnSession *session; - - gc = purple_account_get_connection(account); - - if (gc != NULL) - { - session = gc->proto_data; - msn_change_status(session); - } -} - -static void -msn_set_idle(PurpleConnection *gc, int idle) -{ - MsnSession *session; - - session = gc->proto_data; - - msn_change_status(session); -} - -#if 0 -static void -fake_userlist_add_buddy(MsnUserList *userlist, - const char *who, int list_id, - const char *group_name) -{ - MsnUser *user; - static int group_id_c = 1; - int group_id; - - group_id = -1; - - if (group_name != NULL) - { - MsnGroup *group; - group = msn_group_new(userlist, group_id_c, group_name); - group_id = group_id_c++; - } - - user = msn_userlist_find_user(userlist, who); - - if (user == NULL) - { - user = msn_user_new(userlist, who, NULL); - msn_userlist_add_user(userlist, user); - } - else - if (user->list_op & (1 << list_id)) - { - if (list_id == MSN_LIST_FL) - { - if (group_id >= 0) - if (g_list_find(user->group_ids, - GINT_TO_POINTER(group_id))) - return; - } - else - return; - } - - if (group_id >= 0) - { - user->group_ids = g_list_append(user->group_ids, - GINT_TO_POINTER(group_id)); - } - - user->list_op |= (1 << list_id); -} -#endif - -static void -msn_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsnSession *session; - MsnUserList *userlist; - const char *who; - - session = gc->proto_data; - userlist = session->userlist; - who = msn_normalize(gc->account, buddy->name); - - if (!session->logged_in) - { -#if 0 - fake_userlist_add_buddy(session->sync_userlist, who, MSN_LIST_FL, - group ? group->name : NULL); -#else - purple_debug_error("msn", "msn_add_buddy called before connected\n"); -#endif - - return; - } - -#if 0 - if (group != NULL && group->name != NULL) - purple_debug_info("msn", "msn_add_buddy: %s, %s\n", who, group->name); - else - purple_debug_info("msn", "msn_add_buddy: %s\n", who); -#endif - -#if 0 - /* Which is the max? */ - if (session->fl_users_count >= 150) - { - purple_debug_info("msn", "Too many buddies\n"); - /* Buddy list full */ - /* TODO: purple should be notified of this */ - return; - } -#endif - - /* XXX - Would group ever be NULL here? I don't think so... - * shx: Yes it should; MSN handles non-grouped buddies, and this is only - * internal. */ - msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, - group ? group->name : NULL); -} - -static void -msn_rem_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - /* XXX - Does buddy->name need to be msn_normalize'd here? --KingAnt */ - msn_userlist_rem_buddy(userlist, buddy->name, MSN_LIST_FL, group->name); -} - -static void -msn_add_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_BL_OP) - msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); - - msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); -} - -static void -msn_add_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - user = msn_userlist_find_user(userlist, who); - - if (!session->logged_in) - return; - - if (user != NULL && user->list_op & MSN_LIST_AL_OP) - msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); - - msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); -} - -static void -msn_rem_permit(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy(userlist, who, MSN_LIST_AL, NULL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy(userlist, who, MSN_LIST_BL, NULL); -} - -static void -msn_rem_deny(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnUserList *userlist; - MsnUser *user; - - session = gc->proto_data; - userlist = session->userlist; - - if (!session->logged_in) - return; - - user = msn_userlist_find_user(userlist, who); - - msn_userlist_rem_buddy(userlist, who, MSN_LIST_BL, NULL); - - if (user != NULL && user->list_op & MSN_LIST_RL_OP) - msn_userlist_add_buddy(userlist, who, MSN_LIST_AL, NULL); -} - -static void -msn_set_permit_deny(PurpleConnection *gc) -{ - PurpleAccount *account; - MsnSession *session; - MsnCmdProc *cmdproc; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if (account->perm_deny == PURPLE_PRIVACY_ALLOW_ALL || - account->perm_deny == PURPLE_PRIVACY_DENY_USERS) - { - msn_cmdproc_send(cmdproc, "BLP", "%s", "AL"); - } - else - { - msn_cmdproc_send(cmdproc, "BLP", "%s", "BL"); - } -} - -static void -msn_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - { - /* if we have no switchboard, everyone else left the chat already */ - swboard = msn_switchboard_new(session); - msn_switchboard_request(swboard); - swboard->chat_id = id; - swboard->conv = purple_find_chat(gc, id); - } - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_switchboard_request_add_user(swboard, who); -} - -static void -msn_chat_leave(PurpleConnection *gc, int id) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard_with_id(session, id); - - /* if swboard is NULL we were the only person left anyway */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - msn_switchboard_release(swboard, MSN_SB_FLAG_IM); - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static int -msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurpleAccount *account; - MsnSession *session; - MsnSwitchBoard *swboard; - MsnMessage *msg; - char *msgformat; - char *msgtext; - - account = purple_connection_get_account(gc); - session = gc->proto_data; - swboard = msn_session_find_swboard_with_id(session, id); - - if (swboard == NULL) - return -EINVAL; - - if (!swboard->ready) - return 0; - - swboard->flag |= MSN_SB_FLAG_IM; - - msn_import_html(message, &msgformat, &msgtext); - - if (strlen(msgtext) + strlen(msgformat) + strlen(DISPLAY_VERSION) > 1564) - { - g_free(msgformat); - g_free(msgtext); - - return -E2BIG; - } - - msg = msn_message_new_plain(msgtext); - msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); - msn_switchboard_send_msg(swboard, msg, FALSE); - msn_message_destroy(msg); - - g_free(msgformat); - g_free(msgtext); - - serv_got_chat_in(gc, id, purple_account_get_username(account), flags, - message, time(NULL)); - - return 0; -} - -static void -msn_keepalive(PurpleConnection *gc) -{ - MsnSession *session; - - session = gc->proto_data; - - if (!session->http_method) - { - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_cmdproc_send_quick(cmdproc, "PNG", NULL, NULL); - } -} - -static void -msn_group_buddy(PurpleConnection *gc, const char *who, - const char *old_group_name, const char *new_group_name) -{ - MsnSession *session; - MsnUserList *userlist; - - session = gc->proto_data; - userlist = session->userlist; - - msn_userlist_move_buddy(userlist, who, old_group_name, new_group_name); -} - -static void -msn_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - MsnSession *session; - MsnCmdProc *cmdproc; - int old_gid; - const char *enc_new_group_name; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - enc_new_group_name = purple_url_encode(group->name); - - old_gid = msn_userlist_find_group_id(session->userlist, old_name); - - if (old_gid >= 0) - { - msn_cmdproc_send(cmdproc, "REG", "%d %s 0", old_gid, - enc_new_group_name); - } - else - { - msn_cmdproc_send(cmdproc, "ADG", "%s 0", enc_new_group_name); - } -} - -static void -msn_convo_closed(PurpleConnection *gc, const char *who) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - PurpleConversation *conv; - - session = gc->proto_data; - - swboard = msn_session_find_swboard(session, who); - - /* - * Don't perform an assertion here. If swboard is NULL, then the - * switchboard was either closed by the other party, or the person - * is talking to himself. - */ - if (swboard == NULL) - return; - - conv = swboard->conv; - - /* If we release the switchboard here, it may still have messages - pending ACK which would result in incorrect unsent message errors. - Just let it timeout... This is *so* going to screw with people who - use dumb clients that report "User has closed the conversation window" */ - /* msn_switchboard_release(swboard, MSN_SB_FLAG_IM); */ - swboard->conv = NULL; - - /* If other switchboards managed to associate themselves with this - * conv, make sure they know it's gone! */ - if (conv != NULL) - { - while ((swboard = msn_session_find_swboard_with_conv(session, conv)) != NULL) - swboard->conv = NULL; - } -} - -static void -msn_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - MsnSession *session; - MsnUser *user; - - session = gc->proto_data; - user = session->user; - - msn_user_set_buddy_icon(user, img); - - msn_change_status(session); -} - -static void -msn_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - MsnSession *session; - MsnCmdProc *cmdproc; - int group_id; - - session = gc->proto_data; - cmdproc = session->notification->cmdproc; - - if ((group_id = msn_userlist_find_group_id(session->userlist, group->name)) >= 0) - { - msn_cmdproc_send(cmdproc, "RMG", "%d", group_id); - } -} - -/** - * Extract info text from info_data and add it to user_info - */ -static gboolean -msn_tooltip_extract_info_text(PurpleNotifyUserInfo *user_info, MsnGetInfoData *info_data) -{ - PurpleBuddy *b; - - b = purple_find_buddy(purple_connection_get_account(info_data->gc), - info_data->name); - - if (b) - { - char *tmp; - - if (b->alias && b->alias[0]) - { - char *aliastext = g_markup_escape_text(b->alias, -1); - purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); - g_free(aliastext); - } - - if (b->server_alias) - { - char *nicktext = g_markup_escape_text(b->server_alias, -1); - tmp = g_strdup_printf("%s
", nicktext); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - g_free(nicktext); - } - - /* Add the tooltip information */ - msn_tooltip_text(b, user_info, TRUE); - - return TRUE; - } - - return FALSE; -} - -#if PHOTO_SUPPORT - -static char * -msn_get_photo_url(const char *url_text) -{ - char *p, *q; - - if ((p = strstr(url_text, " contactparams:photopreauthurl=\"")) != NULL) - { - p += strlen(" contactparams:photopreauthurl=\""); - } - - if (p && (strncmp(p, "http://", 8) == 0) && ((q = strchr(p, '"')) != NULL)) - return g_strndup(p, q - p); - - return NULL; -} - -static void msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message); - -#endif - -#if 0 -static char *msn_info_date_reformat(const char *field, size_t len) -{ - char *tmp = g_strndup(field, len); - time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - - g_free(tmp); - return g_strdup(purple_date_format_short(localtime(&t))); -} -#endif - -#define MSN_GOT_INFO_GET_FIELD(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, NULL); \ - if (found) \ - sect_info = TRUE; - -#define MSN_GOT_INFO_GET_FIELD_NO_SEARCH(a, b) \ - found = purple_markup_extract_info_field(stripped, stripped_len, user_info, \ - "\n" a ":", 0, "\n", 0, "Undisclosed", b, 0, NULL, msn_info_strip_search_link); \ - if (found) \ - sect_info = TRUE; - -static char * -msn_info_strip_search_link(const char *field, size_t len) -{ - const char *c; - if ((c = strstr(field, " (http://")) == NULL) - return g_strndup(field, len); - return g_strndup(field, c - field); -} - -static void -msn_got_info(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - MsnGetInfoData *info_data = (MsnGetInfoData *)data; - PurpleNotifyUserInfo *user_info; - char *stripped, *p, *q, *tmp; - char *user_url = NULL; - gboolean found; - gboolean has_tooltip_text = FALSE; - gboolean has_info = FALSE; - gboolean sect_info = FALSE; - gboolean has_contact_info = FALSE; - char *url_buffer; - int stripped_len; -#if PHOTO_SUPPORT - char *photo_url_text = NULL; - MsnGetInfoStepTwoData *info2_data = NULL; -#endif - - purple_debug_info("msn", "In msn_got_info\n"); - - /* Make sure the connection is still valid */ - if (g_list_find(purple_connections_get_all(), info_data->gc) == NULL) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy info.\n"); - g_free(info_data->name); - g_free(info_data); - return; - } - - user_info = purple_notify_user_info_new(); - has_tooltip_text = msn_tooltip_extract_info_text(user_info, info_data); - - if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) - { - tmp = g_strdup_printf("%s", _("Error retrieving profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(info_data->name); - g_free(info_data); - return; - } - - url_buffer = g_strdup(url_text); - - /* If they have a homepage link, MSN masks it such that we need to - * fetch the url out before purple_markup_strip_html() nukes it */ - /* I don't think this works with the new spaces profiles - Stu 3/2/06 */ - if ((p = strstr(url_text, - "Take a look at my
%s", user_url, user_url); - purple_notify_user_info_add_pair(user_info, _("Homepage"), tmp); - g_free(tmp); - g_free(user_url); - - has_info = TRUE; - } - - if (!has_info) - { - /* MSN doesn't actually distinguish between "unknown member" and - * a known member with an empty profile. Try to explain this fact. - * Note that if we have a nonempty tooltip_text, we know the user - * exists. - */ - /* This doesn't work with the new spaces profiles - Stu 3/2/06 - char *p = strstr(url_buffer, "Unknown Member "); - * This might not work for long either ... */ - /* Nope, it failed some time before 5/2/07 :( - char *p = strstr(url_buffer, "form id=\"SpacesSearch\" name=\"SpacesSearch\""); - * Let's see how long this one holds out for ... */ - char *p = strstr(url_buffer, "gc), info_data->name); - purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), - ((p && b) ? _("The user has not created a public profile.") : - (p ? _("MSN reported not being able to find the user's profile. " - "This either means that the user does not exist, " - "or that the user exists " - "but has not created a public profile.") : - _("Could not find " /* This should never happen */ - "any information in the user's profile. " - "The user most likely does not exist.")))); - } - - /* put a link to the actual profile URL */ - tmp = g_strdup_printf("%s%s", - PROFILE_URL, info_data->name, PROFILE_URL, info_data->name); - purple_notify_user_info_add_pair(user_info, _("Profile URL"), tmp); - g_free(tmp); - -#if PHOTO_SUPPORT - /* Find the URL to the photo; must be before the marshalling [Bug 994207] */ - photo_url_text = msn_get_photo_url(url_text); - - /* Marshall the existing state */ - info2_data = g_malloc0(sizeof(MsnGetInfoStepTwoData)); - info2_data->info_data = info_data; - info2_data->stripped = stripped; - info2_data->url_buffer = url_buffer; - info2_data->user_info = user_info; - info2_data->photo_url_text = photo_url_text; - - /* Try to put the photo in there too, if there's one */ - if (photo_url_text) - { - purple_util_fetch_url(photo_url_text, FALSE, NULL, FALSE, msn_got_photo, - info2_data); - } - else - { - /* Emulate a callback */ - /* TODO: Huh? */ - msn_got_photo(NULL, info2_data, NULL, 0, NULL); - } -} - -static void -msn_got_photo(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - MsnGetInfoStepTwoData *info2_data = (MsnGetInfoStepTwoData *)user_data; - int id = -1; - - /* Unmarshall the saved state */ - MsnGetInfoData *info_data = info2_data->info_data; - char *stripped = info2_data->stripped; - char *url_buffer = info2_data->url_buffer; - PurpleNotifyUserInfo *user_info = info2_data->user_info; - char *photo_url_text = info2_data->photo_url_text; - - /* Make sure the connection is still valid if we got here by fetching a photo url */ - if (url_text && (error_message != NULL || - g_list_find(purple_connections_get_all(), info_data->gc) == NULL)) - { - purple_debug_warning("msn", "invalid connection. ignoring buddy photo info.\n"); - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); - g_free(photo_url_text); - g_free(info2_data); - - return; - } - - /* Try to put the photo in there too, if there's one and is readable */ - if (user_data && url_text && len != 0) - { - if (strstr(url_text, "400 Bad Request") - || strstr(url_text, "403 Forbidden") - || strstr(url_text, "404 Not Found")) - { - - purple_debug_info("msn", "Error getting %s: %s\n", - photo_url_text, url_text); - } - else - { - char buf[1024]; - purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT - " bytes\n", photo_url_text, len); - id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - g_snprintf(buf, sizeof(buf), "
", id); - purple_notify_user_info_prepend_pair(user_info, NULL, buf); - } - } - - /* We continue here from msn_got_info, as if nothing has happened */ -#endif - purple_notify_userinfo(info_data->gc, info_data->name, user_info, NULL, NULL); - - g_free(stripped); - g_free(url_buffer); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); -#if PHOTO_SUPPORT - g_free(photo_url_text); - g_free(info2_data); - if (id != -1) - purple_imgstore_unref_by_id(id); -#endif -} - -static void -msn_get_info(PurpleConnection *gc, const char *name) -{ - MsnGetInfoData *data; - char *url; - - data = g_new0(MsnGetInfoData, 1); - data->gc = gc; - data->name = g_strdup(name); - - url = g_strdup_printf("%s%s", PROFILE_URL, name); - - purple_util_fetch_url(url, FALSE, - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - TRUE, msn_got_info, data); - - g_free(url); -} - -static gboolean msn_load(PurplePlugin *plugin) -{ - msn_notification_init(); - msn_switchboard_init(); - msn_sync_init(); - - return TRUE; -} - -static gboolean msn_unload(PurplePlugin *plugin) -{ - msn_notification_end(); - msn_switchboard_end(); - msn_sync_end(); - - return TRUE; -} - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -static gboolean msn_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "msnim")) - return FALSE; - - acct = find_acct("prpl-msn", acct_id); - - if (!acct) - return FALSE; - - /* msnim:chat?contact=user@domain.tld */ - if (!g_ascii_strcasecmp(cmd, "Chat")) { - char *sname = g_hash_table_lookup(params, "contact"); - if (sname) { - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, sname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); - purple_conversation_present(conv); - } - /*else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im();*/ - - return TRUE; - } - /* msnim:add?contact=user@domain.tld */ - else if (!g_ascii_strcasecmp(cmd, "Add")) { - char *name = g_hash_table_lookup(params, "contact"); - purple_blist_request_add_buddy(acct, name, NULL, NULL); - return TRUE; - } - - return FALSE; -} - - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - msn_list_icon, /* list_icon */ - NULL, /* list_emblems */ - msn_status_text, /* status_text */ - msn_tooltip_text, /* tooltip_text */ - msn_status_types, /* away_states */ - msn_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - msn_login, /* login */ - msn_close, /* close */ - msn_send_im, /* send_im */ - NULL, /* set_info */ - msn_send_typing, /* send_typing */ - msn_get_info, /* get_info */ - msn_set_status, /* set_away */ - msn_set_idle, /* set_idle */ - NULL, /* change_passwd */ - msn_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - msn_rem_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - msn_add_permit, /* add_permit */ - msn_add_deny, /* add_deny */ - msn_rem_permit, /* rem_permit */ - msn_rem_deny, /* rem_deny */ - msn_set_permit_deny, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - msn_chat_invite, /* chat_invite */ - msn_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - msn_chat_send, /* chat_send */ - msn_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - msn_group_buddy, /* group_buddy */ - msn_rename_group, /* rename_group */ - NULL, /* buddy_free */ - msn_convo_closed, /* convo_closed */ - msn_normalize, /* normalize */ - msn_set_buddy_icon, /* set_buddy_icon */ - msn_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - msn_can_receive_file, /* can_receive_file */ - msn_send_file, /* send_file */ - msn_new_xfer, /* new_xfer */ - msn_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - msn_send_attention, /* send_attention */ - msn_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - msn_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-msn", /**< id */ - "MSN", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("MSN Protocol Plugin"), - /** description */ - N_("MSN Protocol Plugin"), - "Christian Hammond ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - msn_load, /**< load */ - msn_unload, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - msn_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Server"), "server", - MSN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_int_new(_("Port"), "port", 1863); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Use HTTP Method"), - "http_method", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_string_new(_("HTTP Method Server"), - "http_method_server", MSN_HTTPCONN_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - option = purple_account_option_bool_new(_("Show custom smileys"), - "custom_smileys", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, - option); - - purple_cmd_register("nudge", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-msn", msn_cmd_nudge, - _("nudge: nudge a user to get their attention"), NULL); - - purple_prefs_remove("/plugins/prpl/msn"); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(msn_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(msnp9, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,134 +0,0 @@ -/** - * @file msn.h The MSN protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_H_ -#define _MSN_H_ - -/* #define MSN_DEBUG_MSG 1 */ -/* #define MSN_DEBUG_SLPMSG 1 */ -/* #define MSN_DEBUG_HTTP 1 */ - -/* #define MSN_DEBUG_SLP 1 */ -/* #define MSN_DEBUG_SLP_VERBOSE 1 */ -/* #define MSN_DEBUG_SLP_FILES 1 */ - -/* #define MSN_DEBUG_NS 1 */ -/* #define MSN_DEBUG_SB 1 */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "connection.h" -#include "conversation.h" -#include "debug.h" -#include "cipher.h" -#include "notify.h" -#include "privacy.h" -#include "proxy.h" -#include "prpl.h" -#include "request.h" -#include "servconn.h" -#include "sslconn.h" -#include "util.h" - -#include "ft.h" - -#define MSN_BUF_LEN 8192 - -#define USEROPT_MSNSERVER 3 -#define MSN_SERVER "messenger.hotmail.com" -#define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com" -#define USEROPT_MSNPORT 4 -#define MSN_PORT 1863 - -#define MSN_TYPING_RECV_TIMEOUT 6 -#define MSN_TYPING_SEND_TIMEOUT 4 - -#define HOTMAIL_URL "http://www.hotmail.com/cgi-bin/folders" -#define PASSPORT_URL "http://lc1.law13.hotmail.passport.com/cgi-bin/dologin?login=" -#define PROFILE_URL "http://spaces.live.com/profile.aspx?mem=" - -#define USEROPT_HOTMAIL 0 - -#define BUDDY_ALIAS_MAXLEN 387 - -#define MSN_FT_GUID "{5D3E02AB-6190-11d3-BBBB-00C04F795683}" - -#define MSN_CLIENTINFO \ - "Client-Name: Purple/" VERSION "\r\n" \ - "Chat-Logging: Y\r\n" - -/* Index into attention_types */ -#define MSN_NUDGE 0 - -typedef enum -{ - MSN_LIST_FL_OP = 0x01, - MSN_LIST_AL_OP = 0x02, - MSN_LIST_BL_OP = 0x04, - MSN_LIST_RL_OP = 0x08 - -} MsnListOp; - -typedef enum -{ - MSN_CLIENT_CAP_WIN_MOBILE = 0x00001, - MSN_CLIENT_CAP_UNKNOWN_1 = 0x00002, - MSN_CLIENT_CAP_INK_GIF = 0x00004, - MSN_CLIENT_CAP_INK_ISF = 0x00008, - MSN_CLIENT_CAP_VIDEO_CHAT = 0x00010, - MSN_CLIENT_CAP_BASE = 0x00020, - MSN_CLIENT_CAP_MSNMOBILE = 0x00040, - MSN_CLIENT_CAP_MSNDIRECT = 0x00080, - MSN_CLIENT_CAP_WEBMSGR = 0x00100, - MSN_CLIENT_CAP_DIRECTIM = 0x04000, - MSN_CLIENT_CAP_WINKS = 0x08000, - MSN_CLIENT_CAP_SEARCH = 0x10000 - -} MsnClientCaps; - -typedef enum -{ - MSN_CLIENT_VER_5_0 = 0x00, - MSN_CLIENT_VER_6_0 = 0x10, /* MSNC1 */ - MSN_CLIENT_VER_6_1 = 0x20, /* MSNC2 */ - MSN_CLIENT_VER_6_2 = 0x30, /* MSNC3 */ - MSN_CLIENT_VER_7_0 = 0x40, /* MSNC4 */ - MSN_CLIENT_VER_7_5 = 0x50 /* MSNC5 */ - -} MsnClientVerId; - -#define MSN_CLIENT_ID_VERSION MSN_CLIENT_VER_7_0 -#define MSN_CLIENT_ID_RESERVED_1 0x00 -#define MSN_CLIENT_ID_RESERVED_2 0x00 -#define MSN_CLIENT_ID_CAPABILITIES MSN_CLIENT_CAP_BASE - -#define MSN_CLIENT_ID \ - ((MSN_CLIENT_ID_VERSION << 24) | \ - (MSN_CLIENT_ID_RESERVED_1 << 16) | \ - (MSN_CLIENT_ID_RESERVED_2 << 8) | \ - (MSN_CLIENT_ID_CAPABILITIES)) - -#endif /* _MSN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,441 +0,0 @@ -/** - * @file msn-utils.c Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "msn-utils.h" - -void -msn_parse_format(const char *mime, char **pre_ret, char **post_ret) -{ - char *cur; - GString *pre = g_string_new(NULL); - GString *post = g_string_new(NULL); - unsigned int colors[3]; - - if (pre_ret != NULL) *pre_ret = NULL; - if (post_ret != NULL) *post_ret = NULL; - - cur = strstr(mime, "FN="); - - if (cur && (*(cur = cur + 3) != ';')) - { - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - - cur = strstr(mime, "EF="); - - if (cur && (*(cur = cur + 3) != ';')) - { - while (*cur && *cur != ';') - { - pre = g_string_append_c(pre, '<'); - pre = g_string_append_c(pre, *cur); - pre = g_string_append_c(pre, '>'); - post = g_string_prepend_c(post, '>'); - post = g_string_prepend_c(post, *cur); - post = g_string_prepend_c(post, '/'); - post = g_string_prepend_c(post, '<'); - cur++; - } - } - - cur = strstr(mime, "CO="); - - if (cur && (*(cur = cur + 3) != ';')) - { - int i; - - i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); - - if (i > 0) - { - char tag[64]; - - if (i == 1) - { - colors[1] = 0; - colors[2] = 0; - } - else if (i == 2) - { - unsigned int temp = colors[0]; - - colors[0] = colors[1]; - colors[1] = temp; - colors[2] = 0; - } - else if (i == 3) - { - unsigned int temp = colors[2]; - - colors[2] = colors[0]; - colors[0] = temp; - } - - g_snprintf(tag, sizeof(tag), - "", - colors[0], colors[1], colors[2]); - - pre = g_string_append(pre, tag); - post = g_string_prepend(post, ""); - } - } - - cur = strstr(mime, "RL="); - - if (cur && (*(cur = cur + 3) != ';')) - { - if (*cur == '1') - { - /* RTL text was received */ - pre = g_string_append(pre, ""); - post = g_string_prepend(post, ""); - } - } - - cur = g_strdup(purple_url_decode(pre->str)); - g_string_free(pre, TRUE); - - if (pre_ret != NULL) - *pre_ret = cur; - else - g_free(cur); - - cur = g_strdup(purple_url_decode(post->str)); - g_string_free(post, TRUE); - - if (post_ret != NULL) - *post_ret = cur; - else - g_free(cur); -} - -/* - * We need this because we're only supposed to encode spaces in the font - * names. purple_url_encode() isn't acceptable. - */ -static const char * -encode_spaces(const char *str) -{ - static char buf[BUF_LEN]; - const char *c; - char *d; - - g_return_val_if_fail(str != NULL, NULL); - - for (c = str, d = buf; *c != '\0'; c++) - { - if (*c == ' ') - { - *d++ = '%'; - *d++ = '2'; - *d++ = '0'; - } - else - *d++ = *c; - } - *d = '\0'; - - return buf; -} - -/* - * Taken from the zephyr plugin. - * This parses HTML formatting (put out by one of the gtkimhtml widgets - * and converts it to msn formatting. It doesn't deal with the tag closing, - * but gtkimhtml widgets give valid html. - * It currently deals properly with , , , , - * , , . - * It ignores and - */ -void -msn_import_html(const char *html, char **attributes, char **message) -{ - int len, retcount = 0; - const char *c; - char *msg; - char *fontface = NULL; - char fonteffect[4]; - char fontcolor[7]; - char direction = '0'; - - gboolean has_bold = FALSE; - gboolean has_italic = FALSE; - gboolean has_underline = FALSE; - gboolean has_strikethrough = FALSE; - - g_return_if_fail(html != NULL); - g_return_if_fail(attributes != NULL); - g_return_if_fail(message != NULL); - - len = strlen(html); - msg = g_malloc0(len + 1); - - memset(fontcolor, 0, sizeof(fontcolor)); - strcat(fontcolor, "0"); - memset(fonteffect, 0, sizeof(fonteffect)); - - for (c = html; *c != '\0';) - { - if (*c == '<') - { - if (!g_ascii_strncasecmp(c + 1, "br>", 3)) - { - msg[retcount++] = '\r'; - msg[retcount++] = '\n'; - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "i>", 2)) - { - if (!has_italic) - { - strcat(fonteffect, "I"); - has_italic = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "b>", 2)) - { - if (!has_bold) - { - strcat(fonteffect, "B"); - has_bold = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "u>", 2)) - { - if (!has_underline) - { - strcat(fonteffect, "U"); - has_underline = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "s>", 2)) - { - if (!has_strikethrough) - { - strcat(fonteffect, "S"); - has_strikethrough = TRUE; - } - c += 3; - } - else if (!g_ascii_strncasecmp(c + 1, "a href=\"", 8)) - { - c += 9; - - if (!g_ascii_strncasecmp(c, "mailto:", 7)) - c += 7; - - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - msg[retcount++] = *c++; - - if (*c != '\0') - c += 2; - - /* ignore descriptive string */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "", 4)) - c++; - - if (*c != '\0') - c += 4; - } - else if (!g_ascii_strncasecmp(c + 1, "span", 4)) - { - /* Bi-directional text support using CSS properties in span tags */ - c += 5; - - while (*c != '\0' && *c != '>') - { - while (*c == ' ') - c++; - if (!g_ascii_strncasecmp(c, "dir=\"rtl\"", 9)) - { - c += 9; - direction = '1'; - } - else if (!g_ascii_strncasecmp(c, "style=\"", 7)) - { - /* Parse inline CSS attributes */ - char *attributes; - int attr_len = 0; - c += 7; - while (*(c + attr_len) != '\0' && *(c + attr_len) != '"') - attr_len++; - if (*(c + attr_len) == '"') - { - char *attr_dir; - attributes = g_strndup(c, attr_len); - attr_dir = purple_markup_get_css_property(attributes, "direction"); - if (attr_dir && (!g_ascii_strncasecmp(attr_dir, "RTL", 3))) - direction = '1'; - g_free(attr_dir); - g_free(attributes); - } - - } - else - { - c++; - } - } - if (*c == '>') - c++; - } - else if (!g_ascii_strncasecmp(c + 1, "font", 4)) - { - c += 5; - - while ((*c != '\0') && !g_ascii_strncasecmp(c, " ", 1)) - c++; - - if (!g_ascii_strncasecmp(c, "color=\"#", 7)) - { - c += 8; - - fontcolor[0] = *(c + 4); - fontcolor[1] = *(c + 5); - fontcolor[2] = *(c + 2); - fontcolor[3] = *(c + 3); - fontcolor[4] = *c; - fontcolor[5] = *(c + 1); - - c += 8; - } - else if (!g_ascii_strncasecmp(c, "face=\"", 6)) - { - const char *end = NULL; - const char *comma = NULL; - unsigned int namelen = 0; - - c += 6; - end = strchr(c, '\"'); - comma = strchr(c, ','); - - if (comma == NULL || comma > end) - namelen = (unsigned int)(end - c); - else - namelen = (unsigned int)(comma - c); - - fontface = g_strndup(c, namelen); - c = end + 2; - } - else - { - /* Drop all unrecognized/misparsed font tags */ - while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) - c++; - - if (*c != '\0') - c += 2; - } - } - else - { - while ((*c != '\0') && (*c != '>')) - c++; - if (*c != '\0') - c++; - } - } - else if (*c == '&') - { - if (!g_ascii_strncasecmp(c, "<", 4)) - { - msg[retcount++] = '<'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, ">", 4)) - { - msg[retcount++] = '>'; - c += 4; - } - else if (!g_ascii_strncasecmp(c, " ", 6)) - { - msg[retcount++] = ' '; - c += 6; - } - else if (!g_ascii_strncasecmp(c, """, 6)) - { - msg[retcount++] = '"'; - c += 6; - } - else if (!g_ascii_strncasecmp(c, "&", 5)) - { - msg[retcount++] = '&'; - c += 5; - } - else if (!g_ascii_strncasecmp(c, "'", 6)) - { - msg[retcount++] = '\''; - c += 6; - } - else - msg[retcount++] = *c++; - } - else - msg[retcount++] = *c++; - } - - if (fontface == NULL) - fontface = g_strdup("MS Sans Serif"); - - *attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0; RL=%c", - encode_spaces(fontface), - fonteffect, fontcolor, direction); - *message = g_strdup(msg); - - g_free(fontface); - g_free(msg); -} - -void -msn_parse_socket(const char *str, char **ret_host, int *ret_port) -{ - char *host; - char *c; - int port; - - host = g_strdup(str); - - if ((c = strchr(host, ':')) != NULL) - { - *c = '\0'; - port = atoi(c + 1); - } - else - port = 1863; - - *ret_host = host; - *ret_port = port; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/msn-utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/** - * @file msn-utils.h Utility functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_UTILS_H_ -#define _MSN_UTILS_H_ - -/** - * Parses the MSN message formatting into a format compatible with Purple. - * - * @param mime The mime header with the formatting. - * @param pre_ret The returned prefix string. - * @param post_ret The returned postfix string. - * - * @return The new message. - */ -void msn_parse_format(const char *mime, char **pre_ret, char **post_ret); - -/** - * Parses the Purple message formatting (html) into the MSN format. - * - * @param html The html message to format. - * @param attributes The returned attributes string. - * @param message The returned message string. - * - * @return The new message. - */ -void msn_import_html(const char *html, char **attributes, char **message); - -void msn_parse_socket(const char *str, char **ret_host, int *ret_port); - -#endif /* _MSN_UTILS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,513 +0,0 @@ -/** - * @file nexus.c MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "nexus.h" -#include "notification.h" - -/************************************************************************** - * Main - **************************************************************************/ - -MsnNexus * -msn_nexus_new(MsnSession *session) -{ - MsnNexus *nexus; - - nexus = g_new0(MsnNexus, 1); - nexus->session = session; - nexus->challenge_data = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_free); - - return nexus; -} - -void -msn_nexus_destroy(MsnNexus *nexus) -{ - if (nexus->gsc) - purple_ssl_close(nexus->gsc); - - g_free(nexus->login_host); - - g_free(nexus->login_path); - - if (nexus->challenge_data != NULL) - g_hash_table_destroy(nexus->challenge_data); - - if (nexus->input_handler > 0) - purple_input_remove(nexus->input_handler); - g_free(nexus->write_buf); - g_free(nexus->read_buf); - - g_free(nexus); -} - -/************************************************************************** - * Util - **************************************************************************/ - -static gssize -msn_ssl_read(MsnNexus *nexus) -{ - gssize len; - char temp_buf[4096]; - - if ((len = purple_ssl_read(nexus->gsc, temp_buf, - sizeof(temp_buf))) > 0) - { - nexus->read_buf = g_realloc(nexus->read_buf, - nexus->read_len + len + 1); - strncpy(nexus->read_buf + nexus->read_len, temp_buf, len); - nexus->read_len += len; - nexus->read_buf[nexus->read_len] = '\0'; - } - - return len; -} - -static void -nexus_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnNexus *nexus = data; - int len, total_len; - - total_len = strlen(nexus->write_buf); - - len = purple_ssl_write(nexus->gsc, - nexus->write_buf + nexus->written_len, - total_len - nexus->written_len); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - /* TODO: notify of the error */ - return; - } - nexus->written_len += len; - - if (nexus->written_len < total_len) - return; - - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - - g_free(nexus->write_buf); - nexus->write_buf = NULL; - nexus->written_len = 0; - - nexus->written_cb(nexus, source, 0); -} - -/************************************************************************** - * Login - **************************************************************************/ - -static void -login_connect_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond); - -static void -login_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, void *data) -{ - MsnNexus *nexus; - MsnSession *session; - - nexus = data; - g_return_if_fail(nexus != NULL); - - nexus->gsc = NULL; - - session = nexus->session; - g_return_if_fail(session != NULL); - - msn_session_set_error(session, MSN_ERROR_SERVCONN, _("Unable to connect")); - /* the above line will result in nexus being destroyed, so we don't want - * to destroy it here, or we'd crash */ -} - -static void -nexus_login_written_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnNexus *nexus = data; - MsnSession *session; - int len; - - session = nexus->session; - g_return_if_fail(session != NULL); - - if (nexus->input_handler == 0) - /* TODO: Use purple_ssl_input_add()? */ - nexus->input_handler = purple_input_add(nexus->gsc->fd, - PURPLE_INPUT_READ, nexus_login_written_cb, nexus); - - - len = msn_ssl_read(nexus); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - /* TODO: error handling */ - return; - } - - if (g_strstr_len(nexus->read_buf, nexus->read_len, - "\r\n\r\n") == NULL) - return; - - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - - purple_ssl_close(nexus->gsc); - nexus->gsc = NULL; - - purple_debug_misc("msn", "ssl buffer: {%s}\n", nexus->read_buf); - - if (strstr(nexus->read_buf, "HTTP/1.1 302") != NULL) - { - /* Redirect. */ - char *location, *c; - - location = strstr(nexus->read_buf, "Location: "); - if (location == NULL) - { - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - - return; - } - location = strchr(location, ' ') + 1; - - if ((c = strchr(location, '\r')) != NULL) - *c = '\0'; - - /* Skip the http:// */ - if ((c = strchr(location, '/')) != NULL) - location = c + 2; - - if ((c = strchr(location, '/')) != NULL) - { - g_free(nexus->login_path); - nexus->login_path = g_strdup(c); - - *c = '\0'; - } - - g_free(nexus->login_host); - nexus->login_host = g_strdup(location); - - nexus->gsc = purple_ssl_connect(session->account, - nexus->login_host, PURPLE_SSL_DEFAULT_PORT, - login_connect_cb, login_error_cb, nexus); - } - else if (strstr(nexus->read_buf, "HTTP/1.1 401 Unauthorized") != NULL) - { - const char *error; - - if ((error = strstr(nexus->read_buf, "WWW-Authenticate")) != NULL) - { - if ((error = strstr(error, "cbtxt=")) != NULL) - { - const char *c; - char *temp; - - error += strlen("cbtxt="); - - if ((c = strchr(error, '\n')) == NULL) - c = error + strlen(error); - - temp = g_strndup(error, c - error); - error = purple_url_decode(temp); - g_free(temp); - if ((temp = strstr(error, " Do one of the following or try again:")) != NULL) - *temp = '\0'; - } - } - - msn_session_set_error(session, MSN_ERROR_AUTH, error); - } - else if (strstr(nexus->read_buf, "HTTP/1.1 503 Service Unavailable")) - { - msn_session_set_error(session, MSN_ERROR_SERV_UNAVAILABLE, NULL); - } - else if (strstr(nexus->read_buf, "HTTP/1.1 200 OK")) - { - char *base, *c; - char *login_params; - -#if 0 - /* All your base are belong to us. */ - base = buffer; - - /* For great cookie! */ - while ((base = strstr(base, "Set-Cookie: ")) != NULL) - { - base += strlen("Set-Cookie: "); - - c = strchr(base, ';'); - - session->login_cookies = - g_list_append(session->login_cookies, - g_strndup(base, c - base)); - } -#endif - - base = strstr(nexus->read_buf, "Authentication-Info: "); - - g_return_if_fail(base != NULL); - - base = strstr(base, "from-PP='"); - base += strlen("from-PP='"); - c = strchr(base, '\''); - - login_params = g_strndup(base, c - base); - - msn_got_login_params(session, login_params); - - g_free(login_params); - - msn_nexus_destroy(nexus); - session->nexus = NULL; - return; - } - - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - -} - -/* this guards against missing hash entries */ -static char * -nexus_challenge_data_lookup(GHashTable *challenge_data, const char *key) -{ - char *entry; - - return (entry = (char *)g_hash_table_lookup(challenge_data, key)) ? - entry : "(null)"; -} - -void -login_connect_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - MsnNexus *nexus; - MsnSession *session; - char *username, *password, *encpass; - char *request_str, *head, *tail; - char *buffer = NULL; - guint32 ctint; - - nexus = data; - g_return_if_fail(nexus != NULL); - - session = nexus->session; - g_return_if_fail(session != NULL); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_GET_COOKIE); - - username = - g_strdup(purple_url_encode(purple_account_get_username(session->account))); - - password = g_utf8_strncpy(g_strdup(purple_connection_get_password(session->account->gc)), - purple_connection_get_password(session->account->gc), 16); - encpass = g_strdup(purple_url_encode(password)); - g_free(password); - - ctint = strtoul((char *)g_hash_table_lookup(nexus->challenge_data, "ct"), NULL, 10) + 200; - - head = g_strdup_printf( - "GET %s HTTP/1.1\r\n" - "Authorization: Passport1.4 OrgVerb=GET,OrgURL=%s,sign-in=%s", - nexus->login_path, - (char *)g_hash_table_lookup(nexus->challenge_data, "ru"), - username); - - tail = g_strdup_printf( - "lc=%s,id=%s,tw=%s,fs=%s,ru=%s,ct=%" G_GUINT32_FORMAT ",kpp=%s,kv=%s,ver=%s,tpf=%s\r\n" - "User-Agent: MSMSGS\r\n" - "Host: %s\r\n" - "Connection: Keep-Alive\r\n" - "Cache-Control: no-cache\r\n", - nexus_challenge_data_lookup(nexus->challenge_data, "lc"), - nexus_challenge_data_lookup(nexus->challenge_data, "id"), - nexus_challenge_data_lookup(nexus->challenge_data, "tw"), - nexus_challenge_data_lookup(nexus->challenge_data, "fs"), - nexus_challenge_data_lookup(nexus->challenge_data, "ru"), - ctint, - nexus_challenge_data_lookup(nexus->challenge_data, "kpp"), - nexus_challenge_data_lookup(nexus->challenge_data, "kv"), - nexus_challenge_data_lookup(nexus->challenge_data, "ver"), - nexus_challenge_data_lookup(nexus->challenge_data, "tpf"), - nexus->login_host); - - buffer = g_strdup_printf("%s,pwd=XXXXXXXX,%s\r\n", head, tail); - request_str = g_strdup_printf("%s,pwd=%s,%s\r\n", head, encpass, tail); - - purple_debug_misc("msn", "Sending: {%s}\n", buffer); - - g_free(buffer); - g_free(head); - g_free(tail); - g_free(username); - g_free(encpass); - - nexus->write_buf = request_str; - nexus->written_len = 0; - - nexus->read_len = 0; - - nexus->written_cb = nexus_login_written_cb; - - nexus->input_handler = purple_input_add(gsc->fd, PURPLE_INPUT_WRITE, - nexus_write_cb, nexus); - - nexus_write_cb(nexus, gsc->fd, PURPLE_INPUT_WRITE); - - return; - - -} - -static void -nexus_connect_written_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnNexus *nexus = data; - int len; - char *da_login; - char *base, *c; - - if (nexus->input_handler == 0) - /* TODO: Use purple_ssl_input_add()? */ - nexus->input_handler = purple_input_add(nexus->gsc->fd, - PURPLE_INPUT_READ, nexus_connect_written_cb, nexus); - - /* Get the PassportURLs line. */ - len = msn_ssl_read(nexus); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) { - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - /* TODO: error handling */ - return; - } - - if (g_strstr_len(nexus->read_buf, nexus->read_len, - "\r\n\r\n") == NULL) - return; - - purple_input_remove(nexus->input_handler); - nexus->input_handler = 0; - - base = strstr(nexus->read_buf, "PassportURLs"); - - if (base == NULL) - { - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - return; - } - - if ((da_login = strstr(base, "DALogin=")) != NULL) - { - /* skip over "DALogin=" */ - da_login += 8; - - if ((c = strchr(da_login, ',')) != NULL) - *c = '\0'; - - if ((c = strchr(da_login, '/')) != NULL) - { - nexus->login_path = g_strdup(c); - *c = '\0'; - } - - nexus->login_host = g_strdup(da_login); - } - - g_free(nexus->read_buf); - nexus->read_buf = NULL; - nexus->read_len = 0; - - purple_ssl_close(nexus->gsc); - - /* Now begin the connection to the login server. */ - nexus->gsc = purple_ssl_connect(nexus->session->account, - nexus->login_host, PURPLE_SSL_DEFAULT_PORT, - login_connect_cb, login_error_cb, nexus); -} - - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -nexus_connect_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - MsnNexus *nexus; - MsnSession *session; - - nexus = data; - g_return_if_fail(nexus != NULL); - - session = nexus->session; - g_return_if_fail(session != NULL); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH); - - nexus->write_buf = g_strdup("GET /rdr/pprdr.asp\r\n\r\n"); - nexus->written_len = 0; - - nexus->read_len = 0; - - nexus->written_cb = nexus_connect_written_cb; - - nexus->input_handler = purple_input_add(gsc->fd, PURPLE_INPUT_WRITE, - nexus_write_cb, nexus); - - nexus_write_cb(nexus, gsc->fd, PURPLE_INPUT_WRITE); -} - -void -msn_nexus_connect(MsnNexus *nexus) -{ - nexus->gsc = purple_ssl_connect(nexus->session->account, - "nexus.passport.com", PURPLE_SSL_DEFAULT_PORT, - nexus_connect_cb, login_error_cb, nexus); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/nexus.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/** - * @file nexus.h MSN Nexus functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_NEXUS_H_ -#define _MSN_NEXUS_H_ - -typedef struct _MsnNexus MsnNexus; - -struct _MsnNexus -{ - MsnSession *session; - - char *login_host; - char *login_path; - GHashTable *challenge_data; - PurpleSslConnection *gsc; - - guint input_handler; - - char *write_buf; - gsize written_len; - PurpleInputFunction written_cb; - - char *read_buf; - gsize read_len; -}; - -void msn_nexus_connect(MsnNexus *nexus); -MsnNexus *msn_nexus_new(MsnSession *session); -void msn_nexus_destroy(MsnNexus *nexus); - -#endif /* _MSN_NEXUS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1510 +0,0 @@ -/** - * @file notification.c Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "notification.h" -#include "state.h" -#include "error.h" -#include "msn-utils.h" -#include "page.h" - -#include "userlist.h" -#include "sync.h" -#include "slplink.h" - -static MsnTable *cbs_table; - -/************************************************************************** - * Main - **************************************************************************/ - -static void -destroy_cb(MsnServConn *servconn) -{ - MsnNotification *notification; - - notification = servconn->cmdproc->data; - g_return_if_fail(notification != NULL); - - msn_notification_destroy(notification); -} - -MsnNotification * -msn_notification_new(MsnSession *session) -{ - MsnNotification *notification; - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - notification = g_new0(MsnNotification, 1); - - notification->session = session; - notification->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_NS); - msn_servconn_set_destroy_cb(servconn, destroy_cb); - - notification->cmdproc = servconn->cmdproc; - notification->cmdproc->data = notification; - notification->cmdproc->cbs_table = cbs_table; - - return notification; -} - -void -msn_notification_destroy(MsnNotification *notification) -{ - notification->cmdproc->data = NULL; - - msn_servconn_set_destroy_cb(notification->servconn, NULL); - - msn_servconn_destroy(notification->servconn); - - g_free(notification); -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(MsnServConn *servconn) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - PurpleAccount *account; - char **a, **c, *vers; - int i; - - g_return_if_fail(servconn != NULL); - - cmdproc = servconn->cmdproc; - session = servconn->session; - account = session->account; - - /* Allocate an array for CVR0, NULL, and all the versions */ - a = c = g_new0(char *, session->protocol_ver - 8 + 3); - - for (i = session->protocol_ver; i >= 8; i--) - *c++ = g_strdup_printf("MSNP%d", i); - - *c++ = g_strdup("CVR0"); - - vers = g_strjoinv(" ", a); - - if (session->login_step == MSN_LOGIN_STEP_START) - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE); - else - msn_session_set_login_step(session, MSN_LOGIN_STEP_HANDSHAKE2); - - msn_cmdproc_send(cmdproc, "VER", "%s", vers); - - g_strfreev(a); - g_free(vers); -} - -gboolean -msn_notification_connect(MsnNotification *notification, const char *host, int port) -{ - MsnServConn *servconn; - - g_return_val_if_fail(notification != NULL, FALSE); - - servconn = notification->servconn; - - msn_servconn_set_connect_cb(servconn, connect_cb); - notification->in_use = msn_servconn_connect(servconn, host, port); - - return notification->in_use; -} - -void -msn_notification_disconnect(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - g_return_if_fail(notification->in_use); - - msn_servconn_disconnect(notification->servconn); - - notification->in_use = FALSE; -} - -/************************************************************************** - * Util - **************************************************************************/ - -static void -group_error_helper(MsnSession *session, const char *msg, int group_id, int error) -{ - PurpleAccount *account; - PurpleConnection *gc; - char *reason = NULL; - char *title = NULL; - - account = session->account; - gc = purple_account_get_connection(account); - - if (error == 224) - { - if (group_id == 0) - { - return; - } - else - { - const char *group_name; - group_name = - msn_userlist_find_group_name(session->userlist, - group_id); - reason = g_strdup_printf(_("%s is not a valid group."), - group_name); - } - } - else - { - reason = g_strdup(_("Unknown error.")); - } - - title = g_strdup_printf(_("%s on %s (%s)"), msg, - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - purple_notify_error(gc, NULL, title, reason); - g_free(title); - g_free(reason); -} - -/************************************************************************** - * Login - **************************************************************************/ - -void -msn_got_login_params(MsnSession *session, const char *login_params) -{ - MsnCmdProc *cmdproc; - - cmdproc = session->notification->cmdproc; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_END); - - msn_cmdproc_send(cmdproc, "USR", "TWN S %s", login_params); -} - -static void -cvr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - - account = cmdproc->session->account; - - msn_cmdproc_send(cmdproc, "USR", "TWN I %s", - purple_account_get_username(account)); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - if (!g_ascii_strcasecmp(cmd->params[1], "OK")) - { - /* OK */ - const char *friendly = purple_url_decode(cmd->params[3]); - - session->passport_info.verified = atoi(cmd->params[4]); - - purple_connection_set_display_name(gc, friendly); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_SYN); - - msn_cmdproc_send(cmdproc, "SYN", "%s", "0"); - } - else if (!g_ascii_strcasecmp(cmd->params[1], "TWN")) - { - /* Passport authentication */ - char **elems, **cur, **tokens; - - session->nexus = msn_nexus_new(session); - - /* Parse the challenge data. */ - - elems = g_strsplit(cmd->params[3], ",", 0); - - for (cur = elems; *cur != NULL; cur++) - { - tokens = g_strsplit(*cur, "=", 2); - g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]); - /* Don't free each of the tokens, only the array. */ - g_free(tokens); - } - - g_strfreev(elems); - - msn_session_set_login_step(session, MSN_LOGIN_STEP_AUTH_START); - - msn_nexus_connect(session->nexus); - } -} - -static void -usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnErrorType msnerr = 0; - - switch (error) - { - case 500: - case 601: - case 910: - case 921: - msnerr = MSN_ERROR_SERV_UNAVAILABLE; - break; - case 911: - msnerr = MSN_ERROR_AUTH; - break; - default: - return; - break; - } - - msn_session_set_error(cmdproc->session, msnerr, NULL); -} - -static void -ver_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - gboolean protocol_supported = FALSE; - char proto_str[8]; - size_t i; - - session = cmdproc->session; - account = session->account; - - g_snprintf(proto_str, sizeof(proto_str), "MSNP%d", session->protocol_ver); - - for (i = 1; i < cmd->param_count; i++) - { - if (!strcmp(cmd->params[i], proto_str)) - { - protocol_supported = TRUE; - break; - } - } - - if (!protocol_supported) - { - msn_session_set_error(session, MSN_ERROR_UNSUPPORTED_PROTOCOL, - NULL); - return; - } - - msn_cmdproc_send(cmdproc, "CVR", - "0x0409 winnt 5.1 i386 MSNMSGR 6.0.0602 MSMSGS %s", - purple_account_get_username(account)); -} - -/************************************************************************** - * Log out - **************************************************************************/ - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - if (!g_ascii_strcasecmp(cmd->params[0], "OTH")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SIGN_OTHER, - NULL); - else if (!g_ascii_strcasecmp(cmd->params[0], "SSD")) - msn_session_set_error(cmdproc->session, MSN_ERROR_SERV_DOWN, NULL); -} - -void -msn_notification_close(MsnNotification *notification) -{ - g_return_if_fail(notification != NULL); - - if (!notification->in_use) - return; - - msn_cmdproc_send_quick(notification->cmdproc, "OUT", NULL, NULL); - - msn_notification_disconnect(notification); -} - -/************************************************************************** - * Messages - **************************************************************************/ - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, - size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len); -#ifdef MSN_DEBUG_NS - msn_message_show_readable(msg, "Notification", TRUE); -#endif - - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_destroy(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - /* NOTE: cmd is not always cmdproc->last_cmd, sometimes cmd is a queued - * command and we are processing it */ - - if (cmd->payload == NULL) - { - cmdproc->last_cmd->payload_cb = msg_cmd_post; - cmdproc->servconn->payload_len = atoi(cmd->params[2]); - } - else - { - g_return_if_fail(cmd->payload_cb != NULL); - - cmd->payload_cb(cmdproc, cmd, cmd->payload, cmd->payload_len); - } -} - -/************************************************************************** - * Challenges - **************************************************************************/ - -static void -chl_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnTransaction *trans; - char buf[33]; - const char *challenge_resp; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; - int i; - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)cmd->params[1], - strlen(cmd->params[1])); - - challenge_resp = "VT6PX?UQTM4WM%YR"; - - purple_cipher_context_append(context, (const guchar *)challenge_resp, - strlen(challenge_resp)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - for (i = 0; i < 16; i++) - g_snprintf(buf + (i*2), 3, "%02x", digest[i]); - - trans = msn_transaction_new(cmdproc, "QRY", "%s 32", "PROD0038W!61ZTF9"); - - msn_transaction_set_payload(trans, buf, 32); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -/************************************************************************** - * Buddy Lists - **************************************************************************/ - -static void -add_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnUser *user; - const char *list; - const char *passport; - const char *friendly; - MsnListId list_id; - int group_id; - - list = cmd->params[1]; - passport = cmd->params[3]; - friendly = purple_url_decode(cmd->params[4]); - - session = cmdproc->session; - - user = msn_userlist_find_user(session->userlist, passport); - - if (user == NULL) - { - user = msn_user_new(session->userlist, passport, friendly); - msn_userlist_add_user(session->userlist, user); - } - else - msn_user_set_friendly_name(user, friendly); - - list_id = msn_get_list_id(list); - - if (cmd->param_count >= 6) - group_id = atoi(cmd->params[5]); - else - group_id = -1; - - msn_got_add_user(session, user, list_id, group_id); - msn_user_update(user); -} - -static void -add_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - const char *list, *passport; - char *reason = NULL; - char *msg = NULL; - char **params; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - params = g_strsplit(trans->params, " ", 0); - - list = params[0]; - passport = params[1]; - - if (!strcmp(list, "FL")) - msg = g_strdup_printf(_("Unable to add user on %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - else if (!strcmp(list, "BL")) - msg = g_strdup_printf(_("Unable to block user on %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - else if (!strcmp(list, "AL")) - msg = g_strdup_printf(_("Unable to permit user on %s (%s)"), - purple_account_get_username(account), - purple_account_get_protocol_name(account)); - - if (!strcmp(list, "FL")) - { - if (error == 210) - { - reason = g_strdup_printf(_("%s could not be added because " - "your buddy list is full."), passport); - } - } - - if (reason == NULL) - { - if (error == 208) - { - reason = g_strdup_printf(_("%s is not a valid passport account."), - passport); - } - else if (error == 500) - { - reason = g_strdup(_("Service Temporarily Unavailable.")); - } - else - { - reason = g_strdup(_("Unknown error.")); - } - } - - if (msg != NULL) - { - purple_notify_error(gc, NULL, msg, reason); - g_free(msg); - } - - if (!strcmp(list, "FL")) - { - PurpleBuddy *buddy; - - buddy = purple_find_buddy(account, passport); - - if (buddy != NULL) - purple_blist_remove_buddy(buddy); - } - - g_free(reason); - - g_strfreev(params); -} - -static void -adg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - gint group_id; - const char *group_name; - - session = cmdproc->session; - - group_id = atoi(cmd->params[3]); - - group_name = purple_url_decode(cmd->params[2]); - - msn_group_new(session->userlist, group_id, group_name); - - /* There is a user that must me moved to this group */ - if (cmd->trans->data) - { - /* msn_userlist_move_buddy(); */ - MsnUserList *userlist = cmdproc->session->userlist; - MsnMoveBuddy *data = cmd->trans->data; - - if (data->old_group_name != NULL) - { - msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->old_group_name); - g_free(data->old_group_name); - } - - msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, group_name); - g_free(data->who); - - } -} - -static void -qng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - static int count = 0; - const char *passport; - PurpleAccount *account; - - session = cmdproc->session; - account = session->account; - - if (session->passport_info.file == NULL) - return; - - passport = purple_normalize(account, purple_account_get_username(account)); - - if ((strstr(passport, "@hotmail.") == NULL) && - (strstr(passport, "@live.com") == NULL) && - (strstr(passport, "@msn.com") == NULL)) - return; - - if (count++ < 26) - return; - - count = 0; - msn_cmdproc_send(cmdproc, "URL", "%s", "INBOX"); -} - - -static void -fln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSlpLink *slplink; - MsnUser *user; - - user = msn_userlist_find_user(cmdproc->session->userlist, cmd->params[0]); - - user->status = "offline"; - msn_user_update(user); - - slplink = msn_session_find_slplink(cmdproc->session, cmd->params[0]); - - if (slplink != NULL) - msn_slplink_destroy(slplink); - -} - -static void -iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj; - const char *state, *passport, *friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[1]; - passport = cmd->params[2]; - friendly = purple_url_decode(cmd->params[3]); - - user = msn_userlist_find_user(session->userlist, passport); - - serv_got_alias(gc, passport, friendly); - - msn_user_set_friendly_name(user, friendly); - - if (session->protocol_ver >= 9 && cmd->param_count == 6) - { - msnobj = msn_object_new_from_string(purple_url_decode(cmd->params[5])); - msn_user_set_object(user, msnobj); - } - - msn_user_set_state(user, state); - msn_user_update(user); -} - -static void -ipg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ -#if 0 - purple_debug_misc("msn", "Incoming Page: {%s}\n", payload); -#endif -} - -static void -ipg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmdproc->servconn->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = ipg_cmd_post; -} - -static void -nln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnUser *user; - MsnObject *msnobj; - int clientid; - const char *state, *passport, *friendly, *old_friendly; - - session = cmdproc->session; - account = session->account; - gc = purple_account_get_connection(account); - - state = cmd->params[0]; - passport = cmd->params[1]; - friendly = purple_url_decode(cmd->params[2]); - - user = msn_userlist_find_user(session->userlist, passport); - - old_friendly = msn_user_get_friendly_name(user); - if (!old_friendly || (old_friendly && (!friendly || strcmp(old_friendly, friendly)))) - { - serv_got_alias(gc, passport, friendly); - msn_user_set_friendly_name(user, friendly); - } - - if (session->protocol_ver >= 9) - { - if (cmd->param_count == 5) - { - msnobj = - msn_object_new_from_string(purple_url_decode(cmd->params[4])); - msn_user_set_object(user, msnobj); - } - else - { - msn_user_set_object(user, NULL); - } - } - - clientid = atoi(cmd->params[3]); - user->mobile = (clientid & MSN_CLIENT_CAP_MSNMOBILE); - - msn_user_set_state(user, state); - msn_user_update(user); -} - -#if 0 -static void -chg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *state = cmd->params[1]; - int state_id = 0; - - if (!strcmp(state, "NLN")) - state_id = MSN_ONLINE; - else if (!strcmp(state, "BSY")) - state_id = MSN_BUSY; - else if (!strcmp(state, "IDL")) - state_id = MSN_IDLE; - else if (!strcmp(state, "BRB")) - state_id = MSN_BRB; - else if (!strcmp(state, "AWY")) - state_id = MSN_AWAY; - else if (!strcmp(state, "PHN")) - state_id = MSN_PHONE; - else if (!strcmp(state, "LUN")) - state_id = MSN_LUNCH; - else if (!strcmp(state, "HDN")) - state_id = MSN_HIDDEN; - - cmdproc->session->state = state_id; -} -#endif - - -static void -not_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ -#if 0 - MSN_SET_PARAMS("NOT %d\r\n%s", cmdproc->servconn->payload, payload); - purple_debug_misc("msn", "Notification: {%s}\n", payload); -#endif -} - -static void -not_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmdproc->servconn->payload_len = atoi(cmd->params[0]); - cmdproc->last_cmd->payload_cb = not_cmd_post; -} - -static void -rea_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - const char *friendly; - char *username; - - session = cmdproc->session; - account = session->account; - username = g_strdup(purple_normalize(account, - purple_account_get_username(account))); - - /* Only set display name if our *own* friendly name changed! */ - if (strcmp(username, purple_normalize(account, cmd->params[2]))) - { - g_free(username); - return; - } - - g_free(username); - - gc = account->gc; - friendly = purple_url_decode(cmd->params[3]); - - purple_connection_set_display_name(gc, friendly); -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - g_return_if_fail(cmd->param_count >= 3); - - type = cmd->params[2]; - - if (cmd->param_count == 4) - { - value = cmd->params[3]; - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - const char *type, *value, *passport; - MsnUser *user; - - passport = cmd->params[1]; - user = msn_userlist_find_user(cmdproc->session->userlist, passport); - - g_return_if_fail(user != NULL); - - type = cmd->params[2]; - value = cmd->params[3]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - else if (!strcmp(value, "N")) - user->mobile = FALSE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -static void -reg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - int group_id; - const char *group_name; - - session = cmdproc->session; - group_id = atoi(cmd->params[2]); - group_name = purple_url_decode(cmd->params[3]); - - msn_userlist_rename_group_id(session->userlist, group_id, group_name); -} - -static void -reg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int group_id; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - group_id = atoi(params[0]); - - group_error_helper(cmdproc->session, _("Unable to rename group"), group_id, error); - - g_strfreev(params); -} - -static void -rem_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnUser *user; - const char *list; - const char *passport; - MsnListId list_id; - int group_id; - - session = cmdproc->session; - list = cmd->params[1]; - passport = cmd->params[3]; - user = msn_userlist_find_user(session->userlist, passport); - - g_return_if_fail(user != NULL); - - list_id = msn_get_list_id(list); - - if (cmd->param_count == 5) - group_id = atoi(cmd->params[4]); - else - group_id = -1; - - msn_got_rem_user(session, user, list_id, group_id); - msn_user_update(user); -} - -static void -rmg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - int group_id; - - session = cmdproc->session; - group_id = atoi(cmd->params[2]); - - msn_userlist_remove_group_id(session->userlist, group_id); -} - -static void -rmg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int group_id; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - group_id = atoi(params[0]); - - group_error_helper(cmdproc->session, _("Unable to delete group"), group_id, error); - - g_strfreev(params); -} - -static void -syn_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnSync *sync; - int total_users; - - session = cmdproc->session; - - if (cmd->param_count == 2) - { - /* - * This can happen if we sent a SYN with an up-to-date - * buddy list revision, but we send 0 to get a full list. - * So, error out. - */ - - msn_session_set_error(cmdproc->session, MSN_ERROR_BAD_BLIST, NULL); - return; - } - - total_users = atoi(cmd->params[2]); - - sync = msn_sync_new(session); - sync->total_users = total_users; - sync->old_cbs_table = cmdproc->cbs_table; - - session->sync = sync; - cmdproc->cbs_table = sync->cbs_table; -} - -/************************************************************************** - * Misc commands - **************************************************************************/ - -static void -url_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - const char *rru; - const char *url; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; - FILE *fd; - char *buf; - char buf2[3]; - char sendbuf[64]; - int i; - - session = cmdproc->session; - account = session->account; - - rru = cmd->params[1]; - url = cmd->params[2]; - - buf = g_strdup_printf("%s%lu%s", - session->passport_info.mspauth ? session->passport_info.mspauth : "BOGUS", - time(NULL) - session->passport_info.sl, - purple_connection_get_password(account->gc)); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - g_free(buf); - - memset(sendbuf, 0, sizeof(sendbuf)); - - for (i = 0; i < 16; i++) - { - g_snprintf(buf2, sizeof(buf2), "%02x", digest[i]); - strcat(sendbuf, buf2); - } - - if (session->passport_info.file != NULL) - { - g_unlink(session->passport_info.file); - g_free(session->passport_info.file); - } - - if ((fd = purple_mkstemp(&session->passport_info.file, FALSE)) == NULL) - { - purple_debug_error("msn", - "Error opening temp passport file: %s\n", - g_strerror(errno)); - } - else - { -#ifdef _WIN32 - fputs("\n", fd); -#endif - fputs("\n" - "\n" - "\n" - "\n\n", - fd); - - fprintf(fd, "\n"); - fprintf(fd, "\n\n", - url); - fprintf(fd, "\n"); - fprintf(fd, "\n", - purple_account_get_username(account)); - fprintf(fd, "\n", - purple_account_get_username(account)); - if (session->passport_info.sid != NULL) - fprintf(fd, "\n", - session->passport_info.sid); - if (session->passport_info.kv != NULL) - fprintf(fd, "\n", - session->passport_info.kv); - fprintf(fd, "\n"); - fprintf(fd, "\n", - time(NULL) - session->passport_info.sl); - fprintf(fd, "\n", - rru); - if (session->passport_info.mspauth != NULL) - fprintf(fd, "\n", - session->passport_info.mspauth); - fprintf(fd, "\n", - sendbuf); /* TODO Digest me (huh? -- ChipX86) */ - fprintf(fd, "\n"); - fprintf(fd, "\n"); - fprintf(fd, "\n"); - fprintf(fd, "\n"); - - if (fclose(fd)) - { - purple_debug_error("msn", - "Error closing temp passport file: %s\n", - g_strerror(errno)); - - g_unlink(session->passport_info.file); - g_free(session->passport_info.file); - session->passport_info.file = NULL; - } -#ifdef _WIN32 - else - { - /* - * Renaming file with .html extension, so that the - * win32 open_url will work. - */ - char *tmp; - - if ((tmp = - g_strdup_printf("%s.html", - session->passport_info.file)) != NULL) - { - if (g_rename(session->passport_info.file, - tmp) == 0) - { - g_free(session->passport_info.file); - session->passport_info.file = tmp; - } - else - g_free(tmp); - } - } -#endif - } -} -/************************************************************************** - * Switchboards - **************************************************************************/ - -static void -rng_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - MsnSwitchBoard *swboard; - const char *session_id; - char *host; - int port; - - session = cmdproc->session; - session_id = cmd->params[0]; - - msn_parse_socket(cmd->params[1], &host, &port); - - if (session->http_method) - port = 80; - - swboard = msn_switchboard_new(session); - - msn_switchboard_set_invited(swboard, TRUE); - msn_switchboard_set_session_id(swboard, cmd->params[0]); - msn_switchboard_set_auth_key(swboard, cmd->params[3]); - swboard->im_user = g_strdup(cmd->params[4]); - /* msn_switchboard_add_user(swboard, cmd->params[4]); */ - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - char *host; - int port; - - if (strcmp(cmd->params[1], "SB") && strcmp(cmd->params[1], "NS")) - { - /* Maybe we can have a generic bad command error. */ - purple_debug_error("msn", "Bad XFR command (%s)\n", cmd->params[1]); - return; - } - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!strcmp(cmd->params[1], "SB")) - { - purple_debug_error("msn", "This shouldn't be handled here.\n"); - } - else if (!strcmp(cmd->params[1], "NS")) - { - MsnSession *session; - - session = cmdproc->session; - - msn_session_set_login_step(session, MSN_LOGIN_STEP_TRANSFER); - - msn_notification_connect(session->notification, host, port); - } - - g_free(host); -} - -/************************************************************************** - * Message Types - **************************************************************************/ - -static void -profile_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - const char *value; - - session = cmdproc->session; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if ((value = msn_message_get_attr(msg, "kv")) != NULL) - { - g_free(session->passport_info.kv); - session->passport_info.kv = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "sid")) != NULL) - { - g_free(session->passport_info.sid); - session->passport_info.sid = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "MSPAuth")) != NULL) - { - g_free(session->passport_info.mspauth); - session->passport_info.mspauth = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientIP")) != NULL) - { - g_free(session->passport_info.client_ip); - session->passport_info.client_ip = g_strdup(value); - } - - if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL) - session->passport_info.client_port = ntohs(atoi(value)); - - if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL) - session->passport_info.sl = atol(value); -} - -static void -initial_email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - const char *unread; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.file == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - unread = g_hash_table_lookup(table, "Inbox-Unread"); - - if (unread != NULL) - { - int count = atoi(unread); - - if (count > 0) - { - const char *passports[2] = { msn_user_get_passport(session->user) }; - const char *urls[2] = { session->passport_info.file }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, - passports, urls, NULL, NULL); - } - } - - g_hash_table_destroy(table); -} - -static void -email_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - PurpleConnection *gc; - GHashTable *table; - char *from, *subject, *tmp; - - session = cmdproc->session; - gc = session->account->gc; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - if (session->passport_info.file == NULL) - { - MsnTransaction *trans; - trans = msn_transaction_new(cmdproc, "URL", "%s", "INBOX"); - msn_transaction_queue_cmd(trans, msg->cmd); - - msn_cmdproc_send_trans(cmdproc, trans); - - return; - } - - if (!purple_account_get_check_mail(session->account)) - return; - - table = msn_message_get_hashtable_from_body(msg); - - from = subject = NULL; - - tmp = g_hash_table_lookup(table, "From"); - if (tmp != NULL) - from = purple_mime_decode_field(tmp); - - tmp = g_hash_table_lookup(table, "Subject"); - if (tmp != NULL) - subject = purple_mime_decode_field(tmp); - - purple_notify_email(gc, - (subject != NULL ? subject : ""), - (from != NULL ? from : ""), - msn_user_get_passport(session->user), - session->passport_info.file, NULL, NULL); - - g_free(from); - g_free(subject); - - g_hash_table_destroy(table); -} - -static void -system_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - GHashTable *table; - const char *type_s; - - if (strcmp(msg->remote_user, "Hotmail")) - /* This isn't an official message. */ - return; - - table = msn_message_get_hashtable_from_body(msg); - - if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) - { - int type = atoi(type_s); - char buf[MSN_BUF_LEN]; - int minutes; - - switch (type) - { - case 1: - minutes = atoi(g_hash_table_lookup(table, "Arg1")); - g_snprintf(buf, sizeof(buf), dngettext(PACKAGE, - "The MSN server will shut down for maintenance " - "in %d minute. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", - "The MSN server will shut down for maintenance " - "in %d minutes. You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\nAfter the " - "maintenance has been completed, you will be " - "able to successfully sign in.", minutes), - minutes); - default: - break; - } - - if (*buf != '\0') - purple_notify_info(cmdproc->session->account->gc, NULL, buf, NULL); - } - - g_hash_table_destroy(table); -} - -void -msn_notification_add_buddy(MsnNotification *notification, const char *list, - const char *who, const char *friendly_name, - int group_id) -{ - MsnCmdProc *cmdproc; - cmdproc = notification->servconn->cmdproc; - - if (group_id < 0 && !strcmp(list, "FL")) - group_id = 0; - - if (group_id >= 0) - { - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s %d", - list, who, friendly_name, group_id); - } - else - { - msn_cmdproc_send(cmdproc, "ADD", "%s %s %s", list, who, friendly_name); - } -} - -void -msn_notification_rem_buddy(MsnNotification *notification, const char *list, - const char *who, int group_id) -{ - MsnCmdProc *cmdproc; - cmdproc = notification->servconn->cmdproc; - - if (group_id >= 0) - { - msn_cmdproc_send(cmdproc, "REM", "%s %s %d", list, who, group_id); - } - else - { - msn_cmdproc_send(cmdproc, "REM", "%s %s", list, who); - } -} - -/************************************************************************** - * Init - **************************************************************************/ - -void -msn_notification_init(void) -{ - /* TODO: check prp, blp */ - - cbs_table = msn_table_new(); - - /* Synchronous */ - msn_table_add_cmd(cbs_table, "CHG", "CHG", NULL); - msn_table_add_cmd(cbs_table, "CHG", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "ADD", "ADD", add_cmd); - msn_table_add_cmd(cbs_table, "ADD", "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, "REM", "REM", rem_cmd); - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - msn_table_add_cmd(cbs_table, "USR", "XFR", xfr_cmd); - msn_table_add_cmd(cbs_table, "SYN", "SYN", syn_cmd); - msn_table_add_cmd(cbs_table, "CVR", "CVR", cvr_cmd); - msn_table_add_cmd(cbs_table, "VER", "VER", ver_cmd); - msn_table_add_cmd(cbs_table, "REA", "REA", rea_cmd); - msn_table_add_cmd(cbs_table, "PRP", "PRP", prp_cmd); - /* msn_table_add_cmd(cbs_table, "BLP", "BLP", blp_cmd); */ - msn_table_add_cmd(cbs_table, "BLP", "BLP", NULL); - msn_table_add_cmd(cbs_table, "REG", "REG", reg_cmd); - msn_table_add_cmd(cbs_table, "ADG", "ADG", adg_cmd); - msn_table_add_cmd(cbs_table, "RMG", "RMG", rmg_cmd); - msn_table_add_cmd(cbs_table, "XFR", "XFR", xfr_cmd); - - /* Asynchronous */ - msn_table_add_cmd(cbs_table, NULL, "IPG", ipg_cmd); - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "NOT", not_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); - - msn_table_add_cmd(cbs_table, NULL, "CHL", chl_cmd); - msn_table_add_cmd(cbs_table, NULL, "REM", rem_cmd); - msn_table_add_cmd(cbs_table, NULL, "ADD", add_cmd); - - msn_table_add_cmd(cbs_table, NULL, "QRY", NULL); - msn_table_add_cmd(cbs_table, NULL, "QNG", qng_cmd); - msn_table_add_cmd(cbs_table, NULL, "FLN", fln_cmd); - msn_table_add_cmd(cbs_table, NULL, "NLN", nln_cmd); - msn_table_add_cmd(cbs_table, NULL, "ILN", iln_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - msn_table_add_cmd(cbs_table, NULL, "RNG", rng_cmd); - - msn_table_add_cmd(cbs_table, NULL, "URL", url_cmd); - - msn_table_add_cmd(cbs_table, "fallback", "XFR", xfr_cmd); - - msn_table_add_error(cbs_table, "ADD", add_error); - msn_table_add_error(cbs_table, "REG", reg_error); - msn_table_add_error(cbs_table, "RMG", rmg_error); - /* msn_table_add_error(cbs_table, "REA", rea_error); */ - msn_table_add_error(cbs_table, "USR", usr_error); - - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsprofile", - profile_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsinitialemailnotification", - initial_email_msg); - msn_table_add_msg_type(cbs_table, - "text/x-msmsgsemailnotification", - email_msg); - msn_table_add_msg_type(cbs_table, - "application/x-msmsgssystemmessage", - system_msg); -} - -void -msn_notification_end(void) -{ - msn_table_destroy(cbs_table); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/notification.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/** - * @file notification.h Notification server functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_NOTIFICATION_H_ -#define _MSN_NOTIFICATION_H_ - -typedef struct _MsnNotification MsnNotification; - -#include "session.h" -#include "servconn.h" -#include "cmdproc.h" - -struct _MsnNotification -{ - MsnSession *session; - MsnCmdProc *cmdproc; - MsnServConn *servconn; - - gboolean in_use; -}; - -#include "state.h" - -void msn_notification_end(void); -void msn_notification_init(void); - -void msn_notification_add_buddy(MsnNotification *notification, - const char *list, const char *who, - const char *friendly_name, int group_id); -void msn_notification_rem_buddy(MsnNotification *notification, - const char *list, const char *who, - int group_id); -MsnNotification *msn_notification_new(MsnSession *session); -void msn_notification_destroy(MsnNotification *notification); -gboolean msn_notification_connect(MsnNotification *notification, - const char *host, int port); -void msn_notification_disconnect(MsnNotification *notification); - -/** - * Closes a notification. - * - * It's first closed, and then disconnected. - * - * @param notification The notification object to close. - */ -void msn_notification_close(MsnNotification *notification); - -void msn_got_login_params(MsnSession *session, const char *login_params); - -#endif /* _MSN_NOTIFICATION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,417 +0,0 @@ -/** - * @file object.c MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "object.h" -#include "debug.h" -/* Sha1 stuff */ -#include "cipher.h" -/* Base64 stuff */ -#include "util.h" - -#define GET_STRING_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - if (obj->field != NULL) \ - g_free(obj->field); \ - obj->field = g_strndup(tag, c - tag); \ - } \ - } - -#define GET_INT_TAG(field, id) \ - if ((tag = strstr(str, id "=\"")) != NULL) \ - { \ - char buf[16]; \ - size_t offset; \ - tag += strlen(id "=\""); \ - c = strchr(tag, '"'); \ - if (c != NULL) \ - { \ - memset(buf, 0, sizeof(buf)); \ - offset = c - tag; \ - if (offset >= sizeof(buf)) \ - offset = sizeof(buf) - 1; \ - strncpy(buf, tag, offset); \ - obj->field = atoi(buf); \ - } \ - } - -static GList *local_objs; - -MsnObject * -msn_object_new(void) -{ - MsnObject *obj; - - obj = g_new0(MsnObject, 1); - - msn_object_set_type(obj, MSN_OBJECT_UNKNOWN); - msn_object_set_friendly(obj, "AAA="); - - return obj; -} - -MsnObject * -msn_object_new_from_string(const char *str) -{ - MsnObject *obj; - char *tag, *c; - - g_return_val_if_fail(str != NULL, NULL); - - if (strncmp(str, "creator == NULL || obj->size == 0 || obj->type == 0 - || obj->location == NULL || obj->friendly == NULL - || obj->sha1d == NULL /*|| obj->sha1c == NULL*/) { - purple_debug_error("msn", "Discarding invalid msnobj: '%s'\n", str); - msn_object_destroy(obj); - obj = NULL; - } - - return obj; -} - -MsnObject* -msn_object_new_from_image(PurpleStoredImage *img, const char *location, - const char *creator, MsnObjectType type) -{ - MsnObject *msnobj; - - PurpleCipherContext *ctx; - char *buf; - gconstpointer data; - size_t size; - char *base64; - unsigned char digest[20]; - - msnobj = NULL; - - if (img == NULL) - return msnobj; - - size = purple_imgstore_get_size(img); - data = purple_imgstore_get_data(img); - - /* New object */ - msnobj = msn_object_new(); - msn_object_set_local(msnobj); - msn_object_set_type(msnobj, type); - msn_object_set_location(msnobj, location); - msn_object_set_creator(msnobj, creator); - - msn_object_set_image(msnobj, img); - - /* Compute the SHA1D field. */ - memset(digest, 0, sizeof(digest)); - - ctx = purple_cipher_context_new_by_name("sha1", NULL); - purple_cipher_context_append(ctx, data, size); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1d(msnobj, base64); - g_free(base64); - - msn_object_set_size(msnobj, size); - - /* Compute the SHA1C field. */ - buf = g_strdup_printf( - "Creator%sSize%dType%dLocation%sFriendly%sSHA1D%s", - msn_object_get_creator(msnobj), - msn_object_get_size(msnobj), - msn_object_get_type(msnobj), - msn_object_get_location(msnobj), - msn_object_get_friendly(msnobj), - msn_object_get_sha1d(msnobj)); - - memset(digest, 0, sizeof(digest)); - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, (const guchar *)buf, strlen(buf)); - purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(ctx); - g_free(buf); - - base64 = purple_base64_encode(digest, sizeof(digest)); - msn_object_set_sha1c(msnobj, base64); - g_free(base64); - - return msnobj; -} - -void -msn_object_destroy(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - g_free(obj->creator); - g_free(obj->location); - g_free(obj->friendly); - g_free(obj->sha1d); - g_free(obj->sha1c); - - purple_imgstore_unref(obj->img); - - if (obj->local) - local_objs = g_list_remove(local_objs, obj); - - g_free(obj); -} - -char * -msn_object_to_string(const MsnObject *obj) -{ - char *str; - const char *sha1c; - - g_return_val_if_fail(obj != NULL, NULL); - - sha1c = msn_object_get_sha1c(obj); - - str = g_strdup_printf("", - msn_object_get_creator(obj), - msn_object_get_size(obj), - msn_object_get_type(obj), - msn_object_get_location(obj), - msn_object_get_friendly(obj), - msn_object_get_sha1d(obj), - sha1c ? " SHA1C=\"" : "", - sha1c ? sha1c : "", - sha1c ? "\"" : ""); - - return str; -} - -void -msn_object_set_creator(MsnObject *obj, const char *creator) -{ - g_return_if_fail(obj != NULL); - - if (obj->creator != NULL) - g_free(obj->creator); - - obj->creator = (creator == NULL ? NULL : g_strdup(creator)); -} - -void -msn_object_set_size(MsnObject *obj, int size) -{ - g_return_if_fail(obj != NULL); - - obj->size = size; -} - -void -msn_object_set_type(MsnObject *obj, MsnObjectType type) -{ - g_return_if_fail(obj != NULL); - - obj->type = type; -} - -void -msn_object_set_location(MsnObject *obj, const char *location) -{ - g_return_if_fail(obj != NULL); - - if (obj->location != NULL) - g_free(obj->location); - - obj->location = (location == NULL ? NULL : g_strdup(location)); -} - -void -msn_object_set_friendly(MsnObject *obj, const char *friendly) -{ - g_return_if_fail(obj != NULL); - - if (obj->friendly != NULL) - g_free(obj->friendly); - - obj->friendly = (friendly == NULL ? NULL : g_strdup(friendly)); -} - -void -msn_object_set_sha1d(MsnObject *obj, const char *sha1d) -{ - g_return_if_fail(obj != NULL); - - if (obj->sha1d != NULL) - g_free(obj->sha1d); - - obj->sha1d = (sha1d == NULL ? NULL : g_strdup(sha1d)); -} - -void -msn_object_set_sha1c(MsnObject *obj, const char *sha1c) -{ - g_return_if_fail(obj != NULL); - - if (obj->sha1c != NULL) - g_free(obj->sha1c); - - obj->sha1c = (sha1c == NULL ? NULL : g_strdup(sha1c)); -} - -const char * -msn_object_get_creator(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->creator; -} - -int -msn_object_get_size(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, 0); - - return obj->size; -} - -MsnObjectType -msn_object_get_type(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, MSN_OBJECT_UNKNOWN); - - return obj->type; -} - -const char * -msn_object_get_location(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->location; -} - -const char * -msn_object_get_friendly(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->friendly; -} - -const char * -msn_object_get_sha1d(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1d; -} - -const char * -msn_object_get_sha1c(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - return obj->sha1c; -} - -const char * -msn_object_get_sha1(const MsnObject *obj) -{ - g_return_val_if_fail(obj != NULL, NULL); - - if(obj->sha1c != NULL) { - return obj->sha1c; - } else { - return obj->sha1d; - } -} - -static MsnObject * -msn_object_find_local(const char *sha1) -{ - GList *l; - - g_return_val_if_fail(sha1 != NULL, NULL); - - for (l = local_objs; l != NULL; l = l->next) - { - MsnObject *local_obj = l->data; - - if (!strcmp(msn_object_get_sha1(local_obj), sha1)) - return local_obj; - } - - return NULL; - -} - -void -msn_object_set_local(MsnObject *obj) -{ - g_return_if_fail(obj != NULL); - - obj->local = TRUE; - - local_objs = g_list_append(local_objs, obj); -} - -void -msn_object_set_image(MsnObject *obj, PurpleStoredImage *img) -{ - g_return_if_fail(obj != NULL); - g_return_if_fail(img != NULL); - - /* obj->local = TRUE; */ - - purple_imgstore_unref(obj->img); - obj->img = purple_imgstore_ref(img); -} - -PurpleStoredImage * -msn_object_get_image(const MsnObject *obj) -{ - MsnObject *local_obj; - - g_return_val_if_fail(obj != NULL, NULL); - - local_obj = msn_object_find_local(msn_object_get_sha1(obj)); - - if (local_obj != NULL) - return local_obj->img; - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/object.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,242 +0,0 @@ -/** - * @file object.h MSNObject API - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_OBJECT_H_ -#define _MSN_OBJECT_H_ - -#include "imgstore.h" - -#include "internal.h" - -typedef enum -{ - MSN_OBJECT_UNKNOWN = -1, /**< Unknown object */ - MSN_OBJECT_RESERVED1 = 1, /**< Reserved */ - MSN_OBJECT_EMOTICON = 2, /**< Custom Emoticon */ - MSN_OBJECT_USERTILE = 3, /**< UserTile (buddy icon) */ - MSN_OBJECT_RESERVED2 = 4, /**< Reserved */ - MSN_OBJECT_BACKGROUND = 5 /**< Background */ - -} MsnObjectType; - -typedef struct -{ - gboolean local; - - char *creator; - int size; - MsnObjectType type; - PurpleStoredImage *img; - char *location; - char *friendly; - char *sha1d; - char *sha1c; - -} MsnObject; - -/** - * Creates a MsnObject structure. - * - * @return A new MsnObject structure. - */ -MsnObject *msn_object_new(void); - -/** - * Creates a MsnObject structure from a string. - * - * @param str The string. - * - * @return The new MsnObject structure. - */ -MsnObject *msn_object_new_from_string(const char *str); - -/** - * Creates a MsnObject structure from a stored image - * - * @param img The image associated to object - * @param location The object location as stored in MsnObject - * @param creator The creator of the object - * @param type The type of the object - * - * @return A new MsnObject structure - */ -MsnObject *msn_object_new_from_image(PurpleStoredImage *img, - const char *location, const char *creator, MsnObjectType type); - -/** - * Destroys an MsnObject structure. - * - * @param obj The object structure. - */ -void msn_object_destroy(MsnObject *obj); - -/** - * Outputs a string representation of an MsnObject. - * - * @param obj The object. - * - * @return The string representation. This must be freed. - */ -char *msn_object_to_string(const MsnObject *obj); - -/** - * Sets the creator field in a MsnObject. - * - * @param creator The creator value. - */ -void msn_object_set_creator(MsnObject *obj, const char *creator); - -/** - * Sets the size field in a MsnObject. - * - * @param size The size value. - */ -void msn_object_set_size(MsnObject *obj, int size); - -/** - * Sets the type field in a MsnObject. - * - * @param type The type value. - */ -void msn_object_set_type(MsnObject *obj, MsnObjectType type); - -/** - * Sets the location field in a MsnObject. - * - * @param location The location value. - */ -void msn_object_set_location(MsnObject *obj, const char *location); - -/** - * Sets the friendly name field in a MsnObject. - * - * @param friendly The friendly name value. - */ -void msn_object_set_friendly(MsnObject *obj, const char *friendly); - -/** - * Sets the SHA1D field in a MsnObject. - * - * @param sha1d The sha1d value. - */ -void msn_object_set_sha1d(MsnObject *obj, const char *sha1d); - -/** - * Sets the SHA1C field in a MsnObject. - * - * @param sha1c The sha1c value. - */ -void msn_object_set_sha1c(MsnObject *obj, const char *sha1c); - -/** - * Associates an image with a MsnObject. - * - * @param obj The object. - * @param img The image to associate. - */ -void msn_object_set_image(MsnObject *obj, PurpleStoredImage *img); - -/** - * Returns a MsnObject's creator value. - * - * @param obj The object. - * - * @return The creator value. - */ -const char *msn_object_get_creator(const MsnObject *obj); - -/** - * Returns a MsnObject's size value. - * - * @param obj The object. - * - * @return The size value. - */ -int msn_object_get_size(const MsnObject *obj); - -/** - * Returns a MsnObject's type. - * - * @param obj The object. - * - * @return The object type. - */ -MsnObjectType msn_object_get_type(const MsnObject *obj); - -/** - * Returns a MsnObject's location value. - * - * @param obj The object. - * - * @return The location value. - */ -const char *msn_object_get_location(const MsnObject *obj); - -/** - * Returns a MsnObject's friendly name value. - * - * @param obj The object. - * - * @return The friendly name value. - */ -const char *msn_object_get_friendly(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1D value. - * - * @param obj The object. - * - * @return The SHA1D value. - */ -const char *msn_object_get_sha1d(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1c(const MsnObject *obj); - -/** - * Returns a MsnObject's SHA1C value if it exists, otherwise SHA1D. - * - * @param obj The object. - * - * @return The SHA1C value. - */ -const char *msn_object_get_sha1(const MsnObject *obj); - -/** - * Returns the image associated with the MsnObject. - * - * @param obj The object. - * - * @return The associated image. - */ -PurpleStoredImage *msn_object_get_image(const MsnObject *obj); - -void msn_object_set_local(MsnObject *obj); - -#endif /* _MSN_OBJECT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/** - * @file page.c Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "page.h" - -MsnPage * -msn_page_new(void) -{ - MsnPage *page; - - page = g_new0(MsnPage, 1); - - return page; -} - -void -msn_page_destroy(MsnPage *page) -{ - g_return_if_fail(page != NULL); - - if (page->body != NULL) - g_free(page->body); - - if (page->from_location != NULL) - g_free(page->from_location); - - if (page->from_phone != NULL) - g_free(page->from_phone); - - g_free(page); -} - -char * -msn_page_gen_payload(const MsnPage *page, size_t *ret_size) -{ - char *str; - - g_return_val_if_fail(page != NULL, NULL); - - str = - g_strdup_printf("%s", - msn_page_get_body(page)); - - if (ret_size != NULL) - *ret_size = strlen(str); - - return str; -} - -void -msn_page_set_body(MsnPage *page, const char *body) -{ - g_return_if_fail(page != NULL); - g_return_if_fail(body != NULL); - - if (page->body != NULL) - g_free(page->body); - - page->body = g_strdup(body); -} - -const char * -msn_page_get_body(const MsnPage *page) -{ - g_return_val_if_fail(page != NULL, NULL); - - return page->body; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/page.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/** - * @file page.h Paging functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_PAGE_H_ -#define _MSN_PAGE_H_ - -typedef struct _MsnPage MsnPage; - -#include "session.h" - -/** - * A page. - */ -struct _MsnPage -{ - char *from_location; - char *from_phone; - - char *body; -}; - -/** - * Creates a new, empty page. - * - * @return A new page. - */ -MsnPage *msn_page_new(void); - -/** - * Destroys a page. - */ -void msn_page_destroy(MsnPage *page); - -/** - * Generates the payload data of a page. - * - * @param page The page. - * @param ret_size The returned size of the payload. - * - * @return The payload data of a page. - */ -char *msn_page_gen_payload(const MsnPage *page, size_t *ret_size); - -/** - * Sets the body of a page. - * - * @param page The page. - * @param body The body of the page. - */ -void msn_page_set_body(MsnPage *page, const char *body); - -/** - * Returns the body of the page. - * - * @param page The page. - * - * @return The body of the page. - */ -const char *msn_page_get_body(const MsnPage *page); - -#endif /* _MSN_PAGE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,556 +0,0 @@ -/** - * @file servconn.c Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "servconn.h" -#include "error.h" - -static void read_cb(gpointer data, gint source, PurpleInputCondition cond); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnServConn * -msn_servconn_new(MsnSession *session, MsnServConnType type) -{ - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - servconn = g_new0(MsnServConn, 1); - - servconn->type = type; - - servconn->session = session; - servconn->cmdproc = msn_cmdproc_new(session); - servconn->cmdproc->servconn = servconn; - - servconn->httpconn = msn_httpconn_new(servconn); - - servconn->num = session->servconns_count++; - - servconn->tx_buf = purple_circ_buffer_new(MSN_BUF_LEN); - servconn->tx_handler = 0; - - return servconn; -} - -void -msn_servconn_destroy(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->processing) - { - servconn->wasted = TRUE; - return; - } - - if (servconn->connected) - msn_servconn_disconnect(servconn); - - if (servconn->destroy_cb) - servconn->destroy_cb(servconn); - - if (servconn->httpconn != NULL) - msn_httpconn_destroy(servconn->httpconn); - - g_free(servconn->host); - - purple_circ_buffer_destroy(servconn->tx_buf); - if (servconn->tx_handler > 0) - purple_input_remove(servconn->tx_handler); - - msn_cmdproc_destroy(servconn->cmdproc); - g_free(servconn); -} - -void -msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - servconn->connect_cb = connect_cb; -} - -void -msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->disconnect_cb = disconnect_cb; -} - -void -msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)) -{ - g_return_if_fail(servconn != NULL); - - servconn->destroy_cb = destroy_cb; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -void -msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error) -{ - char *tmp; - const char *reason; - - const char *names[] = { "Notification", "Switchboard" }; - const char *name; - - name = names[servconn->type]; - - switch (error) - { - case MSN_SERVCONN_ERROR_CONNECT: - reason = _("Unable to connect"); break; - case MSN_SERVCONN_ERROR_WRITE: - reason = _("Writing error"); break; - case MSN_SERVCONN_ERROR_READ: - reason = _("Reading error"); break; - default: - reason = _("Unknown error"); break; - } - - purple_debug_error("msn", "Connection error from %s server (%s): %s\n", - name, servconn->host, reason); - tmp = g_strdup_printf(_("Connection error from %s server:\n%s"), - name, reason); - - if (servconn->type == MSN_SERVCONN_NS) - { - msn_session_set_error(servconn->session, MSN_ERROR_SERVCONN, tmp); - } - else if (servconn->type == MSN_SERVCONN_SB) - { - MsnSwitchBoard *swboard; - swboard = servconn->cmdproc->data; - if (swboard != NULL) - swboard->error = MSN_SB_ERROR_CONNECTION; - } - - msn_servconn_disconnect(servconn); - - g_free(tmp); -} - -/************************************************************************** - * Connect - **************************************************************************/ - -static void -connect_cb(gpointer data, gint source, const gchar *error_message) -{ - MsnServConn *servconn; - - servconn = data; - servconn->connect_data = NULL; - servconn->processing = FALSE; - - if (servconn->wasted) - { - if (source >= 0) - close(source); - msn_servconn_destroy(servconn); - return; - } - - servconn->fd = source; - - if (source >= 0) - { - servconn->connected = TRUE; - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - servconn->inpa = purple_input_add(servconn->fd, PURPLE_INPUT_READ, - read_cb, data); - } - else - { - purple_debug_error("msn", "Connection error: %s\n", error_message); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_CONNECT); - } -} - -gboolean -msn_servconn_connect(MsnServConn *servconn, const char *host, int port) -{ - MsnSession *session; - - g_return_val_if_fail(servconn != NULL, FALSE); - g_return_val_if_fail(host != NULL, FALSE); - g_return_val_if_fail(port > 0, FALSE); - - session = servconn->session; - - if (servconn->connected) - msn_servconn_disconnect(servconn); - - g_free(servconn->host); - servconn->host = g_strdup(host); - - if (session->http_method) - { - /* HTTP Connection. */ - - if (!servconn->httpconn->connected) - if (!msn_httpconn_connect(servconn->httpconn, host, port)) - return FALSE; - - servconn->connected = TRUE; - servconn->httpconn->virgin = TRUE; - - /* Someone wants to know we connected. */ - servconn->connect_cb(servconn); - - return TRUE; - } - - servconn->connect_data = purple_proxy_connect(NULL, session->account, - host, port, connect_cb, servconn); - - if (servconn->connect_data != NULL) - { - servconn->processing = TRUE; - return TRUE; - } - else - return FALSE; -} - -void -msn_servconn_disconnect(MsnServConn *servconn) -{ - g_return_if_fail(servconn != NULL); - - if (servconn->connect_data != NULL) - { - purple_proxy_connect_cancel(servconn->connect_data); - servconn->connect_data = NULL; - } - - if (!servconn->connected) - { - /* We could not connect. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->session->http_method) - { - /* Fake disconnection. */ - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); - - return; - } - - if (servconn->inpa > 0) - { - purple_input_remove(servconn->inpa); - servconn->inpa = 0; - } - - close(servconn->fd); - - servconn->rx_buf = NULL; - servconn->rx_len = 0; - servconn->payload_len = 0; - - servconn->connected = FALSE; - - if (servconn->disconnect_cb != NULL) - servconn->disconnect_cb(servconn); -} - -static void -servconn_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(servconn->tx_buf); - - if (writelen == 0) { - purple_input_remove(servconn->tx_handler); - servconn->tx_handler = 0; - return; - } - - ret = write(servconn->fd, servconn->tx_buf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE); - return; - } - - purple_circ_buffer_mark_read(servconn->tx_buf, ret); -} - -ssize_t -msn_servconn_write(MsnServConn *servconn, const char *buf, size_t len) -{ - ssize_t ret = 0; - - g_return_val_if_fail(servconn != NULL, 0); - - if (!servconn->session->http_method) - { - if (servconn->tx_handler == 0) { - switch (servconn->type) - { - case MSN_SERVCONN_NS: - case MSN_SERVCONN_SB: - ret = write(servconn->fd, buf, len); - break; -#if 0 - case MSN_SERVCONN_DC: - ret = write(servconn->fd, &buf, sizeof(len)); - ret = write(servconn->fd, buf, len); - break; -#endif - default: - ret = write(servconn->fd, buf, len); - break; - } - } else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno == EAGAIN) - ret = 0; - if (ret >= 0 && ret < len) { - if (servconn->tx_handler == 0) - servconn->tx_handler = purple_input_add( - servconn->fd, PURPLE_INPUT_WRITE, - servconn_write_cb, servconn); - purple_circ_buffer_append(servconn->tx_buf, buf + ret, - len - ret); - } - } - else - { - ret = msn_httpconn_write(servconn->httpconn, buf, len); - } - - if (ret == -1) - { - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_WRITE); - } - - return ret; -} - -static void -read_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - MsnServConn *servconn; - MsnSession *session; - char buf[MSN_BUF_LEN]; - char *cur, *end, *old_rx_buf; - int len, cur_len; - - servconn = data; - session = servconn->session; - - len = read(servconn->fd, buf, sizeof(buf) - 1); - servconn->session->account->gc->last_received = time(NULL); - - if (len < 0 && errno == EAGAIN) - return; - else if (len <= 0) - { - purple_debug_error("msn", "servconn read error, len: %d error: %s\n", len, g_strerror(errno)); - msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ); - - return; - } - - buf[len] = '\0'; - - servconn->rx_buf = g_realloc(servconn->rx_buf, len + servconn->rx_len + 1); - memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1); - servconn->rx_len += len; - - end = old_rx_buf = servconn->rx_buf; - - servconn->processing = TRUE; - - do - { - cur = end; - - if (servconn->payload_len) - { - if (servconn->payload_len > servconn->rx_len) - /* The payload is still not complete. */ - break; - - cur_len = servconn->payload_len; - end += cur_len; - } - else - { - end = strstr(cur, "\r\n"); - - if (end == NULL) - /* The command is still not complete. */ - break; - - *end = '\0'; - end += 2; - cur_len = end - cur; - } - - servconn->rx_len -= cur_len; - - if (servconn->payload_len) - { - msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len); - servconn->payload_len = 0; - } - else - { - msn_cmdproc_process_cmd_text(servconn->cmdproc, cur); - } - } while (servconn->connected && !servconn->wasted && servconn->rx_len > 0); - - if (servconn->connected && !servconn->wasted) - { - if (servconn->rx_len > 0) - servconn->rx_buf = g_memdup(cur, servconn->rx_len); - else - servconn->rx_buf = NULL; - } - - servconn->processing = FALSE; - - if (servconn->wasted) - msn_servconn_destroy(servconn); - - g_free(old_rx_buf); -} - -#if 0 -static int -create_listener(int port) -{ - int fd; - int flags; - const int on = 1; - -#if 0 - struct addrinfo hints; - struct addrinfo *c, *res; - char port_str[5]; - - snprintf(port_str, sizeof(port_str), "%d", port); - - memset(&hints, 0, sizeof(hints)); - - hints.ai_flags = AI_PASSIVE; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - if (getaddrinfo(NULL, port_str, &hints, &res) != 0) - { - purple_debug_error("msn", "Could not get address info: %s.\n", - port_str); - return -1; - } - - for (c = res; c != NULL; c = c->ai_next) - { - fd = socket(c->ai_family, c->ai_socktype, c->ai_protocol); - - if (fd < 0) - continue; - - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - if (bind(fd, c->ai_addr, c->ai_addrlen) == 0) - break; - - close(fd); - } - - if (c == NULL) - { - purple_debug_error("msn", "Could not find socket: %s.\n", port_str); - return -1; - } - - freeaddrinfo(res); -#else - struct sockaddr_in sockin; - - fd = socket(AF_INET, SOCK_STREAM, 0); - - if (fd < 0) - return -1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) != 0) - { - close(fd); - return -1; - } - - memset(&sockin, 0, sizeof(struct sockaddr_in)); - sockin.sin_family = AF_INET; - sockin.sin_port = htons(port); - - if (bind(fd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) - { - close(fd); - return -1; - } -#endif - - if (listen (fd, 4) != 0) - { - close (fd); - return -1; - } - - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/servconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -/** - * @file servconn.h Server connection functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SERVCONN_H_ -#define _MSN_SERVCONN_H_ - -typedef struct _MsnServConn MsnServConn; - -#include "session.h" -#include "cmdproc.h" - -#include "proxy.h" -#include "httpconn.h" - -/** - * Connection error types. - */ -typedef enum -{ - MSN_SERVCONN_ERROR_NONE, - MSN_SERVCONN_ERROR_CONNECT, - MSN_SERVCONN_ERROR_WRITE, - MSN_SERVCONN_ERROR_READ, - -} MsnServConnError; - -/** - * Connection types. - */ -typedef enum -{ - MSN_SERVCONN_NS, - MSN_SERVCONN_SB - -} MsnServConnType; - -/** - * A Connection. - */ -struct _MsnServConn -{ - MsnServConnType type; /**< The type of this connection. */ - MsnSession *session; /**< The MSN session of this connection. */ - MsnCmdProc *cmdproc; /**< The command processor of this connection. */ - - PurpleProxyConnectData *connect_data; - - gboolean connected; /**< A flag that states if it's connected. */ - gboolean processing; /**< A flag that states if something is working - with this connection. */ - gboolean wasted; /**< A flag that states if it should be destroyed. */ - - char *host; /**< The host this connection is connected or should be - connected to. */ - int num; /**< A number id of this connection. */ - - MsnHttpConn *httpconn; /**< The HTTP connection this connection should use. */ - - int fd; /**< The connection's file descriptor. */ - int inpa; /**< The connection's input handler. */ - - char *rx_buf; /**< The receive buffer. */ - int rx_len; /**< The receive buffer lenght. */ - - size_t payload_len; /**< The length of the payload. - It's only set when we've received a command that - has a payload. */ - - PurpleCircBuffer *tx_buf; - guint tx_handler; - - void (*connect_cb)(MsnServConn *); /**< The callback to call when connecting. */ - void (*disconnect_cb)(MsnServConn *); /**< The callback to call when disconnecting. */ - void (*destroy_cb)(MsnServConn *); /**< The callback to call when destroying. */ -}; - -/** - * Creates a new connection object. - * - * @param session The session. - * @param type The type of the connection. - */ -MsnServConn *msn_servconn_new(MsnSession *session, MsnServConnType type); - -/** - * Destroys a connection object. - * - * @param servconn The connection. - */ -void msn_servconn_destroy(MsnServConn *servconn); - -/** - * Connects to a host. - * - * @param servconn The connection. - * @param host The host. - * @param port The port. - */ -gboolean msn_servconn_connect(MsnServConn *servconn, const char *host, int port); - -/** - * Disconnects. - * - * @param servconn The connection. - */ -void msn_servconn_disconnect(MsnServConn *servconn); - -/** - * Sets the connect callback. - * - * @param servconn The servconn. - * @param connect_cb The connect callback. - */ -void msn_servconn_set_connect_cb(MsnServConn *servconn, - void (*connect_cb)(MsnServConn *)); -/** - * Sets the disconnect callback. - * - * @param servconn The servconn. - * @param disconnect_cb The disconnect callback. - */ -void msn_servconn_set_disconnect_cb(MsnServConn *servconn, - void (*disconnect_cb)(MsnServConn *)); -/** - * Sets the destroy callback. - * - * @param servconn The servconn that's being destroyed. - * @param destroy_cb The destroy callback. - */ -void msn_servconn_set_destroy_cb(MsnServConn *servconn, - void (*destroy_cb)(MsnServConn *)); - -/** - * Writes a chunck of data to the servconn. - * - * @param servconn The servconn. - * @param buf The data to write. - * @param size The size of the data. - */ -ssize_t msn_servconn_write(MsnServConn *servconn, const char *buf, - size_t size); - -/** - * Function to call whenever an error related to a switchboard occurs. - * - * @param servconn The servconn. - * @param error The error that happened. - */ -void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error); - -#endif /* _MSN_SERVCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,432 +0,0 @@ -/** - * @file session.c MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "session.h" -#include "notification.h" - -#include "dialog.h" - -MsnSession * -msn_session_new(PurpleAccount *account) -{ - MsnSession *session; - - g_return_val_if_fail(account != NULL, NULL); - - session = g_new0(MsnSession, 1); - - session->account = account; - session->notification = msn_notification_new(session); - session->userlist = msn_userlist_new(session); - - session->user = msn_user_new(session->userlist, - purple_account_get_username(account), NULL); - - session->protocol_ver = 9; - - return session; -} - -void -msn_session_destroy(MsnSession *session) -{ - g_return_if_fail(session != NULL); - - session->destroying = TRUE; - - if (session->connected) - msn_session_disconnect(session); - - if (session->notification != NULL) - msn_notification_destroy(session->notification); - - while (session->switches != NULL) - msn_switchboard_destroy(session->switches->data); - - while (session->slplinks != NULL) - msn_slplink_destroy(session->slplinks->data); - - msn_userlist_destroy(session->userlist); - - g_free(session->passport_info.kv); - g_free(session->passport_info.sid); - g_free(session->passport_info.mspauth); - g_free(session->passport_info.client_ip); - - if (session->passport_info.file != NULL) - { - g_unlink(session->passport_info.file); - g_free(session->passport_info.file); - } - - if (session->sync != NULL) - msn_sync_destroy(session->sync); - - if (session->nexus != NULL) - msn_nexus_destroy(session->nexus); - - if (session->user != NULL) - msn_user_destroy(session->user); - - g_free(session); -} - -gboolean -msn_session_connect(MsnSession *session, const char *host, int port, - gboolean http_method) -{ - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(!session->connected, TRUE); - - session->connected = TRUE; - session->http_method = http_method; - - if (session->notification == NULL) - { - purple_debug_error("msn", "This shouldn't happen\n"); - g_return_val_if_reached(FALSE); - } - - if (msn_notification_connect(session->notification, host, port)) - { - return TRUE; - } - - return FALSE; -} - -void -msn_session_disconnect(MsnSession *session) -{ - g_return_if_fail(session != NULL); - g_return_if_fail(session->connected); - - session->connected = FALSE; - - while (session->switches != NULL) - msn_switchboard_close(session->switches->data); - - if (session->notification != NULL) - msn_notification_close(session->notification); -} - -/* TODO: This must go away when conversation is redesigned */ -MsnSwitchBoard * -msn_session_find_swboard(MsnSession *session, const char *username) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user)) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_find_swboard_with_conv(MsnSession *session, PurpleConversation *conv) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(conv != NULL, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->conv == conv) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_find_swboard_with_id(const MsnSession *session, int chat_id) -{ - GList *l; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(chat_id >= 0, NULL); - - for (l = session->switches; l != NULL; l = l->next) - { - MsnSwitchBoard *swboard; - - swboard = l->data; - - if (swboard->chat_id == chat_id) - return swboard; - } - - return NULL; -} - -MsnSwitchBoard * -msn_session_get_swboard(MsnSession *session, const char *username, - MsnSBFlag flag) -{ - MsnSwitchBoard *swboard; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = msn_session_find_swboard(session, username); - - if (swboard == NULL) - { - swboard = msn_switchboard_new(session); - swboard->im_user = g_strdup(username); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, username); - } - - swboard->flag |= flag; - - return swboard; -} - -static void -msn_session_sync_users(MsnSession *session) -{ - PurpleConnection *gc = purple_account_get_connection(session->account); - GList *to_remove = NULL; - GSList *buddies; - - g_return_if_fail(gc != NULL); - - /* The core used to use msn_add_buddy to add all buddies before - * being logged in. This no longer happens, so we manually iterate - * over the whole buddy list to identify sync issues. */ - for (buddies = purple_find_buddies(session->account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *buddy = buddies->data; - const char *buddy_name = purple_buddy_get_name(buddy); - const char *group_name = purple_group_get_name(purple_buddy_get_group(buddy)); - MsnUser *remote_user; - gboolean found = FALSE; - - remote_user = msn_userlist_find_user(session->userlist, buddy_name); - - if (remote_user && remote_user->list_op & MSN_LIST_FL_OP) { - int group_id; - GList *l; - - group_id = msn_userlist_find_group_id(remote_user->userlist, - group_name); - - for (l = remote_user->group_ids; l; l = l->next) { - if (group_id == GPOINTER_TO_INT(l->data)) { - found = TRUE; - break; - } - } - - /* We don't care if they're in a different group, as long as they're on the - * list somewhere. If we check for the group, we cause pain, agony and - * suffering for people who decide to re-arrange their buddy list elsewhere. - */ - if (!found) - { - if ((remote_user == NULL) || !(remote_user->list_op & MSN_LIST_FL_OP)) { - /* The user is not on the server list */ - msn_show_sync_issue(session, buddy_name, group_name); - } else { - /* The user is not in that group on the server list */ - to_remove = g_list_prepend(to_remove, buddy); - } - } - } - } - - if (to_remove != NULL) { - g_list_foreach(to_remove, (GFunc)purple_blist_remove_buddy, NULL); - g_list_free(to_remove); - } -} - -void -msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info) -{ - PurpleConnection *gc; - PurpleConnectionError reason; - char *msg; - - gc = purple_account_get_connection(session->account); - - switch (error) - { - case MSN_ERROR_SERVCONN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(info); - break; - case MSN_ERROR_UNSUPPORTED_PROTOCOL: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Our protocol is not supported by the " - "server")); - break; - case MSN_ERROR_HTTP_MALFORMED: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Error parsing HTTP")); - break; - case MSN_ERROR_SIGN_OTHER: - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - msg = g_strdup(_("You have signed on from another location")); - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); - break; - case MSN_ERROR_SERV_UNAVAILABLE: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are temporarily " - "unavailable. Please wait and try " - "again.")); - break; - case MSN_ERROR_SERV_DOWN: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("The MSN servers are going down " - "temporarily")); - break; - case MSN_ERROR_AUTH: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - msg = g_strdup_printf(_("Unable to authenticate: %s"), - (info == NULL ) ? - _("Unknown error") : info); - break; - case MSN_ERROR_BAD_BLIST: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Your MSN buddy list is temporarily " - "unavailable. Please wait and try " - "again.")); - break; - default: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - msg = g_strdup(_("Unknown error")); - break; - } - - msn_session_disconnect(session); - - purple_connection_error_reason(gc, reason, msg); - - g_free(msg); -} - -static const char * -get_login_step_text(MsnSession *session) -{ - const char *steps_text[] = { - _("Connecting"), - _("Handshaking"), - _("Transferring"), - _("Handshaking"), - _("Starting authentication"), - _("Getting cookie"), - _("Authenticating"), - _("Sending cookie"), - _("Retrieving buddy list") - }; - - return steps_text[session->login_step]; -} - -void -msn_session_set_login_step(MsnSession *session, MsnLoginStep step) -{ - PurpleConnection *gc; - - /* Prevent the connection progress going backwards, eg. if we get - * transferred several times during login */ - if (session->login_step > step) - return; - - /* If we're already logged in, we're probably here because of a - * mid-session XFR from the notification server, so we don't want to - * popup the connection progress dialog */ - if (session->logged_in) - return; - - gc = session->account->gc; - - session->login_step = step; - - purple_connection_update_progress(gc, get_login_step_text(session), step, - MSN_LOGIN_STEPS); -} - -void -msn_session_finish_login(MsnSession *session) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurpleStoredImage *img; - const char *passport; - - if (session->logged_in) { - /* We are probably here because of a mid-session notification server XFR - * We must send a CHG now, otherwise the servers default to invisible, - * and prevent things happening, like sending IMs */ - msn_change_status(session); - return; - } - - account = session->account; - gc = purple_account_get_connection(account); - - img = purple_buddy_icons_find_account_icon(session->account); - msn_user_set_buddy_icon(session->user, img); - purple_imgstore_unref(img); - - session->logged_in = TRUE; - - msn_change_status(session); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Sync users */ - msn_session_sync_users(session); - /* It seems that some accounts that haven't accessed hotmail for a while - * and @msn.com accounts don't automatically get the initial email - * notification so we always request it on login - */ - - passport = purple_normalize(account, purple_account_get_username(account)); - - if ((strstr(passport, "@hotmail.") != NULL) || - (strstr(passport, "@msn.com") != NULL)) - { - msn_cmdproc_send(session->notification->cmdproc, "URL", "%s", "INBOX"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -/** - * @file session.h MSN session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SESSION_H_ -#define _MSN_SESSION_H_ - -typedef struct _MsnSession MsnSession; - -#include "sslconn.h" - -#include "user.h" -#include "slpcall.h" - -#include "notification.h" -#include "switchboard.h" -#include "group.h" - -#include "cmdproc.h" -#include "nexus.h" -#include "httpconn.h" - -#include "userlist.h" -#include "sync.h" - -/** - * Types of errors. - */ -typedef enum -{ - MSN_ERROR_SERVCONN, - MSN_ERROR_UNSUPPORTED_PROTOCOL, - MSN_ERROR_HTTP_MALFORMED, - MSN_ERROR_AUTH, - MSN_ERROR_BAD_BLIST, - MSN_ERROR_SIGN_OTHER, - MSN_ERROR_SERV_DOWN, - MSN_ERROR_SERV_UNAVAILABLE - -} MsnErrorType; - -/** - * Login steps. - */ -typedef enum -{ - MSN_LOGIN_STEP_START, - MSN_LOGIN_STEP_HANDSHAKE, - MSN_LOGIN_STEP_TRANSFER, - MSN_LOGIN_STEP_HANDSHAKE2, - MSN_LOGIN_STEP_AUTH_START, - MSN_LOGIN_STEP_AUTH, - MSN_LOGIN_STEP_GET_COOKIE, - MSN_LOGIN_STEP_AUTH_END, - MSN_LOGIN_STEP_SYN, - MSN_LOGIN_STEP_END - -} MsnLoginStep; - -#define MSN_LOGIN_STEPS MSN_LOGIN_STEP_END - -struct _MsnSession -{ - PurpleAccount *account; - MsnUser *user; - - guint protocol_ver; - - MsnLoginStep login_step; /**< The current step in the login process. */ - - gboolean connected; - gboolean logged_in; /**< A temporal flag to ignore local buddy list adds. */ - gboolean destroying; /**< A flag that states if the session is being destroyed. */ - gboolean http_method; - - MsnNotification *notification; - MsnNexus *nexus; - MsnSync *sync; - - MsnUserList *userlist; - - int servconns_count; /**< The count of server connections. */ - GList *switches; /**< The list of all the switchboards. */ - GList *directconns; /**< The list of all the directconnections. */ - GList *slplinks; /**< The list of all the slplinks. */ - - struct - { - char *kv; - char *sid; - char *mspauth; - unsigned long sl; - char *file; - char *client_ip; - int client_port; - int verified; - } passport_info; -}; - -/** - * Creates an MSN session. - * - * @param account The account. - * - * @return The new MSN session. - */ -MsnSession *msn_session_new(PurpleAccount *account); - -/** - * Destroys an MSN session. - * - * @param session The MSN session to destroy. - */ -void msn_session_destroy(MsnSession *session); - -/** - * Connects to and initiates an MSN session. - * - * @param session The MSN session. - * @param host The dispatch server host. - * @param port The dispatch server port. - * @param http_method Whether to use or not http_method. - * - * @return @c TRUE on success, @c FALSE on failure. - */ -gboolean msn_session_connect(MsnSession *session, - const char *host, int port, - gboolean http_method); - -/** - * Disconnects from an MSN session. - * - * @param session The MSN session. - */ -void msn_session_disconnect(MsnSession *session); - - /** - * Finds a switchboard with the given username. - * - * @param session The MSN session. - * @param username The username to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard(MsnSession *session, - const char *username); - - /** - * Finds a switchboard with the given conversation. - * - * @param session The MSN session. - * @param conv The conversation to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_conv(MsnSession *session, - PurpleConversation *conv); -/** - * Finds a switchboard with the given chat ID. - * - * @param session The MSN session. - * @param chat_id The chat ID to search for. - * - * @return The switchboard, if found. - */ -MsnSwitchBoard *msn_session_find_swboard_with_id(const MsnSession *session, - int chat_id); - -/** - * Returns a switchboard to communicate with certain username. - * - * @param session The MSN session. - * @param username The username to search for. - * @param flag The flag of the switchboard - * - * @return The switchboard. - */ -MsnSwitchBoard *msn_session_get_swboard(MsnSession *session, - const char *username, MsnSBFlag flag); - -/** - * Sets an error for the MSN session. - * - * @param session The MSN session. - * @param error The error. - * @param info Extra information. - */ -void msn_session_set_error(MsnSession *session, MsnErrorType error, - const char *info); - -/** - * Sets the current step in the login proccess. - * - * @param session The MSN session. - * @param step The current step. - */ -void msn_session_set_login_step(MsnSession *session, MsnLoginStep step); - -/** - * Finish the login proccess. - * - * @param session The MSN session. - */ -void msn_session_finish_login(MsnSession *session); - -#endif /* _MSN_SESSION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1122 +0,0 @@ -/** - * @file msnslp.c MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slp.h" -#include "slpcall.h" -#include "slpmsg.h" -#include "slpsession.h" - -#include "object.h" -#include "user.h" -#include "switchboard.h" - -#include "smiley.h" - -/* Seconds to delay between sending buddy icon requests to the server. */ -#define BUDDY_ICON_DELAY 20 - -static void send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -static void send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content); - -void msn_request_user_display(MsnUser *user); - -/************************************************************************** - * Util - **************************************************************************/ - -static char * -get_token(const char *str, const char *start, const char *end) -{ - const char *c, *c2; - - if ((c = strstr(str, start)) == NULL) - return NULL; - - c += strlen(start); - - if (end != NULL) - { - if ((c2 = strstr(c, end)) == NULL) - return NULL; - - return g_strndup(c, c2 - c); - } - else - { - /* This has to be changed */ - return g_strdup(c); - } - -} - -/************************************************************************** - * Xfer - **************************************************************************/ - -static void -msn_xfer_init(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - /* MsnSlpLink *slplink; */ - char *content; - - purple_debug_info("msn", "xfer_init\n"); - - slpcall = xfer->data; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_unleash(slpcall->slplink); -} - -void -msn_xfer_cancel(PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *content; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - - slpcall = xfer->data; - - if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) - { - if (slpcall->started) - { - msn_slp_call_close(slpcall); - } - else - { - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_decline(slpcall, slpcall->branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - msn_slplink_unleash(slpcall->slplink); - - msn_slp_call_destroy(slpcall); - } - } -} - -void -msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize len, gsize offset) -{ - PurpleXfer *xfer; - - xfer = slpcall->xfer; - - xfer->bytes_sent = (offset + len); - xfer->bytes_remaining = total_length - (offset + len); - - purple_xfer_update_progress(xfer); -} - -void -msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session) -{ - if ((purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_DONE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_REMOTE) && - (purple_xfer_get_status(slpcall->xfer) != PURPLE_XFER_STATUS_CANCEL_LOCAL)) - { - purple_xfer_cancel_remote(slpcall->xfer); - } -} - -void -msn_xfer_completed_cb(MsnSlpCall *slpcall, const guchar *body, - gsize size) -{ - PurpleXfer *xfer = slpcall->xfer; - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); -} - -/************************************************************************** - * SLP Control - **************************************************************************/ - -#if 0 -static void -got_transresp(MsnSlpCall *slpcall, const char *nonce, - const char *ips_str, int port) -{ - MsnDirectConn *directconn; - char **ip_addrs, **c; - - directconn = msn_directconn_new(slpcall->slplink); - - directconn->initial_call = slpcall; - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - ip_addrs = g_strsplit(ips_str, " ", -1); - - for (c = ip_addrs; *c != NULL; c++) - { - purple_debug_info("msn", "ip_addr = %s\n", *c); - if (msn_directconn_connect(directconn, *c, port)) - break; - } - - g_strfreev(ip_addrs); -} -#endif - -static void -send_ok(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 200 OK */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 200 OK", - branch, type, content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP 200 OK"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_queue_slpmsg(slplink, slpmsg); - - msn_slp_call_session_init(slpcall); -} - -static void -send_decline(MsnSlpCall *slpcall, const char *branch, - const char *type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - - slplink = slpcall->slplink; - - /* 603 Decline */ - slpmsg = msn_slpmsg_sip_new(slpcall, 1, - "MSNSLP/1.0 603 Decline", - branch, type, content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP 603 Decline"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -#define MAX_FILE_NAME_LEN 0x226 - -static void -got_sessionreq(MsnSlpCall *slpcall, const char *branch, - const char *euf_guid, const char *context) -{ - if (!strcmp(euf_guid, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6")) - { - /* Emoticon or UserDisplay */ - char *content; - gsize len; - MsnSlpSession *slpsession; - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - MsnObject *obj; - char *msnobj_data; - PurpleStoredImage *img; - int type; - - /* Send Ok */ - content = g_strdup_printf("SessionID: %lu\r\n\r\n", - slpcall->session_id); - - send_ok(slpcall, branch, "application/x-msnmsgr-sessionreqbody", - content); - - g_free(content); - - slplink = slpcall->slplink; - - msnobj_data = (char *)purple_base64_decode(context, &len); - obj = msn_object_new_from_string(msnobj_data); - type = msn_object_get_type(obj); - g_free(msnobj_data); - - if ((type != MSN_OBJECT_USERTILE) && (type != MSN_OBJECT_EMOTICON)) - { - purple_debug_error("msn", "Wrong object?\n"); - msn_object_destroy(obj); - g_return_if_reached(); - } - - if (type == MSN_OBJECT_EMOTICON) { - char *path; - path = g_build_filename(purple_smileys_get_storing_dir(), - obj->location, NULL); - img = purple_imgstore_new_from_file(path); - g_free(path); - } else { - img = msn_object_get_image(obj); - if (img) - purple_imgstore_ref(img); - } - msn_object_destroy(obj); - - if (img == NULL) - { - purple_debug_error("msn", "Wrong object.\n"); - g_return_if_reached(); - } - - slpsession = msn_slplink_find_slp_session(slplink, - slpcall->session_id); - - /* DATA PREP */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->slpsession = slpsession; - slpmsg->session_id = slpsession->id; - msn_slpmsg_set_body(slpmsg, NULL, 4); -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP DATA PREP"; -#endif - msn_slplink_queue_slpmsg(slplink, slpmsg); - - /* DATA */ - slpmsg = msn_slpmsg_new(slplink); - slpmsg->slpcall = slpcall; - slpmsg->slpsession = slpsession; - slpmsg->flags = 0x20; -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP DATA"; -#endif - msn_slpmsg_set_image(slpmsg, img); - msn_slplink_queue_slpmsg(slplink, slpmsg); - purple_imgstore_unref(img); - } - else if (!strcmp(euf_guid, "5D3E02AB-6190-11D3-BBBB-00C04F795683")) - { - /* File Transfer */ - PurpleAccount *account; - PurpleXfer *xfer; - char *bin; - gsize bin_len; - guint32 file_size; - gchar *file_name; - gunichar2 *uni_name; - - account = slpcall->slplink->session->account; - - slpcall->cb = msn_xfer_completed_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->progress_cb = msn_xfer_progress_cb; - slpcall->branch = g_strdup(branch); - - slpcall->pending = TRUE; - - xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, - slpcall->slplink->remote_user); - if (xfer) - { - bin = (char *)purple_base64_decode(context, &bin_len); - file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8)); - - uni_name = (gunichar2 *)(bin + 20); - while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) { - *uni_name = GUINT16_FROM_LE(*uni_name); - uni_name++; - } - - file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1, - NULL, NULL, NULL); - - g_free(bin); - - purple_xfer_set_filename(xfer, file_name ? file_name : ""); - g_free(file_name); - purple_xfer_set_size(xfer, file_size); - purple_xfer_set_init_fnc(xfer, msn_xfer_init); - purple_xfer_set_request_denied_fnc(xfer, msn_xfer_cancel); - purple_xfer_set_cancel_recv_fnc(xfer, msn_xfer_cancel); - - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - xfer->data = slpcall; - - purple_xfer_request(xfer); - } - } -} - -void -send_bye(MsnSlpCall *slpcall, const char *type) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - - slplink = slpcall->slplink; - - g_return_if_fail(slplink != NULL); - - header = g_strdup_printf("BYE MSNMSGR:%s MSNSLP/1.0", - slplink->local_user); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, - "A0D624A6-6C0C-4283-A9E0-BC97B4B46D32", - type, - "\r\n"); - g_free(header); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP BYE"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_queue_slpmsg(slplink, slpmsg); -} - -static void -got_invite(MsnSlpCall *slpcall, - const char *branch, const char *type, const char *content) -{ - MsnSlpLink *slplink; - - slplink = slpcall->slplink; - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { - char *euf_guid, *context; - char *temp; - - euf_guid = get_token(content, "EUF-GUID: {", "}\r\n"); - - temp = get_token(content, "SessionID: ", "\r\n"); - if (temp != NULL) - slpcall->session_id = atoi(temp); - g_free(temp); - - temp = get_token(content, "AppID: ", "\r\n"); - if (temp != NULL) - slpcall->app_id = atoi(temp); - g_free(temp); - - context = get_token(content, "Context: ", "\r\n"); - - if (context != NULL) - got_sessionreq(slpcall, branch, euf_guid, context); - - g_free(context); - g_free(euf_guid); - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* A direct connection? */ - - char *listening, *nonce; - char *content; - - if (FALSE) - { -#if 0 - MsnDirectConn *directconn; - /* const char *ip_addr; */ - char *ip_port; - int port; - - /* ip_addr = purple_prefs_get_string("/purple/ft/public_ip"); */ - ip_port = "5190"; - listening = "true"; - nonce = rand_guid(); - - directconn = msn_directconn_new(slplink); - - /* msn_directconn_parse_nonce(directconn, nonce); */ - directconn->nonce = g_strdup(nonce); - - msn_directconn_listen(directconn); - - port = directconn->port; - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "Ipv4Internal-Addrs: 192.168.0.82\r\n" - "Ipv4Internal-Port: %d\r\n" - "\r\n", - listening, - nonce, - port); -#endif - } - else - { - listening = "false"; - nonce = g_strdup("00000000-0000-0000-0000-000000000000"); - - content = g_strdup_printf( - "Bridge: TCPv1\r\n" - "Listening: %s\r\n" - "Nonce: {%s}\r\n" - "\r\n", - listening, - nonce); - } - - send_ok(slpcall, branch, - "application/x-msnmsgr-transrespbody", content); - - g_free(content); - g_free(nonce); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (ip_addrs == NULL) - return; - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -static void -got_ok(MsnSlpCall *slpcall, - const char *type, const char *content) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(type != NULL); - - if (!strcmp(type, "application/x-msnmsgr-sessionreqbody")) - { -#if 0 - if (slpcall->type == MSN_SLPCALL_DC) - { - /* First let's try a DirectConnection. */ - - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - char *branch; - - slplink = slpcall->slplink; - - branch = rand_guid(); - - content = g_strdup_printf( - "Bridges: TRUDPv1 TCPv1\r\n" - "NetID: 0\r\n" - "Conn-Type: Direct-Connect\r\n" - "UPnPNat: false\r\n" - "ICF: false\r\n" - ); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slp_sipmsg_new(slpcall, 0, header, branch, - "application/x-msnmsgr-transreqbody", - content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; -#endif - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); - - g_free(branch); - } - else - { - msn_slp_call_session_init(slpcall); - } -#else - msn_slp_call_session_init(slpcall); -#endif - } - else if (!strcmp(type, "application/x-msnmsgr-transreqbody")) - { - /* Do we get this? */ - purple_debug_info("msn", "OK with transreqbody\n"); - } - else if (!strcmp(type, "application/x-msnmsgr-transrespbody")) - { -#if 0 - char *ip_addrs; - char *temp; - char *nonce; - int port; - - nonce = get_token(content, "Nonce: {", "}\r\n"); - ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n"); - - temp = get_token(content, "IPv4Internal-Port: ", "\r\n"); - if (temp != NULL) - port = atoi(temp); - else - port = -1; - g_free(temp); - - if (ip_addrs == NULL) - return; - - if (port > 0) - got_transresp(slpcall, nonce, ip_addrs, port); - - g_free(nonce); - g_free(ip_addrs); -#endif - } -} - -MsnSlpCall * -msn_slp_sip_recv(MsnSlpLink *slplink, const char *body) -{ - MsnSlpCall *slpcall; - - if (body == NULL) - { - purple_debug_warning("msn", "received bogus message\n"); - return NULL; - } - - if (!strncmp(body, "INVITE", strlen("INVITE"))) - { - char *branch; - char *content; - char *content_type; - - slpcall = msn_slp_call_new(slplink); - - /* From: */ -#if 0 - slpcall->remote_user = get_token(body, "From: \r\n"); -#endif - - branch = get_token(body, ";branch={", "}"); - - slpcall->id = get_token(body, "Call-ID: {", "}"); - -#if 0 - long content_len = -1; - - temp = get_token(body, "Content-Length: ", "\r\n"); - if (temp != NULL) - content_len = atoi(temp); - g_free(temp); -#endif - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - got_invite(slpcall, branch, content_type, content); - - g_free(branch); - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "MSNSLP/1.0 ", strlen("MSNSLP/1.0 "))) - { - char *content; - char *content_type; - /* Make sure this is "OK" */ - const char *status = body + strlen("MSNSLP/1.0 "); - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - g_return_val_if_fail(slpcall != NULL, NULL); - - if (strncmp(status, "200 OK", 6)) - { - /* It's not valid. Kill this off. */ - char temp[32]; - const char *c; - - /* Eww */ - if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) || - (c = strchr(status, '\0'))) - { - size_t offset = c - status; - if (offset >= sizeof(temp)) - offset = sizeof(temp) - 1; - - strncpy(temp, status, offset); - temp[offset] = '\0'; - } - - purple_debug_error("msn", "Received non-OK result: %s\n", temp); - - slpcall->wasted = TRUE; - - /* msn_slp_call_destroy(slpcall); */ - return slpcall; - } - - content_type = get_token(body, "Content-Type: ", "\r\n"); - - content = get_token(body, "\r\n\r\n", NULL); - - got_ok(slpcall, content_type, content); - - g_free(content_type); - g_free(content); - } - else if (!strncmp(body, "BYE", strlen("BYE"))) - { - char *call_id; - - call_id = get_token(body, "Call-ID: {", "}"); - slpcall = msn_slplink_find_slp_call(slplink, call_id); - g_free(call_id); - - if (slpcall != NULL) - slpcall->wasted = TRUE; - - /* msn_slp_call_destroy(slpcall); */ - } - else - slpcall = NULL; - - return slpcall; -} - -/************************************************************************** - * Msg Callbacks - **************************************************************************/ - -void -msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - - session = cmdproc->servconn->session; - slplink = msn_session_get_slplink(session, msg->remote_user); - - if (slplink->swboard == NULL) - { - /* We will need this in order to change its flags. */ - slplink->swboard = (MsnSwitchBoard *)cmdproc->data; - /* If swboard is NULL, something has probably gone wrong earlier on - * I didn't want to do this, but MSN 7 is somehow causing us to crash - * here, I couldn't reproduce it to debug more, and people are - * reporting bugs. Hopefully this doesn't cause more crashes. Stu. - */ - if (slplink->swboard != NULL) - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - else - purple_debug_error("msn", "msn_p2p_msg, swboard is NULL, ouch!\n"); - } - - msn_slplink_process_msg(slplink, msg); -} - -static void -got_emoticon(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - - PurpleConversation *conv; - PurpleConnection *gc; - const char *who; - - gc = slpcall->slplink->session->account->gc; - who = slpcall->slplink->remote_user; - - if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, gc->account))) { - - /* FIXME: it would be better if we wrote the data as we received it - instead of all at once, calling write multiple times and - close once at the very end - */ - purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); - purple_conv_custom_smiley_close(conv, slpcall->data_info); - } -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); -#endif -} - -void -msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - char **tokens; - char *smile, *body_str; - const char *body, *who, *sha1; - guint tok; - size_t body_len; - - PurpleConversation *conv; - - session = cmdproc->servconn->session; - - if (!purple_account_get_bool(session->account, "custom_smileys", TRUE)) - return; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - - /* MSN Messenger 7 may send more than one MSNObject in a single message... - * Maybe 10 tokens is a reasonable max value. */ - tokens = g_strsplit(body_str, "\t", 10); - - g_free(body_str); - - for (tok = 0; tok < 9; tok += 2) { - if (tokens[tok] == NULL || tokens[tok + 1] == NULL) { - break; - } - - smile = tokens[tok]; - obj = msn_object_new_from_string(purple_url_decode(tokens[tok + 1])); - - if (obj == NULL) - break; - - who = msn_object_get_creator(obj); - sha1 = msn_object_get_sha1(obj); - - slplink = msn_session_get_slplink(session, who); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, - session->account); - - /* If the conversation doesn't exist then this is a custom smiley - * used in the first message in a MSN conversation: we need to create - * the conversation now, otherwise the custom smiley won't be shown. - * This happens because every GtkIMHtml has its own smiley tree: if - * the conversation doesn't exist then we cannot associate the new - * smiley with its GtkIMHtml widget. */ - if (!conv) { - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, who); - } - - if (purple_conv_custom_smiley_add(conv, smile, "sha1", sha1, TRUE)) { - msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); - } - - msn_object_destroy(obj); - obj = NULL; - who = NULL; - sha1 = NULL; - } - g_strfreev(tokens); -} - -static gboolean -buddy_icon_cached(PurpleConnection *gc, MsnObject *obj) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - const char *old; - const char *new; - - g_return_val_if_fail(obj != NULL, FALSE); - - account = purple_connection_get_account(gc); - - buddy = purple_find_buddy(account, msn_object_get_creator(obj)); - if (buddy == NULL) - return FALSE; - - old = purple_buddy_icons_get_checksum_for_user(buddy); - new = msn_object_get_sha1(obj); - - if (new == NULL) - return FALSE; - - /* If the old and new checksums are the same, and the file actually exists, - * then return TRUE */ - if (old != NULL && !strcmp(old, new)) - return TRUE; - - return FALSE; -} - -static void -msn_release_buddy_icon_request(MsnUserList *userlist) -{ - MsnUser *user; - - g_return_if_fail(userlist != NULL); - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Releasing buddy icon request\n"); -#endif - - if (userlist->buddy_icon_window > 0) - { - GQueue *queue; - PurpleAccount *account; - const char *username; - - queue = userlist->buddy_icon_requests; - - if (g_queue_is_empty(userlist->buddy_icon_requests)) - return; - - user = g_queue_pop_head(queue); - - account = userlist->session->account; - username = user->passport; - - userlist->buddy_icon_window--; - msn_request_user_display(user); - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "msn_release_buddy_icon_request(): buddy_icon_window-- yields =%d\n", - userlist->buddy_icon_window); -#endif - } -} - -/* - * Called on a timeout from end_user_display(). Frees a buddy icon window slow and dequeues the next - * buddy icon request if there is one. - */ -static gboolean -msn_release_buddy_icon_request_timeout(gpointer data) -{ - MsnUserList *userlist = (MsnUserList *)data; - - /* Free one window slot */ - userlist->buddy_icon_window++; - - /* Clear the tag for our former request timer */ - userlist->buddy_icon_request_timer = 0; - - msn_release_buddy_icon_request(userlist); - - return FALSE; -} - -void -msn_queue_buddy_icon_request(MsnUser *user) -{ - PurpleAccount *account; - MsnObject *obj; - GQueue *queue; - - g_return_if_fail(user != NULL); - - account = user->userlist->session->account; - - obj = msn_user_get_object(user); - - if (obj == NULL) - { - purple_buddy_icons_set_for_user(account, user->passport, NULL, 0, NULL); - return; - } - - if (!buddy_icon_cached(account->gc, obj)) - { - MsnUserList *userlist; - - userlist = user->userlist; - queue = userlist->buddy_icon_requests; - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Queueing buddy icon request for %s (buddy_icon_window = %i)\n", - user->passport, userlist->buddy_icon_window); -#endif - - g_queue_push_tail(queue, user); - - if (userlist->buddy_icon_window > 0) - msn_release_buddy_icon_request(userlist); - } -} - -static void -got_user_display(MsnSlpCall *slpcall, - const guchar *data, gsize size) -{ - MsnUserList *userlist; - const char *info; - PurpleAccount *account; - - g_return_if_fail(slpcall != NULL); - - info = slpcall->data_info; -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Got User Display: %s\n", slpcall->slplink->remote_user); -#endif - - userlist = slpcall->slplink->session->userlist; - account = slpcall->slplink->session->account; - - purple_buddy_icons_set_for_user(account, slpcall->slplink->remote_user, - g_memdup(data, size), size, info); - -#if 0 - /* Free one window slot */ - userlist->buddy_icon_window++; - - purple_debug_info("msn", "got_user_display(): buddy_icon_window++ yields =%d\n", - userlist->buddy_icon_window); - - msn_release_buddy_icon_request(userlist); -#endif -} - -static void -end_user_display(MsnSlpCall *slpcall, MsnSession *session) -{ - MsnUserList *userlist; - - g_return_if_fail(session != NULL); - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "End User Display\n"); -#endif - - userlist = session->userlist; - - /* If the session is being destroyed we better stop doing anything. */ - if (session->destroying) - return; - - /* Delay before freeing a buddy icon window slot and requesting the next icon, if appropriate. - * If we don't delay, we'll rapidly hit the MSN equivalent of AIM's rate limiting; the server will - * send us an error 800 like so: - * - * C: NS 000: XFR 21 SB - * S: NS 000: 800 21 - */ - if (userlist->buddy_icon_request_timer) { - /* Free the window slot used by this previous request */ - userlist->buddy_icon_window++; - - /* Clear our pending timeout */ - purple_timeout_remove(userlist->buddy_icon_request_timer); - } - - /* Wait BUDDY_ICON_DELAY_S seconds before freeing our window slot and requesting the next icon. */ - userlist->buddy_icon_request_timer = purple_timeout_add_seconds(BUDDY_ICON_DELAY, - msn_release_buddy_icon_request_timeout, userlist); -} - -void -msn_request_user_display(MsnUser *user) -{ - PurpleAccount *account; - MsnSession *session; - MsnSlpLink *slplink; - MsnObject *obj; - const char *info; - - session = user->userlist->session; - account = session->account; - - slplink = msn_session_get_slplink(session, user->passport); - - obj = msn_user_get_object(user); - - info = msn_object_get_sha1(obj); - - if (g_ascii_strcasecmp(user->passport, - purple_account_get_username(account))) - { - msn_slplink_request_object(slplink, info, got_user_display, - end_user_display, obj); - } - else - { - MsnObject *my_obj = NULL; - gconstpointer data = NULL; - size_t len = 0; - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "Requesting our own user display\n"); -#endif - - my_obj = msn_user_get_object(session->user); - - if (my_obj != NULL) - { - PurpleStoredImage *img = msn_object_get_image(my_obj); - data = purple_imgstore_get_data(img); - len = purple_imgstore_get_size(img); - } - - purple_buddy_icons_set_for_user(account, user->passport, g_memdup(data, len), len, info); - - /* Free one window slot */ - session->userlist->buddy_icon_window++; - -#ifdef MSN_DEBUG_UD - purple_debug_info("msn", "msn_request_user_display(): buddy_icon_window++ yields =%d\n", - session->userlist->buddy_icon_window); -#endif - - msn_release_buddy_icon_request(session->userlist); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,272 +0,0 @@ -/** - * @file slpcall.c SLP Call Functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slpcall.h" -#include "slpsession.h" - -#include "slp.h" - -/* #define MSN_DEBUG_SLPCALL */ - -/************************************************************************** - * Util - **************************************************************************/ - -static char * -rand_guid(void) -{ - return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X", - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111, - rand() % 0xAAFF + 0x1111); -} - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSlpCall * -msn_slp_call_new(MsnSlpLink *slplink) -{ - MsnSlpCall *slpcall; - - g_return_val_if_fail(slplink != NULL, NULL); - - slpcall = g_new0(MsnSlpCall, 1); - -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_new: slpcall(%p)\n", slpcall); -#endif - - slpcall->slplink = slplink; - - msn_slplink_add_slpcall(slplink, slpcall); - - slpcall->timer = purple_timeout_add_seconds(MSN_SLPCALL_TIMEOUT, msn_slp_call_timeout, slpcall); - - return slpcall; -} - -void -msn_slp_call_destroy(MsnSlpCall *slpcall) -{ - GList *e; - MsnSession *session; - -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_destroy: slpcall(%p)\n", slpcall); -#endif - - g_return_if_fail(slpcall != NULL); - - if (slpcall->timer) - purple_timeout_remove(slpcall->timer); - - if (slpcall->id != NULL) - g_free(slpcall->id); - - if (slpcall->branch != NULL) - g_free(slpcall->branch); - - if (slpcall->data_info != NULL) - g_free(slpcall->data_info); - - for (e = slpcall->slplink->slp_msgs; e != NULL; ) - { - MsnSlpMessage *slpmsg = e->data; - e = e->next; - -#ifdef MSN_DEBUG_SLPCALL_VERBOSE - purple_debug_info("msn", "slpcall_destroy: trying slpmsg(%p)\n", - slpmsg); -#endif - - if (slpmsg->slpcall == slpcall) - { - msn_slpmsg_destroy(slpmsg); - } - } - - session = slpcall->slplink->session; - - msn_slplink_remove_slpcall(slpcall->slplink, slpcall); - - if (slpcall->end_cb != NULL) - slpcall->end_cb(slpcall, session); - - if (slpcall->xfer != NULL) { - slpcall->xfer->data = NULL; - purple_xfer_unref(slpcall->xfer); - } - - g_free(slpcall); -} - -void -msn_slp_call_init(MsnSlpCall *slpcall, MsnSlpCallType type) -{ - slpcall->session_id = rand() % 0xFFFFFF00 + 4; - slpcall->id = rand_guid(); - slpcall->type = type; -} - -void -msn_slp_call_session_init(MsnSlpCall *slpcall) -{ - MsnSlpSession *slpsession; - - slpsession = msn_slp_session_new(slpcall); - - if (slpcall->session_init_cb) - slpcall->session_init_cb(slpsession); - - slpcall->started = TRUE; -} - -void -msn_slp_call_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *header; - char *content; - - g_return_if_fail(slpcall != NULL); - g_return_if_fail(context != NULL); - - slplink = slpcall->slplink; - - slpcall->branch = rand_guid(); - - content = g_strdup_printf( - "EUF-GUID: {%s}\r\n" - "SessionID: %lu\r\n" - "AppID: %d\r\n" - "Context: %s\r\n\r\n", - euf_guid, - slpcall->session_id, - app_id, - context); - - header = g_strdup_printf("INVITE MSNMSGR:%s MSNSLP/1.0", - slplink->remote_user); - - slpmsg = msn_slpmsg_sip_new(slpcall, 0, header, slpcall->branch, - "application/x-msnmsgr-sessionreqbody", content); - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP INVITE"; - slpmsg->text_body = TRUE; -#endif - - msn_slplink_send_slpmsg(slplink, slpmsg); - - g_free(header); - g_free(content); -} - -void -msn_slp_call_close(MsnSlpCall *slpcall) -{ - g_return_if_fail(slpcall != NULL); - g_return_if_fail(slpcall->slplink != NULL); - - send_bye(slpcall, "application/x-msnmsgr-sessionclosebody"); - msn_slplink_unleash(slpcall->slplink); - msn_slp_call_destroy(slpcall); -} - -gboolean -msn_slp_call_timeout(gpointer data) -{ - MsnSlpCall *slpcall; - - slpcall = data; - -#ifdef MSN_DEBUG_SLPCALL - purple_debug_info("msn", "slpcall_timeout: slpcall(%p)\n", slpcall); -#endif - - if (!slpcall->pending && !slpcall->progress) - { - msn_slp_call_destroy(slpcall); - return FALSE; - } - - slpcall->progress = FALSE; - - return TRUE; -} - -MsnSlpCall * -msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnSlpCall *slpcall; - const guchar *body; - gsize body_len; - - slpcall = NULL; - body = slpmsg->buffer; - body_len = slpmsg->size; - - if (slpmsg->flags == 0x0) - { - char *body_str; - - body_str = g_strndup((const char *)body, body_len); - slpcall = msn_slp_sip_recv(slplink, body_str); - g_free(body_str); - } - else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpcall != NULL) - { - if (slpcall->timer) - purple_timeout_remove(slpcall->timer); - - slpcall->cb(slpcall, body, body_len); - - slpcall->wasted = TRUE; - } - } -#if 0 - else if (slpmsg->flags == 0x100) - { - slpcall = slplink->directconn->initial_call; - - if (slpcall != NULL) - msn_slp_call_session_init(slpcall); - } -#endif - - return slpcall; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpcall.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/** - * @file slpcall.h SLP Call functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPCALL_H_ -#define _MSN_SLPCALL_H_ - -#include "internal.h" -#include "ft.h" - -typedef struct _MsnSlpCall MsnSlpCall; - -#include "slplink.h" -#include "slpsession.h" - -/* The official client seems to timeout slp calls after 5 minutes */ -#define MSN_SLPCALL_TIMEOUT 300 - -typedef enum -{ - MSN_SLPCALL_ANY, - MSN_SLPCALL_DC, - -} MsnSlpCallType; - -struct _MsnSlpCall -{ - /* MsnSession *session; */ - MsnSlpLink *slplink; - - MsnSlpCallType type; - - /* Call-ID */ - char *id; - char *branch; - - long session_id; - long app_id; - - gboolean pending; /**< A flag that states if we should wait for this - slpcall to start and do not time out. */ - gboolean progress; /**< A flag that states if there has been progress since - the last time out. */ - gboolean wasted; /**< A flag that states if this slpcall is going to be - destroyed. */ - gboolean started; /**< A flag that states if this slpcall's session has - been initiated. */ - - void (*progress_cb)(MsnSlpCall *slpcall, - gsize total_length, gsize len, gsize offset); - void (*session_init_cb)(MsnSlpSession *slpsession); - - /* Can be checksum, or smile */ - char *data_info; - - PurpleXfer *xfer; - - MsnSlpCb cb; - void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session); - - int timer; -}; - -MsnSlpCall *msn_slp_call_new(MsnSlpLink *slplink); -void msn_slp_call_init(MsnSlpCall *slpcall, MsnSlpCallType type); -void msn_slp_call_session_init(MsnSlpCall *slpcall); -void msn_slp_call_destroy(MsnSlpCall *slpcall); -void msn_slp_call_invite(MsnSlpCall *slpcall, const char *euf_guid, - int app_id, const char *context); -void msn_slp_call_close(MsnSlpCall *slpcall); -gboolean msn_slp_call_timeout(gpointer data); - -#endif /* _MSN_SLPCALL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file slp.h MSNSLP support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLP_H_ -#define _MSN_SLP_H_ - -#include "slpcall.h" -#include "session.h" -#include "internal.h" -#include "ft.h" - -void msn_xfer_progress_cb(MsnSlpCall *slpcall, gsize total_length, gsize - len, gsize offset); - -MsnSlpCall * msn_slp_sip_recv(MsnSlpLink *slplink, - const char *body); - -void send_bye(MsnSlpCall *slpcall, const char *type); - -void msn_xfer_completed_cb(MsnSlpCall *slpcall, - const guchar *body, gsize size); - -void msn_xfer_cancel(PurpleXfer *xfer); -void msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session); - -void msn_queue_buddy_icon_request(MsnUser *user); - -#endif /* _MSN_SLP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,822 +0,0 @@ -/** - * @file slplink.c MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slplink.h" - -#include "switchboard.h" -#include "slp.h" - -void msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -#ifdef MSN_DEBUG_SLP_FILES -static int m_sc = 0; -static int m_rc = 0; - -static void -debug_msg_to_file(MsnMessage *msg, gboolean send) -{ - char *tmp; - char *dir; - char *pload; - FILE *tf; - int c; - gsize pload_size; - - dir = send ? "send" : "recv"; - c = send ? m_sc++ : m_rc++; - tmp = g_strdup_printf("%s/msntest/%s/%03d", g_get_home_dir(), dir, c); - tf = g_fopen(tmp, "wb"); - if (tf == NULL) - { - purple_debug_error("msn", "could not open debug file\n"); - return; - } - pload = msn_message_gen_payload(msg, &pload_size); - fwrite(pload, 1, pload_size, tf); - fclose(tf); - g_free(tmp); -} -#endif - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSlpLink * -msn_slplink_new(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - - slplink = g_new0(MsnSlpLink, 1); - -#ifdef MSN_DEBUG_SLPLINK - purple_debug_info("msn", "slplink_new: slplink(%p)\n", slplink); -#endif - - slplink->session = session; - slplink->slp_seq_id = rand() % 0xFFFFFF00 + 4; - - slplink->local_user = g_strdup(msn_user_get_passport(session->user)); - slplink->remote_user = g_strdup(username); - - slplink->slp_msg_queue = g_queue_new(); - - session->slplinks = - g_list_append(session->slplinks, slplink); - - return slplink; -} - -void -msn_slplink_destroy(MsnSlpLink *slplink) -{ - MsnSession *session; - -#ifdef MSN_DEBUG_SLPLINK - purple_debug_info("msn", "slplink_destroy: slplink(%p)\n", slplink); -#endif - - g_return_if_fail(slplink != NULL); - - if (slplink->swboard != NULL) - slplink->swboard->slplinks = g_list_remove(slplink->swboard->slplinks, slplink); - - session = slplink->session; - - if (slplink->local_user != NULL) - g_free(slplink->local_user); - - if (slplink->remote_user != NULL) - g_free(slplink->remote_user); - - if (slplink->directconn != NULL) - msn_directconn_destroy(slplink->directconn); - - while (slplink->slp_calls != NULL) - msn_slp_call_destroy(slplink->slp_calls->data); - - g_queue_free(slplink->slp_msg_queue); - - session->slplinks = - g_list_remove(session->slplinks, slplink); - - g_free(slplink); -} - -MsnSlpLink * -msn_session_find_slplink(MsnSession *session, const char *who) -{ - GList *l; - - for (l = session->slplinks; l != NULL; l = l->next) - { - MsnSlpLink *slplink; - - slplink = l->data; - - if (!strcmp(slplink->remote_user, who)) - return slplink; - } - - return NULL; -} - -MsnSlpLink * -msn_session_get_slplink(MsnSession *session, const char *username) -{ - MsnSlpLink *slplink; - - g_return_val_if_fail(session != NULL, NULL); - g_return_val_if_fail(username != NULL, NULL); - - slplink = msn_session_find_slplink(session, username); - - if (slplink == NULL) - slplink = msn_slplink_new(session, username); - - return slplink; -} - -MsnSlpSession * -msn_slplink_find_slp_session(MsnSlpLink *slplink, long session_id) -{ - GList *l; - MsnSlpSession *slpsession; - - for (l = slplink->slp_sessions; l != NULL; l = l->next) - { - slpsession = l->data; - - if (slpsession->id == session_id) - return slpsession; - } - - return NULL; -} - -void -msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - if (slplink->swboard != NULL) - slplink->swboard->flag |= MSN_SB_FLAG_FT; - - slplink->slp_calls = g_list_append(slplink->slp_calls, slpcall); -} - -void -msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall) -{ - slplink->slp_calls = g_list_remove(slplink->slp_calls, slpcall); - - /* The slplink has no slpcalls in it. If no one is using it, we might - * destroy the switchboard, but we should be careful not to use the slplink - * again. */ - if (slplink->slp_calls == NULL) - { - if (slplink->swboard != NULL) - { - if (msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT)) - /* I'm not sure this is the best thing to do, but it's better - * than nothing. */ - slpcall->slplink = NULL; - } - } -} - -MsnSlpCall * -msn_slplink_find_slp_call(MsnSlpLink *slplink, const char *id) -{ - GList *l; - MsnSlpCall *slpcall; - - if (!id) - return NULL; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->id && !strcmp(slpcall->id, id)) - return slpcall; - } - - return NULL; -} - -MsnSlpCall * -msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id) -{ - GList *l; - MsnSlpCall *slpcall; - - for (l = slplink->slp_calls; l != NULL; l = l->next) - { - slpcall = l->data; - - if (slpcall->session_id == id) - return slpcall; - } - - return NULL; -} - -void -msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ - if (slplink->directconn != NULL) - { - msn_directconn_send_msg(slplink->directconn, msg); - } - else - { - if (slplink->swboard == NULL) - { - slplink->swboard = msn_session_get_swboard(slplink->session, - slplink->remote_user, MSN_SB_FLAG_FT); - - if (slplink->swboard == NULL) - return; - - /* If swboard is destroyed we will be too */ - slplink->swboard->slplinks = g_list_prepend(slplink->swboard->slplinks, slplink); - } - - msn_switchboard_send_msg(slplink->swboard, msg, TRUE); - } -} - -/* We have received the message ack */ -static void -msg_ack(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - long long real_size; - - slpmsg = data; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - slpmsg->offset += msg->msnslp_header.length; - - if (slpmsg->offset < real_size) - { - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - } - else - { - /* The whole message has been sent */ - if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - if (slpmsg->slpcall != NULL) - { - if (slpmsg->slpcall->cb) - slpmsg->slpcall->cb(slpmsg->slpcall, - NULL, 0); - } - } - } - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -/* We have received the message nak. */ -static void -msg_nak(MsnMessage *msg, void *data) -{ - MsnSlpMessage *slpmsg; - - slpmsg = data; - - msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); - - slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); -} - -void -msn_slplink_send_msgpart(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - long long real_size; - size_t len = 0; - - /* Maybe we will want to create a new msg for this slpmsg instead of - * reusing the same one all the time. */ - msg = slpmsg->msg; - - real_size = (slpmsg->flags == 0x2) ? 0 : slpmsg->size; - - if (slpmsg->offset < real_size) - { - if (slpmsg->fp) - { - char data[1202]; - len = fread(data, 1, sizeof(data), slpmsg->fp); - msn_message_set_bin_data(msg, data, len); - } - else - { - len = slpmsg->size - slpmsg->offset; - - if (len > 1202) - len = 1202; - - msn_message_set_bin_data(msg, slpmsg->buffer + slpmsg->offset, len); - } - - msg->msnslp_header.offset = slpmsg->offset; - msg->msnslp_header.length = len; - } - -#ifdef MSN_DEBUG_SLP - msn_message_show_readable(msg, slpmsg->info, slpmsg->text_body); -#endif - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, TRUE); -#endif - - slpmsg->msgs = - g_list_append(slpmsg->msgs, msg); - msn_slplink_send_msg(slplink, msg); - - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, slpmsg->offset); - } - } - - /* slpmsg->offset += len; */ -} - -void -msn_slplink_release_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - MsnMessage *msg; - - slpmsg->msg = msg = msn_message_new_msnslp(); - - if (slpmsg->flags == 0x0) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x2) - { - msg->msnslp_header.session_id = slpmsg->session_id; - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - } - else if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - MsnSlpSession *slpsession; - slpsession = slpmsg->slpsession; - - g_return_if_fail(slpsession != NULL); - msg->msnslp_header.session_id = slpsession->id; - msg->msnslp_footer.value = slpsession->app_id; - msg->msnslp_header.ack_id = rand() % 0xFFFFFF00; - } - else if (slpmsg->flags == 0x100) - { - msg->msnslp_header.ack_id = slpmsg->ack_id; - msg->msnslp_header.ack_sub_id = slpmsg->ack_sub_id; - msg->msnslp_header.ack_size = slpmsg->ack_size; - } - - msg->msnslp_header.id = slpmsg->id; - msg->msnslp_header.flags = slpmsg->flags; - - msg->msnslp_header.total_size = slpmsg->size; - - msn_message_set_attr(msg, "P2P-Dest", slplink->remote_user); - - msg->ack_cb = msg_ack; - msg->nak_cb = msg_nak; - msg->ack_data = slpmsg; - - msn_slplink_send_msgpart(slplink, slpmsg); - - msn_message_destroy(msg); -} - -void -msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - slpmsg->id = slplink->slp_seq_id++; - - g_queue_push_head(slplink->slp_msg_queue, slpmsg); -} - -void -msn_slplink_send_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg) -{ - slpmsg->id = slplink->slp_seq_id++; - - msn_slplink_release_slpmsg(slplink, slpmsg); -} - -void -msn_slplink_unleash(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - /* Send the queued msgs in the order they came. */ - - while ((slpmsg = g_queue_pop_tail(slplink->slp_msg_queue)) != NULL) - { - msn_slplink_release_slpmsg(slplink, slpmsg); - } -} - -void -msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - - slpmsg = msn_slpmsg_new(slplink); - - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = 0x02; - slpmsg->ack_id = msg->msnslp_header.id; - slpmsg->ack_sub_id = msg->msnslp_header.ack_id; - slpmsg->ack_size = msg->msnslp_header.total_size; - -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP ACK"; -#endif - - msn_slplink_send_slpmsg(slplink, slpmsg); - msn_slpmsg_destroy(slpmsg); -} - -static void -send_file_cb(MsnSlpSession *slpsession) -{ - MsnSlpCall *slpcall; - MsnSlpMessage *slpmsg; - struct stat st; - PurpleXfer *xfer; - - slpcall = slpsession->slpcall; - slpmsg = msn_slpmsg_new(slpcall->slplink); - slpmsg->slpcall = slpcall; - slpmsg->flags = 0x1000030; - slpmsg->slpsession = slpsession; -#ifdef MSN_DEBUG_SLP - slpmsg->info = "SLP FILE"; -#endif - xfer = (PurpleXfer *)slpcall->xfer; - purple_xfer_start(slpcall->xfer, -1, NULL, 0); - slpmsg->fp = xfer->dest_fp; - if (g_stat(purple_xfer_get_local_filename(xfer), &st) == 0) - slpmsg->size = st.st_size; - xfer->dest_fp = NULL; /* Disable double fclose() */ - - msn_slplink_send_slpmsg(slpcall->slplink, slpmsg); -} - -void -msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg) -{ - MsnSlpMessage *slpmsg; - const char *data; - guint64 offset; - gsize len; - -#ifdef MSN_DEBUG_SLP - msn_slpmsg_show(msg); -#endif - -#ifdef MSN_DEBUG_SLP_FILES - debug_msg_to_file(msg, FALSE); -#endif - - if (msg->msnslp_header.total_size < msg->msnslp_header.length) - { - purple_debug_error("msn", "This can't be good\n"); - g_return_if_reached(); - } - - slpmsg = NULL; - data = msn_message_get_bin_data(msg, &len); - - /* - OVERHEAD! - if (msg->msnslp_header.length < msg->msnslp_header.total_size) - */ - - offset = msg->msnslp_header.offset; - - if (offset == 0) - { - slpmsg = msn_slpmsg_new(slplink); - slpmsg->id = msg->msnslp_header.id; - slpmsg->session_id = msg->msnslp_header.session_id; - slpmsg->size = msg->msnslp_header.total_size; - slpmsg->flags = msg->msnslp_header.flags; - - if (slpmsg->session_id) - { - if (slpmsg->slpcall == NULL) - slpmsg->slpcall = msn_slplink_find_slp_call_with_session_id(slplink, slpmsg->session_id); - - if (slpmsg->slpcall != NULL) - { - if (slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) - { - PurpleXfer *xfer; - - xfer = slpmsg->slpcall->xfer; - - if (xfer != NULL) - { - purple_xfer_ref(xfer); - purple_xfer_start(xfer, -1, NULL, 0); - - if (xfer->data == NULL) { - purple_xfer_unref(xfer); - return; - } else { - purple_xfer_unref(xfer); - slpmsg->fp = xfer->dest_fp; - xfer->dest_fp = NULL; /* Disable double fclose() */ - } - } - } - } - } - if (!slpmsg->fp && slpmsg->size) - { - slpmsg->buffer = g_try_malloc(slpmsg->size); - if (slpmsg->buffer == NULL) - { - purple_debug_error("msn", "Failed to allocate buffer for slpmsg\n"); - msn_slpmsg_destroy(slpmsg); - return; - } - } - } - else - { - slpmsg = msn_slplink_message_find(slplink, msg->msnslp_header.session_id, msg->msnslp_header.id); - } - - if (slpmsg == NULL) - { - /* Probably the transfer was canceled */ - purple_debug_error("msn", "Couldn't find slpmsg\n"); - return; - } - - if (slpmsg->fp) - { - /* fseek(slpmsg->fp, offset, SEEK_SET); */ - len = fwrite(data, 1, len, slpmsg->fp); - } - else if (slpmsg->size && slpmsg->buffer) - { - if (G_MAXSIZE - len < offset || (offset + len) > slpmsg->size) - { - purple_debug_error("msn", "Oversized slpmsg\n"); - g_return_if_reached(); - } - else - memcpy(slpmsg->buffer + offset, data, len); - } - - if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000030) && - (slpmsg->slpcall != NULL)) - { - slpmsg->slpcall->progress = TRUE; - - if (slpmsg->slpcall->progress_cb != NULL) - { - slpmsg->slpcall->progress_cb(slpmsg->slpcall, slpmsg->size, - len, offset); - } - } - -#if 0 - if (slpmsg->buffer == NULL) - return; -#endif - - if (msg->msnslp_header.offset + msg->msnslp_header.length - >= msg->msnslp_header.total_size) - { - /* All the pieces of the slpmsg have been received */ - MsnSlpCall *slpcall; - - slpcall = msn_slp_process_msg(slplink, slpmsg); - - if (slpmsg->flags == 0x100) - { - MsnDirectConn *directconn; - - directconn = slplink->directconn; - - if (!directconn->acked) - msn_directconn_send_handshake(directconn); - } - else if (slpmsg->flags == 0x0 || slpmsg->flags == 0x20 || - slpmsg->flags == 0x1000030) - { - /* Release all the messages and send the ACK */ - - msn_slplink_send_ack(slplink, msg); - msn_slplink_unleash(slplink); - } - - msn_slpmsg_destroy(slpmsg); - - if (slpcall != NULL && slpcall->wasted) - msn_slp_call_destroy(slpcall); - } -} - -MsnSlpMessage * -msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id) -{ - GList *e; - - for (e = slplink->slp_msgs; e != NULL; e = e->next) - { - MsnSlpMessage *slpmsg = e->data; - - if ((slpmsg->session_id == session_id) && (slpmsg->id == id)) - return slpmsg; - } - - return NULL; -} - -typedef struct -{ - guint32 length; - guint32 unk1; - guint32 file_size; - guint32 unk2; - guint32 unk3; -} MsnContextHeader; - -#define MAX_FILE_NAME_LEN 0x226 - -static gchar * -gen_context(const char *file_name, const char *file_path) -{ - struct stat st; - gsize size = 0; - MsnContextHeader header; - gchar *u8 = NULL; - guchar *base; - guchar *n; - gchar *ret; - gunichar2 *uni = NULL; - glong currentChar = 0; - glong uni_len = 0; - gsize len; - - if (g_stat(file_path, &st) == 0) - size = st.st_size; - - if(!file_name) { - u8 = purple_utf8_try_convert(g_basename(file_path)); - file_name = u8; - } - - uni = g_utf8_to_utf16(file_name, -1, NULL, &uni_len, NULL); - - if(u8) { - g_free(u8); - file_name = NULL; - u8 = NULL; - } - - len = sizeof(MsnContextHeader) + MAX_FILE_NAME_LEN + 4; - - header.length = GUINT32_TO_LE(len); - header.unk1 = GUINT32_TO_LE(2); - header.file_size = GUINT32_TO_LE(size); - header.unk2 = GUINT32_TO_LE(0); - header.unk3 = GUINT32_TO_LE(0); - - base = g_malloc(len + 1); - n = base; - - memcpy(n, &header, sizeof(MsnContextHeader)); - n += sizeof(MsnContextHeader); - - memset(n, 0x00, MAX_FILE_NAME_LEN); - for(currentChar = 0; currentChar < uni_len; currentChar++) { - *((gunichar2 *)n + currentChar) = GUINT16_TO_LE(uni[currentChar]); - } - n += MAX_FILE_NAME_LEN; - - memset(n, 0xFF, 4); - n += 4; - - g_free(uni); - ret = purple_base64_encode(base, len); - g_free(base); - return ret; -} - -void -msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer) -{ - MsnSlpCall *slpcall; - char *context; - const char *fn; - const char *fp; - - fn = purple_xfer_get_filename(xfer); - fp = purple_xfer_get_local_filename(xfer); - - g_return_if_fail(slplink != NULL); - g_return_if_fail(fp != NULL); - - slpcall = msn_slp_call_new(slplink); - msn_slp_call_init(slpcall, MSN_SLPCALL_DC); - - slpcall->session_init_cb = send_file_cb; - slpcall->end_cb = msn_xfer_end_cb; - slpcall->progress_cb = msn_xfer_progress_cb; - slpcall->cb = msn_xfer_completed_cb; - slpcall->xfer = xfer; - purple_xfer_ref(slpcall->xfer); - - slpcall->pending = TRUE; - - purple_xfer_set_cancel_send_fnc(xfer, msn_xfer_cancel); - - xfer->data = slpcall; - - context = gen_context(fn, fp); - - msn_slp_call_invite(slpcall, "5D3E02AB-6190-11D3-BBBB-00C04F795683", 2, - context); - - g_free(context); -} - -void -msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj) -{ - MsnSlpCall *slpcall; - char *msnobj_data; - char *msnobj_base64; - - g_return_if_fail(slplink != NULL); - g_return_if_fail(obj != NULL); - - msnobj_data = msn_object_to_string(obj); - msnobj_base64 = purple_base64_encode((const guchar *)msnobj_data, strlen(msnobj_data)); - g_free(msnobj_data); - - slpcall = msn_slp_call_new(slplink); - msn_slp_call_init(slpcall, MSN_SLPCALL_ANY); - - slpcall->data_info = g_strdup(info); - slpcall->cb = cb; - slpcall->end_cb = end_cb; - - msn_slp_call_invite(slpcall, "A4268EEC-FEC5-49E5-95C3-F126696BDBF6", 1, - msnobj_base64); - - g_free(msnobj_base64); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slplink.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/** - * @file slplink.h MSNSLP Link support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPLINK_H_ -#define _MSN_SLPLINK_H_ - -typedef struct _MsnSlpLink MsnSlpLink; - -#include "directconn.h" -#include "slpcall.h" -#include "slpmsg.h" - -#include "switchboard.h" - -#include "ft.h" - -#include "session.h" - -typedef void (*MsnSlpCb)(MsnSlpCall *slpcall, - const guchar *data, gsize size); -typedef void (*MsnSlpEndCb)(MsnSlpCall *slpcall, MsnSession *session); - -struct _MsnSlpLink -{ - MsnSession *session; - MsnSwitchBoard *swboard; - - char *local_user; - char *remote_user; - - int slp_seq_id; - - MsnDirectConn *directconn; - - GList *slp_calls; - GList *slp_sessions; - GList *slp_msgs; - - GQueue *slp_msg_queue; -}; - -MsnSlpLink *msn_slplink_new(MsnSession *session, const char *username); -void msn_slplink_destroy(MsnSlpLink *slplink); -MsnSlpLink *msn_session_find_slplink(MsnSession *session, - const char *who); -MsnSlpLink *msn_session_get_slplink(MsnSession *session, const char *username); -MsnSlpSession *msn_slplink_find_slp_session(MsnSlpLink *slplink, - long session_id); -void msn_slplink_add_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -void msn_slplink_remove_slpcall(MsnSlpLink *slplink, MsnSlpCall *slpcall); -MsnSlpCall *msn_slplink_find_slp_call(MsnSlpLink *slplink, - const char *id); -MsnSlpCall *msn_slplink_find_slp_call_with_session_id(MsnSlpLink *slplink, long id); -void msn_slplink_send_msg(MsnSlpLink *slplink, MsnMessage *msg); -void msn_slplink_release_slpmsg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_queue_slpmsg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); -void msn_slplink_send_slpmsg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_unleash(MsnSlpLink *slplink); -void msn_slplink_send_ack(MsnSlpLink *slplink, MsnMessage *msg); -void msn_slplink_process_msg(MsnSlpLink *slplink, MsnMessage *msg); -MsnSlpMessage *msn_slplink_message_find(MsnSlpLink *slplink, long session_id, long id); -void msn_slplink_append_slp_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); -void msn_slplink_remove_slp_msg(MsnSlpLink *slplink, - MsnSlpMessage *slpmsg); -void msn_slplink_request_ft(MsnSlpLink *slplink, PurpleXfer *xfer); - -void msn_slplink_request_object(MsnSlpLink *slplink, - const char *info, - MsnSlpCb cb, - MsnSlpEndCb end_cb, - const MsnObject *obj); - -MsnSlpCall *msn_slp_process_msg(MsnSlpLink *slplink, MsnSlpMessage *slpmsg); - -#endif /* _MSN_SLPLINK_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,239 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "slpmsg.h" -#include "slplink.h" - -/************************************************************************** - * SLP Message - **************************************************************************/ - -MsnSlpMessage * -msn_slpmsg_new(MsnSlpLink *slplink) -{ - MsnSlpMessage *slpmsg; - - slpmsg = g_new0(MsnSlpMessage, 1); - -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "slpmsg new (%p)\n", slpmsg); -#endif - - slpmsg->slplink = slplink; - - slplink->slp_msgs = - g_list_append(slplink->slp_msgs, slpmsg); - - return slpmsg; -} - -void -msn_slpmsg_destroy(MsnSlpMessage *slpmsg) -{ - MsnSlpLink *slplink; - GList *cur; - - g_return_if_fail(slpmsg != NULL); - -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "slpmsg destroy (%p)\n", slpmsg); -#endif - - slplink = slpmsg->slplink; - - if (slpmsg->fp != NULL) - fclose(slpmsg->fp); - - purple_imgstore_unref(slpmsg->img); - - /* We don't want to free the data of the PurpleStoredImage, - * but to avoid code duplication, it's sharing buffer. */ - if (slpmsg->img == NULL) - g_free(slpmsg->buffer); - -#ifdef MSN_DEBUG_SLP - /* - if (slpmsg->info != NULL) - g_free(slpmsg->info); - */ -#endif - - for (cur = slpmsg->msgs; cur != NULL; cur = cur->next) - { - /* Something is pointing to this slpmsg, so we should remove that - * pointer to prevent a crash. */ - /* Ex: a user goes offline and after that we receive an ACK */ - - MsnMessage *msg = cur->data; - -#ifdef MSN_DEBUG_SLPMSG - purple_debug_info("msn", "Unlink slpmsg callbacks.\n"); -#endif - - msg->ack_cb = NULL; - msg->nak_cb = NULL; - msg->ack_data = NULL; - } - - slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); - - g_free(slpmsg); -} - -void -msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - if (body != NULL) - slpmsg->buffer = g_memdup(body, size); - else - slpmsg->buffer = g_new0(guchar, size); - - slpmsg->size = size; -} - -void -msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img) -{ - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - slpmsg->img = purple_imgstore_ref(img); - slpmsg->buffer = (guchar *)purple_imgstore_get_data(img); - slpmsg->size = purple_imgstore_get_size(img); -} - -void -msn_slpmsg_open_file(MsnSlpMessage *slpmsg, const char *file_name) -{ - struct stat st; - - /* We can only have one data source at a time. */ - g_return_if_fail(slpmsg->buffer == NULL); - g_return_if_fail(slpmsg->img == NULL); - g_return_if_fail(slpmsg->fp == NULL); - - slpmsg->fp = g_fopen(file_name, "rb"); - - if (g_stat(file_name, &st) == 0) - slpmsg->size = st.st_size; -} - -#ifdef MSN_DEBUG_SLP -void -msn_slpmsg_show(MsnMessage *msg) -{ - const char *info; - gboolean text; - guint32 flags; - - text = FALSE; - - flags = GUINT32_TO_LE(msg->msnslp_header.flags); - - switch (flags) - { - case 0x0: - info = "SLP CONTROL"; - text = TRUE; - break; - case 0x2: - info = "SLP ACK"; break; - case 0x20: - case 0x1000030: - info = "SLP DATA"; break; - default: - info = "SLP UNKNOWN"; break; - } - - msn_message_show_readable(msg, info, text); -} -#endif - -MsnSlpMessage * -msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, const char *branch, - const char *content_type, const char *content) -{ - MsnSlpLink *slplink; - MsnSlpMessage *slpmsg; - char *body; - gsize body_len; - gsize content_len; - - g_return_val_if_fail(slpcall != NULL, NULL); - g_return_val_if_fail(header != NULL, NULL); - - slplink = slpcall->slplink; - - /* Let's remember that "content" should end with a 0x00 */ - - content_len = (content != NULL) ? strlen(content) + 1 : 0; - - body = g_strdup_printf( - "%s\r\n" - "To: \r\n" - "From: \r\n" - "Via: MSNSLP/1.0/TLP ;branch={%s}\r\n" - "CSeq: %d\r\n" - "Call-ID: {%s}\r\n" - "Max-Forwards: 0\r\n" - "Content-Type: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "\r\n", - header, - slplink->remote_user, - slplink->local_user, - branch, - cseq, - slpcall->id, - content_type, - content_len); - - body_len = strlen(body); - - if (content_len > 0) - { - body_len += content_len; - body = g_realloc(body, body_len); - g_strlcat(body, content, body_len); - } - - slpmsg = msn_slpmsg_new(slplink); - msn_slpmsg_set_body(slpmsg, body, body_len); - - slpmsg->sip = TRUE; - slpmsg->slpcall = slpcall; - - g_free(body); - - return slpmsg; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpmsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/** - * @file slpmsg.h SLP Message functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPMSG_H_ -#define _MSN_SLPMSG_H_ - -typedef struct _MsnSlpMessage MsnSlpMessage; - -#include "imgstore.h" - -#include "slpsession.h" -#include "slpcall.h" -#include "slplink.h" -#include "session.h" -#include "msg.h" - -#include "slp.h" - -/** - * A SLP Message This contains everything that we will need to send a SLP - * Message even if has to be sent in several parts. - */ -struct _MsnSlpMessage -{ - MsnSlpSession *slpsession; - MsnSlpCall *slpcall; /**< The slpcall to which this slp message belongs (if applicable). */ - MsnSlpLink *slplink; /**< The slplink through which this slp message is being sent. */ - MsnSession *session; - - long session_id; - long id; - long ack_id; - long ack_sub_id; - long long ack_size; - long app_id; - - gboolean sip; /**< A flag that states if this is a SIP slp message. */ - int ref_count; /**< The reference count. */ - long flags; - - FILE *fp; - PurpleStoredImage *img; - guchar *buffer; - long long offset; - long long size; - - GList *msgs; /**< The real messages. */ - -#if 1 - MsnMessage *msg; /**< The temporary real message that will be sent. */ -#endif - -#ifdef MSN_DEBUG_SLP - char *info; - gboolean text_body; -#endif -}; - -/** - * Creates a new slp message - * - * @param slplink The slplink through which this slp message will be sent. - * @return The created slp message. - */ -MsnSlpMessage *msn_slpmsg_new(MsnSlpLink *slplink); - -/** - * Destroys a slp message - * - * @param slpmsg The slp message to destory. - */ -void msn_slpmsg_destroy(MsnSlpMessage *slpmsg); - -void msn_slpmsg_set_body(MsnSlpMessage *slpmsg, const char *body, - long long size); -void msn_slpmsg_set_image(MsnSlpMessage *slpmsg, PurpleStoredImage *img); -void msn_slpmsg_open_file(MsnSlpMessage *slpmsg, - const char *file_name); -MsnSlpMessage * msn_slpmsg_sip_new(MsnSlpCall *slpcall, int cseq, - const char *header, - const char *branch, - const char *content_type, - const char *content); - -#ifdef MSN_DEBUG_SLP -void msn_slpmsg_show(MsnMessage *msg); -#endif - -#endif /* _MSN_SLPMSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/** - * @file slpsession.h SLP Session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "slpsession.h" - -/************************************************************************** - * SLP Session - **************************************************************************/ - -MsnSlpSession * -msn_slp_session_new(MsnSlpCall *slpcall) -{ - MsnSlpSession *slpsession; - - g_return_val_if_fail(slpcall != NULL, NULL); - - slpsession = g_new0(MsnSlpSession, 1); - - slpsession->slpcall = slpcall; - slpsession->id = slpcall->session_id; - slpsession->call_id = slpcall->id; - slpsession->app_id = slpcall->app_id; - - slpcall->slplink->slp_sessions = - g_list_append(slpcall->slplink->slp_sessions, slpsession); - - return slpsession; -} - -void -msn_slp_session_destroy(MsnSlpSession *slpsession) -{ - g_return_if_fail(slpsession != NULL); - - if (slpsession->call_id != NULL) - g_free(slpsession->call_id); - - slpsession->slpcall->slplink->slp_sessions = - g_list_remove(slpsession->slpcall->slplink->slp_sessions, slpsession); - - g_free(slpsession); -} - -#if 0 -static void -msn_slp_session_send_slpmsg(MsnSlpSession *slpsession, MsnSlpMessage *slpmsg) -{ - slpmsg->slpsession = slpsession; - -#if 0 - slpmsg->session_id = slpsession->id; - slpmsg->app_id = slpsession->app_id; -#endif - - msn_slplink_send_slpmsg(slpsession->slpcall->slplink, slpmsg); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/slpsession.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file slpsession.h SLP Session functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SLPSESSION_H_ -#define _MSN_SLPSESSION_H_ - -typedef struct _MsnSlpSession MsnSlpSession; - -#include "slpcall.h" -#include "slpsession.h" -#include "slpmsg.h" - -struct _MsnSlpSession -{ - /* MsnSlpLink *slplink; */ - MsnSlpCall *slpcall; - - long id; - - long app_id; - char *call_id; -}; - -MsnSlpSession *msn_slp_session_new(MsnSlpCall *slpcall); -void msn_slp_session_destroy(MsnSlpSession *slpsession); -void msn_slpsession_send_slpmsg(MsnSlpSession *slpsession, - MsnSlpMessage *slpmsg); -#endif /* _MSN_SLPSESSION_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file state.c State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "state.h" - -static const char *away_text[] = -{ - N_("Available"), - N_("Available"), - N_("Busy"), - N_("Idle"), - N_("Be Right Back"), - N_("Away From Computer"), - N_("On The Phone"), - N_("Out To Lunch"), - N_("Available"), - N_("Available") -}; - -void -msn_change_status(MsnSession *session) -{ - PurpleAccount *account; - MsnCmdProc *cmdproc; - MsnUser *user; - MsnObject *msnobj; - const char *state_text; - - g_return_if_fail(session != NULL); - g_return_if_fail(session->notification != NULL); - - account = session->account; - cmdproc = session->notification->cmdproc; - user = session->user; - state_text = msn_state_get_text(msn_state_from_account(account)); - - /* If we're not logged in yet, don't send the status to the server, - * it will be sent when login completes - */ - if (!session->logged_in) - return; - - msnobj = msn_user_get_object(user); - - if (msnobj == NULL) - { - msn_cmdproc_send(cmdproc, "CHG", "%s %d", state_text, - MSN_CLIENT_ID); - } - else - { - char *msnobj_str; - - msnobj_str = msn_object_to_string(msnobj); - - msn_cmdproc_send(cmdproc, "CHG", "%s %d %s", state_text, - MSN_CLIENT_ID, purple_url_encode(msnobj_str)); - - g_free(msnobj_str); - } -} - -const char * -msn_away_get_text(MsnAwayType type) -{ - g_return_val_if_fail(type <= MSN_HIDDEN, NULL); - - return _(away_text[type]); -} - -const char * -msn_state_get_text(MsnAwayType state) -{ - static char *status_text[] = - { "NLN", "NLN", "BSY", "IDL", "BRB", "AWY", "PHN", "LUN", "HDN", "HDN" }; - - return status_text[state]; -} - -MsnAwayType -msn_state_from_account(PurpleAccount *account) -{ - MsnAwayType msnstatus; - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); - - if (!strcmp(status_id, "away")) - msnstatus = MSN_AWAY; - else if (!strcmp(status_id, "brb")) - msnstatus = MSN_BRB; - else if (!strcmp(status_id, "busy")) - msnstatus = MSN_BUSY; - else if (!strcmp(status_id, "phone")) - msnstatus = MSN_PHONE; - else if (!strcmp(status_id, "lunch")) - msnstatus = MSN_LUNCH; - else if (!strcmp(status_id, "invisible")) - msnstatus = MSN_HIDDEN; - else - msnstatus = MSN_ONLINE; - - if ((msnstatus == MSN_ONLINE) && purple_presence_is_idle(presence)) - msnstatus = MSN_IDLE; - - return msnstatus; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/state.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/** - * @file state.h State functions and definitions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_STATE_H_ -#define _MSN_STATE_H_ - -/** - * Away types. - */ -typedef enum -{ - MSN_ONLINE = 1, - MSN_BUSY = 2, - MSN_IDLE = 3, - MSN_BRB = 4, - MSN_AWAY = 5, - MSN_PHONE = 6, - MSN_LUNCH = 7, - MSN_OFFLINE = 8, - MSN_HIDDEN = 9 - -} MsnAwayType; - -/** - * Changes the status of the user. - * - * @param session The MSN session. - */ -void msn_change_status(MsnSession *session); - -/** - * Returns the string representation of an away type. - * - * @param type The away type. - * - * @return The string representation of the away type. - */ -const char *msn_away_get_text(MsnAwayType type); - -const char *msn_state_get_text(MsnAwayType state); - -MsnAwayType msn_state_from_account(PurpleAccount *account); - -#endif /* _MSN_STATE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1305 +0,0 @@ -/** - * @file switchboard.c MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "prefs.h" -#include "switchboard.h" -#include "notification.h" -#include "msn-utils.h" - -#include "error.h" - -static MsnTable *cbs_table; - -static void msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, - MsnMsgErrorType error); - -/************************************************************************** - * Main - **************************************************************************/ - -MsnSwitchBoard * -msn_switchboard_new(MsnSession *session) -{ - MsnSwitchBoard *swboard; - MsnServConn *servconn; - - g_return_val_if_fail(session != NULL, NULL); - - swboard = g_new0(MsnSwitchBoard, 1); - - swboard->session = session; - swboard->servconn = servconn = msn_servconn_new(session, MSN_SERVCONN_SB); - swboard->cmdproc = servconn->cmdproc; - - swboard->msg_queue = g_queue_new(); - swboard->empty = TRUE; - - swboard->cmdproc->data = swboard; - swboard->cmdproc->cbs_table = cbs_table; - - session->switches = g_list_append(session->switches, swboard); - - return swboard; -} - -void -msn_switchboard_destroy(MsnSwitchBoard *swboard) -{ - MsnSession *session; - MsnMessage *msg; - GList *l; - -#ifdef MSN_DEBUG_SB - purple_debug_info("msn", "switchboard_destroy: swboard(%p)\n", swboard); -#endif - - g_return_if_fail(swboard != NULL); - - if (swboard->destroying) - return; - - swboard->destroying = TRUE; - - /* If it linked us is because its looking for trouble */ - while (swboard->slplinks != NULL) - msn_slplink_destroy(swboard->slplinks->data); - - /* Destroy the message queue */ - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - if (swboard->error != MSN_SB_ERROR_NONE) - { - /* The messages could not be sent due to a switchboard error */ - msg_error_helper(swboard->cmdproc, msg, - MSN_MSG_ERROR_SB); - } - msn_message_unref(msg); - } - - g_queue_free(swboard->msg_queue); - - /* msg_error_helper will both remove the msg from ack_list and - unref it, so we don't need to do either here */ - while ((l = swboard->ack_list) != NULL) - msg_error_helper(swboard->cmdproc, l->data, MSN_MSG_ERROR_SB); - - g_free(swboard->im_user); - g_free(swboard->auth_key); - g_free(swboard->session_id); - - for (l = swboard->users; l != NULL; l = l->next) - g_free(l->data); - - if (swboard->users != NULL) - g_list_free(swboard->users); - - session = swboard->session; - session->switches = g_list_remove(session->switches, swboard); - -#if 0 - /* This should never happen or we are in trouble. */ - if (swboard->servconn != NULL) - msn_servconn_destroy(swboard->servconn); -#endif - - swboard->cmdproc->data = NULL; - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_servconn_destroy(swboard->servconn); - - g_free(swboard); -} - -void -msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(key != NULL); - - swboard->auth_key = g_strdup(key); -} - -const char * -msn_switchboard_get_auth_key(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->auth_key; -} - -void -msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(id != NULL); - - if (swboard->session_id != NULL) - g_free(swboard->session_id); - - swboard->session_id = g_strdup(id); -} - -const char * -msn_switchboard_get_session_id(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, NULL); - - return swboard->session_id; -} - -int -msn_switchboard_get_chat_id(void) -{ - static int chat_id = 1; - - return chat_id++; -} - -void -msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited) -{ - g_return_if_fail(swboard != NULL); - - swboard->invited = invited; -} - -gboolean -msn_switchboard_is_invited(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - return swboard->invited; -} - -/************************************************************************** - * Utility - **************************************************************************/ - -static void -send_clientcaps(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - msg = msn_message_new(MSN_MSG_CAPS); - msn_message_set_content_type(msg, "text/x-clientcaps"); - msn_message_set_flag(msg, 'U'); - msn_message_set_bin_data(msg, MSN_CLIENTINFO, strlen(MSN_CLIENTINFO)); - - msn_switchboard_send_msg(swboard, msg, TRUE); - - msn_message_destroy(msg); -} - -static void -msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnCmdProc *cmdproc; - PurpleAccount *account; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - account = cmdproc->session->account; - - swboard->users = g_list_prepend(swboard->users, g_strdup(user)); - swboard->current_users++; - swboard->empty = FALSE; - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "user=[%s], total=%d\n", user, - swboard->current_users); -#endif - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - { - /* This is a helper switchboard. */ - purple_debug_error("msn", "switchboard_add_user: conv != NULL\n"); - return; - } - - if ((swboard->conv != NULL) && - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - } - else if (swboard->current_users > 1 || swboard->total_users > 1) - { - if (swboard->conv == NULL || - purple_conversation_get_type(swboard->conv) != PURPLE_CONV_TYPE_CHAT) - { - GList *l; - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] Switching to chat.\n"); -#endif - -#if 0 - /* this is bad - it causes msn_switchboard_close to be called on the - * switchboard we're in the middle of using :( */ - if (swboard->conv != NULL) - purple_conversation_destroy(swboard->conv); -#endif - - swboard->chat_id = msn_switchboard_get_chat_id(); - swboard->flag |= MSN_SB_FLAG_IM; - swboard->conv = serv_got_joined_chat(account->gc, - swboard->chat_id, - "MSN Chat"); - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *tmp_user; - - tmp_user = l->data; - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] Adding [%s].\n", tmp_user); -#endif - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - tmp_user, NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - -#ifdef MSN_DEBUG_CHAT - purple_debug_info("msn", "[chat] We add ourselves.\n"); -#endif - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(swboard->conv), - purple_account_get_username(account), - NULL, PURPLE_CBFLAGS_NONE, TRUE); - - g_free(swboard->im_user); - swboard->im_user = NULL; - } - } - else if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - user, account); - } - else - { - purple_debug_warning("msn", "switchboard_add_user: This should not happen!\n"); - } -} - -static PurpleConversation * -msn_switchboard_get_conv(MsnSwitchBoard *swboard) -{ - PurpleAccount *account; - - g_return_val_if_fail(swboard != NULL, NULL); - - if (swboard->conv != NULL) - return swboard->conv; - - purple_debug_error("msn", "Switchboard with unassigned conversation\n"); - - account = swboard->session->account; - - return (swboard->conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, - account, swboard->im_user)); -} - -static void -msn_switchboard_report_user(MsnSwitchBoard *swboard, PurpleMessageFlags flags, const char *msg) -{ - PurpleConversation *conv; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - if ((conv = msn_switchboard_get_conv(swboard)) != NULL) - { - purple_conversation_write(conv, NULL, msg, flags, time(NULL)); - } -} - -static void -swboard_error_helper(MsnSwitchBoard *swboard, int reason, const char *passport) -{ - g_return_if_fail(swboard != NULL); - - purple_debug_warning("msg", "Error: Unable to call the user %s for reason %i\n", - passport ? passport : "(null)", reason); - - /* TODO: if current_users > 0, this is probably a chat and an invite failed, - * we should report that in the chat or something */ - if (swboard->current_users == 0) - { - swboard->error = reason; - msn_switchboard_close(swboard); - } -} - -static void -cal_error_helper(MsnTransaction *trans, int reason) -{ - MsnSwitchBoard *swboard; - const char *passport; - char **params; - - params = g_strsplit(trans->params, " ", 0); - - passport = params[0]; - - swboard = trans->data; - - purple_debug_warning("msn", "cal_error_helper: command %s failed for reason %i\n",trans->command,reason); - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static void -msg_error_helper(MsnCmdProc *cmdproc, MsnMessage *msg, MsnMsgErrorType error) -{ - MsnSwitchBoard *swboard; - - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(msg != NULL); - - if ((error != MSN_MSG_ERROR_SB) && (msg->nak_cb != NULL)) - msg->nak_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - - /* This is not good, and should be fixed somewhere else. */ - g_return_if_fail(swboard != NULL); - - if (msg->type == MSN_MSG_TEXT) - { - const char *format, *str_reason; - char *body_str, *body_enc, *pre, *post; - -#if 0 - if (swboard->conv == NULL) - { - if (msg->ack_ref) - msn_message_unref(msg); - - return; - } -#endif - - if (error == MSN_MSG_ERROR_TIMEOUT) - { - str_reason = _("Message may have not been sent " - "because a timeout occurred:"); - } - else if (error == MSN_MSG_ERROR_SB) - { - switch (swboard->error) - { - case MSN_SB_ERROR_OFFLINE: - str_reason = _("Message could not be sent, " - "not allowed while invisible:"); - break; - case MSN_SB_ERROR_USER_OFFLINE: - str_reason = _("Message could not be sent " - "because the user is offline:"); - break; - case MSN_SB_ERROR_CONNECTION: - str_reason = _("Message could not be sent " - "because a connection error occurred:"); - break; - case MSN_SB_ERROR_TOO_FAST: - str_reason = _("Message could not be sent " - "because we are sending too quickly:"); - break; - case MSN_SB_ERROR_AUTHFAILED: - str_reason = _("Message could not be sent " - "because we were unable to establish a " - "session with the server. This is " - "likely a server problem, try again in " - "a few minutes:"); - break; - default: - str_reason = _("Message could not be sent " - "because an error with " - "the switchboard occurred:"); - break; - } - } - else - { - str_reason = _("Message may have not been sent " - "because an unknown error occurred:"); - } - - body_str = msn_message_to_string(msg); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - format = msn_message_get_attr(msg, "X-MMS-IM-Format"); - msn_parse_format(format, &pre, &post); - body_str = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - g_free(body_enc); - g_free(pre); - g_free(post); - - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_ERROR, - str_reason); - msn_switchboard_report_user(swboard, PURPLE_MESSAGE_RAW, - body_str); - - g_free(body_str); - } - - /* If a timeout occures we will want the msg around just in case we - * receive the ACK after the timeout. */ - if (msg->ack_ref && error != MSN_MSG_ERROR_TIMEOUT) - { - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); - } -} - -/************************************************************************** - * Message Stuff - **************************************************************************/ - -/** Called when a message times out. */ -static void -msg_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - MsnMessage *msg; - - msg = trans->data; - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_TIMEOUT); -} - -/** Called when we receive an error of a message. */ -static void -msg_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - msg_error_helper(cmdproc, trans->data, MSN_MSG_ERROR_UNKNOWN); -} - -#if 0 -/** Called when we receive an ack of a special message. */ -static void -msg_ack(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg->ack_data); - - msn_message_unref(msg); -} - -/** Called when we receive a nak of a special message. */ -static void -msg_nak(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - - msn_message_unref(msg); -} -#endif - -static void -release_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - char *payload; - gsize payload_len; - - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - cmdproc = swboard->cmdproc; - - payload = msn_message_gen_payload(msg, &payload_len); - -#ifdef MSN_DEBUG_SB - msn_message_show_readable(msg, "SB SEND", FALSE); -#endif - - trans = msn_transaction_new(cmdproc, "MSG", "%c %d", - msn_message_get_flag(msg), payload_len); - - /* Data for callbacks */ - msn_transaction_set_data(trans, msg); - - if (msg->type == MSN_MSG_TEXT) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); - } - else if (msg->type == MSN_MSG_SLP) - { - msg->ack_ref = TRUE; - msn_message_ref(msg); - swboard->ack_list = g_list_append(swboard->ack_list, msg); - msn_transaction_set_timeout_cb(trans, msg_timeout); -#if 0 - if (msg->ack_cb != NULL) - { - msn_transaction_add_cb(trans, "ACK", msg_ack); - msn_transaction_add_cb(trans, "NAK", msg_nak); - } -#endif - } - - trans->payload = payload; - trans->payload_len = payload_len; - - msg->trans = trans; - - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -queue_msg(MsnSwitchBoard *swboard, MsnMessage *msg) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - purple_debug_info("msn", "Appending message to queue.\n"); - - g_queue_push_tail(swboard->msg_queue, msg); - - msn_message_ref(msg); -} - -static void -process_queue(MsnSwitchBoard *swboard) -{ - MsnMessage *msg; - - g_return_if_fail(swboard != NULL); - - purple_debug_info("msn", "Processing queue\n"); - - while ((msg = g_queue_pop_head(swboard->msg_queue)) != NULL) - { - purple_debug_info("msn", "Sending message\n"); - release_msg(swboard, msg); - msn_message_unref(msg); - } -} - -gboolean -msn_switchboard_can_send(MsnSwitchBoard *swboard) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - if (swboard->empty || !g_queue_is_empty(swboard->msg_queue)) - return FALSE; - - return TRUE; -} - -void -msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue) -{ - g_return_if_fail(swboard != NULL); - g_return_if_fail(msg != NULL); - - if (msn_switchboard_can_send(swboard)) - release_msg(swboard, msg); - else if (queue) - queue_msg(swboard, msg); -} - -/************************************************************************** - * Switchboard Commands - **************************************************************************/ - -static void -ans_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - swboard->ready = TRUE; -} - -static void -bye_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - user = cmd->params[0]; - - /* cmdproc->data is set to NULL when the switchboard is destroyed; - * we may get a bye shortly thereafter. */ - g_return_if_fail(swboard != NULL); - - if (!(swboard->flag & MSN_SB_FLAG_IM) && (swboard->conv != NULL)) - purple_debug_error("msn_switchboard", "bye_cmd: helper bug\n"); - - if (swboard->conv == NULL) - { - /* This is a helper switchboard */ - msn_switchboard_destroy(swboard); - } - else if ((swboard->current_users > 1) || - (purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* This is a switchboard used for a chat */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(swboard->conv), user, NULL); - swboard->current_users--; - if (swboard->current_users == 0) - msn_switchboard_destroy(swboard); - } - else - { - /* This is a switchboard used for a im session */ - msn_switchboard_destroy(swboard); - } -} - -static void -iro_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - account = cmdproc->session->account; - gc = account->gc; - swboard = cmdproc->data; - - swboard->total_users = atoi(cmd->params[2]); - - msn_switchboard_add_user(swboard, cmd->params[3]); -} - -static void -joi_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session; - PurpleAccount *account; - PurpleConnection *gc; - MsnSwitchBoard *swboard; - const char *passport; - - passport = cmd->params[0]; - - session = cmdproc->session; - account = session->account; - gc = account->gc; - swboard = cmdproc->data; - - msn_switchboard_add_user(swboard, passport); - - process_queue(swboard); - - if (!session->http_method) - send_clientcaps(swboard); - - if (swboard->closed) - msn_switchboard_close(swboard); -} - -static void -msg_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload, size_t len) -{ - MsnMessage *msg; - - msg = msn_message_new_from_cmd(cmdproc->session, cmd); - - msn_message_parse_payload(msg, payload, len); -#ifdef MSN_DEBUG_SB - msn_message_show_readable(msg, "SB RECV", FALSE); -#endif - - if (msg->remote_user != NULL) - g_free (msg->remote_user); - - msg->remote_user = g_strdup(cmd->params[0]); - msn_cmdproc_process_msg(cmdproc, msg); - - msn_message_destroy(msg); -} - -static void -msg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - cmdproc->servconn->payload_len = atoi(cmd->params[2]); - cmdproc->last_cmd->payload_cb = msg_cmd_post; -} - -static void -nak_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnMessage *msg; - - msg = cmd->trans->data; - g_return_if_fail(msg != NULL); - - msg_error_helper(cmdproc, msg, MSN_MSG_ERROR_NAK); -} - -static void -ack_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - MsnMessage *msg; - - msg = cmd->trans->data; - - if (msg->ack_cb != NULL) - msg->ack_cb(msg, msg->ack_data); - - swboard = cmdproc->data; - if (swboard) - swboard->ack_list = g_list_remove(swboard->ack_list, msg); - msn_message_unref(msg); -} - -static void -out_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - - if (swboard->current_users > 1) - serv_got_chat_left(gc, swboard->chat_id); - - msn_switchboard_disconnect(swboard); -} - -static void -usr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - - swboard = cmdproc->data; - -#if 0 - GList *l; - - for (l = swboard->users; l != NULL; l = l->next) - { - const char *user; - user = l->data; - - msn_cmdproc_send(cmdproc, "CAL", "%s", user); - } -#endif - - swboard->ready = TRUE; - msn_cmdproc_process_queue(cmdproc); -} - -/************************************************************************** - * Message Handlers - **************************************************************************/ -static void -plain_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - const char *body; - char *body_str; - char *body_enc; - char *body_final; - size_t body_len; - const char *passport; - const char *value; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - - body = msn_message_get_bin_data(msg, &body_len); - body_str = g_strndup(body, body_len); - body_enc = g_markup_escape_text(body_str, -1); - g_free(body_str); - - passport = msg->remote_user; - - if (!strcmp(passport, "messenger@microsoft.com") && - strstr(body, "immediate security update")) - { - return; - } - -#if 0 - if ((value = msn_message_get_attr(msg, "User-Agent")) != NULL) - { - purple_debug_misc("msn", "User-Agent = '%s'\n", value); - } -#endif - - if ((value = msn_message_get_attr(msg, "X-MMS-IM-Format")) != NULL) - { - char *pre, *post; - - msn_parse_format(value, &pre, &post); - - body_final = g_strdup_printf("%s%s%s", pre ? pre : "", - body_enc ? body_enc : "", post ? post : ""); - - g_free(pre); - g_free(post); - g_free(body_enc); - } - else - { - body_final = body_enc; - } - - swboard->flag |= MSN_SB_FLAG_IM; - - if (swboard->current_users > 1 || - ((swboard->conv != NULL) && - purple_conversation_get_type(swboard->conv) == PURPLE_CONV_TYPE_CHAT)) - { - /* If current_users is always ok as it should then there is no need to - * check if this is a chat. */ - if (swboard->current_users <= 1) - purple_debug_misc("msn", "plain_msg: current_users(%d)\n", - swboard->current_users); - - serv_got_chat_in(gc, swboard->chat_id, passport, 0, body_final, - time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_chat(gc, swboard->chat_id); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - else - { - serv_got_im(gc, passport, body_final, 0, time(NULL)); - if (swboard->conv == NULL) - { - swboard->conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - passport, purple_connection_get_account(gc)); - swboard->flag |= MSN_SB_FLAG_IM; - } - } - - g_free(body_final); -} - -static void -control_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - PurpleConnection *gc; - MsnSwitchBoard *swboard; - char *passport; - - gc = cmdproc->session->account->gc; - swboard = cmdproc->data; - passport = msg->remote_user; - - if (swboard->current_users == 1 && - msn_message_get_attr(msg, "TypingUser") != NULL) - { - serv_got_typing(gc, passport, MSN_TYPING_RECV_TIMEOUT, - PURPLE_TYPING); - } -} - -static void -clientcaps_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ -#if 0 - MsnSession *session; - MsnSwitchBoard *swboard; - MsnUser *user; - GHashTable *clientcaps; - const char *value; - - char *passport = msg->sender; - - session = cmdproc->session; - swboard = cmdproc->servconn->swboard; - - clientcaps = msn_message_get_hashtable_from_body(msg); -#endif -} - -static void -nudge_msg(MsnCmdProc *cmdproc, MsnMessage *msg) -{ - MsnSwitchBoard *swboard; - PurpleAccount *account; - const char *user; - - swboard = cmdproc->data; - account = cmdproc->session->account; - user = msg->remote_user; - - serv_got_attention(account->gc, user, MSN_NUDGE); -} - -/************************************************************************** - * Connect stuff - **************************************************************************/ -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error); - -static void -connect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - MsnTransaction *trans; - MsnCmdProc *cmdproc; - PurpleAccount *account; - - cmdproc = servconn->cmdproc; - g_return_if_fail(cmdproc != NULL); - - account = cmdproc->session->account; - swboard = cmdproc->data; - g_return_if_fail(swboard != NULL); - - if (msn_switchboard_is_invited(swboard)) - { - swboard->empty = FALSE; - - trans = msn_transaction_new(cmdproc, "ANS", "%s %s %s", - purple_account_get_username(account), - swboard->auth_key, swboard->session_id); - } - else - { - trans = msn_transaction_new(cmdproc, "USR", "%s %s", - purple_account_get_username(account), - swboard->auth_key); - } - - msn_transaction_set_error_cb(trans, ans_usr_error); - msn_transaction_set_data(trans, swboard); - msn_cmdproc_send_trans(cmdproc, trans); -} - -static void -ans_usr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - char **params; - char *passport; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 911) - { - reason = MSN_SB_ERROR_AUTHFAILED; - } - - purple_debug_warning("msn", "ans_usr_error: command %s gave error %i\n", trans->command, error); - - params = g_strsplit(trans->params, " ", 0); - passport = params[0]; - swboard = trans->data; - - swboard_error_helper(swboard, reason, passport); - - g_strfreev(params); -} - -static void -disconnect_cb(MsnServConn *servconn) -{ - MsnSwitchBoard *swboard; - - swboard = servconn->cmdproc->data; - g_return_if_fail(swboard != NULL); - - msn_servconn_set_disconnect_cb(swboard->servconn, NULL); - - msn_switchboard_destroy(swboard); -} - -gboolean -msn_switchboard_connect(MsnSwitchBoard *swboard, const char *host, int port) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - msn_servconn_set_connect_cb(swboard->servconn, connect_cb); - msn_servconn_set_disconnect_cb(swboard->servconn, disconnect_cb); - - return msn_servconn_connect(swboard->servconn, host, port); -} - -void -msn_switchboard_disconnect(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - msn_servconn_disconnect(swboard->servconn); -} - -/************************************************************************** - * Call stuff - **************************************************************************/ -static void -got_cal(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -#if 0 - MsnSwitchBoard *swboard; - const char *user; - - swboard = cmdproc->data; - - user = cmd->params[0]; - - msn_switchboard_add_user(swboard, user); -#endif -} - -static void -cal_timeout(MsnCmdProc *cmdproc, MsnTransaction *trans) -{ - purple_debug_warning("msn", "cal_timeout: command %s timed out\n", trans->command); - - cal_error_helper(trans, MSN_SB_ERROR_UNKNOWN); -} - -static void -cal_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 215) - { - purple_debug_info("msn", "Invited user already in switchboard\n"); - return; - } - else if (error == 217) - { - reason = MSN_SB_ERROR_USER_OFFLINE; - } - - purple_debug_warning("msn", "cal_error: command %s gave error %i\n", trans->command, error); - - cal_error_helper(trans, reason); -} - -void -msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user) -{ - MsnTransaction *trans; - MsnCmdProc *cmdproc; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->cmdproc; - - trans = msn_transaction_new(cmdproc, "CAL", "%s", user); - /* this doesn't do anything, but users seem to think that - * 'Unhandled command' is some kind of error, so we don't report it */ - msn_transaction_add_cb(trans, "CAL", got_cal); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_timeout_cb(trans, cal_timeout); - - if (swboard->ready) - msn_cmdproc_send_trans(cmdproc, trans); - else - msn_cmdproc_queue_trans(cmdproc, trans); -} - -/************************************************************************** - * Create & Transfer stuff - **************************************************************************/ - -static void -got_swboard(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSwitchBoard *swboard; - char *host; - int port; - swboard = cmd->trans->data; - - if (g_list_find(cmdproc->session->switches, swboard) == NULL) - /* The conversation window was closed. */ - return; - - msn_switchboard_set_auth_key(swboard, cmd->params[4]); - - msn_parse_socket(cmd->params[2], &host, &port); - - if (!msn_switchboard_connect(swboard, host, port)) - msn_switchboard_destroy(swboard); - - g_free(host); -} - -static void -xfr_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ - MsnSwitchBoard *swboard; - int reason = MSN_SB_ERROR_UNKNOWN; - - if (error == 913) - reason = MSN_SB_ERROR_OFFLINE; - else if (error == 800) - reason = MSN_SB_ERROR_TOO_FAST; - - swboard = trans->data; - - purple_debug_info("msn", "xfr_error %i for %s: trans %p, command %s, reason %i\n", - error, (swboard->im_user ? swboard->im_user : "(null)"), trans, - (trans->command ? trans->command : "(null)"), reason); - - swboard_error_helper(swboard, reason, swboard->im_user); -} - -void -msn_switchboard_request(MsnSwitchBoard *swboard) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - - g_return_if_fail(swboard != NULL); - - cmdproc = swboard->session->notification->cmdproc; - - trans = msn_transaction_new(cmdproc, "XFR", "%s", "SB"); - msn_transaction_add_cb(trans, "XFR", got_swboard); - - msn_transaction_set_data(trans, swboard); - msn_transaction_set_error_cb(trans, xfr_error); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -void -msn_switchboard_close(MsnSwitchBoard *swboard) -{ - g_return_if_fail(swboard != NULL); - - if (swboard->error != MSN_SB_ERROR_NONE) - { - msn_switchboard_destroy(swboard); - } - else if (g_queue_is_empty(swboard->msg_queue) || - !swboard->session->connected) - { - MsnCmdProc *cmdproc; - cmdproc = swboard->cmdproc; - msn_cmdproc_send_quick(cmdproc, "OUT", NULL, NULL); - - msn_switchboard_destroy(swboard); - } - else - { - swboard->closed = TRUE; - } -} - -gboolean -msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag) -{ - g_return_val_if_fail(swboard != NULL, FALSE); - - swboard->flag &= ~flag; - - if (flag == MSN_SB_FLAG_IM) - /* Forget any conversation that used to be associated with this - * swboard. */ - swboard->conv = NULL; - - if (swboard->flag == 0) - { - msn_switchboard_close(swboard); - return TRUE; - } - - return FALSE; -} - -/************************************************************************** - * Init stuff - **************************************************************************/ - -void -msn_switchboard_init(void) -{ - cbs_table = msn_table_new(); - - msn_table_add_cmd(cbs_table, "ANS", "ANS", ans_cmd); - msn_table_add_cmd(cbs_table, "ANS", "IRO", iro_cmd); - - msn_table_add_cmd(cbs_table, "MSG", "ACK", ack_cmd); - msn_table_add_cmd(cbs_table, "MSG", "NAK", nak_cmd); - - msn_table_add_cmd(cbs_table, "USR", "USR", usr_cmd); - - msn_table_add_cmd(cbs_table, NULL, "MSG", msg_cmd); - msn_table_add_cmd(cbs_table, NULL, "JOI", joi_cmd); - msn_table_add_cmd(cbs_table, NULL, "BYE", bye_cmd); - msn_table_add_cmd(cbs_table, NULL, "OUT", out_cmd); - -#if 0 - /* They might skip the history */ - msn_table_add_cmd(cbs_table, NULL, "ACK", NULL); -#endif - - msn_table_add_error(cbs_table, "MSG", msg_error); - msn_table_add_error(cbs_table, "CAL", cal_error); - - /* Register the message type callbacks. */ - msn_table_add_msg_type(cbs_table, "text/plain", - plain_msg); - msn_table_add_msg_type(cbs_table, "text/x-msmsgscontrol", - control_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientcaps", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "text/x-clientinfo", - clientcaps_msg); - msn_table_add_msg_type(cbs_table, "application/x-msnmsgrp2p", - msn_p2p_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-emoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-mms-animemoticon", - msn_emoticon_msg); - msn_table_add_msg_type(cbs_table, "text/x-msnmsgr-datacast", - nudge_msg); -#if 0 - msn_table_add_msg_type(cbs_table, "text/x-msmmsginvite", - msn_invite_msg); -#endif -} - -void -msn_switchboard_end(void) -{ - msn_table_destroy(cbs_table); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/switchboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -/** - * @file switchboard.h MSN switchboard functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SWITCHBOARD_H_ -#define _MSN_SWITCHBOARD_H_ - -typedef struct _MsnSwitchBoard MsnSwitchBoard; - -#include "conversation.h" - -#include "msg.h" -#include "user.h" - -#include "servconn.h" - -#include "slplink.h" - -/** - * A switchboard error. - */ -typedef enum -{ - MSN_SB_ERROR_NONE, /**< No error. */ - MSN_SB_ERROR_CAL, /**< The user could not join (answer the call). */ - MSN_SB_ERROR_OFFLINE, /**< The account is offline. */ - MSN_SB_ERROR_USER_OFFLINE, /**< The user to call is offline. */ - MSN_SB_ERROR_CONNECTION, /**< There was a connection error. */ - MSN_SB_ERROR_TOO_FAST, /**< We are sending too fast */ - MSN_SB_ERROR_AUTHFAILED, /**< Authentication failed joining the switchboard session */ - MSN_SB_ERROR_UNKNOWN /**< An unknown error occurred. */ - -} MsnSBErrorType; - -/** - * A switchboard flag. - */ -typedef enum -{ - MSN_SB_FLAG_IM = 0x01, /**< This switchboard is being used for a conversation. */ - MSN_SB_FLAG_FT = 0x02, /**< This switchboard is being used for file transfer. */ - -} MsnSBFlag; - -/** - * A switchboard. - * - * A place where a bunch of users send messages to the rest of the users. - */ -struct _MsnSwitchBoard -{ - MsnSession *session; - MsnServConn *servconn; - MsnCmdProc *cmdproc; - char *im_user; - - MsnSBFlag flag; - char *auth_key; - char *session_id; - - PurpleConversation *conv; /**< The conversation that displays the - messages of this switchboard, or @c NULL if - this is a helper switchboard. */ - - gboolean empty; /**< A flag that states if the swithcboard has no - users in it. */ - gboolean invited; /**< A flag that states if we were invited to the - switchboard. */ - gboolean ready; /**< A flag that states if this switchboard is - ready to be used. */ - gboolean closed; /**< A flag that states if the switchboard has - been closed by the user. */ - gboolean destroying; /**< A flag that states if the switchboard is - alredy on the process of destruction. */ - - int current_users; - int total_users; - GList *users; - - int chat_id; - - GQueue *msg_queue; /**< Queue of messages to send. */ - GList *ack_list; /**< List of messages waiting for an ack. */ - - MsnSBErrorType error; /**< The error that occurred in this switchboard - (if applicable). */ - GList *slplinks; /**< The list of slplinks that are using this switchboard. */ -}; - -/** - * Initialize the variables for switchboard creation. - */ -void msn_switchboard_init(void); - -/** - * Destroy the variables for switchboard creation. - */ -void msn_switchboard_end(void); - -/** - * Creates a new switchboard. - * - * @param session The MSN session. - * - * @return The new switchboard. - */ -MsnSwitchBoard *msn_switchboard_new(MsnSession *session); - -/** - * Destroys a switchboard. - * - * @param swboard The switchboard to destroy. - */ -void msn_switchboard_destroy(MsnSwitchBoard *swboard); - -/** - * Sets the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param key The auth key. - */ -void msn_switchboard_set_auth_key(MsnSwitchBoard *swboard, const char *key); - -/** - * Returns the auth key the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The auth key. - */ -const char *msn_switchboard_get_auth_key(MsnSwitchBoard *swboard); - -/** - * Sets the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * @param id The session ID. - */ -void msn_switchboard_set_session_id(MsnSwitchBoard *swboard, const char *id); - -/** - * Returns the session ID the switchboard must use when connecting. - * - * @param swboard The switchboard. - * - * @return The session ID. - */ -const char *msn_switchboard_get_session_id(MsnSwitchBoard *swboard); - -/** - * Returns the next chat ID for use by a switchboard. - * - * @return The chat ID. - */ -int msn_switchboard_get_chat_id(void); - -/** - * Sets whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * @param invite @c TRUE if invited, @c FALSE otherwise. - */ -void msn_switchboard_set_invited(MsnSwitchBoard *swboard, gboolean invited); - -/** - * Returns whether or not we were invited to this switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if invited, @c FALSE otherwise. - */ -gboolean msn_switchboard_is_invited(MsnSwitchBoard *swboard); - -/** - * Connects to a switchboard. - * - * @param swboard The switchboard. - * @param host The switchboard server host. - * @param port The switcbharod server port. - * - * @return @c TRUE if able to connect, or @c FALSE otherwise. - */ -gboolean msn_switchboard_connect(MsnSwitchBoard *swboard, - const char *host, int port); - -/** - * Disconnects from a switchboard. - * - * @param swboard The switchboard to disconnect from. - */ -void msn_switchboard_disconnect(MsnSwitchBoard *swboard); - -/** - * Closes the switchboard. - * - * Called when a conversation is closed. - * - * @param swboard The switchboard to close. - */ -void msn_switchboard_close(MsnSwitchBoard *swboard); - -/** - * Release a switchboard from a certain function. - * - * @param swboard The switchboard to release. - * @param flag The flag that states the function. - * - * @return @c TRUE if the switchboard was closed, @c FALSE otherwise. - */ -gboolean msn_switchboard_release(MsnSwitchBoard *swboard, MsnSBFlag flag); - -/** - * Returns whether or not we currently can send a message through this - * switchboard. - * - * @param swboard The switchboard. - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -gboolean msn_switchboard_can_send(MsnSwitchBoard *swboard); - -/** - * Sends a message through this switchboard. - * - * @param swboard The switchboard. - * @param msg The message. - * @param queue A flag that states if we want this message to be queued (in - * the case it cannot currently be sent). - * - * @return @c TRUE if a message can be sent, @c FALSE otherwise. - */ -void msn_switchboard_send_msg(MsnSwitchBoard *swboard, MsnMessage *msg, - gboolean queue); - -gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard); -gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who); - -void msn_switchboard_request(MsnSwitchBoard *swboard); -void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user); - -/** - * Processes peer to peer messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_p2p_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes emoticon messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -/** - * Processes INVITE messages. - * - * @param cmdproc The command processor. - * @param msg The message. - */ -void msn_invite_msg(MsnCmdProc *cmdproc, MsnMessage *msg); - -#endif /* _MSN_SWITCHBOARD_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,260 +0,0 @@ -/** - * @file sync.c MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "sync.h" -#include "state.h" - -static MsnTable *cbs_table; - -static void -blp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - PurpleConnection *gc = cmdproc->session->account->gc; - const char *list_name; - - list_name = cmd->params[0]; - - if (!g_ascii_strcasecmp(list_name, "AL")) - { - /* - * If the current setting is AL, messages from users who - * are not in BL will be delivered. - * - * In other words, deny some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - else - { - /* If the current setting is BL, only messages from people - * who are in the AL will be delivered. - * - * In other words, permit some. - */ - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } -} - -static void -prp_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *type, *value; - - type = cmd->params[0]; - value = cmd->params[1]; - - if (cmd->param_count == 2) - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, purple_url_decode(value)); - } - else - { - if (!strcmp(type, "PHH")) - msn_user_set_home_phone(session->user, NULL); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(session->user, NULL); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(session->user, NULL); - } -} - -static void -lsg_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - const char *name; - int group_id; - - group_id = atoi(cmd->params[0]); - name = purple_url_decode(cmd->params[1]); - - msn_group_new(session->userlist, group_id, name); - - /* HACK */ - if (group_id == 0) - { - /* Group of ungroupped buddies */ - if (session->sync->total_users == 0) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } - return; - } - - if ((purple_find_group(name)) == NULL) - { - PurpleGroup *g = purple_group_new(name); - purple_blist_add_group(g, NULL); - } -} - -static void -lst_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSession *session = cmdproc->session; - char *passport = NULL; - const char *friend = NULL; - int list_op; - MsnUser *user; - - passport = cmd->params[0]; - friend = purple_url_decode(cmd->params[1]); - list_op = atoi(cmd->params[2]); - - user = msn_user_new(session->userlist, passport, friend); - - msn_userlist_add_user(session->userlist, user); - - session->sync->last_user = user; - - /* TODO: This can be improved */ - - if (list_op & MSN_LIST_FL_OP) - { - char **c; - char **tokens; - const char *group_nums; - GSList *group_ids; - - group_nums = cmd->params[3]; - - group_ids = NULL; - - tokens = g_strsplit(group_nums, ",", -1); - - for (c = tokens; *c != NULL; c++) - { - int id; - - id = atoi(*c); - group_ids = g_slist_append(group_ids, GINT_TO_POINTER(id)); - } - - g_strfreev(tokens); - - msn_got_lst_user(session, user, list_op, group_ids); - - g_slist_free(group_ids); - } - else - { - msn_got_lst_user(session, user, list_op, NULL); - } - - session->sync->num_users++; - - if (session->sync->num_users == session->sync->total_users) - { - cmdproc->cbs_table = session->sync->old_cbs_table; - - msn_session_finish_login(session); - - msn_sync_destroy(session->sync); - session->sync = NULL; - } -} - -static void -bpr_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ - MsnSync *sync = cmdproc->session->sync; - const char *type, *value; - MsnUser *user; - - user = sync->last_user; - - g_return_if_fail(user != NULL); - - type = cmd->params[0]; - value = cmd->params[1]; - - if (value) - { - if (!strcmp(type, "MOB")) - { - if (!strcmp(value, "Y")) - user->mobile = TRUE; - else if (!strcmp(value, "N")) - user->mobile = FALSE; - } - else if (!strcmp(type, "PHH")) - msn_user_set_home_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHW")) - msn_user_set_work_phone(user, purple_url_decode(value)); - else if (!strcmp(type, "PHM")) - msn_user_set_mobile_phone(user, purple_url_decode(value)); - } -} - -void -msn_sync_init(void) -{ - /* TODO: check prp, blp, bpr */ - - cbs_table = msn_table_new(); - - /* Syncing */ - msn_table_add_cmd(cbs_table, NULL, "GTC", NULL); - msn_table_add_cmd(cbs_table, NULL, "BLP", blp_cmd); - msn_table_add_cmd(cbs_table, NULL, "PRP", prp_cmd); - msn_table_add_cmd(cbs_table, NULL, "LSG", lsg_cmd); - msn_table_add_cmd(cbs_table, NULL, "LST", lst_cmd); - msn_table_add_cmd(cbs_table, NULL, "BPR", bpr_cmd); -} - -void -msn_sync_end(void) -{ - msn_table_destroy(cbs_table); -} - -MsnSync * -msn_sync_new(MsnSession *session) -{ - MsnSync *sync; - - sync = g_new0(MsnSync, 1); - - sync->session = session; - sync->cbs_table = cbs_table; - - return sync; -} - -void -msn_sync_destroy(MsnSync *sync) -{ - g_free(sync); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/sync.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/** - * @file sync.h MSN list synchronization functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_SYNC_H_ -#define _MSN_SYNC_H_ - -typedef struct _MsnSync MsnSync; - -#include "session.h" -#include "table.h" -#include "user.h" - -struct _MsnSync -{ - MsnSession *session; - MsnTable *cbs_table; - MsnTable *old_cbs_table; - - int num_users; - int total_users; - int num_groups; - int total_groups; - MsnUser *last_user; -}; - -void msn_sync_init(void); -void msn_sync_end(void); - -MsnSync * msn_sync_new(MsnSession *session); -void msn_sync_destroy(MsnSync *sync); - -#endif /* _MSN_SYNC_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file table.c MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "table.h" - -static void -null_cmd_cb(MsnCmdProc *cmdproc, MsnCommand *cmd) -{ -} - -static void -null_error_cb(MsnCmdProc *cmdproc, MsnTransaction *trans, int error) -{ -} - -MsnTable * -msn_table_new() -{ - MsnTable *table; - - table = g_new0(MsnTable, 1); - - table->cmds = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)g_hash_table_destroy); - table->msgs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->errors = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - table->async = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - table->fallback = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - return table; -} - -void -msn_table_destroy(MsnTable *table) -{ - g_return_if_fail(table != NULL); - - g_hash_table_destroy(table->cmds); - g_hash_table_destroy(table->msgs); - g_hash_table_destroy(table->errors); - - g_hash_table_destroy(table->async); - g_hash_table_destroy(table->fallback); - - g_free(table); -} - -void -msn_table_add_cmd(MsnTable *table, - char *command, char *answer, MsnTransCb cb) -{ - GHashTable *cbs; - - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - cbs = NULL; - - if (command == NULL) - { - cbs = table->async; - } - else if (strcmp(command, "fallback") == 0) - { - cbs = table->fallback; - } - else - { - cbs = g_hash_table_lookup(table->cmds, command); - - if (cbs == NULL) - { - cbs = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - g_hash_table_insert(table->cmds, command, cbs); - } - } - - if (cb == NULL) - cb = null_cmd_cb; - - g_hash_table_insert(cbs, answer, cb); -} - -void -msn_table_add_error(MsnTable *table, - char *answer, MsnErrorCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(answer != NULL); - - if (cb == NULL) - cb = null_error_cb; - - g_hash_table_insert(table->errors, answer, cb); -} - -void -msn_table_add_msg_type(MsnTable *table, - char *type, MsnMsgTypeCb cb) -{ - g_return_if_fail(table != NULL); - g_return_if_fail(type != NULL); - g_return_if_fail(cb != NULL); - -#if 0 - if (cb == NULL) - cb = null_msg_cb; -#endif - - g_hash_table_insert(table->msgs, type, cb); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/** - * @file table.h MSN helper structure - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_TABLE_H_ -#define _MSN_TABLE_H_ - -typedef struct _MsnTable MsnTable; - -#include "cmdproc.h" -#include "transaction.h" -#include "msg.h" - -typedef void (*MsnMsgTypeCb)(MsnCmdProc *cmdproc, MsnMessage *msg); - -struct _MsnTable -{ - GHashTable *cmds; - GHashTable *msgs; - GHashTable *errors; - - GHashTable *async; - GHashTable *fallback; -}; - -MsnTable *msn_table_new(void); -void msn_table_destroy(MsnTable *table); - -void msn_table_add_cmd(MsnTable *table, char *command, char *answer, - MsnTransCb cb); -void msn_table_add_error(MsnTable *table, char *answer, MsnErrorCb cb); -void msn_table_add_msg_type(MsnTable *table, char *type, MsnMsgTypeCb cb); - -#endif /* _MSN_TABLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ -/** - * @file transaction.c MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "transaction.h" - -MsnTransaction * -msn_transaction_new(MsnCmdProc *cmdproc, const char *command, - const char *format, ...) -{ - MsnTransaction *trans; - va_list arg; - - g_return_val_if_fail(command != NULL, NULL); - - trans = g_new0(MsnTransaction, 1); - - trans->cmdproc = cmdproc; - trans->command = g_strdup(command); - - if (format != NULL) - { - va_start(arg, format); - trans->params = g_strdup_vprintf(format, arg); - va_end(arg); - } - - /* trans->queue = g_queue_new(); */ - - return trans; -} - -void -msn_transaction_destroy(MsnTransaction *trans) -{ - g_return_if_fail(trans != NULL); - - g_free(trans->command); - g_free(trans->params); - g_free(trans->payload); - -#if 0 - if (trans->pendent_cmd != NULL) - msn_message_unref(trans->pendent_msg); -#endif - -#if 0 - MsnTransaction *elem; - if (trans->queue != NULL) - { - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_transaction_destroy(elem); - - g_queue_free(trans->queue); - } -#endif - - if (trans->callbacks != NULL && trans->has_custom_callbacks) - g_hash_table_destroy(trans->callbacks); - - if (trans->timer) - purple_timeout_remove(trans->timer); - - g_free(trans); -} - -char * -msn_transaction_to_string(MsnTransaction *trans) -{ - char *str; - - g_return_val_if_fail(trans != NULL, FALSE); - - if (trans->params != NULL) - str = g_strdup_printf("%s %u %s\r\n", trans->command, trans->trId, trans->params); - else - str = g_strdup_printf("%s %u\r\n", trans->command, trans->trId); - - return str; -} - -void -msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd) -{ - purple_debug_info("msn", "queueing command.\n"); - trans->pendent_cmd = cmd; - msn_command_ref(cmd); -} - -void -msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnCommand *cmd; - - if (!cmdproc->servconn->connected) - return; - - purple_debug_info("msn", "unqueueing command.\n"); - cmd = trans->pendent_cmd; - - g_return_if_fail(cmd != NULL); - - msn_cmdproc_process_cmd(cmdproc, cmd); - msn_command_unref(cmd); - - trans->pendent_cmd = NULL; -} - -#if 0 -void -msn_transaction_queue(MsnTransaction *trans, MsnTransaction *elem) -{ - if (trans->queue == NULL) - trans->queue = g_queue_new(); - - g_queue_push_tail(trans->queue, elem); -} - -void -msn_transaction_unqueue(MsnTransaction *trans, MsnCmdProc *cmdproc) -{ - MsnTransaction *elem; - - while ((elem = g_queue_pop_head(trans->queue)) != NULL) - msn_cmdproc_send_trans(cmdproc, elem); -} -#endif - -void -msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(payload != NULL); - - trans->payload = g_strdup(payload); - trans->payload_len = payload_len ? payload_len : strlen(trans->payload); -} - -void -msn_transaction_set_data(MsnTransaction *trans, void *data) -{ - g_return_if_fail(trans != NULL); - - trans->data = data; -} - -void -msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb) -{ - g_return_if_fail(trans != NULL); - g_return_if_fail(answer != NULL); - - if (trans->callbacks == NULL) - { - trans->has_custom_callbacks = TRUE; - trans->callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - NULL); - } - else if (trans->has_custom_callbacks != TRUE) - g_return_if_reached (); - - g_hash_table_insert(trans->callbacks, answer, cb); -} - -static gboolean -transaction_timeout(gpointer data) -{ - MsnTransaction *trans; - - trans = data; - g_return_val_if_fail(trans != NULL, FALSE); - -#if 0 - purple_debug_info("msn", "timed out: %s %d %s\n", trans->command, trans->trId, trans->params); -#endif - - if (trans->timeout_cb != NULL) - trans->timeout_cb(trans->cmdproc, trans); - - return FALSE; -} - -void -msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb) -{ - if (trans->timer) - { - purple_debug_error("msn", "This shouldn't be happening\n"); - purple_timeout_remove(trans->timer); - } - trans->timeout_cb = cb; - trans->timer = purple_timeout_add_seconds(60, transaction_timeout, trans); -} - -void -msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb) -{ - trans->error_cb = cb; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/transaction.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/** - * @file transaction.h MSN transaction functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_TRANSACTION_H -#define _MSN_TRANSACTION_H - -typedef struct _MsnTransaction MsnTransaction; - -#include "command.h" -#include "cmdproc.h" - -typedef void (*MsnTransCb)(MsnCmdProc *cmdproc, MsnCommand *cmd); -typedef void (*MsnTimeoutCb)(MsnCmdProc *cmdproc, MsnTransaction *trans); -typedef void (*MsnErrorCb)(MsnCmdProc *cmdproc, MsnTransaction *trans, - int error); - -/** - * A transaction. A sending command that will initiate the transaction. - */ -struct _MsnTransaction -{ - MsnCmdProc *cmdproc; - unsigned int trId; - - char *command; - char *params; - - int timer; - - void *data; /**< The data to be used on the different callbacks. */ - GHashTable *callbacks; - gboolean has_custom_callbacks; - MsnErrorCb error_cb; - MsnTimeoutCb timeout_cb; - - char *payload; - size_t payload_len; - - GQueue *queue; - MsnCommand *pendent_cmd; /**< The command that is waiting for the result of - this transaction. */ -}; - -MsnTransaction *msn_transaction_new(MsnCmdProc *cmdproc, - const char *command, - const char *format, ...); -void msn_transaction_destroy(MsnTransaction *trans); - -char *msn_transaction_to_string(MsnTransaction *trans); -void msn_transaction_queue_cmd(MsnTransaction *trans, MsnCommand *cmd); -void msn_transaction_unqueue_cmd(MsnTransaction *trans, MsnCmdProc *cmdproc); -void msn_transaction_set_payload(MsnTransaction *trans, - const char *payload, int payload_len); -void msn_transaction_set_data(MsnTransaction *trans, void *data); -void msn_transaction_add_cb(MsnTransaction *trans, char *answer, - MsnTransCb cb); -void msn_transaction_set_error_cb(MsnTransaction *trans, MsnErrorCb cb); -void msn_transaction_set_timeout_cb(MsnTransaction *trans, MsnTimeoutCb cb); - -#endif /* _MSN_TRANSACTION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,332 +0,0 @@ -/** - * @file user.c User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "user.h" -#include "slp.h" - -MsnUser * -msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name) -{ - MsnUser *user; - - user = g_new0(MsnUser, 1); - - user->userlist = userlist; - - msn_user_set_passport(user, passport); - if (friendly_name != NULL) - msn_user_set_friendly_name(user, friendly_name); - - return user; -} - -void -msn_user_destroy(MsnUser *user) -{ - g_return_if_fail(user != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - if (user->group_ids != NULL) - g_list_free(user->group_ids); - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - g_free(user->passport); - g_free(user->friendly_name); - g_free(user->phone.home); - g_free(user->phone.work); - g_free(user->phone.mobile); - - g_free(user); -} - -void -msn_user_update(MsnUser *user) -{ - PurpleAccount *account; - - account = user->userlist->session->account; - - if (user->status != NULL) { - if (!strcmp(user->status, "offline") && user->mobile) { - purple_prpl_got_user_status(account, user->passport, "offline", NULL); - purple_prpl_got_user_status(account, user->passport, "mobile", NULL); - } else { - purple_prpl_got_user_status(account, user->passport, user->status, NULL); - purple_prpl_got_user_status_deactive(account, user->passport, "mobile"); - } - } - - if (user->idle) - purple_prpl_got_user_idle(account, user->passport, TRUE, -1); - else - purple_prpl_got_user_idle(account, user->passport, FALSE, 0); -} - -void -msn_user_set_state(MsnUser *user, const char *state) -{ - const char *status; - - if (!g_ascii_strcasecmp(state, "BSY")) - status = "busy"; - else if (!g_ascii_strcasecmp(state, "BRB")) - status = "brb"; - else if (!g_ascii_strcasecmp(state, "AWY")) - status = "away"; - else if (!g_ascii_strcasecmp(state, "PHN")) - status = "phone"; - else if (!g_ascii_strcasecmp(state, "LUN")) - status = "lunch"; - else - status = "available"; - - if (!g_ascii_strcasecmp(state, "IDL")) - user->idle = TRUE; - else - user->idle = FALSE; - - user->status = status; -} - -void -msn_user_set_passport(MsnUser *user, const char *passport) -{ - g_return_if_fail(user != NULL); - - g_free(user->passport); - user->passport = g_strdup(passport); -} - -void -msn_user_set_friendly_name(MsnUser *user, const char *name) -{ - MsnCmdProc *cmdproc; - MsnSession *session; - const char *encoded; - - g_return_if_fail(user != NULL); - - encoded = purple_url_encode(name); - session = user->userlist->session; - - if (user->friendly_name && strcmp(user->friendly_name, name) - && (strlen(encoded) < 387) && session->passport_info.verified && - (user->list_op & MSN_LIST_FL_OP)) { - /* copy the new name to the server list, but only when new */ - /* should we check this more thoroughly? */ - cmdproc = session->notification->cmdproc; - msn_cmdproc_send(cmdproc, "REA", "%s %s", - user->passport, - encoded); - } - - g_free(user->friendly_name); - user->friendly_name = g_strdup(name); -} - -void -msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img) -{ - MsnObject *msnobj = NULL; - - g_return_if_fail(user != NULL); - - msnobj = msn_object_new_from_image(img, "TFR2C2.tmp", - user->passport, MSN_OBJECT_USERTILE); - - if(!msnobj) - purple_debug_error("msn", "Unable to open buddy icon from %s!\n", user->passport); - - msn_user_set_object(user, msnobj); -} - -void -msn_user_add_group_id(MsnUser *user, int id) -{ - MsnUserList *userlist; - PurpleAccount *account; - PurpleBuddy *b; - PurpleGroup *g; - const char *passport; - const char *group_name; - - g_return_if_fail(user != NULL); - g_return_if_fail(id >= 0); - - user->group_ids = g_list_append(user->group_ids, GINT_TO_POINTER(id)); - - userlist = user->userlist; - account = userlist->session->account; - passport = msn_user_get_passport(user); - - group_name = msn_userlist_find_group_name(userlist, id); - - g = purple_find_group(group_name); - - if ((id == 0) && (g == NULL)) - { - g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - } - - b = purple_find_buddy_in_group(account, passport, g); - - if (b == NULL) - { - b = purple_buddy_new(account, passport, NULL); - - purple_blist_add_buddy(b, NULL, g, NULL); - } - - b->proto_data = user; -} - -void -msn_user_remove_group_id(MsnUser *user, int id) -{ - g_return_if_fail(user != NULL); - g_return_if_fail(id >= 0); - - user->group_ids = g_list_remove(user->group_ids, GINT_TO_POINTER(id)); -} - -void -msn_user_set_home_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (user->phone.home != NULL) - g_free(user->phone.home); - - user->phone.home = (number == NULL ? NULL : g_strdup(number)); -} - -void -msn_user_set_work_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (user->phone.work != NULL) - g_free(user->phone.work); - - user->phone.work = (number == NULL ? NULL : g_strdup(number)); -} - -void -msn_user_set_mobile_phone(MsnUser *user, const char *number) -{ - g_return_if_fail(user != NULL); - - if (user->phone.mobile != NULL) - g_free(user->phone.mobile); - - user->phone.mobile = (number == NULL ? NULL : g_strdup(number)); -} - -void -msn_user_set_object(MsnUser *user, MsnObject *obj) -{ - g_return_if_fail(user != NULL); - - if (user->msnobj != NULL) - msn_object_destroy(user->msnobj); - - user->msnobj = obj; - - if (user->list_op & MSN_LIST_FL_OP) - msn_queue_buddy_icon_request(user); -} - -void -msn_user_set_client_caps(MsnUser *user, GHashTable *info) -{ - g_return_if_fail(user != NULL); - g_return_if_fail(info != NULL); - - if (user->clientcaps != NULL) - g_hash_table_destroy(user->clientcaps); - - user->clientcaps = info; -} - -const char * -msn_user_get_passport(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->passport; -} - -const char * -msn_user_get_friendly_name(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->friendly_name; -} - -const char * -msn_user_get_home_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.home; -} - -const char * -msn_user_get_work_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.work; -} - -const char * -msn_user_get_mobile_phone(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->phone.mobile; -} - -MsnObject * -msn_user_get_object(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->msnobj; -} - -GHashTable * -msn_user_get_client_caps(const MsnUser *user) -{ - g_return_val_if_fail(user != NULL, NULL); - - return user->clientcaps; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/** - * @file user.h User functions - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_USER_H_ -#define _MSN_USER_H_ - -typedef struct _MsnUser MsnUser; - -#include "session.h" -#include "object.h" - -#include "userlist.h" - -/** - * A user. - */ -struct _MsnUser -{ -#if 0 - MsnSession *session; /**< The MSN session. */ -#endif - MsnUserList *userlist; - - char *passport; /**< The passport account. */ - char *friendly_name; /**< The friendly name. */ - - const char *status; /**< The state of the user. */ - gboolean idle; /**< The idle state of the user. */ - - struct - { - char *home; /**< Home phone number. */ - char *work; /**< Work phone number. */ - char *mobile; /**< Mobile phone number. */ - - } phone; - - gboolean authorized; /**< Authorized to add this user. */ - gboolean mobile; /**< Signed up with MSN Mobile. */ - - GList *group_ids; /**< The group IDs. */ - - MsnObject *msnobj; /**< The user's MSN Object. */ - - GHashTable *clientcaps; /**< The client's capabilities. */ - - int list_op; -}; - -/**************************************************************************/ -/** @name User API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new user structure. - * - * @param session The MSN session. - * @param passport The initial passport. - * @param stored_name The initial stored name. - * - * @return A new user structure. - */ -MsnUser *msn_user_new(MsnUserList *userlist, const char *passport, - const char *friendly_name); - -/** - * Destroys a user structure. - * - * @param user The user to destroy. - */ -void msn_user_destroy(MsnUser *user); - - -/** - * Updates the user. - * - * Communicates with the core to update the ui, etc. - * - * @param user The user to update. - */ -void msn_user_update(MsnUser *user); - -/** - * Sets the new state of user. - * - * @param user The user. - * @param state The state string. - */ -void msn_user_set_state(MsnUser *user, const char *state); - -/** - * Sets the passport account for a user. - * - * @param user The user. - * @param passport The passport account. - */ -void msn_user_set_passport(MsnUser *user, const char *passport); - -/** - * Sets the friendly name for a user. - * - * @param user The user. - * @param name The friendly name. - */ -void msn_user_set_friendly_name(MsnUser *user, const char *name); - -/** - * Sets the buddy icon for a local user. - * - * @param user The user. - * @param img The buddy icon image - */ -void msn_user_set_buddy_icon(MsnUser *user, PurpleStoredImage *img); - -/** - * Sets the group ID list for a user. - * - * @param user The user. - * @param ids The group ID list. - */ -void msn_user_set_group_ids(MsnUser *user, GList *ids); - -/** - * Adds the group ID for a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_add_group_id(MsnUser *user, int id); - -/** - * Removes the group ID from a user. - * - * @param user The user. - * @param id The group ID. - */ -void msn_user_remove_group_id(MsnUser *user, int id); - -/** - * Sets the home phone number for a user. - * - * @param user The user. - * @param number The home phone number. - */ -void msn_user_set_home_phone(MsnUser *user, const char *number); - -/** - * Sets the work phone number for a user. - * - * @param user The user. - * @param number The work phone number. - */ -void msn_user_set_work_phone(MsnUser *user, const char *number); - -/** - * Sets the mobile phone number for a user. - * - * @param user The user. - * @param number The mobile phone number. - */ -void msn_user_set_mobile_phone(MsnUser *user, const char *number); - -/** - * Sets the MSNObject for a user. - * - * @param user The user. - * @param obj The MSNObject. - */ -void msn_user_set_object(MsnUser *user, MsnObject *obj); - -/** - * Sets the client information for a user. - * - * @param user The user. - * @param info The client information. - */ -void msn_user_set_client_caps(MsnUser *user, GHashTable *info); - - -/** - * Returns the passport account for a user. - * - * @param user The user. - * - * @return The passport account. - */ -const char *msn_user_get_passport(const MsnUser *user); - -/** - * Returns the friendly name for a user. - * - * @param user The user. - * - * @return The friendly name. - */ -const char *msn_user_get_friendly_name(const MsnUser *user); - -/** - * Returns the home phone number for a user. - * - * @param user The user. - * - * @return The user's home phone number. - */ -const char *msn_user_get_home_phone(const MsnUser *user); - -/** - * Returns the work phone number for a user. - * - * @param user The user. - * - * @return The user's work phone number. - */ -const char *msn_user_get_work_phone(const MsnUser *user); - -/** - * Returns the mobile phone number for a user. - * - * @param user The user. - * - * @return The user's mobile phone number. - */ -const char *msn_user_get_mobile_phone(const MsnUser *user); - -/** - * Returns the MSNObject for a user. - * - * @param user The user. - * - * @return The MSNObject. - */ -MsnObject *msn_user_get_object(const MsnUser *user); - -/** - * Returns the client information for a user. - * - * @param user The user. - * - * @return The client information. - */ -GHashTable *msn_user_get_client_caps(const MsnUser *user); - -/*@}*/ - -#endif /* _MSN_USER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,709 +0,0 @@ -/** - * @file userlist.c MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "msn.h" -#include "userlist.h" - -const char *lists[] = { "FL", "AL", "BL", "RL" }; - -typedef struct -{ - PurpleConnection *gc; - char *who; - char *friendly; - -} MsnPermitAdd; - -/************************************************************************** - * Callbacks - **************************************************************************/ -static void -msn_accept_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - MsnSession *session; - MsnUserList *userlist; - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - session = pa->gc->proto_data; - userlist = session->userlist; - - msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_AL, NULL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -msn_cancel_add_cb(gpointer data) -{ - MsnPermitAdd *pa = data; - MsnSession *session; - MsnUserList *userlist; - - if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { - session = pa->gc->proto_data; - userlist = session->userlist; - - msn_userlist_add_buddy(userlist, pa->who, MSN_LIST_BL, NULL); - } - - g_free(pa->who); - g_free(pa->friendly); - g_free(pa); -} - -static void -got_new_entry(PurpleConnection *gc, const char *passport, const char *friendly) -{ - MsnPermitAdd *pa; - - pa = g_new0(MsnPermitAdd, 1); - pa->who = g_strdup(passport); - pa->friendly = g_strdup(friendly); - pa->gc = gc; - - purple_account_request_authorization(purple_connection_get_account(gc), passport, NULL, friendly, NULL, - purple_find_buddy(purple_connection_get_account(gc), passport) != NULL, - msn_accept_add_cb, msn_cancel_add_cb, pa); -} - -/************************************************************************** - * Utility functions - **************************************************************************/ - -static gboolean -user_is_in_group(MsnUser *user, int group_id) -{ - if (user == NULL) - return FALSE; - - if (group_id < 0) - return FALSE; - - if (g_list_find(user->group_ids, GINT_TO_POINTER(group_id))) - return TRUE; - - return FALSE; -} - -static gboolean -user_is_there(MsnUser *user, int list_id, int group_id) -{ - int list_op; - - if (user == NULL) - return FALSE; - - list_op = 1 << list_id; - - if (!(user->list_op & list_op)) - return FALSE; - - if (list_id == MSN_LIST_FL) - { - if (group_id >= 0) - return user_is_in_group(user, group_id); - } - - return TRUE; -} - -static const char* -get_friendly_name(MsnUser *user) -{ - const char *friendly_name; - - g_return_val_if_fail(user != NULL, NULL); - - friendly_name = msn_user_get_friendly_name(user); - - if (friendly_name != NULL) - friendly_name = purple_url_encode(friendly_name); - else - friendly_name = msn_user_get_passport(user); - - /* this might be a bit of a hack, but it should prevent notification server - * disconnections for people who have buddies with insane friendly names - * who added you to their buddy list from being disconnected. Stu. */ - /* Shx: What? Isn't the store_name obtained from the server, and hence it's - * below the BUDDY_ALIAS_MAXLEN ? */ - /* Stu: yeah, that's why it's a bit of a hack, as you pointed out, we're - * probably decoding the incoming store_name wrong, or something. bleh. */ - - if (strlen(friendly_name) > BUDDY_ALIAS_MAXLEN) - friendly_name = msn_user_get_passport(user); - - return friendly_name; -} - -static void -msn_request_add_group(MsnUserList *userlist, const char *who, - const char *old_group_name, const char *new_group_name) -{ - MsnCmdProc *cmdproc; - MsnTransaction *trans; - MsnMoveBuddy *data; - - cmdproc = userlist->session->notification->cmdproc; - data = g_new0(MsnMoveBuddy, 1); - - data->who = g_strdup(who); - - if (old_group_name) - data->old_group_name = g_strdup(old_group_name); - - trans = msn_transaction_new(cmdproc, "ADG", "%s %d", - purple_url_encode(new_group_name), - 0); - - msn_transaction_set_data(trans, data); - - msn_cmdproc_send_trans(cmdproc, trans); -} - -/************************************************************************** - * Server functions - **************************************************************************/ - -MsnListId -msn_get_list_id(const char *list) -{ - if (list[0] == 'F') - return MSN_LIST_FL; - else if (list[0] == 'A') - return MSN_LIST_AL; - else if (list[0] == 'B') - return MSN_LIST_BL; - else if (list[0] == 'R') - return MSN_LIST_RL; - - return -1; -} - -void -msn_got_add_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id) -{ - PurpleAccount *account; - const char *passport; - const char *friendly; - - account = session->account; - - passport = msn_user_get_passport(user); - friendly = msn_user_get_friendly_name(user); - - if (list_id == MSN_LIST_FL) - { - PurpleConnection *gc; - - gc = purple_account_get_connection(account); - - serv_got_alias(gc, passport, friendly); - - if (group_id >= 0) - { - msn_user_add_group_id(user, group_id); - } - else - { - /* session->sync->fl_users_count++; */ - } - } - else if (list_id == MSN_LIST_AL) - { - purple_privacy_permit_add(account, passport, TRUE); - } - else if (list_id == MSN_LIST_BL) - { - purple_privacy_deny_add(account, passport, TRUE); - } - else if (list_id == MSN_LIST_RL) - { - PurpleConnection *gc; - PurpleConversation *convo; - - gc = purple_account_get_connection(account); - - purple_debug_info("msn", - "%s has added you to his or her buddy list.\n", - passport); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, passport, account); - if (convo) { - PurpleBuddy *buddy; - char *msg; - - buddy = purple_find_buddy(account, passport); - msg = g_strdup_printf( - _("%s has added you to his or her buddy list."), - buddy ? purple_buddy_get_contact_alias(buddy) : passport); - purple_conv_im_write(PURPLE_CONV_IM(convo), passport, msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - - if (!(user->list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) - { - /* - * TODO: The friendly name was NULL for me when I - * looked at this. Maybe we should use the store - * name instead? --KingAnt - */ - got_new_entry(gc, passport, friendly); - } - } - - user->list_op |= (1 << list_id); - /* purple_user_add_list_id (user, list_id); */ -} - -void -msn_got_rem_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id) -{ - PurpleAccount *account; - const char *passport; - - account = session->account; - - passport = msn_user_get_passport(user); - - if (list_id == MSN_LIST_FL) - { - /* TODO: When is the user totally removed? */ - if (group_id >= 0) - { - msn_user_remove_group_id(user, group_id); - return; - } - else - { - /* session->sync->fl_users_count--; */ - } - } - else if (list_id == MSN_LIST_AL) - { - purple_privacy_permit_remove(account, passport, TRUE); - } - else if (list_id == MSN_LIST_BL) - { - purple_privacy_deny_remove(account, passport, TRUE); - } - else if (list_id == MSN_LIST_RL) - { - PurpleConversation *convo; - - purple_debug_info("msn", - "%s has removed you from his or her buddy list.\n", - passport); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, passport, account); - if (convo) { - PurpleBuddy *buddy; - char *msg; - - buddy = purple_find_buddy(account, passport); - msg = g_strdup_printf( - _("%s has removed you from his or her buddy list."), - buddy ? purple_buddy_get_contact_alias(buddy) : passport); - purple_conv_im_write(PURPLE_CONV_IM(convo), passport, msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - } - } - - user->list_op &= ~(1 << list_id); - /* purple_user_remove_list_id (user, list_id); */ - - if (user->list_op == 0) - { - purple_debug_info("msn", "Buddy '%s' shall be deleted?.\n", - passport); - - } -} - -void -msn_got_lst_user(MsnSession *session, MsnUser *user, - int list_op, GSList *group_ids) -{ - PurpleConnection *gc; - PurpleAccount *account; - const char *passport; - const char *store; - - account = session->account; - gc = purple_account_get_connection(account); - - passport = msn_user_get_passport(user); - store = msn_user_get_friendly_name(user); - - if (list_op & MSN_LIST_AL_OP) - { - /* These are users who are allowed to see our status. */ - purple_privacy_deny_remove(account, passport, TRUE); - purple_privacy_permit_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_BL_OP) - { - /* These are users who are not allowed to see our status. */ - purple_privacy_permit_remove(account, passport, TRUE); - purple_privacy_deny_add(account, passport, TRUE); - } - - if (list_op & MSN_LIST_FL_OP) - { - GSList *c; - for (c = group_ids; c != NULL; c = g_slist_next(c)) - { - int group_id; - group_id = GPOINTER_TO_INT(c->data); - msn_user_add_group_id(user, group_id); - } - - /* FIXME: It might be a real alias */ - /* Umm, what? This might fix bug #1385130 */ - serv_got_alias(gc, passport, store); - } - - if (list_op & MSN_LIST_RL_OP) - { - /* These are users who have us on their buddy list. */ - /* - * TODO: What is store name set to when this happens? - * For one of my accounts "something@hotmail.com" - * the store name was "something." Maybe we - * should use the friendly name, instead? --KingAnt - */ - - if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) - { - got_new_entry(gc, passport, store); - } - } - - user->list_op = list_op; -} - -/************************************************************************** - * UserList functions - **************************************************************************/ - -MsnUserList* -msn_userlist_new(MsnSession *session) -{ - MsnUserList *userlist; - - userlist = g_new0(MsnUserList, 1); - - userlist->session = session; - userlist->buddy_icon_requests = g_queue_new(); - - /* buddy_icon_window is the number of allowed simultaneous buddy icon requests. - * XXX With smarter rate limiting code, we could allow more at once... 5 was the limit set when - * we weren't retrieiving any more than 5 per MSN session. */ - userlist->buddy_icon_window = 1; - - return userlist; -} - -void -msn_userlist_destroy(MsnUserList *userlist) -{ - GList *l; - - for (l = userlist->users; l != NULL; l = l->next) - { - msn_user_destroy(l->data); - } - - g_list_free(userlist->users); - - for (l = userlist->groups; l != NULL; l = l->next) - { - msn_group_destroy(l->data); - } - - g_list_free(userlist->groups); - - g_queue_free(userlist->buddy_icon_requests); - - if (userlist->buddy_icon_request_timer) - purple_timeout_remove(userlist->buddy_icon_request_timer); - - g_free(userlist); -} - -void -msn_userlist_add_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_prepend(userlist->users, user); -} - -void -msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user) -{ - userlist->users = g_list_remove(userlist->users, user); -} - -MsnUser * -msn_userlist_find_user(MsnUserList *userlist, const char *passport) -{ - GList *l; - - g_return_val_if_fail(passport != NULL, NULL); - - for (l = userlist->users; l != NULL; l = l->next) - { - MsnUser *user = (MsnUser *)l->data; - - g_return_val_if_fail(user->passport != NULL, NULL); - - if (!strcmp(passport, user->passport)) - return user; - } - - return NULL; -} - -void -msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_append(userlist->groups, group); -} - -void -msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group) -{ - userlist->groups = g_list_remove(userlist->groups, group); -} - -MsnGroup * -msn_userlist_find_group_with_id(MsnUserList *userlist, int id) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(id >= 0, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if (group->id == id) - return group; - } - - return NULL; -} - -MsnGroup * -msn_userlist_find_group_with_name(MsnUserList *userlist, const char *name) -{ - GList *l; - - g_return_val_if_fail(userlist != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - for (l = userlist->groups; l != NULL; l = l->next) - { - MsnGroup *group = l->data; - - if ((group->name != NULL) && !g_ascii_strcasecmp(name, group->name)) - return group; - } - - return NULL; -} - -int -msn_userlist_find_group_id(MsnUserList *userlist, const char *group_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_name(userlist, group_name); - - if (group != NULL) - return msn_group_get_id(group); - else - return -1; -} - -const char * -msn_userlist_find_group_name(MsnUserList *userlist, int group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - return msn_group_get_name(group); - else - return NULL; -} - -void -msn_userlist_rename_group_id(MsnUserList *userlist, int group_id, - const char *new_name) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - msn_group_set_name(group, new_name); -} - -void -msn_userlist_remove_group_id(MsnUserList *userlist, int group_id) -{ - MsnGroup *group; - - group = msn_userlist_find_group_with_id(userlist, group_id); - - if (group != NULL) - { - msn_userlist_remove_group(userlist, group); - msn_group_destroy(group); - } -} - -void -msn_userlist_rem_buddy(MsnUserList *userlist, - const char *who, int list_id, const char *group_name) -{ - MsnUser *user; - int group_id; - const char *list; - - user = msn_userlist_find_user(userlist, who); - group_id = -1; - - if (group_name != NULL) - { - group_id = msn_userlist_find_group_id(userlist, group_name); - - if (group_id < 0) - { - /* Whoa, there is no such group. */ - purple_debug_error("msn", "Group doesn't exist: %s\n", group_name); - return; - } - } - - /* First we're going to check if not there. */ - if (!(user_is_there(user, list_id, group_id))) - { - list = lists[list_id]; - purple_debug_error("msn", "User '%s' is not there: %s\n", - who, list); - return; - } - - /* Then request the rem to the server. */ - list = lists[list_id]; - - msn_notification_rem_buddy(userlist->session->notification, list, who, group_id); -} - -void -msn_userlist_add_buddy(MsnUserList *userlist, - const char *who, int list_id, - const char *group_name) -{ - MsnUser *user; - int group_id; - const char *list; - const char *friendly_name; - - group_id = -1; - - if (!purple_email_is_valid(who)) - { - /* only notify the user about problems adding to the friends list - * maybe we should do something else for other lists, but it probably - * won't cause too many problems if we just ignore it */ - if (list_id == MSN_LIST_FL) - { - char *str = g_strdup_printf(_("Unable to add \"%s\"."), who); - purple_notify_error(NULL, NULL, str, - _("The username specified is invalid.")); - g_free(str); - } - - return; - } - - if (group_name != NULL) - { - group_id = msn_userlist_find_group_id(userlist, group_name); - - if (group_id < 0) - { - /* Whoa, we must add that group first. */ - msn_request_add_group(userlist, who, NULL, group_name); - return; - } - } - - user = msn_userlist_find_user(userlist, who); - - /* First we're going to check if it's already there. */ - if (user_is_there(user, list_id, group_id)) - { - list = lists[list_id]; - purple_debug_error("msn", "User '%s' is already there: %s\n", who, list); - return; - } - - friendly_name = (user != NULL) ? get_friendly_name(user) : who; - - /* Then request the add to the server. */ - list = lists[list_id]; - - msn_notification_add_buddy(userlist->session->notification, list, who, - friendly_name, group_id); -} - -void -msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, const char *new_group_name) -{ - int new_group_id; - - new_group_id = msn_userlist_find_group_id(userlist, new_group_name); - - if (new_group_id < 0) - { - msn_request_add_group(userlist, who, old_group_name, new_group_name); - return; - } - - msn_userlist_add_buddy(userlist, who, MSN_LIST_FL, new_group_name); - msn_userlist_rem_buddy(userlist, who, MSN_LIST_FL, old_group_name); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/msnp9/userlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/** - * @file userlist.h MSN user list support - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _MSN_USERLIST_H_ -#define _MSN_USERLIST_H_ - -typedef struct _MsnUserList MsnUserList; - -#include "cmdproc.h" -#include "user.h" -#include "group.h" - -typedef enum -{ - MSN_LIST_FL, - MSN_LIST_AL, - MSN_LIST_BL, - MSN_LIST_RL - -} MsnListId; - -typedef struct -{ - char *who; - char *old_group_name; - -} MsnMoveBuddy; - -struct _MsnUserList -{ - MsnSession *session; - - /* MsnUsers *users; */ - /* MsnGroups *groups; */ - - GList *users; - GList *groups; - - GQueue *buddy_icon_requests; - int buddy_icon_window; - guint buddy_icon_request_timer; - - int fl_users_count; - -}; - -MsnListId msn_get_list_id(const char *list); - -void msn_got_add_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id); -void msn_got_rem_user(MsnSession *session, MsnUser *user, - MsnListId list_id, int group_id); -void msn_got_lst_user(MsnSession *session, MsnUser *user, - int list_op, GSList *group_ids); - -MsnUserList *msn_userlist_new(MsnSession *session); -void msn_userlist_destroy(MsnUserList *userlist); -void msn_userlist_add_user(MsnUserList *userlist, MsnUser *user); -void msn_userlist_remove_user(MsnUserList *userlist, MsnUser *user); -MsnUser *msn_userlist_find_user(MsnUserList *userlist, - const char *passport); -void msn_userlist_add_group(MsnUserList *userlist, MsnGroup *group); -void msn_userlist_remove_group(MsnUserList *userlist, MsnGroup *group); -MsnGroup *msn_userlist_find_group_with_id(MsnUserList *userlist, int id); -MsnGroup *msn_userlist_find_group_with_name(MsnUserList *userlist, - const char *name); -int msn_userlist_find_group_id(MsnUserList *userlist, - const char *group_name); -const char *msn_userlist_find_group_name(MsnUserList *userlist, - int group_id); -void msn_userlist_rename_group_id(MsnUserList *userlist, int group_id, - const char *new_name); -void msn_userlist_remove_group_id(MsnUserList *userlist, int group_id); - -void msn_userlist_rem_buddy(MsnUserList *userlist, const char *who, - int list_id, const char *group_name); -void msn_userlist_add_buddy(MsnUserList *userlist, const char *who, - int list_id, const char *group_name); -void msn_userlist_move_buddy(MsnUserList *userlist, const char *who, - const char *old_group_name, - const char *new_group_name); - -#endif /* _MSN_USERLIST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,430 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle MXit plugin actions -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "roster.h" -#include "actions.h" -#include "splashscreen.h" -#include "cipher.h" -#include "profile.h" - - -/* MXit Moods */ -static const char* moods[] = { - /* 0 */ N_("None"), - /* 1 */ N_("Angry"), - /* 2 */ N_("Excited"), - /* 3 */ N_("Grumpy"), - /* 4 */ N_("Happy"), - /* 5 */ N_("In Love"), - /* 6 */ N_("Invincible"), - /* 7 */ N_("Sad"), - /* 8 */ N_("Hot"), - /* 9 */ N_("Sick"), - /* 10 */ N_("Sleepy") -}; - - -/*------------------------------------------------------------------------ - * The user has selected to change their current mood. - * - * @param gc The connection object - * @param fields The fields from the request pop-up - */ -static void mxit_cb_set_mood( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - int mood = purple_request_fields_get_choice( fields, "mood" ); - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_set_mood (%i)\n", mood ); - - if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { - purple_debug_error( MXIT_PLUGIN_ID, "Unable to set mood; account offline.\n" ); - return; - } - - /* Save the new mood in session */ - session->mood = mood; - - /* now send the update to MXit */ - mxit_send_mood( session, mood ); -} - - -/*------------------------------------------------------------------------ - * Create and display the mood selection window to the user. - * - * @param action The action object - */ -static void mxit_cb_action_mood( PurplePluginAction* action ) -{ - PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - PurpleRequestFields* fields = NULL; - PurpleRequestFieldGroup* group = NULL; - PurpleRequestField* field = NULL; - unsigned int i = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_action_mood\n" ); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* show current mood */ - field = purple_request_field_string_new( "current", _( "Current Mood" ), _( moods[session->mood] ), FALSE ); - purple_request_field_string_set_editable( field, FALSE ); /* current mood field is not editable */ - purple_request_field_group_add_field( group, field ); - - /* add all moods to list */ - field = purple_request_field_choice_new( "mood", _( "New Mood" ), 0 ); - for ( i = 0; i < ARRAY_SIZE( moods ); i++ ) { - purple_request_field_choice_add( field, _( moods[i] ) ); - } - purple_request_field_set_required( field, TRUE ); - purple_request_field_choice_set_default_value( field, session->mood ); - purple_request_field_group_add_field( group, field ); - - /* (reference: "libpurple/request.h") */ - purple_request_fields( gc, _( "Mood" ), _( "Change your Mood" ), _( "How do you feel right now?" ), fields, _( "Set" ), - G_CALLBACK( mxit_cb_set_mood ), _( "Cancel" ), NULL, purple_connection_get_account( gc ), NULL, NULL, gc ); -} - - -/*------------------------------------------------------------------------ - * The user has selected to change their profile. - * - * @param gc The connection object - * @param fields The fields from the request pop-up - */ -static void mxit_cb_set_profile( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleRequestField* field = NULL; - const char* pin = NULL; - const char* pin2 = NULL; - const char* name = NULL; - const char* bday = NULL; - const char* err = NULL; - int len; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_set_profile\n" ); - - if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { - purple_debug_error( MXIT_PLUGIN_ID, "Unable to update profile; account offline.\n" ); - return; - } - - /* validate pin */ - pin = purple_request_fields_get_string( fields, "pin" ); - if ( !pin ) { - err = _( "The PIN you entered is invalid." ); - goto out; - } - len = strlen( pin ); - if ( ( len < 4 ) || ( len > 10 ) ) { - err = _( "The PIN you entered has an invalid length [4-10]." ); - goto out; - } - for ( i = 0; i < len; i++ ) { - if ( !g_ascii_isdigit( pin[i] ) ) { - err = _( "The PIN is invalid. It should only consist of digits [0-9]." ); - goto out; - } - } - pin2 = purple_request_fields_get_string( fields, "pin2" ); - if ( ( !pin2 ) || ( strcmp( pin, pin2 ) != 0 ) ) { - err = _( "The two PINs you entered do not match." ); - goto out; - } - - /* validate name */ - name = purple_request_fields_get_string( fields, "name" ); - if ( ( !name ) || ( strlen( name ) < 3 ) ) { - err = _( "The name you entered is invalid." ); - goto out; - } - - /* validate birthdate */ - bday = purple_request_fields_get_string( fields, "bday" ); - if ( ( !bday ) || ( strlen( bday ) < 10 ) || ( !validateDate( bday ) ) ) { - err = _( "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." ); - goto out; - } - -out: - if ( !err ) { - struct MXitProfile* profile = session->profile; - GString* attributes = g_string_sized_new( 128 ); - char attrib[512]; - unsigned int acount = 0; - - /* all good, so we can now update the profile */ - - /* update pin */ - purple_account_set_password( session->acc, pin ); - g_free( session->encpwd ); - session->encpwd = mxit_encrypt_password( session ); - - /* update name */ - g_strlcpy( profile->nickname, name, sizeof( profile->nickname ) ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FULLNAME, CP_PROF_TYPE_UTF8, profile->nickname ); - g_string_append( attributes, attrib ); - acount++; - - /* update hidden */ - field = purple_request_fields_get_field( fields, "hidden" ); - profile->hidden = purple_request_field_bool_get_value( field ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_HIDENUMBER, CP_PROF_TYPE_BOOL, ( profile->hidden ) ? "1" : "0" ); - g_string_append( attributes, attrib ); - acount++; - - /* update birthday */ - strcpy( profile->birthday, bday ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_BIRTHDATE, CP_PROF_TYPE_UTF8, profile->birthday ); - g_string_append( attributes, attrib ); - acount++; - - /* update gender */ - profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_GENDER, CP_PROF_TYPE_BOOL, ( profile->male ) ? "1" : "0" ); - g_string_append( attributes, attrib ); - acount++; - - /* update title */ - name = purple_request_fields_get_string( fields, "title" ); - if ( !name ) - profile->title[0] = '\0'; - else - strcpy( profile->title, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_TITLE, CP_PROF_TYPE_UTF8, profile->title ); - g_string_append( attributes, attrib ); - acount++; - - /* update firstname */ - name = purple_request_fields_get_string( fields, "firstname" ); - if ( !name ) - profile->firstname[0] = '\0'; - else - strcpy( profile->firstname, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_FIRSTNAME, CP_PROF_TYPE_UTF8, profile->firstname ); - g_string_append( attributes, attrib ); - acount++; - - /* update lastname */ - name = purple_request_fields_get_string( fields, "lastname" ); - if ( !name ) - profile->lastname[0] = '\0'; - else - strcpy( profile->lastname, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_LASTNAME, CP_PROF_TYPE_UTF8, profile->lastname ); - g_string_append( attributes, attrib ); - acount++; - - /* update email address */ - name = purple_request_fields_get_string( fields, "email" ); - if ( !name ) - profile->email[0] = '\0'; - else - strcpy( profile->email, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_EMAIL, CP_PROF_TYPE_UTF8, profile->email ); - g_string_append( attributes, attrib ); - acount++; - - /* update mobile number */ - name = purple_request_fields_get_string( fields, "mobilenumber" ); - if ( !name ) - profile->mobilenr[0] = '\0'; - else - strcpy( profile->mobilenr, name ); - g_snprintf( attrib, sizeof( attrib ), "\01%s\01%i\01%s", CP_PROFILE_MOBILENR, CP_PROF_TYPE_UTF8, profile->mobilenr ); - g_string_append( attributes, attrib ); - acount++; - - /* send the profile update to MXit */ - mxit_send_extprofile_update( session, session->encpwd, acount, attributes->str ); - g_string_free( attributes, TRUE ); - } - else { - /* show error to user */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Profile Update Error" ), err ); - } -} - - -/*------------------------------------------------------------------------ - * Display and update the user's profile. - * - * @param action The action object - */ -static void mxit_cb_action_profile( PurplePluginAction* action ) -{ - PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct MXitProfile* profile = session->profile; - - PurpleRequestFields* fields = NULL; - PurpleRequestFieldGroup* group = NULL; - PurpleRequestField* field = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_action_profile\n" ); - - /* ensure that we actually have the user's profile information */ - if ( !profile ) { - /* no profile information yet, so we cannot update */ - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Profile" ), _( "Your profile information is not yet retrieved. Please try again later." ) ); - return; - } - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* pin */ - field = purple_request_field_string_new( "pin", _( "PIN" ), session->acc->password, FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), session->acc->password, FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - - /* display name */ - field = purple_request_field_string_new( "name", _( "Display Name" ), profile->nickname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* birthday */ - field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* gender */ - field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); - purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ - purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ - purple_request_field_group_add_field( group, field ); - - /* hidden */ - field = purple_request_field_bool_new( "hidden", _( "Hide my number" ), profile->hidden ); - purple_request_field_group_add_field( group, field ); - - /* title */ - field = purple_request_field_string_new( "title", _( "Title" ), profile->title, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* first name */ - field = purple_request_field_string_new( "firstname", _( "First Name" ), profile->firstname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* last name */ - field = purple_request_field_string_new( "lastname", _( "Last Name" ), profile->lastname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* email */ - field = purple_request_field_string_new( "email", _( "Email" ), profile->email, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* mobile number */ - field = purple_request_field_string_new( "mobilenumber", _( "Mobile Number" ), profile->mobilenr, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* (reference: "libpurple/request.h") */ - purple_request_fields( gc, _( "Profile" ), _( "Update your Profile" ), _( "Here you can update your MXit profile" ), fields, _( "Set" ), - G_CALLBACK( mxit_cb_set_profile ), _( "Cancel" ), NULL, purple_connection_get_account( gc ), NULL, NULL, gc ); -} - - -/*------------------------------------------------------------------------ - * Display the current splash-screen, or a notification pop-up if one is not available. - * - * @param action The action object - */ -static void mxit_cb_action_splash( PurplePluginAction* action ) -{ - PurpleConnection* gc = (PurpleConnection*) action->context; - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - if ( splash_current( session ) != NULL ) - splash_display( session ); - else - mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "View Splash" ), _( "There is no splash-screen currently available" ) ); -} - - -/*------------------------------------------------------------------------ - * Display info about the plugin. - * - * @param action The action object - */ -static void mxit_cb_action_about( PurplePluginAction* action ) -{ - char version[256]; - - g_snprintf( version, sizeof( version ), "MXit libPurple Plugin v%s\n" - "MXit Client Protocol v%s\n\n" - "Author:\nPieter Loubser\n\n" - "Contributors:\nAndrew Victor\n\n" - "Testers:\nBraeme Le Roux\n\n", - MXIT_PLUGIN_VERSION, MXIT_CP_RELEASE ); - - mxit_popup( PURPLE_NOTIFY_MSG_INFO, _( "About" ), version ); -} - - -/*------------------------------------------------------------------------ - * Associate actions with the MXit plugin. - * - * @param plugin The MXit protocol plugin - * @param context The connection context (if available) - * @return The list of plugin actions - */ -GList* mxit_actions( PurplePlugin* plugin, gpointer context ) -{ - PurplePluginAction* action = NULL; - GList* m = NULL; - - /* display / change mood */ - action = purple_plugin_action_new( _( "Change Mood..." ), mxit_cb_action_mood ); - m = g_list_append( m, action ); - - /* display / change profile */ - action = purple_plugin_action_new( _( "Change Profile..." ), mxit_cb_action_profile ); - m = g_list_append( m, action ); - - /* display splash-screen */ - action = purple_plugin_action_new( _( "View Splash..." ), mxit_cb_action_splash ); - m = g_list_append( m, action ); - - /* display plugin version */ - action = purple_plugin_action_new( _( "About..." ), mxit_cb_action_about ); - m = g_list_append( m, action ); - - return m; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/actions.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle MXit plugin actions -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_ACTIONS_H_ -#define _MXIT_ACTIONS_H_ - - -/* callbacks */ -GList* mxit_actions( PurplePlugin* plugin, gpointer context ); - - -#endif /* _MXIT_ACTIONS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,405 +0,0 @@ - -// advanced encryption standard -// author: karl malbrain, malbrain@yahoo.com - -/* -This work, including the source code, documentation -and related data, is placed into the public domain. - -The orginal author is Karl Malbrain. - -THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY -OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF -MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, -ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE -RESULTING FROM THE USE, MODIFICATION, OR -REDISTRIBUTION OF THIS SOFTWARE. -*/ - -#include -#include - -#include "aes.h" - -// AES only supports Nb=4 -#define Nb 4 // number of columns in the state & expanded key - -#define Nk 4 // number of columns in a key -#define Nr 10 // number of rounds in encryption - -static uchar Sbox[256] = { // forward s-box -0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, -0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, -0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, -0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, -0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, -0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, -0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, -0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, -0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, -0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, -0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, -0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, -0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, -0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, -0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, -0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16}; - -static uchar InvSbox[256] = { // inverse s-box -0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, -0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, -0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, -0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, -0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, -0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, -0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, -0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, -0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, -0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, -0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, -0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, -0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, -0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, -0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, -0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d}; - -// combined Xtimes2[Sbox[]] -static uchar Xtime2Sbox[256] = { -0xc6, 0xf8, 0xee, 0xf6, 0xff, 0xd6, 0xde, 0x91, 0x60, 0x02, 0xce, 0x56, 0xe7, 0xb5, 0x4d, 0xec, -0x8f, 0x1f, 0x89, 0xfa, 0xef, 0xb2, 0x8e, 0xfb, 0x41, 0xb3, 0x5f, 0x45, 0x23, 0x53, 0xe4, 0x9b, -0x75, 0xe1, 0x3d, 0x4c, 0x6c, 0x7e, 0xf5, 0x83, 0x68, 0x51, 0xd1, 0xf9, 0xe2, 0xab, 0x62, 0x2a, -0x08, 0x95, 0x46, 0x9d, 0x30, 0x37, 0x0a, 0x2f, 0x0e, 0x24, 0x1b, 0xdf, 0xcd, 0x4e, 0x7f, 0xea, -0x12, 0x1d, 0x58, 0x34, 0x36, 0xdc, 0xb4, 0x5b, 0xa4, 0x76, 0xb7, 0x7d, 0x52, 0xdd, 0x5e, 0x13, -0xa6, 0xb9, 0x00, 0xc1, 0x40, 0xe3, 0x79, 0xb6, 0xd4, 0x8d, 0x67, 0x72, 0x94, 0x98, 0xb0, 0x85, -0xbb, 0xc5, 0x4f, 0xed, 0x86, 0x9a, 0x66, 0x11, 0x8a, 0xe9, 0x04, 0xfe, 0xa0, 0x78, 0x25, 0x4b, -0xa2, 0x5d, 0x80, 0x05, 0x3f, 0x21, 0x70, 0xf1, 0x63, 0x77, 0xaf, 0x42, 0x20, 0xe5, 0xfd, 0xbf, -0x81, 0x18, 0x26, 0xc3, 0xbe, 0x35, 0x88, 0x2e, 0x93, 0x55, 0xfc, 0x7a, 0xc8, 0xba, 0x32, 0xe6, -0xc0, 0x19, 0x9e, 0xa3, 0x44, 0x54, 0x3b, 0x0b, 0x8c, 0xc7, 0x6b, 0x28, 0xa7, 0xbc, 0x16, 0xad, -0xdb, 0x64, 0x74, 0x14, 0x92, 0x0c, 0x48, 0xb8, 0x9f, 0xbd, 0x43, 0xc4, 0x39, 0x31, 0xd3, 0xf2, -0xd5, 0x8b, 0x6e, 0xda, 0x01, 0xb1, 0x9c, 0x49, 0xd8, 0xac, 0xf3, 0xcf, 0xca, 0xf4, 0x47, 0x10, -0x6f, 0xf0, 0x4a, 0x5c, 0x38, 0x57, 0x73, 0x97, 0xcb, 0xa1, 0xe8, 0x3e, 0x96, 0x61, 0x0d, 0x0f, -0xe0, 0x7c, 0x71, 0xcc, 0x90, 0x06, 0xf7, 0x1c, 0xc2, 0x6a, 0xae, 0x69, 0x17, 0x99, 0x3a, 0x27, -0xd9, 0xeb, 0x2b, 0x22, 0xd2, 0xa9, 0x07, 0x33, 0x2d, 0x3c, 0x15, 0xc9, 0x87, 0xaa, 0x50, 0xa5, -0x03, 0x59, 0x09, 0x1a, 0x65, 0xd7, 0x84, 0xd0, 0x82, 0x29, 0x5a, 0x1e, 0x7b, 0xa8, 0x6d, 0x2c -}; - -// combined Xtimes3[Sbox[]] -static uchar Xtime3Sbox[256] = { -0xa5, 0x84, 0x99, 0x8d, 0x0d, 0xbd, 0xb1, 0x54, 0x50, 0x03, 0xa9, 0x7d, 0x19, 0x62, 0xe6, 0x9a, -0x45, 0x9d, 0x40, 0x87, 0x15, 0xeb, 0xc9, 0x0b, 0xec, 0x67, 0xfd, 0xea, 0xbf, 0xf7, 0x96, 0x5b, -0xc2, 0x1c, 0xae, 0x6a, 0x5a, 0x41, 0x02, 0x4f, 0x5c, 0xf4, 0x34, 0x08, 0x93, 0x73, 0x53, 0x3f, -0x0c, 0x52, 0x65, 0x5e, 0x28, 0xa1, 0x0f, 0xb5, 0x09, 0x36, 0x9b, 0x3d, 0x26, 0x69, 0xcd, 0x9f, -0x1b, 0x9e, 0x74, 0x2e, 0x2d, 0xb2, 0xee, 0xfb, 0xf6, 0x4d, 0x61, 0xce, 0x7b, 0x3e, 0x71, 0x97, -0xf5, 0x68, 0x00, 0x2c, 0x60, 0x1f, 0xc8, 0xed, 0xbe, 0x46, 0xd9, 0x4b, 0xde, 0xd4, 0xe8, 0x4a, -0x6b, 0x2a, 0xe5, 0x16, 0xc5, 0xd7, 0x55, 0x94, 0xcf, 0x10, 0x06, 0x81, 0xf0, 0x44, 0xba, 0xe3, -0xf3, 0xfe, 0xc0, 0x8a, 0xad, 0xbc, 0x48, 0x04, 0xdf, 0xc1, 0x75, 0x63, 0x30, 0x1a, 0x0e, 0x6d, -0x4c, 0x14, 0x35, 0x2f, 0xe1, 0xa2, 0xcc, 0x39, 0x57, 0xf2, 0x82, 0x47, 0xac, 0xe7, 0x2b, 0x95, -0xa0, 0x98, 0xd1, 0x7f, 0x66, 0x7e, 0xab, 0x83, 0xca, 0x29, 0xd3, 0x3c, 0x79, 0xe2, 0x1d, 0x76, -0x3b, 0x56, 0x4e, 0x1e, 0xdb, 0x0a, 0x6c, 0xe4, 0x5d, 0x6e, 0xef, 0xa6, 0xa8, 0xa4, 0x37, 0x8b, -0x32, 0x43, 0x59, 0xb7, 0x8c, 0x64, 0xd2, 0xe0, 0xb4, 0xfa, 0x07, 0x25, 0xaf, 0x8e, 0xe9, 0x18, -0xd5, 0x88, 0x6f, 0x72, 0x24, 0xf1, 0xc7, 0x51, 0x23, 0x7c, 0x9c, 0x21, 0xdd, 0xdc, 0x86, 0x85, -0x90, 0x42, 0xc4, 0xaa, 0xd8, 0x05, 0x01, 0x12, 0xa3, 0x5f, 0xf9, 0xd0, 0x91, 0x58, 0x27, 0xb9, -0x38, 0x13, 0xb3, 0x33, 0xbb, 0x70, 0x89, 0xa7, 0xb6, 0x22, 0x92, 0x20, 0x49, 0xff, 0x78, 0x7a, -0x8f, 0xf8, 0x80, 0x17, 0xda, 0x31, 0xc6, 0xb8, 0xc3, 0xb0, 0x77, 0x11, 0xcb, 0xfc, 0xd6, 0x3a -}; - -// modular multiplication tables -// based on: - -// Xtime2[x] = (x & 0x80 ? 0x1b : 0) ^ (x + x) -// Xtime3[x] = x^Xtime2[x]; - -#if 0 -static uchar Xtime2[256] = { -0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, -0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, -0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, -0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, -0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, -0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, -0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, -0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe, -0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05, -0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25, -0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45, -0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65, -0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85, -0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5, -0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5, -0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5}; -#endif - -static uchar Xtime9[256] = { -0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, -0x90, 0x99, 0x82, 0x8b, 0xb4, 0xbd, 0xa6, 0xaf, 0xd8, 0xd1, 0xca, 0xc3, 0xfc, 0xf5, 0xee, 0xe7, -0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, -0xab, 0xa2, 0xb9, 0xb0, 0x8f, 0x86, 0x9d, 0x94, 0xe3, 0xea, 0xf1, 0xf8, 0xc7, 0xce, 0xd5, 0xdc, -0x76, 0x7f, 0x64, 0x6d, 0x52, 0x5b, 0x40, 0x49, 0x3e, 0x37, 0x2c, 0x25, 0x1a, 0x13, 0x08, 0x01, -0xe6, 0xef, 0xf4, 0xfd, 0xc2, 0xcb, 0xd0, 0xd9, 0xae, 0xa7, 0xbc, 0xb5, 0x8a, 0x83, 0x98, 0x91, -0x4d, 0x44, 0x5f, 0x56, 0x69, 0x60, 0x7b, 0x72, 0x05, 0x0c, 0x17, 0x1e, 0x21, 0x28, 0x33, 0x3a, -0xdd, 0xd4, 0xcf, 0xc6, 0xf9, 0xf0, 0xeb, 0xe2, 0x95, 0x9c, 0x87, 0x8e, 0xb1, 0xb8, 0xa3, 0xaa, -0xec, 0xe5, 0xfe, 0xf7, 0xc8, 0xc1, 0xda, 0xd3, 0xa4, 0xad, 0xb6, 0xbf, 0x80, 0x89, 0x92, 0x9b, -0x7c, 0x75, 0x6e, 0x67, 0x58, 0x51, 0x4a, 0x43, 0x34, 0x3d, 0x26, 0x2f, 0x10, 0x19, 0x02, 0x0b, -0xd7, 0xde, 0xc5, 0xcc, 0xf3, 0xfa, 0xe1, 0xe8, 0x9f, 0x96, 0x8d, 0x84, 0xbb, 0xb2, 0xa9, 0xa0, -0x47, 0x4e, 0x55, 0x5c, 0x63, 0x6a, 0x71, 0x78, 0x0f, 0x06, 0x1d, 0x14, 0x2b, 0x22, 0x39, 0x30, -0x9a, 0x93, 0x88, 0x81, 0xbe, 0xb7, 0xac, 0xa5, 0xd2, 0xdb, 0xc0, 0xc9, 0xf6, 0xff, 0xe4, 0xed, -0x0a, 0x03, 0x18, 0x11, 0x2e, 0x27, 0x3c, 0x35, 0x42, 0x4b, 0x50, 0x59, 0x66, 0x6f, 0x74, 0x7d, -0xa1, 0xa8, 0xb3, 0xba, 0x85, 0x8c, 0x97, 0x9e, 0xe9, 0xe0, 0xfb, 0xf2, 0xcd, 0xc4, 0xdf, 0xd6, -0x31, 0x38, 0x23, 0x2a, 0x15, 0x1c, 0x07, 0x0e, 0x79, 0x70, 0x6b, 0x62, 0x5d, 0x54, 0x4f, 0x46}; - -static uchar XtimeB[256] = { -0x00, 0x0b, 0x16, 0x1d, 0x2c, 0x27, 0x3a, 0x31, 0x58, 0x53, 0x4e, 0x45, 0x74, 0x7f, 0x62, 0x69, -0xb0, 0xbb, 0xa6, 0xad, 0x9c, 0x97, 0x8a, 0x81, 0xe8, 0xe3, 0xfe, 0xf5, 0xc4, 0xcf, 0xd2, 0xd9, -0x7b, 0x70, 0x6d, 0x66, 0x57, 0x5c, 0x41, 0x4a, 0x23, 0x28, 0x35, 0x3e, 0x0f, 0x04, 0x19, 0x12, -0xcb, 0xc0, 0xdd, 0xd6, 0xe7, 0xec, 0xf1, 0xfa, 0x93, 0x98, 0x85, 0x8e, 0xbf, 0xb4, 0xa9, 0xa2, -0xf6, 0xfd, 0xe0, 0xeb, 0xda, 0xd1, 0xcc, 0xc7, 0xae, 0xa5, 0xb8, 0xb3, 0x82, 0x89, 0x94, 0x9f, -0x46, 0x4d, 0x50, 0x5b, 0x6a, 0x61, 0x7c, 0x77, 0x1e, 0x15, 0x08, 0x03, 0x32, 0x39, 0x24, 0x2f, -0x8d, 0x86, 0x9b, 0x90, 0xa1, 0xaa, 0xb7, 0xbc, 0xd5, 0xde, 0xc3, 0xc8, 0xf9, 0xf2, 0xef, 0xe4, -0x3d, 0x36, 0x2b, 0x20, 0x11, 0x1a, 0x07, 0x0c, 0x65, 0x6e, 0x73, 0x78, 0x49, 0x42, 0x5f, 0x54, -0xf7, 0xfc, 0xe1, 0xea, 0xdb, 0xd0, 0xcd, 0xc6, 0xaf, 0xa4, 0xb9, 0xb2, 0x83, 0x88, 0x95, 0x9e, -0x47, 0x4c, 0x51, 0x5a, 0x6b, 0x60, 0x7d, 0x76, 0x1f, 0x14, 0x09, 0x02, 0x33, 0x38, 0x25, 0x2e, -0x8c, 0x87, 0x9a, 0x91, 0xa0, 0xab, 0xb6, 0xbd, 0xd4, 0xdf, 0xc2, 0xc9, 0xf8, 0xf3, 0xee, 0xe5, -0x3c, 0x37, 0x2a, 0x21, 0x10, 0x1b, 0x06, 0x0d, 0x64, 0x6f, 0x72, 0x79, 0x48, 0x43, 0x5e, 0x55, -0x01, 0x0a, 0x17, 0x1c, 0x2d, 0x26, 0x3b, 0x30, 0x59, 0x52, 0x4f, 0x44, 0x75, 0x7e, 0x63, 0x68, -0xb1, 0xba, 0xa7, 0xac, 0x9d, 0x96, 0x8b, 0x80, 0xe9, 0xe2, 0xff, 0xf4, 0xc5, 0xce, 0xd3, 0xd8, -0x7a, 0x71, 0x6c, 0x67, 0x56, 0x5d, 0x40, 0x4b, 0x22, 0x29, 0x34, 0x3f, 0x0e, 0x05, 0x18, 0x13, -0xca, 0xc1, 0xdc, 0xd7, 0xe6, 0xed, 0xf0, 0xfb, 0x92, 0x99, 0x84, 0x8f, 0xbe, 0xb5, 0xa8, 0xa3}; - -static uchar XtimeD[256] = { -0x00, 0x0d, 0x1a, 0x17, 0x34, 0x39, 0x2e, 0x23, 0x68, 0x65, 0x72, 0x7f, 0x5c, 0x51, 0x46, 0x4b, -0xd0, 0xdd, 0xca, 0xc7, 0xe4, 0xe9, 0xfe, 0xf3, 0xb8, 0xb5, 0xa2, 0xaf, 0x8c, 0x81, 0x96, 0x9b, -0xbb, 0xb6, 0xa1, 0xac, 0x8f, 0x82, 0x95, 0x98, 0xd3, 0xde, 0xc9, 0xc4, 0xe7, 0xea, 0xfd, 0xf0, -0x6b, 0x66, 0x71, 0x7c, 0x5f, 0x52, 0x45, 0x48, 0x03, 0x0e, 0x19, 0x14, 0x37, 0x3a, 0x2d, 0x20, -0x6d, 0x60, 0x77, 0x7a, 0x59, 0x54, 0x43, 0x4e, 0x05, 0x08, 0x1f, 0x12, 0x31, 0x3c, 0x2b, 0x26, -0xbd, 0xb0, 0xa7, 0xaa, 0x89, 0x84, 0x93, 0x9e, 0xd5, 0xd8, 0xcf, 0xc2, 0xe1, 0xec, 0xfb, 0xf6, -0xd6, 0xdb, 0xcc, 0xc1, 0xe2, 0xef, 0xf8, 0xf5, 0xbe, 0xb3, 0xa4, 0xa9, 0x8a, 0x87, 0x90, 0x9d, -0x06, 0x0b, 0x1c, 0x11, 0x32, 0x3f, 0x28, 0x25, 0x6e, 0x63, 0x74, 0x79, 0x5a, 0x57, 0x40, 0x4d, -0xda, 0xd7, 0xc0, 0xcd, 0xee, 0xe3, 0xf4, 0xf9, 0xb2, 0xbf, 0xa8, 0xa5, 0x86, 0x8b, 0x9c, 0x91, -0x0a, 0x07, 0x10, 0x1d, 0x3e, 0x33, 0x24, 0x29, 0x62, 0x6f, 0x78, 0x75, 0x56, 0x5b, 0x4c, 0x41, -0x61, 0x6c, 0x7b, 0x76, 0x55, 0x58, 0x4f, 0x42, 0x09, 0x04, 0x13, 0x1e, 0x3d, 0x30, 0x27, 0x2a, -0xb1, 0xbc, 0xab, 0xa6, 0x85, 0x88, 0x9f, 0x92, 0xd9, 0xd4, 0xc3, 0xce, 0xed, 0xe0, 0xf7, 0xfa, -0xb7, 0xba, 0xad, 0xa0, 0x83, 0x8e, 0x99, 0x94, 0xdf, 0xd2, 0xc5, 0xc8, 0xeb, 0xe6, 0xf1, 0xfc, -0x67, 0x6a, 0x7d, 0x70, 0x53, 0x5e, 0x49, 0x44, 0x0f, 0x02, 0x15, 0x18, 0x3b, 0x36, 0x21, 0x2c, -0x0c, 0x01, 0x16, 0x1b, 0x38, 0x35, 0x22, 0x2f, 0x64, 0x69, 0x7e, 0x73, 0x50, 0x5d, 0x4a, 0x47, -0xdc, 0xd1, 0xc6, 0xcb, 0xe8, 0xe5, 0xf2, 0xff, 0xb4, 0xb9, 0xae, 0xa3, 0x80, 0x8d, 0x9a, 0x97}; - -static uchar XtimeE[256] = { -0x00, 0x0e, 0x1c, 0x12, 0x38, 0x36, 0x24, 0x2a, 0x70, 0x7e, 0x6c, 0x62, 0x48, 0x46, 0x54, 0x5a, -0xe0, 0xee, 0xfc, 0xf2, 0xd8, 0xd6, 0xc4, 0xca, 0x90, 0x9e, 0x8c, 0x82, 0xa8, 0xa6, 0xb4, 0xba, -0xdb, 0xd5, 0xc7, 0xc9, 0xe3, 0xed, 0xff, 0xf1, 0xab, 0xa5, 0xb7, 0xb9, 0x93, 0x9d, 0x8f, 0x81, -0x3b, 0x35, 0x27, 0x29, 0x03, 0x0d, 0x1f, 0x11, 0x4b, 0x45, 0x57, 0x59, 0x73, 0x7d, 0x6f, 0x61, -0xad, 0xa3, 0xb1, 0xbf, 0x95, 0x9b, 0x89, 0x87, 0xdd, 0xd3, 0xc1, 0xcf, 0xe5, 0xeb, 0xf9, 0xf7, -0x4d, 0x43, 0x51, 0x5f, 0x75, 0x7b, 0x69, 0x67, 0x3d, 0x33, 0x21, 0x2f, 0x05, 0x0b, 0x19, 0x17, -0x76, 0x78, 0x6a, 0x64, 0x4e, 0x40, 0x52, 0x5c, 0x06, 0x08, 0x1a, 0x14, 0x3e, 0x30, 0x22, 0x2c, -0x96, 0x98, 0x8a, 0x84, 0xae, 0xa0, 0xb2, 0xbc, 0xe6, 0xe8, 0xfa, 0xf4, 0xde, 0xd0, 0xc2, 0xcc, -0x41, 0x4f, 0x5d, 0x53, 0x79, 0x77, 0x65, 0x6b, 0x31, 0x3f, 0x2d, 0x23, 0x09, 0x07, 0x15, 0x1b, -0xa1, 0xaf, 0xbd, 0xb3, 0x99, 0x97, 0x85, 0x8b, 0xd1, 0xdf, 0xcd, 0xc3, 0xe9, 0xe7, 0xf5, 0xfb, -0x9a, 0x94, 0x86, 0x88, 0xa2, 0xac, 0xbe, 0xb0, 0xea, 0xe4, 0xf6, 0xf8, 0xd2, 0xdc, 0xce, 0xc0, -0x7a, 0x74, 0x66, 0x68, 0x42, 0x4c, 0x5e, 0x50, 0x0a, 0x04, 0x16, 0x18, 0x32, 0x3c, 0x2e, 0x20, -0xec, 0xe2, 0xf0, 0xfe, 0xd4, 0xda, 0xc8, 0xc6, 0x9c, 0x92, 0x80, 0x8e, 0xa4, 0xaa, 0xb8, 0xb6, -0x0c, 0x02, 0x10, 0x1e, 0x34, 0x3a, 0x28, 0x26, 0x7c, 0x72, 0x60, 0x6e, 0x44, 0x4a, 0x58, 0x56, -0x37, 0x39, 0x2b, 0x25, 0x0f, 0x01, 0x13, 0x1d, 0x47, 0x49, 0x5b, 0x55, 0x7f, 0x71, 0x63, 0x6d, -0xd7, 0xd9, 0xcb, 0xc5, 0xef, 0xe1, 0xf3, 0xfd, 0xa7, 0xa9, 0xbb, 0xb5, 0x9f, 0x91, 0x83, 0x8d}; - -// exchanges columns in each of 4 rows -// row0 - unchanged, row1- shifted left 1, -// row2 - shifted left 2 and row3 - shifted left 3 -static void ShiftRows (uchar *state) -{ -uchar tmp; - - // just substitute row 0 - state[0] = Sbox[state[0]], state[4] = Sbox[state[4]]; - state[8] = Sbox[state[8]], state[12] = Sbox[state[12]]; - - // rotate row 1 - tmp = Sbox[state[1]], state[1] = Sbox[state[5]]; - state[5] = Sbox[state[9]], state[9] = Sbox[state[13]], state[13] = tmp; - - // rotate row 2 - tmp = Sbox[state[2]], state[2] = Sbox[state[10]], state[10] = tmp; - tmp = Sbox[state[6]], state[6] = Sbox[state[14]], state[14] = tmp; - - // rotate row 3 - tmp = Sbox[state[15]], state[15] = Sbox[state[11]]; - state[11] = Sbox[state[7]], state[7] = Sbox[state[3]], state[3] = tmp; -} - -// restores columns in each of 4 rows -// row0 - unchanged, row1- shifted right 1, -// row2 - shifted right 2 and row3 - shifted right 3 -static void InvShiftRows (uchar *state) -{ -uchar tmp; - - // restore row 0 - state[0] = InvSbox[state[0]], state[4] = InvSbox[state[4]]; - state[8] = InvSbox[state[8]], state[12] = InvSbox[state[12]]; - - // restore row 1 - tmp = InvSbox[state[13]], state[13] = InvSbox[state[9]]; - state[9] = InvSbox[state[5]], state[5] = InvSbox[state[1]], state[1] = tmp; - - // restore row 2 - tmp = InvSbox[state[2]], state[2] = InvSbox[state[10]], state[10] = tmp; - tmp = InvSbox[state[6]], state[6] = InvSbox[state[14]], state[14] = tmp; - - // restore row 3 - tmp = InvSbox[state[3]], state[3] = InvSbox[state[7]]; - state[7] = InvSbox[state[11]], state[11] = InvSbox[state[15]], state[15] = tmp; -} - -// recombine and mix each row in a column -static void MixSubColumns (uchar *state) -{ -uchar tmp[4 * Nb]; - - // mixing column 0 - tmp[0] = Xtime2Sbox[state[0]] ^ Xtime3Sbox[state[5]] ^ Sbox[state[10]] ^ Sbox[state[15]]; - tmp[1] = Sbox[state[0]] ^ Xtime2Sbox[state[5]] ^ Xtime3Sbox[state[10]] ^ Sbox[state[15]]; - tmp[2] = Sbox[state[0]] ^ Sbox[state[5]] ^ Xtime2Sbox[state[10]] ^ Xtime3Sbox[state[15]]; - tmp[3] = Xtime3Sbox[state[0]] ^ Sbox[state[5]] ^ Sbox[state[10]] ^ Xtime2Sbox[state[15]]; - - // mixing column 1 - tmp[4] = Xtime2Sbox[state[4]] ^ Xtime3Sbox[state[9]] ^ Sbox[state[14]] ^ Sbox[state[3]]; - tmp[5] = Sbox[state[4]] ^ Xtime2Sbox[state[9]] ^ Xtime3Sbox[state[14]] ^ Sbox[state[3]]; - tmp[6] = Sbox[state[4]] ^ Sbox[state[9]] ^ Xtime2Sbox[state[14]] ^ Xtime3Sbox[state[3]]; - tmp[7] = Xtime3Sbox[state[4]] ^ Sbox[state[9]] ^ Sbox[state[14]] ^ Xtime2Sbox[state[3]]; - - // mixing column 2 - tmp[8] = Xtime2Sbox[state[8]] ^ Xtime3Sbox[state[13]] ^ Sbox[state[2]] ^ Sbox[state[7]]; - tmp[9] = Sbox[state[8]] ^ Xtime2Sbox[state[13]] ^ Xtime3Sbox[state[2]] ^ Sbox[state[7]]; - tmp[10] = Sbox[state[8]] ^ Sbox[state[13]] ^ Xtime2Sbox[state[2]] ^ Xtime3Sbox[state[7]]; - tmp[11] = Xtime3Sbox[state[8]] ^ Sbox[state[13]] ^ Sbox[state[2]] ^ Xtime2Sbox[state[7]]; - - // mixing column 3 - tmp[12] = Xtime2Sbox[state[12]] ^ Xtime3Sbox[state[1]] ^ Sbox[state[6]] ^ Sbox[state[11]]; - tmp[13] = Sbox[state[12]] ^ Xtime2Sbox[state[1]] ^ Xtime3Sbox[state[6]] ^ Sbox[state[11]]; - tmp[14] = Sbox[state[12]] ^ Sbox[state[1]] ^ Xtime2Sbox[state[6]] ^ Xtime3Sbox[state[11]]; - tmp[15] = Xtime3Sbox[state[12]] ^ Sbox[state[1]] ^ Sbox[state[6]] ^ Xtime2Sbox[state[11]]; - - memcpy (state, tmp, sizeof(tmp)); -} - -// restore and un-mix each row in a column -static void InvMixSubColumns (uchar *state) -{ -uchar tmp[4 * Nb]; -int i; - - // restore column 0 - tmp[0] = XtimeE[state[0]] ^ XtimeB[state[1]] ^ XtimeD[state[2]] ^ Xtime9[state[3]]; - tmp[5] = Xtime9[state[0]] ^ XtimeE[state[1]] ^ XtimeB[state[2]] ^ XtimeD[state[3]]; - tmp[10] = XtimeD[state[0]] ^ Xtime9[state[1]] ^ XtimeE[state[2]] ^ XtimeB[state[3]]; - tmp[15] = XtimeB[state[0]] ^ XtimeD[state[1]] ^ Xtime9[state[2]] ^ XtimeE[state[3]]; - - // restore column 1 - tmp[4] = XtimeE[state[4]] ^ XtimeB[state[5]] ^ XtimeD[state[6]] ^ Xtime9[state[7]]; - tmp[9] = Xtime9[state[4]] ^ XtimeE[state[5]] ^ XtimeB[state[6]] ^ XtimeD[state[7]]; - tmp[14] = XtimeD[state[4]] ^ Xtime9[state[5]] ^ XtimeE[state[6]] ^ XtimeB[state[7]]; - tmp[3] = XtimeB[state[4]] ^ XtimeD[state[5]] ^ Xtime9[state[6]] ^ XtimeE[state[7]]; - - // restore column 2 - tmp[8] = XtimeE[state[8]] ^ XtimeB[state[9]] ^ XtimeD[state[10]] ^ Xtime9[state[11]]; - tmp[13] = Xtime9[state[8]] ^ XtimeE[state[9]] ^ XtimeB[state[10]] ^ XtimeD[state[11]]; - tmp[2] = XtimeD[state[8]] ^ Xtime9[state[9]] ^ XtimeE[state[10]] ^ XtimeB[state[11]]; - tmp[7] = XtimeB[state[8]] ^ XtimeD[state[9]] ^ Xtime9[state[10]] ^ XtimeE[state[11]]; - - // restore column 3 - tmp[12] = XtimeE[state[12]] ^ XtimeB[state[13]] ^ XtimeD[state[14]] ^ Xtime9[state[15]]; - tmp[1] = Xtime9[state[12]] ^ XtimeE[state[13]] ^ XtimeB[state[14]] ^ XtimeD[state[15]]; - tmp[6] = XtimeD[state[12]] ^ Xtime9[state[13]] ^ XtimeE[state[14]] ^ XtimeB[state[15]]; - tmp[11] = XtimeB[state[12]] ^ XtimeD[state[13]] ^ Xtime9[state[14]] ^ XtimeE[state[15]]; - - for( i=0; i < 4 * Nb; i++ ) - state[i] = InvSbox[tmp[i]]; -} - -// encrypt/decrypt columns of the key -// n.b. you can replace this with -// byte-wise xor if you wish. - -static void AddRoundKey (unsigned *state, unsigned *key) -{ -int idx; - - for( idx = 0; idx < 4; idx++ ) - state[idx] ^= key[idx]; -} - -static uchar Rcon[11] = { -0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; - -// produce Nb bytes for each round -void ExpandKey (uchar *key, uchar *expkey) -{ -uchar tmp0, tmp1, tmp2, tmp3, tmp4; -unsigned idx; - - memcpy (expkey, key, Nk * 4); - - for( idx = Nk; idx < Nb * (Nr + 1); idx++ ) { - tmp0 = expkey[4*idx - 4]; - tmp1 = expkey[4*idx - 3]; - tmp2 = expkey[4*idx - 2]; - tmp3 = expkey[4*idx - 1]; - if( !(idx % Nk) ) { - tmp4 = tmp3; - tmp3 = Sbox[tmp0]; - tmp0 = Sbox[tmp1] ^ Rcon[idx/Nk]; - tmp1 = Sbox[tmp2]; - tmp2 = Sbox[tmp4]; - } else if( Nk > 6 && idx % Nk == 4 ) { - tmp0 = Sbox[tmp0]; - tmp1 = Sbox[tmp1]; - tmp2 = Sbox[tmp2]; - tmp3 = Sbox[tmp3]; - } - - expkey[4*idx+0] = expkey[4*idx - 4*Nk + 0] ^ tmp0; - expkey[4*idx+1] = expkey[4*idx - 4*Nk + 1] ^ tmp1; - expkey[4*idx+2] = expkey[4*idx - 4*Nk + 2] ^ tmp2; - expkey[4*idx+3] = expkey[4*idx - 4*Nk + 3] ^ tmp3; - } -} - -// encrypt one 128 bit block -void Encrypt (uchar *in, uchar *expkey, uchar *out) -{ -uchar state[Nb * 4]; -unsigned round; - - memcpy (state, in, Nb * 4); - AddRoundKey ((unsigned *)state, (unsigned *)expkey); - - for( round = 1; round < Nr + 1; round++ ) { - if( round < Nr ) - MixSubColumns (state); - else - ShiftRows (state); - - AddRoundKey ((unsigned *)state, (unsigned *)expkey + round * Nb); - } - - memcpy (out, state, sizeof(state)); -} - -void Decrypt (uchar *in, uchar *expkey, uchar *out) -{ -uchar state[Nb * 4]; -unsigned round; - - memcpy (state, in, sizeof(state)); - - AddRoundKey ((unsigned *)state, (unsigned *)expkey + Nr * Nb); - InvShiftRows(state); - - for( round = Nr; round--; ) - { - AddRoundKey ((unsigned *)state, (unsigned *)expkey + round * Nb); - if( round ) - InvMixSubColumns (state); - } - - memcpy (out, state, sizeof(state)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/aes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -// advanced encryption standard -// author: karl malbrain, malbrain@yahoo.com - -/* -This work, including the source code, documentation -and related data, is placed into the public domain. - -The orginal author is Karl Malbrain. - -THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY -OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF -MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, -ASSUMES _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE -RESULTING FROM THE USE, MODIFICATION, OR -REDISTRIBUTION OF THIS SOFTWARE. -*/ - - -#ifndef AES_MALBRAIN -#define AES_MALBRAIN - - -// AES only supports Nb=4 -#define Nb 4 // number of columns in the state & expanded key - -#define Nk 4 // number of columns in a key -#define Nr 10 // number of rounds in encryption - - -typedef unsigned char uchar; - - -void ExpandKey (uchar *key, uchar *expkey); -void Encrypt (uchar *in, uchar *expkey, uchar *out); -void Decrypt (uchar *in, uchar *expkey, uchar *out); - - -#endif /* AES_MALBRAIN */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,655 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle chunked data (multimedia messages) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" -#include "protocol.h" -#include "mxit.h" -#include "chunk.h" -#include "filexfer.h" - - -/*======================================================================================================================== - * Data-Type encoding - */ - -#if 0 -#include -#if (__BYTE_ORDER == __BIG_ENDIAN) -#define SWAP_64(x) (x) -#else -#define SWAP_64(x) bswap_64(x) -#endif -#endif - -/*------------------------------------------------------------------------ - * Encode a single byte in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The byte - * @return The number of bytes added. - */ -static int add_int8( char* chunkdata, char value ) -{ - *chunkdata = value; - - return sizeof( char ); -} - -/*------------------------------------------------------------------------ - * Encode a 16-bit value in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 16-bit value - * @return The number of bytes added. - */ -static int add_int16( char* chunkdata, short value ) -{ - value = htons( value ); /* network byte-order */ - memcpy( chunkdata, &value, sizeof( short ) ); - - return sizeof( short ); -} - -/*------------------------------------------------------------------------ - * Encode a 32-bit value in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 32-bit value - * @return The number of bytes added. - */ -static int add_int32( char* chunkdata, int value ) -{ - value = htonl( value ); /* network byte-order */ - memcpy( chunkdata, &value, sizeof( int ) ); - - return sizeof( int ); -} - -#if 0 -/*------------------------------------------------------------------------ - * Encode a 64-bit value in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 64-bit value - * @return The number of bytes added. - */ -static int add_int64( char* chunkdata, int64_t value ) -{ - value = SWAP_64( value ); /* network byte-order */ - memcpy( chunkdata, &value, sizeof( int64_t ) ); - - return sizeof( int64_t ); -} -#endif - -/*------------------------------------------------------------------------ - * Encode a block of data in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param data The data to add - * @param datalen The length of the data to add - * @return The number of bytes added. - */ -static int add_data( char* chunkdata, const char* data, int datalen ) -{ - memcpy( chunkdata, data, datalen ); - - return datalen; -} - -/*------------------------------------------------------------------------ - * Encode a string as UTF-8 in the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param str The string to encode - * @return The number of bytes in the string - */ -static int add_utf8_string( char* chunkdata, const char* str ) -{ - int pos = 0; - size_t len = strlen( str ); - - /* utf8 string length [2 bytes] */ - pos += add_int16( &chunkdata[pos], len ); - - /* utf8 string */ - pos += add_data( &chunkdata[pos], str, len ); - - return pos; -} - - -/*======================================================================================================================== - * Data-Type decoding - */ - -/*------------------------------------------------------------------------ - * Extract a single byte from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The byte - * @return The number of bytes extracted. - */ -static int get_int8( const char* chunkdata, char* value ) -{ - *value = *chunkdata; - - return sizeof( char ); -} - -/*------------------------------------------------------------------------ - * Extract a 16-bit value from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 16-bit value - * @return The number of bytes extracted - */ -static int get_int16( const char* chunkdata, short* value ) -{ - *value = ntohs( *( (const short*) chunkdata ) ); /* host byte-order */ - - return sizeof( short ); -} - -/*------------------------------------------------------------------------ - * Extract a 32-bit value from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 32-bit value - * @return The number of bytes extracted - */ -static int get_int32( const char* chunkdata, int* value ) -{ - *value = ntohl( *( (const int*) chunkdata ) ); /* host byte-order */ - - return sizeof( int ); -} - -#if 0 -/*------------------------------------------------------------------------ - * Extract a 64-bit value from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param value The 64-bit value - * @return The number of bytes extracted - */ -static int get_int64( const char* chunkdata, int64_t* value ) -{ - *value = SWAP_64( *( (const int64_t*) chunkdata ) ); /* host byte-order */ - - return sizeof( int64_t ); -} -#endif - -/*------------------------------------------------------------------------ - * Copy a block of data from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param dest Where to store the extract data - * @param datalen The length of the data to extract - * @return The number of bytes extracted - */ -static int get_data( const char* chunkdata, char* dest, int datalen ) -{ - memcpy( dest, chunkdata, datalen ); - - return datalen; -} - -/*------------------------------------------------------------------------ - * Extract a UTF-8 encoded string from the chunked data. - * - * @param chunkdata The chunked-data buffer - * @param str A pointer to extracted string. Must be g_free()'d. - * @return The number of bytes consumed - */ -static int get_utf8_string( const char* chunkdata, char* str, int maxstrlen ) -{ - int pos = 0; - short len; - int skip = 0; - - /* string length [2 bytes] */ - pos += get_int16( &chunkdata[pos], &len ); - - if ( len > maxstrlen ) { - /* possible buffer overflow */ - purple_debug_error( MXIT_PLUGIN_ID, "Buffer overflow detected (get_utf8_string)\n" ); - skip = len - maxstrlen; - len = maxstrlen; - } - - /* string data */ - pos += get_data( &chunkdata[pos], str, len ); - str[len] = '\0'; /* terminate string */ - - return pos + skip; -} - - -/*======================================================================================================================== - * Chunked Data encoding - */ - -/*------------------------------------------------------------------------ - * Encode a "reject file" chunk. (Chunk type 7) - * - * @param chunkdata Chunked-data buffer - * @param fileid A unique ID that identifies this file - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_reject( char* chunkdata, const char* fileid ) -{ - int pos = 0; - - /* file id [8 bytes] */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* rejection reason [1 byte] */ - pos += add_int8( &chunkdata[pos], REJECT_BY_USER ); - - /* rejection description [UTF-8 (optional)] */ - pos += add_utf8_string( &chunkdata[pos], "" ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "get file" request chunk. (Chunk type 8) - * - * @param chunkdata Chunked-data buffer - * @param fileid A unique ID that identifies this file - * @param filesize The number of bytes to retrieve - * @param offset The start offset in the file - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_get( char* chunkdata, const char* fileid, int filesize, int offset ) -{ - int pos = 0; - - /* file id [8 bytes] */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* offset [4 bytes] */ - pos += add_int32( &chunkdata[pos], offset ); - - /* length [4 bytes] */ - pos += add_int32( &chunkdata[pos], filesize ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "received file" chunk. (Chunk type 9) - * - * @param chunkdata Chunked-data buffer - * @param fileid A unique ID that identifies this file - * @param status The status of the file transfer (see chunk.h) - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status ) -{ - int pos = 0; - - /* file id [8 bytes] */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* status [1 byte] */ - pos += add_int8( &chunkdata[pos], status ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "send file direct" chunk. (Chunk type 10) - * - * @param chunkdata Chunked-data buffer - * @param username The username of the recipient - * @param filename The name of the file being sent - * @param data The file contents - * @param datalen The size of the file contents - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen ) -{ - int pos = 0; - const char* mime = NULL; - - /* data length [4 bytes] */ - pos += add_int32( &chunkdata[pos], datalen ); - - /* number of username(s) [2 bytes] */ - pos += add_int16( &chunkdata[pos], 1 ); - - /* username(s) [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], username ); - - /* filename [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], filename ); - - /* file mime type [UTF-8] */ - mime = file_mime_type( filename, (const char*) data, datalen ); - pos += add_utf8_string( &chunkdata[pos], mime ); - - /* human readable description [UTF-8 (optional)] */ - pos += add_utf8_string( &chunkdata[pos], "" ); - - /* crc [4 bytes] (0 = optional) */ - pos += add_int32( &chunkdata[pos], 0 ); - - /* the actual file data */ - pos += add_data( &chunkdata[pos], (const char *) data, datalen ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "set avatar" chunk. (Chunk type 13) - * - * @param chunkdata Chunked-data buffer - * @param data The avatar data - * @param datalen The size of the avatar data - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen ) -{ - const char fileid[MXIT_CHUNK_FILEID_LEN]; - int pos = 0; - - /* id [8 bytes] */ - memset( &fileid, 0, sizeof( fileid ) ); /* set to 0 for file upload */ - pos += add_data( &chunkdata[pos], fileid, MXIT_CHUNK_FILEID_LEN ); - - /* size [4 bytes] */ - pos += add_int32( &chunkdata[pos], datalen ); - - /* crc [4 bytes] (0 = optional) */ - pos += add_int32( &chunkdata[pos], 0 ); - - /* the actual file data */ - pos += add_data( &chunkdata[pos], (const char *) data, datalen ); - - return pos; -} - - -/*------------------------------------------------------------------------ - * Encode a "get avatar" chunk. (Chunk type 14) - * - * @param chunkdata Chunked-data buffer - * @param mxitId The username who's avatar to download - * @param avatarId The Id of the avatar image (as string) - * @param imgsize The resolution of the avatar image - * @return The number of bytes encoded in the buffer - */ -int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId, unsigned int imgsize ) -{ - int pos = 0; - - /* number of avatars [4 bytes] */ - pos += add_int32( &chunkdata[pos], 1 ); - - /* username [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], mxitId ); - - /* avatar id [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], avatarId ); - - /* avatar format [UTF-8] */ - pos += add_utf8_string( &chunkdata[pos], MXIT_AVATAR_TYPE ); - - /* avatar bit depth [1 byte] */ - pos += add_int8( &chunkdata[pos], MXIT_AVATAR_BITDEPT ); - - /* number of sizes [2 bytes] */ - pos += add_int16( &chunkdata[pos], 1 ); - - /* image size [4 bytes] */ - pos += add_int32( &chunkdata[pos], imgsize ); - - return pos; -} - - -/*======================================================================================================================== - * Chunked Data decoding - */ - -/*------------------------------------------------------------------------ - * Parse a received "offer file" chunk. (Chunk 6) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param offer Decoded offerfile information - */ -void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer ) -{ - int pos = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_offer (%i bytes)\n", datalen ); - - /* id [8 bytes] */ - pos += get_data( &chunkdata[pos], offer->fileid, 8); - - /* from username [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], offer->username, sizeof( offer->username ) ); - mxit_strip_domain( offer->username ); - - /* file size [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(offer->filesize) ); - - /* filename [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], offer->filename, sizeof( offer->filename) ); - - /* mime type [UTF-8] */ - /* not used by libPurple */ - - /* timestamp [8 bytes] */ - /* not used by libPurple */ - - /* file description [UTF-8] */ - /* not used by libPurple */ - - /* file alternative [UTF-8] */ - /* not used by libPurple */ - - /* flags [4 bytes] */ - /* not used by libPurple */ -} - - -/*------------------------------------------------------------------------ - * Parse a received "get file" response chunk. (Chunk 8) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param offer Decoded getfile information - */ -void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile ) -{ - int pos = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_file (%i bytes)\n", datalen ); - - /* id [8 bytes] */ - pos += get_data( &chunkdata[pos], getfile->fileid, 8 ); - - /* offset [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(getfile->offset) ); - - /* file length [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(getfile->length) ); - - /* crc [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(getfile->crc) ); - - /* file data */ - getfile->data = &chunkdata[pos]; -} - - -/*------------------------------------------------------------------------ - * Parse a received splash screen chunk. (Chunk 2) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param splash Decoded splash image information - */ -static void mxit_chunk_parse_splash( char* chunkdata, int datalen, struct splash_chunk* splash ) -{ - int pos = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_splash (%i bytes)\n", datalen ); - - /* anchor [1 byte] */ - pos += get_int8( &chunkdata[pos], &(splash->anchor) ); - - /* time to show [1 byte] */ - pos += get_int8( &chunkdata[pos], &(splash->showtime) ); - - /* background color [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(splash->bgcolor) ); - - /* file data */ - splash->data = &chunkdata[pos]; - - /* data length */ - splash->datalen = datalen - pos; -} - - -/*------------------------------------------------------------------------ - * Parse a received "custom resource" chunk. (Chunk 1) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param offer Decoded custom resource - */ -void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr ) -{ - int pos = 0; - int chunklen = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_cr (%i bytes)\n", datalen ); - - /* id [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], cr->id, sizeof( cr->id ) ); - - /* handle [UTF-8] */ - pos += get_utf8_string( &chunkdata[pos], cr->handle, sizeof( cr->handle ) ); - - /* operation [1 byte] */ - pos += get_int8( &chunkdata[pos], &(cr->operation) ); - - /* chunk size [4 bytes] */ - pos += get_int32( &chunkdata[pos], &chunklen ); - - /* parse the resource chunks */ - while ( chunklen > 0 ) { - gchar* chunk = &chunkdata[pos]; - - /* start of chunk data */ - pos += MXIT_CHUNK_HEADER_SIZE; - - switch ( chunk_type( chunk ) ) { - case CP_CHUNK_SPLASH : /* splash image */ - { - struct splash_chunk* splash = g_new0( struct splash_chunk, 1 ); - - mxit_chunk_parse_splash( &chunkdata[pos], chunk_length( chunk ), splash ); - - cr->resources = g_list_append( cr->resources, splash ); - break; - } - case CP_CHUNK_CLICK : /* splash click */ - { - struct splash_click_chunk* click = g_new0( struct splash_click_chunk, 1 ); - - cr->resources = g_list_append( cr->resources, click ); - break; - } - default: - purple_debug_info( MXIT_PLUGIN_ID, "Unsupported custom resource chunk received (%i)\n", chunk_type( chunk) ); - } - - /* skip over data to next resource chunk */ - pos += chunk_length( chunk ); - chunklen -= ( MXIT_CHUNK_HEADER_SIZE + chunk_length( chunk ) ); - } -} - - -/*------------------------------------------------------------------------ - * Parse a received "get avatar" response chunk. (Chunk 14) - * - * @param chunkdata Chunked data buffer - * @param datalen The length of the chunked data - * @param avatar Decoded avatar information - */ -void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar ) -{ - int pos = 0; - int numfiles = 0; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_chunk_parse_get_avatar (%i bytes)\n", datalen ); - - /* number of files [4 bytes] */ - pos += get_int32( &chunkdata[pos], &numfiles ); - - if ( numfiles < 1 ) /* no data */ - return; - - /* mxitId [UTF-8 string] */ - pos += get_utf8_string( &chunkdata[pos], avatar->mxitid, sizeof( avatar->mxitid ) ); - - /* avatar id [UTF-8 string] */ - pos += get_utf8_string( &chunkdata[pos], avatar->avatarid, sizeof( avatar->avatarid ) ); - - /* format [UTF-8 string] */ - pos += get_utf8_string( &chunkdata[pos], avatar->format, sizeof( avatar->format ) ); - - /* bit depth [1 byte] */ - pos += get_int8( &chunkdata[pos], &(avatar->bitdepth) ); - - /* crc [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->crc) ); - - /* width [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->width) ); - - /* height [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->height) ); - - /* file length [4 bytes] */ - pos += get_int32( &chunkdata[pos], &(avatar->length) ); - - /* file data */ - avatar->data = &chunkdata[pos]; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/chunk.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- handle chunked data (multimedia messages) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_CHUNK_H_ -#define _MXIT_CHUNK_H_ - - -#include "roster.h" - - -#define MXIT_CHUNK_FILEID_LEN 8 /* bytes */ -#define MXIT_CHUNK_HEADER_SIZE 5 /* type (1 byte) + length (4 bytes) */ - - -/* Multimedia chunk types */ -#define CP_CHUNK_NONE 0x00 /* (0) no chunk */ -#define CP_CHUNK_CUSTOM 0x01 /* (1) custom resource */ -#define CP_CHUNK_SPLASH 0x02 /* (2) splash image */ -#define CP_CHUNK_CLICK 0x03 /* (3) splash click through */ -#define CP_CHUNK_OFFER 0x06 /* (6) offer file */ -#define CP_CHUNK_REJECT 0x07 /* (7) reject file */ -#define CP_CHUNK_GET 0x08 /* (8) get file */ -#define CP_CHUNK_RECIEVED 0x09 /* (9) received file */ -#define CP_CHUNK_DIRECT_SND 0x0A /* (10) send file direct */ -#define CP_CHUNK_DIRECT_FWD 0x0B /* (11) forward file direct */ -#define CP_CHUNK_SKIN 0x0C /* (12) MXit client skin */ -#define CP_CHUNK_SET_AVATAR 0x0D /* (13) set avatar */ -#define CP_CHUNK_GET_AVATAR 0x0E /* (14) get avatar */ -#define CP_CHUNK_END 0x7E /* (126) end */ -#define CP_CHUNK_EXT 0x7F /* (127) extended type */ - - -/* Custom Resource operations */ -#define CR_OP_UPDATE 0 -#define CR_OP_REMOVE 1 - -/* File Received status */ -#define RECV_STATUS_SUCCESS 0 -#define RECV_STATUS_PARSE_FAIL 1 -#define RECV_STATUS_CANNOT_OPEN 8 -#define RECV_STATUS_BAD_CRC 9 -#define RECV_STATUS_BAD_ID 10 - -/* File Reject status */ -#define REJECT_BY_USER 1 -#define REJECT_FILETYPE 2 -#define REJECT_NO_RESOURCES 3 -#define REJECT_BAD_RECIPIENT 4 - -/* - * Chunk header manipulation functions - */ -static inline guint chunk_type( gchar* chunkheader ) -{ - return *chunkheader; -} - -static inline void set_chunk_type( gchar* chunkheader, guint type ) -{ - *chunkheader = type; -} - -static inline guint32 chunk_length( gchar* chunkheader ) -{ - guint32 length = *( (const guint32*) &chunkheader[1] ); - return htonl( length ); -} - -static inline void set_chunk_length( gchar* chunkheader, guint32 size ) -{ - size = htonl( size ); - memcpy( &chunkheader[1], &size, sizeof( guint32 ) ); -} - -static inline gchar* chunk_data( gchar* chunkheader ) -{ - return &chunkheader[MXIT_CHUNK_HEADER_SIZE]; -} - - -struct offerfile_chunk { - char fileid[MXIT_CHUNK_FILEID_LEN]; - char username[MXIT_CP_MAX_JID_LEN + 1]; - int filesize; - char filename[FILENAME_MAX]; -}; - -struct getfile_chunk { - char fileid[MXIT_CHUNK_FILEID_LEN]; - int offset; - int length; - int crc; - char* data; -}; - -struct cr_chunk { - char id[64]; - char handle[64]; - char operation; - GList* resources; -}; - -struct splash_chunk { - char anchor; - char showtime; - int bgcolor; - char* data; - int datalen; -}; - -struct splash_click_chunk { - char reserved[1]; -}; - -struct getavatar_chunk { - char mxitid[50]; - char avatarid[64]; - char format[16]; - char bitdepth; - int crc; - int width; - int height; - int length; - char* data; -}; - -/* Encode chunk */ -int mxit_chunk_create_senddirect( char* chunkdata, const char* username, const char* filename, const unsigned char* data, int datalen ); -int mxit_chunk_create_reject( char* chunkdata, const char* fileid ); -int mxit_chunk_create_get( char* chunkdata, const char* fileid, int filesize, int offset ); -int mxit_chunk_create_received( char* chunkdata, const char* fileid, unsigned char status ); -int mxit_chunk_create_set_avatar( char* chunkdata, const unsigned char* data, int datalen ); -int mxit_chunk_create_get_avatar( char* chunkdata, const char* mxitId, const char* avatarId, unsigned int imgsize ); - -/* Decode chunk */ -void mxit_chunk_parse_offer( char* chunkdata, int datalen, struct offerfile_chunk* offer ); -void mxit_chunk_parse_get( char* chunkdata, int datalen, struct getfile_chunk* getfile ); -void mxit_chunk_parse_cr( char* chunkdata, int datalen, struct cr_chunk* cr ); -void mxit_chunk_parse_get_avatar( char* chunkdata, int datalen, struct getavatar_chunk* avatar ); - -#endif /* _MXIT_CHUNK_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user password encryption -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "mxit.h" -#include "cipher.h" -#include "aes.h" - - -/* password encryption */ -#define INITIAL_KEY "6170383452343567" -#define SECRET_HEADER "" - - -/*------------------------------------------------------------------------ - * Pad the secret data using ISO10126 Padding. - * - * @param secret The data to pad (caller must ensure buffer has enough space for padding) - * @return The total number of 128-bit blocks used - */ -static int pad_secret_data( char* secret ) -{ - int blocks = 0; - int passlen; - int padding; - - passlen = strlen( secret ); - blocks = ( passlen / 16 ) + 1; - padding = ( blocks * 16 ) - passlen; - secret[passlen] = 0x50; - secret[(blocks * 16) - 1] = padding; - - return blocks; -} - - -/*------------------------------------------------------------------------ - * Encrypt the user's cleartext password using the AES 128-bit (ECB) - * encryption algorithm. - * - * @param session The MXit session object - * @return The encrypted & encoded password. Must be g_free'd when no longer needed. - */ -char* mxit_encrypt_password( struct MXitSession* session ) -{ - char key[64]; - char exkey[512]; - char pass[64]; - char encrypted[64]; - char* base64; - int blocks; - int size; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_encrypt_password\n" ); - - memset( encrypted, 0x00, sizeof( encrypted ) ); - memset( exkey, 0x00, sizeof( exkey ) ); - memset( pass, 0x58, sizeof( pass ) ); - pass[sizeof( pass ) - 1] = '\0'; - - /* build the custom AES encryption key */ - strcpy( key, INITIAL_KEY ); - memcpy( key, session->clientkey, strlen( session->clientkey ) ); - ExpandKey( (unsigned char*) key, (unsigned char*) exkey ); - - /* build the custom data to be encrypted */ - strcpy( pass, SECRET_HEADER ); - strcat( pass, session->acc->password ); - - /* pad the secret data */ - blocks = pad_secret_data( pass ); - size = blocks * 16; - - /* now encrypt the password. we encrypt each block separately (ECB mode) */ - for ( i = 0; i < size; i += 16 ) - Encrypt( (unsigned char*) pass + i, (unsigned char*) exkey, (unsigned char*) encrypted + i ); - - /* now base64 encode the encrypted password */ - base64 = purple_base64_encode( (unsigned char*) encrypted, size ); - - return base64; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/cipher.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user password encryption -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_CIPHER_H_ -#define _MXIT_CIPHER_H_ - - -struct MXitSession; - - -char* mxit_encrypt_password( struct MXitSession* session ); - - -#endif /* _MXIT_CIPHER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,451 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- file transfers (sending and receiving) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" -#include "protocol.h" -#include "mxit.h" -#include "chunk.h" -#include "filexfer.h" - - -#define MIME_TYPE_OCTETSTREAM "application/octet-stream" - - -/* supported file mime types */ -static struct mime_type { - const char* magic; - const short magic_len; - const char* mime; -} const mime_types[] = { - /* magic length mime */ - /* images */ { "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A", 8, "image/png" }, /* image png */ - { "\xFF\xD8", 2, "image/jpeg" }, /* image jpeg */ - { "\x3C\x3F\x78\x6D\x6C", 5, "image/svg+xml" }, /* image SVGansi */ - { "\xEF\xBB\xBF", 3, "image/svg+xml" }, /* image SVGutf */ - { "\xEF\xBB\xBF", 3, "image/svg+xml" }, /* image SVGZ */ - /* mxit */ { "\x4d\x58\x4d", 3, "application/mxit-msgs" }, /* mxit message */ - { "\x4d\x58\x44\x01", 4, "application/mxit-mood" }, /* mxit mood */ - { "\x4d\x58\x45\x01", 4, "application/mxit-emo" }, /* mxit emoticon */ - { "\x4d\x58\x46\x01", 4, "application/mxit-emof" }, /* mxit emoticon frame */ - { "\x4d\x58\x53\x01", 4, "application/mxit-skin" }, /* mxit skin */ - /* audio */ { "\x4d\x54\x68\x64", 4, "audio/midi" }, /* audio midi */ - { "\x52\x49\x46\x46", 4, "audio/wav" }, /* audio wav */ - { "\xFF\xF1", 2, "audio/aac" }, /* audio aac1 */ - { "\xFF\xF9", 2, "audio/aac" }, /* audio aac2 */ - { "\xFF", 1, "audio/mp3" }, /* audio mp3 */ - { "\x23\x21\x41\x4D\x52\x0A", 6, "audio/amr" }, /* audio AMR */ - { "\x23\x21\x41\x4D\x52\x2D\x57\x42", 8, "audio/amr-wb" }, /* audio AMR WB */ - { "\x00\x00\x00", 3, "audio/mp4" }, /* audio mp4 */ - { "\x2E\x73\x6E\x64", 4, "audio/au" } /* audio AU */ -}; - - -/*------------------------------------------------------------------------ - * Return the MIME type matching the data file. - * - * @param filename The name of file - * @param buf The data - * @param buflen The length of the data - * @return A MIME type string - */ -const char* file_mime_type( const char* filename, const char* buf, int buflen ) -{ - unsigned int i; - - /* check for matching magic headers */ - for ( i = 0; i < ARRAY_SIZE( mime_types ); i++ ) { - - if ( buflen < mime_types[i].magic_len ) /* data is shorter than size of magic */ - continue; - - if ( memcmp( buf, mime_types[i].magic, mime_types[i].magic_len ) == 0 ) - return mime_types[i].mime; - } - - /* we did not find the MIME type, so return the default (application/octet-stream) */ - return MIME_TYPE_OCTETSTREAM; -} - - -/*------------------------------------------------------------------------ - * Cleanup and deallocate a MXit file transfer object - * - * @param xfer The file transfer object - */ -static void mxit_xfer_free( PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data;; - - if ( mx ) { - g_free( mx ); - xfer->data = NULL; - } -} - - -/*======================================================================================================================== - * File Transfer callbacks - */ - -/*------------------------------------------------------------------------ - * Initialise a new file transfer. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_init( PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_init\n" ); - - if ( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) { - /* we are trying to send a file to MXit */ - - if ( purple_xfer_get_size( xfer ) > CP_MAX_FILESIZE ) { - /* the file is too big */ - purple_xfer_error( xfer->type, xfer->account, xfer->who, _( "The file you are trying to send is too large!" ) ); - purple_xfer_cancel_local( xfer ); - return; - } - - /* start the file transfer */ - purple_xfer_start( xfer, -1, NULL, 0 ); - } - else { - /* - * we have just accepted a file transfer request from MXit. send a confirmation - * to the MXit server so that can send us the file - */ - mxit_send_file_accept( mx->session, mx->fileid, purple_xfer_get_size( xfer ), 0 ); - } -} - - -/*------------------------------------------------------------------------ - * Start the file transfer. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_start( PurpleXfer* xfer ) -{ - unsigned char* buffer; - int size; - int wrote; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_start\n" ); - - if ( purple_xfer_get_type( xfer ) == PURPLE_XFER_SEND ) { - /* - * the user wants to send a file to one of his contacts. we need to create - * a buffer and copy the file data into memory and then we can send it to - * the contact. we will send the whole file with one go. - */ - buffer = g_malloc( xfer->bytes_remaining ); - size = fread( buffer, xfer->bytes_remaining, 1, xfer->dest_fp ); - - wrote = purple_xfer_write( xfer, buffer, xfer->bytes_remaining ); - if ( wrote > 0 ) - purple_xfer_set_bytes_sent( xfer, wrote ); - - /* free the buffer */ - g_free( buffer ); - buffer = NULL; - } -} - - -/*------------------------------------------------------------------------ - * The file transfer has ended. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_end( PurpleXfer* xfer ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_end\n" ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*------------------------------------------------------------------------ - * The file transfer (to a user) has been cancelled. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_cancel_send( PurpleXfer* xfer ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_cancel_send\n" ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*------------------------------------------------------------------------ - * Send the file data. - * - * @param buffer The data to sent - * @param size The length of the data to send - * @param xfer The file transfer object - * @return The amount of data actually sent - */ -static gssize mxit_xfer_write( const guchar* buffer, size_t size, PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_write\n" ); - - if ( !mx ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_xfer_write: invalid internal mxit xfer data\n" ); - return -1; - } - else if ( purple_xfer_get_type( xfer ) != PURPLE_XFER_SEND ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_xfer_write: wrong xfer type received\n" ); - return -1; - } - - /* create and send the packet to MXit */ - mxit_send_file( mx->session, purple_xfer_get_remote_user( xfer ), purple_xfer_get_filename( xfer ), buffer, size ); - - /* the transfer is complete */ - purple_xfer_set_completed( xfer, TRUE ); - - return size; -} - - -/*------------------------------------------------------------------------ - * The user has rejected a file offer from MXit. - * - * @param xfer The file transfer object - */ -static void mxit_xfer_request_denied( PurpleXfer* xfer ) -{ - struct mxitxfer* mx = (struct mxitxfer*) xfer->data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_request_denied\n" ); - - /* send file reject packet to MXit server */ - mxit_send_file_reject( mx->session, mx->fileid ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*------------------------------------------------------------------------ - * The file transfer (from MXit) has been cancelled. - */ -static void mxit_xfer_cancel_recv( PurpleXfer* xfer ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_cancel_recv\n" ); - - /* deallocate object */ - mxit_xfer_free( xfer ); -} - - -/*======================================================================================================================== - * Callbacks from libPurple - */ - -/*------------------------------------------------------------------------ - * Indicate if file transfers are supported to this contact. - * For MXit file transfers are always supported. - * - * @param gc The connection object - * @param who The username of the contact - * @return TRUE if file transfers are supported - */ -gboolean mxit_xfer_enabled( PurpleConnection* gc, const char* who ) -{ - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Create and initialize a new file transfer to a contact. - * - * @param gc The connection object - * @param who The username of the recipient - */ -PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; - - /* (reference: "libpurple/ft.h") */ - xfer = purple_xfer_new( session->acc, PURPLE_XFER_SEND, who ); - - /* create file info and attach it to the file transfer */ - mx = g_new0( struct mxitxfer, 1 ); - mx->session = session; - xfer->data = mx; - - /* configure callbacks (reference: "libpurple/ft.h") */ - purple_xfer_set_init_fnc( xfer, mxit_xfer_init ); - purple_xfer_set_start_fnc( xfer, mxit_xfer_start ); - purple_xfer_set_end_fnc( xfer, mxit_xfer_end ); - purple_xfer_set_cancel_send_fnc( xfer, mxit_xfer_cancel_send ); - purple_xfer_set_write_fnc( xfer, mxit_xfer_write ); - - return xfer; -} - - -/*------------------------------------------------------------------------ - * The user has initiated a file transfer to a contact. - * - * @param gc The connection object - * @param who The username of the contact - * @param filename The filename (is NULL if request has not been accepted yet) - */ -void mxit_xfer_tx( PurpleConnection* gc, const char* who, const char* filename ) -{ - PurpleXfer *xfer = mxit_xfer_new( gc, who ); - - if ( filename ) - purple_xfer_request_accepted( xfer, filename ); - else - purple_xfer_request( xfer ); -} - - -/*======================================================================================================================== - * Calls from the MXit Protocol layer - */ - -/*------------------------------------------------------------------------ - * A file transfer offer has been received from the MXit server. - * - * @param session The MXit session object - * @param usermame The username of the sender - * @param filename The name of the file being offered - * @param filesize The size of the file being offered - * @param fileid A unique ID that identifies this file - */ -void mxit_xfer_rx_offer( struct MXitSession* session, const char* username, const char* filename, int filesize, const char* fileid ) -{ - PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "File Offer: file=%s, from=%s, size=%i\n", filename, username, filesize ); - - xfer = purple_xfer_new( session->acc, PURPLE_XFER_RECEIVE, username ); - if ( xfer ) { - /* create a new mxit xfer struct for internal use */ - mx = g_new0( struct mxitxfer, 1 ); - mx->session = session; - memcpy( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ); - xfer->data = mx; - - purple_xfer_set_filename( xfer, filename ); - if( filesize > 0 ) - purple_xfer_set_size( xfer, filesize ); - - /* register file transfer callback functions */ - purple_xfer_set_init_fnc( xfer, mxit_xfer_init ); - purple_xfer_set_request_denied_fnc( xfer, mxit_xfer_request_denied ); - purple_xfer_set_cancel_recv_fnc( xfer, mxit_xfer_cancel_recv ); - purple_xfer_set_end_fnc( xfer, mxit_xfer_end ); - - /* give the request to the user to accept/deny */ - purple_xfer_request( xfer ); - } -} - - -/*------------------------------------------------------------------------ - * Return the libPurple file-transfer object associated with a MXit transfer - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - */ -static PurpleXfer* find_mxit_xfer( struct MXitSession* session, const char* fileid ) -{ - GList* item = NULL; - PurpleXfer* xfer = NULL; - - item = purple_xfers_get_all(); /* list of all active transfers */ - while ( item ) { - xfer = item->data; - - if ( xfer->account == session->acc ) { - /* transfer is associated with this MXit account */ - struct mxitxfer* mx = xfer->data; - - /* does the fileid match? */ - if ( ( mx ) && ( memcmp( mx->fileid, fileid, MXIT_CHUNK_FILEID_LEN ) == 0 ) ) - break; - } - - item = g_list_next( item ); - } - - if ( item ) - return item->data; - else - return NULL; -} - -/*------------------------------------------------------------------------ - * A file has been received from the MXit server. - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - * @param data The file data - * @param datalen The size of the data - */ -void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const char* data, int datalen ) -{ - PurpleXfer* xfer = NULL; - struct mxitxfer* mx = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_xfer_rx_file: (size=%i)\n", datalen ); - - /* find the file-transfer object */ - xfer = find_mxit_xfer( session, fileid ); - if ( xfer ) { - mx = xfer->data; - - /* this is the transfer we have been looking for */ - purple_xfer_ref( xfer ); - purple_xfer_start( xfer, -1, NULL, 0 ); - fwrite( data, datalen, 1, xfer->dest_fp ); - purple_xfer_unref( xfer ); - purple_xfer_set_completed( xfer, TRUE ); - purple_xfer_end( xfer ); - - /* inform MXit that file was successfully received */ - mxit_send_file_received( session, fileid, RECV_STATUS_SUCCESS ); - } - else { - /* file transfer not found */ - mxit_send_file_received( session, fileid, RECV_STATUS_BAD_ID ); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/filexfer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- file transfers (sending and receiving) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_FILEXFER_H_ -#define _MXIT_FILEXFER_H_ - - -/* - * a MXit file transfer - */ -struct mxitxfer { - struct MXitSession* session; - char fileid[MXIT_CHUNK_FILEID_LEN]; -}; - -const char* file_mime_type( const char* filename, const char* buf, int buflen ); - -/* libPurple callbacks */ -gboolean mxit_xfer_enabled( PurpleConnection* gc, const char* who ); -void mxit_xfer_tx( PurpleConnection* gc, const char* who, const char* filename ); -PurpleXfer* mxit_xfer_new( PurpleConnection* gc, const char* who ); - -/* MXit Protocol callbacks */ -void mxit_xfer_rx_offer( struct MXitSession* session, const char* username, const char* filename, int filesize, const char* fileid ); -void mxit_xfer_rx_file( struct MXitSession* session, const char* fileid, const char* data, int datalen ); - - -#endif /* _MXIT_FILEXFER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,394 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit Forms & Commands -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#include "internal.h" -#include - -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "markup.h" -#include "formcmds.h" - -#undef MXIT_DEBUG_COMMANDS - -/* - * the MXit Command identifiers - */ -typedef enum -{ - MXIT_CMD_UNKNOWN = 0, /* Unknown command */ - MXIT_CMD_CLRSCR, /* Clear screen (clrmsgscreen) */ - MXIT_CMD_SENDSMS, /* Send SMS (sendsms) */ - MXIT_CMD_REPLY, /* Reply (reply) */ - MXIT_CMD_PLATREQ, /* Platform Request (platreq) */ - MXIT_CMD_SELECTCONTACT, /* Select Contact (selc) */ - MXIT_CMD_IMAGE /* Inline image (img) */ -} MXitCommandType; - - -/* - * object for an inline image request with an URL - */ -struct ii_url_request -{ - struct RXMsgData* mx; - char* url; -}; - - -/*------------------------------------------------------------------------ - * Callback function invoked when an inline image request to a web site completes. - * - * @param url_data - * @param user_data The Markup message object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void mxit_cb_ii_returned(PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message) -{ - struct ii_url_request* iireq = (struct ii_url_request*) user_data; - char* ii_data; - int* intptr = NULL; - int id; - -#ifdef MXIT_DEBUG_COMMANDS - purple_debug_info(MXIT_PLUGIN_ID, "Inline Image returned from %s\n", iireq->url); -#endif - - if (!url_text) { - /* no reply from the WAP site */ - purple_debug_error(MXIT_PLUGIN_ID, "Error downloading Inline Image from %s.\n", iireq->url); - goto done; - } - - /* lets first see if we dont have the inline image already in cache */ - if (g_hash_table_lookup(iireq->mx->session->iimages, iireq->url)) { - /* inline image found in the cache, so we just ignore this reply */ - goto done; - } - - /* make a copy of the data */ - ii_data = g_malloc(len); - memcpy(ii_data, (const char*) url_text, len); - - /* we now have the inline image, store it in the imagestore */ - id = purple_imgstore_add_with_id(ii_data, len, NULL); - - /* map the inline image id to purple image id */ - intptr = g_malloc(sizeof(int)); - *intptr = id; - g_hash_table_insert(iireq->mx->session->iimages, iireq->url, intptr); - - iireq->mx->flags |= PURPLE_MESSAGE_IMAGES; - -done: - iireq->mx->img_count--; - if ((iireq->mx->img_count == 0) && (iireq->mx->converted)) { - /* - * this was the last outstanding emoticon for this message, - * so we can now display it to the user. - */ - mxit_show_message(iireq->mx); - } - - g_free(iireq); -} - - -/*------------------------------------------------------------------------ - * Return the command identifier of this MXit Command. - * - * @param cmd The MXit command map - * @return The MXit command identifier - */ -static MXitCommandType command_type(GHashTable* hash) -{ - char* op; - char* type; - - op = g_hash_table_lookup(hash, "op"); - if (op) { - if ( strcmp(op, "cmd") == 0 ) { - type = g_hash_table_lookup(hash, "type"); - if (type == NULL) /* no command provided */ - return MXIT_CMD_UNKNOWN; - else if (strcmp(type, "clrmsgscreen") == 0) /* clear the screen */ - return MXIT_CMD_CLRSCR; - else if (strcmp(type, "sendsms") == 0) /* send an SMS */ - return MXIT_CMD_SENDSMS; - else if (strcmp(type, "reply") == 0) /* list of options */ - return MXIT_CMD_REPLY; - else if (strcmp(type, "platreq") == 0) /* platform request */ - return MXIT_CMD_PLATREQ; - else if (strcmp(type, "selc") == 0) /* select contact */ - return MXIT_CMD_SELECTCONTACT; - } - else if (strcmp(op, "img") == 0) - return MXIT_CMD_IMAGE; - } - - return MXIT_CMD_UNKNOWN; -} - - -/*------------------------------------------------------------------------ - * Tokenize a MXit Command string into a map. - * - * @param cmd The MXit command string - * @return The hash-map, or NULL on error. - */ -static GHashTable* command_tokenize(char* cmd) -{ - GHashTable* hash = NULL; - gchar** parts; - gchar* part; - int i = 0; - -#ifdef MXIT_DEBUG_COMMANDS - purple_debug_info(MXIT_PLUGIN_ID, "command: '%s'\n", cmd); -#endif - - /* explode the command into parts */ - parts = g_strsplit(cmd, "|", 0); - - hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - - /* now break part into a key & value */ - while ((part = parts[i]) != NULL) { - char* value; - - value = strchr(parts[i], '='); /* find start of value */ - if (value != NULL) { - *value = '\0'; - value++; - } - -#ifdef MXIT_DEBUG_COMMANDS - purple_debug_info(MXIT_PLUGIN_ID, " key='%s' value='%s'\n", parts[i], value); -#endif - - g_hash_table_insert(hash, g_strdup(parts[i]), g_strdup(value)); - - i++; - } - - g_strfreev(parts); - - return hash; -} - - -/*------------------------------------------------------------------------ - * Process a ClearScreen MXit command. - * - * @param session The MXit session object - * @param from The sender of the message. - */ -static void command_clearscreen(struct MXitSession* session, const char* from) -{ - PurpleConversation *conv; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, session->acc); - if (conv == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, _( "Conversation with '%s' not found\n" ), from); - return; - } - - purple_conversation_clear_message_history(conv); // TODO: This doesn't actually clear the screen. -} - - -/*------------------------------------------------------------------------ - * Process a Reply MXit command. - * - * @param mx The received message data object - * @param hash The MXit command map - */ -static void command_reply(struct RXMsgData* mx, GHashTable* hash) -{ - char* replymsg; - char* selmsg; - - selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */ - replymsg = g_hash_table_lookup(hash, "replymsg"); /* find the reply message */ - if ((selmsg) && (replymsg)) { - gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1); - - mxit_add_html_link( mx, purple_url_decode(replymsg), seltext ); - - g_free(seltext); - } -} - - -/*------------------------------------------------------------------------ - * Process a PlatformRequest MXit command. - * - * @param hash The MXit command map - * @param msg The message to display (as generated so far) - */ -static void command_platformreq(GHashTable* hash, GString* msg) -{ - gchar* text = NULL; - char* selmsg; - char* dest; - - selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */ - if (selmsg) { - text = g_markup_escape_text(purple_url_decode(selmsg), -1); - } - - dest = g_hash_table_lookup(hash, "dest"); /* find the destination */ - if (dest) { - g_string_append_printf(msg, "%s", purple_url_decode(dest), (text) ? text : _( "Download" )); /* add link to display message */ - } - - if (text) - g_free(text); -} - - -/*------------------------------------------------------------------------ - * Process an inline image MXit command. - * - * @param mx The received message data object - * @param hash The MXit command map - * @param msg The message to display (as generated so far) - */ -static void command_image(struct RXMsgData* mx, GHashTable* hash, GString* msg) -{ - const char* img; - const char* reply; - guchar* rawimg; - char link[256]; - gsize rawimglen; - int imgid; - - img = g_hash_table_lookup(hash, "dat"); - if (img) { - rawimg = purple_base64_decode(img, &rawimglen); - //purple_util_write_data_to_file_absolute("/tmp/mxitinline.png", (char*) rawimg, rawimglen); - imgid = purple_imgstore_add_with_id(rawimg, rawimglen, NULL); - g_snprintf(link, sizeof(link), "", imgid); - g_string_append_printf(msg, "%s", link); - mx->flags |= PURPLE_MESSAGE_IMAGES; - } - else { - img = g_hash_table_lookup(hash, "src"); - if (img) { - struct ii_url_request* iireq; - - iireq = g_new0(struct ii_url_request,1); - iireq->url = g_strdup(purple_url_decode(img)); - iireq->mx = mx; - - g_string_append_printf(msg, "%s%s>", MXIT_II_TAG, iireq->url); - mx->got_img = TRUE; - - /* lets first see if we dont have the inline image already in cache */ - if (g_hash_table_lookup(mx->session->iimages, iireq->url)) { - /* inline image found in the cache, so we do not have to request it from the web */ - g_free(iireq); - } - else { - /* send the request for the inline image */ - purple_debug_info(MXIT_PLUGIN_ID, "sending request for inline image '%s'\n", iireq->url); - - /* request the image (reference: "libpurple/util.h") */ - purple_util_fetch_url_request(iireq->url, TRUE, NULL, TRUE, NULL, FALSE, mxit_cb_ii_returned, iireq); - mx->img_count++; - } - } - } - - /* if this is a clickable image, show a click link */ - reply = g_hash_table_lookup(hash, "replymsg"); - if (reply) { - g_string_append_printf(msg, "\n"); - mxit_add_html_link(mx, reply, _( "click here" )); - } -} - - -/*------------------------------------------------------------------------ - * Process a received MXit Command message. - * - * @param mx The received message data object - * @param message The message text - * @return The length of the command - */ -int mxit_parse_command(struct RXMsgData* mx, char* message) -{ - GHashTable* hash = NULL; - char* start; - char* end; - - /* ensure that this is really a command */ - if ( ( message[0] != ':' ) || ( message[1] != ':' ) ) { - /* this is not a command */ - return 0; - } - - start = message + 2; - end = strstr(start, ":"); - if (end) { - /* end of a command found */ - *end = '\0'; /* terminate command string */ - - hash = command_tokenize(start); /* break into pairs */ - if (hash) { - MXitCommandType type = command_type(hash); - - switch (type) { - case MXIT_CMD_CLRSCR : - command_clearscreen(mx->session, mx->from); - break; - case MXIT_CMD_REPLY : - command_reply(mx, hash); - break; - case MXIT_CMD_PLATREQ : - command_platformreq(hash, mx->msg); - break; - case MXIT_CMD_IMAGE : - command_image(mx, hash, mx->msg); - break; - default : - /* command unknown, or not currently supported */ - break; - } - g_hash_table_destroy(hash); - } - *end = ':'; - - return end - message; - } - else { - return 0; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/formcmds.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit Forms & Commands -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_FORMCMDS_H_ -#define _MXIT_FORMCMDS_H_ - -#include "mxit.h" - - -int mxit_parse_command(struct RXMsgData* mx, char* message); - - -#endif /* _MXIT_FORMCMDS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,327 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "mxit.h" -#include "protocol.h" -#include "http.h" - - -/* HTTP constants */ -#define HTTP_11_200_OK "HTTP/1.1 200 OK\r\n" -#define HTTP_11_100_CONT "HTTP/1.1 100 Continue\r\n" -#define HTTP_11_SEPERATOR "\r\n\r\n" -#define HTTP_CONTENT_LEN "Content-Length: " - - -/* define to enable HTTP debugging */ -#define DEBUG_HTTP - - -/*------------------------------------------------------------------------ - * This will freeup the memory used by a HTTP request structure - * - * @param req The HTTP structure's resources should be freed up - */ -static void free_http_request( struct http_request* req ) -{ - g_free( req->host ); - g_free( req->data ); - g_free( req ); -} - - -/*------------------------------------------------------------------------ - * Write the request to the HTTP server. - * - * @param fd The file descriptor - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static int mxit_http_raw_write( int fd, const char* pktdata, int pktlen ) -{ - int written; - int res; - - written = 0; - while ( written < pktlen ) { - res = write( fd, &pktdata[written], pktlen - written ); - if ( res <= 0 ) { - /* error on socket */ - if ( errno == EAGAIN ) - continue; - - purple_debug_error( MXIT_PLUGIN_ID, "Error while writing packet to HTTP server (%i)\n", res ); - return -1; - } - written += res; - } - - return 0; -} - - -/*------------------------------------------------------------------------ - * Callback when data is received from the HTTP server. - * - * @param user_data The MXit session object - * @param source The file-descriptor on which data was received - * @param cond Condition which caused the callback (PURPLE_INPUT_READ) - */ -static void mxit_cb_http_read( gpointer user_data, gint source, PurpleInputCondition cond ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - char buf[256]; - int buflen; - char* body; - int bodylen; - char* ch; - int len; - char* tmp; - int res; - char* next; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_read\n" ); - - if ( session->rx_state == RX_STATE_RLEN ) { - /* we are reading in the HTTP headers */ - - /* copy partial headers if we have any part saved */ - memcpy( buf, session->rx_dbuf, session->rx_i ); - buflen = session->rx_i; - - /* read bytes from the socket */ - len = read( session->fd, buf + buflen, sizeof( buf ) - buflen ); - if ( len <= 0 ) { - /* connection has been terminated, or error occured */ - goto done; - } - -//nextpacket: - -#ifdef DEBUG_HTTP - purple_debug_info( MXIT_PLUGIN_ID, "HTTP POST READ 1: (%i)\n", len ); - dump_bytes( session, buf + buflen, len ); -#endif - - /* see if we have all the HTTP headers yet */ - ch = strstr( buf, HTTP_11_SEPERATOR ); - if ( !ch ) { - /* we need to wait for more input, so save what we have */ - session->rx_i = buflen + len; - memcpy( session->rx_dbuf, buf, session->rx_i ); - return; - } - buflen += len; - - /* we have the header's end now skip over the http seperator to get the body offset */ - ch += strlen( HTTP_11_SEPERATOR ); - *(ch - 1) = '\0'; - body = ch; - - res = buflen - ( ch - buf ); - if ( res > 0 ) { - /* we read more bytes than just the header so copy it over */ - memcpy( session->rx_dbuf, ch, res ); - session->rx_i = res; - } - else { - session->rx_i = 0; - } - - /* test for a good response */ - if ( ( strncmp( buf, HTTP_11_200_OK, strlen( HTTP_11_200_OK ) ) != 0 ) && ( strncmp( buf, HTTP_11_100_CONT, strlen( HTTP_11_100_CONT ) ) != 0 ) ) { - /* bad result */ - purple_debug_error( MXIT_PLUGIN_ID, "HTTP error: %s\n", ch ); - goto done; - } - - /* find the content-length */ - ch = (char*) purple_strcasestr( buf, HTTP_CONTENT_LEN ); - if ( !ch ) { - /* bad request. it does not contain a content-length header */ - purple_debug_error( MXIT_PLUGIN_ID, "HTTP reply received without content-length header (ignoring packet)\n" ); - goto done; - } - - /* parse the content-length */ - ch += strlen( HTTP_CONTENT_LEN ); - tmp = strchr( ch, '\r' ); - if ( !tmp ) { - purple_debug_error( MXIT_PLUGIN_ID, "Received bad HTTP reply packet (ignoring packet)\n" ); - goto done; - } - tmp = g_strndup( ch, tmp - ch ); - bodylen = atoi( tmp ); - g_free( tmp ); - tmp = NULL; - - if ( buflen > ( ( body - buf ) + bodylen ) ) { - /* we have a second packet here */ - next = body + bodylen; - session->rx_res = 0; - } - else { - session->rx_res = bodylen - session->rx_i; - } - - if ( session->rx_res == 0 ) { - /* we have read all the data */ - session->rx_i = bodylen; - session->rx_state = RX_STATE_PROC; - } - else { - /* there is still some data outstanding */ - session->rx_state = RX_STATE_DATA; - } - } - else if ( session->rx_state == RX_STATE_DATA ) { - /* we are reading the HTTP content (body) */ - - /* read bytes from the socket */ - len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); - if ( len <= 0 ) { - /* connection has been terminated, or error occured */ - goto done; - } - -#ifdef DEBUG_HTTP - purple_debug_info( MXIT_PLUGIN_ID, "HTTP POST READ 2: (%i)\n", len ); - dump_bytes( session, &session->rx_dbuf[session->rx_i], len ); -#endif - session->rx_i += len; - session->rx_res -= len; - - if ( session->rx_res == 0 ) { - /* ok, so now we have read in the whole packet */ - session->rx_state = RX_STATE_PROC; - } - } - - if ( session->rx_state == RX_STATE_PROC ) { - mxit_parse_packet( session ); - -#if 0 - if ( next ) { - /* there is another packet of which we read some data */ - - /* reset input */ - session->rx_state = RX_STATE_RLEN; - session->rx_lbuf[0] = '\0'; - session->rx_i = 0; - session->rx_res = 0; - - /* move read data */ - len = next - buf; - buflen = len; - memcpy( buf, next, len ); - goto nextpacket; - } -#endif - - /* we are done */ - goto done; - } - - return; -done: - close( session->fd ); - purple_input_remove( session->http_handler ); - session->http_handler = 0; -} - - -/*------------------------------------------------------------------------ - * Callback invoked once the connection has been established to the HTTP server, - * or on connection failure. - * - * @param user_data The MXit session object - * @param source The file-descriptor associated with the connection - * @param error_message Message explaining why the connection failed - */ -static void mxit_cb_http_connect( gpointer user_data, gint source, const gchar* error_message ) -{ - struct http_request* req = (struct http_request*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect\n" ); - - /* source is the file descriptor of the new connection */ - if ( source < 0 ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_http_connect failed: %s\n", error_message ); - purple_connection_error( req->session->con, _( "Unable to connect to the MXit HTTP server. Please check your server settings." ) ); - return; - } - - /* we now have an open and active TCP connection to the mxit server */ - req->session->fd = source; - - /* reset the receive buffer */ - req->session->rx_state = RX_STATE_RLEN; - req->session->rx_lbuf[0] = '\0'; - req->session->rx_i = 0; - req->session->rx_res = 0; - - /* start listening on the open connection for messages from the server (reference: "libpurple/eventloop.h") */ - req->session->http_handler = purple_input_add( req->session->fd, PURPLE_INPUT_READ, mxit_cb_http_read, req->session ); - - /* actually send the request to the HTTP server */ - mxit_http_raw_write( req->session->fd, req->data, req->datalen ); - - /* free up resources */ - free_http_request( req ); - req = NULL; -} - - -/*------------------------------------------------------------------------ - * Create HTTP connection for sending a HTTP request - * - * @param session The MXit session object - * @param host The server name to connect to - * @param port The port number to connect to - * @param data The HTTP request data (including HTTP headers etc.) - * @param datalen The HTTP request data length - */ -void mxit_http_send_request( struct MXitSession* session, char* host, int port, const char* data, int datalen ) -{ - PurpleProxyConnectData* con = NULL; - struct http_request* req; - - /* build the http request */ - req = g_new0( struct http_request, 1 ); - req->session = session; - req->host = host; - req->port = port; - req->data = g_malloc0( datalen ); - memcpy( req->data, data, datalen ); - req->datalen = datalen; - - /* open connection to the HTTP server */ - con = purple_proxy_connect( NULL, session->acc, host, port, mxit_cb_http_connect, req ); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/http.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - - -#ifndef _MXIT_HTTP_H_ -#define _MXIT_HTTP_H_ - - - -struct http_request -{ - struct MXitSession* session; - char* host; - int port; - char* data; - int datalen; -}; - - -void mxit_http_send_request( struct MXitSession* session, char* host, int port, const char* data, int datalen ); - - - -#endif /* _MXIT_HTTP_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,786 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit user login functionality -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "cipher.h" -#include "login.h" -#include "profile.h" - -/* requesting captcha size */ -#define MXIT_CAPTCHA_HEIGHT 50 -#define MXIT_CAPTCHA_WIDTH 150 - - -/* prototypes */ -static void mxit_register_view( struct MXitSession* session ); -static void get_clientinfo( struct MXitSession* session ); - - -/*------------------------------------------------------------------------ - * Create a new mxit session object - * - * @return The MXit session object - */ -static struct MXitSession* mxit_create_object( PurpleAccount* account ) -{ - struct MXitSession* session = NULL; - PurpleConnection* con = NULL; - - /* currently the wapsite does not handle a '+' in front of the username (mxitid) so we just strip it */ - if ( account->username[0] == '+' ) { - char* fixed; - - /* cut off the '+' */ - fixed = g_strdup( &account->username[1] ); - purple_account_set_username( account, fixed ); - g_free( fixed ); - } - - session = g_new0( struct MXitSession, 1 ); - - /* configure the connection (reference: "libpurple/connection.h") */ - con = purple_account_get_connection( account ); - con->proto_data = session; - con->flags |= PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_HTML; - session->con = con; - - /* add account */ - session->acc = account; - - /* configure the session (reference: "libpurple/account.h") */ - g_strlcpy( session->server, purple_account_get_string( account, MXIT_CONFIG_SERVER_ADDR, DEFAULT_SERVER ), sizeof( session->server ) ); - g_strlcpy( session->http_server, purple_account_get_string( account, MXIT_CONFIG_HTTPSERVER, DEFAULT_HTTP_SERVER ), sizeof( session->http_server ) ); - session->port = purple_account_get_int( account, MXIT_CONFIG_SERVER_PORT, DEFAULT_PORT ); - g_strlcpy( session->distcode, purple_account_get_string( account, MXIT_CONFIG_DISTCODE, "" ), sizeof( session->distcode ) ); - g_strlcpy( session->clientkey, purple_account_get_string( account, MXIT_CONFIG_CLIENTKEY, "" ), sizeof( session->clientkey ) ); - g_strlcpy( session->dialcode, purple_account_get_string( account, MXIT_CONFIG_DIALCODE, "" ), sizeof( session->dialcode ) ); - session->http = purple_account_get_bool( account, MXIT_CONFIG_USE_HTTP, FALSE ); - session->iimages = g_hash_table_new( g_str_hash, g_str_equal ); - session->rx_state = RX_STATE_RLEN; - session->http_interval = MXIT_HTTP_POLL_MIN; - session->http_last_poll = time( NULL ); - - return session; -} - - -/*------------------------------------------------------------------------ - * We now have a connection established with MXit, so we can start the - * login procedure - * - * @param session The MXit session object - */ -static void mxit_connected( struct MXitSession* session ) -{ - int state; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_connected\n" ); - - session->flags |= MXIT_FLAG_CONNECTED; - purple_connection_update_progress( session->con, _( "Logging In..." ), 2, 4 ); - - /* create a timer to send a ping packet if the connection is idle */ - session->last_tx = time( NULL ); - - /* encrypt the user password */ - session->encpwd = mxit_encrypt_password( session ); - - state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - if ( state == MXIT_STATE_LOGIN ) { - /* create and send login packet */ - mxit_send_login( session ); - } - else { - if ( !session->profile ) { - /* we have lost the session profile, so ask the user to enter it again */ - mxit_register_view( session ); - } - else { - /* create and send the register packet */ - mxit_send_register( session ); - } - } - - /* enable signals */ - mxit_enable_signals( session ); - -#ifdef MXIT_LINK_CLICK - /* register for uri click notification */ - mxit_register_uri_handler(); -#endif - - /* start the polling if this is a HTTP connection */ - if ( session->http ) { - session->http_timer_id = purple_timeout_add_seconds( 2, mxit_manage_polling, session ); - } - - /* This timer might already exist if we're registering a new account */ - if ( session->q_timer == 0 ) - /* start the tx queue manager timer */ - session->q_timer = purple_timeout_add_seconds( 2, mxit_manage_queue, session ); -} - - -/*------------------------------------------------------------------------ - * Callback invoked once the connection has been established to the MXit server, - * or on connection failure. - * - * @param user_data The MXit session object - * @param source The file-descriptor associated with the connection - * @param error_message Message explaining why the connection failed - */ -static void mxit_cb_connect( gpointer user_data, gint source, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect\n" ); - - /* source is the file descriptor of the new connection */ - if ( source < 0 ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_connect failed: %s\n", error_message ); - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); - return; - } - - /* we now have an open and active TCP connection to the mxit server */ - session->fd = source; - - /* start listening on the open connection for messages from the server (reference: "libpurple/eventloop.h") */ - session->con->inpa = purple_input_add( session->fd, PURPLE_INPUT_READ, mxit_cb_rx, session ); - - mxit_connected( session ); -} - - -/*------------------------------------------------------------------------ - * Attempt to establish a connection to the MXit server. - * - * @param session The MXit session object - */ -static void mxit_login_connect( struct MXitSession* session ) -{ - PurpleProxyConnectData* data = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_login_connect\n" ); - - purple_connection_update_progress( session->con, _( "Connecting..." ), 1, 4 ); - - /* - * at this stage we have all the user's information we require - * for logging into MXit. we will now create a new connection to - * a MXit server. - */ - - if ( !session->http ) { - /* socket connection */ - data = purple_proxy_connect( session->con, session->acc, session->server, session->port, mxit_cb_connect, session ); - if ( !data ) { - purple_connection_error( session->con, _( "Unable to connect to the MXit server. Please check your server settings." ) ); - return; - } - } - else { - /* http connection */ - mxit_connected( session ); - } -} - - -/*------------------------------------------------------------------------ - * Register a new account with MXit - * - * @param gc The connection object - * @param fields This is the fields filled-in by the user - */ -static void mxit_cb_register_ok( PurpleConnection *gc, PurpleRequestFields *fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct MXitProfile* profile = session->profile; - const char* str; - const char* pin; - const char* err = NULL; - int len; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_ok\n" ); - - if ( !PURPLE_CONNECTION_IS_VALID( gc ) ) { - purple_debug_error( MXIT_PLUGIN_ID, "Unable to register; account offline.\n" ); - return; - } - - /* nickname */ - str = purple_request_fields_get_string( fields, "nickname" ); - if ( ( !str ) || ( strlen( str ) < 3 ) ) { - err = _( "The nick name you entered is invalid." ); - goto out; - } - g_strlcpy( profile->nickname, str, sizeof( profile->nickname ) ); - - /* birthdate */ - str = purple_request_fields_get_string( fields, "bday" ); - if ( ( !str ) || ( strlen( str ) < 10 ) || ( !validateDate( str ) ) ) { - err = _( "The birthday you entered is invalid. The correct format is: 'YYYY-MM-DD'." ); - goto out; - } - g_strlcpy( profile->birthday, str, sizeof( profile->birthday ) ); - - /* gender */ - profile->male = ( purple_request_fields_get_choice( fields, "male" ) != 0 ); - - /* pin */ - pin = purple_request_fields_get_string( fields, "pin" ); - if ( !pin ) { - err = _( "The PIN you entered is invalid." ); - goto out; - } - len = strlen( pin ); - if ( ( len < 7 ) || ( len > 10 ) ) { - err = _( "The PIN you entered has an invalid length [7-10]." ); - goto out; - } - for ( i = 0; i < len; i++ ) { - if ( !g_ascii_isdigit( pin[i] ) ) { - err = _( "The PIN is invalid. It should only consist of digits [0-9]." ); - goto out; - } - } - str = purple_request_fields_get_string( fields, "pin2" ); - if ( ( !str ) || ( strcmp( pin, str ) != 0 ) ) { - err = _( "The two PINs you entered do not match." ); - goto out; - } - g_strlcpy( profile->pin, pin, sizeof( profile->pin ) ); - -out: - if ( !err ) { - purple_account_set_password( session->acc, session->profile->pin ); - mxit_login_connect( session ); - } - else { - /* show error to user */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Registration Error" ), err ); - mxit_register_view( session ); - } -} - - -/*------------------------------------------------------------------------ - * Register a new account with MXit - * - * @param gc The connection object - * @param fields This is the fields filled-in by the user - */ -static void mxit_cb_register_cancel( PurpleConnection *gc, PurpleRequestFields *fields ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_register_cancel\n" ); - - /* disconnect */ - purple_account_disconnect( gc->account ); -} - - -/*------------------------------------------------------------------------ - * Show a window to the user so that he can enter his information - * - * @param session The MXit session object - */ -static void mxit_register_view( struct MXitSession* session ) -{ - struct MXitProfile* profile; - PurpleRequestFields* fields; - PurpleRequestFieldGroup* group; - PurpleRequestField* field; - - if ( !session->profile ) { - /* we need to create a profile object here */ - session->profile = g_new0( struct MXitProfile, 1 ); - } - profile = session->profile; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* mxit login name */ - field = purple_request_field_string_new( "loginname", _( "MXit Login Name" ), purple_account_get_username( session->acc ), FALSE ); - purple_request_field_string_set_editable( field, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* nick name */ - field = purple_request_field_string_new( "nickname", _( "Nick Name" ), profile->nickname, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* birthday */ - field = purple_request_field_string_new( "bday", _( "Birthday" ), profile->birthday, FALSE ); - purple_request_field_string_set_default_value( field, "YYYY-MM-DD" ); - purple_request_field_group_add_field( group, field ); - - /* gender */ - field = purple_request_field_choice_new( "male", _( "Gender" ), ( profile->male ) ? 1 : 0 ); - purple_request_field_choice_add( field, _( "Female" ) ); /* 0 */ - purple_request_field_choice_add( field, _( "Male" ) ); /* 1 */ - purple_request_field_group_add_field( group, field ); - - /* pin */ - field = purple_request_field_string_new( "pin", _( "PIN" ), profile->pin, FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - field = purple_request_field_string_new( "pin2", _( "Verify PIN" ), "", FALSE ); - purple_request_field_string_set_masked( field, TRUE ); - purple_request_field_group_add_field( group, field ); - - /* show the form to the user to complete */ - purple_request_fields( session->con, _( "Register New MXit Account" ), _( "Register New MXit Account" ), _( "Please fill in the following fields:" ), fields, _( "OK" ), G_CALLBACK( mxit_cb_register_ok ), _( "Cancel" ), G_CALLBACK( mxit_cb_register_cancel ), session->acc, NULL, NULL, session->con ); -} - - -/*------------------------------------------------------------------------ - * Callback function invoked once the Authorization information has been submitted - * to the MXit WAP site. - * - * @param url_data libPurple internal object (see purple_util_fetch_url_request) - * @param user_data The MXit session object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void mxit_cb_clientinfo2( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - gchar** parts; - gchar** host; - int state; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_clientinfo_cb2\n" ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP RESPONSE: '%s'\n", url_text ); -#endif - - if ( !url_text ) { - /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); - return; - } - - /* explode the response from the WAP site into an array */ - parts = g_strsplit( url_text, ";", 15 ); - - if ( !parts ) { - /* wapserver error */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); - return; - } - - /* check wapsite return code */ - switch ( parts[0][0] ) { - case '0' : - /* valid reply! */ - break; - case '1' : - purple_connection_error( session->con, _( "Wrong security code entered. Please try again later." ) ); - return; - case '2' : - purple_connection_error( session->con, _( "Your session has expired. Please try again later." ) ); - return; - case '5' : - purple_connection_error( session->con, _( "Invalid country selected. Please try again." ) ); - return; - case '6' : - purple_connection_error( session->con, _( "Username is not registered. Please register first." ) ); - return; - case '7' : - purple_connection_error( session->con, _( "Username is already registered. Please choose another username." ) ); - /* this user's account already exists, so we need to change the registration login flag to be login */ - purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - return; - case '3' : - case '4' : - default : - purple_connection_error( session->con, _( "Internal error. Please try again later." ) ); - return; - } - - /* now parse and split the distribution code and the client key */ - g_strlcpy( session->distcode, &parts[1][2], 36 + 1 ); - g_strlcpy( session->clientkey, &parts[1][38], 8 + 1 ); - - /* get the dial code for the client */ - g_strlcpy( session->dialcode, parts[4], sizeof( session->dialcode ) ); - - /* parse the proxy server address and port number */ - host = g_strsplit( parts[2], ":", 4 ); - g_strlcpy( session->server, &host[1][2], sizeof( session->server ) ); - session->port = atoi( &host[2][0] ); - - /* parse the http proxy server address and port number */ - g_strlcpy( session->http_server, parts[3], sizeof( session->http_server ) ); - - purple_debug_info( MXIT_PLUGIN_ID, "distcode='%s', clientkey='%s', dialcode='%s'\n", session->distcode, session->clientkey, session->dialcode ); - purple_debug_info( MXIT_PLUGIN_ID, "sock_server='%s', http_server='%s', port='%i', cc='%s'\n", session->server, session->http_server, session->port, parts[11] ); - - /* save the information (reference: "libpurple/account.h") */ - purple_account_set_string( session->acc, MXIT_CONFIG_DISTCODE, session->distcode ); - purple_account_set_string( session->acc, MXIT_CONFIG_CLIENTKEY, session->clientkey ); - purple_account_set_string( session->acc, MXIT_CONFIG_DIALCODE, session->dialcode ); - purple_account_set_string( session->acc, MXIT_CONFIG_SERVER_ADDR, session->server ); - purple_account_set_int( session->acc, MXIT_CONFIG_SERVER_PORT, session->port ); - purple_account_set_string( session->acc, MXIT_CONFIG_HTTPSERVER, session->http_server ); - - /* update the state */ - state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - if ( state == MXIT_STATE_REGISTER1 ) - purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_REGISTER2 ); - - /* freeup the memory */ - g_strfreev( host ); - g_strfreev( parts ); - - if ( state == MXIT_STATE_LOGIN ) { - /* now we can continue with the login process */ - mxit_login_connect( session ); - } - else { - /* the user is registering so we need to get more information from him/her first to complete the process */ - mxit_register_view( session ); - } -} - - -/*------------------------------------------------------------------------ - * Free up the data associated with the Authorization process. - * - * @param data The data object to free - */ -static void free_logindata( struct login_data* data ) -{ - if ( !data ) - return; - - /* free up the login resources */ - g_free( data->wapserver ); - g_free( data->sessionid ); - g_free( data->captcha ); - g_free( data->cc ); - g_free( data->locale ); - g_free( data ); -} - - -/*------------------------------------------------------------------------ - * This function is called when the user accepts the Authorization form. - * - * @param gc The connection object - * @param fields The list of fields in the accepted form - */ -static void mxit_cb_captcha_ok( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleUtilFetchUrlData* url_data; - PurpleRequestField* field; - const char* captcha_resp; - GList* entries; - GList* entry; - char* url; - int state; - - /* get the captcha response */ - captcha_resp = purple_request_fields_get_string( fields, "code" ); - if ( ( captcha_resp == NULL ) || ( captcha_resp[0] == '\0' ) ) { - /* the user did not fill in the captcha */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Error" ), _( "You did not enter the security code" ) ); - free_logindata( session->logindata ); - purple_account_disconnect( session->acc ); - return; - } - - /* get chosen country */ - field = purple_request_fields_get_field( fields, "country" ); - entries = purple_request_field_list_get_selected( field ); - entry = g_list_first( entries ); - session->logindata->cc = purple_request_field_list_get_data( field, entry->data ); - purple_account_set_string( session->acc, MXIT_CONFIG_COUNTRYCODE, session->logindata->cc ); - - /* get chosen language */ - field = purple_request_fields_get_field( fields, "locale" ); - entries = purple_request_field_list_get_selected( field ); - entry = g_list_first( entries ); - session->logindata->locale = purple_request_field_list_get_data( field, entry->data ); - purple_account_set_string( session->acc, MXIT_CONFIG_LOCALE, session->logindata->locale ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "cc='%s', locale='%s', captcha='%s'\n", session->logindata->cc, session->logindata->locale, captcha_resp ); -#endif - - /* get state */ - state = purple_account_get_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - - url = g_strdup_printf( "%s?type=getpid&sessionid=%s&login=%s&ver=%s&clientid=%s&cat=%s&chalresp=%s&cc=%s&loc=%s&path=%i&brand=%s&model=%s&h=%i&w=%i&ts=%li", - session->logindata->wapserver, session->logindata->sessionid, purple_url_encode( session->acc->username ), MXIT_CP_RELEASE, MXIT_CLIENT_ID, MXIT_CP_ARCH, - captcha_resp, session->logindata->cc, session->logindata->locale, ( state == MXIT_STATE_REGISTER1 ) ? 0 : 1, MXIT_CP_PLATFORM, MXIT_CP_OS, - MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo2, session ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); -#endif - g_free( url ); - - /* free up the login resources */ - free_logindata( session->logindata ); -} - - -/*------------------------------------------------------------------------ - * This function is called when the user cancels the Authorization form. - * - * @param gc The connection object - * @param fields The list of fields in the cancelled form - */ -static void mxit_cb_captcha_cancel( PurpleConnection* gc, PurpleRequestFields* fields ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - /* free up the login resources */ - free_logindata( session->logindata ); - - /* we cannot continue, so we disconnect this account */ - purple_account_disconnect( session->acc ); -} - - -/*------------------------------------------------------------------------ - * Callback function invoked once the client information has been retrieved from - * the MXit WAP site. Display page where user can select their authorization information. - * - * @param url_data libPurple internal object (see purple_util_fetch_url_request) - * @param user_data The MXit session object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void mxit_cb_clientinfo1( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - struct login_data* logindata; - PurpleRequestFields* fields; - PurpleRequestFieldGroup* group = NULL; - PurpleRequestField* field = NULL; - gchar** parts; - gchar** countries; - gchar** locales; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_clientinfo_cb1\n" ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "RESPONSE: %s\n", url_text ); -#endif - - if ( !url_text ) { - /* no reply from the WAP site */ - purple_connection_error( session->con, _( "Error contacting the MXit WAP site. Please try again later." ) ); - return; - } - - /* explode the response from the WAP site into an array */ - parts = g_strsplit( url_text, ";", 15 ); - - if ( ( !parts ) || ( parts[0][0] != '0' ) ) { - /* server could not find the user */ - purple_connection_error( session->con, _( "MXit is currently unable to process the request. Please try again later." ) ); - return; - } - - /* save received settings */ - logindata = g_new0( struct login_data, 1 ); - logindata->wapserver = g_strdup( parts[1] ); - logindata->sessionid = g_strdup( parts[2] ); - session->logindata = logindata; - - /* now generate the popup requesting the user for action */ - - fields = purple_request_fields_new(); - group = purple_request_field_group_new( NULL ); - purple_request_fields_add_group( fields, group ); - - /* add the captcha */ - logindata->captcha = purple_base64_decode( parts[3], &logindata->captcha_size ); - field = purple_request_field_image_new( "capcha", _( "Security Code" ), (gchar*) logindata->captcha, logindata->captcha_size ); - purple_request_field_group_add_field( group, field ); - - /* ask for input */ - field = purple_request_field_string_new( "code", _( "Enter Security Code" ), NULL, FALSE ); - purple_request_field_group_add_field( group, field ); - - /* choose your country, but be careful, we already know your IP! ;-) */ - countries = g_strsplit( parts[4], ",", 500 ); - field = purple_request_field_list_new( "country", _( "Your Country" ) ); - purple_request_field_list_set_multi_select( field, FALSE ); - for ( i = 0; countries[i]; i++ ) { - gchar** country; - - country = g_strsplit( countries[i], "|", 2 ); - if ( !country ) { - /* oops, this is not good, time to bail */ - break; - } - purple_request_field_list_add( field, country[1], g_strdup( country[0] ) ); - if ( strcmp( country[1], parts[6] ) == 0 ) { - /* based on the user's ip, this is his current country code, so we default to it */ - purple_request_field_list_add_selected( field, country[1] ); - } - g_strfreev( country ); - } - purple_request_field_group_add_field( group, field ); - - /* choose your language */ - locales = g_strsplit( parts[5], ",", 200 ); - field = purple_request_field_list_new( "locale", _( "Your Language" ) ); - purple_request_field_list_set_multi_select( field, FALSE ); - for ( i = 0; locales[i]; i++ ) { - gchar** locale; - - locale = g_strsplit( locales[i], "|", 2 ); - if ( !locale ) { - /* oops, this is not good, time to bail */ - break; - } - purple_request_field_list_add( field, locale[1], g_strdup( locale[0] ) ); - g_strfreev( locale ); - } - purple_request_field_list_add_selected( field, "English" ); - purple_request_field_group_add_field( group, field ); - - /* display the form to the user and wait for his/her input */ - purple_request_fields( session->con, "MXit", _( "MXit Authorization" ), _( "MXit account validation" ), fields, - _( "Continue" ), G_CALLBACK( mxit_cb_captcha_ok ), _( "Cancel" ), G_CALLBACK( mxit_cb_captcha_cancel ), session->acc, NULL, NULL, session->con ); - - /* freeup the memory */ - g_strfreev( parts ); -} - - -/*------------------------------------------------------------------------ - * Initiate a request for the client information (distribution code, client key, etc) - * required for logging in from the MXit WAP site. - * - * @param session The MXit session object - */ -static void get_clientinfo( struct MXitSession* session ) -{ - PurpleUtilFetchUrlData* url_data; - const char* wapserver; - char* url; - - purple_debug_info( MXIT_PLUGIN_ID, "get_clientinfo\n" ); - - purple_connection_update_progress( session->con, _( "Retrieving User Information..." ), 0, 4 ); - - /* get the WAP site as was configured by the user in the advanced settings */ - wapserver = purple_account_get_string( session->acc, MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE ); - - /* reference: "libpurple/util.h" */ - url = g_strdup_printf( "%s/res/?type=challenge&getcountries=true&getlanguage=true&getimage=true&h=%i&w=%i&ts=%li", wapserver, MXIT_CAPTCHA_HEIGHT, MXIT_CAPTCHA_WIDTH, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_clientinfo1, session ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP REQUEST: '%s'\n", url ); -#endif - g_free( url ); -} - - -/*------------------------------------------------------------------------ - * Log the user into MXit. - * - * @param account The account object - */ -void mxit_login( PurpleAccount* account ) -{ - struct MXitSession* session = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_login\n" ); - - /* create and save a new mxit session */ - session = mxit_create_object( account ); - - /* - * before we can login we need to have a valid distribution code and client key for authentication. - * if we don't have any info saved from a previous login, we need to get it from the MXit WAP site. - * we do cache it, so this step is only done on the very first login for each account. - */ - if ( ( session->distcode == NULL ) || ( strlen( session->distcode ) == 0 ) ) { - /* this must be the very first login, so we need to retrieve the user information */ - get_clientinfo( session ); - } - else { - /* we can continue with the login */ - mxit_login_connect( session ); - } -} - - -/*------------------------------------------------------------------------ - * Perform a reconnect to the MXit server, and maintain same session object. - * - * @param account The account object - */ -void mxit_reconnect( struct MXitSession* session ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_reconnect\n" ); - - /* close existing connection */ - session->flags &= ~MXIT_FLAG_CONNECTED; - purple_proxy_connect_cancel_with_handle( session->con ); - - /* perform the re-connect */ - mxit_login_connect( session ); -} - - -/*------------------------------------------------------------------------ - * Register a new account with MXit - * - * @param acc The account object - */ -void mxit_register( PurpleAccount* account ) -{ - struct MXitSession* session = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_register\n" ); - - /* create and save a new mxit session */ - session = mxit_create_object( account ); - purple_account_set_int( account, MXIT_CONFIG_STATE, MXIT_STATE_REGISTER1 ); - - get_clientinfo( session ); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/login.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit user login functionality -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_LOGIN_H_ -#define _MXIT_LOGIN_H_ - - -struct login_data { - char* wapserver; /* direct WAP server for postback */ - char* sessionid; /* unique session id */ - guchar* captcha; /* actual captcha (PNG) */ - gsize captcha_size; /* captcha size */ - char* cc; /* country code */ - char* locale; /* locale (language) */ -}; - - -void mxit_login( PurpleAccount* account ); -void mxit_register( PurpleAccount* account ); -void mxit_reconnect( struct MXitSession* session ); - - -#endif /* _MXIT_LOGIN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MXITSOURCES = \ - actions.c \ - actions.h \ - aes.c \ - aes.h \ - chunk.c \ - chunk.h \ - cipher.c \ - cipher.h \ - filexfer.c \ - filexfer.h \ - formcmds.c \ - formcmds.h \ - http.c \ - http.h \ - login.c \ - login.h \ - markup.c \ - markup.h \ - multimx.c \ - multimx.h \ - mxit.c \ - mxit.h \ - profile.c \ - profile.h \ - protocol.c \ - protocol.h \ - roster.c \ - roster.h \ - splashscreen.c \ - splashscreen.h - - -AM_CFLAGS = $(st) - -libmxit_la_LDFLAGS = -module -avoid-version - -if STATIC_MXIT - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmxit.la -libmxit_la_SOURCES = $(MXITSOURCES) -libmxit_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmxit.la -libmxit_la_SOURCES = $(MXITSOURCES) -libmxit_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,891 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/mxit -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MXIT_FALSE@libmxit_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libmxit_la_SOURCES_DIST = actions.c actions.h aes.c aes.h chunk.c \ - chunk.h cipher.c cipher.h filexfer.c filexfer.h formcmds.c \ - formcmds.h http.c http.h login.c login.h markup.c markup.h \ - multimx.c multimx.h mxit.c mxit.h profile.c profile.h \ - protocol.c protocol.h roster.c roster.h splashscreen.c \ - splashscreen.h -am__objects_1 = libmxit_la-actions.lo libmxit_la-aes.lo \ - libmxit_la-chunk.lo libmxit_la-cipher.lo \ - libmxit_la-filexfer.lo libmxit_la-formcmds.lo \ - libmxit_la-http.lo libmxit_la-login.lo libmxit_la-markup.lo \ - libmxit_la-multimx.lo libmxit_la-mxit.lo libmxit_la-profile.lo \ - libmxit_la-protocol.lo libmxit_la-roster.lo \ - libmxit_la-splashscreen.lo -@STATIC_MXIT_FALSE@am_libmxit_la_OBJECTS = $(am__objects_1) -@STATIC_MXIT_TRUE@am_libmxit_la_OBJECTS = $(am__objects_1) -libmxit_la_OBJECTS = $(am_libmxit_la_OBJECTS) -@STATIC_MXIT_FALSE@am_libmxit_la_rpath = -rpath $(pkgdir) -@STATIC_MXIT_TRUE@am_libmxit_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmxit_la_SOURCES) -DIST_SOURCES = $(am__libmxit_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MXITSOURCES = \ - actions.c \ - actions.h \ - aes.c \ - aes.h \ - chunk.c \ - chunk.h \ - cipher.c \ - cipher.h \ - filexfer.c \ - filexfer.h \ - formcmds.c \ - formcmds.h \ - http.c \ - http.h \ - login.c \ - login.h \ - markup.c \ - markup.h \ - multimx.c \ - multimx.h \ - mxit.c \ - mxit.h \ - profile.c \ - profile.h \ - protocol.c \ - protocol.h \ - roster.c \ - roster.h \ - splashscreen.c \ - splashscreen.h - -AM_CFLAGS = $(st) -libmxit_la_LDFLAGS = -module -avoid-version -@STATIC_MXIT_FALSE@st = -@STATIC_MXIT_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MXIT_TRUE@noinst_LTLIBRARIES = libmxit.la -@STATIC_MXIT_FALSE@libmxit_la_SOURCES = $(MXITSOURCES) -@STATIC_MXIT_TRUE@libmxit_la_SOURCES = $(MXITSOURCES) -@STATIC_MXIT_TRUE@libmxit_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MXIT_FALSE@pkg_LTLIBRARIES = libmxit.la -@STATIC_MXIT_FALSE@libmxit_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/mxit/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/mxit/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmxit.la: $(libmxit_la_OBJECTS) $(libmxit_la_DEPENDENCIES) - $(LINK) $(am_libmxit_la_rpath) $(libmxit_la_LDFLAGS) $(libmxit_la_OBJECTS) $(libmxit_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-actions.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-aes.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-chunk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-cipher.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-filexfer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-formcmds.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-http.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-login.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-markup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-multimx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-mxit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-profile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-protocol.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-roster.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmxit_la-splashscreen.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmxit_la-actions.lo: actions.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-actions.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-actions.Tpo" -c -o libmxit_la-actions.lo `test -f 'actions.c' || echo '$(srcdir)/'`actions.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-actions.Tpo" "$(DEPDIR)/libmxit_la-actions.Plo"; else rm -f "$(DEPDIR)/libmxit_la-actions.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='actions.c' object='libmxit_la-actions.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-actions.lo `test -f 'actions.c' || echo '$(srcdir)/'`actions.c - -libmxit_la-aes.lo: aes.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-aes.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-aes.Tpo" -c -o libmxit_la-aes.lo `test -f 'aes.c' || echo '$(srcdir)/'`aes.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-aes.Tpo" "$(DEPDIR)/libmxit_la-aes.Plo"; else rm -f "$(DEPDIR)/libmxit_la-aes.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='aes.c' object='libmxit_la-aes.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-aes.lo `test -f 'aes.c' || echo '$(srcdir)/'`aes.c - -libmxit_la-chunk.lo: chunk.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-chunk.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-chunk.Tpo" -c -o libmxit_la-chunk.lo `test -f 'chunk.c' || echo '$(srcdir)/'`chunk.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-chunk.Tpo" "$(DEPDIR)/libmxit_la-chunk.Plo"; else rm -f "$(DEPDIR)/libmxit_la-chunk.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chunk.c' object='libmxit_la-chunk.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-chunk.lo `test -f 'chunk.c' || echo '$(srcdir)/'`chunk.c - -libmxit_la-cipher.lo: cipher.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-cipher.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-cipher.Tpo" -c -o libmxit_la-cipher.lo `test -f 'cipher.c' || echo '$(srcdir)/'`cipher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-cipher.Tpo" "$(DEPDIR)/libmxit_la-cipher.Plo"; else rm -f "$(DEPDIR)/libmxit_la-cipher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cipher.c' object='libmxit_la-cipher.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-cipher.lo `test -f 'cipher.c' || echo '$(srcdir)/'`cipher.c - -libmxit_la-filexfer.lo: filexfer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-filexfer.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-filexfer.Tpo" -c -o libmxit_la-filexfer.lo `test -f 'filexfer.c' || echo '$(srcdir)/'`filexfer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-filexfer.Tpo" "$(DEPDIR)/libmxit_la-filexfer.Plo"; else rm -f "$(DEPDIR)/libmxit_la-filexfer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='filexfer.c' object='libmxit_la-filexfer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-filexfer.lo `test -f 'filexfer.c' || echo '$(srcdir)/'`filexfer.c - -libmxit_la-formcmds.lo: formcmds.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-formcmds.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-formcmds.Tpo" -c -o libmxit_la-formcmds.lo `test -f 'formcmds.c' || echo '$(srcdir)/'`formcmds.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-formcmds.Tpo" "$(DEPDIR)/libmxit_la-formcmds.Plo"; else rm -f "$(DEPDIR)/libmxit_la-formcmds.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='formcmds.c' object='libmxit_la-formcmds.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-formcmds.lo `test -f 'formcmds.c' || echo '$(srcdir)/'`formcmds.c - -libmxit_la-http.lo: http.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-http.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-http.Tpo" -c -o libmxit_la-http.lo `test -f 'http.c' || echo '$(srcdir)/'`http.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-http.Tpo" "$(DEPDIR)/libmxit_la-http.Plo"; else rm -f "$(DEPDIR)/libmxit_la-http.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='http.c' object='libmxit_la-http.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-http.lo `test -f 'http.c' || echo '$(srcdir)/'`http.c - -libmxit_la-login.lo: login.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-login.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-login.Tpo" -c -o libmxit_la-login.lo `test -f 'login.c' || echo '$(srcdir)/'`login.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-login.Tpo" "$(DEPDIR)/libmxit_la-login.Plo"; else rm -f "$(DEPDIR)/libmxit_la-login.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='login.c' object='libmxit_la-login.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-login.lo `test -f 'login.c' || echo '$(srcdir)/'`login.c - -libmxit_la-markup.lo: markup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-markup.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-markup.Tpo" -c -o libmxit_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-markup.Tpo" "$(DEPDIR)/libmxit_la-markup.Plo"; else rm -f "$(DEPDIR)/libmxit_la-markup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='markup.c' object='libmxit_la-markup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c - -libmxit_la-multimx.lo: multimx.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-multimx.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-multimx.Tpo" -c -o libmxit_la-multimx.lo `test -f 'multimx.c' || echo '$(srcdir)/'`multimx.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-multimx.Tpo" "$(DEPDIR)/libmxit_la-multimx.Plo"; else rm -f "$(DEPDIR)/libmxit_la-multimx.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='multimx.c' object='libmxit_la-multimx.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-multimx.lo `test -f 'multimx.c' || echo '$(srcdir)/'`multimx.c - -libmxit_la-mxit.lo: mxit.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-mxit.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-mxit.Tpo" -c -o libmxit_la-mxit.lo `test -f 'mxit.c' || echo '$(srcdir)/'`mxit.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-mxit.Tpo" "$(DEPDIR)/libmxit_la-mxit.Plo"; else rm -f "$(DEPDIR)/libmxit_la-mxit.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mxit.c' object='libmxit_la-mxit.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-mxit.lo `test -f 'mxit.c' || echo '$(srcdir)/'`mxit.c - -libmxit_la-profile.lo: profile.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-profile.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-profile.Tpo" -c -o libmxit_la-profile.lo `test -f 'profile.c' || echo '$(srcdir)/'`profile.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-profile.Tpo" "$(DEPDIR)/libmxit_la-profile.Plo"; else rm -f "$(DEPDIR)/libmxit_la-profile.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='profile.c' object='libmxit_la-profile.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-profile.lo `test -f 'profile.c' || echo '$(srcdir)/'`profile.c - -libmxit_la-protocol.lo: protocol.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-protocol.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-protocol.Tpo" -c -o libmxit_la-protocol.lo `test -f 'protocol.c' || echo '$(srcdir)/'`protocol.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-protocol.Tpo" "$(DEPDIR)/libmxit_la-protocol.Plo"; else rm -f "$(DEPDIR)/libmxit_la-protocol.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protocol.c' object='libmxit_la-protocol.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-protocol.lo `test -f 'protocol.c' || echo '$(srcdir)/'`protocol.c - -libmxit_la-roster.lo: roster.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-roster.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-roster.Tpo" -c -o libmxit_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-roster.Tpo" "$(DEPDIR)/libmxit_la-roster.Plo"; else rm -f "$(DEPDIR)/libmxit_la-roster.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='roster.c' object='libmxit_la-roster.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-roster.lo `test -f 'roster.c' || echo '$(srcdir)/'`roster.c - -libmxit_la-splashscreen.lo: splashscreen.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -MT libmxit_la-splashscreen.lo -MD -MP -MF "$(DEPDIR)/libmxit_la-splashscreen.Tpo" -c -o libmxit_la-splashscreen.lo `test -f 'splashscreen.c' || echo '$(srcdir)/'`splashscreen.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmxit_la-splashscreen.Tpo" "$(DEPDIR)/libmxit_la-splashscreen.Plo"; else rm -f "$(DEPDIR)/libmxit_la-splashscreen.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='splashscreen.c' object='libmxit_la-splashscreen.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmxit_la_CFLAGS) $(CFLAGS) -c -o libmxit_la-splashscreen.lo `test -f 'splashscreen.c' || echo '$(srcdir)/'`splashscreen.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmxit -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmxit -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = actions.c \ - aes.c \ - chunk.c \ - cipher.c \ - filexfer.c \ - formcmds.c \ - http.c \ - login.c \ - markup.c \ - multimx.c \ - mxit.c \ - profile.c \ - protocol.c \ - roster.c \ - splashscreen.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1188 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- convert between MXit and libPurple markup -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "markup.h" -#include "chunk.h" -#include "formcmds.h" -#include "roster.h" - - -/* define this to enable emoticon (markup) debugging */ -#undef MXIT_DEBUG_EMO -/* define this to enable markup conversion debugging */ -#undef MXIT_DEBUG_MARKUP - - -#define MXIT_FRAME_MAGIC "MXF\x01" /* mxit emoticon magic number */ -#define MXIT_MAX_EMO_ID 16 /* maximum emoticon ID length */ -#define COLORCODE_LEN 6 /* colour code ID length */ - - -/* HTML tag types */ -#define MXIT_TAG_COLOR 0x01 /* font color tag */ -#define MXIT_TAG_SIZE 0x02 /* font size tag */ -#define MXIT_MAX_MSG_TAGS 90 /* maximum tags per message (pigdin hack work around) */ - -/* - * a HTML tag object - */ -struct tag { - char type; - char* value; -}; - - -#define MXIT_VIBE_MSG_COLOR "#9933FF" - -/* vibes */ -static const char* vibes[] = { - /* 0 */ N_( "Cool Vibrations" ), - /* 1 */ N_( "Purple Rain" ), - /* 2 */ N_( "Polite" ), - /* 3 */ N_( "Rock n Roll" ), - /* 4 */ N_( "Summer Slumber" ), - /* 5 */ N_( "Electric Razor" ), - /* 6 */ N_( "S.O.S" ), - /* 7 */ N_( "Jack Hammer" ), - /* 8 */ N_( "Bumble Bee" ), - /* 9 */ N_( "Ripple" ) -}; - - - -#ifdef MXIT_DEBUG_EMO -/*------------------------------------------------------------------------ - * Dump a byte buffer as hexadecimal to the console for debugging purposes. - * - * @param buf The data to dump - * @param len The length of the data - */ -static void hex_dump( const char* buf, int len ) -{ - char msg[256]; - int pos; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "Dumping data (%i bytes)\n", len ); - - memset( msg, 0x00, sizeof( msg ) ); - pos = 0; - - for ( i = 0; i < len; i++ ) { - - if ( pos == 0 ) - pos += sprintf( &msg[pos], "%04i: ", i ); - - pos += sprintf( &msg[pos], "0x%02X ", (unsigned char) buf[i] ); - - if ( i % 16 == 15 ) { - pos += sprintf( &msg[pos], "\n" ); - purple_debug_info( MXIT_PLUGIN_ID, msg ); - pos = 0; - } - else if ( i % 16 == 7 ) - pos += sprintf( &msg[pos], " " ); - } - - if ( pos > 0 ) { - pos += sprintf( &msg[pos], "\n" ); - purple_debug_info( MXIT_PLUGIN_ID, msg ); - pos = 0; - } -} -#endif - - -/*------------------------------------------------------------------------ - * Adds a link to a message - * - * @param mx The Markup message object - * @param linkname This is the what will be returned when the link gets clicked - * @param displayname This is the name for the link which will be displayed in the UI - */ -void mxit_add_html_link( struct RXMsgData* mx, const char* linkname, const char* displayname ) -{ -#ifdef MXIT_LINK_CLICK - char retstr[256]; - gchar* retstr64; - char link[256]; - int len; - - len = g_snprintf( retstr, sizeof( retstr ), "%s|%s|%s|%s|%s", MXIT_LINK_KEY, purple_account_get_username( mx->session->acc ), - purple_account_get_protocol_id( mx->session->acc ), mx->from, linkname ); - retstr64 = purple_base64_encode( (const unsigned char*) retstr, len ); - g_snprintf( link, sizeof( link ), "%s%s", MXIT_LINK_PREFIX, retstr64 ); - g_free( retstr64 ); - - g_string_append_printf( mx->msg, "%s", link, displayname ); -#else - g_string_append_printf( mx->msg, "%s", linkname ); -#endif -} - - -/*------------------------------------------------------------------------ - * Extract an ASN.1 formatted length field from the data. - * - * @param data The source data - * @param size The extracted length - * @return The number of bytes extracted - */ -static unsigned int asn_getlength( const char* data, int* size ) -{ - unsigned int len = 0; - unsigned char bytes; - unsigned char byte; - int i; - - /* first byte specifies the number of bytes in the length */ - bytes = ( data[0] & ~0x80 ); - if ( bytes > sizeof( unsigned int ) ) { - /* file too big! */ - return -1; - } - data++; - - /* parse out the actual length */ - for ( i = 0; i < bytes; i++ ) { - byte = data[i]; - len <<= 8; - len += byte; - } - - *size = len; - return bytes + 1; -} - - -/*------------------------------------------------------------------------ - * Extract an ASN.1 formatted UTF-8 string field from the data. - * - * @param data The source data - * @param type Expected type of string - * @param utf8 The extracted string. Must be deallocated by caller. - * @return The number of bytes extracted - */ -static int asn_getUtf8( const char* data, char type, char** utf8 ) -{ - int len; - - /* validate the field type [1 byte] */ - if ( data[0] != type ) { - /* this is not a utf-8 string! */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid UTF-8 encoded string in ASN data (0x%02X)\n", (unsigned char) data[0] ); - return -1; - } - - len = data[1]; /* length field [1 bytes] */ - *utf8 = g_malloc( len + 1 ); - memcpy( *utf8, &data[2], len ); /* data field */ - (*utf8)[len] = '\0'; - - return ( len + 2 ); -} - - -/*------------------------------------------------------------------------ - * Free data associated with a Markup message object. - * - * @param mx The Markup message object - */ -static void free_markupdata( struct RXMsgData* mx ) -{ - if ( mx ) { - if ( mx->msg ) - g_string_free( mx->msg, TRUE ); - if ( mx->from ) - g_free( mx->from ); - g_free( mx ); - } -} - - -/*------------------------------------------------------------------------ - * Split the message into smaller messages and send them one at a time - * to pidgin to be displayed on the UI - * - * @param mx The received message object - */ -static void mxit_show_split_message( struct RXMsgData* mx ) -{ - const char* cont = "continuing...\n"; - GString* msg = NULL; - char* ch = NULL; - int pos = 0; - int start = 0; - int l_nl = 0; - int l_sp = 0; - int l_gt = 0; - int stop = 0; - int tags = 0; - int segs = 0; - gboolean intag = FALSE; - - /* - * awful hack to work around the awful hack in pidgin to work around GtkIMHtml's - * inefficient rendering of messages with lots of formatting changes. - * (reference: see the function pidgin_conv_write_conv() in gtkconv.c) the issue - * is that when you have more than 100 '<' characters in the message passed to - * pidgin, none of the markup (including links) are rendered and thus just dump - * all the text as is to the conversation window. this message dump is very - * confusing and makes it totally unusable. to work around this we will count - * the amount of tags and if its more than the pidgin threshold, we will just - * break the message up into smaller parts and send them seperately to pidgin. - * to the user it will look like multiple messages, but at least he will be able - * to use and understand it. - */ - - ch = mx->msg->str; - pos = start; - while ( ch[pos] ) { - - if ( ch[pos] == '<' ) { - tags++; - intag = TRUE; - } - else if ( ch[pos] == '\n' ) { - l_nl = pos; - } - else if ( ch[pos] == '>' ) { - l_gt = pos; - intag = FALSE; - } - else if ( ch[pos] == ' ' ) { - /* ignore spaces inside tags */ - if ( !intag ) - l_sp = pos; - } - else if ( ( ch[pos] == 'w' ) && ( pos + 4 < mx->msg->len ) && ( memcmp( &ch[pos], "www.", 4 ) == 0 ) ) { - tags += 2; - } - else if ( ( ch[pos] == 'h' ) && ( pos + 8 < mx->msg->len ) && ( memcmp( &ch[pos], "http://", 7 ) == 0 ) ) { - tags += 2; - } - - if ( tags > MXIT_MAX_MSG_TAGS ) { - /* we have reached the maximum amount of tags pidgin (gtk) can handle per message. - so its time to send what we have and then start building a new message */ - - /* now find the right place to break the message */ - if ( l_nl > start ) { - /* break at last '\n' char */ - stop = l_nl; - ch[stop] = '\0'; - msg = g_string_new( &ch[start] ); - ch[stop] = '\n'; - } - else if ( l_sp > start ) { - /* break at last ' ' char */ - stop = l_sp; - ch[stop] = '\0'; - msg = g_string_new( &ch[start] ); - ch[stop] = ' '; - } - else { - /* break at the last '>' char */ - char t; - stop = l_gt + 1; - t = ch[stop]; - ch[stop] = '\0'; - msg = g_string_new( &ch[start] ); - ch[stop] = t; - stop--; - } - - /* build the string */ - if ( segs ) - g_string_prepend( msg, cont ); - - /* push message to pidgin */ - serv_got_im( mx->session->con, mx->from, msg->str, mx->flags, mx->timestamp ); - g_string_free( msg, TRUE ); - msg = NULL; - - tags = 0; - segs++; - start = stop + 1; - } - - pos++; - } - - if ( start != pos ) { - /* send the last part of the message */ - - /* build the string */ - ch[pos] = '\0'; - msg = g_string_new( &ch[start] ); - ch[pos] = '\n'; - if ( segs ) - g_string_prepend( msg, cont ); - - /* push message to pidgin */ - serv_got_im( mx->session->con, mx->from, msg->str, mx->flags, mx->timestamp ); - g_string_free( msg, TRUE ); - msg = NULL; - } -} - - -/*------------------------------------------------------------------------ - * Insert custom emoticons and inline images into the message (if there - * are any), then give the message to the UI to display to the user. - * - * @param mx The received message object - */ -void mxit_show_message( struct RXMsgData* mx ) -{ - char* pos; - int start; - unsigned int end; - int emo_ofs; - char ii[128]; - char tag[64]; - int* img_id; - - if ( mx->got_img ) { - /* search and replace all emoticon tags with proper image tags */ - - while ( ( pos = strstr( mx->msg->str, MXIT_II_TAG ) ) != NULL ) { - start = pos - mx->msg->str; /* offset at which MXIT_II_TAG starts */ - emo_ofs = start + strlen( MXIT_II_TAG ); /* offset at which EMO's ID starts */ - end = emo_ofs + 1; /* offset at which MXIT_II_TAG ends */ - - while ( ( end < mx->msg->len ) && ( mx->msg->str[end] != '>' ) ) - end++; - - if ( end == mx->msg->len ) /* end of emoticon tag not found */ - break; - - memset( ii, 0x00, sizeof( ii ) ); - memcpy( ii, &mx->msg->str[emo_ofs], end - emo_ofs ); - - /* remove inline image tag */ - g_string_erase( mx->msg, start, ( end - start ) + 1 ); - - /* find the image entry */ - img_id = (int*) g_hash_table_lookup( mx->session->iimages, ii ); - if ( !img_id ) { - /* inline image not found, so we will just skip it */ - purple_debug_error( MXIT_PLUGIN_ID, "inline image NOT found (%s)\n", ii ); - } - else { - /* insert img tag */ - g_snprintf( tag, sizeof( tag ), "", *img_id ); - g_string_insert( mx->msg, start, tag ); - } - } - } - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup RX (converted): '%s'\n", mx->msg->str ); -#endif - - if ( mx->processed ) { - /* this message has already been taken care of, so just ignore it here */ - } - else if ( mx->chatid < 0 ) { - /* normal chat message */ - mxit_show_split_message( mx ); - } - else { - /* this is a multimx message */ - serv_got_chat_in( mx->session->con, mx->chatid, mx->from, mx->flags, mx->msg->str, mx->timestamp); - } - - /* freeup resource */ - free_markupdata( mx ); -} - - -/*------------------------------------------------------------------------ - * Extract the custom emoticon ID from the message. - * - * @param message The input data - * @param emid The extracted emoticon ID - */ -static void parse_emoticon_str( const char* message, char* emid ) -{ - int i; - - for ( i = 0; ( message[i] != '\0' && message[i] != '}' && i < MXIT_MAX_EMO_ID ); i++ ) { - emid[i] = message[i]; - } - - if ( message[i] == '\0' ) { - /* end of message reached, ignore the tag */ - emid[0] = '\0'; - } - else if ( i == MXIT_MAX_EMO_ID ) { - /* invalid tag length, ignore the tag */ - emid[0] = '\0'; - } - else - emid[i] = '\0'; -} - - -/*------------------------------------------------------------------------ - * Callback function invoked when a custom emoticon request to the WAP site completes. - * - * @param url_data - * @param user_data The Markup message object - * @param url_text The data returned from the WAP site - * @param len The length of the data returned - * @param error_message Descriptive error message - */ -static void emoticon_returned( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct RXMsgData* mx = (struct RXMsgData*) user_data; - const char* data = url_text; - unsigned int pos = 0; - char emo[16]; - int id; - char* str; - int em_size = 0; - char* em_data = NULL; - char* em_id = NULL; - int* intptr = NULL; - int res; - -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "emoticon_returned\n" ); -#endif - - if ( !url_text ) { - /* no reply from the WAP site */ - purple_debug_error( MXIT_PLUGIN_ID, "Error contacting the MXit WAP site. Please try again later (emoticon).\n" ); - goto done; - } - -#ifdef MXIT_DEBUG_EMO - hex_dump( data, len ); -#endif - - /* parse out the emoticon */ - pos = 0; - - /* validate the binary data received from the wapsite */ - if ( memcmp( MXIT_FRAME_MAGIC, &data[pos], strlen( MXIT_FRAME_MAGIC ) ) != 0 ) { - /* bad data, magic constant is wrong */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad magic)\n" ); - goto done; - } - pos += strlen( MXIT_FRAME_MAGIC ); - - /* validate the image frame desc byte */ - if ( data[pos] != '\x6F' ) { - /* bad frame desc */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad frame desc)\n" ); - goto done; - } - pos++; - - /* get the data length */ - res = asn_getlength( &data[pos], &em_size ); - if ( res <= 0 ) { - /* bad frame length */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad frame length)\n" ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the length '%i'\n", em_size ); -#endif - - /* utf-8 (emoticon name) */ - res = asn_getUtf8( &data[pos], 0x0C, &str ); - if ( res <= 0 ) { - /* bad utf-8 string */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad name string)\n" ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the string '%s'\n", str ); -#endif - g_free( str ); - str = NULL; - - /* utf-8 (emoticon shortcut) */ - res = asn_getUtf8( &data[pos], 0x81, &str ); - if ( res <= 0 ) { - /* bad utf-8 string */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad shortcut string)\n" ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the string '%s'\n", str ); -#endif - em_id = str; - - /* validate the image data type */ - if ( data[pos] != '\x82' ) { - /* bad frame desc */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad data type)\n" ); - g_free( em_id ); - goto done; - } - pos++; - - /* get the data length */ - res = asn_getlength( &data[pos], &em_size ); - if ( res <= 0 ) { - /* bad frame length */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid emoticon received from wapsite (bad data length)\n" ); - g_free( em_id ); - goto done; - } - pos += res; -#ifdef MXIT_DEBUG_EMO - purple_debug_info( MXIT_PLUGIN_ID, "read the length '%i'\n", em_size ); -#endif - - if ( g_hash_table_lookup( mx->session->iimages, em_id ) ) { - /* emoticon found in the table, so ignore this one */ - goto done; - } - - /* make a copy of the data */ - em_data = g_malloc( em_size ); - memcpy( em_data, &data[pos], em_size ); - - /* strip the mxit markup tags from the emoticon id */ - if ( ( em_id[0] == '.' ) && ( em_id[1] == '{' ) ) { - parse_emoticon_str( &em_id[2], emo ); - strcpy( em_id, emo ); - } - - /* we now have the emoticon, store it in the imagestore */ - id = purple_imgstore_add_with_id( em_data, em_size, NULL ); - - /* map the mxit emoticon id to purple image id */ - intptr = g_malloc( sizeof( int ) ); - *intptr = id; - g_hash_table_insert( mx->session->iimages, em_id, intptr ); - - mx->flags |= PURPLE_MESSAGE_IMAGES; -done: - mx->img_count--; - if ( ( mx->img_count == 0 ) && ( mx->converted ) ) { - /* - * this was the last outstanding emoticon for this message, - * so we can now display it to the user. - */ - mxit_show_message( mx ); - } -} - - -/*------------------------------------------------------------------------ - * Send a request to the MXit WAP site to download the specified emoticon. - * - * @param mx The Markup message object - * @param id The ID for the emoticon - */ -static void emoticon_request( struct RXMsgData* mx, const char* id ) -{ - PurpleUtilFetchUrlData* url_data; - const char* wapserver; - char* url; - - purple_debug_info( MXIT_PLUGIN_ID, "sending request for emoticon '%s'\n", id ); - - wapserver = purple_account_get_string( mx->session->acc, MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE ); - - /* reference: "libpurple/util.h" */ - url = g_strdup_printf( "%s/res/?type=emo&mlh=%i&sc=%s&ts=%li", wapserver, MXIT_EMOTICON_SIZE, id, time( NULL ) ); - url_data = purple_util_fetch_url_request( url, TRUE, NULL, TRUE, NULL, FALSE, emoticon_returned, mx ); - g_free( url ); -} - - -/*------------------------------------------------------------------------ - * Parse a Vibe command. - * - * @param mx The Markup message object - * @param message The message text (which contains the vibe) - * @return id The length of the message to skip - */ -static int mxit_parse_vibe( struct RXMsgData* mx, const char* message ) -{ - int vibeid; - - vibeid = message[2] - '0'; - - purple_debug_info( MXIT_PLUGIN_ID, "Vibe received (%i)\n", vibeid ); - - if ( vibeid > ( ARRAY_SIZE( vibes ) - 1 ) ) { - purple_debug_warning( MXIT_PLUGIN_ID, "Unsupported vibe received (%i)\n", vibeid ); - /* unsupported vibe */ - return 0; - } - - g_string_append_printf( mx->msg, "%s Vibe...", MXIT_VIBE_MSG_COLOR, _( vibes[vibeid] ) ); - return 2; -} - - -/*------------------------------------------------------------------------ - * Extract the nickname from a chatroom message and display it nicely in - * libPurple-style (HTML) markup. - * - * @param mx The received message data object - * @param message The message text - * @return The length of the message to skip - */ -static int mxit_extract_chatroom_nick( struct RXMsgData* mx, char* message, int len ) -{ - int i; - - if ( message[0] == '<' ) { - /* - * The message MIGHT contains an embedded nickname. But we can't - * be sure unless we find the end-of-nickname sequence: (>\n) - * Search for it.... - */ - gboolean found = FALSE; - gchar* nickname; - - for ( i = 1; i < len; i++ ) { - if ( ( message[i] == '\n' ) && ( message[i-1] == '>' ) ) { - found = TRUE; - message[i-1] = '\0'; /* loose the '>' */ - i++; /* and skip the new-line */ - break; - } - } - - if ( found ) { - /* - * The message definitely had an embedded nickname - generate a marked-up - * message to be displayed. - */ - nickname = g_markup_escape_text( &message[1], -1 ); - - /* add nickname within some BOLD markup to the new converted message */ - g_string_append_printf( mx->msg, "%s: ", nickname ); - - /* free up the resources */ - g_free( nickname ); - - return i; - } - } - - return 0; -} - - - -/*------------------------------------------------------------------------ - * Convert a message containing MXit protocol markup to libPurple-style (HTML) markup. - * - * @param mx The received message data object - * @param message The message text - * @param len The length of the message - */ -void mxit_parse_markup( struct RXMsgData* mx, char* message, int len, short msgtype, int msgflags ) -{ - char tmpstr1[128]; - char* ch; - int i = 0; - - /* tags */ - gboolean tag_bold = FALSE; - gboolean tag_under = FALSE; - gboolean tag_italic = FALSE; - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup RX (original): '%s'\n", message ); -#endif - - - /* - * supported MXit markup: - * '*' bold - * '_' underline - * '/' italics - * '$' highlight text - * '.+' inc font size - * '.-' dec font size - * '#XXXXXX' foreground color - * '.{XX}' custom emoticon - * '\' escape the following character - * '::' MXit commands - */ - - - if ( is_mxit_chatroom_contact( mx->session, mx->from ) ) { - /* chatroom message, so we need to extract and skip the sender's nickname - * which is embedded inside the message */ - i = mxit_extract_chatroom_nick( mx, message, len ); - } - - /* run through the message and check for custom emoticons and markup */ - for ( ; i < len; i++ ) { - switch ( message[i] ) { - - - /* mxit markup parsing */ - case '*' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - - /* bold markup */ - if ( !tag_bold ) - g_string_append( mx->msg, "" ); - else - g_string_append( mx->msg, "" ); - tag_bold = !tag_bold; - break; - case '_' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - - /* underscore markup */ - if ( !tag_under ) - g_string_append( mx->msg, "" ); - else - g_string_append( mx->msg, "" ); - tag_under = !tag_under; - break; - case '/' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - - /* italics markup */ - if ( !tag_italic ) - g_string_append( mx->msg, "" ); - else - g_string_append( mx->msg, "" ); - tag_italic = !tag_italic; - break; - case '$' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + 1 >= len ) { - /* message too short for complete link */ - g_string_append_c( mx->msg, '$' ); - break; - } - - /* find the end tag */ - ch = strstr( &message[i + 1], "$" ); - if ( ch ) { - /* end found */ - *ch = '\0'; - mxit_add_html_link( mx, &message[i + 1], &message[i + 1] ); - *ch = '$'; - i += ( ch - &message[i + 1] ) + 1; - } - else { - g_string_append_c( mx->msg, message[i] ); - } - /* highlight text */ - break; - case '#' : - if ( !( msgflags & CP_MSG_MARKUP ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + COLORCODE_LEN >= len ) { - /* message too short for complete colour code */ - g_string_append_c( mx->msg, '#' ); - break; - } - - /* foreground (text) color */ - memcpy( tmpstr1, &message[i + 1], COLORCODE_LEN ); - tmpstr1[ COLORCODE_LEN ] = '\0'; /* terminate string */ - if ( strcmp( tmpstr1, "??????" ) == 0 ) { - /* need to reset the font */ - g_string_append( mx->msg, "" ); - i += COLORCODE_LEN; - } - else if ( strspn( tmpstr1, "0123456789abcdefABCDEF") == COLORCODE_LEN ) { - /* definitely a numeric colour code */ - g_string_append_printf( mx->msg, "", tmpstr1 ); - i += COLORCODE_LEN; - } - else { - /* not valid colour markup */ - g_string_append_c( mx->msg, '#' ); - } - break; - case '.' : - if ( !( msgflags & CP_MSG_EMOTICON ) ) { - g_string_append_c( mx->msg, message[i] ); - break; - } - else if ( i + 1 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, '.' ); - break; - } - - switch ( message[i+1] ) { - case '+' : - /* increment text size */ - g_string_append( mx->msg, "" ); - i++; - break; - case '-' : - /* decrement text size */ - g_string_append( mx->msg, "" ); - i++; - break; - case '{' : - /* custom emoticon */ - if ( i + 2 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, '.' ); - break; - } - - parse_emoticon_str( &message[i+2], tmpstr1 ); - if ( tmpstr1[0] != '\0' ) { - mx->got_img = TRUE; - - if ( g_hash_table_lookup( mx->session->iimages, tmpstr1 ) ) { - /* emoticon found in the cache, so we do not have to request it from the WAPsite */ - } - else { - /* request emoticon from the WAPsite */ - mx->img_count++; - emoticon_request( mx, tmpstr1 ); - } - - g_string_append_printf( mx->msg, MXIT_II_TAG"%s>", tmpstr1 ); - i += strlen( tmpstr1 ) + 2; - } - else - g_string_append_c( mx->msg, '.' ); - - break; - default : - g_string_append_c( mx->msg, '.' ); - break; - } - break; - case '\\' : - if ( i + 1 >= len ) { - /* message too short for an escaped character */ - g_string_append_c( mx->msg, '\\' ); - } - else { - /* ignore the next character, because its been escaped */ - g_string_append_c( mx->msg, message[i + 1] ); - i++; - } - break; - - - /* command parsing */ - case ':' : - if ( i + 1 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, ':' ); - break; - } - - if ( message[i+1] == '@' ) { - /* this is a vibe! */ - int size; - - if ( i + 2 >= len ) { - /* message too short */ - g_string_append_c( mx->msg, message[i] ); - break; - } - - size = mxit_parse_vibe( mx, &message[i] ); - if ( size == 0 ) - g_string_append_c( mx->msg, message[i] ); - else - i += size; - } - else if ( msgtype != CP_MSGTYPE_COMMAND ) { - /* this is not a command message */ - g_string_append_c( mx->msg, message[i] ); - } - else if ( message[i+1] == ':' ) { - /* parse out the command */ - int size; - - size = mxit_parse_command( mx, &message[i] ); - if ( size == 0 ) - g_string_append_c( mx->msg, ':' ); - else - i += size; - } - else { - g_string_append_c( mx->msg, ':' ); - } - break; - - - /* these aren't MXit markup, but are interpreted by libPurple */ - case '<' : - g_string_append( mx->msg, "<" ); - break; - case '>' : - g_string_append( mx->msg, ">" ); - break; - case '&' : - g_string_append( mx->msg, "&" ); - break; - case '"' : - g_string_append( mx->msg, """ ); - break; - - default : - /* text */ - g_string_append_c( mx->msg, message[i] ); - break; - } - } -} - - -/*------------------------------------------------------------------------ - * Insert an inline image command. - * - * @param mx The message text as processed so far. - * @oaram id The imgstore ID of the inline image. - */ -static void inline_image_add( GString* mx, int id ) -{ - PurpleStoredImage *image; - gconstpointer img_data; - gsize img_size; - gchar* enc; - - image = purple_imgstore_find_by_id( id ); - if ( image == NULL ) - return; - - img_data = purple_imgstore_get_data( image ); - img_size = purple_imgstore_get_size( image ); - - enc = purple_base64_encode( img_data, img_size ); - - g_string_append( mx, "::op=img|dat=" ); - g_string_append( mx, enc ); - g_string_append_c( mx, ':' ); - - g_free( enc ); -} - - -/*------------------------------------------------------------------------ - * Convert libpurple (HTML) markup to MXit protocol markup (for sending to MXit). - * Any MXit markup codes in the original message also need to be escaped. - * - * @param message The message text containing libPurple (HTML) markup - * @return The message text containing MXit markup - */ -char* mxit_convert_markup_tx( const char* message, int* msgtype ) -{ - GString* mx; - struct tag* tag; - GList* entry; - GList* tagstack = NULL; - char* reply; - char color[8]; - int len = strlen ( message ); - int i; - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup TX (original): '%s'\n", message ); -#endif - - /* - * libPurple uses the following HTML markup codes: - * Bold: ... - * Italics: ... - * Underline: ... - * Strikethrough: ... (NO MXIT SUPPORT) - * Font size: ... - * Font type: ... (NO MXIT SUPPORT) - * Font colour: ... - * Links: ... - * Newline:
- * Inline image: - * The following characters are also encoded: - * & " < > - */ - - /* new message data */ - mx = g_string_sized_new( len ); - - /* run through the message and check for HTML markup */ - for ( i = 0; i < len; i++ ) { - - switch ( message[i] ) { - case '<' : - if ( purple_str_has_prefix( &message[i], "" ) || purple_str_has_prefix( &message[i], "" ) ) { - /* bold */ - g_string_append_c( mx, '*' ); - } - else if ( purple_str_has_prefix( &message[i], "" ) || purple_str_has_prefix( &message[i], "" ) ) { - /* italics */ - g_string_append_c( mx, '/' ); - } - else if ( purple_str_has_prefix( &message[i], "" ) || purple_str_has_prefix( &message[i], "" ) ) { - /* underline */ - g_string_append_c( mx, '_' ); - } - else if ( purple_str_has_prefix( &message[i], "
" ) ) { - /* newline */ - g_string_append_c( mx, '\n' ); - } - else if ( purple_str_has_prefix( &message[i], "" ) ) { - /* end of font tag */ - entry = g_list_last( tagstack ); - if ( entry ) { - tag = entry->data; - if ( tag->type == MXIT_TAG_COLOR ) { - /* font color reset */ - g_string_append( mx, "#??????" ); - } - else if ( tag->type == MXIT_TAG_SIZE ) { - /* font size */ - // TODO: implement size control - } - tagstack = g_list_remove( tagstack, tag ); - g_free( tag ); - } - } - else if ( purple_str_has_prefix( &message[i], "') */ - for ( i++; ( i < len ) && ( message[i] != '>' ) ; i++ ); - - break; - - case '*' : /* MXit bold */ - case '_' : /* MXit underline */ - case '/' : /* MXit italic */ - case '#' : /* MXit font color */ - case '$' : /* MXit highlight text */ - case '\\' : /* MXit escape backslash */ - g_string_append( mx, "\\" ); /* escape character */ - g_string_append_c( mx, message[i] ); /* character to escape */ - break; - - default: - g_string_append_c( mx, message[i] ); - break; - } - } - - /* unescape HTML entities to their literal characters (reference: "libpurple/utils.h") */ - reply = purple_unescape_html( mx->str ); - - g_string_free( mx, TRUE ); - -#ifdef MXIT_DEBUG_MARKUP - purple_debug_info( MXIT_PLUGIN_ID, "Markup TX (converted): '%s'\n", reply ); -#endif - - return reply; -} - - -/*------------------------------------------------------------------------ - * Free an emoticon entry. - * - * @param key MXit emoticon ID - * @param value Imagestore ID for emoticon - * @param user_data NULL (unused) - * @return TRUE - */ -static gboolean emoticon_entry_free( gpointer key, gpointer value, gpointer user_data ) -{ - int* imgid = value; - - /* key is a string */ - g_free( key ); - - /* value is 'id' in imagestore */ - purple_imgstore_unref_by_id( *imgid ); - g_free( value ); - - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Free all entries in the emoticon cache. - * - * @param session The MXit session object - */ -void mxit_free_emoticon_cache( struct MXitSession* session ) -{ - g_hash_table_foreach_remove( session->iimages, emoticon_entry_free, NULL ); - g_hash_table_destroy ( session->iimages ); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/markup.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- convert between MXit and libPurple markup -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_MARKUP_H_ -#define _MXIT_MARKUP_H_ - -#define MXIT_II_TAG " - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" -#include "prpl.h" - -#include "protocol.h" -#include "mxit.h" -#include "multimx.h" -#include "markup.h" - - -#if 0 -static void multimx_dump(struct multimx* multimx) -{ - purple_debug_info(MXIT_PLUGIN_ID, "MultiMX:\n"); - purple_debug_info(MXIT_PLUGIN_ID, " Chat ID: %i\n", multimx->chatid); - purple_debug_info(MXIT_PLUGIN_ID, " Username: %s\n", multimx->roomid); - purple_debug_info(MXIT_PLUGIN_ID, " Alias: %s\n", multimx->roomname); - purple_debug_info(MXIT_PLUGIN_ID, " State: %i\n", multimx->state); -} -#endif - - -/*------------------------------------------------------------------------ - * Find a MultiMx session based on libpurple chatID. - * - * @param session The MXit session object - * @param id The libpurple group-chat ID - * @return The MultiMX room object (or NULL if not found) - */ -static struct multimx* find_room_by_id(struct MXitSession* session, int id) -{ - GList* x = session->rooms; - - while (x != NULL) { - struct multimx* multimx = (struct multimx *) x->data; - - if (multimx->chatid == id) - return multimx; - - x = g_list_next(x); - } - - return NULL; -} - - -/*------------------------------------------------------------------------ - * Find a MultiMx session based on Alias - * - * @param session The MXit session object - * @param roomname The UI room-name - * @return The MultiMX room object (or NULL if not found) - */ -static struct multimx* find_room_by_alias(struct MXitSession* session, const char* roomname) -{ - GList* x = session->rooms; - - while (x != NULL) { - struct multimx* multimx = (struct multimx *) x->data; - - if (!strcmp(multimx->roomname, roomname)) - return multimx; - - x = g_list_next(x); - } - - return NULL; -} - - -/*------------------------------------------------------------------------ - * Find a MultiMx session based on Username (MXit RoomId) - * - * @param session The MXit session object - * @param username The MXit RoomID (MultiMX contact username) - * @return The MultiMX room object (or NULL if not found) - */ -static struct multimx* find_room_by_username(struct MXitSession* session, const char* username) -{ - GList* x = session->rooms; - - while (x != NULL) { - struct multimx* multimx = (struct multimx *) x->data; - - if (!strcmp(multimx->roomid, username)) - return multimx; - - x = g_list_next(x); - } - - return NULL; -} - - -/*------------------------------------------------------------------------ - * Create a GroupChat room, and add to list of rooms. - * - * @param session The MXit session object - * @param roomid The MXit RoomID (MultiMX contact username) - * @param roomname The UI room-name - * @param state The initial state of the room (see multimx.h) - * @return The MultiMX room object - */ -static struct multimx* room_create(struct MXitSession* session, const char* roomid, const char* roomname, short state) -{ - struct multimx* multimx = NULL; - static int groupchatID = 1; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat create - roomid='%s' roomname='%s'\n", roomid, roomname); - - /* Create a new GroupChat */ - multimx = g_new0(struct multimx, 1); - - /* Initialize groupchat */ - g_strlcpy(multimx->roomid, roomid, sizeof(multimx->roomid)); - g_strlcpy(multimx->roomname, roomname, sizeof(multimx->roomname)); - multimx->chatid = groupchatID++; - multimx->state = state; - - /* Add to GroupChat list */ - session->rooms = g_list_append(session->rooms, multimx); - - return multimx; -} - - -/*------------------------------------------------------------------------ - * Free the Groupchat room. - * - * @param session The MXit session object - * @param multimx The MultiMX room object to deallocate - */ -static void room_remove(struct MXitSession* session, struct multimx* multimx) -{ - /* Remove from GroupChat list */ - session->rooms = g_list_remove(session->rooms, multimx); - - /* Deallocate it */ - free (multimx); - multimx = NULL; -} - - -/*------------------------------------------------------------------------ - * Another user has join the GroupChat, add them to the member-list. - * - * @param session The MXit session object - * @param multimx The MultiMX room object - * @param nickname The nickname of the user who joined the room - */ -static void member_added(struct MXitSession* session, struct multimx* multimx, const char* nickname) -{ - PurpleConversation *convo; - - purple_debug_info(MXIT_PLUGIN_ID, "member_added: '%s'\n", nickname); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); - if (convo == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); - return; - } - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nickname, NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - - -/*------------------------------------------------------------------------ - * Another user has left the GroupChat, remove them from the member-list. - * - * @param session The MXit session object - * @param multimx The MultiMX room object - * @param nickname The nickname of the user who left the room - */ -static void member_removed(struct MXitSession* session, struct multimx* multimx, const char* nickname) -{ - PurpleConversation *convo; - - purple_debug_info(MXIT_PLUGIN_ID, "member_removed: '%s'\n", nickname); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); - if (convo == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); - return; - } - - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), nickname, NULL); -} - - -/*------------------------------------------------------------------------ - * Update the full GroupChat member list. - * - * @param session The MXit session object - * @param multimx The MultiMX room object - * @param data The nicknames of the users in the room (separated by \n) - */ -static void member_update(struct MXitSession* session, struct multimx* multimx, char* data) -{ - PurpleConversation *convo; - gchar** userlist; - int i = 0; - - purple_debug_info(MXIT_PLUGIN_ID, "member_update: '%s'\n", data); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc); - if (convo == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname); - return; - } - - /* Clear list */ - purple_conv_chat_clear_users(PURPLE_CONV_CHAT(convo)); - - /* Add each member */ - data = g_strstrip(data); /* string leading & trailing whitespace */ - userlist = g_strsplit(data, "\n", 0); /* tokenize string */ - while (userlist[i] != NULL) { - purple_debug_info(MXIT_PLUGIN_ID, "member_update - adding: '%s'\n", userlist[i]); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), userlist[i], NULL, PURPLE_CBFLAGS_NONE, FALSE); - i++; - } - g_strfreev(userlist); -} - - -/* ------------------------------------------------------------------------------------------------- - * Calls from MXit Protocol layer - * ------------------------------------------------------------------------------------------------- */ - -/*------------------------------------------------------------------------ - * Received a Subscription Request to a MultiMX room. - * - * @param session The MXit session object - * @param contact The invited MultiMX room's contact information - * @param creator The nickname of the room's creator / invitor - */ -void multimx_invite(struct MXitSession* session, struct contact* contact, const char* creator) -{ - GHashTable *components; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s' by '%s'\n", contact->alias, creator); - - /* Create a new room */ - multimx = room_create(session, contact->username, contact->alias, STATE_INVITED); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, g_strdup("room"), g_strdup(contact->alias)); - - /* Call libpurple - will trigger either 'mxit_chat_join' or 'mxit_chat_reject' */ - serv_got_chat_invite(session->con, contact->alias, creator, NULL, components); -} - - -/*------------------------------------------------------------------------ - * MultiMX room has been added to the roster. - * - * @param session The MXit session object - * @param contact The MultiMX room's contact information - */ -void multimx_created(struct MXitSession* session, struct contact* contact) -{ - PurpleConnection *gc = session->con; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat '%s' created as '%s'\n", contact->alias, contact->username); - - /* Find matching MultiMX group */ - multimx = find_room_by_username(session, contact->username); - if (multimx == NULL) { - multimx = room_create(session, contact->username, contact->alias, TRUE); - } - else if (multimx->state == STATE_INVITED) { - /* After successfully accepting an invitation */ - multimx->state = STATE_JOINED; - } - - /* Call libpurple - will trigger 'mxit_chat_join' */ - serv_got_joined_chat(gc, multimx->chatid, multimx->roomname); - - /* Send ".list" command to GroupChat server to retrieve current member-list */ - mxit_send_message(session, multimx->roomid, ".list", FALSE); -} - - -/*------------------------------------------------------------------------ - * Is this username a MultiMX contact? - * - * @param session The MXit session object - * @param username The username of the contact - * @return TRUE if this contacts matches the RoomID of a MultiMX room. - */ -gboolean is_multimx_contact(struct MXitSession* session, const char* username) -{ - /* Check for username in list of open rooms */ - return (find_room_by_username(session, username) != NULL); -} - - -/*------------------------------------------------------------------------ - * Received a message from a MultiMX room. - * - */ -void multimx_message_received(struct RXMsgData* mx, char* msg, int msglen, short msgtype, int msgflags) -{ - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat message received: %s\n", msg); - - /* Find matching multimx group */ - multimx = find_room_by_username(mx->session, mx->from); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Groupchat '%s' not found\n", mx->from); - return; - } - - /* Determine if system message or a message from a contact */ - if (msg[0] == '<') { - /* Message contains embedded nickname - must be from contact */ - unsigned int i; - - for (i = 1; i < strlen(msg); i++) { /* search for end of nickname */ - if (msg[i] == '>') { - msg[i] = '\0'; - g_free(mx->from); - mx->from = g_strdup(&msg[1]); - msg = &msg[i+2]; /* skip '>' and newline */ - break; - } - } - - /* now do markup processing on the message */ - mx->chatid = multimx->chatid; - mxit_parse_markup(mx, msg, strlen(msg), msgtype, msgflags); - } - else { - /* Must be a service message */ - char* ofs; - - /* Determine if somebody has joined or left - update member-list */ - if ((ofs = strstr(msg, " has joined")) != NULL) { - /* Somebody has joined */ - *ofs = '\0'; - member_added(mx->session, multimx, msg); - mx->processed = TRUE; - } - else if ((ofs = strstr(msg, " has left")) != NULL) { - /* Somebody has left */ - *ofs = '\0'; - member_removed(mx->session, multimx, msg); - mx->processed = TRUE; - } - else if (g_str_has_prefix(msg, "The following users are in this MultiMx:") == TRUE) { - member_update(mx->session, multimx, msg + strlen("The following users are in this MultiMx:") + 1); - mx->processed = TRUE; - } - else { - /* Display server message in chat window */ - serv_got_chat_in(mx->session->con, multimx->chatid, "MXit", PURPLE_MESSAGE_SYSTEM, msg, mx->timestamp); - mx->processed = TRUE; - } - } -} - - - -/* ------------------------------------------------------------------------------------------------- - * Callbacks from libpurple - * ------------------------------------------------------------------------------------------------- */ - -/*------------------------------------------------------------------------ - * User has selected "Add Chat" from the main menu. - * - * @param gc The connection object - * @return A list of chat configuration values - */ -GList* mxit_chat_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - /* Configuration option: Room Name */ - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _( "_Room Name:" ); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - - -/*------------------------------------------------------------------------ - * User has joined a chatroom, either because they are creating it or they - * accepted an invite. - * - * @param gc The connection object - * @param components The list of chat configuration values - */ -void mxit_chat_join(PurpleConnection *gc, GHashTable *components) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* roomname = NULL; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "mxit_chat_join\n"); - - /* Determine if groupchat already exists */ - roomname = g_hash_table_lookup(components, "room"); - multimx = find_room_by_alias(session, roomname); - - if (multimx != NULL) { - /* The room information already exists */ - - if (multimx->state == STATE_INVITED) { - /* Invite is pending */ - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i accept sent\n", multimx->chatid); - - /* Send Subscription Accept to MXit */ - mxit_send_allow_sub(session, multimx->roomid, multimx->roomname); - } - else { - /* Join existing room */ - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i rejoined\n", multimx->chatid); - - serv_got_joined_chat(gc, multimx->chatid, multimx->roomname); - } - } - else { - /* Send Groupchat Create to MXit */ - mxit_send_groupchat_create(session, roomname, 0, NULL); - } -} - - -/*------------------------------------------------------------------------ - * User has rejected an invite to join a MultiMX room. - * - * @param gc The connection object - * @param components The list of chat configuration values - */ -void mxit_chat_reject(PurpleConnection *gc, GHashTable* components) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* roomname = NULL; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "mxit_chat_reject\n"); - - roomname = g_hash_table_lookup(components, "room"); - multimx = find_room_by_alias(session, roomname); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Groupchat '%s' not found\n", roomname); - return; - } - - /* Send Subscription Reject to MXit */ - mxit_send_deny_sub(session, multimx->roomid); - - /* Remove from our list of rooms */ - room_remove(session, multimx); -} - - -/*------------------------------------------------------------------------ - * Return name of chatroom (on mouse hover) - * - * @param components The list of chat configuration values. - * @return The name of the chat room - */ -char* mxit_chat_name(GHashTable *components) -{ - return g_strdup(g_hash_table_lookup(components, "room")); -} - - -/*------------------------------------------------------------------------ - * User has selected to invite somebody to a chatroom. - * - * @param gc The connection object - * @param id The chat room ID - * @param msg The invitation message entered by the user - * @param name The username of the person to invite - */ -void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *username) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s'\n", username); - - /* Find matching MultiMX group */ - multimx = find_room_by_id(session, id); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Could not find groupchat %i\n", id); - return; - } - - /* Send invite to MXit */ - mxit_send_groupchat_invite(session, multimx->roomid, 1, &username); -} - - -/*------------------------------------------------------------------------ - * User as closed the chat window, and the chatroom is not marked as persistent. - * - * @param gc The connection object - * @param id The chat room ID - */ -void mxit_chat_leave(PurpleConnection *gc, int id) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct multimx* multimx = NULL; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i leave\n", id); - - /* Find matching multimx group */ - multimx = find_room_by_id(session, id); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Could not find groupchat %i\n", id); - return; - } - - /* Send Remove Groupchat to MXit */ - mxit_send_remove(session, multimx->roomid); - - /* Remove from our list of rooms */ - room_remove(session, multimx); -} - - -/*------------------------------------------------------------------------ - * User has entered a message in a chatroom window, send it to the MXit server. - * - * @param gc The connection object - * @param id The chat room ID - * @param message The sent message data - * @param flags The message flags - * @return Indicates success / failure - */ -int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - struct multimx* multimx = NULL; - const char* nickname; - - purple_debug_info(MXIT_PLUGIN_ID, "Groupchat %i message send: '%s'\n", id, message); - - /* Find matching MultiMX group */ - multimx = find_room_by_id(session, id); - if (multimx == NULL) { - purple_debug_error(MXIT_PLUGIN_ID, "Could not find groupchat %i\n", id); - return -1; - } - - /* Send packet to MXit */ - mxit_send_message(session, multimx->roomid, message, TRUE); - - /* Determine our nickname to display */ - if (session->profile && (session->profile->nickname[0] != '\0')) /* default is profile name (since that's what everybody else sees) */ - nickname = session->profile->nickname; - else - nickname = purple_account_get_alias(purple_connection_get_account(gc)); /* local alias */ - - /* Display message in chat window */ - serv_got_chat_in(gc, id, nickname, flags, message, time(NULL)); - - return 0; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/multimx.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/multimx.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/multimx.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/multimx.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MultiMx GroupChat -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_MULTIMX_H_ -#define _MXIT_MULTIMX_H_ - -#include "roster.h" - - -/* GroupChat Room state */ -#define STATE_CREATOR 0 -#define STATE_INVITED 1 -#define STATE_JOINED 2 - -/* - * a MultiMX room - */ -struct multimx { - char roomname[MXIT_CP_MAX_ALIAS_LEN]; /* name of the room */ - char roomid[MXIT_CP_MAX_JID_LEN]; /* internal JID for room */ - int chatid; /* libpurple chat ID */ - short state; /* state */ -}; - - -/* - * Received a Subscription Request to a MultiMX room. - */ -void multimx_invite(struct MXitSession* session, struct contact* contact, const char* creator); - -/* - * MultiMX room has been added to the roster. - */ -void multimx_created(struct MXitSession* session, struct contact* contact); - -/* - * Is this username a MultiMX contact? - */ -gboolean is_multimx_contact(struct MXitSession* session, const char* username); - -/* - * Received a message from a MultiMX room. - */ -void multimx_message_received(struct RXMsgData* mx, char* message, int len, short msgtype, int msgflags); - -/* - * User has selected "Add Chat" from the main menu. - */ -GList* mxit_chat_info(PurpleConnection *gc); - -/* - * User has joined a chatroom, either because they are creating it or they accepted an invite. - */ -void mxit_chat_join(PurpleConnection *gc, GHashTable *data); - -/* - * User has rejected an invite to join a MultiMX room. - */ -void mxit_chat_reject(PurpleConnection *gc, GHashTable* components); - -/* - * Return name of chatroom (on mouse hover) - */ -char* mxit_chat_name(GHashTable *data); - -/* - * User has selected to invite somebody to a chatroom. - */ -void mxit_chat_invite(PurpleConnection *gc, int id, const char *msg, const char *name); - -/* - * User as closed the chat window, and the chatroom is not marked as persistent. - */ -void mxit_chat_leave(PurpleConnection *gc, int id); - -/* - * User has entered a message in a chatroom window, send it to the MXit server. - */ -int mxit_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); - - -#endif /* _MXIT_MULTIMX_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,692 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit libPurple plugin API -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" -#include "notify.h" -#include "plugin.h" -#include "version.h" - -#include "mxit.h" -#include "protocol.h" -#include "login.h" -#include "roster.h" -#include "chunk.h" -#include "filexfer.h" -#include "actions.h" -#include "multimx.h" - - -#ifdef MXIT_LINK_CLICK - - -/* pidgin callback function pointers for URI click interception */ -static void *(*mxit_pidgin_uri_cb)(const char *uri); -static PurpleNotifyUiOps* mxit_nots_override_original; -static PurpleNotifyUiOps mxit_nots_override; -static int not_link_ref_count = 0; - - -/*------------------------------------------------------------------------ - * Handle an URI clicked on the UI - * - * @param link the link name which has been clicked - */ -static void* mxit_link_click( const char* link64 ) -{ - PurpleAccount* account; - PurpleConnection* con; - gchar** parts = NULL; - gchar* link = NULL; - gsize len; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_link_click (%s)\n", link64 ); - - if ( g_ascii_strncasecmp( link64, MXIT_LINK_PREFIX, strlen( MXIT_LINK_PREFIX ) ) != 0 ) { - /* this is not for us */ - goto skip; - } - - /* decode the base64 payload */ - link = (gchar*) purple_base64_decode( link64 + strlen( MXIT_LINK_PREFIX ), &len ); - purple_debug_info( MXIT_PLUGIN_ID, "Clicked Link: '%s'\n", link ); - - parts = g_strsplit( link, "|", 5 ); - - /* check if this is a valid mxit link */ - if ( ( !parts ) || ( !parts[0] ) || ( !parts[1] ) || ( !parts[2] ) || ( !parts[3] ) || ( !parts[4] ) ) { - /* this is not for us */ - goto skip; - } - else if ( g_ascii_strcasecmp( parts[0], MXIT_LINK_KEY ) != 0 ) { - /* this is not for us */ - goto skip; - } - - /* find the account */ - account = purple_accounts_find( parts[1], parts[2] ); - if ( !account ) - goto skip; - con = purple_account_get_connection( account ); - - /* send click message back to MXit */ - mxit_send_message( con->proto_data, parts[3], parts[4], FALSE ); - - g_free( link ); - link = NULL; - g_strfreev( parts ); - parts = NULL; - - return (void*) link64; - -skip: - /* this is not an internal mxit link */ - - if ( link ) - g_free( link ); - link = NULL; - - if ( parts ) - g_strfreev( parts ); - parts = NULL; - - if ( mxit_pidgin_uri_cb ) - return mxit_pidgin_uri_cb( link64 ); - else - return (void*) link64; -} - - -/*------------------------------------------------------------------------ - * Register MXit to receive URI click notifications from the UI - */ -void mxit_register_uri_handler(void) -{ - not_link_ref_count++; - if ( not_link_ref_count == 1 ) { - /* make copy of notifications */ - mxit_nots_override_original = purple_notify_get_ui_ops(); - memcpy( &mxit_nots_override, mxit_nots_override_original, sizeof( PurpleNotifyUiOps ) ); - - /* save previously configured callback function pointer */ - mxit_pidgin_uri_cb = mxit_nots_override.notify_uri; - - /* override the URI function call with MXit's own one */ - mxit_nots_override.notify_uri = mxit_link_click; - purple_notify_set_ui_ops( &mxit_nots_override ); - } -} - - -/*------------------------------------------------------------------------ - * Unegister MXit from receiving URI click notifications from the UI - */ -static void mxit_unregister_uri_handler() -{ - not_link_ref_count--; - if ( not_link_ref_count == 0 ) { - /* restore the notifications to its original state */ - purple_notify_set_ui_ops( mxit_nots_override_original ); - } -} - -#endif - - -/*------------------------------------------------------------------------ - * This gets called when a new chat conversation is opened by the user - * - * @param conv The conversation object - * @param session The MXit session object - */ -static void mxit_cb_chat_created( PurpleConversation* conv, struct MXitSession* session ) -{ - PurpleConnection* gc; - struct contact* contact; - PurpleBuddy* buddy; - const char* who; - char* tmp; - - gc = purple_conversation_get_gc( conv ); - if ( session->con != gc ) { - /* not our conversation */ - return; - } - else if ( purple_conversation_get_type( conv ) != PURPLE_CONV_TYPE_IM ) { - /* wrong type of conversation */ - return; - } - - /* get the contact name */ - who = purple_conversation_get_name( conv ); - if ( !who ) - return; - - purple_debug_info( MXIT_PLUGIN_ID, "Conversation started with '%s'\n", who ); - - /* find the buddy object */ - buddy = purple_find_buddy( session->acc, who ); - if ( ( !buddy ) || ( !buddy->proto_data ) ) - return; - - /* we ignore all conversations with which we have chatted with in this session */ - if ( find_active_chat( session->active_chats, who ) ) - return; - - /* determite if this buddy is a MXit service */ - contact = buddy->proto_data; - switch ( contact->type ) { - case MXIT_TYPE_BOT : - case MXIT_TYPE_CHATROOM : - case MXIT_TYPE_GALLERY : - case MXIT_TYPE_INFO : - tmp = g_strdup_printf("%s\n", _( "Loading menu..." )); - serv_got_im( session->con, who, tmp, PURPLE_MESSAGE_NOTIFY, time( NULL ) ); - g_free(tmp); - mxit_send_message( session, who, " ", FALSE ); - default : - break; - } -} - - -/*------------------------------------------------------------------------ - * Enable some signals to handled by our plugin - * - * @param session The MXit session object - */ -void mxit_enable_signals( struct MXitSession* session ) -{ - /* enable the signal when a new conversation is opened by the user */ - purple_signal_connect_priority( purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK( mxit_cb_chat_created ), - session, PURPLE_SIGNAL_PRIORITY_HIGHEST ); -} - - -/*------------------------------------------------------------------------ - * Disable some signals handled by our plugin - * - * @param session The MXit session object - */ -static void mxit_disable_signals( struct MXitSession* session ) -{ - /* disable the signal when a new conversation is opened by the user */ - purple_signal_disconnect( purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK( mxit_cb_chat_created ) ); -} - - -/*------------------------------------------------------------------------ - * Return the base icon name. - * - * @param account The MXit account object - * @param buddy The buddy - * @return The icon name (excluding extension) - */ -static const char* mxit_list_icon( PurpleAccount* account, PurpleBuddy* buddy ) -{ - return "mxit"; -} - - -/*------------------------------------------------------------------------ - * Return the emblem icon name. - * - * @param buddy The buddy - * @return The icon name (excluding extension) - */ -static const char* mxit_list_emblem( PurpleBuddy* buddy ) -{ - struct contact* contact = buddy->proto_data; - - if ( !contact ) - return NULL; - - switch ( contact-> type ) { - case MXIT_TYPE_JABBER : /* external contacts via MXit */ - case MXIT_TYPE_MSN : - case MXIT_TYPE_YAHOO : - case MXIT_TYPE_ICQ : - case MXIT_TYPE_AIM : - case MXIT_TYPE_QQ : - case MXIT_TYPE_WV : - return "external"; - - case MXIT_TYPE_BOT : /* MXit services */ - case MXIT_TYPE_GALLERY : - case MXIT_TYPE_INFO : - return "bot"; - - case MXIT_TYPE_CHATROOM : /* MXit group chat services */ - case MXIT_TYPE_MULTIMX : - default: - return NULL; - } -} - - -/*------------------------------------------------------------------------ - * Return short string representing buddy's status for display on buddy list. - * Returns status message (if one is set), or otherwise the mood. - * - * @param buddy The buddy. - * @return The status text - */ -char* mxit_status_text( PurpleBuddy* buddy ) -{ - struct contact* contact = buddy->proto_data; - - if ( !contact ) - return NULL; - - if ( contact->statusMsg ) { - /* status message */ - return g_strdup( contact-> statusMsg ); - } - else { - /* mood */ - return g_strdup( mxit_convert_mood_to_name( contact->mood ) ); - } -} - - -/*------------------------------------------------------------------------ - * Return UI tooltip information for a buddy when hovering in buddy list. - * - * @param buddy The buddy - * @param info The tooltip info being returned - * @param full Return full or summarized information - */ -static void mxit_tooltip( PurpleBuddy* buddy, PurpleNotifyUserInfo* info, gboolean full ) -{ - struct contact* contact = buddy->proto_data; - - if ( !contact ) - return; - - /* status (reference: "libpurple/notify.h") */ - if ( contact->presence != MXIT_PRESENCE_OFFLINE ) - purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); - - /* status message */ - if ( contact->statusMsg ) - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); - - /* mood */ - if ( contact->mood != MXIT_MOOD_NONE ) - purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); - - /* subscription type */ - if ( contact->subtype != 0 ) - purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); - - /* hidden number */ - if ( contact->flags & MXIT_CFLAG_HIDDEN ) - purple_notify_user_info_add_pair( info, _( "Hidden Number" ), _( "Yes" ) ); -} - - -/*------------------------------------------------------------------------ - * Initiate the logout sequence, close the connection and clear the session data. - * - * @param gc The connection object - */ -static void mxit_close( PurpleConnection* gc ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - /* disable signals */ - mxit_disable_signals( session ); - - /* close the connection */ - mxit_close_connection( session ); - -#ifdef MXIT_LINK_CLICK - /* unregister for uri click notification */ - mxit_unregister_uri_handler(); -#endif - - purple_debug_info( MXIT_PLUGIN_ID, "Releasing the session object..\n" ); - - /* free the session memory */ - g_free( session ); - session = NULL; -} - - -/*------------------------------------------------------------------------ - * Send a message to a contact - * - * @param gc The connection object - * @param who The username of the recipient - * @param message The message text - * @param flags Message flags (defined in conversation.h) - * @return Positive value (success, and echo to conversation window) - Zero (success, no echo) - Negative value (error) - */ -static int mxit_send_im( PurpleConnection* gc, const char* who, const char* message, PurpleMessageFlags flags ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who ); - - mxit_send_message( gc->proto_data, who, message, TRUE ); - - return 1; /* echo to conversation window */ -} - - -/*------------------------------------------------------------------------ - * The user changed their current presence state. - * - * @param account The MXit account object - * @param status The new status (libPurple status type) - */ -static void mxit_set_status( PurpleAccount* account, PurpleStatus* status ) -{ - struct MXitSession* session = purple_account_get_connection( account )->proto_data; - const char* statusid; - int presence; - char* statusmsg1; - char* statusmsg2; - - /* get the status id (reference: "libpurple/status.h") */ - statusid = purple_status_get_id( status ); - - /* convert the purple status to a mxit status */ - presence = mxit_convert_presence( statusid ); - if ( presence < 0 ) { - /* error, status not found */ - purple_debug_info( MXIT_PLUGIN_ID, "Presence status NOT found! (id = %s)\n", statusid ); - return; - } - - statusmsg1 = purple_markup_strip_html( purple_status_get_attr_string( status, "message" ) ); - statusmsg2 = g_strndup( statusmsg1, CP_MAX_STATUS_MSG ); - purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_status: '%s'\n", statusmsg2 ); - - /* update presence state */ - mxit_send_presence( session, presence, statusmsg2 ); - - g_free( statusmsg1 ); - g_free( statusmsg2 ); -} - - -/*------------------------------------------------------------------------ - * MXit supports messages to offline contacts. - * - * @param buddy The buddy - */ -static gboolean mxit_offline_message( const PurpleBuddy *buddy ) -{ - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Free the resources used to store a buddy. - * - * @param buddy The buddy - */ -static void mxit_free_buddy( PurpleBuddy* buddy ) -{ - struct contact* contact; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_free_buddy\n" ); - - contact = buddy->proto_data; - if ( contact ) { - if ( contact->statusMsg ) - g_free( contact->statusMsg ); - if ( contact->avatarId ) - g_free( contact->avatarId ); - g_free( contact ); - } - buddy->proto_data = NULL; -} - - -/*------------------------------------------------------------------------ - * Periodic task called every KEEPALIVE_INTERVAL (30 sec) to to maintain - * idle connections, timeouts and the transmission queue to the MXit server. - * - * @param gc The connection object - */ -static void mxit_keepalive( PurpleConnection *gc ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - /* if not logged in, there is nothing to do */ - if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) - return; - - /* pinging is only for socket connections (HTTP does polling) */ - if ( session->http ) - return; - - if ( session->last_tx <= time( NULL ) - MXIT_PING_INTERVAL ) { - /* - * this connection has been idle for too long, better ping - * the server before it kills our connection. - */ - mxit_send_ping( session ); - } -} - - -/*------------------------------------------------------------------------ - * Set or clear our Buddy icon. - * - * @param gc The connection object - * @param img The buddy icon data - */ -static void mxit_set_buddy_icon( PurpleConnection *gc, PurpleStoredImage *img ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - if ( img == NULL ) - mxit_set_avatar( session, NULL, 0 ); - else - mxit_set_avatar( session, purple_imgstore_get_data( img ), purple_imgstore_get_size( img ) ); -} - - -/*------------------------------------------------------------------------ - * Request profile information for another MXit contact. - * - * @param gc The connection object - * @param who The username of the contact. - */ -static void mxit_get_info( PurpleConnection *gc, const char *who ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME, - CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL }; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_info: '%s'\n", who ); - - - /* send profile request */ - mxit_send_extprofile_request( session, who, ARRAY_SIZE( profilelist ), profilelist ); -} - - -/*------------------------------------------------------------------------ - * Return a list of labels to be used by Pidgin for assisting the user. - */ -static GHashTable* mxit_get_text_table( PurpleAccount* acc ) -{ - GHashTable* table; - - table = g_hash_table_new( g_str_hash, g_str_equal ); - - g_hash_table_insert( table, "login_label", (gpointer)_( "Your Mobile Number..." ) ); - - return table; -} - -/*========================================================================================================================*/ - -static PurplePluginProtocolInfo proto_info = { - OPT_PROTO_REGISTER_NOSCREENNAME | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_IM_IMAGE, /* options */ - NULL, /* user_splits */ - NULL, /* protocol_options */ - { /* icon_spec */ - "png", /* format */ - 32, 32, /* min width & height */ - MXIT_AVATAR_SIZE, /* max width */ - MXIT_AVATAR_SIZE, /* max height */ - 100000, /* max filezize */ - PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY /* scaling rules */ - }, - mxit_list_icon, /* list_icon */ - mxit_list_emblem, /* list_emblem */ - mxit_status_text, /* status_text */ - mxit_tooltip, /* tooltip_text */ - mxit_status_types, /* status types [roster.c] */ - NULL, /* blist_node_menu */ - mxit_chat_info, /* chat_info [multimx.c] */ - NULL, /* chat_info_defaults */ - mxit_login, /* login [login.c] */ - mxit_close, /* close */ - mxit_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - mxit_get_info, /* get_info */ - mxit_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - mxit_add_buddy, /* add_buddy [roster.c] */ - NULL, /* add_buddies */ - mxit_remove_buddy, /* remove_buddy [roster.c] */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - mxit_chat_join, /* join_chat [multimx.c] */ - mxit_chat_reject, /* reject chat invite [multimx.c] */ - mxit_chat_name, /* get_chat_name [multimx.c] */ - mxit_chat_invite, /* chat_invite [multimx.c] */ - mxit_chat_leave, /* chat_leave [multimx.c] */ - NULL, /* chat_whisper */ - mxit_chat_send, /* chat_send [multimx.c] */ - mxit_keepalive, /* keepalive */ - mxit_register, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - mxit_buddy_alias, /* alias_buddy [roster.c] */ - mxit_buddy_group, /* group_buddy [roster.c] */ - mxit_rename_group, /* rename_group [roster.c] */ - mxit_free_buddy, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - mxit_set_buddy_icon, /* set_buddy_icon */ - NULL, /* remove_group */ // TODO: Add function to move all contacts out of this group (cmd=30 - remove group)? - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - mxit_xfer_enabled, /* can_receive_file [filexfer.c] */ - mxit_xfer_tx, /* send_file [filexfer.c */ - mxit_xfer_new, /* new_xfer [filexfer.c] */ - mxit_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* attention_types */ - sizeof( PurplePluginProtocolInfo ), /* struct_size */ - mxit_get_text_table, /* get_account_text_table */ - NULL, - NULL -}; - - -static PurplePluginInfo plugin_info = { - PURPLE_PLUGIN_MAGIC, /* purple magic, this must always be PURPLE_PLUGIN_MAGIC */ - PURPLE_MAJOR_VERSION, /* libpurple version */ - PURPLE_MINOR_VERSION, /* libpurple version */ - PURPLE_PLUGIN_PROTOCOL, /* plugin type (connecting to another network) */ - NULL, /* UI requirement (NULL for core plugin) */ - 0, /* plugin flags (zero is default) */ - NULL, /* plugin dependencies (set this value to NULL no matter what) */ - PURPLE_PRIORITY_DEFAULT, /* libpurple priority */ - - MXIT_PLUGIN_ID, /* plugin id (must be unique) */ - MXIT_PLUGIN_NAME, /* plugin name (this will be displayed in the UI) */ - MXIT_PLUGIN_VERSION, /* version of the plugin */ - - MXIT_PLUGIN_SUMMARY, /* short summary of the plugin */ - MXIT_PLUGIN_DESC, /* description of the plugin (can be long) */ - MXIT_PLUGIN_EMAIL, /* plugin author name and email address */ - MXIT_PLUGIN_WWW, /* plugin website (to find new versions and reporting of bugs) */ - - NULL, /* function pointer for loading the plugin */ - NULL, /* function pointer for unloading the plugin */ - NULL, /* function pointer for destroying the plugin */ - - NULL, /* pointer to an UI-specific struct */ - &proto_info, /* pointer to either a PurplePluginLoaderInfo or PurplePluginProtocolInfo struct */ - NULL, /* pointer to a PurplePluginUiInfo struct */ - mxit_actions, /* function pointer where you can define plugin-actions */ - - /* padding */ - NULL, /* pointer reserved for future use */ - NULL, /* pointer reserved for future use */ - NULL, /* pointer reserved for future use */ - NULL /* pointer reserved for future use */ -}; - - -/*------------------------------------------------------------------------ - * Initialising the MXit plugin. - * - * @param plugin The plugin object - */ -static void init_plugin( PurplePlugin* plugin ) -{ - PurpleAccountOption* option; - - purple_debug_info( MXIT_PLUGIN_ID, "Loading MXit libPurple plugin...\n" ); - - /* Configuration options */ - - /* WAP server (reference: "libpurple/accountopt.h") */ - option = purple_account_option_string_new( _( "WAP Server" ), MXIT_CONFIG_WAPSERVER, DEFAULT_WAPSITE ); - proto_info.protocol_options = g_list_append( proto_info.protocol_options, option ); - - option = purple_account_option_bool_new( _( "Connect via HTTP" ), MXIT_CONFIG_USE_HTTP, FALSE ); - proto_info.protocol_options = g_list_append( proto_info.protocol_options, option ); - - option = purple_account_option_bool_new( _( "Enable splash-screen popup" ), MXIT_CONFIG_SPLASHPOPUP, FALSE ); - proto_info.protocol_options = g_list_append( proto_info.protocol_options, option ); -} - -PURPLE_INIT_PLUGIN( mxit, init_plugin, plugin_info ); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/mxit.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit libPurple plugin API -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_H_ -#define _MXIT_H_ - - -#include "internal.h" - - -#if defined( __APPLE__ ) -/* apple architecture */ -#ifndef HOST_NAME_MAX -#define HOST_NAME_MAX 512 -#endif -#elif defined( _WIN32 ) -/* windows architecture */ -#define HOST_NAME_MAX 512 -#include "libc_interface.h" -#elif defined( __linux__ ) -/* linux architecture */ -#include -#include -#include -#include -#include -#else -/* other architecture */ -#ifndef HOST_NAME_MAX -#define HOST_NAME_MAX 512 -#endif -#endif - - -#include "protocol.h" -#include "profile.h" - - -/* Plugin details */ -#define MXIT_PLUGIN_ID "prpl-loubserp-mxit" -#define MXIT_PLUGIN_NAME "MXit" -#define MXIT_PLUGIN_VERSION "2.3.0" -#define MXIT_PLUGIN_EMAIL "Pieter Loubser " -#define MXIT_PLUGIN_WWW "http://www.mxit.com" -#define MXIT_PLUGIN_SUMMARY "MXit Protocol Plugin" -#define MXIT_PLUGIN_DESC "MXit" - -#define MXIT_HTTP_USERAGENT "libpurple-"MXIT_PLUGIN_VERSION - - -/* default connection settings */ -#define DEFAULT_SERVER "stream.mxit.co.za" -#define DEFAULT_PORT 9119 -#define DEFAULT_WAPSITE "http://www.mxit.com" -#define DEFAULT_HTTP_SERVER "http://int.poll.mxit.com:80/mxit" - - -/* Purple account configuration variable names */ -#define MXIT_CONFIG_STATE "state" -#define MXIT_CONFIG_WAPSERVER "wap_server" -#define MXIT_CONFIG_DISTCODE "distcode" -#define MXIT_CONFIG_CLIENTKEY "clientkey" -#define MXIT_CONFIG_DIALCODE "dialcode" -#define MXIT_CONFIG_SERVER_ADDR "server" -#define MXIT_CONFIG_SERVER_PORT "port" -#define MXIT_CONFIG_HTTPSERVER "httpserver" -#define MXIT_CONFIG_SPLASHID "splashid" -#define MXIT_CONFIG_SPLASHCLICK "splashclick" -#define MXIT_CONFIG_SPLASHPOPUP "splashpopup" -#define MXIT_CONFIG_COUNTRYCODE "cc" -#define MXIT_CONFIG_LOCALE "locale" -#define MXIT_CONFIG_USE_HTTP "use_http" - - -/* account states */ -#define MXIT_STATE_LOGIN 0x00 -#define MXIT_STATE_REGISTER1 0x01 -#define MXIT_STATE_REGISTER2 0x02 - - -/* Client session flags */ -#define MXIT_FLAG_CONNECTED 0x01 /* established connection to the server */ -#define MXIT_FLAG_LOGGEDIN 0x02 /* user currently logged in */ -#define MXIT_FLAG_FIRSTROSTER 0x04 /* set to true once the first roster update has been recevied and processed */ - - -/* define this to enable the link clicking support */ -#define MXIT_LINK_CLICK - - -#ifdef MXIT_LINK_CLICK -#define MXIT_LINK_PREFIX "gopher://" -#define MXIT_LINK_KEY "MXIT" -#endif - - -#define ARRAY_SIZE( x ) ( sizeof( x ) / sizeof( x[0] ) ) - - -/* - * data structure containing all MXit session information - */ -struct MXitSession { - /* socket connection */ - char server[HOST_NAME_MAX]; /* MXit server name to connect to */ - int port; /* MXit server port to connect on */ - int fd; /* connection file descriptor */ - - /* http connection */ - gboolean http; /* connect to MXit via HTTP and not by socket */ - char http_server[HOST_NAME_MAX]; /* MXit HTTP server */ - unsigned int http_sesid; /* HTTP session id */ - unsigned int http_seqno; /* HTTP request sequence number */ - guint http_timer_id; /* timer resource id (pidgin) */ - int http_interval; /* poll inverval */ - time_t http_last_poll; /* the last time a poll has been sent */ - guint http_handler; /* HTTP connection handler */ - void* http_out_req; /* HTTP outstanding request */ - - /* client */ - struct login_data* logindata; - char* encpwd; /* encrypted password */ - char distcode[64]; /* distribution code */ - char clientkey[16]; /* client key */ - char dialcode[8]; /* dialing code */ - short flags; /* client session flags (see above) */ - - /* personal (profile) */ - struct MXitProfile* profile; /* user's profile information */ - int mood; /* user's current mood */ - - /* libpurple */ - PurpleAccount* acc; /* pointer to the libpurple internal account struct */ - PurpleConnection* con; /* pointer to the libpurple internal connection struct */ - - /* transmit */ - struct tx_queue queue; /* transmit packet queue (FIFO mode) */ - time_t last_tx; /* timestamp of last packet sent */ - int outack; /* outstanding ack packet */ - guint q_timer; /* timer handler for managing queue */ - - /* receive */ - char rx_lbuf[16]; /* receive byte buffer (socket packet length) */ - char rx_dbuf[CP_MAX_PACKET]; /* receive byte buffer (raw data) */ - unsigned int rx_i; /* receive buffer current index */ - int rx_res; /* amount of bytes still outstanding for the current packet */ - char rx_state; /* current receiver state */ - time_t last_rx; /* timestamp of last packet received */ - GList* active_chats; /* list of all our contacts we received messages from (active chats) */ - - /* groupchat */ - GList* rooms; /* active groupchat rooms */ - - /* inline images */ - GHashTable* iimages; /* table which maps inline images (including emoticons) to purple's imgstore id's */ -}; - - -char* mxit_status_text( PurpleBuddy* buddy ); -void mxit_enable_signals( struct MXitSession* session ); - -#ifdef MXIT_LINK_CLICK -void mxit_register_uri_handler(void); -#endif - - -#endif /* _MXIT_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user profile's -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "mxit.h" -#include "profile.h" -#include "roster.h" - - -/*------------------------------------------------------------------------ - * Returns true if it is a valid date. - * - * @param bday Date-of-Birth string - * @return TRUE if valid, else FALSE - */ -gboolean validateDate( const char* bday ) -{ - struct tm* tm; - time_t t; - int cur_year; - int max_days[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - char date[16]; - int year; - int month; - int day; - - /* validate length */ - if ( strlen( bday ) != 10 ) { - return FALSE; - } - - /* validate the format */ - if ( ( !isdigit( bday[0] ) ) || ( !isdigit( bday[1] ) ) || ( !isdigit( bday[2] ) ) || ( !isdigit( bday[3] ) ) || /* year */ - ( bday[4] != '-' ) || - ( !isdigit( bday[5] ) ) || ( !isdigit( bday[6] ) ) || /* month */ - ( bday[7] != '-' ) || - ( !isdigit( bday[8] ) ) || ( !isdigit( bday[9] ) ) ) { /* day */ - return FALSE; - } - - /* convert */ - t = time( NULL ); - tm = gmtime( &t ); - cur_year = tm->tm_year + 1900; - memcpy( date, bday, 10 ); - date[4] = '\0'; - date[7] = '\0'; - date[10] = '\0'; - year = atoi( &date[0] ); - month = atoi( &date[5] ); - day = atoi( &date[8] ); - - /* validate month */ - if ( ( month < 1 ) || ( month > 12 ) ) { - return FALSE; - } - - /* validate day */ - if ( ( day < 1 ) || ( day > max_days[month] ) ) { - return FALSE; - } - - /* validate year */ - if ( ( year < ( cur_year - 100 ) ) || ( year >= cur_year ) ) { - /* you are either tooo old or tooo young to join mxit... sorry */ - return FALSE; - } - - /* special case leap-year */ - if ( ( year % 4 != 0 ) && ( month == 2 ) && ( day == 29 ) ) { - /* cannot have 29 days in February in non leap-years! */ - return FALSE; - } - - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Display the profile information. - * - * @param session The MXit session object - * @param username The username who's profile information this is - * @param profile The profile - */ -void mxit_show_profile( struct MXitSession* session, const char* username, struct MXitProfile* profile ) -{ - PurpleNotifyUserInfo* info = purple_notify_user_info_new(); - struct contact* contact = NULL; - PurpleBuddy* buddy; - - buddy = purple_find_buddy( session->acc, username ); - if ( buddy ) { - purple_notify_user_info_add_pair( info, _( "Alias" ), buddy->alias ); - purple_notify_user_info_add_section_break( info ); - contact = buddy->proto_data; - } - - purple_notify_user_info_add_pair( info, _( "Nick Name" ), profile->nickname ); - purple_notify_user_info_add_pair( info, _( "Birthday" ), profile->birthday ); - purple_notify_user_info_add_pair( info, _( "Gender" ), profile->male ? _( "Male" ) : _( "Female" ) ); - purple_notify_user_info_add_pair( info, _( "Hidden Number" ), profile->hidden ? _( "Yes" ) : _( "No" ) ); - - purple_notify_user_info_add_section_break( info ); - - /* optional information */ - purple_notify_user_info_add_pair( info, _( "Title" ), profile->title ); - purple_notify_user_info_add_pair( info, _( "First Name" ), profile->firstname ); - purple_notify_user_info_add_pair( info, _( "Last Name" ), profile->lastname ); - purple_notify_user_info_add_pair( info, _( "Email" ), profile->email ); - - purple_notify_user_info_add_section_break( info ); - - if ( contact ) { - /* presence */ - purple_notify_user_info_add_pair( info, _( "Status" ), mxit_convert_presence_to_name( contact->presence ) ); - - /* mood */ - if ( contact->mood != MXIT_MOOD_NONE ) - purple_notify_user_info_add_pair( info, _( "Mood" ), mxit_convert_mood_to_name( contact->mood ) ); - else - purple_notify_user_info_add_pair( info, _( "Mood" ), _( "None" ) ); - - /* status message */ - if ( contact->statusMsg ) - purple_notify_user_info_add_pair( info, _( "Status Message" ), contact->statusMsg ); - - /* subscription type */ - purple_notify_user_info_add_pair( info, _( "Subscription" ), mxit_convert_subtype_to_name( contact->subtype ) ); - } - - purple_notify_userinfo( session->con, username, info, NULL, NULL ); - purple_notify_user_info_destroy( info ); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/profile.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user profile's -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_PROFILE_H_ -#define _MXIT_PROFILE_H_ - -#include - - -struct MXitProfile { - /* required */ - char loginname[64]; /* name user uses to log into MXit with (aka 'mxitid') */ - char nickname[64]; /* user's own display name (aka 'nickname', aka 'fullname', aka 'alias') in MXit */ - char birthday[16]; /* user's birthday "YYYY-MM-DD" */ - gboolean male; /* true if the user's gender is male (otherwise female) */ - char pin[16]; /* user's password */ - - /* optional */ - char title[32]; /* user's title */ - char firstname[64]; /* user's first name */ - char lastname[64]; /* user's last name (aka 'surname') */ - char email[64]; /* user's email address */ - char mobilenr[21]; /* user's mobile number */ - - gboolean hidden; /* set if the user's msisdn should remain hidden */ -}; - -struct MXitSession; -void mxit_show_profile( struct MXitSession* session, const char* username, struct MXitProfile* profile ); - -gboolean validateDate( const char* bday ); - - -#endif /* _MXIT_PROFILE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2438 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "roster.h" -#include "chunk.h" -#include "filexfer.h" -#include "markup.h" -#include "multimx.h" -#include "splashscreen.h" -#include "login.h" -#include "formcmds.h" -#include "http.h" - - -#define MXIT_MS_OFFSET 3 - -/* configure the right record terminator char to use */ -#define CP_REC_TERM ( ( session->http ) ? CP_HTTP_REC_TERM : CP_SOCK_REC_TERM ) - - - -/*------------------------------------------------------------------------ - * Display a notification popup message to the user. - * - * @param type The type of notification: - * - info: PURPLE_NOTIFY_MSG_INFO - * - warning: PURPLE_NOTIFY_MSG_WARNING - * - error: PURPLE_NOTIFY_MSG_ERROR - * @param heading Heading text - * @param message Message text - */ -void mxit_popup( int type, const char* heading, const char* message ) -{ - /* (reference: "libpurple/notify.h") */ - purple_notify_message( NULL, type, _( MXIT_POPUP_WIN_NAME ), heading, message, NULL, NULL ); -} - - -/*------------------------------------------------------------------------ - * For compatibility with legacy clients, all usernames are sent from MXit with a domain - * appended. For MXit contacts, this domain is set to "@m". This function strips - * those fake domains. - * - * @param username The username of the contact - */ -void mxit_strip_domain( char* username ) -{ - if ( g_str_has_suffix( username, "@m" ) ) - username[ strlen(username) - 2 ] = '\0'; -} - - -/*------------------------------------------------------------------------ - * Dump a byte buffer to the console for debugging purposes. - * - * @param buf The data - * @param len The data length - */ -void dump_bytes( struct MXitSession* session, const char* buf, int len ) -{ - char msg[( len * 3 ) + 1]; - int i; - - memset( msg, 0x00, sizeof( msg ) ); - - for ( i = 0; i < len; i++ ) { - if ( buf[i] == CP_REC_TERM ) /* record terminator */ - msg[i] = '!'; - else if ( buf[i] == CP_FLD_TERM ) /* field terminator */ - msg[i] = '^'; - else if ( buf[i] == CP_PKT_TERM ) /* packet terminator */ - msg[i] = '@'; - else if ( buf[i] < 0x20 ) - msg[i] = '_'; - else - msg[i] = buf[i]; - - } - - purple_debug_info( MXIT_PLUGIN_ID, "DUMP: '%s'\n", msg ); -} - - -/*------------------------------------------------------------------------ - * Determine if we have an active chat with a specific contact - * - * @param session The MXit session object - * @param who The contact name - * @return Return true if we have an active chat with the contact - */ -gboolean find_active_chat( const GList* chats, const char* who ) -{ - const GList* list = chats; - const char* chat = NULL; - - while ( list ) { - chat = (const char*) list->data; - - if ( strcmp( chat, who ) == 0 ) - return TRUE; - - list = g_list_next( list ); - } - - return FALSE; -} - - -/*======================================================================================================================== - * Low-level Packet transmission - */ - -/*------------------------------------------------------------------------ - * Remove next packet from transmission queue. - * - * @param session The MXit session object - * @return The next packet for transmission (or NULL) - */ -static struct tx_packet* pop_tx_packet( struct MXitSession* session ) -{ - struct tx_packet* packet = NULL; - - if ( session->queue.count > 0 ) { - /* dequeue the next packet */ - packet = session->queue.packets[session->queue.rd_i]; - session->queue.packets[session->queue.rd_i] = NULL; - session->queue.rd_i = ( session->queue.rd_i + 1 ) % MAX_QUEUE_SIZE; - session->queue.count--; - } - - return packet; -} - - -/*------------------------------------------------------------------------ - * Add packet to transmission queue. - * - * @param session The MXit session object - * @param packet The packet to transmit - * @return Return TRUE if packet was enqueue, or FALSE if queue is full. - */ -static gboolean push_tx_packet( struct MXitSession* session, struct tx_packet* packet ) -{ - if ( session->queue.count < MAX_QUEUE_SIZE ) { - /* enqueue packet */ - session->queue.packets[session->queue.wr_i] = packet; - session->queue.wr_i = ( session->queue.wr_i + 1 ) % MAX_QUEUE_SIZE; - session->queue.count++; - return TRUE; - } - else - return FALSE; /* queue is full */ -} - - -/*------------------------------------------------------------------------ - * Deallocate transmission packet. - * - * @param packet The packet to deallocate. - */ -static void free_tx_packet( struct tx_packet* packet ) -{ - g_free( packet->data ); - g_free( packet ); - packet = NULL; -} - - -/*------------------------------------------------------------------------ - * Flush all the packets from the tx queue and release the resources. - * - * @param session The MXit session object - */ -static void flush_queue( struct MXitSession* session ) -{ - struct tx_packet* packet; - - purple_debug_info( MXIT_PLUGIN_ID, "flushing the tx queue\n" ); - - while ( (packet = pop_tx_packet( session ) ) != NULL ) - free_tx_packet( packet ); -} - - -/*------------------------------------------------------------------------ - * TX Step 3: Write the packet data to the TCP connection. - * - * @param fd The file descriptor - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static int mxit_write_sock_packet( int fd, const char* pktdata, int pktlen ) -{ - int written; - int res; - - written = 0; - while ( written < pktlen ) { - res = write( fd, &pktdata[written], pktlen - written ); - if ( res <= 0 ) { - /* error on socket */ - if ( errno == EAGAIN ) - continue; - - purple_debug_error( MXIT_PLUGIN_ID, "Error while writing packet to MXit server (%i)\n", res ); - return -1; - } - written += res; - } - - return 0; -} - - -/*------------------------------------------------------------------------ - * Callback called for handling a HTTP GET response - * - * @param url_data libPurple internal object (see purple_util_fetch_url_request) - * @param user_data The MXit session object - * @param url_text The data returned (could be NULL if error) - * @param len The length of the data returned (0 if error) - * @param error_message Descriptive error message - */ -static void mxit_cb_http_rx( PurpleUtilFetchUrlData* url_data, gpointer user_data, const gchar* url_text, gsize len, const gchar* error_message ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - - /* clear outstanding request */ - session->http_out_req = NULL; - - if ( ( !url_text ) || ( len == 0 ) ) { - /* error with request */ - purple_debug_error( MXIT_PLUGIN_ID, "HTTP response error (%s)\n", error_message ); - return; - } - - /* convert the HTTP result */ - memcpy( session->rx_dbuf, url_text, len ); - session->rx_i = len; - - mxit_parse_packet( session ); -} - - -/*------------------------------------------------------------------------ - * TX Step 3: Write the packet data to the HTTP connection (GET style). - * - * @param session The MXit session object - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static void mxit_write_http_get( struct MXitSession* session, struct tx_packet* packet ) -{ - char* part = NULL; - char* url = NULL; - - if ( packet->datalen > 0 ) { - char* tmp = NULL; - - tmp = g_strndup( packet->data, packet->datalen ); - part = g_strdup( purple_url_encode( tmp ) ); - g_free( tmp ); - } - - url = g_strdup_printf( "%s?%s%s", session->http_server, purple_url_encode( packet->header ), ( !part ) ? "" : part ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP GET: '%s'\n", url ); -#endif - - /* send the HTTP request */ - session->http_out_req = purple_util_fetch_url_request( url, TRUE, MXIT_HTTP_USERAGENT, TRUE, NULL, FALSE, mxit_cb_http_rx, session ); - - g_free( url ); - if ( part ) - g_free( part ); -} - - -/*------------------------------------------------------------------------ - * TX Step 3: Write the packet data to the HTTP connection (POST style). - * - * @param session The MXit session object - * @param pktdata The packet data - * @param pktlen The length of the packet data - * @return Return -1 on error, otherwise 0 - */ -static void mxit_write_http_post( struct MXitSession* session, struct tx_packet* packet ) -{ - char request[256 + packet->datalen]; - int reqlen; - char* host_name; - int host_port; - gboolean ok; - - /* extract the HTTP host name and host port number to connect to */ - ok = purple_url_parse( session->http_server, &host_name, &host_port, NULL, NULL, NULL ); - if ( !ok ) { - purple_debug_error( MXIT_PLUGIN_ID, "HTTP POST error: (host name '%s' not valid)\n", session->http_server ); - } - - /* strip off the last '&' from the header */ - packet->header[packet->headerlen - 1] = '\0'; - packet->headerlen--; - - /* build the HTTP request packet */ - reqlen = g_snprintf( request, 256, - "POST %s?%s HTTP/1.1\r\n" - "User-Agent: " MXIT_HTTP_USERAGENT "\r\n" - "Content-Type: application/octet-stream\r\n" - "Host: %s\r\n" - "Content-Length: %d\r\n" - "\r\n", - session->http_server, - purple_url_encode( packet->header ), - host_name, - packet->datalen - MXIT_MS_OFFSET - ); - - /* copy over the packet body data (could be binary) */ - memcpy( request + reqlen, packet->data + MXIT_MS_OFFSET, packet->datalen - MXIT_MS_OFFSET ); - reqlen += packet->datalen; - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "HTTP POST:\n" ); - dump_bytes( session, request, reqlen ); -#endif - - /* send the request to the HTTP server */ - mxit_http_send_request( session, host_name, host_port, request, reqlen ); -} - - -/*------------------------------------------------------------------------ - * TX Step 2: Handle the transmission of the packet to the MXit server. - * - * @param session The MXit session object - * @param packet The packet to transmit - */ -static void mxit_send_packet( struct MXitSession* session, struct tx_packet* packet ) -{ - int res; - - if ( !( session->flags & MXIT_FLAG_CONNECTED ) ) { - /* we are not connected so ignore all packets to be send */ - purple_debug_error( MXIT_PLUGIN_ID, "Dropping TX packet (we are not connected)\n" ); - return; - } - - purple_debug_info( MXIT_PLUGIN_ID, "Packet send CMD:%i (%i)\n", packet->cmd, packet->headerlen + packet->datalen ); -#ifdef DEBUG_PROTOCOL - dump_bytes( session, packet->header, packet->headerlen ); - dump_bytes( session, packet->data, packet->datalen ); -#endif - - if ( !session->http ) { - /* socket connection */ - char data[packet->datalen + packet->headerlen]; - int datalen; - - /* create raw data buffer */ - memcpy( data, packet->header, packet->headerlen ); - memcpy( data + packet->headerlen, packet->data, packet->datalen ); - datalen = packet->headerlen + packet->datalen; - - res = mxit_write_sock_packet( session->fd, data, datalen ); - if ( res < 0 ) { - /* we must have lost the connection, so terminate it so that we can reconnect */ - purple_connection_error( session->con, _( "We have lost the connection to MXit. Please reconnect." ) ); - } - } - else { - /* http connection */ - - if ( packet->cmd == CP_CMD_MEDIA ) { - /* multimedia packets must be send with a HTTP POST */ - mxit_write_http_post( session, packet ); - } - else { - mxit_write_http_get( session, packet ); - } - } - - /* update the timestamp of the last-transmitted packet */ - session->last_tx = time( NULL ); - - /* - * we need to remember that we are still waiting for the ACK from - * the server on this request - */ - session->outack = packet->cmd; - - /* free up the packet resources */ - free_tx_packet( packet ); -} - - -/*------------------------------------------------------------------------ - * TX Step 1: Create a new Tx packet and queue it for sending. - * - * @param session The MXit session object - * @param data The packet data (payload) - * @param datalen The length of the packet data - * @param cmd The MXit command for this packet - */ -static void mxit_queue_packet( struct MXitSession* session, const char* data, int datalen, int cmd ) -{ - struct tx_packet* packet; - char header[256]; - int hlen; - - /* create a packet for sending */ - packet = g_new0( struct tx_packet, 1 ); - packet->data = g_malloc0( datalen ); - packet->cmd = cmd; - packet->headerlen = 0; - - /* create generic packet header */ - hlen = sprintf( header, "id=%s%c", session->acc->username, CP_REC_TERM ); /* client msisdn */ - - if ( session->http ) { - /* http connection only */ - hlen += sprintf( header + hlen, "s=" ); - if ( session->http_sesid > 0 ) { - hlen += sprintf( header + hlen, "%u%c", session->http_sesid, CP_FLD_TERM ); /* http session id */ - } - session->http_seqno++; - hlen += sprintf( header + hlen, "%u%c", session->http_seqno, CP_REC_TERM ); /* http request sequence id */ - } - - hlen += sprintf( header + hlen, "cm=%i%c", cmd, CP_REC_TERM ); /* packet command */ - - if ( !session->http ) { - /* socket connection only */ - packet->headerlen += sprintf( packet->header, "ln=%i%c", ( datalen + hlen ), CP_REC_TERM ); /* packet length */ - } - - /* copy the header to packet */ - memcpy( packet->header + packet->headerlen, header, hlen ); - packet->headerlen += hlen; - - /* copy payload to packet */ - if ( datalen > 0 ) - memcpy( packet->data, data, datalen ); - packet->datalen = datalen; - - - /* - * shortcut: first check if there are any commands still outstanding. - * if not, then we might as well just write this packet directly and - * skip the whole queueing thing - */ - if ( session->outack == 0 ) { - /* no outstanding ACKs, so we might as well write it directly */ - mxit_send_packet( session, packet ); - } - else { - /* ACK still outstanding, so we need to queue this request until we have the ACK */ - - if ( ( packet->cmd == CP_CMD_PING ) || ( packet->cmd == CP_CMD_POLL ) ) { - /* we do NOT queue HTTP poll nor socket ping packets */ - free_tx_packet( packet ); - return; - } - - purple_debug_info( MXIT_PLUGIN_ID, "queueing packet for later sending cmd=%i\n", cmd ); - if ( !push_tx_packet( session, packet ) ) { - /* packet could not be queued for transmission */ - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Message Send Error" ), _( "Unable to process your request at this time" ) ); - free_tx_packet( packet ); - } - } -} - - -/*------------------------------------------------------------------------ - * Callback to manage the packet send queue (send next packet, timeout's, etc). - * - * @param session The MXit session object - */ -gboolean mxit_manage_queue( gpointer user_data ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - struct tx_packet* packet = NULL; - - if ( !( session->flags & MXIT_FLAG_CONNECTED ) ) { - /* we are not connected, so ignore the queue */ - return TRUE; - } - else if ( session->outack > 0 ) { - /* we are still waiting for an outstanding ACK from the MXit server */ - if ( session->last_tx <= time( NULL ) - MXIT_ACK_TIMEOUT ) { - /* ack timeout! so we close the connection here */ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_manage_queue: Timeout awaiting ACK for command '%X'\n", session->outack ); - purple_connection_error( session->con, _( "Timeout while waiting for a response from the MXit server." ) ); - } - return TRUE; - } - - packet = pop_tx_packet( session ); - if ( packet != NULL ) { - /* there was a packet waiting to be sent to the server, now is the time to do something about it */ - - /* send the packet to MXit server */ - mxit_send_packet( session, packet ); - } - - return TRUE; -} - - -/*------------------------------------------------------------------------ - * Callback to manage HTTP server polling (HTTP connections ONLY) - * - * @param session The MXit session object - */ -gboolean mxit_manage_polling( gpointer user_data ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - gboolean poll = FALSE; - time_t now = time( NULL ); - int polldiff; - int rxdiff; - - if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) { - /* we only poll if we are actually logged in */ - return TRUE; - } - - /* calculate the time differences */ - rxdiff = now - session->last_rx; - polldiff = now - session->http_last_poll; - - if ( rxdiff < MXIT_HTTP_POLL_MIN ) { - /* we received some reply a few moments ago, so reset the poll interval */ - session->http_interval = MXIT_HTTP_POLL_MIN; - } - else if ( session->http_last_poll < ( now - session->http_interval ) ) { - /* time to poll again */ - poll = TRUE; - - /* back-off some more with the polling */ - session->http_interval = session->http_interval + ( session->http_interval / 2 ); - if ( session->http_interval > MXIT_HTTP_POLL_MAX ) - session->http_interval = MXIT_HTTP_POLL_MAX; - } - - /* debugging */ - //purple_debug_info( MXIT_PLUGIN_ID, "POLL TIMER: %i (%i,%i)\n", session->http_interval, rxdiff, polldiff ); - - if ( poll ) { - /* send poll request */ - session->http_last_poll = time( NULL ); - mxit_send_poll( session ); - } - - return TRUE; -} - - -/*======================================================================================================================== - * Send MXit operations. - */ - -/*------------------------------------------------------------------------ - * Send a ping/keepalive packet to MXit server. - * - * @param session The MXit session object - */ -void mxit_send_ping( struct MXitSession* session ) -{ - /* queue packet for transmission */ - mxit_queue_packet( session, NULL, 0, CP_CMD_PING ); -} - - -/*------------------------------------------------------------------------ - * Send a poll request to the HTTP server (HTTP connections ONLY). - * - * @param session The MXit session object - */ -void mxit_send_poll( struct MXitSession* session ) -{ - /* queue packet for transmission */ - mxit_queue_packet( session, NULL, 0, CP_CMD_POLL ); -} - - -/*------------------------------------------------------------------------ - * Send a logout packet to the MXit server. - * - * @param session The MXit session object - */ -void mxit_send_logout( struct MXitSession* session ) -{ - /* queue packet for transmission */ - mxit_queue_packet( session, NULL, 0, CP_CMD_LOGOUT ); -} - - -/*------------------------------------------------------------------------ - * Send a register packet to the MXit server. - * - * @param session The MXit session object - */ -void mxit_send_register( struct MXitSession* session ) -{ - struct MXitProfile* profile = session->profile; - const char* locale; - char data[CP_MAX_PACKET]; - int datalen; - - locale = purple_account_get_string( session->acc, MXIT_CONFIG_LOCALE, MXIT_DEFAULT_LOCALE ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%i%c%s%c" /* "ms"=password\1version\1maxreplyLen\1name\1 */ - "%s%c%i%c%s%c%s%c" /* dateOfBirth\1gender\1location\1capabilities\1 */ - "%s%c%i%c%s%c%s", /* dc\1features\1dialingcode\1locale */ - session->encpwd, CP_FLD_TERM, MXIT_CP_VERSION, CP_FLD_TERM, CP_MAX_FILESIZE, CP_FLD_TERM, profile->nickname, CP_FLD_TERM, - profile->birthday, CP_FLD_TERM, ( profile->male ) ? 1 : 0, CP_FLD_TERM, MXIT_DEFAULT_LOC, CP_FLD_TERM, MXIT_CP_CAP, CP_FLD_TERM, - session->distcode, CP_FLD_TERM, MXIT_CP_FEATURES, CP_FLD_TERM, session->dialcode, CP_FLD_TERM, locale - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_REGISTER ); -} - - -/*------------------------------------------------------------------------ - * Send a login packet to the MXit server. - * - * @param session The MXit session object - */ -void mxit_send_login( struct MXitSession* session ) -{ - const char* splashId; - const char* locale; - char data[CP_MAX_PACKET]; - int datalen; - - locale = purple_account_get_string( session->acc, MXIT_CONFIG_LOCALE, MXIT_DEFAULT_LOCALE ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%i%c" /* "ms"=password\1version\1getContacts\1 */ - "%s%c%s%c%i%c" /* capabilities\1dc\1features\1 */ - "%s%c%s", /* dialingcode\1locale */ - session->encpwd, CP_FLD_TERM, MXIT_CP_VERSION, CP_FLD_TERM, 1, CP_FLD_TERM, - MXIT_CP_CAP, CP_FLD_TERM, session->distcode, CP_FLD_TERM, MXIT_CP_FEATURES, CP_FLD_TERM, - session->dialcode, CP_FLD_TERM, locale - ); - - /* include "custom resource" information */ - splashId = splash_current( session ); - if ( splashId != NULL ) - datalen += sprintf( data + datalen, "%ccr=%s", CP_REC_TERM, splashId ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_LOGIN ); -} - - -/*------------------------------------------------------------------------ - * Send a chat message packet to the MXit server. - * - * @param session The MXit session object - * @param to The username of the recipient - * @param msg The message text - */ -void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup ) -{ - char data[CP_MAX_PACKET]; - char* markuped_msg; - int datalen; - int msgtype = CP_MSGTYPE_NORMAL; - - /* first we need to convert the markup from libPurple to MXit format */ - if ( parse_markup ) - markuped_msg = mxit_convert_markup_tx( msg, &msgtype ); - else - markuped_msg = g_strdup( msg ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%i%c%i", /* "ms"=jid\1msg\1type\1flags */ - to, CP_FLD_TERM, markuped_msg, CP_FLD_TERM, msgtype, CP_FLD_TERM, CP_MSG_MARKUP | CP_MSG_EMOTICON - ); - - /* free the resources */ - g_free( markuped_msg ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_TX_MSG ); -} - - -/*------------------------------------------------------------------------ - * Send a extended profile request packet to the MXit server. - * - * @param session The MXit session object - * @param username Username who's profile is being requested (NULL = our own) - * @param nr_attribs Number of attributes being requested - * @param attributes The names of the attributes - */ -void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] ) -{ - char data[CP_MAX_PACKET]; - int datalen; - unsigned int i; - - datalen = sprintf( data, "ms=%s%c%i", /* "ms="mxitid\1nr_attributes */ - (username ? username : ""), CP_FLD_TERM, nr_attrib); - - /* add attributes */ - for ( i = 0; i < nr_attrib; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, attribute[i] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_GET ); -} - - -/*------------------------------------------------------------------------ - * Send an update profile packet to the MXit server. - * - * @param session The MXit session object - * @param password The new password to be used for logging in (optional) - * @param nr_attrib The number of attributes - * @param attributes String containing the attributes and settings seperated by '0x01' - */ -void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes ) -{ - char data[CP_MAX_PACKET]; - gchar** parts; - int datalen; - unsigned int i; - - parts = g_strsplit( attributes, "\01", ( MXIT_MAX_ATTRIBS * 3 ) ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%i", /* "ms"=password\1nr_attibutes */ - ( password ) ? password : "", CP_FLD_TERM, nr_attrib - ); - - /* add attributes */ - for ( i = 1; i < nr_attrib * 3; i+=3 ) - datalen += sprintf( data + datalen, "%c%s%c%s%c%s", /* \1name\1type\1value */ - CP_FLD_TERM, parts[i], CP_FLD_TERM, parts[i + 1], CP_FLD_TERM, parts[i + 2] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_EXTPROFILE_SET ); - - /* freeup the memory */ - g_strfreev( parts ); -} - - -/*------------------------------------------------------------------------ - * Send a presence update packet to the MXit server. - * - * @param session The MXit session object - * @param presence The presence (as per MXit types) - * @param statusmsg The status message (can be NULL) - */ -void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%i%c", /* "ms"=show\1status */ - presence, CP_FLD_TERM - ); - - /* append status message (if one is set) */ - if ( statusmsg ) - datalen += sprintf( data + datalen, "%s", statusmsg ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_STATUS ); -} - - -/*------------------------------------------------------------------------ - * Send a mood update packet to the MXit server. - * - * @param session The MXit session object - * @param mood The mood (as per MXit types) - */ -void mxit_send_mood( struct MXitSession* session, int mood ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%i", /* "ms"=mood */ - mood - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_MOOD ); -} - - -/*------------------------------------------------------------------------ - * Send an invite contact packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being invited - * @param alias Our alias for the contact - * @param groupname Group in which contact should be stored. - */ -void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%s%c%i%c%s", /* "ms"=group\1username\1alias\1type\1msg */ - groupname, CP_FLD_TERM, username, CP_FLD_TERM, alias, - CP_FLD_TERM, MXIT_TYPE_MXIT, CP_FLD_TERM, "" - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_INVITE ); -} - - -/*------------------------------------------------------------------------ - * Send a remove contact packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being removed - */ -void mxit_send_remove( struct MXitSession* session, const char* username ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s", /* "ms"=username */ - username - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_REMOVE ); -} - - -/*------------------------------------------------------------------------ - * Send an accept subscription (invite) packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being accepted - * @param alias Our alias for the contact - */ -void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%s", /* "ms"=username\1group\1alias */ - username, CP_FLD_TERM, "", CP_FLD_TERM, alias - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_ALLOW ); -} - - -/*------------------------------------------------------------------------ - * Send an deny subscription (invite) packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being denied - */ -void mxit_send_deny_sub( struct MXitSession* session, const char* username ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s", /* "ms"=username */ - username - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_DENY ); -} - - -/*------------------------------------------------------------------------ - * Send an update contact packet to the MXit server. - * - * @param session The MXit session object - * @param username The username of the contact being denied - * @param alias Our alias for the contact - * @param groupname Group in which contact should be stored. - */ -void mxit_send_update_contact( struct MXitSession* session, const char* username, const char* alias, const char* groupname ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%s%c%s", /* "ms"=groupname\1username\1alias */ - groupname, CP_FLD_TERM, username, CP_FLD_TERM, alias - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_UPDATE ); -} - - -/*------------------------------------------------------------------------ - * Send a splash-screen click event packet. - * - * @param session The MXit session object - * @param splashid The identifier of the splash-screen - */ -void mxit_send_splashclick( struct MXitSession* session, const char* splashid ) -{ - char data[CP_MAX_PACKET]; - int datalen; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s", /* "ms"=splashId */ - splashid - ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_SPLASHCLICK ); -} - - -/*------------------------------------------------------------------------ - * Send packet to create a MultiMX room. - * - * @param session The MXit session object - * @param groupname Name of the room to create - * @param nr_usernames Number of users in initial invite - * @param usernames The usernames of the users in the initial invite - */ -void mxit_send_groupchat_create( struct MXitSession* session, const char* groupname, int nr_usernames, const char* usernames[] ) -{ - char data[CP_MAX_PACKET]; - int datalen; - int i; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%i", /* "ms"=roomname\1nr_jids\1jid0\1..\1jidN */ - groupname, CP_FLD_TERM, nr_usernames - ); - - /* add usernames */ - for ( i = 0; i < nr_usernames; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_GRPCHAT_CREATE ); -} - - -/*------------------------------------------------------------------------ - * Send packet to invite users to existing MultiMX room. - * - * @param session The MXit session object - * @param roomid The unique RoomID for the MultiMx room. - * @param nr_usernames Number of users being invited - * @param usernames The usernames of the users being invited - */ - -void mxit_send_groupchat_invite( struct MXitSession* session, const char* roomid, int nr_usernames, const char* usernames[] ) -{ - char data[CP_MAX_PACKET]; - int datalen; - int i; - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=%s%c%i", /* "ms"=roomid\1nr_jids\1jid0\1..\1jidN */ - roomid, CP_FLD_TERM, nr_usernames - ); - - /* add usernames */ - for ( i = 0; i < nr_usernames; i++ ) - datalen += sprintf( data + datalen, "%c%s", CP_FLD_TERM, usernames[i] ); - - /* queue packet for transmission */ - mxit_queue_packet( session, data, datalen, CP_CMD_GRPCHAT_INVITE ); -} - - -/*------------------------------------------------------------------------ - * Send a "send file direct" multimedia packet. - * - * @param session The MXit session object - * @param username The username of the recipient - * @param filename The name of the file being sent - * @param buf The content of the file - * @param buflen The length of the file contents - */ -void mxit_send_file( struct MXitSession* session, const char* username, const char* filename, const unsigned char* buf, int buflen ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "SENDING FILE '%s' of %i bytes to user '%s'\n", filename, buflen, username ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_senddirect( chunk_data( chunk ), username, filename, buf, buflen ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating senddirect chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_DIRECT_SND ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "reject file" multimedia packet. - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - */ -void mxit_send_file_reject( struct MXitSession* session, const char* fileid ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_reject\n" ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_reject( chunk_data( chunk ), fileid ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating reject chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_REJECT ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "get file" multimedia packet. - * - * @param session The MXit session object - * @param fileid A unique ID that identifies this file - * @param filesize The number of bytes to retrieve - * @param offset Offset in file at which to start retrieving - */ -void mxit_send_file_accept( struct MXitSession* session, const char* fileid, int filesize, int offset ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_accept\n" ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_get( chunk_data(chunk), fileid, filesize, offset ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating getfile chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_GET ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "received file" multimedia packet. - * - * @param session The MXit session object - * @param status The status of the file-transfer - */ -void mxit_send_file_received( struct MXitSession* session, const char* fileid, short status ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_send_file_received\n" ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_received( chunk_data(chunk), fileid, status ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating received chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_RECIEVED ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "set avatar" multimedia packet. - * - * @param session The MXit session object - * @param data The avatar data - * @param buflen The length of the avatar data - */ -void mxit_set_avatar( struct MXitSession* session, const unsigned char* avatar, int avatarlen ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_set_avatar: %i bytes\n", avatarlen ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_set_avatar( chunk_data(chunk), avatar, avatarlen ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating set avatar chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_SET_AVATAR ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Send a "get avatar" multimedia packet. - * - * @param session The MXit session object - * @param mxitId The username who's avatar to request - * @param avatarId The id of the avatar image (as string) - * @param data The avatar data - * @param buflen The length of the avatar data - */ -void mxit_get_avatar( struct MXitSession* session, const char* mxitId, const char* avatarId ) -{ - char data[CP_MAX_PACKET]; - int datalen = 0; - gchar* chunk; - int size; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_get_avatar: %s\n", mxitId ); - - /* convert the packet to a byte stream */ - datalen = sprintf( data, "ms=" ); - - /* map chunk header over data buffer */ - chunk = &data[datalen]; - - size = mxit_chunk_create_get_avatar( chunk_data(chunk), mxitId, avatarId, MXIT_AVATAR_SIZE ); - if ( size < 0 ) { - purple_debug_error( MXIT_PLUGIN_ID, "Error creating get avatar chunk (%i)\n", size ); - return; - } - - set_chunk_type( chunk, CP_CHUNK_GET_AVATAR ); - set_chunk_length( chunk, size ); - datalen += MXIT_CHUNK_HEADER_SIZE + size; - - /* send the byte stream to the mxit server */ - mxit_queue_packet( session, data, datalen, CP_CMD_MEDIA ); -} - - -/*------------------------------------------------------------------------ - * Process a login message packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_login( struct MXitSession* session, struct record** records, int rcount ) -{ - PurpleStatus* status; - int presence; - const char* profilelist[] = { CP_PROFILE_BIRTHDATE, CP_PROFILE_GENDER, CP_PROFILE_HIDENUMBER, CP_PROFILE_FULLNAME, - CP_PROFILE_TITLE, CP_PROFILE_FIRSTNAME, CP_PROFILE_LASTNAME, CP_PROFILE_EMAIL, - CP_PROFILE_MOBILENR }; - - purple_account_set_int( session->acc, MXIT_CONFIG_STATE, MXIT_STATE_LOGIN ); - - /* we were not yet logged in so we need to complete the login sequence here */ - session->flags |= MXIT_FLAG_LOGGEDIN; - purple_connection_update_progress( session->con, _( "Successfully Logged In..." ), 3, 4 ); - purple_connection_set_state( session->con, PURPLE_CONNECTED ); - - /* display the current splash-screen */ - if ( splash_popup_enabled( session ) ) - splash_display( session ); - - /* update presence status */ - status = purple_account_get_active_status( session->acc ); - presence = mxit_convert_presence( purple_status_get_id( status ) ); - if ( presence != MXIT_PRESENCE_ONLINE ) { - /* when logging into MXit, your default presence is online. but with the UI, one can change - * the presence to whatever. in the case where its changed to a different presence setting - * we need to send an update to the server, otherwise the user's presence will be out of - * sync between the UI and MXit. - */ - mxit_send_presence( session, presence, purple_status_get_attr_string( status, "message" ) ); - } - - /* save extra info if this is a HTTP connection */ - if ( session->http ) { - /* save the http server to use for this session */ - g_strlcpy( session->http_server, records[1]->fields[3]->data, sizeof( session->http_server ) ); - - /* save the session id */ - session->http_sesid = atoi( records[0]->fields[0]->data ); - } - - /* retrieve our MXit profile */ - mxit_send_extprofile_request( session, NULL, ARRAY_SIZE( profilelist ), profilelist ); -} - - -/*------------------------------------------------------------------------ - * Process a received message packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_message( struct MXitSession* session, struct record** records, int rcount ) -{ - struct RXMsgData* mx = NULL; - char* message = NULL; - int msglen = 0; - int msgflags = 0; - int msgtype = 0; - - if ( ( rcount == 1 ) || ( records[0]->fcount < 2 ) || ( records[1]->fcount == 0 ) || ( records[1]->fields[0]->len == 0 ) ) { - /* packet contains no message or an empty message */ - return; - } - - message = records[1]->fields[0]->data; - msglen = strlen( message ); - - /* strip off dummy domain */ - mxit_strip_domain( records[0]->fields[0]->data ); - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "Message received from '%s'\n", records[0]->fields[0]->data ); -#endif - - /* decode message flags (if any) */ - if ( records[0]->fcount >= 5 ) - msgflags = atoi( records[0]->fields[4]->data ); - msgtype = atoi( records[0]->fields[2]->data ); - - if ( msgflags & CP_MSG_ENCRYPTED ) { - /* this is an encrypted message. we do not currently support those so ignore it */ - PurpleBuddy* buddy; - const char* name; - char msg[128]; - - buddy = purple_find_buddy( session->acc, records[0]->fields[0]->data ); - if ( buddy ) - name = purple_buddy_get_alias( buddy ); - else - name = records[0]->fields[0]->data; - g_snprintf( msg, sizeof( msg ), _( "%s sent you an encrypted message, but it is not supported on this client." ), name ); - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), msg ); - return; - } - - /* create and initialise new markup struct */ - mx = g_new0( struct RXMsgData, 1 ); - mx->msg = g_string_sized_new( msglen ); - mx->session = session; - mx->from = g_strdup( records[0]->fields[0]->data ); - mx->timestamp = atoi( records[0]->fields[1]->data ); - mx->got_img = FALSE; - mx->chatid = -1; - mx->img_count = 0; - - /* update list of active chats */ - if ( !find_active_chat( session->active_chats, mx->from ) ) { - session->active_chats = g_list_append( session->active_chats, g_strdup( mx->from ) ); - } - - if ( is_multimx_contact( session, mx->from ) ) { - /* this is a MultiMx chatroom message */ - multimx_message_received( mx, message, msglen, msgtype, msgflags ); - } - else { - mxit_parse_markup( mx, message, msglen, msgtype, msgflags ); - } - - /* we are now done parsing the message */ - mx->converted = TRUE; - if ( mx->img_count == 0 ) { - /* we have all the data we need for this message to be displayed now. */ - mxit_show_message( mx ); - } - else { - /* this means there are still images outstanding for this message and - * still need to wait for them before we can display the message. - * so the image received callback function will eventually display - * the message. */ - } -} - - -/*------------------------------------------------------------------------ - * Process a received subscription request packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_new_sub( struct MXitSession* session, struct record** records, int rcount ) -{ - struct contact* contact; - struct record* rec; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_new_sub (%i recs)\n", rcount ); - - for ( i = 0; i < rcount; i++ ) { - rec = records[i]; - - if ( rec->fcount < 4 ) { - purple_debug_error( MXIT_PLUGIN_ID, "BAD SUBSCRIPTION RECORD! %i fields\n", rec->fcount ); - break; - } - - /* build up a new contact info struct */ - contact = g_new0( struct contact, 1 ); - - strcpy( contact->username, rec->fields[0]->data ); - mxit_strip_domain( contact->username ); /* remove dummy domain */ - strcpy( contact->alias, rec->fields[1]->data ); - contact->type = atoi( rec->fields[2]->data ); - - if ( rec->fcount >= 5 ) { - /* there is a personal invite message attached */ - contact->msg = strdup( rec->fields[4]->data ); - } - else - contact->msg = NULL; - - /* handle the subscription */ - if ( contact-> type == MXIT_TYPE_MULTIMX ) { /* subscription to a MultiMX room */ - char* creator = NULL; - - if ( rec->fcount >= 6 ) - creator = rec->fields[5]->data; - - multimx_invite( session, contact, creator ); - } - else - mxit_new_subscription( session, contact ); - } -} - - -/*------------------------------------------------------------------------ - * Process a received contact update packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_contact( struct MXitSession* session, struct record** records, int rcount ) -{ - struct contact* contact = NULL; - struct record* rec; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_contact (%i recs)\n", rcount ); - - for ( i = 0; i < rcount; i++ ) { - rec = records[i]; - - if ( rec->fcount < 6 ) { - purple_debug_error( MXIT_PLUGIN_ID, "BAD CONTACT RECORD! %i fields\n", rec->fcount ); - break; - } - - /* build up a new contact info struct */ - contact = g_new0( struct contact, 1 ); - - strcpy( contact->groupname, rec->fields[0]->data ); - strcpy( contact->username, rec->fields[1]->data ); - mxit_strip_domain( contact->username ); /* remove dummy domain */ - strcpy( contact->alias, rec->fields[2]->data ); - - contact->presence = atoi( rec->fields[3]->data ); - contact->type = atoi( rec->fields[4]->data ); - contact->mood = atoi( rec->fields[5]->data ); - - if ( rec->fcount > 6 ) { - /* added in protocol 5.9.0 - flags & subtype */ - contact->flags = atoi( rec->fields[6]->data ); - contact->subtype = rec->fields[7]->data[0]; - } - - /* add the contact to the buddy list */ - if ( contact-> type == MXIT_TYPE_MULTIMX ) /* contact is a MultiMX room */ - multimx_created( session, contact ); - else - mxit_update_contact( session, contact ); - } - - if ( !( session->flags & MXIT_FLAG_FIRSTROSTER ) ) { - session->flags |= MXIT_FLAG_FIRSTROSTER; - mxit_update_blist( session ); - } -} - - -/*------------------------------------------------------------------------ - * Process a received presence update packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_presence( struct MXitSession* session, struct record** records, int rcount ) -{ - struct record* rec; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_presence (%i recs)\n", rcount ); - - for ( i = 0; i < rcount; i++ ) { - rec = records[i]; - - if ( rec->fcount < 6 ) { - purple_debug_error( MXIT_PLUGIN_ID, "BAD PRESENCE RECORD! %i fields\n", rec->fcount ); - break; - } - - /* - * The format of the record is: - * contactAddressN\1presenceN\1\moodN\1customMoodN\1statusMsgN\1avatarIdN - */ - mxit_strip_domain( rec->fields[0]->data ); /* contactAddress */ - - mxit_update_buddy_presence( session, rec->fields[0]->data, atoi( rec->fields[1]->data ), atoi( rec->fields[2]->data ), - rec->fields[3]->data, rec->fields[4]->data, rec->fields[5]->data ); - } -} - - -/*------------------------------------------------------------------------ - * Process a received extended profile packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_extprofile( struct MXitSession* session, struct record** records, int rcount ) -{ - const char* mxitId = records[0]->fields[0]->data; - struct MXitProfile* profile = NULL; - int count; - int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_extprofile: profile for '%s'\n", mxitId ); - - profile = g_new0( struct MXitProfile, 1 ); - - /* set the count for attributes */ - count = atoi( records[0]->fields[1]->data ); - - for ( i = 0; i < count; i++ ) { - char* fname; - char* fvalue; - char* fstatus; - int f = ( i * 3 ) + 2; - - fname = records[0]->fields[f]->data; /* field name */ - fvalue = records[0]->fields[f + 1]->data; /* field value */ - fstatus = records[0]->fields[f + 2]->data; /* field status */ - - /* first check the status on the returned attribute */ - if ( fstatus[0] != '0' ) { - /* error: attribute requested was NOT found */ - purple_debug_error( MXIT_PLUGIN_ID, "Bad profile status on attribute '%s' \n", fname ); - continue; - } - - if ( strcmp( CP_PROFILE_BIRTHDATE, fname ) == 0 ) { - /* birthdate */ - if ( records[0]->fields[f + 1]->len > 10 ) { - fvalue[10] = '\0'; - records[0]->fields[f + 1]->len = 10; - } - memcpy( profile->birthday, fvalue, records[0]->fields[f + 1]->len ); - } - else if ( strcmp( CP_PROFILE_GENDER, fname ) == 0 ) { - /* gender */ - profile->male = ( fvalue[0] == '1' ); - } - else if ( strcmp( CP_PROFILE_HIDENUMBER, fname ) == 0 ) { - /* hide number */ - profile->hidden = ( fvalue[0] == '1' ); - } - else if ( strcmp( CP_PROFILE_FULLNAME, fname ) == 0 ) { - /* nickname */ - g_strlcpy( profile->nickname, fvalue, sizeof( profile->nickname ) ); - } - else if ( strcmp( CP_PROFILE_AVATAR, fname ) == 0 ) { - /* avatar id, we just ingore it cause we dont need it */ - } - else if ( strcmp( CP_PROFILE_TITLE, fname ) == 0 ) { - /* title */ - g_strlcpy( profile->title, fvalue, sizeof( profile->title ) ); - } - else if ( strcmp( CP_PROFILE_FIRSTNAME, fname ) == 0 ) { - /* first name */ - g_strlcpy( profile->firstname, fvalue, sizeof( profile->firstname ) ); - } - else if ( strcmp( CP_PROFILE_LASTNAME, fname ) == 0 ) { - /* last name */ - g_strlcpy( profile->lastname, fvalue, sizeof( profile->lastname ) ); - } - else if ( strcmp( CP_PROFILE_EMAIL, fname ) == 0 ) { - /* email address */ - g_strlcpy( profile->email, fvalue, sizeof( profile->email ) ); - } - else if ( strcmp( CP_PROFILE_MOBILENR, fname ) == 0 ) { - /* mobile number */ - g_strlcpy( profile->mobilenr, fvalue, sizeof( profile->mobilenr ) ); - } - else { - /* invalid profile attribute */ - purple_debug_error( MXIT_PLUGIN_ID, "Invalid profile attribute received '%s' \n", fname ); - } - } - - if ( records[0]->fields[0]->len == 0 ) { - /* no MXit id provided, so this must be our own profile information */ - if ( session->profile ) - g_free( session->profile ); - session->profile = profile; - } - else { - /* display other user's profile */ - mxit_show_profile( session, mxitId, profile ); - - /* cleanup */ - g_free( profile ); - } -} - - -/*------------------------------------------------------------------------ - * Return the length of a multimedia chunk - * - * @return The actual chunk data length in bytes - */ -static int get_chunk_len( const char* chunkdata ) -{ - int* sizeptr; - - sizeptr = (int*) &chunkdata[1]; /* we skip the first byte (type field) */ - - return ntohl( *sizeptr ); -} - - -/*------------------------------------------------------------------------ - * Process a received multimedia packet. - * - * @param session The MXit session object - * @param records The packet's data records - * @param rcount The number of data records - */ -static void mxit_parse_cmd_media( struct MXitSession* session, struct record** records, int rcount ) -{ - char type; - int size; - - type = records[0]->fields[0]->data[0]; - size = get_chunk_len( records[0]->fields[0]->data ); - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_parse_cmd_media (%i records) (%i bytes)\n", rcount, size ); - - /* supported chunked data types */ - switch ( type ) { - case CP_CHUNK_CUSTOM : /* custom resource */ - { - struct cr_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof( struct cr_chunk ) ); - mxit_chunk_parse_cr( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - purple_debug_info( MXIT_PLUGIN_ID, "chunk info id=%s handle=%s op=%i\n", chunk.id, chunk.handle, chunk.operation ); - - /* this is a splash-screen operation */ - if ( strcmp( chunk.handle, HANDLE_SPLASH2 ) == 0 ) { - if ( chunk.operation == CR_OP_UPDATE ) { /* update the splash-screen */ - struct splash_chunk *splash = chunk.resources->data; // TODO: Fix - assuming 1st resource is splash - gboolean clickable = ( g_list_length( chunk.resources ) > 1 ); // TODO: Fix - if 2 resources, then is clickable - - if ( splash != NULL ) - splash_update( session, chunk.id, splash->data, splash->datalen, clickable ); - } - else if ( chunk.operation == CR_OP_REMOVE ) /* remove the splash-screen */ - splash_remove( session ); - } - - /* cleanup custom resources */ - g_list_foreach( chunk.resources, (GFunc)g_free, NULL ); - - } - break; - - case CP_CHUNK_OFFER : /* file offer */ - { - struct offerfile_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof( struct offerfile_chunk ) ); - mxit_chunk_parse_offer( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - /* process the offer */ - mxit_xfer_rx_offer( session, chunk.username, chunk.filename, chunk.filesize, chunk.fileid ); - } - break; - - case CP_CHUNK_GET : /* get file response */ - { - struct getfile_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof( struct getfile_chunk ) ); - mxit_chunk_parse_get( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - /* process the getfile */ - mxit_xfer_rx_file( session, chunk.fileid, chunk.data, chunk.length ); - } - break; - - case CP_CHUNK_GET_AVATAR : /* get avatars */ - { - struct getavatar_chunk chunk; - - /* decode the chunked data */ - memset( &chunk, 0, sizeof ( struct getavatar_chunk ) ); - mxit_chunk_parse_get_avatar( &records[0]->fields[0]->data[sizeof( char ) + sizeof( int )], records[0]->fields[0]->len, &chunk ); - - /* update avatar image */ - if ( chunk.data ) { - purple_debug_info( MXIT_PLUGIN_ID, "updating avatar for contact '%s'\n", chunk.mxitid ); - purple_buddy_icons_set_for_user( session->acc, chunk.mxitid, g_memdup( chunk.data, chunk.length), chunk.length, chunk.avatarid ); - } - - } - break; - - case CP_CHUNK_SET_AVATAR : - /* this is a reply packet to a set avatar request. no action is required */ - break; - - case CP_CHUNK_DIRECT_SND : - /* this is a ack for a file send. no action is required */ - break; - - case CP_CHUNK_RECIEVED : - /* this is a ack for a file received. no action is required */ - break; - - default : - purple_debug_error( MXIT_PLUGIN_ID, "Unsupported chunked data packet type received (%i)\n", type ); - break; - } -} - - -/*------------------------------------------------------------------------ - * Handle a redirect sent from the MXit server. - * - * @param session The MXit session object - * @param url The redirect information - */ -static void mxit_perform_redirect( struct MXitSession* session, const char* url ) -{ - gchar** parts; - gchar** host; - int type; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_perform_redirect: %s\n", url ); - - /* tokenize the URL string */ - parts = g_strsplit( url, ";", 0 ); - - /* Part 1: protocol://host:port */ - host = g_strsplit( parts[0], ":", 4 ); - if ( strcmp( host[0], "socket" ) == 0 ) { - /* redirect to a MXit socket proxy */ - g_strlcpy( session->server, &host[1][2], sizeof( session->server ) ); - session->port = atoi( host[2] ); - } - else { - purple_connection_error( session->con, _( "Cannot perform redirect using the specified protocol" ) ); - goto redirect_fail; - } - - /* Part 2: type of redirect */ - type = atoi( parts[1] ); - if ( type == CP_REDIRECT_PERMANENT ) { - /* permanent redirect, so save new MXit server and port */ - purple_account_set_string( session->acc, MXIT_CONFIG_SERVER_ADDR, session->server ); - purple_account_set_int( session->acc, MXIT_CONFIG_SERVER_PORT, session->port ); - } - - /* Part 3: message (optional) */ - if ( parts[2] != NULL ) - purple_connection_notice( session->con, parts[2] ); - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_perform_redirect: %s redirect to %s:%i\n", - ( type == CP_REDIRECT_PERMANENT ) ? "Permanent" : "Temporary", session->server, session->port ); - - /* perform the re-connect to the new MXit server */ - mxit_reconnect( session ); - -redirect_fail: - g_strfreev( parts ); - g_strfreev( host ); -} - - -/*------------------------------------------------------------------------ - * Process a success response received from the MXit server. - * - * @param session The MXit session object - * @param packet The received packet - */ -static int process_success_response( struct MXitSession* session, struct rx_packet* packet ) -{ - /* ignore ping/poll packets */ - if ( ( packet->cmd != CP_CMD_PING ) && ( packet->cmd != CP_CMD_POLL ) ) - session->last_rx = time( NULL ); - - /* - * when we pass the packet records to the next level for parsing - * we minus 3 records because 1) the first record is the packet - * type 2) packet reply status 3) the last record is bogus - */ - - /* packet command */ - switch ( packet->cmd ) { - - case CP_CMD_REGISTER : - /* fall through, when registeration successful, MXit will auto login */ - case CP_CMD_LOGIN : - /* login response */ - if ( !( session->flags & MXIT_FLAG_LOGGEDIN ) ) { - mxit_parse_cmd_login( session, &packet->records[2], packet->rcount - 3 ); - } - break; - - case CP_CMD_LOGOUT : - /* logout response */ - session->flags &= ~MXIT_FLAG_LOGGEDIN; - purple_account_disconnect( session->acc ); - - /* note: - * we do not prompt the user here for a reconnect, because this could be the user - * logging in with his phone. so we just disconnect the account otherwise - * mxit will start to bounce between the phone and pidgin. also could be a valid - * disconnect selected by the user. - */ - return -1; - - case CP_CMD_CONTACT : - /* contact update */ - mxit_parse_cmd_contact( session, &packet->records[2], packet->rcount - 3 ); - break; - - case CP_CMD_PRESENCE : - /* presence update */ - mxit_parse_cmd_presence(session, &packet->records[2], packet->rcount - 3 ); - break; - - case CP_CMD_RX_MSG : - /* incoming message (no bogus record) */ - mxit_parse_cmd_message( session, &packet->records[2], packet->rcount - 2 ); - break; - - case CP_CMD_NEW_SUB : - /* new subscription request */ - mxit_parse_cmd_new_sub( session, &packet->records[2], packet->rcount - 3 ); - break; - - case CP_CMD_MEDIA : - /* multi-media message */ - mxit_parse_cmd_media( session, &packet->records[2], packet->rcount - 2 ); - break; - - case CP_CMD_EXTPROFILE_GET : - /* profile update */ - mxit_parse_cmd_extprofile( session, &packet->records[2], packet->rcount - 2 ); - break; - - case CP_CMD_MOOD : - /* mood update */ - case CP_CMD_UPDATE : - /* update contact information */ - case CP_CMD_ALLOW : - /* allow subscription ack */ - case CP_CMD_DENY : - /* deny subscription ack */ - case CP_CMD_INVITE : - /* invite contact ack */ - case CP_CMD_REMOVE : - /* remove contact ack */ - case CP_CMD_TX_MSG : - /* outgoing message ack */ - case CP_CMD_STATUS : - /* presence update ack */ - case CP_CMD_GRPCHAT_CREATE : - /* create groupchat */ - case CP_CMD_GRPCHAT_INVITE : - /* groupchat invite */ - case CP_CMD_PING : - /* ping reply */ - case CP_CMD_POLL : - /* HTTP poll reply */ - case CP_CMD_EXTPROFILE_SET : - /* profile update */ - case CP_CMD_SPLASHCLICK : - /* splash-screen clickthrough */ - break; - - default : - /* unknown packet */ - purple_debug_error( MXIT_PLUGIN_ID, "Received unknown client packet (cmd = %i)\n", packet->cmd ); - } - - return 0; -} - - -/*------------------------------------------------------------------------ - * Process an error response received from the MXit server. - * - * @param session The MXit session object - * @param packet The received packet - */ -static int process_error_response( struct MXitSession* session, struct rx_packet* packet ) -{ - char errmsg[256]; - const char* errdesc; - - /* set the error description to be shown to the user */ - if ( packet->errmsg ) - errdesc = packet->errmsg; - else - errdesc = _( "An internal MXit server error occurred." ); - - purple_debug_info( MXIT_PLUGIN_ID, "Error Reply %i:%s\n", packet->errcode, errdesc ); - - if ( packet->errcode == MXIT_ERRCODE_LOGGEDOUT ) { - /* we are not currently logged in, so we need to reconnect */ - purple_connection_error( session->con, _( errdesc ) ); - } - - /* packet command */ - switch ( packet->cmd ) { - - case CP_CMD_REGISTER : - case CP_CMD_LOGIN : - if ( packet->errcode == MXIT_ERRCODE_REDIRECT ) { - mxit_perform_redirect( session, packet->errmsg ); - return 0; - } - else { - sprintf( errmsg, _( "Login error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error( session->con, errmsg ); - return -1; - } - case CP_CMD_LOGOUT : - sprintf( errmsg, _( "Logout error: %s (%i)" ), errdesc, packet->errcode ); - purple_connection_error_reason( session->con, PURPLE_CONNECTION_ERROR_NAME_IN_USE, _( errmsg ) ); - return -1; - case CP_CMD_CONTACT : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Error" ), _( errdesc ) ); - break; - case CP_CMD_RX_MSG : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Error" ), _( errdesc ) ); - break; - case CP_CMD_TX_MSG : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Message Sending Error" ), _( errdesc ) ); - break; - case CP_CMD_STATUS : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Status Error" ), _( errdesc ) ); - break; - case CP_CMD_MOOD : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Mood Error" ), _( errdesc ) ); - break; - case CP_CMD_KICK : - /* - * the MXit server sends this packet if we were idle for too long. - * to stop the server from closing this connection we need to resend - * the login packet. - */ - mxit_send_login( session ); - break; - case CP_CMD_INVITE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Invitation Error" ), _( errdesc ) ); - break; - case CP_CMD_REMOVE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Removal Error" ), _( errdesc ) ); - break; - case CP_CMD_ALLOW : - case CP_CMD_DENY : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Subscription Error" ), _( errdesc ) ); - break; - case CP_CMD_UPDATE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Contact Update Error" ), _( errdesc ) ); - break; - case CP_CMD_MEDIA : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "File Transfer Error" ), _( errdesc ) ); - break; - case CP_CMD_GRPCHAT_CREATE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Cannot create MultiMx room" ), _( errdesc ) ); - break; - case CP_CMD_GRPCHAT_INVITE : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "MultiMx Invitation Error" ), _( errdesc ) ); - break; - case CP_CMD_EXTPROFILE_GET : - case CP_CMD_EXTPROFILE_SET : - mxit_popup( PURPLE_NOTIFY_MSG_WARNING, _( "Profile Error" ), _( errdesc ) ); - break; - case CP_CMD_SPLASHCLICK : - /* ignore error */ - break; - case CP_CMD_PING : - case CP_CMD_POLL : - break; - default : - mxit_popup( PURPLE_NOTIFY_MSG_ERROR, _( "Error" ), _( errdesc ) ); - break; - } - - return 0; -} - - -/*======================================================================================================================== - * Low-level Packet receive - */ - -#ifdef DEBUG_PROTOCOL -/*------------------------------------------------------------------------ - * Dump a received packet structure. - * - * @param p The received packet - */ -static void dump_packet( struct rx_packet* p ) -{ - struct record* r = NULL; - struct field* f = NULL; - int i; - int j; - - purple_debug_info( MXIT_PLUGIN_ID, "PACKET DUMP: (%i records)\n", p->rcount ); - - for ( i = 0; i < p->rcount; i++ ) { - r = p->records[i]; - purple_debug_info( MXIT_PLUGIN_ID, "RECORD: (%i fields)\n", r->fcount ); - - for ( j = 0; j < r->fcount; j++ ) { - f = r->fields[j]; - purple_debug_info( MXIT_PLUGIN_ID, "\tFIELD: (len=%i) '%s' \n", f->len, f->data ); - } - } -} -#endif - - -/*------------------------------------------------------------------------ - * Free up memory used by a packet structure. - * - * @param p The received packet - */ -static void free_rx_packet( struct rx_packet* p ) -{ - struct record* r = NULL; - struct field* f = NULL; - int i; - int j; - - for ( i = 0; i < p->rcount; i++ ) { - r = p->records[i]; - - for ( j = 0; j < r->fcount; j++ ) { - g_free( f ); - } - g_free( r->fields ); - g_free( r ); - } - g_free( p->records ); -} - - -/*------------------------------------------------------------------------ - * Add a new field to a record. - * - * @param r Parent record object - * @return The newly created field - */ -static struct field* add_field( struct record* r ) -{ - struct field* field; - - field = g_new0( struct field, 1 ); - - r->fields = realloc( r->fields, sizeof( struct field* ) * ( r->fcount + 1 ) ); - r->fields[r->fcount] = field; - r->fcount++; - - return field; -} - - -/*------------------------------------------------------------------------ - * Add a new record to a packet. - * - * @param p The packet object - * @return The newly created record - */ -static struct record* add_record( struct rx_packet* p ) -{ - struct record* rec; - - rec = g_new0( struct record, 1 ); - - p->records = realloc( p->records, sizeof( struct record* ) * ( p->rcount + 1 ) ); - p->records[p->rcount] = rec; - p->rcount++; - - return rec; -} - - -/*------------------------------------------------------------------------ - * Parse the received byte stream into a proper client protocol packet. - * - * @param session The MXit session object - * @return Success (0) or Failure (!0) - */ -int mxit_parse_packet( struct MXitSession* session ) -{ - struct rx_packet packet; - struct record* rec; - struct field* field; - gboolean pbreak; - unsigned int i; - int res = 0; - -#ifdef DEBUG_PROTOCOL - purple_debug_info( MXIT_PLUGIN_ID, "Received packet (%i bytes)\n", session->rx_i ); - dump_bytes( session, session->rx_dbuf, session->rx_i ); -#endif - - i = 0; - while ( i < session->rx_i ) { - - /* create first record and field */ - rec = NULL; - field = NULL; - memset( &packet, 0x00, sizeof( struct rx_packet ) ); - rec = add_record( &packet ); - pbreak = FALSE; - - /* break up the received packet into fields and records for easy parsing */ - while ( ( i < session->rx_i ) && ( !pbreak ) ) { - - switch ( session->rx_dbuf[i] ) { - case CP_SOCK_REC_TERM : - /* new record */ - if ( packet.rcount == 1 ) { - /* packet command */ - packet.cmd = atoi( packet.records[0]->fields[0]->data ); - } - else if ( packet.rcount == 2 ) { - /* special case: binary multimedia packets should not be parsed here */ - if ( packet.cmd == CP_CMD_MEDIA ) { - /* add the chunked to new record */ - rec = add_record( &packet ); - field = add_field( rec ); - field->data = &session->rx_dbuf[i + 1]; - field->len = session->rx_i - i; - /* now skip the binary data */ - res = get_chunk_len( field->data ); - /* determine if we have more packets */ - if ( res + 6 + i < session->rx_i ) { - /* we have more than one packet in this stream */ - i += res + 6; - pbreak = TRUE; - } - else { - i = session->rx_i; - } - } - } - else if ( !field ) { - field = add_field( rec ); - field->data = &session->rx_dbuf[i]; - } - session->rx_dbuf[i] = '\0'; - rec = add_record( &packet ); - field = NULL; - - break; - case CP_FLD_TERM : - /* new field */ - session->rx_dbuf[i] = '\0'; - if ( !field ) { - field = add_field( rec ); - field->data = &session->rx_dbuf[i]; - } - field = NULL; - break; - case CP_PKT_TERM : - /* packet is done! */ - session->rx_dbuf[i] = '\0'; - pbreak = TRUE; - break; - default : - /* skip non special characters */ - if ( !field ) { - field = add_field( rec ); - field->data = &session->rx_dbuf[i]; - } - field->len++; - break; - } - - i++; - } - - if ( packet.rcount < 2 ) { - /* bad packet */ - purple_connection_error( session->con, _( "Invalid packet received from MXit." ) ); - free_rx_packet( &packet ); - continue; - } - - session->rx_dbuf[session->rx_i] = '\0'; - packet.errcode = atoi( packet.records[1]->fields[0]->data ); - - purple_debug_info( MXIT_PLUGIN_ID, "Packet received CMD:%i (%i)\n", packet.cmd, packet.errcode ); -#ifdef DEBUG_PROTOCOL - /* debug */ - dump_packet( &packet ); -#endif - - /* reset the out ack */ - if ( session->outack == packet.cmd ) { - /* outstanding ack received from mxit server */ - session->outack = 0; - } - - /* check packet status */ - if ( packet.errcode != MXIT_ERRCODE_SUCCESS ) { - /* error reply! */ - if ( ( packet.records[1]->fcount > 1 ) && ( packet.records[1]->fields[1]->data ) ) - packet.errmsg = packet.records[1]->fields[1]->data; - else - packet.errmsg = NULL; - - res = process_error_response( session, &packet ); - } - else { - /* success reply! */ - res = process_success_response( session, &packet ); - } - - /* free up the packet resources */ - free_rx_packet( &packet ); - } - - if ( session->outack == 0 ) - mxit_manage_queue( session ); - - return res; -} - - -/*------------------------------------------------------------------------ - * Callback when data is received from the MXit server. - * - * @param user_data The MXit session object - * @param source The file-descriptor on which data was received - * @param cond Condition which caused the callback (PURPLE_INPUT_READ) - */ -void mxit_cb_rx( gpointer user_data, gint source, PurpleInputCondition cond ) -{ - struct MXitSession* session = (struct MXitSession*) user_data; - char ch; - int res; - int len; - - if ( session->rx_state == RX_STATE_RLEN ) { - /* we are reading in the packet length */ - len = read( session->fd, &ch, 1 ); - if ( len < 0 ) { - /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x01)" ) ); - return; - } - else if ( len == 0 ) { - /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x02)" ) ); - return; - } - else { - /* byte read */ - if ( ch == CP_REC_TERM ) { - /* the end of the length record found */ - session->rx_lbuf[session->rx_i] = '\0'; - session->rx_res = atoi( &session->rx_lbuf[3] ); - if ( session->rx_res > CP_MAX_PACKET ) { - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x03)" ) ); - } - session->rx_state = RX_STATE_DATA; - session->rx_i = 0; - } - else { - /* still part of the packet length record */ - session->rx_lbuf[session->rx_i] = ch; - session->rx_i++; - if ( session->rx_i >= sizeof( session->rx_lbuf ) ) { - /* malformed packet length record (too long) */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x04)" ) ); - return; - } - } - } - } - else if ( session->rx_state == RX_STATE_DATA ) { - /* we are reading in the packet data */ - len = read( session->fd, &session->rx_dbuf[session->rx_i], session->rx_res ); - if ( len < 0 ) { - /* connection error */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x05)" ) ); - return; - } - else if ( len == 0 ) { - /* connection closed */ - purple_connection_error( session->con, _( "A connection error occurred to MXit. (read stage 0x06)" ) ); - return; - } - else { - /* data read */ - session->rx_i += len; - session->rx_res -= len; - - if ( session->rx_res == 0 ) { - /* ok, so now we have read in the whole packet */ - session->rx_state = RX_STATE_PROC; - } - } - } - - if ( session->rx_state == RX_STATE_PROC ) { - /* we have a full packet, which we now need to process */ - res = mxit_parse_packet( session ); - - if ( res == 0 ) { - /* we are still logged in */ - session->rx_state = RX_STATE_RLEN; - session->rx_res = 0; - session->rx_i = 0; - } - } -} - - -/*------------------------------------------------------------------------ - * Log the user off MXit and close the connection - * - * @param session The MXit session object - */ -void mxit_close_connection( struct MXitSession* session ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "mxit_close_connection\n" ); - - if ( !( session->flags & MXIT_FLAG_CONNECTED ) ) { - /* we are already closed */ - return; - } - else if ( session->flags & MXIT_FLAG_LOGGEDIN ) { - /* we are currently logged in so we need to send a logout packet */ - if ( !session->http ) { - mxit_send_logout( session ); - } - session->flags &= ~MXIT_FLAG_LOGGEDIN; - } - session->flags &= ~MXIT_FLAG_CONNECTED; - - /* cancel outstanding HTTP request */ - if ( ( session->http ) && ( session->http_out_req ) ) { - purple_util_fetch_url_cancel( (PurpleUtilFetchUrlData*) session->http_out_req ); - session->http_out_req = NULL; - } - - /* remove the input cb function */ - if ( session->con->inpa ) { - purple_input_remove( session->con->inpa ); - session->con->inpa = 0; - } - - /* remove HTTP poll timer */ - if ( session->http_timer_id > 0 ) - purple_timeout_remove( session->http_timer_id ); - - /* remove queue manager timer */ - if ( session->q_timer > 0 ) - purple_timeout_remove( session->q_timer ); - - /* remove all groupchat rooms */ - while ( session->rooms != NULL ) { - struct multimx* multimx = (struct multimx *) session->rooms->data; - - session->rooms = g_list_remove( session->rooms, multimx ); - - free( multimx ); - } - g_list_free( session->rooms ); - session->rooms = NULL; - - /* remove all rx chats names */ - while ( session->active_chats != NULL ) { - char* chat = (char*) session->active_chats->data; - - session->active_chats = g_list_remove( session->active_chats, chat ); - - g_free( chat ); - } - g_list_free( session->active_chats ); - session->active_chats = NULL; - - /* free profile information */ - if ( session->profile ) - free( session->profile ); - - /* free custom emoticons */ - mxit_free_emoticon_cache( session ); - - /* free allocated memory */ - g_free( session->encpwd ); - session->encpwd = NULL; - - /* flush all the commands still in the queue */ - flush_queue( session ); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/protocol.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- MXit client protocol implementation -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_PROTO_H_ -#define _MXIT_PROTO_H_ - - -/* Client protocol constants */ -#define CP_SOCK_REC_TERM '\x00' /* socket record terminator */ -#define CP_HTTP_REC_TERM '\x26' /* http record terminator '&' */ -#define CP_FLD_TERM '\x01' /* field terminator */ -#define CP_PKT_TERM '\x02' /* packet terminator */ - - -#define CP_MAX_PACKET ( 1024 * 1024 ) /* maximum client protocol packet size (1 MiB) */ -#define CP_MAX_FILESIZE ( 150 * 1000 ) /* maximum client protocol file transfer size (150 KB) */ -#define MXIT_EMOTICON_SIZE 18 /* icon size for custom emoticons */ -#define CP_MAX_STATUS_MSG 250 /* maximum status message length (in characters) */ - -/* Avatars */ -#define MXIT_AVATAR_SIZE 96 /* default avatar image size 96x96 */ -#define MXIT_AVATAR_TYPE "PNG" /* request avatars in this file type (only a suggestion) */ -#define MXIT_AVATAR_BITDEPT 24 /* request avatars with this bit depth (only a suggestion) */ - -/* Protocol error codes */ -#define MXIT_ERRCODE_SUCCESS 0 -#define MXIT_ERRCODE_REDIRECT 16 -#define MXIT_ERRCODE_LOGGEDOUT 42 - -/* MXit client features */ -#define MXIT_CF_NONE 0x000000 -#define MXIT_CF_FORMS 0x000001 -#define MXIT_CF_FILE_TRANSFER 0x000002 -#define MXIT_CF_CAMERA 0x000004 -#define MXIT_CF_COMMANDS 0x000008 -#define MXIT_CF_SMS 0x000010 -#define MXIT_CF_FILE_ACCESS 0x000020 -#define MXIT_CF_MIDP2 0x000040 -#define MXIT_CF_SKINS 0x000080 -#define MXIT_CF_AUDIO 0x000100 -#define MXIT_CF_ENCRYPTION 0x000200 -#define MXIT_CF_VOICE_REC 0x000400 -#define MXIT_CF_VECTOR_GFX 0x000800 -#define MXIT_CF_IMAGES 0x001000 -#define MXIT_CF_MARKUP 0x002000 -#define MXIT_CF_VIBES 0x004000 -#define MXIT_CF_SELECT_CONTACT 0x008000 -#define MXIT_CF_CUSTOM_EMO 0x010000 -#define MXIT_CF_ALERT_PROFILES 0x020000 -#define MXIT_CF_EXT_MARKUP 0x040000 -#define MXIT_CF_PLAIN_PWD 0x080000 -#define MXIT_CF_NO_GATEWAYS 0x100000 - -/* Client features supported by this implementation */ -#define MXIT_CP_FEATURES ( MXIT_CF_FILE_TRANSFER | MXIT_CF_FILE_ACCESS | MXIT_CF_AUDIO | MXIT_CF_MARKUP | MXIT_CF_EXT_MARKUP | MXIT_CF_NO_GATEWAYS | MXIT_CF_IMAGES | MXIT_CF_COMMANDS | MXIT_CF_VIBES | MXIT_CF_MIDP2 ) - - -#define MXIT_PING_INTERVAL ( 5 * 60 ) /* ping the server after X seconds of being idle (5 minutes) */ -#define MXIT_ACK_TIMEOUT ( 30 ) /* timeout after waiting X seconds for an ack from the server (30 seconds) */ - -/* MXit client version */ -#define MXIT_CP_DISTCODE "P" /* client distribution code (magic, do not touch!) */ -#define MXIT_CP_RELEASE "5.9.0" /* client protocol release version supported */ -#define MXIT_CP_ARCH "Y" /* client architecture series (Y not for Yoda but for PC-client) */ -#define MXIT_CLIENT_ID "LP" /* client ID as specified by MXit */ -#define MXIT_CP_PLATFORM "PURPLE" /* client platform */ -#define MXIT_CP_VERSION MXIT_CP_DISTCODE"-"MXIT_CP_RELEASE"-"MXIT_CP_ARCH"-"MXIT_CP_PLATFORM - -/* set operating system name */ -#if defined( __APPLE__ ) -#define MXIT_CP_OS "apple" -#elif defined( _WIN32 ) -#define MXIT_CP_OS "windows" -#elif defined( __linux__ ) -#define MXIT_CP_OS "linux" -#else -#define MXIT_CP_OS "unknown" -#endif - -/* Client capabilities */ -#define MXIT_CP_CAP "utf8=true;cid="MXIT_CLIENT_ID - -/* Client settings */ -#define MAX_QUEUE_SIZE ( 1 << 4 ) /* tx queue size (16 packets) */ -#define MXIT_POPUP_WIN_NAME "MXit Notification" /* popup window name */ -#define MXIT_MAX_ATTRIBS 10 /* maximum profile attributes supported */ -#define MXIT_DEFAULT_LOCALE "en" /* default locale setting */ -#define MXIT_DEFAULT_LOC "planetpurple" /* the default location for registration */ - -/* Client protocol commands */ -#define CP_CMD_LOGIN 0x0001 /* (1) login */ -#define CP_CMD_LOGOUT 0x0002 /* (2) logout */ -#define CP_CMD_CONTACT 0x0003 /* (3) get contacts */ -#define CP_CMD_UPDATE 0x0005 /* (5) update contact information */ -#define CP_CMD_INVITE 0x0006 /* (6) subscribe to new contact */ -#define CP_CMD_PRESENCE 0x0007 /* (7) get presence */ -#define CP_CMD_REMOVE 0x0008 /* (8) remove contact */ -#define CP_CMD_RX_MSG 0x0009 /* (9) get new messages */ -#define CP_CMD_TX_MSG 0x000A /* (10) send new message */ -#define CP_CMD_REGISTER 0x000B /* (11) register */ -//#define CP_CMD_PROFILE_SET 0x000C /* (12) set profile (DEPRECATED see CP_CMD_EXTPROFILE_SET) */ -#define CP_CMD_POLL 0x0011 /* (17) poll the HTTP server for an update */ -//#define CP_CMD_PROFILE_GET 0x001A /* (26) get profile (DEPRECATED see CP_CMD_EXTPROFILE_GET) */ -#define CP_CMD_MEDIA 0x001B /* (27) get multimedia message */ -#define CP_CMD_SPLASHCLICK 0x001F /* (31) splash-screen clickthrough */ -#define CP_CMD_STATUS 0x0020 /* (32) set shown presence & status */ -#define CP_CMD_MOOD 0x0029 /* (41) set mood */ -#define CP_CMD_KICK 0x002B /* (43) login kick */ -#define CP_CMD_GRPCHAT_CREATE 0x002C /* (44) create new groupchat */ -#define CP_CMD_GRPCHAT_INVITE 0x002D /* (45) add new groupchat member */ -#define CP_CMD_NEW_SUB 0x0033 /* (51) get new subscription */ -#define CP_CMD_ALLOW 0x0034 /* (52) allow subscription */ -#define CP_CMD_DENY 0x0037 /* (55) deny subscription */ -#define CP_CMD_EXTPROFILE_GET 0x0039 /* (57) get extended profile */ -#define CP_CMD_EXTPROFILE_SET 0x003A /* (58) set extended profile */ -#define CP_CMD_PING 0x03E8 /* (1000) ping (keepalive) */ - -/* HTTP connection */ -#define MXIT_HTTP_POLL_MIN 7 /* minimum time between HTTP polls (seconds) */ -#define MXIT_HTTP_POLL_MAX ( 10 * 60 ) /* maximum time between HTTP polls (seconds) */ - -/* receiver states */ -#define RX_STATE_RLEN 0x01 /* reading packet length section */ -#define RX_STATE_DATA 0x02 /* reading packet data section */ -#define RX_STATE_PROC 0x03 /* process read data */ - -/* message flags */ -#define CP_MSG_ENCRYPTED 0x0010 /* message is encrypted */ -#define CP_MSG_MARKUP 0x0200 /* message may contain markup */ -#define CP_MSG_EMOTICON 0x0400 /* message may contain custom emoticons */ - -/* redirect types */ -#define CP_REDIRECT_PERMANENT 1 /* permanent redirect */ -#define CP_REDIRECT_TEMPORARY 2 /* temporary redirect */ - -/* message tx types */ -#define CP_MSGTYPE_NORMAL 0x01 /* normal message */ -#define CP_MSGTYPE_CHAT 0x02 /* chat message */ -#define CP_MSGTYPE_HEADLINE 0x03 /* headline message */ -#define CP_MSGTYPE_ERROR 0x04 /* error message */ -#define CP_MSGTYPE_GROUPCHAT 0x05 /* groupchat message */ -#define CP_MSGTYPE_FORM 0x06 /* mxit custom form */ -#define CP_MSGTYPE_COMMAND 0x07 /* mxit command */ - - -/* extended profile attribute fields */ -#define CP_PROFILE_BIRTHDATE "birthdate" /* Birthdate (String - ISO 8601 format) */ -#define CP_PROFILE_GENDER "gender" /* Gender (Boolean - 0=female, 1=male) */ -#define CP_PROFILE_HIDENUMBER "hidenumber" /* Hide Number (Boolean - 0=false, 1=true) */ -#define CP_PROFILE_FULLNAME "fullname" /* Fullname (UTF8 String) */ -#define CP_PROFILE_STATUS "statusmsg" /* Status Message (UTF8 String) */ -#define CP_PROFILE_PREVSTATUS "prevstatusmsgs" /* Previous Status Messages (UTF8 String) */ -#define CP_PROFILE_AVATAR "avatarid" /* Avatar ID (String) */ -#define CP_PROFILE_MODIFIED "lastmodified" /* Last-Modified timestamp */ -#define CP_PROFILE_TITLE "title" /* Title (UTF8 String) */ -#define CP_PROFILE_FIRSTNAME "firstname" /* First name (UTF8 String) */ -#define CP_PROFILE_LASTNAME "lastname" /* Last name (UTF8 String) */ -#define CP_PROFILE_EMAIL "email" /* Email address (UTF8 String) */ -#define CP_PROFILE_MOBILENR "mobilenumber" /* Mobile Number (UTF8 String) */ - -/* extended profile field types */ -#define CP_PROF_TYPE_BOOL 0x02 /* boolean profile attribute type */ -#define CP_PROF_TYPE_INT 0x05 /* integer profile attribute type */ -#define CP_PROF_TYPE_UTF8 0x0A /* UTF8 string profile attribute type */ -#define CP_PROF_TYPE_DATE 0x0B /* date-time profile attribute type */ - - -/* define this to enable protocol debugging (very verbose logging) */ -#define DEBUG_PROTOCOL - - -/* ======================================================================================= */ - -struct MXitSession; - -/*------------------------------------------*/ - -struct field { - char* data; - int len; -}; - -struct record { - struct field** fields; - int fcount; -}; - -struct rx_packet { - int cmd; - int errcode; - char* errmsg; - struct record** records; - int rcount; -}; - -struct tx_packet { - int cmd; - char header[256]; - int headerlen; - char* data; - int datalen; -}; - -/*------------------------------------------*/ - - -/* - * A received message data object - */ -struct RXMsgData { - struct MXitSession* session; /* MXit session object */ - char* from; /* the sender's name */ - time_t timestamp; /* time at which the message was sent */ - GString* msg; /* newly created message converted to libPurple formatting */ - gboolean got_img; /* flag to say if this message got any images/emoticons embedded */ - short img_count; /* the amount of images/emoticons still outstanding for the message */ - int chatid; /* multimx chatroom id */ - int flags; /* libPurple conversation flags */ - gboolean converted; /* true if the message has been completely parsed and converted to libPurple markup */ - gboolean processed; /* the message has been processed completely and should be freed up */ -}; - - - -/* - * The packet transmission queue. - */ -struct tx_queue { - struct tx_packet* packets[MAX_QUEUE_SIZE]; /* array of packet pointers */ - int count; /* number of packets queued */ - int rd_i; /* queue current read index (queue offset for reading a packet) */ - int wr_i; /* queue current write index (queue offset for adding new packet) */ -}; - - -/* ======================================================================================= */ - -void mxit_popup( int type, const char* heading, const char* message ); -void mxit_strip_domain( char* username ); -gboolean find_active_chat( const GList* chats, const char* who ); - -void mxit_cb_rx( gpointer data, gint source, PurpleInputCondition cond ); -gboolean mxit_manage_queue( gpointer user_data ); -gboolean mxit_manage_polling( gpointer user_data ); - -void mxit_send_register( struct MXitSession* session ); -void mxit_send_login( struct MXitSession* session ); -void mxit_send_logout( struct MXitSession* session ); -void mxit_send_ping( struct MXitSession* session ); -void mxit_send_poll( struct MXitSession* session ); - -void mxit_send_presence( struct MXitSession* session, int presence, const char* statusmsg ); -void mxit_send_mood( struct MXitSession* session, int mood ); -void mxit_send_message( struct MXitSession* session, const char* to, const char* msg, gboolean parse_markup ); - -void mxit_send_extprofile_update( struct MXitSession* session, const char* password, unsigned int nr_attrib, const char* attributes ); -void mxit_send_extprofile_request( struct MXitSession* session, const char* username, unsigned int nr_attrib, const char* attribute[] ); - -void mxit_send_invite( struct MXitSession* session, const char* username, const char* alias, const char* groupname ); -void mxit_send_remove( struct MXitSession* session, const char* username ); -void mxit_send_allow_sub( struct MXitSession* session, const char* username, const char* alias ); -void mxit_send_deny_sub( struct MXitSession* session, const char* username ); -void mxit_send_update_contact( struct MXitSession* session, const char* username, const char* alias, const char* groupname ); -void mxit_send_splashclick( struct MXitSession* session, const char* splashid ); - -void mxit_send_file( struct MXitSession* session, const char* username, const char* filename, const unsigned char* buf, int buflen ); -void mxit_send_file_reject( struct MXitSession* session, const char* fileid ); -void mxit_send_file_accept( struct MXitSession* session, const char* fileid, int filesize, int offset ); -void mxit_send_file_received( struct MXitSession* session, const char* fileid, short status ); -void mxit_set_avatar( struct MXitSession* session, const unsigned char* avatar, int avatarlen ); -void mxit_get_avatar( struct MXitSession* session, const char* mxitId, const char* avatarId ); - -void mxit_send_groupchat_create( struct MXitSession* session, const char* groupname, int nr_usernames, const char* usernames[] ); -void mxit_send_groupchat_invite( struct MXitSession* session, const char* roomid, int nr_usernames, const char* usernames[] ); - -int mxit_parse_packet( struct MXitSession* session ); -void dump_bytes( struct MXitSession* session, const char* buf, int len ); -void mxit_close_connection( struct MXitSession* session ); - - -#endif /* _MXIT_PROTO_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,719 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user roster management (mxit contacts) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "purple.h" - -#include "protocol.h" -#include "mxit.h" -#include "roster.h" - - -struct contact_invite { - struct MXitSession* session; /* MXit session object */ - struct contact* contact; /* The contact performing the invite */ -}; - - -/*======================================================================================================================== - * Presence / Status - */ - -/* statuses (reference: libpurple/status.h) */ -static struct status -{ - PurpleStatusPrimitive primative; - int mxit; - const char* id; - const char* name; -} const mxit_statuses[] = { - /* primative, no, id, name */ - { PURPLE_STATUS_OFFLINE, MXIT_PRESENCE_OFFLINE, "offline", N_( "Offline" ) }, /* 0 */ - { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_ONLINE, "online", N_( "Available" ) }, /* 1 */ - { PURPLE_STATUS_AWAY, MXIT_PRESENCE_AWAY, "away", N_( "Away" ) }, /* 2 */ - { PURPLE_STATUS_AVAILABLE, MXIT_PRESENCE_AVAILABLE, "chat", N_( "Chatty" ) }, /* 3 */ - { PURPLE_STATUS_UNAVAILABLE, MXIT_PRESENCE_DND, "dnd", N_( "Do Not Disturb" ) } /* 4 */ -}; - - -/*------------------------------------------------------------------------ - * Return list of supported statuses. (see status.h) - * - * @param account The MXit account object - * @return List of PurpleStatusType - */ -GList* mxit_status_types( PurpleAccount* account ) -{ - GList* statuslist = NULL; - PurpleStatusType* type; - unsigned int i; - - for ( i = 0; i < ARRAY_SIZE( mxit_statuses ); i++ ) { - const struct status* status = &mxit_statuses[i]; - - /* add mxit status (reference: "libpurple/status.h") */ - type = purple_status_type_new_with_attrs( status->primative, status->id, _( status->name ), TRUE, TRUE, FALSE, - "message", _( "Message" ), purple_value_new( PURPLE_TYPE_STRING ), - NULL ); - - statuslist = g_list_append( statuslist, type ); - } - - return statuslist; -} - - -/*------------------------------------------------------------------------ - * Returns the MXit presence code, given the unique status ID. - * - * @param id The status ID - * @return The MXit presence code - */ -int mxit_convert_presence( const char* id ) -{ - unsigned int i; - - for ( i = 0; i < ARRAY_SIZE( mxit_statuses ); i++ ) { - if ( strcmp( mxit_statuses[i].id, id ) == 0 ) /* status found! */ - return mxit_statuses[i].mxit; - } - - return -1; -} - - -/*------------------------------------------------------------------------ - * Returns the MXit presence as a string, given the MXit presence ID. - * - * @param no The MXit presence I (see above) - * @return The presence as a text string - */ -const char* mxit_convert_presence_to_name( short no ) -{ - unsigned int i; - - for ( i = 0; i < ARRAY_SIZE( mxit_statuses ); i++ ) { - if ( mxit_statuses[i].mxit == no ) /* status found! */ - return _( mxit_statuses[i].name ); - } - - return ""; -} - - -/*======================================================================================================================== - * Moods - */ - -/*------------------------------------------------------------------------ - * Returns the MXit mood as a string, given the MXit mood's ID. - * - * @param id The MXit mood ID (see roster.h) - * @return The mood as a text string - */ -const char* mxit_convert_mood_to_name( short id ) -{ - switch ( id ) { - case MXIT_MOOD_ANGRY : - return _( "Angry" ); - case MXIT_MOOD_EXCITED : - return _( "Excited" ); - case MXIT_MOOD_GRUMPY : - return _( "Grumpy" ); - case MXIT_MOOD_HAPPY : - return _( "Happy" ); - case MXIT_MOOD_INLOVE : - return _( "In Love" ); - case MXIT_MOOD_INVINCIBLE : - return _( "Invincible" ); - case MXIT_MOOD_SAD : - return _( "Sad" ); - case MXIT_MOOD_HOT : - return _( "Hot" ); - case MXIT_MOOD_SICK : - return _( "Sick" ); - case MXIT_MOOD_SLEEPY : - return _( "Sleepy" ); - case MXIT_MOOD_NONE : - default : - return ""; - } -} - - -/*======================================================================================================================== - * Subscription Types - */ - -/*------------------------------------------------------------------------ - * Returns a Contact subscription type as a string. - * - * @param subtype The subscription type - * @return The subscription type as a text string - */ -const char* mxit_convert_subtype_to_name( short subtype ) -{ - switch ( subtype ) { - case MXIT_SUBTYPE_BOTH : - return _( "Both" ); - case MXIT_SUBTYPE_PENDING : - return _( "Pending" ); - case MXIT_SUBTYPE_ASK : - return _( "Invited" ); - case MXIT_SUBTYPE_REJECTED : - return _( "Rejected" ); - case MXIT_SUBTYPE_DELETED : - return _( "Deleted" ); - case MXIT_SUBTYPE_NONE : - return _( "None" ); - default : - return ""; - } -} - - -/*======================================================================================================================== - * Calls from the MXit Protocol layer - */ - -#if 0 -/*------------------------------------------------------------------------ - * Dump a contact's info the the debug console. - * - * @param contact The contact - */ -static void dump_contact( struct contact* contact ) -{ - purple_debug_info( MXIT_PLUGIN_ID, "CONTACT: name='%s', alias='%s', group='%s', type='%i', presence='%i', mood='%i'\n", - contact->username, contact->alias, contact->groupname, contact->type, contact->presence, contact->mood ); -} -#endif - - -#if 0 -/*------------------------------------------------------------------------ - * Move a buddy from one group to another - * - * @param buddy the buddy to move between groups - * @param group the new group to move the buddy to - */ -static PurpleBuddy* mxit_update_buddy_group( struct MXitSession* session, PurpleBuddy* buddy, PurpleGroup* group ) -{ - struct contact* contact = NULL; - PurpleGroup* current_group = purple_buddy_get_group( buddy ); - PurpleBuddy* newbuddy = NULL; - - /* make sure the groups actually differs */ - if ( strcmp( current_group->name, group->name ) != 0 ) { - /* groupnames does not match, so we need to make the update */ - - purple_debug_info( MXIT_PLUGIN_ID, "Moving '%s' from group '%s' to '%s'\n", buddy->alias, current_group->name, group->name ); - - /* - * XXX: libPurple does not currently provide an API to change or rename the group name - * for a specific buddy. One option is to remove the buddy from the list and re-adding - * him in the new group, but by doing that makes the buddy go offline and then online - * again. This is really not ideal and very iretating, but how else then? - */ - - /* create new buddy */ - newbuddy = purple_buddy_new( session->acc, buddy->name, buddy->alias ); - newbuddy->proto_data = buddy->proto_data; - buddy->proto_data = NULL; - - /* remove the buddy */ - purple_blist_remove_buddy( buddy ); - - /* add buddy */ - purple_blist_add_buddy( newbuddy, NULL, group, NULL ); - - /* now re-instate his presence again */ - contact = newbuddy->proto_data; - if ( contact ) { - - /* update the buddy's status (reference: "libpurple/prpl.h") */ - if ( contact->statusMsg ) - purple_prpl_got_user_status( session->acc, newbuddy->name, mxit_statuses[contact->presence].id, "message", contact->statusMsg, NULL ); - else - purple_prpl_got_user_status( session->acc, newbuddy->name, mxit_statuses[contact->presence].id, NULL ); - - /* update avatar */ - if ( contact->avatarId ) { - mxit_get_avatar( session, newbuddy->name, contact->avatarId ); - g_free( contact->avatarId ); - contact->avatarId = NULL; - } - } - - return newbuddy; - } - else - return buddy; -} -#endif - - -/*------------------------------------------------------------------------ - * A contact update packet was received from the MXit server, so update the buddy's - * information. - * - * @param session The MXit session object - * @param contact The contact - */ -void mxit_update_contact( struct MXitSession* session, struct contact* contact ) -{ - PurpleBuddy* buddy = NULL; - PurpleGroup* group = NULL; - const char* id = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_update_contact: user='%s' alias='%s' group='%s'\n", contact->username, contact->alias, contact->groupname ); - - /* - * libPurple requires all contacts to be in a group. - * So if this MXit contact isn't in a group, pretend it is. - */ - if ( *contact->groupname == '\0' ) { - strcpy( contact->groupname, MXIT_DEFAULT_GROUP ); - } - - /* find or create a group for this contact */ - group = purple_find_group( contact->groupname ); - if ( !group ) - group = purple_group_new( contact->groupname ); - - /* see if the buddy is not in the group already */ - buddy = purple_find_buddy_in_group( session->acc, contact->username, group ); - if ( !buddy ) { - /* buddy not found in the group */ - - /* lets try finding him in all groups */ - buddy = purple_find_buddy( session->acc, contact->username ); - if ( buddy ) { - /* ok, so we found him in another group. to switch him between groups we must delete him and add him again. */ - purple_blist_remove_buddy( buddy ); - buddy = NULL; - } - - /* create new buddy */ - buddy = purple_buddy_new( session->acc, contact->username, contact->alias ); - buddy->proto_data = contact; - - /* add new buddy to list */ - purple_blist_add_buddy( buddy, NULL, group, NULL ); - } - else { - /* buddy was found in the group */ - - /* now update the buddy's alias */ - purple_blist_alias_buddy( buddy, contact->alias ); - - /* replace the buddy's contact struct */ - if ( buddy->proto_data ) - free( buddy->proto_data ); - buddy->proto_data = contact; - } - - /* load buddy's avatar id */ - id = purple_buddy_icons_get_checksum_for_user( buddy ); - if ( id ) - contact->avatarId = g_strdup( id ); - else - contact->avatarId = NULL; - - /* update the buddy's status (reference: "libpurple/prpl.h") */ - purple_prpl_got_user_status( session->acc, contact->username, mxit_statuses[contact->presence].id, NULL ); -} - - -/*------------------------------------------------------------------------ - * A presence update packet was received from the MXit server, so update the buddy's - * information. - * - * @param session The MXit session object - * @param username The contact which presence to update - * @param presence The new presence state for the contact - * @param mood The new mood for the contact - * @param customMood The custom mood identifier - * @param statusMsg This is the contact's status message - * @param avatarId This is the contact's avatar id - */ -void mxit_update_buddy_presence( struct MXitSession* session, const char* username, short presence, short mood, const char* customMood, const char* statusMsg, const char* avatarId ) -{ - PurpleBuddy* buddy = NULL; - struct contact* contact = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_update_buddy_presence: user='%s' presence=%i mood=%i customMood='%s' statusMsg='%s' avatar='%s'\n", - username, presence, mood, customMood, statusMsg, avatarId ); - - if ( ( presence < MXIT_PRESENCE_OFFLINE ) || ( presence > MXIT_PRESENCE_DND ) ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_update_buddy_presence: invalid presence state %i\n", presence ); - return; /* ignore packet */ - } - - /* find the buddy information for this contact (reference: "libpurple/blist.h") */ - buddy = purple_find_buddy( session->acc, username ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_update_buddy_presence: unable to find the buddy '%s'\n", username ); - return; - } - - contact = buddy->proto_data; - if ( !contact ) - return; - - contact->presence = presence; - contact->mood = mood; - - g_strlcpy( contact->customMood, customMood, sizeof( contact->customMood ) ); - // TODO: Download custom mood frame. - - /* update status message */ - if ( contact->statusMsg ) { - g_free( contact->statusMsg ); - contact->statusMsg = NULL; - } - if ( statusMsg[0] != '\0' ) - contact->statusMsg = g_markup_escape_text( statusMsg, -1 ); - - /* update avatarId */ - if ( ( contact->avatarId ) && ( g_ascii_strcasecmp( contact->avatarId, avatarId ) == 0 ) ) { - /* avatar has not changed - do nothing */ - } - else if ( avatarId[0] != '\0' ) { /* avatar has changed */ - if ( contact->avatarId ) - g_free( contact->avatarId ); - contact->avatarId = g_strdup( avatarId ); - - /* Send request to download new avatar image */ - mxit_get_avatar( session, username, avatarId ); - } - else /* clear current avatar */ - purple_buddy_icons_set_for_user( session->acc, username, NULL, 0, NULL ); - - /* update the buddy's status (reference: "libpurple/prpl.h") */ - if ( contact->statusMsg ) - purple_prpl_got_user_status( session->acc, username, mxit_statuses[contact->presence].id, "message", contact->statusMsg, NULL ); - else - purple_prpl_got_user_status( session->acc, username, mxit_statuses[contact->presence].id, NULL ); -} - - -/*------------------------------------------------------------------------ - * update the blist cached by libPurple. We need to do this to keep - * libPurple and MXit's rosters in sync with each other. - * - * @param session The MXit session object - */ -void mxit_update_blist( struct MXitSession* session ) -{ - PurpleBuddy* buddy = NULL; - GSList* list = NULL; - unsigned int i; - - /* remove all buddies we did not receive a roster update for. - * these contacts must have been removed from another client */ - list = purple_find_buddies( session->acc, NULL ); - - for ( i = 0; i < g_slist_length( list ); i++ ) { - buddy = g_slist_nth_data( list, i ); - - if ( !buddy->proto_data ) { - /* this buddy should be removed, because we did not receive him in our roster update from MXit */ - purple_debug_info( MXIT_PLUGIN_ID, "Removed 'old' buddy from the blist '%s' (%s)\n", buddy->alias, buddy->name ); - purple_blist_remove_buddy( buddy ); - } - } - - /* tell the UI to update the blist */ - purple_blist_add_account( session->acc ); -} - - -/*------------------------------------------------------------------------ - * The user authorized an invite (subscription request). - * - * @param user_data Object associated with the invite - */ -static void mxit_cb_buddy_auth( gpointer user_data ) -{ - struct contact_invite* invite = (struct contact_invite*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_buddy_auth '%s'\n", invite->contact->username ); - - /* send a allow subscription packet to MXit */ - mxit_send_allow_sub( invite->session, invite->contact->username, invite->contact->alias ); - - /* freeup invite object */ - if ( invite->contact->msg ) - g_free( invite->contact->msg ); - g_free( invite->contact ); - g_free( invite ); -} - - -/*------------------------------------------------------------------------ - * The user rejected an invite (subscription request). - * - * @param user_data Object associated with the invite - */ -static void mxit_cb_buddy_deny( gpointer user_data ) -{ - struct contact_invite* invite = (struct contact_invite*) user_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_cb_buddy_deny '%s'\n", invite->contact->username ); - - /* send a deny subscription packet to MXit */ - mxit_send_deny_sub( invite->session, invite->contact->username ); - - /* freeup invite object */ - if ( invite->contact->msg ) - g_free( invite->contact->msg ); - g_free( invite->contact ); - g_free( invite ); -} - - -/*------------------------------------------------------------------------ - * A new subscription request packet was received from the MXit server. - * Prompt user to accept or reject it. - * - * @param session The MXit session object - * @param contact The contact performing the invite - */ -void mxit_new_subscription( struct MXitSession* session, struct contact* contact ) -{ - struct contact_invite* invite; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_new_subscription from '%s' (%s)\n", contact->username, contact->alias ); - - invite = g_new0( struct contact_invite, 1 ); - invite->session = session; - invite->contact = contact; - - /* (reference: "libpurple/account.h") */ - purple_account_request_authorization( session->acc, contact->username, NULL, contact->alias, contact->msg, FALSE, mxit_cb_buddy_auth, mxit_cb_buddy_deny, invite ); -} - - -/*------------------------------------------------------------------------ - * Return TRUE if this is a MXit Chatroom contact. - * - * @param session The MXit session object - * @param username The username of the contact - */ -gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* username ) -{ - PurpleBuddy* buddy; - struct contact* contact = NULL; - - /* find the buddy */ - buddy = purple_find_buddy( session->acc, username ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "is_mxit_chatroom_contact: unable to find the buddy '%s'\n", username ); - return FALSE; - } - - contact = buddy->proto_data; - if ( !contact ) - return FALSE; - - return ( contact->type == MXIT_TYPE_CHATROOM ); -} - - -/*======================================================================================================================== - * Callbacks from libpurple - */ - -/*------------------------------------------------------------------------ - * The user has added a buddy to the list, so send an invite request. - * - * @param gc The connection object - * @param buddy The new buddy - * @param group The group of the new buddy - */ -void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - GSList* list = NULL; - PurpleBuddy* mxbuddy = NULL; - unsigned int i; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy '%s' (group='%s')\n", buddy->name, group->name ); - - list = purple_find_buddies( session->acc, buddy->name ); - if ( g_slist_length( list ) == 1 ) { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy (scenario 1) (list:%i)\n", g_slist_length( list ) ); - /* - * we only send an invite to MXit when the user is not already inside our - * blist. this is done because purple does an add_buddy() call when - * you accept an invite. so in that case the user is already - * in our blist and ready to be chatted to. - */ - mxit_send_invite( session, buddy->name, buddy->alias, group->name ); - } - else { - purple_debug_info( MXIT_PLUGIN_ID, "mxit_add_buddy (scenario 2) (list:%i)\n", g_slist_length( list ) ); - /* - * we already have the buddy in our list, so we will only update - * his information here and not send another invite message - */ - - /* find the correct buddy */ - for ( i = 0; i < g_slist_length( list ); i++ ) { - mxbuddy = g_slist_nth_data( list, i ); - - if ( mxbuddy->proto_data != NULL ) { - /* this is our REAL MXit buddy! */ - - /* now update the buddy's alias */ - purple_blist_alias_buddy( mxbuddy, buddy->alias ); - - /* now update the buddy's group */ -// mxbuddy = mxit_update_buddy_group( session, mxbuddy, group ); - - /* send the update to the MXit server */ - mxit_send_update_contact( session, mxbuddy->name, mxbuddy->alias, group->name ); - } - } - } - - /* - * we remove the buddy here from the buddy list because the MXit server - * will send us a proper contact update packet if this succeeds. now - * we do not have to worry about error handling in case of adding an - * invalid contact. so the user will still see the contact as offline - * until he eventually accepts the invite. - */ - purple_blist_remove_buddy( buddy ); - - g_slist_free( list ); -} - - -/*------------------------------------------------------------------------ - * The user has removed a buddy from the list. - * - * @param gc The connection object - * @param buddy The buddy being removed - * @param group The group the buddy was in - */ -void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_remove_buddy '%s'\n", buddy->name ); - - mxit_send_remove( session, buddy->name ); -} - - -/*------------------------------------------------------------------------ - * The user changed the buddy's alias. - * - * @param gc The connection object - * @param who The username of the buddy - * @param alias The new alias - */ -void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleBuddy* buddy = NULL; - PurpleGroup* group = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_alias '%s' to '%s\n", who, alias ); - - /* find the buddy */ - buddy = purple_find_buddy( session->acc, who ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_buddy_alias: unable to find the buddy '%s'\n", who ); - return; - } - - /* find buddy group */ - group = purple_buddy_get_group( buddy ); - if ( !group ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_buddy_alias: unable to find the group for buddy '%s'\n", who ); - return; - } - - mxit_send_update_contact( session, who, alias, group->name ); -} - - -/*------------------------------------------------------------------------ - * The user changed the group for a single buddy. - * - * @param gc The connection object - * @param who The username of the buddy - * @param old_group The old group's name - * @param new_group The new group's name - */ -void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleBuddy* buddy = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_buddy_group from '%s' to '%s'\n", old_group, new_group ); - - /* find the buddy */ - buddy = purple_find_buddy( session->acc, who ); - if ( !buddy ) { - purple_debug_warning( MXIT_PLUGIN_ID, "mxit_buddy_group: unable to find the buddy '%s'\n", who ); - return; - } - - mxit_send_update_contact( session, who, buddy->alias, new_group ); -} - - -/*------------------------------------------------------------------------ - * The user has selected to rename a group, so update all contacts in that - * group. - * - * @param gc The connection object - * @param old_name The old group name - * @param group The updated group object - * @param moved_buddies The buddies affected by the rename - */ -void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - PurpleBuddy* buddy = NULL; - GList* item = NULL; - - purple_debug_info( MXIT_PLUGIN_ID, "mxit_rename_group from '%s' to '%s\n", old_name, group->name ); - - // TODO: Might be more efficient to use the "rename group" command (cmd=29). - - /* loop through all the contacts in the group and send updates */ - item = moved_buddies; - while ( item ) { - buddy = item->data; - mxit_send_update_contact( session, buddy->name, buddy->alias, group->name ); - item = g_list_next( item ); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/roster.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- user roster management (mxit contacts) -- - * - * Pieter Loubser - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_ROSTER_H_ -#define _MXIT_ROSTER_H_ - - -/* MXit contact presence states */ -#define MXIT_PRESENCE_OFFLINE 0x00 -#define MXIT_PRESENCE_ONLINE 0x01 -#define MXIT_PRESENCE_AWAY 0x02 -#define MXIT_PRESENCE_AVAILABLE 0x03 -#define MXIT_PRESENCE_DND 0x04 - - -/* MXit contact types */ -#define MXIT_TYPE_MXIT 0x00 -#define MXIT_TYPE_JABBER 0x01 -#define MXIT_TYPE_MSN 0x02 -#define MXIT_TYPE_YAHOO 0x03 -#define MXIT_TYPE_ICQ 0x04 -#define MXIT_TYPE_AIM 0x05 -#define MXIT_TYPE_QQ 0x06 -#define MXIT_TYPE_WV 0x07 -#define MXIT_TYPE_BOT 0x08 -#define MXIT_TYPE_CHATROOM 0x09 -#define MXIT_TYPE_SMS 0x0A -#define MXIT_TYPE_GROUP 0x0B -#define MXIT_TYPE_GALLERY 0x0C -#define MXIT_TYPE_INFO 0x0D -#define MXIT_TYPE_MULTIMX 0x0E -#define MXIT_TYPE_HYBRID 0x0F - - -/* MXit contact moods */ -#define MXIT_MOOD_NONE 0x00 -#define MXIT_MOOD_ANGRY 0x01 -#define MXIT_MOOD_EXCITED 0x02 -#define MXIT_MOOD_GRUMPY 0x03 -#define MXIT_MOOD_HAPPY 0x04 -#define MXIT_MOOD_INLOVE 0x05 -#define MXIT_MOOD_INVINCIBLE 0x06 -#define MXIT_MOOD_SAD 0x07 -#define MXIT_MOOD_HOT 0x08 -#define MXIT_MOOD_SICK 0x09 -#define MXIT_MOOD_SLEEPY 0x0A - - -/* MXit contact flags */ -#define MXIT_CFLAG_HIDDEN 0x02 -#define MXIT_CFLAG_GATEWAY 0x04 -#define MXIT_CFLAG_FOCUS_SEND_BLANK 0x20000 - - -/* Subscription types */ -#define MXIT_SUBTYPE_BOTH 'B' -#define MXIT_SUBTYPE_PENDING 'P' -#define MXIT_SUBTYPE_ASK 'A' -#define MXIT_SUBTYPE_REJECTED 'R' -#define MXIT_SUBTYPE_DELETED 'D' -#define MXIT_SUBTYPE_NONE 'N' - - -/* client protocol constants */ -#define MXIT_CP_MAX_JID_LEN 64 -#define MXIT_CP_MAX_GROUP_LEN 32 -#define MXIT_CP_MAX_ALIAS_LEN 48 - -#define MXIT_DEFAULT_GROUP "MXit" - - -/* - * a MXit contact - */ -struct contact { - char username[MXIT_CP_MAX_JID_LEN+1]; /* unique contact name (with domain) */ - char alias[MXIT_CP_MAX_GROUP_LEN+1]; /* contact alias (what will be seen) */ - char groupname[MXIT_CP_MAX_ALIAS_LEN+1]; /* contact group name */ - - short type; /* contact type */ - short mood; /* contact current mood */ - int flags; /* contact flags */ - short presence; /* presence state */ - short subtype; /* subscription type */ - - char* msg; /* invite message */ - - char customMood[16]; /* custom mood */ - char* statusMsg; /* status message */ - char* avatarId; /* avatarId */ -}; - -/* Presence / Status */ -GList* mxit_status_types( PurpleAccount* account ); -int mxit_convert_presence( const char* id ); -const char* mxit_convert_presence_to_name( short no ); -const char* mxit_convert_subtype_to_name( short subtype ); - -/* Moods */ -const char* mxit_convert_mood_to_name( short id ); - -/* MXit Protocol callbacks */ -void mxit_update_contact( struct MXitSession* session, struct contact* contact ); -void mxit_update_buddy_presence( struct MXitSession* session, const char* username, short presence, short mood, const char* customMood, const char* statusMsg, const char* avatarId ); -void mxit_new_subscription( struct MXitSession* session, struct contact* contact ); -void mxit_update_blist( struct MXitSession* session ); -gboolean is_mxit_chatroom_contact( struct MXitSession* session, const char* username ); - -/* libPurple callbacks */ -void mxit_add_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ); -void mxit_remove_buddy( PurpleConnection* gc, PurpleBuddy* buddy, PurpleGroup* group ); -void mxit_buddy_alias( PurpleConnection* gc, const char* who, const char* alias ); -void mxit_buddy_group( PurpleConnection* gc, const char* who, const char* old_group, const char* new_group ); -void mxit_rename_group( PurpleConnection* gc, const char* old_name, PurpleGroup* group, GList* moved_buddies ); - - -#endif /* _MXIT_ROSTER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,222 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- splash screens -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "purple.h" -#include "imgstore.h" - -#include "protocol.h" -#include "mxit.h" -#include "splashscreen.h" - - -/*------------------------------------------------------------------------ - * Return the ID of the current splash-screen. - * - * @param session The MXit session object - * @return The ID of the splash-screen (or NULL if no splash-screen) - */ -const char* splash_current(struct MXitSession* session) -{ - const char* splashId = purple_account_get_string(session->acc, MXIT_CONFIG_SPLASHID, NULL); - - if ((splashId != NULL) && (*splashId != '\0')) { - purple_debug_info(MXIT_PLUGIN_ID, "Current splashId: '%s'\n", splashId); - return splashId; - } - else - return NULL; -} - - -/*------------------------------------------------------------------------ - * Indicate if splash-screen popups are enabled. - * - * @param session The MXit session object - * @return TRUE if the popup is enabled. - */ -gboolean splash_popup_enabled(struct MXitSession* session) -{ - return purple_account_get_bool(session->acc, MXIT_CONFIG_SPLASHPOPUP, DEFAULT_SPLASH_POPUP); -} - - -/*------------------------------------------------------------------------ - * Return if the current splash-screen is clickable. - * - * @param session The MXit session object - * @return TRUE or FALSE - */ -static gboolean splash_clickable(struct MXitSession* session) -{ - return purple_account_get_bool(session->acc, MXIT_CONFIG_SPLASHCLICK, FALSE); -} - - -/*------------------------------------------------------------------------ - * Remove the stored splash-screen (if it exists). - * - * @param session The MXit session object - */ -void splash_remove(struct MXitSession* session) -{ - const char* splashId = NULL; - char* filename; - - /* Get current splash ID */ - splashId = splash_current(session); - - if (splashId != NULL) { - purple_debug_info(MXIT_PLUGIN_ID, "Removing splashId: '%s'\n", splashId); - - /* Delete stored splash image */ - filename = g_strdup_printf("%s/mxit/%s.png", purple_user_dir(), splashId); - g_unlink(filename); - g_free(filename); - - /* Clear current splash ID from settings */ - purple_account_set_string(session->acc, MXIT_CONFIG_SPLASHID, ""); - purple_account_set_bool(session->acc, MXIT_CONFIG_SPLASHCLICK, FALSE); - } -} - - -/*------------------------------------------------------------------------ - * Save a new splash-screen for later display. - * - * @param session The MXit session object - * @param splashID The ID of the splash-screen - * @param data Splash-screen image data (PNG format) - * @param datalen Splash-screen image data size - */ -void splash_update(struct MXitSession* session, const char* splashId, const char* data, int datalen, gboolean clickable) -{ - char* dir; - char* filename; - - /* Remove the current splash-screen */ - splash_remove(session); - - /* Save the new splash image */ - dir = g_strdup_printf("%s/mxit", purple_user_dir()); - purple_build_dir(dir, S_IRUSR | S_IWUSR | S_IXUSR); /* ensure directory exists */ - - filename = g_strdup_printf("%s/%s.png", dir, splashId); - if (purple_util_write_data_to_file_absolute(filename, data, datalen)) { - /* Store new splash-screen ID to settings */ - purple_account_set_string(session->acc, MXIT_CONFIG_SPLASHID, splashId); - purple_account_set_bool(session->acc, MXIT_CONFIG_SPLASHCLICK, clickable ); - } - - g_free(dir); - g_free(filename); -} - - -/*------------------------------------------------------------------------ - * The user has clicked OK on the Splash request form. - * - * @param gc The connection object - * @param fields The list of fields in the accepted form - */ -static void splash_click_ok(PurpleConnection* gc, PurpleRequestFields* fields) -{ - struct MXitSession* session = (struct MXitSession*) gc->proto_data; - const char* splashId; - - /* Get current splash ID */ - splashId = splash_current(session); - if (splashId == NULL) /* no splash-screen */ - return; - - /* if is clickable, then send click event */ - if (splash_clickable(session)) - mxit_send_splashclick(session, splashId); -} - - -/*------------------------------------------------------------------------ - * Display the current splash-screen. - * - * @param session The MXit session object - */ -void splash_display(struct MXitSession* session) -{ - const char* splashId = NULL; - char* filename; - gchar* imgdata; - gsize imglen; - int imgid = -1; - - /* Get current splash ID */ - splashId = splash_current(session); - if (splashId == NULL) /* no splash-screen */ - return; - - purple_debug_info(MXIT_PLUGIN_ID, "Display Splash: '%s'\n", splashId); - - /* Load splash-screen image from file */ - filename = g_strdup_printf("%s/mxit/%s.png", purple_user_dir(), splashId); - if (g_file_get_contents(filename, &imgdata, &imglen, NULL)) { - char buf[128]; - - /* Add splash-image to imagestore */ - imgid = purple_imgstore_add_with_id(g_memdup(imgdata, imglen), imglen, NULL); - - /* Generate and display message */ - g_snprintf(buf, sizeof(buf), "", imgid); - - /* Open a request-type popup to display the image */ - { - PurpleRequestFields* fields; - PurpleRequestFieldGroup* group; - PurpleRequestField* field; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_image_new("splash", "", imgdata, imglen); /* add splash image */ - purple_request_field_group_add_field(group, field); - - if (splash_clickable(session)) { - purple_request_fields(session->con, _("MXit Advertising"), NULL, NULL, fields, - _("More Information"), G_CALLBACK(splash_click_ok), _("Close"), NULL, session->acc, NULL, NULL, session->con); - } - else { - purple_request_fields(session->con, _("MXit Advertising"), NULL, NULL, fields, - _("Continue"), G_CALLBACK(splash_click_ok), _("Close"), NULL, session->acc, NULL, NULL, session->con); - } - } - - /* Release reference to image */ - purple_imgstore_unref_by_id(imgid); - - g_free(imgdata); - } - - g_free(filename); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/mxit/splashscreen.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * MXit Protocol libPurple Plugin - * - * -- splash screens -- - * - * Andrew Victor - * - * (C) Copyright 2009 MXit Lifestyle (Pty) Ltd. - * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MXIT_SPLASHSCREEN_H_ -#define _MXIT_SPLASHSCREEN_H_ - -#define HANDLE_SPLASH1 "plas1.png" -#define HANDLE_SPLASH2 "plas2.png" - -#define DEFAULT_SPLASH_POPUP FALSE /* disabled by default */ - -/* - * Return the ID of the current splash-screen. - */ -const char* splash_current(struct MXitSession* session); - -/* - * Indicate if splash-screen popups are enabled. - */ -gboolean splash_popup_enabled(struct MXitSession* session); - -/* - * Save a new splash-screen. - */ -void splash_update(struct MXitSession* session, const char* splashId, const char* data, int datalen, gboolean clickable); - -/* - * Remove the stored splash-screen (if it exists). - */ -void splash_remove(struct MXitSession* session); - -/* - * Display the current splash-screen. - */ -void splash_display(struct MXitSession* session); - -#endif /* _MXIT_SPLASHSCREEN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -MSIMSOURCES = markup.c \ - markup.h \ - message.c \ - message.h \ - myspace.c \ - myspace.h \ - persist.h \ - session.c \ - session.h \ - user.c \ - user.h \ - zap.c \ - zap.h - -AM_CFLAGS = $(st) - -libmyspace_la_LDFLAGS = -module -avoid-version - -if STATIC_MYSPACE - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libmyspace.la -libmyspace_la_SOURCES = $(MSIMSOURCES) -libmyspace_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libmyspace.la -libmyspace_la_SOURCES = $(MSIMSOURCES) -libmyspace_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,795 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/myspace -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_MYSPACE_FALSE@libmyspace_la_DEPENDENCIES = \ -@STATIC_MYSPACE_FALSE@ $(am__DEPENDENCIES_1) -am__libmyspace_la_SOURCES_DIST = markup.c markup.h message.c message.h \ - myspace.c myspace.h persist.h session.c session.h user.c \ - user.h zap.c zap.h -am__objects_1 = libmyspace_la-markup.lo libmyspace_la-message.lo \ - libmyspace_la-myspace.lo libmyspace_la-session.lo \ - libmyspace_la-user.lo libmyspace_la-zap.lo -@STATIC_MYSPACE_FALSE@am_libmyspace_la_OBJECTS = $(am__objects_1) -@STATIC_MYSPACE_TRUE@am_libmyspace_la_OBJECTS = $(am__objects_1) -libmyspace_la_OBJECTS = $(am_libmyspace_la_OBJECTS) -@STATIC_MYSPACE_FALSE@am_libmyspace_la_rpath = -rpath $(pkgdir) -@STATIC_MYSPACE_TRUE@am_libmyspace_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libmyspace_la_SOURCES) -DIST_SOURCES = $(am__libmyspace_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -MSIMSOURCES = markup.c \ - markup.h \ - message.c \ - message.h \ - myspace.c \ - myspace.h \ - persist.h \ - session.c \ - session.h \ - user.c \ - user.h \ - zap.c \ - zap.h - -AM_CFLAGS = $(st) -libmyspace_la_LDFLAGS = -module -avoid-version -@STATIC_MYSPACE_FALSE@st = -@STATIC_MYSPACE_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_MYSPACE_TRUE@noinst_LTLIBRARIES = libmyspace.la -@STATIC_MYSPACE_FALSE@libmyspace_la_SOURCES = $(MSIMSOURCES) -@STATIC_MYSPACE_TRUE@libmyspace_la_SOURCES = $(MSIMSOURCES) -@STATIC_MYSPACE_TRUE@libmyspace_la_CFLAGS = $(AM_CFLAGS) -@STATIC_MYSPACE_FALSE@pkg_LTLIBRARIES = libmyspace.la -@STATIC_MYSPACE_FALSE@libmyspace_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/myspace/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/myspace/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libmyspace.la: $(libmyspace_la_OBJECTS) $(libmyspace_la_DEPENDENCIES) - $(LINK) $(am_libmyspace_la_rpath) $(libmyspace_la_LDFLAGS) $(libmyspace_la_OBJECTS) $(libmyspace_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-markup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-message.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-myspace.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-session.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-user.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmyspace_la-zap.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libmyspace_la-markup.lo: markup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-markup.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-markup.Tpo" -c -o libmyspace_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-markup.Tpo" "$(DEPDIR)/libmyspace_la-markup.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-markup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='markup.c' object='libmyspace_la-markup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-markup.lo `test -f 'markup.c' || echo '$(srcdir)/'`markup.c - -libmyspace_la-message.lo: message.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-message.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-message.Tpo" -c -o libmyspace_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-message.Tpo" "$(DEPDIR)/libmyspace_la-message.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-message.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='message.c' object='libmyspace_la-message.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-message.lo `test -f 'message.c' || echo '$(srcdir)/'`message.c - -libmyspace_la-myspace.lo: myspace.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-myspace.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-myspace.Tpo" -c -o libmyspace_la-myspace.lo `test -f 'myspace.c' || echo '$(srcdir)/'`myspace.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-myspace.Tpo" "$(DEPDIR)/libmyspace_la-myspace.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-myspace.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='myspace.c' object='libmyspace_la-myspace.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-myspace.lo `test -f 'myspace.c' || echo '$(srcdir)/'`myspace.c - -libmyspace_la-session.lo: session.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-session.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-session.Tpo" -c -o libmyspace_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-session.Tpo" "$(DEPDIR)/libmyspace_la-session.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-session.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='session.c' object='libmyspace_la-session.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-session.lo `test -f 'session.c' || echo '$(srcdir)/'`session.c - -libmyspace_la-user.lo: user.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-user.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-user.Tpo" -c -o libmyspace_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-user.Tpo" "$(DEPDIR)/libmyspace_la-user.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-user.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='user.c' object='libmyspace_la-user.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-user.lo `test -f 'user.c' || echo '$(srcdir)/'`user.c - -libmyspace_la-zap.lo: zap.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -MT libmyspace_la-zap.lo -MD -MP -MF "$(DEPDIR)/libmyspace_la-zap.Tpo" -c -o libmyspace_la-zap.lo `test -f 'zap.c' || echo '$(srcdir)/'`zap.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libmyspace_la-zap.Tpo" "$(DEPDIR)/libmyspace_la-zap.Plo"; else rm -f "$(DEPDIR)/libmyspace_la-zap.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zap.c' object='libmyspace_la-zap.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmyspace_la_CFLAGS) $(CFLAGS) -c -o libmyspace_la-zap.lo `test -f 'zap.c' || echo '$(srcdir)/'`zap.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libmyspace -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libmyspace -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS = -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = myspace.c message.c zap.c session.c markup.c user.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -## -## BUILD DLL -## -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,763 +0,0 @@ -/* MySpaceIM Protocol Plugin - markup - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" - -typedef int (*MSIM_XMLNODE_CONVERT)(MsimSession *, xmlnode *, gchar **, gchar **); - -/* Globals */ - -/* The names in in emoticon_names (for ) map to corresponding - * entries in emoticon_symbols (for the ASCII representation of the emoticon). - * - * Multiple emoticon symbols in Pidgin can map to one name. List the - * canonical form, as inserted by the "Smile!" dialog, first. For example, - * :) comes before :-), because although both are recognized as 'happy', - * the first is inserted by the smiley button (first symbol in theme). - * - * Note that symbols are case-sensitive in Pidgin -- :-X is not :-x. */ -static struct MSIM_EMOTICON -{ - gchar *name; - gchar *symbol; -} msim_emoticons[] = { - /* Unfortunately, this list duplicates much of the file - * pidgin/pidgin/pixmaps/emotes/default/22/default.theme.in, because - * that file is part of Pidgin, but we're part of libpurple. - */ - { "bigsmile", ":D" }, - { "bigsmile", ":-D" }, - { "devil", "}:)" }, - { "frazzled", ":Z" }, - { "geek", "B)" }, - { "googles", "%)" }, - { "growl", ":E" }, - { "laugh", ":))" }, /* Must be before ':)' */ - { "happy", ":)" }, - { "happy", ":-)" }, - { "happi", ":)" }, - { "heart", ":X" }, - { "mohawk", "-:" }, - { "mad", "X(" }, - { "messed", "X)" }, - { "nerd", "Q)" }, - { "oops", ":G" }, - { "pirate", "P)" }, - { "scared", ":O" }, - { "sidefrown", ":{" }, - { "sinister", ":B" }, - { "smirk", ":," }, - { "straight", ":|" }, - { "tongue", ":P" }, - { "tongue", ":p" }, - { "tongy", ":P" }, - { "upset", "B|" }, - { "wink", ";-)" }, - { "wink", ";)" }, - { "winc", ";)" }, - { "worried", ":[" }, - { "kiss", ":x" }, - { NULL, NULL } -}; - -/* Indexes of this array + 1 map HTML font size to scale of normal font size. * - * Based on _point_sizes from libpurple/gtkimhtml.c - * 1 2 3 4 5 6 7 */ -static gdouble _font_scale[] = { .85, .95, 1, 1.2, 1.44, 1.728, 2.0736 }; - -/* Purple maximum font size. Equivalent to sizeof(_font_scale) / sizeof(_font_scale[0]) */ -#define MAX_FONT_SIZE 7 - -#define POINTS_PER_INCH 72 /* How many pt's in an inch */ - -/* Text formatting bits for */ -#define MSIM_TEXT_BOLD 1 -#define MSIM_TEXT_ITALIC 2 -#define MSIM_TEXT_UNDERLINE 4 - -/* Default baseline size of purple's fonts, in points. What is size 3 in points. - * _font_scale specifies scaling factor relative to this point size. Note this - * is only the default; it is configurable in account options. */ -#define MSIM_BASE_FONT_POINT_SIZE 8 - -/* Default display's DPI. 96 is common but it can differ. Also configurable - * in account options. */ -#define MSIM_DEFAULT_DPI 96 - -/* round is part of C99, but sometimes is unavailable before then. - * Based on http://forums.belution.com/en/cpp/000/050/13.shtml - */ -static double msim_round(double value) -{ - if (value < 0) { - return -(floor(-value + 0.5)); - } else { - return floor( value + 0.5); - } -} - -/** - * Convert typographical font point size to HTML font size. - * Based on libpurple/gtkimhtml.c - */ -static guint -msim_point_to_purple_size(MsimSession *session, guint point) -{ - guint size, this_point, base; - - base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - - for (size = 0; size < MAX_FONT_SIZE; ++size) { - this_point = (guint)msim_round(base * _font_scale[size]); - - if (this_point >= point) { - purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n", - point, size); - return size; - } - } - - /* No HTML font size was this big; return largest possible. */ - return this_point; -} - -/** - * Convert HTML font size to point size. - */ -static guint -msim_purple_size_to_point(MsimSession *session, guint size) -{ - gdouble scale; - guint point; - guint base; - - scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; - - base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - - point = (guint)msim_round(scale * base); - - purple_debug_info("msim", "msim_purple_size_to_point: size=%d -> %d pt\n", - size, point); - - return point; -} - -/** - * Convert a msim markup font pixel height to the more usual point size, for incoming messages. - */ -static guint -msim_height_to_point(MsimSession *session, guint height) -{ - guint dpi; - - dpi = purple_account_get_int(session->account, "dpi", MSIM_DEFAULT_DPI); - - return (guint)msim_round((POINTS_PER_INCH * 1. / dpi) * height); - - /* See also: libpurple/protocols/bonjour/jabber.c - * _font_size_ichat_to_purple */ -} - -/** - * Convert point size to msim pixel height font size specification, for outgoing messages. - */ -static guint -msim_point_to_height(MsimSession *session, guint point) -{ - guint dpi; - - dpi = purple_account_get_int(session->account, "dpi", MSIM_DEFAULT_DPI); - - return (guint)msim_round((dpi * 1. / POINTS_PER_INCH) * point); -} - -/** - * Convert the msim markup (font) tag into HTML. - */ -static void -msim_markup_f_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *face, *height_str, *decor_str; - GString *gs_end, *gs_begin; - guint decor, height; - - face = xmlnode_get_attrib(root, "f"); - height_str = xmlnode_get_attrib(root, "h"); - decor_str = xmlnode_get_attrib(root, "s"); - - /* Validate the font face, to avoid constructing invalid HTML later */ - if (face != NULL && strchr(face, '\'') != NULL) - face = NULL; - - height = height_str != NULL ? atol(height_str) : 12; - decor = decor_str != NULL ? atol(decor_str) : 0; - - /* - * The HTML we're constructing here is a bit redudant. Ideally we - * would use only the font-family and font-size CSS span, but Pidgin - * doesn't support it (it's included for other UIs). For Pidgin we - * wrap the whole thing in an ugly font tag, and Pidgin will happily - * ignore the . - */ - gs_begin = g_string_new(""); - if (height && !face) { - guint point_size = msim_height_to_point(session, height); - g_string_printf(gs_begin, - "", - msim_point_to_purple_size(session, point_size), - point_size); - } else if (height && face) { - guint point_size = msim_height_to_point(session, height); - g_string_printf(gs_begin, - "", - face, msim_point_to_purple_size(session, point_size), - face, point_size); - } else { - g_string_printf(gs_begin, ""); - } - - gs_end = g_string_new(""); - - if (decor & MSIM_TEXT_BOLD) { - g_string_append(gs_begin, ""); - g_string_prepend(gs_end, ""); - } - - if (decor & MSIM_TEXT_ITALIC) { - g_string_append(gs_begin, ""); - g_string_append(gs_end, ""); - } - - if (decor & MSIM_TEXT_UNDERLINE) { - g_string_append(gs_begin, ""); - g_string_append(gs_end, ""); - } - - *begin = g_string_free(gs_begin, FALSE); - *end = g_string_free(gs_end, FALSE); -} - -/** - * Convert a msim markup color to a color suitable for libpurple. - * - * @param msim Either a color name, or an rgb(x,y,z) code. - * - * @return A new string, either a color name or #rrggbb code. Must g_free(). - */ -static char * -msim_color_to_purple(const char *msim) -{ - guint red, green, blue; - - if (!msim) { - return g_strdup("black"); - } - - if (sscanf(msim, "rgb(%d,%d,%d)", &red, &green, &blue) != 3) { - /* Color name. */ - return g_strdup(msim); - } - /* TODO: rgba (alpha). */ - - return g_strdup_printf("#%.2x%.2x%.2x", red, green, blue); -} - -/** - * Convert the msim markup (anchor) tag into HTML. - */ -static void -msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *href; - - href = xmlnode_get_attrib(root, "h"); - if (!href) { - href = ""; - } - - *begin = g_strdup_printf("%s", href, href); - *end = g_strdup(""); -} - -/** - * Convert the msim markup

(paragraph) tag into HTML. - */ -static void -msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - /* Just pass through unchanged. - * - * Note: attributes currently aren't passed, if there are any. */ - *begin = g_strdup("

"); - *end = g_strdup("

"); -} - -/** - * Convert the msim markup tag (text color) into HTML. - */ -static void -msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *color; - gchar *purple_color; - - color = xmlnode_get_attrib(root, "v"); - if (!color) { - purple_debug_info("msim", "msim_markup_c_to_html: tag w/o v attr\n"); - *begin = g_strdup(""); - *end = g_strdup(""); - /* TODO: log as unrecognized */ - return; - } - - purple_color = msim_color_to_purple(color); - -#ifdef USE_CSS_FORMATTING - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#else - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#endif - - g_free(purple_color); -} - -/** - * Convert the msim markup tag (background color) into HTML. - */ -static void -msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *color; - gchar *purple_color; - - color = xmlnode_get_attrib(root, "v"); - if (!color) { - *begin = g_strdup(""); - *end = g_strdup(""); - purple_debug_info("msim", "msim_markup_b_to_html: w/o v attr\n"); - /* TODO: log as unrecognized. */ - return; - } - - purple_color = msim_color_to_purple(color); - -#ifdef USE_CSS_FORMATTING - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#else - *begin = g_strdup_printf("", purple_color); - *end = g_strdup(""); -#endif - - g_free(purple_color); -} - -/** - * Convert the msim markup tag (emoticon image) into HTML. - */ -static void -msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) -{ - const gchar *name; - guint i; - struct MSIM_EMOTICON *emote; - - name = xmlnode_get_attrib(root, "n"); - if (!name) { - purple_debug_info("msim", "msim_markup_i_to_html: w/o n\n"); - *begin = g_strdup(""); - *end = g_strdup(""); - /* TODO: log as unrecognized */ - return; - } - - /* Find and use canonical form of smiley symbol. */ - for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { - if (g_str_equal(name, emote->name)) { - *begin = g_strdup(emote->symbol); - *end = g_strdup(""); - return; - } - } - - /* Couldn't find it, sorry. Try to degrade gracefully. */ - *begin = g_strdup_printf("**%s**", name); - *end = g_strdup(""); -} - -/** - * Convert an individual msim markup tag to HTML. - */ -static int -msim_markup_tag_to_html(MsimSession *session, xmlnode *root, gchar **begin, - gchar **end) -{ - g_return_val_if_fail(root != NULL, 0); - - if (g_str_equal(root->name, "f")) { - msim_markup_f_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "a")) { - msim_markup_a_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "p")) { - msim_markup_p_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "c")) { - msim_markup_c_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "b")) { - msim_markup_b_to_html(session, root, begin, end); - } else if (g_str_equal(root->name, "i")) { - msim_markup_i_to_html(session, root, begin, end); - } else { - purple_debug_info("msim", "msim_markup_tag_to_html: " - "unknown tag name=%s, ignoring\n", - root->name ? root->name : "(NULL)"); - *begin = g_strdup(""); - *end = g_strdup(""); - } - return 0; -} - -/** - * Convert an individual HTML tag to msim markup. - */ -static int -html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, - gchar **end) -{ - int ret = 0; - - if (!purple_utf8_strcasecmp(root->name, "root") || - !purple_utf8_strcasecmp(root->name, "html")) { - *begin = g_strdup(""); - *end = g_strdup(""); - /* TODO: Coalesce nested tags into one tag! - * Currently, the 's' value will be overwritten when b/i/u is nested - * within another one, and only the inner-most formatting will be - * applied to the text. */ - } else if (!purple_utf8_strcasecmp(root->name, "b")) { - if (root->child->type == XMLNODE_TYPE_DATA) { - *begin = g_strdup_printf("", MSIM_TEXT_BOLD); - *end = g_strdup(""); - } else { - if (!purple_utf8_strcasecmp(root->child->name,"i")) { - ret++; - if (root->child->child->type == XMLNODE_TYPE_DATA) { - *begin = g_strdup_printf("", (MSIM_TEXT_BOLD + MSIM_TEXT_ITALIC)); - *end = g_strdup(""); - } else { - if (!purple_utf8_strcasecmp(root->child->child->name,"u")) { - ret++; - *begin = g_strdup_printf("", (MSIM_TEXT_BOLD + MSIM_TEXT_ITALIC + MSIM_TEXT_UNDERLINE)); - *end = g_strdup(""); - } - } - } else if (!purple_utf8_strcasecmp(root->child->name,"u")) { - ret++; - *begin = g_strdup_printf("", (MSIM_TEXT_BOLD + MSIM_TEXT_UNDERLINE)); - *end = g_strdup(""); - } - } - } else if (!purple_utf8_strcasecmp(root->name, "i")) { - if (root->child->type == XMLNODE_TYPE_DATA) { - *begin = g_strdup_printf("", MSIM_TEXT_ITALIC); - *end = g_strdup(""); - } else { - if (!purple_utf8_strcasecmp(root->child->name,"u")) { - ret++; - *begin = g_strdup_printf("", (MSIM_TEXT_ITALIC + MSIM_TEXT_UNDERLINE)); - *end = g_strdup(""); - } - } - } else if (!purple_utf8_strcasecmp(root->name, "u")) { - *begin = g_strdup_printf("", MSIM_TEXT_UNDERLINE); - *end = g_strdup(""); - } else if (!purple_utf8_strcasecmp(root->name, "a")) { - const gchar *href; - gchar *link_text; - - href = xmlnode_get_attrib(root, "href"); - - if (!href) { - href = xmlnode_get_attrib(root, "HREF"); - } - - link_text = xmlnode_get_data(root); - - if (href) { - if (g_str_equal(link_text, href)) { - /* Purple gives us: URL - * Translate to - * Displayed as text of URL with link to URL - */ - *begin = g_strdup_printf("", href); - } else { - /* But if we get: text - * Translate to: text: - * - * Because official client only supports self-closed - * tags; you can't change the link text. - */ - *begin = g_strdup_printf("%s: ", link_text, href); - } - } else { - *begin = g_strdup(""); - } - - /* Sorry, kid. MySpace doesn't support you within tags. */ - xmlnode_free(root->child); - g_free(link_text); - root->child = NULL; - - *end = g_strdup(""); - } else if (!purple_utf8_strcasecmp(root->name, "font")) { - GString *tmpbegin, *tmpend; - const gchar *size; - const gchar *face; - const gchar *color; - - size = xmlnode_get_attrib(root, "size"); - face = xmlnode_get_attrib(root, "face"); - color = xmlnode_get_attrib(root, "color"); - - tmpbegin = g_string_new(""); - - if (face != NULL) - g_string_append_printf(tmpbegin, " f='%s'", face); - - if (size != NULL) - g_string_append_printf(tmpbegin, " h='%d'", - msim_point_to_height(session, - msim_purple_size_to_point(session, atoi(size)))); - - /* Close the tag */ - g_string_append(tmpbegin, ">"); - - if (color != NULL) { - g_string_append_printf(tmpbegin, "", color); - g_string_prepend(tmpend, ""); - } - - *begin = g_string_free(tmpbegin, FALSE); - *end = g_string_free(tmpend, FALSE); - - } else if (!purple_utf8_strcasecmp(root->name, "body")) { - const gchar *bgcolor; - - bgcolor = xmlnode_get_attrib(root, "bgcolor"); - - if (bgcolor != NULL) { - *begin = g_strdup_printf("", bgcolor); - *end = g_strdup(""); - } - - } else { - gchar *err; - -#ifdef MSIM_MARKUP_SHOW_UNKNOWN_TAGS - *begin = g_strdup_printf("[%s]", root->name); - *end = g_strdup_printf("[/%s]", root->name); -#else - *begin = g_strdup(""); - *end = g_strdup(""); -#endif - - err = g_strdup_printf("html_tag_to_msim_markup: unrecognized " - "HTML tag %s was sent by the IM client; ignoring", - root->name ? root->name : "(NULL)"); - msim_unrecognized(NULL, NULL, err); - g_free(err); - } - return ret; -} - -/** - * Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. - * - * @param f Function to convert tags. - * - * @return An HTML string. Caller frees. - */ -static void -msim_convert_xmlnode(MsimSession *session, GString *out, xmlnode *root, MSIM_XMLNODE_CONVERT f, int nodes_processed) -{ - xmlnode *node; - gchar *begin, *inner, *end, *tmp; - int descended = nodes_processed; - - if (!root || !root->name) - return; - - purple_debug_info("msim", "msim_convert_xmlnode: got root=%s\n", - root->name); - - begin = inner = end = NULL; - - if (descended == 0) /* We've not formatted this yet.. :) */ - descended = f(session, root, &begin, &end); /* Get the value that our format function has already descended for us */ - - g_string_append(out, begin); - g_free(begin); - - /* Loop over all child nodes. */ - for (node = root->child; node != NULL; node = node->next) { - switch (node->type) { - case XMLNODE_TYPE_ATTRIB: - /* Attributes handled above. */ - break; - - case XMLNODE_TYPE_TAG: - /* A tag or tag with attributes. Recursively descend. */ - msim_convert_xmlnode(session, out, node, f, descended); - - purple_debug_info("msim", " ** node name=%s\n", - node->name ? node->name : "(NULL)"); - break; - - case XMLNODE_TYPE_DATA: - /* Literal text. */ - /* - * TODO: Why is it necessary to escape here? I thought - * node->data was already escaped? - */ - tmp = g_markup_escape_text(node->data, node->data_sz); - g_string_append(out, tmp); - g_free(tmp); - break; - - default: - purple_debug_warning("msim", - "msim_convert_xmlnode: unknown node type\n"); - } - } - - /* TODO: Note that msim counts each piece of text enclosed by as - * a paragraph and will display each on its own line. You actually have - * to _nest_ tags to intersperse different text in one paragraph! - * Comment out this line below to see. */ - g_string_append(out, end); - g_free(end); -} - -/** - * Convert XML to something based on MSIM_XMLNODE_CONVERT. - */ -static gchar * -msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) -{ - xmlnode *root; - GString *str; - gchar *enclosed_raw; - - g_return_val_if_fail(raw != NULL, NULL); - - /* Enclose text in one root tag, to try to make it valid XML for parsing. */ - enclosed_raw = g_strconcat("", raw, "", NULL); - - root = xmlnode_from_str(enclosed_raw, -1); - - if (!root) { - purple_debug_warning("msim", "msim_markup_to_html: couldn't parse " - "%s as XML, returning raw: %s\n", enclosed_raw, raw); - /* TODO: msim_unrecognized */ - g_free(enclosed_raw); - return g_strdup(raw); - } - - g_free(enclosed_raw); - - str = g_string_new(NULL); - msim_convert_xmlnode(session, str, root, f, 0); - xmlnode_free(root); - - purple_debug_info("msim", "msim_markup_to_html: returning %s\n", str->str); - - return g_string_free(str, FALSE); -} - -/** - * Convert plaintext smileys to markup tags. - * - * @param before Original text with ASCII smileys. Will be freed. - * @return A new string with tags, if applicable. Must be g_free()'d. - */ -static gchar * -msim_convert_smileys_to_markup(gchar *before) -{ - gchar *old, *new, *replacement; - guint i; - struct MSIM_EMOTICON *emote; - - old = before; - new = NULL; - - for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { - gchar *name, *symbol; - - name = emote->name; - symbol = emote->symbol; - - replacement = g_strdup_printf("", name); - - purple_debug_info("msim", "msim_convert_smileys_to_markup: %s->%s\n", - symbol ? symbol : "(NULL)", - replacement ? replacement : "(NULL)"); - new = purple_strreplace(old, symbol, replacement); - - g_free(replacement); - g_free(old); - - old = new; - } - - return new; -} - -/** - * High-level function to convert MySpaceIM markup to Purple (HTML) markup. - * - * @return Purple markup string, must be g_free()'d. */ -gchar * -msim_markup_to_html(MsimSession *session, const gchar *raw) -{ - return msim_convert_xml(session, raw, msim_markup_tag_to_html); -} - -/** - * High-level function to convert Purple (HTML) to MySpaceIM markup. - * - * TODO: consider using purple_markup_html_to_xhtml() to make valid XML. - * - * @return HTML markup string, must be g_free()'d. */ -gchar * -html_to_msim_markup(MsimSession *session, const gchar *raw) -{ - gchar *markup; - - markup = msim_convert_xml(session, raw, html_tag_to_msim_markup); - - if (purple_account_get_bool(session->account, "emoticons", TRUE)) { - /* Frees markup and allocates a new one. */ - markup = msim_convert_smileys_to_markup(markup); - } - - return markup; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/markup.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/* MySpaceIM Protocol Plugin - markup - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_MARKUP_H -#define _MYSPACE_MARKUP_H - -/* High-level msim markup <=> Purple html conversion functions. */ -gchar *msim_markup_to_html(MsimSession *, const gchar *raw); -gchar *html_to_msim_markup(MsimSession *, const gchar *raw); - -#endif /* !_MYSPACE_MARKUP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1411 +0,0 @@ -/** MySpaceIM protocol messages - * - * \author Jeff Connelly - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" -#include "message.h" - -static void msim_msg_debug_string_element(gpointer data, gpointer user_data); - -/** - * Escape codes and associated replacement text, used for protocol message - * escaping and unescaping. - */ -static struct MSIM_ESCAPE_REPLACEMENT { - gchar *code; - gchar text; -} msim_escape_replacements[] = { - { "/1", '/' }, - { "/2", '\\' }, - /* { "/3", "|" }, */ /* Not used here -- only for within arrays */ - { NULL, 0 } -}; - -/** - * Escape a protocol message. - * - * @return The escaped message. Caller must g_free(). - */ -gchar * -msim_escape(const gchar *msg) -{ - GString *gs; - guint i, j; - guint msg_len; - - gs = g_string_new(""); - msg_len = strlen(msg); - - for (i = 0; i < msg_len; ++i) { - struct MSIM_ESCAPE_REPLACEMENT *replacement; - gchar *replace; - - replace = NULL; - - /* Check for characters that need to be escaped, and escape them. */ - for (j = 0; (replacement = &msim_escape_replacements[j]) && - replacement->code != NULL; ++j) { - if (msg[i] == replacement->text) { - replace = replacement->code; - break; - } - } - - if (replace) { - g_string_append(gs, replace); - } else { - g_string_append_c(gs, msg[i]); - } - } - -#ifdef MSIM_DEBUG_ESCAPE - purple_debug_info("msim", "msim_escape: msg=%s, ret=%s\n", msg, gs->str); -#endif - - return g_string_free(gs, FALSE); -} - -/** - * Unescape a protocol message. - * - * @return The unescaped message, caller must g_free(). - */ -gchar * -msim_unescape(const gchar *msg) -{ - GString *gs; - guint i, j; - guint msg_len; - - gs = g_string_new(""); - msg_len = strlen(msg); - - for (i = 0; i < msg_len; ++i) { - struct MSIM_ESCAPE_REPLACEMENT *replacement; - gchar replace; - - replace = msg[i]; - - for (j = 0; (replacement = &msim_escape_replacements[j]) && - replacement->code != NULL; ++j) { - if (msg[i] == replacement->code[0] && - i + 1 < msg_len && - msg[i + 1] == replacement->code[1]) { - replace = replacement->text; - ++i; - break; - } - } - - g_string_append_c(gs, replace); - } - -#ifdef MSIM_DEBUG_ESCAPE - purple_debug_info("msim", "msim_unescape: msg=%s, ret=%s\n", msg, gs->str); -#endif - - return g_string_free(gs, FALSE); -} - -/** - * Create a new message from va_list and its first argument. - * - * @param first_key The first argument (a key), or NULL to take all arguments - * from argp. - * @param argp A va_list of variadic arguments, already started with va_start(). Will be va_end()'d. - * @return New MsimMessage *, must be freed with msim_msg_free(). - * - * For internal use - users probably want msim_msg_new() or msim_send(). - */ -static MsimMessage * -msim_msg_new_v(gchar *first_key, va_list argp) -{ - gchar *key, *value; - MsimMessageType type; - MsimMessage *msg; - gboolean first; - - GString *gs; - GList *gl; - MsimMessage *dict; - - /* Begin with an empty message. */ - msg = NULL; - - /* First parameter can be given explicitly. */ - first = first_key != NULL; - - /* Read key, type, value triplets until NULL. */ - do { - if (first) { - key = first_key; - first = FALSE; - } else { - key = va_arg(argp, gchar *); - if (!key) { - break; - } - } - - type = va_arg(argp, int); - - /* Interpret variadic arguments. */ - switch (type) { - case MSIM_TYPE_INTEGER: - case MSIM_TYPE_BOOLEAN: - msg = msim_msg_append(msg, key, type, GUINT_TO_POINTER(va_arg(argp, int))); - break; - - case MSIM_TYPE_STRING: - value = va_arg(argp, char *); - - g_return_val_if_fail(value != NULL, FALSE); - - msg = msim_msg_append(msg, key, type, value); - break; - - case MSIM_TYPE_BINARY: - gs = va_arg(argp, GString *); - - g_return_val_if_fail(gs != NULL, FALSE); - - /* msim_msg_free() will free this GString the caller created. */ - msg = msim_msg_append(msg, key, type, gs); - break; - - case MSIM_TYPE_LIST: - gl = va_arg(argp, GList *); - - g_return_val_if_fail(gl != NULL, FALSE); - - msg = msim_msg_append(msg, key, type, gl); - break; - - case MSIM_TYPE_DICTIONARY: - dict = va_arg(argp, MsimMessage *); - - g_return_val_if_fail(dict != NULL, FALSE); - - msg = msim_msg_append(msg, key, type, dict); - break; - - default: - purple_debug_info("msim", "msim_send: unknown type %d\n", type); - break; - } - } while(key); - va_end(argp); - - return msg; -} - -/** - * Create a new MsimMessage. - * - * @param first_key The first key in the sequence, or NULL for an empty message. - * @param ... A sequence of gchar* key/type/value triplets, terminated with NULL. - * - * See msim_msg_append() documentation for details on types. - */ -MsimMessage * -msim_msg_new(gchar *first_key, ...) -{ - va_list argp; - - if (first_key) { - va_start(argp, first_key); - return msim_msg_new_v(first_key, argp); - } else { - return NULL; - } -} - -/** - * Pack a string using the given GFunc and seperator. - * Used by msim_msg_dump() and msim_msg_pack(). - */ -static gchar * -msim_msg_pack_using(MsimMessage *msg, - GFunc gf, - const gchar *sep, - const gchar *begin, const gchar *end) -{ - int num_items; - gchar **strings; - gchar **strings_tmp; - gchar *joined; - gchar *final; - int i; - - g_return_val_if_fail(msg != NULL, NULL); - - num_items = g_list_length(msg); - - /* Add one for NULL terminator for g_strjoinv(). */ - strings = (gchar **)g_new0(gchar *, num_items + 1); - - strings_tmp = strings; - g_list_foreach(msg, gf, &strings_tmp); - - joined = g_strjoinv(sep, strings); - final = g_strconcat(begin, joined, end, NULL); - g_free(joined); - - /* Clean up. */ - for (i = 0; i < num_items; ++i) { - g_free(strings[i]); - } - - g_free(strings); - - return final; -} - -/** - * Return a human-readable string of the message. - * - * @return A new gchar *, must be g_free()'d. - */ -static gchar * -msim_msg_dump_to_str(MsimMessage *msg) -{ - gchar *debug_str; - - if (!msg) { - debug_str = g_strdup(""); - } else { - debug_str = msim_msg_pack_using(msg, msim_msg_debug_string_element, - "\n", ""); - } - - return debug_str; -} - -/** - * Store a human-readable string describing the element. - * - * @param data Pointer to an MsimMessageElement. - * @param user_data - */ -static void -msim_msg_debug_string_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - gchar *string; - GString *gs; - gchar *binary; - gchar ***items; /* wow, a pointer to a pointer to a pointer */ - - gchar *s; - GList *gl; - guint i; - - elem = (MsimMessageElement *)data; - items = user_data; - - switch (elem->type) { - case MSIM_TYPE_INTEGER: - string = g_strdup_printf("%s(integer): %d", elem->name, - GPOINTER_TO_UINT(elem->data)); - break; - - case MSIM_TYPE_RAW: - string = g_strdup_printf("%s(raw): %s", elem->name, - elem->data ? (gchar *)elem->data : "(NULL)"); - break; - - case MSIM_TYPE_STRING: - string = g_strdup_printf("%s(string): %s", elem->name, - elem->data ? (gchar *)elem->data : "(NULL)"); - break; - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - binary = purple_base64_encode((guchar*)gs->str, gs->len); - string = g_strdup_printf("%s(binary, %d bytes): %s", elem->name, (int)gs->len, binary); - g_free(binary); - break; - - case MSIM_TYPE_BOOLEAN: - string = g_strdup_printf("%s(boolean): %s", elem->name, - elem->data ? "TRUE" : "FALSE"); - break; - - case MSIM_TYPE_DICTIONARY: - if (!elem->data) { - s = g_strdup("(NULL)"); - } else { - s = msim_msg_dump_to_str((MsimMessage *)elem->data); - } - - if (!s) { - s = g_strdup("(NULL, couldn't msim_msg_dump_to_str)"); - } - - string = g_strdup_printf("%s(dict): %s", elem->name, s); - - g_free(s); - break; - - case MSIM_TYPE_LIST: - gs = g_string_new(""); - g_string_append_printf(gs, "%s(list): \n", elem->name); - - i = 0; - for (gl = (GList *)elem->data; gl != NULL; gl = g_list_next(gl)) { - g_string_append_printf(gs, " %d. %s\n", i, (gchar *)(gl->data)); - ++i; - } - - string = g_string_free(gs, FALSE); - break; - - default: - string = g_strdup_printf("%s(unknown type %d", - elem->name ? elem->name : "(NULL)", elem->type); - break; - } - - **items = string; - ++(*items); -} - -/** - * Search for and return the node in msg, matching name, or NULL. - * - * @param msg Message to search within. - * @param name Field name to search for. - * - * @return The GList * node for the MsimMessageElement with the given name, or NULL if not found or name is NULL. - * - * For internal use - users probably want to use msim_msg_get() to - * access the MsimMessageElement *, instead of the GList * container. - * - */ -static GList * -msim_msg_get_node(const MsimMessage *msg, const gchar *name) -{ - GList *node; - - if (!name || !msg) { - return NULL; - } - - /* Linear search for the given name. O(n) but n is small. */ - for (node = (GList*)msg; node != NULL; node = g_list_next(node)) { - MsimMessageElement *elem; - - elem = (MsimMessageElement *)node->data; - - g_return_val_if_fail(elem != NULL, NULL); - g_return_val_if_fail(elem->name != NULL, NULL); - - if (strcmp(elem->name, name) == 0) { - return node; - } - } - return NULL; -} - -/** - * Create a new MsimMessageElement * - must be g_free()'d. - * - * For internal use; users probably want msim_msg_append() or msim_msg_insert_before(). - * - * @param dynamic_name Whether 'name' should be freed when the message is destroyed. - */ -static MsimMessageElement * -msim_msg_element_new(const gchar *name, MsimMessageType type, gpointer data, gboolean dynamic_name) -{ - MsimMessageElement *elem; - - elem = g_new0(MsimMessageElement, 1); - - elem->name = name; - elem->dynamic_name = dynamic_name; - elem->type = type; - elem->data = data; - - return elem; -} - -/** - * Append a new element to a message. - * - * @param name Textual name of element (static string, neither copied nor freed). - * @param type An MSIM_TYPE_* code. - * @param data Pointer to data, see below. - * - * @return The new message - must be assigned to as with GList*. For example: - * - * msg = msim_msg_append(msg, ...) - * - * The data parameter depends on the type given: - * - * * MSIM_TYPE_INTEGER: Use GUINT_TO_POINTER(x). - * - * * MSIM_TYPE_BINARY: Same as integer, non-zero is TRUE and zero is FALSE. - * - * * MSIM_TYPE_STRING: gchar *. The data WILL BE FREED - use g_strdup() if needed. - * - * * MSIM_TYPE_RAW: gchar *. The data WILL BE FREED - use g_strdup() if needed. - * - * * MSIM_TYPE_BINARY: g_string_new_len(data, length). The data AND GString will be freed. - * - * * MSIM_TYPE_DICTIONARY: An MsimMessage *. Freed when message is destroyed. - * - * * MSIM_TYPE_LIST: GList * of gchar *. Again, everything will be freed. - * - * */ -MsimMessage * -msim_msg_append(MsimMessage *msg, const gchar *name, - MsimMessageType type, gpointer data) -{ - return g_list_append(msg, msim_msg_element_new(name, type, data, FALSE)); -} - -/** - * Append a new element, but with a dynamically-allocated name. - * Exactly the same as msim_msg_append(), except 'name' will be freed when - * the message is destroyed. Normally, it isn't, because a static string is given. - */ -static MsimMessage * -msim_msg_append_dynamic_name(MsimMessage *msg, gchar *name, - MsimMessageType type, gpointer data) -{ - return g_list_append(msg, msim_msg_element_new(name, type, data, TRUE)); -} - -/** - * Insert a new element into a message, before the given element name. - * - * @param name_before Name of the element to insert the new element before. If - * could not be found or NULL, new element will be inserted at end. - * - * See msim_msg_append() for usage of other parameters, and an important note about return value. - */ -MsimMessage * -msim_msg_insert_before(MsimMessage *msg, const gchar *name_before, - const gchar *name, MsimMessageType type, gpointer data) -{ - MsimMessageElement *new_elem; - GList *node_before; - - new_elem = msim_msg_element_new(name, type, data, FALSE); - - node_before = msim_msg_get_node(msg, name_before); - - return g_list_insert_before(msg, node_before, new_elem); -} - -/** - * Perform a deep copy on a GList * of gchar * strings. Free with msim_msg_list_free(). - */ -static GList * -msim_msg_list_copy(const GList *old) -{ - GList *new_list; - - new_list = NULL; - - /* Deep copy (g_list_copy is shallow). Copy each string. */ - for (; old != NULL; old = g_list_next(old)) { - new_list = g_list_append(new_list, g_strdup(old->data)); - } - - return new_list; -} - -/** - * Clone an individual element. - * - * @param data MsimMessageElement * to clone. - * @param user_data Pointer to MsimMessage * to add cloned element to. - */ -static void -msim_msg_clone_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - MsimMessage **new; - gpointer new_data; - - GString *gs; - MsimMessage *dict; - - elem = (MsimMessageElement *)data; - new = (MsimMessage **)user_data; - - switch (elem->type) { - case MSIM_TYPE_BOOLEAN: - case MSIM_TYPE_INTEGER: - new_data = elem->data; - break; - - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - new_data = g_strdup((gchar *)elem->data); - break; - - case MSIM_TYPE_LIST: - new_data = (gpointer)msim_msg_list_copy((GList *)(elem->data)); - break; - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - - new_data = g_string_new_len(gs->str, gs->len); - break; - case MSIM_TYPE_DICTIONARY: - dict = (MsimMessage *)elem->data; - - new_data = msim_msg_clone(dict); - break; - - default: - purple_debug_info("msim", "msim_msg_clone_element: unknown type %d\n", elem->type); - g_return_if_reached(); - } - - /* Append cloned data. Note that the 'name' field is a static string, so it - * never needs to be copied nor freed. */ - if (elem->dynamic_name) - *new = msim_msg_append_dynamic_name(*new, g_strdup(elem->name), elem->type, new_data); - else - *new = msim_msg_append(*new, elem->name, elem->type, new_data); -} - -/** - * Clone an existing MsimMessage. - * - * @return Cloned message; caller should free with msim_msg_free(). - */ -MsimMessage * -msim_msg_clone(MsimMessage *old) -{ - MsimMessage *new; - - if (old == NULL) { - return NULL; - } - - new = msim_msg_new(FALSE); - - g_list_foreach(old, msim_msg_clone_element, &new); - - return new; -} - -/** - * Free the data of a message element. - * - * @param elem The MsimMessageElement * - * - * Note this only frees the element data; you may also want to free the - * element itself with g_free() (see msim_msg_free_element()). - */ -void -msim_msg_free_element_data(MsimMessageElement *elem) -{ - switch (elem->type) { - case MSIM_TYPE_BOOLEAN: - case MSIM_TYPE_INTEGER: - /* Integer value stored in gpointer - no need to free(). */ - break; - - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - /* Always free strings - caller should have g_strdup()'d if - * string was static or temporary and not to be freed. */ - g_free(elem->data); - break; - - case MSIM_TYPE_BINARY: - /* Free the GString itself and the binary data. */ - g_string_free((GString *)elem->data, TRUE); - break; - - case MSIM_TYPE_DICTIONARY: - msim_msg_free((MsimMessage *)elem->data); - break; - - case MSIM_TYPE_LIST: - g_list_free((GList *)elem->data); - break; - - default: - purple_debug_info("msim", "msim_msg_free_element_data: " - "not freeing unknown type %d\n", elem->type); - break; - } -} - -/** - * Free a GList * of MsimMessageElement *'s. - */ -void -msim_msg_list_free(GList *l) -{ - - for (; l != NULL; l = g_list_next(l)) { - MsimMessageElement *elem; - - elem = (MsimMessageElement *)l->data; - - /* Note that name is almost never dynamically allocated elsewhere; - * it is usually a static string, but not in lists. So cast it. */ - g_free((gchar *)elem->name); - g_free(elem->data); - g_free(elem); - } - g_list_free(l); -} - -/** - * Free an individual message element. - * - * @param data MsimMessageElement * to free. - * @param user_data Not used; required to match g_list_foreach() callback prototype. - * - * Frees both the element data and the element itself. - * Also frees the name if dynamic_name is TRUE. - */ -static void -msim_msg_free_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - - elem = (MsimMessageElement *)data; - - msim_msg_free_element_data(elem); - - if (elem->dynamic_name) - /* Need to cast to remove const-ness, because - * elem->name is almost always a constant, static - * string, but not in this case. */ - g_free((gchar *)elem->name); - - g_free(elem); -} - -/** - * Free a complete message. - */ -void -msim_msg_free(MsimMessage *msg) -{ - if (!msg) { - /* already free as can be */ - return; - } - - g_list_foreach(msg, msim_msg_free_element, NULL); - g_list_free(msg); -} - -/** - * Pack an element into its protocol representation. - * - * @param data Pointer to an MsimMessageElement. - * @param user_data Pointer to a gchar ** array of string items. - * - * Called by msim_msg_pack(). Will pack the MsimMessageElement into - * a part of the protocol string and append it to the array. Caller - * is responsible for creating array to correct dimensions, and - * freeing each string element of the array added by this function. - */ -static void -msim_msg_pack_element(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - gchar *string, *data_string; - gchar ***items; - - elem = (MsimMessageElement *)data; - items = (gchar ***)user_data; - - /* Exclude elements beginning with '_' from packed protocol messages. */ - if (elem->name[0] == '_') { - return; - } - - data_string = msim_msg_pack_element_data(elem); - - switch (elem->type) { - /* These types are represented by key name/value pairs (converted above). */ - case MSIM_TYPE_INTEGER: - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - case MSIM_TYPE_BINARY: - case MSIM_TYPE_DICTIONARY: - case MSIM_TYPE_LIST: - string = g_strconcat(elem->name, "\\", data_string, NULL); - break; - - /* Boolean is represented by absence or presence of name. */ - case MSIM_TYPE_BOOLEAN: - if (GPOINTER_TO_UINT(elem->data)) { - /* True - leave in, with blank value. */ - string = g_strdup_printf("%s\\", elem->name); - } else { - /* False - leave out. */ - string = g_strdup(""); - } - break; - - default: - g_free(data_string); - g_return_if_reached(); - break; - } - - g_free(data_string); - - **items = string; - ++(*items); -} - -/** - * Pack an element into its protcol representation inside a dictionary. - * - * See msim_msg_pack_element(). - */ -static void -msim_msg_pack_element_dict(gpointer data, gpointer user_data) -{ - MsimMessageElement *elem; - gchar *string, *data_string, ***items; - - elem = (MsimMessageElement *)data; - items = (gchar ***)user_data; - - /* Exclude elements beginning with '_' from packed protocol messages. */ - if (elem->name[0] == '_') { - return; - } - - data_string = msim_msg_pack_element_data(elem); - - g_return_if_fail(data_string != NULL); - - switch (elem->type) { - /* These types are represented by key name/value pairs (converted above). */ - case MSIM_TYPE_INTEGER: - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - case MSIM_TYPE_BINARY: - case MSIM_TYPE_DICTIONARY: - case MSIM_TYPE_LIST: - case MSIM_TYPE_BOOLEAN: /* Boolean is On or Off */ - string = g_strconcat(elem->name, "=", data_string, NULL); - break; - - default: - g_free(data_string); - g_return_if_fail(FALSE); - break; - } - - g_free(data_string); - - **items = string; - ++(*items); -} - -/** - * Return a packed string of a message suitable for sending over the wire. - * - * @return A string. Caller must g_free(). - */ -gchar * -msim_msg_pack(MsimMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msim_msg_pack_using(msg, msim_msg_pack_element, "\\", "\\", "\\final\\"); -} - -/** - * Return a packed string of a dictionary, suitable for embedding in MSIM_TYPE_DICTIONARY. - * - * @return A string; caller must g_free(). - */ -static gchar * -msim_msg_pack_dict(MsimMessage *msg) -{ - g_return_val_if_fail(msg != NULL, NULL); - - return msim_msg_pack_using(msg, msim_msg_pack_element_dict, "\034", "", ""); -} - -/** - * Send an existing MsimMessage. - */ -gboolean -msim_msg_send(MsimSession *session, MsimMessage *msg) -{ - gchar *raw; - gboolean success; - - raw = msim_msg_pack(msg); - g_return_val_if_fail(raw != NULL, FALSE); - success = msim_send_raw(session, raw); - g_free(raw); - - return success; -} - -/** - * Return a message element data as a new string for a raw protocol message, - * converting from other types (integer, etc.) if necessary. - * - * @return const gchar * The data as a string, or NULL. Caller must g_free(). - * - * Returns a string suitable for inclusion in a raw protocol message, not necessarily - * optimal for human consumption. For example, strings are escaped. Use - * msim_msg_get_string() if you want a string, which in some cases is same as this. - */ -gchar * -msim_msg_pack_element_data(MsimMessageElement *elem) -{ - GString *gs; - GList *gl; - - g_return_val_if_fail(elem != NULL, NULL); - - switch (elem->type) { - case MSIM_TYPE_INTEGER: - return g_strdup_printf("%d", GPOINTER_TO_UINT(elem->data)); - - case MSIM_TYPE_RAW: - /* Not un-escaped - this is a raw element, already escaped if necessary. */ - return (gchar *)g_strdup((gchar *)elem->data); - - case MSIM_TYPE_STRING: - /* Strings get escaped. msim_escape() creates a new string. */ - g_return_val_if_fail(elem->data != NULL, NULL); - return elem->data ? msim_escape((gchar *)elem->data) : - g_strdup("(NULL)"); - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - /* Do not escape! */ - return purple_base64_encode((guchar *)gs->str, gs->len); - - case MSIM_TYPE_BOOLEAN: - /* Not used by messages in the wire protocol * -- see msim_msg_pack_element. - * Only used by dictionaries, see msim_msg_pack_element_dict. */ - return elem->data ? g_strdup("On") : g_strdup("Off"); - - case MSIM_TYPE_DICTIONARY: - return msim_msg_pack_dict((MsimMessage *)elem->data); - - case MSIM_TYPE_LIST: - /* Pack using a|b|c|d|... */ - gs = g_string_new(""); - - for (gl = (GList *)elem->data; gl != NULL; gl = g_list_next(gl)) { - g_string_append_printf(gs, "%s", (gchar*)(gl->data)); - - /* All but last element is separated by a bar. */ - if (g_list_next(gl)) - g_string_append(gs, "|"); - } - - return g_string_free(gs, FALSE); - - default: - purple_debug_info("msim", "field %s, unknown type %d\n", - elem->name ? elem->name : "(NULL)", - elem->type); - return NULL; - } -} - -/** - * Send a message to the server, whose contents is specified using - * variable arguments. - * - * @param session - * @param ... A sequence of gchar* key/type/value triplets, terminated with NULL. - * - * This function exists for coding convenience: it allows a message to be created - * and sent in one line of code. Internally it calls msim_msg_send(). - * - * IMPORTANT: See msim_msg_append() documentation for details on element types. - * - */ -gboolean -msim_send(MsimSession *session, ...) -{ - gboolean success; - MsimMessage *msg; - va_list argp; - - va_start(argp, session); - msg = msim_msg_new_v(NULL, argp); - - /* Actually send the message. */ - success = msim_msg_send(session, msg); - - /* Cleanup. */ - msim_msg_free(msg); - - return success; -} - -/** - * Print a human-readable string of the message to Purple's debug log. - * - * @param fmt_string A static string, in which '%s' will be replaced. - */ -void -msim_msg_dump(const gchar *fmt_string, MsimMessage *msg) -{ - gchar *debug_str; - - g_return_if_fail(fmt_string != NULL); - - debug_str = msim_msg_dump_to_str(msg); - - g_return_if_fail(debug_str != NULL); - - purple_debug_info("msim", fmt_string, debug_str); - - g_free(debug_str); -} - -/** - * Parse a raw protocol message string into a MsimMessage *. - * - * @param raw The raw message string to parse, will be g_free()'d. - * - * @return MsimMessage *. Caller should msim_msg_free() when done. - */ -MsimMessage * -msim_parse(const gchar *raw) -{ - MsimMessage *msg; - gchar *token; - gchar **tokens; - gchar *key; - gchar *value; - int i; - - g_return_val_if_fail(raw != NULL, NULL); - - purple_debug_info("msim", "msim_parse: got <%s>\n", raw); - - key = NULL; - - /* All messages begin with a \. */ - if (raw[0] != '\\' || raw[1] == 0) { - purple_debug_info("msim", "msim_parse: incomplete/bad string, " - "missing initial backslash: <%s>\n", raw); - /* XXX: Should we try to recover, and read to first backslash? */ - - return NULL; - } - - msg = msim_msg_new(FALSE); - - for (tokens = g_strsplit(raw + 1, "\\", 0), i = 0; - (token = tokens[i]); - i++) { -#ifdef MSIM_DEBUG_PARSE - purple_debug_info("msim", "tok=<%s>, i%2=%d\n", token, i % 2); -#endif - if (i % 2) { - /* Odd-numbered ordinal is a value. */ - - value = token; - - /* Incoming protocol messages get tagged as MSIM_TYPE_RAW, which - * represents an untyped piece of data. msim_msg_get_* will - * convert to appropriate types for caller, and handle unescaping if needed. */ - msg = msim_msg_append_dynamic_name(msg, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value)); -#ifdef MSIM_DEBUG_PARSE - purple_debug_info("msim", "insert string: |%s|=|%s|\n", key, value); -#endif - } else { - /* Even numbered indexes are key names. */ - key = token; - } - } - g_strfreev(tokens); - - return msg; -} - -/** - * Return the first MsimMessageElement * with given name in the MsimMessage *. - * - * @param name Name to search for. - * - * @return MsimMessageElement * matching name, or NULL. - * - * Note: useful fields of MsimMessageElement are 'data' and 'type', which - * you can access directly. But it is often more convenient to use - * another msim_msg_get_* that converts the data to what type you want. - */ -MsimMessageElement * -msim_msg_get(const MsimMessage *msg, const gchar *name) -{ - GList *node; - - node = msim_msg_get_node(msg, name); - if (node) { - return (MsimMessageElement *)node->data; - } else { - return NULL; - } -} - -gchar * -msim_msg_get_string_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, NULL); - switch (elem->type) { - case MSIM_TYPE_INTEGER: - return g_strdup_printf("%d", GPOINTER_TO_UINT(elem->data)); - - case MSIM_TYPE_RAW: - /* Raw element from incoming message - if its a string, it'll - * be escaped. */ - return msim_unescape((gchar *)elem->data); - - case MSIM_TYPE_STRING: - /* Already unescaped. */ - return g_strdup((gchar *)elem->data); - - default: - purple_debug_info("msim", "msim_msg_get_string_element: type %d unknown, name %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return NULL; - } -} - -/** - * Return the data of an element of a given name, as a string. - * - * @param name Name of element. - * - * @return gchar * The data as a string, or NULL if not found. - * Caller must g_free(). - * - * Note that msim_msg_pack_element_data() is similar, but returns a string - * for inclusion into a raw protocol string (escaped and everything). - * This function unescapes the string for you, if needed. - */ -gchar * -msim_msg_get_string(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return NULL; - } - - return msim_msg_get_string_from_element(elem); -} - -/** - * Parse a |-separated string into a new GList. Free with msim_msg_list_free(). - */ -static GList * -msim_msg_list_parse(const gchar *raw) -{ - gchar **array; - GList *list; - guint i; - - array = g_strsplit(raw, "|", 0); - list = NULL; - - /* TODO: escape/unescape /3 <-> | within list elements */ - - for (i = 0; array[i] != NULL; ++i) { - MsimMessageElement *elem; - - /* Freed in msim_msg_list_free() */ - elem = g_new0(MsimMessageElement, 1); - - /* Give the element a name for debugging purposes. - * Not supposed to be looked up by this name; instead, - * lookup the elements by indexing the array. */ - elem->name = g_strdup_printf("(list item #%d)", i); - elem->type = MSIM_TYPE_RAW; - elem->data = g_strdup(array[i]); - - list = g_list_append(list, elem); - } - - g_strfreev(array); - - return list; -} - -static GList * -msim_msg_get_list_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, NULL); - switch (elem->type) { - case MSIM_TYPE_LIST: - return msim_msg_list_copy((GList *)elem->data); - - case MSIM_TYPE_RAW: - return msim_msg_list_parse((gchar *)elem->data); - - default: - purple_debug_info("msim_msg_get_list", "type %d unknown, name %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return NULL; - } -} - -/** - * Return an element as a new list. Caller frees with msim_msg_list_free(). - */ -GList * -msim_msg_get_list(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return NULL; - } - - return msim_msg_get_list_from_element(elem); -} - -/** - * Parse a \x1c-separated "dictionary" of key=value pairs into a hash table. - * - * @param raw The text of the dictionary to parse. Often the - * value for the 'body' field. - * - * @return A new MsimMessage *. Must msim_msg_free() when done. - */ -static MsimMessage * -msim_msg_dictionary_parse(const gchar *raw) -{ - MsimMessage *dict; - gchar *item; - gchar **items; - gchar **elements; - guint i; - - g_return_val_if_fail(raw != NULL, NULL); - - dict = msim_msg_new(NULL); - - for (items = g_strsplit(raw, "\x1c", 0), i = 0; - (item = items[i]); - i++) { - gchar *key, *value; - - elements = g_strsplit(item, "=", 2); - - key = elements[0]; - if (!key) { - purple_debug_info("msim", "msim_msg_dictionary_parse(%s): null key\n", - raw); - g_strfreev(elements); - break; - } - - value = elements[1]; - if (!value) { - purple_debug_info("msim", "msim_msg_dictionary_prase(%s): null value\n", - raw); - g_strfreev(elements); - break; - } - -#ifdef MSIM_DEBUG_PARSE - purple_debug_info("msim_msg_dictionary_parse","-- %s: %s\n", key ? key : "(NULL)", - value ? value : "(NULL)"); -#endif - /* Append with _dynamic_name since g_strdup(key) is dynamic, and - * needs to be freed when the message is destroyed. It isn't static as usual. */ - dict = msim_msg_append_dynamic_name(dict, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value)); - - g_strfreev(elements); - } - - g_strfreev(items); - - return dict; -} - -static MsimMessage * -msim_msg_get_dictionary_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, NULL); - switch (elem->type) { - case MSIM_TYPE_DICTIONARY: - return msim_msg_clone((MsimMessage *)elem->data); - - case MSIM_TYPE_RAW: - return msim_msg_dictionary_parse(elem->data); - - default: - purple_debug_info("msim_msg_get_dictionary", "type %d unknown, name %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return NULL; - } -} - -/** - * Return an element as a new dictionary. Caller frees with msim_msg_free(). - */ -MsimMessage * -msim_msg_get_dictionary(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return NULL; - } - - return msim_msg_get_dictionary_from_element(elem); -} - -guint -msim_msg_get_integer_from_element(MsimMessageElement *elem) -{ - g_return_val_if_fail(elem != NULL, 0); - switch (elem->type) { - case MSIM_TYPE_INTEGER: - return GPOINTER_TO_UINT(elem->data); - - case MSIM_TYPE_RAW: - case MSIM_TYPE_STRING: - /* TODO: find out if we need larger integers */ - return (guint)atoi((gchar *)elem->data); - - default: - return 0; - } -} - -/** - * Return the data of an element of a given name, as an unsigned integer. - * - * @param name Name of element. - * - * @return guint Numeric representation of data, or 0 if could not be converted / not found. - * - * Useful to obtain an element's data if you know it should be an integer, - * even if it is not stored as an MSIM_TYPE_INTEGER. MSIM_TYPE_STRING will - * be converted handled correctly, for example. - */ -guint -msim_msg_get_integer(const MsimMessage *msg, const gchar *name) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - - if (!elem) { - return 0; - } - - return msim_msg_get_integer_from_element(elem); -} - -static gboolean -msim_msg_get_binary_from_element(MsimMessageElement *elem, gchar **binary_data, gsize *binary_length) -{ - GString *gs; - - g_return_val_if_fail(elem != NULL, FALSE); - - switch (elem->type) { - case MSIM_TYPE_RAW: - /* Incoming messages are tagged with MSIM_TYPE_RAW, and - * converted appropriately. They can still be "strings", just they won't - * be tagged as MSIM_TYPE_STRING (as MSIM_TYPE_STRING is intended to be used - * by msimprpl code for things like instant messages - stuff that should be - * escaped if needed). DWIM. - */ - - /* Previously, incoming messages were stored as MSIM_TYPE_STRING. - * This was fine for integers and strings, since they can easily be - * converted in msim_get_*, as desirable. However, it does not work - * well for binary strings. Consider: - * - * If incoming base64'd elements were tagged as MSIM_TYPE_STRING. - * msim_msg_get_binary() sees MSIM_TYPE_STRING, base64 decodes, returns. - * everything is fine. - * But then, msim_send() is called on the incoming message, which has - * a base64'd MSIM_TYPE_STRING that really is encoded binary. The values - * will be escaped since strings are escaped, and / becomes /2; no good. - * - */ - *binary_data = (gchar *)purple_base64_decode((const gchar *)elem->data, binary_length); - return TRUE; - - case MSIM_TYPE_BINARY: - gs = (GString *)elem->data; - - /* Duplicate data, so caller can g_free() it. */ - *binary_data = g_memdup(gs->str, gs->len); - *binary_length = gs->len; - - return TRUE; - - - /* Rejected because if it isn't already a GString, have to g_new0 it and - * then caller has to ALSO free the GString! - * - * return (GString *)elem->data; */ - - default: - purple_debug_info("msim", "msim_msg_get_binary: unhandled type %d for key %s\n", - elem->type, elem->name ? elem->name : "(NULL)"); - return FALSE; - } -} - -/** - * Return the data of an element of a given name, as a binary GString. - * - * @param binary_data A pointer to a new pointer, which will be filled in with the binary data. CALLER MUST g_free(). - * - * @param binary_length A pointer to an integer, which will be set to the binary data length. - * - * @return TRUE if successful, FALSE if not. - */ -gboolean -msim_msg_get_binary(const MsimMessage *msg, const gchar *name, - gchar **binary_data, gsize *binary_length) -{ - MsimMessageElement *elem; - - elem = msim_msg_get(msg, name); - if (!elem) { - return FALSE; - } - - return msim_msg_get_binary_from_element(elem, binary_data, binary_length); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/message.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/** MySpaceIM protocol messages - * - * \author Jeff Connelly - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_MESSAGE_H -#define _MYSPACE_MESSAGE_H - -#include - -#define MsimMessage GList /* #define instead of typedef to avoid casting */ -typedef gchar MsimMessageType; -typedef struct _MsimMessageElement MsimMessageElement; - -#include "session.h" - -/* Types */ -struct _MsimMessageElement -{ - const gchar *name; /**< Textual name of element. */ - gboolean dynamic_name; /**< TRUE if 'name' is a dynamic string to be freed, not static. */ - guint type; /**< MSIM_TYPE_* code. */ - gpointer data; /**< Pointer to data, or GUINT_TO_POINTER for int/bool. */ -}; - -#define msim_msg_get_next_element_node(msg) ((MsimMessage *)(msg->next)) - -/* Protocol field types */ -#define MSIM_TYPE_RAW '-' -#define MSIM_TYPE_INTEGER 'i' -#define MSIM_TYPE_STRING 's' -#define MSIM_TYPE_BINARY 'b' -#define MSIM_TYPE_BOOLEAN 'f' -#define MSIM_TYPE_DICTIONARY 'd' -#define MSIM_TYPE_LIST 'l' - -gchar *msim_escape(const gchar *msg); -gchar *msim_unescape(const gchar *msg); - -MsimMessage *msim_msg_new(gchar *first_key, ...); -/* No sentinel attribute, because can leave off varargs if not_empty is FALSE. */ - -MsimMessage *msim_msg_clone(MsimMessage *old); -void msim_msg_free_element_data(MsimMessageElement *elem); -void msim_msg_free(MsimMessage *msg); -MsimMessage *msim_msg_append(MsimMessage *msg, const gchar *name, MsimMessageType type, gpointer data); -MsimMessage *msim_msg_insert_before(MsimMessage *msg, const gchar *name_before, const gchar *name, MsimMessageType type, gpointer data); -gchar *msim_msg_pack_element_data(MsimMessageElement *elem); -void msim_msg_dump(const char *fmt_string, MsimMessage *msg); -gchar *msim_msg_pack(MsimMessage *msg); - -void msim_msg_list_free(GList *l); - -/* Based on http://permalink.gmane.org/gmane.comp.parsers.sparse/695 - * Define macros for useful gcc attributes. */ -#ifdef __GNUC__ -#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1))) -#define NORETURN_ATTR __attribute__ ((__noreturn__)) -/* __sentinel__ attribute was introduced in gcc 3.5 */ -#if (GCC_VERSION >= 3005) - #define SENTINEL_ATTR __attribute__ ((__sentinel__(0))) -#else - #define SENTINEL_ATTR -#endif /* gcc >= 3.5 */ -#else - #define FORMAT_ATTR(pos) - #define NORETURN_ATTR - #define SENTINEL_ATTR -#endif - -/* Cause gcc to emit "a missing sentinel in function call" if forgot - * to write NULL as last, terminating parameter. */ -gboolean msim_send(struct _MsimSession *session, ...) SENTINEL_ATTR; - -gboolean msim_msg_send(struct _MsimSession *session, MsimMessage *msg); - -MsimMessage *msim_parse(const gchar *raw); - -MsimMessageElement *msim_msg_get(const MsimMessage *msg, const gchar *name); - -/* Retrieve data by name */ -gchar *msim_msg_get_string(const MsimMessage *msg, const gchar *name); -GList *msim_msg_get_list(const MsimMessage *msg, const gchar *name); -MsimMessage *msim_msg_get_dictionary(const MsimMessage *msg, const gchar *name); -guint msim_msg_get_integer(const MsimMessage *msg, const gchar *name); -gboolean msim_msg_get_binary(const MsimMessage *msg, const gchar *name, gchar **binary_data, gsize *binary_length); - -/* Retrieve data by element (MsimMessageElement *), returned from msim_msg_get() */ -gchar *msim_msg_get_string_from_element(MsimMessageElement *elem); -guint msim_msg_get_integer_from_element(MsimMessageElement *elem); - -#endif /* _MYSPACE_MESSAGE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3678 +0,0 @@ -/** - * MySpaceIM Protocol Plugin - * - * \author Jeff Connelly - * - * Copyright (C) 2007, Jeff Connelly - * - * Based on Purple's "C Plugin HOWTO" hello world example. - * - * Code also drawn from mockprpl: - * http://snarfed.org/space/purple+mock+protocol+plugin - * Copyright (C) 2004-2007, Ryan Barrett - * - * and some constructs also based on existing Purple plugins, which are: - * Copyright (C) 2003, Robbert Haarman - * Copyright (C) 2003, Ethan Blanton - * Copyright (C) 2000-2003, Rob Flynn - * Copyright (C) 1998-1999, Mark Spencer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#define PURPLE_PLUGIN - -#include "myspace.h" - -#include "privacy.h" - -static void msim_set_status(PurpleAccount *account, PurpleStatus *status); -static void msim_set_idle(PurpleConnection *gc, int time); - -/** - * Perform actual postprocessing on a message, adding userid as specified. - * - * @param msg The message to postprocess. - * @param uid_before Name of field where to insert new field before, or NULL for end. - * @param uid_field_name Name of field to add uid to. - * @param uid The userid to insert. - * - * If the field named by uid_field_name already exists, then its string contents will - * be used for the field, except "" will be replaced by the userid. - * - * If the field named by uid_field_name does not exist, it will be added before the - * field named by uid_before, as an integer, with the userid. - * - * Does not handle sending, or scheduling userid lookup. For that, see msim_postprocess_outgoing(). - */ -static MsimMessage * -msim_do_postprocessing(MsimMessage *msg, const gchar *uid_before, - const gchar *uid_field_name, guint uid) -{ - MsimMessageElement *elem; - - /* First, check - if the field already exists, replace within it */ - if ((elem = msim_msg_get(msg, uid_field_name)) != NULL) { - gchar *fmt_string; - gchar *uid_str, *new_str; - - /* Get the packed element, flattening it. This allows to be - * replaced within nested data structures, since the replacement is done - * on the linear, packed data, not on a complicated data structure. - * - * For example, if the field was originally a dictionary or a list, you - * would have to iterate over all the items in it to see what needs to - * be replaced. But by packing it first, the marker is easily replaced - * just by a string replacement. - */ - fmt_string = msim_msg_pack_element_data(elem); - - uid_str = g_strdup_printf("%d", uid); - new_str = purple_strreplace(fmt_string, "", uid_str); - g_free(uid_str); - g_free(fmt_string); - - /* Free the old element data */ - msim_msg_free_element_data(elem->data); - - /* Replace it with our new data */ - elem->data = new_str; - elem->type = MSIM_TYPE_RAW; - - } else { - /* Otherwise, insert new field into outgoing message. */ - msg = msim_msg_insert_before(msg, uid_before, uid_field_name, MSIM_TYPE_INTEGER, GUINT_TO_POINTER(uid)); - } - - return msg; -} - -/** - * Callback for msim_postprocess_outgoing() to add a userid to a message, and send it (once receiving userid). - * - * @param session - * @param userinfo The user information reply message, containing the user ID - * @param data The message to postprocess and send. - * - * The data message should contain these fields: - * - * _uid_field_name: string, name of field to add with userid from userinfo message - * _uid_before: string, name of field before field to insert, or NULL for end - */ -static void -msim_postprocess_outgoing_cb(MsimSession *session, const MsimMessage *userinfo, - gpointer data) -{ - gchar *uid_field_name, *uid_before, *username; - guint uid; - MsimMessage *msg, *body; - - msg = (MsimMessage *)data; - - /* Obtain userid from userinfo message. */ - body = msim_msg_get_dictionary(userinfo, "body"); - g_return_if_fail(body != NULL); - - uid = msim_msg_get_integer(body, "UserID"); - msim_msg_free(body); - - username = msim_msg_get_string(msg, "_username"); - - if (!uid) { - gchar *msg; - - msg = g_strdup_printf(_("No such user: %s"), username); - if (!purple_conv_present_error(username, session->account, msg)) { - purple_notify_error(NULL, NULL, _("User lookup"), msg); - } - - g_free(msg); - g_free(username); - /* TODO: free - * msim_msg_free(msg); - */ - return; - } - - uid_field_name = msim_msg_get_string(msg, "_uid_field_name"); - uid_before = msim_msg_get_string(msg, "_uid_before"); - - msg = msim_do_postprocessing(msg, uid_before, uid_field_name, uid); - - /* Send */ - if (!msim_msg_send(session, msg)) { - msim_msg_dump("msim_postprocess_outgoing_cb: sending failed for message: %s\n", msg); - } - - - /* Free field names AFTER sending message, because MsimMessage does NOT copy - * field names - instead, treats them as static strings (which they usually are). - */ - g_free(uid_field_name); - g_free(uid_before); - g_free(username); - /* TODO: free - * msim_msg_free(msg); - */ -} - -/** - * Postprocess and send a message. - * - * @param session - * @param msg Message to postprocess. Will NOT be freed. - * @param username Username to resolve. Assumed to be a static string (will not be freed or copied). - * @param uid_field_name Name of new field to add, containing uid of username. Static string. - * @param uid_before Name of existing field to insert username field before. Static string. - * - * @return TRUE if successful. - */ -static gboolean -msim_postprocess_outgoing(MsimSession *session, MsimMessage *msg, - const gchar *username, const gchar *uid_field_name, - const gchar *uid_before) -{ - PurpleBuddy *buddy; - guint uid; - gboolean rc; - - g_return_val_if_fail(msg != NULL, FALSE); - - /* Store information for msim_postprocess_outgoing_cb(). */ - msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, g_strdup(username)); - msg = msim_msg_append(msg, "_uid_field_name", MSIM_TYPE_STRING, g_strdup(uid_field_name)); - msg = msim_msg_append(msg, "_uid_before", MSIM_TYPE_STRING, g_strdup(uid_before)); - - /* First, try the most obvious. If numeric userid is given, use that directly. */ - if (msim_is_userid(username)) { - uid = atol(username); - } else { - /* Next, see if on buddy list and know uid. */ - buddy = purple_find_buddy(session->account, username); - if (buddy) { - uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID"); - } else { - uid = 0; - } - - if (!buddy || !uid) { - /* Don't have uid offhand - need to ask for it, and wait until hear back before sending. */ - purple_debug_info("msim", ">>> msim_postprocess_outgoing: couldn't find username %s in blist\n", - username ? username : "(NULL)"); - msim_lookup_user(session, username, msim_postprocess_outgoing_cb, msim_msg_clone(msg)); - return TRUE; /* not sure of status yet - haven't sent! */ - } - } - - /* Already have uid, postprocess and send msg immediately. */ - purple_debug_info("msim", "msim_postprocess_outgoing: found username %s has uid %d\n", - username ? username : "(NULL)", uid); - - msg = msim_do_postprocessing(msg, uid_before, uid_field_name, uid); - - rc = msim_msg_send(session, msg); - - /* TODO: free - * msim_msg_free(msg); - */ - - return rc; -} - -/** - * Send a buddy message of a given type. - * - * @param session - * @param who Username to send message to. - * @param text Message text to send. Not freed; will be copied. - * @param type A MSIM_BM_* constant. - * - * @return TRUE if success, FALSE if fail. - * - * Buddy messages ('bm') include instant messages, action messages, status messages, etc. - */ -gboolean -msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, - int type) -{ - gboolean rc; - MsimMessage *msg; - const gchar *from_username; - - g_return_val_if_fail(who != NULL, FALSE); - g_return_val_if_fail(text != NULL, FALSE); - - from_username = session->account->username; - - g_return_val_if_fail(from_username != NULL, FALSE); - - purple_debug_info("msim", "sending %d message from %s to %s: %s\n", - type, from_username, who, text); - - msg = msim_msg_new( - "bm", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(type), - "sesskey", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(session->sesskey), - /* 't' will be inserted here */ - "cv", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(MSIM_CLIENT_VERSION), - "msg", MSIM_TYPE_STRING, g_strdup(text), - NULL); - - rc = msim_postprocess_outgoing(session, msg, who, "t", "cv"); - - msim_msg_free(msg); - - return rc; -} - -/** - * Lookup a username by userid, from buddy list. - * - * @param wanted_uid - * - * @return Username of wanted_uid, if on blist, or NULL. - * This is a static string, so don't free it. Copy it if needed. - * - */ -static const gchar * -msim_uid2username_from_blist(PurpleAccount *account, guint wanted_uid) -{ - GSList *buddies, *cur; - const gchar *ret; - - buddies = purple_find_buddies(account, NULL); - - if (!buddies) - { - purple_debug_info("msim", "msim_uid2username_from_blist: no buddies?\n"); - return NULL; - } - - ret = NULL; - - for (cur = buddies; cur != NULL; cur = g_slist_next(cur)) - { - PurpleBuddy *buddy; - guint uid; - const gchar *name; - - /* See finch/gnthistory.c */ - buddy = cur->data; - - uid = purple_blist_node_get_int(PURPLE_BLIST_NODE(buddy), "UserID"); - name = purple_buddy_get_name(buddy); - - if (uid == wanted_uid) - { - ret = name; - break; - } - } - - g_slist_free(buddies); - return ret; -} - -/** - * Setup a callback, to be called when a reply is received with the returned rid. - * - * @param cb The callback, an MSIM_USER_LOOKUP_CB. - * @param data Arbitrary user data to be passed to callback (probably an MsimMessage *). - * - * @return The request/reply ID, used to link replies with requests, or -1. - * Put the rid in your request, 'rid' field. - * - * TODO: Make more generic and more specific: - * 1) MSIM_USER_LOOKUP_CB - make it for PERSIST_REPLY, not just user lookup - * 2) data - make it an MsimMessage? - */ -guint -msim_new_reply_callback(MsimSession *session, MSIM_USER_LOOKUP_CB cb, - gpointer data) -{ - guint rid; - - rid = session->next_rid++; - - g_hash_table_insert(session->user_lookup_cb, GUINT_TO_POINTER(rid), cb); - g_hash_table_insert(session->user_lookup_cb_data, GUINT_TO_POINTER(rid), data); - - return rid; -} - -/** - * Return the icon name for a buddy and account. - * - * @param acct The account to find the icon for, or NULL for protocol icon. - * @param buddy The buddy to find the icon for, or NULL for the account icon. - * - * @return The base icon name string. - */ -static const gchar * -msim_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) -{ - /* Use a MySpace icon submitted by hbons at - * http://developer.pidgin.im/wiki/MySpaceIM. */ - return "myspace"; -} - -/** - * Obtain the status text for a buddy. - * - * @param buddy The buddy to obtain status text for. - * - * @return Status text, or NULL if error. Caller g_free()'s. - */ -static char * -msim_status_text(PurpleBuddy *buddy) -{ - MsimSession *session; - MsimUser *user; - const gchar *display_name, *headline; - PurpleAccount *account; - PurpleConnection *gc; - - g_return_val_if_fail(buddy != NULL, NULL); - - user = msim_get_user_from_buddy(buddy, TRUE); - - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - session = (MsimSession *)gc->proto_data; - - display_name = headline = NULL; - - /* Retrieve display name and/or headline, depending on user preference. */ - if (purple_account_get_bool(session->account, "show_headline", TRUE)) { - headline = user->headline; - } - - if (purple_account_get_bool(session->account, "show_display_name", FALSE)) { - display_name = user->display_name; - } - - /* Return appropriate combination of display name and/or headline, or neither. */ - - if (display_name && headline) { - return g_strconcat(display_name, " ", headline, NULL); - } else if (display_name) { - return g_strdup(display_name); - } else if (headline) { - return g_strdup(headline); - } - - return NULL; -} - -/** - * Obtain the tooltip text for a buddy. - * - * @param buddy Buddy to obtain tooltip text on. - * @param user_info Variable modified to have the tooltip text. - * @param full TRUE if should obtain full tooltip text. - */ -static void -msim_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, - gboolean full) -{ - MsimUser *user; - - g_return_if_fail(buddy != NULL); - g_return_if_fail(user_info != NULL); - - user = msim_get_user_from_buddy(buddy, TRUE); - - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - MsimSession *session; - PurpleAccount *account = purple_buddy_get_account(buddy); - PurpleConnection *gc = purple_account_get_connection(account); - - session = (MsimSession *)gc->proto_data; - - /* TODO: if (full), do something different? */ - - /* TODO: request information? have to figure out how to do - * the asynchronous lookup like oscar does (tooltip shows - * 'retrieving...' if not yet available, then changes when it is). - * - * Right now, only show what we have on hand. - */ - - /* Show abbreviated user info. */ - msim_append_user_info(session, user_info, user, FALSE); - } -} - -/** - * Get possible user status types. Based on mockprpl. - * - * @return GList of status types. - */ -static GList * -msim_status_types(PurpleAccount *acct) -{ - GList *types; - PurpleStatusType *status; - - purple_debug_info("myspace", "returning status types\n"); - - types = NULL; - - /* Statuses are almost all the same. Define a macro to reduce code repetition. */ -#define _MSIM_ADD_NEW_STATUS(prim) status = \ - purple_status_type_new_with_attrs( \ - prim, /* PurpleStatusPrimitive */ \ - NULL, /* id - use default */ \ - NULL, /* name - use default */ \ - TRUE, /* saveable */ \ - TRUE, /* user_settable */ \ - FALSE, /* not independent */ \ - \ - /* Attributes - each status can have a message. */ \ - "message", \ - _("Message"), \ - purple_value_new(PURPLE_TYPE_STRING), \ - NULL); \ - \ - \ - types = g_list_append(types, status) - - - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_AVAILABLE); - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_AWAY); - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_OFFLINE); - _MSIM_ADD_NEW_STATUS(PURPLE_STATUS_INVISIBLE); - - /* Except tune status is different... */ - status = purple_status_type_new_with_attrs( - PURPLE_STATUS_TUNE, /* primitive */ - "tune", /* ID */ - NULL, /* name - use default */ - FALSE, /* saveable */ - TRUE, /* should be user_settable some day */ - TRUE, /* independent */ - - PURPLE_TUNE_ARTIST, _("Artist"), purple_value_new(PURPLE_TYPE_STRING), - PURPLE_TUNE_TITLE, _("Title"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - - types = g_list_append(types, status); - - return types; -} - -/* - * TODO: This define is stolen from oscar.h. - * It's also in yahoo.h. - * It should be in libpurple/util.c - */ -#define msim_put32(buf, data) ( \ - (*((buf)) = (unsigned char)((data)>>24)&0xff), \ - (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ - (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ - (*((buf)+3) = (unsigned char)(data)&0xff), \ - 4) - -/** - * Compute the base64'd login challenge response based on username, password, nonce, and IPs. - * - * @param nonce The base64 encoded nonce ('nc') field from the server. - * @param email User's email address (used as login name). - * @param password User's cleartext password. - * @param response_len Will be written with response length. - * - * @return Binary login challenge response, ready to send to the server. - * Must be g_free()'d when finished. NULL if error. - */ -static gchar * -msim_compute_login_response(const gchar nonce[2 * NONCE_SIZE], - const gchar *email, const gchar *password, guint *response_len) -{ - PurpleCipherContext *key_context; - PurpleCipher *sha1; - PurpleCipherContext *rc4; - - guchar hash_pw[HASH_SIZE]; - guchar key[HASH_SIZE]; - gchar *password_truncated, *password_utf16le, *password_utf8_lc; - GString *data; - guchar *data_out; - size_t data_out_len; - gsize conv_bytes_read, conv_bytes_written; - GError *conv_error; -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - int i; -#endif - - g_return_val_if_fail(nonce != NULL, NULL); - g_return_val_if_fail(email != NULL, NULL); - g_return_val_if_fail(password != NULL, NULL); - g_return_val_if_fail(response_len != NULL, NULL); - - /* - * Truncate password to 10 characters. Their "change password" - * web page doesn't let you enter more than 10 characters, but you - * can enter more than 10 when logging in on myspace.com and they - * truncate it. - */ - password_truncated = g_strndup(password, 10); - - /* Convert password to lowercase (required for passwords containing - * uppercase characters). MySpace passwords are lowercase, - * see ticket #2066. */ - password_utf8_lc = g_utf8_strdown(password_truncated, -1); - g_free(password_truncated); - - /* Convert ASCII password to UTF16 little endian */ - purple_debug_info("msim", "converting password to UTF-16LE\n"); - conv_error = NULL; - password_utf16le = g_convert(password_utf8_lc, -1, "UTF-16LE", "UTF-8", - &conv_bytes_read, &conv_bytes_written, &conv_error); - g_free(password_utf8_lc); - - if (conv_error != NULL) { - purple_debug_error("msim", - "g_convert password UTF8->UTF16LE failed: %s", - conv_error->message); - g_error_free(conv_error); - return NULL; - } - - /* Compute password hash */ - purple_cipher_digest_region("sha1", (guchar *)password_utf16le, - conv_bytes_written, sizeof(hash_pw), hash_pw, NULL); - g_free(password_utf16le); - -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - purple_debug_info("msim", "pwhash = "); - for (i = 0; i < sizeof(hash_pw); i++) - purple_debug_info("msim", "%.2x ", hash_pw[i]); - purple_debug_info("msim", "\n"); -#endif - - /* key = sha1(sha1(pw) + nonce2) */ - sha1 = purple_ciphers_find_cipher("sha1"); - key_context = purple_cipher_context_new(sha1, NULL); - purple_cipher_context_append(key_context, hash_pw, HASH_SIZE); - purple_cipher_context_append(key_context, (guchar *)(nonce + NONCE_SIZE), NONCE_SIZE); - purple_cipher_context_digest(key_context, sizeof(key), key, NULL); - purple_cipher_context_destroy(key_context); - -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - purple_debug_info("msim", "key = "); - for (i = 0; i < sizeof(key); i++) { - purple_debug_info("msim", "%.2x ", key[i]); - } - purple_debug_info("msim", "\n"); -#endif - - rc4 = purple_cipher_context_new_by_name("rc4", NULL); - - /* Note: 'key' variable is 0x14 bytes (from SHA-1 hash), - * but only first 0x10 used for the RC4 key. */ - purple_cipher_context_set_option(rc4, "key_len", (gpointer)0x10); - purple_cipher_context_set_key(rc4, key); - - /* rc4 encrypt: - * nonce1+email+IP list */ - - data = g_string_new(NULL); - g_string_append_len(data, nonce, NONCE_SIZE); - - /* Include the null terminator */ - g_string_append_len(data, email, strlen(email) + 1); - - while (data->len % 4 != 0) - g_string_append_c(data, 0xfb); - -#ifdef SEND_OUR_IP_ADDRESSES - /* TODO: Obtain IPs of network interfaces instead of using this hardcoded value */ - g_string_set_size(data, data->len + 4); - msim_put32(data->str + data->len - 4, MSIM_LOGIN_IP_LIST_LEN); - g_string_append_len(data, MSIM_LOGIN_IP_LIST, MSIM_LOGIN_IP_LIST_LEN); -#else - g_string_set_size(data, data->len + 4); - msim_put32(data->str + data->len - 4, 0); -#endif /* !SEND_OUR_IP_ADDRESSES */ - - data_out = g_new0(guchar, data->len); - - purple_cipher_context_encrypt(rc4, (const guchar *)data->str, - data->len, data_out, &data_out_len); - purple_cipher_context_destroy(rc4); - - if (data_out_len != data->len) { - purple_debug_info("msim", "msim_compute_login_response: " - "data length mismatch: %" G_GSIZE_FORMAT " != %" - G_GSIZE_FORMAT "\n", data_out_len, data->len); - } - - g_string_free(data, TRUE); - -#ifdef MSIM_DEBUG_LOGIN_CHALLENGE - purple_debug_info("msim", "response=<%s>\n", data_out); -#endif - - *response_len = data_out_len; - - return (gchar *)data_out; -} - -/** - * Process a login challenge, sending a response. - * - * @param session - * @param msg Login challenge message. - * - * @return TRUE if successful, FALSE if not - */ -static gboolean -msim_login_challenge(MsimSession *session, MsimMessage *msg) -{ - PurpleAccount *account; - gchar *response; - guint response_len; - gchar *nc; - gsize nc_len; - gboolean ret; - - g_return_val_if_fail(msg != NULL, FALSE); - - g_return_val_if_fail(msim_msg_get_binary(msg, "nc", &nc, &nc_len), FALSE); - - account = session->account; - - g_return_val_if_fail(account != NULL, FALSE); - - purple_connection_update_progress(session->gc, _("Reading challenge"), 1, 4); - - purple_debug_info("msim", "nc is %" G_GSIZE_FORMAT - " bytes, decoded\n", nc_len); - - if (nc_len != MSIM_AUTH_CHALLENGE_LENGTH) { - purple_debug_info("msim", "bad nc length: %" G_GSIZE_MODIFIER - "x != 0x%x\n", nc_len, MSIM_AUTH_CHALLENGE_LENGTH); - purple_connection_error_reason (session->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unexpected challenge length from server")); - return FALSE; - } - - purple_connection_update_progress(session->gc, _("Logging in"), 2, 4); - - response_len = 0; - response = msim_compute_login_response(nc, account->username, account->password, &response_len); - - g_free(nc); - - ret = msim_send(session, - "login2", MSIM_TYPE_INTEGER, MSIM_AUTH_ALGORITHM, - /* This is actually user's email address. */ - "username", MSIM_TYPE_STRING, g_strdup(account->username), - /* GString will be freed in msim_msg_free() in msim_send(). */ - "response", MSIM_TYPE_BINARY, g_string_new_len(response, response_len), - "clientver", MSIM_TYPE_INTEGER, MSIM_CLIENT_VERSION, - "langid", MSIM_TYPE_INTEGER, MSIM_LANGUAGE_ID_ENGLISH, - "imlang", MSIM_TYPE_STRING, g_strdup(MSIM_LANGUAGE_NAME_ENGLISH), - "reconn", MSIM_TYPE_INTEGER, 0, - "status", MSIM_TYPE_INTEGER, 100, - "id", MSIM_TYPE_INTEGER, 1, - NULL); - - g_free(response); - - return ret; -} - -/** - * Process unrecognized information. - * - * @param session - * @param msg An MsimMessage that was unrecognized, or NULL. - * @param note Information on what was unrecognized, or NULL. - */ -void -msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note) -{ - /* TODO: Some more context, outwardly equivalent to a backtrace, - * for helping figure out what this msg is for. What was going on? - * But not too much information so that a user - * posting this dump reveals confidential information. - */ - - /* TODO: dump unknown msgs to file, so user can send them to me - * if they wish, to help add support for new messages (inspired - * by Alexandr Shutko, who maintains OSCAR protocol documentation). - * - * Filed enhancement ticket for libpurple as #4688. - */ - - purple_debug_info("msim", "Unrecognized data on account for %s\n", - (session && session->account && session->account->username) ? - session->account->username : "(NULL)"); - if (note) { - purple_debug_info("msim", "(Note: %s)\n", note); - } - - if (msg) { - msim_msg_dump("Unrecognized message dump: %s\n", msg); - } -} - -/** Called when the session key arrives to check whether the user - * has a username, and set one if desired. */ -static gboolean -msim_is_username_set(MsimSession *session, MsimMessage *msg) -{ - g_return_val_if_fail(msg != NULL, FALSE); - g_return_val_if_fail(session->gc != NULL, FALSE); - - session->sesskey = msim_msg_get_integer(msg, "sesskey"); - purple_debug_info("msim", "SESSKEY=<%d>\n", session->sesskey); - - /* What is proof? Used to be uid, but now is 52 base64'd bytes... */ - - /* Comes with: proof,profileid,userid,uniquenick -- all same values - * some of the time, but can vary. This is our own user ID. */ - session->userid = msim_msg_get_integer(msg, "userid"); - - /* Save uid to account so this account can be looked up by uid. */ - purple_account_set_int(session->account, "uid", session->userid); - - /* Not sure what profileid is used for. */ - if (msim_msg_get_integer(msg, "profileid") != session->userid) { - msim_unrecognized(session, msg, - "Profile ID didn't match user ID, don't know why"); - } - - /* We now know are our own username, only after we're logged in.. - * which is weird, but happens because you login with your email - * address and not username. Will be freed in msim_session_destroy(). */ - session->username = msim_msg_get_string(msg, "uniquenick"); - - /* If user lacks a username, help them get one. */ - if (msim_msg_get_integer(msg, "uniquenick") == session->userid) { - purple_debug_info("msim_is_username_set", "no username is set\n"); - purple_request_yes_no(session->gc, - _("MySpaceIM - No Username Set"), - _("You appear to have no MySpace username."), - _("Would you like to set one now? (Note: THIS CANNOT BE CHANGED!)"), - 0, - session->account, - NULL, - NULL, - session->gc, - G_CALLBACK(msim_set_username_cb), - G_CALLBACK(msim_do_not_set_username_cb)); - purple_debug_info("msim_is_username_set","'username not set' alert prompted\n"); - return FALSE; - } - return TRUE; -} - -#ifdef MSIM_USE_KEEPALIVE -/** - * Check if the connection is still alive, based on last communication. - */ -static gboolean -msim_check_alive(gpointer data) -{ - MsimSession *session; - time_t delta; - - session = (MsimSession *)data; - - delta = time(NULL) - session->last_comm; - - /* purple_debug_info("msim", "msim_check_alive: delta=%d\n", delta); */ - if (delta >= MSIM_KEEPALIVE_INTERVAL) { - purple_debug_info("msim", - "msim_check_alive: %zu > interval of %d, presumed dead\n", - delta, MSIM_KEEPALIVE_INTERVAL); - purple_connection_error_reason(session->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - - return FALSE; - } - - return TRUE; -} -#endif - -/** - * Handle mail reply checks. - */ -static void -msim_check_inbox_cb(MsimSession *session, const MsimMessage *reply, gpointer data) -{ - MsimMessage *body; - guint old_inbox_status; - guint i, n; - /* Information for each new inbox message type. */ - static struct - { - const gchar *key; - guint bit; - const gchar *url; - const gchar *text; - } message_types[] = { - { "Mail", MSIM_INBOX_MAIL, "http://messaging.myspace.com/index.cfm?fuseaction=mail.inbox", NULL }, - { "BlogComment", MSIM_INBOX_BLOG_COMMENT, "http://blog.myspace.com/index.cfm?fuseaction=blog", NULL }, - { "ProfileComment", MSIM_INBOX_PROFILE_COMMENT, "http://home.myspace.com/index.cfm?fuseaction=user", NULL }, - { "FriendRequest", MSIM_INBOX_FRIEND_REQUEST, "http://messaging.myspace.com/index.cfm?fuseaction=mail.friendRequests", NULL }, - { "PictureComment", MSIM_INBOX_PICTURE_COMMENT, "http://home.myspace.com/index.cfm?fuseaction=user", NULL } - }; - const gchar *froms[G_N_ELEMENTS(message_types) + 1] = { "" }, - *tos[G_N_ELEMENTS(message_types) + 1] = { "" }, - *urls[G_N_ELEMENTS(message_types) + 1] = { "" }, - *subjects[G_N_ELEMENTS(message_types) + 1] = { "" }; - - g_return_if_fail(reply != NULL); - - /* Can't write _()'d strings in array initializers. Workaround. */ - /* khc: then use N_() in the array initializer and use _() when they are - used */ - message_types[0].text = _("New mail messages"); - message_types[1].text = _("New blog comments"); - message_types[2].text = _("New profile comments"); - message_types[3].text = _("New friend requests!"); - message_types[4].text = _("New picture comments"); - - body = msim_msg_get_dictionary(reply, "body"); - - if (body == NULL) - return; - - old_inbox_status = session->inbox_status; - - n = 0; - - for (i = 0; i < G_N_ELEMENTS(message_types); ++i) { - const gchar *key; - guint bit; - - key = message_types[i].key; - bit = message_types[i].bit; - - if (msim_msg_get(body, key)) { - /* Notify only on when _changes_ from no mail -> has mail - * (edge triggered) */ - if (!(session->inbox_status & bit)) { - purple_debug_info("msim", "msim_check_inbox_cb: got %s, at %d\n", - key ? key : "(NULL)", n); - - subjects[n] = message_types[i].text; - froms[n] = _("MySpace"); - tos[n] = session->username; - /* TODO: append token, web challenge, so automatically logs in. - * Would also need to free strings because they won't be static - */ - urls[n] = message_types[i].url; - - ++n; - } else { - purple_debug_info("msim", - "msim_check_inbox_cb: already notified of %s\n", - key ? key : "(NULL)"); - } - - session->inbox_status |= bit; - } - } - - if (n) { - purple_debug_info("msim", - "msim_check_inbox_cb: notifying of %d\n", n); - - /* TODO: free strings with callback _if_ change to dynamic (w/ token) */ - purple_notify_emails(session->gc, /* handle */ - n, /* count */ - TRUE, /* detailed */ - subjects, froms, tos, urls, - NULL, /* PurpleNotifyCloseCallback cb */ - NULL); /* gpointer user_data */ - - } - - msim_msg_free(body); -} - -/** - * Send request to check if there is new mail. - */ -static gboolean -msim_check_inbox(gpointer data) -{ - MsimSession *session; - - session = (MsimSession *)data; - - purple_debug_info("msim", "msim_check_inbox: checking mail\n"); - g_return_val_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_CHECK_MAIL_DSN, - "lid", MSIM_TYPE_INTEGER, MG_CHECK_MAIL_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, - msim_new_reply_callback(session, msim_check_inbox_cb, NULL), - "body", MSIM_TYPE_STRING, g_strdup(""), - NULL), TRUE); - - /* Always return true, so that we keep checking for mail. */ - return TRUE; -} - -/** - * Add contact from server to buddy list, after looking up username. - * Callback from msim_add_contact_from_server(). - * - * @param data An MsimMessage * of the contact information. Will be freed. - */ -static void -msim_add_contact_from_server_cb(MsimSession *session, const MsimMessage *user_lookup_info, gpointer data) -{ - MsimMessage *contact_info, *user_lookup_info_body; - PurpleGroup *group; - PurpleBuddy *buddy; - MsimUser *user; - gchar *username, *group_name, *display_name; - guint uid, visibility; - - contact_info = (MsimMessage *)data; - purple_debug_info("msim_add_contact_from_server_cb", "contact_info addr=%p\n", contact_info); - uid = msim_msg_get_integer(contact_info, "ContactID"); - - if (!user_lookup_info) { - username = g_strdup(msim_uid2username_from_blist(session->account, uid)); - display_name = NULL; - g_return_if_fail(username != NULL); - } else { - user_lookup_info_body = msim_msg_get_dictionary(user_lookup_info, "body"); - username = msim_msg_get_string(user_lookup_info_body, "UserName"); - display_name = msim_msg_get_string(user_lookup_info_body, "DisplayName"); - msim_msg_free(user_lookup_info_body); - g_return_if_fail(username != NULL); - } - - purple_debug_info("msim_add_contact_from_server_cb", - "*** about to add/update username=%s\n", username); - - /* 1. Creates a new group, or gets existing group if it exists (or so - * the documentation claims). */ - group_name = msim_msg_get_string(contact_info, "GroupName"); - if (!group_name || (*group_name == '\0')) { - g_free(group_name); - group_name = g_strdup(_("IM Friends")); - purple_debug_info("myspace", "No GroupName specified, defaulting to '%s'.\n", group_name); - } - group = purple_find_group(group_name); - if (!group) { - group = purple_group_new(group_name); - /* Add group to beginning. See #2752. */ - purple_blist_add_group(group, NULL); - } - g_free(group_name); - - visibility = msim_msg_get_integer(contact_info, "Visibility"); - if (visibility == 2) { - /* This buddy is blocked (and therefore not on our buddy list */ - purple_privacy_deny_add(session->account, username, TRUE); - msim_msg_free(contact_info); - g_free(username); - g_free(display_name); - return; - } - - /* 2. Get or create buddy */ - buddy = purple_find_buddy(session->account, username); - if (!buddy) { - purple_debug_info("msim_add_contact_from_server_cb", - "creating new buddy: %s\n", username); - buddy = purple_buddy_new(session->account, username, NULL); - } - - /* TODO: use 'Position' in contact_info to take into account where buddy is */ - purple_blist_add_buddy(buddy, NULL, group, NULL /* insertion point */); - - if (strtol(username, NULL, 10) == uid) { - /* - * This user has not set their username! Set their server - * alias to their display name so that we don't see a bunch - * of numbers in the buddy list. - */ - if (display_name != NULL) { - purple_blist_node_set_string(PURPLE_BLIST_NODE(buddy), "DisplayName", display_name); - serv_got_alias(session->gc, username, display_name); - } else { - serv_got_alias(session->gc, username, - purple_blist_node_get_string(PURPLE_BLIST_NODE(buddy), "DisplayName")); - } - } - g_free(display_name); - - /* 3. Update buddy information */ - user = msim_get_user_from_buddy(buddy, TRUE); - - user->id = uid; - /* Keep track of the user ID across sessions */ - purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", uid); - - /* Stores a few fields in the MsimUser, relevant to the buddy itself. - * AvatarURL, Headline, ContactID. */ - msim_store_user_info(session, contact_info, NULL); - - /* TODO: other fields, store in 'user' */ - msim_msg_free(contact_info); - - g_free(username); -} - -/** - * Add first ContactID in contact_info to buddy's list. Used to add - * server-side buddies to client-side list. - * - * @return TRUE if added. - */ -static gboolean -msim_add_contact_from_server(MsimSession *session, MsimMessage *contact_info) -{ - guint uid; - const gchar *username; - - uid = msim_msg_get_integer(contact_info, "ContactID"); - g_return_val_if_fail(uid != 0, FALSE); - - /* Lookup the username, since NickName and IMName is unreliable */ - username = msim_uid2username_from_blist(session->account, uid); - if (!username) { - gchar *uid_str; - - uid_str = g_strdup_printf("%d", uid); - purple_debug_info("msim_add_contact_from_server", - "contact_info addr=%p\n", contact_info); - msim_lookup_user(session, uid_str, msim_add_contact_from_server_cb, (gpointer)msim_msg_clone(contact_info)); - g_free(uid_str); - } else { - msim_add_contact_from_server_cb(session, NULL, (gpointer)msim_msg_clone(contact_info)); - } - - /* Say that the contact was added, even if we're still looking up - * their username. */ - return TRUE; -} - -/** - * Called when contact list is received from server. - */ -static void -msim_got_contact_list(MsimSession *session, const MsimMessage *reply, gpointer user_data) -{ - MsimMessage *body, *body_node; - gchar *msg; - guint buddy_count; - - body = msim_msg_get_dictionary(reply, "body"); - - buddy_count = 0; - - for (body_node = body; - body_node != NULL; - body_node = msim_msg_get_next_element_node(body_node)) - { - MsimMessageElement *elem; - - elem = (MsimMessageElement *)body_node->data; - - if (g_str_equal(elem->name, "ContactID")) - { - /* Will look for first contact in body_node */ - if (msim_add_contact_from_server(session, body_node)) { - ++buddy_count; - } - } - } - - switch (GPOINTER_TO_UINT(user_data)) { - case MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS: - msg = g_strdup_printf(ngettext("%d buddy was added or updated from the server (including buddies already on the server-side list)", - "%d buddies were added or updated from the server (including buddies already on the server-side list)", - buddy_count), - buddy_count); - purple_notify_info(session->account, _("Add contacts from server"), msg, NULL); - g_free(msg); - break; - - case MSIM_CONTACT_LIST_IMPORT_TOP_FRIENDS: - /* TODO */ - break; - - case MSIM_CONTACT_LIST_INITIAL_FRIENDS: - /* The session is now set up, ready to be connected. This emits the - * signedOn signal, so clients can now do anything with msimprpl, and - * we're ready for it (session key, userid, username all setup). */ - purple_connection_update_progress(session->gc, _("Connected"), 3, 4); - purple_connection_set_state(session->gc, PURPLE_CONNECTED); - break; - } - - msim_msg_free(body); -} - -/** - * Get contact list, calling msim_got_contact_list() with - * what_to_do_after as user_data gpointer. - * - * @param what_to_do_after should be one of the MSIM_CONTACT_LIST_* #defines. - */ -static gboolean -msim_get_contact_list(MsimSession *session, int what_to_do_after) -{ - return msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_LIST_ALL_CONTACTS_DSN, - "lid", MSIM_TYPE_INTEGER, MG_LIST_ALL_CONTACTS_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, - msim_new_reply_callback(session, msim_got_contact_list, GUINT_TO_POINTER(what_to_do_after)), - "body", MSIM_TYPE_STRING, g_strdup(""), - NULL); -} - -/** Called after username is set, if necessary and we're open for business. */ -gboolean msim_we_are_logged_on(MsimSession *session) -{ - MsimMessage *body; - - /* Set display name to username (otherwise will show email address) */ - purple_connection_set_display_name(session->gc, session->username); - - body = msim_msg_new( - "UserID", MSIM_TYPE_INTEGER, session->userid, - NULL); - - /* Request IM info about ourself. */ - msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_OWN_MYSPACE_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MG_OWN_MYSPACE_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "UserID", MSIM_TYPE_INTEGER, session->userid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - - /* Request MySpace info about ourself. */ - msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_OWN_IM_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MG_OWN_IM_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_STRING, g_strdup(""), - NULL); - - /* TODO: set options (persist cmd=514,dsn=1,lid=10) */ - /* TODO: set blocklist */ - - /* Notify servers of our current status. */ - purple_debug_info("msim", "msim_we_are_logged_on: notifying servers of status\n"); - msim_set_status(session->account, - purple_account_get_active_status(session->account)); - - /* TODO: setinfo */ - /* - body = msim_msg_new( - "TotalFriends", MSIM_TYPE_INTEGER, 666, - NULL); - msim_send(session, - "setinfo", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "info", MSIM_TYPE_DICTIONARY, body, - NULL); - */ - - /* Disable due to problems with timeouts. TODO: fix. */ -#ifdef MSIM_USE_KEEPALIVE - purple_timeout_add_seconds(MSIM_KEEPALIVE_INTERVAL_CHECK, - (GSourceFunc)msim_check_alive, session); -#endif - - /* Check mail if they want to. */ - if (purple_account_get_check_mail(session->account)) { - session->inbox_handle = purple_timeout_add(MSIM_MAIL_INTERVAL_CHECK, - (GSourceFunc)msim_check_inbox, session); - msim_check_inbox(session); - } - - msim_get_contact_list(session, MSIM_CONTACT_LIST_INITIAL_FRIENDS); - - return TRUE; -} - -/** - * Record the client version in the buddy list, from an incoming message. - */ -static gboolean -msim_incoming_bm_record_cv(MsimSession *session, MsimMessage *msg) -{ - gchar *username, *cv; - gboolean ret; - MsimUser *user; - - username = msim_msg_get_string(msg, "_username"); - cv = msim_msg_get_string(msg, "cv"); - - g_return_val_if_fail(username != NULL, FALSE); - if (!cv) { - /* No client version to record, don't worry about it. */ - g_free(username); - return FALSE; - } - - user = msim_find_user(session, username); - - if (user) { - user->client_cv = atol(cv); - ret = TRUE; - } else { - ret = FALSE; - } - - g_free(username); - g_free(cv); - - return ret; -} - -#ifdef MSIM_SEND_CLIENT_VERSION -/** - * Send our client version to another unofficial client that understands it. - */ -static gboolean -msim_send_unofficial_client(MsimSession *session, gchar *username) -{ - gchar *our_info; - gboolean ret; - - our_info = g_strdup_printf("Libpurple %d.%d.%d - msimprpl %s", - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_MICRO_VERSION, - MSIM_PRPL_VERSION_STRING); - - ret = msim_send_bm(session, username, our_info, MSIM_BM_UNOFFICIAL_CLIENT); - - return ret; -} -#endif -/** - * Process incoming status mood messages. - * - * @param session - * @param msg Status mood update message. Caller frees. - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_status_mood(MsimSession *session, MsimMessage *msg) { - /* TODO: I dont know too much about this yet, - * so until I see how the official client handles - * this and decide if libpurple should as well, - * well just say we used it - */ - gchar *ss; - ss = msim_msg_get_string(msg, "msg"); - purple_debug_info("msim", "Incoming Status Message: %s", ss ? ss : "(NULL)"); - g_free(ss); - return TRUE; -} - -/** - * Process incoming status messages. - * - * @param session - * @param msg Status update message. Caller frees. - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_status(MsimSession *session, MsimMessage *msg) -{ - PurpleBuddyList *blist; - MsimUser *user; - GList *list; - gchar *status_headline, *status_headline_escaped; - gint status_code, purple_status_code; - gchar *username; - gchar *unrecognized_msg; - - g_return_val_if_fail(msg != NULL, FALSE); - - /* Helpfully looked up by msim_incoming_resolve() for us. */ - username = msim_msg_get_string(msg, "_username"); - g_return_val_if_fail(username != NULL, FALSE); - - { - gchar *ss; - - ss = msim_msg_get_string(msg, "msg"); - purple_debug_info("msim", - "msim_status: updating status for <%s> to <%s>\n", - username, ss ? ss : "(NULL)"); - g_free(ss); - } - - /* Example fields: - * |s|0|ss|Offline - * |s|1|ss|:-)|ls||ip|0|p|0 - */ - list = msim_msg_get_list(msg, "msg"); - - status_code = msim_msg_get_integer_from_element(g_list_nth_data(list, MSIM_STATUS_ORDINAL_ONLINE)); - purple_debug_info("msim", "msim_status: %s's status code = %d\n", username, status_code); - status_headline = msim_msg_get_string_from_element(g_list_nth_data(list, MSIM_STATUS_ORDINAL_HEADLINE)); - - blist = purple_get_blist(); - - /* Add buddy if not found. - * TODO: Could this be responsible for #3444? */ - user = msim_find_user(session, username); - if (!user) { - PurpleBuddy *buddy; - - purple_debug_info("msim", - "msim_status: making new buddy for %s\n", username); - buddy = purple_buddy_new(session->account, username, NULL); - purple_blist_add_buddy(buddy, NULL, NULL, NULL); - - user = msim_get_user_from_buddy(buddy, TRUE); - user->id = msim_msg_get_integer(msg, "f"); - - /* Keep track of the user ID across sessions */ - purple_blist_node_set_int(PURPLE_BLIST_NODE(buddy), "UserID", user->id); - - msim_store_user_info(session, msg, NULL); - } else { - purple_debug_info("msim", "msim_status: found buddy %s\n", username); - } - - if (status_headline && strcmp(status_headline, "") != 0) { - /* The status headline is plaintext, but libpurple treats it as HTML, - * so escape any HTML characters to their entity equivalents. */ - status_headline_escaped = g_markup_escape_text(status_headline, -1); - } else { - status_headline_escaped = NULL; - } - - g_free(status_headline); - - /* don't copy; let the MsimUser own the headline, memory-wise */ - g_free(user->headline); - user->headline = status_headline_escaped; - - /* Set user status */ - switch (status_code) { - case MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN: - purple_status_code = PURPLE_STATUS_OFFLINE; - break; - - case MSIM_STATUS_CODE_ONLINE: - purple_status_code = PURPLE_STATUS_AVAILABLE; - break; - - case MSIM_STATUS_CODE_AWAY: - purple_status_code = PURPLE_STATUS_AWAY; - break; - - case MSIM_STATUS_CODE_IDLE: - /* Treat idle as an available status. */ - purple_status_code = PURPLE_STATUS_AVAILABLE; - break; - - default: - purple_debug_info("msim", "msim_incoming_status for %s, unknown status code %d, treating as available\n", - username, status_code); - purple_status_code = PURPLE_STATUS_AVAILABLE; - - unrecognized_msg = g_strdup_printf("msim_incoming_status, unrecognized status code: %d\n", - status_code); - msim_unrecognized(session, NULL, unrecognized_msg); - g_free(unrecognized_msg); - } - - purple_prpl_got_user_status(session->account, username, purple_primitive_get_id_from_type(purple_status_code), NULL); - - if (status_code == MSIM_STATUS_CODE_IDLE) { - purple_debug_info("msim", "msim_status: got idle: %s\n", username); - purple_prpl_got_user_idle(session->account, username, TRUE, 0); - } else { - /* All other statuses indicate going back to non-idle. */ - purple_prpl_got_user_idle(session->account, username, FALSE, 0); - } - -#ifdef MSIM_SEND_CLIENT_VERSION - if (status_code == MSIM_STATUS_CODE_ONLINE) { - /* Secretly whisper to unofficial clients our own version as they come online */ - msim_send_unofficial_client(session, username); - } -#endif - - if (status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN) { - /* Get information when they come online. - * TODO: periodically refresh? - */ - purple_debug_info("msim_incoming_status", "%s came online, looking up\n", username); - msim_lookup_user(session, username, NULL, NULL); - } - - g_free(username); - msim_msg_list_free(list); - - return TRUE; -} - -/** - * Handle an incoming instant message. - * - * @param session The session - * @param msg Message from the server, containing 'f' (userid from) and 'msg'. - * Should also contain username in _username from preprocessing. - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_im(MsimSession *session, MsimMessage *msg, const gchar *username) -{ - gchar *msg_msim_markup, *msg_purple_markup; - gchar *userid; - time_t time_received; - PurpleConversation *conv; - - /* I know this isn't really a string... but we need it to be one for - * purple_find_conversation_with_account(). */ - userid = msim_msg_get_string(msg, "f"); - - purple_debug_info("msim_incoming_im", "UserID is %s", userid); - - if (msim_is_userid(username)) { - purple_debug_info("msim", "Ignoring message from spambot (%s) on account %s\n", - username, purple_account_get_username(session->account)); - return FALSE; - } - - /* See if a conversation with their UID already exists...*/ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, userid, session->account); - if (conv) { - /* Since the conversation exists... We need to normalize it */ - purple_conversation_set_name(conv, username); - } - - msg_msim_markup = msim_msg_get_string(msg, "msg"); - g_return_val_if_fail(msg_msim_markup != NULL, FALSE); - - msg_purple_markup = msim_markup_to_html(session, msg_msim_markup); - g_free(msg_msim_markup); - - time_received = msim_msg_get_integer(msg, "date"); - if (!time_received) { - purple_debug_info("msim_incoming_im", "date in message not set.\n"); - time_received = time(NULL); - } - - serv_got_im(session->gc, username, msg_purple_markup, PURPLE_MESSAGE_RECV, time_received); - - g_free(msg_purple_markup); - - return TRUE; -} - -/** - * Handle an incoming action message or an IM. - * - * @param session - * @param msg - * - * @return TRUE if successful. - */ -static gboolean -msim_incoming_action_or_im(MsimSession *session, MsimMessage *msg) -{ - gchar *msg_text, *username; - gboolean rc; - - g_return_val_if_fail(msg != NULL, FALSE); - - msg_text = msim_msg_get_string(msg, "msg"); - g_return_val_if_fail(msg_text != NULL, FALSE); - - username = msim_msg_get_string(msg, "_username"); - g_return_val_if_fail(username != NULL, FALSE); - - purple_debug_info("msim", - "msim_incoming_action_or_im: action <%s> from <%s>\n", - msg_text, username); - - if (g_str_equal(msg_text, "%typing%")) { - serv_got_typing(session->gc, username, 0, PURPLE_TYPING); - rc = TRUE; - } else if (g_str_equal(msg_text, "%stoptyping%")) { - serv_got_typing_stopped(session->gc, username); - rc = TRUE; - } else if (strstr(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_")) { - rc = msim_incoming_zap(session, msg); - } else if (strstr(msg_text, "!!!GroupCount=")) { - /* TODO: support group chats. I think the number in msg_text has - * something to do with the 'gid' field. */ - purple_debug_info("msim", - "msim_incoming_action_or_im: " - "TODO: implement #4691, group chats: %s\n", msg_text); - - rc = TRUE; - } else if (strstr(msg_text, "!!!Offline=")) { - /* TODO: support group chats. This one might mean a user - * went offline or exited the chat. */ - purple_debug_info("msim", "msim_incoming_action_or_im: " - "TODO: implement #4691, group chats: %s\n", msg_text); - - rc = TRUE; - } else if (msim_msg_get_integer(msg, "aid") != 0) { - purple_debug_info("msim", "TODO: implement #4691, group chat from %d on %d: %s\n", - msim_msg_get_integer(msg, "aid"), - msim_msg_get_integer(msg, "f"), - msg_text); - - rc = TRUE; - } else { - rc = msim_incoming_im(session, msg, username); - } - - g_free(msg_text); - g_free(username); - - return rc; -} - -/** - * Process an incoming media (message background?) message. - */ -static gboolean -msim_incoming_media(MsimSession *session, MsimMessage *msg) -{ - gchar *username, *text; - - username = msim_msg_get_string(msg, "_username"); - text = msim_msg_get_string(msg, "msg"); - - g_return_val_if_fail(username != NULL, FALSE); - g_return_val_if_fail(text != NULL, FALSE); - - purple_debug_info("msim", "msim_incoming_media: from %s, got msg=%s\n", username, text); - - /* Media messages are sent when the user opens a window to someone. - * Tell libpurple they started typing and stopped typing, to inform the Psychic - * Mode plugin so it too can open a window to the user. */ - serv_got_typing(session->gc, username, 0, PURPLE_TYPING); - serv_got_typing_stopped(session->gc, username); - - g_free(username); - - return TRUE; -} - -/** - * Process an incoming "unofficial client" message. The plugin for - * Miranda IM sends this message with the plugin information. - */ -static gboolean -msim_incoming_unofficial_client(MsimSession *session, MsimMessage *msg) -{ - MsimUser *user; - gchar *username, *client_info; - - username = msim_msg_get_string(msg, "_username"); - client_info = msim_msg_get_string(msg, "msg"); - - g_return_val_if_fail(username != NULL, FALSE); - g_return_val_if_fail(client_info != NULL, FALSE); - - purple_debug_info("msim", "msim_incoming_unofficial_client: %s is using client %s\n", - username, client_info); - - user = msim_find_user(session, username); - - g_return_val_if_fail(user != NULL, FALSE); - - if (user->client_info) { - g_free(user->client_info); - } - user->client_info = client_info; - - g_free(username); - /* Do not free client_info - the MsimUser now owns it. */ - - return TRUE; -} - -/** - * Handle an incoming buddy message. - */ -static gboolean -msim_incoming_bm(MsimSession *session, MsimMessage *msg) -{ - guint bm; - - bm = msim_msg_get_integer(msg, "bm"); - - msim_incoming_bm_record_cv(session, msg); - - switch (bm) { - case MSIM_BM_STATUS: - return msim_incoming_status(session, msg); - case MSIM_BM_ACTION_OR_IM_DELAYABLE: - case MSIM_BM_ACTION_OR_IM_INSTANT: - return msim_incoming_action_or_im(session, msg); - case MSIM_BM_MEDIA: - return msim_incoming_media(session, msg); - case MSIM_BM_UNOFFICIAL_CLIENT: - return msim_incoming_unofficial_client(session, msg); - case MSIM_BM_STATUS_MOOD: - return msim_incoming_status_mood(session, msg); - default: - /* - * Unknown message type! We used to call - * msim_incoming_action_or_im(session, msg); - * for these, but that doesn't help anything, and it means - * we'll show broken gibberish if MySpace starts sending us - * other message types. - */ - purple_debug_warning("myspace", "Received unknown imcoming " - "message, bm=%u\n", bm); - return TRUE; - } -} - -/** - * Process the initial server information from the server. - */ -static gboolean -msim_process_server_info(MsimSession *session, MsimMessage *msg) -{ - MsimMessage *body; - - body = msim_msg_get_dictionary(msg, "body"); - g_return_val_if_fail(body != NULL, FALSE); - - /* Example body: -AdUnitRefreshInterval=10. -AlertPollInterval=360. -AllowChatRoomEmoticonSharing=False. -ChatRoomUserIDs=78744676;163733130;1300326231;123521495;142663391. -CurClientVersion=673. -EnableIMBrowse=True. -EnableIMStuffAvatars=False. -EnableIMStuffZaps=False. -MaxAddAllFriends=100. -MaxContacts=1000. -MinClientVersion=594. -MySpaceIM_ENGLISH=78744676. -MySpaceNowTimer=720. -PersistenceDataTimeout=900. -UseWebChallenge=1. -WebTicketGoHome=False - - Anything useful? TODO: use what is useful, and use it. -*/ - purple_debug_info("msim_process_server_info", - "maximum contacts: %d\n", - msim_msg_get_integer(body, "MaxContacts")); - - session->server_info = body; - /* session->server_info freed in msim_session_destroy */ - - return TRUE; -} - -/** - * Process a web challenge, used to login to the web site. - */ -static gboolean -msim_web_challenge(MsimSession *session, MsimMessage *msg) -{ - /* TODO: web challenge, store token. #2659. */ - return FALSE; -} - -/** - * Process a persistance message reply from the server. - * - * @param session - * @param msg Message reply from server. - * - * @return TRUE if successful. - * - * msim_lookup_user sets callback for here - */ -static gboolean -msim_process_reply(MsimSession *session, MsimMessage *msg) -{ - MSIM_USER_LOOKUP_CB cb; - gpointer data; - guint rid, cmd, dsn, lid; - - g_return_val_if_fail(msg != NULL, FALSE); - - msim_store_user_info(session, msg, NULL); - - rid = msim_msg_get_integer(msg, "rid"); - cmd = msim_msg_get_integer(msg, "cmd"); - dsn = msim_msg_get_integer(msg, "dsn"); - lid = msim_msg_get_integer(msg, "lid"); - - /* Unsolicited messages */ - if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_GET)) { - if (dsn == MG_SERVER_INFO_DSN && lid == MG_SERVER_INFO_LID) { - return msim_process_server_info(session, msg); - } else if (dsn == MG_WEB_CHALLENGE_DSN && lid == MG_WEB_CHALLENGE_LID) { - return msim_web_challenge(session, msg); - } - } - - /* If a callback is registered for this userid lookup, call it. */ - cb = g_hash_table_lookup(session->user_lookup_cb, GUINT_TO_POINTER(rid)); - data = g_hash_table_lookup(session->user_lookup_cb_data, GUINT_TO_POINTER(rid)); - - if (cb) { - purple_debug_info("msim", "msim_process_reply: calling callback now\n"); - /* Clone message, so that the callback 'cb' can use it (needs to free it also). */ - cb(session, msg, data); - g_hash_table_remove(session->user_lookup_cb, GUINT_TO_POINTER(rid)); - g_hash_table_remove(session->user_lookup_cb_data, GUINT_TO_POINTER(rid)); - } else { - purple_debug_info("msim", - "msim_process_reply: no callback for rid %d\n", rid); - } - - return TRUE; -} - -/** - * Handle an error from the server. - * - * @param session - * @param msg The message. - * - * @return TRUE if successfully reported error. - */ -static gboolean -msim_error(MsimSession *session, MsimMessage *msg) -{ - gchar *errmsg, *full_errmsg; - guint err; - - g_return_val_if_fail(msg != NULL, FALSE); - - err = msim_msg_get_integer(msg, "err"); - errmsg = msim_msg_get_string(msg, "errmsg"); - - full_errmsg = g_strdup_printf(_("Protocol error, code %d: %s"), err, - errmsg ? errmsg : "no 'errmsg' given"); - - g_free(errmsg); - - purple_debug_info("msim", "msim_error (sesskey=%d): %s\n", - session->sesskey, full_errmsg); - - /* Destroy session if fatal. */ - if (msim_msg_get(msg, "fatal")) { - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - purple_debug_info("msim", "fatal error, closing\n"); - - switch (err) { - case MSIM_ERROR_INCORRECT_PASSWORD: /* Incorrect password */ - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); -#ifdef MSIM_MAX_PASSWORD_LENGTH - if (session->account->password && (strlen(session->account->password) > MSIM_MAX_PASSWORD_LENGTH)) { - gchar *suggestion; - - suggestion = g_strdup_printf(_("%s Your password is " - "%zu characters, which is longer than the " - "maximum length of %d. Please shorten your " - "password at http://profileedit.myspace.com/index.cfm?fuseaction=accountSettings.changePassword and try again."), - full_errmsg, - strlen(session->account->password), - MSIM_MAX_PASSWORD_LENGTH); - - /* Replace full_errmsg. */ - g_free(full_errmsg); - full_errmsg = suggestion; - } else { - g_free(full_errmsg); - full_errmsg = g_strdup(_("Incorrect username or password")); - } -#endif - break; - case MSIM_ERROR_LOGGED_IN_ELSEWHERE: /* Logged in elsewhere */ - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - if (!purple_account_get_remember_password(session->account)) - purple_account_set_password(session->account, NULL); - break; - } - purple_connection_error_reason(session->gc, reason, full_errmsg); - } else { - purple_notify_error(session->account, _("MySpaceIM Error"), full_errmsg, NULL); - } - - g_free(full_errmsg); - - return TRUE; -} - -/** - * Process a message. - * - * @param session - * @param msg A message from the server, ready for processing (possibly with resolved username information attached). Caller frees. - * - * @return TRUE if successful. FALSE if processing failed. - */ -static gboolean -msim_process(MsimSession *session, MsimMessage *msg) -{ - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(msg != NULL, FALSE); - - if (msim_msg_get_integer(msg, "lc") == 1) { - return msim_login_challenge(session, msg); - } else if (msim_msg_get_integer(msg, "lc") == 2) { - /* return msim_we_are_logged_on(session, msg); */ - if (msim_is_username_set(session, msg)) { - return msim_we_are_logged_on(session); - } else { - /* No username is set... We'll wait for the callbacks to do their work */ - /* When they're all done, the last one will call msim_we_are_logged_on() and pick up where we left off */ - return FALSE; - } - } else if (msim_msg_get(msg, "bm")) { - return msim_incoming_bm(session, msg); - } else if (msim_msg_get(msg, "rid")) { - return msim_process_reply(session, msg); - } else if (msim_msg_get(msg, "error")) { - return msim_error(session, msg); - } else if (msim_msg_get(msg, "ka")) { - return TRUE; - } else { - msim_unrecognized(session, msg, "in msim_process"); - return FALSE; - } -} - -/** - * After a uid is resolved to username, tag it with the username and submit for processing. - * - * @param session - * @param userinfo Response messsage to resolving request. - * @param data MsimMessage *, the message to attach information to. - */ -static void -msim_incoming_resolved(MsimSession *session, const MsimMessage *userinfo, - gpointer data) -{ - gchar *username; - MsimMessage *msg, *body; - - g_return_if_fail(userinfo != NULL); - - body = msim_msg_get_dictionary(userinfo, "body"); - g_return_if_fail(body != NULL); - - username = msim_msg_get_string(body, "UserName"); - g_return_if_fail(username != NULL); - /* Note: username will be owned by 'msg' below. */ - - msg = (MsimMessage *)data; - g_return_if_fail(msg != NULL); - - /* TODO: more elegant solution than below. attach whole message? */ - /* Special elements name beginning with '_', we'll use internally within the - * program (did not come directly from the wire). */ - msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, username); /* This makes 'msg' the owner of 'username' */ - - /* TODO: attach more useful information, like ImageURL */ - - msim_process(session, msg); - - msim_msg_free(msg); - msim_msg_free(body); -} - -/** - * Preprocess incoming messages, resolving as needed, calling - * msim_process() when ready to process. - * - * @param session - * @param msg MsimMessage *, freed by caller. - */ -static gboolean -msim_preprocess_incoming(MsimSession *session, MsimMessage *msg) -{ - g_return_val_if_fail(msg != NULL, FALSE); - - if (msim_msg_get(msg, "bm") && msim_msg_get(msg, "f")) { - guint uid; - const gchar *username; - - /* 'f' = userid message is from, in buddy messages */ - uid = msim_msg_get_integer(msg, "f"); - - username = msim_uid2username_from_blist(session->account, uid); - - if (username) { - /* Know username already, use it. */ - purple_debug_info("msim", "msim_preprocess_incoming: tagging with _username=%s\n", - username); - msg = msim_msg_append(msg, "_username", MSIM_TYPE_STRING, g_strdup(username)); - return msim_process(session, msg); - - } else { - gchar *from; - - /* Send lookup request. */ - /* XXX: where is msim_msg_get_string() freed? make _strdup and _nonstrdup. */ - purple_debug_info("msim", "msim_incoming: sending lookup, setting up callback\n"); - from = msim_msg_get_string(msg, "f"); - msim_lookup_user(session, from, msim_incoming_resolved, msim_msg_clone(msg)); - g_free(from); - - /* indeterminate */ - return TRUE; - } - } else { - /* Nothing to resolve - send directly to processing. */ - return msim_process(session, msg); - } -} - -/** - * Callback when input available. - * - * @param gc_uncasted A PurpleConnection pointer. - * @param source File descriptor. - * @param cond PURPLE_INPUT_READ - * - * Reads the input, and calls msim_preprocess_incoming() to handle it. - */ -static void -msim_input_cb(gpointer gc_uncasted, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc; - PurpleAccount *account; - MsimSession *session; - gchar *end; - int n; - - g_return_if_fail(gc_uncasted != NULL); - g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */ - - gc = (PurpleConnection *)(gc_uncasted); - account = purple_connection_get_account(gc); - session = gc->proto_data; - - /* libpurple/eventloop.h only defines these two */ - if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) { - purple_debug_info("msim_input_cb", "unknown condition=%d\n", cond); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid input condition")); - return; - } - - g_return_if_fail(cond == PURPLE_INPUT_READ); - - /* Mark down that we got data, so we don't timeout. */ - session->last_comm = time(NULL); - - /* If approaching end of buffer, reallocate some more memory. */ - if (session->rxsize < session->rxoff + MSIM_READ_BUF_SIZE) { - purple_debug_info("msim", - "msim_input_cb: %d-byte read buffer full, rxoff=%d, " "growing by %d bytes\n", - session->rxsize, session->rxoff, MSIM_READ_BUF_SIZE); - session->rxsize += MSIM_READ_BUF_SIZE; - session->rxbuf = g_realloc(session->rxbuf, session->rxsize); - - return; - } - - purple_debug_info("msim", "dynamic buffer at %d (max %d), reading up to %d\n", - session->rxoff, session->rxsize, - MSIM_READ_BUF_SIZE - session->rxoff - 1); - - /* Read into buffer. On Win32, need recv() not read(). session->fd also holds - * the file descriptor, but it sometimes differs from the 'source' parameter. - */ - n = recv(session->fd, - session->rxbuf + session->rxoff, - session->rxsize - session->rxoff - 1, 0); - - if (n < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (n == 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - /* Null terminate */ - purple_debug_info("msim", "msim_input_cb: going to null terminate " - "at n=%d\n", n); - session->rxbuf[session->rxoff + n] = 0; - -#ifdef MSIM_CHECK_EMBEDDED_NULLS - /* Check for embedded NULs. I don't handle them, and they shouldn't occur. */ - if (strlen(session->rxbuf + session->rxoff) != n) { - /* Occurs after login, but it is not a null byte. */ - purple_debug_info("msim", "msim_input_cb: strlen=%d, but read %d bytes" - "--null byte encountered?\n", - strlen(session->rxbuf + session->rxoff), n); - /*purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - "Invalid message - null byte on input"); */ - return; - } -#endif - - session->rxoff += n; - purple_debug_info("msim", "msim_input_cb: read=%d\n", n); - -#ifdef MSIM_DEBUG_RXBUF - purple_debug_info("msim", "buf=<%s>\n", session->rxbuf); -#endif - - /* Look for \\final\\ end markers. If found, process message. */ - while((end = strstr(session->rxbuf, MSIM_FINAL_STRING))) { - MsimMessage *msg; - -#ifdef MSIM_DEBUG_RXBUF - purple_debug_info("msim", "in loop: buf=<%s>\n", session->rxbuf); -#endif - *end = 0; - msg = msim_parse(session->rxbuf); - if (!msg) { - purple_debug_info("msim", "msim_input_cb: couldn't parse rxbuf\n"); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to parse message")); - break; - } else { - /* Process message and then free it (processing function should - * clone message if it wants to keep it afterwards.) */ - if (!msim_preprocess_incoming(session, msg)) { - msim_msg_dump("msim_input_cb: preprocessing message failed on msg: %s\n", msg); - } - msim_msg_free(msg); - } - - /* Move remaining part of buffer to beginning. */ - session->rxoff -= strlen(session->rxbuf) + strlen(MSIM_FINAL_STRING); - memmove(session->rxbuf, end + strlen(MSIM_FINAL_STRING), - session->rxsize - (end + strlen(MSIM_FINAL_STRING) - session->rxbuf)); - - /* Clear end of buffer - * memset(end, 0, MSIM_READ_BUF_SIZE - (end - session->rxbuf)); - */ - } -} - -/** - * Callback when connected. Sets up input handlers. - * - * @param data A PurpleConnection pointer. - * @param source File descriptor. - * @param error_message - */ -static void -msim_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc; - MsimSession *session; - - g_return_if_fail(data != NULL); - - gc = (PurpleConnection *)data; - session = (MsimSession *)gc->proto_data; - - if (source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - session->fd = source; - - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, msim_input_cb, gc); -} - -/** - * Start logging in to the MSIM servers. - * - * @param acct Account information to use to login. - */ -static void -msim_login(PurpleAccount *acct) -{ - PurpleConnection *gc; - const gchar *host; - int port; - - g_return_if_fail(acct != NULL); - g_return_if_fail(acct->username != NULL); - - purple_debug_info("msim", "logging in %s\n", acct->username); - - gc = purple_account_get_connection(acct); - gc->proto_data = msim_session_new(acct); - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC; - - /* - * Lets wipe out our local list of blocked buddies. We'll get a - * list of all blocked buddies from the server, and we shouldn't - * have stuff in the local list that isn't on the server list. - */ - while (acct->deny != NULL) - purple_privacy_deny_remove(acct, acct->deny->data, TRUE); - - /* 1. connect to server */ - purple_connection_update_progress(gc, _("Connecting"), - 0, /* which connection step this is */ - 4); /* total number of steps */ - - host = purple_account_get_string(acct, "server", MSIM_SERVER); - port = purple_account_get_int(acct, "port", MSIM_PORT); - - /* From purple.sf.net/api: - * """Note that this function name can be misleading--although it is called - * "proxy connect," it is used for establishing any outgoing TCP connection, - * whether through a proxy or not.""" */ - - /* Calls msim_connect_cb when connected. */ - if (!purple_proxy_connect(gc, acct, host, port, msim_connect_cb, gc)) { - /* TODO: try other ports if in auto mode, then save - * working port and try that first next time. */ - purple_connection_error_reason (gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } -} - -static void -msim_buddy_free(PurpleBuddy *buddy) -{ - msim_user_free(purple_buddy_get_protocol_data(buddy)); - purple_buddy_set_protocol_data(buddy, NULL); -} - -/** - * Close the connection. - * - * @param gc The connection. - */ -static void -msim_close(PurpleConnection *gc) -{ - GSList *buddies; - MsimSession *session; - - if (gc == NULL) { - return; - } - - /* - * Free our protocol-specific buddy data. It almost seems like libpurple - * should call our buddy_free prpl callback so that we don't need to do - * this... but it doesn't, so we do. - */ - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - while (buddies != NULL) { - msim_buddy_free(buddies->data); - buddies = g_slist_delete_link(buddies, buddies); - } - - session = (MsimSession *)gc->proto_data; - if (session == NULL) - return; - - gc->proto_data = NULL; - - if (session->gc->inpa) { - purple_input_remove(session->gc->inpa); - } - if (session->fd >= 0) { - close(session->fd); - session->fd = -1; - } - - msim_session_destroy(session); -} - -/** - * Schedule an IM to be sent once the user ID is looked up. - * - * @param gc Connection. - * @param who A user id, email, or username to send the message to. - * @param message Instant message text to send. - * @param flags Flags. - * - * @return 1 if successful or postponed, -1 if failed - * - * Allows sending to a user by username, email address, or userid. If - * a username or email address is given, the userid must be looked up. - * This function does that by calling msim_postprocess_outgoing(). - */ -static int -msim_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, - PurpleMessageFlags flags) -{ - MsimSession *session; - gchar *message_msim; - int rc; - - g_return_val_if_fail(gc != NULL, -1); - g_return_val_if_fail(who != NULL, -1); - g_return_val_if_fail(message != NULL, -1); - - /* 'flags' has many options, not used here. */ - - session = (MsimSession *)gc->proto_data; - - message_msim = html_to_msim_markup(session, message); - - if (msim_send_bm(session, who, message_msim, MSIM_BM_ACTION_OR_IM_DELAYABLE)) { - /* Return 1 to have Purple show this IM as being sent, 0 to not. I always - * return 1 even if the message could not be sent, since I don't know if - * it has failed yet--because the IM is only sent after the userid is - * retrieved from the server (which happens after this function returns). - * If an error does occur, it should be logged to the IM window. - */ - rc = 1; - } else { - rc = -1; - } - - g_free(message_msim); - - return rc; -} - -/** - * Handle when our user starts or stops typing to another user. - * - * @param gc - * @param name The buddy name to which our user is typing to - * @param state PURPLE_TYPING, PURPLE_TYPED, PURPLE_NOT_TYPING - * - * @return 0 - */ -static unsigned int -msim_send_typing(PurpleConnection *gc, const gchar *name, - PurpleTypingState state) -{ - const gchar *typing_str; - MsimSession *session; - - g_return_val_if_fail(gc != NULL, 0); - g_return_val_if_fail(name != NULL, 0); - - session = (MsimSession *)gc->proto_data; - - switch (state) { - case PURPLE_TYPING: - typing_str = "%typing%"; - break; - - case PURPLE_TYPED: - case PURPLE_NOT_TYPING: - default: - typing_str = "%stoptyping%"; - break; - } - - purple_debug_info("msim", "msim_send_typing(%s): %d (%s)\n", name, state, typing_str); - msim_send_bm(session, name, typing_str, MSIM_BM_ACTION_OR_IM_INSTANT); - return 0; -} - -/** - * Callback for msim_get_info(), for when user info is received. - */ -static void -msim_get_info_cb(MsimSession *session, const MsimMessage *user_info_msg, - gpointer data) -{ - MsimMessage *msg; - gchar *username; - PurpleNotifyUserInfo *user_info; - MsimUser *user; - - /* Get user{name,id} from msim_get_info, passed as an MsimMessage for - orthogonality. */ - msg = (MsimMessage *)data; - g_return_if_fail(msg != NULL); - - username = msim_msg_get_string(msg, "user"); - if (!username) { - purple_debug_info("msim", "msim_get_info_cb: no 'user' in msg\n"); - return; - } - - msim_msg_free(msg); - purple_debug_info("msim", "msim_get_info_cb: got for user: %s\n", username); - - user = msim_find_user(session, username); - - if (!user) { - /* User isn't on blist, create a temporary user to store info. */ - user = g_new0(MsimUser, 1); - user->temporary_user = TRUE; - } - - /* Update user structure with new information */ - msim_store_user_info(session, user_info_msg, user); - - user_info = purple_notify_user_info_new(); - - /* Append data from MsimUser to PurpleNotifyUserInfo for display, full */ - msim_append_user_info(session, user_info, user, TRUE); - - purple_notify_userinfo(session->gc, username, user_info, NULL, NULL); - purple_debug_info("msim", "msim_get_info_cb: username=%s\n", username); - - purple_notify_user_info_destroy(user_info); - - if (user->temporary_user) - msim_user_free(user); - g_free(username); -} - -/** - * Retrieve a user's profile. - * @param username Username, user ID, or email address to lookup. - */ -static void -msim_get_info(PurpleConnection *gc, const gchar *username) -{ - MsimSession *session; - MsimUser *user; - gchar *user_to_lookup; - MsimMessage *user_msg; - - g_return_if_fail(gc != NULL); - g_return_if_fail(username != NULL); - - session = (MsimSession *)gc->proto_data; - - /* Obtain uid of buddy. */ - user = msim_find_user(session, username); - - /* If is on buddy list, lookup by uid since it is faster. */ - if (user && user->id) { - user_to_lookup = g_strdup_printf("%d", user->id); - } else { - /* Looking up buddy not on blist. Lookup by whatever user entered. */ - user_to_lookup = g_strdup(username); - } - - /* Pass the username to msim_get_info_cb(), because since we lookup - * by userid, the userinfo message will only contain the uid (not - * the username) but it would be useful to display the username too. - */ - user_msg = msim_msg_new( - "user", MSIM_TYPE_STRING, g_strdup(username), - NULL); - purple_debug_info("msim", "msim_get_info, setting up lookup, user=%s\n", username); - - msim_lookup_user(session, user_to_lookup, msim_get_info_cb, user_msg); - - g_free(user_to_lookup); -} - -/** - * Set status using an MSIM_STATUS_CODE_* value. - * @param status_code An MSIM_STATUS_CODE_* value. - * @param statstring Status string, must be a dynamic string (will be freed by msim_send). - */ -static void -msim_set_status_code(MsimSession *session, guint status_code, gchar *statstring) -{ - g_return_if_fail(statstring != NULL); - - purple_debug_info("msim", "msim_set_status_code: going to set status to code=%d,str=%s\n", - status_code, statstring); - - if (!msim_send(session, - "status", MSIM_TYPE_INTEGER, status_code, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "statstring", MSIM_TYPE_STRING, statstring, - "locstring", MSIM_TYPE_STRING, g_strdup(""), - NULL)) - { - purple_debug_info("msim", "msim_set_status: failed to set status\n"); - } -} - -/** - * Set your status - callback for when user manually sets it. - */ -static void -msim_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleStatusType *type; - PurplePresence *pres; - MsimSession *session; - guint status_code; - const gchar *message; - gchar *stripped; - gchar *unrecognized_msg; - - session = (MsimSession *)account->gc->proto_data; - - type = purple_status_get_type(status); - pres = purple_status_get_presence(status); - - switch (purple_status_type_get_primitive(type)) { - case PURPLE_STATUS_AVAILABLE: - purple_debug_info("msim", "msim_set_status: available (%d->%d)\n", PURPLE_STATUS_AVAILABLE, - MSIM_STATUS_CODE_ONLINE); - status_code = MSIM_STATUS_CODE_ONLINE; - break; - - case PURPLE_STATUS_INVISIBLE: - purple_debug_info("msim", "msim_set_status: invisible (%d->%d)\n", PURPLE_STATUS_INVISIBLE, - MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN); - status_code = MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN; - break; - - case PURPLE_STATUS_AWAY: - purple_debug_info("msim", "msim_set_status: away (%d->%d)\n", PURPLE_STATUS_AWAY, - MSIM_STATUS_CODE_AWAY); - status_code = MSIM_STATUS_CODE_AWAY; - break; - - default: - purple_debug_info("msim", "msim_set_status: unknown " - "status interpreting as online"); - status_code = MSIM_STATUS_CODE_ONLINE; - - unrecognized_msg = g_strdup_printf("msim_set_status, unrecognized status type: %d\n", - purple_status_type_get_primitive(type)); - msim_unrecognized(session, NULL, unrecognized_msg); - g_free(unrecognized_msg); - - break; - } - - message = purple_status_get_attr_string(status, "message"); - - /* Status strings are plain text. */ - if (message != NULL) - stripped = purple_markup_strip_html(message); - else - stripped = g_strdup(""); - - msim_set_status_code(session, status_code, stripped); - - /* If we should be idle, set that status. Time is irrelevant here. */ - if (purple_presence_is_idle(pres) && status_code != MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN) - msim_set_idle(account->gc, 1); -} - -/** - * Go idle. - */ -static void -msim_set_idle(PurpleConnection *gc, int time) -{ - MsimSession *session; - PurpleStatus *status; - - g_return_if_fail(gc != NULL); - - session = (MsimSession *)gc->proto_data; - - status = purple_account_get_active_status(session->account); - - if (time == 0) { - /* Going back from idle. In msim, idle is mutually exclusive - * from the other states (you can only be away or idle, but not - * both, for example), so by going non-idle I go back to what - * libpurple says I should be. - */ - msim_set_status(session->account, status); - } else { - const gchar *message; - gchar *stripped; - - /* Set the idle message to the status message from the real - * current status. - */ - message = purple_status_get_attr_string(status, "message"); - if (message != NULL) - stripped = purple_markup_strip_html(message); - else - stripped = g_strdup(""); - - /* msim doesn't support idle time, so just go idle */ - msim_set_status_code(session, MSIM_STATUS_CODE_IDLE, stripped); - } -} - -/** - * @return TRUE if everything was ok, FALSE if something went awry. - */ -static gboolean -msim_update_blocklist_for_buddy(MsimSession *session, const char *name, gboolean allow, gboolean block) -{ - MsimMessage *msg; - GList *list; - - list = NULL; - list = g_list_prepend(list, allow ? "a+" : "a-"); - list = g_list_prepend(list, ""); - list = g_list_prepend(list, block ? "b+" : "b-"); - list = g_list_prepend(list, ""); - list = g_list_reverse(list); - - msg = msim_msg_new( - "blocklist", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* TODO: MsimMessage lists. Currently isn't replaced in lists. */ - /* "idlist", MSIM_TYPE_STRING, g_strdup("a-||b-|"), */ - "idlist", MSIM_TYPE_LIST, list, - NULL); - - if (!msim_postprocess_outgoing(session, msg, name, "idlist", NULL)) { - purple_debug_error("myspace", - "blocklist command failed for %s, allow=%d, block=%d\n", - name, allow, block); - msim_msg_free(msg); - return FALSE; - } - - msim_msg_free(msg); - - return TRUE; -} - -/** - * Add a buddy to user's buddy list. - */ -static void -msim_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsimSession *session; - MsimMessage *msg; - MsimMessage *msg_persist; - MsimMessage *body; - const char *name, *gname; - - session = (MsimSession *)gc->proto_data; - name = purple_buddy_get_name(buddy); - gname = group ? purple_group_get_name(group) : NULL; - - if (msim_get_user_from_buddy(buddy, FALSE) != NULL) - return; - - purple_debug_info("msim", "msim_add_buddy: want to add %s to %s\n", - name, gname ? gname : "(no group)"); - - msg = msim_msg_new( - "addbuddy", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* "newprofileid" will be inserted here with uid. */ - "reason", MSIM_TYPE_STRING, g_strdup(""), - NULL); - - if (!msim_postprocess_outgoing(session, msg, name, "newprofileid", "reason")) { - purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("'addbuddy' command failed.")); - msim_msg_free(msg); - return; - } - msim_msg_free(msg); - - /* TODO: if addbuddy fails ('error' message is returned), delete added buddy from - * buddy list since Purple adds it locally. */ - - body = msim_msg_new( - "ContactID", MSIM_TYPE_STRING, g_strdup(""), - "GroupName", MSIM_TYPE_STRING, g_strdup(gname), - "Position", MSIM_TYPE_INTEGER, 1000, - "Visibility", MSIM_TYPE_INTEGER, 1, - "NickName", MSIM_TYPE_STRING, g_strdup(""), - "NameSelect", MSIM_TYPE_INTEGER, 0, - NULL); - - /* TODO: Update blocklist. */ - - msg_persist = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, - /* TODO: Use msim_new_reply_callback to get rid. */ - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - - if (!msim_postprocess_outgoing(session, msg_persist, name, "body", NULL)) - { - purple_notify_error(NULL, NULL, _("Failed to add buddy"), _("persist command failed")); - msim_msg_free(msg_persist); - return; - } - msim_msg_free(msg_persist); - - /* Add to allow list, remove from block list */ - msim_update_blocklist_for_buddy(session, name, TRUE, FALSE); -} - -/** - * Remove a buddy from the user's buddy list. - */ -static void -msim_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - MsimSession *session; - MsimMessage *delbuddy_msg; - MsimMessage *persist_msg; - const char *name; - - session = (MsimSession *)gc->proto_data; - name = purple_buddy_get_name(buddy); - - delbuddy_msg = msim_msg_new( - "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* 'delprofileid' with uid will be inserted here. */ - NULL); - - if (!msim_postprocess_outgoing(session, delbuddy_msg, name, "delprofileid", NULL)) { - purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("'delbuddy' command failed")); - msim_msg_free(delbuddy_msg); - return; - } - msim_msg_free(delbuddy_msg); - - persist_msg = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_DELETE, - "dsn", MSIM_TYPE_INTEGER, MD_DELETE_BUDDY_DSN, - "lid", MSIM_TYPE_INTEGER, MD_DELETE_BUDDY_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - /* will be replaced by postprocessing */ - "body", MSIM_TYPE_STRING, g_strdup("ContactID="), - NULL); - - if (!msim_postprocess_outgoing(session, persist_msg, name, "body", NULL)) { - purple_notify_error(NULL, NULL, _("Failed to remove buddy"), _("persist command failed")); - msim_msg_free(persist_msg); - return; - } - msim_msg_free(persist_msg); - - /* - * Remove from our approve list and from our block list (this - * doesn't seem like it would be necessary, but the official client - * does it) - */ - if (!msim_update_blocklist_for_buddy(session, name, FALSE, FALSE)) { - purple_notify_error(NULL, NULL, - _("Failed to remove buddy"), _("blocklist command failed")); - return; - } - msim_buddy_free(buddy); -} - -/** - * Remove a buddy from the user's buddy list and add them to the block list. - */ -static void -msim_add_deny(PurpleConnection *gc, const char *name) -{ - MsimSession *session; - MsimMessage *msg, *body; - - session = (MsimSession *)gc->proto_data; - - /* Remove from buddy list */ - msg = msim_msg_new( - "delbuddy", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - /* 'delprofileid' with uid will be inserted here. */ - NULL); - if (!msim_postprocess_outgoing(session, msg, name, "delprofileid", NULL)) - purple_debug_error("myspace", "delbuddy command failed\n"); - msim_msg_free(msg); - - /* Remove from our approve list and add to our block list */ - msim_update_blocklist_for_buddy(session, name, FALSE, TRUE); - - /* - * Add the buddy to our list of blocked contacts, so we know they - * are blocked if we log in with another client - */ - body = msim_msg_new( - "ContactID", MSIM_TYPE_STRING, g_strdup(""), - "Visibility", MSIM_TYPE_INTEGER, 2, - NULL); - msg = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MC_CONTACT_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - if (!msim_postprocess_outgoing(session, msg, name, "body", NULL)) - purple_debug_error("myspace", "add to block list command failed\n"); - msim_msg_free(msg); - - /* - * TODO: MySpace doesn't allow blocked buddies on our buddy list, - * do they? If not then we need to remove the buddy from - * libpurple's buddy list. - */ -} - -/** - * Remove a buddy from the user's block list. - */ -static void -msim_rem_deny(PurpleConnection *gc, const char *name) -{ - MsimSession *session; - MsimMessage *msg, *body; - - session = (MsimSession *)gc->proto_data; - - /* - * Remove from our list of blocked contacts, so we know they - * are no longer blocked if we log in with another client - */ - body = msim_msg_new( - "ContactID", MSIM_TYPE_STRING, g_strdup(""), - NULL); - msg = msim_msg_new( - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_BIT_ACTION | MSIM_CMD_DELETE, - "dsn", MSIM_TYPE_INTEGER, MC_DELETE_CONTACT_INFO_DSN, - "lid", MSIM_TYPE_INTEGER, MC_DELETE_CONTACT_INFO_LID, - "rid", MSIM_TYPE_INTEGER, session->next_rid++, - "body", MSIM_TYPE_DICTIONARY, body, - NULL); - if (!msim_postprocess_outgoing(session, msg, name, "body", NULL)) - purple_debug_error("myspace", "remove from block list command failed\n"); - msim_msg_free(msg); - - /* Remove from our approve list and our block list */ - msim_update_blocklist_for_buddy(session, name, FALSE, FALSE); -} - -/** - * Returns a string of a username in canonical form. Basically removes all the - * spaces, lowercases the string, and looks up user IDs to usernames. - * Normalizing tom, TOM, Tom, and 6221 wil all return 'tom'. - * - * Borrowed this code from oscar_normalize. Added checking for - * "if userid, get name before normalizing" - */ -static const char *msim_normalize(const PurpleAccount *account, const char *str) { - static char normalized[BUF_LEN]; - char *tmp1, *tmp2; - int i, j; - guint id; - - g_return_val_if_fail(str != NULL, NULL); - - if (msim_is_userid(str)) { - /* Have user ID, we need to get their username first :) */ - const char *username; - - /* If the account does not exist, we can't look up the user. */ - if (!account || !account->gc) - return str; - - id = atol(str); - username = msim_uid2username_from_blist((PurpleAccount *)account, id); - if (!username) { - /* Not in buddy list... scheisse... TODO: Manual Lookup! Bug #4631 */ - /* Note: manual lookup using msim_lookup_user() is a problem inside - * msim_normalize(), because msim_lookup_user() calls a callback function - * when the user information has been looked up, but msim_normalize() expects - * the result immediately. */ - strncpy(normalized, str, BUF_LEN); - } else { - strncpy(normalized, username, BUF_LEN); - } - } else { - /* Have username. */ - strncpy(normalized, str, BUF_LEN); - } - - /* Strip spaces. */ - for (i=0, j=0; normalized[j]; j++) { - if (normalized[j] != ' ') - normalized[i++] = normalized[j]; - } - normalized[i] = '\0'; - - /* Lowercase and perform UTF-8 normalization. */ - tmp1 = g_utf8_strdown(normalized, -1); - tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT); - g_snprintf(normalized, sizeof(normalized), "%s", tmp2); - g_free(tmp2); - g_free(tmp1); - - /* TODO: re-add caps and spacing back to what the user wanted. - * User can format their own names, for example 'msimprpl' is shown - * as 'MsIm PrPl' in the official client. - * - * TODO: file a ticket to add this enhancement. - */ - - return normalized; -} - -/** - * Return whether the buddy can be messaged while offline. - * - * The protocol supports offline messages in just the same way as online - * messages. - */ -static gboolean -msim_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -/** - * Send raw data to the server, possibly with embedded NULs. - * - * Used in prpl_info struct, so that plugins can have the most possible - * control of what is sent over the connection. Inside this prpl, - * msim_send_raw() is used, since it sends NUL-terminated strings (easier). - * - * @param gc PurpleConnection - * @param buf Buffer to send - * @param total_bytes Size of buffer to send - * - * @return Bytes successfully sent, or -1 on error. - */ -/* - * TODO: This needs to do non-blocking writes and use a watcher to check - * when the fd is available to be written to. - */ -static int -msim_send_really_raw(PurpleConnection *gc, const char *buf, int total_bytes) -{ - int total_bytes_sent; - MsimSession *session; - - g_return_val_if_fail(gc != NULL, -1); - g_return_val_if_fail(buf != NULL, -1); - g_return_val_if_fail(total_bytes >= 0, -1); - - session = (MsimSession *)gc->proto_data; - - /* Loop until all data is sent, or a failure occurs. */ - total_bytes_sent = 0; - do { - int bytes_sent; - - bytes_sent = send(session->fd, buf + total_bytes_sent, - total_bytes - total_bytes_sent, 0); - - if (bytes_sent < 0) { - purple_debug_info("msim", "msim_send_raw(%s): send() failed: %s\n", - buf, g_strerror(errno)); - return total_bytes_sent; - } - total_bytes_sent += bytes_sent; - - } while(total_bytes_sent < total_bytes); - - return total_bytes_sent; -} - -/** - * Send raw data (given as a NUL-terminated string) to the server. - * - * @param session - * @param msg The raw data to send, in a NUL-terminated string. - * - * @return TRUE if succeeded, FALSE if not. - * - */ -gboolean -msim_send_raw(MsimSession *session, const gchar *msg) -{ - size_t len; - - g_return_val_if_fail(msg != NULL, FALSE); - - purple_debug_info("msim", "msim_send_raw: writing <%s>\n", msg); - len = strlen(msg); - - return msim_send_really_raw(session->gc, msg, len) == len; -} - -static GHashTable * -msim_get_account_text_table(PurpleAccount *unused) -{ - GHashTable *table; - - table = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_insert(table, "login_label", (gpointer)_("Email Address...")); - - return table; -} - -/** - * Callbacks called by Purple, to access this plugin. - */ -static PurplePluginProtocolInfo prpl_info = { - /* options */ - OPT_PROTO_USE_POINTSIZE /* specify font size in sane point size */ - | OPT_PROTO_MAIL_CHECK, - - /* | OPT_PROTO_IM_IMAGE - TODO: direct images. */ - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec - TODO: eventually should add this */ - msim_list_icon, /* list_icon */ - NULL, /* list_emblems */ - msim_status_text, /* status_text */ - msim_tooltip_text, /* tooltip_text */ - msim_status_types, /* status_types */ - msim_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - msim_login, /* login */ - msim_close, /* close */ - msim_send_im, /* send_im */ - NULL, /* set_info */ - msim_send_typing, /* send_typing */ - msim_get_info, /* get_info */ - msim_set_status, /* set_status */ - msim_set_idle, /* set_idle */ - NULL, /* change_passwd */ - msim_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - msim_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - msim_add_deny, /* add_deny */ - NULL, /* rem_permit */ - msim_rem_deny, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - msim_buddy_free, /* buddy_free */ - NULL, /* convo_closed */ - msim_normalize, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - msim_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - msim_send_really_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - msim_send_attention, /* send_attention */ - msim_attention_types, /* attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - msim_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -/** - * Load the plugin. - */ -static gboolean -msim_load(PurplePlugin *plugin) -{ - /* If compiled to use RC4 from libpurple, check if it is really there. */ - if (!purple_ciphers_find_cipher("rc4")) { - purple_debug_error("msim", "rc4 not in libpurple, but it is required - not loading MySpaceIM plugin!\n"); - purple_notify_error(plugin, _("Missing Cipher"), - _("The RC4 cipher could not be found"), - _("Upgrade " - "to a libpurple with RC4 support (>= 2.0.1). MySpaceIM " - "plugin will not be loaded.")); - return FALSE; - } - return TRUE; -} - -/** - * Called when friends have been imported to buddy list on server. - */ -static void -msim_import_friends_cb(MsimSession *session, const MsimMessage *reply, gpointer user_data) -{ - MsimMessage *body; - gchar *completed; - - /* Check if the friends were imported successfully. */ - body = msim_msg_get_dictionary(reply, "body"); - g_return_if_fail(body != NULL); - completed = msim_msg_get_string(body, "Completed"); - msim_msg_free(body); - g_return_if_fail(completed != NULL); - if (!g_str_equal(completed, "True")) - { - purple_debug_info("msim_import_friends_cb", - "failed to import friends: %s", completed); - purple_notify_error(session->account, _("Add friends from MySpace.com"), - _("Importing friends failed"), NULL); - g_free(completed); - return; - } - g_free(completed); - - purple_debug_info("msim_import_friends_cb", - "added friends to server-side buddy list, requesting new contacts from server"); - - msim_get_contact_list(session, MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS); - - /* TODO: show, X friends have been added */ -} - -/** - * Import friends from myspace.com. - */ -static void msim_import_friends(PurplePluginAction *action) -{ - PurpleConnection *gc; - MsimSession *session; - gchar *group_name; - - gc = (PurpleConnection *)action->context; - session = (MsimSession *)gc->proto_data; - - group_name = "MySpace Friends"; - - g_return_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_IMPORT_ALL_FRIENDS_DSN, - "lid", MSIM_TYPE_INTEGER, MC_IMPORT_ALL_FRIENDS_LID, - "uid", MSIM_TYPE_INTEGER, session->userid, - "rid", MSIM_TYPE_INTEGER, - msim_new_reply_callback(session, msim_import_friends_cb, NULL), - "body", MSIM_TYPE_STRING, - g_strdup_printf("GroupName=%s", group_name), - NULL)); -} - -/** - * Actions menu for account. - */ -static GList * -msim_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc; - GList *menu; - PurplePluginAction *act; - - gc = (PurpleConnection *)context; - - menu = NULL; - -#if 0 - /* TODO: find out how */ - act = purple_plugin_action_new(_("Find people..."), msim_); - menu = g_list_append(menu, act); - - act = purple_plugin_action_new(_("Change IM name..."), NULL); - menu = g_list_append(menu, act); -#endif - - act = purple_plugin_action_new(_("Add friends from MySpace.com"), msim_import_friends); - menu = g_list_append(menu, act); - - return menu; -} - -/** - * Based on MSN's plugin info comments. - */ -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-myspace", /**< id */ - "MySpaceIM", /**< name */ - MSIM_PRPL_VERSION_STRING, /**< version */ - /** summary */ - "MySpaceIM Protocol Plugin", - /** description */ - "MySpaceIM Protocol Plugin", - "Jeff Connelly ", /**< author */ - "http://developer.pidgin.im/wiki/MySpaceIM/", /**< homepage */ - - msim_load, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - msim_actions, /**< msim_actions */ - NULL, /**< reserved1 */ - NULL, /**< reserved2 */ - NULL, /**< reserved3 */ - NULL /**< reserved4 */ -}; - -#ifdef MSIM_SELF_TEST -/* - * Test functions. - * Used to test or try out the internal workings of msimprpl. If you're reading - * this code for the first time, these functions can be instructive in learning - * how msimprpl is architected. - */ - -/** - * Test MsimMessage for basic functionality. - */ -static int -msim_test_msg(void) -{ - MsimMessage *msg, *msg_cloned, *msg2; - GList *list; - gchar *packed, *packed_expected, *packed_cloned; - guint failures; - - failures = 0; - - purple_debug_info("msim", "\n\nTesting MsimMessage\n"); - msg = msim_msg_new(NULL); /* Create a new, empty message. */ - - /* Append some new elements. */ - msg = msim_msg_append(msg, "bx", MSIM_TYPE_BINARY, g_string_new_len("XXX", 3)); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v1")); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(42)); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v43")); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v52/xxx\\yyy")); - msg = msim_msg_append(msg, "k1", MSIM_TYPE_STRING, g_strdup("v7")); - msim_msg_dump("msg debug str=%s\n", msg); - packed = msim_msg_pack(msg); - - purple_debug_info("msim", "msg packed=%s\n", packed); - - packed_expected = "\\bx\\WFhY\\k1\\v1\\k1\\42\\k1" - "\\v43\\k1\\v52/1xxx/2yyy\\k1\\v7\\final\\"; - - if (!g_str_equal(packed, packed_expected)) { - purple_debug_info("msim", "!!!(%d), msim_msg_pack not what expected: %s != %s\n", - ++failures, packed, packed_expected); - } - - - msg_cloned = msim_msg_clone(msg); - packed_cloned = msim_msg_pack(msg_cloned); - - purple_debug_info("msim", "msg cloned=%s\n", packed_cloned); - if (!g_str_equal(packed, packed_cloned)) { - purple_debug_info("msim", "!!!(%d), msim_msg_pack on cloned message not equal to original: %s != %s\n", - ++failures, packed_cloned, packed); - } - - g_free(packed); - g_free(packed_cloned); - msim_msg_free(msg_cloned); - msim_msg_free(msg); - - /* Try some of the more advanced functionality */ - list = NULL; - - list = g_list_prepend(list, "item3"); - list = g_list_prepend(list, "item2"); - list = g_list_prepend(list, "item1"); - list = g_list_prepend(list, "item0"); - - msg = msim_msg_new(NULL); - msg = msim_msg_append(msg, "string", MSIM_TYPE_STRING, g_strdup("string value")); - msg = msim_msg_append(msg, "raw", MSIM_TYPE_RAW, g_strdup("raw value")); - msg = msim_msg_append(msg, "integer", MSIM_TYPE_INTEGER, GUINT_TO_POINTER(3140)); - msg = msim_msg_append(msg, "boolean", MSIM_TYPE_BOOLEAN, GUINT_TO_POINTER(FALSE)); - msg = msim_msg_append(msg, "list", MSIM_TYPE_LIST, list); - - msim_msg_dump("msg with list=%s\n", msg); - purple_debug_info("msim", "msg with list packed=%s\n", msim_msg_pack(msg)); - - msg2 = msim_msg_new(NULL); - msg2 = msim_msg_append(msg2, "outer", MSIM_TYPE_STRING, g_strdup("outer value")); - msg2 = msim_msg_append(msg2, "body", MSIM_TYPE_DICTIONARY, msg); - msim_msg_dump("msg with dict=%s\n", msg2); /* msg2 now 'owns' msg */ - purple_debug_info("msim", "msg with dict packed=%s\n", msim_msg_pack(msg2)); - - msim_msg_free(msg2); - - return failures; -} - -/** - * Test protocol-level escaping/unescaping. - */ -static int -msim_test_escaping(void) -{ - guint failures; - gchar *raw, *escaped, *unescaped, *expected; - - failures = 0; - - purple_debug_info("msim", "\n\nTesting escaping\n"); - - raw = "hello/world\\hello/world"; - - escaped = msim_escape(raw); - purple_debug_info("msim", "msim_test_escaping: raw=%s, escaped=%s\n", raw, escaped); - expected = "hello/1world/2hello/1world"; - if (!g_str_equal(escaped, expected)) { - purple_debug_info("msim", "!!!(%d), msim_escape failed: %s != %s\n", - ++failures, escaped, expected); - } - - - unescaped = msim_unescape(escaped); - g_free(escaped); - purple_debug_info("msim", "msim_test_escaping: unescaped=%s\n", unescaped); - if (!g_str_equal(raw, unescaped)) { - purple_debug_info("msim", "!!!(%d), msim_unescape failed: %s != %s\n", - ++failures, raw, unescaped); - } - - return failures; -} - -static void -msim_test_all(void) -{ - guint failures; - - failures = 0; - failures += msim_test_msg(); - failures += msim_test_escaping(); - - if (failures) { - purple_debug_info("msim", "msim_test_all HAD FAILURES: %d\n", failures); - } else { - purple_debug_info("msim", "msim_test_all - all tests passed!\n"); - } - exit(0); -} -#endif - -#ifdef MSIM_CHECK_NEWER_VERSION -/** - * Callback for when a currentversion.txt has been downloaded. - */ -static void -msim_check_newer_version_cb(PurpleUtilFetchUrlData *url_data, - gpointer user_data, - const gchar *url_text, - gsize len, - const gchar *error_message) -{ - GKeyFile *keyfile; - GError *error; - GString *data; - gchar *newest_filever; - - if (!url_text) { - purple_debug_info("msim_check_newer_version_cb", - "got error: %s\n", error_message); - return; - } - - purple_debug_info("msim_check_newer_version_cb", - "url_text=%s\n", url_text ? url_text : "(NULL)"); - - /* Prepend [group] so that GKeyFile can parse it (requires a group). */ - data = g_string_new(url_text); - purple_debug_info("msim", "data=%s\n", data->str - ? data->str : "(NULL)"); - data = g_string_prepend(data, "[group]\n"); - - purple_debug_info("msim", "data=%s\n", data->str - ? data->str : "(NULL)"); - - /* url_text is variable=data\n...†*/ - - /* Check FILEVER, 1.0.716.0. 716 is build, MSIM_CLIENT_VERSION */ - /* New (english) version can be downloaded from SETUPURL+SETUPFILE */ - - error = NULL; - keyfile = g_key_file_new(); - - /* Default list seperator is ;, but currentversion.txt doesn't have - * these, so set to an unused character to avoid parsing problems. */ - g_key_file_set_list_separator(keyfile, '\0'); - - g_key_file_load_from_data(keyfile, data->str, data->len, - G_KEY_FILE_NONE, &error); - g_string_free(data, TRUE); - - if (error != NULL) { - purple_debug_info("msim_check_newer_version_cb", - "couldn't parse, error: %d %d %s\n", - error->domain, error->code, error->message); - g_error_free(error); - return; - } - - gchar **ks; - guint n; - ks = g_key_file_get_keys(keyfile, "group", &n, NULL); - purple_debug_info("msim", "n=%d\n", n); - guint i; - for (i = 0; ks[i] != NULL; ++i) - { - purple_debug_info("msim", "%d=%s\n", i, ks[i]); - } - - newest_filever = g_key_file_get_string(keyfile, "group", - "FILEVER", &error); - - purple_debug_info("msim_check_newer_version_cb", - "newest filever: %s\n", newest_filever ? - newest_filever : "(NULL)"); - if (error != NULL) { - purple_debug_info("msim_check_newer_version_cb", - "error: %d %d %s\n", - error->domain, error->code, error->message); - g_error_free(error); - } - - g_key_file_free(keyfile); - - exit(0); -} -#endif - -/** - Handle a myim:addContact command, after username has been looked up. - */ -static void -msim_uri_handler_addContact_cb(MsimSession *session, MsimMessage *userinfo, gpointer data) -{ - MsimMessage *body; - gchar *username; - - body = msim_msg_get_dictionary(userinfo, "body"); - username = msim_msg_get_string(body, "UserName"); - msim_msg_free(body); - - if (!username) { - guint uid; - - uid = msim_msg_get_integer(userinfo, "UserID"); - g_return_if_fail(uid != 0); - - username = g_strdup_printf("%d", uid); - } - - purple_blist_request_add_buddy(session->account, username, _("Buddies"), NULL); - - g_free(username); -} - -/* TODO: move uid->username resolving to IM sending and buddy adding functions, - * so that user can manually add or IM by userid and username automatically - * looked up if possible? */ - -/** - * Handle a myim:sendIM URI command, after username has been looked up. - */ -static void -msim_uri_handler_sendIM_cb(MsimSession *session, MsimMessage *userinfo, gpointer data) -{ - PurpleConversation *conv; - MsimMessage *body; - gchar *username; - - body = msim_msg_get_dictionary(userinfo, "body"); - username = msim_msg_get_string(body, "UserName"); - msim_msg_free(body); - - if (!username) { - guint uid; - - uid = msim_msg_get_integer(userinfo, "UserID"); - g_return_if_fail(uid != 0); - - username = g_strdup_printf("%d", uid); - } - - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, username, session->account); - if (!conv) { - purple_debug_info("msim_uri_handler", "creating new conversation for %s\n", username); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, session->account, username); - } - - /* Just open the window so the user can send an IM. */ - purple_conversation_present(conv); - - g_free(username); -} - -static gboolean -msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params) -{ - PurpleAccount *account; - MsimSession *session; - GList *l; - gchar *uid_str, *cid_str; - guint uid, cid; - - if (g_ascii_strcasecmp(proto, "myim")) - return FALSE; - - /* Parameters are case-insensitive. */ - uid_str = g_hash_table_lookup(params, "uid"); - cid_str = g_hash_table_lookup(params, "cid"); - - uid = uid_str ? atol(uid_str) : 0; - cid = cid_str ? atol(cid_str) : 0; - - /* Need a contact. */ - g_return_val_if_fail(cid != 0, FALSE); - - /* TODO: if auto=true, "Add all the people on this page to my IM List!", on - * http://collect.myspace.com/index.cfm?fuseaction=im.friendslist. Don't need a cid. */ - - /* Convert numeric contact ID back to a string. Needed for looking up. Don't just - * directly use cid directly from parameters, because it might not be numeric. - * It is trivial to change this to allow cID to be a username, but that's not how - * the official MySpaceIM client works, so don't provide that functionality. */ - cid_str = g_strdup_printf("%d", cid); - - - /* Find our account with specified user id, or use first connected account if uid=0. */ - account = NULL; - l = purple_accounts_get_all(); - while (l) { - if (purple_account_is_connected(l->data) && - (uid == 0 || purple_account_get_int(l->data, "uid", 0) == uid)) { - account = l->data; - break; - } - l = l->next; - } - - if (!account) { - purple_notify_error(NULL, _("myim URL handler"), - _("No suitable MySpaceIM account could be found to open this myim URL."), - _("Enable the proper MySpaceIM account and try again.")); - g_free(cid_str); - return FALSE; - } - - session = (MsimSession *)account->gc->proto_data; - g_return_val_if_fail(session != NULL, FALSE); - - /* Lookup userid to username. TODO: push this down, to IM sending/contact - * adding functions. */ - - /* myim:sendIM?uID=USERID&cID=CONTACTID */ - if (!g_ascii_strcasecmp(cmd, "sendIM")) { - msim_lookup_user(session, cid_str, (MSIM_USER_LOOKUP_CB)msim_uri_handler_sendIM_cb, NULL); - g_free(cid_str); - return TRUE; - - /* myim:addContact?uID=USERID&cID=CONTACTID */ - } else if (!g_ascii_strcasecmp(cmd, "addContact")) { - msim_lookup_user(session, cid_str, (MSIM_USER_LOOKUP_CB)msim_uri_handler_addContact_cb, NULL); - g_free(cid_str); - return TRUE; - } - - return FALSE; -} - -/** - * Initialize plugin. - */ -static void -init_plugin(PurplePlugin *plugin) -{ -#ifdef MSIM_SELF_TEST - msim_test_all(); - exit(0); -#endif /* MSIM_SELF_TEST */ - - PurpleAccountOption *option; - static gboolean initialized = FALSE; - -#ifdef MSIM_CHECK_NEWER_VERSION - /* PROBLEM: MySpace's servers always return Content-Location, and - * libpurple redirects to it, infinitely, even though it is the same - * location we requested! */ - purple_util_fetch_url("http://im.myspace.com/nsis/currentversion.txt", - FALSE, /* not full URL */ - "MSIMAutoUpdateAgent", /* user agent */ - TRUE, /* use HTTP/1.1 */ - msim_check_newer_version_cb, NULL); -#endif - - /* TODO: default to automatically try different ports. Make the user be - * able to set the first port to try (like LastConnectedPort in Windows client). */ - option = purple_account_option_string_new(_("Connect server"), "server", MSIM_SERVER); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Connect port"), "port", MSIM_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - -#ifdef MSIM_USER_WANTS_TO_CONFIGURE_STATUS_TEXT - option = purple_account_option_bool_new(_("Show display name in status text"), "show_display_name", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show headline in status text"), "show_headline", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - -#ifdef MSIM_USER_WANTS_TO_DISABLE_EMOTICONS - option = purple_account_option_bool_new(_("Send emoticons"), "emoticons", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - -#ifdef MSIM_USER_REALLY_CARES_ABOUT_PRECISE_FONT_SIZES - option = purple_account_option_int_new(_("Screen resolution (dots per inch)"), "dpi", MSIM_DEFAULT_DPI); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Base font size (points)"), "base_font_size", MSIM_BASE_FONT_POINT_SIZE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - /* Code below only runs once. Based on oscar.c's oscar_init(). */ - if (initialized) - return; - - initialized = TRUE; - - purple_signal_connect(purple_get_core(), "uri-handler", &initialized, - PURPLE_CALLBACK(msim_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(myspace, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/myspace.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -/* MySpaceIM Protocol Plugin, header file - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_MYSPACE_H -#define _MYSPACE_MYSPACE_H - -#include "internal.h" - -/* Other includes */ -#include -#include /* for EAGAIN */ -#include -#include - -#include - -#ifdef _WIN32 -#include "win32dep.h" -#else -/* For recv() and send(); needed to match Win32 */ -#include -#include -#endif - -#include "notify.h" -#include "plugin.h" -#include "accountopt.h" -#include "version.h" -#include "cipher.h" /* for SHA-1 */ -#include "util.h" /* for base64 */ -#include "debug.h" /* for purple_debug_info */ -#include "request.h" /* For dialogs used in setting the username */ -#include "xmlnode.h" -#include "core.h" -#include "conversation.h" /* For late normalization */ - -/* MySpaceIM includes */ -#include "persist.h" -#include "message.h" -#include "session.h" -#include "zap.h" -#include "markup.h" -#include "user.h" - -/* Conditional compilation options */ -/* Send third-party client version? (Recognized by us and Miranda's plugin) */ -/*#define MSIM_SEND_CLIENT_VERSION */ - -/* Debugging options */ -/* Low-level and rarely needed */ -/*#define MSIM_DEBUG_PARSE */ -/*#define MSIM_DEBUG_LOGIN_CHALLENGE*/ -/*#define MSIM_DEBUG_RXBUF */ - -/* Encode unknown HTML tags from IM clients in messages as [tag], instead of - * ignoring. Useful for debugging */ -/*#define MSIM_MARKUP_SHOW_UNKNOWN_TAGS */ - -/* Define to cause init_plugin() to run some tests and print - * the results to the Purple debug log, then exit. Useful to - * run with 'pidgin -d' to see the output. Don't define if - * you want to actually use the plugin! */ -/*#define MSIM_SELF_TEST */ - -/* Constants */ - -/* Maximum length of a password that is acceptable. This is the limit - * on the official client (build 679) and on the 'new password' field at - * http://settings.myspace.com/index.cfm?fuseaction=user.changepassword - * (though curiously, not on the 'current password' field). */ - -/* After login fails, if password is greater than this many characters, - * warn user that it may be too long. */ -#define MSIM_MAX_PASSWORD_LENGTH 10 - -/* Maximum length of usernames, when setting. */ -#define MSIM_MAX_USERNAME_LENGTH 25 - -/* Build version of MySpaceIM to report to servers (1.0.xxx.0) */ -#define MSIM_CLIENT_VERSION 697 - -/* Check for a newer official MySpaceIM client on startup? - * (Mostly useful for developers) */ -/*#define MSIM_CHECK_NEWER_VERSION*/ - -/* Language codes from http://www.microsoft.com/globaldev/reference/oslocversion.mspx */ -#define MSIM_LANGUAGE_ID_ENGLISH 1033 -#define MSIM_LANGUAGE_NAME_ENGLISH "ENGLISH" - -/* msimprpl version string of this plugin */ -#define MSIM_PRPL_VERSION_STRING "0.18" - -/* Default server */ -#define MSIM_SERVER "im.myspace.akadns.net" -#define MSIM_PORT 1863 /* TODO: alternate ports and automatic */ - -/* Time between keepalives (seconds) - if no data within this time, is dead. */ -#define MSIM_KEEPALIVE_INTERVAL (3 * 60) -/*#define MSIM_USE_KEEPALIVE*/ - -/* Time to check if alive (seconds) */ -#define MSIM_KEEPALIVE_INTERVAL_CHECK 30 - -/* Time to check for new mail (milliseconds) */ -#define MSIM_MAIL_INTERVAL_CHECK (60 * 1000) - -/* Constants */ -#define HASH_SIZE 0x14 /**< Size of SHA-1 hash for login */ -#define NONCE_SIZE 0x20 /**< Half of decoded 'nc' field */ -#define MSIM_READ_BUF_SIZE (15 * 1024) /**< Receive buffer size */ -#define MSIM_FINAL_STRING "\\final\\" /**< Message end marker */ - -/* Messages */ -#define MSIM_BM_ACTION_OR_IM_DELAYABLE 1 -#define MSIM_BM_STATUS 100 -#define MSIM_BM_ACTION_OR_IM_INSTANT 121 -#define MSIM_BM_MEDIA 122 -#define MSIM_BM_PROFILE 124 -#define MSIM_BM_STATUS_MOOD 126 -#define MSIM_BM_UNOFFICIAL_CLIENT 200 - -/* Authentication algorithm for login2 */ -#define MSIM_AUTH_ALGORITHM 196610 - -/* Recognized challenge length */ -#define MSIM_AUTH_CHALLENGE_LENGTH 0x40 - -#ifdef SEND_OUR_IP_ADDRESSES -/* TODO: obtain IPs of network interfaces from user's machine, instead of - * hardcoding these values below (used in msim_compute_login_response). - * This is not immediately - * important because you can still connect and perform basic - * functions of the protocol. There is also a high chance that the addreses - * are RFC1918 private, so the servers couldn't do anything with them - * anyways except make note of that fact. Probably important for any - * kind of direct connection, or file transfer functionality. - */ - -#define MSIM_LOGIN_IP_LIST "\x00\x00\x00\x00\x05\x7f\x00\x00\x01\x00\x00\x00\x00\x0a\x00\x00\x40\xc0\xa8\x58\x01\xc0\xa8\x3c\x01" -#define MSIM_LOGIN_IP_LIST_LEN 25 -#endif /* SEND_OUR_IP_ADDRESSES */ - -/* Indexes into status string (0|1|2|3|..., but 0 always empty) */ -#define MSIM_STATUS_ORDINAL_EMPTY 0 -#define MSIM_STATUS_ORDINAL_UNKNOWNs 1 -#define MSIM_STATUS_ORDINAL_ONLINE 2 -#define MSIM_STATUS_ORDINAL_UNKNOWNss 3 -#define MSIM_STATUS_ORDINAL_HEADLINE 4 -#define MSIM_STATUS_ORDINAL_UNKNOWNls 5 -#define MSIM_STATUS_ORDINAL_UNKNOWN 6 -#define MSIM_STATUS_ORDINAL_UNKNOWN1 7 -#define MSIM_STATUS_ORDINAL_UNKNOWNp 8 -#define MSIM_STATUS_ORDINAL_UNKNOWN2 9 - -/* Status codes - states a buddy (or you!) can be in. */ -#define MSIM_STATUS_CODE_OFFLINE_OR_HIDDEN 0 -#define MSIM_STATUS_CODE_ONLINE 1 -#define MSIM_STATUS_CODE_IDLE 2 -#define MSIM_STATUS_CODE_AWAY 5 - -/* Inbox status bitfield values for MsimSession.inbox_status. */ -#define MSIM_INBOX_MAIL (1 << 0) -#define MSIM_INBOX_BLOG_COMMENT (1 << 1) -#define MSIM_INBOX_PROFILE_COMMENT (1 << 2) -#define MSIM_INBOX_FRIEND_REQUEST (1 << 3) -#define MSIM_INBOX_PICTURE_COMMENT (1 << 4) - -/* Codes for msim_got_contact_list(), to tell what to do afterwards. */ -#define MSIM_CONTACT_LIST_INITIAL_FRIENDS 0 -#define MSIM_CONTACT_LIST_IMPORT_ALL_FRIENDS 1 -#define MSIM_CONTACT_LIST_IMPORT_TOP_FRIENDS 2 - -/* Error codes */ -#define MSIM_ERROR_INCORRECT_PASSWORD 260 -#define MSIM_ERROR_LOGGED_IN_ELSEWHERE 6 - -/* Functions */ -gboolean msim_send_raw(MsimSession *session, const gchar *msg); - -gboolean msim_send_bm(MsimSession *session, const gchar *who, const gchar *text, int type); - -gboolean msim_we_are_logged_on(MsimSession *session); - -void msim_unrecognized(MsimSession *session, MsimMessage *msg, gchar *note); -guint msim_new_reply_callback(MsimSession *session, MSIM_USER_LOOKUP_CB cb, gpointer data); - -#endif /* !_MYSPACE_MYSPACE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/persist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/persist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/persist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/persist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/* MySpaceIM Protocol Plugin, persist commands - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_PERSIST_H -#define _MYSPACE_PERSIST_H - -/** Command codes */ -#define MSIM_CMD_GET 1 -#define MSIM_CMD_PUT 2 -#define MSIM_CMD_DELETE 3 - -/** Command bit fields */ -#define MSIM_CMD_BIT_CODE 255 /*< Bits specifying command code */ -#define MSIM_CMD_BIT_REPLY 256 /**< 1=reply, 0=request */ -#define MSIM_CMD_BIT_ACTION 512 /**< 1=action, 0=information */ -#define MSIM_CMD_BIT_ERROR 1024 /**< 1=error, 0=normal */ - -/** Macros to read cmd bitfield. */ -#define MSIM_CMD_GET_CODE(x) (x & MSIM_CMD_BIT_CODE) -#define MSIM_CMD_IS_REPLY(x) (x & MSIM_CMD_BIT_REPLY) -#define MSIM_CMD_IS_REQUEST(x) !(x & MSIM_CMD_BIT_REPLY) -#define MSIM_CMD_IS_ACTION(x) (x & MSIM_CMD_BIT_ACTION) -#define MSIM_CMD_IS_INFO(x) !(x & MSIM_CMD_BIT_ACTION) -#define MSIM_CMD_IS_ERROR(x) (x & MSIM_CMD_BIT_ERROR) -#define MSIM_CMD_IS_NORMAL(x) !(x & MSIM_CMD_BIT_ERROR) - -/** Define a set of _DSN and _LID constants for a persistance request. */ -#define MSIM_PERSIST_DSN_LID(name,dsn,lid) \ - static const int name##_DSN = dsn; \ - static const int name##_LID = lid; - -/* Can't do this, errors: - * persist.h:51:3: error: '#' is not followed by a macro parameter - * In file included from myspace.c:37: - * persist.h:56: error: expected ')' before numeric constant - * So instead, I define const ints above. -#define MSIM_PERSIST_DSN_LID(name,dsn,lid) \ - #define name##_DSN dsn \ - #define name##_LID lid -#endif -*/ - -/** Messages to Get information dsn lid */ -MSIM_PERSIST_DSN_LID(MG_LIST_ALL_CONTACTS, 0, 1) -MSIM_PERSIST_DSN_LID(MG_USER_INFO_BY_ID, 0, 2) -MSIM_PERSIST_DSN_LID(MG_OWN_IM_INFO, 1, 4) -MSIM_PERSIST_DSN_LID(MG_IM_INFO_BY_ID, 1, 17) -MSIM_PERSIST_DSN_LID(MG_LIST_ALL_GROUPS, 2, 6) -MSIM_PERSIST_DSN_LID(MG_MYSPACE_INFO_BY_ID, 4, 3) -MSIM_PERSIST_DSN_LID(MG_OWN_MYSPACE_INFO, 4, 5) -MSIM_PERSIST_DSN_LID(MG_MYSPACE_INFO_BY_STRING, 5, 7) -MSIM_PERSIST_DSN_LID(MG_CHECK_MAIL, 7, 18) -MSIM_PERSIST_DSN_LID(MG_WEB_CHALLENGE, 17, 26) -MSIM_PERSIST_DSN_LID(MG_USER_SONG, 21, 28) -MSIM_PERSIST_DSN_LID(MG_SERVER_INFO, 101, 20) - -/** Messages to Change/send information */ -MSIM_PERSIST_DSN_LID(MC_USER_PREFERENCES, 1, 10) -MSIM_PERSIST_DSN_LID(MC_DELETE_CONTACT_INFO, 0, 8) -MSIM_PERSIST_DSN_LID(MC_CONTACT_INFO, 0, 9) -MSIM_PERSIST_DSN_LID(MC_SET_USERNAME, 9, 14) -MSIM_PERSIST_DSN_LID(MC_IMPORT_ALL_FRIENDS, 14, 21) -MSIM_PERSIST_DSN_LID(MC_INVITE, 16, 25) - -/** Messages to Delete information */ -MSIM_PERSIST_DSN_LID(MD_DELETE_BUDDY, 0, 8) - -/** Error codes */ -#define MERR_PARSE 1 -#define MERR_NOT_LOGGED_IN 2 -#define MERR_ANOTHER_LOGIN 6 -#define MERR_BAD_EMAIL 259 -#define MERR_BAD_PASSWORD 260 -#define MERR_BAD_UID_IN_PERSISTR 4352 - -#endif /* !_MYSPACE_PERSIST_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -MySpaceIM Protocol Plugin for libpurple by Jeff Connelly 2007-08-07 - -Greetings. This package contains a plugin for libpurple (as used in -Pidgin, formerly Gaim) to connect to the new MySpaceIM instant messaging -network and send/receive messages. Functionality is only basic as of yet, -and this code should be considered alpha quality. - -This code was initially developed under Google Summer of Code 2007. - -For features and TODO, see http://developer.pidgin.im/wiki/MySpaceIM - -Usage: - -Login using your _email address_ you use to login to myspace.com. You can't -login using your numeric ID or alias. - -To test it out, send a message to yourself (by your username or numeric -uid (email not yet supported)) or tom (6221). In either case you should -get a reply. You should also be able to talk to other MySpaceIM users if -you desire. Replies will always be shown as coming from a user's username, -even if you IM by email or userid. - -Feedback welcome. You can IM my test account at "msimprpl" if you feel like it. - -Enjoy, --Jeff Connelly -msimprpl@xyzzy.cjb.net diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* MySpaceIM Protocol Plugin, session - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" - -/* Session methods */ - -/** - * Create a new MSIM session. - * - * @param acct The account to create the session from. - * - * @return Pointer to a new session. Free with msim_session_destroy. - */ -MsimSession * -msim_session_new(PurpleAccount *acct) -{ - MsimSession *session; - - g_return_val_if_fail(acct != NULL, NULL); - - session = g_new0(MsimSession, 1); - - session->magic = MSIM_SESSION_STRUCT_MAGIC; - session->account = acct; - session->gc = purple_account_get_connection(acct); - session->sesskey = 0; - session->userid = 0; - session->username = NULL; - session->fd = -1; - - /* TODO: Remove. */ - session->user_lookup_cb = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, NULL); /* do NOT free function pointers! (values) */ - session->user_lookup_cb_data = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, NULL);/* TODO: we don't know what the values are, - they could be integers inside gpointers - or strings, so I don't freed them. - Figure this out, once free cache. */ - - /* Created in msim_process_server_info() */ - session->server_info = NULL; - - session->rxoff = 0; - session->rxsize = MSIM_READ_BUF_SIZE; - session->rxbuf = g_new0(gchar, session->rxsize); - session->next_rid = 1; - session->last_comm = time(NULL); - session->inbox_status = 0; - session->inbox_handle = 0; - - return session; -} - -/** - * Free a session. - * - * @param session The session to destroy. - */ -void -msim_session_destroy(MsimSession *session) -{ - session->magic = -1; - - g_free(session->rxbuf); - g_free(session->username); - - /* TODO: Remove. */ - g_hash_table_destroy(session->user_lookup_cb); - g_hash_table_destroy(session->user_lookup_cb_data); - - if (session->server_info) { - msim_msg_free(session->server_info); - } - - /* Stop checking the inbox at the end of the session. */ - if (session->inbox_handle) { - purple_timeout_remove(session->inbox_handle); - } - - g_free(session); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/session.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/* MySpaceIM Protocol Plugin, session - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_SESSION_H -#define _MYSPACE_SESSION_H - -#include "account.h" - -/* Random number in every MsimSession, to ensure it is valid. */ -#define MSIM_SESSION_STRUCT_MAGIC 0xe4a6752b - -/* Everything needed to keep track of a session (proto_data field in PurpleConnection) */ -typedef struct _MsimSession -{ - guint magic; /**< MSIM_SESSION_STRUCT_MAGIC */ - PurpleAccount *account; - PurpleConnection *gc; - guint sesskey; /**< Session key from server */ - guint userid; /**< This user's numeric user ID */ - gchar *username; /**< This user's unique username */ - gboolean show_only_to_list; - int privacy_mode; /**< This is a bitmask */ - int offline_message_mode; - gint fd; /**< File descriptor to/from server */ - - /* TODO: Remove. */ - GHashTable *user_lookup_cb; /**< Username -> userid lookup callback */ - GHashTable *user_lookup_cb_data; /**< Username -> userid lookup callback data */ - - MsimMessage *server_info; /**< Parameters from server */ - - gchar *rxbuf; /**< Receive buffer */ - guint rxoff; /**< Receive buffer offset */ - guint rxsize; /**< Receive buffer size */ - guint next_rid; /**< Next request/response ID */ - time_t last_comm; /**< Time received last communication */ - guint inbox_status; /**< Bit field of inbox notifications */ - guint inbox_handle; /**< The handle for the mail check timer */ -} MsimSession; - -MsimSession *msim_session_new(PurpleAccount *acct); -void msim_session_destroy(MsimSession *session); - -#endif /* !_MYSPACE_SESSION_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,890 +0,0 @@ -/* MySpaceIM Protocol Plugin, header file - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" - -static void msim_check_username_availability_cb(PurpleConnection *gc, const char *username_to_check); - -static char *msim_username_to_set; - -/** - * Format the "now playing" indicator, showing the artist and song. - * - * @return Return a new string (must be g_free()'d), or NULL. - */ -static gchar * -msim_format_now_playing(const gchar *band, const gchar *song) -{ - if ((band && *band) || (song && *song)) { - return g_strdup_printf("%s - %s", - (band && *band) ? band : "Unknown Artist", - (song && *song) ? song : "Unknown Song"); - } else { - return NULL; - } -} - -/** - * Get the MsimUser from a PurpleBuddy, optionally creating it if needed. - */ -MsimUser * -msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create) -{ - MsimUser *user; - - if (!buddy) { - return NULL; - } - - user = purple_buddy_get_protocol_data(buddy); - if (create && !user) { - /* No MsimUser for this buddy; make one. */ - - user = g_new0(MsimUser, 1); - user->buddy = buddy; - user->id = purple_blist_node_get_int(&buddy->node, "UserID"); - purple_buddy_set_protocol_data(buddy, user); - } - - return user; -} - -void msim_user_free(MsimUser *user) -{ - if (!user) - return; - - if (user->url_data != NULL) - purple_util_fetch_url_cancel(user->url_data); - - g_free(user->client_info); - g_free(user->gender); - g_free(user->location); - g_free(user->headline); - g_free(user->display_name); - g_free(user->username); - g_free(user->band_name); - g_free(user->song_name); - g_free(user->image_url); - g_free(user); -} - -/** - * Find and return an MsimUser * representing a user on the buddy list, or NULL. - */ -MsimUser * -msim_find_user(MsimSession *session, const gchar *username) -{ - PurpleBuddy *buddy; - - buddy = purple_find_buddy(session->account, username); - if (!buddy) { - return NULL; - } - - return msim_get_user_from_buddy(buddy, TRUE); -} - -/** - * Append user information to a PurpleNotifyUserInfo, given an MsimUser. - * Used by msim_tooltip_text() and msim_get_info_cb() to show a user's profile. - */ -void -msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, MsimUser *user, gboolean full) -{ - PurplePresence *presence; - gchar *str; - guint cv; - - /* Useful to identify the account the tooltip refers to. - * Other prpls show this. */ - if (user->username) { - purple_notify_user_info_add_pair(user_info, _("User"), user->username); - } - - /* a/s/l...the vitals */ - if (user->age) { - char age[16]; - g_snprintf(age, sizeof(age), "%d", user->age); - purple_notify_user_info_add_pair(user_info, _("Age"), age); - } - - if (user->gender && *user->gender) { - purple_notify_user_info_add_pair(user_info, _("Gender"), user->gender); - } - - if (user->location && *user->location) { - purple_notify_user_info_add_pair(user_info, _("Location"), user->location); - } - - /* Other information */ - if (user->headline && *user->headline) { - purple_notify_user_info_add_pair(user_info, _("Headline"), user->headline); - } - - if (user->buddy != NULL) { - presence = purple_buddy_get_presence(user->buddy); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status; - const char *artist, *title; - - status = purple_presence_get_status(presence, "tune"); - title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - - str = msim_format_now_playing(artist, title); - if (str && *str) { - purple_notify_user_info_add_pair(user_info, _("Song"), str); - } - g_free(str); - } - } - - /* Note: total friends only available if looked up by uid, not username. */ - if (user->total_friends) { - char friends[16]; - g_snprintf(friends, sizeof(friends), "%d", user->total_friends); - purple_notify_user_info_add_pair(user_info, _("Total Friends"), friends); - } - - if (full) { - /* Client information */ - char *client = NULL; - - str = user->client_info; - cv = user->client_cv; - - if (str && cv != 0) { - client = g_strdup_printf("%s (build %d)", str, cv); - } else if (str) { - client = g_strdup(str); - } else if (cv) { - client = g_strdup_printf("Build %d", cv); - } - if (client && *client) - purple_notify_user_info_add_pair(user_info, _("Client Version"), client); - g_free(client); - } - - if (full && user->id) { - /* TODO: link to username, if available */ - char *profile; - purple_notify_user_info_add_section_break(user_info); - if (user->buddy != NULL) - profile = g_strdup_printf("%s", - purple_buddy_get_name(user->buddy), _("View web profile")); - else - profile = g_strdup_printf("%s", - user->id, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, profile); - g_free(profile); - } -} - -/** - * Callback for when a buddy icon finished being downloaded. - */ -static void -msim_downloaded_buddy_icon(PurpleUtilFetchUrlData *url_data, - gpointer user_data, - const gchar *url_text, - gsize len, - const gchar *error_message) -{ - MsimUser *user = (MsimUser *)user_data; - const char *name = purple_buddy_get_name(user->buddy); - PurpleAccount *account; - - user->url_data = NULL; - - purple_debug_info("msim_downloaded_buddy_icon", - "Downloaded %" G_GSIZE_FORMAT " bytes\n", len); - - if (!url_text) { - purple_debug_info("msim_downloaded_buddy_icon", - "failed to download icon for %s", - name); - return; - } - - account = purple_buddy_get_account(user->buddy); - purple_buddy_icons_set_for_user(account, name, - g_memdup((gchar *)url_text, len), len, - /* Use URL itself as buddy icon "checksum" (TODO: ETag) */ - user->image_url); /* checksum */ -} - -/** - * Set the currently playing song artist and or title. - * - * @param user User associated with the now playing information. - * - * @param new_artist New artist to set, or NULL/empty to not change artist. - * - * @param new_title New title to set, or NULL/empty to not change title. - * - * If new_artist and new_title are NULL/empty, deactivate PURPLE_STATUS_TUNE. - * - * This function is useful because it lets you set the artist or title - * individually, which purple_prpl_got_user_status() doesn't do. - */ -static void msim_set_artist_or_title(MsimUser *user, const char *new_artist, const char *new_title) -{ - PurplePresence *presence; - PurpleAccount *account; - const char *prev_artist, *prev_title; - const char *name; - - if (user->buddy == NULL) - /* User not on buddy list so nothing to do */ - return; - - prev_artist = NULL; - prev_title = NULL; - - if (new_artist && !*new_artist) - new_artist = NULL; - if (new_title && !*new_title) - new_title = NULL; - - account = purple_buddy_get_account(user->buddy); - name = purple_buddy_get_name(user->buddy); - - if (!new_artist && !new_title) { - purple_prpl_got_user_status_deactive(account, name, "tune"); - return; - } - - presence = purple_buddy_get_presence(user->buddy); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status; - - status = purple_presence_get_status(presence, "tune"); - prev_title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); - prev_artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); - } - - if (!new_artist) - new_artist = prev_artist; - - if (!new_title) - new_title = prev_title; - - purple_prpl_got_user_status(account, name, "tune", - PURPLE_TUNE_TITLE, new_title, - PURPLE_TUNE_ARTIST, new_artist, - NULL); -} - -/** - * Store a field of information about a buddy. - * - * @param key_str Key to store. - * @param value_str Value string, either user takes ownership of this string - * or it is freed if MsimUser doesn't store the string. - * @param user User to store data in. Existing data will be replaced. - */ -static void -msim_store_user_info_each(const gchar *key_str, gchar *value_str, MsimUser *user) -{ - const char *name = user->buddy ? purple_buddy_get_name(user->buddy) : NULL; - - if (g_str_equal(key_str, "UserID") || g_str_equal(key_str, "ContactID")) { - /* Save to buddy list, if it exists, for quick cached uid lookup with msim_uid2username_from_blist(). */ - user->id = atol(value_str); - g_free(value_str); - if (user->buddy) - { - purple_debug_info("msim", "associating uid %s with username %s\n", key_str, name); - purple_blist_node_set_int(PURPLE_BLIST_NODE(user->buddy), "UserID", user->id); - } - /* Need to store in MsimUser, too? What if not on blist? */ - } else if (g_str_equal(key_str, "Age")) { - user->age = atol(value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "Gender")) { - g_free(user->gender); - user->gender = value_str; - } else if (g_str_equal(key_str, "Location")) { - g_free(user->location); - user->location = value_str; - } else if (g_str_equal(key_str, "TotalFriends")) { - user->total_friends = atol(value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "DisplayName")) { - g_free(user->display_name); - user->display_name = value_str; - } else if (g_str_equal(key_str, "BandName")) { - msim_set_artist_or_title(user, value_str, NULL); - g_free(value_str); - } else if (g_str_equal(key_str, "SongName")) { - msim_set_artist_or_title(user, NULL, value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "UserName") || g_str_equal(key_str, "IMName") || g_str_equal(key_str, "NickName")) { - /* Ignore because PurpleBuddy knows this already */ - g_free(value_str); - } else if (g_str_equal(key_str, "ImageURL") || g_str_equal(key_str, "AvatarURL")) { - const gchar *previous_url; - - if (user->temporary_user) { - /* This user will be destroyed soon; don't try to look up its image or avatar, - * since that won't return immediately and we will end up accessing freed data. - */ - g_free(value_str); - return; - } - - g_free(user->image_url); - - user->image_url = value_str; - - /* Instead of showing 'no photo' picture, show nothing. */ - if (g_str_equal(user->image_url, "http://x.myspace.com/images/no_pic.gif")) - { - purple_buddy_icons_set_for_user(purple_buddy_get_account(user->buddy), - name, NULL, 0, NULL); - return; - } - - /* TODO: use ETag for checksum */ - previous_url = purple_buddy_icons_get_checksum_for_user(user->buddy); - - /* Only download if URL changed */ - if (!previous_url || !g_str_equal(previous_url, user->image_url)) { - if (user->url_data != NULL) - purple_util_fetch_url_cancel(user->url_data); - user->url_data = purple_util_fetch_url(user->image_url, TRUE, NULL, TRUE, msim_downloaded_buddy_icon, (gpointer)user); - } - } else if (g_str_equal(key_str, "LastImageUpdated")) { - /* TODO: use somewhere */ - user->last_image_updated = atol(value_str); - g_free(value_str); - } else if (g_str_equal(key_str, "Headline")) { - g_free(user->headline); - user->headline = value_str; - } else { - /* TODO: other fields in MsimUser */ - gchar *msg; - - msg = g_strdup_printf("msim_store_user_info_each: unknown field %s=%s", - key_str, value_str); - g_free(value_str); - - msim_unrecognized(NULL, NULL, msg); - - g_free(msg); - } -} - -/** - * Save buddy information to the buddy list from a user info reply message. - * - * @param session - * @param msg The user information reply, with any amount of information. - * @param user The structure to save to, or NULL to save in PurpleBuddy->proto_data. - * - * Variable information is saved to the passed MsimUser structure. Permanent - * information (UserID) is stored in the blist node of the buddy list (and - * ends up in blist.xml, persisted to disk) if it exists. - * - * If the function has no buddy information, this function - * is a no-op (and returns FALSE). - */ -gboolean -msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *user) -{ - gchar *username; - MsimMessage *body, *body_node; - - g_return_val_if_fail(msg != NULL, FALSE); - - body = msim_msg_get_dictionary(msg, "body"); - if (!body) { - return FALSE; - } - - if (msim_msg_get_integer(msg, "dsn") == MG_OWN_IM_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_IM_INFO_LID) - { - /* - * Some of this info will be available on the buddy list if the - * user has themselves as their own buddy. - * - * Much of the info is already available in MsimSession, - * stored in msim_we_are_logged_on(). - */ - gchar *tmpstr; - - tmpstr = msim_msg_get_string(body, "ShowOnlyToList"); - if (tmpstr != NULL) { - session->show_only_to_list = g_str_equal(tmpstr, "True"); - g_free(tmpstr); - } - - session->privacy_mode = msim_msg_get_integer(body, "PrivacyMode"); - session->offline_message_mode = msim_msg_get_integer(body, "OfflineMessageMode"); - - msim_send(session, - "blocklist", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "idlist", MSIM_TYPE_STRING, - g_strdup_printf("w%d|c%d", - session->show_only_to_list ? 1 : 0, - session->privacy_mode & 1), - NULL); - } else if (msim_msg_get_integer(msg, "dsn") == MG_OWN_MYSPACE_INFO_DSN && - msim_msg_get_integer(msg, "lid") == MG_OWN_MYSPACE_INFO_LID) { - /* TODO: same as above, but for MySpace info. */ - } - - username = msim_msg_get_string(body, "UserName"); - - if (!username) { - purple_debug_info("msim", - "msim_process_reply: not caching body, no UserName\n"); - msim_msg_free(body); - g_free(username); - return FALSE; - } - - /* Null user = find and store in PurpleBuddy's proto_data */ - if (!user) { - user = msim_find_user(session, username); - if (!user) { - msim_msg_free(body); - g_free(username); - return FALSE; - } - } - - /* TODO: make looping over MsimMessage's easier. */ - for (body_node = body; - body_node != NULL; - body_node = msim_msg_get_next_element_node(body_node)) - { - const gchar *key_str; - gchar *value_str; - MsimMessageElement *elem; - - elem = (MsimMessageElement *)body_node->data; - key_str = elem->name; - - value_str = msim_msg_get_string_from_element(elem); - msim_store_user_info_each(key_str, value_str, user); - } - - msim_msg_free(body); - g_free(username); - - return TRUE; -} - -#if 0 -/** - * Return whether a given username is syntactically valid. - * Note: does not actually check that the user exists. - */ -static gboolean -msim_is_valid_username(const gchar *user) -{ - return !msim_is_userid(user) && /* Not all numeric */ - strlen(user) <= MSIM_MAX_USERNAME_LENGTH - && strspn(user, "0123456789" - "abcdefghijklmnopqrstuvwxyz" - "_" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == strlen(user); -} -#endif - -/** - * Check if a string is a userid (all numeric). - * - * @param user The user id, email, or name. - * - * @return TRUE if is userid, FALSE if not. - */ -gboolean -msim_is_userid(const gchar *user) -{ - g_return_val_if_fail(user != NULL, FALSE); - - return strspn(user, "0123456789") == strlen(user); -} - -/** - * Check if a string is an email address (contains an @). - * - * @param user The user id, email, or name. - * - * @return TRUE if is an email, FALSE if not. - * - * This function is not intended to be used as a generic - * means of validating email addresses, but to distinguish - * between a user represented by an email address from - * other forms of identification. - */ -static gboolean -msim_is_email(const gchar *user) -{ - g_return_val_if_fail(user != NULL, FALSE); - - return strchr(user, '@') != NULL; -} - -/** - * Asynchronously lookup user information, calling callback when receive result. - * - * @param session - * @param user The user id, email address, or username. Not freed. - * @param cb Callback, called with user information when available. - * @param data An arbitray data pointer passed to the callback. - */ -/* TODO: change to not use callbacks */ -void -msim_lookup_user(MsimSession *session, const gchar *user, MSIM_USER_LOOKUP_CB cb, gpointer data) -{ - MsimMessage *body; - gchar *field_name; - guint rid, cmd, dsn, lid; - - g_return_if_fail(user != NULL); - /* Callback can be null to not call anything, just lookup & store information. */ - /*g_return_if_fail(cb != NULL);*/ - - purple_debug_info("msim", "msim_lookup_userid: " - "asynchronously looking up <%s>\n", user); - - /* Setup callback. Response will be associated with request using 'rid'. */ - rid = msim_new_reply_callback(session, cb, data); - - /* Send request */ - - cmd = MSIM_CMD_GET; - - if (msim_is_userid(user)) { - field_name = "UserID"; - dsn = MG_MYSPACE_INFO_BY_ID_DSN; - lid = MG_MYSPACE_INFO_BY_ID_LID; - } else if (msim_is_email(user)) { - field_name = "Email"; - dsn = MG_MYSPACE_INFO_BY_STRING_DSN; - lid = MG_MYSPACE_INFO_BY_STRING_LID; - } else { - field_name = "UserName"; - dsn = MG_MYSPACE_INFO_BY_STRING_DSN; - lid = MG_MYSPACE_INFO_BY_STRING_LID; - } - - body = msim_msg_new( - field_name, MSIM_TYPE_STRING, g_strdup(user), - NULL); - - g_return_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, 1, - "dsn", MSIM_TYPE_INTEGER, dsn, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, lid, - "rid", MSIM_TYPE_INTEGER, rid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL)); -} - -/** - * Called after username is set. - */ -static void msim_username_is_set_cb(MsimSession *session, const MsimMessage *userinfo, gpointer data) -{ - gchar *username; - const gchar *errmsg; - MsimMessage *body; - - guint rid; - gint cmd,dsn,uid,lid,code; - /* \persistr\\cmd\258\dsn\9\uid\204084363\lid\14\rid\369\body\UserName=TheAlbinoRhino1.Code=0\final\ */ - - purple_debug_info("msim","username_is_set made\n"); - - cmd = msim_msg_get_integer(userinfo, "cmd"); - dsn = msim_msg_get_integer(userinfo, "dsn"); - uid = msim_msg_get_integer(userinfo, "uid"); - lid = msim_msg_get_integer(userinfo, "lid"); - body = msim_msg_get_dictionary(userinfo, "body"); - errmsg = _("An error occurred while trying to set the username. " - "Please try again, or visit http://editprofile.myspace.com/index.cfm?" - "fuseaction=profile.username to set your username."); - - if (!body) { - purple_debug_info("msim_username_is_set_cb", "No body"); - /* Error: No body! */ - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); - } - username = msim_msg_get_string(body, "UserName"); - code = msim_msg_get_integer(body,"Code"); - - msim_msg_free(body); - - purple_debug_info("msim_username_is_set_cb", - "cmd = %d, dsn = %d, lid = %d, code = %d, username = %s\n", - cmd, dsn, lid, code, username); - - if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_PUT) - && dsn == MC_SET_USERNAME_DSN - && lid == MC_SET_USERNAME_LID) - { - purple_debug_info("msim_username_is_set_cb", "Proper cmd,dsn,lid for username_is_set!\n"); - purple_debug_info("msim_username_is_set_cb", "Username Set with return code %d\n",code); - if (code == 0) { - /* Good! */ - session->username = username; - msim_we_are_logged_on(session); - } else { - purple_debug_info("msim_username_is_set", "code is %d",code); - /* TODO: what to do here? */ - } - } else if (cmd == (MSIM_CMD_BIT_REPLY | MSIM_CMD_GET) - && dsn == MG_MYSPACE_INFO_BY_STRING_DSN - && lid == MG_MYSPACE_INFO_BY_STRING_LID) { - /* Not quite done... ONE MORE STEP :) */ - rid = msim_new_reply_callback(session, msim_username_is_set_cb, data); - body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username), NULL); - if (!msim_send(session, "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_PUT, - "dsn", MSIM_TYPE_INTEGER, MC_SET_USERNAME_DSN, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, MC_SET_USERNAME_LID, - "rid", MSIM_TYPE_INTEGER, rid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL)) { - /* Error! */ - /* Can't set... Disconnect */ - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); - } - - } else { - /* Error! */ - purple_debug_info("msim","username_is_set Error: Invalid cmd/dsn/lid combination"); - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, errmsg); - } -} - -/** - * Asynchronously set new username, calling callback when receive result. - * - * @param session - * @param username The username we're setting for ourselves. Not freed. - * @param cb Callback, called with user information when available. - * @param data An arbitray data pointer passed to the callback. - */ -static void -msim_set_username(MsimSession *session, const gchar *username, - MSIM_USER_LOOKUP_CB cb, gpointer data) -{ - MsimMessage *body; - guint rid; - - g_return_if_fail(username != NULL); - g_return_if_fail(cb != NULL); - - purple_debug_info("msim", "msim_set_username: " - "Setting username %s\n", username); - - /* Setup callback. Response will be associated with request using 'rid'. */ - rid = msim_new_reply_callback(session, cb, data); - - /* TODO: I dont know if the ContactType is -/ALWAYS/- 1 */ - - body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username),NULL); -/* \setinfo\\sesskey\469958979\info\Age=21.AvatarUrl=.BandName=.ContactType=1.DisplayName=Msim.Gender=M.ImageURL=http:/1/1x.myspace.com/1images/1no_pic.gif.LastLogin=128335268400000000.Location=US.ShowAvatar=False.SongName=.TotalFriends=1.UserName=msimprpl2\final\ -*/ - - /* Send request */ - g_return_if_fail(msim_send(session, - "setinfo", MSIM_TYPE_BOOLEAN, TRUE, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "info", MSIM_TYPE_DICTIONARY, body, - NULL)); - body = msim_msg_new("UserName", MSIM_TYPE_STRING, g_strdup(username),NULL); - g_return_if_fail(msim_send(session, - "persist", MSIM_TYPE_INTEGER, 1, - "sesskey", MSIM_TYPE_INTEGER, session->sesskey, - "cmd", MSIM_TYPE_INTEGER, MSIM_CMD_GET, - "dsn", MSIM_TYPE_INTEGER, MG_MYSPACE_INFO_BY_STRING_DSN, - "uid", MSIM_TYPE_INTEGER, session->userid, - "lid", MSIM_TYPE_INTEGER, MG_MYSPACE_INFO_BY_STRING_LID, - "rid", MSIM_TYPE_INTEGER, rid, - "body", MSIM_TYPE_DICTIONARY, body, - NULL)); -} - -/** - * They've confirmed that username that was available, Lets make the call to set it - */ -static void msim_set_username_confirmed_cb(PurpleConnection *gc) -{ - MsimMessage *user_msg; - MsimSession *session; - - g_return_if_fail(gc != NULL); - - session = (MsimSession *)gc->proto_data; - - user_msg = msim_msg_new( - "user", MSIM_TYPE_STRING, g_strdup(msim_username_to_set), - NULL); - - purple_debug_info("msim_set_username_confirmed_cb", "Setting username to %s\n", msim_username_to_set); - - /* Sets our username... keep your fingers crossed :) */ - msim_set_username(session, msim_username_to_set, msim_username_is_set_cb, user_msg); - g_free(msim_username_to_set); -} - -/** - * This is where we do a bit more than merely prompt the user. - * Now we have some real data to tell us the state of their requested username - * \persistr\\cmd\257\dsn\5\uid\204084363\lid\7\rid\367\body\UserName=TheAlbinoRhino1\final\ - */ -static void msim_username_is_available_cb(MsimSession *session, const MsimMessage *userinfo, gpointer data) -{ - MsimMessage *msg; - gchar *username; - MsimMessage *body; - gint userid; - - purple_debug_info("msim_username_is_available_cb", "Look up username callback made\n"); - - msg = (MsimMessage *)data; - g_return_if_fail(msg != NULL); - - username = msim_msg_get_string(msg, "user"); - body = msim_msg_get_dictionary(userinfo, "body"); - - if (!body) { - purple_debug_info("msim_username_is_available_cb", "No body for %s?!\n", username); - purple_connection_error_reason(session->gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("An error occurred while trying to set the username. " - "Please try again, or visit http://editprofile.myspace.com/index.cfm?" - "fuseaction=profile.username to set your username.")); - return; - } - - userid = msim_msg_get_integer(body, "UserID"); - - purple_debug_info("msim_username_is_available_cb", "Returned username is %s and userid is %d\n", username, userid); - msim_msg_free(body); - msim_msg_free(msg); - - /* The response for a free username will ONLY have the UserName in it.. - * thus making UserID return 0 when we msg_get_integer it */ - if (userid == 0) { - /* This username is currently unused */ - purple_debug_info("msim_username_is_available_cb", "Username available. Prompting to Confirm.\n"); - msim_username_to_set = g_strdup(username); - g_free(username); - purple_request_yes_no(session->gc, - _("MySpaceIM - Username Available"), - _("This username is available. Would you like to set it?"), - _("ONCE SET, THIS CANNOT BE CHANGED!"), - 0, - session->account, - NULL, - NULL, - session->gc, - G_CALLBACK(msim_set_username_confirmed_cb), - G_CALLBACK(msim_do_not_set_username_cb)); - } else { - /* Looks like its in use or we have an invalid response */ - purple_debug_info("msim_username_is_available_cb", "Username unavaiable. Prompting for new entry.\n"); - purple_request_input(session->gc, _("MySpaceIM - Please Set a Username"), - _("This username is unavailable."), - _("Please try another username:"), - "", FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msim_check_username_availability_cb), - _("Cancel"), G_CALLBACK(msim_do_not_set_username_cb), - session->account, - NULL, - NULL, - session->gc); - } -} - -/** - * Once they've submitted their desired new username, - * check if it is available here. - */ -static void msim_check_username_availability_cb(PurpleConnection *gc, const char *username_to_check) -{ - MsimMessage *user_msg; - MsimSession *session; - - g_return_if_fail(gc != NULL); - - session = (MsimSession *)gc->proto_data; - - purple_debug_info("msim_check_username_availability_cb", "Checking username: %s\n", username_to_check); - - user_msg = msim_msg_new( - "user", MSIM_TYPE_STRING, g_strdup(username_to_check), - NULL); - - /* 25 characters: letters, numbers, underscores */ - /* TODO: VERIFY ABOVE */ - - /* \persist\1\sesskey\288500516\cmd\1\dsn\5\uid\204084363\lid\7\rid\367\body\UserName=Jaywalker\final\ */ - /* Official client uses a standard lookup... So do we! */ - msim_lookup_user(session, username_to_check, msim_username_is_available_cb, user_msg); -} - -/*** - * If they hit cancel or no at any point in the Setting Username process, - * we come here. Currently we're safe letting them get by without - * setting it, unless we hear otherwise. So for now give them a menu. - * If this becomes an issue with the official client then boot them here. - */ -void msim_do_not_set_username_cb(PurpleConnection *gc) -{ - purple_debug_info("msim", "Don't set username"); - - /* Protocol won't log in now without a username set.. Disconnect */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("No username set")); -} - -/** - * They've decided to set a username! Yay! - */ -void msim_set_username_cb(PurpleConnection *gc) -{ - g_return_if_fail(gc != NULL); - purple_debug_info("msim","Set username\n"); - purple_request_input(gc, _("MySpaceIM - Please Set a Username"), - _("Please enter a username to check its availability:"), - NULL, - "", FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(msim_check_username_availability_cb), - _("Cancel"), G_CALLBACK(msim_do_not_set_username_cb), - purple_connection_get_account(gc), - NULL, - NULL, - gc); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/user.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -/* MySpaceIM Protocol Plugin, header file - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_USER_H -#define _MYSPACE_USER_H - -/* Hold ephemeral information about buddies, for proto_data of PurpleBuddy. */ -/* GHashTable? */ -typedef struct _MsimUser -{ - PurpleBuddy *buddy; - /* Note: id is also &buddy->node (set_blist_node_int), when buddy is non-NULL */ - int id; - guint client_cv; - gchar *client_info; - guint age; - gchar *gender; - gchar *location; - guint total_friends; - gchar *headline; - gchar *display_name; - gchar *username; - gchar *band_name, *song_name; - gchar *image_url; - guint last_image_updated; - gboolean temporary_user; - PurpleUtilFetchUrlData *url_data; -} MsimUser; - -/* Callback function pointer type for when a user's information is received, - * initiated from a user lookup. */ -typedef void (*MSIM_USER_LOOKUP_CB)(MsimSession *session, const MsimMessage *userinfo, gpointer data); - -MsimUser *msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create); -void msim_user_free(MsimUser *user); -MsimUser *msim_find_user(MsimSession *session, const gchar *username); -void msim_append_user_info(MsimSession *session, PurpleNotifyUserInfo *user_info, MsimUser *user, gboolean full); -gboolean msim_store_user_info(MsimSession *session, const MsimMessage *msg, MsimUser *user); -gboolean msim_is_userid(const gchar *user); -void msim_lookup_user(MsimSession *session, const gchar *user, MSIM_USER_LOOKUP_CB cb, gpointer data); -void msim_set_username_cb(PurpleConnection *gc); -void msim_do_not_set_username_cb(PurpleConnection *gc); - -#endif /* !_MYSPACE_USER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* MySpaceIM Protocol Plugin - zap support - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "myspace.h" -#include "zap.h" - -/** Get zap types. */ -GList * -msim_attention_types(PurpleAccount *acct) -{ - static GList *types = NULL; - PurpleAttentionType* attn; - - if (!types) { -#define _MSIM_ADD_NEW_ATTENTION(icn, ulname, nme, incoming, outgoing) \ - attn = purple_attention_type_new(ulname, nme, incoming, outgoing); \ - purple_attention_type_set_icon_name(attn, icn); \ - types = g_list_append(types, attn); - - /* TODO: icons for each zap */ - - /* Lots of comments for translators: */ - - /* Zap means "to strike suddenly and forcefully as if with a - * projectile or weapon." This term often has an electrical - * connotation, for example, "he was zapped by electricity when - * he put a fork in the toaster." */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Zap", _("Zap"), _("%s has zapped you!"), - _("Zapping %s...")); - - /* Whack means "to hit or strike someone with a sharp blow" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Whack", _("Whack"), - _("%s has whacked you!"), _("Whacking %s...")); - - /* Torch means "to set on fire." Don't worry, this doesn't - * make a whole lot of sense in English, either. Feel free - * to translate it literally. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Torch", _("Torch"), - _("%s has torched you!"), _("Torching %s...")); - - /* Smooch means "to kiss someone, often enthusiastically" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Smooch", _("Smooch"), - _("%s has smooched you!"), _("Smooching %s...")); - - /* A hug is a display of affection; wrapping your arms around someone */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Hug", _("Hug"), _("%s has hugged you!"), - _("Hugging %s...")); - - /* Slap means "to hit someone with an open/flat hand" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Slap", _("Slap"), - _("%s has slapped you!"), _("Slapping %s...")); - - /* Goose means "to pinch someone on their butt" */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Goose", _("Goose"), - _("%s has goosed you!"), _("Goosing %s...")); - - /* A high-five is when two people's hands slap each other - * in the air above their heads. It is done to celebrate - * something, often a victory, or to congratulate someone. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "High-five", _("High-five"), - _("%s has high-fived you!"), _("High-fiving %s...")); - - /* We're not entirely sure what the MySpace people mean by - * this... but we think it's the equivalent of "prank." Or, for - * someone to perform a mischievous trick or practical joke. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Punk", _("Punk"), - _("%s has punk'd you!"), _("Punking %s...")); - - /* Raspberry is a slang term for the vibrating sound made - * when you stick your tongue out of your mouth with your - * lips closed and blow. It is typically done when - * gloating or bragging. Nowadays it's a pretty silly - * gesture, so it does not carry a harsh negative - * connotation. It is generally used in a playful tone - * with friends. */ - _MSIM_ADD_NEW_ATTENTION(NULL, "Raspberry", _("Raspberry"), - _("%s has raspberried you!"), _("Raspberrying %s...")); - } - - return types; -} - -/** Send a zap to a user. */ -static gboolean -msim_send_zap(MsimSession *session, const gchar *username, guint code) -{ - gchar *zap_string; - gboolean rc; - - g_return_val_if_fail(session != NULL, FALSE); - g_return_val_if_fail(username != NULL, FALSE); - - /* Construct and send the actual zap command. */ - zap_string = g_strdup_printf("!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", code); - - if (!msim_send_bm(session, username, zap_string, MSIM_BM_ACTION_OR_IM_INSTANT)) { - purple_debug_info("msim_send_zap", - "msim_send_bm failed: zapping %s with %s\n", - username, zap_string); - rc = FALSE; - } else { - rc = TRUE; - } - - g_free(zap_string); - - return rc; -} - -/** Send a zap */ -gboolean -msim_send_attention(PurpleConnection *gc, const gchar *username, guint code) -{ - GList *types; - MsimSession *session; - PurpleAttentionType *attn; - PurpleBuddy *buddy; - - session = (MsimSession *)gc->proto_data; - - /* Look for this attention type, by the code index given. */ - types = msim_attention_types(gc->account); - attn = (PurpleAttentionType *)g_list_nth_data(types, code); - - if (!attn) { - purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code); - return FALSE; - } - - buddy = purple_find_buddy(session->account, username); - if (!buddy) { - return FALSE; - } - - msim_send_zap(session, username, code); - - return TRUE; -} - -/** Zap someone. Callback from msim_blist_node_menu zap menu. */ -static void -msim_send_zap_from_menu(PurpleBlistNode *node, gpointer zap_num_ptr) -{ - PurpleBuddy *buddy; - PurpleAccount *account; - PurpleConnection *gc; - MsimSession *session; - guint zap; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* Only know about buddies for now. */ - return; - } - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - - /* Find the session */ - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - session = (MsimSession *)gc->proto_data; - - zap = GPOINTER_TO_INT(zap_num_ptr); - - purple_prpl_send_attention(session->gc, purple_buddy_get_name(buddy), zap); -} - -/** Return menu, if any, for a buddy list node. */ -GList * -msim_blist_node_menu(PurpleBlistNode *node) -{ - GList *menu, *zap_menu; - GList *types; - PurpleMenuAction *act; - guint i; - - if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) { - /* Only know about buddies for now. */ - return NULL; - } - - zap_menu = NULL; - - /* TODO: get rid of once is accessible directly in GUI */ - types = msim_attention_types(NULL); - i = 0; - do - { - PurpleAttentionType *attn; - - attn = (PurpleAttentionType *)types->data; - - act = purple_menu_action_new(purple_attention_type_get_name(attn), - PURPLE_CALLBACK(msim_send_zap_from_menu), GUINT_TO_POINTER(i), NULL); - zap_menu = g_list_append(zap_menu, act); - - ++i; - } while ((types = g_list_next(types))); - - act = purple_menu_action_new(_("Zap"), NULL, NULL, zap_menu); - menu = g_list_append(NULL, act); - - return menu; -} - -/** Process an incoming zap. */ -gboolean -msim_incoming_zap(MsimSession *session, MsimMessage *msg) -{ - gchar *msg_text, *username; - gint zap; - - msg_text = msim_msg_get_string(msg, "msg"); - username = msim_msg_get_string(msg, "_username"); - - g_return_val_if_fail(msg_text != NULL, FALSE); - g_return_val_if_fail(username != NULL, FALSE); - - g_return_val_if_fail(sscanf(msg_text, "!!!ZAP_SEND!!!=RTE_BTN_ZAPS_%d", &zap) == 1, FALSE); - - zap = CLAMP(zap, 0, 9); - - purple_prpl_got_attention(session->gc, username, zap); - - g_free(msg_text); - g_free(username); - - return TRUE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/myspace/zap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* MySpaceIM Protocol Plugin - zap support - * - * Copyright (C) 2007, Jeff Connelly - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _MYSPACE_ZAP_H -#define _MYSPACE_ZAP_H - -GList *msim_attention_types(PurpleAccount *acct); -gboolean msim_send_attention(PurpleConnection *gc, const gchar *username, guint code); -GList *msim_blist_node_menu(PurpleBlistNode *node); -gboolean msim_incoming_zap(MsimSession *session, MsimMessage *msg); - -#endif /* !_MYSPACE_ZAP_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -NOVELLSOURCES = \ - nmfield.h \ - nmfield.c \ - nmconn.h \ - nmconn.c \ - nmconference.h \ - nmconference.c \ - nmcontact.h \ - nmcontact.c \ - nmevent.h \ - nmevent.c \ - nmmessage.h \ - nmmessage.c \ - nmrequest.h \ - nmrequest.c \ - nmrtf.h \ - nmrtf.c \ - nmuser.h \ - nmuser.c \ - nmuserrecord.h \ - nmuserrecord.c \ - novell.c - -AM_CFLAGS = $(st) - -libnovell_la_LDFLAGS = -module -avoid-version - -if STATIC_NOVELL - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libnovell.la -libnovell_la_SOURCES = $(NOVELLSOURCES) -libnovell_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libnovell.la -libnovell_la_SOURCES = $(NOVELLSOURCES) -libnovell_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,849 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/novell -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_NOVELL_FALSE@libnovell_la_DEPENDENCIES = \ -@STATIC_NOVELL_FALSE@ $(am__DEPENDENCIES_1) -am__libnovell_la_SOURCES_DIST = nmfield.h nmfield.c nmconn.h nmconn.c \ - nmconference.h nmconference.c nmcontact.h nmcontact.c \ - nmevent.h nmevent.c nmmessage.h nmmessage.c nmrequest.h \ - nmrequest.c nmrtf.h nmrtf.c nmuser.h nmuser.c nmuserrecord.h \ - nmuserrecord.c novell.c -am__objects_1 = libnovell_la-nmfield.lo libnovell_la-nmconn.lo \ - libnovell_la-nmconference.lo libnovell_la-nmcontact.lo \ - libnovell_la-nmevent.lo libnovell_la-nmmessage.lo \ - libnovell_la-nmrequest.lo libnovell_la-nmrtf.lo \ - libnovell_la-nmuser.lo libnovell_la-nmuserrecord.lo \ - libnovell_la-novell.lo -@STATIC_NOVELL_FALSE@am_libnovell_la_OBJECTS = $(am__objects_1) -@STATIC_NOVELL_TRUE@am_libnovell_la_OBJECTS = $(am__objects_1) -libnovell_la_OBJECTS = $(am_libnovell_la_OBJECTS) -@STATIC_NOVELL_FALSE@am_libnovell_la_rpath = -rpath $(pkgdir) -@STATIC_NOVELL_TRUE@am_libnovell_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libnovell_la_SOURCES) -DIST_SOURCES = $(am__libnovell_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -NOVELLSOURCES = \ - nmfield.h \ - nmfield.c \ - nmconn.h \ - nmconn.c \ - nmconference.h \ - nmconference.c \ - nmcontact.h \ - nmcontact.c \ - nmevent.h \ - nmevent.c \ - nmmessage.h \ - nmmessage.c \ - nmrequest.h \ - nmrequest.c \ - nmrtf.h \ - nmrtf.c \ - nmuser.h \ - nmuser.c \ - nmuserrecord.h \ - nmuserrecord.c \ - novell.c - -AM_CFLAGS = $(st) -libnovell_la_LDFLAGS = -module -avoid-version -@STATIC_NOVELL_FALSE@st = -@STATIC_NOVELL_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_NOVELL_TRUE@noinst_LTLIBRARIES = libnovell.la -@STATIC_NOVELL_FALSE@libnovell_la_SOURCES = $(NOVELLSOURCES) -@STATIC_NOVELL_TRUE@libnovell_la_SOURCES = $(NOVELLSOURCES) -@STATIC_NOVELL_TRUE@libnovell_la_CFLAGS = $(AM_CFLAGS) -@STATIC_NOVELL_FALSE@pkg_LTLIBRARIES = libnovell.la -@STATIC_NOVELL_FALSE@libnovell_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/novell/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/novell/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libnovell.la: $(libnovell_la_OBJECTS) $(libnovell_la_DEPENDENCIES) - $(LINK) $(am_libnovell_la_rpath) $(libnovell_la_LDFLAGS) $(libnovell_la_OBJECTS) $(libnovell_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmconference.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmconn.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmcontact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmevent.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmfield.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmmessage.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmrequest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmrtf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmuser.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-nmuserrecord.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnovell_la-novell.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libnovell_la-nmfield.lo: nmfield.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmfield.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmfield.Tpo" -c -o libnovell_la-nmfield.lo `test -f 'nmfield.c' || echo '$(srcdir)/'`nmfield.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmfield.Tpo" "$(DEPDIR)/libnovell_la-nmfield.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmfield.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmfield.c' object='libnovell_la-nmfield.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmfield.lo `test -f 'nmfield.c' || echo '$(srcdir)/'`nmfield.c - -libnovell_la-nmconn.lo: nmconn.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmconn.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmconn.Tpo" -c -o libnovell_la-nmconn.lo `test -f 'nmconn.c' || echo '$(srcdir)/'`nmconn.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmconn.Tpo" "$(DEPDIR)/libnovell_la-nmconn.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmconn.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmconn.c' object='libnovell_la-nmconn.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmconn.lo `test -f 'nmconn.c' || echo '$(srcdir)/'`nmconn.c - -libnovell_la-nmconference.lo: nmconference.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmconference.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmconference.Tpo" -c -o libnovell_la-nmconference.lo `test -f 'nmconference.c' || echo '$(srcdir)/'`nmconference.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmconference.Tpo" "$(DEPDIR)/libnovell_la-nmconference.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmconference.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmconference.c' object='libnovell_la-nmconference.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmconference.lo `test -f 'nmconference.c' || echo '$(srcdir)/'`nmconference.c - -libnovell_la-nmcontact.lo: nmcontact.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmcontact.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmcontact.Tpo" -c -o libnovell_la-nmcontact.lo `test -f 'nmcontact.c' || echo '$(srcdir)/'`nmcontact.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmcontact.Tpo" "$(DEPDIR)/libnovell_la-nmcontact.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmcontact.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmcontact.c' object='libnovell_la-nmcontact.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmcontact.lo `test -f 'nmcontact.c' || echo '$(srcdir)/'`nmcontact.c - -libnovell_la-nmevent.lo: nmevent.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmevent.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmevent.Tpo" -c -o libnovell_la-nmevent.lo `test -f 'nmevent.c' || echo '$(srcdir)/'`nmevent.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmevent.Tpo" "$(DEPDIR)/libnovell_la-nmevent.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmevent.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmevent.c' object='libnovell_la-nmevent.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmevent.lo `test -f 'nmevent.c' || echo '$(srcdir)/'`nmevent.c - -libnovell_la-nmmessage.lo: nmmessage.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmmessage.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmmessage.Tpo" -c -o libnovell_la-nmmessage.lo `test -f 'nmmessage.c' || echo '$(srcdir)/'`nmmessage.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmmessage.Tpo" "$(DEPDIR)/libnovell_la-nmmessage.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmmessage.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmmessage.c' object='libnovell_la-nmmessage.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmmessage.lo `test -f 'nmmessage.c' || echo '$(srcdir)/'`nmmessage.c - -libnovell_la-nmrequest.lo: nmrequest.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmrequest.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmrequest.Tpo" -c -o libnovell_la-nmrequest.lo `test -f 'nmrequest.c' || echo '$(srcdir)/'`nmrequest.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmrequest.Tpo" "$(DEPDIR)/libnovell_la-nmrequest.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmrequest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmrequest.c' object='libnovell_la-nmrequest.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmrequest.lo `test -f 'nmrequest.c' || echo '$(srcdir)/'`nmrequest.c - -libnovell_la-nmrtf.lo: nmrtf.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmrtf.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmrtf.Tpo" -c -o libnovell_la-nmrtf.lo `test -f 'nmrtf.c' || echo '$(srcdir)/'`nmrtf.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmrtf.Tpo" "$(DEPDIR)/libnovell_la-nmrtf.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmrtf.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmrtf.c' object='libnovell_la-nmrtf.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmrtf.lo `test -f 'nmrtf.c' || echo '$(srcdir)/'`nmrtf.c - -libnovell_la-nmuser.lo: nmuser.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmuser.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmuser.Tpo" -c -o libnovell_la-nmuser.lo `test -f 'nmuser.c' || echo '$(srcdir)/'`nmuser.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmuser.Tpo" "$(DEPDIR)/libnovell_la-nmuser.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmuser.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmuser.c' object='libnovell_la-nmuser.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmuser.lo `test -f 'nmuser.c' || echo '$(srcdir)/'`nmuser.c - -libnovell_la-nmuserrecord.lo: nmuserrecord.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-nmuserrecord.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-nmuserrecord.Tpo" -c -o libnovell_la-nmuserrecord.lo `test -f 'nmuserrecord.c' || echo '$(srcdir)/'`nmuserrecord.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-nmuserrecord.Tpo" "$(DEPDIR)/libnovell_la-nmuserrecord.Plo"; else rm -f "$(DEPDIR)/libnovell_la-nmuserrecord.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nmuserrecord.c' object='libnovell_la-nmuserrecord.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-nmuserrecord.lo `test -f 'nmuserrecord.c' || echo '$(srcdir)/'`nmuserrecord.c - -libnovell_la-novell.lo: novell.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -MT libnovell_la-novell.lo -MD -MP -MF "$(DEPDIR)/libnovell_la-novell.Tpo" -c -o libnovell_la-novell.lo `test -f 'novell.c' || echo '$(srcdir)/'`novell.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnovell_la-novell.Tpo" "$(DEPDIR)/libnovell_la-novell.Plo"; else rm -f "$(DEPDIR)/libnovell_la-novell.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='novell.c' object='libnovell_la-novell.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnovell_la_CFLAGS) $(CFLAGS) -c -o libnovell_la-novell.lo `test -f 'novell.c' || echo '$(srcdir)/'`novell.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libnovell -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libnovell -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = \ - nmfield.c \ - nmconn.c \ - nmconference.c \ - nmcontact.c \ - nmevent.c \ - nmmessage.c \ - nmrequest.c \ - nmrtf.c \ - nmuser.c \ - nmuserrecord.c \ - novell.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -/* - * nmconference.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include "nmconference.h" - -static int conf_count = 0; - -struct _NMConference -{ - - /* The conference identifier */ - char *guid; - - /* The list of participants for the conference */ - GSList *participants; - - /* Flags for the conference */ - guint32 flags; - - /* User defined data */ - gpointer data; - - /* Reference count for this object */ - int ref_count; - -}; - - -/******************************************************************************* - * Conference API -- see header file for comments - ******************************************************************************/ - -NMConference * -nm_create_conference(const char *guid) -{ - NMConference *conf = g_new0(NMConference, 1); - - if (guid) { - conf->guid = g_strdup(guid); - } else { - conf->guid = g_strdup(BLANK_GUID); - } - conf->ref_count = 1; - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Creating a conference %p, total=%d\n", - conf, conf_count++); - - return conf; -} - -void -nm_release_conference(NMConference * conference) -{ - GSList *node; - - g_return_if_fail(conference != NULL); - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "In release conference %p, refs=%d\n", - conference, conference->ref_count); - if (--conference->ref_count == 0) { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Releasing conference %p, total=%d\n", - conference, --conf_count); - - if (conference->guid) - g_free(conference->guid); - - if (conference->participants) { - for (node = conference->participants; node; node = node->next) { - if (node->data) { - NMUserRecord *user_record = node->data; - - nm_release_user_record(user_record); - node->data = NULL; - } - } - - g_slist_free(conference->participants); - } - - g_free(conference); - } -} - -gboolean -nm_conference_is_instantiated(NMConference * conference) -{ - if (conference == NULL) - return FALSE; - - return (strncmp(conference->guid, BLANK_GUID, CONF_GUID_END) != 0); -} - -int -nm_conference_get_participant_count(NMConference * conference) -{ - if (conference == NULL) - return 0; - - return g_slist_length(conference->participants); -} - -NMUserRecord * -nm_conference_get_participant(NMConference * conference, int index) -{ - if (conference == NULL) - return NULL; - - return (NMUserRecord *) g_slist_nth_data(conference->participants, index); -} - -void -nm_conference_add_participant(NMConference * conference, - NMUserRecord * user_record) -{ - if (conference == NULL || user_record == NULL) { - return; - } - - nm_user_record_add_ref(user_record); - conference->participants = g_slist_append(conference->participants, user_record); -} - -void -nm_conference_remove_participant(NMConference * conference, const char *dn) -{ - GSList *node, *element = NULL; - - if (conference == NULL || dn == NULL) { - return; - } - - for (node = conference->participants; node; node = node->next) { - NMUserRecord *user_record = node->data; - - if (user_record) { - if (nm_utf8_str_equal(dn, nm_user_record_get_dn(user_record))) { - element = node; - break; - } - } - } - - if (element) { - nm_release_user_record((NMUserRecord *) element->data); - element->data = NULL; - conference->participants = - g_slist_remove_link(conference->participants, element); - g_slist_free_1(element); - } -} - -void -nm_conference_add_ref(NMConference * conference) -{ - if (conference) - conference->ref_count++; -} - -void -nm_conference_set_flags(NMConference * conference, guint32 flags) -{ - if (conference) { - conference->flags = flags; - } -} - -void -nm_conference_set_guid(NMConference * conference, const char *guid) -{ - if (conference) { - - /* Release memory for old guid */ - if (conference->guid) { - g_free(conference->guid); - } - - /* Set the new guid */ - if (guid) - conference->guid = g_strdup(guid); - else - conference->guid = g_strdup(BLANK_GUID); - } -} - -void -nm_conference_set_data(NMConference * conference, gpointer data) -{ - if (conference == NULL) - return; - - conference->data = data; -} - -gpointer -nm_conference_get_data(NMConference * conference) -{ - if (conference == NULL) - return NULL; - - return conference->data; -} - -const char * -nm_conference_get_guid(NMConference * conference) -{ - if (conference == NULL) - return NULL; - - return conference->guid; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconference.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -/* - * nmconference.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_CONFERENCE_H__ -#define __NM_CONFERENCE_H__ - -typedef struct _NMConference NMConference; - -#include "nmuserrecord.h" - -/* A blank GUID -- represents an uninstatiated conference */ -#define BLANK_GUID "[00000000-00000000-00000000-0000-0000]" - -/* This is how much of the conference GUIDs to compare when testing - * to see if two conferences are the same. We cannot compare the - * entire GUID because the last part is the session count. - */ -#define CONF_GUID_END 27 - -/** - * Creates an conference object. - * - * The conference should be released by calling - * nm_release_conference - * - * @param guid The GUID for the conference. - * - * @return The new NMConference - */ -NMConference *nm_create_conference(const char *guid); - -/** - * Increments the reference count for the conference. - * - * The reference to the conference should be released - * by calling nm_release_conference - * - * @param conference The conference to reference - */ -void nm_conference_add_ref(NMConference * conference); - -/** - * Releases the resources associated with the conference - * if there are no more references to it, otherwise just - * decrements the reference count. - * - * @param conf The conference to release - * - */ -void nm_release_conference(NMConference * conf); - -/** - * Set the GUID for the conference. - * - * @param conference The conference - * @param guid The new conference GUID - * - */ -void nm_conference_set_guid(NMConference * conference, const char *guid); - -/** - * Return the GUID for the conference. - * - * @param conference The conference - * - * @return The GUID for the conference - */ -const char *nm_conference_get_guid(NMConference * conference); - -/** - * Add a participant to the conference. - * - * @param conference The conference - * @param user_record The user record to add as a participant - * - * @return - */ -void nm_conference_add_participant(NMConference * conference, - NMUserRecord * user_record); - -/** - * Remove a participant to the conference. - * - * @param conference The conference - * @param dn The dn of the participant to remove - * - */ -void nm_conference_remove_participant(NMConference * conference, const char *dn); - -/** - * Return the total number of participants in the conference. - * - * @param conference The conference - * - * @return The number of participants for the conference - * - */ -int nm_conference_get_participant_count(NMConference * conference); - -/** - * Return a participant given an index. - * - * @param conference The conference - * @param index The index of the participant to get - * - * @return The participant or NULL if the index is out of range. - * - */ -NMUserRecord *nm_conference_get_participant(NMConference * conference, int index); - -/** - * Check to see if the conference has been instantiated - * - * @param conference The conference - * - * @return TRUE if the conference has been instantiated, - * FALSE otherwise. - * - */ -gboolean nm_conference_is_instantiated(NMConference * conf); - -/** - * Set the flags for the conference. - * - * @param conference The conference - * @param flags The conference flags. - * - */ -void nm_conference_set_flags(NMConference * conference, guint32 flags); - -/** - * Set the user defined data for the conference. - * - * @param conference The conference - * @param data User defined data - * - */ -void nm_conference_set_data(NMConference * conference, gpointer data); - -/** - * Get the user defined data for the conference. - * - * @param conference The conference - * - * @return The data if it has been set, NULL otherwise. - * - */ -gpointer nm_conference_get_data(NMConference * conference); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,701 +0,0 @@ -/* - * nmconn.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include -#include -#include -#include -#include "nmconn.h" - -#ifdef _WIN32 -#include -#endif - -#define NO_ESCAPE(ch) ((ch == 0x20) || (ch >= 0x30 && ch <= 0x39) || \ - (ch >= 0x41 && ch <= 0x5a) || (ch >= 0x61 && ch <= 0x7a)) - -/* Read data from conn until the end of a line */ -static NMERR_T -read_line(NMConn * conn, char *buff, int len) -{ - NMERR_T rc = NM_OK; - int total_bytes = 0; - - while ((rc == NM_OK) && (total_bytes < (len - 1))) { - rc = nm_read_all(conn, &buff[total_bytes], 1); - if (rc == NM_OK) { - total_bytes += 1; - if (buff[total_bytes - 1] == '\n') { - break; - } - } - } - buff[total_bytes] = '\0'; - - return rc; -} - -static char * -url_escape_string(char *src) -{ - guint32 escape = 0; - char *p; - char *q; - char *encoded = NULL; - int ch; - - static const char hex_table[16] = "0123456789abcdef"; - - if (src == NULL) { - return NULL; - } - - /* Find number of chars to escape */ - for (p = src; *p != '\0'; p++) { - ch = (guchar) *p; - if (!NO_ESCAPE(ch)) { - escape++; - } - } - - encoded = g_malloc((p - src) + (escape * 2) + 1); - - /* Escape the string */ - for (p = src, q = encoded; *p != '\0'; p++) { - ch = (guchar) * p; - if (NO_ESCAPE(ch)) { - if (ch != 0x20) { - *q = ch; - q++; - } else { - *q = '+'; - q++; - } - } else { - *q = '%'; - q++; - - *q = hex_table[ch >> 4]; - q++; - - *q = hex_table[ch & 15]; - q++; - } - } - *q = '\0'; - - return encoded; -} - -static char * -encode_method(guint8 method) -{ - char *str; - - switch (method) { - case NMFIELD_METHOD_EQUAL: - str = "G"; - break; - case NMFIELD_METHOD_UPDATE: - str = "F"; - break; - case NMFIELD_METHOD_GTE: - str = "E"; - break; - case NMFIELD_METHOD_LTE: - str = "D"; - break; - case NMFIELD_METHOD_NE: - str = "C"; - break; - case NMFIELD_METHOD_EXIST: - str = "B"; - break; - case NMFIELD_METHOD_NOTEXIST: - str = "A"; - break; - case NMFIELD_METHOD_SEARCH: - str = "9"; - break; - case NMFIELD_METHOD_MATCHBEGIN: - str = "8"; - break; - case NMFIELD_METHOD_MATCHEND: - str = "7"; - break; - case NMFIELD_METHOD_NOT_ARRAY: - str = "6"; - break; - case NMFIELD_METHOD_OR_ARRAY: - str = "5"; - break; - case NMFIELD_METHOD_AND_ARRAY: - str = "4"; - break; - case NMFIELD_METHOD_DELETE_ALL: - str = "3"; - break; - case NMFIELD_METHOD_DELETE: - str = "2"; - break; - case NMFIELD_METHOD_ADD: - str = "1"; - break; - default: /* NMFIELD_METHOD_VALID */ - str = "0"; - break; - } - - return str; -} - -NMConn * -nm_create_conn(const char *addr, int port) -{ - NMConn *conn = g_new0(NMConn, 1); - conn->addr = g_strdup(addr); - conn->port = port; - return conn; -} - -void nm_release_conn(NMConn *conn) -{ - if (conn) { - GSList *node; - for (node = conn->requests; node; node = node->next) { - if (node->data) - nm_release_request(node->data); - } - g_slist_free(conn->requests); - conn->requests = NULL; - if (conn->ssl_conn) { - g_free(conn->ssl_conn); - conn->ssl_conn = NULL; - } - g_free(conn->addr); - conn->addr = NULL; - g_free(conn); - } -} - -int -nm_tcp_write(NMConn * conn, const void *buff, int len) -{ - if (conn == NULL || buff == NULL) - return -1; - - if (!conn->use_ssl) - return (write(conn->fd, buff, len)); - else if (conn->ssl_conn && conn->ssl_conn->write) - return (conn->ssl_conn->write(conn->ssl_conn->data, buff, len)); - else - return -1; -} - -int -nm_tcp_read(NMConn * conn, void *buff, int len) -{ - if (conn == NULL || buff == NULL) - return -1; - - if (!conn->use_ssl) - return (read(conn->fd, buff, len)); - else if (conn->ssl_conn && conn->ssl_conn->read) - return ((conn->ssl_conn->read)(conn->ssl_conn->data, buff, len)); - else - return -1; -} - -NMERR_T -nm_read_all(NMConn * conn, char *buff, int len) -{ - NMERR_T rc = NM_OK; - int bytes_left = len; - int bytes_read; - int total_bytes = 0; - int retry = 1000; - - if (conn == NULL || buff == NULL) - return NMERR_BAD_PARM; - - /* Keep reading until buffer is full */ - while (bytes_left) { - bytes_read = nm_tcp_read(conn, &buff[total_bytes], bytes_left); - if (bytes_read > 0) { - bytes_left -= bytes_read; - total_bytes += bytes_read; - } else { - if (errno == EAGAIN) { - if (--retry == 0) { - rc = NMERR_TCP_READ; - break; - } -#ifdef _WIN32 - Sleep(1); -#else - usleep(1000); -#endif - } else { - rc = NMERR_TCP_READ; - break; - } - } - } - return rc; -} - -NMERR_T -nm_read_uint32(NMConn *conn, guint32 *val) -{ - NMERR_T rc = NM_OK; - - rc = nm_read_all(conn, (char *)val, sizeof(*val)); - if (rc == NM_OK) { - *val = GUINT32_FROM_LE(*val); - } - - return rc; -} - -NMERR_T -nm_read_uint16(NMConn *conn, guint16 *val) -{ - NMERR_T rc = NM_OK; - - rc = nm_read_all(conn, (char *)val, sizeof(*val)); - if (rc == NM_OK) { - *val = GUINT16_FROM_LE(*val); - } - - return rc; -} - -NMERR_T -nm_write_fields(NMConn * conn, NMField * fields) -{ - NMERR_T rc = NM_OK; - NMField *field; - char *value = NULL; - char *method = NULL; - char buffer[4096]; - int ret; - int bytes_to_send; - int val = 0; - - if (conn == NULL || fields == NULL) { - return NMERR_BAD_PARM; - } - - /* Format each field as valid "post" data and write it out */ - for (field = fields; (rc == NM_OK) && (field->tag); field++) { - - /* We don't currently handle binary types */ - if (field->method == NMFIELD_METHOD_IGNORE || - field->type == NMFIELD_TYPE_BINARY) { - continue; - } - - /* Write the field tag */ - bytes_to_send = g_snprintf(buffer, sizeof(buffer), "&tag=%s", field->tag); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - /* Write the field method */ - if (rc == NM_OK) { - method = encode_method(field->method); - bytes_to_send = g_snprintf(buffer, sizeof(buffer), "&cmd=%s", method); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - - /* Write the field value */ - if (rc == NM_OK) { - switch (field->type) { - case NMFIELD_TYPE_UTF8: - case NMFIELD_TYPE_DN: - - value = url_escape_string((char *) field->ptr_value); - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&val=%s", value); - if (bytes_to_send > (int)sizeof(buffer)) { - ret = nm_tcp_write(conn, buffer, sizeof(buffer)); - } else { - ret = nm_tcp_write(conn, buffer, bytes_to_send); - } - - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - g_free(value); - - break; - - case NMFIELD_TYPE_ARRAY: - case NMFIELD_TYPE_MV: - - val = nm_count_fields((NMField *) field->ptr_value); - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&val=%u", val); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - break; - - default: - - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&val=%u", field->value); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - break; - } - } - - /* Write the field type */ - if (rc == NM_OK) { - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "&type=%u", field->type); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - - /* If the field is a sub array then post its fields */ - if (rc == NM_OK && val > 0) { - if (field->type == NMFIELD_TYPE_ARRAY || - field->type == NMFIELD_TYPE_MV) { - - rc = nm_write_fields(conn, (NMField *) field->ptr_value); - - } - } - } - - return rc; -} - -NMERR_T -nm_send_request(NMConn *conn, char *cmd, NMField *fields, - nm_response_cb cb, gpointer data, NMRequest **request) -{ - NMERR_T rc = NM_OK; - char buffer[512]; - int bytes_to_send; - int ret; - NMField *request_fields = NULL; - char *str = NULL; - - if (conn == NULL || cmd == NULL) - return NMERR_BAD_PARM; - - /* Write the post */ - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "POST /%s HTTP/1.0\r\n", cmd); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - - /* Write headers */ - if (rc == NM_OK) { - if (strcmp("login", cmd) == 0) { - bytes_to_send = g_snprintf(buffer, sizeof(buffer), - "Host: %s:%d\r\n\r\n", conn->addr, conn->port); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } else { - bytes_to_send = g_snprintf(buffer, sizeof(buffer), "\r\n"); - ret = nm_tcp_write(conn, buffer, bytes_to_send); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - } - - /* Add the transaction id to the request fields */ - if (rc == NM_OK) { - if (fields) - request_fields = nm_copy_field_array(fields); - - str = g_strdup_printf("%d", ++(conn->trans_id)); - request_fields = nm_field_add_pointer(request_fields, NM_A_SZ_TRANSACTION_ID, 0, - NMFIELD_METHOD_VALID, 0, - str, NMFIELD_TYPE_UTF8); - } - - /* Send the request to the server */ - if (rc == NM_OK) { - rc = nm_write_fields(conn, request_fields); - } - - /* Write the CRLF to terminate the data */ - if (rc == NM_OK) { - ret = nm_tcp_write(conn, "\r\n", strlen("\r\n")); - if (ret < 0) { - rc = NMERR_TCP_WRITE; - } - } - - /* Create a request struct, add it to our queue, and return it */ - if (rc == NM_OK) { - NMRequest *new_request = nm_create_request(cmd, conn->trans_id, - time(0), cb, NULL, data); - nm_conn_add_request_item(conn, new_request); - - /* Set the out param if it was sent in, otherwise release the request */ - if (request) - *request = new_request; - else - nm_release_request(new_request); - } - - if (request_fields != NULL) - nm_free_fields(&request_fields); - - return rc; -} - -NMERR_T -nm_read_header(NMConn * conn) -{ - NMERR_T rc = NM_OK; - char buffer[512]; - char *ptr = NULL; - int i; - char rtn_buf[8]; - int rtn_code = 0; - - if (conn == NULL) - return NMERR_BAD_PARM; - - *buffer = '\0'; - rc = read_line(conn, buffer, sizeof(buffer)); - if (rc == NM_OK) { - - /* Find the return code */ - ptr = strchr(buffer, ' '); - if (ptr != NULL) { - ptr++; - - i = 0; - while (isdigit(*ptr) && (i < 3)) { - rtn_buf[i] = *ptr; - i++; - ptr++; - } - rtn_buf[i] = '\0'; - - if (i > 0) - rtn_code = atoi(rtn_buf); - } - } - - /* Finish reading header, in the future we might want to do more processing here */ - /* TODO: handle more general redirects in the future */ - while ((rc == NM_OK) && (strcmp(buffer, "\r\n") != 0)) { - rc = read_line(conn, buffer, sizeof(buffer)); - } - - if (rc == NM_OK && rtn_code == 301) - rc = NMERR_SERVER_REDIRECT; - - return rc; -} - -NMERR_T -nm_read_fields(NMConn * conn, int count, NMField ** fields) -{ - NMERR_T rc = NM_OK; - guint8 type; - guint8 method; - guint32 val; - char tag[64]; - NMField *sub_fields = NULL; - char *str = NULL; - - if (conn == NULL || fields == NULL) - return NMERR_BAD_PARM; - - do { - if (count > 0) { - count--; - } - - /* Read the field type, method, and tag */ - rc = nm_read_all(conn, (char *)&type, sizeof(type)); - if (rc != NM_OK || type == 0) - break; - - rc = nm_read_all(conn, (char *)&method, sizeof(method)); - if (rc != NM_OK) - break; - - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - if (val > sizeof(tag)) { - rc = NMERR_PROTOCOL; - break; - } - - rc = nm_read_all(conn, tag, val); - if (rc != NM_OK) - break; - - if (type == NMFIELD_TYPE_MV || type == NMFIELD_TYPE_ARRAY) { - - /* Read the subarray (first read the number of items in the array) */ - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - if (val > 0) { - rc = nm_read_fields(conn, val, &sub_fields); - if (rc != NM_OK) - break; - } - - *fields = nm_field_add_pointer(*fields, tag, 0, method, - 0, sub_fields, type); - - sub_fields = NULL; - - } else if (type == NMFIELD_TYPE_UTF8 || type == NMFIELD_TYPE_DN) { - - /* Read the string (first read the length) */ - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - if (val >= NMFIELD_MAX_STR_LENGTH) { - rc = NMERR_PROTOCOL; - break; - } - - if (val > 0) { - str = g_new0(char, val + 1); - - rc = nm_read_all(conn, str, val); - if (rc != NM_OK) - break; - - *fields = nm_field_add_pointer(*fields, tag, 0, method, - 0, str, type); - str = NULL; - } - - } else { - - /* Read the numerical value */ - rc = nm_read_uint32(conn, &val); - if (rc != NM_OK) - break; - - *fields = nm_field_add_number(*fields, tag, 0, method, - 0, val, type); - } - - } while ((type != 0) && (count != 0)); - - - if (str != NULL) { - g_free(str); - } - - if (sub_fields != NULL) { - nm_free_fields(&sub_fields); - } - - return rc; -} - -void -nm_conn_add_request_item(NMConn * conn, NMRequest * request) -{ - if (conn == NULL || request == NULL) - return; - - nm_request_add_ref(request); - conn->requests = g_slist_append(conn->requests, request); -} - -void -nm_conn_remove_request_item(NMConn * conn, NMRequest * request) -{ - if (conn == NULL || request == NULL) - return; - - conn->requests = g_slist_remove(conn->requests, request); - nm_release_request(request); -} - -NMRequest * -nm_conn_find_request(NMConn * conn, int trans_id) -{ - NMRequest *req = NULL; - GSList *itr = NULL; - - if (conn == NULL) - return NULL; - - itr = conn->requests; - while (itr) { - req = (NMRequest *) itr->data; - if (req != NULL && nm_request_get_trans_id(req) == trans_id) { - return req; - } - itr = g_slist_next(itr); - } - return NULL; -} - -const char * -nm_conn_get_addr(NMConn * conn) -{ - if (conn == NULL) - return NULL; - else - return conn->addr; -} - -int -nm_conn_get_port(NMConn * conn) -{ - if (conn == NULL) - return -1; - else - return conn->port; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* - * nmconn.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_CONN_H__ -#define __NM_CONN_H__ - -typedef struct _NMConn NMConn; -typedef struct _NMSSLConn NMSSLConn; - -#include "nmfield.h" -#include "nmuser.h" - -typedef int (*nm_ssl_read_cb) (gpointer ssl_data, void *buff, int len); -typedef int (*nm_ssl_write_cb) (gpointer ssl_data, const void *buff, int len); - -struct _NMConn -{ - - /* The address of the server that we are connecting to. */ - char *addr; - - /* The port that we are connecting to. */ - int port; - - /* The file descriptor of the socket for the connection. */ - int fd; - - /* The transaction counter. */ - int trans_id; - - /* A list of requests currently awaiting a response. */ - GSList *requests; - - /* Are we connected? TRUE if so, FALSE if not. */ - gboolean connected; - - /* Are we running in secure mode? */ - gboolean use_ssl; - - /* Have we been redirected? */ - gboolean redirect; - - /* SSL connection */ - NMSSLConn *ssl_conn; - -}; - -struct _NMSSLConn -{ - - /* Data to pass to the callbacks */ - gpointer data; - - /* Callbacks for reading/writing */ - nm_ssl_read_cb read; - nm_ssl_write_cb write; - -}; - -/** - * Allocate a new NMConn struct - * - * @param The address of the server that we are connecting to. - * @param The port that we are connecting to. - * - * @return A pointer to a newly allocated NMConn struct, should - * be freed by calling nm_release_conn() - */ -NMConn *nm_create_conn(const char *addr, int port); - -/** - * Release an NMConn - * - * @param Pointer to the NMConn to release. - * - */ -void nm_release_conn(NMConn *conn); - -/** - * Write len bytes from the given buffer. - * - * @param conn The connection to write to. - * @param buff The buffer to write from. - * @param len The number of bytes to write. - * - * @return The number of bytes written. - */ -int nm_tcp_write(NMConn * conn, const void *buff, int len); - -/** - * Read at most len bytes into the given buffer. - * - * @param conn The connection to read from. - * @param buff The buffer to write to. - * @param len The maximum number of bytes to read. - * - * @return The number of bytes read. - */ -int nm_tcp_read(NMConn * conn, void *buff, int len); - -/** - * Read exactly len bytes into the given buffer. - * - * @param conn The connection to read from. - * @param buff The buffer to write to. - * @param len The number of bytes to read. - * - * @return NM_OK on success, NMERR_TCP_READ if read fails. - */ -NMERR_T nm_read_all(NMConn * conn, char *buf, int len); - -/** - * Read a 32 bit value and convert it to the host byte order. - * - * @param conn The connection to read from. - * @param val A pointer to unsigned 32 bit integer - * - * @return NM_OK on success, NMERR_TCP_READ if read fails. - */ -NMERR_T -nm_read_uint32(NMConn *conn, guint32 *val); - -/** - * Read a 16 bit value and convert it to the host byte order. - * - * @param conn The connection to read from. - * @param val A pointer to unsigned 16 bit integer - * - * @return NM_OK on success, NMERR_TCP_READ if read fails. - */ -NMERR_T -nm_read_uint16(NMConn *conn, guint16 *val); - -/** - * Dispatch a request to the server. - * - * @param conn The connection. - * @param cmd The request to dispatch. - * @param fields The field list for the request. - * @param cb The response callback for the new request object. - * @param data The user defined data for the request (to be passed to the resp cb). - * @param req The request. Should be freed with nm_release_request. - * - * @return NM_OK on success. - */ -NMERR_T -nm_send_request(NMConn *conn, char *cmd, NMField *fields, - nm_response_cb cb, gpointer data, NMRequest **request); - -/** - * Write out the given field list. - * - * @param conn The connection to write to. - * @param fields The field list to write. - * - * @return NM_OK on success. - */ -NMERR_T nm_write_fields(NMConn * conn, NMField * fields); - -/** - * Read the headers for a response. - * - * @param conn The connection to read from. - * - * @return NM_OK on success. - */ -NMERR_T nm_read_header(NMConn * conn); - -/** - * Read a field list from the connection. - * - * @param conn The connection to read from. - * @param count The maximum number of fields to read (or -1 for no max). - * @param fields The field list. This is an out param. It - * should be freed by calling nm_free_fields - * when finished. - * - * @return NM_OK on success. - */ -NMERR_T nm_read_fields(NMConn * conn, int count, NMField ** fields); - -/** - * Add a request to the connections request list. - * - * @param conn The connection. - * @param request The request to add to the list. - */ -void nm_conn_add_request_item(NMConn * conn, NMRequest * request); - -/** - * Remove a request from the connections list. - * - * @param conn The connection. - * @param request The request to remove from the list. - */ -void nm_conn_remove_request_item(NMConn * conn, NMRequest * request); - -/** - * Find the request with the given transaction id in the connections - * request list. - * - * @param conn The connection. - * @param trans_id The transaction id of the request to return. - * - * @return The request, or NULL if a matching request is not - * found. - */ -NMRequest *nm_conn_find_request(NMConn * conn, int trans_id); - -/** - * Get the server address for the connection. - * - * @param conn The connection. - * - * @return The server address for the connection. - * - */ -const char *nm_conn_get_addr(NMConn * conn); - -/** - * Get the port for the connection. - * - * @param conn The connection. - * - * @return The port that we are connected to. - */ -int nm_conn_get_port(NMConn * conn); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,972 +0,0 @@ -/* - * nmcontact.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include "nmcontact.h" -#include "nmfield.h" -#include "nmuser.h" - -struct _NMContact -{ - int id; - int parent_id; - int seq; - char *dn; - char *display_name; - NMUserRecord *user_record; - gpointer data; - int ref_count; -}; - -struct _NMFolder -{ - int id; - int seq; - char *name; - GSList *folders; - GSList *contacts; - int ref_count; -}; - -static int count = 0; - -static void _release_folder_contacts(NMFolder * folder); -static void _release_folder_folders(NMFolder * folder); -static void _add_contacts(NMUser * user, NMFolder * folder, NMField * fields); -static void _add_folders(NMFolder * root, NMField * fields); - -/********************************************************************* - * Contact API - *********************************************************************/ - -NMContact * -nm_create_contact() -{ - NMContact *contact = g_new0(NMContact, 1); - - contact->ref_count = 1; - - purple_debug(PURPLE_DEBUG_INFO, "novell", "Creating contact, total=%d\n", - count++); - - return contact; -} - -/* - * This creates a contact for the contact list. The - * field array that is passed in should be a - * NM_A_FA_CONTACT array. - * - */ -NMContact * -nm_create_contact_from_fields(NMField * fields) -{ - NMContact *contact; - NMField *field; - - if ( fields == NULL || fields->tag == NULL || fields->ptr_value == 0 || - strcmp(fields->tag, NM_A_FA_CONTACT) ) - { - return NULL; - } - - contact = nm_create_contact(); - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->id = atoi((char *) field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_PARENT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->parent_id = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->seq = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->display_name = g_strdup((char *) field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_DN, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->dn = g_strdup((char *) field->ptr_value); - - } - - return contact; -} - -void -nm_contact_update_list_properties(NMContact * contact, NMField * fields) -{ - NMField *field; - - if (contact == NULL || fields == NULL || fields->ptr_value == 0) - return; - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->id = atoi((char *)field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_PARENT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->parent_id = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - contact->seq = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) { - if (contact->display_name) - g_free(contact->display_name); - - contact->display_name = g_strdup((char *) field->ptr_value); - } - - } - - if ((field = nm_locate_field(NM_A_SZ_DN, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) { - if (contact->dn) - g_free(contact->dn); - - contact->dn = g_strdup((char *) field->ptr_value); - } - - } -} - -NMField * -nm_contact_to_fields(NMContact * contact) -{ - NMField *fields = NULL; - - if (contact == NULL) - return NULL; - - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", contact->id), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", contact->parent_id), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", contact->seq), NMFIELD_TYPE_UTF8); - - if (contact->display_name != NULL) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(contact->display_name), NMFIELD_TYPE_UTF8); - } - - if (contact->dn != NULL) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(contact->dn), NMFIELD_TYPE_UTF8); - } - - return fields; -} - -void -nm_contact_add_ref(NMContact * contact) -{ - if (contact) - contact->ref_count++; -} - -void -nm_release_contact(NMContact * contact) -{ - if (contact == NULL) - return; - - if (--(contact->ref_count) == 0) { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Releasing contact, total=%d\n", --count); - - if (contact->display_name) { - g_free(contact->display_name); - } - - if (contact->dn) { - g_free(contact->dn); - } - - if (contact->user_record) { - nm_release_user_record(contact->user_record); - } - - g_free(contact); - } - -} - -const char * -nm_contact_get_display_name(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - if (contact->user_record != NULL && contact->display_name == NULL) { - const char *full_name, *lname, *fname, *cn, *display_id; - - full_name = nm_user_record_get_full_name(contact->user_record); - fname = nm_user_record_get_first_name(contact->user_record); - lname = nm_user_record_get_last_name(contact->user_record); - cn = nm_user_record_get_userid(contact->user_record); - display_id = nm_user_record_get_display_id(contact->user_record); - - /* Try to build a display name. */ - if (full_name) { - - contact->display_name = g_strdup(full_name); - - } else if (fname && lname) { - - contact->display_name = g_strdup_printf("%s %s", fname, lname); - - } else { - - /* If auth attribute is set use it */ - if (nm_user_record_get_auth_attr(contact->user_record) && - display_id != NULL) { - - contact->display_name = g_strdup(display_id); - - } else { - - /* Use CN or display id */ - if (cn) { - - contact->display_name = g_strdup(cn); - - } else if (display_id) { - - contact->display_name = g_strdup(display_id); - - } - - } - - } - } - - return contact->display_name; -} - -void -nm_contact_set_display_name(NMContact * contact, const char *display_name) -{ - if (contact == NULL) - return; - - if (contact->display_name) { - g_free(contact->display_name); - contact->display_name = NULL; - } - - if (display_name) - contact->display_name = g_strdup(display_name); -} - -void -nm_contact_set_dn(NMContact * contact, const char *dn) -{ - if (contact == NULL) - return; - - if (contact->dn) { - g_free(contact->dn); - contact->dn = NULL; - } - - if (dn) - contact->dn = g_strdup(dn); -} - -const char * -nm_contact_get_dn(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - return contact->dn; -} - -gpointer -nm_contact_get_data(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - return contact->data; -} - -int -nm_contact_get_id(NMContact * contact) -{ - if (contact == NULL) - return -1; - - return contact->id; -} - -int -nm_contact_get_parent_id(NMContact * contact) -{ - if (contact == NULL) - return -1; - - return contact->parent_id; -} - -void -nm_contact_set_data(NMContact * contact, gpointer data) -{ - if (contact == NULL) - return; - - contact->data = data; -} - -void -nm_contact_set_user_record(NMContact * contact, NMUserRecord * user_record) -{ - if (contact == NULL) - return; - - if (contact->user_record) { - nm_release_user_record(contact->user_record); - } - - nm_user_record_add_ref(user_record); - contact->user_record = user_record; -} - -NMUserRecord * -nm_contact_get_user_record(NMContact * contact) -{ - if (contact == NULL) - return NULL; - - return contact->user_record; -} - -const char * -nm_contact_get_userid(NMContact * contact) -{ - NMUserRecord *user_record; - const char *userid = NULL; - - if (contact == NULL) - return NULL; - - user_record = nm_contact_get_user_record(contact); - if (user_record) { - userid = nm_user_record_get_userid(user_record); - } - - return userid; -} - -const char * -nm_contact_get_display_id(NMContact * contact) -{ - NMUserRecord *user_record; - const char *id = NULL; - - if (contact == NULL) - return NULL; - - user_record = nm_contact_get_user_record(contact); - if (user_record) { - id = nm_user_record_get_display_id(user_record); - } - - return id; -} - - -/********************************************************************* - * Folder API - *********************************************************************/ - -NMFolder * -nm_create_folder(const char *name) -{ - NMFolder *folder = g_new0(NMFolder, 1); - - if (name) - folder->name = g_strdup(name); - - folder->ref_count = 1; - - return folder; -} - -NMFolder * -nm_create_folder_from_fields(NMField * fields) -{ - NMField *field; - NMFolder *folder; - - if (fields == NULL || fields->ptr_value == 0) - return NULL; - - folder = g_new0(NMFolder, 1); - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->id = atoi((char *) field->ptr_value); - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->seq = atoi((char *) field->ptr_value); - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->name = g_strdup((char *) field->ptr_value); - } - - folder->ref_count = 1; - return folder; -} - -NMField * -nm_folder_to_fields(NMFolder * folder) -{ - NMField *fields = NULL; - - if (folder == NULL) - return NULL; - - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", folder->id), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("0"), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_TYPE, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("1"), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", folder->seq), NMFIELD_TYPE_UTF8); - - if (folder->name != NULL) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(folder->name), NMFIELD_TYPE_UTF8); - } - - - return fields; -} - -void -nm_folder_update_list_properties(NMFolder * folder, NMField * fields) -{ - NMField *field; - - if (folder == NULL || fields == NULL || fields->ptr_value == 0) - return; - - if ((field = nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->id = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_SEQUENCE_NUMBER, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) - folder->seq = atoi((char *) field->ptr_value); - - } - - if ((field = - nm_locate_field(NM_A_SZ_DISPLAY_NAME, (NMField *) fields->ptr_value))) { - - if (field->ptr_value) { - if (folder->name) - g_free(folder->name); - - folder->name = g_strdup((char *) field->ptr_value); - } - - } - -} - -void -nm_release_folder(NMFolder * folder) -{ - if (folder == NULL) - return; - - if (--(folder->ref_count) == 0) { - if (folder->name) { - g_free(folder->name); - } - - if (folder->folders) { - _release_folder_folders(folder); - } - - if (folder->contacts) { - _release_folder_contacts(folder); - } - - g_free(folder); - } -} - - -void -nm_folder_add_ref(NMFolder * folder) -{ - if (folder) - folder->ref_count++; -} - -int -nm_folder_get_subfolder_count(NMFolder * folder) -{ - if (folder == NULL) - return 0; - - if (folder->folders) - return g_slist_length(folder->folders); - else - return 0; -} - -NMFolder * -nm_folder_get_subfolder(NMFolder * folder, int index) -{ - if (folder == NULL) - return NULL; - - if (folder->folders) - return (NMFolder *) g_slist_nth_data(folder->folders, index); - else - return NULL; -} - -int -nm_folder_get_contact_count(NMFolder * folder) -{ - if (folder == NULL) - return 0; - - if (folder->contacts != NULL) - return g_slist_length(folder->contacts); - else - return 0; -} - -NMContact * -nm_folder_get_contact(NMFolder * folder, int index) -{ - if (folder == NULL) - return NULL; - - if (folder->contacts) - return (NMContact *) g_slist_nth_data(folder->contacts, index); - else - return NULL; -} - -const char * -nm_folder_get_name(NMFolder * folder) -{ - if (folder == NULL) - return NULL; - - return folder->name; -} - -void -nm_folder_set_name(NMFolder * folder, const char *name) -{ - if (folder == NULL || name == NULL) - return; - - if (folder->name) - g_free(folder->name); - - folder->name = g_strdup(name); -} - -int -nm_folder_get_id(NMFolder * folder) -{ - if (folder == NULL) { - return -1; - } - - return folder->id; -} - -void -nm_folder_add_folder_to_list(NMFolder * root, NMFolder * folder) -{ - GSList *node; - - if (root == NULL || folder == NULL) - return; - - node = root->folders; - while (node) { - if (folder->seq <= ((NMFolder *) node->data)->seq) { - nm_folder_add_ref(folder); - root->folders = g_slist_insert_before(root->folders, node, folder); - break; - } - node = g_slist_next(node); - } - if (node == NULL) { - nm_folder_add_ref(folder); - root->folders = g_slist_append(root->folders, folder); - } -} - -void -nm_folder_remove_contact(NMFolder * folder, NMContact * contact) -{ - GSList *node; - - if (folder == NULL || contact == NULL) - return; - - node = folder->contacts; - while (node) { - if (contact->id == ((NMContact *) (node->data))->id) { - folder->contacts = g_slist_remove(folder->contacts, node->data); - nm_release_contact(contact); - break; - } - node = g_slist_next(node); - } -} - -void -nm_folder_add_contact_to_list(NMFolder * root_folder, NMContact * contact) -{ - GSList *node = NULL; - NMFolder *folder = root_folder; - - if (folder == NULL || contact == NULL) - return; - - /* Find folder to add contact to */ - if (contact->parent_id != 0) { - node = folder->folders; - while (node) { - folder = (NMFolder *) node->data; - if (contact->parent_id == folder->id) { - break; - } - folder = NULL; - node = g_slist_next(node); - } - } - - /* Add contact to list */ - if (folder) { - node = folder->contacts; - while (node) { - if (contact->seq <= ((NMContact *) (node->data))->seq) { - nm_contact_add_ref(contact); - folder->contacts = - g_slist_insert_before(folder->contacts, node, contact); - break; - } - node = g_slist_next(node); - } - - if (node == NULL) { - nm_contact_add_ref(contact); - folder->contacts = g_slist_append(folder->contacts, contact); - } - } -} - -void -nm_folder_add_contacts_and_folders(NMUser * user, NMFolder * root, - NMField * fields) -{ - /* Add the contacts and folders from the field array */ - if (user && root && fields) { - _add_folders(root, fields); - _add_contacts(user, root, fields); - } -} - -gpointer -nm_folder_find_item_by_object_id(NMFolder * root_folder, int object_id) -{ - int cnt, cnt2, i, j; - gpointer item = NULL; - NMFolder *folder; - NMContact *contact; - - if (root_folder == NULL) - return NULL; - - /* Check all contacts for the top level folder */ - cnt = nm_folder_get_contact_count(root_folder); - for (i = 0; i < cnt; i++) { - contact = nm_folder_get_contact(root_folder, i); - if (contact && (contact->id == object_id)) { - item = contact; - break; - } - } - - /* If we haven't found the item yet, check the subfolders */ - if (item == NULL) { - cnt = nm_folder_get_subfolder_count(root_folder); - for (i = 0; (i < cnt) && (item == NULL); i++) { - folder = nm_folder_get_subfolder(root_folder, i); - - /* Check the id of this folder */ - if (folder && (folder->id == object_id)) { - item = folder; - break; - } - - /* Check all contacts for this folder */ - cnt2 = nm_folder_get_contact_count(folder); - for (j = 0; j < cnt2; j++) { - contact = nm_folder_get_contact(folder, j); - if (contact && (contact->id == object_id)) { - item = contact; - break; - } - } - } - } - - return item; -} - -NMContact * -nm_folder_find_contact_by_userid(NMFolder * folder, const char *userid) -{ - int cnt, i; - NMContact *tmp, *contact = NULL; - - if (folder == NULL || userid == NULL) - return NULL; - - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - tmp = nm_folder_get_contact(folder, i); - if (tmp && nm_utf8_str_equal(nm_contact_get_userid(tmp), userid)) { - contact = tmp; - break; - } - } - - return contact; -} - -NMContact * -nm_folder_find_contact_by_display_id(NMFolder * folder, const char *display_id) -{ - int cnt, i; - NMContact *tmp, *contact = NULL; - - if (folder == NULL || display_id == NULL) - return NULL; - - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - tmp = nm_folder_get_contact(folder, i); - if (tmp && nm_utf8_str_equal(nm_contact_get_display_id(tmp), display_id)) { - contact = tmp; - break; - } - } - - return contact; -} - -NMContact * -nm_folder_find_contact(NMFolder * folder, const char *dn) -{ - int cnt, i; - NMContact *tmp, *contact = NULL; - - if (folder == NULL || dn == NULL) - return NULL; - - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - tmp = nm_folder_get_contact(folder, i); - if (tmp && nm_utf8_str_equal(nm_contact_get_dn(tmp), dn)) { - contact = tmp; - break; - } - } - - return contact; -} - - -/********************************************************************* - * Utility functions - *********************************************************************/ - -static void -_release_folder_contacts(NMFolder * folder) -{ - GSList *cnode; - NMContact *contact; - - for (cnode = folder->contacts; cnode; cnode = cnode->next) { - contact = cnode->data; - cnode->data = NULL; - nm_release_contact(contact); - } - - g_slist_free(folder->contacts); - folder->contacts = NULL; -} - -static void -_release_folder_folders(NMFolder * folder) -{ - GSList *fnode; - NMFolder *subfolder; - - if (folder == NULL) - return; - - for (fnode = folder->folders; fnode; fnode = fnode->next) { - subfolder = fnode->data; - fnode->data = NULL; - nm_release_folder(subfolder); - } - - g_slist_free(folder->folders); - folder->folders = NULL; -} - -static void -_add_folders(NMFolder * root, NMField * fields) -{ - NMFolder *folder = NULL; - NMField *locate = NULL; - - locate = nm_locate_field(NM_A_FA_FOLDER, fields); - while (locate != NULL) { - - /* Create a new folder */ - folder = nm_create_folder_from_fields(locate); - - /* Add subfolder to roots folder list */ - nm_folder_add_folder_to_list(root, folder); - - /* Decrement the ref count */ - nm_release_folder(folder); - - /* Find the next folder */ - locate = nm_locate_field(NM_A_FA_FOLDER, locate+1); - - } -} - -static void -_add_contacts(NMUser * user, NMFolder * folder, NMField * fields) -{ - NMContact *contact = NULL; - NMField *locate = NULL, *details; - NMUserRecord *user_record = NULL; - - locate = nm_locate_field(NM_A_FA_CONTACT, fields); - while (locate != NULL) { - - /* Create a new contact from the fields */ - contact = nm_create_contact_from_fields(locate); - - /* Add it to our contact list */ - nm_folder_add_contact_to_list(folder, contact); - - /* Update the contact cache */ - nm_user_add_contact(user, contact); - - /* Update the user record cache */ - if ((details = nm_locate_field(NM_A_FA_USER_DETAILS, - (NMField *) locate->ptr_value))) { - user_record = nm_find_user_record(user, nm_contact_get_dn(contact)); - if (user_record == NULL) { - user_record = nm_create_user_record_from_fields(details); - nm_user_record_set_dn(user_record, nm_contact_get_dn(contact)); - nm_user_add_user_record(user, user_record); - nm_release_user_record(user_record); - } - nm_contact_set_user_record(contact, user_record); - } - - nm_release_contact(contact); - - locate = nm_locate_field(NM_A_FA_CONTACT, locate+1); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmcontact.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,425 +0,0 @@ -/* - * nmcontact.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_CONTACT_H__ -#define __NM_CONTACT_H__ - -#include - -typedef struct _NMContact NMContact; -typedef struct _NMContactProperty NMContactProperty; -typedef struct _NMFolder NMFolder; - -#include "nmfield.h" -#include "nmuser.h" - -/** - * Creates a contact - * - * Should be released by calling nm_release_contact - * - * @return The new NMContact - * - */ -NMContact *nm_create_contact(void); - -/** - * Creates a contact from a field array representing the - * contact - * - * Should be released by calling nm_release_contact - * - * @param fields Should be the NM_A_FA_CONTACT for - * the contact - * - * @return The new contact - * - */ -NMContact *nm_create_contact_from_fields(NMField * fields); - -/** - * Add a reference to an existing contact - * - * The reference should be released by calling - * nm_release_contact - * - * @param contact The contact - * - */ -void nm_contact_add_ref(NMContact * contact); - -/** - * Update the contact list properties of the contact (sequence, parent id, etc.) - * - * @param contact The contact to update - * @param fields The fields to update from (should be a NM_A_FA_CONTACT array) - * - */ -void nm_contact_update_list_properties(NMContact * contact, NMField * fields); - -/** - * Release a contact reference - * - * @param contact The contact to release. - * - */ -void nm_release_contact(NMContact * contact); - -/** - * Get the display name of a contact - * - * @param contact The contact - * - * @return The display name of a contact - * - */ -const char *nm_contact_get_display_name(NMContact * contact); - -/** - * Get the DN of a contact - * - * @param contact The contact - * - * @return The DN of the contact - */ -const char *nm_contact_get_dn(NMContact * contact); - -/** - * Set the display name for a contact. This is called - * by nm_send_rename_contact. It should not be called - * directly (it does not change the display name on the - * server side list -- nm_send_rename_conact does). - * - * @param contact The contact - * @param display_name The new display name - * - */ -void nm_contact_set_display_name(NMContact * contact, const char * display_name); - -/** - * Set the DN for the contact - * - * @param contact The contact - * @param dn The new DN for the contact - * - */ -void nm_contact_set_dn(NMContact * contact, const char * dn); - -/** - * Return a field array (NM_A_FA_CONTACT) representing the contact - * - * @param contact The contact - * - * @return A field array representing the contact - */ -NMField *nm_contact_to_fields(NMContact * contact); - -/** - * Set the user record for the contact - * - * @param contact The contact - * @param user_record The user record - * - */ -void nm_contact_set_user_record(NMContact * contact, NMUserRecord * user_record); - -/** - * Get the user record for the contact - * - * @param contact The contact - * - * @return The user record associated with the contact - * - */ -NMUserRecord *nm_contact_get_user_record(NMContact * contact); - -/** - * Get the user defined data for the contact - * - * @param contact The contact - * - * @return The user defined data for the contact - * - */ -gpointer nm_contact_get_data(NMContact * contact); - -/** - * Get the Object ID for the contact - * - * @param contact The contact - * - * @return The ID for the contact - */ -int nm_contact_get_id(NMContact * contact); - -/** - * Get the ID for the folder that the contact is in - * - * @param contact The contact - * - * @return The ID of the folder that contains the contact - * - */ -int nm_contact_get_parent_id(NMContact * contact); - -/** - * Get The userid of the contact. - * - * @param contact The contact - * - * @return The userid of the contact - * - */ -const char *nm_contact_get_userid(NMContact * contact); - -/** - * Get the display id of the contact - * - * @param contact The contact - * - * @return The display id of the contact - */ -const char *nm_contact_get_display_id(NMContact * contact); - -/** - * Set the user defined data for the contact - * - * @param contact The contact - * @param data The user defined data - * - */ -void nm_contact_set_data(NMContact * contact, gpointer data); - -/** - * Create a folder with the given name - * - * @param name The name of the folder - * - * @return The new folder - * - */ -NMFolder *nm_create_folder(const char *name); - -/** - * Create a folder from a NM_A_FA_FOLDER field array - * - * @param fields The NM_A_FA_FOLDER field array - * - * @return The new folder - * - */ -NMFolder *nm_create_folder_from_fields(NMField * fields); - -/** - * Add a reference to an existing folder - * - * The reference should be released by calling - * nm_release_folder - * - * @param folder The folder - * - */ -void nm_folder_add_ref(NMFolder * folder); - -/** - * Release a reference to a folder. - * - * @param folder The folder to release - * - */ -void nm_release_folder(NMFolder * folder); - -/** - * Return the number of subfolders for the given - * folder - * - * @param folder The folder - * - * @return The number of subfolders contained by folder - */ -int nm_folder_get_subfolder_count(NMFolder * folder); - -/** - * Get a subfolder - * - * @param folder The root folder - * @param index The index of the folder to get - * - * @return The subfolder at the given index - * - */ -NMFolder *nm_folder_get_subfolder(NMFolder * folder, int index); - -/** - * Get the number of contacts in the given folder - * - * @param folder The folder - * - * @return The number of contacts contained by folder - * - */ -int nm_folder_get_contact_count(NMFolder * folder); - -/** - * Get a contact in the given folder - * - * @param folder The folder - * @param index The index of the contact to get - * - * @return The contact at the given index - * - */ -NMContact *nm_folder_get_contact(NMFolder * folder, int index); - -/** - * Get the name of the folder - * - * @param folder The folder - * - * @return The name of the folder. - * - */ -const char *nm_folder_get_name(NMFolder * folder); - -/** - * Set the name of a folder. Do not call this directly. - * It does not change the name of the folder in the - * server side contact list. You must call - * nm_send_set_folder_name(). - * - * @param folder The folder - * @param name The new name for the folder - * - */ -void nm_folder_set_name(NMFolder * folder, const char *name); - -/** - * Get Object ID for folder - * - * @param folder The folder - * - * @return The ID of the folder - * - */ -int nm_folder_get_id(NMFolder * folder); - -/** - * Add contacts and folders from fields into root - * - * @param user The logged in user - * @param root The root folder - * @param fields The contact list field array - * - */ -void nm_folder_add_contacts_and_folders(NMUser * user, NMFolder * root, - NMField * fields); -/** - * Add a contact to the contact list. - * - * @param root_folder The root folder of the contact list - * @param contact The contact to add - * - */ -void nm_folder_add_contact_to_list(NMFolder * root_folder, - NMContact * contact); - -/** - * Update the contact list properties of the folder (sequence, parent id, etc.) - * - * @param folder The folder to update - * @param fields The fields to update from (should be a NM_A_FA_FOLDER array) - * - */ -void nm_folder_update_list_properties(NMFolder * folder, NMField * fields); - -/** - * Add folder to the contact list - * - * @param root_folder The root folder of the contact list - * @param folder The folder to add to the contact list - * - */ -void nm_folder_add_folder_to_list(NMFolder * root_folder, NMFolder * folder); - -/** - * Find the object with the given id - * - * @param root_folder The root folder of the contact list - * @param object_id The object id of the object to find - * - * @return The object with object id (either a contact or a folder) - */ -gpointer nm_folder_find_item_by_object_id(NMFolder * root_folder, - int object_id); - -/** - * Remove a contact from the folder - * - * @param folder The folder - * @param contact The contact to remove - * - */ -void nm_folder_remove_contact(NMFolder * folder, NMContact * contact); - -/** - * Find a contact in a folder by DN - * - * @param folder The folder to search - * @param dn The DN of the contact to find - * - * @return The contact if found, NULL otherwise - * - */ -NMContact *nm_folder_find_contact(NMFolder * folder, const char *dn); - -/** - * Find a contact in a folder by userid - * - * @param folder The folder to search - * @param userid The userid of the contact to find - * - * @return The contact if found, NULL otherwise - * - */ -NMContact *nm_folder_find_contact_by_userid(NMFolder * folder, - const char *userid); - -/** - * Find a contact in a folder by display id - * - * @param folder The folder to search - * @param display_id The userid of the contact to find - * - * @return The contact if found, NULL otherwise - * - */ -NMContact * -nm_folder_find_contact_by_display_id(NMFolder * folder, const char *display_id); - -/** - * Return a field array (NM_A_FA_FOLDER) representing the folder - * - * @param folder The folder - * - * @return A field array representing the folder - */ -NMField *nm_folder_to_fields(NMFolder * folder); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,940 +0,0 @@ -/* - * nmevent.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include -#include "nmevent.h" -#include "nmfield.h" -#include "nmconn.h" -#include "nmuserrecord.h" -#include "nmrtf.h" - -#define MAX_UINT32 0xFFFFFFFF - -struct _NMEvent -{ - - /* Event type */ - int type; - - /* The DN of the event source */ - char *source; - - /* Timestamp of the event */ - guint32 gmt; - - /* Conference to associate with the event */ - NMConference *conference; - - /* User record to associate with the event */ - NMUserRecord *user_record; - - /* Text associated with the event */ - char *text; - - /* Reference count for event structure */ - int ref_count; - -}; - -/* Handle getdetails response and set the new user record into the event */ -static void -_got_user_for_event(NMUser * user, NMERR_T ret_val, - gpointer resp_data, gpointer user_data) -{ - NMUserRecord *user_record; - NMEvent *event; - nm_event_cb cb; - - if (user == NULL) - return; - - user_record = resp_data; - event = user_data; - - if (ret_val == NM_OK) { - if (event && user_record) { - - /* Add the user record to the event structure - * and make the callback. - */ - nm_event_set_user_record(event, user_record); - if ((cb = nm_user_get_event_callback(user))) { - cb(user, event); - } - } - - } else { - /* Cleanup resp_data */ - - } - - /* Clean up */ - if (event) - nm_release_event(event); - -} - -/* Handle getdetails response, set the new user record into the event - * and add the user record as a participant in the conference - */ -static void -_got_user_for_conference(NMUser * user, NMERR_T ret_val, - gpointer resp_data, gpointer user_data) -{ - NMUserRecord *user_record = resp_data; - NMEvent *event = user_data; - NMConference *conference; - nm_event_cb cb; - - if (user == NULL) - return; - - if (event && user_record) { - - conference = nm_event_get_conference(event); - if (conference) { - - /* Add source of event as recip of the conference */ - nm_conference_add_participant(conference, user_record); - - /* Add the user record to the event structure - * and make the callback. - */ - nm_event_set_user_record(event, user_record); - if ((cb = nm_user_get_event_callback(user))) { - cb(user, event); - } - } - } - - if (event) - nm_release_event(event); -} - -/* Read the receive message event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_receive_message(NMUser * user, NMEvent * event, gboolean autoreply) -{ - NMConference *conference; - NMUserRecord *user_record; - NMConn *conn; - NMERR_T rc = NM_OK; - guint32 size = 0, flags = 0; - char *msg = NULL; - char *nortf = NULL; - char *guid = NULL; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the conference flags */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &flags); - } - - /* Read the message text */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - msg = g_new0(char, size + 1); - rc = nm_read_all(conn, msg, size); - - purple_debug(PURPLE_DEBUG_INFO, "novell", "Message is %s\n", msg); - - /* Auto replies are not in RTF format! */ - if (!autoreply) { - NMRtfContext *ctx; - - ctx = nm_rtf_init(); - nortf = nm_rtf_strip_formatting(ctx, msg); - nm_rtf_deinit(ctx); - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Message without RTF is %s\n", nortf); - - /* Store the event data */ - nm_event_set_text(event, nortf); - - } else { - - /* Store the event data */ - nm_event_set_text(event, msg); - } - } - } - - /* Check to see if we already know about the conference */ - conference = nm_conference_list_find(user, guid); - if (conference) { - - nm_conference_set_flags(conference, flags); - nm_event_set_conference(event, conference); - - /* Add a reference to the user record in our event object */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - nm_event_set_user_record(event, user_record); - } - - } else { - - /* This is a new conference, so create one and add it to our list */ - conference = nm_create_conference(guid); - nm_conference_set_flags(conference, flags); - - /* Add a reference to the conference in the event */ - nm_event_set_conference(event, conference); - - /* Add new conference to the conference list */ - nm_conference_list_add(user, conference); - - /* Check to see if we have details for the event source yet */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - /* We do so add the user record as a recipient of the conference */ - nm_conference_add_participant(conference, user_record); - - /* Add a reference to the user record in our event object */ - nm_event_set_user_record(event, user_record); - - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_conference, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - nm_release_conference(conference); - } - - if (msg) - g_free(msg); - - if (nortf) - g_free(nortf); - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the invite event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_conference_invite(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - char *msg = NULL; - NMConn *conn; - NMUserRecord *user_record; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the the message */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - msg = g_new0(char, size + 1); - rc = nm_read_all(conn, msg, size); - } - } - - /* Store the event data */ - if (rc == NM_OK) { - NMConference *conference; - - nm_event_set_text(event, msg); - - conference = nm_conference_list_find(user, guid); - if (conference == NULL) { - conference = nm_create_conference(guid); - - /* Add new conference to the list and the event */ - nm_conference_list_add(user, conference); - nm_event_set_conference(event, conference); - - /* Check to see if we have details for the event source yet */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - /* Add a reference to the user record in our event object */ - nm_event_set_user_record(event, user_record); - - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_event, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - nm_release_conference(conference); - - } - } - - if (msg) - g_free(msg); - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the invite notify event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_conference_invite_notify(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConn *conn; - NMConference *conference; - NMUserRecord *user_record; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - - /* Check to see if we have details for the event source yet */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - /* Add a reference to the user record in our event object */ - nm_event_set_user_record(event, user_record); - - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_event, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference reject event and set up the event object */ -static NMERR_T -handle_conference_reject(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConn *conn; - NMConference *conference; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference left event, set up the event object, and - * remove the conference from the list if there are no more - * participants - */ -static NMERR_T -handle_conference_left(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0, flags = 0; - char *guid = NULL; - NMConference *conference; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the conference flags */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &flags); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - nm_conference_set_flags(conference, flags); - - nm_conference_remove_participant(conference, nm_event_get_source(event)); - if (nm_conference_get_participant_count(conference) == 0) { - nm_conference_list_remove(user, conference); - } - - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference closed, set up the event object, and - * remove the conference from the list - */ -static NMERR_T -handle_conference_closed(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConference *conference; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - nm_conference_list_remove(user, conference); - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the conference joined event, set up the event object, and - * get details for the event source if we don't have them yet. - */ -static NMERR_T -handle_conference_joined(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0, flags = 0; - char *guid = NULL; - NMConn *conn; - NMConference *conference; - NMUserRecord *user_record; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - /* Read the conference flags */ - if (rc == NM_OK) { - rc = nm_read_uint32(conn, &flags); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_conference_set_flags(conference, flags); - - nm_event_set_conference(event, conference); - - /* Add the new user to the participants list */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - nm_conference_remove_participant(conference, - nm_user_record_get_dn(user_record)); - nm_conference_add_participant(conference, user_record); - } else { - - /* Need to go to the server to get details for the user */ - rc = nm_send_get_details(user, nm_event_get_source(event), - _got_user_for_conference, event); - if (rc == NM_OK) - rc = -1; /* Not done processing the event yet! */ - } - - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the typing event and set up the event object */ -static NMERR_T -handle_typing(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConference *conference; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (rc == NM_OK) { - conference = nm_conference_list_find(user, guid); - if (conference) { - nm_event_set_conference(event, conference); - } else { - rc = NMERR_CONFERENCE_NOT_FOUND; - } - } - - if (guid) - g_free(guid); - - return rc; -} - -/* Read the event, set up the event object, and update - * the status in the user record (for the event source) - */ -static NMERR_T -handle_status_change(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint16 status; - guint32 size; - char *text = NULL; - NMUserRecord *user_record; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read new status */ - rc = nm_read_uint16(conn, &status); - if (rc == NM_OK) { - - /* Read the status text */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - text = g_new0(char, size + 1); - rc = nm_read_all(conn, text, size); - } - } - - if (rc == NM_OK) { - nm_event_set_text(event, text); - - /* Get a reference to the user record and store the new status */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - nm_event_set_user_record(event, user_record); - nm_user_record_set_status(user_record, status, text); - } - } - - if (text) - g_free(text); - - return rc; -} - -/* Read the undeliverable event */ -static NMERR_T -handle_undeliverable_status(NMUser * user, NMEvent * event) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - char *guid = NULL; - NMConn *conn; - - conn = nm_user_get_conn(user); - - /* Read the conference guid */ - rc = nm_read_uint32(conn, &size); - if (size == MAX_UINT32) return NMERR_PROTOCOL; - - if (rc == NM_OK) { - guid = g_new0(char, size + 1); - rc = nm_read_all(conn, guid, size); - } - - if (guid) - g_free(guid); - - return rc; -} - -/******************************************************************************* - * Event API -- see header file for comments - ******************************************************************************/ - -NMEvent * -nm_create_event(int type, const char *source, guint32 gmt) -{ - NMEvent *event = g_new0(NMEvent, 1); - - event->type = type; - event->gmt = gmt; - - if (source) - event->source = g_strdup(source); - - event->ref_count = 1; - - return event; -} - -void -nm_release_event(NMEvent * event) -{ - if (event == NULL) { - return; - } - - if (--(event->ref_count) == 0) { - - if (event->source) - g_free(event->source); - - if (event->conference) - nm_release_conference(event->conference); - - if (event->user_record) - nm_release_user_record(event->user_record); - - if (event->text) - g_free(event->text); - - g_free(event); - } -} - - -NMConference * -nm_event_get_conference(NMEvent * event) -{ - if (event) - return event->conference; - else - return NULL; -} - -void -nm_event_set_conference(NMEvent * event, NMConference * conference) -{ - if (event && conference) { - nm_conference_add_ref(conference); - event->conference = conference; - } -} - -NMUserRecord * -nm_event_get_user_record(NMEvent * event) -{ - if (event) - return event->user_record; - else - return NULL; -} - -void -nm_event_set_user_record(NMEvent * event, NMUserRecord * user_record) -{ - if (event && user_record) { - nm_user_record_add_ref(user_record); - event->user_record = user_record; - } -} - -const char * -nm_event_get_text(NMEvent * event) -{ - if (event) - return event->text; - else - return NULL; -} - -void -nm_event_set_text(NMEvent * event, const char *text) -{ - if (event) { - if (text) - event->text = g_strdup(text); - else - event->text = NULL; - } -} - -const char * -nm_event_get_source(NMEvent * event) -{ - if (event) - return event->source; - else - return NULL; -} - -int -nm_event_get_type(NMEvent * event) -{ - if (event) - return event->type; - else - return -1; -} - -time_t -nm_event_get_gmt(NMEvent * event) -{ - if (event) - return event->gmt; - else - return (time_t)-1; -} - -NMERR_T -nm_process_event(NMUser * user, int type) -{ - NMERR_T rc = NM_OK; - guint32 size = 0; - NMEvent *event = NULL; - char *source = NULL; - nm_event_cb cb; - NMConn *conn; - - if (user == NULL) - return NMERR_BAD_PARM; - - if (type < NMEVT_START || type > NMEVT_STOP) - return NMERR_PROTOCOL; - - conn = nm_user_get_conn(user); - - /* Read the event source */ - rc = nm_read_uint32(conn, &size); - if (rc == NM_OK) { - if (size > 0) { - source = g_new0(char, size); - - rc = nm_read_all(conn, source, size); - } - } - - /* Read the event data */ - if (rc == NM_OK) { - event = nm_create_event(type, source, time(0)); - - if (event) { - - switch (type) { - case NMEVT_STATUS_CHANGE: - rc = handle_status_change(user, event); - break; - - case NMEVT_RECEIVE_MESSAGE: - rc = handle_receive_message(user, event, FALSE); - break; - - case NMEVT_RECEIVE_AUTOREPLY: - rc = handle_receive_message(user, event, TRUE); - break; - - case NMEVT_USER_TYPING: - case NMEVT_USER_NOT_TYPING: - rc = handle_typing(user, event); - break; - - case NMEVT_CONFERENCE_LEFT: - rc = handle_conference_left(user, event); - break; - - case NMEVT_CONFERENCE_CLOSED: - rc = handle_conference_closed(user, event); - break; - - case NMEVT_CONFERENCE_JOINED: - rc = handle_conference_joined(user, event); - break; - - case NMEVT_CONFERENCE_INVITE: - rc = handle_conference_invite(user, event); - break; - - case NMEVT_CONFERENCE_REJECT: - rc = handle_conference_reject(user, event); - break; - - case NMEVT_CONFERENCE_INVITE_NOTIFY: - rc = handle_conference_invite_notify(user, event); - break; - - case NMEVT_UNDELIVERABLE_STATUS: - rc = handle_undeliverable_status(user, event); - break; - - case NMEVT_INVALID_RECIPIENT: - /* Nothing else to read, just callback */ - break; - - case NMEVT_USER_DISCONNECT: - /* Nothing else to read, just callback */ - break; - - case NMEVT_SERVER_DISCONNECT: - /* Nothing else to read, just callback */ - break; - - case NMEVT_RECEIVE_FILE: - case NMEVT_CONTACT_ADD: - /* Safely ignored for now */ - break; - - default: - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Unknown event %d received.\n", type); - rc = NMERR_PROTOCOL; - break; - } - } - } - - if (rc == (NMERR_T)-1) { - /* -1 means that we are not ready to callback yet. */ - rc = NM_OK; - } else if (rc == NM_OK && (cb = nm_user_get_event_callback(user))) { - - cb(user, event); - - if (event) - nm_release_event(event); - } else { - if (event) - nm_release_event(event); - } - - /* Cleanup */ - if (source) - g_free(source); - - return rc; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmevent.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -/* - * nmevent.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_EVENT_H__ -#define __NM_EVENT_H__ - -typedef struct _NMEvent NMEvent; - -#include "nmuser.h" -#include - -/** - * Defines for the event types - */ -#define NMEVT_INVALID_RECIPIENT 101 -#define NMEVT_UNDELIVERABLE_STATUS 102 -#define NMEVT_STATUS_CHANGE 103 -#define NMEVT_CONTACT_ADD 104 -#define NMEVT_CONFERENCE_CLOSED 105 -#define NMEVT_CONFERENCE_JOINED 106 -#define NMEVT_CONFERENCE_LEFT 107 -#define NMEVT_RECEIVE_MESSAGE 108 -#define NMEVT_RECEIVE_FILE 109 -#define NMEVT_USER_TYPING 112 -#define NMEVT_USER_NOT_TYPING 113 -#define NMEVT_USER_DISCONNECT 114 -#define NMEVT_SERVER_DISCONNECT 115 -#define NMEVT_CONFERENCE_RENAME 116 -#define NMEVT_CONFERENCE_INVITE 117 -#define NMEVT_CONFERENCE_INVITE_NOTIFY 118 -#define NMEVT_CONFERENCE_REJECT 119 -#define NMEVT_RECEIVE_AUTOREPLY 121 -#define NMEVT_START NMEVT_INVALID_RECIPIENT -#define NMEVT_STOP NMEVT_RECEIVE_AUTOREPLY - -/** - * Process the event. The event will be read, an NMEvent will - * be created, and the event callback will be called. - * - * @param user The main user structure. - * @param type The type of the event to read. - * - * @return NM_OK on success - */ -NMERR_T nm_process_event(NMUser * user, int type); - -/** - * Creates an NMEvent - * - * The NMEvent should be released by calling - * nm_release_event. - * - * @param type The event type, see defines above. - * @param source The DN of the event source. - * @param gmt The time that the event occurred. - * - * @return The new NMEvent - */ -NMEvent *nm_create_event(int type, const char *source, guint32 gmt); - -/** - * Releases an NMEvent - * - * @param event The event to release - * - */ -void nm_release_event(NMEvent * event); - -/** - * Sets the conference object for the given event. - * - * @param event The event. - * @param conference The conference to associate with the event. - * - */ -void nm_event_set_conference(NMEvent * event, NMConference * conference); - -/** - * Returns the conference object associated with the given event. This should not - * be released. If it needs to be kept around call nm_conference_addref(). - * - * @param event The event. - * - * @return The conference associated with the event, or NULL - * if no conference has been set for the event. - */ -NMConference *nm_event_get_conference(NMEvent * event); - -/** - * Sets the NMUserRecord object for the given event. - * The user record represents the event source. - * - * @param event The event. - * @param user_record The user record to associate with the event. - * - */ -void nm_event_set_user_record(NMEvent * event, NMUserRecord * user_record); - -/** - * Returns the NMUserRecord object associated with the given event. - * The user record represents the event source. This should not - * be released. If it needs to be kept around call - * nm_user_record_add_ref(). - * - * @param event The event. - * - * @return The user record associated with the event, or NULL - * if no user record has been set for the event. - */ -NMUserRecord *nm_event_get_user_record(NMEvent * event); - -/** - * Sets the text to associate with the given event. - * - * @param event The event. - * @param text The text to associate with the event. - * - */ -void nm_event_set_text(NMEvent * event, const char *text); - -/** - * Returns the text associated with the given event. - * - * @param event The event. - * - * @return The text associated with the event, or NULL - * if no text has been set for the event. - */ -const char *nm_event_get_text(NMEvent * event); - -/** - * Returns the source of the event (this will be the full DN of the - * event source). - * - * @param event The event. - * - * @return The full DN of the event's source. - */ -const char *nm_event_get_source(NMEvent * event); - -/** - * Returns the type of the event. See the defines above for - * a list of possible event types. - * - * @param event The event. - * - * @return The type of the event. - * - */ -int nm_event_get_type(NMEvent * event); - -/** - * Returns the time that the event took place. - * - * @param event The event. - * - * @return The timestamp for the event. - */ -time_t nm_event_get_gmt(NMEvent * event); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,364 +0,0 @@ -/* - * nmfield.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include "nmfield.h" - -/* Free a field value and tag */ -static void _free_field(NMField * field); - -/* Free a field value */ -static void _free_field_value(NMField * field); - -/* Make a deep copy of the field */ -static void _copy_field(NMField * dest, NMField * src); - -/* Make a deep copy of the field's value */ -static void _copy_field_value(NMField * dest, NMField * src); - -/* Create a string from a value -- for debugging */ -static char *_value_to_string(NMField * field); - -static NMField * -_add_blank_field(NMField *fields, guint32 count) -{ - guint32 new_len; - - if (fields == NULL) { - fields = g_new0(NMField, 10); - fields->len = 10; - } else { - if (fields->len < count + 2) { - new_len = count + 10; - fields = g_realloc(fields, new_len * sizeof(NMField)); - fields->len = new_len; - } - } - return fields; -} - -NMField * -nm_field_add_number(NMField * fields, const char *tag, guint32 size, guint8 method, - guint8 flags, guint32 value, guint8 type) -{ - guint32 count; - NMField *field; - - count = nm_count_fields(fields); - fields = _add_blank_field(fields, count); - - field = &(fields[count]); - field->tag = g_strdup(tag); - field->size = size; - field->method = method; - field->flags = flags; - field->value = value; - field->type = type; - - /* Null terminate the field array */ - field = &((fields)[count + 1]); - field->tag = NULL; - field->value = 0; - field->ptr_value = NULL; - - return fields; -} - -NMField * -nm_field_add_pointer(NMField * fields, const char *tag, guint32 size, guint8 method, - guint8 flags, gpointer value, guint8 type) -{ - guint32 count; - NMField *field = NULL; - - count = nm_count_fields(fields); - fields = _add_blank_field(fields, count); - - field = &(fields[count]); - field->tag = g_strdup(tag); - field->size = size; - field->method = method; - field->flags = flags; - field->ptr_value = value; - field->type = type; - - /* Null terminate the field array */ - field = &((fields)[count + 1]); - field->tag = NULL; - field->value = 0; - field->ptr_value = NULL; - - return fields; -} - -guint32 -nm_count_fields(NMField * fields) -{ - guint32 count = 0; - - if (fields) { - while (fields->tag != NULL) { - count++; - fields++; - } - } - - return count; -} - -void -nm_free_fields(NMField ** fields) -{ - NMField *field = NULL; - - if ((fields == NULL) || (*fields == NULL)) - return; - - field = *fields; - - while (field->tag != NULL) { - _free_field(field); - field++; - } - - g_free(*fields); - *fields = NULL; -} - - -static void -_free_field(NMField * field) -{ - if (field == NULL) - return; - - _free_field_value(field); - g_free(field->tag); -} - -static void -_free_field_value(NMField * field) -{ - if (field == NULL) - return; - - switch (field->type) { - case NMFIELD_TYPE_BINARY: - case NMFIELD_TYPE_UTF8: - case NMFIELD_TYPE_DN: - g_free(field->ptr_value); - break; - - case NMFIELD_TYPE_ARRAY: - case NMFIELD_TYPE_MV: - nm_free_fields((NMField **)&field->ptr_value); - break; - - default: - break; - } - - field->size = 0; - field->ptr_value = NULL; -} - -NMField * -nm_locate_field(char *tag, NMField * fields) -{ - NMField *ret_fields = NULL; - - if ((fields == NULL) || (tag == NULL)) { - return NULL; - } - - while (fields->tag != NULL) { - if (g_ascii_strcasecmp(fields->tag, tag) == 0) { - ret_fields = fields; - break; - } - fields++; - } - - return ret_fields; -} - -NMField * -nm_copy_field_array(NMField * src) -{ - NMField *ptr = NULL; - NMField *dest = NULL; - int count; - - if (src != NULL) { - count = nm_count_fields(src) + 1; - dest = g_new0(NMField, count); - dest->len = count; - ptr = dest; - while (src->tag != NULL) { - _copy_field(ptr, src); - ptr++; - src++; - } - } - - return dest; -} - -static void -_copy_field(NMField * dest, NMField * src) -{ - dest->type = src->type; - dest->flags = src->flags; - dest->method = src->method; - dest->tag = g_strdup(src->tag); - _copy_field_value(dest, src); -} - -static void -_copy_field_value(NMField * dest, NMField * src) -{ - dest->type = src->type; - switch (dest->type) { - case NMFIELD_TYPE_UTF8: - case NMFIELD_TYPE_DN: - if (src->size == 0 && src->ptr_value != NULL) { - src->size = strlen((char *) src->ptr_value) + 1; - } - /* fall through */ - case NMFIELD_TYPE_BINARY: - if (src->size != 0 && src->ptr_value != NULL) { - dest->ptr_value = g_new0(char, src->size); - memcpy(dest->ptr_value, src->ptr_value, src->size); - } - break; - - case NMFIELD_TYPE_ARRAY: - case NMFIELD_TYPE_MV: - dest->ptr_value = nm_copy_field_array((NMField *)src->ptr_value); - break; - - default: - /* numeric value */ - dest->value = src->value; - break; - } - - dest->size = src->size; -} - -void -nm_remove_field(NMField * field) -{ - NMField *tmp; - guint32 len; - - if ((field != NULL) && (field->tag != NULL)) { - _free_field(field); - - /* Move fields down */ - tmp = field + 1; - while (1) { - /* Don't overwrite the size of the array */ - len = field->len; - - *field = *tmp; - - field->len = len; - - if (tmp->tag == NULL) - break; - - field++; - tmp++; - } - } -} - -void -nm_print_fields(NMField * fields) -{ - char *str = NULL; - NMField *field = fields; - - if (fields == NULL) - return; - - while (field->tag != NULL) { - if (field->type == NMFIELD_TYPE_ARRAY || field->type == NMFIELD_TYPE_MV) { - printf("Subarray START: %s Method = %d\n", field->tag, field->method); - nm_print_fields((NMField *) field->ptr_value); - printf("Subarray END: %s\n", field->tag); - } else { - str = _value_to_string(field); - printf("Tag=%s;Value=%s\n", field->tag, str); - g_free(str); - str = NULL; - } - field++; - } - -} - -static char * -_value_to_string(NMField * field) -{ - char *value = NULL; - - if (field == NULL) - return NULL; - - /* This is a single value attribute */ - if (((field->type == NMFIELD_TYPE_UTF8) || - (field->type == NMFIELD_TYPE_DN)) && (field->ptr_value != NULL)) { - value = g_strdup((const char *) field->ptr_value); - } else if (field->type == NMFIELD_TYPE_BINARY && field->ptr_value != NULL) { - value = g_new0(char, field->size); - memcpy(value, (const char *) field->ptr_value, field->size); - } else if (field->type == NMFIELD_TYPE_BOOL) { - if (field->value) { - value = g_strdup(NM_FIELD_TRUE); - } else { - value = g_strdup(NM_FIELD_FALSE); - } - } else { - /* assume it is a number */ - value = g_new0(char, 20); - - switch (field->type) { - case NMFIELD_TYPE_BYTE: - case NMFIELD_TYPE_WORD: - case NMFIELD_TYPE_DWORD: - value = g_strdup_printf("%ld", (long) field->value); - break; - - case NMFIELD_TYPE_UBYTE: - case NMFIELD_TYPE_UWORD: - case NMFIELD_TYPE_UDWORD: - value = g_strdup_printf("%lu", (unsigned long) field->value); - break; - } - } - - if (value == NULL) - value = g_strdup("NULL"); - - return value; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmfield.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,225 +0,0 @@ -/* - * nmfield.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef NMFIELD_H -#define NMFIELD_H - -#include - -typedef struct NMField_t -{ - char *tag; /* Field tag */ - guint8 method; /* Method of the field */ - guint8 flags; /* Flags */ - guint8 type; /* Type of value */ - guint32 size; /* Size of value if binary */ - guint32 value; /* Value of a numeric field */ - gpointer ptr_value; /* Value of a string or sub array field */ - guint32 len; /* Length of the array */ -} NMField; - -/* Field types */ -#define NMFIELD_TYPE_INVALID 0 -#define NMFIELD_TYPE_NUMBER 1 -#define NMFIELD_TYPE_BINARY 2 -#define NMFIELD_TYPE_BYTE 3 -#define NMFIELD_TYPE_UBYTE 4 -#define NMFIELD_TYPE_WORD 5 -#define NMFIELD_TYPE_UWORD 6 -#define NMFIELD_TYPE_DWORD 7 -#define NMFIELD_TYPE_UDWORD 8 -#define NMFIELD_TYPE_ARRAY 9 -#define NMFIELD_TYPE_UTF8 10 -#define NMFIELD_TYPE_BOOL 11 -#define NMFIELD_TYPE_MV 12 -#define NMFIELD_TYPE_DN 13 - -/* Field methods */ -#define NMFIELD_METHOD_VALID 0 -#define NMFIELD_METHOD_IGNORE 1 -#define NMFIELD_METHOD_DELETE 2 -#define NMFIELD_METHOD_DELETE_ALL 3 -#define NMFIELD_METHOD_EQUAL 4 -#define NMFIELD_METHOD_ADD 5 -#define NMFIELD_METHOD_UPDATE 6 -#define NMFIELD_METHOD_GTE 10 -#define NMFIELD_METHOD_LTE 12 -#define NMFIELD_METHOD_NE 14 -#define NMFIELD_METHOD_EXIST 15 -#define NMFIELD_METHOD_NOTEXIST 16 -#define NMFIELD_METHOD_SEARCH 17 -#define NMFIELD_METHOD_MATCHBEGIN 19 -#define NMFIELD_METHOD_MATCHEND 20 -#define NMFIELD_METHOD_NOT_ARRAY 40 -#define NMFIELD_METHOD_OR_ARRAY 41 -#define NMFIELD_METHOD_AND_ARRAY 42 - -/* Attribute Names (field tags) */ -#define NM_A_IP_ADDRESS "nnmIPAddress" -#define NM_A_PORT "nnmPort" -#define NM_A_FA_FOLDER "NM_A_FA_FOLDER" -#define NM_A_FA_CONTACT "NM_A_FA_CONTACT" -#define NM_A_FA_CONVERSATION "NM_A_FA_CONVERSATION" -#define NM_A_FA_MESSAGE "NM_A_FA_MESSAGE" -#define NM_A_FA_CONTACT_LIST "NM_A_FA_CONTACT_LIST" -#define NM_A_FA_RESULTS "NM_A_FA_RESULTS" -#define NM_A_FA_INFO_DISPLAY_ARRAY "NM_A_FA_INFO_DISPLAY_ARRAY" -#define NM_A_FA_USER_DETAILS "NM_A_FA_USER_DETAILS" -#define NM_A_SZ_OBJECT_ID "NM_A_SZ_OBJECT_ID" -#define NM_A_SZ_PARENT_ID "NM_A_SZ_PARENT_ID" -#define NM_A_SZ_SEQUENCE_NUMBER "NM_A_SZ_SEQUENCE_NUMBER" -#define NM_A_SZ_TYPE "NM_A_SZ_TYPE" -#define NM_A_SZ_STATUS "NM_A_SZ_STATUS" -#define NM_A_SZ_STATUS_TEXT "NM_A_SZ_STATUS_TEXT" -#define NM_A_SZ_DN "NM_A_SZ_DN" -#define NM_A_SZ_DISPLAY_NAME "NM_A_SZ_DISPLAY_NAME" -#define NM_A_SZ_USERID "NM_A_SZ_USERID" -#define NM_A_SZ_CREDENTIALS "NM_A_SZ_CREDENTIALS" -#define NM_A_SZ_MESSAGE_BODY "NM_A_SZ_MESSAGE_BODY" -#define NM_A_SZ_MESSAGE_TEXT "NM_A_SZ_MESSAGE_TEXT" -#define NM_A_UD_MESSAGE_TYPE "NM_A_UD_MESSAGE_TYPE" -#define NM_A_FA_PARTICIPANTS "NM_A_FA_PARTICIPANTS" -#define NM_A_FA_INVITES "NM_A_FA_INVITES" -#define NM_A_FA_EVENT "NM_A_FA_EVENT" -#define NM_A_UD_COUNT "NM_A_UD_COUNT" -#define NM_A_UD_DATE "NM_A_UD_DATE" -#define NM_A_UD_EVENT "NM_A_UD_EVENT" -#define NM_A_B_NO_CONTACTS "NM_A_B_NO_CONTACTS" -#define NM_A_B_NO_CUSTOMS "NM_A_B_NO_CUSTOMS" -#define NM_A_B_NO_PRIVACY "NM_A_B_NO_PRIVACY" -#define NM_A_UW_STATUS "NM_A_UW_STATUS" -#define NM_A_UD_OBJECT_ID "NM_A_UD_OBJECT_ID" -#define NM_A_SZ_TRANSACTION_ID "NM_A_SZ_TRANSACTION_ID" -#define NM_A_SZ_RESULT_CODE "NM_A_SZ_RESULT_CODE" -#define NM_A_UD_BUILD "NM_A_UD_BUILD" -#define NM_A_SZ_AUTH_ATTRIBUTE "NM_A_SZ_AUTH_ATTRIBUTE" -#define NM_A_UD_KEEPALIVE "NM_A_UD_KEEPALIVE" -#define NM_A_SZ_USER_AGENT "NM_A_SZ_USER_AGENT" -#define NM_A_BLOCKING "nnmBlocking" -#define NM_A_BLOCKING_DENY_LIST "nnmBlockingDenyList" -#define NM_A_BLOCKING_ALLOW_LIST "nnmBlockingAllowList" -#define NM_A_SZ_BLOCKING_ALLOW_ITEM "NM_A_SZ_BLOCKING_ALLOW_ITEM" -#define NM_A_SZ_BLOCKING_DENY_ITEM "NM_A_SZ_BLOCKING_DENY_ITEM" -#define NM_A_LOCKED_ATTR_LIST "nnmLockedAttrList" - -#define NM_PROTOCOL_VERSION 2 - -#define NM_FIELD_TRUE "1" -#define NM_FIELD_FALSE "0" - -#define NMFIELD_MAX_STR_LENGTH 32768 - -/** - * Count the number of fields - * - * @param fields Field array - * - * @return The number of fields in the array. - * - */ -guint32 nm_count_fields(NMField * fields); - -/** - * Add a field to the field array. The field should be of type NMFIELD_TYPE_UTF8, - * NMFIELD_TYPE_DN, NMFIELD_TYPE_ARRAY, or NMFIELD_TYPE_MV - * - * NOTE: field array that is passed in may be realloc'd so you should use - * the returned field array pointer not the passed in pointer after calling - * this function. - * - * @param fields Field array - * @param tag Tag for the new field - * @param size Size of the field value (if type = binary) - * @param method Field method (see method defines above) - * @param flags Flags for new field - * @param value The value of the field - * @param type The type of the field value - * - * @return Pointer to the updated field array - * - */ -NMField *nm_field_add_pointer(NMField *fields, const char *tag, guint32 size, guint8 method, - guint8 flags, gpointer value, guint8 type); - -/** - * Add a numeric field to the field array. - * - * NOTE: field array that is passed in may be realloc'd so you should use - * the returned field array pointer not the passed in pointer after calling - * this function. - * - * @param fields Field array - * @param tag Tag for the new field - * @param size Size of the field value (if type = binary) - * @param method Field method (see method defines above) - * @param flags Flags for new field - * @param value The value of the field - * @param type The type of the field value - * - * @return Pointer to the updated field array - * - */ -NMField *nm_field_add_number(NMField *fields, const char *tag, guint32 size, guint8 method, - guint8 flags, guint32 value, guint8 type); - -/** - * Recursively free an array of fields and set pointer to NULL. - * - * @param fields Pointer to a field array - * - */ -void nm_free_fields(NMField ** fields); - -/** - * Find first field with given tag in field array. - * - * Note: this will only work for 7-bit ascii tags (which is all that - * we use currently). - * - * @param tag Tag to search for - * @param fields Field array - * - * @return The first matching field, or NULL if no fields match. - * - */ -NMField *nm_locate_field(char *tag, NMField * fields); - -/** - * Make a deep copy of a field array - * - * @param src The array to copy - * - * @return The new (copied) array, which must be freed. - * - */ -NMField *nm_copy_field_array(NMField * src); - -/** - * Remove a field and move other fields up to fill the gap - * - * @param field The field to remove - * - */ -void nm_remove_field(NMField * field); - -/* Print a field array (for debugging purposes) */ -void nm_print_fields(NMField * fields); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/* - * nmmessage.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "nmmessage.h" - -struct _NMMessage -{ - NMConference *conference; - char *text; - guint32 ref_count; -}; - - -/** Message API **/ - -NMMessage * -nm_create_message(const char *text) -{ - NMMessage *msg = g_new0(NMMessage, 1); - - if (text) - msg->text = g_strdup(text); - - msg->ref_count = 1; - return msg; -} - -void -nm_message_add_ref(NMMessage * msg) -{ - if (msg) - msg->ref_count++; -} - -void -nm_release_message(NMMessage * msg) -{ - if (msg && (--(msg->ref_count) == 0)) { - if (msg->text) - g_free(msg->text); - - if (msg->conference) - nm_release_conference(msg->conference); - - g_free(msg); - } -} - -const char * -nm_message_get_text(NMMessage * msg) -{ - if (msg == NULL) - return NULL; - - return msg->text; -} - -void -nm_message_set_conference(NMMessage * msg, NMConference * conf) -{ - if (msg == NULL || conf == NULL) - return; - - /* Need to ref the conference first so that it doesn't - * get released out from under us - */ - nm_conference_add_ref(conf); - - msg->conference = conf; -} - -NMConference * -nm_message_get_conference(NMMessage * msg) -{ - if (msg == NULL) - return NULL; - - return msg->conference; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmmessage.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - * nmmessage.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_MESSAGE_H__ -#define __NM_MESSAGE_H__ - -typedef struct _NMMessage NMMessage; - -#include "nmconference.h" - -/** - * Creates a new message. - * - * The returned message should be released by calling - * nm_release_message - * - * @param text The message text - * @return A newly allocated message - */ -NMMessage *nm_create_message(const char *text); - -/** - * Increment the reference count for the message object. - * - * @param msg The message - */ -void nm_message_add_ref(NMMessage * msg); - -/** - * Releases a message. - * - * @param msg The message - */ -void nm_release_message(NMMessage * msg); - -/** - * Returns the message text - * - * @param msg The message - * @return The message text - */ -const char *nm_message_get_text(NMMessage * msg); - -/** - * Sets the conference object for a message - * - * @param msg The message - * @param conf The conference to associate with the message - * @return RVALUE_OK on success - */ -void nm_message_set_conference(NMMessage * msg, NMConference * conf); - -/** - * Returns the conference object associated with the message - * - * Note: this does not increment the reference count for the - * conference and the conference should NOT be released with - * nm_release_conference. If the reference needs to be kept - * around nm_conference_add_ref should be called. - * - * @param msg The message - * @return The conference associated with this message - */ -NMConference *nm_message_get_conference(NMMessage * msg); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/* - * nmrequest.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "nmrequest.h" - -static int count = 0; - -struct _NMRequest -{ - int trans_id; - char *cmd; - int gmt; - gpointer data; - gpointer user_define; - nm_response_cb callback; - int ref_count; - NMERR_T ret_code; -}; - -NMRequest *nm_create_request(const char *cmd, int trans_id, int gmt, nm_response_cb cb, - gpointer resp_data, gpointer user_define) -{ - NMRequest *req; - - if (cmd == NULL) - return NULL; - - req = g_new0(NMRequest, 1); - req->cmd = g_strdup(cmd); - req->trans_id = trans_id; - req->gmt = gmt; - req->callback = cb; - req->data = resp_data; - req->user_define = user_define; - req->ref_count = 1; - - purple_debug_info("novell", "Creating NMRequest instance, total=%d\n", ++count); - - return req; -} - -void -nm_release_request(NMRequest * req) -{ - if (req && (--req->ref_count == 0)) { - if (req->cmd) - g_free(req->cmd); - g_free(req); - - purple_debug_info("novell", - "Releasing NMRequest instance, total=%d\n", --count); - } - -} - -void -nm_request_add_ref(NMRequest * req) -{ - if (req) - req->ref_count++; -} - -void -nm_request_set_callback(NMRequest * req, nm_response_cb callback) -{ - if (req) - req->callback = callback; -} - -void -nm_request_set_data(NMRequest * req, gpointer data) -{ - if (req) - req->data = data; -} - -void -nm_request_set_user_define(NMRequest * req, gpointer user_define) -{ - if (req) - req->user_define = user_define; -} - -int -nm_request_get_trans_id(NMRequest * req) -{ - if (req) - return req->trans_id; - else - return -1; -} - -const char * -nm_request_get_cmd(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->cmd; -} - -gpointer -nm_request_get_data(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->data; -} - -gpointer -nm_request_get_user_define(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->user_define; -} - -nm_response_cb -nm_request_get_callback(NMRequest * req) -{ - if (req == NULL) - return NULL; - - return req->callback; -} - - -void -nm_request_set_ret_code(NMRequest * req, NMERR_T rc) -{ - if (req) - req->ret_code = rc; -} - -NMERR_T -nm_request_get_ret_code(NMRequest * req) -{ - if (req) - return req->ret_code; - else - return (NMERR_T) - 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrequest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -/* - * nmrequest.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_REQUEST_H__ -#define __NM_REQUEST_H__ - -typedef struct _NMRequest NMRequest; - -#include "nmuser.h" - -/** - * Create a new request object. Object must be release with nm_release_object. - * - * @param cmd The request command string (e.g. "login") - * @param trans_id The request transaction id - * @param gmt The time in seconds that the request was created - * - * @return The new request object - */ -NMRequest *nm_create_request(const char *cmd, int trans_id, int gmt, nm_response_cb cb, - gpointer resp_data, gpointer user_define); - -/** - * Release a request object. - * - * @param req The request to release - */ -void nm_release_request(NMRequest * req); - -/** - * Add a new reference to this object. This reference must be released by - * a call to nm_release_object. - * - * @param req The request object - */ -void nm_request_add_ref(NMRequest * req); - -/** - * Set the response callback for this request object. This is the callback - * that will be made when we get a response from the server. - * - * @param req The request object - * @param callback The response callback - * - */ -void nm_request_set_callback(NMRequest * req, nm_response_cb callback); - -/** - * Set the response data. This will be set differently depending on - * the request type (for example to nm_send_get_details will set this - * to be the newly create NMUserRecord object). - * - * @param req The request object - * @param data Pointer to some data - * - */ -void nm_request_set_data(NMRequest * req, gpointer data); - -/** - * Set the user defined data. This is the data that the client - * passes to the various nm_send_* functions. We will pass it - * back when we make the callback. - * - * @param req The request object - * @param user_define Pointer to some data - * - */ -void nm_request_set_user_define(NMRequest * req, gpointer user_define); - -/** - * Set the return code. This is the return code that we received in - * the server response fields. - * - * @param req The request object - * @param rc The return code to set - */ -void nm_request_set_ret_code(NMRequest * req, NMERR_T rc); - -/** - * Get the transaction id for this request. - * - * @param req The request object - * - * @return The transaction id. - */ -int nm_request_get_trans_id(NMRequest * req); - -/** - * Get the command (request type) for this request. - * - * @param req The request object - * - * @return The request cmd - */ -const char *nm_request_get_cmd(NMRequest * req); - -/** - * Get the response data for this request - * - * @param req The request object - * - * @return The response data - */ -gpointer nm_request_get_data(NMRequest * req); - -/** - * Get the user defined data for this request - * - * @param req The request object - * - * @return The user defined data - */ -gpointer nm_request_get_user_define(NMRequest * req); - -/** - * Get the response callback for this request - * - * @param req The request object - * - * @return The response callback - */ -nm_response_cb nm_request_get_callback(NMRequest * req); - -/** - * Get the return code - * - * @param req The request object - * - * @return The return code (from the response fields) - */ -NMERR_T nm_request_get_ret_code(NMRequest * req); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,829 +0,0 @@ -/* - * nmrtf.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* This code was adapted from the sample RTF reader found here: - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec.asp - */ - -#include -#include -#include -#include -#include -#include -#include "nmrtf.h" -#include "debug.h" - -/* Internal RTF parser error codes */ -#define NMRTF_OK 0 /* Everything's fine! */ -#define NMRTF_STACK_UNDERFLOW 1 /* Unmatched '}' */ -#define NMRTF_STACK_OVERFLOW 2 /* Too many '{' -- memory exhausted */ -#define NMRTF_UNMATCHED_BRACE 3 /* RTF ended during an open group. */ -#define NMRTF_INVALID_HEX 4 /* invalid hex character found in data */ -#define NMRTF_BAD_TABLE 5 /* RTF table (sym or prop) invalid */ -#define NMRTF_ASSERTION 6 /* Assertion failure */ -#define NMRTF_EOF 7 /* End of file reached while reading RTF */ -#define NMRTF_CONVERT_ERROR 8 /* Error converting text */ - -#define NMRTF_MAX_DEPTH 256 - -typedef enum -{ - NMRTF_STATE_NORMAL, - NMRTF_STATE_SKIP, - NMRTF_STATE_FONTTABLE, - NMRTF_STATE_BIN, - NMRTF_STATE_HEX -} NMRtfState; /* Rtf State */ - -/* Property types that we care about */ -typedef enum -{ - NMRTF_PROP_FONT_IDX, - NMRTF_PROP_FONT_CHARSET, - NMRTF_PROP_MAX -} NMRtfProperty; - -typedef enum -{ - NMRTF_SPECIAL_BIN, - NMRTF_SPECIAL_HEX, - NMRTF_SPECIAL_UNICODE, - NMRTF_SPECIAL_SKIP -} NMRtfSpecialKwd; - -typedef enum -{ - NMRTF_DEST_FONTTABLE, - NMRTF_DEST_SKIP -} NMRtfDestinationType; - -typedef enum -{ - NMRTF_KWD_CHAR, - NMRTF_KWD_DEST, - NMRTF_KWD_PROP, - NMRTF_KWD_SPEC -} NMRtfKeywordType; - -typedef struct _NMRTFCharProp -{ - /* All we care about for now is the font. - * bold, italic, underline, etc. should be - * added here - */ - int font_idx; - int font_charset; -} NMRtfCharProp; - -typedef struct _NMRtfStateSave -{ - NMRtfCharProp chp; - NMRtfState rds; - NMRtfState ris; -} NMRtfStateSave; - -typedef struct _NMRtfSymbol -{ - char *keyword; /* RTF keyword */ - int default_val; /* default value to use */ - gboolean pass_default; /* true to use default value from this table */ - NMRtfKeywordType kwd_type; /* the type of the keyword */ - int action; /* property type if the keyword represents a property */ - /* destination type if the keyword represents a destination */ - /* character to print if the keyword represents a character */ -} NMRtfSymbol; - - -typedef struct _NMRtfFont -{ - int number; - char *name; - int charset; -} NMRtfFont; - -/* RTF Context */ -struct _NMRtfContext -{ - NMRtfState rds; /* destination state */ - NMRtfState ris; /* internal state */ - NMRtfCharProp chp; /* current character properties (ie. font, bold, italic, etc.) */ - GSList *font_table; /* the font table */ - GSList *saved; /* saved state stack */ - int param; /* numeric parameter for the current keyword */ - long bytes_to_skip; /* number of bytes to skip (after encountering \bin) */ - int depth; /* how many groups deep are we */ - gboolean skip_unknown; /* if true, skip any unknown destinations (this is set after encountering '\*') */ - char *input; /* input string */ - char nextch; /* next char in input */ - GString *ansi; /* Temporary ansi text, will be convert/flushed to the output string */ - GString *output; /* The plain text UTF8 string */ -}; - -static int rtf_parse(NMRtfContext *ctx); -static int rtf_push_state(NMRtfContext *ctx); -static int rtf_pop_state(NMRtfContext *ctx); -static NMRtfFont *rtf_get_font(NMRtfContext *ctx, int index); -static int rtf_get_char(NMRtfContext *ctx, guchar *ch); -static int rtf_unget_char(NMRtfContext *ctx, guchar ch); -static int rtf_flush_data(NMRtfContext *ctx); -static int rtf_parse_keyword(NMRtfContext *ctx); -static int rtf_dispatch_control(NMRtfContext *ctx, char *keyword, int param, gboolean param_set); -static int rtf_dispatch_char(NMRtfContext *ctx, guchar ch); -static int rtf_dispatch_unicode_char(NMRtfContext *ctx, gunichar ch); -static int rtf_print_char(NMRtfContext *ctx, guchar ch); -static int rtf_print_unicode_char(NMRtfContext *ctx, gunichar ch); -static int rtf_change_destination(NMRtfContext *ctx, NMRtfDestinationType dest); -static int rtf_dispatch_special(NMRtfContext *ctx, NMRtfSpecialKwd special); -static int rtf_apply_property(NMRtfContext *ctx, NMRtfProperty prop, int val); - -/* RTF parser tables */ - -/* Keyword descriptions */ -NMRtfSymbol rtf_symbols[] = { - /* keyword, default, pass_default, keyword_type, action */ - {"fonttbl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_FONTTABLE}, - {"f", 0, FALSE, NMRTF_KWD_PROP, NMRTF_PROP_FONT_IDX}, - {"fcharset", 0, FALSE, NMRTF_KWD_PROP, NMRTF_PROP_FONT_CHARSET}, - {"par", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"line", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"\0x0a", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"\0x0d", 0, FALSE, NMRTF_KWD_CHAR, 0x0a}, - {"tab", 0, FALSE, NMRTF_KWD_CHAR, 0x09}, - {"\r", 0, FALSE, NMRTF_KWD_CHAR, '\r'}, - {"\n", 0, FALSE, NMRTF_KWD_CHAR, '\n'}, - {"ldblquote",0, FALSE, NMRTF_KWD_CHAR, '"'}, - {"rdblquote",0, FALSE, NMRTF_KWD_CHAR, '"'}, - {"{", 0, FALSE, NMRTF_KWD_CHAR, '{'}, - {"}", 0, FALSE, NMRTF_KWD_CHAR, '}'}, - {"\\", 0, FALSE, NMRTF_KWD_CHAR, '\\'}, - {"bin", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_BIN}, - {"*", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_SKIP}, - {"'", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_HEX}, - {"u", 0, FALSE, NMRTF_KWD_SPEC, NMRTF_SPECIAL_UNICODE}, - {"colortbl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"author", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"buptim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"comment", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"creatim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"doccomm", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footer", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footerf", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footerl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footerr", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"footnote", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"ftncn", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"ftnsep", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"ftnsepc", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"header", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"headerf", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"headerl", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"headerr", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"info", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"keywords", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"operator", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"pict", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"printim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"private1", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"revtim", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"rxe", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"stylesheet", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"subject", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"tc", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"title", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"txe", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP}, - {"xe", 0, FALSE, NMRTF_KWD_DEST, NMRTF_DEST_SKIP} -}; -int table_size = sizeof(rtf_symbols) / sizeof(NMRtfSymbol); - -NMRtfContext * -nm_rtf_init() -{ - NMRtfContext *ctx = g_new0(NMRtfContext, 1); - ctx->nextch = -1; - ctx->ansi = g_string_new(""); - ctx->output = g_string_new(""); - return ctx; -} - -char * -nm_rtf_strip_formatting(NMRtfContext *ctx, const char *input) -{ - int status; - - ctx->input = (char *)input; - status = rtf_parse(ctx); - if (status == NMRTF_OK) - return g_strdup(ctx->output->str); - - purple_debug_info("novell", "RTF parser failed with error code %d\n", status); - return NULL; -} - -void -nm_rtf_deinit(NMRtfContext *ctx) -{ - GSList *node; - NMRtfFont *font; - NMRtfStateSave *save; - - if (ctx) { - for (node = ctx->font_table; node; node = node->next) { - font = node->data; - g_free(font->name); - g_free(font); - node->data = NULL; - } - g_slist_free(ctx->font_table); - for (node = ctx->saved; node; node = node->next) { - save = node->data; - g_free(save); - node->data = NULL; - } - g_slist_free(ctx->saved); - g_string_free(ctx->ansi, TRUE); - g_string_free(ctx->output, TRUE); - g_free(ctx); - } -} - -static const char * -get_current_encoding(NMRtfContext *ctx) -{ - NMRtfFont *font; - - font = rtf_get_font(ctx, ctx->chp.font_idx); - - switch (font->charset) { - case 0: - return "CP1252"; - case 77: - return "MACINTOSH"; - case 78: - return "SJIS"; - case 128: - return "CP932"; - case 129: - return "CP949"; - case 130: - return "CP1361"; - case 134: - return "CP936"; - case 136: - return "CP950"; - case 161: - return "CP1253"; - case 162: - return "CP1254"; - case 163: - return "CP1258"; - case 181: - case 177: - return "CP1255"; - case 178: - case 179: - case 180: - return "CP1256"; - case 186: - return "CP1257"; - case 204: - return "CP1251"; - case 222: - return "CP874"; - case 238: - return "CP1250"; - case 254: - return "CP437"; - default: - purple_debug_info("novell", "Unhandled font charset %d\n", font->charset); - return "CP1252"; - } - return "CP1252"; -} - - -/* - * Add an entry to the font table - */ -static int -rtf_add_font_entry(NMRtfContext *ctx, int number, const char *name, int charset) -{ - NMRtfFont *font = g_new0(NMRtfFont, 1); - - font->number = number; - font->name = g_strdup(name); - font->charset = charset; - - purple_debug_info("novell", "Adding font to table: #%d\t%s\t%d\n", - font->number, font->name, font->charset); - - ctx->font_table = g_slist_append(ctx->font_table, font); - - return NMRTF_OK; -} - -/* - * Return the nth entry in the font table - */ -static NMRtfFont * -rtf_get_font(NMRtfContext *ctx, int nth) -{ - NMRtfFont *font; - - font = g_slist_nth_data(ctx->font_table, nth); - - return font; -} - -/* - * Step 1: - * Isolate RTF keywords and send them to rtf_parse_keyword; - * Push and pop state at the start and end of RTF groups; - * Send text to rtf_dispatch_char for further processing. - */ -static int -rtf_parse(NMRtfContext *ctx) -{ - int status; - guchar ch; - guchar hex_byte = 0; - int hex_count = 2; - int len; - - if (ctx->input == NULL) - return NMRTF_OK; - - while (rtf_get_char(ctx, &ch) == NMRTF_OK) { - if (ctx->depth < 0) - return NMRTF_STACK_UNDERFLOW; - - /* if we're parsing binary data, handle it directly */ - if (ctx->ris == NMRTF_STATE_BIN) { - if ((status = rtf_dispatch_char(ctx, ch)) != NMRTF_OK) - return status; - } else { - switch (ch) { - case '{': - if (ctx->depth > NMRTF_MAX_DEPTH) - return NMRTF_STACK_OVERFLOW; - rtf_flush_data(ctx); - if ((status = rtf_push_state(ctx)) != NMRTF_OK) - return status; - break; - case '}': - rtf_flush_data(ctx); - - /* for some reason there is always an unwanted '\par' at the end */ - if (ctx->rds == NMRTF_STATE_NORMAL) { - len = ctx->output->len; - if (ctx->output->str[len-1] == '\n') - ctx->output = g_string_truncate(ctx->output, len-1); - } - - if ((status = rtf_pop_state(ctx)) != NMRTF_OK) - return status; - - if (ctx->depth < 0) - return NMRTF_STACK_OVERFLOW; - break; - case '\\': - if ((status = rtf_parse_keyword(ctx)) != NMRTF_OK) - return status; - break; - case 0x0d: - case 0x0a: /* cr and lf are noise characters... */ - break; - default: - if (ctx->ris == NMRTF_STATE_NORMAL) { - if ((status = rtf_dispatch_char(ctx, ch)) != NMRTF_OK) - return status; - } else { /* parsing a hex encoded character */ - if (ctx->ris != NMRTF_STATE_HEX) - return NMRTF_ASSERTION; - - hex_byte = hex_byte << 4; - if (isdigit(ch)) - hex_byte += (char) ch - '0'; - else { - if (islower(ch)) { - if (ch < 'a' || ch > 'f') - return NMRTF_INVALID_HEX; - hex_byte += (char) ch - 'a' + 10; - } else { - if (ch < 'A' || ch > 'F') - return NMRTF_INVALID_HEX; - hex_byte += (char) ch - 'A' + 10; - } - } - hex_count--; - if (hex_count == 0) { - if ((status = rtf_dispatch_char(ctx, hex_byte)) != NMRTF_OK) - return status; - hex_count = 2; - hex_byte = 0; - ctx->ris = NMRTF_STATE_NORMAL; - } - } - break; - } - } - } - if (ctx->depth < 0) - return NMRTF_STACK_OVERFLOW; - if (ctx->depth > 0) - return NMRTF_UNMATCHED_BRACE; - return NMRTF_OK; -} - -/* - * Push the current state onto stack - */ -static int -rtf_push_state(NMRtfContext *ctx) -{ - NMRtfStateSave *save = g_new0(NMRtfStateSave, 1); - save->chp = ctx->chp; - save->rds = ctx->rds; - save->ris = ctx->ris; - ctx->saved = g_slist_prepend(ctx->saved, save); - ctx->ris = NMRTF_STATE_NORMAL; - (ctx->depth)++; - return NMRTF_OK; -} - -/* - * Restore the state at the top of the stack - */ -static int -rtf_pop_state(NMRtfContext *ctx) -{ - NMRtfStateSave *save_old; - GSList *link_old; - - if (ctx->saved == NULL) - return NMRTF_STACK_UNDERFLOW; - - save_old = ctx->saved->data; - ctx->chp = save_old->chp; - ctx->rds = save_old->rds; - ctx->ris = save_old->ris; - (ctx->depth)--; - - g_free(save_old); - link_old = ctx->saved; - ctx->saved = g_slist_remove_link(ctx->saved, link_old); - g_slist_free_1(link_old); - return NMRTF_OK; -} - -/* - * Step 2: - * Get a control word (and its associated value) and - * dispatch the control. - */ -static int -rtf_parse_keyword(NMRtfContext *ctx) -{ - int status = NMRTF_OK; - guchar ch; - gboolean param_set = FALSE; - gboolean is_neg = FALSE; - int param = 0; - char keyword[30]; - char parameter[20]; - int i; - - keyword[0] = '\0'; - parameter[0] = '\0'; - if ((status = rtf_get_char(ctx, &ch)) != NMRTF_OK) - return status; - - if (!isalpha(ch)) { - /* a control symbol; no delimiter. */ - keyword[0] = (char) ch; - keyword[1] = '\0'; - return rtf_dispatch_control(ctx, keyword, 0, param_set); - } - - /* parse keyword */ - for (i = 0; isalpha(ch) && (i < sizeof(keyword) - 1); rtf_get_char(ctx, &ch)) { - keyword[i] = (char) ch; - i++; - } - keyword[i] = '\0'; - - /* check for '-' indicated a negative parameter value */ - if (ch == '-') { - is_neg = TRUE; - if ((status = rtf_get_char(ctx, &ch)) != NMRTF_OK) - return status; - } - - /* check for numerical param */ - if (isdigit(ch)) { - - param_set = TRUE; - for (i = 0; isdigit(ch) && (i < sizeof(parameter) - 1); rtf_get_char(ctx, &ch)) { - parameter[i] = (char) ch; - i++; - } - parameter[i] = '\0'; - - ctx->param = param = atoi(parameter); - if (is_neg) - ctx->param = param = -param; - } - - /* space after control is optional, put character back if it is not a space */ - if (ch != ' ') - rtf_unget_char(ctx, ch); - - return rtf_dispatch_control(ctx, keyword, param, param_set); -} - -/* - * Route the character to the appropriate destination - */ -static int -rtf_dispatch_char(NMRtfContext *ctx, guchar ch) -{ - if (ctx->ris == NMRTF_STATE_BIN && --(ctx->bytes_to_skip) <= 0) - ctx->ris = NMRTF_STATE_NORMAL; - - switch (ctx->rds) { - case NMRTF_STATE_SKIP: - return NMRTF_OK; - case NMRTF_STATE_NORMAL: - return rtf_print_char(ctx, ch); - case NMRTF_STATE_FONTTABLE: - if (ch == ';') { - rtf_add_font_entry(ctx, ctx->chp.font_idx, - ctx->ansi->str, ctx->chp.font_charset); - g_string_truncate(ctx->ansi, 0); - } - else { - return rtf_print_char(ctx, ch); - } - return NMRTF_OK; - default: - return NMRTF_OK; - } -} - -/* Handle a unicode character */ -static int -rtf_dispatch_unicode_char(NMRtfContext *ctx, gunichar ch) -{ - switch (ctx->rds) { - case NMRTF_STATE_SKIP: - return NMRTF_OK; - case NMRTF_STATE_NORMAL: - case NMRTF_STATE_FONTTABLE: - return rtf_print_unicode_char(ctx, ch); - default: - return NMRTF_OK; - } -} - -/* - * Output a character - */ -static int -rtf_print_char(NMRtfContext *ctx, guchar ch) -{ - - ctx->ansi = g_string_append_c(ctx->ansi, ch); - - return NMRTF_OK; -} - -/* - * Output a unicode character - */ -static int -rtf_print_unicode_char(NMRtfContext *ctx, gunichar ch) -{ - char buf[7]; - int num; - - /* convert and flush the ansi buffer to the utf8 buffer */ - rtf_flush_data(ctx); - - /* convert the unicode character to utf8 and add directly to the output buffer */ - num = g_unichar_to_utf8((gunichar) ch, buf); - buf[num] = 0; - purple_debug_info("novell", "converted unichar 0x%X to utf8 char %s\n", ch, buf); - - ctx->output = g_string_append(ctx->output, buf); - return NMRTF_OK; -} - -/* - * Flush the output text - */ -static int -rtf_flush_data(NMRtfContext *ctx) -{ - int status = NMRTF_OK; - char *conv_data = NULL; - const char *enc = NULL; - GError *gerror = NULL; - - if (ctx->rds == NMRTF_STATE_NORMAL && ctx->ansi->len > 0) { - enc = get_current_encoding(ctx); - conv_data = g_convert(ctx->ansi->str, ctx->ansi->len, "UTF-8", enc, - NULL, NULL, &gerror); - if (conv_data) { - ctx->output = g_string_append(ctx->output, conv_data); - g_free(conv_data); - ctx->ansi = g_string_truncate(ctx->ansi, 0); - } else { - status = NMRTF_CONVERT_ERROR; - purple_debug_info("novell", "failed to convert data! error code = %d msg = %s\n", - gerror->code, gerror->message); - g_free(gerror); - } - } - - return status; -} - -/* - * Handle a property change - */ -static int -rtf_apply_property(NMRtfContext *ctx, NMRtfProperty prop, int val) -{ - if (ctx->rds == NMRTF_STATE_SKIP) /* If we're skipping text, */ - return NMRTF_OK; /* don't do anything. */ - - /* Need to flush any temporary data before a property change*/ - rtf_flush_data(ctx); - - switch (prop) { - case NMRTF_PROP_FONT_IDX: - ctx->chp.font_idx = val; - break; - case NMRTF_PROP_FONT_CHARSET: - ctx->chp.font_charset = val; - break; - default: - return NMRTF_BAD_TABLE; - } - - return NMRTF_OK; -} - -/* - * Step 3. - * Search the table for keyword and evaluate it appropriately. - * - * Inputs: - * keyword: The RTF control to evaluate. - * param: The parameter of the RTF control. - * param_set: TRUE if the control had a parameter; (that is, if param is valid) - * FALSE if it did not. - */ -static int -rtf_dispatch_control(NMRtfContext *ctx, char *keyword, int param, gboolean param_set) -{ - int idx; - - for (idx = 0; idx < table_size; idx++) { - if (strcmp(keyword, rtf_symbols[idx].keyword) == 0) - break; - } - - if (idx == table_size) { - if (ctx->skip_unknown) - ctx->rds = NMRTF_STATE_SKIP; - ctx->skip_unknown = FALSE; - return NMRTF_OK; - } - - /* found it! use kwd_type and action to determine what to do with it. */ - ctx->skip_unknown = FALSE; - switch (rtf_symbols[idx].kwd_type) { - case NMRTF_KWD_PROP: - if (rtf_symbols[idx].pass_default || !param_set) - param = rtf_symbols[idx].default_val; - return rtf_apply_property(ctx, rtf_symbols[idx].action, param); - case NMRTF_KWD_CHAR: - return rtf_dispatch_char(ctx, rtf_symbols[idx].action); - case NMRTF_KWD_DEST: - return rtf_change_destination(ctx, rtf_symbols[idx].action); - case NMRTF_KWD_SPEC: - return rtf_dispatch_special(ctx, rtf_symbols[idx].action); - default: - return NMRTF_BAD_TABLE; - } - return NMRTF_BAD_TABLE; -} - -/* - * Change to the destination specified. - */ -static int -rtf_change_destination(NMRtfContext *ctx, NMRtfDestinationType type) -{ - /* if we're skipping text, don't do anything */ - if (ctx->rds == NMRTF_STATE_SKIP) - return NMRTF_OK; - - switch (type) { - case NMRTF_DEST_FONTTABLE: - ctx->rds = NMRTF_STATE_FONTTABLE; - g_string_truncate(ctx->ansi, 0); - break; - default: - ctx->rds = NMRTF_STATE_SKIP; /* when in doubt, skip it... */ - break; - } - return NMRTF_OK; -} - -/* - * Dispatch an RTF control that needs special processing - */ -static int -rtf_dispatch_special(NMRtfContext *ctx, NMRtfSpecialKwd type) -{ - int status = NMRTF_OK; - guchar ch; - - if (ctx->rds == NMRTF_STATE_SKIP && type != NMRTF_SPECIAL_BIN) /* if we're skipping, and it's not */ - return NMRTF_OK; /* the \bin keyword, ignore it. */ - - switch (type) { - case NMRTF_SPECIAL_BIN: - ctx->ris = NMRTF_STATE_BIN; - ctx->bytes_to_skip = ctx->param; - break; - case NMRTF_SPECIAL_SKIP: - ctx->skip_unknown = TRUE; - break; - case NMRTF_SPECIAL_HEX: - ctx->ris = NMRTF_STATE_HEX; - break; - case NMRTF_SPECIAL_UNICODE: - purple_debug_info("novell", "parsing unichar\n"); - status = rtf_dispatch_unicode_char(ctx, ctx->param); - /* Skip next char */ - if (status == NMRTF_OK) - status = rtf_get_char(ctx, &ch); - break; - default: - status = NMRTF_BAD_TABLE; - break; - } - - return status; -} - -/* - * Get the next character from the input stream - */ -static int -rtf_get_char(NMRtfContext *ctx, guchar *ch) -{ - if (ctx->nextch >= 0) { - *ch = ctx->nextch; - ctx->nextch = -1; - } - else { - *ch = *(ctx->input); - ctx->input++; - } - - if (*ch) - return NMRTF_OK; - else - return NMRTF_EOF; -} - -/* - * Move a character back into the input stream - */ -static int -rtf_unget_char(NMRtfContext *ctx, guchar ch) -{ - ctx->nextch = ch; - return NMRTF_OK; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmrtf.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * nmrtf.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NMRTF_H__ -#define __NMRTF_H__ - -typedef struct _NMRtfContext NMRtfContext; - -NMRtfContext *nm_rtf_init(void); -char *nm_rtf_strip_formatting(NMRtfContext *ctx, const char *input); -void nm_rtf_deinit(NMRtfContext *ctx); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2137 +0,0 @@ -/* - * nmuser.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include -#include "nmfield.h" -#include "nmuser.h" -#include "nmconn.h" -#include "nmcontact.h" -#include "nmuserrecord.h" -#include "util.h" - -/* This is the template that we wrap outgoing messages in, since the other - * GW Messenger clients expect messages to be in RTF. - */ -#define RTF_TEMPLATE "{\\rtf1\\ansi\n"\ - "{\\fonttbl{\\f0\\fnil Unknown;}}\n"\ - "{\\colortbl ;\\red0\\green0\\blue0;}\n"\ - "\\uc1\\cf1\\f0\\fs24 %s\\par\n}" -#define NM_MAX_MESSAGE_SIZE 2048 - -static NMERR_T nm_process_response(NMUser * user); -static void _update_contact_list(NMUser * user, NMField * fields); -static void _handle_multiple_get_details_login_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data); -static char * nm_rtfize_text(char *text); - -/** - * See header for comments on on "public" functions - */ - -NMUser * -nm_initialize_user(const char *name, const char *server_addr, - int port, gpointer data, nm_event_cb event_callback) -{ - NMUser *user; - if (name == NULL || server_addr == NULL || event_callback == NULL) - return NULL; - - user = g_new0(NMUser, 1); - - - - user->contacts = - g_hash_table_new_full(g_str_hash, nm_utf8_str_equal, - g_free, (GDestroyNotify) nm_release_contact); - - user->user_records = - g_hash_table_new_full(g_str_hash, nm_utf8_str_equal, g_free, - (GDestroyNotify) nm_release_user_record); - - user->display_id_to_dn = g_hash_table_new_full(g_str_hash, nm_utf8_str_equal, - g_free, g_free); - - user->name = g_strdup(name); - user->conn = nm_create_conn(server_addr, port); - user->conn->addr = g_strdup(server_addr); - user->conn->port = port; - user->evt_callback = event_callback; - user->client_data = data; - - return user; -} - - -void -nm_deinitialize_user(NMUser * user) -{ - nm_release_conn(user->conn); - - if (user->contacts) { - g_hash_table_destroy(user->contacts); - } - - if (user->user_records) { - g_hash_table_destroy(user->user_records); - } - - if (user->display_id_to_dn) { - g_hash_table_destroy(user->display_id_to_dn); - } - - if (user->name) { - g_free(user->name); - } - - if (user->user_record) { - nm_release_user_record(user->user_record); - } - - nm_conference_list_free(user); - nm_destroy_contact_list(user); - - g_free(user); -} - -NMERR_T -nm_send_login(NMUser * user, const char *pwd, const char *my_addr, - const char *user_agent, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL || pwd == NULL || user_agent == NULL) { - return NMERR_BAD_PARM; - } - - fields = nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(user->name), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_CREDENTIALS, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(pwd), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_SZ_USER_AGENT, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(user_agent), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_number(fields, NM_A_UD_BUILD, 0, NMFIELD_METHOD_VALID, 0, - NM_PROTOCOL_VERSION, NMFIELD_TYPE_UDWORD); - if (my_addr) { - fields = nm_field_add_pointer(fields, NM_A_IP_ADDRESS, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(my_addr), NMFIELD_TYPE_UTF8); - } - - /* Send the login */ - rc = nm_send_request(user->conn, "login", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_set_status(NMUser * user, int status, const char *text, - const char *auto_resp, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL) - return NMERR_BAD_PARM; - - /* Add the status */ - fields = nm_field_add_pointer(fields, NM_A_SZ_STATUS, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", status), NMFIELD_TYPE_UTF8); - - /* Add the status text and auto reply text if there is any */ - if (text) { - fields = nm_field_add_pointer(fields, NM_A_SZ_STATUS_TEXT, 0, - NMFIELD_METHOD_VALID, 0, g_strdup(text), - NMFIELD_TYPE_UTF8); - } - - if (auto_resp) { - fields = nm_field_add_pointer(fields, NM_A_SZ_MESSAGE_BODY, 0, - NMFIELD_METHOD_VALID, 0, g_strdup(auto_resp), - NMFIELD_TYPE_UTF8); - } - - rc = nm_send_request(user->conn, "setstatus", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_multiple_get_details(NMUser * user, GSList *names, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - GSList *node; - - if (user == NULL || names == NULL) - return NMERR_BAD_PARM; - - /* Add in DN or display id */ - for (node = names; node; node = node->next) { - fields = nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(node->data), NMFIELD_TYPE_UTF8); - } - - rc = nm_send_request(user->conn, "getdetails", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_get_details(NMUser * user, const char *name, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL || name == NULL) - return NMERR_BAD_PARM; - - /* Add in DN or display id */ - if (strstr("=", name)) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_DN); - } else { - - const char *dn = nm_lookup_dn(user, name); - if (dn) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_DN); - } else { - fields = - nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_UTF8); - } - - } - - rc = nm_send_request(user->conn, "getdetails", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_create_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMField *field = NULL; - NMRequest *req = NULL; - int count, i; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in a blank guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(BLANK_GUID), NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - - /* Add participants in */ - count = nm_conference_get_participant_count(conference); - for (i = 0; i < count; i++) { - NMUserRecord *user_record = nm_conference_get_participant(conference, i); - - if (user_record) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, - 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_user_record_get_dn(user_record)), - NMFIELD_TYPE_DN); - } - } - - /* Add our user in */ - field = nm_locate_field(NM_A_SZ_DN, user->fields); - if (field) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, - 0, NMFIELD_METHOD_VALID, 0, - g_strdup((char *) field->ptr_value), - NMFIELD_TYPE_DN); - } - - rc = nm_send_request(user->conn, "createconf", fields, callback, data, &req); - if (rc == NM_OK && req) { - nm_conference_add_ref(conference); - nm_request_set_data(req, conference); - } - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_leave_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "leaveconf", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_join_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL, *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "joinconf", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_reject_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "rejectconf", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_conference_invite(NMUser *user, NMConference *conference, NMUserRecord *user_record, - const char *message, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *tmp = NULL; - NMRequest *req = NULL; - - if (user == NULL || conference == NULL || user_record == NULL) - return NMERR_BAD_PARM; - - /* Add in the conference guid */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conference)), - NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, - NMFIELD_METHOD_VALID, 0, tmp, - NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Add in DN of user to invite */ - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_user_record_get_dn(user_record)), - NMFIELD_TYPE_DN); - - /* Add the invite message if there is one */ - if (message) - fields = nm_field_add_pointer(fields, NM_A_SZ_MESSAGE_BODY, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(message), NMFIELD_TYPE_UTF8); - - /* Send the request to the server */ - rc = nm_send_request(user->conn, "sendinvite", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, conference); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_message(NMUser * user, NMMessage * message, nm_response_cb callback) -{ - NMERR_T rc = NM_OK; - char *text, *rtfized; - NMField *fields = NULL, *tmp = NULL; - NMConference *conf; - NMUserRecord *user_record; - int count, i; - - if (user == NULL || message == NULL) { - return NMERR_BAD_PARM; - } - - conf = nm_message_get_conference(message); - if (!nm_conference_is_instantiated(conf)) { - rc = NMERR_CONFERENCE_NOT_INSTANTIATED; - } else { - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conf)), - NMFIELD_TYPE_UTF8); - - fields = - nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, NMFIELD_METHOD_VALID, 0, - tmp, NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Add RTF and plain text versions of the message */ - text = g_strdup(nm_message_get_text(message)); - - /* Truncate if necessary */ - if (strlen(text) > NM_MAX_MESSAGE_SIZE) - text[NM_MAX_MESSAGE_SIZE] = 0; - - rtfized = nm_rtfize_text(text); - - purple_debug_info("novell", "message text is: %s\n", text); - purple_debug_info("novell", "message rtf is: %s\n", rtfized); - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_MESSAGE_BODY, 0, NMFIELD_METHOD_VALID, 0, - rtfized, NMFIELD_TYPE_UTF8); - - tmp = nm_field_add_number(tmp, NM_A_UD_MESSAGE_TYPE, 0, NMFIELD_METHOD_VALID, 0, - 0, NMFIELD_TYPE_UDWORD); - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_MESSAGE_TEXT, 0, NMFIELD_METHOD_VALID, 0, - text, NMFIELD_TYPE_UTF8); - - fields = nm_field_add_pointer(fields, NM_A_FA_MESSAGE, 0, NMFIELD_METHOD_VALID, 0, - tmp, NMFIELD_TYPE_ARRAY); - tmp = NULL; - - /* Add participants */ - count = nm_conference_get_participant_count(conf); - for (i = 0; i < count; i++) { - user_record = nm_conference_get_participant(conf, i); - if (user_record) { - fields = - nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_user_record_get_dn(user_record)), - NMFIELD_TYPE_DN); - } - } - - /* Send the request */ - rc = nm_send_request(user->conn, "sendmessage", fields, callback, NULL, NULL); - } - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_typing(NMUser * user, NMConference * conf, - gboolean typing, nm_response_cb callback) -{ - NMERR_T rc = NM_OK; - char *str = NULL; - NMField *fields = NULL, *tmp = NULL; - - if (user == NULL || conf == NULL) { - return NMERR_BAD_PARM; - } - - if (!nm_conference_is_instantiated(conf)) { - rc = NMERR_CONFERENCE_NOT_INSTANTIATED; - } else { - /* Add the conference GUID */ - tmp = nm_field_add_pointer(tmp, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(nm_conference_get_guid(conf)), - NMFIELD_TYPE_UTF8); - - /* Add typing type */ - str = g_strdup_printf("%d", - (typing ? NMEVT_USER_TYPING : - NMEVT_USER_NOT_TYPING)); - - tmp = nm_field_add_pointer(tmp, NM_A_SZ_TYPE, 0, NMFIELD_METHOD_VALID, 0, - str, NMFIELD_TYPE_UTF8); - - fields = - nm_field_add_pointer(fields, NM_A_FA_CONVERSATION, 0, NMFIELD_METHOD_VALID, 0, - tmp, NMFIELD_TYPE_ARRAY); - tmp = NULL; - - rc = nm_send_request(user->conn, "sendtyping", fields, callback, NULL, NULL); - } - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_create_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - const char *name = NULL; - const char *display_name = NULL; - - if (user == NULL || folder == NULL || contact == NULL) { - return NMERR_BAD_PARM; - } - - /* Add parent ID */ - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Check to see if userid is current user and return an error? */ - - /* Check to see if contact already exists and return an error? */ - - /* Add userid or dn */ - name = nm_contact_get_dn(contact); - if (name == NULL) - return NMERR_BAD_PARM; - - if (strstr("=", name)) { - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_DN); - } else { - fields = nm_field_add_pointer(fields, NM_A_SZ_USERID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_UTF8); - } - - /* Add display name */ - display_name = nm_contact_get_display_name(contact); - if (display_name) - fields = nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(display_name), NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "createcontact", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_remove_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - - if (user == NULL || folder == NULL || contact == NULL) { - return NMERR_BAD_PARM; - } - - /* Add parent id */ - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Add object id */ - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_contact_get_id(contact)), - NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "deletecontact", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_create_folder(NMUser * user, const char *name, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - - if (user == NULL || name == NULL) { - return NMERR_BAD_PARM; - } - - /* Add parent ID */ - fields = nm_field_add_pointer(fields, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("0"), NMFIELD_TYPE_UTF8); - - /* Add name of the folder to add */ - fields = - nm_field_add_pointer(fields, NM_A_SZ_DISPLAY_NAME, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(name), NMFIELD_TYPE_UTF8); - - /* Add sequence, for now just put it at the bottom */ - fields = - nm_field_add_pointer(fields, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, 0, - g_strdup("-1"), NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "createfolder", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, g_strdup(name)); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_remove_folder(NMUser * user, NMFolder * folder, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - - if (user == NULL || folder == NULL) { - return NMERR_BAD_PARM; - } - - /* Add the object id */ - fields = nm_field_add_pointer(fields, NM_A_SZ_OBJECT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "deletecontact", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, folder); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_get_status(NMUser * user, NMUserRecord * user_record, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMRequest *req = NULL; - const char *dn; - - if (user == NULL || user_record == NULL) - return NMERR_BAD_PARM; - - /* Add DN to field list */ - dn = nm_user_record_get_dn(user_record); - if (dn == NULL) - return (NMERR_T) -1; - - fields = nm_field_add_pointer(fields, NM_A_SZ_DN, 0, NMFIELD_METHOD_VALID, 0, - g_strdup(dn), NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "getstatus", fields, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, user_record); - - if (req) - nm_release_request(req); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_rename_contact(NMUser * user, NMContact * contact, - const char *new_name, nm_response_cb callback, - gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *field = NULL, *fields = NULL, *list = NULL; - NMRequest *req = NULL; - - if (user == NULL || contact == NULL || new_name == NULL) - return NMERR_BAD_PARM; - - /* Create field list for current contact */ - field = nm_contact_to_fields(contact); - if (field) { - - fields = - nm_field_add_pointer(fields, NM_A_FA_CONTACT, 0, NMFIELD_METHOD_DELETE, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Update the contacts display name locally */ - nm_contact_set_display_name(contact, new_name); - - /* Create field list for updated contact */ - field = nm_contact_to_fields(contact); - if (field) { - fields = - nm_field_add_pointer(fields, NM_A_FA_CONTACT, 0, NMFIELD_METHOD_ADD, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Package it up */ - list = - nm_field_add_pointer(list, NM_A_FA_CONTACT_LIST, 0, NMFIELD_METHOD_VALID, - 0, fields, NMFIELD_TYPE_ARRAY); - fields = NULL; - - rc = nm_send_request(user->conn, "updateitem", list, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - } - } - - if (req) - nm_release_request(req); - - if (list) - nm_free_fields(&list); - - return rc; -} - -NMERR_T -nm_send_rename_folder(NMUser * user, NMFolder * folder, const char *new_name, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *field = NULL, *fields = NULL, *list = NULL; - NMRequest *req = NULL; - - if (user == NULL || folder == NULL || new_name == NULL) - return NMERR_BAD_PARM; - - /* Make sure folder does not already exist!? */ - if (nm_find_folder(user, new_name)) - return NMERR_FOLDER_EXISTS; - - /* Create field list for current folder */ - field = nm_folder_to_fields(folder); - if (field) { - - fields = nm_field_add_pointer(fields, NM_A_FA_FOLDER, 0, NMFIELD_METHOD_DELETE, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Update the folders display name locally */ - nm_folder_set_name(folder, new_name); - - /* Create field list for updated folder */ - field = nm_folder_to_fields(folder); - if (field) { - fields = nm_field_add_pointer(fields, NM_A_FA_FOLDER, 0, NMFIELD_METHOD_ADD, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Package it up */ - list = nm_field_add_pointer(list, NM_A_FA_CONTACT_LIST, 0, NMFIELD_METHOD_VALID, - 0, fields, NMFIELD_TYPE_ARRAY); - fields = NULL; - - rc = nm_send_request(user->conn, "updateitem", list, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, folder); - } - } - - if (req) - nm_release_request(req); - - if (list) - nm_free_fields(&list); - - return rc; -} - -NMERR_T -nm_send_move_contact(NMUser * user, NMContact * contact, NMFolder * folder, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *field = NULL, *fields = NULL, *list = NULL; - NMRequest *req = NULL; - - if (user == NULL || contact == NULL || folder == NULL) - return NMERR_BAD_PARM; - - /* Create field list for the contact */ - field = nm_contact_to_fields(contact); - if (field) { - - fields = nm_field_add_pointer(fields, NM_A_FA_CONTACT, 0, NMFIELD_METHOD_DELETE, 0, - field, NMFIELD_TYPE_ARRAY); - field = NULL; - - /* Wrap the contact up and add it to the request field list */ - list = nm_field_add_pointer(list, NM_A_FA_CONTACT_LIST, 0, NMFIELD_METHOD_VALID, 0, - fields, NMFIELD_TYPE_ARRAY); - fields = NULL; - - /* Add sequence number */ - list = nm_field_add_pointer(list, NM_A_SZ_SEQUENCE_NUMBER, 0, NMFIELD_METHOD_VALID, - 0, g_strdup("-1"), NMFIELD_TYPE_UTF8); - - /* Add parent ID */ - list = nm_field_add_pointer(list, NM_A_SZ_PARENT_ID, 0, NMFIELD_METHOD_VALID, 0, - g_strdup_printf("%d", nm_folder_get_id(folder)), - NMFIELD_TYPE_UTF8); - - /* Dispatch the request */ - rc = nm_send_request(user->conn, "movecontact", list, callback, data, &req); - if (rc == NM_OK && req) - nm_request_set_data(req, contact); - - } - - if (req) - nm_release_request(req); - - if (list) - nm_free_fields(&list); - - return rc; -} - - -NMERR_T -nm_send_create_privacy_item(NMUser *user, const char *who, gboolean allow_list, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - const char *tag; - - if (user == NULL || who == NULL) - return NMERR_BAD_PARM; - - if (allow_list) - tag = NM_A_SZ_BLOCKING_ALLOW_ITEM; - else - tag = NM_A_SZ_BLOCKING_DENY_ITEM; - - fields = nm_field_add_pointer(fields, tag, 0, NMFIELD_METHOD_ADD, 0, - g_strdup(who), NMFIELD_TYPE_UTF8); - - rc = nm_send_request(user->conn, "createblock", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_remove_privacy_item(NMUser *user, const char *dn, gboolean allow_list, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - const char *tag; - GSList **list_ptr, *node; - - if (user == NULL || dn == NULL) - return NMERR_BAD_PARM; - - if (allow_list) { - tag = NM_A_BLOCKING_ALLOW_LIST; - list_ptr = &user->allow_list; - } else { - tag = NM_A_BLOCKING_DENY_LIST; - list_ptr = &user->deny_list; - } - - /* Remove item from the cached list */ - if ((node = g_slist_find_custom(*list_ptr, dn, (GCompareFunc)purple_utf8_strcasecmp))) { - *list_ptr = g_slist_remove_link(*list_ptr, node); - g_slist_free_1(node); - } - - fields = nm_field_add_pointer(fields, tag, 0, NMFIELD_METHOD_DELETE, 0, - g_strdup(dn), NMFIELD_TYPE_DN); - - rc = nm_send_request(user->conn, "updateblocks", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; - -} - -NMERR_T -nm_send_set_privacy_default(NMUser *user, gboolean default_deny, - nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - - if (user == NULL) - return NMERR_BAD_PARM; - - fields = nm_field_add_pointer(fields, NM_A_BLOCKING, 0, NMFIELD_METHOD_UPDATE, 0, - (default_deny ? g_strdup("1") : g_strdup("0")), - NMFIELD_TYPE_UTF8); - - rc = nm_send_request(user->conn, "updateblocks", fields, callback, data, NULL); - - nm_free_fields(&fields); - return rc; -} - -NMERR_T -nm_send_keepalive(NMUser *user, nm_response_cb callback, gpointer data) -{ - NMERR_T rc = NM_OK; - - if (user == NULL) - return NMERR_BAD_PARM; - - rc = nm_send_request(user->conn, "ping", NULL, callback, data, NULL); - - return rc; -} - -NMERR_T -nm_process_new_data(NMUser * user) -{ - NMConn *conn; - NMERR_T rc = NM_OK; - guint32 val; - - if (user == NULL) - return NMERR_BAD_PARM; - - conn = user->conn; - - /* Check to see if this is an event or a response */ - rc = nm_read_all(conn, (char *) &val, sizeof(val)); - if (rc == NM_OK) { - if (strncmp((char *) &val, "HTTP", strlen("HTTP")) == 0) - rc = nm_process_response(user); - else - rc = nm_process_event(user, GUINT32_FROM_LE(val)); - - } else { - if (errno == EAGAIN) - rc = NM_OK; - else - rc = NMERR_PROTOCOL; - } - - return rc; -} - -NMConference * -nm_find_conversation(NMUser * user, const char *who) -{ - NMConference *conference = NULL; - NMConference *tmp; - GSList *cnode; - - if (user && user->conferences) { - for (cnode = user->conferences; cnode; cnode = cnode->next) { - tmp = cnode->data; - if (nm_conference_get_participant_count(tmp) == 1) { - NMUserRecord *ur = nm_conference_get_participant(tmp, 0); - - if (ur) { - if (nm_utf8_str_equal(nm_user_record_get_dn(ur), who)) { - conference = tmp; - break; - } - } - } - } - } - - return conference; -} - -void -nm_conference_list_add(NMUser * user, NMConference * conf) -{ - if (user == NULL || conf == NULL) - return; - - nm_conference_add_ref(conf); - user->conferences = g_slist_append(user->conferences, conf); -} - -void -nm_conference_list_remove(NMUser * user, NMConference * conf) -{ - if (user == NULL || conf == NULL) - return; - - if (g_slist_find(user->conferences, conf)) { - user->conferences = g_slist_remove(user->conferences, conf); - nm_release_conference(conf); - } -} - -void -nm_conference_list_free(NMUser * user) -{ - GSList *cnode; - NMConference *conference; - - if (user == NULL) - return; - - if (user->conferences) { - for (cnode = user->conferences; cnode; cnode = cnode->next) { - conference = cnode->data; - cnode->data = NULL; - nm_release_conference(conference); - } - - g_slist_free(user->conferences); - user->conferences = NULL; - } -} - -NMConference * -nm_conference_list_find(NMUser * user, const char *guid) -{ - GSList *cnode; - NMConference *conference = NULL, *tmp; - - if (user == NULL || guid == NULL) - return NULL; - - if (user->conferences) { - for (cnode = user->conferences; cnode; cnode = cnode->next) { - tmp = cnode->data; - if (nm_are_guids_equal(nm_conference_get_guid(tmp), guid)) { - conference = tmp; - break; - } - } - } - - return conference; -} - -gboolean -nm_are_guids_equal(const char *guid1, const char *guid2) -{ - if (guid1 == NULL || guid2 == NULL) - return FALSE; - - return (strncmp(guid1, guid2, CONF_GUID_END) == 0); -} - -void -nm_user_add_contact(NMUser * user, NMContact * contact) -{ - if (user == NULL || contact == NULL) - return; - - nm_contact_add_ref(contact); - - g_hash_table_insert(user->contacts, - g_utf8_strdown(nm_contact_get_dn(contact), -1), contact); -} - -void -nm_user_add_user_record(NMUser * user, NMUserRecord * user_record) -{ - const char *display_id; - const char *dn; - - if (!user || !user_record) - return; - - display_id = nm_user_record_get_display_id(user_record); - dn = nm_user_record_get_dn(user_record); - - if (!dn || !display_id) - return; - - nm_user_record_add_ref(user_record); - - g_hash_table_insert(user->user_records, - g_utf8_strdown(dn, -1), - user_record); - - g_hash_table_insert(user->display_id_to_dn, - g_utf8_strdown(display_id, -1), - g_utf8_strdown(dn, -1)); -} - -nm_event_cb -nm_user_get_event_callback(NMUser * user) -{ - if (user == NULL) - return NULL; - - return user->evt_callback; -} - -NMConn * -nm_user_get_conn(NMUser * user) -{ - if (user == NULL) - return NULL; - - return user->conn; -} - -NMERR_T -nm_create_contact_list(NMUser * user) -{ - NMERR_T rc = NM_OK; - NMField *locate = NULL; - - if (user == NULL || user->fields == NULL) { - return NMERR_BAD_PARM; - } - - /* Create the root folder */ - user->root_folder = nm_create_folder(""); - - /* Find the contact list in the login fields */ - locate = nm_locate_field(NM_A_FA_CONTACT_LIST, user->fields); - if (locate != NULL) { - - /* Add the folders and then the contacts */ - nm_folder_add_contacts_and_folders(user, user->root_folder, - (NMField *) (locate->ptr_value)); - - } - - return rc; -} - -gboolean nm_user_is_privacy_locked(NMUser *user) -{ - if (user) { - return user->privacy_locked; - } - - return FALSE; -} - -static gboolean -_create_privacy_list(NMUser * user, NMRequest *request) -{ - NMField *locate = NULL; - GSList *need_details = NULL; - - /* Are the privacy settings locked */ - locate = nm_locate_field(NM_A_LOCKED_ATTR_LIST, user->fields); - if (locate && locate->ptr_value) { - if (locate->type == NMFIELD_TYPE_UTF8 && - (purple_utf8_strcasecmp(locate->ptr_value, NM_A_BLOCKING) == 0)) { - user->privacy_locked = TRUE; - } else if (locate->type == NMFIELD_TYPE_MV || - locate->type == NMFIELD_TYPE_ARRAY) { - NMField *tmp = (NMField *)locate->ptr_value; - while (tmp && tmp->tag) { - if (purple_utf8_strcasecmp(tmp->ptr_value, NM_A_BLOCKING) == 0) { - user->privacy_locked = TRUE; - break; - } - tmp++; - } - } - } - - /* Set default deny flag */ - locate = nm_locate_field(NM_A_BLOCKING, user->fields); - if (locate && locate->ptr_value) { - user->default_deny = atoi((char *)locate->ptr_value); - } - - /* Read internal blocking allow list */ - locate = nm_locate_field(NM_A_BLOCKING_ALLOW_LIST, user->fields); - if (locate && locate->ptr_value) { - - if (locate->type == NMFIELD_TYPE_MV) { - locate = (NMField *)locate->ptr_value; - for (; locate->tag != NULL; locate++) { - if (locate->ptr_value) { - - user->allow_list = g_slist_append(user->allow_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - } else { - - user->allow_list = g_slist_append(user->allow_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - - /* Read internal blocking deny list */ - locate = nm_locate_field(NM_A_BLOCKING_DENY_LIST, user->fields); - if (locate && locate->ptr_value) { - - if (locate->type == NMFIELD_TYPE_MV) { - locate = (NMField *)locate->ptr_value; - for (; locate->tag != NULL; locate++) { - if (locate->ptr_value) { - - user->deny_list = g_slist_append(user->deny_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - } else { - - user->deny_list = g_slist_append(user->deny_list, (char *)locate->ptr_value); - - if (nm_find_user_record(user, (char *)locate->ptr_value) == NULL) - need_details = g_slist_append(need_details, (char *)locate->ptr_value); - - } - } - - if (need_details) { - - nm_request_add_ref(request); - nm_send_multiple_get_details(user, need_details, - _handle_multiple_get_details_login_cb, request); - - return FALSE; - } - - return TRUE; -} - -void -nm_destroy_contact_list(NMUser * user) -{ - if (user == NULL) - return; - - if (user->root_folder) { - nm_release_folder(user->root_folder); - user->root_folder = NULL; - } -} - -NMFolder * -nm_get_root_folder(NMUser * user) -{ - if (user == NULL) - return NULL; - - if (user->root_folder == NULL) - nm_create_contact_list(user); - - return user->root_folder; -} - -NMContact * -nm_find_contact(NMUser * user, const char *name) -{ - char *str; - const char *dn = NULL; - NMContact *contact = NULL; - - if (user == NULL || name == NULL) - return NULL; - - str = g_utf8_strdown(name, -1); - if (strstr(str, "=")) { - dn = str; - } else { - /* Assume that we have a display id instead of a dn */ - dn = (const char *) g_hash_table_lookup(user->display_id_to_dn, str); - } - - /* Find contact object in reference table */ - if (dn) { - contact = (NMContact *) g_hash_table_lookup(user->contacts, dn); - } - - g_free(str); - return contact; -} - -GList * -nm_find_contacts(NMUser * user, const char *dn) -{ - guint32 i, cnt; - NMFolder *folder; - NMContact *contact; - GList *contacts = NULL; - - if (user == NULL || dn == NULL) - return NULL; - - /* Check for contact at the root */ - contact = nm_folder_find_contact(user->root_folder, dn); - if (contact) { - contacts = g_list_append(contacts, contact); - contact = NULL; - } - - /* Check for contact in each subfolder */ - cnt = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < cnt; i++) { - folder = nm_folder_get_subfolder(user->root_folder, i); - contact = nm_folder_find_contact(folder, dn); - if (contact) { - contacts = g_list_append(contacts, contact); - contact = NULL; - } - } - - return contacts; -} - -NMUserRecord * -nm_find_user_record(NMUser * user, const char *name) -{ - char *str = NULL; - const char *dn = NULL; - NMUserRecord *user_record = NULL; - - if (user == NULL || name == NULL) - return NULL; - - str = g_utf8_strdown(name, -1); - if (strstr(str, "=")) { - dn = str; - } else { - /* Assume that we have a display id instead of a dn */ - dn = (const char *) g_hash_table_lookup(user->display_id_to_dn, str); - } - - /* Find user record in reference table */ - if (dn) { - user_record = - (NMUserRecord *) g_hash_table_lookup(user->user_records, dn); - } - - g_free(str); - return user_record; -} - -const char * -nm_lookup_dn(NMUser * user, const char *display_id) -{ - const char *dn; - char *lower; - - if (user == NULL || display_id == NULL) - return NULL; - - lower = g_utf8_strdown(display_id, -1); - dn = g_hash_table_lookup(user->display_id_to_dn, lower); - g_free(lower); - - return dn; -} - -NMFolder * -nm_find_folder(NMUser * user, const char *name) -{ - NMFolder *folder = NULL, *temp; - int i, num_folders; - const char *tname = NULL; - - if (user == NULL || name == NULL) - return NULL; - - if (*name == '\0') - return user->root_folder; - - num_folders = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < num_folders; i++) { - temp = nm_folder_get_subfolder(user->root_folder, i); - tname = nm_folder_get_name(temp); - if (tname && (strcmp(tname, name) == 0)) { - folder = temp; - break; - } - } - - return folder; -} - -NMFolder * -nm_find_folder_by_id(NMUser * user, int object_id) -{ - NMFolder *folder = NULL, *temp; - int i, num_folders; - - if (user == NULL) - return NULL; - - if (object_id == 0) - return user->root_folder; - - num_folders = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < num_folders; i++) { - temp = nm_folder_get_subfolder(user->root_folder, i); - if (nm_folder_get_id(temp) == object_id) { - folder = temp; - break; - } - } - - return folder; -} - -static void -_handle_multiple_get_details_login_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - nm_response_cb cb; - NMRequest *request = user_data; - - if (user == NULL || request == NULL) - return; - - if ((cb = nm_request_get_callback(request))) { - cb(user, ret_code, nm_request_get_data(request), - nm_request_get_user_define(request)); - nm_release_request(request); - } -} - -static void -_handle_multiple_get_details_joinconf_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMRequest *request = user_data; - NMUserRecord *user_record = resp_data; - NMConference *conference; - GSList *list, *node; - - if (user == NULL || resp_data == NULL || user_data == NULL) - return; - - conference = nm_request_get_data(request); - list = nm_request_get_user_define(request); - - if (ret_code == 0 && conference && list) { - - /* Add the user to the conference */ - nm_conference_add_participant(conference, user_record); - - /* Find the user in the list and remove it */ - for (node = list; node; node = node->next) { - if (nm_utf8_str_equal(nm_user_record_get_dn(user_record), - (const char *) node->data)) { - g_free(node->data); - list = g_slist_remove(list, node->data); - nm_request_set_user_define(request, list); - break; - } - } - - /* Time to callback? */ - if (list == NULL) { - nm_response_cb cb = nm_request_get_callback(request); - - if (cb) { - cb(user, 0, conference, conference); - } - nm_release_request(request); - } - } -} - -static NMERR_T -nm_call_handler(NMUser * user, NMRequest * request, NMField * fields) -{ - NMERR_T rc = NM_OK, ret_code = NM_OK; - NMConference *conf = NULL; - NMUserRecord *user_record = NULL; - NMField *locate = NULL; - NMField *field = NULL; - const char *cmd; - nm_response_cb cb; - gboolean done = TRUE; - - if (user == NULL || request == NULL || fields == NULL) - return NMERR_BAD_PARM; - - /* Get the return code */ - field = nm_locate_field(NM_A_SZ_RESULT_CODE, fields); - if (field) { - ret_code = atoi((char *) field->ptr_value); - } else { - ret_code = NMERR_PROTOCOL; - } - - cmd = nm_request_get_cmd(request); - if (ret_code == NM_OK && cmd != NULL) { - - if (strcmp("login", cmd) == 0) { - - user->user_record = nm_create_user_record_from_fields(fields); - - /* Save the users fields */ - user->fields = nm_copy_field_array(fields); - - nm_create_contact_list(user); - done = _create_privacy_list(user, request); - - } else if (strcmp("setstatus", cmd) == 0) { - - /* Nothing to do */ - - } else if (strcmp("createconf", cmd) == 0) { - - conf = (NMConference *) nm_request_get_data(request); - - /* get the convo guid */ - locate = nm_locate_field(NM_A_FA_CONVERSATION, fields); - if (locate) { - field = - nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value); - if (field) { - nm_conference_set_guid(conf, (char *) field->ptr_value); - } - } - - nm_conference_list_add(user, conf); - nm_release_conference(conf); - - } else if (strcmp("leaveconf", cmd) == 0) { - - conf = (NMConference *) nm_request_get_data(request); - nm_conference_list_remove(user, conf); - - } else if (strcmp("joinconf", cmd) == 0) { - GSList *list = NULL, *node; - - conf = nm_request_get_data(request); - - locate = nm_locate_field(NM_A_FA_CONTACT_LIST, fields); - if (locate && locate->ptr_value != 0) { - - field = (NMField *) locate->ptr_value; - while ((field = nm_locate_field(NM_A_SZ_DN, field))) { - if (field && field->ptr_value != 0) { - - if (nm_utf8_str_equal - (nm_user_record_get_dn(user->user_record), - (const char *) field->ptr_value)) { - field++; - continue; - } - - user_record = - nm_find_user_record(user, - (const char *) field->ptr_value); - if (user_record == NULL) { - list = - g_slist_append(list, - g_strdup((char *) field->ptr_value)); - } else { - nm_conference_add_participant(conf, user_record); - } - } - field++; - } - - if (list != NULL) { - - done = FALSE; - nm_request_set_user_define(request, list); - nm_request_add_ref(request); - for (node = list; node; node = node->next) { - - nm_send_get_details(user, (const char *) node->data, - _handle_multiple_get_details_joinconf_cb, - request); - } - } - } - - } else if (strcmp("getdetails", cmd) == 0) { - - locate = nm_locate_field(NM_A_FA_RESULTS, fields); - while (locate && locate->ptr_value != 0) { - - user_record = nm_create_user_record_from_fields(locate); - if (user_record) { - NMUserRecord *tmp; - - tmp = - nm_find_user_record(user, - nm_user_record_get_dn(user_record)); - if (tmp) { - - /* Update the existing user record */ - nm_user_record_copy(tmp, user_record); - nm_release_user_record(user_record); - user_record = tmp; - - } else { - nm_user_add_user_record(user, user_record); - nm_release_user_record(user_record); - } - - /* Response data is new user record */ - nm_request_set_data(request, (gpointer) user_record); - } - - locate = nm_locate_field(NM_A_FA_RESULTS, locate+1); - } - - } else if (strcmp("createfolder", cmd) == 0) { - - _update_contact_list(user, fields); - - } else if (strcmp("createcontact", cmd) == 0) { - - _update_contact_list(user, fields); - - locate = - nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) fields->ptr_value); - if (locate) { - - NMContact *new_contact = - nm_folder_find_item_by_object_id(user->root_folder, - atoi((char *)locate->ptr_value)); - - if (new_contact) { - - /* Add the contact to our cache */ - nm_user_add_contact(user, new_contact); - - /* Set the contact as the response data */ - nm_request_set_data(request, (gpointer) new_contact); - - } - - } - - } else if (strcmp("deletecontact", cmd) == 0) { - - _update_contact_list(user, fields); - - } else if (strcmp("movecontact", cmd) == 0) { - - _update_contact_list(user, fields); - - } else if (strcmp("getstatus", cmd) == 0) { - - locate = nm_locate_field(NM_A_SZ_STATUS, fields); - if (locate) { - nm_user_record_set_status((NMUserRecord *) - nm_request_get_data(request), - atoi((char *) locate->ptr_value), NULL); - } - - } else if (strcmp("updateitem", cmd) == 0) { - - /* Nothing extra to do here */ - - } else if (strcmp("createblock", cmd) == 0) { - if ((locate = nm_locate_field(NM_A_BLOCKING_DENY_LIST, fields))) { - if (locate->ptr_value) { - user->deny_list = g_slist_append(user->deny_list, g_strdup((char *)locate->ptr_value)); - } - } else if ((locate = nm_locate_field(NM_A_BLOCKING_ALLOW_LIST, fields))) { - if (locate->ptr_value) { - user->allow_list = g_slist_append(user->allow_list, g_strdup((char *)locate->ptr_value)); - } - } - } else if (strcmp("updateblocks", cmd) == 0) { - /* nothing to do here */ - } else { - - /* Nothing to do, just print debug message */ - purple_debug(PURPLE_DEBUG_INFO, "novell", - "nm_call_handler(): Unknown request command, %s\n", cmd); - - } - } - - if (done && (cb = nm_request_get_callback(request))) { - - cb(user, ret_code, nm_request_get_data(request), - nm_request_get_user_define(request)); - } - - return rc; -} - -static NMERR_T -nm_process_response(NMUser * user) -{ - NMERR_T rc = NM_OK; - NMField *fields = NULL; - NMField *field = NULL; - NMConn *conn = user->conn; - NMRequest *req = NULL; - - rc = nm_read_header(conn); - if (rc == NM_OK) { - rc = nm_read_fields(conn, -1, &fields); - } - - if (rc == NM_OK) { - field = nm_locate_field(NM_A_SZ_TRANSACTION_ID, fields); - if (field != NULL && field->ptr_value != 0) { - req = nm_conn_find_request(conn, atoi((char *) field->ptr_value)); - if (req != NULL) { - rc = nm_call_handler(user, req, fields); - nm_conn_remove_request_item(conn, req); - } - - } - } - - if (fields) - nm_free_fields(&fields); - - return rc; -} - -/* - * Some utility functions...haven't figured out where - * they belong yet. - */ - -gboolean -nm_utf8_str_equal(gconstpointer str1, gconstpointer str2) -{ - return (purple_utf8_strcasecmp(str1, str2) == 0); -} - -char * -nm_typed_to_dotted(const char *typed) -{ - unsigned i = 0, j = 0; - char *dotted; - - if (typed == NULL) - return NULL; - - dotted = g_new0(char, strlen(typed)); - - do { - - /* replace comma with a dot */ - if (j != 0) { - dotted[j] = '.'; - j++; - } - - /* skip the type */ - while (typed[i] != '\0' && typed[i] != '=') - i++; - - /* verify that we aren't running off the end */ - if (typed[i] == '\0') { - dotted[j] = '\0'; - break; - } - - i++; - - /* copy the object name to context */ - while (typed[i] != '\0' && typed[i] != ',') { - dotted[j] = typed[i]; - j++; - i++; - } - - } while (typed[i] != '\0'); - - return dotted; -} - -const char * -nm_error_to_string(NMERR_T err) -{ - static char *unknown_msg = NULL; - - g_free(unknown_msg); - unknown_msg = NULL; - - switch (err) { - - case NMERR_BAD_PARM: - return _("Required parameters not passed in"); - - case NMERR_TCP_WRITE: - return _("Unable to write to network"); - - case NMERR_TCP_READ: - return _("Unable to read from network"); - - case NMERR_PROTOCOL: - return _("Error communicating with server"); - - case NMERR_CONFERENCE_NOT_FOUND: - case NMERR_CONFERENCE_NOT_FOUND_2: - return _("Conference not found"); - - case NMERR_CONFERENCE_NOT_INSTANTIATED: - return _("Conference does not exist"); - - case NMERR_DUPLICATE_FOLDER: - case NMERR_FOLDER_EXISTS: - return _("A folder with that name already exists"); - - case NMERR_NOT_SUPPORTED: - return _("Not supported"); - - case NMERR_PASSWORD_EXPIRED: - case NMERR_PASSWORD_EXPIRED_2: - return _("Password has expired"); - - case NMERR_PASSWORD_INVALID: - return _("Incorrect password"); - - case NMERR_USER_NOT_FOUND: - return _("User not found"); - - case NMERR_USER_DISABLED: - return _("Account has been disabled"); - - case NMERR_DIRECTORY_FAILURE: - return _("The server could not access the directory"); - - case NMERR_ADMIN_LOCKED: - return _("Your system administrator has disabled this operation"); - - case NMERR_SERVER_BUSY: - return _("The server is unavailable; try again later"); - - case NMERR_DUPLICATE_CONTACT: - return _("Cannot add a contact to the same folder twice"); - - case NMERR_USER_NOT_ALLOWED: - return _("Cannot add yourself"); - - case NMERR_MASTER_ARCHIVE_MISSING: - return _("Master archive is misconfigured"); - - case NMERR_AUTHENTICATION_FAILED: - case NMERR_CREDENTIALS_MISSING: - return _("Incorrect username or password"); - - case NMERR_HOST_NOT_FOUND: - return _("Could not recognize the host of the username you entered"); - - case NMERR_ACCESS_DENIED: - return _("Your account has been disabled because too many incorrect passwords were entered"); - - case NMERR_DUPLICATE_PARTICIPANT: - return _("You cannot add the same person twice to a conversation"); - - case NMERR_TOO_MANY_CONTACTS: - case NMERR_TOO_MANY_FOLDERS: - return _("You have reached your limit for the number of contacts allowed"); - - case NMERR_OBJECT_NOT_FOUND: - return _("You have entered an incorrect username"); - - case NMERR_DIRECTORY_UPDATE: - return _("An error occurred while updating the directory"); - - case NMERR_SERVER_PROTOCOL: - return _("Incompatible protocol version"); - - case NMERR_USER_BLOCKED: - return _("The user has blocked you"); - - case NMERR_EVAL_CONNECTION_LIMIT: - return _("This evaluation version does not allow more than ten users to log in at one time"); - - case NMERR_CONVERSATION_INVITE: - return _("The user is either offline or you are blocked"); - - default: - unknown_msg = g_strdup_printf (_("Unknown error: 0x%X"), err); - - return unknown_msg; - } -} - -static void -_update_contact_list(NMUser * user, NMField * fields) -{ - NMField *list, *cursor, *locate; - gint objid1; - NMContact *contact; - NMFolder *folder; - gpointer item; - - if (user == NULL || fields == NULL) - return; - - /* Is it wrapped in a RESULTS array? */ - if (strcmp(fields->tag, NM_A_FA_RESULTS) == 0) { - list = (NMField *) fields->ptr_value; - } else { - list = fields; - } - - /* Update the cached contact list */ - cursor = (NMField *) list->ptr_value; - while (cursor->tag != NULL) { - if ((g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) || - (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) == 0)) { - - locate = - nm_locate_field(NM_A_SZ_OBJECT_ID, (NMField *) cursor->ptr_value); - if (locate != NULL && locate->ptr_value != 0) { - objid1 = atoi((char *) locate->ptr_value); - item = - nm_folder_find_item_by_object_id(user->root_folder, objid1); - if (item != NULL) { - if (cursor->method == NMFIELD_METHOD_ADD) { - if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) { - contact = (NMContact *) item; - nm_contact_update_list_properties(contact, cursor); - } else if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) - == 0) { - folder = (NMFolder *) item; - nm_folder_update_list_properties(folder, cursor); - } - } else if (cursor->method == NMFIELD_METHOD_DELETE) { - if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) { - contact = (NMContact *) item; - folder = - nm_find_folder_by_id(user, - nm_contact_get_parent_id - (contact)); - if (folder) { - nm_folder_remove_contact(folder, contact); - } - } else if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) - == 0) { - /* TODO: write nm_folder_remove_folder */ - /* ignoring for now, should not be a big deal */ -/* folder = (NMFolder *) item;*/ -/* nm_folder_remove_folder(user->root_folder, folder);*/ - } - } - } else { - - if (cursor->method == NMFIELD_METHOD_ADD) { - - /* Not found, so we need to add it */ - if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_CONTACT) == 0) { - - const char *dn = NULL; - - locate = - nm_locate_field(NM_A_SZ_DN, - (NMField *) cursor->ptr_value); - if (locate != NULL && locate->ptr_value != 0) { - dn = (const char *) locate->ptr_value; - if (dn != NULL) { - contact = - nm_create_contact_from_fields(cursor); - if (contact) { - nm_folder_add_contact_to_list(user-> - root_folder, - contact); - nm_release_contact(contact); - } - } - } - } else if (g_ascii_strcasecmp(cursor->tag, NM_A_FA_FOLDER) - == 0) { - folder = nm_create_folder_from_fields(cursor); - nm_folder_add_folder_to_list(user->root_folder, - folder); - nm_release_folder(folder); - } - } - } - } - } - cursor++; - } -} - -static char * -nm_rtfize_text(char *text) -{ - GString *gstr = NULL; - unsigned char *pch; - char *uni_str = NULL, *rtf = NULL; - int bytes; - gunichar uc; - - gstr = g_string_sized_new(strlen(text)*2); - pch = (unsigned char *)text; - while (*pch) { - if ((*pch) <= 0x7F) { - switch (*pch) { - case '{': - case '}': - case '\\': - gstr = g_string_append_c(gstr, '\\'); - gstr = g_string_append_c(gstr, *pch); - break; - case '\n': - gstr = g_string_append(gstr, "\\par "); - break; - default: - gstr = g_string_append_c(gstr, *pch); - break; - } - pch++; - } else { - /* convert the utf-8 character to ucs-4 for rtf encoding */ - if(*pch <= 0xDF) { - uc = ((((gunichar)pch[0]) & 0x001F) << 6) | - (((gunichar)pch[1]) & 0x003F); - bytes = 2; - } else if(*pch <= 0xEF) { - uc = ((((gunichar)pch[0]) & 0x000F) << 12) | - ((((gunichar)pch[1]) & 0x003F) << 6) | - (((gunichar)pch[2]) & 0x003F); - bytes = 3; - } else if (*pch <= 0xF7) { - uc = ((((gunichar)pch[0]) & 0x0007) << 18) | - ((((gunichar)pch[1]) & 0x003F) << 12) | - ((((gunichar)pch[2]) & 0x003F) << 6) | - (((gunichar)pch[3]) & 0x003F); - bytes = 4; - } else if (*pch <= 0xFB) { - uc = ((((gunichar)pch[0]) & 0x0003) << 24) | - ((((gunichar)pch[1]) & 0x003F) << 18) | - ((((gunichar)pch[2]) & 0x003F) << 12) | - ((((gunichar)pch[3]) & 0x003F) << 6) | - (((gunichar)pch[4]) & 0x003F); - bytes = 5; - } else if (*pch <= 0xFD) { - uc = ((((gunichar)pch[0]) & 0x0001) << 30) | - ((((gunichar)pch[1]) & 0x003F) << 24) | - ((((gunichar)pch[2]) & 0x003F) << 18) | - ((((gunichar)pch[3]) & 0x003F) << 12) | - ((((gunichar)pch[4]) & 0x003F) << 6) | - (((gunichar)pch[5]) & 0x003F); - bytes = 6; - } else { - /* should never happen ... bogus utf-8! */ - purple_debug_info("novell", "bogus utf-8 lead byte: 0x%X\n", pch[0]); - uc = 0x003F; - bytes = 1; - } - uni_str = g_strdup_printf("\\u%d?", uc); - purple_debug_info("novell", "unicode escaped char %s\n", uni_str); - gstr = g_string_append(gstr, uni_str); - pch += bytes; - g_free(uni_str); - } - } - - rtf = g_strdup_printf(RTF_TEMPLATE, gstr->str); - g_string_free(gstr, TRUE); - return rtf; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuser.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,680 +0,0 @@ -/* - * nmuser.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_USER_H__ -#define __NM_USER_H__ - -#include -#include -#include - -typedef guint32 NMERR_T; -typedef int NMSTATUS_T; - -typedef struct _NMUser NMUser; - -typedef enum -{ - NMREQUEST_TYPE_LOGIN = 0, - NMREQUEST_TYPE_LOGOUT, - NMREQUEST_TYPE_SETSTATUS, - NMREQUEST_TYPE_GETDETAILS, - NMREQUEST_TYPE_CREATECONF, - NMREQUEST_TYPE_SENDMESSAGE, - NMREQUEST_TYPE_JOINCONF, - NMREQUEST_TYPE_LEAVECONF, - NMREQUEST_TYPE_REJECTCONF, - NMREQUEST_TYPE_SENDTYPING, - NMREQUEST_TYPE_CREATECONTACT, - NMREQUEST_TYPE_DELETECONTACT - -} NMRequestType; - -#include "debug.h" -#include "nmmessage.h" -#include "nmconference.h" -#include "nmcontact.h" -#include "nmuserrecord.h" -#include "nmfield.h" -#include "nmevent.h" - -/* Callback typedefs */ -typedef void (*nm_response_cb) (NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data); - -typedef void (*nm_event_cb) (NMUser * user, NMEvent * event); - -#include "nmrequest.h" -#include "nmconn.h" - -/* This represents user that we are currently logged in as */ -struct _NMUser -{ - - char *name; - - NMSTATUS_T status; - - /* A copy of the login response fields */ - NMField *fields; - - /* The user record for this user */ - NMUserRecord *user_record; - - /* Our connection information */ - NMConn *conn; - - /* Our public IP address */ - char *address; - - /* This is the contact list */ - NMFolder *root_folder; - - /* All contacts that we know about hashed by dn */ - GHashTable *contacts; - - /* All user records hashed by dn */ - GHashTable *user_records; - - /* DN lookup */ - GHashTable *display_id_to_dn; - - /* One on one conversations indexed by recipient's dn */ - GSList *conferences; - - guint32 conference_count; - - /* Called when we receive an event */ - nm_event_cb evt_callback; - - /* Privacy settings */ - gboolean privacy_locked; - gboolean default_deny; - GSList *allow_list; - GSList *deny_list; - - /* Pending requests. If we need to go to the server to more info - * before processing a request we will queue it up and process when - * we get a response - */ - GSList *pending_requests; - - /* Pending events. Same as above except for events. */ - GSList *pending_events; - - /* Generic pointer to data needed by the client - * using the API - */ - gpointer client_data; - - /* Have the privacy lists been synched yet */ - gboolean privacy_synched; - - /* Has the contact list been synched */ - gboolean clist_synched; -}; - -#define NM_STATUS_UNKNOWN 0 -#define NM_STATUS_OFFLINE 1 -#define NM_STATUS_AVAILABLE 2 -#define NM_STATUS_BUSY 3 -#define NM_STATUS_AWAY 4 -#define NM_STATUS_AWAY_IDLE 5 -#define NM_STATUS_INVALID 6 - -#define NMERR_BASE 0x2000L -#define NM_OK 0L -#define NMERR_BAD_PARM (NMERR_BASE + 0x0001) -#define NMERR_TCP_WRITE (NMERR_BASE + 0x0002) -#define NMERR_TCP_READ (NMERR_BASE + 0x0003) -#define NMERR_PROTOCOL (NMERR_BASE + 0x0004) -#define NMERR_SERVER_REDIRECT (NMERR_BASE + 0x0005) -#define NMERR_CONFERENCE_NOT_FOUND (NMERR_BASE + 0x0006) -#define NMERR_CONFERENCE_NOT_INSTANTIATED (NMERR_BASE + 0x0007) -#define NMERR_FOLDER_EXISTS (NMERR_BASE + 0x0008) - -/* Errors that are returned from the server */ -#define NMERR_SERVER_BASE 0xD100L -#define NMERR_ACCESS_DENIED (NMERR_SERVER_BASE + 0x0006) -#define NMERR_NOT_SUPPORTED (NMERR_SERVER_BASE + 0x000A) -#define NMERR_PASSWORD_EXPIRED (NMERR_SERVER_BASE + 0x000B) -#define NMERR_PASSWORD_INVALID (NMERR_SERVER_BASE + 0x000C) -#define NMERR_USER_NOT_FOUND (NMERR_SERVER_BASE + 0x000D) -#define NMERR_USER_DISABLED (NMERR_SERVER_BASE + 0x0010) -#define NMERR_DIRECTORY_FAILURE (NMERR_SERVER_BASE + 0x0011) -#define NMERR_HOST_NOT_FOUND (NMERR_SERVER_BASE + 0x0019) -#define NMERR_ADMIN_LOCKED (NMERR_SERVER_BASE + 0x001C) -#define NMERR_DUPLICATE_PARTICIPANT (NMERR_SERVER_BASE + 0x001F) -#define NMERR_SERVER_BUSY (NMERR_SERVER_BASE + 0x0023) -#define NMERR_OBJECT_NOT_FOUND (NMERR_SERVER_BASE + 0x0024) -#define NMERR_DIRECTORY_UPDATE (NMERR_SERVER_BASE + 0x0025) -#define NMERR_DUPLICATE_FOLDER (NMERR_SERVER_BASE + 0x0026) -#define NMERR_DUPLICATE_CONTACT (NMERR_SERVER_BASE + 0x0027) -#define NMERR_USER_NOT_ALLOWED (NMERR_SERVER_BASE + 0x0028) -#define NMERR_TOO_MANY_CONTACTS (NMERR_SERVER_BASE + 0x0029) -#define NMERR_CONFERENCE_NOT_FOUND_2 (NMERR_SERVER_BASE + 0x002B) -#define NMERR_TOO_MANY_FOLDERS (NMERR_SERVER_BASE + 0x002C) -#define NMERR_SERVER_PROTOCOL (NMERR_SERVER_BASE + 0x0030) -#define NMERR_CONVERSATION_INVITE (NMERR_SERVER_BASE + 0x0035) -#define NMERR_USER_BLOCKED (NMERR_SERVER_BASE + 0x0039) -#define NMERR_MASTER_ARCHIVE_MISSING (NMERR_SERVER_BASE + 0x003A) -#define NMERR_PASSWORD_EXPIRED_2 (NMERR_SERVER_BASE + 0x0042) -#define NMERR_CREDENTIALS_MISSING (NMERR_SERVER_BASE + 0x0046) -#define NMERR_AUTHENTICATION_FAILED (NMERR_SERVER_BASE + 0x0049) -#define NMERR_EVAL_CONNECTION_LIMIT (NMERR_SERVER_BASE + 0x004A) - -/** - * Initialize the user that we are going to login to the system as. - * - * @param name The userid of the user - * @param server IP Address of server - * @param port Port to connect to on the server - * @param data Client data to associate with the user - * @param event_callback Function to call when we receive an event - * - * @return The initialized user object. Must be freed by calling - * nm_deinitialize_user - */ -NMUser *nm_initialize_user(const char *name, const char *server, int port, - gpointer data, nm_event_cb event_callback); - - -/** - * Free up resources associated with the user object. - * - * @param user The user to deinitialize - */ -void nm_deinitialize_user(NMUser * user); - -/** - * Send a login request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The User to login -- must be initialized - * @param pwd The password of the user - * @param my_addr The address of the client machine - * @param user_agent String describing the client (eg. "Purple/0.76 (Linux; 2.4.20)") - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if login is sent successfully, error otherwise. - */ -NMERR_T nm_send_login(NMUser * user, const char *pwd, const char *my_addr, - const char *user_agent, nm_response_cb callback, - gpointer data); - -/** - * Send a set status request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param dn The DN of the user (if known, or NULL if not known) - * @param address IP Address of server - * @param callback Function to call when we get the response from the server - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_set_status(NMUser * user, int status, const char *text, - const char *auto_resp, nm_response_cb callback, - gpointer data); - -/** - * Send a create conference to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference to create - * @param add_participants Add participant list on create? - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_create_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - -/** - * Tell server we have left the conference. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is leaving - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_leave_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - -/** - * Send a join conference request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is joining - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_join_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - -/** - * Send a conference reject request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is rejecting - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_reject_conference(NMUser * user, NMConference * conference, - nm_response_cb callback, gpointer data); - - -/** - * Send a conference invitation to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conference Conference the user is rejecting - * @param user_record The user to invite - * @param message The invite message if there is one, NULL otherwise - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_conference_invite(NMUser *user, NMConference *conference, NMUserRecord *user_record, - const char *message, nm_response_cb callback, gpointer data); - -/** - * Get details for a more than one user from the server. - * - * The response data sent to the callback will be an NMUserRecord which should be - * freed with nm_release_user_record - * - * @param user The logged in User - * @param names Link list of user id's or dn's - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_multiple_get_details(NMUser * user, GSList *names, - nm_response_cb callback, gpointer data); - -/** - * Get details for a user from the server. - * - * The response data sent to the callback will be an NMUserRecord which should be - * freed with nm_release_user_record - * - * @param user The logged in User - * @param name Userid or DN of the user to look up - * @param callback Function to call when we get the response from the server - * @param data User defined data to be passed to the callback function - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_get_details(NMUser * user, const char *name, - nm_response_cb callback, gpointer data); - -/** - * Send a message. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param message The message to send. - * @param callback Function to call when we get the response from the server - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_message(NMUser * user, NMMessage * message, - nm_response_cb callback); - -/** - * Sends a typing event to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param conf The conference that corresponds to the typing event - * @param typing TRUE if the user is typing - * FALSE if the user has stopped typing - * @param callback Function to call when we get the response from the server - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_typing(NMUser * user, NMConference * conf, - gboolean typing, nm_response_cb callback); - -/** - * Send a create contact request to the server. - * - * The given folder should already exist on the server. If not, - * the call will fail. - * - * The response data sent to the callback will be a NMContact which should - * be released with nm_release_contact - * - * @param user The logged in User - * @param folder The folder that the contact should be created in - * @param contact The contact to add - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_create_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data); - -/** - * Send a remove contact request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param folder The folder to remove contact from - * @param contact The contact to remove - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_remove_contact(NMUser * user, NMFolder * folder, - NMContact * contact, nm_response_cb callback, - gpointer data); - -/** - * Send a create folder request to the server. - * - * The response data sent to the callback will be a NMFolder which should be - * released with nm_release_folder - * - * @param user The logged in User - * @param name The name of the folder to create - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_create_folder(NMUser * user, const char *name, - nm_response_cb callback, gpointer data); - -/** - * Send a delete folder request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param folder The name of the folder to remove - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_remove_folder(NMUser * user, NMFolder * folder, - nm_response_cb callback, gpointer data); - -/** - * Send a rename contact request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param contact The contact to rename - * @param new_name The new display name for the contact - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_rename_contact(NMUser * user, NMContact * contact, - const char *new_name, nm_response_cb callback, - gpointer data); - -/** - * Send a rename folder request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param folder The folder to rename - * @param new_name The new name of the folder - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_rename_folder(NMUser * user, NMFolder * folder, - const char *new_name, nm_response_cb callback, - gpointer data); - -/** - * Send a move contact request to the server. - * - * The response data sent to the callback will be NULL. - * - * @param user The logged in User - * @param contact The contact to move - * @param folder The folder to move the contact to - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_move_contact(NMUser * user, NMContact * contact, - NMFolder * folder, nm_response_cb callback, - gpointer data); - -/** - * Send a get status request to the server. - * - * The response data sent to the callback will be a NMUserRecord. - * - * @param user The logged in User - * @param contact The contact to move - * @param folder The folder to move the contact to - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T nm_send_get_status(NMUser * user, NMUserRecord * user_record, - nm_response_cb callback, gpointer data); - -/** - * Send a request to add an item to the allow or deny list. - * - * @param user The logged in User - * @param who The userid or DN of the user to add to list - * @param allow_list TRUE if adding to allow list, FALSE if adding to deny list - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_create_privacy_item(NMUser *user, const char *who, gboolean is_allowed, - nm_response_cb callback, gpointer data); - -/** - * Send a request to remove an item from the allow or deny list. - * - * @param user The logged in User - * @param who The userid or DN of the user to add to list - * @param allow_list TRUE if removing from allow list, FALSE if removing from deny list - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_remove_privacy_item(NMUser *user, const char *dn, gboolean allow_list, - nm_response_cb callback, gpointer data); - -/** - * Send a request to change the default privacy setting to deny all or allow all - * - * @param user The logged in User - * @param default_deny TRUE if default should be changed to deny all - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_set_privacy_default(NMUser *user, gboolean default_deny, - nm_response_cb callback, gpointer data); - -/** - * Send a ping to the server - * - * @param user The logged in User - * @param callback Function to call when we get the response from the server - * @param data User defined data - * - * @return NM_OK if successfully sent, error otherwise - */ -NMERR_T -nm_send_keepalive(NMUser *user, nm_response_cb callback, gpointer data); - -/** - * Reads a response/event from the server and processes it. - * - * @param user The logged in User - */ -NMERR_T nm_process_new_data(NMUser * user); - -/** - * Return the root folder of the contact list - * - * @param user The logged in User - * - * @return Root folder - */ -NMFolder *nm_get_root_folder(NMUser * user); - -/** - * Create the contact list based on the login fields - * - * @param user The logged in User - * - */ -NMERR_T nm_create_contact_list(NMUser * user); - -void nm_destroy_contact_list(NMUser * user); - -void nm_user_add_contact(NMUser * user, NMContact * contact); - -void nm_user_add_user_record(NMUser * user, NMUserRecord * user_record); - -NMContact *nm_find_contact(NMUser * user, const char *dn); - -GList *nm_find_contacts(NMUser * user, const char *dn); - -NMUserRecord *nm_find_user_record(NMUser * user, const char *dn); - -NMFolder *nm_find_folder(NMUser * user, const char *name); - -NMFolder *nm_find_folder_by_id(NMUser * user, int object_id); - -NMConference *nm_find_conversation(NMUser * user, const char *who); - -void nm_conference_list_add(NMUser * user, NMConference * conf); - -void nm_conference_list_remove(NMUser * user, NMConference * conf); - -void nm_conference_list_free(NMUser * user); - -NMConference *nm_conference_list_find(NMUser * user, const char *guid); - -const char *nm_lookup_dn(NMUser * user, const char *display_id); - -nm_event_cb nm_user_get_event_callback(NMUser * user); - -NMConn *nm_user_get_conn(NMUser * user); - -gboolean nm_user_is_privacy_locked(NMUser *user); - -/** Some utility functions **/ - -/** - * Check to see if the conference GUIDs are equivalent. - * - * @param guid1 First guid to compare - * @param guid2 Second guid to compare - * - * @return TRUE if conference GUIDs are equivalent, FALSE otherwise. - * - */ -gboolean nm_are_guids_equal(const char *guid1, const char *guid2); - -/** - * Compare UTF8 strings for equality only (case insensitive) - * - * @param guid1 First string to compare - * @param guid2 Second string to compare - * - * @return TRUE if strings are equal, FALSE otherwise - * - */ -gboolean nm_utf8_str_equal(gconstpointer str1, gconstpointer str2); - -/** - * Convert a fully typed LDAP DN to dotted, untype notation - * e.g. cn=mike,o=novell -> mike.novell - * - * @param typed Fully typed dn - * - * @return Dotted equivalent of typed (must be freed). - * - */ -char *nm_typed_to_dotted(const char *typed); - -/** - * Return a string representation of the error code. - * - * @param error NMERR_T to convert to string - * - * @return String representation. - */ -const char *nm_error_to_string (NMERR_T err); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,561 +0,0 @@ -/* - * nmuserrecord.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include -#include -#include "nmuserrecord.h" -#include "nmfield.h" -#include "nmuser.h" - -struct _NMUserRecord -{ - NMSTATUS_T status; - char *status_text; - char *dn; - char *cn; - char *display_id; - char *fname; - char *lname; - char *full_name; - NMField *fields; - gboolean auth_attr; - gpointer data; - int ref_count; -}; - -struct _NMProperty -{ - char *tag; - char *value; -}; - -static int count = 0; - -/* API functions */ - -NMUserRecord * -nm_create_user_record() -{ - NMUserRecord *user_record = g_new0(NMUserRecord, 1); - - user_record->ref_count = 1; - - purple_debug(PURPLE_DEBUG_INFO, "novell", "Creating user_record, total=%d\n", - count++); - - return user_record; -} - -static char * -_get_attribute_value(NMField *field) -{ - char *value = NULL; - - if (field->ptr_value == NULL) - return NULL; - - if (field->type == NMFIELD_TYPE_UTF8 || field->type == NMFIELD_TYPE_DN) { - - value = (char *)field->ptr_value; - - } else if (field->type == NMFIELD_TYPE_MV) { - - /* Need to handle multi-valued returns, for now - * just pick the first value and return it - */ - NMField *tmp = (NMField *)field->ptr_value; - if ((tmp != NULL) && - ((tmp->type == NMFIELD_TYPE_UTF8) || - (tmp->type == NMFIELD_TYPE_DN))) { - - value = (char *)tmp->ptr_value; - - } else { - return NULL; - } - - } else { - return NULL; - } - - return g_strdup(value); -} -/* - * This creates a user_record for the reference list the - * field array that is passed in should be a - * NM_A_FA_USER_DETAILS array. - */ -NMUserRecord * -nm_create_user_record_from_fields(NMField * details) -{ - NMUserRecord *user_record; - NMField *field, *fields = details; - - if (details == NULL) { - return NULL; - } - - if (details->type == NMFIELD_TYPE_ARRAY) { - if (details->ptr_value == NULL) - return NULL; - fields = (NMField *) details->ptr_value; - } - - user_record = nm_create_user_record(); - - if ((field = nm_locate_field(NM_A_SZ_AUTH_ATTRIBUTE, fields))) { - - if (field->ptr_value) { - user_record->display_id = _get_attribute_value(field); - user_record->auth_attr = TRUE; - } - } - - if ((field = nm_locate_field(NM_A_SZ_DN, fields))) { - - if (field->ptr_value) { - user_record->dn = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("CN", fields))) { - - if (field->ptr_value) { - user_record->cn = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("Given Name", fields))) { - - if (field->ptr_value) { - user_record->fname = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("Surname", fields))) { - - if (field->ptr_value) { - user_record->lname = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field("Full Name", fields))) { - - if (field->ptr_value) { - user_record->full_name = _get_attribute_value(field); - } - } - - if ((field = nm_locate_field(NM_A_SZ_STATUS, fields))) { - - if (field->ptr_value) - user_record->status = atoi((char *) field->ptr_value); - - } - - if ((field = nm_locate_field(NM_A_SZ_MESSAGE_BODY, fields))) { - - if (field->ptr_value) - user_record->status_text = g_strdup((char *) field->ptr_value); - - } - - user_record->fields = nm_copy_field_array(fields); - - return user_record; -} - -void -nm_user_record_copy(NMUserRecord * dest, NMUserRecord * src) -{ - if (dest == NULL || src == NULL) - return; - - dest->status = src->status; - - /* Copy status text */ - if (dest->status_text) { - g_free(dest->status_text); - dest->status_text = NULL; - } - - if (src->status_text) - dest->status_text = g_strdup(src->status_text); - - /* Copy DN */ - if (dest->dn) { - g_free(dest->dn); - dest->dn = NULL; - } - - if (src->dn) - dest->dn = g_strdup(src->dn); - - /* Copy CN */ - if (dest->cn) { - g_free(dest->cn); - dest->cn = NULL; - } - - if (src->cn) - dest->cn = g_strdup(src->cn); - - /* Copy display id */ - if (dest->display_id) { - g_free(dest->display_id); - dest->display_id = NULL; - } - - if (src->display_id) - dest->display_id = g_strdup(src->display_id); - - /* Copy first name */ - if (dest->fname) { - g_free(dest->fname); - dest->fname = NULL; - } - - if (src->fname) - dest->fname = g_strdup(src->fname); - - /* Copy last name */ - if (dest->lname) { - g_free(dest->lname); - dest->lname = NULL; - } - - if (src->lname) - dest->lname = g_strdup(src->lname); - - /* Copy full name */ - if (dest->full_name) { - g_free(dest->full_name); - dest->full_name = NULL; - } - - if (src->full_name) - dest->full_name = g_strdup(src->full_name); - - /* Copy fields */ - if (src->fields) { - - if (dest->fields) { - nm_free_fields(&dest->fields); - } - - dest->fields = nm_copy_field_array(src->fields); - } - - /* Copy data */ - dest->data = src->data; -} - -void -nm_user_record_add_ref(NMUserRecord * user_record) -{ - if (user_record) - user_record->ref_count++; -} - -void -nm_release_user_record(NMUserRecord * user_record) -{ - if (--(user_record->ref_count) == 0) { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Releasing user_record, total=%d\n", --count); - - if (user_record->dn) { - g_free(user_record->dn); - } - - if (user_record->cn) { - g_free(user_record->cn); - } - - if (user_record->display_id) { - g_free(user_record->display_id); - } - - if (user_record->fname) { - g_free(user_record->fname); - } - - if (user_record->lname) { - g_free(user_record->lname); - } - - if (user_record->full_name) { - g_free(user_record->full_name); - } - - if (user_record->status_text) { - g_free(user_record->status_text); - } - - nm_free_fields(&user_record->fields); - - g_free(user_record); - } -} - -/* UserRecord API */ - -NMSTATUS_T -nm_user_record_get_status(NMUserRecord * user_record) -{ - if (user_record == NULL) - return (NMSTATUS_T) - 1; - - return user_record->status; - -} - -const char * -nm_user_record_get_status_text(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->status_text; -} - -void -nm_user_record_set_dn(NMUserRecord * user_record, const char *dn) -{ - if (user_record != NULL && dn != NULL) { - if (user_record->dn) - g_free(user_record->dn); - - user_record->dn = g_strdup(dn); - } -} - -const char * -nm_user_record_get_dn(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->dn; -} - -void -nm_user_record_set_userid(NMUserRecord * user_record, const char *userid) -{ - if (user_record != NULL && userid != NULL) { - if (user_record->cn) - g_free(user_record->cn); - - user_record->cn = g_strdup(userid); - } -} - -const char * -nm_user_record_get_userid(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->cn; -} - -void -nm_user_record_set_display_id(NMUserRecord * user_record, const char *display_id) -{ - if (user_record != NULL && display_id != NULL) { - if (user_record->display_id) - g_free(user_record->display_id); - - user_record->display_id = g_strdup(display_id); - } -} - -const char * -nm_user_record_get_display_id(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - if (user_record->display_id == NULL) { - user_record->display_id = nm_typed_to_dotted(user_record->dn); - } - - return user_record->display_id; -} - -const char * -nm_user_record_get_full_name(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - if (user_record->full_name == NULL) { - if (user_record->fname && user_record->lname) { - user_record->full_name = g_strdup_printf("%s %s", - user_record->fname, - user_record->lname); - - } - } - - return user_record->full_name; -} - -const char * -nm_user_record_get_first_name(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->fname; - -} - -const char * -nm_user_record_get_last_name(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->lname; -} - -gpointer -nm_user_record_get_data(NMUserRecord * user_record) -{ - if (user_record == NULL) - return NULL; - - return user_record->data; -} - -void -nm_user_record_set_data(NMUserRecord * user_record, gpointer data) -{ - if (user_record == NULL) - return; - - user_record->data = data; -} - -void -nm_user_record_set_status(NMUserRecord * user_record, - int status, const char *text) -{ - if (user_record == NULL) - return; - - user_record->status = status; - - if (user_record->status_text) { - g_free(user_record->status_text); - user_record->status_text = NULL; - } - - if (text) - user_record->status_text = g_strdup(text); -} - -gboolean -nm_user_record_get_auth_attr(NMUserRecord *user_record) -{ - if (user_record == NULL) - return FALSE; - - return user_record->auth_attr; -} - -int -nm_user_record_get_property_count(NMUserRecord * user_record) -{ - NMField *locate, *fields; - - int count = 0; - - if (user_record && user_record->fields) { - locate = nm_locate_field(NM_A_FA_INFO_DISPLAY_ARRAY, - (NMField *) user_record->fields); - if (locate && (fields = (NMField *) (locate->ptr_value))) { - count = (int) nm_count_fields(fields); - } - } - return count; -} - -NMProperty * -nm_user_record_get_property(NMUserRecord * user_record, int index) -{ - NMProperty *property = NULL; - NMField *field = NULL, *fields, *locate; - - if (user_record && user_record->fields) { - locate = nm_locate_field(NM_A_FA_INFO_DISPLAY_ARRAY, - (NMField *) user_record->fields); - if (locate && (fields = (NMField *) (locate->ptr_value))) { - int max = nm_count_fields(fields); - - if (index < max) { - if (user_record) { - field = &fields[index]; - if (field && field->tag && field->ptr_value) { - property = g_new0(NMProperty, 1); - property->tag = g_strdup(field->tag); - property->value = _get_attribute_value(field); - } - } - } - } - } - - return property; -} - -void -nm_release_property(NMProperty * property) -{ - if (property) { - if (property->tag) - g_free(property->tag); - - if (property->value) - g_free(property->value); - - g_free(property); - } -} - -const char * -nm_property_get_tag(NMProperty * property) -{ - if (property) - return property->tag; - else - return NULL; -} - -const char * -nm_property_get_value(NMProperty * property) -{ - if (property) - return property->value; - else - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/nmuserrecord.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,273 +0,0 @@ -/* - * nmuserrecord.h - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef __NM_USER_RECORD_H__ -#define __NM_USER_RECORD_H__ - -#include - -typedef struct _NMUserRecord NMUserRecord; -typedef struct _NMProperty NMProperty; - -#include "nmfield.h" -#include "nmuser.h" - -/** - * Creates an NMUserRecord - * - * The NMUserRecord should be released by calling - * nm_release_user_record - * - * @return The new user record - * - */ -NMUserRecord *nm_create_user_record(void); - -/** - * Creates an NMUserRecord - * - * The NMUserRecord should be released by calling - * nm_release_user_record - * - * @param details Should be a NM_A_FA_USER_DETAILS - * - * - * @return The new user record - * - */ -NMUserRecord *nm_create_user_record_from_fields(NMField * details); - -/** - * Add a reference to an existing user_record - * - * The reference should be released by calling - * nm_release_user_record - * - * @param user_record The contact to addref - * - */ -void nm_user_record_add_ref(NMUserRecord * user_record); - -/** - * Release a reference to the user record - * - * @param user_record The user record - * - */ -void nm_release_user_record(NMUserRecord * user_record); - -/** - * Set the status for the user record - * - * @param user_record The user record - * @param status The status for the user - * @param text The status text for the user - * - */ -void nm_user_record_set_status(NMUserRecord * user_record, NMSTATUS_T status, - const char *text); - -/** - * Get the status for the user record - * - * @param user_record The user record - * - * @return The status for the user record - */ -NMSTATUS_T nm_user_record_get_status(NMUserRecord * user_record); - -/** - * Get the status text for the user record - * - * @param user_record The user record - * - * @return The status text if there is any, NULL otherwise - * - */ -const char *nm_user_record_get_status_text(NMUserRecord * user_record); - -/** - * Set the DN for the user record - * - * @param user_record The user record - * @param dn The new DN for the user record - * - */ -void nm_user_record_set_dn(NMUserRecord * user_record, const char *dn); - -/** - * Get the DN for the user record - * - * @param user_record The user record - * - * @return The DN for the user record - */ -const char *nm_user_record_get_dn(NMUserRecord * user_record); - -/** - * Set the user id for the - * - * @param user_record The user record - * @param userid The userid (CN) for the user record - * - */ -void nm_user_record_set_userid(NMUserRecord * user_record, const char *userid); - -/** - * Get the user id for the user record - * - * @param user_record The user record - * - * @return The user id for the user record - */ -const char *nm_user_record_get_userid(NMUserRecord * user_record); - -/** - * Set the display id for the user record - * - * @param user_record The user record - * @param display_id The new display id for the user - * - */ -void nm_user_record_set_display_id(NMUserRecord * user_record, - const char *display_id); - -/** - * Get the display id for the user record - * - * @param user_record The user record - * - * @return The display id for the user record - */ -const char *nm_user_record_get_display_id(NMUserRecord * user_record); - -/** - * Return whether or not the display id is an auth attribute or not. - * - * @param user_record The user record - * - * @return TRUE if display_id is an auth attribute, FALSE otherwise. - */ -gboolean -nm_user_record_get_auth_attr(NMUserRecord *user_record); - -/** - * Get the full name for the user record - * - * @param user_record The user record - * - * @return The full name for the user - */ -const char *nm_user_record_get_full_name(NMUserRecord * user_record); - -/** - * Get the first name for the user record - * - * @param user_record The user record - * - * @return The first name for the user - */ -const char *nm_user_record_get_first_name(NMUserRecord * user_record); - -/** - * Get the last name for the user record - * - * @param user_record The user record - * - * @return The last name for the user - */ -const char *nm_user_record_get_last_name(NMUserRecord * user_record); - -/** - * Set the user defined data for the user record - * - * @param user_record The user record - * @param data The user defined data for the user record - * - */ -void nm_user_record_set_data(NMUserRecord * user_record, gpointer data); - -/** - * Get the user defined data for the user record - * - * @param user_record The user record - * - * @return The user defined data for the user record - */ -gpointer nm_user_record_get_data(NMUserRecord * user_record); - -/** - * Get the property count for the user record - * - * @param user_record The user record - * - * @return The number of information properties for the user record - * - */ -int nm_user_record_get_property_count(NMUserRecord * user_record); - -/** - * Get an info property for the user record. The property must be released - * by calling nm_release_property() - * - * @param user_record The user record - * @param index The index of the property to get (zero based) - * - * @return The property - */ -NMProperty *nm_user_record_get_property(NMUserRecord * user_record, int index); - -/** - * Release a property object - * - * @param property The property - * - */ -void nm_release_property(NMProperty * property); - -/** - * Get the tag for the property - * - * @param property The property - * - * @return The tag of the property (i.e. "Email Address") - */ -const char *nm_property_get_tag(NMProperty * property); - -/** - * Get the value for the property - * - * @param property The property - * - * @return The value of the property (i.e. "nobody@nowhere.com") - */ -const char *nm_property_get_value(NMProperty * property); - -/** - * Copy a user record (deep copy). The dest user record must have already been - * created (nm_create_user_record) - * - * @param dest The destination of the copy - * @param src The source of the copy - * - */ -void nm_user_record_copy(NMUserRecord * dest, NMUserRecord * src); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/novell.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/novell.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/novell.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/novell/novell.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3586 +0,0 @@ -/* - * novell.c - * - * Copyright (c) 2004 Novell, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "accountopt.h" -#include "debug.h" -#include "prpl.h" -#include "server.h" -#include "nmuser.h" -#include "notify.h" -#include "util.h" -#include "sslconn.h" -#include "request.h" -#include "network.h" -#include "privacy.h" -#include "status.h" -#include "version.h" - -#define DEFAULT_PORT 8300 -#define NOVELL_CONNECT_STEPS 4 -#define NM_ROOT_FOLDER_NAME "GroupWise Messenger" - -#define NOVELL_STATUS_TYPE_AVAILABLE "available" -#define NOVELL_STATUS_TYPE_AWAY "away" -#define NOVELL_STATUS_TYPE_BUSY "busy" -#define NOVELL_STATUS_TYPE_OFFLINE "offline" -#define NOVELL_STATUS_TYPE_IDLE "idle" -#define NOVELL_STATUS_TYPE_APPEAR_OFFLINE "appearoffline" - -static PurplePlugin *my_protocol = NULL; - -static gboolean -_is_disconnect_error(NMERR_T err); - -static gboolean -_check_for_disconnect(NMUser * user, NMERR_T err); - -static void -_send_message(NMUser * user, NMMessage * message); - -static void -_update_buddy_status(NMUser *user, PurpleBuddy * buddy, int status, int gmt); - -static void -_remove_purple_buddies(NMUser * user); - -static void -_add_contacts_to_purple_blist(NMUser * user, NMFolder * folder); - -static void -_add_purple_buddies(NMUser * user); - -static void -_sync_contact_list(NMUser *user); - -static void -_sync_privacy_lists(NMUser *user); - -static void -_show_info(PurpleConnection * gc, NMUserRecord * user_record); - -const char * -_get_conference_name(int id); - -/******************************************************************************* - * Response callbacks - *******************************************************************************/ - -/* Handle login response */ -static void -_login_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - const char *alias; - NMERR_T rc; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - if (gc == NULL) - return; - - if (ret_code == NM_OK) { - - /* Set alias for user if not set (use Full Name) */ - alias = purple_account_get_alias(user->client_data); - if (alias == NULL || *alias == '\0') { - alias = nm_user_record_get_full_name(user->user_record); - - if (alias) - purple_account_set_alias(user->client_data, alias); - } - - /* Tell Purple that we are connected */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - _sync_contact_list(user); - - rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, - NULL); - _check_for_disconnect(user, rc); - - } else { - PurpleConnectionError reason; - char *err = g_strdup_printf(_("Unable to login: %s"), - nm_error_to_string (ret_code)); - - switch (ret_code) { - case NMERR_AUTHENTICATION_FAILED: - case NMERR_CREDENTIALS_MISSING: - case NMERR_PASSWORD_INVALID: - /* Don't attempt to auto-reconnect if our - * password was invalid. - */ - if (!purple_account_get_remember_password(gc->account)) - purple_account_set_password(gc->account, NULL); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - default: - /* FIXME: There are other reasons login could fail */ - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - } - - purple_connection_error_reason(gc, reason, err); - g_free(err); - } -} - -/* Handle getstatus response*/ -static void -_get_status_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleBuddy *buddy; - GSList *buddies; - GSList *bnode; - NMUserRecord *user_record = (NMUserRecord *) resp_data; - int status; - - if (user == NULL || user_record == NULL) - return; - - if (ret_code == NM_OK) { - - /* Find all Purple buddies and update their statuses */ - const char *name = nm_user_record_get_display_id(user_record); - - if (name) { - buddies = purple_find_buddies((PurpleAccount *) user->client_data, name); - for (bnode = buddies; bnode; bnode = bnode->next) { - buddy = (PurpleBuddy *) bnode->data; - if (buddy) { - status = nm_user_record_get_status(user_record); - _update_buddy_status(user, buddy, status, time(0)); - } - } - g_slist_free(buddies); - } - - } else { - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_get_status_resp_cb(): rc = 0x%X\n", ret_code); - - } -} - -/* Show an error if the rename failed */ -static void -_rename_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_rename_contact_resp_cb(): rc = 0x%X\n", ret_code); - } -} - -/* Handle the getdetails response and send the message */ -static void -_get_details_resp_send_msg(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConversation *gconv; - PurpleConnection *gc; - NMUserRecord *user_record = NULL; - NMContact *cntct = NULL; - NMConference *conf; - NMMessage *msg = user_data; - const char *dn = NULL; - const char *name; - - if (user == NULL || msg == NULL) - return; - - if (ret_code == NM_OK) { - user_record = (NMUserRecord *) resp_data; - if (user_record) { - - /* Set the title for the conversation */ - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - nm_user_record_get_display_id(user_record), - (PurpleAccount *) user->client_data); - if (gconv) { - - dn = nm_user_record_get_dn(user_record); - if (dn) { - cntct = nm_find_contact(user, dn); - } - - if (cntct) { - purple_conversation_set_title(gconv, - nm_contact_get_display_name(cntct)); - } else { - - /* Not in the contact list, try to user full name */ - name = (char *) nm_user_record_get_full_name(user_record); - if (name) - purple_conversation_set_title(gconv, name); - } - } - - /* Add the user record to particpant list */ - conf = nm_message_get_conference(msg); - if (conf) { - nm_conference_add_participant(conf, user_record); - _send_message(user, msg); - } - } - - } else { - - gc = purple_account_get_connection(user->client_data); - if (gc != NULL) { - char *err = g_strdup_printf(_("Unable to send message." - " Could not get details for user (%s)."), - nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (msg) - nm_release_message(msg); - } -} - -/* Set up the new PurpleBuddy based on the response from getdetails */ -static void -_get_details_resp_setup_buddy(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMUserRecord *user_record; - NMContact *contact; - PurpleBuddy *buddy; - const char *alias; - NMERR_T rc = NM_OK; - - if (user == NULL || resp_data == NULL || user_data == NULL) - return; - - contact = user_data; - - if (ret_code == NM_OK) { - user_record = resp_data; - - buddy = nm_contact_get_data(contact); - - nm_contact_set_user_record(contact, user_record); - - /* Set the display id */ - purple_blist_rename_buddy(buddy, - nm_user_record_get_display_id(user_record)); - - alias = purple_buddy_get_alias(buddy); - if (alias == NULL || *alias == '\0' || (strcmp(alias, purple_buddy_get_name(buddy)) == 0)) { - purple_blist_alias_buddy(buddy, - nm_user_record_get_full_name(user_record)); - - /* Tell the server about the new display name */ - rc = nm_send_rename_contact(user, contact, - nm_user_record_get_full_name(user_record), - NULL, NULL); - _check_for_disconnect(user, rc); - - } - - - /* Get initial status for the buddy */ - rc = nm_send_get_status(user, resp_data, _get_status_resp_cb, NULL); - _check_for_disconnect(user, rc); - -/* nm_release_contact(contact);*/ - - } - - if (contact) - nm_release_contact(contact); -} - -/* Add the new contact into the PurpleBuddy list */ -static void -_create_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMContact *tmp_contact = (NMContact *) user_data; - NMContact *new_contact = NULL; - NMFolder *folder = NULL; - PurpleGroup *group; - PurpleBuddy *buddy; - const char *folder_name = NULL; - NMERR_T rc = NM_OK; - - if (user == NULL) - return; - - if (ret_code == NM_OK) { - - new_contact = (NMContact *) resp_data; - if (new_contact == NULL || tmp_contact == NULL) - return; - - /* Get the userid and folder name for the new contact */ - folder = nm_find_folder_by_id(user, - nm_contact_get_parent_id(new_contact)); - if (folder) { - folder_name = nm_folder_get_name(folder); - } - - if (folder_name == NULL || *folder_name == '\0') - folder_name = NM_ROOT_FOLDER_NAME; - - /* Re-add the buddy now that we got the okay from the server */ - if (folder_name && (group = purple_find_group(folder_name))) { - - const char *alias = nm_contact_get_display_name(tmp_contact); - const char *display_id = nm_contact_get_display_id(new_contact); - - if (display_id == NULL) - display_id = nm_contact_get_dn(new_contact); - - if (alias && strcmp(alias, display_id)) { - - /* The user requested an alias, tell the server about it. */ - rc = nm_send_rename_contact(user, new_contact, alias, - _rename_contact_resp_cb, NULL); - _check_for_disconnect(user, rc); - - } else { - - alias = ""; - - } - - /* Add it to the purple buddy list if it is not there */ - buddy = purple_find_buddy_in_group(user->client_data, display_id, group); - if (buddy == NULL) { - buddy = purple_buddy_new(user->client_data, display_id, alias); - purple_blist_add_buddy(buddy, NULL, group, NULL); - } - - /* Save the new buddy as part of the contact object */ - nm_contact_set_data(new_contact, (gpointer) buddy); - - /* We need details for the user before we can setup the - * new Purple buddy. We always call this because the - * 'createcontact' response fields do not always contain - * everything that we need. - */ - nm_contact_add_ref(new_contact); - - rc = nm_send_get_details(user, nm_contact_get_dn(new_contact), - _get_details_resp_setup_buddy, new_contact); - _check_for_disconnect(user, rc); - - } - - } else { - PurpleConnection *gc = purple_account_get_connection(user->client_data); - const char *name = nm_contact_get_dn(tmp_contact); - char *err; - - err = - g_strdup_printf(_("Unable to add %s to your buddy list (%s)."), - name, nm_error_to_string (ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } - - if (tmp_contact) - nm_release_contact(tmp_contact); -} - -/* Show an error if we failed to send the message */ -static void -_send_message_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - char *err = NULL; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - gc = purple_account_get_connection(user->client_data); - - /* TODO: Improve this! message to who or for what conference? */ - err = g_strdup_printf(_("Unable to send message (%s)."), - nm_error_to_string (ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } -} - -/* Show an error if the remove failed */ -static void -_remove_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_remove_contact_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -/* Show an error if the remove failed */ -static void -_remove_folder_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_remove_folder_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -/* Show an error if the move failed */ -static void -_move_contact_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_move_contact_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -/* Show an error if the rename failed */ -static void -_rename_folder_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - if (ret_code != NM_OK) { - /* TODO: Display an error? */ - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_rename_folder_resp_cb(): rc = 0x%x\n", ret_code); - } -} - -static void -_sendinvite_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - char *err; - PurpleConnection *gc; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - gc = purple_account_get_connection(user->client_data); - err = g_strdup_printf(_("Unable to invite user (%s)."), nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_sendinvite_resp_cb(): rc = 0x%x\n", ret_code); - } - -} - -/* If the createconf was successful attempt to send the message, - * otherwise display an error message to the user. - */ -static void -_createconf_resp_send_msg(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMConference *conf; - NMMessage *msg = user_data; - - if (user == NULL || msg == NULL) - return; - - if (ret_code == NM_OK) { - _send_message(user, msg); - } else { - - if ((conf = nm_message_get_conference(msg))) { - - PurpleConnection *gc = purple_account_get_connection(user->client_data); - const char *name = NULL; - char *err; - NMUserRecord *ur; - - ur = nm_conference_get_participant(conf, 0); - if (ur) - name = nm_user_record_get_userid(ur); - - if (name) - err = g_strdup_printf(_("Unable to send message to %s." - " Could not create the conference (%s)."), - name, - nm_error_to_string (ret_code)); - else - err = g_strdup_printf(_("Unable to send message." - " Could not create the conference (%s)."), - nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (msg) - nm_release_message(msg); - } -} - -/* Move contact to newly created folder */ -static void -_create_folder_resp_move_contact(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMContact *contact = user_data; - NMFolder *new_folder; - char *folder_name = resp_data; - NMERR_T rc = NM_OK; - - if (user == NULL || folder_name == NULL || contact == NULL) { - - if (folder_name) - g_free(folder_name); - - return; - } - - if (ret_code == NM_OK || ret_code == NMERR_DUPLICATE_FOLDER) { - new_folder = nm_find_folder(user, folder_name); - if (new_folder) { - - /* Tell the server to move the contact to the new folder */ -/* rc = nm_send_move_contact(user, contact, new_folder, - _move_contact_resp_cb, NULL); */ - - rc = nm_send_create_contact(user, new_folder, contact, - NULL, NULL); - - _check_for_disconnect(user, rc); - - } - } else { - PurpleConnection *gc = purple_account_get_connection(user->client_data); - char *err = g_strdup_printf(_("Unable to move user %s" - " to folder %s in the server side list." - " Error while creating folder (%s)."), - nm_contact_get_dn(contact), - folder_name, - nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (folder_name) - g_free(folder_name); -} - -/* Add contact to newly create folder */ -static void -_create_folder_resp_add_contact(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMContact *contact = (NMContact *) user_data; - NMFolder *folder; - char *folder_name = (char *) resp_data; - NMERR_T rc = NM_OK; - - if (user == NULL || folder_name == NULL || contact == NULL) { - - if (contact) - nm_release_contact(contact); - - if (folder_name) - g_free(folder_name); - - return; - } - - if (ret_code == NM_OK || ret_code == NMERR_DUPLICATE_FOLDER) { - folder = nm_find_folder(user, folder_name); - if (folder) { - - rc = nm_send_create_contact(user, folder, contact, - _create_contact_resp_cb, contact); - _check_for_disconnect(user, rc); - } - } else { - PurpleConnection *gc = purple_account_get_connection(user->client_data); - const char *name = nm_contact_get_dn(contact); - char *err = - g_strdup_printf(_("Unable to add %s to your buddy list." - " Error creating folder in server side list (%s)."), - name, nm_error_to_string (ret_code)); - - purple_notify_error(gc, NULL, err, NULL); - - nm_release_contact(contact); - g_free(err); - } - - g_free(folder_name); -} - -static void -_join_conf_resp_cb(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConversation *chat; - PurpleConnection *gc; - NMUserRecord *ur; - NMConference *conference = user_data; - const char *name, *conf_name; - int i, count; - - if (user == NULL || conference == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - conf_name = _get_conference_name(++user->conference_count); - chat = serv_got_joined_chat(gc, user->conference_count, conf_name); - if (chat) { - - nm_conference_set_data(conference, (gpointer) chat); - - count = nm_conference_get_participant_count(conference); - for (i = 0; i < count; i++) { - ur = nm_conference_get_participant(conference, i); - if (ur) { - name = nm_user_record_get_display_id(ur); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat), name, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - } - } - } - } -} - -/* Show info returned by getdetails */ -static void -_get_details_resp_show_info(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - char *name; - char *err; - - if (user == NULL) - return; - - name = user_data; - - if (ret_code == NM_OK) { - user_record = (NMUserRecord *) resp_data; - if (user_record) { - _show_info(purple_account_get_connection(user->client_data), - user_record); - } - } else { - gc = purple_account_get_connection(user->client_data); - err = - g_strdup_printf(_("Could not get details for user %s (%s)."), - name, nm_error_to_string (ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (name) - g_free(name); -} - -/* Handle get details response add to privacy list */ -static void -_get_details_resp_add_privacy_item(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record = resp_data; - char *err; - gboolean allowed = GPOINTER_TO_INT(user_data); - const char *display_id; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - display_id = nm_user_record_get_display_id(user_record); - - if (ret_code == NM_OK) { - - if (allowed) { - - if (!g_slist_find_custom(gc->account->permit, - display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, display_id, TRUE); - } - - } else { - - if (!g_slist_find_custom(gc->account->permit, - display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, display_id, TRUE); - } - } - - } else { - - err = g_strdup_printf(_("Unable to add user to privacy list (%s)."), - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -/* Handle response to create privacy item request */ -static void -_create_privacy_item_deny_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - char *who = user_data; - char *err; - NMERR_T rc = NM_OK; - const char *display_id = NULL; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - - user_record = nm_find_user_record(user, who); - if (user_record) - display_id = nm_user_record_get_display_id(user_record); - - if (display_id) { - - if (!g_slist_find_custom(gc->account->deny, - display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - - purple_privacy_deny_add(gc->account, display_id, TRUE); - } - - } else { - rc = nm_send_get_details(user, who, - _get_details_resp_add_privacy_item, - (gpointer)FALSE); - _check_for_disconnect(user, rc); - } - } else { - - err = g_strdup_printf(_("Unable to add %s to deny list (%s)."), - who, nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } - - if (who) - g_free(who); - -} - -/* Handle response to create privacy item request */ -static void -_create_privacy_item_permit_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - char *who = user_data; - char *err; - NMERR_T rc = NM_OK; - const char *display_id = NULL; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - - user_record = nm_find_user_record(user, who); - if (user_record) - display_id = nm_user_record_get_display_id(user_record); - - if (display_id) { - - if (!g_slist_find_custom(gc->account->permit, - display_id, - (GCompareFunc)purple_utf8_strcasecmp)) { - - purple_privacy_permit_add(gc->account, display_id, TRUE); - } - - } else { - rc = nm_send_get_details(user, who, - _get_details_resp_add_privacy_item, - (gpointer)TRUE); - _check_for_disconnect(user, rc); - } - - } else { - - err = g_strdup_printf(_("Unable to add %s to permit list (%s)."), who, - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } - - if (who) - g_free(who); -} - -static void -_get_details_send_privacy_create(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMERR_T rc = NM_OK; - PurpleConnection *gc; - NMUserRecord *user_record = resp_data; - char *err; - gboolean allowed = GPOINTER_TO_INT(user_data); - const char *dn, *display_id; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - dn = nm_user_record_get_dn(user_record); - display_id = nm_user_record_get_display_id(user_record); - - if (ret_code == NM_OK) { - - if (allowed) { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_permit_resp_cb, - g_strdup(display_id)); - _check_for_disconnect(user, rc); - - } else { - rc = nm_send_create_privacy_item(user, dn, FALSE, - _create_privacy_item_deny_resp_cb, - g_strdup(display_id)); - _check_for_disconnect(user, rc); - } - - } else { - - err = g_strdup_printf(_("Unable to add user to privacy list (%s)."), - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -static void -_remove_privacy_item_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - char *who = user_data; - char *err; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - - gc = purple_account_get_connection(user->client_data); - err = g_strdup_printf(_("Unable to remove %s from privacy list (%s)."), who, - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } - - if (who) - g_free(who); -} - -static void -_set_privacy_default_resp_cb(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - PurpleConnection *gc; - char *err; - - if (user == NULL) - return; - - if (ret_code != NM_OK) { - - gc = purple_account_get_connection(user->client_data); - err = g_strdup_printf(_("Unable to change server side privacy settings (%s)."), - nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -/* Handle get details response add to privacy list */ -static void -_get_details_resp_send_invite(NMUser *user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMERR_T rc = NM_OK; - PurpleConnection *gc; - NMUserRecord *user_record = resp_data; - char *err; - GSList *cnode; - NMConference *conference; - gpointer chat; - long id = (long) user_data; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - - if (ret_code == NM_OK) { - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - rc = nm_send_conference_invite(user, conference, user_record, - NULL, _sendinvite_resp_cb, NULL); - _check_for_disconnect(user, rc); - break; - } - } - } - - } else { - - err = g_strdup_printf(_("Unable to invite user (%s)."), nm_error_to_string(ret_code)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - - } -} - -static void -_createconf_resp_send_invite(NMUser * user, NMERR_T ret_code, - gpointer resp_data, gpointer user_data) -{ - NMERR_T rc = NM_OK; - NMConference *conference = resp_data; - NMUserRecord *user_record = user_data; - PurpleConnection *gc; - char *err; - - if (user == NULL) - return; - - - - if (ret_code == NM_OK) { - rc = nm_send_conference_invite(user, conference, user_record, - NULL, _sendinvite_resp_cb, NULL); - _check_for_disconnect(user, rc); - } else { - err = g_strdup_printf(_("Unable to create conference (%s)."), nm_error_to_string(ret_code)); - gc = purple_account_get_connection(user->client_data); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); - } -} - -/******************************************************************************* - * Helper functions - ******************************************************************************/ - -static char * -_user_agent_string(void) -{ - -#if !defined(_WIN32) - - const char *sysname = ""; - const char *release = ""; - struct utsname u; - - if (uname(&u) == 0) { - sysname = u.sysname; - release = u.release; - } else { - sysname = "Linux"; - release = "Unknown"; - } - - return g_strdup_printf("Purple/%s (%s; %s)", VERSION, sysname, release); - -#else - - const char *sysname = ""; - OSVERSIONINFO os_info; - SYSTEM_INFO sys_info; - - os_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&os_info); - GetSystemInfo(&sys_info); - - if (os_info.dwPlatformId == VER_PLATFORM_WIN32_NT) { - switch (os_info.dwMajorVersion) { - case 3: - case 4: - sysname = "Windows NT"; - break; - case 5: - switch (os_info.dwMinorVersion) { - case 0: - sysname = "Windows 2000"; - break; - case 1: - sysname = "Windows XP"; - break; - case 2: - sysname = "Windows Server 2003"; - break; - default: - sysname = "Windows"; - break; - } - break; - default: - sysname = "Windows"; - break; - } - - } else if (os_info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - switch (os_info.dwMinorVersion) { - case 0: - sysname = "Windows 95"; - break; - case 10: - sysname = "Windows 98"; - break; - case 90: - sysname = "Windows ME"; - break; - default: - sysname = "Windows"; - break; - } - } else { - sysname = "Windows"; - } - - return g_strdup_printf("Purple/%s (%s; %ld.%ld)", VERSION, sysname, - os_info.dwMajorVersion, os_info.dwMinorVersion); - -#endif - - -} - -static gboolean -_is_disconnect_error(NMERR_T err) -{ - return (err == NMERR_TCP_WRITE || - err == NMERR_TCP_READ || err == NMERR_PROTOCOL); -} - -static gboolean -_check_for_disconnect(NMUser * user, NMERR_T err) -{ - PurpleConnection *gc = purple_account_get_connection(user->client_data); - - if (_is_disconnect_error(err)) { - - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error communicating with server. Closing connection.")); - return TRUE; - - } - - return FALSE; -} - -/* Check to see if the conference is instantiated, if so send the message. - * If not send the create conference -- the response handler for the createconf - * will call this function again. - */ -static void -_send_message(NMUser * user, NMMessage * message) -{ - NMConference *conf; - NMERR_T rc = NM_OK; - - conf = nm_message_get_conference(message); - if (conf) { - /* We have a conference make sure that the - server knows about it already. */ - if (nm_conference_is_instantiated(conf)) { - - /* We have everything that we need...finally! */ - rc = nm_send_message(user, message, _send_message_resp_cb); - _check_for_disconnect(user, rc); - - nm_release_message(message); - - } else { - rc = nm_send_create_conference(user, conf, _createconf_resp_send_msg, message); - _check_for_disconnect(user, rc); - } - } -} - -/* - * Update the status of the given buddy in the Purple buddy list - */ -static void -_update_buddy_status(NMUser *user, PurpleBuddy * buddy, int novellstatus, int gmt) -{ - PurpleAccount *account; - const char *status_id; - const char *text = NULL; - const char *dn; - const char *name; - int idle = 0; - gboolean loggedin = TRUE; - - account = purple_buddy_get_account(buddy); - name = purple_buddy_get_name(buddy); - - switch (novellstatus) { - case NM_STATUS_AVAILABLE: - status_id = NOVELL_STATUS_TYPE_AVAILABLE; - break; - case NM_STATUS_AWAY: - status_id = NOVELL_STATUS_TYPE_AWAY; - break; - case NM_STATUS_BUSY: - status_id = NOVELL_STATUS_TYPE_BUSY; - break; - case NM_STATUS_OFFLINE: - status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; - break; - case NM_STATUS_AWAY_IDLE: - status_id = NOVELL_STATUS_TYPE_AWAY; - idle = gmt; - break; - default: - status_id = NOVELL_STATUS_TYPE_OFFLINE; - loggedin = FALSE; - break; - } - - /* Get status text for the user */ - dn = nm_lookup_dn(user, name); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); - if (user_record) { - text = nm_user_record_get_status_text(user_record); - } - } - - purple_prpl_got_user_status(account, name, status_id, - "message", text, NULL); - purple_prpl_got_user_idle(account, name, - (novellstatus == NM_STATUS_AWAY_IDLE), idle); -} - -/* Iterate through the cached Purple buddy list and remove buddies - * that are not in the server side list. - */ -static void -_remove_purple_buddies(NMUser *user) -{ - PurpleBlistNode *gnode; - PurpleBlistNode *cnode; - PurpleBlistNode *bnode; - PurpleGroup *group; - PurpleBuddy *buddy; - GSList *rem_list = NULL; - GSList *l; - NMFolder *folder = NULL; - const char *gname = NULL; - - for (gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - group = (PurpleGroup *) gnode; - gname = purple_group_get_name(group); - for (cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = purple_blist_node_get_first_child(cnode); - bnode; - bnode = purple_blist_node_get_sibling_next(bnode)) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *) bnode; - if (purple_buddy_get_account(buddy) == user->client_data) { - if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) - gname = ""; - folder = nm_find_folder(user, gname); - if (folder == NULL || - !nm_folder_find_contact_by_display_id(folder, purple_buddy_get_name(buddy))) { - rem_list = g_slist_append(rem_list, buddy); - } - } - } - } - } - - if (rem_list) { - for (l = rem_list; l; l = l->next) { - purple_blist_remove_buddy(l->data); - } - g_slist_free(rem_list); - } -} - -/* Add all of the contacts in the given folder to the Purple buddy list */ -static void -_add_contacts_to_purple_blist(NMUser * user, NMFolder * folder) -{ - NMUserRecord *user_record = NULL; - NMContact *contact = NULL; - PurpleBuddy *buddy = NULL; - PurpleGroup *group; - NMERR_T cnt = 0, i; - const char *text = NULL; - const char *name = NULL; - const char *fname = NULL; - int status = 0; - - /* If this is the root folder give it a name. Purple does not have the concept of - * a root folder. - */ - fname = nm_folder_get_name(folder); - if (fname == NULL || *fname == '\0') { - fname = NM_ROOT_FOLDER_NAME; - } - - /* Does the Purple group exist already? */ - group = purple_find_group(fname); - if (group == NULL) { - group = purple_group_new(fname); - purple_blist_add_group(group, NULL); - } - - /* Get each contact for this folder */ - cnt = nm_folder_get_contact_count(folder); - for (i = 0; i < cnt; i++) { - contact = nm_folder_get_contact(folder, i); - if (contact) { - - name = nm_contact_get_display_id(contact); - if (name) { - - buddy = purple_find_buddy_in_group(user->client_data, name, group); - if (buddy == NULL) { - /* Add it to the purple buddy list */ - buddy = purple_buddy_new(user->client_data, - name, - nm_contact_get_display_name(contact)); - - purple_blist_add_buddy(buddy, NULL, group, NULL); - } - - /* Set the initial status for the buddy */ - user_record = nm_contact_get_user_record(contact); - if (user_record) { - status = nm_user_record_get_status(user_record); - text = nm_user_record_get_status_text(user_record); - } - _update_buddy_status(user, buddy, status, time(0)); - - /* Save the new buddy as part of the contact object */ - nm_contact_set_data(contact, (gpointer) buddy); - } - - } else { - /* NULL contact. This should not happen, but - * let's break out of the loop. - */ - break; - } - } -} - -/* Add all of the server side contacts to the Purple buddy list. */ -static void -_add_purple_buddies(NMUser * user) -{ - int cnt = 0, i; - NMFolder *root_folder = NULL; - NMFolder *folder = NULL; - - root_folder = nm_get_root_folder(user); - if (root_folder) { - - /* Add sub-folders and contacts to sub-folders... - * iterate throught the sub-folders in reverse order - * because Purple adds the folders to the front -- so we - * want to add the first folder last - */ - cnt = nm_folder_get_subfolder_count(root_folder); - for (i = cnt-1; i >= 0; i--) { - folder = nm_folder_get_subfolder(root_folder, i); - if (folder) { - _add_contacts_to_purple_blist(user, folder); - } - } - - /* Add contacts for the root folder */ - _add_contacts_to_purple_blist(user, root_folder); - } -} - -static void -_sync_contact_list(NMUser *user) -{ - /* Remove all buddies from the local list that are - * not in the server side list and add all buddies - * from the server side list that are not in - * the local list - */ - _remove_purple_buddies(user); - _add_purple_buddies(user); - user->clist_synched = TRUE; -} - -static void -_sync_privacy_lists(NMUser *user) -{ - GSList *node = NULL, *rem_list = NULL; - PurpleConnection *gc; - const char *name, *dn; - NMUserRecord *user_record; - - if (user == NULL) - return; - - gc = purple_account_get_connection(user->client_data); - if (gc == NULL) - return; - - /* Set the Purple privacy setting */ - if (user->default_deny) { - if (user->allow_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_ALL; - } else { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - } - } else { - if (user->deny_list == NULL) { - gc->account->perm_deny = PURPLE_PRIVACY_ALLOW_ALL; - } else { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - } - } - - /* Add stuff */ - for (node = user->allow_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) - name = nm_user_record_get_display_id(user_record); - else - name =(char *)node->data; - - if (!g_slist_find_custom(gc->account->permit, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); - } - } - - for (node = user->deny_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) - name = nm_user_record_get_display_id(user_record); - else - name =(char *)node->data; - - if (!g_slist_find_custom(gc->account->deny, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name, TRUE); - } - } - - - /* Remove stuff */ - for (node = gc->account->permit; node; node = node->next) { - dn = nm_lookup_dn(user, (char *)node->data); - if (dn != NULL && - !g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rem_list = g_slist_append(rem_list, node->data); - } - } - - if (rem_list) { - for (node = rem_list; node; node = node->next) { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); - } - g_free(rem_list); - rem_list = NULL; - } - - for (node = gc->account->deny; node; node = node->next) { - dn = nm_lookup_dn(user, (char *)node->data); - if (dn != NULL && - !g_slist_find_custom(user->deny_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rem_list = g_slist_append(rem_list, node->data); - } - } - - if (rem_list) { - for (node = rem_list; node; node = node->next) { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); - } - g_slist_free(rem_list); - } -} - - /* Map known property tags to user-friendly strings */ -static const char * -_map_property_tag(const char *tag) -{ - if (tag == NULL) return NULL; - - if (strcmp(tag, "telephoneNumber") == 0) - return _("Telephone Number"); - else if (strcmp(tag, "L") == 0) - return _("Location"); - else if (strcmp(tag, "OU") == 0) - return _("Department"); - else if (strcmp(tag, "personalTitle") == 0) - return _("Personal Title"); - else if (strcmp(tag, "Title") == 0) - return _("Title"); - else if (strcmp(tag, "mailstop") == 0) - return _("Mailstop"); - else if (strcmp(tag, "Internet EMail Address") == 0) - return _("Email Address"); - else - return tag; -} - -/* Display a dialog box showing the properties for the given user record */ -static void -_show_info(PurpleConnection * gc, NMUserRecord * user_record) -{ - PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); - int count, i; - NMProperty *property; - const char *tag, *value; - - tag = _("User ID"); - value = nm_user_record_get_userid(user_record); - if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } - -/* tag = _("DN"); - value = nm_user_record_get_dn(user_record); - if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } -*/ - - tag = _("Full name"); - value = nm_user_record_get_full_name(user_record); - if (value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } - - count = nm_user_record_get_property_count(user_record); - for (i = 0; i < count; i++) { - property = nm_user_record_get_property(user_record, i); - if (property) { - tag = _map_property_tag(nm_property_get_tag(property)); - value = nm_property_get_value(property); - if (tag && value) { - purple_notify_user_info_add_pair(user_info, tag, value); - } - nm_release_property(property); - } - } - - purple_notify_userinfo(gc, nm_user_record_get_userid(user_record), - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); -} - -/* Send a join conference, the first item in the parms list is the - * NMUser object and the second item is the conference to join. - * This callback is passed to purple_request_action when we ask the - * user if they want to join the conference. - */ -static void -_join_conference_cb(GSList * parms) -{ - NMUser *user; - NMConference *conference; - NMERR_T rc = NM_OK; - - if (parms == NULL || g_slist_length(parms) != 2) - return; - - user = g_slist_nth_data(parms, 0); - conference = g_slist_nth_data(parms, 1); - - if (user && conference) { - rc = nm_send_join_conference(user, conference, - _join_conf_resp_cb, conference); - _check_for_disconnect(user, rc); - } - - g_slist_free(parms); -} - -/* Send a reject conference, the first item in the parms list is the - * NMUser object and the second item is the conference to reject. - * This callback is passed to purple_request_action when we ask the - * user if they want to joing the conference. - */ -static void -_reject_conference_cb(GSList * parms) -{ - NMUser *user; - NMConference *conference; - NMERR_T rc = NM_OK; - - if (parms == NULL || g_slist_length(parms) != 2) - return; - - user = g_slist_nth_data(parms, 0); - conference = g_slist_nth_data(parms, 1); - - if (user && conference) { - rc = nm_send_reject_conference(user, conference, NULL, NULL); - _check_for_disconnect(user, rc); - } - - g_slist_free(parms); -} - -static void -_initiate_conference_cb(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - NMUser *user; - const char *conf_name; - PurpleConversation *chat = NULL; - NMUserRecord *user_record; - NMConference *conference; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - user = gc->proto_data; - if (user == NULL) - return; - - /* We should already have a userrecord for the buddy */ - user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); - if (user_record == NULL) - return; - - conf_name = _get_conference_name(++user->conference_count); - chat = serv_got_joined_chat(gc, user->conference_count, conf_name); - if (chat) { - - conference = nm_create_conference(NULL); - nm_conference_set_data(conference, (gpointer) chat); - nm_send_create_conference(user, conference, _createconf_resp_send_invite, user_record); - nm_release_conference(conference); - } -} - -const char * -_get_conference_name(int id) -{ - static char *name = NULL; - - if (name) - g_free(name); - - name = g_strdup_printf(_("GroupWise Conference %d"), id); - - return name; -} - -static void -_show_privacy_locked_error(PurpleConnection *gc, NMUser *user) -{ - char *err; - - err = g_strdup_printf(_("Unable to change server side privacy settings (%s)."), - nm_error_to_string(NMERR_ADMIN_LOCKED)); - purple_notify_error(gc, NULL, err, NULL); - g_free(err); -} - -/******************************************************************************* - * Connect and recv callbacks - ******************************************************************************/ - -static void -novell_ssl_connect_error(PurpleSslConnection * gsc, - PurpleSslErrorType error, gpointer data) -{ - PurpleConnection *gc; - NMUser *user; - - gc = data; - user = gc->proto_data; - user->conn->ssl_conn->data = NULL; - - purple_connection_ssl_error (gc, error); -} - -static void -novell_ssl_recv_cb(gpointer data, PurpleSslConnection * gsc, - PurpleInputCondition condition) -{ - PurpleConnection *gc = data; - NMUser *user; - NMERR_T rc; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - rc = nm_process_new_data(user); - if (rc != NM_OK) { - - if (_is_disconnect_error(rc)) { - - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error communicating with server. Closing connection.")); - } else { - purple_debug(PURPLE_DEBUG_INFO, "novell", - "Error processing event or response (%d).\n", rc); - } - } -} - -static void -novell_ssl_connected_cb(gpointer data, PurpleSslConnection * gsc, - PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - NMUser *user; - NMConn *conn; - NMERR_T rc = 0; - const char *pwd = NULL; - const char *my_addr = NULL; - char *ua = NULL; - - if (gc == NULL || gsc == NULL) - return; - - user = gc->proto_data; - if ((user == NULL) || (conn = user->conn) == NULL) - return; - - purple_connection_update_progress(gc, _("Authenticating..."), - 2, NOVELL_CONNECT_STEPS); - - my_addr = purple_network_get_my_ip(gsc->fd); - pwd = purple_connection_get_password(gc); - ua = _user_agent_string(); - - rc = nm_send_login(user, pwd, my_addr, ua, _login_resp_cb, NULL); - if (rc == NM_OK) { - conn->connected = TRUE; - purple_ssl_input_add(gsc, novell_ssl_recv_cb, gc); - } else { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } - - purple_connection_update_progress(gc, _("Waiting for response..."), - 3, NOVELL_CONNECT_STEPS); - - g_free(ua); -} - -/******************************************************************************* - * Event callback and event handlers - ******************************************************************************/ - -static void -_evt_receive_message(NMUser * user, NMEvent * event) -{ - NMUserRecord *user_record = NULL; - NMContact *contact = NULL; - PurpleConversation *gconv; - NMConference *conference; - PurpleMessageFlags flags; - char *text = NULL; - - text = g_markup_escape_text(nm_event_get_text(event), -1); - - conference = nm_event_get_conference(event); - if (conference) { - - PurpleConversation *chat = nm_conference_get_data(conference); - - /* Is this a single person 'conversation' or a conference? */ - if (chat == NULL && nm_conference_get_participant_count(conference) == 1) { - - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - - flags = 0; - if (nm_event_get_type(event) == NMEVT_RECEIVE_AUTOREPLY) - flags |= PURPLE_MESSAGE_AUTO_RESP; - - serv_got_im(purple_account_get_connection(user->client_data), - nm_user_record_get_display_id(user_record), - text, flags, - nm_event_get_gmt(event)); - - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - nm_user_record_get_display_id(user_record), - (PurpleAccount *) user->client_data); - if (gconv) { - - contact = nm_find_contact(user, nm_event_get_source(event)); - if (contact) { - - purple_conversation_set_title( - gconv, nm_contact_get_display_name(contact)); - - - } else { - - const char *name = - nm_user_record_get_full_name(user_record); - - if (name == NULL) - name = nm_user_record_get_userid(user_record); - - purple_conversation_set_title(gconv, name); - } - - } - - } else { - /* this should not happen, see the event code. - * the event code will get the contact details from - * the server if it does not have them before calling - * the event callback. - */ - } - - } else if (chat) { - - /* get the contact for send if we have one */ - NMContact *contact = nm_find_contact(user, - nm_event_get_source(event)); - - /* get the user record for the sender */ - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - const char *name = nm_contact_get_display_name(contact); - - if (name == NULL) { - name = nm_user_record_get_full_name(user_record); - if (name == NULL) - name = nm_user_record_get_display_id(user_record); - } - - serv_got_chat_in(purple_account_get_connection(user->client_data), - purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)), - name, 0, text, nm_event_get_gmt(event)); - } - } - } - - g_free(text); -} - -static void -_evt_conference_left(NMUser * user, NMEvent * event) -{ - PurpleConversation *chat; - NMConference *conference; - - conference = nm_event_get_conference(event); - if (conference) { - chat = nm_conference_get_data(conference); - if (chat) { - NMUserRecord *ur = nm_find_user_record(user, - nm_event_get_source(event)); - - if (ur) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat), - nm_user_record_get_display_id(ur), - NULL); - } - } -} - -static void -_evt_conference_invite_notify(NMUser * user, NMEvent * event) -{ - PurpleConversation *gconv; - NMConference *conference; - NMUserRecord *user_record = NULL; - char *str = NULL; - - user_record = nm_find_user_record(user, nm_event_get_source(event)); - conference = nm_event_get_conference(event); - if (user_record && conference) { - gconv = nm_conference_get_data(conference); - str = g_strdup_printf(_("%s has been invited to this conversation."), - nm_user_record_get_display_id(user_record)); - purple_conversation_write(gconv, NULL, str, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - } -} - -static void -_evt_conference_invite(NMUser * user, NMEvent * event) -{ - NMUserRecord *ur; - PurpleConnection *gc; - GSList *parms = NULL; - const char *title = NULL; - const char *secondary = NULL; - const char *name = NULL; - char *primary = NULL; - time_t gmt; - - ur = nm_find_user_record(user, nm_event_get_source(event)); - if (ur) - name = nm_user_record_get_full_name(ur); - - if (name == NULL) - name = nm_event_get_source(event); - - gmt = nm_event_get_gmt(event); - title = _("Invitation to Conversation"); - primary = g_strdup_printf(_("Invitation from: %s\n\nSent: %s"), - name, purple_date_format_full(localtime(&gmt))); - secondary = _("Would you like to join the conversation?"); - - /* Set up parms list for the callbacks - * We need to send the NMUser object and - * the NMConference object to the callbacks - */ - parms = NULL; - parms = g_slist_append(parms, user); - parms = g_slist_append(parms, nm_event_get_conference(event)); - - /* Prompt the user */ - /* TODO: Would it be better to use serv_got_chat_invite() here? */ - gc = purple_account_get_connection(user->client_data); - purple_request_action(gc, title, primary, secondary, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), name, NULL, - parms, 2, - _("Yes"), G_CALLBACK(_join_conference_cb), - _("No"), G_CALLBACK(_reject_conference_cb)); - - g_free(primary); -} - - -static void -_evt_conference_joined(NMUser * user, NMEvent * event) -{ - PurpleConversation *chat = NULL; - PurpleConnection *gc; - NMConference *conference = NULL; - NMUserRecord *ur = NULL; - const char *name; - const char *conf_name; - - gc = purple_account_get_connection(user->client_data); - if (gc == NULL) - return; - - conference = nm_event_get_conference(event); - if (conference) { - chat = nm_conference_get_data(conference); - if (nm_conference_get_participant_count(conference) == 2 && chat == NULL) { - ur = nm_conference_get_participant(conference, 0); - if (ur) { - conf_name = _get_conference_name(++user->conference_count); - chat = - serv_got_joined_chat(gc, user->conference_count, conf_name); - if (chat) { - - nm_conference_set_data(conference, (gpointer) chat); - - name = nm_user_record_get_display_id(ur); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat), name, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - - } - } - } - - if (chat != NULL) { - ur = nm_find_user_record(user, nm_event_get_source(event)); - if (ur) { - name = nm_user_record_get_display_id(ur); - if (!purple_conv_chat_find_user(PURPLE_CONV_CHAT(chat), name)) { - purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat), name, NULL, - PURPLE_CBFLAGS_NONE, TRUE); - } - } - } - } -} - -static void -_evt_status_change(NMUser * user, NMEvent * event) -{ - PurpleBuddy *buddy = NULL; - GSList *buddies; - GSList *bnode; - NMUserRecord *user_record; - const char *display_id; - int status; - - user_record = nm_event_get_user_record(event); - if (user_record) { - - /* Retrieve new status */ - status = nm_user_record_get_status(user_record); - - /* Update status for buddy in all folders */ - display_id = nm_user_record_get_display_id(user_record); - buddies = purple_find_buddies(user->client_data, display_id); - for (bnode = buddies; bnode; bnode = bnode->next) { - buddy = (PurpleBuddy *) bnode->data; - if (buddy) { - _update_buddy_status(user, buddy, status, nm_event_get_gmt(event)); - } - } - - g_slist_free(buddies); - - } -} - -static void -_evt_user_disconnect(NMUser * user, NMEvent * event) -{ - PurpleConnection *gc; - PurpleAccount *account = user->client_data; - - gc = purple_account_get_connection(account); - if (gc) - { - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NAME_IN_USE, - _("You have signed on from another location")); - } -} - -static void -_evt_user_typing(NMUser * user, NMEvent * event) -{ - PurpleConnection *gc; - NMUserRecord *user_record = NULL; - - gc = purple_account_get_connection((PurpleAccount *) user->client_data); - if (gc) { - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - serv_got_typing(gc, nm_user_record_get_display_id(user_record), - 30, PURPLE_TYPING); - } - } -} - -static void -_evt_user_not_typing(NMUser * user, NMEvent * event) -{ - PurpleConnection *gc; - NMUserRecord *user_record; - - gc = purple_account_get_connection((PurpleAccount *) user->client_data); - if (gc) { - user_record = nm_find_user_record(user, nm_event_get_source(event)); - if (user_record) { - serv_got_typing_stopped(gc, - nm_user_record_get_display_id(user_record)); - } - } -} - -static void -_evt_undeliverable_status(NMUser * user, NMEvent * event) -{ - NMUserRecord *ur; - PurpleConversation *gconv; - char *str; - - ur = nm_find_user_record(user, nm_event_get_source(event)); - if (ur) { - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - gconv = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - nm_user_record_get_display_id(ur), - user->client_data); - if (gconv) { - const char *name = nm_user_record_get_full_name(ur); - - if (name == NULL) { - name = nm_user_record_get_display_id(ur); - } - str = g_strdup_printf(_("%s appears to be offline and did not receive" - " the message that you just sent."), name); - purple_conversation_write(gconv, NULL, str, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - } - } -} - -static void -_event_callback(NMUser * user, NMEvent * event) -{ - if (user == NULL || event == NULL) - return; - - switch (nm_event_get_type(event)) { - case NMEVT_STATUS_CHANGE: - _evt_status_change(user, event); - break; - case NMEVT_RECEIVE_AUTOREPLY: - case NMEVT_RECEIVE_MESSAGE: - _evt_receive_message(user, event); - break; - case NMEVT_USER_DISCONNECT: - _evt_user_disconnect(user, event); - break; - case NMEVT_USER_TYPING: - _evt_user_typing(user, event); - break; - case NMEVT_USER_NOT_TYPING: - _evt_user_not_typing(user, event); - break; - case NMEVT_SERVER_DISCONNECT: - /* Nothing to do? */ - break; - case NMEVT_INVALID_RECIPIENT: - break; - case NMEVT_UNDELIVERABLE_STATUS: - _evt_undeliverable_status(user, event); - break; - case NMEVT_CONFERENCE_INVITE_NOTIFY: - /* Someone else has been invited to join a - * conference that we are currently a part of - */ - _evt_conference_invite_notify(user, event); - break; - case NMEVT_CONFERENCE_INVITE: - /* We have been invited to join a conference */ - _evt_conference_invite(user, event); - break; - case NMEVT_CONFERENCE_JOINED: - /* Some one has joined a conference that we - * are a part of - */ - _evt_conference_joined(user, event); - break; - case NMEVT_CONFERENCE_LEFT: - /* Someone else has left a conference that we - * are currently a part of - */ - _evt_conference_left(user, event); - break; - default: - purple_debug(PURPLE_DEBUG_INFO, "novell", - "_event_callback(): unhandled event, %d\n", - nm_event_get_type(event)); - break; - } -} - -/******************************************************************************* - * Prpl Ops - ******************************************************************************/ - -static void -novell_login(PurpleAccount * account) -{ - PurpleConnection *gc; - NMUser *user = NULL; - const char *server; - const char *name; - int port; - - if (account == NULL) - return; - - gc = purple_account_get_connection(account); - if (gc == NULL) - return; - - server = purple_account_get_string(account, "server", NULL); - if (server == NULL || *server == '\0') { - - /* TODO: Would be nice to prompt if not set! - * purple_request_fields(gc, _("Server Address"),...); - */ - - /* ...but for now just error out with a nice message. */ - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("Unable to connect to server. Please enter the " - "address of the server to which you wish to connect.")); - return; - } - - port = purple_account_get_int(account, "port", DEFAULT_PORT); - name = purple_account_get_username(account); - - user = nm_initialize_user(name, server, port, account, _event_callback); - if (user && user->conn) { - /* save user */ - gc->proto_data = user; - - /* connect to the server */ - purple_connection_update_progress(gc, _("Connecting"), - 1, NOVELL_CONNECT_STEPS); - - user->conn->use_ssl = TRUE; - - user->conn->ssl_conn = g_new0(NMSSLConn, 1); - user->conn->ssl_conn->read = (nm_ssl_read_cb) purple_ssl_read; - user->conn->ssl_conn->write = (nm_ssl_write_cb) purple_ssl_write; - - user->conn->ssl_conn->data = purple_ssl_connect(user->client_data, - user->conn->addr, user->conn->port, - novell_ssl_connected_cb, novell_ssl_connect_error, gc); - if (user->conn->ssl_conn->data == NULL) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - } - } -} - -static void -novell_close(PurpleConnection * gc) -{ - NMUser *user; - NMConn *conn; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user) { - conn = user->conn; - if (conn && conn->ssl_conn) { - purple_ssl_close(user->conn->ssl_conn->data); - } - nm_deinitialize_user(user); - } - gc->proto_data = NULL; -} - -static int -novell_send_im(PurpleConnection * gc, const char *name, - const char *message_body, PurpleMessageFlags flags) -{ - NMUserRecord *user_record = NULL; - NMConference *conf = NULL; - NMMessage *message; - NMUser *user; - const char *dn = NULL; - char *plain; - gboolean done = TRUE, created_conf = FALSE; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL || - message_body == NULL || *message_body == '\0') - return 0; - - user = gc->proto_data; - if (user == NULL) - return 0; - - /* Create a new message */ - plain = purple_unescape_html(message_body); - message = nm_create_message(plain); - g_free(plain); - - /* Need to get the DN for the buddy so we can look up the convo */ - dn = nm_lookup_dn(user, name); - - /* Do we already know about the sender? */ - user_record = nm_find_user_record(user, dn); - if (user_record) { - - /* Do we already have an instantiated conference? */ - conf = nm_find_conversation(user, dn); - if (conf == NULL) { - - /* If not, create a blank conference */ - conf = nm_create_conference(NULL); - created_conf = TRUE; - - nm_conference_add_participant(conf, user_record); - } - - nm_message_set_conference(message, conf); - - /* Make sure conference is instantiated */ - if (!nm_conference_is_instantiated(conf)) { - - /* It is not, so send the createconf. We will - * have to finish sending the message when we - * get the response with the new conference guid. - */ - rc = nm_send_create_conference(user, conf, _createconf_resp_send_msg, message); - _check_for_disconnect(user, rc); - - done = FALSE; - } - - } else { - - /* If we don't have details for the user, then we don't have - * a conference yet. So create one and send the getdetails - * to the server. We will have to finish sending the message - * when we get the response from the server. - */ - conf = nm_create_conference(NULL); - created_conf = TRUE; - - nm_message_set_conference(message, conf); - - rc = nm_send_get_details(user, name, _get_details_resp_send_msg, message); - _check_for_disconnect(user, rc); - - done = FALSE; - } - - if (done) { - - /* Did we find everything we needed? */ - rc = nm_send_message(user, message, _send_message_resp_cb); - _check_for_disconnect(user, rc); - - nm_release_message(message); - } - - if (created_conf && conf) - nm_release_conference(conf); - - return 1; -} - -static unsigned int -novell_send_typing(PurpleConnection * gc, const char *name, PurpleTypingState state) -{ - NMConference *conf = NULL; - NMUser *user; - const char *dn = NULL; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL) - return 0; - - user = gc->proto_data; - if (user == NULL) - return 0; - - /* Need to get the DN for the buddy so we can look up the convo */ - dn = nm_lookup_dn(user, name); - if (dn) { - - /* Now find the conference in our list */ - conf = nm_find_conversation(user, dn); - if (conf) { - - rc = nm_send_typing(user, conf, - ((state == PURPLE_TYPING) ? TRUE : FALSE), NULL); - _check_for_disconnect(user, rc); - - } - - } - - return 0; -} - -static void -novell_convo_closed(PurpleConnection * gc, const char *who) -{ - NMUser *user; - NMConference *conf; - const char *dn; - NMERR_T rc = NM_OK; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user && (dn = nm_lookup_dn(user, who))) { - conf = nm_find_conversation(user, dn); - if (conf) { - rc = nm_send_leave_conference(user, conf, NULL, NULL); - _check_for_disconnect(user, rc); - } - } -} - -static void -novell_chat_leave(PurpleConnection * gc, int id) -{ - NMConference *conference; - NMUser *user; - PurpleConversation *chat; - GSList *cnode; - NMERR_T rc = NM_OK; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - rc = nm_send_leave_conference(user, conference, NULL, NULL); - _check_for_disconnect(user, rc); - break; - } - } - } - - serv_got_chat_left(gc, id); -} - -static void -novell_chat_invite(PurpleConnection *gc, int id, - const char *message, const char *who) -{ - NMConference *conference; - NMUser *user; - PurpleConversation *chat; - GSList *cnode; - NMERR_T rc = NM_OK; - NMUserRecord *user_record = NULL; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - user_record = nm_find_user_record(user, who); - if (user_record == NULL) { - rc = nm_send_get_details(user, who, _get_details_resp_send_invite, GINT_TO_POINTER(id)); - _check_for_disconnect(user, rc); - return; - } - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - rc = nm_send_conference_invite(user, conference, user_record, - message, _sendinvite_resp_cb, NULL); - _check_for_disconnect(user, rc); - break; - } - } - } -} - -static int -novell_chat_send(PurpleConnection * gc, int id, const char *text, PurpleMessageFlags flags) -{ - NMConference *conference; - PurpleConversation *chat; - GSList *cnode; - NMMessage *message; - NMUser *user; - NMERR_T rc = NM_OK; - const char *name; - char *str, *plain; - - if (gc == NULL || text == NULL) - return -1; - - user = gc->proto_data; - if (user == NULL) - return -1; - - plain = purple_unescape_html(text); - message = nm_create_message(plain); - g_free(plain); - - for (cnode = user->conferences; cnode != NULL; cnode = cnode->next) { - conference = cnode->data; - if (conference && (chat = nm_conference_get_data(conference))) { - if (purple_conv_chat_get_id(PURPLE_CONV_CHAT(chat)) == id) { - - nm_message_set_conference(message, conference); - - /* check to see if the conference is instatiated yet */ - if (!nm_conference_is_instantiated(conference)) { - nm_message_add_ref(message); - nm_send_create_conference(user, conference, _createconf_resp_send_msg, message); - } else { - rc = nm_send_message(user, message, _send_message_resp_cb); - } - - nm_release_message(message); - - if (!_check_for_disconnect(user, rc)) { - - /* Use the account alias if it is set */ - name = purple_account_get_alias(user->client_data); - if (name == NULL || *name == '\0') { - - /* If there is no account alias, try full name */ - name = nm_user_record_get_full_name(user->user_record); - if (name == NULL || *name == '\0') { - - /* Fall back to the username that we are signed in with */ - name = purple_account_get_username(user->client_data); - } - } - - serv_got_chat_in(gc, id, name, flags, text, time(NULL)); - return 0; - } else - return -1; - - } - } - } - - - /* The conference was not found, must be closed */ - chat = purple_find_chat(gc, id); - if (chat) { - str = g_strdup(_("This conference has been closed." - " No more messages can be sent.")); - purple_conversation_write(chat, NULL, str, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(str); - } - - if (message) - nm_release_message(message); - - return -1; -} - -static void -novell_add_buddy(PurpleConnection * gc, PurpleBuddy *buddy, PurpleGroup * group) -{ - NMFolder *folder = NULL; - NMContact *contact; - NMUser *user; - NMERR_T rc = NM_OK; - const char *alias, *gname, *bname; - - if (gc == NULL || buddy == NULL || group == NULL) - return; - - user = (NMUser *) purple_connection_get_protocol_data(gc); - if (user == NULL) - return; - - /* If we haven't synched the contact list yet, ignore - * the add_buddy calls. Server side list is the master. - */ - if (!user->clist_synched) - return; - - /* Don't re-add a buddy that is already on our contact list */ - if (nm_find_user_record(user, purple_buddy_get_name(buddy)) != NULL) - return; - - contact = nm_create_contact(); - nm_contact_set_dn(contact, purple_buddy_get_name(buddy)); - - /* Remove the PurpleBuddy (we will add it back after adding it - * to the server side list). Save the alias if there is one. - */ - alias = purple_buddy_get_alias(buddy); - bname = purple_buddy_get_name(buddy); - if (alias && strcmp(alias, bname)) - nm_contact_set_display_name(contact, alias); - - purple_blist_remove_buddy(buddy); - buddy = NULL; - - gname = purple_group_get_name(group); - if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { - gname = ""; - } - - folder = nm_find_folder(user, gname); - if (folder) { - - /* We have everything that we need, so send the createcontact */ - rc = nm_send_create_contact(user, folder, contact, - _create_contact_resp_cb, contact); - - } else { - - /* Need to create the folder before we can add the contact */ - rc = nm_send_create_folder(user, gname, - _create_folder_resp_add_contact, contact); - } - - _check_for_disconnect(user, rc); - -} - -static void -novell_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - NMContact *contact; - NMFolder *folder; - NMUser *user; - const char *dn, *gname; - NMERR_T rc = NM_OK; - - if (gc == NULL || buddy == NULL || group == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)))) { - gname = purple_group_get_name(group); - if (strcmp(gname, NM_ROOT_FOLDER_NAME) == 0) { - gname = ""; - } - folder = nm_find_folder(user, gname); - if (folder) { - contact = nm_folder_find_contact(folder, dn); - if (contact) { - - /* Remove the buddy from the contact */ - nm_contact_set_data(contact, NULL); - - /* Tell the server to remove the contact */ - rc = nm_send_remove_contact(user, folder, contact, - _remove_contact_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } - } -} - -static void -novell_remove_group(PurpleConnection * gc, PurpleGroup *group) -{ - NMUser *user; - NMERR_T rc = NM_OK; - - if (gc == NULL || group == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user) { - NMFolder *folder = nm_find_folder(user, purple_group_get_name(group)); - - if (folder) { - rc = nm_send_remove_folder(user, folder, - _remove_folder_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } -} - -static void -novell_alias_buddy(PurpleConnection * gc, const char *name, const char *alias) -{ - NMContact *contact; - NMUser *user; - GList *contacts = NULL; - GList *cnode = NULL; - const char *dn = NULL, *fname = NULL; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL || alias == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, name))) { - - /* Alias all of instances of the contact */ - contacts = nm_find_contacts(user, dn); - for (cnode = contacts; cnode != NULL; cnode = cnode->next) { - contact = (NMContact *) cnode->data; - if (contact) { - PurpleGroup *group = NULL; - PurpleBuddy *buddy; - NMFolder *folder; - - /* Alias the Purple buddy? */ - folder = nm_find_folder_by_id(user, - nm_contact_get_parent_id(contact)); - if (folder) { - fname = nm_folder_get_name(folder); - if (*fname == '\0') { - fname = NM_ROOT_FOLDER_NAME; - } - group = purple_find_group(fname); - } - - if (group) { - const char *balias; - buddy = purple_find_buddy_in_group(user->client_data, - name, group); - balias = buddy ? purple_buddy_get_local_buddy_alias(buddy) : NULL; - if (balias && strcmp(balias, alias)) - purple_blist_alias_buddy(buddy, alias); - } - - /* Tell the server to alias the contact */ - rc = nm_send_rename_contact(user, contact, alias, - _rename_contact_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } - if (contacts) - g_list_free(contacts); - } -} - -static void -novell_group_buddy(PurpleConnection * gc, - const char *name, const char *old_group_name, - const char *new_group_name) -{ - NMFolder *old_folder; - NMFolder *new_folder; - NMContact *contact; - NMUser *user; - const char *dn; - NMERR_T rc = NM_OK; - - if (gc == NULL || name == NULL || - old_group_name == NULL || new_group_name == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user && (dn = nm_lookup_dn(user, name))) { - - /* Find the old folder */ - if (strcmp(old_group_name, NM_ROOT_FOLDER_NAME) == 0) { - old_folder = nm_get_root_folder(user); - if (nm_folder_find_contact(old_folder, dn) == NULL) - old_folder = nm_find_folder(user, old_group_name); - } else { - old_folder = nm_find_folder(user, old_group_name); - } - - if (old_folder && (contact = nm_folder_find_contact(old_folder, dn))) { - - /* Find the new folder */ - new_folder = nm_find_folder(user, new_group_name); - if (new_folder == NULL) { - if (strcmp(new_group_name, NM_ROOT_FOLDER_NAME) == 0) - new_folder = nm_get_root_folder(user); - } - - if (new_folder) { - - /* Tell the server to move the contact to the new folder */ - rc = nm_send_move_contact(user, contact, new_folder, - _move_contact_resp_cb, NULL); - - } else { - - nm_contact_add_ref(contact); - - /* Remove the old contact first */ - nm_send_remove_contact(user, old_folder, contact, - _remove_contact_resp_cb, NULL); - - /* New folder does not exist yet, so create it */ - rc = nm_send_create_folder(user, new_group_name, - _create_folder_resp_move_contact, - contact); - } - - _check_for_disconnect(user, rc); - } - } -} - -static void -novell_rename_group(PurpleConnection * gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - NMERR_T rc = NM_OK; - NMFolder *folder; - NMUser *user; - - if (gc == NULL || old_name == NULL || group == NULL || moved_buddies == NULL) { - return; - } - - user = gc->proto_data; - if (user) { - const char *gname = purple_group_get_name(group); - /* Does new folder exist already? */ - if (nm_find_folder(user, gname)) { - /* purple_blist_rename_group() adds the buddies - * to the new group and removes the old group... - * so there is nothing more to do here. - */ - return; - } - - if (strcmp(old_name, NM_ROOT_FOLDER_NAME) == 0) { - /* Can't rename the root folder ... need to revisit this */ - return; - } - - folder = nm_find_folder(user, old_name); - if (folder) { - rc = nm_send_rename_folder(user, folder, gname, - _rename_folder_resp_cb, NULL); - _check_for_disconnect(user, rc); - } - } -} - -static const char * -novell_list_icon(PurpleAccount * account, PurpleBuddy * buddy) -{ - return "novell"; -} - -static void -novell_tooltip_text(PurpleBuddy * buddy, PurpleNotifyUserInfo * user_info, gboolean full) -{ - NMUserRecord *user_record = NULL; - PurpleConnection *gc; - NMUser *user; - int status = 0; - const char *status_str = NULL; - const char *text = NULL; - - if (buddy == NULL) - return; - - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - if (gc == NULL || (user = gc->proto_data) == NULL) - return; - - if (PURPLE_BUDDY_IS_ONLINE(buddy)) { - user_record = nm_find_user_record(user, purple_buddy_get_name(buddy)); - if (user_record) { - status = nm_user_record_get_status(user_record); - text = nm_user_record_get_status_text(user_record); - /* No custom text, so default it ... */ - switch (status) { - case NM_STATUS_AVAILABLE: - status_str = _("Available"); - break; - case NM_STATUS_AWAY: - status_str = _("Away"); - break; - case NM_STATUS_BUSY: - status_str = _("Busy"); - break; - case NM_STATUS_AWAY_IDLE: - status_str = _("Idle"); - break; - case NM_STATUS_OFFLINE: - status_str = _("Offline"); - break; - default: - status_str = _("Unknown"); - break; - } - - purple_notify_user_info_add_pair(user_info, _("Status"), status_str); - - if (text) - purple_notify_user_info_add_pair(user_info, _("Message"), text); - } - } -} - -static void -novell_set_idle(PurpleConnection * gc, int time) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *id = NULL; - PurpleStatus *status = NULL; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - status = purple_account_get_active_status(purple_connection_get_account(gc)); - id = purple_status_get_id(status); - - /* Only go idle if active status is available */ - if (!strcmp(id, NOVELL_STATUS_TYPE_AVAILABLE)) { - if (time > 0) { - rc = nm_send_set_status(user, NM_STATUS_AWAY_IDLE, NULL, NULL, NULL, NULL); - } else { - rc = nm_send_set_status(user, NM_STATUS_AVAILABLE, NULL, NULL, NULL, NULL); - } - } - - _check_for_disconnect(user, rc); -} - -static void -novell_get_info(PurpleConnection * gc, const char *name) -{ - NMUserRecord *user_record; - NMUser *user; - NMERR_T rc; - - if (gc == NULL || name == NULL) - return; - - user = (NMUser *) gc->proto_data; - if (user) { - - user_record = nm_find_user_record(user, name); - if (user_record) { - - _show_info(gc, user_record); - - } else { - - rc = nm_send_get_details(user, name, - _get_details_resp_show_info, g_strdup(name)); - - _check_for_disconnect(user, rc); - - } - - } -} - -static char * -novell_status_text(PurpleBuddy * buddy) -{ - const char *text = NULL; - const char *dn = NULL; - PurpleAccount *account; - - account = buddy ? purple_buddy_get_account(buddy) : NULL; - if (buddy && account) { - PurpleConnection *gc = purple_account_get_connection(account); - - if (gc && gc->proto_data) { - NMUser *user = gc->proto_data; - - dn = nm_lookup_dn(user, purple_buddy_get_name(buddy)); - if (dn) { - NMUserRecord *user_record = nm_find_user_record(user, dn); - - if (user_record) { - text = nm_user_record_get_status_text(user_record); - if (text) - return g_strdup(text); - } - } - } - } - - return NULL; -} - -static GList * -novell_status_types(PurpleAccount *account) -{ - GList *status_types = NULL; - PurpleStatusType *type; - - g_return_val_if_fail(account != NULL, NULL); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, NOVELL_STATUS_TYPE_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, NOVELL_STATUS_TYPE_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, NOVELL_STATUS_TYPE_BUSY, - _("Busy"), TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, NOVELL_STATUS_TYPE_APPEAR_OFFLINE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE); - status_types = g_list_append(status_types, type); - - return status_types; -} - -static void -novell_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - gboolean connected; - PurplePresence *presence; - PurpleStatusType *type; - PurpleStatusPrimitive primitive; - NMUser *user; - NMSTATUS_T novellstatus = NM_STATUS_AVAILABLE; - NMERR_T rc = NM_OK; - const char *msg = NULL; - char *text = NULL; - - connected = purple_account_is_connected(account); - presence = purple_status_get_presence(status); - type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(type); - - /* - * We don't have any independent statuses, so we don't need to - * do anything when a status is deactivated (because another - * status is about to be activated). - */ - if (!purple_status_is_active(status)) - return; - - if (!connected) - return; - - gc = purple_account_get_connection(account); - user = gc->proto_data; - if (user == NULL) - return; - - if (primitive == PURPLE_STATUS_AVAILABLE) { - novellstatus = NM_STATUS_AVAILABLE; - } else if (primitive == PURPLE_STATUS_AWAY) { - novellstatus = NM_STATUS_AWAY; - } else if (primitive == PURPLE_STATUS_UNAVAILABLE) { - novellstatus = NM_STATUS_BUSY; - } else if (primitive == PURPLE_STATUS_INVISIBLE) { - novellstatus = NM_STATUS_OFFLINE; - } else if (purple_presence_is_idle(presence)) { - novellstatus = NM_STATUS_AWAY_IDLE; - } else { - novellstatus = NM_STATUS_AVAILABLE; - } - - if (primitive == PURPLE_STATUS_AWAY || primitive == PURPLE_STATUS_AVAILABLE || - primitive == PURPLE_STATUS_UNAVAILABLE) { - msg = purple_status_get_attr_string(status, "message"); - text = g_strdup(msg); - - if (primitive == PURPLE_STATUS_AVAILABLE) - msg = NULL; /* no auto replies for online status */ - - /* Don't want newlines in status text */ - purple_util_chrreplace(text, '\n', ' '); - } - - rc = nm_send_set_status(user, novellstatus, text, msg, NULL, NULL); - _check_for_disconnect(user, rc); - - if (text) - g_free(text); -} - -static void -novell_add_permit(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *name = who; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - /* Remove first -- we will add it back in when we get - * the okay from the server - */ - purple_privacy_permit_remove(gc->account, who, TRUE); - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - /* Work around for problem with un-typed, dotted contexts */ - if (strchr(who, '.')) { - const char *dn = nm_lookup_dn(user, who); - if (dn == NULL) { - rc = nm_send_get_details(user, who, _get_details_send_privacy_create, - (gpointer)TRUE); - _check_for_disconnect(user, rc); - return; - } else { - name = dn; - } - } - - rc = nm_send_create_privacy_item(user, name, TRUE, - _create_privacy_item_permit_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_add_deny(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *name = who; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - /* Remove first -- we will add it back in when we get - * the okay from the server - */ - purple_privacy_deny_remove(gc->account, who, TRUE); - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - /* Work around for problem with un-typed, dotted contexts */ - if (strchr(who, '.')) { - const char *dn = nm_lookup_dn(user, who); - if (dn == NULL) { - rc = nm_send_get_details(user, who, _get_details_send_privacy_create, - (gpointer)FALSE); - _check_for_disconnect(user, rc); - return; - } else { - name = dn; - } - } - - rc = nm_send_create_privacy_item(user, name, FALSE, - _create_privacy_item_deny_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_rem_permit(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *dn = NULL; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - dn = nm_lookup_dn(user, who); - if (dn == NULL) - dn = who; - - rc = nm_send_remove_privacy_item(user, dn, TRUE, - _remove_privacy_item_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_rem_deny(PurpleConnection *gc, const char *who) -{ - NMUser *user; - NMERR_T rc = NM_OK; - const char *dn = NULL; - - if (gc == NULL || who == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - dn = nm_lookup_dn(user, who); - if (dn == NULL) - dn = who; - - rc = nm_send_remove_privacy_item(user, dn, FALSE, - _remove_privacy_item_resp_cb, - g_strdup(who)); - _check_for_disconnect(user, rc); -} - -static void -novell_set_permit_deny(PurpleConnection *gc) -{ - NMERR_T rc = NM_OK; - const char *dn, *name = NULL; - NMUserRecord *user_record = NULL; - GSList *node = NULL, *copy = NULL; - NMUser *user; - int i, j, num_contacts, num_folders; - NMContact *contact; - NMFolder *folder = NULL; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - if (user->privacy_synched == FALSE) { - _sync_privacy_lists(user); - user->privacy_synched = TRUE; - return; - } - - if (nm_user_is_privacy_locked(user)) { - _show_privacy_locked_error(gc, user); - _sync_privacy_lists(user); - return; - } - - switch (gc->account->perm_deny) { - - case PURPLE_PRIVACY_ALLOW_ALL: - rc = nm_send_set_privacy_default(user, FALSE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* clear server side deny list */ - if (rc == NM_OK) { - copy = g_slist_copy(user->deny_list); - for (node = copy; node && node->data; node = node->next) { - rc = nm_send_remove_privacy_item(user, (const char *)node->data, - FALSE, NULL, NULL); - if (_check_for_disconnect(user, rc)) - break; - } - g_slist_free(copy); - g_slist_free(user->deny_list); - user->deny_list = NULL; - } - break; - - case PURPLE_PRIVACY_DENY_ALL: - rc = nm_send_set_privacy_default(user, TRUE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* clear server side allow list */ - if (rc == NM_OK) { - copy = g_slist_copy(user->allow_list); - for (node = copy; node && node->data; node = node->next) { - rc = nm_send_remove_privacy_item(user, (const char *)node->data, - TRUE, NULL, NULL); - if (_check_for_disconnect(user, rc)) - break; - } - g_slist_free(copy); - g_slist_free(user->allow_list); - user->allow_list = NULL; - } - break; - - case PURPLE_PRIVACY_ALLOW_USERS: - - rc = nm_send_set_privacy_default(user, TRUE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* sync allow lists */ - if (rc == NM_OK) { - - for (node = user->allow_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) { - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(gc->account->permit, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(gc->account, name , TRUE); - } - } - } - - for (node = gc->account->permit; node; node = node->next) { - name = NULL; - dn = nm_lookup_dn(user, (char *)node->data); - if (dn) { - user_record = nm_find_user_record(user, dn); - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_deny_resp_cb, - g_strdup(dn)); - } - } else { - purple_privacy_permit_remove(gc->account, (char *)node->data, TRUE); - } - } - } - break; - - case PURPLE_PRIVACY_DENY_USERS: - - /* set to default allow */ - rc = nm_send_set_privacy_default(user, FALSE, - _set_privacy_default_resp_cb, NULL); - _check_for_disconnect(user, rc); - - /* sync deny lists */ - if (rc == NM_OK) { - - for (node = user->deny_list; node; node = node->next) { - user_record = nm_find_user_record(user, (char *)node->data); - if (user_record) { - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(gc->account->deny, - name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(gc->account, name , TRUE); - } - } - } - - for (node = gc->account->deny; node; node = node->next) { - - name = NULL; - dn = nm_lookup_dn(user, (char *)node->data); - if (dn) { - user_record = nm_find_user_record(user, dn); - name = nm_user_record_get_display_id(user_record); - - if (!g_slist_find_custom(user->deny_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) { - rc = nm_send_create_privacy_item(user, dn, FALSE, - _create_privacy_item_deny_resp_cb, - g_strdup(name)); - } - } else { - purple_privacy_deny_remove(gc->account, (char *)node->data, TRUE); - } - } - - } - break; - - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - - /* remove users from allow list that are not in buddy list */ - copy = g_slist_copy(user->allow_list); - for (node = copy; node && node->data; node = node->next) { - if (!nm_find_contacts(user, node->data)) { - rc = nm_send_remove_privacy_item(user, (const char *)node->data, - TRUE, NULL, NULL); - if (_check_for_disconnect(user, rc)) - return; - } - } - g_slist_free(copy); - - /* add all buddies to allow list */ - num_contacts = nm_folder_get_contact_count(user->root_folder); - for (i = 0; i < num_contacts; i++) { - contact = nm_folder_get_contact(user->root_folder, i); - dn = nm_contact_get_dn(contact); - if (dn && !g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) - { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_deny_resp_cb, - g_strdup(dn)); - if (_check_for_disconnect(user, rc)) - return; - } - - } - - num_folders = nm_folder_get_subfolder_count(user->root_folder); - for (i = 0; i < num_folders; i++) { - folder = nm_folder_get_subfolder(user->root_folder, i); - num_contacts = nm_folder_get_contact_count(folder); - for (j = 0; j < num_contacts; j++) { - contact = nm_folder_get_contact(folder, j); - dn = nm_contact_get_dn(contact); - if (dn && !g_slist_find_custom(user->allow_list, - dn, (GCompareFunc)purple_utf8_strcasecmp)) - { - rc = nm_send_create_privacy_item(user, dn, TRUE, - _create_privacy_item_deny_resp_cb, - g_strdup(dn)); - if (_check_for_disconnect(user, rc)) - return; - } - } - } - - /* set to default deny */ - rc = nm_send_set_privacy_default(user, TRUE, - _set_privacy_default_resp_cb, NULL); - if (_check_for_disconnect(user, rc)) - break; - - break; - } -} - -static GList * -novell_blist_node_menu(PurpleBlistNode *node) -{ - GList *list = NULL; - PurpleMenuAction *act; - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - act = purple_menu_action_new(_("Initiate _Chat"), - PURPLE_CALLBACK(_initiate_conference_cb), - NULL, NULL); - list = g_list_append(list, act); - } - - return list; -} - -static void -novell_keepalive(PurpleConnection *gc) -{ - NMUser *user; - NMERR_T rc = NM_OK; - - if (gc == NULL) - return; - - user = gc->proto_data; - if (user == NULL) - return; - - rc = nm_send_keepalive(user, NULL, NULL); - _check_for_disconnect(user, rc); -} - -static PurplePluginProtocolInfo prpl_info = { - 0, - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec */ - novell_list_icon, /* list_icon */ - NULL, /* list_emblems */ - novell_status_text, /* status_text */ - novell_tooltip_text, /* tooltip_text */ - novell_status_types, /* status_types */ - novell_blist_node_menu, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - novell_login, /* login */ - novell_close, /* close */ - novell_send_im, /* send_im */ - NULL, /* set_info */ - novell_send_typing, /* send_typing */ - novell_get_info, /* get_info */ - novell_set_status, /* set_status */ - novell_set_idle, /* set_idle */ - NULL, /* change_passwd */ - novell_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - novell_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - novell_add_permit, /* add_permit */ - novell_add_deny, /* add_deny */ - novell_rem_permit, /* rem_permit */ - novell_rem_deny, /* rem_deny */ - novell_set_permit_deny, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - novell_chat_invite, /* chat_invite */ - novell_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - novell_chat_send, /* chat_send */ - novell_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - novell_alias_buddy, /* alias_buddy */ - novell_group_buddy, /* group_buddy */ - novell_rename_group, /* rename_group */ - NULL, /* buddy_free */ - novell_convo_closed, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - NULL, /* set_buddy_icon */ - novell_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "prpl-novell", /**< id */ - "GroupWise", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Novell GroupWise Messenger Protocol Plugin"), - /** description */ - N_("Novell GroupWise Messenger Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin * plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Server address"), "server", NULL); - prpl_info.protocol_options = - g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Server port"), "port", DEFAULT_PORT); - prpl_info.protocol_options = - g_list_append(prpl_info.protocol_options, option); - - my_protocol = plugin; -} - -PURPLE_INIT_PLUGIN(novell, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -NULLSOURCES = nullprpl.c - -AM_CFLAGS = $(st) - -libnull_la_LDFLAGS = -module -avoid-version - -# nullprpl isn't built by default. when it is built, it's dynamically linked. -st = -pkg_LTLIBRARIES = libnull.la -libnull_la_SOURCES = $(NULLSOURCES) -libnull_la_LIBADD = $(GLIB_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,716 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/null -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -libnull_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_1 = nullprpl.lo -am_libnull_la_OBJECTS = $(am__objects_1) -libnull_la_OBJECTS = $(am_libnull_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libnull_la_SOURCES) -DIST_SOURCES = $(libnull_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - README - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -NULLSOURCES = nullprpl.c -AM_CFLAGS = $(st) -libnull_la_LDFLAGS = -module -avoid-version - -# nullprpl isn't built by default. when it is built, it's dynamically linked. -st = -pkg_LTLIBRARIES = libnull.la -libnull_la_SOURCES = $(NULLSOURCES) -libnull_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/null/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/null/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libnull.la: $(libnull_la_OBJECTS) $(libnull_la_DEPENDENCIES) - $(LINK) -rpath $(pkgdir) $(libnull_la_LDFLAGS) $(libnull_la_OBJECTS) $(libnull_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nullprpl.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-pkgLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-pkgLTLIBRARIES install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libnull -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libnull -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = nullprpl.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install install_real clean - -all: $(TARGET).dll - -install_real: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -install: all - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/nullprpl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/nullprpl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/nullprpl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/nullprpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1196 +0,0 @@ -/** - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Nullprpl is a mock protocol plugin for Pidgin and libpurple. You can create - * accounts with it, sign on and off, add buddies, and send and receive IMs, - * all without connecting to a server! - * - * Beyond that basic functionality, nullprpl supports presence and - * away/available messages, offline messages, user info, typing notification, - * privacy allow/block lists, chat rooms, whispering, room lists, and protocol - * icons and emblems. Notable missing features are file transfer and account - * registration and authentication. - * - * Nullprpl is intended as an example of how to write a libpurple protocol - * plugin. It doesn't contain networking code or an event loop, but it does - * demonstrate how to use the libpurple API to do pretty much everything a prpl - * might need to do. - * - * Nullprpl is also a useful tool for hacking on Pidgin, Finch, and other - * libpurple clients. It's a full-featured protocol plugin, but doesn't depend - * on an external server, so it's a quick and easy way to exercise test new - * code. It also allows you to work while you're disconnected. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include -#include -#include - -#include - -/* If you're using this as the basis of a prpl that will be distributed - * separately from libpurple, remove the internal.h include below and replace - * it with code to include your own config.h or similar. If you're going to - * provide for translation, you'll also need to setup the gettext macros. */ -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cmds.h" -#include "conversation.h" -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "roomlist.h" -#include "status.h" -#include "util.h" -#include "version.h" - - -#define NULLPRPL_ID "prpl-null" -static PurplePlugin *_null_protocol = NULL; - -#define NULL_STATUS_ONLINE "online" -#define NULL_STATUS_AWAY "away" -#define NULL_STATUS_OFFLINE "offline" - -typedef void (*GcFunc)(PurpleConnection *from, - PurpleConnection *to, - gpointer userdata); - -typedef struct { - GcFunc fn; - PurpleConnection *from; - gpointer userdata; -} GcFuncData; - -/* - * stores offline messages that haven't been delivered yet. maps username - * (char *) to GList * of GOfflineMessages. initialized in nullprpl_init. - */ -GHashTable* goffline_messages = NULL; - -typedef struct { - char *from; - char *message; - time_t mtime; - PurpleMessageFlags flags; -} GOfflineMessage; - -/* - * helpers - */ -static PurpleConnection *get_nullprpl_gc(const char *username) { - PurpleAccount *acct = purple_accounts_find(username, NULLPRPL_ID); - if (acct && purple_account_is_connected(acct)) - return acct->gc; - else - return NULL; -} - -static void call_if_nullprpl(gpointer data, gpointer userdata) { - PurpleConnection *gc = (PurpleConnection *)(data); - GcFuncData *gcfdata = (GcFuncData *)userdata; - - if (!strcmp(gc->account->protocol_id, NULLPRPL_ID)) - gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); -} - -static void foreach_nullprpl_gc(GcFunc fn, PurpleConnection *from, - gpointer userdata) { - GcFuncData gcfdata = { fn, from, userdata }; - g_list_foreach(purple_connections_get_all(), call_if_nullprpl, - &gcfdata); -} - - -typedef void(*ChatFunc)(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata); - -typedef struct { - ChatFunc fn; - PurpleConvChat *from_chat; - gpointer userdata; -} ChatFuncData; - -static void call_chat_func(gpointer data, gpointer userdata) { - PurpleConnection *to = (PurpleConnection *)data; - ChatFuncData *cfdata = (ChatFuncData *)userdata; - - int id = cfdata->from_chat->id; - PurpleConversation *conv = purple_find_chat(to, id); - if (conv) { - PurpleConvChat *chat = purple_conversation_get_chat_data(conv); - cfdata->fn(cfdata->from_chat, chat, id, conv->name, cfdata->userdata); - } -} - -static void foreach_gc_in_chat(ChatFunc fn, PurpleConnection *from, - int id, gpointer userdata) { - PurpleConversation *conv = purple_find_chat(from, id); - ChatFuncData cfdata = { fn, - purple_conversation_get_chat_data(conv), - userdata }; - - g_list_foreach(purple_connections_get_all(), call_chat_func, - &cfdata); -} - - -static void discover_status(PurpleConnection *from, PurpleConnection *to, - gpointer userdata) { - const char *from_username = from->account->username; - const char *to_username = to->account->username; - - if (purple_find_buddy(from->account, to_username)) { - PurpleStatus *status = purple_account_get_active_status(to->account); - const char *status_id = purple_status_get_id(status); - const char *message = purple_status_get_attr_string(status, "message"); - - if (!strcmp(status_id, NULL_STATUS_ONLINE) || - !strcmp(status_id, NULL_STATUS_AWAY) || - !strcmp(status_id, NULL_STATUS_OFFLINE)) { - purple_debug_info("nullprpl", "%s sees that %s is %s: %s\n", - from_username, to_username, status_id, message); - purple_prpl_got_user_status(from->account, to_username, status_id, - (message) ? "message" : NULL, message, NULL); - } else { - purple_debug_error("nullprpl", - "%s's buddy %s has an unknown status: %s, %s", - from_username, to_username, status_id, message); - } - } -} - -static void report_status_change(PurpleConnection *from, PurpleConnection *to, - gpointer userdata) { - purple_debug_info("nullprpl", "notifying %s that %s changed status\n", - to->account->username, from->account->username); - discover_status(to, from, NULL); -} - - -/* - * UI callbacks - */ -static void nullprpl_input_user_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *)action->context; - PurpleAccount *acct = purple_connection_get_account(gc); - purple_debug_info("nullprpl", "showing 'Set User Info' dialog for %s\n", - acct->username); - - purple_account_request_change_user_info(acct); -} - -/* this is set to the actions member of the PurplePluginInfo struct at the - * bottom. - */ -static GList *nullprpl_actions(PurplePlugin *plugin, gpointer context) -{ - PurplePluginAction *action = purple_plugin_action_new( - _("Set User Info..."), nullprpl_input_user_info); - return g_list_append(NULL, action); -} - - -/* - * prpl functions - */ -static const char *nullprpl_list_icon(PurpleAccount *acct, PurpleBuddy *buddy) -{ - return "null"; -} - -static char *nullprpl_status_text(PurpleBuddy *buddy) { - purple_debug_info("nullprpl", "getting %s's status text for %s\n", - buddy->name, buddy->account->username); - - if (purple_find_buddy(buddy->account, buddy->name)) { - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - const char *name = purple_status_get_name(status); - const char *message = purple_status_get_attr_string(status, "message"); - - char *text; - if (message && strlen(message) > 0) - text = g_strdup_printf("%s: %s", name, message); - else - text = g_strdup(name); - - purple_debug_info("nullprpl", "%s's status text is %s\n", buddy->name, text); - return text; - - } else { - purple_debug_info("nullprpl", "...but %s is not logged in\n", buddy->name); - return g_strdup("Not logged in"); - } -} - -static void nullprpl_tooltip_text(PurpleBuddy *buddy, - PurpleNotifyUserInfo *info, - gboolean full) { - PurpleConnection *gc = get_nullprpl_gc(buddy->name); - - if (gc) { - /* they're logged in */ - PurplePresence *presence = purple_buddy_get_presence(buddy); - PurpleStatus *status = purple_presence_get_active_status(presence); - char *msg = nullprpl_status_text(buddy); - purple_notify_user_info_add_pair(info, purple_status_get_name(status), - msg); - g_free(msg); - - if (full) { - const char *user_info = purple_account_get_user_info(gc->account); - if (user_info) - purple_notify_user_info_add_pair(info, _("User info"), user_info); - } - - } else { - /* they're not logged in */ - purple_notify_user_info_add_pair(info, _("User info"), _("not logged in")); - } - - purple_debug_info("nullprpl", "showing %s tooltip for %s\n", - (full) ? "full" : "short", buddy->name); -} - -static GList *nullprpl_status_types(PurpleAccount *acct) -{ - GList *types = NULL; - PurpleStatusType *type; - - purple_debug_info("nullprpl", "returning status types for %s: %s, %s, %s\n", - acct->username, - NULL_STATUS_ONLINE, NULL_STATUS_AWAY, NULL_STATUS_OFFLINE); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - NULL_STATUS_ONLINE, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - NULL_STATUS_AWAY, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE, - NULL_STATUS_OFFLINE, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_prepend(types, type); - - return g_list_reverse(types); -} - -static void blist_example_menu_item(PurpleBlistNode *node, gpointer userdata) { - purple_debug_info("nullprpl", "example menu item clicked on user %s\n", - ((PurpleBuddy *)node)->name); - - purple_notify_info(NULL, /* plugin handle or PurpleConnection */ - _("Primary title"), - _("Secondary title"), - _("This is the callback for the nullprpl menu item.")); -} - -static GList *nullprpl_blist_node_menu(PurpleBlistNode *node) { - purple_debug_info("nullprpl", "providing buddy list context menu item\n"); - - if (PURPLE_BLIST_NODE_IS_BUDDY(node)) { - PurpleMenuAction *action = purple_menu_action_new( - _("Nullprpl example menu item"), - PURPLE_CALLBACK(blist_example_menu_item), - NULL, /* userdata passed to the callback */ - NULL); /* child menu items */ - return g_list_append(NULL, action); - } else { - return NULL; - } -} - -static GList *nullprpl_chat_info(PurpleConnection *gc) { - struct proto_chat_entry *pce; /* defined in prpl.h */ - - purple_debug_info("nullprpl", "returning chat setting 'room'\n"); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Chat _room"); - pce->identifier = "room"; - pce->required = TRUE; - - return g_list_append(NULL, pce); -} - -static GHashTable *nullprpl_chat_info_defaults(PurpleConnection *gc, - const char *room) { - GHashTable *defaults; - - purple_debug_info("nullprpl", "returning chat default setting " - "'room' = 'default'\n"); - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_insert(defaults, "room", g_strdup("default")); - return defaults; -} - -static void nullprpl_login(PurpleAccount *acct) -{ - PurpleConnection *gc = purple_account_get_connection(acct); - GList *offline_messages; - - purple_debug_info("nullprpl", "logging in %s\n", acct->username); - - purple_connection_update_progress(gc, _("Connecting"), - 0, /* which connection step this is */ - 2); /* total number of steps */ - - purple_connection_update_progress(gc, _("Connected"), - 1, /* which connection step this is */ - 2); /* total number of steps */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* tell purple about everyone on our buddy list who's connected */ - foreach_nullprpl_gc(discover_status, gc, NULL); - - /* notify other nullprpl accounts */ - foreach_nullprpl_gc(report_status_change, gc, NULL); - - /* fetch stored offline messages */ - purple_debug_info("nullprpl", "checking for offline messages for %s\n", - acct->username); - offline_messages = g_hash_table_lookup(goffline_messages, acct->username); - while (offline_messages) { - GOfflineMessage *message = (GOfflineMessage *)offline_messages->data; - purple_debug_info("nullprpl", "delivering offline message to %s: %s\n", - acct->username, message->message); - serv_got_im(gc, message->from, message->message, message->flags, - message->mtime); - offline_messages = g_list_next(offline_messages); - - g_free(message->from); - g_free(message->message); - g_free(message); - } - - g_list_free(offline_messages); - g_hash_table_remove(goffline_messages, &acct->username); -} - -static void nullprpl_close(PurpleConnection *gc) -{ - /* notify other nullprpl accounts */ - foreach_nullprpl_gc(report_status_change, gc, NULL); -} - -static int nullprpl_send_im(PurpleConnection *gc, const char *who, - const char *message, PurpleMessageFlags flags) -{ - const char *from_username = gc->account->username; - PurpleMessageFlags receive_flags = ((flags & ~PURPLE_MESSAGE_SEND) - | PURPLE_MESSAGE_RECV); - PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); - PurpleConnection *to; - - purple_debug_info("nullprpl", "sending message from %s to %s: %s\n", - from_username, who, message); - - /* is the sender blocked by the recipient's privacy settings? */ - if (to_acct && !purple_privacy_check(to_acct, gc->account->username)) { - char *msg = g_strdup_printf( - _("Your message was blocked by %s's privacy settings."), who); - purple_debug_info("nullprpl", - "discarding; %s is blocked by %s's privacy settings\n", - from_username, who); - purple_conv_present_error(who, gc->account, msg); - g_free(msg); - return 0; - } - - /* is the recipient online? */ - to = get_nullprpl_gc(who); - if (to) { /* yes, send */ - serv_got_im(to, from_username, message, receive_flags, time(NULL)); - - } else { /* nope, store as an offline message */ - GOfflineMessage *offline_message; - GList *messages; - - purple_debug_info("nullprpl", - "%s is offline, sending as offline message\n", who); - offline_message = g_new0(GOfflineMessage, 1); - offline_message->from = g_strdup(from_username); - offline_message->message = g_strdup(message); - offline_message->mtime = time(NULL); - offline_message->flags = receive_flags; - - messages = g_hash_table_lookup(goffline_messages, who); - messages = g_list_append(messages, offline_message); - g_hash_table_insert(goffline_messages, g_strdup(who), messages); - } - - return 1; -} - -static void nullprpl_set_info(PurpleConnection *gc, const char *info) { - purple_debug_info("nullprpl", "setting %s's user info to %s\n", - gc->account->username, info); -} - -static const char *typing_state_to_string(PurpleTypingState typing) { - switch (typing) { - case PURPLE_NOT_TYPING: return "is not typing"; - case PURPLE_TYPING: return "is typing"; - case PURPLE_TYPED: return "stopped typing momentarily"; - default: return "unknown typing state"; - } -} - -static void notify_typing(PurpleConnection *from, PurpleConnection *to, - gpointer typing) { - const char *from_username = from->account->username; - const char *action = typing_state_to_string((PurpleTypingState)typing); - purple_debug_info("nullprpl", "notifying %s that %s %s\n", - to->account->username, from_username, action); - - serv_got_typing(to, - from_username, - 0, /* if non-zero, a timeout in seconds after which to - * reset the typing status to PURPLE_NOT_TYPING */ - (PurpleTypingState)typing); -} - -static unsigned int nullprpl_send_typing(PurpleConnection *gc, const char *name, - PurpleTypingState typing) { - purple_debug_info("nullprpl", "%s %s\n", gc->account->username, - typing_state_to_string(typing)); - foreach_nullprpl_gc(notify_typing, gc, (gpointer)typing); - return 0; -} - -static void nullprpl_get_info(PurpleConnection *gc, const char *username) { - const char *body; - PurpleNotifyUserInfo *info = purple_notify_user_info_new(); - PurpleAccount *acct; - - purple_debug_info("nullprpl", "Fetching %s's user info for %s\n", username, - gc->account->username); - - if (!get_nullprpl_gc(username)) { - char *msg = g_strdup_printf(_("%s is not logged in."), username); - purple_notify_error(gc, _("User Info"), _("User info not available. "), msg); - g_free(msg); - } - - acct = purple_accounts_find(username, NULLPRPL_ID); - if (acct) - body = purple_account_get_user_info(acct); - else - body = _("No user info."); - purple_notify_user_info_add_pair(info, "Info", body); - - /* show a buddy's user info in a nice dialog box */ - purple_notify_userinfo(gc, /* connection the buddy info came through */ - username, /* buddy's username */ - info, /* body */ - NULL, /* callback called when dialog closed */ - NULL); /* userdata for callback */ -} - -static void nullprpl_set_status(PurpleAccount *acct, PurpleStatus *status) { - const char *msg = purple_status_get_attr_string(status, "message"); - purple_debug_info("nullprpl", "setting %s's status to %s: %s\n", - acct->username, purple_status_get_name(status), msg); - - foreach_nullprpl_gc(report_status_change, get_nullprpl_gc(acct->username), - NULL); -} - -static void nullprpl_set_idle(PurpleConnection *gc, int idletime) { - purple_debug_info("nullprpl", - "purple reports that %s has been idle for %d seconds\n", - gc->account->username, idletime); -} - -static void nullprpl_change_passwd(PurpleConnection *gc, const char *old_pass, - const char *new_pass) { - purple_debug_info("nullprpl", "%s wants to change their password\n", - gc->account->username); -} - -static void nullprpl_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - const char *username = gc->account->username; - PurpleConnection *buddy_gc = get_nullprpl_gc(buddy->name); - - purple_debug_info("nullprpl", "adding %s to %s's buddy list\n", buddy->name, - username); - - if (buddy_gc) { - PurpleAccount *buddy_acct = buddy_gc->account; - - discover_status(gc, buddy_gc, NULL); - - if (purple_find_buddy(buddy_acct, username)) { - purple_debug_info("nullprpl", "%s is already on %s's buddy list\n", - username, buddy->name); - } else { - purple_debug_info("nullprpl", "asking %s if they want to add %s\n", - buddy->name, username); - purple_account_request_add(buddy_acct, - username, - NULL, /* local account id (rarely used) */ - NULL, /* alias */ - NULL); /* message */ - } - } -} - -static void nullprpl_add_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { - GList *buddy = buddies; - GList *group = groups; - - purple_debug_info("nullprpl", "adding multiple buddies\n"); - - while (buddy && group) { - nullprpl_add_buddy(gc, (PurpleBuddy *)buddy->data, (PurpleGroup *)group->data); - buddy = g_list_next(buddy); - group = g_list_next(group); - } -} - -static void nullprpl_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - purple_debug_info("nullprpl", "removing %s from %s's buddy list\n", - buddy->name, gc->account->username); -} - -static void nullprpl_remove_buddies(PurpleConnection *gc, GList *buddies, - GList *groups) { - GList *buddy = buddies; - GList *group = groups; - - purple_debug_info("nullprpl", "removing multiple buddies\n"); - - while (buddy && group) { - nullprpl_remove_buddy(gc, (PurpleBuddy *)buddy->data, - (PurpleGroup *)group->data); - buddy = g_list_next(buddy); - group = g_list_next(group); - } -} - -/* - * nullprpl uses purple's local whitelist and blacklist, stored in blist.xml, as - * its authoritative privacy settings, and uses purple's logic (specifically - * purple_privacy_check(), from privacy.h), to determine whether messages are - * allowed or blocked. - */ -static void nullprpl_add_permit(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s adds %s to their allowed list\n", - gc->account->username, name); -} - -static void nullprpl_add_deny(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s adds %s to their blocked list\n", - gc->account->username, name); -} - -static void nullprpl_rem_permit(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s removes %s from their allowed list\n", - gc->account->username, name); -} - -static void nullprpl_rem_deny(PurpleConnection *gc, const char *name) { - purple_debug_info("nullprpl", "%s removes %s from their blocked list\n", - gc->account->username, name); -} - -static void nullprpl_set_permit_deny(PurpleConnection *gc) { - /* this is for synchronizing the local black/whitelist with the server. - * for nullprpl, it's a noop. - */ -} - -static void joined_chat(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - /* tell their chat window that we joined */ - purple_debug_info("nullprpl", "%s sees that %s joined chat room %s\n", - to->nick, from->nick, room); - purple_conv_chat_add_user(to, - from->nick, - NULL, /* user-provided join message, IRC style */ - PURPLE_CBFLAGS_NONE, - TRUE); /* show a join message */ - - if (from != to) { - /* add them to our chat window */ - purple_debug_info("nullprpl", "%s sees that %s is in chat room %s\n", - from->nick, to->nick, room); - purple_conv_chat_add_user(from, - to->nick, - NULL, /* user-provided join message, IRC style */ - PURPLE_CBFLAGS_NONE, - FALSE); /* show a join message */ - } -} - -static void nullprpl_join_chat(PurpleConnection *gc, GHashTable *components) { - const char *username = gc->account->username; - const char *room = g_hash_table_lookup(components, "room"); - int chat_id = g_str_hash(room); - purple_debug_info("nullprpl", "%s is joining chat room %s\n", username, room); - - if (!purple_find_chat(gc, chat_id)) { - serv_got_joined_chat(gc, chat_id, room); - - /* tell everyone that we joined, and add them if they're already there */ - foreach_gc_in_chat(joined_chat, gc, chat_id, NULL); - } else { - char *tmp = g_strdup_printf(_("%s is already in chat room %s."), - username, - room); - purple_debug_info("nullprpl", "%s is already in chat room %s\n", username, - room); - purple_notify_info(gc, _("Join chat"), _("Join chat"), tmp); - g_free(tmp); - } -} - -static void nullprpl_reject_chat(PurpleConnection *gc, GHashTable *components) { - const char *invited_by = g_hash_table_lookup(components, "invited_by"); - const char *room = g_hash_table_lookup(components, "room"); - const char *username = gc->account->username; - PurpleConnection *invited_by_gc = get_nullprpl_gc(invited_by); - char *message = g_strdup_printf( - "%s %s %s.", - username, - _("has rejected your invitation to join the chat room"), - room); - - purple_debug_info("nullprpl", - "%s has rejected %s's invitation to join chat room %s\n", - username, invited_by, room); - - purple_notify_info(invited_by_gc, - _("Chat invitation rejected"), - _("Chat invitation rejected"), - message); - g_free(message); -} - -static char *nullprpl_get_chat_name(GHashTable *components) { - const char *room = g_hash_table_lookup(components, "room"); - purple_debug_info("nullprpl", "reporting chat room name '%s'\n", room); - return g_strdup(room); -} - -static void nullprpl_chat_invite(PurpleConnection *gc, int id, - const char *message, const char *who) { - const char *username = gc->account->username; - PurpleConversation *conv = purple_find_chat(gc, id); - const char *room = conv->name; - PurpleAccount *to_acct = purple_accounts_find(who, NULLPRPL_ID); - - purple_debug_info("nullprpl", "%s is inviting %s to join chat room %s\n", - username, who, room); - - if (to_acct) { - PurpleConversation *to_conv = purple_find_chat(to_acct->gc, id); - if (to_conv) { - char *tmp = g_strdup_printf("%s is already in chat room %s.", who, room); - purple_debug_info("nullprpl", - "%s is already in chat room %s; " - "ignoring invitation from %s\n", - who, room, username); - purple_notify_info(gc, _("Chat invitation"), _("Chat invitation"), tmp); - g_free(tmp); - } else { - GHashTable *components; - components = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_replace(components, "room", g_strdup(room)); - g_hash_table_replace(components, "invited_by", g_strdup(username)); - serv_got_chat_invite(to_acct->gc, room, username, message, components); - } - } -} - -static void left_chat_room(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - if (from != to) { - /* tell their chat window that we left */ - purple_debug_info("nullprpl", "%s sees that %s left chat room %s\n", - to->nick, from->nick, room); - purple_conv_chat_remove_user(to, - from->nick, - NULL); /* user-provided message, IRC style */ - } -} - -static void nullprpl_chat_leave(PurpleConnection *gc, int id) { - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("nullprpl", "%s is leaving chat room %s\n", - gc->account->username, conv->name); - - /* tell everyone that we left */ - foreach_gc_in_chat(left_chat_room, gc, id, NULL); -} - -static PurpleCmdRet send_whisper(PurpleConversation *conv, const gchar *cmd, - gchar **args, gchar **error, void *userdata) { - const char *to_username; - const char *message; - const char *from_username; - PurpleConvChat *chat; - PurpleConvChatBuddy *chat_buddy; - PurpleConnection *to; - - /* parse args */ - to_username = args[0]; - message = args[1]; - - if (!to_username || strlen(to_username) == 0) { - *error = g_strdup(_("Whisper is missing recipient.")); - return PURPLE_CMD_RET_FAILED; - } else if (!message || strlen(message) == 0) { - *error = g_strdup(_("Whisper is missing message.")); - return PURPLE_CMD_RET_FAILED; - } - - from_username = conv->account->username; - purple_debug_info("nullprpl", "%s whispers to %s in chat room %s: %s\n", - from_username, to_username, conv->name, message); - - chat = purple_conversation_get_chat_data(conv); - chat_buddy = purple_conv_chat_cb_find(chat, to_username); - to = get_nullprpl_gc(to_username); - - if (!chat_buddy) { - /* this will be freed by the caller */ - *error = g_strdup_printf(_("%s is not logged in."), to_username); - return PURPLE_CMD_RET_FAILED; - } else if (!to) { - *error = g_strdup_printf(_("%s is not in this chat room."), to_username); - return PURPLE_CMD_RET_FAILED; - } else { - /* write the whisper in the sender's chat window */ - char *message_to = g_strdup_printf("%s (to %s)", message, to_username); - purple_conv_chat_write(chat, from_username, message_to, - PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_WHISPER, - time(NULL)); - g_free(message_to); - - /* send the whisper */ - serv_chat_whisper(to, chat->id, from_username, message); - - return PURPLE_CMD_RET_OK; - } -} - -static void nullprpl_chat_whisper(PurpleConnection *gc, int id, const char *who, - const char *message) { - const char *username = gc->account->username; - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("nullprpl", - "%s receives whisper from %s in chat room %s: %s\n", - username, who, conv->name, message); - - /* receive whisper on recipient's account */ - serv_got_chat_in(gc, id, who, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_WHISPER, - message, time(NULL)); -} - -static void receive_chat_message(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - const char *message = (const char *)userdata; - PurpleConnection *to_gc = get_nullprpl_gc(to->nick); - - purple_debug_info("nullprpl", - "%s receives message from %s in chat room %s: %s\n", - to->nick, from->nick, room, message); - serv_got_chat_in(to_gc, id, from->nick, PURPLE_MESSAGE_RECV, message, - time(NULL)); -} - -static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message, - PurpleMessageFlags flags) { - const char *username = gc->account->username; - PurpleConversation *conv = purple_find_chat(gc, id); - - if (conv) { - purple_debug_info("nullprpl", - "%s is sending message to chat room %s: %s\n", username, - conv->name, message); - - /* send message to everyone in the chat room */ - foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message); - return 0; - } else { - purple_debug_info("nullprpl", - "tried to send message from %s to chat room #%d: %s\n" - "but couldn't find chat room", - username, id, message); - return -1; - } -} - -static void nullprpl_register_user(PurpleAccount *acct) { - purple_debug_info("nullprpl", "registering account for %s\n", - acct->username); -} - -static void nullprpl_get_cb_info(PurpleConnection *gc, int id, const char *who) { - PurpleConversation *conv = purple_find_chat(gc, id); - purple_debug_info("nullprpl", - "retrieving %s's info for %s in chat room %s\n", who, - gc->account->username, conv->name); - - nullprpl_get_info(gc, who); -} - -static void nullprpl_alias_buddy(PurpleConnection *gc, const char *who, - const char *alias) { - purple_debug_info("nullprpl", "%s sets %s's alias to %s\n", - gc->account->username, who, alias); -} - -static void nullprpl_group_buddy(PurpleConnection *gc, const char *who, - const char *old_group, - const char *new_group) { - purple_debug_info("nullprpl", "%s has moved %s from group %s to group %s\n", - gc->account->username, who, old_group, new_group); -} - -static void nullprpl_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) { - purple_debug_info("nullprpl", "%s has renamed group %s to %s\n", - gc->account->username, old_name, group->name); -} - -static void nullprpl_convo_closed(PurpleConnection *gc, const char *who) { - purple_debug_info("nullprpl", "%s's conversation with %s was closed\n", - gc->account->username, who); -} - -/* normalize a username (e.g. remove whitespace, add default domain, etc.) - * for nullprpl, this is a noop. - */ -static const char *nullprpl_normalize(const PurpleAccount *acct, - const char *input) { - return NULL; -} - -static void nullprpl_set_buddy_icon(PurpleConnection *gc, - PurpleStoredImage *img) { - purple_debug_info("nullprpl", "setting %s's buddy icon to %s\n", - gc->account->username, - img ? purple_imgstore_get_filename(img) : "(null)"); -} - -static void nullprpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { - purple_debug_info("nullprpl", "%s has removed group %s\n", - gc->account->username, group->name); -} - - -static void set_chat_topic_fn(PurpleConvChat *from, PurpleConvChat *to, - int id, const char *room, gpointer userdata) { - const char *topic = (const char *)userdata; - const char *username = from->conv->account->username; - char *msg; - - purple_conv_chat_set_topic(to, username, topic); - - if (topic && strlen(topic) > 0) - msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); - else - msg = g_strdup_printf(_("%s clears topic"), username); - - purple_conv_chat_write(to, username, msg, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, - time(NULL)); - g_free(msg); -} - -static void nullprpl_set_chat_topic(PurpleConnection *gc, int id, - const char *topic) { - PurpleConversation *conv = purple_find_chat(gc, id); - PurpleConvChat *chat = purple_conversation_get_chat_data(conv); - const char *last_topic; - - if (!chat) - return; - - purple_debug_info("nullprpl", "%s sets topic of chat room '%s' to '%s'\n", - gc->account->username, conv->name, topic); - - last_topic = purple_conv_chat_get_topic(chat); - if ((!topic && !last_topic) || - (topic && last_topic && !strcmp(topic, last_topic))) - return; /* topic is unchanged, this is a noop */ - - foreach_gc_in_chat(set_chat_topic_fn, gc, id, (gpointer)topic); -} - -static gboolean nullprpl_finish_get_roomlist(gpointer roomlist) { - purple_roomlist_set_in_progress((PurpleRoomlist *)roomlist, FALSE); - return FALSE; -} - -static PurpleRoomlist *nullprpl_roomlist_get_list(PurpleConnection *gc) { - const char *username = gc->account->username; - PurpleRoomlist *roomlist = purple_roomlist_new(gc->account); - GList *fields = NULL; - PurpleRoomlistField *field; - GList *chats; - GList *seen_ids = NULL; - - purple_debug_info("nullprpl", "%s asks for room list; returning:\n", username); - - /* set up the room list */ - field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "room", - "room", TRUE /* hidden */); - fields = g_list_append(fields, field); - - field = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, "Id", "Id", FALSE); - fields = g_list_append(fields, field); - - purple_roomlist_set_fields(roomlist, fields); - - /* add each chat room. the chat ids are cached in seen_ids so that each room - * is only returned once, even if multiple users are in it. */ - for (chats = purple_get_chats(); chats; chats = g_list_next(chats)) { - PurpleConversation *conv = (PurpleConversation *)chats->data; - PurpleRoomlistRoom *room; - const char *name = conv->name; - int id = purple_conversation_get_chat_data(conv)->id; - - /* have we already added this room? */ - if (g_list_find_custom(seen_ids, name, (GCompareFunc)strcmp)) - continue; /* yes! try the next one. */ - - /* This cast is OK because this list is only staying around for the life - * of this function and none of the conversations are being deleted - * in that timespan. */ - seen_ids = g_list_prepend(seen_ids, (char *)name); /* no, it's new. */ - purple_debug_info("nullprpl", "%s (%d), ", name, id); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(roomlist, room, name); - purple_roomlist_room_add_field(roomlist, room, &id); - purple_roomlist_room_add(roomlist, room); - } - - g_list_free(seen_ids); - purple_timeout_add(1 /* ms */, nullprpl_finish_get_roomlist, roomlist); - return roomlist; -} - -static void nullprpl_roomlist_cancel(PurpleRoomlist *list) { - purple_debug_info("nullprpl", "%s asked to cancel room list request\n", - list->account->username); -} - -static void nullprpl_roomlist_expand_category(PurpleRoomlist *list, - PurpleRoomlistRoom *category) { - purple_debug_info("nullprpl", "%s asked to expand room list category %s\n", - list->account->username, category->name); -} - -/* nullprpl doesn't support file transfer...yet... */ -static gboolean nullprpl_can_receive_file(PurpleConnection *gc, - const char *who) { - return FALSE; -} - -static gboolean nullprpl_offline_message(const PurpleBuddy *buddy) { - purple_debug_info("nullprpl", - "reporting that offline messages are supported for %s\n", - buddy->name); - return TRUE; -} - - -/* - * prpl stuff. see prpl.h for more information. - */ - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_NO_PASSWORD | OPT_PROTO_CHAT_TOPIC, /* options */ - NULL, /* user_splits, initialized in nullprpl_init() */ - NULL, /* protocol_options, initialized in nullprpl_init() */ - { /* icon_spec, a PurpleBuddyIconSpec */ - "png,jpg,gif", /* format */ - 0, /* min_width */ - 0, /* min_height */ - 128, /* max_width */ - 128, /* max_height */ - 10000, /* max_filesize */ - PURPLE_ICON_SCALE_DISPLAY, /* scale_rules */ - }, - nullprpl_list_icon, /* list_icon */ - NULL, /* list_emblem */ - nullprpl_status_text, /* status_text */ - nullprpl_tooltip_text, /* tooltip_text */ - nullprpl_status_types, /* status_types */ - nullprpl_blist_node_menu, /* blist_node_menu */ - nullprpl_chat_info, /* chat_info */ - nullprpl_chat_info_defaults, /* chat_info_defaults */ - nullprpl_login, /* login */ - nullprpl_close, /* close */ - nullprpl_send_im, /* send_im */ - nullprpl_set_info, /* set_info */ - nullprpl_send_typing, /* send_typing */ - nullprpl_get_info, /* get_info */ - nullprpl_set_status, /* set_status */ - nullprpl_set_idle, /* set_idle */ - nullprpl_change_passwd, /* change_passwd */ - nullprpl_add_buddy, /* add_buddy */ - nullprpl_add_buddies, /* add_buddies */ - nullprpl_remove_buddy, /* remove_buddy */ - nullprpl_remove_buddies, /* remove_buddies */ - nullprpl_add_permit, /* add_permit */ - nullprpl_add_deny, /* add_deny */ - nullprpl_rem_permit, /* rem_permit */ - nullprpl_rem_deny, /* rem_deny */ - nullprpl_set_permit_deny, /* set_permit_deny */ - nullprpl_join_chat, /* join_chat */ - nullprpl_reject_chat, /* reject_chat */ - nullprpl_get_chat_name, /* get_chat_name */ - nullprpl_chat_invite, /* chat_invite */ - nullprpl_chat_leave, /* chat_leave */ - nullprpl_chat_whisper, /* chat_whisper */ - nullprpl_chat_send, /* chat_send */ - NULL, /* keepalive */ - nullprpl_register_user, /* register_user */ - nullprpl_get_cb_info, /* get_cb_info */ - NULL, /* get_cb_away */ - nullprpl_alias_buddy, /* alias_buddy */ - nullprpl_group_buddy, /* group_buddy */ - nullprpl_rename_group, /* rename_group */ - NULL, /* buddy_free */ - nullprpl_convo_closed, /* convo_closed */ - nullprpl_normalize, /* normalize */ - nullprpl_set_buddy_icon, /* set_buddy_icon */ - nullprpl_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - nullprpl_set_chat_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - nullprpl_roomlist_get_list, /* roomlist_get_list */ - nullprpl_roomlist_cancel, /* roomlist_cancel */ - nullprpl_roomlist_expand_category, /* roomlist_expand_category */ - nullprpl_can_receive_file, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - nullprpl_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static void nullprpl_init(PurplePlugin *plugin) -{ - /* see accountopt.h for information about user splits and protocol options */ - PurpleAccountUserSplit *split = purple_account_user_split_new( - _("Example user split"), /* text shown to user */ - "default", /* default value */ - '@'); /* field separator */ - PurpleAccountOption *option = purple_account_option_string_new( - _("Example option"), /* text shown to user */ - "example", /* pref name */ - "default"); /* default value */ - - purple_debug_info("nullprpl", "starting up\n"); - - prpl_info.user_splits = g_list_append(NULL, split); - prpl_info.protocol_options = g_list_append(NULL, option); - - /* register whisper chat command, /msg */ - purple_cmd_register("msg", - "ws", /* args: recipient and message */ - PURPLE_CMD_P_DEFAULT, /* priority */ - PURPLE_CMD_FLAG_CHAT, - "prpl-null", - send_whisper, - "msg <username> <message>: send a private message, aka a whisper", - NULL); /* userdata */ - - /* get ready to store offline messages */ - goffline_messages = g_hash_table_new_full(g_str_hash, /* hash fn */ - g_str_equal, /* key comparison fn */ - g_free, /* key free fn */ - NULL); /* value free fn */ - - _null_protocol = plugin; -} - -static void nullprpl_destroy(PurplePlugin *plugin) { - purple_debug_info("nullprpl", "shutting down\n"); -} - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, /* magic */ - PURPLE_MAJOR_VERSION, /* major_version */ - PURPLE_MINOR_VERSION, /* minor_version */ - PURPLE_PLUGIN_PROTOCOL, /* type */ - NULL, /* ui_requirement */ - 0, /* flags */ - NULL, /* dependencies */ - PURPLE_PRIORITY_DEFAULT, /* priority */ - NULLPRPL_ID, /* id */ - "Null - Testing Plugin", /* name */ - DISPLAY_VERSION, /* version */ - N_("Null Protocol Plugin"), /* summary */ - N_("Null Protocol Plugin"), /* description */ - NULL, /* author */ - PURPLE_WEBSITE, /* homepage */ - NULL, /* load */ - NULL, /* unload */ - nullprpl_destroy, /* destroy */ - NULL, /* ui_info */ - &prpl_info, /* extra_info */ - NULL, /* prefs_info */ - nullprpl_actions, /* actions */ - NULL, /* padding... */ - NULL, - NULL, - NULL, -}; - -PURPLE_INIT_PLUGIN(null, nullprpl_init, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/null/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -nullprpl - --------- -OVERVIEW --------- -Nullprpl is a mock protocol plugin for Pidgin and libpurple. You can create -accounts with it, sign on and off, add buddies, and send and receive IMs, all -without connecting to a server! - -Beyond that basic functionality, nullprpl supports presence and away/available -messages, offline messages, user info, typing notification, privacy -allow/block lists, chat rooms, whispering, room lists, and protocol icons and -emblems. Notable missing features are file transfer and account registration -and authentication. - -Nullprpl is intended as an example of how to write a libpurple protocol -plugin. It doesn't contain networking code or an event loop, but it does -demonstrate how to use the libpurple API to do pretty much everything a prpl -might need to do. - -Nullprpl is also a useful tool for hacking on Pidgin, Finch, and other -libpurple clients. It's a full-featured protocol plugin, but doesn't depend on -an external server, so it's a quick and easy way to exercise test new code. It -also allows you to work while you're disconnected. - ------------------------ -BUILDING AND INSTALLING ------------------------ - -To build, just run ./configure as usual in the root directory of the pidgin -source distribution. Then cd libpurple/protocols/null and then make. To -install, run make install. Then run Pidgin. - -To build nullprpl on Windows (with Cygwin/MinGW), use: make -f Makefile.mingw - ------ -USAGE ------ -To add a nullprpl account, go to the account editor window and click Add. -Select Nullprpl from the protocol drop-down list, and enter any username you -want. - -Now, use Pidgin like normal. You can add buddies, send IMs, set away messages, -etc. If you send IMs to your own username, they will be echoed back to you. - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/AUTHORS qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/AUTHORS --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/AUTHORS 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/AUTHORS 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ - -N: ComBOTS Product GmbH (htfv) -T: 2007 -E: foss@combots.com - -N: Jonathan Clark -T: 2005-2006 -E: ardentlygnarley a.t users d.o.t sourceforge d.o.t net - -N: Mark Doliner -T: 2001-2006 -H: markdoliner -E: thekingant a.t users d.o.t sourceforge d.o.t net -W: http://kingant.net/ - -N: Adam Fritzler -T: 1998-2001 -H: mid -E: mid a.t auk d.o.t cx -W: http://www.auk.cx/~mid,http://www.auk.cx/faim -D: Wrote most of the wap of crap that you see before you. - -N: Josh Myer -T: 1998-2001 -E: josh a.t joshisanerd d.o.t com -D: OFT/ODC (not quite finished yet..), random little things, Munger-At-Large, compile-time warnings. - -N: Daniel M. Pomerantz -H: dmprantz -D: Made initial versions cross platform - -N: Daniel Reed -T: 1998-2001 -H: n, linuxkitty -E: n a.t ml d.o.t org -W: http://users.n.ml.org/n/ -D: Fixed aim_snac.c - -N: Eric Warmenhoven -T: 1998-2001 -E: warmenhoven a.t linux d.o.t com -D: Some OFT info, initial author of the libpurple-side of the oscar protocol plugin - -N: Brock Wilcox -T: 1998-2001 -H: awwaiid -E: awwaiid a.t auk d.o.t cx -D: Figured out original password roasting - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/bstream.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/bstream.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/bstream.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/bstream.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,351 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * This file contains all functions needed to use bstreams. - */ - -#include "oscar.h" - -int byte_stream_new(ByteStream *bs, guint32 len) -{ - if (bs == NULL) - return -1; - - return byte_stream_init(bs, g_malloc(len), len); -} - -int byte_stream_init(ByteStream *bs, guint8 *data, int len) -{ - - if (bs == NULL) - return -1; - - bs->data = data; - bs->len = len; - bs->offset = 0; - - return 0; -} - -void byte_stream_destroy(ByteStream *bs) -{ - g_free(bs->data); -} - -int byte_stream_empty(ByteStream *bs) -{ - return bs->len - bs->offset; -} - -int byte_stream_curpos(ByteStream *bs) -{ - return bs->offset; -} - -int byte_stream_setpos(ByteStream *bs, unsigned int off) -{ - - if (off > bs->len) - return -1; - - bs->offset = off; - - return off; -} - -void byte_stream_rewind(ByteStream *bs) -{ - - byte_stream_setpos(bs, 0); - - return; -} - -/* - * N can be negative, which can be used for going backwards - * in a bstream. I'm not sure if libfaim actually does - * this anywhere... - */ -int byte_stream_advance(ByteStream *bs, int n) -{ - - if ((byte_stream_curpos(bs) + n < 0) || (byte_stream_empty(bs) < n)) - return 0; /* XXX throw an exception */ - - bs->offset += n; - - return n; -} - -guint8 byte_stream_get8(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset++; - - return aimutil_get8(bs->data + bs->offset - 1); -} - -guint16 byte_stream_get16(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += 2; - - return aimutil_get16(bs->data + bs->offset - 2); -} - -guint32 byte_stream_get32(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += 4; - - return aimutil_get32(bs->data + bs->offset - 4); -} - -guint8 byte_stream_getle8(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset++; - - return aimutil_getle8(bs->data + bs->offset - 1); -} - -guint16 byte_stream_getle16(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += 2; - - return aimutil_getle16(bs->data + bs->offset - 2); -} - -guint32 byte_stream_getle32(ByteStream *bs) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += 4; - - return aimutil_getle32(bs->data + bs->offset - 4); -} - -static void byte_stream_getrawbuf_nocheck(ByteStream *bs, guint8 *buf, int len) -{ - memcpy(buf, bs->data + bs->offset, len); - bs->offset += len; -} - -int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len) -{ - - if (byte_stream_empty(bs) < len) - return 0; - - byte_stream_getrawbuf_nocheck(bs, buf, len); - return len; -} - -guint8 *byte_stream_getraw(ByteStream *bs, int len) -{ - guint8 *ob; - - if (byte_stream_empty(bs) < len) - return NULL; - - ob = g_malloc(len); - - byte_stream_getrawbuf_nocheck(bs, ob, len); - - return ob; -} - -char *byte_stream_getstr(ByteStream *bs, int len) -{ - char *ob; - - if (byte_stream_empty(bs) < len) - return NULL; - - ob = g_malloc(len + 1); - - byte_stream_getrawbuf_nocheck(bs, (guint8 *)ob, len); - - ob[len] = '\0'; - - return ob; -} - -int byte_stream_put8(ByteStream *bs, guint8 v) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_put8(bs->data + bs->offset, v); - - return 1; -} - -int byte_stream_put16(ByteStream *bs, guint16 v) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_put16(bs->data + bs->offset, v); - - return 2; -} - -int byte_stream_put32(ByteStream *bs, guint32 v) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_put32(bs->data + bs->offset, v); - - return 1; -} - -int byte_stream_putle8(ByteStream *bs, guint8 v) -{ - - if (byte_stream_empty(bs) < 1) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_putle8(bs->data + bs->offset, v); - - return 1; -} - -int byte_stream_putle16(ByteStream *bs, guint16 v) -{ - - if (byte_stream_empty(bs) < 2) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_putle16(bs->data + bs->offset, v); - - return 2; -} - -int byte_stream_putle32(ByteStream *bs, guint32 v) -{ - - if (byte_stream_empty(bs) < 4) - return 0; /* XXX throw an exception */ - - bs->offset += aimutil_putle32(bs->data + bs->offset, v); - - return 1; -} - - -int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len) -{ - - if (byte_stream_empty(bs) < len) - return 0; /* XXX throw an exception */ - - memcpy(bs->data + bs->offset, v, len); - bs->offset += len; - - return len; -} - -int byte_stream_putstr(ByteStream *bs, const char *str) -{ - return byte_stream_putraw(bs, (guint8 *)str, strlen(str)); -} - -int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len) -{ - - if (byte_stream_empty(srcbs) < len) - return 0; /* XXX throw exception (underrun) */ - - if (byte_stream_empty(bs) < len) - return 0; /* XXX throw exception (overflow) */ - - memcpy(bs->data + bs->offset, srcbs->data + srcbs->offset, len); - bs->offset += len; - srcbs->offset += len; - - return len; -} - -int byte_stream_putuid(ByteStream *bs, OscarData *od) -{ - PurpleAccount *account; - - account = purple_connection_get_account(od->gc); - - return byte_stream_putle32(bs, atoi(purple_account_get_username(account))); -} - -void byte_stream_put_bart_asset(ByteStream *bs, guint16 type, ByteStream *data) -{ - byte_stream_put16(bs, type); - - if (data != NULL && data->len > 0) { - /* Flags. 0x04 means "this asset has data attached to it" */ - byte_stream_put8(bs, 0x04); /* Flags */ - byte_stream_put8(bs, data->len); /* Length */ - byte_stream_rewind(data); - byte_stream_putbs(bs, data, data->len); /* Data */ - } else { - byte_stream_put8(bs, 0x00); /* No flags */ - byte_stream_put8(bs, 0x00); /* Length */ - /* No data */ - } -} - -void byte_stream_put_bart_asset_str(ByteStream *bs, guint16 type, const char *datastr) -{ - ByteStream data; - size_t len = datastr != NULL ? strlen(datastr) : 0; - - if (len > 0) { - byte_stream_new(&data, 2 + len + 2); - byte_stream_put16(&data, len); /* Length */ - byte_stream_putstr(&data, datastr); /* String */ - byte_stream_put16(&data, 0x0000); /* Unknown */ - byte_stream_put_bart_asset(bs, type, &data); - byte_stream_destroy(&data); - } else { - byte_stream_put_bart_asset(bs, type, NULL); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/clientlogin.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/clientlogin.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/clientlogin.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/clientlogin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,580 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/** - * This file implements AIM's clientLogin procedure for authenticating - * users. This replaces the older MD5-based and XOR-based - * authentication methods that use SNAC family 0x0017. - * - * This doesn't use SNACs or FLAPs at all. It makes http and https - * POSTs to AOL to validate the user based on the password they - * provided to us. Upon successful authentication we request a - * connection to the BOS server by calling startOSCARsession. The - * AOL server gives us the hostname and port number to use, as well - * as the cookie to use to authenticate to the BOS server. And then - * everything else is the same as with BUCP. - * - * For details, see: - * http://dev.aol.com/aim/oscar/#AUTH - * http://dev.aol.com/authentication_for_clients - */ - -#include "oscar.h" -#include "oscarcommon.h" - -#include "cipher.h" -#include "core.h" - -#define URL_CLIENT_LOGIN "https://api.screenname.aol.com/auth/clientLogin" -#define URL_START_OSCAR_SESSION "http://api.oscar.aol.com/aim/startOSCARSession" - -/* - * Using clientLogin requires a developer ID. This key is for libpurple. - * It is the default key for all libpurple-based clients. AOL encourages - * UIs (especially ones with lots of users) to override this with their - * own key. This key is owned by the AIM account "markdoliner" - * - * Keys can be managed at http://developer.aim.com/manageKeys.jsp - */ -#define DEFAULT_CLIENT_KEY "ma15d7JTxbmVG-RP" - -static const char *get_client_key(OscarData *od) -{ - return oscar_get_ui_info_string( - od->icq ? "prpl-icq-clientkey" : "prpl-aim-clientkey", - DEFAULT_CLIENT_KEY); -} - -static gchar *generate_error_message(xmlnode *resp, const char *url) -{ - xmlnode *text; - gchar *err = NULL; - gchar *details = NULL; - - if (resp && (text = xmlnode_get_child(resp, "statusText"))) { - details = xmlnode_get_data(text); - } - - if (details && *details) { - err = g_strdup_printf(_("Received unexpected response from %s: %s"), url, details); - } else { - err = g_strdup_printf(_("Received unexpected response from %s"), url); - } - - g_free(details); - return err; -} - -/** - * @return A null-terminated base64 encoded version of the HMAC - * calculated using the given key and data. - */ -static gchar *hmac_sha256(const char *key, const char *message) -{ - PurpleCipherContext *context; - guchar digest[32]; - - context = purple_cipher_context_new_by_name("hmac", NULL); - purple_cipher_context_set_option(context, "hash", "sha256"); - purple_cipher_context_set_key(context, (guchar *)key); - purple_cipher_context_append(context, (guchar *)message, strlen(message)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - purple_cipher_context_destroy(context); - - return purple_base64_encode(digest, sizeof(digest)); -} - -/** - * @return A base-64 encoded HMAC-SHA256 signature created using the - * technique documented at - * http://dev.aol.com/authentication_for_clients#signing - */ -static gchar *generate_signature(const char *method, const char *url, const char *parameters, const char *session_key) -{ - char *encoded_url, *signature_base_string, *signature; - const char *encoded_parameters; - - encoded_url = g_strdup(purple_url_encode(url)); - encoded_parameters = purple_url_encode(parameters); - signature_base_string = g_strdup_printf("%s&%s&%s", - method, encoded_url, encoded_parameters); - g_free(encoded_url); - - signature = hmac_sha256(session_key, signature_base_string); - g_free(signature_base_string); - - return signature; -} - -static gboolean parse_start_oscar_session_response(PurpleConnection *gc, const gchar *response, gsize response_len, char **host, unsigned short *port, char **cookie, char **tls_certname) -{ - xmlnode *response_node, *tmp_node, *data_node; - xmlnode *host_node = NULL, *port_node = NULL, *cookie_node = NULL, *tls_node = NULL; - gboolean use_tls; - char *tmp; - guint code; - - use_tls = purple_account_get_bool(purple_connection_get_account(gc), "use_ssl", OSCAR_DEFAULT_USE_SSL); - - /* Parse the response as XML */ - response_node = xmlnode_from_str(response, response_len); - if (response_node == NULL) - { - char *msg; - purple_debug_error("oscar", "startOSCARSession could not parse " - "response as XML: %s\n", response); - /* Note to translators: %s in this string is a URL */ - msg = generate_error_message(response_node, - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - return FALSE; - } - - /* Grab the necessary XML nodes */ - tmp_node = xmlnode_get_child(response_node, "statusCode"); - data_node = xmlnode_get_child(response_node, "data"); - if (data_node != NULL) { - host_node = xmlnode_get_child(data_node, "host"); - port_node = xmlnode_get_child(data_node, "port"); - cookie_node = xmlnode_get_child(data_node, "cookie"); - tls_node = xmlnode_get_child(data_node, "tlsCertName"); - } - - /* Make sure we have a status code */ - if (tmp_node == NULL || (tmp = xmlnode_get_data_unescaped(tmp_node)) == NULL) { - char *msg; - purple_debug_error("oscar", "startOSCARSession response was " - "missing statusCode: %s\n", response); - msg = generate_error_message(response_node, - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Make sure the status code was 200 */ - code = atoi(tmp); - if (code != 200) - { - purple_debug_error("oscar", "startOSCARSession response statusCode " - "was %s: %s\n", tmp, response); - - if (code == 401 || code == 607) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("You have been connecting and disconnecting too " - "frequently. Wait ten minutes and try again. If " - "you continue to try, you will need to wait even " - "longer.")); - else { - char *msg; - msg = generate_error_message(response_node, - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); - g_free(msg); - } - - g_free(tmp); - xmlnode_free(response_node); - return FALSE; - } - g_free(tmp); - - /* Make sure we have everything else */ - if (data_node == NULL || host_node == NULL || - port_node == NULL || cookie_node == NULL || - (use_tls && tls_node == NULL)) - { - char *msg; - purple_debug_error("oscar", "startOSCARSession response was missing " - "something: %s\n", response); - msg = generate_error_message(response_node, - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Extract data from the XML */ - *host = xmlnode_get_data_unescaped(host_node); - tmp = xmlnode_get_data_unescaped(port_node); - *cookie = xmlnode_get_data_unescaped(cookie_node); - - if (use_tls) - *tls_certname = xmlnode_get_data_unescaped(tls_node); - - if (*host == NULL || **host == '\0' || tmp == NULL || *tmp == '\0' || *cookie == NULL || **cookie == '\0' || - (use_tls && (*tls_certname == NULL || **tls_certname == '\0'))) - { - char *msg; - purple_debug_error("oscar", "startOSCARSession response was missing " - "something: %s\n", response); - msg = generate_error_message(response_node, - URL_START_OSCAR_SESSION); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - g_free(*host); - g_free(tmp); - g_free(*cookie); - xmlnode_free(response_node); - return FALSE; - } - - *port = atoi(tmp); - g_free(tmp); - - return TRUE; -} - -static void start_oscar_session_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - OscarData *od; - PurpleConnection *gc; - char *host, *cookie; - char *tls_certname = NULL; - unsigned short port; - guint8 *cookiedata; - gsize cookiedata_len; - - od = user_data; - gc = od->gc; - - od->url_data = NULL; - - if (error_message != NULL || len == 0) { - gchar *tmp; - /* Note to translators: The first %s is a URL, the second is an - error message. */ - tmp = g_strdup_printf(_("Error requesting %s: %s"), - URL_START_OSCAR_SESSION, error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (!parse_start_oscar_session_response(gc, url_text, len, &host, &port, &cookie, &tls_certname)) - return; - - cookiedata = purple_base64_decode(cookie, &cookiedata_len); - oscar_connect_to_bos(gc, od, host, port, cookiedata, cookiedata_len, tls_certname); - g_free(cookiedata); - - g_free(host); - g_free(cookie); - g_free(tls_certname); -} - -static void send_start_oscar_session(OscarData *od, const char *token, const char *session_key, time_t hosttime) -{ - char *query_string, *signature, *url; - gboolean use_tls = purple_account_get_bool(purple_connection_get_account(od->gc), "use_ssl", OSCAR_DEFAULT_USE_SSL); - - /* - * Construct the GET parameters. 0x00000611 is the distid given to - * us by AOL for use as the default libpurple distid. - */ - query_string = g_strdup_printf("a=%s" - "&distId=%d" - "&f=xml" - "&k=%s" - "&ts=%" PURPLE_TIME_T_MODIFIER - "&useTLS=%d", - purple_url_encode(token), - oscar_get_ui_info_int(od->icq ? "prpl-icq-distid" - : "prpl-aim-distid", 0x00000611), - get_client_key(od), hosttime, use_tls); - signature = generate_signature("GET", URL_START_OSCAR_SESSION, - query_string, session_key); - url = g_strdup_printf(URL_START_OSCAR_SESSION "?%s&sig_sha256=%s", - query_string, signature); - g_free(query_string); - g_free(signature); - - /* Make the request */ - od->url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, - start_oscar_session_cb, od); - g_free(url); -} - -/** - * This function parses the given response from a clientLogin request - * and extracts the useful information. - * - * @param gc The PurpleConnection. If the response data does - * not indicate then purple_connection_error_reason() - * will be called to close this connection. - * @param response The response data from the clientLogin request. - * @param response_len The length of the above response, or -1 if - * @response is NUL terminated. - * @param token If parsing was successful then this will be set to - * a newly allocated string containing the token. The - * caller should g_free this string when it is finished - * with it. On failure this value will be untouched. - * @param secret If parsing was successful then this will be set to - * a newly allocated string containing the secret. The - * caller should g_free this string when it is finished - * with it. On failure this value will be untouched. - * @param hosttime If parsing was successful then this will be set to - * the time on the OpenAuth Server in seconds since the - * Unix epoch. On failure this value will be untouched. - * - * @return TRUE if the request was successful and we were able to - * extract all info we need. Otherwise FALSE. - */ -static gboolean parse_client_login_response(PurpleConnection *gc, const gchar *response, gsize response_len, char **token, char **secret, time_t *hosttime) -{ - xmlnode *response_node, *tmp_node, *data_node; - xmlnode *secret_node = NULL, *hosttime_node = NULL, *token_node = NULL, *tokena_node = NULL; - char *tmp; - - /* Parse the response as XML */ - response_node = xmlnode_from_str(response, response_len); - if (response_node == NULL) - { - char *msg; - purple_debug_error("oscar", "clientLogin could not parse " - "response as XML: %s\n", response); - msg = generate_error_message(response_node, - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - return FALSE; - } - - /* Grab the necessary XML nodes */ - tmp_node = xmlnode_get_child(response_node, "statusCode"); - data_node = xmlnode_get_child(response_node, "data"); - if (data_node != NULL) { - secret_node = xmlnode_get_child(data_node, "sessionSecret"); - hosttime_node = xmlnode_get_child(data_node, "hostTime"); - token_node = xmlnode_get_child(data_node, "token"); - if (token_node != NULL) - tokena_node = xmlnode_get_child(token_node, "a"); - } - - /* Make sure we have a status code */ - if (tmp_node == NULL || (tmp = xmlnode_get_data_unescaped(tmp_node)) == NULL) { - char *msg; - purple_debug_error("oscar", "clientLogin response was " - "missing statusCode: %s\n", response); - msg = generate_error_message(response_node, - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Make sure the status code was 200 */ - if (strcmp(tmp, "200") != 0) - { - int status_code, status_detail_code = 0; - - status_code = atoi(tmp); - g_free(tmp); - tmp_node = xmlnode_get_child(response_node, "statusDetailCode"); - if (tmp_node != NULL && (tmp = xmlnode_get_data_unescaped(tmp_node)) != NULL) { - status_detail_code = atoi(tmp); - g_free(tmp); - } - - purple_debug_error("oscar", "clientLogin response statusCode " - "was %d (%d): %s\n", status_code, status_detail_code, response); - - if (status_code == 330 && status_detail_code == 3011) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Incorrect password")); - } else if (status_code == 330 && status_detail_code == 3015) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Server requested that you fill out a CAPTCHA in order to " - "sign in, but this client does not currently support CAPTCHAs.")); - } else if (status_code == 401 && status_detail_code == 3019) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("AOL does not allow your screen name to authenticate here")); - } else { - char *msg; - msg = generate_error_message(response_node, - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, msg); - g_free(msg); - } - - xmlnode_free(response_node); - return FALSE; - } - g_free(tmp); - - /* Make sure we have everything else */ - if (data_node == NULL || secret_node == NULL || - token_node == NULL || tokena_node == NULL) - { - char *msg; - purple_debug_error("oscar", "clientLogin response was missing " - "something: %s\n", response); - msg = generate_error_message(response_node, - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - xmlnode_free(response_node); - return FALSE; - } - - /* Extract data from the XML */ - *token = xmlnode_get_data_unescaped(tokena_node); - *secret = xmlnode_get_data_unescaped(secret_node); - tmp = xmlnode_get_data_unescaped(hosttime_node); - if (*token == NULL || **token == '\0' || *secret == NULL || **secret == '\0' || tmp == NULL || *tmp == '\0') - { - char *msg; - purple_debug_error("oscar", "clientLogin response was missing " - "something: %s\n", response); - msg = generate_error_message(response_node, - URL_CLIENT_LOGIN); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - g_free(*token); - g_free(*secret); - g_free(tmp); - xmlnode_free(response_node); - return FALSE; - } - - *hosttime = strtol(tmp, NULL, 10); - g_free(tmp); - - xmlnode_free(response_node); - - return TRUE; -} - -static void client_login_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) -{ - OscarData *od; - PurpleConnection *gc; - char *token, *secret, *session_key; - time_t hosttime; - int password_len; - char *password; - - od = user_data; - gc = od->gc; - - od->url_data = NULL; - - if (error_message != NULL || len == 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Error requesting %s: %s"), - URL_CLIENT_LOGIN, error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (!parse_client_login_response(gc, url_text, len, &token, &secret, &hosttime)) - return; - - password_len = strlen(purple_connection_get_password(gc)); - password = g_strdup_printf("%.*s", - od->icq ? MIN(password_len, MAXICQPASSLEN) : password_len, - purple_connection_get_password(gc)); - session_key = hmac_sha256(password, secret); - g_free(password); - g_free(secret); - - send_start_oscar_session(od, token, session_key, hosttime); - - g_free(token); - g_free(session_key); -} - -/** - * This function sends a request to - * https://api.screenname.aol.com/auth/clientLogin with the user's - * username and password and receives the user's session key, which is - * used to request a connection to the BOSS server. - */ -void send_client_login(OscarData *od, const char *username) -{ - PurpleConnection *gc; - GString *request, *body; - const char *tmp; - char *password; - int password_len; - - gc = od->gc; - - /* - * We truncate ICQ passwords to 8 characters. There is probably a - * limit for AIM passwords, too, but we really only need to do - * this for ICQ because older ICQ clients let you enter a password - * as long as you wanted and then they truncated it silently. - * - * And we can truncate based on the number of bytes and not the - * number of characters because passwords for AIM and ICQ are - * supposed to be plain ASCII (I don't know if this has always been - * the case, though). - */ - tmp = purple_connection_get_password(gc); - password_len = strlen(tmp); - password = g_strndup(tmp, od->icq ? MIN(password_len, MAXICQPASSLEN) : password_len); - - /* Construct the body of the HTTP POST request */ - body = g_string_new(""); - g_string_append_printf(body, "devId=%s", get_client_key(od)); - g_string_append_printf(body, "&f=xml"); - g_string_append_printf(body, "&pwd=%s", purple_url_encode(password)); - g_string_append_printf(body, "&s=%s", purple_url_encode(username)); - g_free(password); - - /* Construct an HTTP POST request */ - request = g_string_new("POST /auth/clientLogin HTTP/1.0\r\n" - "Connection: close\r\n" - "Accept: */*\r\n"); - - /* Tack on the body */ - g_string_append_printf(request, "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n"); - g_string_append_printf(request, "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n", body->len); - g_string_append_len(request, body->str, body->len); - g_string_free(body, TRUE); - - /* Send the POST request */ - od->url_data = purple_util_fetch_url_request(URL_CLIENT_LOGIN, - TRUE, NULL, FALSE, request->str, FALSE, - client_login_cb, od); - g_string_free(request, TRUE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/COPYING qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/COPYING --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/COPYING 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_admin.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_admin.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_admin.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_admin.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,246 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0007 - Account Administration. - * - * Used for stuff like changing the formating of your username, changing your - * email address, requesting an account confirmation email, getting account info, - */ - -#include "oscar.h" - -/** - * Subtype 0x0002 - Request a bit of account info. - * - * Info should be one of the following: - * 0x0001 - Username formatting - * 0x0011 - Email address - * 0x0013 - Unknown - */ -void -aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info) -{ - ByteStream bs; - aim_snacid_t snacid; - - byte_stream_new(&bs, 4); - - byte_stream_put16(&bs, info); - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtypes 0x0003 and 0x0005 - Parse account info. - * - * Called in reply to both an information request (subtype 0x0002) and - * an information change (subtype 0x0004). - */ -static void -infochange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - char *url=NULL, *sn=NULL, *email=NULL; - guint16 perms, tlvcount, err=0; - - perms = byte_stream_get16(bs); - tlvcount = byte_stream_get16(bs); - - while (tlvcount && byte_stream_empty(bs)) { - guint16 type, length; - - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - - switch (type) { - case 0x0001: { - g_free(sn); - sn = byte_stream_getstr(bs, length); - } break; - - case 0x0004: { - g_free(url); - url = byte_stream_getstr(bs, length); - } break; - - case 0x0008: { - err = byte_stream_get16(bs); - } break; - - case 0x0011: { - g_free(email); - if (length == 0) - email = g_strdup("*suppressed"); - else - email = byte_stream_getstr(bs, length); - } break; - } - - tlvcount--; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - userfunc(od, conn, frame, (snac->subtype == 0x0005) ? 1 : 0, perms, err, url, sn, email); - - g_free(sn); - g_free(url); - g_free(email); -} - -/** - * Subtype 0x0004 - Set the formatting of username (change spaces and capitalization). - */ -void -aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - byte_stream_new(&bs, 2+2+strlen(newnick)); - - aim_tlvlist_add_str(&tlvlist, 0x0001, newnick); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0004 - Change password. - */ -void -aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw) -{ - ByteStream bs; - GSList *tlvlist = NULL; - aim_snacid_t snacid; - - byte_stream_new(&bs, 4+strlen(curpw)+4+strlen(newpw)); - - /* new password TLV t(0002) */ - aim_tlvlist_add_str(&tlvlist, 0x0002, newpw); - - /* current password TLV t(0012) */ - aim_tlvlist_add_str(&tlvlist, 0x0012, curpw); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0004 - Change email address. - */ -void -aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - byte_stream_new(&bs, 2+2+strlen(newemail)); - - aim_tlvlist_add_str(&tlvlist, 0x0011, newemail); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ADMIN, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Subtype 0x0006 - Request account confirmation. - * - * This will cause an email to be sent to the address associated with - * the account. By following the instructions in the mail, you can - * get the TRIAL flag removed from your account. - * - */ -void -aim_admin_reqconfirm(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n(od, conn, SNAC_FAMILY_ADMIN, 0x0006); -} - -/** - * Subtype SNAC_FAMILY_ADMIN - Account confirmation request acknowledgement. - */ -static int -accountconfirm(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 status; - /* GSList *tlvlist; */ - - status = byte_stream_get16(bs); - /* Status is 0x0013 if unable to confirm at this time */ - - /* tlvlist = aim_tlvlist_read(bs); */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, status); - - /* aim_tlvlist_free(tlvlist); */ - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) { - infochange(od, conn, mod, frame, snac, bs); - return 1; - } else if (snac->subtype == SNAC_FAMILY_ADMIN) - return accountconfirm(od, conn, mod, frame, snac, bs); - - return 0; -} - -int admin_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ADMIN; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "admin", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_advert.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_advert.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_advert.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_advert.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0005 - Advertisements. - * - */ - -#include "oscar.h" - -void -aim_ads_requestads(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n(od, conn, SNAC_FAMILY_ADVERT, 0x0002); -} - -static int snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs) -{ - return 0; -} - -int adverts_modfirst(OscarData *od, aim_module_t *mod) -{ - - mod->family = SNAC_FAMILY_ADVERT; - mod->version = 0x0001; - mod->toolid = 0x0001; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "advert", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_alert.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_alert.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_alert.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_alert.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0018 - Email notification - * - * Used for being alerted when the email address(es) associated with - * your username get new electronic-m. For normal AIM accounts, you - * get the email address username@netscape.net. AOL accounts have - * username@aol.com, and can also activate a netscape.net account. - * Note: This information might be out of date. - */ - -#include "oscar.h" - -/** - * Subtype 0x0006 - Request information about your email account - * - * @param od The oscar session. - * @param conn The email connection for this session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_email_sendcookies(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ALERT))) - return -EINVAL; - - byte_stream_new(&bs, 2+16+16); - - /* Number of cookies to follow */ - byte_stream_put16(&bs, 0x0002); - - /* Cookie */ - byte_stream_put16(&bs, 0x5d5e); - byte_stream_put16(&bs, 0x1708); - byte_stream_put16(&bs, 0x55aa); - byte_stream_put16(&bs, 0x11d3); - byte_stream_put16(&bs, 0xb143); - byte_stream_put16(&bs, 0x0060); - byte_stream_put16(&bs, 0xb0fb); - byte_stream_put16(&bs, 0x1ecb); - - /* Cookie */ - byte_stream_put16(&bs, 0xb380); - byte_stream_put16(&bs, 0x9ad8); - byte_stream_put16(&bs, 0x0dba); - byte_stream_put16(&bs, 0x11d5); - byte_stream_put16(&bs, 0x9f8a); - byte_stream_put16(&bs, 0x0060); - byte_stream_put16(&bs, 0xb0ee); - byte_stream_put16(&bs, 0x0631); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ALERT, 0x0006, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ALERT, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0007 - Receive information about your email account - * - * So I don't even know if you can have multiple 16 byte keys, - * but this is coded so it will handle that, and handle it well. - * This tells you if you have unread mail or not, the URL you - * should use to access that mail, and the domain name for the - * email account (username@domainname.com). If this is the - * first 0x0007 SNAC you've received since you signed on, or if - * this is just a periodic status update, this will also contain - * the number of unread emails that you have. - */ -static int -parseinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - struct aim_emailinfo *new; - GSList *tlvlist; - guint8 *cookie8, *cookie16; - int tmp, havenewmail = 0; /* Used to tell the client we have _new_ mail */ - - char *alertitle = NULL, *alerturl = NULL; - - cookie8 = byte_stream_getraw(bs, 8); /* Possibly the code used to log you in to mail? */ - cookie16 = byte_stream_getraw(bs, 16); /* Mail cookie sent above */ - - /* See if we already have some info associated with this cookie */ - for (new = od->emailinfo; (new && memcmp(cookie16, new->cookie16, 16)); new = new->next); - if (new) { - /* Free some of the old info, if it exists */ - g_free(new->cookie8); - g_free(new->cookie16); - g_free(new->url); - g_free(new->domain); - } else { - /* We don't already have info, so create a new struct for it */ - new = g_new0(struct aim_emailinfo, 1); - new->next = od->emailinfo; - od->emailinfo = new; - } - - new->cookie8 = cookie8; - new->cookie16 = cookie16; - - tlvlist = aim_tlvlist_readnum(bs, byte_stream_get16(bs)); - - tmp = aim_tlv_get16(tlvlist, 0x0080, 1); - if (tmp) { - if (new->nummsgs < tmp) - havenewmail = 1; - new->nummsgs = tmp; - } else { - /* If they don't send a 0x0080 TLV, it means we definitely have new mail */ - /* (ie. this is not just another status update) */ - havenewmail = 1; - new->nummsgs++; /* We know we have at least 1 new email */ - } - new->url = aim_tlv_getstr(tlvlist, 0x0007, 1); - if (!(new->unread = aim_tlv_get8(tlvlist, 0x0081, 1))) { - havenewmail = 0; - new->nummsgs = 0; - } - new->domain = aim_tlv_getstr(tlvlist, 0x0082, 1); - new->flag = aim_tlv_get16(tlvlist, 0x0084, 1); - - alertitle = aim_tlv_getstr(tlvlist, 0x0005, 1); - alerturl = aim_tlv_getstr(tlvlist, 0x000d, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, new, havenewmail, alertitle, (alerturl ? alerturl + 2 : NULL)); - - aim_tlvlist_free(tlvlist); - - g_free(alertitle); - g_free(alerturl); - - return ret; -} - -/** - * Subtype 0x0016 - Send something or other - * - * @param od The oscar session. - * @param conn The email connection for this session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_email_activate(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ALERT))) - return -EINVAL; - - byte_stream_new(&bs, 1+16); - - /* I would guess this tells AIM that you want updates for your mail accounts */ - /* ...but I really have no idea */ - byte_stream_put8(&bs, 0x02); - byte_stream_put32(&bs, 0x04000000); - byte_stream_put32(&bs, 0x04000000); - byte_stream_put32(&bs, 0x04000000); - byte_stream_put32(&bs, 0x00000000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ALERT, 0x0016, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ALERT, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0007) - return parseinfo(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -email_shutdown(OscarData *od, aim_module_t *mod) -{ - while (od->emailinfo) - { - struct aim_emailinfo *tmp = od->emailinfo; - od->emailinfo = od->emailinfo->next; - g_free(tmp->cookie16); - g_free(tmp->cookie8); - g_free(tmp->url); - g_free(tmp->domain); - g_free(tmp); - } - - return; -} - -int -email_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ALERT; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "alert", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = email_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_auth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_auth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_auth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_auth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,659 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0017 - Authentication. - * - * Deals with the authorizer for SNAC-based login, and also old-style - * non-SNAC login. - * - */ - -#include "oscar.h" - -#include - -#include "cipher.h" - -/* #define USE_XOR_FOR_ICQ */ - -#ifdef USE_XOR_FOR_ICQ -/** - * Encode a password using old XOR method - * - * This takes a const pointer to a (null terminated) string - * containing the unencoded password. It also gets passed - * an already allocated buffer to store the encoded password. - * This buffer should be the exact length of the password without - * the null. The encoded password buffer /is not %NULL terminated/. - * - * The encoding_table seems to be a fixed set of values. We'll - * hope it doesn't change over time! - * - * This is only used for the XOR method, not the better MD5 method. - * - * @param password Incoming password. - * @param encoded Buffer to put encoded password. - */ -static int -aim_encode_password(const char *password, guint8 *encoded) -{ - guint8 encoding_table[] = { -#if 0 /* old v1 table */ - 0xf3, 0xb3, 0x6c, 0x99, - 0x95, 0x3f, 0xac, 0xb6, - 0xc5, 0xfa, 0x6b, 0x63, - 0x69, 0x6c, 0xc3, 0x9f -#else /* v2.1 table, also works for ICQ */ - 0xf3, 0x26, 0x81, 0xc4, - 0x39, 0x86, 0xdb, 0x92, - 0x71, 0xa3, 0xb9, 0xe6, - 0x53, 0x7a, 0x95, 0x7c -#endif - }; - unsigned int i; - - for (i = 0; i < strlen(password); i++) - encoded[i] = (password[i] ^ encoding_table[i]); - - return 0; -} -#endif - -#ifdef USE_OLD_MD5 -static int -aim_encode_password_md5(const char *password, size_t password_len, const char *key, guint8 *digest) -{ - PurpleCipherContext *context; - - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, (const guchar *)key, strlen(key)); - purple_cipher_context_append(context, (const guchar *)password, password_len); - purple_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - return 0; -} -#else -static int -aim_encode_password_md5(const char *password, size_t password_len, const char *key, guint8 *digest) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar passdigest[16]; - - cipher = purple_ciphers_find_cipher("md5"); - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (const guchar *)password, password_len); - purple_cipher_context_digest(context, 16, passdigest, NULL); - purple_cipher_context_destroy(context); - - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, (const guchar *)key, strlen(key)); - purple_cipher_context_append(context, passdigest, 16); - purple_cipher_context_append(context, (const guchar *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - return 0; -} -#endif - -#ifdef USE_XOR_FOR_ICQ -/* - * Part two of the ICQ hack. Note the ignoring of the key. - */ -static int -goddamnicq2(OscarData *od, FlapConnection *conn, const char *sn, const char *password, ClientInfo *ci) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - int passwdlen; - guint8 *password_encoded; - guint32 distrib; - - passwdlen = strlen(password); - password_encoded = (guint8 *)g_malloc(passwdlen+1); - if (passwdlen > MAXICQPASSLEN) - passwdlen = MAXICQPASSLEN; - - frame = flap_frame_new(od, 0x01, 1152); - - aim_encode_password(password, password_encoded); - - distrib = oscar_get_ui_info_int( - od->icq ? "prpl-icq-distid" : "prpl-aim-distid", - ci->distrib); - - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_str(&tlvlist, 0x0001, sn); - aim_tlvlist_add_raw(&tlvlist, 0x0002, passwdlen, password_encoded); - - if (ci->clientstring != NULL) - aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); - else { - gchar *clientstring = oscar_get_clientstring(); - aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring); - g_free(clientstring); - } - aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid); - aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); - aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); - aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); - aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); - aim_tlvlist_add_32(&tlvlist, 0x0014, distrib); /* distribution chan */ - aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang); - aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country); - - aim_tlvlist_write(&frame->data, &tlvlist); - - g_free(password_encoded); - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); - - return 0; -} -#endif - -/* - * Subtype 0x0002 - * - * This is the initial login request packet. - * - * NOTE!! If you want/need to make use of the aim_sendmemblock() function, - * then the client information you send here must exactly match the - * executable that you're pulling the data from. - * - * Java AIM 1.1.19: - * clientstring = "AOL Instant Messenger (TM) version 1.1.19 for Java built 03/24/98, freeMem 215871 totalMem 1048567, i686, Linus, #2 SMP Sun Feb 11 03:41:17 UTC 2001 2.4.1-ac9, IBM Corporation, 1.1.8, 45.3, Tue Mar 27 12:09:17 PST 2001" - * clientid = 0x0001 - * major = 0x0001 - * minor = 0x0001 - * point = (not sent) - * build = 0x0013 - * unknown= (not sent) - * - * AIM for Linux 1.1.112: - * clientstring = "AOL Instant Messenger (SM)" - * clientid = 0x1d09 - * major = 0x0001 - * minor = 0x0001 - * point = 0x0001 - * build = 0x0070 - * unknown= 0x0000008b - * serverstore = 0x01 - * - * @param truncate_pass Truncate the password to 8 characters. This - * usually happens for AOL accounts. We are told that we - * should truncate it if the 0x0017/0x0007 SNAC contains - * a TLV of type 0x0026 with data 0x0000. - * @param allow_multiple_logins Allow multiple logins? If TRUE, the AIM - * server will prompt the user when multiple logins occur. If - * FALSE, existing connections (on other clients) will be - * disconnected automatically as we connect. - */ -int -aim_send_login(OscarData *od, FlapConnection *conn, const char *sn, const char *password, gboolean truncate_pass, ClientInfo *ci, const char *key, gboolean allow_multiple_logins) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - guint8 digest[16]; - aim_snacid_t snacid; - size_t password_len; - guint32 distrib; - - if (!ci || !sn || !password) - return -EINVAL; - -#ifdef USE_XOR_FOR_ICQ - /* If we're signing on an ICQ account then use the older, XOR login method */ - if (aim_snvalid_icq(sn)) - return goddamnicq2(od, conn, sn, password, ci); -#endif - - frame = flap_frame_new(od, 0x02, 1152); - - snacid = aim_cachesnac(od, SNAC_FAMILY_AUTH, 0x0002, 0x0000, NULL, 0); - aim_putsnac(&frame->data, SNAC_FAMILY_AUTH, 0x0002, 0x0000, snacid); - - aim_tlvlist_add_str(&tlvlist, 0x0001, sn); - - /* Truncate ICQ and AOL passwords, if necessary */ - password_len = strlen(password); - if (oscar_util_valid_name_icq(sn) && (password_len > MAXICQPASSLEN)) - password_len = MAXICQPASSLEN; - else if (truncate_pass && password_len > 8) - password_len = 8; - - aim_encode_password_md5(password, password_len, key, digest); - - distrib = oscar_get_ui_info_int( - od->icq ? "prpl-icq-distid" : "prpl-aim-distid", - ci->distrib); - - aim_tlvlist_add_raw(&tlvlist, 0x0025, 16, digest); - -#ifndef USE_OLD_MD5 - aim_tlvlist_add_noval(&tlvlist, 0x004c); -#endif - - if (ci->clientstring != NULL) - aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); - else { - gchar *clientstring = oscar_get_clientstring(); - aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring); - g_free(clientstring); - } - aim_tlvlist_add_16(&tlvlist, 0x0016, (guint16)ci->clientid); - aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); - aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); - aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); - aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); - aim_tlvlist_add_32(&tlvlist, 0x0014, distrib); - aim_tlvlist_add_str(&tlvlist, 0x000f, ci->lang); - aim_tlvlist_add_str(&tlvlist, 0x000e, ci->country); - - /* - * If set, old-fashioned buddy lists will not work. You will need - * to use SSI. - */ - aim_tlvlist_add_8(&tlvlist, 0x004a, (allow_multiple_logins ? 0x01 : 0x03)); - - aim_tlvlist_write(&frame->data, &tlvlist); - - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); - - return 0; -} - -/* - * This is sent back as a general response to the login command. - * It can be either an error or a success, depending on the - * presence of certain TLVs. - * - * The client should check the value passed as errorcode. If - * its nonzero, there was an error. - */ -static int -parse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - GSList *tlvlist; - aim_rxcallback_t userfunc; - struct aim_authresp_info *info; - int ret = 0; - - info = g_new0(struct aim_authresp_info, 1); - - /* - * Read block of TLVs. All further data is derived - * from what is parsed here. - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * No matter what, we should have a username. - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) { - info->bn = aim_tlv_getstr(tlvlist, 0x0001, 1); - purple_connection_set_display_name(od->gc, info->bn); - } - - /* - * Check for an error code. If so, we should also - * have an error url. - */ - if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) - info->errorcode = aim_tlv_get16(tlvlist, 0x0008, 1); - if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) - info->errorurl = aim_tlv_getstr(tlvlist, 0x0004, 1); - - /* - * BOS server address. - */ - if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) - info->bosip = aim_tlv_getstr(tlvlist, 0x0005, 1); - - /* - * Authorization cookie. - */ - if (aim_tlv_gettlv(tlvlist, 0x0006, 1)) { - aim_tlv_t *tmptlv; - - tmptlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); - if (tmptlv != NULL) - { - info->cookielen = tmptlv->length; - info->cookie = tmptlv->value; - } - } - - /* - * The email address attached to this account - * Not available for ICQ or @mac.com logins. - * If you receive this TLV, then you are allowed to use - * family 0x0018 to check the status of your email. - * XXX - Not really true! - */ - if (aim_tlv_gettlv(tlvlist, 0x0011, 1)) - info->email = aim_tlv_getstr(tlvlist, 0x0011, 1); - - /* - * The registration status. (Not real sure what it means.) - * Not available for ICQ or @mac.com logins. - * - * 1 = No disclosure - * 2 = Limited disclosure - * 3 = Full disclosure - * - * This has to do with whether your email address is available - * to other users or not. AFAIK, this feature is no longer used. - * - * Means you can use the admin family? (0x0007) - * - */ - if (aim_tlv_gettlv(tlvlist, 0x0013, 1)) - info->regstatus = aim_tlv_get16(tlvlist, 0x0013, 1); - - if (aim_tlv_gettlv(tlvlist, 0x0040, 1)) - info->latestbeta.build = aim_tlv_get32(tlvlist, 0x0040, 1); - if (aim_tlv_gettlv(tlvlist, 0x0041, 1)) - info->latestbeta.url = aim_tlv_getstr(tlvlist, 0x0041, 1); - if (aim_tlv_gettlv(tlvlist, 0x0042, 1)) - info->latestbeta.info = aim_tlv_getstr(tlvlist, 0x0042, 1); - if (aim_tlv_gettlv(tlvlist, 0x0043, 1)) - info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1); - -#if 0 - if (aim_tlv_gettlv(tlvlist, 0x0048, 1)) { - /* beta serial */ - } -#endif - - if (aim_tlv_gettlv(tlvlist, 0x0044, 1)) - info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1); - if (aim_tlv_gettlv(tlvlist, 0x0045, 1)) - info->latestrelease.url = aim_tlv_getstr(tlvlist, 0x0045, 1); - if (aim_tlv_gettlv(tlvlist, 0x0046, 1)) - info->latestrelease.info = aim_tlv_getstr(tlvlist, 0x0046, 1); - if (aim_tlv_gettlv(tlvlist, 0x0047, 1)) - info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1); - -#if 0 - if (aim_tlv_gettlv(tlvlist, 0x0049, 1)) { - /* lastest release serial */ - } -#endif - - /* - * URL to change password. - */ - if (aim_tlv_gettlv(tlvlist, 0x0054, 1)) - info->chpassurl = aim_tlv_getstr(tlvlist, 0x0054, 1); - -#if 0 - /* - * Unknown. Seen on an @mac.com username with value of 0x003f - */ - if (aim_tlv_gettlv(tlvlist, 0x0055, 1)) { - /* Unhandled */ - } -#endif - - od->authinfo = info; - - if ((userfunc = aim_callhandler(od, snac ? snac->family : SNAC_FAMILY_AUTH, snac ? snac->subtype : 0x0003))) - ret = userfunc(od, conn, frame, info); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -#ifdef USE_XOR_FOR_ICQ -/* - * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client - * - * This is a bit confusing. - * - * Normal SNAC login goes like this: - * - connect - * - server sends flap version - * - client sends flap version - * - client sends username (17/6) - * - server sends hash key (17/7) - * - client sends auth request (17/2 -- aim_send_login) - * - server yells - * - * XOR login (for ICQ) goes like this: - * - connect - * - server sends flap version - * - client sends auth request which contains flap version (aim_send_login) - * - server yells - * - * For the client API, we make them implement the most complicated version, - * and for the simpler version, we fake it and make it look like the more - * complicated process. - * - * This is done by giving the client a faked key, just so we can convince - * them to call aim_send_login right away, which will detect the session - * flag that says this is XOR login and ignore the key, sending an ICQ - * login request instead of the normal SNAC one. - * - * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. - */ -static int -goddamnicq(OscarData *od, FlapConnection *conn, const char *sn) -{ - FlapFrame frame; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_AUTH, 0x0007))) - userfunc(od, conn, &frame, ""); - - return 0; -} -#endif - -/* - * Subtype 0x0006 - * - * In AIM 3.5 protocol, the first stage of login is to request login from the - * Authorizer, passing it the username for verification. If the name is - * invalid, a 0017/0003 is spit back, with the standard error contents. If - * valid, a 0017/0007 comes back, which is the signal to send it the main - * login command (0017/0002). - * - */ -int -aim_request_login(OscarData *od, FlapConnection *conn, const char *sn) -{ - FlapFrame *frame; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !conn || !sn) - return -EINVAL; - -#ifdef USE_XOR_FOR_ICQ - if (aim_snvalid_icq(sn)) - return goddamnicq(od, conn, sn); -#endif - - frame = flap_frame_new(od, 0x02, 10+2+2+strlen(sn)+8); - - snacid = aim_cachesnac(od, SNAC_FAMILY_AUTH, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&frame->data, SNAC_FAMILY_AUTH, 0x0006, 0x0000, snacid); - - aim_tlvlist_add_str(&tlvlist, 0x0001, sn); - - /* Tell the server we support SecurID logins. */ - aim_tlvlist_add_noval(&tlvlist, 0x004b); - - /* Unknown. Sent in recent WinAIM clients.*/ - aim_tlvlist_add_noval(&tlvlist, 0x005a); - - aim_tlvlist_write(&frame->data, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); - - return 0; -} - -/* - * Subtype 0x0007 - * - * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed - * by only its length in a two byte word. - * - * Calls the client, which should then use the value to call aim_send_login. - * - */ -static int -keyparse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int keylen, ret = 1; - aim_rxcallback_t userfunc; - char *keystr; - GSList *tlvlist; - gboolean truncate_pass; - - keylen = byte_stream_get16(bs); - keystr = byte_stream_getstr(bs, keylen); - tlvlist = aim_tlvlist_read(bs); - - /* - * If the truncate_pass TLV exists then we should truncate the - * user's password to 8 characters. This flag is sent to us - * when logging in with an AOL user's username. - */ - truncate_pass = aim_tlv_gettlv(tlvlist, 0x0026, 1) != NULL; - - /* XXX - When GiantGrayPanda signed on AIM I got a thing asking me to register - * for the netscape network. This SNAC had a type 0x0058 TLV with length 10. - * Data is 0x0007 0004 3e19 ae1e 0006 0004 0000 0005 */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, keystr, (int)truncate_pass); - - g_free(keystr); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/** - * Subtype 0x000a - * - * Receive SecurID request. - */ -static int -got_securid_request(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/** - * Subtype 0x000b - * - * Send SecurID response. - */ -int -aim_auth_securid_send(OscarData *od, const char *securid) -{ - FlapConnection *conn; - FlapFrame *frame; - aim_snacid_t snacid; - int len; - - if (!od || !(conn = flap_connection_getbytype_all(od, SNAC_FAMILY_AUTH)) || !securid) - return -EINVAL; - - len = strlen(securid); - - frame = flap_frame_new(od, 0x02, 10+2+len); - - snacid = aim_cachesnac(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_RESPONSE, 0x0000, NULL, 0); - aim_putsnac(&frame->data, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_RESPONSE, 0x0000, 0); - - byte_stream_put16(&frame->data, len); - byte_stream_putstr(&frame->data, securid); - - flap_connection_send(conn, frame); - - return 0; -} - -static void -auth_shutdown(OscarData *od, aim_module_t *mod) -{ - if (od->authinfo != NULL) - { - g_free(od->authinfo->bn); - g_free(od->authinfo->bosip); - g_free(od->authinfo->errorurl); - g_free(od->authinfo->email); - g_free(od->authinfo->chpassurl); - g_free(od->authinfo->latestrelease.name); - g_free(od->authinfo->latestrelease.url); - g_free(od->authinfo->latestrelease.info); - g_free(od->authinfo->latestbeta.name); - g_free(od->authinfo->latestbeta.url); - g_free(od->authinfo->latestbeta.info); - g_free(od->authinfo); - } -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return parse(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0007) - return keyparse(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000a) - return got_securid_request(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -auth_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_AUTH; - mod->version = 0x0000; - mod->flags = 0; - strncpy(mod->name, "auth", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = auth_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bart.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bart.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bart.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bart.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,186 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0010 - Server stored buddy art - * - * Used for storing and retrieving your cute little buddy icon - * from the AIM servers. - * - */ - -#include "oscar.h" - -/** - * Subtype 0x0002 - Upload your icon. - * - * @param od The oscar session. - * @param icon The raw data of the icon image file. - * @param iconlen Length of the raw data of the icon image file. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_BART)) || !icon || !iconlen) - return -EINVAL; - - byte_stream_new(&bs, 2 + 2 + iconlen); - - /* The reference number for the icon */ - byte_stream_put16(&bs, 1); - - /* The icon */ - byte_stream_put16(&bs, iconlen); - byte_stream_putraw(&bs, icon, iconlen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BART, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BART, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0003 - Acknowledgement for uploading a buddy icon. - * - * You get this honky after you upload a buddy icon. - */ -static int -uploadack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 something, somethingelse; - guint8 onemorething; - - something = byte_stream_get16(bs); - somethingelse = byte_stream_get16(bs); - onemorething = byte_stream_get8(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/** - * Subtype 0x0004 - Request someone's icon. - * - * @param od The oscar session. - * @param bn The name of the buddy whose icon you are requesting. - * @param iconcsum The MD5 checksum of the icon you are requesting. - * @param iconcsumlen Length of the MD5 checksum given above. Should be 10 bytes. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_bart_request(OscarData *od, const char *bn, guint8 iconcsumtype, const guint8 *iconcsum, guint16 iconcsumlen) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_BART)) || !bn || !strlen(bn) || !iconcsum || !iconcsumlen) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 4 + 1+iconcsumlen); - - /* Buddy name */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Some numbers. You like numbers, right? */ - byte_stream_put8(&bs, 0x01); - byte_stream_put16(&bs, 0x0001); - byte_stream_put8(&bs, iconcsumtype); - - /* Icon string */ - byte_stream_put8(&bs, iconcsumlen); - byte_stream_putraw(&bs, iconcsum, iconcsumlen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BART, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BART, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0005 - Receive a buddy icon. - * - * This is sent in response to a buddy icon request. - */ -static int -parseicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *bn; - guint16 flags, iconlen; - guint8 iconcsumtype, iconcsumlen, *iconcsum, *icon; - - bn = byte_stream_getstr(bs, byte_stream_get8(bs)); - flags = byte_stream_get16(bs); - iconcsumtype = byte_stream_get8(bs); - iconcsumlen = byte_stream_get8(bs); - iconcsum = byte_stream_getraw(bs, iconcsumlen); - iconlen = byte_stream_get16(bs); - icon = byte_stream_getraw(bs, iconlen); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, iconcsumtype, iconcsum, iconcsumlen, icon, iconlen); - - g_free(bn); - g_free(iconcsum); - g_free(icon); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return uploadack(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0005) - return parseicon(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -bart_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_BART; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "bart", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bos.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bos.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bos.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_bos.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0009 - Basic Oscar Service. - * - * The functionality of this family has been replaced by SSI. - */ - -#include "oscar.h" - -#include - -/* Subtype 0x0002 - Request BOS rights. */ -void -aim_bos_reqrights(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_BOS, 0x0002); -} - -/* Subtype 0x0003 - BOS Rights. */ -static int rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist; - guint16 maxpermits = 0, maxdenies = 0; - int ret = 0; - - /* - * TLVs follow - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * TLV type 0x0001: Maximum number of buddies on permit list. - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) - maxpermits = aim_tlv_get16(tlvlist, 0x0001, 1); - - /* - * TLV type 0x0002: Maximum number of buddies on deny list. - */ - if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) - maxdenies = aim_tlv_get16(tlvlist, 0x0002, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, maxpermits, maxdenies); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0004 - Set group permission mask. - * - * Normally 0x1f (all classes). - * - * The group permission mask allows you to keep users of a certain - * class or classes from talking to you. The mask should be - * a bitwise OR of all the user classes you want to see you. - * - */ -void -aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask) -{ - aim_genericreq_l(od, conn, SNAC_FAMILY_BOS, 0x0004, &mask); -} - -/* - * Stubtypes 0x0005, 0x0006, 0x0007, and 0x0008 - Modify permit/deny lists. - * - * Changes your visibility depending on changetype: - * - * AIM_VISIBILITYCHANGE_PERMITADD: Lets provided list of names see you - * AIM_VISIBILITYCHANGE_PERMIDREMOVE: Removes listed names from permit list - * AIM_VISIBILITYCHANGE_DENYADD: Hides you from provided list of names - * AIM_VISIBILITYCHANGE_DENYREMOVE: Lets list see you again - * - * list should be a list of "Buddy Name One&BuddyNameTwo&" etc. - * - * Equivelents to options in WinAIM: - * - Allow all users to contact me: Send an AIM_VISIBILITYCHANGE_DENYADD - * with only your name on it. - * - Allow only users on my Buddy List: Send an - * AIM_VISIBILITYCHANGE_PERMITADD with the list the same as your - * buddy list - * - Allow only the uesrs below: Send an AIM_VISIBILITYCHANGE_PERMITADD - * with everyone listed that you want to see you. - * - Block all users: Send an AIM_VISIBILITYCHANGE_PERMITADD with only - * yourself in the list - * - Block the users below: Send an AIM_VISIBILITYCHANGE_DENYADD with - * the list of users to be blocked - * - * XXX ye gods. - */ -int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int changetype, const char *denylist) -{ - ByteStream bs; - int packlen = 0; - guint16 subtype; - char *localcpy = NULL, *tmpptr = NULL; - int i; - int listcount; - aim_snacid_t snacid; - - if (!denylist) - return -EINVAL; - - if (changetype == AIM_VISIBILITYCHANGE_PERMITADD) - subtype = 0x05; - else if (changetype == AIM_VISIBILITYCHANGE_PERMITREMOVE) - subtype = 0x06; - else if (changetype == AIM_VISIBILITYCHANGE_DENYADD) - subtype = 0x07; - else if (changetype == AIM_VISIBILITYCHANGE_DENYREMOVE) - subtype = 0x08; - else - return -EINVAL; - - localcpy = g_strdup(denylist); - - listcount = aimutil_itemcnt(localcpy, '&'); - packlen = aimutil_tokslen(localcpy, 99, '&') + listcount-1; - - byte_stream_new(&bs, packlen); - - for (i = 0; (i < (listcount - 1)) && (i < 99); i++) { - tmpptr = aimutil_itemindex(localcpy, i, '&'); - - byte_stream_put8(&bs, strlen(tmpptr)); - byte_stream_putstr(&bs, tmpptr); - - g_free(tmpptr); - } - g_free(localcpy); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BOS, subtype, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BOS, subtype, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return rights(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -bos_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_BOS; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "bos", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0003 (SNAC_FAMILY_BUDDY) - Old-style Buddylist Management (non-SSI). - * - */ - -#include "oscar.h" - -#include - -/* - * Subtype 0x0002 - Request rights. - * - * Request Buddy List rights. - * - */ -void -aim_buddylist_reqrights(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_REQRIGHTS); -} - -/* - * Subtype 0x0003 - Rights. - * - */ -static int -rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist; - guint16 maxbuddies = 0, maxwatchers = 0; - int ret = 0; - - /* - * TLVs follow - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * TLV type 0x0001: Maximum number of buddies. - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) - maxbuddies = aim_tlv_get16(tlvlist, 0x0001, 1); - - /* - * TLV type 0x0002: Maximum number of watchers. - * - * Watchers are other users who have you on their buddy - * list. (This is called the "reverse list" by a certain - * other IM protocol.) - * - */ - if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) - maxwatchers = aim_tlv_get16(tlvlist, 0x0002, 1); - - /* - * TLV type 0x0003: Unknown. - * - * ICQ only? - */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, maxbuddies, maxwatchers); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0004 (SNAC_SUBTYPE_BUDDY_ADDBUDDY) - Add buddy to list. - * - * Adds a single buddy to your buddy list after login. - * XXX This should just be an extension of setbuddylist() - * - */ -int -aim_buddylist_addbuddy(OscarData *od, FlapConnection *conn, const char *sn) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!sn || !strlen(sn)) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(sn)); - - byte_stream_put8(&bs, strlen(sn)); - byte_stream_putstr(&bs, sn); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, sn, strlen(sn)+1); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0004 (SNAC_SUBTYPE_BUDDY_ADDBUDDY) - Add multiple buddies to your buddy list. - * - * This just builds the "set buddy list" command then queues it. - * - * buddy_list = "Buddy Name One&BuddyNameTwo&"; - * - * XXX Clean this up. - * - */ -int -aim_buddylist_set(OscarData *od, FlapConnection *conn, const char *buddy_list) -{ - ByteStream bs; - aim_snacid_t snacid; - int len = 0; - char *localcpy = NULL; - char *tmpptr = NULL; - - if (!buddy_list || !(localcpy = g_strdup(buddy_list))) - return -EINVAL; - - for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { - purple_debug_misc("oscar", "---adding: %s (%" G_GSIZE_FORMAT - ")\n", tmpptr, strlen(tmpptr)); - len += 1 + strlen(tmpptr); - tmpptr = strtok(NULL, "&"); - } - - byte_stream_new(&bs, len); - - strncpy(localcpy, buddy_list, strlen(buddy_list) + 1); - - for (tmpptr = strtok(localcpy, "&"); tmpptr; ) { - - purple_debug_misc("oscar", "---adding: %s (%" G_GSIZE_FORMAT - ")\n", tmpptr, strlen(tmpptr)); - - byte_stream_put8(&bs, strlen(tmpptr)); - byte_stream_putstr(&bs, tmpptr); - tmpptr = strtok(NULL, "&"); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BUDDY, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - g_free(localcpy); - - return 0; -} - -/* - * Subtype 0x0005 (SNAC_SUBTYPE_BUDDY_REMBUDDY) - Remove buddy from list. - * - * XXX generalise to support removing multiple buddies (basically, its - * the same as setbuddylist() but with a different snac subtype). - * - */ -int -aim_buddylist_removebuddy(OscarData *od, FlapConnection *conn, const char *sn) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!sn || !strlen(sn)) - return -EINVAL; - - byte_stream_new(&bs, 1 + strlen(sn)); - - byte_stream_put8(&bs, strlen(sn)); - byte_stream_putstr(&bs, sn); - - snacid = aim_cachesnac(od, SNAC_FAMILY_BUDDY, 0x0005, 0x0000, sn, strlen(sn)+1); - flap_connection_send_snac(od, conn, SNAC_FAMILY_BUDDY, 0x0005, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtypes 0x000b (SNAC_SUBTYPE_BUDDY_ONCOMING) and 0x000c (SNAC_SUBTYPE_BUDDY_OFFGOING) - Change in buddy status - * - * Oncoming Buddy notifications contain a subset of the - * user information structure. It's close enough to run - * through aim_info_extract() however. - * - * Although the offgoing notification contains no information, - * it is still in a format parsable by aim_info_extract(). - * - */ -static int -buddychange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_userinfo_t userinfo; - aim_rxcallback_t userfunc; - - aim_info_extract(od, bs, &userinfo); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &userinfo); - - aim_info_free(&userinfo); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == SNAC_SUBTYPE_BUDDY_RIGHTSINFO) - return rights(od, conn, mod, frame, snac, bs); - else if ((snac->subtype == SNAC_SUBTYPE_BUDDY_ONCOMING) || (snac->subtype == SNAC_SUBTYPE_BUDDY_OFFGOING)) - return buddychange(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -buddylist_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_BUDDY; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "buddy", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,608 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000e - Routines for the Chat service. - * - */ - -#include "oscar.h" - -#include - -/* Stored in the ->internal of chat connections */ -struct chatconnpriv -{ - guint16 exchange; - char *name; - guint16 instance; -}; - -void -flap_connection_destroy_chat(OscarData *od, FlapConnection *conn) -{ - struct chatconnpriv *ccp = (struct chatconnpriv *)conn->internal; - - if (ccp) - g_free(ccp->name); - g_free(ccp); - - return; -} - -char * -aim_chat_getname(FlapConnection *conn) -{ - struct chatconnpriv *ccp; - - if (!conn) - return NULL; - - if (conn->type != SNAC_FAMILY_CHAT) - return NULL; - - ccp = (struct chatconnpriv *)conn->internal; - - return ccp->name; -} - -/* XXX get this into conn.c -- evil!! */ -FlapConnection * -aim_chat_getconn(OscarData *od, const char *name) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur; cur = cur->next) - { - FlapConnection *conn; - struct chatconnpriv *ccp; - - conn = cur->data; - ccp = (struct chatconnpriv *)conn->internal; - - if (conn->type != SNAC_FAMILY_CHAT) - continue; - if (!conn->internal) - { - purple_debug_misc("oscar", "%sfaim: chat: chat connection with no name! (fd = %d)\n", - conn->gsc ? "(ssl) " : "", conn->gsc ? conn->gsc->fd : conn->fd); - continue; - } - - if (strcmp(ccp->name, name) == 0) - return conn; - } - - return NULL; -} - -int -aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance) -{ - struct chatconnpriv *ccp; - - if (!conn || !roomname) - return -EINVAL; - - if (conn->internal) - g_free(conn->internal); - - ccp = g_new(struct chatconnpriv, 1); - - ccp->exchange = exchange; - ccp->name = g_strdup(roomname); - ccp->instance = instance; - - conn->internal = (void *)ccp; - - return 0; -} - -int -aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo) -{ - if (!bs || !outinfo) - return 0; - - outinfo->exchange = byte_stream_get16(bs); - outinfo->namelen = byte_stream_get8(bs); - outinfo->name = (char *)byte_stream_getraw(bs, outinfo->namelen); - outinfo->instance = byte_stream_get16(bs); - - return 0; -} - -int -aim_chat_leaveroom(OscarData *od, const char *name) -{ - FlapConnection *conn; - - if (!(conn = aim_chat_getconn(od, name))) - return -ENOENT; - - flap_connection_close(od, conn); - - return 0; -} - -/* - * Subtype 0x0002 - General room information. Lots of stuff. - * - * Values I know are in here but I haven't attached - * them to any of the 'Unknown's: - * - Language (English) - * - */ -static int -infoupdate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_userinfo_t *userinfo = NULL; - aim_rxcallback_t userfunc; - int ret = 0; - int usercount; - guint8 detaillevel = 0; - char *roomname; - struct aim_chat_roominfo roominfo; - guint16 tlvcount = 0; - GSList *tlvlist; - aim_tlv_t *tlv; - char *roomdesc; - guint16 flags; - guint32 creationtime; - guint16 maxmsglen, maxvisiblemsglen; - guint16 unknown_d2, unknown_d5; - - aim_chat_readroominfo(bs, &roominfo); - - detaillevel = byte_stream_get8(bs); - - if (detaillevel != 0x02) { - purple_debug_misc("oscar", "faim: chat_roomupdateinfo: detail level %d not supported\n", detaillevel); - return 1; - } - - tlvcount = byte_stream_get16(bs); - - /* - * Everything else are TLVs. - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * TLV type 0x006a is the room name in Human Readable Form. - */ - roomname = aim_tlv_getstr(tlvlist, 0x006a, 1); - - /* - * Type 0x006f: Number of occupants. - */ - usercount = aim_tlv_get16(tlvlist, 0x006f, 1); - - /* - * Type 0x0073: Occupant list. - */ - tlv = aim_tlv_gettlv(tlvlist, 0x0073, 1); - if (tlv != NULL) - { - int curoccupant = 0; - ByteStream occbs; - - /* Allocate enough userinfo structs for all occupants */ - userinfo = g_new0(aim_userinfo_t, usercount); - - byte_stream_init(&occbs, tlv->value, tlv->length); - - while (curoccupant < usercount) - aim_info_extract(od, &occbs, &userinfo[curoccupant++]); - } - - /* - * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG) - */ - flags = aim_tlv_get16(tlvlist, 0x00c9, 1); - - /* - * Type 0x00ca: Creation time (4 bytes) - */ - creationtime = aim_tlv_get32(tlvlist, 0x00ca, 1); - - /* - * Type 0x00d1: Maximum Message Length - */ - maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1); - - /* - * Type 0x00d2: Unknown. (2 bytes) - */ - unknown_d2 = aim_tlv_get16(tlvlist, 0x00d2, 1); - - /* - * Type 0x00d3: Room Description - */ - roomdesc = aim_tlv_getstr(tlvlist, 0x00d3, 1); - -#if 0 - /* - * Type 0x000d4: Unknown (flag only) - */ - if (aim_tlv_gettlv(tlvlist, 0x000d4, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00d5: Unknown. (1 byte) - */ - unknown_d5 = aim_tlv_get8(tlvlist, 0x00d5, 1); - -#if 0 - /* - * Type 0x00d6: Encoding 1 ("us-ascii") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d6, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d7: Language 1 ("en") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d7, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d8: Encoding 2 ("us-ascii") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d8, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d9: Language 2 ("en") - */ - if (aim_tlv_gettlv(tlvlist, 0x000d9, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00da: Maximum visible message length - */ - maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - ret = userfunc(od, conn, - frame, - &roominfo, - roomname, - usercount, - userinfo, - roomdesc, - flags, - creationtime, - maxmsglen, - unknown_d2, - unknown_d5, - maxvisiblemsglen); - } - - g_free(roominfo.name); - - while (usercount > 0) - aim_info_free(&userinfo[--usercount]); - - g_free(userinfo); - g_free(roomname); - g_free(roomdesc); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* Subtypes 0x0003 and 0x0004 */ -static int -userlistchange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_userinfo_t *userinfo = NULL; - aim_rxcallback_t userfunc; - int curcount = 0, ret = 0; - - while (byte_stream_empty(bs)) { - curcount++; - userinfo = g_realloc(userinfo, curcount * sizeof(aim_userinfo_t)); - aim_info_extract(od, bs, &userinfo[curcount-1]); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, curcount, userinfo); - - aim_info_free(userinfo); - g_free(userinfo); - - return ret; -} - -/* - * Subtype 0x0005 - Send a Chat Message. - * - * Possible flags: - * AIM_CHATFLAGS_NOREFLECT -- Unset the flag that requests messages - * should be sent to their sender. - * AIM_CHATFLAGS_AWAY -- Mark the message as an autoresponse - * (Note that WinAIM does not honor this, - * and displays the message as normal.) - * - * XXX convert this to use tlvchains - */ -int -aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language) -{ - int i; - ByteStream bs; - IcbmCookie *cookie; - aim_snacid_t snacid; - guint8 ckstr[8]; - GSList *tlvlist = NULL, *inner_tlvlist = NULL; - - if (!od || !conn || !msg || (msglen <= 0)) - return 0; - - byte_stream_new(&bs, 1142); - - snacid = aim_cachesnac(od, SNAC_FAMILY_CHAT, 0x0005, 0x0000, NULL, 0); - - /* - * Cookie - * - * XXX mkcookie should generate the cookie and cache it in one - * operation to preserve uniqueness. - */ - for (i = 0; i < 8; i++) - ckstr[i] = (guint8)rand(); - - cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL); - cookie->data = NULL; /* XXX store something useful here */ - - aim_cachecookie(od, cookie); - - /* ICBM Header */ - byte_stream_putraw(&bs, ckstr, 8); /* Cookie */ - byte_stream_put16(&bs, 0x0003); /* Channel */ - - /* - * Type 1: Flag meaning this message is destined to the room. - */ - aim_tlvlist_add_noval(&tlvlist, 0x0001); - - /* - * Type 6: Reflect - */ - if (!(flags & AIM_CHATFLAGS_NOREFLECT)) - aim_tlvlist_add_noval(&tlvlist, 0x0006); - - /* - * Type 7: Autoresponse - */ - if (flags & AIM_CHATFLAGS_AWAY) - aim_tlvlist_add_noval(&tlvlist, 0x0007); - - /* - * SubTLV: Type 1: Message - */ - aim_tlvlist_add_raw(&inner_tlvlist, 0x0001, msglen, (guchar *)msg); - - /* - * SubTLV: Type 2: Encoding - */ - if (encoding != NULL) - aim_tlvlist_add_str(&inner_tlvlist, 0x0002, encoding); - - /* - * SubTLV: Type 3: Language - */ - if (language != NULL) - aim_tlvlist_add_str(&inner_tlvlist, 0x0003, language); - - /* - * Type 5: Message block. Contains more TLVs. - * - * This could include other information... We just - * put in a message TLV however. - * - */ - aim_tlvlist_add_frozentlvlist(&tlvlist, 0x0005, &inner_tlvlist); - - aim_tlvlist_write(&bs, &tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_CHAT, 0x0005, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0006 - * - * We could probably include this in the normal ICBM parsing - * code as channel 0x0003, however, since only the start - * would be the same, we might as well do it here. - * - * General outline of this SNAC: - * snac - * cookie - * channel id - * tlvlist - * unknown - * source user info - * name - * evility - * userinfo tlvs - * online time - * etc - * message metatlv - * message tlv - * message string - * possibly others - * - */ -static int -incomingim_ch3(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0, i; - aim_rxcallback_t userfunc; - aim_userinfo_t userinfo; - guint8 cookie[8]; - guint16 channel; - GSList *tlvlist; - char *msg = NULL; - int len = 0; - char *encoding = NULL, *language = NULL; - IcbmCookie *ck; - aim_tlv_t *tlv; - ByteStream tbs; - - memset(&userinfo, 0, sizeof(aim_userinfo_t)); - - /* - * Read ICBM Cookie. - */ - for (i = 0; i < 8; i++) - cookie[i] = byte_stream_get8(bs); - - if ((ck = aim_uncachecookie(od, cookie, AIM_COOKIETYPE_CHAT))) { - g_free(ck->data); - g_free(ck); - } - - /* - * Channel ID - * - * Channel 0x0003 is used for chat messages. - * - */ - channel = byte_stream_get16(bs); - - if (channel != 0x0003) { - purple_debug_misc("oscar", "faim: chat_incoming: unknown channel! (0x%04x)\n", channel); - return 0; - } - - /* - * Start parsing TLVs right away. - */ - tlvlist = aim_tlvlist_read(bs); - - /* - * Type 0x0003: Source User Information - */ - tlv = aim_tlv_gettlv(tlvlist, 0x0003, 1); - if (tlv != NULL) - { - byte_stream_init(&tbs, tlv->value, tlv->length); - aim_info_extract(od, &tbs, &userinfo); - } - -#if 0 - /* - * Type 0x0001: If present, it means it was a message to the - * room (as opposed to a whisper). - */ - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x0005: Message Block. Conains more TLVs. - */ - tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1); - if (tlv != NULL) - { - GSList *inner_tlvlist; - aim_tlv_t *inner_tlv; - - byte_stream_init(&tbs, tlv->value, tlv->length); - inner_tlvlist = aim_tlvlist_read(&tbs); - - /* - * Type 0x0001: Message. - */ - inner_tlv = aim_tlv_gettlv(inner_tlvlist, 0x0001, 1); - if (inner_tlv != NULL) - { - len = inner_tlv->length; - msg = aim_tlv_getvalue_as_string(inner_tlv); - } - - /* - * Type 0x0002: Encoding. - */ - encoding = aim_tlv_getstr(inner_tlvlist, 0x0002, 1); - - /* - * Type 0x0003: Language. - */ - language = aim_tlv_getstr(inner_tlvlist, 0x0003, 1); - - aim_tlvlist_free(inner_tlvlist); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &userinfo, len, msg, encoding, language); - - aim_info_free(&userinfo); - g_free(msg); - g_free(encoding); - g_free(language); - aim_tlvlist_free(tlvlist); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0002) - return infoupdate(od, conn, mod, frame, snac, bs); - else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004)) - return userlistchange(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0006) - return incomingim_ch3(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -chat_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_CHAT; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "chat", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chatnav.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chatnav.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chatnav.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_chatnav.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000d - Handle ChatNav. - * - * The ChatNav(igation) service does various things to keep chat - * alive. It provides room information, room searching and creating, - * as well as giving users the right ("permission") to use chat. - * - */ - -#include "oscar.h" - -static int -error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_snac_t *snac2; - guint16 error, chatnav_error; - GSList *tlvlist; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_warning("oscar", "chatnav error: received response to unknown request (%08x)\n", snac->id); - return 0; - } - - if (snac2->family != SNAC_FAMILY_CHATNAV) { - purple_debug_warning("oscar", "chatnav error: received response that maps to corrupt request (fam=%04x)\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - /* - * We now know what the original SNAC subtype was. - */ - if (snac2->type == 0x0008) /* create room */ - { - error = byte_stream_get16(bs); - tlvlist = aim_tlvlist_read(bs); - chatnav_error = aim_tlv_get16(tlvlist, 0x0008, 1); - - purple_debug_warning("oscar", - "Could not join room, error=0x%04hx, chatnav_error=0x%04hx\n", - error, chatnav_error); - purple_notify_error(od->gc, NULL, _("Could not join chat room"), - chatnav_error == 0x0033 ? _("Invalid chat room name") : _("Unknown error")); - - ret = 1; - } - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/* - * Subtype 0x0002 - * - * conn must be a chatnav connection! - * - */ -void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_CHATNAV, 0x0002); -} - -/* - * Subtype 0x0008 - */ -int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange) -{ - static const char ck[] = {"create"}; - static const char lang[] = {"en"}; - static const char charset[] = {"us-ascii"}; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - byte_stream_new(&bs, 1142); - - snacid = aim_cachesnac(od, SNAC_FAMILY_CHATNAV, 0x0008, 0x0000, NULL, 0); - - /* exchange */ - byte_stream_put16(&bs, exchange); - - /* - * This looks to be a big hack. You'll note that this entire - * SNAC is just a room info structure, but the hard room name, - * here, is set to "create". - * - * Either this goes on the "list of questions concerning - * why-the-hell-did-you-do-that", or this value is completely - * ignored. Without experimental evidence, but a good knowledge of - * AOL style, I'm going to guess that it is the latter, and that - * the value of the room name in create requests is ignored. - */ - byte_stream_put8(&bs, strlen(ck)); - byte_stream_putstr(&bs, ck); - - /* - * instance - * - * Setting this to 0xffff apparently assigns the last instance. - * - */ - byte_stream_put16(&bs, 0xffff); - - /* detail level */ - byte_stream_put8(&bs, 0x01); - - aim_tlvlist_add_str(&tlvlist, 0x00d3, name); - aim_tlvlist_add_str(&tlvlist, 0x00d6, charset); - aim_tlvlist_add_str(&tlvlist, 0x00d7, lang); - - /* tlvcount */ - byte_stream_put16(&bs, aim_tlvlist_count(tlvlist)); - aim_tlvlist_write(&bs, &tlvlist); - - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_CHATNAV, 0x0008, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -parseinfo_perms(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs, aim_snac_t *snac2) -{ - aim_rxcallback_t userfunc; - int ret = 0; - struct aim_chat_exchangeinfo *exchanges = NULL; - int curexchange; - aim_tlv_t *exchangetlv; - guint8 maxrooms = 0; - GSList *tlvlist, *innerlist; - - tlvlist = aim_tlvlist_read(bs); - - /* - * Type 0x0002: Maximum concurrent rooms. - */ - if (aim_tlv_gettlv(tlvlist, 0x0002, 1)) - maxrooms = aim_tlv_get8(tlvlist, 0x0002, 1); - - /* - * Type 0x0003: Exchange information - * - * There can be any number of these, each one - * representing another exchange. - * - */ - for (curexchange = 0; ((exchangetlv = aim_tlv_gettlv(tlvlist, 0x0003, curexchange+1))); ) { - ByteStream tbs; - - byte_stream_init(&tbs, exchangetlv->value, exchangetlv->length); - - curexchange++; - - exchanges = g_realloc(exchanges, curexchange * sizeof(struct aim_chat_exchangeinfo)); - - /* exchange number */ - exchanges[curexchange-1].number = byte_stream_get16(&tbs); - innerlist = aim_tlvlist_read(&tbs); - -#if 0 - /* - * Type 0x000a: Unknown. - * - * Usually three bytes: 0x0114 (exchange 1) or 0x010f (others). - * - */ - if (aim_tlv_gettlv(innerlist, 0x000a, 1)) { - /* Unhandled */ - } - - /* - * Type 0x000d: Unknown. - */ - if (aim_tlv_gettlv(innerlist, 0x000d, 1)) { - /* Unhandled */ - } - - /* - * Type 0x0004: Unknown - */ - if (aim_tlv_gettlv(innerlist, 0x0004, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x0002: Unknown - */ - if (aim_tlv_gettlv(innerlist, 0x0002, 1)) { - guint16 classperms; - - classperms = aim_tlv_get16(innerlist, 0x0002, 1); - - purple_debug_misc("oscar", "faim: class permissions %x\n", classperms); - } - - /* - * Type 0x00c9: Flags - * - * 1 Evilable - * 2 Nav Only - * 4 Instancing Allowed - * 8 Occupant Peek Allowed - * - */ - if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) - exchanges[curexchange-1].flags = aim_tlv_get16(innerlist, 0x00c9, 1); - -#if 0 - /* - * Type 0x00ca: Creation Date - */ - if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d0: Mandatory Channels? - */ - if (aim_tlv_gettlv(innerlist, 0x00d0, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d1: Maximum Message length - */ - if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) { - /* Unhandled */ - } - - /* - * Type 0x00d2: Maximum Occupancy? - */ - if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00d3: Exchange Description - */ - if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) - exchanges[curexchange-1].name = aim_tlv_getstr(innerlist, 0x00d3, 1); - else - exchanges[curexchange-1].name = NULL; - -#if 0 - /* - * Type 0x00d4: Exchange Description URL - */ - if (aim_tlv_gettlv(innerlist, 0x00d4, 1)) { - /* Unhandled */ - } -#endif - - /* - * Type 0x00d5: Creation Permissions - * - * 0 Creation not allowed - * 1 Room creation allowed - * 2 Exchange creation allowed - * - */ - if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) { - guint8 createperms; - - createperms = aim_tlv_get8(innerlist, 0x00d5, 1); - } - - /* - * Type 0x00d6: Character Set (First Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d6, 1)) - exchanges[curexchange-1].charset1 = aim_tlv_getstr(innerlist, 0x00d6, 1); - else - exchanges[curexchange-1].charset1 = NULL; - - /* - * Type 0x00d7: Language (First Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d7, 1)) - exchanges[curexchange-1].lang1 = aim_tlv_getstr(innerlist, 0x00d7, 1); - else - exchanges[curexchange-1].lang1 = NULL; - - /* - * Type 0x00d8: Character Set (Second Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d8, 1)) - exchanges[curexchange-1].charset2 = aim_tlv_getstr(innerlist, 0x00d8, 1); - else - exchanges[curexchange-1].charset2 = NULL; - - /* - * Type 0x00d9: Language (Second Time) - */ - if (aim_tlv_gettlv(innerlist, 0x00d9, 1)) - exchanges[curexchange-1].lang2 = aim_tlv_getstr(innerlist, 0x00d9, 1); - else - exchanges[curexchange-1].lang2 = NULL; - -#if 0 - /* - * Type 0x00da: Unknown - */ - if (aim_tlv_gettlv(innerlist, 0x00da, 1)) { - /* Unhandled */ - } -#endif - - aim_tlvlist_free(innerlist); - } - - /* - * Call client. - */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac2->type, maxrooms, curexchange, exchanges); - - for (curexchange--; curexchange >= 0; curexchange--) { - g_free(exchanges[curexchange].name); - g_free(exchanges[curexchange].charset1); - g_free(exchanges[curexchange].lang1); - g_free(exchanges[curexchange].charset2); - g_free(exchanges[curexchange].lang2); - } - g_free(exchanges); - aim_tlvlist_free(tlvlist); - - return ret; -} - -static int -parseinfo_create(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs, aim_snac_t *snac2) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist, *innerlist; - char *ck = NULL, *fqcn = NULL, *name = NULL; - guint16 exchange = 0, instance = 0, unknown = 0, flags = 0, maxmsglen = 0, maxoccupancy = 0; - guint32 createtime = 0; - guint8 createperms = 0, detaillevel; - int cklen; - aim_tlv_t *bigblock; - int ret = 0; - ByteStream bbbs; - - tlvlist = aim_tlvlist_read(bs); - - if (!(bigblock = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { - purple_debug_misc("oscar", "no bigblock in top tlv in create room response\n"); - aim_tlvlist_free(tlvlist); - return 0; - } - - byte_stream_init(&bbbs, bigblock->value, bigblock->length); - - exchange = byte_stream_get16(&bbbs); - cklen = byte_stream_get8(&bbbs); - ck = byte_stream_getstr(&bbbs, cklen); - instance = byte_stream_get16(&bbbs); - detaillevel = byte_stream_get8(&bbbs); - - if (detaillevel != 0x02) { - purple_debug_misc("oscar", "unknown detaillevel in create room response (0x%02x)\n", detaillevel); - aim_tlvlist_free(tlvlist); - g_free(ck); - return 0; - } - - unknown = byte_stream_get16(&bbbs); - - innerlist = aim_tlvlist_read(&bbbs); - - if (aim_tlv_gettlv(innerlist, 0x006a, 1)) - fqcn = aim_tlv_getstr(innerlist, 0x006a, 1); - - if (aim_tlv_gettlv(innerlist, 0x00c9, 1)) - flags = aim_tlv_get16(innerlist, 0x00c9, 1); - - if (aim_tlv_gettlv(innerlist, 0x00ca, 1)) - createtime = aim_tlv_get32(innerlist, 0x00ca, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d1, 1)) - maxmsglen = aim_tlv_get16(innerlist, 0x00d1, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d2, 1)) - maxoccupancy = aim_tlv_get16(innerlist, 0x00d2, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d3, 1)) - name = aim_tlv_getstr(innerlist, 0x00d3, 1); - - if (aim_tlv_gettlv(innerlist, 0x00d5, 1)) - createperms = aim_tlv_get8(innerlist, 0x00d5, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - ret = userfunc(od, conn, frame, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck); - } - - g_free(ck); - g_free(name); - g_free(fqcn); - aim_tlvlist_free(innerlist); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0009 - * - * Since multiple things can trigger this callback, we must lookup the - * snacid to determine the original snac subtype that was called. - * - * XXX This isn't really how this works. But this is: Every d/9 response - * has a 16bit value at the beginning. That matches to: - * Short Desc = 1 - * Full Desc = 2 - * Instance Info = 4 - * Nav Short Desc = 8 - * Nav Instance Info = 16 - * And then everything is really asynchronous. There is no specific - * attachment of a response to a create room request, for example. Creating - * the room yields no different a response than requesting the room's info. - * - */ -static int -parseinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_snac_t *snac2; - int ret = 0; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "faim: chatnav_parse_info: received response to unknown request! (%08x)\n", snac->id); - return 0; - } - - if (snac2->family != SNAC_FAMILY_CHATNAV) { - purple_debug_misc("oscar", "faim: chatnav_parse_info: received response that maps to corrupt request! (fam=%04x)\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - /* - * We now know what the original SNAC subtype was. - */ - if (snac2->type == 0x0002) /* request chat rights */ - ret = parseinfo_perms(od, conn, mod, frame, snac, bs, snac2); - else if (snac2->type == 0x0003) /* request exchange info */ - purple_debug_misc("oscar", "chatnav_parse_info: response to exchange info\n"); - else if (snac2->type == 0x0004) /* request room info */ - purple_debug_misc("oscar", "chatnav_parse_info: response to room info\n"); - else if (snac2->type == 0x0005) /* request more room info */ - purple_debug_misc("oscar", "chatnav_parse_info: response to more room info\n"); - else if (snac2->type == 0x0006) /* request occupant list */ - purple_debug_misc("oscar", "chatnav_parse_info: response to occupant info\n"); - else if (snac2->type == 0x0007) /* search for a room */ - purple_debug_misc("oscar", "chatnav_parse_info: search results\n"); - else if (snac2->type == 0x0008) /* create room */ - ret = parseinfo_create(od, conn, mod, frame, snac, bs, snac2); - else - purple_debug_misc("oscar", "chatnav_parse_info: unknown request subtype (%04x)\n", snac2->type); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0009) - return parseinfo(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -chatnav_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_CHATNAV; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "chatnav", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_feedbag.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_feedbag.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_feedbag.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_feedbag.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1986 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0013 - Server-Side/Stored Information. - * - * Relatively new facility that allows certain types of information, such as - * a user's buddy list, permit/deny list, and permit/deny preferences, to be - * stored on the server, so that they can be accessed from any client. - * - * We keep 2 copies of SSI data: - * 1) An exact copy of what is stored on the AIM servers. - * 2) A local copy that we make changes to, and then send diffs - * between this and the exact copy to keep them in sync. - * - * All the "aim_ssi_itemlist_bleh" functions near the top just modify the list - * that is given to them (i.e. they don't send SNACs). - * - * The SNAC sending and receiving functions are lower down in the file, and - * they're simpler. They are in the order of the subtypes they deal with, - * starting with the request rights function (subtype 0x0002), then parse - * rights (subtype 0x0003), then--well, you get the idea. - * - * This is entirely too complicated. - * You don't know the half of it. - * - */ - -#include "oscar.h" - -static int aim_ssi_addmoddel(OscarData *od); - -/** - * Locally rebuild the 0x00c8 TLV in the additional data of the given group. - * - * @param list A pointer to a pointer to the current list of items. - * @param name A null terminated string containing the group name, or NULL - * if you want to modify the master group. - * @return Return a pointer to the modified item. - */ -static void -aim_ssi_itemlist_rebuildgroup(struct aim_ssi_item *list, const char *name) -{ - int newlen; - struct aim_ssi_item *cur, *group; - - /* Find the group */ - if (!(group = aim_ssi_itemlist_finditem(list, name, NULL, AIM_SSI_TYPE_GROUP))) - return; - - /* Find the length for the new additional data */ - newlen = 0; - if (group->gid == 0x0000) { - for (cur=list; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) - newlen += 2; - } else { - for (cur=list; cur; cur=cur->next) - if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) - newlen += 2; - } - - /* Build the new TLV list */ - if (newlen > 0) { - guint8 *newdata; - - newdata = (guint8 *)g_malloc((newlen)*sizeof(guint8)); - newlen = 0; - if (group->gid == 0x0000) { - for (cur=list; cur; cur=cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid != 0x0000)) - newlen += aimutil_put16(newdata+newlen, cur->gid); - } else { - for (cur=list; cur; cur=cur->next) - if ((cur->gid == group->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) - newlen += aimutil_put16(newdata+newlen, cur->bid); - } - aim_tlvlist_replace_raw(&group->data, 0x00c8, newlen, newdata); - - g_free(newdata); - } -} - -/** - * Locally add a new item to the given item list. - * - * @param list A pointer to a pointer to the current list of items. - * @param name A null terminated string of the name of the new item, or NULL if the - * item should have no name. - * @param gid The group ID# you want the new item to have, or 0xFFFF if we should pick something. - * @param bid The buddy ID# you want the new item to have, or 0xFFFF if we should pick something. - * @param type The type of the item, 0x0000 for a contact, 0x0001 for a group, etc. - * @param data The additional data for the new item. - * @return A pointer to the newly created item. - */ -static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, const char *name, guint16 gid, guint16 bid, guint16 type, GSList *data) -{ - gboolean exists; - struct aim_ssi_item *cur, *new; - - new = g_new(struct aim_ssi_item, 1); - - /* Set the name */ - new->name = g_strdup(name); - - /* Set the group ID# and buddy ID# */ - new->gid = gid; - new->bid = bid; - if (type == AIM_SSI_TYPE_GROUP) { - if ((new->gid == 0xFFFF) && name) { - do { - new->gid += 0x0001; - exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) - if ((cur->type == AIM_SSI_TYPE_GROUP) && (cur->gid == new->gid)) { - exists = TRUE; - break; - } - } while (exists); - } - } else if (new->gid == 0x0000) { - /* - * This is weird, but apparently items in the root group can't - * have a buddy ID equal to any group ID. You'll get error - * 0x0003 when trying to add, which is "item already exists" - */ - if (new->bid == 0xFFFF) { - do { - new->bid += 0x0001; - exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) - if (cur->bid == new->bid || cur->gid == new->bid) { - exists = TRUE; - break; - } - } while (exists); - } - } else { - if (new->bid == 0xFFFF) { - do { - new->bid += 0x0001; - exists = FALSE; - for (cur = *list; cur != NULL; cur = cur->next) - if (cur->bid == new->bid && cur->gid == new->gid) { - exists = TRUE; - break; - } - } while (exists); - } - } - - /* Set the type */ - new->type = type; - - /* Set the TLV list */ - new->data = aim_tlvlist_copy(data); - - /* Add the item to the list in the correct numerical position. Fancy, eh? */ - if (*list) { - if ((new->gid < (*list)->gid) || ((new->gid == (*list)->gid) && (new->bid < (*list)->bid))) { - new->next = *list; - *list = new; - } else { - struct aim_ssi_item *prev; - for ((prev=*list, cur=(*list)->next); (cur && ((new->gid > cur->gid) || ((new->gid == cur->gid) && (new->bid > cur->bid)))); prev=cur, cur=cur->next); - new->next = prev->next; - prev->next = new; - } - } else { - new->next = *list; - *list = new; - } - - return new; -} - -/** - * Locally delete an item from the given item list. - * - * @param list A pointer to a pointer to the current list of items. - * @param del A pointer to the item you want to remove from the list. - * @return Return 0 if no errors, otherwise return the error number. - */ -static int aim_ssi_itemlist_del(struct aim_ssi_item **list, struct aim_ssi_item *del) -{ - if (!(*list) || !del) - return -EINVAL; - - /* Remove the item from the list */ - if (*list == del) { - *list = (*list)->next; - } else { - struct aim_ssi_item *cur; - for (cur=*list; (cur->next && (cur->next!=del)); cur=cur->next); - if (cur->next) - cur->next = del->next; - } - - /* Free the removed item */ - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); - - return 0; -} - -/** - * Compare two items to see if they have the same data. - * - * @param cur1 A pointer to a pointer to the first item. - * @param cur2 A pointer to a pointer to the second item. - * @return Return 0 if no differences, or a number if there are differences. - */ -static int aim_ssi_itemlist_cmp(struct aim_ssi_item *cur1, struct aim_ssi_item *cur2) -{ - if (!cur1 || !cur2) - return 1; - - if (cur1->data && !cur2->data) - return 2; - - if (!cur1->data && cur2->data) - return 3; - - if ((cur1->data && cur2->data) && (aim_tlvlist_cmp(cur1->data, cur2->data))) - return 4; - - if (cur1->name && !cur2->name) - return 5; - - if (!cur1->name && cur2->name) - return 6; - - if (cur1->name && cur2->name && oscar_util_name_compare(cur1->name, cur2->name)) - return 7; - - if (cur1->gid != cur2->gid) - return 8; - - if (cur1->bid != cur2->bid) - return 9; - - if (cur1->type != cur2->type) - return 10; - - return 0; -} - -static gboolean aim_ssi_itemlist_valid(struct aim_ssi_item *list, struct aim_ssi_item *item) -{ - struct aim_ssi_item *cur; - for (cur=list; cur; cur=cur->next) - if (cur == item) - return TRUE; - return FALSE; -} - -/** - * Locally find an item given a group ID# and a buddy ID#. - * - * @param list A pointer to the current list of items. - * @param gid The group ID# of the desired item. - * @param bid The buddy ID# of the desired item. - * @return Return a pointer to the item if found, else return NULL; - */ -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid) -{ - struct aim_ssi_item *cur; - for (cur=list; cur; cur=cur->next) - if ((cur->gid == gid) && (cur->bid == bid)) - return cur; - return NULL; -} - -/** - * Locally find an item given a group name, buddy name, and type. If group name - * and buddy name are null, then just return the first item of the given type. - * - * @param list A pointer to the current list of items. - * @param gn The group name of the desired item. - * @param bn The buddy name of the desired item. - * @param type The type of the desired item. - * @return Return a pointer to the item if found, else return NULL. - */ -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type) -{ - struct aim_ssi_item *cur; - if (!list) - return NULL; - - if (gn && bn) { /* For finding buddies in groups */ - for (cur=list; cur; cur=cur->next) - if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { - struct aim_ssi_item *curg; - for (curg=list; curg; curg=curg->next) - if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) && (curg->name) && !(oscar_util_name_compare(curg->name, gn))) - return cur; - } - - } else if (gn) { /* For finding groups */ - for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (cur->bid == 0x0000) && (cur->name) && !(oscar_util_name_compare(cur->name, gn))) { - return cur; - } - } - - } else if (bn) { /* For finding permits, denies, and ignores */ - for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (cur->name) && !(oscar_util_name_compare(cur->name, bn))) { - return cur; - } - } - - /* For stuff without names--permit deny setting, visibility mask, etc. */ - } else for (cur=list; cur; cur=cur->next) { - if ((cur->type == type) && (!cur->name)) - return cur; - } - - return NULL; -} - -/** - * Check if the given buddy exists in any group in the buddy list. - * - * @param list A pointer to the current list of items. - * @param bn The group name of the desired item. - * @return Return a pointer to the name of the item if found, else return NULL; - */ -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn) -{ - if (!bn) - return NULL; - return aim_ssi_itemlist_finditem(list, NULL, bn, AIM_SSI_TYPE_BUDDY); -} - -/** - * Locally find the parent item of the given buddy name. - * - * @param list A pointer to the current list of items. - * @param bn The buddy name of the desired item. - * @return Return a pointer to the name of the item if found, else return NULL; - */ -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn) -{ - struct aim_ssi_item *cur, *curg; - if (!list || !bn) - return NULL; - if (!(cur = aim_ssi_itemlist_exists(list, bn))) - return NULL; - if (!(curg = aim_ssi_itemlist_find(list, cur->gid, 0x0000))) - return NULL; - return curg->name; -} - -/** - * Locally find the permit/deny setting item, and return the setting. - * - * @param list A pointer to the current list of items. - * @return Return the current SSI permit deny setting, or 0 if no setting was found. - */ -int aim_ssi_getpermdeny(struct aim_ssi_item *list) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PDINFO); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00ca, 1); - if (tlv && tlv->value) - return aimutil_get8(tlv->value); - } - return 0; -} - -/** - * Locally find the presence flag item, and return the setting. The returned setting is a - * bitmask of the preferences. See the AIM_SSI_PRESENCE_FLAG_* #defines in oscar.h. - * - * @param list A pointer to the current list of items. - * @return Return the current set of preferences. - */ -guint32 aim_ssi_getpresence(struct aim_ssi_item *list) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x00c9, 1); - if (tlv && tlv->length) - return aimutil_get32(tlv->value); - } - return 0xFFFFFFFF; -} - -/** - * Locally find the alias of the given buddy. - * - * @param list A pointer to the current list of items. - * @param gn The group of the buddy. - * @param bn The name of the buddy. - * @return A pointer to a NULL terminated string that is the buddy's - * alias, or NULL if the buddy has no alias. You should free - * this returned value! - */ -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x0131, 1); - if (tlv && tlv->length) - return g_strndup((const gchar *)tlv->value, tlv->length); - } - return NULL; -} - -/** - * Locally find the comment of the given buddy. - * - * @param list A pointer to the current list of items. - * @param gn The group of the buddy. - * @param bn The name of the buddy. - * @return A pointer to a NULL terminated string that is the buddy's - * comment, or NULL if the buddy has no comment. You should free - * this returned value! - */ -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - aim_tlv_t *tlv = aim_tlv_gettlv(cur->data, 0x013c, 1); - if (tlv && tlv->length) { - return g_strndup((const gchar *)tlv->value, tlv->length); - } - } - return NULL; -} - -/** - * Locally find if you are waiting for authorization for a buddy. - * - * @param list A pointer to the current list of items. - * @param gn The group of the buddy. - * @param bn The name of the buddy. - * @return 1 if you are waiting for authorization; 0 if you are not - */ -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn) -{ - struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, gn, bn, AIM_SSI_TYPE_BUDDY); - if (cur) { - if (aim_tlv_gettlv(cur->data, 0x0066, 1)) - return TRUE; - } - return FALSE; -} - -/** - * If there are changes, then create temporary items and - * call addmoddel. - * - * @param od The oscar session. - * @return Return 0 if no errors, otherwise return the error number. - */ -static int aim_ssi_sync(OscarData *od) -{ - struct aim_ssi_item *cur1, *cur2; - struct aim_ssi_tmp *cur, *new; - int n = 0; - - /* - * The variable "n" is used to limit the number of addmoddel's that - * are performed in a single SNAC. It will hopefully keep the size - * of the SNAC below the maximum SNAC size. - */ - - if (!od) - return -EINVAL; - - /* If we're waiting for an ack, we shouldn't do anything else */ - if (od->ssi.waiting_for_ack) - return 0; - - /* - * Compare the 2 lists and create an aim_ssi_tmp for each difference. - * We should only send either additions, modifications, or deletions - * before waiting for an acknowledgement. So first do deletions, then - * additions, then modifications. Also, both the official and the local - * list should be in ascending numerical order for the group ID#s and the - * buddy ID#s, which makes things more efficient. I think. - */ - - /* Deletions */ - if (!od->ssi.pending) { - for (cur1=od->ssi.official; cur1 && (n < 15); cur1=cur1->next) { - if (!aim_ssi_itemlist_find(od->ssi.local, cur1->gid, cur1->bid)) { - n++; - new = g_new(struct aim_ssi_tmp, 1); - new->action = SNAC_SUBTYPE_FEEDBAG_DEL; - new->ack = 0xffff; - new->name = NULL; - new->item = cur1; - new->next = NULL; - if (od->ssi.pending) { - for (cur=od->ssi.pending; cur->next; cur=cur->next); - cur->next = new; - } else - od->ssi.pending = new; - } - } - } - - /* Additions */ - if (!od->ssi.pending) { - for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { - if (!aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid)) { - n++; - new = g_new(struct aim_ssi_tmp, 1); - new->action = SNAC_SUBTYPE_FEEDBAG_ADD; - new->ack = 0xffff; - new->name = NULL; - new->item = cur1; - new->next = NULL; - if (od->ssi.pending) { - for (cur=od->ssi.pending; cur->next; cur=cur->next); - cur->next = new; - } else - od->ssi.pending = new; - } - } - } - - /* Modifications */ - if (!od->ssi.pending) { - for (cur1=od->ssi.local; cur1 && (n < 15); cur1=cur1->next) { - cur2 = aim_ssi_itemlist_find(od->ssi.official, cur1->gid, cur1->bid); - if (cur2 && (aim_ssi_itemlist_cmp(cur1, cur2))) { - n++; - new = g_new(struct aim_ssi_tmp, 1); - new->action = SNAC_SUBTYPE_FEEDBAG_MOD; - new->ack = 0xffff; - new->name = NULL; - new->item = cur1; - new->next = NULL; - if (od->ssi.pending) { - for (cur=od->ssi.pending; cur->next; cur=cur->next); - cur->next = new; - } else - od->ssi.pending = new; - } - } - } - - /* We're out of stuff to do, so tell the AIM servers we're done and exit */ - if (!od->ssi.pending) { - if (od->ssi.in_transaction) { - aim_ssi_modend(od); - od->ssi.in_transaction = FALSE; - } - return 0; - } - - /* If this is the first in a series of add/mod/del - * requests then send the "begin transaction" message. */ - if (!od->ssi.in_transaction) - { - aim_ssi_modbegin(od); - od->ssi.in_transaction = TRUE; - } - - /* Make sure we don't send anything else between now - * and when we receive the ack for the following operation */ - od->ssi.waiting_for_ack = TRUE; - - /* Now go mail off our data and wait 4 to 6 weeks */ - return aim_ssi_addmoddel(od);; -} - -/** - * Free all SSI data. - * - * This doesn't remove it from the server, that's different. - * - * @param od The oscar odion. - * @return Return 0 if no errors, otherwise return the error number. - */ -static void -aim_ssi_freelist(OscarData *od) -{ - struct aim_ssi_item *cur, *del; - struct aim_ssi_tmp *curtmp, *deltmp; - - cur = od->ssi.official; - while (cur) { - del = cur; - cur = cur->next; - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); - } - - cur = od->ssi.local; - while (cur) { - del = cur; - cur = cur->next; - g_free(del->name); - aim_tlvlist_free(del->data); - g_free(del); - } - - curtmp = od->ssi.pending; - while (curtmp) { - deltmp = curtmp; - curtmp = curtmp->next; - g_free(deltmp); - } - - od->ssi.numitems = 0; - od->ssi.official = NULL; - od->ssi.local = NULL; - od->ssi.pending = NULL; - od->ssi.timestamp = (time_t)0; -} - -/** - * This "cleans" the ssi list. It does the following: - * 1) Makes sure all buddies, permits, and denies have names. - * 2) Makes sure that all buddies are in a group that exist. - * 3) Deletes any empty groups - * - * @param od The oscar odion. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_cleanlist(OscarData *od) -{ - struct aim_ssi_item *cur, *next; - - if (!od) - return -EINVAL; - - /* Delete any buddies, permits, or denies with empty names. */ - /* If there are any buddies directly in the master group, add them to a real group. */ - /* DESTROY any buddies that are directly in the master group. */ - /* Do the same for buddies that are in a non-existant group. */ - /* This will kind of mess up if you hit the item limit, but this function isn't too critical */ - cur = od->ssi.local; - while (cur) { - next = cur->next; - if (!cur->name) { - if (cur->type == AIM_SSI_TYPE_BUDDY) - aim_ssi_delbuddy(od, NULL, NULL); - else if (cur->type == AIM_SSI_TYPE_PERMIT) - aim_ssi_delpermit(od, NULL); - else if (cur->type == AIM_SSI_TYPE_DENY) - aim_ssi_deldeny(od, NULL); - } else if ((cur->type == AIM_SSI_TYPE_BUDDY) && ((cur->gid == 0x0000) || (!aim_ssi_itemlist_find(od->ssi.local, cur->gid, 0x0000)))) { - char *alias = aim_ssi_getalias(od->ssi.local, NULL, cur->name); - aim_ssi_addbuddy(od, cur->name, "orphans", NULL, alias, NULL, NULL, FALSE); - aim_ssi_delbuddy(od, cur->name, NULL); - g_free(alias); - } - cur = next; - } - - /* Make sure there aren't any duplicate buddies in a group, or duplicate permits or denies */ - cur = od->ssi.local; - while (cur) { - if ((cur->type == AIM_SSI_TYPE_BUDDY) || (cur->type == AIM_SSI_TYPE_PERMIT) || (cur->type == AIM_SSI_TYPE_DENY)) - { - struct aim_ssi_item *cur2, *next2; - cur2 = cur->next; - while (cur2) { - next2 = cur2->next; - if ((cur->type == cur2->type) && (cur->gid == cur2->gid) && (cur->name != NULL) && (cur2->name != NULL) && (!oscar_util_name_compare(cur->name, cur2->name))) { - aim_ssi_itemlist_del(&od->ssi.local, cur2); - } - cur2 = next2; - } - } - cur = cur->next; - } - - /* If we've made any changes then sync our list with the server's */ - return aim_ssi_sync(od); -} - -/** - * Add a buddy to the list. - * - * @param od The oscar odion. - * @param name The name of the item. - * @param group The group of the item. - * @param data A TLV list to use as the additional data for this item. - * @param alias The alias/nickname of the item, or NULL. - * @param comment The buddy comment for the item, or NULL. - * @param smsnum The locally assigned SMS number, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *data, const char *alias, const char *comment, const char *smsnum, gboolean needauth) -{ - struct aim_ssi_item *parent; - - if (!od || !name || !group) - return -EINVAL; - - /* Find the parent */ - if (!(parent = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) { - /* Find the parent's parent (the master group) */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Add the parent */ - parent = aim_ssi_itemlist_add(&od->ssi.local, group, 0xFFFF, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Modify the parent's parent (the master group) */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, NULL); - } - - /* Create a TLV list for the new buddy */ - if (needauth) - aim_tlvlist_add_noval(&data, 0x0066); - if (alias != NULL) - aim_tlvlist_add_str(&data, 0x0131, alias); - if (smsnum != NULL) - aim_tlvlist_add_str(&data, 0x013a, smsnum); - if (comment != NULL) - aim_tlvlist_add_str(&data, 0x013c, comment); - - /* Add that bad boy */ - aim_ssi_itemlist_add(&od->ssi.local, name, parent->gid, 0xFFFF, AIM_SSI_TYPE_BUDDY, data); - aim_tlvlist_free(data); - - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Add a permit buddy to the list. - * - * @param od The oscar odion. - * @param name The name of the item.. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_addpermit(OscarData *od, const char *name) -{ - - if (!od || !name || !od->ssi.received_data) - return -EINVAL; - - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Add that bad boy */ - aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_PERMIT, NULL); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Add a deny buddy to the list. - * - * @param od The oscar odion. - * @param name The name of the item.. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_adddeny(OscarData *od, const char *name) -{ - - if (!od || !name || !od->ssi.received_data) - return -EINVAL; - - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - /* Add that bad boy */ - aim_ssi_itemlist_add(&od->ssi.local, name, 0x0000, 0xFFFF, AIM_SSI_TYPE_DENY, NULL); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a buddy from the list. - * - * @param od The oscar odion. - * @param name The name of the item, or NULL. - * @param group The group of the item, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group) -{ - struct aim_ssi_item *del; - - if (!od) - return -EINVAL; - - /* Find the buddy */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, name, AIM_SSI_TYPE_BUDDY))) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a group from the list. - * - * @param od The oscar odion. - * @param group The name of the group. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delgroup(OscarData *od, const char *group) -{ - struct aim_ssi_item *del; - aim_tlv_t *tlv; - - if (!od) - return -EINVAL; - - /* Find the group */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, group, NULL, AIM_SSI_TYPE_GROUP))) - return -EINVAL; - - /* Don't delete the group if it's not empty */ - tlv = aim_tlv_gettlv(del->data, 0x00c8, 1); - if (tlv && tlv->length > 0) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Modify the parent group */ - aim_ssi_itemlist_rebuildgroup(od->ssi.local, group); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a permit buddy from the list. - * - * @param od The oscar odion. - * @param name The name of the item, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delpermit(OscarData *od, const char *name) -{ - struct aim_ssi_item *del; - - if (!od) - return -EINVAL; - - /* Find the item */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, NULL, name, AIM_SSI_TYPE_PERMIT))) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Deletes a deny buddy from the list. - * - * @param od The oscar odion. - * @param name The name of the item, or NULL. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_deldeny(OscarData *od, const char *name) -{ - struct aim_ssi_item *del; - - if (!od) - return -EINVAL; - - /* Find the item */ - if (!(del = aim_ssi_itemlist_finditem(od->ssi.local, NULL, name, AIM_SSI_TYPE_DENY))) - return -EINVAL; - - /* Remove the item from the list */ - aim_ssi_itemlist_del(&od->ssi.local, del); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Move a buddy from one group to another group. This basically just deletes the - * buddy and re-adds it. - * - * @param od The oscar odion. - * @param oldgn The group that the buddy is currently in. - * @param newgn The group that the buddy should be moved in to. - * @param bn The name of the buddy to be moved. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *bn) -{ - struct aim_ssi_item *buddy; - GSList *data; - - /* Find the buddy */ - buddy = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, bn, AIM_SSI_TYPE_BUDDY); - if (buddy == NULL) - return -EINVAL; - - /* Make a copy of the buddy's TLV list */ - data = aim_tlvlist_copy(buddy->data); - - /* Delete the old item */ - aim_ssi_delbuddy(od, bn, oldgn); - - /* Add the new item using the EXACT SAME TLV list */ - aim_ssi_addbuddy(od, bn, newgn, data, NULL, NULL, NULL, FALSE); - - return 0; -} - -/** - * Change the alias stored on the server for a given buddy. - * - * @param od The oscar odion. - * @param gn The group that the buddy is currently in. - * @param bn The name of the buddy. - * @param alias The new alias for the buddy, or NULL if you want to remove - * a buddy's comment. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias) -{ - struct aim_ssi_item *tmp; - - if (!od || !gn || !bn) - return -EINVAL; - - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) - return -EINVAL; - - /* Either add or remove the 0x0131 TLV from the TLV chain */ - if ((alias != NULL) && (strlen(alias) > 0)) - aim_tlvlist_replace_str(&tmp->data, 0x0131, alias); - else - aim_tlvlist_remove(&tmp->data, 0x0131); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Change the comment stored on the server for a given buddy. - * - * @param od The oscar odion. - * @param gn The group that the buddy is currently in. - * @param bn The name of the buddy. - * @param alias The new comment for the buddy, or NULL if you want to remove - * a buddy's comment. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *comment) -{ - struct aim_ssi_item *tmp; - - if (!od || !gn || !bn) - return -EINVAL; - - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, gn, bn, AIM_SSI_TYPE_BUDDY))) - return -EINVAL; - - /* Either add or remove the 0x0131 TLV from the TLV chain */ - if ((comment != NULL) && (strlen(comment) > 0)) - aim_tlvlist_replace_str(&tmp->data, 0x013c, comment); - else - aim_tlvlist_remove(&tmp->data, 0x013c); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Rename a group. - * - * @param od The oscar odion. - * @param oldgn The old group name. - * @param newgn The new group name. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn) -{ - struct aim_ssi_item *group; - - if (!od || !oldgn || !newgn) - return -EINVAL; - - if (!(group = aim_ssi_itemlist_finditem(od->ssi.local, oldgn, NULL, AIM_SSI_TYPE_GROUP))) - return -EINVAL; - - g_free(group->name); - group->name = g_strdup(newgn); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Stores your permit/deny setting on the server, and starts using it. - * - * @param od The oscar odion. - * @param permdeny Your permit/deny setting. Can be one of the following: - * 1 - Allow all users - * 2 - Block all users - * 3 - Allow only the users below - * 4 - Block only the users below - * 5 - Allow only users on my buddy list - * @param vismask A bitmask of the class of users to whom you want to be - * visible. See the AIM_FLAG_BLEH #defines in oscar.h - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask) -{ - struct aim_ssi_item *tmp; - - if (!od || !od->ssi.received_data) - return -EINVAL; - - /* Find the PDINFO item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PDINFO))) { - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PDINFO, NULL); - } - - /* Need to add the 0x00ca TLV to the TLV chain */ - aim_tlvlist_replace_8(&tmp->data, 0x00ca, permdeny); - - /* Need to add the 0x00cb TLV to the TLV chain */ - aim_tlvlist_replace_32(&tmp->data, 0x00cb, vismask); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/** - * Set buddy icon information - * - * @param od The oscar odion. - * @param iconcsum The MD5 checksum of the icon you are using. - * @param iconcsumlen Length of the MD5 checksum given above. Should be 0x10 bytes. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen) -{ - struct aim_ssi_item *tmp; - guint8 *csumdata; - - if (!od || !iconsum || !iconsumlen || !od->ssi.received_data) - return -EINVAL; - - /* Find the ICONINFO item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL); - } - - /* Need to add the 0x00d5 TLV to the TLV chain */ - csumdata = (guint8 *)g_malloc((iconsumlen+2)*sizeof(guint8)); - aimutil_put8(&csumdata[0], 0x00); - aimutil_put8(&csumdata[1], iconsumlen); - memcpy(&csumdata[2], iconsum, iconsumlen); - aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata); - g_free(csumdata); - - /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */ - aim_tlvlist_replace_noval(&tmp->data, 0x0131); - - /* Sync our local list with the server list */ - aim_ssi_sync(od); - return 0; -} - -/** - * Remove a reference to a server stored buddy icon. This will make your - * icon stop showing up to other people. - * - * Really this function just sets the icon to a dummy value. It's weird... - * but I think the dummy value basically means "I don't have an icon!" - * - * @param od The oscar session. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_delicon(OscarData *od) -{ - const guint8 csumdata[] = {0x02, 0x01, 0xd2, 0x04, 0x72}; - - return aim_ssi_seticon(od, csumdata, 5); -} - -/** - * Stores your setting for various SSI settings. Whether you - * should show up as idle or not, etc. - * - * @param od The oscar odion. - * @param presence A bitmask of the first 32 entries [0-31] from - * http://dev.aol.com/aim/oscar/#FEEDBAG__BUDDY_PREFS - * 0x00000002 - Hide "eBuddy group" (whatever that is) - * 0x00000400 - Allow others to see your idle time - * 0x00020000 - Don't show Recent Buddies - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_ssi_setpresence(OscarData *od, guint32 presence) { - struct aim_ssi_item *tmp; - - if (!od || !od->ssi.received_data) - return -EINVAL; - - /* Find the PRESENCEPREFS item, or add it if it does not exist */ - if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, NULL, AIM_SSI_TYPE_PRESENCEPREFS))) { - /* Make sure the master group exists */ - if (aim_ssi_itemlist_find(od->ssi.local, 0x0000, 0x0000) == NULL) - aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0x0000, AIM_SSI_TYPE_GROUP, NULL); - - tmp = aim_ssi_itemlist_add(&od->ssi.local, NULL, 0x0000, 0xFFFF, AIM_SSI_TYPE_PRESENCEPREFS, NULL); - } - - /* Need to add the x00c9 TLV to the TLV chain */ - aim_tlvlist_replace_32(&tmp->data, 0x00c9, presence); - - /* Sync our local list with the server list */ - return aim_ssi_sync(od); -} - -/* - * Subtype 0x0002 - Request SSI Rights. - */ -int aim_ssi_reqrights(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQRIGHTS); - - return 0; -} - -/* - * Subtype 0x0003 - SSI Rights Information. - */ -static int parserights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0, i; - aim_rxcallback_t userfunc; - GSList *tlvlist; - aim_tlv_t *tlv; - ByteStream bstream; - guint16 *maxitems; - - /* This SNAC is made up of a bunch of TLVs */ - tlvlist = aim_tlvlist_read(bs); - - /* TLV 0x0004 contains the maximum number of each item */ - if (!(tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { - aim_tlvlist_free(tlvlist); - return 0; - } - - byte_stream_init(&bstream, tlv->value, tlv->length); - - maxitems = (guint16 *)g_malloc((tlv->length/2)*sizeof(guint16)); - - for (i=0; i<(tlv->length/2); i++) - maxitems[i] = byte_stream_get16(&bstream); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, tlv->length/2, maxitems); - - aim_tlvlist_free(tlvlist); - g_free(maxitems); - - return ret; -} - -/* - * Subtype 0x0004 - Request SSI Data when you don't have a timestamp and - * revision number. - * - */ -int aim_ssi_reqdata(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - /* Free any current data, just in case */ - aim_ssi_freelist(od); - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQDATA); - - return 0; -} - -/* - * Subtype 0x0005 - Request SSI Data when you have a timestamp and revision - * number. - * - * The data will only be sent if it is newer than the posted local - * timestamp and revision. - * - * Note that the client should never increment the revision, only the server. - * - */ -int aim_ssi_reqifchanged(OscarData *od, time_t timestamp, guint16 numitems) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - byte_stream_new(&bs, 4+2); - - byte_stream_put32(&bs, timestamp); - byte_stream_put16(&bs, numitems); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQIFCHANGED, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_REQIFCHANGED, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - /* Free any current data, just in case */ - aim_ssi_freelist(od); - - return 0; -} - -/* - * Subtype 0x0006 - SSI Data. - */ -static int parsedata(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint8 fmtver; /* guess */ - guint16 namelen, gid, bid, type; - char *name; - GSList *data; - - fmtver = byte_stream_get8(bs); /* Version of ssi data. Should be 0x00 */ - od->ssi.numitems += byte_stream_get16(bs); /* # of items in this SSI SNAC */ - - /* Read in the list */ - while (byte_stream_empty(bs) > 4) { /* last four bytes are timestamp */ - if ((namelen = byte_stream_get16(bs))) - name = byte_stream_getstr(bs, namelen); - else - name = NULL; - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - type = byte_stream_get16(bs); - data = aim_tlvlist_readlen(bs, byte_stream_get16(bs)); - aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data); - g_free(name); - aim_tlvlist_free(data); - } - - /* Read in the timestamp */ - od->ssi.timestamp = byte_stream_get32(bs); - - if (!(snac->flags & 0x0001)) { - /* Make a copy of the list */ - struct aim_ssi_item *cur; - for (cur=od->ssi.official; cur; cur=cur->next) - aim_ssi_itemlist_add(&od->ssi.local, cur->name, cur->gid, cur->bid, cur->type, cur->data); - - od->ssi.received_data = TRUE; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, fmtver, od->ssi.numitems, od->ssi.timestamp); - } - - return ret; -} - -/* - * Subtype 0x0007 - SSI Activate Data. - * - * Should be sent after receiving 13/6 or 13/f to tell the server you - * are ready to begin using the list. It will promptly give you the - * presence information for everyone in your list and put your permit/deny - * settings into effect. - * - */ -int aim_ssi_enable(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, 0x0007); - - return 0; -} - -/* - * Subtype 0x0008/0x0009/0x000a - SSI Add/Mod/Del Item(s). - * - * Sends the SNAC to add, modify, or delete items from the server-stored - * information. These 3 SNACs all have an identical structure. The only - * difference is the subtype that is set for the SNAC. - * - */ -static int aim_ssi_addmoddel(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - struct aim_ssi_tmp *cur; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !od->ssi.pending || !od->ssi.pending->item) - return -EINVAL; - - /* Calculate total SNAC size */ - bslen = 0; - for (cur=od->ssi.pending; cur; cur=cur->next) { - bslen += 10; /* For length, GID, BID, type, and length */ - if (cur->item->name) - bslen += strlen(cur->item->name); - if (cur->item->data) - bslen += aim_tlvlist_size(cur->item->data); - } - - byte_stream_new(&bs, bslen); - - for (cur=od->ssi.pending; cur; cur=cur->next) { - byte_stream_put16(&bs, cur->item->name ? strlen(cur->item->name) : 0); - if (cur->item->name) - byte_stream_putstr(&bs, cur->item->name); - byte_stream_put16(&bs, cur->item->gid); - byte_stream_put16(&bs, cur->item->bid); - byte_stream_put16(&bs, cur->item->type); - byte_stream_put16(&bs, cur->item->data ? aim_tlvlist_size(cur->item->data) : 0); - if (cur->item->data) - aim_tlvlist_write(&bs, &cur->item->data); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, od->ssi.pending->action, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, od->ssi.pending->action, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0008 - Incoming SSI add. - * - * Sent by the server, for example, when someone is added to - * your "Recent Buddies" group. - */ -static int parseadd(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *name; - guint16 len, gid, bid, type; - GSList *data; - - while (byte_stream_empty(bs)) { - if ((len = byte_stream_get16(bs))) - name = byte_stream_getstr(bs, len); - else - name = NULL; - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - type = byte_stream_get16(bs); - if ((len = byte_stream_get16(bs))) - data = aim_tlvlist_readlen(bs, len); - else - data = NULL; - - aim_ssi_itemlist_add(&od->ssi.local, name, gid, bid, type, data); - aim_ssi_itemlist_add(&od->ssi.official, name, gid, bid, type, data); - aim_tlvlist_free(data); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac->subtype, type, name); - - g_free(name); - } - - return ret; -} - -/* - * Subtype 0x0009 - Incoming SSI mod. - */ -static int parsemod(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *name; - guint16 len, gid, bid, type; - GSList *data; - struct aim_ssi_item *item; - - while (byte_stream_empty(bs)) { - if ((len = byte_stream_get16(bs))) - name = byte_stream_getstr(bs, len); - else - name = NULL; - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - type = byte_stream_get16(bs); - if ((len = byte_stream_get16(bs))) - data = aim_tlvlist_readlen(bs, len); - else - data = NULL; - - /* Replace the 2 local items with the given one */ - if ((item = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) { - item->type = type; - g_free(item->name); - item->name = g_strdup(name); - aim_tlvlist_free(item->data); - item->data = aim_tlvlist_copy(data); - } - - if ((item = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) { - item->type = type; - g_free(item->name); - item->name = g_strdup(name); - aim_tlvlist_free(item->data); - item->data = aim_tlvlist_copy(data); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac->subtype, type, name); - - g_free(name); - aim_tlvlist_free(data); - } - - return ret; -} - -/* - * Subtype 0x000a - Incoming SSI del. - * - * XXX - It would probably be good for the client to actually do something when it gets this. - */ -static int parsedel(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 gid, bid; - struct aim_ssi_item *del; - - while (byte_stream_empty(bs)) { - byte_stream_advance(bs, byte_stream_get16(bs)); - gid = byte_stream_get16(bs); - bid = byte_stream_get16(bs); - byte_stream_get16(bs); - byte_stream_advance(bs, byte_stream_get16(bs)); - - if ((del = aim_ssi_itemlist_find(od->ssi.local, gid, bid))) - aim_ssi_itemlist_del(&od->ssi.local, del); - if ((del = aim_ssi_itemlist_find(od->ssi.official, gid, bid))) - aim_ssi_itemlist_del(&od->ssi.official, del); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - } - - return ret; -} - -/* - * Subtype 0x000e - SSI Add/Mod/Del Ack. - * - * Response to add, modify, or delete SNAC (sent with aim_ssi_addmoddel). - * - */ -static int parseack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - struct aim_ssi_tmp *cur, *del; - - /* Read in the success/failure flags from the ack SNAC */ - cur = od->ssi.pending; - while (cur && (byte_stream_empty(bs)>0)) { - cur->ack = byte_stream_get16(bs); - cur = cur->next; - } - - /* - * If outcome is 0, then add the item to the item list, or replace the other item, - * or remove the old item. If outcome is non-zero, then remove the item from the - * local list, or unmodify it, or add it. - */ - for (cur=od->ssi.pending; (cur && (cur->ack != 0xffff)); cur=cur->next) { - if (cur->item) { - if (cur->ack) { - /* Our action was unsuccessful, so change the local list back to how it was */ - if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { - /* Remove the item from the local list */ - /* Make sure cur->item is still valid memory */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - cur->name = g_strdup(cur->item->name); - aim_ssi_itemlist_del(&od->ssi.local, cur->item); - } - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { - /* Replace the local item with the item from the official list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { - g_free(cur->item->name); - cur->item->name = g_strdup(cur1->name); - aim_tlvlist_free(cur->item->data); - cur->item->data = aim_tlvlist_copy(cur1->data); - } - } else - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { - /* Add the item back into the local list */ - if (aim_ssi_itemlist_valid(od->ssi.official, cur->item)) { - aim_ssi_itemlist_add(&od->ssi.local, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); - } else - cur->item = NULL; - } - - } else { - /* Do the exact opposite */ - if (cur->action == SNAC_SUBTYPE_FEEDBAG_ADD) { - /* Add the local item to the official list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - aim_ssi_itemlist_add(&od->ssi.official, cur->item->name, cur->item->gid, cur->item->bid, cur->item->type, cur->item->data); - } else - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_MOD) { - /* Replace the official item with the item from the local list */ - if (aim_ssi_itemlist_valid(od->ssi.local, cur->item)) { - struct aim_ssi_item *cur1; - if ((cur1 = aim_ssi_itemlist_find(od->ssi.official, cur->item->gid, cur->item->bid))) { - g_free(cur1->name); - cur1->name = g_strdup(cur->item->name); - aim_tlvlist_free(cur1->data); - cur1->data = aim_tlvlist_copy(cur->item->data); - } - } else - cur->item = NULL; - - } else if (cur->action == SNAC_SUBTYPE_FEEDBAG_DEL) { - /* Remove the item from the official list */ - if (aim_ssi_itemlist_valid(od->ssi.official, cur->item)) - aim_ssi_itemlist_del(&od->ssi.official, cur->item); - cur->item = NULL; - } - - } - } /* End if (cur->item) */ - } /* End for loop */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, od->ssi.pending); - - /* Free all aim_ssi_tmp's with an outcome */ - cur = od->ssi.pending; - while (cur && (cur->ack != 0xffff)) { - del = cur; - cur = cur->next; - g_free(del->name); - g_free(del); - } - od->ssi.pending = cur; - - /* If we're not waiting for any more acks, then send more SNACs */ - if (!od->ssi.pending) { - od->ssi.waiting_for_ack = FALSE; - aim_ssi_sync(od); - } - - return ret; -} - -/* - * Subtype 0x000f - SSI Data Unchanged. - * - * Response to aim_ssi_reqifchanged() if the server-side data is not newer than - * posted local stamp/revision. - * - */ -static int parsedataunchanged(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - od->ssi.received_data = TRUE; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/* - * Subtype 0x0011 - SSI Begin Data Modification. - * - * Tell the server you're going to start modifying data. This marks - * the beginning of a transaction. - */ -int aim_ssi_modbegin(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTART); - - return 0; -} - -/* - * Subtype 0x0012 - SSI End Data Modification. - * - * Tell the server you're finished modifying data. The marks the end - * of a transaction. - */ -int aim_ssi_modend(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_EDITSTOP); - - return 0; -} - -/* - * Subtype 0x0014 - Grant authorization - * - * Authorizes a contact so they can add you to their contact list. - * - */ -int aim_ssi_sendauth(OscarData *od, char *bn, char *msg) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 2+(msg ? strlen(msg)+1 : 0) + 2); - - /* Username */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Message (null terminated) */ - byte_stream_put16(&bs, msg ? strlen(msg) : 0); - if (msg) { - byte_stream_putstr(&bs, msg); - byte_stream_put8(&bs, 0x00); - } - - /* Unknown */ - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTH, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTH, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0015 - Receive an authorization grant - */ -static int receiveauthgrant(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - char *bn, *msg; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) - msg = byte_stream_getstr(bs, tmp); - else - msg = NULL; - - /* Unknown */ - tmp = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, msg); - - g_free(bn); - g_free(msg); - - return ret; -} - -/* - * Subtype 0x0018 - Send authorization request - * - * Sends a request for authorization to the given contact. The request will either be - * granted, denied, or dropped. - * - */ -int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 2+(msg ? strlen(msg)+1 : 0) + 2); - - /* Username */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Message (null terminated) */ - byte_stream_put16(&bs, msg ? strlen(msg) : 0); - if (msg) { - byte_stream_putstr(&bs, msg); - byte_stream_put8(&bs, 0x00); - } - - /* Unknown */ - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0019 - Receive an authorization request - */ -static int receiveauthrequest(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - char *bn, *msg; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) - msg = byte_stream_getstr(bs, tmp); - else - msg = NULL; - - /* Unknown */ - tmp = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, msg); - - g_free(bn); - g_free(msg); - - return ret; -} - -/* - * Subtype 0x001a - Send authorization reply - * - * Sends a reply to a request for authorization. The reply can either - * grant authorization or deny authorization. - * - * if reply=0x00 then deny - * if reply=0x01 then grant - * - */ -int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn) + 1 + 2+(msg ? (strlen(msg)+1) : 0) + 2); - - /* Username */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* Grant or deny */ - byte_stream_put8(&bs, reply); - - /* Message (null terminated) */ - byte_stream_put16(&bs, msg ? (strlen(msg)+1) : 0); - if (msg) { - byte_stream_putstr(&bs, msg); - byte_stream_put8(&bs, 0x00); - } - - /* Unknown */ - byte_stream_put16(&bs, 0x0000); - - snacid = aim_cachesnac(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x001b - Receive an authorization reply - * - * You get this bad boy when other people respond to the authorization - * request that you have previously sent them. - */ -static int receiveauthreply(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - guint8 reply; - char *bn, *msg; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - /* Read reply */ - reply = byte_stream_get8(bs); - - /* Read message (null terminated) */ - if ((tmp = byte_stream_get16(bs))) - msg = byte_stream_getstr(bs, tmp); - else - msg = NULL; - - /* Unknown */ - tmp = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn, reply, msg); - - g_free(bn); - g_free(msg); - - return ret; -} - -/* - * Subtype 0x001c - Receive a message telling you someone added you to their list. - */ -static int receiveadded(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp; - char *bn; - - /* Read buddy name */ - if ((tmp = byte_stream_get8(bs))) - bn = byte_stream_getstr(bs, tmp); - else - bn = NULL; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, bn); - - g_free(bn); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO) - return parserights(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_LIST) - return parsedata(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_ADD) - return parseadd(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_MOD) - return parsemod(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_DEL) - return parsedel(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_SRVACK) - return parseack(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_NOLIST) - return parsedataunchanged(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTH) - return receiveauthgrant(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ) - return receiveauthrequest(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP) - return receiveauthreply(od, conn, mod, frame, snac, bs); - else if (snac->subtype == SNAC_SUBTYPE_FEEDBAG_ADDED) - return receiveadded(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -ssi_shutdown(OscarData *od, aim_module_t *mod) -{ - aim_ssi_freelist(od); -} - -int -ssi_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_FEEDBAG; - mod->version = 0x0004; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "feedbag", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = ssi_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icbm.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icbm.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icbm.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icbm.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2873 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0004 - Routines for sending/receiving Instant Messages. - * - * Note the term ICBM (Inter-Client Basic Message) which blankets - * all types of generically routed through-server messages. Within - * the ICBM types (family 4), a channel is defined. Each channel - * represents a different type of message. Channel 1 is used for - * what would commonly be called an "instant message". Channel 2 - * is used for negotiating "rendezvous". These transactions end in - * something more complex happening, such as a chat invitation, or - * a file transfer. Channel 3 is used for chat messages (not in - * the same family as these channels). Channel 4 is used for - * various ICQ messages. Examples are normal messages, URLs, and - * old-style authorization. - * - * In addition to the channel, every ICBM contains a cookie. For - * standard IMs, these are only used for error messages. However, - * the more complex rendezvous messages make suitably more complex - * use of this field. - * - * TODO: Split this up into an im.c file an an icbm.c file. It - * will be beautiful, you'll see. - * - * Make sure flap_connection_findbygroup is used by all functions. - */ - -#include "oscar.h" -#include "peer.h" - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -#include "util.h" - - -/** - * Add a standard ICBM header to the given bstream with the given - * information. - * - * @param bs The bstream to write the ICBM header to. - * @param c c is for cookie, and cookie is for me. - * @param channel The ICBM channel (1 through 4). - * @param bn Null-terminated scrizeen nizame. - * @return The number of bytes written. It's really not useful. - */ -static int aim_im_puticbm(ByteStream *bs, const guchar *c, guint16 channel, const char *bn) -{ - byte_stream_putraw(bs, c, 8); - byte_stream_put16(bs, channel); - byte_stream_put8(bs, strlen(bn)); - byte_stream_putstr(bs, bn); - return 8+2+1+strlen(bn); -} - -/** - * Generates a random ICBM cookie in a character array of length 8 - * and copies it into the variable passed as cookie - * TODO: Maybe we should stop limiting our characters to the visible range? - */ -void aim_icbm_makecookie(guchar *cookie) -{ - int i; - - /* Should be like "21CBF95" and null terminated */ - for (i = 0; i < 7; i++) - cookie[i] = 0x30 + ((guchar)rand() % 10); - cookie[7] = '\0'; -} - -/* - * Takes a msghdr (and a length) and returns a client type - * code. Note that this is *only a guess* and has a low likelihood - * of actually being accurate. - * - * Its based on experimental data, with the help of Eric Warmenhoven - * who seems to have collected a wide variety of different AIM clients. - * - * - * Heres the current collection: - * 0501 0003 0101 0101 01 AOL Mobile Communicator, WinAIM 1.0.414 - * 0501 0003 0101 0201 01 WinAIM 2.0.847, 2.1.1187, 3.0.1464, - * 4.3.2229, 4.4.2286 - * 0501 0004 0101 0102 0101 WinAIM 4.1.2010, libfaim (right here) - * 0501 0003 0101 02 WinAIM 5 - * 0501 0001 01 iChat x.x, mobile buddies - * 0501 0001 0101 01 AOL v6.0, CompuServe 2000 v6.0, any TOC client - * 0501 0002 0106 WinICQ 5.45.1.3777.85 - * - * Note that in this function, only the feature bytes are tested, since - * the rest will always be the same. - * - */ -guint16 aim_im_fingerprint(const guint8 *msghdr, int len) -{ - static const struct { - guint16 clientid; - int len; - guint8 data[10]; - } fingerprints[] = { - /* AOL Mobile Communicator, WinAIM 1.0.414 */ - { AIM_CLIENTTYPE_MC, - 3, {0x01, 0x01, 0x01}}, - - /* WinAIM 2.0.847, 2.1.1187, 3.0.1464, 4.3.2229, 4.4.2286 */ - { AIM_CLIENTTYPE_WINAIM, - 3, {0x01, 0x01, 0x02}}, - - /* WinAIM 4.1.2010, libfaim */ - { AIM_CLIENTTYPE_WINAIM41, - 4, {0x01, 0x01, 0x01, 0x02}}, - - /* AOL v6.0, CompuServe 2000 v6.0, any TOC client */ - { AIM_CLIENTTYPE_AOL_TOC, - 1, {0x01}}, - - { 0, 0, {0x00}} - }; - int i; - - if (!msghdr || (len <= 0)) - return AIM_CLIENTTYPE_UNKNOWN; - - for (i = 0; fingerprints[i].len; i++) { - if (fingerprints[i].len != len) - continue; - if (memcmp(fingerprints[i].data, msghdr, fingerprints[i].len) == 0) - return fingerprints[i].clientid; - } - - return AIM_CLIENTTYPE_UNKNOWN; -} - -/* - * Subtype 0x0001 - Error - */ -static int -error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - guint16 reason, errcode = 0; - char *bn; - GSList *tlvlist; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "icbm error: received response from unknown request!\n"); - return 0; - } - - if (snac2->family != SNAC_FAMILY_ICBM) { - purple_debug_misc("oscar", "icbm error: received response from invalid request! %d\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - if (!(bn = snac2->data)) { - purple_debug_misc("oscar", "icbm error: received response from request without a buddy name!\n"); - g_free(snac2); - return 0; - } - - reason = byte_stream_get16(bs); - - tlvlist = aim_tlvlist_read(bs); - if (aim_tlv_gettlv(tlvlist, 0x0008, 1)) - errcode = aim_tlv_get16(tlvlist, 0x0008, 1); - aim_tlvlist_free(tlvlist); - - /* Notify the user that the message wasn't delivered */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, reason, errcode, bn); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/** - * Subtype 0x0002 - Set ICBM parameters. - * - * I definitely recommend sending this. If you don't, you'll be stuck - * with the rather unreasonable defaults. - * - */ -int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!params) - return -EINVAL; - - byte_stream_new(&bs, 16); - - /* This is read-only (see Parameter Reply). Must be set to zero here. */ - byte_stream_put16(&bs, 0x0000); - - /* These are all read-write */ - byte_stream_put32(&bs, params->flags); - byte_stream_put16(&bs, params->maxmsglen); - byte_stream_put16(&bs, params->maxsenderwarn); - byte_stream_put16(&bs, params->maxrecverwarn); - byte_stream_put32(&bs, params->minmsginterval); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0004 - Request ICBM parameter information. - * - */ -int aim_im_reqparams(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_ICBM, 0x0004); - - return 0; -} - -/** - * Subtype 0x0005 - Receive parameter information. - * - */ -static int aim_im_paraminfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - struct aim_icbmparameters params; - - params.maxchan = byte_stream_get16(bs); - params.flags = byte_stream_get32(bs); - params.maxmsglen = byte_stream_get16(bs); - params.maxsenderwarn = byte_stream_get16(bs); - params.maxrecverwarn = byte_stream_get16(bs); - params.minmsginterval = byte_stream_get32(bs); - - params.flags = AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED - | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED - | AIM_IMPARAM_FLAG_EVENTS_ALLOWED - | AIM_IMPARAM_FLAG_SMS_SUPPORTED - | AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED; - params.maxmsglen = 8000; - params.minmsginterval = 0; - - aim_im_setparams(od, ¶ms); - - return 0; -} - -/** - * Subtype 0x0006 - Send an ICBM (instant message). - * - * - * Possible flags: - * AIM_IMFLAGS_AWAY -- Marks the message as an autoresponse - * AIM_IMFLAGS_ACK -- Requests that the server send an ack - * when the message is received (of type SNAC_FAMILY_ICBM/0x000c) - * AIM_IMFLAGS_OFFLINE--If destination is offline, store it until they are - * online (probably ICQ only). - * - * Generally, you should use the lowest encoding possible to send - * your message. If you only use basic punctuation and the generic - * Latin alphabet, use ASCII7 (no flags). If you happen to use non-ASCII7 - * characters, but they are all clearly defined in ISO-8859-1, then - * use that. Keep in mind that not all characters in the PC ASCII8 - * character set are defined in the ISO standard. For those cases (most - * notably when the (r) symbol is used), you must use the full UNICODE - * encoding for your message. In UNICODE mode, _all_ characters must - * occupy 16bits, including ones that are not special. (Remember that - * the first 128 UNICODE symbols are equivalent to ASCII7, however they - * must be prefixed with a zero high order byte.) - * - * I strongly discourage the use of UNICODE mode, mainly because none - * of the clients I use can parse those messages (and besides that, - * wchars are difficult and non-portable to handle in most UNIX environments). - * If you really need to include special characters, use the HTML UNICODE - * entities. These are of the form ߪ where 2026 is the hex - * representation of the UNICODE index (in this case, UNICODE - * "Horizontal Ellipsis", or 133 in in ASCII8). - * - * Implementation note: Since this is one of the most-used functions - * in all of libfaim, it is written with performance in mind. As such, - * it is not as clear as it could be in respect to how this message is - * supposed to be layed out. Most obviously, tlvlists should be used - * instead of writing out the bytes manually. - * - * XXX - more precise verification that we never send SNACs larger than 8192 - * XXX - check SNAC size for multipart - * - */ -int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args) -{ - FlapConnection *conn; - aim_snacid_t snacid; - ByteStream data; - guchar cookie[8]; - int msgtlvlen; - static const guint8 deffeatures[] = { 0x01, 0x01, 0x01, 0x02 }; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!args) - return -EINVAL; - - if (args->flags & AIM_IMFLAGS_MULTIPART) { - if (args->mpmsg->numparts == 0) - return -EINVAL; - } else { - if (!args->msg || (args->msglen <= 0)) - return -EINVAL; - - if (args->msglen > MAXMSGLEN) - return -E2BIG; - } - - /* Painfully calculate the size of the message TLV */ - msgtlvlen = 1 + 1; /* 0501 */ - - if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) - msgtlvlen += 2 + args->featureslen; - else - msgtlvlen += 2 + sizeof(deffeatures); - - if (args->flags & AIM_IMFLAGS_MULTIPART) { - aim_mpmsg_section_t *sec; - - for (sec = args->mpmsg->parts; sec; sec = sec->next) { - msgtlvlen += 2 /* 0101 */ + 2 /* block len */; - msgtlvlen += 4 /* charset */ + sec->datalen; - } - - } else { - msgtlvlen += 2 /* 0101 */ + 2 /* block len */; - msgtlvlen += 4 /* charset */ + args->msglen; - } - - byte_stream_new(&data, msgtlvlen + 128); - - /* Generate an ICBM cookie */ - aim_icbm_makecookie(cookie); - - /* ICBM header */ - aim_im_puticbm(&data, cookie, 0x0001, args->destbn); - - /* Message TLV (type 0x0002) */ - byte_stream_put16(&data, 0x0002); - byte_stream_put16(&data, msgtlvlen); - - /* Features TLV (type 0x0501) */ - byte_stream_put16(&data, 0x0501); - if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) { - byte_stream_put16(&data, args->featureslen); - byte_stream_putraw(&data, args->features, args->featureslen); - } else { - byte_stream_put16(&data, sizeof(deffeatures)); - byte_stream_putraw(&data, deffeatures, sizeof(deffeatures)); - } - - if (args->flags & AIM_IMFLAGS_MULTIPART) { - aim_mpmsg_section_t *sec; - - /* Insert each message part in a TLV (type 0x0101) */ - for (sec = args->mpmsg->parts; sec; sec = sec->next) { - byte_stream_put16(&data, 0x0101); - byte_stream_put16(&data, sec->datalen + 4); - byte_stream_put16(&data, sec->charset); - byte_stream_put16(&data, sec->charsubset); - byte_stream_putraw(&data, (guchar *)sec->data, sec->datalen); - } - - } else { - - /* Insert message text in a TLV (type 0x0101) */ - byte_stream_put16(&data, 0x0101); - - /* Message block length */ - byte_stream_put16(&data, args->msglen + 0x04); - - /* Character set */ - byte_stream_put16(&data, args->charset); - byte_stream_put16(&data, args->charsubset); - - /* Message. Not terminated */ - byte_stream_putraw(&data, (guchar *)args->msg, args->msglen); - } - - /* Set the Autoresponse flag */ - if (args->flags & AIM_IMFLAGS_AWAY) { - byte_stream_put16(&data, 0x0004); - byte_stream_put16(&data, 0x0000); - } else { - if (args->flags & AIM_IMFLAGS_ACK) { - /* Set the Request Acknowledge flag */ - byte_stream_put16(&data, 0x0003); - byte_stream_put16(&data, 0x0000); - } - - if (args->flags & AIM_IMFLAGS_OFFLINE) { - /* Allow this message to be queued as an offline message */ - byte_stream_put16(&data, 0x0006); - byte_stream_put16(&data, 0x0000); - } - } - - /* - * Set the I HAVE A REALLY PURTY ICON flag. - * XXX - This should really only be sent on initial - * IMs and when you change your icon. - */ - if (args->flags & AIM_IMFLAGS_HASICON) { - byte_stream_put16(&data, 0x0008); - byte_stream_put16(&data, 0x000c); - byte_stream_put32(&data, args->iconlen); - byte_stream_put16(&data, 0x0001); - byte_stream_put16(&data, args->iconsum); - byte_stream_put32(&data, args->iconstamp); - } - - /* - * Set the Buddy Icon Requested flag. - * XXX - Every time? Surely not... - */ - if (args->flags & AIM_IMFLAGS_BUDDYREQ) { - byte_stream_put16(&data, 0x0009); - byte_stream_put16(&data, 0x0000); - } - - /* XXX - should be optional */ - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, args->destbn, strlen(args->destbn)+1); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &data); - byte_stream_destroy(&data); - - /* clean out SNACs over 60sec old */ - aim_cleansnacs(od, 60); - - return 0; -} - -/* - * Simple wrapper for aim_im_sendch1_ext() - * - * You cannot use aim_send_im if you need the HASICON flag. You must - * use aim_im_sendch1_ext directly for that. - * - * aim_send_im also cannot be used if you require UNICODE messages, because - * that requires an explicit message length. Use aim_im_sendch1_ext(). - * - */ -int aim_im_sendch1(OscarData *od, const char *bn, guint16 flags, const char *msg) -{ - struct aim_sendimext_args args; - - args.destbn = bn; - args.flags = flags; - args.msg = msg; - args.msglen = strlen(msg); - args.charset = 0x0000; - args.charsubset = 0x0000; - - /* Make these don't get set by accident -- they need aim_im_sendch1_ext */ - args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART); - - return aim_im_sendch1_ext(od, &args); -} - -/* - * Subtype 0x0006 - Send a chat invitation. - */ -int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - IcbmCookie *msgcookie; - struct aim_invite_priv *priv; - guchar cookie[8]; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!bn || !msg || !roomname) - return -EINVAL; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 1142+strlen(bn)+strlen(roomname)+strlen(msg)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, bn, strlen(bn)+1); - - /* XXX should be uncached by an unwritten 'invite accept' handler */ - priv = g_malloc(sizeof(struct aim_invite_priv)); - priv->bn = g_strdup(bn); - priv->roomname = g_strdup(roomname); - priv->exchange = exchange; - priv->instance = instance; - - if ((msgcookie = aim_mkcookie(cookie, AIM_COOKIETYPE_INVITE, priv))) - aim_cachecookie(od, msgcookie); - else - g_free(priv); - - /* ICBM Header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - /* - * TLV t(0005) - * - * Everything else is inside this TLV. - * - * Sigh. AOL was rather inconsistent right here. So we have - * to play some minor tricks. Right inside the type 5 is some - * raw data, followed by a series of TLVs. - * - */ - byte_stream_new(&hdrbs, 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2); - - byte_stream_put16(&hdrbs, 0x0000); /* Unknown! */ - byte_stream_putraw(&hdrbs, cookie, sizeof(cookie)); /* I think... */ - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_CHAT); - - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, 0x0001); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_add_str(&inner_tlvlist, 0x000c, msg); - aim_tlvlist_add_chatroom(&inner_tlvlist, 0x2711, exchange, roomname, instance); - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0006 - Send your icon to a given user. - * - * This is also performance sensitive. (If you can believe it...) - * - */ -int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!bn || !icon || (iconlen <= 0) || (iconlen >= MAXICONLEN)) - return -EINVAL; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 8+2+1+strlen(bn)+2+2+2+8+16+2+2+2+2+2+2+2+4+4+4+iconlen+strlen(AIM_ICONIDENT)+2+2); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - /* - * TLV t(0005) - * - * Encompasses everything below. - */ - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 2+8+16+6+4+4+iconlen+4+4+4+strlen(AIM_ICONIDENT)); - - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, cookie, 8); - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_BUDDYICON); - - /* TLV t(000a) */ - byte_stream_put16(&bs, 0x000a); - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - /* TLV t(000f) */ - byte_stream_put16(&bs, 0x000f); - byte_stream_put16(&bs, 0x0000); - - /* TLV t(2711) */ - byte_stream_put16(&bs, 0x2711); - byte_stream_put16(&bs, 4+4+4+iconlen+strlen(AIM_ICONIDENT)); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, iconsum); - byte_stream_put32(&bs, iconlen); - byte_stream_put32(&bs, stamp); - byte_stream_putraw(&bs, icon, iconlen); - byte_stream_putstr(&bs, AIM_ICONIDENT); - - /* TLV t(0003) */ - byte_stream_put16(&bs, 0x0003); - byte_stream_put16(&bs, 0x0000); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0006 - Send a rich text message. - * - * This only works for ICQ 2001b (thats 2001 not 2000). Better, only - * send it to clients advertising the RTF capability. In fact, if you send - * it to a client that doesn't support that capability, the server will gladly - * bounce it back to you. - * - * You'd think this would be in icq.c, but, well, I'm trying to stick with - * the one-group-per-file scheme as much as possible. This could easily - * be an exception, since Rendezvous IMs are external of the Oscar core, - * and therefore are undefined. Really I just need to think of a good way to - * make an interface similar to what AOL actually uses. But I'm not using COM. - * - */ -int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - const char rtfcap[] = {"{97B12751-243C-4334-AD22-D6ABF73F1492}"}; /* OSCAR_CAPABILITY_ICQRTF capability in string form */ - int servdatalen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (!args || !args->destbn || !args->rtfmsg) - return -EINVAL; - - servdatalen = 2+2+16+2+4+1+2 + 2+2+4+4+4 + 2+4+2+strlen(args->rtfmsg)+1 + 4+4+4+strlen(rtfcap)+1; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 128+servdatalen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, args->destbn); - - /* TLV t(0005) - Encompasses everything below. */ - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 2+8+16 + 2+2+2 + 2+2 + 2+2+servdatalen); - - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, cookie, 8); - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY); - - /* t(000a) l(0002) v(0001) */ - byte_stream_put16(&bs, 0x000a); - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - /* t(000f) l(0000) v() */ - byte_stream_put16(&bs, 0x000f); - byte_stream_put16(&bs, 0x0000); - - /* Service Data TLV */ - byte_stream_put16(&bs, 0x2711); - byte_stream_put16(&bs, servdatalen); - - byte_stream_putle16(&bs, 11 + 16 /* 11 + (sizeof CLSID) */); - byte_stream_putle16(&bs, 9); - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); - byte_stream_putle16(&bs, 0); - byte_stream_putle32(&bs, 0); - byte_stream_putle8(&bs, 0); - byte_stream_putle16(&bs, 0x03ea); /* trid1 */ - - byte_stream_putle16(&bs, 14); - byte_stream_putle16(&bs, 0x03eb); /* trid2 */ - byte_stream_putle32(&bs, 0); - byte_stream_putle32(&bs, 0); - byte_stream_putle32(&bs, 0); - - byte_stream_putle16(&bs, 0x0001); - byte_stream_putle32(&bs, 0); - byte_stream_putle16(&bs, strlen(args->rtfmsg)+1); - byte_stream_putraw(&bs, (const guint8 *)args->rtfmsg, strlen(args->rtfmsg)+1); - - byte_stream_putle32(&bs, args->fgcolor); - byte_stream_putle32(&bs, args->bgcolor); - byte_stream_putle32(&bs, strlen(rtfcap)+1); - byte_stream_putraw(&bs, (const guint8 *)rtfcap, strlen(rtfcap)+1); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Cancel a rendezvous invitation. It could be an invitation to - * establish a direct connection, or a file-send, or a chat invite. - */ -void -aim_im_sendch2_cancel(PeerConnection *peer_conn) -{ - OscarData *od; - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - od = peer_conn->od; - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 118+strlen(peer_conn->bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 64); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_CANCEL); - byte_stream_putraw(&hdrbs, peer_conn->cookie, 8); - byte_stream_putcaps(&hdrbs, peer_conn->type); - - /* This TLV means "cancel!" */ - aim_tlvlist_add_16(&inner_tlvlist, 0x000b, 0x0001); - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send an "I accept and I've connected to - * you" message. - */ -void -aim_im_sendch2_connected(PeerConnection *peer_conn) -{ - OscarData *od; - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - od = peer_conn->od; - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 11+strlen(peer_conn->bn) + 4+2+8+16); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, peer_conn->cookie, 0x0002, peer_conn->bn); - - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 0x001a); - byte_stream_put16(&bs, AIM_RENDEZVOUS_CONNECTED); - byte_stream_putraw(&bs, peer_conn->cookie, 8); - byte_stream_putcaps(&bs, peer_conn->type); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send a direct connect rendezvous ICBM. This - * could have a number of meanings, depending on the content: - * "I want you to connect to me" - * "I want to connect to you" - * "I want to connect through a proxy server" - */ -void -aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 246+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 128); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send a direct connect rendezvous ICBM asking the - * remote user to connect to us via a proxy server. - */ -void -aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - guint8 ip_comp[4]; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 246+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 128); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_DIRECTIM); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); - - /* Send the bitwise complement of the port and ip. As a check? */ - ip_comp[0] = ~ip[0]; - ip_comp[1] = ~ip[1]; - ip_comp[2] = ~ip[2]; - ip_comp[3] = ~ip[3]; - aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp); - aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); - - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send an "I want to send you this file" message - * - */ -void -aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - - g_return_if_fail(bn != NULL); - g_return_if_fail(ip != NULL); - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 1014); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 512); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, port); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - /* TODO: Send 0x0016 and 0x0017 */ - -#if 0 - /* TODO: If the following is ever enabled, ensure that it is - * not sent with a receive redirect or stage 3 proxy - * redirect for a file receive (same conditions for - * sending 0x000f above) - */ - aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file."); -#endif - - if (filename != NULL) - { - ByteStream inner_bs; - - /* Begin TLV t(2711) */ - byte_stream_new(&inner_bs, 2+2+4+strlen(filename)+1); - byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001); - byte_stream_put16(&inner_bs, numfiles); - byte_stream_put32(&inner_bs, size); - - /* Filename - NULL terminated, for some odd reason */ - byte_stream_putstr(&inner_bs, filename); - byte_stream_put8(&inner_bs, 0x00); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, inner_bs.len, inner_bs.data); - byte_stream_destroy(&inner_bs); - /* End TLV t(2711) */ - } - - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Send a sendfile connect rendezvous ICBM asking the - * remote user to connect to us via a proxy server. - */ -void -aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *outer_tlvlist = NULL, *inner_tlvlist = NULL; - ByteStream hdrbs; - guint8 ip_comp[4]; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (conn == NULL) - return; - - byte_stream_new(&bs, 1014); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - aim_tlvlist_add_noval(&outer_tlvlist, 0x0003); - - byte_stream_new(&hdrbs, 512); - - byte_stream_put16(&hdrbs, AIM_RENDEZVOUS_PROPOSE); - byte_stream_putraw(&hdrbs, cookie, 8); - byte_stream_putcaps(&hdrbs, OSCAR_CAPABILITY_SENDFILE); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x0002, 4, ip); - aim_tlvlist_add_raw(&inner_tlvlist, 0x0003, 4, ip); - aim_tlvlist_add_16(&inner_tlvlist, 0x0005, pin); - aim_tlvlist_add_16(&inner_tlvlist, 0x000a, requestnumber); - aim_tlvlist_add_noval(&inner_tlvlist, 0x000f); - aim_tlvlist_add_noval(&inner_tlvlist, 0x0010); - - /* Send the bitwise complement of the port and ip. As a check? */ - ip_comp[0] = ~ip[0]; - ip_comp[1] = ~ip[1]; - ip_comp[2] = ~ip[2]; - ip_comp[3] = ~ip[3]; - aim_tlvlist_add_raw(&inner_tlvlist, 0x0016, 4, ip_comp); - aim_tlvlist_add_16(&inner_tlvlist, 0x0017, ~pin); - -#if 0 - /* TODO: If the following is ever enabled, ensure that it is - * not sent with a receive redirect or stage 3 proxy - * redirect for a file receive (same conditions for - * sending 0x000f above) - */ - aim_tlvlist_add_raw(&inner_tlvlist, 0x000e, 2, "en"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000d, 8, "us-ascii"); - aim_tlvlist_add_raw(&inner_tlvlist, 0x000c, 24, "Please accept this file."); -#endif - - if (filename != NULL) - { - ByteStream filename_bs; - - /* Begin TLV t(2711) */ - byte_stream_new(&filename_bs, 2+2+4+strlen(filename)+1); - byte_stream_put16(&filename_bs, (numfiles > 1) ? 0x0002 : 0x0001); - byte_stream_put16(&filename_bs, numfiles); - byte_stream_put32(&filename_bs, size); - - /* Filename - NULL terminated, for some odd reason */ - byte_stream_putstr(&filename_bs, filename); - byte_stream_put8(&filename_bs, 0x00); - - aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, filename_bs.len, filename_bs.data); - byte_stream_destroy(&filename_bs); - /* End TLV t(2711) */ - } - - aim_tlvlist_write(&hdrbs, &inner_tlvlist); - - aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data); - byte_stream_destroy(&hdrbs); - - aim_tlvlist_write(&bs, &outer_tlvlist); - - aim_tlvlist_free(inner_tlvlist); - aim_tlvlist_free(outer_tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Subtype 0x0006 - Request the status message of the given ICQ user. - * - * @param od The oscar session. - * @param bn The UIN of the user of whom you wish to request info. - * @param type The type of info you wish to request. This should be the current - * state of the user, as one of the AIM_ICQ_STATE_* defines. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM)) || !bn) - return -EINVAL; - - aim_icbm_makecookie(cookie); - - byte_stream_new(&bs, 8+2+1+strlen(bn) + 4+0x5e + 4); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0002, bn); - - /* TLV t(0005) - Encompasses almost everything below. */ - byte_stream_put16(&bs, 0x0005); /* T */ - byte_stream_put16(&bs, 0x005e); /* L */ - { /* V */ - byte_stream_put16(&bs, 0x0000); - - /* Cookie */ - byte_stream_putraw(&bs, cookie, 8); - - /* Put the 16 byte server relay capability */ - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_ICQSERVERRELAY); - - /* TLV t(000a) */ - byte_stream_put16(&bs, 0x000a); - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - /* TLV t(000f) */ - byte_stream_put16(&bs, 0x000f); - byte_stream_put16(&bs, 0x0000); - - /* TLV t(2711) */ - byte_stream_put16(&bs, 0x2711); - byte_stream_put16(&bs, 0x0036); - { /* V */ - byte_stream_putle16(&bs, 0x001b); /* L */ - byte_stream_putle16(&bs, 0x0009); /* Protocol version */ - byte_stream_putcaps(&bs, OSCAR_CAPABILITY_EMPTY); - byte_stream_putle16(&bs, 0x0000); /* Unknown */ - byte_stream_putle16(&bs, 0x0001); /* Client features? */ - byte_stream_putle16(&bs, 0x0000); /* Unknown */ - byte_stream_putle8(&bs, 0x00); /* Unkizown */ - byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ - - byte_stream_putle16(&bs, 0x000e); /* L */ - byte_stream_putle16(&bs, 0xffff); /* Sequence number? XXX - This should decrement by 1 with each request */ - byte_stream_putle32(&bs, 0x00000000); /* Unknown */ - byte_stream_putle32(&bs, 0x00000000); /* Unknown */ - byte_stream_putle32(&bs, 0x00000000); /* Unknown */ - - /* The type of status message being requested */ - if (type & AIM_ICQ_STATE_CHAT) - byte_stream_putle16(&bs, 0x03ec); - else if(type & AIM_ICQ_STATE_DND) - byte_stream_putle16(&bs, 0x03eb); - else if(type & AIM_ICQ_STATE_OUT) - byte_stream_putle16(&bs, 0x03ea); - else if(type & AIM_ICQ_STATE_BUSY) - byte_stream_putle16(&bs, 0x03e9); - else if(type & AIM_ICQ_STATE_AWAY) - byte_stream_putle16(&bs, 0x03e8); - - byte_stream_putle16(&bs, 0x0001); /* Status? */ - byte_stream_putle16(&bs, 0x0001); /* Priority of this message? */ - byte_stream_putle16(&bs, 0x0001); /* L */ - byte_stream_putle8(&bs, 0x00); /* String of length L */ - } /* End TLV t(2711) */ - } /* End TLV t(0005) */ - - /* TLV t(0003) */ - byte_stream_put16(&bs, 0x0003); - byte_stream_put16(&bs, 0x0000); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Subtype 0x0006 - Send an ICQ-esque ICBM. - * - * This can be used to send an ICQ authorization reply (deny or grant). It is the "old way." - * The new way is to use SSI. I like the new way a lot better. This seems like such a hack, - * mostly because it's in network byte order. Figuring this stuff out sometimes takes a while, - * but thats ok, because it gives me time to try to figure out what kind of drugs the AOL people - * were taking when they merged the two protocols. - * - * @param bn The destination buddy name. - * @param type The type of message. 0x0007 for authorization denied. 0x0008 for authorization granted. - * @param message The message you want to send, it should be null terminated. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - guchar cookie[8]; - - if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) - return -EINVAL; - - if (!bn || !type || !message) - return -EINVAL; - - byte_stream_new(&bs, 8+3+strlen(bn)+12+strlen(message)+1+4); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0006, 0x0000, NULL, 0); - - aim_icbm_makecookie(cookie); - - /* ICBM header */ - aim_im_puticbm(&bs, cookie, 0x0004, bn); - - /* - * TLV t(0005) - * - * ICQ data (the UIN and the message). - */ - byte_stream_put16(&bs, 0x0005); - byte_stream_put16(&bs, 4 + 2+2+strlen(message)+1); - - /* - * Your UIN - */ - byte_stream_putuid(&bs, od); - - /* - * TLV t(type) l(strlen(message)+1) v(message+NULL) - */ - byte_stream_putle16(&bs, type); - byte_stream_putle16(&bs, strlen(message)+1); - byte_stream_putraw(&bs, (const guint8 *)message, strlen(message)+1); - - /* - * TLV t(0006) l(0000) v() - */ - byte_stream_put16(&bs, 0x0006); - byte_stream_put16(&bs, 0x0000); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0006, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * XXX - I don't see when this would ever get called... - */ -static int outgoingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guchar cookie[8]; - guint16 channel; - GSList *tlvlist; - char *bn; - int bnlen; - guint16 icbmflags = 0; - guint8 flag1 = 0, flag2 = 0; - gchar *msg = NULL; - aim_tlv_t *msgblock; - - /* ICBM Cookie. */ - aim_icbm_makecookie(cookie); - - /* Channel ID */ - channel = byte_stream_get16(bs); - - if (channel != 0x01) { - purple_debug_misc("oscar", "icbm: ICBM recieved on unsupported channel. Ignoring. (chan = %04x)\n", channel); - return 0; - } - - bnlen = byte_stream_get8(bs); - bn = byte_stream_getstr(bs, bnlen); - - tlvlist = aim_tlvlist_read(bs); - - if (aim_tlv_gettlv(tlvlist, 0x0003, 1)) - icbmflags |= AIM_IMFLAGS_ACK; - if (aim_tlv_gettlv(tlvlist, 0x0004, 1)) - icbmflags |= AIM_IMFLAGS_AWAY; - - if ((msgblock = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { - ByteStream mbs; - int featurelen, msglen; - - byte_stream_init(&mbs, msgblock->value, msgblock->length); - - byte_stream_get8(&mbs); - byte_stream_get8(&mbs); - for (featurelen = byte_stream_get16(&mbs); featurelen; featurelen--) - byte_stream_get8(&mbs); - byte_stream_get8(&mbs); - byte_stream_get8(&mbs); - - msglen = byte_stream_get16(&mbs) - 4; /* final block length */ - - flag1 = byte_stream_get16(&mbs); - flag2 = byte_stream_get16(&mbs); - - msg = byte_stream_getstr(&mbs, msglen); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, msg, icbmflags, flag1, flag2); - - g_free(bn); - g_free(msg); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Ahh, the joys of nearly ridiculous over-engineering. - * - * Not only do AIM ICBM's support multiple channels. Not only do they - * support multiple character sets. But they support multiple character - * sets / encodings within the same ICBM. - * - * These multipart messages allow for complex space savings techniques, which - * seem utterly unnecessary by today's standards. In fact, there is only - * one client still in popular use that still uses this method: AOL for the - * Macintosh, Version 5.0. Obscure, yes, I know. - * - * In modern (non-"legacy") clients, if the user tries to send a character - * that is not ISO-8859-1 or ASCII, the client will send the entire message - * as UNICODE, meaning that every character in the message will occupy the - * full 16 bit UNICODE field, even if the high order byte would be zero. - * Multipart messages prevent this wasted space by allowing the client to - * only send the characters in UNICODE that need to be sent that way, and - * the rest of the message can be sent in whatever the native character - * set is (probably ASCII). - * - * An important note is that sections will be displayed in the order that - * they appear in the ICBM. There is no facility for merging or rearranging - * sections at run time. So if you have, say, ASCII then UNICODE then ASCII, - * you must supply two ASCII sections with a UNICODE in the middle, and incur - * the associated overhead. - * - * Normally I would have laughed and given a firm 'no' to supporting this - * seldom-used feature, but something is attracting me to it. In the future, - * it may be possible to abuse this to send mixed-media messages to other - * open source clients (like encryption or something) -- see faimtest for - * examples of how to do this. - * - * I would definitely recommend avoiding this feature unless you really - * know what you are doing, and/or you have something neat to do with it. - * - */ -int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm) -{ - - memset(mpm, 0, sizeof(aim_mpmsg_t)); - - return 0; -} - -static int mpmsg_addsection(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, gchar *data, guint16 datalen) -{ - aim_mpmsg_section_t *sec; - - sec = g_malloc(sizeof(aim_mpmsg_section_t)); - - sec->charset = charset; - sec->charsubset = charsubset; - sec->data = data; - sec->datalen = datalen; - sec->next = NULL; - - if (!mpm->parts) - mpm->parts = sec; - else { - aim_mpmsg_section_t *cur; - - for (cur = mpm->parts; cur->next; cur = cur->next) - ; - cur->next = sec; - } - - mpm->numparts++; - - return 0; -} - -int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen) -{ - gchar *dup; - - dup = g_malloc(datalen); - memcpy(dup, data, datalen); - - if (mpmsg_addsection(od, mpm, charset, charsubset, dup, datalen) == -1) { - g_free(dup); - return -1; - } - - return 0; -} - -/* XXX - should provide a way of saying ISO-8859-1 specifically */ -int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii) -{ - gchar *dup; - - if (!(dup = g_strdup(ascii))) - return -1; - - if (mpmsg_addsection(od, mpm, 0x0000, 0x0000, dup, strlen(ascii)) == -1) { - g_free(dup); - return -1; - } - - return 0; -} - -int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen) -{ - gchar *buf; - ByteStream bs; - int i; - - buf = g_malloc(unicodelen * 2); - - byte_stream_init(&bs, (guchar *)buf, unicodelen * 2); - - /* We assume unicode is in /host/ byte order -- convert to network */ - for (i = 0; i < unicodelen; i++) - byte_stream_put16(&bs, unicode[i]); - - if (mpmsg_addsection(od, mpm, 0x0002, 0x0000, buf, byte_stream_curpos(&bs)) == -1) { - g_free(buf); - return -1; - } - - return 0; -} - -void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm) -{ - aim_mpmsg_section_t *cur; - - for (cur = mpm->parts; cur; ) { - aim_mpmsg_section_t *tmp; - - tmp = cur->next; - g_free(cur->data); - g_free(cur); - cur = tmp; - } - - mpm->numparts = 0; - mpm->parts = NULL; - - return; -} - -/* - * Start by building the multipart structures, then pick the first - * human-readable section and stuff it into args->msg so no one gets - * suspicious. - */ -static int incomingim_ch1_parsemsgs(OscarData *od, aim_userinfo_t *userinfo, guint8 *data, int len, struct aim_incomingim_ch1_args *args) -{ - /* Should this be ASCII -> UNICODE -> Custom */ - static const guint16 charsetpri[] = { - AIM_CHARSET_ASCII, /* ASCII first */ - AIM_CHARSET_LATIN_1, /* then ISO-8859-1 */ - AIM_CHARSET_UNICODE, /* UNICODE as last resort */ - }; - static const int charsetpricount = 3; - int i; - ByteStream mbs; - aim_mpmsg_section_t *sec; - - byte_stream_init(&mbs, data, len); - - while (byte_stream_empty(&mbs)) { - guint16 msglen, flag1, flag2; - gchar *msgbuf; - - byte_stream_get8(&mbs); /* 01 */ - byte_stream_get8(&mbs); /* 01 */ - - /* Message string length, including character set info. */ - msglen = byte_stream_get16(&mbs); - if (msglen > byte_stream_empty(&mbs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - - /* Character set info */ - flag1 = byte_stream_get16(&mbs); - flag2 = byte_stream_get16(&mbs); - - /* Message. */ - msglen -= 4; - - /* - * For now, we don't care what the encoding is. Just copy - * it into a multipart struct and deal with it later. However, - * always pad the ending with a NULL. This makes it easier - * to treat ASCII sections as strings. It won't matter for - * UNICODE or binary data, as you should never read past - * the specified data length, which will not include the pad. - * - * XXX - There's an API bug here. For sending, the UNICODE is - * given in host byte order (aim_mpmsg_addunicode), but here - * the received messages are given in network byte order. - * - */ - msgbuf = (gchar *)byte_stream_getraw(&mbs, msglen); - mpmsg_addsection(od, &args->mpmsg, flag1, flag2, msgbuf, msglen); - - } /* while */ - - args->icbmflags |= AIM_IMFLAGS_MULTIPART; /* always set */ - - /* - * Clients that support multiparts should never use args->msg, as it - * will point to an arbitrary section. - * - * Here, we attempt to provide clients that do not support multipart - * messages with something to look at -- hopefully a human-readable - * string. But, failing that, a UNICODE message, or nothing at all. - * - * Which means that even if args->msg is NULL, it does not mean the - * message was blank. - * - */ - for (i = 0; i < charsetpricount; i++) { - for (sec = args->mpmsg.parts; sec; sec = sec->next) { - - if (sec->charset != charsetpri[i]) - continue; - - /* Great. We found one. Fill it in. */ - args->charset = sec->charset; - args->charsubset = sec->charsubset; - - /* Set up the simple flags */ - switch (args->charsubset) - { - case 0x0000: - /* standard subencoding? */ - break; - case 0x000b: - args->icbmflags |= AIM_IMFLAGS_SUBENC_MACINTOSH; - break; - case 0xffff: - /* no subencoding */ - break; - default: - break; - } - - args->msg = sec->data; - args->msglen = sec->datalen; - - return 0; - } - } - - /* No human-readable sections found. Oh well. */ - args->charset = args->charsubset = 0xffff; - args->msg = NULL; - args->msglen = 0; - - return 0; -} - -static int incomingim_ch1(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, ByteStream *bs, guint8 *cookie) -{ - guint16 type, length, magic1, msglen = 0; - aim_rxcallback_t userfunc; - int ret = 0; - int rev = 0; - struct aim_incomingim_ch1_args args; - unsigned int endpos; - - memset(&args, 0, sizeof(args)); - - aim_mpmsg_init(od, &args.mpmsg); - - /* - * This used to be done using tlvchains. For performance reasons, - * I've changed it to process the TLVs in-place. This avoids lots - * of per-IM memory allocations. - */ - while (byte_stream_empty(bs) >= 4) - { - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - - if (length > byte_stream_empty(bs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - - endpos = byte_stream_curpos(bs) + length; - - if (type == 0x0002) { /* Message Block */ - - /* - * This TLV consists of the following: - * - 0501 -- Unknown - * - Features: Don't know how to interpret these - * - 0101 -- Unknown - * - Message - * - * Slick and possible others reverse 'Features' and 'Messages' section. - * Thus, the TLV could have following layout: - * - 0101 -- Unknown (possibly magic for message section) - * - Message - * - 0501 -- Unknown (possibly magic for features section) - * - Features: Don't know how to interpret these - */ - - magic1 = byte_stream_get16(bs); /* 0501 or 0101 */ - if (magic1 == 0x101) /* Bad, message comes before attributes */ - { - /* Jump to the features section */ - msglen = byte_stream_get16(bs); - bs->offset += msglen; - rev = 1; - - magic1 = byte_stream_get16(bs); /* 0501 */ - } - - if (magic1 != 0x501) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - - args.featureslen = byte_stream_get16(bs); - if (args.featureslen > byte_stream_empty(bs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - if (args.featureslen == 0) - { - args.features = NULL; - } - else - { - args.features = byte_stream_getraw(bs, args.featureslen); - args.icbmflags |= AIM_IMFLAGS_CUSTOMFEATURES; - } - - if (rev) - { - /* Fix buffer back to message */ - bs->offset -= args.featureslen + 2 + 2 + msglen + 2 + 2; - } - - magic1 = byte_stream_get16(bs); /* 01 01 */ - if (magic1 != 0x101) /* Bad, message comes before attributes */ - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - msglen = byte_stream_get16(bs); - - /* - * The rest of the TLV contains one or more message - * blocks... - */ - incomingim_ch1_parsemsgs(od, userinfo, bs->data + bs->offset - 2 - 2 /* XXX evil!!! */, msglen + 2 + 2, &args); - - } else if (type == 0x0003) { /* Server Ack Requested */ - - args.icbmflags |= AIM_IMFLAGS_ACK; - - } else if (type == 0x0004) { /* Message is Auto Response */ - - args.icbmflags |= AIM_IMFLAGS_AWAY; - - } else if (type == 0x0006) { /* Message was received offline. */ - - /* - * This flag is set on incoming offline messages for both - * AIM and ICQ accounts. - */ - args.icbmflags |= AIM_IMFLAGS_OFFLINE; - - } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ - - args.iconlen = byte_stream_get32(bs); - byte_stream_get16(bs); /* 0x0001 */ - args.iconsum = byte_stream_get16(bs); - args.iconstamp = byte_stream_get32(bs); - - /* - * This looks to be a client bug. MacAIM 4.3 will - * send this tag, but with all zero values, in the - * first message of a conversation. This makes no - * sense whatsoever, so I'm going to say its a bug. - * - * You really shouldn't advertise a zero-length icon - * anyway. - * - */ - if (args.iconlen) - args.icbmflags |= AIM_IMFLAGS_HASICON; - - } else if (type == 0x0009) { - - args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; - - } else if (type == 0x000b) { /* Non-direct connect typing notification */ - - args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; - - } else if (type == 0x0016) { - - /* - * UTC timestamp for when the message was sent. Only - * provided for offline messages. - */ - args.timestamp = byte_stream_get32(bs); - - } else if (type == 0x0017) { - - if (length > byte_stream_empty(bs)) - { - purple_debug_misc("oscar", "Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n", userinfo->bn); - break; - } - g_free(args.extdata); - args.extdatalen = length; - if (args.extdatalen == 0) - args.extdata = NULL; - else - args.extdata = byte_stream_getraw(bs, args.extdatalen); - - } else { - purple_debug_misc("oscar", "incomingim_ch1: unknown TLV 0x%04x (len %d)\n", type, length); - } - - /* - * This is here to protect ourselves from ourselves. That - * is, if something above doesn't completely parse its value - * section, or, worse, overparses it, this will set the - * stream where it needs to be in order to land on the next - * TLV when the loop continues. - * - */ - byte_stream_setpos(bs, endpos); - } - - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, userinfo, &args); - - aim_mpmsg_free(od, &args.mpmsg); - g_free(args.features); - g_free(args.extdata); - - return ret; -} - -static void -incomingim_ch2_buddylist(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - /* - * This goes like this... - * - * group name length - * group name - * num of buddies in group - * buddy name length - * buddy name - * buddy name length - * buddy name - * ... - * group name length - * group name - * num of buddies in group - * buddy name length - * buddy name - * ... - * ... - */ - while (byte_stream_empty(servdata)) - { - guint16 gnlen, numb; - int i; - char *gn; - - gnlen = byte_stream_get16(servdata); - gn = byte_stream_getstr(servdata, gnlen); - numb = byte_stream_get16(servdata); - - for (i = 0; i < numb; i++) { - guint16 bnlen; - char *bn; - - bnlen = byte_stream_get16(servdata); - bn = byte_stream_getstr(servdata, bnlen); - - purple_debug_misc("oscar", "got a buddy list from %s: group %s, buddy %s\n", userinfo->bn, gn, bn); - - g_free(bn); - } - - g_free(gn); - } - - return; -} - -static void -incomingim_ch2_buddyicon_free(OscarData *od, IcbmArgsCh2 *args) -{ - g_free(args->info.icon.icon); - - return; -} - -static void -incomingim_ch2_buddyicon(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - args->info.icon.checksum = byte_stream_get32(servdata); - args->info.icon.length = byte_stream_get32(servdata); - args->info.icon.timestamp = byte_stream_get32(servdata); - args->info.icon.icon = byte_stream_getraw(servdata, args->info.icon.length); - - args->destructor = (void *)incomingim_ch2_buddyicon_free; - - return; -} - -static void -incomingim_ch2_chat_free(OscarData *od, IcbmArgsCh2 *args) -{ - /* XXX - aim_chat_roominfo_free() */ - g_free(args->info.chat.roominfo.name); - - return; -} - -static void -incomingim_ch2_chat(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - /* - * Chat room info. - */ - aim_chat_readroominfo(servdata, &args->info.chat.roominfo); - - args->destructor = (void *)incomingim_ch2_chat_free; -} - -static void -incomingim_ch2_icqserverrelay_free(OscarData *od, IcbmArgsCh2 *args) -{ - g_free((char *)args->info.rtfmsg.rtfmsg); -} - -/* - * The relationship between OSCAR_CAPABILITY_ICQSERVERRELAY and OSCAR_CAPABILITY_ICQRTF is - * kind of odd. This sends the client ICQRTF since that is all that I've seen - * SERVERRELAY used for. - * - * Note that this is all little-endian. Cringe. - * - */ -static void -incomingim_ch2_icqserverrelay(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - guint16 hdrlen, anslen, msglen; - - if (byte_stream_empty(servdata) < 24) - /* Someone sent us a short server relay ICBM. Weird. (Maybe?) */ - return; - - hdrlen = byte_stream_getle16(servdata); - byte_stream_advance(servdata, hdrlen); - - hdrlen = byte_stream_getle16(servdata); - byte_stream_advance(servdata, hdrlen); - - args->info.rtfmsg.msgtype = byte_stream_getle16(servdata); - - anslen = byte_stream_getle32(servdata); - byte_stream_advance(servdata, anslen); - - msglen = byte_stream_getle16(servdata); - args->info.rtfmsg.rtfmsg = byte_stream_getstr(servdata, msglen); - - args->info.rtfmsg.fgcolor = byte_stream_getle32(servdata); - args->info.rtfmsg.bgcolor = byte_stream_getle32(servdata); - - hdrlen = byte_stream_getle32(servdata); - byte_stream_advance(servdata, hdrlen); - - args->destructor = (void *)incomingim_ch2_icqserverrelay_free; -} - -static void -incomingim_ch2_sendfile_free(OscarData *od, IcbmArgsCh2 *args) -{ - g_free(args->info.sendfile.filename); -} - -/* Someone is sending us a file */ -static void -incomingim_ch2_sendfile(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, aim_userinfo_t *userinfo, IcbmArgsCh2 *args, ByteStream *servdata) -{ - int flen; - - args->destructor = (void *)incomingim_ch2_sendfile_free; - - /* Maybe there is a better way to tell what kind of sendfile - * this is? Maybe TLV t(000a)? */ - - /* subtype is one of AIM_OFT_SUBTYPE_* */ - args->info.sendfile.subtype = byte_stream_get16(servdata); - args->info.sendfile.totfiles = byte_stream_get16(servdata); - args->info.sendfile.totsize = byte_stream_get32(servdata); - - /* - * I hope to God I'm right when I guess that there is a - * 32 char max filename length for single files. I think - * OFT tends to do that. Gotta love inconsistency. I saw - * a 26 byte filename? - */ - /* AAA - create an byte_stream_getnullstr function (don't anymore)(maybe) */ - /* Use an inelegant way of getting the null-terminated filename, - * since there's no easy bstream routine. */ - for (flen = 0; byte_stream_get8(servdata); flen++); - byte_stream_advance(servdata, -flen -1); - args->info.sendfile.filename = byte_stream_getstr(servdata, flen); - - /* There is sometimes more after the null-terminated filename, - * but I'm unsure of its format. */ - /* I don't believe him. */ - /* There is sometimes a null byte inside a unicode filename, - * but as far as I can tell the filename is the last - * piece of data that will be in this message. --Jonathan */ -} - -typedef void (*ch2_args_destructor_t)(OscarData *od, IcbmArgsCh2 *args); - -static int incomingim_ch2(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie) -{ - aim_rxcallback_t userfunc; - aim_tlv_t *block1, *servdatatlv; - GSList *list2; - aim_tlv_t *tlv; - IcbmArgsCh2 args; - ByteStream bbs, sdbs, *sdbsptr = NULL; - guint8 *cookie2; - int ret = 0; - - char proxyip[30] = {""}; - char clientip[30] = {""}; - char verifiedip[30] = {""}; - - memset(&args, 0, sizeof(args)); - - /* - * There's another block of TLVs embedded in the type 5 here. - */ - block1 = aim_tlv_gettlv(tlvlist, 0x0005, 1); - if (block1 == NULL) - { - /* The server sent us ch2 ICBM without ch2 info? Weird. */ - return 1; - } - byte_stream_init(&bbs, block1->value, block1->length); - - /* - * First two bytes represent the status of the connection. - * One of the AIM_RENDEZVOUS_ defines. - * - * 0 is a request, 1 is a cancel, 2 is an accept - */ - args.status = byte_stream_get16(&bbs); - - /* - * Next comes the cookie. Should match the ICBM cookie. - */ - cookie2 = byte_stream_getraw(&bbs, 8); - if (memcmp(cookie, cookie2, 8) != 0) - { - purple_debug_warning("oscar", - "Cookies don't match in rendezvous ICBM, bailing out.\n"); - g_free(cookie2); - return 1; - } - memcpy(args.cookie, cookie2, 8); - g_free(cookie2); - - /* - * The next 16bytes are a capability block so we can - * identify what type of rendezvous this is. - */ - args.type = aim_locate_getcaps(od, &bbs, 0x10); - - /* - * What follows may be TLVs or nothing, depending on the - * purpose of the message. - * - * Ack packets for instance have nothing more to them. - */ - list2 = aim_tlvlist_read(&bbs); - - /* - * IP address to proxy the file transfer through. - * - * TODO: I don't like this. Maybe just read in an int? Or inet_ntoa... - */ - tlv = aim_tlv_gettlv(list2, 0x0002, 1); - if ((tlv != NULL) && (tlv->length == 4)) - snprintf(proxyip, sizeof(proxyip), "%hhu.%hhu.%hhu.%hhu", - tlv->value[0], tlv->value[1], - tlv->value[2], tlv->value[3]); - - /* - * IP address from the perspective of the client. - */ - tlv = aim_tlv_gettlv(list2, 0x0003, 1); - if ((tlv != NULL) && (tlv->length == 4)) - snprintf(clientip, sizeof(clientip), "%hhu.%hhu.%hhu.%hhu", - tlv->value[0], tlv->value[1], - tlv->value[2], tlv->value[3]); - - /* - * Verified IP address (from the perspective of Oscar). - * - * This is added by the server. - */ - tlv = aim_tlv_gettlv(list2, 0x0004, 1); - if ((tlv != NULL) && (tlv->length == 4)) - snprintf(verifiedip, sizeof(verifiedip), "%hhu.%hhu.%hhu.%hhu", - tlv->value[0], tlv->value[1], - tlv->value[2], tlv->value[3]); - - /* - * Port number for something. - */ - if (aim_tlv_gettlv(list2, 0x0005, 1)) - args.port = aim_tlv_get16(list2, 0x0005, 1); - - /* - * File transfer "request number": - * 0x0001 - Initial file transfer request for no proxy or stage 1 proxy - * 0x0002 - "Reply request" for a stage 2 proxy (receiver wants to use proxy) - * 0x0003 - A third request has been sent; applies only to stage 3 proxied transfers - */ - if (aim_tlv_gettlv(list2, 0x000a, 1)) - args.requestnumber = aim_tlv_get16(list2, 0x000a, 1); - - /* - * Terminate connection/error code. 0x0001 means the other user - * canceled the connection. - */ - if (aim_tlv_gettlv(list2, 0x000b, 1)) - args.errorcode = aim_tlv_get16(list2, 0x000b, 1); - - /* - * Invitation message / chat description. - */ - if (aim_tlv_gettlv(list2, 0x000c, 1)) { - args.msg = aim_tlv_getstr(list2, 0x000c, 1); - args.msglen = aim_tlv_getlength(list2, 0x000c, 1); - } - - /* - * Character set. - */ - if (aim_tlv_gettlv(list2, 0x000d, 1)) - args.encoding = aim_tlv_getstr(list2, 0x000d, 1); - - /* - * Language. - */ - if (aim_tlv_gettlv(list2, 0x000e, 1)) - args.language = aim_tlv_getstr(list2, 0x000e, 1); - -#if 0 - /* - * Unknown -- no value - * - * Maybe means we should connect directly to transfer the file? - * Also used in ICQ Lite Beta 4.0 URLs. Also empty. - */ - /* I don't think this indicates a direct transfer; this flag is - * also present in a stage 1 proxied file send request -- Jonathan */ - if (aim_tlv_gettlv(list2, 0x000f, 1)) { - /* Unhandled */ - } -#endif - - /* - * Flag meaning we should proxy the file transfer through an AIM server - */ - if (aim_tlv_gettlv(list2, 0x0010, 1)) - args.use_proxy = TRUE; - - if (strlen(proxyip)) - args.proxyip = (char *)proxyip; - if (strlen(clientip)) - args.clientip = (char *)clientip; - if (strlen(verifiedip)) - args.verifiedip = (char *)verifiedip; - - /* - * This must be present in PROPOSALs, but will probably not - * exist in CANCELs and ACCEPTs. Also exists in ICQ Lite - * Beta 4.0 URLs (OSCAR_CAPABILITY_ICQSERVERRELAY). - * - * Service Data blocks are module-specific in format. - */ - if ((servdatatlv = aim_tlv_gettlv(list2, 0x2711 /* 10001 */, 1))) { - - byte_stream_init(&sdbs, servdatatlv->value, servdatatlv->length); - sdbsptr = &sdbs; - - /* - * The rest of the handling depends on what type it is. - * - * Not all of them have special handling (yet). - */ - if (args.type & OSCAR_CAPABILITY_BUDDYICON) - incomingim_ch2_buddyicon(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_SENDBUDDYLIST) - incomingim_ch2_buddylist(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_CHAT) - incomingim_ch2_chat(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_ICQSERVERRELAY) - incomingim_ch2_icqserverrelay(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - else if (args.type & OSCAR_CAPABILITY_SENDFILE) - incomingim_ch2_sendfile(od, conn, mod, frame, snac, userinfo, &args, sdbsptr); - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, userinfo, &args); - - - if (args.destructor) - ((ch2_args_destructor_t)args.destructor)(od, &args); - - g_free((char *)args.msg); - g_free((char *)args.encoding); - g_free((char *)args.language); - - aim_tlvlist_free(list2); - - return ret; -} - -static int incomingim_ch4(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, GSList *tlvlist, guint8 *cookie) -{ - ByteStream meat; - aim_rxcallback_t userfunc; - aim_tlv_t *block; - struct aim_incomingim_ch4_args args; - int ret = 0; - - /* - * Make a bstream for the meaty part. Yum. Meat. - */ - if (!(block = aim_tlv_gettlv(tlvlist, 0x0005, 1))) - return -1; - byte_stream_init(&meat, block->value, block->length); - - args.uin = byte_stream_getle32(&meat); - args.type = byte_stream_getle8(&meat); - args.flags = byte_stream_getle8(&meat); - if (args.type == 0x1a) - /* There seems to be a problem with the length in SMS msgs from server, this fixed it */ - args.msglen = block->length - 6; - else - args.msglen = byte_stream_getle16(&meat); - args.msg = (gchar *)byte_stream_getraw(&meat, args.msglen); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, userinfo, &args); - - g_free(args.msg); - - return ret; -} - -/* - * Subtype 0x0007 - * - * It can easily be said that parsing ICBMs is THE single - * most difficult thing to do in the in AIM protocol. In - * fact, I think I just did say that. - * - * Below is the best damned solution I've come up with - * over the past sixteen months of battling with it. This - * can parse both away and normal messages from every client - * I have access to. Its not fast, its not clean. But it works. - * - */ -static int incomingim(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - guchar *cookie; - guint16 channel; - aim_userinfo_t userinfo; - - memset(&userinfo, 0x00, sizeof(aim_userinfo_t)); - - /* - * Read ICBM Cookie. - */ - cookie = byte_stream_getraw(bs, 8); - - /* - * Channel ID. - * - * Channel 0x0001 is the message channel. It is - * used to send basic ICBMs. - * - * Channel 0x0002 is the Rendezvous channel, which - * is where Chat Invitiations and various client-client - * connection negotiations come from. - * - * Channel 0x0003 is used for chat messages. - * - * Channel 0x0004 is used for ICQ authorization, or - * possibly any system notice. - * - */ - channel = byte_stream_get16(bs); - - /* - * Extract the standard user info block. - * - * Note that although this contains TLVs that appear contiguous - * with the TLVs read below, they are two different pieces. The - * userinfo block contains the number of TLVs that contain user - * information, the rest are not even though there is no separation. - * You can start reading the message TLVs after aim_info_extract() - * parses out the standard userinfo block. - * - * That also means that TLV types can be duplicated between the - * userinfo block and the rest of the message, however there should - * never be two TLVs of the same type in one block. - * - */ - aim_info_extract(od, bs, &userinfo); - - /* - * From here on, its depends on what channel we're on. - * - * Technically all channels have a TLV list have this, however, - * for the common channel 1 case, in-place parsing is used for - * performance reasons (less memory allocation). - */ - if (channel == 1) { - - ret = incomingim_ch1(od, conn, mod, frame, snac, channel, &userinfo, bs, cookie); - - } else if (channel == 2) { - GSList *tlvlist; - - /* - * Read block of TLVs (not including the userinfo data). All - * further data is derived from what is parsed here. - */ - tlvlist = aim_tlvlist_read(bs); - - ret = incomingim_ch2(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); - - aim_tlvlist_free(tlvlist); - - } else if (channel == 4) { - GSList *tlvlist; - - tlvlist = aim_tlvlist_read(bs); - ret = incomingim_ch4(od, conn, mod, frame, snac, channel, &userinfo, tlvlist, cookie); - aim_tlvlist_free(tlvlist); - - } else { - purple_debug_misc("oscar", "icbm: ICBM received on an unsupported channel. Ignoring. (chan = %04x)\n", channel); - } - - aim_info_free(&userinfo); - g_free(cookie); - - return ret; -} - -/* - * Subtype 0x0008 - Send a warning to bn. - * - * Flags: - * AIM_WARN_ANON Send as an anonymous (doesn't count as much) - * - * returns -1 on error (couldn't alloc packet), 0 on success. - * - */ -int aim_im_warn(OscarData *od, FlapConnection *conn, const char *bn, guint32 flags) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !conn || !bn) - return -EINVAL; - - byte_stream_new(&bs, strlen(bn)+3); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0008, 0x0000, bn, strlen(bn)+1); - - byte_stream_put16(&bs, (flags & AIM_WARN_ANON) ? 0x0001 : 0x0000); - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0008, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* Subtype 0x000a */ -static int missedcall(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 channel, nummissed, reason; - aim_userinfo_t userinfo; - - while (byte_stream_empty(bs)) { - - channel = byte_stream_get16(bs); - aim_info_extract(od, bs, &userinfo); - nummissed = byte_stream_get16(bs); - reason = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, &userinfo, nummissed, reason); - - aim_info_free(&userinfo); - } - - return ret; -} - -/* - * Subtype 0x000b - * - * Possible codes: - * AIM_TRANSFER_DENY_NOTSUPPORTED -- "client does not support" - * AIM_TRANSFER_DENY_DECLINE -- "client has declined transfer" - * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers" - * - */ -int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - byte_stream_new(&bs, 8+2+1+strlen(bn)+6); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x000b, 0x0000, NULL, 0); - - byte_stream_putraw(&bs, cookie, 8); - - byte_stream_put16(&bs, 0x0002); /* channel */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - aim_tlvlist_add_16(&tlvlist, 0x0003, code); - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x000b, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -static void parse_status_note_text(OscarData *od, guchar *cookie, char *bn, ByteStream *bs) -{ - struct aim_icq_info *info; - struct aim_icq_info *prev_info; - char *response; - char *encoding; - char *stripped_encoding; - char *status_note_title; - char *status_note_text; - char *stripped_status_note_text; - char *status_note; - guint32 length; - guint16 version; - guint32 capability; - guint8 message_type; - guint16 status_code; - guint16 text_length; - guint32 request_length; - guint32 response_length; - guint32 encoding_length; - PurpleAccount *account; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - - for (prev_info = NULL, info = od->icq_info; info != NULL; prev_info = info, info = info->next) - { - if (memcmp(&info->icbm_cookie, cookie, 8) == 0) - { - if (prev_info == NULL) - od->icq_info = info->next; - else - prev_info->next = info->next; - - break; - } - } - - if (info == NULL) - return; - - status_note_title = info->status_note_title; - g_free(info); - - length = byte_stream_getle16(bs); - if (length != 27) { - purple_debug_misc("oscar", "clientautoresp: incorrect header " - "size; expected 27, received %u.\n", length); - g_free(status_note_title); - return; - } - - version = byte_stream_getle16(bs); - if (version != 9) { - purple_debug_misc("oscar", "clientautoresp: incorrect version; " - "expected 9, received %u.\n", version); - g_free(status_note_title); - return; - } - - capability = aim_locate_getcaps(od, bs, 0x10); - if (capability != OSCAR_CAPABILITY_EMPTY) { - purple_debug_misc("oscar", "clientautoresp: plugin ID is not null.\n"); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 2); /* unknown */ - byte_stream_advance(bs, 4); /* client capabilities flags */ - byte_stream_advance(bs, 1); /* unknown */ - byte_stream_advance(bs, 2); /* downcouner? */ - - length = byte_stream_getle16(bs); - if (length != 14) { - purple_debug_misc("oscar", "clientautoresp: incorrect header " - "size; expected 14, received %u.\n", length); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 2); /* downcounter? */ - byte_stream_advance(bs, 12); /* unknown */ - - message_type = byte_stream_get8(bs); - if (message_type != 0x1a) { - purple_debug_misc("oscar", "clientautoresp: incorrect message " - "type; expected 0x1a, received 0x%x.\n", message_type); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 1); /* message flags */ - - status_code = byte_stream_getle16(bs); - if (status_code != 0) { - purple_debug_misc("oscar", "clientautoresp: incorrect status " - "code; expected 0, received %u.\n", status_code); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, 2); /* priority code */ - - text_length = byte_stream_getle16(bs); - byte_stream_advance(bs, text_length); /* text */ - - length = byte_stream_getle16(bs); - byte_stream_advance(bs, 18); /* unknown */ - - request_length = byte_stream_getle32(bs); - if (length != 18 + 4 + request_length + 17) { - purple_debug_misc("oscar", "clientautoresp: incorrect block; " - "expected length is %u, got %u.\n", - 18 + 4 + request_length + 17, length); - g_free(status_note_title); - return; - } - - byte_stream_advance(bs, request_length); /* x request */ - byte_stream_advance(bs, 17); /* unknown */ - - length = byte_stream_getle32(bs); - response_length = byte_stream_getle32(bs); - response = byte_stream_getstr(bs, response_length); - encoding_length = byte_stream_getle32(bs); - if (length != 4 + response_length + 4 + encoding_length) { - purple_debug_misc("oscar", "clientautoresp: incorrect block; " - "expected length is %u, got %u.\n", - 4 + response_length + 4 + encoding_length, length); - g_free(status_note_title); - g_free(response); - return; - } - - encoding = byte_stream_getstr(bs, encoding_length); - - account = purple_connection_get_account(od->gc); - - stripped_encoding = oscar_encoding_extract(encoding); - status_note_text = oscar_encoding_to_utf8(account, stripped_encoding, response, response_length); - stripped_status_note_text = purple_markup_strip_html(status_note_text); - - if (stripped_status_note_text != NULL && stripped_status_note_text[0] != 0) - status_note = g_strdup_printf("%s: %s", status_note_title, stripped_status_note_text); - else - status_note = g_strdup(status_note_title); - - g_free(status_note_title); - g_free(response); - g_free(encoding); - g_free(stripped_encoding); - g_free(status_note_text); - g_free(stripped_status_note_text); - - buddy = purple_find_buddy(account, bn); - if (buddy == NULL) - { - purple_debug_misc("oscar", "clientautoresp: buddy %s was not found.\n", bn); - g_free(status_note); - return; - } - - purple_debug_misc("oscar", "clientautoresp: setting status " - "message to \"%s\".\n", status_note); - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - purple_prpl_got_user_status(account, bn, - purple_status_get_id(status), - "message", status_note, NULL); - - g_free(status_note); -} - -/* - * Subtype 0x000b - Receive the response from an ICQ status message - * request (in which case this contains the ICQ status message) or - * a file transfer or direct IM request was declined. - */ -static int clientautoresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 channel, reason; - char *bn; - guchar *cookie; - guint8 bnlen; - - cookie = byte_stream_getraw(bs, 8); - channel = byte_stream_get16(bs); - bnlen = byte_stream_get8(bs); - bn = byte_stream_getstr(bs, bnlen); - reason = byte_stream_get16(bs); - - if (channel == 0x0002) - { - if (reason == 0x0003) /* channel-specific */ - /* parse status note text */ - parse_status_note_text(od, cookie, bn, bs); - - byte_stream_get16(bs); /* Unknown */ - byte_stream_get16(bs); /* Unknown */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, reason, cookie); - - } else if (channel == 0x0004) { /* ICQ message */ - switch (reason) { - case 0x0003: { /* ICQ status message. Maybe other stuff too, you never know with these people. */ - guint8 statusmsgtype, *msg; - guint16 len; - guint32 state; - - len = byte_stream_getle16(bs); /* Should be 0x001b */ - byte_stream_advance(bs, len); /* Unknown */ - - len = byte_stream_getle16(bs); /* Should be 0x000e */ - byte_stream_advance(bs, len); /* Unknown */ - - statusmsgtype = byte_stream_getle8(bs); - switch (statusmsgtype) { - case 0xe8: - state = AIM_ICQ_STATE_AWAY; - break; - case 0xe9: - state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; - break; - case 0xea: - state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT; - break; - case 0xeb: - state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; - break; - case 0xec: - state = AIM_ICQ_STATE_CHAT; - break; - default: - state = 0; - break; - } - - byte_stream_getle8(bs); /* Unknown - 0x03 Maybe this means this is an auto-reply */ - byte_stream_getle16(bs); /* Unknown - 0x0000 */ - byte_stream_getle16(bs); /* Unknown - 0x0000 */ - - len = byte_stream_getle16(bs); - msg = byte_stream_getraw(bs, len); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, reason, state, msg); - - g_free(msg); - } break; - - default: { - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, reason); - } break; - } /* end switch */ - } - - g_free(cookie); - g_free(bn); - - return ret; -} - -/* - * Subtype 0x000c - Receive an ack after sending an ICBM. - * - * You have to have send the message with the AIM_IMFLAGS_ACK flag set - * (TLV t(0003)). The ack contains the ICBM header of the message you - * sent. - * - */ -static int msgack(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - guint16 ch; - guchar *cookie; - char *bn; - int ret = 0; - - cookie = byte_stream_getraw(bs, 8); - ch = byte_stream_get16(bs); - bn = byte_stream_getstr(bs, byte_stream_get8(bs)); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, ch, bn); - - g_free(bn); - g_free(cookie); - - return ret; -} - -/* - * Subtype 0x0010 - Request any offline messages that are waiting for - * us. This is the "new" way of handling offline messages which is - * used for both AIM and ICQ. The old way is to use the ugly - * aim_icq_reqofflinemsgs() function, but that is no longer necessary. - * - * We set the 0x00000100 flag on the ICBM message parameters, which - * tells the oscar servers that we support offline messages. When we - * set that flag the servers do not automatically send us offline - * messages. Instead we must request them using this function. This - * should happen after sending the 0x0001/0x0002 "client online" SNAC. - */ -int aim_im_reqofflinemsgs(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) - return -EINVAL; - - aim_genericreq_n(od, conn, SNAC_FAMILY_ICBM, 0x0010); - - return 0; -} - -/* - * Subtype 0x0014 - Send a mini typing notification (mtn) packet. - * - * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, - * and Purple 0.60 and newer. - * - */ -int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) - return -EINVAL; - - if (!bn) - return -EINVAL; - - byte_stream_new(&bs, 11+strlen(bn)+2); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICBM, 0x0014, 0x0000, NULL, 0); - - /* ICBM cookie */ - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - - /* - * Channel (should be 0x0001 for mtn) - */ - byte_stream_put16(&bs, channel); - - /* - * Dest buddy name - */ - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - /* - * Event (should be 0x0000, 0x0001, or 0x0002 for mtn) - */ - byte_stream_put16(&bs, event); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICBM, 0x0014, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0014 - Receive a mini typing notification (mtn) packet. - * - * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, - * and Purple 0.60 and newer. - * - */ -static int mtn_receive(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - char *bn; - guint8 bnlen; - guint16 channel, event; - - byte_stream_advance(bs, 8); /* ICBM cookie */ - channel = byte_stream_get16(bs); - bnlen = byte_stream_get8(bs); - bn = byte_stream_getstr(bs, bnlen); - event = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, channel, bn, event); - - g_free(bn); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0005) - return aim_im_paraminfo(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0006) - return outgoingim(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0007) - return incomingim(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000a) - return missedcall(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000b) - return clientautoresp(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000c) - return msgack(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0014) - return mtn_receive(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -msg_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ICBM; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "messaging", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_icq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,897 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0015 - Encapsulated ICQ. - * - */ - -#include "oscar.h" - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -int aim_icq_reqofflinemsgs(OscarData *od) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - purple_debug_info("oscar", "Requesting offline messages\n"); - - bslen = 2 + 4 + 2 + 2; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x003c); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -int aim_icq_ackofflinemsgs(OscarData *od) -{ - ByteStream bs; - FlapFrame *frame; - aim_snacid_t snacid; - int bslen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - purple_debug_info("oscar", "Acknowledged receipt of offline messages\n"); - - bslen = 2 + 4 + 2 + 2; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x003e); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - -int -aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2+4+2+2+2+2+2+1+1+1+1+1+1; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x0c3a); /* shrug. */ - byte_stream_putle16(&bs, 0x030c); - byte_stream_putle16(&bs, 0x0001); - byte_stream_putle8(&bs, webaware); - byte_stream_putle8(&bs, 0xf8); - byte_stream_putle8(&bs, 0x02); - byte_stream_putle8(&bs, 0x01); - byte_stream_putle8(&bs, 0x00); - byte_stream_putle8(&bs, !auth_required); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Change your ICQ password. - * - * @param od The oscar session - * @param passwd The new password. If this is longer than 8 characters it - * will be truncated. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_icq_changepasswd(OscarData *od, const char *passwd) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen, passwdlen; - - if (!passwd) - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - passwdlen = strlen(passwd); - if (passwdlen > MAXICQPASSLEN) - passwdlen = MAXICQPASSLEN; - bslen = 2+4+2+2+2+2+passwdlen+1; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x042e); /* shrug. */ - byte_stream_putle16(&bs, passwdlen+1); - byte_stream_putstr(&bs, passwd); - byte_stream_putle8(&bs, '\0'); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -int aim_icq_getallinfo(OscarData *od, const char *uin) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - struct aim_icq_info *info; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x04b2); /* shrug. */ - byte_stream_putle32(&bs, atoi(uin)); - - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - /* Keep track of this request and the ICQ number and request ID */ - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); - info->reqid = snacid; - info->uin = atoi(uin); - info->next = od->icq_info; - od->icq_info = info; - - return 0; -} - -int aim_icq_getalias(OscarData *od, const char *uin) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - struct aim_icq_info *info; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - purple_debug_info("oscar", "Requesting ICQ alias for %s\n", uin); - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x04ba); /* shrug. */ - byte_stream_putle32(&bs, atoi(uin)); - - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - /* Keep track of this request and the ICQ number and request ID */ - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); - info->reqid = snacid; - info->uin = atoi(uin); - info->next = od->icq_info; - od->icq_info = info; - - return 0; -} - -int aim_icq_getsimpleinfo(OscarData *od, const char *uin) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!uin || uin[0] < '0' || uin[0] > '9') - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2 + 4 + 2 + 2 + 2 + 4; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x051f); /* shrug. */ - byte_stream_putle32(&bs, atoi(uin)); - - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - return 0; -} - -#if 0 -int aim_icq_sendxmlreq(OscarData *od, const char *xml) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - int bslen; - - if (!xml || !strlen(xml)) - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - bslen = 2 + 10 + 2 + strlen(xml) + 1; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - byte_stream_putle16(&bs, 0x0998); /* shrug. */ - byte_stream_putle16(&bs, strlen(xml) + 1); - byte_stream_putraw(&bs, (guint8 *)xml, strlen(xml) + 1); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} -#endif - -/* - * Send an SMS message. This is the non-US way. The US-way is to IM - * their cell phone number (+19195551234). - * - * We basically construct and send an XML message. The format is: - * - * full_phone_without_leading_+ - * message - * 1252 - * self_uin - * self_name - * Yes|No - * - * - * - * Yeah hi Peter, whaaaat's happening. If there's any way to use - * a codepage other than 1252 that would be great. Thaaaanks. - */ -int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias) -{ - FlapConnection *conn; - PurpleAccount *account; - ByteStream bs; - aim_snacid_t snacid; - int bslen, xmllen; - char *xml; - const char *timestr, *username; - time_t t; - struct tm *tm; - gchar *stripped; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICQ))) - return -EINVAL; - - if (!name || !msg || !alias) - return -EINVAL; - - account = purple_connection_get_account(od->gc); - username = purple_account_get_username(account); - - time(&t); - tm = gmtime(&t); - timestr = purple_utf8_strftime("%a, %d %b %Y %T %Z", tm); - - stripped = purple_markup_strip_html(msg); - - /* The length of xml included the null terminating character */ - xmllen = 209 + strlen(name) + strlen(stripped) + strlen(username) + strlen(alias) + strlen(timestr) + 1; - - xml = g_new(char, xmllen); - snprintf(xml, xmllen, "" - "%s" - "%s" - "1252" - "%s" - "%s" - "Yes" - "" - "", - name, stripped, username, alias, timestr); - - bslen = 36 + xmllen; - - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ICQ, 0x0002, 0x0000, NULL, 0); - - /* For simplicity, don't bother using a tlvlist */ - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, bslen); - - byte_stream_putle16(&bs, bslen - 2); - byte_stream_putuid(&bs, od); - byte_stream_putle16(&bs, 0x07d0); /* I command thee. */ - byte_stream_putle16(&bs, snacid); /* eh. */ - - /* From libicq200-0.3.2/src/SNAC-SRV.cpp */ - byte_stream_putle16(&bs, 0x1482); - byte_stream_put16(&bs, 0x0001); - byte_stream_put16(&bs, 0x0016); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, xmllen); - byte_stream_putstr(&bs, xml); - byte_stream_put8(&bs, 0x00); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_ICQ, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - g_free(xml); - g_free(stripped); - - return 0; -} - -static void aim_icq_freeinfo(struct aim_icq_info *info) { - int i; - - if (!info) - return; - g_free(info->nick); - g_free(info->first); - g_free(info->last); - g_free(info->email); - g_free(info->homecity); - g_free(info->homestate); - g_free(info->homephone); - g_free(info->homefax); - g_free(info->homeaddr); - g_free(info->mobile); - g_free(info->homezip); - g_free(info->personalwebpage); - if (info->email2) - for (i = 0; i < info->numaddresses; i++) - g_free(info->email2[i]); - g_free(info->email2); - g_free(info->workcity); - g_free(info->workstate); - g_free(info->workphone); - g_free(info->workfax); - g_free(info->workaddr); - g_free(info->workzip); - g_free(info->workcompany); - g_free(info->workdivision); - g_free(info->workposition); - g_free(info->workwebpage); - g_free(info->info); - g_free(info->status_note_title); - g_free(info); -} - -/** - * Subtype 0x0003 - Response to SNAC_FAMILY_ICQ/0x002, contains an ICQesque packet. - */ -static int -icqresponse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - GSList *tlvlist; - aim_tlv_t *datatlv; - ByteStream qbs; - guint32 ouruin; - guint16 cmdlen, cmd, reqid; - - if (!(tlvlist = aim_tlvlist_read(bs)) || !(datatlv = aim_tlv_gettlv(tlvlist, 0x0001, 1))) { - aim_tlvlist_free(tlvlist); - purple_debug_misc("oscar", "corrupt ICQ response\n"); - return 0; - } - - byte_stream_init(&qbs, datatlv->value, datatlv->length); - - cmdlen = byte_stream_getle16(&qbs); - ouruin = byte_stream_getle32(&qbs); - cmd = byte_stream_getle16(&qbs); - reqid = byte_stream_getle16(&qbs); - - purple_debug_misc("oscar", "icq response: %d bytes, %u, 0x%04x, 0x%04x\n", cmdlen, ouruin, cmd, reqid); - - if (cmd == 0x0041) { /* offline message */ -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS - struct aim_icq_offlinemsg msg; - aim_rxcallback_t userfunc; - - memset(&msg, 0, sizeof(msg)); - - msg.sender = byte_stream_getle32(&qbs); - msg.year = byte_stream_getle16(&qbs); - msg.month = byte_stream_getle8(&qbs); - msg.day = byte_stream_getle8(&qbs); - msg.hour = byte_stream_getle8(&qbs); - msg.minute = byte_stream_getle8(&qbs); - msg.type = byte_stream_getle8(&qbs); - msg.flags = byte_stream_getle8(&qbs); - msg.msglen = byte_stream_getle16(&qbs); - msg.msg = byte_stream_getstr(&qbs, msg.msglen); - - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG))) - ret = userfunc(od, conn, frame, &msg); - - g_free(msg.msg); - - } else if (cmd == 0x0042) { - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE))) - ret = userfunc(od, conn, frame); -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - - } else if (cmd == 0x07da) { /* information */ - guint16 subtype; - struct aim_icq_info *info; - aim_rxcallback_t userfunc; - - subtype = byte_stream_getle16(&qbs); - byte_stream_advance(&qbs, 1); /* 0x0a */ - - /* find other data from the same request */ - for (info = od->icq_info; info && (info->reqid != reqid); info = info->next); - if (!info) { - info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1); - info->reqid = reqid; - info->next = od->icq_info; - od->icq_info = info; - } - - switch (subtype) { - case 0x00a0: { /* hide ip status */ - /* nothing */ - } break; - - case 0x00aa: { /* password change status */ - /* nothing */ - } break; - - case 0x00c8: { /* general and "home" information */ - info->nick = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->first = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->last = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->email = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homecity = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homestate = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homephone = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homefax = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homeaddr = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->mobile = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homezip = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->homecountry = byte_stream_getle16(&qbs); - /* 0x0a 00 02 00 */ - /* 1 byte timezone? */ - /* 1 byte hide email flag? */ - } break; - - case 0x00dc: { /* personal information */ - info->age = byte_stream_getle8(&qbs); - info->unknown = byte_stream_getle8(&qbs); - info->gender = byte_stream_getle8(&qbs); /* Not specified=0x00, Female=0x01, Male=0x02 */ - info->personalwebpage = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->birthyear = byte_stream_getle16(&qbs); - info->birthmonth = byte_stream_getle8(&qbs); - info->birthday = byte_stream_getle8(&qbs); - info->language1 = byte_stream_getle8(&qbs); - info->language2 = byte_stream_getle8(&qbs); - info->language3 = byte_stream_getle8(&qbs); - /* 0x00 00 01 00 00 01 00 00 00 00 00 */ - } break; - - case 0x00d2: { /* work information */ - info->workcity = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workstate = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workphone = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workfax = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workaddr = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workzip = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workcountry = byte_stream_getle16(&qbs); - info->workcompany = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workdivision = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->workposition = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - byte_stream_advance(&qbs, 2); /* 0x01 00 */ - info->workwebpage = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - } break; - - case 0x00e6: { /* additional personal information */ - info->info = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)-1); - } break; - - case 0x00eb: { /* email address(es) */ - int i; - info->numaddresses = byte_stream_getle16(&qbs); - info->email2 = (char **)g_new0(char *, info->numaddresses); - for (i = 0; i < info->numaddresses; i++) { - info->email2[i] = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - if (i+1 != info->numaddresses) - byte_stream_advance(&qbs, 1); /* 0x00 */ - } - } break; - - case 0x00f0: { /* personal interests */ - } break; - - case 0x00fa: { /* past background and current organizations */ - } break; - - case 0x0104: { /* alias info */ - info->nick = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->first = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->last = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - byte_stream_advance(&qbs, byte_stream_getle16(&qbs)); /* email address? */ - /* Then 0x00 02 00 */ - } break; - - case 0x010e: { /* unknown */ - /* 0x00 00 */ - } break; - - case 0x019a: { /* simple info */ - byte_stream_advance(&qbs, 2); - info->uin = byte_stream_getle32(&qbs); - info->nick = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->first = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->last = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - info->email = byte_stream_getstr(&qbs, byte_stream_getle16(&qbs)); - /* Then 0x00 02 00 00 00 00 00 */ - } break; - - /* status note title and send request for status note text */ - case 0x0fb4: { - GSList *tlvlist; - aim_tlv_t *tlv; - FlapConnection *conn; - char *uin = NULL; - char *status_note_title = NULL; - - conn = flap_connection_findbygroup(od, 0x0004); - if (conn == NULL) - { - purple_debug_misc("oscar", "icq/0x0fb4: flap connection was not found.\n"); - break; - } - - byte_stream_advance(&qbs, 0x02); /* length */ - byte_stream_advance(&qbs, 0x2f); /* unknown stuff */ - - tlvlist = aim_tlvlist_read(&qbs); - - tlv = aim_tlv_gettlv(tlvlist, 0x0032, 1); - if (tlv != NULL) - /* Get user number */ - uin = aim_tlv_getvalue_as_string(tlv); - - tlv = aim_tlv_gettlv(tlvlist, 0x0226, 1); - if (tlv != NULL) - /* Get status note title */ - status_note_title = aim_tlv_getvalue_as_string(tlv); - - aim_tlvlist_free(tlvlist); - - if (uin == NULL || status_note_title == NULL) - { - purple_debug_misc("oscar", "icq/0x0fb4: uin or " - "status_note_title was not found\n"); - g_free(uin); - g_free(status_note_title); - break; - } - - if (status_note_title[0] == '\0') - { - PurpleAccount *account; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - - account = purple_connection_get_account(od->gc); - buddy = purple_find_buddy(account, uin); - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_active_status(presence); - - purple_prpl_got_user_status(account, uin, - purple_status_get_id(status), - "message", NULL, NULL); - - g_free(status_note_title); - } - else - { - struct aim_icq_info *info; - ByteStream bs; - guint32 bslen; - aim_snacid_t snacid; - guchar cookie[8]; - - info = g_new0(struct aim_icq_info, 1); - - bslen = 13 + strlen(uin) + 30 + 6 + 4 + 55 + 85 + 4; - byte_stream_new(&bs, 4 + bslen); - - snacid = aim_cachesnac(od, 0x0004, 0x0006, 0x0000, NULL, 0); - - aim_icbm_makecookie(cookie); - - byte_stream_putraw(&bs, cookie, 8); /* ICBM cookie */ - byte_stream_put16(&bs, 0x0002); /* message channel */ - byte_stream_put8(&bs, strlen(uin)); /* uin */ - byte_stream_putstr(&bs, uin); - - byte_stream_put16(&bs, 0x0005); /* rendez vous data */ - byte_stream_put16(&bs, 0x00b2); - byte_stream_put16(&bs, 0x0000); /* request */ - byte_stream_putraw(&bs, cookie, 8); /* ICBM cookie */ - byte_stream_put32(&bs, 0x09461349); /* ICQ server relaying */ - byte_stream_put16(&bs, 0x4c7f); - byte_stream_put16(&bs, 0x11d1); - byte_stream_put32(&bs, 0x82224445); - byte_stream_put32(&bs, 0x53540000); - - byte_stream_put16(&bs, 0x000a); /* unknown TLV */ - byte_stream_put16(&bs, 0x0002); - byte_stream_put16(&bs, 0x0001); - - byte_stream_put16(&bs, 0x000f); /* unknown TLV */ - byte_stream_put16(&bs, 0x0000); - - byte_stream_put16(&bs, 0x2711); /* extended data */ - byte_stream_put16(&bs, 0x008a); - byte_stream_putle16(&bs, 0x001b); /* length */ - byte_stream_putle16(&bs, 0x0009); /* version */ - byte_stream_putle32(&bs, 0x00000000); /* plugin: none */ - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle16(&bs, 0x0000); /* unknown */ - byte_stream_putle32(&bs, 0x00000000); /* client capabilities flags */ - byte_stream_put8(&bs, 0x00); /* unknown */ - byte_stream_putle16(&bs, 0x0064); /* downcounter? */ - byte_stream_putle16(&bs, 0x000e); /* length */ - byte_stream_putle16(&bs, 0x0064); /* downcounter? */ - byte_stream_putle32(&bs, 0x00000000); /* unknown */ - byte_stream_putle32(&bs, 0x00000000); - byte_stream_putle32(&bs, 0x00000000); - byte_stream_put8(&bs, 0x1a); /* message type: plugin message descibed by text string */ - byte_stream_put8(&bs, 0x00); /* message flags */ - byte_stream_putle16(&bs, 0x0000); /* status code */ - byte_stream_putle16(&bs, 0x0001); /* priority code */ - byte_stream_putle16(&bs, 0x0000); /* text length */ - - byte_stream_put8(&bs, 0x3a); /* message dump */ - byte_stream_put32(&bs, 0x00811a18); - byte_stream_put32(&bs, 0xbc0e6c18); - byte_stream_put32(&bs, 0x47a5916f); - byte_stream_put32(&bs, 0x18dcc76f); - byte_stream_put32(&bs, 0x1a010013); - byte_stream_put32(&bs, 0x00000041); - byte_stream_put32(&bs, 0x77617920); - byte_stream_put32(&bs, 0x53746174); - byte_stream_put32(&bs, 0x7573204d); - byte_stream_put32(&bs, 0x65737361); - byte_stream_put32(&bs, 0x67650100); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x00000015); - byte_stream_put32(&bs, 0x00000000); - byte_stream_put32(&bs, 0x0000000d); - byte_stream_put32(&bs, 0x00000074); - byte_stream_put32(&bs, 0x6578742f); - byte_stream_put32(&bs, 0x782d616f); - byte_stream_put32(&bs, 0x6c727466); - - byte_stream_put16(&bs, 0x0003); /* server ACK requested */ - byte_stream_put16(&bs, 0x0000); - - info->uin = atoi(uin); - info->status_note_title = status_note_title; - - memcpy(&info->icbm_cookie, cookie, 8); - - info->next = od->icq_info; - od->icq_info = info; - - flap_connection_send_snac_with_priority(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - } - - g_free(uin); - - } break; - - } /* End switch statement */ - - if (!(snac->flags & 0x0001)) { - if (subtype != 0x0104) - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO))) - ret = userfunc(od, conn, frame, info); - - if (info->uin && info->nick) - if ((userfunc = aim_callhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS))) - ret = userfunc(od, conn, frame, info); - - if (od->icq_info == info) { - od->icq_info = info->next; - } else { - struct aim_icq_info *cur; - for (cur=od->icq_info; (cur->next && (cur->next!=info)); cur=cur->next); - if (cur->next) - cur->next = cur->next->next; - } - aim_icq_freeinfo(info); - } - } - - aim_tlvlist_free(tlvlist); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return icqresponse(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -icq_shutdown(OscarData *od, aim_module_t *mod) -{ - struct aim_icq_info *del; - - while (od->icq_info) { - del = od->icq_info; - od->icq_info = od->icq_info->next; - aim_icq_freeinfo(del); - } - - return; -} - -int -icq_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ICQ; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x047c; - mod->flags = 0; - strncpy(mod->name, "icq", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = icq_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_invite.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_invite.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_invite.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_invite.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0006 - This isn't really ever used by anyone anymore. - * - * Once upon a time, there used to be a menu item in AIM clients that - * said something like "Invite a friend to use AIM..." and then it would - * ask for an email address and it would sent a mail to them saying - * how perfectly wonderful the AIM service is and why you should use it - * and click here if you hate the person who sent this to you and want to - * complain and yell at them in a small box with pretty fonts. - * - * I could've sworn libfaim had this implemented once, a long long time ago, - * but I can't find it. - * - * I'm mainly adding this so that I can keep advertising that we support - * group 6, even though we don't. - * - */ - -#include "oscar.h" - -int invite_modfirst(OscarData *od, aim_module_t *mod) -{ - - mod->family = SNAC_FAMILY_INVITE; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "invite", sizeof(mod->name)); - mod->snachandler = NULL; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_locate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_locate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_locate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_locate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1401 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0002 - Locate. - * - * The functions here are responsible for requesting and parsing information- - * gathering SNACs. Or something like that. This family contains the SNACs - * for getting and setting info, away messages, directory profile thingy, etc. - */ - -#include "oscar.h" -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* Define to log unknown TLVs */ -/* #define LOG_UNKNOWN_TLV */ - -/* - * Capability blocks. - * - * These are CLSIDs. They should actually be of the form: - * - * {0x0946134b, 0x4c7f, 0x11d1, - * {0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}}, - * - * But, eh. - */ -static const struct { - guint32 flag; - guint8 data[16]; -} aim_caps[] = { - - /* - * These are in ascending numerical order. - */ - - /* Client understands short caps, a UUID of the form - * 0946XXYY-4C7F-11D1-8222-444553540000 where XXYY is the short cap. */ - {OSCAR_CAPABILITY_SHORTCAPS, - {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_SECUREIM, - {0x09, 0x46, 0x00, 0x01, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* OSCAR_CAPABILITY_XHTML_IM */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x00, 0x02, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_VIDEO, - {0x09, 0x46, 0x01, 0x00, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* "Live Video" (SIP/RTC Video) support in Windows AIM 5.5.3501 and newer */ - {OSCAR_CAPABILITY_LIVEVIDEO, - {0x09, 0x46, 0x01, 0x01, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* "Camera" support in Windows AIM 5.5.3501 and newer */ - {OSCAR_CAPABILITY_CAMERA, - {0x09, 0x46, 0x01, 0x02, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* "Microphone" support in Windows AIM 5.5.3501 and newer */ - /* OSCAR_CAPABILITY_MICROPHONE */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x03, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* Supports RTC Audio */ - /* OSCAR_CAPABILITY_RTCAUDIO */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x04, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* In iChatAV (version numbers...?) */ - {OSCAR_CAPABILITY_ICHATAV, - {0x09, 0x46, 0x01, 0x05, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x45, 0x53, 0x54, 0x00}}, - - /* Supports "new status message features" (Who advertises this one?) */ - /* OSCAR_CAPABILITY_HOST_STATUS_TEXT_AWARE */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x0a, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* Supports "see as I type" (Who advertises this one?) */ - /* OSCAR_CAPABILITY_SEE_AS_I_TYPE */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0x0b, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* Client only asserts caps for services in which it is participating */ - /* OSCAR_CAPABILITY_SMARTCAPS */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0x01, 0xff, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_HIPTOP, - {0x09, 0x46, 0x13, 0x23, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_TALK, - {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_SENDFILE, - {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ICQ_DIRECT, - {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_DIRECTIM, - {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_BUDDYICON, - {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ADDINS, - {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_GETFILE, - {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ICQSERVERRELAY, - {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* - * Indeed, there are two of these. The former appears to be correct, - * but in some versions of winaim, the second one is set. Either they - * forgot to fix endianness, or they made a typo. It really doesn't - * matter which. - */ - {OSCAR_CAPABILITY_GAMES, - {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - {OSCAR_CAPABILITY_GAMES2, - {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1, - 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_SENDBUDDYLIST, - {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* - * Setting this lets AIM users receive messages from ICQ users, and ICQ - * users receive messages from AIM users. It also lets ICQ users show - * up in buddy lists for AIM users, and AIM users show up in buddy lists - * for ICQ users. And ICQ privacy/invisibility acts like AIM privacy, - * in that if you add a user to your deny list, you will not be able to - * see them as online (previous you could still see them, but they - * couldn't see you. - */ - {OSCAR_CAPABILITY_INTEROPERATE, - {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_UNICODE, - {0x09, 0x46, 0x13, 0x4e, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0xf0, 0x03, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_ICHAT_SCREENSHARE, - {0x09, 0x46, 0xf0, 0x04, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x09, 0x46, 0xf0, 0x05, 0x4c, 0x7f, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_UNICODEOLD, - {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8, - 0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}}, - - {OSCAR_CAPABILITY_TYPING, - {0x56, 0x3f, 0xc8, 0x09, 0x0b, 0x6f, 0x41, 0xbd, - 0x9f, 0x79, 0x42, 0x26, 0x09, 0xdf, 0xa2, 0xf3}}, - - /* - * Chat is oddball. - */ - {OSCAR_CAPABILITY_CHAT, - {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, - 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}, - - /* This is added by the servers and it only shows up for ourselves... */ - {OSCAR_CAPABILITY_GENERICUNKNOWN, - {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, - 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x09}}, - - {OSCAR_CAPABILITY_ICQRTF, - {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, - 0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}}, - - {OSCAR_CAPABILITY_APINFO, - {0xaa, 0x4a, 0x32, 0xb5, 0xf8, 0x84, 0x48, 0xc6, - 0xa3, 0xd7, 0x8c, 0x50, 0x97, 0x19, 0xfd, 0x5b}}, - - {OSCAR_CAPABILITY_TRILLIANCRYPT, - {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb, - 0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_EMPTY, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - - {OSCAR_CAPABILITY_LAST, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, -}; - -/* - * Add the userinfo to our linked list. If we already have userinfo - * for this buddy, then just overwrite parts of the old data. - * - * @param userinfo Contains the new information for the buddy. - */ -static void -aim_locate_adduserinfo(OscarData *od, aim_userinfo_t *userinfo) -{ - aim_userinfo_t *cur; - - cur = aim_locate_finduserinfo(od, userinfo->bn); - - if (cur == NULL) { - cur = (aim_userinfo_t *)g_new0(aim_userinfo_t, 1); - cur->bn = g_strdup(userinfo->bn); - cur->next = od->locate.userinfo; - od->locate.userinfo = cur; - } - - cur->warnlevel = userinfo->warnlevel; - cur->idletime = userinfo->idletime; - if (userinfo->flags != 0) - cur->flags = userinfo->flags; - if (userinfo->createtime != 0) - cur->createtime = userinfo->createtime; - if (userinfo->membersince != 0) - cur->membersince = userinfo->membersince; - if (userinfo->onlinesince != 0) - cur->onlinesince = userinfo->onlinesince; - if (userinfo->sessionlen != 0) - cur->sessionlen = userinfo->sessionlen; - if (userinfo->capabilities != 0) - cur->capabilities = userinfo->capabilities; - cur->present |= userinfo->present; - - if (userinfo->iconcsumlen > 0) { - g_free(cur->iconcsum); - cur->iconcsum = (guint8 *)g_malloc(userinfo->iconcsumlen); - memcpy(cur->iconcsum, userinfo->iconcsum, userinfo->iconcsumlen); - cur->iconcsumlen = userinfo->iconcsumlen; - } - - if (userinfo->info != NULL) { - g_free(cur->info); - g_free(cur->info_encoding); - if (userinfo->info_len > 0) { - cur->info = (char *)g_malloc(userinfo->info_len); - memcpy(cur->info, userinfo->info, userinfo->info_len); - } else - cur->info = NULL; - cur->info_encoding = g_strdup(userinfo->info_encoding); - cur->info_len = userinfo->info_len; - } - - if (userinfo->status != NULL) { - g_free(cur->status); - g_free(cur->status_encoding); - if (userinfo->status_len > 0) { - cur->status = (char *)g_malloc(userinfo->status_len); - memcpy(cur->status, userinfo->status, userinfo->status_len); - } else - cur->status = NULL; - if (userinfo->status_encoding != NULL) - cur->status_encoding = g_strdup(userinfo->status_encoding); - else - cur->status_encoding = NULL; - cur->status_len = userinfo->status_len; - } - - if (userinfo->itmsurl != NULL) { - g_free(cur->itmsurl); - g_free(cur->itmsurl_encoding); - if (userinfo->itmsurl_len > 0) { - cur->itmsurl = (char *)g_malloc(userinfo->itmsurl_len); - memcpy(cur->itmsurl, userinfo->itmsurl, userinfo->itmsurl_len); - } else - cur->itmsurl = NULL; - if (userinfo->itmsurl_encoding != NULL) - cur->itmsurl_encoding = g_strdup(userinfo->itmsurl_encoding); - else - cur->itmsurl_encoding = NULL; - cur->itmsurl_len = userinfo->itmsurl_len; - } - - if (userinfo->away != NULL) { - g_free(cur->away); - g_free(cur->away_encoding); - if (userinfo->away_len > 0) { - cur->away = (char *)g_malloc(userinfo->away_len); - memcpy(cur->away, userinfo->away, userinfo->away_len); - } else - cur->away = NULL; - cur->away_encoding = g_strdup(userinfo->away_encoding); - cur->away_len = userinfo->away_len; - - } else { - /* - * We don't have an away message specified in this user_info - * block, so clear any cached away message now. - */ - if (cur->away) { - g_free(cur->away); - cur->away = NULL; - } - if (cur->away_encoding) { - g_free(cur->away_encoding); - cur->away_encoding = NULL; - } - cur->away_len = 0; - } -} - -aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn) { - aim_userinfo_t *cur = NULL; - - if (bn == NULL) - return NULL; - - cur = od->locate.userinfo; - - while (cur != NULL) { - if (oscar_util_name_compare(cur->bn, bn) == 0) - return cur; - cur = cur->next; - } - - return NULL; -} - -guint32 -aim_locate_getcaps(OscarData *od, ByteStream *bs, int len) -{ - guint32 flags = 0; - int offset; - - for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x10) { - guint8 *cap; - int i, identified; - - cap = byte_stream_getraw(bs, 0x10); - - for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) { - if (memcmp(&aim_caps[i].data, cap, 0x10) == 0) { - flags |= aim_caps[i].flag; - identified++; - break; /* should only match once... */ - } - } - - if (!identified) - purple_debug_misc("oscar", "unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", - cap[0], cap[1], cap[2], cap[3], - cap[4], cap[5], - cap[6], cap[7], - cap[8], cap[9], - cap[10], cap[11], cap[12], cap[13], - cap[14], cap[15]); - - g_free(cap); - } - - return flags; -} - -guint32 -aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len) -{ - guint32 flags = 0; - int offset; - - for (offset = 0; byte_stream_empty(bs) && (offset < len); offset += 0x02) { - guint8 *cap; - int i, identified; - - cap = byte_stream_getraw(bs, 0x02); - - for (i = 0, identified = 0; !(aim_caps[i].flag & OSCAR_CAPABILITY_LAST); i++) { - if (memcmp(&aim_caps[i].data[2], cap, 0x02) == 0) { - flags |= aim_caps[i].flag; - identified++; - break; /* should only match once... */ - } - } - - if (!identified) - purple_debug_misc("oscar", "unknown short capability: {%02x%02x}\n", cap[0], cap[1]); - - g_free(cap); - } - - return flags; -} - -int -byte_stream_putcaps(ByteStream *bs, guint32 caps) -{ - int i; - - if (!bs) - return -EINVAL; - - for (i = 0; byte_stream_empty(bs); i++) { - - if (aim_caps[i].flag == OSCAR_CAPABILITY_LAST) - break; - - if (caps & aim_caps[i].flag) - byte_stream_putraw(bs, aim_caps[i].data, 0x10); - - } - - return 0; -} - -#ifdef LOG_UNKNOWN_TLV -static void -dumptlv(OscarData *od, guint16 type, ByteStream *bs, guint8 len) -{ - int i; - - if (!od || !bs || !len) - return; - - purple_debug_misc("oscar", "userinfo: type =0x%04x\n", type); - purple_debug_misc("oscar", "userinfo: length=0x%04x\n", len); - purple_debug_misc("oscar", "userinfo: value:\n"); - - for (i = 0; i < len; i++) { - if ((i % 8) == 0) - purple_debug_misc("oscar", "\nuserinfo: "); - purple_debug_misc("oscar", "0x%2x ", byte_stream_get8(bs)); - } - - purple_debug_misc("oscar", "\n"); - - return; -} -#endif - -void -aim_info_free(aim_userinfo_t *info) -{ - g_free(info->bn); - g_free(info->iconcsum); - g_free(info->info); - g_free(info->info_encoding); - g_free(info->status); - g_free(info->status_encoding); - g_free(info->itmsurl); - g_free(info->itmsurl_encoding); - g_free(info->away); - g_free(info->away_encoding); -} - -/* - * AIM is fairly regular about providing user info. This is a generic - * routine to extract it in its standard form. - */ -int -aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *outinfo) -{ - int curtlv, tlvcnt; - guint8 bnlen; - - if (!bs || !outinfo) - return -EINVAL; - - /* Clear out old data first */ - memset(outinfo, 0x00, sizeof(aim_userinfo_t)); - - /* - * Username. Stored as an unterminated string prepended with a - * byte containing its length. - */ - bnlen = byte_stream_get8(bs); - outinfo->bn = byte_stream_getstr(bs, bnlen); - - /* - * Warning Level. Stored as an unsigned short. - */ - outinfo->warnlevel = byte_stream_get16(bs); - - /* - * TLV Count. Unsigned short representing the number of - * Type-Length-Value triples that follow. - */ - tlvcnt = byte_stream_get16(bs); - - /* - * Parse out the Type-Length-Value triples as they're found. - */ - for (curtlv = 0; curtlv < tlvcnt; curtlv++) { - guint16 type, length; - int endpos; - - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - - endpos = byte_stream_curpos(bs) + MIN(length, byte_stream_empty(bs)); - - if (type == 0x0001) { - /* - * User flags - * - * Specified as any of the following ORed together: - * 0x0001 Unconfirmed account - * 0x0002 Unknown bit 2 - * 0x0004 AOL Main Service user - * 0x0008 Unknown bit 4 - * 0x0010 Free (AIM) user - * 0x0020 Away - * 0x0040 ICQ user (AIM bit also set) - * 0x0080 Mobile device - * 0x0400 Bot (like ActiveBuddy) - */ - outinfo->flags = byte_stream_get16(bs); - outinfo->present |= AIM_USERINFO_PRESENT_FLAGS; - - } else if (type == 0x0002) { - /* - * Account creation time - * - * The time/date that the user originally registered for - * the service, stored in time_t format. - * - * I'm not sure how this differs from type 5 ("member - * since"). - * - * Note: This is the field formerly known as "member - * since". All these years and I finally found out - * that I got the name wrong. - */ - outinfo->createtime = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_CREATETIME; - - } else if (type == 0x0003) { - /* - * On-Since date - * - * The time/date that the user started their current - * session, stored in time_t format. - */ - outinfo->onlinesince = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_ONLINESINCE; - - } else if (type == 0x0004) { - /* - * Idle time - * - * Number of minutes since the user actively used the - * service. - * - * Note that the client tells the server when to start - * counting idle times, so this may or may not be - * related to reality. - */ - outinfo->idletime = byte_stream_get16(bs); - outinfo->present |= AIM_USERINFO_PRESENT_IDLE; - - } else if (type == 0x0005) { - /* - * Member since date - * - * The time/date that the user originally registered for - * the service, stored in time_t format. - * - * This is sometimes sent instead of type 2 ("account - * creation time"), particularly in the self-info. - * And particularly for ICQ? - */ - outinfo->membersince = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_MEMBERSINCE; - - } else if (type == 0x0006) { - /* - * ICQ Online Status - * - * ICQ's Away/DND/etc "enriched" status. Some decoding - * of values done by Scott - */ - byte_stream_get16(bs); - outinfo->icqinfo.status = byte_stream_get16(bs); - outinfo->present |= AIM_USERINFO_PRESENT_ICQEXTSTATUS; - - } else if (type == 0x0008) { - /* - * Client type, or some such. - */ - - } else if (type == 0x000a) { - /* - * ICQ User IP Address - * - * Ahh, the joy of ICQ security. - */ - outinfo->icqinfo.ipaddr = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_ICQIPADDR; - - } else if (type == 0x000c) { - /* - * Random crap containing the IP address, - * apparently a port number, and some Other Stuff. - * - * Format is: - * 4 bytes - Our IP address, 0xc0 a8 01 2b for 192.168.1.43 - */ - byte_stream_getrawbuf(bs, outinfo->icqinfo.crap, 0x25); - outinfo->present |= AIM_USERINFO_PRESENT_ICQDATA; - - } else if (type == 0x000d) { - /* - * OSCAR Capability information - */ - outinfo->capabilities |= aim_locate_getcaps(od, bs, length); - outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; - - } else if (type == 0x000e) { - /* - * AOL capability information - */ - - } else if ((type == 0x000f) || (type == 0x0010)) { - /* - * Type = 0x000f: Session Length. (AIM) - * Type = 0x0010: Session Length. (AOL) - * - * The duration, in seconds, of the user's current - * session. - * - * Which TLV type this comes in depends on the - * service the user is using (AIM or AOL). - */ - outinfo->sessionlen = byte_stream_get32(bs); - outinfo->present |= AIM_USERINFO_PRESENT_SESSIONLEN; - - } else if (type == 0x0014) { - /* - * My instance number. - */ - guint8 instance_number; - instance_number = byte_stream_get8(bs); - - } else if (type == 0x0019) { - /* - * OSCAR short capability information. A shortened - * form of the normal capabilities. - */ - outinfo->capabilities |= aim_locate_getcaps_short(od, bs, length); - outinfo->present |= AIM_USERINFO_PRESENT_CAPABILITIES; - - } else if (type == 0x001a) { - /* - * Type = 0x001a - * - * AOL short capability information. A shortened - * form of the normal capabilities. - */ - - } else if (type == 0x001b) { - /* - * Encryption certification MD5 checksum. - */ - - } else if (type == 0x001d) { - /* - * Buddy icon information and status/available messages. - * - * This almost seems like the AIM protocol guys gave - * the iChat guys a Type, and the iChat guys tried to - * cram as much cool shit into it as possible. Then - * the Windows AIM guys were like, "hey, that's - * pretty neat, let's copy those prawns." - * - * In that spirit, this can contain a custom message, - * kind of like an away message, but you're not away - * (it's called an "available" message). Or it can - * contain information about the buddy icon the user - * has stored on the server. - */ - guint16 type2; - guint8 number2, length2; - int endpos2; - - /* - * Continue looping as long as we're able to read type2, - * number2, and length2. - */ - while (byte_stream_curpos(bs) + 4 <= endpos) { - type2 = byte_stream_get16(bs); - number2 = byte_stream_get8(bs); - length2 = byte_stream_get8(bs); - - endpos2 = byte_stream_curpos(bs) + MIN(length2, byte_stream_empty(bs)); - - switch (type2) { - case 0x0000: { /* This is an official buddy icon? */ - /* This is always 5 bytes of "0x02 01 d2 04 72"? */ - } break; - - case 0x0001: { /* A buddy icon checksum */ - if ((length2 > 0) && ((number2 == 0x00) || (number2 == 0x01))) { - g_free(outinfo->iconcsum); - outinfo->iconcsumtype = number2; - outinfo->iconcsum = byte_stream_getraw(bs, length2); - outinfo->iconcsumlen = length2; - } - } break; - - case 0x0002: { /* A status/available message */ - g_free(outinfo->status); - g_free(outinfo->status_encoding); - if (length2 >= 4) { - outinfo->status_len = byte_stream_get16(bs); - outinfo->status = byte_stream_getstr(bs, outinfo->status_len); - if (byte_stream_get16(bs) == 0x0001) { /* We have an encoding */ - byte_stream_get16(bs); - outinfo->status_encoding = byte_stream_getstr(bs, byte_stream_get16(bs)); - } else { - /* No explicit encoding, client should use UTF-8 */ - outinfo->status_encoding = NULL; - } - } else { - byte_stream_advance(bs, length2); - outinfo->status_len = 0; - outinfo->status = g_strdup(""); - outinfo->status_encoding = NULL; - } - } break; - - case 0x0009: { /* An iTunes Music Store link */ - g_free(outinfo->itmsurl); - g_free(outinfo->itmsurl_encoding); - if (length2 >= 4) { - outinfo->itmsurl_len = byte_stream_get16(bs); - outinfo->itmsurl = byte_stream_getstr(bs, outinfo->itmsurl_len); - if (byte_stream_get16(bs) == 0x0001) { - /* We have an encoding */ - byte_stream_get16(bs); - outinfo->itmsurl_encoding = byte_stream_getstr(bs, byte_stream_get16(bs)); - } else { - /* No explicit encoding, client should use UTF-8 */ - outinfo->itmsurl_encoding = NULL; - } - } else { - byte_stream_advance(bs, length2); - outinfo->itmsurl_len = 0; - outinfo->itmsurl = g_strdup(""); - outinfo->itmsurl_encoding = NULL; - } - } break; - } - - /* Save ourselves. */ - byte_stream_setpos(bs, endpos2); - } - - } else if (type == 0x001e) { - /* - * Always four bytes, but it doesn't look like an int. - */ - - } else if (type == 0x001f) { - /* - * Upper bytes of user flags. Can be any size - * - * Seen on a buddy using DeadAIM. Data was 4 bytes: - * 0x00 00 00 10 - */ - - } else if (type == 0x0023) { - /* - * Last Buddy Feed update time, in seconds since the epoch. - */ - - } else if (type == 0x0026) { - /* - * Time that the profile was set, in seconds since the epoch. - */ - - } else if (type == 0x0027) { - /* - * Time that the away message was set, in seconds since the epoch. - */ - - } else if (type == 0x002a) { - /* - * Country code based on GeoIP data. - */ - - } else { - - /* - * Reaching here indicates that either AOL has - * added yet another TLV for us to deal with, - * or the parsing has gone Terribly Wrong. - * - * Either way, inform the owner and attempt - * recovery. - * - */ -#ifdef LOG_UNKNOWN_TLV - purple_debug_misc("oscar", "userinfo: **warning: unexpected TLV:\n"); - purple_debug_misc("oscar", "userinfo: bn =%s\n", outinfo->bn); - dumptlv(od, type, bs, length); -#endif - } - - /* Save ourselves. */ - byte_stream_setpos(bs, endpos); - } - - aim_locate_adduserinfo(od, outinfo); - - return 0; -} - -/* - * Inverse of aim_info_extract() - */ -int -aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info) -{ - GSList *tlvlist = NULL; - - if (!bs || !info) - return -EINVAL; - - byte_stream_put8(bs, strlen(info->bn)); - byte_stream_putstr(bs, info->bn); - - byte_stream_put16(bs, info->warnlevel); - - if (info->present & AIM_USERINFO_PRESENT_FLAGS) - aim_tlvlist_add_16(&tlvlist, 0x0001, info->flags); - if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) - aim_tlvlist_add_32(&tlvlist, 0x0002, info->membersince); - if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) - aim_tlvlist_add_32(&tlvlist, 0x0003, info->onlinesince); - if (info->present & AIM_USERINFO_PRESENT_IDLE) - aim_tlvlist_add_16(&tlvlist, 0x0004, info->idletime); - -/* XXX - So, ICQ_OSCAR_SUPPORT is never defined anywhere... */ -#ifdef ICQ_OSCAR_SUPPORT - if (atoi(info->bn) != 0) { - if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) - aim_tlvlist_add_16(&tlvlist, 0x0006, info->icqinfo.status); - if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) - aim_tlvlist_add_32(&tlvlist, 0x000a, info->icqinfo.ipaddr); - } -#endif - - if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) - aim_tlvlist_add_caps(&tlvlist, 0x000d, info->capabilities); - - if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) - aim_tlvlist_add_32(&tlvlist, (guint16)((info->flags & AIM_FLAG_AOL) ? 0x0010 : 0x000f), info->sessionlen); - - byte_stream_put16(bs, aim_tlvlist_count(tlvlist)); - aim_tlvlist_write(bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - return 0; -} - -/* - * Subtype 0x0001 - */ -static int -error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - guint16 reason; - char *bn; - - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "locate error: received response from unknown request!\n"); - return 0; - } - - if ((snac2->family != SNAC_FAMILY_LOCATE) && (snac2->type != 0x0015)) { - purple_debug_misc("oscar", "locate error: received response from invalid request! %d\n", snac2->family); - g_free(snac2->data); - g_free(snac2); - return 0; - } - - if (!(bn = snac2->data)) { - purple_debug_misc("oscar", "locate error: received response from request without a buddy name!\n"); - g_free(snac2); - return 0; - } - - reason = byte_stream_get16(bs); - - /* Notify the user that we do not have info for this buddy */ - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, reason, bn); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/* - * Subtype 0x0002 - * - * Request Location services rights. - * - */ -int -aim_locate_reqrights(OscarData *od) -{ - FlapConnection *conn; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_REQRIGHTS); - - return 0; -} - -/* - * Subtype 0x0003 - * - * Normally contains: - * t(0001) - short containing max profile length (value = 1024) - * t(0002) - short - unknown (value = 16) [max MIME type length?] - * t(0003) - short - unknown (value = 10) - * t(0004) - short - unknown (value = 2048) [ICQ only?] - */ -static int -rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - GSList *tlvlist; - aim_rxcallback_t userfunc; - int ret = 0; - guint16 maxsiglen = 0; - - tlvlist = aim_tlvlist_read(bs); - - if (aim_tlv_gettlv(tlvlist, 0x0001, 1)) - maxsiglen = aim_tlv_get16(tlvlist, 0x0001, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, maxsiglen); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0004 - * - * Gives BOS your profile. - * - * profile_encoding and awaymsg_encoding MUST be set if profile or - * away are set, respectively, and their value may or may not be - * restricted to a few choices. I am currently aware of: - * - * us-ascii Just that - * unicode-2-0 UTF-16BE - * - * profile_len and awaymsg_len MUST be set similarly, and they MUST - * be the length of their respective strings in bytes. - * - * To get the previous behavior of awaymsg == "" un-setting the away - * message, set awaymsg non-NULL and awaymsg_len to 0 (this is the - * obvious equivalent). - * - */ -int -aim_locate_setprofile(OscarData *od, - const char *profile_encoding, const gchar *profile, const int profile_len, - const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - char *encoding; - static const char defencoding[] = {"text/aolrtf; charset=\"%s\""}; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - if (!profile && !awaymsg) - return -EINVAL; - - if ((profile && profile_encoding == NULL) || (awaymsg && awaymsg_len && awaymsg_encoding == NULL)) { - return -EINVAL; - } - - /* Build the packet first to get real length */ - if (profile) { - /* no + 1 here because of %s */ - encoding = g_malloc(strlen(defencoding) + strlen(profile_encoding)); - snprintf(encoding, strlen(defencoding) + strlen(profile_encoding), defencoding, profile_encoding); - aim_tlvlist_add_str(&tlvlist, 0x0001, encoding); - aim_tlvlist_add_raw(&tlvlist, 0x0002, profile_len, (const guchar *)profile); - g_free(encoding); - } - - /* - * So here's how this works: - * - You are away when you have a non-zero-length type 4 TLV stored. - * - You become unaway when you clear the TLV with a zero-length - * type 4 TLV. - * - If you do not send the type 4 TLV, your status does not change - * (that is, if you were away, you'll remain away). - */ - if (awaymsg) { - if (awaymsg_len) { - encoding = g_malloc(strlen(defencoding) + strlen(awaymsg_encoding)); - snprintf(encoding, strlen(defencoding) + strlen(awaymsg_encoding), defencoding, awaymsg_encoding); - aim_tlvlist_add_str(&tlvlist, 0x0003, encoding); - aim_tlvlist_add_raw(&tlvlist, 0x0004, awaymsg_len, (const guchar *)awaymsg); - g_free(encoding); - } else - aim_tlvlist_add_noval(&tlvlist, 0x0004); - } - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0004 - Set your client's capabilities. - */ -int -aim_locate_setcaps(OscarData *od, guint32 caps) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - aim_tlvlist_add_caps(&tlvlist, 0x0005, caps); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0005 - Request info of another AIM user. - * - * @param bn The buddy name whose info you wish to request. - * @param infotype The type of info you wish to request. - * 0x0001 - Info/profile - * 0x0003 - Away message - * 0x0004 - Capabilities - */ -int -aim_locate_getinfo(OscarData *od, const char *bn, guint16 infotype) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 2+1+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0005, 0x0000, NULL, 0); - - byte_stream_put16(&bs, infotype); - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0005, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* Subtype 0x0006 */ -static int -userinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_userinfo_t *userinfo, *userinfo2; - GSList *tlvlist; - aim_tlv_t *tlv = NULL; - - userinfo = (aim_userinfo_t *)g_malloc(sizeof(aim_userinfo_t)); - aim_info_extract(od, bs, userinfo); - tlvlist = aim_tlvlist_read(bs); - - /* Profile will be 1 and 2 */ - userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1); - if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) { - userinfo->info = (char *)g_malloc(tlv->length); - memcpy(userinfo->info, tlv->value, tlv->length); - userinfo->info_len = tlv->length; - } - - /* Away message will be 3 and 4 */ - userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1); - if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) { - userinfo->away = (char *)g_malloc(tlv->length); - memcpy(userinfo->away, tlv->value, tlv->length); - userinfo->away_len = tlv->length; - } - - /* Caps will be 5 */ - if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) { - ByteStream cbs; - byte_stream_init(&cbs, tlv->value, tlv->length); - userinfo->capabilities = aim_locate_getcaps(od, &cbs, tlv->length); - userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES; - } - aim_tlvlist_free(tlvlist); - - aim_locate_adduserinfo(od, userinfo); - userinfo2 = aim_locate_finduserinfo(od, userinfo->bn); - aim_info_free(userinfo); - g_free(userinfo); - - /* Show the info to the user */ - if (userinfo2 != NULL && ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))) - ret = userfunc(od, conn, frame, userinfo2); - - return ret; -} - -/* - * Subtype 0x0009 - Set directory profile data. - * - * This is not the same as aim_location_setprofile! - * privacy: 1 to allow searching, 0 to disallow. - * - */ -int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - aim_tlvlist_add_16(&tlvlist, 0x000a, privacy); - - if (first) - aim_tlvlist_add_str(&tlvlist, 0x0001, first); - if (last) - aim_tlvlist_add_str(&tlvlist, 0x0002, last); - if (middle) - aim_tlvlist_add_str(&tlvlist, 0x0003, middle); - if (maiden) - aim_tlvlist_add_str(&tlvlist, 0x0004, maiden); - - if (state) - aim_tlvlist_add_str(&tlvlist, 0x0007, state); - if (city) - aim_tlvlist_add_str(&tlvlist, 0x0008, city); - - if (nickname) - aim_tlvlist_add_str(&tlvlist, 0x000c, nickname); - if (zip) - aim_tlvlist_add_str(&tlvlist, 0x000d, zip); - - if (street) - aim_tlvlist_add_str(&tlvlist, 0x0021, street); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0009, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x0009, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x000b - Huh? What is this? - */ -int aim_locate_000b(OscarData *od, const char *bn) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - return -EINVAL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 1+strlen(bn)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x000b, 0x0000, NULL, 0); - - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x000b, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x000f - * - * XXX pass these in better - * - */ -int -aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE))) - return -EINVAL; - - /* ?? privacy ?? */ - aim_tlvlist_add_16(&tlvlist, 0x000a, privacy); - - if (interest1) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest1); - if (interest2) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest2); - if (interest3) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest3); - if (interest4) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest4); - if (interest5) - aim_tlvlist_add_str(&tlvlist, 0x0000b, interest5); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x000f, 0x0000, NULL, 0); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send_snac(od, conn, SNAC_FAMILY_LOCATE, 0x000f, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - return 0; -} - -/* - * Subtype 0x0015 - Request the info of a user using the short method. This is - * what iChat uses. It normally is VERY leniently rate limited. - * - * @param bn The buddy name whose info you wish to request. - * @param flags The bitmask which specifies the type of info you wish to request. - * 0x00000001 - Info/profile. - * 0x00000002 - Away message. - * 0x00000004 - Capabilities. - * 0x00000008 - Certification. - * @return Return 0 if no errors, otherwise return the error number. - */ -int -aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_LOCATE)) || !bn) - return -EINVAL; - - byte_stream_new(&bs, 4 + 1 + strlen(bn)); - byte_stream_put32(&bs, flags); - byte_stream_put8(&bs, strlen(bn)); - byte_stream_putstr(&bs, bn); - - snacid = aim_cachesnac(od, SNAC_FAMILY_LOCATE, 0x0015, 0x0000, bn, strlen(bn)+1); - flap_connection_send_snac_with_priority(od, conn, SNAC_FAMILY_LOCATE, 0x0015, 0x0000, snacid, &bs, FALSE); - - byte_stream_destroy(&bs); - - return 0; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0003) - return rights(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0006) - return userinfo(od, conn, mod, frame, snac, bs); - - return 0; -} - -static void -locate_shutdown(OscarData *od, aim_module_t *mod) -{ - aim_userinfo_t *del; - - while (od->locate.userinfo) { - del = od->locate.userinfo; - od->locate.userinfo = od->locate.userinfo->next; - aim_info_free(del); - g_free(del); - } -} - -int -locate_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_LOCATE; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "locate", sizeof(mod->name)); - mod->snachandler = snachandler; - mod->shutdown = locate_shutdown; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_odir.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_odir.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_odir.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_odir.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,264 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000f - Newer Search Method - * - * Used for searching for other AIM users by email address, name, - * location, commmon interests, and a few other similar things. - * - */ - -#include "oscar.h" - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * Search for an AIM buddy based on their email address. - * - * @param od The oscar session. - * @param region Should be "us-ascii" unless you know what you're doing. - * @param email The email address you want to search for. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_odir_email(OscarData *od, const char *region, const char *email) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region || !email) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_str(&tlvlist, 0x001c, region); - aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0001); /* Type of search */ - aim_tlvlist_add_str(&tlvlist, 0x0005, email); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * Search for an AIM buddy based on various info - * about the person. - * - * @param od The oscar session. - * @param region Should be "us-ascii" unless you know what you're doing. - * @param first The first name of the person you want to search for. - * @param middle The middle name of the person you want to search for. - * @param last The last name of the person you want to search for. - * @param maiden The maiden name of the person you want to search for. - * @param nick The nick name of the person you want to search for. - * @param city The city where the person you want to search for resides. - * @param state The state where the person you want to search for resides. - * @param country The country where the person you want to search for resides. - * @param zip The zip code where the person you want to search for resides. - * @param address The street address where the person you want to seach for resides. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_odir_name(OscarData *od, const char *region, const char *first, const char *middle, const char *last, const char *maiden, const char *nick, const char *city, const char *state, const char *country, const char *zip, const char *address) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_str(&tlvlist, 0x001c, region); - aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0000); /* Type of search */ - if (first) - aim_tlvlist_add_str(&tlvlist, 0x0001, first); - if (last) - aim_tlvlist_add_str(&tlvlist, 0x0002, last); - if (middle) - aim_tlvlist_add_str(&tlvlist, 0x0003, middle); - if (maiden) - aim_tlvlist_add_str(&tlvlist, 0x0004, maiden); - if (country) - aim_tlvlist_add_str(&tlvlist, 0x0006, country); - if (state) - aim_tlvlist_add_str(&tlvlist, 0x0007, state); - if (city) - aim_tlvlist_add_str(&tlvlist, 0x0008, city); - if (nick) - aim_tlvlist_add_str(&tlvlist, 0x000c, nick); - if (zip) - aim_tlvlist_add_str(&tlvlist, 0x000d, zip); - if (address) - aim_tlvlist_add_str(&tlvlist, 0x0021, address); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0002 - Submit a User Search Request - * - * @param od The oscar session. - * @param interest1 An interest you want to search for. - * @return Return 0 if no errors, otherwise return the error number. - */ -int aim_odir_interest(OscarData *od, const char *region, const char *interest) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ODIR)) || !region) - return -EINVAL; - - /* Create a TLV chain, write it to the outgoing frame, then free the chain */ - aim_tlvlist_add_str(&tlvlist, 0x001c, region); - aim_tlvlist_add_16(&tlvlist, 0x000a, 0x0001); /* Type of search */ - if (interest) - aim_tlvlist_add_str(&tlvlist, 0x0001, interest); - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_ODIR, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_ODIR, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - - -/** - * Subtype 0x0003 - Receive Reply From a User Search - * - */ -static int parseresults(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 tmp, numresults; - struct aim_odir *results = NULL; - - tmp = byte_stream_get16(bs); /* Unknown */ - tmp = byte_stream_get16(bs); /* Unknown */ - byte_stream_advance(bs, tmp); - - numresults = byte_stream_get16(bs); /* Number of results to follow */ - - /* Allocate a linked list, 1 node per result */ - while (numresults) { - struct aim_odir *new; - GSList *tlvlist = aim_tlvlist_readnum(bs, byte_stream_get16(bs)); - new = (struct aim_odir *)g_malloc(sizeof(struct aim_odir)); - new->first = aim_tlv_getstr(tlvlist, 0x0001, 1); - new->last = aim_tlv_getstr(tlvlist, 0x0002, 1); - new->middle = aim_tlv_getstr(tlvlist, 0x0003, 1); - new->maiden = aim_tlv_getstr(tlvlist, 0x0004, 1); - new->email = aim_tlv_getstr(tlvlist, 0x0005, 1); - new->country = aim_tlv_getstr(tlvlist, 0x0006, 1); - new->state = aim_tlv_getstr(tlvlist, 0x0007, 1); - new->city = aim_tlv_getstr(tlvlist, 0x0008, 1); - new->bn = aim_tlv_getstr(tlvlist, 0x0009, 1); - new->interest = aim_tlv_getstr(tlvlist, 0x000b, 1); - new->nick = aim_tlv_getstr(tlvlist, 0x000c, 1); - new->zip = aim_tlv_getstr(tlvlist, 0x000d, 1); - new->region = aim_tlv_getstr(tlvlist, 0x001c, 1); - new->address = aim_tlv_getstr(tlvlist, 0x0021, 1); - new->next = results; - results = new; - numresults--; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, results); - - /* Now free everything from above */ - while (results) { - struct aim_odir *del = results; - results = results->next; - g_free(del->first); - g_free(del->last); - g_free(del->middle); - g_free(del->maiden); - g_free(del->email); - g_free(del->country); - g_free(del->state); - g_free(del->city); - g_free(del->bn); - g_free(del->interest); - g_free(del->nick); - g_free(del->zip); - g_free(del->region); - g_free(del->address); - g_free(del); - } - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return parseresults(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -odir_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_ODIR; - mod->version = 0x0001; - mod->toolid = 0x0010; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "odir", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_oservice.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_oservice.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_oservice.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_oservice.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1176 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0001 - This is a very special group. All connections support - * this group, as it does some particularly good things (like rate limiting). - */ - -#include "oscar.h" - -#include "cipher.h" - -/* - * Each time we make a FLAP connection to an oscar server the server gives - * us a list of rate classes. Each rate class has different properties for - * how frequently we can send SNACs in that rate class before we become - * throttled or disconnected. - * - * The server also gives us a list of every available SNAC and tells us which - * rate class it's in. There are a lot of different SNACs, so this list can be - * fairly large. One important characteristic of these rate classes is that - * currently (and since at least 2004) most SNACs are in the same rate class. - * - * One optimization we can do to save memory is to only keep track of SNACs - * that are in classes other than this default rate class. So if we try to - * look up a SNAC and it's not in our hash table then we can assume that it's - * in the default rate class. - */ -#define OSCAR_DEFAULT_RATECLASS 1 - -/* Subtype 0x0002 - Client Online */ -void -aim_srv_clientready(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *cur; - - byte_stream_new(&bs, 1142); - - /* - * Send only the tool versions that the server cares about (that it - * marked as supporting in the server ready SNAC). - */ - for (cur = conn->groups; cur != NULL; cur = cur->next) - { - aim_module_t *mod; - - if ((mod = aim__findmodulebygroup(od, GPOINTER_TO_UINT(cur->data)))) - { - byte_stream_put16(&bs, mod->family); - byte_stream_put16(&bs, mod->version); - byte_stream_put16(&bs, mod->toolid); - byte_stream_put16(&bs, mod->toolversion); - } - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Subtype 0x0003 - Host Online - * - * See comments in conn.c about how the group associations are supposed - * to work, and how they really work. - * - * This info probably doesn't even need to make it to the client. - * - * We don't actually call the client here. This starts off the connection - * initialization routine required by all AIM connections. The next time - * the client is called is the CONNINITDONE callback, which should be - * shortly after the rate information is acknowledged. - * - */ -static int -hostonline(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int group; - - while (byte_stream_empty(bs)) - { - group = byte_stream_get16(bs); - conn->groups = g_slist_prepend(conn->groups, GUINT_TO_POINTER(group)); - } - - /* - * Next step is in the Host Versions handler. - * - * Note that we must send this before we request rates, since - * the format of the rate information depends on the versions we - * give it. - * - */ - aim_srv_setversions(od, conn); - - return 1; -} - -/* Subtype 0x0004 - Service request */ -void -aim_srv_requestnew(OscarData *od, guint16 serviceid) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - if(!conn) - return; - - byte_stream_new(&bs, 6); - - byte_stream_put16(&bs, serviceid); - - if (od->use_ssl) - /* Request SSL Connection */ - aim_tlvlist_add_noval(&tlvlist, 0x008c); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Join a room of name roomname. This is the first step to joining an - * already created room. It's basically a Service Request for - * family 0x000e, with a little added on to specify the exchange and room - * name. - */ -int -aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - struct chatsnacinfo csi; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - if (!conn || !roomname || roomname[0] == '\0') - return -EINVAL; - - byte_stream_new(&bs, 506); - - memset(&csi, 0, sizeof(csi)); - csi.exchange = exchange; - g_strlcpy(csi.name, roomname, sizeof(csi.name)); - csi.instance = instance; - - /* - * Requesting service chat (0x000e) - */ - byte_stream_put16(&bs, 0x000e); - - aim_tlvlist_add_chatroom(&tlvlist, 0x0001, exchange, roomname, instance); - - if (od->use_ssl) - /* Request SSL Connection */ - aim_tlvlist_add_noval(&tlvlist, 0x008c); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, &csi, sizeof(csi)); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* Subtype 0x0005 - Redirect */ -static int -redirect(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - struct aim_redirect_data redir; - aim_rxcallback_t userfunc; - GSList *tlvlist; - aim_snac_t *origsnac = NULL; - int ret = 0; - - memset(&redir, 0, sizeof(redir)); - - tlvlist = aim_tlvlist_read(bs); - - if (!aim_tlv_gettlv(tlvlist, 0x000d, 1) || - !aim_tlv_gettlv(tlvlist, 0x0005, 1) || - !aim_tlv_gettlv(tlvlist, 0x0006, 1)) { - aim_tlvlist_free(tlvlist); - return 0; - } - - redir.group = aim_tlv_get16(tlvlist, 0x000d, 1); - redir.ip = aim_tlv_getstr(tlvlist, 0x0005, 1); - redir.cookielen = aim_tlv_gettlv(tlvlist, 0x0006, 1)->length; - redir.cookie = (guchar *)aim_tlv_getstr(tlvlist, 0x0006, 1); - redir.ssl_cert_cn = aim_tlv_getstr(tlvlist, 0x008d, 1); - redir.use_ssl = aim_tlv_get8(tlvlist, 0x008e, 1); - - /* Fetch original SNAC so we can get csi if needed */ - origsnac = aim_remsnac(od, snac->id); - - if ((redir.group == SNAC_FAMILY_CHAT) && origsnac) { - struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data; - - redir.chat.exchange = csi->exchange; - redir.chat.room = csi->name; - redir.chat.instance = csi->instance; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &redir); - - g_free((void *)redir.ip); - g_free((void *)redir.cookie); - g_free((void *)redir.ssl_cert_cn); - - if (origsnac) - g_free(origsnac->data); - g_free(origsnac); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* Subtype 0x0006 - Request Rate Information. */ -void -aim_srv_reqrates(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x0006); -} - -/* - * OSCAR defines several 'rate classes'. Each class has separate - * rate limiting properties (limit level, alert level, disconnect - * level, etc), and a set of SNAC family/type pairs associated with - * it. The rate classes, their limiting properties, and the definitions - * of which SNACs belong to which class are defined in the - * Rate Response packet at login to each host. - * - * Logically, all rate offenses within one class count against further - * offenses for other SNACs in the same class (ie, sending messages - * too fast will limit the number of user info requests you can send, - * since those two SNACs are in the same rate class). - * - * Since the rate classes are defined dynamically at login, the values - * below may change. But they seem to be fairly constant. - * - * Currently, BOS defines five rate classes, with the commonly used - * members as follows... - * - * Rate class 0x0001: - * - Everything thats not in any of the other classes - * - * Rate class 0x0002: - * - Buddy list add/remove - * - Permit list add/remove - * - Deny list add/remove - * - * Rate class 0x0003: - * - User information requests - * - Outgoing ICBMs - * - * Rate class 0x0004: - * - A few unknowns: 2/9, 2/b, and f/2 - * - * Rate class 0x0005: - * - Chat room create - * - Outgoing chat ICBMs - * - * The only other thing of note is that class 5 (chat) has slightly looser - * limiting properties than class 3 (normal messages). But thats just a - * small bit of trivia for you. - * - * The last thing that needs to be learned about the rate limiting - * system is how the actual numbers relate to the passing of time. This - * seems to be a big mystery. - * - * See joscar's javadoc for the RateClassInfo class for a great - * explanation. You might be able to find it at - * http://dscoder.com/RateClassInfo.html - */ - -static struct rateclass * -rateclass_find(GSList *rateclasses, guint16 id) -{ - GSList *tmp; - - for (tmp = rateclasses; tmp != NULL; tmp = tmp->next) - { - struct rateclass *rateclass; - rateclass = tmp->data; - if (rateclass->classid == id) - return rateclass; - } - - return NULL; -} - -/* Subtype 0x0007 - Rate Parameters */ -static int -rateresp(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - guint16 numclasses, i; - aim_rxcallback_t userfunc; - - /* - * First are the parameters for each rate class. - */ - numclasses = byte_stream_get16(bs); - for (i = 0; i < numclasses; i++) - { - struct rateclass *rateclass; - guint32 delta; - struct timeval now; - - gettimeofday(&now, NULL); - rateclass = g_new(struct rateclass, 1); - - rateclass->classid = byte_stream_get16(bs); - rateclass->windowsize = byte_stream_get32(bs); - rateclass->clear = byte_stream_get32(bs); - rateclass->alert = byte_stream_get32(bs); - rateclass->limit = byte_stream_get32(bs); - rateclass->disconnect = byte_stream_get32(bs); - rateclass->current = byte_stream_get32(bs); - rateclass->max = byte_stream_get32(bs); - if (mod->version >= 3) { - delta = byte_stream_get32(bs); - rateclass->dropping_snacs = byte_stream_get8(bs); - } else { - delta = 0; - rateclass->dropping_snacs = 0; - } - - rateclass->last.tv_sec = now.tv_sec - delta / 1000; - rateclass->last.tv_usec = now.tv_usec - (delta % 1000) * 1000; - - conn->rateclasses = g_slist_prepend(conn->rateclasses, rateclass); - - if (rateclass->classid == OSCAR_DEFAULT_RATECLASS) - conn->default_rateclass = rateclass; - } - conn->rateclasses = g_slist_reverse(conn->rateclasses); - - /* - * Then the members of each class. - */ - for (i = 0; i < numclasses; i++) - { - guint16 classid, count; - struct rateclass *rateclass; - int j; - - classid = byte_stream_get16(bs); - count = byte_stream_get16(bs); - - if (classid == OSCAR_DEFAULT_RATECLASS) { - /* - * Don't bother adding these SNACs to the hash table. See the - * comment for OSCAR_DEFAULT_RATECLASS at the top of this file. - */ - byte_stream_advance(bs, 4 * count); - continue; - } - - rateclass = rateclass_find(conn->rateclasses, classid); - - for (j = 0; j < count; j++) - { - guint16 group, subtype; - - group = byte_stream_get16(bs); - subtype = byte_stream_get16(bs); - - if (rateclass != NULL) - g_hash_table_insert(conn->rateclass_members, - GUINT_TO_POINTER((group << 16) + subtype), - rateclass); - } - } - - /* - * We don't pass the rate information up to the client, as it really - * doesn't care. The information is stored in the connection, however - * so that we can do rate limiting management when sending SNACs. - */ - - /* - * Subscribe to rate change information for all rate classes. - */ - aim_srv_rates_addparam(od, conn); - - /* - * Finally, tell the client it's ready to go... - */ - if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE))) - userfunc(od, conn, frame); - - return 1; -} - -/* Subtype 0x0008 - Add Rate Parameter */ -void -aim_srv_rates_addparam(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tmp; - - byte_stream_new(&bs, 502); - - for (tmp = conn->rateclasses; tmp != NULL; tmp = tmp->next) - { - struct rateclass *rateclass; - rateclass = tmp->data; - byte_stream_put16(&bs, rateclass->classid); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x0009 - Delete Rate Parameter */ -void -aim_srv_rates_delparam(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *tmp; - - byte_stream_new(&bs, 502); - - for (tmp = conn->rateclasses; tmp != NULL; tmp = tmp->next) - { - struct rateclass *rateclass; - rateclass = tmp->data; - byte_stream_put16(&bs, rateclass->classid); - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x000a - Rate Change */ -static int -ratechange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - guint16 code, classid; - struct rateclass *rateclass; - guint32 delta; - struct timeval now; - static const char *codes[5] = { - "invalid", - "change", - "warning", - "limit", - "limit cleared", - }; - - gettimeofday(&now, NULL); - code = byte_stream_get16(bs); - classid = byte_stream_get16(bs); - - rateclass = rateclass_find(conn->rateclasses, classid); - if (rateclass == NULL) - /* This should never really happen */ - return 0; - - rateclass->windowsize = byte_stream_get32(bs); - rateclass->clear = byte_stream_get32(bs); - rateclass->alert = byte_stream_get32(bs); - rateclass->limit = byte_stream_get32(bs); - rateclass->disconnect = byte_stream_get32(bs); - rateclass->current = byte_stream_get32(bs); - rateclass->max = byte_stream_get32(bs); - if (mod->version >= 3) { - delta = byte_stream_get32(bs); - rateclass->dropping_snacs = byte_stream_get8(bs); - } else { - delta = 0; - rateclass->dropping_snacs = 0; - } - - rateclass->last.tv_sec = now.tv_sec - delta / 1000; - rateclass->last.tv_usec = now.tv_usec - (delta % 1000) * 1000; - - purple_debug_misc("oscar", "rate %s (param ID 0x%04hx): curavg = %u, " - "maxavg = %u, alert at %u, clear warning at %u, limit at %u, " - "disconnect at %u, delta is %u, dropping is %u (window size = %u)\n", - (code < 5) ? codes[code] : codes[0], rateclass->classid, - rateclass->current, rateclass->max, rateclass->alert, - rateclass->clear, rateclass->limit, rateclass->disconnect, - delta, rateclass->dropping_snacs, rateclass->windowsize); - - if (code == AIM_RATE_CODE_LIMIT) { - purple_debug_warning("oscar", "The last action you attempted " - "could not be performed because you are over the rate " - "limit. Please wait 10 seconds and try again.\n"); - } - - return 1; -} - -/* - * How Migrations work. - * - * The server sends a Server Pause message, which the client should respond to - * with a Server Pause Ack, which contains the families it needs on this - * connection. The server will send a Migration Notice with an IP address, and - * then disconnect. Next the client should open the connection and send the - * cookie. Repeat the normal login process and pretend this never happened. - * - * The Server Pause contains no data. - * - */ - -/* Subtype 0x000b - Service Pause */ -static int -serverpause(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/* - * Subtype 0x000c - Service Pause Acknowledgement - * - * It is rather important that aim_srv_sendpauseack() gets called for the exact - * same connection that the Server Pause callback was called for, since - * libfaim extracts the data for the SNAC from the connection structure. - * - * Of course, if you don't do that, more bad things happen than just what - * libfaim can cause. - * - */ -void -aim_srv_sendpauseack(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *cur; - - byte_stream_new(&bs, 1014); - - /* - * This list should have all the groups that the original - * Host Online / Server Ready said this host supports. And - * we want them all back after the migration. - */ - for (cur = conn->groups; cur != NULL; cur = cur->next) - byte_stream_put16(&bs, GPOINTER_TO_UINT(cur->data)); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x000d - Service Resume */ -static int -serverresume(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame); - - return ret; -} - -/* Subtype 0x000e - Request self-info */ -void -aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x000e); -} - -/* Subtype 0x000f - Self User Info */ -static int -selfinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_userinfo_t userinfo; - - aim_info_extract(od, bs, &userinfo); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, &userinfo); - - aim_info_free(&userinfo); - - return ret; -} - -/* Subtype 0x0010 - Evil Notification */ -static int -evilnotify(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 newevil; - aim_userinfo_t userinfo; - - memset(&userinfo, 0, sizeof(aim_userinfo_t)); - - newevil = byte_stream_get16(bs); - - if (byte_stream_empty(bs)) - aim_info_extract(od, bs, &userinfo); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, newevil, &userinfo); - - aim_info_free(&userinfo); - - return ret; -} - -/* - * Subtype 0x0011 - Idle Notification - * - * Should set your current idle time in seconds. Note that this should - * never be called consecutively with a non-zero idle time. That makes - * OSCAR do funny things. Instead, just set it once you go idle, and then - * call it again with zero when you're back. - * - */ -void -aim_srv_setidle(OscarData *od, guint32 idletime) -{ - FlapConnection *conn; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); - if(!conn) - return; - - aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0011, &idletime); -} - -/* - * Subtype 0x0012 - Service Migrate - * - * This is the final SNAC sent on the original connection during a migration. - * It contains the IP and cookie used to connect to the new server, and - * optionally a list of the SNAC groups being migrated. - * - */ -static int -migrate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - int ret = 0; - guint16 groupcount, i; - GSList *tlvlist; - char *ip = NULL; - aim_tlv_t *cktlv; - - /* - * Apparently there's some fun stuff that can happen right here. The - * migration can actually be quite selective about what groups it - * moves to the new server. When not all the groups for a connection - * are migrated, or they are all migrated but some groups are moved - * to a different server than others, it is called a bifurcated - * migration. - * - * Let's play dumb and not support that. - * - */ - groupcount = byte_stream_get16(bs); - for (i = 0; i < groupcount; i++) { - guint16 group; - - group = byte_stream_get16(bs); - - purple_debug_misc("oscar", "bifurcated migration unsupported -- group 0x%04x\n", group); - } - - tlvlist = aim_tlvlist_read(bs); - - if (aim_tlv_gettlv(tlvlist, 0x0005, 1)) - ip = aim_tlv_getstr(tlvlist, 0x0005, 1); - - cktlv = aim_tlv_gettlv(tlvlist, 0x0006, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, ip, cktlv ? cktlv->value : NULL); - - aim_tlvlist_free(tlvlist); - g_free(ip); - - return ret; -} - -/* Subtype 0x0013 - Message of the Day */ -static int -motd(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - char *msg = NULL; - int ret = 0; - GSList *tlvlist; - guint16 id; - - /* - * Code. - * - * Valid values: - * 1 Mandatory upgrade - * 2 Advisory upgrade - * 3 System bulletin - * 4 Nothing's wrong ("top o the world" -- normal) - * 5 Lets-break-something. - * - */ - id = byte_stream_get16(bs); - - /* - * TLVs follow - */ - tlvlist = aim_tlvlist_read(bs); - - msg = aim_tlv_getstr(tlvlist, 0x000b, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, id, msg); - - g_free(msg); - - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* - * Subtype 0x0014 - Set privacy flags - * - * Normally 0x03. - * - * Bit 1: Allows other AIM users to see how long you've been idle. - * Bit 2: Allows other AIM users to see how long you've been a member. - * - */ -void -aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags) -{ - aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0014, &flags); -} - -/* - * Subtype 0x0016 - No-op - * - * WinAIM sends these every 4min or so to keep the connection alive. Its not - * really necessary. - * - * Wha? No? Since when? I think WinAIM sends an empty channel 5 - * FLAP as a no-op... - */ -void -aim_srv_nop(OscarData *od, FlapConnection *conn) -{ - aim_genericreq_n(od, conn, SNAC_FAMILY_OSERVICE, 0x0016); -} - -/* - * Subtype 0x0017 - Set client versions - * - * If you've seen the clientonline/clientready SNAC you're probably - * wondering what the point of this one is. And that point seems to be - * that the versions in the client online SNAC are sent too late for the - * server to be able to use them to change the protocol for the earlier - * login packets (client versions are sent right after Host Online is - * received, but client online versions aren't sent until quite a bit later). - * We can see them already making use of this by changing the format of - * the rate information based on what version of group 1 we advertise here. - * - */ -void -aim_srv_setversions(OscarData *od, FlapConnection *conn) -{ - ByteStream bs; - aim_snacid_t snacid; - GSList *cur; - - byte_stream_new(&bs, 1142); - - /* - * Send only the versions that the server cares about (that it - * marked as supporting in the server ready SNAC). - */ - for (cur = conn->groups; cur != NULL; cur = cur->next) - { - aim_module_t *mod; - - if ((mod = aim__findmodulebygroup(od, GPOINTER_TO_UINT(cur->data)))) - { - byte_stream_put16(&bs, mod->family); - byte_stream_put16(&bs, mod->version); - } - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* Subtype 0x0018 - Host versions */ -static int -hostversions(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int vercount; - guint8 *versions; - - /* This is frivolous. (Thank you SmarterChild.) */ - vercount = byte_stream_empty(bs)/4; - versions = byte_stream_getraw(bs, byte_stream_empty(bs)); - g_free(versions); - - /* - * Now request rates. - */ - aim_srv_reqrates(od, conn); - - return 1; -} - -/** - * Subtype 0x001e - Extended Status/Extra Info. - * - * These settings are transient, not server-stored (i.e. they only - * apply to this session, and must be re-set the next time you sign - * on). - * - * You can set your ICQ status (available, away, do not disturb, - * etc.), or whether your IP address should be hidden or not, or - * if your status is visible on ICQ web sites, and you can set - * your IP address info and what not. - * - * You can also set your "available" message. This is currently - * only supported by iChat, Purple and other 3rd party clients. - * - * These are the same TLVs seen in user info. You can - * also set 0x0008 and 0x000c. - */ -int -aim_srv_setextrainfo(OscarData *od, - gboolean seticqstatus, guint32 icqstatus, - gboolean setstatusmsg, const char *statusmsg, const char *itmsurl) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - GSList *tlvlist = NULL; - - if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM))) - return -EINVAL; - - if (seticqstatus) - { - aim_tlvlist_add_32(&tlvlist, 0x0006, icqstatus | - AIM_ICQ_STATE_HIDEIP | AIM_ICQ_STATE_DIRECTREQUIREAUTH); - } - -#if 0 - if (other_stuff_that_isnt_implemented) - { - aim_tlvlist_add_raw(&tlvlist, 0x000c, 0x0025, - chunk_of_x25_bytes_with_ip_address_etc); - aim_tlvlist_add_raw(&tlvlist, 0x0011, 0x0005, unknown 0x01 61 10 f6 41); - aim_tlvlist_add_16(&tlvlist, 0x0012, unknown 0x00 00); - } -#endif - - if (setstatusmsg) - { - size_t statusmsglen, itmsurllen; - ByteStream tmpbs; - - statusmsglen = (statusmsg != NULL) ? strlen(statusmsg) : 0; - itmsurllen = (itmsurl != NULL) ? strlen(itmsurl) : 0; - - byte_stream_new(&tmpbs, statusmsglen + 8 + itmsurllen + 8); - byte_stream_put_bart_asset_str(&tmpbs, 0x0002, statusmsg); - byte_stream_put_bart_asset_str(&tmpbs, 0x0009, itmsurl); - - aim_tlvlist_add_raw(&tlvlist, 0x001d, - byte_stream_curpos(&tmpbs), tmpbs.data); - byte_stream_destroy(&tmpbs); - } - - byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); - - aim_tlvlist_write(&bs, &tlvlist); - aim_tlvlist_free(tlvlist); - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/** - * Starting this past week (26 Mar 2001, say), AOL has started sending - * this nice little extra SNAC. AFAIK, it has never been used until now. - * - * The request contains eight bytes. The first four are an offset, the - * second four are a length. - * - * The offset is an offset into aim.exe when it is mapped during execution - * on Win32. So far, AOL has only been requesting bytes in static regions - * of memory. (I won't put it past them to start requesting data in - * less static regions -- regions that are initialized at run time, but still - * before the client receives this request.) - * - * When the client receives the request, it adds it to the current ds - * (0x00400000) and dereferences it, copying the data into a buffer which - * it then runs directly through the MD5 hasher. The 16 byte output of - * the hash is then sent back to the server. - * - * If the client does not send any data back, or the data does not match - * the data that the specific client should have, the client will get the - * following message from "AOL Instant Messenger": - * "You have been disconnected from the AOL Instant Message Service (SM) - * for accessing the AOL network using unauthorized software. You can - * download a FREE, fully featured, and authorized client, here - * http://www.aol.com/aim/download2.html" - * The connection is then closed, receiving disconnect code 1, URL - * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html. - * - * Note, however, that numerous inconsistencies can cause the above error, - * not just sending back a bad hash. Do not immediatly suspect this code - * if you get disconnected. AOL and the open/free software community have - * played this game for a couple years now, generating the above message - * on numerous ocassions. - * - * Anyway, neener. We win again. - * - */ -/* Subtype 0x001f - Client verification */ -static int -memrequest(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint32 offset, len; - GSList *tlvlist; - char *modname; - - offset = byte_stream_get32(bs); - len = byte_stream_get32(bs); - tlvlist = aim_tlvlist_read(bs); - - modname = aim_tlv_getstr(tlvlist, 0x0001, 1); - - purple_debug_info("oscar", "Got memory request for data at 0x%08x (%u bytes) of requested %s\n", offset, len, modname ? modname : "aim.exe"); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, offset, len, modname); - - g_free(modname); - aim_tlvlist_free(tlvlist); - - return ret; -} - -/* Subtype 0x0020 - Client verification reply */ -int -aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!od || !conn) - return -EINVAL; - - byte_stream_new(&bs, 2+16); - - byte_stream_put16(&bs, 0x0010); /* md5 is always 16 bytes */ - - if ((flag == AIM_SENDMEMBLOCK_FLAG_ISHASH) && buf && (len == 0x10)) { /* we're getting a hash */ - - byte_stream_putraw(&bs, buf, 0x10); - - } else if (buf && (len > 0)) { /* use input buffer */ - PurpleCipherContext *context; - guchar digest[16]; - - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, buf, len); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - byte_stream_putraw(&bs, digest, 0x10); - - } else if (len == 0) { /* no length, just hash NULL (buf is optional) */ - PurpleCipherContext *context; - guchar digest[16]; - guint8 nil = '\0'; - - /* - * I'm not sure if we really need the empty append with the - * new MD5 functions, so I'll leave it in, just in case. - */ - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, &nil, 0); - purple_cipher_context_digest(context, 16, digest, NULL); - purple_cipher_context_destroy(context); - - byte_stream_putraw(&bs, digest, 0x10); - - } else { - - /* - * This data is correct for AIM 3.5.1670. - * - * Using these blocks is as close to "legal" as you can get - * without using an AIM binary. - * - */ - if ((offset == 0x03ffffff) && (len == 0x03ffffff)) { - -#if 1 /* with "AnrbnrAqhfzcd" */ - byte_stream_put32(&bs, 0x44a95d26); - byte_stream_put32(&bs, 0xd2490423); - byte_stream_put32(&bs, 0x93b8821f); - byte_stream_put32(&bs, 0x51c54b01); -#else /* no filename */ - byte_stream_put32(&bs, 0x1df8cbae); - byte_stream_put32(&bs, 0x5523b839); - byte_stream_put32(&bs, 0xa0e10db3); - byte_stream_put32(&bs, 0xa46d3b39); -#endif - - } else - purple_debug_warning("oscar", "sendmemblock: unknown hash request\n"); - - } - - snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, NULL, 0); - flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0021 - Receive our extended status - * - * This is used for iChat's "available" messages, and maybe ICQ extended - * status messages? It's also used to tell the client whether or not it - * needs to upload an SSI buddy icon... who engineers this stuff, anyway? - */ -static int -aim_parse_extstatus(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 type; - guint8 flags, length; - - type = byte_stream_get16(bs); - flags = byte_stream_get8(bs); - length = byte_stream_get8(bs); - - /* - * A flag of 0x01 could mean "this is the checksum we have for you" - * A flag of 0x40 could mean "I don't have your icon, upload it" - */ - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { - switch (type) { - case 0x0000: - case 0x0001: { /* buddy icon checksum */ - /* not sure what the difference between 1 and 0 is */ - guint8 *md5 = byte_stream_getraw(bs, length); - ret = userfunc(od, conn, frame, type, flags, length, md5); - g_free(md5); - } break; - case 0x0002: { /* available message */ - /* there is a second length that is just for the message */ - char *msg = byte_stream_getstr(bs, byte_stream_get16(bs)); - ret = userfunc(od, conn, frame, msg); - g_free(msg); - } break; - } - } - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0003) - return hostonline(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0005) - return redirect(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0007) - return rateresp(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000a) - return ratechange(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000b) - return serverpause(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000d) - return serverresume(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x000f) - return selfinfo(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0010) - return evilnotify(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0012) - return migrate(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0013) - return motd(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0018) - return hostversions(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x001f) - return memrequest(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0021) - return aim_parse_extstatus(od, conn, mod, frame, snac, bs); - - return 0; -} - -int service_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_OSERVICE; - mod->version = 0x0003; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "oservice", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_popup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_popup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_popup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_popup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x0008 - Popups. - * - * Popups are just what it sounds like. They're a way for the server to - * open up an informative box on the client's screen. - */ - -#include - -/* - * This is all there is to it. - * - * The message is probably HTML. - * - */ -static int -parsepopup(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - aim_rxcallback_t userfunc; - GSList *tlvlist; - int ret = 0; - char *msg, *url; - guint16 width, height, delay; - - tlvlist = aim_tlvlist_read(bs); - - msg = aim_tlv_getstr(tlvlist, 0x0001, 1); - url = aim_tlv_getstr(tlvlist, 0x0002, 1); - width = aim_tlv_get16(tlvlist, 0x0003, 1); - height = aim_tlv_get16(tlvlist, 0x0004, 1); - delay = aim_tlv_get16(tlvlist, 0x0005, 1); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, msg, url, width, height, delay); - - aim_tlvlist_free(tlvlist); - g_free(msg); - g_free(url); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0002) - return parsepopup(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -popups_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_POPUP; - mod->version = 0x0001; - mod->toolid = 0x0104; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "popup", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_stats.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_stats.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_stats.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_stats.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000b - Statistics. - * - */ - -#include - -static int -reportinterval(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - guint16 interval; - - interval = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, interval); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0002) - return reportinterval(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -stats_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_STATS; - mod->version = 0x0001; - mod->toolid = 0x0104; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "stats", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_translate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_translate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_translate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_translate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000c - Translation. - * - * I have no idea why this group was issued. I have never seen anything - * that uses it. From what I remember, the last time I tried to poke at - * the server with this group, it whined about not supporting it. - * - * But we advertise it anyway, because its fun. - * - */ - -#include "oscar.h" - -int translate_modfirst(OscarData *od, aim_module_t *mod) -{ - - mod->family = SNAC_FAMILY_TRANSLATE; - mod->version = 0x0001; - mod->toolid = 0x0104; - mod->toolversion = 0x0001; - mod->flags = 0; - strncpy(mod->name, "translate", sizeof(mod->name)); - mod->snachandler = NULL; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_userlookup.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_userlookup.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_userlookup.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/family_userlookup.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,157 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Family 0x000a - User Search. - * - * TODO: Add aim_usersearch_name() - * - */ - -#include "oscar.h" - -/* - * Subtype 0x0001 - * - * XXX can this be integrated with the rest of the error handling? - */ -static int error(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - - /* XXX the modules interface should have already retrieved this for us */ - if (!(snac2 = aim_remsnac(od, snac->id))) { - purple_debug_misc("oscar", "search error: couldn't get a snac for 0x%08x\n", snac->id); - return 0; - } - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, snac2->data /* address */); - - /* XXX freesnac()? */ - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -/* - * Subtype 0x0002 - * - */ -int aim_search_address(OscarData *od, const char *address) -{ - FlapConnection *conn; - ByteStream bs; - aim_snacid_t snacid; - - conn = flap_connection_findbygroup(od, SNAC_FAMILY_USERLOOKUP); - - if (!conn || !address) - return -EINVAL; - - byte_stream_new(&bs, strlen(address)); - - byte_stream_putstr(&bs, address); - - snacid = aim_cachesnac(od, SNAC_FAMILY_USERLOOKUP, 0x0002, 0x0000, address, strlen(address)+1); - flap_connection_send_snac(od, conn, SNAC_FAMILY_USERLOOKUP, 0x0002, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); - - return 0; -} - -/* - * Subtype 0x0003 - * - */ -static int reply(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int j = 0, m, ret = 0; - GSList *tlvlist; - char *cur = NULL, *buf = NULL; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - const char *searchaddr = NULL; - - if ((snac2 = aim_remsnac(od, snac->id))) - searchaddr = (const char *)snac2->data; - - tlvlist = aim_tlvlist_read(bs); - m = aim_tlvlist_count(tlvlist); - - /* XXX uhm. - * This is the only place that uses something other than 1 for the 3rd - * parameter to aim_tlv_gettlv_whatever(). - */ - while ((cur = aim_tlv_getstr(tlvlist, 0x0001, j+1)) && j < m) - { - buf = g_realloc(buf, (j+1) * (MAXSNLEN+1)); - - strncpy(&buf[j * (MAXSNLEN+1)], cur, MAXSNLEN); - g_free(cur); - - j++; - } - g_free(cur); - - aim_tlvlist_free(tlvlist); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, searchaddr, j, buf); - - /* XXX freesnac()? */ - if (snac2) - g_free(snac2->data); - g_free(snac2); - - g_free(buf); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return error(od, conn, mod, frame, snac, bs); - else if (snac->subtype == 0x0003) - return reply(od, conn, mod, frame, snac, bs); - - return 0; -} - -int -search_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = SNAC_FAMILY_USERLOOKUP; - mod->version = 0x0001; - mod->toolid = 0x0110; - mod->toolversion = 0x0629; - mod->flags = 0; - strncpy(mod->name, "userlookup", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/flap_connection.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/flap_connection.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/flap_connection.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/flap_connection.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1128 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" - -#include "eventloop.h" -#include "proxy.h" - -#ifndef _WIN32 -#include -#include -#include -#endif - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/** - * This sends a channel 1 SNAC containing the FLAP version. - * The FLAP version is sent by itself at the beginning of every - * connection to a FLAP server. It is always the very first - * packet sent by both the server and the client after the SYN, - * SYN/ACK, ACK handshake. - */ -void -flap_connection_send_version(OscarData *od, FlapConnection *conn) -{ - FlapFrame *frame; - - frame = flap_frame_new(od, 0x01, 4); - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - flap_connection_send(conn, frame); -} - -/** - * This sends a channel 1 FLAP containing the FLAP version and - * the authentication cookie. This is sent when connecting to - * any FLAP server after the initial connection to the auth - * server. It is always the very first packet sent by both the - * server and the client after the SYN, SYN/ACK, ACK handshake. - */ -void -flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - - frame = flap_frame_new(od, 0x01, 4 + 2 + 2 + length); - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_raw(&tlvlist, 0x0006, length, chipsahoy); - aim_tlvlist_write(&frame->data, &tlvlist); - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); -} - -void -flap_connection_send_version_with_cookie_and_clientinfo(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy, ClientInfo *ci, gboolean allow_multiple_logins) -{ - FlapFrame *frame; - GSList *tlvlist = NULL; - - frame = flap_frame_new(od, 0x01, 1152 + length); - - byte_stream_put32(&frame->data, 0x00000001); /* FLAP Version */ - aim_tlvlist_add_raw(&tlvlist, 0x0006, length, chipsahoy); - - if (ci->clientstring != NULL) - aim_tlvlist_add_str(&tlvlist, 0x0003, ci->clientstring); - else { - gchar *clientstring = oscar_get_clientstring(); - aim_tlvlist_add_str(&tlvlist, 0x0003, clientstring); - g_free(clientstring); - } - aim_tlvlist_add_16(&tlvlist, 0x0017, (guint16)ci->major); - aim_tlvlist_add_16(&tlvlist, 0x0018, (guint16)ci->minor); - aim_tlvlist_add_16(&tlvlist, 0x0019, (guint16)ci->point); - aim_tlvlist_add_16(&tlvlist, 0x001a, (guint16)ci->build); - aim_tlvlist_add_8(&tlvlist, 0x004a, (allow_multiple_logins ? 0x01 : 0x03)); - - aim_tlvlist_write(&frame->data, &tlvlist); - - aim_tlvlist_free(tlvlist); - - flap_connection_send(conn, frame); -} - -static struct rateclass * -flap_connection_get_rateclass(FlapConnection *conn, guint16 family, guint16 subtype) -{ - gconstpointer key; - gpointer rateclass; - - key = GUINT_TO_POINTER((family << 16) + subtype); - rateclass = g_hash_table_lookup(conn->rateclass_members, key); - if (rateclass != NULL) - return rateclass; - - return conn->default_rateclass; -} - -/* - * Attempt to calculate what our new current average would be if we - * were to send a SNAC in this rateclass at the given time. - */ -static guint32 -rateclass_get_new_current(FlapConnection *conn, struct rateclass *rateclass, struct timeval *now) -{ - unsigned long timediff; /* In milliseconds */ - guint32 current; - - /* This formula is documented at http://dev.aol.com/aim/oscar/#RATELIMIT */ - timediff = (now->tv_sec - rateclass->last.tv_sec) * 1000 + (now->tv_usec - rateclass->last.tv_usec) / 1000; - current = ((rateclass->current * (rateclass->windowsize - 1)) + timediff) / rateclass->windowsize; - - return MIN(current, rateclass->max); -} - -/* - * Attempt to send the contents of a given queue - * - * @return TRUE if the queue was completely emptied or was initially - * empty; FALSE if rate limiting prevented it from being - * emptied. - */ -static gboolean flap_connection_send_snac_queue(FlapConnection *conn, struct timeval now, GQueue *queue) -{ - while (!g_queue_is_empty(queue)) - { - QueuedSnac *queued_snac; - struct rateclass *rateclass; - - queued_snac = g_queue_peek_head(queue); - - rateclass = flap_connection_get_rateclass(conn, queued_snac->family, queued_snac->subtype); - if (rateclass != NULL) - { - guint32 new_current; - - new_current = rateclass_get_new_current(conn, rateclass, &now); - - if (rateclass->dropping_snacs || new_current <= rateclass->alert) - /* Not ready to send this SNAC yet--keep waiting. */ - return FALSE; - - rateclass->current = new_current; - rateclass->last.tv_sec = now.tv_sec; - rateclass->last.tv_usec = now.tv_usec; - } - - flap_connection_send(conn, queued_snac->frame); - g_free(queued_snac); - g_queue_pop_head(queue); - } - - /* We emptied the queue */ - return TRUE; -} - -static gboolean flap_connection_send_queued(gpointer data) -{ - FlapConnection *conn; - struct timeval now; - - conn = data; - gettimeofday(&now, NULL); - - purple_debug_info("oscar", "Attempting to send %u queued SNACs and %u queued low-priority SNACs for %p\n", - (conn->queued_snacs ? conn->queued_snacs->length : 0), - (conn->queued_lowpriority_snacs ? conn->queued_lowpriority_snacs->length : 0), - conn); - if (!conn->queued_snacs || flap_connection_send_snac_queue(conn, now, conn->queued_snacs)) { - if (!conn->queued_lowpriority_snacs || flap_connection_send_snac_queue(conn, now, conn->queued_lowpriority_snacs)) { - /* Both queues emptied. */ - conn->queued_timeout = 0; - return FALSE; - } - } - - /* We couldn't send all our SNACs. Keep trying */ - return TRUE; -} - -/** - * This sends a channel 2 FLAP containing a SNAC. The SNAC family and - * subtype are looked up in the rate info for this connection, and if - * sending this SNAC will induce rate limiting then we delay sending - * of the SNAC by putting it into an outgoing holding queue. - * - * @param data The optional bytestream that makes up the data portion - * of this SNAC. For empty SNACs this should be NULL. - * @param high_priority If TRUE, the SNAC will be queued normally if - * needed. If FALSE, it wil be queued separately, to be sent - * only if all high priority SNACs have been sent. - */ -void -flap_connection_send_snac_with_priority(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data, gboolean high_priority) -{ - FlapFrame *frame; - guint32 length; - gboolean enqueue = FALSE; - struct rateclass *rateclass; - - length = data != NULL ? data->offset : 0; - - frame = flap_frame_new(od, 0x02, 10 + length); - aim_putsnac(&frame->data, family, subtype, flags, snacid); - - if (length > 0) - { - byte_stream_rewind(data); - byte_stream_putbs(&frame->data, data, length); - } - - if (conn->queued_timeout != 0) - enqueue = TRUE; - else if ((rateclass = flap_connection_get_rateclass(conn, family, subtype)) != NULL) - { - struct timeval now; - guint32 new_current; - - gettimeofday(&now, NULL); - new_current = rateclass_get_new_current(conn, rateclass, &now); - - if (rateclass->dropping_snacs || new_current <= rateclass->alert) - { - purple_debug_info("oscar", "Current rate for conn %p would be %u, but we alert at %u; enqueueing\n", conn, new_current, rateclass->alert); - - enqueue = TRUE; - } - else - { - rateclass->current = new_current; - rateclass->last.tv_sec = now.tv_sec; - rateclass->last.tv_usec = now.tv_usec; - } - } - - if (enqueue) - { - /* We've been sending too fast, so delay this message */ - QueuedSnac *queued_snac; - - queued_snac = g_new(QueuedSnac, 1); - queued_snac->family = family; - queued_snac->subtype = subtype; - queued_snac->frame = frame; - - if (high_priority) { - if (!conn->queued_snacs) - conn->queued_snacs = g_queue_new(); - g_queue_push_tail(conn->queued_snacs, queued_snac); - } else { - if (!conn->queued_lowpriority_snacs) - conn->queued_lowpriority_snacs = g_queue_new(); - g_queue_push_tail(conn->queued_lowpriority_snacs, queued_snac); - } - - if (conn->queued_timeout == 0) - conn->queued_timeout = purple_timeout_add(500, flap_connection_send_queued, conn); - - return; - } - - flap_connection_send(conn, frame); -} - -void -flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data) -{ - flap_connection_send_snac_with_priority(od, conn, family, subtype, flags, snacid, data, TRUE); -} - -/** - * This sends an empty channel 4 FLAP. This is sent to signify - * that we're logging off. This shouldn't really be necessary-- - * usually the AIM server will detect that the TCP connection has - * been destroyed--but it's good practice. - */ -static void -flap_connection_send_close(OscarData *od, FlapConnection *conn) -{ - FlapFrame *frame; - - frame = flap_frame_new(od, 0x04, 0); - flap_connection_send(conn, frame); -} - -/** - * This sends an empty channel 5 FLAP. This is used as a keepalive - * packet in FLAP connections. WinAIM 4.x and higher send these - * _every minute_ to keep the connection alive. - */ -void -flap_connection_send_keepalive(OscarData *od, FlapConnection *conn) -{ - FlapFrame *frame; - - frame = flap_frame_new(od, 0x05, 0); - flap_connection_send(conn, frame); - - /* clean out SNACs over 60sec old */ - aim_cleansnacs(od, 60); -} - -/** - * Allocate a new empty connection structure. - * - * @param od The oscar session associated with this connection. - * @param type Type of connection to create - * - * @return Returns the new connection structure. - */ -FlapConnection * -flap_connection_new(OscarData *od, int type) -{ - FlapConnection *conn; - - conn = g_new0(FlapConnection, 1); - conn->od = od; - conn->buffer_outgoing = purple_circ_buffer_new(0); - conn->fd = -1; - conn->subtype = -1; - conn->type = type; - conn->rateclass_members = g_hash_table_new(g_direct_hash, g_direct_equal); - - od->oscar_connections = g_slist_prepend(od->oscar_connections, conn); - - return conn; -} - -/** - * Close (but not free) a connection. - * - * This cancels any currently pending connection attempt, - * closes any open fd and frees the auth cookie. - * - * @param conn The connection to close. - */ -void -flap_connection_close(OscarData *od, FlapConnection *conn) -{ - if (conn->connect_data != NULL) - { - purple_proxy_connect_cancel(conn->connect_data); - conn->connect_data = NULL; - } - - if (conn->new_conn_data != NULL) - { - if (conn->type == SNAC_FAMILY_CHAT) - { - oscar_chat_destroy(conn->new_conn_data); - conn->new_conn_data = NULL; - } - } - - if ((conn->fd >= 0 || conn->gsc != NULL) - && conn->type == SNAC_FAMILY_LOCATE) - flap_connection_send_close(od, conn); - - if (conn->watcher_incoming != 0) - { - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - } - - if (conn->watcher_outgoing != 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - } - - if (conn->fd >= 0) - { - close(conn->fd); - conn->fd = -1; - } - - if (conn->gsc != NULL) - { - purple_ssl_close(conn->gsc); - conn->gsc = NULL; - } - - g_free(conn->buffer_incoming.data.data); - conn->buffer_incoming.data.data = NULL; - - purple_circ_buffer_destroy(conn->buffer_outgoing); - conn->buffer_outgoing = NULL; -} - -/** - * Free a FlapFrame - * - * @param frame The frame to free. - */ -static void -flap_frame_destroy(FlapFrame *frame) -{ - g_free(frame->data.data); - g_free(frame); -} - -static gboolean -flap_connection_destroy_cb(gpointer data) -{ - FlapConnection *conn; - OscarData *od; - PurpleAccount *account; - aim_rxcallback_t userfunc; - - conn = data; - od = conn->od; - account = purple_connection_get_account(od->gc); - - purple_debug_info("oscar", "Destroying oscar connection of " - "type 0x%04hx. Disconnect reason is %d\n", - conn->type, conn->disconnect_reason); - - od->oscar_connections = g_slist_remove(od->oscar_connections, conn); - - if ((userfunc = aim_callhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) - userfunc(od, conn, NULL, conn->disconnect_code, conn->error_message); - - /* - * TODO: If we don't have a SNAC_FAMILY_LOCATE connection then - * we should try to request one instead of disconnecting. - */ - if (!account->disconnecting && ((od->oscar_connections == NULL) - || (!flap_connection_getbytype(od, SNAC_FAMILY_LOCATE)))) - { - /* No more FLAP connections! Sign off this PurpleConnection! */ - gchar *tmp; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - - if (conn->disconnect_code == 0x0001) { - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - tmp = g_strdup(_("You have signed on from another location")); - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - tmp = g_strdup(_("Server closed the connection")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - tmp = g_strdup_printf(_("Lost connection with server: %s"), - conn->error_message); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - tmp = g_strdup(_("Received invalid data on connection with server")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - tmp = g_strdup_printf(_("Unable to connect: %s"), - conn->error_message); - else - /* - * We shouldn't print a message for some disconnect_reasons. - * Like OSCAR_DISCONNECT_LOCAL_CLOSED. - */ - tmp = NULL; - - if (tmp != NULL) - { - purple_connection_error_reason(od->gc, reason, tmp); - g_free(tmp); - } - } - - flap_connection_close(od, conn); - - g_free(conn->error_message); - g_free(conn->cookie); - - /* - * Free conn->internal, if necessary - */ - if (conn->type == SNAC_FAMILY_CHAT) - flap_connection_destroy_chat(od, conn); - - g_slist_free(conn->groups); - while (conn->rateclasses != NULL) - { - g_free(conn->rateclasses->data); - conn->rateclasses = g_slist_delete_link(conn->rateclasses, conn->rateclasses); - } - - g_hash_table_destroy(conn->rateclass_members); - - if (conn->queued_snacs) { - while (!g_queue_is_empty(conn->queued_snacs)) - { - QueuedSnac *queued_snac; - queued_snac = g_queue_pop_head(conn->queued_snacs); - flap_frame_destroy(queued_snac->frame); - g_free(queued_snac); - } - g_queue_free(conn->queued_snacs); - } - - if (conn->queued_lowpriority_snacs) { - while (!g_queue_is_empty(conn->queued_lowpriority_snacs)) - { - QueuedSnac *queued_snac; - queued_snac = g_queue_pop_head(conn->queued_lowpriority_snacs); - flap_frame_destroy(queued_snac->frame); - g_free(queued_snac); - } - g_queue_free(conn->queued_lowpriority_snacs); - } - - if (conn->queued_timeout > 0) - purple_timeout_remove(conn->queued_timeout); - - g_free(conn); - - return FALSE; -} - -/** - * See the comments for the parameters of - * flap_connection_schedule_destroy(). - */ -void -flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - purple_timeout_remove(conn->destroy_timeout); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - flap_connection_destroy_cb(conn); -} - -/** - * Schedule Purple to destroy the given FlapConnection as soon as we - * return control back to the program's main loop. We must do this - * if we want to destroy the connection but we are still using it - * for some reason. - * - * @param reason The reason for the disconnection. - * @param error_message A brief error message that gives more detail - * regarding the reason for the disconnecting. This should - * be NULL for everything except OSCAR_DISCONNECT_LOST_CONNECTION, - * in which case it should contain the value of g_strerror(errno), - * and OSCAR_DISCONNECT_COULD_NOT_CONNECT, in which case it - * should contain the error_message passed back from the call - * to purple_proxy_connect(). - */ -void -flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - /* Already taken care of */ - return; - - purple_debug_info("oscar", "Scheduling destruction of FLAP " - "connection of type 0x%04hx\n", conn->type); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - conn->destroy_timeout = purple_timeout_add(0, flap_connection_destroy_cb, conn); -} - -/** - * In OSCAR, every connection has a set of SNAC groups associated - * with it. These are the groups that you can send over this connection - * without being guaranteed a "Not supported" SNAC error. - * - * The grand theory of things says that these associations transcend - * what libfaim calls "connection types" (conn->type). You can probably - * see the elegance here, but since I want to revel in it for a bit, you - * get to hear it all spelled out. - * - * So let us say that you have your core BOS connection running. One - * of your modules has just given you a SNAC of the group 0x0004 to send - * you. Maybe an IM destined for some twit in Greenland. So you start - * at the top of your connection list, looking for a connection that - * claims to support group 0x0004. You find one. Why, that neat BOS - * connection of yours can do that. So you send it on its way. - * - * Now, say, that fellow from Greenland has friends and they all want to - * meet up with you in a lame chat room. This has landed you a SNAC - * in the family 0x000e and you have to admit you're a bit lost. You've - * searched your connection list for someone who wants to make your life - * easy and deliver this SNAC for you, but there isn't one there. - * - * Here comes the good bit. Without even letting anyone know, particularly - * the module that decided to send this SNAC, and definitely not that twit - * in Greenland, you send out a service request. In this request, you have - * marked the need for a connection supporting group 0x000e. A few seconds - * later, you receive a service redirect with an IP address and a cookie in - * it. Great, you say. Now I have something to do. Off you go, making - * that connection. One of the first things you get from this new server - * is a message saying that indeed it does support the group you were looking - * for. So you continue and send rate confirmation and all that. - * - * Then you remember you had that SNAC to send, and now you have a means to - * do it, and you do, and everyone is happy. Except the Greenlander, who is - * still stuck in the bitter cold. - * - * Oh, and this is useful for building the Migration SNACs, too. In the - * future, this may help convince me to implement rate limit mitigation - * for real. We'll see. - * - * Just to make me look better, I'll say that I've known about this great - * scheme for quite some time now. But I still haven't convinced myself - * to make libfaim work that way. It would take a fair amount of effort, - * and probably some client API changes as well. (Whenever I don't want - * to do something, I just say it would change the client API. Then I - * instantly have a couple of supporters of not doing it.) - * - * Generally, addgroup is only called by the internal handling of the - * server ready SNAC. So if you want to do something before that, you'll - * have to be more creative. That is done rather early, though, so I don't - * think you have to worry about it. Unless you're me. I care deeply - * about such inane things. - * - */ - -/** - * Find a FlapConnection that supports the given oscar - * family. - */ -FlapConnection * -flap_connection_findbygroup(OscarData *od, guint16 group) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur != NULL; cur = cur->next) - { - FlapConnection *conn; - GSList *l; - - conn = cur->data; - - for (l = conn->groups; l != NULL; l = l->next) - { - if (GPOINTER_TO_UINT(l->data) == group) - return conn; - } - } - - return NULL; -} - -/** - * Locates a connection of the specified type in the - * specified session. - * - * TODO: Use flap_connection_findbygroup everywhere and get rid of this. - * - * @param od The session to search. - * @param type The type of connection to look for. - * - * @return Returns the first connection found of the given target type, - * or NULL if none could be found. - */ -FlapConnection * -flap_connection_getbytype(OscarData *od, int type) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur != NULL; cur = cur->next) - { - FlapConnection *conn; - conn = cur->data; - if ((conn->type == type) && (conn->connected)) - return conn; - } - - return NULL; -} - -FlapConnection * -flap_connection_getbytype_all(OscarData *od, int type) -{ - GSList *cur; - - for (cur = od->oscar_connections; cur; cur = cur->next) - { - FlapConnection *conn; - conn = cur->data; - if (conn->type == type) - return conn; - } - - return NULL; -} - -/** - * Allocate a new FLAP frame. - * - * @param channel The FLAP channel. This is almost always 2. - */ -FlapFrame * -flap_frame_new(OscarData *od, guint16 channel, int datalen) -{ - FlapFrame *frame; - - frame = g_new0(FlapFrame, 1); - frame->channel = channel; - - if (datalen > 0) - byte_stream_new(&frame->data, datalen); - - return frame; -} - -static void -parse_snac(OscarData *od, FlapConnection *conn, FlapFrame *frame) -{ - aim_module_t *cur; - aim_modsnac_t snac; - - if (byte_stream_empty(&frame->data) < 10) - return; - - snac.family = byte_stream_get16(&frame->data); - snac.subtype = byte_stream_get16(&frame->data); - snac.flags = byte_stream_get16(&frame->data); - snac.id = byte_stream_get32(&frame->data); - - /* SNAC flags are apparently uniform across all SNACs, so we handle them here */ - if (snac.flags & 0x0001) { - /* - * This means the SNAC will be followed by another SNAC with - * related information. We don't need to do anything about - * this here. - */ - } - if (snac.flags & 0x8000) { - /* - * This packet contains the version of the family that this SNAC is - * in. You get this when your SSI module is version 2 or higher. - * For now we have no need for this, but you could always save - * it as a part of aim_modnsac_t, or something. The format is... - * 2 byte length of total mini-header (which is 6 bytes), then TLV - * of type 0x0001, length 0x0002, value is the 2 byte version - * number - */ - byte_stream_advance(&frame->data, byte_stream_get16(&frame->data)); - } - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - - if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && - (cur->family != snac.family)) - continue; - - if (cur->snachandler(od, conn, cur, frame, &snac, &frame->data)) - return; - } -} - -static void -parse_fakesnac(OscarData *od, FlapConnection *conn, FlapFrame *frame, guint16 family, guint16 subtype) -{ - aim_module_t *cur; - aim_modsnac_t snac; - - snac.family = family; - snac.subtype = subtype; - snac.flags = snac.id = 0; - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - - if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && - (cur->family != snac.family)) - continue; - - if (cur->snachandler(od, conn, cur, frame, &snac, &frame->data)) - return; - } -} - -static void -parse_flap_ch4(OscarData *od, FlapConnection *conn, FlapFrame *frame) -{ - GSList *tlvlist; - char *msg = NULL; - - if (byte_stream_empty(&frame->data) == 0) { - /* XXX should do something with this */ - return; - } - - /* An ICQ account is logging in */ - if (conn->type == SNAC_FAMILY_AUTH) - { - parse_fakesnac(od, conn, frame, 0x0017, 0x0003); - return; - } - - tlvlist = aim_tlvlist_read(&frame->data); - - if (aim_tlv_gettlv(tlvlist, 0x0009, 1)) - conn->disconnect_code = aim_tlv_get16(tlvlist, 0x0009, 1); - - if (aim_tlv_gettlv(tlvlist, 0x000b, 1)) - msg = aim_tlv_getstr(tlvlist, 0x000b, 1); - - /* - * The server ended this FLAP connnection, so let's be nice and - * close the physical TCP connection - */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_REMOTE_CLOSED, msg); - - aim_tlvlist_free(tlvlist); - - g_free(msg); -} - -/** - * Takes a new incoming FLAP frame and sends it to the appropriate - * handler function to be parsed. - */ -static void -parse_flap(OscarData *od, FlapConnection *conn, FlapFrame *frame) -{ - if (frame->channel == 0x01) { - guint32 flap_version = byte_stream_get32(&frame->data); - if (flap_version != 0x00000001) - { - /* Error! */ - purple_debug_warning("oscar", "Expecting FLAP version " - "0x00000001 but received FLAP version %08x. Closing connection.\n", - flap_version); - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - } - else - conn->connected = TRUE; - - } else if (frame->channel == 0x02) { - parse_snac(od, conn, frame); - - } else if (frame->channel == 0x04) { - parse_flap_ch4(od, conn, frame); - - } else if (frame->channel == 0x05) { - /* TODO: Reset our keepalive watchdog? */ - - } -} - -/** - * Read in all available data on the socket for a given connection. - * All complete FLAPs handled immedate after they're received. - * Incomplete FLAP data is stored locally and appended to the next - * time this callback is triggered. - * - * This is called by flap_connection_recv_cb and - * flap_connection_recv_cb_ssl for unencrypted/encrypted connections. - */ -static void -flap_connection_recv(FlapConnection *conn) -{ - gpointer buf; - gsize buflen; - gssize read; - - /* Read data until we run out of data and break out of the loop */ - while (TRUE) - { - /* Start reading a new FLAP */ - if (conn->buffer_incoming.data.data == NULL) - { - buf = conn->header + conn->header_received; - buflen = 6 - conn->header_received; - - /* Read the first 6 bytes (the FLAP header) */ - if (conn->gsc) - read = purple_ssl_read(conn->gsc, buf, buflen); - else - read = recv(conn->fd, buf, buflen, 0); - - /* Check if the FLAP server closed the connection */ - if (read == 0) - { - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - break; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - break; - - /* Error! */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - break; - } - conn->od->gc->last_received = time(NULL); - - /* If we don't even have a complete FLAP header then do nothing */ - conn->header_received += read; - if (conn->header_received < 6) - break; - - /* All FLAP frames must start with the byte 0x2a */ - if (aimutil_get8(&conn->header[0]) != 0x2a) - { - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - break; - } - - /* Verify the sequence number sent by the server. */ -#if 0 - /* TODO: Need to initialize conn->seqnum_in somewhere before we can use this. */ - if (aimutil_get16(&conn->header[1]) != conn->seqnum_in++) - { - /* Received an out-of-order FLAP! */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - break; - } -#endif - - /* Initialize a new temporary FlapFrame for incoming data */ - conn->buffer_incoming.channel = aimutil_get8(&conn->header[1]); - conn->buffer_incoming.seqnum = aimutil_get16(&conn->header[2]); - conn->buffer_incoming.data.len = aimutil_get16(&conn->header[4]); - conn->buffer_incoming.data.data = g_new(guint8, conn->buffer_incoming.data.len); - conn->buffer_incoming.data.offset = 0; - } - - buflen = conn->buffer_incoming.data.len - conn->buffer_incoming.data.offset; - if (buflen) - { - buf = &conn->buffer_incoming.data.data[conn->buffer_incoming.data.offset]; - /* Read data into the temporary FlapFrame until it is complete */ - if (conn->gsc) - read = purple_ssl_read(conn->gsc, buf, buflen); - else - read = recv(conn->fd, buf, buflen, 0); - - /* Check if the FLAP server closed the connection */ - if (read == 0) - { - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - break; - } - - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - break; - - /* Error! */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - break; - } - - conn->buffer_incoming.data.offset += read; - if (conn->buffer_incoming.data.offset < conn->buffer_incoming.data.len) - /* Waiting for more data to arrive */ - break; - } - - /* We have a complete FLAP! Handle it and continue reading */ - byte_stream_rewind(&conn->buffer_incoming.data); - parse_flap(conn->od, conn, &conn->buffer_incoming); - conn->lastactivity = time(NULL); - - g_free(conn->buffer_incoming.data.data); - conn->buffer_incoming.data.data = NULL; - - conn->header_received = 0; - } -} - -void -flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - FlapConnection *conn = data; - - flap_connection_recv(conn); -} - -void -flap_connection_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond) -{ - FlapConnection *conn = data; - - flap_connection_recv(conn); -} - -/** - * @param source When this function is called as a callback source is - * set to the fd that triggered the callback. But this function - * is also called directly from flap_connection_send_byte_stream(), - * in which case source will be -1. So don't use source--use - * conn->gsc or conn->fd instead. - */ -static void -send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - FlapConnection *conn; - int writelen, ret; - - conn = data; - writelen = purple_circ_buffer_get_max_read(conn->buffer_outgoing); - - if (writelen == 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - return; - } - - if (conn->gsc) - ret = purple_ssl_write(conn->gsc, conn->buffer_outgoing->outptr, - writelen); - else - ret = send(conn->fd, conn->buffer_outgoing->outptr, writelen, 0); - if (ret <= 0) - { - if (ret < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) - /* No worries */ - return; - - /* Error! */ - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - if (conn->gsc) { - purple_ssl_close(conn->gsc); - conn->gsc = NULL; - } else { - close(conn->fd); - conn->fd = -1; - } - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - purple_circ_buffer_mark_read(conn->buffer_outgoing, ret); -} - -static void -flap_connection_send_byte_stream(ByteStream *bs, FlapConnection *conn, size_t count) -{ - if (conn == NULL) - return; - - /* Make sure we don't send past the end of the bs */ - if (count > byte_stream_empty(bs)) - count = byte_stream_empty(bs); /* truncate to remaining space */ - - if (count == 0) - return; - - /* Add everything to our outgoing buffer */ - purple_circ_buffer_append(conn->buffer_outgoing, bs->data, count); - - /* If we haven't already started writing stuff, then start the cycle */ - if (conn->watcher_outgoing == 0) - { - if (conn->gsc) { - conn->watcher_outgoing = purple_input_add(conn->gsc->fd, - PURPLE_INPUT_WRITE, send_cb, conn); - send_cb(conn, -1, 0); - } else if (conn->fd >= 0) { - conn->watcher_outgoing = purple_input_add(conn->fd, - PURPLE_INPUT_WRITE, send_cb, conn); - send_cb(conn, -1, 0); - } - } -} - -static void -sendframe_flap(FlapConnection *conn, FlapFrame *frame) -{ - ByteStream bs; - int payloadlen, bslen; - - payloadlen = byte_stream_curpos(&frame->data); - - byte_stream_new(&bs, 6 + payloadlen); - - /* FLAP header */ - byte_stream_put8(&bs, 0x2a); - byte_stream_put8(&bs, frame->channel); - byte_stream_put16(&bs, frame->seqnum); - byte_stream_put16(&bs, payloadlen); - - /* Payload */ - byte_stream_rewind(&frame->data); - byte_stream_putbs(&bs, &frame->data, payloadlen); - - bslen = byte_stream_curpos(&bs); - byte_stream_rewind(&bs); - flap_connection_send_byte_stream(&bs, conn, bslen); - - byte_stream_destroy(&bs); -} - -void -flap_connection_send(FlapConnection *conn, FlapFrame *frame) -{ - frame->seqnum = ++(conn->seqnum_out); - sendframe_flap(conn, frame); - flap_frame_destroy(frame); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libaim.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libaim.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libaim.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libaim.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* libaim is the AIM protocol plugin. It is linked against liboscarcommon, - * which contains all the shared implementation code with libicq - */ - -#include "oscarcommon.h" - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - /* The mimimum icon size below is not needed in AIM 6.0 */ - {"gif,jpeg,bmp,ico", 0, 0, 100, 100, 7168, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - oscar_list_icon_aim, /* list_icon */ - oscar_list_emblem, /* list_emblems */ - oscar_status_text, /* status_text */ - oscar_tooltip_text, /* tooltip_text */ - oscar_status_types, /* status_types */ - oscar_blist_node_menu, /* blist_node_menu */ - oscar_chat_info, /* chat_info */ - oscar_chat_info_defaults, /* chat_info_defaults */ - oscar_login, /* login */ - oscar_close, /* close */ - oscar_send_im, /* send_im */ - oscar_set_info, /* set_info */ - oscar_send_typing, /* send_typing */ - oscar_get_info, /* get_info */ - oscar_set_status, /* set_status */ - oscar_set_idle, /* set_idle */ - oscar_change_passwd, /* change_passwd */ - oscar_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - oscar_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - oscar_add_permit, /* add_permit */ - oscar_add_deny, /* add_deny */ - oscar_rem_permit, /* rem_permit */ - oscar_rem_deny, /* rem_deny */ - oscar_set_permit_deny, /* set_permit_deny */ - oscar_join_chat, /* join_chat */ - NULL, /* reject_chat */ - oscar_get_chat_name, /* get_chat_name */ - oscar_chat_invite, /* chat_invite */ - oscar_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - oscar_send_chat, /* chat_send */ - oscar_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - oscar_alias_buddy, /* alias_buddy */ - oscar_move_buddy, /* group_buddy */ - oscar_rename_group, /* rename_group */ - NULL, /* buddy_free */ - oscar_convo_closed, /* convo_closed */ - oscar_normalize, /* normalize */ - oscar_set_icon, /* set_buddy_icon */ - oscar_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - oscar_can_receive_file, /* can_receive_file */ - oscar_send_file, /* send_file */ - oscar_new_xfer, /* new_xfer */ - oscar_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-aim", /**< id */ - "AIM", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("AIM Protocol Plugin"), - /** description */ - N_("AIM Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - oscar_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - oscar_init(plugin); -} - -PURPLE_INIT_PLUGIN(aim, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libicq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libicq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libicq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/libicq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* libicq is the ICQ protocol plugin. It is linked against liboscarcommon, - * which contains all the shared implementation code with libaim - */ - - -#include "oscarcommon.h" - -static GHashTable * -icq_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(table, "login_label", (gpointer)_("ICQ UIN...")); - return table; -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"gif,jpeg,bmp,ico", 48, 48, 52, 64, 7168, - PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - oscar_list_icon_icq, /* list_icon */ - oscar_list_emblem, /* list_emblems */ - oscar_status_text, /* status_text */ - oscar_tooltip_text, /* tooltip_text */ - oscar_status_types, /* status_types */ - oscar_blist_node_menu, /* blist_node_menu */ - oscar_chat_info, /* chat_info */ - oscar_chat_info_defaults, /* chat_info_defaults */ - oscar_login, /* login */ - oscar_close, /* close */ - oscar_send_im, /* send_im */ - oscar_set_info, /* set_info */ - oscar_send_typing, /* send_typing */ - oscar_get_info, /* get_info */ - oscar_set_status, /* set_status */ - oscar_set_idle, /* set_idle */ - oscar_change_passwd, /* change_passwd */ - oscar_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - oscar_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - oscar_add_permit, /* add_permit */ - oscar_add_deny, /* add_deny */ - oscar_rem_permit, /* rem_permit */ - oscar_rem_deny, /* rem_deny */ - oscar_set_permit_deny, /* set_permit_deny */ - oscar_join_chat, /* join_chat */ - NULL, /* reject_chat */ - oscar_get_chat_name, /* get_chat_name */ - oscar_chat_invite, /* chat_invite */ - oscar_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - oscar_send_chat, /* chat_send */ - oscar_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - oscar_alias_buddy, /* alias_buddy */ - oscar_move_buddy, /* group_buddy */ - oscar_rename_group, /* rename_group */ - NULL, /* buddy_free */ - oscar_convo_closed, /* convo_closed */ - oscar_normalize, /* normalize */ - oscar_set_icon, /* set_buddy_icon */ - oscar_remove_group, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - oscar_can_receive_file, /* can_receive_file */ - oscar_send_file, /* send_file */ - oscar_new_xfer, /* new_xfer */ - oscar_offline_message, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - icq_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-icq", /**< id */ - "ICQ", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("ICQ Protocol Plugin"), - /** description */ - N_("ICQ Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - oscar_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - oscar_init(plugin); - - option = purple_account_option_string_new(_("Encoding"), "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -} - -PURPLE_INIT_PLUGIN(icq, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -EXTRA_DIST = \ - COPYING \ - AUTHORS \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -OSCARSOURCES = \ - bstream.c \ - clientlogin.c \ - family_admin.c \ - family_advert.c \ - family_alert.c \ - family_auth.c \ - family_bart.c \ - family_bos.c \ - family_buddy.c \ - family_chat.c \ - family_chatnav.c \ - family_icq.c \ - family_icbm.c \ - family_invite.c \ - family_locate.c \ - family_odir.c \ - family_oservice.c \ - family_popup.c \ - family_feedbag.c \ - family_stats.c \ - family_translate.c \ - family_userlookup.c \ - flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ - oscar.h \ - oscarcommon.h \ - oscar_data.c \ - peer.c \ - peer.h \ - peer_proxy.c \ - rxhandlers.c \ - snac.c \ - snactypes.h \ - tlv.c \ - util.c - -AM_CFLAGS = $(st) - -libaim_la_LDFLAGS = -module -avoid-version -libicq_la_LDFLAGS = -module -avoid-version -if STATIC_OSCAR - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = liboscar.la -liboscar_la_SOURCES = $(OSCARSOURCES) libaim.c libicq.c -liboscar_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = liboscar.la libaim.la libicq.la -liboscar_la_SOURCES = $(OSCARSOURCES) -liboscar_la_LIBADD = $(GLIB_LIBS) - -libaim_la_SOURCES = libaim.c -libaim_la_LIBADD = liboscar.la - -libicq_la_SOURCES = libicq.c -libicq_la_LIBADD = liboscar.la - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1118 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/oscar -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in AUTHORS \ - COPYING -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -@STATIC_OSCAR_FALSE@libaim_la_DEPENDENCIES = liboscar.la -am__libaim_la_SOURCES_DIST = libaim.c -@STATIC_OSCAR_FALSE@am_libaim_la_OBJECTS = libaim.lo -libaim_la_OBJECTS = $(am_libaim_la_OBJECTS) -@STATIC_OSCAR_FALSE@am_libaim_la_rpath = -rpath $(pkgdir) -@STATIC_OSCAR_FALSE@libicq_la_DEPENDENCIES = liboscar.la -am__libicq_la_SOURCES_DIST = libicq.c -@STATIC_OSCAR_FALSE@am_libicq_la_OBJECTS = libicq.lo -libicq_la_OBJECTS = $(am_libicq_la_OBJECTS) -@STATIC_OSCAR_FALSE@am_libicq_la_rpath = -rpath $(pkgdir) -am__DEPENDENCIES_1 = -@STATIC_OSCAR_FALSE@liboscar_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__liboscar_la_SOURCES_DIST = bstream.c clientlogin.c family_admin.c \ - family_advert.c family_alert.c family_auth.c family_bart.c \ - family_bos.c family_buddy.c family_chat.c family_chatnav.c \ - family_icq.c family_icbm.c family_invite.c family_locate.c \ - family_odir.c family_oservice.c family_popup.c \ - family_feedbag.c family_stats.c family_translate.c \ - family_userlookup.c flap_connection.c misc.c msgcookie.c odc.c \ - oft.c oscar.c oscar.h oscarcommon.h oscar_data.c peer.c peer.h \ - peer_proxy.c rxhandlers.c snac.c snactypes.h tlv.c util.c \ - libaim.c libicq.c -am__objects_1 = liboscar_la-bstream.lo liboscar_la-clientlogin.lo \ - liboscar_la-family_admin.lo liboscar_la-family_advert.lo \ - liboscar_la-family_alert.lo liboscar_la-family_auth.lo \ - liboscar_la-family_bart.lo liboscar_la-family_bos.lo \ - liboscar_la-family_buddy.lo liboscar_la-family_chat.lo \ - liboscar_la-family_chatnav.lo liboscar_la-family_icq.lo \ - liboscar_la-family_icbm.lo liboscar_la-family_invite.lo \ - liboscar_la-family_locate.lo liboscar_la-family_odir.lo \ - liboscar_la-family_oservice.lo liboscar_la-family_popup.lo \ - liboscar_la-family_feedbag.lo liboscar_la-family_stats.lo \ - liboscar_la-family_translate.lo \ - liboscar_la-family_userlookup.lo \ - liboscar_la-flap_connection.lo liboscar_la-misc.lo \ - liboscar_la-msgcookie.lo liboscar_la-odc.lo liboscar_la-oft.lo \ - liboscar_la-oscar.lo liboscar_la-oscar_data.lo \ - liboscar_la-peer.lo liboscar_la-peer_proxy.lo \ - liboscar_la-rxhandlers.lo liboscar_la-snac.lo \ - liboscar_la-tlv.lo liboscar_la-util.lo -@STATIC_OSCAR_FALSE@am_liboscar_la_OBJECTS = $(am__objects_1) -@STATIC_OSCAR_TRUE@am_liboscar_la_OBJECTS = $(am__objects_1) \ -@STATIC_OSCAR_TRUE@ liboscar_la-libaim.lo liboscar_la-libicq.lo -liboscar_la_OBJECTS = $(am_liboscar_la_OBJECTS) -@STATIC_OSCAR_FALSE@am_liboscar_la_rpath = -rpath $(pkgdir) -@STATIC_OSCAR_TRUE@am_liboscar_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libaim_la_SOURCES) $(libicq_la_SOURCES) \ - $(liboscar_la_SOURCES) -DIST_SOURCES = $(am__libaim_la_SOURCES_DIST) \ - $(am__libicq_la_SOURCES_DIST) $(am__liboscar_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - COPYING \ - AUTHORS \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -OSCARSOURCES = \ - bstream.c \ - clientlogin.c \ - family_admin.c \ - family_advert.c \ - family_alert.c \ - family_auth.c \ - family_bart.c \ - family_bos.c \ - family_buddy.c \ - family_chat.c \ - family_chatnav.c \ - family_icq.c \ - family_icbm.c \ - family_invite.c \ - family_locate.c \ - family_odir.c \ - family_oservice.c \ - family_popup.c \ - family_feedbag.c \ - family_stats.c \ - family_translate.c \ - family_userlookup.c \ - flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ - oscar.h \ - oscarcommon.h \ - oscar_data.c \ - peer.c \ - peer.h \ - peer_proxy.c \ - rxhandlers.c \ - snac.c \ - snactypes.h \ - tlv.c \ - util.c - -AM_CFLAGS = $(st) -libaim_la_LDFLAGS = -module -avoid-version -libicq_la_LDFLAGS = -module -avoid-version -@STATIC_OSCAR_FALSE@st = -@STATIC_OSCAR_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_OSCAR_TRUE@noinst_LTLIBRARIES = liboscar.la -@STATIC_OSCAR_FALSE@liboscar_la_SOURCES = $(OSCARSOURCES) -@STATIC_OSCAR_TRUE@liboscar_la_SOURCES = $(OSCARSOURCES) libaim.c libicq.c -@STATIC_OSCAR_TRUE@liboscar_la_CFLAGS = $(AM_CFLAGS) -@STATIC_OSCAR_FALSE@pkg_LTLIBRARIES = liboscar.la libaim.la libicq.la -@STATIC_OSCAR_FALSE@liboscar_la_LIBADD = $(GLIB_LIBS) -@STATIC_OSCAR_FALSE@libaim_la_SOURCES = libaim.c -@STATIC_OSCAR_FALSE@libaim_la_LIBADD = liboscar.la -@STATIC_OSCAR_FALSE@libicq_la_SOURCES = libicq.c -@STATIC_OSCAR_FALSE@libicq_la_LIBADD = liboscar.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/oscar/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/oscar/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libaim.la: $(libaim_la_OBJECTS) $(libaim_la_DEPENDENCIES) - $(LINK) $(am_libaim_la_rpath) $(libaim_la_LDFLAGS) $(libaim_la_OBJECTS) $(libaim_la_LIBADD) $(LIBS) -libicq.la: $(libicq_la_OBJECTS) $(libicq_la_DEPENDENCIES) - $(LINK) $(am_libicq_la_rpath) $(libicq_la_LDFLAGS) $(libicq_la_OBJECTS) $(libicq_la_LIBADD) $(LIBS) -liboscar.la: $(liboscar_la_OBJECTS) $(liboscar_la_DEPENDENCIES) - $(LINK) $(am_liboscar_la_rpath) $(liboscar_la_LDFLAGS) $(liboscar_la_OBJECTS) $(liboscar_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libaim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-bstream.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-clientlogin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_admin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_advert.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_alert.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_auth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_bart.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_bos.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_chatnav.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_feedbag.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_icbm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_icq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_invite.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_locate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_odir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_oservice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_popup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_stats.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_translate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-family_userlookup.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-flap_connection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-libaim.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-libicq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-misc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-msgcookie.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-odc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-oft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-oscar.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-oscar_data.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-peer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-peer_proxy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-rxhandlers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-snac.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-tlv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liboscar_la-util.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -liboscar_la-bstream.lo: bstream.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-bstream.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-bstream.Tpo" -c -o liboscar_la-bstream.lo `test -f 'bstream.c' || echo '$(srcdir)/'`bstream.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-bstream.Tpo" "$(DEPDIR)/liboscar_la-bstream.Plo"; else rm -f "$(DEPDIR)/liboscar_la-bstream.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bstream.c' object='liboscar_la-bstream.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-bstream.lo `test -f 'bstream.c' || echo '$(srcdir)/'`bstream.c - -liboscar_la-clientlogin.lo: clientlogin.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-clientlogin.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-clientlogin.Tpo" -c -o liboscar_la-clientlogin.lo `test -f 'clientlogin.c' || echo '$(srcdir)/'`clientlogin.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-clientlogin.Tpo" "$(DEPDIR)/liboscar_la-clientlogin.Plo"; else rm -f "$(DEPDIR)/liboscar_la-clientlogin.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='clientlogin.c' object='liboscar_la-clientlogin.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-clientlogin.lo `test -f 'clientlogin.c' || echo '$(srcdir)/'`clientlogin.c - -liboscar_la-family_admin.lo: family_admin.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_admin.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_admin.Tpo" -c -o liboscar_la-family_admin.lo `test -f 'family_admin.c' || echo '$(srcdir)/'`family_admin.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_admin.Tpo" "$(DEPDIR)/liboscar_la-family_admin.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_admin.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_admin.c' object='liboscar_la-family_admin.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_admin.lo `test -f 'family_admin.c' || echo '$(srcdir)/'`family_admin.c - -liboscar_la-family_advert.lo: family_advert.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_advert.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_advert.Tpo" -c -o liboscar_la-family_advert.lo `test -f 'family_advert.c' || echo '$(srcdir)/'`family_advert.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_advert.Tpo" "$(DEPDIR)/liboscar_la-family_advert.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_advert.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_advert.c' object='liboscar_la-family_advert.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_advert.lo `test -f 'family_advert.c' || echo '$(srcdir)/'`family_advert.c - -liboscar_la-family_alert.lo: family_alert.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_alert.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_alert.Tpo" -c -o liboscar_la-family_alert.lo `test -f 'family_alert.c' || echo '$(srcdir)/'`family_alert.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_alert.Tpo" "$(DEPDIR)/liboscar_la-family_alert.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_alert.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_alert.c' object='liboscar_la-family_alert.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_alert.lo `test -f 'family_alert.c' || echo '$(srcdir)/'`family_alert.c - -liboscar_la-family_auth.lo: family_auth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_auth.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_auth.Tpo" -c -o liboscar_la-family_auth.lo `test -f 'family_auth.c' || echo '$(srcdir)/'`family_auth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_auth.Tpo" "$(DEPDIR)/liboscar_la-family_auth.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_auth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_auth.c' object='liboscar_la-family_auth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_auth.lo `test -f 'family_auth.c' || echo '$(srcdir)/'`family_auth.c - -liboscar_la-family_bart.lo: family_bart.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_bart.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_bart.Tpo" -c -o liboscar_la-family_bart.lo `test -f 'family_bart.c' || echo '$(srcdir)/'`family_bart.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_bart.Tpo" "$(DEPDIR)/liboscar_la-family_bart.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_bart.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_bart.c' object='liboscar_la-family_bart.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_bart.lo `test -f 'family_bart.c' || echo '$(srcdir)/'`family_bart.c - -liboscar_la-family_bos.lo: family_bos.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_bos.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_bos.Tpo" -c -o liboscar_la-family_bos.lo `test -f 'family_bos.c' || echo '$(srcdir)/'`family_bos.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_bos.Tpo" "$(DEPDIR)/liboscar_la-family_bos.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_bos.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_bos.c' object='liboscar_la-family_bos.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_bos.lo `test -f 'family_bos.c' || echo '$(srcdir)/'`family_bos.c - -liboscar_la-family_buddy.lo: family_buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_buddy.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_buddy.Tpo" -c -o liboscar_la-family_buddy.lo `test -f 'family_buddy.c' || echo '$(srcdir)/'`family_buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_buddy.Tpo" "$(DEPDIR)/liboscar_la-family_buddy.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_buddy.c' object='liboscar_la-family_buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_buddy.lo `test -f 'family_buddy.c' || echo '$(srcdir)/'`family_buddy.c - -liboscar_la-family_chat.lo: family_chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_chat.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_chat.Tpo" -c -o liboscar_la-family_chat.lo `test -f 'family_chat.c' || echo '$(srcdir)/'`family_chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_chat.Tpo" "$(DEPDIR)/liboscar_la-family_chat.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_chat.c' object='liboscar_la-family_chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_chat.lo `test -f 'family_chat.c' || echo '$(srcdir)/'`family_chat.c - -liboscar_la-family_chatnav.lo: family_chatnav.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_chatnav.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_chatnav.Tpo" -c -o liboscar_la-family_chatnav.lo `test -f 'family_chatnav.c' || echo '$(srcdir)/'`family_chatnav.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_chatnav.Tpo" "$(DEPDIR)/liboscar_la-family_chatnav.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_chatnav.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_chatnav.c' object='liboscar_la-family_chatnav.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_chatnav.lo `test -f 'family_chatnav.c' || echo '$(srcdir)/'`family_chatnav.c - -liboscar_la-family_icq.lo: family_icq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_icq.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_icq.Tpo" -c -o liboscar_la-family_icq.lo `test -f 'family_icq.c' || echo '$(srcdir)/'`family_icq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_icq.Tpo" "$(DEPDIR)/liboscar_la-family_icq.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_icq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_icq.c' object='liboscar_la-family_icq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_icq.lo `test -f 'family_icq.c' || echo '$(srcdir)/'`family_icq.c - -liboscar_la-family_icbm.lo: family_icbm.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_icbm.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_icbm.Tpo" -c -o liboscar_la-family_icbm.lo `test -f 'family_icbm.c' || echo '$(srcdir)/'`family_icbm.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_icbm.Tpo" "$(DEPDIR)/liboscar_la-family_icbm.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_icbm.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_icbm.c' object='liboscar_la-family_icbm.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_icbm.lo `test -f 'family_icbm.c' || echo '$(srcdir)/'`family_icbm.c - -liboscar_la-family_invite.lo: family_invite.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_invite.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_invite.Tpo" -c -o liboscar_la-family_invite.lo `test -f 'family_invite.c' || echo '$(srcdir)/'`family_invite.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_invite.Tpo" "$(DEPDIR)/liboscar_la-family_invite.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_invite.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_invite.c' object='liboscar_la-family_invite.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_invite.lo `test -f 'family_invite.c' || echo '$(srcdir)/'`family_invite.c - -liboscar_la-family_locate.lo: family_locate.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_locate.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_locate.Tpo" -c -o liboscar_la-family_locate.lo `test -f 'family_locate.c' || echo '$(srcdir)/'`family_locate.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_locate.Tpo" "$(DEPDIR)/liboscar_la-family_locate.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_locate.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_locate.c' object='liboscar_la-family_locate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_locate.lo `test -f 'family_locate.c' || echo '$(srcdir)/'`family_locate.c - -liboscar_la-family_odir.lo: family_odir.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_odir.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_odir.Tpo" -c -o liboscar_la-family_odir.lo `test -f 'family_odir.c' || echo '$(srcdir)/'`family_odir.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_odir.Tpo" "$(DEPDIR)/liboscar_la-family_odir.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_odir.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_odir.c' object='liboscar_la-family_odir.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_odir.lo `test -f 'family_odir.c' || echo '$(srcdir)/'`family_odir.c - -liboscar_la-family_oservice.lo: family_oservice.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_oservice.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_oservice.Tpo" -c -o liboscar_la-family_oservice.lo `test -f 'family_oservice.c' || echo '$(srcdir)/'`family_oservice.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_oservice.Tpo" "$(DEPDIR)/liboscar_la-family_oservice.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_oservice.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_oservice.c' object='liboscar_la-family_oservice.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_oservice.lo `test -f 'family_oservice.c' || echo '$(srcdir)/'`family_oservice.c - -liboscar_la-family_popup.lo: family_popup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_popup.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_popup.Tpo" -c -o liboscar_la-family_popup.lo `test -f 'family_popup.c' || echo '$(srcdir)/'`family_popup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_popup.Tpo" "$(DEPDIR)/liboscar_la-family_popup.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_popup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_popup.c' object='liboscar_la-family_popup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_popup.lo `test -f 'family_popup.c' || echo '$(srcdir)/'`family_popup.c - -liboscar_la-family_feedbag.lo: family_feedbag.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_feedbag.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_feedbag.Tpo" -c -o liboscar_la-family_feedbag.lo `test -f 'family_feedbag.c' || echo '$(srcdir)/'`family_feedbag.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_feedbag.Tpo" "$(DEPDIR)/liboscar_la-family_feedbag.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_feedbag.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_feedbag.c' object='liboscar_la-family_feedbag.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_feedbag.lo `test -f 'family_feedbag.c' || echo '$(srcdir)/'`family_feedbag.c - -liboscar_la-family_stats.lo: family_stats.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_stats.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_stats.Tpo" -c -o liboscar_la-family_stats.lo `test -f 'family_stats.c' || echo '$(srcdir)/'`family_stats.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_stats.Tpo" "$(DEPDIR)/liboscar_la-family_stats.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_stats.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_stats.c' object='liboscar_la-family_stats.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_stats.lo `test -f 'family_stats.c' || echo '$(srcdir)/'`family_stats.c - -liboscar_la-family_translate.lo: family_translate.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_translate.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_translate.Tpo" -c -o liboscar_la-family_translate.lo `test -f 'family_translate.c' || echo '$(srcdir)/'`family_translate.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_translate.Tpo" "$(DEPDIR)/liboscar_la-family_translate.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_translate.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_translate.c' object='liboscar_la-family_translate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_translate.lo `test -f 'family_translate.c' || echo '$(srcdir)/'`family_translate.c - -liboscar_la-family_userlookup.lo: family_userlookup.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-family_userlookup.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-family_userlookup.Tpo" -c -o liboscar_la-family_userlookup.lo `test -f 'family_userlookup.c' || echo '$(srcdir)/'`family_userlookup.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-family_userlookup.Tpo" "$(DEPDIR)/liboscar_la-family_userlookup.Plo"; else rm -f "$(DEPDIR)/liboscar_la-family_userlookup.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='family_userlookup.c' object='liboscar_la-family_userlookup.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-family_userlookup.lo `test -f 'family_userlookup.c' || echo '$(srcdir)/'`family_userlookup.c - -liboscar_la-flap_connection.lo: flap_connection.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-flap_connection.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-flap_connection.Tpo" -c -o liboscar_la-flap_connection.lo `test -f 'flap_connection.c' || echo '$(srcdir)/'`flap_connection.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-flap_connection.Tpo" "$(DEPDIR)/liboscar_la-flap_connection.Plo"; else rm -f "$(DEPDIR)/liboscar_la-flap_connection.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='flap_connection.c' object='liboscar_la-flap_connection.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-flap_connection.lo `test -f 'flap_connection.c' || echo '$(srcdir)/'`flap_connection.c - -liboscar_la-misc.lo: misc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-misc.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-misc.Tpo" -c -o liboscar_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-misc.Tpo" "$(DEPDIR)/liboscar_la-misc.Plo"; else rm -f "$(DEPDIR)/liboscar_la-misc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='liboscar_la-misc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c - -liboscar_la-msgcookie.lo: msgcookie.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-msgcookie.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-msgcookie.Tpo" -c -o liboscar_la-msgcookie.lo `test -f 'msgcookie.c' || echo '$(srcdir)/'`msgcookie.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-msgcookie.Tpo" "$(DEPDIR)/liboscar_la-msgcookie.Plo"; else rm -f "$(DEPDIR)/liboscar_la-msgcookie.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='msgcookie.c' object='liboscar_la-msgcookie.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-msgcookie.lo `test -f 'msgcookie.c' || echo '$(srcdir)/'`msgcookie.c - -liboscar_la-odc.lo: odc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-odc.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-odc.Tpo" -c -o liboscar_la-odc.lo `test -f 'odc.c' || echo '$(srcdir)/'`odc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-odc.Tpo" "$(DEPDIR)/liboscar_la-odc.Plo"; else rm -f "$(DEPDIR)/liboscar_la-odc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='odc.c' object='liboscar_la-odc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-odc.lo `test -f 'odc.c' || echo '$(srcdir)/'`odc.c - -liboscar_la-oft.lo: oft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-oft.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-oft.Tpo" -c -o liboscar_la-oft.lo `test -f 'oft.c' || echo '$(srcdir)/'`oft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-oft.Tpo" "$(DEPDIR)/liboscar_la-oft.Plo"; else rm -f "$(DEPDIR)/liboscar_la-oft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oft.c' object='liboscar_la-oft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-oft.lo `test -f 'oft.c' || echo '$(srcdir)/'`oft.c - -liboscar_la-oscar.lo: oscar.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-oscar.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-oscar.Tpo" -c -o liboscar_la-oscar.lo `test -f 'oscar.c' || echo '$(srcdir)/'`oscar.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-oscar.Tpo" "$(DEPDIR)/liboscar_la-oscar.Plo"; else rm -f "$(DEPDIR)/liboscar_la-oscar.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oscar.c' object='liboscar_la-oscar.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-oscar.lo `test -f 'oscar.c' || echo '$(srcdir)/'`oscar.c - -liboscar_la-oscar_data.lo: oscar_data.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-oscar_data.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-oscar_data.Tpo" -c -o liboscar_la-oscar_data.lo `test -f 'oscar_data.c' || echo '$(srcdir)/'`oscar_data.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-oscar_data.Tpo" "$(DEPDIR)/liboscar_la-oscar_data.Plo"; else rm -f "$(DEPDIR)/liboscar_la-oscar_data.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='oscar_data.c' object='liboscar_la-oscar_data.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-oscar_data.lo `test -f 'oscar_data.c' || echo '$(srcdir)/'`oscar_data.c - -liboscar_la-peer.lo: peer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-peer.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-peer.Tpo" -c -o liboscar_la-peer.lo `test -f 'peer.c' || echo '$(srcdir)/'`peer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-peer.Tpo" "$(DEPDIR)/liboscar_la-peer.Plo"; else rm -f "$(DEPDIR)/liboscar_la-peer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='peer.c' object='liboscar_la-peer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-peer.lo `test -f 'peer.c' || echo '$(srcdir)/'`peer.c - -liboscar_la-peer_proxy.lo: peer_proxy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-peer_proxy.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-peer_proxy.Tpo" -c -o liboscar_la-peer_proxy.lo `test -f 'peer_proxy.c' || echo '$(srcdir)/'`peer_proxy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-peer_proxy.Tpo" "$(DEPDIR)/liboscar_la-peer_proxy.Plo"; else rm -f "$(DEPDIR)/liboscar_la-peer_proxy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='peer_proxy.c' object='liboscar_la-peer_proxy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-peer_proxy.lo `test -f 'peer_proxy.c' || echo '$(srcdir)/'`peer_proxy.c - -liboscar_la-rxhandlers.lo: rxhandlers.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-rxhandlers.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-rxhandlers.Tpo" -c -o liboscar_la-rxhandlers.lo `test -f 'rxhandlers.c' || echo '$(srcdir)/'`rxhandlers.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-rxhandlers.Tpo" "$(DEPDIR)/liboscar_la-rxhandlers.Plo"; else rm -f "$(DEPDIR)/liboscar_la-rxhandlers.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='rxhandlers.c' object='liboscar_la-rxhandlers.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-rxhandlers.lo `test -f 'rxhandlers.c' || echo '$(srcdir)/'`rxhandlers.c - -liboscar_la-snac.lo: snac.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-snac.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-snac.Tpo" -c -o liboscar_la-snac.lo `test -f 'snac.c' || echo '$(srcdir)/'`snac.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-snac.Tpo" "$(DEPDIR)/liboscar_la-snac.Plo"; else rm -f "$(DEPDIR)/liboscar_la-snac.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='snac.c' object='liboscar_la-snac.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-snac.lo `test -f 'snac.c' || echo '$(srcdir)/'`snac.c - -liboscar_la-tlv.lo: tlv.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-tlv.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-tlv.Tpo" -c -o liboscar_la-tlv.lo `test -f 'tlv.c' || echo '$(srcdir)/'`tlv.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-tlv.Tpo" "$(DEPDIR)/liboscar_la-tlv.Plo"; else rm -f "$(DEPDIR)/liboscar_la-tlv.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tlv.c' object='liboscar_la-tlv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-tlv.lo `test -f 'tlv.c' || echo '$(srcdir)/'`tlv.c - -liboscar_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-util.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-util.Tpo" -c -o liboscar_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-util.Tpo" "$(DEPDIR)/liboscar_la-util.Plo"; else rm -f "$(DEPDIR)/liboscar_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='liboscar_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -liboscar_la-libaim.lo: libaim.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-libaim.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-libaim.Tpo" -c -o liboscar_la-libaim.lo `test -f 'libaim.c' || echo '$(srcdir)/'`libaim.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-libaim.Tpo" "$(DEPDIR)/liboscar_la-libaim.Plo"; else rm -f "$(DEPDIR)/liboscar_la-libaim.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libaim.c' object='liboscar_la-libaim.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-libaim.lo `test -f 'libaim.c' || echo '$(srcdir)/'`libaim.c - -liboscar_la-libicq.lo: libicq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -MT liboscar_la-libicq.lo -MD -MP -MF "$(DEPDIR)/liboscar_la-libicq.Tpo" -c -o liboscar_la-libicq.lo `test -f 'libicq.c' || echo '$(srcdir)/'`libicq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/liboscar_la-libicq.Tpo" "$(DEPDIR)/liboscar_la-libicq.Plo"; else rm -f "$(DEPDIR)/liboscar_la-libicq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libicq.c' object='liboscar_la-libicq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liboscar_la_CFLAGS) $(CFLAGS) -c -o liboscar_la-libicq.lo `test -f 'libicq.c' || echo '$(srcdir)/'`libicq.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of liboscar -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = liboscar -AIM_TARGET = libaim -ICQ_TARGET = libicq -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else - ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) - endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L. - -## -## SOURCES, OBJECTS -## -C_SRC = \ - bstream.c \ - clientlogin.c \ - family_admin.c \ - family_advert.c \ - family_alert.c \ - family_auth.c \ - family_bart.c \ - family_bos.c \ - family_buddy.c \ - family_chat.c \ - family_chatnav.c \ - family_icq.c \ - family_icbm.c \ - family_invite.c \ - family_locate.c \ - family_odir.c \ - family_popup.c \ - family_oservice.c \ - family_feedbag.c \ - family_stats.c \ - family_translate.c \ - family_userlookup.c \ - flap_connection.c \ - misc.c \ - msgcookie.c \ - odc.c \ - oft.c \ - oscar.c \ - oscar_data.c \ - peer.c \ - peer_proxy.c \ - rxhandlers.c \ - snac.c \ - tlv.c \ - util.c - -OBJECTS = $(C_SRC:%.c=%.o) - -AIM_C_SRC = libaim.c -AIM_OBJECTS = $(AIM_C_SRC:%.c=%.o) - -ICQ_C_SRC = libicq.c -ICQ_OBJECTS = $(ICQ_C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll $(AIM_TARGET).dll $(ICQ_TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(AIM_TARGET).dll $(ICQ_TARGET).dll $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll.a $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -$(AIM_TARGET).dll: $(TARGET).dll.a $(AIM_OBJECTS) - $(CC) -shared $(AIM_OBJECTS) $(LIB_PATHS) $(LIBS) -loscar $(DLL_LD_FLAGS) -o $(AIM_TARGET).dll - -$(ICQ_TARGET).dll: $(TARGET).dll.a $(ICQ_OBJECTS) - $(CC) -shared $(ICQ_OBJECTS) $(LIB_PATHS) $(LIBS) -loscar $(DLL_LD_FLAGS) -o $(ICQ_TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a - rm -f $(AIM_OBJECTS) $(AIM_TARGET).dll - rm -f $(ICQ_OBJECTS) $(ICQ_TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/misc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/misc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/misc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/misc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,155 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Random stuff. Basically just a few functions for sending - * simple SNACs, and then the generic error handler. - */ - -#include "oscar.h" - -/* - * Generic routine for sending commands. - * - * I know I can do this in a smarter way...but I'm not thinking straight - * right now... - * - * I had one big function that handled all three cases, but then it broke - * and I split it up into three. But then I fixed it. I just never went - * back to the single. I don't see any advantage to doing it either way. - * - */ -void -aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) -{ - aim_snacid_t snacid = 0x00000000; - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL); -} - -void -aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype) -{ - aim_snacid_t snacid; - - snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, NULL); -} - -void -aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *longdata) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!longdata) - { - aim_genericreq_n(od, conn, family, subtype); - return; - } - - byte_stream_new(&bs, 4); - - snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); - - byte_stream_put32(&bs, *longdata); - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -void -aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *shortdata) -{ - ByteStream bs; - aim_snacid_t snacid; - - if (!shortdata) - { - aim_genericreq_n(od, conn, family, subtype); - return; - } - - byte_stream_new(&bs, 2); - - snacid = aim_cachesnac(od, family, subtype, 0x0000, NULL, 0); - - byte_stream_put16(&bs, *shortdata); - - flap_connection_send_snac(od, conn, family, subtype, 0x0000, snacid, &bs); - - byte_stream_destroy(&bs); -} - -/* - * Should be generic enough to handle the errors for all groups. - * - */ -static int -generror(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - int ret = 0; - int error = 0; - aim_rxcallback_t userfunc; - aim_snac_t *snac2; - - snac2 = aim_remsnac(od, snac->id); - - if (byte_stream_empty(bs)) - error = byte_stream_get16(bs); - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - ret = userfunc(od, conn, frame, error, snac2 ? snac2->data : NULL); - - if (snac2) - g_free(snac2->data); - g_free(snac2); - - return ret; -} - -static int -snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) -{ - if (snac->subtype == 0x0001) - return generror(od, conn, mod, frame, snac, bs); - else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) { - aim_rxcallback_t userfunc; - - if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) - return userfunc(od, conn, frame); - } - - return 0; -} - -int -misc_modfirst(OscarData *od, aim_module_t *mod) -{ - mod->family = 0xffff; - mod->version = 0x0000; - mod->flags = AIM_MODFLAG_MULTIFAMILY; - strncpy(mod->name, "misc", sizeof(mod->name)); - mod->snachandler = snachandler; - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/msgcookie.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/msgcookie.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/msgcookie.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/msgcookie.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Cookie Caching stuff. Adam wrote this, apparently just some - * derivatives of n's SNAC work. I cleaned it up, added comments. - * - */ - -/* - * I'm assuming that cookies are type-specific. that is, we can have - * "1234578" for type 1 and type 2 concurrently. if i'm wrong, then we - * lose some error checking. if we assume cookies are not type-specific and are - * wrong, we get quirky behavior when cookies step on each others' toes. - */ - -#include "oscar.h" - -/** - * aim_cachecookie - appends a cookie to the cookie list - * - * if cookie->cookie for type cookie->type is found, updates the - * ->addtime of the found structure; otherwise adds the given cookie - * to the cache - * - * @param od session to add to - * @param cookie pointer to struct to append - * @return returns -1 on error, 0 on append, 1 on update. the cookie you pass - * in may be free'd, so don't count on its value after calling this! - */ -int aim_cachecookie(OscarData *od, IcbmCookie *cookie) -{ - IcbmCookie *newcook; - - if (!od || !cookie) - return -EINVAL; - - newcook = aim_checkcookie(od, cookie->cookie, cookie->type); - - if (newcook == cookie) { - newcook->addtime = time(NULL); - return 1; - } else if (newcook) - aim_cookie_free(od, newcook); - - cookie->addtime = time(NULL); - - cookie->next = od->msgcookies; - od->msgcookies = cookie; - - return 0; -} - -/** - * aim_uncachecookie - grabs a cookie from the cookie cache (removes it from the list) - * - * takes a cookie string and a cookie type and finds the cookie struct associated with that duple, removing it from the cookie list ikn the process. - * - * @param od session to grab cookie from - * @param cookie cookie string to look for - * @param type cookie type to look for - * @return if found, returns the struct; if none found (or on error), returns NULL: - */ -IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type) -{ - IcbmCookie *cur, **prev; - - if (!cookie || !od->msgcookies) - return NULL; - - for (prev = &od->msgcookies; (cur = *prev); ) { - if ((cur->type == type) && - (memcmp(cur->cookie, cookie, 8) == 0)) { - *prev = cur->next; - return cur; - } - prev = &cur->next; - } - - return NULL; -} - -/** - * aim_mkcookie - generate an IcbmCookie *struct from a cookie string, a type, and a data pointer. - * - * @param c pointer to the cookie string array - * @param type cookie type to use - * @param data data to be cached with the cookie - * @return returns NULL on error, a pointer to the newly-allocated - * cookie on success. - */ -IcbmCookie *aim_mkcookie(guint8 *c, int type, void *data) -{ - IcbmCookie *cookie; - - if (!c) - return NULL; - - cookie = g_new0(IcbmCookie, 1); - - cookie->data = data; - cookie->type = type; - memcpy(cookie->cookie, c, 8); - - return cookie; -} - -/** - * aim_checkcookie - check to see if a cookietuple has been cached - * - * @param od session to check for the cookie in - * @param cookie pointer to the cookie string array - * @param type type of the cookie to look for - * @return returns a pointer to the cookie struct (still in the list) - * on success; returns NULL on error/not found - */ - -IcbmCookie *aim_checkcookie(OscarData *od, const guint8 *cookie, const int type) -{ - IcbmCookie *cur; - - for (cur = od->msgcookies; cur; cur = cur->next) { - if ((cur->type == type) && - (memcmp(cur->cookie, cookie, 8) == 0)) - return cur; - } - - return NULL; -} - -/** - * aim_cookie_free - free an IcbmCookie struct - * - * this function removes the cookie *cookie from the list of cookies - * in od, and then frees all memory associated with it. including - * its data! if you want to use the private data after calling this, - * make sure you copy it first. - * - * @param od session to remove the cookie from - * @param cookie the address of a pointer to the cookie struct to remove - * @return returns -1 on error, 0 on success. - * - */ -int aim_cookie_free(OscarData *od, IcbmCookie *cookie) -{ - IcbmCookie *cur, **prev; - - if (!od || !cookie) - return -EINVAL; - - for (prev = &od->msgcookies; (cur = *prev); ) { - if (cur == cookie) - *prev = cur->next; - else - prev = &cur->next; - } - - g_free(cookie->data); - g_free(cookie); - - return 0; -} - -/* XXX I hate switch */ -int aim_msgcookie_gettype(int type) -{ - /* XXX: hokey-assed. needs fixed. */ - switch(type) { - case OSCAR_CAPABILITY_BUDDYICON: return AIM_COOKIETYPE_OFTICON; - case OSCAR_CAPABILITY_TALK: return AIM_COOKIETYPE_OFTVOICE; - case OSCAR_CAPABILITY_DIRECTIM: return AIM_COOKIETYPE_OFTIMAGE; - case OSCAR_CAPABILITY_CHAT: return AIM_COOKIETYPE_CHAT; - case OSCAR_CAPABILITY_GETFILE: return AIM_COOKIETYPE_OFTGET; - case OSCAR_CAPABILITY_SENDFILE: return AIM_COOKIETYPE_OFTSEND; - default: return AIM_COOKIETYPE_UNKNOWN; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/odc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/odc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/odc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/odc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,626 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* From the oscar PRPL */ -#include "oscar.h" -#include "peer.h" - -/* From Purple */ -#include "conversation.h" -#include "imgstore.h" -#include "util.h" - -#define DIRECTIM_MAX_FILESIZE 52428800 - -/** - * Free any ODC related data and print a message to the conversation - * window based on conn->disconnect_reason. - */ -void -peer_odc_close(PeerConnection *conn) -{ - gchar *tmp; - - if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - tmp = g_strdup(_("The remote user has closed the connection.")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - tmp = g_strdup(_("The remote user has declined your request.")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - tmp = g_strdup_printf(_("Lost connection with the remote user:
%s"), - conn->error_message); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - tmp = g_strdup(_("Received invalid data on connection with remote user.")); - else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - tmp = g_strdup(_("Unable to establish a connection with the remote user.")); - else - /* - * We shouldn't print a message for some disconnect_reasons. - * Like OSCAR_DISCONNECT_LOCAL_CLOSED. - */ - tmp = NULL; - - if (tmp != NULL) - { - PurpleAccount *account; - PurpleConversation *conv; - - account = purple_connection_get_account(conn->od->gc); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - - if (conn->frame != NULL) - { - OdcFrame *frame; - frame = conn->frame; - g_free(frame->payload.data); - g_free(frame); - } -} - -/** - * Write the given OdcFrame to a ByteStream and send it out - * on the established PeerConnection. - */ -static void -peer_odc_send(PeerConnection *conn, OdcFrame *frame) -{ - PurpleAccount *account; - const char *username; - size_t length; - ByteStream bs; - - purple_debug_info("oscar", "Outgoing ODC frame to %s with " - "type=0x%04x, flags=0x%04x, payload length=%u\n", - conn->bn, frame->type, frame->flags, frame->payload.len); - - account = purple_connection_get_account(conn->od->gc); - username = purple_account_get_username(account); - memcpy(frame->bn, username, strlen(username)); - memcpy(frame->cookie, conn->cookie, 8); - - length = 76; - byte_stream_new(&bs, length + frame->payload.len); - byte_stream_putraw(&bs, conn->magic, 4); - byte_stream_put16(&bs, length); - byte_stream_put16(&bs, frame->type); - byte_stream_put16(&bs, frame->subtype); - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, frame->cookie, 8); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put32(&bs, frame->payload.len); - byte_stream_put16(&bs, frame->encoding); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, frame->flags); - byte_stream_put16(&bs, 0x0000); - byte_stream_put16(&bs, 0x0000); - byte_stream_putraw(&bs, frame->bn, 32); - byte_stream_putraw(&bs, frame->payload.data, frame->payload.len); - - peer_connection_send(conn, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Send a very basic ODC frame (which contains the cookie) so that the - * remote user can verify that we are the person they were expecting. - * If we made an outgoing connection to then remote user, then we send - * this immediately. If the remote user connected to us, then we wait - * for the other person to send this to us, then we send one to them. - */ -void -peer_odc_send_cookie(PeerConnection *conn) -{ - OdcFrame frame; - - memset(&frame, 0, sizeof(OdcFrame)); - frame.type = 0x0001; - frame.subtype = 0x0006; - frame.flags = 0x0060; /* Maybe this means "we're sending the cookie"? */ - - peer_odc_send(conn, &frame); -} - -/** - * Send client-to-client typing notification over an established direct connection. - */ -void -peer_odc_send_typing(PeerConnection *conn, PurpleTypingState typing) -{ - OdcFrame frame; - - memset(&frame, 0, sizeof(OdcFrame)); - frame.type = 0x0001; - frame.subtype = 0x0006; - if (typing == PURPLE_TYPING) - frame.flags = 0x0002 | 0x0008; - else if (typing == PURPLE_TYPED) - frame.flags = 0x0002 | 0x0004; - else - frame.flags = 0x0002; - - peer_odc_send(conn, &frame); -} - -/** - * Send client-to-client IM over an established direct connection. - * To send a direct IM, call this just like you would aim_send_im. - * - * @param conn The already-connected ODC connection. - * @param msg Null-terminated string to send. - * @param len The length of the message to send, including binary data. - * @param encoding See the AIM_CHARSET_* defines in oscar.h - * @param autoreply TRUE if this is any auto-reply. - */ -void -peer_odc_send_im(PeerConnection *conn, const char *msg, int len, int encoding, gboolean autoreply) -{ - OdcFrame frame; - - g_return_if_fail(msg != NULL); - g_return_if_fail(len > 0); - - memset(&frame, 0, sizeof(OdcFrame)); - frame.type = 0x0001; - frame.subtype = 0x0006; - frame.payload.len = len; - frame.encoding = encoding; - frame.flags = autoreply; - byte_stream_new(&frame.payload, len); - byte_stream_putraw(&frame.payload, (guint8 *)msg, len); - - peer_odc_send(conn, &frame); - - g_free(frame.payload.data); -} - -struct embedded_data -{ - size_t size; - const guint8 *data; -}; - -/** - * This is called after a direct IM has been received in its entirety. This - * function is passed a long chunk of data which contains the IM with any - * data chunks (images) appended to it. - * - * This function rips out all the data chunks and creates an imgstore for - * each one. In order to do this, it first goes through the IM and takes - * out all the IMG tags. When doing so, it rewrites the original IMG tag - * with one compatible with the imgstore Purple core code. For each one, we - * then read in chunks of data from the end of the message and actually - * create the img store using the given data. - * - * For somewhat easy reference, here's a sample message - * (with added whitespace): - * - * - * - * This is a really stupid picture:
- *
- * Yeah it is
- * Here is another one:
- * - *
- * - * - * datadatadatadata - * datadatadatadata - * - */ -static void -peer_odc_handle_payload(PeerConnection *conn, const char *msg, size_t len, int encoding, gboolean autoreply) -{ - PurpleConnection *gc; - PurpleAccount *account; - const char *msgend, *binary_start, *dataend; - const char *tmp, *start, *end, *idstr, *src, *sizestr; - GData *attributes; - GHashTable *embedded_datas; - struct embedded_data *embedded_data; - GSList *images; - gchar *utf8; - GString *newmsg; - PurpleMessageFlags imflags; - - gc = conn->od->gc; - account = purple_connection_get_account(gc); - - dataend = msg + len; - - /* - * Create a hash table containing references to each embedded - * data chunk. The key is the "ID" and the value is an - * embedded_data struct. - */ - embedded_datas = g_hash_table_new_full(g_direct_hash, - g_direct_equal, NULL, g_free); - - /* - * Create an index of any binary chunks. If we run into any - * problems while parsing the binary data section then we stop - * parsing it, and the local user will see broken image icons. - */ - /* TODO: Use a length argument when looking for the tag! */ - binary_start = purple_strcasestr(msg, ""); - if (binary_start == NULL) - msgend = dataend; - else - { - msgend = binary_start; - - /* Move our pointer to immediately after the tag */ - tmp = binary_start + 8; - - /* The embedded binary markup has a mimimum length of 29 bytes */ - /* TODO: Use a length argument when looking for the tag! */ - while ((tmp + 29 <= dataend) && - purple_markup_find_tag("data", tmp, &start, &tmp, &attributes)) - { - unsigned int id; - size_t size; - - /* Move the binary pointer from ">" to the start of the data */ - tmp++; - - /* Get the ID */ - idstr = g_datalist_get_data(&attributes, "id"); - if (idstr == NULL) - { - g_datalist_clear(&attributes); - break; - } - id = atoi(idstr); - - /* Get the size */ - sizestr = g_datalist_get_data(&attributes, "size"); - if (sizestr == NULL) - { - g_datalist_clear(&attributes); - break; - } - size = atol(sizestr); - - g_datalist_clear(&attributes); - - if ((size > 0) && (tmp + size > dataend)) - break; - - embedded_data = g_new(struct embedded_data, 1); - embedded_data->size = size; - embedded_data->data = (const guint8 *)tmp; - tmp += size; - - /* Skip past the closing tag */ - if (g_ascii_strncasecmp(tmp, "", 7)) - { - g_free(embedded_data); - break; - } - tmp += 7; - - g_hash_table_insert(embedded_datas, - GINT_TO_POINTER(id), embedded_data); - } - } - - /* - * Loop through the message, replacing OSCAR img tags with the - * equivalent Purple img tag. - */ - images = NULL; - newmsg = g_string_new(""); - tmp = msg; - while (purple_markup_find_tag("img", tmp, &start, &end, &attributes)) - { - int imgid = 0; - - idstr = g_datalist_get_data(&attributes, "id"); - src = g_datalist_get_data(&attributes, "src"); - sizestr = g_datalist_get_data(&attributes, "datasize"); - - if ((idstr != NULL) && (src != NULL) && (sizestr!= NULL)) - { - unsigned int id; - size_t size; - - id = atoi(idstr); - size = atol(sizestr); - embedded_data = g_hash_table_lookup(embedded_datas, - GINT_TO_POINTER(id)); - - if ((embedded_data != NULL) && (embedded_data->size == size)) - { - imgid = purple_imgstore_add_with_id(g_memdup(embedded_data->data, size), size, src); - - /* Record the image number */ - images = g_slist_append(images, GINT_TO_POINTER(imgid)); - } - } - - /* Delete the attribute list */ - g_datalist_clear(&attributes); - - /* Append the message up to the tag */ - utf8 = purple_plugin_oscar_decode_im_part(account, conn->bn, - encoding, 0x0000, tmp, start - tmp); - if (utf8 != NULL) { - g_string_append(newmsg, utf8); - g_free(utf8); - } - - if (imgid != 0) - { - /* Write the new image tag */ - g_string_append_printf(newmsg, "", imgid); - } - - /* Continue from the end of the tag */ - tmp = end + 1; - } - - /* Append any remaining message data */ - if (tmp <= msgend) - { - utf8 = purple_plugin_oscar_decode_im_part(account, conn->bn, - encoding, 0x0000, tmp, msgend - tmp); - if (utf8 != NULL) { - g_string_append(newmsg, utf8); - g_free(utf8); - } - } - - /* Display the message we received */ - imflags = 0; - if (images != NULL) - imflags |= PURPLE_MESSAGE_IMAGES; - if (autoreply) - imflags |= PURPLE_MESSAGE_AUTO_RESP; - serv_got_im(gc, conn->bn, newmsg->str, imflags, time(NULL)); - g_string_free(newmsg, TRUE); - - /* unref any images we allocated */ - if (images) - { - GSList *l; - for (l = images; l != NULL; l = l->next) - purple_imgstore_unref_by_id(GPOINTER_TO_INT(l->data)); - g_slist_free(images); - } - - /* Delete our list of pointers to embedded images */ - g_hash_table_destroy(embedded_datas); -} - -/** - * This is a purple_input_add() watcher callback function for reading - * direct IM payload data. "Payload data" is always an IM and - * maybe some embedded images or files or something. The actual - * ODC frame is read using peer_connection_recv_cb(). We temporarily - * switch to this watcher callback ONLY to read the payload, and we - * switch back once we're done. - */ -static void -peer_odc_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - OdcFrame *frame; - ByteStream *bs; - gssize read; - - conn = data; - frame = conn->frame; - bs = &frame->payload; - - /* Read data into the temporary buffer until it is complete */ - read = recv(conn->fd, - &bs->data[bs->offset], - bs->len - bs->offset, - 0); - - /* Check if the remote user closed the connection */ - if (read == 0) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - return; - } - - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - peer_connection_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - bs->offset += read; - if (bs->offset < bs->len) - /* Waiting for more data to arrive */ - return; - - /* We have a complete ODC/OFT frame! Handle it and continue reading */ - byte_stream_rewind(bs); - peer_odc_handle_payload(conn, (const char *)bs->data, - bs->len, frame->encoding, frame->flags & 0x0001); - g_free(bs->data); - bs->data = NULL; - g_free(frame); - conn->frame = NULL; - - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_connection_recv_cb, conn); -} - -/** - * Handle an incoming OdcFrame. If there is a payload associated - * with this frame, then we remove the old watcher and add the - * ODC watcher to read in the payload. - */ -void -peer_odc_recv_frame(PeerConnection *conn, ByteStream *bs) -{ - PurpleConnection *gc; - OdcFrame *frame; - - gc = conn->od->gc; - - frame = g_new0(OdcFrame, 1); - frame->type = byte_stream_get16(bs); - frame->subtype = byte_stream_get16(bs); - byte_stream_advance(bs, 2); - byte_stream_getrawbuf(bs, frame->cookie, 8); - byte_stream_advance(bs, 8); - frame->payload.len = byte_stream_get32(bs); - frame->encoding = byte_stream_get16(bs); - byte_stream_advance(bs, 4); - frame->flags = byte_stream_get16(bs); - byte_stream_advance(bs, 4); - byte_stream_getrawbuf(bs, frame->bn, 32); - - purple_debug_info("oscar", "Incoming ODC frame from %s with " - "type=0x%04x, flags=0x%04x, payload length=%u\n", - frame->bn, frame->type, frame->flags, frame->payload.len); - - if (!conn->ready) - { - /* - * We need to verify the cookie so that we know we are - * connected to our friend and not a malicious middle man. - */ - - PurpleAccount *account; - PurpleConversation *conv; - - if (conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING) - { - if (memcmp(conn->cookie, frame->cookie, 8)) - { - /* - * Oh no! The user that connected to us did not send - * the correct cookie! They are not our friend. Go try - * to accept another connection? - */ - purple_debug_info("oscar", "Received an incorrect cookie. " - "Closing connection.\n"); - peer_connection_destroy(conn, - OSCAR_DISCONNECT_INVALID_DATA, NULL); - g_free(frame); - return; - } - - /* - * Ok, we know they are legit. Now be courteous and - * send them our cookie. Note: This doesn't seem - * to be necessary, but it also doesn't seem to hurt. - */ - peer_odc_send_cookie(conn); - } - - conn->ready = TRUE; - - /* - * If they connected to us then close the listener socket - * and send them our cookie. - */ - if (conn->listenerfd != -1) - { - close(conn->listenerfd); - conn->listenerfd = -1; - } - - /* Tell the local user that we are connected */ - account = purple_connection_get_account(gc); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, _("Direct IM established"), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - if ((frame->type != 0x0001) && (frame->subtype != 0x0006)) - { - purple_debug_info("oscar", "Unknown ODC frame type 0x%04hx, " - "subtype 0x%04hx.\n", frame->type, frame->subtype); - g_free(frame); - return; - } - - if (frame->flags & 0x0008) - { - /* I had to leave this. It's just too funny. It reminds me of my sister. */ - purple_debug_info("oscar", "ohmigod! %s has started typing " - "(DirectIM). He's going to send you a message! " - "*squeal*\n", conn->bn); - serv_got_typing(gc, conn->bn, 0, PURPLE_TYPING); - } - else if (frame->flags & 0x0004) - { - serv_got_typing(gc, conn->bn, 0, PURPLE_TYPED); - } - else - { - serv_got_typing_stopped(gc, conn->bn); - } - - if (frame->payload.len > 0) - { - if (frame->payload.len > DIRECTIM_MAX_FILESIZE) - { - gchar *tmp, *size1, *size2; - PurpleAccount *account; - PurpleConversation *conv; - - size1 = purple_str_size_to_units(frame->payload.len); - size2 = purple_str_size_to_units(DIRECTIM_MAX_FILESIZE); - tmp = g_strdup_printf(_("%s tried to send you a %s file, but we only allow files up to %s over Direct IM. Try using file transfer instead.\n"), conn->bn, size1, size2); - g_free(size1); - g_free(size2); - - account = purple_connection_get_account(conn->od->gc); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - g_free(frame); - return; - } - - /* We have payload data! Switch to the ODC watcher to read it. */ - frame->payload.data = g_new(guint8, frame->payload.len); - frame->payload.offset = 0; - conn->frame = frame; - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_odc_recv_cb, conn); - return; - } - - g_free(frame); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,813 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * I feel like this is a good place to explain OFT, so I'm going to - * do just that. Each OFT packet has a header type. I guess this - * is pretty similar to the subtype of a SNAC packet. The type - * basically tells the other client the meaning of the OFT packet. - * There are two distinct types of file transfer, which I usually - * call "sendfile" and "getfile." Sendfile is when you send a file - * to another AIM user. Getfile is when you share a group of files, - * and other users request that you send them the files. - * - * A typical sendfile file transfer goes like this: - * 1) Sender sends a channel 2 ICBM telling the other user that - * we want to send them a file. At the same time, we open a - * listener socket (this should be done before sending the - * ICBM) on some port, and wait for them to connect to us. - * The ICBM we sent should contain our IP address and the port - * number that we're listening on. - * 2) The receiver connects to the sender on the given IP address - * and port. After the connection is established, the receiver - * sends an ICBM signifying that we are ready and waiting. - * 3) The sender sends an OFT PROMPT message over the OFT - * connection. - * 4) The receiver of the file sends back an exact copy of this - * OFT packet, except the cookie is filled in with the cookie - * from the ICBM. I think this might be an attempt to verify - * that the user that is connected is actually the guy that - * we sent the ICBM to. Oh, I've been calling this the ACK. - * 5) The sender starts sending raw data across the connection - * until the entire file has been sent. - * 6) The receiver knows the file is finished because the sender - * sent the file size in an earlier OFT packet. So then the - * receiver sends the DONE thingy (after filling in the - * "received" checksum and size) and closes the connection. - */ - -#include "oscar.h" -#include "peer.h" - -#include "util.h" - -#define CHECKSUM_BUFFER_SIZE 256 * 1024 - -struct _ChecksumData -{ - PeerConnection *conn; - PurpleXfer *xfer; - GSourceFunc callback; - size_t size; - guint32 checksum; - size_t total; - FILE *file; - guint8 buffer[CHECKSUM_BUFFER_SIZE]; - guint timer; -}; - -void -peer_oft_checksum_destroy(ChecksumData *checksum_data) -{ - checksum_data->conn->checksum_data = NULL; - fclose(checksum_data->file); - if (checksum_data->timer > 0) - purple_timeout_remove(checksum_data->timer); - g_free(checksum_data); -} - -/** - * Calculate oft checksum of buffer - * - * Prevcheck should be 0xFFFF0000 when starting a checksum of a file. The - * checksum is kind of a rolling checksum thing, so each time you get bytes - * of a file you just call this puppy and it updates the checksum. You can - * calculate the checksum of an entire file by calling this in a while or a - * for loop, or something. - * - * Thanks to Graham Booker for providing this improved checksum routine, - * which is simpler and should be more accurate than Josh Myer's original - * code. -- wtm - * - * This algorithm works every time I have tried it. The other fails - * sometimes. So, AOL who thought this up? It has got to be the weirdest - * checksum I have ever seen. - * - * @param buffer Buffer of data to checksum. Man I'd like to buff her... - * @param bufsize Size of buffer. - * @param prevchecksum Previous checksum. - * @param odd Whether an odd number of bytes have been processed before this call - */ -static guint32 -peer_oft_checksum_chunk(const guint8 *buffer, int bufferlen, guint32 prevchecksum, int odd) -{ - guint32 checksum, oldchecksum; - int i = 0; - unsigned short val; - - checksum = (prevchecksum >> 16) & 0xffff; - if (odd) - { - /* - * This is one hell of a hack, but it should always work. - * Essentially, I am reindexing the array so that index 1 - * is the first element. Since the odd and even bytes are - * detected by the index number. - */ - i = 1; - bufferlen++; - buffer--; - } - for (; i < bufferlen; i++) - { - oldchecksum = checksum; - if (i & 1) - val = buffer[i]; - else - val = buffer[i] << 8; - checksum -= val; - /* - * The following appears to be necessary.... It happens - * every once in a while and the checksum doesn't fail. - */ - if (checksum > oldchecksum) - checksum--; - } - checksum = ((checksum & 0x0000ffff) + (checksum >> 16)); - checksum = ((checksum & 0x0000ffff) + (checksum >> 16)); - return checksum << 16; -} - -static gboolean -peer_oft_checksum_file_piece(gpointer data) -{ - ChecksumData *checksum_data; - gboolean repeat; - - checksum_data = data; - repeat = FALSE; - - if (checksum_data->total < checksum_data->size) - { - size_t bytes = MIN(CHECKSUM_BUFFER_SIZE, - checksum_data->size - checksum_data->total); - - bytes = fread(checksum_data->buffer, 1, bytes, checksum_data->file); - if (bytes != 0) - { - checksum_data->checksum = peer_oft_checksum_chunk(checksum_data->buffer, bytes, checksum_data->checksum, checksum_data->total & 1); - checksum_data->total += bytes; - repeat = TRUE; - } - } - - if (!repeat) - { - purple_debug_info("oscar", "Checksum of %s calculated\n", - purple_xfer_get_local_filename(checksum_data->xfer)); - if (checksum_data->callback != NULL) - checksum_data->callback(checksum_data); - peer_oft_checksum_destroy(checksum_data); - } - - return repeat; -} - -/** - * Calculate oft checksum of a file in a series of calls to - * peer_oft_checksum_file_piece(). We do it this way because - * calculating the checksum on large files can take a long time, - * and we want to return control to the UI so that the application - * doesn't appear completely frozen. - * - * @param conn The connection used for this file transfer. - * @param xfer The file transfer needing this checksum. - * @param callback The function to call upon calculation of the checksum. - * @param size The maximum size to check. - */ - -static void -peer_oft_checksum_file(PeerConnection *conn, PurpleXfer *xfer, GSourceFunc callback, size_t size) -{ - ChecksumData *checksum_data; - - purple_debug_info("oscar", "Calculating checksum of %s\n", - purple_xfer_get_local_filename(xfer)); - - checksum_data = g_malloc0(sizeof(ChecksumData)); - checksum_data->conn = conn; - checksum_data->xfer = xfer; - checksum_data->callback = callback; - checksum_data->size = size; - checksum_data->checksum = 0xffff0000; - checksum_data->file = fopen(purple_xfer_get_local_filename(xfer), "rb"); - - if (checksum_data->file == NULL) - { - purple_debug_error("oscar", "Unable to open %s for checksumming: %s\n", - purple_xfer_get_local_filename(xfer), g_strerror(errno)); - callback(checksum_data); - g_free(checksum_data); - } - else - { - checksum_data->timer = purple_timeout_add(10, - peer_oft_checksum_file_piece, checksum_data); - conn->checksum_data = checksum_data; - } -} - -static void -peer_oft_copy_xfer_data(PeerConnection *conn, OftFrame *frame) -{ - g_free(conn->xferdata.name); - - memcpy(&(conn->xferdata), frame, sizeof(OftFrame)); - conn->xferdata.name = g_memdup(frame->name, frame->name_length); -} - -/** - * Free any OFT related data. - */ -void -peer_oft_close(PeerConnection *conn) -{ - /* - * If canceled by local user, and we're receiving a file, and - * we're not connected/ready then send an ICBM cancel message. - */ - if ((purple_xfer_get_status(conn->xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) && - !conn->ready) - { - aim_im_sendch2_cancel(conn); - } - - if (conn->sending_data_timer != 0) - { - purple_timeout_remove(conn->sending_data_timer); - conn->sending_data_timer = 0; - } -} - -/** - * Write the given OftFrame to a ByteStream and send it out - * on the established PeerConnection. - */ -static void -peer_oft_send(PeerConnection *conn, OftFrame *frame) -{ - size_t length; - ByteStream bs; - - length = 192 + frame->name_length; - byte_stream_new(&bs, length); - byte_stream_putraw(&bs, conn->magic, 4); - byte_stream_put16(&bs, length); - byte_stream_put16(&bs, frame->type); - byte_stream_putraw(&bs, frame->cookie, 8); - byte_stream_put16(&bs, frame->encrypt); - byte_stream_put16(&bs, frame->compress); - byte_stream_put16(&bs, frame->totfiles); - byte_stream_put16(&bs, frame->filesleft); - byte_stream_put16(&bs, frame->totparts); - byte_stream_put16(&bs, frame->partsleft); - byte_stream_put32(&bs, frame->totsize); - byte_stream_put32(&bs, frame->size); - byte_stream_put32(&bs, frame->modtime); - byte_stream_put32(&bs, frame->checksum); - byte_stream_put32(&bs, frame->rfrcsum); - byte_stream_put32(&bs, frame->rfsize); - byte_stream_put32(&bs, frame->cretime); - byte_stream_put32(&bs, frame->rfcsum); - byte_stream_put32(&bs, frame->nrecvd); - byte_stream_put32(&bs, frame->recvcsum); - byte_stream_putraw(&bs, frame->idstring, 32); - byte_stream_put8(&bs, frame->flags); - byte_stream_put8(&bs, frame->lnameoffset); - byte_stream_put8(&bs, frame->lsizeoffset); - byte_stream_putraw(&bs, frame->dummy, 69); - byte_stream_putraw(&bs, frame->macfileinfo, 16); - byte_stream_put16(&bs, frame->nencode); - byte_stream_put16(&bs, frame->nlanguage); - /* - * The name can be more than 64 characters, but if it is less than - * 64 characters it is padded with NULLs. - */ - byte_stream_putraw(&bs, frame->name, frame->name_length); - - peer_connection_send(conn, &bs); - - byte_stream_destroy(&bs); -} - -void -peer_oft_send_prompt(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_PROMPT; - peer_oft_send(conn, &conn->xferdata); -} - -static void -peer_oft_send_ack(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_ACK; - - /* Fill in the cookie */ - memcpy(conn->xferdata.cookie, conn->cookie, 8); - - peer_oft_send(conn, &conn->xferdata); -} - -static void -peer_oft_send_resume_accept(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_RESUMEACCEPT; - - /* Fill in the cookie */ - memcpy(conn->xferdata.cookie, conn->cookie, 8); - - peer_oft_send(conn, &conn->xferdata); -} - -static void -peer_oft_send_done(PeerConnection *conn) -{ - conn->xferdata.type = PEER_TYPE_DONE; - conn->xferdata.rfrcsum = 0xffff0000; - conn->xferdata.nrecvd = purple_xfer_get_bytes_sent(conn->xfer); - peer_oft_send(conn, &conn->xferdata); -} - -/** - * This function exists so that we don't remove the outgoing - * data watcher while we're still sending data. In most cases - * any data we're sending will be instantly wisked away to a TCP - * buffer maintained by our operating system... but we want to - * make sure the core doesn't start sending file data while - * we're still sending OFT frame data. That would be bad. - */ -static gboolean -start_transfer_when_done_sending_data(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) - { - conn->sending_data_timer = 0; - conn->xfer->fd = conn->fd; - conn->fd = -1; - purple_xfer_start(conn->xfer, conn->xfer->fd, NULL, 0); - return FALSE; - } - - return TRUE; -} - -/** - * This function is similar to the above function, except instead - * of starting the xfer it will destroy the connection. This is - * used when you want to send one final message across the peer - * connection, and then close everything. - */ -static gboolean -destroy_connection_when_done_sending_data(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - if (purple_circ_buffer_get_max_read(conn->buffer_outgoing) == 0) - { - conn->sending_data_timer = 0; - peer_connection_destroy(conn, conn->disconnect_reason, NULL); - return FALSE; - } - - return TRUE; -} - -/* - * This is called when a buddy sends us some file info. This happens when they - * are sending a file to you, and you have just established a connection to them. - * You should send them the exact same info except use the real cookie. We also - * get like totally ready to like, receive the file, kay? - */ -static void -peer_oft_recv_frame_prompt(PeerConnection *conn, OftFrame *frame) -{ - /* Record the file information and send an ack */ - peer_oft_copy_xfer_data(conn, frame); - peer_oft_send_ack(conn); - - /* Remove our watchers and use the file transfer watchers in the core */ - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - conn->sending_data_timer = purple_timeout_add(100, - start_transfer_when_done_sending_data, conn); -} - -/** - * We are sending a file to someone else. They have just acknowledged our - * prompt, so we want to start sending data like there's no tomorrow. - */ -static void -peer_oft_recv_frame_ack(PeerConnection *conn, OftFrame *frame) -{ - if (memcmp(conn->cookie, frame->cookie, 8) != 0) - { - purple_debug_info("oscar", "Received an incorrect cookie. " - "Closing connection.\n"); - peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); - return; - } - - /* Remove our watchers and use the file transfer watchers in the core */ - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - conn->sending_data_timer = purple_timeout_add(100, - start_transfer_when_done_sending_data, conn); -} - -static gboolean -peer_oft_recv_frame_resume_checksum_calculated_cb(gpointer data) -{ - ChecksumData *checksum_data; - PeerConnection *conn; - - checksum_data = data; - conn = checksum_data->conn; - - /* Check the checksums here. If not match, don't allow resume */ - if (checksum_data->checksum != conn->xferdata.recvcsum || checksum_data->total != conn->xferdata.nrecvd) - { - /* Reset internal structure */ - conn->xferdata.recvcsum = 0xffff0000; - conn->xferdata.rfrcsum = 0xffff0000; - conn->xferdata.nrecvd = 0; - } - else - /* Accept the change */ - purple_xfer_set_bytes_sent(checksum_data->xfer, conn->xferdata.nrecvd); - - peer_oft_send_resume_accept(conn); - - return FALSE; -} - -/** - * We are sending a file to someone else. They have just acknowledged our - * prompt and are asking to resume, so we accept their resume and await - * a resume ack. - */ -static void -peer_oft_recv_frame_resume(PeerConnection *conn, OftFrame *frame) -{ - if (memcmp(conn->cookie, frame->cookie, 8) != 0) - { - purple_debug_info("oscar", "Received an incorrect cookie. " - "Closing connection.\n"); - peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); - return; - } - - /* Copy resume data into internal structure */ - conn->xferdata.recvcsum = frame->recvcsum; - conn->xferdata.rfrcsum = frame->rfrcsum; - conn->xferdata.nrecvd = frame->nrecvd; - - peer_oft_checksum_file(conn, conn->xfer, - peer_oft_recv_frame_resume_checksum_calculated_cb, - frame->nrecvd); -} - -/* - * We just sent a file to someone. They said they got it and everything, - * so we can close our direct connection and what not. - */ -static void -peer_oft_recv_frame_done(PeerConnection *conn, OftFrame *frame) -{ - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - conn->xfer->fd = conn->fd; - conn->fd = -1; - conn->disconnect_reason = OSCAR_DISCONNECT_DONE; - peer_connection_schedule_destroy(conn, conn->disconnect_reason, NULL); -} - -/** - * Handle an incoming OftFrame. If there is a payload associated - * with this frame, then we remove the old watcher and add the - * OFT watcher to read in the payload. - */ -void -peer_oft_recv_frame(PeerConnection *conn, ByteStream *bs) -{ - OftFrame frame; - - frame.type = byte_stream_get16(bs); - byte_stream_getrawbuf(bs, frame.cookie, 8); - frame.encrypt = byte_stream_get16(bs); - frame.compress = byte_stream_get16(bs); - frame.totfiles = byte_stream_get16(bs); - frame.filesleft = byte_stream_get16(bs); - frame.totparts = byte_stream_get16(bs); - frame.partsleft = byte_stream_get16(bs); - frame.totsize = byte_stream_get32(bs); - frame.size = byte_stream_get32(bs); - frame.modtime = byte_stream_get32(bs); - frame.checksum = byte_stream_get32(bs); - frame.rfrcsum = byte_stream_get32(bs); - frame.rfsize = byte_stream_get32(bs); - frame.cretime = byte_stream_get32(bs); - frame.rfcsum = byte_stream_get32(bs); - frame.nrecvd = byte_stream_get32(bs); - frame.recvcsum = byte_stream_get32(bs); - byte_stream_getrawbuf(bs, frame.idstring, 32); - frame.flags = byte_stream_get8(bs); - frame.lnameoffset = byte_stream_get8(bs); - frame.lsizeoffset = byte_stream_get8(bs); - byte_stream_getrawbuf(bs, frame.dummy, 69); - byte_stream_getrawbuf(bs, frame.macfileinfo, 16); - frame.nencode = byte_stream_get16(bs); - frame.nlanguage = byte_stream_get16(bs); - frame.name_length = bs->len - 186; - frame.name = byte_stream_getraw(bs, frame.name_length); - - purple_debug_info("oscar", "Incoming OFT frame from %s with " - "type=0x%04x\n", conn->bn, frame.type); - - /* TODOFT: peer_oft_dirconvert_fromstupid(frame->name); */ - - switch(frame.type) - { - case PEER_TYPE_PROMPT: - peer_oft_recv_frame_prompt(conn, &frame); - break; - case PEER_TYPE_ACK: - case PEER_TYPE_RESUMEACK: - peer_oft_recv_frame_ack(conn, &frame); - break; - case PEER_TYPE_RESUME: - peer_oft_recv_frame_resume(conn, &frame); - break; - case PEER_TYPE_DONE: - peer_oft_recv_frame_done(conn, &frame); - break; - default: - break; - } - - g_free(frame.name); -} - -/*******************************************************************/ -/* Begin PurpleXfer callbacks for use when receiving a file */ -/*******************************************************************/ - -void -peer_oft_recvcb_init(PurpleXfer *xfer) -{ - PeerConnection *conn; - - conn = xfer->data; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - peer_connection_trynext(conn); -} - -void -peer_oft_recvcb_end(PurpleXfer *xfer) -{ - PeerConnection *conn; - - conn = xfer->data; - - /* Tell the other person that we've received everything */ - conn->fd = conn->xfer->fd; - conn->xfer->fd = -1; - peer_oft_send_done(conn); - - conn->disconnect_reason = OSCAR_DISCONNECT_DONE; - conn->sending_data_timer = purple_timeout_add(100, - destroy_connection_when_done_sending_data, conn); -} - -void -peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size) -{ - PeerConnection *conn; - - /* Update our rolling checksum. Like Walmart, yo. */ - conn = xfer->data; - conn->xferdata.recvcsum = peer_oft_checksum_chunk(buffer, - size, conn->xferdata.recvcsum, purple_xfer_get_bytes_sent(xfer) & 1); -} - -/*******************************************************************/ -/* End PurpleXfer callbacks for use when receiving a file */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin PurpleXfer callbacks for use when sending a file */ -/*******************************************************************/ - -static gboolean -peer_oft_checksum_calculated_cb(gpointer data) -{ - ChecksumData *checksum_data; - PeerConnection *conn; - - checksum_data = data; - conn = checksum_data->conn; - - conn->xferdata.checksum = checksum_data->checksum; - - /* Start the connection process */ - peer_connection_trynext(checksum_data->conn); - - return FALSE; -} - -void -peer_oft_sendcb_init(PurpleXfer *xfer) -{ - PeerConnection *conn; - size_t size; - - conn = xfer->data; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - - /* Make sure the file size can be represented in 32 bits */ - size = purple_xfer_get_size(xfer); - if (size > G_MAXUINT32) - { - gchar *tmp, *size1, *size2; - size1 = purple_str_size_to_units(size); - size2 = purple_str_size_to_units(G_MAXUINT32); - tmp = g_strdup_printf(_("File %s is %s, which is larger than " - "the maximum size of %s."), - xfer->local_filename, size1, size2); - purple_xfer_error(purple_xfer_get_type(xfer), - purple_xfer_get_account(xfer), xfer->who, tmp); - g_free(size1); - g_free(size2); - g_free(tmp); - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - return; - } - - /* Keep track of file transfer info */ - conn->xferdata.totfiles = 1; - conn->xferdata.filesleft = 1; - conn->xferdata.totparts = 1; - conn->xferdata.partsleft = 1; - conn->xferdata.totsize = size; - conn->xferdata.size = size; - conn->xferdata.checksum = 0xffff0000; - conn->xferdata.rfrcsum = 0xffff0000; - conn->xferdata.rfcsum = 0xffff0000; - conn->xferdata.recvcsum = 0xffff0000; - strncpy((gchar *)conn->xferdata.idstring, "Cool FileXfer", 31); - conn->xferdata.modtime = 0; - conn->xferdata.cretime = 0; - xfer->filename = g_path_get_basename(xfer->local_filename); - conn->xferdata.name_length = MAX(64, strlen(xfer->filename) + 1); - conn->xferdata.name = (guchar *)g_strndup(xfer->filename, conn->xferdata.name_length - 1); - - peer_oft_checksum_file(conn, xfer, - peer_oft_checksum_calculated_cb, G_MAXUINT32); -} - -/* - * AIM file transfers aren't really meant to be thought - * of as a transferring just a single file. The rendezvous - * establishes a connection between two computers, and then - * those computers can use the same connection for transferring - * multiple files. So we don't want the Purple core up and closing - * the socket all willy-nilly. We want to do that in the oscar - * prpl, whenever one side or the other says they're finished - * using the connection. There might be a better way to intercept - * the socket from the core... - */ -void -peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size) -{ - PeerConnection *conn; - - conn = xfer->data; - - /* - * If we're done sending, intercept the socket from the core ft code - * and wait for the other guy to send the "done" OFT packet. - */ - if (purple_xfer_get_bytes_remaining(xfer) <= 0) - { - purple_input_remove(xfer->watcher); - conn->fd = xfer->fd; - xfer->fd = -1; - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_connection_recv_cb, conn); - } -} - -/*******************************************************************/ -/* End PurpleXfer callbacks for use when sending a file */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin PurpleXfer callbacks for use when sending and receiving */ -/*******************************************************************/ - -void -peer_oft_cb_generic_cancel(PurpleXfer *xfer) -{ - PeerConnection *conn; - - conn = xfer->data; - - if (conn == NULL) - return; - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); -} - -/*******************************************************************/ -/* End PurpleXfer callbacks for use when sending and receiving */ -/*******************************************************************/ - -#ifdef TODOFT -/* - * This little area in oscar.c is the nexus of file transfer code, - * so I wrote a little explanation of what happens. I am such a - * ninja. - * - * The series of events for a file send is: - * -Create xfer and call purple_xfer_request (this happens in oscar_ask_sendfile) - * -User chooses a file and oscar_xfer_init is called. It establishes a - * listening socket, then asks the remote user to connect to us (and - * gives them the file name, port, IP, etc.) - * -They connect to us and we send them an PEER_TYPE_PROMPT (this happens - * in peer_oft_recv_frame_established) - * -They send us an PEER_TYPE_ACK and then we start sending data - * -When we finish, they send us an PEER_TYPE_DONE and they close the - * connection. - * -We get drunk because file transfer kicks ass. - * - * The series of events for a file receive is: - * -Create xfer and call purple_xfer request (this happens in incomingim_chan2) - * -Purple user selects file to name and location to save file to and - * oscar_xfer_init is called - * -It connects to the remote user using the IP they gave us earlier - * -After connecting, they send us an PEER_TYPE_PROMPT. In reply, we send - * them an PEER_TYPE_ACK. - * -They begin to send us lots of raw data. - * -When they finish sending data we send an PEER_TYPE_DONE and then close - * the connection. - * - * Update August 2005: - * The series of events for transfers has been seriously complicated by the addition - * of transfer redirects and proxied connections. I could throw a whole lot of words - * at trying to explain things here, but it probably wouldn't do much good. To get - * a better idea of what happens, take a look at the diagrams and documentation - * from my Summer of Code project. -- Jonathan Clark - */ - -/** - * Convert the directory separator from / (0x2f) to ^A (0x01) - * - * @param name The filename to convert. - */ -static void -peer_oft_dirconvert_tostupid(char *name) -{ - while (name[0]) { - if (name[0] == 0x01) - name[0] = G_DIR_SEPARATOR; - name++; - } -} - -/** - * Convert the directory separator from ^A (0x01) to / (0x2f) - * - * @param name The filename to convert. - */ -static void -peer_oft_dirconvert_fromstupid(char *name) -{ - while (name[0]) { - if (name[0] == G_DIR_SEPARATOR) - name[0] = 0x01; - name++; - } -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,7243 +0,0 @@ -/* - * purple - * - * Some code copyright (C) 1998-1999, Mark Spencer - * Some code copyright (C) 1999-2001, Eric Warmenhoven - * Some code copyright (C) 2001-2003, Sean Egan - * Some code copyright (C) 2001-2007, Mark Doliner - * Some code copyright (C) 2005, Jonathan Clark - * Some code copyright (C) 2007, ComBOTS Product GmbH (htfv) - * Some code copyright (C) 2008, Aman Gupta - * - * Most libfaim code copyright (C) 1998-2001 Adam Fritzler - * Some libfaim code copyright (C) 2001-2004 Mark Doliner - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "buddyicon.h" -#include "cipher.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "imgstore.h" -#include "network.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "util.h" -#include "version.h" - -#include "oscarcommon.h" -#include "oscar.h" -#include "peer.h" - -#define OSCAR_STATUS_ID_INVISIBLE "invisible" -#define OSCAR_STATUS_ID_OFFLINE "offline" -#define OSCAR_STATUS_ID_AVAILABLE "available" -#define OSCAR_STATUS_ID_AWAY "away" -#define OSCAR_STATUS_ID_DND "dnd" -#define OSCAR_STATUS_ID_NA "na" -#define OSCAR_STATUS_ID_OCCUPIED "occupied" -#define OSCAR_STATUS_ID_FREE4CHAT "free4chat" -#define OSCAR_STATUS_ID_CUSTOM "custom" -#define OSCAR_STATUS_ID_MOBILE "mobile" - -#define AIMHASHDATA "http://pidgin.im/aim_data.php3" - -#define OSCAR_CONNECT_STEPS 6 - -static OscarCapability purple_caps = (OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | - OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | - OSCAR_CAPABILITY_SHORTCAPS | OSCAR_CAPABILITY_TYPING); - -static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02}; -static guint8 features_icq[] = {0x01, 0x06}; -static guint8 features_icq_offline[] = {0x01}; -static guint8 ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -struct create_room { - char *name; - int exchange; -}; - -struct oscar_ask_directim_data -{ - OscarData *od; - char *who; -}; - -/* - * Various PRPL-specific buddy info that we want to keep track of - * Some other info is maintained by locate.c, and I'd like to move - * the rest of this to libfaim, mostly im.c - * - * TODO: More of this should use the status API. - */ -struct buddyinfo { - gboolean typingnot; - guint32 ipaddr; - - unsigned long ico_me_len; - unsigned long ico_me_csum; - time_t ico_me_time; - gboolean ico_informed; - - unsigned long ico_len; - unsigned long ico_csum; - time_t ico_time; - gboolean ico_need; - gboolean ico_sent; -}; - -struct name_data { - PurpleConnection *gc; - gchar *name; - gchar *nick; -}; - -static const char * const msgerrreason[] = { - N_("Invalid error"), - N_("Invalid SNAC"), - N_("Rate to host"), - N_("Rate to client"), - N_("Not logged in"), - N_("Service unavailable"), - N_("Service not defined"), - N_("Obsolete SNAC"), - N_("Not supported by host"), - N_("Not supported by client"), - N_("Refused by client"), - N_("Reply too big"), - N_("Responses lost"), - N_("Request denied"), - N_("Busted SNAC payload"), - N_("Insufficient rights"), - N_("In local permit/deny"), - N_("Warning level too high (sender)"), - N_("Warning level too high (receiver)"), - N_("User temporarily unavailable"), - N_("No match"), - N_("List overflow"), - N_("Request ambiguous"), - N_("Queue full"), - N_("Not while on AOL") -}; -static const int msgerrreasonlen = G_N_ELEMENTS(msgerrreason); - -static const char * const errcodereason[] = { - N_("Invalid error"), - N_("Not logged in"), - N_("Cannot receive IM due to parental controls"), - N_("Cannot send SMS without accepting terms"), - N_("Cannot send SMS"), /* SMS_WITHOUT_DISCLAIMER is weird */ - N_("Cannot send SMS to this country"), - N_("Unknown error"), /* Undocumented */ - N_("Unknown error"), /* Undocumented */ - N_("Cannot send SMS to unknown country"), - N_("Bot accounts cannot initiate IMs"), - N_("Bot account cannot IM this user"), - N_("Bot account reached IM limit"), - N_("Bot account reached daily IM limit"), - N_("Bot account reached monthly IM limit"), - N_("Unable to receive offline messages"), - N_("Offline message store full") -}; -static const int errcodereasonlen = G_N_ELEMENTS(errcodereason); - -/* All the libfaim->purple callback functions */ - -/* Only used when connecting with the old-style BUCP login */ -static int purple_parse_auth_resp (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_login (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_auth_securid_request(OscarData *, FlapConnection *, FlapFrame *, ...); - -static int purple_handle_redirect (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_info_change (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_account_confirm (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_oncoming (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_offgoing (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_incoming_im(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_misses (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_clientauto (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_userinfo (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_motd (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_chatnav_info (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_join (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_leave (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_info_update (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_conv_chat_incoming_msg(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_email_parseupdate(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_icon_parseicon (OscarData *, FlapConnection *, FlapFrame *, ...); -static int oscar_icon_req (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_msgack (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_evilnotify (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_searcherror(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_searchreply(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_bosrights (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_connerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_msgerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_mtn (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_locaterights(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_buddyrights(OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_locerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_parse_genericerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_memrequest (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_selfinfo (OscarData *, FlapConnection *, FlapFrame *, ...); -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -static int purple_offlinemsg (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_offlinemsgdone (OscarData *, FlapConnection *, FlapFrame *, ...); -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ -static int purple_icqalias (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_icqinfo (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_popup (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parseerr (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parserights (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parselist (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parseack (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_parseaddmod (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_authgiven (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_authrequest (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_authreply (OscarData *, FlapConnection *, FlapFrame *, ...); -static int purple_ssi_gotadded (OscarData *, FlapConnection *, FlapFrame *, ...); - -static void purple_icons_fetch(PurpleConnection *gc); - -void oscar_set_info(PurpleConnection *gc, const char *info); -static void oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, gboolean setstatus, PurpleStatus *status); -static void oscar_set_extendedstatus(PurpleConnection *gc); -static gboolean purple_ssi_rerequestdata(gpointer data); - -static void oscar_free_name_data(struct name_data *data) { - g_free(data->name); - g_free(data->nick); - g_free(data); -} - -#ifdef _WIN32 -const char *oscar_get_locale_charset(void) { - static const char *charset = NULL; - if (charset == NULL) - g_get_charset(&charset); - return charset; -} -#endif - -/** - * Determine how we can send this message. Per the warnings elsewhere - * in this file, these little checks determine the simplest encoding - * we can use for a given message send using it. - */ -static guint32 -oscar_charset_check(const char *utf8) -{ - int i = 0; - int charset = AIM_CHARSET_ASCII; - - /* - * Can we get away with using our custom encoding? - */ - while (utf8[i]) - { - if ((unsigned char)utf8[i] > 0x7f) { - /* not ASCII! */ - charset = AIM_CHARSET_LATIN_1; - break; - } - i++; - } - - /* - * Must we send this message as UNICODE (in the UTF-16BE encoding)? - */ - while (utf8[i]) - { - /* ISO-8859-1 is 0x00-0xbf in the first byte - * followed by 0xc0-0xc3 in the second */ - if ((unsigned char)utf8[i] < 0x80) { - i++; - continue; - } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && - ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { - i += 2; - continue; - } - charset = AIM_CHARSET_UNICODE; - break; - } - - return charset; -} - -/** - * Take a string of the form charset="bleh" where bleh is - * one of us-ascii, utf-8, iso-8859-1, or unicode-2-0, and - * return a newly allocated string containing bleh. - */ -gchar * -oscar_encoding_extract(const char *encoding) -{ - gchar *ret = NULL; - char *begin, *end; - - g_return_val_if_fail(encoding != NULL, NULL); - - /* Make sure encoding begins with charset= */ - if (strncmp(encoding, "text/aolrtf; charset=", 21) && - strncmp(encoding, "text/x-aolrtf; charset=", 23) && - strncmp(encoding, "text/plain; charset=", 20)) - { - return NULL; - } - - begin = strchr(encoding, '"'); - end = strrchr(encoding, '"'); - - if ((begin == NULL) || (end == NULL) || (begin >= end)) - return NULL; - - ret = g_strndup(begin+1, (end-1) - begin); - - return ret; -} - -gchar * -oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen) -{ - gchar *utf8 = NULL; - - if ((encoding == NULL) || encoding[0] == '\0') { - purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n"); - } else if (!g_ascii_strcasecmp(encoding, "iso-8859-1")) { - utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL); - } else if (!g_ascii_strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") || - !g_ascii_strcasecmp(encoding, "us-ascii")) - { - utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL); - } else if (!g_ascii_strcasecmp(encoding, "unicode-2-0")) { - /* Some official ICQ clients are apparently total crack, - * and have been known to save a UTF-8 string converted - * from the locale character set to UTF-16 (not from UTF-8 - * to UTF-16!) in the away message. This hack should find - * and do something (un)reasonable with that, and not - * mess up too much else. */ - const gchar *charset = purple_account_get_string(account, "encoding", NULL); - if (charset) { - gsize len; - utf8 = g_convert(text, textlen, charset, "UTF-16BE", &len, NULL, NULL); - if (!utf8 || len != textlen || !g_utf8_validate(utf8, -1, NULL)) { - g_free(utf8); - utf8 = NULL; - } else { - purple_debug_info("oscar", "Used broken ICQ fallback encoding\n"); - } - } - if (!utf8) - utf8 = g_convert(text, textlen, "UTF-8", "UTF-16BE", NULL, NULL, NULL); - } else if (g_ascii_strcasecmp(encoding, "utf-8")) { - purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", " - "attempting to convert to UTF-8 anyway\n", encoding); - utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); - } - - /* - * If utf8 is still NULL then either the encoding is utf-8 or - * we have been unable to convert the text to utf-8 from the encoding - * that was specified. So we check if the text is valid utf-8 then - * just copy it. - */ - if (utf8 == NULL) { - if (textlen != 0 && *text != '\0' - && !g_utf8_validate(text, textlen, NULL)) - utf8 = g_strdup(_("(There was an error receiving this message. The buddy you are speaking with is probably using a different encoding than expected. If you know what encoding he is using, you can specify it in the advanced account options for your AIM/ICQ account.)")); - else - utf8 = g_strndup(text, textlen); - } - - return utf8; -} - -static gchar * -oscar_utf8_try_convert(PurpleAccount *account, OscarData *od, const gchar *msg) -{ - const char *charset = NULL; - char *ret = NULL; - - if (od->icq) - charset = purple_account_get_string(account, "encoding", NULL); - - if(charset && *charset) - ret = g_convert(msg, -1, "UTF-8", charset, NULL, NULL, NULL); - - if(!ret) - ret = purple_utf8_try_convert(msg); - - return ret; -} - -static gchar * -purple_plugin_oscar_convert_to_utf8(const gchar *data, gsize datalen, const char *charsetstr, gboolean fallback) -{ - gchar *ret = NULL; - GError *err = NULL; - - if ((charsetstr == NULL) || (*charsetstr == '\0')) - return NULL; - - if (g_ascii_strcasecmp("UTF-8", charsetstr)) { - if (fallback) - ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err); - else - ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err); - if (err != NULL) { - purple_debug_warning("oscar", "Conversion from %s failed: %s.\n", - charsetstr, err->message); - g_error_free(err); - } - } else { - if (g_utf8_validate(data, datalen, NULL)) - ret = g_strndup(data, datalen); - else - purple_debug_warning("oscar", "String is not valid UTF-8.\n"); - } - - return ret; -} - -/** - * This attemps to decode an incoming IM into a UTF8 string. - * - * We try decoding using two different character sets. The charset - * specified in the IM determines the order in which we attempt to - * decode. We do this because there are lots of broken ICQ clients - * that don't correctly send non-ASCII messages. And if Purple isn't - * able to deal with that crap, then people complain like banshees. - * charsetstr1 is always set to what the correct encoding should be. - */ -gchar * -purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcebn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen) -{ - gchar *ret = NULL; - const gchar *charsetstr1, *charsetstr2, *charsetstr3 = NULL; - - if ((datalen == 0) || (data == NULL)) - return NULL; - - if (charset == AIM_CHARSET_UNICODE) { - charsetstr1 = "UTF-16BE"; - charsetstr2 = "UTF-8"; - } else if (charset == AIM_CHARSET_LATIN_1) { - if ((sourcebn != NULL) && oscar_util_valid_name_icq(sourcebn)) - charsetstr1 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - else - charsetstr1 = "ISO-8859-1"; - charsetstr2 = "UTF-8"; - } else if (charset == AIM_CHARSET_ASCII) { - /* Should just be "ASCII" */ - charsetstr1 = "ASCII"; - charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - } else if (charset == 0x000d) { - /* iChat sending unicode over a Direct IM connection = UTF-8 */ - /* Mobile AIM client on multiple devices (including Blackberry Tour, Nokia 3100, and LG VX6000) = ISO-8859-1 */ - charsetstr1 = "UTF-8"; - charsetstr2 = "ISO-8859-1"; - charsetstr3 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - } else { - /* Unknown, hope for valid UTF-8... */ - charsetstr1 = "UTF-8"; - charsetstr2 = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - } - - purple_debug_info("oscar", "Parsing IM part, charset=0x%04hx, charsubset=0x%04hx, datalen=%" G_GSIZE_FORMAT ", choice1=%s, choice2=%s, choice3=%s\n", - charset, charsubset, datalen, charsetstr1, charsetstr2, (charsetstr3 ? charsetstr3 : "")); - - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr1, FALSE); - if (ret == NULL) { - if (charsetstr3 != NULL) { - /* Try charsetstr2 without allowing substitutions, then fall through to charsetstr3 if needed */ - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, FALSE); - if (ret == NULL) - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr3, TRUE); - } else { - /* Try charsetstr2, allowing substitutions */ - ret = purple_plugin_oscar_convert_to_utf8(data, datalen, charsetstr2, TRUE); - } - } - if (ret == NULL) { - char *str, *salvage, *tmp; - - str = g_malloc(datalen + 1); - strncpy(str, data, datalen); - str[datalen] = '\0'; - salvage = purple_utf8_salvage(str); - tmp = g_strdup_printf(_("(There was an error receiving this message. Either you and %s have different encodings selected, or %s has a buggy client.)"), - sourcebn, sourcebn); - ret = g_strdup_printf("%s %s", salvage, tmp); - g_free(tmp); - g_free(str); - g_free(salvage); - } - - return ret; -} - -/** - * Figure out what encoding to use when sending a given outgoing message. - */ -static void -purple_plugin_oscar_convert_to_best_encoding(PurpleConnection *gc, - const char *destbn, const gchar *from, - gchar **msg, int *msglen_int, - guint16 *charset, guint16 *charsubset) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleAccount *account = purple_connection_get_account(gc); - GError *err = NULL; - aim_userinfo_t *userinfo = NULL; - const gchar *charsetstr; - gsize msglen; - - /* Attempt to send as ASCII */ - if (oscar_charset_check(from) == AIM_CHARSET_ASCII) { - *msg = g_convert(from, -1, "ASCII", "UTF-8", NULL, &msglen, NULL); - *charset = AIM_CHARSET_ASCII; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - /* - * If we're sending to an ICQ user, and they are in our - * buddy list, and they are advertising the Unicode - * capability, and they are online, then attempt to send - * as UTF-16BE. - */ - if ((destbn != NULL) && oscar_util_valid_name_icq(destbn)) - userinfo = aim_locate_finduserinfo(od, destbn); - - if ((userinfo != NULL) && (userinfo->capabilities & OSCAR_CAPABILITY_UNICODE)) - { - PurpleBuddy *b; - b = purple_find_buddy(account, destbn); - if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b))) - { - *msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, &err); - if (*msg != NULL) - { - *charset = AIM_CHARSET_UNICODE; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - purple_debug_error("oscar", "Conversion from UTF-8 to UTF-16BE failed: %s.\n", - err->message); - g_error_free(err); - err = NULL; - } - } - - /* - * If this is AIM then attempt to send as ISO-8859-1. If this is - * ICQ then attempt to send as the user specified character encoding. - */ - charsetstr = "ISO-8859-1"; - if ((destbn != NULL) && oscar_util_valid_name_icq(destbn)) - charsetstr = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING); - - /* - * XXX - We need a way to only attempt to convert if we KNOW "from" - * can be converted to "charsetstr" - */ - *msg = g_convert(from, -1, charsetstr, "UTF-8", NULL, &msglen, &err); - if (*msg != NULL) { - *charset = AIM_CHARSET_LATIN_1; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - purple_debug_info("oscar", "Conversion from UTF-8 to %s failed (%s). Falling back to unicode.\n", - charsetstr, err->message); - g_error_free(err); - err = NULL; - - /* - * Nothing else worked, so send as UTF-16BE. - */ - *msg = g_convert(from, -1, "UTF-16BE", "UTF-8", NULL, &msglen, &err); - if (*msg != NULL) { - *charset = AIM_CHARSET_UNICODE; - *charsubset = 0x0000; - *msglen_int = msglen; - return; - } - - purple_debug_error("oscar", "Error converting a Unicode message: %s\n", err->message); - g_error_free(err); - err = NULL; - - purple_debug_error("oscar", "This should NEVER happen! Sending UTF-8 text flagged as ASCII.\n"); - *msg = g_strdup(from); - *msglen_int = strlen(*msg); - *charset = AIM_CHARSET_ASCII; - *charsubset = 0x0000; - return; -} - -/** - * Looks for %n, %d, or %t in a string, and replaces them with the - * specified name, date, and time, respectively. - * - * @param str The string that may contain the special variables. - * @param name The sender name. - * - * @return A newly allocated string where the special variables are - * expanded. This should be g_free'd by the caller. - */ -static gchar * -purple_str_sub_away_formatters(const char *str, const char *name) -{ - char *c; - GString *cpy; - time_t t; - struct tm *tme; - - g_return_val_if_fail(str != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - /* Create an empty GString that is hopefully big enough for most messages */ - cpy = g_string_sized_new(1024); - - t = time(NULL); - tme = localtime(&t); - - c = (char *)str; - while (*c) { - switch (*c) { - case '%': - if (*(c + 1)) { - switch (*(c + 1)) { - case 'n': - /* append name */ - g_string_append(cpy, name); - c++; - break; - case 'd': - /* append date */ - g_string_append(cpy, purple_date_format_short(tme)); - c++; - break; - case 't': - /* append time */ - g_string_append(cpy, purple_time_format(tme)); - c++; - break; - default: - g_string_append_c(cpy, *c); - } - } else { - g_string_append_c(cpy, *c); - } - break; - default: - g_string_append_c(cpy, *c); - } - c++; - } - - return g_string_free(cpy, FALSE); -} - -static gchar *oscar_caps_to_string(OscarCapability caps) -{ - GString *str; - const gchar *tmp; - guint bit = 1; - - str = g_string_new(""); - - if (!caps) { - return NULL; - } else while (bit <= OSCAR_CAPABILITY_LAST) { - if (bit & caps) { - switch (bit) { - case OSCAR_CAPABILITY_BUDDYICON: - tmp = _("Buddy Icon"); - break; - case OSCAR_CAPABILITY_TALK: - tmp = _("Voice"); - break; - case OSCAR_CAPABILITY_DIRECTIM: - tmp = _("AIM Direct IM"); - break; - case OSCAR_CAPABILITY_CHAT: - tmp = _("Chat"); - break; - case OSCAR_CAPABILITY_GETFILE: - tmp = _("Get File"); - break; - case OSCAR_CAPABILITY_SENDFILE: - tmp = _("Send File"); - break; - case OSCAR_CAPABILITY_GAMES: - case OSCAR_CAPABILITY_GAMES2: - tmp = _("Games"); - break; - case OSCAR_CAPABILITY_ADDINS: - tmp = _("Add-Ins"); - break; - case OSCAR_CAPABILITY_SENDBUDDYLIST: - tmp = _("Send Buddy List"); - break; - case OSCAR_CAPABILITY_ICQ_DIRECT: - tmp = _("ICQ Direct Connect"); - break; - case OSCAR_CAPABILITY_APINFO: - tmp = _("AP User"); - break; - case OSCAR_CAPABILITY_ICQRTF: - tmp = _("ICQ RTF"); - break; - case OSCAR_CAPABILITY_EMPTY: - tmp = _("Nihilist"); - break; - case OSCAR_CAPABILITY_ICQSERVERRELAY: - tmp = _("ICQ Server Relay"); - break; - case OSCAR_CAPABILITY_UNICODEOLD: - tmp = _("Old ICQ UTF8"); - break; - case OSCAR_CAPABILITY_TRILLIANCRYPT: - tmp = _("Trillian Encryption"); - break; - case OSCAR_CAPABILITY_UNICODE: - tmp = _("ICQ UTF8"); - break; - case OSCAR_CAPABILITY_HIPTOP: - tmp = _("Hiptop"); - break; - case OSCAR_CAPABILITY_SECUREIM: - tmp = _("Security Enabled"); - break; - case OSCAR_CAPABILITY_VIDEO: - tmp = _("Video Chat"); - break; - /* Not actually sure about this one... WinAIM doesn't show anything */ - case OSCAR_CAPABILITY_ICHATAV: - tmp = _("iChat AV"); - break; - case OSCAR_CAPABILITY_LIVEVIDEO: - tmp = _("Live Video"); - break; - case OSCAR_CAPABILITY_CAMERA: - tmp = _("Camera"); - break; - case OSCAR_CAPABILITY_ICHAT_SCREENSHARE: - tmp = _("Screen Sharing"); - break; - default: - tmp = NULL; - break; - } - if (tmp) - g_string_append_printf(str, "%s%s", (*(str->str) == '\0' ? "" : ", "), tmp); - } - bit <<= 1; - } - - return g_string_free(str, FALSE); -} - -static char *oscar_icqstatus(int state) { - /* Make a cute little string that shows the status of the dude or dudet */ - if (state & AIM_ICQ_STATE_CHAT) - return g_strdup(_("Free For Chat")); - else if (state & AIM_ICQ_STATE_DND) - return g_strdup(_("Do Not Disturb")); - else if (state & AIM_ICQ_STATE_OUT) - return g_strdup(_("Not Available")); - else if (state & AIM_ICQ_STATE_BUSY) - return g_strdup(_("Occupied")); - else if (state & AIM_ICQ_STATE_AWAY) - return g_strdup(_("Away")); - else if (state & AIM_ICQ_STATE_WEBAWARE) - return g_strdup(_("Web Aware")); - else if (state & AIM_ICQ_STATE_INVISIBLE) - return g_strdup(_("Invisible")); - else - return g_strdup(_("Online")); -} - -static void -oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value) -{ - if (value && value[0]) { - purple_notify_user_info_add_pair(user_info, name, value); - } -} - -static void -oscar_user_info_convert_and_add_pair(PurpleAccount *account, OscarData *od, PurpleNotifyUserInfo *user_info, - const char *name, const char *value) -{ - gchar *utf8; - - if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, od, value))) { - purple_notify_user_info_add_pair(user_info, name, utf8); - g_free(utf8); - } -} - -static void -oscar_user_info_convert_and_add(PurpleAccount *account, OscarData *od, PurpleNotifyUserInfo *user_info, - const char *name, const char *value) -{ - gchar *utf8; - - if (value && value[0] && (utf8 = oscar_utf8_try_convert(account, od, value))) { - purple_notify_user_info_add_pair(user_info, name, utf8); - g_free(utf8); - } -} - -/** - * @brief Append the status information to a user_info struct - * - * The returned information is HTML-ready, appropriately escaped, as all information in a user_info struct should be HTML. - * - * @param gc The PurpleConnection - * @param user_info A PurpleNotifyUserInfo object to which status information will be added - * @param b The PurpleBuddy whose status is desired. This or the aim_userinfo_t (or both) must be passed to oscar_user_info_append_status(). - * @param userinfo The aim_userinfo_t of the buddy whose status is desired. This or the PurpleBuddy (or both) must be passed to oscar_user_info_append_status(). - * @param strip_html_tags If strip_html_tags is TRUE, tags embedded in the status message will be stripped, returning a non-formatted string. The string will still be HTML escaped. - */ -static void oscar_user_info_append_status(PurpleConnection *gc, PurpleNotifyUserInfo *user_info, PurpleBuddy *b, aim_userinfo_t *userinfo, gboolean strip_html_tags) -{ - PurpleAccount *account = purple_connection_get_account(gc); - OscarData *od; - PurplePresence *presence = NULL; - PurpleStatus *status = NULL; - gchar *message = NULL, *itmsurl = NULL, *tmp; - gboolean is_away; - - od = purple_connection_get_protocol_data(gc); - - if (b == NULL && userinfo == NULL) - return; - - if (b == NULL) - b = purple_find_buddy(purple_connection_get_account(gc), userinfo->bn); - else - userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); - - if (b) { - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - } - - /* If we have both b and userinfo we favor userinfo, because if we're - viewing someone's profile then we want the HTML away message, and - the "message" attribute of the status contains only the plaintext - message. */ - if (userinfo) { - if ((userinfo->flags & AIM_FLAG_AWAY) - && userinfo->away_len > 0 - && userinfo->away != NULL - && userinfo->away_encoding != NULL) - { - /* Away message */ - tmp = oscar_encoding_extract(userinfo->away_encoding); - message = oscar_encoding_to_utf8(account, - tmp, userinfo->away, userinfo->away_len); - g_free(tmp); - } else { - /* - * Available message or non-HTML away message (because that's - * all we have right now. - */ - if ((userinfo->status != NULL) && userinfo->status[0] != '\0') { - message = oscar_encoding_to_utf8(account, - userinfo->status_encoding, userinfo->status, - userinfo->status_len); - } -#if defined (_WIN32) || defined (__APPLE__) - if (userinfo->itmsurl && (userinfo->itmsurl[0] != '\0')) - itmsurl = oscar_encoding_to_utf8(account, userinfo->itmsurl_encoding, - userinfo->itmsurl, userinfo->itmsurl_len); -#endif - } - } else { - message = g_strdup(purple_status_get_attr_string(status, "message")); - itmsurl = g_strdup(purple_status_get_attr_string(status, "itmsurl")); - } - - is_away = ((status && !purple_status_is_available(status)) || - (userinfo && (userinfo->flags & AIM_FLAG_AWAY))); - - if (strip_html_tags) { - /* Away messages are HTML, but available messages were originally plain text. - * We therefore need to strip away messages but not available messages if we're asked to remove HTML tags. - */ - /* - * It seems like the above comment no longer applies. All messages need - * to be escaped. - */ - if (message) { - gchar *tmp2; - tmp = purple_markup_strip_html(message); - g_free(message); - tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - message = tmp2; - } - - } else { - if (itmsurl) { - tmp = g_strdup_printf("%s", - itmsurl, message); - g_free(message); - message = tmp; - } - } - g_free(itmsurl); - - if (message) { - tmp = purple_str_sub_away_formatters(message, purple_account_get_username(account)); - g_free(message); - message = tmp; - } - - if (b) { - if (purple_presence_is_online(presence)) { - if (oscar_util_valid_name_icq(purple_buddy_get_name(b)) || is_away || !message || !(*message)) { - /* Append the status name for online ICQ statuses, away AIM statuses, and for all buddies with no message. - * If the status name and the message are the same, only show one. */ - const char *status_name = purple_status_get_name(status); - if (status_name && message && !strcmp(status_name, message)) - status_name = NULL; - - tmp = g_strdup_printf("%s%s%s", - status_name ? status_name : "", - ((status_name && message) && *message) ? ": " : "", - (message && *message) ? message : ""); - g_free(message); - message = tmp; - } - - } else if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, purple_buddy_get_name(b)), - purple_buddy_get_name(b))) - { - /* Note if an offline buddy is not authorized */ - tmp = g_strdup_printf("%s%s%s", - _("Not Authorized"), - (message && *message) ? ": " : "", - (message && *message) ? message : ""); - g_free(message); - message = tmp; - } else { - g_free(message); - message = g_strdup(_("Offline")); - } - } - - purple_notify_user_info_add_pair(user_info, _("Status"), message); - g_free(message); -} - -static void oscar_user_info_append_extra_info(PurpleConnection *gc, PurpleNotifyUserInfo *user_info, PurpleBuddy *b, aim_userinfo_t *userinfo) -{ - OscarData *od; - PurpleAccount *account; - PurplePresence *presence = NULL; - PurpleStatus *status = NULL; - PurpleGroup *g = NULL; - struct buddyinfo *bi = NULL; - char *tmp; - const char *bname = NULL, *gname = NULL; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - if ((user_info == NULL) || ((b == NULL) && (userinfo == NULL))) - return; - - if (userinfo == NULL) - userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); - - if (b == NULL) - b = purple_find_buddy(account, userinfo->bn); - - if (b != NULL) { - bname = purple_buddy_get_name(b); - g = purple_buddy_get_group(b); - gname = purple_group_get_name(g); - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - } - - if (userinfo != NULL) - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->bn)); - - if ((bi != NULL) && (bi->ipaddr != 0)) { - tmp = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", - (bi->ipaddr & 0xff000000) >> 24, - (bi->ipaddr & 0x00ff0000) >> 16, - (bi->ipaddr & 0x0000ff00) >> 8, - (bi->ipaddr & 0x000000ff)); - oscar_user_info_add_pair(user_info, _("IP Address"), tmp); - g_free(tmp); - } - - if ((userinfo != NULL) && (userinfo->warnlevel != 0)) { - tmp = g_strdup_printf("%d", (int)(userinfo->warnlevel/10.0 + .5)); - oscar_user_info_add_pair(user_info, _("Warning Level"), tmp); - g_free(tmp); - } - - if ((b != NULL) && (bname != NULL) && (g != NULL) && (gname != NULL)) { - tmp = aim_ssi_getcomment(od->ssi.local, gname, bname); - if (tmp != NULL) { - char *tmp2 = g_markup_escape_text(tmp, strlen(tmp)); - g_free(tmp); - - oscar_user_info_convert_and_add_pair(account, od, user_info, _("Buddy Comment"), tmp2); - g_free(tmp2); - } - } -} - -static char *extract_name(const char *name) { - char *tmp, *x; - int i, j; - - if (!name) - return NULL; - - x = strchr(name, '-'); - if (!x) - return NULL; - - x = strchr(x + 1, '-'); - if (!x) - return NULL; - - tmp = g_strdup(++x); - - for (i = 0, j = 0; x[i]; i++) { - char hex[3]; - if (x[i] != '%') { - tmp[j++] = x[i]; - continue; - } - strncpy(hex, x + ++i, 2); - hex[2] = 0; - i++; - tmp[j++] = strtol(hex, NULL, 16); - } - - tmp[j] = 0; - return tmp; -} - -static struct chat_connection * -find_oscar_chat(PurpleConnection *gc, int id) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - GSList *cur; - struct chat_connection *cc; - - for (cur = od->oscar_chats; cur != NULL; cur = cur->next) - { - cc = (struct chat_connection *)cur->data; - if (cc->id == id) - return cc; - } - - return NULL; -} - -static struct chat_connection * -find_oscar_chat_by_conn(PurpleConnection *gc, FlapConnection *conn) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - GSList *cur; - struct chat_connection *cc; - - for (cur = od->oscar_chats; cur != NULL; cur = cur->next) - { - cc = (struct chat_connection *)cur->data; - if (cc->conn == conn) - return cc; - } - - return NULL; -} - -static struct chat_connection * -find_oscar_chat_by_conv(PurpleConnection *gc, PurpleConversation *conv) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - GSList *cur; - struct chat_connection *cc; - - for (cur = od->oscar_chats; cur != NULL; cur = cur->next) - { - cc = (struct chat_connection *)cur->data; - if (cc->conv == conv) - return cc; - } - - return NULL; -} - -void -oscar_chat_destroy(struct chat_connection *cc) -{ - g_free(cc->name); - g_free(cc->show); - g_free(cc); -} - -static void -oscar_chat_kill(PurpleConnection *gc, struct chat_connection *cc) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - /* Notify the conversation window that we've left the chat */ - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(cc->conv))); - - /* Destroy the chat_connection */ - od->oscar_chats = g_slist_remove(od->oscar_chats, cc); - flap_connection_schedule_destroy(cc->conn, OSCAR_DISCONNECT_DONE, NULL); - oscar_chat_destroy(cc); -} - -/** - * This is called from the callback functions for establishing - * a TCP connection with an oscar host if an error occurred. - */ -static void -connection_common_error_cb(FlapConnection *conn, const gchar *error_message) -{ - OscarData *od; - PurpleConnection *gc; - - od = conn->od; - gc = od->gc; - - purple_debug_error("oscar", "unable to connect to FLAP " - "server of type 0x%04hx\n", conn->type); - - if (conn->type == SNAC_FAMILY_AUTH) - { - /* This only happens when connecting with the old-style BUCP login */ - gchar *msg; - msg = g_strdup_printf(_("Unable to connect to authentication server: %s"), - error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - } - else if (conn->type == SNAC_FAMILY_LOCATE) - { - gchar *msg; - msg = g_strdup_printf(_("Unable to connect to BOS server: %s"), - error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, msg); - g_free(msg); - } - else - { - /* Maybe we should call this for BOS connections, too? */ - flap_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_COULD_NOT_CONNECT, error_message); - } -} - -/** - * This is called from the callback functions for establishing - * a TCP connection with an oscar host. Depending on the type - * of host, we do a few different things here. - */ -static void -connection_common_established_cb(FlapConnection *conn) -{ - OscarData *od; - PurpleConnection *gc; - PurpleAccount *account; - - od = conn->od; - gc = od->gc; - account = purple_connection_get_account(gc); - - purple_debug_info("oscar", "connected to FLAP server of type 0x%04hx\n", - conn->type); - - if (conn->cookie == NULL) - flap_connection_send_version(od, conn); - else - { - if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN)) - { - ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; - ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; - flap_connection_send_version_with_cookie_and_clientinfo(od, - conn, conn->cookielen, conn->cookie, - od->icq ? &icqinfo : &aiminfo, - purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); - } else { - flap_connection_send_version_with_cookie(od, conn, - conn->cookielen, conn->cookie); - } - - - g_free(conn->cookie); - conn->cookie = NULL; - } - - if (conn->type == SNAC_FAMILY_AUTH) - { - /* This only happens when connecting with the old-style BUCP login */ - aim_request_login(od, conn, purple_account_get_username(account)); - purple_debug_info("oscar", "Username sent, waiting for response\n"); - purple_connection_update_progress(gc, _("Username sent"), 1, OSCAR_CONNECT_STEPS); - ck[1] = 0x65; - } - else if (conn->type == SNAC_FAMILY_LOCATE) - { - purple_connection_update_progress(gc, _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); - ck[4] = 0x61; - } - else if (conn->type == SNAC_FAMILY_CHAT) - { - od->oscar_chats = g_slist_prepend(od->oscar_chats, conn->new_conn_data); - conn->new_conn_data = NULL; - } -} - -static void -connection_established_cb(gpointer data, gint source, const gchar *error_message) -{ - FlapConnection *conn; - - conn = data; - - conn->connect_data = NULL; - conn->fd = source; - - if (source < 0) - { - connection_common_error_cb(conn, error_message); - return; - } - - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, flap_connection_recv_cb, conn); - connection_common_established_cb(conn); -} - -static void -ssl_connection_established_cb(gpointer data, PurpleSslConnection *gsc, - PurpleInputCondition cond) -{ - FlapConnection *conn; - - conn = data; - - purple_ssl_input_add(gsc, flap_connection_recv_cb_ssl, conn); - connection_common_established_cb(conn); -} - -static void -ssl_connection_error_cb(PurpleSslConnection *gsc, PurpleSslErrorType error, - gpointer data) -{ - FlapConnection *conn; - - conn = data; - - if (conn->watcher_outgoing) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - } - - /* sslconn frees the connection on error */ - conn->gsc = NULL; - - connection_common_error_cb(conn, purple_ssl_strerror(error)); -} - -static void -flap_connection_established_bos(OscarData *od, FlapConnection *conn) -{ - PurpleConnection *gc = od->gc; - - aim_srv_reqpersonalinfo(od, conn); - - purple_debug_info("oscar", "ssi: requesting rights and list\n"); - aim_ssi_reqrights(od); - aim_ssi_reqdata(od); - if (od->getblisttimer > 0) - purple_timeout_remove(od->getblisttimer); - od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od); - - aim_locate_reqrights(od); - aim_buddylist_reqrights(od, conn); - aim_im_reqparams(od); - aim_bos_reqrights(od, conn); /* TODO: Don't call this with ssi */ - - purple_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); -} - -static void -flap_connection_established_admin(OscarData *od, FlapConnection *conn) -{ - aim_srv_clientready(od, conn); - purple_debug_info("oscar", "connected to admin\n"); - - if (od->chpass) { - purple_debug_info("oscar", "changing password\n"); - aim_admin_changepasswd(od, conn, od->newp, od->oldp); - g_free(od->oldp); - od->oldp = NULL; - g_free(od->newp); - od->newp = NULL; - od->chpass = FALSE; - } - if (od->setnick) { - purple_debug_info("oscar", "formatting username\n"); - aim_admin_setnick(od, conn, od->newformatting); - g_free(od->newformatting); - od->newformatting = NULL; - od->setnick = FALSE; - } - if (od->conf) { - purple_debug_info("oscar", "confirming account\n"); - aim_admin_reqconfirm(od, conn); - od->conf = FALSE; - } - if (od->reqemail) { - purple_debug_info("oscar", "requesting email address\n"); - aim_admin_getinfo(od, conn, 0x0011); - od->reqemail = FALSE; - } - if (od->setemail) { - purple_debug_info("oscar", "setting email address\n"); - aim_admin_setemail(od, conn, od->email); - g_free(od->email); - od->email = NULL; - od->setemail = FALSE; - } -} - -static void -flap_connection_established_chat(OscarData *od, FlapConnection *conn) -{ - PurpleConnection *gc = od->gc; - struct chat_connection *chatcon; - static int id = 1; - - aim_srv_clientready(od, conn); - - chatcon = find_oscar_chat_by_conn(gc, conn); - if (chatcon) { - chatcon->id = id; - chatcon->conv = serv_got_joined_chat(gc, id++, chatcon->show); - } -} - -static void -flap_connection_established_chatnav(OscarData *od, FlapConnection *conn) -{ - aim_srv_clientready(od, conn); - aim_chatnav_reqrights(od, conn); -} - -static void -flap_connection_established_alert(OscarData *od, FlapConnection *conn) -{ - aim_email_sendcookies(od); - aim_email_activate(od); - aim_srv_clientready(od, conn); -} - -static void -flap_connection_established_bart(OscarData *od, FlapConnection *conn) -{ - PurpleConnection *gc = od->gc; - - aim_srv_clientready(od, conn); - - od->iconconnecting = FALSE; - - purple_icons_fetch(gc); -} - -static int -flap_connection_established(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - purple_debug_info("oscar", "FLAP connection of type 0x%04hx is " - "now fully connected\n", conn->type); - if (conn->type == SNAC_FAMILY_LOCATE) - flap_connection_established_bos(od, conn); - else if (conn->type == SNAC_FAMILY_ADMIN) - flap_connection_established_admin(od, conn); - else if (conn->type == SNAC_FAMILY_CHAT) - flap_connection_established_chat(od, conn); - else if (conn->type == SNAC_FAMILY_CHATNAV) - flap_connection_established_chatnav(od, conn); - else if (conn->type == SNAC_FAMILY_ALERT) - flap_connection_established_alert(od, conn); - else if (conn->type == SNAC_FAMILY_BART) - flap_connection_established_bart(od, conn); - - return 1; -} - -static void -idle_reporting_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleConnection *gc; - OscarData *od; - gboolean report_idle; - guint32 presence; - - gc = data; - od = purple_connection_get_protocol_data(gc); - report_idle = strcmp((const char *)value, "none") != 0; - presence = aim_ssi_getpresence(od->ssi.local); - - if (report_idle) - aim_ssi_setpresence(od, presence | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); - else - aim_ssi_setpresence(od, presence & ~AIM_SSI_PRESENCE_FLAG_SHOWIDLE); -} - -/** - * Should probably make a "Use recent buddies group" account preference - * so that this option is surfaced to the user. - */ -static void -recent_buddies_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleConnection *gc; - OscarData *od; - guint32 presence; - - gc = data; - od = purple_connection_get_protocol_data(gc); - presence = aim_ssi_getpresence(od->ssi.local); - - if (value) - aim_ssi_setpresence(od, presence & ~AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES); - else - aim_ssi_setpresence(od, presence | AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES); -} - -void -oscar_login(PurpleAccount *account) -{ - PurpleConnection *gc; - OscarData *od; - - gc = purple_account_get_connection(account); - od = oscar_data_new(); - od->gc = gc; - purple_connection_set_protocol_data(gc, od); - - oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, purple_connerr, 0); - oscar_data_addhandler(od, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, flap_connection_established, 0); - - oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0003, purple_info_change, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0005, purple_info_change, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ADMIN, 0x0007, purple_account_confirm, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ALERT, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ALERT, SNAC_SUBTYPE_ALERT_MAILSTATUS, purple_email_parseupdate, 0); - - /* These are only needed when connecting with the old-style BUCP login */ - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0003, purple_parse_auth_resp, 0); - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, 0x0007, purple_parse_login, 0); - oscar_data_addhandler(od, SNAC_FAMILY_AUTH, SNAC_SUBTYPE_AUTH_SECURID_REQUEST, purple_parse_auth_securid_request, 0); - - oscar_data_addhandler(od, SNAC_FAMILY_BART, SNAC_SUBTYPE_BART_RESPONSE, purple_icon_parseicon, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BOS, 0x0003, purple_bosrights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_RIGHTSINFO, purple_parse_buddyrights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_ONCOMING, purple_parse_oncoming, 0); - oscar_data_addhandler(od, SNAC_FAMILY_BUDDY, SNAC_SUBTYPE_BUDDY_OFFGOING, purple_parse_offgoing, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERJOIN, purple_conv_chat_join, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_USERLEAVE, purple_conv_chat_leave, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE, purple_conv_chat_info_update, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHAT, SNAC_SUBTYPE_CHAT_INCOMINGMSG, purple_conv_chat_incoming_msg, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_CHATNAV, SNAC_SUBTYPE_CHATNAV_INFO, purple_chatnav_info, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ERROR, purple_ssi_parseerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO, purple_ssi_parserights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_LIST, purple_ssi_parselist, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SRVACK, purple_ssi_parseack, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADD, purple_ssi_parseaddmod, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_MOD, purple_ssi_parseaddmod, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTH, purple_ssi_authgiven, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ, purple_ssi_authrequest, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP, purple_ssi_authreply, 0); - oscar_data_addhandler(od, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_ADDED, purple_ssi_gotadded, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_INCOMING, purple_parse_incoming_im, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MISSEDCALL, purple_parse_misses, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_CLIENTAUTORESP, purple_parse_clientauto, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ERROR, purple_parse_msgerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_MTN, purple_parse_mtn, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICBM, SNAC_SUBTYPE_ICBM_ACK, purple_parse_msgack, 0); -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSG, purple_offlinemsg, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE, purple_offlinemsgdone, 0); -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_ALIAS, purple_icqalias, 0); - oscar_data_addhandler(od, SNAC_FAMILY_ICQ, SNAC_SUBTYPE_ICQ_INFO, purple_icqinfo, 0); - oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_RIGHTSINFO, purple_parse_locaterights, 0); - oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_USERINFO, purple_parse_userinfo, 0); - oscar_data_addhandler(od, SNAC_FAMILY_LOCATE, SNAC_SUBTYPE_LOCATE_ERROR, purple_parse_locerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0001, purple_parse_genericerr, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x000f, purple_selfinfo, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x001f, purple_memrequest, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, 0x0021, oscar_icon_req,0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_REDIRECT, purple_handle_redirect, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_MOTD, purple_parse_motd, 0); - oscar_data_addhandler(od, SNAC_FAMILY_OSERVICE, SNAC_SUBTYPE_OSERVICE_EVIL, purple_parse_evilnotify, 0); - oscar_data_addhandler(od, SNAC_FAMILY_POPUP, 0x0002, purple_popup, 0); - oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, SNAC_SUBTYPE_USERLOOKUP_ERROR, purple_parse_searcherror, 0); - oscar_data_addhandler(od, SNAC_FAMILY_USERLOOKUP, 0x0003, purple_parse_searchreply, 0); - - purple_debug_misc("oscar", "oscar_login: gc = %p\n", gc); - - if (!oscar_util_valid_name(purple_account_get_username(account))) { - gchar *buf; - buf = g_strdup_printf(_("Unable to sign on as %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), purple_account_get_username(account)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, buf); - g_free(buf); - return; - } - - if (oscar_util_valid_name_icq((purple_account_get_username(account)))) { - od->icq = TRUE; - } else { - gc->flags |= PURPLE_CONNECTION_HTML; - gc->flags |= PURPLE_CONNECTION_AUTO_RESP; - } - - od->default_port = purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT); - od->use_ssl = purple_account_get_bool(account, "use_ssl", OSCAR_DEFAULT_USE_SSL); - - /* Connect to core Purple signals */ - purple_prefs_connect_callback(gc, "/purple/away/idle_reporting", idle_reporting_pref_cb, gc); - purple_prefs_connect_callback(gc, "/plugins/prpl/oscar/recent_buddies", recent_buddies_pref_cb, gc); - - /* - * On 2008-03-05 AOL released some documentation on the OSCAR protocol - * which includes a new login method called clientLogin. It is similar - * (though not the same?) as what the AIM 6.0 series uses to - * authenticate. - * - * AIM 5.9 and lower use an MD5-based login procedure called "BUCP". - * This authentication method is used for both ICQ and AIM when - * clientLogin is not enabled. - */ - if (purple_account_get_bool(account, "use_clientlogin", OSCAR_DEFAULT_USE_CLIENTLOGIN)) { - send_client_login(od, purple_account_get_username(account)); - } else { - FlapConnection *newconn; - const char *server; - - newconn = flap_connection_new(od, SNAC_FAMILY_AUTH); - - if (od->use_ssl) { - if (!purple_ssl_is_supported()) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, - _("SSL support unavailable")); - return; - } - - server = purple_account_get_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER); - - /* - * If the account's server is what the oscar prpl has offered as - * the default login server through the vast eons (all two of - * said default options, AFAIK) and the user wants SSL, we'll - * do what we know is best for them and change the setting out - * from under them to the SSL login server. - */ - if (!strcmp(server, OSCAR_DEFAULT_LOGIN_SERVER) || !strcmp(server, OSCAR_OLD_LOGIN_SERVER)) { - purple_debug_info("oscar", "Account uses SSL, so changing server to default SSL server\n"); - purple_account_set_string(account, "server", OSCAR_DEFAULT_SSL_LOGIN_SERVER); - server = OSCAR_DEFAULT_SSL_LOGIN_SERVER; - } - - newconn->gsc = purple_ssl_connect(account, server, - purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), - ssl_connection_established_cb, ssl_connection_error_cb, newconn); - } else { - server = purple_account_get_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER); - - /* - * See the comment above. We do the reverse here. If they don't want - * SSL but their server is set to OSCAR_DEFAULT_SSL_LOGIN_SERVER, - * set it back to the default. - */ - if (!strcmp(server, OSCAR_DEFAULT_SSL_LOGIN_SERVER)) { - purple_debug_info("oscar", "Account does not use SSL, so changing server back to non-SSL\n"); - purple_account_set_string(account, "server", OSCAR_DEFAULT_LOGIN_SERVER); - server = OSCAR_DEFAULT_LOGIN_SERVER; - } - - newconn->connect_data = purple_proxy_connect(NULL, account, server, - purple_account_get_int(account, "port", OSCAR_DEFAULT_LOGIN_PORT), - connection_established_cb, newconn); - } - - if (newconn->gsc == NULL && newconn->connect_data == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - } - - purple_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); - ck[0] = 0x5a; -} - -void -oscar_close(PurpleConnection *gc) -{ - OscarData *od; - - od = purple_connection_get_protocol_data(gc); - - while (od->oscar_chats) - { - struct chat_connection *cc = od->oscar_chats->data; - od->oscar_chats = g_slist_remove(od->oscar_chats, cc); - oscar_chat_destroy(cc); - } - while (od->create_rooms) - { - struct create_room *cr = od->create_rooms->data; - g_free(cr->name); - od->create_rooms = g_slist_remove(od->create_rooms, cr); - g_free(cr); - } - oscar_data_destroy(od); - purple_connection_set_protocol_data(gc, NULL); - - purple_prefs_disconnect_by_handle(gc); - - purple_debug_info("oscar", "Signed off.\n"); -} - -/* XXX - Should use purple_util_fetch_url for the below stuff */ -struct pieceofcrap { - PurpleConnection *gc; - unsigned long offset; - unsigned long len; - char *modname; - int fd; - FlapConnection *conn; - unsigned int inpa; -}; - -static void damn_you(gpointer data, gint source, PurpleInputCondition c) -{ - struct pieceofcrap *pos = data; - OscarData *od = purple_connection_get_protocol_data(pos->gc); - char in = '\0'; - int x = 0; - unsigned char m[17]; - GString *msg; - - while (read(pos->fd, &in, 1) == 1) { - if (in == '\n') - x++; - else if (in != '\r') - x = 0; - if (x == 2) - break; - in = '\0'; - } - if (in != '\n') { - char buf[256]; - g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. " - "If so, check %s for updates."), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_notify_warning(pos->gc, NULL, - _("Unable to get a valid AIM login hash."), - buf); - purple_input_remove(pos->inpa); - close(pos->fd); - g_free(pos); - return; - } - if (read(pos->fd, m, 16) != 16) - { - purple_debug_warning("oscar", "Could not read full AIM login hash " - "from " AIMHASHDATA "--that's bad.\n"); - } - m[16] = '\0'; - - msg = g_string_new("Sending hash: "); - for (x = 0; x < 16; x++) - g_string_append_printf(msg, "%02hhx ", (unsigned char)m[x]); - g_string_append(msg, "\n"); - purple_debug_misc("oscar", "%s", msg->str); - g_string_free(msg, TRUE); - - purple_input_remove(pos->inpa); - close(pos->fd); - aim_sendmemblock(od, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); - g_free(pos); -} - -static void -straight_to_hell(gpointer data, gint source, const gchar *error_message) -{ - struct pieceofcrap *pos = data; - gchar *buf; - gssize result; - - pos->fd = source; - - if (source < 0) { - buf = g_strdup_printf(_("You may be disconnected shortly. " - "If so, check %s for updates."), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_notify_warning(pos->gc, NULL, - _("Unable to get a valid AIM login hash."), - buf); - g_free(buf); - g_free(pos->modname); - g_free(pos); - return; - } - - buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", - pos->offset, pos->len, pos->modname ? pos->modname : ""); - result = send(pos->fd, buf, strlen(buf), 0); - if (result != strlen(buf)) { - if (result < 0) - purple_debug_error("oscar", "Error writing %" G_GSIZE_FORMAT - " bytes to fetch AIM hash data: %s\n", - strlen(buf), g_strerror(errno)); - else - purple_debug_error("oscar", "Tried to write %" - G_GSIZE_FORMAT " bytes to fetch AIM hash data but " - "instead wrote %" G_GSSIZE_FORMAT " bytes\n", - strlen(buf), result); - } - g_free(buf); - g_free(pos->modname); - pos->inpa = purple_input_add(pos->fd, PURPLE_INPUT_READ, damn_you, pos); - return; -} - -/* size of icbmui.ocm, the largest module in AIM 3.5 */ -#define AIM_MAX_FILE_SIZE 98304 - -static int purple_memrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - va_list ap; - struct pieceofcrap *pos; - guint32 offset, len; - char *modname; - - va_start(ap, fr); - offset = va_arg(ap, guint32); - len = va_arg(ap, guint32); - modname = va_arg(ap, char *); - va_end(ap); - - purple_debug_misc("oscar", "offset: %u, len: %u, file: %s\n", - offset, len, (modname ? modname : "aim.exe")); - - if (len == 0) { - purple_debug_misc("oscar", "len is 0, hashing NULL\n"); - aim_sendmemblock(od, conn, offset, len, NULL, - AIM_SENDMEMBLOCK_FLAG_ISREQUEST); - return 1; - } - /* uncomment this when you're convinced it's right. remember, it's been wrong before. */ -#if 0 - if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { - char *buf; - int i = 8; - if (modname) - i += strlen(modname); - buf = g_malloc(i); - i = 0; - if (modname) { - memcpy(buf, modname, strlen(modname)); - i += strlen(modname); - } - buf[i++] = offset & 0xff; - buf[i++] = (offset >> 8) & 0xff; - buf[i++] = (offset >> 16) & 0xff; - buf[i++] = (offset >> 24) & 0xff; - buf[i++] = len & 0xff; - buf[i++] = (len >> 8) & 0xff; - buf[i++] = (len >> 16) & 0xff; - buf[i++] = (len >> 24) & 0xff; - purple_debug_misc("oscar", "len + offset is invalid, " - "hashing request\n"); - aim_sendmemblock(od, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); - g_free(buf); - return 1; - } -#endif - - pos = g_new0(struct pieceofcrap, 1); - pos->gc = od->gc; - pos->conn = conn; - - pos->offset = offset; - pos->len = len; - pos->modname = g_strdup(modname); - - if (purple_proxy_connect(pos->gc, pos->gc->account, "pidgin.im", 80, - straight_to_hell, pos) == NULL) - { - char buf[256]; - g_free(pos->modname); - g_free(pos); - - g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. " - "If so, check %s for updates."), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_notify_warning(pos->gc, NULL, - _("Unable to get a valid login hash."), - buf); - } - - return 1; -} - -int oscar_connect_to_bos(PurpleConnection *gc, OscarData *od, const char *host, guint16 port, guint8 *cookie, guint16 cookielen, const char *tls_certname) -{ - PurpleAccount *account; - FlapConnection *conn; - - account = purple_connection_get_account(gc); - - conn = flap_connection_new(od, SNAC_FAMILY_LOCATE); - conn->cookielen = cookielen; - conn->cookie = g_memdup(cookie, cookielen); - - /* - * tls_certname is only set (and must be set if we get this far) if - * SSL is enabled. - */ - if (tls_certname) - { - conn->gsc = purple_ssl_connect_with_ssl_cn(account, host, port, - ssl_connection_established_cb, ssl_connection_error_cb, - tls_certname, conn); - } - else - { - conn->connect_data = purple_proxy_connect(NULL, - account, host, port, - connection_established_cb, conn); - } - - if (conn->gsc == NULL && conn->connect_data == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - return 0; - } - - od->default_port = port; - - purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); - ck[3] = 0x64; - - return 1; -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_auth_resp(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char *host; int port; - int i; - FlapConnection *newconn; - va_list ap; - struct aim_authresp_info *info; - - port = purple_account_get_int(account, "port", od->default_port); - - va_start(ap, fr); - info = va_arg(ap, struct aim_authresp_info *); - va_end(ap); - - purple_debug_info("oscar", - "inside auth_resp (Username: %s)\n", info->bn); - - if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { - char buf[256]; - switch (info->errorcode) { - case 0x01: - /* Unregistered username */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_INVALID_USERNAME, _("Username does not exist")); - break; - case 0x05: - /* Incorrect password */ - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password")); - break; - case 0x11: - /* Suspended account */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Your account is currently suspended")); - break; - case 0x02: - case 0x14: - /* service temporarily unavailable */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("The AOL Instant Messenger service is temporarily unavailable.")); - break; - case 0x18: - /* username connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your username has been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); - break; - case 0x1c: - { - /* client too old */ - g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), - oscar_get_ui_info_string("website", PURPLE_WEBSITE)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, buf); - break; - } - case 0x1d: - /* IP address connecting too frequently */ - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, _("Your IP address has been connecting and disconnecting too frequently. Wait a minute and try again. If you continue to try, you will need to wait even longer.")); - break; - default: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Unknown reason")); - break; - } - purple_debug_info("oscar", "Login Error Code 0x%04hx\n", info->errorcode); - purple_debug_info("oscar", "Error URL: %s\n", info->errorurl ? info->errorurl : ""); - return 1; - } - - purple_debug_misc("oscar", "Reg status: %hu\n" - "Email: %s\n" - "BOSIP: %s\n", - info->regstatus, - info->email ? info->email : "null", - info->bosip ? info->bosip : "null"); - purple_debug_info("oscar", "Closing auth connection...\n"); - flap_connection_schedule_destroy(conn, OSCAR_DISCONNECT_DONE, NULL); - - for (i = 0; i < strlen(info->bosip); i++) { - if (info->bosip[i] == ':') { - port = atoi(&(info->bosip[i+1])); - break; - } - } - host = g_strndup(info->bosip, i); - newconn = flap_connection_new(od, SNAC_FAMILY_LOCATE); - newconn->cookielen = info->cookielen; - newconn->cookie = g_memdup(info->cookie, info->cookielen); - - if (od->use_ssl) - { - /* - * This shouldn't be hardcoded to "bos.oscar.aol.com" except that - * the server isn't sending us a name to use for comparing the - * certificate common name. - */ - newconn->gsc = purple_ssl_connect_with_ssl_cn(account, host, port, - ssl_connection_established_cb, ssl_connection_error_cb, - "bos.oscar.aol.com", newconn); - } - else - { - newconn->connect_data = purple_proxy_connect(NULL, account, host, port, - connection_established_cb, newconn); - } - - g_free(host); - if (newconn->gsc == NULL && newconn->connect_data == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - return 0; - } - - purple_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); - ck[3] = 0x64; - - return 1; -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static void -purple_parse_auth_securid_request_yes_cb(gpointer user_data, const char *msg) -{ - PurpleConnection *gc = user_data; - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_auth_securid_send(od, msg); -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static void -purple_parse_auth_securid_request_no_cb(gpointer user_data, const char *value) -{ - PurpleConnection *gc = user_data; - - /* Disconnect */ - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("The SecurID key entered is invalid")); -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_auth_securid_request(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - gchar *primary; - - purple_debug_info("oscar", "Got SecurID request\n"); - - primary = g_strdup_printf("Enter the SecurID key for %s.", purple_account_get_username(account)); - purple_request_input(gc, NULL, _("Enter SecurID"), primary, - _("Enter the 6 digit number from the digital display."), - FALSE, FALSE, NULL, - _("_OK"), G_CALLBACK(purple_parse_auth_securid_request_yes_cb), - _("_Cancel"), G_CALLBACK(purple_parse_auth_securid_request_no_cb), - account, NULL, NULL, - gc); - g_free(primary); - - return 1; -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static int -purple_parse_login(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - ClientInfo aiminfo = CLIENTINFO_PURPLE_AIM; - ClientInfo icqinfo = CLIENTINFO_PURPLE_ICQ; - va_list ap; - char *key; - gboolean truncate_pass; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - key = va_arg(ap, char *); - truncate_pass = va_arg(ap, int); - va_end(ap); - - aim_send_login(od, conn, purple_account_get_username(account), - purple_connection_get_password(gc), truncate_pass, - od->icq ? &icqinfo : &aiminfo, key, - purple_account_get_bool(account, "allow_multiple_logins", OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS)); - - purple_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); - ck[2] = 0x6c; - - return 1; -} - -static int -purple_handle_redirect(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char *host, *separator; - int port; - FlapConnection *newconn; - va_list ap; - struct aim_redirect_data *redir; - - va_start(ap, fr); - redir = va_arg(ap, struct aim_redirect_data *); - va_end(ap); - - port = od->default_port; - separator = strchr(redir->ip, ':'); - if (separator != NULL) - { - host = g_strndup(redir->ip, separator - redir->ip); - port = atoi(separator + 1); - } - else - host = g_strdup(redir->ip); - - /* - * These FLAP servers advertise SSL (type "0x02"), but SSL connections to these hosts - * die a painful death. iChat and Miranda, when using SSL, still do these in plaintext. - */ - if (redir->use_ssl && (redir->group == SNAC_FAMILY_ADMIN || - redir->group == SNAC_FAMILY_BART)) - { - purple_debug_info("oscar", "Ignoring broken SSL for FLAP type 0x%04hx.\n", - redir->group); - redir->use_ssl = 0; - } - - purple_debug_info("oscar", "Connecting to FLAP server %s:%d of type 0x%04hx%s\n", - host, port, redir->group, - od->use_ssl && !redir->use_ssl ? " without SSL, despite main stream encryption" : ""); - - newconn = flap_connection_new(od, redir->group); - newconn->cookielen = redir->cookielen; - newconn->cookie = g_memdup(redir->cookie, redir->cookielen); - if (newconn->type == SNAC_FAMILY_CHAT) - { - struct chat_connection *cc; - cc = g_new0(struct chat_connection, 1); - cc->conn = newconn; - cc->gc = gc; - cc->name = g_strdup(redir->chat.room); - cc->exchange = redir->chat.exchange; - cc->instance = redir->chat.instance; - cc->show = extract_name(redir->chat.room); - newconn->new_conn_data = cc; - purple_debug_info("oscar", "Connecting to chat room %s exchange %hu\n", cc->name, cc->exchange); - } - - - if (redir->use_ssl) - { - newconn->gsc = purple_ssl_connect_with_ssl_cn(account, host, port, - ssl_connection_established_cb, ssl_connection_error_cb, - redir->ssl_cert_cn, newconn); - } - else - { - newconn->connect_data = purple_proxy_connect(NULL, account, host, port, - connection_established_cb, newconn); - } - - if (newconn->gsc == NULL && newconn->connect_data == NULL) - { - flap_connection_schedule_destroy(newconn, - OSCAR_DISCONNECT_COULD_NOT_CONNECT, - _("Unable to initialize connection")); - purple_debug_error("oscar", "Unable to connect to FLAP server " - "of type 0x%04hx\n", redir->group); - } - g_free(host); - - return 1; -} - - -static int purple_parse_oncoming(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - struct buddyinfo *bi; - time_t time_idle = 0, signon = 0; - int type = 0; - gboolean buddy_is_away = FALSE; - const char *status_id; - va_list ap; - aim_userinfo_t *info; - char *message = NULL; - char *itmsurl = NULL; - char *tmp; - const char *tmp2; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - g_return_val_if_fail(info != NULL, 1); - g_return_val_if_fail(info->bn != NULL, 1); - - /* - * If this is an AIM buddy and their name has formatting, set their - * server alias. - */ - if (!oscar_util_valid_name_icq(info->bn)) { - gboolean bn_has_formatting = FALSE; - char *c; - for (c = info->bn; *c != '\0'; c++) { - if (!islower(*c)) { - bn_has_formatting = TRUE; - break; - } - } - serv_got_alias(gc, info->bn, - bn_has_formatting ? info->bn : NULL); - } - - if (info->present & AIM_USERINFO_PRESENT_FLAGS) { - if (info->flags & AIM_FLAG_AWAY) - buddy_is_away = TRUE; - } - if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { - type = info->icqinfo.status; - if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && - (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { - buddy_is_away = TRUE; - } - } - - if (oscar_util_valid_name_icq(info->bn)) { - if (type & AIM_ICQ_STATE_CHAT) - status_id = OSCAR_STATUS_ID_FREE4CHAT; - else if (type & AIM_ICQ_STATE_DND) - status_id = OSCAR_STATUS_ID_DND; - else if (type & AIM_ICQ_STATE_OUT) - status_id = OSCAR_STATUS_ID_NA; - else if (type & AIM_ICQ_STATE_BUSY) - status_id = OSCAR_STATUS_ID_OCCUPIED; - else if (type & AIM_ICQ_STATE_AWAY) - status_id = OSCAR_STATUS_ID_AWAY; - else if (type & AIM_ICQ_STATE_INVISIBLE) - status_id = OSCAR_STATUS_ID_INVISIBLE; - else - status_id = OSCAR_STATUS_ID_AVAILABLE; - } else { - if (type & AIM_ICQ_STATE_INVISIBLE) - status_id = OSCAR_STATUS_ID_INVISIBLE; - else if (buddy_is_away) - status_id = OSCAR_STATUS_ID_AWAY; - else - status_id = OSCAR_STATUS_ID_AVAILABLE; - } - - if (info->flags & AIM_FLAG_WIRELESS) - { - purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_MOBILE, NULL); - } else { - purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); - } - - if (info->status != NULL && info->status[0] != '\0') - /* Grab the available message */ - message = oscar_encoding_to_utf8(account, info->status_encoding, - info->status, info->status_len); - - tmp2 = tmp = (message ? purple_markup_escape_text(message, -1) : NULL); - - if (strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE) == 0) { - if (info->itmsurl_encoding && info->itmsurl && info->itmsurl_len) - /* Grab the iTunes Music Store URL */ - itmsurl = oscar_encoding_to_utf8(account, info->itmsurl_encoding, - info->itmsurl, info->itmsurl_len); - - if (tmp2 == NULL && itmsurl != NULL) - /* - * The message can't be NULL because NULL means it was the - * last attribute, so the itmsurl would get ignored below. - */ - tmp2 = ""; - - purple_prpl_got_user_status(account, info->bn, status_id, - "message", tmp2, "itmsurl", itmsurl, NULL); - } - else - purple_prpl_got_user_status(account, info->bn, status_id, "message", tmp2, NULL); - - g_free(tmp); - - g_free(message); - g_free(itmsurl); - - /* Login time stuff */ - if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) - signon = info->onlinesince; - else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) - signon = time(NULL) - info->sessionlen; - purple_prpl_got_user_login_time(account, info->bn, signon); - - /* Idle time stuff */ - /* info->idletime is the number of minutes that this user has been idle */ - if (info->present & AIM_USERINFO_PRESENT_IDLE) - time_idle = time(NULL) - info->idletime * 60; - - if (time_idle > 0) - purple_prpl_got_user_idle(account, info->bn, TRUE, time_idle); - else - purple_prpl_got_user_idle(account, info->bn, FALSE, 0); - - /* Server stored icon stuff */ - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, info->bn)); - if (!bi) { - bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, info->bn)), bi); - } - bi->typingnot = FALSE; - bi->ico_informed = FALSE; - bi->ipaddr = info->icqinfo.ipaddr; - - if (info->iconcsumlen) { - const char *saved_b16 = NULL; - char *b16 = NULL; - PurpleBuddy *b = NULL; - - b16 = purple_base16_encode(info->iconcsum, info->iconcsumlen); - b = purple_find_buddy(account, info->bn); - if (b != NULL) - saved_b16 = purple_buddy_icons_get_checksum_for_user(b); - - if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { - /* Invalidate the old icon for this user */ - purple_buddy_icons_set_for_user(account, info->bn, NULL, 0, NULL); - - /* Fetch the new icon (if we're not already doing so) */ - if (g_slist_find_custom(od->requesticon, info->bn, - (GCompareFunc)oscar_util_name_compare) == NULL) - { - od->requesticon = g_slist_prepend(od->requesticon, - g_strdup(purple_normalize(account, info->bn))); - purple_icons_fetch(gc); - } - } - g_free(b16); - } - - return 1; -} - -static void purple_check_comment(OscarData *od, const char *str) { - if ((str == NULL) || strcmp(str, (const char *)ck)) - aim_locate_setcaps(od, purple_caps); - else - aim_locate_setcaps(od, purple_caps | OSCAR_CAPABILITY_SECUREIM); -} - -static int purple_parse_offgoing(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - va_list ap; - aim_userinfo_t *info; - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - purple_prpl_got_user_status(account, info->bn, OSCAR_STATUS_ID_OFFLINE, NULL); - purple_prpl_got_user_status_deactive(account, info->bn, OSCAR_STATUS_ID_MOBILE); - g_hash_table_remove(od->buddyinfo, purple_normalize(gc->account, info->bn)); - - return 1; -} - -static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleMessageFlags flags = 0; - struct buddyinfo *bi; - PurpleStoredImage *img; - GString *message; - gchar *tmp; - aim_mpmsg_section_t *curpart; - const char *start, *end; - GData *attribs; - - purple_debug_misc("oscar", "Received IM from %s with %d parts\n", - userinfo->bn, args->mpmsg.numparts); - - if (args->mpmsg.numparts == 0) - return 1; - - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, userinfo->bn)); - if (!bi) { - bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, userinfo->bn)), bi); - } - - if (args->icbmflags & AIM_IMFLAGS_AWAY) - flags |= PURPLE_MESSAGE_AUTO_RESP; - - if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) - bi->typingnot = TRUE; - else - bi->typingnot = FALSE; - - if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { - purple_debug_misc("oscar", "%s has an icon\n", userinfo->bn); - if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { - bi->ico_need = TRUE; - bi->ico_len = args->iconlen; - bi->ico_csum = args->iconsum; - bi->ico_time = args->iconstamp; - } - } - - img = purple_buddy_icons_find_account_icon(account); - if ((img != NULL) && - (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { - gconstpointer data = purple_imgstore_get_data(img); - size_t len = purple_imgstore_get_size(img); - purple_debug_info("oscar", - "Sending buddy icon to %s (%" G_GSIZE_FORMAT " bytes)\n", - userinfo->bn, len); - aim_im_sendch2_icon(od, userinfo->bn, data, len, - purple_buddy_icons_get_account_icon_timestamp(account), - aimutil_iconsum(data, len)); - } - purple_imgstore_unref(img); - - message = g_string_new(""); - curpart = args->mpmsg.parts; - while (curpart != NULL) { - tmp = purple_plugin_oscar_decode_im_part(account, userinfo->bn, curpart->charset, - curpart->charsubset, curpart->data, curpart->datalen); - if (tmp != NULL) { - g_string_append(message, tmp); - g_free(tmp); - } - - curpart = curpart->next; - } - tmp = g_string_free(message, FALSE); - - /* - * If the message is from an ICQ user and to an ICQ user then escape any HTML, - * because HTML is not sent over ICQ as a means to format a message. - * So any HTML we receive is intended to be displayed. Also, \r\n must be - * replaced with
- * - * Note: There *may* be some clients which send messages as HTML formatted - - * they need to be special-cased somehow. - */ - if (od->icq && oscar_util_valid_name_icq(userinfo->bn)) { - /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */ - gchar *tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - tmp = tmp2; - tmp2 = purple_strreplace(tmp, "\r\n", "
"); - g_free(tmp); - tmp = tmp2; - } - - /* - * Convert iChat color tags to normal font tags. - */ - if (purple_markup_find_tag("body", tmp, &start, &end, &attribs)) - { - int len; - char *tmp2, *body; - const char *ichattextcolor, *ichatballooncolor; - const char *slash_body_start, *slash_body_end = NULL; /* */ - GData *unused; - - /* - * Find the ending so we can strip off the outer - * and - */ - if (purple_markup_find_tag("/body", end + 1, &slash_body_start, &slash_body_end, &unused)) - { - body = g_strndup(start, slash_body_end - start + 1); - g_datalist_clear(&unused); - } - else - { - purple_debug_warning("oscar", "Broken message contains but not !\n"); - /* Take everything after */ - body = g_strdup(start); - } - - ichattextcolor = g_datalist_get_data(&attribs, "ichattextcolor"); - if (ichattextcolor != NULL) - { - tmp2 = g_strdup_printf("%s", ichattextcolor, body); - g_free(body); - body = tmp2; - } - - ichatballooncolor = g_datalist_get_data(&attribs, "ichatballooncolor"); - if (ichatballooncolor != NULL) - { - tmp2 = g_strdup_printf("%s", ichatballooncolor, body); - g_free(body); - body = tmp2; - } - - g_datalist_clear(&attribs); - - len = start - tmp; - tmp2 = g_strdup_printf("%.*s%s%s", len, tmp, body, slash_body_end ? slash_body_end + 1: ""); - g_free(tmp); - g_free(body); - - tmp = tmp2; - } - - /* - * Are there surrounding tags? If so, strip them out, too. - */ - if (purple_markup_find_tag("html", tmp, &start, &end, &attribs)) - { - gchar *tmp2; - int len; - - g_datalist_clear(&attribs); - - len = start - tmp; - tmp2 = g_strdup_printf("%.*s%s", len, tmp, end + 1); - g_free(tmp); - tmp = tmp2; - } - - if (purple_markup_find_tag("/html", tmp, &start, &end, &attribs)) - { - gchar *tmp2; - int len; - - g_datalist_clear(&attribs); - - len = start - tmp; - tmp2 = g_strdup_printf("%.*s%s", len, tmp, end + 1); - g_free(tmp); - tmp = tmp2; - } - - serv_got_im(gc, userinfo->bn, tmp, flags, - (args->icbmflags & AIM_IMFLAGS_OFFLINE) ? args->timestamp : time(NULL)); - g_free(tmp); - - return 1; -} - -static int -incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args) -{ - PurpleConnection *gc; - PurpleAccount *account; - char *message = NULL; - - g_return_val_if_fail(od != NULL, 0); - g_return_val_if_fail(od->gc != NULL, 0); - - gc = od->gc; - account = purple_connection_get_account(gc); - od = purple_connection_get_protocol_data(gc); - - if (args == NULL) - return 0; - - purple_debug_misc("oscar", "Incoming rendezvous message of type %u, " - "user %s, status %hu\n", args->type, userinfo->bn, args->status); - - if (args->msg != NULL) - { - if (args->encoding != NULL) - { - char *encoding = NULL; - encoding = oscar_encoding_extract(args->encoding); - message = oscar_encoding_to_utf8(account, encoding, args->msg, - args->msglen); - g_free(encoding); - } else { - if (g_utf8_validate(args->msg, args->msglen, NULL)) - message = g_strdup(args->msg); - } - } - - if (args->type & OSCAR_CAPABILITY_CHAT) - { - char *encoding, *utf8name, *tmp; - GHashTable *components; - - if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange) { - g_free(message); - return 1; - } - encoding = args->encoding ? oscar_encoding_extract(args->encoding) : NULL; - utf8name = oscar_encoding_to_utf8(account, encoding, - args->info.chat.roominfo.name, - args->info.chat.roominfo.namelen); - g_free(encoding); - - tmp = extract_name(utf8name); - if (tmp != NULL) - { - g_free(utf8name); - utf8name = tmp; - } - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - g_free); - g_hash_table_replace(components, g_strdup("room"), utf8name); - g_hash_table_replace(components, g_strdup("exchange"), - g_strdup_printf("%d", args->info.chat.roominfo.exchange)); - serv_got_chat_invite(gc, - utf8name, - userinfo->bn, - message, - components); - } - - else if ((args->type & OSCAR_CAPABILITY_SENDFILE) || - (args->type & OSCAR_CAPABILITY_DIRECTIM)) - { - if (args->status == AIM_RENDEZVOUS_PROPOSE) - { - peer_connection_got_proposition(od, userinfo->bn, message, args); - } - else if (args->status == AIM_RENDEZVOUS_CANCEL) - { - /* The other user canceled a peer request */ - PeerConnection *conn; - - conn = peer_connection_find_by_cookie(od, userinfo->bn, args->cookie); - /* - * If conn is NULL it means we haven't tried to create - * a connection with that user. They may be trying to - * do something malicious. - */ - if (conn != NULL) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - } - } - else if (args->status == AIM_RENDEZVOUS_CONNECTED) - { - /* - * Remote user has accepted our peer request. If we - * wanted to we could look up the PeerConnection using - * args->cookie, but we don't need to do anything here. - */ - } - } - - else if (args->type & OSCAR_CAPABILITY_GETFILE) - { - } - - else if (args->type & OSCAR_CAPABILITY_TALK) - { - } - - else if (args->type & OSCAR_CAPABILITY_BUDDYICON) - { - purple_buddy_icons_set_for_user(account, userinfo->bn, - g_memdup(args->info.icon.icon, args->info.icon.length), - args->info.icon.length, - NULL); - } - - else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY) - { - purple_debug_error("oscar", "Got an ICQ Server Relay message of " - "type %d\n", args->info.rtfmsg.msgtype); - } - - else - { - purple_debug_error("oscar", "Unknown request class %hu\n", - args->type); - } - - g_free(message); - - return 1; -} - -/* - * Authorization Functions - * Most of these are callbacks from dialogs. They're used by both - * methods of authorization (SSI and old-school channel 4 ICBM) - */ -/* When you ask other people for authorization */ -static void -purple_auth_request(struct name_data *data, char *msg) -{ - PurpleConnection *gc; - OscarData *od; - PurpleAccount *account; - PurpleBuddy *buddy; - PurpleGroup *group; - const char *bname, *gname; - - gc = data->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - buddy = purple_find_buddy(account, data->name); - if (buddy != NULL) - group = purple_buddy_get_group(buddy); - else - group = NULL; - - if (group != NULL) - { - bname = purple_buddy_get_name(buddy); - gname = purple_group_get_name(group); - purple_debug_info("oscar", "ssi: adding buddy %s to group %s\n", - bname, gname); - aim_ssi_sendauthrequest(od, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); - if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) - { - aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, TRUE); - - /* Mobile users should always be online */ - if (bname[0] == '+') { - purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - purple_buddy_get_name(buddy), - OSCAR_STATUS_ID_MOBILE, NULL); - } - } - } - - oscar_free_name_data(data); -} - -static void -purple_auth_sendrequest(PurpleConnection *gc, const char *name) -{ - struct name_data *data; - - data = g_new0(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(name); - - purple_request_input(data->gc, NULL, _("Authorization Request Message:"), - NULL, _("Please authorize me!"), TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(purple_auth_request), - _("_Cancel"), G_CALLBACK(oscar_free_name_data), - purple_connection_get_account(gc), name, NULL, - data); -} - -static void -purple_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - purple_auth_sendrequest(gc, purple_buddy_get_name(buddy)); -} - -/* When other people ask you for authorization */ -static void -purple_auth_grant(gpointer cbdata) -{ - struct name_data *data = cbdata; - PurpleConnection *gc = data->gc; - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_ssi_sendauthreply(od, data->name, 0x01, NULL); - - oscar_free_name_data(data); -} - -/* When other people ask you for authorization */ -static void -purple_auth_dontgrant(struct name_data *data, char *msg) -{ - PurpleConnection *gc = data->gc; - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given.")); -} - -static void -purple_auth_dontgrant_msgprompt(gpointer cbdata) -{ - struct name_data *data = cbdata; - purple_request_input(data->gc, NULL, _("Authorization Denied Message:"), - NULL, _("No reason given."), TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(purple_auth_dontgrant), - _("_Cancel"), G_CALLBACK(oscar_free_name_data), - purple_connection_get_account(data->gc), data->name, NULL, - data); -} - -/* When someone sends you buddies */ -static void -purple_icq_buddyadd(struct name_data *data) -{ - PurpleConnection *gc = data->gc; - - purple_blist_request_add_buddy(purple_connection_get_account(gc), data->name, NULL, data->nick); - - oscar_free_name_data(data); -} - -static int -incomingim_chan4(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - gchar **msg1, **msg2; - int i, numtoks; - - if (!args->type || !args->msg || !args->uin) - return 1; - - purple_debug_info("oscar", - "Received a channel 4 message of type 0x%02hx.\n", - args->type); - - /* - * Split up the message at the delimeter character, then convert each - * string to UTF-8. Unless, of course, this is a type 1 message. If - * this is a type 1 message, then the delimiter 0xfe could be a valid - * character in whatever encoding the message was sent in. Type 1 - * messages are always made up of only one part, so we can easily account - * for this suck-ass part of the protocol by splitting the string into at - * most 1 baby string. - */ - msg1 = g_strsplit(args->msg, "\376", (args->type == 0x01 ? 1 : 0)); - for (numtoks=0; msg1[numtoks]; numtoks++); - msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); - for (i=0; msg1[i]; i++) { - gchar *uin = g_strdup_printf("%u", args->uin); - - purple_str_strip_char(msg1[i], '\r'); - /* TODO: Should use an encoding other than ASCII? */ - msg2[i] = purple_plugin_oscar_decode_im_part(account, uin, AIM_CHARSET_ASCII, 0x0000, msg1[i], strlen(msg1[i])); - g_free(uin); - } - msg2[i] = NULL; - - switch (args->type) { - case 0x01: { /* MacICQ message or basic offline message */ - if (i >= 1) { - gchar *uin = g_strdup_printf("%u", args->uin); - gchar *tmp; - - /* If the message came from an ICQ user then escape any HTML */ - tmp = g_markup_escape_text(msg2[0], -1); - - if (t) { /* This is an offline message */ - /* The timestamp is UTC-ish, so we need to get the offset */ -#ifdef HAVE_TM_GMTOFF - time_t now; - struct tm *tm; - now = time(NULL); - tm = localtime(&now); - t += tm->tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); - t -= timezone; -# endif -#endif - serv_got_im(gc, uin, tmp, 0, t); - } else { /* This is a message from MacICQ/Miranda */ - serv_got_im(gc, uin, tmp, 0, time(NULL)); - } - g_free(uin); - g_free(tmp); - } - } break; - - case 0x04: { /* Someone sent you a URL */ - if (i >= 2) { - if (msg2[1] != NULL) { - gchar *uin = g_strdup_printf("%u", args->uin); - gchar *message = g_strdup_printf("%s", - msg2[1], - (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); - serv_got_im(gc, uin, message, 0, time(NULL)); - g_free(uin); - g_free(message); - } - } - } break; - - case 0x06: { /* Someone requested authorization */ - if (i >= 6) { - struct name_data *data = g_new(struct name_data, 1); - gchar *bn = g_strdup_printf("%u", args->uin); - gchar *reason = NULL; - - if (msg2[5] != NULL) - reason = purple_plugin_oscar_decode_im_part(account, bn, AIM_CHARSET_LATIN_1, 0x0000, msg2[5], strlen(msg2[5])); - - purple_debug_info("oscar", - "Received an authorization request from UIN %u\n", - args->uin); - data->gc = gc; - data->name = bn; - data->nick = NULL; - - purple_account_request_authorization(account, bn, NULL, NULL, - reason, purple_find_buddy(account, bn) != NULL, - purple_auth_grant, - purple_auth_dontgrant_msgprompt, data); - g_free(reason); - } - } break; - - case 0x07: { /* Someone has denied you authorization */ - if (i >= 1) { - gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); - purple_notify_info(gc, NULL, _("ICQ authorization denied."), - dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x08: { /* Someone has granted you authorization */ - gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin); - purple_notify_info(gc, NULL, "ICQ authorization accepted.", - dialog_msg); - g_free(dialog_msg); - } break; - - case 0x09: { /* Message from the Godly ICQ server itself, I think */ - if (i >= 5) { - gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); - purple_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ - if (i >= 6) { - gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); - purple_notify_info(gc, NULL, "ICQ Page", dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ - if (i >= 6) { - gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]); - purple_notify_info(gc, NULL, "ICQ Email", dialog_msg); - g_free(dialog_msg); - } - } break; - - case 0x12: { - /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ - /* Someone added you to their buddy list? */ - } break; - - case 0x13: { /* Someone has sent you some ICQ buddies */ - guint i, num; - gchar **text; - text = g_strsplit(args->msg, "\376", 0); - if (text) { - /* Read the number of contacts that we were sent */ - errno = 0; - num = text[0] ? strtoul(text[0], NULL, 10) : 0; - - if (num > 0 && errno == 0) { - for (i=0; imsg, NULL); - purple_debug_error("oscar", "Unknown syntax parsing " - "ICQ buddies. args->msg=%s\n", tmp); - g_free(tmp); - break; - } - - message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); - - data = g_new(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(text[i*2+1]); - data->nick = g_strdup(text[i*2+2]); - - purple_request_action(gc, NULL, message, - _("Do you want to add this buddy " - "to your buddy list?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), data->name, NULL, - data, 2, - _("_Add"), G_CALLBACK(purple_icq_buddyadd), - _("_Decline"), G_CALLBACK(oscar_free_name_data)); - g_free(message); - } - } else { - gchar *tmp = g_strescape(args->msg, NULL); - purple_debug_error("oscar", "Unknown syntax parsing " - "ICQ buddies. args->msg=%s\n", tmp); - g_free(tmp); - } - g_strfreev(text); - } - } break; - - case 0x1a: { /* Handle SMS or someone has sent you a greeting card or requested buddies? */ - ByteStream qbs; - int smstype, taglen, smslen; - char *tagstr = NULL, *smsmsg = NULL; - xmlnode *xmlroot = NULL, *xmltmp = NULL; - gchar *uin = NULL, *message = NULL; - - /* From libicq2000-0.3.2/src/ICQ.cpp */ - byte_stream_init(&qbs, (guint8 *)args->msg, args->msglen); - byte_stream_advance(&qbs, 21); - /* expected: 01 00 00 20 00 0e 28 f6 00 11 e7 d3 11 bc f3 00 04 ac 96 9d c2 | 00 00 | 06 00 00 00 | 49 43 51 53 43 53 ...*/ - /* unexpected: 00 00 26 00 81 1a 18 bc 0e 6c 18 47 a5 91 6f 18 dc c7 6f 1a | 00 00 | 0d 00 00 00 | 49 43 51 57 65 62 4d 65 73 73 61 67 65 ... */ - smstype = byte_stream_getle16(&qbs); - if (smstype != 0) - break; - taglen = byte_stream_getle32(&qbs); - tagstr = byte_stream_getstr(&qbs, taglen); - if (tagstr == NULL) - break; - byte_stream_advance(&qbs, 3); - byte_stream_advance(&qbs, 4); - smslen = byte_stream_getle32(&qbs); - smsmsg = byte_stream_getstr(&qbs, smslen); - - /* Check if this is an SMS being sent from server */ - if ((smstype == 0) && (!strcmp(tagstr, "ICQSMS")) && (smsmsg != NULL)) - { - xmlroot = xmlnode_from_str(smsmsg, -1); - if (xmlroot != NULL) - { - xmltmp = xmlnode_get_child(xmlroot, "sender"); - if (xmltmp != NULL) - uin = xmlnode_get_data(xmltmp); - - xmltmp = xmlnode_get_child(xmlroot, "text"); - if (xmltmp != NULL) - message = xmlnode_get_data(xmltmp); - - if ((uin != NULL) && (message != NULL)) - serv_got_im(gc, uin, message, 0, time(NULL)); - - g_free(uin); - g_free(message); - xmlnode_free(xmlroot); - } - } - g_free(tagstr); - g_free(smsmsg); - } break; - - default: { - purple_debug_info("oscar", - "Received a channel 4 message of unknown type " - "(type 0x%02hhx).\n", args->type); - } break; - } - - g_strfreev(msg1); - g_strfreev(msg2); - - return 1; -} - -static int purple_parse_incoming_im(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - guint16 channel; - int ret = 0; - aim_userinfo_t *userinfo; - va_list ap; - - va_start(ap, fr); - channel = (guint16)va_arg(ap, unsigned int); - userinfo = va_arg(ap, aim_userinfo_t *); - - switch (channel) { - case 1: { /* standard message */ - struct aim_incomingim_ch1_args *args; - args = va_arg(ap, struct aim_incomingim_ch1_args *); - ret = incomingim_chan1(od, conn, userinfo, args); - } break; - - case 2: { /* rendezvous */ - IcbmArgsCh2 *args; - args = va_arg(ap, IcbmArgsCh2 *); - ret = incomingim_chan2(od, conn, userinfo, args); - } break; - - case 4: { /* ICQ */ - struct aim_incomingim_ch4_args *args; - args = va_arg(ap, struct aim_incomingim_ch4_args *); - ret = incomingim_chan4(od, conn, userinfo, args, 0); - } break; - - default: { - purple_debug_warning("oscar", - "ICBM received on unsupported channel (channel " - "0x%04hx).", channel); - } break; - } - - va_end(ap); - - return ret; -} - -static int purple_parse_misses(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char *buf; - va_list ap; - guint16 chan, nummissed, reason; - aim_userinfo_t *userinfo; - - va_start(ap, fr); - chan = (guint16)va_arg(ap, unsigned int); - userinfo = va_arg(ap, aim_userinfo_t *); - nummissed = (guint16)va_arg(ap, unsigned int); - reason = (guint16)va_arg(ap, unsigned int); - va_end(ap); - - switch(reason) { - case 0: /* Invalid (0) */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because it was invalid.", - "You missed %hu messages from %s because they were invalid.", - nummissed), - nummissed, - userinfo->bn); - break; - case 1: /* Message too large */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because it was too large.", - "You missed %hu messages from %s because they were too large.", - nummissed), - nummissed, - userinfo->bn); - break; - case 2: /* Rate exceeded */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because the rate limit has been exceeded.", - "You missed %hu messages from %s because the rate limit has been exceeded.", - nummissed), - nummissed, - userinfo->bn); - break; - case 3: /* Evil Sender */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because his/her warning level is too high.", - "You missed %hu messages from %s because his/her warning level is too high.", - nummissed), - nummissed, - userinfo->bn); - break; - case 4: /* Evil Receiver */ - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s because your warning level is too high.", - "You missed %hu messages from %s because your warning level is too high.", - nummissed), - nummissed, - userinfo->bn); - break; - default: - buf = g_strdup_printf( - dngettext(PACKAGE, - "You missed %hu message from %s for an unknown reason.", - "You missed %hu messages from %s for an unknown reason.", - nummissed), - nummissed, - userinfo->bn); - break; - } - - if (!purple_conv_present_error(userinfo->bn, account, buf)) - purple_notify_error(od->gc, NULL, buf, NULL); - g_free(buf); - - return 1; -} - -static int -purple_parse_clientauto_ch2(OscarData *od, const char *who, guint16 reason, const guchar *cookie) -{ - if (reason == 0x0003) - { - /* Rendezvous was refused. */ - PeerConnection *conn; - - conn = peer_connection_find_by_cookie(od, who, cookie); - - if (conn == NULL) - { - purple_debug_info("oscar", "Received a rendezvous cancel message " - "for a nonexistant connection from %s.\n", who); - } - else - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_REFUSED, NULL); - } - } - else - { - purple_debug_warning("oscar", "Received an unknown rendezvous " - "message from %s. Type 0x%04hx\n", who, reason); - } - - return 0; -} - -static int purple_parse_clientauto_ch4(OscarData *od, char *who, guint16 reason, guint32 state, char *msg) { - PurpleConnection *gc = od->gc; - - switch(reason) { - case 0x0003: { /* Reply from an ICQ status message request */ - char *statusmsg, **splitmsg; - PurpleNotifyUserInfo *user_info; - - /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ - statusmsg = oscar_icqstatus(state); - splitmsg = g_strsplit(msg, "\r\n", 0); - - user_info = purple_notify_user_info_new(); - - purple_notify_user_info_add_pair(user_info, _("UIN"), who); - purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("
", splitmsg)); - - g_free(statusmsg); - g_strfreev(splitmsg); - - purple_notify_userinfo(gc, who, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - } break; - - default: { - purple_debug_warning("oscar", - "Received an unknown client auto-response from %s. " - "Type 0x%04hx\n", who, reason); - } break; - } /* end of switch */ - - return 0; -} - -static int purple_parse_clientauto(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 chan, reason; - char *who; - - va_start(ap, fr); - chan = (guint16)va_arg(ap, unsigned int); - who = va_arg(ap, char *); - reason = (guint16)va_arg(ap, unsigned int); - - if (chan == 0x0002) { /* File transfer declined */ - guchar *cookie = va_arg(ap, guchar *); - return purple_parse_clientauto_ch2(od, who, reason, cookie); - } else if (chan == 0x0004) { /* ICQ message */ - guint32 state = 0; - char *msg = NULL; - if (reason == 0x0003) { - state = va_arg(ap, guint32); - msg = va_arg(ap, char *); - } - return purple_parse_clientauto_ch4(od, who, reason, state, msg); - } - - va_end(ap); - - return 1; -} - -static int purple_parse_genericerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 reason; - - va_start(ap, fr); - reason = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_error("oscar", - "snac threw error (reason 0x%04hx: %s)\n", reason, - (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); - return 1; -} - -static int purple_parse_msgerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; -#ifdef TODOFT - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleXfer *xfer; -#endif - va_list ap; - guint16 reason, errcode; - char *data, *reason_str, *buf; - - va_start(ap, fr); - reason = (guint16)va_arg(ap, unsigned int); - errcode = (guint16)va_arg(ap, unsigned int); - data = va_arg(ap, char *); - va_end(ap); - - purple_debug_error("oscar", - "Message error with data %s and reason %hu and errcode %hu\n", - (data != NULL ? data : ""), reason, errcode); - - if ((data == NULL) || (*data == '\0')) - /* We can't do anything if data is empty */ - return 1; - -#ifdef TODOFT - /* If this was a file transfer request, data is a cookie */ - if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { - purple_xfer_cancel_remote(xfer); - return 1; - } -#endif - - /* Data is assumed to be the destination bn */ - - reason_str = g_strdup((reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason")); - if (errcode != 0 && errcode < errcodereasonlen) - buf = g_strdup_printf(_("Unable to send message: %s (%s)"), reason_str, - _(errcodereason[errcode])); - else - buf = g_strdup_printf(_("Unable to send message: %s"), reason_str); - - if (!purple_conv_present_error(data, purple_connection_get_account(gc), buf)) { - g_free(buf); - if (errcode != 0 && errcode < errcodereasonlen) - buf = g_strdup_printf(_("Unable to send message to %s: %s (%s)"), - data ? data : "(unknown)", reason_str, - _(errcodereason[errcode])); - else - buf = g_strdup_printf(_("Unable to send message to %s: %s"), - data ? data : "(unknown)", reason_str); - purple_notify_error(od->gc, NULL, buf, reason_str); - } - g_free(buf); - g_free(reason_str); - - return 1; -} - -static int purple_parse_mtn(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 channel, event; - char *bn; - - va_start(ap, fr); - channel = (guint16) va_arg(ap, unsigned int); - bn = va_arg(ap, char *); - event = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - switch (event) { - case 0x0000: { /* Text has been cleared */ - serv_got_typing_stopped(gc, bn); - } break; - - case 0x0001: { /* Paused typing */ - serv_got_typing(gc, bn, 0, PURPLE_TYPED); - } break; - - case 0x0002: { /* Typing */ - serv_got_typing(gc, bn, 0, PURPLE_TYPING); - } break; - - case 0x000f: { /* Closed IM window */ - serv_got_typing_stopped(gc, bn); - } break; - - default: { - purple_debug_info("oscar", "Received unknown typing " - "notification message from %s. Channel is 0x%04x " - "and event is 0x%04hx.\n", bn, channel, event); - } break; - } - - return 1; -} - -/* - * We get this error when there was an error in the locate family. This - * happens when you request info of someone who is offline. - */ -static int purple_parse_locerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - gchar *buf; - va_list ap; - guint16 reason; - char *destn; - PurpleNotifyUserInfo *user_info; - - va_start(ap, fr); - reason = (guint16) va_arg(ap, unsigned int); - destn = va_arg(ap, char *); - va_end(ap); - - if (destn == NULL) - return 1; - - user_info = purple_notify_user_info_new(); - buf = g_strdup_printf(_("User information not available: %s"), (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason.")); - purple_notify_user_info_add_pair(user_info, NULL, buf); - purple_notify_userinfo(od->gc, destn, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - purple_conv_present_error(destn, purple_connection_get_account(od->gc), buf); - g_free(buf); - - return 1; -} - -static int purple_parse_userinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleNotifyUserInfo *user_info; - gchar *tmp = NULL, *info_utf8 = NULL; - va_list ap; - aim_userinfo_t *userinfo; - - va_start(ap, fr); - userinfo = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - user_info = purple_notify_user_info_new(); - - oscar_user_info_append_status(gc, user_info, /* PurpleBuddy */ NULL, userinfo, /* strip_html_tags */ FALSE); - - if ((userinfo->present & AIM_USERINFO_PRESENT_IDLE) && userinfo->idletime != 0) { - tmp = purple_str_seconds_to_string(userinfo->idletime*60); - oscar_user_info_add_pair(user_info, _("Idle"), tmp); - g_free(tmp); - } - - oscar_user_info_append_extra_info(gc, user_info, NULL, userinfo); - - if ((userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) && !oscar_util_valid_name_sms(userinfo->bn)) { - /* An SMS contact is always online; its Online Since value is not useful */ - time_t t = userinfo->onlinesince; - oscar_user_info_add_pair(user_info, _("Online Since"), purple_date_format_full(localtime(&t))); - } - - if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { - time_t t = userinfo->membersince; - oscar_user_info_add_pair(user_info, _("Member Since"), purple_date_format_full(localtime(&t))); - } - - if (userinfo->capabilities != 0) { - tmp = oscar_caps_to_string(userinfo->capabilities); - oscar_user_info_add_pair(user_info, _("Capabilities"), tmp); - g_free(tmp); - } - - /* Info */ - if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { - tmp = oscar_encoding_extract(userinfo->info_encoding); - info_utf8 = oscar_encoding_to_utf8(account, tmp, userinfo->info, - userinfo->info_len); - g_free(tmp); - if (info_utf8 != NULL) { - tmp = purple_str_sub_away_formatters(info_utf8, purple_account_get_username(account)); - purple_notify_user_info_add_section_break(user_info); - oscar_user_info_add_pair(user_info, _("Profile"), tmp); - g_free(tmp); - g_free(info_utf8); - } - } - - purple_notify_user_info_add_section_break(user_info); - tmp = g_strdup_printf("%s", - purple_normalize(account, userinfo->bn), _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - purple_notify_userinfo(gc, userinfo->bn, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - return 1; -} - -static int purple_parse_motd(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - char *msg; - guint16 id; - va_list ap; - - va_start(ap, fr); - id = (guint16) va_arg(ap, unsigned int); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_misc("oscar", - "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); - if (id < 4) - purple_notify_warning(od->gc, NULL, - _("Your AIM connection may be lost."), NULL); - - return 1; -} - -static int purple_chatnav_info(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 type; - - va_start(ap, fr); - type = (guint16) va_arg(ap, unsigned int); - - switch(type) { - case 0x0002: { - guint8 maxrooms; - struct aim_chat_exchangeinfo *exchanges; - int exchangecount, i; - - maxrooms = (guint8) va_arg(ap, unsigned int); - exchangecount = va_arg(ap, int); - exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); - - purple_debug_misc("oscar", "chat info: Chat Rights:\n"); - purple_debug_misc("oscar", - "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); - purple_debug_misc("oscar", - "chat info: \tExchange List: (%d total)\n", exchangecount); - for (i = 0; i < exchangecount; i++) - purple_debug_misc("oscar", - "chat info: \t\t%hu %s\n", - exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); - while (od->create_rooms) { - struct create_room *cr = od->create_rooms->data; - purple_debug_info("oscar", - "creating room %s\n", cr->name); - aim_chatnav_createroom(od, conn, cr->name, cr->exchange); - g_free(cr->name); - od->create_rooms = g_slist_remove(od->create_rooms, cr); - g_free(cr); - } - } - break; - case 0x0008: { - char *fqcn, *name, *ck; - guint16 instance, flags, maxmsglen, maxoccupancy, unknown, exchange; - guint8 createperms; - guint32 createtime; - - fqcn = va_arg(ap, char *); - instance = (guint16)va_arg(ap, unsigned int); - exchange = (guint16)va_arg(ap, unsigned int); - flags = (guint16)va_arg(ap, unsigned int); - createtime = va_arg(ap, guint32); - maxmsglen = (guint16)va_arg(ap, unsigned int); - maxoccupancy = (guint16)va_arg(ap, unsigned int); - createperms = (guint8)va_arg(ap, unsigned int); - unknown = (guint16)va_arg(ap, unsigned int); - name = va_arg(ap, char *); - ck = va_arg(ap, char *); - - purple_debug_misc("oscar", - "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", - fqcn ? fqcn : "(null)", exchange, instance, flags, createtime, - maxmsglen, maxoccupancy, createperms, unknown, - name ? name : "(null)", ck); - aim_chat_join(od, exchange, ck, instance); - } - break; - default: - purple_debug_warning("oscar", - "chatnav info: unknown type (%04hx)\n", type); - break; - } - - va_end(ap); - - return 1; -} - -static int purple_conv_chat_join(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - int count, i; - aim_userinfo_t *info; - PurpleConnection *gc = od->gc; - - struct chat_connection *c = NULL; - - va_start(ap, fr); - count = va_arg(ap, int); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - c = find_oscar_chat_by_conn(gc, conn); - if (!c) - return 1; - - for (i = 0; i < count; i++) - purple_conv_chat_add_user(PURPLE_CONV_CHAT(c->conv), info[i].bn, NULL, PURPLE_CBFLAGS_NONE, TRUE); - - return 1; -} - -static int purple_conv_chat_leave(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - int count, i; - aim_userinfo_t *info; - PurpleConnection *gc = od->gc; - - struct chat_connection *c = NULL; - - va_start(ap, fr); - count = va_arg(ap, int); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - c = find_oscar_chat_by_conn(gc, conn); - if (!c) - return 1; - - for (i = 0; i < count; i++) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c->conv), info[i].bn, NULL); - - return 1; -} - -static int purple_conv_chat_info_update(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - aim_userinfo_t *userinfo; - struct aim_chat_roominfo *roominfo; - char *roomname; - int usercount; - char *roomdesc; - guint16 unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; - guint32 creationtime; - PurpleConnection *gc = od->gc; - struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); - - if (!ccon) - return 1; - - va_start(ap, fr); - roominfo = va_arg(ap, struct aim_chat_roominfo *); - roomname = va_arg(ap, char *); - usercount= va_arg(ap, int); - userinfo = va_arg(ap, aim_userinfo_t *); - roomdesc = va_arg(ap, char *); - unknown_c9 = (guint16)va_arg(ap, unsigned int); - creationtime = va_arg(ap, guint32); - maxmsglen = (guint16)va_arg(ap, unsigned int); - unknown_d2 = (guint16)va_arg(ap, unsigned int); - unknown_d5 = (guint16)va_arg(ap, unsigned int); - maxvisiblemsglen = (guint16)va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", - maxmsglen, maxvisiblemsglen); - - ccon->maxlen = maxmsglen; - ccon->maxvis = maxvisiblemsglen; - - return 1; -} - -static int purple_conv_chat_incoming_msg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - struct chat_connection *ccon = find_oscar_chat_by_conn(gc, conn); - gchar *utf8; - va_list ap; - aim_userinfo_t *info; - int len; - char *msg; - char *charset; - - if (!ccon) - return 1; - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - len = va_arg(ap, int); - msg = va_arg(ap, char *); - charset = va_arg(ap, char *); - va_end(ap); - - utf8 = oscar_encoding_to_utf8(account, charset, msg, len); - if (utf8 == NULL) - /* The conversion failed! */ - utf8 = g_strdup(_("[Unable to display a message from this user because it contained invalid characters.]")); - serv_got_chat_in(gc, ccon->id, info->bn, 0, utf8, time((time_t)NULL)); - g_free(utf8); - - return 1; -} - -static int purple_email_parseupdate(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - PurpleConnection *gc; - PurpleAccount *account; - struct aim_emailinfo *emailinfo; - int havenewmail; - char *alertitle, *alerturl; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - emailinfo = va_arg(ap, struct aim_emailinfo *); - havenewmail = va_arg(ap, int); - alertitle = va_arg(ap, char *); - alerturl = va_arg(ap, char *); - va_end(ap); - - if (account != NULL && emailinfo != NULL && purple_account_get_check_mail(account) && - emailinfo->unread && havenewmail) { - gchar *to = g_strdup_printf("%s%s%s", - purple_account_get_username(account), - emailinfo->domain ? "@" : "", - emailinfo->domain ? emailinfo->domain : ""); - const char *tos[2] = { to }; - const char *urls[2] = { emailinfo->url }; - purple_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, - tos, urls, NULL, NULL); - g_free(to); - } - - if (alertitle) - purple_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); - - return 1; -} - -static int purple_icon_parseicon(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn; - guint8 iconcsumtype, *iconcsum, *icon; - guint16 iconcsumlen, iconlen; - - va_start(ap, fr); - bn = va_arg(ap, char *); - iconcsumtype = va_arg(ap, int); - iconcsum = va_arg(ap, guint8 *); - iconcsumlen = va_arg(ap, int); - icon = va_arg(ap, guint8 *); - iconlen = va_arg(ap, int); - va_end(ap); - - /* - * Some AIM clients will send a blank GIF image with iconlen 90 when - * no icon is set. Ignore these. - */ - if ((iconlen > 0) && (iconlen != 90)) { - char *b16 = purple_base16_encode(iconcsum, iconcsumlen); - purple_buddy_icons_set_for_user(purple_connection_get_account(gc), - bn, g_memdup(icon, iconlen), iconlen, b16); - g_free(b16); - } - - return 1; -} - -static void -purple_icons_fetch(PurpleConnection *gc) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - aim_userinfo_t *userinfo; - FlapConnection *conn; - - conn = flap_connection_getbytype(od, SNAC_FAMILY_BART); - if (!conn) { - if (!od->iconconnecting) { - aim_srv_requestnew(od, SNAC_FAMILY_BART); - od->iconconnecting = TRUE; - } - return; - } - - if (od->set_icon) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) { - aim_ssi_delicon(od); - } else { - purple_debug_info("oscar", - "Uploading icon to icon server\n"); - aim_bart_upload(od, purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_imgstore_unref(img); - } - od->set_icon = FALSE; - } - - while (od->requesticon != NULL) - { - userinfo = aim_locate_finduserinfo(od, (char *)od->requesticon->data); - if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) - aim_bart_request(od, od->requesticon->data, userinfo->iconcsumtype, userinfo->iconcsum, userinfo->iconcsumlen); - - g_free(od->requesticon->data); - od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); - } - - purple_debug_misc("oscar", "no more icons to request\n"); -} - -/* - * Received in response to an IM sent with the AIM_IMFLAGS_ACK option. - */ -static int purple_parse_msgack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 type; - char *bn; - - va_start(ap, fr); - type = (guint16) va_arg(ap, unsigned int); - bn = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", "Sent message to %s.\n", bn); - - return 1; -} - -static int purple_parse_evilnotify(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { -#ifdef CRAZY_WARNING - va_list ap; - guint16 newevil; - aim_userinfo_t *userinfo; - - va_start(ap, fr); - newevil = (guint16) va_arg(ap, unsigned int); - userinfo = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - purple_prpl_got_account_warning_level(account, (userinfo && userinfo->bn) ? userinfo->bn : NULL, (newevil/10.0) + 0.5); -#endif - - return 1; -} - -static int purple_selfinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - int warning_level; - va_list ap; - aim_userinfo_t *info; - - va_start(ap, fr); - info = va_arg(ap, aim_userinfo_t *); - va_end(ap); - - purple_connection_set_display_name(od->gc, info->bn); - - /* - * What's with the + 0.5? - * The 0.5 is basically poor-man's rounding. Normally - * casting "13.7" to an int will truncate to "13," but - * with 13.7 + 0.5 = 14.2, which becomes "14" when - * truncated. - */ - warning_level = info->warnlevel/10.0 + 0.5; - -#ifdef CRAZY_WARNING - purple_presence_set_warning_level(presence, warning_level); -#endif - - return 1; -} - -static int purple_connerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 code; - char *msg; - - va_start(ap, fr); - code = (guint16)va_arg(ap, int); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", "Disconnected. Code is 0x%04x and msg is %s\n", - code, (msg != NULL ? msg : "")); - - g_return_val_if_fail(conn != NULL, 1); - - if (conn->type == SNAC_FAMILY_CHAT) { - struct chat_connection *cc; - PurpleConversation *conv = NULL; - - cc = find_oscar_chat_by_conn(gc, conn); - if (cc != NULL) - { - conv = purple_find_chat(gc, cc->id); - - if (conv != NULL) - { - /* - * TOOD: Have flap_connection_destroy_cb() send us the - * error message stored in 'tmp', which should be - * human-friendly, and print that to the chat room. - */ - gchar *buf; - buf = g_strdup_printf(_("You have been disconnected from chat " - "room %s."), cc->name); - purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_ERROR, time(NULL)); - g_free(buf); - } - oscar_chat_kill(gc, cc); - } - } - - return 1; -} - -static int purple_parse_locaterights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - va_list ap; - guint16 maxsiglen; - - va_start(ap, fr); - maxsiglen = (guint16) va_arg(ap, int); - va_end(ap); - - purple_debug_misc("oscar", - "locate rights: max sig len = %d\n", maxsiglen); - - od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; - - aim_locate_setcaps(od, purple_caps); - oscar_set_info_and_status(account, TRUE, account->user_info, TRUE, - purple_account_get_active_status(account)); - - return 1; -} - -static int purple_parse_buddyrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - guint16 maxbuddies, maxwatchers; - - va_start(ap, fr); - maxbuddies = (guint16) va_arg(ap, unsigned int); - maxwatchers = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); - - od->rights.maxbuddies = (guint)maxbuddies; - od->rights.maxwatchers = (guint)maxwatchers; - - return 1; -} - -static int purple_bosrights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc; - PurpleAccount *account; - PurpleStatus *status; - gboolean is_available; - PurplePresence *presence; - const char *username, *message, *itmsurl; - char *tmp; - va_list ap; - guint16 maxpermits, maxdenies; - - gc = od->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - va_start(ap, fr); - maxpermits = (guint16) va_arg(ap, unsigned int); - maxdenies = (guint16) va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_misc("oscar", - "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); - - od->rights.maxpermits = (guint)maxpermits; - od->rights.maxdenies = (guint)maxdenies; - - purple_debug_info("oscar", "buddy list loaded\n"); - - if (purple_account_get_user_info(account) != NULL) - serv_set_info(gc, purple_account_get_user_info(account)); - - username = purple_account_get_username(account); - if (!od->icq && strcmp(username, purple_connection_get_display_name(gc)) != 0) - /* - * Format the username for AIM accounts if it's different - * than what's currently set. - */ - oscar_format_username(gc, username); - - /* Set our available message based on the current status */ - status = purple_account_get_active_status(account); - is_available = purple_status_is_available(status); - if (is_available) - message = purple_status_get_attr_string(status, "message"); - else - message = NULL; - tmp = purple_markup_strip_html(message); - itmsurl = purple_status_get_attr_string(status, "itmsurl"); - aim_srv_setextrainfo(od, FALSE, 0, is_available, tmp, itmsurl); - g_free(tmp); - - presence = purple_status_get_presence(status); - aim_srv_setidle(od, !purple_presence_is_idle(presence) ? 0 : time(NULL) - purple_presence_get_idle_time(presence)); - - if (od->icq) { -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS - aim_icq_reqofflinemsgs(od); -#endif - oscar_set_extendedstatus(gc); - aim_icq_setsecurity(od, - purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION), - purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)); - } - - aim_srv_requestnew(od, SNAC_FAMILY_ALERT); - aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); - - od->bos.have_rights = TRUE; - - /* - * If we've already received our feedbag data then we're not waiting on - * anything else, so send the server clientready. - * - * Normally we get bos rights before we get our feedbag data, so this - * rarely (never?) happens. And I'm not sure it actually matters if we - * wait for bos rights before calling clientready. But it seems safer - * to do it this way. - */ - if (od->ssi.received_data) { - aim_srv_clientready(od, conn); - - /* Request offline messages for AIM and ICQ */ - aim_im_reqofflinemsgs(od); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - } - - return 1; -} - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -static int purple_offlinemsg(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - struct aim_icq_offlinemsg *msg; - struct aim_incomingim_ch4_args args; - time_t t; - - va_start(ap, fr); - msg = va_arg(ap, struct aim_icq_offlinemsg *); - va_end(ap); - - purple_debug_info("oscar", - "Received offline message. Converting to channel 4 ICBM...\n"); - args.uin = msg->sender; - args.type = msg->type; - args.flags = msg->flags; - args.msglen = msg->msglen; - args.msg = msg->msg; - t = purple_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); - incomingim_chan4(od, conn, NULL, &args, t); - - return 1; -} - -static int purple_offlinemsgdone(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - aim_icq_ackofflinemsgs(od); - return 1; -} -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - -static int purple_icqinfo(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - PurpleBuddy *buddy; - struct buddyinfo *bi; - gchar who[16]; - PurpleNotifyUserInfo *user_info; - gchar *utf8; - gchar *buf; - const gchar *alias; - va_list ap; - struct aim_icq_info *info; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - info = va_arg(ap, struct aim_icq_info *); - va_end(ap); - - if (!info->uin) - return 0; - - user_info = purple_notify_user_info_new(); - - g_snprintf(who, sizeof(who), "%u", info->uin); - buddy = purple_find_buddy(account, who); - if (buddy != NULL) - bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, purple_buddy_get_name(buddy))); - else - bi = NULL; - - purple_notify_user_info_add_pair(user_info, _("UIN"), who); - oscar_user_info_convert_and_add(account, od, user_info, _("Nick"), info->nick); - if ((bi != NULL) && (bi->ipaddr != 0)) { - char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", - (bi->ipaddr & 0xff000000) >> 24, - (bi->ipaddr & 0x00ff0000) >> 16, - (bi->ipaddr & 0x0000ff00) >> 8, - (bi->ipaddr & 0x000000ff)); - purple_notify_user_info_add_pair(user_info, _("IP Address"), tstr); - g_free(tstr); - } - oscar_user_info_convert_and_add(account, od, user_info, _("First Name"), info->first); - oscar_user_info_convert_and_add(account, od, user_info, _("Last Name"), info->last); - if (info->email && info->email[0] && (utf8 = oscar_utf8_try_convert(account, od, info->email))) { - buf = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); - g_free(buf); - g_free(utf8); - } - if (info->numaddresses && info->email2) { - int i; - for (i = 0; i < info->numaddresses; i++) { - if (info->email2[i] && info->email2[i][0] && (utf8 = oscar_utf8_try_convert(account, od, info->email2[i]))) { - buf = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Email Address"), buf); - g_free(buf); - g_free(utf8); - } - } - } - oscar_user_info_convert_and_add(account, od, user_info, _("Mobile Phone"), info->mobile); - - if (info->gender != 0) - purple_notify_user_info_add_pair(user_info, _("Gender"), (info->gender == 1 ? _("Female") : _("Male"))); - - if ((info->birthyear > 1900) && (info->birthmonth > 0) && (info->birthday > 0)) { - /* Initialize the struct properly or strftime() will crash - * under some conditions (e.g. Debian sarge w/ LANG=en_HK). */ - time_t t = time(NULL); - struct tm *tm = localtime(&t); - - tm->tm_mday = (int)info->birthday; - tm->tm_mon = (int)info->birthmonth - 1; - tm->tm_year = (int)info->birthyear - 1900; - - /* To be 100% sure that the fields are re-normalized. - * If you're sure strftime() ALWAYS does this EVERYWHERE, - * feel free to remove it. --rlaager */ - mktime(tm); - - oscar_user_info_convert_and_add(account, od, user_info, _("Birthday"), purple_date_format_short(tm)); - } - if ((info->age > 0) && (info->age < 255)) { - char age[5]; - snprintf(age, sizeof(age), "%hhd", info->age); - purple_notify_user_info_add_pair(user_info, _("Age"), age); - } - if (info->personalwebpage && info->personalwebpage[0] && (utf8 = oscar_utf8_try_convert(account, od, info->personalwebpage))) { - buf = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Personal Web Page"), buf); - g_free(buf); - g_free(utf8); - } - - if (buddy != NULL) - oscar_user_info_append_status(gc, user_info, buddy, /* aim_userinfo_t */ NULL, /* strip_html_tags */ FALSE); - - oscar_user_info_convert_and_add(account, od, user_info, _("Additional Information"), info->info); - purple_notify_user_info_add_section_break(user_info); - - if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { - purple_notify_user_info_add_section_header(user_info, _("Home Address")); - - oscar_user_info_convert_and_add(account, od, user_info, _("Address"), info->homeaddr); - oscar_user_info_convert_and_add(account, od, user_info, _("City"), info->homecity); - oscar_user_info_convert_and_add(account, od, user_info, _("State"), info->homestate); - oscar_user_info_convert_and_add(account, od, user_info, _("Zip Code"), info->homezip); - } - if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { - purple_notify_user_info_add_section_header(user_info, _("Work Address")); - - oscar_user_info_convert_and_add(account, od, user_info, _("Address"), info->workaddr); - oscar_user_info_convert_and_add(account, od, user_info, _("City"), info->workcity); - oscar_user_info_convert_and_add(account, od, user_info, _("State"), info->workstate); - oscar_user_info_convert_and_add(account, od, user_info, _("Zip Code"), info->workzip); - } - if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { - purple_notify_user_info_add_section_header(user_info, _("Work Information")); - - oscar_user_info_convert_and_add(account, od, user_info, _("Company"), info->workcompany); - oscar_user_info_convert_and_add(account, od, user_info, _("Division"), info->workdivision); - oscar_user_info_convert_and_add(account, od, user_info, _("Position"), info->workposition); - - if (info->workwebpage && info->workwebpage[0] && (utf8 = oscar_utf8_try_convert(account, od, info->workwebpage))) { - char *webpage = g_strdup_printf("%s", utf8, utf8); - purple_notify_user_info_add_pair(user_info, _("Web Page"), webpage); - g_free(webpage); - g_free(utf8); - } - } - - if (buddy != NULL) - alias = purple_buddy_get_alias(buddy); - else - alias = who; - purple_notify_userinfo(gc, who, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - return 1; -} - -static int purple_icqalias(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - gchar who[16], *utf8; - PurpleBuddy *b; - va_list ap; - struct aim_icq_info *info; - - va_start(ap, fr); - info = va_arg(ap, struct aim_icq_info *); - va_end(ap); - - if (info->uin && info->nick && info->nick[0] && (utf8 = oscar_utf8_try_convert(account, od, info->nick))) { - g_snprintf(who, sizeof(who), "%u", info->uin); - serv_got_alias(gc, who, utf8); - if ((b = purple_find_buddy(account, who))) { - purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8); - } - g_free(utf8); - } - - return 1; -} - -static int purple_popup(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - gchar *text; - va_list ap; - char *msg, *url; - guint16 wid, hei, delay; - - va_start(ap, fr); - msg = va_arg(ap, char *); - url = va_arg(ap, char *); - wid = (guint16) va_arg(ap, int); - hei = (guint16) va_arg(ap, int); - delay = (guint16) va_arg(ap, int); - va_end(ap); - - text = g_strdup_printf("%s
%s", msg, url, url); - purple_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); - g_free(text); - - return 1; -} - -static void oscar_searchresults_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) -{ - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 0), NULL, NULL); -} - -static int purple_parse_searchreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc = od->gc; - PurpleNotifySearchResults *results; - PurpleNotifySearchColumn *column; - gchar *secondary; - int i, num; - va_list ap; - char *email, *usernames; - - va_start(ap, fr); - email = va_arg(ap, char *); - num = va_arg(ap, int); - usernames = va_arg(ap, char *); - va_end(ap); - - results = purple_notify_searchresults_new(); - - if (results == NULL) { - purple_debug_error("oscar", "purple_parse_searchreply: " - "Unable to display the search results.\n"); - purple_notify_error(gc, NULL, - _("Unable to display the search results."), - NULL); - return 1; - } - - secondary = g_strdup_printf( - dngettext(PACKAGE, "The following username is associated with %s", - "The following usernames are associated with %s", - num), - email); - - column = purple_notify_searchresults_column_new(_("Username")); - purple_notify_searchresults_column_add(results, column); - - for (i = 0; i < num; i++) { - GList *row; - row = g_list_append(NULL, g_strdup(&usernames[i * (MAXSNLEN + 1)])); - purple_notify_searchresults_row_add(results, row); - } - purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, - oscar_searchresults_add_buddy_cb); - purple_notify_searchresults(gc, NULL, NULL, secondary, results, NULL, NULL); - - g_free(secondary); - - return 1; -} - -static int purple_parse_searcherror(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - va_list ap; - char *email; - char *buf; - - va_start(ap, fr); - email = va_arg(ap, char *); - va_end(ap); - - buf = g_strdup_printf(_("No results found for email address %s"), email); - purple_notify_error(od->gc, NULL, buf, NULL); - g_free(buf); - - return 1; -} - -static int purple_account_confirm(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - guint16 status; - va_list ap; - char msg[256]; - - va_start(ap, fr); - status = (guint16) va_arg(ap, unsigned int); /* status code of confirmation request */ - va_end(ap); - - purple_debug_info("oscar", - "account confirmation returned status 0x%04x (%s)\n", status, - status ? "unknown" : "email sent"); - if (!status) { - g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), - purple_account_get_username(purple_connection_get_account(gc))); - purple_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); - } - - return 1; -} - -static int purple_info_change(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 perms, err; - char *url, *bn, *email; - int change; - - va_start(ap, fr); - change = va_arg(ap, int); - perms = (guint16) va_arg(ap, unsigned int); - err = (guint16) va_arg(ap, unsigned int); - url = va_arg(ap, char *); - bn = va_arg(ap, char *); - email = va_arg(ap, char *); - va_end(ap); - - purple_debug_misc("oscar", - "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, bn=%s, email=%s\n", - change ? "change" : "request", perms, err, - (url != NULL) ? url : "(null)", - (bn != NULL) ? bn : "(null)", - (email != NULL) ? email : "(null)"); - - if ((err > 0) && (url != NULL)) { - char *dialog_msg; - - if (err == 0x0001) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format username because the requested name differs from the original."), err); - else if (err == 0x0006) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format username because it is invalid."), err); - else if (err == 0x00b) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format username because the requested name is too long."), err); - else if (err == 0x001d) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because there is already a request pending for this username."), err); - else if (err == 0x0021) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address has too many usernames associated with it."), err); - else if (err == 0x0023) - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); - else - dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); - purple_notify_error(gc, NULL, - _("Error Changing Account Info"), dialog_msg); - g_free(dialog_msg); - return 1; - } - - if (email != NULL) { - char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), - purple_account_get_username(purple_connection_get_account(gc)), email); - purple_notify_info(gc, NULL, _("Account Info"), dialog_msg); - g_free(dialog_msg); - } - - return 1; -} - -void -oscar_keepalive(PurpleConnection *gc) -{ - OscarData *od; - FlapConnection *conn; - - od = purple_connection_get_protocol_data(gc); - conn = flap_connection_getbytype(od, SNAC_FAMILY_LOCATE); - if (conn != NULL) - flap_connection_send_keepalive(od, conn); -} - -unsigned int -oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) -{ - OscarData *od; - PeerConnection *conn; - - od = purple_connection_get_protocol_data(gc); - conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); - - if ((conn != NULL) && (conn->ready)) - { - peer_odc_send_typing(conn, state); - } - else { - /* Don't send if this turkey is in our deny list */ - GSList *list; - for (list=gc->account->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); - if (!list) { - struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(gc->account, name)); - if (bi && bi->typingnot) { - if (state == PURPLE_TYPING) - aim_im_sendmtn(od, 0x0001, name, 0x0002); - else if (state == PURPLE_TYPED) - aim_im_sendmtn(od, 0x0001, name, 0x0001); - else - aim_im_sendmtn(od, 0x0001, name, 0x0000); - } - } - } - return 0; -} - -/* TODO: Move this into odc.c! */ -static void -purple_odc_send_im(PeerConnection *conn, const char *message, PurpleMessageFlags imflags) -{ - GString *msg; - GString *data; - gchar *tmp; - int tmplen; - guint16 charset, charsubset; - GData *attribs; - const char *start, *end, *last; - int oscar_id = 0; - - msg = g_string_new(""); - data = g_string_new(""); - last = message; - - /* for each valid IMG tag... */ - while (last && *last && purple_markup_find_tag("img", last, &start, &end, &attribs)) - { - PurpleStoredImage *image = NULL; - const char *id; - - if (start - last) { - g_string_append_len(msg, last, start - last); - } - - id = g_datalist_get_data(&attribs, "id"); - - /* ... if it refers to a valid purple image ... */ - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - /* ... append the message from start to the tag ... */ - unsigned long size = purple_imgstore_get_size(image); - const char *filename = purple_imgstore_get_filename(image); - gconstpointer imgdata = purple_imgstore_get_data(image); - - oscar_id++; - - /* ... insert a new img tag with the oscar id ... */ - if (filename) - g_string_append_printf(msg, - "", - filename, oscar_id, size); - else - g_string_append_printf(msg, - "", - oscar_id, size); - - /* ... and append the data to the binary section ... */ - g_string_append_printf(data, "", - oscar_id, size); - g_string_append_len(data, imgdata, size); - g_string_append(data, ""); - } - /* If the tag is invalid, skip it, thus no else here */ - - g_datalist_clear(&attribs); - - /* continue from the end of the tag */ - last = end + 1; - } - - /* append any remaining message data */ - if (last && *last) - g_string_append(msg, last); - - g_string_append(msg, ""); - - /* Convert the message to a good encoding */ - purple_plugin_oscar_convert_to_best_encoding(conn->od->gc, - conn->bn, msg->str, &tmp, &tmplen, &charset, &charsubset); - g_string_free(msg, TRUE); - msg = g_string_new_len(tmp, tmplen); - g_free(tmp); - - /* Append any binary data that we may have */ - if (oscar_id) { - msg = g_string_append_len(msg, data->str, data->len); - msg = g_string_append(msg, ""); - } - g_string_free(data, TRUE); - - purple_debug_info("oscar", "sending direct IM %s using charset %i", msg->str, charset); - - peer_odc_send_im(conn, msg->str, msg->len, charset, - imflags & PURPLE_MESSAGE_AUTO_RESP); - g_string_free(msg, TRUE); -} - -int -oscar_send_im(PurpleConnection *gc, const char *name, const char *message, PurpleMessageFlags imflags) -{ - OscarData *od; - PurpleAccount *account; - PeerConnection *conn; - int ret; - char *tmp1, *tmp2; - gboolean is_sms, is_html; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - ret = 0; - - is_sms = oscar_util_valid_name_sms(name); - - if (od->icq && is_sms) { - /* - * We're sending to a phone number and this is ICQ, - * so send the message as an SMS using aim_icq_sendsms() - */ - int ret; - purple_debug_info("oscar", "Sending SMS to %s.\n", name); - ret = aim_icq_sendsms(od, name, message, purple_account_get_username(account)); - return (ret >= 0 ? 1 : ret); - } - - if (imflags & PURPLE_MESSAGE_AUTO_RESP) - tmp1 = purple_str_sub_away_formatters(message, name); - else - tmp1 = g_strdup(message); - - conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); - if ((conn != NULL) && (conn->ready)) - { - /* If we're directly connected, send a direct IM */ - purple_debug_info("oscar", "Sending direct IM with flags %i\n", imflags); - purple_odc_send_im(conn, tmp1, imflags); - } else { - struct buddyinfo *bi; - struct aim_sendimext_args args; - PurpleConversation *conv; - PurpleStoredImage *img; - PurpleBuddy *buddy; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); - - if (strstr(tmp1, "buddyinfo, purple_normalize(account, name)); - if (!bi) { - bi = g_new0(struct buddyinfo, 1); - g_hash_table_insert(od->buddyinfo, g_strdup(purple_normalize(account, name)), bi); - } - - args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; - - if (!is_sms && (!buddy || !PURPLE_BUDDY_IS_ONLINE(buddy))) - args.flags |= AIM_IMFLAGS_OFFLINE; - - if (od->icq) { - /* We have to present different "features" (whose meaning - is unclear and are merely a result of protocol inspection) - to offline ICQ buddies. Otherwise, the official - ICQ client doesn't treat those messages as being "ANSI- - encoded" (and instead, assumes them to be UTF-8). - For more details, see SF issue 1179452. - */ - if (buddy && PURPLE_BUDDY_IS_ONLINE(buddy)) { - args.features = features_icq; - args.featureslen = sizeof(features_icq); - } else { - args.features = features_icq_offline; - args.featureslen = sizeof(features_icq_offline); - } - } else { - args.features = features_aim; - args.featureslen = sizeof(features_aim); - - if (imflags & PURPLE_MESSAGE_AUTO_RESP) - args.flags |= AIM_IMFLAGS_AWAY; - } - - if (bi->ico_need) { - purple_debug_info("oscar", - "Sending buddy icon request with message\n"); - args.flags |= AIM_IMFLAGS_BUDDYREQ; - bi->ico_need = FALSE; - } - - img = purple_buddy_icons_find_account_icon(account); - if (img) { - gconstpointer data = purple_imgstore_get_data(img); - args.iconlen = purple_imgstore_get_size(img); - args.iconsum = aimutil_iconsum(data, args.iconlen); - args.iconstamp = purple_buddy_icons_get_account_icon_timestamp(account); - - if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { - bi->ico_informed = FALSE; - bi->ico_sent = FALSE; - } - - /* - * TODO: - * For some reason sending our icon to people only works - * when we're the ones who initiated the conversation. If - * the other person sends the first IM then they never get - * the icon. We should fix that. - */ - if (!bi->ico_informed) { - purple_debug_info("oscar", - "Claiming to have a buddy icon\n"); - args.flags |= AIM_IMFLAGS_HASICON; - bi->ico_me_len = args.iconlen; - bi->ico_me_csum = args.iconsum; - bi->ico_me_time = args.iconstamp; - bi->ico_informed = TRUE; - } - - purple_imgstore_unref(img); - } - - args.destbn = name; - - /* - * If we're IMing an SMS user or an ICQ user from an ICQ account, then strip HTML. - */ - if (oscar_util_valid_name_sms(name)) { - /* Messaging an SMS (mobile) user */ - tmp2 = purple_markup_strip_html(tmp1); - is_html = FALSE; - } else if (od->icq) { - if (oscar_util_valid_name_icq(name)) { - /* From ICQ to ICQ */ - tmp2 = purple_markup_strip_html(tmp1); - is_html = FALSE; - } else { - /* From ICQ to AIM */ - tmp2 = g_strdup(tmp1); - is_html = TRUE; - } - } else { - /* From AIM to AIM and AIM to ICQ */ - tmp2 = g_strdup(tmp1); - is_html = TRUE; - } - g_free(tmp1); - tmp1 = tmp2; - - purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset); - if (is_html && (args.msglen > MAXMSGLEN)) { - /* If the length was too long, try stripping the HTML and then running it back through - * purple_strdup_withhtml() and the encoding process. The result may be shorter. */ - g_free((char *)args.msg); - - tmp2 = purple_markup_strip_html(tmp1); - g_free(tmp1); - - /* re-escape the entities */ - tmp1 = g_markup_escape_text(tmp2, -1); - g_free(tmp2); - - tmp2 = purple_strdup_withhtml(tmp1); - g_free(tmp1); - tmp1 = tmp2; - - purple_plugin_oscar_convert_to_best_encoding(gc, name, tmp1, (char **)&args.msg, &args.msglen, &args.charset, &args.charsubset); - - purple_debug_info("oscar", "Sending %s as %s because the original was too long.\n", - message, (char *)args.msg); - } - - purple_debug_info("oscar", "Sending IM, charset=0x%04hx, charsubset=0x%04hx, length=%d\n", - args.charset, args.charsubset, args.msglen); - ret = aim_im_sendch1_ext(od, &args); - g_free((char *)args.msg); - } - - g_free(tmp1); - - if (ret >= 0) - return 1; - - return ret; -} - -/* - * As of 26 June 2006, ICQ users can request AIM info from - * everyone, and can request ICQ info from ICQ users, and - * AIM users can only request AIM info. - */ -void oscar_get_info(PurpleConnection *gc, const char *name) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->icq && oscar_util_valid_name_icq(name)) - aim_icq_getallinfo(od, name); - else - aim_locate_getinfoshort(od, name, 0x00000003); -} - -#if 0 -static void oscar_set_dir(PurpleConnection *gc, const char *first, const char *middle, const char *last, - const char *maiden, const char *city, const char *state, const char *country, int web) { - /* XXX - some of these things are wrong, but i'm lazy */ - OscarData *od = purple_connection_get_protocol_data(gc); - aim_locate_setdirinfo(od, first, middle, last, - maiden, NULL, NULL, city, state, NULL, 0, web); -} -#endif - -void oscar_set_idle(PurpleConnection *gc, int time) { - OscarData *od = purple_connection_get_protocol_data(gc); - aim_srv_setidle(od, time); -} - -static -gchar *purple_prpl_oscar_convert_to_infotext(const gchar *str, gsize *ret_len, char **encoding) -{ - int charset = 0; - char *encoded = NULL; - - charset = oscar_charset_check(str); - if (charset == AIM_CHARSET_UNICODE) { - encoded = g_convert(str, -1, "UTF-16BE", "UTF-8", NULL, ret_len, NULL); - *encoding = "unicode-2-0"; - } else if (charset == AIM_CHARSET_LATIN_1) { - encoded = g_convert(str, -1, "ISO-8859-1", "UTF-8", NULL, ret_len, NULL); - *encoding = "iso-8859-1"; - } else { - encoded = g_strdup(str); - *ret_len = strlen(str); - *encoding = "us-ascii"; - } - - return encoded; -} - -void -oscar_set_info(PurpleConnection *gc, const char *rawinfo) -{ - PurpleAccount *account; - PurpleStatus *status; - - account = purple_connection_get_account(gc); - status = purple_account_get_active_status(account); - oscar_set_info_and_status(account, TRUE, rawinfo, FALSE, status); -} - -static void -oscar_set_extendedstatus(PurpleConnection *gc) -{ - OscarData *od; - PurpleAccount *account; - PurpleStatus *status; - const gchar *status_id; - guint32 data = 0x00000000; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - status = purple_account_get_active_status(account); - status_id = purple_status_get_id(status); - - data |= AIM_ICQ_STATE_HIDEIP; - if (purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE)) - data |= AIM_ICQ_STATE_WEBAWARE; - - if (!strcmp(status_id, OSCAR_STATUS_ID_AVAILABLE)) - data |= AIM_ICQ_STATE_NORMAL; - else if (!strcmp(status_id, OSCAR_STATUS_ID_AWAY)) - data |= AIM_ICQ_STATE_AWAY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_DND)) - data |= AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_NA)) - data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_OCCUPIED)) - data |= AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; - else if (!strcmp(status_id, OSCAR_STATUS_ID_FREE4CHAT)) - data |= AIM_ICQ_STATE_CHAT; - else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE)) - data |= AIM_ICQ_STATE_INVISIBLE; - else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) - data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; - - aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL); -} - -static void -oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, - gboolean setstatus, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleStatusType *status_type; - PurpleStatusPrimitive primitive; - - char *info_encoding = NULL; - char *info = NULL; - gsize infolen = 0; - - char *away_encoding = NULL; - char *away = NULL; - gsize awaylen = 0; - - char *status_text = NULL; - const char *itmsurl = NULL; - - status_type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(status_type); - - if (!setinfo) - { - /* Do nothing! */ - } - else if (od->rights.maxsiglen == 0) - { - purple_notify_warning(gc, NULL, _("Unable to set AIM profile."), - _("You have probably requested to set your " - "profile before the login procedure completed. " - "Your profile remains unset; try setting it " - "again when you are fully connected.")); - } - else if (rawinfo != NULL) - { - char *htmlinfo = purple_strdup_withhtml(rawinfo); - info = purple_prpl_oscar_convert_to_infotext(htmlinfo, &infolen, &info_encoding); - g_free(htmlinfo); - - if (infolen > od->rights.maxsiglen) - { - gchar *errstr; - errstr = g_strdup_printf(dngettext(PACKAGE, "The maximum profile length of %d byte " - "has been exceeded. It has been truncated for you.", - "The maximum profile length of %d bytes " - "has been exceeded. It has been truncated for you.", - od->rights.maxsiglen), od->rights.maxsiglen); - purple_notify_warning(gc, NULL, _("Profile too long."), errstr); - g_free(errstr); - } - } - - if (setstatus) - { - const char *status_html; - - status_html = purple_status_get_attr_string(status, "message"); - - if (status_html == NULL || primitive == PURPLE_STATUS_AVAILABLE || primitive == PURPLE_STATUS_INVISIBLE) - { - /* This is needed for us to un-set any previous away message. */ - away = g_strdup(""); - } - else - { - gchar *linkified; - - /* We do this for icq too so that they work for old third party clients */ - linkified = purple_markup_linkify(status_html); - away = purple_prpl_oscar_convert_to_infotext(linkified, &awaylen, &away_encoding); - g_free(linkified); - - if (awaylen > od->rights.maxawaymsglen) - { - gchar *errstr; - - errstr = g_strdup_printf(dngettext(PACKAGE, "The maximum away message length of %d byte " - "has been exceeded. It has been truncated for you.", - "The maximum away message length of %d bytes " - "has been exceeded. It has been truncated for you.", - od->rights.maxawaymsglen), od->rights.maxawaymsglen); - purple_notify_warning(gc, NULL, _("Away message too long."), errstr); - g_free(errstr); - } - } - } - - aim_locate_setprofile(od, - info_encoding, info, MIN(infolen, od->rights.maxsiglen), - away_encoding, away, MIN(awaylen, od->rights.maxawaymsglen)); - g_free(info); - g_free(away); - - if (setstatus) - { - const char *status_html; - - status_html = purple_status_get_attr_string(status, "message"); - if (od->icq && (status_html == NULL || status_html[0] == '\0')) - status_html = purple_status_type_get_name(status_type); - if (status_html != NULL) - { - status_text = purple_markup_strip_html(status_html); - /* If the status_text is longer than 251 characters then truncate it */ - if (strlen(status_text) > MAXAVAILMSGLEN) - { - char *tmp = g_utf8_find_prev_char(status_text, &status_text[MAXAVAILMSGLEN - 2]); - strcpy(tmp, "..."); - } - } - - itmsurl = purple_status_get_attr_string(status, "itmsurl"); - - /* TODO: Combine these two calls! */ - aim_srv_setextrainfo(od, FALSE, 0, TRUE, status_text, itmsurl); - oscar_set_extendedstatus(gc); - g_free(status_text); - } -} - -static void -oscar_set_status_icq(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - - /* Our permit/deny setting affects our invisibility */ - oscar_set_permit_deny(gc); - - /* - * TODO: I guess we should probably wait and do this after we get - * confirmation from the above SSI call? Right now other people - * see our status blip to "invisible" before we appear offline. - */ - oscar_set_extendedstatus(gc); -} - -void -oscar_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *pc; - OscarData *od; - - purple_debug_info("oscar", "Set status to %s\n", purple_status_get_name(status)); - - if (!purple_status_is_active(status)) - return; - - if (!purple_account_is_connected(account)) - return; - - pc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(pc); - - /* Set the AIM-style away message for both AIM and ICQ accounts */ - oscar_set_info_and_status(account, FALSE, NULL, TRUE, status); - - /* Set the ICQ status for ICQ accounts only */ - if (od->icq) - oscar_set_status_icq(account); -} - -#ifdef CRAZY_WARN -void -oscar_warn(PurpleConnection *gc, const char *name, gboolean anonymous) { - OscarData *od = purple_connection_get_protocol_data(gc); - aim_im_warn(od, od->conn, name, anonymous ? AIM_WARN_ANON : 0); -} -#endif - -void -oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - OscarData *od; - PurpleAccount *account; - const char *bname, *gname; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - bname = purple_buddy_get_name(buddy); - gname = purple_group_get_name(group); - - if (!oscar_util_valid_name(bname)) { - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because the username is invalid. Usernames must be a valid email address, or start with a letter and contain only letters, numbers and spaces, or contain only numbers."), bname); - if (!purple_conv_present_error(bname, account, buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - - /* Remove from local list */ - purple_blist_remove_buddy(buddy); - - return; - } - - if (od->ssi.received_data) { - if (!aim_ssi_itemlist_finditem(od->ssi.local, gname, bname, AIM_SSI_TYPE_BUDDY)) { - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s\n", bname, gname); - aim_ssi_addbuddy(od, bname, gname, NULL, purple_buddy_get_alias_only(buddy), NULL, NULL, 0); - - /* Mobile users should always be online */ - if (bname[0] == '+') { - purple_prpl_got_user_status(account, bname, - OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, bname, - OSCAR_STATUS_ID_MOBILE, NULL); - } - } else if (aim_ssi_waitingforauth(od->ssi.local, - aim_ssi_itemlist_findparentname(od->ssi.local, bname), - bname)) { - /* Not authorized -- Re-request authorization */ - purple_auth_sendrequest(gc, bname); - } - } - - /* XXX - Should this be done from AIM accounts, as well? */ - if (od->icq) - aim_icq_getalias(od, bname); -} - -void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - const char *gname = purple_group_get_name(group); - const char *bname = purple_buddy_get_name(buddy); - purple_debug_info("oscar", - "ssi: deleting buddy %s from group %s\n", bname, gname); - aim_ssi_delbuddy(od, bname, gname); - } -} - -void oscar_move_buddy(PurpleConnection *gc, const char *name, const char *old_group, const char *new_group) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data && strcmp(old_group, new_group)) { - purple_debug_info("oscar", - "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); - aim_ssi_movebuddy(od, old_group, new_group, name); - } -} - -void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - if (gname) { - purple_debug_info("oscar", - "ssi: changing the alias for buddy %s to %s\n", name, alias ? alias : "(none)"); - aim_ssi_aliasbuddy(od, gname, name, alias); - } - } -} - -/* - * FYI, the OSCAR SSI code removes empty groups automatically. - */ -void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->ssi.received_data) { - const char *gname = purple_group_get_name(group); - if (aim_ssi_itemlist_finditem(od->ssi.local, gname, NULL, AIM_SSI_TYPE_GROUP)) { - GList *cur, *groups = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - - /* Make a list of what the groups each buddy is in */ - for (cur = moved_buddies; cur != NULL; cur = cur->next) { - PurpleBlistNode *node = cur->data; - /* node is PurpleBuddy, parent is a PurpleContact. - * We must go two levels up to get the Group */ - groups = g_list_append(groups, - purple_buddy_get_group((PurpleBuddy*)node)); - } - - purple_account_remove_buddies(account, moved_buddies, groups); - purple_account_add_buddies(account, moved_buddies); - g_list_free(groups); - purple_debug_info("oscar", - "ssi: moved all buddies from group %s to %s\n", old_name, gname); - } else { - aim_ssi_rename_group(od, old_name, gname); - purple_debug_info("oscar", - "ssi: renamed group %s to %s\n", old_name, gname); - } - } -} - -void oscar_remove_group(PurpleConnection *gc, PurpleGroup *group) -{ - aim_ssi_delgroup(purple_connection_get_protocol_data(gc), purple_group_get_name(group)); -} - -static gboolean purple_ssi_rerequestdata(gpointer data) { - OscarData *od = data; - - aim_ssi_reqdata(od); - - return TRUE; -} - -static int purple_ssi_parseerr(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 reason; - - va_start(ap, fr); - reason = (guint16)va_arg(ap, unsigned int); - va_end(ap); - - purple_debug_error("oscar", "ssi: SNAC error %hu\n", reason); - - if (reason == 0x0005) { - if (od->getblisttimer > 0) - purple_timeout_remove(od->getblisttimer); - else - /* We only show this error the first time it happens */ - purple_notify_error(gc, NULL, - _("Unable to Retrieve Buddy List"), - _("The AIM servers were temporarily unable to send " - "your buddy list. Your buddy list is not lost, and " - "will probably become available in a few minutes.")); - od->getblisttimer = purple_timeout_add_seconds(30, purple_ssi_rerequestdata, od); - return 1; - } - - oscar_set_status_icq(purple_connection_get_account(gc)); - - return 1; -} - -static int purple_ssi_parserights(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - int i; - va_list ap; - int numtypes; - guint16 *maxitems; - GString *msg; - - va_start(ap, fr); - numtypes = va_arg(ap, int); - maxitems = va_arg(ap, guint16 *); - va_end(ap); - - msg = g_string_new("ssi rights:"); - for (i=0; istr); - g_string_free(msg, TRUE); - - if (numtypes >= 0) - od->rights.maxbuddies = maxitems[0]; - if (numtypes >= 1) - od->rights.maxgroups = maxitems[1]; - if (numtypes >= 2) - od->rights.maxpermits = maxitems[2]; - if (numtypes >= 3) - od->rights.maxdenies = maxitems[3]; - - return 1; -} - -static int purple_ssi_parselist(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - PurpleGroup *g; - PurpleBuddy *b; - struct aim_ssi_item *curitem; - guint32 tmp; - PurpleStoredImage *img; - va_list ap; - guint16 fmtver, numitems; - guint32 timestamp; - - gc = od->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - va_start(ap, fr); - fmtver = (guint16)va_arg(ap, int); - numitems = (guint16)va_arg(ap, int); - timestamp = va_arg(ap, guint32); - va_end(ap); - - /* Don't attempt to re-request our buddy list later */ - if (od->getblisttimer != 0) - purple_timeout_remove(od->getblisttimer); - od->getblisttimer = 0; - - purple_debug_info("oscar", - "ssi: syncing local list and server list\n"); - - /* Clean the buddy list */ - aim_ssi_cleanlist(od); - - { /* If not in server list then prune from local list */ - GSList *cur, *next; - GSList *buddies = purple_find_buddies(account, NULL); - - /* Buddies */ - cur = NULL; - - while(buddies) { - PurpleGroup *g; - const char *gname; - const char *bname; - - b = buddies->data; - g = purple_buddy_get_group(b); - gname = purple_group_get_name(g); - bname = purple_buddy_get_name(b); - - if (aim_ssi_itemlist_exists(od->ssi.local, bname)) { - /* If the buddy is an ICQ user then load his nickname */ - const char *servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"); - char *alias; - const char *balias; - if (servernick) - serv_got_alias(gc, bname, servernick); - - /* Store local alias on server */ - alias = aim_ssi_getalias(od->ssi.local, gname, bname); - balias = purple_buddy_get_local_buddy_alias(b); - if (!alias && balias && *balias) - aim_ssi_aliasbuddy(od, gname, bname, balias); - g_free(alias); - } else { - purple_debug_info("oscar", - "ssi: removing buddy %s from local list\n", bname); - /* We can't actually remove now because it will screw up our looping */ - cur = g_slist_prepend(cur, b); - } - buddies = g_slist_delete_link(buddies, buddies); - } - - while (cur != NULL) { - b = cur->data; - cur = g_slist_remove(cur, b); - purple_blist_remove_buddy(b); - } - - /* Permit list */ - if (account->permit) { - next = account->permit; - while (next != NULL) { - cur = next; - next = next->next; - if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { - purple_debug_info("oscar", - "ssi: removing permit %s from local list\n", (const char *)cur->data); - purple_privacy_permit_remove(account, cur->data, TRUE); - } - } - } - - /* Deny list */ - if (account->deny) { - next = account->deny; - while (next != NULL) { - cur = next; - next = next->next; - if (!aim_ssi_itemlist_finditem(od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { - purple_debug_info("oscar", - "ssi: removing deny %s from local list\n", (const char *)cur->data); - purple_privacy_deny_remove(account, cur->data, TRUE); - } - } - } - /* Presence settings (idle time visibility) */ - tmp = aim_ssi_getpresence(od->ssi.local); - if (tmp != 0xFFFFFFFF) { - const char *idle_reporting_pref; - gboolean report_idle; - - idle_reporting_pref = purple_prefs_get_string("/purple/away/idle_reporting"); - report_idle = strcmp(idle_reporting_pref, "none") != 0; - - if (report_idle) - aim_ssi_setpresence(od, tmp | AIM_SSI_PRESENCE_FLAG_SHOWIDLE); - else - aim_ssi_setpresence(od, tmp & ~AIM_SSI_PRESENCE_FLAG_SHOWIDLE); - } - - - } /* end pruning buddies from local list */ - - /* Add from server list to local list */ - for (curitem=od->ssi.local; curitem; curitem=curitem->next) { - if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) - switch (curitem->type) { - case AIM_SSI_TYPE_BUDDY: { /* Buddy */ - if (curitem->name) { - struct aim_ssi_item *groupitem; - char *gname, *gname_utf8, *alias, *alias_utf8; - - groupitem = aim_ssi_itemlist_find(od->ssi.local, curitem->gid, 0x0000); - gname = groupitem ? groupitem->name : NULL; - if (gname != NULL) { - if (g_utf8_validate(gname, -1, NULL)) - gname_utf8 = g_strdup(gname); - else - gname_utf8 = oscar_utf8_try_convert(account, od, gname); - } else - gname_utf8 = NULL; - - g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")); - if (g == NULL) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); - purple_blist_add_group(g, NULL); - } - - alias = aim_ssi_getalias(od->ssi.local, gname, curitem->name); - if (alias != NULL) { - if (g_utf8_validate(alias, -1, NULL)) - alias_utf8 = g_strdup(alias); - else - alias_utf8 = oscar_utf8_try_convert(account, od, alias); - g_free(alias); - } else - alias_utf8 = NULL; - - b = purple_find_buddy_in_group(account, curitem->name, g); - if (b) { - /* Get server stored alias */ - purple_blist_alias_buddy(b, alias_utf8); - } else { - b = purple_buddy_new(account, curitem->name, alias_utf8); - - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); - purple_blist_add_buddy(b, NULL, g, NULL); - } - if (!oscar_util_name_compare(curitem->name, purple_account_get_username(account))) { - char *comment = aim_ssi_getcomment(od->ssi.local, gname, curitem->name); - if (comment != NULL) - { - purple_check_comment(od, comment); - g_free(comment); - } - } - - /* Mobile users should always be online */ - if (curitem->name[0] == '+') { - purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - purple_buddy_get_name(b), - OSCAR_STATUS_ID_MOBILE, NULL); - } - - g_free(gname_utf8); - g_free(alias_utf8); - } - } break; - - case AIM_SSI_TYPE_GROUP: { /* Group */ - char *gname; - char *gname_utf8; - - gname = curitem->name; - if (gname != NULL) { - if (g_utf8_validate(gname, -1, NULL)) - gname_utf8 = g_strdup(gname); - else - gname_utf8 = oscar_utf8_try_convert(account, od, gname); - } else - gname_utf8 = NULL; - - if (gname_utf8 != NULL && purple_find_group(gname_utf8) == NULL) { - g = purple_group_new(gname_utf8); - purple_blist_add_group(g, NULL); - } - g_free(gname_utf8); - } break; - - case AIM_SSI_TYPE_PERMIT: { /* Permit buddy */ - if (curitem->name) { - /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ - GSList *list; - for (list=account->permit; (list && oscar_util_name_compare(curitem->name, list->data)); list=list->next); - if (!list) { - purple_debug_info("oscar", - "ssi: adding permit buddy %s to local list\n", curitem->name); - purple_privacy_permit_add(account, curitem->name, TRUE); - } - } - } break; - - case AIM_SSI_TYPE_DENY: { /* Deny buddy */ - if (curitem->name) { - GSList *list; - for (list=account->deny; (list && oscar_util_name_compare(curitem->name, list->data)); list=list->next); - if (!list) { - purple_debug_info("oscar", - "ssi: adding deny buddy %s to local list\n", curitem->name); - purple_privacy_deny_add(account, curitem->name, TRUE); - } - } - } break; - - case AIM_SSI_TYPE_PDINFO: { /* Permit/deny setting */ - /* - * We don't inherit the permit/deny setting from the server - * for ICQ because, for ICQ, this setting controls who can - * see your online status when you are invisible. Thus it is - * a part of your status and not really related to blocking. - */ - if (!od->icq && curitem->data) { - guint8 perm_deny = aim_ssi_getpermdeny(od->ssi.local); - if (perm_deny != 0 && perm_deny != account->perm_deny) - { - purple_debug_info("oscar", - "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, perm_deny); - account->perm_deny = perm_deny; - } - } - } break; - - case AIM_SSI_TYPE_PRESENCEPREFS: { /* Presence setting */ - /* We don't want to change Purple's setting because it applies to all accounts */ - } break; - } /* End of switch on curitem->type */ - } /* End of for loop */ - - oscar_set_status_icq(account); - - /* Activate SSI */ - /* Sending the enable causes other people to be able to see you, and you to see them */ - /* Make sure your privacy setting/invisibility is set how you want it before this! */ - purple_debug_info("oscar", - "ssi: activating server-stored buddy list\n"); - aim_ssi_enable(od); - - /* - * Make sure our server-stored icon is updated correctly in - * the event that the local user set a new icon while this - * account was offline. - */ - img = purple_buddy_icons_find_account_icon(account); - oscar_set_icon(gc, img); - purple_imgstore_unref(img); - - /* - * If we've already received our bos rights then we're not waiting on - * anything else, so send the server clientready. - */ - if (od->bos.have_rights) { - aim_srv_clientready(od, conn); - - /* Request offline messages for AIM and ICQ */ - aim_im_reqofflinemsgs(od); - - purple_connection_set_state(gc, PURPLE_CONNECTED); - } - - return 1; -} - -static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - struct aim_ssi_tmp *retval; - - va_start(ap, fr); - retval = va_arg(ap, struct aim_ssi_tmp *); - va_end(ap); - - while (retval) { - purple_debug_misc("oscar", - "ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item"); - - if (retval->ack != 0xffff) - switch (retval->ack) { - case 0x0000: { /* added successfully */ - } break; - - case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ - gchar *buf; - buf = g_strdup_printf(_("Unable to add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); - if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - } - - case 0x000e: { /* buddy requires authorization */ - if ((retval->action == SNAC_SUBTYPE_FEEDBAG_ADD) && (retval->name)) - purple_auth_sendrequest(gc, retval->name); - } break; - - default: { /* La la la */ - gchar *buf; - purple_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); - buf = g_strdup_printf(_("Unable to add the buddy %s for an unknown reason."), - (retval->name ? retval->name : _("(no name)"))); - if ((retval->name != NULL) && !purple_conv_present_error(retval->name, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to Add"), buf); - g_free(buf); - } break; - } - - retval = retval->next; - } - - return 1; -} - -static int -purple_ssi_parseaddmod(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) -{ - PurpleConnection *gc; - PurpleAccount *account; - char *gname, *gname_utf8, *alias, *alias_utf8; - PurpleBuddy *b; - PurpleGroup *g; - struct aim_ssi_item *ssi_item; - va_list ap; - guint16 snac_subtype, type; - const char *name; - - gc = od->gc; - account = purple_connection_get_account(gc); - - va_start(ap, fr); - snac_subtype = (guint16)va_arg(ap, int); - type = (guint16)va_arg(ap, int); - name = va_arg(ap, char *); - va_end(ap); - - if ((type != 0x0000) || (name == NULL)) - return 1; - - gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - gname_utf8 = gname ? oscar_utf8_try_convert(account, od, gname) : NULL; - - alias = aim_ssi_getalias(od->ssi.local, gname, name); - if (alias != NULL) - { - if (g_utf8_validate(alias, -1, NULL)) - alias_utf8 = g_strdup(alias); - else - alias_utf8 = oscar_utf8_try_convert(account, od, alias); - } - else - alias_utf8 = NULL; - g_free(alias); - - b = purple_find_buddy(account, name); - if (b) { - /* - * You're logged in somewhere else and you aliased one - * of your buddies, so update our local buddy list with - * the person's new alias. - */ - purple_blist_alias_buddy(b, alias_utf8); - } else if (snac_subtype == 0x0008) { - /* - * You're logged in somewhere else and you added a buddy to - * your server list, so add them to your local buddy list. - */ - b = purple_buddy_new(account, name, alias_utf8); - - if (!(g = purple_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { - g = purple_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); - purple_blist_add_group(g, NULL); - } - - purple_debug_info("oscar", - "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); - purple_blist_add_buddy(b, NULL, g, NULL); - - /* Mobile users should always be online */ - if (name[0] == '+') { - purple_prpl_got_user_status(account, - name, OSCAR_STATUS_ID_AVAILABLE, NULL); - purple_prpl_got_user_status(account, - name, OSCAR_STATUS_ID_MOBILE, NULL); - } - - } - - ssi_item = aim_ssi_itemlist_finditem(od->ssi.local, - gname, name, AIM_SSI_TYPE_BUDDY); - if (ssi_item == NULL) - { - purple_debug_error("oscar", "purple_ssi_parseaddmod: " - "Could not find ssi item for oncoming buddy %s, " - "group %s\n", name, gname); - } - - g_free(gname_utf8); - g_free(alias_utf8); - - return 1; -} - -static int purple_ssi_authgiven(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn, *msg; - gchar *dialog_msg, *nombre; - struct name_data *data; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", - "ssi: %s has given you permission to add him to your buddy list\n", bn); - - buddy = purple_find_buddy(purple_connection_get_account(gc), bn); - if (buddy && (purple_buddy_get_alias_only(buddy))) - nombre = g_strdup_printf("%s (%s)", bn, purple_buddy_get_alias_only(buddy)); - else - nombre = g_strdup(bn); - - dialog_msg = g_strdup_printf(_("The user %s has given you permission to add him or her to your buddy list. Do you want to add this user?"), nombre); - g_free(nombre); - - data = g_new(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(bn); - data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); - - purple_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), bn, NULL, - data, - G_CALLBACK(purple_icq_buddyadd), - G_CALLBACK(oscar_free_name_data)); - g_free(dialog_msg); - - return 1; -} - -static int purple_ssi_authrequest(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn; - char *msg; - PurpleAccount *account = purple_connection_get_account(gc); - gchar *reason = NULL; - struct name_data *data; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", - "ssi: received authorization request from %s\n", bn); - - buddy = purple_find_buddy(account, bn); - - if (msg != NULL) - reason = purple_plugin_oscar_decode_im_part(account, bn, AIM_CHARSET_LATIN_1, 0x0000, msg, strlen(msg)); - - data = g_new(struct name_data, 1); - data->gc = gc; - data->name = g_strdup(bn); - data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); - - purple_account_request_authorization(account, bn, NULL, - (buddy ? purple_buddy_get_alias_only(buddy) : NULL), - reason, buddy != NULL, purple_auth_grant, - purple_auth_dontgrant_msgprompt, data); - g_free(reason); - - return 1; -} - -static int purple_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - char *bn, *msg; - gchar *dialog_msg, *nombre; - guint8 reply; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - reply = (guint8)va_arg(ap, int); - msg = va_arg(ap, char *); - va_end(ap); - - purple_debug_info("oscar", - "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", bn, reply); - - buddy = purple_find_buddy(purple_connection_get_account(gc), bn); - if (buddy && (purple_buddy_get_alias_only(buddy))) - nombre = g_strdup_printf("%s (%s)", bn, purple_buddy_get_alias_only(buddy)); - else - nombre = g_strdup(bn); - - if (reply) { - /* Granted */ - dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre); - purple_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); - } else { - /* Denied */ - dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); - purple_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); - } - g_free(dialog_msg); - g_free(nombre); - - return 1; -} - -static int purple_ssi_gotadded(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - PurpleAccount *account = purple_connection_get_account(gc); - va_list ap; - char *bn; - PurpleBuddy *buddy; - - va_start(ap, fr); - bn = va_arg(ap, char *); - va_end(ap); - - buddy = purple_find_buddy(account, bn); - purple_debug_info("oscar", "ssi: %s added you to their buddy list\n", bn); - purple_account_notify_added(account, bn, NULL, - (buddy ? purple_buddy_get_alias_only(buddy) : NULL), NULL); - - return 1; -} - -GList *oscar_chat_info(PurpleConnection *gc) { - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Room:"); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Exchange:"); - pce->identifier = "exchange"; - pce->required = TRUE; - pce->is_int = TRUE; - pce->min = 4; - pce->max = 20; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *oscar_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "room", g_strdup(chat_name)); - g_hash_table_insert(defaults, "exchange", g_strdup("4")); - - return defaults; -} - -char * -oscar_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "room")); -} - -void -oscar_join_chat(PurpleConnection *gc, GHashTable *data) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - FlapConnection *conn; - char *name, *exchange; - int exchange_int; - - name = g_hash_table_lookup(data, "room"); - exchange = g_hash_table_lookup(data, "exchange"); - - g_return_if_fail(name != NULL && *name != '\0'); - g_return_if_fail(exchange != NULL); - - errno = 0; - exchange_int = strtol(exchange, NULL, 10); - g_return_if_fail(errno == 0); - - purple_debug_info("oscar", "Attempting to join chat room %s.\n", name); - - if ((conn = flap_connection_getbytype(od, SNAC_FAMILY_CHATNAV))) - { - purple_debug_info("oscar", "chatnav exists, creating room\n"); - aim_chatnav_createroom(od, conn, name, exchange_int); - } else { - /* this gets tricky */ - struct create_room *cr = g_new0(struct create_room, 1); - purple_debug_info("oscar", "chatnav does not exist, opening chatnav\n"); - cr->exchange = exchange_int; - cr->name = g_strdup(name); - od->create_rooms = g_slist_prepend(od->create_rooms, cr); - aim_srv_requestnew(od, SNAC_FAMILY_CHATNAV); - } -} - -void -oscar_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - struct chat_connection *ccon = find_oscar_chat(gc, id); - - if (ccon == NULL) - return; - - aim_im_sendch2_chatinvite(od, name, message ? message : "", - ccon->exchange, ccon->name, 0x0); -} - -void -oscar_chat_leave(PurpleConnection *gc, int id) -{ - PurpleConversation *conv; - struct chat_connection *cc; - - conv = purple_find_chat(gc, id); - - g_return_if_fail(conv != NULL); - - purple_debug_info("oscar", "Leaving chat room %s\n", - purple_conversation_get_name(conv)); - - cc = find_oscar_chat(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv))); - oscar_chat_kill(gc, cc); -} - -int oscar_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleConversation *conv = NULL; - struct chat_connection *c = NULL; - char *buf, *buf2, *buf3; - guint16 charset, charsubset; - char *charsetstr = NULL; - int len; - - if (!(conv = purple_find_chat(gc, id))) - return -EINVAL; - - if (!(c = find_oscar_chat_by_conv(gc, conv))) - return -EINVAL; - - buf = purple_strdup_withhtml(message); - - if (strstr(buf, " c->maxlen) || (len > c->maxvis)) { - /* If the length was too long, try stripping the HTML and then running it back through - * purple_strdup_withhtml() and the encoding process. The result may be shorter. */ - g_free(buf2); - - buf3 = purple_markup_strip_html(buf); - g_free(buf); - - buf = purple_strdup_withhtml(buf3); - g_free(buf3); - - purple_plugin_oscar_convert_to_best_encoding(gc, NULL, buf, &buf2, &len, &charset, &charsubset); - - if ((len > c->maxlen) || (len > c->maxvis)) { - purple_debug_warning("oscar", "Could not send %s because (%i > maxlen %i) or (%i > maxvis %i)\n", - buf2, len, c->maxlen, len, c->maxvis); - g_free(buf); - g_free(buf2); - return -E2BIG; - } - - purple_debug_info("oscar", "Sending %s as %s because the original was too long.\n", - message, buf2); - } - - if (charset == AIM_CHARSET_ASCII) - charsetstr = "us-ascii"; - else if (charset == AIM_CHARSET_UNICODE) - charsetstr = "unicode-2-0"; - else if (charset == AIM_CHARSET_LATIN_1) - charsetstr = "iso-8859-1"; - aim_chat_send_im(od, c->conn, 0, buf2, len, charsetstr, "en"); - g_free(buf2); - g_free(buf); - - return 0; -} - -const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b) -{ - const char *name = b ? purple_buddy_get_name(b) : NULL; - if ((b == NULL) || (name == NULL) || oscar_util_valid_name_sms(name)) - { - if (a == NULL || oscar_util_valid_name_icq(purple_account_get_username(a))) - return "icq"; - else - return "aim"; - } - - if (oscar_util_valid_name_icq(name)) - return "icq"; - return "aim"; -} - -const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b) -{ - const char *name = b ? purple_buddy_get_name(b) : NULL; - if ((b == NULL) || (name == NULL) || oscar_util_valid_name_sms(name)) - { - if (a != NULL && oscar_util_valid_name_icq(purple_account_get_username(a))) - return "icq"; - else - return "aim"; - } - - if (oscar_util_valid_name_icq(name)) - return "icq"; - return "aim"; -} - -const char *oscar_list_emblem(PurpleBuddy *b) -{ - PurpleConnection *gc = NULL; - OscarData *od = NULL; - PurpleAccount *account = NULL; - PurplePresence *presence; - PurpleStatus *status; - const char *status_id; - aim_userinfo_t *userinfo = NULL; - const char *name; - - account = purple_buddy_get_account(b); - name = purple_buddy_get_name(b); - if (account != NULL) - gc = purple_account_get_connection(account); - if (gc != NULL) - od = purple_connection_get_protocol_data(gc); - if (od != NULL) - userinfo = aim_locate_finduserinfo(od, name); - - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - status_id = purple_status_get_id(status); - - if (purple_presence_is_online(presence) == FALSE) { - char *gname; - if ((name) && (od) && (od->ssi.received_data) && - (gname = aim_ssi_itemlist_findparentname(od->ssi.local, name)) && - (aim_ssi_waitingforauth(od->ssi.local, gname, name))) { - return "not-authorized"; - } - } - - if (userinfo != NULL ) { - if (userinfo->flags & AIM_FLAG_ADMINISTRATOR) - return "admin"; - if (userinfo->flags & AIM_FLAG_ACTIVEBUDDY) - return "bot"; - if (userinfo->capabilities & OSCAR_CAPABILITY_HIPTOP) - return "hiptop"; - if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM) - return "secure"; - if (userinfo->icqinfo.status & AIM_ICQ_STATE_BIRTHDAY) - return "birthday"; - } - return NULL; -} - -void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurpleConnection *gc; - PurpleAccount *account; - OscarData *od; - aim_userinfo_t *userinfo; - - if (!PURPLE_BUDDY_IS_ONLINE(b)) - return; - - account = purple_buddy_get_account(b); - gc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(gc); - userinfo = aim_locate_finduserinfo(od, purple_buddy_get_name(b)); - - oscar_user_info_append_status(gc, user_info, b, userinfo, /* strip_html_tags */ TRUE); - - if (full) - oscar_user_info_append_extra_info(gc, user_info, b, userinfo); -} - -char *oscar_status_text(PurpleBuddy *b) -{ - PurpleConnection *gc; - PurpleAccount *account; - OscarData *od; - const PurplePresence *presence; - const PurpleStatus *status; - const char *id; - const char *message; - gchar *ret = NULL; - - gc = purple_account_get_connection(purple_buddy_get_account(b)); - account = purple_connection_get_account(gc); - od = purple_connection_get_protocol_data(gc); - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - id = purple_status_get_id(status); - - if ((od != NULL) && !purple_presence_is_online(presence)) - { - const char *name = purple_buddy_get_name(b); - char *gname = aim_ssi_itemlist_findparentname(od->ssi.local, name); - if (aim_ssi_waitingforauth(od->ssi.local, gname, name)) - ret = g_strdup(_("Not Authorized")); - else - ret = g_strdup(_("Offline")); - } - else - { - message = purple_status_get_attr_string(status, "message"); - if (message != NULL) - { - gchar *tmp1, *tmp2; - tmp1 = purple_markup_strip_html(message); - purple_util_chrreplace(tmp1, '\n', ' '); - tmp2 = g_markup_escape_text(tmp1, -1); - ret = purple_str_sub_away_formatters(tmp2, purple_account_get_username(account)); - g_free(tmp1); - g_free(tmp2); - } - else if (purple_status_is_available(status)) - { - /* Don't show "Available" as status message in case buddy doesn't have a status message */ - } - else - { - ret = g_strdup(purple_status_get_name(status)); - } - } - - return ret; -} - - -static int oscar_icon_req(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { - PurpleConnection *gc = od->gc; - va_list ap; - guint16 type; - guint8 flags = 0, length = 0; - guchar *md5 = NULL; - - va_start(ap, fr); - type = va_arg(ap, int); - - switch(type) { - case 0x0000: - case 0x0001: { - flags = va_arg(ap, int); - length = va_arg(ap, int); - md5 = va_arg(ap, guchar *); - - if ((flags == 0x00) || (flags == 0x41)) { - if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { - od->iconconnecting = TRUE; - od->set_icon = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_BART); - } else { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) { - aim_ssi_delicon(od); - } else { - - purple_debug_info("oscar", - "Uploading icon to icon server\n"); - aim_bart_upload(od, purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_imgstore_unref(img); - } - } - } else if (flags == 0x81) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - if (img == NULL) - aim_ssi_delicon(od); - else { - aim_ssi_seticon(od, md5, length); - purple_imgstore_unref(img); - } - } - } break; - - case 0x0002: { /* We just set an "available" message? */ - } break; - } - - va_end(ap); - - return 0; -} - -void oscar_set_permit_deny(PurpleConnection *gc) { - PurpleAccount *account = purple_connection_get_account(gc); - OscarData *od = purple_connection_get_protocol_data(gc); - PurplePrivacyType perm_deny; - - /* - * For ICQ the permit/deny setting controls who you can see you - * online when you set your status to "invisible." If we're ICQ - * and we're invisible then we need to use one of - * PURPLE_PRIVACY_ALLOW_USERS or PURPLE_PRIVACY_ALLOW_BUDDYLIST or - * PURPLE_PRIVACY_DENY_USERS if we actually want to be invisible - * to anyone. - * - * These three permit/deny settings correspond to: - * 1. Invisible to everyone except the people on my "permit" list - * 2. Invisible to everyone except the people on my buddy list - * 3. Invisible only to the people on my "deny" list - * - * It would be nice to allow cases 2 and 3, but our UI doesn't have - * a nice way to do it. For now we just force case 1. - */ - if (od->icq && purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE)) - perm_deny = PURPLE_PRIVACY_ALLOW_USERS; - else - perm_deny = account->perm_deny; - - if (od->ssi.received_data) - /* - * Conveniently there is a one-to-one mapping between the - * values of libpurple's PurplePrivacyType and the values used - * by the oscar protocol. - */ - aim_ssi_setpermdeny(od, perm_deny, 0xffffffff); -} - -void oscar_add_permit(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to add a permit\n"); - if (od->ssi.received_data) - aim_ssi_addpermit(od, who); -} - -void oscar_add_deny(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to add a deny\n"); - if (od->ssi.received_data) - aim_ssi_adddeny(od, who); -} - -void oscar_rem_permit(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to delete a permit\n"); - if (od->ssi.received_data) - aim_ssi_delpermit(od, who); -} - -void oscar_rem_deny(PurpleConnection *gc, const char *who) { - OscarData *od = purple_connection_get_protocol_data(gc); - purple_debug_info("oscar", "ssi: About to delete a deny\n"); - if (od->ssi.received_data) - aim_ssi_deldeny(od, who); -} - -GList * -oscar_status_types(PurpleAccount *account) -{ - gboolean is_icq; - GList *status_types = NULL; - PurpleStatusType *type; - - g_return_val_if_fail(account != NULL, NULL); - - /* Used to flag some statuses as "user settable" or not */ - is_icq = oscar_util_valid_name_icq(purple_account_get_username(account)); - - /* Common status types */ - /* Really the available message should only be settable for AIM accounts */ - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - OSCAR_STATUS_ID_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), - "itmsurl", _("iTunes Music Store Link"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, - OSCAR_STATUS_ID_FREE4CHAT, - _("Free For Chat"), TRUE, is_icq, FALSE); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - OSCAR_STATUS_ID_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - OSCAR_STATUS_ID_INVISIBLE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE); - status_types = g_list_prepend(status_types, type); - - /* ICQ-specific status types */ - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - OSCAR_STATUS_ID_OCCUPIED, - _("Occupied"), TRUE, is_icq, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - OSCAR_STATUS_ID_DND, - _("Do Not Disturb"), TRUE, is_icq, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY, - OSCAR_STATUS_ID_NA, - _("Not Available"), TRUE, is_icq, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - status_types = g_list_prepend(status_types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - OSCAR_STATUS_ID_OFFLINE, - NULL, TRUE, TRUE, FALSE); - status_types = g_list_prepend(status_types, type); - - status_types = g_list_reverse(status_types); - - return status_types; -} - -static void oscar_ssi_editcomment(struct name_data *data, const char *text) { - PurpleConnection *gc; - PurpleAccount *account; - OscarData *od; - PurpleBuddy *b; - PurpleGroup *g; - const char *username; - - gc = data->gc; - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - b = purple_find_buddy(account, data->name); - if (b == NULL) { - oscar_free_name_data(data); - return; - } - - g = purple_buddy_get_group(b); - if (g == NULL) { - oscar_free_name_data(data); - return; - } - - aim_ssi_editcomment(od, purple_group_get_name(g), data->name, text); - - username = purple_account_get_username(account); - if (!oscar_util_name_compare(data->name, username)) - purple_check_comment(od, text); - - oscar_free_name_data(data); -} - -static void oscar_buddycb_edit_comment(PurpleBlistNode *node, gpointer ignore) { - - PurpleBuddy *buddy; - PurpleConnection *gc; - OscarData *od; - struct name_data *data; - PurpleGroup *g; - char *comment; - gchar *comment_utf8; - gchar *title; - PurpleAccount *account; - const char *name; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - name = purple_buddy_get_name(buddy); - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(gc); - - if (!(g = purple_buddy_get_group(buddy))) - return; - - data = g_new(struct name_data, 1); - - comment = aim_ssi_getcomment(od->ssi.local, purple_group_get_name(g), name); - comment_utf8 = comment ? oscar_utf8_try_convert(account, od, comment) : NULL; - - data->gc = gc; - data->name = g_strdup(name); - data->nick = g_strdup(purple_buddy_get_alias_only(buddy)); - - title = g_strdup_printf(_("Buddy Comment for %s"), data->name); - purple_request_input(gc, title, _("Buddy Comment:"), NULL, - comment_utf8, TRUE, FALSE, NULL, - _("_OK"), G_CALLBACK(oscar_ssi_editcomment), - _("_Cancel"), G_CALLBACK(oscar_free_name_data), - account, data->name, NULL, - data); - g_free(title); - - g_free(comment); - g_free(comment_utf8); -} - -static void -oscar_ask_directim_yes_cb(struct oscar_ask_directim_data *data) -{ - peer_connection_propose(data->od, OSCAR_CAPABILITY_DIRECTIM, data->who); - g_free(data->who); - g_free(data); -} - -static void -oscar_ask_directim_no_cb(struct oscar_ask_directim_data *data) -{ - g_free(data->who); - g_free(data); -} - -/* This is called from right-click menu on a buddy node. */ -static void -oscar_ask_directim(gpointer object, gpointer ignored) -{ - PurpleBlistNode *node; - PurpleBuddy *buddy; - PurpleConnection *gc; - gchar *buf; - struct oscar_ask_directim_data *data; - PurpleAccount *account; - - node = object; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - - data = g_new0(struct oscar_ask_directim_data, 1); - data->who = g_strdup(purple_buddy_get_name(buddy)); - data->od = purple_connection_get_protocol_data(gc); - buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), - data->who); - - purple_request_action(gc, NULL, buf, - _("Because this reveals your IP address, it " - "may be considered a security risk. Do you " - "wish to continue?"), - 0, /* Default action is "connect" */ - account, data->who, NULL, - data, 2, - _("C_onnect"), G_CALLBACK(oscar_ask_directim_yes_cb), - _("_Cancel"), G_CALLBACK(oscar_ask_directim_no_cb)); - g_free(buf); -} - -static void -oscar_close_directim(gpointer object, gpointer ignored) -{ - PurpleBlistNode *node; - PurpleBuddy *buddy; - PurpleAccount *account; - PurpleConnection *gc; - PurpleConversation *conv; - OscarData *od; - PeerConnection *conn; - const char *name; - - node = object; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy*)node; - name = purple_buddy_get_name(buddy); - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - od = gc->proto_data; - conn = peer_connection_find_by_type(od, name, OSCAR_CAPABILITY_DIRECTIM); - - if (conn != NULL) - { - if (!conn->ready) - aim_im_sendch2_cancel(conn); - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - - /* OSCAR_DISCONNECT_LOCAL_CLOSED doesn't write anything to the convo - * window. Let the user know that we canceled the Direct IM. */ - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); - purple_conversation_write(conv, NULL, _("You closed the connection."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } -} - -static void -oscar_get_aim_info_cb(PurpleBlistNode *node, gpointer ignore) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - aim_locate_getinfoshort(purple_connection_get_protocol_data(gc), - purple_buddy_get_name(buddy), 0x00000003); -} - -static GList * -oscar_buddy_menu(PurpleBuddy *buddy) { - - PurpleConnection *gc; - OscarData *od; - GList *menu; - PurpleMenuAction *act; - aim_userinfo_t *userinfo; - PurpleAccount *account; - const char *bname = purple_buddy_get_name(buddy); - - account = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(account); - od = purple_connection_get_protocol_data(gc); - userinfo = aim_locate_finduserinfo(od, bname); - menu = NULL; - - if (od->icq && oscar_util_valid_name_icq(bname)) - { - act = purple_menu_action_new(_("Get AIM Info"), - PURPLE_CALLBACK(oscar_get_aim_info_cb), - NULL, NULL); - menu = g_list_prepend(menu, act); - } - - if (purple_buddy_get_group(buddy) != NULL) - { - /* We only do this if the user is in our buddy list */ - act = purple_menu_action_new(_("Edit Buddy Comment"), - PURPLE_CALLBACK(oscar_buddycb_edit_comment), - NULL, NULL); - menu = g_list_prepend(menu, act); - } - -#if 0 - if (od->icq) - { - act = purple_menu_action_new(_("Get Status Msg"), - PURPLE_CALLBACK(oscar_get_icqstatusmsg), - NULL, NULL); - menu = g_list_prepend(menu, act); - } -#endif - - if (userinfo && - oscar_util_name_compare(purple_account_get_username(account), bname) && - PURPLE_BUDDY_IS_ONLINE(buddy)) - { - PeerConnection *conn; - conn = peer_connection_find_by_type(od, bname, OSCAR_CAPABILITY_DIRECTIM); - - if (userinfo->capabilities & OSCAR_CAPABILITY_DIRECTIM) - { - if (conn) - { - act = purple_menu_action_new(_("End Direct IM Session"), - PURPLE_CALLBACK(oscar_close_directim), - NULL, NULL); - } - else - { - act = purple_menu_action_new(_("Direct IM"), - PURPLE_CALLBACK(oscar_ask_directim), - NULL, NULL); - } - menu = g_list_prepend(menu, act); - } -#if 0 - /* TODO: This menu item should be added by the core */ - if (userinfo->capabilities & OSCAR_CAPABILITY_GETFILE) { - act = purple_menu_action_new(_("Get File"), - PURPLE_CALLBACK(oscar_ask_getfile), - NULL, NULL); - menu = g_list_prepend(menu, act); - } -#endif - } - - if (od->ssi.received_data && purple_buddy_get_group(buddy) != NULL) - { - /* - * We only do this if the user is in our buddy list and we're - * waiting for authorization. - */ - char *gname; - gname = aim_ssi_itemlist_findparentname(od->ssi.local, bname); - if (gname && aim_ssi_waitingforauth(od->ssi.local, gname, bname)) - { - act = purple_menu_action_new(_("Re-request Authorization"), - PURPLE_CALLBACK(purple_auth_sendrequest_menu), - NULL, NULL); - menu = g_list_prepend(menu, act); - } - } - - menu = g_list_reverse(menu); - - return menu; -} - - -GList *oscar_blist_node_menu(PurpleBlistNode *node) { - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return oscar_buddy_menu((PurpleBuddy *) node); - } else { - return NULL; - } -} - -static void -oscar_icq_privacy_opts(PurpleConnection *gc, PurpleRequestFields *fields) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - PurpleAccount *account = purple_connection_get_account(gc); - PurpleRequestField *f; - gboolean auth, web_aware; - - f = purple_request_fields_get_field(fields, "authorization"); - auth = purple_request_field_bool_get_value(f); - - f = purple_request_fields_get_field(fields, "web_aware"); - web_aware = purple_request_field_bool_get_value(f); - - purple_account_set_bool(account, "authorization", auth); - purple_account_set_bool(account, "web_aware", web_aware); - - oscar_set_extendedstatus(gc); - aim_icq_setsecurity(od, auth, web_aware); -} - -static void -oscar_show_icq_privacy_opts(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - gboolean auth, web_aware; - - auth = purple_account_get_bool(account, "authorization", OSCAR_DEFAULT_AUTHORIZATION); - web_aware = purple_account_get_bool(account, "web_aware", OSCAR_DEFAULT_WEB_AWARE); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - - f = purple_request_field_bool_new("authorization", _("Require authorization"), auth); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_bool_new("web_aware", _("Web aware (enabling this will cause you to receive SPAM!)"), web_aware); - purple_request_field_group_add_field(g, f); - - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("ICQ Privacy Options"), _("ICQ Privacy Options"), - NULL, fields, - _("OK"), G_CALLBACK(oscar_icq_privacy_opts), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -void oscar_format_username(PurpleConnection *gc, const char *nick) { - OscarData *od = purple_connection_get_protocol_data(gc); - if (!oscar_util_name_compare(purple_account_get_username(purple_connection_get_account(gc)), nick)) { - if (!flap_connection_getbytype(od, SNAC_FAMILY_ADMIN)) { - od->setnick = TRUE; - g_free(od->newformatting); - od->newformatting = g_strdup(nick); - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } else { - aim_admin_setnick(od, flap_connection_getbytype(od, SNAC_FAMILY_ADMIN), nick); - } - } else { - purple_notify_error(gc, NULL, _("The new formatting is invalid."), - _("Username formatting can change only capitalization and whitespace.")); - } -} - -static void oscar_confirm_account(PurplePluginAction *action) -{ - PurpleConnection *gc; - OscarData *od; - FlapConnection *conn; - - gc = (PurpleConnection *)action->context; - od = purple_connection_get_protocol_data(gc); - - conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - if (conn != NULL) { - aim_admin_reqconfirm(od, conn); - } else { - od->conf = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } -} - -static void oscar_show_email(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - OscarData *od = purple_connection_get_protocol_data(gc); - FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - - if (conn) { - aim_admin_getinfo(od, conn, 0x11); - } else { - od->reqemail = TRUE; - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } -} - -static void oscar_change_email(PurpleConnection *gc, const char *email) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - FlapConnection *conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - - if (conn) { - aim_admin_setemail(od, conn, email); - } else { - od->setemail = TRUE; - od->email = g_strdup(email); - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } -} - -static void oscar_show_change_email(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, - FALSE, FALSE, NULL, - _("_OK"), G_CALLBACK(oscar_change_email), - _("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void oscar_show_awaitingauth(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - OscarData *od = purple_connection_get_protocol_data(gc); - gchar *text, *tmp; - GSList *buddies; - PurpleAccount *account; - int num=0; - - text = g_strdup(""); - account = purple_connection_get_account(gc); - - buddies = purple_find_buddies(account, NULL); - while (buddies) { - PurpleBuddy *buddy; - const gchar *bname, *gname; - - buddy = buddies->data; - bname = purple_buddy_get_name(buddy); - gname = purple_group_get_name(purple_buddy_get_group(buddy)); - if (aim_ssi_waitingforauth(od->ssi.local, gname, bname)) { - const gchar *alias = purple_buddy_get_alias_only(buddy); - if (alias) - tmp = g_strdup_printf("%s %s (%s)
", text, bname, alias); - else - tmp = g_strdup_printf("%s %s
", text, bname); - g_free(text); - text = tmp; - - num++; - } - - buddies = g_slist_delete_link(buddies, buddies); - } - - if (!num) { - g_free(text); - text = g_strdup(_("you are not waiting for authorization")); - } - - purple_notify_formatted(gc, NULL, _("You are awaiting authorization from " - "the following buddies"), _("You can re-request " - "authorization from these buddies by " - "right-clicking on them and selecting " - "\"Re-request Authorization.\""), text, NULL, NULL); - g_free(text); -} - -static void search_by_email_cb(PurpleConnection *gc, const char *email) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - aim_search_address(od, email); -} - -static void oscar_show_find_email(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, _("Find Buddy by Email"), - _("Search for a buddy by email address"), - _("Type the email address of the buddy you are " - "searching for."), - NULL, FALSE, FALSE, NULL, - _("_Search"), G_CALLBACK(search_by_email_cb), - _("_Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void oscar_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void oscar_show_set_info_icqurl(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_notify_uri(gc, "http://www.icq.com/whitepages/user_details.php"); -} - -static void oscar_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -/** - * Only used when connecting with the old-style BUCP login. - */ -static void oscar_show_chpassurl(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - OscarData *od = purple_connection_get_protocol_data(gc); - gchar *substituted = purple_strreplace(od->authinfo->chpassurl, "%s", purple_account_get_username(purple_connection_get_account(gc))); - purple_notify_uri(gc, substituted); - g_free(substituted); -} - -static void oscar_show_imforwardingurl(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); -} - -void oscar_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - if (img == NULL) { - aim_ssi_delicon(od); - } else { - PurpleCipherContext *context; - guchar md5[16]; - gconstpointer data = purple_imgstore_get_data(img); - size_t len = purple_imgstore_get_size(img); - - context = purple_cipher_context_new_by_name("md5", NULL); - purple_cipher_context_append(context, data, len); - purple_cipher_context_digest(context, 16, md5, NULL); - purple_cipher_context_destroy(context); - - aim_ssi_seticon(od, md5, 16); - } -} - -/** - * Called by the Purple core to determine whether or not we're - * allowed to send a file to this user. - */ -gboolean -oscar_can_receive_file(PurpleConnection *gc, const char *who) -{ - OscarData *od; - PurpleAccount *account; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - if (od != NULL) - { - aim_userinfo_t *userinfo; - userinfo = aim_locate_finduserinfo(od, who); - - /* - * Don't allowing sending a file to a user that does not support - * file transfer, and don't allow sending to ourselves. - */ - if (((userinfo == NULL) || - (userinfo->capabilities & OSCAR_CAPABILITY_SENDFILE)) && - oscar_util_name_compare(who, purple_account_get_username(account))) - { - return TRUE; - } - } - - return FALSE; -} - -PurpleXfer * -oscar_new_xfer(PurpleConnection *gc, const char *who) -{ - PurpleXfer *xfer; - OscarData *od; - PurpleAccount *account; - PeerConnection *conn; - - od = purple_connection_get_protocol_data(gc); - account = purple_connection_get_account(gc); - - xfer = purple_xfer_new(account, PURPLE_XFER_SEND, who); - if (xfer) - { - purple_xfer_ref(xfer); - purple_xfer_set_init_fnc(xfer, peer_oft_sendcb_init); - purple_xfer_set_cancel_send_fnc(xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_request_denied_fnc(xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_ack_fnc(xfer, peer_oft_sendcb_ack); - - conn = peer_connection_new(od, OSCAR_CAPABILITY_SENDFILE, who); - conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - aim_icbm_makecookie(conn->cookie); - conn->xfer = xfer; - xfer->data = conn; - } - - return xfer; -} - -/* - * Called by the Purple core when the user indicates that a - * file is to be sent to a special someone. - */ -void -oscar_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurpleXfer *xfer; - - xfer = oscar_new_xfer(gc, who); - - if (file != NULL) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -GList * -oscar_actions(PurplePlugin *plugin, gpointer context) -{ - PurpleConnection *gc = (PurpleConnection *) context; - OscarData *od = purple_connection_get_protocol_data(gc); - GList *menu = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set User Info..."), - oscar_show_set_info); - menu = g_list_prepend(menu, act); - - if (od->icq) - { - act = purple_plugin_action_new(_("Set User Info (web)..."), - oscar_show_set_info_icqurl); - menu = g_list_prepend(menu, act); - } - - act = purple_plugin_action_new(_("Change Password..."), - oscar_change_pass); - menu = g_list_prepend(menu, act); - - if (od->authinfo != NULL && od->authinfo->chpassurl != NULL) - { - /* This only happens when connecting with the old-style BUCP login */ - act = purple_plugin_action_new(_("Change Password (web)"), - oscar_show_chpassurl); - menu = g_list_prepend(menu, act); - } - - if (!od->icq) - { - act = purple_plugin_action_new(_("Configure IM Forwarding (web)"), - oscar_show_imforwardingurl); - menu = g_list_prepend(menu, act); - } - - menu = g_list_prepend(menu, NULL); - - if (od->icq) - { - /* ICQ actions */ - act = purple_plugin_action_new(_("Set Privacy Options..."), - oscar_show_icq_privacy_opts); - menu = g_list_prepend(menu, act); - } - else - { - /* AIM actions */ - act = purple_plugin_action_new(_("Confirm Account"), - oscar_confirm_account); - menu = g_list_prepend(menu, act); - - act = purple_plugin_action_new(_("Display Currently Registered Email Address"), - oscar_show_email); - menu = g_list_prepend(menu, act); - - act = purple_plugin_action_new(_("Change Currently Registered Email Address..."), - oscar_show_change_email); - menu = g_list_prepend(menu, act); - } - - menu = g_list_prepend(menu, NULL); - - act = purple_plugin_action_new(_("Show Buddies Awaiting Authorization"), - oscar_show_awaitingauth); - menu = g_list_prepend(menu, act); - - menu = g_list_prepend(menu, NULL); - - act = purple_plugin_action_new(_("Search for Buddy by Email Address..."), - oscar_show_find_email); - menu = g_list_prepend(menu, act); - -#if 0 - act = purple_plugin_action_new(_("Search for Buddy by Information"), - show_find_info); - menu = g_list_prepend(menu, act); -#endif - - menu = g_list_reverse(menu); - - return menu; -} - -void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - OscarData *od = purple_connection_get_protocol_data(gc); - - if (od->icq) { - aim_icq_changepasswd(od, new); - } else { - FlapConnection *conn; - conn = flap_connection_getbytype(od, SNAC_FAMILY_ADMIN); - if (conn) { - aim_admin_changepasswd(od, conn, new, old); - } else { - od->chpass = TRUE; - od->oldp = g_strdup(old); - od->newp = g_strdup(new); - aim_srv_requestnew(od, SNAC_FAMILY_ADMIN); - } - } -} - -void -oscar_convo_closed(PurpleConnection *gc, const char *who) -{ - OscarData *od; - PeerConnection *conn; - - od = purple_connection_get_protocol_data(gc); - conn = peer_connection_find_by_type(od, who, OSCAR_CAPABILITY_DIRECTIM); - - if (conn != NULL) - { - if (!conn->ready) - aim_im_sendch2_cancel(conn); - - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - } -} - -const char * -oscar_normalize(const PurpleAccount *account, const char *str) -{ - static char buf[BUF_LEN]; - char *tmp1, *tmp2; - int i, j; - - g_return_val_if_fail(str != NULL, NULL); - - /* copy str to buf and skip all blanks */ - i = 0; - for (j = 0; str[j]; j++) { - if (str[j] != ' ') { - buf[i++] = str[j]; - if (i >= BUF_LEN - 1) - break; - } - } - buf[i] = '\0'; - - tmp1 = g_utf8_strdown(buf, -1); - tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT); - strcpy(buf, tmp2); - g_free(tmp2); - g_free(tmp1); - - return buf; -} - -gboolean -oscar_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -/* TODO: Find somewhere to put this instead of including it in a bunch of places. - * Maybe just change purple_accounts_find() to return anything for the prpl if there is no acct_id. - */ -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - - -static gboolean oscar_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - char prpl[11]; - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "aim") && g_ascii_strcasecmp(proto, "icq")) - return FALSE; - - g_snprintf(prpl, sizeof(prpl), "prpl-%s", proto); - - acct = find_acct(prpl, acct_id); - - if (!acct) - return FALSE; - - /* aim:GoIM?screenname=SCREENNAME&message=MESSAGE */ - if (!g_ascii_strcasecmp(cmd, "GoIM")) { - char *bname = g_hash_table_lookup(params, "screenname"); - if (bname) { - char *message = g_hash_table_lookup(params, "message"); - - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, bname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, bname); - purple_conversation_present(conv); - - if (message) { - /* Spaces are encoded as '+' */ - g_strdelimit(message, "+", ' '); - purple_conv_send_confirm(conv, message); - } - } - /*else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im();*/ - - return TRUE; - } - /* aim:GoChat?roomname=CHATROOMNAME&exchange=4 */ - else if (!g_ascii_strcasecmp(cmd, "GoChat")) { - char *rname = g_hash_table_lookup(params, "roomname"); - if (rname) { - /* This is somewhat hacky, but the params aren't useful after this command */ - g_hash_table_insert(params, g_strdup("exchange"), g_strdup("4")); - g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); - serv_join_chat(purple_account_get_connection(acct), params); - } - /*else - ** Same as above (except that this would have to be re-written using purple_request_*) - pidgin_blist_joinchat_show(); */ - - return TRUE; - } - /* aim:AddBuddy?screenname=SCREENNAME&groupname=GROUPNAME*/ - else if (!g_ascii_strcasecmp(cmd, "AddBuddy")) { - char *bname = g_hash_table_lookup(params, "screenname"); - char *gname = g_hash_table_lookup(params, "groupname"); - purple_blist_request_add_buddy(acct, bname, gname, NULL); - return TRUE; - } - - return FALSE; -} - -void oscar_init(PurplePlugin *plugin) -{ - PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); - PurpleAccountOption *option; - static gboolean init = FALSE; - - option = purple_account_option_string_new(_("Server"), "server", OSCAR_DEFAULT_LOGIN_SERVER); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_int_new(_("Port"), "port", OSCAR_DEFAULT_LOGIN_PORT); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_bool_new(_("Use SSL"), "use_ssl", - OSCAR_DEFAULT_USE_SSL); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_bool_new(_("Use clientLogin"), "use_clientlogin", - OSCAR_DEFAULT_USE_CLIENTLOGIN); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - option = purple_account_option_bool_new( - _("Always use AIM/ICQ proxy server for\nfile transfers and direct IM (slower,\nbut does not reveal your IP address)"), "always_use_rv_proxy", - OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - - if (g_str_equal(purple_plugin_get_id(plugin), "prpl-aim")) { - option = purple_account_option_bool_new(_("Allow multiple simultaneous logins"), "allow_multiple_logins", - OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS); - prpl_info->protocol_options = g_list_append(prpl_info->protocol_options, option); - } - - if (init) - return; - init = TRUE; - - /* Preferences */ - purple_prefs_add_none("/plugins/prpl/oscar"); - purple_prefs_add_bool("/plugins/prpl/oscar/recent_buddies", FALSE); - - purple_prefs_remove("/plugins/prpl/oscar/show_idle"); - purple_prefs_remove("/plugins/prpl/oscar/always_use_rv_proxy"); - - /* protocol handler */ - /* TODO: figure out a good instance to use here */ - purple_signal_connect(purple_get_core(), "uri-handler", &init, - PURPLE_CALLBACK(oscar_uri_handler), NULL); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscarcommon.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscarcommon.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscarcommon.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscarcommon.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* oscarcommon.h contains prototypes for the prpl functions used by libaim.c - * and libicq.c - */ - -#include "internal.h" - -#include "accountopt.h" -#include "prpl.h" -#include "version.h" -#include "notify.h" - -#define OSCAR_DEFAULT_LOGIN_SERVER "login.messaging.aol.com" -#define OSCAR_DEFAULT_LOGIN_PORT 5190 -#define OSCAR_DEFAULT_SSL_LOGIN_SERVER "slogin.oscar.aol.com" -#define OSCAR_OLD_LOGIN_SERVER "login.oscar.aol.com" -#ifndef _WIN32 -#define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1" -#else -#define OSCAR_DEFAULT_CUSTOM_ENCODING oscar_get_locale_charset() -#endif -#define OSCAR_DEFAULT_AUTHORIZATION TRUE -#define OSCAR_DEFAULT_HIDE_IP TRUE -#define OSCAR_DEFAULT_WEB_AWARE FALSE -#define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE -#define OSCAR_DEFAULT_ALLOW_MULTIPLE_LOGINS TRUE -#define OSCAR_DEFAULT_USE_SSL TRUE -#define OSCAR_DEFAULT_USE_CLIENTLOGIN TRUE - -#ifdef _WIN32 -const char *oscar_get_locale_charset(void); -#endif -const char *oscar_list_icon_icq(PurpleAccount *a, PurpleBuddy *b); -const char *oscar_list_icon_aim(PurpleAccount *a, PurpleBuddy *b); -const char* oscar_list_emblem(PurpleBuddy *b); -char *oscar_status_text(PurpleBuddy *b); -void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -GList *oscar_status_types(PurpleAccount *account); -GList *oscar_blist_node_menu(PurpleBlistNode *node); -GList *oscar_chat_info(PurpleConnection *gc); -GHashTable *oscar_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -void oscar_login(PurpleAccount *account); -void oscar_close(PurpleConnection *gc); -int oscar_send_im(PurpleConnection *gc, const char *name, const char *message, PurpleMessageFlags imflags); -void oscar_set_info(PurpleConnection *gc, const char *rawinfo); -unsigned int oscar_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); -void oscar_get_info(PurpleConnection *gc, const char *name); -void oscar_set_status(PurpleAccount *account, PurpleStatus *status); -void oscar_set_idle(PurpleConnection *gc, int time); -void oscar_change_passwd(PurpleConnection *gc, const char *old, const char *new); -void oscar_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void oscar_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void oscar_add_permit(PurpleConnection *gc, const char *who); -void oscar_add_deny(PurpleConnection *gc, const char *who); -void oscar_rem_permit(PurpleConnection *gc, const char *who); -void oscar_rem_deny(PurpleConnection *gc, const char *who); -void oscar_set_permit_deny(PurpleConnection *gc); -void oscar_join_chat(PurpleConnection *gc, GHashTable *data); -char *oscar_get_chat_name(GHashTable *data); -void oscar_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name); -void oscar_chat_leave(PurpleConnection *gc, int id); -int oscar_send_chat(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); -void oscar_keepalive(PurpleConnection *gc); -void oscar_alias_buddy(PurpleConnection *gc, const char *name, const char *alias); -void oscar_move_buddy(PurpleConnection *gc, const char *name, const char *old_group, const char *new_group); -void oscar_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies); -void oscar_convo_closed(PurpleConnection *gc, const char *who); -const char *oscar_normalize(const PurpleAccount *account, const char *str); -void oscar_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -void oscar_remove_group(PurpleConnection *gc, PurpleGroup *group); -gboolean oscar_can_receive_file(PurpleConnection *gc, const char *who); -void oscar_send_file(PurpleConnection *gc, const char *who, const char *file); -PurpleXfer *oscar_new_xfer(PurpleConnection *gc, const char *who); -gboolean oscar_offline_message(const PurpleBuddy *buddy); -void oscar_format_username(PurpleConnection *gc, const char *nick); -GList *oscar_actions(PurplePlugin *plugin, gpointer context); -void oscar_init(PurplePlugin *plugin); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar_data.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar_data.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar_data.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar_data.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" - -typedef struct _SnacHandler SnacHandler; - -struct _SnacHandler -{ - guint16 family; - guint16 subtype; - aim_rxcallback_t handler; - guint16 flags; -}; - -/** - * Allocates a new OscarData and initializes it with default values. - */ -OscarData * -oscar_data_new(void) -{ - OscarData *od; - - od = g_new0(OscarData, 1); - - aim_initsnachash(od); - od->snacid_next = 0x00000001; - od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - od->handlerlist = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); - - /* - * Register all the modules for this session... - */ - aim__registermodule(od, misc_modfirst); /* load the catch-all first */ - aim__registermodule(od, service_modfirst); - aim__registermodule(od, locate_modfirst); - aim__registermodule(od, buddylist_modfirst); - aim__registermodule(od, msg_modfirst); - /* aim__registermodule(od, adverts_modfirst); */ - /* aim__registermodule(od, invite_modfirst); */ - aim__registermodule(od, admin_modfirst); - aim__registermodule(od, popups_modfirst); - aim__registermodule(od, bos_modfirst); - aim__registermodule(od, search_modfirst); - aim__registermodule(od, stats_modfirst); - /* aim__registermodule(od, translate_modfirst); */ - aim__registermodule(od, chatnav_modfirst); - aim__registermodule(od, chat_modfirst); - aim__registermodule(od, odir_modfirst); - aim__registermodule(od, bart_modfirst); - /* missing 0x11 - 0x12 */ - aim__registermodule(od, ssi_modfirst); - /* missing 0x14 */ - aim__registermodule(od, icq_modfirst); - /* missing 0x16 */ - /* auth_modfirst is only needed if we're connecting with the old-style BUCP login */ - aim__registermodule(od, auth_modfirst); - aim__registermodule(od, email_modfirst); - - return od; -} - -/** - * Logoff and deallocate a session. - * - * @param od Session to kill - */ -void -oscar_data_destroy(OscarData *od) -{ - aim_cleansnacs(od, -1); - - /* Only used when connecting with clientLogin */ - if (od->url_data != NULL) - purple_util_fetch_url_cancel(od->url_data); - - while (od->requesticon) - { - g_free(od->requesticon->data); - od->requesticon = g_slist_delete_link(od->requesticon, od->requesticon); - } - g_free(od->email); - g_free(od->newp); - g_free(od->oldp); - if (od->getblisttimer > 0) - purple_timeout_remove(od->getblisttimer); - while (od->oscar_connections != NULL) - flap_connection_destroy(od->oscar_connections->data, - OSCAR_DISCONNECT_DONE, NULL); - - while (od->peer_connections != NULL) - peer_connection_destroy(od->peer_connections->data, - OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); - - aim__shutdownmodules(od); - - g_hash_table_destroy(od->buddyinfo); - g_hash_table_destroy(od->handlerlist); - - g_free(od); -} - -void -oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags) -{ - SnacHandler *snac_handler; - - purple_debug_misc("oscar", "Adding handler for %04x/%04x\n", family, subtype); - - snac_handler = g_new0(SnacHandler, 1); - - snac_handler->family = family; - snac_handler->subtype = subtype; - snac_handler->flags = flags; - snac_handler->handler = newhandler; - - g_hash_table_insert(od->handlerlist, - GUINT_TO_POINTER((family << 16) + subtype), - snac_handler); -} - -aim_rxcallback_t -aim_callhandler(OscarData *od, guint16 family, guint16 subtype) -{ - SnacHandler *snac_handler; - - snac_handler = g_hash_table_lookup(od->handlerlist, GUINT_TO_POINTER((family << 16) + subtype)); - - return snac_handler ? snac_handler->handler : NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/oscar.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1711 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Main libfaim header. Must be included in client for prototypes/macros. - * - * "come on, i turned a chick lesbian; i think this is the hackish equivalent" - * -- Josh Myer - * - */ - -#ifndef _OSCAR_H_ -#define _OSCAR_H_ - -#include "internal.h" -#include "circbuffer.h" -#include "debug.h" -#include "eventloop.h" -#include "proxy.h" -#include "sslconn.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _WIN32 -#include -#include -#include -#include -#include -#else -#include "libc_interface.h" -#endif - -typedef struct _ByteStream ByteStream; -typedef struct _ClientInfo ClientInfo; -typedef struct _FlapConnection FlapConnection; -typedef struct _FlapFrame FlapFrame; -typedef struct _IcbmArgsCh2 IcbmArgsCh2; -typedef struct _IcbmCookie IcbmCookie; -typedef struct _OscarData OscarData; -typedef struct _QueuedSnac QueuedSnac; - -typedef guint32 aim_snacid_t; - -#include "snactypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define FAIM_SNAC_HASH_SIZE 16 - -/* - * Current Maximum Length for usernames (not including NULL) - * - * Currently only names up to 16 characters can be registered - * however it is apparently legal for them to be larger. - */ -#define MAXSNLEN 97 - -/* - * Current Maximum Length for Instant Messages - * - * This was found basically by experiment, but not wholly - * accurate experiment. It should not be regarded - * as completely correct. But its a decent approximation. - * - * Note that although we can send this much, its impossible - * for WinAIM clients (up through the latest (4.0.1957)) to - * send any more than 1kb. Amaze all your windows friends - * with utterly oversized instant messages! - */ -#define MAXMSGLEN 2544 - -/* - * Maximum size of a Buddy Icon. - */ -#define MAXICONLEN 7168 -#define AIM_ICONIDENT "AVT1picture.id" - -/* - * Current Maximum Length for Chat Room Messages - * - * This is actually defined by the protocol to be - * dynamic, but I have yet to see due cause to - * define it dynamically here. Maybe later. - * - */ -#define MAXCHATMSGLEN 512 - -/* - * Found by trial and error. - */ -#define MAXAVAILMSGLEN 251 - -/** - * Maximum length for the password of an ICQ account - */ -#define MAXICQPASSLEN 8 - -#define AIM_MD5_STRING "AOL Instant Messenger (SM)" - -/* - * Client info. Filled in by the client and passed in to - * aim_send_login(). The information ends up getting passed to OSCAR - * through the initial login command. - * - */ -struct _ClientInfo -{ - const char *clientstring; - guint16 clientid; - guint16 major; - guint16 minor; - guint16 point; - guint16 build; - guint32 distrib; - const char *country; /* two-letter abbrev */ - const char *lang; /* two-letter abbrev */ -}; - -/* Needs to be checked */ -#define CLIENTINFO_AIM_3_5_1670 { \ - "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \ - 0x0004, \ - 0x0003, 0x0005, \ - 0x0000, 0x0686, \ - 0x0000002a, \ - "us", "en", \ -} - -/* Needs to be checked */ -/* Latest winaim without ssi */ -#define CLIENTINFO_AIM_4_1_2010 { \ - "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \ - 0x0004, \ - 0x0004, 0x0001, \ - 0x0000, 0x07da, \ - 0x0000004b, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_AIM_4_3_2188 { \ - "AOL Instant Messenger (SM), version 4.3.2188/WIN32", \ - 0x0109, \ - 0x0400, 0x0003, \ - 0x0000, 0x088c, \ - 0x00000086, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_AIM_4_8_2540 { \ - "AOL Instant Messenger (SM), version 4.8.2540/WIN32", \ - 0x0109, \ - 0x0004, 0x0008, \ - 0x0000, 0x09ec, \ - 0x000000af, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_AIM_5_0_2938 { \ - "AOL Instant Messenger, version 5.0.2938/WIN32", \ - 0x0109, \ - 0x0005, 0x0000, \ - 0x0000, 0x0b7a, \ - 0x00000000, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_5_1_3036 { \ - "AOL Instant Messenger, version 5.1.3036/WIN32", \ - 0x0109, \ - 0x0005, 0x0001, \ - 0x0000, 0x0bdc, \ - 0x000000d2, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_5_5_3415 { \ - "AOL Instant Messenger, version 5.5.3415/WIN32", \ - 0x0109, \ - 0x0005, 0x0005, \ - 0x0000, 0x0057, \ - 0x000000ef, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_5_9_3702 { \ - "AOL Instant Messenger, version 5.9.3702/WIN32", \ - 0x0109, \ - 0x0005, 0x0009, \ - 0x0000, 0x0e76, \ - 0x00000111, \ - "us", "en", \ -} - -#define CLIENTINFO_ICHAT_1_0 { \ - "Apple iChat", \ - 0x311a, \ - 0x0001, 0x0000, \ - 0x0000, 0x003c, \ - 0x000000c6, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_ICQ_4_65_3281 { \ - "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \ - 0x010a, \ - 0x0004, 0x0041, \ - 0x0001, 0x0cd1, \ - 0x00000055, \ - "us", "en", \ -} - -/* Needs to be checked */ -#define CLIENTINFO_ICQ_5_34_3728 { \ - "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \ - 0x010a, \ - 0x0005, 0x0022, \ - 0x0001, 0x0e8f, \ - 0x00000055, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQ_5_45_3777 { \ - "ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \ - 0x010a, \ - 0x0005, 0x002d, \ - 0x0001, 0x0ec1, \ - 0x00000055, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQ6_6_0_6059 { \ - "ICQ Client", \ - 0x010a, \ - 0x0006, 0x0000, \ - 0x0000, 0x17ab, \ - 0x00007535, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQBASIC_14_3_1068 { \ - "ICQBasic", \ - 0x010a, \ - 0x0014, 0x0003, \ - 0x0000, 0x042c, \ - 0x0000043d, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQBASIC_14_34_3000 { \ - "ICQBasic", \ - 0x010a, \ - 0x0014, 0x0034, \ - 0x0000, 0x0bb8, \ - 0x0000043d, \ - "us", "en", \ -} - -#define CLIENTINFO_ICQBASIC_14_34_3096 { \ - "ICQBasic", \ - 0x010a, \ - 0x0014, 0x0034, \ - 0x0000, 0x0c18, \ - 0x0000043d, \ - "us", "en", \ -} - -#define CLIENTINFO_NETSCAPE_7_0_1 { \ - "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \ - 0x1d0d, \ - 0x0007, 0x0000, \ - 0x0001, 0x0000, \ - 0x00000058, \ - "us", "en", \ -} - -/* - * We need to use the major-minor-micro versions from the official - * AIM and ICQ programs here or AOL won't let us use certain features. - * - * 0x00000611 is the distid given to us by AOL for use as the default - * libpurple distid. - */ -#define CLIENTINFO_PURPLE_AIM { \ - NULL, \ - 0x0109, \ - 0x0005, 0x0001, \ - 0x0000, 0x0bdc, \ - 0x00000611, \ - "us", "en", \ -} - -#define CLIENTINFO_PURPLE_ICQ { \ - NULL, \ - 0x010a, \ - 0x0014, 0x0034, \ - 0x0000, 0x0c18, \ - 0x00000611, \ - "us", "en", \ -} - -#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036 -#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQBASIC_14_34_3096 - -typedef enum -{ - OSCAR_DISCONNECT_DONE, /* not considered an error */ - OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */ - OSCAR_DISCONNECT_REMOTE_CLOSED, - OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */ - OSCAR_DISCONNECT_LOST_CONNECTION, - OSCAR_DISCONNECT_INVALID_DATA, - OSCAR_DISCONNECT_COULD_NOT_CONNECT, - OSCAR_DISCONNECT_RETRYING /* peer connections only */ -} OscarDisconnectReason; - -typedef enum -{ - OSCAR_CAPABILITY_BUDDYICON = 0x00000001, - OSCAR_CAPABILITY_TALK = 0x00000002, - OSCAR_CAPABILITY_DIRECTIM = 0x00000004, - OSCAR_CAPABILITY_CHAT = 0x00000008, - OSCAR_CAPABILITY_GETFILE = 0x00000010, - OSCAR_CAPABILITY_SENDFILE = 0x00000020, - OSCAR_CAPABILITY_GAMES = 0x00000040, - OSCAR_CAPABILITY_ADDINS = 0x00000080, - OSCAR_CAPABILITY_SENDBUDDYLIST = 0x00000100, - OSCAR_CAPABILITY_GAMES2 = 0x00000200, - OSCAR_CAPABILITY_ICQ_DIRECT = 0x00000400, - OSCAR_CAPABILITY_APINFO = 0x00000800, - OSCAR_CAPABILITY_ICQRTF = 0x00001000, - OSCAR_CAPABILITY_EMPTY = 0x00002000, - OSCAR_CAPABILITY_ICQSERVERRELAY = 0x00004000, - OSCAR_CAPABILITY_UNICODEOLD = 0x00008000, - OSCAR_CAPABILITY_TRILLIANCRYPT = 0x00010000, - OSCAR_CAPABILITY_UNICODE = 0x00020000, - OSCAR_CAPABILITY_INTEROPERATE = 0x00040000, - OSCAR_CAPABILITY_SHORTCAPS = 0x00080000, - OSCAR_CAPABILITY_HIPTOP = 0x00100000, - OSCAR_CAPABILITY_SECUREIM = 0x00200000, - OSCAR_CAPABILITY_SMS = 0x00400000, - OSCAR_CAPABILITY_VIDEO = 0x00800000, - OSCAR_CAPABILITY_ICHATAV = 0x01000000, - OSCAR_CAPABILITY_LIVEVIDEO = 0x02000000, - OSCAR_CAPABILITY_CAMERA = 0x04000000, - OSCAR_CAPABILITY_ICHAT_SCREENSHARE = 0x08000000, - OSCAR_CAPABILITY_TYPING = 0x10000000, - OSCAR_CAPABILITY_GENERICUNKNOWN = 0x20000000, - OSCAR_CAPABILITY_LAST = 0x40000000 -} OscarCapability; - -/* - * Byte Stream type. Sort of. - * - * Use of this type serves a couple purposes: - * - Buffer/buflen pairs are passed all around everywhere. This turns - * that into one value, as well as abstracting it slightly. - * - Through the abstraction, it is possible to enable bounds checking - * for robustness at the cost of performance. But a clean failure on - * weird packets is much better than a segfault. - * - I like having variables named "bs". - * - * Don't touch the insides of this struct. Or I'll have to kill you. - * - */ -struct _ByteStream -{ - guint8 *data; - guint32 len; - guint32 offset; -}; - -struct _QueuedSnac -{ - guint16 family; - guint16 subtype; - FlapFrame *frame; -}; - -struct _FlapFrame -{ - guint8 channel; - guint16 seqnum; - ByteStream data; /* payload stream */ -}; - -struct _FlapConnection -{ - OscarData *od; /**< Pointer to parent session. */ - gboolean connected; - time_t lastactivity; /**< Time of last transmit. */ - guint destroy_timeout; - OscarDisconnectReason disconnect_reason; - gchar *error_message; - guint16 disconnect_code; - - /* A few variables that are only used when connecting */ - PurpleProxyConnectData *connect_data; - guint16 cookielen; - guint8 *cookie; - gpointer new_conn_data; - - int fd; - PurpleSslConnection *gsc; - guint8 header[6]; - gssize header_received; - FlapFrame buffer_incoming; - PurpleCircBuffer *buffer_outgoing; - guint watcher_incoming; - guint watcher_outgoing; - - guint16 type; - guint16 subtype; - guint16 seqnum_out; /**< The sequence number of most recently sent packet. */ - guint16 seqnum_in; /**< The sequence number of most recently received packet. */ - GSList *groups; - GSList *rateclasses; /* Contains nodes of struct rateclass. */ - struct rateclass *default_rateclass; - GHashTable *rateclass_members; /* Key is family and subtype, value is pointer to the rateclass struct to use. */ - - GQueue *queued_snacs; /**< Contains QueuedSnacs. */ - GQueue *queued_lowpriority_snacs; /**< Contains QueuedSnacs to send only once queued_snacs is empty */ - guint queued_timeout; - - void *internal; /* internal conn-specific libfaim data */ -}; - -struct _IcbmCookie -{ - guchar cookie[8]; - int type; - void *data; - time_t addtime; - struct _IcbmCookie *next; -}; - -#include "peer.h" - -/* - * AIM Session: The main client-data interface. - * - */ -struct _OscarData -{ - /** Only used when connecting with clientLogin */ - PurpleUtilFetchUrlData *url_data; - - gboolean iconconnecting; - gboolean set_icon; - - GSList *create_rooms; - - gboolean conf; - gboolean reqemail; - gboolean setemail; - char *email; - gboolean setnick; - char *newformatting; - gboolean chpass; - char *oldp; - char *newp; - - GSList *oscar_chats; - GHashTable *buddyinfo; - GSList *requesticon; - - gboolean use_ssl; - gboolean icq; - guint getblisttimer; - - struct { - guint maxwatchers; /* max users who can watch you */ - guint maxbuddies; /* max users you can watch */ - guint maxgroups; /* max groups in server list */ - guint maxpermits; /* max users on permit list */ - guint maxdenies; /* max users on deny list */ - guint maxsiglen; /* max size (bytes) of profile */ - guint maxawaymsglen; /* max size (bytes) of posted away message */ - } rights; - - PurpleConnection *gc; - - void *modlistv; - - /* - * Outstanding snac handling - * - * TODO: Should these be per-connection? -mid - */ - void *snac_hash[FAIM_SNAC_HASH_SIZE]; - aim_snacid_t snacid_next; - - /* - * TODO: Data specific to a certain family should go into a - * hashtable and the core parts of libfaim shouldn't - * need to know about them. - */ - - IcbmCookie *msgcookies; - struct aim_icq_info *icq_info; - - /** Only used when connecting with the old-style BUCP login. */ - struct aim_authresp_info *authinfo; - struct aim_emailinfo *emailinfo; - - struct { - struct aim_userinfo_s *userinfo; - } locate; - - struct { - gboolean have_rights; - } bos; - - /* Server-stored information (ssi) */ - struct { - gboolean received_data; - guint16 numitems; - struct aim_ssi_item *official; - struct aim_ssi_item *local; - struct aim_ssi_tmp *pending; - time_t timestamp; - gboolean waiting_for_ack; - gboolean in_transaction; - } ssi; - - /** Contains pointers to handler functions for each family/subtype. */ - GHashTable *handlerlist; - - /** A linked list containing FlapConnections. */ - GSList *oscar_connections; - guint16 default_port; - - /** A linked list containing PeerConnections. */ - GSList *peer_connections; -}; - -/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ -#define AIM_ICQ_STATE_NORMAL 0x00000000 -#define AIM_ICQ_STATE_AWAY 0x00000001 -#define AIM_ICQ_STATE_DND 0x00000002 -#define AIM_ICQ_STATE_OUT 0x00000004 -#define AIM_ICQ_STATE_BUSY 0x00000010 -#define AIM_ICQ_STATE_CHAT 0x00000020 -#define AIM_ICQ_STATE_INVISIBLE 0x00000100 -#define AIM_ICQ_STATE_WEBAWARE 0x00010000 -#define AIM_ICQ_STATE_HIDEIP 0x00020000 -#define AIM_ICQ_STATE_BIRTHDAY 0x00080000 -#define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000 -#define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000 -#define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000 -#define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000 - -/** - * Only used when connecting with the old-style BUCP login. - */ -struct aim_clientrelease -{ - char *name; - guint32 build; - char *url; - char *info; -}; - -/** - * Only used when connecting with the old-style BUCP login. - */ -struct aim_authresp_info -{ - char *bn; - guint16 errorcode; - char *errorurl; - guint16 regstatus; - char *email; - char *bosip; - guint16 cookielen; - guint8 *cookie; - char *chpassurl; - struct aim_clientrelease latestrelease; - struct aim_clientrelease latestbeta; -}; - -/* Callback data for redirect. */ -struct aim_redirect_data -{ - guint16 group; - const char *ip; - guint16 cookielen; - const guint8 *cookie; - const char *ssl_cert_cn; - guint8 use_ssl; - struct { /* group == SNAC_FAMILY_CHAT */ - guint16 exchange; - const char *room; - guint16 instance; - } chat; -}; - -int oscar_connect_to_bos(PurpleConnection *gc, OscarData *od, const char *host, guint16 port, guint8 *cookie, guint16 cookielen, const char *tls_certname); - -/* family_auth.c */ - -/** - * Only used when connecting with the old-style BUCP login. - */ -int aim_request_login(OscarData *od, FlapConnection *conn, const char *bn); - -/** - * Only used when connecting with the old-style BUCP login. - */ -int aim_send_login(OscarData *od, FlapConnection *conn, const char *bn, const char *password, gboolean truncate_pass, ClientInfo *ci, const char *key, gboolean allow_multiple_logins); - -/** - * Only used when connecting with the old-style BUCP login. - */ -/* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid); - -/** - * Only used when connecting with clientLogin. - */ -void send_client_login(OscarData *od, const char *username); - -/* flap_connection.c */ -FlapConnection *flap_connection_new(OscarData *, int type); -void flap_connection_close(OscarData *od, FlapConnection *conn); -void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -void flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group); -FlapConnection *flap_connection_getbytype(OscarData *, int type); -FlapConnection *flap_connection_getbytype_all(OscarData *, int type); -void flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond); -void flap_connection_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond); - -void flap_connection_send(FlapConnection *conn, FlapFrame *frame); -void flap_connection_send_version(OscarData *od, FlapConnection *conn); -void flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy); -void flap_connection_send_version_with_cookie_and_clientinfo(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy, ClientInfo *ci, gboolean allow_multiple_login); -void flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data); -void flap_connection_send_snac_with_priority(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data, gboolean high_priority); -void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn); -FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen); - -/* oscar_data.c */ -typedef int (*aim_rxcallback_t)(OscarData *od, FlapConnection *conn, FlapFrame *frame, ...); - -OscarData *oscar_data_new(void); -void oscar_data_destroy(OscarData *); -void oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags); -aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 subtype); - -/* misc.c */ -#define AIM_VISIBILITYCHANGE_PERMITADD 0x05 -#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 -#define AIM_VISIBILITYCHANGE_DENYADD 0x07 -#define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 - -#define AIM_PRIVFLAGS_ALLOWIDLE 0x01 -#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 - -#define AIM_WARN_ANON 0x01 - - - -/* 0x0001 - family_oservice.c */ -/* 0x0002 */ void aim_srv_clientready(OscarData *od, FlapConnection *conn); -/* 0x0004 */ void aim_srv_requestnew(OscarData *od, guint16 serviceid); -/* 0x0006 */ void aim_srv_reqrates(OscarData *od, FlapConnection *conn); -/* 0x0008 */ void aim_srv_rates_addparam(OscarData *od, FlapConnection *conn); -/* 0x0009 */ void aim_srv_rates_delparam(OscarData *od, FlapConnection *conn); -/* 0x000c */ void aim_srv_sendpauseack(OscarData *od, FlapConnection *conn); -/* 0x000e */ void aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn); -/* 0x0011 */ void aim_srv_setidle(OscarData *od, guint32 idletime); -/* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32); -/* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn); -/* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn); -/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setstatusmsg, const char *statusmsg, const char *itmsurl); - - -void aim_bos_reqrights(OscarData *od, FlapConnection *conn); -int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int, const char *); -void aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask); - - - -#define AIM_CLIENTTYPE_UNKNOWN 0x0000 -#define AIM_CLIENTTYPE_MC 0x0001 -#define AIM_CLIENTTYPE_WINAIM 0x0002 -#define AIM_CLIENTTYPE_WINAIM41 0x0003 -#define AIM_CLIENTTYPE_AOL_TOC 0x0004 -guint16 aim_im_fingerprint(const guint8 *msghdr, int len); - -#define AIM_RATE_CODE_CHANGE 0x0001 -#define AIM_RATE_CODE_WARNING 0x0002 -#define AIM_RATE_CODE_LIMIT 0x0003 -#define AIM_RATE_CODE_CLEARLIMIT 0x0004 -void aim_ads_requestads(OscarData *od, FlapConnection *conn); - - - -/* family_icbm.c */ -#define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 -#define AIM_OFT_SUBTYPE_SEND_DIR 0x0002 -#define AIM_OFT_SUBTYPE_GET_FILE 0x0011 -#define AIM_OFT_SUBTYPE_GET_LIST 0x0012 - -#define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 -#define AIM_TRANSFER_DENY_DECLINE 0x0001 -#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 - -#define AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED 0x00000001 -#define AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED 0x00000002 -#define AIM_IMPARAM_FLAG_EVENTS_ALLOWED 0x00000008 -#define AIM_IMPARAM_FLAG_SMS_SUPPORTED 0x00000010 -#define AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED 0x00000100 - -/* This is what the server will give you if you don't set them yourself. */ -/* This is probably out of date. */ -#define AIM_IMPARAM_DEFAULTS { \ - 0, \ - AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED, \ - 512, /* !! Note how small this is. */ \ - (99.9)*10, (99.9)*10, \ - 1000 /* !! And how large this is. */ \ -} - -/* This is what most AIM versions use. */ -/* This is probably out of date. */ -#define AIM_IMPARAM_REASONABLE { \ - 0, \ - AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED, \ - 8000, \ - (99.9)*10, (99.9)*10, \ - 0 \ -} - -struct aim_icbmparameters -{ - guint16 maxchan; - guint32 flags; /* AIM_IMPARAM_FLAG_ */ - guint16 maxmsglen; /* message size that you will accept */ - guint16 maxsenderwarn; /* this and below are *10 (999=99.9%) */ - guint16 maxrecverwarn; - guint32 minmsginterval; /* in milliseconds? */ -}; - -/* - * TODO: Should probably combine this with struct chat_connection. - */ -struct aim_chat_roominfo -{ - guint16 exchange; - char *name; - guint8 namelen; - guint16 instance; -}; - -struct chat_connection -{ - char *name; - char *show; /* AOL did something funny to us */ - guint16 exchange; - guint16 instance; - FlapConnection *conn; - int id; - PurpleConnection *gc; - PurpleConversation *conv; - int maxlen; - int maxvis; -}; - -/* - * All this chat struct stuff should be in family_chat.c - */ -void oscar_chat_destroy(struct chat_connection *cc); - -#define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */ -#define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */ -#define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */ -#define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ -#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ -#define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ -#define AIM_IMFLAGS_EXTDATA 0x0100 -#define AIM_IMFLAGS_X 0x0200 -#define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ -#define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ -#define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ - -#define AIM_CHARSET_ASCII 0x0000 /* ISO 646 */ -#define AIM_CHARSET_UNICODE 0x0002 /* ISO 10646 (UTF-16/UCS-2BE) */ -#define AIM_CHARSET_LATIN_1 0x0003 /* ISO 8859-1 */ - -/* - * Multipart message structures. - */ -typedef struct aim_mpmsg_section_s -{ - guint16 charset; - guint16 charsubset; - gchar *data; - guint16 datalen; - struct aim_mpmsg_section_s *next; -} aim_mpmsg_section_t; - -typedef struct aim_mpmsg_s -{ - unsigned int numparts; - aim_mpmsg_section_t *parts; -} aim_mpmsg_t; - -int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm); -int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen); -int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii); -int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen); -void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm); - -/* - * Arguments to aim_send_im_ext(). - * - * This is really complicated. But immensely versatile. - * - */ -struct aim_sendimext_args -{ - - /* These are _required_ */ - const char *destbn; - guint32 flags; /* often 0 */ - - /* Only required if not using multipart messages */ - const char *msg; - int msglen; - - /* Required if ->msg is not provided */ - aim_mpmsg_t *mpmsg; - - /* Only used if AIM_IMFLAGS_HASICON is set */ - guint32 iconlen; - time_t iconstamp; - guint32 iconsum; - - /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ - guint16 featureslen; - guint8 *features; - - /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ - guint16 charset; - guint16 charsubset; -}; - -/* - * Arguments to aim_send_rtfmsg(). - */ -struct aim_sendrtfmsg_args -{ - const char *destbn; - guint32 fgcolor; - guint32 bgcolor; - const char *rtfmsg; /* must be in RTF */ -}; - -/* - * This information is provided in the Incoming ICBM callback for - * Channel 1 ICBM's. - * - * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they - * are optional, both are always set by the current libfaim code. - * That may or may not change in the future. It is mainly for - * consistency with aim_sendimext_args. - * - * Multipart messages require some explanation. If you want to use them, - * I suggest you read all the comments in family_icbm.c. - * - */ -struct aim_incomingim_ch1_args -{ - - /* Always provided */ - aim_mpmsg_t mpmsg; - guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */ - time_t timestamp; /* Only set for offline messages */ - - /* Only provided if message has a human-readable section */ - gchar *msg; - int msglen; - - /* Only provided if AIM_IMFLAGS_HASICON is set */ - time_t iconstamp; - guint32 iconlen; - guint16 iconsum; - - /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */ - guint8 *features; - guint8 featureslen; - - /* Only provided if AIM_IMFLAGS_EXTDATA is set */ - guint8 extdatalen; - guint8 *extdata; - - /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */ - guint16 charset; - guint16 charsubset; -}; - -/* Valid values for channel 2 args->status */ -#define AIM_RENDEZVOUS_PROPOSE 0x0000 -#define AIM_RENDEZVOUS_CANCEL 0x0001 -#define AIM_RENDEZVOUS_CONNECTED 0x0002 - -struct _IcbmArgsCh2 -{ - guint16 status; - guchar cookie[8]; - int type; /* One of the OSCAR_CAPABILITY_ constants */ - const char *proxyip; - const char *clientip; - const char *verifiedip; - guint16 port; - gboolean use_proxy; - guint16 errorcode; - const char *msg; /* invite message or file description */ - guint16 msglen; - const char *encoding; - const char *language; - guint16 requestnumber; - union { - struct { - guint32 checksum; - guint32 length; - time_t timestamp; - guint8 *icon; - } icon; - struct { - struct aim_chat_roominfo roominfo; - } chat; - struct { - guint16 msgtype; - guint32 fgcolor; - guint32 bgcolor; - const char *rtfmsg; - } rtfmsg; - struct { - guint16 subtype; - guint16 totfiles; - guint32 totsize; - char *filename; - } sendfile; - } info; - void *destructor; /* used internally only */ -}; - -/* Valid values for channel 4 args->type */ -#define AIM_ICQMSG_AUTHREQUEST 0x0006 -#define AIM_ICQMSG_AUTHDENIED 0x0007 -#define AIM_ICQMSG_AUTHGRANTED 0x0008 - -struct aim_incomingim_ch4_args -{ - guint32 uin; /* Of the sender of the ICBM */ - guint8 type; - guint8 flags; - gchar *msg; /* Reason for auth request, deny, or accept */ - int msglen; -}; - -/* SNAC sending functions */ -/* 0x0002 */ int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params); -/* 0x0004 */ int aim_im_reqparams(OscarData *od); -/* 0x0006 */ int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args); -/* 0x0006 */ int aim_im_sendch1(OscarData *, const char *destbn, guint16 flags, const char *msg); -/* 0x0006 */ int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance); -/* 0x0006 */ int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum); -/* 0x0006 */ int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args); - -/* 0x0006 */ void aim_im_sendch2_cancel(PeerConnection *peer_conn); -/* 0x0006 */ void aim_im_sendch2_connected(PeerConnection *peer_conn); -/* 0x0006 */ void aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber); -/* 0x0006 */ void aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber); -/* 0x0006 */ void aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles); -/* 0x0006 */ void aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles); - -/* 0x0006 */ int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type); -/* 0x0006 */ int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message); -/* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destbn, guint32 flags); -/* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code); -/* 0x0010 */ int aim_im_reqofflinemsgs(OscarData *od); -/* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 channel, const char *bn, guint16 event); -void aim_icbm_makecookie(guchar* cookie); -gchar *oscar_encoding_extract(const char *encoding); -gchar *oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen); -gchar *purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcebn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen); - - -/* 0x0002 - family_locate.c */ -/* - * AIM User Info, Standard Form. - */ -#define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ -#define AIM_FLAG_ADMINISTRATOR 0x0002 -#define AIM_FLAG_AOL 0x0004 -#define AIM_FLAG_OSCAR_PAY 0x0008 -#define AIM_FLAG_FREE 0x0010 -#define AIM_FLAG_AWAY 0x0020 -#define AIM_FLAG_ICQ 0x0040 -#define AIM_FLAG_WIRELESS 0x0080 -#define AIM_FLAG_UNKNOWN100 0x0100 -#define AIM_FLAG_IMFORWARDING 0x0200 -#define AIM_FLAG_ACTIVEBUDDY 0x0400 -#define AIM_FLAG_UNKNOWN800 0x0800 -#define AIM_FLAG_ONEWAYWIRELESS 0x1000 -#define AIM_FLAG_NOKNOCKKNOCK 0x00040000 -#define AIM_FLAG_FORWARD_MOBILE 0x00080000 - -#define AIM_USERINFO_PRESENT_FLAGS 0x00000001 -#define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 -#define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 -#define AIM_USERINFO_PRESENT_IDLE 0x00000008 -#define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010 -#define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020 -#define AIM_USERINFO_PRESENT_ICQDATA 0x00000040 -#define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080 -#define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 -#define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 - -struct userinfo_node -{ - char *bn; - struct userinfo_node *next; -}; - -typedef struct aim_userinfo_s -{ - char *bn; - guint16 warnlevel; /* evil percent * 10 (999 = 99.9%) */ - guint16 idletime; /* in seconds */ - guint16 flags; - guint32 createtime; /* time_t */ - guint32 membersince; /* time_t */ - guint32 onlinesince; /* time_t */ - guint32 sessionlen; /* in seconds */ - guint32 capabilities; - struct { - guint32 status; - guint32 ipaddr; - guint8 crap[0x25]; /* until we figure it out... */ - } icqinfo; - guint32 present; - - guint8 iconcsumtype; - guint16 iconcsumlen; - guint8 *iconcsum; - - char *info; - char *info_encoding; - guint16 info_len; - - char *status; - char *status_encoding; - guint16 status_len; - - char *itmsurl; - char *itmsurl_encoding; - guint16 itmsurl_len; - - char *away; - char *away_encoding; - guint16 away_len; - - struct aim_userinfo_s *next; -} aim_userinfo_t; - -#define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 -#define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 - -int aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag); - -struct aim_invite_priv -{ - char *bn; - char *roomname; - guint16 exchange; - guint16 instance; -}; - -#define AIM_COOKIETYPE_UNKNOWN 0x00 -#define AIM_COOKIETYPE_ICBM 0x01 -#define AIM_COOKIETYPE_ADS 0x02 -#define AIM_COOKIETYPE_BOS 0x03 -#define AIM_COOKIETYPE_IM 0x04 -#define AIM_COOKIETYPE_CHAT 0x05 -#define AIM_COOKIETYPE_CHATNAV 0x06 -#define AIM_COOKIETYPE_INVITE 0x07 -/* we'll move OFT up a bit to give breathing room. not like it really - * matters. */ -#define AIM_COOKIETYPE_OFTIM 0x10 -#define AIM_COOKIETYPE_OFTGET 0x11 -#define AIM_COOKIETYPE_OFTSEND 0x12 -#define AIM_COOKIETYPE_OFTVOICE 0x13 -#define AIM_COOKIETYPE_OFTIMAGE 0x14 -#define AIM_COOKIETYPE_OFTICON 0x15 - -aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn); -void aim_locate_dorequest(OscarData *od); - -/* 0x0002 */ int aim_locate_reqrights(OscarData *od); -/* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps); -/* 0x0004 */ int aim_locate_setprofile(OscarData *od, const char *profile_encoding, const gchar *profile, const int profile_len, const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len); -/* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16); -/* 0x0009 */ int aim_locate_setdirinfo(OscarData *od, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, guint16 privacy); -/* 0x000b */ int aim_locate_000b(OscarData *od, const char *bn); -/* 0x000f */ int aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy); -/* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags); - -guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len); -guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len); -void aim_info_free(aim_userinfo_t *); -int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *); -int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info); - - - -/* 0x0003 - family_buddy.c */ -/* 0x0002 */ void aim_buddylist_reqrights(OscarData *, FlapConnection *); -/* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *); -/* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *); -/* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *); - - - -/* 0x000a - family_userlookup.c */ -int aim_search_address(OscarData *, const char *); - - - -/* 0x000d - family_chatnav.c */ -/* 0x000e - family_chat.c */ -/* These apply to exchanges as well. */ -#define AIM_CHATROOM_FLAG_EVILABLE 0x0001 -#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002 -#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004 -#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008 - -struct aim_chat_exchangeinfo -{ - guint16 number; - guint16 flags; - char *name; - char *charset1; - char *lang1; - char *charset2; - char *lang2; -}; - -#define AIM_CHATFLAGS_NOREFLECT 0x0001 -#define AIM_CHATFLAGS_AWAY 0x0002 -int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language); -int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance); -int aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance); -char *aim_chat_getname(FlapConnection *conn); -FlapConnection *aim_chat_getconn(OscarData *, const char *name); - -void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn); - -int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange); -int aim_chat_leaveroom(OscarData *od, const char *name); - - - -/* 0x000f - family_odir.c */ -struct aim_odir -{ - char *first; - char *last; - char *middle; - char *maiden; - char *email; - char *country; - char *state; - char *city; - char *bn; - char *interest; - char *nick; - char *zip; - char *region; - char *address; - struct aim_odir *next; -}; - -int aim_odir_email(OscarData *, const char *, const char *); -int aim_odir_name(OscarData *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); -int aim_odir_interest(OscarData *, const char *, const char *); - - - -/* 0x0010 - family_bart.c */ -int aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen); -int aim_bart_request(OscarData *od, const char *bn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen); - - - -/* 0x0013 - family_feedbag.c */ -#define AIM_SSI_TYPE_BUDDY 0x0000 -#define AIM_SSI_TYPE_GROUP 0x0001 -#define AIM_SSI_TYPE_PERMIT 0x0002 -#define AIM_SSI_TYPE_DENY 0x0003 -#define AIM_SSI_TYPE_PDINFO 0x0004 -#define AIM_SSI_TYPE_PRESENCEPREFS 0x0005 -#define AIM_SSI_TYPE_ICONINFO 0x0014 - -#define AIM_SSI_ACK_SUCCESS 0x0000 -#define AIM_SSI_ACK_ITEMNOTFOUND 0x0002 -#define AIM_SSI_ACK_IDNUMINUSE 0x000a -#define AIM_SSI_ACK_ATMAX 0x000c -#define AIM_SSI_ACK_INVALIDNAME 0x000d -#define AIM_SSI_ACK_AUTHREQUIRED 0x000e - -/* These flags are set in the 0x00c9 TLV of SSI type 0x0005 */ -#define AIM_SSI_PRESENCE_FLAG_SHOWIDLE 0x00000400 -#define AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES 0x00020000 - -struct aim_ssi_item -{ - char *name; - guint16 gid; - guint16 bid; - guint16 type; - GSList *data; - struct aim_ssi_item *next; -}; - -struct aim_ssi_tmp -{ - guint16 action; - guint16 ack; - char *name; - struct aim_ssi_item *item; - struct aim_ssi_tmp *next; -}; - -/* These build the actual SNACs and queue them to be sent */ -/* 0x0002 */ int aim_ssi_reqrights(OscarData *od); -/* 0x0004 */ int aim_ssi_reqdata(OscarData *od); -/* 0x0005 */ int aim_ssi_reqifchanged(OscarData *od, time_t localstamp, guint16 localrev); -/* 0x0007 */ int aim_ssi_enable(OscarData *od); -/* 0x0011 */ int aim_ssi_modbegin(OscarData *od); -/* 0x0012 */ int aim_ssi_modend(OscarData *od); -/* 0x0014 */ int aim_ssi_sendauth(OscarData *od, char *bn, char *msg); -/* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg); -/* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg); - -/* Client functions for retrieving SSI data */ -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid); -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type); -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn); -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn); -int aim_ssi_getpermdeny(struct aim_ssi_item *list); -guint32 aim_ssi_getpresence(struct aim_ssi_item *list); -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn); -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn); -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn); - -/* Client functions for changing SSI data */ -int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *tlvlist, const char *alias, const char *comment, const char *smsnum, gboolean needauth); -int aim_ssi_addpermit(OscarData *od, const char *name); -int aim_ssi_adddeny(OscarData *od, const char *name); -int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group); -int aim_ssi_delgroup(OscarData *od, const char *group); -int aim_ssi_delpermit(OscarData *od, const char *name); -int aim_ssi_deldeny(OscarData *od, const char *name); -int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *bn); -int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias); -int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *alias); -int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn); -int aim_ssi_cleanlist(OscarData *od); -int aim_ssi_deletelist(OscarData *od); -int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask); -int aim_ssi_setpresence(OscarData *od, guint32 presence); -int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen); -int aim_ssi_delicon(OscarData *od); - - - -/* 0x0015 - family_icq.c */ -#define AIM_ICQ_INFO_SIMPLE 0x001 -#define AIM_ICQ_INFO_SUMMARY 0x002 -#define AIM_ICQ_INFO_EMAIL 0x004 -#define AIM_ICQ_INFO_PERSONAL 0x008 -#define AIM_ICQ_INFO_ADDITIONAL 0x010 -#define AIM_ICQ_INFO_WORK 0x020 -#define AIM_ICQ_INFO_INTERESTS 0x040 -#define AIM_ICQ_INFO_ORGS 0x080 -#define AIM_ICQ_INFO_UNKNOWN 0x100 -#define AIM_ICQ_INFO_HAVEALL 0x1ff - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -struct aim_icq_offlinemsg -{ - guint32 sender; - guint16 year; - guint8 month, day, hour, minute; - guint8 type; - guint8 flags; - char *msg; - int msglen; -}; -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */ - -struct aim_icq_info -{ - guint16 reqid; - - /* simple */ - guint32 uin; - - /* general and "home" information (0x00c8) */ - char *nick; - char *first; - char *last; - char *email; - char *homecity; - char *homestate; - char *homephone; - char *homefax; - char *homeaddr; - char *mobile; - char *homezip; - guint16 homecountry; -/* guint8 timezone; - guint8 hideemail; */ - - /* personal (0x00dc) */ - guint8 age; - guint8 unknown; - guint8 gender; - char *personalwebpage; - guint16 birthyear; - guint8 birthmonth; - guint8 birthday; - guint8 language1; - guint8 language2; - guint8 language3; - - /* work (0x00d2) */ - char *workcity; - char *workstate; - char *workphone; - char *workfax; - char *workaddr; - char *workzip; - guint16 workcountry; - char *workcompany; - char *workdivision; - char *workposition; - char *workwebpage; - - /* additional personal information (0x00e6) */ - char *info; - - /* email (0x00eb) */ - guint16 numaddresses; - char **email2; - - /* we keep track of these in a linked list because we're 1337 */ - struct aim_icq_info *next; - - /* status note info */ - guint8 icbm_cookie[8]; - char *status_note_title; -}; - -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS -int aim_icq_reqofflinemsgs(OscarData *od); -int aim_icq_ackofflinemsgs(OscarData *od); -#endif -int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware); -int aim_icq_changepasswd(OscarData *od, const char *passwd); -int aim_icq_getsimpleinfo(OscarData *od, const char *uin); -int aim_icq_getalias(OscarData *od, const char *uin); -int aim_icq_getallinfo(OscarData *od, const char *uin); -int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias); - - -/* 0x0017 - family_auth.c */ -void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *); -void aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw); -void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn); -void aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info); -void aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail); -void aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick); - - - -/* 0x0018 - family_alert.c */ -struct aim_emailinfo -{ - guint8 *cookie16; - guint8 *cookie8; - char *url; - guint16 nummsgs; - guint8 unread; - char *domain; - guint16 flag; - struct aim_emailinfo *next; -}; - -int aim_email_sendcookies(OscarData *od); -int aim_email_activate(OscarData *od); - - - -/* tlv.c - TLV handling */ - -/* TLV structure */ -typedef struct aim_tlv_s -{ - guint16 type; - guint16 length; - guint8 *value; -} aim_tlv_t; - -/* TLV handling functions */ -char *aim_tlv_getvalue_as_string(aim_tlv_t *tlv); - -aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth); -int aim_tlv_getlength(GSList *list, const guint16 type, const int nth); -char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth); -guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth); -guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth); -guint32 aim_tlv_get32(GSList *list, const guint16 type, const int nth); - -/* TLV list handling functions */ -GSList *aim_tlvlist_read(ByteStream *bs); -GSList *aim_tlvlist_readnum(ByteStream *bs, guint16 num); -GSList *aim_tlvlist_readlen(ByteStream *bs, guint16 len); -GSList *aim_tlvlist_copy(GSList *orig); - -int aim_tlvlist_count(GSList *list); -int aim_tlvlist_size(GSList *list); -int aim_tlvlist_cmp(GSList *one, GSList *two); -int aim_tlvlist_write(ByteStream *bs, GSList **list); -void aim_tlvlist_free(GSList *list); - -int aim_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value); -int aim_tlvlist_add_noval(GSList **list, const guint16 type); -int aim_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value); -int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value); -int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value); -int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value); -int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps); -int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo); -int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance); -int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tl); - -int aim_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 lenth, const guint8 *value); -int aim_tlvlist_replace_str(GSList **list, const guint16 type, const char *str); -int aim_tlvlist_replace_noval(GSList **list, const guint16 type); -int aim_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value); -int aim_tlvlist_replace_16(GSList **list, const guint16 type, const guint16 value); -int aim_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value); - -void aim_tlvlist_remove(GSList **list, const guint16 type); - - - -/* util.c */ -/* These are really ugly. You'd think this was LISP. I wish it was. */ -#define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1) -#define aimutil_get8(buf) ((*(buf))&0xff) -#define aimutil_put16(buf, data) ( \ - (*(buf) = (guint8)((data)>>8)&0xff), \ - (*((buf)+1) = (guint8)(data)&0xff), \ - 2) -#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) -#define aimutil_put32(buf, data) ( \ - (*((buf)) = (guint8)((data)>>24)&0xff), \ - (*((buf)+1) = (guint8)((data)>>16)&0xff), \ - (*((buf)+2) = (guint8)((data)>>8)&0xff), \ - (*((buf)+3) = (guint8)(data)&0xff), \ - 4) -#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ - (((*((buf)+1))<<16)&0x00ff0000) + \ - (((*((buf)+2))<< 8)&0x0000ff00) + \ - (((*((buf)+3) )&0x000000ff))) - -/* Little-endian versions (damn ICQ) */ -#define aimutil_putle8(buf, data) ( \ - (*(buf) = (guint8)(data) & 0xff), \ - 1) -#define aimutil_getle8(buf) ( \ - (*(buf)) & 0xff \ - ) -#define aimutil_putle16(buf, data) ( \ - (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \ - (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \ - 2) -#define aimutil_getle16(buf) ( \ - (((*((buf)+0)) << 0) & 0x00ff) + \ - (((*((buf)+1)) << 8) & 0xff00) \ - ) -#define aimutil_putle32(buf, data) ( \ - (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \ - (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \ - (*((buf)+2) = (guint8)((data) >> 16) & 0xff), \ - (*((buf)+3) = (guint8)((data) >> 24) & 0xff), \ - 4) -#define aimutil_getle32(buf) ( \ - (((*((buf)+0)) << 0) & 0x000000ff) + \ - (((*((buf)+1)) << 8) & 0x0000ff00) + \ - (((*((buf)+2)) << 16) & 0x00ff0000) + \ - (((*((buf)+3)) << 24) & 0xff000000)) - -int oscar_get_ui_info_int(const char *str, int default_value); -const char *oscar_get_ui_info_string(const char *str, const char *default_value); -gchar *oscar_get_clientstring(void); - -guint16 aimutil_iconsum(const guint8 *buf, int buflen); -int aimutil_tokslen(char *toSearch, int theindex, char dl); -int aimutil_itemcnt(char *toSearch, char dl); -char *aimutil_itemindex(char *toSearch, int theindex, char dl); - -gboolean oscar_util_valid_name(const char *bn); -gboolean oscar_util_valid_name_icq(const char *bn); -gboolean oscar_util_valid_name_sms(const char *bn); -int oscar_util_name_compare(const char *bn1, const char *bn2); - - - - -typedef struct { - guint16 family; - guint16 subtype; - guint16 flags; - guint32 id; -} aim_modsnac_t; - -#define AIM_MODULENAME_MAXLEN 16 -#define AIM_MODFLAG_MULTIFAMILY 0x0001 -typedef struct aim_module_s -{ - guint16 family; - guint16 version; - guint16 toolid; - guint16 toolversion; - guint16 flags; - char name[AIM_MODULENAME_MAXLEN+1]; - int (*snachandler)(OscarData *od, FlapConnection *conn, struct aim_module_s *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs); - void (*shutdown)(OscarData *od, struct aim_module_s *mod); - void *priv; - struct aim_module_s *next; -} aim_module_t; - -int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *)); -void aim__shutdownmodules(OscarData *od); -aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group); -aim_module_t *aim__findmodule(OscarData *od, const char *name); - -int admin_modfirst(OscarData *od, aim_module_t *mod); -int buddylist_modfirst(OscarData *od, aim_module_t *mod); -int bos_modfirst(OscarData *od, aim_module_t *mod); -int search_modfirst(OscarData *od, aim_module_t *mod); -int stats_modfirst(OscarData *od, aim_module_t *mod); -int auth_modfirst(OscarData *od, aim_module_t *mod); -int msg_modfirst(OscarData *od, aim_module_t *mod); -int misc_modfirst(OscarData *od, aim_module_t *mod); -int chatnav_modfirst(OscarData *od, aim_module_t *mod); -int chat_modfirst(OscarData *od, aim_module_t *mod); -int locate_modfirst(OscarData *od, aim_module_t *mod); -int service_modfirst(OscarData *od, aim_module_t *mod); -int invite_modfirst(OscarData *od, aim_module_t *mod); -int translate_modfirst(OscarData *od, aim_module_t *mod); -int popups_modfirst(OscarData *od, aim_module_t *mod); -int adverts_modfirst(OscarData *od, aim_module_t *mod); -int odir_modfirst(OscarData *od, aim_module_t *mod); -int bart_modfirst(OscarData *od, aim_module_t *mod); -int ssi_modfirst(OscarData *od, aim_module_t *mod); -int icq_modfirst(OscarData *od, aim_module_t *mod); -int email_modfirst(OscarData *od, aim_module_t *mod); - -void aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype); -void aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype); -void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *); -void aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *); - -/* bstream.c */ -int byte_stream_new(ByteStream *bs, guint32 len); -int byte_stream_init(ByteStream *bs, guint8 *data, int len); -void byte_stream_destroy(ByteStream *bs); -int byte_stream_empty(ByteStream *bs); -int byte_stream_curpos(ByteStream *bs); -int byte_stream_setpos(ByteStream *bs, unsigned int off); -void byte_stream_rewind(ByteStream *bs); -int byte_stream_advance(ByteStream *bs, int n); -guint8 byte_stream_get8(ByteStream *bs); -guint16 byte_stream_get16(ByteStream *bs); -guint32 byte_stream_get32(ByteStream *bs); -guint8 byte_stream_getle8(ByteStream *bs); -guint16 byte_stream_getle16(ByteStream *bs); -guint32 byte_stream_getle32(ByteStream *bs); -int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len); -guint8 *byte_stream_getraw(ByteStream *bs, int len); -char *byte_stream_getstr(ByteStream *bs, int len); -int byte_stream_put8(ByteStream *bs, guint8 v); -int byte_stream_put16(ByteStream *bs, guint16 v); -int byte_stream_put32(ByteStream *bs, guint32 v); -int byte_stream_putle8(ByteStream *bs, guint8 v); -int byte_stream_putle16(ByteStream *bs, guint16 v); -int byte_stream_putle32(ByteStream *bs, guint32 v); -int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len); -int byte_stream_putstr(ByteStream *bs, const char *str); -int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len); -int byte_stream_putuid(ByteStream *bs, OscarData *od); -int byte_stream_putcaps(ByteStream *bs, guint32 caps); - -/** - * Inserts a BART asset block into the given byte stream. The flags - * and length are set appropriately based on the value of data. - */ -void byte_stream_put_bart_asset(ByteStream *bs, guint16 type, ByteStream *data); - -/** - * A helper function that calls byte_stream_put_bart_asset with the - * appropriate data ByteStream given the datastr. - */ -void byte_stream_put_bart_asset_str(ByteStream *bs, guint16 type, const char *datastr); - -/* - * Generic SNAC structure. Rarely if ever used. - */ -typedef struct aim_snac_s { - aim_snacid_t id; - guint16 family; - guint16 type; - guint16 flags; - void *data; - time_t issuetime; - struct aim_snac_s *next; -} aim_snac_t; - -/* snac.c */ -void aim_initsnachash(OscarData *od); -aim_snacid_t aim_newsnac(OscarData *, aim_snac_t *newsnac); -aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen); -aim_snac_t *aim_remsnac(OscarData *, aim_snacid_t id); -void aim_cleansnacs(OscarData *, int maxage); -int aim_putsnac(ByteStream *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id); - -struct chatsnacinfo { - guint16 exchange; - char name[128]; - guint16 instance; -}; - -struct rateclass { - guint16 classid; - guint32 windowsize; - guint32 clear; - guint32 alert; - guint32 limit; - guint32 disconnect; - guint32 current; - guint32 max; - guint8 dropping_snacs; - - struct timeval last; /**< The time when we last sent a SNAC of this rate class. */ -}; - -int aim_cachecookie(OscarData *od, IcbmCookie *cookie); -IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type); -IcbmCookie *aim_mkcookie(guint8 *, int, void *); -IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int); -int aim_freecookie(OscarData *od, IcbmCookie *cookie); -int aim_msgcookie_gettype(int type); -int aim_cookie_free(OscarData *od, IcbmCookie *cookie); - -int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo); - -void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn); - -#ifdef __cplusplus -} -#endif - -#endif /* _OSCAR_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1125 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * Functions dealing with peer connections. This includes the code - * used to establish a peer connection for both Oscar File transfer - * (OFT) and Oscar Direct Connect (ODC). (ODC is also referred to - * as DirectIM and IM Image.) - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -/* From the oscar PRPL */ -#include "oscar.h" -#include "peer.h" - -/* From Purple */ -#include "conversation.h" -#include "ft.h" -#include "network.h" -#include "notify.h" -#include "request.h" -#include "util.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#include /* for inet_ntoa */ -#include /* for UINT_MAX */ -#endif - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -/* - * I really want to switch all our networking code to using IPv6 only, - * but that really isn't a good idea at all. Evan S. of Adium says - * OS X sets all connections as "AF_INET6/PF_INET6," even if there is - * nothing inherently IPv6 about them. And I feel like Linux kernel - * 2.6.5 is doing the same thing. So we REALLY should accept - * connections if they're showing up as IPv6. Old OSes (Solaris?) - * that might not have full IPv6 support yet will fail if we try - * to use PF_INET6 but it isn't defined. --Mark Doliner - */ -#ifndef PF_INET6 -#define PF_INET6 PF_INET -#endif - -PeerConnection * -peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type) -{ - GSList *cur; - PeerConnection *conn; - - for (cur = od->peer_connections; cur != NULL; cur = cur->next) - { - conn = cur->data; - if ((conn->type == type) && !oscar_util_name_compare(conn->bn, bn)) - return conn; - } - - return NULL; -} - -/** - * @param cookie This must be exactly 8 characters. - */ -PeerConnection * -peer_connection_find_by_cookie(OscarData *od, const char *bn, const guchar *cookie) -{ - GSList *cur; - PeerConnection *conn; - - for (cur = od->peer_connections; cur != NULL; cur = cur->next) - { - conn = cur->data; - if (!memcmp(conn->cookie, cookie, 8) && !oscar_util_name_compare(conn->bn, bn)) - return conn; - } - - return NULL; -} - -PeerConnection * -peer_connection_new(OscarData *od, OscarCapability type, const char *bn) -{ - PeerConnection *conn; - PurpleAccount *account; - - account = purple_connection_get_account(od->gc); - - conn = g_new0(PeerConnection, 1); - conn->od = od; - conn->type = type; - conn->bn = g_strdup(bn); - conn->buffer_outgoing = purple_circ_buffer_new(0); - conn->listenerfd = -1; - conn->fd = -1; - conn->lastactivity = time(NULL); - conn->use_proxy |= purple_account_get_bool(account, "always_use_rv_proxy", FALSE); - - if (type == OSCAR_CAPABILITY_DIRECTIM) - memcpy(conn->magic, "ODC2", 4); - else if (type == OSCAR_CAPABILITY_SENDFILE) - memcpy(conn->magic, "OFT2", 4); - - od->peer_connections = g_slist_prepend(od->peer_connections, conn); - - return conn; -} - -static void -peer_connection_close(PeerConnection *conn) -{ - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - peer_odc_close(conn); - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - peer_oft_close(conn); - - if (conn->verified_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->verified_connect_data); - conn->verified_connect_data = NULL; - } - - if (conn->client_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->client_connect_data); - conn->client_connect_data = NULL; - } - - if (conn->listen_data != NULL) - { - purple_network_listen_cancel(conn->listen_data); - conn->listen_data = NULL; - } - - if (conn->connect_timeout_timer != 0) - { - purple_timeout_remove(conn->connect_timeout_timer); - conn->connect_timeout_timer = 0; - } - - if (conn->watcher_incoming != 0) - { - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - } - if (conn->watcher_outgoing != 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - } - if (conn->listenerfd >= 0) - { - close(conn->listenerfd); - conn->listenerfd = -1; - } - if (conn->fd >= 0) - { - close(conn->fd); - conn->fd = -1; - } - - g_free(conn->buffer_incoming.data); - conn->buffer_incoming.data = NULL; - conn->buffer_incoming.len = 0; - conn->buffer_incoming.offset = 0; - - purple_circ_buffer_destroy(conn->buffer_outgoing); - conn->buffer_outgoing = purple_circ_buffer_new(0); - - conn->flags &= ~PEER_CONNECTION_FLAG_IS_INCOMING; -} - -static gboolean -peer_connection_destroy_cb(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - purple_request_close_with_handle(conn); - - peer_connection_close(conn); - - if (conn->checksum_data != NULL) - peer_oft_checksum_destroy(conn->checksum_data); - - if (conn->xfer != NULL) - { - PurpleXferStatusType status; - conn->xfer->data = NULL; - status = purple_xfer_get_status(conn->xfer); - if ((status != PURPLE_XFER_STATUS_DONE) && - (status != PURPLE_XFER_STATUS_CANCEL_LOCAL) && - (status != PURPLE_XFER_STATUS_CANCEL_REMOTE)) - { - if ((conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) || - (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED)) - purple_xfer_cancel_remote(conn->xfer); - else - purple_xfer_cancel_local(conn->xfer); - } - purple_xfer_unref(conn->xfer); - conn->xfer = NULL; - } - - g_free(conn->bn); - g_free(conn->error_message); - g_free(conn->proxyip); - g_free(conn->clientip); - g_free(conn->verifiedip); - g_free(conn->xferdata.name); - purple_circ_buffer_destroy(conn->buffer_outgoing); - - conn->od->peer_connections = g_slist_remove(conn->od->peer_connections, conn); - - g_free(conn); - - return FALSE; -} - -void -peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - purple_timeout_remove(conn->destroy_timeout); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - peer_connection_destroy_cb(conn); -} - -void -peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message) -{ - if (conn->destroy_timeout != 0) - /* Already taken care of */ - return; - - purple_debug_info("oscar", "Scheduling destruction of peer connection\n"); - conn->disconnect_reason = reason; - g_free(conn->error_message); - conn->error_message = g_strdup(error_message); - conn->destroy_timeout = purple_timeout_add(0, peer_connection_destroy_cb, conn); -} - -/*******************************************************************/ -/* Begin code for receiving data on a peer connection */ -/*******************************************************************/ - -/** - * This should be used to read ODC and OFT framing info. It should - * NOT be used to read the payload sent across the connection (IMs, - * file data, etc), and it should NOT be used to read proxy negotiation - * headers. - * - * Unlike flap_connection_recv_cb(), this only reads one frame at a - * time. This is done so that the watcher can be changed during the - * handling of the frame. If the watcher is changed then this - * function will not read in any more data. This happens when - * reading the payload of a direct IM frame, or when we're - * receiving a file from the remote user. Once the data has been - * read, the watcher will be switched back to this function to - * continue reading the next frame. - */ -void -peer_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - gssize read; - - conn = data; - - /* Start reading a new ODC/OFT frame */ - if (conn->buffer_incoming.data == NULL) - { - /* Read the first 6 bytes (magic string and frame length) */ - read = recv(conn->fd, conn->header + conn->header_received, - 6 - conn->header_received, 0); - - /* Check if the remote user closed the connection */ - if (read == 0) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - return; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - peer_connection_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - conn->lastactivity = time(NULL); - - /* If we don't even have the first 6 bytes then do nothing */ - conn->header_received += read; - if (conn->header_received < 6) - return; - - /* All ODC/OFT frames must start with a magic string */ - if (memcmp(conn->magic, conn->header, 4)) - { - purple_debug_warning("oscar", "Expecting magic string to " - "be %c%c%c%c but received magic string %c%c%c%c. " - "Closing connection.\n", - conn->magic[0], conn->magic[1], conn->magic[2], - conn->magic[3], conn->header[0], conn->header[1], - conn->header[2], conn->header[3]); - peer_connection_destroy(conn, OSCAR_DISCONNECT_INVALID_DATA, NULL); - return; - } - - /* Initialize a new temporary ByteStream for incoming data */ - conn->buffer_incoming.len = aimutil_get16(&conn->header[4]) - 6; - conn->buffer_incoming.data = g_new(guint8, conn->buffer_incoming.len); - conn->buffer_incoming.offset = 0; - } - - /* Read data into the temporary buffer until it is complete */ - read = recv(conn->fd, - &conn->buffer_incoming.data[conn->buffer_incoming.offset], - conn->buffer_incoming.len - conn->buffer_incoming.offset, - 0); - - /* Check if the remote user closed the connection */ - if (read == 0) - { - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - return; - } - - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - peer_connection_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, g_strerror(errno)); - return; - } - - conn->lastactivity = time(NULL); - conn->buffer_incoming.offset += read; - if (conn->buffer_incoming.offset < conn->buffer_incoming.len) - /* Waiting for more data to arrive */ - return; - - /* We have a complete ODC/OFT frame! Handle it and continue reading */ - byte_stream_rewind(&conn->buffer_incoming); - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - peer_odc_recv_frame(conn, &conn->buffer_incoming); - } - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - peer_oft_recv_frame(conn, &conn->buffer_incoming); - } - - g_free(conn->buffer_incoming.data); - conn->buffer_incoming.data = NULL; - - conn->header_received = 0; -} - -/*******************************************************************/ -/* End code for receiving data on a peer connection */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin code for sending data on a peer connection */ -/*******************************************************************/ - -static void -send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - gsize writelen; - gssize wrotelen; - - conn = data; - writelen = purple_circ_buffer_get_max_read(conn->buffer_outgoing); - - if (writelen == 0) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - /* - * The buffer is currently empty, so reset the current input - * and output positions to the start of the buffer. We do - * this so that the next chunk of data that we put into the - * buffer can be read back out of the buffer in one fell swoop. - * Otherwise it gets fragmented and we have to read from the - * second half of the buffer than go back and read the rest of - * the chunk from the first half. - * - * We're using TCP, which is a stream based protocol, so this - * isn't supposed to matter. However, experience has shown - * that at least the proxy file transfer code in AIM 6.1.41.2 - * requires that the entire OFT frame arrive all at once. If - * the frame is fragmented then AIM freaks out and aborts the - * file transfer. Somebody should teach those guys how to - * write good TCP code. - */ - conn->buffer_outgoing->inptr = conn->buffer_outgoing->buffer; - conn->buffer_outgoing->outptr = conn->buffer_outgoing->buffer; - return; - } - - wrotelen = send(conn->fd, conn->buffer_outgoing->outptr, writelen, 0); - if (wrotelen <= 0) - { - if (wrotelen < 0 && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) - /* No worries */ - return; - - if (conn->ready) - { - purple_input_remove(conn->watcher_outgoing); - conn->watcher_outgoing = 0; - close(conn->fd); - conn->fd = -1; - peer_connection_schedule_destroy(conn, - OSCAR_DISCONNECT_LOST_CONNECTION, NULL); - } - else - { - /* - * This could happen when unable to send a negotiation - * frame to a peer proxy server. - */ - peer_connection_trynext(conn); - } - return; - } - - purple_circ_buffer_mark_read(conn->buffer_outgoing, wrotelen); - conn->lastactivity = time(NULL); -} - -/** - * This should be called by OFT/ODC code to send a standard OFT or ODC - * frame across the peer connection along with some payload data. Or - * maybe a file. Anything, really. - */ -void -peer_connection_send(PeerConnection *conn, ByteStream *bs) -{ - /* Add everything to our outgoing buffer */ - purple_circ_buffer_append(conn->buffer_outgoing, bs->data, bs->len); - - /* If we haven't already started writing stuff, then start the cycle */ - if ((conn->watcher_outgoing == 0) && (conn->fd >= 0)) - { - conn->watcher_outgoing = purple_input_add(conn->fd, - PURPLE_INPUT_WRITE, send_cb, conn); - send_cb(conn, conn->fd, 0); - } -} - -/*******************************************************************/ -/* End code for sending data on a peer connection */ -/*******************************************************************/ - -/*******************************************************************/ -/* Begin code for establishing a peer connection */ -/*******************************************************************/ - -void -peer_connection_finalize_connection(PeerConnection *conn) -{ - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_connection_recv_cb, conn); - - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - /* - * If we are connecting to them then send our cookie so they - * can verify who we are. Note: This doesn't seem to be - * necessary, but it also doesn't seem to hurt. - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING)) - peer_odc_send_cookie(conn); - } - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - if (purple_xfer_get_type(conn->xfer) == PURPLE_XFER_SEND) - { - peer_oft_send_prompt(conn); - } - } - - /* - * Tell the remote user that we're connected (which may also imply - * that we've accepted their request). - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_IS_INCOMING)) - aim_im_sendch2_connected(conn); -} - -/** - * We tried to make an outgoing connection to a remote user. It - * either connected or failed to connect. - */ -static void -peer_connection_common_established_cb(gpointer data, gint source, const gchar *error_message, gboolean verified) -{ - PeerConnection *conn; - - conn = data; - - if (verified) - conn->verified_connect_data = NULL; - else - conn->client_connect_data = NULL; - - if (source < 0) - { - if ((conn->verified_connect_data == NULL) && - (conn->client_connect_data == NULL)) - { - /* Our parallel connection attemps have both failed. */ - peer_connection_trynext(conn); - } - return; - } - - purple_timeout_remove(conn->connect_timeout_timer); - conn->connect_timeout_timer = 0; - - if (conn->client_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->client_connect_data); - conn->client_connect_data = NULL; - } - - if (conn->verified_connect_data != NULL) - { - purple_proxy_connect_cancel(conn->verified_connect_data); - conn->verified_connect_data = NULL; - } - - conn->fd = source; - - peer_connection_finalize_connection(conn); -} - -static void -peer_connection_verified_established_cb(gpointer data, gint source, const gchar *error_message) -{ - peer_connection_common_established_cb(data, source, error_message, TRUE); -} - -static void -peer_connection_client_established_cb(gpointer data, gint source, const gchar *error_message) -{ - peer_connection_common_established_cb(data, source, error_message, FALSE); -} - -/** - * This is the watcher callback for any listening socket that is - * waiting for a peer to connect. When a peer connects we set the - * input watcher to start reading data from the peer. - * - * To make sure that the connection is with the intended person and - * not with a malicious middle man, we don't send anything until we've - * received a peer frame from the remote user and have verified that - * the cookie in the peer frame matches the cookie that was exchanged - * in the channel 2 ICBM. - */ -void -peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - OscarData *od; - PurpleConnection *gc; - struct sockaddr addr; - socklen_t addrlen = sizeof(addr); - int flags; - - conn = data; - od = conn->od; - gc = od->gc; - - purple_debug_info("oscar", "Accepting connection on listener socket.\n"); - - conn->fd = accept(conn->listenerfd, &addr, &addrlen); - if (conn->fd < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No connection yet--no worries */ - /* TODO: Hmm, but they SHOULD be connected if we're here, right? */ - return; - - peer_connection_trynext(conn); - return; - } - - if ((addr.sa_family != PF_INET) && (addr.sa_family != PF_INET6)) - { - /* Invalid connection type?! Continue waiting. */ - close(conn->fd); - return; - } - - flags = fcntl(conn->fd, F_GETFL); - fcntl(conn->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(conn->fd, F_SETFD, FD_CLOEXEC); -#endif - - purple_input_remove(conn->watcher_incoming); - - peer_connection_finalize_connection(conn); -} - -/** - * We've just opened a listener socket, so we send the remote - * user an ICBM and ask them to connect to us. - */ -static void -peer_connection_establish_listener_cb(int listenerfd, gpointer data) -{ - PeerConnection *conn; - OscarData *od; - PurpleConnection *gc; - PurpleAccount *account; - PurpleConversation *conv; - char *tmp; - FlapConnection *bos_conn; - const char *listener_ip; - unsigned short listener_port; - - conn = data; - conn->listen_data = NULL; - - if (listenerfd < 0) - { - /* Could not open listener socket */ - peer_connection_trynext(conn); - return; - } - - od = conn->od; - gc = od->gc; - account = purple_connection_get_account(gc); - conn->listenerfd = listenerfd; - - /* Watch for new connections on our listener socket */ - conn->watcher_incoming = purple_input_add(conn->listenerfd, - PURPLE_INPUT_READ, peer_connection_listen_cb, conn); - - /* Send the "please connect to me!" ICBM */ - bos_conn = flap_connection_findbygroup(od, SNAC_FAMILY_ICBM); - if (bos_conn == NULL) - { - /* Not good */ - peer_connection_trynext(conn); - return; - } - - if (bos_conn->gsc) - listener_ip = purple_network_get_my_ip(bos_conn->gsc->fd); - else - listener_ip = purple_network_get_my_ip(bos_conn->fd); - listener_port = purple_network_get_port_from_fd(conn->listenerfd); - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - aim_im_sendch2_odc_requestdirect(od, - conn->cookie, conn->bn, purple_network_ip_atoi(listener_ip), - listener_port, ++conn->lastrequestnumber); - - /* Print a message to a local conversation window */ - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for " - "Direct IM."), conn->bn, listener_ip, listener_port); - purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - const guchar *ip_atoi = purple_network_ip_atoi(listener_ip); - if (ip_atoi == NULL) { - purple_debug_error("oscar", "Cannot send file. atoi(%s) failed.\n" - "Other possibly useful information: fd = %d, port = %d\n", - listener_ip ? listener_ip : "(null!)", conn->listenerfd, - listener_port); - purple_xfer_cancel_local(conn->xfer); - return; - } - aim_im_sendch2_sendfile_requestdirect(od, - conn->cookie, conn->bn, - ip_atoi, - listener_port, ++conn->lastrequestnumber, - (const gchar *)conn->xferdata.name, - conn->xferdata.size, conn->xferdata.totfiles); - } -} - -/** - * This is a callback function used when we're connecting to a peer - * using either the client IP or the verified IP and the connection - * took longer than 5 seconds to complete. We do this because - * waiting for the OS to time out the connection attempt is not - * practical--the default timeout on many OSes can be 3 minutes or - * more, and users are impatient. - * - * Worst case scenario: the user is connected to the Internet using - * a modem with severe lag. The peer connections fail and Purple falls - * back to using a proxied connection. The lower bandwidth - * limitations imposed by the proxied connection won't matter because - * the user is using a modem. - * - * I suppose this line of thinking is discriminatory against people - * with very high lag but decent throughput who are transferring - * large files. But we don't care about those people. - * - * I (Sean) changed the timeout from 15 to 5 seconds, as 60 seconds is - * too long for a user to wait to send a file. I'm also parallelizing - * requests when possible. The longest we should have to wait now is 10 - * seconds. We shouldn't make it shorter than this. - */ -static gboolean -peer_connection_tooktoolong(gpointer data) -{ - PeerConnection *conn; - - conn = data; - - purple_debug_info("oscar", "Peer connection timed out after 5 seconds. " - "Trying next method...\n"); - - peer_connection_trynext(conn); - - /* Cancel this timer. It'll be added again, if needed. */ - return FALSE; -} - -/** - * Try to establish the given PeerConnection using a defined - * sequence of steps. - */ -void -peer_connection_trynext(PeerConnection *conn) -{ - PurpleAccount *account; - - account = purple_connection_get_account(conn->od->gc); - - /* - * Close any remnants of a previous failed connection attempt. - */ - peer_connection_close(conn); - - /* - * 1. Attempt to connect to the remote user using their verifiedip and clientip. - * We try these at the same time and use whichever succeeds first, so we don't - * have to wait for a timeout. - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_DIRECT) && - (conn->verifiedip != NULL) && (conn->port != 0) && (!conn->use_proxy)) - { - conn->flags |= PEER_CONNECTION_FLAG_TRIED_DIRECT; - - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - gchar *tmp; - PurpleConversation *conv; - tmp = g_strdup_printf(_("Attempting to connect to %s:%hu."), - conn->verifiedip, conn->port); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - - conn->verified_connect_data = purple_proxy_connect(NULL, account, - conn->verifiedip, conn->port, - peer_connection_verified_established_cb, conn); - - if ((conn->verifiedip == NULL) || - strcmp(conn->verifiedip, conn->clientip)) - { - conn->client_connect_data = purple_proxy_connect(NULL, account, - conn->clientip, conn->port, - peer_connection_client_established_cb, conn); - } - - if ((conn->verified_connect_data != NULL) || - (conn->client_connect_data != NULL)) - { - /* Connecting... */ - conn->connect_timeout_timer = purple_timeout_add_seconds(5, - peer_connection_tooktoolong, conn); - return; - } - } - - /* - * 2. Attempt to have the remote user connect to us (using both - * our verifiedip and our clientip). - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_INCOMING) && - (!conn->use_proxy)) - { - conn->flags |= PEER_CONNECTION_FLAG_TRIED_INCOMING; - - /* - * Remote user is connecting to us, so we'll need to verify - * that the user who connected is our friend. - */ - conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - - conn->listen_data = purple_network_listen_range(5190, 5290, SOCK_STREAM, - peer_connection_establish_listener_cb, conn); - if (conn->listen_data != NULL) - { - /* Opening listener socket... */ - return; - } - } - - /* - * 3. Attempt to have both users connect to an intermediate proxy - * server. - */ - if (!(conn->flags & PEER_CONNECTION_FLAG_TRIED_PROXY)) - { - conn->flags |= PEER_CONNECTION_FLAG_TRIED_PROXY; - - /* - * If we initiate the proxy connection, then the remote user - * could be anyone, so we need to verify that the user who - * connected is our friend. - */ - if (!conn->use_proxy) - conn->flags |= PEER_CONNECTION_FLAG_IS_INCOMING; - - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - { - gchar *tmp; - PurpleConversation *conv; - tmp = g_strdup(_("Attempting to connect via proxy server.")); - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, conn->bn); - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmp); - } - - conn->verified_connect_data = purple_proxy_connect(NULL, account, - (conn->proxyip != NULL) ? conn->proxyip : PEER_PROXY_SERVER, - PEER_PROXY_PORT, - peer_proxy_connection_established_cb, conn); - if (conn->verified_connect_data != NULL) - { - /* Connecting... */ - return; - } - } - - /* Give up! */ - peer_connection_destroy(conn, OSCAR_DISCONNECT_COULD_NOT_CONNECT, NULL); -} - -/** - * Initiate a peer connection with someone. - */ -void -peer_connection_propose(OscarData *od, OscarCapability type, const char *bn) -{ - PeerConnection *conn; - - if (type == OSCAR_CAPABILITY_DIRECTIM) - { - conn = peer_connection_find_by_type(od, bn, type); - if (conn != NULL) - { - if (conn->ready) - { - PurpleAccount *account; - PurpleConversation *conv; - - purple_debug_info("oscar", "Already have a direct IM " - "session with %s.\n", bn); - account = purple_connection_get_account(od->gc); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - bn, account); - if (conv != NULL) - purple_conversation_present(conv); - return; - } - - /* Cancel the old connection and try again */ - peer_connection_destroy(conn, OSCAR_DISCONNECT_RETRYING, NULL); - } - } - - conn = peer_connection_new(od, type, bn); - conn->flags |= PEER_CONNECTION_FLAG_INITIATED_BY_ME; - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - aim_icbm_makecookie(conn->cookie); - - peer_connection_trynext(conn); -} - -/** - * Someone else wants to establish a peer connection with us, - * and we said yes. - */ -static void -peer_connection_got_proposition_yes_cb(gpointer data, gint id) -{ - PeerConnection *conn; - - conn = data; - - conn->flags |= PEER_CONNECTION_FLAG_APPROVED; - peer_connection_trynext(conn); -} - -/** - * Someone else wants to establish a peer connection with us, - * and we said no. - * - * "Well, one time my friend asked me if I wanted to play the - * piccolo. But I said no." - */ -static void -peer_connection_got_proposition_no_cb(gpointer data, gint id) -{ - PeerConnection *conn; - - conn = data; - - aim_im_denytransfer(conn->od, conn->bn, conn->cookie, - AIM_TRANSFER_DENY_DECLINE); - peer_connection_destroy(conn, OSCAR_DISCONNECT_LOCAL_CLOSED, NULL); -} - -/** - * Someone else wants to establish a peer connection with us. - */ -void -peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *message, IcbmArgsCh2 *args) -{ - PurpleConnection *gc; - PurpleAccount *account; - PeerConnection *conn; - gchar *buf; - - gc = od->gc; - account = purple_connection_get_account(gc); - - /* - * If we have a connection with this same cookie then they are - * probably just telling us they weren't able to connect to us - * and we should try connecting to them, instead. Or they want - * to go through a proxy. - */ - conn = peer_connection_find_by_cookie(od, bn, args->cookie); - if ((conn != NULL) && (conn->type == args->type)) - { - purple_debug_info("oscar", "Remote user wants to try a " - "different connection method\n"); - g_free(conn->proxyip); - g_free(conn->clientip); - g_free(conn->verifiedip); - if (args->use_proxy) - conn->proxyip = g_strdup(args->proxyip); - else - conn->proxyip = NULL; - conn->verifiedip = g_strdup(args->verifiedip); - conn->clientip = g_strdup(args->clientip); - conn->port = args->port; - conn->use_proxy |= args->use_proxy; - conn->lastrequestnumber++; - peer_connection_trynext(conn); - return; - } - - /* If this is a direct IM, then close any existing session */ - if (args->type == OSCAR_CAPABILITY_DIRECTIM) - { - conn = peer_connection_find_by_type(od, bn, args->type); - if (conn != NULL) - { - /* Close the old direct IM and start a new one */ - purple_debug_info("oscar", "Received new direct IM request " - "from %s. Destroying old connection.\n", bn); - peer_connection_destroy(conn, OSCAR_DISCONNECT_REMOTE_CLOSED, NULL); - } - } - - /* Check for proper arguments */ - if (args->type == OSCAR_CAPABILITY_SENDFILE) - { - if ((args->info.sendfile.filename == NULL) || - (args->info.sendfile.totsize == 0) || - (args->info.sendfile.totfiles == 0)) - { - purple_debug_warning("oscar", - "%s tried to send you a file with incomplete " - "information.\n", bn); - return; - } - } - - conn = peer_connection_new(od, args->type, bn); - memcpy(conn->cookie, args->cookie, 8); - if (args->use_proxy) - conn->proxyip = g_strdup(args->proxyip); - conn->clientip = g_strdup(args->clientip); - conn->verifiedip = g_strdup(args->verifiedip); - conn->port = args->port; - conn->use_proxy |= args->use_proxy; - conn->lastrequestnumber++; - - if (args->type == OSCAR_CAPABILITY_DIRECTIM) - { - buf = g_strdup_printf(_("%s has just asked to directly connect to %s"), - bn, purple_account_get_username(account)); - - purple_request_action(conn, NULL, buf, - _("This requires a direct connection between " - "the two computers and is necessary for IM " - "Images. Because your IP address will be " - "revealed, this may be considered a privacy " - "risk."), - PURPLE_DEFAULT_ACTION_NONE, - account, bn, NULL, - conn, 2, - _("C_onnect"), G_CALLBACK(peer_connection_got_proposition_yes_cb), - _("Cancel"), G_CALLBACK(peer_connection_got_proposition_no_cb)); - } - else if (args->type == OSCAR_CAPABILITY_SENDFILE) - { - gchar *filename; - - conn->xfer = purple_xfer_new(account, PURPLE_XFER_RECEIVE, bn); - if (conn->xfer) - { - conn->xfer->data = conn; - purple_xfer_ref(conn->xfer); - purple_xfer_set_size(conn->xfer, args->info.sendfile.totsize); - - /* Set the file name */ - if (g_utf8_validate(args->info.sendfile.filename, -1, NULL)) - filename = g_strdup(args->info.sendfile.filename); - else - filename = purple_utf8_salvage(args->info.sendfile.filename); - - if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) - { - /* - * If they are sending us a directory then the last character - * of the file name will be an asterisk. We don't want to - * save stuff to a directory named "*" so we remove the - * asterisk from the file name. - */ - char *tmp = strrchr(filename, '\\'); - if ((tmp != NULL) && (tmp[1] == '*')) - tmp[0] = '\0'; - } - purple_xfer_set_filename(conn->xfer, filename); - g_free(filename); - - /* - * Set the message, unless this is the dummy message from an - * ICQ client or an empty message from an AIM client. - * TODO: Maybe we should strip HTML and then see if strlen>0? - */ - if ((message != NULL) && - (g_ascii_strncasecmp(message, "", 13) != 0) && - (g_ascii_strcasecmp(message, "") != 0)) - { - purple_xfer_set_message(conn->xfer, message); - } - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(conn->xfer, peer_oft_recvcb_init); - purple_xfer_set_end_fnc(conn->xfer, peer_oft_recvcb_end); - purple_xfer_set_request_denied_fnc(conn->xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_cancel_recv_fnc(conn->xfer, peer_oft_cb_generic_cancel); - purple_xfer_set_ack_fnc(conn->xfer, peer_oft_recvcb_ack_recv); - - /* Now perform the request */ - purple_xfer_request(conn->xfer); - } - } -} - -/*******************************************************************/ -/* End code for establishing a peer connection */ -/*******************************************************************/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,281 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * OFT and ODC Services - */ - -#ifndef _PEER_H_ -#define _PEER_H_ - -#include "ft.h" -#include "network.h" -#include "proxy.h" - -typedef struct _ChecksumData ChecksumData; -typedef struct _OdcFrame OdcFrame; -typedef struct _OftFrame OftFrame; -typedef struct _ProxyFrame ProxyFrame; -typedef struct _PeerConnection PeerConnection; - -#define PEER_CONNECTION_FLAG_INITIATED_BY_ME 0x0001 -#define PEER_CONNECTION_FLAG_APPROVED 0x0002 -#define PEER_CONNECTION_FLAG_TRIED_DIRECT 0x0004 -#define PEER_CONNECTION_FLAG_TRIED_INCOMING 0x0008 -#define PEER_CONNECTION_FLAG_TRIED_PROXY 0x0010 -#define PEER_CONNECTION_FLAG_IS_INCOMING 0x0020 - -#define PEER_TYPE_PROMPT 0x0101 /* "I am going to send you this file, is that ok?" */ -#define PEER_TYPE_RESUMEACCEPT 0x0106 /* We are accepting the resume */ -#define PEER_TYPE_ACK 0x0202 /* "Yes, it is ok for you to send me that file" */ -#define PEER_TYPE_DONE 0x0204 /* "I received that file with no problems, thanks a bunch" */ -#define PEER_TYPE_RESUME 0x0205 /* Resume transferring, sent by whoever receives */ -#define PEER_TYPE_RESUMEACK 0x0207 /* Our resume accept was ACKed */ - -#define PEER_TYPE_GETFILE_REQUESTLISTING 0x1108 /* "I have a listing.txt file, do you want it?" */ -#define PEER_TYPE_GETFILE_RECEIVELISTING 0x1209 /* "Yes, please send me your listing.txt file" */ -#define PEER_TYPE_GETFILE_RECEIVEDLISTING 0x120a /* received corrupt listing.txt file? I'm just guessing about this one... */ -#define PEER_TYPE_GETFILE_ACKLISTING 0x120b /* "I received the listing.txt file successfully" */ -#define PEER_TYPE_GETFILE_REQUESTFILE 0x120c /* "Please send me this file" */ - -/* - * For peer proxying - */ -#define PEER_PROXY_SERVER "ars.oscar.aol.com" -#define PEER_PROXY_PORT 5190 /* The port we should always connect to */ -#define PEER_PROXY_PACKET_VERSION 0x044a - -/* Thanks to Keith Lea and the Joust project for documenting these */ -#define PEER_PROXY_TYPE_ERROR 0x0001 -#define PEER_PROXY_TYPE_CREATE 0x0002 -#define PEER_PROXY_TYPE_CREATED 0x0003 -#define PEER_PROXY_TYPE_JOIN 0x0004 -#define PEER_PROXY_TYPE_READY 0x0005 - -struct _OdcFrame -{ - /* guchar magic[4]; */ /* 0 */ - /* guint16 length; */ /* 4 */ - guint16 type; /* 6 */ - guint16 subtype; /* 8 */ - /* Unknown */ /* 10 */ - guchar cookie[8]; /* 12 */ - /* Unknown */ - /* guint32 payloadlength; */ /* 28 */ - guint16 encoding; /* 32 */ - /* Unknown */ - guint16 flags; /* 38 */ - /* Unknown */ - guchar bn[32]; /* 44 */ - /* Unknown */ - ByteStream payload; /* 76 */ -}; - -struct _OftFrame -{ - /* guchar magic[4]; */ /* 0 */ - /* guint16 length; */ /* 4 */ - guint16 type; /* 6 */ - guchar cookie[8]; /* 8 */ - guint16 encrypt; /* 16 */ - guint16 compress; /* 18 */ - guint16 totfiles; /* 20 */ - guint16 filesleft; /* 22 */ - guint16 totparts; /* 24 */ - guint16 partsleft; /* 26 */ - guint32 totsize; /* 28 */ - guint32 size; /* 32 */ - guint32 modtime; /* 36 */ - guint32 checksum; /* 40 */ - guint32 rfrcsum; /* 44 */ - guint32 rfsize; /* 48 */ - guint32 cretime; /* 52 */ - guint32 rfcsum; /* 56 */ - guint32 nrecvd; /* 60 */ - guint32 recvcsum; /* 64 */ - guchar idstring[32]; /* 68 */ - guint8 flags; /* 100 */ - guint8 lnameoffset; /* 101 */ - guint8 lsizeoffset; /* 102 */ - guchar dummy[69]; /* 103 */ - guchar macfileinfo[16]; /* 172 */ - guint16 nencode; /* 188 */ - guint16 nlanguage; /* 190 */ - guchar *name; /* 192 */ - size_t name_length; - /* Payload? */ /* 256 */ -}; - -struct _ProxyFrame -{ - /* guint16 length; */ /* 0 */ - guint16 version; /* 2 */ - guint16 type; /* 4 */ - guint32 unknown; /* 6 */ - guint16 flags; /* 10 */ - ByteStream payload; /* 12 */ -}; - -struct _PeerConnection -{ - OscarData *od; - OscarCapability type; - char *bn; - guchar magic[4]; - guchar cookie[8]; - guint16 lastrequestnumber; - - gboolean ready; - int flags; /**< Bitmask of PEER_CONNECTION_FLAG_ */ - time_t lastactivity; /**< Time of last transmit. */ - guint destroy_timeout; - OscarDisconnectReason disconnect_reason; - char *error_message; - - /** - * A pointer to either an OdcFrame or an OftFrame. - */ - gpointer frame; - - /** - * This is only used when the peer connection is being established. - */ - PurpleProxyConnectData *client_connect_data; - PurpleProxyConnectData *verified_connect_data; - - /** - * This is only used when the peer connection is being established. - */ - PurpleNetworkListenData *listen_data; - - - /** - * This is only used when the peer connection is being established. - */ - guint connect_timeout_timer; - - /** - * This is only used while the remote user is attempting to - * connect to us. - */ - int listenerfd; - - int fd; - guint8 header[6]; - gssize header_received; - guint8 proxy_header[12]; - gssize proxy_header_received; - ByteStream buffer_incoming; - PurpleCircBuffer *buffer_outgoing; - guint watcher_incoming; - guint watcher_outgoing; - - /** - * IP address of the proxy server, if applicable. - */ - gchar *proxyip; - - /** - * IP address of the remote user from THEIR point of view. - */ - gchar *clientip; - - /** - * IP address of the remote user from the oscar server's - * point of view. - */ - gchar *verifiedip; - - guint16 port; - gboolean use_proxy; - - /** - * Checksumming - */ - ChecksumData *checksum_data; - - /* TODOFT */ - PurpleXfer *xfer; - OftFrame xferdata; - guint sending_data_timer; -}; - -/* - * For all peer connections - */ - -/** - * Create a new PeerConnection structure and initialize it with some - * sane defaults. - * - * @param type The type of the peer connection. One of - * OSCAR_CAPABILITY_DIRECTIM or OSCAR_CAPABILITY_SENDFILE. - */ -PeerConnection *peer_connection_new(OscarData *od, OscarCapability type, const char *bn); - -void peer_connection_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -void peer_connection_schedule_destroy(PeerConnection *conn, OscarDisconnectReason reason, const gchar *error_message); -PeerConnection *peer_connection_find_by_type(OscarData *od, const char *bn, OscarCapability type); -PeerConnection *peer_connection_find_by_cookie(OscarData *od, const char *bn, const guchar *cookie); - -void peer_connection_listen_cb(gpointer data, gint source, PurpleInputCondition cond); -void peer_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond); -void peer_connection_send(PeerConnection *conn, ByteStream *bs); - -void peer_connection_trynext(PeerConnection *conn); -void peer_connection_finalize_connection(PeerConnection *conn); -void peer_connection_propose(OscarData *od, OscarCapability type, const char *bn); -void peer_connection_got_proposition(OscarData *od, const gchar *bn, const gchar *message, IcbmArgsCh2 *args); - -/* - * For ODC - */ -void peer_odc_close(PeerConnection *conn); -void peer_odc_recv_frame(PeerConnection *conn, ByteStream *bs); -void peer_odc_send_cookie(PeerConnection *conn); -void peer_odc_send_typing(PeerConnection *conn, PurpleTypingState typing); -void peer_odc_send_im(PeerConnection *conn, const char *msg, int len, int encoding, gboolean autoreply); - -/* - * For OFT - */ -void peer_oft_close(PeerConnection *conn); -void peer_oft_recv_frame(PeerConnection *conn, ByteStream *bs); -void peer_oft_send_prompt(PeerConnection *conn); -void peer_oft_checksum_destroy(ChecksumData *checksum_data); - -/* Xfer callbacks for receiving a file */ -void peer_oft_recvcb_init(PurpleXfer *xfer); -void peer_oft_recvcb_end(PurpleXfer *xfer); -void peer_oft_recvcb_ack_recv(PurpleXfer *xfer, const guchar *buffer, size_t size); - -/* Xfer callbacks for sending a file */ -void peer_oft_sendcb_init(PurpleXfer *xfer); -void peer_oft_sendcb_ack(PurpleXfer *xfer, const guchar *buffer, size_t size); - -/* Xfer callbacks for both sending and receiving */ -void peer_oft_cb_generic_cancel(PurpleXfer *xfer); - -/* - * For peer proxying - */ -void peer_proxy_connection_established_cb(gpointer data, gint source, const gchar *error_message); - -#endif /* _PEER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer_proxy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer_proxy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer_proxy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/peer_proxy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,351 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "oscar.h" -#include "peer.h" - -static void -peer_proxy_send(PeerConnection *conn, ProxyFrame *frame) -{ - size_t length; - ByteStream bs; - - purple_debug_info("oscar", "Outgoing peer proxy frame with " - "type=0x%04hx, unknown=0x%08x, " - "flags=0x%04hx, and payload length=%hd\n", - frame->type, frame->unknown, - frame->flags, frame->payload.len); - - length = 12 + frame->payload.len; - byte_stream_new(&bs, length); - byte_stream_put16(&bs, length - 2); - byte_stream_put16(&bs, PEER_PROXY_PACKET_VERSION); - byte_stream_put16(&bs, frame->type); - byte_stream_put32(&bs, frame->unknown); - byte_stream_put16(&bs, frame->flags); - byte_stream_putraw(&bs, frame->payload.data, frame->payload.len); - - peer_connection_send(conn, &bs); - - byte_stream_destroy(&bs); -} - -/** - * Create a rendezvous "init send" packet and send it on its merry way. - * This is the first packet sent to the proxy server by the first client - * to indicate that this will be a proxied connection - * - * @param conn The peer connection. - */ -static void -peer_proxy_send_create_new_conn(PeerConnection *conn) -{ - ProxyFrame frame; - PurpleAccount *account; - const gchar *bn; - guint8 bn_length; - - memset(&frame, 0, sizeof(ProxyFrame)); - frame.type = PEER_PROXY_TYPE_CREATE; - frame.flags = 0x0000; - - account = purple_connection_get_account(conn->od->gc); - bn = purple_account_get_username(account); - bn_length = strlen(bn); - byte_stream_new(&frame.payload, 1 + bn_length + 8 + 20); - byte_stream_put8(&frame.payload, bn_length); - byte_stream_putraw(&frame.payload, (const guint8 *)bn, bn_length); - byte_stream_putraw(&frame.payload, conn->cookie, 8); - - byte_stream_put16(&frame.payload, 0x0001); /* Type */ - byte_stream_put16(&frame.payload, 16); /* Length */ - byte_stream_putcaps(&frame.payload, conn->type); /* Value */ - - peer_proxy_send(conn, &frame); -} - -/** - * Create a rendezvous "init recv" packet and send it on its merry way. - * This is the first packet sent to the proxy server by the second client - * involved in this rendezvous proxy session. - * - * @param conn The peer connection. - * @param pin The 2 byte PIN sent to us by the other user. This acts - * as our passcode when establishing the proxy session. - */ -static void -peer_proxy_send_join_existing_conn(PeerConnection *conn, guint16 pin) -{ - ProxyFrame frame; - PurpleAccount *account; - const gchar *bn; - guint8 bn_length; - - memset(&frame, 0, sizeof(ProxyFrame)); - frame.type = PEER_PROXY_TYPE_JOIN; - frame.flags = 0x0000; - - account = purple_connection_get_account(conn->od->gc); - bn = purple_account_get_username(account); - bn_length = strlen(bn); - byte_stream_new(&frame.payload, 1 + bn_length + 2 + 8 + 20); - byte_stream_put8(&frame.payload, bn_length); - byte_stream_putraw(&frame.payload, (const guint8 *)bn, bn_length); - byte_stream_put16(&frame.payload, pin); - byte_stream_putraw(&frame.payload, conn->cookie, 8); - - byte_stream_put16(&frame.payload, 0x0001); /* Type */ - byte_stream_put16(&frame.payload, 16); /* Length */ - byte_stream_putcaps(&frame.payload, conn->type); /* Value */ - - peer_proxy_send(conn, &frame); -} - -/** - * Handle an incoming peer proxy negotiation frame. - */ -static void -peer_proxy_recv_frame(PeerConnection *conn, ProxyFrame *frame) -{ - purple_debug_info("oscar", "Incoming peer proxy frame with " - "type=0x%04hx, unknown=0x%08x, " - "flags=0x%04hx, and payload length=%hd\n", frame->type, - frame->unknown, frame->flags, frame->payload.len); - - if (frame->type == PEER_PROXY_TYPE_CREATED) - { - /* - * Read in 2 byte port then 4 byte IP and tell the - * remote user to connect to it by sending an ICBM. - */ - guint16 pin; - int i; - guint8 ip[4]; - - pin = byte_stream_get16(&frame->payload); - for (i = 0; i < 4; i++) - ip[i] = byte_stream_get8(&frame->payload); - if (conn->type == OSCAR_CAPABILITY_DIRECTIM) - aim_im_sendch2_odc_requestproxy(conn->od, - conn->cookie, - conn->bn, ip, pin, ++conn->lastrequestnumber); - else if (conn->type == OSCAR_CAPABILITY_SENDFILE) - { - aim_im_sendch2_sendfile_requestproxy(conn->od, - conn->cookie, conn->bn, - ip, pin, ++conn->lastrequestnumber, - (const gchar *)conn->xferdata.name, - conn->xferdata.size, conn->xferdata.totfiles); - } - } - else if (frame->type == PEER_PROXY_TYPE_READY) - { - purple_input_remove(conn->watcher_incoming); - conn->watcher_incoming = 0; - - peer_connection_finalize_connection(conn); - } - else if (frame->type == PEER_PROXY_TYPE_ERROR) - { - if (byte_stream_empty(&frame->payload) >= 2) - { - guint16 error; - const char *msg; - error = byte_stream_get16(&frame->payload); - if (error == 0x000d) - msg = "bad request"; - else if (error == 0x0010) - msg = "initial request timed out"; - else if (error == 0x001a) - msg ="accept period timed out"; - else - msg = "unknown reason"; - purple_debug_info("oscar", "Proxy negotiation failed with " - "error 0x%04hx: %s\n", error, msg); - } - else - { - purple_debug_warning("oscar", "Proxy negotiation failed with " - "an unknown error\n"); - } - peer_connection_trynext(conn); - } - else - { - purple_debug_warning("oscar", "Unknown peer proxy frame type 0x%04hx.\n", - frame->type); - } -} - -static void -peer_proxy_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PeerConnection *conn; - gssize read; - ProxyFrame *frame; - - conn = data; - frame = conn->frame; - - /* Start reading a new proxy frame */ - if (frame == NULL) - { - /* Read the first 12 bytes (frame length and header) */ - read = recv(conn->fd, conn->proxy_header + conn->proxy_header_received, - 12 - conn->proxy_header_received, 0); - - /* Check if the proxy server closed the connection */ - if (read == 0) - { - purple_debug_info("oscar", "Peer proxy server closed connection\n"); - peer_connection_trynext(conn); - return; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - purple_debug_info("oscar", "Lost connection with peer proxy server\n"); - peer_connection_trynext(conn); - return; - } - - conn->lastactivity = time(NULL); - - /* If we don't even have the first 12 bytes then do nothing */ - conn->proxy_header_received += read; - if (conn->proxy_header_received < 12) - return; - - /* We only support a specific version of the proxy protocol */ - if (aimutil_get16(&conn->proxy_header[2]) != PEER_PROXY_PACKET_VERSION) - { - purple_debug_warning("oscar", "Expected peer proxy protocol " - "version %u but received version %u. Closing " - "connection.\n", PEER_PROXY_PACKET_VERSION, - aimutil_get16(&conn->proxy_header[2])); - peer_connection_trynext(conn); - return; - } - - /* Initialize a new temporary ProxyFrame for incoming data */ - frame = g_new0(ProxyFrame, 1); - frame->payload.len = aimutil_get16(&conn->proxy_header[0]) - 10; - frame->version = aimutil_get16(&conn->proxy_header[2]); - frame->type = aimutil_get16(&conn->proxy_header[4]); - frame->unknown = aimutil_get16(&conn->proxy_header[6]); - frame->flags = aimutil_get16(&conn->proxy_header[10]); - if (frame->payload.len > 0) - frame->payload.data = g_new(guint8, frame->payload.len); - conn->frame = frame; - } - - /* If this frame has a payload then attempt to read it */ - if (frame->payload.len - frame->payload.offset > 0) - { - /* Read data into the temporary buffer until it is complete */ - read = recv(conn->fd, - &frame->payload.data[frame->payload.offset], - frame->payload.len - frame->payload.offset, - 0); - - /* Check if the proxy server closed the connection */ - if (read == 0) - { - purple_debug_info("oscar", "Peer proxy server closed connection\n"); - g_free(frame->payload.data); - g_free(frame); - conn->frame = NULL; - peer_connection_trynext(conn); - return; - } - - /* If there was an error then close the connection */ - if (read < 0) - { - if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) - /* No worries */ - return; - - purple_debug_info("oscar", "Lost connection with peer proxy server\n"); - g_free(frame->payload.data); - g_free(frame); - conn->frame = NULL; - peer_connection_trynext(conn); - return; - } - - frame->payload.offset += read; - } - - conn->lastactivity = time(NULL); - if (frame->payload.offset < frame->payload.len) - /* Waiting for more data to arrive */ - return; - - /* We have a complete proxy frame! Handle it and continue reading */ - conn->frame = NULL; - byte_stream_rewind(&frame->payload); - peer_proxy_recv_frame(conn, frame); - - g_free(frame->payload.data); - g_free(frame); - - conn->proxy_header_received = 0; -} - -/** - * We tried to make an outgoing connection to a proxy server. It - * either connected or failed to connect. - */ -void -peer_proxy_connection_established_cb(gpointer data, gint source, const gchar *error_message) -{ - PeerConnection *conn; - - conn = data; - - conn->verified_connect_data = NULL; - - if (source < 0) - { - peer_connection_trynext(conn); - return; - } - - conn->fd = source; - conn->watcher_incoming = purple_input_add(conn->fd, - PURPLE_INPUT_READ, peer_proxy_connection_recv_cb, conn); - - if (conn->proxyip != NULL) - /* Connect to the session created by the remote user */ - peer_proxy_send_join_existing_conn(conn, conn->port); - else - /* Create a new session */ - peer_proxy_send_create_new_conn(conn); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/rxhandlers.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/rxhandlers.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/rxhandlers.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/rxhandlers.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,288 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" -#include "peer.h" - -aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group) -{ - aim_module_t *cur; - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - if (cur->family == group) - return cur; - } - - return NULL; -} - -aim_module_t *aim__findmodule(OscarData *od, const char *name) -{ - aim_module_t *cur; - - for (cur = (aim_module_t *)od->modlistv; cur; cur = cur->next) { - if (strcmp(name, cur->name) == 0) - return cur; - } - - return NULL; -} - -int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *)) -{ - aim_module_t *mod; - - if (!od || !modfirst) - return -1; - - mod = g_new0(aim_module_t, 1); - - if (modfirst(od, mod) == -1) { - g_free(mod); - return -1; - } - - if (aim__findmodule(od, mod->name)) { - if (mod->shutdown) - mod->shutdown(od, mod); - g_free(mod); - return -1; - } - - mod->next = (aim_module_t *)od->modlistv; - od->modlistv = mod; - - purple_debug_misc("oscar", "registered module %s (family 0x%04x, version = 0x%04x, tool 0x%04x, tool version 0x%04x)\n", mod->name, mod->family, mod->version, mod->toolid, mod->toolversion); - - return 0; -} - -void aim__shutdownmodules(OscarData *od) -{ - aim_module_t *cur; - - for (cur = (aim_module_t *)od->modlistv; cur; ) { - aim_module_t *tmp; - - tmp = cur->next; - - if (cur->shutdown) - cur->shutdown(od, cur); - - g_free(cur); - - cur = tmp; - } - - od->modlistv = NULL; - - return; -} - -#if 0 -/* - * Bleck functions get called when there's no non-bleck functions - * around to cleanup the mess... - */ -static int bleck(OscarData *od, FlapFrame *frame, ...) -{ - guint16 family, subtype; - guint16 maxf, maxs; - - static const char *channels[6] = { - "Invalid (0)", - "FLAP Version", - "SNAC", - "Invalid (3)", - "Negotiation", - "FLAP NOP" - }; - static const int maxchannels = 5; - - /* XXX: this is ugly. and big just for debugging. */ - static const char *literals[14][25] = { - {"Invalid", - NULL - }, - {"General", - "Invalid", - "Error", - "Client Ready", - "Server Ready", - "Service Request", - "Redirect", - "Rate Information Request", - "Rate Information", - "Rate Information Ack", - NULL, - "Rate Information Change", - "Server Pause", - NULL, - "Server Resume", - "Request Personal User Information", - "Personal User Information", - "Evil Notification", - NULL, - "Migration notice", - "Message of the Day", - "Set Privacy Flags", - "Well Known URL", - "NOP" - }, - {"Location", - "Invalid", - "Error", - "Request Rights", - "Rights Information", - "Set user information", - "Request User Information", - "User Information", - "Watcher Sub Request", - "Watcher Notification" - }, - {"Buddy List Management", - "Invalid", - "Error", - "Request Rights", - "Rights Information", - "Add Buddy", - "Remove Buddy", - "Watcher List Query", - "Watcher List Response", - "Watcher SubRequest", - "Watcher Notification", - "Reject Notification", - "Oncoming Buddy", - "Offgoing Buddy" - }, - {"Messeging", - "Invalid", - "Error", - "Add ICBM Parameter", - "Remove ICBM Parameter", - "Request Parameter Information", - "Parameter Information", - "Outgoing Message", - "Incoming Message", - "Evil Request", - "Evil Reply", - "Missed Calls", - "Message Error", - "Host Ack" - }, - {"Advertisements", - "Invalid", - "Error", - "Request Ad", - "Ad Data (GIFs)" - }, - {"Invitation / Client-to-Client", - "Invalid", - "Error", - "Invite a Friend", - "Invitation Ack" - }, - {"Administrative", - "Invalid", - "Error", - "Information Request", - "Information Reply", - "Information Change Request", - "Information Chat Reply", - "Account Confirm Request", - "Account Confirm Reply", - "Account Delete Request", - "Account Delete Reply" - }, - {"Popups", - "Invalid", - "Error", - "Display Popup" - }, - {"BOS", - "Invalid", - "Error", - "Request Rights", - "Rights Response", - "Set group permission mask", - "Add permission list entries", - "Delete permission list entries", - "Add deny list entries", - "Delete deny list entries", - "Server Error" - }, - {"User Lookup", - "Invalid", - "Error", - "Search Request", - "Search Response" - }, - {"Stats", - "Invalid", - "Error", - "Set minimum report interval", - "Report Events" - }, - {"Translate", - "Invalid", - "Error", - "Translate Request", - "Translate Reply", - }, - {"Chat Navigation", - "Invalid", - "Error", - "Request rights", - "Request Exchange Information", - "Request Room Information", - "Request Occupant List", - "Search for Room", - "Outgoing Message", - "Incoming Message", - "Evil Request", - "Evil Reply", - "Chat Error", - } - }; - - maxf = sizeof(literals) / sizeof(literals[0]); - maxs = sizeof(literals[0]) / sizeof(literals[0][0]); - - if (frame->channel == 0x02) { - - family = byte_stream_get16(&frame->data); - subtype = byte_stream_get16(&frame->data); - - if ((family < maxf) && (subtype+1 < maxs) && (literals[family][subtype] != NULL)) - purple_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (%s)\n", channels[frame->channel], family, subtype, literals[family][subtype+1]); - else - purple_debug_misc("oscar", "bleck: channel %s: null handler for %04x/%04x (no literal)\n", channels[frame->channel], family, subtype); - } else { - - if (frame->channel <= maxchannels) - purple_debug_misc("oscar", "bleck: channel %s (0x%02x)\n", channels[frame->channel], frame->channel); - else - purple_debug_misc("oscar", "bleck: unknown channel 0x%02x\n", frame->channel); - - } - - return 1; -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snac.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snac.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snac.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snac.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,167 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * - * Various SNAC-related dodads... - * - * outstanding_snacs is a list of aim_snac_t structs. A SNAC should be added - * whenever a new SNAC is sent and it should remain in the list until the - * response for it has been received. - * - * cleansnacs() should be called periodically by the client in order - * to facilitate the aging out of unreplied-to SNACs. This can and does - * happen, so it should be handled. - * - */ - -#include "oscar.h" - -/* - * Called from oscar_session_new() to initialize the hash. - */ -void aim_initsnachash(OscarData *od) -{ - int i; - - for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) - od->snac_hash[i] = NULL; - - return; -} - -aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen) -{ - aim_snac_t snac; - - snac.id = od->snacid_next++; - snac.family = family; - snac.type = type; - snac.flags = flags; - - if (datalen) { - if (!(snac.data = g_malloc(datalen))) - return 0; /* er... */ - memcpy(snac.data, data, datalen); - } else - snac.data = NULL; - - return aim_newsnac(od, &snac); -} - -/* - * Clones the passed snac structure and caches it in the - * list/hash. - */ -aim_snacid_t aim_newsnac(OscarData *od, aim_snac_t *newsnac) -{ - aim_snac_t *snac; - int index; - - if (!newsnac) - return 0; - - if (!(snac = g_malloc(sizeof(aim_snac_t)))) - return 0; - memcpy(snac, newsnac, sizeof(aim_snac_t)); - snac->issuetime = time(NULL); - - index = snac->id % FAIM_SNAC_HASH_SIZE; - - snac->next = (aim_snac_t *)od->snac_hash[index]; - od->snac_hash[index] = (void *)snac; - - return snac->id; -} - -/* - * Finds a snac structure with the passed SNAC ID, - * removes it from the list/hash, and returns a pointer to it. - * - * The returned structure must be freed by the caller. - * - */ -aim_snac_t *aim_remsnac(OscarData *od, aim_snacid_t id) -{ - aim_snac_t *cur, **prev; - int index; - - index = id % FAIM_SNAC_HASH_SIZE; - - for (prev = (aim_snac_t **)&od->snac_hash[index]; (cur = *prev); ) { - if (cur->id == id) { - *prev = cur->next; - if (cur->flags & AIM_SNACFLAGS_DESTRUCTOR) { - g_free(cur->data); - cur->data = NULL; - } - return cur; - } else - prev = &cur->next; - } - - return cur; -} - -/* - * This is for cleaning up old SNACs that either don't get replies or - * a reply was never received for. Garbage collection. Plain and simple. - * - * maxage is the _minimum_ age in seconds to keep SNACs. - * - */ -void aim_cleansnacs(OscarData *od, int maxage) -{ - int i; - - for (i = 0; i < FAIM_SNAC_HASH_SIZE; i++) { - aim_snac_t *cur, **prev; - time_t curtime; - - if (!od->snac_hash[i]) - continue; - - curtime = time(NULL); /* done here in case we waited for the lock */ - - for (prev = (aim_snac_t **)&od->snac_hash[i]; (cur = *prev); ) { - if ((curtime - cur->issuetime) > maxage) { - - *prev = cur->next; - - g_free(cur->data); - g_free(cur); - } else - prev = &cur->next; - } - } - - return; -} - -int aim_putsnac(ByteStream *bs, guint16 family, guint16 subtype, guint16 flags, aim_snacid_t snacid) -{ - - byte_stream_put16(bs, family); - byte_stream_put16(bs, subtype); - byte_stream_put16(bs, flags); - byte_stream_put32(bs, snacid); - - return 10; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snactypes.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snactypes.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snactypes.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/snactypes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,287 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * AIM Callback Types - * - */ -#ifndef _SNACTYPES_H_ -#define _SNACTYPES_H_ - -/* - * SNAC Families. - */ -#define SNAC_FAMILY_OSERVICE 0x0001 -#define SNAC_FAMILY_LOCATE 0x0002 -#define SNAC_FAMILY_BUDDY 0x0003 -#define SNAC_FAMILY_ICBM 0x0004 -#define SNAC_FAMILY_ADVERT 0x0005 -#define SNAC_FAMILY_INVITE 0x0006 -#define SNAC_FAMILY_ADMIN 0x0007 -#define SNAC_FAMILY_POPUP 0x0008 -#define SNAC_FAMILY_BOS 0x0009 -#define SNAC_FAMILY_USERLOOKUP 0x000a -#define SNAC_FAMILY_STATS 0x000b -#define SNAC_FAMILY_TRANSLATE 0x000c -#define SNAC_FAMILY_CHATNAV 0x000d -#define SNAC_FAMILY_CHAT 0x000e -#define SNAC_FAMILY_ODIR 0x000f -#define SNAC_FAMILY_BART 0x0010 -#define SNAC_FAMILY_FEEDBAG 0x0013 -#define SNAC_FAMILY_ICQ 0x0015 -#define SNAC_FAMILY_AUTH 0x0017 -#define SNAC_FAMILY_ALERT 0x0018 - -#define AIM_CB_FAM_SPECIAL 0xffff /* Internal libfaim use */ - -/* - * SNAC Family: Ack. - * - * Not really a family, but treating it as one really - * helps it fit into the libfaim callback structure better. - * - */ -#define AIM_CB_ACK_ACK 0x0001 - -/* - * SNAC Family: General. - */ -#define SNAC_SUBTYPE_OSERVICE_ERROR 0x0001 -#define SNAC_SUBTYPE_OSERVICE_CLIENTREADY 0x0002 -#define SNAC_SUBTYPE_OSERVICE_SERVERREADY 0x0003 -#define SNAC_SUBTYPE_OSERVICE_SERVICEREQ 0x0004 -#define SNAC_SUBTYPE_OSERVICE_REDIRECT 0x0005 -#define SNAC_SUBTYPE_OSERVICE_RATEINFOREQ 0x0006 -#define SNAC_SUBTYPE_OSERVICE_RATEINFO 0x0007 -#define SNAC_SUBTYPE_OSERVICE_RATEINFOACK 0x0008 -#define SNAC_SUBTYPE_OSERVICE_RATECHANGE 0x000a -#define SNAC_SUBTYPE_OSERVICE_SERVERPAUSE 0x000b -#define SNAC_SUBTYPE_OSERVICE_SERVERRESUME 0x000d -#define SNAC_SUBTYPE_OSERVICE_REQSELFINFO 0x000e -#define SNAC_SUBTYPE_OSERVICE_SELFINFO 0x000f -#define SNAC_SUBTYPE_OSERVICE_EVIL 0x0010 -#define SNAC_SUBTYPE_OSERVICE_SETIDLE 0x0011 -#define SNAC_SUBTYPE_OSERVICE_MIGRATIONREQ 0x0012 -#define SNAC_SUBTYPE_OSERVICE_MOTD 0x0013 -#define SNAC_SUBTYPE_OSERVICE_SETPRIVFLAGS 0x0014 -#define SNAC_SUBTYPE_OSERVICE_WELLKNOWNURL 0x0015 -#define SNAC_SUBTYPE_OSERVICE_NOP 0x0016 -#define SNAC_SUBTYPE_OSERVICE_DEFAULT 0xffff - -/* - * SNAC Family: Location Services. - */ -#define SNAC_SUBTYPE_LOCATE_ERROR 0x0001 -#define SNAC_SUBTYPE_LOCATE_REQRIGHTS 0x0002 -#define SNAC_SUBTYPE_LOCATE_RIGHTSINFO 0x0003 -#define SNAC_SUBTYPE_LOCATE_SETUSERINFO 0x0004 -#define SNAC_SUBTYPE_LOCATE_REQUSERINFO 0x0005 -#define SNAC_SUBTYPE_LOCATE_USERINFO 0x0006 -#define SNAC_SUBTYPE_LOCATE_WATCHERSUBREQ 0x0007 -#define SNAC_SUBTYPE_LOCATE_WATCHERNOT 0x0008 -#define SNAC_SUBTYPE_LOCATE_DEFAULT 0xffff - -/* - * SNAC Family: Buddy List Management Services. - */ -#define SNAC_SUBTYPE_BUDDY_ERROR 0x0001 -#define SNAC_SUBTYPE_BUDDY_REQRIGHTS 0x0002 -#define SNAC_SUBTYPE_BUDDY_RIGHTSINFO 0x0003 -#define SNAC_SUBTYPE_BUDDY_ADDBUDDY 0x0004 -#define SNAC_SUBTYPE_BUDDY_REMBUDDY 0x0005 -#define SNAC_SUBTYPE_BUDDY_REJECT 0x000a -#define SNAC_SUBTYPE_BUDDY_ONCOMING 0x000b -#define SNAC_SUBTYPE_BUDDY_OFFGOING 0x000c -#define SNAC_SUBTYPE_BUDDY_DEFAULT 0xffff - -/* - * SNAC Family: Messaging Services. - */ -#define SNAC_SUBTYPE_ICBM_ERROR 0x0001 -#define SNAC_SUBTYPE_ICBM_PARAMINFO 0x0005 -#define SNAC_SUBTYPE_ICBM_INCOMING 0x0007 -#define SNAC_SUBTYPE_ICBM_EVIL 0x0009 -#define SNAC_SUBTYPE_ICBM_MISSEDCALL 0x000a -#define SNAC_SUBTYPE_ICBM_CLIENTAUTORESP 0x000b -#define SNAC_SUBTYPE_ICBM_ACK 0x000c -#define SNAC_SUBTYPE_ICBM_MTN 0x0014 -#define SNAC_SUBTYPE_ICBM_DEFAULT 0xffff - -/* - * SNAC Family: Advertisement Services - */ -#define SNAC_SUBTYPE_ADVERT_ERROR 0x0001 -#define SNAC_SUBTYPE_ADVERT_DEFAULT 0xffff - -/* - * SNAC Family: Invitation Services. - */ -#define SNAC_SUBTYPE_INVITE_ERROR 0x0001 -#define SNAC_SUBTYPE_INVITE_DEFAULT 0xffff - -/* - * SNAC Family: Administrative Services. - */ -#define SNAC_SUBTYPE_ADMIN_ERROR 0x0001 -#define SNAC_SUBTYPE_ADMIN_INFOCHANGE_REPLY 0x0005 -#define SNAC_SUBTYPE_ADMIN_DEFAULT 0xffff - -/* - * SNAC Family: Popup Messages - */ -#define SNAC_SUBTYPE_POPUP_ERROR 0x0001 -#define SNAC_SUBTYPE_POPUP_DEFAULT 0xffff - -/* - * SNAC Family: Misc BOS Services. - */ -#define SNAC_SUBTYPE_BOS_ERROR 0x0001 -#define SNAC_SUBTYPE_BOS_RIGHTSQUERY 0x0002 -#define SNAC_SUBTYPE_BOS_RIGHTS 0x0003 -#define SNAC_SUBTYPE_BOS_DEFAULT 0xffff - -/* - * SNAC Family: User Lookup Services - */ -#define SNAC_SUBTYPE_USERLOOKUP_ERROR 0x0001 -#define SNAC_SUBTYPE_USERLOOKUP_DEFAULT 0xffff - -/* - * SNAC Family: User Status Services - */ -#define SNAC_SUBTYPE_STATS_ERROR 0x0001 -#define SNAC_SUBTYPE_STATS_SETREPORTINTERVAL 0x0002 -#define SNAC_SUBTYPE_STATS_REPORTACK 0x0004 -#define SNAC_SUBTYPE_STATS_DEFAULT 0xffff - -/* - * SNAC Family: Translation Services - */ -#define SNAC_SUBTYPE_TRANSLATE_ERROR 0x0001 -#define SNAC_SUBTYPE_TRANSLATE_DEFAULT 0xffff - -/* - * SNAC Family: Chat Navigation Services - */ -#define SNAC_SUBTYPE_CHATNAV_ERROR 0x0001 -#define SNAC_SUBTYPE_CHATNAV_CREATE 0x0008 -#define SNAC_SUBTYPE_CHATNAV_INFO 0x0009 -#define SNAC_SUBTYPE_CHATNAV_DEFAULT 0xffff - -/* - * SNAC Family: Chat Services - */ -#define SNAC_SUBTYPE_CHAT_ERROR 0x0001 -#define SNAC_SUBTYPE_CHAT_ROOMINFOUPDATE 0x0002 -#define SNAC_SUBTYPE_CHAT_USERJOIN 0x0003 -#define SNAC_SUBTYPE_CHAT_USERLEAVE 0x0004 -#define SNAC_SUBTYPE_CHAT_OUTGOINGMSG 0x0005 -#define SNAC_SUBTYPE_CHAT_INCOMINGMSG 0x0006 -#define SNAC_SUBTYPE_CHAT_DEFAULT 0xffff - -/* - * SNAC Family: "New" Search - */ -#define SNAC_SUBTYPE_ODIR_ERROR 0x0001 -#define SNAC_SUBTYPE_ODIR_SEARCH 0x0002 -#define SNAC_SUBTYPE_ODIR_RESULTS 0x0003 - -/* - * SNAC Family: Buddy icons - */ -#define SNAC_SUBTYPE_BART_ERROR 0x0001 -#define SNAC_SUBTYPE_BART_REQUEST 0x0004 -#define SNAC_SUBTYPE_BART_RESPONSE 0x0005 - -/* - * SNAC Family: Server-Stored Buddy Lists - */ -#define SNAC_SUBTYPE_FEEDBAG_ERROR 0x0001 -#define SNAC_SUBTYPE_FEEDBAG_REQRIGHTS 0x0002 -#define SNAC_SUBTYPE_FEEDBAG_RIGHTSINFO 0x0003 -#define SNAC_SUBTYPE_FEEDBAG_REQDATA 0x0004 -#define SNAC_SUBTYPE_FEEDBAG_REQIFCHANGED 0x0005 -#define SNAC_SUBTYPE_FEEDBAG_LIST 0x0006 -#define SNAC_SUBTYPE_FEEDBAG_ACTIVATE 0x0007 -#define SNAC_SUBTYPE_FEEDBAG_ADD 0x0008 -#define SNAC_SUBTYPE_FEEDBAG_MOD 0x0009 -#define SNAC_SUBTYPE_FEEDBAG_DEL 0x000A -#define SNAC_SUBTYPE_FEEDBAG_SRVACK 0x000E -#define SNAC_SUBTYPE_FEEDBAG_NOLIST 0x000F -#define SNAC_SUBTYPE_FEEDBAG_EDITSTART 0x0011 -#define SNAC_SUBTYPE_FEEDBAG_EDITSTOP 0x0012 -#define SNAC_SUBTYPE_FEEDBAG_SENDAUTH 0x0014 -#define SNAC_SUBTYPE_FEEDBAG_RECVAUTH 0x0015 -#define SNAC_SUBTYPE_FEEDBAG_SENDAUTHREQ 0x0018 -#define SNAC_SUBTYPE_FEEDBAG_RECVAUTHREQ 0x0019 -#define SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP 0x001a -#define SNAC_SUBTYPE_FEEDBAG_RECVAUTHREP 0x001b -#define SNAC_SUBTYPE_FEEDBAG_ADDED 0x001c - -/* - * SNAC Family: ICQ - * - * Most of these are actually special. - */ -#define SNAC_SUBTYPE_ICQ_ERROR 0x0001 -#define SNAC_SUBTYPE_ICQ_OFFLINEMSG 0x00f0 -#define SNAC_SUBTYPE_ICQ_OFFLINEMSGCOMPLETE 0x00f1 -#define SNAC_SUBTYPE_ICQ_INFO 0x00f2 -#define SNAC_SUBTYPE_ICQ_ALIAS 0x00f3 -#define SNAC_SUBTYPE_ICQ_DEFAULT 0xffff - -/* - * SNAC Family: Authorizer - * - * Used only in protocol versions three and above. - */ -#define SNAC_SUBTYPE_AUTH_ERROR 0x0001 -#define SNAC_SUBTYPE_AUTH_LOGINREQEST 0x0002 -#define SNAC_SUBTYPE_AUTH_LOGINRESPONSE 0x0003 -#define SNAC_SUBTYPE_AUTH_AUTHREQ 0x0006 -#define SNAC_SUBTYPE_AUTH_AUTHRESPONSE 0x0007 -#define SNAC_SUBTYPE_AUTH_SECURID_REQUEST 0x000a -#define SNAC_SUBTYPE_AUTH_SECURID_RESPONSE 0x000b - -/* - * SNAC Family: Email - * - * Used for getting information on the email address - * associated with your username. - */ -#define SNAC_SUBTYPE_ALERT_ERROR 0x0001 -#define SNAC_SUBTYPE_ALERT_SENDCOOKIES 0x0006 -#define SNAC_SUBTYPE_ALERT_MAILSTATUS 0x0007 -#define SNAC_SUBTYPE_ALERT_INIT 0x0016 - -/* - * SNAC Family: Internal Messages - * - * This isn't truly a SNAC family either, but using - * these, we can integrated non-SNAC services into - * the SNAC-centered libfaim callback structure. - */ -#define AIM_CB_SPECIAL_CONNERR 0x0003 -#define AIM_CB_SPECIAL_CONNINITDONE 0x0006 - -/* SNAC flags */ -#define AIM_SNACFLAGS_DESTRUCTOR 0x0001 - -#endif /* _SNACTYPES_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/tlv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/tlv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/tlv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/tlv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,825 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -#include "oscar.h" - -static aim_tlv_t * -createtlv(guint16 type, guint16 length, guint8 *value) -{ - aim_tlv_t *ret; - - ret = g_new(aim_tlv_t, 1); - ret->type = type; - ret->length = length; - ret->value = value; - - return ret; -} - -static void -freetlv(aim_tlv_t *oldtlv) -{ - g_free(oldtlv->value); - g_free(oldtlv); -} - -static GSList * -aim_tlv_read(GSList *list, ByteStream *bs) -{ - guint16 type, length; - aim_tlv_t *tlv; - - type = byte_stream_get16(bs); - length = byte_stream_get16(bs); - -#if 0 - /* - * This code hasn't been needed in years. It's been commented - * out since 2003, at the latest. It seems likely that it was - * just a bug in their server code that has since been fixed. - * In any case, here's the orignal comment, kept for historical - * purposes: - * - * Okay, so now AOL has decided that any TLV of - * type 0x0013 can only be two bytes, despite - * what the actual given length is. So here - * we dump any invalid TLVs of that sort. Hopefully - * there's no special cases to this special case. - * - mid (30jun2000) - */ - if ((type == 0x0013) && (length != 0x0002)) { - length = 0x0002; - return list; - } -#endif - if (length > byte_stream_empty(bs)) { - aim_tlvlist_free(list); - return NULL; - } - - tlv = createtlv(type, length, NULL); - if (tlv->length > 0) { - tlv->value = byte_stream_getraw(bs, length); - if (!tlv->value) { - freetlv(tlv); - aim_tlvlist_free(list); - return NULL; - } - } - - return g_slist_prepend(list, tlv); -} - -/** - * Read a TLV chain from a buffer. - * - * Reads and parses a series of TLV patterns from a data buffer; the - * returned structure is manipulatable with the rest of the TLV - * routines. When done with a TLV chain, aim_tlvlist_free() should - * be called to free the dynamic substructures. - * - * TODO: There should be a flag setable here to have the tlvlist contain - * bstream references, so that at least the ->value portion of each - * element doesn't need to be malloc/memcpy'd. This could prove to be - * just as efficient as the in-place TLV parsing used in a couple places - * in libfaim. - * - * @param bs Input bstream - * @return Return the TLV chain read - */ -GSList *aim_tlvlist_read(ByteStream *bs) -{ - GSList *list = NULL; - - while (byte_stream_empty(bs) > 0) { - list = aim_tlv_read(list, bs); - if (list == NULL) - return NULL; - } - - return g_slist_reverse(list); -} - -/** - * Read a TLV chain from a buffer. - * - * Reads and parses a series of TLV patterns from a data buffer; the - * returned structure is manipulatable with the rest of the TLV - * routines. When done with a TLV chain, aim_tlvlist_free() should - * be called to free the dynamic substructures. - * - * TODO: There should be a flag setable here to have the tlvlist contain - * bstream references, so that at least the ->value portion of each - * element doesn't need to be malloc/memcpy'd. This could prove to be - * just as efficient as the in-place TLV parsing used in a couple places - * in libfaim. - * - * @param bs Input bstream - * @param num The max number of TLVs that will be read, or -1 if unlimited. - * There are a number of places where you want to read in a tlvchain, - * but the chain is not at the end of the SNAC, and the chain is - * preceded by the number of TLVs. So you can limit that with this. - * @return Return the TLV chain read - */ -GSList *aim_tlvlist_readnum(ByteStream *bs, guint16 num) -{ - GSList *list = NULL; - - while ((byte_stream_empty(bs) > 0) && (num != 0)) { - list = aim_tlv_read(list, bs); - if (list == NULL) - return NULL; - num--; - } - - return g_slist_reverse(list); -} - -/** - * Read a TLV chain from a buffer. - * - * Reads and parses a series of TLV patterns from a data buffer; the - * returned structure is manipulatable with the rest of the TLV - * routines. When done with a TLV chain, aim_tlvlist_free() should - * be called to free the dynamic substructures. - * - * TODO: There should be a flag setable here to have the tlvlist contain - * bstream references, so that at least the ->value portion of each - * element doesn't need to be malloc/memcpy'd. This could prove to be - * just as efficient as the in-place TLV parsing used in a couple places - * in libfaim. - * - * @param bs Input bstream - * @param len The max length in bytes that will be read. - * There are a number of places where you want to read in a tlvchain, - * but the chain is not at the end of the SNAC, and the chain is - * preceded by the length of the TLVs. So you can limit that with this. - * @return Return the TLV chain read - */ -GSList *aim_tlvlist_readlen(ByteStream *bs, guint16 len) -{ - GSList *list = NULL; - - while ((byte_stream_empty(bs) > 0) && (len > 0)) { - list = aim_tlv_read(list, bs); - if (list == NULL) - return NULL; - - len -= 2 + 2 + ((aim_tlv_t *)list->data)->length; - } - - return g_slist_reverse(list); -} - -/** - * Duplicate a TLV chain. - * This is pretty self explanatory. - * - * @param orig The TLV chain you want to make a copy of. - * @return A newly allocated TLV chain. - */ -GSList *aim_tlvlist_copy(GSList *orig) -{ - GSList *new = NULL; - aim_tlv_t *tlv; - - while (orig != NULL) { - tlv = orig->data; - aim_tlvlist_add_raw(&new, tlv->type, tlv->length, tlv->value); - orig = orig->next; - } - - return new; -} - -/* - * Compare two TLV lists for equality. This probably is not the most - * efficient way to do this. - * - * @param one One of the TLV chains to compare. - * @param two The other TLV chain to compare. - * @return Return 0 if the lists are the same, return 1 if they are different. - */ -int aim_tlvlist_cmp(GSList *one, GSList *two) -{ - ByteStream bs1, bs2; - - if (aim_tlvlist_size(one) != aim_tlvlist_size(two)) - return 1; - - byte_stream_new(&bs1, aim_tlvlist_size(one)); - byte_stream_new(&bs2, aim_tlvlist_size(two)); - - aim_tlvlist_write(&bs1, &one); - aim_tlvlist_write(&bs2, &two); - - if (memcmp(bs1.data, bs2.data, bs1.len)) { - byte_stream_destroy(&bs1); - byte_stream_destroy(&bs2); - return 1; - } - - byte_stream_destroy(&bs1); - byte_stream_destroy(&bs2); - - return 0; -} - -/** - * Free a TLV chain structure - * - * Walks the list of TLVs in the passed TLV chain and - * frees each one. Note that any references to this data - * should be removed before calling this. - * - * @param list Chain to be freed - */ -void aim_tlvlist_free(GSList *list) -{ - while (list != NULL) - { - freetlv(list->data); - list = g_slist_delete_link(list, list); - } -} - -/** - * Count the number of TLVs in a chain. - * - * @param list Chain to be counted. - * @return The number of TLVs stored in the passed chain. - */ -int aim_tlvlist_count(GSList *list) -{ - GSList *cur; - int count; - - if (list == NULL) - return 0; - - for (cur = list, count = 0; cur; cur = cur->next) - count++; - - return count; -} - -/** - * Count the number of bytes in a TLV chain. - * - * @param list Chain to be sized - * @return The number of bytes that would be needed to - * write the passed TLV chain to a data buffer. - */ -int aim_tlvlist_size(GSList *list) -{ - GSList *cur; - int size; - - if (list == NULL) - return 0; - - for (cur = list, size = 0; cur; cur = cur->next) - size += (4 + ((aim_tlv_t *)cur->data)->length); - - return size; -} - -/** - * Adds the passed string as a TLV element of the passed type - * to the TLV chain. - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param length Length of string to add (not including %NULL). - * @param value String to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value) -{ - aim_tlv_t *tlv; - - if (list == NULL) - return 0; - - tlv = createtlv(type, length, NULL); - if (tlv->length > 0) - tlv->value = g_memdup(value, length); - - *list = g_slist_append(*list, tlv); - - return tlv->length; -} - -/** - * Add a one byte integer to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value) -{ - guint8 v8[1]; - - aimutil_put8(v8, value); - - return aim_tlvlist_add_raw(list, type, 1, v8); -} - -/** - * Add a two byte integer to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value) -{ - guint8 v16[2]; - - aimutil_put16(v16, value); - - return aim_tlvlist_add_raw(list, type, 2, v16); -} - -/** - * Add a four byte integer to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value) -{ - guint8 v32[4]; - - aimutil_put32(v32, value); - - return aim_tlvlist_add_raw(list, type, 4, v32); -} - -/** - * Add a string to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param value Value to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value) -{ - return aim_tlvlist_add_raw(list, type, strlen(value), (guint8 *)value); -} - -/** - * Adds a block of capability blocks to a TLV chain. The bitfield - * passed in should be a bitwise %OR of any of the %AIM_CAPS constants: - * - * %OSCAR_CAPABILITY_BUDDYICON Supports Buddy Icons - * %OSCAR_CAPABILITY_TALK Supports Voice Chat - * %OSCAR_CAPABILITY_IMIMAGE Supports DirectIM/IMImage - * %OSCAR_CAPABILITY_CHAT Supports Chat - * %OSCAR_CAPABILITY_GETFILE Supports Get File functions - * %OSCAR_CAPABILITY_SENDFILE Supports Send File functions - * - * @param list Destination chain - * @param type TLV type to add - * @param caps Bitfield of capability flags to send - * @return The size of the value added. - */ -int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps) -{ - guint8 buf[256]; /* TODO: Don't use a fixed length buffer */ - ByteStream bs; - - if (caps == 0) - return 0; /* nothing there anyway */ - - byte_stream_init(&bs, buf, sizeof(buf)); - - byte_stream_putcaps(&bs, caps); - - return aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), buf); -} - -/** - * Adds the given chatroom info to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param roomname The name of the chat. - * @param instance The instance. - * @return The size of the value added. - */ -int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance) -{ - int len; - ByteStream bs; - - byte_stream_new(&bs, 2 + 1 + strlen(roomname) + 2); - - byte_stream_put16(&bs, exchange); - byte_stream_put8(&bs, strlen(roomname)); - byte_stream_putstr(&bs, roomname); - byte_stream_put16(&bs, instance); - - len = aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data); - - byte_stream_destroy(&bs); - - return len; -} - -/** - * Adds a TLV with a zero length to a TLV chain. - * - * @param list Destination chain. - * @param type TLV type to add. - * @return The size of the value added. - */ -int aim_tlvlist_add_noval(GSList **list, const guint16 type) -{ - return aim_tlvlist_add_raw(list, type, 0, NULL); -} - -/* - * Note that the inner TLV chain will not be modifiable as a tlvchain once - * it is written using this. Or rather, it can be, but updates won't be - * made to this. - * - * TODO: Should probably support sublists for real. - * - * This is so neat. - * - * @param list Destination chain. - * @param type TLV type to add. - * @param t1 The TLV chain you want to write. - * @return The number of bytes written to the destination TLV chain. - * 0 is returned if there was an error or if the destination - * TLV chain has length 0. - */ -int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tlvlist) -{ - int buflen; - ByteStream bs; - - buflen = aim_tlvlist_size(*tlvlist); - - if (buflen <= 0) - return 0; - - byte_stream_new(&bs, buflen); - - aim_tlvlist_write(&bs, tlvlist); - - aim_tlvlist_add_raw(list, type, byte_stream_curpos(&bs), bs.data); - - byte_stream_destroy(&bs); - - return buflen; -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param length Length of string to add (not including %NULL). - * @param value String to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value) -{ - GSList *cur; - aim_tlv_t *tlv; - - if (list == NULL) - return 0; - - for (cur = *list; cur != NULL; cur = cur->next) - { - tlv = cur->data; - if (tlv->type == type) - break; - } - - if (cur == NULL) - /* TLV does not exist, so add a new one */ - return aim_tlvlist_add_raw(list, type, length, value); - - g_free(tlv->value); - tlv->length = length; - if (tlv->length > 0) { - tlv->value = g_memdup(value, length); - } else - tlv->value = NULL; - - return tlv->length; -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_str(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param str String to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_str(GSList **list, const guint16 type, const char *str) -{ - return aim_tlvlist_replace_raw(list, type, strlen(str), (const guchar *)str); -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_noval(GSList **list, const guint16 type) -{ - return aim_tlvlist_replace_raw(list, type, 0, NULL); -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param value 8 bit value to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value) -{ - guint8 v8[1]; - - aimutil_put8(v8, value); - - return aim_tlvlist_replace_raw(list, type, 1, v8); -} - -/** - * Substitute a TLV of a given type with a new TLV of the same type. If - * you attempt to replace a TLV that does not exist, this function will - * just add a new TLV as if you called aim_tlvlist_add_raw(). - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - * @param value 32 bit value to add. - * @return The length of the TLV. - */ -int aim_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value) -{ - guint8 v32[4]; - - aimutil_put32(v32, value); - - return aim_tlvlist_replace_raw(list, type, 4, v32); -} - -/** - * Remove all TLVs of a given type. If you attempt to remove a TLV - * that does not exist, nothing happens. - * - * @param list Desination chain (%NULL pointer if empty). - * @param type TLV type. - */ -void aim_tlvlist_remove(GSList **list, const guint16 type) -{ - GSList *cur, *next; - aim_tlv_t *tlv; - - if (list == NULL || *list == NULL) - return; - - cur = *list; - while (cur != NULL) - { - tlv = cur->data; - next = cur->next; - - if (tlv->type == type) - { - /* Delete this TLV */ - *list = g_slist_delete_link(*list, cur); - g_free(tlv->value); - g_free(tlv); - } - - cur = next; - } -} - -/** - * Write a TLV chain into a data buffer. - * - * Copies a TLV chain into a raw data buffer, writing only the number - * of bytes specified. This operation does not free the chain; - * aim_tlvlist_free() must still be called to free up the memory used - * by the chain structures. - * - * TODO: Clean this up, make better use of bstreams - * - * @param bs Input bstream - * @param list Source TLV chain - * @return Return 0 if the destination bstream is too small. - */ -int aim_tlvlist_write(ByteStream *bs, GSList **list) -{ - int goodbuflen; - GSList *cur; - aim_tlv_t *tlv; - - /* do an initial run to test total length */ - goodbuflen = aim_tlvlist_size(*list); - - if (goodbuflen > byte_stream_empty(bs)) - return 0; /* not enough buffer */ - - /* do the real write-out */ - for (cur = *list; cur; cur = cur->next) { - tlv = cur->data; - byte_stream_put16(bs, tlv->type); - byte_stream_put16(bs, tlv->length); - if (tlv->length > 0) - byte_stream_putraw(bs, tlv->value, tlv->length); - } - - return 1; /* TODO: This is a nonsensical return */ -} - - -/** - * Grab the Nth TLV of type type in the TLV list list. - * - * Returns a pointer to an aim_tlv_t of the specified type; - * %NULL on error. The @nth parameter is specified starting at %1. - * In most cases, there will be no more than one TLV of any type - * in a chain. - * - * @param list Source chain. - * @param type Requested TLV type. - * @param nth Index of TLV of type to get. - * @return The TLV you were looking for, or NULL if one could not be found. - */ -aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth) -{ - GSList *cur; - aim_tlv_t *tlv; - int i; - - for (cur = list, i = 0; cur != NULL; cur = cur->next) { - tlv = cur->data; - if (tlv->type == type) - i++; - if (i >= nth) - return tlv; - } - - return NULL; -} - -/** - * Get the length of the data of the nth TLV in the given TLV chain. - * - * @param list Source chain. - * @param type Requested TLV type. - * @param nth Index of TLV of type to get. - * @return The length of the data in this TLV, or -1 if the TLV could not be - * found. Unless -1 is returned, this value will be 2 bytes. - */ -int aim_tlv_getlength(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return -1; - - return tlv->length; -} - -char * -aim_tlv_getvalue_as_string(aim_tlv_t *tlv) -{ - char *ret; - - ret = g_malloc(tlv->length + 1); - memcpy(ret, tlv->value, tlv->length); - ret[tlv->length] = '\0'; - - return ret; -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as a string. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value of the TLV you were looking for, or NULL if one could - * not be found. This is a dynamic buffer and must be freed by the - * caller. - */ -char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return NULL; - - return aim_tlv_getvalue_as_string(tlv); -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as an 8bit - * integer. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value the TLV you were looking for, or 0 if one could - * not be found. - */ -guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return 0; /* erm */ - - return aimutil_get8(tlv->value); -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as a 16bit - * integer. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value the TLV you were looking for, or 0 if one could - * not be found. - */ -guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return 0; /* erm */ - - return aimutil_get16(tlv->value); -} - -/** - * Retrieve the data from the nth TLV in the given TLV chain as a 32bit - * integer. - * - * @param list Source TLV chain. - * @param type TLV type to search for. - * @param nth Index of TLV to return. - * @return The value the TLV you were looking for, or 0 if one could - * not be found. - */ -guint32 aim_tlv_get32(GSList *list, const guint16 type, const int nth) -{ - aim_tlv_t *tlv; - - tlv = aim_tlv_gettlv(list, type, nth); - if (tlv == NULL) - return 0; /* erm */ - - return aimutil_get32(tlv->value); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/oscar/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,291 +0,0 @@ -/* - * Purple's oscar protocol plugin - * This file is the legal property of its developers. - * Please see the AUTHORS file distributed alongside this file. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA -*/ - -/* - * A little bit of this - * A little bit of that - * It started with a kiss - * Now we're up to bat - */ - -#include "oscar.h" - -#include "core.h" - -#include - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -int oscar_get_ui_info_int(const char *str, int default_value) -{ - GHashTable *ui_info; - - ui_info = purple_core_get_ui_info(); - if (ui_info != NULL) { - gpointer value; - if (g_hash_table_lookup_extended(ui_info, str, NULL, &value)) - return GPOINTER_TO_INT(value); - } - - return default_value; -} - -const char *oscar_get_ui_info_string(const char *str, const char *default_value) -{ - GHashTable *ui_info; - const char *value = NULL; - - ui_info = purple_core_get_ui_info(); - if (ui_info != NULL) - value = g_hash_table_lookup(ui_info, str); - if (value == NULL) - value = default_value; - - return value; -} - -gchar *oscar_get_clientstring(void) -{ - const char *name, *version; - - name = oscar_get_ui_info_string("name", "Purple"); - version = oscar_get_ui_info_string("version", VERSION); - - return g_strdup_printf("%s/%s", name, version);; -} - -/* - * Tokenizing functions. Used to portably replace strtok/sep. - * -- DMP. - * - */ -/* TODO: Get rid of this and use glib functions */ -int -aimutil_tokslen(char *toSearch, int theindex, char dl) -{ - int curCount = 1; - char *next; - char *last; - int toReturn; - - last = toSearch; - next = strchr(toSearch, dl); - - while(curCount < theindex && next != NULL) { - curCount++; - last = next + 1; - next = strchr(last, dl); - } - - if ((curCount < theindex) || (next == NULL)) - toReturn = strlen(toSearch) - (curCount - 1); - else - toReturn = next - toSearch - (curCount - 1); - - return toReturn; -} - -int -aimutil_itemcnt(char *toSearch, char dl) -{ - int curCount; - char *next; - - curCount = 1; - - next = strchr(toSearch, dl); - - while(next != NULL) { - curCount++; - next = strchr(next + 1, dl); - } - - return curCount; -} - -char * -aimutil_itemindex(char *toSearch, int theindex, char dl) -{ - int curCount; - char *next; - char *last; - char *toReturn; - - curCount = 0; - - last = toSearch; - next = strchr(toSearch, dl); - - while (curCount < theindex && next != NULL) { - curCount++; - last = next + 1; - next = strchr(last, dl); - } - next = strchr(last, dl); - - if (curCount < theindex) { - toReturn = g_malloc(sizeof(char)); - *toReturn = '\0'; - } else { - if (next == NULL) { - toReturn = g_malloc((strlen(last) + 1) * sizeof(char)); - strcpy(toReturn, last); - } else { - toReturn = g_malloc((next - last + 1) * sizeof(char)); - memcpy(toReturn, last, (next - last)); - toReturn[next - last] = '\0'; - } - } - return toReturn; -} - -/** - * Calculate the checksum of a given icon. - */ -guint16 -aimutil_iconsum(const guint8 *buf, int buflen) -{ - guint32 sum; - int i; - - for (i=0, sum=0; i+1> 16) + (sum & 0x0000ffff); - - return sum; -} - -/** - * Check if the given name is a valid AIM username. - * Example: BobDole - * Example: Henry_Ford@mac.com - * Example: 1KrazyKat@example.com - * - * @return TRUE if the name is valid, FALSE if not. - */ -static gboolean -oscar_util_valid_name_aim(const char *name) -{ - int i; - - if (purple_email_is_valid(name)) - return TRUE; - - /* Normal AIM usernames can't start with a number */ - if (isdigit(name[0])) - return FALSE; - - for (i = 0; name[i] != '\0'; i++) { - if (!isalnum(name[i]) && (name[i] != ' ')) - return FALSE; - } - - return TRUE; -} - -/** - * Check if the given name is a valid ICQ username. - * Example: 1234567 - * - * @return TRUE if the name is valid, FALSE if not. - */ -gboolean -oscar_util_valid_name_icq(const char *name) -{ - int i; - - for (i = 0; name[i] != '\0'; i++) { - if (!isdigit(name[i])) - return FALSE; - } - - return TRUE; -} - -/** - * Check if the given name is a valid SMS username. - * Example: +19195551234 - * - * @return TRUE if the name is valid, FALSE if not. - */ -gboolean -oscar_util_valid_name_sms(const char *name) -{ - int i; - - if (name[0] != '+') - return FALSE; - - for (i = 1; name[i] != '\0'; i++) { - if (!isdigit(name[i])) - return FALSE; - } - - return TRUE; -} - -/** - * Check if the given name is a valid oscar username. - * - * @return TRUE if the name is valid, FALSE if not. - */ -gboolean -oscar_util_valid_name(const char *name) -{ - if ((name == NULL) || (*name == '\0')) - return FALSE; - - return oscar_util_valid_name_icq(name) - || oscar_util_valid_name_sms(name) - || oscar_util_valid_name_aim(name); -} - -/** - * This takes two names and compares them using the rules - * on usernames for AIM/AOL. Mainly, this means case and space - * insensitivity (all case differences and spacing differences are - * ignored, with the exception that usernames can not start with - * a space). - * - * @return 0 if equal, non-0 if different - */ -/* TODO: Do something different for email addresses. */ -int -oscar_util_name_compare(const char *name1, const char *name2) -{ - - if ((name1 == NULL) || (name2 == NULL)) - return -1; - - do { - while (*name2 == ' ') - name2++; - while (*name1 == ' ') - name1++; - if (toupper(*name1) != toupper(*name2)) - return 1; - } while ((*name1 != '\0') && name1++ && name2++); - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/AUTHORS qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/AUTHORS --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/AUTHORS 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/AUTHORS 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -Code Contributors -========= -puzzlebird : original author -gfhuang(poppyer): patches for libpurple 2.0.0beta2, maintainer -Yuan Qingyun : patches for libpurple 1.5.0, maintainer -henryouly : file transfer, udp sock5 proxy and qq_show, maintainer -hzhr : maintainer -joymarquis : maintainer -arfankai : fixed bugs in char_conv.c -rakescar : provided filter for HTML tag -yyw : improved performance on PPC linux -lvxiang : provided ip to location original code -markhuetsch : OpenQ merge into libpurple, maintainer 2006-2007 -ccpaging : maintainer since 2007 -icesky : maintainer since 2007 -csyfek : faces, maintainer since 2007 - -Lovely Patch Writers -========= -gnap : message displaying, documentation -manphiz : qun processing -moo : qun processing -Coly Li : qun processing -Emil Alexiev : captcha verification on login based on LumaQQ for MAC (2007), - login, add buddy, remove buddy, message exchange and logout -Chengming Wang : buddy memo -lonicerae : chat room window bugfix, server list bugfix, buddy memo - -Acknowledgement -========= -Shufeng Tan : http://sf.net/projects/perl-oicq -Jeff Ye : http://www.sinomac.com -Hu Zheng : http://forlinux.yeah.net -yunfan : http://www.myswear.net -OpenQ Team : http://openq.linuxsir.org -LumaQQ Team : http://lumaqq.linuxsir.org -Pidgin Team : http://www.pidgin.im -Huang Guan : http://home.xxsyzx.com -OpenQ Google Group : http://groups.google.com/group/openq - -Scrupulous Testers -========= -yegle -cnzhangbx -casparant -wd -x6719620 -netelk -and more, please let me know... thank you! diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,898 +0,0 @@ -/** - * @file buddy_info.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "request.h" - -#include "utils.h" -#include "packet_parse.h" -#include "buddy_list.h" -#include "buddy_info.h" -#include "char_conv.h" -#include "im.h" -#include "qq_define.h" -#include "qq_base.h" -#include "qq_network.h" - -#define QQ_HOROSCOPE_SIZE 13 -static const gchar *horoscope_names[] = { - "-", N_("Aquarius"), N_("Pisces"), N_("Aries"), N_("Taurus"), - N_("Gemini"), N_("Cancer"), N_("Leo"), N_("Virgo"), N_("Libra"), - N_("Scorpio"), N_("Sagittarius"), N_("Capricorn") -}; - -#define QQ_ZODIAC_SIZE 13 -static const gchar *zodiac_names[] = { - "-", N_("Rat"), N_("Ox"), N_("Tiger"), N_("Rabbit"), - N_("Dragon"), N_("Snake"), N_("Horse"), N_("Goat"), N_("Monkey"), - N_("Rooster"), N_("Dog"), N_("Pig") -}; - -#define QQ_BLOOD_SIZE 6 -static const gchar *blood_types[] = { - "-", "A", "B", "O", "AB", N_("Other") -}; - -#define QQ_PUBLISH_SIZE 3 -static const gchar *publish_types[] = { - N_("Visible"), N_("Friend Only"), N_("Private") -}; - -#define QQ_GENDER_SIZE 3 -static const gchar *genders[] = { - N_("Private"), - N_("Male"), - N_("Female"), -}; - -static const gchar *genders_zh[] = { - "-", - "\xc4\xd0", - "\xc5\xae", -}; - -#define QQ_FACES 134 -#define QQ_ICON_PREFIX "qq_" -#define QQ_ICON_SUFFIX ".png" - -enum { - QQ_INFO_UID = 0, QQ_INFO_NICK, QQ_INFO_COUNTRY, QQ_INFO_PROVINCE, QQ_INFO_ZIPCODE, - QQ_INFO_ADDR, QQ_INFO_TEL, QQ_INFO_AGE, QQ_INFO_GENDER, QQ_INFO_NAME, QQ_INFO_EMAIL, - QQ_INFO_PG_SN, QQ_INFO_PG_NUM, QQ_INFO_PG_SP, QQ_INFO_PG_BASE_NUM, QQ_INFO_PG_TYPE, - QQ_INFO_OCCU, QQ_INFO_HOME_PAGE, QQ_INFO_AUTH_TYPE, QQ_INFO_UNKNOW1, QQ_INFO_UNKNOW2, - QQ_INFO_FACE, QQ_INFO_MOBILE, QQ_INFO_MOBILE_TYPE, QQ_INFO_INTRO, QQ_INFO_CITY, - QQ_INFO_UNKNOW3, QQ_INFO_UNKNOW4, QQ_INFO_UNKNOW5, - QQ_INFO_IS_PUB_MOBILE, QQ_INFO_IS_PUB_CONTACT, QQ_INFO_COLLEGE, QQ_INFO_HOROSCOPE, - QQ_INFO_ZODIAC, QQ_INFO_BLOOD, QQ_INFO_SHOW, QQ_INFO_UNKNOW6, - QQ_INFO_LAST_2007, QQ_INFO_LAST -}; - -enum { - QQ_FIELD_UNUSED = 0, QQ_FIELD_BASE, QQ_FIELD_EXT, QQ_FIELD_CONTACT, QQ_FIELD_ADDR -}; - -enum { - QQ_FIELD_LABEL = 0, QQ_FIELD_STRING, QQ_FIELD_MULTI, QQ_FIELD_BOOL, QQ_FIELD_CHOICE -}; - -typedef struct { - int iclass; - int type; - char *id; - char *text; - const gchar **choice; - int choice_size; -} QQ_FIELD_INFO; - -static const QQ_FIELD_INFO field_infos[] = { - { QQ_FIELD_BASE, QQ_FIELD_STRING, "uid", N_("QQ Number"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "nick", N_("Nickname"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "country", N_("Country/Region"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "province", N_("Province/State"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "zipcode", N_("Zipcode"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "address", N_("Address"), NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "tel", N_("Phone Number"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "age", N_("Age"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_CHOICE, "gender", N_("Gender"), genders, QQ_GENDER_SIZE }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "name", N_("Name"), NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "email", N_("Email"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sn", "Pager Serial Num", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_num", "Pager Num", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sp", "Pager Serivce Provider", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sta", "Pager Station Num", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_type", "Pager Type", NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_STRING, "occupation", N_("Occupation"), NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "homepage", N_("Homepage"), NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_BOOL, "auth", N_("Authorize adding"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow1", "Unknow1", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow2", "Unknow2", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "face", "Face", NULL, 0 }, - { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "mobile", N_("Cellphone Number"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "mobile_type", "Cellphone Type", NULL, 0 }, - { QQ_FIELD_BASE, QQ_FIELD_MULTI, "intro", N_("Personal Introduction"), NULL, 0 }, - { QQ_FIELD_ADDR, QQ_FIELD_STRING, "city", N_("City/Area"), NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow3", "Unknow3", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow4", "Unknow4", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow5", "Unknow5", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_CHOICE, "pub_mobile", N_("Publish Mobile"), publish_types, QQ_PUBLISH_SIZE }, - { QQ_FIELD_CONTACT, QQ_FIELD_CHOICE, "pub_contact", N_("Publish Contact"), publish_types, QQ_PUBLISH_SIZE }, - { QQ_FIELD_EXT, QQ_FIELD_STRING, "college", N_("College"), NULL, 0 }, - { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "horoscope", N_("Horoscope"), horoscope_names, QQ_HOROSCOPE_SIZE }, - { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "zodiac", N_("Zodiac"), zodiac_names, QQ_ZODIAC_SIZE }, - { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "blood", N_("Blood"), blood_types, QQ_BLOOD_SIZE }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "qq_show", "QQ Show", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow6", "Unknow6", NULL, 0 }, - { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "LAST_2005", "LAST_2005", NULL, 0 } -}; - -typedef struct _modify_info_request { - PurpleConnection *gc; - int iclass; - gchar **segments; -} modify_info_request; - -#ifdef DEBUG -static void info_debug(gchar **segments) -{ -#if 0 - int index; - gchar *utf8_str; - for (index = 0; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].type == QQ_FIELD_STRING - || field_infos[index].type == QQ_FIELD_LABEL - || field_infos[index].type == QQ_FIELD_MULTI - || index == QQ_INFO_GENDER) { - utf8_str = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT); - purple_debug_info("QQ_BUDDY_INFO", "%s: %s\n", field_infos[index].text, utf8_str); - g_free(utf8_str); - continue; - } - purple_debug_info("QQ_BUDDY_INFO", "%s: %s\n", field_infos[index].text, segments[index]); - } -#endif -} -#endif - -static void info_display_only(PurpleConnection *gc, gchar **segments) -{ - PurpleNotifyUserInfo *user_info; - gchar *utf8_value; - int index; - int choice_num; - - user_info = purple_notify_user_info_new(); - - for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].iclass == QQ_FIELD_UNUSED) { - continue; - } - switch (field_infos[index].type) { - case QQ_FIELD_BOOL: - purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), - strtol(segments[index], NULL, 10) ? _("True") : _("False")); - break; - case QQ_FIELD_CHOICE: - choice_num = strtol(segments[index], NULL, 10); - if (choice_num < 0 || choice_num >= field_infos[index].choice_size) { - choice_num = 0; - } - - purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), field_infos[index].choice[choice_num]); - break; - case QQ_FIELD_LABEL: - case QQ_FIELD_STRING: - case QQ_FIELD_MULTI: - default: - if (strlen(segments[index]) != 0) { - utf8_value = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT); - purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), utf8_value); - g_free(utf8_value); - } - break; - } - } - - purple_notify_userinfo(gc, segments[0], user_info, NULL, NULL); - - purple_notify_user_info_destroy(user_info); - g_strfreev(segments); -} - -void qq_request_buddy_info(PurpleConnection *gc, guint32 uid, - guint32 update_class, int action) -{ - qq_data *qd; - gchar raw_data[16] = {0}; - - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - g_snprintf(raw_data, sizeof(raw_data), "%u", uid); - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data), - update_class, action); -} - -/* send packet to modify personal information */ -static void request_change_info(PurpleConnection *gc, gchar **segments) -{ - gint bytes = 0; - guint8 raw_data[MAX_PACKET_SIZE - 128] = {0}; - guint8 bar; - gchar *join; - - g_return_if_fail(segments != NULL); - - bar = 0x1f; - - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_put8(raw_data + bytes, bar); - - /* important! skip the first uid entry */ - join = g_strjoinv("\x1f", segments + 1); - bytes += qq_putdata(raw_data + bytes, (guint8 *)join, strlen(join)); - g_free(join); - - bytes += qq_put8(raw_data + bytes, bar); - - /* qq_show_packet("request_modify_info", raw_data, bytes); */ - qq_send_cmd(gc, QQ_CMD_UPDATE_INFO, raw_data, bytes); -} - -static void info_modify_cancel_cb(modify_info_request *info_request) -{ - g_strfreev(info_request->segments); - g_free(info_request); -} - -/* parse fields and send info packet */ -static void info_modify_ok_cb(modify_info_request *info_request, PurpleRequestFields *fields) -{ - PurpleConnection *gc; - qq_data *qd; - gchar **segments; - int index; - const char *utf8_str; - gchar *value; - int choice_num; - - gc = info_request->gc; - g_return_if_fail(gc != NULL && info_request->gc); - qd = (qq_data *) gc->proto_data; - segments = info_request->segments; - g_return_if_fail(segments != NULL); - - for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].iclass == QQ_FIELD_UNUSED) { - continue; - } - if (!purple_request_fields_exists(fields, field_infos[index].id)) { - continue; - } - switch (field_infos[index].type) { - case QQ_FIELD_BOOL: - value = purple_request_fields_get_bool(fields, field_infos[index].id) - ? g_strdup("1") : g_strdup("0"); - g_free(segments[index]); - segments[index] = value; - break; - case QQ_FIELD_CHOICE: - choice_num = purple_request_fields_get_choice(fields, field_infos[index].id); - if (choice_num < 0 || choice_num >= field_infos[index].choice_size) choice_num = 0; - - if (index == QQ_INFO_GENDER) { - /* QQ Server only recept gender in Chinese */ - value = g_strdup(genders_zh[choice_num]); - } else { - value = g_strdup_printf("%d", choice_num); - } - g_free(segments[index]); - segments[index] = value; - break; - case QQ_FIELD_LABEL: - case QQ_FIELD_STRING: - case QQ_FIELD_MULTI: - default: - utf8_str = purple_request_fields_get_string(fields, field_infos[index].id); - if (utf8_str == NULL) { - value = g_strdup("-"); - } else { - value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT); - if (value == NULL) value = g_strdup("-"); - } - g_free(segments[index]); - segments[index] = value; - break; - } - } - request_change_info(gc, segments); - - g_strfreev(segments); - g_free(info_request); -} - -static void field_request_new(PurpleRequestFieldGroup *group, gint index, gchar **segments) -{ - PurpleRequestField *field; - gchar *utf8_value; - int choice_num; - int i; - - g_return_if_fail(index >=0 && segments[index] != NULL && index < QQ_INFO_LAST); - - switch (field_infos[index].type) { - case QQ_FIELD_STRING: - case QQ_FIELD_MULTI: - utf8_value = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT); - if (field_infos[index].type == QQ_FIELD_STRING) { - field = purple_request_field_string_new( - field_infos[index].id, _(field_infos[index].text), utf8_value, FALSE); - } else { - field = purple_request_field_string_new( - field_infos[index].id, _(field_infos[index].text), utf8_value, TRUE); - } - purple_request_field_group_add_field(group, field); - g_free(utf8_value); - break; - case QQ_FIELD_BOOL: - field = purple_request_field_bool_new( - field_infos[index].id, _(field_infos[index].text), - strtol(segments[index], NULL, 10) ? TRUE : FALSE); - purple_request_field_group_add_field(group, field); - break; - case QQ_FIELD_CHOICE: - choice_num = strtol(segments[index], NULL, 10); - if (choice_num < 0 || choice_num >= field_infos[index].choice_size) choice_num = 0; - - if (index == QQ_INFO_GENDER && strlen(segments[index]) != 0) { - for (i = 0; i < QQ_GENDER_SIZE; i++) { - if (strcmp(segments[index], genders_zh[i]) == 0) { - choice_num = i; - } - } - } - field = purple_request_field_choice_new( - field_infos[index].id, _(field_infos[index].text), choice_num); - for (i = 0; i < field_infos[index].choice_size; i++) { - purple_request_field_choice_add(field, field_infos[index].choice[i]); - } - purple_request_field_group_add_field(group, field); - break; - case QQ_FIELD_LABEL: - default: - field = purple_request_field_label_new(field_infos[index].id, segments[index]); - purple_request_field_group_add_field(group, field); - break; - } -} - -static void info_modify_dialogue(PurpleConnection *gc, gchar **segments, int iclass) -{ - qq_data *qd; - PurpleRequestFieldGroup *group; - PurpleRequestFields *fields; - modify_info_request *info_request; - gchar *utf8_title, *utf8_prim; - int index; - - qd = (qq_data *) gc->proto_data; - /* Keep one dialog once a time */ - purple_request_close_with_handle(gc); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) { - if (field_infos[index].iclass != iclass) { - continue; - } - field_request_new(group, index, segments); - } - - switch (iclass) { - case QQ_FIELD_CONTACT: - utf8_title = g_strdup(_("Modify Contact")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Contact"), segments[0]); - case QQ_FIELD_ADDR: - utf8_title = g_strdup(_("Modify Address")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Address"), segments[0]); - case QQ_FIELD_EXT: - utf8_title = g_strdup(_("Modify Extended Information")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Extended Information"), segments[0]); - break; - case QQ_FIELD_BASE: - default: - utf8_title = g_strdup(_("Modify Information")); - utf8_prim = g_strdup_printf("%s for %s", _("Modify Information"), segments[0]); - } - - info_request = g_new0(modify_info_request, 1); - info_request->gc = gc; - info_request->iclass = iclass; - info_request->segments = segments; - - purple_request_fields(gc, - utf8_title, - utf8_prim, - NULL, - fields, - _("Update"), G_CALLBACK(info_modify_ok_cb), - _("Cancel"), G_CALLBACK(info_modify_cancel_cb), - purple_connection_get_account(gc), NULL, NULL, - info_request); - - g_free(utf8_title); - g_free(utf8_prim); -} - -/* process the reply of modify_info packet */ -void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - data[data_len] = '\0'; - if (qd->uid != atoi((gchar *) data)) { /* return should be my uid */ - purple_debug_info("QQ", "Failed Updating info\n"); - qq_got_message(gc, _("Could not change buddy information.")); - } -} - -static void request_set_buddy_icon(PurpleConnection *gc, gint face_num) -{ - PurpleAccount *account = purple_connection_get_account(gc); - PurplePresence *presence = purple_account_get_presence(account); - qq_data *qd = (qq_data *) gc->proto_data; - gint offset; - - if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { - offset = 2; - } else if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY)) { - offset = 1; - } else { - offset = 0; - } - - qd->my_icon = 3 * (face_num - 1) + offset; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_SET_ICON); -} - -void qq_change_icon_cb(PurpleConnection *gc, const char *filepath) -{ - gchar *basename; - size_t index; - gint face; - - g_return_if_fail(filepath != NULL); - - purple_debug_info("QQ", "Change my icon to %s\n", filepath); - - basename = g_path_get_basename(filepath); - index = strcspn(basename, "0123456789"); - face = strtol(basename + index, NULL, 10); - g_free(basename); - purple_debug_info("QQ", "Set face to %d\n", face); - - request_set_buddy_icon(gc, face); -} - -void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - PurpleAccount *account = purple_connection_get_account(gc); - const gchar *icon_path = purple_account_get_buddy_icon_path(account); - - g_return_if_fail(icon_path != NULL); - - /* Fixme: - * icon_path is always null - * purple_imgstore_get_filename is always new file - * QQ buddy may set custom icon if level is over 16 */ - purple_debug_info("QQ", "Change my icon to %s\n", icon_path); -} - -gchar *qq_get_icon_name(gint face) -{ - gint icon; - gchar *icon_name; - - icon = face / 3 + 1; - if (icon < 1 || icon > QQ_FACES) { - icon = 1; - } - - icon_name = g_strdup_printf("%s%d%s", QQ_ICON_PREFIX, icon, QQ_ICON_SUFFIX); - return icon_name; -} - -/* - * This function seems to let people set their buddy icon, but it restricts - * them to using a small list of stock icons. Wouldn't it make more sense - * to use libpurple's normal icon setting stuff? - * - * Also it would be nice to unify the icon_dir code for Windows and Linux. - */ -gchar *qq_get_icon_path(gchar *icon_name) -{ - gchar *icon_path; - const gchar *icon_dir; -#ifdef _WIN32 - static char *dir = NULL; - if (dir == NULL) { - dir = g_build_filename(wpurple_install_dir(), "pixmaps", - "purple", "buddy_icons", "qq", NULL); - } -#endif - - /* - * TODO: The QQ protocol plugin should probably call - * purple_prefs_add_string() at startup to initialize this - * preference. It is used to allow users or distributions - * to specify this directory. We don't include these icons - * with libpurple because of possible copyright concerns. - */ - icon_dir = purple_prefs_get_string("/plugins/prpl/qq/icon_dir"); - if ( icon_dir == NULL || strlen(icon_dir) == 0) { -#ifdef _WIN32 - icon_dir = dir; -#else - icon_dir = QQ_BUDDY_ICON_DIR; -#endif - } - icon_path = g_strdup_printf("%s%c%s", icon_dir, G_DIR_SEPARATOR, icon_name); - - return icon_path; -} - -void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face) -{ - PurpleBuddy *buddy; - const gchar *icon_name_prev = NULL; - gchar *icon_name; - gchar *icon_path; - gchar *icon_file_content; - gsize icon_file_size; - - g_return_if_fail(account != NULL && who != NULL); - - /* purple_debug_info("QQ", "Update %s icon to %d\n", who, face); */ - - icon_name = qq_get_icon_name(face); - g_return_if_fail(icon_name != NULL); - /* purple_debug_info("QQ", "icon file name is %s\n", icon_name); */ - - if ((buddy = purple_find_buddy(account, who))) { - icon_name_prev = purple_buddy_icons_get_checksum_for_user(buddy); - /* - purple_debug_info("QQ", "Previous icon is %s\n", - icon_name_prev != NULL ? icon_name_prev : "(NULL)"); - */ - } - if (icon_name_prev != NULL && !strcmp(icon_name, icon_name_prev)) { - /* purple_debug_info("QQ", "Icon is not changed\n"); */ - g_free(icon_name); - return; - } - - icon_path = qq_get_icon_path(icon_name); - if (icon_path == NULL) { - g_free(icon_name); - return; - } - - if (!g_file_get_contents(icon_path, &icon_file_content, &icon_file_size, NULL)) { - purple_debug_error("QQ", "Failed reading icon file %s\n", icon_path); - } else { - purple_debug_info("QQ", "Update %s icon to %d (%s)\n", - who, face, icon_path); - purple_buddy_icons_set_for_user(account, who, - icon_file_content, icon_file_size, icon_name); - } - g_free(icon_name); - g_free(icon_path); -} - -/* after getting info or modify myself, refresh the buddy list accordingly */ -static void update_buddy_info(PurpleConnection *gc, gchar **segments) -{ - PurpleBuddy *buddy = NULL; - qq_data *qd = NULL; - qq_buddy_data *bd = NULL; - guint32 uid; - gchar *who; - gchar *alias_utf8; - - PurpleAccount *account = purple_connection_get_account(gc); - qd = (qq_data *)purple_connection_get_protocol_data(gc); - - uid = strtoul(segments[QQ_INFO_UID], NULL, 10); - who = uid_to_purple_name(uid); - qq_filter_str(segments[QQ_INFO_NICK]); - alias_utf8 = qq_to_utf8(segments[QQ_INFO_NICK], QQ_CHARSET_DEFAULT); - - if (uid == qd->uid) { /* it is me */ - purple_debug_info("QQ", "Got my info\n"); - qd->my_icon = strtol(segments[QQ_INFO_FACE], NULL, 10); - if (alias_utf8 != NULL) { - purple_account_set_alias(account, alias_utf8); - } - /* add me to buddy list */ - buddy = qq_buddy_find_or_new(gc, uid); - } else { - buddy = purple_find_buddy(gc->account, who); - /* purple_debug_info("QQ", "buddy=%p\n", (void*)buddy); */ - } - - /* if the buddy is null, the api will catch it and return null here */ - bd = purple_buddy_get_protocol_data(buddy); - /* purple_debug_info("QQ", "bd=%p\n", (void*)bd); */ - - if (bd == NULL || buddy == NULL) { - g_free(who); - g_free(alias_utf8); - return; - } - - /* update buddy list (including myself, if myself is the buddy) */ - bd->age = strtol(segments[QQ_INFO_AGE], NULL, 10); - bd->gender = strtol(segments[QQ_INFO_GENDER], NULL, 10); - bd->face = strtol(segments[QQ_INFO_FACE], NULL, 10); - - if (alias_utf8 != NULL) { - if (bd->nickname) g_free(bd->nickname); - bd->nickname = g_strdup(alias_utf8); - } - bd->last_update = time(NULL); - - purple_blist_server_alias_buddy(buddy, bd->nickname); - - /* convert face num from packet (0-299) to local face (1-100) */ - qq_update_buddy_icon(gc->account, who, bd->face); - - g_free(who); - g_free(alias_utf8); -} - -/* process reply to get_info packet */ -void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc) -{ - qq_data *qd; - gchar **segments; - gint field_count; - gchar *icon_name; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (qd->client_version >= 2008) { - field_count = QQ_INFO_LAST; - } else { - field_count = QQ_INFO_LAST_2007; - } - if (NULL == (segments = split_data(data, data_len, "\x1e", field_count))) - return; - -#ifdef DEBUG - info_debug(segments); -#endif - - if (action == QQ_BUDDY_INFO_SET_ICON) { - if (strtol(segments[QQ_INFO_FACE], NULL, 10) != qd->my_icon) { - icon_name = g_strdup_printf("%d", qd->my_icon); - g_free(segments[QQ_INFO_FACE]); - segments[QQ_INFO_FACE] = icon_name; - - /* Update me in buddy list */ - update_buddy_info(gc, segments); - /* send new face to server */ - request_change_info(gc, segments); - } - g_strfreev(segments); - return; - } - - update_buddy_info(gc, segments); - switch (action) { - case QQ_BUDDY_INFO_DISPLAY: - info_display_only(gc, segments); - break; - case QQ_BUDDY_INFO_SET_ICON: - g_return_if_reached(); - break; - case QQ_BUDDY_INFO_MODIFY_BASE: - info_modify_dialogue(gc, segments, QQ_FIELD_BASE); - break; - case QQ_BUDDY_INFO_MODIFY_EXT: - info_modify_dialogue(gc, segments, QQ_FIELD_EXT); - break; - case QQ_BUDDY_INFO_MODIFY_ADDR: - info_modify_dialogue(gc, segments, QQ_FIELD_ADDR); - break; - case QQ_BUDDY_INFO_MODIFY_CONTACT: - info_modify_dialogue(gc, segments, QQ_FIELD_CONTACT); - break; - default: - g_strfreev(segments); - break; - } - return; -} - -void qq_request_get_level(PurpleConnection *gc, guint32 uid) -{ - qq_data *qd = (qq_data *) gc->proto_data; - guint8 buf[16] = {0}; - gint bytes = 0; - - if (qd->client_version >= 2007) { - bytes += qq_put8(buf + bytes, 0x02); - } else { - bytes += qq_put8(buf + bytes, 0x00); - } - bytes += qq_put32(buf + bytes, uid); - qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes); -} - -void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid) -{ - guint8 buf[16] = {0}; - gint bytes = 0; - - bytes += qq_put8(buf + bytes, 0x08); - bytes += qq_put32(buf + bytes, uid); - bytes += qq_put8(buf + bytes, 0x00); - qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes); -} - -void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class) -{ - qq_data *qd = (qq_data *) gc->proto_data; - PurpleBuddy *buddy; - qq_buddy_data *bd; - guint8 *buf; - GSList *buddies, *it; - gint bytes; - - /* server only reply levels for online buddies */ - buf = g_newa(guint8, MAX_PACKET_SIZE); - - bytes = 0; - bytes += qq_put8(buf + bytes, 0x00); - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - for (it = buddies; it; it = it->next) { - buddy = it->data; - if (buddy == NULL) continue; - if ((bd = purple_buddy_get_protocol_data(buddy)) == NULL) continue; - if (bd->uid == 0) continue; /* keep me as end of packet*/ - if (bd->uid == qd->uid) continue; - bytes += qq_put32(buf + bytes, bd->uid); - } - bytes += qq_put32(buf + bytes, qd->uid); - qq_send_cmd_mess(gc, QQ_CMD_GET_LEVEL, buf, bytes, update_class, 0); -} - -static void process_level(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes = 0; - guint32 uid, onlineTime; - guint16 level, timeRemainder; - qq_buddy_data *bd; - - while (data_len - bytes >= 12) { - bytes += qq_get32(&uid, data + bytes); - bytes += qq_get32(&onlineTime, data + bytes); - bytes += qq_get16(&level, data + bytes); - bytes += qq_get16(&timeRemainder, data + bytes); - purple_debug_info("QQ", "level: %d, uid %u, tmOnline: %d, tmRemainder: %d\n", - level, uid, onlineTime, timeRemainder); - - bd = qq_buddy_data_find(gc, uid); - if (bd == NULL) { - purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid); - continue; - } - - bd->onlineTime = onlineTime; - bd->level = level; - bd->timeRemainder = timeRemainder; - } - - if (bytes != data_len) { - purple_debug_error("QQ", - "Wrong format of Get levels. Truncate %d bytes.\n", data_len - bytes); - } -} - -static void process_level_2007(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes; - guint32 uid, onlineTime; - guint16 level, timeRemainder; - qq_buddy_data *bd; - guint16 str_len; - gchar *str; - gchar *str_utf8; - - bytes = 0; - bytes += qq_get32(&uid, data + bytes); - bytes += qq_get32(&onlineTime, data + bytes); - bytes += qq_get16(&level, data + bytes); - bytes += qq_get16(&timeRemainder, data + bytes); - purple_debug_info("QQ", "level: %d, uid %u, tmOnline: %d, tmRemainder: %d\n", - level, uid, onlineTime, timeRemainder); - - bd = qq_buddy_data_find(gc, uid); - if (bd == NULL) { - purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid); - return; - } - - bd->onlineTime = onlineTime; - bd->level = level; - bd->timeRemainder = timeRemainder; - - /* extend bytes in qq2007*/ - bytes += 4; /* skip 8 bytes */ - /* qq_show_packet("Buddies level", data + bytes, data_len - bytes); */ - - do { - bytes += qq_get16(&str_len, data + bytes); - if (str_len <= 0 || bytes + str_len > data_len) { - purple_debug_error("QQ", - "Wrong format of Get levels. Truncate %d bytes.\n", data_len - bytes); - break; - } - str = g_strndup((gchar *)data + bytes, str_len); - bytes += str_len; - str_utf8 = qq_to_utf8(str, QQ_CHARSET_DEFAULT); - purple_debug_info("QQ", "%s\n", str_utf8); - g_free(str_utf8); - g_free(str); - } while (bytes < data_len); -} - -void qq_process_get_level_reply(guint8 *data, gint data_len, PurpleConnection *gc) -{ - gint bytes; - guint8 sub_cmd; - - bytes = 0; - bytes += qq_get8(&sub_cmd, data + bytes); - switch (sub_cmd) { - case 0x08: - process_level_2007(gc, data + bytes, data_len - bytes); - break; - case 0x00: - case 0x02: - default: - process_level(gc, data + bytes, data_len - bytes); - break; - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_info.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file buddy_info.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_INFO_H_ -#define _QQ_BUDDY_INFO_H_ - -#include -#include "connection.h" - -#include "buddy_opt.h" -#include "qq.h" - -/* use in qq2005 - * ext_flag: (0-7) - * bit1 => qq space - * comm_flag: (0-7) - * bit1 => member - * bit4 => TCP mode - * bit5 => open mobile QQ - * bit6 => bind to mobile - * bit7 => whether having a video -#define QQ_COMM_FLAG_QQ_MEMBER 0x02 -#define QQ_COMM_FLAG_TCP_MODE 0x10 -#define QQ_COMM_FLAG_MOBILE 0x20 -#define QQ_COMM_FLAG_BIND_MOBILE 0x40 -#define QQ_COMM_FLAG_VIDEO 0x80 - */ -/* status in eva for qq2006 -#define QQ_FRIEND_FLAG_QQ_MEMBER 0x01 -#define QQ_FRIEND_FLAG_MOBILE 0x10 -#define QQ_FRIEND_FLAG_BIND_MOBILE 0x20 -*/ -#define QQ_COMM_FLAG_QQ_VIP 0x02 -#define QQ_COMM_FLAG_QQ_MEMBER 0x04 -#define QQ_COMM_FLAG_TCP_MODE 0x10 -#define QQ_COMM_FLAG_MOBILE 0x20 -#define QQ_COMM_FLAG_BIND_MOBILE 0x40 -#define QQ_COMM_FLAG_VIDEO 0x80 - -#define QQ_EXT_FLAG_ZONE 0x02 - -#define QQ_BUDDY_GENDER_GG 0x00 -#define QQ_BUDDY_GENDER_MM 0x01 -#define QQ_BUDDY_GENDER_UNKNOWN 0xff - -enum { - QQ_BUDDY_INFO_UPDATE_ONLY = 0, - QQ_BUDDY_INFO_DISPLAY, - QQ_BUDDY_INFO_SET_ICON, - QQ_BUDDY_INFO_MODIFY_BASE, - QQ_BUDDY_INFO_MODIFY_EXT, - QQ_BUDDY_INFO_MODIFY_ADDR, - QQ_BUDDY_INFO_MODIFY_CONTACT -}; - -gchar *qq_get_icon_name(gint face); -gchar *qq_get_icon_path(gchar *icon_name); -void qq_change_icon_cb(PurpleConnection *gc, const char *filepath); - -void qq_request_buddy_info(PurpleConnection *gc, guint32 uid, - guint32 update_class, int action); -void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img); -void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len); -void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc); - -void qq_request_get_level(PurpleConnection *gc, guint32 uid); -void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid); -void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class); -void qq_process_get_level_reply(guint8 *buf, gint buf_len, PurpleConnection *gc); - -void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,707 +0,0 @@ -/** - * @file buddy_list.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "qq.h" - -#include "debug.h" -#include "notify.h" -#include "utils.h" -#include "packet_parse.h" -#include "buddy_info.h" -#include "buddy_memo.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "char_conv.h" -#include "qq_define.h" -#include "qq_base.h" -#include "group.h" -#include "group_internal.h" -#include "group_info.h" - -#include "qq_network.h" - -#define QQ_GET_ONLINE_BUDDY_02 0x02 -#define QQ_GET_ONLINE_BUDDY_03 0x03 /* unknown function */ - -typedef struct _qq_buddy_online { - guint16 unknown1; - guint8 ext_flag; - guint8 comm_flag; - guint16 unknown2; - guint8 ending; /* 0x00 */ -} qq_buddy_online; - -/* get a list of online_buddies */ -void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class) -{ - qq_data *qd; - guint8 *raw_data; - gint bytes = 0; - - qd = (qq_data *) gc->proto_data; - raw_data = g_newa(guint8, 5); - - /* 000-000 get online friends cmd - * only 0x02 and 0x03 returns info from server, other valuse all return 0xff - * I can also only send the first byte (0x02, or 0x03) - * and the result is the same */ - bytes += qq_put8(raw_data + bytes, QQ_GET_ONLINE_BUDDY_02); - /* 001-001 seems it supports 255 online buddies at most */ - bytes += qq_put8(raw_data + bytes, position); - /* 002-002 */ - bytes += qq_put8(raw_data + bytes, 0x00); - /* 003-004 */ - bytes += qq_put16(raw_data + bytes, 0x0000); - - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_ONLINE, raw_data, 5, update_class, 0); -} - -/* position starts with 0x0000, - * server may return a position tag if list is too long for one packet */ -void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes = 0; - - qd = (qq_data *) gc->proto_data; - - /* 000-001 starting position, can manually specify */ - bytes += qq_put16(raw_data + bytes, position); - /* before Mar 18, 2004, any value can work, and we sent 00 - * I do not know what data QQ server is expecting, as QQ2003iii 0304 itself - * even can sending packets 00 and get no response. - * Now I tested that 00,00,00,00,00,01 work perfectly - * March 22, found the 00,00,00 starts to work as well */ - bytes += qq_put8(raw_data + bytes, 0x00); - if (qd->client_version >= 2007) { - bytes += qq_put16(raw_data + bytes, 0x0000); - } - - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_LIST, raw_data, bytes, update_class, 0); -} - -/* get all list, buddies & Quns with groupsid support */ -void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class) -{ - guint8 raw_data[16] = {0}; - gint bytes = 0; - - /* 0x01 download, 0x02, upload */ - bytes += qq_put8(raw_data + bytes, 0x01); - /* unknown 0x02 */ - bytes += qq_put8(raw_data + bytes, 0x02); - /* unknown 00 00 00 00 */ - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, position); - - qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_AND_ROOMS, raw_data, bytes, update_class, 0); -} - -/* parse the data into qq_buddy_status */ -static gint get_buddy_status(qq_buddy_status *bs, guint8 *data) -{ - gint bytes = 0; - - g_return_val_if_fail(data != NULL && bs != NULL, -1); - - /* 000-003: uid */ - bytes += qq_get32(&bs->uid, data + bytes); - /* 004-004: 0x01 */ - bytes += qq_get8(&bs->unknown1, data + bytes); - /* this is no longer the IP, it seems QQ (as of 2006) no longer sends - * the buddy's IP in this packet. all 0s */ - /* 005-008: ip */ - bytes += qq_getIP(&bs->ip, data + bytes); - /* port info is no longer here either */ - /* 009-010: port */ - bytes += qq_get16(&bs->port, data + bytes); - /* 011-011: 0x00 */ - bytes += qq_get8(&bs->unknown2, data + bytes); - /* 012-012: status */ - bytes += qq_get8(&bs->status, data + bytes); - /* 013-014: client tag */ - bytes += qq_get16(&bs->unknown3, data + bytes); - /* 015-030: unknown key */ - bytes += qq_getdata(&(bs->unknown_key[0]), QQ_KEY_LENGTH, data + bytes); - - purple_debug_info("QQ", "Status:%d, uid: %u, ip: %s:%d, U: %d - %d - %04X\n", - bs->status, bs->uid, inet_ntoa(bs->ip), bs->port, - bs->unknown1, bs->unknown2, bs->unknown3); - - return bytes; -} - -/* process the reply packet for get_buddies_online packet */ -guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes, bytes_start; - gint count; - guint8 position; - gchar *who; - PurpleBuddy *buddy; - qq_buddy_data *bd; - int entry_len = 38; - - qq_buddy_status bs; - struct { - guint16 unknown1; - guint8 ext_flag; - guint8 comm_flag; - guint16 unknown2; - guint8 ending; /* 0x00 */ - } packet; - - g_return_val_if_fail(data != NULL && data_len != 0, -1); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Get buddies online reply packet", data, len); */ - if (qd->client_version >= 2007) entry_len += 4; - - bytes = 0; - bytes += qq_get8(&position, data + bytes); - - count = 0; - while (bytes < data_len) { - if (data_len - bytes < entry_len) { - purple_debug_error("QQ", "[buddies online] only %d, need %d\n", - (data_len - bytes), entry_len); - break; - } - memset(&bs, 0 ,sizeof(bs)); - memset(&packet, 0 ,sizeof(packet)); - - /* set flag */ - bytes_start = bytes; - /* based on one online buddy entry */ - /* 000-030 qq_buddy_status */ - bytes += get_buddy_status(&bs, data + bytes); - /* 031-032: */ - bytes += qq_get16(&packet.unknown1, data + bytes); - /* 033-033: ext_flag */ - bytes += qq_get8(&packet.ext_flag, data + bytes); - /* 034-034: comm_flag */ - bytes += qq_get8(&packet.comm_flag, data + bytes); - /* 035-036: */ - bytes += qq_get16(&packet.unknown2, data + bytes); - /* 037-037: */ - bytes += qq_get8(&packet.ending, data + bytes); /* 0x00 */ - /* skip 4 bytes in qq2007 */ - if (qd->client_version >= 2007) bytes += 4; - - if (bs.uid == 0 || (bytes - bytes_start) != entry_len) { - purple_debug_error("QQ", "uid=0 or entry complete len(%d) != %d\n", - (bytes - bytes_start), entry_len); - continue; - } /* check if it is a valid entry */ - - if (bs.uid == qd->uid) { - purple_debug_warning("QQ", "I am in online list %u\n", bs.uid); - } - - /* update buddy information */ - who = uid_to_purple_name(bs.uid); - buddy = purple_find_buddy(gc->account, who); - g_free(who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, bs.uid); - } - bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); - if (bd == NULL) { - purple_debug_error("QQ", - "Got an online buddy %u, but not in my buddy list\n", bs.uid); - continue; - } - /* - if(0 != fe->s->client_tag) - q_bud->client_tag = fe->s->client_tag; - */ - if (bd->status != bs.status || bd->comm_flag != packet.comm_flag) { - bd->status = bs.status; - bd->comm_flag = packet.comm_flag; - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } - bd->ip.s_addr = bs.ip.s_addr; - bd->port = bs.port; - bd->ext_flag = packet.ext_flag; - bd->last_update = time(NULL); - count++; - } - - if(bytes > data_len) { - purple_debug_error("QQ", - "qq_process_get_buddies_online: Dangerous error! maybe protocol changed, notify developers!\n"); - } - - purple_debug_info("QQ", "Received %d online buddies, nextposition=%u\n", - count, (guint) position); - return position; -} - - -/* process reply for get_buddies_list */ -guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - qq_buddy_data bd; - gint bytes_expected, count; - gint bytes, buddy_bytes; - gint nickname_len; - guint16 position, unknown; - PurpleBuddy *buddy; - - g_return_val_if_fail(data != NULL && data_len != 0, -1); - - qd = (qq_data *) gc->proto_data; - - if (data_len <= 2) { - purple_debug_error("QQ", "empty buddies list\n"); - return -1; - } - /* qq_show_packet("QQ get buddies list", data, data_len); */ - bytes = 0; - bytes += qq_get16(&position, data + bytes); - /* the following data is buddy list in this packet */ - count = 0; - while (bytes < data_len) { - memset(&bd, 0, sizeof(bd)); - /* set flag */ - buddy_bytes = bytes; - /* 000-003: uid */ - bytes += qq_get32(&bd.uid, data + bytes); - /* 004-005: icon index (1-255) */ - bytes += qq_get16(&bd.face, data + bytes); - /* 006-006: age */ - bytes += qq_get8(&bd.age, data + bytes); - /* 007-007: gender */ - bytes += qq_get8(&bd.gender, data + bytes); - - nickname_len = qq_get_vstr(&bd.nickname, QQ_CHARSET_DEFAULT, data + bytes); - bytes += nickname_len; - qq_filter_str(bd.nickname); - - /* Fixme: merge following as 32bit flag */ - bytes += qq_get16(&unknown, data + bytes); - bytes += qq_get8(&bd.ext_flag, data + bytes); - bytes += qq_get8(&bd.comm_flag, data + bytes); - - if (qd->client_version >= 2007) { - bytes += 4; /* skip 4 bytes */ - bytes_expected = 16 + nickname_len; - } else { - bytes_expected = 12 + nickname_len; - } - - if (bd.uid == 0 || (bytes - buddy_bytes) != bytes_expected) { - purple_debug_info("QQ", - "Buddy entry, expect %d bytes, read %d bytes\n", - bytes_expected, bytes - buddy_bytes); - g_free(bd.nickname); - continue; - } else { - count++; - } - -#if 1 - purple_debug_info("QQ", "buddy [%09d]: ext_flag=0x%02x, comm_flag=0x%02x, nick=%s\n", - bd.uid, bd.ext_flag, bd.comm_flag, bd.nickname); -#endif - - buddy = qq_buddy_find_or_new(gc, bd.uid); - if (buddy == NULL || purple_buddy_get_protocol_data(buddy) == NULL) { - g_free(bd.nickname); - continue; - } - purple_blist_server_alias_buddy(buddy, bd.nickname); - bd.last_update = time(NULL); - qq_update_buddy_status(gc, bd.uid, bd.status, bd.comm_flag); - - g_memmove(purple_buddy_get_protocol_data(buddy), &bd, sizeof(qq_buddy_data)); - /* nickname has been copy to buddy_data do not free - g_free(bd.nickname); - */ - /*qq_request_buddy_memo(gc, ((qq_buddy_data*)buddy->proto_data)->uid, 0, QQ_BUDDY_MEMO_GET);*/ - qq_request_buddy_memo(gc, bd.uid, bd.uid, QQ_BUDDY_MEMO_GET); - } - - if(bytes > data_len) { - purple_debug_error("QQ", - "qq_process_get_buddies: Dangerous error! maybe protocol changed, notify developers!\n"); - } - - purple_debug_info("QQ", "Received %d buddies, nextposition=%u\n", - count, (guint) position); - return position; -} - -guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint i, j; - gint bytes; - guint8 sub_cmd, reply_code; - guint32 unknown, position; - guint32 uid; - guint8 type; - qq_room_data *rmd; - - g_return_val_if_fail(data != NULL && data_len != 0, -1); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&sub_cmd, data + bytes); - g_return_val_if_fail(sub_cmd == 0x01, -1); - - bytes += qq_get8(&reply_code, data + bytes); - if(0 != reply_code) { - purple_debug_warning("QQ", "qq_process_get_buddies_and_rooms, %d\n", reply_code); - } - - bytes += qq_get32(&unknown, data + bytes); - bytes += qq_get32(&position, data + bytes); - /* the following data is all list in this packet */ - i = 0; - j = 0; - while (bytes < data_len) { - /* 00-03: uid */ - bytes += qq_get32(&uid, data + bytes); - /* 04: type 0x1:buddy 0x4:Qun */ - bytes += qq_get8(&type, data + bytes); - /* 05: skip unknow 0x00 */ - bytes += 1; - if (uid == 0 || (type != 0x1 && type != 0x4)) { - purple_debug_info("QQ", "Buddy entry, uid=%u, type=%d\n", uid, type); - continue; - } - if(0x1 == type) { /* a buddy */ - /* don't do anything but count - buddies are handled by - * qq_request_get_buddies */ - ++i; - } else { /* a group */ - rmd = qq_room_data_find(gc, uid); - if(rmd == NULL) { - purple_debug_info("QQ", "Unknown room id %u\n", uid); - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_INFO, uid); - } else { - rmd->my_role = QQ_ROOM_ROLE_YES; - } - ++j; - } - } - - if(bytes > data_len) { - purple_debug_error("QQ", - "qq_process_get_buddies_and_rooms: Dangerous error! maybe protocol changed, notify developers!\n"); - } - - purple_debug_info("QQ", "Received %d buddies and %d groups, nextposition=%u\n", i, j, (guint) position); - return position; -} - -#define QQ_MISC_STATUS_HAVING_VIIDEO 0x00000001 -#define QQ_CHANGE_ONLINE_STATUS_REPLY_OK 0x30 /* ASCII value of "0" */ - -/* TODO: figure out what's going on with the IP region. Sometimes I get valid IP addresses, - * but the port number's weird, other times I get 0s. I get these simultaneously on the same buddy, - * using different accounts to get info. */ -static guint8 get_status_from_purple(PurpleConnection *gc) -{ - qq_data *qd; - PurpleAccount *account; - PurplePresence *presence; - guint8 ret; - - qd = (qq_data *) gc->proto_data; - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { - ret = QQ_BUDDY_ONLINE_INVISIBLE; - } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) - { - if (qd->client_version >= 2007) { - ret = QQ_BUDDY_ONLINE_BUSY; - } else { - ret = QQ_BUDDY_ONLINE_INVISIBLE; - } - } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) { - ret = QQ_BUDDY_ONLINE_AWAY; - } else { - ret = QQ_BUDDY_ONLINE_NORMAL; - } - return ret; -} - -/* send a packet to change my online status */ -void qq_request_change_status(PurpleConnection *gc, guint32 update_class) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes = 0; - guint8 away_cmd; - guint32 misc_status; - gboolean fake_video; - PurpleAccount *account; - PurplePresence *presence; - - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - qd = (qq_data *) gc->proto_data; - if (!qd->is_login) - return; - - away_cmd = get_status_from_purple(gc); - - misc_status = 0x00000000; - fake_video = purple_prefs_get_bool("/plugins/prpl/qq/show_fake_video"); - if (fake_video) - misc_status |= QQ_MISC_STATUS_HAVING_VIIDEO; - - if (qd->client_version >= 2007) { - bytes = 0; - bytes += qq_put8(raw_data + bytes, away_cmd); - /* status version */ - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put32(raw_data + bytes, misc_status); - /* Fixme: custom status message, now is empty */ - bytes += qq_put16(raw_data + bytes, 0); - } else { - bytes = 0; - bytes += qq_put8(raw_data + bytes, away_cmd); - bytes += qq_put32(raw_data + bytes, misc_status); - } - qq_send_cmd_mess(gc, QQ_CMD_CHANGE_STATUS, raw_data, bytes, update_class, 0); -} - -/* parse the reply packet for change_status */ -void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - guint8 reply; - qq_buddy_data *bd; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes = qq_get8(&reply, data + bytes); - if (reply != QQ_CHANGE_ONLINE_STATUS_REPLY_OK) { - purple_debug_warning("QQ", "Change status fail 0x%02X\n", reply); - return; - } - - /* purple_debug_info("QQ", "Change status OK\n"); */ - bd = qq_buddy_data_find(gc, qd->uid); - if (bd != NULL) { - bd->status = get_status_from_purple(gc); - bd->last_update = time(NULL); - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } -} - -/* it is a server message indicating that one of my buddies has changed its status */ -void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - guint32 my_uid; - gchar *who; - PurpleBuddy *buddy; - qq_buddy_data *bd; - qq_buddy_status bs; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (data_len < 35) { - purple_debug_error("QQ", "[buddy status change] only %d, need 35 bytes\n", data_len); - return; - } - - memset(&bs, 0, sizeof(bs)); - bytes = 0; - /* 000-030: qq_buddy_status */ - bytes += get_buddy_status(&bs, data + bytes); - /* 031-034: Unknow, maybe my uid */ - /* This has a value of 0 when we've changed our status to - * QQ_BUDDY_ONLINE_INVISIBLE */ - bytes += qq_get32(&my_uid, data + bytes); - - /* update buddy information */ - who = uid_to_purple_name(bs.uid); - buddy = purple_find_buddy(gc->account, who); - g_free(who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, bs.uid); - } - bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); - if (bd == NULL) { - purple_debug_warning("QQ", "Got status of no-auth buddy %u\n", bs.uid); - return; - } - - if(bs.ip.s_addr != 0) { - bd->ip.s_addr = bs.ip.s_addr; - bd->port = bs.port; - } - if (bd->status != bs.status) { - bd->status = bs.status; - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } - bd->last_update = time(NULL); - - if (bd->status == QQ_BUDDY_ONLINE_NORMAL && bd->level <= 0) { - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, bd->uid); - } else { - qq_request_get_level(gc, bd->uid); - } - } -} - -/*TODO: maybe this should be qq_update_buddy_status() ?*/ -void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag) -{ - gchar *who; - gchar *status_id; - - g_return_if_fail(uid != 0); - - /* purple supports signon and idle time - * but it is not much use for QQ, I do not use them */ - /* serv_got_update(gc, name, online, 0, q_bud->signon, q_bud->idle, bud->uc); */ - status_id = "available"; - switch(status) { - case QQ_BUDDY_OFFLINE: - status_id = "offline"; - break; - case QQ_BUDDY_ONLINE_NORMAL: - status_id = "available"; - break; - case QQ_BUDDY_CHANGE_TO_OFFLINE: - status_id = "offline"; - break; - case QQ_BUDDY_ONLINE_AWAY: - status_id = "away"; - break; - case QQ_BUDDY_ONLINE_INVISIBLE: - status_id = "invisible"; - break; - case QQ_BUDDY_ONLINE_BUSY: - status_id = "busy"; - break; - default: - status_id = "invisible"; - purple_debug_error("QQ", "unknown status: 0x%X\n", status); - break; - } - - purple_debug_info("QQ", "buddy %u status = %s\n", uid, status_id); - who = uid_to_purple_name(uid); - purple_prpl_got_user_status(gc->account, who, status_id, NULL); - - if (flag & QQ_COMM_FLAG_MOBILE && status != QQ_BUDDY_OFFLINE) - purple_prpl_got_user_status(gc->account, who, "mobile", NULL); - else - purple_prpl_got_user_status_deactive(gc->account, who, "mobile"); - - g_free(who); -} - -/* refresh all buddies online/offline, - * after receiving reply for get_buddies_online packet */ -void qq_update_buddyies_status(PurpleConnection *gc) -{ - qq_data *qd; - PurpleBuddy *buddy; - qq_buddy_data *bd; - GSList *buddies, *it; - time_t tm_limit = time(NULL); - - qd = (qq_data *) (gc->proto_data); - - tm_limit -= QQ_UPDATE_ONLINE_INTERVAL; - - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - for (it = buddies; it; it = it->next) { - buddy = it->data; - if (buddy == NULL) continue; - - bd = purple_buddy_get_protocol_data(buddy); - if (bd == NULL) continue; - - if (bd->uid == 0) continue; - if (bd->uid == qd->uid) continue; /* my status is always online in my buddy list */ - if (tm_limit < bd->last_update) continue; - if (bd->status == QQ_BUDDY_ONLINE_INVISIBLE) continue; - if (bd->status == QQ_BUDDY_CHANGE_TO_OFFLINE) continue; - - bd->status = QQ_BUDDY_CHANGE_TO_OFFLINE; - bd->last_update = time(NULL); - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } -} - -void qq_buddy_data_free_all(PurpleConnection *gc) -{ - qq_data *qd; - PurpleBuddy *buddy; - GSList *buddies, *it; - gint count = 0; - - qd = (qq_data *)purple_connection_get_protocol_data(gc); - - buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); - for (it = buddies; it; it = it->next) { - qq_buddy_data *qbd = NULL; - - buddy = it->data; - if (buddy == NULL) continue; - - qbd = purple_buddy_get_protocol_data(buddy); - if (qbd == NULL) continue; - - qq_buddy_data_free(qbd); - purple_buddy_set_protocol_data(buddy, NULL); - - count++; - } - - if (count > 0) { - purple_debug_info("QQ", "%d buddies' data are freed\n", count); - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_list.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/** - * @file buddy_list.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_LIST_H_ -#define _QQ_BUDDY_LIST_H_ - -#include -#include "connection.h" - -#include "qq.h" -typedef struct _qq_buddy_status { - guint32 uid; - guint8 unknown1; - struct in_addr ip; - guint16 port; - guint8 unknown2; - guint8 status; - guint16 unknown3; - guint8 unknown_key[QQ_KEY_LENGTH]; -} qq_buddy_status; - -void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class); -guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class); -guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class); -guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_change_status(PurpleConnection *gc, guint32 update_class); -void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc); -void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_update_buddyies_status(PurpleConnection *gc); -void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag); -void qq_buddy_data_free_all(PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,390 +0,0 @@ -/** - * @file buddy_memo.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "request.h" - -#include "buddy_memo.h" -#include "utils.h" -#include "packet_parse.h" -#include "buddy_list.h" -#include "buddy_info.h" -#include "char_conv.h" -#include "im.h" -#include "qq_define.h" -#include "qq_base.h" -#include "qq_network.h" -#include "qq.h" - - -#include -#include -#include - -#include -#include - -/* memo index */ -enum { - QQ_MEMO_ALIAS = 0, - QQ_MEMO_MOBILD, - QQ_MEMO_TELEPHONE, - QQ_MEMO_ADDRESS, - QQ_MEMO_EMAIL, - QQ_MEMO_ZIPCODE, - QQ_MEMO_NOTE, - QQ_MEMO_SIZE -}; - -/* memo id */ -static const gchar *memo_id[] = { - "mm_alias", - "mm_mobile", - "mm_telephone", - "mm_address", - "mm_email", - "mm_zipcode", - "mm_note" -}; - -/* memo text */ -static const gchar *memo_txt[] = { - N_("Alias"), - N_("Mobile"), - N_("Telephone"), - N_("Address"), - N_("Email"), - N_("Postal Code"), - N_("Note") -}; - -typedef struct _modify_memo_request { - PurpleConnection *gc; - guint32 bd_uid; - gchar **segments; -} modify_memo_request; - - -static void memo_debug(gchar **segments) -{ - gint index; - g_return_if_fail(NULL != segments); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - purple_debug_info("QQ","memo[%i]=%s\n", index, segments[index]); - } -} - -static void memo_free(gchar **segments) -{ - gint index; - g_return_if_fail(NULL != segments); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - g_free(segments[index]); - } - purple_debug_info("QQ", "memo freed\n"); -} - -static void update_buddy_memo(PurpleConnection *gc, guint32 bd_uid, gchar *alias) -{ - PurpleAccount *account; - PurpleBuddy *buddy; - gchar *who; - g_return_if_fail(NULL != gc && NULL != alias); - - account = (PurpleAccount *)gc->account; - g_return_if_fail(NULL != account); - - who = uid_to_purple_name(bd_uid); - buddy = purple_find_buddy(account, who); - if (buddy == NULL || buddy->proto_data == NULL) { - g_free(who); - purple_debug_info("QQ", "Error...Can NOT find %d!\n", bd_uid); - return; - } - purple_blist_alias_buddy(buddy, (const char*)alias); -} - -static void request_change_memo(PurpleConnection *gc, guint32 bd_uid, gchar **segments) -{ - gint bytes; - /* Attention, length of each segment must be guint8(0~255), - * so length of memo string is limited. - * convert it to guint8 first before putting data */ - guint seg_len; - gint index; - guint8 raw_data[MAX_PACKET_SIZE - 16] = {0}; - - purple_debug_info( "QQ", "request_change_memo\n" ); - g_return_if_fail(NULL != gc && NULL != segments); - - bytes = 0; - bytes += qq_put8(raw_data+bytes, QQ_BUDDY_MEMO_MODIFY); - bytes += qq_put8(raw_data+bytes, 0x00); - bytes += qq_put32(raw_data+bytes, (guint32)bd_uid); - bytes += qq_put8(raw_data+bytes, 0x00); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - seg_len = strlen(segments[index]); - seg_len = seg_len & 0xff; - bytes += qq_put8(raw_data+bytes, (guint8)seg_len); - bytes += qq_putdata(raw_data+bytes, (const guint8 *)segments[index], (guint8)seg_len); - } - - /* debug */ - /* - qq_show_packet("MEMO MODIFY", raw_data, bytes); - */ - - qq_send_cmd(gc, QQ_CMD_BUDDY_MEMO, raw_data, bytes); -} - -static void memo_modify_cancle_cb(modify_memo_request *memo_request, PurpleRequestFields *fields) -{ - memo_free(memo_request->segments); - g_free(memo_request); -} - -/* prepare segments to be sent, string all convert to qq charset */ -static void memo_modify_ok_cb(modify_memo_request *memo_request, PurpleRequestFields *fields) -{ - PurpleConnection *gc; - guint32 bd_uid; - gchar **segments; - const gchar *utf8_str; - gchar *value = NULL; - gint index; - - g_return_if_fail(NULL != memo_request); - gc = (PurpleConnection *)memo_request->gc; - segments = (gchar **)memo_request->segments; - g_return_if_fail(NULL != gc && NULL != segments); - bd_uid = (guint32)memo_request->bd_uid; - - - for (index = 0; index < QQ_MEMO_SIZE; index++) { - utf8_str = purple_request_fields_get_string(fields, memo_id[index]); - /* update alias */ - if (QQ_MEMO_ALIAS == index) { - update_buddy_memo(gc, bd_uid, segments[QQ_MEMO_ALIAS]); - } - if (NULL == utf8_str) { - value = g_strdup(""); - } - else { - value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT); - /* Warnning: value will be string "(NULL)" instead of NULL */ - if (!qq_strcmp("(NULL)", value)) { - value = g_strdup(""); - } - } - g_free(segments[index]); - segments[index] = value; - } - - memo_debug(segments); - /* send segments */ - request_change_memo(gc, bd_uid, segments); - - /* free segments */ - memo_free(segments); - g_free(memo_request); -} - -/* memo modify dialogue */ -static void memo_modify_dialogue(PurpleConnection *gc, guint32 bd_uid, gchar **segments, guint32 action) -{ - modify_memo_request *memo_request; - PurpleRequestField *field; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - int index; - gchar *utf8_title; - gchar *utf8_primary; - - g_return_if_fail(NULL != gc && NULL != segments); - - switch (action) { - case QQ_BUDDY_MEMO_GET: - memo_free(segments); - break; - case QQ_BUDDY_MEMO_MODIFY: - /* keep one dialog once a time */ - purple_request_close_with_handle(gc); - /* show dialog */ - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - for(index = 0; index < QQ_MEMO_SIZE; index++) { - /* - purple_debug_info("QQ", "id:%s txt:%s segment:%s\n", - memo_id[index], memo_txt[index], segments[index]); - */ - field = purple_request_field_string_new(memo_id[index], memo_txt[index], - segments[index], FALSE); - purple_request_field_group_add_field(group, field); - } - - /* for upload cb */ - memo_request = g_new0(modify_memo_request, 1); - memo_request->gc = gc; - memo_request->bd_uid = bd_uid; - memo_request->segments = segments; - /* callback */ - utf8_title = g_strdup(_("Buddy Memo")); - utf8_primary = g_strdup(_("Change his/her memo as you like")); - - purple_request_fields(gc, utf8_title, utf8_primary, NULL, - fields, - _("_Modify"), G_CALLBACK(memo_modify_ok_cb), - _("_Cancel"), G_CALLBACK(memo_modify_cancle_cb), - purple_connection_get_account(gc), NULL, NULL, - memo_request); - - g_free(utf8_title); - g_free(utf8_primary); - break; - default: - purple_debug_info("QQ", "Error...unknown memo action, please tell us\n"); - break; - } -} - -static void qq_create_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 action) -{ - gchar **segments; - gint index; - g_return_if_fail(NULL != gc); - - segments = g_new0(gchar*, QQ_MEMO_SIZE); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - segments[index] = g_strdup("");; - } - memo_modify_dialogue(gc, bd_uid, segments, action); -} - -/* process reply to get_memo packet */ -void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, - guint32 update_class, guint32 action) -{ - gchar **segments; - gint bytes; - gint index; - guint8 rcv_cmd; - guint32 rcv_uid; - guint8 unk1_8; - guint8 is_success; - - g_return_if_fail(NULL != gc && NULL != data && 0 != data_len); - /* - qq_show_packet("MEMO REACH", data, data_len); - */ - purple_debug_info("QQ", "action=0x%02X\n", action); - - bytes = 0; - - /* TX looks a bit clever than before... :) */ - bytes += qq_get8(&rcv_cmd, data+bytes); - purple_debug_info("QQ", "rcv_cmd=0x%02X\n", rcv_cmd); - - /* it's possible that packet contains no buddy uid and no memo!!! - * go to next step according to previous action sent */ - if (1 == data_len) { /* only one byte */ - purple_debug_info("QQ", "memo packet contains no buddy uid and memo...\n"); - if (QQ_BUDDY_MEMO_MODIFY == action) { - qq_create_buddy_memo(gc, (guint32)update_class, QQ_BUDDY_MEMO_MODIFY); - return; - } - return; - } - - switch (rcv_cmd) { - case QQ_BUDDY_MEMO_MODIFY: - case QQ_BUDDY_MEMO_REMOVE: - bytes += qq_get8(&is_success, data+bytes); - if (QQ_BUDDY_MEMO_REQUEST_SUCCESS == is_success) { - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, - _("Memo Modify"), _("Server says:"), - _("Your request was accepted."), - NULL, NULL); - purple_debug_info("QQ", "memo change succeessfully!\n"); - } - else { - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, - _("Memo Modify"), _("Server says:"), - _("Your request was rejected."), - NULL, NULL); - purple_debug_info("QQ", "memo change failed\n"); - } - break; - case QQ_BUDDY_MEMO_GET: - bytes += qq_get32(&rcv_uid, data+bytes); - purple_debug_info("QQ", "rcv_uid=%u\n", rcv_uid); - bytes += qq_get8(&unk1_8, data+bytes); - purple_debug_info("QQ", "unk1_8=0x%02X\n", unk1_8); - segments = g_new0(gchar*, QQ_MEMO_SIZE); - for (index = 0; index < QQ_MEMO_SIZE; index++) { - /* get utf8 string */ - bytes += qq_get_vstr(&segments[index], QQ_CHARSET_DEFAULT, data+bytes); - /* - purple_debug_info("QQ", "bytes:%d, seg:%s\n", bytes, segments[index]); - */ - } - - /* common action, update buddy memo */ - update_buddy_memo(gc, rcv_uid, segments[QQ_MEMO_ALIAS]); - - /* memo is thing that we regard our buddy as, so we need one more buddy_uid */ - memo_modify_dialogue(gc, rcv_uid, segments, action); - break; - default: - purple_debug_info("QQ", "received an UNKNOWN memo cmd!!!\n"); - break; - } -} - -/* request buddy memo */ -void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action) -{ - guint8 raw_data[16] = {0}; - gint bytes; - - purple_debug_info("QQ", "qq_request_buddy_memo, buddy uid=%u, update_class=%u\n", - bd_uid, update_class); - g_return_if_fail(NULL != gc); - /* '0' is ok - g_return_if_fail(uid != 0); - */ - bytes = 0; - bytes += qq_put8(raw_data+bytes, QQ_BUDDY_MEMO_GET); - bytes += qq_put32(raw_data+bytes, bd_uid); - /* - qq_show_packet("MEMO REQUEST", raw_data, bytes); - */ - - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_MEMO, (guint8*)raw_data, bytes, update_class, action); -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_memo.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/** - * @file buddy_memo.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_MEMO_H_ -#define _QQ_BUDDY_MEMO_H_ - -#include -#include "connection.h" -#include "blist.h" - -#define QQ_BUDDY_MEMO_REQUEST_SUCCESS 0x00 - -/* clan command for memo */ -enum -{ - QQ_BUDDY_MEMO_MODIFY = 0x01, /* upload memo */ - QQ_BUDDY_MEMO_REMOVE, /* remove memo */ - QQ_BUDDY_MEMO_GET /* get memo */ -}; - - -void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, guint32 update_class, guint32 action); - -void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action); - -#endif - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1304 +0,0 @@ -/** - * @file buddy_opt.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "request.h" -#include "privacy.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "char_conv.h" -#include "qq_define.h" -#include "im.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "utils.h" - -#define PURPLE_GROUP_QQ_FORMAT "QQ (%s)" - -#define QQ_REMOVE_SELF_REPLY_OK 0x00 - -enum { - QQ_MY_AUTH_APPROVE = 0x30, /* ASCII value of "0" */ - QQ_MY_AUTH_REJECT = 0x31, /* ASCII value of "1" */ - QQ_MY_AUTH_REQUEST = 0x32 /* ASCII value of "2" */ -}; - -typedef struct _qq_buddy_req { - PurpleConnection *gc; - guint32 uid; - guint8 *auth; - guint8 auth_len; -} qq_buddy_req; - -void add_buddy_authorize_input(PurpleConnection *gc, guint32 uid, - guint8 *auth, guint8 auth_len); - -static void buddy_req_free(qq_buddy_req *add_req) -{ - g_return_if_fail(add_req != NULL); - if (add_req->auth) g_free(add_req->auth); - g_free(add_req); -} - -static void buddy_req_cancel_cb(qq_buddy_req *add_req, const gchar *msg) -{ - g_return_if_fail(add_req != NULL); - buddy_req_free(add_req); -} - -PurpleGroup *qq_group_find_or_new(const gchar *group_name) -{ - PurpleGroup *g; - - g_return_val_if_fail(group_name != NULL, NULL); - - g = purple_find_group(group_name); - if (g == NULL) { - g = purple_group_new(group_name); - purple_blist_add_group(g, NULL); - purple_debug_warning("QQ", "Add new group: %s\n", group_name); - } - - return g; -} - -static qq_buddy_data *qq_buddy_data_new(guint32 uid) -{ - qq_buddy_data *bd = g_new0(qq_buddy_data, 1); - memset(bd, 0, sizeof(qq_buddy_data)); - bd->uid = uid; - bd->status = QQ_BUDDY_OFFLINE; - return bd; -} - -qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, guint32 uid) -{ - gchar *who; - PurpleBuddy *buddy; - qq_buddy_data *bd; - - g_return_val_if_fail(gc != NULL, NULL); - - who = uid_to_purple_name(uid); - if (who == NULL) return NULL; - buddy = purple_find_buddy(purple_connection_get_account(gc), who); - g_free(who); - - if (buddy == NULL) { - purple_debug_error("QQ", "Can not find purple buddy of %u\n", uid); - return NULL; - } - - if ((bd = purple_buddy_get_protocol_data(buddy)) == NULL) { - purple_debug_error("QQ", "Can not find buddy data of %u\n", uid); - return NULL; - } - return bd; -} - -void qq_buddy_data_free(qq_buddy_data *bd) -{ - g_return_if_fail(bd != NULL); - - if (bd->nickname) g_free(bd->nickname); - g_free(bd); -} - -/* create purple buddy without data and display with no-auth icon */ -PurpleBuddy *qq_buddy_new(PurpleConnection *gc, guint32 uid) -{ - PurpleBuddy *buddy; - PurpleGroup *group; - gchar *who; - gchar *group_name; - - g_return_val_if_fail(gc->account != NULL && uid != 0, NULL); - - group_name = g_strdup_printf(PURPLE_GROUP_QQ_FORMAT, - purple_account_get_username(gc->account)); - group = qq_group_find_or_new(group_name); - if (group == NULL) { - purple_debug_error("QQ", "Failed creating group %s\n", group_name); - return NULL; - } - - purple_debug_info("QQ", "Add new purple buddy: [%u]\n", uid); - who = uid_to_purple_name(uid); - buddy = purple_buddy_new(gc->account, who, NULL); /* alias is NULL */ - purple_buddy_set_protocol_data(buddy, NULL); - - g_free(who); - - purple_blist_add_buddy(buddy, NULL, group, NULL); - - g_free(group_name); - - return buddy; -} - -static void qq_buddy_free(PurpleBuddy *buddy) -{ - qq_buddy_data *bd; - - g_return_if_fail(buddy); - - if ((bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - qq_buddy_data_free(bd); - } - purple_buddy_set_protocol_data(buddy, NULL); - purple_blist_remove_buddy(buddy); -} - -PurpleBuddy *qq_buddy_find(PurpleConnection *gc, guint32 uid) -{ - PurpleBuddy *buddy; - gchar *who; - - g_return_val_if_fail(gc->account != NULL && uid != 0, NULL); - - who = uid_to_purple_name(uid); - buddy = purple_find_buddy(gc->account, who); - g_free(who); - return buddy; -} - -PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, guint32 uid) -{ - PurpleBuddy *buddy; - qq_buddy_data *bd; - - g_return_val_if_fail(gc->account != NULL && uid != 0, NULL); - - buddy = qq_buddy_find(gc, uid); - if (buddy == NULL) { - buddy = qq_buddy_new(gc, uid); - if (buddy == NULL) { - return NULL; - } - } - - if (purple_buddy_get_protocol_data(buddy) != NULL) { - return buddy; - } - - bd = qq_buddy_data_new(uid); - purple_buddy_set_protocol_data(buddy, bd); - return buddy; -} - -/* send packet to remove a buddy from my buddy list */ -static void request_remove_buddy(PurpleConnection *gc, guint32 uid) -{ - gchar uid_str[11]; - gint bytes; - - g_return_if_fail(uid > 0); - - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - bytes = strlen(uid_str); - qq_send_cmd_mess(gc, QQ_CMD_REMOVE_BUDDY, (guint8 *) uid_str, bytes, 0, uid); -} - -static void request_remove_buddy_ex(PurpleConnection *gc, - guint32 uid, guint8 *auth, guint8 auth_len) -{ - gint bytes; - guint8 *raw_data; - gchar uid_str[16]; - - g_return_if_fail(uid != 0); - g_return_if_fail(auth != NULL && auth_len > 0); - - raw_data = g_newa(guint8, auth_len + sizeof(uid_str) ); - bytes = 0; - bytes += qq_put8(raw_data + bytes, auth_len); - bytes += qq_putdata(raw_data + bytes, auth, auth_len); - - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - bytes += qq_putdata(raw_data + bytes, (guint8 *)uid_str, strlen(uid_str)); - - qq_send_cmd_mess(gc, QQ_CMD_REMOVE_BUDDY, raw_data, bytes, 0, uid); -} - -void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, guint32 uid) -{ - guint8 raw_data[16]; - gint bytes; - - g_return_if_fail(uid > 0); - bytes = 0; - bytes += qq_put8(raw_data + bytes, cmd); - bytes += qq_put16(raw_data + bytes, sub_cmd); - bytes += qq_put32(raw_data + bytes, uid); - - qq_send_cmd_mess(gc, QQ_CMD_AUTH_CODE, raw_data, bytes, 0, uid); -} - -void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gint bytes; - guint8 cmd, reply; - guint16 sub_cmd; - guint8 *code = NULL; - guint16 code_len = 0; - - g_return_if_fail(data != NULL && data_len != 0); - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - - qq_show_packet("qq_process_auth_code", data, data_len); - bytes = 0; - bytes += qq_get8(&cmd, data + bytes); - bytes += qq_get16(&sub_cmd, data + bytes); - bytes += qq_get8(&reply, data + bytes); - g_return_if_fail(bytes + 2 <= data_len); - - bytes += qq_get16(&code_len, data + bytes); - g_return_if_fail(code_len > 0); - g_return_if_fail(bytes + code_len <= data_len); - code = g_newa(guint8, code_len); - bytes += qq_getdata(code, code_len, data + bytes); - - if (cmd == QQ_AUTH_INFO_BUDDY && sub_cmd == QQ_AUTH_INFO_REMOVE_BUDDY) { - request_remove_buddy_ex(gc, uid, code, code_len); - return; - } - if (cmd == QQ_AUTH_INFO_BUDDY && sub_cmd == QQ_AUTH_INFO_ADD_BUDDY) { - add_buddy_authorize_input(gc, uid, code, code_len); - return; - } - purple_debug_info("QQ", "Got auth info cmd 0x%x, sub 0x%x, reply 0x%x\n", - cmd, sub_cmd, reply); -} - -static void add_buddy_question_cb(qq_buddy_req *add_req, const gchar *text) -{ - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - qq_request_question(add_req->gc, QQ_QUESTION_ANSWER, add_req->uid, NULL, text); - buddy_req_free(add_req); -} - -static void add_buddy_question_input(PurpleConnection *gc, guint32 uid, gchar *question) -{ - gchar *who, *msg; - qq_buddy_req *add_req; - g_return_if_fail(uid != 0); - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; - add_req->auth = NULL; - add_req->auth_len = 0; - - who = uid_to_purple_name(uid); - msg = g_strdup_printf(_("%u requires verification"), uid); - purple_request_input(gc, _("Add buddy question"), msg, - _("Enter answer here"), - NULL, - TRUE, FALSE, NULL, - _("Send"), G_CALLBACK(add_buddy_question_cb), - _("Cancel"), G_CALLBACK(buddy_req_cancel_cb), - purple_connection_get_account(gc), who, NULL, - add_req); - - g_free(msg); - g_free(who); -} - -void qq_request_question(PurpleConnection *gc, - guint8 cmd, guint32 uid, const gchar *question_utf8, const gchar *answer_utf8) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(uid > 0); - bytes = 0; - bytes += qq_put8(raw_data + bytes, cmd); - if (cmd == QQ_QUESTION_GET) { - bytes += qq_put8(raw_data + bytes, 0); - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; - } - if (cmd == QQ_QUESTION_SET) { - bytes += qq_put_vstr(raw_data + bytes, question_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put_vstr(raw_data + bytes, answer_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put8(raw_data + bytes, 0); - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; - } - /* Unknow 2 bytes, 0x(00 01) */ - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put8(raw_data + bytes, 0x01); - g_return_if_fail(uid != 0); - bytes += qq_put32(raw_data + bytes, uid); - if (cmd == QQ_QUESTION_REQUEST) { - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; - } - bytes += qq_put_vstr(raw_data + bytes, answer_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put8(raw_data + bytes, 0); - qq_send_cmd_mess(gc, QQ_CMD_BUDDY_QUESTION, raw_data, bytes, 0, uid); - return; -} - -static void request_add_buddy_by_question(PurpleConnection *gc, guint32 uid, - guint8 *code, guint16 code_len) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes = 0; - - g_return_if_fail(uid != 0 && code_len > 0); - - bytes = 0; - bytes += qq_put8(raw_data + bytes, 0x10); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put16(raw_data + bytes, 0); - - bytes += qq_put8(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, 0); /* no auth code */ - - bytes += qq_put16(raw_data + bytes, code_len); - bytes += qq_putdata(raw_data + bytes, code, code_len); - - bytes += qq_put8(raw_data + bytes, 1); /* ALLOW ADD ME FLAG */ - bytes += qq_put8(raw_data + bytes, 0); /* group number? */ - qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes); -} - -void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gint bytes; - guint8 cmd, reply; - gchar *question, *answer; - guint16 code_len; - guint8 *code; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - qq_show_packet("qq_process_question", data, data_len); - bytes = 0; - bytes += qq_get8(&cmd, data + bytes); - if (cmd == QQ_QUESTION_GET) { - bytes += qq_get_vstr(&question, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&answer, QQ_CHARSET_DEFAULT, data + bytes); - purple_debug_info("QQ", "Get buddy adding Q&A:\n%s\n%s\n", question, answer); - g_free(question); - g_free(answer); - return; - } - if (cmd == QQ_QUESTION_SET) { - bytes += qq_get8(&reply, data + bytes); - if (reply == 0) { - purple_debug_info("QQ", "Successed setting Q&A\n"); - } else { - purple_debug_warning("QQ", "Failed setting Q&A, reply %d\n", reply); - } - return; - } - - g_return_if_fail(uid != 0); - bytes += 2; /* skip 2 bytes, 0x(00 01)*/ - if (cmd == QQ_QUESTION_REQUEST) { - bytes += qq_get8(&reply, data + bytes); - if (reply == 0x01) { - purple_debug_warning("QQ", "Failed getting question, reply %d\n", reply); - return; - } - bytes += qq_get_vstr(&question, QQ_CHARSET_DEFAULT, data + bytes); - purple_debug_info("QQ", "Get buddy question:\n%s\n", question); - add_buddy_question_input(gc, uid, question); - g_free(question); - return; - } - - if (cmd == QQ_QUESTION_ANSWER) { - bytes += qq_get8(&reply, data + bytes); - if (reply == 0x01) { - purple_notify_error(gc, _("Add Buddy"), _("Invalid answer."), NULL); - return; - } - bytes += qq_get16(&code_len, data + bytes); - g_return_if_fail(code_len > 0); - g_return_if_fail(bytes + code_len <= data_len); - - code = g_newa(guint8, code_len); - bytes += qq_getdata(code, code_len, data + bytes); - request_add_buddy_by_question(gc, uid, code, code_len); - return; - } - - g_return_if_reached(); -} - -/* try to remove myself from someone's buddy list */ -static void request_buddy_remove_me(PurpleConnection *gc, guint32 uid) -{ - guint8 raw_data[16] = {0}; - gint bytes = 0; - - g_return_if_fail(uid > 0); - - bytes += qq_put32(raw_data + bytes, uid); - - qq_send_cmd_mess(gc, QQ_CMD_REMOVE_ME, raw_data, bytes, 0, uid); -} - -/* try to add a buddy without authentication */ -static void request_add_buddy_no_auth(PurpleConnection *gc, guint32 uid) -{ - gchar uid_str[11]; - - g_return_if_fail(uid > 0); - - /* we need to send the ascii code of this uid to qq server */ - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - qq_send_cmd_mess(gc, QQ_CMD_ADD_BUDDY_NO_AUTH, - (guint8 *) uid_str, strlen(uid_str), 0, uid); -} - -static void request_add_buddy_no_auth_ex(PurpleConnection *gc, guint32 uid) -{ - guint bytes; - guint8 raw_data[16]; - - g_return_if_fail(uid != 0); - - bytes = 0; - bytes += qq_put32(raw_data + bytes, uid); - qq_send_cmd_mess(gc, QQ_CMD_ADD_BUDDY_NO_AUTH_EX, raw_data, bytes, 0, uid); -} - -/* this buddy needs authentication, text conversion is done at lowest level */ -static void request_add_buddy_auth(PurpleConnection *gc, guint32 uid, const gchar response, const gchar *text) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - gchar *msg, uid_str[11]; - guint8 bar; - - g_return_if_fail(uid != 0); - - g_snprintf(uid_str, sizeof(uid_str), "%u", uid); - bar = 0x1f; - - bytes = 0; - bytes += qq_putdata(raw_data + bytes, (guint8 *) uid_str, strlen(uid_str)); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_put8(raw_data + bytes, response); - - if (text != NULL) { - msg = utf8_to_qq(text, QQ_CHARSET_DEFAULT); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_putdata(raw_data + bytes, (guint8 *) msg, strlen(msg)); - g_free(msg); - } - - qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH, raw_data, bytes); -} - -static void request_add_buddy_auth_ex(PurpleConnection *gc, guint32 uid, - const gchar *text, guint8 *auth, guint8 auth_len) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes = 0; - - g_return_if_fail(uid != 0); - - bytes = 0; - bytes += qq_put8(raw_data + bytes, 0x02); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put16(raw_data + bytes, 0); - - bytes += qq_put8(raw_data + bytes, 0); - if (auth == NULL || auth_len <= 0) { - bytes += qq_put8(raw_data + bytes, 0); - } else { - bytes += qq_put8(raw_data + bytes, auth_len); - bytes += qq_putdata(raw_data + bytes, auth, auth_len); - } - bytes += qq_put8(raw_data + bytes, 1); /* ALLOW ADD ME FLAG */ - bytes += qq_put8(raw_data + bytes, 0); /* group number? */ - bytes += qq_put_vstr(raw_data + bytes, text, QQ_CHARSET_DEFAULT); - qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes); -} - -void qq_process_add_buddy_auth_ex(PurpleConnection *gc, guint8 *data, gint data_len, guint32 ship32) -{ - g_return_if_fail(data != NULL && data_len != 0); - - qq_show_packet("qq_process_question", data, data_len); -} - -static void add_buddy_auth_cb(qq_buddy_req *add_req, const gchar *text) -{ - qq_data *qd; - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - qd = (qq_data *)add_req->gc->proto_data; - if (qd->client_version > 2005) { - request_add_buddy_auth_ex(add_req->gc, add_req->uid, - text, add_req->auth, add_req->auth_len); - } else { - request_add_buddy_auth(add_req->gc, add_req->uid, QQ_MY_AUTH_REQUEST, text); - } - buddy_req_free(add_req); -} - -/* the real packet to reject and request is sent from here */ -static void buddy_add_deny_reason_cb(qq_buddy_req *add_req, const gchar *reason) -{ - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - request_add_buddy_auth(add_req->gc, add_req->uid, QQ_MY_AUTH_REJECT, reason); - buddy_req_free(add_req); -} - -static void buddy_add_deny_noreason_cb(qq_buddy_req *add_req) -{ - buddy_add_deny_reason_cb(add_req, NULL); -} - -/* we approve other's request of adding me as friend */ -static void buddy_add_authorize_cb(gpointer data) -{ - qq_buddy_req *add_req = (qq_buddy_req *)data; - - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - request_add_buddy_auth(add_req->gc, add_req->uid, QQ_MY_AUTH_APPROVE, NULL); - buddy_req_free(add_req); -} - -/* we reject other's request of adding me as friend */ -static void buddy_add_deny_cb(gpointer data) -{ - qq_buddy_req *add_req = (qq_buddy_req *)data; - gchar *who = uid_to_purple_name(add_req->uid); - purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), - NULL, _("Sorry, you're not my style."), TRUE, FALSE, NULL, - _("OK"), G_CALLBACK(buddy_add_deny_reason_cb), - _("Cancel"), G_CALLBACK(buddy_add_deny_noreason_cb), - purple_connection_get_account(add_req->gc), who, NULL, - add_req); - g_free(who); -} - -static void add_buddy_no_auth_cb(qq_buddy_req *add_req) -{ - qq_data *qd; - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->uid == 0) { - buddy_req_free(add_req); - return; - } - - qd = (qq_data *) add_req->gc->proto_data; - if (qd->client_version > 2005) { - request_add_buddy_no_auth_ex(add_req->gc, add_req->uid); - } else { - request_add_buddy_no_auth(add_req->gc, add_req->uid); - } - buddy_req_free(add_req); -} - -void add_buddy_authorize_input(PurpleConnection *gc, guint32 uid, - guint8 *auth, guint8 auth_len) -{ - gchar *who, *msg; - qq_buddy_req *add_req; - g_return_if_fail(uid != 0); - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; - add_req->auth = NULL; - add_req->auth_len = 0; - if (auth != NULL && auth_len > 0) { - add_req->auth = g_new0(guint8, auth_len); - g_memmove(add_req->auth, auth, auth_len); - add_req->auth_len = auth_len; - } - - who = uid_to_purple_name(uid); - msg = g_strdup_printf(_("%u needs authorization"), uid); - purple_request_input(gc, _("Add buddy authorize"), msg, - _("Enter request here"), - _("Would you be my friend?"), - TRUE, FALSE, NULL, - _("Send"), G_CALLBACK(add_buddy_auth_cb), - _("Cancel"), G_CALLBACK(buddy_req_cancel_cb), - purple_connection_get_account(gc), who, NULL, - add_req); - - g_free(msg); - g_free(who); -} - -/* add a buddy and send packet to QQ server - * note that when purple load local cached buddy list into its blist - * it also calls this funtion, so we have to - * define qd->is_login=TRUE AFTER LOGIN */ -void qq_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - qq_data *qd; - guint32 uid; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - g_return_if_fail(buddy != NULL); - - qd = (qq_data *) gc->proto_data; - if (!qd->is_login) - return; /* IMPORTANT ! */ - - uid = purple_name_to_uid(purple_buddy_get_name(buddy)); - if (uid > 0) { - if (qd->client_version > 2005) { - request_add_buddy_no_auth_ex(gc, uid); - } else { - request_add_buddy_no_auth(gc, uid); - } - return; - } - - purple_notify_error(gc, _("QQ Buddy"), _("Add buddy"), _("Invalid QQ Number")); - if (buddy == NULL) { - return; - } - - purple_debug_info("QQ", "Remove buddy with invalid QQ number %u\n", uid); - qq_buddy_free(buddy); -} - -/* process reply to add_buddy_auth request */ -void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gchar **segments, *msg_utf8; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (data[0] == '0') { - purple_debug_info("QQ", "Reply OK for sending authorize\n"); - return; - } - - if (NULL == (segments = split_data(data, data_len, "\x1f", 2))) { - purple_notify_error(gc, _("QQ Buddy"), _("Failed sending authorize"), NULL); - return; - } - msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); - purple_notify_error(gc, _("QQ Buddy"), _("Failed sending authorize"), msg_utf8); - g_free(msg_utf8); -} - -/* process the server reply for my request to remove a buddy */ -void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - PurpleBuddy *buddy = NULL; - gchar *msg; - - g_return_if_fail(data != NULL && data_len != 0); - g_return_if_fail(uid != 0); - - buddy = qq_buddy_find(gc, uid); - if (data[0] != 0) { - msg = g_strdup_printf(_("Failed removing buddy %u"), uid); - purple_notify_info(gc, _("QQ Buddy"), msg, NULL); - g_free(msg); - } - - purple_debug_info("QQ", "Reply OK for removing buddy\n"); - /* remove buddy again */ - if (buddy != NULL) { - qq_buddy_free(buddy); - } -} - -/* process the server reply for my request to remove myself from a buddy */ -void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gchar *msg; - - g_return_if_fail(data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - - if (data[0] == 0) { - purple_debug_info("QQ", "Reply OK for removing me from %u's buddy list\n", uid); - return; - } - msg = g_strdup_printf(_("Failed removing me from %d's buddy list"), uid); - purple_notify_info(gc, _("QQ Buddy"), msg, NULL); - g_free(msg); -} - -void qq_process_add_buddy_no_auth(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gchar **segments; - gchar *dest_uid, *reply; - PurpleBuddy *buddy; - qq_buddy_data *bd; - - g_return_if_fail(data != NULL && data_len != 0); - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Process buddy add for id [%u]\n", uid); - qq_show_packet("buddy_add_no_auth", data, data_len); - - if (NULL == (segments = split_data(data, data_len, "\x1f", 2))) - return; - - dest_uid = segments[0]; - reply = segments[1]; - if (strtoul(dest_uid, NULL, 10) != qd->uid) { /* should not happen */ - purple_debug_error("QQ", "Add buddy reply is to [%s], not me!\n", dest_uid); - g_strfreev(segments); - return; - } - - if (strtol(reply, NULL, 10) == 0) { - /* add OK */ - qq_buddy_find_or_new(gc, uid); - - qq_request_buddy_info(gc, uid, 0, 0); - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - qq_request_get_buddies_online(gc, 0, 0); - - purple_debug_info("QQ", "Successed adding into %u's buddy list\n", uid); - g_strfreev(segments); - return; - } - - /* need auth */ - purple_debug_warning("QQ", "Failed adding buddy, need authorize\n"); - - buddy = qq_buddy_find(gc, uid); - if (buddy == NULL) { - buddy = qq_buddy_new(gc, uid); - } - if (buddy != NULL && (bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - /* Not authorized now, free buddy data */ - qq_buddy_data_free(bd); - purple_buddy_set_protocol_data(buddy, NULL); - } - - add_buddy_authorize_input(gc, uid, NULL, 0); - g_strfreev(segments); -} - -void qq_process_add_buddy_no_auth_ex(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid) -{ - qq_data *qd; - gint bytes; - guint32 dest_uid; - guint8 reply; - guint8 auth_type; - - g_return_if_fail(data != NULL && data_len >= 5); - g_return_if_fail(uid != 0); - - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Process buddy add no auth for id [%u]\n", uid); - qq_show_packet("buddy_add_no_auth_ex", data, data_len); - - bytes = 0; - bytes += qq_get32(&dest_uid, data + bytes); - bytes += qq_get8(&reply, data + bytes); - - g_return_if_fail(dest_uid == uid); - - if (reply == 0x99) { - purple_debug_info("QQ", "Successfully added buddy %u\n", uid); - qq_buddy_find_or_new(gc, uid); - - qq_request_buddy_info(gc, uid, 0, 0); - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - qq_request_get_buddies_online(gc, 0, 0); - return; - } - - if (reply != 0) { - purple_debug_info("QQ", "Failed adding buddy %u, Unknown reply 0x%02X\n", - uid, reply); - } - - /* need auth */ - g_return_if_fail(data_len > bytes); - bytes += qq_get8(&auth_type, data + bytes); - purple_debug_warning("QQ", "Adding buddy needs authorize 0x%02X\n", auth_type); - - switch (auth_type) { - case 0x00: /* no authorize */ - break; - case 0x01: /* authorize */ - qq_request_auth_code(gc, QQ_AUTH_INFO_BUDDY, QQ_AUTH_INFO_ADD_BUDDY, uid); - break; - case 0x02: /* disable */ - break; - case 0x03: /* answer question */ - qq_request_question(gc, QQ_QUESTION_REQUEST, uid, NULL, NULL); - break; - default: - g_return_if_reached(); - break; - } - return; -} - -/* remove a buddy and send packet to QQ server accordingly */ -void qq_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - qq_data *qd; - qq_buddy_data *bd; - guint32 uid; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - g_return_if_fail(buddy != NULL); - - qd = (qq_data *) gc->proto_data; - if (!qd->is_login) - return; - - uid = purple_name_to_uid(purple_buddy_get_name(buddy)); - if (uid > 0 && uid != qd->uid) { - if (qd->client_version > 2005) { - qq_request_auth_code(gc, QQ_AUTH_INFO_BUDDY, QQ_AUTH_INFO_REMOVE_BUDDY, uid); - } else { - request_remove_buddy(gc, uid); - request_buddy_remove_me(gc, uid); - } - } - - if ((bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - qq_buddy_data_free(bd); - purple_buddy_set_protocol_data(buddy, NULL); - } else { - purple_debug_warning("QQ", "Empty buddy data of %s\n", purple_buddy_get_name(buddy)); - } - - /* Do not call purple_blist_remove_buddy, - * otherwise purple segmentation fault */ -} - -static void buddy_add_input(PurpleConnection *gc, guint32 uid, gchar *reason) -{ - PurpleAccount *account = purple_connection_get_account(gc); - qq_buddy_req *add_req; - gchar *who; - - g_return_if_fail(uid != 0 && reason != NULL); - - purple_debug_info("QQ", "Buddy %u request adding, msg: %s\n", uid, reason); - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; - - if (purple_prefs_get_bool("/plugins/prpl/qq/auto_get_authorize_info")) { - qq_request_buddy_info(gc, add_req->uid, 0, QQ_BUDDY_INFO_DISPLAY); - } - who = uid_to_purple_name(add_req->uid); - - purple_account_request_authorization(account, - who, NULL, - NULL, reason, - purple_find_buddy(account, who) != NULL, - buddy_add_authorize_cb, - buddy_add_deny_cb, - add_req); - - g_free(who); -} - -/* someone wants to add you to his buddy list */ -static void server_buddy_add_request(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - guint32 uid; - gchar *msg, *reason; - - g_return_if_fail(from != NULL && to != NULL); - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid != 0); - - if (purple_prefs_get_bool("/plugins/prpl/qq/auto_get_authorize_info")) { - qq_request_buddy_info(gc, uid, 0, QQ_BUDDY_INFO_DISPLAY); - } - - if (data_len <= 0) { - reason = g_strdup( _("No reason given") ); - } else { - msg = g_strndup((gchar *)data, data_len); - reason = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - if (reason == NULL) reason = g_strdup( _("Unknown reason") ); - g_free(msg); - } - - buddy_add_input(gc, uid, reason); - g_free(reason); -} - -void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint8 cmd; - guint8 reply; - guint32 uid; - guint16 flag1, flag2; - - g_return_if_fail(data != NULL && data_len >= 5); - - qd = (qq_data *) gc->proto_data; - - qq_show_packet("buddy_check_code", data, data_len); - - bytes = 0; - bytes += qq_get8(&cmd, data + bytes); /* 0x03 */ - bytes += qq_get8(&reply, data + bytes); - - if (reply == 0) { - purple_debug_info("QQ", "Failed checking code\n"); - return; - } - - bytes += qq_get32(&uid, data + bytes); - g_return_if_fail(uid != 0); - bytes += qq_get16(&flag1, data + bytes); - bytes += qq_get16(&flag2, data + bytes); - purple_debug_info("QQ", "Check code reply Ok, uid %u, flag 0x%04X-0x%04X\n", - uid, flag1, flag2); - return; -} - -static void request_buddy_check_code(PurpleConnection *gc, - gchar *from, guint8 *code, gint code_len) -{ - guint8 *raw_data; - gint bytes; - guint32 uid; - - g_return_if_fail(code != NULL && code_len > 0 && from != NULL); - - uid = strtoul(from, NULL, 10); - raw_data = g_newa(guint8, code_len + 16); - bytes = 0; - bytes += qq_put8(raw_data + bytes, 0x03); - bytes += qq_put8(raw_data + bytes, 0x01); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put16(raw_data + bytes, code_len); - bytes += qq_putdata(raw_data + bytes, code, code_len); - - qq_send_cmd(gc, QQ_CMD_BUDDY_CHECK_CODE, raw_data, bytes); -} - -static gint server_buddy_check_code(PurpleConnection *gc, - gchar *from, guint8 *data, gint data_len) -{ - gint bytes; - guint16 code_len; - guint8 *code; - - g_return_val_if_fail(data != NULL && data_len > 0, 0); - - bytes = 0; - bytes += qq_get16(&code_len, data + bytes); - if (code_len <= 0) { - purple_debug_info("QQ", "Server msg for buddy has no code\n"); - return bytes; - } - if (bytes + code_len < data_len) { - purple_debug_error("QQ", "Code len error in server msg for buddy\n"); - qq_show_packet("server_buddy_check_code", data, data_len); - code_len = data_len - bytes; - } - code = g_newa(guint8, code_len); - bytes += qq_getdata(code, code_len, data + bytes); - - request_buddy_check_code(gc, from, code, code_len); - return bytes; -} - -static void server_buddy_add_request_ex(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - gint bytes; - guint32 uid; - gchar *msg; - guint8 allow_reverse; - - g_return_if_fail(from != NULL && to != NULL); - g_return_if_fail(data != NULL && data_len >= 3); - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid != 0); - - /* qq_show_packet("server_buddy_add_request_ex", data, data_len); */ - - bytes = 0; - bytes += qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data+bytes); - bytes += qq_get8(&allow_reverse, data + bytes); /* allow_reverse = 0x01, allowed */ - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); - - if (strlen(msg) <= 0) { - g_free(msg); - msg = g_strdup( _("No reason given") ); - } - buddy_add_input(gc, uid, msg); - g_free(msg); -} - -/* when you are added by a person, QQ server will send sys message */ -static void server_buddy_added(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - PurpleAccount *account = purple_connection_get_account(gc); - PurpleBuddy *buddy; - guint32 uid; - qq_buddy_req *add_req; - gchar *who; - gchar *primary; - - g_return_if_fail(from != NULL && to != NULL); - - uid = strtoul(from, NULL, 10); - who = uid_to_purple_name(uid); - - buddy = purple_find_buddy(account, who); - if (buddy != NULL) { - purple_account_notify_added(account, from, to, NULL, NULL); - } - - add_req = g_new0(qq_buddy_req, 1); - add_req->gc = gc; - add_req->uid = uid; /* only need to get value */ - primary = g_strdup_printf(_("You have been added by %s"), from); - purple_request_action(gc, NULL, primary, - _("Would you like to add him?"), - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), who, NULL, - add_req, 2, - _("Add"), G_CALLBACK(add_buddy_no_auth_cb), - _("Cancel"), G_CALLBACK(buddy_req_cancel_cb)); - - g_free(who); - g_free(primary); -} - -static void server_buddy_added_ex(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - gint bytes; - guint8 allow_reverse; - gchar *msg; - - g_return_if_fail(from != NULL && to != NULL); - g_return_if_fail(data != NULL && data_len >= 3); - - qq_show_packet("server_buddy_added_ex", data, data_len); - - bytes = 0; - bytes += qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data+bytes); /* always empty msg */ - purple_debug_info("QQ", "Buddy added msg: %s\n", msg); - bytes += qq_get8(&allow_reverse, data + bytes); /* allow_reverse = 0x01, allowed */ - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); - - g_free(msg); -} - -static void server_buddy_adding_ex(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - gint bytes; - guint8 allow_reverse; - - g_return_if_fail(from != NULL && to != NULL); - g_return_if_fail(data != NULL && data_len >= 3); - - qq_show_packet("server_buddy_adding_ex", data, data_len); - - bytes = 0; - bytes += qq_get8(&allow_reverse, data + bytes); /* allow_reverse = 0x01, allowed */ - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); -} - -/* the buddy approves your request of adding him/her as your friend */ -static void server_buddy_added_me(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - PurpleAccount *account = purple_connection_get_account(gc); - qq_data *qd; - guint32 uid; - - g_return_if_fail(from != NULL && to != NULL); - - qd = (qq_data *) gc->proto_data; - - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid > 0); - - server_buddy_check_code(gc, from, data, data_len); - - qq_buddy_find_or_new(gc, uid); - qq_request_buddy_info(gc, uid, 0, 0); - qq_request_get_buddies_online(gc, 0, 0); - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - - purple_account_notify_added(account, to, from, NULL, NULL); -} - -/* you are rejected by the person */ -static void server_buddy_rejected_me(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - guint32 uid; - PurpleBuddy *buddy; - gchar *msg, *msg_utf8; - gint bytes; - gchar **segments; - gchar *primary, *secondary; - qq_buddy_data *bd; - - g_return_if_fail(from != NULL && to != NULL); - - qq_show_packet("server_buddy_rejected_me", data, data_len); - - if (data_len <= 0) { - msg = g_strdup( _("No reason given") ); - } else { - segments = g_strsplit((gchar *)data, "\x1f", 1); - if (segments != NULL && segments[0] != NULL) { - msg = g_strdup(segments[0]); - g_strfreev(segments); - bytes = strlen(msg) + 1; - if (bytes < data_len) { - server_buddy_check_code(gc, from, data + bytes, data_len - bytes); - } - } else { - msg = g_strdup( _("No reason given") ); - } - } - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - if (msg_utf8 == NULL) { - msg_utf8 = g_strdup( _("Unknown reason") ); - } - g_free(msg); - - primary = g_strdup_printf(_("Rejected by %s"), from); - secondary = g_strdup_printf(_("Message: %s"), msg_utf8); - - purple_notify_info(gc, _("QQ Buddy"), primary, secondary); - - g_free(msg_utf8); - g_free(primary); - g_free(secondary); - - uid = strtoul(from, NULL, 10); - g_return_if_fail(uid != 0); - - buddy = qq_buddy_find(gc, uid); - if (buddy != NULL && (bd = purple_buddy_get_protocol_data(buddy)) != NULL) { - /* Not authorized now, free buddy data */ - qq_buddy_data_free(bd); - purple_buddy_set_protocol_data(buddy, NULL); - } -} - -void qq_process_buddy_from_server(PurpleConnection *gc, int funct, - gchar *from, gchar *to, guint8 *data, gint data_len) -{ - switch (funct) { - case QQ_SERVER_BUDDY_ADDED: - server_buddy_added(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADD_REQUEST: - server_buddy_add_request(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADD_REQUEST_EX: - server_buddy_add_request_ex(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADDED_ME: - server_buddy_added_me(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_REJECTED_ME: - server_buddy_rejected_me(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADDED_EX: - server_buddy_added_ex(gc, from, to, data, data_len); - break; - case QQ_SERVER_BUDDY_ADDING_EX: - case QQ_SERVER_BUDDY_ADDED_ANSWER: - server_buddy_adding_ex(gc, from, to, data, data_len); - break; - default: - purple_debug_warning("QQ", "Unknow buddy operate (%d) from server\n", funct); - break; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/buddy_opt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/** - * @file buddy_opt.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BUDDY_OPT_H_ -#define _QQ_BUDDY_OPT_H_ - -#include -#include "connection.h" - -#include "qq.h" - -enum { - QQ_AUTH_INFO_BUDDY = 0x01, - QQ_AUTH_INFO_ROOM = 0x02, - - QQ_AUTH_INFO_ADD_BUDDY = 0x0001, - QQ_AUTH_INFO_TEMP_SESSION = 0x0003, - QQ_AUTH_INFO_CLUSTER = 0x0002, - QQ_AUTH_INFO_REMOVE_BUDDY = 0x0006, - QQ_AUTH_INFO_UPDATE_BUDDY_INFO = 0x0007 -}; - -enum { - QQ_QUESTION_GET = 0x01, - QQ_QUESTION_SET = 0x02, - QQ_QUESTION_REQUEST = 0x03, /* get question only*/ - QQ_QUESTION_ANSWER = 0x04 -}; - -void qq_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void qq_change_buddys_group(PurpleConnection *gc, const char *who, - const char *old_group, const char *new_group); -void qq_remove_buddy_and_me(PurpleBlistNode * node); -void qq_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); - -void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); -void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); -void qq_process_add_buddy_no_auth(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid); -void qq_process_add_buddy_no_auth_ex(PurpleConnection *gc, - guint8 *data, gint data_len, guint32 uid); -void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc); -void qq_process_buddy_from_server(PurpleConnection *gc, int funct, - gchar *from, gchar *to, guint8 *data, gint data_len); - -void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, guint32 uid); -void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); -void qq_request_question(PurpleConnection *gc, - guint8 cmd, guint32 uid, const gchar *question_utf8, const gchar *answer_utf8); -void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid); - -void qq_process_add_buddy_auth_ex(PurpleConnection *gc, guint8 *data, gint data_len, guint32 ship32); - -qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, guint32 uid); -void qq_buddy_data_free(qq_buddy_data *bd); - -PurpleBuddy *qq_buddy_new(PurpleConnection *gc, guint32 uid); -PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, guint32 uid); -PurpleBuddy *qq_buddy_find(PurpleConnection *gc, guint32 uid); -PurpleGroup *qq_group_find_or_new(const gchar *group_name); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/ChangeLog qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/ChangeLog --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/ChangeLog 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/ChangeLog 1970-01-01 00:00:00.000000000 +0000 @@ -1,373 +0,0 @@ -2009.04.23 - flos - * Fixed a bug of updating buddy who is not in user's buddy list - -2009.02.25 - flos - * Changed text 'ZipCode' to 'Postal Code' - -2009.02.24 - flos - * NEVER forget our COPYRIGHT, ;) - -2009.02.24 - flos - * Changed update_class type from gint to guint32 - * Fixed a bug of displaying of memo when memo is nothing - -2009.02.21 - flos - * Added 'qq_strlen' and 'qq_strcmp' funtions in qq.h - * Fixed compiling problems with lower version of GTK+ - -2009.02.21 - flos - * Rewrite whole buddy memo part - * Remove 'qq_to_utf8_len' and 'utf8_to_qq_len' functions in char_conv.c - * Update ChangeLog, AUTHORS - -2009.02.09 - Chengming Wang - * Rewrite buddy_memo using qq_put/qq_get series functions - -2009.02.09 - Chengming Wang - * Added buddy 'get memo', 'remove memo', 'upload memo' functions - -2009.02.08 - flos - * Fixed showing message of chat room when message comes in - -2008.12.28 - flos - * Fixes #7908 - -2008.12.28 - flos - * References #7908 - -2008.12.25 - flos - * References #7821 - * Updated authors - -2008.12.17 - flos - * Minor fixed in buddy_info.c - -2008.12.06 - flos - * Removed version checking script in Makefiles since our developers all migrated to monotone - * Use our development revision as OPENQ_VERSION in qq.c - -2008.12.05 - flos - * Fixed a bug after propagating - -2008.11.18 - ccpaging - * Fixed: IM format suuport in IM and QUN IM - * Divide long IM message into segment and sending - * Divide long QUN IM message in to segment and sending - * Add some new function in im.c to put format when sending - * Add some new function in im.c to get format when receiving - * Need improvement: - Merge long IM message when receiving. Need a buffer to store segments of long IM message. - Send segment of long IM message one by one. Need a buffer to store segments of long IM message. - -2008.11.11 - ccpaging - * Change QQ number to unsigned long - * Change Qun ID and Qun extend ID to unsigned long - * Rewrite smiley convert function, use qsort and bsearch - * Update smiley map according EVA and pidgin theme file - * Support long IM message in private and Qun - -2008.10.27 - ccpaging - * Fixed a bug in group_join.c - -2008.10.30 - flos - * Fixed a bug which made xgettext failed in buddy_info.c - * Fixed a bug in Makefile.am and Makefile.mingw - * Updated acknowledgement in qq.c - -2008.10.28 - flos - * Updated AUTHORS - -2008.10.27 - ccpaging - * Fixed a bug in buddy_info.c - -2008.10.27 - ccpaging - * Update 'buddy_adding' protocol - -2008.10.22 - ccpaging - * 20081022 - -2008.10.20 - ccpaging - * Support incoming authorization of 'buddy_adding' protocol of QQ2007/2008 - -2008.10.14 - ccpaging - * 2007 remove buddy ok - * Removed group_search.c/h - -2008.10.10 - ccpaging - * Support part of 'buddy' protocol of QQ2007/2008 - -2008.10.10 - ccpaging - * Keep group_search.c/h for later use - * Update 'group' - -2008.10.09 - ccpaging - * 20081009-1 - -2008.10.09 - ccpaging - * Update 'group' protocol - * Functions of group_find, group_free, group_search merged into group_join and group_internal - * Removed group_find.c/h, group_free.c/h, group_search.c/h - -2008.10.08 - ccpaging - * Update 'group' protocol - -2008.10.08 - ccpaging - * 20081008-1 - -2008.10.08 - ccpaging - * Update group part - * Delete some meaningless functions and data - * Added 'change my icon' - -2008.10.08 - lonicerae - * Update Makefile.mingw - -2008.10.08 - ccpaging - * Fixed QQ_BUDDY_ICON_DIR problem - -2008.10.07 - lonicerae - * Update 'version display' - -2008.10.07 - lonicerae - * Added some defensive code for 'action' series functions of qq.c - -2008.10.07 - ccpaging - * Update buddy icon - -2008.10.07 - ccpaging - * Update qq_buddy - -2008.10.07 - ccpaging - * Update qun conversation - -2008.10.05 - lonicerae - * Bug fix in 'About OpenQ' dialog - -2008.10.05 - lonicerae - * Added 'About OpenQ' dialog - -2008.10.05 - ccpaging - * Add my uid into buddy list - * Fixed a minor bug in qq_create_buddy. Not get new buddy's info. - * There are 38 fields in protocol 2008, one more than 2005/2007. - * The packet of Modifing buddy info is changed. Need sample to fix it. - -2008.10.04 - ccpaging - * Update protocol for 2007 - * Code cleanup - -2008.10.04 - lonicerae - * fixed a bug in qq_base.c - -2008.10.03 - ccpaging - * 2007 protocol: - 1. fixed 'get room info' - 2. fixed 'get buddy level' - -2008.10.02 - ccpaging - * Added 'Captcha Display' function - * QQ2007 for openq, programed by Emil Alexiev: - 1. Most functions from patch written by Emil Alexiev merged into trunk, except 'buddy operations' - 2. 'online buddy status' and 'qun buddies' still have problems - * QQ2008 console client, programed by Shrimp: - 1. 'before login' and 'keep alive' parts merged into trunk - -2008.09.30 - ccpaging - * Successfully login using 2007/2008 protocols - -2008.09.29 - ccpaging - * 'Check Password' function for protocol 2007/2008 - -2008.09.28 - ccpaging - * The source is only for debug, not for user: - 1. Implement new QQ protocol 2007/2008, include login and change status - 2. Check 2005's login reply packet, get last 3 login time. - 3. Server's notice and news is displayed in self buddy (The new buddy created in buddy list). - 4. The notice messages when adding/removing QQ Qun's buddy displayed in char conversation. They are displayed as purple notify windows in the past. - 5. The notice messages when adding/removing buddy displayed in self buddy's conversation. They are displayed as purple notify windows in the past. - 6. Client version can be selected in account option. Now only qq2005 is working, other new version is only for debug. - -2008.09.26 - ccpaging - * Added 'Request/Add/Remove Buddy' functions - -2008.09.19 - ccpaging - * Rewrite buddy modify info, there is a ticket for this problem - * Use ship32 to trans action code between request packet and reply packet process - -2008.09.15 - csyfek - * im.pidgin.pidgin.openq branch - -2008.09.05 - ccpaging - * Filter chars 0x01-0x20 in nickname - -2008.09.05 - ccpaging - * Fixed compilation even pidgin-udp-patch not applied - * Place and analysis 'before login packet' after login. packages will be updated slowly and server may send lots of 'server command packet', while 'before login packet' is placed after 'finished update' - -2008.09.02 - ccpaging - * Bugfix: can not send message to the QUN blocked adding - * Tickets: - Fixes #6957 - -2008.09.02 - ccpaging - * Use new tactics of information update: - 1. send next package till the previous package received - 2. fix duplicated get_room_info and get_room_buddies commands - -2008.08.16 - ccpaging - * Rename group to room. If you used pidginqq before, this may create a new room with same title, you may delete old one - * Replace purple_debug with purple_debug_info, purple_debug_warning, purple_debug_error - * Add server notice and server new, and two options to turn on/off - * Minor modify for reducing transaction's debug infor - * Minor modifies for system notice and QQ news. - * Add 4 new strings need translate compare with p10. - * Tickets: - Fixes #6990 - -2008.08.10 - csyfek - * Commit to Pidgin - -2008.08.07 - ccpaging - * Support managing multi-connections according to simple.c - -2008.08.06 - ccpaging - * Rename names of variables, Group, to Room - * Functions of group_network merged into qq_network and qq_process - * Canceled managing glist of group packet, add sub_cmdd and room_id to transaction - * Fixed error of demo group: - If 'room list' and 'room infor' are not setup, response received from server will emits 'room_id = 0' packet. - -2008.08.04 - ccpaging - * Use new crypt/decrypt functions - * Rename crypt.c/h to qq_crypt.c/h - * Clean code of decrypt functions - * Fixed decryption failure - -2008.08.04 - csyfek - * Update AUTHORS - -2008.08.03 - csyfek - * Commit lost files to Pidgin - -2008.08.02 - csyfek - * Commit to Pidgin - * Tickets: - Fixes #1861 - Fixes #1902 - References #5112 - -2008.08.02 - ccpaging - * Store all keys and md5 values of qq_data in char[QQ_KEY_LENGTH] - * Use random value in inikey - * TEA header padding in crypt.c - * Rewrite login part of qq_process - -2008.07.31 - ccpaging - * Fixed: send reply when get duplicate server command. The server may not get our reply before. - * Tag custom picture as text "(Broken)" - -2008.07.30 - ccpaging , csyfek - * Change some debug message - * Modify buddy status flag according to eva for QQ2006 - * Modify buddy status parse and correspond to eva2 - * Add getIP/putIP functions to packet_parse.c, and replace some gen_ip_str - * Replace guint32 *ip with struct in_addr, and reduce g_new/g_free operation - * Source file changed: - Merge buddy_status into buddy_list - Change login_logout to qq_base - Merge keep_alive into qq_base - New qq_process extract from qq_network - * Fixed: Byte alignment bug in crypt.c, tested in ARM PDA - * Fixed: group chat message may get in before getting group info, and so group info is empty - * Add qq_send_cmd_group_get_group_info when joined a group chat in group_im.c - * Add some new group command identify according eva but further program - * Add some new QQ client version identify - * Fixed: Identify buddy's client version by IM packet, and not by status - * Add some new info in buddy's tooltip text - * Add video falg to buddy's emblem. But those flag in buddy status may not prasing correctly - * Use new timeout function to handle send keep_alive, resend packet, update buddy status - * Add new advanced options: - The end user may change interval of keep_alive, resend packet, update buddy status to feed their need. - For example, saving network flow when use mobile phone. - Keep alive packet must be sent in 60-120 seconds whatever client rcved data of not. - The intervals of keep alive and update status should be multiple of resend's interval, - Since we use counter not time() in a single timeout function for efficiency. - * Rewrite qq_trans.c, and use one g_list to manage: - Store server packet before login, and prase all of them when get login - Store client send packet for resend scanning, confirm server reply, filter duplicate server reply - Store server packet for filter out duplicate - * Add QQ_MSG_SYS_NOTICE = 0x06 in sys_msg.c - * Rewrite qq_proc_cmd_reply and qq_proc_cmd_server: - In QQ protocol, one packet reply may need a new packet send later. - We may call it packet trigger. The triggers always is hided in every qq_process_reply. - Now we try to extract those triggers and put into a single function, - and then every trigger should be obviously and easy to manage. - -2008.07.12 - ccpaging - * Fixed: Always lost connection. Now send keep alive packet in every 30 seconds - * Minor fix for debug information - * Filter \r\n and replace with SPCAE in group notive - * Fixed a memory leak - * Tickets: - * Fixes #4024. - -2008.06.29 - csyfek - * Minor bug fix - * Add some doxygen syntax for preparing development documentation - * References #6199 - -2008.06.28 - ccpaging , moo - * Patches from moo and ccpaging. - * Tickets: - * Fixes #4956. - * Fixes #2998. - -2008.06.07 - ccpaging , csyfek - * Clean code and apply patches from QuLogic - -2008.05.19 - ccpaging , csyfek - * Reconnect server 5 time in 5000 ms, when connect failed - * Rename sendqueue.c/sendqueue.h to qq_trans.c/qq_trans.h - * Rewrite packet_process - * Rewrite qq_send_cmd - * Create server list, try to connect every server when failed - -2008.05.14 - ccpaging - * Move function for before login packets storing to sendqueue - * Use transaction data structure to store before login packets - * Rewrite tcp_pending and packet_process in qq_network.c - -2008.05.09 - ccpaging - * Remove function _create_packet_head_seq in qq_network.c - * Create new function encap in qq_netowork.c - * Clean code of qq_send_packet_request_login_token and qq_send_packet_login in login_out.c - -2008.05.09 - ccpaging - * Clean code of packet_parse.c, enable PARSER_DEBUG - * Rewrite send_queue - -2008.05.08 - ccpaging - * Rewrite qq_network - * Add srv resolve function when qq_login - * Merge function _qq_common_clean in qq_proxy.c to qq_disconnect - * Move orignal qq_disconnect to qq_close - * qq_data alloc in qq_open and release in qq_close - * Network connect of QQ is created in qq_connect, and release in qq_disconnect - -2008.05.05 - ccpaging - * Merge function _qq_common_clean in qq_proxy.c to qq_disconnect - * Move orignal qq_disconnect to qq_close - * qq_data alloc in qq_open and release in qq_close - * Network connect of QQ is created in qq_connect, and release in qq_disconnect - -2008.05.05 - ccpaging - * Add qq_hex_dump function - -2008.04.25 - ccpaging , csyfek - * Rewrite read_packet and create_packet functions, use qq_put and qq_get functions instead - * New logic in accord with protocol models to handle packets, some related functions rewritten - -2008.03.24 - ccpaging - * Remove qq_crypt function in crypt.c, use qq_crypt and qq_decrypt directly - -** since pidgin-2.4.0 *** diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/** - * @file char_conv.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" - -#include "char_conv.h" -#include "packet_parse.h" -#include "utils.h" - -#define UTF8 "UTF-8" -#define QQ_CHARSET_ZH_CN "GB18030" -#define QQ_CHARSET_ENG "ISO-8859-1" - -#define QQ_NULL_MSG "(NULL)" /* return this if conversion fails */ - -/* convert a string from from_charset to to_charset, using g_convert */ -/* Warning: do not return NULL */ -static gchar *do_convert(const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset) -{ - GError *error = NULL; - gchar *ret; - gsize byte_read, byte_write; - - g_return_val_if_fail(str != NULL && to_charset != NULL && from_charset != NULL, g_strdup(QQ_NULL_MSG)); - - ret = g_convert(str, len, to_charset, from_charset, &byte_read, &byte_write, &error); - - if (error == NULL) { - return ret; /* convert is OK */ - } - - /* convert error */ - purple_debug_error("QQ_CONVERT", "%s\n", error->message); - qq_show_packet("Dump failed text", (guint8 *) str, (len == -1) ? strlen(str) : len); - - g_error_free(error); - return g_strdup(QQ_NULL_MSG); -} - -/* - * take the input as a pascal string and return a converted c-string in UTF-8 - * returns the number of bytes read, return -1 if fatal error - * the converted UTF-8 will be saved in ret - * Return: *ret != NULL - */ -gint qq_get_vstr(gchar **ret, const gchar *from_charset, guint8 *data) -{ - guint8 len; - - g_return_val_if_fail(data != NULL && from_charset != NULL, -1); - - len = data[0]; - if (len == 0) { - *ret = g_strdup(""); - return 1; - } - *ret = do_convert((gchar *) (data + 1), (gssize) len, UTF8, from_charset); - - return len + 1; -} - -gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset) -{ - gchar *str; - guint8 len; - - if (str_utf8 == NULL || (len = strlen(str_utf8)) == 0) { - buf[0] = 0; - return 1; - } - str = do_convert(str_utf8, -1, to_charset, UTF8); - len = strlen(str_utf8); - buf[0] = len; - if (len > 0) { - memcpy(buf + 1, str, len); - } - return 1 + len; -} - -/* Warning: do not return NULL */ -gchar *utf8_to_qq(const gchar *str, const gchar *to_charset) -{ - return do_convert(str, -1, to_charset, UTF8); -} - -/* Warning: do not return NULL */ -gchar *qq_to_utf8(const gchar *str, const gchar *from_charset) -{ - return do_convert(str, -1, UTF8, from_charset); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/char_conv.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/** - * @file char_conv.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_CHAR_CONV_H_ -#define _QQ_CHAR_CONV_H_ - -#include - -#define QQ_CHARSET_DEFAULT "GB18030" - -gint qq_get_vstr(gchar **ret, const gchar *from_charset, guint8 *data); -gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset); - -gchar *utf8_to_qq(const gchar *str, const gchar *to_charset); -gchar *qq_to_utf8(const gchar *str, const gchar *from_charset); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,825 +0,0 @@ -/** - * @file file_trans.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "ft.h" -#include "cipher.h" - -#include "qq_crypt.h" -#include "file_trans.h" -#include "qq_define.h" -#include "im.h" -#include "packet_parse.h" -#include "proxy.h" -#include "qq_network.h" -#include "send_file.h" -#include "utils.h" - -struct _qq_file_header { - guint16 client_ver; - guint8 file_key; - guint32 sender_uid; - guint32 receiver_uid; -}; - -typedef struct _qq_file_header qq_file_header; - -static guint32 _get_file_key(guint8 seed) -{ - guint32 key; - key = seed | (seed << 8) | (seed << 16) | (seed << 24); - return key; -} - -static guint32 _gen_file_key(void) -{ - guint8 seed; - - seed = rand() & 0xFF; - return _get_file_key(seed); -} - -static guint32 _decrypt_qq_uid(guint32 uid, guint32 key) -{ - return ~(uid ^ key); -} - -static guint32 _encrypt_qq_uid(guint32 uid, guint32 key) -{ - return (~uid) ^ key; -} - -static void _fill_file_md5(const gchar *filename, gint filelen, guint8 *md5) -{ - FILE *fp; - guint8 *buffer; - size_t wc; - - const gint QQ_MAX_FILE_MD5_LENGTH = 10002432; - - g_return_if_fail(filename != NULL && md5 != NULL); - if (filelen > QQ_MAX_FILE_MD5_LENGTH) - filelen = QQ_MAX_FILE_MD5_LENGTH; - - fp = fopen(filename, "rb"); - g_return_if_fail(fp != NULL); - - buffer = g_newa(guint8, filelen); - g_return_if_fail(buffer != NULL); - wc = fread(buffer, filelen, 1, fp); - fclose(fp); - if (wc != 1) { - purple_debug_error("qq", "Unable to read file: %s\n", filename); - - /* TODO: XXX: Really, the caller should be modified to deal with this properly. */ - return; - } - - qq_get_md5(md5, QQ_KEY_LENGTH, buffer, filelen); -} - -static gint _qq_get_file_header(qq_file_header *fh, guint8 *buf) -{ - gint bytes = 0; - bytes += qq_get16(&(fh->client_ver), buf + bytes); - bytes += qq_get8(&fh->file_key, buf + bytes); - bytes += qq_get32(&(fh->sender_uid), buf + bytes); - bytes += qq_get32(&(fh->receiver_uid), buf + bytes); - - fh->sender_uid = _decrypt_qq_uid(fh->sender_uid, _get_file_key(fh->file_key)); - fh->receiver_uid = _decrypt_qq_uid(fh->receiver_uid, _get_file_key(fh->file_key)); - return bytes; -} - -static const gchar *qq_get_file_cmd_desc(gint type) -{ - switch (type) { - case QQ_FILE_CMD_SENDER_SAY_HELLO: - return "QQ_FILE_CMD_SENDER_SAY_HELLO"; - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - return "QQ_FILE_CMD_SENDER_SAY_HELLO_ACK"; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - return "QQ_FILE_CMD_RECEIVER_SAY_HELLO"; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - return "QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK"; - case QQ_FILE_CMD_NOTIFY_IP_ACK: - return "QQ_FILE_CMD_NOTIFY_IP_ACK"; - case QQ_FILE_CMD_PING: - return "QQ_FILE_CMD_PING"; - case QQ_FILE_CMD_PONG: - return "QQ_FILE_CMD_PONG"; - case QQ_FILE_CMD_INITATIVE_CONNECT: - return "QQ_FILE_CMD_INITATIVE_CONNECT"; - case QQ_FILE_CMD_FILE_OP: - return "QQ_FILE_CMD_FILE_OP"; - case QQ_FILE_CMD_FILE_OP_ACK: - return "QQ_FILE_CMD_FILE_OP_ACK"; - case QQ_FILE_BASIC_INFO: - return "QQ_FILE_BASIC_INFO"; - case QQ_FILE_DATA_INFO: - return "QQ_FILE_DATA_INFO"; - case QQ_FILE_EOF: - return "QQ_FILE_EOF"; - default: - return "UNKNOWN_TYPE"; - } -} - -/* The memmap version has better performance for big files transfering - * but it will spend plenty of memory, so do not use it in a low-memory host */ -#ifdef USE_MMAP -#include - -static int _qq_xfer_open_file(const gchar *filename, const gchar *method, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - int fd; - if (method[0] == 'r') { - fd = open(purple_xfer_get_local_filename(xfer), O_RDONLY); - info->buffer = mmap(0, purple_xfer_get_size(xfer), PROT_READ, MAP_PRIVATE, fd, 0); - } - else - { - fd = open(purple_xfer_get_local_filename(xfer), O_RDWR|O_CREAT, 0644); - info->buffer = mmap(0, purple_xfer_get_size(xfer), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FILE, fd, 0); - } - - if (info->buffer == NULL) { - return - 1; - } - return 0; -} - -static gint _qq_xfer_read_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - gint readbytes; - - buffer = info->buffer + len * index; - readbytes = purple_xfer_get_size(xfer) - (buffer - info->buffer); - if (readbytes > info->fragment_len) readbytes = info->fragment_len; - return readbytes; -} - -static gint _qq_xfer_write_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - memcpy(info->buffer + index * len, buffer, len); - return 0; -} - -void qq_xfer_close_file(PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - if (info->buffer) munmap(info->buffer, purple_xfer_get_size(xfer)); -} -#else -static int _qq_xfer_open_file(const gchar *filename, const gchar *method, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - info->dest_fp = fopen(purple_xfer_get_local_filename(xfer), method); - if (info->dest_fp == NULL) { - return -1; - } - return 0; -} - -static gint _qq_xfer_read_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - fseek(info->dest_fp, index * len, SEEK_SET); - return fread(buffer, 1, len, info->dest_fp); -} - -static gint _qq_xfer_write_file(guint8 *buffer, guint index, guint len, PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - fseek(info->dest_fp, index * len, SEEK_SET); - return fwrite(buffer, 1, len, info->dest_fp); -} - -void qq_xfer_close_file(PurpleXfer *xfer) -{ - ft_info *info = xfer->data; - - if (info->dest_fp) fclose(info->dest_fp); -} -#endif - -static gint _qq_send_file(PurpleConnection *gc, guint8 *data, gint len, guint16 packet_type, guint32 to_uid) -{ - guint8 *raw_data; - gint bytes = 0; - guint32 file_key; - qq_data *qd; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - - info = (ft_info *) qd->xfer->data; - - raw_data = g_newa(guint8, MAX_PACKET_SIZE); - file_key = _gen_file_key(); - - bytes += qq_put8(raw_data + bytes, packet_type); - bytes += qq_put16(raw_data + bytes, qd->client_tag); - bytes += qq_put8(raw_data + bytes, file_key & 0xff); - bytes += qq_put32(raw_data + bytes, _encrypt_qq_uid(qd->uid, file_key)); - bytes += qq_put32(raw_data + bytes, _encrypt_qq_uid(to_uid, file_key)); - bytes += qq_putdata(raw_data + bytes, data, len); - - if (bytes == len + 12) { - _qq_xfer_write(raw_data, bytes, qd->xfer); - } else - purple_debug_info("QQ", "send_file: want %d but got %d\n", len + 12, bytes); - return bytes; -} - -/* send a file to udp channel with QQ_FILE_CONTROL_PACKET_TAG */ -void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte) -{ - qq_data *qd; - gint bytes, bytes_expected, encrypted_len; - guint8 *raw_data, *encrypted; - time_t now; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - info = (ft_info *) qd->xfer->data; - - raw_data = g_newa (guint8, 61); - bytes = 0; - - now = time(NULL); - - bytes += qq_putdata(raw_data + bytes, qd->session_md5, 16); - bytes += qq_put16(raw_data + bytes, packet_type); - switch (packet_type) { - case QQ_FILE_CMD_SENDER_SAY_HELLO: - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - case QQ_FILE_CMD_NOTIFY_IP_ACK: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - bytes += qq_put16(raw_data + bytes, info->send_seq); - break; - default: - bytes += qq_put16(raw_data + bytes, ++qd->send_seq); - } - bytes += qq_put32(raw_data + bytes, (guint32) now); - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put8(raw_data + bytes, qd->my_icon); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, 0x00); - /* 0x65: send a file, 0x6b: send a custom face */ - bytes += qq_put8(raw_data + bytes, QQ_FILE_TRANSFER_FILE); /* FIXME temp by gfhuang */ - switch (packet_type) - { - case QQ_FILE_CMD_SENDER_SAY_HELLO: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put8(raw_data + bytes, hellobyte); - bytes_expected = 48; - break; - case QQ_FILE_CMD_PING: - case QQ_FILE_CMD_PONG: - case QQ_FILE_CMD_NOTIFY_IP_ACK: - bytes += qq_fill_conn_info(raw_data, info); - bytes_expected = 61; - break; - default: - purple_debug_info("QQ", "qq_send_file_ctl_packet: Unknown packet type[%d]\n", - packet_type); - bytes_expected = 0; - } - - if (bytes != bytes_expected) { - purple_debug_error("QQ", "qq_send_file_ctl_packet: Expected to get %d bytes, but get %d\n", - bytes_expected, bytes); - return; - } - - qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", - raw_data, bytes, - "sending packet[%s]:", qq_get_file_cmd_desc(packet_type)); - - encrypted = g_newa(guint8, bytes + 17); - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, info->file_session_key); - /*debug: try to decrypt it */ - -#if 0 - guint8 *buf; - int buflen; - hex_dump = hex_dump_to_str(encrypted, encrypted_len); - purple_debug_info("QQ", "encrypted packet: \n%s\n", hex_dump); - g_free(hex_dump); - buf = g_newa(guint8, MAX_PACKET_SIZE); - buflen = encrypted_len; - if (qq_crypt(DECRYPT, encrypted, encrypted_len, info->file_session_key, buf, &buflen)) { - purple_debug_info("QQ", "decrypt success\n"); - if (buflen == bytes && memcmp(raw_data, buf, buflen) == 0) - purple_debug_info("QQ", "checksum ok\n"); - - hex_dump = hex_dump_to_str(buf, buflen); - purple_debug_info("QQ", "decrypted packet: \n%s\n", hex_dump); - g_free(hex_dump); - } else { - purple_debug_info("QQ", "decrypt fail\n"); - } -#endif - - purple_debug_info("QQ", "<== send %s packet\n", qq_get_file_cmd_desc(packet_type)); - _qq_send_file(gc, encrypted, encrypted_len, QQ_FILE_CONTROL_PACKET_TAG, info->to_uid); -} - -/* send a file to udp channel with QQ_FILE_DATA_PACKET_TAG */ -static void _qq_send_file_data_packet(PurpleConnection *gc, guint16 packet_type, guint8 sub_type, - guint32 fragment_index, guint16 seq, guint8 *data, gint len) -{ - guint8 *raw_data, filename_md5[QQ_KEY_LENGTH], file_md5[QQ_KEY_LENGTH]; - gint bytes; - guint32 fragment_size = 1000; - const char *filename; - gint filename_len, filesize; - qq_data *qd; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - info = (ft_info *) qd->xfer->data; - - filename = purple_xfer_get_filename(qd->xfer); - filesize = purple_xfer_get_size(qd->xfer); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE); - bytes = 0; - - bytes += qq_put8(raw_data + bytes, 0x00); - bytes += qq_put16(raw_data + bytes, packet_type); - switch (packet_type) { - case QQ_FILE_BASIC_INFO: - case QQ_FILE_DATA_INFO: - case QQ_FILE_EOF: - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, 0x00); - break; - case QQ_FILE_CMD_FILE_OP: - switch(sub_type) - { - case QQ_FILE_BASIC_INFO: - filename_len = strlen(filename); - qq_get_md5(filename_md5, sizeof(filename_md5), (guint8 *)filename, filename_len); - _fill_file_md5(purple_xfer_get_local_filename(qd->xfer), - purple_xfer_get_size(qd->xfer), - file_md5); - - info->fragment_num = (filesize - 1) / QQ_FILE_FRAGMENT_MAXLEN + 1; - info->fragment_len = QQ_FILE_FRAGMENT_MAXLEN; - - purple_debug_info("QQ", - "start transfering data, %d fragments with %d length each\n", - info->fragment_num, info->fragment_len); - /* Unknown */ - bytes += qq_put16(raw_data + bytes, 0x0000); - /* Sub-operation type */ - bytes += qq_put8(raw_data + bytes, sub_type); - /* Length of file */ - bytes += qq_put32(raw_data + bytes, filesize); - /* Number of fragments */ - bytes += qq_put32(raw_data + bytes, info->fragment_num); - /* Length of a single fragment */ - bytes += qq_put32(raw_data + bytes, info->fragment_len); - bytes += qq_putdata(raw_data + bytes, file_md5, 16); - bytes += qq_putdata(raw_data + bytes, filename_md5, 16); - /* Length of filename */ - bytes += qq_put16(raw_data + bytes, filename_len); - /* 8 unknown bytes */ - bytes += qq_put32(raw_data + bytes, 0x00000000); - bytes += qq_put32(raw_data + bytes, 0x00000000); - /* filename */ - bytes += qq_putdata(raw_data + bytes, (guint8 *) filename, - filename_len); - break; - case QQ_FILE_DATA_INFO: - purple_debug_info("QQ", - "sending %dth fragment with length %d, offset %d\n", - fragment_index, len, (fragment_index-1)*fragment_size); - /* bytes += qq_put16(raw_data + bytes, ++(qd->send_seq)); */ - bytes += qq_put16(raw_data + bytes, info->send_seq); - bytes += qq_put8(raw_data + bytes, sub_type); - /* bytes += qq_put32(raw_data + bytes, fragment_index); */ - bytes += qq_put32(raw_data + bytes, fragment_index - 1); - bytes += qq_put32(raw_data + bytes, (fragment_index - 1) * fragment_size); - bytes += qq_put16(raw_data + bytes, len); - bytes += qq_putdata(raw_data + bytes, data, len); - break; - case QQ_FILE_EOF: - purple_debug_info("QQ", "end of sending data\n"); - /* bytes += qq_put16(raw_data + bytes, info->fragment_num + 1); */ - bytes += qq_put16(raw_data + bytes, info->fragment_num); - bytes += qq_put8(raw_data + bytes, sub_type); - /* purple_xfer_set_completed(qd->xfer, TRUE); */ - } - break; - case QQ_FILE_CMD_FILE_OP_ACK: - switch (sub_type) - { - case QQ_FILE_BASIC_INFO: - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, sub_type); - bytes += qq_put32(raw_data + bytes, 0x00000000); - break; - case QQ_FILE_DATA_INFO: - bytes += qq_put16(raw_data + bytes, seq); - bytes += qq_put8(raw_data + bytes, sub_type); - bytes += qq_put32(raw_data + bytes, fragment_index); - break; - case QQ_FILE_EOF: - bytes += qq_put16(raw_data + bytes, filesize / QQ_FILE_FRAGMENT_MAXLEN + 2); - bytes += qq_put8(raw_data + bytes, sub_type); - break; - } - } - purple_debug_info("QQ", "<== send %s packet\n", qq_get_file_cmd_desc(packet_type)); - _qq_send_file(gc, raw_data, bytes, QQ_FILE_DATA_PACKET_TAG, info->to_uid); -} - -/* A conversation starts like this: - * Sender ==> Receiver [QQ_FILE_CMD_PING] - * Sender <== Receiver [QQ_FILE_CMD_PONG] - * Sender ==> Receiver [QQ_FILE_CMD_SENDER_SAY_HELLO] - * Sender <== Receiver [QQ_FILE_CMD_SENDER_SAY_HELLO_ACK] - * Sender <== Receiver [QQ_FILE_CMD_RECEIVER_SAY_HELLO] - * Sender ==> Receiver [QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK] - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_BASIC_INFO] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_BASIC_INFO] - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_DATA_INFO] - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_DATA_INFO] - * ...... - * Sender ==> Receiver [QQ_FILE_CMD_FILE_OP, QQ_FILE_EOF] - * Sender <== Receiver [QQ_FILE_CMD_FILE_OP_ACK, QQ_FILE_EOF] - */ - - -static void _qq_process_recv_file_ctl_packet(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes ; - gint decryped_bytes; - qq_file_header fh; - guint8 *decrypted_data; - gint decrypted_len; - qq_data *qd = (qq_data *) gc->proto_data; - guint16 packet_type; - guint16 seq; - guint8 hellobyte; - ft_info *info = (ft_info *) qd->xfer->data; - - bytes = 0; - bytes += _qq_get_file_header(&fh, data + bytes); - - decrypted_data = g_newa(guint8, data_len); - decrypted_len = qq_decrypt(decrypted_data, data, data_len, qd->session_md5); - if ( decrypted_len <= 0 ) { - purple_debug_error("QQ", "Error decrypt rcv file ctrl packet\n"); - return; - } - - /* only for debug info */ - decryped_bytes = 16; /* skip md5 section */ - decryped_bytes += qq_get16(&packet_type, decrypted_data + decryped_bytes); - decryped_bytes += qq_get16(&seq, decrypted_data + decryped_bytes); - decryped_bytes += 4+1+1+19+1; /* skip something */ - - purple_debug_info("QQ", "==> [%d] receive %s packet\n", seq, qq_get_file_cmd_desc(packet_type)); - qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", - decrypted_data, decrypted_len, - "decrypted control packet received:"); - - switch (packet_type) { - case QQ_FILE_CMD_NOTIFY_IP_ACK: - decryped_bytes = 0; - qq_get_conn_info(info, decrypted_data + decryped_bytes); - /* qq_send_file_ctl_packet(gc, QQ_FILE_CMD_PING, fh->sender_uid, 0); */ - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_SENDER_SAY_HELLO, fh.sender_uid, 0); - break; - case QQ_FILE_CMD_SENDER_SAY_HELLO: - /* I'm receiver, if we receive SAY_HELLO from sender, we send back the ACK */ - decryped_bytes += 47; - decryped_bytes += qq_get8(&hellobyte, decrypted_data + decryped_bytes); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_SENDER_SAY_HELLO_ACK, fh.sender_uid, hellobyte); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_RECEIVER_SAY_HELLO, fh.sender_uid, 0); - break; - case QQ_FILE_CMD_SENDER_SAY_HELLO_ACK: - /* I'm sender, do nothing */ - break; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO: - /* I'm sender, ack the hello packet and send the first data */ - decryped_bytes += 47; - decryped_bytes += qq_get8(&hellobyte, decrypted_data + decryped_bytes); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK, fh.sender_uid, hellobyte); - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_BASIC_INFO, 0, 0, NULL, 0); - break; - case QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK: - /* I'm receiver, do nothing */ - break; - case QQ_FILE_CMD_PING: - /* I'm receiver, ack the PING */ - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_PONG, fh.sender_uid, 0); - break; - case QQ_FILE_CMD_PONG: - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_SENDER_SAY_HELLO, fh.sender_uid, 0); - break; - default: - purple_debug_info("QQ", "unprocess file command %d\n", packet_type); - } -} - -static void _qq_recv_file_progess(PurpleConnection *gc, guint8 *buffer, guint16 len, guint32 index, guint32 offset) -{ - qq_data *qd = (qq_data *) gc->proto_data; - PurpleXfer *xfer = qd->xfer; - ft_info *info = (ft_info *) xfer->data; - guint32 mask; - - purple_debug_info("QQ", - "receiving %dth fragment with length %d, slide window status %o, max_fragment_index %d\n", - index, len, info->window, info->max_fragment_index); - if (info->window == 0 && info->max_fragment_index == 0) { - if (_qq_xfer_open_file(purple_xfer_get_local_filename(xfer), "wb", xfer) == -1) { - purple_xfer_cancel_local(xfer); - return; - } - purple_debug_info("QQ", "object file opened for writing\n"); - } - mask = 0x1 << (index % sizeof(info->window)); - if (index < info->max_fragment_index || (info->window & mask)) { - purple_debug_info("QQ", "duplicate %dth fragment, drop it!\n", index+1); - return; - } - - info->window |= mask; - - _qq_xfer_write_file(buffer, index, len, xfer); - - xfer->bytes_sent += len; - xfer->bytes_remaining -= len; - purple_xfer_update_progress(xfer); - - mask = 0x1 << (info->max_fragment_index % sizeof(info->window)); - while (info->window & mask) - { - info->window &= ~mask; - info->max_fragment_index ++; - if (mask & 0x8000) mask = 0x0001; - else mask = mask << 1; - } - purple_debug_info("QQ", "procceed %dth fragment, slide window status %o, max_fragment_index %d\n", - index, info->window, info->max_fragment_index); -} - -static void _qq_send_file_progess(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *) gc->proto_data; - PurpleXfer *xfer = qd->xfer; - ft_info *info = (ft_info *) xfer->data; - guint32 mask; - guint8 *buffer; - guint i; - gint readbytes; - - if (purple_xfer_get_bytes_remaining(xfer) <= 0) return; - if (info->window == 0 && info->max_fragment_index == 0) - { - if (_qq_xfer_open_file(purple_xfer_get_local_filename(xfer), "rb", xfer) == -1) { - purple_xfer_cancel_local(xfer); - return; - } - } - buffer = g_newa(guint8, info->fragment_len); - mask = 0x1 << (info->max_fragment_index % sizeof(info->window)); - for (i = 0; i < sizeof(info->window); i++) { - if ((info->window & mask) == 0) { - readbytes = _qq_xfer_read_file(buffer, info->max_fragment_index + i, info->fragment_len, xfer); - if (readbytes > 0) - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO, - info->max_fragment_index + i + 1, 0, buffer, readbytes); - } - if (mask & 0x8000) mask = 0x0001; - else mask = mask << 1; - } -} - -static void _qq_update_send_progess(PurpleConnection *gc, guint32 fragment_index) -{ - guint32 mask; - guint8 *buffer; - gint readbytes; - qq_data *qd = (qq_data *) gc->proto_data; - PurpleXfer *xfer = qd->xfer; - ft_info *info = (ft_info *) xfer->data; - - purple_debug_info("QQ", - "receiving %dth fragment ack, slide window status %o, max_fragment_index %d\n", - fragment_index, info->window, info->max_fragment_index); - if (fragment_index < info->max_fragment_index || - fragment_index >= info->max_fragment_index + sizeof(info->window)) { - purple_debug_info("QQ", "duplicate %dth fragment, drop it!\n", fragment_index+1); - return; - } - mask = 0x1 << (fragment_index % sizeof(info->window)); - if ((info->window & mask) == 0) - { - info->window |= mask; - if (fragment_index + 1 != info->fragment_num) { - xfer->bytes_sent += info->fragment_len; - } else { - xfer->bytes_sent += purple_xfer_get_size(xfer) % info->fragment_len; - } - xfer->bytes_remaining = purple_xfer_get_size(xfer) - purple_xfer_get_bytes_sent(xfer); - purple_xfer_update_progress(xfer); - if (purple_xfer_get_bytes_remaining(xfer) <= 0) { - /* We have finished sending the file */ - purple_xfer_set_completed(xfer, TRUE); - return; - } - mask = 0x1 << (info->max_fragment_index % sizeof(info->window)); - while (info->window & mask) - { - /* move the slide window */ - info->window &= ~mask; - - buffer = g_newa(guint8, info->fragment_len); - readbytes = _qq_xfer_read_file(buffer, info->max_fragment_index + sizeof(info->window), - info->fragment_len, xfer); - if (readbytes > 0) - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_DATA_INFO, - info->max_fragment_index + sizeof(info->window) + 1, 0, buffer, readbytes); - - info->max_fragment_index ++; - if (mask & 0x8000) mask = 0x0001; - else mask = mask << 1; - } - } - purple_debug_info("QQ", - "procceed %dth fragment ack, slide window status %o, max_fragment_index %d\n", - fragment_index, info->window, info->max_fragment_index); -} - -static void _qq_process_recv_file_data(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes ; - qq_file_header fh; - guint16 packet_type; - guint16 packet_seq; - guint8 sub_type; - guint32 fragment_index; - guint16 fragment_len; - guint32 fragment_offset; - qq_data *qd = (qq_data *) gc->proto_data; - ft_info *info = (ft_info *) qd->xfer->data; - - bytes = 0; - bytes += _qq_get_file_header(&fh, data + bytes); - - bytes += 1; /* skip an unknown byte */ - bytes += qq_get16(&packet_type, data + bytes); - switch(packet_type) - { - case QQ_FILE_CMD_FILE_OP: - bytes += qq_get16(&packet_seq, data + bytes); - bytes += qq_get8(&sub_type, data + bytes); - switch (sub_type) - { - case QQ_FILE_BASIC_INFO: - bytes += 4; /* file length, we have already known it from xfer */ - bytes += qq_get32(&info->fragment_num, data + bytes); - bytes += qq_get32(&info->fragment_len, data + bytes); - - /* FIXME: We must check the md5 here, - * if md5 doesn't match we will ignore - * the packet or send sth as error number */ - - info->max_fragment_index = 0; - info->window = 0; - purple_debug_info("QQ", - "start receiving data, %d fragments with %d length each\n", - info->fragment_num, info->fragment_len); - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP_ACK, sub_type, - 0, 0, NULL, 0); - break; - case QQ_FILE_DATA_INFO: - bytes += qq_get32(&fragment_index, data + bytes); - bytes += qq_get32(&fragment_offset, data + bytes); - bytes += qq_get16(&fragment_len, data + bytes); - purple_debug_info("QQ", - "received %dth fragment with length %d, offset %d\n", - fragment_index, fragment_len, fragment_offset); - - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP_ACK, sub_type, - fragment_index, packet_seq, NULL, 0); - _qq_recv_file_progess(gc, data + bytes, fragment_len, fragment_index, fragment_offset); - break; - case QQ_FILE_EOF: - purple_debug_info("QQ", "end of receiving\n"); - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP_ACK, sub_type, - 0, 0, NULL, 0); - break; - } - break; - case QQ_FILE_CMD_FILE_OP_ACK: - bytes += qq_get16(&packet_seq, data + bytes); - bytes += qq_get8(&sub_type, data + bytes); - switch (sub_type) - { - case QQ_FILE_BASIC_INFO: - info->max_fragment_index = 0; - info->window = 0; - /* It is ready to send file data */ - _qq_send_file_progess(gc); - break; - case QQ_FILE_DATA_INFO: - bytes += qq_get32(&fragment_index, data + bytes); - _qq_update_send_progess(gc, fragment_index); - if (purple_xfer_is_completed(qd->xfer)) - _qq_send_file_data_packet(gc, QQ_FILE_CMD_FILE_OP, QQ_FILE_EOF, 0, 0, NULL, 0); - /* else - _qq_send_file_progess(gc); */ - break; - case QQ_FILE_EOF: - /* FIXME: OK, we can end the connection successfully */ - - _qq_send_file_data_packet(gc, QQ_FILE_EOF, 0, 0, 0, NULL, 0); - purple_xfer_set_completed(qd->xfer, TRUE); - break; - } - break; - case QQ_FILE_EOF: - _qq_send_file_data_packet(gc, QQ_FILE_EOF, 0, 0, 0, NULL, 0); - purple_xfer_set_completed(qd->xfer, TRUE); - purple_xfer_end(qd->xfer); - break; - case QQ_FILE_BASIC_INFO: - purple_debug_info("QQ", "here\n"); - _qq_send_file_data_packet(gc, QQ_FILE_DATA_INFO, 0, 0, 0, NULL, 0); - break; - default: - purple_debug_info("QQ", "_qq_process_recv_file_data: unknown packet type [%d]\n", - packet_type); - break; - } -} - -void qq_process_recv_file(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes; - guint8 tag; - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&tag, data + bytes); - - switch (tag) { - case QQ_FILE_CONTROL_PACKET_TAG: - _qq_process_recv_file_ctl_packet(gc, data + bytes, len - bytes); - break; - case QQ_FILE_DATA_PACKET_TAG: - _qq_process_recv_file_data(gc, data + bytes, len - bytes); - break; - default: - purple_debug_info("QQ", "unknown packet tag\n"); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/file_trans.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/** - * @file file_trans.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_QQ_FILE_TRANS_H_ -#define _QQ_QQ_FILE_TRANS_H_ - -#include "server.h" - -enum { - QQ_FILE_CMD_SENDER_SAY_HELLO = 0x31, - QQ_FILE_CMD_SENDER_SAY_HELLO_ACK = 0x32, - QQ_FILE_CMD_RECEIVER_SAY_HELLO = 0x33, - QQ_FILE_CMD_RECEIVER_SAY_HELLO_ACK = 0x34, - QQ_FILE_CMD_NOTIFY_IP_ACK = 0x3c, - QQ_FILE_CMD_PING = 0x3d, - QQ_FILE_CMD_PONG = 0x3e, - QQ_FILE_CMD_INITATIVE_CONNECT = 0x40 -}; - -enum { - QQ_FILE_TRANSFER_FILE = 0x65, - QQ_FILE_TRANSFER_FACE = 0x6b -}; - -enum { - QQ_FILE_BASIC_INFO = 0x01, - QQ_FILE_DATA_INFO = 0x02, - QQ_FILE_EOF = 0x03, - QQ_FILE_CMD_FILE_OP = 0x07, - QQ_FILE_CMD_FILE_OP_ACK = 0x08 -}; - -#define QQ_FILE_FRAGMENT_MAXLEN 1000 - -#define QQ_FILE_CONTROL_PACKET_TAG 0x00 -/* #define QQ_PACKET_TAG 0x02 */ /* all QQ text packets starts with it */ -#define QQ_FILE_DATA_PACKET_TAG 0x03 -#define QQ_FILE_AGENT_PACKET_TAG 0x04 -/* #define QQ_PACKET_TAIL 0x03 */ /* all QQ text packets end with it */ - -void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte); -void qq_process_recv_file(PurpleConnection *gc, guint8 *data, gint len); -/* void qq_send_file_data_packet(PurpleConnection *gc, guint16 packet_type, guint8 sub_type, guint32 fragment_index, guint16 seq, guint8 *data, gint len); */ -void qq_xfer_close_file(PurpleXfer *xfer); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/** - * @file group.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "prpl.h" -#include "request.h" - -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "utils.h" -#include "qq_network.h" -#include "qq_define.h" - -static void _qq_group_search_callback(PurpleConnection *gc, const gchar *input) -{ - guint32 ext_id; - - g_return_if_fail(input != NULL); - ext_id = strtoul(input, NULL, 10); - /* 0x00000000 means search for demo group */ - qq_request_room_search(gc, ext_id, QQ_ROOM_SEARCH_ONLY); -} - -static void _qq_group_search_cancel_callback(PurpleConnection *gc, const gchar *input) -{ - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - purple_roomlist_set_in_progress(qd->roomlist, FALSE); -} - -/* This is needed for PurpleChat node to be valid */ -GList *qq_chat_info(PurpleConnection *gc) -{ - GList *m; - struct proto_chat_entry *pce; - - m = NULL; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("ID: "); - pce->identifier = QQ_ROOM_KEY_EXTERNAL_ID; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *qq_chat_info_defaults(PurpleConnection *gc, const gchar *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, QQ_ROOM_KEY_EXTERNAL_ID, g_strdup(chat_name)); - - return defaults; -} - -/* get a list of qq groups */ -PurpleRoomlist *qq_roomlist_get_list(PurpleConnection *gc) -{ - GList *fields; - qq_data *qd; - PurpleRoomlist *rl; - PurpleRoomlistField *f; - - qd = (qq_data *) gc->proto_data; - - fields = NULL; - rl = purple_roomlist_new(purple_connection_get_account(gc)); - qd->roomlist = rl; - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Group ID"), QQ_ROOM_KEY_EXTERNAL_ID, FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", QQ_ROOM_KEY_INTERNAL_ID, TRUE); - fields = g_list_append(fields, f); - - fields = g_list_append(fields, f); - purple_roomlist_set_fields(rl, fields); - purple_roomlist_set_in_progress(qd->roomlist, TRUE); - - purple_request_input(gc, _("QQ Qun"), - _("Please enter Qun number"), - _("You can only search for permanent Qun\n"), - NULL, FALSE, FALSE, NULL, - _("Search"), G_CALLBACK(_qq_group_search_callback), - _("Cancel"), G_CALLBACK(_qq_group_search_cancel_callback), - purple_connection_get_account(gc), NULL, NULL, - gc); - - return qd->roomlist; -} - -/* free roomlist space, I have no idea when this one is called... */ -void qq_roomlist_cancel(PurpleRoomlist *list) -{ - qq_data *qd; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - gc = purple_account_get_connection(list->account); - - qd = (qq_data *) gc->proto_data; - purple_roomlist_set_in_progress(list, FALSE); - purple_roomlist_unref(list); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/** - * @file group.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_H_ -#define _QQ_GROUP_H_ - -#include -#include "account.h" -#include "connection.h" -#include "roomlist.h" -#include "qq.h" - -#define PURPLE_GROUP_QQ_QUN "QQ 群" - -typedef enum { - QQ_ROOM_ROLE_NO = 0x00, /* default 0x00 means not member */ - QQ_ROOM_ROLE_YES, - QQ_ROOM_ROLE_REQUESTING, - QQ_ROOM_ROLE_ADMIN -} qq_room_role; - -typedef struct _qq_room_data qq_room_data; -struct _qq_room_data { - /* all these will be saved when we exit Purple */ - qq_room_role my_role; /* my role for this room */ - guint32 id; - guint32 ext_id; - guint8 type8; /* permanent or temporory */ - guint32 creator_uid; - guint32 category; - guint8 auth_type; - gchar *title_utf8; - gchar *desc_utf8; - /* all these will be loaded from the network */ - gchar *notice_utf8; /* group notice by admin */ - - gboolean is_got_buddies; - GList *members; -}; - -GList *qq_chat_info(PurpleConnection *gc); -GHashTable *qq_chat_info_defaults(PurpleConnection *gc, const gchar *chat_name); - -PurpleRoomlist *qq_roomlist_get_list(PurpleConnection *gc); - -void qq_roomlist_cancel(PurpleRoomlist *list); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,442 +0,0 @@ -/** - * @file group_im.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "request.h" -#include "util.h" - -#include "char_conv.h" -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "group_im.h" -#include "group_opt.h" -#include "im.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_process.h" -#include "utils.h" - -/* show group conversation window */ -PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd) -{ - PurpleConversation *conv; - qq_data *qd; - gchar *topic_utf8; - - g_return_val_if_fail(rmd != NULL, NULL); - g_return_val_if_fail(rmd->title_utf8, NULL); - qd = (qq_data *) gc->proto_data; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - rmd->title_utf8, purple_connection_get_account(gc)); - if (conv != NULL) { - /* show only one conversation per room */ - return conv; - } - - serv_got_joined_chat(gc, rmd->id, rmd->title_utf8); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, rmd->title_utf8, purple_connection_get_account(gc)); - if (conv != NULL) { - if (rmd->notice_utf8 != NULL) { - topic_utf8 = g_strdup_printf("%u %s", rmd->ext_id, rmd->notice_utf8); - } else { - topic_utf8 = g_strdup_printf("%u", rmd->ext_id); - } - purple_debug_info("QQ", "Chat topic = %s\n", topic_utf8); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); - g_free(topic_utf8); - - if (rmd->is_got_buddies) - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_ONLINES, rmd->id); - else - qq_update_room(gc, 0, rmd->id); - return conv; - } - return NULL; -} - -/* refresh online member in group conversation window */ -void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd) -{ - GList *names, *list, *flags; - qq_buddy_data *bd; - gchar *member_name, *member_uid; - PurpleConversation *conv; - gint flag; - gboolean is_find; - - g_return_if_fail(rmd != NULL); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - rmd->title_utf8, purple_connection_get_account(gc)); - if (conv == NULL) { - purple_debug_warning("QQ", "Conversation \"%s\" is not opened\n", rmd->title_utf8); - return; - } - g_return_if_fail(rmd->members != NULL); - - names = NULL; - flags = NULL; - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - - /* we need unique identifiers for everyone in the chat or else we'll - * run into problems with functions like get_cb_real_name from qq.c */ - member_name = (bd->nickname != NULL && *(bd->nickname) != '\0') ? - g_strdup_printf("%s (%u)", bd->nickname, bd->uid) : - g_strdup_printf("(%u)", bd->uid); - member_uid = g_strdup_printf("(%u)", bd->uid); - - flag = 0; - /* TYPING to put online above OP and FOUNDER */ - if (is_online(bd->status)) flag |= (PURPLE_CBFLAGS_TYPING | PURPLE_CBFLAGS_VOICE); - if(1 == (bd->role & 1)) flag |= PURPLE_CBFLAGS_OP; - if(bd->uid == rmd->creator_uid) flag |= PURPLE_CBFLAGS_FOUNDER; - - is_find = TRUE; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), member_name)) - { - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), - member_name, - flag); - } else if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(conv), member_uid)) - { - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(conv), - member_uid, - flag); - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(conv), member_uid, member_name); - } else { - is_find = FALSE; - } - if (!is_find) { - /* always put it even offline */ - names = g_list_append(names, member_name); - flags = g_list_append(flags, GINT_TO_POINTER(flag)); - } else { - g_free(member_name); - } - g_free(member_uid); - list = list->next; - } - - if (names != NULL && flags != NULL) { - purple_conv_chat_add_users(PURPLE_CONV_CHAT(conv), names, NULL, flags, FALSE); - } - - /* clean up names */ - while (names != NULL) { - member_name = (gchar *) names->data; - names = g_list_remove(names, member_name); - g_free(member_name); - } - g_list_free(flags); -} - -void qq_room_got_chat_in(PurpleConnection *gc, - guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time) -{ - PurpleConversation *conv; - qq_data *qd; - qq_buddy_data *bd; - qq_room_data *rmd; - gchar *from; - - g_return_if_fail(gc != NULL && room_id != 0); - g_return_if_fail(msg != NULL); - - qd = (qq_data *)gc->proto_data; - conv = purple_find_chat(gc, room_id); - rmd = qq_room_data_find(gc, room_id); - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "is_show_chat:%d\n", qd->is_show_chat); - if (NULL == conv && qd->is_show_chat) { - conv = qq_room_conv_open(gc, rmd); - } - - if (NULL == conv) { - purple_debug_info("QQ", "Conversion of %u is not open, missing from %d:/n%s/v\n", - room_id, uid_from, msg); - return; - } - - if (uid_from != 0) { - - bd = qq_room_buddy_find(rmd, uid_from); - if (bd == NULL || bd->nickname == NULL) - from = g_strdup_printf("%u", uid_from); - else - from = g_strdup(bd->nickname); - } else { - from = g_strdup(""); - } - serv_got_chat_in(gc, room_id, from, 0, msg, in_time); - g_free(from); -} - -/* recv an IM from a group chat */ -void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type) -{ - qq_data *qd; - gchar *msg_smiley, *msg_fmt, *msg_utf8; - gint bytes, tail_len; - struct { - guint32 ext_id; - guint8 type8; - guint32 member_uid; - guint16 unknown; - guint16 msg_seq; - time_t send_time; - guint32 version; - guint16 msg_len; - gchar *msg; - } im_text; - guint32 temp_id; - guint16 content_type; - guint8 frag_count, frag_index; - guint16 msg_id; - qq_im_format *fmt = NULL; - - /* at least include im_text.msg_len */ - g_return_if_fail(data != NULL && data_len > 23); - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("ROOM_IM", data, data_len); */ - memset(&im_text, 0, sizeof(im_text)); - bytes = 0; - bytes += qq_get32(&(im_text.ext_id), data + bytes); - bytes += qq_get8(&(im_text.type8), data + bytes); - - if(QQ_MSG_TEMP_QUN_IM == msg_type) { - bytes += qq_get32(&temp_id, data + bytes); - } - - bytes += qq_get32(&(im_text.member_uid), bytes + data); - bytes += qq_get16(&im_text.unknown, data + bytes); /* 0x0001? */ - bytes += qq_get16(&(im_text.msg_seq), data + bytes); - bytes += qq_getime(&im_text.send_time, data + bytes); - bytes += qq_get32(&im_text.version, data + bytes); - bytes += qq_get16(&(im_text.msg_len), data + bytes); - purple_debug_info("QQ", "Room IM, ext id %u, seq %u, version 0x%04X, len %u\n", - im_text.ext_id, im_text.msg_seq, im_text.version, im_text.msg_len); - - if (im_text.msg_len != data_len - bytes) { - purple_debug_warning("QQ", "Room IM length %d should be %d\n", - im_text.msg_len, data_len - bytes); - im_text.msg_len = data_len - bytes; - } - - g_return_if_fail(im_text.msg_len > 0 && bytes + im_text.msg_len <= data_len); - if(msg_type != QQ_MSG_QUN_IM_UNKNOWN) { - g_return_if_fail(im_text.msg_len >= 10); - - bytes += qq_get16(&content_type, data + bytes); - bytes += qq_get8(&frag_count, data + bytes); - bytes += qq_get8(&frag_index, data + bytes); - bytes += qq_get16(&msg_id, data + bytes); - bytes += 4; /* skip 0x(00 00 00 00) */ - purple_debug_info("QQ", "Room IM, content %d, frag %d-%d, msg id %u\n", - content_type, frag_count, frag_index, msg_id); - im_text.msg_len -= 10; - } - g_return_if_fail(im_text.msg_len > 0); - - /* qq_show_packet("Message", data + bytes, data_len - bytes); */ - if (frag_count <= 1 || frag_count == frag_index + 1) { - fmt = qq_im_fmt_new(); - tail_len = qq_get_im_tail(fmt, data + bytes, data_len - bytes); - im_text.msg = g_strndup((gchar *)(data + bytes), data_len - tail_len); - } else { - im_text.msg = g_strndup((gchar *)(data + bytes), data_len - bytes); - } - - /* group im_group has no flag to indicate whether it has font_attr or not */ - msg_smiley = qq_emoticon_to_purple(im_text.msg); - if (fmt != NULL) { - msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); - msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); - g_free(msg_fmt); - qq_im_fmt_free(fmt); - } else { - msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); - } - g_free(msg_smiley); - - purple_debug_info("QQ", "Room (%u) IM from %u: %s\n", - im_text.ext_id, im_text.member_uid, msg_utf8); - qq_room_got_chat_in(gc, id, im_text.member_uid, msg_utf8, im_text.send_time); - - g_free(msg_utf8); - g_free(im_text.msg); -} - -/* send IM to a group */ -static void request_room_send_im(PurpleConnection *gc, guint32 room_id, qq_im_format *fmt, const gchar *msg) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(room_id != 0 && msg != NULL); - - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); - bytes += qq_put_im_tail(raw_data + bytes, fmt); - /* reset first two bytes */ - qq_put16(raw_data, bytes - 2); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM, room_id, raw_data, bytes); -} - -/* this is the ACK */ -void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len) -{ - /* return should be the internal group id - * but we have nothing to do with it */ - return; -} - -void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len) -{ - /* return should be the internal group id - * but we have nothing to do with it */ - return; -} - -#if 0 -static void request_room_send_im_ex(PurpleConnection *gc, guint32 room_id, - qq_im_format *fmt, gchar *msg, guint16 msg_id, guint8 frag_count, guint8 frag_index) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - - g_return_if_fail(room_id != 0 && msg != NULL); - - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); /* packet len */ - /* type 0x0001, text only; 0x0002, with custom emoticon */ - bytes += qq_put16(raw_data + bytes, 0x0001); - bytes += qq_put8(raw_data + bytes, frag_count); - bytes += qq_put8(raw_data + bytes, frag_index); - bytes += qq_put16(raw_data + bytes, msg_id); - bytes += qq_put32(raw_data + bytes, 0); /* unknow 4 bytes */ - bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); - if (frag_count == frag_index + 1) { - bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ - bytes += qq_put_im_tail(raw_data + bytes, fmt); - } - - /* reset first two bytes as length */ - qq_put16(raw_data, bytes - 2); - - /*qq_show_packet("QQ_ROOM_CMD_SEND_IM_EX", raw_data, bytes); */ - qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_IM_EX, room_id, raw_data, bytes); -} -#endif - -/* send a chat msg to a QQ Qun - * called by purple */ -int qq_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) -{ - qq_data *qd; - qq_im_format *fmt; - gchar *msg_stripped, *tmp; - GSList *segments, *it; - gint msg_len; - const gchar *start_invalid; - gboolean is_smiley_none; - guint8 frag_count, frag_index; - - g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1); - g_return_val_if_fail(id != 0 && what != NULL, -1); - - qd = (qq_data *) gc->proto_data; - purple_debug_info("QQ", "Send chat IM to %u, len %" G_GSIZE_FORMAT ":\n%s\n", id, strlen(what), what); - - /* qq_show_packet("chat IM UTF8", (guint8 *)what, strlen(what)); */ - - fmt = qq_im_fmt_new_by_purple(what); - is_smiley_none = qq_im_smiley_none(what); - - msg_stripped = purple_markup_strip_html(what); - g_return_val_if_fail(msg_stripped != NULL, -1); - /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ - - /* Check and valid utf8 string */ - msg_len = strlen(msg_stripped); - if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { - if (start_invalid > msg_stripped) { - tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); - g_free(msg_stripped); - msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); - g_free(tmp); - } else { - g_free(msg_stripped); - msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); - } - } - - is_smiley_none = qq_im_smiley_none(what); - segments = qq_im_get_segments(msg_stripped, is_smiley_none); - g_free(msg_stripped); - - if (segments == NULL) { - return -1; - } - - qd->send_im_id++; - fmt = qq_im_fmt_new_by_purple(what); - frag_count = g_slist_length(segments); - frag_index = 0; -/* - if (frag_count <= 1) { -*/ - for (it = segments; it; it = it->next) { - request_room_send_im(gc, id, fmt, (gchar *)it->data); - g_free(it->data); - } -/* - } else { - for (it = segments; it; it = it->next) { - request_room_send_im_ex(gc, id, fmt, (gchar *)it->data, - qd->send_im_id, frag_count, frag_index); - g_free(it->data); - frag_index++; - } - } -*/ - qq_im_fmt_free(fmt); - g_slist_free(segments); - return 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_im.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/** - * @file group_im.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_IM_H_ -#define _QQ_GROUP_IM_H_ - -#include -#include "connection.h" -#include "conversation.h" -#include "group.h" - -PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd); -void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd); - -void qq_room_got_chat_in(PurpleConnection *gc, - guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time); - -int qq_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags); -void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len); -void qq_process_room_send_im_ex(PurpleConnection *gc, guint8 *data, gint len); - -void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,392 +0,0 @@ -/** - * @file group_info.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" - -#include "char_conv.h" -#include "group_im.h" -#include "group_internal.h" -#include "group_info.h" -#include "buddy_list.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "utils.h" - -/* we check who needs to update member info every minutes - * this interval determines if their member info is outdated */ -#define QQ_GROUP_CHAT_REFRESH_NICKNAME_INTERNAL 180 - -static gboolean check_update_interval(qq_buddy_data *member) -{ - g_return_val_if_fail(member != NULL, FALSE); - return (member->nickname == NULL) || - (time(NULL) - member->last_update) > QQ_GROUP_CHAT_REFRESH_NICKNAME_INTERNAL; -} - -/* this is done when we receive the reply to get_online_members sub_cmd - * all member are set offline, and then only those in reply packets are online */ -static void set_all_offline(qq_room_data *rmd) -{ - GList *list; - qq_buddy_data *bd; - g_return_if_fail(rmd != NULL); - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - bd->status = QQ_BUDDY_CHANGE_TO_OFFLINE; - list = list->next; - } -} - -/* send packet to get info for each group member */ -gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class) -{ - guint8 *raw_data; - gint bytes, num; - GList *list; - qq_room_data *rmd; - qq_buddy_data *bd; - - g_return_val_if_fail(room_id > 0, 0); - - rmd = qq_room_data_find(gc, room_id); - g_return_val_if_fail(rmd != NULL, 0); - - for (num = 0, list = rmd->members; list != NULL; list = list->next) { - bd = (qq_buddy_data *) list->data; - if (check_update_interval(bd)) - num++; - } - - if (num <= 0) { - purple_debug_info("QQ", "No group member info needs to be updated now.\n"); - return 0; - } - - raw_data = g_newa(guint8, 4 * num); - - bytes = 0; - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (check_update_interval(bd)) - bytes += qq_put32(raw_data + bytes, bd->uid); - list = list->next; - } - - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_BUDDIES, rmd->id, raw_data, bytes, - update_class, 0); - return num; -} - -static gchar *get_role_desc(qq_room_role role) -{ - const char *role_desc; - switch (role) { - case QQ_ROOM_ROLE_NO: - role_desc = _("Not member"); - break; - case QQ_ROOM_ROLE_YES: - role_desc = _("Member"); - break; - case QQ_ROOM_ROLE_REQUESTING: - role_desc = _("Requesting"); - break; - case QQ_ROOM_ROLE_ADMIN: - role_desc = _("Admin"); - break; - default: - role_desc = _("Unknown"); - } - - return g_strdup(role_desc); -} - -static void room_info_display(PurpleConnection *gc, qq_room_data *rmd) -{ - PurpleNotifyUserInfo *room_info; - gchar *utf8_value; - - g_return_if_fail(rmd != NULL && rmd->id > 0); - - room_info = purple_notify_user_info_new(); - - purple_notify_user_info_add_pair(room_info, _("Title"), rmd->title_utf8); - purple_notify_user_info_add_pair(room_info, _("Notice"), rmd->notice_utf8); - purple_notify_user_info_add_pair(room_info, _("Detail"), rmd->desc_utf8); - - purple_notify_user_info_add_section_break(room_info); - - utf8_value = g_strdup_printf(("%u"), rmd->creator_uid); - purple_notify_user_info_add_pair(room_info, _("Creator"), utf8_value); - g_free(utf8_value); - - utf8_value = get_role_desc(rmd->my_role); - purple_notify_user_info_add_pair(room_info, _("About me"), utf8_value); - g_free(utf8_value); - - utf8_value = g_strdup_printf(("%d"), rmd->category); - purple_notify_user_info_add_pair(room_info, _("Category"), utf8_value); - g_free(utf8_value); - - utf8_value = g_strdup_printf(("%d"), rmd->auth_type); - purple_notify_user_info_add_pair(room_info, _("Authorize"), utf8_value); - g_free(utf8_value); - - utf8_value = g_strdup_printf(("%u"), rmd->ext_id); - purple_notify_userinfo(gc, utf8_value, room_info, NULL, NULL); - g_free(utf8_value); - - purple_notify_user_info_destroy(room_info); -} - -void qq_process_room_cmd_get_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc) -{ - qq_data *qd; - qq_room_data *rmd; - qq_buddy_data *bd; - PurpleChat *chat; - PurpleConversation *conv; - guint8 organization, role; - guint16 unknown, max_members; - guint32 member_uid, id, ext_id; - guint32 unknown4; - guint8 unknown1; - gint bytes, num; - gchar *notice; - gchar *topic_utf8; - - g_return_if_fail(data != NULL && data_len > 0); - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Room Info", data, data_len); */ - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - bytes += qq_get32(&ext_id, data + bytes); - g_return_if_fail(ext_id > 0); - - chat = qq_room_find_or_new(gc, id, ext_id); - g_return_if_fail(chat != NULL); - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - bytes += qq_get8(&(rmd->type8), data + bytes); - bytes += qq_get32(&unknown4, data + bytes); /* unknown 4 bytes */ - bytes += qq_get32(&(rmd->creator_uid), data + bytes); - bytes += qq_get8(&(rmd->auth_type), data + bytes); - bytes += qq_get32(&unknown4, data + bytes); /* oldCategory */ - bytes += qq_get16(&unknown, data + bytes); - bytes += qq_get32(&(rmd->category), data + bytes); - bytes += qq_get16(&max_members, data + bytes); - bytes += qq_get8(&unknown1, data + bytes); - /* the following, while Eva: - * 4(unk), 4(verID), 1(nameLen), nameLen(qunNameContent), 1(0x00), - * 2(qunNoticeLen), qunNoticeLen(qunNoticeContent, 1(qunDescLen), - * qunDestLen(qunDestcontent)) */ - bytes += qq_get8(&unknown1, data + bytes); - purple_debug_info("QQ", "type: %u creator: %u category: %u maxmembers: %u\n", - rmd->type8, rmd->creator_uid, rmd->category, max_members); - - if (qd->client_version >= 2007) { - /* skip 7 bytes unknow in qq2007 0x(00 00 01 00 00 00 fc)*/ - bytes += 7; - } - /* qq_show_packet("Room Info", data + bytes, data_len - bytes); */ - /* strlen + */ - bytes += qq_get_vstr(&(rmd->title_utf8), QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get16(&unknown, data + bytes); /* 0x0000 */ - bytes += qq_get_vstr(¬ice, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&(rmd->desc_utf8), QQ_CHARSET_DEFAULT, data + bytes); - - purple_debug_info("QQ", "room [%s] notice [%s] desc [%s] unknow 0x%04X\n", - rmd->title_utf8, notice, rmd->desc_utf8, unknown); - - num = 0; - /* now comes the member list separated by 0x00 */ - while (bytes < data_len) { - bytes += qq_get32(&member_uid, data + bytes); - num++; - bytes += qq_get8(&organization, data + bytes); - bytes += qq_get8(&role, data + bytes); - -#if 0 - if(organization != 0 || role != 0) { - purple_debug_info("QQ", "%u, organization=%d, role=%d\n", member_uid, organization, role); - } -#endif - - bd = qq_room_buddy_find_or_new(gc, rmd, member_uid); - if (bd != NULL) - bd->role = role; - } - if(bytes > data_len) { - purple_debug_error("QQ", - "group_cmd_get_group_info: Dangerous error! maybe protocol changed, notify me!"); - } - - purple_debug_info("QQ", "group \"%s\" has %d members\n", rmd->title_utf8, num); - - if (rmd->creator_uid == qd->uid) - rmd->my_role = QQ_ROOM_ROLE_ADMIN; - - /* filter \r\n in notice */ - qq_filter_str(notice); - rmd->notice_utf8 = strdup(notice); - g_free(notice); - - qq_room_update_chat_info(chat, rmd); - - if (action == QQ_ROOM_INFO_DISPLAY) { - room_info_display(gc, rmd); - } - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - rmd->title_utf8, purple_connection_get_account(gc)); - if(NULL == conv) { - purple_debug_warning("QQ", "Conversation \"%s\" is not opened\n", rmd->title_utf8); - return; - } - - topic_utf8 = g_strdup_printf("%u %s", rmd->ext_id, rmd->notice_utf8); - purple_debug_info("QQ", "Set chat topic to %s\n", topic_utf8); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); - g_free(topic_utf8); -} - -void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc) -{ - guint32 room_id, member_uid; - guint8 unknown; - gint bytes, num; - qq_room_data *rmd; - qq_buddy_data *bd; - - g_return_if_fail(data != NULL && len > 0); - - if (len <= 3) { - purple_debug_error("QQ", "Invalid group online member reply, discard it!\n"); - return; - } - - bytes = 0; - bytes += qq_get32(&room_id, data + bytes); - bytes += qq_get8(&unknown, data + bytes); /* 0x3c ?? */ - g_return_if_fail(room_id > 0); - - rmd = qq_room_data_find(gc, room_id); - if (rmd == NULL) { - purple_debug_error("QQ", "Can not info of room id [%u]\n", room_id); - return; - } - - /* set all offline first, then update those online */ - set_all_offline(rmd); - num = 0; - while (bytes < len) { - bytes += qq_get32(&member_uid, data + bytes); - num++; - bd = qq_room_buddy_find_or_new(gc, rmd, member_uid); - if (bd != NULL) - bd->status = QQ_BUDDY_ONLINE_NORMAL; - } - if(bytes > len) { - purple_debug_error("QQ", - "group_cmd_get_online_members: Dangerous error! maybe protocol changed, notify developers!"); - } - - purple_debug_info("QQ", "Group \"%s\" has %d online members\n", rmd->title_utf8, num); - qq_room_conv_set_onlines(gc, rmd); -} - -/* process the reply to get_members_info packet */ -void qq_process_room_cmd_get_buddies(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - gint num; - guint32 id, member_uid; - guint16 unknown; - qq_room_data *rmd; - qq_buddy_data *bd; - gchar *nick; - - g_return_if_fail(data != NULL && len > 0); - - /* qq_show_packet("qq_process_room_cmd_get_buddies", data, len); */ - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - num = 0; - /* now starts the member info, as get buddy list reply */ - while (bytes < len) { - bytes += qq_get32(&member_uid, data + bytes); - g_return_if_fail(member_uid > 0); - bd = qq_room_buddy_find_or_new(gc, rmd, member_uid); - g_return_if_fail(bd != NULL); - - num++; - bytes += qq_get16(&(bd->face), data + bytes); - bytes += qq_get8(&(bd->age), data + bytes); - bytes += qq_get8(&(bd->gender), data + bytes); - bytes += qq_get_vstr(&nick, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get16(&unknown, data + bytes); - bytes += qq_get8(&(bd->ext_flag), data + bytes); - bytes += qq_get8(&(bd->comm_flag), data + bytes); - - /* filter \r\n in nick */ - qq_filter_str(nick); - bd->nickname = g_strdup(nick); - g_free(nick); - -#if 0 - purple_debug_info("QQ", - "member [%09d]: ext_flag=0x%02x, comm_flag=0x%02x, nick=%s\n", - member_uid, bd->ext_flag, bd->comm_flag, bd->nickname); -#endif - - bd->last_update = time(NULL); - } - if (bytes > len) { - purple_debug_error("QQ", - "group_cmd_get_members_info: Dangerous error! maybe protocol changed, notify developers!"); - } - purple_debug_info("QQ", "Group \"%s\" got %d member info\n", rmd->title_utf8, num); - - rmd->is_got_buddies = TRUE; - qq_room_conv_set_onlines(gc, rmd); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_info.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/** - * @file group_info.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_INFO_H_ -#define _QQ_GROUP_INFO_H_ - -#include -#include "connection.h" -#include "group.h" - -enum { - QQ_ROOM_INFO_UPDATE_ONLY = 0, - QQ_ROOM_INFO_DISPLAY -}; - -gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class); - -void qq_process_room_cmd_get_info(guint8 *data, gint len, guint32 action, PurpleConnection *gc); -void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc); -void qq_process_room_cmd_get_buddies(guint8 *data, gint len, PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,434 +0,0 @@ -/** - * @file group_internal.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "blist.h" -#include "debug.h" - -#include "buddy_opt.h" -#include "group_internal.h" -#include "utils.h" - -static qq_room_data *room_data_new(guint32 id, guint32 ext_id, const gchar *title) -{ - qq_room_data *rmd; - - purple_debug_info("QQ", "Created room data: %s, ext id %u, id %u\n", - title == NULL ? "(NULL)" : title, - ext_id, id); - rmd = g_new0(qq_room_data, 1); - rmd->my_role = QQ_ROOM_ROLE_NO; - rmd->id = id; - rmd->ext_id = ext_id; - rmd->type8 = 0x01; /* assume permanent Qun */ - rmd->creator_uid = 10000; /* assume by QQ admin */ - rmd->category = 0x01; - rmd->auth_type = 0x02; /* assume need auth */ - rmd->title_utf8 = g_strdup(title == NULL ? "" : title); - rmd->desc_utf8 = g_strdup(""); - rmd->notice_utf8 = g_strdup(""); - rmd->members = NULL; - rmd->is_got_buddies = FALSE; - return rmd; -} - -/* create a qq_room_data from hashtable */ -static qq_room_data *room_data_new_by_hashtable(PurpleConnection *gc, GHashTable *data) -{ - qq_room_data *rmd; - guint32 id, ext_id; - gchar *value; - - value = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); - id = value ? strtoul(value, NULL, 10) : 0; - value = g_hash_table_lookup(data, QQ_ROOM_KEY_EXTERNAL_ID); - ext_id = value ? strtoul(value, NULL, 10) : 0; - value = g_hash_table_lookup(data, QQ_ROOM_KEY_TITLE_UTF8); - - rmd = room_data_new(id, ext_id, value); - rmd->my_role = QQ_ROOM_ROLE_YES; - return rmd; -} - -/* gracefully free all members in a room */ -static void room_buddies_free(qq_room_data *rmd) -{ - gint i; - GList *list; - qq_buddy_data *bd; - - g_return_if_fail(rmd != NULL); - i = 0; - while (NULL != (list = rmd->members)) { - bd = (qq_buddy_data *) list->data; - i++; - rmd->members = g_list_remove(rmd->members, bd); - qq_buddy_data_free(bd); - } - - rmd->members = NULL; -} - -/* gracefully free the memory for one qq_room_data */ -static void room_data_free(qq_room_data *rmd) -{ - g_return_if_fail(rmd != NULL); - room_buddies_free(rmd); - g_free(rmd->title_utf8); - g_free(rmd->desc_utf8); - g_free(rmd->notice_utf8); - g_free(rmd); -} - -void qq_room_update_chat_info(PurpleChat *chat, qq_room_data *rmd) -{ - GHashTable *components; - - if (rmd->title_utf8 != NULL && strlen(rmd->title_utf8) > 0) { - purple_blist_alias_chat(chat, rmd->title_utf8); - } - - components = purple_chat_get_components(chat); - - g_hash_table_replace(components, - g_strdup(QQ_ROOM_KEY_INTERNAL_ID), - g_strdup_printf("%u", rmd->id)); - g_hash_table_replace(components, - g_strdup(QQ_ROOM_KEY_EXTERNAL_ID), - g_strdup_printf("%u", rmd->ext_id)); - g_hash_table_replace(components, - g_strdup(QQ_ROOM_KEY_TITLE_UTF8), g_strdup(rmd->title_utf8)); -} - -static PurpleChat *chat_new(PurpleConnection *gc, qq_room_data *rmd) -{ - GHashTable *components; - PurpleGroup *g; - PurpleChat *chat; - - purple_debug_info("QQ", "Add new chat: id %u, ext id %u, title %s\n", - rmd->id, rmd->ext_id, - rmd->title_utf8 == NULL ? "(NULL)" : rmd->title_utf8); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, - g_strdup(QQ_ROOM_KEY_INTERNAL_ID), g_strdup_printf("%u", rmd->id)); - g_hash_table_insert(components, g_strdup(QQ_ROOM_KEY_EXTERNAL_ID), - g_strdup_printf("%u", rmd->ext_id)); - g_hash_table_insert(components, g_strdup(QQ_ROOM_KEY_TITLE_UTF8), g_strdup(rmd->title_utf8)); - - chat = purple_chat_new(purple_connection_get_account(gc), rmd->title_utf8, components); - g = qq_group_find_or_new(PURPLE_GROUP_QQ_QUN); - purple_blist_add_chat(chat, g, NULL); - - return chat; -} - -PurpleChat *qq_room_find_or_new(PurpleConnection *gc, guint32 id, guint32 ext_id) -{ - qq_data *qd; - qq_room_data *rmd; - PurpleChat *chat; - gchar *num_str; - - g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, NULL); - qd = (qq_data *) gc->proto_data; - - g_return_val_if_fail(id != 0 && ext_id != 0, NULL); - - purple_debug_info("QQ", "Find or add new room: id %u, ext id %u\n", id, ext_id); - - rmd = qq_room_data_find(gc, id); - if (rmd == NULL) { - rmd = room_data_new(id, ext_id, NULL); - g_return_val_if_fail(rmd != NULL, NULL); - rmd->my_role = QQ_ROOM_ROLE_YES; - qd->groups = g_list_append(qd->groups, rmd); - } - - num_str = g_strdup_printf("%u", ext_id); - chat = purple_blist_find_chat(purple_connection_get_account(gc), num_str); - g_free(num_str); - if (chat) { - return chat; - } - - return chat_new(gc, rmd); -} - -void qq_room_remove(PurpleConnection *gc, guint32 id) -{ - qq_data *qd; - PurpleChat *chat; - qq_room_data *rmd; - gchar *num_str; - guint32 ext_id; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Find and remove room data, id %u\n", id); - rmd = qq_room_data_find(gc, id); - g_return_if_fail (rmd != NULL); - - ext_id = rmd->ext_id; - qd->groups = g_list_remove(qd->groups, rmd); - room_data_free(rmd); - - purple_debug_info("QQ", "Find and remove chat, ext_id %u\n", ext_id); - num_str = g_strdup_printf("%u", ext_id); - chat = purple_blist_find_chat(purple_connection_get_account(gc), num_str); - g_free(num_str); - - g_return_if_fail (chat != NULL); - - purple_blist_remove_chat(chat); -} - -/* find a qq_buddy_data by uid, called by im.c */ -qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, guint32 uid) -{ - GList *list; - qq_buddy_data *bd; - g_return_val_if_fail(rmd != NULL && uid > 0, NULL); - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (bd->uid == uid) - return bd; - else - list = list->next; - } - - return NULL; -} - -/* remove a qq_buddy_data by uid, called by qq_group_opt.c */ -void qq_room_buddy_remove(qq_room_data *rmd, guint32 uid) -{ - GList *list; - qq_buddy_data *bd; - g_return_if_fail(rmd != NULL && uid > 0); - - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (bd->uid == uid) { - rmd->members = g_list_remove(rmd->members, bd); - return; - } else { - list = list->next; - } - } -} - -qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, guint32 member_uid) -{ - qq_buddy_data *member, *bd; - PurpleBuddy *buddy; - g_return_val_if_fail(rmd != NULL && member_uid > 0, NULL); - - member = qq_room_buddy_find(rmd, member_uid); - if (member == NULL) { /* first appear during my session */ - member = g_new0(qq_buddy_data, 1); - member->uid = member_uid; - buddy = purple_find_buddy(purple_connection_get_account(gc), uid_to_purple_name(member_uid)); - if (buddy != NULL) { - const gchar *alias = NULL; - - bd = purple_buddy_get_protocol_data(buddy); - if (bd != NULL && bd->nickname != NULL) - member->nickname = g_strdup(bd->nickname); - else if ((alias = purple_buddy_get_alias(buddy)) != NULL) - member->nickname = g_strdup(alias); - } - rmd->members = g_list_append(rmd->members, member); - } - - return member; -} - -qq_room_data *qq_room_data_find(PurpleConnection *gc, guint32 room_id) -{ - GList *list; - qq_room_data *rmd; - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - - if (qd->groups == NULL || room_id <= 0) - return 0; - - list = qd->groups; - while (list != NULL) { - rmd = (qq_room_data *) list->data; - if (rmd->id == room_id) { - return rmd; - } - list = list->next; - } - - return NULL; -} - -guint32 qq_room_get_next(PurpleConnection *gc, guint32 room_id) -{ - GList *list; - qq_room_data *rmd; - qq_data *qd; - gboolean is_find = FALSE; - - qd = (qq_data *) gc->proto_data; - - if (qd->groups == NULL) { - return 0; - } - - if (room_id <= 0) { - rmd = (qq_room_data *) qd->groups->data; - return rmd->id; - } - - list = qd->groups; - while (list != NULL) { - rmd = (qq_room_data *) list->data; - list = list->next; - if (rmd->id == room_id) { - is_find = TRUE; - break; - } - } - - g_return_val_if_fail(is_find, 0); - if (list == NULL) return 0; /* be the end */ - rmd = (qq_room_data *) list->data; - g_return_val_if_fail(rmd != NULL, 0); - return rmd->id; -} - -guint32 qq_room_get_next_conv(PurpleConnection *gc, guint32 room_id) -{ - GList *list; - qq_room_data *rmd; - qq_data *qd; - gboolean is_find; - - qd = (qq_data *) gc->proto_data; - - list = qd->groups; - if (room_id > 0) { - /* search next room */ - is_find = FALSE; - while (list != NULL) { - rmd = (qq_room_data *) list->data; - list = list->next; - if (rmd->id == room_id) { - is_find = TRUE; - break; - } - } - g_return_val_if_fail(is_find, 0); - } - - while (list != NULL) { - rmd = (qq_room_data *) list->data; - g_return_val_if_fail(rmd != NULL, 0); - - if (rmd->my_role == QQ_ROOM_ROLE_YES || rmd->my_role == QQ_ROOM_ROLE_ADMIN) { - if (NULL != purple_find_conversation_with_account( - PURPLE_CONV_TYPE_CHAT,rmd->title_utf8, purple_connection_get_account(gc))) { - /* In convseration*/ - return rmd->id; - } - } - list = list->next; - } - - return 0; -} - -/* this should be called upon signin, even when we did not open group chat window */ -void qq_room_data_initial(PurpleConnection *gc) -{ - PurpleAccount *account; - PurpleChat *chat; - PurpleGroup *purple_group; - PurpleBlistNode *node; - qq_data *qd; - qq_room_data *rmd; - gint count; - - account = purple_connection_get_account(gc); - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Initial QQ Qun configurations\n"); - purple_group = purple_find_group(PURPLE_GROUP_QQ_QUN); - if (purple_group == NULL) { - purple_debug_info("QQ", "We have no QQ Qun\n"); - return; - } - - count = 0; - for (node = purple_blist_node_get_first_child((PurpleBlistNode *)purple_group); - node != NULL; - node = purple_blist_node_get_sibling_next(node)) - { - if ( !PURPLE_BLIST_NODE_IS_CHAT(node)) { - continue; - } - /* got one */ - chat = (PurpleChat *) node; - if (account != purple_chat_get_account(chat)) /* not qq account*/ - continue; - - rmd = room_data_new_by_hashtable(gc, purple_chat_get_components(chat)); - qd->groups = g_list_append(qd->groups, rmd); - count++; - } - - purple_debug_info("QQ", "Load %d QQ Qun configurations\n", count); -} - -void qq_room_data_free_all(PurpleConnection *gc) -{ - qq_data *qd; - qq_room_data *rmd; - gint count; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - count = 0; - while (qd->groups != NULL) { - rmd = (qq_room_data *) qd->groups->data; - qd->groups = g_list_remove(qd->groups, rmd); - room_data_free(rmd); - count++; - } - - if (count > 0) { - purple_debug_info("QQ", "%d rooms are freed\n", count); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file group_internal.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_HASH_H_ -#define _QQ_GROUP_HASH_H_ - -#include -#include "group.h" - -#define QQ_ROOM_KEY_INTERNAL_ID "id" -#define QQ_ROOM_KEY_EXTERNAL_ID "ext_id" -#define QQ_ROOM_KEY_TITLE_UTF8 "title_utf8" - -PurpleChat *qq_room_find_or_new(PurpleConnection *gc, guint32 id, guint32 ext_id); -void qq_room_remove(PurpleConnection *gc, guint32 id); -void qq_room_update_chat_info(PurpleChat *chat, qq_room_data *rmd); - -qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, guint32 uid); -void qq_room_buddy_remove(qq_room_data *rmd, guint32 uid); -qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, guint32 member_uid); - -void qq_room_data_initial(PurpleConnection *gc); -void qq_room_data_free_all(PurpleConnection *gc); -qq_room_data *qq_room_data_find(PurpleConnection *gc, guint32 room_id); - -guint32 qq_room_get_next(PurpleConnection *gc, guint32 room_id); -guint32 qq_room_get_next_conv(PurpleConnection *gc, guint32 room_id); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,429 +0,0 @@ -/** - * @file group_join.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "debug.h" -#include "notify.h" -#include "request.h" -#include "server.h" - -#include "char_conv.h" -#include "im.h" -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "group_opt.h" -#include "group_im.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_process.h" - -enum { - QQ_ROOM_JOIN_OK = 0x01, - QQ_ROOM_JOIN_NEED_AUTH = 0x02, - QQ_ROOM_JOIN_DENIED = 0x03 -}; - -enum { - QQ_ROOM_SEARCH_TYPE_BY_ID = 0x01, - QQ_ROOM_SEARCH_TYPE_DEMO = 0x02 -}; - -static void group_quit_cb(qq_room_req *add_req) -{ - PurpleConnection *gc; - guint32 id; - qq_room_data *rmd; - - if (add_req->gc == NULL || add_req->id == 0) { - g_free(add_req); - return; - } - - gc = add_req->gc; - id = add_req->id; - - rmd = qq_room_data_find(gc, id); - if (rmd == NULL) { - g_free(add_req); - return; - } - - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_QUIT, rmd->id); - g_free(add_req); -} - -/* send packet to join a group without auth */ -void qq_request_room_join(PurpleConnection *gc, qq_room_data *rmd) -{ - g_return_if_fail(rmd != NULL); - - if (rmd->my_role == QQ_ROOM_ROLE_NO) { - rmd->my_role = QQ_ROOM_ROLE_REQUESTING; - } - - switch (rmd->auth_type) { - case QQ_ROOM_AUTH_TYPE_NO_AUTH: - case QQ_ROOM_AUTH_TYPE_NEED_AUTH: - break; - case QQ_ROOM_AUTH_TYPE_NO_ADD: - if (rmd->my_role == QQ_ROOM_ROLE_NO - && rmd->my_role == QQ_ROOM_ROLE_REQUESTING) { - purple_notify_warning(gc, NULL, _("The Qun does not allow others to join"), NULL); - return; - } - break; - default: - purple_debug_error("QQ", "Unknown room auth type: %d\n", rmd->auth_type); - break; - } - - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_JOIN, rmd->id); -} - -static void group_join_cb(qq_room_req *add_req, const gchar *reason_utf8) -{ - qq_room_data *rmd; - - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->id == 0) { - g_free(add_req); - return; - } - - rmd = qq_room_data_find(add_req->gc, add_req->id); - if (rmd == NULL) { - purple_debug_error("QQ", "Can not find room data of %u\n", add_req->id); - g_free(add_req); - return; - } - - qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_APPLY, 0, reason_utf8); - g_free(add_req); -} - -static void room_join_cancel_cb(qq_room_req *add_req, const gchar *msg) -{ - g_return_if_fail(add_req != NULL); - g_free(add_req); -} - -static void do_room_join_request(PurpleConnection *gc, qq_room_data *rmd) -{ - gchar *msg; - qq_room_req *add_req; - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "Room id %u needs authentication\n", rmd->id); - - msg = g_strdup_printf("QQ Qun %u needs authentication\n", rmd->ext_id); - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = rmd->id; - purple_request_input(gc, _("Join QQ Qun"), msg, - _("Input request here"), - _("Would you be my friend?"), TRUE, FALSE, NULL, - _("Send"), - G_CALLBACK(group_join_cb), - _("Cancel"), G_CALLBACK(room_join_cancel_cb), - purple_connection_get_account(gc), rmd->title_utf8, NULL, - add_req); - g_free(msg); -} - -void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd, - guint8 opt, guint32 uid, const gchar *reason_utf8) -{ - guint8 raw_data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(rmd != NULL); - - if (opt == QQ_ROOM_AUTH_REQUEST_APPLY) { - rmd->my_role = QQ_ROOM_ROLE_REQUESTING; - uid = 0; - } - - bytes = 0; - bytes += qq_put8(raw_data + bytes, opt); - bytes += qq_put32(raw_data + bytes, uid); - bytes += qq_put_vstr(raw_data + bytes, reason_utf8, QQ_CHARSET_DEFAULT); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_AUTH, rmd->id, raw_data, bytes); -} - -/* If comes here, cmd is OK already */ -void qq_process_group_cmd_exit_group(guint8 *data, gint len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - guint32 id; - - g_return_if_fail(data != NULL && len > 0); - qd = (qq_data *) gc->proto_data; - - if (len < 4) { - purple_debug_error("QQ", "Invalid exit group reply, expect %d bytes, read %d bytes\n", 4, len); - return; - } - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - - qq_room_remove(gc, id); -} - -/* Process the reply to group_auth subcmd */ -void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - qq_data *qd; - qq_room_data *rmd; - gchar *msg; - - g_return_if_fail(data != NULL && len > 0); - qd = (qq_data *) gc->proto_data; - - if (len < 4) { - purple_debug_error("QQ", - "Invalid join room reply, expect %d bytes, read %d bytes\n", 4, len); - return; - } - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - msg = g_strdup_printf(_("Successfully joined Qun %s (%u)"), rmd->title_utf8, rmd->ext_id); - qq_got_message(gc, msg); - g_free(msg); - } else { - qq_got_message(gc, _("Successfully joined Qun")); - } -} - -/* process group cmd reply "join group" */ -void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - guint8 reply; - qq_room_data *rmd; - gchar *msg; - - g_return_if_fail(data != NULL && len > 0); - - if (len < 5) { - purple_debug_error("QQ", - "Invalid join room reply, expect %d bytes, read %d bytes\n", 5, len); - return; - } - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - bytes += qq_get8(&reply, data + bytes); - - /* join group OK */ - rmd = qq_room_data_find(gc, id); - /* need to check if group is NULL or not. */ - g_return_if_fail(rmd != NULL); - switch (reply) { - case QQ_ROOM_JOIN_OK: - purple_debug_info("QQ", "Succeeded in joining group \"%s\"\n", rmd->title_utf8); - rmd->my_role = QQ_ROOM_ROLE_YES; - /* this must be shown before getting online members */ - qq_room_conv_open(gc, rmd); - break; - case QQ_ROOM_JOIN_NEED_AUTH: - purple_debug_info("QQ", - "Failed to join room ext id %u %s, needs authentication\n", - rmd->ext_id, rmd->title_utf8); - rmd->my_role = QQ_ROOM_ROLE_NO; - do_room_join_request(gc, rmd); - break; - case QQ_ROOM_JOIN_DENIED: - msg = g_strdup_printf(_("Qun %u denied from joining"), rmd->ext_id); - purple_notify_info(gc, _("QQ Qun Operation"), _("Failed:"), msg); - g_free(msg); - break; - default: - purple_debug_info("QQ", - "Failed to join room ext id %u %s, unknown reply: 0x%02x\n", - rmd->ext_id, rmd->title_utf8, reply); - - purple_notify_info(gc, _("QQ Qun Operation"), _("Failed:"), _("Join Qun, Unknown Reply")); - } -} - -/* Attempt to join a group without auth */ -void qq_group_join(PurpleConnection *gc, GHashTable *data) -{ - qq_data *qd; - gchar *ext_id_str; - gchar *id_str; - guint32 ext_id; - guint32 id; - qq_room_data *rmd; - - g_return_if_fail(data != NULL); - qd = (qq_data *) gc->proto_data; - - ext_id_str = g_hash_table_lookup(data, QQ_ROOM_KEY_EXTERNAL_ID); - id_str = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); - purple_debug_info("QQ", "Join room %s, extend id %s\n", id_str, ext_id_str); - - if (id_str != NULL) { - id = strtoul(id_str, NULL, 10); - if (id != 0) { - rmd = qq_room_data_find(gc, id); - if (rmd) { - qq_request_room_join(gc, rmd); - return; - } - } - } - - purple_debug_info("QQ", "Search and join extend id %s\n", ext_id_str); - if (ext_id_str == NULL) { - return; - } - ext_id = strtoul(ext_id_str, NULL, 10); - if (ext_id == 0) { - return; - } - - qq_request_room_search(gc, ext_id, QQ_ROOM_SEARCH_FOR_JOIN); -} - -void qq_room_quit(PurpleConnection *gc, guint32 room_id) -{ - qq_room_req *add_req; - - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = room_id; - - purple_request_action(gc, _("QQ Qun Operation"), - _("Quit Qun"), - _("Note, if you are the creator, \nthis operation will eventually remove this Qun."), - 1, - purple_connection_get_account(gc), NULL, NULL, - add_req, 2, _("Cancel"), - G_CALLBACK(room_join_cancel_cb), - _("Continue"), G_CALLBACK(group_quit_cb)); -} - -/* send packet to search for qq_group */ -void qq_request_room_search(PurpleConnection *gc, guint32 ext_id, int action) -{ - guint8 raw_data[16] = {0}; - gint bytes = 0; - guint8 type; - - purple_debug_info("QQ", "Search QQ Qun %u\n", ext_id); - type = (ext_id == 0x00000000) ? QQ_ROOM_SEARCH_TYPE_DEMO : QQ_ROOM_SEARCH_TYPE_BY_ID; - - bytes = 0; - bytes += qq_put8(raw_data + bytes, type); - bytes += qq_put32(raw_data + bytes, ext_id); - - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_SEARCH, 0, raw_data, bytes, 0, action); -} - -static void add_to_roomlist(qq_data *qd, qq_room_data *rmd) -{ - PurpleRoomlistRoom *room; - gchar field[11]; - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, rmd->title_utf8, NULL); - g_snprintf(field, sizeof(field), "%u", rmd->ext_id); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%u", rmd->creator_uid); - purple_roomlist_room_add_field(qd->roomlist, room, field); - purple_roomlist_room_add_field(qd->roomlist, room, rmd->desc_utf8); - g_snprintf(field, sizeof(field), "%u", rmd->id); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%d", rmd->type8); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%d", rmd->auth_type); - purple_roomlist_room_add_field(qd->roomlist, room, field); - g_snprintf(field, sizeof(field), "%d", rmd->category); - purple_roomlist_room_add_field(qd->roomlist, room, field); - purple_roomlist_room_add_field(qd->roomlist, room, rmd->title_utf8); - purple_roomlist_room_add(qd->roomlist, room); - - purple_roomlist_set_in_progress(qd->roomlist, FALSE); -} - -/* process group cmd reply "search group" */ -void qq_process_room_search(PurpleConnection *gc, guint8 *data, gint len, guint32 ship32) -{ - qq_data *qd; - qq_room_data rmd; - PurpleChat *chat; - gint bytes; - guint8 search_type; - guint16 unknown; - - g_return_if_fail(data != NULL && len > 0); - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&search_type, data + bytes); - - /* now it starts with group_info_entry */ - bytes += qq_get32(&(rmd.id), data + bytes); - bytes += qq_get32(&(rmd.ext_id), data + bytes); - bytes += qq_get8(&(rmd.type8), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get32(&(rmd.creator_uid), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get32(&(rmd.category), data + bytes); - bytes += qq_get_vstr(&(rmd.title_utf8), QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get16(&(unknown), data + bytes); - bytes += qq_get8(&(rmd.auth_type), data + bytes); - bytes += qq_get_vstr(&(rmd.desc_utf8), QQ_CHARSET_DEFAULT, data + bytes); - /* end of one qq_group */ - if(bytes != len) { - purple_debug_error("QQ", - "group_cmd_search_group: Dangerous error! maybe protocol changed, notify developers!"); - } - - if (ship32 == QQ_ROOM_SEARCH_FOR_JOIN) { - chat = qq_room_find_or_new(gc, rmd.id, rmd.ext_id); - g_return_if_fail(chat != NULL); - - qq_room_update_chat_info(chat, &rmd); - qq_request_room_join(gc, &rmd); - } else { - add_to_roomlist(qd, &rmd); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_join.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/** - * @file group_join.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_JOIN_H_ -#define _QQ_GROUP_JOIN_H_ - -#include -#include "connection.h" -#include "group.h" - -enum { - QQ_ROOM_AUTH_TYPE_NO_AUTH = 0x01, - QQ_ROOM_AUTH_TYPE_NEED_AUTH = 0x02, - QQ_ROOM_AUTH_TYPE_NO_ADD = 0x03 -}; - -enum { - QQ_ROOM_AUTH_REQUEST_APPLY = 0x01, - QQ_ROOM_AUTH_REQUEST_APPROVE = 0x02, - QQ_ROOM_AUTH_REQUEST_REJECT = 0x03 -}; - -enum { - QQ_ROOM_SEARCH_ONLY = 0, - QQ_ROOM_SEARCH_FOR_JOIN -}; - -void qq_request_room_search(PurpleConnection *gc, guint32 ext_id, int action); -void qq_process_room_search(PurpleConnection *gc, guint8 *data, gint len, guint32 ship32); - -void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd, guint8 opt, guint32 uid, const gchar *reason_utf8); -void qq_group_join(PurpleConnection *gc, GHashTable *data); -void qq_request_room_join(PurpleConnection *gc, qq_room_data *rmd); -void qq_room_quit(PurpleConnection *gc, guint32 room_id); -void qq_process_group_cmd_exit_group(guint8 *data, gint len, PurpleConnection *gc); -void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc); -void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,594 +0,0 @@ -/** - * @file group_opt.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "qq.h" - -#include "debug.h" -#include "notify.h" -#include "request.h" - -#include "buddy_info.h" -#include "char_conv.h" -#include "group_internal.h" -#include "group_info.h" -#include "group_join.h" -#include "group_im.h" -#include "group_opt.h" -#include "qq_define.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_process.h" -#include "utils.h" - -static int _compare_guint32(const void *a, - const void *b) -{ - const guint32 *x = a; - const guint32 *y = b; - return (*x - *y); -} - -static void _sort(guint32 *list) -{ - gint i; - for (i = 0; list[i] < 0xffffffff; i++) {; - } - qsort (list, i, sizeof (guint32), _compare_guint32); -} - -static void _qq_group_member_opt(PurpleConnection *gc, qq_room_data *rmd, gint operation, guint32 *members) -{ - guint8 *data; - gint i, count, data_len; - gint bytes; - g_return_if_fail(members != NULL); - - for (count = 0; members[count] != 0xffffffff; count++) {; - } - data_len = 6 + count * 4; - data = g_newa(guint8, data_len); - - bytes = 0; - bytes += qq_put8(data + bytes, operation); - for (i = 0; i < count; i++) - bytes += qq_put32(data + bytes, members[i]); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_MEMBER_OPT, rmd->id, data, bytes); -} - -static void room_req_cancel_cb(qq_room_req *add_req) -{ - if (add_req != NULL) - g_free(add_req); -} - -static void member_join_authorize_cb(gpointer data) -{ - qq_room_req *add_req = (qq_room_req *)data; - qq_room_data *rmd; - g_return_if_fail(add_req != NULL && add_req->gc != NULL); - g_return_if_fail(add_req->id > 0 && add_req->member > 0); - rmd = qq_room_data_find(add_req->gc, add_req->id); - g_return_if_fail(rmd != NULL); - - qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, add_req->member, ""); - qq_room_buddy_find_or_new(add_req->gc, rmd, add_req->member); - g_free(add_req); -} - -static void member_join_deny_reason_cb(qq_room_req *add_req, gchar *msg_utf8) -{ - qq_room_data *rmd; - g_return_if_fail(add_req != NULL && add_req->gc != NULL); - g_return_if_fail(add_req->id > 0 && add_req->member > 0); - rmd = qq_room_data_find(add_req->gc, add_req->id); - g_return_if_fail(rmd != NULL); - qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_REJECT, add_req->member, msg_utf8); - g_free(add_req); -} - -static void member_join_deny_noreason_cb(qq_room_req *add_req, gchar *msg_utf8) -{ - member_join_deny_reason_cb(add_req, NULL); -} - -static void member_join_deny_cb(gpointer data) -{ - qq_room_req *add_req = (qq_room_req *)data; - gchar *who; - g_return_if_fail(add_req != NULL && add_req->gc != NULL); - g_return_if_fail(add_req->id > 0 && add_req->member > 0); - - who = uid_to_purple_name(add_req->member); - purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), - NULL, _("Sorry, you are not our style"), TRUE, FALSE, NULL, - _("OK"), G_CALLBACK(member_join_deny_reason_cb), - _("Cancel"), G_CALLBACK(member_join_deny_noreason_cb), - purple_connection_get_account(add_req->gc), who, NULL, - add_req); - g_free(who); -} - -void qq_group_modify_members(PurpleConnection *gc, qq_room_data *rmd, guint32 *new_members) -{ - guint32 *old_members, *del_members, *add_members; - qq_buddy_data *bd; - qq_data *qd; - gint i = 0, old = 0, new = 0, del = 0, add = 0; - GList *list; - - g_return_if_fail(rmd != NULL); - qd = (qq_data *) gc->proto_data; - if (new_members[0] == 0xffffffff) - return; - - old_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - del_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - add_members = g_newa(guint32, QQ_QUN_MEMBER_MAX); - - /* construct the old member list */ - list = rmd->members; - while (list != NULL) { - bd = (qq_buddy_data *) list->data; - if (bd != NULL) - old_members[i++] = bd->uid; - list = list->next; - } - old_members[i] = 0xffffffff; /* this is the end */ - - /* sort to speed up making del_members and add_members list */ - _sort(old_members); - _sort(new_members); - - for (old = 0, new = 0; old_members[old] < 0xffffffff || new_members[new] < 0xffffffff;) { - if (old_members[old] > new_members[new]) { - add_members[add++] = new_members[new++]; - } else if (old_members[old] < new_members[new]) { - del_members[del++] = old_members[old++]; - } else { - if (old_members[old] < 0xffffffff) - old++; - if (new_members[new] < 0xffffffff) - new++; - } - } - del_members[del] = add_members[add] = 0xffffffff; - - for (i = 0; i < del; i++) - qq_room_buddy_remove(rmd, del_members[i]); - for (i = 0; i < add; i++) - qq_room_buddy_find_or_new(gc, rmd, add_members[i]); - - if (del > 0) - _qq_group_member_opt(gc, rmd, QQ_ROOM_MEMBER_DEL, del_members); - if (add > 0) - _qq_group_member_opt(gc, rmd, QQ_ROOM_MEMBER_ADD, add_members); -} - -void qq_group_process_modify_members_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - time_t now = time(NULL); - qq_room_data *rmd; - g_return_if_fail(data != NULL); - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - /* we should have its info locally */ - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "Succeed in modify members for room %u\n", rmd->ext_id); - - qq_room_got_chat_in(gc, id, 0, _("Successfully changed Qun members"), now); -} - -void qq_room_change_info(PurpleConnection *gc, qq_room_data *rmd) -{ - guint8 data[MAX_PACKET_SIZE - 16]; - gint bytes; - - g_return_if_fail(rmd != NULL); - - bytes = 0; - /* 005-005 */ - bytes += qq_put8(data + bytes, 0x01); - /* 006-006 */ - bytes += qq_put8(data + bytes, rmd->auth_type); - /* 007-008 */ - bytes += qq_put16(data + bytes, 0x0000); - /* 009-010 */ - bytes += qq_put16(data + bytes, rmd->category); - - bytes += qq_put_vstr(data + bytes, rmd->title_utf8, QQ_CHARSET_DEFAULT); - - bytes += qq_put16(data + bytes, 0x0000); - - bytes += qq_put_vstr(data + bytes, rmd->notice_utf8, QQ_CHARSET_DEFAULT); - bytes += qq_put_vstr(data + bytes, rmd->desc_utf8, QQ_CHARSET_DEFAULT); - - qq_send_room_cmd(gc, QQ_ROOM_CMD_CHANGE_INFO, rmd->id, data, bytes); -} - -void qq_group_process_modify_info_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - time_t now = time(NULL); - - g_return_if_fail(data != NULL); - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - purple_debug_info("QQ", "Successfully modified room info of %u\n", id); - - qq_room_got_chat_in(gc, id, 0, _("Successfully changed Qun information"), now); -} - -/* we create a very simple room first, and then let the user to modify */ -void qq_create_room(PurpleConnection *gc, const gchar *name) -{ - guint8 *data; - gint data_len; - gint bytes; - qq_data *qd; - g_return_if_fail(name != NULL); - - qd = (qq_data *) gc->proto_data; - - data_len = 64 + strlen(name); - data = g_newa(guint8, data_len); - - bytes = 0; - /* we create the simpleset group, only group name is given */ - /* 001 */ - bytes += qq_put8(data + bytes, QQ_ROOM_TYPE_PERMANENT); - /* 002 */ - bytes += qq_put8(data + bytes, QQ_ROOM_AUTH_TYPE_NEED_AUTH); - /* 003-004 */ - bytes += qq_put16(data + bytes, 0x0000); - /* 005-006 */ - bytes += qq_put16(data + bytes, 0x0003); - /* 007 */ - bytes += qq_put8(data + bytes, strlen(name)); - bytes += qq_putdata(data + bytes, (guint8 *) name, strlen(name)); - bytes += qq_put16(data + bytes, 0x0000); - bytes += qq_put8(data + bytes, 0x00); /* no group notice */ - bytes += qq_put8(data + bytes, 0x00); /* no group desc */ - bytes += qq_put32(data + bytes, qd->uid); /* I am member of coz */ - - if (bytes > data_len) { - purple_debug_error("QQ", - "Overflow in qq_room_create, max %d bytes, now %d bytes\n", - data_len, bytes); - return; - } - qq_send_room_cmd_noid(gc, QQ_ROOM_CMD_CREATE, data, bytes); -} - -static void room_create_cb(qq_room_req *add_req) -{ - qq_room_data *rmd; - g_return_if_fail(add_req != NULL); - if (add_req->gc == NULL || add_req->id == 0) { - g_free(add_req); - return; - } - - rmd = qq_room_data_find(add_req->gc, add_req->id); - if (rmd == NULL) { - g_free(add_req); - return; - } - - /* TODO insert UI code here */ - /* qq_group_detail_window_show(g->gc, rmd); */ - g_free(add_req); -} - -void qq_group_process_create_group_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id, ext_id; - qq_room_data *rmd; - qq_room_req *add_req; - qq_data *qd; - - g_return_if_fail(data != NULL); - g_return_if_fail(gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - bytes += qq_get32(&ext_id, data + bytes); - g_return_if_fail(id > 0 && ext_id); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - rmd->my_role = QQ_ROOM_ROLE_ADMIN; - rmd->creator_uid = qd->uid; - - qq_send_room_cmd_only(gc, QQ_ROOM_CMD_ACTIVATE, id); - qq_update_room(gc, 0, rmd->id); - - purple_debug_info("QQ", "Succeed in create Qun, ext id %u\n", rmd->ext_id); - - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = id; - - purple_request_action(gc, _("QQ Qun Operation"), - _("You have successfully created a Qun"), - _("Would you like to set up detailed information now?"), - 1, - purple_connection_get_account(gc), NULL, NULL, - add_req, 2, - _("Setup"), G_CALLBACK(room_create_cb), - _("Cancel"), G_CALLBACK(room_req_cancel_cb)); -} - -void qq_group_process_activate_group_reply(guint8 *data, gint len, PurpleConnection *gc) -{ - gint bytes; - guint32 id; - qq_room_data *rmd; - g_return_if_fail(data != NULL); - - bytes = 0; - bytes += qq_get32(&id, data + bytes); - g_return_if_fail(id > 0); - - /* we should have its info locally */ - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - purple_debug_info("QQ", "Succeed in activate Qun %u\n", rmd->ext_id); -} - -void qq_group_manage_group(PurpleConnection *gc, GHashTable *data) -{ - gchar *id_ptr; - guint32 id; - qq_room_data *rmd; - - g_return_if_fail(data != NULL); - - id_ptr = g_hash_table_lookup(data, QQ_ROOM_KEY_INTERNAL_ID); - id = strtoul(id_ptr, NULL, 10); - g_return_if_fail(id > 0); - - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - /* XXX insert UI code here */ - /* qq_group_detail_window_show(gc, rmd); */ -} - -/* receive an application to join the group */ -void qq_process_room_buddy_request_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, member_id; - guint8 type8; - gchar *msg, *reason; - qq_room_req *add_req; - gchar *who; - gint bytes = 0; - qq_room_data *rmd; - time_t now = time(NULL); - - g_return_if_fail(id > 0 && data != NULL && len > 0); - - /* FIXME: check length here */ - - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&member_id, data + bytes); - - g_return_if_fail(ext_id > 0 && member_id > 0); - - bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - - purple_debug_info("QQ", "%u requested to join room, ext id %u\n", member_id, ext_id); - - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - if (qq_room_buddy_find(rmd, member_id)) { - purple_debug_info("QQ", "Approve join, buddy joined before\n"); - msg = g_strdup_printf(_("%u requested to join Qun %u for %s"), - member_id, ext_id, reason); - qq_room_got_chat_in(gc, id, 0, msg, now); - qq_send_cmd_group_auth(gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, member_id, ""); - g_free(msg); - g_free(reason); - return; - } - - if (purple_prefs_get_bool("/plugins/prpl/qq/auto_get_authorize_info")) { - qq_request_buddy_info(gc, member_id, 0, QQ_BUDDY_INFO_DISPLAY); - } - who = uid_to_purple_name(member_id); - msg = g_strdup_printf(_("%u request to join Qun %u"), member_id, ext_id); - - add_req = g_new0(qq_room_req, 1); - add_req->gc = gc; - add_req->id = id; - add_req->member = member_id; - - purple_request_action(gc, _("QQ Qun Operation"), - msg, reason, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), who, NULL, - add_req, 2, - _("Deny"), G_CALLBACK(member_join_deny_cb), - _("Authorize"), G_CALLBACK(member_join_authorize_cb)); - - g_free(who); - g_free(msg); - g_free(reason); -} - -/* the request to join a group is rejected */ -void qq_process_room_buddy_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, admin_uid; - guint8 type8; - gchar *msg, *reason; - qq_room_data *rmd; - gint bytes; - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&admin_uid, data + bytes); - - g_return_if_fail(ext_id > 0 && admin_uid > 0); - - bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - - msg = g_strdup_printf - (_("Failed to join Qun %u, operated by admin %u"), ext_id, admin_uid); - - purple_notify_warning(gc, _("QQ Qun Operation"), msg, reason); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - rmd->my_role = QQ_ROOM_ROLE_NO; - } - - g_free(msg); - g_free(reason); -} - -/* the request to join a group is approved */ -void qq_process_room_buddy_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, admin_uid; - guint8 type8; - gchar *msg, *reason; - qq_room_data *rmd; - gint bytes; - time_t now; - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&admin_uid, data + bytes); - - g_return_if_fail(ext_id > 0 && admin_uid > 0); - /* it is also a "无" here, so do not display */ - bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - rmd->my_role = QQ_ROOM_ROLE_YES; - } - - msg = g_strdup_printf(_("Joining Qun %u is approved by admin %u for %s"), - ext_id, admin_uid, reason); - now = time(NULL); - qq_room_got_chat_in(gc, id, 0, msg, now); - - g_free(msg); - g_free(reason); -} - -/* process the packet when removed from a group */ -void qq_process_room_buddy_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, uid; - guint8 type8; - gchar *msg; - qq_room_data *rmd; - gint bytes = 0; - time_t now = time(NULL); - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&uid, data + bytes); - - g_return_if_fail(ext_id > 0 && uid > 0); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - if (rmd != NULL) { - rmd->my_role = QQ_ROOM_ROLE_NO; - } - - msg = g_strdup_printf(_("Removed buddy %u."), uid); - qq_room_got_chat_in(gc, id, 0, msg, now); - g_free(msg); -} - -/* process the packet when added to a group */ -void qq_process_room_buddy_joined(guint8 *data, gint len, guint32 id, PurpleConnection *gc) -{ - guint32 ext_id, uid; - guint8 type8; - qq_room_data *rmd; - gint bytes; - gchar *msg; - time_t now = time(NULL); - - g_return_if_fail(data != NULL && len > 0); - - /* FIXME: check length here */ - bytes = 0; - bytes += qq_get32(&ext_id, data + bytes); - bytes += qq_get8(&type8, data + bytes); - bytes += qq_get32(&uid, data + bytes); - - g_return_if_fail(ext_id > 0 && id > 0); - - qq_room_find_or_new(gc, id, ext_id); - rmd = qq_room_data_find(gc, id); - g_return_if_fail(rmd != NULL); - - rmd->my_role = QQ_ROOM_ROLE_YES; - - qq_update_room(gc, 0, rmd->id); - - msg = g_strdup_printf(_("New buddy %u joined."), uid); - qq_room_got_chat_in(gc, id, 0, msg, now); - g_free(msg); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/group_opt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/** - * @file group_opt.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_GROUP_OPT_H_ -#define _QQ_GROUP_OPT_H_ - -#include -#include "connection.h" -#include "group.h" - -#define QQ_QUN_MEMBER_MAX 80 /* max number of the group */ - -typedef struct _qq_room_req { - PurpleConnection *gc; - guint32 id; - guint32 member; -} qq_room_req; - -enum { - QQ_ROOM_TYPE_PERMANENT = 0x01, - QQ_ROOM_TYPE_TEMPORARY -}; - -enum { - QQ_ROOM_MEMBER_ADD = 0x01, - QQ_ROOM_MEMBER_DEL -}; - -void qq_group_modify_members(PurpleConnection *gc, qq_room_data *rmd, guint32 *new_members); -void qq_room_change_info(PurpleConnection *gc, qq_room_data *rmd); - -void qq_create_room(PurpleConnection *gc, const gchar *name); -void qq_group_process_modify_info_reply(guint8 *data, gint len, PurpleConnection *gc); -void qq_group_process_modify_members_reply(guint8 *data, gint len, PurpleConnection *gc); -void qq_group_manage_group(PurpleConnection *gc, GHashTable *data); -void qq_group_process_activate_group_reply(guint8 *data, gint len, PurpleConnection *gc); -void qq_group_process_create_group_reply(guint8 *data, gint len, PurpleConnection *gc); - -void qq_process_room_buddy_request_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -void qq_process_room_buddy_joined(guint8 *data, gint len, guint32 id, PurpleConnection *gc); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1320 +0,0 @@ -/** - * @file im.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "conversation.h" -#include "debug.h" -#include "internal.h" -#include "notify.h" -#include "server.h" -#include "util.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "char_conv.h" -#include "qq_define.h" -#include "im.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "send_file.h" -#include "utils.h" - -#define QQ_MSG_IM_MAX 700 /* max length of IM */ - -enum { - QQ_IM_TEXT = 0x01, - QQ_IM_AUTO_REPLY = 0x02 -}; - -enum -{ - QQ_NORMAL_IM_TEXT = 0x000b, - QQ_NORMAL_IM_FILE_REQUEST_TCP = 0x0001, - QQ_NORMAL_IM_FILE_APPROVE_TCP = 0x0003, - QQ_NORMAL_IM_FILE_REJECT_TCP = 0x0005, - QQ_NORMAL_IM_FILE_REQUEST_UDP = 0x0035, - QQ_NORMAL_IM_FILE_APPROVE_UDP = 0x0037, - QQ_NORMAL_IM_FILE_REJECT_UDP = 0x0039, - QQ_NORMAL_IM_FILE_NOTIFY = 0x003b, - QQ_NORMAL_IM_FILE_PASV = 0x003f, /* are you behind a firewall? */ - QQ_NORMAL_IM_FILE_CANCEL = 0x0049, - QQ_NORMAL_IM_FILE_EX_REQUEST_UDP = 0x81, - QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT = 0x83, - QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL = 0x85, - QQ_NORMAL_IM_FILE_EX_NOTIFY_IP = 0x87 -}; - -typedef struct _qq_im_header qq_im_header; -struct _qq_im_header { - /* this is the common part of normal_text */ - guint16 version_from; - guint32 uid_from; - guint32 uid_to; - guint8 session_md5[QQ_KEY_LENGTH]; - guint16 im_type; -}; - -/* read the common parts of the normal_im, - * returns the bytes read if succeed, or -1 if there is any error */ -static gint get_im_header(qq_im_header *im_header, guint8 *data, gint len) -{ - gint bytes; - g_return_val_if_fail(data != NULL && len > 0, -1); - - bytes = 0; - bytes += qq_get16(&(im_header->version_from), data + bytes); - bytes += qq_get32(&(im_header->uid_from), data + bytes); - bytes += qq_get32(&(im_header->uid_to), data + bytes); - bytes += qq_getdata(im_header->session_md5, QQ_KEY_LENGTH, data + bytes); - bytes += qq_get16(&(im_header->im_type), data + bytes); - return bytes; -} - -typedef struct _qq_emoticon qq_emoticon; -struct _qq_emoticon { - guint8 symbol; - gchar *name; -}; - -static gboolean emoticons_is_sorted = FALSE; -/* Map for purple smiley convert to qq, need qsort */ -static qq_emoticon emoticons_std[] = { - {0x4f, "/:)"}, {0x4f, "/wx"}, {0x4f, "/small_smile"}, - {0x42, "/:~"}, {0x42, "/pz"}, {0x42, "/curl_lip"}, - {0x43, "/:*"}, {0x43, "/se"}, {0x43, "/desire"}, - {0x44, "/:|"}, {0x44, "/fd"}, {0x44, "/dazed"}, - {0x45, "/8-)"}, {0x45, "/dy"}, {0x45, "/revel"}, - {0x46, "/:<"}, {0x46, "/ll"}, {0x46, "/cry"}, - {0x47, "/:$"}, {0x47, "/hx"}, {0x47, "/bashful"}, - {0x48, "/:x"}, {0x48, "/bz"}, {0x48, "/shut_mouth"}, - {0x8f, "/|-)"}, {0x8f, "/kun"}, {0x8f, "/sleepy"}, - {0x49, "/:z"}, {0x49, "/shui"}, {0x49, "/sleep"}, /* after sleepy */ - {0x4a, "/:'"}, {0x4a, "/dk"}, {0x4a, "/weep"}, - {0x4b, "/:-|"}, {0x4b, "/gg"}, {0x4b, "/embarassed"}, - {0x4c, "/:@"}, {0x4c, "/fn"}, {0x4c, "/pissed_off"}, - {0x4d, "/:P"}, {0x4d, "/tp"}, {0x4d, "/act_up"}, - {0x4e, "/:D"}, {0x4e, "/cy"}, {0x4e, "/toothy_smile"}, - {0x41, "/:O"}, {0x41, "/jy"}, {0x41, "/surprised"}, - {0x73, "/:("}, {0x73, "/ng"}, {0x73, "/sad"}, - {0x74, "/:+"}, {0x74, "/kuk"}, {0x74, "/cool"}, - {0xa1, "/--b"}, {0xa1, "/lengh"}, - {0x76, "/:Q"}, {0x76, "/zk"}, {0x76, "/crazy"}, - {0x8a, "/;P"}, {0x8a, "/tx"}, {0x8a, "/titter"}, - {0x8b, "/;-D"}, {0x8b, "/ka"}, {0x8b, "/cute"}, - {0x8c, "/;d"}, {0x8c, "/by"}, {0x8c, "/disdain"}, - {0x8d, "/;o"}, {0x8d, "/am"}, {0x8d, "/arrogant"}, - {0x8e, "/:g"}, {0x8e, "/jie"}, {0x8e, "/starving"}, - {0x78, "/:!"}, {0x78, "/jk"}, {0x78, "/terror"}, - {0x79, "/:L"}, {0x79, "/lh"}, {0x79, "/sweat"}, - {0x7a, "/:>"}, {0x7a, "/hanx"}, {0x7a, "/smirk"}, - {0x7b, "/:;"}, {0x7b, "/db"}, {0x7b, "/soldier"}, - {0x90, "/;f"}, {0x90, "/fendou"}, {0x90, "/struggle"}, - {0x91, "/:-S"}, {0x91, "/zhm"}, {0x91, "/curse"}, - {0x92, "/?"}, {0x92, "/yiw"}, {0x92, "/question"}, - {0x93, "/;x"}, {0x93, "/xu"}, {0x93, "/shh"}, - {0x94, "/;@"}, {0x94, "/yun"}, {0x94, "/dizzy"}, - {0x95, "/:8"}, {0x95, "/zhem"}, {0x95, "/excrutiating"}, - {0x96, "/;!"}, {0x96, "/shuai"}, {0x96, "/freaked_out"}, - {0x97, "/!!!"}, {0x97, "/kl"}, {0x97, "/skeleton"}, - {0x98, "/xx"}, {0x98, "/qiao"}, {0x98, "/hammer"}, - {0x99, "/bye"}, {0x99, "/zj"}, {0x99, "/bye"}, - {0xa2, "/wipe"}, {0xa2, "/ch"}, - {0xa3, "/dig"}, {0xa3, "/kb"}, - {0xa4, "/handclap"},{0xa4, "/gz"}, - {0xa5, "/&-("}, {0xa5, "/qd"}, - {0xa6, "/B-)"}, {0xa6, "/huaix"}, - {0xa7, "/<@"}, {0xa7, "/zhh"}, - {0xa8, "/@>"}, {0xa8, "/yhh"}, - {0xa9, "/:-O"}, {0xa9, "/hq"}, - {0xaa, "/>-|"}, {0xaa, "/bs"}, - {0xab, "/P-("}, {0xab, "/wq"}, - {0xac, "/:'|"}, {0xac, "/kk"}, - {0xad, "/X-)"}, {0xad, "/yx"}, - {0xae, "/:*"}, {0xae, "/qq"}, - {0xaf, "/@x"}, {0xaf, "/xia"}, - {0xb0, "/8*"}, {0xb0, "/kel"}, - {0xb1, "/pd"}, {0xb1, "/cd"}, - {0x61, "/"}, {0x61, "/xig"}, {0x61, "/watermelon"}, - {0xb2, "/beer"}, {0xb2, "/pj"}, - {0xb3, "/basketb"}, {0xb3, "/lq"}, - {0xb4, "/oo"}, {0xb4, "/pp"}, - {0x80, "/coffee"}, {0x80, "/kf"}, - {0x81, "/eat"}, {0x81, "/fan"}, - {0x62, "/rose"}, {0x62, "/mg"}, - {0x63, "/fade"}, {0x63, "/dx"}, {0x63, "/wilt"}, - {0xb5, "/showlove"},{0xb5, "/sa"}, /* after sad */ - {0x65, "/heart"}, {0x65, "/xin"}, - {0x66, "/break"}, {0x66, "/xs"}, {0x66, "/broken_heart"}, - {0x67, "/cake"}, {0x67, "/dg"}, - {0x9c, "/li"}, {0x9c, "/shd"}, {0x9c, "/lightning"}, - {0x9d, "/bome"}, {0x9d, "/zhd"}, {0x9d, "/bomb"}, - {0x9e, "/kn"}, {0x9e, "/dao"}, {0x9e, "/knife"}, - {0x5e, "/footb"}, {0x5e, "/zq"}, {0x5e, "/soccer"}, - {0xb6, "/ladybug"}, {0xb6, "/pc"}, - {0x89, "/shit"}, {0x89, "/bb"}, - {0x6e, "/moon"}, {0x6e, "/yl"}, - {0x6b, "/sun"}, {0x6b, "/ty"}, - {0x68, "/gift"}, {0x68, "/lw"}, - {0x7f, "/hug"}, {0x7f, "/yb"}, - {0x6f, "/strong"}, {0x6f, "/qiang"}, {0x6f, "/thumbs_up"}, - {0x70, "/weak"}, {0x70, "/ruo"}, {0x70, "/thumbs_down"}, - {0x88, "/share"}, {0x88, "/ws"}, {0x88, "/handshake"}, - {0xb7, "/@)"}, {0xb7, "/bq"}, - {0xb8, "/jj"}, {0xb8, "/gy"}, - {0xb9, "/@@"}, {0xb9, "/qt"}, - {0xba, "/bad"}, {0xba, "/cj"}, - {0xbb, "/loveu"}, {0xbb, "/aini"}, - {0xbc, "/no"}, {0xbc, "/bu"}, - {0xbd, "/ok"}, {0xbd, "/hd"}, - {0x5c, "/love"}, {0x5c, "/aiq"}, /* after loveu */ - {0x56, "/"}, {0x56, "/fw"}, {0x56, "/blow_kiss"}, - {0x58, "/jump"}, {0x58, "/tiao"}, - {0x5a, "/shake"}, {0x5a, "/fad"}, /* after fade */ - {0x5b, "/"}, {0x5b, "/oh"}, {0x5b, "/angry"}, - {0xbe, "/circle"}, {0xbe, "/zhq"}, - {0xbf, "/kotow"}, {0xbf, "/kt"}, - {0xc0, "/turn"}, {0xc0, "/ht"}, - {0x77, "/:t"}, {0x77, "/tu"}, {0x77, "/vomit"}, /* after turn */ - {0xa0, "/victory"}, {0xa0, "/shl"}, {0xa0, "/v"}, /* end of v */ - {0xc1, "/skip"}, {0xc1, "/tsh"}, - {0xc2, "/oY"}, {0xc2, "/hsh"}, - {0xc3, "/#-O"}, {0xc3, "/jd"}, - {0xc4, "/hiphop"}, {0xc4, "/jw"}, - {0xc5, "/kiss"}, {0xc5, "/xw"}, - {0xc6, "/<&"}, {0xc6, "/ztj"}, - {0x7c, "/pig"}, {0x7c, "/zt"}, /* after ztj */ - {0xc7, "/&>"}, {0xc7, "/ytj"}, /* must be end of "&" */ - {0x75, "/:#"}, {0x75, "/feid"}, {0x75, "/SARS"}, - {0x59, "/go"}, {0x59, "/shan"}, - {0x57, "/find"}, {0x57, "/zhao"}, {0x57, "/search"}, - {0x55, "/&"}, {0x55, "/mm"}, {0x55, "/beautiful_eyebrows"}, - {0x7d, "/cat"}, {0x7d, "/maom"}, - {0x7e, "/dog"}, {0x7e, "/xg"}, - {0x9a, "/$"}, {0x9a, "/qianc"}, {0x9a, "/money"}, - {0x9b, "/(!)"}, {0x9b, "/dp"}, {0x9b, "/lightbulb"}, - {0x60, "/cup"}, {0x60, "/bei"}, - {0x9f, "/music"}, {0x9f, "/yy"}, - {0x82, "/pill"}, {0x82, "/yw"}, - {0x64, "/kiss"}, {0x64, "/wen"}, - {0x83, "/meeting"}, {0x83, "/hy"}, - {0x84, "/phone"}, {0x84, "/dh"}, - {0x85, "/time"}, {0x85, "/sj"}, - {0x86, "/email"}, {0x86, "/yj"}, - {0x87, "/tv"}, {0x87, "/ds"}, - {0x50, "/"}, {0x50, "/dd"}, - {0x51, "/"}, {0x51, "/mn"}, {0x51, "/beauty"}, - {0x52, "/"}, {0x52, "/hl"}, - {0x53, "/"}, {0x53, "/mamao"}, - {0x54, "/"}, {0x54, "/qz"}, {0x54, "/qq"}, - {0x5d, "/"}, {0x5d, "/bj"}, {0x5d, "/baijiu"}, - {0x5f, "/"}, {0x5f, "/qsh"}, {0x5f, "/soda"}, - {0x69, "/"}, {0x69, "/xy"}, {0x69, "/rain"}, - {0x6a, "/<~>"}, {0x6a, "/duoy"}, {0x6a, "/cloudy"}, - {0x6c, "/"}, {0x6c, "/xr"}, {0x6c, "/snowman"}, - {0x6d, "/<*>"}, {0x6d, "/xixing"}, {0x6d, "/star"}, /* after starving */ - {0x71, "/<00>"}, {0x71, "/nv"}, {0x71, "/woman"}, - {0x72, "/<11>"}, {0x72, "/nan"}, {0x72, "/man"}, - {0, NULL} -}; -gint emoticons_std_num = sizeof(emoticons_std) / sizeof(qq_emoticon) - 1; - -/* Map for purple smiley convert to qq, need qsort */ -static qq_emoticon emoticons_ext[] = { - {0xc7, "/&>"}, {0xa5, "/&-("}, - {0xbb, "/loveu"}, - {0x63, "/fade"}, - {0x8f, "/sleepy"}, {0x73, "/sad"}, {0x8e, "/starving"}, - {0xc0, "/turn"}, - {0xa0, "/victory"}, {0x77, "/vomit"}, - {0xc6, "/ztj"}, - {0, NULL} -}; -gint emoticons_ext_num = sizeof(emoticons_ext) / sizeof(qq_emoticon) - 1; - -/* Map for qq smiley convert to purple */ -static qq_emoticon emoticons_sym[] = { - {0x41, "/jy"}, - {0x42, "/pz"}, - {0x43, "/se"}, - {0x44, "/fd"}, - {0x45, "/dy"}, - {0x46, "/ll"}, - {0x47, "/hx"}, - {0x48, "/bz"}, - {0x49, "/shui"}, - {0x4a, "/dk"}, - {0x4b, "/gg"}, - {0x4c, "/fn"}, - {0x4d, "/tp"}, - {0x4e, "/cy"}, - {0x4f, "/wx"}, - {0x50, "/dd"}, - {0x51, "/mn"}, - {0x52, "/hl"}, - {0x53, "/mamao"}, - {0x54, "/qz"}, - {0x55, "/mm"}, - {0x56, "/fw"}, - {0x57, "/zhao"}, - {0x58, "/tiao"}, - {0x59, "/shan"}, - {0x5a, "/fad"}, - {0x5b, "/oh"}, - {0x5c, "/aiq"}, - {0x5d, "/bj"}, - {0x5e, "/zq"}, - {0x5f, "/qsh"}, - {0x60, "/bei"}, - {0x61, "/xig"}, - {0x62, "/mg"}, - {0x63, "/dx"}, - {0x64, "/wen"}, - {0x65, "/xin"}, - {0x66, "/xs"}, - {0x67, "/dg"}, - {0x68, "/lw"}, - {0x69, "/xy"}, - {0x6a, "/duoy"}, - {0x6b, "/ty"}, - {0x6c, "/xr"}, - {0x6d, "/xixing"}, - {0x6e, "/yl"}, - {0x6f, "/qiang"}, - {0x70, "/ruo"}, - {0x71, "/nv"}, - {0x72, "/nan"}, - {0x73, "/ng"}, - {0x74, "/kuk"}, - {0x75, "/feid"}, - {0x76, "/zk"}, - {0x77, "/tu"}, - {0x78, "/jk"}, - {0x79, "/sweat"}, - {0x7a, "/hanx"}, - {0x7b, "/db"}, - {0x7c, "/zt"}, - {0x7d, "/maom"}, - {0x7e, "/xg"}, - {0x7f, "/yb"}, - {0x80, "/coffee"}, - {0x81, "/fan"}, - {0x82, "/yw"}, - {0x83, "/hy"}, - {0x84, "/dh"}, - {0x85, "/sj"}, - {0x86, "/yj"}, - {0x87, "/ds"}, - {0x88, "/ws"}, - {0x89, "/bb"}, - {0x8a, "/tx"}, - {0x8b, "/ka"}, - {0x8c, "/by"}, - {0x8d, "/am"}, - {0x8e, "/jie"}, - {0x8f, "/kun"}, - {0x90, "/fendou"}, - {0x91, "/zhm"}, - {0x92, "/yiw"}, - {0x93, "/xu"}, - {0x94, "/yun"}, - {0x95, "/zhem"}, - {0x96, "/shuai"}, - {0x97, "/kl"}, - {0x98, "/qiao"}, - {0x99, "/zj"}, - {0x9a, "/qianc"}, - {0x9b, "/dp"}, - {0x9c, "/shd"}, - {0x9d, "/zhd"}, - {0x9e, "/dao"}, - {0x9f, "/yy"}, - {0xa0, "/shl"}, - {0xa1, "/lengh"}, - {0xa2, "/wipe"}, - {0xa3, "/kb"}, - {0xa4, "/gz"}, - {0xa5, "/qd"}, - {0xa6, "/huaix"}, - {0xa7, "/zhh"}, - {0xa8, "/yhh"}, - {0xa9, "/hq"}, - {0xaa, "/bs"}, - {0xab, "/wq"}, - {0xac, "/kk"}, - {0xad, "/yx"}, - {0xae, "/qq"}, - {0xaf, "/xia"}, - {0xb0, "/kel"}, - {0xb1, "/cd"}, - {0xb2, "/pj"}, - {0xb3, "/lq"}, - {0xb4, "/pp"}, - {0xb5, "/sa"}, - {0xb6, "/pc"}, - {0xb7, "/bq"}, - {0xb8, "/gy"}, - {0xb9, "/qt"}, - {0xba, "/cj"}, - {0xbb, "/aini"}, - {0xbc, "/bu"}, - {0xbd, "/hd"}, - {0xbe, "/zhq"}, - {0xbf, "/kt"}, - {0xc0, "/ht"}, - {0xc1, "/tsh"}, - {0xc2, "/hsh"}, - {0xc3, "/jd"}, - {0xc4, "/jw"}, - {0xc5, "/xw"}, - {0xc6, "/ztj"}, - {0xc7, "/ytj"}, - {0, NULL} -}; -gint emoticons_sym_num = sizeof(emoticons_sym) / sizeof(qq_emoticon) - 1;; - -static int emoticon_cmp(const void *k1, const void *k2) -{ - const qq_emoticon *e1 = (const qq_emoticon *) k1; - const qq_emoticon *e2 = (const qq_emoticon *) k2; - if (e1->symbol == 0) { - /* purple_debug_info("QQ", "emoticon_cmp len %d\n", strlen(e2->name)); */ - return strncmp(e1->name, e2->name, strlen(e2->name)); - } - if (e2->symbol == 0) { - /* purple_debug_info("QQ", "emoticon_cmp len %d\n", strlen(e1->name)); */ - return strncmp(e1->name, e2->name, strlen(e1->name)); - } - return strcmp(e1->name, e2->name); -} - -static void emoticon_try_sort() -{ - if (emoticons_is_sorted) - return; - - purple_debug_info("QQ", "qsort stand emoticons\n"); - qsort(emoticons_std, emoticons_std_num, sizeof(qq_emoticon), emoticon_cmp); - purple_debug_info("QQ", "qsort extend emoticons\n"); - qsort(emoticons_ext, emoticons_ext_num, sizeof(qq_emoticon), emoticon_cmp); - emoticons_is_sorted = TRUE; -} - -static qq_emoticon *emoticon_find(gchar *name) -{ - qq_emoticon *ret = NULL; - qq_emoticon key; - - g_return_val_if_fail(name != NULL, NULL); - emoticon_try_sort(); - - key.name = name; - key.symbol = 0; - - /* purple_debug_info("QQ", "bsearch emoticon %.20s\n", name); */ - ret = (qq_emoticon *)bsearch(&key, emoticons_ext, emoticons_ext_num, - sizeof(qq_emoticon), emoticon_cmp); - if (ret != NULL) { - return ret; - } - ret = (qq_emoticon *)bsearch(&key, emoticons_std, emoticons_std_num, - sizeof(qq_emoticon), emoticon_cmp); - return ret; -} - -static gchar *emoticon_get(guint8 symbol) -{ - g_return_val_if_fail(symbol >= emoticons_sym[0].symbol, NULL); - g_return_val_if_fail(symbol <= emoticons_sym[emoticons_sym_num - 2].symbol, NULL); - - return emoticons_sym[symbol - emoticons_sym[0].symbol].name; -} - -/* convert qq emote icon to purple sytle - Notice: text is in qq charset, GB18030 or utf8 */ -gchar *qq_emoticon_to_purple(gchar *text) -{ - gchar *ret; - GString *converted; - gchar **segments; - gboolean have_smiley; - gchar *purple_smiley; - gchar *cur; - guint8 symbol; - - /* qq_show_packet("text", (guint8 *)text, strlen(text)); */ - g_return_val_if_fail(text != NULL && strlen(text) != 0, g_strdup("")); - - while ((cur = strchr(text, '\x14')) != NULL) - *cur = '\x15'; - - segments = g_strsplit(text, "\x15", 0); - if(segments == NULL) { - return g_strdup(""); - } - - converted = g_string_new(""); - have_smiley = FALSE; - if (segments[0] != NULL) { - g_string_append(converted, segments[0]); - } else { - purple_debug_info("QQ", "segments[0] is NULL\n"); - } - while ((*(++segments)) != NULL) { - have_smiley = TRUE; - - cur = *segments; - if (cur == NULL) { - purple_debug_info("QQ", "current segment is NULL\n"); - break; - } - if (strlen(cur) == 0) { - purple_debug_info("QQ", "current segment length is 0\n"); - break; - } - symbol = (guint8)cur[0]; - - purple_smiley = emoticon_get(symbol); - if (purple_smiley == NULL) { - purple_debug_info("QQ", "Not found smiley of 0x%02X\n", symbol); - g_string_append(converted, ""); - } else { - purple_debug_info("QQ", "Found 0x%02X smiley is %s\n", symbol, purple_smiley); - g_string_append(converted, purple_smiley); - g_string_append(converted, cur + 1); - } - /* purple_debug_info("QQ", "next segment\n"); */ - } - - /* purple_debug_info("QQ", "end of convert\n"); */ - if (!have_smiley) { - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - ret = converted->str; - g_string_free(converted, FALSE); - return ret; -} - -void qq_im_fmt_free(qq_im_format *fmt) -{ - g_return_if_fail(fmt != NULL); - if (fmt->font) g_free(fmt->font); - g_free(fmt); -} - -qq_im_format *qq_im_fmt_new(void) -{ - qq_im_format *fmt; - const gchar simsun[] = { 0xcb, 0xce, 0xcc, 0xe5, 0}; /* simsun in Chinese */ - - fmt = g_new0(qq_im_format, 1); - memset(fmt, 0, sizeof(qq_im_format)); - fmt->font_len = strlen(simsun); - fmt->font = g_strdup(simsun); - fmt->attr = 10; - /* encoding, 0x8602=GB, 0x0000=EN, define BIG5 support here */ - fmt->charset = 0x8602; - - return fmt; -} - -qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg) -{ - qq_im_format *fmt; - const gchar *start, *end, *last; - GData *attribs; - gchar *tmp; - unsigned char *rgb; - - g_return_val_if_fail(msg != NULL, NULL); - - fmt = qq_im_fmt_new(); - - last = msg; - while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { - tmp = g_datalist_get_data(&attribs, "face"); - if (tmp && strlen(tmp) > 0) { - if (fmt->font) g_free(fmt->font); - fmt->font_len = strlen(tmp); - fmt->font = g_strdup(tmp); - } - - tmp = g_datalist_get_data(&attribs, "size"); - if (tmp) { - fmt->attr = atoi(tmp) * 3 + 1; - fmt->attr &= 0x0f; - } - - tmp = g_datalist_get_data(&attribs, "color"); - if (tmp && strlen(tmp) > 1) { - rgb = purple_base16_decode(tmp + 1, NULL); - g_memmove(fmt->rgb, rgb, 3); - g_free(rgb); - } - - g_datalist_clear(&attribs); - last = end + 1; - } - - if (purple_markup_find_tag("b", msg, &start, &end, &attribs)) { - fmt->attr |= 0x20; - g_datalist_clear(&attribs); - } - - if (purple_markup_find_tag("i", msg, &start, &end, &attribs)) { - fmt->attr |= 0x40; - g_datalist_clear(&attribs); - } - - if (purple_markup_find_tag("u", msg, &start, &end, &attribs)) { - fmt->attr |= 0x80; - g_datalist_clear(&attribs); - } - - return fmt; -} - -/* convert qq format to purple - Notice: text is in qq charset, GB18030 or utf8 */ -gchar *qq_im_fmt_to_purple(qq_im_format *fmt, gchar *text) -{ - GString *converted, *tmp; - gchar *ret; - gint size; - - converted = g_string_new(text); - tmp = g_string_new(""); - g_string_append_printf(tmp, "", - fmt->rgb[0], fmt->rgb[1], fmt->rgb[2]); - g_string_prepend(converted, tmp->str); - g_string_set_size(tmp, 0); - g_string_append(converted, ""); - - /* Fixme: - * check font face can be convert to utf8 or not? - * If failed, prepending font face cause msg display as "(NULL)" */ - if (fmt->font != NULL) { - g_string_append_printf(tmp, "", fmt->font); - g_string_prepend(converted, tmp->str); - g_string_set_size(tmp, 0); - g_string_append(converted, ""); - } - size = (fmt->attr & 0x1f) / 3; - if (size >= 0) { - g_string_append_printf(tmp, "", size); - g_string_prepend(converted, tmp->str); - g_string_set_size(tmp, 0); - g_string_append(converted, ""); - } - if (fmt->attr & 0x20) { - /* bold */ - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - if (fmt->attr & 0x40) { - /* italic */ - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - if (fmt->attr & 0x80) { - /* underline */ - g_string_prepend(converted, ""); - g_string_append(converted, ""); - } - - g_string_free(tmp, TRUE); - ret = converted->str; - g_string_free(converted, FALSE); - return ret; -} - -gint qq_put_im_tail(guint8 *buf, qq_im_format *fmt) -{ - gint bytes; - - g_return_val_if_fail(buf != NULL && fmt != NULL, 0); - - bytes = 0; - bytes += qq_put8(buf + bytes, 0); - bytes += qq_put8(buf + bytes, fmt->attr); - bytes += qq_putdata(buf + bytes, fmt->rgb, sizeof(fmt->rgb)); - bytes += qq_put8(buf + bytes, 0); - bytes += qq_put16(buf + bytes, fmt->charset); - if (fmt->font != NULL && fmt->font_len > 0) { - bytes += qq_putdata(buf + bytes, (guint8 *)fmt->font, fmt->font_len); - } else { - purple_debug_warning("QQ", "Font name is empty\n"); - } - bytes += qq_put8(buf + bytes, bytes + 1); - /* qq_show_packet("IM tail", buf, bytes); */ - return bytes; -} - -/* data includes text msg and font attr*/ -gint qq_get_im_tail(qq_im_format *fmt, guint8 *data, gint data_len) -{ - gint bytes, text_len; - guint8 tail_len; - guint8 font_len; - - g_return_val_if_fail(fmt != NULL && data != NULL, 0); - g_return_val_if_fail(data_len > 1, 0); - tail_len = data[data_len - 1]; - g_return_val_if_fail(tail_len > 2, 0); - text_len = data_len - tail_len; - g_return_val_if_fail(text_len >= 0, 0); - - bytes = text_len; - /* qq_show_packet("IM tail", data + bytes, tail_len); */ - bytes += 1; /* skip 0x00 */ - bytes += qq_get8(&fmt->attr, data + bytes); - bytes += qq_getdata(fmt->rgb, sizeof(fmt->rgb), data + bytes); /* red,green,blue */ - bytes += 1; /* skip 0x00 */ - bytes += qq_get16(&fmt->charset, data + bytes); - - font_len = data_len - bytes - 1; - g_return_val_if_fail(font_len > 0, bytes + 1); - - fmt->font_len = font_len; - if (fmt->font != NULL) g_free(fmt->font); - fmt->font = g_strndup((gchar *)data + bytes, fmt->font_len); - return tail_len; -} - -void qq_got_message(PurpleConnection *gc, const gchar *msg) -{ - qq_data *qd; - gchar *from; - time_t now = time(NULL); - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = gc->proto_data; - - g_return_if_fail(qd->uid > 0); - - qq_buddy_find_or_new(gc, qd->uid); - - from = uid_to_purple_name(qd->uid); - serv_got_im(gc, from, msg, PURPLE_MESSAGE_SYSTEM, now); - g_free(from); -} - -/* process received normal text IM */ -static void process_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header) -{ - qq_data *qd; - guint16 purple_msg_type; - gchar *who; - gchar *msg_smiley, *msg_fmt, *msg_utf8; - PurpleBuddy *buddy; - qq_buddy_data *bd; - gint bytes, tail_len; - qq_im_format *fmt = NULL; - - struct { - /* now comes the part for text only */ - guint16 msg_seq; - guint32 send_time; - guint16 sender_icon; - guint8 unknown1[3]; - guint8 has_font_attr; - guint8 fragment_count; - guint8 fragment_index; - guint8 msg_id; - guint8 unknown2; - guint8 msg_type; - gchar *msg; /* no fixed length, ends with 0x00 */ - } im_text; - - g_return_if_fail (data != NULL && len > 0); - g_return_if_fail(im_header != NULL); - - qd = (qq_data *) gc->proto_data; - memset(&im_text, 0, sizeof(im_text)); - - /* qq_show_packet("IM text", data, len); */ - bytes = 0; - bytes += qq_get16(&(im_text.msg_seq), data + bytes); - bytes += qq_get32(&(im_text.send_time), data + bytes); - bytes += qq_get16(&(im_text.sender_icon), data + bytes); - bytes += qq_getdata(im_text.unknown1, sizeof(im_text.unknown1), data + bytes); /* 0x(00 00 00)*/ - bytes += qq_get8(&(im_text.has_font_attr), data + bytes); - bytes += qq_get8(&(im_text.fragment_count), data + bytes); - bytes += qq_get8(&(im_text.fragment_index), data + bytes); - bytes += qq_get8(&(im_text.msg_id), data + bytes); - bytes += 1; /* skip 0x00 */ - bytes += qq_get8(&(im_text.msg_type), data + bytes); - purple_debug_info("QQ", "IM Seq %u, id %04X, fragment %d-%d, type %d, %s\n", - im_text.msg_seq, im_text.msg_id, - im_text.fragment_count, im_text.fragment_index, - im_text.msg_type, - im_text.has_font_attr ? "exist font atrr" : ""); - - if (im_text.has_font_attr) { - fmt = qq_im_fmt_new(); - tail_len = qq_get_im_tail(fmt, data + bytes, len - bytes); - im_text.msg = g_strndup((gchar *)(data + bytes), len - tail_len); - } else { - im_text.msg = g_strndup((gchar *)(data + bytes), len - bytes); - } - /* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg) ); */ - - who = uid_to_purple_name(im_header->uid_from); - buddy = purple_find_buddy(gc->account, who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, im_header->uid_from); - } - bd = (buddy == NULL) ? NULL : purple_buddy_get_protocol_data(buddy); - if (bd != NULL) { - bd->client_tag = im_header->version_from; - bd->face = im_text.sender_icon; - qq_update_buddy_icon(gc->account, who, bd->face); - } - - purple_msg_type = (im_text.msg_type == QQ_IM_AUTO_REPLY) - ? PURPLE_MESSAGE_AUTO_RESP : 0; - - msg_smiley = qq_emoticon_to_purple(im_text.msg); - if (fmt != NULL) { - msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); - msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); - g_free(msg_fmt); - qq_im_fmt_free(fmt); - } else { - msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); - } - g_free(msg_smiley); - - /* send encoded to purple, note that we use im_text.send_time, - * not the time we receive the message - * as it may have been delayed when I am not online. */ - purple_debug_info("QQ", "IM from %u: %s\n", im_header->uid_from,msg_utf8); - serv_got_im(gc, who, msg_utf8, purple_msg_type, (time_t) im_text.send_time); - - g_free(msg_utf8); - g_free(who); - g_free(im_text.msg); -} - -/* process received extended (2007) text IM */ -static void process_extend_im_text(PurpleConnection *gc, guint8 *data, gint len, qq_im_header *im_header) -{ - qq_data *qd; - guint16 purple_msg_type; - gchar *who; - gchar *msg_smiley, *msg_fmt, *msg_utf8; - PurpleBuddy *buddy; - qq_buddy_data *bd; - gint bytes, tail_len; - qq_im_format *fmt = NULL; - - struct { - /* now comes the part for text only */ - guint16 msg_seq; - guint32 send_time; - guint16 sender_icon; - guint32 has_font_attr; - guint8 unknown1[8]; - guint8 fragment_count; - guint8 fragment_index; - guint8 msg_id; - guint8 unknown2; - guint8 msg_type; - gchar *msg; /* no fixed length, ends with 0x00 */ - guint8 fromMobileQQ; - } im_text; - - g_return_if_fail (data != NULL && len > 0); - g_return_if_fail(im_header != NULL); - - qd = (qq_data *) gc->proto_data; - memset(&im_text, 0, sizeof(im_text)); - - /* qq_show_packet("Extend IM text", data, len); */ - bytes = 0; - bytes += qq_get16(&(im_text.msg_seq), data + bytes); - bytes += qq_get32(&(im_text.send_time), data + bytes); - bytes += qq_get16(&(im_text.sender_icon), data + bytes); - bytes += qq_get32(&(im_text.has_font_attr), data + bytes); - bytes += qq_getdata(im_text.unknown1, sizeof(im_text.unknown1), data + bytes); - bytes += qq_get8(&(im_text.fragment_count), data + bytes); - bytes += qq_get8(&(im_text.fragment_index), data + bytes); - bytes += qq_get8(&(im_text.msg_id), data + bytes); - bytes += 1; /* skip 0x00 */ - bytes += qq_get8(&(im_text.msg_type), data + bytes); - purple_debug_info("QQ", "IM Seq %u, id %04X, fragment %d-%d, type %d, %s\n", - im_text.msg_seq, im_text.msg_id, - im_text.fragment_count, im_text.fragment_index, - im_text.msg_type, - im_text.has_font_attr ? "exist font atrr" : ""); - - if (im_text.has_font_attr) { - fmt = qq_im_fmt_new(); - tail_len = qq_get_im_tail(fmt, data + bytes, len - bytes); - im_text.msg = g_strndup((gchar *)(data + bytes), len - tail_len); - } else { - im_text.msg = g_strndup((gchar *)(data + bytes), len - bytes); - } - /* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg)); */ - - if(im_text.fragment_count == 0) im_text.fragment_count = 1; - - who = uid_to_purple_name(im_header->uid_from); - buddy = purple_find_buddy(gc->account, who); - if (buddy == NULL) { - /* create no-auth buddy */ - buddy = qq_buddy_new(gc, im_header->uid_from); - } - bd = (buddy == NULL) ? NULL : purple_buddy_get_protocol_data(buddy); - if (bd != NULL) { - bd->client_tag = im_header->version_from; - bd->face = im_text.sender_icon; - qq_update_buddy_icon(gc->account, who, bd->face); - } - - purple_msg_type = 0; - - msg_smiley = qq_emoticon_to_purple(im_text.msg); - if (fmt != NULL) { - msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley); - msg_utf8 = qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT); - g_free(msg_fmt); - qq_im_fmt_free(fmt); - } else { - msg_utf8 = qq_to_utf8(msg_smiley, QQ_CHARSET_DEFAULT); - } - g_free(msg_smiley); - - /* send encoded to purple, note that we use im_text.send_time, - * not the time we receive the message - * as it may have been delayed when I am not online. */ - serv_got_im(gc, who, msg_utf8, purple_msg_type, (time_t) im_text.send_time); - - g_free(msg_utf8); - g_free(who); - g_free(im_text.msg); -} - -/* it is a normal IM, maybe text or video request */ -void qq_process_im(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes = 0; - qq_im_header im_header; - - g_return_if_fail (data != NULL && len > 0); - - bytes = get_im_header(&im_header, data, len); - if (bytes < 0) { - purple_debug_error("QQ", "Fail read im header, len %d\n", len); - qq_show_packet ("IM Header", data, len); - return; - } - purple_debug_info("QQ", - "Got IM to %u, type: %02X from: %u ver: %s (%04X)\n", - im_header.uid_to, im_header.im_type, im_header.uid_from, - qq_get_ver_desc(im_header.version_from), im_header.version_from); - - switch (im_header.im_type) { - case QQ_NORMAL_IM_TEXT: - if (bytes >= len - 1) { - purple_debug_warning("QQ", "Received normal IM text is empty\n"); - return; - } - process_im_text(gc, data + bytes, len - bytes, &im_header); - break; - case QQ_NORMAL_IM_FILE_REJECT_UDP: - qq_process_recv_file_reject(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_APPROVE_UDP: - qq_process_recv_file_accept(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_UDP: - qq_process_recv_file_request(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_CANCEL: - qq_process_recv_file_cancel(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_NOTIFY: - qq_process_recv_file_notify(data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_TCP: - /* Check ReceivedFileIM::parseContents in eva*/ - /* some client use this function for detect invisable buddy*/ - case QQ_NORMAL_IM_FILE_APPROVE_TCP: - case QQ_NORMAL_IM_FILE_REJECT_TCP: - case QQ_NORMAL_IM_FILE_PASV: - case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP: - case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT: - case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL: - case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP: - qq_show_packet ("Not support", data, len); - break; - default: - /* a simple process here, maybe more later */ - qq_show_packet ("Unknow", data + bytes, len - bytes); - return; - } -} - -/* it is a extended IM, maybe text or video request */ -void qq_process_extend_im(PurpleConnection *gc, guint8 *data, gint len) -{ - gint bytes; - qq_im_header im_header; - - g_return_if_fail (data != NULL && len > 0); - - bytes = get_im_header(&im_header, data, len); - if (bytes < 0) { - purple_debug_error("QQ", "Fail read im header, len %d\n", len); - qq_show_packet ("IM Header", data, len); - return; - } - purple_debug_info("QQ", - "Got Extend IM to %u, type: %02X from: %u ver: %s (%04X)\n", - im_header.uid_to, im_header.im_type, im_header.uid_from, - qq_get_ver_desc(im_header.version_from), im_header.version_from); - - switch (im_header.im_type) { - case QQ_NORMAL_IM_TEXT: - process_extend_im_text(gc, data + bytes, len - bytes, &im_header); - break; - case QQ_NORMAL_IM_FILE_REJECT_UDP: - qq_process_recv_file_reject (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_APPROVE_UDP: - qq_process_recv_file_accept (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_UDP: - qq_process_recv_file_request (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_CANCEL: - qq_process_recv_file_cancel (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_NOTIFY: - qq_process_recv_file_notify (data + bytes, len - bytes, im_header.uid_from, gc); - break; - case QQ_NORMAL_IM_FILE_REQUEST_TCP: - /* Check ReceivedFileIM::parseContents in eva*/ - /* some client use this function for detect invisable buddy*/ - case QQ_NORMAL_IM_FILE_APPROVE_TCP: - case QQ_NORMAL_IM_FILE_REJECT_TCP: - case QQ_NORMAL_IM_FILE_PASV: - case QQ_NORMAL_IM_FILE_EX_REQUEST_UDP: - case QQ_NORMAL_IM_FILE_EX_REQUEST_ACCEPT: - case QQ_NORMAL_IM_FILE_EX_REQUEST_CANCEL: - case QQ_NORMAL_IM_FILE_EX_NOTIFY_IP: - qq_show_packet ("Not support", data, len); - break; - default: - /* a simple process here, maybe more later */ - qq_show_packet ("Unknow", data + bytes, len - bytes); - break; - } -} - -/* send an IM to uid_to */ -static void request_send_im(PurpleConnection *gc, guint32 uid_to, gint type, - qq_im_format *fmt, gchar *msg, guint8 id, guint8 frag_count, guint8 frag_index) -{ - qq_data *qd; - guint8 raw_data[MAX_PACKET_SIZE - 16]; - guint16 im_type; - gint bytes; - time_t now; - - qd = (qq_data *) gc->proto_data; - im_type = QQ_NORMAL_IM_TEXT; - - /* purple_debug_info("QQ", "Send IM %d-%d\n", frag_count, frag_index); */ - bytes = 0; - /* 000-003: receiver uid */ - bytes += qq_put32(raw_data + bytes, qd->uid); - /* 004-007: sender uid */ - bytes += qq_put32(raw_data + bytes, uid_to); - /* 008-009: sender client version */ - bytes += qq_put16(raw_data + bytes, qd->client_tag); - /* 010-013: receiver uid */ - bytes += qq_put32(raw_data + bytes, qd->uid); - /* 014-017: sender uid */ - bytes += qq_put32(raw_data + bytes, uid_to); - /* 018-033: md5 of (uid+session_key) */ - bytes += qq_putdata(raw_data + bytes, qd->session_md5, 16); - /* 034-035: message type */ - bytes += qq_put16(raw_data + bytes, QQ_NORMAL_IM_TEXT); - /* 036-037: sequence number */ - bytes += qq_put16(raw_data + bytes, qd->send_seq); - /* 038-041: send time */ - now = time(NULL); - bytes += qq_put32(raw_data + bytes, (guint32) now); - /* 042-043: sender icon */ - bytes += qq_put16(raw_data + bytes, qd->my_icon); - /* 044-046: always 0x00 */ - bytes += qq_put16(raw_data + bytes, 0x0000); - bytes += qq_put8(raw_data + bytes, 0x00); - /* 047-047: always use font attr */ - bytes += qq_put8(raw_data + bytes, 0x01); - /* 048-051: always 0x00 */ - /* Fixme: frag_count, frag_index not working now */ - bytes += qq_put8(raw_data + bytes, frag_count); - bytes += qq_put8(raw_data + bytes, frag_index); - bytes += qq_put8(raw_data + bytes, id); - bytes += qq_put8(raw_data + bytes, 0); - /* 052-052: text message type (normal/auto-reply) */ - bytes += qq_put8(raw_data + bytes, type); - /* 053- : msg ends with 0x00 */ - bytes += qq_putdata(raw_data + bytes, (guint8 *)msg, strlen(msg)); - if (frag_count == frag_index + 1) { - bytes += qq_put8(raw_data + bytes, 0x20); /* add extra SPACE */ - } - bytes += qq_put_im_tail(raw_data + bytes, fmt); - - /* qq_show_packet("QQ_CMD_SEND_IM", raw_data, bytes); */ - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); -} - -static void im_convert_and_merge(GString *dest, GString *append) -{ - gchar *converted; - g_return_if_fail(dest != NULL && append != NULL); - - if (append->str == NULL || append->len <= 0) { - return; - } - /* purple_debug_info("QQ", "Append:\n%s\n", append->str); */ - converted = utf8_to_qq(append->str, QQ_CHARSET_DEFAULT); - g_string_append(dest, converted); - g_string_set_size(append, 0); - g_free(converted); -} - -GSList *qq_im_get_segments(gchar *msg_stripped, gboolean is_smiley_none) -{ - GSList *string_list = NULL; - GString *new_string; - GString *append_utf8; - gchar *start, *p; - gint count, len; - qq_emoticon *emoticon; - - g_return_val_if_fail(msg_stripped != NULL, NULL); - - start = msg_stripped; - count = 0; - new_string = g_string_new(""); - append_utf8 = g_string_new(""); - while (*start) { - p = start; - - /* Convert emoticon */ - if (!is_smiley_none && *p == '/') { - if (new_string->len + append_utf8->len + 2 > QQ_MSG_IM_MAX) { - /* enough chars to send */ - im_convert_and_merge(new_string, append_utf8); - string_list = g_slist_append(string_list, strdup(new_string->str)); - g_string_set_size(new_string, 0); - continue; - } - emoticon = emoticon_find(p); - if (emoticon != NULL) { - purple_debug_info("QQ", "found emoticon %s as 0x%02X\n", - emoticon->name, emoticon->symbol); - /* QQ emoticon code prevent converting from utf8 to QQ charset - * convert append_utf8 to QQ charset - * merge the result to dest - * append qq QQ emoticon code to dest */ - im_convert_and_merge(new_string, append_utf8); - g_string_append_c(new_string, 0x14); - g_string_append_c(new_string, emoticon->symbol); - start += strlen(emoticon->name); - continue; - } else { - purple_debug_info("QQ", "Not found emoticon %.20s\n", p); - } - } - - /* Get next char */ - start = g_utf8_next_char(p); - len = start - p; - if (new_string->len + append_utf8->len + len > QQ_MSG_IM_MAX) { - /* enough chars to send */ - im_convert_and_merge(new_string, append_utf8); - string_list = g_slist_append(string_list, strdup(new_string->str)); - g_string_set_size(new_string, 0); - } - g_string_append_len(append_utf8, p, len); - } - - if (new_string->len + append_utf8->len > 0) { - im_convert_and_merge(new_string, append_utf8); - string_list = g_slist_append(string_list, strdup(new_string->str)); - } - g_string_free(new_string, TRUE); - g_string_free(append_utf8, TRUE); - return string_list; -} - -gboolean qq_im_smiley_none(const gchar *msg) -{ - const gchar *start, *end, *last; - GData *attribs; - gchar *tmp; - gboolean ret = FALSE; - - g_return_val_if_fail(msg != NULL, TRUE); - - last = msg; - while (purple_markup_find_tag("font", last, &start, &end, &attribs)) { - tmp = g_datalist_get_data(&attribs, "sml"); - if (tmp && strlen(tmp) > 0) { - if (strcmp(tmp, "none") == 0) { - ret = TRUE; - break; - } - } - g_datalist_clear(&attribs); - last = end + 1; - } - return ret; -} - -/* Grab custom emote icons -static GSList* qq_grab_emoticons(const char *msg, const char*username) -{ - GSList *list; - GList *smileys; - PurpleSmiley *smiley; - const char *smiley_shortcut; - char *ptr; - int length; - PurpleStoredImage *img; - - smileys = purple_smileys_get_all(); - length = strlen(msg); - - for (; smileys; smileys = g_list_delete_link(smileys, smileys)) { - smiley = smileys->data; - smiley_shortcut = purple_smiley_get_shortcut(smiley); - purple_debug_info("QQ", "Smiley shortcut [%s]\n", smiley_shortcut); - - ptr = g_strstr_len(msg, length, smiley_shortcut); - - if (!ptr) - continue; - - purple_debug_info("QQ", "Found Smiley shortcut [%s]\n", smiley_shortcut); - - img = purple_smiley_get_stored_image(smiley); - - emoticon = g_new0(MsnEmoticon, 1); - emoticon->smile = g_strdup(purple_smiley_get_shortcut(smiley)); - emoticon->obj = msn_object_new_from_image(img, - purple_imgstore_get_filename(img), - username, MSN_OBJECT_EMOTICON); - - purple_imgstore_unref(img); - list = g_slist_prepend(list, emoticon); - } - return list; -} -*/ - -gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *what, PurpleMessageFlags flags) -{ - qq_data *qd; - guint32 uid_to; - gint type; - qq_im_format *fmt; - gchar *msg_stripped, *tmp; - GSList *segments, *it; - gint msg_len; - const gchar *start_invalid; - gboolean is_smiley_none; - guint8 frag_count, frag_index; - guint8 msg_id; - - g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1); - g_return_val_if_fail(who != NULL && what != NULL, -1); - - qd = (qq_data *) gc->proto_data; - purple_debug_info("QQ", "Send IM to %s, len %" G_GSIZE_FORMAT ":\n%s\n", who, strlen(what), what); - - uid_to = purple_name_to_uid(who); - if (uid_to == qd->uid) { - /* if msg is to myself, bypass the network */ - serv_got_im(gc, who, what, flags, time(NULL)); - return 1; - } - - type = (flags == PURPLE_MESSAGE_AUTO_RESP ? QQ_IM_AUTO_REPLY : QQ_IM_TEXT); - /* qq_show_packet("IM UTF8", (guint8 *)what, strlen(what)); */ - - msg_stripped = purple_markup_strip_html(what); - g_return_val_if_fail(msg_stripped != NULL, -1); - /* qq_show_packet("IM Stripped", (guint8 *)what, strlen(what)); */ - - /* Check and valid utf8 string */ - msg_len = strlen(msg_stripped); - g_return_val_if_fail(msg_len > 0, -1); - if (!g_utf8_validate(msg_stripped, msg_len, &start_invalid)) { - if (start_invalid > msg_stripped) { - tmp = g_strndup(msg_stripped, start_invalid - msg_stripped); - g_free(msg_stripped); - msg_stripped = g_strconcat(tmp, _("(Invalid UTF-8 string)"), NULL); - g_free(tmp); - } else { - g_free(msg_stripped); - msg_stripped = g_strdup(_("(Invalid UTF-8 string)")); - } - } - - is_smiley_none = qq_im_smiley_none(what); - segments = qq_im_get_segments(msg_stripped, is_smiley_none); - g_free(msg_stripped); - - if (segments == NULL) { - return -1; - } - - qd->send_im_id++; - msg_id = (guint8)(qd->send_im_id && 0xFF); - fmt = qq_im_fmt_new_by_purple(what); - frag_count = g_slist_length(segments); - frag_index = 0; - for (it = segments; it; it = it->next) { - /* - request_send_im(gc, uid_to, type, fmt, (gchar *)it->data, - msg_id, frag_count, frag_index); - */ - request_send_im(gc, uid_to, type, fmt, (gchar *)it->data, 0, 0, 0); - g_free(it->data); - frag_index++; - } - g_slist_free(segments); - qq_im_fmt_free(fmt); - return 1; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/im.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -/** - * @file im.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_IM_H_ -#define _QQ_IM_H_ - -#include -#include "connection.h" - -enum { - QQ_MSG_TO_BUDDY = 0x0009, - QQ_MSG_TO_UNKNOWN = 0x000a, - QQ_MSG_SMS = 0x0014, /* not sure */ - QQ_MSG_NEWS = 0x0018, - QQ_MSG_QUN_IM_UNKNOWN = 0x0020, - QQ_MSG_ADD_TO_QUN = 0x0021, - QQ_MSG_DEL_FROM_QUN = 0x0022, - QQ_MSG_APPLY_ADD_TO_QUN = 0x0023, - QQ_MSG_APPROVE_APPLY_ADD_TO_QUN = 0x0024, - QQ_MSG_REJCT_APPLY_ADD_TO_QUN = 0x0025, - QQ_MSG_CREATE_QUN = 0x0026, - QQ_MSG_TEMP_QUN_IM = 0x002A, - QQ_MSG_QUN_IM = 0x002B, - QQ_MSG_SYS_30 = 0x0030, - QQ_MSG_SYS_4C = 0x004C, - QQ_MSG_EXTEND = 0x0084, - QQ_MSG_EXTEND_85 = 0x0085 -}; - -typedef struct { - guint8 attr; - guint8 rgb[3]; - guint16 charset; - gchar *font; /* Attension: font may NULL. font name is in QQ charset */ - guint8 font_len; -} qq_im_format; - -gint qq_put_im_tail(guint8 *buf, qq_im_format *fmt); -gint qq_get_im_tail(qq_im_format *fmt, guint8 *data, gint data_len); - -qq_im_format *qq_im_fmt_new(void); -void qq_im_fmt_free(qq_im_format *fmt); -qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg); -gchar *qq_im_fmt_to_purple(qq_im_format *fmt, gchar *text); -gboolean qq_im_smiley_none(const gchar *msg); -GSList *qq_im_get_segments(gchar *msg_stripped, gboolean is_smiley_none); - -void qq_got_message(PurpleConnection *gc, const gchar *msg); -gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *message, PurpleMessageFlags flags); - -void qq_process_im(PurpleConnection *gc, guint8 *data, gint len); -void qq_process_extend_im(PurpleConnection *gc, guint8 *data, gint len); - -gchar *qq_emoticon_to_purple(gchar *text); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -QQSOURCES = \ - buddy_info.c \ - buddy_info.h \ - buddy_memo.c \ - buddy_memo.h \ - buddy_list.c \ - buddy_list.h \ - buddy_opt.c \ - buddy_opt.h \ - char_conv.c \ - char_conv.h \ - qq_crypt.c \ - qq_crypt.h \ - file_trans.c \ - file_trans.h \ - group.c \ - group.h \ - group_internal.c \ - group_internal.h \ - group_im.c \ - group_im.h \ - group_info.c \ - group_info.h \ - group_join.c \ - group_join.h \ - group_opt.c \ - group_opt.h \ - qq_define.c \ - qq_define.h \ - im.c \ - im.h \ - qq_process.c \ - qq_process.h \ - qq_base.c \ - qq_base.h \ - packet_parse.c \ - packet_parse.h \ - qq.c \ - qq.h \ - qq_network.c \ - qq_network.h \ - send_file.c \ - send_file.h \ - qq_trans.c \ - qq_trans.h \ - utils.c \ - utils.h - -AM_CFLAGS = $(st) - -libqq_la_LDFLAGS = -module -avoid-version - -if STATIC_QQ - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libqq.la -libqq_la_SOURCES = $(QQSOURCES) -libqq_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -noinst_LTLIBRARIES = -pkg_LTLIBRARIES = libqq.la -libqq_la_SOURCES = $(QQSOURCES) -libqq_la_LIBADD = $(GLIB_LIBS) - -endif - -# For 'make check' -noinst_LTLIBRARIES += libqq_tmp.la -libqq_tmp_la_SOURCES = $(libqq_la_SOURCES) -libqq_tmp_la_LIBADD = $(libqq_la_LIBADD) - - -# QQ_BUDDY_ICON_DIR is the path where a bunch of stock icons can be -# places for users to choose from when setting their buddy icon. We -# don't distribute those icons ourselves because of possibly copyright -# concerns, but distributions might want to put icons here. -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DQQ_BUDDY_ICON_DIR=\"$(datadir)/pixmaps/purple/buddy_icons/qq\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1042 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/qq -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in AUTHORS \ - ChangeLog -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_QQ_FALSE@libqq_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libqq_la_SOURCES_DIST = buddy_info.c buddy_info.h buddy_memo.c \ - buddy_memo.h buddy_list.c buddy_list.h buddy_opt.c buddy_opt.h \ - char_conv.c char_conv.h qq_crypt.c qq_crypt.h file_trans.c \ - file_trans.h group.c group.h group_internal.c group_internal.h \ - group_im.c group_im.h group_info.c group_info.h group_join.c \ - group_join.h group_opt.c group_opt.h qq_define.c qq_define.h \ - im.c im.h qq_process.c qq_process.h qq_base.c qq_base.h \ - packet_parse.c packet_parse.h qq.c qq.h qq_network.c \ - qq_network.h send_file.c send_file.h qq_trans.c qq_trans.h \ - utils.c utils.h -am__objects_1 = libqq_la-buddy_info.lo libqq_la-buddy_memo.lo \ - libqq_la-buddy_list.lo libqq_la-buddy_opt.lo \ - libqq_la-char_conv.lo libqq_la-qq_crypt.lo \ - libqq_la-file_trans.lo libqq_la-group.lo \ - libqq_la-group_internal.lo libqq_la-group_im.lo \ - libqq_la-group_info.lo libqq_la-group_join.lo \ - libqq_la-group_opt.lo libqq_la-qq_define.lo libqq_la-im.lo \ - libqq_la-qq_process.lo libqq_la-qq_base.lo \ - libqq_la-packet_parse.lo libqq_la-qq.lo libqq_la-qq_network.lo \ - libqq_la-send_file.lo libqq_la-qq_trans.lo libqq_la-utils.lo -@STATIC_QQ_FALSE@am_libqq_la_OBJECTS = $(am__objects_1) -@STATIC_QQ_TRUE@am_libqq_la_OBJECTS = $(am__objects_1) -libqq_la_OBJECTS = $(am_libqq_la_OBJECTS) -@STATIC_QQ_FALSE@am_libqq_la_rpath = -rpath $(pkgdir) -@STATIC_QQ_TRUE@am_libqq_la_rpath = -@STATIC_QQ_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -libqq_tmp_la_DEPENDENCIES = $(am__DEPENDENCIES_2) -am__libqq_tmp_la_SOURCES_DIST = buddy_info.c buddy_info.h buddy_memo.c \ - buddy_memo.h buddy_list.c buddy_list.h buddy_opt.c buddy_opt.h \ - char_conv.c char_conv.h qq_crypt.c qq_crypt.h file_trans.c \ - file_trans.h group.c group.h group_internal.c group_internal.h \ - group_im.c group_im.h group_info.c group_info.h group_join.c \ - group_join.h group_opt.c group_opt.h qq_define.c qq_define.h \ - im.c im.h qq_process.c qq_process.h qq_base.c qq_base.h \ - packet_parse.c packet_parse.h qq.c qq.h qq_network.c \ - qq_network.h send_file.c send_file.h qq_trans.c qq_trans.h \ - utils.c utils.h -am__objects_2 = buddy_info.lo buddy_memo.lo buddy_list.lo buddy_opt.lo \ - char_conv.lo qq_crypt.lo file_trans.lo group.lo \ - group_internal.lo group_im.lo group_info.lo group_join.lo \ - group_opt.lo qq_define.lo im.lo qq_process.lo qq_base.lo \ - packet_parse.lo qq.lo qq_network.lo send_file.lo qq_trans.lo \ - utils.lo -@STATIC_QQ_FALSE@am__objects_3 = $(am__objects_2) -@STATIC_QQ_TRUE@am__objects_3 = $(am__objects_2) -am_libqq_tmp_la_OBJECTS = $(am__objects_3) -libqq_tmp_la_OBJECTS = $(am_libqq_tmp_la_OBJECTS) -@STATIC_QQ_FALSE@am_libqq_tmp_la_rpath = -@STATIC_QQ_TRUE@am_libqq_tmp_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libqq_la_SOURCES) $(libqq_tmp_la_SOURCES) -DIST_SOURCES = $(am__libqq_la_SOURCES_DIST) \ - $(am__libqq_tmp_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -QQSOURCES = \ - buddy_info.c \ - buddy_info.h \ - buddy_memo.c \ - buddy_memo.h \ - buddy_list.c \ - buddy_list.h \ - buddy_opt.c \ - buddy_opt.h \ - char_conv.c \ - char_conv.h \ - qq_crypt.c \ - qq_crypt.h \ - file_trans.c \ - file_trans.h \ - group.c \ - group.h \ - group_internal.c \ - group_internal.h \ - group_im.c \ - group_im.h \ - group_info.c \ - group_info.h \ - group_join.c \ - group_join.h \ - group_opt.c \ - group_opt.h \ - qq_define.c \ - qq_define.h \ - im.c \ - im.h \ - qq_process.c \ - qq_process.h \ - qq_base.c \ - qq_base.h \ - packet_parse.c \ - packet_parse.h \ - qq.c \ - qq.h \ - qq_network.c \ - qq_network.h \ - send_file.c \ - send_file.h \ - qq_trans.c \ - qq_trans.h \ - utils.c \ - utils.h - -AM_CFLAGS = $(st) -libqq_la_LDFLAGS = -module -avoid-version -@STATIC_QQ_FALSE@st = -@STATIC_QQ_TRUE@st = -DPURPLE_STATIC_PRPL - -# For 'make check' -@STATIC_QQ_FALSE@noinst_LTLIBRARIES = libqq_tmp.la - -# For 'make check' -@STATIC_QQ_TRUE@noinst_LTLIBRARIES = libqq.la libqq_tmp.la -@STATIC_QQ_FALSE@libqq_la_SOURCES = $(QQSOURCES) -@STATIC_QQ_TRUE@libqq_la_SOURCES = $(QQSOURCES) -@STATIC_QQ_TRUE@libqq_la_CFLAGS = $(AM_CFLAGS) -@STATIC_QQ_FALSE@pkg_LTLIBRARIES = libqq.la -@STATIC_QQ_FALSE@libqq_la_LIBADD = $(GLIB_LIBS) -libqq_tmp_la_SOURCES = $(libqq_la_SOURCES) -libqq_tmp_la_LIBADD = $(libqq_la_LIBADD) - -# QQ_BUDDY_ICON_DIR is the path where a bunch of stock icons can be -# places for users to choose from when setting their buddy icon. We -# don't distribute those icons ourselves because of possibly copyright -# concerns, but distributions might want to put icons here. -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -DQQ_BUDDY_ICON_DIR=\"$(datadir)/pixmaps/purple/buddy_icons/qq\" \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/qq/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/qq/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libqq.la: $(libqq_la_OBJECTS) $(libqq_la_DEPENDENCIES) - $(LINK) $(am_libqq_la_rpath) $(libqq_la_LDFLAGS) $(libqq_la_OBJECTS) $(libqq_la_LIBADD) $(LIBS) -libqq_tmp.la: $(libqq_tmp_la_OBJECTS) $(libqq_tmp_la_DEPENDENCIES) - $(LINK) $(am_libqq_tmp_la_rpath) $(libqq_tmp_la_LDFLAGS) $(libqq_tmp_la_OBJECTS) $(libqq_tmp_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddy_info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddy_list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddy_memo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddy_opt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/char_conv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_trans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_im.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_internal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_join.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group_opt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/im.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_memo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-buddy_opt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-char_conv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-file_trans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_im.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_info.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_internal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_join.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-group_opt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-im.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-packet_parse.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_base.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_crypt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_define.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_network.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_process.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-qq_trans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-send_file.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqq_la-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet_parse.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq_base.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq_crypt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq_define.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq_network.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq_process.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qq_trans.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send_file.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libqq_la-buddy_info.lo: buddy_info.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_info.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_info.Tpo" -c -o libqq_la-buddy_info.lo `test -f 'buddy_info.c' || echo '$(srcdir)/'`buddy_info.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_info.Tpo" "$(DEPDIR)/libqq_la-buddy_info.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_info.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_info.c' object='libqq_la-buddy_info.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_info.lo `test -f 'buddy_info.c' || echo '$(srcdir)/'`buddy_info.c - -libqq_la-buddy_memo.lo: buddy_memo.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_memo.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_memo.Tpo" -c -o libqq_la-buddy_memo.lo `test -f 'buddy_memo.c' || echo '$(srcdir)/'`buddy_memo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_memo.Tpo" "$(DEPDIR)/libqq_la-buddy_memo.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_memo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_memo.c' object='libqq_la-buddy_memo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_memo.lo `test -f 'buddy_memo.c' || echo '$(srcdir)/'`buddy_memo.c - -libqq_la-buddy_list.lo: buddy_list.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_list.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_list.Tpo" -c -o libqq_la-buddy_list.lo `test -f 'buddy_list.c' || echo '$(srcdir)/'`buddy_list.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_list.Tpo" "$(DEPDIR)/libqq_la-buddy_list.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_list.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_list.c' object='libqq_la-buddy_list.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_list.lo `test -f 'buddy_list.c' || echo '$(srcdir)/'`buddy_list.c - -libqq_la-buddy_opt.lo: buddy_opt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-buddy_opt.lo -MD -MP -MF "$(DEPDIR)/libqq_la-buddy_opt.Tpo" -c -o libqq_la-buddy_opt.lo `test -f 'buddy_opt.c' || echo '$(srcdir)/'`buddy_opt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-buddy_opt.Tpo" "$(DEPDIR)/libqq_la-buddy_opt.Plo"; else rm -f "$(DEPDIR)/libqq_la-buddy_opt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy_opt.c' object='libqq_la-buddy_opt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-buddy_opt.lo `test -f 'buddy_opt.c' || echo '$(srcdir)/'`buddy_opt.c - -libqq_la-char_conv.lo: char_conv.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-char_conv.lo -MD -MP -MF "$(DEPDIR)/libqq_la-char_conv.Tpo" -c -o libqq_la-char_conv.lo `test -f 'char_conv.c' || echo '$(srcdir)/'`char_conv.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-char_conv.Tpo" "$(DEPDIR)/libqq_la-char_conv.Plo"; else rm -f "$(DEPDIR)/libqq_la-char_conv.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='char_conv.c' object='libqq_la-char_conv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-char_conv.lo `test -f 'char_conv.c' || echo '$(srcdir)/'`char_conv.c - -libqq_la-qq_crypt.lo: qq_crypt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_crypt.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_crypt.Tpo" -c -o libqq_la-qq_crypt.lo `test -f 'qq_crypt.c' || echo '$(srcdir)/'`qq_crypt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_crypt.Tpo" "$(DEPDIR)/libqq_la-qq_crypt.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_crypt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_crypt.c' object='libqq_la-qq_crypt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_crypt.lo `test -f 'qq_crypt.c' || echo '$(srcdir)/'`qq_crypt.c - -libqq_la-file_trans.lo: file_trans.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-file_trans.lo -MD -MP -MF "$(DEPDIR)/libqq_la-file_trans.Tpo" -c -o libqq_la-file_trans.lo `test -f 'file_trans.c' || echo '$(srcdir)/'`file_trans.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-file_trans.Tpo" "$(DEPDIR)/libqq_la-file_trans.Plo"; else rm -f "$(DEPDIR)/libqq_la-file_trans.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='file_trans.c' object='libqq_la-file_trans.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-file_trans.lo `test -f 'file_trans.c' || echo '$(srcdir)/'`file_trans.c - -libqq_la-group.lo: group.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group.Tpo" -c -o libqq_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group.Tpo" "$(DEPDIR)/libqq_la-group.Plo"; else rm -f "$(DEPDIR)/libqq_la-group.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group.c' object='libqq_la-group.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group.lo `test -f 'group.c' || echo '$(srcdir)/'`group.c - -libqq_la-group_internal.lo: group_internal.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_internal.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_internal.Tpo" -c -o libqq_la-group_internal.lo `test -f 'group_internal.c' || echo '$(srcdir)/'`group_internal.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_internal.Tpo" "$(DEPDIR)/libqq_la-group_internal.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_internal.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_internal.c' object='libqq_la-group_internal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_internal.lo `test -f 'group_internal.c' || echo '$(srcdir)/'`group_internal.c - -libqq_la-group_im.lo: group_im.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_im.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_im.Tpo" -c -o libqq_la-group_im.lo `test -f 'group_im.c' || echo '$(srcdir)/'`group_im.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_im.Tpo" "$(DEPDIR)/libqq_la-group_im.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_im.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_im.c' object='libqq_la-group_im.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_im.lo `test -f 'group_im.c' || echo '$(srcdir)/'`group_im.c - -libqq_la-group_info.lo: group_info.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_info.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_info.Tpo" -c -o libqq_la-group_info.lo `test -f 'group_info.c' || echo '$(srcdir)/'`group_info.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_info.Tpo" "$(DEPDIR)/libqq_la-group_info.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_info.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_info.c' object='libqq_la-group_info.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_info.lo `test -f 'group_info.c' || echo '$(srcdir)/'`group_info.c - -libqq_la-group_join.lo: group_join.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_join.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_join.Tpo" -c -o libqq_la-group_join.lo `test -f 'group_join.c' || echo '$(srcdir)/'`group_join.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_join.Tpo" "$(DEPDIR)/libqq_la-group_join.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_join.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_join.c' object='libqq_la-group_join.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_join.lo `test -f 'group_join.c' || echo '$(srcdir)/'`group_join.c - -libqq_la-group_opt.lo: group_opt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-group_opt.lo -MD -MP -MF "$(DEPDIR)/libqq_la-group_opt.Tpo" -c -o libqq_la-group_opt.lo `test -f 'group_opt.c' || echo '$(srcdir)/'`group_opt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-group_opt.Tpo" "$(DEPDIR)/libqq_la-group_opt.Plo"; else rm -f "$(DEPDIR)/libqq_la-group_opt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='group_opt.c' object='libqq_la-group_opt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-group_opt.lo `test -f 'group_opt.c' || echo '$(srcdir)/'`group_opt.c - -libqq_la-qq_define.lo: qq_define.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_define.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_define.Tpo" -c -o libqq_la-qq_define.lo `test -f 'qq_define.c' || echo '$(srcdir)/'`qq_define.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_define.Tpo" "$(DEPDIR)/libqq_la-qq_define.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_define.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_define.c' object='libqq_la-qq_define.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_define.lo `test -f 'qq_define.c' || echo '$(srcdir)/'`qq_define.c - -libqq_la-im.lo: im.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-im.lo -MD -MP -MF "$(DEPDIR)/libqq_la-im.Tpo" -c -o libqq_la-im.lo `test -f 'im.c' || echo '$(srcdir)/'`im.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-im.Tpo" "$(DEPDIR)/libqq_la-im.Plo"; else rm -f "$(DEPDIR)/libqq_la-im.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='im.c' object='libqq_la-im.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-im.lo `test -f 'im.c' || echo '$(srcdir)/'`im.c - -libqq_la-qq_process.lo: qq_process.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_process.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_process.Tpo" -c -o libqq_la-qq_process.lo `test -f 'qq_process.c' || echo '$(srcdir)/'`qq_process.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_process.Tpo" "$(DEPDIR)/libqq_la-qq_process.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_process.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_process.c' object='libqq_la-qq_process.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_process.lo `test -f 'qq_process.c' || echo '$(srcdir)/'`qq_process.c - -libqq_la-qq_base.lo: qq_base.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_base.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_base.Tpo" -c -o libqq_la-qq_base.lo `test -f 'qq_base.c' || echo '$(srcdir)/'`qq_base.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_base.Tpo" "$(DEPDIR)/libqq_la-qq_base.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_base.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_base.c' object='libqq_la-qq_base.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_base.lo `test -f 'qq_base.c' || echo '$(srcdir)/'`qq_base.c - -libqq_la-packet_parse.lo: packet_parse.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-packet_parse.lo -MD -MP -MF "$(DEPDIR)/libqq_la-packet_parse.Tpo" -c -o libqq_la-packet_parse.lo `test -f 'packet_parse.c' || echo '$(srcdir)/'`packet_parse.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-packet_parse.Tpo" "$(DEPDIR)/libqq_la-packet_parse.Plo"; else rm -f "$(DEPDIR)/libqq_la-packet_parse.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='packet_parse.c' object='libqq_la-packet_parse.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-packet_parse.lo `test -f 'packet_parse.c' || echo '$(srcdir)/'`packet_parse.c - -libqq_la-qq.lo: qq.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq.Tpo" -c -o libqq_la-qq.lo `test -f 'qq.c' || echo '$(srcdir)/'`qq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq.Tpo" "$(DEPDIR)/libqq_la-qq.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq.c' object='libqq_la-qq.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq.lo `test -f 'qq.c' || echo '$(srcdir)/'`qq.c - -libqq_la-qq_network.lo: qq_network.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_network.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_network.Tpo" -c -o libqq_la-qq_network.lo `test -f 'qq_network.c' || echo '$(srcdir)/'`qq_network.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_network.Tpo" "$(DEPDIR)/libqq_la-qq_network.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_network.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_network.c' object='libqq_la-qq_network.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_network.lo `test -f 'qq_network.c' || echo '$(srcdir)/'`qq_network.c - -libqq_la-send_file.lo: send_file.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-send_file.lo -MD -MP -MF "$(DEPDIR)/libqq_la-send_file.Tpo" -c -o libqq_la-send_file.lo `test -f 'send_file.c' || echo '$(srcdir)/'`send_file.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-send_file.Tpo" "$(DEPDIR)/libqq_la-send_file.Plo"; else rm -f "$(DEPDIR)/libqq_la-send_file.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='send_file.c' object='libqq_la-send_file.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-send_file.lo `test -f 'send_file.c' || echo '$(srcdir)/'`send_file.c - -libqq_la-qq_trans.lo: qq_trans.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-qq_trans.lo -MD -MP -MF "$(DEPDIR)/libqq_la-qq_trans.Tpo" -c -o libqq_la-qq_trans.lo `test -f 'qq_trans.c' || echo '$(srcdir)/'`qq_trans.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-qq_trans.Tpo" "$(DEPDIR)/libqq_la-qq_trans.Plo"; else rm -f "$(DEPDIR)/libqq_la-qq_trans.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='qq_trans.c' object='libqq_la-qq_trans.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-qq_trans.lo `test -f 'qq_trans.c' || echo '$(srcdir)/'`qq_trans.c - -libqq_la-utils.lo: utils.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -MT libqq_la-utils.lo -MD -MP -MF "$(DEPDIR)/libqq_la-utils.Tpo" -c -o libqq_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libqq_la-utils.Tpo" "$(DEPDIR)/libqq_la-utils.Plo"; else rm -f "$(DEPDIR)/libqq_la-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libqq_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libqq_la_CFLAGS) $(CFLAGS) -c -o libqq_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of the QQ prpl -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libqq -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += \ - -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = \ - buddy_info.c \ - buddy_list.c \ - buddy_memo.c \ - buddy_opt.c \ - char_conv.c \ - qq_crypt.c \ - file_trans.c \ - group.c \ - group_internal.c \ - group_im.c \ - group_info.c \ - group_join.c \ - group_opt.c \ - qq_define.c \ - im.c \ - packet_parse.c \ - qq.c \ - qq_base.c \ - qq_network.c \ - qq_process.c \ - qq_trans.c \ - send_file.c \ - utils.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ -/** - * @file packet_parse.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include - -#include "packet_parse.h" -#include "debug.h" - -/*------------------------------------------------PUT------------------------------------------------*/ - -/* note: - * 1, in these functions, 'b' stands for byte, 'w' stands for word, 'dw' stands for double word. - * 2, we use '*cursor' and 'buf' as two addresses to calculate the length. - * 3, change 'undef' to 'define' to get more info about the packet parsing. */ - -#undef PARSER_DEBUG - -/* read one byte from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_get8(guint8 *b, guint8 *buf) -{ - guint8 b_dest; - memcpy(&b_dest, buf, sizeof(b_dest)); - *b = b_dest; -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][get8] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][get8] b_dest 0x%2x, *b 0x%02x\n", b_dest, *b); -#endif - return sizeof(b_dest); -} - - -/* read two bytes as "guint16" from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_get16(guint16 *w, guint8 *buf) -{ - guint16 w_dest; - memcpy(&w_dest, buf, sizeof(w_dest)); - *w = g_ntohs(w_dest); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][get16] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][get16] w_dest 0x%04x, *w 0x%04x\n", w_dest, *w); -#endif - return sizeof(w_dest); -} - -/* read four bytes as "guint32" from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_get32(guint32 *dw, guint8 *buf) -{ - guint32 dw_dest; - memcpy(&dw_dest, buf, sizeof(dw_dest)); - *dw = g_ntohl(dw_dest); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][get32] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][get32] dw_dest 0x%08x, *dw 0x%08x\n", dw_dest, *dw); -#endif - return sizeof(dw_dest); -} - -gint qq_getIP(struct in_addr *ip, guint8 *buf) -{ - memcpy(ip, buf, sizeof(struct in_addr)); - return sizeof(struct in_addr); -} - -/* read datalen bytes from buf, - * return the number of bytes read if succeeds, otherwise return -1 */ -gint qq_getdata(guint8 *data, gint datalen, guint8 *buf) -{ - memcpy(data, buf, datalen); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][getdata] buf %p\n", (void *)buf); -#endif - return datalen; -} - - -/* read four bytes as "time_t" from buf, - * return the number of bytes read if succeeds, otherwise return -1 - * This function is a wrapper around read_packet_dw() to avoid casting. */ -gint qq_getime(time_t *t, guint8 *buf) -{ - guint32 dw_dest; - memcpy(&dw_dest, buf, sizeof(dw_dest)); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][getime] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][getime] dw_dest before 0x%08x\n", dw_dest); -#endif - dw_dest = g_ntohl(dw_dest); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][getime] dw_dest after 0x%08x\n", dw_dest); -#endif - memcpy(t, &dw_dest, sizeof(dw_dest)); - return sizeof(dw_dest); -} - -/*------------------------------------------------PUT------------------------------------------------*/ -/* pack one byte into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_put8(guint8 *buf, guint8 b) -{ - memcpy(buf, &b, sizeof(b)); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put8] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put8] b 0x%02x\n", b); -#endif - return sizeof(b); -} - - -/* pack two bytes as "guint16" into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_put16(guint8 *buf, guint16 w) -{ - guint16 w_porter; - w_porter = g_htons(w); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put16] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put16] w 0x%04x, w_porter 0x%04x\n", w, w_porter); -#endif - memcpy(buf, &w_porter, sizeof(w_porter)); - return sizeof(w_porter); -} - - -/* pack four bytes as "guint32" into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_put32(guint8 *buf, guint32 dw) -{ - guint32 dw_porter; - dw_porter = g_htonl(dw); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put32] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter); -#endif - memcpy(buf, &dw_porter, sizeof(dw_porter)); - return sizeof(dw_porter); -} - -gint qq_putime(guint8 *buf, time_t *t) -{ - guint32 dw, dw_porter; - memcpy(&dw, t, sizeof(dw)); - dw_porter = g_htonl(dw); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][put32] buf %p\n", (void *)buf); - purple_debug_info("QQ", "[DBG][put32] dw 0x%08x, dw_porter 0x%08x\n", dw, dw_porter); -#endif - memcpy(buf, &dw_porter, sizeof(dw_porter)); - return sizeof(dw_porter); -} - -gint qq_putIP(guint8* buf, struct in_addr *ip) -{ - memcpy(buf, ip, sizeof(struct in_addr)); - return sizeof(struct in_addr); -} - -/* pack datalen bytes into buf - * return the number of bytes packed, otherwise return -1 */ -gint qq_putdata(guint8 *buf, const guint8 *data, const int datalen) -{ - memcpy(buf, data, datalen); -#ifdef PARSER_DEBUG - purple_debug_info("QQ", "[DBG][putdata] buf %p\n", (void *)buf); -#endif - return datalen; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/packet_parse.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/** - * @file packet_parse.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_PACKET_PARSE_H_ -#define _QQ_PACKET_PARSE_H_ - -#include -#include - -/* According to "UNIX Network Programming", all TCP/IP implementations - * must support a minimum IP datagram size of 576 bytes, regardless of the MTU. - * Assuming a 20 byte IP header and 8 byte UDP header, this leaves 548 bytes - * as a safe maximum size for UDP messages. - * - * TCP allows packet 64K - */ -#define MAX_PACKET_SIZE 65535 - -#ifndef _WIN32 -#include -#else -#include "win32dep.h" -#endif - -gint qq_get8(guint8 *b, guint8 *buf); -gint qq_get16(guint16 *w, guint8 *buf); -gint qq_get32(guint32 *dw, guint8 *buf); -gint qq_getIP(struct in_addr *ip, guint8 *buf); -gint qq_getime(time_t *t, guint8 *buf); -gint qq_getdata(guint8 *data, gint datalen, guint8 *buf); - -gint qq_put8(guint8 *buf, guint8 b); -gint qq_put16(guint8 *buf, guint16 w); -gint qq_put32(guint8 *buf, guint32 dw); -gint qq_putIP(guint8* buf, struct in_addr *ip); -gint qq_putime(guint8 *buf, time_t *t); -gint qq_putdata(guint8 *buf, const guint8 *data, const int datalen); - -/* -gint read_packet_b(guint8 *buf, guint8 **cursor, gint buflen, guint8 *b); -gint read_packet_w(guint8 *buf, guint8 **cursor, gint buflen, guint16 *w); -gint read_packet_dw(guint8 *buf, guint8 **cursor, gint buflen, guint32 *dw); -gint read_packet_time(guint8 *buf, guint8 **cursor, gint buflen, time_t *t); -gint read_packet_data(guint8 *buf, guint8 **cursor, gint buflen, guint8 *data, gint datalen); - -gint create_packet_b(guint8 *buf, guint8 **cursor, guint8 b); -gint create_packet_w(guint8 *buf, guint8 **cursor, guint16 w); -gint create_packet_dw(guint8 *buf, guint8 **cursor, guint32 dw); -gint create_packet_data(guint8 *buf, guint8 **cursor, guint8 *data, gint datalen); -*/ - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1489 +0,0 @@ -/** - * @file qq_base.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "debug.h" -#include "server.h" -#include "cipher.h" -#include "request.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "char_conv.h" -#include "qq_crypt.h" -#include "group.h" -#include "qq_define.h" -#include "qq_network.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq.h" -#include "qq_network.h" -#include "utils.h" - -/* generate a md5 key using uid and session_key */ -static void get_session_md5(guint8 *session_md5, guint32 uid, guint8 *session_key) -{ - guint8 src[QQ_KEY_LENGTH + QQ_KEY_LENGTH]; - gint bytes = 0; - - bytes += qq_put32(src + bytes, uid); - bytes += qq_putdata(src + bytes, session_key, QQ_KEY_LENGTH); - - qq_get_md5(session_md5, QQ_KEY_LENGTH, src, bytes); -} - -/* process login reply which says OK */ -static gint8 process_login_ok(PurpleConnection *gc, guint8 *data, gint len) -{ - qq_data *qd; - gint bytes; - - guint8 ret; - guint32 uid; - struct in_addr ip; - guint16 port; - struct tm *tm_local; - - qd = (qq_data *) gc->proto_data; - /* qq_show_packet("Login reply", data, len); */ - - if (len < 148) { - qq_show_packet("Login reply OK, but length < 139", data, len); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt server reply")); - return QQ_LOGIN_REPLY_ERR; - } - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); - get_session_md5(qd->session_md5, qd->uid, qd->session_key); - purple_debug_info("QQ", "Got session_key\n"); - bytes += qq_get32(&uid, data + bytes); - if (uid != qd->uid) { - purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); - } - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - purple_debug_info("QQ", "Internet IP: %s, %d\n", inet_ntoa(qd->my_ip), qd->my_port); - - bytes += qq_getIP(&qd->my_local_ip, data + bytes); - bytes += qq_get16(&qd->my_local_port, data + bytes); - purple_debug_info("QQ", "Local IP: %s, %d\n", inet_ntoa(qd->my_local_ip), qd->my_local_port); - - bytes += qq_getime(&qd->login_time, data + bytes); - tm_local = localtime(&qd->login_time); - purple_debug_info("QQ", "Login time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - /* skip unknown 2 bytes, 0x(03 0a) */ - bytes += 2; - /* skip unknown 24 bytes, maybe token to access Qun shared files */ - bytes += 24; - /* unknow ip and port */ - bytes += qq_getIP(&ip, data + bytes); - bytes += qq_get16(&port, data + bytes); - purple_debug_info("QQ", "Unknow IP: %s, %d\n", inet_ntoa(ip), port); - /* unknow ip and port */ - bytes += qq_getIP(&ip, data + bytes); - bytes += qq_get16(&port, data + bytes); - purple_debug_info("QQ", "Unknow IP: %s, %d\n", inet_ntoa(ip), port); - /* unknown 4 bytes, 0x(00 81 00 00)*/ - bytes += 4; - /* skip unknown 32 bytes, maybe key to access QQ Home */ - bytes += 32; - /* skip unknown 16 bytes, 0x(00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 00) */ - bytes += 16; - /* time */ - bytes += qq_getime(&qd->last_login_time[0], data + bytes); - tm_local = localtime(&qd->last_login_time[0]); - purple_debug_info("QQ", "Last login time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - /* unknow time */ - g_return_val_if_fail(sizeof(qd->last_login_time) / sizeof(time_t) > 1, QQ_LOGIN_REPLY_OK); - bytes += qq_getime(&qd->last_login_time[1], data + bytes); - tm_local = localtime(&qd->last_login_time[1]); - purple_debug_info("QQ", "Time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - - g_return_val_if_fail(sizeof(qd->last_login_time) / sizeof(time_t) > 2, QQ_LOGIN_REPLY_OK); - bytes += qq_getime(&qd->last_login_time[2], data + bytes); - tm_local = localtime(&qd->last_login_time[2]); - purple_debug_info("QQ", "Time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - /* unknow 9 bytes, 0x(00 0a 00 0a 01 00 00 0e 10) */ - - if (len > 148) { - qq_show_packet("Login reply OK, but length > 139", data, len); - } - return QQ_LOGIN_REPLY_OK; -} - -/* process login reply packet which includes redirected new server address */ -static gint8 process_login_redirect(PurpleConnection *gc, guint8 *data, gint len) -{ - qq_data *qd; - gint bytes; - struct { - guint8 result; - guint32 uid; - struct in_addr new_server_ip; - guint16 new_server_port; - } packet; - - - if (len < 11) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt server reply")); - return QQ_LOGIN_REPLY_ERR; - } - - qd = (qq_data *) gc->proto_data; - bytes = 0; - /* 000-000: reply code */ - bytes += qq_get8(&packet.result, data + bytes); - /* 001-004: login uid */ - bytes += qq_get32(&packet.uid, data + bytes); - /* 005-008: redirected new server IP */ - bytes += qq_getIP(&packet.new_server_ip, data + bytes); - /* 009-010: redirected new server port */ - bytes += qq_get16(&packet.new_server_port, data + bytes); - - if (len > 11) { - purple_debug_error("QQ", "Login redirect more than expected %d bytes, read %d bytes\n", 11, bytes); - } - - /* redirect to new server, do not disconnect or connect here - * those connect should be called at packet_process */ - qd->redirect_ip.s_addr = packet.new_server_ip.s_addr; - qd->redirect_port = packet.new_server_port; - return QQ_LOGIN_REPLY_REDIRECT; -} - -/* request before login */ -void qq_request_token(PurpleConnection *gc) -{ - qq_data *qd; - guint8 buf[16] = {0}; - gint bytes = 0; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - bytes += qq_put8(buf + bytes, 0); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN, qd->send_seq, buf, bytes, TRUE); -} - -/* send login packet to QQ server */ -void qq_request_login(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - /* for QQ 2005? copy from lumaqq */ - static const guint8 login_23_51[29] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x86, 0xcc, 0x4c, 0x35, - 0x2c, 0xd3, 0x73, 0x6c, 0x14, 0xf6, 0xf6, 0xaf, - 0xc3, 0xfa, 0x33, 0xa4, 0x01 - }; - - static const guint8 login_53_68[16] = { - 0x8D, 0x8B, 0xFA, 0xEC, 0xD5, 0x52, 0x17, 0x4A, - 0x86, 0xF9, 0xA7, 0x75, 0xE6, 0x32, 0xD1, 0x6D - }; - - static const guint8 login_100_bytes[100] = { - 0x40, 0x0B, 0x04, 0x02, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0xE9, 0x03, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF3, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xED, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xEC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0xEE, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0xEF, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0xEB, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - /* now generate the encrypted data - * 000-015 use password_twice_md5 as key to encrypt empty string */ - encrypted_len = qq_encrypt(encrypted, (guint8 *) "", 0, qd->ld.pwd_twice_md5); - g_return_if_fail(encrypted_len == 16); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - - /* 016-016 */ - bytes += qq_put8(raw_data + bytes, 0x00); - /* 017-020, used to be IP, now zero */ - bytes += qq_put32(raw_data + bytes, 0x00000000); - /* 021-022, used to be port, now zero */ - bytes += qq_put16(raw_data + bytes, 0x0000); - /* 023-051, fixed value, unknown */ - bytes += qq_putdata(raw_data + bytes, login_23_51, 29); - /* 052-052, login mode */ - bytes += qq_put8(raw_data + bytes, qd->login_mode); - /* 053-068, fixed value, maybe related to per machine */ - bytes += qq_putdata(raw_data + bytes, login_53_68, 16); - /* 069, login token length */ - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - /* 070-093, login token, normally 24 bytes */ - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - /* 100 bytes unknown */ - bytes += qq_putdata(raw_data + bytes, login_100_bytes, 100); - /* all zero left */ - memset(raw_data + bytes, 0, 416 - bytes); - bytes = 416; - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_LOGIN, qd->send_seq, buf, bytes, TRUE); -} - -guint8 qq_process_token(PurpleConnection *gc, guint8 *buf, gint buf_len) -{ - qq_data *qd; - gint bytes; - guint8 ret; - guint8 token_len; - gchar *msg; - - g_return_val_if_fail(buf != NULL && buf_len != 0, QQ_LOGIN_REPLY_ERR); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&ret, buf + bytes); - bytes += qq_get8(&token_len, buf + bytes); - - if (ret != QQ_LOGIN_REPLY_OK) { - qq_show_packet("Failed requesting token", buf, buf_len); - - msg = g_strdup_printf( _("Failed requesting token, 0x%02X"), ret ); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - msg); - g_free(msg); - return QQ_LOGIN_REPLY_ERR; - } - - if (bytes + token_len < buf_len) { - msg = g_strdup_printf( _("Invalid token len, %d"), token_len); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - msg); - g_free(msg); - return QQ_LOGIN_REPLY_ERR; - } - - if (bytes + token_len > buf_len) { - purple_debug_info("QQ", "Extra token data, %d %d\n", token_len, buf_len - bytes); - } - /* qq_show_packet("Got token", buf + bytes, buf_len - bytes); */ - - if (qd->ld.token != NULL) { - g_free(qd->ld.token); - qd->ld.token = NULL; - qd->ld.token_len = 0; - } - qd->ld.token = g_new0(guint8, token_len); - qd->ld.token_len = token_len; - g_memmove(qd->ld.token, buf + 2, qd->ld.token_len); - return ret; -} - -/* send logout packets to QQ server */ -void qq_request_logout(PurpleConnection *gc) -{ - gint i; - qq_data *qd; - - qd = (qq_data *) gc->proto_data; - for (i = 0; i < 4; i++) - qq_send_cmd(gc, QQ_CMD_LOGOUT, qd->ld.pwd_twice_md5, QQ_KEY_LENGTH); - - qd->is_login = FALSE; /* update login status AFTER sending logout packets */ -} - -/* for QQ 2003iii 0117, fixed value */ -/* static const guint8 login_23_51[29] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xbf, 0x14, 0x11, 0x20, - 0x03, 0x9d, 0xb2, 0xe6, 0xb3, 0x11, 0xb7, 0x13, - 0x95, 0x67, 0xda, 0x2c, 0x01 -}; */ - -/* for QQ 2003iii 0304, fixed value */ -/* -static const guint8 login_23_51[29] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x9a, 0x93, 0xfe, 0x85, - 0xd3, 0xd9, 0x2a, 0x41, 0xc8, 0x0d, 0xff, 0xb6, - 0x40, 0xb8, 0xac, 0x32, 0x01 -}; -*/ - -/* fixed value, not affected by version, or mac address */ -/* -static const guint8 login_53_68[16] = { - 0x82, 0x2a, 0x91, 0xfd, 0xa5, 0xca, 0x67, 0x4c, - 0xac, 0x81, 0x1f, 0x6f, 0x52, 0x05, 0xa7, 0xbf -}; -*/ - -/* process the login reply packet */ -guint8 qq_process_login( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - guint8 ret = data[0]; - gchar *msg, *msg_utf8; - gchar *error; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - qd = (qq_data *) gc->proto_data; - - switch (ret) { - case QQ_LOGIN_REPLY_OK: - purple_debug_info("QQ", "Login OK\n"); - return process_login_ok(gc, data, data_len); - case QQ_LOGIN_REPLY_REDIRECT: - purple_debug_info("QQ", "Redirect new server\n"); - return process_login_redirect(gc, data, data_len); - - case 0x0A: /* extend redirect used in QQ2006 */ - error = g_strdup( _("Redirect_EX is not currently supported") ); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0x05: /* invalid password */ - if (!purple_account_get_remember_password(gc->account)) { - purple_account_set_password(gc->account, NULL); - } - error = g_strdup( _("Incorrect password")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0x06: /* need activation */ - error = g_strdup( _("Activation required")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - - default: - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, - ">>> [default] decrypt and dump"); - error = g_strdup_printf( - _("Unknown reply code when logging in (0x%02X)"), - ret ); - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - - msg = g_strndup((gchar *)data + 1, data_len - 1); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - - purple_debug_error("QQ", "%s: %s\n", error, msg_utf8); - purple_connection_error_reason(gc, reason, msg_utf8); - - g_free(error); - g_free(msg); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; -} - -/* send keep-alive packet to QQ server (it is a heart-beat) */ -void qq_request_keep_alive(PurpleConnection *gc) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes= 0; - - qd = (qq_data *) gc->proto_data; - - /* In fact, we can send whatever we like to server - * with this command, server return the same result including - * the amount of online QQ users, my ip and port */ - bytes += qq_put32(raw_data + bytes, qd->uid); - qq_send_cmd(gc, QQ_CMD_KEEP_ALIVE, raw_data, bytes); -} - -/* parse the return ofqq_process_keep_alive keep-alive packet, it includes some system information */ -gboolean qq_process_keep_alive(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gchar **segments; - - g_return_val_if_fail(data != NULL, FALSE); - g_return_val_if_fail(data_len != 0, FALSE); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Keep alive reply packet", data, len); */ - - /* the last one is 60, don't know what it is */ - segments = split_data(data, data_len, "\x1f", 6); - if (segments == NULL) - return TRUE; - - /* segments[0] and segment[1] are all 0x30 ("0") */ - qd->online_total = strtol(segments[2], NULL, 10); - if(0 == qd->online_total) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - } - qd->my_ip.s_addr = inet_addr(segments[3]); - qd->my_port = strtol(segments[4], NULL, 10); - - purple_debug_info("QQ", "keep alive, %s:%d\n", - inet_ntoa(qd->my_ip), qd->my_port); - - g_strfreev(segments); - return TRUE; -} - -void qq_request_keep_alive_2007(PurpleConnection *gc) -{ - qq_data *qd; - guint8 raw_data[32] = {0}; - gint bytes= 0; - gchar *uid_str; - - qd = (qq_data *) gc->proto_data; - - /* In fact, we can send whatever we like to server - * with this command, server return the same result including - * the amount of online QQ users, my ip and port */ - uid_str = g_strdup_printf("%u", qd->uid); - bytes += qq_putdata(raw_data + bytes, (guint8 *)uid_str, strlen(uid_str)); - qq_send_cmd(gc, QQ_CMD_KEEP_ALIVE, raw_data, bytes); - - g_free(uid_str); -} - -gboolean qq_process_keep_alive_2007(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes= 0; - guint8 ret; - - g_return_val_if_fail(data != NULL && data_len != 0, FALSE); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Keep alive reply packet", data, len); */ - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - bytes += qq_get32(&qd->online_total, data + bytes); - if(0 == qd->online_total) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - } - - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - return TRUE; -} - -void qq_request_keep_alive_2008(PurpleConnection *gc) -{ - qq_data *qd; - guint8 raw_data[16] = {0}; - gint bytes= 0; - - qd = (qq_data *) gc->proto_data; - - /* In fact, we can send whatever we like to server - * with this command, server return the same result including - * the amount of online QQ users, my ip and port */ - bytes += qq_put32(raw_data + bytes, qd->uid); - bytes += qq_putime(raw_data + bytes, &qd->login_time); - qq_send_cmd(gc, QQ_CMD_KEEP_ALIVE, raw_data, bytes); -} - -gboolean qq_process_keep_alive_2008(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes= 0; - guint8 ret; - time_t server_time; - struct tm *tm_local; - - g_return_val_if_fail(data != NULL && data_len != 0, FALSE); - - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Keep alive reply packet", data, len); */ - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - bytes += qq_get32(&qd->online_total, data + bytes); - if(0 == qd->online_total) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - } - - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - /* skip 2 byytes, 0x(00 3c) */ - bytes += 2; - bytes += qq_getime(&server_time, data + bytes); - /* skip 5 bytes, all are 0 */ - - purple_debug_info("QQ", "keep alive, %s:%d\n", - inet_ntoa(qd->my_ip), qd->my_port); - - tm_local = localtime(&server_time); - purple_debug_info("QQ", "Server time: %d-%d-%d, %d:%d:%d\n", - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - return TRUE; -} - -/* For QQ2007/2008 */ -void qq_request_get_server(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - raw_data = g_newa(guint8, 128); - memset(raw_data, 0, 128); - - encrypted = g_newa(guint8, 128 + 17); /* 17 bytes more */ - - bytes = 0; - if (qd->redirect == NULL) { - /* first packet to get server */ - qd->redirect_len = 15; - qd->redirect = g_realloc(qd->redirect, qd->redirect_len); - memset(qd->redirect, 0, qd->redirect_len); - } - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_GET_SERVER, qd->send_seq, buf, bytes, TRUE); -} - -guint16 qq_process_get_server(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint16 ret; - - g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - g_return_val_if_fail (data != NULL, QQ_LOGIN_REPLY_ERR); - - /* qq_show_packet("Get Server", data, data_len); */ - bytes = 0; - bytes += qq_get16(&ret, data + bytes); - if (ret == 0) { - /* Notice: do not clear redirect_data here. It will be used in login*/ - qd->redirect_ip.s_addr = 0; - return QQ_LOGIN_REPLY_OK; - } - - if (data_len < 15) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt server reply")); - return QQ_LOGIN_REPLY_ERR; - } - - qd->redirect_len = data_len; - qd->redirect = g_realloc(qd->redirect, qd->redirect_len); - qq_getdata(qd->redirect, qd->redirect_len, data); - /* qq_show_packet("Redirect to", qd->redirect, qd->redirect_len); */ - - qq_getIP(&qd->redirect_ip, data + 11); - purple_debug_info("QQ", "Get server %s\n", inet_ntoa(qd->redirect_ip)); - return QQ_LOGIN_REPLY_REDIRECT; -} - -void qq_request_token_ex(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - bytes += qq_put8(raw_data + bytes, 3); /* Subcommand */ - bytes += qq_put16(raw_data + bytes, 5); - bytes += qq_put32(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, 0); /* fragment index */ - bytes += qq_put16(raw_data + bytes, 0); /* captcha token */ - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN_EX, qd->send_seq, buf, bytes, TRUE); -} - -void qq_request_token_ex_next(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - bytes += qq_put8(raw_data + bytes, 3); /* Subcommand */ - bytes += qq_put16(raw_data + bytes, 5); - bytes += qq_put32(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, qd->captcha.next_index); /* fragment index */ - bytes += qq_put16(raw_data + bytes, qd->captcha.token_len); /* captcha token */ - bytes += qq_putdata(raw_data + bytes, qd->captcha.token, qd->captcha.token_len); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN_EX, qd->send_seq, buf, bytes, TRUE); - - purple_connection_update_progress(gc, _("Requesting captcha"), 3, QQ_CONNECT_STEPS); -} - -static void request_token_ex_code(PurpleConnection *gc, - guint8 *token, guint16 token_len, guint8 *code, guint16 code_len) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - g_return_if_fail(code != NULL && code_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - bytes = 0; - bytes += qq_put8(raw_data + bytes, qd->ld.token_len); - bytes += qq_putdata(raw_data + bytes, qd->ld.token, qd->ld.token_len); - bytes += qq_put8(raw_data + bytes, 4); /* Subcommand */ - bytes += qq_put16(raw_data + bytes, 5); - bytes += qq_put32(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, code_len); - bytes += qq_putdata(raw_data + bytes, code, code_len); - bytes += qq_put16(raw_data + bytes, qd->ld.token_ex_len); /* login token ex */ - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_TOKEN_EX, qd->send_seq, buf, bytes, TRUE); - - purple_connection_update_progress(gc, _("Checking captcha"), 3, QQ_CONNECT_STEPS); -} - -typedef struct { - PurpleConnection *gc; - guint8 *token; - guint16 token_len; -} qq_captcha_request; - -static void captcha_request_destory(qq_captcha_request *captcha_req) -{ - g_return_if_fail(captcha_req != NULL); - if (captcha_req->token) g_free(captcha_req->token); - g_free(captcha_req); -} - -static void captcha_input_cancel_cb(qq_captcha_request *captcha_req, - PurpleRequestFields *fields) -{ - captcha_request_destory(captcha_req); - - purple_connection_error_reason(captcha_req->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Failed captcha verification")); -} - -static void captcha_input_ok_cb(qq_captcha_request *captcha_req, - PurpleRequestFields *fields) -{ - gchar *code; - - g_return_if_fail(captcha_req != NULL && captcha_req->gc != NULL); - - code = utf8_to_qq( - purple_request_fields_get_string(fields, "captcha_code"), - QQ_CHARSET_DEFAULT); - - if (strlen(code) <= 0) { - captcha_input_cancel_cb(captcha_req, fields); - return; - } - - request_token_ex_code(captcha_req->gc, - captcha_req->token, captcha_req->token_len, - (guint8 *)code, strlen(code)); - - captcha_request_destory(captcha_req); -} - -void qq_captcha_input_dialog(PurpleConnection *gc,qq_captcha_data *captcha) -{ - PurpleAccount *account; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - qq_captcha_request *captcha_req; - - g_return_if_fail(captcha->token != NULL && captcha->token_len > 0); - g_return_if_fail(captcha->data != NULL && captcha->data_len > 0); - - captcha_req = g_new0(qq_captcha_request, 1); - captcha_req->gc = gc; - captcha_req->token = g_new0(guint8, captcha->token_len); - g_memmove(captcha_req->token, captcha->token, captcha->token_len); - captcha_req->token_len = captcha->token_len; - - account = purple_connection_get_account(gc); - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_image_new("captcha_img", - _("Captcha Image"), (char *)captcha->data, captcha->data_len); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("captcha_code", - _("Enter code"), "", FALSE); - purple_request_field_string_set_masked(field, FALSE); - purple_request_field_group_add_field(group, field); - - purple_request_fields(account, - _("QQ Captcha Verification"), - _("QQ Captcha Verification"), - _("Enter the text from the image"), - fields, - _("OK"), G_CALLBACK(captcha_input_ok_cb), - _("Cancel"), G_CALLBACK(captcha_input_cancel_cb), - purple_connection_get_account(gc), NULL, NULL, - captcha_req); -} - -guint8 qq_process_token_ex(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - int bytes; - guint8 ret; - guint8 sub_cmd; - guint8 reply; - guint16 captcha_len; - guint8 curr_index; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - ret = data[0]; - - bytes = 0; - bytes += qq_get8(&sub_cmd, data + bytes); /* 03: ok; 04: need verifying */ - bytes += 2; /* 0x(00 05) */ - bytes += qq_get8(&reply, data + bytes); - - bytes += qq_get16(&(qd->ld.token_ex_len), data + bytes); - qd->ld.token_ex = g_realloc(qd->ld.token_ex, qd->ld.token_ex_len); - bytes += qq_getdata(qd->ld.token_ex, qd->ld.token_ex_len, data + bytes); - /* qq_show_packet("Get token ex", qd->ld.token_ex, qd->ld.token_ex_len); */ - - if(reply != 1) - { - purple_debug_info("QQ", "Captcha verified, result %d\n", reply); - return QQ_LOGIN_REPLY_OK; - } - - bytes += qq_get16(&captcha_len, data + bytes); - - qd->captcha.data = g_realloc(qd->captcha.data, qd->captcha.data_len + captcha_len); - bytes += qq_getdata(qd->captcha.data + qd->captcha.data_len, captcha_len, data + bytes); - qd->captcha.data_len += captcha_len; - - bytes += qq_get8(&curr_index, data + bytes); - bytes += qq_get8(&qd->captcha.next_index, data + bytes); - - bytes += qq_get16(&qd->captcha.token_len, data + bytes); - qd->captcha.token = g_realloc(qd->captcha.token, qd->captcha.token_len); - bytes += qq_getdata(qd->captcha.token, qd->captcha.token_len, data + bytes); - /* qq_show_packet("Get captcha token", qd->captcha.token, qd->captcha.token_len); */ - - purple_debug_info("QQ", "Request next captcha %d, new %d, total %d\n", - qd->captcha.next_index, captcha_len, qd->captcha.data_len); - if(qd->captcha.next_index > 0) - { - return QQ_LOGIN_REPLY_NEXT_TOKEN_EX; - } - - return QQ_LOGIN_REPLY_CAPTCHA_DLG; -} - -/* source copy from gg's common.c */ -static guint32 crc32_table[256]; -static int crc32_initialized = 0; - -static void crc32_make_table() -{ - guint32 h = 1; - unsigned int i, j; - - memset(crc32_table, 0, sizeof(crc32_table)); - - for (i = 128; i; i >>= 1) { - h = (h >> 1) ^ ((h & 1) ? 0xedb88320L : 0); - - for (j = 0; j < 256; j += 2 * i) - crc32_table[i + j] = crc32_table[j] ^ h; - } - - crc32_initialized = 1; -} - -static guint32 crc32(guint32 crc, const guint8 *buf, int len) -{ - if (!crc32_initialized) - crc32_make_table(); - - if (!buf || len < 0) - return crc; - - crc ^= 0xffffffffL; - - while (len--) - crc = (crc >> 8) ^ crc32_table[(crc ^ *buf++) & 0xff]; - - return crc ^ 0xffffffffL; -} - -void qq_request_check_pwd(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - static guint8 header[] = { - 0x00, 0x5F, 0x00, 0x00, 0x08, 0x04, 0x01, 0xE0 - }; - static guint8 unknown[] = { - 0xDB, 0xB9, 0xF3, 0x0B, 0xF9, 0x13, 0x87, 0xB2, - 0xE6, 0x20, 0x43, 0xBE, 0x53, 0xCA, 0x65, 0x03 - }; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token_ex != NULL && qd->ld.token_ex_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - /* Encrypted password and put in encrypted */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, qd->ld.pwd_md5, sizeof(qd->ld.pwd_md5)); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, rand() & 0xffff); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.pwd_twice_md5); - - /* create packet */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, header, sizeof(header)); - /* token get from qq_request_token_ex */ - bytes += qq_put8(raw_data + bytes, (guint8)(qd->ld.token_ex_len & 0xff)); - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - /* password encrypted */ - bytes += qq_put16(raw_data + bytes, encrypted_len); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* len of unknown + len of CRC32 */ - bytes += qq_put16(raw_data + bytes, sizeof(unknown) + 4); - bytes += qq_putdata(raw_data + bytes, unknown, sizeof(unknown)); - bytes += qq_put32( - raw_data + bytes, crc32(0xFFFFFFFF, unknown, sizeof(unknown))); - - /* put length into first 2 bytes */ - qq_put8(raw_data + 1, bytes - 2); - - /* tail */ - bytes += qq_put16(raw_data + bytes, 0x0003); - bytes += qq_put8(raw_data + bytes, 0); - bytes += qq_put8(raw_data + bytes, qd->ld.pwd_md5[1]); - bytes += qq_put8(raw_data + bytes, qd->ld.pwd_md5[2]); - - /* qq_show_packet("Check password", raw_data, bytes); */ - /* Encrypted by random key*/ - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.random_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - bytes += qq_putdata(buf + bytes, qd->ld.random_key, QQ_KEY_LENGTH); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_CHECK_PWD, qd->send_seq, buf, bytes, TRUE); -} - -guint8 qq_process_check_pwd( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - int bytes; - guint8 ret; - gchar *error = NULL; - guint16 unknow_token_len; - gchar *msg, *msg_utf8; - guint16 msg_len; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - /* qq_show_packet("Check password reply", data, data_len); */ - - bytes = 0; - bytes += qq_get16(&unknow_token_len, data + bytes); /* maybe total length */ - bytes += qq_get8(&ret, data + bytes); - bytes += 4; /* 0x(00 00 6d b9) */ - /* unknow_token_len may 0 when not reply ok*/ - bytes += qq_get16(&unknow_token_len, data + bytes); /* 0x0020 */ - bytes += unknow_token_len; - bytes += qq_get16(&unknow_token_len, data + bytes); /* 0x0020 */ - bytes += unknow_token_len; - - if (ret == 0) { - /* get login_token */ - bytes += qq_get16(&qd->ld.login_token_len, data + bytes); - if (qd->ld.login_token != NULL) g_free(qd->ld.login_token); - qd->ld.login_token = g_new0(guint8, qd->ld.login_token_len); - bytes += qq_getdata(qd->ld.login_token, qd->ld.login_token_len, data + bytes); - /* qq_show_packet("Get login token", qd->ld.login_token, qd->ld.login_token_len); */ - - /* get login_key */ - bytes += qq_getdata(qd->ld.login_key, sizeof(qd->ld.login_key), data + bytes); - /* qq_show_packet("Get login key", qd->ld.login_key, sizeof(qd->ld.login_key)); */ - return QQ_LOGIN_REPLY_OK; - } - - switch (ret) - { - case 0x34: /* invalid password */ - if (!purple_account_get_remember_password(gc->account)) { - purple_account_set_password(gc->account, NULL); - } - error = g_strdup(_("Incorrect password")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0x33: /* need activation */ - case 0x51: /* need activation */ - error = g_strdup(_("Activation required")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 0xBF: /* uid is not exist */ - error = g_strdup(_("Username does not exist")); - reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - default: - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, - ">>> [default] decrypt and dump"); - error = g_strdup_printf( - _("Unknown reply when checking password (0x%02X)"), - ret ); - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - - bytes += qq_get16(&msg_len, data + bytes); - - msg = g_strndup((gchar *)data + bytes, msg_len); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - - purple_debug_error("QQ", "%s: %s\n", error, msg_utf8); - purple_connection_error_reason(gc, reason, msg_utf8); - - g_free(error); - g_free(msg); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; -} - -void qq_request_login_2007(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - static const guint8 login_1_16[] = { - 0x56, 0x4E, 0xC8, 0xFB, 0x0A, 0x4F, 0xEF, 0xB3, - 0x7A, 0x5D, 0xD8, 0x86, 0x0F, 0xAC, 0xE5, 0x1A - }; - static const guint8 login_2_16[] = { - 0x5E, 0x22, 0x3A, 0xBE, 0x13, 0xBF, 0xDA, 0x4C, - 0xA9, 0xB7, 0x0B, 0x43, 0x63, 0x51, 0x8E, 0x28 - }; - static const guint8 login_3_83[] = { - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x40, 0x01, 0x01, 0x58, 0x83, - 0xD0, 0x00, 0x10, 0x9D, 0x14, 0x64, 0x0A, 0x2E, - 0xE2, 0x11, 0xF7, 0x90, 0xF0, 0xB5, 0x5F, 0x16, - 0xFB, 0x41, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x76, 0x3C, 0xEE, - 0x4A, 0x00, 0x10, 0x86, 0x81, 0xAD, 0x1F, 0xC8, - 0xC9, 0xCC, 0xCF, 0xCA, 0x9F, 0xFF, 0x88, 0xC0, - 0x5C, 0x88, 0xD5 - }; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - /* Encrypted password and put in encrypted */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, qd->ld.pwd_md5, sizeof(qd->ld.pwd_md5)); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, 0xffff); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.pwd_twice_md5); - - /* create packet */ - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); /* Unknow */ - /* password encrypted */ - bytes += qq_put16(raw_data + bytes, encrypted_len); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* put data which NULL string encrypted by key pwd_twice_md5 */ - encrypted_len = qq_encrypt(encrypted, (guint8 *) "", 0, qd->ld.pwd_twice_md5); - g_return_if_fail(encrypted_len == 16); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* unknow fill 0 */ - memset(raw_data + bytes, 0, 19); - bytes += 19; - bytes += qq_putdata(raw_data + bytes, login_1_16, sizeof(login_1_16)); - - bytes += qq_put8(raw_data + bytes, rand() & 0xff); - bytes += qq_put8(raw_data + bytes, qd->login_mode); - /* unknow 10 bytes zero filled*/ - memset(raw_data + bytes, 0, 10); - bytes += 10; - /* redirect data, 15 bytes */ - /* qq_show_packet("Redirect", qd->redirect, qd->redirect_len); */ - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_2_16, sizeof(login_2_16)); - /* captcha token get from qq_process_token_ex */ - bytes += qq_put8(raw_data + bytes, (guint8)(qd->ld.token_ex_len & 0xff)); - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_3_83, sizeof(login_3_83)); - memset(raw_data + bytes, 0, 332 - sizeof(login_3_83)); - bytes += 332 - sizeof(login_3_83); - - /* qq_show_packet("Login", raw_data, bytes); */ - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.login_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - /* logint token get from qq_process_check_pwd_2007 */ - bytes += qq_put16(buf + bytes, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, qd->ld.login_token, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_LOGIN, qd->send_seq, buf, bytes, TRUE); -} - -/* process the login reply packet */ -guint8 qq_process_login_2007( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint8 ret; - guint32 uid; - gchar *error; - gchar *msg; - gchar *msg_utf8; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - if (ret != 0) { - msg = g_strndup((gchar *)data + bytes, data_len - bytes); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - - switch (ret) { - case 0x05: - purple_debug_error("QQ", "Server busy for %s\n", msg_utf8); - return QQ_LOGIN_REPLY_REDIRECT; - case 0x0A: - /* 0a 2d 9a 4b 9a 01 01 00 00 00 05 00 00 00 00 79 0e 5f fd */ - /* Missing get server before login*/ - default: - error = g_strdup_printf( - _("Unknown reply code when logging in (0x%02X):\n%s"), - ret, msg_utf8); - break; - } - - purple_debug_error("QQ", "%s\n", error); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - error); - - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, error); - - g_free(error); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; - } - - bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); - purple_debug_info("QQ", "Got session_key\n"); - get_session_md5(qd->session_md5, qd->uid, qd->session_key); - - bytes += qq_get32(&uid, data + bytes); - if (uid != qd->uid) { - purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); - } - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - bytes += qq_getIP(&qd->my_local_ip, data + bytes); - bytes += qq_get16(&qd->my_local_port, data + bytes); - bytes += qq_getime(&qd->login_time, data + bytes); - /* skip unknow 50 byte */ - bytes += 50; - /* skip client key 32 byte */ - bytes += 32; - /* skip unknow 12 byte */ - bytes += 12; - /* last login */ - bytes += qq_getIP(&qd->last_login_ip, data + bytes); - bytes += qq_getime(&qd->last_login_time[0], data + bytes); - purple_debug_info("QQ", "Last Login: %s, %s\n", - inet_ntoa(qd->last_login_ip), ctime(&qd->last_login_time[0])); - return QQ_LOGIN_REPLY_OK; -} - -void qq_request_login_2008(PurpleConnection *gc) -{ - qq_data *qd; - guint8 *buf, *raw_data; - gint bytes; - guint8 *encrypted; - gint encrypted_len; - guint8 index, count; - - static const guint8 login_1_16[] = { - 0xD2, 0x41, 0x75, 0x12, 0xC2, 0x86, 0x57, 0x10, - 0x78, 0x57, 0xDC, 0x24, 0x8C, 0xAA, 0x8F, 0x4E - }; - - static const guint8 login_2_16[] = { - 0x94, 0x0B, 0x73, 0x7A, 0xA2, 0x51, 0xF0, 0x4B, - 0x95, 0x2F, 0xC6, 0x0A, 0x5B, 0xF6, 0x76, 0x52 - }; - static const guint8 login_3_18[] = { - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x40, 0x01, 0x1b, 0x02, 0x84, - 0x50, 0x00 - }; - static const guint8 login_4_16[] = { - 0x2D, 0x49, 0x15, 0x55, 0x78, 0xFC, 0xF3, 0xD4, - 0x53, 0x55, 0x60, 0x9C, 0x37, 0x9F, 0xE9, 0x59 - }; - static const guint8 login_5_6[] = { - 0x02, 0x68, 0xe8, 0x07, 0x83, 0x00 - }; - static const guint8 login_6_16[] = { - 0x3B, 0xCE, 0x43, 0xF1, 0x8B, 0xA4, 0x2B, 0xB5, - 0xB3, 0x51, 0x57, 0xF7, 0x06, 0x4B, 0x18, 0xFC - }; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0); - - raw_data = g_newa(guint8, MAX_PACKET_SIZE - 17); - memset(raw_data, 0, MAX_PACKET_SIZE - 17); - - encrypted = g_newa(guint8, MAX_PACKET_SIZE); /* 17 bytes more */ - - /* Encrypted password and put in encrypted */ - bytes = 0; - bytes += qq_putdata(raw_data + bytes, qd->ld.pwd_md5, sizeof(qd->ld.pwd_md5)); - bytes += qq_put16(raw_data + bytes, 0); - bytes += qq_put16(raw_data + bytes, 0xffff); - - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.pwd_twice_md5); - - /* create packet */ - bytes = 0; - bytes += qq_put16(raw_data + bytes, 0); /* Unknow */ - /* password encrypted */ - bytes += qq_put16(raw_data + bytes, encrypted_len); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* put data which NULL string encrypted by key pwd_twice_md5 */ - encrypted_len = qq_encrypt(encrypted, (guint8 *) "", 0, qd->ld.pwd_twice_md5); - g_return_if_fail(encrypted_len == 16); - bytes += qq_putdata(raw_data + bytes, encrypted, encrypted_len); - /* unknow 19 bytes zero filled*/ - memset(raw_data + bytes, 0, 19); - bytes += 19; - bytes += qq_putdata(raw_data + bytes, login_1_16, sizeof(login_1_16)); - - index = rand() % 3; /* can be set as 1 */ - for( count = 0; count < encrypted_len; count++ ) - index ^= encrypted[count]; - for( count = 0; count < sizeof(login_1_16); count++ ) - index ^= login_1_16[count]; - bytes += qq_put8(raw_data + bytes, index); /* random in QQ 2007*/ - - bytes += qq_put8(raw_data + bytes, qd->login_mode); - /* unknow 10 bytes zero filled*/ - memset(raw_data + bytes, 0, 10); - bytes += 10; - /* redirect data, 15 bytes */ - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_2_16, sizeof(login_2_16)); - /* captcha token get from qq_process_token_ex */ - bytes += qq_put8(raw_data + bytes, (guint8)(qd->ld.token_ex_len & 0xff)); - bytes += qq_putdata(raw_data + bytes, qd->ld.token_ex, qd->ld.token_ex_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_3_18, sizeof(login_3_18)); - bytes += qq_put8(raw_data + bytes , sizeof(login_4_16)); - bytes += qq_putdata(raw_data + bytes, login_4_16, sizeof(login_4_16)); - /* unknow 10 bytes zero filled*/ - memset(raw_data + bytes, 0, 10); - bytes += 10; - /* redirect data, 15 bytes */ - bytes += qq_putdata(raw_data + bytes, qd->redirect, qd->redirect_len); - /* unknow fill */ - bytes += qq_putdata(raw_data + bytes, login_5_6, sizeof(login_5_6)); - bytes += qq_put8(raw_data + bytes , sizeof(login_6_16)); - bytes += qq_putdata(raw_data + bytes, login_6_16, sizeof(login_6_16)); - /* unknow 249 bytes zero filled*/ - memset(raw_data + bytes, 0, 249); - bytes += 249; - - /* qq_show_packet("Login request", raw_data, bytes); */ - encrypted_len = qq_encrypt(encrypted, raw_data, bytes, qd->ld.login_key); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - bytes = 0; - /* logint token get from qq_process_check_pwd_2007 */ - bytes += qq_put16(buf + bytes, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, qd->ld.login_token, qd->ld.login_token_len); - bytes += qq_putdata(buf + bytes, encrypted, encrypted_len); - - qd->send_seq++; - qq_send_cmd_encrypted(gc, QQ_CMD_LOGIN, qd->send_seq, buf, bytes, TRUE); -} - -guint8 qq_process_login_2008( PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint bytes; - guint8 ret; - guint32 uid; - gchar *error; - gchar *msg; - gchar *msg_utf8; - - g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR); - - qd = (qq_data *) gc->proto_data; - - bytes = 0; - bytes += qq_get8(&ret, data + bytes); - if (ret != 0) { - msg = g_strndup((gchar *)data + bytes, data_len - bytes); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - - switch (ret) { - case 0x05: - purple_debug_error("QQ", "Server busy for %s\n", msg_utf8); - return QQ_LOGIN_REPLY_REDIRECT; - break; - default: - error = g_strdup_printf( - _("Unknown reply code when logging in (0x%02X):\n%s"), - ret, msg_utf8); - break; - } - - purple_debug_error("QQ", "%s\n", error); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - error); - - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", data, data_len, error); - - g_free(error); - g_free(msg_utf8); - return QQ_LOGIN_REPLY_ERR; - } - - bytes += qq_getdata(qd->session_key, sizeof(qd->session_key), data + bytes); - purple_debug_info("QQ", "Got session_key\n"); - get_session_md5(qd->session_md5, qd->uid, qd->session_key); - - bytes += qq_get32(&uid, data + bytes); - if (uid != qd->uid) { - purple_debug_warning("QQ", "My uid in login reply is %u, not %u\n", uid, qd->uid); - } - bytes += qq_getIP(&qd->my_ip, data + bytes); - bytes += qq_get16(&qd->my_port, data + bytes); - bytes += qq_getIP(&qd->my_local_ip, data + bytes); - bytes += qq_get16(&qd->my_local_port, data + bytes); - bytes += qq_getime(&qd->login_time, data + bytes); - /* skip 1 byte, always 0x03 */ - /* skip 1 byte, login mode */ - bytes = 131; - bytes += qq_getIP(&qd->last_login_ip, data + bytes); - bytes += qq_getime(&qd->last_login_time[0], data + bytes); - purple_debug_info("QQ", "Last Login: %s, %s\n", - inet_ntoa(qd->last_login_ip), ctime(&qd->last_login_time[0])); - return QQ_LOGIN_REPLY_OK; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_base.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/** - * file qq_base.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_BASE_H_ -#define _QQ_BASE_H_ - -#include -#include "connection.h" - -#define QQ_LOGIN_REPLY_OK 0x00 -#define QQ_LOGIN_REPLY_REDIRECT 0x01 -/* defined by myself */ -#define QQ_LOGIN_REPLY_CAPTCHA_DLG 0xfd -#define QQ_LOGIN_REPLY_NEXT_TOKEN_EX 0xfe -#define QQ_LOGIN_REPLY_ERR 0xff - -#define QQ_LOGIN_MODE_NORMAL 0x0a -#define QQ_LOGIN_MODE_AWAY 0x1e -#define QQ_LOGIN_MODE_HIDDEN 0x28 - -#define QQ_UPDATE_ONLINE_INTERVAL 300 /* in sec */ - -void qq_request_token(PurpleConnection *gc); -guint8 qq_process_token(PurpleConnection *gc, guint8 *buf, gint buf_len); - -void qq_request_login(PurpleConnection *gc); -guint8 qq_process_login( PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_logout(PurpleConnection *gc); - -void qq_request_keep_alive(PurpleConnection *gc); -gboolean qq_process_keep_alive(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_keep_alive_2007(PurpleConnection *gc); -gboolean qq_process_keep_alive_2007(guint8 *data, gint data_len, PurpleConnection *gc); - -void qq_request_keep_alive_2008(PurpleConnection *gc); -gboolean qq_process_keep_alive_2008(guint8 *data, gint data_len, PurpleConnection *gc); - -/* for QQ2007/2008 */ -void qq_request_get_server(PurpleConnection *gc); -guint16 qq_process_get_server(PurpleConnection *gc, guint8 *rcved, gint rcved_len); - -void qq_request_token_ex(PurpleConnection *gc); -void qq_request_token_ex_next(PurpleConnection *gc); -guint8 qq_process_token_ex(PurpleConnection *gc, guint8 *buf, gint buf_len); -void qq_captcha_input_dialog(PurpleConnection *gc,qq_captcha_data *captcha); - -void qq_request_check_pwd(PurpleConnection *gc); -guint8 qq_process_check_pwd( PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_login_2007(PurpleConnection *gc); -guint8 qq_process_login_2007( PurpleConnection *gc, guint8 *data, gint data_len); - -void qq_request_login_2008(PurpleConnection *gc); -guint8 qq_process_login_2008( PurpleConnection *gc, guint8 *data, gint data_len); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1161 +0,0 @@ -/** - * @file qq.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "prpl.h" -#include "privacy.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -#include "buddy_info.h" -#include "buddy_memo.h" -#include "buddy_opt.h" -#include "buddy_list.h" -#include "char_conv.h" -#include "group.h" -#include "group_im.h" -#include "group_info.h" -#include "group_join.h" -#include "group_opt.h" -#include "group_internal.h" -#include "qq_define.h" -#include "im.h" -#include "qq_process.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq.h" -#include "qq_network.h" -#include "send_file.h" -#include "utils.h" -#include "version.h" - -#define OPENQ_VERSION "0.3.2-p20" - -static GList *server_list_build(gchar select) -{ - GList *list = NULL; - - if ( select == 'T' || select == 'A') { - list = g_list_append(list, "tcpconn.tencent.com:8000"); - list = g_list_append(list, "tcpconn2.tencent.com:8000"); - list = g_list_append(list, "tcpconn3.tencent.com:8000"); - list = g_list_append(list, "tcpconn4.tencent.com:8000"); - list = g_list_append(list, "tcpconn5.tencent.com:8000"); - list = g_list_append(list, "tcpconn6.tencent.com:8000"); - } - if ( select == 'U' || select == 'A') { - list = g_list_append(list, "sz.tencent.com:8000"); - list = g_list_append(list, "sz2.tencent.com:8000"); - list = g_list_append(list, "sz3.tencent.com:8000"); - list = g_list_append(list, "sz4.tencent.com:8000"); - list = g_list_append(list, "sz5.tencent.com:8000"); - list = g_list_append(list, "sz6.tencent.com:8000"); - list = g_list_append(list, "sz7.tencent.com:8000"); - list = g_list_append(list, "sz8.tencent.com:8000"); - list = g_list_append(list, "sz9.tencent.com:8000"); - } - return list; -} - -static void server_list_create(PurpleAccount *account) -{ - PurpleConnection *gc; - qq_data *qd; - PurpleProxyInfo *gpi; - const gchar *custom_server; - - gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = gc->proto_data; - - gpi = purple_proxy_get_setup(account); - - qd->use_tcp = purple_account_get_bool(account, "use_tcp", TRUE); - - custom_server = purple_account_get_string(account, "server", NULL); - - if (custom_server != NULL) { - purple_debug_info("QQ", "Select server '%s'\n", custom_server); - if (*custom_server != '\0' && g_ascii_strcasecmp(custom_server, "auto") != 0) { - qd->servers = g_list_append(qd->servers, g_strdup(custom_server)); - return; - } - } - - if (qd->use_tcp) { - qd->servers = server_list_build('T'); - return; - } - - qd->servers = server_list_build('U'); -} - -static void server_list_remove_all(qq_data *qd) -{ - g_return_if_fail(qd != NULL); - - purple_debug_info("QQ", "free server list\n"); - g_list_free(qd->servers); - qd->curr_server = NULL; -} - -static void qq_login(PurpleAccount *account) -{ - PurpleConnection *gc; - qq_data *qd; - PurplePresence *presence; - const gchar *version_str; - - g_return_if_fail(account != NULL); - - gc = purple_account_get_connection(account); - g_return_if_fail(gc != NULL); - - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_AUTO_RESP; - - qd = g_new0(qq_data, 1); - memset(qd, 0, sizeof(qq_data)); - qd->gc = gc; - gc->proto_data = qd; - - presence = purple_account_get_presence(account); - if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { - qd->login_mode = QQ_LOGIN_MODE_HIDDEN; - } else if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) - || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY)) { - qd->login_mode = QQ_LOGIN_MODE_AWAY; - } else { - qd->login_mode = QQ_LOGIN_MODE_NORMAL; - } - - server_list_create(account); - purple_debug_info("QQ", "Server list has %d\n", g_list_length(qd->servers)); - - version_str = purple_account_get_string(account, "client_version", NULL); - qd->client_tag = QQ_CLIENT_0D55; /* set default as QQ2005 */ - qd->client_version = 2005; - if (version_str != NULL && strlen(version_str) != 0) { - if (strcmp(version_str, "qq2007") == 0) { - qd->client_tag = QQ_CLIENT_111D; - qd->client_version = 2007; - } else if (strcmp(version_str, "qq2008") == 0) { - qd->client_tag = QQ_CLIENT_115B; - qd->client_version = 2008; - } - } - - qd->is_show_notice = purple_account_get_bool(account, "show_notice", TRUE); - qd->is_show_news = purple_account_get_bool(account, "show_news", TRUE); - qd->is_show_chat = purple_account_get_bool(account, "show_chat", TRUE); - - qd->resend_times = purple_prefs_get_int("/plugins/prpl/qq/resend_times"); - if (qd->resend_times <= 1) qd->itv_config.resend = 4; - - qd->itv_config.resend = purple_prefs_get_int("/plugins/prpl/qq/resend_interval"); - if (qd->itv_config.resend <= 0) qd->itv_config.resend = 3; - purple_debug_info("QQ", "Resend interval %d, retries %d\n", - qd->itv_config.resend, qd->resend_times); - - qd->itv_config.keep_alive = purple_account_get_int(account, "keep_alive_interval", 60); - if (qd->itv_config.keep_alive < 30) qd->itv_config.keep_alive = 30; - qd->itv_config.keep_alive /= qd->itv_config.resend; - qd->itv_count.keep_alive = qd->itv_config.keep_alive; - - qd->itv_config.update = purple_account_get_int(account, "update_interval", 300); - if (qd->itv_config.update > 0) { - if (qd->itv_config.update < qd->itv_config.keep_alive) { - qd->itv_config.update = qd->itv_config.keep_alive; - } - qd->itv_config.update /= qd->itv_config.resend; - qd->itv_count.update = qd->itv_config.update; - } else { - qd->itv_config.update = 0; - } - - qd->connect_watcher = purple_timeout_add_seconds(0, qq_connect_later, gc); -} - -/* clean up the given QQ connection and free all resources */ -static void qq_close(PurpleConnection *gc) -{ - qq_data *qd; - - g_return_if_fail(gc != NULL && gc->proto_data); - qd = gc->proto_data; - - if (qd->check_watcher > 0) { - purple_timeout_remove(qd->check_watcher); - qd->check_watcher = 0; - } - - if (qd->connect_watcher > 0) { - purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = 0; - } - - qq_disconnect(gc); - - if (qd->redirect) g_free(qd->redirect); - if (qd->ld.token) g_free(qd->ld.token); - if (qd->ld.token_ex) g_free(qd->ld.token_ex); - if (qd->captcha.token) g_free(qd->captcha.token); - if (qd->captcha.data) g_free(qd->captcha.data); - - server_list_remove_all(qd); - - g_free(qd); - gc->proto_data = NULL; -} - -/* returns the icon name for a buddy or protocol */ -static const gchar *qq_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "qq"; -} - - -/* a short status text beside buddy icon*/ -static gchar *qq_status_text(PurpleBuddy *b) -{ - qq_buddy_data *bd; - GString *status; - - bd = purple_buddy_get_protocol_data(b); - if (bd == NULL) - return NULL; - - status = g_string_new(""); - - switch(bd->status) { - case QQ_BUDDY_OFFLINE: - g_string_append(status, _("Offline")); - break; - case QQ_BUDDY_ONLINE_NORMAL: - g_string_append(status, _("Online")); - break; - /* TODO What does this status mean? Labelling it as offline... */ - case QQ_BUDDY_CHANGE_TO_OFFLINE: - g_string_append(status, _("Offline")); - break; - case QQ_BUDDY_ONLINE_AWAY: - g_string_append(status, _("Away")); - break; - case QQ_BUDDY_ONLINE_INVISIBLE: - g_string_append(status, _("Invisible")); - break; - case QQ_BUDDY_ONLINE_BUSY: - g_string_append(status, _("Busy")); - break; - default: - g_string_printf(status, _("Unknown-%d"), bd->status); - } - - return g_string_free(status, FALSE); -} - - -/* a floating text when mouse is on the icon, show connection status here */ -static void qq_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - qq_buddy_data *bd; - gchar *tmp; - GString *str; - - g_return_if_fail(b != NULL); - - bd = purple_buddy_get_protocol_data(b); - if (bd == NULL) - return; - - /* if (PURPLE_BUDDY_IS_ONLINE(b) && bd != NULL) */ - if (bd->ip.s_addr != 0) { - str = g_string_new(NULL); - g_string_printf(str, "%s:%d", inet_ntoa(bd->ip), bd->port); - if (bd->comm_flag & QQ_COMM_FLAG_TCP_MODE) { - g_string_append(str, " TCP"); - } else { - g_string_append(str, " UDP"); - } - g_string_free(str, TRUE); - } - - tmp = g_strdup_printf("%d", bd->age); - purple_notify_user_info_add_pair(user_info, _("Age"), tmp); - g_free(tmp); - - switch (bd->gender) { - case QQ_BUDDY_GENDER_GG: - purple_notify_user_info_add_pair(user_info, _("Gender"), _("Male")); - break; - case QQ_BUDDY_GENDER_MM: - purple_notify_user_info_add_pair(user_info, _("Gender"), _("Female")); - break; - case QQ_BUDDY_GENDER_UNKNOWN: - purple_notify_user_info_add_pair(user_info, _("Gender"), _("Unknown")); - break; - default: - tmp = g_strdup_printf("Error (%d)", bd->gender); - purple_notify_user_info_add_pair(user_info, _("Gender"), tmp); - g_free(tmp); - } - - if (bd->level) { - tmp = g_strdup_printf("%d", bd->level); - purple_notify_user_info_add_pair(user_info, _("Level"), tmp); - g_free(tmp); - } - - str = g_string_new(NULL); - if (bd->comm_flag & QQ_COMM_FLAG_QQ_MEMBER) { - g_string_append( str, _("Member") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_QQ_VIP) { - g_string_append( str, _(" VIP") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_TCP_MODE) { - g_string_append( str, _(" TCP") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_MOBILE) { - g_string_append( str, _(" FromMobile") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_BIND_MOBILE) { - g_string_append( str, _(" BindMobile") ); - } - if (bd->comm_flag & QQ_COMM_FLAG_VIDEO) { - g_string_append( str, _(" Video") ); - } - - if (bd->ext_flag & QQ_EXT_FLAG_ZONE) { - g_string_append( str, _(" Zone") ); - } - purple_notify_user_info_add_pair(user_info, _("Flag"), str->str); - - g_string_free(str, TRUE); - -#ifdef DEBUG - tmp = g_strdup_printf( "%s (%04X)", - qq_get_ver_desc(bd->client_tag), - bd->client_tag ); - purple_notify_user_info_add_pair(user_info, _("Ver"), tmp); - g_free(tmp); - - tmp = g_strdup_printf( "Ext 0x%X, Comm 0x%X", - bd->ext_flag, bd->comm_flag ); - purple_notify_user_info_add_pair(user_info, _("Flag"), tmp); - g_free(tmp); -#endif -} - -/* we can show tiny icons on the four corners of buddy icon, */ -static const char *qq_list_emblem(PurpleBuddy *b) -{ - PurpleAccount *account; - PurpleConnection *gc; - qq_data *qd; - qq_buddy_data *buddy; - - if (!b || !(account = purple_buddy_get_account(b)) || - !(gc = purple_account_get_connection(account)) || - !(qd = purple_connection_get_protocol_data(gc))) - return NULL; - - buddy = purple_buddy_get_protocol_data(b); - if (!buddy) { - return "not-authorized"; - } - - if (buddy->comm_flag & QQ_COMM_FLAG_MOBILE) - return "mobile"; - if (buddy->comm_flag & QQ_COMM_FLAG_VIDEO) - return "video"; - if (buddy->comm_flag & QQ_COMM_FLAG_QQ_MEMBER) - return "qq_member"; - - return NULL; -} - -/* QQ away status (used to initiate QQ away packet) */ -static GList *qq_status_types(PurpleAccount *ga) -{ - PurpleStatusType *status; - GList *types = NULL; - - status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, - "available", _("Available"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_AWAY, - "away", _("Away"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, - "invisible", _("Invisible"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, - "busy", _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - "offline", _("Offline"), TRUE, TRUE, FALSE); - types = g_list_append(types, status); - - status = purple_status_type_new_full(PURPLE_STATUS_MOBILE, - "mobile", NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, status); - - return types; -} - -/* initiate QQ away with proper change_status packet */ -static void qq_change_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - - qq_request_change_status(gc, 0); -} - -/* send packet to get who's detailed information */ -static void qq_show_buddy_info(PurpleConnection *gc, const gchar *who) -{ - guint32 uid; - qq_data *qd; - - qd = gc->proto_data; - uid = purple_name_to_uid(who); - - if (uid <= 0) { - purple_debug_error("QQ", "Not valid QQid: %s\n", who); - purple_notify_error(gc, NULL, _("Invalid name"), NULL); - return; - } - - if (qd->client_version >= 2007) { - qq_request_get_level_2007(gc, uid); - } else { - qq_request_get_level(gc, uid); - } - qq_request_buddy_info(gc, uid, 0, QQ_BUDDY_INFO_DISPLAY); -} - -static void action_update_all_rooms(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - - if ( !qd->is_login ) { - return; - } - - qq_update_all_rooms(gc, 0, 0); -} - -static void action_change_icon(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - gchar *icon_name; - gchar *icon_path; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - - if ( !qd->is_login ) { - return; - } - - icon_name = qq_get_icon_name(qd->my_icon); - icon_path = qq_get_icon_path(icon_name); - g_free(icon_name); - - purple_debug_info("QQ", "Change prev icon %s to...\n", icon_path); - purple_request_file(action, _("Select icon..."), icon_path, - FALSE, - G_CALLBACK(qq_change_icon_cb), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); - g_free(icon_path); -} - -static void action_modify_info_base(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_BASE); -} - -static void action_modify_info_ext(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_EXT); -} - -static void action_modify_info_addr(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_ADDR); -} - -static void action_modify_info_contact(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_CONTACT); -} - -static void action_change_password(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - purple_notify_uri(NULL, "https://password.qq.com"); -} - -/* show a brief summary of what we get from login packet */ -static void action_show_account_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - GString *info; - struct tm *tm_local; - int index; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - info = g_string_new(""); - - tm_local = localtime(&qd->login_time); - g_string_append_printf(info, _("Login time: %d-%d-%d, %d:%d:%d
\n"), - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - g_string_append_printf(info, _("Total Online Buddies: %d
\n"), qd->online_total); - tm_local = localtime(&qd->online_last_update); - g_string_append_printf(info, _("Last Refresh: %d-%d-%d, %d:%d:%d
\n"), - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - - g_string_append(info, "
"); - - g_string_append_printf(info, _("Server: %s
\n"), qd->curr_server); - g_string_append_printf(info, _("Client Tag: %s
\n"), qq_get_ver_desc(qd->client_tag)); - g_string_append_printf(info, _("Connection Mode: %s
\n"), qd->use_tcp ? "TCP" : "UDP"); - g_string_append_printf(info, _("My Internet IP: %s:%d
\n"), inet_ntoa(qd->my_ip), qd->my_port); - - g_string_append(info, "
"); - g_string_append(info, "Network Status
\n"); - g_string_append_printf(info, _("Sent: %lu
\n"), qd->net_stat.sent); - g_string_append_printf(info, _("Resend: %lu
\n"), qd->net_stat.resend); - g_string_append_printf(info, _("Lost: %lu
\n"), qd->net_stat.lost); - g_string_append_printf(info, _("Received: %lu
\n"), qd->net_stat.rcved); - g_string_append_printf(info, _("Received Duplicate: %lu
\n"), qd->net_stat.rcved_dup); - - g_string_append(info, "
"); - g_string_append(info, "Last Login Information
\n"); - - for (index = 0; index < sizeof(qd->last_login_time) / sizeof(time_t); index++) { - tm_local = localtime(&qd->last_login_time[index]); - g_string_append_printf(info, _("Time: %d-%d-%d, %d:%d:%d
\n"), - (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday, - tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec); - } - if (qd->last_login_ip.s_addr != 0) { - g_string_append_printf(info, _("IP: %s
\n"), inet_ntoa(qd->last_login_ip)); - } - - g_string_append(info, ""); - - purple_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL); - - g_string_free(info, TRUE); -} - -static void action_about_openq(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - qq_data *qd; - GString *info; - gchar *title; - - g_return_if_fail(NULL != gc && NULL != gc->proto_data); - qd = (qq_data *) gc->proto_data; - - info = g_string_new(""); - g_string_append(info, _("

Original Author:
\n")); - g_string_append(info, "puzzlebird
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Code Contributors:
\n")); - g_string_append(info, "gfhuang(poppyer) : patches for libpurple 2.0.0beta2, maintainer
\n"); - g_string_append(info, "Yuan Qingyun : patches for libpurple 1.5.0, maintainer
\n"); - g_string_append(info, "henryouly : file transfer, udp sock5 proxy and qq_show, maintainer
\n"); - g_string_append(info, "hzhr : maintainer
\n"); - g_string_append(info, "joymarquis : maintainer
\n"); - g_string_append(info, "arfankai : fixed bugs in char_conv.c
\n"); - g_string_append(info, "rakescar : provided filter for HTML tag
\n"); - g_string_append(info, "yyw : improved performance on PPC linux
\n"); - g_string_append(info, "lvxiang : provided ip to location original code
\n"); - g_string_append(info, "markhuetsch : OpenQ merge into libpurple, maintainer 2006-2007
\n"); - g_string_append(info, "ccpaging : maintainer since 2007
\n"); - g_string_append(info, "icesky : maintainer since 2007
\n"); - g_string_append(info, "csyfek : faces, maintainer since 2007
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Lovely Patch Writers:
\n")); - g_string_append(info, "gnap : message displaying, documentation
\n"); - g_string_append(info, "manphiz : qun processing
\n"); - g_string_append(info, "moo : qun processing
\n"); - g_string_append(info, "Coly Li : qun processing
\n"); - g_string_append(info, "Emil Alexiev : captcha verification on login based on LumaQQ for MAC (2007), login, add buddy, remove buddy, message exchange and logout
\n"); - g_string_append(info, "Chengming Wang : buddy memo
\n"); - g_string_append(info, "lonicerae : chat room window bugfix, server list bugfix, buddy memo
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Acknowledgement:
\n")); - g_string_append(info, "Shufeng Tan : http://sf.net/projects/perl-oicq
\n"); - g_string_append(info, "Jeff Ye : http://www.sinomac.com
\n"); - g_string_append(info, "Hu Zheng : http://forlinux.yeah.net
\n"); - g_string_append(info, "yunfan : http://www.myswear.net
\n"); - g_string_append(info, "OpenQ Team : http://openq.linuxsir.org
\n"); - g_string_append(info, "LumaQQ Team : http://lumaqq.linuxsir.org
\n"); - g_string_append(info, "Pidgin Team : http://www.pidgin.im
\n"); - g_string_append(info, "Huang Guan : http://home.xxsyzx.com
\n"); - g_string_append(info, "OpenQ Google Group : http://groups.google.com/group/openq
\n"); - g_string_append(info, "
\n"); - - g_string_append(info, _("

Scrupulous Testers:
\n")); - g_string_append(info, "yegle
\n"); - g_string_append(info, "cnzhangbx
\n"); - g_string_append(info, "casparant
\n"); - g_string_append(info, "wd
\n"); - g_string_append(info, "x6719620
\n"); - g_string_append(info, "netelk
\n"); - g_string_append(info, _("and more, please let me know... thank you!))")); - g_string_append(info, "
\n
\n"); - g_string_append(info, _("

And, all the boys in the backroom...
\n")); - g_string_append(info, _("Feel free to join us! :)")); - g_string_append(info, ""); - - title = g_strdup_printf(_("About OpenQ %s"), OPENQ_VERSION); - purple_notify_formatted(gc, title, title, NULL, info->str, NULL, NULL); - - g_free(title); - g_string_free(info, TRUE); -} - -/* - static void _qq_menu_search_or_add_permanent_group(PurplePluginAction *action) - { - purple_roomlist_show_with_account(NULL); - } -*/ - -/* - static void _qq_menu_create_permanent_group(PurplePluginAction * action) - { - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, _("Create QQ Qun"), - _("Input Qun name here"), - _("Only QQ members can create permanent Qun"), - "OpenQ", FALSE, FALSE, NULL, - _("Create"), G_CALLBACK(qq_create_room), _("Cancel"), NULL, gc); - } -*/ - -static void action_chat_quit(PurpleBlistNode * node) -{ - PurpleChat *chat = (PurpleChat *)node; - PurpleAccount *account = purple_chat_get_account(chat); - PurpleConnection *gc = purple_account_get_connection(account); - GHashTable *components = purple_chat_get_components(chat); - gchar *num_str; - guint32 room_id; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - g_return_if_fail(components != NULL); - - num_str = g_hash_table_lookup(components, QQ_ROOM_KEY_INTERNAL_ID); - room_id = strtoul(num_str, NULL, 10); - g_return_if_fail(room_id != 0); - - qq_room_quit(gc, room_id); -} - -static void action_chat_get_info(PurpleBlistNode * node) -{ - PurpleChat *chat = (PurpleChat *)node; - PurpleAccount *account = purple_chat_get_account(chat); - PurpleConnection *gc = purple_account_get_connection(account); - GHashTable *components = purple_chat_get_components(chat); - gchar *num_str; - guint32 room_id; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - g_return_if_fail(components != NULL); - - num_str = g_hash_table_lookup(components, QQ_ROOM_KEY_INTERNAL_ID); - room_id = strtoul(num_str, NULL, 10); - g_return_if_fail(room_id != 0); - - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0, - 0, QQ_ROOM_INFO_DISPLAY); -} - -#if 0 -/* TODO: re-enable this */ -static void _qq_menu_send_file(PurpleBlistNode * node, gpointer ignored) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - qq_buddy_data *bd; - - g_return_if_fail (PURPLE_BLIST_NODE_IS_BUDDY (node)); - buddy = (PurpleBuddy *) node; - bd = (qq_buddy_data *) buddy->proto_data; - /* if (is_online (bd->status)) { */ - gc = purple_account_get_connection (buddy->account); - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qq_send_file(gc, buddy->name, NULL); - /* } */ -} -#endif - -/* protocol related menus */ -static GList *qq_actions(PurplePlugin *plugin, gpointer context) -{ - GList *m; - PurplePluginAction *act; - - m = NULL; - act = purple_plugin_action_new(_("Change Icon"), action_change_icon); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Information"), action_modify_info_base); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Extended Information"), action_modify_info_ext); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Address"), action_modify_info_addr); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Modify Contact"), action_modify_info_contact); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Change Password"), action_change_password); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Account Information"), action_show_account_info); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Update all QQ Quns"), action_update_all_rooms); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("About OpenQ"), action_about_openq); - m = g_list_append(m, act); - /* - act = purple_plugin_action_new(_("Qun: Search a permanent Qun"), _qq_menu_search_or_add_permanent_group); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Qun: Create a permanent Qun"), _qq_menu_create_permanent_group); - m = g_list_append(m, act); - */ - - return m; -} - -static void qq_add_buddy_from_menu_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - qq_add_buddy(gc, buddy, NULL); -} - -static void qq_modify_buddy_memo_from_menu_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - qq_buddy_data *bd; - PurpleConnection *gc; - guint32 bd_uid; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *)node; - g_return_if_fail(NULL != buddy); - - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - g_return_if_fail(NULL != gc); - - bd = (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); - g_return_if_fail(NULL != bd); - bd_uid = bd->uid; - - /* param: gc, uid, update_class, action - * here, update_class is set to bd_uid. because some memo packages returned - * without uid, which will make us confused */ - qq_request_buddy_memo(gc, bd_uid, bd_uid, QQ_BUDDY_MEMO_MODIFY); -} - -static GList *qq_buddy_menu(PurpleBuddy *buddy) -{ - GList *m = NULL; - PurpleMenuAction *act; - qq_buddy_data *bd = purple_buddy_get_protocol_data(buddy); - - if (bd == NULL) { - act = purple_menu_action_new(_("Add Buddy"), - PURPLE_CALLBACK(qq_add_buddy_from_menu_cb), - NULL, NULL); - m = g_list_append(m, act); - return m; - } - - - act = purple_menu_action_new(_("Modify Buddy Memo"), - PURPLE_CALLBACK(qq_modify_buddy_memo_from_menu_cb), - NULL, NULL); - m = g_list_append(m, act); - - - /* TODO : not working, temp commented out by gfhuang */ -#if 0 - if (bd && is_online(bd->status)) { - act = purple_menu_action_new(_("Send File"), PURPLE_CALLBACK(_qq_menu_send_file), NULL, NULL); /* add NULL by gfhuang */ - m = g_list_append(m, act); - } -#endif - return m; -} - -/* chat-related (QQ Qun) menu shown up with right-click */ -static GList *qq_chat_menu(PurpleBlistNode *node) -{ - GList *m; - PurpleMenuAction *act; - - m = NULL; - act = purple_menu_action_new(_("Get Info"), PURPLE_CALLBACK(action_chat_get_info), NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Quit Qun"), PURPLE_CALLBACK(action_chat_quit), NULL, NULL); - m = g_list_append(m, act); - return m; -} - -/* buddy-related menu shown up with right-click */ -static GList *qq_blist_node_menu(PurpleBlistNode * node) -{ - if(PURPLE_BLIST_NODE_IS_CHAT(node)) - return qq_chat_menu(node); - - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) - return qq_buddy_menu((PurpleBuddy *) node); - - return NULL; -} - -/* convert name displayed in a chat channel to original QQ UID */ -static gchar *chat_name_to_purple_name(const gchar *const name) -{ - const char *start; - const char *end; - gchar *ret; - - g_return_val_if_fail(name != NULL, NULL); - - /* Sample: (1234567)*/ - start = strchr(name, '('); - g_return_val_if_fail(start != NULL, NULL); - end = strchr(start, ')'); - g_return_val_if_fail(end != NULL && (end - start) > 1, NULL); - - ret = g_strndup(start + 1, end - start - 1); - - return ret; -} - -/* convert chat nickname to uid to get this buddy info */ -/* who is the nickname of buddy in QQ chat-room (Qun) */ -static void qq_get_chat_buddy_info(PurpleConnection *gc, gint channel, const gchar *who) -{ - qq_data *qd; - gchar *uid_str; - guint32 uid; - - purple_debug_info("QQ", "Get chat buddy info of %s\n", who); - g_return_if_fail(who != NULL); - - uid_str = chat_name_to_purple_name(who); - if (uid_str == NULL) { - return; - } - - qd = gc->proto_data; - uid = purple_name_to_uid(uid_str); - g_free(uid_str); - - if (uid <= 0) { - purple_debug_error("QQ", "Not valid chat name: %s\n", who); - purple_notify_error(gc, NULL, _("Invalid name"), NULL); - return; - } - - if (qd->client_version < 2007) { - qq_request_get_level(gc, uid); - } - qq_request_buddy_info(gc, uid, 0, QQ_BUDDY_INFO_DISPLAY); -} - -/* convert chat nickname to uid to invite individual IM to buddy */ -/* who is the nickname of buddy in QQ chat-room (Qun) */ -static gchar *qq_get_chat_buddy_real_name(PurpleConnection *gc, gint channel, const gchar *who) -{ - g_return_val_if_fail(who != NULL, NULL); - return chat_name_to_purple_name(who); -} - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_USE_POINTSIZE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, /* icon_spec */ - qq_list_icon, /* list_icon */ - qq_list_emblem, /* list_emblems */ - qq_status_text, /* status_text */ - qq_tooltip_text, /* tooltip_text */ - qq_status_types, /* away_states */ - qq_blist_node_menu, /* blist_node_menu */ - qq_chat_info, /* chat_info */ - qq_chat_info_defaults, /* chat_info_defaults */ - qq_login, /* open */ - qq_close, /* close */ - qq_send_im, /* send_im */ - NULL, /* set_info */ - NULL, /* send_typing */ - qq_show_buddy_info, /* get_info */ - qq_change_status, /* change status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - qq_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - qq_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - qq_group_join, /* join_chat */ - NULL, /* reject chat invite */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - qq_chat_send, /* chat_send */ - NULL, /* keepalive */ - NULL, /* register_user */ - qq_get_chat_buddy_info, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* change buddy's group */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - qq_set_custom_icon, - NULL, /* remove_group */ - qq_get_chat_buddy_real_name, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - qq_roomlist_get_list, /* roomlist_get_list */ - qq_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* qq_send_file send_file */ - NULL, /* new xfer */ - NULL, /* offline_message */ - NULL, /* PurpleWhiteboardPrplOps */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get attention_types */ - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-qq", /**< id */ - "QQ", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("QQ Protocol Plugin"), - /** description */ - N_("QQ Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - qq_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleKeyValuePair *kvp; - GList *server_list = NULL; - GList *server_kv_list = NULL; - GList *it; - /* #ifdef DEBUG */ - GList *version_kv_list = NULL; - /* #endif */ - - server_list = server_list_build('A'); - - purple_prefs_remove("/plugins/prpl/qq/serverlist"); - - server_kv_list = NULL; - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("Auto")); - kvp->value = g_strdup("auto"); - server_kv_list = g_list_append(server_kv_list, kvp); - - it = server_list; - while(it) { - if (it->data != NULL && strlen(it->data) > 0) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(it->data); - kvp->value = g_strdup(it->data); - server_kv_list = g_list_append(server_kv_list, kvp); - } - it = it->next; - } - - g_list_free(server_list); - - option = purple_account_option_list_new(_("Select Server"), "server", server_kv_list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("QQ2005")); - kvp->value = g_strdup("qq2005"); - version_kv_list = g_list_append(version_kv_list, kvp); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("QQ2007")); - kvp->value = g_strdup("qq2007"); - version_kv_list = g_list_append(version_kv_list, kvp); - - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(_("QQ2008")); - kvp->value = g_strdup("qq2008"); - version_kv_list = g_list_append(version_kv_list, kvp); - - option = purple_account_option_list_new(_("Client Version"), "client_version", version_kv_list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Connect by TCP"), "use_tcp", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show server notice"), "show_notice", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show server news"), "show_news", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Show chat room when msg comes"), "show_chat", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Keep alive interval (seconds)"), "keep_alive_interval", 60); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Update interval (seconds)"), "update_interval", 300); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_add_none("/plugins/prpl/qq"); - purple_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE); - purple_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE); - purple_prefs_add_bool("/plugins/prpl/qq/auto_get_authorize_info", TRUE); - purple_prefs_add_int("/plugins/prpl/qq/resend_interval", 3); - purple_prefs_add_int("/plugins/prpl/qq/resend_times", 10); -} - -PURPLE_INIT_PLUGIN(qq, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,337 +0,0 @@ -/** - * @file qq_crypt.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * - * QQ encryption algorithm - * Convert from ASM code provided by PerlOICQ - * - * Puzzlebird, Nov-Dec 2002 - */ - -/* Notes: (QQ uses 16 rounds, and modified something...) - -IN : 64 bits of data in v[0] - v[1]. -OUT: 64 bits of data in w[0] - w[1]. -KEY: 128 bits of key in k[0] - k[3]. - -delta is chosen to be the real part of -the golden ratio: Sqrt(5/4) - 1/2 ~ 0.618034 multiplied by 2^32. - -0x61C88647 is what we can track on the ASM codes.!! -*/ - -#include - -#include "debug.h" -#include "qq_crypt.h" - -#if 0 -void show_binary(char *psztitle, const guint8 *const buffer, gint bytes) -{ - printf("== %s %d ==\r\n", psztitle, bytes); - gint i, j, ch; - for (i = 0; i < bytes; i += 16) { - /* length label */ - printf("%07x: ", i); - - /* dump hex value */ - for (j = 0; j < 16; j++) { - if (j == 8) { - printf(" -"); - } - if ((i + j) < bytes) - printf(" %02x", buffer[i + j]); - else - printf(" "); - } - - printf(" "); - - - /* dump ascii value */ - for (j = 0; j < 16 && (i + j) < bytes; j++) { - ch = buffer[i + j] & 127; - if (ch < ' ' || ch == 127) - printf("."); - else - printf("%c", ch); - } - printf("\r\n"); - } - printf("========\r\n"); -} -#else - -#define show_binary(args... ) /* nothing */ - -#endif - -/******************************************************************** - * encryption - *******************************************************************/ - -/* Tiny Encryption Algorithm (TEA) */ -static inline void qq_encipher(guint32 *const v, const guint32 *const k, guint32 *const w) -{ - register guint32 - y = g_ntohl(v[0]), - z = g_ntohl(v[1]), - a = g_ntohl(k[0]), - b = g_ntohl(k[1]), - c = g_ntohl(k[2]), - d = g_ntohl(k[3]), - n = 0x10, - sum = 0, - delta = 0x9E3779B9; /* 0x9E3779B9 - 0x100000000 = -0x61C88647 */ - - while (n-- > 0) { - sum += delta; - y += ((z << 4) + a) ^ (z + sum) ^ ((z >> 5) + b); - z += ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d); - } - - w[0] = g_htonl(y); - w[1] = g_htonl(z); -} - -/* it can be the real random seed function */ -/* override with number, convenient for debug */ -#ifdef DEBUG -static gint crypt_rand(void) { - return 0xdead; -} -#else -#include -#define crypt_rand() rand() -#endif - -/* 64-bit blocks and some kind of feedback mode of operation */ -static inline void encrypt_out(guint8 *crypted, const gint crypted_len, const guint8 *key) -{ - /* ships in encipher */ - guint32 plain32[2]; - guint32 p32_prev[2]; - guint32 key32[4]; - guint32 crypted32[2]; - guint32 c32_prev[2]; - - guint8 *crypted_ptr; - gint count64; - - /* prepare at first */ - crypted_ptr = crypted; - - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - - p32_prev[0] = 0; p32_prev[1] = 0; - plain32[0] = crypted32[0] ^ p32_prev[0]; plain32[1] = crypted32[1] ^ p32_prev[1]; - - g_memmove(key32, key, 16); - count64 = crypted_len / 8; - while (count64-- > 0){ - /* encrypt it */ - qq_encipher(plain32, key32, crypted32); - - crypted32[0] ^= p32_prev[0]; crypted32[1] ^= p32_prev[1]; - - /* store curr 64 bits crypted */ - g_memmove(crypted_ptr, crypted32, sizeof(crypted32)); - - /* set prev */ - p32_prev[0] = plain32[0]; p32_prev[1] = plain32[1]; - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - - /* set next 64 bits want to crypt*/ - if (count64 > 0) { - crypted_ptr += 8; - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - plain32[0] = crypted32[0] ^ c32_prev[0]; plain32[1] = crypted32[1] ^ c32_prev[1]; - } - } -} - -/* length of crypted buffer must be plain_len + 17*/ -/* - * The above comment used to say "plain_len + 16", but based on the - * behavior of the function that is wrong. If you give this function - * a plain string with len%8 = 7 then the returned length is len+17 - */ -gint qq_encrypt(guint8* crypted, const guint8* const plain, const gint plain_len, const guint8* const key) -{ - guint8 *crypted_ptr = crypted; /* current position of dest */ - gint pos, padding; - - padding = (plain_len + 10) % 8; - if (padding) { - padding = 8 - padding; - } - - pos = 0; - - /* set first byte as padding len */ - crypted_ptr[pos] = (rand() & 0xf8) | padding; - pos++; - - /* extra 2 bytes */ - padding += 2; - - /* faster a little - memset(crypted_ptr + pos, rand() & 0xff, padding); - pos += padding; - */ - - /* more random */ - while (padding--) { - crypted_ptr[pos++] = rand() & 0xff; - } - - g_memmove(crypted_ptr + pos, plain, plain_len); - pos += plain_len; - - /* header padding len + plain len must be multiple of 8 - * tail pading len is always 8 - (1st byte) - */ - memset(crypted_ptr + pos, 0x00, 7); - pos += 7; - - show_binary("After padding", crypted, pos); - - encrypt_out(crypted, pos, key); - - show_binary("Encrypted", crypted, pos); - return pos; -} - -/******************************************************************** - * decryption - ********************************************************************/ - -static inline void qq_decipher(guint32 *const v, const guint32 *const k, guint32 *const w) -{ - register guint32 - y = g_ntohl(v[0]), - z = g_ntohl(v[1]), - a = g_ntohl(k[0]), - b = g_ntohl(k[1]), - c = g_ntohl(k[2]), - d = g_ntohl(k[3]), - n = 0x10, - sum = 0xE3779B90, /* why this ? must be related with n value */ - delta = 0x9E3779B9; - - /* sum = delta<<5, in general sum = delta * n */ - while (n-- > 0) { - z -= ((y << 4) + c) ^ (y + sum) ^ ((y >> 5) + d); - y -= ((z << 4) + a) ^ (z + sum) ^ ((z >> 5) + b); - sum -= delta; - } - - w[0] = g_htonl(y); - w[1] = g_htonl(z); -} - -static inline gint decrypt_out(guint8 *dest, gint crypted_len, const guint8* const key) -{ - gint plain_len; - guint32 key32[4]; - guint32 crypted32[2]; - guint32 c32_prev[2]; - guint32 plain32[2]; - guint32 p32_prev[2]; - gint count64; - gint padding; - guint8 *crypted_ptr = dest; - - /* decrypt first 64 bit */ - memcpy(key32, key, sizeof(key32)); - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - - qq_decipher(crypted32, key32, p32_prev); - memcpy(crypted_ptr, p32_prev, sizeof(p32_prev)); - - /* check padding len */ - padding = 2 + (crypted_ptr[0] & 0x7); - if (padding < 2) { - padding += 8; - } - plain_len = crypted_len - 1 - padding - 7; - if( plain_len < 0 ) { - return -2; - } - - count64 = crypted_len / 8; - while (--count64 > 0){ - c32_prev[0] = crypted32[0]; c32_prev[1] = crypted32[1]; - crypted_ptr += 8; - - memcpy(crypted32, crypted_ptr, sizeof(crypted32)); - p32_prev[0] ^= crypted32[0]; p32_prev[1] ^= crypted32[1]; - - qq_decipher(p32_prev, key32, p32_prev); - - plain32[0] = p32_prev[0] ^ c32_prev[0]; plain32[1] = p32_prev[1] ^ c32_prev[1]; - memcpy(crypted_ptr, plain32, sizeof(plain32)); - } - - return plain_len; -} - -/* length of plain buffer must be equal to crypted_len */ -gint qq_decrypt(guint8 *plain, const guint8* const crypted, const gint crypted_len, const guint8* const key) -{ - gint plain_len = 0; - gint hdr_padding; - gint pos; - - /* at least 16 bytes and %8 == 0 */ - if ((crypted_len % 8) || (crypted_len < 16)) { - return -1; - } - - memcpy(plain, crypted, crypted_len); - - plain_len = decrypt_out(plain, crypted_len, key); - if (plain_len < 0) { - return plain_len; /* invalid first 64 bits */ - } - - show_binary("Decrypted with padding", plain, crypted_len); - - /* check last 7 bytes is zero or not? */ - for (pos = crypted_len - 1; pos > crypted_len - 8; pos--) { - if (plain[pos] != 0) { - return -3; - } - } - if (plain_len == 0) { - return plain_len; - } - - hdr_padding = crypted_len - plain_len - 7; - g_memmove(plain, plain + hdr_padding, plain_len); - - return plain_len; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_crypt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ - /** - * @file qq_crypt.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef _QQ_CRYPT_H_ -#define _QQ_CRYPT_H_ - -#include - -gint qq_encrypt(guint8* crypted, const guint8* const plain, const gint plain_len, const guint8* const key); - -gint qq_decrypt(guint8 *plain, const guint8* const crypted, const gint crypted_len, const guint8* const key); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,268 +0,0 @@ -/** - * @file qq_define.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "qq_define.h" - -#define QQ_CLIENT_062E 0x062e /* GB QQ2000c build 0630 */ -#define QQ_CLIENT_072E 0x072e /* EN QQ2000c build 0305 */ -#define QQ_CLIENT_0801 0x0801 /* EN QQ2000c build 0630 */ -#define QQ_CLIENT_0A1D 0x0a1d /* GB QQ2003c build 0808 */ -#define QQ_CLIENT_0B07 0x0b07 /* GB QQ2003c build 0925 */ -#define QQ_CLIENT_0B2F 0x0b2f /* GB QQ2003iii build 0117 */ -#define QQ_CLIENT_0B35 0x0b35 /* GB QQ2003iii build 0304 (offical release) */ -#define QQ_CLIENT_0B37 0x0b37 /* GB QQ2003iii build 0304 (April 05 updates) */ -#define QQ_CLIENT_0E1B 0x0e1b /* QQ2005 ? */ -#define QQ_CLIENT_0E35 0x0e35 /* EN QQ2005 V05.0.200.020 */ -#define QQ_CLIENT_0F15 0x0f15 /* QQ2006 Spring Festival build */ -#define QQ_CLIENT_0F5F 0x0f5f /* QQ2006 final build */ - -#define QQ_CLIENT_0C0B 0x0C0B /* QQ2004 */ -#define QQ_CLIENT_0C0D 0x0C0D /* QQ2004 preview*/ -#define QQ_CLIENT_0C21 0x0C21 /* QQ2004 */ -#define QQ_CLIENT_0C49 0x0C49 /* QQ2004II */ -#define QQ_CLIENT_0D05 0x0D05 /* QQ2005 beta1 */ -#define QQ_CLIENT_0D51 0x0D51 /* QQ2005 beta2 */ -#define QQ_CLIENT_0D61 0x0D61 /* QQ2005 */ -#define QQ_CLIENT_05A5 0x05A5 /* ? */ -#define QQ_CLIENT_05F1 0x0F15 /* QQ2006 Spring Festival */ -#define QQ_CLIENT_0F4B 0x0F4B /* QQ2006 Beta 3 */ - -#define QQ_CLIENT_1105 0x1105 /* QQ2007 beta4*/ -#define QQ_CLIENT_1203 0x1203 /* QQ2008 */ -#define QQ_CLIENT_1205 0x1205 /* QQ2008 Qi Fu */ -#define QQ_CLIENT_120B 0x120B /* QQ2008 July 8.0.978.400 */ -#define QQ_CLIENT_1412 0x1412 /* QQMac 1.0 preview1 build 670 */ -#define QQ_CLIENT_1441 0x1441 /* QQ2009 preview2 */ - -#define QQ_SERVER_0100 0x0100 /* server */ - - -/* given source tag, return its description accordingly */ -const gchar *qq_get_ver_desc(gint source) -{ - switch (source) { - case QQ_CLIENT_062E: - return "GB QQ2000c build 0630"; - case QQ_CLIENT_072E: - return "En QQ2000c build 0305"; - case QQ_CLIENT_0801: - return "En QQ2000c build 0630"; - case QQ_CLIENT_0A1D: - return "GB QQ2003ii build 0808"; - case QQ_CLIENT_0B07: - return "GB QQ2003ii build 0925"; - case QQ_CLIENT_0B2F: - return "GB QQ2003iii build 0117"; - case QQ_CLIENT_0B35: - return "GB QQ2003iii build 0304"; - case QQ_CLIENT_0B37: - return "GB QQ2003iii build 0304 (April 5 update)"; - case QQ_CLIENT_0C0B: - return "QQ2004"; - case QQ_CLIENT_0C0D: - return "QQ2004 preview"; - case QQ_CLIENT_0C21: - return "QQ2004"; - case QQ_CLIENT_0C49: - return "QQ2004II"; - case QQ_CLIENT_0D05: - return "QQ2005 beta1"; - case QQ_CLIENT_0D51: - return "QQ2005 beta2"; - case QQ_CLIENT_0D55: - case QQ_CLIENT_0D61: - return "QQ2005"; - case QQ_CLIENT_0E1B: - return "QQ2005 or QQ2006"; - case QQ_CLIENT_0E35: - return "En QQ2005 V05.0.200.020"; - case QQ_CLIENT_0F15: - return "QQ2006 Spring Festival"; - case QQ_CLIENT_0F4B: - return "QQ2006 beta3"; - case QQ_CLIENT_0F5F: - return "QQ2006 final build"; - case QQ_CLIENT_1105: - return "QQ2007 beta4"; - case QQ_CLIENT_111D: - return "QQ2007"; - case QQ_CLIENT_115B: - case QQ_CLIENT_1203: - case QQ_CLIENT_1205: - case QQ_CLIENT_120B: - return "QQ2008"; - case QQ_CLIENT_1412: - return "QQMac 1.0 preview1 build 670"; - case QQ_CLIENT_1441: - return "QQ2009 preview2"; - case QQ_SERVER_0100: - return "QQ Server 0100"; - default: - return "Unknown Version"; - } -} - -/* given command alias, return the command name accordingly */ -const gchar *qq_get_cmd_desc(gint cmd) -{ - switch (cmd) { - case QQ_CMD_LOGOUT: - return "QQ_CMD_LOGOUT"; - case QQ_CMD_KEEP_ALIVE: - return "CMD_KEEP_ALIVE"; - case QQ_CMD_UPDATE_INFO: - return "CMD_UPDATE_INFO"; - case QQ_CMD_SEARCH_USER: - return "CMD_SEARCH_USER"; - case QQ_CMD_GET_BUDDY_INFO: - return "CMD_GET_BUDDY_INFO"; - case QQ_CMD_ADD_BUDDY_NO_AUTH: - return "CMD_ADD_BUDDY_NO_AUTH"; - case QQ_CMD_REMOVE_BUDDY: - return "CMD_REMOVE_BUDDY"; - case QQ_CMD_ADD_BUDDY_AUTH: - return "CMD_ADD_BUDDY_AUTH"; - case QQ_CMD_CHANGE_STATUS: - return "CMD_CHANGE_STATUS"; - case QQ_CMD_ACK_SYS_MSG: - return "CMD_ACK_SYS_MSG"; - case QQ_CMD_SEND_IM: - return "CMD_SEND_IM"; - case QQ_CMD_RECV_IM: - return "CMD_RECV_IM"; - case QQ_CMD_REMOVE_ME: - return "CMD_REMOVE_ME"; - case QQ_CMD_LOGIN: - return "CMD_LOGIN"; - case QQ_CMD_GET_BUDDIES_LIST: - return "CMD_GET_BUDDIES_LIST"; - case QQ_CMD_GET_BUDDIES_ONLINE: - return "CMD_GET_BUDDIES_ONLINE"; - case QQ_CMD_ROOM: - return "CMD_ROOM"; - case QQ_CMD_GET_BUDDIES_AND_ROOMS: - return "CMD_GET_BUDDIES_AND_ROOMS"; - case QQ_CMD_GET_LEVEL: - return "CMD_GET_LEVEL"; - case QQ_CMD_TOKEN: - return "CMD_TOKEN"; - case QQ_CMD_RECV_MSG_SYS: - return "CMD_RECV_MSG_SYS"; - case QQ_CMD_BUDDY_CHANGE_STATUS: - return "CMD_BUDDY_CHANGE_STATUS"; - case QQ_CMD_GET_SERVER: - return "CMD_GET_SERVER"; - case QQ_CMD_TOKEN_EX: - return "CMD_TOKEN_EX"; - case QQ_CMD_CHECK_PWD: - return "CMD_CHECK_PWD"; - case QQ_CMD_AUTH_CODE: - return "CMD_AUTH_CODE"; - case QQ_CMD_ADD_BUDDY_NO_AUTH_EX: - return "CMD_ADD_BUDDY_NO_AUTH_EX"; - case QQ_CMD_ADD_BUDDY_AUTH_EX: - return "CMD_BUDDY_ADD_AUTH_EX"; - case QQ_CMD_BUDDY_CHECK_CODE: - return "CMD_BUDDY_CHECK_CODE"; - case QQ_CMD_BUDDY_QUESTION: - return "CMD_BUDDY_QUESTION"; - case QQ_CMD_BUDDY_MEMO: - return "CMD_BUDDY_MEMO"; - default: - return "CMD_UNKNOW"; - } -} - -const gchar *qq_get_room_cmd_desc(gint room_cmd) -{ - switch (room_cmd) { - case QQ_ROOM_CMD_CREATE: - return "ROOM_CMD_CREATE"; - case QQ_ROOM_CMD_MEMBER_OPT: - return "ROOM_CMD_MEMBER_OPT"; - case QQ_ROOM_CMD_CHANGE_INFO: - return "ROOM_CMD_CHANGE_INFO"; - case QQ_ROOM_CMD_GET_INFO: - return "ROOM_CMD_GET_INFO"; - case QQ_ROOM_CMD_ACTIVATE: - return "ROOM_CMD_ACTIVATE"; - case QQ_ROOM_CMD_SEARCH: - return "ROOM_CMD_SEARCH"; - case QQ_ROOM_CMD_JOIN: - return "ROOM_CMD_JOIN"; - case QQ_ROOM_CMD_AUTH: - return "ROOM_CMD_AUTH"; - case QQ_ROOM_CMD_QUIT: - return "ROOM_CMD_QUIT"; - case QQ_ROOM_CMD_SEND_IM: - return "ROOM_CMD_SEND_IM"; - case QQ_ROOM_CMD_GET_ONLINES: - return "ROOM_CMD_GET_ONLINES"; - case QQ_ROOM_CMD_GET_BUDDIES: - return "ROOM_CMD_GET_BUDDIES"; - case QQ_ROOM_CMD_CHANGE_CARD: - return "ROOM_CMD_CHANGE_CARD"; - case QQ_ROOM_CMD_GET_REALNAMES: - return "ROOM_CMD_GET_REALNAMES"; - case QQ_ROOM_CMD_GET_CARD: - return "ROOM_CMD_GET_CARD"; - case QQ_ROOM_CMD_SEND_IM_EX: - return "ROOM_CMD_SEND_IM_EX"; - case QQ_ROOM_CMD_ADMIN: - return "ROOM_CMD_ADMIN"; - case QQ_ROOM_CMD_TRANSFER: - return "ROOM_CMD_TRANSFER"; - case QQ_ROOM_CMD_TEMP_CREATE: - return "ROOM_CMD_TEMP_CREATE"; - case QQ_ROOM_CMD_TEMP_CHANGE_MEMBER: - return "ROOM_CMD_TEMP_CHANGE_MEMBER"; - case QQ_ROOM_CMD_TEMP_QUIT: - return "ROOM_CMD_TEMP_QUIT"; - case QQ_ROOM_CMD_TEMP_GET_INFO: - return "ROOM_CMD_TEMP_GET_INFO"; - case QQ_ROOM_CMD_TEMP_SEND_IM: - return "ROOM_CMD_TEMP_SEND_IM"; - case QQ_ROOM_CMD_TEMP_GET_MEMBERS: - return "ROOM_CMD_TEMP_GET_MEMBERS"; - default: - return "ROOM_CMD_UNKNOW"; - } -} - -/* check if status means online or offline */ -gboolean is_online(guint8 status) -{ - switch(status) { - case QQ_BUDDY_ONLINE_NORMAL: - case QQ_BUDDY_ONLINE_AWAY: - case QQ_BUDDY_ONLINE_INVISIBLE: - case QQ_BUDDY_ONLINE_BUSY: - return TRUE; - case QQ_BUDDY_CHANGE_TO_OFFLINE: - return FALSE; - } - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_define.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/** - * @file qq_define.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_HEADER_INFO_H_ -#define _QQ_HEADER_INFO_H_ - -#include - -#define QQ_UDP_HEADER_LENGTH 7 -#define QQ_TCP_HEADER_LENGTH 9 - -#define QQ_PACKET_TAG 0x02 /* all QQ text packets starts with it */ -#define QQ_PACKET_TAIL 0x03 /* all QQ text packets end with it */ - -#define QQ_CLIENT_0D55 0x0d55 /* QQ2005 used by openq before */ -#define QQ_CLIENT_111D 0x111D /* QQ2007 */ -#define QQ_CLIENT_115B 0x115B /* QQ2008 He Sui*/ - -const gchar *qq_get_ver_desc(gint source); - -/* list of known QQ commands */ -enum { - QQ_CMD_LOGOUT = 0x0001, /* log out */ - QQ_CMD_KEEP_ALIVE = 0x0002, /* get onlines from tencent */ - QQ_CMD_UPDATE_INFO = 0x0004, /* update information */ - QQ_CMD_SEARCH_USER = 0x0005, /* search for user */ - QQ_CMD_GET_BUDDY_INFO = 0x0006, /* get user information */ - QQ_CMD_ADD_BUDDY_NO_AUTH = 0x0009, /* add buddy without auth */ - QQ_CMD_REMOVE_BUDDY = 0x000a, /* delete a buddy */ - QQ_CMD_ADD_BUDDY_AUTH = 0x000b, /* buddy authentication */ - QQ_CMD_CHANGE_STATUS = 0x000d, /* change my online status */ - QQ_CMD_ACK_SYS_MSG = 0x0012, /* ack system message */ - QQ_CMD_SEND_IM = 0x0016, /* send message */ - QQ_CMD_RECV_IM = 0x0017, /* receive message */ - QQ_CMD_REMOVE_ME = 0x001c, /* remove self */ - QQ_CMD_REQUEST_KEY = 0x001d, /* request key for file transfer */ - QQ_CMD_CELL_PHONE_1 = 0x0021, /* cell phone 1 */ - QQ_CMD_LOGIN = 0x0022, /* login */ - QQ_CMD_GET_BUDDIES_LIST = 0x0026, /* get buddies list */ - QQ_CMD_GET_BUDDIES_ONLINE = 0x0027, /* get online buddies list */ - QQ_CMD_CELL_PHONE_2 = 0x0029, /* cell phone 2 */ - QQ_CMD_ROOM = 0x0030, /* room command */ - QQ_CMD_GET_BUDDIES_AND_ROOMS = 0x0058, - QQ_CMD_GET_LEVEL = 0x005C, /* get level for one or more buddies */ - QQ_CMD_TOKEN = 0x0062, /* get login token */ - QQ_CMD_RECV_MSG_SYS = 0x0080, /* receive a system message */ - QQ_CMD_BUDDY_CHANGE_STATUS = 0x0081, /* buddy change status */ - QQ_CMD_BUDDY_MEMO = 0x003E, /* the message about buddy memo */ - - /* for QQ2007*/ - QQ_CMD_GET_SERVER = 0x0091, /* select login server */ - QQ_CMD_TOKEN_EX = 0x00BA, /* get LOGIN token */ - QQ_CMD_CHECK_PWD = 0x00DD, /* Password verify */ - QQ_CMD_AUTH_CODE = 0x00AE, /* the request verification of information */ - QQ_CMD_ADD_BUDDY_NO_AUTH_EX = 0x00A7, /* add friend without auth */ - QQ_CMD_ADD_BUDDY_AUTH_EX = 0x00A8, /* add buddy with auth */ - QQ_CMD_BUDDY_CHECK_CODE = 0x00B5, - QQ_CMD_BUDDY_QUESTION = 0x00B7 -}; - -const gchar *qq_get_cmd_desc(gint type); - -enum { - QQ_ROOM_CMD_CREATE = 0x01, - QQ_ROOM_CMD_MEMBER_OPT = 0x02, - QQ_ROOM_CMD_CHANGE_INFO = 0x03, - QQ_ROOM_CMD_GET_INFO = 0x04, - QQ_ROOM_CMD_ACTIVATE = 0x05, - QQ_ROOM_CMD_SEARCH = 0x06, - QQ_ROOM_CMD_JOIN = 0x07, - QQ_ROOM_CMD_AUTH = 0x08, - QQ_ROOM_CMD_QUIT = 0x09, - QQ_ROOM_CMD_SEND_IM = 0x0a, - QQ_ROOM_CMD_GET_ONLINES = 0x0b, - QQ_ROOM_CMD_GET_BUDDIES = 0x0c, - - QQ_ROOM_CMD_CHANGE_CARD = 0x0E, - QQ_ROOM_CMD_GET_REALNAMES = 0x0F, - QQ_ROOM_CMD_GET_CARD = 0x10, - QQ_ROOM_CMD_SEND_IM_EX = 0x1A, - QQ_ROOM_CMD_ADMIN = 0x1B, - QQ_ROOM_CMD_TRANSFER = 0x1C, - QQ_ROOM_CMD_TEMP_CREATE = 0x30, - QQ_ROOM_CMD_TEMP_CHANGE_MEMBER = 0x31, - QQ_ROOM_CMD_TEMP_QUIT = 0x32, - QQ_ROOM_CMD_TEMP_GET_INFO = 0x33, - QQ_ROOM_CMD_TEMP_SEND_IM = 0x35, - QQ_ROOM_CMD_TEMP_GET_MEMBERS = 0x37 -}; - -const gchar *qq_get_room_cmd_desc(gint room_cmd); - -enum { - QQ_SERVER_BUDDY_ADDED = 1, - QQ_SERVER_BUDDY_ADD_REQUEST = 2, - QQ_SERVER_BUDDY_ADDED_ME = 3, - QQ_SERVER_BUDDY_REJECTED_ME = 4, - QQ_SERVER_NOTICE= 6, - QQ_SERVER_NEW_CLIENT = 9, - QQ_SERVER_BUDDY_ADDING_EX = 40, - QQ_SERVER_BUDDY_ADD_REQUEST_EX = 41, - QQ_SERVER_BUDDY_ADDED_ANSWER = 42, - QQ_SERVER_BUDDY_ADDED_EX = 43 -}; - -enum { - QQ_BUDDY_OFFLINE = 0x00, - QQ_BUDDY_ONLINE_NORMAL = 10, - QQ_BUDDY_CHANGE_TO_OFFLINE = 20, - QQ_BUDDY_ONLINE_AWAY = 30, - QQ_BUDDY_ONLINE_INVISIBLE = 40, - QQ_BUDDY_ONLINE_BUSY = 50 -}; - - -gboolean is_online(guint8 status); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/** - * @file qq.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_QQ_H_ -#define _QQ_QQ_H_ - -#include "internal.h" -#include "ft.h" -#include "circbuffer.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "proxy.h" -#include "roomlist.h" - -#define QQ_KEY_LENGTH 16 - -/* steal from kazehakase :) */ -#define qq_strlen(s) ((s)!=NULL?strlen(s):0) -#define qq_strcmp(s1,s2) ((s1)!=NULL && (s2)!=NULL?strcmp(s1,s2):0) - -typedef struct _qq_data qq_data; -typedef struct _qq_buddy_data qq_buddy_data; -typedef struct _qq_interval qq_interval; -typedef struct _qq_net_stat qq_net_stat; -typedef struct _qq_login_data qq_login_data; -typedef struct _qq_captcha_data qq_captcha_data; - -struct _qq_captcha_data { - guint8 *token; - guint16 token_len; - guint8 next_index; - guint8 *data; - guint16 data_len; -}; - -struct _qq_login_data { - guint8 random_key[QQ_KEY_LENGTH]; /* first encrypt key generated by client */ - guint8 *token; /* get from server */ - guint8 token_len; - guint8 *token_ex; /* get from server */ - guint16 token_ex_len; - - guint8 pwd_md5[QQ_KEY_LENGTH]; /* password in md5 (or md5' md5) */ - guint8 pwd_twice_md5[QQ_KEY_LENGTH]; - - guint8 *login_token; - guint16 login_token_len; - guint8 login_key[QQ_KEY_LENGTH]; -}; - -struct _qq_interval { - gint resend; - gint keep_alive; - gint update; -}; - -struct _qq_net_stat { - glong sent; - glong resend; - glong lost; - glong rcved; - glong rcved_dup; -}; - -struct _qq_buddy_data { - guint32 uid; - guint16 face; /* index: 0 - 299 */ - guint8 age; - guint8 gender; - gchar *nickname; - struct in_addr ip; - guint16 port; - guint8 status; - guint8 ext_flag; - guint8 comm_flag; /* details in qq_buddy_list.c */ - guint16 client_tag; - guint8 onlineTime; - guint16 level; - guint16 timeRemainder; - time_t signon; - time_t idle; - time_t last_update; - gchar** memo; - - gint8 role; /* role in group, used only in group->members list */ -}; - -typedef struct _qq_connection qq_connection; -struct _qq_connection { - int fd; /* socket file handler */ - int input_handler; - - /* tcp related */ - int can_write_handler; /* use in tcp_send_out */ - PurpleCircBuffer *tcp_txbuf; - guint8 *tcp_rxqueue; - int tcp_rxlen; -}; - -struct _qq_data { - PurpleConnection *gc; - - GSList *openconns; - gboolean use_tcp; /* network in tcp or udp */ - PurpleProxyConnectData *conn_data; -#ifndef purple_proxy_connect_udp - PurpleDnsQueryData *udp_query_data; /* udp related */ - gint udp_can_write_handler; /* socket can_write handle, use in udp connecting and tcp send out */ -#endif - gint fd; /* socket file handler */ - qq_net_stat net_stat; - - GList *servers; - gchar *curr_server; /* point to servers->data, do not free*/ - - guint16 client_tag; - gint client_version; - - struct in_addr redirect_ip; - guint16 redirect_port; - guint8 *redirect; - guint8 redirect_len; - - guint check_watcher; - guint connect_watcher; - gint connect_retry; - - qq_interval itv_config; - qq_interval itv_count; - guint network_watcher; - gint resend_times; - - GList *transactions; /* check ack packet and resend */ - - guint32 uid; /* QQ number */ - - qq_login_data ld; - qq_captcha_data captcha; - - guint8 session_key[QQ_KEY_LENGTH]; /* later use this as key in this session */ - guint8 session_md5[QQ_KEY_LENGTH]; /* concatenate my uid with session_key and md5 it */ - - guint16 send_seq; /* send sequence number */ - guint8 login_mode; /* online of invisible */ - gboolean is_login; /* used by qq_add_buddy */ - - PurpleXfer *xfer; /* file transfer handler */ - - /* get from login reply packet */ - struct in_addr my_local_ip; /* my local ip address detected by server */ - guint16 my_local_port; /* my lcoal port detected by server */ - time_t login_time; - time_t last_login_time[3]; - struct in_addr last_login_ip; - /* get from keep_alive packet */ - struct in_addr my_ip; /* my ip address detected by server */ - guint16 my_port; /* my port detected by server */ - guint16 my_icon; /* my icon index */ - guint32 online_total; /* the number of online QQ users */ - time_t online_last_update; /* last time send get_friends_online packet */ - - PurpleRoomlist *roomlist; - - GList *groups; - - gboolean is_show_notice; - gboolean is_show_news; - gboolean is_show_chat; - - guint16 send_im_id; /* send IM sequence number */ -}; - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1320 +0,0 @@ -/** - * @file qq_network.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "cipher.h" -#include "debug.h" - -#include "buddy_info.h" -#include "group_info.h" -#include "group_internal.h" -#include "qq_crypt.h" -#include "qq_define.h" -#include "qq_base.h" -#include "buddy_list.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_trans.h" -#include "utils.h" -#include "qq_process.h" - -#define QQ_DEFAULT_PORT 8000 - -/* set QQ_CONNECT_MAX to 1, when test reconnecting */ -#define QQ_CONNECT_MAX 3 -#define QQ_CONNECT_INTERVAL 2 -#define QQ_CONNECT_CHECK 5 -#define QQ_KEEP_ALIVE_INTERVAL 60 -#define QQ_TRANS_INTERVAL 10 - -gboolean connect_to_server(PurpleConnection *gc, gchar *server, gint port); - -static qq_connection *connection_find(qq_data *qd, int fd) { - qq_connection *ret = NULL; - GSList *entry = qd->openconns; - while(entry) { - ret = entry->data; - if(ret->fd == fd) return ret; - entry = entry->next; - } - return NULL; -} - -static qq_connection *connection_create(qq_data *qd, int fd) { - qq_connection *ret = g_new0(qq_connection, 1); - ret->fd = fd; - qd->openconns = g_slist_append(qd->openconns, ret); - return ret; -} - -static void connection_remove(qq_data *qd, int fd) { - qq_connection *conn = connection_find(qd, fd); - qd->openconns = g_slist_remove(qd->openconns, conn); - - g_return_if_fail( conn != NULL ); - - purple_debug_info("QQ", "Close socket %d\n", conn->fd); - if(conn->input_handler > 0) purple_input_remove(conn->input_handler); - if(conn->can_write_handler > 0) purple_input_remove(conn->can_write_handler); - - if (conn->fd >= 0) close(conn->fd); - if(conn->tcp_txbuf != NULL) purple_circ_buffer_destroy(conn->tcp_txbuf); - if (conn->tcp_rxqueue != NULL) g_free(conn->tcp_rxqueue); - - g_free(conn); -} - -static void connection_free_all(qq_data *qd) { - qq_connection *ret = NULL; - GSList *entry = qd->openconns; - while(entry) { - ret = entry->data; - connection_remove(qd, ret->fd); - entry = qd->openconns; - } -} -static gboolean set_new_server(qq_data *qd) -{ - gint count; - gint index; - GList *it = NULL; - - g_return_val_if_fail(qd != NULL, FALSE); - - if (qd->servers == NULL) { - purple_debug_info("QQ", "Server list is NULL\n"); - return FALSE; - } - - /* remove server used before */ - if (qd->curr_server != NULL) { - purple_debug_info("QQ", - "Remove current [%s] from server list\n", qd->curr_server); - qd->servers = g_list_remove(qd->servers, qd->curr_server); - qd->curr_server = NULL; - } - - count = g_list_length(qd->servers); - purple_debug_info("QQ", "Server list has %d\n", count); - if (count <= 0) { - /* no server left, disconnect when result is false */ - qd->servers = NULL; - return FALSE; - } - - /* get new server */ - index = rand() % count; - it = g_list_nth(qd->servers, index); - qd->curr_server = it->data; /* do not free server_name */ - if (qd->curr_server == NULL || strlen(qd->curr_server) <= 0 ) { - purple_debug_info("QQ", "Server name at %d is empty\n", index); - return FALSE; - } - - purple_debug_info("QQ", "set new server to %s\n", qd->curr_server); - return TRUE; -} - -static gint packet_get_header(guint8 *header_tag, guint16 *source_tag, - guint16 *cmd, guint16 *seq, guint8 *buf) -{ - gint bytes = 0; - bytes += qq_get8(header_tag, buf + bytes); - bytes += qq_get16(source_tag, buf + bytes); - bytes += qq_get16(cmd, buf + bytes); - bytes += qq_get16(seq, buf + bytes); - return bytes; -} - -static gboolean connect_check(gpointer data) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); - qd = (qq_data *) gc->proto_data; - - if (qd->connect_watcher > 0) { - purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = 0; - } - - if (qd->fd >= 0 && qd->ld.token != NULL && qd->ld.token_len > 0) { - purple_debug_info("QQ", "Connect ok\n"); - return FALSE; - } - - qd->connect_watcher = purple_timeout_add_seconds(0, qq_connect_later, gc); - return FALSE; -} - -/* Warning: qq_connect_later destory all connection - * Any function should be care of use qq_data after call this function - * Please conside tcp_pending and udp_pending */ -gboolean qq_connect_later(gpointer data) -{ - PurpleConnection *gc; - char *tmp_server; - int port; - gchar **segments; - qq_data *qd; - - gc = (PurpleConnection *) data; - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); - qd = (qq_data *) gc->proto_data; - tmp_server = NULL; - - if (qd->check_watcher > 0) { - purple_timeout_remove(qd->check_watcher); - qd->check_watcher = 0; - } - qq_disconnect(gc); - - if (qd->redirect_ip.s_addr != 0) { - /* redirect to new server */ - tmp_server = g_strdup_printf("%s:%d", inet_ntoa(qd->redirect_ip), qd->redirect_port); - qd->servers = g_list_append(qd->servers, tmp_server); - - qd->curr_server = tmp_server; - tmp_server = NULL; - - qd->redirect_ip.s_addr = 0; - qd->redirect_port = 0; - qd->connect_retry = QQ_CONNECT_MAX; - } - - if (qd->curr_server == NULL || strlen (qd->curr_server) == 0 || qd->connect_retry <= 0) { - if ( set_new_server(qd) != TRUE) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return FALSE; - } - qd->connect_retry = QQ_CONNECT_MAX; - } - - segments = g_strsplit_set(qd->curr_server, ":", 0); - tmp_server = g_strdup(segments[0]); - if (NULL != segments[1]) { - port = atoi(segments[1]); - if (port <= 0) { - purple_debug_info("QQ", "Port not define in %s, use default.\n", qd->curr_server); - port = QQ_DEFAULT_PORT; - } - } else { - purple_debug_info("QQ", "Error splitting server string: %s, setting port to default.\n", qd->curr_server); - port = QQ_DEFAULT_PORT; - } - - g_strfreev(segments); - - qd->connect_retry--; - if ( !connect_to_server(gc, tmp_server, port) ) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } - - g_free(tmp_server); - tmp_server = NULL; - - qd->check_watcher = purple_timeout_add_seconds(QQ_CONNECT_CHECK, connect_check, gc); - return FALSE; /* timeout callback stops */ -} - -static void redirect_server(PurpleConnection *gc) -{ - qq_data *qd; - qd = (qq_data *) gc->proto_data; - - if (qd->check_watcher > 0) { - purple_timeout_remove(qd->check_watcher); - qd->check_watcher = 0; - } - if (qd->connect_watcher > 0) purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc); -} - -/* process the incoming packet from qq_pending */ -static gboolean packet_process(PurpleConnection *gc, guint8 *buf, gint buf_len) -{ - qq_data *qd; - gint bytes, bytes_not_read; - - guint8 header_tag; - guint16 source_tag; - guint16 cmd; - guint16 seq; /* May be ack_seq or send_seq, depends on cmd */ - guint8 room_cmd; - guint32 room_id; - guint32 update_class; - guint32 ship32; - int ret; - - qq_transaction *trans; - - g_return_val_if_fail(buf != NULL && buf_len > 0, TRUE); - - qd = (qq_data *) gc->proto_data; - - qd->net_stat.rcved++; - if (qd->net_stat.rcved <= 0) memset(&(qd->net_stat), 0, sizeof(qd->net_stat)); - - /* Len, header and tail tag have been checked before */ - bytes = 0; - bytes += packet_get_header(&header_tag, &source_tag, &cmd, &seq, buf + bytes); - -#if 1 - purple_debug_info("QQ", "==> [%05d] %s 0x%04X, source tag 0x%04X len %d\n", - seq, qq_get_cmd_desc(cmd), cmd, source_tag, buf_len); -#endif - /* this is the length of all the encrypted data (also remove tail tag) */ - bytes_not_read = buf_len - bytes - 1; - - /* ack packet, we need to update send tranactions */ - /* we do not check duplication for server ack */ - trans = qq_trans_find_rcved(gc, cmd, seq); - if (trans == NULL) { - /* new server command */ - if ( !qd->is_login ) { - qq_trans_add_remain(gc, cmd, seq, buf + bytes, bytes_not_read); - } else { - qq_trans_add_server_cmd(gc, cmd, seq, buf + bytes, bytes_not_read); - qq_proc_server_cmd(gc, cmd, seq, buf + bytes, bytes_not_read); - } - return TRUE; - } - - if (qq_trans_is_dup(trans)) { - qd->net_stat.rcved_dup++; - purple_debug_info("QQ", "dup [%05d] %s, discard...\n", seq, qq_get_cmd_desc(cmd)); - return TRUE; - } - - update_class = qq_trans_get_class(trans); - ship32 = qq_trans_get_ship(trans); - if (update_class != 0 || ship32 != 0) { - purple_debug_info("QQ", "Update class %d, ship32 %d\n", update_class, ship32); - } - - switch (cmd) { - case QQ_CMD_TOKEN: - case QQ_CMD_GET_SERVER: - case QQ_CMD_TOKEN_EX: - case QQ_CMD_CHECK_PWD: - case QQ_CMD_LOGIN: - ret = qq_proc_login_cmds(gc, cmd, seq, buf + bytes, bytes_not_read, update_class, ship32); - if (ret != QQ_LOGIN_REPLY_OK) { - if (ret == QQ_LOGIN_REPLY_REDIRECT) { - redirect_server(gc); - } - return FALSE; /* do nothing after this function and return now */ - } - break; - case QQ_CMD_ROOM: - room_cmd = qq_trans_get_room_cmd(trans); - room_id = qq_trans_get_room_id(trans); - qq_proc_room_cmds(gc, seq, room_cmd, room_id, buf + bytes, bytes_not_read, update_class, ship32); - break; - default: - qq_proc_client_cmds(gc, cmd, seq, buf + bytes, bytes_not_read, update_class, ship32); - break; - } - - return TRUE; -} - -static void tcp_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - qq_connection *conn; - guint8 buf[1024]; /* set to 16 when test tcp_rxqueue */ - gint buf_len; - gint bytes; - - guint8 *pkt; - guint16 pkt_len; - - gchar *error_msg; - guint8 *jump; - gint jump_len; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - if(cond != PURPLE_INPUT_READ) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Socket error")); - return; - } - - conn = connection_find(qd, source); - g_return_if_fail(conn != NULL); - - /* test code, not using tcp_rxqueue - memset(pkt,0, sizeof(pkt)); - buf_len = read(qd->fd, pkt, sizeof(pkt)); - if (buf_len > 2) { - packet_process(gc, pkt + 2, buf_len - 2); - } - return; - */ - - buf_len = read(source, buf, sizeof(buf)); - if (buf_len < 0) { - if (errno == EAGAIN) - /* No worries */ - return; - - error_msg = g_strdup_printf(_("Lost connection with server: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - error_msg); - g_free(error_msg); - return; - } else if (buf_len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - /* keep alive will be sent in 30 seconds since last_receive - * QQ need a keep alive packet in every 60 seconds - gc->last_received = time(NULL); - */ - /* purple_debug_info("TCP_PENDING", "Read %d bytes, rxlen is %d\n", buf_len, conn->tcp_rxlen); */ - conn->tcp_rxqueue = g_realloc(conn->tcp_rxqueue, buf_len + conn->tcp_rxlen); - memcpy(conn->tcp_rxqueue + conn->tcp_rxlen, buf, buf_len); - conn->tcp_rxlen += buf_len; - - pkt = g_newa(guint8, MAX_PACKET_SIZE); - while (PURPLE_CONNECTION_IS_VALID(gc)) { - if (qd->openconns == NULL) { - break; - } - if (conn->tcp_rxqueue == NULL) { - conn->tcp_rxlen = 0; - break; - } - if (conn->tcp_rxlen < QQ_TCP_HEADER_LENGTH) { - break; - } - - bytes = 0; - bytes += qq_get16(&pkt_len, conn->tcp_rxqueue + bytes); - if (conn->tcp_rxlen < pkt_len) { - break; - } - - /* purple_debug_info("TCP_PENDING", "Packet len=%d, rxlen=%d\n", pkt_len, conn->tcp_rxlen); */ - if ( pkt_len < QQ_TCP_HEADER_LENGTH - || *(conn->tcp_rxqueue + bytes) != QQ_PACKET_TAG - || *(conn->tcp_rxqueue + pkt_len - 1) != QQ_PACKET_TAIL) { - /* HEY! This isn't even a QQ. What are you trying to pull? */ - purple_debug_warning("TCP_PENDING", "Packet error, no header or tail tag\n"); - - jump = memchr(conn->tcp_rxqueue + 1, QQ_PACKET_TAIL, conn->tcp_rxlen - 1); - if ( !jump ) { - purple_debug_warning("TCP_PENDING", "Failed to find next tail, clear receive buffer\n"); - g_free(conn->tcp_rxqueue); - conn->tcp_rxqueue = NULL; - conn->tcp_rxlen = 0; - return; - } - - /* jump and over QQ_PACKET_TAIL */ - jump_len = (jump - conn->tcp_rxqueue) + 1; - purple_debug_warning("TCP_PENDING", "Find next tail at %d, jump %d\n", jump_len, jump_len + 1); - g_memmove(conn->tcp_rxqueue, jump, conn->tcp_rxlen - jump_len); - conn->tcp_rxlen -= jump_len; - continue; - } - - memset(pkt, 0, MAX_PACKET_SIZE); - g_memmove(pkt, conn->tcp_rxqueue + bytes, pkt_len - bytes); - - /* jump to next packet */ - conn->tcp_rxlen -= pkt_len; - if (conn->tcp_rxlen) { - /* purple_debug_info("TCP_PENDING", "shrink tcp_rxqueue to %d\n", conn->tcp_rxlen); */ - jump = g_memdup(conn->tcp_rxqueue + pkt_len, conn->tcp_rxlen); - g_free(conn->tcp_rxqueue); - conn->tcp_rxqueue = jump; - } else { - /* purple_debug_info("TCP_PENDING", "free tcp_rxqueue\n"); */ - g_free(conn->tcp_rxqueue); - conn->tcp_rxqueue = NULL; - } - - /* packet_process may call disconnect and destory data like conn - * do not call packet_process before jump, - * break if packet_process return FALSE */ - if (packet_process(gc, pkt, pkt_len - bytes) == FALSE) { - purple_debug_info("TCP_PENDING", "Connection has been destory\n"); - break; - } - } -} - -static void udp_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = NULL; - qq_data *qd; - guint8 *buf; - gint buf_len; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - if(cond != PURPLE_INPUT_READ) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Socket error")); - return; - } - - buf = g_newa(guint8, MAX_PACKET_SIZE); - - /* here we have UDP proxy suppport */ - buf_len = read(source, buf, MAX_PACKET_SIZE); - if (buf_len <= 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to read from socket")); - return; - } - - /* keep alive will be sent in 30 seconds since last_receive - * QQ need a keep alive packet in every 60 seconds - gc->last_received = time(NULL); - */ - - if (buf_len < QQ_UDP_HEADER_LENGTH) { - if (buf[0] != QQ_PACKET_TAG || buf[buf_len - 1] != QQ_PACKET_TAIL) { - qq_hex_dump(PURPLE_DEBUG_ERROR, "UDP_PENDING", - buf, buf_len, - "Received packet is too short, or no header and tail tag"); - return; - } - } - - /* packet_process may call disconnect and destory data like conn - * do not call packet_process before jump, - * break if packet_process return FALSE */ - packet_process(gc, buf, buf_len); -} - -static gint udp_send_out(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - gint ret; - - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - -#if 0 - purple_debug_info("UDP_SEND_OUT", "Send %d bytes to socket %d\n", data_len, qd->fd); -#endif - - errno = 0; - ret = send(qd->fd, data, data_len, 0); - if (ret < 0 && errno == EAGAIN) { - return ret; - } - - if (ret < 0) { - /* TODO: what to do here - do we really have to disconnect? */ - purple_debug_error("UDP_SEND_OUT", "Send failed: %d, %s\n", errno, g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - g_strerror(errno)); - } - return ret; -} - -static void tcp_can_write(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - qq_connection *conn; - int ret, writelen; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - conn = connection_find(qd, source); - g_return_if_fail(conn != NULL); - - writelen = purple_circ_buffer_get_max_read(conn->tcp_txbuf); - if (writelen == 0) { - purple_input_remove(conn->can_write_handler); - conn->can_write_handler = 0; - return; - } - - ret = write(source, conn->tcp_txbuf->outptr, writelen); - purple_debug_info("TCP_CAN_WRITE", "total %d bytes is sent %d\n", writelen, ret); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret < 0) { - /* TODO: what to do here - do we really have to disconnect? */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(conn->tcp_txbuf, ret); -} - -static gint tcp_send_out(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd; - qq_connection *conn; - gint ret; - - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - - conn = connection_find(qd, qd->fd); - g_return_val_if_fail(conn, -1); - -#if 0 - purple_debug_info("TCP_SEND_OUT", "Send %d bytes to socket %d\n", data_len, qd->fd); -#endif - - if (conn->can_write_handler == 0) { - ret = write(qd->fd, data, data_len); - } else { - ret = -1; - errno = EAGAIN; - } - - /* - purple_debug_info("TCP_SEND_OUT", - "Socket %d, total %d bytes is sent %d\n", qd->fd, data_len, ret); - */ - if (ret < 0 && errno == EAGAIN) { - /* socket is busy, send later */ - purple_debug_info("TCP_SEND_OUT", "Socket is busy and send later\n"); - ret = 0; - } else if (ret <= 0) { - /* TODO: what to do here - do we really have to disconnect? */ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_debug_error("TCP_SEND_OUT", - "Send to socket %d failed: %d, %s\n", qd->fd, errno, g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return ret; - } - - if (ret < data_len) { - purple_debug_info("TCP_SEND_OUT", "Add %d bytes to buffer\n", data_len - ret); - if (conn->can_write_handler == 0) { - conn->can_write_handler = purple_input_add(qd->fd, PURPLE_INPUT_WRITE, tcp_can_write, gc); - } - if (conn->tcp_txbuf == NULL) { - conn->tcp_txbuf = purple_circ_buffer_new(4096); - } - purple_circ_buffer_append(conn->tcp_txbuf, data + ret, data_len - ret); - } - return ret; -} - -static gboolean network_timeout(gpointer data) -{ - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - gboolean is_lost_conn; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, TRUE); - qd = (qq_data *) gc->proto_data; - - is_lost_conn = qq_trans_scan(gc); - if (is_lost_conn) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Lost connection with server")); - return TRUE; - } - - if ( !qd->is_login ) { - return TRUE; - } - - qd->itv_count.keep_alive--; - if (qd->itv_count.keep_alive <= 0) { - qd->itv_count.keep_alive = qd->itv_config.keep_alive; - if (qd->client_version >= 2008) { - qq_request_keep_alive_2008(gc); - } else if (qd->client_version >= 2007) { - qq_request_keep_alive_2007(gc); - } else { - qq_request_keep_alive(gc); - } - return TRUE; - } - - if (qd->itv_config.update <= 0) { - return TRUE; - } - - qd->itv_count.update--; - if (qd->itv_count.update <= 0) { - qd->itv_count.update = qd->itv_config.update; - qq_update_online(gc, 0); - return TRUE; - } - - return TRUE; /* if return FALSE, timeout callback stops */ -} - -static void set_all_keys(PurpleConnection *gc) -{ - qq_data *qd; - const gchar *passwd; - guint8 *dest; - int dest_len = QQ_KEY_LENGTH; -#ifndef DEBUG - int bytes; -#endif - /* _qq_show_socket("Got login socket", source); */ - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - /* QQ use random seq, to minimize duplicated packets */ - srand(time(NULL)); - qd->send_seq = rand() & 0xffff; - - qd->is_login = FALSE; - qd->uid = strtoul(purple_account_get_username(purple_connection_get_account(gc)), NULL, 10); - -#ifdef DEBUG - memset(qd->ld.random_key, 0x01, sizeof(qd->ld.random_key)); -#else - for (bytes = 0; bytes < sizeof(qd->ld.random_key); bytes++) { - qd->ld.random_key[bytes] = (guint8) (rand() & 0xff); - } -#endif - - /* now generate md5 processed passwd */ - passwd = purple_account_get_password(purple_connection_get_account(gc)); - - /* use twice-md5 of user password as session key since QQ 2003iii */ - dest = qd->ld.pwd_md5; - qq_get_md5(dest, dest_len, (guint8 *)passwd, strlen(passwd)); - - dest = qd->ld.pwd_twice_md5; - qq_get_md5(dest, dest_len, qd->ld.pwd_md5, dest_len); -} - -/* the callback function after socket is built - * we setup the qq protocol related configuration here */ -static void connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc; - qq_data *qd; - PurpleAccount *account ; - qq_connection *conn; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - qd = (qq_data *) gc->proto_data; - account = purple_connection_get_account(gc); - - /* conn_data will be destoryed */ - qd->conn_data = NULL; - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - purple_debug_info("QQ_CONN", "Invalid connection\n"); - close(source); - return; - } - - if (source < 0) { /* socket returns -1 */ - purple_debug_info("QQ_CONN", - "Could not establish a connection with the server:\n%s\n", - error_message); - if (qd->connect_watcher > 0) purple_timeout_remove(qd->connect_watcher); - qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc); - return; - } - - /* _qq_show_socket("Got login socket", source); */ - qd->fd = source; - conn = connection_create(qd, source); - if (qd->use_tcp) { - conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, tcp_pending, gc); - } else { - conn->input_handler = purple_input_add(source, PURPLE_INPUT_READ, udp_pending, gc); - } - - g_return_if_fail(qd->network_watcher == 0); - qd->network_watcher = purple_timeout_add_seconds(qd->itv_config.resend, network_timeout, gc); - - set_all_keys( gc ); - - if (qd->client_version >= 2007) { - purple_connection_update_progress(gc, _("Getting server"), 2, QQ_CONNECT_STEPS); - qq_request_get_server(gc); - return; - } - - purple_connection_update_progress(gc, _("Requesting token"), 2, QQ_CONNECT_STEPS); - qq_request_token(gc); -} - -#ifndef purple_proxy_connect_udp -static void udp_can_write(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc; - qq_data *qd; - socklen_t len; - int error=0, ret; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - qd = (qq_data *) gc->proto_data; - - - purple_debug_info("proxy", "Connected.\n"); - - /* - * getsockopt after a non-blocking connect returns -1 if something is - * really messed up (bad descriptor, usually). Otherwise, it returns 0 and - * error holds what connect would have returned if it blocked until now. - * Thus, error == 0 is success, error == EINPROGRESS means "try again", - * and anything else is a real error. - * - * (error == EINPROGRESS can happen after a select because the kernel can - * be overly optimistic sometimes. select is just a hint that you might be - * able to do something.) - */ - len = sizeof(error); - ret = getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len); - if (ret == 0 && error == EINPROGRESS) - return; /* we'll be called again later */ - - purple_input_remove(qd->udp_can_write_handler); - qd->udp_can_write_handler = 0; - if (ret < 0 || error != 0) { - if(ret != 0) - error = errno; - - close(source); - - purple_debug_error("proxy", "getsockopt SO_ERROR check: %s\n", g_strerror(error)); - - connect_cb(gc, -1, _("Unable to connect")); - return; - } - - connect_cb(gc, source, NULL); -} - -static void udp_host_resolved(GSList *hosts, gpointer data, const char *error_message) { - PurpleConnection *gc; - qq_data *qd; - struct sockaddr server_addr; - int addr_size; - gint fd = -1; - int flags; - - gc = (PurpleConnection *) data; - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - - qd = (qq_data *) gc->proto_data; - - /* udp_query_data must be set as NULL. - * Otherwise purple_dnsquery_destroy in qq_disconnect cause glib double free error */ - qd->udp_query_data = NULL; - - if (!hosts || !hosts->data) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to resolve hostname")); - return; - } - - addr_size = GPOINTER_TO_INT(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - memcpy(&server_addr, hosts->data, addr_size); - g_free(hosts->data); - - hosts = g_slist_remove(hosts, hosts->data); - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - fd = socket(PF_INET, SOCK_DGRAM, 0); - if (fd < 0) { - purple_debug_error("QQ", - "Unable to create socket: %s\n", g_strerror(errno)); - return; - } - - /* we use non-blocking mode to speed up connection */ - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - /* From Unix-socket-FAQ: http://www.faqs.org/faqs/unix-faq/socket/ - * - * If a UDP socket is unconnected, which is the normal state after a - * bind() call, then send() or write() are not allowed, since no - * destination is available; only sendto() can be used to send data. - * - * Calling connect() on the socket simply records the specified address - * and port number as being the desired communications partner. That - * means that send() or write() are now allowed; they use the destination - * address and port given on the connect call as the destination of packets. - */ - if (connect(fd, &server_addr, addr_size) >= 0) { - purple_debug_info("QQ", "Connected.\n"); - flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); - connect_cb(gc, fd, NULL); - return; - } - - /* [EINPROGRESS] - * The socket is marked as non-blocking and the connection cannot be - * completed immediately. It is possible to select for completion by - * selecting the socket for writing. - * [EINTR] - * A signal interrupted the call. - * The connection is established asynchronously. - */ - if ((errno == EINPROGRESS) || (errno == EINTR)) { - purple_debug_warning( "QQ", "Connect in asynchronous mode.\n"); - qd->udp_can_write_handler = purple_input_add(fd, PURPLE_INPUT_WRITE, udp_can_write, gc); - return; - } - - purple_debug_error("QQ", "Connection failed: %s\n", g_strerror(errno)); - close(fd); -} -#endif - -gboolean connect_to_server(PurpleConnection *gc, gchar *server, gint port) -{ - PurpleAccount *account ; - qq_data *qd; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); - account = purple_connection_get_account(gc); - qd = (qq_data *) gc->proto_data; - - if (server == NULL || server[0] == '\0' || port == 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Invalid server or port")); - return FALSE; - } - - purple_connection_update_progress(gc, _("Connecting to server"), 1, QQ_CONNECT_STEPS); - - purple_debug_info("QQ", "Connect to %s:%d\n", server, port); - - if (qd->conn_data != NULL) { - purple_proxy_connect_cancel(qd->conn_data); - qd->conn_data = NULL; - } - -#ifdef purple_proxy_connect_udp - if (qd->use_tcp) { - qd->conn_data = purple_proxy_connect(gc, account, server, port, connect_cb, gc); - } else { - qd->conn_data = purple_proxy_connect_udp(gc, account, server, port, connect_cb, gc); - } - if ( qd->conn_data == NULL ) { - purple_debug_error("QQ", "Couldn't create socket\n"); - return FALSE; - } -#else - /* QQ connection via UDP/TCP. - * Now use Purple proxy function to provide TCP proxy support, - * and qq_udp_proxy.c to add UDP proxy support (thanks henry) */ - if(qd->use_tcp) { - qd->conn_data = purple_proxy_connect(gc, account, server, port, connect_cb, gc); - if ( qd->conn_data == NULL ) { - purple_debug_error("QQ", "Unable to connect.\n"); - return FALSE; - } - return TRUE; - } - - purple_debug_info("QQ", "UDP Connect to %s:%d\n", server, port); - qd->udp_query_data = purple_dnsquery_a(server, port, udp_host_resolved, gc); - if ( qd->udp_query_data == NULL ) { - purple_debug_error("QQ", "Could not resolve hostname\n"); - return FALSE; - } -#endif - return TRUE; -} - -/* clean up qq_data structure and all its components - * always used before a redirectly connection */ -void qq_disconnect(PurpleConnection *gc) -{ - qq_data *qd; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - purple_debug_info("QQ", "Disconnecting...\n"); - - if (qd->network_watcher > 0) { - purple_debug_info("QQ", "Remove network watcher\n"); - purple_timeout_remove(qd->network_watcher); - qd->network_watcher = 0; - } - - /* finish all I/O */ - if (qd->fd >= 0 && qd->is_login) { - qq_request_logout(gc); - } - - /* not connected */ - if (qd->conn_data != NULL) { - purple_debug_info("QQ", "Connect cancel\n"); - purple_proxy_connect_cancel(qd->conn_data); - qd->conn_data = NULL; - } -#ifndef purple_proxy_connect_udp - if (qd->udp_can_write_handler) { - purple_input_remove(qd->udp_can_write_handler); - qd->udp_can_write_handler = 0; - } - if (qd->udp_query_data != NULL) { - purple_debug_info("QQ", "destroy udp_query_data\n"); - purple_dnsquery_destroy(qd->udp_query_data); - qd->udp_query_data = NULL; - } -#endif - connection_free_all(qd); - qd->fd = -1; - - qq_trans_remove_all(gc); - - memset(qd->ld.random_key, 0, sizeof(qd->ld.random_key)); - memset(qd->ld.pwd_md5, 0, sizeof(qd->ld.pwd_md5)); - memset(qd->ld.pwd_twice_md5, 0, sizeof(qd->ld.pwd_twice_md5)); - memset(qd->ld.login_key, 0, sizeof(qd->ld.login_key)); - memset(qd->session_key, 0, sizeof(qd->session_key)); - memset(qd->session_md5, 0, sizeof(qd->session_md5)); - - qd->my_local_ip.s_addr = 0; - qd->my_local_port = 0; - qd->my_ip.s_addr = 0; - qd->my_port = 0; - - qq_room_data_free_all(gc); - qq_buddy_data_free_all(gc); -} - -static gint packet_encap(qq_data *qd, guint8 *buf, gint maxlen, guint16 cmd, guint16 seq, - guint8 *data, gint data_len) -{ - gint bytes = 0; - g_return_val_if_fail(qd != NULL && buf != NULL && maxlen > 0, -1); - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - /* QQ TCP packet has two bytes in the begining defines packet length - * so leave room here to store packet size */ - if (qd->use_tcp) { - bytes += qq_put16(buf + bytes, 0x0000); - } - /* now comes the normal QQ packet as UDP */ - bytes += qq_put8(buf + bytes, QQ_PACKET_TAG); - bytes += qq_put16(buf + bytes, qd->client_tag); - bytes += qq_put16(buf + bytes, cmd); - - bytes += qq_put16(buf + bytes, seq); - - bytes += qq_put32(buf + bytes, qd->uid); - bytes += qq_putdata(buf + bytes, data, data_len); - bytes += qq_put8(buf + bytes, QQ_PACKET_TAIL); - - /* set TCP packet length at begin of the packet */ - if (qd->use_tcp) { - qq_put16(buf, bytes); - } - - return bytes; -} - -/* data has been encrypted before */ -static gint packet_send_out(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *data, gint data_len) -{ - qq_data *qd; - guint8 *buf; - gint buf_len; - gint bytes_sent; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *)gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - buf_len = packet_encap(qd, buf, MAX_PACKET_SIZE, cmd, seq, data, data_len); - if (buf_len <= 0) { - return -1; - } - - qd->net_stat.sent++; - if (qd->use_tcp) { - bytes_sent = tcp_send_out(gc, buf, buf_len); - } else { - bytes_sent = udp_send_out(gc, buf, buf_len); - } - - return bytes_sent; -} - -gint qq_send_cmd_encrypted(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *encrypted, gint encrypted_len, gboolean is_save2trans) -{ - gint sent_len; - -#if 1 - /* qq_show_packet("qq_send_cmd_encrypted", data, data_len); */ - purple_debug_info("QQ", "<== [%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, encrypted_len); -#endif - - sent_len = packet_send_out(gc, cmd, seq, encrypted, encrypted_len); - if (is_save2trans) { - qq_trans_add_client_cmd(gc, cmd, seq, encrypted, encrypted_len, 0, 0); - } - return sent_len; -} - -/* Encrypt data with session_key, and send packet out */ -static gint send_cmd_detail(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len, gboolean is_save2trans, - guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *encrypted; - gint encrypted_len; - gint bytes_sent; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *)gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - /* at most 17 bytes more */ - encrypted = g_newa(guint8, data_len + 17); - encrypted_len = qq_encrypt(encrypted, data, data_len, qd->session_key); - if (encrypted_len < 16) { - purple_debug_error("QQ_ENCRYPT", "Error len %d: [%05d] 0x%04X %s\n", - encrypted_len, seq, cmd, qq_get_cmd_desc(cmd)); - return -1; - } - - bytes_sent = packet_send_out(gc, cmd, seq, encrypted, encrypted_len); - - if (is_save2trans) { - qq_trans_add_client_cmd(gc, cmd, seq, encrypted, encrypted_len, - update_class, ship32); - } - return bytes_sent; -} - -gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len, - guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint16 seq; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - seq = ++qd->send_seq; -#if 1 - purple_debug_info("QQ", "<== [%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, data_len); -#endif - return send_cmd_detail(gc, cmd, seq, data, data_len, TRUE, update_class, ship32); -} - -/* set seq and is_save2trans, then call send_cmd_detail */ -gint qq_send_cmd(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len) -{ - qq_data *qd; - guint16 seq; - gboolean is_save2trans; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - - if (cmd != QQ_CMD_LOGOUT) { - seq = ++qd->send_seq; - is_save2trans = TRUE; - } else { - seq = 0xFFFF; - is_save2trans = FALSE; - } -#if 1 - purple_debug_info("QQ", "<== [%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, data_len); -#endif - return send_cmd_detail(gc, cmd, seq, data, data_len, is_save2trans, 0, 0); -} - -/* set seq and is_save2trans, then call send_cmd_detail */ -gint qq_send_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *data, gint data_len) -{ - qq_data *qd; - guint8 *encrypted; - gint encrypted_len; - gint bytes_sent; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *)gc->proto_data; - g_return_val_if_fail(data != NULL && data_len > 0, -1); - -#if 1 - purple_debug_info("QQ", "<== [SRV-%05d] %s(0x%04X), datalen %d\n", - seq, qq_get_cmd_desc(cmd), cmd, data_len); -#endif - /* at most 17 bytes more */ - encrypted = g_newa(guint8, data_len + 17); - encrypted_len = qq_encrypt(encrypted, data, data_len, qd->session_key); - if (encrypted_len < 16) { - purple_debug_error("QQ_ENCRYPT", "Error len %d: [%05d] 0x%04X %s\n", - encrypted_len, seq, cmd, qq_get_cmd_desc(cmd)); - return -1; - } - - bytes_sent = packet_send_out(gc, cmd, seq, encrypted, encrypted_len); - qq_trans_add_server_reply(gc, cmd, seq, encrypted, encrypted_len); - - return bytes_sent; -} - -static gint send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *buf; - gint buf_len; - guint8 *encrypted; - gint encrypted_len; - gint bytes_sent; - guint16 seq; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1); - qd = (qq_data *) gc->proto_data; - - buf = g_newa(guint8, MAX_PACKET_SIZE); - memset(buf, 0, MAX_PACKET_SIZE); - - /* encap room_cmd and room id to buf*/ - buf_len = 0; - buf_len += qq_put8(buf + buf_len, room_cmd); - if (room_id != 0) { - /* id 0 is for QQ Demo Group, now they are closed*/ - buf_len += qq_put32(buf + buf_len, room_id); - } - if (data != NULL && data_len > 0) { - buf_len += qq_putdata(buf + buf_len, data, data_len); - } - - qd->send_seq++; - seq = qd->send_seq; - - /* Encrypt to encrypted with session_key */ - /* at most 17 bytes more */ - encrypted = g_newa(guint8, buf_len + 17); - encrypted_len = qq_encrypt(encrypted, buf, buf_len, qd->session_key); - if (encrypted_len < 16) { - purple_debug_error("QQ_ENCRYPT", "Error len %d: [%05d] %s (0x%02X)\n", - encrypted_len, seq, qq_get_room_cmd_desc(room_cmd), room_cmd); - return -1; - } - - bytes_sent = packet_send_out(gc, QQ_CMD_ROOM, seq, encrypted, encrypted_len); -#if 1 - /* qq_show_packet("send_room_cmd", buf, buf_len); */ - purple_debug_info("QQ", - "<== [%05d] %s (0x%02X) to room %d, datalen %d\n", - seq, qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, buf_len); -#endif - - qq_trans_add_room_cmd(gc, seq, room_cmd, room_id, encrypted, encrypted_len, - update_class, ship32); - return bytes_sent; -} - -gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - g_return_val_if_fail(room_cmd > 0, -1); - return send_room_cmd(gc, room_cmd, room_id, data, data_len, update_class, ship32); -} - -gint qq_send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len) -{ - g_return_val_if_fail(room_cmd > 0 && room_id > 0, -1); - return send_room_cmd(gc, room_cmd, room_id, data, data_len, 0, 0); -} - -gint qq_send_room_cmd_noid(PurpleConnection *gc, guint8 room_cmd, - guint8 *data, gint data_len) -{ - g_return_val_if_fail(room_cmd > 0, -1); - return send_room_cmd(gc, room_cmd, 0, data, data_len, 0, 0); -} - -gint qq_send_room_cmd_only(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - g_return_val_if_fail(room_cmd > 0 && room_id > 0, -1); - return send_room_cmd(gc, room_cmd, room_id, NULL, 0, 0, 0); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_network.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/** - * @file qq_network.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_NETWORK_H -#define _QQ_NETWORK_H - -#include -#include "connection.h" - -#include "qq.h" - -#define QQ_CONNECT_STEPS 4 /* steps in connection */ - -gboolean qq_connect_later(gpointer data); -void qq_disconnect(PurpleConnection *gc); - -gint qq_send_cmd_encrypted(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *encrypted_data, gint encrypted_len, gboolean is_save2trans); -gint qq_send_cmd(PurpleConnection *gc, guint16 cmd, guint8 *data, gint datalen); -gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len, - guint32 update_class, guint32 ship32); - -gint qq_send_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len); - -gint qq_send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len); -gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32); -gint qq_send_room_cmd_only(PurpleConnection *gc, guint8 room_cmd, guint32 room_id); -gint qq_send_room_cmd_noid(PurpleConnection *gc, guint8 room_cmd, - guint8 *data, gint data_len); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1173 +0,0 @@ -/** - * @file qq_network.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "cipher.h" -#include "debug.h" - -#include "buddy_info.h" -#include "buddy_list.h" -#include "buddy_opt.h" -#include "group_info.h" -#include "char_conv.h" -#include "qq_crypt.h" - -#include "group_internal.h" -#include "group_im.h" -#include "group_info.h" -#include "group_join.h" -#include "group_opt.h" - -#include "qq_define.h" -#include "qq_base.h" -#include "im.h" -#include "qq_process.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "qq_trans.h" -#include "utils.h" -#include "buddy_memo.h" - -enum { - QQ_ROOM_CMD_REPLY_OK = 0x00, - QQ_ROOM_CMD_REPLY_SEARCH_ERROR = 0x02, - QQ_ROOM_CMD_REPLY_NOT_MEMBER = 0x0a -}; - -/* default process, decrypt and dump */ -static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq) -{ - qq_data *qd; - gchar *msg; - - g_return_if_fail(data != NULL && data_len != 0); - - qq_show_packet(title, data, data_len); - - qd = (qq_data *) gc->proto_data; - - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", - data, data_len, - ">>> [%d] %s -> [default] decrypt and dump", - seq, qq_get_cmd_desc(cmd)); - - msg = g_strdup_printf("Unknow command 0x%02X, %s", cmd, qq_get_cmd_desc(cmd)); - purple_notify_info(gc, _("QQ Error"), title, msg); - g_free(msg); -} - -/* parse the reply to send_im */ -static void do_im_ack(guint8 *data, gint data_len, PurpleConnection *gc) -{ - qq_data *qd; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = gc->proto_data; - - if (data[0] != 0) { - purple_debug_warning("QQ", "Failed sent IM\n"); - purple_notify_error(gc, _("Error"), _("Unable to send message."), NULL); - return; - } - - purple_debug_info("QQ", "OK sent IM\n"); -} - -static void do_server_news(PurpleConnection *gc, guint8 *data, gint data_len) -{ - qq_data *qd = (qq_data *) gc->proto_data; - gint bytes; - gchar *title, *brief, *url; - gchar *content; - - g_return_if_fail(data != NULL && data_len != 0); - - /* qq_show_packet("Rcv news", data, data_len); */ - - bytes = 4; /* skip unknown 4 bytes */ - - bytes += qq_get_vstr(&title, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&brief, QQ_CHARSET_DEFAULT, data + bytes); - bytes += qq_get_vstr(&url, QQ_CHARSET_DEFAULT, data + bytes); - - content = g_strdup_printf(_("Server News:\n%s\n%s\n%s"), title, brief, url); - - if (qd->is_show_news) { - qq_got_message(gc, content); - } else { - purple_debug_info("QQ", "QQ Server news:\n%s\n", content); - } - g_free(title); - g_free(brief); - g_free(url); - g_free(content); -} - -static void do_got_sms(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes; - gchar *mobile = NULL; - gchar *msg = NULL; - gchar *msg_utf8 = NULL; - gchar *msg_formated; - - g_return_if_fail(data != NULL && data_len > 26); - - qq_show_packet("Rcv sms", data, data_len); - - bytes = 0; - bytes += 1; /* skip 0x00 */ - mobile = g_strndup((gchar *)data + bytes, 20); - bytes += 20; - bytes += 5; /* skip 0x(49 11 98 d5 03)*/ - if (bytes < data_len) { - msg = g_strndup((gchar *)data + bytes, data_len - bytes); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - } else { - msg_utf8 = g_strdup(""); - } - - msg_formated = g_strdup_printf(_("%s:%s"), mobile, msg_utf8); - - qq_got_message(gc, msg_formated); - - g_free(msg_formated); - g_free(msg_utf8); - g_free(mobile); -} - -static void do_msg_sys_30(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint len; - guint8 reply; - gchar **segments, *msg_utf8; - - g_return_if_fail(data != NULL && data_len != 0); - - len = data_len; - - if (NULL == (segments = split_data(data, len, "\x2f", 2))) - return; - - reply = strtol(segments[0], NULL, 10); - if (reply == 1) - purple_debug_warning("QQ", "We are kicked out by QQ server\n"); - - msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); - qq_got_message(gc, msg_utf8); -} - -static void do_msg_sys_4c(PurpleConnection *gc, guint8 *data, gint data_len) -{ - gint bytes; - gint msg_len; - GString *content; - gchar *msg = NULL; - - g_return_if_fail(data != NULL && data_len > 0); - - bytes = 6; /* skip 0x(06 00 01 1e 01 1c)*/ - - content = g_string_new(""); - while (bytes < data_len) { - msg_len = qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data + bytes); - g_string_append(content, msg); - g_string_append(content, "\n"); - g_free(msg); - - if (msg_len <= 1) { - break; - } - bytes += msg_len; - } - if (bytes != data_len) { - purple_debug_warning("QQ", "Failed to read QQ_MSG_SYS_4C\n"); - qq_show_packet("do_msg_sys_4c", data, data_len); - } - qq_got_message(gc, content->str); - g_string_free(content, FALSE); -} - -static const gchar *get_im_type_desc(gint type) -{ - switch (type) { - case QQ_MSG_TO_BUDDY: - return "QQ_MSG_TO_BUDDY"; - case QQ_MSG_TO_UNKNOWN: - return "QQ_MSG_TO_UNKNOWN"; - case QQ_MSG_QUN_IM_UNKNOWN: - return "QQ_MSG_QUN_IM_UNKNOWN"; - case QQ_MSG_ADD_TO_QUN: - return "QQ_MSG_ADD_TO_QUN"; - case QQ_MSG_DEL_FROM_QUN: - return "QQ_MSG_DEL_FROM_QUN"; - case QQ_MSG_APPLY_ADD_TO_QUN: - return "QQ_MSG_APPLY_ADD_TO_QUN"; - case QQ_MSG_CREATE_QUN: - return "QQ_MSG_CREATE_QUN"; - case QQ_MSG_SYS_30: - return "QQ_MSG_SYS_30"; - case QQ_MSG_SYS_4C: - return "QQ_MSG_SYS_4C"; - case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: - return "QQ_MSG_APPROVE_APPLY_ADD_TO_QUN"; - case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: - return "QQ_MSG_REJCT_APPLY_ADD_TO_QUN"; - case QQ_MSG_TEMP_QUN_IM: - return "QQ_MSG_TEMP_QUN_IM"; - case QQ_MSG_QUN_IM: - return "QQ_MSG_QUN_IM"; - case QQ_MSG_NEWS: - return "QQ_MSG_NEWS"; - case QQ_MSG_SMS: - return "QQ_MSG_SMS"; - case QQ_MSG_EXTEND: - return "QQ_MSG_EXTEND"; - case QQ_MSG_EXTEND_85: - return "QQ_MSG_EXTEND_85"; - default: - return "QQ_MSG_UNKNOWN"; - } -} - -/* I receive a message, mainly it is text msg, - * but we need to proess other types (group etc) */ -static void process_private_msg(guint8 *data, gint data_len, guint16 seq, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - - struct { - guint32 uid_from; - guint32 uid_to; - guint32 seq; - struct in_addr ip_from; - guint16 port_from; - guint16 msg_type; - } header; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - if (data_len < 16) { /* we need to ack with the first 16 bytes */ - purple_debug_error("QQ", "MSG is too short\n"); - return; - } else { - /* when we receive a message, - * we send an ACK which is the first 16 bytes of incoming packet */ - qq_send_server_reply(gc, QQ_CMD_RECV_IM, seq, data, 16); - } - - /* check len first */ - if (data_len < 20) { /* length of im_header */ - purple_debug_error("QQ", "Invald MSG header, len %d < 20\n", data_len); - return; - } - - bytes = 0; - bytes += qq_get32(&(header.uid_from), data + bytes); - bytes += qq_get32(&(header.uid_to), data + bytes); - bytes += qq_get32(&(header.seq), data + bytes); - /* if the message is delivered via server, it is server IP/port */ - bytes += qq_getIP(&(header.ip_from), data + bytes); - bytes += qq_get16(&(header.port_from), data + bytes); - bytes += qq_get16(&(header.msg_type), data + bytes); - /* im_header prepared */ - - if (header.uid_to != qd->uid) { /* should not happen */ - purple_debug_error("QQ", "MSG to %u, NOT me\n", header.uid_to); - return; - } - - /* check bytes */ - if (bytes >= data_len - 1) { - purple_debug_warning("QQ", "Empty MSG\n"); - return; - } - - switch (header.msg_type) { - case QQ_MSG_NEWS: - do_server_news(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_SMS: - do_got_sms(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_EXTEND: - case QQ_MSG_EXTEND_85: - purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from); - qq_process_extend_im(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_TO_UNKNOWN: - case QQ_MSG_TO_BUDDY: - purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from); - qq_process_im(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_QUN_IM_UNKNOWN: - case QQ_MSG_TEMP_QUN_IM: - case QQ_MSG_QUN_IM: - purple_debug_info("QQ", "MSG from room [%d]\n", header.uid_from); - qq_process_room_im(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type); - break; - case QQ_MSG_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from [%d], Added\n", header.uid_from); - /* uid_from is group id - * we need this to create a dummy group and add to blist */ - qq_process_room_buddy_joined(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_DEL_FROM_QUN: - purple_debug_info("QQ", "Notice from room [%d], Removed\n", header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_removed(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_APPLY_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from room [%d], Joined\n", header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_request_join(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n", - header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_approved(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: - purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n", - header.uid_from); - /* uid_from is group id */ - qq_process_room_buddy_rejected(data + bytes, data_len - bytes, header.uid_from, gc); - break; - case QQ_MSG_SYS_30: - do_msg_sys_30(gc, data + bytes, data_len - bytes); - break; - case QQ_MSG_SYS_4C: - do_msg_sys_4c(gc, data + bytes, data_len - bytes); - break; - default: - purple_debug_warning("QQ", "MSG from %u, unknown type %s [0x%04X]\n", - header.uid_from, get_im_type_desc(header.msg_type), header.msg_type); - qq_show_packet("MSG header", data, bytes); - if (data_len - bytes > 0) { - qq_show_packet("MSG data", data + bytes, data_len - bytes); - } - break; - } -} - -/* Send ACK if the sys message needs an ACK */ -static void request_server_ack(PurpleConnection *gc, gchar *funct_str, gchar *from, guint16 seq) -{ - qq_data *qd; - guint8 *raw_data; - gint bytes; - guint8 bar; - - g_return_if_fail(funct_str != NULL && from != NULL); - qd = (qq_data *) gc->proto_data; - - - bar = 0x1e; - raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16); - - bytes = 0; - bytes += qq_putdata(raw_data + bytes, (guint8 *)funct_str, strlen(funct_str)); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_putdata(raw_data + bytes, (guint8 *)from, strlen(from)); - bytes += qq_put8(raw_data + bytes, bar); - bytes += qq_put16(raw_data + bytes, seq); - - qq_send_server_reply(gc, QQ_CMD_ACK_SYS_MSG, 0, raw_data, bytes); -} - -static void do_server_notice(PurpleConnection *gc, gchar *from, gchar *to, - guint8 *data, gint data_len) -{ - qq_data *qd = (qq_data *) gc->proto_data; - gchar *msg, *msg_utf8; - gchar *title, *content; - - g_return_if_fail(from != NULL && to != NULL && data_len > 0); - - msg = g_strndup((gchar *)data, data_len); - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - if (msg_utf8 == NULL) { - purple_debug_error("QQ", "Recv NULL sys msg from %s to %s, discard\n", - from, to); - return; - } - - title = g_strdup_printf(_("From %s:"), from); - content = g_strdup_printf(_("Server notice From %s: \n%s"), from, msg_utf8); - - if (qd->is_show_notice) { - qq_got_message(gc, content); - } else { - purple_debug_info("QQ", "QQ Server notice from %s:\n%s\n", from, msg_utf8); - } - g_free(msg_utf8); - g_free(title); - g_free(content); -} - -static void process_server_msg(PurpleConnection *gc, guint8 *data, gint data_len, guint16 seq) -{ - qq_data *qd; - guint8 *data_str, i = 0; - gchar **segments, **seg; - gchar *funct_str, *from, *to; - gint bytes, funct; - - g_return_if_fail(data != NULL && data_len != 0); - - qd = (qq_data *) gc->proto_data; - - data_str = g_newa(guint8, data_len + 1); - g_memmove(data_str, data, data_len); - data_str[data_len] = 0x00; - - segments = g_strsplit((gchar *) data_str, "\x1f", 0); - g_return_if_fail(segments != NULL); - for (seg = segments; *seg != NULL; seg++) - i++; - if (i < 3) { - purple_debug_warning("QQ", "Server message segments is less than 3\n"); - g_strfreev(segments); - return; - } - - bytes = 0; - funct_str = segments[0]; - bytes += strlen(funct_str) + 1; - from = segments[1]; - bytes += strlen(from) + 1; - to = segments[2]; - bytes += strlen(to) + 1; - - request_server_ack(gc, funct_str, from, seq); - - /* qq_show_packet("Server MSG", data, data_len); */ - if (strtoul(to, NULL, 10) != qd->uid) { /* not to me */ - purple_debug_error("QQ", "Recv sys msg to [%s], not me!, discard\n", to); - g_strfreev(segments); - return; - } - - funct = strtol(funct_str, NULL, 10); - switch (funct) { - case QQ_SERVER_BUDDY_ADDED: - case QQ_SERVER_BUDDY_ADD_REQUEST: - case QQ_SERVER_BUDDY_ADDED_ME: - case QQ_SERVER_BUDDY_REJECTED_ME: - case QQ_SERVER_BUDDY_ADD_REQUEST_EX: - case QQ_SERVER_BUDDY_ADDING_EX: - case QQ_SERVER_BUDDY_ADDED_ANSWER: - case QQ_SERVER_BUDDY_ADDED_EX: - qq_process_buddy_from_server(gc, funct, from, to, data + bytes, data_len - bytes); - break; - case QQ_SERVER_NOTICE: - do_server_notice(gc, from, to, data + bytes, data_len - bytes); - break; - case QQ_SERVER_NEW_CLIENT: - purple_debug_warning("QQ", "QQ Server has newer client version\n"); - break; - default: - qq_show_packet("Unknown sys msg", data, data_len); - purple_debug_warning("QQ", "Recv unknown sys msg code: %s\n", funct_str); - break; - } - g_strfreev(segments); -} - -void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len) -{ - qq_data *qd; - - guint8 *data; - gint data_len; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - data = g_newa(guint8, rcved_len); - data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); - if (data_len < 0) { - purple_debug_warning("QQ", - "Can not decrypt server cmd by session key, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - return; - } - - if (data_len <= 0) { - purple_debug_warning("QQ", - "Server cmd decrypted is empty, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - return; - } - - /* now process the packet */ - switch (cmd) { - case QQ_CMD_RECV_IM: - process_private_msg(data, data_len, seq, gc); - break; - case QQ_CMD_RECV_MSG_SYS: - process_server_msg(gc, data, data_len, seq); - break; - case QQ_CMD_BUDDY_CHANGE_STATUS: - qq_process_buddy_change_status(data, data_len, gc); - break; - default: - process_unknow_cmd(gc, _("Unknown SERVER CMD"), data, data_len, cmd, seq); - break; - } -} - -static void process_room_cmd_notify(PurpleConnection *gc, - guint8 room_cmd, guint8 room_id, guint8 reply, guint8 *data, gint data_len) -{ - gchar *prim; - gchar *msg, *msg_utf8; - g_return_if_fail(data != NULL && data_len > 0); - - msg = g_strndup((gchar *) data, data_len); /* it will append 0x00 */ - msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); - g_free(msg); - - prim = g_strdup_printf(_("Error reply of %s(0x%02X)\nRoom %u, reply 0x%02X"), - qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, reply); - - purple_notify_error(gc, _("QQ Qun Command"), prim, msg_utf8); - - g_free(prim); - g_free(msg_utf8); -} - -void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - qq_data *qd; - gint ret; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - switch (room_cmd) { - case 0: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ROOM, 0); - break; - case QQ_ROOM_CMD_GET_INFO: - ret = qq_request_room_get_buddies(gc, room_id, QQ_CMD_CLASS_UPDATE_ROOM); - if (ret <= 0) { - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ROOM, 0); - } - break; - case QQ_ROOM_CMD_GET_BUDDIES: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ROOM, 0); - break; - case QQ_ROOM_CMD_GET_ONLINES: - /* last command */ - default: - break; - } -} - -void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - qq_data *qd; - gboolean is_new_turn = FALSE; - guint32 next_id; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - next_id = qq_room_get_next(gc, room_id); - purple_debug_info("QQ", "Update rooms, next id %u, prev id %u\n", next_id, room_id); - - if (next_id <= 0) { - if (room_id > 0) { - is_new_turn = TRUE; - next_id = qq_room_get_next(gc, 0); - purple_debug_info("QQ", "New turn, id %u\n", next_id); - } else { - purple_debug_info("QQ", "No room. Finished update\n"); - return; - } - } - - switch (room_cmd) { - case 0: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - case QQ_ROOM_CMD_GET_INFO: - if (!is_new_turn) { - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - } else { - qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL); - } - break; - case QQ_ROOM_CMD_GET_BUDDIES: - /* last command */ - if (!is_new_turn) { - qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL); - } else { - purple_debug_info("QQ", "Finished update\n"); - } - break; - default: - break; - } -} - -void qq_update_all(PurpleConnection *gc, guint16 cmd) -{ - qq_data *qd; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - switch (cmd) { - case 0: - qq_request_buddy_info(gc, qd->uid, QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - case QQ_CMD_GET_BUDDY_INFO: - qq_request_change_status(gc, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_CHANGE_STATUS: - qq_request_get_buddies(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_GET_BUDDIES_LIST: - qq_request_get_buddies_and_rooms(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_GET_BUDDIES_AND_ROOMS: - if (qd->client_version >= 2007) { - /* QQ2007/2008 can not get buddies level*/ - qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - } else { - qq_request_get_buddies_level(gc, QQ_CMD_CLASS_UPDATE_ALL); - } - break; - case QQ_CMD_GET_LEVEL: - qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); - break; - case QQ_CMD_GET_BUDDIES_ONLINE: - /* last command */ - qq_update_all_rooms(gc, 0, 0); - break; - default: - break; - } - qd->online_last_update = time(NULL); -} - -static void update_all_rooms_online(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) -{ - qq_data *qd; - guint32 next_id; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - next_id = qq_room_get_next_conv(gc, room_id); - if (next_id <= 0 && room_id <= 0) { - purple_debug_info("QQ", "No room in conversation, no update online buddies\n"); - return; - } - if (next_id <= 0 ) { - purple_debug_info("QQ", "finished update rooms' online buddies\n"); - return; - } - - switch (room_cmd) { - case 0: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - case QQ_ROOM_CMD_GET_ONLINES: - qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0, - QQ_CMD_CLASS_UPDATE_ALL, 0); - break; - default: - break; - } -} - -void qq_update_online(PurpleConnection *gc, guint16 cmd) -{ - qq_data *qd; - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - switch (cmd) { - case 0: - qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ONLINE); - break; - case QQ_CMD_GET_BUDDIES_ONLINE: - /* last command */ - update_all_rooms_online(gc, 0, 0); - break; - default: - break; - } - qd->online_last_update = time(NULL); -} - -void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq, - guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len, - guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *data; - gint data_len; - qq_room_data *rmd; - gint bytes; - guint8 reply_cmd, reply; - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - data = g_newa(guint8, rcved_len); - data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); - if (data_len < 0) { - purple_debug_warning("QQ", - "Can not decrypt room cmd by session key, [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - return; - } - - if (room_id <= 0) { - purple_debug_warning("QQ", - "Invaild room id, [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - /* Some room cmd has no room id, like QQ_ROOM_CMD_SEARCH */ - } - - if (data_len <= 2) { - purple_debug_warning("QQ", - "Invaild len of room cmd decrypted, [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - return; - } - - bytes = 0; - bytes += qq_get8(&reply_cmd, data + bytes); - bytes += qq_get8(&reply, data + bytes); - - if (reply_cmd != room_cmd) { - purple_debug_warning("QQ", - "Missing room cmd in reply 0x%02X %s, [%05d], 0x%02X %s for %d, len %d\n", - reply_cmd, qq_get_room_cmd_desc(reply_cmd), - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - } - - /* now process the packet */ - if (reply != QQ_ROOM_CMD_REPLY_OK) { - switch (reply) { /* this should be all errors */ - case QQ_ROOM_CMD_REPLY_NOT_MEMBER: - rmd = qq_room_data_find(gc, room_id); - if (rmd == NULL) { - purple_debug_warning("QQ", - "Missing room id in [%05d], 0x%02X %s for %d, len %d\n", - seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); - } else { - purple_debug_warning("QQ", - "Not a member of room \"%s\"\n", rmd->title_utf8); - rmd->my_role = QQ_ROOM_ROLE_NO; - } - break; - case QQ_ROOM_CMD_REPLY_SEARCH_ERROR: - if (qd->roomlist != NULL) { - if (purple_roomlist_get_in_progress(qd->roomlist)) - purple_roomlist_set_in_progress(qd->roomlist, FALSE); - } - default: - process_room_cmd_notify(gc, reply_cmd, room_id, reply, data + bytes, data_len - bytes); - } - return; - } - - /* seems ok so far, so we process the reply according to sub_cmd */ - switch (reply_cmd) { - case QQ_ROOM_CMD_GET_INFO: - qq_process_room_cmd_get_info(data + bytes, data_len - bytes, ship32, gc); - break; - case QQ_ROOM_CMD_CREATE: - qq_group_process_create_group_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_CHANGE_INFO: - qq_group_process_modify_info_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_MEMBER_OPT: - qq_group_process_modify_members_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_ACTIVATE: - qq_group_process_activate_group_reply(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_SEARCH: - qq_process_room_search(gc, data + bytes, data_len - bytes, ship32); - break; - case QQ_ROOM_CMD_JOIN: - qq_process_group_cmd_join_group(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_AUTH: - qq_process_group_cmd_join_group_auth(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_QUIT: - qq_process_group_cmd_exit_group(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_SEND_IM: - qq_process_room_send_im(gc, data + bytes, data_len - bytes); - break; - case QQ_ROOM_CMD_SEND_IM_EX: - qq_process_room_send_im_ex(gc, data + bytes, data_len - bytes); - break; - case QQ_ROOM_CMD_GET_ONLINES: - qq_process_room_cmd_get_onlines(data + bytes, data_len - bytes, gc); - break; - case QQ_ROOM_CMD_GET_BUDDIES: - qq_process_room_cmd_get_buddies(data + bytes, data_len - bytes, gc); - break; - default: - purple_debug_warning("QQ", "Unknow room cmd 0x%02X %s\n", - reply_cmd, qq_get_room_cmd_desc(reply_cmd)); - } - - if (update_class == QQ_CMD_CLASS_NONE) - return; - - if (update_class == QQ_CMD_CLASS_UPDATE_ALL) { - qq_update_all_rooms(gc, room_cmd, room_id); - return; - } - if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) { - update_all_rooms_online(gc, room_cmd, room_id); - return; - } - if (update_class == QQ_CMD_CLASS_UPDATE_ROOM) { - qq_update_room(gc, room_cmd, room_id); - } -} - -guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - guint8 *data = NULL; - gint data_len = 0; - guint ret_8 = QQ_LOGIN_REPLY_ERR; - - g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); - qd = (qq_data *) gc->proto_data; - - g_return_val_if_fail(rcved_len > 0, QQ_LOGIN_REPLY_ERR); - data = g_newa(guint8, rcved_len); - - switch (cmd) { - case QQ_CMD_TOKEN: - if (qq_process_token(gc, rcved, rcved_len) == QQ_LOGIN_REPLY_OK) { - if (qd->client_version >= 2007) { - qq_request_token_ex(gc); - } else { - qq_request_login(gc); - } - return QQ_LOGIN_REPLY_OK; - } - return QQ_LOGIN_REPLY_ERR; - case QQ_CMD_GET_SERVER: - case QQ_CMD_TOKEN_EX: - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); - break; - case QQ_CMD_CHECK_PWD: - /* May use password_twice_md5 in the past version like QQ2005 */ - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by random_key, %d bytes\n", data_len); - } else { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5, %d bytes\n", data_len); - } - } - break; - case QQ_CMD_LOGIN: - default: - if (qd->client_version >= 2007) { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); - } else { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.login_key); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by login_key\n"); - } - } - } else { - /* May use password_twice_md5 in the past version like QQ2005 */ - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by random_key\n"); - } else { - data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); - if (data_len >= 0) { - purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); - } - } - } - break; - } - - if (data_len < 0) { - purple_debug_warning("QQ", - "Can not decrypt login cmd, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Unable to decrypt login reply")); - return QQ_LOGIN_REPLY_ERR; - } - - switch (cmd) { - case QQ_CMD_GET_SERVER: - ret_8 = qq_process_get_server(gc, data, data_len); - if ( ret_8 == QQ_LOGIN_REPLY_OK) { - qq_request_token(gc); - } else if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { - return QQ_LOGIN_REPLY_REDIRECT; - } - break; - case QQ_CMD_TOKEN_EX: - ret_8 = qq_process_token_ex(gc, data, data_len); - if (ret_8 == QQ_LOGIN_REPLY_OK) { - qq_request_check_pwd(gc); - } else if (ret_8 == QQ_LOGIN_REPLY_NEXT_TOKEN_EX) { - qq_request_token_ex_next(gc); - } else if (ret_8 == QQ_LOGIN_REPLY_CAPTCHA_DLG) { - qq_captcha_input_dialog(gc, &(qd->captcha)); - g_free(qd->captcha.token); - g_free(qd->captcha.data); - memset(&qd->captcha, 0, sizeof(qd->captcha)); - } - break; - case QQ_CMD_CHECK_PWD: - ret_8 = qq_process_check_pwd(gc, data, data_len); - if (ret_8 != QQ_LOGIN_REPLY_OK) { - return ret_8; - } - if (qd->client_version >= 2008) { - qq_request_login_2008(gc); - } else { - qq_request_login_2007(gc); - } - break; - case QQ_CMD_LOGIN: - if (qd->client_version >= 2008) { - ret_8 = qq_process_login_2008(gc, data, data_len); - if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { - qq_request_get_server(gc); - return QQ_LOGIN_REPLY_OK; - } - } else if (qd->client_version >= 2007) { - ret_8 = qq_process_login_2007(gc, data, data_len); - if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { - qq_request_get_server(gc); - return QQ_LOGIN_REPLY_OK; - } - } else { - ret_8 = qq_process_login(gc, data, data_len); - } - if (ret_8 != QQ_LOGIN_REPLY_OK) { - return ret_8; - } - - purple_connection_update_progress(gc, _("Logging in"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS); - purple_debug_info("QQ", "Login replies OK; everything is fine\n"); - purple_connection_set_state(gc, PURPLE_CONNECTED); - qd->is_login = TRUE; /* must be defined after sev_finish_login */ - - /* now initiate QQ Qun, do it first as it may take longer to finish */ - qq_room_data_initial(gc); - - /* is_login, but we have packets before login */ - qq_trans_process_remained(gc); - - qq_update_all(gc, 0); - break; - default: - process_unknow_cmd(gc, _("Unknown LOGIN CMD"), data, data_len, cmd, seq); - return QQ_LOGIN_REPLY_ERR; - } - return QQ_LOGIN_REPLY_OK; -} - -void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - - guint8 *data; - gint data_len; - - guint8 ret_8 = 0; - guint16 ret_16 = 0; - guint32 ret_32 = 0; - gboolean is_unknow = FALSE; - - g_return_if_fail(rcved_len > 0); - - g_return_if_fail (gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - data = g_newa(guint8, rcved_len); - data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); - if (data_len < 0) { - purple_debug_warning("QQ", - "Reply can not be decrypted by session key, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - qq_show_packet("Can not decrypted", rcved, rcved_len); - return; - } - - if (data_len <= 0) { - purple_debug_warning("QQ", - "Reply decrypted is empty, [%05d], 0x%04X %s, len %d\n", - seq, cmd, qq_get_cmd_desc(cmd), rcved_len); - return; - } - - switch (cmd) { - case QQ_CMD_UPDATE_INFO: - qq_process_change_info(gc, data, data_len); - break; - case QQ_CMD_ADD_BUDDY_NO_AUTH: - qq_process_add_buddy_no_auth(gc, data, data_len, ship32); - break; - case QQ_CMD_REMOVE_BUDDY: - qq_process_remove_buddy(gc, data, data_len, ship32); - break; - case QQ_CMD_REMOVE_ME: - qq_process_buddy_remove_me(gc, data, data_len, ship32); - break; - case QQ_CMD_ADD_BUDDY_AUTH: - qq_process_add_buddy_auth(data, data_len, gc); - break; - case QQ_CMD_GET_BUDDY_INFO: - qq_process_get_buddy_info(data, data_len, ship32, gc); - break; - case QQ_CMD_CHANGE_STATUS: - qq_process_change_status(data, data_len, gc); - break; - case QQ_CMD_SEND_IM: - do_im_ack(data, data_len, gc); - break; - case QQ_CMD_KEEP_ALIVE: - if (qd->client_version >= 2008) { - qq_process_keep_alive_2008(data, data_len, gc); - } else if (qd->client_version >= 2007) { - qq_process_keep_alive_2007(data, data_len, gc); - } else { - qq_process_keep_alive(data, data_len, gc); - } - break; - case QQ_CMD_GET_BUDDIES_ONLINE: - ret_8 = qq_process_get_buddies_online(data, data_len, gc); - if (ret_8 > 0 && ret_8 < 0xff) { - purple_debug_info("QQ", "Requesting for more online buddies\n"); - qq_request_get_buddies_online(gc, ret_8, update_class); - return; - } - purple_debug_info("QQ", "All online buddies received\n"); - qq_update_buddyies_status(gc); - break; - case QQ_CMD_GET_LEVEL: - qq_process_get_level_reply(data, data_len, gc); - break; - case QQ_CMD_GET_BUDDIES_LIST: - ret_16 = qq_process_get_buddies(data, data_len, gc); - if (ret_16 > 0 && ret_16 < 0xffff) { - purple_debug_info("QQ", "Requesting for more buddies\n"); - qq_request_get_buddies(gc, ret_16, update_class); - return; - } - purple_debug_info("QQ", "All buddies received. Requesting buddies' levels\n"); - break; - case QQ_CMD_GET_BUDDIES_AND_ROOMS: - ret_32 = qq_process_get_buddies_and_rooms(data, data_len, gc); - if (ret_32 > 0 && ret_32 < 0xffffffff) { - purple_debug_info("QQ", "Requesting for more buddies and groups\n"); - qq_request_get_buddies_and_rooms(gc, ret_32, update_class); - return; - } - purple_debug_info("QQ", "All buddies and groups received\n"); - break; - case QQ_CMD_AUTH_CODE: - qq_process_auth_code(gc, data, data_len, ship32); - break; - case QQ_CMD_BUDDY_QUESTION: - qq_process_question(gc, data, data_len, ship32); - break; - case QQ_CMD_ADD_BUDDY_NO_AUTH_EX: - qq_process_add_buddy_no_auth_ex(gc, data, data_len, ship32); - break; - case QQ_CMD_ADD_BUDDY_AUTH_EX: - qq_process_add_buddy_auth_ex(gc, data, data_len, ship32); - break; - case QQ_CMD_BUDDY_CHECK_CODE: - qq_process_buddy_check_code(gc, data, data_len); - break; - case QQ_CMD_BUDDY_MEMO: - purple_debug_info("QQ", "Receive memo from server!\n"); - qq_process_get_buddy_memo(gc, data, data_len, update_class, ship32); - return; - purple_debug_info("QQ", "Should NOT be here...\n"); - break; - default: - process_unknow_cmd(gc, _("Unknown CLIENT CMD"), data, data_len, cmd, seq); - is_unknow = TRUE; - break; - } - if (is_unknow) - return; - - if (update_class == QQ_CMD_CLASS_NONE) - return; - - purple_debug_info("QQ", "Update class %d\n", update_class); - if (update_class == QQ_CMD_CLASS_UPDATE_ALL) { - qq_update_all(gc, cmd); - return; - } - if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) { - qq_update_online(gc, cmd); - return; - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_process.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/** - * @file qq_process.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_PROCESS_H -#define _QQ_PROCESS_H - -#include -#include "connection.h" - -#include "qq.h" - -enum { - QQ_CMD_CLASS_NONE = 0, - QQ_CMD_CLASS_UPDATE_ALL, - QQ_CMD_CLASS_UPDATE_ONLINE, - QQ_CMD_CLASS_UPDATE_BUDDY, - QQ_CMD_CLASS_UPDATE_ROOM -}; - -guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32); -void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32); -void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq, - guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len, - guint32 update_class, guint32 ship32); - -void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len); - -void qq_update_all(PurpleConnection *gc, guint16 cmd); -void qq_update_online(PurpleConnection *gc, guint16 cmd); -void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id); -void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id); -#endif - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,415 +0,0 @@ -/** - * @file qq_trans.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "connection.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "request.h" - -#include "qq_define.h" -#include "qq_network.h" -#include "qq_process.h" -#include "qq_trans.h" - -enum { - QQ_TRANS_IS_SERVER = 0x01, /* Is server command or client command */ - QQ_TRANS_IS_IMPORT = 0x02, /* Only notice if not get reply; or resend, disconn if reties get 0*/ - QQ_TRANS_REMAINED = 0x04, /* server command before login*/ - QQ_TRANS_IS_REPLY = 0x08 /* server command before login*/ -}; - -struct _qq_transaction { - guint8 flag; - guint16 seq; - guint16 cmd; - - guint8 room_cmd; - guint32 room_id; - - guint8 *data; - gint data_len; - - gint fd; - gint send_retries; - gint rcved_times; - gint scan_times; - - guint32 update_class; - guint32 ship32; -}; - -gboolean qq_trans_is_server(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, FALSE); - - if (trans->flag & QQ_TRANS_IS_SERVER) - return TRUE; - else - return FALSE; -} - -gboolean qq_trans_is_dup(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, TRUE); - - if (trans->rcved_times > 1) - return TRUE; - else - return FALSE; -} - -guint8 qq_trans_get_room_cmd(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, 0); - return trans->room_cmd; -} - -guint32 qq_trans_get_room_id(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, 0); - return trans->room_id; -} - -guint32 qq_trans_get_class(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, QQ_CMD_CLASS_NONE); - return trans->update_class; -} - -guint32 qq_trans_get_ship(qq_transaction *trans) -{ - g_return_val_if_fail(trans != NULL, 0); - return trans->ship32; -} - -static qq_transaction *trans_create(PurpleConnection *gc, gint fd, - guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd; - qq_transaction *trans; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, NULL); - qd = (qq_data *) gc->proto_data; - - trans = g_new0(qq_transaction, 1); - - memset(trans, 0, sizeof(qq_transaction)); - trans->fd = fd; - trans->cmd = cmd; - trans->seq = seq; - - trans->data = NULL; - trans->data_len = 0; - if (data != NULL && data_len > 0) { - /* don't use g_strdup, may have 0x00 */ - trans->data = g_memdup(data, data_len); - trans->data_len = data_len; - } - - trans->update_class = update_class; - trans->ship32 = ship32; - return trans; -} - -/* Remove a packet with seq from send trans */ -static void trans_remove(PurpleConnection *gc, qq_transaction *trans) -{ - qq_data *qd = (qq_data *)gc->proto_data; - - g_return_if_fail(gc != NULL && gc->proto_data != NULL); - qd = (qq_data *) gc->proto_data; - - g_return_if_fail(trans != NULL); -#if 0 - purple_debug_info("QQ_TRANS", - "Remove [%s%05d] retry %d rcved %d scan %d %s\n", - (trans->flag & QQ_TRANS_IS_SERVER) ? "SRV-" : "", - trans->seq, - trans->send_retries, trans->rcved_times, trans->scan_times, - qq_get_cmd_desc(trans->cmd)); -#endif - if (trans->data) g_free(trans->data); - qd->transactions = g_list_remove(qd->transactions, trans); - g_free(trans); -} - -static qq_transaction *trans_find(PurpleConnection *gc, guint16 cmd, guint16 seq) -{ - qq_data *qd; - GList *list; - qq_transaction *trans; - - g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, NULL); - qd = (qq_data *) gc->proto_data; - - list = qd->transactions; - while (list != NULL) { - trans = (qq_transaction *) list->data; - if(trans->cmd == cmd && trans->seq == seq) { - return trans; - } - list = list->next; - } - - return NULL; -} - -void qq_trans_add_client_cmd(PurpleConnection *gc, - guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, update_class, ship32); - - if (cmd == QQ_CMD_TOKEN || cmd == QQ_CMD_LOGIN || cmd == QQ_CMD_KEEP_ALIVE) { - trans->flag |= QQ_TRANS_IS_IMPORT; - } - trans->send_retries = qd->resend_times; -#if 0 - purple_debug_info("QQ_TRANS", "Add client cmd, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -qq_transaction *qq_trans_find_rcved(PurpleConnection *gc, guint16 cmd, guint16 seq) -{ - qq_transaction *trans; - - trans = trans_find(gc, cmd, seq); - if (trans == NULL) { - return NULL; - } - - if (trans->rcved_times == 0) { - trans->scan_times = 0; - } - trans->rcved_times++; - /* server may not get our confirm reply before, send reply again*/ - if (qq_trans_is_server(trans) && (trans->flag & QQ_TRANS_IS_REPLY)) { - if (trans->data != NULL && trans->data_len > 0) { - qq_send_cmd_encrypted(gc, trans->cmd, trans->seq, trans->data, trans->data_len, FALSE); - } - } - return trans; -} - -void qq_trans_add_room_cmd(PurpleConnection *gc, - guint16 seq, guint8 room_cmd, guint32 room_id, guint8 *data, gint data_len, - guint32 update_class, guint32 ship32) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, QQ_CMD_ROOM, seq, data, data_len, - update_class, ship32); - - trans->room_cmd = room_cmd; - trans->room_id = room_id; - trans->send_retries = qd->resend_times; -#if 0 - purple_debug_info("QQ_TRANS", "Add room cmd, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, rcved, rcved_len, QQ_CMD_CLASS_NONE, 0); - - trans->flag = QQ_TRANS_IS_SERVER; - trans->send_retries = 0; - trans->rcved_times = 1; -#if 0 - purple_debug_info("QQ_TRANS", "Add server cmd, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -void qq_trans_add_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *reply, gint reply_len) -{ - qq_transaction *trans; - - g_return_if_fail(reply != NULL && reply_len > 0); - - trans = trans_find(gc, cmd, seq); - if (trans == NULL) { - return; - } - - g_return_if_fail(trans->flag & QQ_TRANS_IS_SERVER); - trans->flag |= QQ_TRANS_IS_REPLY; - - if (trans->data) g_free(trans->data); - - trans->data = g_memdup(reply, reply_len); - trans->data_len = reply_len; -} - -void qq_trans_add_remain(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, QQ_CMD_CLASS_NONE, 0); - - trans->flag = QQ_TRANS_IS_SERVER; - trans->flag |= QQ_TRANS_REMAINED; - trans->send_retries = 0; - trans->rcved_times = 1; -#if 1 - purple_debug_info("QQ_TRANS", "Add server cmd and remained, seq %d, data %p, len %d\n", - trans->seq, trans->data, trans->data_len); -#endif - qd->transactions = g_list_append(qd->transactions, trans); -} - -void qq_trans_process_remained(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *)gc->proto_data; - GList *curr; - GList *next; - qq_transaction *trans; - - g_return_if_fail(qd != NULL); - - next = qd->transactions; - while( (curr = next) ) { - next = curr->next; - trans = (qq_transaction *) (curr->data); -#if 0 - purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); -#endif - if ( !(trans->flag & QQ_TRANS_IS_SERVER) ) { - continue; - } - if ( !(trans->flag & QQ_TRANS_REMAINED) ) { - continue; - } - /* set QQ_TRANS_REMAINED off */ - trans->flag &= ~QQ_TRANS_REMAINED; - -#if 1 - purple_debug_info("QQ_TRANS", - "Process server cmd remained, seq %d, data %p, len %d, send_retries %d\n", - trans->seq, trans->data, trans->data_len, trans->send_retries); -#endif - qq_proc_server_cmd(gc, trans->cmd, trans->seq, trans->data, trans->data_len); - } - - /* purple_debug_info("QQ_TRANS", "Scan finished\n"); */ - return; -} - -gboolean qq_trans_scan(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *)gc->proto_data; - GList *curr; - GList *next; - qq_transaction *trans; - - g_return_val_if_fail(qd != NULL, FALSE); - - next = qd->transactions; - while( (curr = next) ) { - next = curr->next; - trans = (qq_transaction *) (curr->data); - /* purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); */ - - if (trans->flag & QQ_TRANS_REMAINED) { - /* keep server cmd before login*/ - continue; - } - - trans->scan_times++; - if (trans->scan_times <= 1) { - /* skip in 10 seconds */ - continue; - } - - if (trans->rcved_times > 0) { - /* Has been received */ - trans_remove(gc, trans); - continue; - } - - if (trans->flag & QQ_TRANS_IS_SERVER) { - continue; - } - - /* Never get reply */ - trans->send_retries--; - if (trans->send_retries <= 0) { - purple_debug_warning("QQ_TRANS", - "[%d] %s is lost.\n", - trans->seq, qq_get_cmd_desc(trans->cmd)); - if (trans->flag & QQ_TRANS_IS_IMPORT) { - return TRUE; - } - - qd->net_stat.lost++; - purple_debug_error("QQ_TRANS", - "Lost [%d] %s, data %p, len %d, retries %d\n", - trans->seq, qq_get_cmd_desc(trans->cmd), - trans->data, trans->data_len, trans->send_retries); - trans_remove(gc, trans); - continue; - } - - qd->net_stat.resend++; - purple_debug_warning("QQ_TRANS", - "Resend [%d] %s data %p, len %d, send_retries %d\n", - trans->seq, qq_get_cmd_desc(trans->cmd), - trans->data, trans->data_len, trans->send_retries); - qq_send_cmd_encrypted(gc, trans->cmd, trans->seq, trans->data, trans->data_len, FALSE); - } - - /* purple_debug_info("QQ_TRANS", "Scan finished\n"); */ - return FALSE; -} - -/* clean up send trans and free all contents */ -void qq_trans_remove_all(PurpleConnection *gc) -{ - qq_data *qd = (qq_data *)gc->proto_data; - qq_transaction *trans; - gint count = 0; - - while(qd->transactions != NULL) { - trans = (qq_transaction *) (qd->transactions->data); - qd->transactions = g_list_remove(qd->transactions, trans); - - if (trans->data) g_free(trans->data); - g_free(trans); - - count++; - } - if (count > 0) { - purple_debug_info("QQ_TRANS", "Free all %d packets\n", count); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/qq_trans.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -/** - * @file qq_trans.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_SEND_QUEUE_H_ -#define _QQ_SEND_QUEUE_H_ - -#include -#include "qq.h" - -typedef struct _qq_transaction qq_transaction; - -qq_transaction *qq_trans_find_rcved(PurpleConnection *gc, guint16 cmd, guint16 seq); -gboolean qq_trans_is_server(qq_transaction *trans) ; -gboolean qq_trans_is_dup(qq_transaction *trans); -guint8 qq_trans_get_room_cmd(qq_transaction *trans); -guint32 qq_trans_get_room_id(qq_transaction *trans); -guint32 qq_trans_get_class(qq_transaction *trans); -guint32 qq_trans_get_ship(qq_transaction *trans); - -void qq_trans_add_client_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32); -void qq_trans_add_room_cmd(PurpleConnection *gc, - guint16 seq, guint8 room_cmd, guint32 room_id, - guint8 *data, gint data_len, guint32 update_class, guint32 ship32); -void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *rcved, gint rcved_len); -void qq_trans_add_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *reply, gint reply_len); -void qq_trans_add_remain(PurpleConnection *gc, guint16 cmd, guint16 seq, - guint8 *data, gint data_len); - -void qq_trans_process_remained(PurpleConnection *gc); -gboolean qq_trans_scan(PurpleConnection *gc); -void qq_trans_remove_all(PurpleConnection *gc); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,944 +0,0 @@ -/** - * @file send_file.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "qq.h" - -#include "send_file.h" -#include "debug.h" -#include "network.h" -#include "notify.h" - -#include "buddy_list.h" -#include "file_trans.h" -#include "qq_define.h" -#include "im.h" -#include "qq_base.h" -#include "packet_parse.h" -#include "qq_network.h" -#include "utils.h" - -enum -{ - QQ_FILE_TRANS_REQ = 0x0035, - QQ_FILE_TRANS_ACC_UDP = 0x0037, - QQ_FILE_TRANS_ACC_TCP = 0x0003, - QQ_FILE_TRANS_DENY_UDP = 0x0039, - QQ_FILE_TRANS_DENY_TCP = 0x0005, - QQ_FILE_TRANS_NOTIFY = 0x003b, - QQ_FILE_TRANS_NOTIFY_ACK = 0x003c, - QQ_FILE_TRANS_CANCEL = 0x0049, - QQ_FILE_TRANS_PASV = 0x003f -}; - -static int _qq_in_same_lan(ft_info *info) -{ - if (info->remote_internet_ip == info->local_internet_ip) return 1; - purple_debug_info("QQ", - "Not in the same LAN, remote internet ip[%x], local internet ip[%x]\n", - info->remote_internet_ip - , info->local_internet_ip); - return 0; -} - -static int _qq_xfer_init_udp_channel(ft_info *info) -{ - struct sockaddr_in sin; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - if (!_qq_in_same_lan(info)) { - sin.sin_port = g_htons(info->remote_major_port); - sin.sin_addr.s_addr = g_htonl(info->remote_internet_ip); - } else { - sin.sin_port = g_htons(info->remote_minor_port); - sin.sin_addr.s_addr = g_htonl(info->remote_real_ip); - } - return 0; -} - -/* these 2 functions send and recv buffer from/to UDP channel */ -static ssize_t _qq_xfer_udp_recv(guint8 *buf, size_t len, PurpleXfer *xfer) -{ - struct sockaddr_in sin; - socklen_t sinlen; - ft_info *info; - gint r; - - info = (ft_info *) xfer->data; - sinlen = sizeof(sin); - r = recvfrom(info->recv_fd, buf, len, 0, (struct sockaddr *) &sin, &sinlen); - purple_debug_info("QQ", - "==> recv %d bytes from File UDP Channel, remote ip[%s], remote port[%d]\n", - r, inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port)); - return r; -} - -/* -static ssize_t _qq_xfer_udp_send(const char *buf, size_t len, PurpleXfer *xfer) -{ - ft_info *info; - - info = (ft_info *) xfer->data; - return send(info->sender_fd, buf, len, 0); -} -*/ - -static ssize_t _qq_xfer_udp_send(const guint8 *buf, size_t len, PurpleXfer *xfer) -{ - struct sockaddr_in sin; - ft_info *info; - - info = (ft_info *) xfer->data; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - if (!_qq_in_same_lan(info)) { - sin.sin_port = g_htons(info->remote_major_port); - sin.sin_addr.s_addr = g_htonl(info->remote_internet_ip); - } else if (info->use_major) { - sin.sin_port = g_htons(info->remote_major_port); - sin.sin_addr.s_addr = g_htonl(info->remote_real_ip); - } else { - sin.sin_port = g_htons(info->remote_minor_port); - sin.sin_addr.s_addr = g_htonl(info->remote_real_ip); - } - purple_debug_info("QQ", "sending to channel: %s:%d\n", - inet_ntoa(sin.sin_addr), - (int)g_ntohs(sin.sin_port) - ); - return sendto(info->sender_fd, buf, len, 0, (struct sockaddr *) &sin, sizeof(sin)); -} - -/* user-defined functions for purple_xfer_read and purple_xfer_write */ - -/* -static ssize_t _qq_xfer_read(char **buf, PurpleXfer *xfer) -{ - *buf = g_newa(char, QQ_FILE_FRAGMENT_MAXLEN + 100); - return _qq_xfer_udp_recv(*buf, QQ_FILE_FRAGMENT_MAXLEN + 100, xfer); -} -*/ - -gssize _qq_xfer_write(const guint8 *buf, size_t len, PurpleXfer *xfer) -{ - return _qq_xfer_udp_send(buf, len, xfer); -} - -static void _qq_xfer_recv_packet(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - PurpleAccount *account = purple_xfer_get_account(xfer); - PurpleConnection *gc = purple_account_get_connection(account); - guint8 *buf; - gint size; - /* FIXME: It seems that the transfer never use a packet - * larger than 1500 bytes, so if it happened to be a - * larger packet, either error occurred or protocol should - * be modified - */ - ft_info *info; - info = xfer->data; - g_return_if_fail (source == info->recv_fd); - buf = g_newa(guint8, 1500); - size = _qq_xfer_udp_recv(buf, 1500, xfer); - qq_process_recv_file(gc, buf, size); -} - -/* start file transfer process */ -/* -static void _qq_xfer_send_start (PurpleXfer *xfer) -{ - PurpleAccount *account; - PurpleConnection *gc; - ft_info *info; - - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - info = (ft_info *) xfer->data; -} -*/ - -/* -static void _qq_xfer_send_ack (PurpleXfer *xfer, const char *buffer, size_t len) -{ - PurpleAccount *account; - PurpleConnection *gc; - - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - qq_process_recv_file(gc, (guint8 *) buffer, len); -} -*/ - -/* -static void _qq_xfer_recv_start(PurpleXfer *xfer) -{ -} -*/ - -static void _qq_xfer_end(PurpleXfer *xfer) -{ - ft_info *info; - g_return_if_fail(xfer != NULL && xfer->data != NULL); - info = (ft_info *) xfer->data; - - qq_xfer_close_file(xfer); - if (info->dest_fp != NULL) { - fclose(info->dest_fp); - purple_debug_info("QQ", "file closed\n"); - } - if (info->major_fd != 0) { - close(info->major_fd); - purple_debug_info("QQ", "major port closed\n"); - } - if (info->minor_fd != 0) { - close(info->minor_fd); - purple_debug_info("QQ", "minor port closed\n"); - } - /* - if (info->buffer != NULL) { - munmap(info->buffer, purple_xfer_get_size(xfer)); - purple_debug_info("QQ", "file mapping buffer is freed.\n"); - } - */ - g_free(info); -} - -static void qq_show_conn_info(ft_info *info) -{ - gchar *internet_ip_str, *real_ip_str; - guint32 ip; - - ip = g_htonl(info->remote_real_ip); - real_ip_str = gen_ip_str((guint8 *) &ip); - ip = g_htonl(info->remote_internet_ip); - internet_ip_str = gen_ip_str((guint8 *) &ip); - purple_debug_info("QQ", "remote internet ip[%s:%d], major port[%d], real ip[%s], minor port[%d]\n", - internet_ip_str, info->remote_internet_port, - info->remote_major_port, real_ip_str, info->remote_minor_port - ); - g_free(real_ip_str); - g_free(internet_ip_str); -} - -#define QQ_CONN_INFO_LEN 61 -gint qq_get_conn_info(ft_info *info, guint8 *data) -{ - gint bytes = 0; - /* 16 + 30 + 1 + 4 + 2 + 2 + 4 + 2 = 61 */ - bytes += qq_getdata(info->file_session_key, 16, data + bytes); - bytes += 30; /* skip 30 bytes */ - bytes += qq_get8(&info->conn_method, data + bytes); - bytes += qq_get32(&info->remote_internet_ip, data + bytes); - bytes += qq_get16(&info->remote_internet_port, data + bytes); - bytes += qq_get16(&info->remote_major_port, data + bytes); - bytes += qq_get32(&info->remote_real_ip, data + bytes); - bytes += qq_get16(&info->remote_minor_port, data + bytes); - qq_show_conn_info(info); - return bytes; -} - -gint qq_fill_conn_info(guint8 *raw_data, ft_info *info) -{ - gint bytes = 0; - /* 064: connection method, UDP 0x00, TCP 0x03 */ - bytes += qq_put8 (raw_data + bytes, info->conn_method); - /* 065-068: outer ip address of sender (proxy address) */ - bytes += qq_put32 (raw_data + bytes, info->local_internet_ip); - /* 069-070: sender port */ - bytes += qq_put16 (raw_data + bytes, info->local_internet_port); - /* 071-072: the first listening port(TCP doesn't have this part) */ - bytes += qq_put16 (raw_data + bytes, info->local_major_port); - /* 073-076: real ip */ - bytes += qq_put32 (raw_data + bytes, info->local_real_ip); - /* 077-078: the second listening port */ - bytes += qq_put16 (raw_data + bytes, info->local_minor_port); - return bytes; -} - - -/* fill in the common information of file transfer */ -static gint _qq_create_packet_file_header -(guint8 *raw_data, guint32 to_uid, guint16 message_type, qq_data *qd, gboolean seq_ack) -{ - gint bytes; - time_t now; - guint16 seq; - ft_info *info; - - bytes = 0; - now = time(NULL); - if (!seq_ack) seq = qd->send_seq; - else { - info = (ft_info *) qd->xfer->data; - seq = info->send_seq; - } - - /* 000-003: receiver uid */ - bytes += qq_put32 (raw_data + bytes, qd->uid); - /* 004-007: sender uid */ - bytes += qq_put32 (raw_data + bytes, to_uid); - /* 008-009: sender client version */ - bytes += qq_put16 (raw_data + bytes, qd->client_tag); - /* 010-013: receiver uid */ - bytes += qq_put32 (raw_data + bytes, qd->uid); - /* 014-017: sender uid */ - bytes += qq_put32 (raw_data + bytes, to_uid); - /* 018-033: md5 of (uid+session_key) */ - bytes += qq_putdata (raw_data + bytes, qd->session_md5, 16); - /* 034-035: message type */ - bytes += qq_put16 (raw_data + bytes, message_type); - /* 036-037: sequence number */ - bytes += qq_put16 (raw_data + bytes, seq); - /* 038-041: send time */ - bytes += qq_put32 (raw_data + bytes, (guint32) now); - /* 042-042: always 0x00 */ - bytes += qq_put8 (raw_data + bytes, 0x00); - /* 043-043: sender icon */ - bytes += qq_put8 (raw_data + bytes, qd->my_icon); - /* 044-046: always 0x00 */ - bytes += qq_put16 (raw_data + bytes, 0x0000); - bytes += qq_put8 (raw_data + bytes, 0x00); - /* 047-047: we use font attr */ - bytes += qq_put8 (raw_data + bytes, 0x01); - /* 048-051: always 0x00 */ - bytes += qq_put32 (raw_data + bytes, 0x00000000); - - /* 052-062: always 0x00 */ - bytes += qq_put32 (raw_data + bytes, 0x00000000); - bytes += qq_put32 (raw_data + bytes, 0x00000000); - bytes += qq_put16 (raw_data + bytes, 0x0000); - bytes += qq_put8 (raw_data + bytes, 0x00); - /* 063: transfer_type, 0x65: FILE 0x6b: FACE */ - bytes += qq_put8 (raw_data + bytes, QQ_FILE_TRANSFER_FILE); /* FIXME */ - - return bytes; -} - -#if 0 -in_addr_t get_real_ip() -{ - char hostname[40]; - struct hostent *host; - - gethostname(hostname, sizeof(hostname)); - host = gethostbyname(hostname); - return *(host->h_addr); -} - - -#include -#include - -#define MAXINTERFACES 16 -in_addr_t get_real_ip() -{ - int fd, intrface, i; - struct ifconf ifc; - struct ifreq buf[MAXINTERFACES]; - in_addr_t ret; - - if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 0; - ifc.ifc_len = sizeof(buf); - ifc.ifc_buf = (caddr_t) buf; - if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0) return 0; - intrface = ifc.ifc_len / sizeof(struct ifreq); - for (i = 0; i < intrface; i++) { - /* buf[intrface].ifr_name */ - if (ioctl(fd, SIOCGIFADDR, (char *) &buf[i]) >= 0) - { - ret = (((struct sockaddr_in *)(&buf[i].ifr_addr))->sin_addr).s_addr; - if (ret == g_ntohl(0x7f000001)) continue; - return ret; - } - } - return 0; -} -#endif - -static void _qq_xfer_init_socket(PurpleXfer *xfer) -{ - gint sockfd, listen_port = 0, i; - socklen_t sin_len; - struct sockaddr_in sin; - ft_info *info; - - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->data != NULL); - info = (ft_info *) xfer->data; - - /* debug - info->local_real_ip = 0x7f000001; - */ - info->local_real_ip = g_ntohl(inet_addr(purple_network_get_my_ip(-1))); - purple_debug_info("QQ", "local real ip is %x\n", info->local_real_ip); - - for (i = 0; i < 2; i++) { - sockfd = socket(PF_INET, SOCK_DGRAM, 0); - g_return_if_fail(sockfd >= 0); - - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - sin_len = sizeof(sin); - bind(sockfd, (struct sockaddr *) &sin, sin_len); - getsockname(sockfd, (struct sockaddr *) &sin, &sin_len); - listen_port = g_ntohs(sin.sin_port); - - switch (i) { - case 0: - info->local_major_port = listen_port; - info->major_fd = sockfd; - purple_debug_info("QQ", "UDP Major Channel created on port[%d]\n", - info->local_major_port); - break; - case 1: - info->local_minor_port = listen_port; - info->minor_fd = sockfd; - purple_debug_info("QQ", "UDP Minor Channel created on port[%d]\n", - info->local_minor_port); - break; - } - } - - if (_qq_in_same_lan(info)) { - info->sender_fd = info->recv_fd = info->minor_fd; - } else { - info->sender_fd = info->recv_fd = info->major_fd; - } -/* xfer->watcher = purple_input_add(info->recv_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); */ -} - -/* create the QQ_FILE_TRANS_REQ packet with file infomations */ -static void _qq_send_packet_file_request (PurpleConnection *gc, guint32 to_uid, gchar *filename, gint filesize) -{ - qq_data *qd; - guint8 *raw_data; - gchar *filelen_str; - gint filename_len, filelen_strlen, packet_len, bytes; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - - info = g_new0(ft_info, 1); - info->to_uid = to_uid; - info->send_seq = qd->send_seq; - info->local_internet_ip = qd->my_ip.s_addr; - info->local_internet_port = qd->my_port; - info->local_real_ip = 0x00000000; - info->conn_method = 0x00; - qd->xfer->data = info; - - filename_len = strlen(filename); - filelen_str = g_strdup_printf("%d ?ֽ?", filesize); - filelen_strlen = strlen(filelen_str); - - packet_len = 82 + filename_len + filelen_strlen; - raw_data = g_newa(guint8, packet_len); - bytes = 0; - - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, - QQ_FILE_TRANS_REQ, qd, FALSE); - bytes += qq_fill_conn_info(raw_data + bytes, info); - /* 079: 0x20 */ - bytes += qq_put8 (raw_data + bytes, 0x20); - /* 080: 0x1f */ - bytes += qq_put8 (raw_data + bytes, 0x1f); - /* undetermined len: filename */ - bytes += qq_putdata (raw_data + bytes, (guint8 *) filename, filename_len); - /* 0x1f */ - bytes += qq_put8 (raw_data + bytes, 0x1f); - /* file length */ - bytes += qq_putdata (raw_data + bytes, (guint8 *) filelen_str, filelen_strlen); - - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file_request", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); - - g_free (filelen_str); -} - -/* tell the buddy we want to accept the file */ -static void _qq_send_packet_file_accept(PurpleConnection *gc, guint32 to_uid) -{ - qq_data *qd; - guint8 *raw_data; - guint16 minor_port; - guint32 real_ip; - gint packet_len, bytes; - ft_info *info; - - qd = (qq_data *) gc->proto_data; - info = (ft_info *) qd->xfer->data; - - purple_debug_info("QQ", "I've accepted the file transfer request from %d\n", to_uid); - _qq_xfer_init_socket(qd->xfer); - - packet_len = 79; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - minor_port = info->local_minor_port; - real_ip = info->local_real_ip; - info->local_minor_port = 0; - info->local_real_ip = 0; - - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_ACC_UDP, qd, TRUE); - bytes += qq_fill_conn_info(raw_data + bytes, info); - - info->local_minor_port = minor_port; - info->local_real_ip = real_ip; - - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file_accept", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); -} - -static void _qq_send_packet_file_notifyip(PurpleConnection *gc, guint32 to_uid) -{ - PurpleXfer *xfer; - ft_info *info; - qq_data *qd; - guint8 *raw_data; - gint packet_len, bytes; - - qd = (qq_data *) gc->proto_data; - xfer = qd->xfer; - info = xfer->data; - - packet_len = 79; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - purple_debug_info("QQ", "<== sending qq file notify ip packet\n"); - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_NOTIFY, qd, TRUE); - bytes += qq_fill_conn_info(raw_data + bytes, info); - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file_notify", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); - - if (xfer->watcher) purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(info->recv_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); - purple_input_add(info->major_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); -} - -/* tell the buddy we don't want the file */ -static void _qq_send_packet_file_reject (PurpleConnection *gc, guint32 to_uid) -{ - qq_data *qd; - guint8 *raw_data; - gint packet_len, bytes; - - purple_debug_info("_qq_send_packet_file_reject", "start\n"); - qd = (qq_data *) gc->proto_data; - - packet_len = 64; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_DENY_UDP, qd, TRUE); - - if (packet_len == bytes) - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - else - purple_debug_info("qq_send_packet_file", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); -} - -/* tell the buddy to cancel transfer */ -static void _qq_send_packet_file_cancel (PurpleConnection *gc, guint32 to_uid) -{ - qq_data *qd; - guint8 *raw_data; - gint packet_len, bytes; - - purple_debug_info("_qq_send_packet_file_cancel", "start\n"); - qd = (qq_data *) gc->proto_data; - - packet_len = 64; - raw_data = g_newa (guint8, packet_len); - bytes = 0; - - purple_debug_info("_qq_send_packet_file_cancel", "before create header\n"); - bytes += _qq_create_packet_file_header(raw_data + bytes, to_uid, QQ_FILE_TRANS_CANCEL, qd, TRUE); - purple_debug_info("_qq_send_packet_file_cancel", "end create header\n"); - - if (packet_len == bytes) { - purple_debug_info("_qq_send_packet_file_cancel", "before send cmd\n"); - qq_send_cmd(gc, QQ_CMD_SEND_IM, raw_data, bytes); - } - else - purple_debug_info("qq_send_packet_file", - "%d bytes expected but got %d bytes\n", - packet_len, bytes); - - purple_debug_info("qq_send_packet_file_cancel", "end\n"); -} - -/* request to send a file */ -static void -_qq_xfer_init (PurpleXfer * xfer) -{ - PurpleConnection *gc; - PurpleAccount *account; - guint32 to_uid; - const gchar *filename; - gchar *base_filename; - - g_return_if_fail (xfer != NULL); - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - - to_uid = purple_name_to_uid (xfer->who); - g_return_if_fail (to_uid != 0); - - filename = purple_xfer_get_local_filename (xfer); - g_return_if_fail (filename != NULL); - - base_filename = g_path_get_basename(filename); - - _qq_send_packet_file_request (gc, to_uid, base_filename, - purple_xfer_get_size(xfer)); - g_free(base_filename); -} - -/* cancel the transfer of receiving files */ -static void _qq_xfer_cancel(PurpleXfer *xfer) -{ - PurpleConnection *gc; - PurpleAccount *account; - guint16 *seq; - - g_return_if_fail (xfer != NULL); - seq = (guint16 *) xfer->data; - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - - switch (purple_xfer_get_status(xfer)) { - case PURPLE_XFER_STATUS_CANCEL_LOCAL: - _qq_send_packet_file_cancel(gc, purple_name_to_uid(xfer->who)); - break; - case PURPLE_XFER_STATUS_CANCEL_REMOTE: - _qq_send_packet_file_cancel(gc, purple_name_to_uid(xfer->who)); - break; - case PURPLE_XFER_STATUS_NOT_STARTED: - break; - case PURPLE_XFER_STATUS_UNKNOWN: - _qq_send_packet_file_reject(gc, purple_name_to_uid(xfer->who)); - break; - case PURPLE_XFER_STATUS_DONE: - break; - case PURPLE_XFER_STATUS_ACCEPTED: - break; - case PURPLE_XFER_STATUS_STARTED: - break; - } -} - -/* init the transfer of receiving files */ -static void _qq_xfer_recv_init(PurpleXfer *xfer) -{ - PurpleConnection *gc; - PurpleAccount *account; - ft_info *info; - - g_return_if_fail (xfer != NULL && xfer->data != NULL); - info = (ft_info *) xfer->data; - account = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(account); - - _qq_send_packet_file_accept(gc, purple_name_to_uid(xfer->who)); -} - -/* process reject im for file transfer request */ -void qq_process_recv_file_reject (guint8 *data, gint data_len, - guint32 sender_uid, PurpleConnection *gc) -{ - gchar *msg, *filename; - qq_data *qd; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - g_return_if_fail (qd->xfer != NULL); - - /* border has been checked before - if (*cursor >= (data + data_len - 1)) { - purple_debug_warning("QQ", - "Received file reject message is empty\n"); - return; - } - */ - filename = g_path_get_basename(purple_xfer_get_local_filename(qd->xfer)); - msg = g_strdup_printf(_("%d has declined the file %s"), - sender_uid, filename); - - purple_notify_warning (gc, _("File Send"), msg, NULL); - purple_xfer_request_denied(qd->xfer); - qd->xfer = NULL; - - g_free(filename); - g_free(msg); -} - -/* process cancel im for file transfer request */ -void qq_process_recv_file_cancel (guint8 *data, gint data_len, - guint32 sender_uid, PurpleConnection *gc) -{ - gchar *msg, *filename; - qq_data *qd; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - g_return_if_fail (qd->xfer != NULL - && purple_xfer_get_filename(qd->xfer) != NULL); - - /* border has been checked before - if (*cursor >= (data + data_len - 1)) { - purple_debug_warning("QQ", "Received file reject message is empty\n"); - return; - } - */ - filename = g_path_get_basename(purple_xfer_get_local_filename(qd->xfer)); - msg = g_strdup_printf - (_("%d cancelled the transfer of %s"), - sender_uid, filename); - - purple_notify_warning (gc, _("File Send"), msg, NULL); - purple_xfer_cancel_remote(qd->xfer); - qd->xfer = NULL; - - g_free(filename); - g_free(msg); -} - -/* process accept im for file transfer request */ -void qq_process_recv_file_accept(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc) -{ - qq_data *qd; - gint bytes; - ft_info *info; - PurpleXfer *xfer; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - xfer = qd->xfer; - info = (ft_info *) qd->xfer->data; - - if (data_len <= 30 + QQ_CONN_INFO_LEN) { - purple_debug_warning("QQ", "Received file reject message is empty\n"); - return; - } - - bytes = 18 + 12; /* skip 30 bytes */ - qq_get_conn_info(info, data + bytes); - _qq_xfer_init_socket(qd->xfer); - - _qq_xfer_init_udp_channel(info); - _qq_send_packet_file_notifyip(gc, sender_uid); -} - -/* process request from buddy's im for file transfer request */ -void qq_process_recv_file_request(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection * gc) -{ - qq_data *qd; - PurpleXfer *xfer; - gchar *sender_name, **fileinfo; - ft_info *info; - PurpleBuddy *b; - qq_buddy_data *bd; - gint bytes; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - - info = g_newa(ft_info, 1); - info->local_internet_ip = qd->my_ip.s_addr; - info->local_internet_port = qd->my_port; - info->local_real_ip = 0x00000000; - info->to_uid = sender_uid; - - if (data_len <= 2 + 30 + QQ_CONN_INFO_LEN) { - purple_debug_warning("QQ", "Received file request message is empty\n"); - return; - } - bytes = 0; - bytes += qq_get16(&(info->send_seq), data + bytes); - - bytes += 18 + 12; /* skip 30 bytes */ - bytes += qq_get_conn_info(info, data + bytes); - - fileinfo = g_strsplit((gchar *) (data + 81 + 12), "\x1f", 2); - g_return_if_fail (fileinfo != NULL && fileinfo[0] != NULL && fileinfo[1] != NULL); - - sender_name = uid_to_purple_name(sender_uid); - - /* FACE from IP detector, ignored by gfhuang */ - if(g_ascii_strcasecmp(fileinfo[0], "FACE") == 0) { - purple_debug_warning("QQ", - "Received a FACE ip detect from %d, so he/she must be online :)\n", sender_uid); - - b = purple_find_buddy(gc->account, sender_name); - bd = (b == NULL) ? NULL : purple_buddy_get_protocol_data(b); - if (bd) { - if(0 != info->remote_real_ip) { - g_memmove(&(bd->ip), &info->remote_real_ip, sizeof(bd->ip)); - bd->port = info->remote_minor_port; - } - else if (0 != info->remote_internet_ip) { - g_memmove(&(bd->ip), &info->remote_internet_ip, sizeof(bd->ip)); - bd->port = info->remote_major_port; - } - - if(!is_online(bd->status)) { - bd->status = QQ_BUDDY_ONLINE_INVISIBLE; - bd->last_update = time(NULL); - qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); - } - else - purple_debug_info("QQ", "buddy %d is already online\n", sender_uid); - - } - else - purple_debug_warning("QQ", "buddy %d is not in list\n", sender_uid); - - g_free(sender_name); - g_strfreev(fileinfo); - return; - } - - xfer = purple_xfer_new(purple_connection_get_account(gc), - PURPLE_XFER_RECEIVE, - sender_name); - if (xfer) - { - purple_xfer_set_filename(xfer, fileinfo[0]); - purple_xfer_set_size(xfer, atoi(fileinfo[1])); - - purple_xfer_set_init_fnc(xfer, _qq_xfer_recv_init); - purple_xfer_set_request_denied_fnc(xfer, _qq_xfer_cancel); - purple_xfer_set_cancel_recv_fnc(xfer, _qq_xfer_cancel); - purple_xfer_set_end_fnc(xfer, _qq_xfer_end); - purple_xfer_set_write_fnc(xfer, _qq_xfer_write); - - xfer->data = info; - qd->xfer = xfer; - - purple_xfer_request(xfer); - } - - g_free(sender_name); - g_strfreev(fileinfo); -} - -static void _qq_xfer_send_notify_ip_ack(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer = (PurpleXfer *) data; - PurpleAccount *account = purple_xfer_get_account(xfer); - PurpleConnection *gc = purple_account_get_connection(account); - ft_info *info = (ft_info *) xfer->data; - - purple_input_remove(xfer->watcher); - xfer->watcher = purple_input_add(info->recv_fd, PURPLE_INPUT_READ, _qq_xfer_recv_packet, xfer); - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_NOTIFY_IP_ACK, info->to_uid, 0); - /* - info->use_major = TRUE; - qq_send_file_ctl_packet(gc, QQ_FILE_CMD_NOTIFY_IP_ACK, info->to_uid, 0); - info->use_major = FALSE; - */ -} - -void qq_process_recv_file_notify(guint8 *data, gint data_len, - guint32 sender_uid, PurpleConnection *gc) -{ - gint bytes; - qq_data *qd; - ft_info *info; - PurpleXfer *xfer; - - g_return_if_fail (data != NULL && data_len != 0); - qd = (qq_data *) gc->proto_data; - - xfer = qd->xfer; - info = (ft_info *) qd->xfer->data; - if (data_len <= 2 + 30 + QQ_CONN_INFO_LEN) { - purple_debug_warning("QQ", "Received file notify message is empty\n"); - return; - } - - bytes = 0; - bytes += qq_get16(&(info->send_seq), data + bytes); - - bytes += 18 + 12; - bytes += qq_get_conn_info(info, data + bytes); - - _qq_xfer_init_udp_channel(info); - - xfer->watcher = purple_input_add(info->sender_fd, PURPLE_INPUT_WRITE, _qq_xfer_send_notify_ip_ack, xfer); -} - -/* temp placeholder until a working function can be implemented */ -gboolean qq_can_receive_file(PurpleConnection *gc, const char *who) -{ - return TRUE; -} - -void qq_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - qq_data *qd; - PurpleXfer *xfer; - - qd = (qq_data *) gc->proto_data; - - xfer = purple_xfer_new (gc->account, PURPLE_XFER_SEND, - who); - if (xfer) - { - purple_xfer_set_init_fnc (xfer, _qq_xfer_init); - purple_xfer_set_cancel_send_fnc (xfer, _qq_xfer_cancel); - purple_xfer_set_write_fnc(xfer, _qq_xfer_write); - - qd->xfer = xfer; - purple_xfer_request(xfer); - } -} - -/* -static void qq_send_packet_request_key(PurpleConnection *gc, guint8 key) -{ - qq_send_cmd(gc, QQ_CMD_REQUEST_KEY, &key, 1); -} - -static void qq_process_recv_request_key(PurpleConnection *gc) -{ -} -*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/send_file.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/** - * @file send_file.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_QQ_SEND_FILE_H_ -#define _QQ_QQ_SEND_FILE_H_ - -#include "ft.h" -#include "qq.h" - -typedef struct _ft_info { - guint32 to_uid; - guint16 send_seq; - guint8 file_session_key[QQ_KEY_LENGTH]; - guint8 conn_method; - guint32 remote_internet_ip; - guint16 remote_internet_port; - guint16 remote_major_port; - guint32 remote_real_ip; - guint16 remote_minor_port; - guint32 local_internet_ip; - guint16 local_internet_port; - guint16 local_major_port; - guint32 local_real_ip; - guint16 local_minor_port; - /* we use these to control the packets sent or received */ - guint32 fragment_num; - guint32 fragment_len; - /* The max index of sending/receiving fragment - * for sender, it is the lower bolder of a slide window for sending - * for receiver, it seems that packets having a fragment index lower - * than max_fragment_index have been received already - */ - guint32 max_fragment_index; - guint32 window; - - /* It seems that using xfer's function is not enough for our - * transfer module. So I will use our own structure instead - * of xfer provided - */ - int major_fd; - int minor_fd; - int sender_fd; - int recv_fd; - FILE *dest_fp; - /* guint8 *buffer; */ - gboolean use_major; -} ft_info; - -void qq_process_recv_file_accept(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_reject(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_cancel(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_request(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -void qq_process_recv_file_notify(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc); -gboolean qq_can_receive_file(PurpleConnection *gc, const char *who); -void qq_send_file(PurpleConnection *gc, const char *who, const char *file); -gint qq_get_conn_info(ft_info *info, guint8 *data); -gint qq_fill_conn_info(guint8 *data, ft_info *info); -gssize _qq_xfer_write(const guint8 *buf, size_t len, PurpleXfer *xfer); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,359 +0,0 @@ -/** - * @file utils.c - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "limits.h" -#include "stdlib.h" -#include "string.h" - -#ifdef _WIN32 -#include "win32dep.h" -#endif - -#include "cipher.h" - -#include "char_conv.h" -#include "debug.h" -#include "prefs.h" -#include "qq.h" -#include "util.h" -#include "utils.h" - -/* These functions are used only in development phase */ -/* - static void _qq_show_socket(gchar *desc, gint fd) { - struct sockaddr_in sin; - socklen_t len = sizeof(sin); - getsockname(fd, (struct sockaddr *)&sin, &len); - purple_debug_info(desc, "%s:%d\n", - inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port)); - } - */ - -void qq_get_md5(guint8 *md5, gint md5_len, const guint8* const src, gint src_len) -{ - PurpleCipher *cipher; - PurpleCipherContext *context; - - g_return_if_fail(md5 != NULL && md5_len > 0); - g_return_if_fail(src != NULL && src_len > 0); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - purple_cipher_context_append(context, src, src_len); - purple_cipher_context_digest(context, md5_len, md5, NULL); - purple_cipher_context_destroy(context); -} - -gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount) -{ - gint index; - - index = atoi(index_str); - if (index < 0 || index >= amount) - index = 0; - - return array[index]; -} - -gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount) -{ - gint index; - - for (index = 0; index <= amount; index++) - if (g_ascii_strcasecmp(array[index], name) == 0) - break; - - if (index >= amount) - index = 0; /* meaning no match */ - return g_strdup_printf("%d", index); -} - -/* split the given data(len) with delimit, - * check the number of field matches the expected_fields (<=0 means all) - * return gchar* array (needs to be freed by g_strfreev later), or NULL */ -gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields) -{ - guint8 *input; - gchar **segments, **seg; - gint count = 0, j; - - g_return_val_if_fail(data != NULL && len != 0 && delimit != 0, NULL); - - /* as the last field would be string, but data is not ended with 0x00 - * we have to duplicate the data and append a 0x00 at the end */ - input = g_newa(guint8, len + 1); - g_memmove(input, data, len); - input[len] = 0x00; - - segments = g_strsplit((gchar *) input, delimit, 0); - if (expected_fields <= 0) - return segments; - - for (seg = segments; *seg != NULL; seg++) - count++; - if (count < expected_fields) { /* not enough fields */ - purple_debug_error("QQ", "Less fields %d then %d\n", count, expected_fields); - return NULL; - } else if (count > expected_fields) { /* more fields, OK */ - purple_debug_warning("QQ", "More fields %d than %d\n", count, expected_fields); - /* free up those not used */ - for (j = expected_fields; j < count; j++) { - purple_debug_warning("QQ", "field[%d] is %s\n", j, segments[j]); - g_free(segments[j]); - } - segments[expected_fields] = NULL; - } - - return segments; -} - -/* convert Purple name to original QQ UID */ -guint32 purple_name_to_uid(const gchar *const name) -{ - guint32 ret; - g_return_val_if_fail(name != NULL, 0); - - ret = strtoul(name, NULL, 10); - if (errno == ERANGE) - return 0; - else - return ret; -} - -gchar *gen_ip_str(guint8 *ip) { - gchar *ret; - if (ip == NULL || ip[0] == 0) { - ret = g_new(gchar, 1); - *ret = '\0'; - return ret; - } else { - return g_strdup_printf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - } -} - -guint8 *str_ip_gen(gchar *str) { - guint8 *ip = g_new(guint8, 4); - gint a, b, c, d; - - sscanf(str, "%d.%d.%d.%d", &a, &b, &c, &d); - ip[0] = a; - ip[1] = b; - ip[2] = c; - ip[3] = d; - return ip; -} - -/* convert a QQ UID to a unique name of Purple - * the return needs to be freed */ -gchar *uid_to_purple_name(guint32 uid) -{ - return g_strdup_printf("%u", uid); -} - -/* try to dump the data as GBK */ -gchar* try_dump_as_gbk(const guint8 *const data, gint len) -{ - gint i; - guint8 *incoming; - gchar *msg_utf8; - - incoming = g_newa(guint8, len + 1); - g_memmove(incoming, data, len); - incoming[len] = 0x00; - /* GBK code: - * Single-byte ASCII: 0x21-0x7E - * GBK first byte range: 0x81-0xFE - * GBK second byte range: 0x40-0x7E and 0x80-0xFE */ - for (i = 0; i < len; i++) - if (incoming[i] >= 0x81) - break; - - msg_utf8 = i < len ? qq_to_utf8((gchar *) &incoming[i], QQ_CHARSET_DEFAULT) : NULL; - - if (msg_utf8 != NULL) { - purple_debug_warning("QQ", "Try extract GB msg: %s\n", msg_utf8); - } - return msg_utf8; -} - -/* strips whitespace */ -static gchar *strstrip(const gchar *const buffer) -{ - GString *stripped; - gchar *ret, cur; - gint i; - - g_return_val_if_fail(buffer != NULL, NULL); - - stripped = g_string_new(""); - for (i=0; istr; - g_string_free(stripped, FALSE); - - return ret; -} - -/* Attempts to dump an ASCII hex string to a string of bytes. - * The return should be freed later. */ -guint8 *hex_str_to_bytes(const gchar *const buffer, gint *out_len) -{ - gchar *hex_str, *hex_buffer, *cursor; - gchar tmp[2]; - guint8 *bytes, nibble1, nibble2; - gint index; - - g_return_val_if_fail(buffer != NULL, NULL); - - hex_buffer = strstrip(buffer); - - if (strlen(hex_buffer) % 2 != 0) { - purple_debug_warning("QQ", - "Unable to convert an odd number of nibbles to a string of bytes!\n"); - g_free(hex_buffer); - return NULL; - } - bytes = g_newa(guint8, strlen(hex_buffer) / 2); - hex_str = g_ascii_strdown(hex_buffer, -1); - g_free(hex_buffer); - index = 0; - for (cursor = hex_str; cursor < hex_str + sizeof(gchar) * (strlen(hex_str)) - 1; cursor++) { - if (g_ascii_isdigit(*cursor)) { - tmp[0] = *cursor; - tmp[1] = '\0'; - nibble1 = atoi(tmp); - } else if (g_ascii_isalpha(*cursor) && (gint) *cursor - 87 < 16) { - nibble1 = (gint) *cursor - 87; - } else { - purple_debug_warning("QQ", "Invalid char \'%c\' found in hex string!\n", - *cursor); - g_free(hex_str); - return NULL; - } - nibble1 = nibble1 << 4; - cursor++; - if (g_ascii_isdigit(*cursor)) { - tmp[0] = *cursor; - tmp[1] = '\0'; - nibble2 = atoi(tmp); - } else if (g_ascii_isalpha(*cursor) && (gint) (*cursor - 87) < 16) { - nibble2 = (gint) *cursor - 87; - } else { - purple_debug_warning("QQ", "Invalid char found in hex string!\n"); - g_free(hex_str); - return NULL; - } - bytes[index++] = nibble1 + nibble2; - } - *out_len = strlen(hex_str) / 2; - g_free(hex_str); - return g_memdup(bytes, *out_len); -} - -/* Dumps a chunk of raw data into an ASCII hex string. - * The return should be freed later. */ -static gchar *hex_dump_to_str(const guint8 *const buffer, gint bytes) -{ - GString *str; - gchar *ret; - gint i, j, ch; - - str = g_string_new(""); - for (i = 0; i < bytes; i += 16) { - /* length label */ - g_string_append_printf(str, "%07x: ", i); - - /* dump hex value */ - for (j = 0; j < 16; j++) - if ((i + j) < bytes) - g_string_append_printf(str, " %02x", buffer[i + j]); - else - g_string_append(str, " --"); - g_string_append(str, " "); - - /* dump ascii value */ - for (j = 0; j < 16 && (i + j) < bytes; j++) { - ch = buffer[i + j] & 127; - if (ch < ' ' || ch == 127) - g_string_append_c(str, '.'); - else - g_string_append_c(str, ch); - } - g_string_append_c(str, '\n'); - } - - ret = str->str; - /* GString can be freed without freeing it character data */ - g_string_free(str, FALSE); - - return ret; -} - -void qq_hex_dump(PurpleDebugLevel level, const char *category, - const guint8 *pdata, gint bytes, - const char *format, ...) -{ - va_list args; - char *arg_s = NULL; - gchar *phex = NULL; - - g_return_if_fail(level != PURPLE_DEBUG_ALL); - g_return_if_fail(format != NULL); - - va_start(args, format); - arg_s = g_strdup_vprintf(format, args); - va_end(args); - - if (bytes <= 0) { - purple_debug(level, category, "%s", arg_s); - return; - } - - phex = hex_dump_to_str(pdata, bytes); - purple_debug(level, category, "%s - (len %d)\n%s", arg_s, bytes, phex); - g_free(phex); -} - -void qq_show_packet(const gchar *desc, const guint8 *buf, gint len) -{ - qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", buf, len, desc); -} - -void qq_filter_str(gchar *str) { - gchar *temp; - if (str == NULL) { - return; - } - - for (temp = str; *temp != 0; temp++) { - /*if (*temp == '\r' || *temp == '\n') *temp = ' ';*/ - if (*temp > 0 && *temp < 0x20) *temp = ' '; - } - g_strstrip(str); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/qq/utils.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/** - * @file utils.h - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _QQ_MY_UTILS_H_ -#define _QQ_MY_UTILS_H_ - -#include -#include - -#include "debug.h" - -void qq_get_md5(guint8 *md5, gint md5_len, const guint8* const src, gint src_len); - -gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount); -gchar *get_index_str_by_name(gchar **array, const gchar *name, gint amount); - -gchar **split_data(guint8 *data, gint len, const gchar *delimit, gint expected_fields); - -gchar *gen_ip_str(guint8 *ip); -guint8 *str_ip_gen(gchar *str); - -guint32 purple_name_to_uid(const gchar *name); -gchar *uid_to_purple_name(guint32 uid); - -gchar *try_dump_as_gbk(const guint8 *const data, gint len); - -void qq_show_packet(const gchar *desc, const guint8 *buf, gint len); -void qq_hex_dump(PurpleDebugLevel level, const char *category, - const guint8 *pdata, gint bytes, - const char *format, ...); -guint8 *hex_str_to_bytes(const gchar *buf, gint *out_len); - -void qq_filter_str(gchar *str); -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -noinst_HEADERS = sametime.h - -SAMETIMESOURCES = sametime.c - -AM_CFLAGS = \ - $(st) - -if STATIC_SAMETIME - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libsametime.la -libsametime_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libsametime.la - -endif - -libsametime_la_SOURCES = $(SAMETIMESOURCES) -libsametime_la_LDFLAGS = -module -avoid-version -libsametime_la_LIBADD = $(GLIB_LIBS) $(MEANWHILE_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(MEANWHILE_CFLAGS) \ - -DG_LOG_DOMAIN=\"sametime\" - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,743 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/sametime -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -libsametime_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) -am__objects_1 = libsametime_la-sametime.lo -am_libsametime_la_OBJECTS = $(am__objects_1) -libsametime_la_OBJECTS = $(am_libsametime_la_OBJECTS) -@STATIC_SAMETIME_FALSE@am_libsametime_la_rpath = -rpath $(pkgdir) -@STATIC_SAMETIME_TRUE@am_libsametime_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsametime_la_SOURCES) -DIST_SOURCES = $(libsametime_la_SOURCES) -HEADERS = $(noinst_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -noinst_HEADERS = sametime.h -SAMETIMESOURCES = sametime.c -AM_CFLAGS = \ - $(st) - -@STATIC_SAMETIME_FALSE@st = -@STATIC_SAMETIME_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_SAMETIME_TRUE@noinst_LTLIBRARIES = libsametime.la -@STATIC_SAMETIME_TRUE@libsametime_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SAMETIME_FALSE@pkg_LTLIBRARIES = libsametime.la -libsametime_la_SOURCES = $(SAMETIMESOURCES) -libsametime_la_LDFLAGS = -module -avoid-version -libsametime_la_LIBADD = $(GLIB_LIBS) $(MEANWHILE_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(MEANWHILE_CFLAGS) \ - -DG_LOG_DOMAIN=\"sametime\" - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/sametime/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/sametime/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsametime.la: $(libsametime_la_OBJECTS) $(libsametime_la_DEPENDENCIES) - $(LINK) $(am_libsametime_la_rpath) $(libsametime_la_LDFLAGS) $(libsametime_la_OBJECTS) $(libsametime_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsametime_la-sametime.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsametime_la-sametime.lo: sametime.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsametime_la_CFLAGS) $(CFLAGS) -MT libsametime_la-sametime.lo -MD -MP -MF "$(DEPDIR)/libsametime_la-sametime.Tpo" -c -o libsametime_la-sametime.lo `test -f 'sametime.c' || echo '$(srcdir)/'`sametime.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsametime_la-sametime.Tpo" "$(DEPDIR)/libsametime_la-sametime.Plo"; else rm -f "$(DEPDIR)/libsametime_la-sametime.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sametime.c' object='libsametime_la-sametime.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsametime_la_CFLAGS) $(CFLAGS) -c -o libsametime_la-sametime.lo `test -f 'sametime.c' || echo '$(srcdir)/'`sametime.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsametime -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libsametime -NEEDED_DLLS = $(MEANWHILE_TOP)/bin/libmeanwhile-1.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else - ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) - endif -endif - -CFLAGS += -DG_LOG_DOMAIN=\"sametime\" - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(MEANWHILE_TOP)/include/meanwhile \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(MEANWHILE_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = sametime.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lintl \ - -lws2_32 \ - -lmeanwhile \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## - -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5849 +0,0 @@ - -/* - Meanwhile Protocol Plugin for Purple - Adds Lotus Sametime support to Purple using the Meanwhile library - - Copyright (C) 2004 Christopher (siege) O'Brien - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, - USA. -*/ - -#include "internal.h" - -/* system includes */ -#include -#include - -/* glib includes */ -#include - -/* purple includes */ -#include "account.h" -#include "accountopt.h" -#include "circbuffer.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "imgstore.h" -#include "mime.h" -#include "notify.h" -#include "plugin.h" -#include "privacy.h" -#include "prpl.h" -#include "request.h" -#include "util.h" -#include "version.h" - -/* meanwhile includes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* plugin includes */ -#include "sametime.h" - - -/* considering that there's no display of this information for prpls, - I don't know why I even bother providing these. Oh valiant reader, - I do it all for you. */ -/* scratch that, I just added it to the prpl options panel */ -#define PLUGIN_ID "prpl-meanwhile" -#define PLUGIN_NAME "Sametime" -#define PLUGIN_SUMMARY "Sametime Protocol Plugin" -#define PLUGIN_DESC "Open implementation of a Lotus Sametime client" -#define PLUGIN_AUTHOR "Christopher (siege) O'Brien " -#define PLUGIN_HOMEPAGE "http://meanwhile.sourceforge.net/" - - -/* plugin preference names */ -#define MW_PRPL_OPT_BASE "/plugins/prpl/meanwhile" -#define MW_PRPL_OPT_BLIST_ACTION MW_PRPL_OPT_BASE "/blist_action" -#define MW_PRPL_OPT_PSYCHIC MW_PRPL_OPT_BASE "/psychic" -#define MW_PRPL_OPT_FORCE_LOGIN MW_PRPL_OPT_BASE "/force_login" -#define MW_PRPL_OPT_SAVE_DYNAMIC MW_PRPL_OPT_BASE "/save_dynamic" - - -/* stages of connecting-ness */ -#define MW_CONNECT_STEPS 11 - - -/* stages of conciousness */ -#define MW_STATE_OFFLINE "offline" -#define MW_STATE_ACTIVE "active" -#define MW_STATE_AWAY "away" -#define MW_STATE_BUSY "dnd" -#define MW_STATE_MESSAGE "message" -#define MW_STATE_ENLIGHTENED "buddha" - - -/* keys to get/set chat information */ -#define CHAT_KEY_CREATOR "chat.creator" -#define CHAT_KEY_NAME "chat.name" -#define CHAT_KEY_TOPIC "chat.topic" -#define CHAT_KEY_INVITE "chat.invite" -#define CHAT_KEY_IS_PLACE "chat.is_place" - - -/* key for associating a mwLoginType with a buddy */ -#define BUDDY_KEY_CLIENT "meanwhile.client" - -/* store the remote alias so that we can re-create it easily */ -#define BUDDY_KEY_NAME "meanwhile.shortname" - -/* enum mwSametimeUserType */ -#define BUDDY_KEY_TYPE "meanwhile.type" - - -/* key for the real group name for a meanwhile group */ -#define GROUP_KEY_NAME "meanwhile.group" - -/* enum mwSametimeGroupType */ -#define GROUP_KEY_TYPE "meanwhile.type" - -/* NAB group owning account */ -#define GROUP_KEY_OWNER "meanwhile.account" - -/* key gtk blist uses to indicate a collapsed group */ -#define GROUP_KEY_COLLAPSED "collapsed" - - -/* verification replacement */ -#define mwSession_NO_SECRET "meanwhile.no_secret" - - -/* keys to get/set purple plugin information */ -#define MW_KEY_HOST "server" -#define MW_KEY_PORT "port" -#define MW_KEY_FORCE "force_login" -#define MW_KEY_FAKE_IT "fake_client_id" -#define MW_KEY_CLIENT "client_id_val" -#define MW_KEY_MAJOR "client_major" -#define MW_KEY_MINOR "client_minor" - - -/** number of seconds from the first blist change before a save to the - storage service occurs. */ -#define BLIST_SAVE_SECONDS 15 - - -/** the possible buddy list storage settings */ -enum blist_choice { - blist_choice_LOCAL = 1, /**< local only */ - blist_choice_MERGE = 2, /**< merge from server */ - blist_choice_STORE = 3, /**< merge from and save to server */ - blist_choice_SYNCH = 4 /**< sync with server */ -}; - - -/** the default blist storage option */ -#define BLIST_CHOICE_DEFAULT blist_choice_SYNCH - - -/* testing for the above */ -#define BLIST_PREF_IS(n) (purple_prefs_get_int(MW_PRPL_OPT_BLIST_ACTION)==(n)) -#define BLIST_PREF_IS_LOCAL() BLIST_PREF_IS(blist_choice_LOCAL) -#define BLIST_PREF_IS_MERGE() BLIST_PREF_IS(blist_choice_MERGE) -#define BLIST_PREF_IS_STORE() BLIST_PREF_IS(blist_choice_STORE) -#define BLIST_PREF_IS_SYNCH() BLIST_PREF_IS(blist_choice_SYNCH) - - -/* debugging output */ -#define DEBUG_ERROR(a...) purple_debug_error(G_LOG_DOMAIN, a) -#define DEBUG_INFO(a...) purple_debug_info(G_LOG_DOMAIN, a) -#define DEBUG_MISC(a...) purple_debug_misc(G_LOG_DOMAIN, a) -#define DEBUG_WARN(a...) purple_debug_warning(G_LOG_DOMAIN, a) - - -/** ensure non-null strings */ -#ifndef NSTR -# define NSTR(str) ((str)? (str): "(null)") -#endif - - -/** calibrates distinct secure channel nomenclature */ -static const unsigned char no_secret[] = { - 0x2d, 0x2d, 0x20, 0x73, 0x69, 0x65, 0x67, 0x65, - 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x73, 0x20, 0x6a, - 0x65, 0x6e, 0x6e, 0x69, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x7a, 0x6f, 0x65, 0x20, 0x2d, 0x2d, 0x00, -}; - - -/** handler IDs from g_log_set_handler in mw_plugin_init */ -static guint log_handler[2] = { 0, 0 }; - - -/** the purple plugin data. - available as gc->proto_data and mwSession_getClientData */ -struct mwPurplePluginData { - struct mwSession *session; - - struct mwServiceAware *srvc_aware; - struct mwServiceConference *srvc_conf; - struct mwServiceFileTransfer *srvc_ft; - struct mwServiceIm *srvc_im; - struct mwServicePlace *srvc_place; - struct mwServiceResolve *srvc_resolve; - struct mwServiceStorage *srvc_store; - - /** map of PurpleGroup:mwAwareList and mwAwareList:PurpleGroup */ - GHashTable *group_list_map; - - /** event id for the buddy list save callback */ - guint save_event; - - /** socket fd */ - int socket; - gint outpa; /* like inpa, but the other way */ - - /** circular buffer for outgoing data */ - PurpleCircBuffer *sock_buf; - - PurpleConnection *gc; -}; - - -typedef struct { - PurpleBuddy *buddy; - PurpleGroup *group; -} BuddyAddData; - - -/* blist and aware functions */ - -static void blist_export(PurpleConnection *gc, struct mwSametimeList *stlist); - -static void blist_store(struct mwPurplePluginData *pd); - -static void blist_schedule(struct mwPurplePluginData *pd); - -static void blist_merge(PurpleConnection *gc, struct mwSametimeList *stlist); - -static void blist_sync(PurpleConnection *gc, struct mwSametimeList *stlist); - -static gboolean buddy_is_external(PurpleBuddy *b); - -static void buddy_add(struct mwPurplePluginData *pd, PurpleBuddy *buddy); - -static PurpleBuddy * -buddy_ensure(PurpleConnection *gc, PurpleGroup *group, - struct mwSametimeUser *stuser); - -static void group_add(struct mwPurplePluginData *pd, PurpleGroup *group); - -static PurpleGroup * -group_ensure(PurpleConnection *gc, struct mwSametimeGroup *stgroup); - -static struct mwAwareList * -list_ensure(struct mwPurplePluginData *pd, PurpleGroup *group); - - -/* session functions */ - -static struct mwSession * -gc_to_session(PurpleConnection *gc); - -static PurpleConnection *session_to_gc(struct mwSession *session); - - -/* conference functions */ - -static struct mwConference * -conf_find_by_id(struct mwPurplePluginData *pd, int id); - - -/* conversation functions */ - -struct convo_msg { - enum mwImSendType type; - gpointer data; - GDestroyNotify clear; -}; - - -struct convo_data { - struct mwConversation *conv; - GList *queue; /**< outgoing message queue, list of convo_msg */ -}; - -static void convo_data_new(struct mwConversation *conv); - -static void convo_data_free(struct convo_data *conv); - -static void convo_features(struct mwConversation *conv); - -static PurpleConversation *convo_get_gconv(struct mwConversation *conv); - - -/* name and id */ - -struct named_id { - char *id; - char *name; -}; - - -/* connection functions */ - -static void connect_cb(gpointer data, gint source, const gchar *error_message); - - -/* ----- session ------ */ - - -/** resolves a mwSession from a PurpleConnection */ -static struct mwSession *gc_to_session(PurpleConnection *gc) { - struct mwPurplePluginData *pd; - - g_return_val_if_fail(gc != NULL, NULL); - - pd = gc->proto_data; - g_return_val_if_fail(pd != NULL, NULL); - - return pd->session; -} - - -/** resolves a PurpleConnection from a mwSession */ -static PurpleConnection *session_to_gc(struct mwSession *session) { - struct mwPurplePluginData *pd; - - g_return_val_if_fail(session != NULL, NULL); - - pd = mwSession_getClientData(session); - g_return_val_if_fail(pd != NULL, NULL); - - return pd->gc; -} - - -static void write_cb(gpointer data, gint source, PurpleInputCondition cond) { - struct mwPurplePluginData *pd = data; - PurpleCircBuffer *circ = pd->sock_buf; - gsize avail; - int ret; - - DEBUG_INFO("write_cb\n"); - - g_return_if_fail(circ != NULL); - - avail = purple_circ_buffer_get_max_read(circ); - if(BUF_LONG < avail) avail = BUF_LONG; - - while(avail) { - ret = write(pd->socket, circ->outptr, avail); - - if(ret <= 0) - break; - - purple_circ_buffer_mark_read(circ, ret); - avail = purple_circ_buffer_get_max_read(circ); - if(BUF_LONG < avail) avail = BUF_LONG; - } - - if(! avail) { - purple_input_remove(pd->outpa); - pd->outpa = 0; - } -} - - -static int mw_session_io_write(struct mwSession *session, - const guchar *buf, gsize len) { - struct mwPurplePluginData *pd; - gssize ret = 0; - int err = 0; - - pd = mwSession_getClientData(session); - - /* socket was already closed. */ - if(pd->socket == 0) - return 1; - - if(pd->outpa) { - DEBUG_INFO("already pending INPUT_WRITE, buffering\n"); - purple_circ_buffer_append(pd->sock_buf, buf, len); - return 0; - } - - while(len) { - ret = write(pd->socket, buf, (len > BUF_LEN)? BUF_LEN: len); - - if(ret <= 0) - break; - - len -= ret; - buf += ret; - } - - if(ret <= 0) - err = errno; - - if(err == EAGAIN) { - /* append remainder to circular buffer */ - DEBUG_INFO("EAGAIN\n"); - purple_circ_buffer_append(pd->sock_buf, buf, len); - pd->outpa = purple_input_add(pd->socket, PURPLE_INPUT_WRITE, write_cb, pd); - - } else if(len > 0) { - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - DEBUG_ERROR("write returned %" G_GSSIZE_FORMAT ", %" G_GSIZE_FORMAT - " bytes left unwritten\n", ret, len); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - -#if 0 - close(pd->socket); - pd->socket = 0; -#endif - - return -1; - } - - return 0; -} - - -static void mw_session_io_close(struct mwSession *session) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - - if(pd->outpa) { - purple_input_remove(pd->outpa); - pd->outpa = 0; - } - - if(pd->socket) { - close(pd->socket); - pd->socket = 0; - } - - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; - } -} - - -static void mw_session_clear(struct mwSession *session) { - ; /* nothing for now */ -} - - -/* ----- aware list ----- */ - - -static void blist_resolve_alias_cb(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer data) { - struct mwResolveResult *result; - struct mwResolveMatch *match; - - g_return_if_fail(results != NULL); - - result = results->data; - g_return_if_fail(result != NULL); - g_return_if_fail(result->matches != NULL); - - match = result->matches->data; - g_return_if_fail(match != NULL); - - purple_blist_server_alias_buddy(data, match->name); - purple_blist_node_set_string(data, BUDDY_KEY_NAME, match->name); -} - - -static void mw_aware_list_on_aware(struct mwAwareList *list, - struct mwAwareSnapshot *aware) { - - PurpleConnection *gc; - PurpleAccount *acct; - - struct mwPurplePluginData *pd; - guint32 idle; - guint stat; - const char *id; - const char *status = MW_STATE_ACTIVE; - - gc = mwAwareList_getClientData(list); - acct = purple_connection_get_account(gc); - - pd = gc->proto_data; - idle = aware->status.time; - stat = aware->status.status; - id = aware->id.user; - - if(idle) { - guint32 idle_len; /*< how long a client has been idle */ - guint32 ugly_idle_len; /*< how long a broken client has been idle */ - - DEBUG_INFO("%s has idle value 0x%x\n", NSTR(id), idle); - - idle_len = time(NULL) - idle; - ugly_idle_len = ((time(NULL) * 1000) - idle) / 1000; - - if(idle > ugly_idle_len) - ugly_idle_len = 0; - else - ugly_idle_len = (ugly_idle_len - idle) / 1000; - - /* - what's the deal here? Well, good clients are smart enough to - publish their idle time by using an attribute to indicate that - they went idle at some time UTC, in seconds since epoch. Bad - clients use milliseconds since epoch. So we're going to compute - the idle time for either method, then figure out the lower of - the two and use that. Blame the ST 7.5 development team for - this. - */ - - DEBUG_INFO("idle time: %u, ugly idle time: %u\n", idle_len, ugly_idle_len); - -#if 1 - if(idle_len <= ugly_idle_len) { - ; /* DEBUG_INFO("sane idle value, let's use it\n"); */ - } else { - idle = time(NULL) - ugly_idle_len; - } - -#else - if(idle < 0 || idle > time(NULL)) { - DEBUG_INFO("hiding a messy idle value 0x%x\n", NSTR(id), idle); - idle = -1; - } -#endif - } - - switch(stat) { - case mwStatus_ACTIVE: - status = MW_STATE_ACTIVE; - idle = 0; - break; - - case mwStatus_IDLE: - if(! idle) idle = -1; - break; - - case mwStatus_AWAY: - status = MW_STATE_AWAY; - break; - - case mwStatus_BUSY: - status = MW_STATE_BUSY; - break; - } - - /* NAB group members */ - if(aware->group) { - PurpleGroup *group; - PurpleBuddy *buddy; - PurpleBlistNode *bnode; - - group = g_hash_table_lookup(pd->group_list_map, list); - buddy = purple_find_buddy_in_group(acct, id, group); - bnode = (PurpleBlistNode *) buddy; - - if(! buddy) { - struct mwServiceResolve *srvc; - GList *query; - - buddy = purple_buddy_new(acct, id, NULL); - purple_blist_add_buddy(buddy, NULL, group, NULL); - - bnode = (PurpleBlistNode *) buddy; - - srvc = pd->srvc_resolve; - query = g_list_append(NULL, (char *) id); - - mwServiceResolve_resolve(srvc, query, mwResolveFlag_USERS, - blist_resolve_alias_cb, buddy, NULL); - g_list_free(query); - } - - purple_blist_node_set_int(bnode, BUDDY_KEY_TYPE, mwSametimeUser_NORMAL); - } - - if(aware->online) { - purple_prpl_got_user_status(acct, id, status, NULL); - purple_prpl_got_user_idle(acct, id, !!idle, (time_t) idle); - - } else { - purple_prpl_got_user_status(acct, id, MW_STATE_OFFLINE, NULL); - } -} - - -static void mw_aware_list_on_attrib(struct mwAwareList *list, - struct mwAwareIdBlock *id, - struct mwAwareAttribute *attrib) { - - ; /* nothing. We'll get attribute data as we need it */ -} - - -static void mw_aware_list_clear(struct mwAwareList *list) { - ; /* nothing for now */ -} - - -static struct mwAwareListHandler mw_aware_list_handler = { - mw_aware_list_on_aware, - mw_aware_list_on_attrib, - mw_aware_list_clear, -}; - - -/** Ensures that an Aware List is associated with the given group, and - returns that list. */ -static struct mwAwareList * -list_ensure(struct mwPurplePluginData *pd, PurpleGroup *group) { - - struct mwAwareList *list; - - g_return_val_if_fail(pd != NULL, NULL); - g_return_val_if_fail(group != NULL, NULL); - - list = g_hash_table_lookup(pd->group_list_map, group); - if(! list) { - list = mwAwareList_new(pd->srvc_aware, &mw_aware_list_handler); - mwAwareList_setClientData(list, pd->gc, NULL); - - mwAwareList_watchAttributes(list, - mwAttribute_AV_PREFS_SET, - mwAttribute_MICROPHONE, - mwAttribute_SPEAKERS, - mwAttribute_VIDEO_CAMERA, - mwAttribute_FILE_TRANSFER, - NULL); - - g_hash_table_replace(pd->group_list_map, group, list); - g_hash_table_insert(pd->group_list_map, list, group); - } - - return list; -} - - -static void blist_export(PurpleConnection *gc, struct mwSametimeList *stlist) { - /* - find the account for this connection - - iterate through the buddy list - - add each buddy matching this account to the stlist - */ - - PurpleAccount *acct; - PurpleBlistNode *gn, *cn, *bn; - PurpleGroup *grp; - PurpleBuddy *bdy; - - struct mwSametimeGroup *stg = NULL; - struct mwIdBlock idb = { NULL, NULL }; - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - for(gn = purple_blist_get_root(); gn; - gn = purple_blist_node_get_sibling_next(gn)) { - const char *owner; - const char *gname; - enum mwSametimeGroupType gtype; - gboolean gopen; - - if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; - grp = (PurpleGroup *) gn; - - /* the group's type (normal or dynamic) */ - gtype = purple_blist_node_get_int(gn, GROUP_KEY_TYPE); - if(! gtype) gtype = mwSametimeGroup_NORMAL; - - /* if it's a normal group with none of our people in it, skip it */ - if(gtype == mwSametimeGroup_NORMAL && !purple_group_on_account(grp, acct)) - continue; - - /* if the group has an owner and we're not it, skip it */ - owner = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - if(owner && strcmp(owner, purple_account_get_username(acct))) - continue; - - /* the group's actual name may be different from the purple group's - name. Find whichever is there */ - gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = purple_group_get_name(grp); - - /* we save this, but never actually honor it */ - gopen = ! purple_blist_node_get_bool(gn, GROUP_KEY_COLLAPSED); - - stg = mwSametimeGroup_new(stlist, gtype, gname); - mwSametimeGroup_setAlias(stg, purple_group_get_name(grp)); - mwSametimeGroup_setOpen(stg, gopen); - - /* don't attempt to put buddies in a dynamic group, it breaks - other clients */ - if(gtype == mwSametimeGroup_DYNAMIC) - continue; - - for(cn = purple_blist_node_get_first_child(gn); - cn; - cn = purple_blist_node_get_sibling_next(cn)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cn)) continue; - - for(bn = purple_blist_node_get_first_child(cn); - bn; - bn = purple_blist_node_get_sibling_next(bn)) { - if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - if(! PURPLE_BLIST_NODE_SHOULD_SAVE(bn)) continue; - - bdy = (PurpleBuddy *) bn; - - if(purple_buddy_get_account(bdy) == acct) { - struct mwSametimeUser *stu; - enum mwSametimeUserType utype; - - idb.user = (char *)purple_buddy_get_name(bdy); - - utype = purple_blist_node_get_int(bn, BUDDY_KEY_TYPE); - if(! utype) utype = mwSametimeUser_NORMAL; - - stu = mwSametimeUser_new(stg, utype, &idb); - mwSametimeUser_setShortName(stu, purple_buddy_get_server_alias(bdy)); - mwSametimeUser_setAlias(stu, purple_buddy_get_local_buddy_alias(bdy)); - } - } - } - } -} - - -static void blist_store(struct mwPurplePluginData *pd) { - - struct mwSametimeList *stlist; - struct mwServiceStorage *srvc; - struct mwStorageUnit *unit; - - PurpleConnection *gc; - - struct mwPutBuffer *b; - struct mwOpaque *o; - - g_return_if_fail(pd != NULL); - - srvc = pd->srvc_store; - g_return_if_fail(srvc != NULL); - - gc = pd->gc; - - if(BLIST_PREF_IS_LOCAL() || BLIST_PREF_IS_MERGE()) { - DEBUG_INFO("preferences indicate not to save remote blist\n"); - return; - - } else if(MW_SERVICE_IS_DEAD(srvc)) { - DEBUG_INFO("aborting save of blist: storage service is not alive\n"); - return; - - } else if(BLIST_PREF_IS_STORE() || BLIST_PREF_IS_SYNCH()) { - DEBUG_INFO("saving remote blist\n"); - - } else { - g_return_if_reached(); - } - - /* create and export to a list object */ - stlist = mwSametimeList_new(); - blist_export(gc, stlist); - - /* write it to a buffer */ - b = mwPutBuffer_new(); - mwSametimeList_put(b, stlist); - mwSametimeList_free(stlist); - - /* put the buffer contents into a storage unit */ - unit = mwStorageUnit_new(mwStore_AWARE_LIST); - o = mwStorageUnit_asOpaque(unit); - mwPutBuffer_finalize(o, b); - - /* save the storage unit to the service */ - mwServiceStorage_save(srvc, unit, NULL, NULL, NULL); -} - - -static gboolean blist_save_cb(gpointer data) { - struct mwPurplePluginData *pd = data; - - blist_store(pd); - pd->save_event = 0; - return FALSE; -} - - -/** schedules the buddy list to be saved to the server */ -static void blist_schedule(struct mwPurplePluginData *pd) { - if(pd->save_event) return; - - pd->save_event = purple_timeout_add_seconds(BLIST_SAVE_SECONDS, - blist_save_cb, pd); -} - - -static gboolean buddy_is_external(PurpleBuddy *b) { - g_return_val_if_fail(b != NULL, FALSE); - return purple_str_has_prefix(purple_buddy_get_name(b), "@E "); -} - - -/** Actually add a buddy to the aware service, and schedule the buddy - list to be saved to the server */ -static void buddy_add(struct mwPurplePluginData *pd, - PurpleBuddy *buddy) { - - struct mwAwareIdBlock idb = { mwAware_USER, (char *) purple_buddy_get_name(buddy), NULL }; - struct mwAwareList *list; - - PurpleGroup *group; - GList *add; - - add = g_list_prepend(NULL, &idb); - - group = purple_buddy_get_group(buddy); - list = list_ensure(pd, group); - - if(mwAwareList_addAware(list, add)) { - purple_blist_remove_buddy(buddy); - } - - blist_schedule(pd); - - g_list_free(add); -} - - -/** ensure that a PurpleBuddy exists in the group with data - appropriately matching the st user entry from the st list */ -static PurpleBuddy *buddy_ensure(PurpleConnection *gc, PurpleGroup *group, - struct mwSametimeUser *stuser) { - - struct mwPurplePluginData *pd = gc->proto_data; - PurpleBuddy *buddy; - PurpleAccount *acct = purple_connection_get_account(gc); - - const char *id = mwSametimeUser_getUser(stuser); - const char *name = mwSametimeUser_getShortName(stuser); - const char *alias = mwSametimeUser_getAlias(stuser); - enum mwSametimeUserType type = mwSametimeUser_getType(stuser); - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(strlen(id) > 0, NULL); - - buddy = purple_find_buddy_in_group(acct, id, group); - if(! buddy) { - buddy = purple_buddy_new(acct, id, alias); - - purple_blist_add_buddy(buddy, NULL, group, NULL); - buddy_add(pd, buddy); - } - - purple_blist_alias_buddy(buddy, alias); - purple_blist_server_alias_buddy(buddy, name); - purple_blist_node_set_string((PurpleBlistNode *) buddy, BUDDY_KEY_NAME, name); - purple_blist_node_set_int((PurpleBlistNode *) buddy, BUDDY_KEY_TYPE, type); - - return buddy; -} - - -/** add aware watch for a dynamic group */ -static void group_add(struct mwPurplePluginData *pd, - PurpleGroup *group) { - - struct mwAwareIdBlock idb = { mwAware_GROUP, NULL, NULL }; - struct mwAwareList *list; - const char *n; - GList *add; - - n = purple_blist_node_get_string((PurpleBlistNode *) group, GROUP_KEY_NAME); - if(! n) n = purple_group_get_name(group); - - idb.user = (char *) n; - add = g_list_prepend(NULL, &idb); - - list = list_ensure(pd, group); - mwAwareList_addAware(list, add); - g_list_free(add); -} - - -/** ensure that a PurpleGroup exists in the blist with data - appropriately matching the st group entry from the st list */ -static PurpleGroup *group_ensure(PurpleConnection *gc, - struct mwSametimeGroup *stgroup) { - PurpleAccount *acct; - PurpleGroup *group = NULL; - PurpleBuddyList *blist; - PurpleBlistNode *gn; - const char *name, *alias, *owner; - enum mwSametimeGroupType type; - - acct = purple_connection_get_account(gc); - owner = purple_account_get_username(acct); - - blist = purple_get_blist(); - g_return_val_if_fail(blist != NULL, NULL); - - name = mwSametimeGroup_getName(stgroup); - alias = mwSametimeGroup_getAlias(stgroup); - type = mwSametimeGroup_getType(stgroup); - - DEBUG_INFO("attempting to ensure group %s, called %s\n", - NSTR(name), NSTR(alias)); - - /* first attempt at finding the group, by the name key */ - for(gn = purple_blist_get_root(); gn; - gn = purple_blist_node_get_sibling_next(gn)) { - const char *n, *o; - if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; - n = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - o = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - - DEBUG_INFO("found group named %s, owned by %s\n", NSTR(n), NSTR(o)); - - if(n && !strcmp(n, name)) { - if(!o || !strcmp(o, owner)) { - DEBUG_INFO("that'll work\n"); - group = (PurpleGroup *) gn; - break; - } - } - } - - /* try again, by alias */ - if(! group) { - DEBUG_INFO("searching for group by alias %s\n", NSTR(alias)); - group = purple_find_group(alias); - } - - /* oh well, no such group. Let's create it! */ - if(! group) { - DEBUG_INFO("creating group\n"); - group = purple_group_new(alias); - purple_blist_add_group(group, NULL); - } - - gn = (PurpleBlistNode *) group; - purple_blist_node_set_string(gn, GROUP_KEY_NAME, name); - purple_blist_node_set_int(gn, GROUP_KEY_TYPE, type); - - if(type == mwSametimeGroup_DYNAMIC) { - purple_blist_node_set_string(gn, GROUP_KEY_OWNER, owner); - group_add(gc->proto_data, group); - } - - return group; -} - - -/** merge the entries from a st list into the purple blist */ -static void blist_merge(PurpleConnection *gc, struct mwSametimeList *stlist) { - struct mwSametimeGroup *stgroup; - struct mwSametimeUser *stuser; - - PurpleGroup *group; - PurpleBuddy *buddy; - - GList *gl, *gtl, *ul, *utl; - - gl = gtl = mwSametimeList_getGroups(stlist); - for(; gl; gl = gl->next) { - - stgroup = (struct mwSametimeGroup *) gl->data; - group = group_ensure(gc, stgroup); - - ul = utl = mwSametimeGroup_getUsers(stgroup); - for(; ul; ul = ul->next) { - - stuser = (struct mwSametimeUser *) ul->data; - buddy = buddy_ensure(gc, group, stuser); - } - g_list_free(utl); - } - g_list_free(gtl); -} - - -/** remove all buddies on account from group. If del is TRUE and group - is left empty, remove group as well */ -static void group_clear(PurpleGroup *group, PurpleAccount *acct, gboolean del) { - PurpleConnection *gc; - GList *prune = NULL; - PurpleBlistNode *gn, *cn, *bn; - - g_return_if_fail(group != NULL); - - DEBUG_INFO("clearing members from pruned group %s\n", NSTR(purple_group_get_name(group))); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - gn = (PurpleBlistNode *) group; - - for(cn = purple_blist_node_get_first_child(gn); - cn; - cn = purple_blist_node_get_sibling_next(cn)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cn)) continue; - - for(bn = purple_blist_node_get_first_child(cn); - bn; - bn = purple_blist_node_get_sibling_next(bn)) { - PurpleBuddy *gb = (PurpleBuddy *) bn; - - if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - - if(purple_buddy_get_account(gb) == acct) { - DEBUG_INFO("clearing %s from group\n", NSTR(purple_buddy_get_name(gb))); - prune = g_list_prepend(prune, gb); - } - } - } - - /* quickly unsubscribe from presence for the entire group */ - purple_account_remove_group(acct, group); - - /* remove blist entries that need to go */ - while(prune) { - purple_blist_remove_buddy(prune->data); - prune = g_list_delete_link(prune, prune); - } - DEBUG_INFO("cleared buddies\n"); - - /* optionally remove group from blist */ - if(del && !purple_blist_get_group_size(group, TRUE)) { - DEBUG_INFO("removing empty group\n"); - purple_blist_remove_group(group); - } -} - - -/** prune out group members that shouldn't be there */ -static void group_prune(PurpleConnection *gc, PurpleGroup *group, - struct mwSametimeGroup *stgroup) { - - PurpleAccount *acct; - PurpleBlistNode *gn, *cn, *bn; - - GHashTable *stusers; - GList *prune = NULL; - GList *ul, *utl; - - g_return_if_fail(group != NULL); - - DEBUG_INFO("pruning membership of group %s\n", NSTR(purple_group_get_name(group))); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - stusers = g_hash_table_new(g_str_hash, g_str_equal); - - /* build a hash table for quick lookup while pruning the group - contents */ - utl = mwSametimeGroup_getUsers(stgroup); - for(ul = utl; ul; ul = ul->next) { - const char *id = mwSametimeUser_getUser(ul->data); - g_hash_table_insert(stusers, (char *) id, ul->data); - DEBUG_INFO("server copy has %s\n", NSTR(id)); - } - g_list_free(utl); - - gn = (PurpleBlistNode *) group; - - for(cn = purple_blist_node_get_first_child(gn); - cn; - cn = purple_blist_node_get_sibling_next(cn)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cn)) continue; - - for(bn = purple_blist_node_get_first_child(cn); - bn; - bn = purple_blist_node_get_sibling_next(bn)) { - PurpleBuddy *gb = (PurpleBuddy *) bn; - - if(! PURPLE_BLIST_NODE_IS_BUDDY(bn)) continue; - - /* if the account is correct and they're not in our table, mark - them for pruning */ - if(purple_buddy_get_account(gb) == acct && !g_hash_table_lookup(stusers, purple_buddy_get_name(gb))) { - DEBUG_INFO("marking %s for pruning\n", NSTR(purple_buddy_get_name(gb))); - prune = g_list_prepend(prune, gb); - } - } - } - DEBUG_INFO("done marking\n"); - - g_hash_table_destroy(stusers); - - if(prune) { - purple_account_remove_buddies(acct, prune, NULL); - while(prune) { - purple_blist_remove_buddy(prune->data); - prune = g_list_delete_link(prune, prune); - } - } -} - - -/** synch the entries from a st list into the purple blist, removing any - existing buddies that aren't in the st list */ -static void blist_sync(PurpleConnection *gc, struct mwSametimeList *stlist) { - - PurpleAccount *acct; - PurpleBuddyList *blist; - PurpleBlistNode *gn; - - GHashTable *stgroups; - GList *g_prune = NULL; - - GList *gl, *gtl; - - const char *acct_n; - - DEBUG_INFO("synchronizing local buddy list from server list\n"); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - acct_n = purple_account_get_username(acct); - - blist = purple_get_blist(); - g_return_if_fail(blist != NULL); - - /* build a hash table for quick lookup while pruning the local - list, mapping group name to group structure */ - stgroups = g_hash_table_new(g_str_hash, g_str_equal); - - gtl = mwSametimeList_getGroups(stlist); - for(gl = gtl; gl; gl = gl->next) { - const char *name = mwSametimeGroup_getName(gl->data); - g_hash_table_insert(stgroups, (char *) name, gl->data); - } - g_list_free(gtl); - - /* find all groups which should be pruned from the local list */ - for(gn = purple_blist_get_root(); gn; - gn = purple_blist_node_get_sibling_next(gn)) { - PurpleGroup *grp = (PurpleGroup *) gn; - const char *gname, *owner; - struct mwSametimeGroup *stgrp; - - if(! PURPLE_BLIST_NODE_IS_GROUP(gn)) continue; - - /* group not belonging to this account */ - if(! purple_group_on_account(grp, acct)) - continue; - - /* dynamic group belonging to this account. don't prune contents */ - owner = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - if(owner && !strcmp(owner, acct_n)) - continue; - - /* we actually are synching by this key as opposed to the group - title, which can be different things in the st list */ - gname = purple_blist_node_get_string(gn, GROUP_KEY_NAME); - if(! gname) gname = purple_group_get_name(grp); - - stgrp = g_hash_table_lookup(stgroups, gname); - if(! stgrp) { - /* remove the whole group */ - DEBUG_INFO("marking group %s for pruning\n", purple_group_get_name(grp)); - g_prune = g_list_prepend(g_prune, grp); - - } else { - /* synch the group contents */ - group_prune(gc, grp, stgrp); - } - } - DEBUG_INFO("done marking groups\n"); - - /* don't need this anymore */ - g_hash_table_destroy(stgroups); - - /* prune all marked groups */ - while(g_prune) { - PurpleGroup *grp = g_prune->data; - PurpleBlistNode *gn = (PurpleBlistNode *) grp; - const char *owner; - gboolean del = TRUE; - - owner = purple_blist_node_get_string(gn, GROUP_KEY_OWNER); - if(owner && strcmp(owner, acct_n)) { - /* it's a specialty group belonging to another account with some - of our members in it, so don't fully delete it */ - del = FALSE; - } - - group_clear(g_prune->data, acct, del); - g_prune = g_list_delete_link(g_prune, g_prune); - } - - /* done with the pruning, let's merge in the additions */ - blist_merge(gc, stlist); -} - - -/** callback passed to the storage service when it's told to load the - st list */ -static void fetch_blist_cb(struct mwServiceStorage *srvc, - guint32 result, struct mwStorageUnit *item, - gpointer data) { - - struct mwPurplePluginData *pd = data; - struct mwSametimeList *stlist; - - struct mwGetBuffer *b; - - g_return_if_fail(result == ERR_SUCCESS); - - /* check our preferences for loading */ - if(BLIST_PREF_IS_LOCAL()) { - DEBUG_INFO("preferences indicate not to load remote buddy list\n"); - return; - } - - b = mwGetBuffer_wrap(mwStorageUnit_asOpaque(item)); - - stlist = mwSametimeList_new(); - mwSametimeList_get(b, stlist); - - /* merge or synch depending on preferences */ - if(BLIST_PREF_IS_MERGE() || BLIST_PREF_IS_STORE()) { - blist_merge(pd->gc, stlist); - - } else if(BLIST_PREF_IS_SYNCH()) { - blist_sync(pd->gc, stlist); - } - - mwSametimeList_free(stlist); - mwGetBuffer_free(b); -} - - -/** signal triggered when a conversation is opened in Purple */ -static void conversation_created_cb(PurpleConversation *g_conv, - struct mwPurplePluginData *pd) { - - /* we need to tell the IM service to negotiate features for the - conversation right away, otherwise it'll wait until the first - message is sent before offering NotesBuddy features. Therefore - whenever Purple creates a conversation, we'll immediately open the - channel to the other side and figure out what the target can - handle. Unfortunately, this makes us vulnerable to Psychic Mode, - whereas a more lazy negotiation based on the first message - would not */ - - PurpleConnection *gc; - struct mwIdBlock who = { 0, 0 }; - struct mwConversation *conv; - - gc = purple_conversation_get_gc(g_conv); - if(pd->gc != gc) - return; /* not ours */ - - if(purple_conversation_get_type(g_conv) != PURPLE_CONV_TYPE_IM) - return; /* wrong type */ - - who.user = (char *) purple_conversation_get_name(g_conv); - conv = mwServiceIm_getConversation(pd->srvc_im, &who); - - convo_features(conv); - - if(mwConversation_isClosed(conv)) - mwConversation_open(conv); -} - - -static void blist_menu_nab(PurpleBlistNode *node, gpointer data) { - struct mwPurplePluginData *pd = data; - PurpleConnection *gc; - - PurpleGroup *group = (PurpleGroup *) node; - - GString *str; - char *tmp; - const char *gname; - - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - g_return_if_fail(PURPLE_BLIST_NODE_IS_GROUP(node)); - - str = g_string_new(NULL); - - tmp = (char *) purple_blist_node_get_string(node, GROUP_KEY_NAME); - gname = purple_group_get_name(group); - - g_string_append_printf(str, _("Group Title: %s
"), gname); - g_string_append_printf(str, _("Notes Group ID: %s
"), tmp); - - tmp = g_strdup_printf(_("Info for Group %s"), gname); - - purple_notify_formatted(gc, tmp, _("Notes Address Book Information"), - NULL, str->str, NULL, NULL); - - g_free(tmp); - g_string_free(str, TRUE); -} - - -/** The normal blist menu prpl function doesn't get called for groups, - so we use the blist-node-extended-menu signal to trigger this - handler */ -static void blist_node_menu_cb(PurpleBlistNode *node, - GList **menu, struct mwPurplePluginData *pd) { - const char *owner; - PurpleGroup *group; - PurpleAccount *acct; - PurpleMenuAction *act; - - /* we only want groups */ - if(! PURPLE_BLIST_NODE_IS_GROUP(node)) return; - group = (PurpleGroup *) node; - - acct = purple_connection_get_account(pd->gc); - g_return_if_fail(acct != NULL); - - /* better make sure we're connected */ - if(! purple_account_is_connected(acct)) return; - -#if 0 - /* if there's anyone in the group for this acct, offer to invite - them all to a conference */ - if(purple_group_on_account(group, acct)) { - act = purple_menu_action_new(_("Invite Group to Conference..."), - PURPLE_CALLBACK(blist_menu_group_invite), - pd, NULL); - *menu = g_list_append(*menu, NULL); - } -#endif - - /* check if it's a NAB group for this account */ - owner = purple_blist_node_get_string(node, GROUP_KEY_OWNER); - if(owner && !strcmp(owner, purple_account_get_username(acct))) { - act = purple_menu_action_new(_("Get Notes Address Book Info"), - PURPLE_CALLBACK(blist_menu_nab), pd, NULL); - *menu = g_list_append(*menu, act); - } -} - - -/* lifted this from oldstatus, since HEAD doesn't do this at login - anymore. */ -static void blist_init(PurpleAccount *acct) { - PurpleBlistNode *gnode, *cnode, *bnode; - GList *add_buds = NULL; - - for(gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - if(! PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; - - for(cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - if(! PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for(bnode = purple_blist_node_get_first_child(cnode); - bnode; - bnode = purple_blist_node_get_sibling_next(bnode)) { - PurpleBuddy *b; - if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - - b = (PurpleBuddy *)bnode; - if(purple_buddy_get_account(b) == acct) { - add_buds = g_list_append(add_buds, b); - } - } - } - } - - if(add_buds) { - purple_account_add_buddies(acct, add_buds); - g_list_free(add_buds); - } -} - - -/** Last thing to happen from a started session */ -static void services_starting(struct mwPurplePluginData *pd) { - - PurpleConnection *gc; - PurpleAccount *acct; - struct mwStorageUnit *unit; - PurpleBlistNode *l; - - gc = pd->gc; - acct = purple_connection_get_account(gc); - - /* grab the buddy list from the server */ - unit = mwStorageUnit_new(mwStore_AWARE_LIST); - mwServiceStorage_load(pd->srvc_store, unit, fetch_blist_cb, pd, NULL); - - /* find all the NAB groups and subscribe to them */ - for(l = purple_blist_get_root(); l; - l = purple_blist_node_get_sibling_next(l)) { - PurpleGroup *group = (PurpleGroup *) l; - enum mwSametimeGroupType gt; - const char *owner; - - if(! PURPLE_BLIST_NODE_IS_GROUP(l)) continue; - - /* if the group is ownerless, or has an owner and we're not it, - skip it */ - owner = purple_blist_node_get_string(l, GROUP_KEY_OWNER); - if(!owner || strcmp(owner, purple_account_get_username(acct))) - continue; - - gt = purple_blist_node_get_int(l, GROUP_KEY_TYPE); - if(gt == mwSametimeGroup_DYNAMIC) - group_add(pd, group); - } - - /* set the aware attributes */ - /* indicate we understand what AV prefs are, but don't support any */ - mwServiceAware_setAttributeBoolean(pd->srvc_aware, - mwAttribute_AV_PREFS_SET, TRUE); - mwServiceAware_unsetAttribute(pd->srvc_aware, mwAttribute_MICROPHONE); - mwServiceAware_unsetAttribute(pd->srvc_aware, mwAttribute_SPEAKERS); - mwServiceAware_unsetAttribute(pd->srvc_aware, mwAttribute_VIDEO_CAMERA); - - /* ... but we can do file transfers! */ - mwServiceAware_setAttributeBoolean(pd->srvc_aware, - mwAttribute_FILE_TRANSFER, TRUE); - - blist_init(acct); -} - - -static void session_loginRedirect(struct mwSession *session, - const char *host) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *account; - guint port; - const char *current_host; - - pd = mwSession_getClientData(session); - gc = pd->gc; - account = purple_connection_get_account(gc); - port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT); - current_host = purple_account_get_string(account, MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - - if(purple_account_get_bool(account, MW_KEY_FORCE, FALSE) || - !host || (! strcmp(current_host, host)) || - (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL)) { - - /* if we're configured to force logins, or if we're being - redirected to the already configured host, or if we couldn't - connect to the new host, we'll force the login instead */ - - mwSession_forceLogin(session); - } -} - - -static void mw_prpl_set_status(PurpleAccount *acct, PurpleStatus *status); - - -/** called from mw_session_stateChange when the session's state is - mwSession_STARTED. Any finalizing of start-up stuff should go - here */ -static void session_started(struct mwPurplePluginData *pd) { - PurpleStatus *status; - PurpleAccount *acct; - - /* set out initial status */ - acct = purple_connection_get_account(pd->gc); - status = purple_account_get_active_status(acct); - mw_prpl_set_status(acct, status); - - /* start watching for new conversations */ - purple_signal_connect(purple_conversations_get_handle(), - "conversation-created", pd, - PURPLE_CALLBACK(conversation_created_cb), pd); - - /* watch for group extended menu items */ - purple_signal_connect(purple_blist_get_handle(), - "blist-node-extended-menu", pd, - PURPLE_CALLBACK(blist_node_menu_cb), pd); - - /* use our services to do neat things */ - services_starting(pd); -} - - -static void session_stopping(struct mwPurplePluginData *pd) { - /* stop watching the signals from session_started */ - purple_signals_disconnect_by_handle(pd); -} - - -static void mw_session_stateChange(struct mwSession *session, - enum mwSessionState state, - gpointer info) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - const char *msg = NULL; - - pd = mwSession_getClientData(session); - gc = pd->gc; - - switch(state) { - case mwSession_STARTING: - msg = _("Sending Handshake"); - purple_connection_update_progress(gc, msg, 2, MW_CONNECT_STEPS); - break; - - case mwSession_HANDSHAKE: - msg = _("Waiting for Handshake Acknowledgement"); - purple_connection_update_progress(gc, msg, 3, MW_CONNECT_STEPS); - break; - - case mwSession_HANDSHAKE_ACK: - msg = _("Handshake Acknowledged, Sending Login"); - purple_connection_update_progress(gc, msg, 4, MW_CONNECT_STEPS); - break; - - case mwSession_LOGIN: - msg = _("Waiting for Login Acknowledgement"); - purple_connection_update_progress(gc, msg, 5, MW_CONNECT_STEPS); - break; - - case mwSession_LOGIN_REDIR: - msg = _("Login Redirected"); - purple_connection_update_progress(gc, msg, 6, MW_CONNECT_STEPS); - session_loginRedirect(session, info); - break; - - case mwSession_LOGIN_CONT: - msg = _("Forcing Login"); - purple_connection_update_progress(gc, msg, 7, MW_CONNECT_STEPS); - - case mwSession_LOGIN_ACK: - msg = _("Login Acknowledged"); - purple_connection_update_progress(gc, msg, 8, MW_CONNECT_STEPS); - break; - - case mwSession_STARTED: - msg = _("Starting Services"); - purple_connection_update_progress(gc, msg, 9, MW_CONNECT_STEPS); - - session_started(pd); - - msg = _("Connected"); - purple_connection_update_progress(gc, msg, 10, MW_CONNECT_STEPS); - purple_connection_set_state(gc, PURPLE_CONNECTED); - break; - - case mwSession_STOPPING: - - session_stopping(pd); - - if(GPOINTER_TO_UINT(info) & ERR_FAILURE) { - char *err = mwError(GPOINTER_TO_UINT(info)); - PurpleConnectionError reason; - switch (GPOINTER_TO_UINT(info)) { - case VERSION_MISMATCH: - reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - - case USER_RESTRICTED: - case INCORRECT_LOGIN: - case USER_UNREGISTERED: - case GUEST_IN_USE: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - - case ENCRYPT_MISMATCH: - case ERR_ENCRYPT_NO_SUPPORT: - case ERR_NO_COMMON_ENCRYPT: - reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR; - break; - - case VERIFICATION_DOWN: - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE; - break; - - case MULTI_SERVER_LOGIN: - case MULTI_SERVER_LOGIN2: - reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; - break; - - default: - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - } - purple_connection_error_reason(gc, reason, err); - g_free(err); - } - break; - - case mwSession_STOPPED: - break; - - case mwSession_UNKNOWN: - default: - DEBUG_WARN("session in unknown state\n"); - } -} - - -static void mw_session_setPrivacyInfo(struct mwSession *session) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - struct mwPrivacyInfo *privacy; - GSList *l, **ll; - guint count; - - DEBUG_INFO("privacy information set from server\n"); - - g_return_if_fail(session != NULL); - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - privacy = mwSession_getPrivacyInfo(session); - count = privacy->count; - - ll = (privacy->deny)? &acct->deny: &acct->permit; - for(l = *ll; l; l = l->next) g_free(l->data); - g_slist_free(*ll); - l = *ll = NULL; - - while(count--) { - struct mwUserItem *u = privacy->users + count; - l = g_slist_prepend(l, g_strdup(u->id)); - } - *ll = l; -} - - -static void mw_session_setUserStatus(struct mwSession *session) { - struct mwPurplePluginData *pd; - PurpleConnection *gc; - struct mwAwareIdBlock idb = { mwAware_USER, NULL, NULL }; - struct mwUserStatus *stat; - - g_return_if_fail(session != NULL); - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - idb.user = mwSession_getProperty(session, mwSession_AUTH_USER_ID); - stat = mwSession_getUserStatus(session); - - /* trigger an update of our own status if we're in the buddy list */ - mwServiceAware_setStatus(pd->srvc_aware, &idb, stat); -} - - -static void mw_session_admin(struct mwSession *session, - const char *text) { - PurpleConnection *gc; - PurpleAccount *acct; - const char *host; - const char *msg; - char *prim; - - gc = session_to_gc(session); - g_return_if_fail(gc != NULL); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - host = purple_account_get_string(acct, MW_KEY_HOST, NULL); - - msg = _("A Sametime administrator has issued the following announcement" - " on server %s"); - prim = g_strdup_printf(msg, NSTR(host)); - - purple_notify_message(gc, PURPLE_NOTIFY_MSG_INFO, - _("Sametime Administrator Announcement"), - prim, text, NULL, NULL); - - g_free(prim); -} - - -/** called from read_cb, attempts to read available data from sock and - pass it to the session, passing back the return code from the read - call for handling in read_cb */ -static int read_recv(struct mwSession *session, int sock) { - guchar buf[BUF_LEN]; - int len; - - len = read(sock, buf, BUF_LEN); - if(len > 0) { - mwSession_recv(session, buf, len); - } - - return len; -} - - -/** callback triggered from purple_input_add, watches the socked for - available data to be processed by the session */ -static void read_cb(gpointer data, gint source, PurpleInputCondition cond) { - struct mwPurplePluginData *pd = data; - int ret = 0, err = 0; - - g_return_if_fail(pd != NULL); - - ret = read_recv(pd->session, pd->socket); - - /* normal operation ends here */ - if(ret > 0) return; - - /* fetch the global error value */ - err = errno; - - /* read problem occurred if we're here, so we'll need to take care of - it and clean up internal state */ - - if(pd->socket) { - close(pd->socket); - pd->socket = 0; - } - - if(pd->gc->inpa) { - purple_input_remove(pd->gc->inpa); - pd->gc->inpa = 0; - } - - if(! ret) { - DEBUG_INFO("connection reset\n"); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - - } else if(ret < 0) { - const gchar *err_str = g_strerror(err); - char *msg = NULL; - - DEBUG_INFO("error in read callback: %s\n", err_str); - - msg = g_strdup_printf(_("Lost connection with server: %s"), err_str); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - msg); - g_free(msg); - } -} - - -/** Callback passed to purple_proxy_connect when an account is logged - in, and if the session logging in receives a redirect message */ -static void connect_cb(gpointer data, gint source, const gchar *error_message) { - - struct mwPurplePluginData *pd = data; - PurpleConnection *gc = pd->gc; - - if(source < 0) { - /* connection failed */ - - if(pd->socket) { - /* this is a redirect connect, force login on existing socket */ - mwSession_forceLogin(pd->session); - - } else { - /* this is a regular connect, error out */ - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason(pd->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - tmp); - g_free(tmp); - } - - return; - } - - if(pd->socket) { - /* stop any existing login attempt */ - mwSession_stop(pd->session, ERR_SUCCESS); - } - - pd->socket = source; - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, - read_cb, pd); - - mwSession_start(pd->session); -} - - -static void mw_session_announce(struct mwSession *s, - struct mwLoginInfo *from, - gboolean may_reply, - const char *text) { - struct mwPurplePluginData *pd; - PurpleAccount *acct; - PurpleConversation *conv; - PurpleBuddy *buddy; - char *who = from->user_id; - char *msg; - - pd = mwSession_getClientData(s); - acct = purple_connection_get_account(pd->gc); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, acct); - if(! conv) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, who); - - buddy = purple_find_buddy(acct, who); - if(buddy) who = (char *) purple_buddy_get_contact_alias(buddy); - - who = g_strdup_printf(_("Announcement from %s"), who); - msg = purple_markup_linkify(text); - - purple_conversation_write(conv, who, msg ? msg : "", PURPLE_MESSAGE_RECV, time(NULL)); - g_free(who); - g_free(msg); -} - - -static struct mwSessionHandler mw_session_handler = { - mw_session_io_write, - mw_session_io_close, - mw_session_clear, - mw_session_stateChange, - mw_session_setPrivacyInfo, - mw_session_setUserStatus, - mw_session_admin, - mw_session_announce, -}; - - -static void mw_aware_on_attrib(struct mwServiceAware *srvc, - struct mwAwareAttribute *attrib) { - - ; /** @todo handle server attributes. There may be some stuff we - actually want to look for, but I'm not aware of anything right - now.*/ -} - - -static void mw_aware_clear(struct mwServiceAware *srvc) { - ; /* nothing for now */ -} - - -static struct mwAwareHandler mw_aware_handler = { - mw_aware_on_attrib, - mw_aware_clear, -}; - - -static struct mwServiceAware *mw_srvc_aware_new(struct mwSession *s) { - struct mwServiceAware *srvc; - srvc = mwServiceAware_new(s, &mw_aware_handler); - return srvc; -}; - - -static void mw_conf_invited(struct mwConference *conf, - struct mwLoginInfo *inviter, - const char *invitation) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - char *c_inviter, *c_name, *c_topic, *c_invitation; - GHashTable *ht; - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - c_inviter = g_strdup(inviter->user_id); - g_hash_table_insert(ht, CHAT_KEY_CREATOR, c_inviter); - - c_name = g_strdup(mwConference_getName(conf)); - g_hash_table_insert(ht, CHAT_KEY_NAME, c_name); - - c_topic = g_strdup(mwConference_getTitle(conf)); - g_hash_table_insert(ht, CHAT_KEY_TOPIC, c_topic); - - c_invitation = g_strdup(invitation); - g_hash_table_insert(ht, CHAT_KEY_INVITE, c_invitation); - - DEBUG_INFO("received invitation from '%s' to join ('%s','%s'): '%s'\n", - NSTR(c_inviter), NSTR(c_name), - NSTR(c_topic), NSTR(c_invitation)); - - if(! c_topic) c_topic = "(no title)"; - if(! c_invitation) c_invitation = "(no message)"; - serv_got_chat_invite(gc, c_topic, c_inviter, c_invitation, ht); -} - - -/* The following mess helps us relate a mwConference to a PurpleConvChat - in the various forms by which either may be indicated */ - -#define CONF_TO_ID(conf) (GPOINTER_TO_INT(conf)) -#define ID_TO_CONF(pd, id) (conf_find_by_id((pd), (id))) - -#define CHAT_TO_ID(chat) (purple_conv_chat_get_id(chat)) -#define ID_TO_CHAT(id) (purple_find_chat(id)) - -#define CHAT_TO_CONF(pd, chat) (ID_TO_CONF((pd), CHAT_TO_ID(chat))) -#define CONF_TO_CHAT(conf) (ID_TO_CHAT(CONF_TO_ID(conf))) - - -static struct mwConference * -conf_find_by_id(struct mwPurplePluginData *pd, int id) { - - struct mwServiceConference *srvc = pd->srvc_conf; - struct mwConference *conf = NULL; - GList *l, *ll; - - ll = mwServiceConference_getConferences(srvc); - for(l = ll; l; l = l->next) { - struct mwConference *c = l->data; - PurpleConvChat *h = mwConference_getClientData(c); - - if(CHAT_TO_ID(h) == id) { - conf = c; - break; - } - } - g_list_free(ll); - - return conf; -} - - -static void mw_conf_opened(struct mwConference *conf, GList *members) { - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *g_conf; - - const char *n = mwConference_getName(conf); - const char *t = mwConference_getTitle(conf); - - DEBUG_INFO("conf %s opened, %u initial members\n", - NSTR(n), g_list_length(members)); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - if(! t) t = "(no title)"; - g_conf = serv_got_joined_chat(gc, CONF_TO_ID(conf), t); - - mwConference_setClientData(conf, PURPLE_CONV_CHAT(g_conf), NULL); - - for(; members; members = members->next) { - struct mwLoginInfo *peer = members->data; - purple_conv_chat_add_user(PURPLE_CONV_CHAT(g_conf), peer->user_id, - NULL, PURPLE_CBFLAGS_NONE, FALSE); - } -} - - -static void mw_conf_closed(struct mwConference *conf, guint32 reason) { - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - const char *n = mwConference_getName(conf); - char *msg = mwError(reason); - - DEBUG_INFO("conf %s closed, 0x%08x\n", NSTR(n), reason); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - serv_got_chat_left(gc, CONF_TO_ID(conf)); - - purple_notify_error(gc, _("Conference Closed"), NULL, msg); - g_free(msg); -} - - -static void mw_conf_peer_joined(struct mwConference *conf, - struct mwLoginInfo *peer) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConvChat *g_conf; - - const char *n = mwConference_getName(conf); - - DEBUG_INFO("%s joined conf %s\n", NSTR(peer->user_id), NSTR(n)); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - g_conf = mwConference_getClientData(conf); - g_return_if_fail(g_conf != NULL); - - purple_conv_chat_add_user(g_conf, peer->user_id, - NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - - -static void mw_conf_peer_parted(struct mwConference *conf, - struct mwLoginInfo *peer) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConvChat *g_conf; - - const char *n = mwConference_getName(conf); - - DEBUG_INFO("%s left conf %s\n", NSTR(peer->user_id), NSTR(n)); - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - g_conf = mwConference_getClientData(conf); - g_return_if_fail(g_conf != NULL); - - purple_conv_chat_remove_user(g_conf, peer->user_id, NULL); -} - - -static void mw_conf_text(struct mwConference *conf, - struct mwLoginInfo *who, const char *text) { - - struct mwServiceConference *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - char *esc; - - if(! text) return; - - srvc = mwConference_getService(conf); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - esc = g_markup_escape_text(text, -1); - serv_got_chat_in(gc, CONF_TO_ID(conf), who->user_id, 0, esc, time(NULL)); - g_free(esc); -} - - -static void mw_conf_typing(struct mwConference *conf, - struct mwLoginInfo *who, gboolean typing) { - - /* purple really has no good way to expose this to the user. */ - - const char *n = mwConference_getName(conf); - const char *w = who->user_id; - - if(typing) { - DEBUG_INFO("%s in conf %s: \n", NSTR(w), NSTR(n)); - - } else { - DEBUG_INFO("%s in conf %s: \n", NSTR(w), NSTR(n)); - } -} - - -static void mw_conf_clear(struct mwServiceConference *srvc) { - ; -} - - -static struct mwConferenceHandler mw_conference_handler = { - mw_conf_invited, - mw_conf_opened, - mw_conf_closed, - mw_conf_peer_joined, - mw_conf_peer_parted, - mw_conf_text, - mw_conf_typing, - mw_conf_clear, -}; - - -static struct mwServiceConference *mw_srvc_conf_new(struct mwSession *s) { - struct mwServiceConference *srvc; - srvc = mwServiceConference_new(s, &mw_conference_handler); - return srvc; -} - - -/** size of an outgoing file transfer chunk */ -#define MW_FT_LEN (BUF_LONG * 2) - - -static void ft_incoming_cancel(PurpleXfer *xfer) { - /* incoming transfer rejected or canceled in-progress */ - struct mwFileTransfer *ft = xfer->data; - if(ft) mwFileTransfer_reject(ft); -} - - -static void ft_incoming_init(PurpleXfer *xfer) { - /* incoming transfer accepted */ - - /* - accept the mwFileTransfer - - open/create the local FILE "wb" - - stick the FILE's fp in xfer->dest_fp - */ - - struct mwFileTransfer *ft; - FILE *fp; - - ft = xfer->data; - - fp = g_fopen(xfer->local_filename, "wb"); - if(! fp) { - mwFileTransfer_cancel(ft); - return; - } - - xfer->dest_fp = fp; - mwFileTransfer_accept(ft); -} - - -static void mw_ft_offered(struct mwFileTransfer *ft) { - /* - - create a purple ft object - - offer it - */ - - struct mwServiceFileTransfer *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - const char *who; - PurpleXfer *xfer; - - /* @todo add some safety checks */ - srvc = mwFileTransfer_getService(ft); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - acct = purple_connection_get_account(gc); - - who = mwFileTransfer_getUser(ft)->user; - - DEBUG_INFO("file transfer %p offered\n", ft); - DEBUG_INFO(" from: %s\n", NSTR(who)); - DEBUG_INFO(" file: %s\n", NSTR(mwFileTransfer_getFileName(ft))); - DEBUG_INFO(" size: %u\n", mwFileTransfer_getFileSize(ft)); - DEBUG_INFO(" text: %s\n", NSTR(mwFileTransfer_getMessage(ft))); - - xfer = purple_xfer_new(acct, PURPLE_XFER_RECEIVE, who); - if (xfer) - { - purple_xfer_ref(xfer); - mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; - - purple_xfer_set_init_fnc(xfer, ft_incoming_init); - purple_xfer_set_cancel_recv_fnc(xfer, ft_incoming_cancel); - purple_xfer_set_request_denied_fnc(xfer, ft_incoming_cancel); - - purple_xfer_set_filename(xfer, mwFileTransfer_getFileName(ft)); - purple_xfer_set_size(xfer, mwFileTransfer_getFileSize(ft)); - purple_xfer_set_message(xfer, mwFileTransfer_getMessage(ft)); - - purple_xfer_request(xfer); - } -} - - -static void ft_send(struct mwFileTransfer *ft, FILE *fp) { - guchar buf[MW_FT_LEN]; - struct mwOpaque o = { .data = buf, .len = MW_FT_LEN }; - guint32 rem; - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - - rem = mwFileTransfer_getRemaining(ft); - if(rem < MW_FT_LEN) o.len = rem; - - if(fread(buf, (size_t) o.len, 1, fp)) { - - /* calculate progress and display it */ - xfer->bytes_sent += o.len; - xfer->bytes_remaining -= o.len; - purple_xfer_update_progress(xfer); - - mwFileTransfer_send(ft, &o); - - } else { - int err = errno; - DEBUG_WARN("problem reading from file %s: %s\n", - NSTR(mwFileTransfer_getFileName(ft)), g_strerror(err)); - - mwFileTransfer_cancel(ft); - } -} - - -static void mw_ft_opened(struct mwFileTransfer *ft) { - /* - - get purple ft from client data in ft - - set the state to active - */ - - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - - if(! xfer) { - mwFileTransfer_cancel(ft); - mwFileTransfer_free(ft); - g_return_if_reached(); - } - - if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - xfer->dest_fp = g_fopen(xfer->local_filename, "rb"); - ft_send(ft, xfer->dest_fp); - } -} - - -static void mw_ft_closed(struct mwFileTransfer *ft, guint32 code) { - /* - - get purple ft from client data in ft - - indicate rejection/cancelation/completion - - free the file transfer itself - */ - - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - if(xfer) { - xfer->data = NULL; - - if(! mwFileTransfer_getRemaining(ft)) { - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - - } else if(mwFileTransfer_isCancelLocal(ft)) { - /* calling purple_xfer_cancel_local is redundant, since that's - probably what triggered this function to be called */ - ; - - } else if(mwFileTransfer_isCancelRemote(ft)) { - /* steal the reference for the xfer */ - mwFileTransfer_setClientData(ft, NULL, NULL); - purple_xfer_cancel_remote(xfer); - - /* drop the stolen reference */ - purple_xfer_unref(xfer); - return; - } - } - - mwFileTransfer_free(ft); -} - - -static void mw_ft_recv(struct mwFileTransfer *ft, - struct mwOpaque *data) { - /* - - get purple ft from client data in ft - - update transfered percentage - - if done, destroy the ft, disassociate from purple ft - */ - - PurpleXfer *xfer; - FILE *fp; - size_t wc; - - xfer = mwFileTransfer_getClientData(ft); - g_return_if_fail(xfer != NULL); - - fp = xfer->dest_fp; - g_return_if_fail(fp != NULL); - - /* we must collect and save our precious data */ - wc = fwrite(data->data, 1, data->len, fp); - if (wc != data->len) { - DEBUG_ERROR("failed to write data\n"); - purple_xfer_cancel_local(xfer); - return; - } - - /* update the progress */ - xfer->bytes_sent += data->len; - xfer->bytes_remaining -= data->len; - purple_xfer_update_progress(xfer); - - /* let the other side know we got it, and to send some more */ - mwFileTransfer_ack(ft); -} - - -static void mw_ft_ack(struct mwFileTransfer *ft) { - PurpleXfer *xfer; - - xfer = mwFileTransfer_getClientData(ft); - g_return_if_fail(xfer != NULL); - g_return_if_fail(xfer->watcher == 0); - - if(! mwFileTransfer_getRemaining(ft)) { - purple_xfer_set_completed(xfer, TRUE); - purple_xfer_end(xfer); - - } else if(mwFileTransfer_isOpen(ft)) { - ft_send(ft, xfer->dest_fp); - } -} - - -static void mw_ft_clear(struct mwServiceFileTransfer *srvc) { - ; -} - - -static struct mwFileTransferHandler mw_ft_handler = { - mw_ft_offered, - mw_ft_opened, - mw_ft_closed, - mw_ft_recv, - mw_ft_ack, - mw_ft_clear, -}; - - -static struct mwServiceFileTransfer *mw_srvc_ft_new(struct mwSession *s) { - struct mwServiceFileTransfer *srvc; - GHashTable *ft_map; - - ft_map = g_hash_table_new(g_direct_hash, g_direct_equal); - - srvc = mwServiceFileTransfer_new(s, &mw_ft_handler); - mwService_setClientData(MW_SERVICE(srvc), ft_map, - (GDestroyNotify) g_hash_table_destroy); - - return srvc; -} - - -static void convo_data_free(struct convo_data *cd) { - GList *l; - - /* clean the queue */ - for(l = cd->queue; l; l = g_list_delete_link(l, l)) { - struct convo_msg *m = l->data; - if(m->clear) m->clear(m->data); - g_free(m); - } - - g_free(cd); -} - - -/** allocates a convo_data structure and associates it with the - conversation in the client data slot */ -static void convo_data_new(struct mwConversation *conv) { - struct convo_data *cd; - - g_return_if_fail(conv != NULL); - - if(mwConversation_getClientData(conv)) - return; - - cd = g_new0(struct convo_data, 1); - cd->conv = conv; - - mwConversation_setClientData(conv, cd, (GDestroyNotify) convo_data_free); -} - - -static PurpleConversation *convo_get_gconv(struct mwConversation *conv) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - - struct mwIdBlock *idb; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - acct = purple_connection_get_account(gc); - - idb = mwConversation_getTarget(conv); - - return purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - idb->user, acct); -} - - -static void convo_queue(struct mwConversation *conv, - enum mwImSendType type, gconstpointer data) { - - struct convo_data *cd; - struct convo_msg *m; - - convo_data_new(conv); - cd = mwConversation_getClientData(conv); - - m = g_new0(struct convo_msg, 1); - m->type = type; - - switch(type) { - case mwImSend_PLAIN: - m->data = g_strdup(data); - m->clear = g_free; - break; - - case mwImSend_TYPING: - default: - m->data = (gpointer) data; - m->clear = NULL; - } - - cd->queue = g_list_append(cd->queue, m); -} - - -/* Does what it takes to get an error displayed for a conversation */ -static void convo_error(struct mwConversation *conv, guint32 err) { - PurpleConversation *gconv; - char *tmp, *text; - struct mwIdBlock *idb; - - idb = mwConversation_getTarget(conv); - - tmp = mwError(err); - text = g_strconcat(_("Unable to send message: "), tmp, NULL); - - gconv = convo_get_gconv(conv); - if(gconv && !purple_conv_present_error(idb->user, gconv->account, text)) { - - g_free(text); - text = g_strdup_printf(_("Unable to send message to %s:"), - (idb->user)? idb->user: "(unknown)"); - purple_notify_error(purple_account_get_connection(gconv->account), - NULL, text, tmp); - } - - g_free(tmp); - g_free(text); -} - - -static void convo_queue_send(struct mwConversation *conv) { - struct convo_data *cd; - GList *l; - - cd = mwConversation_getClientData(conv); - - for(l = cd->queue; l; l = g_list_delete_link(l, l)) { - struct convo_msg *m = l->data; - - mwConversation_send(conv, m->type, m->data); - - if(m->clear) m->clear(m->data); - g_free(m); - } - - cd->queue = NULL; -} - - -/** called when a mw conversation leaves a purple conversation to - inform the purple conversation that it's unsafe to offer any *cool* - features. */ -static void convo_nofeatures(struct mwConversation *conv) { - PurpleConversation *gconv; - PurpleConnection *gc; - - gconv = convo_get_gconv(conv); - if(! gconv) return; - - gc = purple_conversation_get_gc(gconv); - if(! gc) return; - - purple_conversation_set_features(gconv, gc->flags); -} - - -/** called when a mw conversation and purple conversation come together, - to inform the purple conversation of what features to offer the - user */ -static void convo_features(struct mwConversation *conv) { - PurpleConversation *gconv; - PurpleConnectionFlags feat; - - gconv = convo_get_gconv(conv); - if(! gconv) return; - - feat = purple_conversation_get_features(gconv); - - if(mwConversation_isOpen(conv)) { - if(mwConversation_supports(conv, mwImSend_HTML)) { - feat |= PURPLE_CONNECTION_HTML; - } else { - feat &= ~PURPLE_CONNECTION_HTML; - } - - if(mwConversation_supports(conv, mwImSend_MIME)) { - feat &= ~PURPLE_CONNECTION_NO_IMAGES; - } else { - feat |= PURPLE_CONNECTION_NO_IMAGES; - } - - DEBUG_INFO("conversation features set to 0x%04x\n", feat); - purple_conversation_set_features(gconv, feat); - - } else { - convo_nofeatures(conv); - } -} - - -static void mw_conversation_opened(struct mwConversation *conv) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleAccount *acct; - - struct convo_dat *cd; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - acct = purple_connection_get_account(gc); - - /* set up the queue */ - cd = mwConversation_getClientData(conv); - if(cd) { - convo_queue_send(conv); - - if(! convo_get_gconv(conv)) { - mwConversation_free(conv); - return; - } - - } else { - convo_data_new(conv); - } - - { /* record the client key for the buddy */ - PurpleBuddy *buddy; - struct mwLoginInfo *info; - info = mwConversation_getTargetInfo(conv); - - buddy = purple_find_buddy(acct, info->user_id); - if(buddy) { - purple_blist_node_set_int((PurpleBlistNode *) buddy, - BUDDY_KEY_CLIENT, info->type); - } - } - - convo_features(conv); -} - - -static void mw_conversation_closed(struct mwConversation *conv, - guint32 reason) { - - struct convo_data *cd; - - g_return_if_fail(conv != NULL); - - /* if there's an error code and a non-typing message in the queue, - print an error message to the conversation */ - cd = mwConversation_getClientData(conv); - if(reason && cd && cd->queue) { - GList *l; - for(l = cd->queue; l; l = l->next) { - struct convo_msg *m = l->data; - if(m->type != mwImSend_TYPING) { - convo_error(conv, reason); - break; - } - } - } - -#if 0 - /* don't do this, to prevent the occasional weird sending of - formatted messages as plaintext when the other end closes the - conversation after we've begun composing the message */ - convo_nofeatures(conv); -#endif - - mwConversation_removeClientData(conv); -} - - -static void im_recv_text(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *msg) { - - struct mwIdBlock *idb; - char *txt, *esc; - const char *t; - - idb = mwConversation_getTarget(conv); - - txt = purple_utf8_try_convert(msg); - t = txt? txt: msg; - - esc = g_markup_escape_text(t, -1); - serv_got_im(pd->gc, idb->user, esc, 0, time(NULL)); - g_free(esc); - - g_free(txt); -} - - -static void im_recv_typing(struct mwConversation *conv, - struct mwPurplePluginData *pd, - gboolean typing) { - - struct mwIdBlock *idb; - idb = mwConversation_getTarget(conv); - - serv_got_typing(pd->gc, idb->user, 0, - typing? PURPLE_TYPING: PURPLE_NOT_TYPING); -} - - -static void im_recv_html(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *msg) { - struct mwIdBlock *idb; - char *t1, *t2; - const char *t; - - idb = mwConversation_getTarget(conv); - - /* ensure we're receiving UTF8 */ - t1 = purple_utf8_try_convert(msg); - t = t1? t1: msg; - - /* convert entities to UTF8 so they'll log correctly */ - t2 = purple_utf8_ncr_decode(t); - t = t2? t2: t; - - serv_got_im(pd->gc, idb->user, t, 0, time(NULL)); - - g_free(t1); - g_free(t2); -} - - -static void im_recv_subj(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *subj) { - - /** @todo somehow indicate receipt of a conversation subject. It - would also be nice if we added a /topic command for the - protocol */ - ; -} - - -/** generate "cid:908@20582notesbuddy" from "<908@20582notesbuddy>" */ -static char *make_cid(const char *cid) { - gsize n; - char *c, *d; - - g_return_val_if_fail(cid != NULL, NULL); - - n = strlen(cid); - g_return_val_if_fail(n > 2, NULL); - - c = g_strndup(cid+1, n-2); - d = g_strdup_printf("cid:%s", c); - - g_free(c); - return d; -} - - -static void im_recv_mime(struct mwConversation *conv, - struct mwPurplePluginData *pd, - const char *data) { - - GHashTable *img_by_cid; - GList *images; - - GString *str; - - PurpleMimeDocument *doc; - GList *parts; - - img_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - images = NULL; - - /* don't want the contained string to ever be NULL */ - str = g_string_new(""); - - doc = purple_mime_document_parse(data); - - /* handle all the MIME parts */ - parts = purple_mime_document_get_parts(doc); - for(; parts; parts = parts->next) { - PurpleMimePart *part = parts->data; - const char *type; - - type = purple_mime_part_get_field(part, "content-type"); - DEBUG_INFO("MIME part Content-Type: %s\n", NSTR(type)); - - if(! type) { - ; /* feh */ - - } else if(purple_str_has_prefix(type, "image")) { - /* put images into the image store */ - - guchar *d_dat; - gsize d_len; - char *cid; - int img; - - /* obtain and unencode the data */ - purple_mime_part_get_data_decoded(part, &d_dat, &d_len); - - /* look up the content id */ - cid = (char *) purple_mime_part_get_field(part, "Content-ID"); - cid = make_cid(cid); - - /* add image to the purple image store */ - img = purple_imgstore_add_with_id(d_dat, d_len, cid); - - /* map the cid to the image store identifier */ - g_hash_table_insert(img_by_cid, cid, GINT_TO_POINTER(img)); - - /* recall the image for dereferencing later */ - images = g_list_append(images, GINT_TO_POINTER(img)); - - } else if(purple_str_has_prefix(type, "text")) { - - /* concatenate all the text parts together */ - guchar *data; - gsize len; - - purple_mime_part_get_data_decoded(part, &data, &len); - g_string_append(str, (const char *)data); - g_free(data); - } - } - - purple_mime_document_free(doc); - - /* @todo should put this in its own function */ - { /* replace each IMG tag's SRC attribute with an ID attribute. This - actually modifies the contents of str */ - GData *attribs; - char *start, *end; - char *tmp = str->str; - - while(*tmp && purple_markup_find_tag("img", tmp, (const char **) &start, - (const char **) &end, &attribs)) { - - char *alt, *align, *border, *src; - int img = 0; - - alt = g_datalist_get_data(&attribs, "alt"); - align = g_datalist_get_data(&attribs, "align"); - border = g_datalist_get_data(&attribs, "border"); - src = g_datalist_get_data(&attribs, "src"); - - if(src) - img = GPOINTER_TO_INT(g_hash_table_lookup(img_by_cid, src)); - - if(img) { - GString *atstr; - gsize len = (end - start); - gsize mov; - - atstr = g_string_new(""); - if(alt) g_string_append_printf(atstr, " alt=\"%s\"", alt); - if(align) g_string_append_printf(atstr, " align=\"%s\"", align); - if(border) g_string_append_printf(atstr, " border=\"%s\"", border); - - mov = g_snprintf(start, len, "str, img); - while(mov < len) start[mov++] = ' '; - - g_string_free(atstr, TRUE); - } - - g_datalist_clear(&attribs); - tmp = end + 1; - } - } - - im_recv_html(conv, pd, str->str); - - g_string_free(str, TRUE); - - /* clean up the cid table */ - g_hash_table_destroy(img_by_cid); - - /* dereference all the imgages */ - while(images) { - purple_imgstore_unref_by_id(GPOINTER_TO_INT(images->data)); - images = g_list_delete_link(images, images); - } -} - - -static void mw_conversation_recv(struct mwConversation *conv, - enum mwImSendType type, - gconstpointer msg) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - - switch(type) { - case mwImSend_PLAIN: - im_recv_text(conv, pd, msg); - break; - - case mwImSend_TYPING: - im_recv_typing(conv, pd, !! msg); - break; - - case mwImSend_HTML: - im_recv_html(conv, pd, msg); - break; - - case mwImSend_SUBJECT: - im_recv_subj(conv, pd, msg); - break; - - case mwImSend_MIME: - im_recv_mime(conv, pd, msg); - break; - - default: - DEBUG_INFO("conversation received strange type, 0x%04x\n", type); - ; /* erm... */ - } -} - - -static void mw_place_invite(struct mwConversation *conv, - const char *message, - const char *title, const char *name) { - struct mwServiceIm *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - - struct mwIdBlock *idb; - GHashTable *ht; - - srvc = mwConversation_getService(conv); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - - idb = mwConversation_getTarget(conv); - - ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_insert(ht, CHAT_KEY_CREATOR, g_strdup(idb->user)); - g_hash_table_insert(ht, CHAT_KEY_NAME, g_strdup(name)); - g_hash_table_insert(ht, CHAT_KEY_TOPIC, g_strdup(title)); - g_hash_table_insert(ht, CHAT_KEY_INVITE, g_strdup(message)); - g_hash_table_insert(ht, CHAT_KEY_IS_PLACE, g_strdup("")); /* ugh */ - - if(! title) title = "(no title)"; - if(! message) message = "(no message)"; - serv_got_chat_invite(pd->gc, title, idb->user, message, ht); - - mwConversation_close(conv, ERR_SUCCESS); - mwConversation_free(conv); -} - - -static void mw_im_clear(struct mwServiceIm *srvc) { - ; -} - - -static struct mwImHandler mw_im_handler = { - mw_conversation_opened, - mw_conversation_closed, - mw_conversation_recv, - mw_place_invite, - mw_im_clear, -}; - - -static struct mwServiceIm *mw_srvc_im_new(struct mwSession *s) { - struct mwServiceIm *srvc; - srvc = mwServiceIm_new(s, &mw_im_handler); - mwServiceIm_setClientType(srvc, mwImClient_NOTESBUDDY); - return srvc; -} - - -/* The following helps us relate a mwPlace to a PurpleConvChat in the - various forms by which either may be indicated. Uses some of - the similar macros from the conference service above */ - -#define PLACE_TO_ID(place) (GPOINTER_TO_INT(place)) -#define ID_TO_PLACE(pd, id) (place_find_by_id((pd), (id))) - -#define CHAT_TO_PLACE(pd, chat) (ID_TO_PLACE((pd), CHAT_TO_ID(chat))) -#define PLACE_TO_CHAT(place) (ID_TO_CHAT(PLACE_TO_ID(place))) - - -static struct mwPlace * -place_find_by_id(struct mwPurplePluginData *pd, int id) { - struct mwServicePlace *srvc = pd->srvc_place; - struct mwPlace *place = NULL; - GList *l; - - l = (GList *) mwServicePlace_getPlaces(srvc); - for(; l; l = l->next) { - struct mwPlace *p = l->data; - PurpleConvChat *h = PURPLE_CONV_CHAT(mwPlace_getClientData(p)); - - if(CHAT_TO_ID(h) == id) { - place = p; - break; - } - } - - return place; -} - - -static void mw_place_opened(struct mwPlace *place) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *gconf; - - GList *members, *l; - - const char *n = mwPlace_getName(place); - const char *t = mwPlace_getTitle(place); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - members = mwPlace_getMembers(place); - - DEBUG_INFO("place %s opened, %u initial members\n", - NSTR(n), g_list_length(members)); - - if(! t) t = "(no title)"; - gconf = serv_got_joined_chat(gc, PLACE_TO_ID(place), t); - - mwPlace_setClientData(place, gconf, NULL); - - for(l = members; l; l = l->next) { - struct mwIdBlock *idb = l->data; - purple_conv_chat_add_user(PURPLE_CONV_CHAT(gconf), idb->user, - NULL, PURPLE_CBFLAGS_NONE, FALSE); - } - g_list_free(members); -} - - -static void mw_place_closed(struct mwPlace *place, guint32 code) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - const char *n = mwPlace_getName(place); - char *msg = mwError(code); - - DEBUG_INFO("place %s closed, 0x%08x\n", NSTR(n), code); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - serv_got_chat_left(gc, PLACE_TO_ID(place)); - - purple_notify_error(gc, _("Place Closed"), NULL, msg); - g_free(msg); -} - - -static void mw_place_peerJoined(struct mwPlace *place, - const struct mwIdBlock *peer) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *gconf; - - const char *n = mwPlace_getName(place); - - DEBUG_INFO("%s joined place %s\n", NSTR(peer->user), NSTR(n)); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - gconf = mwPlace_getClientData(place); - g_return_if_fail(gconf != NULL); - - purple_conv_chat_add_user(PURPLE_CONV_CHAT(gconf), peer->user, - NULL, PURPLE_CBFLAGS_NONE, TRUE); -} - - -static void mw_place_peerParted(struct mwPlace *place, - const struct mwIdBlock *peer) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - PurpleConversation *gconf; - - const char *n = mwPlace_getName(place); - - DEBUG_INFO("%s left place %s\n", NSTR(peer->user), NSTR(n)); - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - gconf = mwPlace_getClientData(place); - g_return_if_fail(gconf != NULL); - - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(gconf), peer->user, NULL); -} - - -static void mw_place_peerSetAttribute(struct mwPlace *place, - const struct mwIdBlock *peer, - guint32 attr, struct mwOpaque *o) { - ; -} - - -static void mw_place_peerUnsetAttribute(struct mwPlace *place, - const struct mwIdBlock *peer, - guint32 attr) { - ; -} - - -static void mw_place_message(struct mwPlace *place, - const struct mwIdBlock *who, - const char *msg) { - struct mwServicePlace *srvc; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - char *esc; - - if(! msg) return; - - srvc = mwPlace_getService(place); - session = mwService_getSession(MW_SERVICE(srvc)); - pd = mwSession_getClientData(session); - gc = pd->gc; - - esc = g_markup_escape_text(msg, -1); - serv_got_chat_in(gc, PLACE_TO_ID(place), who->user, 0, esc, time(NULL)); - g_free(esc); -} - - -static void mw_place_clear(struct mwServicePlace *srvc) { - ; -} - - -static struct mwPlaceHandler mw_place_handler = { - mw_place_opened, - mw_place_closed, - mw_place_peerJoined, - mw_place_peerParted, - mw_place_peerSetAttribute, - mw_place_peerUnsetAttribute, - mw_place_message, - mw_place_clear, -}; - - -static struct mwServicePlace *mw_srvc_place_new(struct mwSession *s) { - struct mwServicePlace *srvc; - srvc = mwServicePlace_new(s, &mw_place_handler); - return srvc; -} - - -static struct mwServiceResolve *mw_srvc_resolve_new(struct mwSession *s) { - struct mwServiceResolve *srvc; - srvc = mwServiceResolve_new(s); - return srvc; -} - - -static struct mwServiceStorage *mw_srvc_store_new(struct mwSession *s) { - struct mwServiceStorage *srvc; - srvc = mwServiceStorage_new(s); - return srvc; -} - - -/** allocate and associate a mwPurplePluginData with a PurpleConnection */ -static struct mwPurplePluginData *mwPurplePluginData_new(PurpleConnection *gc) { - struct mwPurplePluginData *pd; - - g_return_val_if_fail(gc != NULL, NULL); - - pd = g_new0(struct mwPurplePluginData, 1); - pd->gc = gc; - pd->session = mwSession_new(&mw_session_handler); - pd->srvc_aware = mw_srvc_aware_new(pd->session); - pd->srvc_conf = mw_srvc_conf_new(pd->session); - pd->srvc_ft = mw_srvc_ft_new(pd->session); - pd->srvc_im = mw_srvc_im_new(pd->session); - pd->srvc_place = mw_srvc_place_new(pd->session); - pd->srvc_resolve = mw_srvc_resolve_new(pd->session); - pd->srvc_store = mw_srvc_store_new(pd->session); - pd->group_list_map = g_hash_table_new(g_direct_hash, g_direct_equal); - pd->sock_buf = purple_circ_buffer_new(0); - - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_aware)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_conf)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_ft)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_im)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_place)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_resolve)); - mwSession_addService(pd->session, MW_SERVICE(pd->srvc_store)); - - mwSession_addCipher(pd->session, mwCipher_new_RC2_40(pd->session)); - mwSession_addCipher(pd->session, mwCipher_new_RC2_128(pd->session)); - - mwSession_setClientData(pd->session, pd, NULL); - gc->proto_data = pd; - - return pd; -} - - -static void mwPurplePluginData_free(struct mwPurplePluginData *pd) { - g_return_if_fail(pd != NULL); - - pd->gc->proto_data = NULL; - - mwSession_removeService(pd->session, mwService_AWARE); - mwSession_removeService(pd->session, mwService_CONFERENCE); - mwSession_removeService(pd->session, mwService_FILE_TRANSFER); - mwSession_removeService(pd->session, mwService_IM); - mwSession_removeService(pd->session, mwService_PLACE); - mwSession_removeService(pd->session, mwService_RESOLVE); - mwSession_removeService(pd->session, mwService_STORAGE); - - mwService_free(MW_SERVICE(pd->srvc_aware)); - mwService_free(MW_SERVICE(pd->srvc_conf)); - mwService_free(MW_SERVICE(pd->srvc_ft)); - mwService_free(MW_SERVICE(pd->srvc_im)); - mwService_free(MW_SERVICE(pd->srvc_place)); - mwService_free(MW_SERVICE(pd->srvc_resolve)); - mwService_free(MW_SERVICE(pd->srvc_store)); - - mwCipher_free(mwSession_getCipher(pd->session, mwCipher_RC2_40)); - mwCipher_free(mwSession_getCipher(pd->session, mwCipher_RC2_128)); - - mwSession_free(pd->session); - - g_hash_table_destroy(pd->group_list_map); - purple_circ_buffer_destroy(pd->sock_buf); - - g_free(pd); -} - - -static const char *mw_prpl_list_icon(PurpleAccount *a, PurpleBuddy *b) { - /* my little green dude is a chopped up version of the aim running - guy. First, cut off the head and store someplace safe. Then, - take the left-half side of the body and throw it away. Make a - copy of the remaining body, and flip it horizontally. Now attach - the two pieces into an X shape, and drop the head back on the - top, being careful to center it. Then, just change the color - saturation to bring the red down a bit, and voila! */ - - /* then, throw all of that away and use sodipodi to make a new - icon. You know, LIKE A REAL MAN. */ - - return "meanwhile"; -} - - -static const char* mw_prpl_list_emblem(PurpleBuddy *b) -{ - if(buddy_is_external(b)) - return "external"; - - return NULL; -} - - -static char *mw_prpl_status_text(PurpleBuddy *b) { - PurpleConnection *gc; - struct mwPurplePluginData *pd; - struct mwAwareIdBlock t = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; - const char *ret = NULL; - - if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) - ret = mwServiceAware_getText(pd->srvc_aware, &t); - - return (ret && g_utf8_validate(ret, -1, NULL)) ? g_markup_escape_text(ret, -1): NULL; -} - - -static const char *status_text(PurpleBuddy *b) { - PurplePresence *presence; - PurpleStatus *status; - - presence = purple_buddy_get_presence(b); - status = purple_presence_get_active_status(presence); - - return purple_status_get_name(status); -} - - -static gboolean user_supports(struct mwServiceAware *srvc, - const char *who, guint32 feature) { - - const struct mwAwareAttribute *attr; - struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; - - attr = mwServiceAware_getAttribute(srvc, &idb, feature); - return (attr != NULL) && mwAwareAttribute_asBoolean(attr); -} - - -static char *user_supports_text(struct mwServiceAware *srvc, const char *who) { - const char *feat[] = {NULL, NULL, NULL, NULL, NULL}; - const char **f = feat; - - if(user_supports(srvc, who, mwAttribute_AV_PREFS_SET)) { - gboolean mic, speak, video; - - mic = user_supports(srvc, who, mwAttribute_MICROPHONE); - speak = user_supports(srvc, who, mwAttribute_SPEAKERS); - video = user_supports(srvc, who, mwAttribute_VIDEO_CAMERA); - - if(mic) *f++ = _("Microphone"); - if(speak) *f++ = _("Speakers"); - if(video) *f++ = _("Video Camera"); - } - - if(user_supports(srvc, who, mwAttribute_FILE_TRANSFER)) - *f++ = _("File Transfer"); - - return (*feat)? g_strjoinv(", ", (char **)feat): NULL; - /* jenni loves siege */ -} - - -static void mw_prpl_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) { - PurpleConnection *gc; - struct mwPurplePluginData *pd = NULL; - struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(b), NULL }; - - const char *message = NULL; - const char *status; - char *tmp; - - if ((gc = purple_account_get_connection(purple_buddy_get_account(b))) - && (pd = gc->proto_data)) - message = mwServiceAware_getText(pd->srvc_aware, &idb); - - status = status_text(b); - - if(message != NULL && g_utf8_validate(message, -1, NULL) && purple_utf8_strcasecmp(status, message)) { - tmp = g_markup_escape_text(message, -1); - purple_notify_user_info_add_pair(user_info, status, tmp); - g_free(tmp); - - } else { - purple_notify_user_info_add_pair(user_info, _("Status"), status); - } - - if(full && pd != NULL) { - tmp = user_supports_text(pd->srvc_aware, purple_buddy_get_name(b)); - if(tmp) { - purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); - g_free(tmp); - } - - if(buddy_is_external(b)) { - purple_notify_user_info_add_pair(user_info, NULL, _("External User")); - } - } -} - -static GList *mw_prpl_status_types(PurpleAccount *acct) -{ - GList *types = NULL; - PurpleStatusType *type; - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, - MW_STATE_ACTIVE, NULL, TRUE, TRUE, FALSE, - MW_STATE_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, - MW_STATE_AWAY, NULL, TRUE, TRUE, FALSE, - MW_STATE_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, - MW_STATE_BUSY, _("Do Not Disturb"), TRUE, TRUE, FALSE, - MW_STATE_MESSAGE, _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, - MW_STATE_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - - -static void conf_create_prompt_cancel(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - ; /* nothing to do */ -} - - -static void conf_create_prompt_join(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - PurpleAccount *acct; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - struct mwServiceConference *srvc; - - PurpleRequestField *f; - - const char *topic, *invite; - struct mwConference *conf; - struct mwIdBlock idb = { NULL, NULL }; - - acct = purple_buddy_get_account(buddy); - gc = purple_account_get_connection(acct); - pd = gc->proto_data; - srvc = pd->srvc_conf; - - f = purple_request_fields_get_field(fields, CHAT_KEY_TOPIC); - topic = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, CHAT_KEY_INVITE); - invite = purple_request_field_string_get_value(f); - - conf = mwConference_new(srvc, topic); - mwConference_open(conf); - - idb.user = (char *)purple_buddy_get_name(buddy); - mwConference_invite(conf, &idb, invite); -} - - -static void blist_menu_conf_create(PurpleBuddy *buddy, const char *msg) { - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - - PurpleAccount *acct; - PurpleConnection *gc; - - const char *msgA; - const char *msgB; - char *msg1; - - g_return_if_fail(buddy != NULL); - - acct = purple_buddy_get_account(buddy); - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, g); - - f = purple_request_field_string_new(CHAT_KEY_TOPIC, _("Topic"), NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new(CHAT_KEY_INVITE, _("Message"), msg, FALSE); - purple_request_field_group_add_field(g, f); - - msgA = _("Create conference with user"); - msgB = _("Please enter a topic for the new conference, and an invitation" - " message to be sent to %s"); - msg1 = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); - - purple_request_fields(gc, _("New Conference"), - msgA, msg1, fields, - _("Create"), G_CALLBACK(conf_create_prompt_join), - _("Cancel"), G_CALLBACK(conf_create_prompt_cancel), - acct, purple_buddy_get_name(buddy), NULL, - buddy); - g_free(msg1); -} - - -static void conf_select_prompt_cancel(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - ; -} - - -static void conf_select_prompt_invite(PurpleBuddy *buddy, - PurpleRequestFields *fields) { - PurpleRequestField *f; - GList *l; - const char *msg; - - f = purple_request_fields_get_field(fields, CHAT_KEY_INVITE); - msg = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "conf"); - l = purple_request_field_list_get_selected(f); - - if(l) { - gpointer d = purple_request_field_list_get_data(f, l->data); - - if(GPOINTER_TO_INT(d) == 0x01) { - blist_menu_conf_create(buddy, msg); - - } else { - struct mwIdBlock idb = { (char *)purple_buddy_get_name(buddy), NULL }; - mwConference_invite(d, &idb, msg); - } - } -} - - -static void blist_menu_conf_list(PurpleBuddy *buddy, - GList *confs) { - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - - PurpleAccount *acct; - PurpleConnection *gc; - - const char *msgA; - const char *msgB; - char *msg; - - acct = purple_buddy_get_account(buddy); - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, g); - - f = purple_request_field_list_new("conf", _("Available Conferences")); - purple_request_field_list_set_multi_select(f, FALSE); - for(; confs; confs = confs->next) { - struct mwConference *c = confs->data; - purple_request_field_list_add(f, mwConference_getTitle(c), c); - } - purple_request_field_list_add(f, _("Create New Conference..."), - GINT_TO_POINTER(0x01)); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new(CHAT_KEY_INVITE, "Message", NULL, FALSE); - purple_request_field_group_add_field(g, f); - - msgA = _("Invite user to a conference"); - msgB = _("Select a conference from the list below to send an invite to" - " user %s. Select \"Create New Conference\" if you'd like to" - " create a new conference to invite this user to."); - msg = g_strdup_printf(msgB, purple_buddy_get_name(buddy)); - - purple_request_fields(gc, _("Invite to Conference"), - msgA, msg, fields, - _("Invite"), G_CALLBACK(conf_select_prompt_invite), - _("Cancel"), G_CALLBACK(conf_select_prompt_cancel), - acct, purple_buddy_get_name(buddy), NULL, - buddy); - g_free(msg); -} - - -static void blist_menu_conf(PurpleBlistNode *node, gpointer data) { - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleAccount *acct; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - GList *l; - - g_return_if_fail(node != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - acct = purple_buddy_get_account(buddy); - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* - - get a list of all conferences on this session - - if none, prompt to create one, and invite buddy to it - - else, prompt to select a conference or create one - */ - - l = mwServiceConference_getConferences(pd->srvc_conf); - if(l) { - blist_menu_conf_list(buddy, l); - g_list_free(l); - - } else { - blist_menu_conf_create(buddy, NULL); - } -} - - -#if 0 -static void blist_menu_announce(PurpleBlistNode *node, gpointer data) { - PurpleBuddy *buddy = (PurpleBuddy *) node; - PurpleAccount *acct; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - struct mwSession *session; - char *rcpt_name; - GList *rcpt; - - g_return_if_fail(node != NULL); - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - acct = buddy->account; - g_return_if_fail(acct != NULL); - - gc = purple_account_get_connection(acct); - g_return_if_fail(gc != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - rcpt_name = g_strdup_printf("@U %s", buddy->name); - rcpt = g_list_prepend(NULL, rcpt_name); - - session = pd->session; - mwSession_sendAnnounce(session, FALSE, - "This is a TEST announcement. Please ignore.", - rcpt); - - g_list_free(rcpt); - g_free(rcpt_name); -} -#endif - - -static GList *mw_prpl_blist_node_menu(PurpleBlistNode *node) { - GList *l = NULL; - PurpleMenuAction *act; - - if(! PURPLE_BLIST_NODE_IS_BUDDY(node)) - return l; - - l = g_list_append(l, NULL); - - act = purple_menu_action_new(_("Invite to Conference..."), - PURPLE_CALLBACK(blist_menu_conf), NULL, NULL); - l = g_list_append(l, act); - -#if 0 - act = purple_menu_action_new(_("Send TEST Announcement"), - PURPLE_CALLBACK(blist_menu_announce), NULL, NULL); - l = g_list_append(l, act); -#endif - - /** note: this never gets called for a PurpleGroup, have to use the - blist-node-extended-menu signal for that. The function - blist_node_menu_cb is assigned to this signal in the function - services_starting */ - - return l; -} - - -static GList *mw_prpl_chat_info(PurpleConnection *gc) { - GList *l = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("Topic:"); - pce->identifier = CHAT_KEY_TOPIC; - l = g_list_append(l, pce); - - return l; -} - - -static GHashTable *mw_prpl_chat_info_defaults(PurpleConnection *gc, - const char *name) { - GHashTable *table; - - g_return_val_if_fail(gc != NULL, NULL); - - table = g_hash_table_new_full(g_str_hash, g_str_equal, - NULL, g_free); - - g_hash_table_insert(table, CHAT_KEY_NAME, g_strdup(name)); - g_hash_table_insert(table, CHAT_KEY_INVITE, NULL); - - return table; -} - - -static void mw_prpl_login(PurpleAccount *acct); - - -static void prompt_host_cancel_cb(PurpleConnection *gc) { - const char *msg = _("No Sametime Community Server specified"); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - msg); -} - - -static void prompt_host_ok_cb(PurpleConnection *gc, const char *host) { - if(host && *host) { - PurpleAccount *acct = purple_connection_get_account(gc); - purple_account_set_string(acct, MW_KEY_HOST, host); - mw_prpl_login(acct); - - } else { - prompt_host_cancel_cb(gc); - } -} - - -static void prompt_host(PurpleConnection *gc) { - PurpleAccount *acct; - const char *msgA; - char *msg; - - acct = purple_connection_get_account(gc); - msgA = _("No host or IP address has been configured for the" - " Meanwhile account %s. Please enter one below to" - " continue logging in."); - msg = g_strdup_printf(msgA, NSTR(purple_account_get_username(acct))); - - purple_request_input(gc, _("Meanwhile Connection Setup"), - _("No Sametime Community Server Specified"), msg, - MW_PLUGIN_DEFAULT_HOST, FALSE, FALSE, NULL, - _("Connect"), G_CALLBACK(prompt_host_ok_cb), - _("Cancel"), G_CALLBACK(prompt_host_cancel_cb), - acct, NULL, NULL, - gc); - - g_free(msg); -} - - -static void mw_prpl_login(PurpleAccount *account) { - PurpleConnection *gc; - struct mwPurplePluginData *pd; - - char *user, *pass, *host; - guint port; - - gc = purple_account_get_connection(account); - pd = mwPurplePluginData_new(gc); - - /* while we do support images, the default is to not offer it */ - gc->flags |= PURPLE_CONNECTION_NO_IMAGES; - - user = g_strdup(purple_account_get_username(account)); - - host = strrchr(user, ':'); - if(host) { - /* annoying user split from 1.2.0, need to undo it */ - *host++ = '\0'; - purple_account_set_string(account, MW_KEY_HOST, host); - purple_account_set_username(account, user); - - } else { - host = (char *) purple_account_get_string(account, MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - } - - if(! host || ! *host) { - /* somehow, we don't have a host to connect to. Well, we need one - to actually continue, so let's ask the user directly. */ - g_free(user); - prompt_host(gc); - return; - } - - pass = g_strdup(purple_account_get_password(account)); - port = purple_account_get_int(account, MW_KEY_PORT, MW_PLUGIN_DEFAULT_PORT); - - DEBUG_INFO("user: '%s'\n", user); - DEBUG_INFO("host: '%s'\n", host); - DEBUG_INFO("port: %u\n", port); - - mwSession_setProperty(pd->session, mwSession_NO_SECRET, - (char *) no_secret, NULL); - mwSession_setProperty(pd->session, mwSession_AUTH_USER_ID, user, g_free); - mwSession_setProperty(pd->session, mwSession_AUTH_PASSWORD, pass, g_free); - - if(purple_account_get_bool(account, MW_KEY_FAKE_IT, FALSE)) { - guint client, major, minor; - - /* if we're faking the login, let's also fake the version we're - reporting. Let's also allow the actual values to be specified */ - - client = purple_account_get_int(account, MW_KEY_CLIENT, mwLogin_BINARY); - major = purple_account_get_int(account, MW_KEY_MAJOR, 0x001e); - minor = purple_account_get_int(account, MW_KEY_MINOR, 0x196f); - - DEBUG_INFO("client id: 0x%04x\n", client); - DEBUG_INFO("client major: 0x%04x\n", major); - DEBUG_INFO("client minor: 0x%04x\n", minor); - - mwSession_setProperty(pd->session, mwSession_CLIENT_TYPE_ID, - GUINT_TO_POINTER(client), NULL); - - mwSession_setProperty(pd->session, mwSession_CLIENT_VER_MAJOR, - GUINT_TO_POINTER(major), NULL); - - mwSession_setProperty(pd->session, mwSession_CLIENT_VER_MINOR, - GUINT_TO_POINTER(minor), NULL); - } - - purple_connection_update_progress(gc, _("Connecting"), 1, MW_CONNECT_STEPS); - - if (purple_proxy_connect(gc, account, host, port, connect_cb, pd) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } -} - - -static void mw_prpl_close(PurpleConnection *gc) { - struct mwPurplePluginData *pd; - - g_return_if_fail(gc != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* get rid of the blist save timeout */ - if(pd->save_event) { - purple_timeout_remove(pd->save_event); - pd->save_event = 0; - blist_store(pd); - } - - /* stop the session */ - mwSession_stop(pd->session, 0x00); - - /* no longer necessary */ - gc->proto_data = NULL; - - /* stop watching the socket */ - if(gc->inpa) { - purple_input_remove(gc->inpa); - gc->inpa = 0; - } - - /* clean up the rest */ - mwPurplePluginData_free(pd); -} - - -static int mw_rand(void) { - static int seed = 0; - - /* for diversity, not security. don't touch */ - srand(time(NULL) ^ seed); - seed = rand(); - - return seed; -} - - -/** generates a random-ish content id string */ -static char *im_mime_content_id(void) { - return g_strdup_printf("%03x@%05xmeanwhile", - mw_rand() & 0xfff, mw_rand() & 0xfffff); -} - - -/** generates a multipart/related content type with a random-ish - boundary value */ -static char *im_mime_content_type(void) { - return g_strdup_printf("multipart/related; boundary=related_MW%03x_%04x", - mw_rand() & 0xfff, mw_rand() & 0xffff); -} - - -/** determine content type from extension. Not so happy about this, - but I don't want to actually write image type detection */ -static char *im_mime_img_content_type(PurpleStoredImage *img) { - const char *fn = purple_imgstore_get_filename(img); - const char *ct = NULL; - - ct = strrchr(fn, '.'); - if(! ct) { - ct = "image"; - - } else if(! strcmp(".png", ct)) { - ct = "image/png"; - - } else if(! strcmp(".jpg", ct)) { - ct = "image/jpeg"; - - } else if(! strcmp(".jpeg", ct)) { - ct = "image/jpeg"; - - } else if(! strcmp(".gif", ct)) { - ct = "image/gif"; - - } else { - ct = "image"; - } - - return g_strdup_printf("%s; name=\"%s\"", ct, fn); -} - - -static char *im_mime_img_content_disp(PurpleStoredImage *img) { - const char *fn = purple_imgstore_get_filename(img); - return g_strdup_printf("attachment; filename=\"%s\"", fn); -} - - -/** turn an IM with embedded images into a multi-part mime document */ -static char *im_mime_convert(PurpleConnection *gc, - struct mwConversation *conv, - const char *message) { - GString *str; - PurpleMimeDocument *doc; - PurpleMimePart *part; - - GData *attr; - char *tmp, *start, *end; - - str = g_string_new(NULL); - - doc = purple_mime_document_new(); - - purple_mime_document_set_field(doc, "Mime-Version", "1.0"); - purple_mime_document_set_field(doc, "Content-Disposition", "inline"); - - tmp = im_mime_content_type(); - purple_mime_document_set_field(doc, "Content-Type", tmp); - g_free(tmp); - - tmp = (char *) message; - while(*tmp && purple_markup_find_tag("img", tmp, (const char **) &start, - (const char **) &end, &attr)) { - char *id; - PurpleStoredImage *img = NULL; - - gsize len = (start - tmp); - - /* append the in-between-tags text */ - if(len) g_string_append_len(str, tmp, len); - - /* find the imgstore data by the id tag */ - id = g_datalist_get_data(&attr, "id"); - if(id && *id) - img = purple_imgstore_find_by_id(atoi(id)); - - if(img) { - char *cid; - gpointer data; - size_t size; - - part = purple_mime_part_new(doc); - - data = im_mime_img_content_disp(img); - purple_mime_part_set_field(part, "Content-Disposition", data); - g_free(data); - - data = im_mime_img_content_type(img); - purple_mime_part_set_field(part, "Content-Type", data); - g_free(data); - - cid = im_mime_content_id(); - data = g_strdup_printf("<%s>", cid); - purple_mime_part_set_field(part, "Content-ID", data); - g_free(data); - - purple_mime_part_set_field(part, "Content-transfer-encoding", "base64"); - - /* obtain and base64 encode the image data, and put it in the - mime part */ - size = purple_imgstore_get_size(img); - data = purple_base64_encode(purple_imgstore_get_data(img), (gsize) size); - purple_mime_part_set_data(part, data); - g_free(data); - - /* append the modified tag */ - g_string_append_printf(str, "", cid); - g_free(cid); - - } else { - /* append the literal image tag, since we couldn't find a - relative imgstore object */ - gsize len = (end - start) + 1; - g_string_append_len(str, start, len); - } - - g_datalist_clear(&attr); - tmp = end + 1; - } - - /* append left-overs */ - g_string_append(str, tmp); - - /* add the text/html part */ - part = purple_mime_part_new(doc); - purple_mime_part_set_field(part, "Content-Disposition", "inline"); - - tmp = purple_utf8_ncr_encode(str->str); - purple_mime_part_set_field(part, "Content-Type", "text/html"); - purple_mime_part_set_field(part, "Content-Transfer-Encoding", "7bit"); - purple_mime_part_set_data(part, tmp); - g_free(tmp); - - g_string_free(str, TRUE); - - str = g_string_new(NULL); - purple_mime_document_write(doc, str); - tmp = str->str; - g_string_free(str, FALSE); - - return tmp; -} - - -static int mw_prpl_send_im(PurpleConnection *gc, - const char *name, - const char *message, - PurpleMessageFlags flags) { - - struct mwPurplePluginData *pd; - struct mwIdBlock who = { (char *) name, NULL }; - struct mwConversation *conv; - - g_return_val_if_fail(gc != NULL, 0); - pd = gc->proto_data; - - g_return_val_if_fail(pd != NULL, 0); - - conv = mwServiceIm_getConversation(pd->srvc_im, &who); - - /* this detection of features to determine how to send the message - (plain, html, or mime) is flawed because the other end of the - conversation could close their channel at any time, rendering any - existing formatting in an outgoing message innapropriate. The end - result is that it may be possible that the other side of the - conversation will receive a plaintext message with html contents, - which is bad. I'm not sure how to fix this correctly. */ - - if(strstr(message, "proto_data; - - g_return_val_if_fail(pd != NULL, 0); - - conv = mwServiceIm_getConversation(pd->srvc_im, &who); - - if(mwConversation_isOpen(conv)) { - mwConversation_send(conv, mwImSend_TYPING, t); - - } else if((state == PURPLE_TYPING) || (state == PURPLE_TYPED)) { - /* only open a channel for sending typing notification, not for - when typing has stopped. There's no point in re-opening a - channel just to tell someone that this side isn't typing. */ - - convo_queue(conv, mwImSend_TYPING, t); - - if(! mwConversation_isPending(conv)) { - mwConversation_open(conv); - } - } - - return 0; -} - - -static const char *mw_client_name(guint16 type) { - switch(type) { - case mwLogin_LIB: - return "Lotus Binary Library"; - - case mwLogin_JAVA_WEB: - return "Lotus Java Client Applet"; - - case mwLogin_BINARY: - return "Lotus Sametime Connect"; - - case mwLogin_JAVA_APP: - return "Lotus Java Client Application"; - - case mwLogin_LINKS: - return "Lotus Sametime Links"; - - case mwLogin_NOTES_6_5: - case mwLogin_NOTES_6_5_3: - case mwLogin_NOTES_7_0_beta: - case mwLogin_NOTES_7_0: - return "Lotus Notes Client"; - - case mwLogin_ICT: - case mwLogin_ICT_1_7_8_2: - case mwLogin_ICT_SIP: - return "IBM Community Tools"; - - case mwLogin_NOTESBUDDY_4_14: - case mwLogin_NOTESBUDDY_4_15: - case mwLogin_NOTESBUDDY_4_16: - return "Alphaworks NotesBuddy"; - - case 0x1305: - case 0x1306: - case 0x1307: - return "Lotus Sametime Connect 7.5"; - - case mwLogin_SANITY: - return "Sanity"; - - case mwLogin_ST_PERL: - return "ST-Send-Message"; - - case mwLogin_TRILLIAN: - case mwLogin_TRILLIAN_IBM: - return "Trillian"; - - case mwLogin_MEANWHILE: - return "Meanwhile"; - - default: - return NULL; - } -} - - -static void mw_prpl_get_info(PurpleConnection *gc, const char *who) { - - struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; - - struct mwPurplePluginData *pd; - PurpleAccount *acct; - PurpleBuddy *b; - PurpleNotifyUserInfo *user_info; - char *tmp; - const char *tmp2; - - g_return_if_fail(who != NULL); - g_return_if_fail(*who != '\0'); - - pd = gc->proto_data; - - acct = purple_connection_get_account(gc); - b = purple_find_buddy(acct, who); - user_info = purple_notify_user_info_new(); - - if(purple_str_has_prefix(who, "@E ")) { - purple_notify_user_info_add_pair(user_info, _("External User"), NULL); - } - - purple_notify_user_info_add_pair(user_info, _("User ID"), who); - - if(b) { - guint32 type; - - if(purple_buddy_get_server_alias(b)) { - purple_notify_user_info_add_pair(user_info, _("Full Name"), purple_buddy_get_server_alias(b)); - } - - type = purple_blist_node_get_int((PurpleBlistNode *) b, BUDDY_KEY_CLIENT); - if(type) { - tmp = g_strdup(mw_client_name(type)); - if (!tmp) - tmp = g_strdup_printf(_("Unknown (0x%04x)
"), type); - - purple_notify_user_info_add_pair(user_info, _("Last Known Client"), tmp); - - g_free(tmp); - } - } - - tmp = user_supports_text(pd->srvc_aware, who); - if(tmp) { - purple_notify_user_info_add_pair(user_info, _("Supports"), tmp); - g_free(tmp); - } - - if(b) { - purple_notify_user_info_add_pair(user_info, _("Status"), status_text(b)); - - /* XXX Is this adding a status message in its own section rather than with the "Status" label? */ - tmp2 = mwServiceAware_getText(pd->srvc_aware, &idb); - if(tmp2 && g_utf8_validate(tmp2, -1, NULL)) { - tmp = g_markup_escape_text(tmp2, -1); - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - } - } - - /* @todo emit a signal to allow a plugin to override the display of - this notification, so that it can create its own */ - - purple_notify_userinfo(gc, who, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); -} - - -static void mw_prpl_set_status(PurpleAccount *acct, PurpleStatus *status) { - PurpleConnection *gc; - const char *state; - char *message = NULL; - struct mwSession *session; - struct mwUserStatus stat; - - g_return_if_fail(acct != NULL); - gc = purple_account_get_connection(acct); - - state = purple_status_get_id(status); - - DEBUG_INFO("Set status to %s\n", purple_status_get_name(status)); - - g_return_if_fail(gc != NULL); - - session = gc_to_session(gc); - g_return_if_fail(session != NULL); - - /* get a working copy of the current status */ - mwUserStatus_clone(&stat, mwSession_getUserStatus(session)); - - /* determine the state */ - if(! strcmp(state, MW_STATE_ACTIVE)) { - stat.status = mwStatus_ACTIVE; - - } else if(! strcmp(state, MW_STATE_AWAY)) { - stat.status = mwStatus_AWAY; - - } else if(! strcmp(state, MW_STATE_BUSY)) { - stat.status = mwStatus_BUSY; - } - - /* determine the message */ - message = (char *) purple_status_get_attr_string(status, MW_STATE_MESSAGE); - - if(message) { - /* all the possible non-NULL values of message up to this point - are const, so we don't need to free them */ - message = purple_markup_strip_html(message); - } - - /* out with the old */ - g_free(stat.desc); - - /* in with the new */ - stat.desc = (char *) message; - - mwSession_setUserStatus(session, &stat); - mwUserStatus_clear(&stat); -} - - -static void mw_prpl_set_idle(PurpleConnection *gc, int t) { - struct mwSession *session; - struct mwUserStatus stat; - - - session = gc_to_session(gc); - g_return_if_fail(session != NULL); - - mwUserStatus_clone(&stat, mwSession_getUserStatus(session)); - - if(t) { - time_t now = time(NULL); - stat.time = now - t; - - } else { - stat.time = 0; - } - - if(t > 0 && stat.status == mwStatus_ACTIVE) { - /* we were active and went idle, so change the status to IDLE. */ - stat.status = mwStatus_IDLE; - - } else if(t == 0 && stat.status == mwStatus_IDLE) { - /* we only become idle automatically, so change back to ACTIVE */ - stat.status = mwStatus_ACTIVE; - } - - mwSession_setUserStatus(session, &stat); - mwUserStatus_clear(&stat); -} - - -static void notify_im(PurpleConnection *gc, GList *row, void *user_data) { - PurpleAccount *acct; - PurpleConversation *conv; - char *id; - - acct = purple_connection_get_account(gc); - id = g_list_nth_data(row, 1); - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, id, acct); - if(! conv) conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, id); - purple_conversation_present(conv); -} - - -static void notify_add(PurpleConnection *gc, GList *row, void *user_data) { - BuddyAddData *data = user_data; - const char *group_name = NULL; - - if (data && data->group) { - group_name = purple_group_get_name(data->group); - } - - purple_blist_request_add_buddy(purple_connection_get_account(gc), - g_list_nth_data(row, 1), group_name, - g_list_nth_data(row, 0)); -} - - -static void notify_close(gpointer data) { - if (data) { - g_free(data); - } -} - - -static void multi_resolved_query(struct mwResolveResult *result, - PurpleConnection *gc, gpointer data) { - GList *l; - const char *msgA; - const char *msgB; - char *msg; - - PurpleNotifySearchResults *sres; - PurpleNotifySearchColumn *scol; - - sres = purple_notify_searchresults_new(); - - scol = purple_notify_searchresults_column_new(_("User Name")); - purple_notify_searchresults_column_add(sres, scol); - - scol = purple_notify_searchresults_column_new(_("Sametime ID")); - purple_notify_searchresults_column_add(sres, scol); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_IM, - notify_im); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_ADD, - notify_add); - - for(l = result->matches; l; l = l->next) { - struct mwResolveMatch *match = l->data; - GList *row = NULL; - - DEBUG_INFO("multi resolve: %s, %s\n", - NSTR(match->id), NSTR(match->name)); - - if(!match->id || !match->name) - continue; - - row = g_list_append(row, g_strdup(match->name)); - row = g_list_append(row, g_strdup(match->id)); - purple_notify_searchresults_row_add(sres, row); - } - - msgA = _("An ambiguous user ID was entered"); - msgB = _("The identifier '%s' may possibly refer to any of the following" - " users. Please select the correct user from the list below to" - " add them to your buddy list."); - msg = g_strdup_printf(msgB, result->name); - - purple_notify_searchresults(gc, _("Select User"), - msgA, msg, sres, notify_close, data); - - g_free(msg); -} - - -static void add_buddy_resolved(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer b) { - - struct mwResolveResult *res = NULL; - BuddyAddData *data = b; - PurpleBuddy *buddy = NULL; - PurpleConnection *gc; - struct mwPurplePluginData *pd; - - g_return_if_fail(data != NULL); - - buddy = data->buddy; - - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - pd = gc->proto_data; - - if(results) - res = results->data; - - if(!code && res && res->matches) { - if(!res->matches->next) { - struct mwResolveMatch *match = res->matches->data; - - /* only one? that might be the right one! */ - if(strcmp(res->name, match->id)) { - /* uh oh, the single result isn't identical to the search - term, better safe then sorry, so let's make sure it's who - the user meant to add */ - purple_blist_remove_buddy(buddy); - multi_resolved_query(res, gc, data); - - } else { - - /* same person, set the server alias */ - purple_blist_server_alias_buddy(buddy, match->name); - purple_blist_node_set_string((PurpleBlistNode *) buddy, - BUDDY_KEY_NAME, match->name); - - /* subscribe to awareness */ - buddy_add(pd, buddy); - - blist_schedule(pd); - - g_free(data); - } - - } else { - /* prompt user if more than one match was returned */ - purple_blist_remove_buddy(buddy); - multi_resolved_query(res, gc, data); - } - - return; - } - -#if 0 - /* fall-through indicates that we couldn't find a matching user in - the resolve service (ether error or zero results), so we remove - this buddy */ - - /* note: I can't really think of a good reason to alter the buddy - list in any way. There has been at least one report where the - resolve service isn't returning correct results anyway, so let's - just leave them in the list. I'm just going to if0 this section - out unless I can think of a very good reason to do this. -siege */ - - DEBUG_INFO("no such buddy in community\n"); - purple_blist_remove_buddy(buddy); - blist_schedule(pd); - - if(res && res->name) { - /* compose and display an error message */ - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("Unable to add user: user not found"); - - msgB = _("The identifier '%s' did not match any users in your" - " Sametime community. This entry has been removed from" - " your buddy list."); - msg = g_strdup_printf(msgB, NSTR(res->name)); - - purple_notify_error(gc, _("Unable to add user"), msgA, msg); - - g_free(msg); - } -#endif -} - - -static void mw_prpl_add_buddy(PurpleConnection *gc, - PurpleBuddy *buddy, - PurpleGroup *group) { - - struct mwPurplePluginData *pd = gc->proto_data; - struct mwServiceResolve *srvc; - GList *query; - enum mwResolveFlag flags; - guint32 req; - BuddyAddData *data; - - /* catch external buddies. They won't be in the resolve service */ - if(buddy_is_external(buddy)) { - buddy_add(pd, buddy); - return; - } - - data = g_new0(BuddyAddData, 1); - data->buddy = buddy; - data->group = group; - - srvc = pd->srvc_resolve; - - query = g_list_prepend(NULL, (char *)purple_buddy_get_name(buddy)); - flags = mwResolveFlag_FIRST | mwResolveFlag_USERS; - - req = mwServiceResolve_resolve(srvc, query, flags, add_buddy_resolved, - data, NULL); - g_list_free(query); - - if(req == SEARCH_ERROR) { - purple_blist_remove_buddy(buddy); - blist_schedule(pd); - } -} - - -static void foreach_add_buddies(PurpleGroup *group, GList *buddies, - struct mwPurplePluginData *pd) { - struct mwAwareList *list; - - list = list_ensure(pd, group); - mwAwareList_addAware(list, buddies); - g_list_free(buddies); -} - - -static void mw_prpl_add_buddies(PurpleConnection *gc, - GList *buddies, - GList *groups) { - - struct mwPurplePluginData *pd; - GHashTable *group_sets; - struct mwAwareIdBlock *idbs, *idb; - - pd = gc->proto_data; - - /* map PurpleGroup:GList of mwAwareIdBlock */ - group_sets = g_hash_table_new(g_direct_hash, g_direct_equal); - - /* bunch of mwAwareIdBlock allocated at once, free'd at once */ - idb = idbs = g_new(struct mwAwareIdBlock, g_list_length(buddies)); - - /* first pass collects mwAwareIdBlock lists for each group */ - for(; buddies; buddies = buddies->next) { - PurpleBuddy *b = buddies->data; - PurpleGroup *g; - const char *fn; - GList *l; - - /* nab the saved server alias and stick it on the buddy */ - fn = purple_blist_node_get_string((PurpleBlistNode *) b, BUDDY_KEY_NAME); - purple_blist_server_alias_buddy(b, fn); - - /* convert PurpleBuddy into a mwAwareIdBlock */ - idb->type = mwAware_USER; - idb->user = (char *) purple_buddy_get_name(b); - idb->community = NULL; - - /* put idb into the list associated with the buddy's group */ - g = purple_buddy_get_group(b); - l = g_hash_table_lookup(group_sets, g); - l = g_list_prepend(l, idb++); - g_hash_table_insert(group_sets, g, l); - } - - /* each group's buddies get added in one shot, and schedule the blist - for saving */ - g_hash_table_foreach(group_sets, (GHFunc) foreach_add_buddies, pd); - blist_schedule(pd); - - /* cleanup */ - g_hash_table_destroy(group_sets); - g_free(idbs); -} - - -static void mw_prpl_remove_buddy(PurpleConnection *gc, - PurpleBuddy *buddy, PurpleGroup *group) { - - struct mwPurplePluginData *pd; - struct mwAwareIdBlock idb = { mwAware_USER, (char *)purple_buddy_get_name(buddy), NULL }; - struct mwAwareList *list; - - GList *rem = g_list_prepend(NULL, &idb); - - pd = gc->proto_data; - group = purple_buddy_get_group(buddy); - list = list_ensure(pd, group); - - mwAwareList_removeAware(list, rem); - blist_schedule(pd); - - g_list_free(rem); -} - - -static void privacy_fill(struct mwPrivacyInfo *priv, - GSList *members) { - - struct mwUserItem *u; - guint count; - - count = g_slist_length(members); - DEBUG_INFO("privacy_fill: %u members\n", count); - - priv->count = count; - priv->users = g_new0(struct mwUserItem, count); - - while(count--) { - u = priv->users + count; - u->id = members->data; - members = members->next; - } -} - - -static void mw_prpl_set_permit_deny(PurpleConnection *gc) { - PurpleAccount *acct; - struct mwPurplePluginData *pd; - struct mwSession *session; - - struct mwPrivacyInfo privacy = { - FALSE, /* deny */ - 0, /* count */ - NULL, /* users */ - }; - - g_return_if_fail(gc != NULL); - - acct = purple_connection_get_account(gc); - g_return_if_fail(acct != NULL); - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - session = pd->session; - g_return_if_fail(session != NULL); - - switch(acct->perm_deny) { - case PURPLE_PRIVACY_DENY_USERS: - DEBUG_INFO("PURPLE_PRIVACY_DENY_USERS\n"); - privacy_fill(&privacy, acct->deny); - privacy.deny = TRUE; - break; - - case PURPLE_PRIVACY_ALLOW_ALL: - DEBUG_INFO("PURPLE_PRIVACY_ALLOW_ALL\n"); - privacy.deny = TRUE; - break; - - case PURPLE_PRIVACY_ALLOW_USERS: - DEBUG_INFO("PURPLE_PRIVACY_ALLOW_USERS\n"); - privacy_fill(&privacy, acct->permit); - privacy.deny = FALSE; - break; - - case PURPLE_PRIVACY_DENY_ALL: - DEBUG_INFO("PURPLE_PRIVACY_DENY_ALL\n"); - privacy.deny = FALSE; - break; - - default: - DEBUG_INFO("acct->perm_deny is 0x%x\n", acct->perm_deny); - return; - } - - mwSession_setPrivacyInfo(session, &privacy); - g_free(privacy.users); -} - - -static void mw_prpl_add_permit(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static void mw_prpl_add_deny(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static void mw_prpl_rem_permit(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static void mw_prpl_rem_deny(PurpleConnection *gc, const char *name) { - mw_prpl_set_permit_deny(gc); -} - - -static struct mwConference *conf_find(struct mwServiceConference *srvc, - const char *name) { - GList *l, *ll; - struct mwConference *conf = NULL; - - ll = mwServiceConference_getConferences(srvc); - for(l = ll; l; l = l->next) { - struct mwConference *c = l->data; - if(! strcmp(name, mwConference_getName(c))) { - conf = c; - break; - } - } - g_list_free(ll); - - return conf; -} - - -static void mw_prpl_join_chat(PurpleConnection *gc, - GHashTable *components) { - - struct mwPurplePluginData *pd; - char *c, *t; - - pd = gc->proto_data; - - c = g_hash_table_lookup(components, CHAT_KEY_NAME); - t = g_hash_table_lookup(components, CHAT_KEY_TOPIC); - - if(g_hash_table_lookup(components, CHAT_KEY_IS_PLACE)) { - /* use place service */ - struct mwServicePlace *srvc; - struct mwPlace *place = NULL; - - srvc = pd->srvc_place; - place = mwPlace_new(srvc, c, t); - mwPlace_open(place); - - } else { - /* use conference service */ - struct mwServiceConference *srvc; - struct mwConference *conf = NULL; - - srvc = pd->srvc_conf; - if(c) conf = conf_find(srvc, c); - - if(conf) { - DEBUG_INFO("accepting conference invitation\n"); - mwConference_accept(conf); - - } else { - DEBUG_INFO("creating new conference\n"); - conf = mwConference_new(srvc, t); - mwConference_open(conf); - } - } -} - - -static void mw_prpl_reject_chat(PurpleConnection *gc, - GHashTable *components) { - - struct mwPurplePluginData *pd; - struct mwServiceConference *srvc; - char *c; - - pd = gc->proto_data; - srvc = pd->srvc_conf; - - if(g_hash_table_lookup(components, CHAT_KEY_IS_PLACE)) { - ; /* nothing needs doing */ - - } else { - /* reject conference */ - c = g_hash_table_lookup(components, CHAT_KEY_NAME); - if(c) { - struct mwConference *conf = conf_find(srvc, c); - if(conf) mwConference_reject(conf, ERR_SUCCESS, "Declined"); - } - } -} - - -static char *mw_prpl_get_chat_name(GHashTable *components) { - return g_hash_table_lookup(components, CHAT_KEY_NAME); -} - - -static void mw_prpl_chat_invite(PurpleConnection *gc, - int id, - const char *invitation, - const char *who) { - - struct mwPurplePluginData *pd; - struct mwConference *conf; - struct mwPlace *place; - struct mwIdBlock idb = { (char *) who, NULL }; - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - conf = ID_TO_CONF(pd, id); - - if(conf) { - mwConference_invite(conf, &idb, invitation); - return; - } - - place = ID_TO_PLACE(pd, id); - g_return_if_fail(place != NULL); - - /* @todo: use the IM service for invitation */ - mwPlace_legacyInvite(place, &idb, invitation); -} - - -static void mw_prpl_chat_leave(PurpleConnection *gc, - int id) { - - struct mwPurplePluginData *pd; - struct mwConference *conf; - - pd = gc->proto_data; - - g_return_if_fail(pd != NULL); - conf = ID_TO_CONF(pd, id); - - if(conf) { - mwConference_destroy(conf, ERR_SUCCESS, "Leaving"); - - } else { - struct mwPlace *place = ID_TO_PLACE(pd, id); - g_return_if_fail(place != NULL); - - mwPlace_destroy(place, ERR_SUCCESS); - } -} - - -static void mw_prpl_chat_whisper(PurpleConnection *gc, - int id, - const char *who, - const char *message) { - - mw_prpl_send_im(gc, who, message, 0); -} - - -static int mw_prpl_chat_send(PurpleConnection *gc, - int id, - const char *message, - PurpleMessageFlags flags) { - - struct mwPurplePluginData *pd; - struct mwConference *conf; - char *msg; - int ret; - - pd = gc->proto_data; - - g_return_val_if_fail(pd != NULL, 0); - conf = ID_TO_CONF(pd, id); - - msg = purple_markup_strip_html(message); - - if(conf) { - ret = ! mwConference_sendText(conf, msg); - - } else { - struct mwPlace *place = ID_TO_PLACE(pd, id); - g_return_val_if_fail(place != NULL, 0); - - ret = ! mwPlace_sendText(place, msg); - } - - g_free(msg); - return ret; -} - - -static void mw_prpl_keepalive(PurpleConnection *gc) { - struct mwSession *session; - - g_return_if_fail(gc != NULL); - - session = gc_to_session(gc); - g_return_if_fail(session != NULL); - - mwSession_sendKeepalive(session); -} - - -static void mw_prpl_alias_buddy(PurpleConnection *gc, - const char *who, - const char *alias) { - - struct mwPurplePluginData *pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* it's a change to the buddy list, so we've gotta reflect that in - the server copy */ - - blist_schedule(pd); -} - - -static void mw_prpl_group_buddy(PurpleConnection *gc, - const char *who, - const char *old_group, - const char *new_group) { - - struct mwAwareIdBlock idb = { mwAware_USER, (char *) who, NULL }; - GList *gl = g_list_prepend(NULL, &idb); - - struct mwPurplePluginData *pd = gc->proto_data; - PurpleGroup *group; - struct mwAwareList *list; - - /* add who to new_group's aware list */ - group = purple_find_group(new_group); - list = list_ensure(pd, group); - mwAwareList_addAware(list, gl); - - /* remove who from old_group's aware list */ - group = purple_find_group(old_group); - list = list_ensure(pd, group); - mwAwareList_removeAware(list, gl); - - g_list_free(gl); - - /* schedule the changes to be saved */ - blist_schedule(pd); -} - - -static void mw_prpl_rename_group(PurpleConnection *gc, - const char *old, - PurpleGroup *group, - GList *buddies) { - - struct mwPurplePluginData *pd = gc->proto_data; - g_return_if_fail(pd != NULL); - - /* it's a change in the buddy list, so we've gotta reflect that in - the server copy. Also, having this function should prevent all - those buddies from being removed and re-added. We don't really - give a crap what the group is named in Purple other than to record - that as the group name/alias */ - - blist_schedule(pd); -} - - -static void mw_prpl_buddy_free(PurpleBuddy *buddy) { - /* I don't think we have any cleanup for buddies yet */ - ; -} - - -static void mw_prpl_convo_closed(PurpleConnection *gc, const char *who) { - struct mwPurplePluginData *pd = gc->proto_data; - struct mwServiceIm *srvc; - struct mwConversation *conv; - struct mwIdBlock idb = { (char *) who, NULL }; - - g_return_if_fail(pd != NULL); - - srvc = pd->srvc_im; - g_return_if_fail(srvc != NULL); - - conv = mwServiceIm_findConversation(srvc, &idb); - if(! conv) return; - - if(mwConversation_isOpen(conv)) - mwConversation_free(conv); -} - - -static const char *mw_prpl_normalize(const PurpleAccount *account, - const char *id) { - - /* code elsewhere assumes that the return value points to different - memory than the passed value, but it won't free the normalized - data. wtf? */ - - static char buf[BUF_LEN]; - strncpy(buf, id, sizeof(buf)); - return buf; -} - - -static void mw_prpl_remove_group(PurpleConnection *gc, PurpleGroup *group) { - struct mwPurplePluginData *pd; - struct mwAwareList *list; - - pd = gc->proto_data; - g_return_if_fail(pd != NULL); - g_return_if_fail(pd->group_list_map != NULL); - - list = g_hash_table_lookup(pd->group_list_map, group); - - if(list) { - g_hash_table_remove(pd->group_list_map, list); - g_hash_table_remove(pd->group_list_map, group); - mwAwareList_free(list); - - blist_schedule(pd); - } -} - - -static gboolean mw_prpl_can_receive_file(PurpleConnection *gc, - const char *who) { - struct mwPurplePluginData *pd; - struct mwServiceAware *srvc; - PurpleAccount *acct; - - g_return_val_if_fail(gc != NULL, FALSE); - - pd = gc->proto_data; - g_return_val_if_fail(pd != NULL, FALSE); - - srvc = pd->srvc_aware; - g_return_val_if_fail(srvc != NULL, FALSE); - - acct = purple_connection_get_account(gc); - g_return_val_if_fail(acct != NULL, FALSE); - - return purple_find_buddy(acct, who) && - user_supports(srvc, who, mwAttribute_FILE_TRANSFER); -} - - -static void ft_outgoing_init(PurpleXfer *xfer) { - PurpleAccount *acct; - PurpleConnection *gc; - - struct mwPurplePluginData *pd; - struct mwServiceFileTransfer *srvc; - struct mwFileTransfer *ft; - - const char *filename; - gsize filesize; - FILE *fp; - - struct mwIdBlock idb = { NULL, NULL }; - - DEBUG_INFO("ft_outgoing_init\n"); - - acct = purple_xfer_get_account(xfer); - gc = purple_account_get_connection(acct); - pd = gc->proto_data; - srvc = pd->srvc_ft; - - filename = purple_xfer_get_local_filename(xfer); - filesize = purple_xfer_get_size(xfer); - idb.user = xfer->who; - - purple_xfer_update_progress(xfer); - - /* test that we can actually send the file */ - fp = g_fopen(filename, "rb"); - if(! fp) { - char *msg = g_strdup_printf(_("Error reading file %s: \n%s\n"), - filename, g_strerror(errno)); - purple_xfer_error(purple_xfer_get_type(xfer), acct, xfer->who, msg); - g_free(msg); - return; - } - fclose(fp); - - { - char *tmp = strrchr(filename, G_DIR_SEPARATOR); - if(tmp++) filename = tmp; - } - - ft = mwFileTransfer_new(srvc, &idb, NULL, filename, filesize); - - purple_xfer_ref(xfer); - mwFileTransfer_setClientData(ft, xfer, (GDestroyNotify) purple_xfer_unref); - xfer->data = ft; - - mwFileTransfer_offer(ft); -} - - -static void ft_outgoing_cancel(PurpleXfer *xfer) { - struct mwFileTransfer *ft = xfer->data; - - DEBUG_INFO("ft_outgoing_cancel called\n"); - - if(ft) mwFileTransfer_cancel(ft); -} - - -static PurpleXfer *mw_prpl_new_xfer(PurpleConnection *gc, const char *who) { - PurpleAccount *acct; - PurpleXfer *xfer; - - acct = purple_connection_get_account(gc); - - xfer = purple_xfer_new(acct, PURPLE_XFER_SEND, who); - if (xfer) - { - purple_xfer_set_init_fnc(xfer, ft_outgoing_init); - purple_xfer_set_cancel_send_fnc(xfer, ft_outgoing_cancel); - } - - return xfer; -} - -static void mw_prpl_send_file(PurpleConnection *gc, - const char *who, const char *file) { - - PurpleXfer *xfer = mw_prpl_new_xfer(gc, who); - - if(file) { - DEBUG_INFO("file != NULL\n"); - purple_xfer_request_accepted(xfer, file); - - } else { - DEBUG_INFO("file == NULL\n"); - purple_xfer_request(xfer); - } -} - - -static PurplePluginProtocolInfo mw_prpl_info = { - .options = OPT_PROTO_IM_IMAGE, - .user_splits = NULL, /*< set in mw_plugin_init */ - .protocol_options = NULL, /*< set in mw_plugin_init */ - .icon_spec = NO_BUDDY_ICONS, - .list_icon = mw_prpl_list_icon, - .list_emblem = mw_prpl_list_emblem, - .status_text = mw_prpl_status_text, - .tooltip_text = mw_prpl_tooltip_text, - .status_types = mw_prpl_status_types, - .blist_node_menu = mw_prpl_blist_node_menu, - .chat_info = mw_prpl_chat_info, - .chat_info_defaults = mw_prpl_chat_info_defaults, - .login = mw_prpl_login, - .close = mw_prpl_close, - .send_im = mw_prpl_send_im, - .set_info = NULL, - .send_typing = mw_prpl_send_typing, - .get_info = mw_prpl_get_info, - .set_status = mw_prpl_set_status, - .set_idle = mw_prpl_set_idle, - .change_passwd = NULL, - .add_buddy = mw_prpl_add_buddy, - .add_buddies = mw_prpl_add_buddies, - .remove_buddy = mw_prpl_remove_buddy, - .remove_buddies = NULL, - .add_permit = mw_prpl_add_permit, - .add_deny = mw_prpl_add_deny, - .rem_permit = mw_prpl_rem_permit, - .rem_deny = mw_prpl_rem_deny, - .set_permit_deny = mw_prpl_set_permit_deny, - .join_chat = mw_prpl_join_chat, - .reject_chat = mw_prpl_reject_chat, - .get_chat_name = mw_prpl_get_chat_name, - .chat_invite = mw_prpl_chat_invite, - .chat_leave = mw_prpl_chat_leave, - .chat_whisper = mw_prpl_chat_whisper, - .chat_send = mw_prpl_chat_send, - .keepalive = mw_prpl_keepalive, - .register_user = NULL, - .get_cb_info = NULL, - .get_cb_away = NULL, - .alias_buddy = mw_prpl_alias_buddy, - .group_buddy = mw_prpl_group_buddy, - .rename_group = mw_prpl_rename_group, - .buddy_free = mw_prpl_buddy_free, - .convo_closed = mw_prpl_convo_closed, - .normalize = mw_prpl_normalize, - .set_buddy_icon = NULL, - .remove_group = mw_prpl_remove_group, - .get_cb_real_name = NULL, - .set_chat_topic = NULL, - .find_blist_chat = NULL, - .roomlist_get_list = NULL, - .roomlist_expand_category = NULL, - .can_receive_file = mw_prpl_can_receive_file, - .send_file = mw_prpl_send_file, - .new_xfer = mw_prpl_new_xfer, - .offline_message = NULL, - .whiteboard_prpl_ops = NULL, - .send_raw = NULL, - .struct_size = sizeof(PurplePluginProtocolInfo) -}; - - -static PurplePluginPrefFrame * -mw_plugin_get_plugin_pref_frame(PurplePlugin *plugin) { - PurplePluginPrefFrame *frame; - PurplePluginPref *pref; - - frame = purple_plugin_pref_frame_new(); - - pref = purple_plugin_pref_new_with_label(_("Remotely Stored Buddy List")); - purple_plugin_pref_frame_add(frame, pref); - - - pref = purple_plugin_pref_new_with_name(MW_PRPL_OPT_BLIST_ACTION); - purple_plugin_pref_set_label(pref, _("Buddy List Storage Mode")); - - purple_plugin_pref_set_type(pref, PURPLE_PLUGIN_PREF_CHOICE); - purple_plugin_pref_add_choice(pref, _("Local Buddy List Only"), - GINT_TO_POINTER(blist_choice_LOCAL)); - purple_plugin_pref_add_choice(pref, _("Merge List from Server"), - GINT_TO_POINTER(blist_choice_MERGE)); - purple_plugin_pref_add_choice(pref, _("Merge and Save List to Server"), - GINT_TO_POINTER(blist_choice_STORE)); - purple_plugin_pref_add_choice(pref, _("Synchronize List with Server"), - GINT_TO_POINTER(blist_choice_SYNCH)); - - purple_plugin_pref_frame_add(frame, pref); - - return frame; -} - - -static PurplePluginUiInfo mw_plugin_ui_info = { - mw_plugin_get_plugin_pref_frame, - 0, /* page_num */ - NULL, /* frame */ - NULL, - NULL, - NULL, - NULL -}; - - -static void st_import_action_cb(PurpleConnection *gc, char *filename) { - struct mwSametimeList *l; - - FILE *file; - char buf[BUF_LEN]; - size_t len; - - GString *str; - - file = g_fopen(filename, "r"); - g_return_if_fail(file != NULL); - - str = g_string_new(NULL); - while( (len = fread(buf, 1, BUF_LEN, file)) ) { - g_string_append_len(str, buf, len); - } - - fclose(file); - - l = mwSametimeList_load(str->str); - g_string_free(str, TRUE); - - blist_merge(gc, l); - mwSametimeList_free(l); -} - - -/** prompts for a file to import blist from */ -static void st_import_action(PurplePluginAction *act) { - PurpleConnection *gc; - PurpleAccount *account; - char *title; - - gc = act->context; - account = purple_connection_get_account(gc); - title = g_strdup_printf(_("Import Sametime List for Account %s"), - purple_account_get_username(account)); - - purple_request_file(gc, title, NULL, FALSE, - G_CALLBACK(st_import_action_cb), NULL, - account, NULL, NULL, - gc); - - g_free(title); -} - - -static void st_export_action_cb(PurpleConnection *gc, char *filename) { - struct mwSametimeList *l; - char *str; - FILE *file; - - file = g_fopen(filename, "w"); - g_return_if_fail(file != NULL); - - l = mwSametimeList_new(); - blist_export(gc, l); - str = mwSametimeList_store(l); - mwSametimeList_free(l); - - fprintf(file, "%s", str); - fclose(file); - - g_free(str); -} - - -/** prompts for a file to export blist to */ -static void st_export_action(PurplePluginAction *act) { - PurpleConnection *gc; - PurpleAccount *account; - char *title; - - gc = act->context; - account = purple_connection_get_account(gc); - title = g_strdup_printf(_("Export Sametime List for Account %s"), - purple_account_get_username(account)); - - purple_request_file(gc, title, NULL, TRUE, - G_CALLBACK(st_export_action_cb), NULL, - account, NULL, NULL, - gc); - - g_free(title); -} - - -static void remote_group_multi_cleanup(gpointer ignore, - PurpleRequestFields *fields) { - - PurpleRequestField *f; - GList *l; - - f = purple_request_fields_get_field(fields, "group"); - l = purple_request_field_list_get_items(f); - - for(; l; l = l->next) { - const char *i = l->data; - struct named_id *res; - - res = purple_request_field_list_get_data(f, i); - - g_free(res->id); - g_free(res->name); - g_free(res); - } -} - - -static void remote_group_done(struct mwPurplePluginData *pd, - const char *id, const char *name) { - PurpleConnection *gc; - PurpleAccount *acct; - PurpleGroup *group; - PurpleBlistNode *gn; - const char *owner; - - g_return_if_fail(pd != NULL); - - gc = pd->gc; - acct = purple_connection_get_account(gc); - - /* collision checking */ - group = purple_find_group(name); - if(group) { - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("Unable to add group: group exists"); - msgB = _("A group named '%s' already exists in your buddy list."); - msg = g_strdup_printf(msgB, name); - - purple_notify_error(gc, _("Unable to add group"), msgA, msg); - - g_free(msg); - return; - } - - group = purple_group_new(name); - gn = (PurpleBlistNode *) group; - - owner = purple_account_get_username(acct); - - purple_blist_node_set_string(gn, GROUP_KEY_NAME, id); - purple_blist_node_set_int(gn, GROUP_KEY_TYPE, mwSametimeGroup_DYNAMIC); - purple_blist_node_set_string(gn, GROUP_KEY_OWNER, owner); - purple_blist_add_group(group, NULL); - - group_add(pd, group); - blist_schedule(pd); -} - - -static void remote_group_multi_cb(struct mwPurplePluginData *pd, - PurpleRequestFields *fields) { - PurpleRequestField *f; - GList *l; - - f = purple_request_fields_get_field(fields, "group"); - l = purple_request_field_list_get_selected(f); - - if(l) { - const char *i = l->data; - struct named_id *res; - - res = purple_request_field_list_get_data(f, i); - remote_group_done(pd, res->id, res->name); - } - - remote_group_multi_cleanup(NULL, fields); -} - - -static void remote_group_multi(struct mwResolveResult *result, - struct mwPurplePluginData *pd) { - - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - GList *l; - const char *msgA; - const char *msgB; - char *msg; - - PurpleConnection *gc = pd->gc; - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, g); - - f = purple_request_field_list_new("group", _("Possible Matches")); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_field_set_required(f, TRUE); - - for(l = result->matches; l; l = l->next) { - struct mwResolveMatch *match = l->data; - struct named_id *res = g_new0(struct named_id, 1); - - res->id = g_strdup(match->id); - res->name = g_strdup(match->name); - - purple_request_field_list_add(f, res->name, res); - } - - purple_request_field_group_add_field(g, f); - - msgA = _("Notes Address Book group results"); - msgB = _("The identifier '%s' may possibly refer to any of the following" - " Notes Address Book groups. Please select the correct group from" - " the list below to add it to your buddy list."); - msg = g_strdup_printf(msgB, result->name); - - purple_request_fields(gc, _("Select Notes Address Book"), - msgA, msg, fields, - _("Add Group"), G_CALLBACK(remote_group_multi_cb), - _("Cancel"), G_CALLBACK(remote_group_multi_cleanup), - purple_connection_get_account(gc), result->name, NULL, - pd); - - g_free(msg); -} - - -static void remote_group_resolved(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer b) { - - struct mwResolveResult *res = NULL; - struct mwSession *session; - struct mwPurplePluginData *pd; - PurpleConnection *gc; - - session = mwService_getSession(MW_SERVICE(srvc)); - g_return_if_fail(session != NULL); - - pd = mwSession_getClientData(session); - g_return_if_fail(pd != NULL); - - gc = pd->gc; - g_return_if_fail(gc != NULL); - - if(!code && results) { - res = results->data; - - if(res->matches) { - remote_group_multi(res, pd); - return; - } - } - - if(res && res->name) { - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("Unable to add group: group not found"); - - msgB = _("The identifier '%s' did not match any Notes Address Book" - " groups in your Sametime community."); - msg = g_strdup_printf(msgB, res->name); - - purple_notify_error(gc, _("Unable to add group"), msgA, msg); - - g_free(msg); - } -} - - -static void remote_group_action_cb(PurpleConnection *gc, const char *name) { - struct mwPurplePluginData *pd; - struct mwServiceResolve *srvc; - GList *query; - enum mwResolveFlag flags; - guint32 req; - - pd = gc->proto_data; - srvc = pd->srvc_resolve; - - query = g_list_prepend(NULL, (char *) name); - flags = mwResolveFlag_FIRST | mwResolveFlag_GROUPS; - - req = mwServiceResolve_resolve(srvc, query, flags, remote_group_resolved, - NULL, NULL); - g_list_free(query); - - if(req == SEARCH_ERROR) { - /** @todo display error */ - } -} - - -static void remote_group_action(PurplePluginAction *act) { - PurpleConnection *gc; - const char *msgA; - const char *msgB; - - gc = act->context; - - msgA = _("Notes Address Book Group"); - msgB = _("Enter the name of a Notes Address Book group in the field below" - " to add the group and its members to your buddy list."); - - purple_request_input(gc, _("Add Group"), msgA, msgB, NULL, - FALSE, FALSE, NULL, - _("Add"), G_CALLBACK(remote_group_action_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - - -static void search_notify(struct mwResolveResult *result, - PurpleConnection *gc) { - GList *l; - const char *msgA; - const char *msgB; - char *msg1; - char *msg2; - - PurpleNotifySearchResults *sres; - PurpleNotifySearchColumn *scol; - - sres = purple_notify_searchresults_new(); - - scol = purple_notify_searchresults_column_new(_("User Name")); - purple_notify_searchresults_column_add(sres, scol); - - scol = purple_notify_searchresults_column_new(_("Sametime ID")); - purple_notify_searchresults_column_add(sres, scol); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_IM, - notify_im); - - purple_notify_searchresults_button_add(sres, PURPLE_NOTIFY_BUTTON_ADD, - notify_add); - - for(l = result->matches; l; l = l->next) { - struct mwResolveMatch *match = l->data; - GList *row = NULL; - - if(!match->id || !match->name) - continue; - - row = g_list_append(row, g_strdup(match->name)); - row = g_list_append(row, g_strdup(match->id)); - purple_notify_searchresults_row_add(sres, row); - } - - msgA = _("Search results for '%s'"); - msgB = _("The identifier '%s' may possibly refer to any of the following" - " users. You may add these users to your buddy list or send them" - " messages with the action buttons below."); - - msg1 = g_strdup_printf(msgA, result->name); - msg2 = g_strdup_printf(msgB, result->name); - - purple_notify_searchresults(gc, _("Search Results"), - msg1, msg2, sres, notify_close, NULL); - - g_free(msg1); - g_free(msg2); -} - - -static void search_resolved(struct mwServiceResolve *srvc, - guint32 id, guint32 code, GList *results, - gpointer b) { - - PurpleConnection *gc = b; - struct mwResolveResult *res = NULL; - - if(results) res = results->data; - - if(!code && res && res->matches) { - search_notify(res, gc); - - } else { - const char *msgA; - const char *msgB; - char *msg; - - msgA = _("No matches"); - msgB = _("The identifier '%s' did not match any users in your" - " Sametime community."); - msg = g_strdup_printf(msgB, (res && res->name) ? NSTR(res->name) : ""); - - purple_notify_error(gc, _("No Matches"), msgA, msg); - - g_free(msg); - } -} - - -static void search_action_cb(PurpleConnection *gc, const char *name) { - struct mwPurplePluginData *pd; - struct mwServiceResolve *srvc; - GList *query; - enum mwResolveFlag flags; - guint32 req; - - pd = gc->proto_data; - srvc = pd->srvc_resolve; - - query = g_list_prepend(NULL, (char *) name); - flags = mwResolveFlag_FIRST | mwResolveFlag_USERS; - - req = mwServiceResolve_resolve(srvc, query, flags, search_resolved, - gc, NULL); - g_list_free(query); - - if(req == SEARCH_ERROR) { - /** @todo display error */ - } -} - - -static void search_action(PurplePluginAction *act) { - PurpleConnection *gc; - const char *msgA; - const char *msgB; - - gc = act->context; - - msgA = _("Search for a user"); - msgB = _("Enter a name or partial ID in the field below to search" - " for matching users in your Sametime community."); - - purple_request_input(gc, _("User Search"), msgA, msgB, NULL, - FALSE, FALSE, NULL, - _("Search"), G_CALLBACK(search_action_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - - -static GList *mw_plugin_actions(PurplePlugin *plugin, gpointer context) { - PurplePluginAction *act; - GList *l = NULL; - - act = purple_plugin_action_new(_("Import Sametime List..."), - st_import_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Export Sametime List..."), - st_export_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("Add Notes Address Book Group..."), - remote_group_action); - l = g_list_append(l, act); - - act = purple_plugin_action_new(_("User Search..."), - search_action); - l = g_list_append(l, act); - - return l; -} - - -static gboolean mw_plugin_load(PurplePlugin *plugin) { - return TRUE; -} - - -static gboolean mw_plugin_unload(PurplePlugin *plugin) { - return TRUE; -} - - -static void mw_plugin_destroy(PurplePlugin *plugin) { - g_log_remove_handler(G_LOG_DOMAIN, log_handler[0]); - g_log_remove_handler("meanwhile", log_handler[1]); -} - -static PurplePluginInfo mw_plugin_info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - PLUGIN_ID, /**< id */ - PLUGIN_NAME, /**< name */ - DISPLAY_VERSION, /**< version */ - PLUGIN_SUMMARY, /**< summary */ - PLUGIN_DESC, /**< description */ - PLUGIN_AUTHOR, /**< author */ - PLUGIN_HOMEPAGE, /**< homepage */ - - mw_plugin_load, /**< load */ - mw_plugin_unload, /**< unload */ - mw_plugin_destroy, /**< destroy */ - - NULL, /**< ui_info */ - &mw_prpl_info, /**< extra_info */ - &mw_plugin_ui_info, /**< prefs_info */ - mw_plugin_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - - -static void mw_log_handler(const gchar *domain, GLogLevelFlags flags, - const gchar *msg, gpointer data) { - - if(! (msg && *msg)) return; - - /* handle g_log requests via purple's built-in debug logging */ - if(flags & G_LOG_LEVEL_ERROR) { - purple_debug_error(domain, "%s\n", msg); - - } else if(flags & G_LOG_LEVEL_WARNING) { - purple_debug_warning(domain, "%s\n", msg); - - } else { - purple_debug_info(domain, "%s\n", msg); - } -} - - -static void mw_plugin_init(PurplePlugin *plugin) { - PurpleAccountOption *opt; - GList *l = NULL; - - GLogLevelFlags logflags = - G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION; - - /* set up the preferences */ - purple_prefs_add_none(MW_PRPL_OPT_BASE); - purple_prefs_add_int(MW_PRPL_OPT_BLIST_ACTION, BLIST_CHOICE_DEFAULT); - - /* remove dead preferences */ - purple_prefs_remove(MW_PRPL_OPT_PSYCHIC); - purple_prefs_remove(MW_PRPL_OPT_SAVE_DYNAMIC); - - /* host to connect to */ - opt = purple_account_option_string_new(_("Server"), MW_KEY_HOST, - MW_PLUGIN_DEFAULT_HOST); - l = g_list_append(l, opt); - - /* port to connect to */ - opt = purple_account_option_int_new(_("Port"), MW_KEY_PORT, - MW_PLUGIN_DEFAULT_PORT); - l = g_list_append(l, opt); - - { /* copy the old force login setting from prefs if it's - there. Don't delete the preference, since there may be more - than one account that wants to check for it. */ - gboolean b = FALSE; - const char *label = _("Force login (ignore server redirects)"); - - if(purple_prefs_exists(MW_PRPL_OPT_FORCE_LOGIN)) - b = purple_prefs_get_bool(MW_PRPL_OPT_FORCE_LOGIN); - - opt = purple_account_option_bool_new(label, MW_KEY_FORCE, b); - l = g_list_append(l, opt); - } - - /* pretend to be Sametime Connect */ - opt = purple_account_option_bool_new(_("Hide client identity"), - MW_KEY_FAKE_IT, FALSE); - l = g_list_append(l, opt); - - mw_prpl_info.protocol_options = l; - l = NULL; - - /* forward all our g_log messages to purple. Generally all the logging - calls are using purple_log directly, but the g_return macros will - get caught here */ - log_handler[0] = g_log_set_handler(G_LOG_DOMAIN, logflags, - mw_log_handler, NULL); - - /* redirect meanwhile's logging to purple's */ - log_handler[1] = g_log_set_handler("meanwhile", logflags, - mw_log_handler, NULL); -} - - -PURPLE_INIT_PLUGIN(sametime, mw_plugin_init, mw_plugin_info); -/* The End. */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/sametime/sametime.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ - - -/* CFLAGS trumps configure values */ - - -/** default host for the purple plugin. You can specialize a build to - default to your server by supplying this at compile time */ -#ifndef MW_PLUGIN_DEFAULT_HOST -#define MW_PLUGIN_DEFAULT_HOST "" -#endif -/* "" */ - - -/** default port for the purple plugin. You can specialize a build to - default to your server by supplying this at compile time */ -#ifndef MW_PLUGIN_DEFAULT_PORT -#define MW_PLUGIN_DEFAULT_PORT 1533 -#endif -/* 1533 */ - - -/** default encoding for the purple plugin.*/ -#ifndef MW_PLUGIN_DEFAULT_ENCODING -#define MW_PLUGIN_DEFAULT_ENCODING "ISO-8859-1" -#endif -/* ISO-8859-1 */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1738 +0,0 @@ -/* - - silcpurple_buddy.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Key Agreement *********************************/ - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data); - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local); - -typedef struct { - char *nick; - PurpleConnection *gc; -} *SilcPurpleResolve; - -static void -silcpurple_buddy_keyagr_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleResolve r = context; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), r->nick); - purple_notify_error(gc, _("Key Agreement"), - _("Cannot perform the key agreement"), tmp); - g_free(r->nick); - silc_free(r); - return; - } - - silcpurple_buddy_keyagr_do(gc, r->nick, FALSE); - g_free(r->nick); - silc_free(r); -} - -static void -silcpurple_buddy_keyagr_cb(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - SilcKeyAgreementStatus status, - SilcSKEKeyMaterial key, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn) - return; - - switch (status) { - case SILC_KEY_AGREEMENT_OK: - { - PurpleConversation *convo; - char tmp[128]; - - /* Set the private key for this client */ - silc_client_del_private_message_key(client, conn, client_entry); - silc_client_add_private_message_key_ske(client, conn, client_entry, - NULL, NULL, key); - silc_ske_free_key_material(key); - - - /* Open IM window */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - client_entry->nickname, sg->account); - if (convo) { - /* we don't have windows in the core anymore...but we may want to - * provide some method for asking the UI to show the window - purple_conv_window_show(purple_conversation_get_window(convo)); - */ - } else { - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, sg->account, - client_entry->nickname); - } - g_snprintf(tmp, sizeof(tmp), "%s [private key]", client_entry->nickname); - purple_conversation_set_title(convo, tmp); - } - break; - - case SILC_KEY_AGREEMENT_ERROR: - purple_notify_error(gc, _("Key Agreement"), - _("Error occurred during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_FAILURE: - purple_notify_error(gc, _("Key Agreement"), _("Key Agreement failed"), NULL); - break; - - case SILC_KEY_AGREEMENT_TIMEOUT: - purple_notify_error(gc, _("Key Agreement"), - _("Timeout during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_ABORTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement was aborted"), NULL); - break; - - case SILC_KEY_AGREEMENT_ALREADY_STARTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement is already started"), NULL); - break; - - case SILC_KEY_AGREEMENT_SELF_DENIED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement cannot be started with yourself"), - NULL); - break; - - default: - break; - } -} - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local) -{ - SilcPurple sg = gc->proto_data; - SilcDList clients; - SilcClientEntry client_entry; - SilcClientConnectionParams params; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - SilcSocket sock; - - if (!sg->conn || !name) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, name, - FALSE); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleResolve r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->nick = g_strdup(name); - r->gc = gc; - silc_client_get_clients(sg->client, sg->conn, name, NULL, - silcpurple_buddy_keyagr_resolved, r); - return; - } - - silc_socket_stream_get_info(silc_packet_stream_get_stream(sg->conn->stream), - &sock, NULL, NULL, NULL); - - /* Resolve the local IP from the outgoing socket connection. We resolve - it to check whether we have a private range IP address or public IP - address. If we have public then we will assume that we are not behind - NAT and will provide automatically the point of connection to the - agreement. If we have private range address we assume that we are - behind NAT and we let the responder provide the point of connection. - - The algorithm also checks the remote IP address of server connection. - If it is private range address and we have private range address we - assume that we are chatting in LAN and will provide the point of - connection. - - Naturally this algorithm does not always get things right. */ - - if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (!force_local && silcpurple_ip_is_private(local_ip)) { - local = FALSE; - - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide - the connection point. */ - local = TRUE; - } - } - - if (force_local) - local = TRUE; - - if (local && !local_ip) - local_ip = silc_net_localip(); - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - if (local) - /* Provide connection point */ - params.local_ip = local_ip; - - /* Send the key agreement request */ - silc_client_send_key_agreement(sg->client, sg->conn, client_entry, - ¶ms, sg->public_key, - sg->private_key, - silcpurple_buddy_keyagr_cb, NULL); - - silc_free(local_ip); - silc_free(remote_ip); - silc_client_list_free(sg->client, sg->conn, clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - char *hostname; - SilcUInt16 port; -} *SilcPurpleKeyAgrAsk; - -static void -silcpurple_buddy_keyagr_request_cb(SilcPurpleKeyAgrAsk a, gint id) -{ - SilcClientEntry client_entry; - SilcClientConnectionParams params; - - if (id != 1) - goto out; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(a->client, a->conn, - &a->client_id); - if (!client_entry) { - purple_notify_error(a->client->application, _("Key Agreement"), - _("The remote user is not present in the network any more"), - NULL); - goto out; - } - - /* If the hostname was provided by the requestor perform the key agreement - now. Otherwise, we will send him a request to connect to us. */ - if (a->hostname) { - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - silc_client_perform_key_agreement(a->client, a->conn, - client_entry, ¶ms, - a->conn->public_key, - a->conn->private_key, - a->hostname, a->port, - silcpurple_buddy_keyagr_cb, NULL); - } else { - /* Send request. Force us as the point of connection since requestor - did not provide the point of connection. */ - silcpurple_buddy_keyagr_do(a->client->application, - client_entry->nickname, TRUE); - } - - out: - g_free(a->hostname); - silc_free(a); -} - -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port, - SilcUInt16 protocol) -{ - char tmp[128], tmp2[128]; - SilcPurpleKeyAgrAsk a; - PurpleConnection *gc = client->application; - - /* For now Pidgin don't support UDP key agreement */ - if (protocol == 1) - return; - - g_snprintf(tmp, sizeof(tmp), - _("Key agreement request received from %s. Would you like to " - "perform the key agreement?"), client_entry->nickname); - if (hostname) - g_snprintf(tmp2, sizeof(tmp2), - _("The remote user is waiting key agreement on:\n" - "Remote host: %s\nRemote port: %d"), hostname, port); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->client = client; - a->conn = conn; - a->client_id = client_entry->id; - if (hostname) - a->hostname = g_strdup(hostname); - a->port = port; - - purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, - NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), - _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); -} - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleAccount *account; - - buddy = (PurpleBuddy *)node; - account = purple_buddy_get_account(buddy); - silcpurple_buddy_keyagr_do(purple_account_get_connection(account), - purple_buddy_get_name(buddy), FALSE); -} - - -/**************************** Static IM Key **********************************/ - -static void -silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcDList clients; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - purple_buddy_get_name(b), FALSE); - if (!clients) - return; - - silc_dlist_start(clients); - silc_client_del_private_message_key(sg->client, sg->conn, - silc_dlist_get(clients)); - silc_client_list_free(sg->client, sg->conn, clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurplePrivkey; - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_privkey_cb(SilcPurplePrivkey p, const char *passphrase) -{ - SilcClientEntry client_entry; - - if (!passphrase || !(*passphrase)) { - silc_free(p); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(p->client, p->conn, - &p->client_id); - if (!client_entry) { - purple_notify_error(p->client->application, _("IM With Password"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(p); - return; - } - - /* Set the private message key */ - silc_client_del_private_message_key(p->client, p->conn, - client_entry); - silc_client_add_private_message_key(p->client, p->conn, - client_entry, NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase)); - silc_free(p); -} - -static void -silcpurple_buddy_privkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("IM With Password"), - _("Cannot set IM key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_privkey(client->application, context); - g_free(context); -} - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcPurplePrivkey p; - SilcDList clients; - SilcClientEntry client_entry; - - if (!name) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - name, FALSE); - if (!clients) { - silc_client_get_clients(sg->client, sg->conn, name, NULL, - silcpurple_buddy_privkey_resolved, - g_strdup(name)); - return; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->client = sg->client; - p->conn = sg->conn; - p->client_id = client_entry->id; - purple_request_input(gc, _("IM With Password"), NULL, - _("Set IM Password"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), - _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); - - silc_client_list_free(sg->client, sg->conn, clients); -} - -static void -silcpurple_buddy_privkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - silcpurple_buddy_privkey(gc, purple_buddy_get_name(buddy)); -} - - -/**************************** Get Public Key *********************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurpleBuddyGetkey; - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name); - -static SilcBool -silcpurple_buddy_getkey_cb(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap) -{ - SilcClientEntry client_entry; - SilcPurpleBuddyGetkey g = context; - - if (status != SILC_STATUS_OK) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return FALSE; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(g->client, g->conn, - &g->client_id); - if (!client_entry) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return FALSE; - } - - if (!client_entry->public_key) { - silc_free(g); - return FALSE; - } - - /* Now verify the public key */ - silcpurple_verify_public_key(g->client, g->conn, client_entry->nickname, - SILC_CONN_CLIENT, client_entry->public_key, - NULL, NULL); - silc_free(g); - return TRUE; -} - -static void -silcpurple_buddy_getkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("Get Public Key"), - _("Cannot fetch the public key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_getkey(client->application, context); - g_free(context); -} - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - SilcDList clients; - SilcPurpleBuddyGetkey g; - SilcUInt16 cmd_ident; - - if (!name) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, name, FALSE); - if (!clients) { - silc_client_get_clients(client, conn, name, NULL, - silcpurple_buddy_getkey_resolved, - g_strdup(name)); - return; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - /* Call GETKEY */ - g = silc_calloc(1, sizeof(*g)); - if (!g) - return; - g->client = client; - g->conn = conn; - g->client_id = client_entry->id; - cmd_ident = silc_client_command_call(client, conn, NULL, "GETKEY", - client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, cmd_ident, - silcpurple_buddy_getkey_cb, g); - silc_client_list_free(client, conn, clients); -} - -static void -silcpurple_buddy_getkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - silcpurple_buddy_getkey(gc, purple_buddy_get_name(buddy)); -} - -static void -silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcPublicKey public_key; - const char *pkfile; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; - - pkfile = purple_blist_node_get_string(node, "public-key"); - if (!silc_pkcs_load_public_key(pkfile, &public_key)) { - purple_notify_error(gc, - _("Show Public Key"), - _("Could not load public key"), NULL); - return; - } - - silcpurple_show_public_key(sg, purple_buddy_get_name(b), public_key, NULL, NULL); - silc_pkcs_public_key_free(public_key); -} - - -/**************************** Buddy routines *********************************/ - -/* The buddies are implemented by using the WHOIS and WATCH commands that - can be used to search users by their public key. Since nicknames aren't - unique in SILC we cannot trust the buddy list using their nickname. We - associate public keys to buddies and use those to search and watch - in the network. - - The problem is that Purple does not return PurpleBuddy contexts to the - callbacks but the buddy names. Naturally, this is not going to work - with SILC. But, for now, we have to do what we can... */ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - PurpleBuddy *b; - unsigned char *offline_pk; - SilcUInt32 offline_pk_len; - SilcPublicKey public_key; - unsigned int offline : 1; - unsigned int pubkey_search : 1; - unsigned int init : 1; -} *SilcPurpleBuddyRes; - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id); -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context); - -void silcpurple_get_info(PurpleConnection *gc, const char *who) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - PurpleBuddy *b; - const char *filename, *nick = who; - char tmp[256]; - - if (!who) - return; - if (strlen(who) > 1 && who[0] == '@') - nick = who + 1; - if (strlen(who) > 1 && who[0] == '*') - nick = who + 1; - if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') - nick = who + 2; - - b = purple_find_buddy(gc->account, nick); - if (b) { - /* See if we have this buddy's public key. If we do use that - to search the details. */ - gpointer proto_data; - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - "-details", "-pubkey", filename, NULL); - return; - } - - if (!(proto_data = purple_buddy_get_protocol_data(b))) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), purple_buddy_get_name(b)); - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), tmp); - return; - } - - client_entry = silc_client_get_client_by_id(client, conn, proto_data); - if (client_entry) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - client_entry->nickname, "-details", NULL); - } - } else { - /* Call WHOIS just with nickname. */ - silc_client_command_call(client, conn, NULL, "WHOIS", nick, NULL); - } -} - -static void -silcpurple_add_buddy_pk_no(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - purple_buddy_get_name(r->b)); - purple_notify_error(r->client->application, _("Add Buddy"), tmp, - _("You cannot receive buddy notifications until you " - "import his/her public key. You can use the Get Public Key " - "command to get the public key.")); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); -} - -static void -silcpurple_add_buddy_save(SilcBool success, void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttribute attribute; - SilcVCardStruct vcard; - SilcMime message = NULL, extension = NULL; - SilcMime usericon = NULL; - SilcAttributeObjPk serverpk, usersign, serversign; - gboolean usign_success = TRUE, ssign_success = TRUE; - char filename[512], filename2[512], *fingerprint = NULL, *tmp; - SilcUInt32 len; - SilcHash hash; - int i; - - if (!success) { - /* The user did not trust the public key. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r->offline_pk); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); - return; - } - - if (r->offline) { - /* User is offline. Associate the imported public key with - this user. */ - fingerprint = silc_hash_fingerprint(NULL, r->offline_pk, - r->offline_pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - silc_free(fingerprint); - silc_free(r->offline_pk); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry) { - silc_free(r->offline_pk); - silc_pkcs_public_key_free(r->public_key); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); - return; - } - - memset(&vcard, 0, sizeof(vcard)); - memset(&serverpk, 0, sizeof(serverpk)); - memset(&usersign, 0, sizeof(usersign)); - memset(&serversign, 0, sizeof(serversign)); - - /* Now that we have the public key and we trust it now we - save the attributes of the buddy and update its status. */ - - if (client_entry->attrs) { - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) - != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - - switch (attribute) { - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - break; - - case SILC_ATTRIBUTE_STATUS_MESSAGE: - message = silc_mime_alloc(); - if (!silc_attribute_get_object(attr, (void *)message, - sizeof(*message))) - continue; - break; - - case SILC_ATTRIBUTE_EXTENSION: - extension = silc_mime_alloc(); - if (!silc_attribute_get_object(attr, (void *)extension, - sizeof(*extension))) - continue; - break; - - case SILC_ATTRIBUTE_USER_ICON: - usericon = silc_mime_alloc(); - if (!silc_attribute_get_object(attr, (void *)usericon, - sizeof(*usericon))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_PUBLIC_KEY: - if (serverpk.type) - continue; - if (!silc_attribute_get_object(attr, (void *)&serverpk, - sizeof(serverpk))) - continue; - break; - - case SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE: - if (usersign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&usersign, - sizeof(usersign))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_DIGITAL_SIGNATURE: - if (serversign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&serversign, - sizeof(serversign))) - continue; - break; - - default: - break; - } - } - } - - /* Verify the attribute signatures */ - silc_hash_alloc((const unsigned char *)"sha1", &hash); - - if (usersign.data) { - unsigned char *verifyd; - SilcUInt32 verify_len; - - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - FALSE, &verify_len); - if (verifyd && !silc_pkcs_verify(client_entry->public_key, - usersign.data, - usersign.data_len, - verifyd, verify_len, hash)) - usign_success = FALSE; - silc_free(verifyd); - } - - if (serversign.data) { - SilcPublicKey public_key; - SilcPKCSType type = 0; - unsigned char *verifyd; - SilcUInt32 verify_len; - - if (!strcmp(serverpk.type, "silc-rsa")) - type = SILC_PKCS_SILC; - else if (!strcmp(serverpk.type, "ssh-rsa")) - type = SILC_PKCS_SSH2; - else if (!strcmp(serverpk.type, "x509v3-sign-rsa")) - type = SILC_PKCS_X509V3; - else if (!strcmp(serverpk.type, "pgp-sign-rsa")) - type = SILC_PKCS_OPENPGP; - - if (silc_pkcs_public_key_alloc(type, serverpk.data, - serverpk.data_len, - &public_key)) { - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - TRUE, &verify_len); - if (verifyd && !silc_pkcs_verify(public_key, - serversign.data, - serversign.data_len, - verifyd, verify_len, - hash)) - ssign_success = FALSE; - silc_pkcs_public_key_free(public_key); - silc_free(verifyd); - } - } - - fingerprint = silc_fingerprint(client_entry->fingerprint, 20); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - if (usign_success || ssign_success) { - struct passwd *pw; - struct stat st; - - memset(filename2, 0, sizeof(filename2)); - - /* Filename for dir */ - tmp = fingerprint + strlen(fingerprint) - 9; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "friends" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), tmp); - - pw = getpwuid(getuid()); - if (!pw) - return; - - /* Create dir if it doesn't exist */ - if ((g_stat(filename, &st)) == -1) { - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - int ret = g_mkdir(filename, 0755); - if (ret < 0) - return; - } - } - } - - /* Save VCard */ - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "vcard", filename); - if (vcard.full_name) { - tmp = (char *)silc_vcard_encode(&vcard, &len); - silc_file_writefile(filename2, tmp, len); - silc_free(tmp); - } - - /* Save status message */ - if (message) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "status_message.mime", - filename); - tmp = (char *)silc_mime_get_data(message, &len); - silc_file_writefile(filename2, tmp, len); - silc_mime_free(message); - } - - /* Save extension data */ - if (extension) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "extension.mime", - filename); - tmp = (char *)silc_mime_get_data(extension, &len); - silc_file_writefile(filename2, tmp, len); - silc_mime_free(extension); - } - - /* Save user icon */ - if (usericon) { - const char *type = silc_mime_get_field(usericon, "Content-Type"); - if (type && - (!strcmp(type, "image/jpeg") || - !strcmp(type, "image/gif") || - !strcmp(type, "image/bmp") || - !strcmp(type, "image/png"))) { - const unsigned char *data; - SilcUInt32 data_len; - data = silc_mime_get_data(usericon, &data_len); - if (data) { - /* TODO: Check if SILC gives us something to use as the checksum instead */ - purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len, NULL); - } - } - silc_mime_free(usericon); - } - } - - /* Save the public key path to buddy properties, as it is used - to identify the buddy in the network (and not the nickname). */ - memset(filename, 0, sizeof(filename)); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - - /* Update online status */ - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - - /* Finally, start watching this user so we receive its status - changes from the server */ - g_snprintf(filename2, sizeof(filename2) - 1, "+%s", filename); - silc_client_command_call(r->client, r->conn, NULL, "WATCH", "-pubkey", - filename2, NULL); - - silc_hash_free(hash); - silc_free(fingerprint); - silc_free(r->offline_pk); - if (r->public_key) - silc_pkcs_public_key_free(r->public_key); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_import(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &r->public_key)) { - silcpurple_add_buddy_ask_pk_cb(r, 0); - purple_notify_error(r->client->application, - _("Add Buddy"), _("Could not load public key"), NULL); - return; - } - - /* Now verify the public key */ - r->offline_pk = silc_pkcs_public_key_encode(r->public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, purple_buddy_get_name(r->b), - SILC_CONN_CLIENT, r->public_key, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_ask_pk_cancel(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id) -{ - if (id != 0) { - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - /* Open file selector to select the public key. */ - purple_request_file(r->client->application, _("Open..."), NULL, FALSE, - G_CALLBACK(silcpurple_add_buddy_ask_import), - G_CALLBACK(silcpurple_add_buddy_ask_pk_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); - -} - -static void -silcpurple_add_buddy_ask_pk(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - purple_buddy_get_name(r->b)); - purple_request_action(r->client->application, _("Add Buddy"), tmp, - _("To add the buddy you must import his/her public key. " - "Press Import to import a public key."), 0, - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r, 2, - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb), - _("_Import..."), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb)); -} - -static SilcBool -silcpurple_add_buddy_getkey_cb(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap) -{ - SilcPurpleBuddyRes r = context; - SilcClientEntry client_entry; - - if (status != SILC_STATUS_OK) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return FALSE; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry || !client_entry->public_key) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return FALSE; - } - - /* Now verify the public key */ - silcpurple_verify_public_key(r->client, r->conn, client_entry->nickname, - SILC_CONN_CLIENT, client_entry->public_key, - silcpurple_add_buddy_save, r); - return TRUE; -} - -static void -silcpurple_add_buddy_select_cb(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - PurpleRequestField *f; - GList *list; - SilcClientEntry client_entry; - SilcDList clients; - - f = purple_request_fields_get_field(fields, "list"); - list = purple_request_field_list_get_selected(f); - if (!list) { - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - client_entry = purple_request_field_list_get_data(f, list->data); - clients = silc_dlist_init(); - silc_dlist_add(clients, client_entry); - silcpurple_add_buddy_resolved(r->client, r->conn, SILC_STATUS_OK, - clients, r); - silc_dlist_uninit(clients); -} - -static void -silcpurple_add_buddy_select_cancel(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_select(SilcPurpleBuddyRes r, SilcDList clients) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512], tmp2[128]; - char *fingerprint; - SilcClientEntry client_entry; - - fields = purple_request_fields_new(); - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields_add_group(fields, g); - - silc_dlist_start(clients); - while ((client_entry = silc_dlist_get(clients))) { - fingerprint = NULL; - if (*client_entry->fingerprint) { - fingerprint = silc_fingerprint(client_entry->fingerprint, 20); - g_snprintf(tmp2, sizeof(tmp2), "\n%s", fingerprint); - } - g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s", - client_entry->realname, client_entry->nickname, - client_entry->username, *client_entry->hostname ? - client_entry->hostname : "", - fingerprint ? tmp2 : ""); - purple_request_field_list_add(f, tmp, client_entry); - silc_free(fingerprint); - } - - purple_request_fields(r->client->application, _("Add Buddy"), - _("Select correct user"), - r->pubkey_search - ? _("More than one user was found with the same public key. Select " - "the correct user from the list to add to the buddy list.") - : _("More than one user was found with the same name. Select " - "the correct user from the list to add to the buddy list."), - fields, - _("OK"), G_CALLBACK(silcpurple_add_buddy_select_cb), - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_select_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); -} - -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcAttributePayload pub; - SilcAttributeObjPk userpk; - const char *filename; - SilcClientEntry client_entry = NULL; - SilcUInt16 cmd_ident; - const char *name; - - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - - /* If the buddy is offline/nonexistent, we will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - if (!clients) { - if (r->init) { - silc_free(r); - return; - } - - r->offline = TRUE; - /* If the user has already associated a public key, try loading it - * before prompting the user to load it again */ - if (filename != NULL) - silcpurple_add_buddy_ask_import(r, filename); - else - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* If more than one client was found with nickname, we need to verify - from user which one is the correct. */ - if (silc_dlist_count(clients) > 1 && !r->pubkey_search) { - if (r->init) { - silc_free(r); - return; - } - - silcpurple_add_buddy_select(r, clients); - return; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - name = purple_buddy_get_name(b); - - /* If we searched using public keys and more than one entry was found - the same person is logged on multiple times. */ - if (silc_dlist_count(clients) > 1 && r->pubkey_search && name) { - if (r->init) { - /* Find the entry that closest matches to the - buddy nickname. */ - SilcClientEntry entry; - silc_dlist_start(clients); - while ((entry = silc_dlist_get(clients))) { - if (!g_ascii_strncasecmp(name, entry->nickname, - strlen(name))) { - client_entry = entry; - break; - } - } - } else { - /* Verify from user which one is correct */ - silcpurple_add_buddy_select(r, clients); - return; - } - } - - /* The client was found. Now get its public key and verify - that before adding the buddy. */ - memset(&userpk, 0, sizeof(userpk)); - purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id, sizeof(client_entry->id))); - r->client_id = client_entry->id; - - /* Get the public key from attributes, if not present then - resolve it with GETKEY unless we have it cached already. */ - if (client_entry->attrs && !client_entry->public_key) { - pub = silcpurple_get_attr(client_entry->attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY); - if (!pub || !silc_attribute_get_object(pub, (void *)&userpk, - sizeof(userpk))) { - /* Get public key with GETKEY */ - cmd_ident = - silc_client_command_call(client, conn, NULL, - "GETKEY", client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - cmd_ident, - silcpurple_add_buddy_getkey_cb, - r); - return; - } - if (!silc_pkcs_public_key_alloc(SILC_PKCS_SILC, - userpk.data, userpk.data_len, - &client_entry->public_key)) - return; - silc_free(userpk.data); - } else if (filename && !client_entry->public_key) { - if (!silc_pkcs_load_public_key(filename, &client_entry->public_key)) { - /* Get public key with GETKEY */ - cmd_ident = - silc_client_command_call(client, conn, NULL, - "GETKEY", client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - cmd_ident, - silcpurple_add_buddy_getkey_cb, - r); - return; - } - } else if (!client_entry->public_key) { - /* Get public key with GETKEY */ - cmd_ident = - silc_client_command_call(client, conn, NULL, - "GETKEY", client_entry->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - cmd_ident, - silcpurple_add_buddy_getkey_cb, - r); - return; - } - - /* We have the public key, verify it. */ - silcpurple_verify_public_key(client, conn, client_entry->nickname, - SILC_CONN_CLIENT, - client_entry->public_key, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPurpleBuddyRes r; - SilcBuffer attrs; - const char *filename, *name = purple_buddy_get_name(b); - - r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->client = client; - r->conn = conn; - r->b = b; - r->init = init; - - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - SilcPublicKey public_key; - SilcAttributeObjPk userpk; - - if (!silc_pkcs_load_public_key(filename, &public_key)) - return; - - /* Get all attributes, and use the public key to search user */ - name = NULL; - attrs = silc_client_attributes_request(SILC_ATTRIBUTE_USER_INFO, - SILC_ATTRIBUTE_SERVICE, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_ATTRIBUTE_STATUS_FREETEXT, - SILC_ATTRIBUTE_STATUS_MESSAGE, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_ATTRIBUTE_TIMEZONE, - SILC_ATTRIBUTE_GEOLOCATION, - SILC_ATTRIBUTE_USER_ICON, - SILC_ATTRIBUTE_DEVICE_INFO, 0); - userpk.type = "silc-rsa"; - userpk.data = silc_pkcs_public_key_encode(public_key, &userpk.data_len); - attrs = silc_attribute_payload_encode(attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY, - SILC_ATTRIBUTE_FLAG_VALID, - &userpk, sizeof(userpk)); - silc_free(userpk.data); - silc_pkcs_public_key_free(public_key); - r->pubkey_search = TRUE; - } else { - /* Get all attributes */ - attrs = silc_client_attributes_request(0); - } - - /* Resolve */ - silc_client_get_clients_whois(client, conn, name, NULL, attrs, - silcpurple_add_buddy_resolved, r); - silc_buffer_free(attrs); -} - -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - /* Don't add if the buddy is already on the list. - * - * SILC doesn't have groups, so we also don't need to do anything - * for a move. */ - if (purple_buddy_get_protocol_data(buddy) == NULL) - silcpurple_add_buddy_i(gc, buddy, FALSE); -} - -void silcpurple_send_buddylist(PurpleConnection *gc) -{ - GSList *buddies; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) - { - PurpleBuddy *buddy = buddies->data; - silcpurple_add_buddy_i(gc, buddy, TRUE); - } -} - -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - silc_free(purple_buddy_get_protocol_data(buddy)); -} - -void silcpurple_idle_set(PurpleConnection *gc, int idle) - -{ - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - SilcAttributeObjService service; - const char *server; - int port; - - sg = gc->proto_data; - if (sg == NULL) - return; - - client = sg->client; - if (client == NULL) - return; - - conn = sg->conn; - if (conn == NULL) - return; - - server = purple_account_get_string(sg->account, "server", - "silc.silcnet.org"); - port = purple_account_get_int(sg->account, "port", 706), - - memset(&service, 0, sizeof(service)); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - service.port = port; - g_snprintf(service.address, sizeof(service.address), "%s", server); - service.idle = idle; - silc_client_attribute_add(client, conn, SILC_ATTRIBUTE_SERVICE, - &service, sizeof(service)); -} - -char *silcpurple_status_text(PurpleBuddy *b) -{ - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = purple_buddy_get_protocol_data(b); - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return NULL; - - /* If user is online, we show the mood status, if available. - If user is offline or away that status is indicated. */ - - if (client_entry->mode & SILC_UMODE_DETACHED) - return g_strdup(_("Detached")); - if (client_entry->mode & SILC_UMODE_GONE) - return g_strdup(_("Away")); - if (client_entry->mode & SILC_UMODE_INDISPOSED) - return g_strdup(_("Indisposed")); - if (client_entry->mode & SILC_UMODE_BUSY) - return g_strdup(_("Busy")); - if (client_entry->mode & SILC_UMODE_PAGE) - return g_strdup(_("Wake Me Up")); - if (client_entry->mode & SILC_UMODE_HYPER) - return g_strdup(_("Hyper Active")); - if (client_entry->mode & SILC_UMODE_ROBOT) - return g_strdup(_("Robot")); - - attr = silcpurple_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - /* The mood is a bit mask, so we could show multiple moods, - but let's show only one for now. */ - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - return g_strdup(_("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - return g_strdup(_("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - return g_strdup(_("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - return g_strdup(_("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - return g_strdup(_("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - return g_strdup(_("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - return g_strdup(_("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - return g_strdup(_("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - return g_strdup(_("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - return g_strdup(_("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - return g_strdup(_("Anxious")); - } - - return NULL; -} - -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = purple_buddy_get_protocol_data(b); - SilcClientEntry client_entry; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - char tmp[256]; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return; - - if (client_entry->nickname) - purple_notify_user_info_add_pair(user_info, _("Nickname"), - client_entry->nickname); - if (client_entry->username && client_entry->hostname) { - g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - } - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - - if (statusstr) { - purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); - g_free(statusstr); - } - - if (full) { - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - } -} - -static void -silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(b)); - sg = gc->proto_data; - - /* Call KILL */ - silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - purple_buddy_get_name(b), "Killed by operator", NULL); -} - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; -} *SilcPurpleBuddyWb; - -static void -silcpurple_buddy_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleBuddyWb wb = data; - silcpurple_wb_init(wb->sg, wb->client_entry); - silc_free(wb); -} - -GList *silcpurple_buddy_menu(PurpleBuddy *buddy) -{ - PurpleAccount *account = purple_buddy_get_account(buddy); - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *pkfile = NULL; - SilcClientEntry client_entry = NULL; - PurpleMenuAction *act; - GList *m = NULL; - SilcPurpleBuddyWb wb; - - pkfile = purple_blist_node_get_string((PurpleBlistNode *) buddy, "public-key"); - client_entry = silc_client_get_client_by_id(sg->client, - sg->conn, - purple_buddy_get_protocol_data(buddy)); - - if (client_entry && - silc_client_private_message_key_is_set(sg->client, - sg->conn, client_entry)) { - act = purple_menu_action_new(_("Reset IM Key"), - PURPLE_CALLBACK(silcpurple_buddy_resetkey), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("IM with Key Exchange"), - PURPLE_CALLBACK(silcpurple_buddy_keyagr), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("IM with Password"), - PURPLE_CALLBACK(silcpurple_buddy_privkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (pkfile) { - act = purple_menu_action_new(_("Show Public Key"), - PURPLE_CALLBACK(silcpurple_buddy_showkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("Get Public Key..."), - PURPLE_CALLBACK(silcpurple_buddy_getkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (conn && conn->local_entry->mode & SILC_UMODE_ROUTER_OPERATOR) { - act = purple_menu_action_new(_("Kill User"), - PURPLE_CALLBACK(silcpurple_buddy_kill), - NULL, NULL); - m = g_list_append(m, act); - } - - if (client_entry) { - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->client_entry = client_entry; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_buddy_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - return m; -} - -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcMime mime; - char type[32]; - const char *t; - - /* Remove */ - if (!img) { - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_ICON, NULL); - return; - } - - /* Add */ - mime = silc_mime_alloc(); - if (!mime) - return; - - t = purple_imgstore_get_extension(img); - if (!t || !strcmp(t, "icon")) { - silc_mime_free(mime); - return; - } - if (!strcmp(t, "jpg")) - t = "jpeg"; - g_snprintf(type, sizeof(type), "image/%s", t); - silc_mime_add_field(mime, "Content-Type", type); - silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img)); - - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_ICON, mime, sizeof(*mime)); - - silc_mime_free(mime); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1434 +0,0 @@ -/* - - silcpurple_chat.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Channel Routines ******************************/ - -GList *silcpurple_chat_info(PurpleConnection *gc) -{ - GList *ci = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - ci = g_list_append(ci, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Passphrase:"); - pce->identifier = "passphrase"; - pce->secret = TRUE; - ci = g_list_append(ci, pce); - - return ci; -} - -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); - -static void -silcpurple_chat_getinfo_res(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList channels, - void *context) -{ - GHashTable *components = context; - PurpleConnection *gc = client->application; - const char *chname; - char tmp[256]; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - - if (!channels) { - g_snprintf(tmp, sizeof(tmp), - _("Channel %s does not exist in the network"), chname); - purple_notify_error(gc, _("Channel Information"), - _("Cannot get channel information"), tmp); - return; - } - - silcpurple_chat_getinfo(gc, components); -} - - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) -{ - SilcPurple sg = gc->proto_data; - const char *chname; - char tmp[256], *tmp2; - GString *s; - SilcChannelEntry channel; - SilcHashTableList htl; - SilcChannelUser chu; - - if (!components) - return; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - silc_client_get_channel_resolve(sg->client, sg->conn, - (char *)chname, - silcpurple_chat_getinfo_res, - components); - return; - } - - s = g_string_new(""); - tmp2 = g_markup_escape_text(channel->channel_name, -1); - g_string_append_printf(s, _("Channel Name: %s"), tmp2); - g_free(tmp2); - if (channel->user_list && silc_hash_table_count(channel->user_list)) - g_string_append_printf(s, _("
User Count: %d"), - (int)silc_hash_table_count(channel->user_list)); - - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - tmp2 = g_markup_escape_text(chu->client->nickname, -1); - g_string_append_printf(s, _("
Channel Founder: %s"), - tmp2); - g_free(tmp2); - break; - } - } - silc_hash_table_list_reset(&htl); - - if (channel->cipher) - g_string_append_printf(s, _("
Channel Cipher: %s"), - channel->cipher); - - if (channel->hmac) - /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ - g_string_append_printf(s, _("
Channel HMAC: %s"), - channel->hmac); - - if (channel->topic) { - tmp2 = g_markup_escape_text(channel->topic, -1); - g_string_append_printf(s, _("
Channel Topic:
%s"), tmp2); - g_free(tmp2); - } - - if (channel->mode) { - g_string_append_printf(s, _("
Channel Modes: ")); - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - g_string_append(s, tmp); - } - - if (channel->founder_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); - if (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - g_string_append_printf(s, _("
Founder Key Fingerprint:
%s"), fingerprint); - g_string_append_printf(s, _("
Founder Key Babbleprint:
%s"), babbleprint); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - } - - purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, s->str, NULL, NULL); - g_string_free(s, TRUE); -} - - -static void -silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat = (PurpleChat *)node; - PurpleAccount *account = purple_chat_get_account(chat); - silcpurple_chat_getinfo(purple_account_get_connection(account), - purple_chat_get_components(chat)); -} - - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ -/************************** Channel Invite List ******************************/ - -static void -silcpurple_chat_invitelist(PurpleBlistNode *node, gpointer data); -{ - -} - - -/**************************** Channel Ban List *******************************/ - -static void -silcpurple_chat_banlist(PurpleBlistNode *node, gpointer data); -{ - -} -#endif - - -/************************* Channel Authentication ****************************/ - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; - PurpleChat *c; - SilcDList pubkeys; -} *SilcPurpleChauth; - -static void -silcpurple_chat_chpk_add(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - unsigned char mode[4]; - SilcUInt32 m; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key)) { - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_dlist_uninit(sgc->pubkeys); - silc_free(sgc); - purple_notify_error(client->application, - _("Add Channel Public Key"), - _("Could not load public key"), NULL); - return; - } - - pk = silc_public_key_payload_encode(public_key); - chpks = silc_buffer_alloc_size(2); - SILC_PUT16_MSB(1, chpks->head); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - silc_buffer_len(pk), 0x00); - silc_buffer_free(pk); - - m = sgc->channel->mode; - m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - silcpurple_command_reply, NULL, 3, - 1, chidp->data, silc_buffer_len(chidp), - 2, mode, sizeof(mode), - 9, chpks->data, silc_buffer_len(chpks)); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cancel(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPublicKey public_key; - - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - GList *list; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - SilcUInt16 c = 0, ct; - unsigned char mode[4]; - SilcUInt32 m; - - f = purple_request_fields_get_field(fields, "list"); - if (!purple_request_field_list_get_selected(f)) { - /* Add new public key */ - purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, - G_CALLBACK(silcpurple_chat_chpk_add), - G_CALLBACK(silcpurple_chat_chpk_cancel), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - - list = purple_request_field_list_get_items(f); - chpks = silc_buffer_alloc_size(2); - - for (ct = 0; list; list = list->next, ct++) { - public_key = purple_request_field_list_get_data(f, list->data); - if (purple_request_field_list_is_selected(f, list->data)) { - /* Delete this public key */ - pk = silc_public_key_payload_encode(public_key); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - silc_buffer_len(pk), 0x01); - silc_buffer_free(pk); - c++; - } - } - if (!c) { - silc_buffer_free(chpks); - return; - } - SILC_PUT16_MSB(c, chpks->head); - - m = sgc->channel->mode; - if (ct == c) - m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(&sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - silcpurple_command_reply, NULL, 3, - 1, chidp->data, silc_buffer_len(chidp), - 2, mode, sizeof(mode), - 9, chpks->data, silc_buffer_len(chpks)); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -static void -silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - PurpleRequestField *f; - SilcPublicKey public_key; - const char *curpass, *val; - int set; - - f = purple_request_fields_get_field(fields, "passphrase"); - val = purple_request_field_string_get_value(f); - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - if (!val && curpass) - set = 0; - else if (val && !curpass) - set = 1; - else if (val && curpass && strcmp(val, curpass)) - set = 1; - else - set = -1; - - if (set == 1) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "+a", val, NULL); - purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); - } else if (set == 0) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "-a", NULL); - purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); - } - - if (sgc->pubkeys) { - silc_dlist_start(sgc->pubkeys); - while ((public_key = silc_dlist_get(sgc->pubkeys))) - silc_pkcs_public_key_free(public_key); - silc_dlist_uninit(sgc->pubkeys); - } - silc_free(sgc); -} - -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcDList channel_pubkeys) -{ - SilcPublicKey public_key; - SilcSILCPublicKey silc_pubkey; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint, *babbleprint; - SilcPublicKeyIdentifier ident; - char tmp2[1024], t[512]; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcPurpleChauth sgc; - const char *curpass = NULL; - - sgc = silc_calloc(1, sizeof(*sgc)); - if (!sgc) - return; - sgc->sg = sg; - sgc->channel = channel; - - fields = purple_request_fields_new(); - - if (sgc->c) - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), - curpass, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l1", _("Channel Public Keys List")); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(t, sizeof(t), - _("Channel authentication is used to secure the channel from " - "unauthorized access. The authentication may be based on " - "passphrase and digital signatures. If passphrase is set, it " - "is required to be able to join. If channel public keys are set " - "then only users whose public keys are listed are able to join.")); - - if (!channel_pubkeys || !silc_dlist_count(channel_pubkeys)) { - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - if (channel_pubkeys) - silc_dlist_uninit(channel_pubkeys); - return; - } - sgc->pubkeys = channel_pubkeys; - - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - silc_dlist_start(channel_pubkeys); - while ((public_key = silc_dlist_get(channel_pubkeys))) { - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - continue; - fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); - babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); - - silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key); - ident = &silc_pubkey->identifier; - - g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", - ident->realname ? ident->realname : ident->username ? - ident->username : "", fingerprint, babbleprint); - purple_request_field_list_add(f, tmp2, public_key); - - silc_free(fingerprint); - silc_free(babbleprint); - } - - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); -} - -static void -silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+C", NULL); -} - - -/************************** Channel Private Groups **************************/ - -/* Private groups are "virtual" channels. They are groups inside a channel. - This is implemented by using channel private keys. By knowing a channel - private key user becomes part of that group and is able to talk on that - group. Other users, on the same channel, won't be able to see the - messages of that group. It is possible to have multiple groups inside - a channel - and thus having multiple private keys on the channel. */ - -typedef struct { - SilcPurple sg; - PurpleChat *c; - const char *channel; -} *SilcPurpleCharPrv; - -static void -silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - SilcPurple sg = p->sg; - char tmp[512]; - PurpleRequestField *f; - const char *name, *passphrase, *alias; - GHashTable *comp; - PurpleGroup *g; - PurpleChat *cn; - - f = purple_request_fields_get_field(fields, "name"); - name = purple_request_field_string_get_value(f); - if (!name) { - silc_free(p); - return; - } - f = purple_request_fields_get_field(fields, "passphrase"); - passphrase = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "alias"); - alias = purple_request_field_string_get_value(f); - - /* Add private group to buddy list */ - g_snprintf(tmp, sizeof(tmp), "%s [Private Group]", name); - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - g_hash_table_replace(comp, "channel", g_strdup(tmp)); - g_hash_table_replace(comp, "passphrase", g_strdup(passphrase)); - - cn = purple_chat_new(sg->account, alias, comp); - g = purple_chat_get_group(p->c); - purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); - - /* Associate to a real channel */ - purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); - - /* Join the group */ - silcpurple_chat_join(sg->gc, comp); - - silc_free(p); -} - -static void -silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - silc_free(p); -} - -static void -silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleCharPrv p; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->sg = sg; - - p->channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); - p->c = purple_blist_find_chat(sg->account, p->channel); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("name", _("Group Name"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("passphrase", _("Passphrase"), - NULL, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("alias", _("Alias"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(tmp, sizeof(tmp), - _("Please enter the %s channel private group name and passphrase."), - p->channel); - purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, - _("Add"), G_CALLBACK(silcpurple_chat_prv_add), - _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), - purple_connection_get_account(gc), NULL, NULL, p); -} - - -/****************************** Channel Modes ********************************/ - -static void -silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-f", NULL); -} - -static void -silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - const char *channel; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - if (!sg->conn) - return; - - /* XXX we should have ability to define which founder - key to use. Now we use the user's own public key - (default key). */ - - /* Call CMODE */ - channel = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, - "+f", NULL); -} - -typedef struct { - SilcPurple sg; - char *channel; -} *SilcPurpleChatInput; - -static void -silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) -{ - SilcChannelEntry channel; - int ulimit = 0; - - channel = silc_client_get_channel(s->sg->client, s->sg->conn, - (char *)s->channel); - if (!channel) - return; - if (limit) - ulimit = atoi(limit); - - if (!limit || !(*limit) || *limit == '0') { - if (limit && ulimit == channel->user_limit) { - g_free(s->channel); - silc_free(s); - return; - } - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "-l", NULL); - - g_free(s->channel); - silc_free(s); - return; - } - - if (ulimit == channel->user_limit) { - g_free(s->channel); - silc_free(s); - return; - } - - /* Call CMODE */ - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "+l", limit, NULL); - - g_free(s->channel); - silc_free(s); -} - -static void -silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleChatInput s; - SilcChannelEntry channel; - char *ch; - char tmp[32]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - if (!sg->conn) - return; - - ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel")); - channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); - if (!channel) - return; - - s = silc_calloc(1, sizeof(*s)); - if (!s) - return; - s->channel = ch; - s->sg = sg; - g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); - purple_request_input(gc, _("User Limit"), NULL, - _("Set user limit on channel. Set to zero to reset user limit."), - tmp, FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), - _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), - purple_connection_get_account(gc), NULL, NULL, s); -} - -static void -silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-t", NULL); -} - -static void -silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+t", NULL); -} - -static void -silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-p", NULL); -} - -static void -silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+p", NULL); -} - -static void -silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "-s", NULL); -} - -static void -silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(purple_chat_get_account(chat)); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(purple_chat_get_components(chat), "channel"), - "+s", NULL); -} - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; -} *SilcPurpleChatWb; - -static void -silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleChatWb wb = data; - silcpurple_wb_init_ch(wb->sg, wb->channel); - silc_free(wb); -} - -GList *silcpurple_chat_menu(PurpleChat *chat) -{ - GHashTable *components = purple_chat_get_components(chat); - PurpleConnection *gc = purple_account_get_connection(purple_chat_get_account(chat)); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *chname = NULL; - SilcChannelEntry channel = NULL; - SilcChannelUser chu = NULL; - SilcUInt32 mode = 0; - - GList *m = NULL; - PurpleMenuAction *act; - - if (components) - chname = g_hash_table_lookup(components, "channel"); - if (chname) - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (channel) { - chu = silc_client_on_channel(channel, conn->local_entry); - if (chu) - mode = chu->mode; - } - - if (strstr(chname, "[Private Group]")) - return NULL; - - act = purple_menu_action_new(_("Get Info"), - PURPLE_CALLBACK(silcpurple_chat_getinfo_menu), - NULL, NULL); - m = g_list_append(m, act); - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Invite List"), - PURPLE_CALLBACK(silcpurple_chat_invitelist), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Ban List"), - PURPLE_CALLBACK(silcpurple_chat_banlist), - NULL, NULL); - m = g_list_append(m, act); - } -#endif - - if (chu) { - act = purple_menu_action_new(_("Add Private Group"), - PURPLE_CALLBACK(silcpurple_chat_prv), - NULL, NULL); - m = g_list_append(m, act); - } - - if (chu && mode & SILC_CHANNEL_UMODE_CHANFO) { - act = purple_menu_action_new(_("Channel Authentication"), - PURPLE_CALLBACK(silcpurple_chat_chauth), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { - act = purple_menu_action_new(_("Reset Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent_reset), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (chu && mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Set User Limit"), - PURPLE_CALLBACK(silcpurple_chat_ulimit), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { - act = purple_menu_action_new(_("Reset Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_resettopic), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_settopic), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { - act = purple_menu_action_new(_("Reset Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetprivate), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_setprivate), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_SECRET) { - act = purple_menu_action_new(_("Reset Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetsecret), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_setsecret), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (chu && channel) { - SilcPurpleChatWb wb; - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->channel = channel; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_chat_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - - return m; -} - - -/******************************* Joining Etc. ********************************/ - -char *silcpurple_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - const char *channel, *passphrase, *parentch; - - if (!conn) - return; - - channel = g_hash_table_lookup(data, "channel"); - passphrase = g_hash_table_lookup(data, "passphrase"); - - /* Check if we are joining a private group. Handle it - purely locally as it's not a real channel */ - if (strstr(channel, "[Private Group]")) { - SilcChannelEntry channel_entry; - SilcChannelPrivateKey key; - PurpleChat *c; - SilcPurplePrvgrp grp; - - c = purple_blist_find_chat(sg->account, channel); - parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); - if (!parentch) - return; - - channel_entry = silc_client_get_channel(sg->client, sg->conn, - (char *)parentch); - if (!channel_entry || - !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), - _("You have to join the %s channel before you are " - "able to join the private group"), parentch); - purple_notify_error(gc, _("Join Private Group"), - _("Cannot join private group"), tmp); - return; - } - - /* Add channel private key */ - if (!silc_client_add_channel_private_key(client, conn, - channel_entry, channel, - NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), &key)) - return; - - /* Join the group */ - grp = silc_calloc(1, sizeof(*grp)); - if (!grp) - return; - grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; - grp->chid = SILC_PTR_TO_32(channel_entry->context); - grp->parentch = parentch; - grp->channel = channel; - grp->key = key; - sg->grps = g_list_append(sg->grps, grp); - serv_got_joined_chat(gc, grp->id, channel); - return; - } - - /* XXX We should have other properties here as well: - 1. whether to try to authenticate to the channel - 1a. with default key, - 1b. with specific key. - 2. whether to try to authenticate to become founder. - 2a. with default key, - 2b. with specific key. - - Since now such variety is not possible in the join dialog - we always use -founder and -auth options, which try to - do both 1 and 2 with default keys. */ - - /* Call JOIN */ - if ((passphrase != NULL) && (*passphrase != '\0')) - silc_client_command_call(client, conn, NULL, "JOIN", - channel, passphrase, "-auth", "-founder", NULL); - else - silc_client_command_call(client, conn, NULL, "JOIN", - channel, "-auth", "-founder", NULL); -} - -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if we are inviting on a private group. Invite - to the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call INVITE */ - silc_client_command_call(client, conn, NULL, "INVITE", - chu->channel->channel_name, - name, NULL); -} - -void silcpurple_chat_leave(PurpleConnection *gc, int id) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - GList *l; - SilcPurplePrvgrp prv; - - if (!conn) - return; - - /* See if we are leaving a private group */ - if (id > SILCPURPLE_PRVGRP) { - SilcChannelEntry channel; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) - return; - silc_client_del_channel_private_key(client, conn, - channel, prv->key); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - serv_got_chat_left(gc, id); - return; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call LEAVE */ - silc_client_command_call(client, conn, NULL, "LEAVE", - chu->channel->channel_name, NULL); - - serv_got_chat_left(gc, id); - - /* Leave from private groups on this channel as well */ - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->chid == id) { - prv = l->data; - silc_client_del_channel_private_key(client, conn, - chu->channel, - prv->key); - serv_got_chat_left(gc, prv->id); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - if (!sg->grps) - break; - } -} - -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, - PurpleMessageFlags msgflags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - SilcChannelEntry channel = NULL; - SilcChannelPrivateKey key = NULL; - SilcUInt32 flags; - int ret = 0; - char *msg2, *tmp; - gboolean found = FALSE; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - SilcDList list; - - if (!msg || !conn) - return 0; - - flags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg2 = purple_unescape_html(msg); - - if (!g_ascii_strncasecmp(msg2, "/me ", 4)) - { - msg2 += 4; - if (!*msg2) { - g_free(tmp); - return 0; - } - flags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (sign) - flags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Get the channel private key if we are sending on - private group */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) { - g_free(tmp); - return 0; - } - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) { - g_free(tmp); - return 0; - } - key = prv->key; - } - - if (!channel) { - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) { - g_free(tmp); - return 0; - } - channel = chu->channel; - } - - /* Check for images */ - if (msgflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(msg, &flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_channel_message(client, conn, - channel, key, - flags, sg->sha1hash, - buf->data, - silc_buffer_len(buf)); - silc_mime_partial_free(list); - g_free(tmp); - - if (ret) - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, time(NULL)); - return ret; - } - } - - /* Send channel message */ - ret = silc_client_send_channel_message(client, conn, channel, key, - flags, sg->sha1hash, - (unsigned char *)msg2, - strlen(msg2)); - if (ret) { - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, - time(NULL)); - } - g_free(tmp); - - return ret; -} - -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if setting topic on private group. Set it - on the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call TOPIC */ - silc_client_command_call(client, conn, NULL, "TOPIC", - chu->channel->channel_name, topic, NULL); -} - -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - GList *fields = NULL; - PurpleRoomlistField *f; - - if (!conn) - return NULL; - - if (sg->roomlist) - purple_roomlist_unref(sg->roomlist); - - sg->roomlist_canceled = FALSE; - - sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, - _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, - _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - purple_roomlist_set_fields(sg->roomlist, fields); - - /* Call LIST */ - silc_client_command_call(client, conn, "LIST"); - - purple_roomlist_set_in_progress(sg->roomlist, TRUE); - - return sg->roomlist; -} - -void silcpurple_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - if (sg->roomlist == list) { - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - sg->roomlist_canceled = TRUE; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,488 +0,0 @@ -/* - - silcpurple_ft.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" - -/****************************** File Transfer ********************************/ - -/* This implements the secure file transfer protocol (SFTP) using the SILC - SFTP library implementation. The API we use from the SILC Toolkit is the - SILC Client file transfer API, as it provides a simple file transfer we - need in this case. We could use the SILC SFTP API directly, but it would - be an overkill since we'd effectively re-implement the file transfer what - the SILC Client's file transfer API already provides. - - From Purple we do NOT use the FT API to do the transfer as it is very limiting. - In fact it does not suite to file transfers like SFTP at all. For example, - it assumes that read operations are synchronous what they are not in SFTP. - It also assumes that the file transfer socket is to be handled by the Purple - eventloop, and this naturally is something we don't want to do in case of - SILC Toolkit. The FT API suites well to purely stream based file transfers - like HTTP GET and similar. - - For this reason, we directly access the Purple GKT FT API and hack the FT - API to merely provide the user interface experience and all the magic - is done in the SILC Toolkit. Ie. we update the statistics information in - the FT API for user interface, and that's it. A bit dirty but until the - FT API gets better this is the way to go. Good thing that FT API allowed - us to do this. */ - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; - SilcUInt32 session_id; - char *hostname; - SilcUInt16 port; - PurpleXfer *xfer; - - SilcClientFileName completion; - void *completion_context; -} *SilcPurpleXfer; - -static void -silcpurple_ftp_monitor(SilcClient client, - SilcClientConnection conn, - SilcClientMonitorStatus status, - SilcClientFileError error, - SilcUInt64 offset, - SilcUInt64 filesize, - SilcClientEntry client_entry, - SilcUInt32 session_id, - const char *filepath, - void *context) -{ - SilcPurpleXfer xfer = context; - PurpleConnection *gc = xfer->sg->gc; - char tmp[256]; - - if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { - /* All started sessions terminate here */ - xfer->xfer->data = NULL; - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_DISCONNECT) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Remote disconnected")); - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(client, conn, session_id); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) - return; - - if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { - if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { - g_snprintf(tmp, sizeof(tmp), "No such file %s", - filepath ? filepath : "[N/A]"); - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), tmp); - } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Permission denied")); - } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Key agreement failed")); - } else if (error == SILC_CLIENT_FILE_TIMEOUT) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Connection timed out")); - } else if (error == SILC_CLIENT_FILE_CONNECT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Creating connection failed")); - } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("File transfer session does not exist")); - } - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(client, conn, session_id); - return; - } - - /* Update file transfer UI */ - if (!offset && filesize) - purple_xfer_set_size(xfer->xfer, filesize); - if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; - } - purple_xfer_update_progress(xfer->xfer); - - if (status == SILC_CLIENT_FILE_MONITOR_SEND || - status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { - if (offset == filesize) { - /* Download finished */ - purple_xfer_set_completed(xfer->xfer, TRUE); - silc_client_file_close(client, conn, session_id); - } - } -} - -static void -silcpurple_ftp_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - if (!xfer) - return; - - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - if (!xfer) - return; - - /* Cancel the transmission */ - xfer->completion(NULL, xfer->completion_context); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_ok(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - - if (!xfer) - return; - - name = purple_xfer_get_local_filename(x); - g_unlink(name); - xfer->completion(name, xfer->completion_context); -} - -static void -silcpurple_ftp_ask_name(SilcClient client, - SilcClientConnection conn, - SilcUInt32 session_id, - const char *remote_filename, - SilcClientFileName completion, - void *completion_context, - void *context) -{ - SilcPurpleXfer xfer = context; - - xfer->completion = completion; - xfer->completion_context = completion_context; - - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_ask_name_ok); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_ask_name_cancel); - - /* Request to save the file */ - purple_xfer_set_filename(xfer->xfer, remote_filename); - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_request_result(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - SilcClientFileError status; - PurpleConnection *gc = xfer->sg->gc; - SilcClientConnectionParams params; - gboolean local = xfer->hostname ? FALSE : TRUE; - char *local_ip = NULL, *remote_ip = NULL; - SilcSocket sock; - - if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) - return; - if (!xfer) - return; - - silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), - &sock, NULL, NULL, NULL); - - if (local) { - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = TRUE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - } - - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - if (local) - /* Provide connection point */ - params.local_ip = local_ip; - - /* Start the file transfer */ - status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn, - ¶ms, xfer->sg->public_key, - xfer->sg->private_key, - silcpurple_ftp_monitor, xfer, - NULL, xfer->session_id, - silcpurple_ftp_ask_name, xfer); - switch (status) { - case SILC_CLIENT_FILE_OK: - silc_free(local_ip); - silc_free(remote_ip); - return; - break; - - case SILC_CLIENT_FILE_UNKNOWN_SESSION: - purple_notify_error(gc, _("Secure File Transfer"), - _("No file transfer session active"), NULL); - break; - - case SILC_CLIENT_FILE_ALREADY_STARTED: - purple_notify_error(gc, _("Secure File Transfer"), - _("File transfer already started"), NULL); - break; - - case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not perform key agreement for file transfer"), - NULL); - break; - - default: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not start the file transfer"), NULL); - break; - } - - /* Error */ - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_request_denied(PurpleXfer *x) -{ - -} - -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleXfer xfer; - - xfer = silc_calloc(1, sizeof(*xfer)); - if (!xfer) { - silc_client_file_close(sg->client, sg->conn, session_id); - return; - } - - xfer->sg = sg; - xfer->client_entry = client_entry; - xfer->session_id = session_id; - xfer->hostname = g_strdup(hostname); - xfer->port = port; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_RECEIVE, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_request_result); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); - xfer->xfer->remote_ip = g_strdup(hostname); - xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; - - /* File transfer request */ - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_send_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - if (!xfer) - return; - - /* This call will free all resources */ - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_send(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - SilcClientConnectionParams params; - SilcSocket sock; - - if (!xfer) - return; - - name = purple_xfer_get_local_filename(x); - - silc_socket_stream_get_info(silc_packet_stream_get_stream(xfer->sg->conn->stream), - &sock, NULL, NULL, NULL); - - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = FALSE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - - memset(¶ms, 0, sizeof(params)); - params.timeout_secs = 60; - if (local) - /* Provide connection point */ - params.local_ip = local_ip; - - /* Send the file */ - silc_client_file_send(xfer->sg->client, xfer->sg->conn, - xfer->client_entry, ¶ms, - xfer->sg->public_key, xfer->sg->private_key, - silcpurple_ftp_monitor, xfer, - name, &xfer->session_id); - - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_send_file_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - PurpleConnection *gc = client->application; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(gc, _("Secure File Transfer"), - _("Cannot send file"), tmp); - g_free(context); - return; - } - - silcpurple_ftp_send_file(client->application, (const char *)context, NULL); - g_free(context); -} - -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcDList clients; - SilcPurpleXfer xfer; - - g_return_val_if_fail(name != NULL, NULL); - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, name, FALSE); - if (!clients) { - silc_client_get_clients(client, conn, name, NULL, - silcpurple_ftp_send_file_resolved, - g_strdup(name)); - return NULL; - } - silc_dlist_start(clients); - - xfer = silc_calloc(1, sizeof(*xfer)); - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->sg = sg; - xfer->client_entry = silc_dlist_get(clients); - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_SEND, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_free(xfer); - return NULL; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; - - silc_free(clients); - - return xfer->xfer; -} - -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file) -{ - PurpleXfer *xfer = silcpurple_ftp_new_xfer(gc, name); - - g_return_if_fail(xfer != NULL); - - /* Choose file to send */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SILCSOURCES = \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - silc.c \ - silcpurple.h \ - util.c \ - wb.c \ - wb.h - -AM_CFLAGS = $(st) - -libsilcpurple_la_LDFLAGS = -module -avoid-version - -if STATIC_SILC - -st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -noinst_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -libsilcpurple_la_LIBADD = $(SILC_LIBS) - -else - -st = $(SILC_CFLAGS) -pkg_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,815 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/silc -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_SILC_FALSE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@STATIC_SILC_TRUE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_TRUE@ $(am__DEPENDENCIES_1) -am__libsilcpurple_la_SOURCES_DIST = buddy.c chat.c ft.c ops.c pk.c \ - silc.c silcpurple.h util.c wb.c wb.h -am__objects_1 = libsilcpurple_la-buddy.lo libsilcpurple_la-chat.lo \ - libsilcpurple_la-ft.lo libsilcpurple_la-ops.lo \ - libsilcpurple_la-pk.lo libsilcpurple_la-silc.lo \ - libsilcpurple_la-util.lo libsilcpurple_la-wb.lo -@STATIC_SILC_FALSE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -@STATIC_SILC_TRUE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -libsilcpurple_la_OBJECTS = $(am_libsilcpurple_la_OBJECTS) -@STATIC_SILC_FALSE@am_libsilcpurple_la_rpath = -rpath $(pkgdir) -@STATIC_SILC_TRUE@am_libsilcpurple_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsilcpurple_la_SOURCES) -DIST_SOURCES = $(am__libsilcpurple_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -SILCSOURCES = \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - silc.c \ - silcpurple.h \ - util.c \ - wb.c \ - wb.h - -AM_CFLAGS = $(st) -libsilcpurple_la_LDFLAGS = -module -avoid-version -@STATIC_SILC_FALSE@st = $(SILC_CFLAGS) -@STATIC_SILC_TRUE@st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -@STATIC_SILC_TRUE@noinst_LTLIBRARIES = libsilcpurple.la -@STATIC_SILC_FALSE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SILC_FALSE@libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) -@STATIC_SILC_TRUE@libsilcpurple_la_LIBADD = $(SILC_LIBS) -@STATIC_SILC_FALSE@pkg_LTLIBRARIES = libsilcpurple.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/silc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/silc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsilcpurple.la: $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_DEPENDENCIES) - $(LINK) $(am_libsilcpurple_la_rpath) $(libsilcpurple_la_LDFLAGS) $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ops.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-pk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-silc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-wb.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsilcpurple_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" "$(DEPDIR)/libsilcpurple_la-buddy.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libsilcpurple_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libsilcpurple_la-chat.lo: chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-chat.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-chat.Tpo" -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo" "$(DEPDIR)/libsilcpurple_la-chat.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chat.c' object='libsilcpurple_la-chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c - -libsilcpurple_la-ft.lo: ft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ft.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ft.Tpo" -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo" "$(DEPDIR)/libsilcpurple_la-ft.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ft.c' object='libsilcpurple_la-ft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c - -libsilcpurple_la-ops.lo: ops.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ops.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ops.Tpo" -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo" "$(DEPDIR)/libsilcpurple_la-ops.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ops.c' object='libsilcpurple_la-ops.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c - -libsilcpurple_la-pk.lo: pk.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-pk.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-pk.Tpo" -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo" "$(DEPDIR)/libsilcpurple_la-pk.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pk.c' object='libsilcpurple_la-pk.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c - -libsilcpurple_la-silc.lo: silc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-silc.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-silc.Tpo" -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo" "$(DEPDIR)/libsilcpurple_la-silc.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='silc.c' object='libsilcpurple_la-silc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c - -libsilcpurple_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-util.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-util.Tpo" -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-util.Tpo" "$(DEPDIR)/libsilcpurple_la-util.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libsilcpurple_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -libsilcpurple_la-wb.lo: wb.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-wb.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-wb.Tpo" -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo" "$(DEPDIR)/libsilcpurple_la-wb.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wb.c' object='libsilcpurple_la-wb.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsilc protocol plugin -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = libsilc -NEEDED_DLLS = $(SILC_TOOLKIT)/bin/libsilc-1-1-2.dll \ - $(SILC_TOOLKIT)/bin/libsilcclient-1-1-2.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(SILC_TOOLKIT)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(SILC_TOOLKIT)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = silc.c \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - util.c \ - wb.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lsilc \ - -lsilcclient - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--image-base,0x74000000 -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ops.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ops.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ops.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/ops.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1874 +0,0 @@ -/* - - silcpurple_ops.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" -#include "wb.h" - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcChannelPrivateKey key, SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context); - -/* Message sent to the application by library. `conn' associates the - message to a specific connection. `conn', however, may be NULL. - The `type' indicates the type of the message sent by the library. - The application can for example filter the message according the - type. */ - -void silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...) -{ - char tmp[256]; - va_list va; - PurpleConnection *gc = NULL; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - - va_start(va, msg); - silc_vsnprintf(tmp, sizeof(tmp), msg, va); - va_end(va); - - if (type != SILC_CLIENT_MESSAGE_ERROR) { - purple_debug_misc("silc", "silc_say (%d) %s\n", type, tmp); - return; - } - - purple_debug_error("silc", "silc_say error: %s\n", tmp); - - if (!strcmp(tmp, "Authentication failed")) - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - - if (client != NULL) - gc = client->application; - - if (gc != NULL) - purple_connection_error_reason(gc, reason, tmp); - else - purple_notify_error(NULL, _("Error"), _("Error occurred"), tmp); -} - -/* Processes incoming MIME message. Can be private message or channel - message. Returns TRUE if the message `mime' was displayed. */ - -static SilcBool -silcpurple_mime_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, SilcMime mime, - gboolean recursive) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *type; - const unsigned char *data; - SilcUInt32 data_len; - PurpleMessageFlags cflags = 0; - PurpleConversation *convo = NULL; - SilcBool ret = FALSE; - - if (!mime) - return FALSE; - - /* Check for fragmented MIME message */ - if (silc_mime_is_partial(mime)) { - if (!sg->mimeass) - sg->mimeass = silc_mime_assembler_alloc(); - - /* Defragment */ - mime = silc_mime_assemble(sg->mimeass, mime); - if (!mime) - /* More fragments to come */ - return FALSE; - - /* Process the complete message */ - return silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, mime, - FALSE); - } - - /* Check for multipart message */ - if (silc_mime_is_multipart(mime)) { - SilcMime p; - const char *mtype; - SilcDList parts = silc_mime_get_multiparts(mime, &mtype); - SilcBool ret; - - if (!strcmp(mtype, "mixed")) { - /* Contains multiple messages */ - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Recursively process parts */ - ret = silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE); - } - } - - if (!strcmp(mtype, "alternative")) { - /* Same message in alternative formats. Kopete sends - these. Go in order from last to first. */ - silc_dlist_end(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Go through the alternatives and display the first - one we support. */ - if (silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE)) { - ret = TRUE; - break; - } - } - } - - goto out; - } - - /* Get content type and MIME data */ - type = silc_mime_get_field(mime, "Content-Type"); - if (!type) - goto out; - data = silc_mime_get_data(mime, &data_len); - if (!data) - goto out; - - /* Process according to content type */ - - /* Plain text */ - if (strstr(type, "text/plain")) { - /* Default is UTF-8, don't check for other charsets */ - if (!strstr(type, "utf-8")) - goto out; - - if (channel) - silc_channel_message(client, conn, sender, channel, - payload, key, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - else - silc_private_message(client, conn, sender, payload, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - ret = TRUE; - goto out; - } - - /* Image */ - if (strstr(type, "image/png") || - strstr(type, "image/jpeg") || - strstr(type, "image/gif") || - strstr(type, "image/tiff")) { - char tmp[32]; - int imgid; - - /* Get channel convo (if message is for channel) */ - if (key && channel) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (channel && !convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (channel && !convo) - goto out; - - imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); - if (imgid) { - cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; - g_snprintf(tmp, sizeof(tmp), "", imgid); - - if (channel) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : - "", cflags, - tmp, time(NULL)); - else - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, cflags, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - cflags = 0; - ret = TRUE; - } - goto out; - } - - /* Whiteboard message */ - if (strstr(type, "application/x-wb") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) { - if (channel) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); - else - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); - ret = TRUE; - goto out; - } - - out: - if (!recursive) - silc_mime_free(mime); - return ret; -} - -/* Message for a channel. The `sender' is the sender of the message - The `channel' is the channel. The `message' is the message. Note - that `message' maybe NULL. The `flags' indicates message flags - and it is used to determine how the message can be interpreted - (like it may tell the message is multimedia message). */ - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcChannelPrivateKey key, SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (key) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (!convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(NULL, message, message_len); - silcpurple_mime_message(client, conn, sender, channel, payload, - key, flags, mime, FALSE); - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname, 0, tmp, time(NULL)); - g_free(tmp); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname, (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname, 0, tmp, time(NULL)); - g_free(tmp); - } -} - - -/* Private message to the client. The `sender' is the sender of the - message. The message is `message'and maybe NULL. The `flags' - indicates message flags and it is used to determine how the message - can be interpreted (like it may tell the message is multimedia - message). */ - -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (sender->nickname) - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - sender->nickname, sg->account); - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(NULL, message, message_len); - silcpurple_mime_message(client, conn, sender, NULL, payload, - NULL, flags, mime, FALSE); - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - tmp = g_markup_escape_text(msg, -1); - serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); - g_free(msg); - g_free(tmp); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname, (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname, tmp, 0, time(NULL)); - g_free(tmp); - } -} - - -/* Notify message to the client. The notify arguments are sent in the - same order as servers sends them. The arguments are same as received - from the server except for ID's. If ID is received application receives - the corresponding entry to the ID. For example, if Client ID is received - application receives SilcClientEntry. Also, if the notify type is - for channel the channel entry is sent to application (even if server - does not send it because client library gets the channel entry from - the Channel ID in the packet's header). */ - -static void -silc_notify(SilcClient client, SilcClientConnection conn, - SilcNotifyType type, ...) -{ - va_list va; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *convo; - SilcClientEntry client_entry, client_entry2; - SilcChannelEntry channel; - SilcServerEntry server_entry; - SilcIdType idtype; - void *entry; - SilcUInt32 mode; - SilcHashTableList htl; - SilcChannelUser chu; - char buf[512], buf2[512], *tmp, *name; - SilcNotifyType notify; - PurpleBuddy *b; - SilcDList list; - int i; - - va_start(va, type); - memset(buf, 0, sizeof(buf)); - - switch (type) { - - case SILC_NOTIFY_TYPE_NONE: - break; - - case SILC_NOTIFY_TYPE_INVITE: - { - GHashTable *components; - (void)va_arg(va, SilcChannelEntry); - name = va_arg(va, char *); - client_entry = va_arg(va, SilcClientEntry); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, g_strdup("channel"), g_strdup(name)); - serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); - } - break; - - case SILC_NOTIFY_TYPE_JOIN: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - /* If we joined channel, do nothing */ - if (client_entry == conn->local_entry) - break; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Join user to channel */ - g_snprintf(buf, sizeof(buf), "%s@%s", - client_entry->username, client_entry->hostname); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, buf, PURPLE_CBFLAGS_NONE, TRUE); - - break; - - case SILC_NOTIFY_TYPE_LEAVE: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Remove user from channel */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, NULL); - - break; - - case SILC_NOTIFY_TYPE_SIGNOFF: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - tmp); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_TOPIC_SET: - { - char *esc, *tmp2; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - tmp = va_arg(va, char *); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (!tmp) - break; - - esc = g_markup_escape_text(tmp, -1); - tmp2 = purple_markup_linkify(esc); - g_free(esc); - - if (idtype == SILC_ID_CLIENT) { - client_entry = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - client_entry->nickname, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - server_entry->server_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - server_entry->server_name, tmp); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - channel->channel_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - channel->channel_name, tmp); - } else { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); - } - - g_free(tmp2); - - break; - - } - case SILC_NOTIFY_TYPE_NICK_CHANGE: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); /* Old nick */ - name = va_arg(va, char *); /* New nick */ - - if (!strcmp(tmp, name)) - break; - - /* Change nick on all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - tmp, name); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_CMODE_CHANGE: - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, SilcPublicKey); - (void)va_arg(va, SilcDList); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set channel %s modes to: %s"), name, - channel->channel_name, buf2); - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all channel %s modes"), name, - channel->channel_name); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - break; - - case SILC_NOTIFY_TYPE_CUMODE_CHANGE: - { - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set %s's modes to: %s"), name, - client_entry2->nickname, buf2); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (mode & SILC_CHANNEL_UMODE_CHANOP) - flags |= PURPLE_CBFLAGS_OP; - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all %s's modes"), name, - client_entry2->nickname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); - break; - } - - case SILC_NOTIFY_TYPE_MOTD: - tmp = va_arg(va, char *); - silc_free(sg->motd); - sg->motd = silc_memdup(tmp, strlen(tmp)); - break; - - case SILC_NOTIFY_TYPE_KICKED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (client_entry == conn->local_entry) { - /* Remove us from channel */ - g_snprintf(buf, sizeof(buf), - _("You have been kicked off %s by %s (%s)"), - channel->channel_name, client_entry2->nickname, - tmp ? tmp : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - /* Remove user from channel */ - g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - buf); - } - - break; - - case SILC_NOTIFY_TYPE_KILLED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - idtype = va_arg(va, int); - entry = va_arg(va, SilcClientEntry); - - if (client_entry == conn->local_entry) { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove us from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } - silc_hash_table_list_reset(&htl); - - } else { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove user from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } - silc_hash_table_list_reset(&htl); - } - - break; - - case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: - break; - - case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: - (void)va_arg(va, void *); - list = va_arg(va, SilcDList); - - silc_dlist_start(list); - while ((client_entry = silc_dlist_get(list))) { - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - _("Server signoff")); - } - silc_hash_table_list_reset(&htl); - } - break; - - case SILC_NOTIFY_TYPE_ERROR: - { - SilcStatus error = va_arg(va, int); - purple_notify_error(gc, "Error Notify", - silc_get_status_message(error), - NULL); - } - break; - - case SILC_NOTIFY_TYPE_WATCH: - { - SilcPublicKey public_key; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint; - - client_entry = va_arg(va, SilcClientEntry); - (void)va_arg(va, char *); - mode = va_arg(va, SilcUInt32); - notify = va_arg(va, int); - public_key = va_arg(va, SilcPublicKey); - - b = NULL; - if (public_key) { - GSList *buddies; - const char *f; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - break; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(buf, sizeof(buf) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" - G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - silc_free(fingerprint); - silc_free(pk); - - /* Find buddy by associated public key */ - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - b = buddies->data; - f = purple_blist_node_get_string(PURPLE_BLIST_NODE(b), "public-key"); - if (purple_strequal(f, buf)) - goto cont; - b = NULL; - } - } - cont: - if (!b) { - /* Find buddy by nickname */ - b = purple_find_buddy(sg->account, client_entry->nickname); - if (!b) { - purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", - client_entry->nickname); - break; - } - } - - silc_free(purple_buddy_get_protocol_data(b)); - purple_buddy_set_protocol_data(b, silc_memdup(&client_entry->id, - sizeof(client_entry->id))); - if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { - break; - } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { - /* See if client was away and is now present */ - if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | - SILC_UMODE_BUSY | SILC_UMODE_PAGE | - SILC_UMODE_DETACHED)) && - (client_entry->mode & SILC_UMODE_GONE || - client_entry->mode & SILC_UMODE_INDISPOSED || - client_entry->mode & SILC_UMODE_BUSY || - client_entry->mode & SILC_UMODE_PAGE || - client_entry->mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - else if ((mode & SILC_UMODE_GONE) || - (mode & SILC_UMODE_INDISPOSED) || - (mode & SILC_UMODE_BUSY) || - (mode & SILC_UMODE_PAGE) || - (mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } - } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || - notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || - notify == SILC_NOTIFY_TYPE_KILLED) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } else if (notify == SILC_NOTIFY_TYPE_NONE) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - } - break; - - default: - purple_debug_info("silc", "Unhandled notification: %d\n", type); - break; - } - - va_end(va); -} - - -/* Command handler. This function is called always after application has - called a command. It will be called to indicate that the command - was processed. It will also be called if error occurs while processing - the command. The `success' indicates whether the command was sent - or if error occurred. The `status' indicates the actual error. - The `argc' and `argv' are the command line arguments sent to the - command by application. Note that, this is not reply to the command - from server, this is merely and indication to application that the - command was processed. */ - -static void -silc_command(SilcClient client, SilcClientConnection conn, - SilcBool success, SilcCommand command, SilcStatus status, - SilcUInt32 argc, unsigned char **argv) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - switch (command) { - - case SILC_COMMAND_CMODE: - if (argc == 3 && !strcmp((char *)argv[2], "+C")) - sg->chpk = TRUE; - else - sg->chpk = FALSE; - break; - - default: - break; - } -} - -#if 0 -static void -silcpurple_whois_more(SilcClientEntry client_entry, gint id) -{ - SilcAttributePayload attr; - SilcAttribute attribute; - GString *s; - SilcVCardStruct vcard; - int i; - - if (id != 0) - return; - - memset(&vcard, 0, sizeof(vcard)); - - s = g_string_new(""); - - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - switch (attribute) { - - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - g_string_append_printf(s, "%s:\n\n", _("Personal Information")); - if (vcard.full_name) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Full Name"), - vcard.full_name); - if (vcard.first_name) - g_string_append_printf(s, "%s:\t%s\n", - _("First Name"), - vcard.first_name); - if (vcard.middle_names) - g_string_append_printf(s, "%s:\t%s\n", - _("Middle Name"), - vcard.middle_names); - if (vcard.family_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Family Name"), - vcard.family_name); - if (vcard.nickname) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Nickname"), - vcard.nickname); - if (vcard.bday) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Birth Day"), - vcard.bday); - if (vcard.title) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Title"), - vcard.title); - if (vcard.role) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Role"), - vcard.role); - if (vcard.org_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Organization"), - vcard.org_name); - if (vcard.org_unit) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Unit"), - vcard.org_unit); - if (vcard.url) - g_string_append_printf(s, "%s:\t%s\n", - _("Homepage"), - vcard.url); - if (vcard.label) - g_string_append_printf(s, "%s:\t%s\n", - _("Address"), - vcard.label); - for (i = 0; i < vcard.num_tels; i++) { - if (vcard.tels[i].telnum) - g_string_append_printf(s, "%s:\t\t\t%s\n", - _("Phone"), - vcard.tels[i].telnum); - } - for (i = 0; i < vcard.num_emails; i++) { - if (vcard.emails[i].address) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Email"), - vcard.emails[i].address); - } - if (vcard.note) - g_string_append_printf(s, "\n%s:\t\t%s\n", - _("Note"), - vcard.note); - break; - } - } - - purple_notify_info(NULL, _("User Information"), _("User Information"), - s->str); - g_string_free(s, TRUE); -} -#endif - - -/* Command reply handler. Delivers a reply to command that was sent - earlier. The `conn' is the associated client connection. The `command' - indicates the command reply type. If the `status' other than - SILC_STATUS_OK an error occurred. In this case the `error' will indicate - the error. It is possible to receive list of command replies and list - of errors. In this case the `status' will indicate it is an list entry - (the `status' is SILC_STATUS_LIST_START, SILC_STATUS_LIST_ITEM and/or - SILC_STATUS_LIST_END). - - The arguments received in `ap' are command specific. See a separate - documentation in the Toolkit Reference Manual for the command reply - arguments. */ - -static void -silc_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, va_list ap) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - - switch (command) { - case SILC_COMMAND_JOIN: - { - SilcChannelEntry channel; - PurpleConversation *convo; - SilcHashTableList *user_list; - SilcChannelUser chu; - GList *users = NULL, *flags = NULL; - char tmp[256], *topic; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), - silc_get_status_message(error)); - return; - } - - (void)va_arg(ap, char *); - channel = va_arg(ap, SilcChannelEntry); - (void)va_arg(ap, SilcUInt32); - user_list = va_arg(ap, SilcHashTableList *); - topic = va_arg(ap, char *); - - /* Add channel to Purple */ - channel->context = SILC_32_TO_PTR(++sg->channel_ids); - serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - /* Add all users to channel */ - while (silc_hash_table_get(user_list, NULL, (void *)&chu)) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - chu->context = SILC_32_TO_PTR(sg->channel_ids); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) - f |= PURPLE_CBFLAGS_FOUNDER; - if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) - f |= PURPLE_CBFLAGS_OP; - users = g_list_append(users, chu->client->nickname); - flags = g_list_append(flags, GINT_TO_POINTER(f)); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - if (chu->client == conn->local_entry) - g_snprintf(tmp, sizeof(tmp), - _("You are channel founder on %s"), - channel->channel_name); - else - g_snprintf(tmp, sizeof(tmp), - _("Channel founder on %s is %s"), - channel->channel_name, chu->client->nickname); - - purple_conversation_write(convo, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - } - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - g_list_free(users); - g_list_free(flags); - - /* Set topic */ - if (topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic); - - /* Set nick */ - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), conn->local_entry->nickname); - } - break; - - case SILC_COMMAND_LEAVE: - break; - - case SILC_COMMAND_USERS: - break; - - case SILC_COMMAND_WHOIS: - { - SilcUInt32 idle, *user_modes; - SilcDList channels; - SilcClientEntry client_entry; - char tmp[1024], *tmp2; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - PurpleNotifyUserInfo *user_info; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(error)); - break; - } - - client_entry = va_arg(ap, SilcClientEntry); - (void)va_arg(ap, char *); - (void)va_arg(ap, char *); - (void)va_arg(ap, char *); - channels = va_arg(ap, SilcDList); - (void)va_arg(ap, SilcUInt32); - idle = va_arg(ap, SilcUInt32); - (void)va_arg(ap, unsigned char *); - user_modes = va_arg(ap, SilcUInt32 *); - - user_info = purple_notify_user_info_new(); - tmp2 = g_markup_escape_text(client_entry->nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); - g_free(tmp2); - if (client_entry->realname) { - tmp2 = g_markup_escape_text(client_entry->realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); - g_free(tmp2); - } - tmp2 = g_markup_escape_text(client_entry->username, -1); - if (*client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); - g_free(tmp2); - - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (statusstr) { - tmp2 = g_markup_escape_text(statusstr, -1); - purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); - g_free(statusstr); - g_free(tmp2); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - - if (*client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - if (channels && user_modes) { - SilcChannelPayload entry; - int i = 0; - - memset(tmp, 0, sizeof(tmp)); - silc_dlist_start(channels); - while ((entry = silc_dlist_get(channels))) { - SilcUInt32 name_len; - char *m = silc_client_chumode_char(user_modes[i++]); - char *name = (char *)silc_channel_get_name(entry, &name_len); - if (m) - silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); - silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); - silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); - silc_free(m); - } - tmp2 = g_markup_escape_text(tmp, -1); - purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); - g_free(tmp2); - } - - if (client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - if (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - } - -#if 0 /* XXX for now, let's not show attrs here */ - if (client_entry->attrs) - purple_request_action(gc, _("User Information"), - _("User Information"), - buf, 1, client_entry, 2, - _("OK"), G_CALLBACK(silcpurple_whois_more), - _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); - else -#endif /* 0 */ - purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_WHOWAS: - { - SilcClientEntry client_entry; - char *nickname, *realname, *username, *tmp; - PurpleNotifyUserInfo *user_info; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(error)); - break; - } - - client_entry = va_arg(ap, SilcClientEntry); - nickname = va_arg(ap, char *); - username = va_arg(ap, char *); - realname = va_arg(ap, char *); - if (!nickname) - break; - - user_info = purple_notify_user_info_new(); - tmp = g_markup_escape_text(nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - if (realname) { - tmp = g_markup_escape_text(realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); - g_free(tmp); - } - if (username) { - tmp = g_markup_escape_text(username, -1); - if (client_entry && *client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - g_free(tmp); - } - if (client_entry && *client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - - if (client_entry && client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - if (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - } - - purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_DETACH: - { - const char *file; - SilcBuffer detach_data; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), - silc_get_status_message(error)); - return; - } - - detach_data = va_arg(ap, SilcBuffer); - - /* Save the detachment data to file. */ - file = silcpurple_session_file(purple_account_get_username(sg->account)); - g_unlink(file); - silc_file_writefile(file, (const char *)silc_buffer_data(detach_data), - silc_buffer_len(detach_data)); - } - break; - - case SILC_COMMAND_TOPIC: - { - SilcChannelEntry channel; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Topic"), _("Cannot set topic"), - silc_get_status_message(error)); - return; - } - - channel = va_arg(ap, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) { - purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", - channel->channel_name); - break; - } - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - } - break; - - case SILC_COMMAND_NICK: - { - SilcClientEntry local_entry; - SilcHashTableList htl; - SilcChannelUser chu; - const char *oldnick, *newnick; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), - silc_get_status_message(error)); - return; - } - - local_entry = va_arg(ap, SilcClientEntry); - newnick = va_arg(ap, char *); - - /* Change nick on all channels */ - silc_hash_table_list(local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); - if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), newnick))) { - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - oldnick, newnick); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), newnick); - } - } - silc_hash_table_list_reset(&htl); - - purple_connection_set_display_name(gc, newnick); - } - break; - - case SILC_COMMAND_LIST: - { - char *topic, *name; - int usercount; - PurpleRoomlistRoom *room; - - if (sg->roomlist_canceled) - break; - - if (error != SILC_STATUS_OK) { - purple_notify_error(gc, _("Error"), _("Error retrieving room list"), - silc_get_status_message(error)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - - (void)va_arg(ap, SilcChannelEntry); - name = va_arg(ap, char *); - if (!name) { - purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), - _("Network is empty")); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - topic = va_arg(ap, char *); - usercount = va_arg(ap, int); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(sg->roomlist, room, name); - purple_roomlist_room_add_field(sg->roomlist, room, - SILC_32_TO_PTR(usercount)); - purple_roomlist_room_add_field(sg->roomlist, room, - topic ? topic : ""); - purple_roomlist_room_add(sg->roomlist, room); - - if (status == SILC_STATUS_LIST_END || - status == SILC_STATUS_OK) { - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - } - } - break; - - case SILC_COMMAND_GETKEY: - { - SilcPublicKey public_key; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - silc_get_status_message(error)); - return; - } - - (void)va_arg(ap, SilcUInt32); - (void)va_arg(ap, void *); - public_key = va_arg(ap, SilcPublicKey); - - if (!public_key) - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - _("No public key was received")); - } - break; - - case SILC_COMMAND_INFO: - { - - char *server_name; - char *server_info; - char tmp[256]; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Server Information"), - _("Cannot get server information"), - silc_get_status_message(error)); - return; - } - - (void)va_arg(ap, SilcServerEntry); - server_name = va_arg(ap, char *); - server_info = va_arg(ap, char *); - - if (server_name && server_info) { - g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", - server_name, server_info); - purple_notify_info(gc, NULL, _("Server Information"), tmp); - } - } - break; - - case SILC_COMMAND_STATS: - { - SilcClientStats *stats; - char *msg; - - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Server Statistics"), - _("Cannot get server statistics"), - silc_get_status_message(error)); - return; - } - - stats = va_arg(ap, SilcClientStats *); - - msg = g_strdup_printf(_("Local server start time: %s\n" - "Local server uptime: %s\n" - "Local server clients: %d\n" - "Local server channels: %d\n" - "Local server operators: %d\n" - "Local router operators: %d\n" - "Local cell clients: %d\n" - "Local cell channels: %d\n" - "Local cell servers: %d\n" - "Total clients: %d\n" - "Total channels: %d\n" - "Total servers: %d\n" - "Total routers: %d\n" - "Total server operators: %d\n" - "Total router operators: %d\n"), - silc_time_string(stats->starttime), - purple_str_seconds_to_string((int)stats->uptime), - (int)stats->my_clients, - (int)stats->my_channels, - (int)stats->my_server_ops, - (int)stats->my_router_ops, - (int)stats->cell_clients, - (int)stats->cell_channels, - (int)stats->cell_servers, - (int)stats->clients, - (int)stats->channels, - (int)stats->servers, - (int)stats->routers, - (int)stats->server_ops, - (int)stats->router_ops); - - purple_notify_info(gc, NULL, - _("Network Statistics"), msg); - g_free(msg); - } - break; - - case SILC_COMMAND_PING: - { - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Ping"), _("Ping failed"), - silc_get_status_message(error)); - return; - } - - purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), - NULL); - } - break; - - case SILC_COMMAND_KILL: - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("Kill User"), - _("Could not kill user"), - silc_get_status_message(error)); - return; - } - break; - - case SILC_COMMAND_CMODE: - { - SilcChannelEntry channel_entry; - SilcDList channel_pubkeys, list; - SilcArgumentDecodedList e; - - if (status != SILC_STATUS_OK) - return; - - channel_entry = va_arg(ap, SilcChannelEntry); - (void)va_arg(ap, SilcUInt32); - (void)va_arg(ap, SilcPublicKey); - channel_pubkeys = va_arg(ap, SilcDList); - - if (!sg->chpk) - break; - - list = silc_dlist_init(); - - if (channel_pubkeys) { - silc_dlist_start(channel_pubkeys); - while ((e = silc_dlist_get(channel_pubkeys))) { - if (e->arg_type == 0x00 || - e->arg_type == 0x03) - silc_dlist_add(list, silc_pkcs_public_key_copy(e->argument)); - } - } - silcpurple_chat_chauth_show(sg, channel_entry, list); - } - break; - - case SILC_COMMAND_WATCH: - if (status != SILC_STATUS_OK) { - purple_notify_error(gc, _("WATCH"), _("Cannot watch user"), - silc_get_status_message(error)); - return; - } - break; - - default: - if (status == SILC_STATUS_OK) - purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); - else - purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, - silc_get_status_message(error)); - break; - } -} - -/* Generic command reply callback for silc_client_command_send. Simply - calls the default command_reply client operation callback */ - -SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap) -{ - silc_command_reply(client, conn, command, status, error, ap); - return TRUE; -} - - -typedef struct { - union { - SilcAskPassphrase ask_pass; - SilcGetAuthMeth get_auth; - } u; - void *context; -} *SilcPurpleAskPassphrase; - -static void -silc_ask_auth_password_cb(const unsigned char *passphrase, - SilcUInt32 passphrase_len, void *context) -{ - SilcPurpleAskPassphrase internal = context; - - if (!passphrase || !(*passphrase)) - internal->u.get_auth(SILC_AUTH_NONE, NULL, 0, internal->context); - else - internal->u.get_auth(SILC_AUTH_PASSWORD, - (unsigned char *)passphrase, - passphrase_len, internal->context); - silc_free(internal); -} - -/* Find authentication method and authentication data by hostname and - port. The hostname may be IP address as well. The `auth_method' is - the authentication method the remote connection requires. It is - however possible that remote accepts also some other authentication - method. Application should use the method that may have been - configured for this connection. If none has been configured it should - use the required `auth_method'. If the `auth_method' is - SILC_AUTH_NONE, server does not require any authentication or the - required authentication method is not known. The `completion' - callback must be called to deliver the chosen authentication method - and data. The `conn' may be NULL. */ - -static void -silc_get_auth_method(SilcClient client, SilcClientConnection conn, - char *hostname, SilcUInt16 port, - SilcAuthMethod auth_method, - SilcGetAuthMeth completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleAskPassphrase internal; - const char *password; - - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 4, 5); - else - purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); - - /* Check configuration if we have this connection configured. */ - if (auth_method == SILC_AUTH_PUBLIC_KEY && - purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { - completion(SILC_AUTH_PUBLIC_KEY, NULL, 0, context); - return; - } - if (auth_method == SILC_AUTH_PASSWORD) { - password = purple_connection_get_password(gc); - if (password && *password) { - completion(SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); - return; - } - - /* Ask password from user */ - internal = silc_calloc(1, sizeof(*internal)); - if (!internal) - return; - internal->u.get_auth = completion; - internal->context = context; - silc_ask_passphrase(client, conn, silc_ask_auth_password_cb, - internal); - return; - } - - completion(SILC_AUTH_NONE, NULL, 0, context); -} - - -/* Called to verify received public key. The `conn_type' indicates which - entity (server or client) has sent the public key. If user decides to - trust the key the application may save the key as trusted public key for - later use. The `completion' must be called after the public key has - been verified. */ - -static void -silc_verify_public_key(SilcClient client, SilcClientConnection conn, - SilcConnectionType conn_type, - SilcPublicKey public_key, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn && (conn_type == SILC_CONN_SERVER || - conn_type == SILC_CONN_ROUTER)) { - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 3, 5); - else - purple_connection_update_progress(gc, _("Verifying server public key"), - 3, 5); - } - - /* Verify public key */ - silcpurple_verify_public_key(client, conn, NULL, conn_type, - public_key, completion, context); -} - -static void -silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) -{ - if (!passphrase || !(*passphrase)) - internal->u.ask_pass(NULL, 0, internal->context); - else - internal->u.ask_pass((unsigned char *)passphrase, - strlen(passphrase), internal->context); - silc_free(internal); -} - -/* Ask (interact, that is) a passphrase from user. The passphrase is - returned to the library by calling the `completion' callback with - the `context'. The returned passphrase SHOULD be in UTF-8 encoded, - if not then the library will attempt to encode. */ - -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); - - if (!internal) - return; - internal->u.ask_pass = completion; - internal->context = context; - purple_request_input(gc, _("Passphrase"), NULL, - _("Passphrase required"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silc_ask_passphrase_cb), - _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), - purple_connection_get_account(gc), NULL, NULL, internal); -} - - -/* Called to indicate that incoming key agreement request has been - received. If the application wants to perform key agreement it may - call silc_client_perform_key_agreement to initiate key agreement or - silc_client_send_key_agreement to provide connection point to the - remote client in case the `hostname' is NULL. If key agreement is - not desired this request can be ignored. The `protocol' is either - value 0 for TCP or value 1 for UDP. */ - -static void -silc_key_agreement(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 protocol, - SilcUInt16 port) -{ - silcpurple_buddy_keyagr_request(client, conn, client_entry, - hostname, port, protocol); -} - - -/* Notifies application that file transfer protocol session is being - requested by the remote client indicated by the `client_entry' from - the `hostname' and `port'. The `session_id' is the file transfer - session and it can be used to either accept or reject the file - transfer request, by calling the silc_client_file_receive or - silc_client_file_close, respectively. */ - -static void -silc_ftp(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - silcpurple_ftp_request(client, conn, client_entry, session_id, - hostname, port); -} - -SilcClientOperations ops = { - silc_say, - silc_channel_message, - silc_private_message, - silc_notify, - silc_command, - silc_command_reply, - silc_get_auth_method, - silc_verify_public_key, - silc_ask_passphrase, - silc_key_agreement, - silc_ftp -}; diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/pk.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/pk.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/pk.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/pk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,274 +0,0 @@ -/* - - silcpurple_pk.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" - -/************************* Public Key Verification ***************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - char *filename; - char *entity; - char *entity_name; - char *fingerprint; - char *babbleprint; - SilcPublicKey public_key; - SilcVerifyPublicKey completion; - void *context; - gboolean changed; -} *PublicKeyVerify; - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify); - -static void silcpurple_verify_cb(PublicKeyVerify verify, gint id) -{ - if (id != 2) { - if (verify->completion) - verify->completion(FALSE, verify->context); - } else { - if (verify->completion) - verify->completion(TRUE, verify->context); - - /* Save the key for future checking */ - silc_pkcs_save_public_key(verify->filename, verify->public_key, - SILC_PKCS_FILE_BASE64); - } - - g_free(verify->filename); - g_free(verify->entity); - g_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_pkcs_public_key_free(verify->public_key); - silc_free(verify); -} - -static void silcpurple_verify_details_cb(PublicKeyVerify verify) -{ - /* What a hack. We have to display the accept dialog _again_ - because Purple closes the dialog after you press the button. Purple - should have option for the dialogs whether the buttons close them - or not. */ - silcpurple_verify_ask(verify->entity, verify->fingerprint, - verify->babbleprint, verify); -} - -static void silcpurple_verify_details(PublicKeyVerify verify, gint id) -{ - PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; - - silcpurple_show_public_key(sg, verify->entity_name, verify->public_key, - G_CALLBACK(silcpurple_verify_details_cb), - verify); -} - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify) -{ - PurpleConnection *gc = verify->client->application; - char tmp[256], tmp2[256]; - - if (verify->changed) { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Your local copy does not match this " - "key. Would you still like to accept this public key?"), - entity); - } else { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Would you like to accept this " - "public key?"), entity); - } - g_snprintf(tmp2, sizeof(tmp2), - _("Fingerprint and babbleprint for the %s key are:\n\n" - "%s\n%s\n"), entity, fingerprint, babbleprint); - - purple_request_action(gc, _("Verify Public Key"), tmp, tmp2, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), entity, NULL, verify, 3, - _("Yes"), G_CALLBACK(silcpurple_verify_cb), - _("No"), G_CALLBACK(silcpurple_verify_cb), - _("_View..."), G_CALLBACK(silcpurple_verify_details)); -} - -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcConnectionType conn_type, - SilcPublicKey public_key, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - int i; - char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; - char *fingerprint, *babbleprint; - struct passwd *pw; - struct stat st; - char *entity = ((conn_type == SILC_CONN_SERVER || - conn_type == SILC_CONN_ROUTER) ? - "server" : "client"); - PublicKeyVerify verify; - const char *ip, *hostname; - SilcUInt16 port; - unsigned char *pk; - SilcUInt32 pk_len; - - if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC) { - purple_notify_error(gc, _("Verify Public Key"), - _("Unsupported public key type"), NULL); - if (completion) - completion(FALSE, context); - return; - } - - pw = getpwuid(getuid()); - if (!pw) { - if (completion) - completion(FALSE, context); - return; - } - - memset(filename, 0, sizeof(filename)); - memset(filename2, 0, sizeof(filename2)); - memset(file, 0, sizeof(file)); - - silc_socket_stream_get_info(silc_packet_stream_get_stream(conn->stream), - NULL, &hostname, &ip, &port); - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) { - if (completion) - completion(FALSE, context); - return; - } - - if (conn_type == SILC_CONN_SERVER || - conn_type == SILC_CONN_ROUTER) { - if (!name) { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - ip, port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - hostname, port); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - hostf = filename2; - } else { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - name, port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - } - } else { - /* Replace all whitespaces with `_'. */ - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - g_snprintf(file, sizeof(file) - 1, "%skey_%s.pub", entity, fingerprint); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - silc_free(fingerprint); - - ipf = filename; - } - - verify = silc_calloc(1, sizeof(*verify)); - if (!verify) - return; - verify->client = client; - verify->conn = conn; - verify->filename = g_strdup(ipf); - verify->entity = g_strdup(entity); - verify->entity_name = (conn_type != SILC_CONN_CLIENT ? - (name ? g_strdup(name) : g_strdup(hostname)) - : NULL); - verify->public_key = silc_pkcs_public_key_copy(public_key); - verify->completion = completion; - verify->context = context; - fingerprint = verify->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = verify->babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - /* Check whether this key already exists */ - if (g_stat(ipf, &st) < 0 && (!hostf || g_stat(hostf, &st) < 0)) { - /* Key does not exist, ask user to verify the key and save it */ - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } else { - /* The key already exists, verify it. */ - SilcPublicKey public_key; - unsigned char *encpk; - SilcUInt32 encpk_len; - - /* Load the key file, try for both IP filename and hostname filename */ - if (!silc_pkcs_load_public_key(ipf, &public_key) && - (!hostf || (!silc_pkcs_load_public_key(hostf, &public_key)))) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Encode the key data */ - encpk = silc_pkcs_public_key_encode(public_key, &encpk_len); - if (!encpk) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Compare the keys */ - if (memcmp(encpk, pk, encpk_len)) { - /* Ask user to verify the key and save it */ - verify->changed = TRUE; - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Local copy matched */ - if (completion) - completion(TRUE, context); - g_free(verify->filename); - g_free(verify->entity); - g_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_pkcs_public_key_free(verify->public_key); - silc_free(verify); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -SILC Purple Plugin -================== - -This is the Purple protocol plugin of the protocol called Secure Internet -Live Conferencing (SILC). The implementation will use the SILC Toolkit, -freely available from the http://silcnet.org/ site, for the actual SILC -protocol implementation. - -To include SILC into Purple, one needs to first compile and install -the SILC Toolkit. It is done as follows: - - ./configure - make - make install - -This will compile shared libraries of the SILC Toolkit. If the --prefix -is not given to ./configure, the binaries are installed into the -/usr/local/silc directory. - -Once the Toolkit is installed one needs to tell Purple's ./configure -script where the SILC Toolkit is located. It is done as simply as: - - ./configure - -if pkg-config is installed in your system. If it is isn't it's done as: - - ./configure --with-silc-libs=/path/to/silc/lib - --with-silc-includes=/path/to/silc/include - -If the SILC Toolkit cannot be found then the SILC protocol plugin will -not be compiled. diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2252 +0,0 @@ -/* - - silcpurple.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "version.h" -#include "wb.h" -#include "core.h" - -extern SilcClientOperations ops; -static PurplePlugin *silc_plugin = NULL; - -/* Error log message callback */ - -static SilcBool silcpurple_log_error(SilcLogType type, char *message, - void *context) -{ - silc_say(NULL, NULL, SILC_CLIENT_MESSAGE_ERROR, message); - return TRUE; -} - -static const char * -silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return (const char *)"silc"; -} - -static GList * -silcpurple_away_states(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static void -silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = NULL; - SilcUInt32 mode; - SilcBuffer idp; - unsigned char mb[4]; - const char *state; - - if (gc != NULL) - sg = gc->proto_data; - - if (status == NULL) - return; - - state = purple_status_get_id(status); - - if (state == NULL) - return; - - if ((sg == NULL) || (sg->conn == NULL)) - return; - - mode = sg->conn->local_entry->mode; - mode &= ~(SILC_UMODE_GONE | - SILC_UMODE_HYPER | - SILC_UMODE_BUSY | - SILC_UMODE_INDISPOSED | - SILC_UMODE_PAGE); - - if (!strcmp(state, "hyper")) - mode |= SILC_UMODE_HYPER; - else if (!strcmp(state, "away")) - mode |= SILC_UMODE_GONE; - else if (!strcmp(state, "busy")) - mode |= SILC_UMODE_BUSY; - else if (!strcmp(state, "indisposed")) - mode |= SILC_UMODE_INDISPOSED; - else if (!strcmp(state, "page")) - mode |= SILC_UMODE_PAGE; - - /* Send UMODE */ - idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); - SILC_PUT32_MSB(mode, mb); - silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, - silcpurple_command_reply, NULL, 2, - 1, idp->data, silc_buffer_len(idp), - 2, mb, sizeof(mb)); - silc_buffer_free(idp); -} - - -/*************************** Connection Routines *****************************/ - -static void -silcpurple_keepalive(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0, - NULL, 0); -} - -#if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) -static gboolean -silcpurple_scheduler(gpointer *context) -{ - SilcClient client = (SilcClient)context; - silc_client_run_one(client); - return TRUE; -} -#else -typedef struct { - SilcPurple sg; - SilcUInt32 fd; - guint tag; -} *SilcPurpleTask; - -/* A timeout occurred. Call SILC scheduler. */ - -static gboolean -silcpurple_scheduler_timeout(gpointer context) -{ - SilcPurpleTask task = (SilcPurpleTask)context; - silc_client_run_one(task->sg->client); - silc_dlist_del(task->sg->tasks, task); - silc_free(task); - return FALSE; -} - -/* An fd task event occurred. Call SILC scheduler. */ - -static void -silcpurple_scheduler_fd(gpointer data, gint fd, PurpleInputCondition cond) -{ - SilcClient client = (SilcClient)data; - silc_client_run_one(client); -} - -/* SILC Scheduler notify callback. This is called whenever task is added to - or deleted from SILC scheduler. It's also called when fd task events - change. Here we add same tasks to glib's main loop. */ - -static void -silcpurple_scheduler(SilcSchedule schedule, - SilcBool added, SilcTask task, - SilcBool fd_task, SilcUInt32 fd, - SilcTaskEvent event, - long seconds, long useconds, - void *context) -{ - SilcClient client = (SilcClient)context; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleTask ptask = NULL; - - if (added) { - if (fd_task) { - /* Add fd or change fd events */ - PurpleInputCondition e = 0; - - silc_dlist_start(sg->tasks); - while ((ptask = silc_dlist_get(sg->tasks))) - if (ptask->fd == fd) { - purple_input_remove(ptask->tag); - break; - } - - if (event & SILC_TASK_READ) - e |= PURPLE_INPUT_READ; - if (event & SILC_TASK_WRITE) - e |= PURPLE_INPUT_WRITE; - - if (e) { - if (!ptask) { - ptask = silc_calloc(1, sizeof(*ptask)); - ptask->fd = fd; - silc_dlist_add(sg->tasks, ptask); - } - ptask->tag = purple_input_add(fd, e, silcpurple_scheduler_fd, - client); - } else if (ptask) { - silc_dlist_del(sg->tasks, ptask); - silc_free(ptask); - } - } else { - /* Add timeout */ - ptask = silc_calloc(1, sizeof(*ptask)); - ptask->sg = sg; - ptask->tag = purple_timeout_add((seconds * 1000) + - (useconds / 1000), - silcpurple_scheduler_timeout, - ptask); - silc_dlist_add(sg->tasks, ptask); - } - } else { - if (fd_task) { - /* Remove fd */ - silc_dlist_start(sg->tasks); - while ((ptask = silc_dlist_get(sg->tasks))) - if (ptask->fd == fd) { - purple_input_remove(ptask->tag); - silc_dlist_del(sg->tasks, ptask); - silc_free(ptask); - break; - } - } - } -} -#endif /* __SILC_TOOLKIT_VERSION */ - -static void -silcpurple_connect_cb(SilcClient client, SilcClientConnection conn, - SilcClientConnectionStatus status, SilcStatus error, - const char *message, void *context) -{ - PurpleConnection *gc = context; - SilcPurple sg; - SilcUInt32 mask; - char tz[16]; - PurpleStoredImage *img; -#ifdef HAVE_SYS_UTSNAME_H - struct utsname u; -#endif - - sg = gc->proto_data; - - switch (status) { - case SILC_CLIENT_CONN_SUCCESS: - case SILC_CLIENT_CONN_SUCCESS_RESUME: - sg->conn = conn; - - /* Connection created successfully */ - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Send the server our buddy list */ - silcpurple_send_buddylist(gc); - - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Send any UMODEs configured for account */ - if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { - silc_client_command_call(sg->client, sg->conn, NULL, - "UMODE", "+P", NULL); - } - - /* Set default attributes */ - mask = SILC_ATTRIBUTE_MOOD_NORMAL; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - mask = SILC_ATTRIBUTE_CONTACT_CHAT; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); -#ifdef HAVE_SYS_UTSNAME_H - if (!uname(&u)) { - SilcAttributeObjDevice dev; - memset(&dev, 0, sizeof(dev)); - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } -#endif - silc_timezone(tz, sizeof(tz)); - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)tz, strlen(tz)); - - /* Set our buddy icon */ - img = purple_buddy_icons_find_account_icon(sg->account); - silcpurple_buddy_set_icon(gc, img); - purple_imgstore_unref(img); - - return; - break; - - case SILC_CLIENT_CONN_DISCONNECTED: - /* Disconnected */ - if (sg->resuming && !sg->detaching) - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Close the connection */ - if (!sg->detaching) - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected by server")); - else - /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ - purple_account_disconnect(purple_connection_get_account(gc)); - break; - - case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error connecting to SILC Server")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Key Exchange failed")); - break; - - case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Authentication failed")); - break; - - case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Resuming detached session failed. " - "Press Reconnect to create new connection.")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection timed out")); - break; - } - - /* Error */ - sg->conn = NULL; -} - -static void -silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream, - void *context) -{ - PurpleConnection *gc = context; - SilcPurple sg; - SilcClient client; - SilcClientConnectionParams params; - const char *dfile; - - sg = gc->proto_data; - - if (status != SILC_SOCKET_OK) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - silc_pkcs_public_key_free(sg->public_key); - silc_pkcs_private_key_free(sg->private_key); - silc_free(sg); - gc->proto_data = NULL; - return; - } - - client = sg->client; - - /* Get session detachment data, if available */ - memset(¶ms, 0, sizeof(params)); - dfile = silcpurple_session_file(purple_account_get_username(sg->account)); - params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); - if (params.detach_data) - params.detach_data[params.detach_data_len] = 0; - params.ignore_requested_attributes = FALSE; - params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE); - - /* Progress */ - if (params.detach_data) { - purple_connection_update_progress(gc, _("Resuming session"), 2, 5); - sg->resuming = TRUE; - } else { - purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); - } - - /* Perform SILC Key Exchange. */ - silc_client_key_exchange(sg->client, ¶ms, sg->public_key, - sg->private_key, stream, SILC_CONN_SERVER, - silcpurple_connect_cb, gc); - - silc_free(params.detach_data); -} - -static void -silcpurple_login_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - SilcPurple sg; - - g_return_if_fail(gc != NULL); - - sg = gc->proto_data; - - if (source < 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - silc_pkcs_public_key_free(sg->public_key); - silc_pkcs_private_key_free(sg->private_key); - silc_free(sg); - gc->proto_data = NULL; - return; - } - - silc_hash_alloc((unsigned char *)"sha1", &sg->sha1hash); - - /* Wrap socket to TCP stream */ - silc_socket_tcp_stream_create(source, TRUE, FALSE, - sg->client->schedule, - silcpurple_stream_created, gc); -} - -static void silcpurple_continue_running(SilcPurple sg) -{ - PurpleConnection *gc = sg->gc; - PurpleAccount *account = purple_connection_get_account(gc); - - /* Connect to the SILC server */ - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), - silcpurple_login_connected, gc) == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - gc->proto_data = NULL; - silc_free(sg); - return; - } -} - -static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = (SilcPurple)gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - char pkd[256], prd[256]; - const char *password; - gboolean remember; - - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - - password = purple_request_fields_get_string(fields, "password"); - remember = purple_request_fields_get_bool(fields, "remember"); - - if (!password || !*password) - { - purple_notify_error(gc, NULL, _("Password is required to sign on."), NULL); - gc->proto_data = NULL; - silc_free(sg); - return; - } - - if (remember) - purple_account_set_remember_password(account, TRUE); - - purple_account_set_password(account, password); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - password, - &sg->public_key, &sg->private_key)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to load SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); - return; - } - silcpurple_continue_running(sg); -} - -static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg; - /* The password prompt dialog doesn't get disposed if the account disconnects */ - if (!PURPLE_CONNECTION_IS_VALID(gc)) - return; - sg = gc->proto_data; - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to load SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); -} - -static void silcpurple_running(SilcClient client, void *context) -{ - SilcPurple sg = context; - PurpleConnection *gc = sg->gc; - PurpleAccount *account = purple_connection_get_account(gc); - char pkd[256], prd[256]; - - - /* Progress */ - purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, - &sg->public_key, &sg->private_key)) { - if (!purple_account_get_password(account)) { - purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb), - G_CALLBACK(silcpurple_no_password_cb), gc); - return; - } - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to load SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); - return; - } - silcpurple_continue_running(sg); -} - -static void -silcpurple_login(PurpleAccount *account) -{ - SilcClient client; - PurpleConnection *gc; - SilcPurple sg; - SilcClientParams params; - const char *cipher, *hmac; - char *username, *hostname, *realname, **up; - int i; - - gc = account->gc; - if (!gc) - return; - gc->proto_data = NULL; - - memset(¶ms, 0, sizeof(params)); - strcat(params.nickname_format, "%n#a"); - - /* Allocate SILC client */ - client = silc_client_alloc(&ops, ¶ms, gc, NULL); - if (!client) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Out of memory")); - return; - } - - /* Get username, real name and local hostname for SILC library */ - if (!purple_account_get_username(account)) - purple_account_set_username(account, silc_get_username()); - - username = (char *)purple_account_get_username(account); - up = g_strsplit(username, "@", 2); - username = g_strdup(up[0]); - g_strfreev(up); - - if (!purple_account_get_user_info(account)) { - purple_account_set_user_info(account, silc_get_real_name()); - if (!purple_account_get_user_info(account)) - purple_account_set_user_info(account, - "John T. Noname"); - } - realname = (char *)purple_account_get_user_info(account); - hostname = silc_net_localhost(); - - purple_connection_set_display_name(gc, username); - - /* Register requested cipher and HMAC */ - cipher = purple_account_get_string(account, "cipher", - SILC_DEFAULT_CIPHER); - for (i = 0; silc_default_ciphers[i].name; i++) - if (!strcmp(silc_default_ciphers[i].name, cipher)) { - silc_cipher_register(&(silc_default_ciphers[i])); - break; - } - hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); - for (i = 0; silc_default_hmacs[i].name; i++) - if (!strcmp(silc_default_hmacs[i].name, hmac)) { - silc_hmac_register(&(silc_default_hmacs[i])); - break; - } - - sg = silc_calloc(1, sizeof(*sg)); - if (!sg) - return; - sg->client = client; - sg->gc = gc; - sg->account = account; - gc->proto_data = sg; - - /* Init SILC client */ - if (!silc_client_init(client, username, hostname, realname, - silcpurple_running, sg)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to initialize SILC protocol")); - gc->proto_data = NULL; - silc_free(sg); - silc_free(hostname); - g_free(username); - return; - } - silc_free(hostname); - g_free(username); - - /* Check the ~/.silc dir and create it, and new key pair if necessary. */ - if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Error loading SILC key pair")); - gc->proto_data = NULL; - silc_free(sg); - return; - } - -#if __SILC_TOOLKIT_VERSION < SILC_VERSION(1,1,1) - /* Schedule SILC using Glib's event loop */ - sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, client); -#else - /* Run SILC scheduler */ - sg->tasks = silc_dlist_init(); - silc_schedule_set_notify(client->schedule, silcpurple_scheduler, - client); - silc_client_run_one(client); -#endif /* __SILC_TOOLKIT_VERSION */ -} - -static int -silcpurple_close_final(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - - silc_client_stop(sg->client, NULL, NULL); - silc_client_free(sg->client); - if (sg->sha1hash) - silc_hash_free(sg->sha1hash); - if (sg->mimeass) - silc_mime_assembler_free(sg->mimeass); - silc_free(sg); - return 0; -} - -static void -silcpurple_close(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; -#if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) - SilcPurpleTask task; -#endif /* __SILC_TOOLKIT_VERSION */ - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - g_return_if_fail(sg != NULL); - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - /* Send QUIT */ - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", quit_msg, - NULL); - g_free(quit_msg); - - if (sg->conn) - silc_client_close_connection(sg->client, sg->conn); - -#if __SILC_TOOLKIT_VERSION >= SILC_VERSION(1,1,1) - if (sg->conn) - silc_client_run_one(sg->client); - silc_schedule_set_notify(sg->client->schedule, NULL, NULL); - - silc_dlist_start(sg->tasks); - while ((task = silc_dlist_get(sg->tasks))) { - purple_input_remove(task->tag); - silc_free(task); - } - silc_dlist_uninit(sg->tasks); -#endif /* __SILC_TOOLKIT_VERSION */ - - purple_timeout_remove(sg->scheduler); - purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); -} - - -/****************************** Protocol Actions *****************************/ - -static void -silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - char *tmp; - SilcUInt32 tmp_len, mask; - SilcAttributeObjService service; - SilcAttributeObjDevice dev; - SilcVCardStruct vcard; - const char *val; - - sg = gc->proto_data; - if (!sg) - return; - - memset(&service, 0, sizeof(service)); - memset(&dev, 0, sizeof(dev)); - memset(&vcard, 0, sizeof(vcard)); - - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_INFO, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_TIMEZONE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_GEOLOCATION, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, NULL); - - /* Set mood */ - mask = 0; - f = purple_request_fields_get_field(fields, "mood_normal"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_NORMAL; - f = purple_request_fields_get_field(fields, "mood_happy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_HAPPY; - f = purple_request_fields_get_field(fields, "mood_sad"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SAD; - f = purple_request_fields_get_field(fields, "mood_angry"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANGRY; - f = purple_request_fields_get_field(fields, "mood_jealous"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; - f = purple_request_fields_get_field(fields, "mood_ashamed"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; - f = purple_request_fields_get_field(fields, "mood_invincible"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; - f = purple_request_fields_get_field(fields, "mood_inlove"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INLOVE; - f = purple_request_fields_get_field(fields, "mood_sleepy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; - f = purple_request_fields_get_field(fields, "mood_bored"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_BORED; - f = purple_request_fields_get_field(fields, "mood_excited"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_EXCITED; - f = purple_request_fields_get_field(fields, "mood_anxious"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set preferred contact */ - mask = 0; - f = purple_request_fields_get_field(fields, "contact_chat"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CHAT; - f = purple_request_fields_get_field(fields, "contact_email"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; - f = purple_request_fields_get_field(fields, "contact_call"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CALL; - f = purple_request_fields_get_field(fields, "contact_sms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_SMS; - f = purple_request_fields_get_field(fields, "contact_mms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_MMS; - f = purple_request_fields_get_field(fields, "contact_video"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; - if (mask) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set status text */ - val = NULL; - f = purple_request_fields_get_field(fields, "status_text"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, - (void *)val, strlen(val)); - - /* Set vcard */ - val = NULL; - f = purple_request_fields_get_field(fields, "vcard"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) { - purple_account_set_string(sg->account, "vcard", val); - tmp = silc_file_readfile(val, &tmp_len); - if (tmp) { - tmp[tmp_len] = 0; - if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_INFO, - (void *)&vcard, - sizeof(vcard)); - } - silc_vcard_free(&vcard); - silc_free(tmp); - } else { - purple_account_set_string(sg->account, "vcard", ""); - } - -#ifdef HAVE_SYS_UTSNAME_H - /* Set device info */ - f = purple_request_fields_get_field(fields, "device"); - if (f && purple_request_field_bool_get_value(f)) { - struct utsname u; - if (!uname(&u)) { - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } - } -#endif - - /* Set timezone */ - val = NULL; - f = purple_request_fields_get_field(fields, "timezone"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)val, strlen(val)); -} - -static void -silcpurple_attrs(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcHashTable attrs; - SilcAttributePayload attr; - gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, - mangry = FALSE, mjealous = FALSE, mashamed = FALSE, - minvincible = FALSE, minlove = FALSE, msleepy = FALSE, - mbored = FALSE, mexcited = FALSE, manxious = FALSE; - gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, - cmms = FALSE, cchat = TRUE, cvideo = FALSE; - gboolean device = TRUE; - char status[1024], tz[16]; - - sg = gc->proto_data; - if (!sg) - return; - - memset(status, 0, sizeof(status)); - - attrs = silc_client_attributes_get(client, conn); - if (attrs) { - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), - NULL, (void *)&attr)) { - SilcUInt32 mood = 0; - silc_attribute_get_object(attr, &mood, sizeof(mood)); - mnormal = !mood; - mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); - msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); - mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); - mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); - mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); - minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); - minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); - msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); - mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); - mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); - manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), - NULL, (void *)&attr)) { - SilcUInt32 contact = 0; - silc_attribute_get_object(attr, &contact, sizeof(contact)); - cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); - ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); - csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); - cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); - cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); - cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), - NULL, (void *)&attr)) - silc_attribute_get_object(attr, &status, sizeof(status)); - - if (!silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), - NULL, (void *)&attr)) - device = FALSE; - } - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l3", _("Your Current Mood")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_email", _("Email"), cemail); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("status_text", _("Your Current Status"), - status[0] ? status : NULL, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); -#if 0 - f = purple_request_field_label_new("l2", _("Online Services")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("services", - _("Let others see what services you are using"), - TRUE); - purple_request_field_group_add_field(g, f); -#endif -#ifdef HAVE_SYS_UTSNAME_H - f = purple_request_field_bool_new("device", - _("Let others see what computer you are using"), - device); - purple_request_field_group_add_field(g, f); -#endif - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("vcard", _("Your VCard File"), - purple_account_get_string(sg->account, "vcard", ""), - FALSE); - purple_request_field_group_add_field(g, f); - - silc_timezone(tz, sizeof(tz)); - f = purple_request_field_string_new("timezone", _("Timezone (UTC)"), tz, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("User Online Status Attributes"), - _("User Online Status Attributes"), - _("You can let other users see your online status information " - "and your personal information. Please fill the information " - "you would like other users to see about yourself."), - fields, - _("OK"), G_CALLBACK(silcpurple_attrs_cb), - _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); -} - -static void -silcpurple_detach(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - /* Call DETACH */ - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; -} - -static void -silcpurple_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - char *tmp; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - if (!sg->motd) { - purple_notify_error( - gc, _("Message of the Day"), _("No Message of the Day available"), - _("There is no Message of the Day associated with this connection")); - return; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); -} - -static void -silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - PurpleRequestField *f; - const char *val, *pkfile = NULL, *prfile = NULL; - const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; - const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; - char *identifier; - int keylen = SILCPURPLE_DEF_PKCS_LEN; - SilcPublicKey public_key; - - sg = gc->proto_data; - if (!sg) - return; - - val = NULL; - f = purple_request_fields_get_field(fields, "pass1"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass1 = val; - else - pass1 = ""; - val = NULL; - f = purple_request_fields_get_field(fields, "pass2"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass2 = val; - else - pass2 = ""; - - if (strcmp(pass1, pass2)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); - return; - } - - val = NULL; - f = purple_request_fields_get_field(fields, "key"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - keylen = atoi(val); - f = purple_request_fields_get_field(fields, "pkfile"); - if (f) - pkfile = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "prfile"); - if (f) - prfile = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "un"); - if (f) - un = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "hn"); - if (f) - hn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "rn"); - if (f) - rn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "e"); - if (f) - e = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "o"); - if (f) - o = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "c"); - if (f) - c = purple_request_field_string_get_value(f); - - identifier = silc_pkcs_silc_encode_identifier((char *)un, (char *)hn, - (char *)rn, (char *)e, - (char *)o, (char *)c, - NULL); - - /* Create the key pair */ - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile, - identifier, pass1, &public_key, NULL, - FALSE)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); - return; - } - - silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); - - silc_pkcs_public_key_free(public_key); - silc_free(identifier); -} - -static void -silcpurple_create_keypair(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - const char *username, *realname; - char *hostname, **u; - char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; - - username = purple_account_get_username(sg->account); - u = g_strsplit(username, "@", 2); - username = u[0]; - realname = purple_account_get_user_info(sg->account); - hostname = silc_net_localhost(); - g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); - - g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); - g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); - g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); - g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("e", _("Email"), tmp, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("o", _("Organization"), "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("c", _("Country"), "", FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("Create New SILC Key Pair"), - _("Create New SILC Key Pair"), NULL, fields, - _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), - _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); - - g_strfreev(u); - silc_free(hostname); -} - -static void -silcpurple_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -static void -silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - char prd[256]; - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, - "private-key", - prd), old ? old : "", new ? new : ""); -} - -static void -silcpurple_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void -silcpurple_set_info(PurpleConnection *gc, const char *text) -{ -} - -static GList * -silcpurple_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Online Status"), - silcpurple_attrs); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Detach From Server"), - silcpurple_detach); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("View Message of the Day"), - silcpurple_view_motd); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Create SILC Key Pair..."), - silcpurple_create_keypair); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Change Password..."), - silcpurple_change_pass); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Set User Info..."), - silcpurple_show_set_info); - list = g_list_append(list, act); - - return list; -} - - -/******************************* IM Routines *********************************/ - -typedef struct { - char *nick; - char *message; - SilcUInt32 message_len; - SilcMessageFlags flags; - PurpleMessageFlags gflags; -} *SilcPurpleIM; - -static void -silcpurple_send_im_resolved(SilcClient client, - SilcClientConnection conn, - SilcStatus status, - SilcDList clients, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleIM im = context; - PurpleConversation *convo; - char tmp[256]; - SilcClientEntry client_entry; - SilcDList list; - gboolean free_list = FALSE; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, - sg->account); - if (!convo) - return; - - if (!clients) - goto err; - - if (silc_dlist_count(clients) > 1) { - /* Find the correct one. The im->nick might be a formatted nick - so this will find the correct one. */ - clients = silc_client_get_clients_local(client, conn, - im->nick, FALSE); - if (!clients) - goto err; - - free_list = TRUE; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - /* Check for images */ - if (im->gflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(im->message, - (SilcUInt32 *)(void *)&im->flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - silc_client_send_private_message(client, conn, - client_entry, im->flags, sg->sha1hash, - buf->data, - silc_buffer_len(buf)); - silc_mime_partial_free(list); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - } - } - - /* Send the message */ - silc_client_send_private_message(client, conn, client_entry, im->flags, - sg->sha1hash, (unsigned char *)im->message, im->message_len); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - - err: - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), im->nick); - purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - out: - if (free_list) { - silc_client_list_free(client, conn, clients); - } - g_free(im->nick); - g_free(im->message); - silc_free(im); -} - -static int -silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcDList clients; - SilcClientEntry client_entry; - SilcUInt32 mflags; - char *msg, *tmp; - int ret = 0; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - SilcDList list; - - if (!who || !message) - return 0; - - mflags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg = purple_unescape_html(message); - - if (!g_ascii_strncasecmp(msg, "/me ", 4)) { - msg += 4; - if (!*msg) { - g_free(tmp); - return 0; - } - mflags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), - _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - if (sign) - mflags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, who, FALSE); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleIM im = silc_calloc(1, sizeof(*im)); - if (!im) { - g_free(tmp); - return 0; - } - im->nick = g_strdup(who); - im->message = g_strdup(message); - im->message_len = strlen(im->message); - im->flags = mflags; - im->gflags = flags; - silc_client_get_clients(client, conn, who, NULL, - silcpurple_send_im_resolved, im); - g_free(tmp); - return 0; - } - - silc_dlist_start(clients); - client_entry = silc_dlist_get(clients); - - /* Check for images */ - if (flags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(message, &mflags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_private_message(client, conn, - client_entry, mflags, sg->sha1hash, - buf->data, - silc_buffer_len(buf)); - silc_mime_partial_free(list); - g_free(tmp); - silc_client_list_free(client, conn, clients); - return ret; - } - } - - /* Send private message directly */ - ret = silc_client_send_private_message(client, conn, client_entry, - mflags, sg->sha1hash, - (unsigned char *)msg, - strlen(msg)); - - g_free(tmp); - silc_client_list_free(client, conn, clients); - return ret; -} - - -static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { - /* split this single menu building function back into the two - original: one for buddies and one for chats */ - if(PURPLE_BLIST_NODE_IS_CHAT(node)) { - return silcpurple_chat_menu((PurpleChat *) node); - } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return silcpurple_buddy_menu((PurpleBuddy *) node); - } else { - g_return_val_if_reached(NULL); - } -} - -/********************************* Commands **********************************/ - -static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - PurpleConversation *convo = conv; - int id = 0; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - if(args && args[0]) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); - - if (convo != NULL) - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); - - if (id == 0) - return PURPLE_CMD_RET_FAILED; - - silcpurple_chat_leave(gc, id); - - return PURPLE_CMD_RET_OK; - -} - -static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - int id = 0; - char *buf, *tmp, *tmp2; - const char *topic; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == 0) - return PURPLE_CMD_RET_FAILED; - - if (!args || !args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); - if (topic) { - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - } - - if (args && args[0] && (strlen(args[0]) > 255)) { - *error = g_strdup(_("Topic too long")); - return PURPLE_CMD_RET_FAILED; - } - - silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - GHashTable *comp; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(comp, "channel", args[0]); - if(args[1]) - g_hash_table_replace(comp, "passphrase", args[1]); - - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); - purple_roomlist_show_with_account(purple_connection_get_account(gc)); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - silcpurple_get_info(gc, args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret; - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret = 1; - PurpleConversation *convo; - PurpleConnection *gc; - PurpleAccount *account; - - if (!args || !args[0]) { - *error = g_strdup(_("You must specify a nick")); - return PURPLE_CMD_RET_FAILED; - } - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - account = purple_connection_get_account(gc); - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); - - if (args[1]) { - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *tmp; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!sg->motd) { - *error = g_strdup(_("There is no Message of the Day associated with this connection")); - return PURPLE_CMD_RET_FAILED; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - SilcChannelEntry channel; - char *silccmd, *silcargs, *msg, tmp[256]; - const char *chname; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL || !args || gc->proto_data == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (args[0]) - chname = args[0]; - else - chname = purple_conversation_get_name(conv); - - if (!args[1]) { - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - *error = g_strdup_printf(_("channel %s not found"), chname); - return PURPLE_CMD_RET_FAILED; - } - if (channel->mode) { - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); - } else { - msg = g_strdup_printf(_("no channel modes are set on %s"), chname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", - msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - return PURPLE_CMD_RET_OK; - } - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *silccmd, *silcargs; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); - g_free(quit_msg); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!silc_client_command_call(sg->client, sg->conn, args[0])) { - *error = g_strdup_printf(_("Unknown command: %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - - -/************************** Plugin Initialization ****************************/ - -static void -silcpurple_register_commands(void) -{ - purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); - purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); - purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); - purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_join, - _("join <channel> [<password>]: Join a chat on this network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); - purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", - silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); - purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_msg, - _("msg <nick> <message>: Send a private message to a user"), NULL); - purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, - _("query <nick> [<message>]: Send a private message to a user"), NULL); - purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, - _("motd: View the server's Message Of The Day"), NULL); - purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_detach, - _("detach: Detach this session"), NULL); - purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, - _("quit [message]: Disconnect from the server, with an optional message"), NULL); - purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_call, - _("call <command>: Call any silc client command"), NULL); - /* These below just get passed through for the silc client library to deal - * with */ - purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); - purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("nick <newnick>: Change your nickname"), NULL); - purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("whowas <nick>: View nick's information"), NULL); - purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, - _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); - purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); - purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("umode <usermodes>: Set your modes in the network"), NULL); - purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); - purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); - purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); - purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("info [server]: View server administrative details"), NULL); - purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); - purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); - purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("stats: View server and network statistics"), NULL); - purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("ping: Send PING to the connected server"), NULL); -#if 0 /* Purple doesn't handle these yet */ - purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_users, - _("users <channel>: List users in channel")); - purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names, - _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); -#endif -} - -static PurpleWhiteboardPrplOps silcpurple_wb_ops = -{ - silcpurple_wb_start, - silcpurple_wb_end, - silcpurple_wb_get_dimensions, - silcpurple_wb_set_dimensions, - silcpurple_wb_get_brush, - silcpurple_wb_set_brush, - silcpurple_wb_send, - silcpurple_wb_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | - OPT_PROTO_SLASH_COMMANDS_NATIVE, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ - silcpurple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - silcpurple_status_text, /* status_text */ - silcpurple_tooltip_text, /* tooltip_text */ - silcpurple_away_states, /* away_states */ - silcpurple_blist_node_menu, /* blist_node_menu */ - silcpurple_chat_info, /* chat_info */ - silcpurple_chat_info_defaults, /* chat_info_defaults */ - silcpurple_login, /* login */ - silcpurple_close, /* close */ - silcpurple_send_im, /* send_im */ - silcpurple_set_info, /* set_info */ - NULL, /* send_typing */ - silcpurple_get_info, /* get_info */ - silcpurple_set_status, /* set_status */ - silcpurple_idle_set, /* set_idle */ - silcpurple_change_passwd, /* change_passwd */ - silcpurple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - silcpurple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - silcpurple_chat_join, /* join_chat */ - NULL, /* reject_chat */ - silcpurple_get_chat_name, /* get_chat_name */ - silcpurple_chat_invite, /* chat_invite */ - silcpurple_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - silcpurple_chat_send, /* chat_send */ - silcpurple_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - silcpurple_buddy_set_icon, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - silcpurple_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - silcpurple_roomlist_get_list, /* roomlist_get_list */ - silcpurple_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - silcpurple_ftp_send_file, /* send_file */ - silcpurple_ftp_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - &silcpurple_wb_ops, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-silc", /**< id */ - "SILC", /**< name */ - "1.1", /**< version */ - /** summary */ - N_("SILC Protocol Plugin"), - /** description */ - N_("Secure Internet Live Conferencing (SILC) Protocol"), - "Pekka Riikonen", /**< author */ - "http://silcnet.org/", /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - silcpurple_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -#if 0 -static SilcBool silcpurple_debug_cb(char *file, char *function, int line, - char *message, void *context) -{ - purple_debug_info("SILC", "%s:%d:%s - %s\n", file ? file : "(null)", line, function ? function : "(null)", message ? message : "(null)"); - return TRUE; -} -#endif - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleAccountUserSplit *split; - char tmp[256]; - int i; - PurpleKeyValuePair *kvp; - GList *list = NULL; - - silc_plugin = plugin; - - split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Account options */ - option = purple_account_option_string_new(_("Connect server"), - "server", - "silc.silcnet.org"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_int_new(_("Port"), "port", 706); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Public Key file"), - "public-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Private Key file"), - "private-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - for (i = 0; silc_default_ciphers[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_ciphers[i].name); - kvp->value = g_strdup(silc_default_ciphers[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("Cipher"), "cipher", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - list = NULL; - for (i = 0; silc_default_hmacs[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_hmacs[i].name); - kvp->value = g_strdup(silc_default_hmacs[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("HMAC"), "hmac", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use Perfect Forward Secrecy"), - "pfs", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Public key authentication"), - "pubkey-auth", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), - "block-ims", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block messages to whiteboard"), - "block-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Automatically open whiteboard"), - "open-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), - "sign-verify", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_remove("/plugins/prpl/silc"); - - silc_log_set_callback(SILC_LOG_ERROR, silcpurple_log_error, NULL); - silcpurple_register_commands(); - -#if 0 -silc_log_debug(TRUE); -silc_log_set_debug_string("*client*"); -silc_log_quick(TRUE); -silc_log_set_debug_callbacks(silcpurple_debug_cb, NULL, NULL, NULL); -#endif - -} - -PURPLE_INIT_PLUGIN(silc, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silcpurple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silcpurple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silcpurple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/silcpurple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_H -#define SILCPURPLE_H - -/* Purple includes */ -#include "internal.h" -#include "account.h" -#include "accountopt.h" -#include "cmds.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -#undef SILC_VERSION -#define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)) - -/* Default public and private key file names */ -#define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" -#define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" - -/* Default settings for creating key pair */ -#define SILCPURPLE_DEF_PKCS "rsa" -#define SILCPURPLE_DEF_PKCS_LEN 2048 - -#define SILCPURPLE_PRVGRP 0x001fffff - -/* Status IDs */ -#define SILCPURPLE_STATUS_ID_OFFLINE "offline" -#define SILCPURPLE_STATUS_ID_AVAILABLE "available" -#define SILCPURPLE_STATUS_ID_HYPER "hyper" -#define SILCPURPLE_STATUS_ID_AWAY "away" -#define SILCPURPLE_STATUS_ID_BUSY "busy" -#define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" -#define SILCPURPLE_STATUS_ID_PAGE "page" - -typedef struct { - unsigned long id; - const char *channel; - unsigned long chid; - const char *parentch; - SilcChannelPrivateKey key; -} *SilcPurplePrvgrp; - -/* The SILC Purple plugin context */ -typedef struct SilcPurpleStruct { - SilcClient client; - SilcClientConnection conn; - SilcPublicKey public_key; - SilcPrivateKey private_key; - SilcHash sha1hash; - - SilcDList tasks; - guint scheduler; - PurpleConnection *gc; - PurpleAccount *account; - unsigned long channel_ids; - GList *grps; - - char *motd; - PurpleRoomlist *roomlist; - SilcMimeAssembler mimeass; - unsigned int detaching : 1; - unsigned int resuming : 1; - unsigned int roomlist_canceled : 1; - unsigned int chpk : 1; -} *SilcPurple; - - -void silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...); -SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommand command, SilcStatus status, - SilcStatus error, void *context, va_list ap); -gboolean silcpurple_check_silc_dir(PurpleConnection *gc); -const char *silcpurple_silcdir(void); -const char *silcpurple_session_file(const char *account); -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, - SilcConnectionType conn_type, - SilcPublicKey public_key, - SilcVerifyPublicKey completion, - void *context); -GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_send_buddylist(PurpleConnection *gc); -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port, - SilcUInt16 protocol); -void silcpurple_idle_set(PurpleConnection *gc, int idle); -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -char *silcpurple_status_text(PurpleBuddy *b); -gboolean silcpurple_ip_is_private(const char *ip); -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port); -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context); -void silcpurple_get_info(PurpleConnection *gc, const char *who); -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -GList *silcpurple_chat_info(PurpleConnection *gc); -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -GList *silcpurple_chat_menu(PurpleChat *); -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); -char *silcpurple_get_chat_name(GHashTable *data); -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name); -void silcpurple_chat_leave(PurpleConnection *gc, int id); -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); -void silcpurple_roomlist_cancel(PurpleRoomlist *list); -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcDList channel_pubkeys); -void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr); -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -char *silcpurple_file2mime(const char *filename); -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); - -#ifdef _WIN32 -typedef int uid_t; - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - int pw_uid; /* user id */ - int pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct passwd *getpwuid(int uid); -int getuid(void); -int geteuid(void); -#endif - -#endif /* SILCPURPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/TODO qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/TODO --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/TODO 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -Features TODO (maybe) -===================== - -Preferences - - Add joined channels to buddy list automatically (during - session) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,779 +0,0 @@ -/* - - silcpurple_util.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" - -/**************************** Utility Routines *******************************/ - -static char str[256], str2[256]; - -const char *silcpurple_silcdir(void) -{ - const char *hd = purple_home_dir(); - memset(str, 0, sizeof(str)); - g_snprintf(str, sizeof(str) - 1, "%s" G_DIR_SEPARATOR_S ".silc", hd ? hd : "/tmp"); - return (const char *)str; -} - -const char *silcpurple_session_file(const char *account) -{ - memset(str2, 0, sizeof(str2)); - g_snprintf(str2, sizeof(str2) - 1, "%s" G_DIR_SEPARATOR_S "%s_session", - silcpurple_silcdir(), account); - return (const char *)str2; -} - -gboolean silcpurple_ip_is_private(const char *ip) -{ - if (silc_net_is_ip4(ip)) { - if (!strncmp(ip, "10.", 3)) { - return TRUE; - } else if (!strncmp(ip, "172.", 4) && strlen(ip) > 6) { - char tmp[3]; - int s; - memset(tmp, 0, sizeof(tmp)); - strncpy(tmp, ip + 4, 2); - s = atoi(tmp); - if (s >= 16 && s <= 31) - return TRUE; - } else if (!strncmp(ip, "192.168.", 8)) { - return TRUE; - } - } - - return FALSE; -} - -/* This checks stats for various SILC files and directories. First it - checks if ~/.silc directory exist and is owned by the correct user. If - it doesn't exist, it will create the directory. After that it checks if - user's Public and Private key files exists and creates them if needed. */ - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc) -{ - char filename[256], file_public_key[256], file_private_key[256]; - char servfilename[256], clientfilename[256], friendsfilename[256]; - char pkd[256], prd[256]; - struct stat st; - struct passwd *pw; - int fd; - - pw = getpwuid(getuid()); - if (!pw) { - purple_debug_error("silc", "silc: %s\n", g_strerror(errno)); - return FALSE; - } - - g_snprintf(filename, sizeof(filename) - 1, "%s", silcpurple_silcdir()); - g_snprintf(servfilename, sizeof(servfilename) - 1, "%s" G_DIR_SEPARATOR_S "serverkeys", - silcpurple_silcdir()); - g_snprintf(clientfilename, sizeof(clientfilename) - 1, "%s" G_DIR_SEPARATOR_S "clientkeys", - silcpurple_silcdir()); - g_snprintf(friendsfilename, sizeof(friendsfilename) - 1, "%s" G_DIR_SEPARATOR_S "friends", - silcpurple_silcdir()); - - /* - * Check ~/.silc directory - */ - if ((g_stat(filename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(filename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno)); - return FALSE; - } - } else { -#ifndef _WIN32 - /* Check the owner of the dir */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own '%s' directory\n", - filename); - return FALSE; - } -#endif - } - - /* - * Check ~./silc/serverkeys directory - */ - if ((g_stat(servfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(servfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - servfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/clientkeys directory - */ - if ((g_stat(clientfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(clientfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - clientfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/friends directory - */ - if ((g_stat(friendsfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(friendsfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - friendsfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check Public and Private keys - */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); - g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); - - if ((g_stat(file_public_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, - file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, - NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to create SILC key pair")); - return FALSE; - } - - if ((g_stat(file_public_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the public key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your public key!?\n"); - return FALSE; - } -#endif - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } else if ((g_stat(file_private_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, - file_private_key, NULL, - (gc->password == NULL) - ? "" : gc->password, - NULL, NULL, FALSE)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to create SILC key pair")); - return FALSE; - } - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } - /* This shouldn't really happen because silc_create_key_pair() - * will set the permissions */ - else if ((g_stat(file_private_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the private key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your private key!?\n"); - if (fd != -1) - close(fd); - return FALSE; - } - - /* Check the permissions for the private key */ - if ((st.st_mode & 0777) != 0600) { - purple_debug_warning("silc", "Wrong permissions in your private key file `%s'!\n" - "Trying to change them ...\n", file_private_key); - if ((fd == -1) || (fchmod(fd, S_IRUSR | S_IWUSR)) == -1) { - purple_debug_error("silc", - "Failed to change permissions for private key file!\n" - "Permissions for your private key file must be 0600.\n"); - if (fd != -1) - close(fd); - return FALSE; - } - purple_debug_warning("silc", "Done.\n\n"); - } -#endif - - if (fd != -1) - close(fd); - - return TRUE; -} - -#ifdef _WIN32 -struct passwd *getpwuid(uid_t uid) { - struct passwd *pwd = calloc(1, sizeof(struct passwd)); - return pwd; -} - -uid_t getuid() { - return 0; -} - -uid_t geteuid() { - return 0; -} -#endif - -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context) -{ - SilcPublicKeyIdentifier ident; - SilcSILCPublicKey silc_pubkey; - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len, key_len = 0; - GString *s; - - /* We support showing only SILC public keys for now */ - if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC) - return; - - silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key); - ident = &silc_pubkey->identifier; - key_len = silc_pkcs_public_key_get_len(public_key); - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - return; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - if (!fingerprint || !babbleprint) - return; - - s = g_string_new(""); - if (ident->realname) - /* Hint for translators: Please check the tabulator width here and in - the next strings (short strings: 2 tabs, longer strings 1 tab, - sum: 3 tabs or 24 characters) */ - g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname); - if (ident->username) - g_string_append_printf(s, _("User Name: \t%s\n"), ident->username); - if (ident->email) - g_string_append_printf(s, _("Email: \t\t%s\n"), ident->email); - if (ident->host) - g_string_append_printf(s, _("Host Name: \t%s\n"), ident->host); - if (ident->org) - g_string_append_printf(s, _("Organization: \t%s\n"), ident->org); - if (ident->country) - g_string_append_printf(s, _("Country: \t%s\n"), ident->country); - g_string_append_printf(s, _("Algorithm: \t%s\n"), silc_pubkey->pkcs->name); - g_string_append_printf(s, _("Key Length: \t%d bits\n"), (int)key_len); - if (ident->version) - g_string_append_printf(s, _("Version: \t%s\n"), ident->version); - g_string_append_printf(s, "\n"); - g_string_append_printf(s, _("Public Key Fingerprint:\n%s\n\n"), fingerprint); - g_string_append_printf(s, _("Public Key Babbleprint:\n%s"), babbleprint); - - purple_request_action(sg->gc, _("Public Key Information"), - _("Public Key Information"), - s->str, 0, purple_connection_get_account(sg->gc), - NULL, NULL, context, 1, _("Close"), callback); - - g_string_free(s, TRUE); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); -} - -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute) -{ - SilcAttributePayload attr = NULL; - - if (!attrs) - return NULL; - - silc_dlist_start(attrs); - while ((attr = silc_dlist_get(attrs)) != SILC_LIST_END) - if (attribute == silc_attribute_get_attribute(attr)) - break; - - return attr; -} - -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if ((mode & SILC_UMODE_SERVER_OPERATOR) || - (mode & SILC_UMODE_ROUTER_OPERATOR)) { - strcat(buf, (mode & SILC_UMODE_SERVER_OPERATOR) ? - "[server operator] " : - (mode & SILC_UMODE_ROUTER_OPERATOR) ? - "[SILC operator] " : "[unknown mode] "); - } - if (mode & SILC_UMODE_GONE) - strcat(buf, "[away] "); - if (mode & SILC_UMODE_INDISPOSED) - strcat(buf, "[indisposed] "); - if (mode & SILC_UMODE_BUSY) - strcat(buf, "[busy] "); - if (mode & SILC_UMODE_PAGE) - strcat(buf, "[wake me up] "); - if (mode & SILC_UMODE_HYPER) - strcat(buf, "[hyperactive] "); - if (mode & SILC_UMODE_ROBOT) - strcat(buf, "[robot] "); - if (mode & SILC_UMODE_ANONYMOUS) - strcat(buf, "[anonymous] "); - if (mode & SILC_UMODE_BLOCK_PRIVMSG) - strcat(buf, "[blocks private messages] "); - if (mode & SILC_UMODE_DETACHED) - strcat(buf, "[detached] "); - if (mode & SILC_UMODE_REJECT_WATCHING) - strcat(buf, "[rejects watching] "); - if (mode & SILC_UMODE_BLOCK_INVITE) - strcat(buf, "[blocks invites] "); - g_strchomp(buf); -} - -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) - strcat(buf, "[permanent] "); - if (mode & SILC_CHANNEL_MODE_PRIVATE) - strcat(buf, "[private] "); - if (mode & SILC_CHANNEL_MODE_SECRET) - strcat(buf, "[secret] "); - if (mode & SILC_CHANNEL_MODE_PRIVKEY) - strcat(buf, "[private key] "); - if (mode & SILC_CHANNEL_MODE_INVITE) - strcat(buf, "[invite only] "); - if (mode & SILC_CHANNEL_MODE_TOPIC) - strcat(buf, "[topic restricted] "); - if (mode & SILC_CHANNEL_MODE_ULIMIT) - strcat(buf, "[user count limit] "); - if (mode & SILC_CHANNEL_MODE_PASSPHRASE) - strcat(buf, "[passphrase auth] "); - if (mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) - strcat(buf, "[public key auth] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_USERS) - strcat(buf, "[users silenced] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_OPERS) - strcat(buf, "[operators silenced] "); - g_strchomp(buf); -} - -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strcat(buf, "[founder] "); - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strcat(buf, "[operator] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES) - strcat(buf, "[blocks messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_USERS) - strcat(buf, "[blocks user messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS) - strcat(buf, "[blocks robot messages] "); - if (mode & SILC_CHANNEL_UMODE_QUIET) - strcat(buf, "[quieted] "); - g_strchomp(buf); -} - -void -silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr) -{ - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - SilcAttributeContact contact; - SilcAttributeObjDevice device; - SilcAttributeObjGeo geo; - - char tmp[1024]; - GString *s; - - *moodstr = NULL; - *statusstr = NULL; - *contactstr = NULL; - *langstr = NULL; - *devicestr = NULL; - *tzstr = NULL; - *geostr = NULL; - - if (!attrs) - return; - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - g_string_append_printf(s, "[%s] ", _("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - g_string_append_printf(s, "[%s] ", _("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - g_string_append_printf(s, "[%s] ", _("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - g_string_append_printf(s, "[%s] ", _("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - g_string_append_printf(s, "[%s] ", _("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - g_string_append_printf(s, "[%s] ", _("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - g_string_append_printf(s, "[%s] ", _("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - g_string_append_printf(s, "[%s] ", _("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - g_string_append_printf(s, "[%s] ", _("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - g_string_append_printf(s, "[%s] ", _("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - g_string_append_printf(s, "[%s] ", _("Anxious")); - } - if (strlen(s->str)) { - *moodstr = g_string_free(s, FALSE); - g_strchomp(*moodstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *statusstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); - if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { - if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) - g_string_append_printf(s, "[%s] ", _("Chat")); - if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) - g_string_append_printf(s, "[%s] ", _("Email")); - if (contact & SILC_ATTRIBUTE_CONTACT_CALL) - g_string_append_printf(s, "[%s] ", _("Phone")); - if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) - g_string_append_printf(s, "[%s] ", _("Paging")); - if (contact & SILC_ATTRIBUTE_CONTACT_SMS) - g_string_append_printf(s, "[%s] ", _("SMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_MMS) - g_string_append_printf(s, "[%s] ", _("MMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) - g_string_append_printf(s, "[%s] ", _("Video Conferencing")); - } - if (strlen(s->str)) { - *contactstr = g_string_free(s, FALSE); - g_strchomp(*contactstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *langstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_DEVICE_INFO); - memset(&device, 0, sizeof(device)); - if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { - if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) - g_string_append_printf(s, "%s: ", _("Computer")); - if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) - g_string_append_printf(s, "%s: ", _("Mobile Phone")); - if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) - g_string_append_printf(s, "%s: ", _("PDA")); - if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) - g_string_append_printf(s, "%s: ", _("Terminal")); - g_string_append_printf(s, "%s %s %s %s", - device.manufacturer ? device.manufacturer : "", - device.version ? device.version : "", - device.model ? device.model : "", - device.language ? device.language : ""); - } - if (strlen(s->str)) - *devicestr = g_string_free(s, FALSE); - else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_TIMEZONE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *tzstr = g_strdup(tmp); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_GEOLOCATION); - memset(&geo, 0, sizeof(geo)); - if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) - *geostr = g_strdup_printf("%s %s %s (%s)", - geo.longitude ? geo.longitude : "", - geo.latitude ? geo.latitude : "", - geo.altitude ? geo.altitude : "", - geo.accuracy ? geo.accuracy : ""); -} - -/* Returns MIME type of filetype */ - -char *silcpurple_file2mime(const char *filename) -{ - const char *ct; - - ct = strrchr(filename, '.'); - if (!ct) - return NULL; - else if (!g_ascii_strcasecmp(".png", ct)) - return g_strdup("image/png"); - else if (!g_ascii_strcasecmp(".jpg", ct)) - return g_strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".jpeg", ct)) - return g_strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".gif", ct)) - return g_strdup("image/gif"); - else if (!g_ascii_strcasecmp(".tiff", ct)) - return g_strdup("image/tiff"); - - return NULL; -} - -/* Checks if message has images, and assembles MIME message if it has. - If only one image is present, creates simple MIME image message. If - there are multiple images and/or text with images multipart MIME - message is created. */ - -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags) -{ - SilcMime mime = NULL, p; - SilcDList list, parts = NULL; - const char *start, *end, *last; - GData *attribs; - char *type; - gboolean images = FALSE; - - last = msg; - while (last && *last && purple_markup_find_tag("img", last, &start, - &end, &attribs)) { - PurpleStoredImage *image = NULL; - const char *id; - - /* Check if there is text before image */ - if (start - last) { - char *text, *tmp; - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - tmp = g_strndup(last, start - last); - text = purple_unescape_html(tmp); - g_free(tmp); - - /* Add text */ - silc_mime_add_data(p, (const unsigned char *)text, strlen(text)); - g_free(text); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - id = g_datalist_get_data(&attribs, "id"); - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - unsigned long imglen = purple_imgstore_get_size(image); - gconstpointer img = purple_imgstore_get_data(image); - - p = silc_mime_alloc(); - - /* Add content type */ - type = silcpurple_file2mime(purple_imgstore_get_filename(image)); - if (!type) { - g_datalist_clear(&attribs); - last = end + 1; - continue; - } - silc_mime_add_field(p, "Content-Type", type); - g_free(type); - - /* Add content transfer encoding */ - silc_mime_add_field(p, "Content-Transfer-Encoding", "binary"); - - /* Add image data */ - silc_mime_add_data(p, img, imglen); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - images = TRUE; - } - - g_datalist_clear(&attribs); - - /* Continue after tag */ - last = end + 1; - } - - /* Check for text after the image(s) */ - if (images && last && *last) { - char *tmp = purple_unescape_html(last); - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - /* Add text */ - silc_mime_add_data(p, (const unsigned char *)tmp, strlen(tmp)); - g_free(tmp); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - /* If there weren't any images, don't return anything. */ - if (!images) { - if (parts) - silc_dlist_uninit(parts); - return NULL; - } - - if (silc_dlist_count(parts) > 1) { - /* Multipart MIME message */ - char b[32]; - mime = silc_mime_alloc(); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - g_snprintf(b, sizeof(b), "b%4X%4X", - (unsigned int)time(NULL), - silc_dlist_count(parts)); - silc_mime_set_multipart(mime, "mixed", b); - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) - silc_mime_add_multipart(mime, p); - } else { - /* Simple MIME message */ - silc_dlist_start(parts); - mime = silc_dlist_get(parts); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - } - - *mflags &= ~SILC_MESSAGE_FLAG_UTF8; - *mflags |= SILC_MESSAGE_FLAG_DATA; - - /* Encode message. Fragment if it is too large */ - list = silc_mime_encode_partial(mime, 0xfc00); - - silc_dlist_uninit(parts); - - /* Added multiparts gets freed here */ - silc_mime_free(mime); - - return list; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -/* - - wb.c - - Author: Pekka Riikonen - - Copyright (C) 2005 - 2007 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "internal.h" -#include "silc.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/* - SILC Whiteboard packet: - - 1 byte command - 2 bytes width - 2 bytes height - 4 bytes brush color - 2 bytes brush size - n bytes data - - Data: - - 4 bytes x - 4 bytes y - - Commands: - - 0x01 draw - 0x02 clear - - MIME: - - MIME-Version: 1.0 - Content-Type: application/x-wb - Content-Transfer-Encoding: binary - -*/ - -#define SILCPURPLE_WB_MIME "MIME-Version: 1.0\r\nContent-Type: application/x-wb\r\nContent-Transfer-Encoding: binary\r\n\r\n" -#define SILCPURPLE_WB_HEADER strlen(SILCPURPLE_WB_MIME) + 11 - -#define SILCPURPLE_WB_WIDTH 500 -#define SILCPURPLE_WB_HEIGHT 400 -#define SILCPURPLE_WB_WIDTH_MAX 1024 -#define SILCPURPLE_WB_HEIGHT_MAX 1024 - -/* Commands */ -typedef enum { - SILCPURPLE_WB_DRAW = 0x01, - SILCPURPLE_WB_CLEAR = 0x02, -} SilcPurpleWbCommand; - -/* Brush size */ -typedef enum { - SILCPURPLE_WB_BRUSH_SMALL = 2, - SILCPURPLE_WB_BRUSH_MEDIUM = 5, - SILCPURPLE_WB_BRUSH_LARGE = 10, -} SilcPurpleWbBrushSize; - -/* Brush color (XXX Purple should provide default colors) */ -typedef enum { - SILCPURPLE_WB_COLOR_BLACK = 0, - SILCPURPLE_WB_COLOR_RED = 13369344, - SILCPURPLE_WB_COLOR_GREEN = 52224, - SILCPURPLE_WB_COLOR_BLUE = 204, - SILCPURPLE_WB_COLOR_YELLOW = 15658496, - SILCPURPLE_WB_COLOR_ORANGE = 16737792, - SILCPURPLE_WB_COLOR_CYAN = 52428, - SILCPURPLE_WB_COLOR_VIOLET = 5381277, - SILCPURPLE_WB_COLOR_PURPLE = 13369548, - SILCPURPLE_WB_COLOR_TAN = 12093547, - SILCPURPLE_WB_COLOR_BROWN = 5256485, - SILCPURPLE_WB_COLOR_GREY = 11184810, - SILCPURPLE_WB_COLOR_WHITE = 16777215, -} SilcPurpleWbColor; - -typedef struct { - int type; /* 0 = buddy, 1 = channel */ - union { - SilcClientEntry client; - SilcChannelEntry channel; - } u; - int width; - int height; - int brush_size; - int brush_color; -} *SilcPurpleWb; - -/* Initialize whiteboard */ - -PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) -{ - SilcClientConnection conn; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - conn = sg->conn; - wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); - if (!wb) - wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 0; - wbs->u.client = client_entry; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) -{ - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) - wb = purple_whiteboard_create(sg->account, channel->channel_name, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 1; - wbs->u.channel = channel; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, - unsigned char *message, SilcUInt32 message_len) -{ - SilcUInt8 command; - SilcUInt16 width, height, brush_size; - SilcUInt32 brush_color, x, y, dx, dy; - SilcBufferStruct buf; - int ret; - - /* Parse the packet */ - silc_buffer_set(&buf, message, message_len); - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_CHAR(&command), - SILC_STR_UI_SHORT(&width), - SILC_STR_UI_SHORT(&height), - SILC_STR_UI_INT(&brush_color), - SILC_STR_UI_SHORT(&brush_size), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, ret); - - /* Update whiteboard if its dimensions changed */ - if (width != wbs->width || height != wbs->height) - silcpurple_wb_set_dimensions(wb, height, width); - - if (command == SILCPURPLE_WB_DRAW) { - /* Parse data and draw it */ - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - x = dx; - y = dy; - while (silc_buffer_len(&buf) > 0) { - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - - purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy, - brush_color, brush_size); - x += dx; - y += dy; - } - } - - if (command == SILCPURPLE_WB_CLEAR) - purple_whiteboard_clear(wb); -} - -typedef struct { - unsigned char *message; - SilcUInt32 message_len; - SilcPurple sg; - SilcClientEntry sender; - SilcChannelEntry channel; -} *SilcPurpleWbRequest; - -static void -silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) -{ - PurpleWhiteboard *wb; - - if (id != 1) - goto out; - - if (!req->channel) - wb = silcpurple_wb_init(req->sg, req->sender); - else - wb = silcpurple_wb_init_ch(req->sg, req->channel); - - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); - - out: - silc_free(req->message); - silc_free(req); -} - -static void -silcpurple_wb_request(SilcClient client, const unsigned char *message, - SilcUInt32 message_len, SilcClientEntry sender, - SilcChannelEntry channel) -{ - char tmp[256]; - SilcPurpleWbRequest req; - PurpleConnection *gc; - SilcPurple sg; - - gc = client->application; - sg = gc->proto_data; - - /* Open whiteboard automatically if requested */ - if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { - PurpleWhiteboard *wb; - - if (!channel) - wb = silcpurple_wb_init(sg, sender); - else - wb = silcpurple_wb_init_ch(sg, channel); - - silcpurple_wb_parse(wb->proto_data, wb, - (unsigned char *)message, - message_len); - return; - } - - /* Close any previous unaccepted requests */ - purple_request_close_with_handle(sender); - - if (!channel) { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard. Would you like " - "to open the whiteboard?"), sender->nickname); - } else { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard on %s channel. " - "Would you like to open the whiteboard?"), - sender->nickname, channel->channel_name); - } - - req = silc_calloc(1, sizeof(*req)); - if (!req) - return; - req->message = silc_memdup(message, message_len); - req->message_len = message_len; - req->sender = sender; - req->channel = channel; - req->sg = sg; - - purple_request_action(gc, _("Whiteboard"), tmp, NULL, 1, - sg->account, sender->nickname, NULL, req, 2, - _("Yes"), G_CALLBACK(silcpurple_wb_request_cb), - _("No"), G_CALLBACK(silcpurple_wb_request_cb)); -} - -/* Process incoming whiteboard message */ - -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, sender->nickname); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, NULL); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Process incoming whiteboard message on channel */ - -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, channel); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Send whiteboard message */ - -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - GList *list; - int len; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - for (list = draw_list; list; list = list->next) - len += 4; - - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_DRAW), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - silc_buffer_pull(packet, SILCPURPLE_WB_HEADER); - for (list = draw_list; list; list = list->next) { - silc_buffer_format(packet, - SILC_STR_UI_INT(GPOINTER_TO_INT(list->data)), - SILC_STR_END); - silc_buffer_pull(packet, 4); - } - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } else if (wbs->type == 1) { - /* Channel message. Channel private keys are not supported. */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } - - silc_buffer_free(packet); -} - -/* Purple Whiteboard operations */ - -void silcpurple_wb_start(PurpleWhiteboard *wb) -{ - /* Nothing here. Everything is in initialization */ -} - -void silcpurple_wb_end(PurpleWhiteboard *wb) -{ - silc_free(wb->proto_data); - wb->proto_data = NULL; -} - -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - SilcPurpleWb wbs = wb->proto_data; - *width = wbs->width; - *height = wbs->height; -} - -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : - width; - wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : - height; - - /* Update whiteboard */ - purple_whiteboard_set_dimensions(wb, wbs->width, wbs->height); -} - -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - SilcPurpleWb wbs = wb->proto_data; - *size = wbs->brush_size; - *color = wbs->brush_color; -} - -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->brush_size = size; - wbs->brush_color = color; - - /* Update whiteboard */ - purple_whiteboard_set_brush(wb, size, color); -} - -void silcpurple_wb_clear(PurpleWhiteboard *wb) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - int len; - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_CLEAR), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } else if (wbs->type == 1) { - /* Channel message */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, NULL, - packet->head, len); - } - - silc_buffer_free(packet); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc/wb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_WB_H -#define SILCPURPLE_WB_H - -#include "silcpurple.h" -#include "whiteboard.h" - -PurpleWhiteboard * -silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry); -PurpleWhiteboard * -silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel); -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_start(PurpleWhiteboard *wb); -void silcpurple_wb_end(PurpleWhiteboard *wb); -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height); -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color); -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list); -void silcpurple_wb_clear(PurpleWhiteboard *wb); - -#endif /* SILCPURPLE_WB_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/buddy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/buddy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/buddy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/buddy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1748 +0,0 @@ -/* - - silcpurple_buddy.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Key Agreement *********************************/ - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data); - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local); - -typedef struct { - char *nick; - PurpleConnection *gc; -} *SilcPurpleResolve; - -static void -silcpurple_buddy_keyagr_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleResolve r = context; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), r->nick); - purple_notify_error(gc, _("Key Agreement"), - _("Cannot perform the key agreement"), tmp); - silc_free(r->nick); - silc_free(r); - return; - } - - silcpurple_buddy_keyagr_do(gc, r->nick, FALSE); - silc_free(r->nick); - silc_free(r); -} - -typedef struct { - gboolean responder; -} *SilcPurpleKeyAgr; - -static void -silcpurple_buddy_keyagr_cb(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - SilcKeyAgreementStatus status, - SilcSKEKeyMaterial *key, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleKeyAgr a = context; - - if (!sg->conn) - return; - - switch (status) { - case SILC_KEY_AGREEMENT_OK: - { - PurpleConversation *convo; - char tmp[128]; - - /* Set the private key for this client */ - silc_client_del_private_message_key(client, conn, client_entry); - silc_client_add_private_message_key_ske(client, conn, client_entry, - NULL, NULL, key, a->responder); - silc_ske_free_key_material(key); - - - /* Open IM window */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - client_entry->nickname, sg->account); - if (convo) { - /* we don't have windows in the core anymore...but we may want to - * provide some method for asking the UI to show the window - purple_conv_window_show(purple_conversation_get_window(convo)); - */ - } else { - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, sg->account, - client_entry->nickname); - } - g_snprintf(tmp, sizeof(tmp), "%s [private key]", client_entry->nickname); - purple_conversation_set_title(convo, tmp); - } - break; - - case SILC_KEY_AGREEMENT_ERROR: - purple_notify_error(gc, _("Key Agreement"), - _("Error occurred during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_FAILURE: - purple_notify_error(gc, _("Key Agreement"), _("Key Agreement failed"), NULL); - break; - - case SILC_KEY_AGREEMENT_TIMEOUT: - purple_notify_error(gc, _("Key Agreement"), - _("Timeout during key agreement"), NULL); - break; - - case SILC_KEY_AGREEMENT_ABORTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement was aborted"), NULL); - break; - - case SILC_KEY_AGREEMENT_ALREADY_STARTED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement is already started"), NULL); - break; - - case SILC_KEY_AGREEMENT_SELF_DENIED: - purple_notify_error(gc, _("Key Agreement"), - _("Key agreement cannot be started with yourself"), - NULL); - break; - - default: - break; - } - - silc_free(a); -} - -static void -silcpurple_buddy_keyagr_do(PurpleConnection *gc, const char *name, - gboolean force_local) -{ - SilcPurple sg = gc->proto_data; - SilcClientEntry *clients; - SilcUInt32 clients_count; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - char *nickname; - SilcPurpleKeyAgr a; - - if (!sg->conn || !name) - return; - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, nickname, name, - &clients_count); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleResolve r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->nick = g_strdup(name); - r->gc = gc; - silc_client_get_clients(sg->client, sg->conn, nickname, NULL, - silcpurple_buddy_keyagr_resolved, r); - silc_free(nickname); - return; - } - - /* Resolve the local IP from the outgoing socket connection. We resolve - it to check whether we have a private range IP address or public IP - address. If we have public then we will assume that we are not behind - NAT and will provide automatically the point of connection to the - agreement. If we have private range address we assume that we are - behind NAT and we let the responder provide the point of connection. - - The algorithm also checks the remote IP address of server connection. - If it is private range address and we have private range address we - assume that we are chatting in LAN and will provide the point of - connection. - - Naturally this algorithm does not always get things right. */ - - if (silc_net_check_local_by_sock(sg->conn->sock->sock, NULL, &local_ip)) { - /* Check if the IP is private */ - if (!force_local && silcpurple_ip_is_private(local_ip)) { - local = FALSE; - - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(sg->conn->sock->sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide - the connection point. */ - local = TRUE; - } - } - - if (force_local) - local = TRUE; - - if (local && !local_ip) - local_ip = silc_net_localip(); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->responder = local; - - /* Send the key agreement request */ - silc_client_send_key_agreement(sg->client, sg->conn, clients[0], - local ? local_ip : NULL, NULL, 0, 60, - silcpurple_buddy_keyagr_cb, a); - - silc_free(local_ip); - silc_free(remote_ip); - silc_free(clients); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - char *hostname; - SilcUInt16 port; -} *SilcPurpleKeyAgrAsk; - -static void -silcpurple_buddy_keyagr_request_cb(SilcPurpleKeyAgrAsk a, gint id) -{ - SilcPurpleKeyAgr ai; - SilcClientEntry client_entry; - - if (id != 1) - goto out; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(a->client, a->conn, - &a->client_id); - if (!client_entry) { - purple_notify_error(a->client->application, _("Key Agreement"), - _("The remote user is not present in the network any more"), - NULL); - goto out; - } - - /* If the hostname was provided by the requestor perform the key agreement - now. Otherwise, we will send him a request to connect to us. */ - if (a->hostname) { - ai = silc_calloc(1, sizeof(*ai)); - if (!ai) - goto out; - ai->responder = FALSE; - silc_client_perform_key_agreement(a->client, a->conn, client_entry, - a->hostname, a->port, - silcpurple_buddy_keyagr_cb, ai); - } else { - /* Send request. Force us as the point of connection since requestor - did not provide the point of connection. */ - silcpurple_buddy_keyagr_do(a->client->application, - client_entry->nickname, TRUE); - } - - out: - silc_free(a->hostname); - silc_free(a); -} - -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port) -{ - char tmp[128], tmp2[128]; - SilcPurpleKeyAgrAsk a; - PurpleConnection *gc = client->application; - - g_snprintf(tmp, sizeof(tmp), - _("Key agreement request received from %s. Would you like to " - "perform the key agreement?"), client_entry->nickname); - if (hostname) - g_snprintf(tmp2, sizeof(tmp2), - _("The remote user is waiting key agreement on:\n" - "Remote host: %s\nRemote port: %d"), hostname, port); - - a = silc_calloc(1, sizeof(*a)); - if (!a) - return; - a->client = client; - a->conn = conn; - a->client_id = *client_entry->id; - if (hostname) - a->hostname = strdup(hostname); - a->port = port; - - purple_request_action(client->application, _("Key Agreement Request"), tmp, - hostname ? tmp2 : NULL, 1, gc->account, client_entry->nickname, - NULL, a, 2, _("Yes"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb), - _("No"), G_CALLBACK(silcpurple_buddy_keyagr_request_cb)); -} - -static void -silcpurple_buddy_keyagr(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - - buddy = (PurpleBuddy *)node; - silcpurple_buddy_keyagr_do(buddy->account->gc, buddy->name, FALSE); -} - - -/**************************** Static IM Key **********************************/ - -static void -silcpurple_buddy_resetkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - char *nickname; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - if (!silc_parse_userfqdn(b->name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, b->name, - &clients_count); - if (!clients) { - silc_free(nickname); - return; - } - - clients[0]->prv_resp = FALSE; - silc_client_del_private_message_key(sg->client, sg->conn, - clients[0]); - silc_free(clients); - silc_free(nickname); -} - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurplePrivkey; - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_privkey_cb(SilcPurplePrivkey p, const char *passphrase) -{ - SilcClientEntry client_entry; - - if (!passphrase || !(*passphrase)) { - silc_free(p); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(p->client, p->conn, - &p->client_id); - if (!client_entry) { - purple_notify_error(p->client->application, _("IM With Password"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(p); - return; - } - - /* Set the private message key */ - silc_client_del_private_message_key(p->client, p->conn, - client_entry); - silc_client_add_private_message_key(p->client, p->conn, - client_entry, NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), FALSE, - client_entry->prv_resp); - if (!client_entry->prv_resp) - silc_client_send_private_message_key_request(p->client, - p->conn, - client_entry); - silc_free(p); -} - -static void -silcpurple_buddy_privkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("IM With Password"), - _("Cannot set IM key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_privkey(client->application, context); - silc_free(context); -} - -static void -silcpurple_buddy_privkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - char *nickname; - SilcPurplePrivkey p; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - if (!name) - return; - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(sg->client, sg->conn, - nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(sg->client, sg->conn, nickname, NULL, - silcpurple_buddy_privkey_resolved, - g_strdup(name)); - silc_free(nickname); - return; - } - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->client = sg->client; - p->conn = sg->conn; - p->client_id = *clients[0]->id; - purple_request_input(gc, _("IM With Password"), NULL, - _("Set IM Password"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silcpurple_buddy_privkey_cb), - _("Cancel"), G_CALLBACK(silcpurple_buddy_privkey_cb), - gc->account, NULL, NULL, p); - - silc_free(clients); - silc_free(nickname); -} - -static void -silcpurple_buddy_privkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - silcpurple_buddy_privkey(gc, buddy->name); -} - - -/**************************** Get Public Key *********************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; -} *SilcPurpleBuddyGetkey; - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name); - -static void -silcpurple_buddy_getkey_cb(SilcPurpleBuddyGetkey g, - SilcClientCommandReplyContext cmd) -{ - SilcClientEntry client_entry; - unsigned char *pk; - SilcUInt32 pk_len; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(g->client, g->conn, - &g->client_id); - if (!client_entry) { - purple_notify_error(g->client->application, _("Get Public Key"), - _("The remote user is not present in the network any more"), - NULL); - silc_free(g); - return; - } - - if (!client_entry->public_key) { - silc_free(g); - return; - } - - /* Now verify the public key */ - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - silcpurple_verify_public_key(g->client, g->conn, client_entry->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - NULL, NULL); - silc_free(pk); - silc_free(g); -} - -static void -silcpurple_buddy_getkey_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(client->application, _("Get Public Key"), - _("Cannot fetch the public key"), tmp); - g_free(context); - return; - } - - silcpurple_buddy_getkey(client->application, context); - silc_free(context); -} - -static void -silcpurple_buddy_getkey(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count; - SilcPurpleBuddyGetkey g; - char *nickname; - - if (!name) - return; - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_buddy_getkey_resolved, - g_strdup(name)); - silc_free(nickname); - return; - } - - /* Call GETKEY */ - g = silc_calloc(1, sizeof(*g)); - if (!g) - return; - g->client = client; - g->conn = conn; - g->client_id = *clients[0]->id; - silc_client_command_call(client, conn, NULL, "GETKEY", - clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_buddy_getkey_cb, g); - silc_free(clients); - silc_free(nickname); -} - -static void -silcpurple_buddy_getkey_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(buddy->account); - - silcpurple_buddy_getkey(gc, buddy->name); -} - -static void -silcpurple_buddy_showkey(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - SilcPublicKey public_key; - const char *pkfile; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - pkfile = purple_blist_node_get_string(node, "public-key"); - if (!silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(pkfile, &public_key, SILC_PKCS_FILE_BIN)) { - purple_notify_error(gc, - _("Show Public Key"), - _("Could not load public key"), NULL); - return; - } - - silcpurple_show_public_key(sg, b->name, public_key, NULL, NULL); - silc_pkcs_public_key_free(public_key); -} - - -/**************************** Buddy routines *********************************/ - -/* The buddies are implemented by using the WHOIS and WATCH commands that - can be used to search users by their public key. Since nicknames aren't - unique in SILC we cannot trust the buddy list using their nickname. We - associate public keys to buddies and use those to search and watch - in the network. - - The problem is that Purple does not return PurpleBuddy contexts to the - callbacks but the buddy names. Naturally, this is not going to work - with SILC. But, for now, we have to do what we can... */ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - SilcClientID client_id; - PurpleBuddy *b; - unsigned char *offline_pk; - SilcUInt32 offline_pk_len; - unsigned int offline : 1; - unsigned int pubkey_search : 1; - unsigned int init : 1; -} *SilcPurpleBuddyRes; - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id); -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context); - -void silcpurple_get_info(PurpleConnection *gc, const char *who) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry client_entry; - PurpleBuddy *b; - const char *filename, *nick = who; - char tmp[256]; - - if (!who) - return; - if (strlen(who) > 1 && who[0] == '@') - nick = who + 1; - if (strlen(who) > 1 && who[0] == '*') - nick = who + 1; - if (strlen(who) > 2 && who[0] == '*' && who[1] == '@') - nick = who + 2; - - b = purple_find_buddy(gc->account, nick); - if (b) { - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - "-details", "-pubkey", filename, NULL); - return; - } - - if (!b->proto_data) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), b->name); - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), tmp); - return; - } - - client_entry = silc_client_get_client_by_id(client, conn, b->proto_data); - if (client_entry) { - /* Call WHOIS. The user info is displayed in the WHOIS - command reply. */ - silc_client_command_call(client, conn, NULL, "WHOIS", - client_entry->nickname, "-details", NULL); - } - } else { - /* Call WHOIS just with nickname. */ - silc_client_command_call(client, conn, NULL, "WHOIS", nick, NULL); - } -} - -static void -silcpurple_add_buddy_pk_no(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not trusted"), - r->b->name); - purple_notify_error(r->client->application, _("Add Buddy"), tmp, - _("You cannot receive buddy notifications until you " - "import his/her public key. You can use the Get Public Key " - "command to get the public key.")); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); -} - -static void -silcpurple_add_buddy_save(bool success, void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcClient client = r->client; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttribute attribute; - SilcVCardStruct vcard; - SilcAttributeObjMime message, extension; -#ifdef SILC_ATTRIBUTE_USER_ICON - SilcAttributeObjMime usericon; -#endif - SilcAttributeObjPk serverpk, usersign, serversign; - gboolean usign_success = TRUE, ssign_success = TRUE; - char filename[512], filename2[512], *fingerprint = NULL, *tmp; - SilcUInt32 len; - int i; - - if (!success) { - /* The user did not trust the public key. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - if (r->offline) { - /* User is offline. Associate the imported public key with - this user. */ - fingerprint = silc_hash_fingerprint(NULL, r->offline_pk, - r->offline_pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - silc_free(fingerprint); - silc_free(r->offline_pk); - silc_free(r); - return; - } - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry) { - silc_free(r); - return; - } - - memset(&vcard, 0, sizeof(vcard)); - memset(&message, 0, sizeof(message)); - memset(&extension, 0, sizeof(extension)); -#ifdef SILC_ATTRIBUTE_USER_ICON - memset(&usericon, 0, sizeof(usericon)); -#endif - memset(&serverpk, 0, sizeof(serverpk)); - memset(&usersign, 0, sizeof(usersign)); - memset(&serversign, 0, sizeof(serversign)); - - /* Now that we have the public key and we trust it now we - save the attributes of the buddy and update its status. */ - - if (client_entry->attrs) { - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) - != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - - switch (attribute) { - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - break; - - case SILC_ATTRIBUTE_STATUS_MESSAGE: - if (!silc_attribute_get_object(attr, (void *)&message, - sizeof(message))) - continue; - break; - - case SILC_ATTRIBUTE_EXTENSION: - if (!silc_attribute_get_object(attr, (void *)&extension, - sizeof(extension))) - continue; - break; - -#ifdef SILC_ATTRIBUTE_USER_ICON - case SILC_ATTRIBUTE_USER_ICON: - if (!silc_attribute_get_object(attr, (void *)&usericon, - sizeof(usericon))) - continue; - break; -#endif - - case SILC_ATTRIBUTE_SERVER_PUBLIC_KEY: - if (serverpk.type) - continue; - if (!silc_attribute_get_object(attr, (void *)&serverpk, - sizeof(serverpk))) - continue; - break; - - case SILC_ATTRIBUTE_USER_DIGITAL_SIGNATURE: - if (usersign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&usersign, - sizeof(usersign))) - continue; - break; - - case SILC_ATTRIBUTE_SERVER_DIGITAL_SIGNATURE: - if (serversign.data) - continue; - if (!silc_attribute_get_object(attr, (void *)&serversign, - sizeof(serversign))) - continue; - break; - - default: - break; - } - } - } - - /* Verify the attribute signatures */ - - if (usersign.data) { - SilcPKCS pkcs; - unsigned char *verifyd; - SilcUInt32 verify_len; - - silc_pkcs_alloc((unsigned char*)"rsa", &pkcs); - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - FALSE, &verify_len); - if (verifyd && silc_pkcs_public_key_set(pkcs, client_entry->public_key)){ - if (!silc_pkcs_verify_with_hash(pkcs, client->sha1hash, - usersign.data, - usersign.data_len, - verifyd, verify_len)) - usign_success = FALSE; - } - silc_free(verifyd); - } - - if (serversign.data && !strcmp(serverpk.type, "silc-rsa")) { - SilcPublicKey public_key; - SilcPKCS pkcs; - unsigned char *verifyd; - SilcUInt32 verify_len; - - if (silc_pkcs_public_key_decode(serverpk.data, serverpk.data_len, - &public_key)) { - silc_pkcs_alloc((unsigned char *)"rsa", &pkcs); - verifyd = silc_attribute_get_verify_data(client_entry->attrs, - TRUE, &verify_len); - if (verifyd && silc_pkcs_public_key_set(pkcs, public_key)) { - if (!silc_pkcs_verify_with_hash(pkcs, client->sha1hash, - serversign.data, - serversign.data_len, - verifyd, verify_len)) - ssign_success = FALSE; - } - silc_pkcs_public_key_free(public_key); - silc_free(verifyd); - } - } - - fingerprint = silc_fingerprint(client_entry->fingerprint, - client_entry->fingerprint_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - if (usign_success || ssign_success) { - struct passwd *pw; - struct stat st; - - memset(filename2, 0, sizeof(filename2)); - - /* Filename for dir */ - tmp = fingerprint + strlen(fingerprint) - 9; - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "friends" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), tmp); - - pw = getpwuid(getuid()); - if (!pw) - return; - - /* Create dir if it doesn't exist */ - if ((g_stat(filename, &st)) == -1) { - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - int ret = g_mkdir(filename, 0755); - if (ret < 0) - return; - } - } - } - - /* Save VCard */ - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "vcard", filename); - if (vcard.full_name) { - tmp = (char *)silc_vcard_encode(&vcard, &len); - silc_file_writefile(filename2, tmp, len); - silc_free(tmp); - } - - /* Save status message */ - if (message.mime) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "status_message.mime", - filename); - silc_file_writefile(filename2, (char *)message.mime, - message.mime_len); - } - - /* Save extension data */ - if (extension.mime) { - memset(filename2, 0, sizeof(filename2)); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "extension.mime", - filename); - silc_file_writefile(filename2, (char *)extension.mime, - extension.mime_len); - } - -#ifdef SILC_ATTRIBUTE_USER_ICON - /* Save user icon */ - if (usericon.mime) { - SilcMime m = silc_mime_decode(usericon.mime, - usericon.mime_len); - if (m) { - const char *type = silc_mime_get_field(m, "Content-Type"); - if (!strcmp(type, "image/jpeg") || - !strcmp(type, "image/gif") || - !strcmp(type, "image/bmp") || - !strcmp(type, "image/png")) { - const unsigned char *data; - SilcUInt32 data_len; - data = silc_mime_get_data(m, &data_len); - if (data) { - /* TODO: Check if SILC gives us something to use as the checksum instead */ - purple_buddy_icons_set_for_user(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), g_memdup(data, data_len), data_len, NULL); - } - } - silc_mime_free(m); - } - } -#endif - } - - /* Save the public key path to buddy properties, as it is used - to identify the buddy in the network (and not the nickname). */ - memset(filename, 0, sizeof(filename)); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - purple_blist_node_set_string((PurpleBlistNode *)b, "public-key", filename); - - /* Update online status */ - purple_prpl_got_user_status(purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - - /* Finally, start watching this user so we receive its status - changes from the server */ - g_snprintf(filename2, sizeof(filename2) - 1, "+%s", filename); - silc_client_command_call(r->client, r->conn, NULL, "WATCH", "-pubkey", - filename2, NULL); - - silc_free(fingerprint); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_import(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - SilcPublicKey public_key; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_BIN)) { - silcpurple_add_buddy_ask_pk_cb(r, 0); - purple_notify_error(r->client->application, - _("Add Buddy"), _("Could not load public key"), NULL); - return; - } - - /* Now verify the public key */ - r->offline_pk = silc_pkcs_public_key_encode(public_key, &r->offline_pk_len); - silcpurple_verify_public_key(r->client, r->conn, r->b->name, - SILC_SOCKET_TYPE_CLIENT, - r->offline_pk, r->offline_pk_len, - SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); -} - -static void -silcpurple_add_buddy_ask_pk_cancel(void *user_data, const char *name) -{ - SilcPurpleBuddyRes r = (SilcPurpleBuddyRes)user_data; - - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_ask_pk_cb(SilcPurpleBuddyRes r, gint id) -{ - if (id != 0) { - /* The user did not import public key. The buddy is unusable. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - /* Open file selector to select the public key. */ - purple_request_file(r->client->application, _("Open..."), NULL, FALSE, - G_CALLBACK(silcpurple_add_buddy_ask_import), - G_CALLBACK(silcpurple_add_buddy_ask_pk_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); - -} - -static void -silcpurple_add_buddy_ask_pk(SilcPurpleBuddyRes r) -{ - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"), - r->b->name); - purple_request_action(r->client->application, _("Add Buddy"), tmp, - _("To add the buddy you must import his/her public key. " - "Press Import to import a public key."), 0, - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r, 2, - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb), - _("_Import..."), G_CALLBACK(silcpurple_add_buddy_ask_pk_cb)); -} - -static void -silcpurple_add_buddy_getkey_cb(SilcPurpleBuddyRes r, - SilcClientCommandReplyContext cmd) -{ - SilcClientEntry client_entry; - unsigned char *pk; - SilcUInt32 pk_len; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(r->client, r->conn, - &r->client_id); - if (!client_entry || !client_entry->public_key) { - /* The buddy is offline/nonexistent. We will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - r->offline = TRUE; - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* Now verify the public key */ - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - silcpurple_verify_public_key(r->client, r->conn, client_entry->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); - silc_free(pk); -} - -static void -silcpurple_add_buddy_select_cb(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - PurpleRequestField *f; - GList *list; - SilcClientEntry client_entry; - - f = purple_request_fields_get_field(fields, "list"); - list = purple_request_field_list_get_selected(f); - if (!list) { - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); - return; - } - - client_entry = purple_request_field_list_get_data(f, list->data); - silcpurple_add_buddy_resolved(r->client, r->conn, &client_entry, 1, r); -} - -static void -silcpurple_add_buddy_select_cancel(SilcPurpleBuddyRes r, PurpleRequestFields *fields) -{ - /* The user did not select any user. */ - silcpurple_add_buddy_pk_no(r); - silc_free(r); -} - -static void -silcpurple_add_buddy_select(SilcPurpleBuddyRes r, - SilcClientEntry *clients, - SilcUInt32 clients_count) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512], tmp2[128]; - int i; - char *fingerprint; - - fields = purple_request_fields_new(); - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields_add_group(fields, g); - - for (i = 0; i < clients_count; i++) { - fingerprint = NULL; - if (clients[i]->fingerprint) { - fingerprint = silc_fingerprint(clients[i]->fingerprint, - clients[i]->fingerprint_len); - g_snprintf(tmp2, sizeof(tmp2), "\n%s", fingerprint); - } - g_snprintf(tmp, sizeof(tmp), "%s - %s (%s@%s)%s", - clients[i]->realname, clients[i]->nickname, - clients[i]->username, clients[i]->hostname ? - clients[i]->hostname : "", - fingerprint ? tmp2 : ""); - purple_request_field_list_add(f, tmp, clients[i]); - silc_free(fingerprint); - } - - purple_request_fields(r->client->application, _("Add Buddy"), - _("Select correct user"), - r->pubkey_search - ? _("More than one user was found with the same public key. Select " - "the correct user from the list to add to the buddy list.") - : _("More than one user was found with the same name. Select " - "the correct user from the list to add to the buddy list."), - fields, - _("OK"), G_CALLBACK(silcpurple_add_buddy_select_cb), - _("Cancel"), G_CALLBACK(silcpurple_add_buddy_select_cancel), - purple_buddy_get_account(r->b), purple_buddy_get_name(r->b), NULL, r); -} - -static void -silcpurple_add_buddy_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - SilcPurpleBuddyRes r = context; - PurpleBuddy *b = r->b; - SilcAttributePayload pub; - SilcAttributeObjPk userpk; - unsigned char *pk; - SilcUInt32 pk_len; - const char *filename; - - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - - /* If the buddy is offline/nonexistent, we will require user - to associate a public key with the buddy or the buddy - cannot be added. */ - if (!clients_count) { - if (r->init) { - silc_free(r); - return; - } - - r->offline = TRUE; - /* If the user has already associated a public key, try loading it - * before prompting the user to load it again */ - if (filename != NULL) - silcpurple_add_buddy_ask_import(r, filename); - else - silcpurple_add_buddy_ask_pk(r); - return; - } - - /* If more than one client was found with nickname, we need to verify - from user which one is the correct. */ - if (clients_count > 1 && !r->pubkey_search) { - if (r->init) { - silc_free(r); - return; - } - - silcpurple_add_buddy_select(r, clients, clients_count); - return; - } - - /* If we searched using public keys and more than one entry was found - the same person is logged on multiple times. */ - if (clients_count > 1 && r->pubkey_search && b->name) { - if (r->init) { - /* Find the entry that closest matches to the - buddy nickname. */ - int i; - for (i = 0; i < clients_count; i++) { - if (!g_ascii_strncasecmp(b->name, clients[i]->nickname, - strlen(b->name))) { - clients[0] = clients[i]; - break; - } - } - } else { - /* Verify from user which one is correct */ - silcpurple_add_buddy_select(r, clients, clients_count); - return; - } - } - - /* The client was found. Now get its public key and verify - that before adding the buddy. */ - memset(&userpk, 0, sizeof(userpk)); - b->proto_data = silc_memdup(clients[0]->id, sizeof(*clients[0]->id)); - r->client_id = *clients[0]->id; - - /* Get the public key from attributes, if not present then - resolve it with GETKEY unless we have it cached already. */ - if (clients[0]->attrs && !clients[0]->public_key) { - pub = silcpurple_get_attr(clients[0]->attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY); - if (!pub || !silc_attribute_get_object(pub, (void *)&userpk, - sizeof(userpk))) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - if (!silc_pkcs_public_key_decode(userpk.data, userpk.data_len, - &clients[0]->public_key)) - return; - silc_free(userpk.data); - } else if (filename && !clients[0]->public_key) { - if (!silc_pkcs_load_public_key(filename, &clients[0]->public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(filename, &clients[0]->public_key, - SILC_PKCS_FILE_BIN)) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - } else if (!clients[0]->public_key) { - /* Get public key with GETKEY */ - silc_client_command_call(client, conn, NULL, - "GETKEY", clients[0]->nickname, NULL); - silc_client_command_pending(conn, SILC_COMMAND_GETKEY, - conn->cmd_ident, - (SilcCommandCb)silcpurple_add_buddy_getkey_cb, - r); - return; - } - - /* We have the public key, verify it. */ - pk = silc_pkcs_public_key_encode(clients[0]->public_key, &pk_len); - silcpurple_verify_public_key(client, conn, clients[0]->nickname, - SILC_SOCKET_TYPE_CLIENT, - pk, pk_len, SILC_SKE_PK_TYPE_SILC, - silcpurple_add_buddy_save, r); - silc_free(pk); -} - -static void -silcpurple_add_buddy_i(PurpleConnection *gc, PurpleBuddy *b, gboolean init) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPurpleBuddyRes r; - SilcBuffer attrs; - const char *filename, *name = b->name; - - r = silc_calloc(1, sizeof(*r)); - if (!r) - return; - r->client = client; - r->conn = conn; - r->b = b; - r->init = init; - - /* See if we have this buddy's public key. If we do use that - to search the details. */ - filename = purple_blist_node_get_string((PurpleBlistNode *)b, "public-key"); - if (filename) { - SilcPublicKey public_key; - SilcAttributeObjPk userpk; - - if (!silc_pkcs_load_public_key(filename, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(filename, &public_key, - SILC_PKCS_FILE_BIN)) - return; - - /* Get all attributes, and use the public key to search user */ - name = NULL; - attrs = silc_client_attributes_request(SILC_ATTRIBUTE_USER_INFO, - SILC_ATTRIBUTE_SERVICE, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_ATTRIBUTE_STATUS_FREETEXT, - SILC_ATTRIBUTE_STATUS_MESSAGE, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_ATTRIBUTE_TIMEZONE, - SILC_ATTRIBUTE_GEOLOCATION, -#ifdef SILC_ATTRIBUTE_USER_ICON - SILC_ATTRIBUTE_USER_ICON, -#endif - SILC_ATTRIBUTE_DEVICE_INFO, 0); - userpk.type = "silc-rsa"; - userpk.data = silc_pkcs_public_key_encode(public_key, &userpk.data_len); - attrs = silc_attribute_payload_encode(attrs, - SILC_ATTRIBUTE_USER_PUBLIC_KEY, - SILC_ATTRIBUTE_FLAG_VALID, - &userpk, sizeof(userpk)); - silc_free(userpk.data); - silc_pkcs_public_key_free(public_key); - r->pubkey_search = TRUE; - } else { - /* Get all attributes */ - attrs = silc_client_attributes_request(0); - } - - /* Resolve */ - silc_client_get_clients_whois(client, conn, name, NULL, attrs, - silcpurple_add_buddy_resolved, r); - silc_buffer_free(attrs); -} - -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - /* Don't add if the buddy is already on the list. - * - * SILC doesn't have groups, so we don't need to do anything - * for a move. */ - if (purple_buddy_get_protocol_data(buddy) == NULL) - silcpurple_add_buddy_i(gc, buddy, FALSE); -} - -void silcpurple_send_buddylist(PurpleConnection *gc) -{ - PurpleBuddyList *blist; - PurpleBlistNode *gnode, *cnode, *bnode; - PurpleBuddy *buddy; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - if ((blist = purple_get_blist()) != NULL) - { - for (gnode = blist->root; gnode != NULL; gnode = gnode->next) - { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode != NULL; cnode = cnode->next) - { - if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = cnode->child; bnode != NULL; bnode = bnode->next) - { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - buddy = (PurpleBuddy *)bnode; - if (purple_buddy_get_account(buddy) == account) - silcpurple_add_buddy_i(gc, buddy, TRUE); - } - } - } - } -} - -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, - PurpleGroup *group) -{ - silc_free(buddy->proto_data); -} - -void silcpurple_idle_set(PurpleConnection *gc, int idle) - -{ - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - SilcAttributeObjService service; - const char *server; - int port; - - sg = gc->proto_data; - if (sg == NULL) - return; - - client = sg->client; - if (client == NULL) - return; - - conn = sg->conn; - if (conn == NULL) - return; - - server = purple_account_get_string(sg->account, "server", - "silc.silcnet.org"); - port = purple_account_get_int(sg->account, "port", 706), - - memset(&service, 0, sizeof(service)); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - service.port = port; - g_snprintf(service.address, sizeof(service.address), "%s", server); - service.idle = idle; - silc_client_attribute_add(client, conn, SILC_ATTRIBUTE_SERVICE, - &service, sizeof(service)); -} - -char *silcpurple_status_text(PurpleBuddy *b) -{ - SilcPurple sg = b->account->gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = b->proto_data; - SilcClientEntry client_entry; - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return NULL; - - /* If user is online, we show the mood status, if available. - If user is offline or away that status is indicated. */ - - if (client_entry->mode & SILC_UMODE_DETACHED) - return g_strdup(_("Detached")); - if (client_entry->mode & SILC_UMODE_GONE) - return g_strdup(_("Away")); - if (client_entry->mode & SILC_UMODE_INDISPOSED) - return g_strdup(_("Indisposed")); - if (client_entry->mode & SILC_UMODE_BUSY) - return g_strdup(_("Busy")); - if (client_entry->mode & SILC_UMODE_PAGE) - return g_strdup(_("Wake Me Up")); - if (client_entry->mode & SILC_UMODE_HYPER) - return g_strdup(_("Hyper Active")); - if (client_entry->mode & SILC_UMODE_ROBOT) - return g_strdup(_("Robot")); - - attr = silcpurple_get_attr(client_entry->attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - /* The mood is a bit mask, so we could show multiple moods, - but let's show only one for now. */ - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - return g_strdup(_("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - return g_strdup(_("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - return g_strdup(_("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - return g_strdup(_("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - return g_strdup(_("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - return g_strdup(_("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - return g_strdup(_("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - return g_strdup(_("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - return g_strdup(_("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - return g_strdup(_("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - return g_strdup(_("Anxious")); - } - - return NULL; -} - -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - SilcPurple sg = b->account->gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientID *client_id = b->proto_data; - SilcClientEntry client_entry; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - char tmp[256]; - - /* Get the client entry. */ - client_entry = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry) - return; - - if (client_entry->nickname) - purple_notify_user_info_add_pair(user_info, _("Nickname"), - client_entry->nickname); - if (client_entry->username && client_entry->hostname) { - g_snprintf(tmp, sizeof(tmp), "%s@%s", client_entry->username, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - } - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - - if (statusstr) { - purple_notify_user_info_add_pair(user_info, _("Message"), statusstr); - g_free(statusstr); - } - - if (full) { - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - } -} - -static void -silcpurple_buddy_kill(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - b = (PurpleBuddy *) node; - gc = purple_account_get_connection(b->account); - sg = gc->proto_data; - - /* Call KILL */ - silc_client_command_call(sg->client, sg->conn, NULL, "KILL", - b->name, "Killed by operator", NULL); -} - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; -} *SilcPurpleBuddyWb; - -static void -silcpurple_buddy_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleBuddyWb wb = data; - silcpurple_wb_init(wb->sg, wb->client_entry); - silc_free(wb); -} - -GList *silcpurple_buddy_menu(PurpleBuddy *buddy) -{ - PurpleConnection *gc = purple_account_get_connection(buddy->account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *pkfile = NULL; - SilcClientEntry client_entry = NULL; - PurpleMenuAction *act; - GList *m = NULL; - SilcPurpleBuddyWb wb; - - pkfile = purple_blist_node_get_string((PurpleBlistNode *) buddy, "public-key"); - client_entry = silc_client_get_client_by_id(sg->client, - sg->conn, - buddy->proto_data); - - if (client_entry && client_entry->send_key) { - act = purple_menu_action_new(_("Reset IM Key"), - PURPLE_CALLBACK(silcpurple_buddy_resetkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("IM with Key Exchange"), - PURPLE_CALLBACK(silcpurple_buddy_keyagr), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("IM with Password"), - PURPLE_CALLBACK(silcpurple_buddy_privkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (pkfile) { - act = purple_menu_action_new(_("Show Public Key"), - PURPLE_CALLBACK(silcpurple_buddy_showkey), - NULL, NULL); - m = g_list_append(m, act); - - } else { - act = purple_menu_action_new(_("Get Public Key..."), - PURPLE_CALLBACK(silcpurple_buddy_getkey_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - if (conn && conn->local_entry->mode & SILC_UMODE_ROUTER_OPERATOR) { - act = purple_menu_action_new(_("Kill User"), - PURPLE_CALLBACK(silcpurple_buddy_kill), - NULL, NULL); - m = g_list_append(m, act); - } - - if (client_entry) { - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->client_entry = client_entry; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_buddy_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - return m; -} - -#ifdef SILC_ATTRIBUTE_USER_ICON -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcMime mime; - char type[32]; - unsigned char *icon; - const char *t; - SilcAttributeObjMime obj; - - /* Remove */ - if (!img) { - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_ICON, NULL); - return; - } - - /* Add */ - mime = silc_mime_alloc(); - if (!mime) - return; - - t = purple_imgstore_get_extension(img); - if (!t || !strcmp(t, "icon")) { - silc_mime_free(mime); - return; - } - if (!strcmp(t, "jpg")) - t = "jpeg"; - g_snprintf(type, sizeof(type), "image/%s", t); - silc_mime_add_field(mime, "Content-Type", type); - silc_mime_add_data(mime, purple_imgstore_get_data(img), purple_imgstore_get_size(img)); - - obj.mime = icon = silc_mime_encode(mime, &obj.mime_len); - if (obj.mime) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_ICON, &obj, sizeof(obj)); - - silc_free(icon); - silc_mime_free(mime); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/chat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/chat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/chat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/chat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1456 +0,0 @@ -/* - - silcpurple_chat.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/***************************** Channel Routines ******************************/ - -GList *silcpurple_chat_info(PurpleConnection *gc) -{ - GList *ci = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Channel:"); - pce->identifier = "channel"; - pce->required = TRUE; - ci = g_list_append(ci, pce); - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Passphrase:"); - pce->identifier = "passphrase"; - pce->secret = TRUE; - ci = g_list_append(ci, pce); - - return ci; -} - -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "channel", g_strdup(chat_name)); - - return defaults; -} - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components); - -static void -silcpurple_chat_getinfo_res(SilcClient client, - SilcClientConnection conn, - SilcChannelEntry *channels, - SilcUInt32 channels_count, - void *context) -{ - GHashTable *components = context; - PurpleConnection *gc = client->application; - const char *chname; - char tmp[256]; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - - if (!channels) { - g_snprintf(tmp, sizeof(tmp), - _("Channel %s does not exist in the network"), chname); - purple_notify_error(gc, _("Channel Information"), - _("Cannot get channel information"), tmp); - return; - } - - silcpurple_chat_getinfo(gc, components); -} - - -static void -silcpurple_chat_getinfo(PurpleConnection *gc, GHashTable *components) -{ - SilcPurple sg = gc->proto_data; - const char *chname; - char *buf, tmp[256], *tmp2; - GString *s; - SilcChannelEntry channel; - SilcHashTableList htl; - SilcChannelUser chu; - - if (!components) - return; - - chname = g_hash_table_lookup(components, "channel"); - if (!chname) - return; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - silc_client_get_channel_resolve(sg->client, sg->conn, - (char *)chname, - silcpurple_chat_getinfo_res, - components); - return; - } - - s = g_string_new(""); - tmp2 = g_markup_escape_text(channel->channel_name, -1); - g_string_append_printf(s, _("Channel Name: %s"), tmp2); - g_free(tmp2); - if (channel->user_list && silc_hash_table_count(channel->user_list)) - g_string_append_printf(s, _("
User Count: %d"), - (int)silc_hash_table_count(channel->user_list)); - - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - tmp2 = g_markup_escape_text(chu->client->nickname, -1); - g_string_append_printf(s, _("
Channel Founder: %s"), - tmp2); - g_free(tmp2); - break; - } - } - silc_hash_table_list_reset(&htl); - - if (channel->channel_key) - g_string_append_printf(s, _("
Channel Cipher: %s"), - silc_cipher_get_name(channel->channel_key)); - if (channel->hmac) - /* Definition of HMAC: http://en.wikipedia.org/wiki/HMAC */ - g_string_append_printf(s, _("
Channel HMAC: %s"), - silc_hmac_get_name(channel->hmac)); - - if (channel->topic) { - tmp2 = g_markup_escape_text(channel->topic, -1); - g_string_append_printf(s, _("
Channel Topic:
%s"), tmp2); - g_free(tmp2); - } - - if (channel->mode) { - g_string_append_printf(s, _("
Channel Modes: ")); - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - g_string_append(s, tmp); - } - - if (channel->founder_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(channel->founder_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - g_string_append_printf(s, _("
Founder Key Fingerprint:
%s"), fingerprint); - g_string_append_printf(s, _("
Founder Key Babbleprint:
%s"), babbleprint); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - - buf = g_string_free(s, FALSE); - purple_notify_formatted(gc, NULL, _("Channel Information"), NULL, buf, NULL, NULL); - g_free(buf); -} - - -static void -silcpurple_chat_getinfo_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat = (PurpleChat *)node; - silcpurple_chat_getinfo(chat->account->gc, chat->components); -} - - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ -/************************** Channel Invite List ******************************/ - -static void -silcpurple_chat_invitelist(PurpleBlistNode *node, gpointer data); -{ - -} - - -/**************************** Channel Ban List *******************************/ - -static void -silcpurple_chat_banlist(PurpleBlistNode *node, gpointer data); -{ - -} -#endif - - -/************************* Channel Authentication ****************************/ - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; - PurpleChat *c; - SilcBuffer pubkeys; -} *SilcPurpleChauth; - -static void -silcpurple_chat_chpk_add(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - unsigned char mode[4]; - SilcUInt32 m; - - /* Load the public key */ - if (!silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(name, &public_key, SILC_PKCS_FILE_BIN)) { - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); - purple_notify_error(client->application, - _("Add Channel Public Key"), - _("Could not load public key"), NULL); - return; - } - - pk = silc_pkcs_public_key_payload_encode(public_key); - chpks = silc_buffer_alloc_size(2); - SILC_PUT16_MSB(1, chpks->head); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - pk->len, 0x00); - silc_buffer_free(pk); - - m = sgc->channel->mode; - m |= SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - ++conn->cmd_ident, 3, - 1, chidp->data, chidp->len, - 2, mode, sizeof(mode), - 9, chpks->data, chpks->len); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cancel(void *user_data, const char *name) -{ - SilcPurpleChauth sgc = (SilcPurpleChauth)user_data; - silcpurple_chat_chauth_show(sgc->sg, sgc->channel, sgc->pubkeys); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chpk_cb(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - GList *list; - SilcPublicKey public_key; - SilcBuffer chpks, pk, chidp; - SilcUInt16 c = 0, ct; - unsigned char mode[4]; - SilcUInt32 m; - - f = purple_request_fields_get_field(fields, "list"); - if (!purple_request_field_list_get_selected(f)) { - /* Add new public key */ - purple_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE, - G_CALLBACK(silcpurple_chat_chpk_add), - G_CALLBACK(silcpurple_chat_chpk_cancel), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - - list = purple_request_field_list_get_items(f); - chpks = silc_buffer_alloc_size(2); - - for (ct = 0; list; list = list->next, ct++) { - public_key = purple_request_field_list_get_data(f, list->data); - if (purple_request_field_list_is_selected(f, list->data)) { - /* Delete this public key */ - pk = silc_pkcs_public_key_payload_encode(public_key); - chpks = silc_argument_payload_encode_one(chpks, pk->data, - pk->len, 0x01); - silc_buffer_free(pk); - c++; - } - silc_pkcs_public_key_free(public_key); - } - if (!c) { - silc_buffer_free(chpks); - return; - } - SILC_PUT16_MSB(c, chpks->head); - - m = sgc->channel->mode; - if (ct == c) - m &= ~SILC_CHANNEL_MODE_CHANNEL_AUTH; - - /* Send CMODE */ - SILC_PUT32_MSB(m, mode); - chidp = silc_id_payload_encode(sgc->channel->id, SILC_ID_CHANNEL); - silc_client_command_send(client, conn, SILC_COMMAND_CMODE, - ++conn->cmd_ident, 3, - 1, chidp->data, chidp->len, - 2, mode, sizeof(mode), - 9, chpks->data, chpks->len); - silc_buffer_free(chpks); - silc_buffer_free(chidp); - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -static void -silcpurple_chat_chauth_ok(SilcPurpleChauth sgc, PurpleRequestFields *fields) -{ - SilcPurple sg = sgc->sg; - PurpleRequestField *f; - const char *curpass, *val; - int set; - - f = purple_request_fields_get_field(fields, "passphrase"); - val = purple_request_field_string_get_value(f); - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - if (!val && curpass) - set = 0; - else if (val && !curpass) - set = 1; - else if (val && curpass && strcmp(val, curpass)) - set = 1; - else - set = -1; - - if (set == 1) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "+a", val, NULL); - purple_blist_node_set_string((PurpleBlistNode *)sgc->c, "passphrase", val); - } else if (set == 0) { - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - sgc->channel->channel_name, "-a", NULL); - purple_blist_node_remove_setting((PurpleBlistNode *)sgc->c, "passphrase"); - } - - silc_buffer_free(sgc->pubkeys); - silc_free(sgc); -} - -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcBuffer channel_pubkeys) -{ - SilcUInt16 argc; - SilcArgumentPayload chpks; - unsigned char *pk; - SilcUInt32 pk_len, type; - char *fingerprint, *babbleprint; - SilcPublicKey pubkey; - SilcPublicKeyIdentifier ident; - char tmp2[1024], t[512]; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcPurpleChauth sgc; - const char *curpass = NULL; - - sgc = silc_calloc(1, sizeof(*sgc)); - if (!sgc) - return; - sgc->sg = sg; - sgc->channel = channel; - - fields = purple_request_fields_new(); - - if (sgc->c) - curpass = purple_blist_node_get_string((PurpleBlistNode *)sgc->c, "passphrase"); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("passphrase", _("Channel Passphrase"), - curpass, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l1", _("Channel Public Keys List")); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(t, sizeof(t), - _("Channel authentication is used to secure the channel from " - "unauthorized access. The authentication may be based on " - "passphrase and digital signatures. If passphrase is set, it " - "is required to be able to join. If channel public keys are set " - "then only users whose public keys are listed are able to join.")); - - if (!channel_pubkeys) { - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - return; - } - sgc->pubkeys = silc_buffer_copy(channel_pubkeys); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_list_new("list", NULL); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - SILC_GET16_MSB(argc, channel_pubkeys->data); - chpks = silc_argument_payload_parse(channel_pubkeys->data + 2, - channel_pubkeys->len - 2, argc); - if (!chpks) - return; - - pk = silc_argument_get_first_arg(chpks, &type, &pk_len); - while (pk) { - fingerprint = silc_hash_fingerprint(NULL, pk + 4, pk_len - 4); - babbleprint = silc_hash_babbleprint(NULL, pk + 4, pk_len - 4); - silc_pkcs_public_key_payload_decode(pk, pk_len, &pubkey); - ident = silc_pkcs_decode_identifier(pubkey->identifier); - - g_snprintf(tmp2, sizeof(tmp2), "%s\n %s\n %s", - ident->realname ? ident->realname : ident->username ? - ident->username : "", fingerprint, babbleprint); - purple_request_field_list_add(f, tmp2, pubkey); - - silc_free(fingerprint); - silc_free(babbleprint); - silc_pkcs_free_identifier(ident); - pk = silc_argument_get_next_arg(chpks, &type, &pk_len); - } - - purple_request_field_list_set_multi_select(f, FALSE); - purple_request_fields(sg->gc, _("Channel Authentication"), - _("Channel Authentication"), t, fields, - _("Add / Remove"), G_CALLBACK(silcpurple_chat_chpk_cb), - _("OK"), G_CALLBACK(silcpurple_chat_chauth_ok), - purple_connection_get_account(sg->gc), NULL, NULL, sgc); - - silc_argument_payload_free(chpks); -} - -static void -silcpurple_chat_chauth(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+C", NULL); -} - - -/************************** Channel Private Groups **************************/ - -/* Private groups are "virtual" channels. They are groups inside a channel. - This is implemented by using channel private keys. By knowing a channel - private key user becomes part of that group and is able to talk on that - group. Other users, on the same channel, won't be able to see the - messages of that group. It is possible to have multiple groups inside - a channel - and thus having multiple private keys on the channel. */ - -typedef struct { - SilcPurple sg; - PurpleChat *c; - const char *channel; -} *SilcPurpleCharPrv; - -static void -silcpurple_chat_prv_add(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - SilcPurple sg = p->sg; - char tmp[512]; - PurpleRequestField *f; - const char *name, *passphrase, *alias; - GHashTable *comp; - PurpleGroup *g; - PurpleChat *cn; - - f = purple_request_fields_get_field(fields, "name"); - name = purple_request_field_string_get_value(f); - if (!name) { - silc_free(p); - return; - } - f = purple_request_fields_get_field(fields, "passphrase"); - passphrase = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "alias"); - alias = purple_request_field_string_get_value(f); - - /* Add private group to buddy list */ - g_snprintf(tmp, sizeof(tmp), "%s [Private Group]", name); - comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(comp, g_strdup("channel"), g_strdup(tmp)); - g_hash_table_replace(comp, g_strdup("passphrase"), g_strdup(passphrase)); - - cn = purple_chat_new(sg->account, alias, comp); - g = (PurpleGroup *)p->c->node.parent; - purple_blist_add_chat(cn, g, (PurpleBlistNode *)p->c); - - /* Associate to a real channel */ - purple_blist_node_set_string((PurpleBlistNode *)cn, "parentch", p->channel); - - /* Join the group */ - silcpurple_chat_join(sg->gc, comp); - - silc_free(p); -} - -static void -silcpurple_chat_prv_cancel(SilcPurpleCharPrv p, PurpleRequestFields *fields) -{ - silc_free(p); -} - -static void -silcpurple_chat_prv(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleCharPrv p; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - char tmp[512]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - p = silc_calloc(1, sizeof(*p)); - if (!p) - return; - p->sg = sg; - - p->channel = g_hash_table_lookup(chat->components, "channel"); - p->c = purple_blist_find_chat(sg->account, p->channel); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("name", _("Group Name"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("passphrase", _("Passphrase"), - NULL, FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_string_new("alias", _("Alias"), - NULL, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g_snprintf(tmp, sizeof(tmp), - _("Please enter the %s channel private group name and passphrase."), - p->channel); - purple_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields, - _("Add"), G_CALLBACK(silcpurple_chat_prv_add), - _("Cancel"), G_CALLBACK(silcpurple_chat_prv_cancel), - purple_connection_get_account(gc), NULL, NULL, p); -} - - -/****************************** Channel Modes ********************************/ - -static void -silcpurple_chat_permanent_reset(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-f", NULL); -} - -static void -silcpurple_chat_permanent(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - const char *channel; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - if (!sg->conn) - return; - - /* XXX we should have ability to define which founder - key to use. Now we use the user's own public key - (default key). */ - - /* Call CMODE */ - channel = g_hash_table_lookup(chat->components, "channel"); - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", channel, - "+f", NULL); -} - -typedef struct { - SilcPurple sg; - char *channel; -} *SilcPurpleChatInput; - -static void -silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit) -{ - SilcChannelEntry channel; - int ulimit = 0; - - channel = silc_client_get_channel(s->sg->client, s->sg->conn, - (char *)s->channel); - if (!channel) - return; - if (limit) - ulimit = atoi(limit); - - if (!limit || !(*limit) || *limit == '0') { - if (limit && ulimit == channel->user_limit) { - silc_free(s); - return; - } - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "-l", NULL); - - silc_free(s); - return; - } - - if (ulimit == channel->user_limit) { - silc_free(s); - return; - } - - /* Call CMODE */ - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE", - s->channel, "+l", limit, NULL); - - silc_free(s); -} - -static void -silcpurple_chat_ulimit(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - SilcPurpleChatInput s; - SilcChannelEntry channel; - char *ch; - char tmp[32]; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - if (!sg->conn) - return; - - ch = g_strdup(g_hash_table_lookup(chat->components, "channel")); - channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch); - if (!channel) - return; - - s = silc_calloc(1, sizeof(*s)); - if (!s) - return; - s->channel = ch; - s->sg = sg; - g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit); - purple_request_input(gc, _("User Limit"), NULL, - _("Set user limit on channel. Set to zero to reset user limit."), - tmp, FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(silcpurple_chat_ulimit_cb), - _("Cancel"), G_CALLBACK(silcpurple_chat_ulimit_cb), - purple_connection_get_account(gc), NULL, NULL, s); -} - -static void -silcpurple_chat_resettopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-t", NULL); -} - -static void -silcpurple_chat_settopic(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+t", NULL); -} - -static void -silcpurple_chat_resetprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-p", NULL); -} - -static void -silcpurple_chat_setprivate(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+p", NULL); -} - -static void -silcpurple_chat_resetsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "-s", NULL); -} - -static void -silcpurple_chat_setsecret(PurpleBlistNode *node, gpointer data) -{ - PurpleChat *chat; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node)); - - chat = (PurpleChat *) node; - gc = purple_account_get_connection(chat->account); - sg = gc->proto_data; - - silc_client_command_call(sg->client, sg->conn, NULL, "CMODE", - g_hash_table_lookup(chat->components, "channel"), - "+s", NULL); -} - -typedef struct { - SilcPurple sg; - SilcChannelEntry channel; -} *SilcPurpleChatWb; - -static void -silcpurple_chat_wb(PurpleBlistNode *node, gpointer data) -{ - SilcPurpleChatWb wb = data; - silcpurple_wb_init_ch(wb->sg, wb->channel); - silc_free(wb); -} - -GList *silcpurple_chat_menu(PurpleChat *chat) -{ - GHashTable *components = chat->components; - PurpleConnection *gc = purple_account_get_connection(chat->account); - SilcPurple sg = gc->proto_data; - SilcClientConnection conn = sg->conn; - const char *chname = NULL; - SilcChannelEntry channel = NULL; - SilcChannelUser chu = NULL; - SilcUInt32 mode = 0; - - GList *m = NULL; - PurpleMenuAction *act; - - if (components) - chname = g_hash_table_lookup(components, "channel"); - if (chname) - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (channel) { - chu = silc_client_on_channel(channel, conn->local_entry); - if (chu) - mode = chu->mode; - } - - if (strstr(chname, "[Private Group]")) - return NULL; - - act = purple_menu_action_new(_("Get Info"), - PURPLE_CALLBACK(silcpurple_chat_getinfo_menu), - NULL, NULL); - m = g_list_append(m, act); - -#if 0 /* XXX For now these are not implemented. We need better - listview dialog from Purple for these. */ - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Invite List"), - PURPLE_CALLBACK(silcpurple_chat_invitelist), - NULL, NULL); - m = g_list_append(m, act); - - act = purple_menu_action_new(_("Ban List"), - PURPLE_CALLBACK(silcpurple_chat_banlist), - NULL, NULL); - m = g_list_append(m, act); - } -#endif - - if (chu) { - act = purple_menu_action_new(_("Add Private Group"), - PURPLE_CALLBACK(silcpurple_chat_prv), - NULL, NULL); - m = g_list_append(m, act); - } - - if (mode & SILC_CHANNEL_UMODE_CHANFO) { - act = purple_menu_action_new(_("Channel Authentication"), - PURPLE_CALLBACK(silcpurple_chat_chauth), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) { - act = purple_menu_action_new(_("Reset Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent_reset), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Permanent"), - PURPLE_CALLBACK(silcpurple_chat_permanent), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (mode & SILC_CHANNEL_UMODE_CHANOP) { - act = purple_menu_action_new(_("Set User Limit"), - PURPLE_CALLBACK(silcpurple_chat_ulimit), - NULL, NULL); - m = g_list_append(m, act); - - if (channel->mode & SILC_CHANNEL_MODE_TOPIC) { - act = purple_menu_action_new(_("Reset Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_resettopic), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Topic Restriction"), - PURPLE_CALLBACK(silcpurple_chat_settopic), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_PRIVATE) { - act = purple_menu_action_new(_("Reset Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetprivate), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Private Channel"), - PURPLE_CALLBACK(silcpurple_chat_setprivate), - NULL, NULL); - m = g_list_append(m, act); - } - - if (channel->mode & SILC_CHANNEL_MODE_SECRET) { - act = purple_menu_action_new(_("Reset Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_resetsecret), - NULL, NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Set Secret Channel"), - PURPLE_CALLBACK(silcpurple_chat_setsecret), - NULL, NULL); - m = g_list_append(m, act); - } - } - - if (channel) { - SilcPurpleChatWb wb; - wb = silc_calloc(1, sizeof(*wb)); - wb->sg = sg; - wb->channel = channel; - act = purple_menu_action_new(_("Draw On Whiteboard"), - PURPLE_CALLBACK(silcpurple_chat_wb), - (void *)wb, NULL); - m = g_list_append(m, act); - } - - return m; -} - - -/******************************* Joining Etc. ********************************/ - -void silcpurple_chat_join_done(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcChannelEntry channel = context; - PurpleConversation *convo; - SilcUInt32 retry = SILC_PTR_TO_32(channel->context); - SilcHashTableList htl; - SilcChannelUser chu; - GList *users = NULL, *flags = NULL; - char tmp[256]; - - if (!clients && retry < 1) { - /* Resolving users failed, try again. */ - channel->context = SILC_32_TO_PTR(retry + 1); - silc_client_get_clients_by_channel(client, conn, channel, - silcpurple_chat_join_done, channel); - return; - } - - /* Add channel to Purple */ - channel->context = SILC_32_TO_PTR(++sg->channel_ids); - serv_got_joined_chat(gc, sg->channel_ids, channel->channel_name); - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - /* Add all users to channel */ - silc_hash_table_list(channel->user_list, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - PurpleConvChatBuddyFlags f = PURPLE_CBFLAGS_NONE; - if (!chu->client->nickname) - continue; - chu->context = SILC_32_TO_PTR(sg->channel_ids); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) - f |= PURPLE_CBFLAGS_FOUNDER; - if (chu->mode & SILC_CHANNEL_UMODE_CHANOP) - f |= PURPLE_CBFLAGS_OP; - users = g_list_append(users, g_strdup(chu->client->nickname)); - flags = g_list_append(flags, GINT_TO_POINTER(f)); - - if (chu->mode & SILC_CHANNEL_UMODE_CHANFO) { - if (chu->client == conn->local_entry) - g_snprintf(tmp, sizeof(tmp), - _("You are channel founder on %s"), - channel->channel_name); - else - g_snprintf(tmp, sizeof(tmp), - _("Channel founder on %s is %s"), - channel->channel_name, chu->client->nickname); - - purple_conversation_write(convo, NULL, tmp, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - - } - } - silc_hash_table_list_reset(&htl); - - purple_conv_chat_add_users(PURPLE_CONV_CHAT(convo), users, NULL, flags, FALSE); - g_list_free(users); - g_list_free(flags); - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - - /* Set nick */ - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), conn->local_entry->nickname); -} - -char *silcpurple_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "channel")); -} - -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - const char *channel, *passphrase, *parentch; - - if (!conn) - return; - - channel = g_hash_table_lookup(data, "channel"); - passphrase = g_hash_table_lookup(data, "passphrase"); - - /* Check if we are joining a private group. Handle it - purely locally as it's not a real channel */ - if (strstr(channel, "[Private Group]")) { - SilcChannelEntry channel_entry; - SilcChannelPrivateKey key; - PurpleChat *c; - SilcPurplePrvgrp grp; - - c = purple_blist_find_chat(sg->account, channel); - parentch = purple_blist_node_get_string((PurpleBlistNode *)c, "parentch"); - if (!parentch) - return; - - channel_entry = silc_client_get_channel(sg->client, sg->conn, - (char *)parentch); - if (!channel_entry || - !silc_client_on_channel(channel_entry, sg->conn->local_entry)) { - char tmp[512]; - g_snprintf(tmp, sizeof(tmp), - _("You have to join the %s channel before you are " - "able to join the private group"), parentch); - purple_notify_error(gc, _("Join Private Group"), - _("Cannot join private group"), tmp); - return; - } - - /* Add channel private key */ - if (!silc_client_add_channel_private_key(client, conn, - channel_entry, channel, - NULL, NULL, - (unsigned char *)passphrase, - strlen(passphrase), &key)) - return; - - /* Join the group */ - grp = silc_calloc(1, sizeof(*grp)); - if (!grp) - return; - grp->id = ++sg->channel_ids + SILCPURPLE_PRVGRP; - grp->chid = SILC_PTR_TO_32(channel_entry->context); - grp->parentch = parentch; - grp->channel = channel; - grp->key = key; - sg->grps = g_list_append(sg->grps, grp); - serv_got_joined_chat(gc, grp->id, channel); - return; - } - - /* XXX We should have other properties here as well: - 1. whether to try to authenticate to the channel - 1a. with default key, - 1b. with specific key. - 2. whether to try to authenticate to become founder. - 2a. with default key, - 2b. with specific key. - - Since now such variety is not possible in the join dialog - we always use -founder and -auth options, which try to - do both 1 and 2 with default keys. */ - - /* Call JOIN */ - if ((passphrase != NULL) && (*passphrase != '\0')) - silc_client_command_call(client, conn, NULL, "JOIN", - channel, passphrase, "-auth", "-founder", NULL); - else - silc_client_command_call(client, conn, NULL, "JOIN", - channel, "-auth", "-founder", NULL); -} - -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if we are inviting on a private group. Invite - to the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call INVITE */ - silc_client_command_call(client, conn, NULL, "INVITE", - chu->channel->channel_name, - name, NULL); -} - -void silcpurple_chat_leave(PurpleConnection *gc, int id) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - GList *l; - SilcPurplePrvgrp prv; - - if (!conn) - return; - - /* See if we are leaving a private group */ - if (id > SILCPURPLE_PRVGRP) { - SilcChannelEntry channel; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) - return; - silc_client_del_channel_private_key(client, conn, - channel, prv->key); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - serv_got_chat_left(gc, id); - return; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call LEAVE */ - silc_client_command_call(client, conn, NULL, "LEAVE", - chu->channel->channel_name, NULL); - - serv_got_chat_left(gc, id); - - /* Leave from private groups on this channel as well */ - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->chid == id) { - prv = l->data; - silc_client_del_channel_private_key(client, conn, - chu->channel, - prv->key); - serv_got_chat_left(gc, prv->id); - silc_free(prv); - sg->grps = g_list_remove(sg->grps, prv); - if (!sg->grps) - break; - } -} - -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags msgflags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - SilcChannelEntry channel = NULL; - SilcChannelPrivateKey key = NULL; - SilcUInt32 flags; - int ret; - char *msg2, *tmp; - gboolean found = FALSE; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); - - if (!msg || !conn) - return 0; - - flags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg2 = purple_unescape_html(msg); - - if (!g_ascii_strncasecmp(msg2, "/me ", 4)) - { - msg2 += 4; - if (!*msg2) { - g_free(tmp); - return 0; - } - flags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (sign) - flags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Get the channel private key if we are sending on - private group */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) { - g_free(tmp); - return 0; - } - prv = l->data; - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)prv->parentch); - if (!channel) { - g_free(tmp); - return 0; - } - key = prv->key; - } - - if (!channel) { - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) { - g_free(tmp); - return 0; - } - channel = chu->channel; - } - - /* Send channel message */ - ret = silc_client_send_channel_message(client, conn, channel, key, - flags, (unsigned char *)msg2, - strlen(msg2), TRUE); - if (ret) { - serv_got_chat_in(gc, id, purple_connection_get_display_name(gc), msgflags, msg, - time(NULL)); - } - g_free(tmp); - - return ret; -} - -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcHashTableList htl; - SilcChannelUser chu; - gboolean found = FALSE; - - if (!conn) - return; - - /* See if setting topic on private group. Set it - on the actual channel */ - if (id > SILCPURPLE_PRVGRP) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->id == id) - break; - if (!l) - return; - prv = l->data; - id = prv->chid; - } - - /* Find channel by id */ - silc_hash_table_list(conn->local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - if (SILC_PTR_TO_32(chu->channel->context) == id ) { - found = TRUE; - break; - } - } - silc_hash_table_list_reset(&htl); - if (!found) - return; - - /* Call TOPIC */ - silc_client_command_call(client, conn, NULL, "TOPIC", - chu->channel->channel_name, topic, NULL); -} - -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - GList *fields = NULL; - PurpleRoomlistField *f; - - if (!conn) - return NULL; - - if (sg->roomlist) - purple_roomlist_unref(sg->roomlist); - - sg->roomlist_canceled = FALSE; - - sg->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, - _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, - _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - purple_roomlist_set_fields(sg->roomlist, fields); - - /* Call LIST */ - silc_client_command_call(client, conn, "LIST"); - - purple_roomlist_set_in_progress(sg->roomlist, TRUE); - - return sg->roomlist; -} - -void silcpurple_roomlist_cancel(PurpleRoomlist *list) -{ - PurpleConnection *gc = purple_account_get_connection(list->account); - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - - purple_roomlist_set_in_progress(list, FALSE); - if (sg->roomlist == list) { - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - sg->roomlist_canceled = TRUE; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ft.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ft.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ft.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ft.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,412 +0,0 @@ -/* - - silcpurple_ft.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" - -/****************************** File Transfer ********************************/ - -/* This implements the secure file transfer protocol (SFTP) using the SILC - SFTP library implementation. The API we use from the SILC Toolkit is the - SILC Client file transfer API, as it provides a simple file transfer we - need in this case. We could use the SILC SFTP API directly, but it would - be an overkill since we'd effectively re-implement the file transfer what - the SILC Client's file transfer API already provides. - - From Purple we do NOT use the FT API to do the transfer as it is very limiting. - In fact it does not suite to file transfers like SFTP at all. For example, - it assumes that read operations are synchronous what they are not in SFTP. - It also assumes that the file transfer socket is to be handled by the Purple - eventloop, and this naturally is something we don't want to do in case of - SILC Toolkit. The FT API suites well to purely stream based file transfers - like HTTP GET and similar. - - For this reason, we directly access the Purple GKT FT API and hack the FT - API to merely provide the user interface experience and all the magic - is done in the SILC Toolkit. Ie. we update the statistics information in - the FT API for user interface, and that's it. A bit dirty but until the - FT API gets better this is the way to go. Good thing that FT API allowed - us to do this. */ - -typedef struct { - SilcPurple sg; - SilcClientEntry client_entry; - SilcUInt32 session_id; - char *hostname; - SilcUInt16 port; - PurpleXfer *xfer; - - SilcClientFileName completion; - void *completion_context; -} *SilcPurpleXfer; - -static void -silcpurple_ftp_monitor(SilcClient client, - SilcClientConnection conn, - SilcClientMonitorStatus status, - SilcClientFileError error, - SilcUInt64 offset, - SilcUInt64 filesize, - SilcClientEntry client_entry, - SilcUInt32 session_id, - const char *filepath, - void *context) -{ - SilcPurpleXfer xfer = context; - PurpleConnection *gc = xfer->sg->gc; - char tmp[256]; - - if (status == SILC_CLIENT_FILE_MONITOR_CLOSED) { - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - if (status == SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT) - return; - - if (status == SILC_CLIENT_FILE_MONITOR_ERROR) { - if (error == SILC_CLIENT_FILE_NO_SUCH_FILE) { - g_snprintf(tmp, sizeof(tmp), "No such file %s", - filepath ? filepath : "[N/A]"); - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), tmp); - } else if (error == SILC_CLIENT_FILE_PERMISSION_DENIED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Permission denied")); - } else if (error == SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("Key agreement failed")); - } else if (error == SILC_CLIENT_FILE_UNKNOWN_SESSION) { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), - _("File transfer session does not exist")); - } else { - purple_notify_error(gc, _("Secure File Transfer"), - _("Error during file transfer"), NULL); - } - silc_client_file_close(client, conn, session_id); - purple_xfer_unref(xfer->xfer); - silc_free(xfer); - return; - } - - /* Update file transfer UI */ - if (!offset && filesize) - purple_xfer_set_size(xfer->xfer, filesize); - if (offset && filesize) { - xfer->xfer->bytes_sent = offset; - xfer->xfer->bytes_remaining = filesize - offset; - } - purple_xfer_update_progress(xfer->xfer); - - if (status == SILC_CLIENT_FILE_MONITOR_SEND || - status == SILC_CLIENT_FILE_MONITOR_RECEIVE) { - if (offset == filesize) { - /* Download finished */ - purple_xfer_set_completed(xfer->xfer, TRUE); - silc_client_file_close(client, conn, session_id); - } - } -} - -static void -silcpurple_ftp_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - xfer->xfer->status = PURPLE_XFER_STATUS_CANCEL_LOCAL; - purple_xfer_update_progress(xfer->xfer); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - - /* Cancel the transmission */ - xfer->completion(NULL, xfer->completion_context); - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); -} - -static void -silcpurple_ftp_ask_name_ok(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - - name = purple_xfer_get_local_filename(x); - g_unlink(name); - xfer->completion(name, xfer->completion_context); -} - -static void -silcpurple_ftp_ask_name(SilcClient client, - SilcClientConnection conn, - SilcUInt32 session_id, - const char *remote_filename, - SilcClientFileName completion, - void *completion_context, - void *context) -{ - SilcPurpleXfer xfer = context; - - xfer->completion = completion; - xfer->completion_context = completion_context; - - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_ask_name_ok); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_ask_name_cancel); - - /* Request to save the file */ - purple_xfer_set_filename(xfer->xfer, remote_filename); - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_request_result(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - SilcClientFileError status; - PurpleConnection *gc = xfer->sg->gc; - - if (purple_xfer_get_status(x) != PURPLE_XFER_STATUS_ACCEPTED) - return; - - /* Start the file transfer */ - status = silc_client_file_receive(xfer->sg->client, xfer->sg->conn, - silcpurple_ftp_monitor, xfer, - NULL, xfer->session_id, - silcpurple_ftp_ask_name, xfer); - switch (status) { - case SILC_CLIENT_FILE_OK: - return; - break; - - case SILC_CLIENT_FILE_UNKNOWN_SESSION: - purple_notify_error(gc, _("Secure File Transfer"), - _("No file transfer session active"), NULL); - break; - - case SILC_CLIENT_FILE_ALREADY_STARTED: - purple_notify_error(gc, _("Secure File Transfer"), - _("File transfer already started"), NULL); - break; - - case SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not perform key agreement for file transfer"), - NULL); - break; - - default: - purple_notify_error(gc, _("Secure File Transfer"), - _("Could not start the file transfer"), NULL); - break; - } - - /* Error */ - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); -} - -static void -silcpurple_ftp_request_denied(PurpleXfer *x) -{ - -} - -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleXfer xfer; - - xfer = silc_calloc(1, sizeof(*xfer)); - if (!xfer) { - silc_client_file_close(sg->client, sg->conn, session_id); - return; - } - - xfer->sg = sg; - xfer->client_entry = client_entry; - xfer->session_id = session_id; - xfer->hostname = g_strdup(hostname); - xfer->port = port; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_RECEIVE, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_request_result); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_recv_fnc(xfer->xfer, silcpurple_ftp_cancel); - xfer->xfer->remote_ip = g_strdup(hostname); - xfer->xfer->remote_port = port; - xfer->xfer->data = xfer; - - /* File transfer request */ - purple_xfer_request(xfer->xfer); -} - -static void -silcpurple_ftp_send_cancel(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - purple_xfer_unref(xfer->xfer); - g_free(xfer->hostname); - silc_free(xfer); -} - -static void -silcpurple_ftp_send(PurpleXfer *x) -{ - SilcPurpleXfer xfer = x->data; - const char *name; - char *local_ip = NULL, *remote_ip = NULL; - gboolean local = TRUE; - - name = purple_xfer_get_local_filename(x); - - /* Do the same magic what we do with key agreement (see silcpurple_buddy.c) - to see if we are behind NAT. */ - if (silc_net_check_local_by_sock(xfer->sg->conn->sock->sock, - NULL, &local_ip)) { - /* Check if the IP is private */ - if (silcpurple_ip_is_private(local_ip)) { - local = FALSE; - /* Local IP is private, resolve the remote server IP to see whether - we are talking to Internet or just on LAN. */ - if (silc_net_check_host_by_sock(xfer->sg->conn->sock->sock, NULL, - &remote_ip)) - if (silcpurple_ip_is_private(remote_ip)) - /* We assume we are in LAN. Let's provide the connection point. */ - local = TRUE; - } - } - - if (local && !local_ip) - local_ip = silc_net_localip(); - - /* Send the file */ - silc_client_file_send(xfer->sg->client, xfer->sg->conn, - silcpurple_ftp_monitor, xfer, - local_ip, 0, !local, xfer->client_entry, - name, &xfer->session_id); - - silc_free(local_ip); - silc_free(remote_ip); -} - -static void -silcpurple_ftp_send_file_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - char tmp[256]; - - if (!clients) { - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), - (const char *)context); - purple_notify_error(gc, _("Secure File Transfer"), - _("Cannot send file"), tmp); - silc_free(context); - return; - } - - silcpurple_ftp_send_file(client->application, (const char *)context, NULL); - silc_free(context); -} - -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count; - SilcPurpleXfer xfer; - char *nickname; - - g_return_val_if_fail(name != NULL, NULL); - - if (!silc_parse_userfqdn(name, &nickname, NULL)) - return NULL; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, name, - &clients_count); - if (!clients) { - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_ftp_send_file_resolved, - strdup(name)); - silc_free(nickname); - return NULL; - } - - xfer = silc_calloc(1, sizeof(*xfer)); - - g_return_val_if_fail(xfer != NULL, NULL); - - xfer->sg = sg; - xfer->client_entry = clients[0]; - xfer->xfer = purple_xfer_new(xfer->sg->account, PURPLE_XFER_SEND, - xfer->client_entry->nickname); - if (!xfer->xfer) { - silc_client_file_close(xfer->sg->client, xfer->sg->conn, xfer->session_id); - g_free(xfer->hostname); - silc_free(xfer); - return NULL; - } - purple_xfer_set_init_fnc(xfer->xfer, silcpurple_ftp_send); - purple_xfer_set_request_denied_fnc(xfer->xfer, silcpurple_ftp_request_denied); - purple_xfer_set_cancel_send_fnc(xfer->xfer, silcpurple_ftp_send_cancel); - xfer->xfer->data = xfer; - - silc_free(clients); - silc_free(nickname); - - return xfer->xfer; -} - -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file) -{ - PurpleXfer *xfer = silcpurple_ftp_new_xfer(gc, name); - - g_return_if_fail(xfer != NULL); - - /* Choose file to send */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SILCSOURCES = silc.c silcpurple.h buddy.c chat.c ft.c ops.c pk.c util.c wb.c wb.h - -AM_CFLAGS = $(st) - -libsilcpurple_la_LDFLAGS = -module -avoid-version - -if STATIC_SILC - -st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -noinst_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -libsilcpurple_la_LIBADD = $(SILC_LIBS) - -else - -st = $(SILC_CFLAGS) -pkg_LTLIBRARIES = libsilcpurple.la -libsilcpurple_la_SOURCES = $(SILCSOURCES) -libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,804 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/silc10 -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_SILC_FALSE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@STATIC_SILC_TRUE@libsilcpurple_la_DEPENDENCIES = \ -@STATIC_SILC_TRUE@ $(am__DEPENDENCIES_1) -am__libsilcpurple_la_SOURCES_DIST = silc.c silcpurple.h buddy.c chat.c \ - ft.c ops.c pk.c util.c wb.c wb.h -am__objects_1 = libsilcpurple_la-silc.lo libsilcpurple_la-buddy.lo \ - libsilcpurple_la-chat.lo libsilcpurple_la-ft.lo \ - libsilcpurple_la-ops.lo libsilcpurple_la-pk.lo \ - libsilcpurple_la-util.lo libsilcpurple_la-wb.lo -@STATIC_SILC_FALSE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -@STATIC_SILC_TRUE@am_libsilcpurple_la_OBJECTS = $(am__objects_1) -libsilcpurple_la_OBJECTS = $(am_libsilcpurple_la_OBJECTS) -@STATIC_SILC_FALSE@am_libsilcpurple_la_rpath = -rpath $(pkgdir) -@STATIC_SILC_TRUE@am_libsilcpurple_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsilcpurple_la_SOURCES) -DIST_SOURCES = $(am__libsilcpurple_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw \ - README \ - TODO - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -SILCSOURCES = silc.c silcpurple.h buddy.c chat.c ft.c ops.c pk.c util.c wb.c wb.h -AM_CFLAGS = $(st) -libsilcpurple_la_LDFLAGS = -module -avoid-version -@STATIC_SILC_FALSE@st = $(SILC_CFLAGS) -@STATIC_SILC_TRUE@st = -DPURPLE_STATIC_PRPL $(SILC_CFLAGS) -@STATIC_SILC_TRUE@noinst_LTLIBRARIES = libsilcpurple.la -@STATIC_SILC_FALSE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_SOURCES = $(SILCSOURCES) -@STATIC_SILC_TRUE@libsilcpurple_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SILC_FALSE@libsilcpurple_la_LIBADD = $(GLIB_LIBS) $(SILC_LIBS) -@STATIC_SILC_TRUE@libsilcpurple_la_LIBADD = $(SILC_LIBS) -@STATIC_SILC_FALSE@pkg_LTLIBRARIES = libsilcpurple.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(DEBUG_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(SILC_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/silc10/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/silc10/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsilcpurple.la: $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_DEPENDENCIES) - $(LINK) $(am_libsilcpurple_la_rpath) $(libsilcpurple_la_LDFLAGS) $(libsilcpurple_la_OBJECTS) $(libsilcpurple_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-buddy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-chat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-ops.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-pk.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-silc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsilcpurple_la-wb.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsilcpurple_la-silc.lo: silc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-silc.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-silc.Tpo" -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo" "$(DEPDIR)/libsilcpurple_la-silc.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-silc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='silc.c' object='libsilcpurple_la-silc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-silc.lo `test -f 'silc.c' || echo '$(srcdir)/'`silc.c - -libsilcpurple_la-buddy.lo: buddy.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-buddy.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo" "$(DEPDIR)/libsilcpurple_la-buddy.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-buddy.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='buddy.c' object='libsilcpurple_la-buddy.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-buddy.lo `test -f 'buddy.c' || echo '$(srcdir)/'`buddy.c - -libsilcpurple_la-chat.lo: chat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-chat.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-chat.Tpo" -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo" "$(DEPDIR)/libsilcpurple_la-chat.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-chat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='chat.c' object='libsilcpurple_la-chat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-chat.lo `test -f 'chat.c' || echo '$(srcdir)/'`chat.c - -libsilcpurple_la-ft.lo: ft.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ft.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ft.Tpo" -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo" "$(DEPDIR)/libsilcpurple_la-ft.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ft.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ft.c' object='libsilcpurple_la-ft.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ft.lo `test -f 'ft.c' || echo '$(srcdir)/'`ft.c - -libsilcpurple_la-ops.lo: ops.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-ops.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-ops.Tpo" -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo" "$(DEPDIR)/libsilcpurple_la-ops.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-ops.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ops.c' object='libsilcpurple_la-ops.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-ops.lo `test -f 'ops.c' || echo '$(srcdir)/'`ops.c - -libsilcpurple_la-pk.lo: pk.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-pk.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-pk.Tpo" -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo" "$(DEPDIR)/libsilcpurple_la-pk.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-pk.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pk.c' object='libsilcpurple_la-pk.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-pk.lo `test -f 'pk.c' || echo '$(srcdir)/'`pk.c - -libsilcpurple_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-util.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-util.Tpo" -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-util.Tpo" "$(DEPDIR)/libsilcpurple_la-util.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libsilcpurple_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -libsilcpurple_la-wb.lo: wb.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -MT libsilcpurple_la-wb.lo -MD -MP -MF "$(DEPDIR)/libsilcpurple_la-wb.Tpo" -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo" "$(DEPDIR)/libsilcpurple_la-wb.Plo"; else rm -f "$(DEPDIR)/libsilcpurple_la-wb.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='wb.c' object='libsilcpurple_la-wb.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsilcpurple_la_CFLAGS) $(CFLAGS) -c -o libsilcpurple_la-wb.lo `test -f 'wb.c' || echo '$(srcdir)/'`wb.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsilc protocol plugin -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -DEFINES := $(subst -DWIN32_LEAN_AND_MEAN,,$(DEFINES)) - -TARGET = libsilc -NEEDED_DLLS = $(SILC_TOOLKIT)/lib/silc.dll \ - $(SILC_TOOLKIT)/lib/silcclient.dll -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) \ - -I$(SILC_TOOLKIT)/include - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(SILC_TOOLKIT)/lib - -## -## SOURCES, OBJECTS -## -C_SRC = silc.c \ - buddy.c \ - chat.c \ - ft.c \ - ops.c \ - pk.c \ - util.c \ - wb.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple \ - -lsilc \ - -lsilcclient - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) $(PURPLE_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - cp $(NEEDED_DLLS) $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--image-base,0x64000000 -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ops.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ops.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ops.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/ops.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2063 +0,0 @@ -/* - - silcpurple_ops.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" -#include "wb.h" - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); - -/* Message sent to the application by library. `conn' associates the - message to a specific connection. `conn', however, may be NULL. - The `type' indicates the type of the message sent by the library. - The application can for example filter the message according the - type. */ - -static void -silc_say(SilcClient client, SilcClientConnection conn, - SilcClientMessageType type, char *msg, ...) -{ - /* Nothing */ -} - -#ifdef HAVE_SILCMIME_H -/* Processes incoming MIME message. Can be private message or channel - message. */ - -static void -silcpurple_mime_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, SilcMime mime, - gboolean recursive) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *type; - const unsigned char *data; - SilcUInt32 data_len; - PurpleMessageFlags cflags = 0; - PurpleConversation *convo = NULL; - - if (!mime) - return; - - /* Check for fragmented MIME message */ - if (silc_mime_is_partial(mime)) { - if (!sg->mimeass) - sg->mimeass = silc_mime_assembler_alloc(); - - /* Defragment */ - mime = silc_mime_assemble(sg->mimeass, mime); - if (!mime) - /* More fragments to come */ - return; - - /* Process the complete message */ - silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, mime, FALSE); - return; - } - - /* Check for multipart message */ - if (silc_mime_is_multipart(mime)) { - SilcMime p; - const char *mtype; - SilcDList parts = silc_mime_get_multiparts(mime, &mtype); - - /* Only "mixed" type supported */ - if (strcmp(mtype, "mixed")) - goto out; - - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) { - /* Recursively process parts */ - silcpurple_mime_message(client, conn, sender, channel, - payload, key, flags, p, TRUE); - } - goto out; - } - - /* Get content type and MIME data */ - type = silc_mime_get_field(mime, "Content-Type"); - if (!type) - goto out; - data = silc_mime_get_data(mime, &data_len); - if (!data) - goto out; - - /* Process according to content type */ - - /* Plain text */ - if (strstr(type, "text/plain")) { - /* Default is UTF-8, don't check for other charsets */ - if (!strstr(type, "utf-8")) - goto out; - - if (channel) - silc_channel_message(client, conn, sender, channel, - payload, key, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - else - silc_private_message(client, conn, sender, payload, - SILC_MESSAGE_FLAG_UTF8, data, - data_len); - goto out; - } - - /* Image */ - if (strstr(type, "image/png") || - strstr(type, "image/jpeg") || - strstr(type, "image/gif") || - strstr(type, "image/tiff")) { - char tmp[32]; - int imgid; - - /* Get channel convo (if message is for channel) */ - if (key && channel) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (channel && !convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (channel && !convo) - goto out; - - imgid = purple_imgstore_add_with_id(g_memdup(data, data_len), data_len, ""); - if (imgid) { - cflags |= PURPLE_MESSAGE_IMAGES | PURPLE_MESSAGE_RECV; - g_snprintf(tmp, sizeof(tmp), "", imgid); - - if (channel) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : - "", cflags, - tmp, time(NULL)); - else - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, cflags, time(NULL)); - - purple_imgstore_unref_by_id(imgid); - cflags = 0; - } - goto out; - } - - /* Whiteboard message */ - if (strstr(type, "application/x-wb") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) { - if (channel) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); - else - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); - goto out; - } - - out: - if (!recursive) - silc_mime_free(mime); -} -#endif /* HAVE_SILCMIME_H */ - -/* Message for a channel. The `sender' is the sender of the message - The `channel' is the channel. The `message' is the message. Note - that `message' maybe NULL. The `flags' indicates message flags - and it is used to determine how the message can be interpreted - (like it may tell the message is multimedia message). */ - -static void -silc_channel_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, SilcChannelPrivateKey key, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (key) { - GList *l; - SilcPurplePrvgrp prv; - - for (l = sg->grps; l; l = l->next) - if (((SilcPurplePrvgrp)l->data)->key == key) { - prv = l->data; - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - prv->channel, sg->account); - break; - } - } - if (!convo) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - return; - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { - /* Process MIME message */ -#ifdef HAVE_SILCMIME_H - SilcMime mime; - mime = silc_mime_decode(message, message_len); - silcpurple_mime_message(client, conn, sender, channel, payload, - key, flags, mime, FALSE); -#else - char type[128], enc[128]; - unsigned char *data; - SilcUInt32 data_len; - - memset(type, 0, sizeof(type)); - memset(enc, 0, sizeof(enc)); - - if (!silc_mime_parse(message, message_len, NULL, 0, - type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, - &data_len)) - return; - - if (!strcmp(type, "application/x-wb") && - !strcmp(enc, "binary") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) - silcpurple_wb_receive_ch(client, conn, sender, channel, - payload, flags, data, data_len); -#endif - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : "", 0, - tmp, time(NULL)); - g_free(tmp); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname ? - sender->nickname : "", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), - sender->nickname ? - sender->nickname : "", 0, - tmp, time(NULL)); - g_free(tmp); - } -} - - -/* Private message to the client. The `sender' is the sender of the - message. The message is `message'and maybe NULL. The `flags' - indicates message flags and it is used to determine how the message - can be interpreted (like it may tell the message is multimedia - message). */ - -static void -silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo = NULL; - char *msg, *tmp; - - if (!message) - return; - - if (sender->nickname) - /* XXX - Should this be PURPLE_CONV_TYPE_IM? */ - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, - sender->nickname, sg->account); - - if (flags & SILC_MESSAGE_FLAG_SIGNED && - purple_account_get_bool(sg->account, "sign-verify", FALSE)) { - /* XXX */ - } - - if (flags & SILC_MESSAGE_FLAG_DATA) { -#ifdef HAVE_SILCMIME_H - /* Process MIME message */ - SilcMime mime; - mime = silc_mime_decode(message, message_len); - silcpurple_mime_message(client, conn, sender, NULL, payload, - NULL, flags, mime, FALSE); -#else - char type[128], enc[128]; - unsigned char *data; - SilcUInt32 data_len; - - memset(type, 0, sizeof(type)); - memset(enc, 0, sizeof(enc)); - - if (!silc_mime_parse(message, message_len, NULL, 0, - type, sizeof(type) - 1, enc, sizeof(enc) - 1, &data, - &data_len)) - return; - - if (!strcmp(type, "application/x-wb") && - !strcmp(enc, "binary") && - !purple_account_get_bool(sg->account, "block-wb", FALSE)) - silcpurple_wb_receive(client, conn, sender, payload, - flags, data, data_len); -#endif - return; - } - - if (flags & SILC_MESSAGE_FLAG_ACTION && convo) { - msg = g_strdup_printf("/me %s", - (const char *)message); - if (!msg) - return; - - tmp = g_markup_escape_text(msg, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, 0, time(NULL)); - g_free(msg); - g_free(tmp); - return; - } - - if (flags & SILC_MESSAGE_FLAG_NOTICE && convo) { - msg = g_strdup_printf("(notice) %s %s", - sender->nickname ? - sender->nickname : "", - (const char *)message); - if (!msg) - return; - - /* Send to Purple */ - purple_conversation_write(convo, NULL, (const char *)msg, - PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(msg); - return; - } - - if (flags & SILC_MESSAGE_FLAG_UTF8) { - tmp = g_markup_escape_text((const char *)message, -1); - /* Send to Purple */ - serv_got_im(gc, sender->nickname ? - sender->nickname : "", - tmp, 0, time(NULL)); - g_free(tmp); - } -} - - -/* Notify message to the client. The notify arguments are sent in the - same order as servers sends them. The arguments are same as received - from the server except for ID's. If ID is received application receives - the corresponding entry to the ID. For example, if Client ID is received - application receives SilcClientEntry. Also, if the notify type is - for channel the channel entry is sent to application (even if server - does not send it because client library gets the channel entry from - the Channel ID in the packet's header). */ - -static void -silc_notify(SilcClient client, SilcClientConnection conn, - SilcNotifyType type, ...) -{ - va_list va; - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - SilcClientEntry client_entry, client_entry2; - SilcChannelEntry channel; - SilcServerEntry server_entry; - SilcIdType idtype; - void *entry; - SilcUInt32 mode; - SilcHashTableList htl; - SilcChannelUser chu; - char buf[512], buf2[512], *tmp, *name; - SilcNotifyType notify; - PurpleBuddy *b; - int i; - - va_start(va, type); - memset(buf, 0, sizeof(buf)); - - switch (type) { - - case SILC_NOTIFY_TYPE_NONE: - break; - - case SILC_NOTIFY_TYPE_INVITE: - { - GHashTable *components; - va_arg(va, SilcChannelEntry); - name = va_arg(va, char *); - client_entry = va_arg(va, SilcClientEntry); - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_insert(components, strdup("channel"), strdup(name)); - serv_got_chat_invite(gc, name, client_entry->nickname, NULL, components); - } - break; - - case SILC_NOTIFY_TYPE_JOIN: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - /* If we joined channel, do nothing */ - if (client_entry == conn->local_entry) - break; - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Join user to channel */ - g_snprintf(buf, sizeof(buf), "%s@%s", - client_entry->username, client_entry->hostname); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), - g_strdup(client_entry->nickname), buf, PURPLE_CBFLAGS_NONE, TRUE); - - break; - - case SILC_NOTIFY_TYPE_LEAVE: - client_entry = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - /* Remove user from channel */ - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, NULL); - - break; - - case SILC_NOTIFY_TYPE_SIGNOFF: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - - if (!client_entry->nickname) - break; - - /* Remove from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - tmp); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_TOPIC_SET: - { - char *esc, *tmp2; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - tmp = va_arg(va, char *); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (!tmp) - break; - - esc = g_markup_escape_text(tmp, -1); - tmp2 = purple_markup_linkify(esc); - g_free(esc); - - if (idtype == SILC_ID_CLIENT) { - client_entry = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - client_entry->nickname, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - server_entry->server_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), server_entry->server_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - server_entry->server_name, tmp); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of %s to: %s"), - channel->channel_name, channel->channel_name, tmp2); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), - channel->channel_name, tmp); - } else { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, tmp); - } - - g_free(tmp2); - - break; - - } - case SILC_NOTIFY_TYPE_NICK_CHANGE: - client_entry = va_arg(va, SilcClientEntry); - client_entry2 = va_arg(va, SilcClientEntry); - - if (!strcmp(client_entry->nickname, client_entry2->nickname)) - break; - - /* Change nick on all channels */ - silc_hash_table_list(client_entry2->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), client_entry->nickname)) - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - client_entry2->nickname); - } - silc_hash_table_list_reset(&htl); - - break; - - case SILC_NOTIFY_TYPE_CMODE_CHANGE: - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, char *); - (void)va_arg(va, SilcPublicKey); - (void)va_arg(va, SilcBuffer); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chmode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set channel %s modes to: %s"), name, - channel->channel_name, buf2); - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all channel %s modes"), name, - channel->channel_name); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - break; - - case SILC_NOTIFY_TYPE_CUMODE_CHANGE: - { - PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; - idtype = va_arg(va, int); - entry = va_arg(va, void *); - mode = va_arg(va, SilcUInt32); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (idtype == SILC_ID_CLIENT) - name = ((SilcClientEntry)entry)->nickname; - else if (idtype == SILC_ID_SERVER) - name = ((SilcServerEntry)entry)->server_name; - else - name = ((SilcChannelEntry)entry)->channel_name; - if (!name) - break; - - if (mode) { - silcpurple_get_chumode_string(mode, buf2, sizeof(buf2)); - g_snprintf(buf, sizeof(buf), - _("%s set %s's modes to: %s"), name, - client_entry2->nickname, buf2); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - flags |= PURPLE_CBFLAGS_FOUNDER; - if (mode & SILC_CHANNEL_UMODE_CHANOP) - flags |= PURPLE_CBFLAGS_OP; - } else { - g_snprintf(buf, sizeof(buf), - _("%s removed all %s's modes"), name, - client_entry2->nickname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), channel->channel_name, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(convo), client_entry2->nickname, flags); - break; - } - - case SILC_NOTIFY_TYPE_MOTD: - tmp = va_arg(va, char *); - silc_free(sg->motd); - sg->motd = silc_memdup(tmp, strlen(tmp)); - break; - - case SILC_NOTIFY_TYPE_KICKED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - client_entry2 = va_arg(va, SilcClientEntry); - channel = va_arg(va, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) - break; - - if (client_entry == conn->local_entry) { - /* Remove us from channel */ - g_snprintf(buf, sizeof(buf), - _("You have been kicked off %s by %s (%s)"), - channel->channel_name, client_entry2->nickname, - tmp ? tmp : ""); - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } else { - /* Remove user from channel */ - g_snprintf(buf, sizeof(buf), _("Kicked by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, - buf); - } - - break; - - case SILC_NOTIFY_TYPE_KILLED: - client_entry = va_arg(va, SilcClientEntry); - tmp = va_arg(va, char *); - idtype = va_arg(va, int); - entry = va_arg(va, SilcClientEntry); - - if (!client_entry->nickname) - break; - - if (client_entry == conn->local_entry) { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("You have been killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove us from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_write(PURPLE_CONV_CHAT(convo), client_entry->nickname, - buf, PURPLE_MESSAGE_SYSTEM, time(NULL)); - serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo))); - } - silc_hash_table_list_reset(&htl); - - } else { - if (idtype == SILC_ID_CLIENT) { - client_entry2 = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - client_entry2->nickname, tmp ? tmp : ""); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - server_entry->server_name, tmp ? tmp : ""); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("Killed by %s (%s)"), - channel->channel_name, tmp ? tmp : ""); - } - - /* Remove user from all channels */ - silc_hash_table_list(client_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - client_entry->nickname, tmp); - } - silc_hash_table_list_reset(&htl); - } - - break; - - case SILC_NOTIFY_TYPE_CHANNEL_CHANGE: - break; - - case SILC_NOTIFY_TYPE_SERVER_SIGNOFF: - { - int i; - SilcClientEntry *clients; - SilcUInt32 clients_count; - - (void)va_arg(va, void *); - clients = va_arg(va, SilcClientEntry *); - clients_count = va_arg(va, SilcUInt32); - - for (i = 0; i < clients_count; i++) { - if (!clients[i]->nickname) - break; - - /* Remove from all channels */ - silc_hash_table_list(clients[i]->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = - purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), - clients[i]->nickname, - _("Server signoff")); - } - silc_hash_table_list_reset(&htl); - } - } - break; - - case SILC_NOTIFY_TYPE_ERROR: - { - SilcStatus error = va_arg(va, int); - purple_notify_error(gc, "Error Notify", - silc_get_status_message(error), - NULL); - } - break; - - case SILC_NOTIFY_TYPE_WATCH: - { - SilcPublicKey public_key; - unsigned char *pk; - SilcUInt32 pk_len; - char *fingerprint; - - client_entry = va_arg(va, SilcClientEntry); - (void)va_arg(va, char *); - mode = va_arg(va, SilcUInt32); - notify = va_arg(va, int); - public_key = va_arg(va, SilcPublicKey); - - b = NULL; - if (public_key) { - PurpleBlistNode *gnode, *cnode, *bnode; - const char *f; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - if (!pk) - break; - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - g_snprintf(buf, sizeof(buf) - 1, - "%s" G_DIR_SEPARATOR_S "clientkeys" - G_DIR_SEPARATOR_S "clientkey_%s.pub", - silcpurple_silcdir(), fingerprint); - silc_free(fingerprint); - silc_free(pk); - - /* Find buddy by associated public key */ - for (gnode = purple_get_blist()->root; gnode; - gnode = gnode->next) { - if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) - continue; - for (cnode = gnode->child; cnode; cnode = cnode->next) { - if( !PURPLE_BLIST_NODE_IS_CONTACT(cnode)) - continue; - for (bnode = cnode->child; bnode; - bnode = bnode->next) { - if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) - continue; - b = (PurpleBuddy *)bnode; - if (b->account != gc->account) - continue; - f = purple_blist_node_get_string(bnode, "public-key"); - if (f && !strcmp(f, buf)) - goto cont; - b = NULL; - } - } - } - } - cont: - if (!b) { - /* Find buddy by nickname */ - b = purple_find_buddy(sg->account, client_entry->nickname); - if (!b) { - purple_debug_warning("silc", "WATCH for %s, unknown buddy\n", - client_entry->nickname); - break; - } - } - - silc_free(b->proto_data); - b->proto_data = silc_memdup(client_entry->id, - sizeof(*client_entry->id)); - if (notify == SILC_NOTIFY_TYPE_NICK_CHANGE) { - break; - } else if (notify == SILC_NOTIFY_TYPE_UMODE_CHANGE) { - /* See if client was away and is now present */ - if (!(mode & (SILC_UMODE_GONE | SILC_UMODE_INDISPOSED | - SILC_UMODE_BUSY | SILC_UMODE_PAGE | - SILC_UMODE_DETACHED)) && - (client_entry->mode & SILC_UMODE_GONE || - client_entry->mode & SILC_UMODE_INDISPOSED || - client_entry->mode & SILC_UMODE_BUSY || - client_entry->mode & SILC_UMODE_PAGE || - client_entry->mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - else if ((mode & SILC_UMODE_GONE) || - (mode & SILC_UMODE_INDISPOSED) || - (mode & SILC_UMODE_BUSY) || - (mode & SILC_UMODE_PAGE) || - (mode & SILC_UMODE_DETACHED)) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } - } else if (notify == SILC_NOTIFY_TYPE_SIGNOFF || - notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF || - notify == SILC_NOTIFY_TYPE_KILLED) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_OFFLINE, NULL); - } else if (notify == SILC_NOTIFY_TYPE_NONE) { - client_entry->mode = mode; - purple_prpl_got_user_status(purple_buddy_get_account(b), purple_buddy_get_name(b), SILCPURPLE_STATUS_ID_AVAILABLE, NULL); - } - } - break; - - default: - purple_debug_info("silc", "Unhandled notification: %d\n", type); - break; - } - - va_end(va); -} - - -/* Command handler. This function is called always in the command function. - If error occurs it will be called as well. `conn' is the associated - client connection. `cmd_context' is the command context that was - originally sent to the command. `success' is FALSE if error occurred - during command. `command' is the command being processed. It must be - noted that this is not reply from server. This is merely called just - after application has called the command. Just to tell application - that the command really was processed. */ - -static void -silc_command(SilcClient client, SilcClientConnection conn, - SilcClientCommandContext cmd_context, bool success, - SilcCommand command, SilcStatus status) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - switch (command) { - - case SILC_COMMAND_CMODE: - if (cmd_context->argc == 3 && - !strcmp((char *)cmd_context->argv[2], "+C")) - sg->chpk = TRUE; - else - sg->chpk = FALSE; - break; - - default: - break; - } -} - -#if 0 -static void -silcpurple_whois_more(SilcClientEntry client_entry, gint id) -{ - SilcAttributePayload attr; - SilcAttribute attribute; - char *buf; - GString *s; - SilcVCardStruct vcard; - int i; - - if (id != 0) - return; - - memset(&vcard, 0, sizeof(vcard)); - - s = g_string_new(""); - - silc_dlist_start(client_entry->attrs); - while ((attr = silc_dlist_get(client_entry->attrs)) != SILC_LIST_END) { - attribute = silc_attribute_get_attribute(attr); - switch (attribute) { - - case SILC_ATTRIBUTE_USER_INFO: - if (!silc_attribute_get_object(attr, (void *)&vcard, - sizeof(vcard))) - continue; - g_string_append_printf(s, "%s:\n\n", _("Personal Information")); - if (vcard.full_name) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Full Name"), - vcard.full_name); - if (vcard.first_name) - g_string_append_printf(s, "%s:\t%s\n", - _("First Name"), - vcard.first_name); - if (vcard.middle_names) - g_string_append_printf(s, "%s:\t%s\n", - _("Middle Name"), - vcard.middle_names); - if (vcard.family_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Family Name"), - vcard.family_name); - if (vcard.nickname) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Nickname"), - vcard.nickname); - if (vcard.bday) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Birth Day"), - vcard.bday); - if (vcard.title) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Title"), - vcard.title); - if (vcard.role) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Job Role"), - vcard.role); - if (vcard.org_name) - g_string_append_printf(s, "%s:\t%s\n", - _("Organization"), - vcard.org_name); - if (vcard.org_unit) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Unit"), - vcard.org_unit); - if (vcard.url) - g_string_append_printf(s, "%s:\t%s\n", - _("Homepage"), - vcard.url); - if (vcard.label) - g_string_append_printf(s, "%s:\t%s\n", - _("Address"), - vcard.label); - for (i = 0; i < vcard.num_tels; i++) { - if (vcard.tels[i].telnum) - g_string_append_printf(s, "%s:\t\t\t%s\n", - _("Phone"), - vcard.tels[i].telnum); - } - for (i = 0; i < vcard.num_emails; i++) { - if (vcard.emails[i].address) - g_string_append_printf(s, "%s:\t\t%s\n", - _("Email"), - vcard.emails[i].address); - } - if (vcard.note) - g_string_append_printf(s, "\n%s:\t\t%s\n", - _("Note"), - vcard.note); - break; - } - } - - buf = g_string_free(s, FALSE); - purple_notify_info(NULL, _("User Information"), _("User Information"), - buf); - g_free(buf); -} -#endif - -/* Command reply handler. This function is called always in the command reply - function. If error occurs it will be called as well. Normal scenario - is that it will be called after the received command data has been parsed - and processed. The function is used to pass the received command data to - the application. - - `conn' is the associated client connection. `cmd_payload' is the command - payload data received from server and it can be ignored. It is provided - if the application would like to re-parse the received command data, - however, it must be noted that the data is parsed already by the library - thus the payload can be ignored. `success' is FALSE if error occurred. - In this case arguments are not sent to the application. The `status' is - the command reply status server returned. The `command' is the command - reply being processed. The function has variable argument list and each - command defines the number and type of arguments it passes to the - application (on error they are not sent). */ - -static void -silc_command_reply(SilcClient client, SilcClientConnection conn, - SilcCommandPayload cmd_payload, bool success, - SilcCommand command, SilcStatus status, ...) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - PurpleConversation *convo; - va_list vp; - - va_start(vp, status); - - switch (command) { - case SILC_COMMAND_JOIN: - { - SilcChannelEntry channel_entry; - - if (!success) { - purple_notify_error(gc, _("Join Chat"), _("Cannot join channel"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, char *); - channel_entry = va_arg(vp, SilcChannelEntry); - - /* Resolve users on channel */ - silc_client_get_clients_by_channel(client, conn, channel_entry, - silcpurple_chat_join_done, - channel_entry); - } - break; - - case SILC_COMMAND_LEAVE: - break; - - case SILC_COMMAND_USERS: - break; - - case SILC_COMMAND_WHOIS: - { - SilcUInt32 idle, mode; - SilcBuffer channels, user_modes; - SilcClientEntry client_entry; - char tmp[1024], *tmp2; - char *moodstr, *statusstr, *contactstr, *langstr, *devicestr, *tzstr, *geostr; - PurpleNotifyUserInfo *user_info; - - if (!success) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(status)); - break; - } - - client_entry = va_arg(vp, SilcClientEntry); - if (!client_entry->nickname) - break; - (void)va_arg(vp, char *); - (void)va_arg(vp, char *); - (void)va_arg(vp, char *); - channels = va_arg(vp, SilcBuffer); - mode = va_arg(vp, SilcUInt32); - idle = va_arg(vp, SilcUInt32); - (void)va_arg(vp, unsigned char *); - user_modes = va_arg(vp, SilcBuffer); - - user_info = purple_notify_user_info_new(); - tmp2 = g_markup_escape_text(client_entry->nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp2); - g_free(tmp2); - if (client_entry->realname) { - tmp2 = g_markup_escape_text(client_entry->realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp2); - g_free(tmp2); - } - if (client_entry->username) { - tmp2 = g_markup_escape_text(client_entry->username, -1); - if (client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp2, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp2); - g_free(tmp2); - } - - if (client_entry->mode) { - memset(tmp, 0, sizeof(tmp)); - silcpurple_get_umode_string(client_entry->mode, - tmp, sizeof(tmp) - strlen(tmp)); - purple_notify_user_info_add_pair(user_info, _("User Modes"), tmp); - } - - silcpurple_parse_attrs(client_entry->attrs, &moodstr, &statusstr, &contactstr, &langstr, &devicestr, &tzstr, &geostr); - if (moodstr) { - purple_notify_user_info_add_pair(user_info, _("Mood"), moodstr); - g_free(moodstr); - } - - if (statusstr) { - tmp2 = g_markup_escape_text(statusstr, -1); - purple_notify_user_info_add_pair(user_info, _("Status Text"), tmp2); - g_free(statusstr); - g_free(tmp2); - } - - if (contactstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Contact"), contactstr); - g_free(contactstr); - } - - if (langstr) { - purple_notify_user_info_add_pair(user_info, _("Preferred Language"), langstr); - g_free(langstr); - } - - if (devicestr) { - purple_notify_user_info_add_pair(user_info, _("Device"), devicestr); - g_free(devicestr); - } - - if (tzstr) { - purple_notify_user_info_add_pair(user_info, _("Timezone"), tzstr); - g_free(tzstr); - } - - if (geostr) { - purple_notify_user_info_add_pair(user_info, _("Geolocation"), geostr); - g_free(geostr); - } - - if (client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - if (channels && user_modes) { - SilcUInt32 *umodes; - SilcDList list = - silc_channel_payload_parse_list(channels->data, - channels->len); - if (list && silc_get_mode_list(user_modes, - silc_dlist_count(list), - &umodes)) { - SilcChannelPayload entry; - int i = 0; - - memset(tmp, 0, sizeof(tmp)); - silc_dlist_start(list); - while ((entry = silc_dlist_get(list)) - != SILC_LIST_END) { - SilcUInt32 name_len; - char *m = silc_client_chumode_char(umodes[i++]); - char *name = (char *)silc_channel_get_name(entry, &name_len); - if (m) - silc_strncat(tmp, sizeof(tmp) - 1, m, strlen(m)); - silc_strncat(tmp, sizeof(tmp) - 1, name, name_len); - silc_strncat(tmp, sizeof(tmp) - 1, " ", 1); - silc_free(m); - - } - tmp2 = g_markup_escape_text(tmp, -1); - purple_notify_user_info_add_pair(user_info, _("Currently on"), tmp2); - g_free(tmp2); - silc_free(umodes); - } - } - - if (client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - -#if 0 /* XXX for now, let's not show attrs here */ - if (client_entry->attrs) - purple_request_action(gc, _("User Information"), - _("User Information"), - buf, 1, client_entry, 2, - _("OK"), G_CALLBACK(silcpurple_whois_more), - _("_More..."), G_CALLBACK(silcpurple_whois_more), gc->account, NULL, NULL); - else -#endif - purple_notify_userinfo(gc, client_entry->nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_WHOWAS: - { - SilcClientEntry client_entry; - char *nickname, *realname, *username, *tmp; - PurpleNotifyUserInfo *user_info; - - if (!success) { - purple_notify_error(gc, _("User Information"), - _("Cannot get user information"), - silc_get_status_message(status)); - break; - } - - client_entry = va_arg(vp, SilcClientEntry); - nickname = va_arg(vp, char *); - username = va_arg(vp, char *); - realname = va_arg(vp, char *); - if (!nickname) - break; - - user_info = purple_notify_user_info_new(); - tmp = g_markup_escape_text(nickname, -1); - purple_notify_user_info_add_pair(user_info, _("Nickname"), tmp); - g_free(tmp); - if (realname) { - tmp = g_markup_escape_text(realname, -1); - purple_notify_user_info_add_pair(user_info, _("Real Name"), tmp); - g_free(tmp); - } - if (username) { - tmp = g_markup_escape_text(username, -1); - if (client_entry && client_entry->hostname) { - gchar *tmp3; - tmp3 = g_strdup_printf("%s@%s", tmp, client_entry->hostname); - purple_notify_user_info_add_pair(user_info, _("Username"), tmp3); - g_free(tmp3); - } else - purple_notify_user_info_add_pair(user_info, _("Username"), tmp); - g_free(tmp); - } - if (client_entry && client_entry->server) - purple_notify_user_info_add_pair(user_info, _("Server"), client_entry->server); - - - if (client_entry && client_entry->public_key) { - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - pk = silc_pkcs_public_key_encode(client_entry->public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - purple_notify_user_info_add_pair(user_info, _("Public Key Fingerprint"), fingerprint); - purple_notify_user_info_add_pair(user_info, _("Public Key Babbleprint"), babbleprint); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - } - - purple_notify_userinfo(gc, nickname, user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } - break; - - case SILC_COMMAND_DETACH: - if (!success) { - purple_notify_error(gc, _("Detach From Server"), _("Cannot detach"), - silc_get_status_message(status)); - return; - } - break; - - case SILC_COMMAND_TOPIC: - { - SilcChannelEntry channel; - - if (!success) { - purple_notify_error(gc, _("Topic"), _("Cannot set topic"), - silc_get_status_message(status)); - return; - } - - channel = va_arg(vp, SilcChannelEntry); - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - channel->channel_name, sg->account); - if (!convo) { - purple_debug_error("silc", "Got a topic for %s, which doesn't exist\n", - channel->channel_name); - break; - } - - /* Set topic */ - if (channel->topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, channel->topic); - } - break; - - case SILC_COMMAND_NICK: - { - /* I don't think we should need to do this because the server should - * be sending a SILC_NOTIFY_TYPE_NICK_CHANGE when we change our own - * nick, but it isn't, so we deal with it here instead. Stu. */ - SilcClientEntry local_entry; - SilcHashTableList htl; - SilcChannelUser chu; - const char *oldnick; - - if (!success) { - purple_notify_error(gc, _("Nick"), _("Failed to change nickname"), - silc_get_status_message(status)); - return; - } - - local_entry = va_arg(vp, SilcClientEntry); - - /* Change nick on all channels */ - silc_hash_table_list(local_entry->channels, &htl); - while (silc_hash_table_get(&htl, NULL, (void *)&chu)) { - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - chu->channel->channel_name, sg->account); - if (!convo) - continue; - oldnick = purple_conv_chat_get_nick(PURPLE_CONV_CHAT(convo)); - if (strcmp(oldnick, purple_normalize(purple_conversation_get_account(convo), local_entry->nickname))) { - purple_conv_chat_rename_user(PURPLE_CONV_CHAT(convo), - oldnick, local_entry->nickname); - purple_conv_chat_set_nick(PURPLE_CONV_CHAT(convo), local_entry->nickname); - } - } - silc_hash_table_list_reset(&htl); - - purple_connection_set_display_name(gc, local_entry->nickname); - } - break; - - case SILC_COMMAND_LIST: - { - char *topic, *name; - int usercount; - PurpleRoomlistRoom *room; - - if (sg->roomlist_canceled) - break; - - if (!success) { - purple_notify_error(gc, _("Error"), _("Error retrieving room list"), - silc_get_status_message(status)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - - (void)va_arg(vp, SilcChannelEntry); - name = va_arg(vp, char *); - if (!name) { - purple_notify_error(gc, _("Roomlist"), _("Cannot get room list"), - silc_get_status_message(status)); - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - return; - } - topic = va_arg(vp, char *); - usercount = va_arg(vp, int); - - room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, NULL); - purple_roomlist_room_add_field(sg->roomlist, room, name); - purple_roomlist_room_add_field(sg->roomlist, room, - SILC_32_TO_PTR(usercount)); - purple_roomlist_room_add_field(sg->roomlist, room, - topic ? topic : ""); - purple_roomlist_room_add(sg->roomlist, room); - - if (status == SILC_STATUS_LIST_END || - status == SILC_STATUS_OK) { - purple_roomlist_set_in_progress(sg->roomlist, FALSE); - purple_roomlist_unref(sg->roomlist); - sg->roomlist = NULL; - } - } - break; - - case SILC_COMMAND_GETKEY: - { - SilcPublicKey public_key; - - if (!success) { - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, SilcUInt32); - (void)va_arg(vp, void *); - public_key = va_arg(vp, SilcPublicKey); - - if (!public_key) - purple_notify_error(gc, _("Get Public Key"), - _("Cannot fetch the public key"), - _("No public key was received")); - } - break; - - case SILC_COMMAND_INFO: - { - - char *server_name; - char *server_info; - char tmp[256]; - - if (!success) { - purple_notify_error(gc, _("Server Information"), - _("Cannot get server information"), - silc_get_status_message(status)); - return; - } - - (void)va_arg(vp, SilcServerEntry); - server_name = va_arg(vp, char *); - server_info = va_arg(vp, char *); - - if (server_name && server_info) { - g_snprintf(tmp, sizeof(tmp), "Server: %s\n%s", - server_name, server_info); - purple_notify_info(gc, NULL, _("Server Information"), tmp); - } - } - break; - - case SILC_COMMAND_STATS: - { - SilcUInt32 starttime, uptime, my_clients, my_channels, my_server_ops, - my_router_ops, cell_clients, cell_channels, cell_servers, - clients, channels, servers, routers, server_ops, router_ops; - SilcUInt32 buffer_length; - SilcBufferStruct buf; - - unsigned char *server_stats; - char *msg; - - if (!success) { - purple_notify_error(gc, _("Server Statistics"), - _("Cannot get server statistics"), - silc_get_status_message(status)); - return; - } - - server_stats = va_arg(vp, unsigned char *); - buffer_length = va_arg(vp, SilcUInt32); - if (!server_stats || !buffer_length) { - purple_notify_error(gc, _("Server Statistics"), - _("No server statistics available"), NULL); - break; - } - silc_buffer_set(&buf, server_stats, buffer_length); - silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&starttime), - SILC_STR_UI_INT(&uptime), - SILC_STR_UI_INT(&my_clients), - SILC_STR_UI_INT(&my_channels), - SILC_STR_UI_INT(&my_server_ops), - SILC_STR_UI_INT(&my_router_ops), - SILC_STR_UI_INT(&cell_clients), - SILC_STR_UI_INT(&cell_channels), - SILC_STR_UI_INT(&cell_servers), - SILC_STR_UI_INT(&clients), - SILC_STR_UI_INT(&channels), - SILC_STR_UI_INT(&servers), - SILC_STR_UI_INT(&routers), - SILC_STR_UI_INT(&server_ops), - SILC_STR_UI_INT(&router_ops), - SILC_STR_END); - - msg = g_strdup_printf(_("Local server start time: %s\n" - "Local server uptime: %s\n" - "Local server clients: %d\n" - "Local server channels: %d\n" - "Local server operators: %d\n" - "Local router operators: %d\n" - "Local cell clients: %d\n" - "Local cell channels: %d\n" - "Local cell servers: %d\n" - "Total clients: %d\n" - "Total channels: %d\n" - "Total servers: %d\n" - "Total routers: %d\n" - "Total server operators: %d\n" - "Total router operators: %d\n"), - silc_get_time(starttime), - purple_str_seconds_to_string((int)uptime), - (int)my_clients, (int)my_channels, (int)my_server_ops, (int)my_router_ops, - (int)cell_clients, (int)cell_channels, (int)cell_servers, - (int)clients, (int)channels, (int)servers, (int)routers, - (int)server_ops, (int)router_ops); - - purple_notify_info(gc, NULL, - _("Network Statistics"), msg); - g_free(msg); - } - break; - - case SILC_COMMAND_PING: - { - if (!success) { - purple_notify_error(gc, _("Ping"), _("Ping failed"), - silc_get_status_message(status)); - return; - } - - purple_notify_info(gc, _("Ping"), _("Ping reply received from server"), - NULL); - } - break; - - case SILC_COMMAND_KILL: - if (!success) { - purple_notify_error(gc, _("Kill User"), - _("Could not kill user"), - silc_get_status_message(status)); - return; - } - break; - - case SILC_COMMAND_CMODE: - { - SilcChannelEntry channel_entry; - SilcBuffer channel_pubkeys; - - if (!success) - return; - - channel_entry = va_arg(vp, SilcChannelEntry); - (void)va_arg(vp, SilcUInt32); - (void)va_arg(vp, SilcPublicKey); - channel_pubkeys = va_arg(vp, SilcBuffer); - - if (sg->chpk) - silcpurple_chat_chauth_show(sg, channel_entry, channel_pubkeys); - } - break; - - default: - if (success) - purple_debug_info("silc", "Unhandled command: %d (succeeded)\n", command); - else - purple_debug_info("silc", "Unhandled command: %d (failed: %s)\n", command, - silc_get_status_message(status)); - break; - } - - va_end(vp); -} - - -/* Called to indicate that connection was either successfully established - or connecting failed. This is also the first time application receives - the SilcClientConnection object which it should save somewhere. - If the `success' is FALSE the application must always call the function - silc_client_close_connection. */ - -static void -silc_connected(SilcClient client, SilcClientConnection conn, - SilcClientConnectionStatus status) -{ - PurpleConnection *gc = client->application; - SilcPurple sg; - - if (gc == NULL) { - silc_client_close_connection(client, conn); - return; - } - sg = gc->proto_data; - - switch (status) { - case SILC_CLIENT_CONN_SUCCESS: - case SILC_CLIENT_CONN_SUCCESS_RESUME: - purple_connection_set_state(gc, PURPLE_CONNECTED); - - /* Send the server our buddy list */ - silcpurple_send_buddylist(gc); - - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - /* Send any UMODEs configured for account */ - if (purple_account_get_bool(sg->account, "block-ims", FALSE)) { - silc_client_command_call(sg->client, sg->conn, NULL, - "UMODE", "+P", NULL); - } - - return; - break; - case SILC_CLIENT_CONN_ERROR: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error during connecting to SILC Server")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, - _("Key Exchange failed")); - break; - - case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Authentication failed")); - break; - - case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Resuming detached session failed. " - "Press Reconnect to create new connection.")); - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - break; - - case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection timed out")); - break; - } - - /* Error */ - sg->conn = NULL; - silc_client_close_connection(client, conn); -} - - -/* Called to indicate that connection was disconnected to the server. - The `status' may tell the reason of the disconnection, and if the - `message' is non-NULL it may include the disconnection message - received from server. */ - -static void -silc_disconnected(SilcClient client, SilcClientConnection conn, - SilcStatus status, const char *message) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (sg->resuming && !sg->detaching) - g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); - - sg->conn = NULL; - - /* Close the connection */ - if (!sg->detaching) - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Disconnected by server")); - else - /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ - purple_account_disconnect(purple_connection_get_account(gc)); -} - - -typedef struct { - SilcGetAuthMeth completion; - void *context; -} *SilcPurpleGetAuthMethod; - -/* Callback called when we've received the authentication method information - from the server after we've requested it. */ - -static void silc_get_auth_method_callback(SilcClient client, - SilcClientConnection conn, - SilcAuthMethod auth_meth, - void *context) -{ - SilcPurpleGetAuthMethod internal = context; - - switch (auth_meth) { - case SILC_AUTH_NONE: - /* No authentication required. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - - case SILC_AUTH_PASSWORD: - /* By returning NULL here the library will ask the passphrase from us - by calling the silc_ask_passphrase. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - - case SILC_AUTH_PUBLIC_KEY: - /* Do not get the authentication data now, the library will generate - it using our default key, if we do not provide it here. */ - (*internal->completion)(TRUE, auth_meth, NULL, 0, internal->context); - break; - } - - silc_free(internal); -} - -/* Find authentication method and authentication data by hostname and - port. The hostname may be IP address as well. When the authentication - method has been resolved the `completion' callback with the found - authentication method and authentication data is called. The `conn' - may be NULL. */ - -static void -silc_get_auth_method(SilcClient client, SilcClientConnection conn, - char *hostname, SilcUInt16 port, - SilcGetAuthMeth completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleGetAuthMethod internal; - const char *password; - - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 4, 5); - else - purple_connection_update_progress(gc, _("Authenticating connection"), 4, 5); - - /* Check configuration if we have this connection configured. If we - have then return that data immediately, as it's faster way. */ - if (purple_account_get_bool(sg->account, "pubkey-auth", FALSE)) { - completion(TRUE, SILC_AUTH_PUBLIC_KEY, NULL, 0, context); - return; - } - password = purple_connection_get_password(gc); - if (password && *password) { - completion(TRUE, SILC_AUTH_PASSWORD, (unsigned char *)password, strlen(password), context); - return; - } - - /* Resolve the authentication method from server, as we may not know it. */ - internal = silc_calloc(1, sizeof(*internal)); - if (!internal) - return; - internal->completion = completion; - internal->context = context; - silc_client_request_authentication_method(client, conn, - silc_get_auth_method_callback, - internal); -} - - -/* Verifies received public key. The `conn_type' indicates which entity - (server, client etc.) has sent the public key. If user decides to trust - the application may save the key as trusted public key for later - use. The `completion' must be called after the public key has been - verified. */ - -static void -silc_verify_public_key(SilcClient client, SilcClientConnection conn, - SilcSocketType conn_type, unsigned char *pk, - SilcUInt32 pk_len, SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - - if (!sg->conn && (conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER)) { - /* Progress */ - if (sg->resuming) - purple_connection_update_progress(gc, _("Resuming session"), 3, 5); - else - purple_connection_update_progress(gc, _("Verifying server public key"), - 3, 5); - } - - /* Verify public key */ - silcpurple_verify_public_key(client, conn, NULL, conn_type, pk, - pk_len, pk_type, completion, context); -} - -typedef struct { - SilcAskPassphrase completion; - void *context; -} *SilcPurpleAskPassphrase; - -static void -silc_ask_passphrase_cb(SilcPurpleAskPassphrase internal, const char *passphrase) -{ - if (!passphrase || !(*passphrase)) - internal->completion(NULL, 0, internal->context); - else - internal->completion((unsigned char *)passphrase, - strlen(passphrase), internal->context); - silc_free(internal); -} - -/* Ask (interact, that is) a passphrase from user. The passphrase is - returned to the library by calling the `completion' callback with - the `context'. The returned passphrase SHOULD be in UTF-8 encoded, - if not then the library will attempt to encode. */ - -static void -silc_ask_passphrase(SilcClient client, SilcClientConnection conn, - SilcAskPassphrase completion, void *context) -{ - PurpleConnection *gc = client->application; - SilcPurpleAskPassphrase internal = silc_calloc(1, sizeof(*internal)); - - if (!internal) - return; - internal->completion = completion; - internal->context = context; - purple_request_input(gc, _("Passphrase"), NULL, - _("Passphrase required"), NULL, FALSE, TRUE, NULL, - _("OK"), G_CALLBACK(silc_ask_passphrase_cb), - _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb), - purple_connection_get_account(gc), NULL, NULL, internal); -} - - -/* Notifies application that failure packet was received. This is called - if there is some protocol active in the client. The `protocol' is the - protocol context. The `failure' is opaque pointer to the failure - indication. Note, that the `failure' is protocol dependant and - application must explicitly cast it to correct type. Usually `failure' - is 32 bit failure type (see protocol specs for all protocol failure - types). */ - -static void -silc_failure(SilcClient client, SilcClientConnection conn, - SilcProtocol protocol, void *failure) -{ - PurpleConnection *gc = client->application; - char buf[128]; - - memset(buf, 0, sizeof(buf)); - - if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_KEY_EXCHANGE) { - SilcSKEStatus status = (SilcSKEStatus)SILC_PTR_TO_32(failure); - - if (status == SILC_SKE_STATUS_BAD_VERSION) - g_snprintf(buf, sizeof(buf), - _("Failure: Version mismatch, upgrade your client")); - if (status == SILC_SKE_STATUS_UNSUPPORTED_PUBLIC_KEY) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not trust/support your public key")); - if (status == SILC_SKE_STATUS_UNKNOWN_GROUP) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed KE group")); - if (status == SILC_SKE_STATUS_UNKNOWN_CIPHER) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed cipher")); - if (status == SILC_SKE_STATUS_UNKNOWN_PKCS) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed PKCS")); - if (status == SILC_SKE_STATUS_UNKNOWN_HASH_FUNCTION) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed hash function")); - if (status == SILC_SKE_STATUS_UNKNOWN_HMAC) - g_snprintf(buf, sizeof(buf), - _("Failure: Remote does not support proposed HMAC")); - if (status == SILC_SKE_STATUS_INCORRECT_SIGNATURE) - g_snprintf(buf, sizeof(buf), _("Failure: Incorrect signature")); - if (status == SILC_SKE_STATUS_INVALID_COOKIE) - g_snprintf(buf, sizeof(buf), _("Failure: Invalid cookie")); - - /* Show the error on the progress bar. A more generic error message - is going to be showed to user after this in the silc_connected. */ - purple_connection_update_progress(gc, buf, 2, 5); - } - - if (protocol->protocol->type == SILC_PROTOCOL_CLIENT_CONNECTION_AUTH) { - SilcUInt32 err = SILC_PTR_TO_32(failure); - - if (err == SILC_AUTH_FAILED) - g_snprintf(buf, sizeof(buf), _("Failure: Authentication failed")); - - /* Show the error on the progress bar. A more generic error message - is going to be showed to user after this in the silc_connected. */ - purple_connection_update_progress(gc, buf, 4, 5); - } -} - -/* Asks whether the user would like to perform the key agreement protocol. - This is called after we have received an key agreement packet or an - reply to our key agreement packet. This returns TRUE if the user wants - the library to perform the key agreement protocol and FALSE if it is not - desired (application may start it later by calling the function - silc_client_perform_key_agreement). If TRUE is returned also the - `completion' and `context' arguments must be set by the application. */ - -static bool -silc_key_agreement(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, const char *hostname, - SilcUInt16 port, SilcKeyAgreementCallback *completion, - void **context) -{ - silcpurple_buddy_keyagr_request(client, conn, client_entry, hostname, port); - *completion = NULL; - *context = NULL; - return FALSE; -} - - -/* Notifies application that file transfer protocol session is being - requested by the remote client indicated by the `client_entry' from - the `hostname' and `port'. The `session_id' is the file transfer - session and it can be used to either accept or reject the file - transfer request, by calling the silc_client_file_receive or - silc_client_file_close, respectively. */ - -static void -silc_ftp(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port) -{ - silcpurple_ftp_request(client, conn, client_entry, session_id, - hostname, port); -} - - -/* Delivers SILC session detachment data indicated by `detach_data' to the - application. If application has issued SILC_COMMAND_DETACH command - the client session in the SILC network is not quit. The client remains - in the network but is detached. The detachment data may be used later - to resume the session in the SILC Network. The appliation is - responsible of saving the `detach_data', to for example in a file. - - The detachment data can be given as argument to the functions - silc_client_connect_to_server, or silc_client_add_connection when - creating connection to remote server, inside SilcClientConnectionParams - structure. If it is provided the client library will attempt to resume - the session in the network. After the connection is created - successfully, the application is responsible of setting the user - interface for user into the same state it was before detaching (showing - same channels, channel modes, etc). It can do this by fetching the - information (like joined channels) from the client library. */ - -static void -silc_detach(SilcClient client, SilcClientConnection conn, - const unsigned char *detach_data, SilcUInt32 detach_data_len) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - const char *file; - - /* Save the detachment data to file. */ - file = silcpurple_session_file(purple_account_get_username(sg->account)); - g_unlink(file); - silc_file_writefile(file, (char *)detach_data, detach_data_len); -} - -SilcClientOperations ops = { - silc_say, - silc_channel_message, - silc_private_message, - silc_notify, - silc_command, - silc_command_reply, - silc_connected, - silc_disconnected, - silc_get_auth_method, - silc_verify_public_key, - silc_ask_passphrase, - silc_failure, - silc_key_agreement, - silc_ftp, - silc_detach -}; diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/pk.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/pk.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/pk.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/pk.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,274 +0,0 @@ -/* - - silcpurple_pk.c - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" - -/************************* Public Key Verification ***************************/ - -typedef struct { - SilcClient client; - SilcClientConnection conn; - char *filename; - char *entity; - char *entity_name; - char *fingerprint; - char *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len; - SilcSKEPKType pk_type; - SilcVerifyPublicKey completion; - void *context; - gboolean changed; -} *PublicKeyVerify; - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify); - -static void silcpurple_verify_cb(PublicKeyVerify verify, gint id) -{ - if (id != 2) { - if (verify->completion) - verify->completion(FALSE, verify->context); - } else { - if (verify->completion) - verify->completion(TRUE, verify->context); - - /* Save the key for future checking */ - silc_pkcs_save_public_key_data(verify->filename, verify->pk, - verify->pk_len, SILC_PKCS_FILE_PEM); - } - - silc_free(verify->filename); - silc_free(verify->entity); - silc_free(verify->entity_name); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_free(verify->pk); - silc_free(verify); -} - -static void silcpurple_verify_details_cb(PublicKeyVerify verify) -{ - /* What a hack. We have to display the accept dialog _again_ - because Purple closes the dialog after you press the button. Purple - should have option for the dialogs whether the buttons close them - or not. */ - silcpurple_verify_ask(verify->entity, verify->fingerprint, - verify->babbleprint, verify); -} - -static void silcpurple_verify_details(PublicKeyVerify verify, gint id) -{ - SilcPublicKey public_key; - PurpleConnection *gc = verify->client->application; - SilcPurple sg = gc->proto_data; - - silc_pkcs_public_key_decode(verify->pk, verify->pk_len, - &public_key); - silcpurple_show_public_key(sg, verify->entity_name, public_key, - G_CALLBACK(silcpurple_verify_details_cb), - verify); - silc_pkcs_public_key_free(public_key); -} - -static void silcpurple_verify_ask(const char *entity, - const char *fingerprint, - const char *babbleprint, - PublicKeyVerify verify) -{ - PurpleConnection *gc = verify->client->application; - char tmp[256], tmp2[256]; - - if (verify->changed) { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Your local copy does not match this " - "key. Would you still like to accept this public key?"), - entity); - } else { - g_snprintf(tmp, sizeof(tmp), - _("Received %s's public key. Would you like to accept this " - "public key?"), entity); - } - g_snprintf(tmp2, sizeof(tmp2), - _("Fingerprint and babbleprint for the %s key are:\n\n" - "%s\n%s\n"), entity, fingerprint, babbleprint); - - purple_request_action(gc, _("Verify Public Key"), tmp, tmp2, - PURPLE_DEFAULT_ACTION_NONE, - purple_connection_get_account(gc), entity, NULL, verify, 3, - _("Yes"), G_CALLBACK(silcpurple_verify_cb), - _("No"), G_CALLBACK(silcpurple_verify_cb), - _("_View..."), G_CALLBACK(silcpurple_verify_details)); -} - -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcSocketType conn_type, - unsigned char *pk, SilcUInt32 pk_len, - SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context) -{ - PurpleConnection *gc = client->application; - int i; - char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; - char *fingerprint, *babbleprint; - struct passwd *pw; - struct stat st; - char *entity = ((conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER) ? - "server" : "client"); - PublicKeyVerify verify; - - if (pk_type != SILC_SKE_PK_TYPE_SILC) { - purple_notify_error(gc, _("Verify Public Key"), - _("Unsupported public key type"), NULL); - if (completion) - completion(FALSE, context); - return; - } - - pw = getpwuid(getuid()); - if (!pw) { - if (completion) - completion(FALSE, context); - return; - } - - memset(filename, 0, sizeof(filename)); - memset(filename2, 0, sizeof(filename2)); - memset(file, 0, sizeof(file)); - - if (conn_type == SILC_SOCKET_TYPE_SERVER || - conn_type == SILC_SOCKET_TYPE_ROUTER) { - if (!name) { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - conn->sock->ip, conn->sock->port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - conn->sock->hostname, conn->sock->port); - g_snprintf(filename2, sizeof(filename2) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - hostf = filename2; - } else { - g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, - name, conn->sock->port); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - - ipf = filename; - } - } else { - /* Replace all whitespaces with `_'. */ - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - for (i = 0; i < strlen(fingerprint); i++) - if (fingerprint[i] == ' ') - fingerprint[i] = '_'; - - g_snprintf(file, sizeof(file) - 1, "%skey_%s.pub", entity, fingerprint); - g_snprintf(filename, sizeof(filename) - 1, - "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", - silcpurple_silcdir(), entity, file); - silc_free(fingerprint); - - ipf = filename; - } - - verify = silc_calloc(1, sizeof(*verify)); - if (!verify) - return; - verify->client = client; - verify->conn = conn; - verify->filename = strdup(ipf); - verify->entity = strdup(entity); - verify->entity_name = (conn_type != SILC_SOCKET_TYPE_CLIENT ? - (name ? strdup(name) : strdup(conn->sock->hostname)) - : NULL); - verify->pk = silc_memdup(pk, pk_len); - verify->pk_len = pk_len; - verify->pk_type = pk_type; - verify->completion = completion; - verify->context = context; - fingerprint = verify->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = verify->babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - /* Check whether this key already exists */ - if (g_stat(ipf, &st) < 0 && (!hostf || g_stat(hostf, &st) < 0)) { - /* Key does not exist, ask user to verify the key and save it */ - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } else { - /* The key already exists, verify it. */ - SilcPublicKey public_key; - unsigned char *encpk; - SilcUInt32 encpk_len; - - /* Load the key file, try for both IP filename and hostname filename */ - if (!silc_pkcs_load_public_key(ipf, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(ipf, &public_key, - SILC_PKCS_FILE_BIN) && - (!hostf || (!silc_pkcs_load_public_key(hostf, &public_key, - SILC_PKCS_FILE_PEM) && - !silc_pkcs_load_public_key(hostf, &public_key, - SILC_PKCS_FILE_BIN)))) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Encode the key data */ - encpk = silc_pkcs_public_key_encode(public_key, &encpk_len); - if (!encpk) { - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Compare the keys */ - if (memcmp(encpk, pk, encpk_len)) { - /* Ask user to verify the key and save it */ - verify->changed = TRUE; - silcpurple_verify_ask(name ? name : entity, - fingerprint, babbleprint, verify); - return; - } - - /* Local copy matched */ - if (completion) - completion(TRUE, context); - silc_free(verify->filename); - silc_free(verify->entity); - silc_free(verify->entity_name); - silc_free(verify->pk); - silc_free(verify->fingerprint); - silc_free(verify->babbleprint); - silc_free(verify); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/README qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/README --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/README 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -SILC Purple Plugin -================== - -This is the Purple protocol plugin of the protocol called Secure Internet -Live Conferencing (SILC). The implementation will use the SILC Toolkit, -freely available from the http://silcnet.org/ site, for the actual SILC -protocol implementation. - -To include SILC into Purple, one needs to first compile and install -the SILC Toolkit. It is done as follows: - - ./configure --enable-shared - make - make install - -This will compile shared libraries of the SILC Toolkit. If the --prefix -is not given to ./configure, the binaries are installed into the -/usr/local/silc directory. - -Once the Toolkit is installed one needs to tell Purple's ./configure -script where the SILC Toolkit is located. It is done as simply as: - - ./configure - -if pkg-config is installed in your system. If it is isn't it's done as: - - ./configure --with-silc-libs=/path/to/silc/lib - --with-silc-includes=/path/to/silc/include - -If the SILC Toolkit cannot be found then the SILC protocol plugin will -not be compiled. diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silc.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silc.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silc.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1960 +0,0 @@ -/* - - silcpurple.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "version.h" -#include "wb.h" -#include "core.h" - -extern SilcClientOperations ops; -static PurplePlugin *silc_plugin = NULL; - -static const char * -silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return (const char *)"silc"; -} - -static GList * -silcpurple_away_states(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE); - types = g_list_append(types, type); - type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static void -silcpurple_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc = purple_account_get_connection(account); - SilcPurple sg = NULL; - SilcUInt32 mode; - SilcBuffer idp; - unsigned char mb[4]; - const char *state; - - if (gc != NULL) - sg = gc->proto_data; - - if (status == NULL) - return; - - state = purple_status_get_id(status); - - if (state == NULL) - return; - - if ((sg == NULL) || (sg->conn == NULL)) - return; - - mode = sg->conn->local_entry->mode; - mode &= ~(SILC_UMODE_GONE | - SILC_UMODE_HYPER | - SILC_UMODE_BUSY | - SILC_UMODE_INDISPOSED | - SILC_UMODE_PAGE); - - if (!strcmp(state, "hyper")) - mode |= SILC_UMODE_HYPER; - else if (!strcmp(state, "away")) - mode |= SILC_UMODE_GONE; - else if (!strcmp(state, "busy")) - mode |= SILC_UMODE_BUSY; - else if (!strcmp(state, "indisposed")) - mode |= SILC_UMODE_INDISPOSED; - else if (!strcmp(state, "page")) - mode |= SILC_UMODE_PAGE; - - /* Send UMODE */ - idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT); - SILC_PUT32_MSB(mode, mb); - silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE, - ++sg->conn->cmd_ident, 2, - 1, idp->data, idp->len, - 2, mb, sizeof(mb)); - silc_buffer_free(idp); -} - - -/*************************** Connection Routines *****************************/ - -static void -silcpurple_keepalive(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - silc_client_send_packet(sg->client, sg->conn, SILC_PACKET_HEARTBEAT, - NULL, 0); -} - -static gboolean -silcpurple_scheduler(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - silc_client_run_one(sg->client); - return TRUE; -} - -static void -silcpurple_nickname_parse(const char *nickname, - char **ret_nickname) -{ - silc_parse_userfqdn(nickname, ret_nickname, NULL); -} - -static void -silcpurple_login_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - SilcPurple sg; - SilcClient client; - SilcClientConnection conn; - PurpleAccount *account; - SilcClientConnectionParams params; - SilcUInt32 mask; - const char *dfile, *tmp; -#ifdef SILC_ATTRIBUTE_USER_ICON - PurpleStoredImage *img; -#endif -#ifdef HAVE_SYS_UTSNAME_H - struct utsname u; -#endif - - - g_return_if_fail(gc != NULL); - - sg = gc->proto_data; - - if (source < 0) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Connection failed")); - return; - } - - client = sg->client; - account = sg->account; - - /* Get session detachment data, if available */ - memset(¶ms, 0, sizeof(params)); - dfile = silcpurple_session_file(purple_account_get_username(sg->account)); - params.detach_data = (unsigned char *)silc_file_readfile(dfile, ¶ms.detach_data_len); - if (params.detach_data) - params.detach_data[params.detach_data_len] = 0; - - /* Add connection to SILC client library */ - conn = silc_client_add_connection( - sg->client, ¶ms, - (char *)purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), sg); - if (!conn) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to initialize SILC Client connection")); - gc->proto_data = NULL; - return; - } - sg->conn = conn; - - /* Progress */ - if (params.detach_data) { - purple_connection_update_progress(gc, _("Resuming session"), 2, 5); - sg->resuming = TRUE; - } else { - purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5); - } - - /* Perform SILC Key Exchange. The "silc_connected" will be called - eventually. */ - silc_client_start_key_exchange(sg->client, sg->conn, source); - - /* Set default attributes */ - mask = SILC_ATTRIBUTE_MOOD_NORMAL; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - mask = SILC_ATTRIBUTE_CONTACT_CHAT; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); -#ifdef HAVE_SYS_UTSNAME_H - if (!uname(&u)) { - SilcAttributeObjDevice dev; - memset(&dev, 0, sizeof(dev)); - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } -#endif -#ifdef _WIN32 - tmp = _tzname[0]; -#else - tmp = tzname[0]; -#endif - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)tmp, strlen(tmp)); - -#ifdef SILC_ATTRIBUTE_USER_ICON - /* Set our buddy icon */ - img = purple_buddy_icons_find_account_icon(account); - silcpurple_buddy_set_icon(gc, img); - purple_imgstore_unref(img); -#endif - - silc_free(params.detach_data); -} - -static void -silcpurple_login(PurpleAccount *account) -{ - SilcPurple sg; - SilcClient client; - SilcClientParams params; - PurpleConnection *gc; - char pkd[256], prd[256]; - const char *cipher, *hmac; - char *realname; - int i; - - gc = account->gc; - if (!gc) - return; - gc->proto_data = NULL; - - memset(¶ms, 0, sizeof(params)); - strcat(params.nickname_format, "%n@%h%a"); - params.nickname_parse = silcpurple_nickname_parse; - params.ignore_requested_attributes = FALSE; - - /* Allocate SILC client */ - client = silc_client_alloc(&ops, ¶ms, gc, NULL); - if (!client) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Out of memory")); - return; - } - - /* Get username, real name and local hostname for SILC library */ - if (purple_account_get_username(account)) { - const char *u = purple_account_get_username(account); - char **up = g_strsplit(u, "@", 2); - client->username = strdup(up[0]); - g_strfreev(up); - } else { - client->username = silc_get_username(); - purple_account_set_username(account, client->username); - } - realname = silc_get_real_name(); - if (purple_account_get_user_info(account)) { - client->realname = strdup(purple_account_get_user_info(account)); - free(realname); - } else if ((silc_get_real_name() != NULL) && (*realname != '\0')) { - client->realname = realname; - purple_account_set_user_info(account, client->realname); - } else { - free(realname); - client->realname = strdup(_("John Noname")); - } - client->hostname = silc_net_localhost(); - - purple_connection_set_display_name(gc, client->username); - - /* Register requested cipher and HMAC */ - cipher = purple_account_get_string(account, "cipher", SILC_DEFAULT_CIPHER); - for (i = 0; silc_default_ciphers[i].name; i++) - if (!strcmp(silc_default_ciphers[i].name, cipher)) { - silc_cipher_register(&(silc_default_ciphers[i])); - break; - } - hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC); - for (i = 0; silc_default_hmacs[i].name; i++) - if (!strcmp(silc_default_hmacs[i].name, hmac)) { - silc_hmac_register(&(silc_default_hmacs[i])); - break; - } - - /* Init SILC client */ - if (!silc_client_init(client)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unable to initialize SILC protocol")); - return; - } - - /* Check the ~/.silc dir and create it, and new key pair if necessary. */ - if (!silcpurple_check_silc_dir(gc)) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Error loading SILC key pair")); - return; - } - - /* Progress */ - purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5); - - /* Load SILC key pair */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd), - (char *)purple_account_get_string(account, "private-key", prd), - (gc->password == NULL) ? "" : gc->password, &client->pkcs, - &client->public_key, &client->private_key)) { - g_snprintf(pkd, sizeof(pkd), _("Unable to load SILC key pair: %s"), g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, - pkd); - return; - } - - sg = silc_calloc(1, sizeof(*sg)); - if (!sg) - return; - memset(sg, 0, sizeof(*sg)); - sg->client = client; - sg->gc = gc; - sg->account = account; - gc->proto_data = sg; - - /* Connect to the SILC server */ - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", - "silc.silcnet.org"), - purple_account_get_int(account, "port", 706), - silcpurple_login_connected, gc) == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create connection")); - return; - } - - /* Schedule SILC using Glib's event loop */ - sg->scheduler = purple_timeout_add(300, (GSourceFunc)silcpurple_scheduler, sg); -} - -static int -silcpurple_close_final(gpointer *context) -{ - SilcPurple sg = (SilcPurple)context; - silc_client_stop(sg->client); - silc_client_free(sg->client); -#ifdef HAVE_SILCMIME_H - if (sg->mimeass) - silc_mime_assembler_free(sg->mimeass); -#endif - silc_free(sg); - return 0; -} - -static void -silcpurple_close(PurpleConnection *gc) -{ - SilcPurple sg = gc->proto_data; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - g_return_if_fail(sg != NULL); - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - /* Send QUIT */ - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", quit_msg, NULL); - g_free(quit_msg); - - if (sg->conn) - silc_client_close_connection(sg->client, sg->conn); - - purple_timeout_remove(sg->scheduler); - purple_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg); -} - - -/****************************** Protocol Actions *****************************/ - -static void -silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestField *f; - char *tmp; - SilcUInt32 tmp_len, mask; - SilcAttributeObjService service; - SilcAttributeObjDevice dev; - SilcVCardStruct vcard; - const char *val; - - sg = gc->proto_data; - if (!sg) - return; - - memset(&service, 0, sizeof(service)); - memset(&dev, 0, sizeof(dev)); - memset(&vcard, 0, sizeof(vcard)); - - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_USER_INFO, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_SERVICE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_STATUS_MESSAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_TIMEZONE, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_GEOLOCATION, NULL); - silc_client_attribute_del(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, NULL); - - /* Set mood */ - mask = 0; - f = purple_request_fields_get_field(fields, "mood_normal"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_NORMAL; - f = purple_request_fields_get_field(fields, "mood_happy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_HAPPY; - f = purple_request_fields_get_field(fields, "mood_sad"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SAD; - f = purple_request_fields_get_field(fields, "mood_angry"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANGRY; - f = purple_request_fields_get_field(fields, "mood_jealous"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_JEALOUS; - f = purple_request_fields_get_field(fields, "mood_ashamed"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ASHAMED; - f = purple_request_fields_get_field(fields, "mood_invincible"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE; - f = purple_request_fields_get_field(fields, "mood_inlove"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_INLOVE; - f = purple_request_fields_get_field(fields, "mood_sleepy"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_SLEEPY; - f = purple_request_fields_get_field(fields, "mood_bored"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_BORED; - f = purple_request_fields_get_field(fields, "mood_excited"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_EXCITED; - f = purple_request_fields_get_field(fields, "mood_anxious"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_MOOD, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set preferred contact */ - mask = 0; - f = purple_request_fields_get_field(fields, "contact_chat"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CHAT; - f = purple_request_fields_get_field(fields, "contact_email"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_EMAIL; - f = purple_request_fields_get_field(fields, "contact_call"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_CALL; - f = purple_request_fields_get_field(fields, "contact_sms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_SMS; - f = purple_request_fields_get_field(fields, "contact_mms"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_MMS; - f = purple_request_fields_get_field(fields, "contact_video"); - if (f && purple_request_field_bool_get_value(f)) - mask |= SILC_ATTRIBUTE_CONTACT_VIDEO; - if (mask) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_PREFERRED_CONTACT, - SILC_32_TO_PTR(mask), - sizeof(SilcUInt32)); - - /* Set status text */ - val = NULL; - f = purple_request_fields_get_field(fields, "status_text"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_STATUS_FREETEXT, - (void *)val, strlen(val)); - - /* Set vcard */ - val = NULL; - f = purple_request_fields_get_field(fields, "vcard"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) { - purple_account_set_string(sg->account, "vcard", val); - tmp = silc_file_readfile(val, &tmp_len); - if (tmp) { - tmp[tmp_len] = 0; - if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard)) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_USER_INFO, - (void *)&vcard, - sizeof(vcard)); - } - silc_vcard_free(&vcard); - silc_free(tmp); - } else { - purple_account_set_string(sg->account, "vcard", ""); - } - -#ifdef HAVE_SYS_UTSNAME_H - /* Set device info */ - f = purple_request_fields_get_field(fields, "device"); - if (f && purple_request_field_bool_get_value(f)) { - struct utsname u; - if (!uname(&u)) { - dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER; - dev.version = u.release; - dev.model = u.sysname; - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_DEVICE_INFO, - (void *)&dev, sizeof(dev)); - } - } -#endif - - /* Set timezone */ - val = NULL; - f = purple_request_fields_get_field(fields, "timezone"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - silc_client_attribute_add(client, conn, - SILC_ATTRIBUTE_TIMEZONE, - (void *)val, strlen(val)); -} - -static void -silcpurple_attrs(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - SilcHashTable attrs; - SilcAttributePayload attr; - gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE, - mangry = FALSE, mjealous = FALSE, mashamed = FALSE, - minvincible = FALSE, minlove = FALSE, msleepy = FALSE, - mbored = FALSE, mexcited = FALSE, manxious = FALSE; - gboolean cemail = FALSE, ccall = FALSE, csms = FALSE, - cmms = FALSE, cchat = TRUE, cvideo = FALSE; - gboolean device = TRUE; - char status[1024]; - - sg = gc->proto_data; - if (!sg) - return; - - memset(status, 0, sizeof(status)); - - attrs = silc_client_attributes_get(client, conn); - if (attrs) { - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD), - NULL, (void *)&attr)) { - SilcUInt32 mood = 0; - silc_attribute_get_object(attr, &mood, sizeof(mood)); - mnormal = !mood; - mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY); - msad = (mood & SILC_ATTRIBUTE_MOOD_SAD); - mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY); - mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS); - mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED); - minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE); - minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE); - msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY); - mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED); - mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED); - manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT), - NULL, (void *)&attr)) { - SilcUInt32 contact = 0; - silc_attribute_get_object(attr, &contact, sizeof(contact)); - cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL); - ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL); - csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS); - cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS); - cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT); - cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO); - } - - if (silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT), - NULL, (void *)&attr)) - silc_attribute_get_object(attr, &status, sizeof(status)); - - if (!silc_hash_table_find(attrs, - SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO), - NULL, (void *)&attr)) - device = FALSE; - } - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_label_new("l3", _("Your Current Mood")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sad", _("Sad"), msad); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious); - purple_request_field_group_add_field(g, f); - - f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_email", _("Email"), cemail); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_call", _("Phone"), ccall); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_sms", _("SMS"), csms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("status_text", _("Your Current Status"), - status[0] ? status : NULL, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); -#if 0 - f = purple_request_field_label_new("l2", _("Online Services")); - purple_request_field_group_add_field(g, f); - f = purple_request_field_bool_new("services", - _("Let others see what services you are using"), - TRUE); - purple_request_field_group_add_field(g, f); -#endif -#ifdef HAVE_SYS_UTSNAME_H - f = purple_request_field_bool_new("device", - _("Let others see what computer you are using"), - device); - purple_request_field_group_add_field(g, f); -#endif - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("vcard", _("Your VCard File"), - purple_account_get_string(sg->account, "vcard", ""), - FALSE); - purple_request_field_group_add_field(g, f); -#ifdef _WIN32 - f = purple_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); -#else - f = purple_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); -#endif - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("User Online Status Attributes"), - _("User Online Status Attributes"), - _("You can let other users see your online status information " - "and your personal information. Please fill the information " - "you would like other users to see about yourself."), - fields, - _("OK"), G_CALLBACK(silcpurple_attrs_cb), - _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel), - gc->account, NULL, NULL, gc); -} - -static void -silcpurple_detach(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - /* Call DETACH */ - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; -} - -static void -silcpurple_view_motd(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg; - char *tmp; - - if (!gc) - return; - sg = gc->proto_data; - if (!sg) - return; - - if (!sg->motd) { - purple_notify_error( - gc, _("Message of the Day"), _("No Message of the Day available"), - _("There is no Message of the Day associated with this connection")); - return; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); -} - -static void -silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields) -{ - /* Nothing */ -} - -static void -silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - SilcPurple sg = gc->proto_data; - PurpleRequestField *f; - const char *val, *pkfile = NULL, *prfile = NULL; - const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; - const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; - char *identifier; - int keylen = SILCPURPLE_DEF_PKCS_LEN; - SilcPublicKey public_key; - - sg = gc->proto_data; - if (!sg) - return; - - val = NULL; - f = purple_request_fields_get_field(fields, "pass1"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass1 = val; - else - pass1 = ""; - val = NULL; - f = purple_request_fields_get_field(fields, "pass2"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - pass2 = val; - else - pass2 = ""; - - if (strcmp(pass1, pass2)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); - return; - } - - val = NULL; - f = purple_request_fields_get_field(fields, "key"); - if (f) - val = purple_request_field_string_get_value(f); - if (val && *val) - keylen = atoi(val); - f = purple_request_fields_get_field(fields, "pkfile"); - if (f) - pkfile = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "prfile"); - if (f) - prfile = purple_request_field_string_get_value(f); - - f = purple_request_fields_get_field(fields, "un"); - if (f) - un = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "hn"); - if (f) - hn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "rn"); - if (f) - rn = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "e"); - if (f) - e = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "o"); - if (f) - o = purple_request_field_string_get_value(f); - f = purple_request_fields_get_field(fields, "c"); - if (f) - c = purple_request_field_string_get_value(f); - - identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn, - (char *)rn, (char *)e, (char *)o, (char *)c); - - /* Create the key pair */ - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile, - identifier, pass1, NULL, &public_key, NULL, - FALSE)) { - purple_notify_error( - gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); - return; - } - - silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL); - - silc_pkcs_public_key_free(public_key); - silc_free(identifier); -} - -static void -silcpurple_create_keypair(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - SilcPurple sg = gc->proto_data; - PurpleRequestFields *fields; - PurpleRequestFieldGroup *g; - PurpleRequestField *f; - const char *username, *realname; - char *hostname, **u; - char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; - - username = purple_account_get_username(sg->account); - u = g_strsplit(username, "@", 2); - username = u[0]; - realname = purple_account_get_user_info(sg->account); - hostname = silc_net_localhost(); - g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); - - g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir()); - g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir()); - g_snprintf(pkd, sizeof(pkd) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd2)); - g_snprintf(prd, sizeof(prd) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd2)); - - fields = purple_request_fields_new(); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("e", _("Email"), tmp, FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("o", _("Organization"), "", FALSE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("c", _("Country"), "", FALSE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - g = purple_request_field_group_new(NULL); - f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE); - purple_request_field_string_set_masked(f, TRUE); - purple_request_field_group_add_field(g, f); - purple_request_fields_add_group(fields, g); - - purple_request_fields(gc, _("Create New SILC Key Pair"), - _("Create New SILC Key Pair"), NULL, fields, - _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb), - _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel), - gc->account, NULL, NULL, gc); - - g_strfreev(u); - silc_free(hostname); -} - -static void -silcpurple_change_pass(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_password(purple_connection_get_account(gc)); -} - -static void -silcpurple_change_passwd(PurpleConnection *gc, const char *old, const char *new) -{ - char prd[256]; - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir()); - silc_change_private_key_passphrase(purple_account_get_string(gc->account, - "private-key", - prd), old ? old : "", new ? new : ""); -} - -static void -silcpurple_show_set_info(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_account_request_change_user_info(purple_connection_get_account(gc)); -} - -static void -silcpurple_set_info(PurpleConnection *gc, const char *text) -{ -} - -static GList * -silcpurple_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Online Status"), - silcpurple_attrs); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Detach From Server"), - silcpurple_detach); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("View Message of the Day"), - silcpurple_view_motd); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Create SILC Key Pair..."), - silcpurple_create_keypair); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Change Password..."), - silcpurple_change_pass); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Set User Info..."), - silcpurple_show_set_info); - list = g_list_append(list, act); - - return list; -} - - -/******************************* IM Routines *********************************/ - -typedef struct { - char *nick; - char *message; - SilcUInt32 message_len; - SilcMessageFlags flags; - PurpleMessageFlags gflags; -} *SilcPurpleIM; - -static void -silcpurple_send_im_resolved(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context) -{ - PurpleConnection *gc = client->application; - SilcPurple sg = gc->proto_data; - SilcPurpleIM im = context; - PurpleConversation *convo; - char tmp[256], *nickname = NULL; - SilcClientEntry client_entry; -#ifdef HAVE_SILCMIME_H - SilcDList list; -#endif - - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->nick, - sg->account); - if (!convo) - return; - - if (!clients) - goto err; - - if (clients_count > 1) { - silc_parse_userfqdn(im->nick, &nickname, NULL); - - /* Find the correct one. The im->nick might be a formatted nick - so this will find the correct one. */ - clients = silc_client_get_clients_local(client, conn, - nickname, im->nick, - &clients_count); - if (!clients) - goto err; - client_entry = clients[0]; - silc_free(clients); - } else { - client_entry = clients[0]; - } - -#ifdef HAVE_SILCMIME_H - /* Check for images */ - if (im->gflags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(im->message, (SilcUInt32 *)&im->flags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - silc_client_send_private_message(client, conn, - client_entry, im->flags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - } - } -#endif - - /* Send the message */ - silc_client_send_private_message(client, conn, client_entry, im->flags, - (unsigned char *)im->message, im->message_len, TRUE); - purple_conv_im_write(PURPLE_CONV_IM(convo), conn->local_entry->nickname, - im->message, 0, time(NULL)); - goto out; - - err: - g_snprintf(tmp, sizeof(tmp), - _("User %s is not present in the network"), im->nick); - purple_conversation_write(convo, NULL, tmp, PURPLE_MESSAGE_SYSTEM, time(NULL)); - - out: - g_free(im->nick); - g_free(im->message); - silc_free(im); - silc_free(nickname); -} - -static int -silcpurple_send_im(PurpleConnection *gc, const char *who, const char *message, - PurpleMessageFlags flags) -{ - SilcPurple sg = gc->proto_data; - SilcClient client = sg->client; - SilcClientConnection conn = sg->conn; - SilcClientEntry *clients; - SilcUInt32 clients_count, mflags; - char *nickname, *msg, *tmp; - int ret = 0; - gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE); -#ifdef HAVE_SILCMIME_H - SilcDList list; -#endif - - if (!who || !message) - return 0; - - mflags = SILC_MESSAGE_FLAG_UTF8; - - tmp = msg = purple_unescape_html(message); - - if (!g_ascii_strncasecmp(msg, "/me ", 4)) { - msg += 4; - if (!*msg) { - g_free(tmp); - return 0; - } - mflags |= SILC_MESSAGE_FLAG_ACTION; - } else if (strlen(msg) > 1 && msg[0] == '/') { - if (!silc_client_command_call(client, conn, msg + 1)) - purple_notify_error(gc, _("Call Command"), _("Cannot call command"), - _("Unknown command")); - g_free(tmp); - return 0; - } - - - if (!silc_parse_userfqdn(who, &nickname, NULL)) { - g_free(tmp); - return 0; - } - - if (sign) - mflags |= SILC_MESSAGE_FLAG_SIGNED; - - /* Find client entry */ - clients = silc_client_get_clients_local(client, conn, nickname, who, - &clients_count); - if (!clients) { - /* Resolve unknown user */ - SilcPurpleIM im = silc_calloc(1, sizeof(*im)); - if (!im) { - g_free(tmp); - return 0; - } - im->nick = g_strdup(who); - im->message = g_strdup(message); - im->message_len = strlen(im->message); - im->flags = mflags; - im->gflags = flags; - silc_client_get_clients(client, conn, nickname, NULL, - silcpurple_send_im_resolved, im); - silc_free(nickname); - g_free(tmp); - return 0; - } - -#ifdef HAVE_SILCMIME_H - /* Check for images */ - if (flags & PURPLE_MESSAGE_IMAGES) { - list = silcpurple_image_message(message, &mflags); - if (list) { - /* Send one or more MIME message. If more than one, they - are MIME fragments due to over large message */ - SilcBuffer buf; - - silc_dlist_start(list); - while ((buf = silc_dlist_get(list)) != SILC_LIST_END) - ret = - silc_client_send_private_message(client, conn, - clients[0], mflags, - buf->data, buf->len, - TRUE); - silc_mime_partial_free(list); - g_free(tmp); - silc_free(nickname); - silc_free(clients); - return ret; - } - } -#endif - - /* Send private message directly */ - ret = silc_client_send_private_message(client, conn, clients[0], - mflags, - (unsigned char *)msg, - strlen(msg), TRUE); - - g_free(tmp); - silc_free(nickname); - silc_free(clients); - return ret; -} - - -static GList *silcpurple_blist_node_menu(PurpleBlistNode *node) { - /* split this single menu building function back into the two - original: one for buddies and one for chats */ - - if(PURPLE_BLIST_NODE_IS_CHAT(node)) { - return silcpurple_chat_menu((PurpleChat *) node); - } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return silcpurple_buddy_menu((PurpleBuddy *) node); - } else { - g_return_val_if_reached(NULL); - } -} - -/********************************* Commands **********************************/ - -static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - PurpleConversation *convo = conv; - int id = 0; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - if(args && args[0]) - convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], - gc->account); - - if (convo != NULL) - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)); - - if (id == 0) - return PURPLE_CMD_RET_FAILED; - - silcpurple_chat_leave(gc, id); - - return PURPLE_CMD_RET_OK; - -} - -static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - int id = 0; - char *buf, *tmp, *tmp2; - const char *topic; - - gc = purple_conversation_get_gc(conv); - id = purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)); - - if (gc == NULL || id == 0) - return PURPLE_CMD_RET_FAILED; - - if (!args || !args[0]) { - topic = purple_conv_chat_get_topic (PURPLE_CONV_CHAT(conv)); - if (topic) { - tmp = g_markup_escape_text(topic, -1); - tmp2 = purple_markup_linkify(tmp); - buf = g_strdup_printf(_("current topic is: %s"), tmp2); - g_free(tmp); - g_free(tmp2); - } else - buf = g_strdup(_("No topic is set")); - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), gc->account->username, buf, - PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(buf); - - } - - if (args && args[0] && (strlen(args[0]) > 255)) { - *error = g_strdup(_("Topic too long")); - return PURPLE_CMD_RET_FAILED; - } - - silcpurple_chat_set_topic(gc, id, args ? args[0] : NULL); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - GHashTable *comp; - - if(!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - - g_hash_table_replace(comp, "channel", args[0]); - if(args[1]) - g_hash_table_replace(comp, "passphrase", args[1]); - - silcpurple_chat_join(purple_conversation_get_gc(conv), comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - gc = purple_conversation_get_gc(conv); - purple_roomlist_show_with_account(purple_connection_get_account(gc)); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - silcpurple_get_info(gc, args[0]); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret; - PurpleConnection *gc; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - int ret = 1; - PurpleConversation *convo; - PurpleConnection *gc; - PurpleAccount *account; - - if (!args || !args[0]) { - *error = g_strdup(_("You must specify a nick")); - return PURPLE_CMD_RET_FAILED; - } - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - account = purple_connection_get_account(gc); - - convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, args[0]); - - if (args[1]) { - ret = silcpurple_send_im(gc, args[0], args[1], PURPLE_MESSAGE_SEND); - purple_conv_im_write(PURPLE_CONV_IM(convo), purple_connection_get_display_name(gc), - args[1], PURPLE_MESSAGE_SEND, time(NULL)); - } - - if (ret) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *tmp; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!sg->motd) { - *error = g_strdup(_("There is no Message of the Day associated with this connection")); - return PURPLE_CMD_RET_FAILED; - } - - tmp = g_markup_escape_text(sg->motd, -1); - purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL, - tmp, NULL, NULL); - g_free(tmp); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silc_client_command_call(sg->client, sg->conn, "DETACH"); - sg->detaching = TRUE; - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - SilcChannelEntry channel; - char *silccmd, *silcargs, *msg, tmp[256]; - const char *chname; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL || !args || gc->proto_data == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (args[0]) - chname = args[0]; - else - chname = purple_conversation_get_name(conv); - - if (!args[1]) { - channel = silc_client_get_channel(sg->client, sg->conn, - (char *)chname); - if (!channel) { - *error = g_strdup_printf(_("channel %s not found"), chname); - return PURPLE_CMD_RET_FAILED; - } - if (channel->mode) { - silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp)); - msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp); - } else { - msg = g_strdup_printf(_("no channel modes are set on %s"), chname); - } - purple_conv_chat_write(PURPLE_CONV_CHAT(conv), "", - msg, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NO_LOG, time(NULL)); - g_free(msg); - return PURPLE_CMD_RET_OK; - } - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - char *silccmd, *silcargs; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - silcargs = g_strjoinv(" ", args); - silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL); - g_free(silcargs); - if (!silc_client_command_call(sg->client, sg->conn, silccmd)) { - g_free(silccmd); - *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd); - return PURPLE_CMD_RET_FAILED; - } - g_free(silccmd); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - GHashTable *ui_info; - const char *ui_name = NULL, *ui_website = NULL; - char *quit_msg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - ui_info = purple_core_get_ui_info(); - - if(ui_info) { - ui_name = g_hash_table_lookup(ui_info, "name"); - ui_website = g_hash_table_lookup(ui_info, "website"); - } - - if(!ui_name || !ui_website) { - ui_name = "Pidgin"; - ui_website = PURPLE_WEBSITE; - } - quit_msg = g_strdup_printf(_("Download %s: %s"), - ui_name, ui_website); - - silc_client_command_call(sg->client, sg->conn, NULL, - "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL); - g_free(quit_msg); - - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_conversation_get_gc(conv); - - if (gc == NULL) - return PURPLE_CMD_RET_FAILED; - - sg = gc->proto_data; - - if (sg == NULL) - return PURPLE_CMD_RET_FAILED; - - if (!silc_client_command_call(sg->client, sg->conn, args[0])) { - *error = g_strdup_printf(_("Unknown command: %s"), args[0]); - return PURPLE_CMD_RET_FAILED; - } - - return PURPLE_CMD_RET_OK; -} - - -/************************** Plugin Initialization ****************************/ - -static void -silcpurple_register_commands(void) -{ - purple_cmd_register("part", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL); - purple_cmd_register("leave", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL); - purple_cmd_register("topic", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_topic, _("topic [<new topic>]: View or change the topic"), NULL); - purple_cmd_register("join", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, - "prpl-silc", silcpurple_cmd_chat_join, - _("join <channel> [<password>]: Join a chat on this network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", - silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL); - purple_cmd_register("whois", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", - silcpurple_cmd_whois, _("whois <nick>: View nick's information"), NULL); - purple_cmd_register("msg", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_msg, - _("msg <nick> <message>: Send a private message to a user"), NULL); - purple_cmd_register("query", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query, - _("query <nick> [<message>]: Send a private message to a user"), NULL); - purple_cmd_register("motd", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd, - _("motd: View the server's Message Of The Day"), NULL); - purple_cmd_register("detach", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_detach, - _("detach: Detach this session"), NULL); - purple_cmd_register("quit", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit, - _("quit [message]: Disconnect from the server, with an optional message"), NULL); - purple_cmd_register("call", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_call, - _("call <command>: Call any silc client command"), NULL); - /* These below just get passed through for the silc client library to deal - * with */ - purple_cmd_register("kill", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kill <nick> [-pubkey|<reason>]: Kill nick"), NULL); - purple_cmd_register("nick", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("nick <newnick>: Change your nickname"), NULL); - purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("whowas <nick>: View nick's information"), NULL); - purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode, - _("cmode <channel> [+|-<modes>] [arguments]: Change or display channel modes"), NULL); - purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("cumode <channel> +|-<modes> <nick>: Change nick's modes on channel"), NULL); - purple_cmd_register("umode", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("umode <usermodes>: Set your modes in the network"), NULL); - purple_cmd_register("oper", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("oper <nick> [-pubkey]: Get server operator privileges"), NULL); - purple_cmd_register("invite", "ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("invite <channel> [-|+]<nick>: invite nick or add/remove from channel invite list"), NULL); - purple_cmd_register("kick", "wws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("kick <channel> <nick> [comment]: Kick client from channel"), NULL); - purple_cmd_register("info", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("info [server]: View server administrative details"), NULL); - purple_cmd_register("ban", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic, - _("ban [<channel> +|-<nick>]: Ban client from channel"), NULL); - purple_cmd_register("getkey", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("getkey <nick|server>: Retrieve client's or server's public key"), NULL); - purple_cmd_register("stats", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("stats: View server and network statistics"), NULL); - purple_cmd_register("ping", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_generic, - _("ping: Send PING to the connected server"), NULL); -#if 0 /* Purple doesn't handle these yet */ - purple_cmd_register("users", "w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-silc", silcpurple_cmd_users, - _("users <channel>: List users in channel")); - purple_cmd_register("names", "ww", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY | - PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_names, - _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); -#endif -} - -static PurpleWhiteboardPrplOps silcpurple_wb_ops = -{ - silcpurple_wb_start, - silcpurple_wb_end, - silcpurple_wb_get_dimensions, - silcpurple_wb_set_dimensions, - silcpurple_wb_get_brush, - silcpurple_wb_set_brush, - silcpurple_wb_send, - silcpurple_wb_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ -#ifdef HAVE_SILCMIME_H - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | OPT_PROTO_IM_IMAGE | - OPT_PROTO_SLASH_COMMANDS_NATIVE, -#else - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | - OPT_PROTO_PASSWORD_OPTIONAL | - OPT_PROTO_SLASH_COMMANDS_NATIVE, -#endif - NULL, /* user_splits */ - NULL, /* protocol_options */ -#ifdef SILC_ATTRIBUTE_USER_ICON - {"jpeg,gif,png,bmp", 0, 0, 96, 96, 0, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ -#else - NO_BUDDY_ICONS, -#endif - silcpurple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - silcpurple_status_text, /* status_text */ - silcpurple_tooltip_text, /* tooltip_text */ - silcpurple_away_states, /* away_states */ - silcpurple_blist_node_menu, /* blist_node_menu */ - silcpurple_chat_info, /* chat_info */ - silcpurple_chat_info_defaults,/* chat_info_defaults */ - silcpurple_login, /* login */ - silcpurple_close, /* close */ - silcpurple_send_im, /* send_im */ - silcpurple_set_info, /* set_info */ - NULL, /* send_typing */ - silcpurple_get_info, /* get_info */ - silcpurple_set_status, /* set_status */ - silcpurple_idle_set, /* set_idle */ - silcpurple_change_passwd, /* change_passwd */ - silcpurple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - silcpurple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - silcpurple_chat_join, /* join_chat */ - NULL, /* reject_chat */ - silcpurple_get_chat_name, /* get_chat_name */ - silcpurple_chat_invite, /* chat_invite */ - silcpurple_chat_leave, /* chat_leave */ - NULL, /* chat_whisper */ - silcpurple_chat_send, /* chat_send */ - silcpurple_keepalive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ -#ifdef SILC_ATTRIBUTE_USER_ICON - silcpurple_buddy_set_icon, /* set_buddy_icon */ -#else - NULL, -#endif - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - silcpurple_chat_set_topic, /* set_chat_topic */ - NULL, /* find_blist_chat */ - silcpurple_roomlist_get_list, /* roomlist_get_list */ - silcpurple_roomlist_cancel, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - silcpurple_ftp_send_file, /* send_file */ - silcpurple_ftp_new_xfer, /* new_xfer */ - NULL, /* offline_message */ - &silcpurple_wb_ops, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-silc", /**< id */ - "SILC", /**< name */ - "1.0", /**< version */ - /** summary */ - N_("SILC Protocol Plugin"), - /** description */ - N_("Secure Internet Live Conferencing (SILC) Protocol"), - "Pekka Riikonen", /**< author */ - "http://silcnet.org/", /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, /**< prefs_info */ - silcpurple_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - PurpleAccountUserSplit *split; - char tmp[256]; - int i; - PurpleKeyValuePair *kvp; - GList *list = NULL; - - silc_plugin = plugin; - - split = purple_account_user_split_new(_("Network"), "silcnet.org", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - /* Account options */ - option = purple_account_option_string_new(_("Connect server"), - "server", - "silc.silcnet.org"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_int_new(_("Port"), "port", 706); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Public Key file"), - "public-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - option = purple_account_option_string_new(_("Private Key file"), - "private-key", tmp); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - for (i = 0; silc_default_ciphers[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_ciphers[i].name); - kvp->value = g_strdup(silc_default_ciphers[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("Cipher"), "cipher", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - list = NULL; - for (i = 0; silc_default_hmacs[i].name; i++) { - kvp = g_new0(PurpleKeyValuePair, 1); - kvp->key = g_strdup(silc_default_hmacs[i].name); - kvp->value = g_strdup(silc_default_hmacs[i].name); - list = g_list_append(list, kvp); - } - option = purple_account_option_list_new(_("HMAC"), "hmac", list); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Public key authentication"), - "pubkey-auth", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), - "block-ims", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Block messages to whiteboard"), - "block-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Automatically open whiteboard"), - "open-wb", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), - "sign-verify", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - purple_prefs_remove("/plugins/prpl/silc"); - - silcpurple_register_commands(); - -#ifdef _WIN32 - silc_net_win32_init(); -#endif -} - -PURPLE_INIT_PLUGIN(silc10, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silcpurple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silcpurple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silcpurple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/silcpurple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2004 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_H -#define SILCPURPLE_H - -/* Purple includes */ -#include "internal.h" -#include "account.h" -#include "accountopt.h" -#include "cmds.h" -#include "conversation.h" -#include "debug.h" -#include "ft.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "roomlist.h" -#include "server.h" -#include "util.h" - -/* Default public and private key file names */ -#define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" -#define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" - -/* Default settings for creating key pair */ -#define SILCPURPLE_DEF_PKCS "rsa" -#define SILCPURPLE_DEF_PKCS_LEN 2048 - -#define SILCPURPLE_PRVGRP 0x001fffff - -/* Status IDs */ -#define SILCPURPLE_STATUS_ID_OFFLINE "offline" -#define SILCPURPLE_STATUS_ID_AVAILABLE "available" -#define SILCPURPLE_STATUS_ID_HYPER "hyper" -#define SILCPURPLE_STATUS_ID_AWAY "away" -#define SILCPURPLE_STATUS_ID_BUSY "busy" -#define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" -#define SILCPURPLE_STATUS_ID_PAGE "page" - -typedef struct { - unsigned long id; - const char *channel; - unsigned long chid; - const char *parentch; - SilcChannelPrivateKey key; -} *SilcPurplePrvgrp; - -/* The SILC Purple plugin context */ -typedef struct SilcPurpleStruct { - SilcClient client; - SilcClientConnection conn; - - guint scheduler; - PurpleConnection *gc; - PurpleAccount *account; - unsigned long channel_ids; - GList *grps; - - char *motd; - PurpleRoomlist *roomlist; -#ifdef HAVE_SILCMIME_H - SilcMimeAssembler mimeass; -#endif - unsigned int detaching : 1; - unsigned int resuming : 1; - unsigned int roomlist_canceled : 1; - unsigned int chpk : 1; -} *SilcPurple; - - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc); -void silcpurple_chat_join_done(SilcClient client, - SilcClientConnection conn, - SilcClientEntry *clients, - SilcUInt32 clients_count, - void *context); -const char *silcpurple_silcdir(void); -const char *silcpurple_session_file(const char *account); -void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, - const char *name, SilcSocketType conn_type, - unsigned char *pk, SilcUInt32 pk_len, - SilcSKEPKType pk_type, - SilcVerifyPublicKey completion, void *context); -GList *silcpurple_buddy_menu(PurpleBuddy *buddy); -void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_send_buddylist(PurpleConnection *gc); -void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void silcpurple_buddy_keyagr_request(SilcClient client, - SilcClientConnection conn, - SilcClientEntry client_entry, - const char *hostname, SilcUInt16 port); -void silcpurple_idle_set(PurpleConnection *gc, int idle); -void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -char *silcpurple_status_text(PurpleBuddy *b); -gboolean silcpurple_ip_is_private(const char *ip); -void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); -PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); -void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, - SilcClientEntry client_entry, SilcUInt32 session_id, - const char *hostname, SilcUInt16 port); -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context); -void silcpurple_get_info(PurpleConnection *gc, const char *who); -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size); -GList *silcpurple_chat_info(PurpleConnection *gc); -GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); -GList *silcpurple_chat_menu(PurpleChat *); -void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); -char *silcpurple_get_chat_name(GHashTable *data); -void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, - const char *name); -void silcpurple_chat_leave(PurpleConnection *gc, int id); -int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); -void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); -PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); -void silcpurple_roomlist_cancel(PurpleRoomlist *list); -void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, - SilcBuffer channel_pubkeys); -void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr); -#ifdef SILC_ATTRIBUTE_USER_ICON -void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); -#endif -#ifdef HAVE_SILCMIME_H -char *silcpurple_file2mime(const char *filename); -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); -#endif - -#ifdef _WIN32 -typedef int uid_t; - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - int pw_uid; /* user id */ - int pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct passwd *getpwuid(int uid); -int getuid(void); -int geteuid(void); -#endif - -#endif /* SILCPURPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/TODO qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/TODO --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/TODO 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -Features TODO (maybe) -===================== - -Preferences - - Add joined channels to buddy list automatically (during - session) - - Add joined channels to buddy list automatically permanently - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,776 +0,0 @@ -/* - - silcpurple_util.c - - Author: Pekka Riikonen - - Copyright (C) 2004 - 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "imgstore.h" - -/**************************** Utility Routines *******************************/ - -static char str[256], str2[256]; - -const char *silcpurple_silcdir(void) -{ - const char *hd = purple_home_dir(); - memset(str, 0, sizeof(str)); - g_snprintf(str, sizeof(str) - 1, "%s" G_DIR_SEPARATOR_S ".silc", hd ? hd : "/tmp"); - return (const char *)str; -} - -const char *silcpurple_session_file(const char *account) -{ - memset(str2, 0, sizeof(str2)); - g_snprintf(str2, sizeof(str2) - 1, "%s" G_DIR_SEPARATOR_S "%s_session", - silcpurple_silcdir(), account); - return (const char *)str2; -} - -gboolean silcpurple_ip_is_private(const char *ip) -{ - if (silc_net_is_ip4(ip)) { - if (!strncmp(ip, "10.", 3)) { - return TRUE; - } else if (!strncmp(ip, "172.", 4) && strlen(ip) > 6) { - char tmp[3]; - int s; - memset(tmp, 0, sizeof(tmp)); - strncpy(tmp, ip + 4, 2); - s = atoi(tmp); - if (s >= 16 && s <= 31) - return TRUE; - } else if (!strncmp(ip, "192.168.", 8)) { - return TRUE; - } - } - - return FALSE; -} - -/* This checks stats for various SILC files and directories. First it - checks if ~/.silc directory exist and is owned by the correct user. If - it doesn't exist, it will create the directory. After that it checks if - user's Public and Private key files exists and creates them if needed. */ - -gboolean silcpurple_check_silc_dir(PurpleConnection *gc) -{ - char filename[256], file_public_key[256], file_private_key[256]; - char servfilename[256], clientfilename[256], friendsfilename[256]; - char pkd[256], prd[256]; - struct stat st; - struct passwd *pw; - int fd; - - pw = getpwuid(getuid()); - if (!pw) { - purple_debug_error("silc", "silc: %s\n", g_strerror(errno)); - return FALSE; - } - - g_snprintf(filename, sizeof(filename) - 1, "%s", silcpurple_silcdir()); - g_snprintf(servfilename, sizeof(servfilename) - 1, "%s" G_DIR_SEPARATOR_S "serverkeys", - silcpurple_silcdir()); - g_snprintf(clientfilename, sizeof(clientfilename) - 1, "%s" G_DIR_SEPARATOR_S "clientkeys", - silcpurple_silcdir()); - g_snprintf(friendsfilename, sizeof(friendsfilename) - 1, "%s" G_DIR_SEPARATOR_S "friends", - silcpurple_silcdir()); - - /* - * Check ~/.silc directory - */ - if ((g_stat(filename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(filename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - filename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", filename, g_strerror(errno)); - return FALSE; - } - } else { -#ifndef _WIN32 - /* Check the owner of the dir */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own '%s' directory\n", - filename); - return FALSE; - } -#endif - } - - /* - * Check ~./silc/serverkeys directory - */ - if ((g_stat(servfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(servfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - servfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - servfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/clientkeys directory - */ - if ((g_stat(clientfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(clientfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - clientfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - clientfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check ~./silc/friends directory - */ - if ((g_stat(friendsfilename, &st)) == -1) { - /* If dir doesn't exist */ - if (errno == ENOENT) { - if (pw->pw_uid == geteuid()) { - if ((g_mkdir(friendsfilename, 0755)) == -1) { - purple_debug_error("silc", "Couldn't create '%s' directory\n", friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't create '%s' directory due to a wrong uid!\n", - friendsfilename); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' directory, error: %s\n", - friendsfilename, g_strerror(errno)); - return FALSE; - } - } - - /* - * Check Public and Private keys - */ - g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir()); - g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir()); - g_snprintf(file_public_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "public-key", pkd)); - g_snprintf(file_private_key, sizeof(file_public_key) - 1, "%s", - purple_account_get_string(gc->account, "private-key", prd)); - - if ((g_stat(file_public_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, file_private_key, NULL, - (gc->password == NULL) ? "" : gc->password, - NULL, NULL, NULL, FALSE)) { - purple_debug_error("silc", "Couldn't create key pair\n"); - return FALSE; - } - - if ((g_stat(file_public_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' public key, error: %s\n", - file_public_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the public key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your public key!?\n"); - return FALSE; - } -#endif - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } else if ((g_stat(file_private_key, &st)) == -1) { - /* If file doesn't exist */ - if (errno == ENOENT) { - purple_connection_update_progress(gc, _("Creating SILC key pair..."), 1, 5); - if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, - SILCPURPLE_DEF_PKCS_LEN, - file_public_key, file_private_key, NULL, - (gc->password == NULL) ? "" : gc->password, - NULL, NULL, NULL, FALSE)) { - purple_debug_error("silc", "Couldn't create key pair\n"); - return FALSE; - } - - if ((fd = g_open(file_private_key, O_RDONLY, 0)) != -1) { - if ((fstat(fd, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - close(fd); - return FALSE; - } - } - /* This shouldn't really happen because silc_create_key_pair() - * will set the permissions */ - else if ((g_stat(file_private_key, &st)) == -1) { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } else { - purple_debug_error("silc", "Couldn't stat '%s' private key, error: %s\n", - file_private_key, g_strerror(errno)); - return FALSE; - } - } - -#ifndef _WIN32 - /* Check the owner of the private key */ - if (st.st_uid != 0 && st.st_uid != pw->pw_uid) { - purple_debug_error("silc", "You don't seem to own your private key!?\n"); - if (fd != -1) - close(fd); - return FALSE; - } - - /* Check the permissions for the private key */ - if ((st.st_mode & 0777) != 0600) { - purple_debug_warning("silc", "Wrong permissions in your private key file `%s'!\n" - "Trying to change them ...\n", file_private_key); - if ((fd == -1) || (fchmod(fd, S_IRUSR | S_IWUSR)) == -1) { - purple_debug_error("silc", - "Failed to change permissions for private key file!\n" - "Permissions for your private key file must be 0600.\n"); - if (fd != -1) - close(fd); - return FALSE; - } - purple_debug_warning("silc", "Done.\n\n"); - } -#endif - - if (fd != -1) - close(fd); - - return TRUE; -} - -#ifdef _WIN32 -struct passwd *getpwuid(uid_t uid) { - struct passwd *pwd = calloc(1, sizeof(struct passwd)); - return pwd; -} - -uid_t getuid() { - return 0; -} - -uid_t geteuid() { - return 0; -} -#endif - -void silcpurple_show_public_key(SilcPurple sg, - const char *name, SilcPublicKey public_key, - GCallback callback, void *context) -{ - SilcPublicKeyIdentifier ident; - SilcPKCS pkcs; - char *fingerprint, *babbleprint; - unsigned char *pk; - SilcUInt32 pk_len, key_len = 0; - GString *s; - char *buf; - - ident = silc_pkcs_decode_identifier(public_key->identifier); - if (!ident) - return; - - pk = silc_pkcs_public_key_encode(public_key, &pk_len); - fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); - babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); - - if (silc_pkcs_alloc((unsigned char *)public_key->name, &pkcs)) { - key_len = silc_pkcs_public_key_set(pkcs, public_key); - silc_pkcs_free(pkcs); - } - - s = g_string_new(""); - if (ident->realname) - /* Hint for translators: Please check the tabulator width here and in - the next strings (short strings: 2 tabs, longer strings 1 tab, - sum: 3 tabs or 24 characters) */ - g_string_append_printf(s, _("Real Name: \t%s\n"), ident->realname); - if (ident->username) - g_string_append_printf(s, _("User Name: \t%s\n"), ident->username); - if (ident->email) - g_string_append_printf(s, _("Email: \t\t%s\n"), ident->email); - if (ident->host) - g_string_append_printf(s, _("Host Name: \t%s\n"), ident->host); - if (ident->org) - g_string_append_printf(s, _("Organization: \t%s\n"), ident->org); - if (ident->country) - g_string_append_printf(s, _("Country: \t%s\n"), ident->country); - g_string_append_printf(s, _("Algorithm: \t%s\n"), public_key->name); - g_string_append_printf(s, _("Key Length: \t%d bits\n"), (int)key_len); - g_string_append_printf(s, "\n"); - g_string_append_printf(s, _("Public Key Fingerprint:\n%s\n\n"), fingerprint); - g_string_append_printf(s, _("Public Key Babbleprint:\n%s"), babbleprint); - - buf = g_string_free(s, FALSE); - - purple_request_action(sg->gc, _("Public Key Information"), - _("Public Key Information"), - buf, 0, purple_connection_get_account(sg->gc), - NULL, NULL, context, 1, _("Close"), callback); - - g_free(buf); - silc_free(fingerprint); - silc_free(babbleprint); - silc_free(pk); - silc_pkcs_free_identifier(ident); -} - -SilcAttributePayload -silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute) -{ - SilcAttributePayload attr = NULL; - - if (!attrs) - return NULL; - - silc_dlist_start(attrs); - while ((attr = silc_dlist_get(attrs)) != SILC_LIST_END) - if (attribute == silc_attribute_get_attribute(attr)) - break; - - return attr; -} - -void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if ((mode & SILC_UMODE_SERVER_OPERATOR) || - (mode & SILC_UMODE_ROUTER_OPERATOR)) { - strcat(buf, (mode & SILC_UMODE_SERVER_OPERATOR) ? - "[server operator] " : - (mode & SILC_UMODE_ROUTER_OPERATOR) ? - "[SILC operator] " : "[unknown mode] "); - } - if (mode & SILC_UMODE_GONE) - strcat(buf, "[away] "); - if (mode & SILC_UMODE_INDISPOSED) - strcat(buf, "[indisposed] "); - if (mode & SILC_UMODE_BUSY) - strcat(buf, "[busy] "); - if (mode & SILC_UMODE_PAGE) - strcat(buf, "[wake me up] "); - if (mode & SILC_UMODE_HYPER) - strcat(buf, "[hyperactive] "); - if (mode & SILC_UMODE_ROBOT) - strcat(buf, "[robot] "); - if (mode & SILC_UMODE_ANONYMOUS) - strcat(buf, "[anonymous] "); - if (mode & SILC_UMODE_BLOCK_PRIVMSG) - strcat(buf, "[blocks private messages] "); - if (mode & SILC_UMODE_DETACHED) - strcat(buf, "[detached] "); - if (mode & SILC_UMODE_REJECT_WATCHING) - strcat(buf, "[rejects watching] "); - if (mode & SILC_UMODE_BLOCK_INVITE) - strcat(buf, "[blocks invites] "); - g_strchomp(buf); -} - -void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) - strcat(buf, "[permanent] "); - if (mode & SILC_CHANNEL_MODE_PRIVATE) - strcat(buf, "[private] "); - if (mode & SILC_CHANNEL_MODE_SECRET) - strcat(buf, "[secret] "); - if (mode & SILC_CHANNEL_MODE_PRIVKEY) - strcat(buf, "[private key] "); - if (mode & SILC_CHANNEL_MODE_INVITE) - strcat(buf, "[invite only] "); - if (mode & SILC_CHANNEL_MODE_TOPIC) - strcat(buf, "[topic restricted] "); - if (mode & SILC_CHANNEL_MODE_ULIMIT) - strcat(buf, "[user count limit] "); - if (mode & SILC_CHANNEL_MODE_PASSPHRASE) - strcat(buf, "[passphrase auth] "); - if (mode & SILC_CHANNEL_MODE_CHANNEL_AUTH) - strcat(buf, "[public key auth] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_USERS) - strcat(buf, "[users silenced] "); - if (mode & SILC_CHANNEL_MODE_SILENCE_OPERS) - strcat(buf, "[operators silenced] "); - g_strchomp(buf); -} - -void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, - SilcUInt32 buf_size) -{ - memset(buf, 0, buf_size); - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strcat(buf, "[founder] "); - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strcat(buf, "[operator] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES) - strcat(buf, "[blocks messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_USERS) - strcat(buf, "[blocks user messages] "); - if (mode & SILC_CHANNEL_UMODE_BLOCK_MESSAGES_ROBOTS) - strcat(buf, "[blocks robot messages] "); - if (mode & SILC_CHANNEL_UMODE_QUIET) - strcat(buf, "[quieted] "); - g_strchomp(buf); -} - -void -silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, - char **contactstr, char **langstr, char **devicestr, - char **tzstr, char **geostr) -{ - SilcAttributePayload attr; - SilcAttributeMood mood = 0; - SilcAttributeContact contact; - SilcAttributeObjDevice device; - SilcAttributeObjGeo geo; - - char tmp[1024]; - GString *s; - - *moodstr = NULL; - *statusstr = NULL; - *contactstr = NULL; - *langstr = NULL; - *devicestr = NULL; - *tzstr = NULL; - *geostr = NULL; - - if (!attrs) - return; - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_MOOD); - if (attr && silc_attribute_get_object(attr, &mood, sizeof(mood))) { - if (mood & SILC_ATTRIBUTE_MOOD_HAPPY) - g_string_append_printf(s, "[%s] ", _("Happy")); - if (mood & SILC_ATTRIBUTE_MOOD_SAD) - g_string_append_printf(s, "[%s] ", _("Sad")); - if (mood & SILC_ATTRIBUTE_MOOD_ANGRY) - g_string_append_printf(s, "[%s] ", _("Angry")); - if (mood & SILC_ATTRIBUTE_MOOD_JEALOUS) - g_string_append_printf(s, "[%s] ", _("Jealous")); - if (mood & SILC_ATTRIBUTE_MOOD_ASHAMED) - g_string_append_printf(s, "[%s] ", _("Ashamed")); - if (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE) - g_string_append_printf(s, "[%s] ", _("Invincible")); - if (mood & SILC_ATTRIBUTE_MOOD_INLOVE) - g_string_append_printf(s, "[%s] ", _("In Love")); - if (mood & SILC_ATTRIBUTE_MOOD_SLEEPY) - g_string_append_printf(s, "[%s] ", _("Sleepy")); - if (mood & SILC_ATTRIBUTE_MOOD_BORED) - g_string_append_printf(s, "[%s] ", _("Bored")); - if (mood & SILC_ATTRIBUTE_MOOD_EXCITED) - g_string_append_printf(s, "[%s] ", _("Excited")); - if (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS) - g_string_append_printf(s, "[%s] ", _("Anxious")); - } - if (strlen(s->str)) { - *moodstr = s->str; - g_string_free(s, FALSE); - g_strchomp(*moodstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_STATUS_FREETEXT); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *statusstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_CONTACT); - if (attr && silc_attribute_get_object(attr, &contact, sizeof(contact))) { - if (contact & SILC_ATTRIBUTE_CONTACT_CHAT) - g_string_append_printf(s, "[%s] ", _("Chat")); - if (contact & SILC_ATTRIBUTE_CONTACT_EMAIL) - g_string_append_printf(s, "[%s] ", _("Email")); - if (contact & SILC_ATTRIBUTE_CONTACT_CALL) - g_string_append_printf(s, "[%s] ", _("Phone")); - if (contact & SILC_ATTRIBUTE_CONTACT_PAGE) - g_string_append_printf(s, "[%s] ", _("Paging")); - if (contact & SILC_ATTRIBUTE_CONTACT_SMS) - g_string_append_printf(s, "[%s] ", _("SMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_MMS) - g_string_append_printf(s, "[%s] ", _("MMS")); - if (contact & SILC_ATTRIBUTE_CONTACT_VIDEO) - g_string_append_printf(s, "[%s] ", _("Video Conferencing")); - } - if (strlen(s->str)) { - *contactstr = s->str; - g_string_free(s, FALSE); - g_strchomp(*contactstr); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_PREFERRED_LANGUAGE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *langstr = g_strdup(tmp); - - s = g_string_new(""); - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_DEVICE_INFO); - memset(&device, 0, sizeof(device)); - if (attr && silc_attribute_get_object(attr, &device, sizeof(device))) { - if (device.type == SILC_ATTRIBUTE_DEVICE_COMPUTER) - g_string_append_printf(s, "%s: ", _("Computer")); - if (device.type == SILC_ATTRIBUTE_DEVICE_MOBILE_PHONE) - g_string_append_printf(s, "%s: ", _("Mobile Phone")); - if (device.type == SILC_ATTRIBUTE_DEVICE_PDA) - g_string_append_printf(s, "%s: ", _("PDA")); - if (device.type == SILC_ATTRIBUTE_DEVICE_TERMINAL) - g_string_append_printf(s, "%s: ", _("Terminal")); - g_string_append_printf(s, "%s %s %s %s", - device.manufacturer ? device.manufacturer : "", - device.version ? device.version : "", - device.model ? device.model : "", - device.language ? device.language : ""); - } - if (strlen(s->str)) { - *devicestr = s->str; - g_string_free(s, FALSE); - } else - g_string_free(s, TRUE); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_TIMEZONE); - memset(tmp, 0, sizeof(tmp)); - if (attr && silc_attribute_get_object(attr, tmp, sizeof(tmp))) - *tzstr = g_strdup(tmp); - - attr = silcpurple_get_attr(attrs, SILC_ATTRIBUTE_GEOLOCATION); - memset(&geo, 0, sizeof(geo)); - if (attr && silc_attribute_get_object(attr, &geo, sizeof(geo))) - *geostr = g_strdup_printf("%s %s %s (%s)", - geo.longitude ? geo.longitude : "", - geo.latitude ? geo.latitude : "", - geo.altitude ? geo.altitude : "", - geo.accuracy ? geo.accuracy : ""); -} - -#ifdef HAVE_SILCMIME_H -/* Returns MIME type of filetype */ - -char *silcpurple_file2mime(const char *filename) -{ - const char *ct; - - ct = strrchr(filename, '.'); - if (!ct) - return NULL; - else if (!g_ascii_strcasecmp(".png", ct)) - return strdup("image/png"); - else if (!g_ascii_strcasecmp(".jpg", ct)) - return strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".jpeg", ct)) - return strdup("image/jpeg"); - else if (!g_ascii_strcasecmp(".gif", ct)) - return strdup("image/gif"); - else if (!g_ascii_strcasecmp(".tiff", ct)) - return strdup("image/tiff"); - - return NULL; -} - -/* Checks if message has images, and assembles MIME message if it has. - If only one image is present, creates simple MIME image message. If - there are multiple images and/or text with images multipart MIME - message is created. */ - -SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags) -{ - SilcMime mime = NULL, p; - SilcDList list, parts = NULL; - const char *start, *end, *last; - GData *attribs; - char *type; - gboolean images = FALSE; - - last = msg; - while (last && *last && purple_markup_find_tag("img", last, &start, - &end, &attribs)) { - PurpleStoredImage *image = NULL; - const char *id; - - /* Check if there is text before image */ - if (start - last) { - char *text, *tmp; - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - tmp = g_strndup(last, start - last); - text = purple_unescape_html(tmp); - g_free(tmp); - /* Add text */ - silc_mime_add_data(p, (unsigned char *)text, strlen(text)); - g_free(text); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - id = g_datalist_get_data(&attribs, "id"); - if (id && (image = purple_imgstore_find_by_id(atoi(id)))) { - unsigned long imglen = purple_imgstore_get_size(image); - gconstpointer img = purple_imgstore_get_data(image); - - p = silc_mime_alloc(); - - /* Add content type */ - type = silcpurple_file2mime(purple_imgstore_get_filename(image)); - if (!type) { - g_datalist_clear(&attribs); - last = end + 1; - continue; - } - silc_mime_add_field(p, "Content-Type", type); - silc_free(type); - - /* Add content transfer encoding */ - silc_mime_add_field(p, "Content-Transfer-Encoding", "binary"); - - /* Add image data */ - silc_mime_add_data(p, img, imglen); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - images = TRUE; - } - - g_datalist_clear(&attribs); - - /* Continue after tag */ - last = end + 1; - } - - /* Check for text after the image(s) */ - if (images && last && *last) { - char *tmp = purple_unescape_html(last); - p = silc_mime_alloc(); - - /* Add content type */ - silc_mime_add_field(p, "Content-Type", - "text/plain; charset=utf-8"); - - /* Add text */ - silc_mime_add_data(p, (unsigned char *)tmp, strlen(tmp)); - g_free(tmp); - - if (!parts) - parts = silc_dlist_init(); - silc_dlist_add(parts, p); - } - - /* If there weren't any images, don't return anything. */ - if (!images) { - if (parts) - silc_dlist_uninit(parts); - return NULL; - } - - if (silc_dlist_count(parts) > 1) { - /* Multipart MIME message */ - char b[32]; - mime = silc_mime_alloc(); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - g_snprintf(b, sizeof(b), "b%4X%4X", - (unsigned int)time(NULL), - silc_dlist_count(parts)); - silc_mime_set_multipart(mime, "mixed", b); - silc_dlist_start(parts); - while ((p = silc_dlist_get(parts)) != SILC_LIST_END) - silc_mime_add_multipart(mime, p); - } else { - /* Simple MIME message */ - silc_dlist_start(parts); - mime = silc_dlist_get(parts); - silc_mime_add_field(mime, "MIME-Version", "1.0"); - } - - *mflags &= ~SILC_MESSAGE_FLAG_UTF8; - *mflags |= SILC_MESSAGE_FLAG_DATA; - - /* Encode message. Fragment if it is too large */ - list = silc_mime_encode_partial(mime, 0xfc00); - - silc_dlist_uninit(parts); - - /* Added multiparts gets freed here */ - silc_mime_free(mime); - - return list; -} - -#endif /* HAVE_SILCMIME_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,520 +0,0 @@ -/* - - wb.c - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silcincludes.h" -#include "silcclient.h" -#include "silcpurple.h" -#include "wb.h" - -/* - SILC Whiteboard packet: - - 1 byte command - 2 bytes width - 2 bytes height - 4 bytes brush color - 2 bytes brush size - n bytes data - - Data: - - 4 bytes x - 4 bytes y - - Commands: - - 0x01 draw - 0x02 clear - - MIME: - - MIME-Version: 1.0 - Content-Type: application/x-wb - Content-Transfer-Encoding: binary - -*/ - -#define SILCPURPLE_WB_MIME "MIME-Version: 1.0\r\nContent-Type: application/x-wb\r\nContent-Transfer-Encoding: binary\r\n\r\n" -#define SILCPURPLE_WB_HEADER strlen(SILCPURPLE_WB_MIME) + 11 - -#define SILCPURPLE_WB_WIDTH 500 -#define SILCPURPLE_WB_HEIGHT 400 -#define SILCPURPLE_WB_WIDTH_MAX 1024 -#define SILCPURPLE_WB_HEIGHT_MAX 1024 - -/* Commands */ -typedef enum { - SILCPURPLE_WB_DRAW = 0x01, - SILCPURPLE_WB_CLEAR = 0x02 -} SilcPurpleWbCommand; - -/* Brush size */ -typedef enum { - SILCPURPLE_WB_BRUSH_SMALL = 2, - SILCPURPLE_WB_BRUSH_MEDIUM = 5, - SILCPURPLE_WB_BRUSH_LARGE = 10 -} SilcPurpleWbBrushSize; - -/* Brush color (XXX Purple should provide default colors) */ -typedef enum { - SILCPURPLE_WB_COLOR_BLACK = 0, - SILCPURPLE_WB_COLOR_RED = 13369344, - SILCPURPLE_WB_COLOR_GREEN = 52224, - SILCPURPLE_WB_COLOR_BLUE = 204, - SILCPURPLE_WB_COLOR_YELLOW = 15658496, - SILCPURPLE_WB_COLOR_ORANGE = 16737792, - SILCPURPLE_WB_COLOR_CYAN = 52428, - SILCPURPLE_WB_COLOR_VIOLET = 5381277, - SILCPURPLE_WB_COLOR_PURPLE = 13369548, - SILCPURPLE_WB_COLOR_TAN = 12093547, - SILCPURPLE_WB_COLOR_BROWN = 5256485, - SILCPURPLE_WB_COLOR_GREY = 11184810, - SILCPURPLE_WB_COLOR_WHITE = 16777215 -} SilcPurpleWbColor; - -typedef struct { - int type; /* 0 = buddy, 1 = channel */ - union { - SilcClientEntry client; - SilcChannelEntry channel; - } u; - int width; - int height; - int brush_size; - int brush_color; -} *SilcPurpleWb; - -/* Initialize whiteboard */ - -PurpleWhiteboard *silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry) -{ - SilcClientConnection conn; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - conn = sg->conn; - wb = purple_whiteboard_get_session(sg->account, client_entry->nickname); - if (!wb) - wb = purple_whiteboard_create(sg->account, client_entry->nickname, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 0; - wbs->u.client = client_entry; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -PurpleWhiteboard *silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel) -{ - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) - wb = purple_whiteboard_create(sg->account, channel->channel_name, 0); - if (!wb) - return NULL; - - if (!wb->proto_data) { - wbs = silc_calloc(1, sizeof(*wbs)); - if (!wbs) - return NULL; - wbs->type = 1; - wbs->u.channel = channel; - wbs->width = SILCPURPLE_WB_WIDTH; - wbs->height = SILCPURPLE_WB_HEIGHT; - wbs->brush_size = SILCPURPLE_WB_BRUSH_SMALL; - wbs->brush_color = SILCPURPLE_WB_COLOR_BLACK; - wb->proto_data = wbs; - - /* Start the whiteboard */ - purple_whiteboard_start(wb); - purple_whiteboard_clear(wb); - } - - return wb; -} - -static void -silcpurple_wb_parse(SilcPurpleWb wbs, PurpleWhiteboard *wb, - unsigned char *message, SilcUInt32 message_len) -{ - SilcUInt8 command; - SilcUInt16 width, height, brush_size; - SilcUInt32 brush_color, x, y, dx, dy; - SilcBufferStruct buf; - int ret; - - /* Parse the packet */ - silc_buffer_set(&buf, message, message_len); - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_CHAR(&command), - SILC_STR_UI_SHORT(&width), - SILC_STR_UI_SHORT(&height), - SILC_STR_UI_INT(&brush_color), - SILC_STR_UI_SHORT(&brush_size), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, ret); - - /* Update whiteboard if its dimensions changed */ - if (width != wbs->width || height != wbs->height) - silcpurple_wb_set_dimensions(wb, height, width); - - if (command == SILCPURPLE_WB_DRAW) { - /* Parse data and draw it */ - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - x = dx; - y = dy; - while (buf.len > 0) { - ret = silc_buffer_unformat(&buf, - SILC_STR_UI_INT(&dx), - SILC_STR_UI_INT(&dy), - SILC_STR_END); - if (ret < 0) - return; - silc_buffer_pull(&buf, 8); - - purple_whiteboard_draw_line(wb, x, y, x + dx, y + dy, - brush_color, brush_size); - x += dx; - y += dy; - } - } - - if (command == SILCPURPLE_WB_CLEAR) - purple_whiteboard_clear(wb); -} - -typedef struct { - unsigned char *message; - SilcUInt32 message_len; - SilcPurple sg; - SilcClientEntry sender; - SilcChannelEntry channel; -} *SilcPurpleWbRequest; - -static void -silcpurple_wb_request_cb(SilcPurpleWbRequest req, gint id) -{ - PurpleWhiteboard *wb; - - if (id != 1) - goto out; - - if (!req->channel) - wb = silcpurple_wb_init(req->sg, req->sender); - else - wb = silcpurple_wb_init_ch(req->sg, req->channel); - - silcpurple_wb_parse(wb->proto_data, wb, req->message, req->message_len); - - out: - silc_free(req->message); - silc_free(req); -} - -static void -silcpurple_wb_request(SilcClient client, const unsigned char *message, - SilcUInt32 message_len, SilcClientEntry sender, - SilcChannelEntry channel) -{ - char tmp[128]; - SilcPurpleWbRequest req; - PurpleConnection *gc; - SilcPurple sg; - - gc = client->application; - sg = gc->proto_data; - - /* Open whiteboard automatically if requested */ - if (purple_account_get_bool(sg->account, "open-wb", FALSE)) { - PurpleWhiteboard *wb; - - if (!channel) - wb = silcpurple_wb_init(sg, sender); - else - wb = silcpurple_wb_init_ch(sg, channel); - - silcpurple_wb_parse(wb->proto_data, wb, (unsigned char *)message, - message_len); - return; - } - - /* Close any previous unaccepted requests */ - purple_request_close_with_handle(sender); - - if (!channel) { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard. Would you like " - "to open the whiteboard?"), sender->nickname); - } else { - g_snprintf(tmp, sizeof(tmp), - _("%s sent message to whiteboard on %s channel. " - "Would you like to open the whiteboard?"), - sender->nickname, channel->channel_name); - } - - req = silc_calloc(1, sizeof(*req)); - if (!req) - return; - req->message = silc_memdup(message, message_len); - req->message_len = message_len; - req->sender = sender; - req->channel = channel; - req->sg = sg; - - purple_request_action(sender, _("Whiteboard"), tmp, NULL, 1, - sg->account, sender->nickname, NULL, req, 2, - _("Yes"), G_CALLBACK(silcpurple_wb_request_cb), - _("No"), G_CALLBACK(silcpurple_wb_request_cb)); -} - -/* Process incoming whiteboard message */ - -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, sender->nickname); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, NULL); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Process incoming whiteboard message on channel */ - -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len) -{ - SilcPurple sg; - PurpleConnection *gc; - PurpleWhiteboard *wb; - SilcPurpleWb wbs; - - gc = client->application; - sg = gc->proto_data; - - wb = purple_whiteboard_get_session(sg->account, channel->channel_name); - if (!wb) { - /* Ask user if they want to open the whiteboard */ - silcpurple_wb_request(client, message, message_len, - sender, channel); - return; - } - - wbs = wb->proto_data; - silcpurple_wb_parse(wbs, wb, (unsigned char *)message, message_len); -} - -/* Send whiteboard message */ - -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - GList *list; - int len; - PurpleConnection *gc; - SilcPurple sg; - - g_return_if_fail(draw_list); - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - for (list = draw_list; list; list = list->next) - len += 4; - - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_DRAW), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - silc_buffer_pull(packet, SILCPURPLE_WB_HEADER); - for (list = draw_list; list; list = list->next) { - silc_buffer_format(packet, - SILC_STR_UI_INT(GPOINTER_TO_INT(list->data)), - SILC_STR_END); - silc_buffer_pull(packet, 4); - } - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } else if (wbs->type == 1) { - /* Channel message. Channel private keys are not supported. */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } - - silc_buffer_free(packet); -} - -/* Purple Whiteboard operations */ - -void silcpurple_wb_start(PurpleWhiteboard *wb) -{ - /* Nothing here. Everything is in initialization */ -} - -void silcpurple_wb_end(PurpleWhiteboard *wb) -{ - silc_free(wb->proto_data); - wb->proto_data = NULL; -} - -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - SilcPurpleWb wbs = wb->proto_data; - *width = wbs->width; - *height = wbs->height; -} - -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->width = width > SILCPURPLE_WB_WIDTH_MAX ? SILCPURPLE_WB_WIDTH_MAX : - width; - wbs->height = height > SILCPURPLE_WB_HEIGHT_MAX ? SILCPURPLE_WB_HEIGHT_MAX : - height; - - /* Update whiteboard */ - purple_whiteboard_set_dimensions(wb, wbs->width, wbs->height); -} - -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - SilcPurpleWb wbs = wb->proto_data; - *size = wbs->brush_size; - *color = wbs->brush_color; -} - -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - SilcPurpleWb wbs = wb->proto_data; - wbs->brush_size = size; - wbs->brush_color = color; - - /* Update whiteboard */ - purple_whiteboard_set_brush(wb, size, color); -} - -void silcpurple_wb_clear(PurpleWhiteboard *wb) -{ - SilcPurpleWb wbs = wb->proto_data; - SilcBuffer packet; - int len; - PurpleConnection *gc; - SilcPurple sg; - - gc = purple_account_get_connection(wb->account); - g_return_if_fail(gc); - sg = gc->proto_data; - g_return_if_fail(sg); - - len = SILCPURPLE_WB_HEADER; - packet = silc_buffer_alloc_size(len); - if (!packet) - return; - - /* Assmeble packet */ - silc_buffer_format(packet, - SILC_STR_UI32_STRING(SILCPURPLE_WB_MIME), - SILC_STR_UI_CHAR(SILCPURPLE_WB_CLEAR), - SILC_STR_UI_SHORT(wbs->width), - SILC_STR_UI_SHORT(wbs->height), - SILC_STR_UI_INT(wbs->brush_color), - SILC_STR_UI_SHORT(wbs->brush_size), - SILC_STR_END); - - /* Send the message */ - if (wbs->type == 0) { - /* Private message */ - silc_client_send_private_message(sg->client, sg->conn, - wbs->u.client, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } else if (wbs->type == 1) { - /* Channel message */ - silc_client_send_channel_message(sg->client, sg->conn, - wbs->u.channel, NULL, - SILC_MESSAGE_FLAG_DATA, - packet->head, len, TRUE); - } - - silc_buffer_free(packet); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/silc10/wb.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - - silcpurple.h - - Author: Pekka Riikonen - - Copyright (C) 2005 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef SILCPURPLE_WB_H -#define SILCPURPLE_WB_H - -#include "silcpurple.h" -#include "whiteboard.h" - -PurpleWhiteboard * -silcpurple_wb_init(SilcPurple sg, SilcClientEntry client_entry); -PurpleWhiteboard * -silcpurple_wb_init_ch(SilcPurple sg, SilcChannelEntry channel); -void silcpurple_wb_receive(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessagePayload payload, - SilcMessageFlags flags, const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_receive_ch(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcChannelEntry channel, - SilcMessagePayload payload, - SilcMessageFlags flags, - const unsigned char *message, - SilcUInt32 message_len); -void silcpurple_wb_start(PurpleWhiteboard *wb); -void silcpurple_wb_end(PurpleWhiteboard *wb); -void silcpurple_wb_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void silcpurple_wb_set_dimensions(PurpleWhiteboard *wb, int width, int height); -void silcpurple_wb_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void silcpurple_wb_set_brush(PurpleWhiteboard *wb, int size, int color); -void silcpurple_wb_send(PurpleWhiteboard *wb, GList *draw_list); -void silcpurple_wb_clear(PurpleWhiteboard *wb); - -#endif /* SILCPURPLE_WB_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -SIMPLESOURCES = \ - simple.c \ - simple.h \ - sipmsg.c \ - sipmsg.h - -AM_CFLAGS = $(st) - -libsimple_la_LDFLAGS = -module -avoid-version - -if STATIC_SIMPLE - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libsimple.la -libsimple_la_SOURCES = $(SIMPLESOURCES) -libsimple_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libsimple.la -libsimple_la_SOURCES = $(SIMPLESOURCES) -libsimple_la_LIBADD = $(GLIB_LIBS) - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,751 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/simple -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -@STATIC_SIMPLE_FALSE@libsimple_la_DEPENDENCIES = \ -@STATIC_SIMPLE_FALSE@ $(am__DEPENDENCIES_1) -am__libsimple_la_SOURCES_DIST = simple.c simple.h sipmsg.c sipmsg.h -am__objects_1 = libsimple_la-simple.lo libsimple_la-sipmsg.lo -@STATIC_SIMPLE_FALSE@am_libsimple_la_OBJECTS = $(am__objects_1) -@STATIC_SIMPLE_TRUE@am_libsimple_la_OBJECTS = $(am__objects_1) -libsimple_la_OBJECTS = $(am_libsimple_la_OBJECTS) -@STATIC_SIMPLE_FALSE@am_libsimple_la_rpath = -rpath $(pkgdir) -@STATIC_SIMPLE_TRUE@am_libsimple_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libsimple_la_SOURCES) -DIST_SOURCES = $(am__libsimple_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -SIMPLESOURCES = \ - simple.c \ - simple.h \ - sipmsg.c \ - sipmsg.h - -AM_CFLAGS = $(st) -libsimple_la_LDFLAGS = -module -avoid-version -@STATIC_SIMPLE_FALSE@st = -@STATIC_SIMPLE_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_SIMPLE_TRUE@noinst_LTLIBRARIES = libsimple.la -@STATIC_SIMPLE_FALSE@libsimple_la_SOURCES = $(SIMPLESOURCES) -@STATIC_SIMPLE_TRUE@libsimple_la_SOURCES = $(SIMPLESOURCES) -@STATIC_SIMPLE_TRUE@libsimple_la_CFLAGS = $(AM_CFLAGS) -@STATIC_SIMPLE_FALSE@pkg_LTLIBRARIES = libsimple.la -@STATIC_SIMPLE_FALSE@libsimple_la_LIBADD = $(GLIB_LIBS) -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/simple/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/simple/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libsimple.la: $(libsimple_la_OBJECTS) $(libsimple_la_DEPENDENCIES) - $(LINK) $(am_libsimple_la_rpath) $(libsimple_la_LDFLAGS) $(libsimple_la_OBJECTS) $(libsimple_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsimple_la-simple.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsimple_la-sipmsg.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libsimple_la-simple.lo: simple.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -MT libsimple_la-simple.lo -MD -MP -MF "$(DEPDIR)/libsimple_la-simple.Tpo" -c -o libsimple_la-simple.lo `test -f 'simple.c' || echo '$(srcdir)/'`simple.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsimple_la-simple.Tpo" "$(DEPDIR)/libsimple_la-simple.Plo"; else rm -f "$(DEPDIR)/libsimple_la-simple.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='simple.c' object='libsimple_la-simple.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -c -o libsimple_la-simple.lo `test -f 'simple.c' || echo '$(srcdir)/'`simple.c - -libsimple_la-sipmsg.lo: sipmsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -MT libsimple_la-sipmsg.lo -MD -MP -MF "$(DEPDIR)/libsimple_la-sipmsg.Tpo" -c -o libsimple_la-sipmsg.lo `test -f 'sipmsg.c' || echo '$(srcdir)/'`sipmsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsimple_la-sipmsg.Tpo" "$(DEPDIR)/libsimple_la-sipmsg.Plo"; else rm -f "$(DEPDIR)/libsimple_la-sipmsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sipmsg.c' object='libsimple_la-sipmsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsimple_la_CFLAGS) $(CFLAGS) -c -o libsimple_la-sipmsg.lo `test -f 'sipmsg.c' || echo '$(srcdir)/'`sipmsg.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libsimple -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libsimple -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = simple.c \ - sipmsg.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(DLL_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) - rm -f $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2154 +0,0 @@ -/** - * @file simple.c - * - * purple - * - * Copyright (C) 2005 Thomas Butter - * - * *** - * Thanks to Google's Summer of Code Program and the helpful mentors - * *** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "blist.h" -#include "conversation.h" -#include "dnsquery.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "plugin.h" -#include "util.h" -#include "version.h" -#include "network.h" -#include "xmlnode.h" - -#include "simple.h" -#include "sipmsg.h" -#include "dnssrv.h" -#include "ntlm.h" - -static char *gentag(void) { - return g_strdup_printf("%04d%04d", rand() & 0xFFFF, rand() & 0xFFFF); -} - -static char *genbranch(void) { - return g_strdup_printf("z9hG4bK%04X%04X%04X%04X%04X", - rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF, - rand() & 0xFFFF, rand() & 0xFFFF); -} - -static char *gencallid(void) { - return g_strdup_printf("%04Xg%04Xa%04Xi%04Xm%04Xt%04Xb%04Xx%04Xx", - rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF, - rand() & 0xFFFF, rand() & 0xFFFF, rand() & 0xFFFF, - rand() & 0xFFFF, rand() & 0xFFFF); -} - -static const char *simple_list_icon(PurpleAccount *a, PurpleBuddy *b) { - return "simple"; -} - -static void simple_keep_alive(PurpleConnection *gc) { - struct simple_account_data *sip = gc->proto_data; - if(sip->udp) { /* in case of UDP send a packet only with a 0 byte to - remain in the NAT table */ - gchar buf[2] = {0, 0}; - purple_debug_info("simple", "sending keep alive\n"); - sendto(sip->fd, buf, 1, 0, (struct sockaddr*)&sip->serveraddr, sizeof(struct sockaddr_in)); - } - return; -} - -static gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc); -static void send_notify(struct simple_account_data *sip, struct simple_watcher *); - -static void send_open_publish(struct simple_account_data *sip); -static void send_closed_publish(struct simple_account_data *sip); - -static void do_notifies(struct simple_account_data *sip) { - GSList *tmp = sip->watcher; - purple_debug_info("simple", "do_notifies()\n"); - if((sip->republish != -1) || sip->republish < time(NULL)) { - if(purple_account_get_bool(sip->account, "dopublish", TRUE)) { - send_open_publish(sip); - } - } - - while(tmp) { - purple_debug_info("simple", "notifying %s\n", ((struct simple_watcher*)tmp->data)->name); - send_notify(sip, tmp->data); - tmp = tmp->next; - } -} - -static void simple_set_status(PurpleAccount *account, PurpleStatus *status) { - PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); - struct simple_account_data *sip = NULL; - - if (!purple_status_is_active(status)) - return; - - if (account->gc) - sip = account->gc->proto_data; - - if (sip) - { - g_free(sip->status); - if (primitive == PURPLE_STATUS_AVAILABLE) - sip->status = g_strdup("available"); - else - sip->status = g_strdup("busy"); - - do_notifies(sip); - } -} - -static struct sip_connection *connection_find(struct simple_account_data *sip, int fd) { - struct sip_connection *ret = NULL; - GSList *entry = sip->openconns; - while(entry) { - ret = entry->data; - if(ret->fd == fd) return ret; - entry = entry->next; - } - return NULL; -} - -static struct simple_watcher *watcher_find(struct simple_account_data *sip, - const gchar *name) { - struct simple_watcher *watcher; - GSList *entry = sip->watcher; - while(entry) { - watcher = entry->data; - if(!strcmp(name, watcher->name)) return watcher; - entry = entry->next; - } - return NULL; -} - -static struct simple_watcher *watcher_create(struct simple_account_data *sip, - const gchar *name, const gchar *callid, const gchar *ourtag, - const gchar *theirtag, gboolean needsxpidf) { - struct simple_watcher *watcher = g_new0(struct simple_watcher, 1); - watcher->name = g_strdup(name); - watcher->dialog.callid = g_strdup(callid); - watcher->dialog.ourtag = g_strdup(ourtag); - watcher->dialog.theirtag = g_strdup(theirtag); - watcher->needsxpidf = needsxpidf; - sip->watcher = g_slist_append(sip->watcher, watcher); - return watcher; -} - -static void watcher_remove(struct simple_account_data *sip, const gchar *name) { - struct simple_watcher *watcher = watcher_find(sip, name); - sip->watcher = g_slist_remove(sip->watcher, watcher); - g_free(watcher->name); - g_free(watcher->dialog.callid); - g_free(watcher->dialog.ourtag); - g_free(watcher->dialog.theirtag); - g_free(watcher); -} - -static struct sip_connection *connection_create(struct simple_account_data *sip, int fd) { - struct sip_connection *ret = g_new0(struct sip_connection, 1); - ret->fd = fd; - sip->openconns = g_slist_append(sip->openconns, ret); - return ret; -} - -static void connection_remove(struct simple_account_data *sip, int fd) { - struct sip_connection *conn = connection_find(sip, fd); - sip->openconns = g_slist_remove(sip->openconns, conn); - if(conn->inputhandler) purple_input_remove(conn->inputhandler); - g_free(conn->inbuf); - g_free(conn); -} - -static void connection_free_all(struct simple_account_data *sip) { - struct sip_connection *ret = NULL; - GSList *entry = sip->openconns; - while(entry) { - ret = entry->data; - connection_remove(sip, ret->fd); - entry = sip->openconns; - } -} - -static void simple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; - struct simple_buddy *b; - const char *name = purple_buddy_get_name(buddy); - if(strncmp(name, "sip:", 4)) { - gchar *buf = g_strdup_printf("sip:%s", name); - purple_blist_rename_buddy(buddy, buf); - g_free(buf); - } - if(!g_hash_table_lookup(sip->buddies, name)) { - b = g_new0(struct simple_buddy, 1); - purple_debug_info("simple", "simple_add_buddy %s\n", name); - b->name = g_strdup(name); - g_hash_table_insert(sip->buddies, b->name, b); - } else { - purple_debug_info("simple", "buddy %s already in internal list\n", name); - } -} - -static void simple_get_buddies(PurpleConnection *gc) { - GSList *buddies; - PurpleAccount *account; - - purple_debug_info("simple", "simple_get_buddies\n"); - - account = purple_connection_get_account(gc); - buddies = purple_find_buddies(account, NULL); - while (buddies) { - PurpleBuddy *buddy = buddies->data; - simple_add_buddy(gc, buddy, purple_buddy_get_group(buddy)); - - buddies = g_slist_delete_link(buddies, buddies); - } -} - -static void simple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - const char *name = purple_buddy_get_name(buddy); - struct simple_account_data *sip = (struct simple_account_data *)gc->proto_data; - struct simple_buddy *b = g_hash_table_lookup(sip->buddies, name); - g_hash_table_remove(sip->buddies, name); - g_free(b->name); - g_free(b); -} - -static GList *simple_status_types(PurpleAccount *acc) { - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_full( - PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE); - types = g_list_append(types, type); - - return types; -} - -static gchar *auth_header(struct simple_account_data *sip, - struct sip_auth *auth, const gchar *method, const gchar *target) { - gchar noncecount[9]; - gchar *response; - gchar *ret; - gchar *tmp; - const char *authdomain; - const char *authuser; - - authdomain = purple_account_get_string(sip->account, "authdomain", ""); - authuser = purple_account_get_string(sip->account, "authuser", sip->username); - - if(!authuser || strlen(authuser) < 1) { - authuser = sip->username; - } - - if(auth->type == 1) { /* Digest */ - sprintf(noncecount, "%08d", auth->nc++); - response = purple_cipher_http_digest_calculate_response( - "md5", method, target, NULL, NULL, - auth->nonce, noncecount, NULL, auth->digest_session_key); - purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); - - ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); - g_free(response); - return ret; - } else if(auth->type == 2) { /* NTLM */ - if(auth->nc == 3 && auth->nonce) { - /* TODO: Don't hardcode "purple" as the hostname */ - ret = purple_ntlm_gen_type3(authuser, sip->password, "purple", authdomain, (const guint8 *)auth->nonce, &auth->flags); - tmp = g_strdup_printf("NTLM qop=\"auth\", opaque=\"%s\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"%s\"", auth->opaque, auth->realm, auth->target, ret); - g_free(ret); - return tmp; - } - tmp = g_strdup_printf("NTLM qop=\"auth\", realm=\"%s\", targetname=\"%s\", gssapi-data=\"\"", auth->realm, auth->target); - return tmp; - } - - sprintf(noncecount, "%08d", auth->nc++); - response = purple_cipher_http_digest_calculate_response( - "md5", method, target, NULL, NULL, - auth->nonce, noncecount, NULL, auth->digest_session_key); - purple_debug(PURPLE_DEBUG_MISC, "simple", "response %s\n", response); - - ret = g_strdup_printf("Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", nc=\"%s\", response=\"%s\"", authuser, auth->realm, auth->nonce, target, noncecount, response); - g_free(response); - return ret; -} - -static char *parse_attribute(const char *attrname, const char *source) { - const char *tmp, *tmp2; - char *retval = NULL; - int len = strlen(attrname); - - /* we know that source is NULL-terminated. - * Therefore this loop won't be infinite. - */ - while (source[0] == ' ') - source++; - - if(!strncmp(source, attrname, len)) { - tmp = source + len; - tmp2 = g_strstr_len(tmp, strlen(tmp), "\""); - if(tmp2) - retval = g_strndup(tmp, tmp2 - tmp); - else - retval = g_strdup(tmp); - } - - return retval; -} - -static void fill_auth(struct simple_account_data *sip, const gchar *hdr, struct sip_auth *auth) { - int i = 0; - const char *authuser; - char *tmp; - gchar **parts; - - authuser = purple_account_get_string(sip->account, "authuser", sip->username); - - if(!authuser || strlen(authuser) < 1) { - authuser = sip->username; - } - - if(!hdr) { - purple_debug_error("simple", "fill_auth: hdr==NULL\n"); - return; - } - - if(!g_ascii_strncasecmp(hdr, "NTLM", 4)) { - purple_debug_info("simple", "found NTLM\n"); - auth->type = 2; - parts = g_strsplit(hdr+5, "\",", 0); - i = 0; - while(parts[i]) { - purple_debug_info("simple", "parts[i] %s\n", parts[i]); - if((tmp = parse_attribute("gssapi-data=\"", parts[i]))) { - auth->nonce = g_memdup(purple_ntlm_parse_type2(tmp, &auth->flags), 8); - g_free(tmp); - } - if((tmp = parse_attribute("targetname=\"", - parts[i]))) { - auth->target = tmp; - } - else if((tmp = parse_attribute("realm=\"", - parts[i]))) { - auth->realm = tmp; - } - else if((tmp = parse_attribute("opaque=\"", parts[i]))) { - auth->opaque = tmp; - } - i++; - } - g_strfreev(parts); - auth->nc = 1; - if(!strstr(hdr, "gssapi-data")) { - auth->nc = 1; - } else { - auth->nc = 3; - } - - return; - } else if(!g_ascii_strncasecmp(hdr, "DIGEST", 6)) { - - purple_debug_info("simple", "found DIGEST\n"); - - auth->type = 1; - parts = g_strsplit(hdr+7, ",", 0); - while(parts[i]) { - if((tmp = parse_attribute("nonce=\"", parts[i]))) { - auth->nonce = tmp; - } - else if((tmp = parse_attribute("realm=\"", parts[i]))) { - auth->realm = tmp; - } - i++; - } - g_strfreev(parts); - purple_debug(PURPLE_DEBUG_MISC, "simple", "nonce: %s realm: %s\n", - auth->nonce ? auth->nonce : "(null)", - auth->realm ? auth->realm : "(null)"); - - if(auth->realm) { - auth->digest_session_key = purple_cipher_http_digest_calculate_session_key( - "md5", authuser, auth->realm, sip->password, auth->nonce, NULL); - - auth->nc = 1; - } - - } else { - purple_debug_error("simple", "Unsupported or bad WWW-Authenticate header (%s).\n", hdr); - } - -} - -static void simple_canwrite_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - gsize max_write; - gssize written; - - max_write = purple_circ_buffer_get_max_read(sip->txbuf); - - if(max_write == 0) { - purple_input_remove(sip->tx_handler); - sip->tx_handler = 0; - return; - } - - written = write(sip->fd, sip->txbuf->outptr, max_write); - - if(written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - /*TODO: do we really want to disconnect on a failure to write?*/ - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - purple_circ_buffer_mark_read(sip->txbuf, written); -} - -static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond); - -static void send_later_cb(gpointer data, gint source, const gchar *error_message) { - PurpleConnection *gc = data; - struct simple_account_data *sip; - struct sip_connection *conn; - - if(source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - sip = gc->proto_data; - sip->fd = source; - sip->connecting = FALSE; - - simple_canwrite_cb(gc, sip->fd, PURPLE_INPUT_WRITE); - - /* If there is more to write now, we need to register a handler */ - if(sip->txbuf->bufused > 0) - sip->tx_handler = purple_input_add(sip->fd, PURPLE_INPUT_WRITE, - simple_canwrite_cb, gc); - - conn = connection_create(sip, source); - conn->inputhandler = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_input_cb, gc); -} - - -static void sendlater(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; - - if(!sip->connecting) { - purple_debug_info("simple", "connecting to %s port %d\n", sip->realhostname ? sip->realhostname : "{NULL}", sip->realport); - if (purple_proxy_connect(gc, sip->account, sip->realhostname, sip->realport, send_later_cb, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect")); - } - sip->connecting = TRUE; - } - - if(purple_circ_buffer_get_max_read(sip->txbuf) > 0) - purple_circ_buffer_append(sip->txbuf, "\r\n", 2); - - purple_circ_buffer_append(sip->txbuf, buf, strlen(buf)); -} - -static void sendout_pkt(PurpleConnection *gc, const char *buf) { - struct simple_account_data *sip = gc->proto_data; - time_t currtime = time(NULL); - int writelen = strlen(buf); - - purple_debug(PURPLE_DEBUG_MISC, "simple", "\n\nsending - %s\n######\n%s\n######\n\n", ctime(&currtime), buf); - if(sip->udp) { - if(sendto(sip->fd, buf, writelen, 0, (struct sockaddr*)&sip->serveraddr, sizeof(struct sockaddr_in)) < writelen) { - purple_debug_info("simple", "could not send packet\n"); - } - } else { - int ret; - if(sip->fd < 0) { - sendlater(gc, buf); - return; - } - - if(sip->tx_handler) { - ret = -1; - errno = EAGAIN; - } else - ret = write(sip->fd, buf, writelen); - - if (ret < 0 && errno == EAGAIN) - ret = 0; - else if(ret <= 0) { /* XXX: When does this happen legitimately? */ - sendlater(gc, buf); - return; - } - - if (ret < writelen) { - if(!sip->tx_handler) - sip->tx_handler = purple_input_add(sip->fd, - PURPLE_INPUT_WRITE, simple_canwrite_cb, - gc); - - /* XXX: is it OK to do this? You might get part of a request sent - with part of another. */ - if(sip->txbuf->bufused > 0) - purple_circ_buffer_append(sip->txbuf, "\r\n", 2); - - purple_circ_buffer_append(sip->txbuf, buf + ret, - writelen - ret); - } - } -} - -static int simple_send_raw(PurpleConnection *gc, const char *buf, int len) -{ - sendout_pkt(gc, buf); - return len; -} - -static void sendout_sipmsg(struct simple_account_data *sip, struct sipmsg *msg) { - GSList *tmp = msg->headers; - gchar *name; - gchar *value; - GString *outstr = g_string_new(""); - g_string_append_printf(outstr, "%s %s SIP/2.0\r\n", msg->method, msg->target); - while(tmp) { - name = ((struct siphdrelement*) (tmp->data))->name; - value = ((struct siphdrelement*) (tmp->data))->value; - g_string_append_printf(outstr, "%s: %s\r\n", name, value); - tmp = g_slist_next(tmp); - } - g_string_append_printf(outstr, "\r\n%s", msg->body ? msg->body : ""); - sendout_pkt(sip->gc, outstr->str); - g_string_free(outstr, TRUE); -} - -static void send_sip_response(PurpleConnection *gc, struct sipmsg *msg, int code, - const char *text, const char *body) { - GSList *tmp = msg->headers; - gchar *name; - gchar *value; - GString *outstr = g_string_new(""); - - /* When sending the acknowlegements and errors, the content length from the original - message is still here, but there is no body; we need to make sure we're sending the - correct content length */ - sipmsg_remove_header(msg, "Content-Length"); - if(body) { - gchar len[12]; - sprintf(len, "%" G_GSIZE_FORMAT , strlen(body)); - sipmsg_add_header(msg, "Content-Length", len); - } - else - sipmsg_add_header(msg, "Content-Length", "0"); - g_string_append_printf(outstr, "SIP/2.0 %d %s\r\n", code, text); - while(tmp) { - name = ((struct siphdrelement*) (tmp->data))->name; - value = ((struct siphdrelement*) (tmp->data))->value; - - g_string_append_printf(outstr, "%s: %s\r\n", name, value); - tmp = g_slist_next(tmp); - } - g_string_append_printf(outstr, "\r\n%s", body ? body : ""); - sendout_pkt(gc, outstr->str); - g_string_free(outstr, TRUE); -} - -static void transactions_remove(struct simple_account_data *sip, struct transaction *trans) { - if(trans->msg) sipmsg_free(trans->msg); - sip->transactions = g_slist_remove(sip->transactions, trans); - g_free(trans); -} - -static void transactions_add_buf(struct simple_account_data *sip, const gchar *buf, void *callback) { - struct transaction *trans = g_new0(struct transaction, 1); - trans->time = time(NULL); - trans->msg = sipmsg_parse_msg(buf); - trans->cseq = sipmsg_find_header(trans->msg, "CSeq"); - trans->callback = callback; - sip->transactions = g_slist_append(sip->transactions, trans); -} - -static struct transaction *transactions_find(struct simple_account_data *sip, struct sipmsg *msg) { - struct transaction *trans; - GSList *transactions = sip->transactions; - const gchar *cseq = sipmsg_find_header(msg, "CSeq"); - - if (cseq) { - while(transactions) { - trans = transactions->data; - if(!strcmp(trans->cseq, cseq)) { - return trans; - } - transactions = transactions->next; - } - } else { - purple_debug(PURPLE_DEBUG_MISC, "simple", "Received message contains no CSeq header.\n"); - } - - return NULL; -} - -static void send_sip_request(PurpleConnection *gc, const gchar *method, - const gchar *url, const gchar *to, const gchar *addheaders, - const gchar *body, struct sip_dialog *dialog, TransCallback tc) { - struct simple_account_data *sip = gc->proto_data; - char *callid = dialog ? g_strdup(dialog->callid) : gencallid(); - char *auth = NULL; - const char *addh = ""; - gchar *branch = genbranch(); - gchar *tag = NULL; - char *buf; - - if(!strcmp(method, "REGISTER")) { - if(sip->regcallid) { - g_free(callid); - callid = g_strdup(sip->regcallid); - } - else sip->regcallid = g_strdup(callid); - } - - if(addheaders) addh = addheaders; - if(sip->registrar.type && !strcmp(method, "REGISTER")) { - buf = auth_header(sip, &sip->registrar, method, url); - auth = g_strdup_printf("Authorization: %s\r\n", buf); - g_free(buf); - purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); - } else if(sip->proxy.type && strcmp(method, "REGISTER")) { - buf = auth_header(sip, &sip->proxy, method, url); - auth = g_strdup_printf("Proxy-Authorization: %s\r\n", buf); - g_free(buf); - purple_debug(PURPLE_DEBUG_MISC, "simple", "header %s", auth); - } - - if (!dialog) - tag = gentag(); - - buf = g_strdup_printf("%s %s SIP/2.0\r\n" - "Via: SIP/2.0/%s %s:%d;branch=%s\r\n" - /* Don't know what epid is, but LCS wants it */ - "From: ;tag=%s;epid=1234567890\r\n" - "To: <%s>%s%s\r\n" - "Max-Forwards: 10\r\n" - "CSeq: %d %s\r\n" - "User-Agent: Purple/" VERSION "\r\n" - "Call-ID: %s\r\n" - "%s%s" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%s", - method, - url, - sip->udp ? "UDP" : "TCP", - purple_network_get_my_ip(-1), - sip->listenport, - branch, - sip->username, - sip->servername, - dialog ? dialog->ourtag : tag, - to, - dialog ? ";tag=" : "", - dialog ? dialog->theirtag : "", - ++sip->cseq, - method, - callid, - auth ? auth : "", - addh, - strlen(body), - body); - - g_free(tag); - g_free(auth); - g_free(branch); - g_free(callid); - - /* add to ongoing transactions */ - - transactions_add_buf(sip, buf, tc); - - sendout_pkt(gc, buf); - - g_free(buf); -} - -static char *get_contact(struct simple_account_data *sip) { - return g_strdup_printf(";methods=\"MESSAGE, SUBSCRIBE, NOTIFY\"", - sip->username, purple_network_get_my_ip(-1), - sip->listenport, - sip->udp ? "udp" : "tcp"); -} - -static void do_register_exp(struct simple_account_data *sip, int expire) { - char *uri, *to, *contact, *hdr; - - sip->reregister = time(NULL) + expire - 50; - - uri = g_strdup_printf("sip:%s", sip->servername); - to = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - contact = get_contact(sip); - hdr = g_strdup_printf("Contact: %s\r\nExpires: %d\r\n", contact, expire); - g_free(contact); - - sip->registerstatus = SIMPLE_REGISTER_SENT; - - send_sip_request(sip->gc, "REGISTER", uri, to, hdr, "", NULL, - process_register_response); - - g_free(hdr); - g_free(uri); - g_free(to); -} - -static void do_register(struct simple_account_data *sip) { - do_register_exp(sip, sip->registerexpire); -} - -static gchar *parse_from(const gchar *hdr) { - gchar *from; - const gchar *tmp, *tmp2 = hdr; - - if(!hdr) return NULL; - purple_debug_info("simple", "parsing address out of %s\n", hdr); - tmp = strchr(hdr, '<'); - - /* i hate the different SIP UA behaviours... */ - if(tmp) { /* sip address in <...> */ - tmp2 = tmp + 1; - tmp = strchr(tmp2, '>'); - if(tmp) { - from = g_strndup(tmp2, tmp - tmp2); - } else { - purple_debug_info("simple", "found < without > in From\n"); - return NULL; - } - } else { - tmp = strchr(tmp2, ';'); - if(tmp) { - from = g_strndup(tmp2, tmp - tmp2); - } else { - from = g_strdup(tmp2); - } - } - purple_debug_info("simple", "got %s\n", from); - return from; -} -static gchar *find_tag(const gchar *); - -static gboolean process_subscribe_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - gchar *to = NULL; - struct simple_buddy *b = NULL; - gchar *theirtag = NULL, *ourtag = NULL; - const gchar *callid = NULL; - - purple_debug_info("simple", "process subscribe response\n"); - - if(msg->response == 200 || msg->response == 202) { - if ( (to = parse_from(sipmsg_find_header(msg, "To"))) && - (b = g_hash_table_lookup(sip->buddies, to)) && - !(b->dialog)) - { - purple_debug_info("simple", "creating dialog" - " information for a subscription.\n"); - - theirtag = find_tag(sipmsg_find_header(msg, "To")); - ourtag = find_tag(sipmsg_find_header(msg, "From")); - callid = sipmsg_find_header(msg, "Call-ID"); - - if (theirtag && ourtag && callid) - { - b->dialog = g_new0(struct sip_dialog, 1); - b->dialog->ourtag = g_strdup(ourtag); - b->dialog->theirtag = g_strdup(theirtag); - b->dialog->callid = g_strdup(callid); - - purple_debug_info("simple", "ourtag: %s\n", - ourtag); - purple_debug_info("simple", "theirtag: %s\n", - theirtag); - purple_debug_info("simple", "callid: %s\n", - callid); - g_free(theirtag); - g_free(ourtag); - } - } - else - { - purple_debug_info("simple", "cannot create dialog!\n"); - } - return TRUE; - } - - to = parse_from(sipmsg_find_header(tc->msg, "To")); /* cant be NULL since it is our own msg */ - - /* we can not subscribe -> user is offline (TODO unknown status?) */ - - purple_prpl_got_user_status(sip->account, to, "offline", NULL); - g_free(to); - return TRUE; -} - -static void simple_subscribe_exp(struct simple_account_data *sip, struct simple_buddy *buddy, int expiration) { - gchar *contact, *to, *tmp, *tmp2; - - tmp2 = g_strdup_printf( - "Expires: %d\r\n" - "Accept: application/pidf+xml, application/xpidf+xml\r\n" - "Event: presence\r\n", - expiration); - - if(strncmp(buddy->name, "sip:", 4)) - to = g_strdup_printf("sip:%s", buddy->name); - else - to = g_strdup(buddy->name); - - tmp = get_contact(sip); - contact = g_strdup_printf("%sContact: %s\r\n", tmp2, tmp); - g_free(tmp); - g_free(tmp2); - - send_sip_request(sip->gc, "SUBSCRIBE", to, to, contact,"",buddy->dialog, - (expiration > 0) ? process_subscribe_response : NULL); - - g_free(to); - g_free(contact); - - /* resubscribe before subscription expires */ - /* add some jitter */ - if (expiration > 60) - buddy->resubscribe = time(NULL) + (expiration - 60) + (rand() % 50); - else if (expiration > 0) - buddy->resubscribe = time(NULL) + ((int) (expiration / 2)); -} - -static void simple_subscribe(struct simple_account_data *sip, struct simple_buddy *buddy) { - simple_subscribe_exp(sip, buddy, SUBSCRIBE_EXPIRATION); -} - -static void simple_unsubscribe(char *name, struct simple_buddy *buddy, struct simple_account_data *sip) { - if (buddy->dialog) - { - purple_debug_info("simple", "Unsubscribing from %s\n", name); - simple_subscribe_exp(sip, buddy, 0); - } -} - -static gboolean simple_add_lcs_contacts(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - const gchar *tmp; - xmlnode *item, *group, *isc; - const char *name_group; - PurpleBuddy *b; - PurpleGroup *g = NULL; - struct simple_buddy *bs; - int len = msg->bodylen; - - - tmp = sipmsg_find_header(msg, "Event"); - if(tmp && !strncmp(tmp, "vnd-microsoft-roaming-contacts", 30)){ - - purple_debug_info("simple", "simple_add_lcs_contacts->%s-%d\n", msg->body, len); - /*Convert the contact from XML to Purple Buddies*/ - isc = xmlnode_from_str(msg->body, len); - - /* ToDo. Find for all groups */ - if ((group = xmlnode_get_child(isc, "group"))) { - name_group = xmlnode_get_attrib(group, "name"); - purple_debug_info("simple", "name_group->%s\n", name_group); - g = purple_find_group(name_group); - if(!g) - g = purple_group_new(name_group); - } - - if (!g) { - g = purple_find_group("Buddies"); - if(!g) - g = purple_group_new("Buddies"); - } - - for(item = xmlnode_get_child(isc, "contact"); item; item = xmlnode_get_next_twin(item)) - { - const char *uri, *name, *groups; - char *buddy_name; - uri = xmlnode_get_attrib(item, "uri"); - name = xmlnode_get_attrib(item, "name"); - groups = xmlnode_get_attrib(item, "groups"); - purple_debug_info("simple", "URI->%s\n", uri); - - buddy_name = g_strdup_printf("sip:%s", uri); - - b = purple_find_buddy(sip->account, buddy_name); - if(!b){ - b = purple_buddy_new(sip->account, buddy_name, uri); - } - g_free(buddy_name); - - purple_blist_add_buddy(b, NULL, g, NULL); - purple_blist_alias_buddy(b, uri); - bs = g_new0(struct simple_buddy, 1); - bs->name = g_strdup(purple_buddy_get_name(b)); - g_hash_table_insert(sip->buddies, bs->name, bs); - } - xmlnode_free(isc); - } - return 0; -} - -static void simple_subscribe_buddylist(struct simple_account_data *sip) { - gchar *contact = "Event: vnd-microsoft-roaming-contacts\r\nAccept: application/vnd-microsoft-roaming-contacts+xml\r\nSupported: com.microsoft.autoextend\r\nSupported: ms-benotify\r\nProxy-Require: ms-benotify\r\nSupported: ms-piggyback-first-notify\r\n"; - gchar *to; - gchar *tmp; - to = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - - tmp = get_contact(sip); - - contact = g_strdup_printf("%sContact: %s\r\n", contact, tmp); - g_free(tmp); - - send_sip_request(sip->gc, "SUBSCRIBE", to, to, contact, "", NULL, simple_add_lcs_contacts); - - g_free(to); - g_free(contact); -} - - -static void simple_buddy_resub(char *name, struct simple_buddy *buddy, struct simple_account_data *sip) { - time_t curtime = time(NULL); - purple_debug_info("simple", "buddy resub\n"); - if(buddy->resubscribe < curtime) { - purple_debug(PURPLE_DEBUG_MISC, "simple", "simple_buddy_resub %s\n", name); - simple_subscribe(sip, buddy); - } -} - -static gboolean resend_timeout(struct simple_account_data *sip) { - GSList *tmp = sip->transactions; - time_t currtime = time(NULL); - while(tmp) { - struct transaction *trans = tmp->data; - tmp = tmp->next; - purple_debug_info("simple", "have open transaction age: %lu\n", currtime- trans->time); - if((currtime - trans->time > 5) && trans->retries >= 1) { - /* TODO 408 */ - } else { - if((currtime - trans->time > 2) && trans->retries == 0) { - trans->retries++; - sendout_sipmsg(sip, trans->msg); - } - } - } - return TRUE; -} - -static gboolean subscribe_timeout(struct simple_account_data *sip) { - GSList *tmp; - time_t curtime = time(NULL); - /* register again if first registration expires */ - if(sip->reregister < curtime) { - do_register(sip); - } - - /* publish status again if our last update is about to expire. */ - if (sip->republish != -1 && - sip->republish < curtime && - purple_account_get_bool(sip->account, "dopublish", TRUE)) - { - purple_debug_info("simple", "subscribe_timeout: republishing status.\n"); - send_open_publish(sip); - } - - /* check for every subscription if we need to resubscribe */ - g_hash_table_foreach(sip->buddies, (GHFunc)simple_buddy_resub, (gpointer)sip); - - /* remove a timed out suscriber */ - tmp = sip->watcher; - while(tmp) { - struct simple_watcher *watcher = tmp->data; - if(watcher->expire < curtime) { - watcher_remove(sip, watcher->name); - tmp = sip->watcher; - } - if(tmp) tmp = tmp->next; - } - - return TRUE; -} - -static void simple_send_message(struct simple_account_data *sip, const char *to, const char *msg, const char *type) { - gchar *hdr; - gchar *fullto; - if(strncmp(to, "sip:", 4)) - fullto = g_strdup_printf("sip:%s", to); - else - fullto = g_strdup(to); - - if(type) { - hdr = g_strdup_printf("Content-Type: %s\r\n", type); - } else { - hdr = g_strdup("Content-Type: text/plain\r\n"); - } - send_sip_request(sip->gc, "MESSAGE", fullto, fullto, hdr, msg, NULL, NULL); - g_free(hdr); - g_free(fullto); -} - -static int simple_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct simple_account_data *sip = gc->proto_data; - char *to = g_strdup(who); - char *text = purple_unescape_html(what); - simple_send_message(sip, to, text, NULL); - g_free(to); - g_free(text); - return 1; -} - -static void process_incoming_message(struct simple_account_data *sip, struct sipmsg *msg) { - gchar *from; - const gchar *contenttype; - gboolean found = FALSE; - - from = parse_from(sipmsg_find_header(msg, "From")); - - if(!from) return; - - purple_debug(PURPLE_DEBUG_MISC, "simple", "got message from %s: %s\n", from, msg->body); - - contenttype = sipmsg_find_header(msg, "Content-Type"); - if(!contenttype || !strncmp(contenttype, "text/plain", 10) || !strncmp(contenttype, "text/html", 9)) { - serv_got_im(sip->gc, from, msg->body, 0, time(NULL)); - send_sip_response(sip->gc, msg, 200, "OK", NULL); - found = TRUE; - } - else if(!strncmp(contenttype, "application/im-iscomposing+xml", 30)) { - xmlnode *isc = xmlnode_from_str(msg->body, msg->bodylen); - xmlnode *state; - gchar *statedata; - - if(!isc) { - purple_debug_info("simple", "process_incoming_message: can not parse iscomposing\n"); - g_free(from); - return; - } - - state = xmlnode_get_child(isc, "state"); - - if(!state) { - purple_debug_info("simple", "process_incoming_message: no state found\n"); - xmlnode_free(isc); - g_free(from); - return; - } - - statedata = xmlnode_get_data(state); - if(statedata) { - if(strstr(statedata, "active")) - serv_got_typing(sip->gc, from, 0, PURPLE_TYPING); - else - serv_got_typing_stopped(sip->gc, from); - - g_free(statedata); - } - xmlnode_free(isc); - send_sip_response(sip->gc, msg, 200, "OK", NULL); - found = TRUE; - } - if(!found) { - purple_debug_info("simple", "got unknown mime-type\n"); - send_sip_response(sip->gc, msg, 415, "Unsupported media type", NULL); - } - g_free(from); -} - - -gboolean process_register_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - const gchar *tmp; - purple_debug(PURPLE_DEBUG_MISC, "simple", "in process register response response: %d\n", msg->response); - switch (msg->response) { - case 200: - if(sip->registerstatus < SIMPLE_REGISTER_COMPLETE) { /* registered */ - if(purple_account_get_bool(sip->account, "dopublish", TRUE)) { - send_open_publish(sip); - } - } - sip->registerstatus = SIMPLE_REGISTER_COMPLETE; - purple_connection_set_state(sip->gc, PURPLE_CONNECTED); - - /* get buddies from blist */ - simple_get_buddies(sip->gc); - - subscribe_timeout(sip); - tmp = sipmsg_find_header(msg, "Allow-Events"); - if(tmp && strstr(tmp, "vnd-microsoft-provisioning")){ - simple_subscribe_buddylist(sip); - } - - break; - case 401: - if(sip->registerstatus != SIMPLE_REGISTER_RETRY) { - purple_debug_info("simple", "REGISTER retries %d\n", sip->registrar.retries); - if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - if (!purple_account_get_remember_password(sip->gc->account)) - purple_account_set_password(sip->gc->account, NULL); - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Incorrect password")); - return TRUE; - } - tmp = sipmsg_find_header(msg, "WWW-Authenticate"); - fill_auth(sip, tmp, &sip->registrar); - sip->registerstatus = SIMPLE_REGISTER_RETRY; - do_register(sip); - } - break; - default: - if (sip->registerstatus != SIMPLE_REGISTER_RETRY) { - purple_debug_info("simple", "Unrecognized return code for REGISTER.\n"); - if (sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_OTHER_ERROR, - _("Unknown server response")); - return TRUE; - } - sip->registerstatus = SIMPLE_REGISTER_RETRY; - do_register(sip); - } - break; - } - return TRUE; -} - -static gboolean dialog_match(struct sip_dialog *dialog, struct sipmsg *msg) -{ - const gchar *fromhdr; - const gchar *tohdr; - const gchar *callid; - gchar *ourtag, *theirtag; - gboolean match = FALSE; - - fromhdr = sipmsg_find_header(msg, "From"); - tohdr = sipmsg_find_header(msg, "To"); - callid = sipmsg_find_header(msg, "Call-ID"); - - if (!fromhdr || !tohdr || !callid) - return FALSE; - - ourtag = find_tag(tohdr); - theirtag = find_tag(fromhdr); - - if (ourtag && theirtag && - !strcmp(dialog->callid, callid) && - !strcmp(dialog->ourtag, ourtag) && - !strcmp(dialog->theirtag, theirtag)) - match = TRUE; - - g_free(ourtag); - g_free(theirtag); - - return match; -} - -static void process_incoming_notify(struct simple_account_data *sip, struct sipmsg *msg) { - gchar *from; - const gchar *fromhdr; - gchar *basicstatus_data; - xmlnode *pidf; - xmlnode *basicstatus = NULL, *tuple, *status; - gboolean isonline = FALSE; - struct simple_buddy *b = NULL; - const gchar *sshdr = NULL; - - fromhdr = sipmsg_find_header(msg, "From"); - from = parse_from(fromhdr); - if(!from) return; - - b = g_hash_table_lookup(sip->buddies, from); - if (!b) - { - g_free(from); - purple_debug_info("simple", "Could not find the buddy.\n"); - return; - } - - if (b->dialog && !dialog_match(b->dialog, msg)) - { - /* We only accept notifies from people that - * we already have a dialog with. - */ - purple_debug_info("simple","No corresponding dialog for notify--discard\n"); - g_free(from); - return; - } - - pidf = xmlnode_from_str(msg->body, msg->bodylen); - - if(!pidf) { - purple_debug_info("simple", "process_incoming_notify: no parseable pidf\n"); - sshdr = sipmsg_find_header(msg, "Subscription-State"); - if (sshdr) - { - int i = 0; - gchar **ssparts = g_strsplit(sshdr, ":", 0); - while (ssparts[i]) - { - g_strchug(ssparts[i]); - if (purple_str_has_prefix(ssparts[i], "terminated")) - { - purple_debug_info("simple", "Subscription expired!"); - if (b->dialog) - { - g_free(b->dialog->ourtag); - g_free(b->dialog->theirtag); - g_free(b->dialog->callid); - g_free(b->dialog); - b->dialog = NULL; - } - - purple_prpl_got_user_status(sip->account, from, "offline", NULL); - break; - } - i++; - } - g_strfreev(ssparts); - } - send_sip_response(sip->gc, msg, 200, "OK", NULL); - g_free(from); - return; - } - - if ((tuple = xmlnode_get_child(pidf, "tuple"))) - if ((status = xmlnode_get_child(tuple, "status"))) - basicstatus = xmlnode_get_child(status, "basic"); - - if(!basicstatus) { - purple_debug_info("simple", "process_incoming_notify: no basic found\n"); - xmlnode_free(pidf); - g_free(from); - return; - } - - basicstatus_data = xmlnode_get_data(basicstatus); - - if(!basicstatus_data) { - purple_debug_info("simple", "process_incoming_notify: no basic data found\n"); - xmlnode_free(pidf); - g_free(from); - return; - } - - if(strstr(basicstatus_data, "open")) - isonline = TRUE; - - - if(isonline) - purple_prpl_got_user_status(sip->account, from, "available", NULL); - else - purple_prpl_got_user_status(sip->account, from, "offline", NULL); - - xmlnode_free(pidf); - g_free(from); - g_free(basicstatus_data); - - send_sip_response(sip->gc, msg, 200, "OK", NULL); -} - -static unsigned int simple_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { - struct simple_account_data *sip = gc->proto_data; - - gchar *xml = "\n" - "\n" - "%s\n" - "text/plain\n" - "60\n" - ""; - gchar *recv = g_strdup(name); - if(state == PURPLE_TYPING) { - gchar *msg = g_strdup_printf(xml, "active"); - simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); - g_free(msg); - } else /* TODO: Only if (state == PURPLE_TYPED) ? */ { - gchar *msg = g_strdup_printf(xml, "idle"); - simple_send_message(sip, recv, msg, "application/im-iscomposing+xml"); - g_free(msg); - } - g_free(recv); - /* - * TODO: Is this right? It will cause the core to call - * serv_send_typing(gc, who, PURPLE_TYPING) once every second - * until the user stops typing. If that's not desired, - * then return 0 instead. - */ - return 1; -} - -static gchar *find_tag(const gchar *hdr) { - const gchar *tmp = strstr(hdr, ";tag="), *tmp2; - - if(!tmp) return NULL; - tmp += 5; - if((tmp2 = strchr(tmp, ';'))) { - return g_strndup(tmp, tmp2 - tmp); - } - return g_strdup(tmp); -} - -static gchar* gen_xpidf(struct simple_account_data *sip) { - gchar *doc = g_strdup_printf("\n" - "\n" - "\n" - "\n" - "\n" - "

\n" - "\n" - "
\n" - "\n" - "\n", - sip->username, - sip->servername, - sip->username, - sip->servername, - sip->username, - sip->servername, - sip->status); - return doc; -} - -static gchar* gen_pidf(struct simple_account_data *sip, gboolean open) { - gchar *doc = g_strdup_printf("\n" - "\n" - "\n" - "\n" - "%s\n" - "\n" - "%s\n" - "\n" - "", - sip->username, - sip->servername, - (open == TRUE) ? "open" : "closed", - (open == TRUE) ? sip->status : ""); - return doc; -} - -static void send_notify(struct simple_account_data *sip, struct simple_watcher *watcher) { - gchar *doc = watcher->needsxpidf ? gen_xpidf(sip) : gen_pidf(sip, TRUE); - gchar *hdr = watcher->needsxpidf ? "Event: presence\r\nContent-Type: application/xpidf+xml\r\n" : "Event: presence\r\nContent-Type: application/pidf+xml\r\n"; - send_sip_request(sip->gc, "NOTIFY", watcher->name, watcher->name, hdr, doc, &watcher->dialog, NULL); - g_free(doc); -} - -static gboolean process_publish_response(struct simple_account_data *sip, struct sipmsg *msg, struct transaction *tc) { - - const gchar *etag = NULL; - - if(msg->response != 200 && msg->response != 408) { - /* never send again */ - sip->republish = -1; - } - - etag = sipmsg_find_header(msg, "SIP-Etag"); - if (etag) { - /* we must store the etag somewhere. */ - g_free(sip->publish_etag); - sip->publish_etag = g_strdup(etag); - } - - return TRUE; -} - -static void send_open_publish(struct simple_account_data *sip) { - gchar *add_headers = NULL; - gchar *uri = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - gchar *doc = gen_pidf(sip, TRUE); - - add_headers = g_strdup_printf("%s%s%s%s%d\r\n%s", - sip->publish_etag ? "SIP-If-Match: " : "", - sip->publish_etag ? sip->publish_etag : "", - sip->publish_etag ? "\r\n" : "", - "Expires: ", PUBLISH_EXPIRATION, - "Event: presence\r\n" - "Content-Type: application/pidf+xml\r\n"); - - send_sip_request(sip->gc, "PUBLISH", uri, uri, - add_headers, doc, NULL, process_publish_response); - sip->republish = time(NULL) + PUBLISH_EXPIRATION - 50; - g_free(uri); - g_free(doc); - g_free(add_headers); -} - -static void send_closed_publish(struct simple_account_data *sip) { - gchar *uri = g_strdup_printf("sip:%s@%s", sip->username, sip->servername); - gchar *add_headers, *doc; - - add_headers = g_strdup_printf("%s%s%s%s", - sip->publish_etag ? "SIP-If-Match: " : "", - sip->publish_etag ? sip->publish_etag : "", - sip->publish_etag ? "\r\n" : "", - "Expires: 600\r\n" - "Event: presence\r\n" - "Content-Type: application/pidf+xml\r\n"); - - doc = gen_pidf(sip, FALSE); - send_sip_request(sip->gc, "PUBLISH", uri, uri, add_headers, - doc, NULL, process_publish_response); - /*sip->republish = time(NULL) + 500;*/ - g_free(uri); - g_free(doc); - g_free(add_headers); -} - -static void process_incoming_subscribe(struct simple_account_data *sip, struct sipmsg *msg) { - const char *from_hdr = sipmsg_find_header(msg, "From"); - gchar *from = parse_from(from_hdr); - gchar *theirtag = find_tag(from_hdr); - gchar *ourtag = find_tag(sipmsg_find_header(msg, "To")); - gboolean tagadded = FALSE; - const gchar *callid = sipmsg_find_header(msg, "Call-ID"); - const gchar *expire = sipmsg_find_header(msg, "Expire"); - gchar *tmp; - struct simple_watcher *watcher = watcher_find(sip, from); - if(!ourtag) { - tagadded = TRUE; - ourtag = gentag(); - } - if(!watcher) { /* new subscription */ - const gchar *acceptheader = sipmsg_find_header(msg, "Accept"); - gboolean needsxpidf = FALSE; - if(!purple_privacy_check(sip->account, from)) { - send_sip_response(sip->gc, msg, 202, "Ok", NULL); - goto privend; - } - if(acceptheader) { - const gchar *tmp = acceptheader; - gboolean foundpidf = FALSE; - gboolean foundxpidf = FALSE; - while(tmp && tmp < acceptheader + strlen(acceptheader)) { - gchar *tmp2 = strchr(tmp, ','); - if(tmp2) *tmp2 = '\0'; - if(!g_ascii_strcasecmp("application/pidf+xml", tmp)) - foundpidf = TRUE; - if(!g_ascii_strcasecmp("application/xpidf+xml", tmp)) - foundxpidf = TRUE; - if(tmp2) { - *tmp2 = ','; - tmp = tmp2 + 1; - while(*tmp == ' ') tmp++; - } else - tmp = 0; - } - if(!foundpidf && foundxpidf) needsxpidf = TRUE; - } - watcher = watcher_create(sip, from, callid, ourtag, theirtag, needsxpidf); - } - if(tagadded) { - gchar *to = g_strdup_printf("%s;tag=%s", sipmsg_find_header(msg, "To"), ourtag); - sipmsg_remove_header(msg, "To"); - sipmsg_add_header(msg, "To", to); - g_free(to); - } - if(expire) - watcher->expire = time(NULL) + strtol(expire, NULL, 10); - else - watcher->expire = time(NULL) + 600; - sipmsg_remove_header(msg, "Contact"); - tmp = get_contact(sip); - sipmsg_add_header(msg, "Contact", tmp); - g_free(tmp); - purple_debug_info("simple", "got subscribe: name %s ourtag %s theirtag %s callid %s\n", watcher->name, watcher->dialog.ourtag, watcher->dialog.theirtag, watcher->dialog.callid); - send_sip_response(sip->gc, msg, 200, "Ok", NULL); - send_notify(sip, watcher); -privend: - g_free(from); - g_free(theirtag); - g_free(ourtag); -} - -static void process_input_message(struct simple_account_data *sip, struct sipmsg *msg) { - gboolean found = FALSE; - if(msg->response == 0) { /* request */ - if(!strcmp(msg->method, "MESSAGE")) { - process_incoming_message(sip, msg); - found = TRUE; - } else if(!strcmp(msg->method, "NOTIFY")) { - process_incoming_notify(sip, msg); - found = TRUE; - } else if(!strcmp(msg->method, "SUBSCRIBE")) { - process_incoming_subscribe(sip, msg); - found = TRUE; - } else { - send_sip_response(sip->gc, msg, 501, "Not implemented", NULL); - } - } else { /* response */ - struct transaction *trans = transactions_find(sip, msg); - if(trans) { - if(msg->response == 407) { - gchar *resend, *auth; - const gchar *ptmp; - - if(sip->proxy.retries > 3) return; - sip->proxy.retries++; - /* do proxy authentication */ - - ptmp = sipmsg_find_header(msg, "Proxy-Authenticate"); - - fill_auth(sip, ptmp, &sip->proxy); - auth = auth_header(sip, &sip->proxy, trans->msg->method, trans->msg->target); - sipmsg_remove_header(trans->msg, "Proxy-Authorization"); - sipmsg_add_header(trans->msg, "Proxy-Authorization", auth); - g_free(auth); - resend = sipmsg_to_string(trans->msg); - /* resend request */ - sendout_pkt(sip->gc, resend); - g_free(resend); - } else { - if(msg->response == 100) { - /* ignore provisional response */ - purple_debug_info("simple", "got trying response\n"); - } else { - sip->proxy.retries = 0; - if(!strcmp(trans->msg->method, "REGISTER")) { - - /* This is encountered when a REGISTER request was ... - */ - if(msg->response == 401) { - /* denied until further authentication was provided. */ - sip->registrar.retries++; - } - else if (msg->response != 200) { - /* denied for some other reason! */ - sip->registrar.retries++; - } - else { - /* accepted! */ - sip->registrar.retries = 0; - } - } else { - if(msg->response == 401) { - /* This is encountered when a generic (MESSAGE, NOTIFY, etc) - * was denied until further authorization is provided. - */ - gchar *resend, *auth; - const gchar *ptmp; - - if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) return; - sip->registrar.retries++; - - ptmp = sipmsg_find_header(msg, "WWW-Authenticate"); - - fill_auth(sip, ptmp, &sip->registrar); - auth = auth_header(sip, &sip->registrar, trans->msg->method, trans->msg->target); - sipmsg_remove_header(trans->msg, "Authorization"); - sipmsg_add_header(trans->msg, "Authorization", auth); - g_free(auth); - resend = sipmsg_to_string(trans->msg); - /* resend request */ - sendout_pkt(sip->gc, resend); - g_free(resend); - } else { - /* Reset any count of retries that may have - * accumulated in the above branch. - */ - sip->registrar.retries = 0; - } - } - if(trans->callback) { - /* call the callback to process response*/ - (trans->callback)(sip, msg, trans); - } - transactions_remove(sip, trans); - } - } - found = TRUE; - } else { - purple_debug(PURPLE_DEBUG_MISC, "simple", "received response to unknown transaction"); - } - } - if(!found) { - purple_debug(PURPLE_DEBUG_MISC, "simple", "received a unknown sip message with method %s and response %d\n", msg->method, msg->response); - } -} - -static void process_input(struct simple_account_data *sip, struct sip_connection *conn) -{ - char *cur; - char *dummy; - struct sipmsg *msg; - int restlen; - cur = conn->inbuf; - - /* according to the RFC remove CRLF at the beginning */ - while(*cur == '\r' || *cur == '\n') { - cur++; - } - if(cur != conn->inbuf) { - memmove(conn->inbuf, cur, conn->inbufused - (cur - conn->inbuf)); - conn->inbufused = strlen(conn->inbuf); - } - - /* Received a full Header? */ - if((cur = strstr(conn->inbuf, "\r\n\r\n")) != NULL) { - time_t currtime = time(NULL); - cur += 2; - cur[0] = '\0'; - purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), conn->inbuf); - msg = sipmsg_parse_header(conn->inbuf); - - if(!msg) { - /* Should we re-use this error message (from lower in the function)? */ - purple_debug_misc("simple", "received a incomplete sip msg: %s\n", conn->inbuf); - return; - } - - cur[0] = '\r'; - cur += 2; - restlen = conn->inbufused - (cur - conn->inbuf); - if(restlen >= msg->bodylen) { - dummy = g_malloc(msg->bodylen + 1); - memcpy(dummy, cur, msg->bodylen); - dummy[msg->bodylen] = '\0'; - msg->body = dummy; - cur += msg->bodylen; - memmove(conn->inbuf, cur, conn->inbuflen - (cur - conn->inbuf)); - conn->inbufused = strlen(conn->inbuf); - } else { - sipmsg_free(msg); - return; - } - purple_debug(PURPLE_DEBUG_MISC, "simple", "in process response response: %d\n", msg->response); - process_input_message(sip, msg); - } else { - purple_debug(PURPLE_DEBUG_MISC, "simple", "received a incomplete sip msg: %s\n", conn->inbuf); - } -} - -static void simple_udp_process(gpointer data, gint source, PurpleInputCondition con) { - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - struct sipmsg *msg; - int len; - time_t currtime; - - static char buffer[65536]; - if((len = recv(source, buffer, sizeof(buffer) - 1, 0)) > 0) { - buffer[len] = '\0'; - purple_debug_info("simple", "\n\nreceived - %s\n######\n%s\n#######\n\n", ctime(&currtime), buffer); - msg = sipmsg_parse_msg(buffer); - if(msg) process_input_message(sip, msg); - } -} - -static void simple_input_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - int len; - struct sip_connection *conn = connection_find(sip, source); - if(!conn) { - purple_debug_error("simple", "Connection not found!\n"); - return; - } - - if(conn->inbuflen < conn->inbufused + SIMPLE_BUF_INC) { - conn->inbuflen += SIMPLE_BUF_INC; - conn->inbuf = g_realloc(conn->inbuf, conn->inbuflen); - } - - len = read(source, conn->inbuf + conn->inbufused, SIMPLE_BUF_INC - 1); - - if(len < 0 && errno == EAGAIN) - return; - else if(len <= 0) { - purple_debug_info("simple", "simple_input_cb: read error\n"); - connection_remove(sip, source); - if(sip->fd == source) sip->fd = -1; - return; - } - gc->last_received = time(NULL); - conn->inbufused += len; - conn->inbuf[conn->inbufused] = '\0'; - - process_input(sip, conn); -} - -/* Callback for new connections on incoming TCP port */ -static void simple_newconn_cb(gpointer data, gint source, PurpleInputCondition cond) { - PurpleConnection *gc = data; - struct simple_account_data *sip = gc->proto_data; - struct sip_connection *conn; - int newfd, flags; - - newfd = accept(source, NULL, NULL); - - flags = fcntl(newfd, F_GETFL); - fcntl(newfd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(newfd, F_SETFD, FD_CLOEXEC); -#endif - - conn = connection_create(sip, newfd); - - conn->inputhandler = purple_input_add(newfd, PURPLE_INPUT_READ, simple_input_cb, gc); -} - -static void login_cb(gpointer data, gint source, const gchar *error_message) { - PurpleConnection *gc = data; - struct simple_account_data *sip; - struct sip_connection *conn; - - if(source < 0) { - gchar *tmp = g_strdup_printf(_("Unable to connect: %s"), - error_message); - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - sip = gc->proto_data; - sip->fd = source; - - conn = connection_create(sip, source); - - sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip); - - do_register(sip); - - conn->inputhandler = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_input_cb, gc); -} - -static guint simple_ht_hash_nick(const char *nick) { - char *lc = g_utf8_strdown(nick, -1); - guint bucket = g_str_hash(lc); - g_free(lc); - - return bucket; -} - -static gboolean simple_ht_equals_nick(const char *nick1, const char *nick2) { - return (purple_utf8_strcasecmp(nick1, nick2) == 0); -} - -static void simple_udp_host_resolved_listen_cb(int listenfd, gpointer data) { - struct simple_account_data *sip = (struct simple_account_data*) data; - - sip->listen_data = NULL; - - if(listenfd == -1) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } - - sip->fd = listenfd; - - sip->listenport = purple_network_get_port_from_fd(sip->fd); - sip->listenfd = sip->fd; - - sip->listenpa = purple_input_add(sip->fd, PURPLE_INPUT_READ, simple_udp_process, sip->gc); - - sip->resendtimeout = purple_timeout_add(2500, (GSourceFunc) resend_timeout, sip); - sip->registertimeout = purple_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip); - do_register(sip); -} - -static void simple_udp_host_resolved(GSList *hosts, gpointer data, const char *error_message) { - struct simple_account_data *sip = (struct simple_account_data*) data; - int addr_size; - - sip->query_data = NULL; - - if (!hosts || !hosts->data) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to resolve hostname")); - return; - } - - addr_size = GPOINTER_TO_INT(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - memcpy(&(sip->serveraddr), hosts->data, addr_size); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_DGRAM, - simple_udp_host_resolved_listen_cb, sip); - if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } -} - -static void -simple_tcp_connect_listen_cb(int listenfd, gpointer data) { - struct simple_account_data *sip = (struct simple_account_data*) data; - - sip->listen_data = NULL; - - sip->listenfd = listenfd; - if(sip->listenfd == -1) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } - - purple_debug_info("simple", "listenfd: %d\n", sip->listenfd); - sip->listenport = purple_network_get_port_from_fd(sip->listenfd); - sip->listenpa = purple_input_add(sip->listenfd, PURPLE_INPUT_READ, - simple_newconn_cb, sip->gc); - purple_debug_info("simple", "connecting to %s port %d\n", - sip->realhostname, sip->realport); - /* open tcp connection to the server */ - if (purple_proxy_connect(sip->gc, sip->account, sip->realhostname, - sip->realport, login_cb, sip->gc) == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - } -} - -static void srvresolved(PurpleSrvResponse *resp, int results, gpointer data) { - struct simple_account_data *sip; - gchar *hostname; - int port; - - sip = data; - sip->srv_query_data = NULL; - - port = purple_account_get_int(sip->account, "port", 0); - - /* find the host to connect to */ - if(results) { - hostname = g_strdup(resp->hostname); - if(!port) - port = resp->port; - g_free(resp); - } else { - if(!purple_account_get_bool(sip->account, "useproxy", FALSE)) { - hostname = g_strdup(sip->servername); - } else { - hostname = g_strdup(purple_account_get_string(sip->account, "proxy", sip->servername)); - } - } - - sip->realhostname = hostname; - sip->realport = port; - if(!sip->realport) sip->realport = 5060; - - /* TCP case */ - if(!sip->udp) { - /* create socket for incoming connections */ - sip->listen_data = purple_network_listen_range(5060, 5160, SOCK_STREAM, - simple_tcp_connect_listen_cb, sip); - if (sip->listen_data == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to create listen socket")); - return; - } - } else { /* UDP */ - purple_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); - - sip->query_data = purple_dnsquery_a(hostname, port, simple_udp_host_resolved, sip); - if (sip->query_data == NULL) { - purple_connection_error_reason(sip->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to resolve hostname")); - } - } -} - -static void simple_login(PurpleAccount *account) -{ - PurpleConnection *gc; - struct simple_account_data *sip; - gchar **userserver; - const gchar *hosttoconnect; - - const char *username = purple_account_get_username(account); - gc = purple_account_get_connection(account); - - if (strpbrk(username, " \t\v\r\n") != NULL) { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("SIP usernames may not contain whitespaces or @ symbols")); - return; - } - - gc->proto_data = sip = g_new0(struct simple_account_data, 1); - sip->gc = gc; - sip->account = account; - sip->registerexpire = 900; - sip->udp = purple_account_get_bool(account, "udp", FALSE); - /* TODO: is there a good default grow size? */ - if(!sip->udp) - sip->txbuf = purple_circ_buffer_new(0); - - userserver = g_strsplit(username, "@", 2); - if (userserver[1] == NULL || userserver[1][0] == '\0') { - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, - _("SIP connect server not specified")); - return; - } - - purple_connection_set_display_name(gc, userserver[0]); - sip->username = g_strdup(userserver[0]); - sip->servername = g_strdup(userserver[1]); - sip->password = g_strdup(purple_connection_get_password(gc)); - g_strfreev(userserver); - - sip->buddies = g_hash_table_new((GHashFunc)simple_ht_hash_nick, (GEqualFunc)simple_ht_equals_nick); - - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - - /* TODO: Set the status correctly. */ - sip->status = g_strdup("available"); - - if(!purple_account_get_bool(account, "useproxy", FALSE)) { - hosttoconnect = sip->servername; - } else { - hosttoconnect = purple_account_get_string(account, "proxy", sip->servername); - } - - sip->srv_query_data = purple_srv_resolve("sip", - sip->udp ? "udp" : "tcp", hosttoconnect, srvresolved, sip); -} - -static void simple_close(PurpleConnection *gc) -{ - struct simple_account_data *sip = gc->proto_data; - - if(sip) { - /* unregister */ - if (sip->registerstatus == SIMPLE_REGISTER_COMPLETE) - { - g_hash_table_foreach(sip->buddies, - (GHFunc)simple_unsubscribe, - (gpointer)sip); - - if(purple_account_get_bool(sip->account, - "dopublish", TRUE)) - send_closed_publish(sip); - - do_register_exp(sip, 0); - } - connection_free_all(sip); - - if (sip->query_data != NULL) - purple_dnsquery_destroy(sip->query_data); - - if (sip->srv_query_data != NULL) - purple_srv_cancel(sip->srv_query_data); - - if (sip->listen_data != NULL) - purple_network_listen_cancel(sip->listen_data); - - g_free(sip->servername); - g_free(sip->username); - g_free(sip->password); - g_free(sip->registrar.nonce); - g_free(sip->registrar.opaque); - g_free(sip->registrar.target); - g_free(sip->registrar.realm); - g_free(sip->registrar.digest_session_key); - g_free(sip->proxy.nonce); - g_free(sip->proxy.opaque); - g_free(sip->proxy.target); - g_free(sip->proxy.realm); - g_free(sip->proxy.digest_session_key); - g_free(sip->publish_etag); - if(sip->txbuf) - purple_circ_buffer_destroy(sip->txbuf); - g_free(sip->realhostname); - if(sip->listenpa) purple_input_remove(sip->listenpa); - if(sip->tx_handler) purple_input_remove(sip->tx_handler); - if(sip->resendtimeout) purple_timeout_remove(sip->resendtimeout); - if(sip->registertimeout) purple_timeout_remove(sip->registertimeout); - } - g_free(gc->proto_data); - gc->proto_data = NULL; -} - -static PurplePluginProtocolInfo prpl_info = -{ - 0, - NULL, /* user_splits */ - NULL, /* protocol_options */ - NO_BUDDY_ICONS, /* icon_spec */ - simple_list_icon, /* list_icon */ - NULL, /* list_emblems */ - NULL, /* status_text */ - NULL, /* tooltip_text */ - simple_status_types, /* away_states */ - NULL, /* blist_node_menu */ - NULL, /* chat_info */ - NULL, /* chat_info_defaults */ - simple_login, /* login */ - simple_close, /* close */ - simple_im_send, /* send_im */ - NULL, /* set_info */ - simple_typing, /* send_typing */ - NULL, /* get_info */ - simple_set_status, /* set_status */ - NULL, /* set_idle */ - NULL, /* change_passwd */ - simple_add_buddy, /* add_buddy */ - NULL, /* add_buddies */ - simple_remove_buddy, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* rem_permit */ - NULL, /* rem_deny */ - NULL, /* set_permit_deny */ - NULL, /* join_chat */ - NULL, /* reject_chat */ - NULL, /* get_chat_name */ - NULL, /* chat_invite */ - NULL, /* chat_leave */ - NULL, /* chat_whisper */ - NULL, /* chat_send */ - simple_keep_alive, /* keepalive */ - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - NULL, /* normalize */ - NULL, /* set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* get_cb_real_name */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - simple_send_raw, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - NULL, /* send_attention */ - NULL, /* get_attention_types */ - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-simple", /**< id */ - "SIMPLE", /**< name */ - DISPLAY_VERSION, /**< version */ - N_("SIP/SIMPLE Protocol Plugin"), /** summary */ - N_("The SIP/SIMPLE Protocol Plugin"), /** description */ - "Thomas Butter ", /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - NULL, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void _init_plugin(PurplePlugin *plugin) -{ - PurpleAccountUserSplit *split; - PurpleAccountOption *option; - - split = purple_account_user_split_new(_("Server"), "", '@'); - prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); - - option = purple_account_option_bool_new(_("Publish status (note: everyone may watch you)"), "dopublish", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Connect port"), "port", 0); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use UDP"), "udp", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(_("Use proxy"), "useproxy", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("Proxy"), "proxy", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("Auth User"), "authuser", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_string_new(_("Auth Domain"), "authdomain", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -} - -PURPLE_INIT_PLUGIN(simple, _init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/simple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ -/** - * @file simple.h - * - * purple - * - * Copyright (C) 2005, Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_SIMPLE_H -#define _PURPLE_SIMPLE_H - -#include -#include - -#include "cipher.h" -#include "circbuffer.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "network.h" -#include "proxy.h" -#include "prpl.h" - -#include "sipmsg.h" - -#define SIMPLE_BUF_INC 1024 -#define SIMPLE_REGISTER_RETRY_MAX 2 - -#define SIMPLE_REGISTER_SENT 1 -#define SIMPLE_REGISTER_RETRY 2 -#define SIMPLE_REGISTER_COMPLETE 3 - -#define PUBLISH_EXPIRATION 600 -#define SUBSCRIBE_EXPIRATION 1200 - -struct sip_dialog { - gchar *ourtag; - gchar *theirtag; - gchar *callid; -}; - -struct simple_watcher { - gchar *name; - time_t expire; - struct sip_dialog dialog; - gboolean needsxpidf; -}; - -struct simple_buddy { - gchar *name; - time_t resubscribe; - struct sip_dialog *dialog; -}; - -struct sip_auth { - int type; /* 1 = Digest / 2 = NTLM */ - gchar *nonce; - gchar *opaque; - gchar *realm; - gchar *target; - guint32 flags; - int nc; - gchar *digest_session_key; - int retries; -}; - -struct simple_account_data { - PurpleConnection *gc; - gchar *servername; - gchar *username; - gchar *password; - PurpleDnsQueryData *query_data; - PurpleSrvQueryData *srv_query_data; - PurpleNetworkListenData *listen_data; - int fd; - int cseq; - time_t reregister; - time_t republish; - int registerstatus; /* 0 nothing, 1 first registration send, 2 auth received, 3 registered */ - struct sip_auth registrar; - struct sip_auth proxy; - int listenfd; - int listenport; - int listenpa; - gchar *status; - GHashTable *buddies; - guint registertimeout; - guint resendtimeout; - gboolean connecting; - PurpleAccount *account; - PurpleCircBuffer *txbuf; - guint tx_handler; - gchar *regcallid; - GSList *transactions; - GSList *watcher; - GSList *openconns; - gboolean udp; - struct sockaddr_in serveraddr; - int registerexpire; - gchar *realhostname; - int realport; /* port and hostname from SRV record */ - gchar *publish_etag; -}; - -struct sip_connection { - int fd; - gchar *inbuf; - int inbuflen; - int inbufused; - int inputhandler; -}; - -struct transaction; - -typedef gboolean (*TransCallback) (struct simple_account_data *, struct sipmsg *, struct transaction *); - -struct transaction { - time_t time; - int retries; - int transport; /* 0 = tcp, 1 = udp */ - int fd; - const gchar *cseq; - struct sipmsg *msg; - TransCallback callback; -}; - -#endif /* _PURPLE_SIMPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,222 +0,0 @@ -/** - * @file sipmsg.c - * - * purple - * - * Copyright (C) 2005 Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "accountopt.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "plugin.h" -#include "util.h" -#include "version.h" - -#include "simple.h" -#include "sipmsg.h" - -struct sipmsg *sipmsg_parse_msg(const gchar *msg) { - const char *tmp = strstr(msg, "\r\n\r\n"); - char *line; - struct sipmsg *smsg; - - if(!tmp) return NULL; - - line = g_strndup(msg, tmp - msg); - - smsg = sipmsg_parse_header(line); - if(smsg != NULL) - smsg->body = g_strdup(tmp + 4); - else - purple_debug_error("SIMPLE", "No header parsed from line: %s\n", line); - - g_free(line); - return smsg; -} - -struct sipmsg *sipmsg_parse_header(const gchar *header) { - struct sipmsg *msg = g_new0(struct sipmsg,1); - gchar **parts, **lines = g_strsplit(header,"\r\n",0); - gchar *dummy, *dummy2, *tmp; - const gchar *tmp2; - int i = 1; - - if(!lines[0]) { - g_strfreev(lines); - g_free(msg); - return NULL; - } - - parts = g_strsplit(lines[0], " ", 3); - if(!parts[0] || !parts[1] || !parts[2]) { - g_strfreev(parts); - g_strfreev(lines); - g_free(msg); - return NULL; - } - - if(strstr(parts[0],"SIP")) { /* numeric response */ - msg->method = g_strdup(parts[2]); - msg->response = strtol(parts[1],NULL,10); - } else { /* request */ - msg->method = g_strdup(parts[0]); - msg->target = g_strdup(parts[1]); - msg->response = 0; - } - g_strfreev(parts); - - for(i=1; lines[i] && strlen(lines[i])>2; i++) { - parts = g_strsplit(lines[i], ":", 2); - if(!parts[0] || !parts[1]) { - g_strfreev(parts); - g_strfreev(lines); - g_free(msg); - return NULL; - } - dummy = parts[1]; - dummy2 = 0; - while(*dummy==' ' || *dummy=='\t') dummy++; - dummy2 = g_strdup(dummy); - while(lines[i+1] && (lines[i+1][0]==' ' || lines[i+1][0]=='\t')) { - i++; - dummy = lines[i]; - while(*dummy==' ' || *dummy=='\t') dummy++; - tmp = g_strdup_printf("%s %s",dummy2, dummy); - g_free(dummy2); - dummy2 = tmp; - } - sipmsg_add_header(msg, parts[0], dummy2); - g_strfreev(parts); - } - g_strfreev(lines); - - tmp2 = sipmsg_find_header(msg, "Content-Length"); - if (tmp2 != NULL) - msg->bodylen = strtol(tmp2, NULL, 10); - - if(msg->response) { - tmp2 = sipmsg_find_header(msg, "CSeq"); - if(!tmp2) { - /* SHOULD NOT HAPPEN */ - msg->method = 0; - } else { - parts = g_strsplit(tmp2, " ", 2); - msg->method = g_strdup(parts[1]); - g_strfreev(parts); - } - } - - return msg; -} - -void sipmsg_print(const struct sipmsg *msg) { - GSList *cur; - struct siphdrelement *elem; - purple_debug(PURPLE_DEBUG_MISC, "simple", "SIP MSG\n"); - purple_debug(PURPLE_DEBUG_MISC, "simple", "response: %d\nmethod: %s\nbodylen: %d\n",msg->response,msg->method,msg->bodylen); - if(msg->target) purple_debug(PURPLE_DEBUG_MISC, "simple", "target: %s\n",msg->target); - cur = msg->headers; - while(cur) { - elem = cur->data; - purple_debug(PURPLE_DEBUG_MISC, "simple", "name: %s value: %s\n",elem->name, elem->value); - cur = g_slist_next(cur); - } -} - -char *sipmsg_to_string(const struct sipmsg *msg) { - GSList *cur; - GString *outstr = g_string_new(""); - struct siphdrelement *elem; - - if(msg->response) - g_string_append_printf(outstr, "SIP/2.0 %d Unknown\r\n", - msg->response); - else - g_string_append_printf(outstr, "%s %s SIP/2.0\r\n", - msg->method, msg->target); - - cur = msg->headers; - while(cur) { - elem = cur->data; - g_string_append_printf(outstr, "%s: %s\r\n", elem->name, - elem->value); - cur = g_slist_next(cur); - } - - g_string_append_printf(outstr, "\r\n%s", msg->bodylen ? msg->body : ""); - - return g_string_free(outstr, FALSE); -} -void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value) { - struct siphdrelement *element = g_new0(struct siphdrelement,1); - element->name = g_strdup(name); - element->value = g_strdup(value); - msg->headers = g_slist_append(msg->headers, element); -} - -void sipmsg_free(struct sipmsg *msg) { - struct siphdrelement *elem; - while(msg->headers) { - elem = msg->headers->data; - msg->headers = g_slist_remove(msg->headers,elem); - g_free(elem->name); - g_free(elem->value); - g_free(elem); - } - g_free(msg->method); - g_free(msg->target); - g_free(msg->body); - g_free(msg); -} - -void sipmsg_remove_header(struct sipmsg *msg, const gchar *name) { - struct siphdrelement *elem; - GSList *tmp = msg->headers; - while(tmp) { - elem = tmp->data; - if(g_ascii_strcasecmp(elem->name, name)==0) { - msg->headers = g_slist_remove(msg->headers, elem); - g_free(elem->name); - g_free(elem->value); - g_free(elem); - return; - } - tmp = g_slist_next(tmp); - } - return; -} - -const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name) { - GSList *tmp; - struct siphdrelement *elem; - tmp = msg->headers; - while(tmp) { - elem = tmp->data; - if(g_ascii_strcasecmp(elem->name, name)==0) { - return elem->value; - } - tmp = g_slist_next(tmp); - } - return NULL; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/simple/sipmsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** - * @file sipmsg.h - * - * purple - * - * Copyright (C) 2005, Thomas Butter - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_SIPMSG_H -#define _PURPLE_SIPMSG_H - -#include - -struct sipmsg { - int response; /* 0 means request, otherwise response code */ - gchar *method; - gchar *target; - GSList *headers; - int bodylen; - gchar *body; -}; - -struct siphdrelement { - gchar *name; - gchar *value; -}; - -struct sipmsg *sipmsg_parse_msg(const gchar *msg); -struct sipmsg *sipmsg_parse_header(const gchar *header); -void sipmsg_add_header(struct sipmsg *msg, const gchar *name, const gchar *value); -void sipmsg_free(struct sipmsg *msg); -const gchar *sipmsg_find_header(struct sipmsg *msg, const gchar *name); -void sipmsg_remove_header(struct sipmsg *msg, const gchar *name); -void sipmsg_print(const struct sipmsg *msg); -char *sipmsg_to_string(const struct sipmsg *msg); -#endif /* _PURPLE_SIMPLE_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoo.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoo.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoo.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoo.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,352 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include -#include - -#include "libymsg.h" -#include "yahoochat.h" -#include "yahoo_aliases.h" -#include "yahoo_doodle.h" -#include "yahoo_filexfer.h" -#include "yahoo_picture.h" - -static PurplePlugin *my_protocol = NULL; - -static void yahoo_register_commands(void) -{ - purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoopurple_cmd_chat_join, - _("join <room>: Join a chat room on the Yahoo network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoopurple_cmd_chat_list, - _("list: List rooms on the Yahoo network"), NULL); - purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoopurple_cmd_buzz, - _("buzz: Buzz a user to get their attention"), NULL); - purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoo", yahoo_doodle_purple_cmd_start, - _("doodle: Request user to start a Doodle session"), NULL); -} - -static PurpleAccount *find_acct(const char *prpl, const char *acct_id) -{ - PurpleAccount *acct = NULL; - - /* If we have a specific acct, use it */ - if (acct_id) { - acct = purple_accounts_find(acct_id, prpl); - if (acct && !purple_account_is_connected(acct)) - acct = NULL; - } else { /* Otherwise find an active account for the protocol */ - GList *l = purple_accounts_get_all(); - while (l) { - if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) - && purple_account_is_connected(l->data)) { - acct = l->data; - break; - } - l = l->next; - } - } - - return acct; -} - -/* This may not be the best way to do this, but we find the first key w/o a value - * and assume it is the buddy name */ -static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data) -{ - char **retval = user_data; - - if (value == NULL && *retval == NULL) { - *retval = key; - } -} - -static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params) -{ - char *acct_id = g_hash_table_lookup(params, "account"); - PurpleAccount *acct; - - if (g_ascii_strcasecmp(proto, "ymsgr")) - return FALSE; - - acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); - - if (!acct) - return FALSE; - - /* ymsgr:SendIM?screename&m=The+Message */ - if (!g_ascii_strcasecmp(cmd, "SendIM")) { - char *sname = NULL; - g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname); - if (sname) { - char *message = g_hash_table_lookup(params, "m"); - - PurpleConversation *conv = purple_find_conversation_with_account( - PURPLE_CONV_TYPE_IM, sname, acct); - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); - purple_conversation_present(conv); - - if (message) { - /* Spaces are encoded as '+' */ - g_strdelimit(message, "+", ' '); - purple_conv_send_confirm(conv, message); - } - } - /* else - **If pidgindialogs_im() was in the core, we could use it here. - * It is all purple_request_* based, but I'm not sure it really belongs in the core - pidgindialogs_im(); */ - - return TRUE; - } - /* ymsgr:Chat?roomname */ - else if (!g_ascii_strcasecmp(cmd, "Chat")) { - char *rname = NULL; - g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname); - if (rname) { - /* This is somewhat hacky, but the params aren't useful after this command */ - g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); - g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat")); - serv_join_chat(purple_account_get_connection(acct), params); - } - /* else - ** Same as above (except that this would have to be re-written using purple_request_*) - pidgin_blist_joinchat_show(); */ - - return TRUE; - } - /* ymsgr:AddFriend?name */ - else if (!g_ascii_strcasecmp(cmd, "AddFriend")) { - char *name = NULL; - g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name); - purple_blist_request_add_buddy(acct, name, NULL, NULL); - return TRUE; - } - - return FALSE; -} - -static GHashTable * -yahoo_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo ID...")); - return table; -} - -static gboolean yahoo_unload_plugin(PurplePlugin *plugin) -{ - yahoo_dest_colorht(); - - return TRUE; -} - -static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = -{ - yahoo_doodle_start, - yahoo_doodle_end, - yahoo_doodle_get_dimensions, - NULL, - yahoo_doodle_get_brush, - yahoo_doodle_set_brush, - yahoo_doodle_send_draw_list, - yahoo_doodle_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, - yahoo_list_icon, - yahoo_list_emblem, - yahoo_status_text, - yahoo_tooltip_text, - yahoo_status_types, - yahoo_blist_node_menu, - yahoo_c_info, - yahoo_c_info_defaults, - yahoo_login, - yahoo_close, - yahoo_send_im, - NULL, /* set info */ - yahoo_send_typing, - yahoo_get_info, - yahoo_set_status, - yahoo_set_idle, - NULL, /* change_passwd*/ - yahoo_add_buddy, - NULL, /* add_buddies */ - yahoo_remove_buddy, - NULL, /* remove_buddies */ - NULL, /* add_permit */ - yahoo_add_deny, - NULL, /* rem_permit */ - yahoo_rem_deny, - yahoo_set_permit_deny, - yahoo_c_join, - NULL, /* reject chat invite */ - yahoo_get_chat_name, - yahoo_c_invite, - yahoo_c_leave, - NULL, /* chat whisper */ - yahoo_c_send, - yahoo_keepalive, - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - yahoo_update_alias, /* alias_buddy */ - yahoo_change_buddys_group, - yahoo_rename_group, - NULL, /* buddy_free */ - NULL, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - yahoo_set_buddy_icon, - NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/ - NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - yahoo_roomlist_get_list, - yahoo_roomlist_cancel, - yahoo_roomlist_expand_category, - yahoo_can_receive_file, /* can_receive_file */ - yahoo_send_file, - yahoo_new_xfer, - yahoo_offline_message, /* offline_message */ - &yahoo_whiteboard_prpl_ops, - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - - yahoo_send_attention, - yahoo_attention_types, - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - yahoo_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "prpl-yahoo", /**< id */ - "Yahoo", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Yahoo! Protocol Plugin"), - /** description */ - N_("Yahoo! Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - NULL, /**< load */ - yahoo_unload_plugin, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - yahoo_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use account proxy for SSL connections"), "proxy_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - -#if 0 - option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - my_protocol = plugin; - yahoo_register_commands(); - yahoo_init_colorht(); - - purple_signal_connect(purple_get_core(), "uri-handler", plugin, - PURPLE_CALLBACK(yahoo_uri_handler), NULL); -} - -PURPLE_INIT_PLUGIN(yahoo, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoojp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoojp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoojp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libyahoojp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,245 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include - -#include "libymsg.h" -#include "yahoochat.h" -#include "yahoo_aliases.h" -#include "yahoo_doodle.h" -#include "yahoo_filexfer.h" -#include "yahoo_picture.h" - -static void yahoojp_register_commands(void) -{ - purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoopurple_cmd_chat_join, - _("join <room>: Join a chat room on the Yahoo network"), NULL); - purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | - PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoopurple_cmd_chat_list, - _("list: List rooms on the Yahoo network"), NULL); - purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoopurple_cmd_buzz, - _("buzz: Buzz a user to get their attention"), NULL); - purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-yahoojp", yahoo_doodle_purple_cmd_start, - _("doodle: Request user to start a Doodle session"), NULL); -} - -static GHashTable * -yahoojp_get_account_text_table(PurpleAccount *account) -{ - GHashTable *table; - table = g_hash_table_new(g_str_hash, g_str_equal); - g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo JAPAN ID...")); - return table; -} - -static gboolean yahoojp_unload_plugin(PurplePlugin *plugin) -{ - yahoo_dest_colorht(); - - return TRUE; -} - -static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = -{ - yahoo_doodle_start, - yahoo_doodle_end, - yahoo_doodle_get_dimensions, - NULL, - yahoo_doodle_get_brush, - yahoo_doodle_set_brush, - yahoo_doodle_send_draw_list, - yahoo_doodle_clear, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static PurplePluginProtocolInfo prpl_info = -{ - OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, - NULL, /* user_splits */ - NULL, /* protocol_options */ - {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, - yahoo_list_icon, - yahoo_list_emblem, - yahoo_status_text, - yahoo_tooltip_text, - yahoo_status_types, - yahoo_blist_node_menu, - yahoo_c_info, - yahoo_c_info_defaults, - yahoo_login, - yahoo_close, - yahoo_send_im, - NULL, /* set info */ - yahoo_send_typing, - yahoo_get_info, - yahoo_set_status, - yahoo_set_idle, - NULL, /* change_passwd*/ - yahoo_add_buddy, - NULL, /* add_buddies */ - yahoo_remove_buddy, - NULL, /* remove_buddies */ - NULL, /* add_permit */ - yahoo_add_deny, - NULL, /* rem_permit */ - yahoo_rem_deny, - yahoo_set_permit_deny, - yahoo_c_join, - NULL, /* reject chat invite */ - yahoo_get_chat_name, - yahoo_c_invite, - yahoo_c_leave, - NULL, /* chat whisper */ - yahoo_c_send, - yahoo_keepalive, - NULL, /* register_user */ - NULL, /* get_cb_info */ - NULL, /* get_cb_away */ - yahoo_update_alias, /* alias_buddy */ - yahoo_change_buddys_group, - yahoo_rename_group, - NULL, /* buddy_free */ - NULL, /* convo_closed */ - purple_normalize_nocase, /* normalize */ - yahoo_set_buddy_icon, - NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/ - NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */ - NULL, /* set_chat_topic */ - NULL, /* find_blist_chat */ - yahoo_roomlist_get_list, - yahoo_roomlist_cancel, - yahoo_roomlist_expand_category, - NULL, /* can_receive_file */ - yahoo_send_file, - yahoo_new_xfer, - yahoo_offline_message, /* offline_message */ - &yahoo_whiteboard_prpl_ops, - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - NULL, /* unregister_user */ - - yahoo_send_attention, - yahoo_attention_types, - - sizeof(PurplePluginProtocolInfo), /* struct_size */ - yahoojp_get_account_text_table, /* get_account_text_table */ - NULL, /* initiate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = -{ - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - "prpl-yahoojp", /**< id */ - "Yahoo JAPAN", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Yahoo! JAPAN Protocol Plugin"), - /** description */ - N_("Yahoo! JAPAN Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - NULL, /**< load */ - yahoojp_unload_plugin, /**< unload */ - NULL, /**< destroy */ - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - yahoo_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void -init_plugin(PurplePlugin *plugin) -{ - PurpleAccountOption *option; - - option = purple_account_option_string_new(_("Pager server"), "server", YAHOOJP_PAGER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOOJP_XFER_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOOJP_ROOMLIST_LOCALE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encoding"), "local_charset", "UTF-8"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Use account proxy for SSL connections"), "proxy_ssl", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - -#if 0 - option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); -#endif - - yahoojp_register_commands(); - yahoo_init_colorht(); -} - -PURPLE_INIT_PLUGIN(yahoojp, init_plugin, info); - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5139 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cipher.h" -#include "cmds.h" -#include "core.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "server.h" -#include "util.h" -#include "version.h" -#include "xmlnode.h" - -#include "libymsg.h" -#include "yahoochat.h" -#include "yahoo_aliases.h" -#include "yahoo_doodle.h" -#include "yahoo_filexfer.h" -#include "yahoo_friend.h" -#include "yahoo_packet.h" -#include "yahoo_picture.h" -#include "ycht.h" - -/* #define YAHOO_DEBUG */ - -/* #define TRY_WEBMESSENGER_LOGIN 0 */ - -/* One hour */ -#define PING_TIMEOUT 3600 - -/* One minute */ -#define KEEPALIVE_TIMEOUT 60 - -#ifdef TRY_WEBMESSENGER_LOGIN -static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); -#endif /* TRY_WEBMESSENGER_LOGIN */ - -static gboolean yahoo_is_japan(PurpleAccount *account) -{ - return purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoojp"); -} - -static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) -{ - char *status = NULL; - - if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name)) - return; - - switch (f->status) { - case YAHOO_STATUS_OFFLINE: - status = YAHOO_STATUS_TYPE_OFFLINE; - break; - case YAHOO_STATUS_AVAILABLE: - status = YAHOO_STATUS_TYPE_AVAILABLE; - break; - case YAHOO_STATUS_BRB: - status = YAHOO_STATUS_TYPE_BRB; - break; - case YAHOO_STATUS_BUSY: - status = YAHOO_STATUS_TYPE_BUSY; - break; - case YAHOO_STATUS_NOTATHOME: - status = YAHOO_STATUS_TYPE_NOTATHOME; - break; - case YAHOO_STATUS_NOTATDESK: - status = YAHOO_STATUS_TYPE_NOTATDESK; - break; - case YAHOO_STATUS_NOTINOFFICE: - status = YAHOO_STATUS_TYPE_NOTINOFFICE; - break; - case YAHOO_STATUS_ONPHONE: - status = YAHOO_STATUS_TYPE_ONPHONE; - break; - case YAHOO_STATUS_ONVACATION: - status = YAHOO_STATUS_TYPE_ONVACATION; - break; - case YAHOO_STATUS_OUTTOLUNCH: - status = YAHOO_STATUS_TYPE_OUTTOLUNCH; - break; - case YAHOO_STATUS_STEPPEDOUT: - status = YAHOO_STATUS_TYPE_STEPPEDOUT; - break; - case YAHOO_STATUS_INVISIBLE: /* this should never happen? */ - status = YAHOO_STATUS_TYPE_INVISIBLE; - break; - case YAHOO_STATUS_CUSTOM: - case YAHOO_STATUS_IDLE: - if (!f->away) - status = YAHOO_STATUS_TYPE_AVAILABLE; - else - status = YAHOO_STATUS_TYPE_AWAY; - break; - default: - purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); - break; - } - - if (status) { - if (f->status == YAHOO_STATUS_CUSTOM) - purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message", - yahoo_friend_get_status_message(f), NULL); - else - purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL); - } - - if (f->idle != 0) - purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle); - else - purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0); - - if (f->sms) - purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); - else - purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); -} - -static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - GSList *l = pkt->hash; - YahooFriend *f = NULL; - char *name = NULL; - gboolean unicode = FALSE; - char *message = NULL; - YahooFederation fed = YAHOO_FEDERATION_NONE; - char *fedname = NULL; - - if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, - _("You have signed on from another location")); - return; - } - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 0: /* we won't actually do anything with this */ - case 1: /* we won't actually do anything with this */ - break; - case 8: /* how many online buddies we have */ - break; - case 7: /* the current buddy */ - /* update the previous buddy before changing the variables */ - if (f) { - if (message) - yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); - if (name) - yahoo_update_status(gc, name, f); - } - name = message = NULL; - f = NULL; - if (pair->value && g_utf8_validate(pair->value, -1, NULL)) { - GSList *tmplist; - - name = pair->value; - - /* Look ahead to see if we have the federation info about the buddy */ - for (tmplist = l->next; tmplist; tmplist = tmplist->next) { - struct yahoo_pair *p = tmplist->data; - if (p->key == 7) - break; - if (p->key == 241) { - fed = strtol(p->value, NULL, 10); - g_free(fedname); - switch (fed) { - case YAHOO_FEDERATION_MSN: - name = fedname = g_strconcat("msn/", name, NULL); - break; - case YAHOO_FEDERATION_OCS: - name = fedname = g_strconcat("ocs/", name, NULL); - break; - case YAHOO_FEDERATION_IBM: - name = fedname = g_strconcat("ibm/", name, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - fedname = NULL; - break; - } - break; - } - } - f = yahoo_friend_find_or_new(gc, name); - f->fed = fed; - } - break; - case 10: /* state */ - if (!f) - break; - - f->status = strtol(pair->value, NULL, 10); - if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT)) - f->away = 1; - else - f->away = 0; - - if (f->status == YAHOO_STATUS_IDLE) { - /* Idle may have already been set in a more precise way in case 137 */ - if (f->idle == 0) - { - if(pkt->service == YAHOO_SERVICE_STATUS_15) - f->idle = -1; - else - f->idle = time(NULL); - } - } else - f->idle = 0; - - if (f->status != YAHOO_STATUS_CUSTOM) - yahoo_friend_set_status_message(f, NULL); - - f->sms = 0; - break; - case 19: /* custom message */ - if (f) - message = pair->value; - break; - case 11: /* this is the buddy's session id */ - if (f) - f->session_id = strtol(pair->value, NULL, 10); - break; - case 17: /* in chat? */ - break; - case 47: /* is custom status away or not? 2=idle*/ - if (!f) - break; - - /* I have no idea what it means when this is - * set when someone's available, but it doesn't - * mean idle. */ - if (f->status == YAHOO_STATUS_AVAILABLE) - break; - - f->away = strtol(pair->value, NULL, 10); - if (f->away == 2) { - /* Idle may have already been set in a more precise way in case 137 */ - if (f->idle == 0) - { - if(pkt->service == YAHOO_SERVICE_STATUS_15) - f->idle = -1; - else - f->idle = time(NULL); - } - } - - break; - case 138: /* when value is 1, either we're not idle, or we are but won't say how long */ - if (!f) - break; - - if( (strtol(pair->value, NULL, 10) == 1) && (f->idle) ) - f->idle = -1; - break; - case 137: /* usually idle time in seconds, sometimes login time */ - if (!f) - break; - - if (f->status != YAHOO_STATUS_AVAILABLE) - f->idle = time(NULL) - strtol(pair->value, NULL, 10); - break; - case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ - if (strtol(pair->value, NULL, 10) == 0) { - if (f) - f->status = YAHOO_STATUS_OFFLINE; - if (name) { - purple_prpl_got_user_status(account, name, "offline", NULL); - purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); - } - break; - } - break; - case 60: /* SMS */ - if (f) { - f->sms = strtol(pair->value, NULL, 10); - yahoo_update_status(gc, name, f); - } - break; - case 197: /* Avatars */ - { - guchar *decoded; - char *tmp; - gsize len; - - if (pair->value) { - decoded = purple_base64_decode(pair->value, &len); - if (len) { - tmp = purple_str_binary_to_ascii(decoded, len); - purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp); - g_free(tmp); - } - g_free(decoded); - } - break; - } - case 192: /* Pictures, aka Buddy Icons, checksum */ - { - /* FIXME: Please, if you know this protocol, - * FIXME: fix up the strtol() stuff if possible. */ - int cksum = strtol(pair->value, NULL, 10); - const char *locksum = NULL; - PurpleBuddy *b; - - if (!name) - break; - - b = purple_find_buddy(gc->account, name); - - if (!cksum || (cksum == -1)) { - if (f) - yahoo_friend_set_buddy_icon_need_request(f, TRUE); - purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); - break; - } - - if (!f) - break; - - yahoo_friend_set_buddy_icon_need_request(f, FALSE); - if (b) { - locksum = purple_buddy_icons_get_checksum_for_user(b); - if (!locksum || (cksum != strtol(locksum, NULL, 10))) - yahoo_send_picture_request(gc, name); - } - - break; - } - case 16: /* Custom error message */ - { - char *tmp = yahoo_string_decode(gc, pair->value, TRUE); - purple_notify_error(gc, NULL, tmp, NULL); - g_free(tmp); - } - break; - case 97: /* Unicode status message */ - unicode = !strcmp(pair->value, "1"); - break; - case 244: /* client version number. Yahoo Client Detection */ - if(f && strtol(pair->value, NULL, 10)) - f->version_id = strtol(pair->value, NULL, 10); - break; - case 241: /* Federated network buddy belongs to */ - break; /* We process this when get '7' */ - default: - purple_debug_warning("yahoo", - "Unknown status key %d\n", pair->key); - break; - } - - l = l->next; - } - - if (f) { - if (pkt->service == YAHOO_SERVICE_LOGOFF) - f->status = YAHOO_STATUS_OFFLINE; - if (message) - yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); - - if (name) /* update the last buddy */ - yahoo_update_status(gc, name, f); - } - - g_free(fedname); -} - -static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) -{ - PurpleBuddy *b; - PurpleGroup *g; - GSList *list, *i; - gboolean onlist = 0; - char *oname = NULL; - char **oname_p = &oname; - GSList **list_p = &list; - - if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) - list = purple_find_buddies(account, name); - else - g_hash_table_steal(ht, name); - - for (i = list; i; i = i->next) { - b = i->data; - g = purple_buddy_get_group(b); - if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { - purple_debug_misc("yahoo", - "Oh good, %s is in the right group (%s).\n", name, group); - list = g_slist_delete_link(list, i); - onlist = 1; - break; - } - } - - if (!onlist) { - purple_debug_misc("yahoo", - "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); - if (!(g = purple_find_group(group))) { - g = purple_group_new(group); - purple_blist_add_group(g, NULL); - } - b = purple_buddy_new(account, name, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - - if (list) { - if (!oname) - oname = g_strdup(purple_normalize(account, name)); - g_hash_table_insert(ht, oname, list); - } else if (oname) - g_free(oname); -} - -static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) -{ - char *name = key; - GSList *list = value, *i; - PurpleBuddy *b; - PurpleGroup *g; - - for (i = list; i; i = i->next) { - b = i->data; - g = purple_buddy_get_group(b); - purple_debug_misc("yahoo", "Deleting Buddy %s from group %s.\n", name, - purple_group_get_name(g)); - purple_blist_remove_buddy(b); - } -} - -static char *_getcookie(char *rawcookie) -{ - char *cookie = NULL; - char *tmpcookie; - char *cookieend; - - if (strlen(rawcookie) < 2) - return NULL; - tmpcookie = g_strdup(rawcookie+2); - cookieend = strchr(tmpcookie, ';'); - - if (cookieend) - *cookieend = '\0'; - - cookie = g_strdup(tmpcookie); - g_free(tmpcookie); - - return cookie; -} - -static void yahoo_process_cookie(YahooData *yd, char *c) -{ - if (c[0] == 'Y') { - if (yd->cookie_y) - g_free(yd->cookie_y); - yd->cookie_y = _getcookie(c); - } else if (c[0] == 'T') { - if (yd->cookie_t) - g_free(yd->cookie_t); - yd->cookie_t = _getcookie(c); - } else - purple_debug_info("yahoo", "Unrecognized cookie '%c'\n", c[0]); - yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c)); -} - -static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - GHashTable *ht; - char *norm_bud = NULL; - char *temp = NULL; - YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ - /* But what if you had no friends? */ - PurpleBuddy *b; - PurpleGroup *g; - YahooFederation fed = YAHOO_FEDERATION_NONE; - int stealth = 0; - - ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); - - while (l) { - struct yahoo_pair *pair = l->data; - l = l->next; - - switch (pair->key) { - case 302: - /* This is always 318 before a group, 319 before the first s/n in a group, 320 before any ignored s/n. - * It is not sent for s/n's in a group after the first. - * All ignored s/n's are listed last, so when we see a 320 we clear the group and begin marking the - * s/n's as ignored. It is always followed by an identical 300 key. - */ - if (pair->value && !strcmp(pair->value, "320")) { - /* No longer in any group; this indicates the start of the ignore list. */ - g_free(yd->current_list15_grp); - yd->current_list15_grp = NULL; - } - - break; - case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */ - if(temp != NULL) { - switch (fed) { - case YAHOO_FEDERATION_MSN: - norm_bud = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - norm_bud = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - norm_bud = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_PBX: - norm_bud = g_strconcat("pbx/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - norm_bud = g_strdup(temp); - break; - } - if (yd->current_list15_grp) { - /* This buddy is in a group */ - f = yahoo_friend_find_or_new(gc, norm_bud); - if (!(b = purple_find_buddy(account, norm_bud))) { - if (!(g = purple_find_group(yd->current_list15_grp))) { - g = purple_group_new(yd->current_list15_grp); - purple_blist_add_group(g, NULL); - } - b = purple_buddy_new(account, norm_bud, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp); - if(fed) { - f->fed = fed; - purple_debug_info("yahoo", "Setting federation to %d\n", f->fed); - } - if(stealth == 2) - f->presence = YAHOO_PRESENCE_PERM_OFFLINE; - - /* set p2p status not connected and no p2p packet sent */ - if(fed == YAHOO_FEDERATION_NONE) { - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - f->p2p_packet_sent = 0; - } else - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); - } else { - /* This buddy is on the ignore list (and therefore in no group) */ - purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); - purple_privacy_deny_add(account, norm_bud, 1); - } - - g_free(norm_bud); - norm_bud=NULL; - fed = YAHOO_FEDERATION_NONE; - stealth = 0; - g_free(temp); - temp = NULL; - } - break; - case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ - break; - case 65: /* This is the group */ - g_free(yd->current_list15_grp); - yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 7: /* buddy's s/n */ - g_free(temp); - temp = g_strdup(purple_normalize(account, pair->value)); - break; - case 241: /* user on federated network */ - fed = strtol(pair->value, NULL, 10); - break; - case 59: /* somebody told cookies come here too, but im not sure */ - yahoo_process_cookie(yd, pair->value); - break; - case 317: /* Stealth Setting */ - stealth = strtol(pair->value, NULL, 10); - break; - /* case 242: */ /* this seems related to 241 */ - /* break; */ - } - } - - g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); - - /* The reporter of ticket #9745 determined that we weren't retrieving the - * aliases during buddy list retrieval, so we never updated aliases that - * changed while we were signed off. */ - yahoo_fetch_aliases(gc); - - /* Now that we have processed the buddy list, we can say yahoo has connected */ - purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account))); - yd->logged_in = TRUE; - purple_debug_info("yahoo","Authentication: Connection established\n"); - purple_connection_set_state(gc, PURPLE_CONNECTED); - if (yd->picture_upload_todo) { - yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); - yd->picture_upload_todo = NULL; - } - yahoo_set_status(account, purple_account_get_active_status(account)); - - g_hash_table_destroy(ht); - g_free(temp); -} - -static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - gboolean export = FALSE; - gboolean got_serv_list = FALSE; - PurpleBuddy *b; - PurpleGroup *g; - YahooFriend *f = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - GHashTable *ht; - - char **lines; - char **split; - char **buddies; - char **tmp, **bud, *norm_bud; - char *grp = NULL; - - if (pkt->id) - yd->session_id = pkt->id; - - while (l) { - struct yahoo_pair *pair = l->data; - l = l->next; - - switch (pair->key) { - case 87: - if (!yd->tmp_serv_blist) - yd->tmp_serv_blist = g_string_new(pair->value); - else - g_string_append(yd->tmp_serv_blist, pair->value); - break; - case 88: - if (!yd->tmp_serv_ilist) - yd->tmp_serv_ilist = g_string_new(pair->value); - else - g_string_append(yd->tmp_serv_ilist, pair->value); - break; - case 89: - yd->profiles = g_strsplit(pair->value, ",", -1); - break; - case 59: /* cookies, yum */ - yahoo_process_cookie(yd, pair->value); - break; - case YAHOO_SERVICE_PRESENCE_PERM: - if (!yd->tmp_serv_plist) - yd->tmp_serv_plist = g_string_new(pair->value); - else - g_string_append(yd->tmp_serv_plist, pair->value); - break; - } - } - - if (pkt->status != 0) - return; - - if (yd->tmp_serv_blist) { - ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); - - lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1); - for (tmp = lines; *tmp; tmp++) { - split = g_strsplit(*tmp, ":", 2); - if (!split) - continue; - if (!split[0] || !split[1]) { - g_strfreev(split); - continue; - } - grp = yahoo_string_decode(gc, split[0], FALSE); - buddies = g_strsplit(split[1], ",", -1); - for (bud = buddies; bud && *bud; bud++) { - norm_bud = g_strdup(purple_normalize(account, *bud)); - f = yahoo_friend_find_or_new(gc, norm_bud); - - if (!(b = purple_find_buddy(account, norm_bud))) { - if (!(g = purple_find_group(grp))) { - g = purple_group_new(grp); - purple_blist_add_group(g, NULL); - } - b = purple_buddy_new(account, norm_bud, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - export = TRUE; - } - - yahoo_do_group_check(account, ht, norm_bud, grp); - /* set p2p status not connected and no p2p packet sent */ - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - f->p2p_packet_sent = 0; - - g_free(norm_bud); - } - g_strfreev(buddies); - g_strfreev(split); - g_free(grp); - } - g_strfreev(lines); - - g_string_free(yd->tmp_serv_blist, TRUE); - yd->tmp_serv_blist = NULL; - g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); - g_hash_table_destroy(ht); - } - - if (yd->tmp_serv_ilist) { - buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); - for (bud = buddies; bud && *bud; bud++) { - /* The server is already ignoring the user */ - got_serv_list = TRUE; - purple_privacy_deny_add(account, *bud, 1); - } - g_strfreev(buddies); - - g_string_free(yd->tmp_serv_ilist, TRUE); - yd->tmp_serv_ilist = NULL; - } - - if (got_serv_list && - ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && - (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && - (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) - { - account->perm_deny = PURPLE_PRIVACY_DENY_USERS; - purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", - account->username); - } - - if (yd->tmp_serv_plist) { - buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); - for (bud = buddies; bud && *bud; bud++) { - f = yahoo_friend_find(gc, *bud); - if (f) { - purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", - account->username, *bud); - f->presence = YAHOO_PRESENCE_PERM_OFFLINE; - } - } - g_strfreev(buddies); - g_string_free(yd->tmp_serv_plist, TRUE); - yd->tmp_serv_plist = NULL; - - } - /* Now that we've got the list, request aliases */ - yahoo_fetch_aliases(gc); -} - -/* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ -static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) -{ - PurpleAccount *account; - char *msg = NULL; - char *from = NULL; - char *stat = NULL; - char *game = NULL; - YahooFriend *f = NULL; - GSList *l = pkt->hash; - gint val_11 = 0; - YahooData *yd = gc->proto_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - account = purple_connection_get_account(gc); - - while (l) { - struct yahoo_pair *pair = l->data; - if (pair->key == 4 || pair->key == 1) - from = pair->value; - if (pair->key == 49) - msg = pair->value; - if (pair->key == 13) - stat = pair->value; - if (pair->key == 14) - game = pair->value; - if (pair->key == 11) - val_11 = strtol(pair->value, NULL, 10); - if (pair->key == 241) - fed = strtol(pair->value, NULL, 10); - l = l->next; - } - - if (!from || !msg) - return; - - /* disconnect the peer if connected through p2p and sends wrong value for session id */ - if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { - purple_debug_warning("yahoo","p2p: %s sent us notify with wrong session id. Disconnecting p2p connection to peer\n", from); - /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - g_hash_table_remove(yd->peers, from); - return; - } - - if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) - && (purple_privacy_check(account, from))) - { - char *fed_from = from; - switch (fed) { - case YAHOO_FEDERATION_MSN: - fed_from = g_strconcat("msn/", from, NULL); - break; - case YAHOO_FEDERATION_OCS: - fed_from = g_strconcat("ocs/", from, NULL); - break; - case YAHOO_FEDERATION_IBM: - fed_from = g_strconcat("ibm/", from, NULL); - break; - case YAHOO_FEDERATION_PBX: - fed_from = g_strconcat("pbx/", from, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - - if (*stat == '1') - serv_got_typing(gc, fed_from, 0, PURPLE_TYPING); - else - serv_got_typing_stopped(gc, fed_from); - - if (fed_from != from) - g_free(fed_from); - - } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { - PurpleBuddy *bud = purple_find_buddy(account, from); - - if (!bud) { - purple_debug_warning("yahoo", - "%s is playing a game, and doesn't want you to know.\n", from); - } - - f = yahoo_friend_find(gc, from); - if (!f) - return; /* if they're not on the list, don't bother */ - - yahoo_friend_set_game(f, NULL); - - if (*stat == '1') { - yahoo_friend_set_game(f, game); - if (bud) - yahoo_update_status(gc, from, f); - } - } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) { - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); - char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from); - purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); - g_free(buf); - } -} - - -struct _yahoo_im { - char *from; - char *active_id; - int time; - int utf8; - int buddy_icon; - char *id; - char *msg; - YahooFederation fed; - char *fed_from; -}; - -static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - GSList *l = pkt->hash; - struct _yahoo_im *sms = NULL; - YahooData *yd; - char *server_msg = NULL; - char *m; - - yd = gc->proto_data; - account = purple_connection_get_account(gc); - - while (l != NULL) { - struct yahoo_pair *pair = l->data; - if (pair->key == 4) { - sms = g_new0(struct _yahoo_im, 1); - sms->from = g_strdup_printf("+%s", pair->value); - sms->time = time(NULL); - sms->utf8 = TRUE; - } - if (pair->key == 14) { - if (sms) - sms->msg = pair->value; - } - if (pair->key == 68) - if(sms) - g_hash_table_insert(yd->sms_carrier, g_strdup(sms->from), g_strdup(pair->value)); - if (pair->key == 16) - server_msg = pair->value; - l = l->next; - } - - if( (pkt->status == -1) || (pkt->status == YAHOO_STATUS_DISCONNECTED) ) { - if (server_msg) { - PurpleConversation *c; - c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms->from, account); - if (c == NULL) - c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sms->from); - purple_conversation_write(c, NULL, server_msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - else - purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL); - - g_free(sms->from); - g_free(sms); - return ; - } - - if (!sms->from || !sms->msg) { - g_free(sms); - return; - } - - m = yahoo_string_decode(gc, sms->msg, sms->utf8); - serv_got_im(gc, sms->from, m, 0, sms->time); - - g_free(m); - g_free(sms->from); - g_free(sms); -} - -/* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ -static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) -{ - PurpleAccount *account; - YahooData *yd = gc->proto_data; - GSList *l = pkt->hash; - GSList *list = NULL; - struct _yahoo_im *im = NULL; - - account = purple_connection_get_account(gc); - - if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { - /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ - while (l != NULL) { - struct yahoo_pair *pair = l->data; - if (pair->key == 4 || pair->key == 1) { - im = g_new0(struct _yahoo_im, 1); - list = g_slist_append(list, im); - im->from = pair->value; - im->time = time(NULL); - im->utf8 = TRUE; - im->fed = YAHOO_FEDERATION_NONE; - im->fed_from = g_strdup(im->from); - } - if (im && pair->key == 5) - im->active_id = pair->value; - if (pair->key == 97) - if (im) - im->utf8 = strtol(pair->value, NULL, 10); - if (pair->key == 15) - if (im) - im->time = strtol(pair->value, NULL, 10); - if (pair->key == 206) - if (im) - im->buddy_icon = strtol(pair->value, NULL, 10); - if (pair->key == 14) { - if (im) - im->msg = pair->value; - } - if (im && pair->key == 241) { - im->fed = strtol(pair->value, NULL, 10); - g_free(im->fed_from); - switch (im->fed) { - case YAHOO_FEDERATION_MSN: - im->fed_from = g_strconcat("msn/",im->from, NULL); - break; - case YAHOO_FEDERATION_OCS: - im->fed_from = g_strconcat("ocs/",im->from, NULL); - break; - case YAHOO_FEDERATION_IBM: - im->fed_from = g_strconcat("ibm/",im->from, NULL); - break; - case YAHOO_FEDERATION_PBX: - im->fed_from = g_strconcat("pbx/",im->from, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - im->fed_from = g_strdup(im->from); - break; - } - purple_debug_info("yahoo", "Message from federated (%d) buddy %s.\n", im->fed, im->fed_from); - - } - /* peer session id */ - if (im && (pair->key == 11)) { - /* disconnect the peer if connected through p2p and sends wrong value for session id */ - if( (im->fed == YAHOO_FEDERATION_NONE) && (pkt_type == YAHOO_PKT_TYPE_P2P) - && (yd->session_id != strtol(pair->value, NULL, 10)) ) - { - purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->fed_from); - /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - g_hash_table_remove(yd->peers, im->fed_from); - g_free(im->fed_from); - g_free(im); - return; /* Not sure whether we should process remaining IMs in this packet */ - } - } - /* IMV key */ - if (im && pair->key == 63) - { - /* Check for the Doodle IMV, no IMvironment for federated buddies */ - if (im->from != NULL && im->fed == YAHOO_FEDERATION_NONE) - { - g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(pair->value)); - - if (strstr(pair->value, "doodle;") != NULL) - { - PurpleWhiteboard *wb; - - if (!purple_privacy_check(account, im->from)) { - purple_debug_info("yahoo", "Doodle request from %s dropped.\n", - im->from); - g_free(im->fed_from); - g_free(im); - return; - } - /* I'm not sure the following ever happens -DAA */ - wb = purple_whiteboard_get_session(account, im->from); - - /* If a Doodle session doesn't exist between this user */ - if(wb == NULL) - { - doodle_session *ds; - wb = purple_whiteboard_create(account, im->from, - DOODLE_STATE_REQUESTED); - ds = wb->proto_data; - ds->imv_key = g_strdup(pair->value); - - yahoo_doodle_command_send_request(gc, im->from, pair->value); - yahoo_doodle_command_send_ready(gc, im->from, pair->value); - } - } - } - } - if (pair->key == 429) - if (im) - im->id = pair->value; - l = l->next; - } - } else if (pkt->status == 2) { - purple_notify_error(gc, NULL, - _("Your Yahoo! message did not get sent."), NULL); - } - - for (l = list; l; l = l->next) { - YahooFriend *f; - char *m, *m2; - im = l->data; - - if (!im->fed_from || !im->msg) { - g_free(im->fed_from); - g_free(im); - continue; - } - - if (!purple_privacy_check(account, im->fed_from)) { - purple_debug_info("yahoo", "Message from %s dropped.\n", im->fed_from); - return; - } - - /* - * TODO: Is there anything else we should check when determining whether - * we should send an acknowledgement? - */ - if (im->id != NULL) { - /* Send acknowledgement. If we don't do this then the official - * Yahoo Messenger client for Windows will send us the same - * message 7 seconds later as an offline message. This is true - * for at least version 9.0.0.2162 on Windows XP. */ - struct yahoo_packet *pkt2; - pkt2 = yahoo_packet_new(YAHOO_SERVICE_MESSAGE_ACK, - YAHOO_STATUS_AVAILABLE, pkt->id); - yahoo_packet_hash(pkt2, "ssisii", - 1, im->active_id, /* May not always be the connection's display name */ - 5, im->from, - 302, 430, - 430, im->id, - 303, 430, - 450, 0); - yahoo_packet_send_and_free(pkt2, yd); - } - - m = yahoo_string_decode(gc, im->msg, im->utf8); - /* This may actually not be necessary, but it appears - * that at least at one point some clients were sending - * "\r\n" as line delimiters, so we want to avoid double - * lines. */ - m2 = purple_strreplace(m, "\r\n", "\n"); - g_free(m); - m = m2; - purple_util_chrreplace(m, '\r', '\n'); - if (!strcmp(m, "")) { - char *username; - - username = g_markup_escape_text(im->fed_from, -1); - purple_prpl_got_attention(gc, username, YAHOO_BUZZ); - g_free(username); - g_free(m); - g_free(im->fed_from); - g_free(im); - continue; - } - - m2 = yahoo_codes_to_html(m); - g_free(m); - - serv_got_im(gc, im->fed_from, m2, 0, im->time); - g_free(m2); - - /* Official clients don't share buddy images with federated buddies */ - if (im->fed == YAHOO_FEDERATION_NONE) { - if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) { - if (yahoo_friend_get_buddy_icon_need_request(f)) { - yahoo_send_picture_request(gc, im->from); - yahoo_friend_set_buddy_icon_need_request(f, FALSE); - } - } - } - - g_free(im->fed_from); - g_free(im); - } - - g_slist_free(list); -} - -static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *prim, *me = NULL, *msg = NULL; - - while (l) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 5) - me = pair->value; - if (pair->key == 14) - msg = pair->value; - - l = l->next; - } - - if (!msg || !g_utf8_validate(msg, -1, NULL)) - return; - - prim = g_strdup_printf(_("Yahoo! system message for %s:"), - me?me:purple_connection_get_display_name(gc)); - purple_notify_info(NULL, NULL, prim, msg); - g_free(prim); -} - -struct yahoo_add_request { - PurpleConnection *gc; - char *id; - char *who; - YahooFederation fed; -}; - -static void -yahoo_buddy_add_authorize_cb(gpointer data) -{ - struct yahoo_add_request *add_req = data; - struct yahoo_packet *pkt; - YahooData *yd = add_req->gc->proto_data; - const char *who = add_req->who; - - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - if (add_req->fed) { - who += 4; - yahoo_packet_hash(pkt, "ssiii", - 1, add_req->id, - 5, who, - 241, add_req->fed, - 13, 1, - 334, 0); - } - else { - yahoo_packet_hash(pkt, "ssii", - 1, add_req->id, - 5, who, - 13, 1, - 334, 0); - } - - yahoo_packet_send_and_free(pkt, yd); - - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); -} - -static void -yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) -{ - YahooData *yd = add_req->gc->proto_data; - struct yahoo_packet *pkt; - char *encoded_msg = NULL; - const char *who = add_req->who; - - if (msg && *msg) - encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL); - - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - if (add_req->fed) { - who += 4; /* Skip fed identifier (msn|ocs|ibm)/' */ - yahoo_packet_hash(pkt, "ssiiiis", - 1, add_req->id, - 5, who, - 241, add_req->fed, - 13, 2, - 334, 0, - 97, 1, - 14, encoded_msg ? encoded_msg : ""); - } - else { - yahoo_packet_hash(pkt, "ssiiis", - 1, add_req->id, - 5, who, - 13, 2, - 334, 0, - 97, 1, - 14, encoded_msg ? encoded_msg : ""); - } - - - yahoo_packet_send_and_free(pkt, yd); - - g_free(encoded_msg); - - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); -} - -static void -yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg) -{ - yahoo_buddy_add_deny_cb(add_req, NULL); -} - -static void -yahoo_buddy_add_deny_reason_cb(gpointer data) { - struct yahoo_add_request *add_req = data; - purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), - NULL, _("No reason given."), TRUE, FALSE, NULL, - _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), - _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), - purple_connection_get_account(add_req->gc), add_req->who, NULL, - add_req); -} - -static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) -{ - char *notify_msg; - YahooData *yd = gc->proto_data; - - if (who == NULL) - return; - - if (reason != NULL) { - char *msg2 = yahoo_string_decode(gc, reason, FALSE); - notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2); - g_free(msg2); - } else - notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list."), who); - - purple_notify_info(gc, NULL, _("Add buddy rejected"), notify_msg); - g_free(notify_msg); - - g_hash_table_remove(yd->friends, who); - purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */ - /* TODO: Shouldn't we remove the buddy from our local list? */ -} - -static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) { - PurpleAccount *account; - GSList *l = pkt->hash; - const char *msg = NULL; - - account = purple_connection_get_account(gc); - - /* Buddy authorized/declined our addition */ - if (pkt->status == 1) { - char *temp = NULL; - char *who = NULL; - int response = 0; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - temp = pair->value; - break; - case 13: - response = strtol(pair->value, NULL, 10); - break; - case 14: - msg = pair->value; - break; - case 241: - fed = strtol(pair->value, NULL, 10); - break; - } - l = l->next; - } - - switch (fed) { - case YAHOO_FEDERATION_MSN: - who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - who = g_strdup(temp); - break; - } - - if (response == 1) /* Authorized */ - purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); - else if (response == 2) { /* Declined */ - purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); - yahoo_buddy_denied_our_add(gc, who, msg); - } else - purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)"); - g_free(who); - } - /* Buddy requested authorization to add us. */ - else if (pkt->status == 3) { - struct yahoo_add_request *add_req; - const char *firstname = NULL, *lastname = NULL; - char *temp = NULL; - - add_req = g_new0(struct yahoo_add_request, 1); - add_req->gc = gc; - add_req->fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - temp = pair->value; - break; - case 5: - add_req->id = g_strdup(pair->value); - break; - case 14: - msg = pair->value; - break; - case 216: - firstname = pair->value; - break; - case 241: - add_req->fed = strtol(pair->value, NULL, 10); - break; - case 254: - lastname = pair->value; - break; - - } - l = l->next; - } - switch (add_req->fed) { - case YAHOO_FEDERATION_MSN: - add_req->who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - add_req->who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - add_req->who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - add_req->who = g_strdup(temp); - break; - } - - if (add_req->id && add_req->who) { - char *alias = NULL, *dec_msg = NULL; - - if (!purple_privacy_check(account, add_req->who)) - { - purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", - add_req->who); - yahoo_buddy_add_deny_cb(add_req, NULL); - return; - } - - if (msg) - dec_msg = yahoo_string_decode(gc, msg, FALSE); - - if (firstname && lastname) - alias = g_strdup_printf("%s %s", firstname, lastname); - else if (firstname) - alias = g_strdup(firstname); - else if (lastname) - alias = g_strdup(lastname); - - /* DONE! this is almost exactly the same as what MSN does, - * this should probably be moved to the core. - */ - purple_account_request_authorization(account, add_req->who, add_req->id, - alias, dec_msg, - purple_find_buddy(account, add_req->who) != NULL, - yahoo_buddy_add_authorize_cb, - yahoo_buddy_add_deny_reason_cb, - add_req); - g_free(alias); - g_free(dec_msg); - } else { - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); - } - } else { - purple_debug_error("yahoo", "Received authorization of unknown status (%d).\n", pkt->status); - } -} - -/* I don't think this happens anymore in Version 15 */ -static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { - PurpleAccount *account; - struct yahoo_add_request *add_req; - char *msg = NULL; - GSList *l = pkt->hash; - - account = purple_connection_get_account(gc); - - add_req = g_new0(struct yahoo_add_request, 1); - add_req->gc = gc; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 1: - add_req->id = g_strdup(pair->value); - break; - case 3: - add_req->who = g_strdup(pair->value); - break; - case 15: /* time, for when they add us and we're offline */ - break; - case 14: - msg = pair->value; - break; - } - l = l->next; - } - - if (add_req->id && add_req->who) { - char *dec_msg = NULL; - - if (!purple_privacy_check(account, add_req->who)) { - purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", - add_req->who); - yahoo_buddy_add_deny_cb(add_req, NULL); - return; - } - - if (msg) - dec_msg = yahoo_string_decode(gc, msg, FALSE); - - /* DONE! this is almost exactly the same as what MSN does, - * this should probably be moved to the core. - */ - purple_account_request_authorization(account, add_req->who, add_req->id, - NULL, dec_msg, - purple_find_buddy(account,add_req->who) != NULL, - yahoo_buddy_add_authorize_cb, - yahoo_buddy_add_deny_reason_cb, add_req); - g_free(dec_msg); - } else { - g_free(add_req->id); - g_free(add_req->who); - g_free(add_req); - } -} - -/* I have no idea if this every gets called in version 15 */ -static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *who = NULL; - char *msg = NULL; - GSList *l = pkt->hash; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 3: - who = pair->value; - break; - case 14: - msg = pair->value; - break; - } - l = l->next; - } - - yahoo_buddy_denied_our_add(gc, who, msg); -} - -static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - switch (pkt->status) { - case 1: - yahoo_process_status(gc, pkt); - return; - case 3: - yahoo_buddy_added_us(gc, pkt); - break; - case 7: - yahoo_buddy_denied_our_add_old(gc, pkt); - break; - default: - break; - } -} - -#define OUT_CHARSET "utf-8" - -static char *yahoo_decode(const char *text) -{ - char *converted = NULL; - char *n, *new; - const char *end, *p; - int i, k; - - n = new = g_malloc(strlen (text) + 1); - end = text + strlen(text); - - for (p = text; p < end; p++, n++) { - if (*p == '\\') { - if (p[1] >= '0' && p[1] <= '7') { - p += 1; - for (i = 0, k = 0; k < 3; k += 1) { - char c = p[k]; - if (c < '0' || c > '7') break; - i *= 8; - i += c - '0'; - } - *n = i; - p += k - 1; - } else { /* bug 959248 */ - /* If we see a \ not followed by an octal number, - * it means that it is actually a \\ with one \ - * already eaten by some unknown function. - * This is arguably broken. - * - * I think wing is wrong here, there is no function - * called that I see that could have done it. I guess - * it is just really sending single \'s. That's yahoo - * for you. - */ - *n = *p; - } - } - else - *n = *p; - } - - *n = '\0'; - - if (strstr(text, "\033$B")) - converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL); - if (!converted) - converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL); - g_free(new); - - return converted; -} - -static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - const char *who = NULL; - const char *email = NULL; - const char *subj = NULL; - const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); - int count = 0; - GSList *l = pkt->hash; - - if (!purple_account_get_check_mail(account)) - return; - - while (l) { - struct yahoo_pair *pair = l->data; - if (pair->key == 9) - count = strtol(pair->value, NULL, 10); - else if (pair->key == 43) - who = pair->value; - else if (pair->key == 42) - email = pair->value; - else if (pair->key == 18) - subj = pair->value; - l = l->next; - } - - if (who && subj && email && *email) { - char *dec_who = yahoo_decode(who); - char *dec_subj = yahoo_decode(subj); - char *from = g_strdup_printf("%s (%s)", dec_who, email); - - purple_notify_email(gc, dec_subj, from, purple_account_get_username(account), - yahoo_mail_url, NULL, NULL); - - g_free(dec_who); - g_free(dec_subj); - g_free(from); - } else if (count > 0) { - const char *tos[2] = { purple_account_get_username(account) }; - const char *urls[2] = { yahoo_mail_url }; - - purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls, - NULL, NULL); - } -} - -/* We use this structure once while we authenticate */ -struct yahoo_auth_data -{ - PurpleConnection *gc; - char *seed; -}; - -/* This is the y64 alphabet... it's like base64, but has a . and a _ */ -static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; - -/* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function - * in util.c, but it is different from the one yahoo uses */ -static void to_y64(char *out, const unsigned char *in, gsize inlen) - /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ -{ - for (; inlen >= 3; inlen -= 3) - { - *out++ = base64digits[in[0] >> 2]; - *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; - *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; - *out++ = base64digits[in[2] & 0x3f]; - in += 3; - } - if (inlen > 0) - { - unsigned char fragment; - - *out++ = base64digits[in[0] >> 2]; - fragment = (in[0] << 4) & 0x30; - if (inlen > 1) - fragment |= in[1] >> 4; - *out++ = base64digits[fragment]; - *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c]; - *out++ = '-'; - } - *out = '\0'; -} - -static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) -{ - YahooData *yd = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - const char *name = purple_normalize(account, purple_account_get_username(account)); - PurpleCipher *md5_cipher; - PurpleCipherContext *md5_ctx; - guchar md5_digest[16]; - gchar base64_string[25]; - struct yahoo_packet *pkt; - - purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n"); - - md5_cipher = purple_ciphers_find_cipher("md5"); - md5_ctx = purple_cipher_context_new(md5_cipher, NULL); - purple_cipher_context_append(md5_ctx, (guchar *)crypt, strlen(crypt)); - purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), md5_digest, NULL); - - to_y64(base64_string, md5_digest, 16); - - purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, yd->session_id); - - yahoo_packet_hash(pkt, "sssssssss", - 1, name, - 0, name, - 277, yd->cookie_y, - 278, yd->cookie_t, - 307, base64_string, - 244, yd->jp ? YAHOOJP_CLIENT_VERSION_ID : YAHOO_CLIENT_VERSION_ID, - 2, name, - 2, "1", - 135, yd->jp ? YAHOOJP_CLIENT_VERSION : YAHOO_CLIENT_VERSION); - - if (yd->picture_checksum) - yahoo_packet_hash_int(pkt, 192, yd->picture_checksum); - yahoo_packet_send_and_free(pkt, yd); - - purple_cipher_context_destroy(md5_ctx); -} - -static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) -{ - struct yahoo_auth_data *auth_data = user_data; - PurpleConnection *gc = auth_data->gc; - YahooData *yd; - gboolean try_login_on_error = FALSE; - - purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - g_free(auth_data->seed); - g_free(auth_data); - g_return_if_reached(); - } - - yd = (YahooData *)gc->proto_data; - - if (error_message != NULL) { - purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); - g_free(auth_data->seed); - g_free(auth_data); - return; - } - else if (len > 0 && ret_data && *ret_data) { - gchar **split_data = g_strsplit(ret_data, "\r\n", -1); - int totalelements = 0; - int response_no = -1; - char *crumb = NULL; - char *crypt = NULL; - -#if GLIB_CHECK_VERSION(2,6,0) - totalelements = g_strv_length(split_data); -#else - while (split_data[++totalelements] != NULL); -#endif - if (totalelements >= 4) { - response_no = strtol(split_data[0], NULL, 10); - crumb = g_strdup(split_data[1] + strlen("crumb=")); - yd->cookie_y = g_strdup(split_data[2] + strlen("Y=")); - yd->cookie_t = g_strdup(split_data[3] + strlen("T=")); - } - - g_strfreev(split_data); - - if(response_no != 0) { - /* Some error in the login process */ - PurpleConnectionError error; - char *error_reason = NULL; - - switch(response_no) { - case -1: - /* Some error in the received stream */ - error_reason = g_strdup(_("Received invalid data")); - error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 100: - /* Unknown error */ - error_reason = g_strdup(_("Unknown error")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - default: - /* if we have everything we need, why not try to login irrespective of response */ - if((crumb != NULL) && (yd->cookie_y != NULL) && (yd->cookie_t != NULL)) { - try_login_on_error = TRUE; - break; - } - error_reason = g_strdup(_("Unknown error")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - if(error_reason) { - purple_debug_error("yahoo", "Authentication error: %s. " - "Code %d\n", error_reason, response_no); - purple_connection_error_reason(gc, error, error_reason); - g_free(error_reason); - g_free(auth_data->seed); - g_free(auth_data); - return; - } - } - - crypt = g_strconcat(crumb, auth_data->seed, NULL); - yahoo_auth16_stage3(gc, crypt); - g_free(crypt); - g_free(crumb); - } - g_free(auth_data->seed); - g_free(auth_data); -} - -static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) -{ - struct yahoo_auth_data *auth_data = user_data; - PurpleConnection *gc = auth_data->gc; - - purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage1_cb\n"); - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - g_free(auth_data->seed); - g_free(auth_data); - g_return_if_reached(); - } - - if (error_message != NULL) { - purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); - g_free(auth_data->seed); - g_free(auth_data); - return; - } - else if (len > 0 && ret_data && *ret_data) { - gchar **split_data = g_strsplit(ret_data, "\r\n", -1); - int totalelements = 0; - int response_no = -1; - char *token = NULL; - -#if GLIB_CHECK_VERSION(2,6,0) - totalelements = g_strv_length(split_data); -#else - while (split_data[++totalelements] != NULL); -#endif - if(totalelements == 1) - response_no = strtol(split_data[0], NULL, 10); - else if(totalelements >= 2) { - response_no = strtol(split_data[0], NULL, 10); - token = g_strdup(split_data[1] + strlen("ymsgr=")); - } - - g_strfreev(split_data); - - if(response_no != 0) { - /* Some error in the login process */ - PurpleConnectionError error; - char *error_reason; - - switch(response_no) { - case -1: - /* Some error in the received stream */ - error_reason = g_strdup(_("Received invalid data")); - error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 1212: - /* Password incorrect */ - /* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */ - if (!purple_account_get_remember_password(purple_connection_get_account(gc))) - purple_account_set_password(purple_connection_get_account(gc), NULL); - error_reason = g_strdup(_("Incorrect password")); - error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 1213: - /* security lock from too many failed login attempts */ - error_reason = g_strdup(_("Account locked: Too many failed login attempts. Logging into the Yahoo! website may fix this.")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - case 1235: - /* the username does not exist */ - error_reason = g_strdup(_("Username does not exist")); - error = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - case 1214: - case 1236: - /* indicates a lock of some description */ - error_reason = g_strdup(_("Account locked: Unknown reason. Logging into the Yahoo! website may fix this.")); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - case 100: - /* username or password missing */ - error_reason = g_strdup(_("Username or password missing")); - error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - default: - /* Unknown error! */ - error_reason = g_strdup_printf(_("Unknown error (%d)"), response_no); - error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - break; - } - purple_debug_error("yahoo", "Authentication error: %s. Code %d\n", - error_reason, response_no); - purple_connection_error_reason(gc, error, error_reason); - g_free(error_reason); - g_free(auth_data->seed); - g_free(auth_data); - g_free(token); - } - else { - /* OK to login, correct information provided */ - PurpleUtilFetchUrlData *url_data = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - char *url = NULL; - gboolean yahoojp = yahoo_is_japan(account); - gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); - - url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); - url_data = purple_util_fetch_url_request_len_with_account( - proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, - TRUE, NULL, FALSE, -1, yahoo_auth16_stage2, auth_data); - g_free(url); - g_free(token); - } - } -} - -static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) -{ - PurpleAccount *account = purple_connection_get_account(gc); - PurpleUtilFetchUrlData *url_data = NULL; - struct yahoo_auth_data *auth_data = NULL; - char *url = NULL; - char *encoded_username; - char *encoded_password; - gboolean yahoojp = yahoo_is_japan(account); - gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); - - purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n"); - - if(!purple_ssl_is_supported()) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); - return; - } - - auth_data = g_new0(struct yahoo_auth_data, 1); - auth_data->gc = gc; - auth_data->seed = g_strdup(seed); - - encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc)))); - encoded_password = g_strdup(purple_url_encode(purple_connection_get_password(gc))); - url = g_strdup_printf(yahoojp ? YAHOOJP_TOKEN_URL : YAHOO_TOKEN_URL, - encoded_username, encoded_password, purple_url_encode(seed)); - g_free(encoded_password); - g_free(encoded_username); - - url_data = purple_util_fetch_url_request_len_with_account( - proxy_ssl ? account : NULL, url, TRUE, - YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, - yahoo_auth16_stage1_cb, auth_data); - - g_free(url); -} - -static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *seed = NULL; - char *sn = NULL; - GSList *l = pkt->hash; - int m = 0; - gchar *buf; - - while (l) { - struct yahoo_pair *pair = l->data; - if (pair->key == 94) - seed = pair->value; - if (pair->key == 1) - sn = pair->value; - if (pair->key == 13) - m = atoi(pair->value); - l = l->next; - } - - if (seed) { - switch (m) { - case 0: - /* used to be for really old auth routine, dont support now */ - case 1: - case 2: /* Yahoo ver 16 authentication */ - yahoo_auth16_stage1(gc, seed); - break; - default: - { - GHashTable *ui_info = purple_core_get_ui_info(); - - buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " - "authentication method. You will probably not be able " - "to successfully sign on to Yahoo. Check %s for updates."), - ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); - purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), - buf); - g_free(buf); - yahoo_auth16_stage1(gc, seed); /* Can't hurt to try it anyway. */ - break; - } - } - } -} - -static void ignore_buddy(PurpleBuddy *buddy) { - PurpleGroup *group; - PurpleAccount *account; - gchar *name; - - if (!buddy) - return; - - group = purple_buddy_get_group(buddy); - name = g_strdup(purple_buddy_get_name(buddy)); - account = purple_buddy_get_account(buddy); - - purple_debug_info("yahoo", "blist: Removing '%s' from buddy list.\n", name); - purple_account_remove_buddy(account, buddy, group); - purple_blist_remove_buddy(buddy); - - serv_add_deny(purple_account_get_connection(account), name); - - g_free(name); -} - -static void keep_buddy(PurpleBuddy *b) -{ - purple_privacy_deny_remove(purple_buddy_get_account(b), - purple_buddy_get_name(b), 1); -} - -static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { - PurpleBuddy *b; - GSList *l; - gchar *who = NULL; - gchar *me = NULL; - gchar buf[BUF_LONG]; - gboolean ignore = TRUE; - gint status = 0; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - switch (pair->key) { - case 0: - who = pair->value; - break; - case 1: - me = pair->value; - break; - case 13: - /* 1 == ignore, 2 == unignore */ - ignore = (strtol(pair->value, NULL, 10) == 1); - break; - case 66: - status = strtol(pair->value, NULL, 10); - break; - default: - break; - } - } - - /* - * status - * 0 - ok - * 2 - already in ignore list, could not add - * 3 - not in ignore list, could not delete - * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?) - */ - switch (status) { - case 12: - purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s", - who, (ignore ? "ignoring" : "unignoring")); - - if (ignore) { - b = purple_find_buddy(gc->account, who); - g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " - "user is on your buddy list. Clicking \"Yes\" " - "will remove and ignore the buddy."), who); - purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, - gc->account, who, NULL, - b, - G_CALLBACK(ignore_buddy), - G_CALLBACK(keep_buddy)); - break; - } - case 2: - purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.\n", - who); - break; - case 3: - purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete\n", - who); - case 0: - default: - break; - } -} - -static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) -{ -#ifdef TRY_WEBMESSENGER_LOGIN - YahooData *yd = gc->proto_data; -#endif /* TRY_WEBMESSENGER_LOGIN */ - GSList *l = pkt->hash; - int err = 0; - char *msg; - char *url = NULL; - char *fullmsg; - PurpleAccount *account = gc->account; - PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; - - while (l) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 66) - err = strtol(pair->value, NULL, 10); - else if (pair->key == 20) - url = pair->value; - - l = l->next; - } - - switch (err) { - case 0: - msg = g_strdup(_("Unknown error")); - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 3: - msg = g_strdup(_("Username does not exist")); - reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - case 13: -#ifdef TRY_WEBMESSENGER_LOGIN - if (!yd->wm) { - PurpleUtilFetchUrlData *url_data; - yd->wm = TRUE; - if (yd->fd >= 0) - close(yd->fd); - if (gc->inpa) - purple_input_remove(gc->inpa); - url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, - "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - return; - } -#endif /* TRY_WEBMESSENGER_LOGIN */ - if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - - msg = g_strdup(_("Invalid username or password")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 14: - msg = g_strdup(_("Your account has been locked due to too many failed login attempts." - " Please try logging into the Yahoo! website.")); - reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; - break; - case 52: - /* See #9660. As much as we know, reconnecting shouldn't hurt */ - purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n"); - msg = g_strdup_printf(_("Unknown error 52. Reconnecting should fix this.")); - reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; - break; - case 1013: - msg = g_strdup(_("Error 1013: The username you have entered is invalid." - " The most common cause of this error is entering your email" - " address instead of your Yahoo! ID.")); - reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; - break; - default: - msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err); - } - - if (url) - fullmsg = g_strdup_printf("%s\n%s", msg, url); - else - fullmsg = g_strdup(msg); - - purple_connection_error_reason(gc, reason, fullmsg); - g_free(msg); - g_free(fullmsg); -} - -static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - int err = 0; - char *who = NULL; - char *temp = NULL; - char *group = NULL; - char *decoded_group; - char *buf; - YahooFriend *f; - GSList *l = pkt->hash; - YahooData *yd = gc->proto_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 66: - err = strtol(pair->value, NULL, 10); - break; - case 7: - temp = pair->value; - break; - case 65: - group = pair->value; - break; - case 241: - fed = strtol(pair->value, NULL, 10); - break; - } - - l = l->next; - } - - if (!temp) - return; - if (!group) - group = ""; - - switch (fed) { - case YAHOO_FEDERATION_MSN: - who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - default: - who = g_strdup(temp); - break; - } - - if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */ - f = yahoo_friend_find_or_new(gc, who); - yahoo_update_status(gc, who, f); - f->fed = fed; - - if( !g_hash_table_lookup(yd->peers, who) ) { - /* we are not connected as client, so set friend to not connected */ - if(fed) - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); - else { - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - f->p2p_packet_sent = 0; - } - } - else /* we are already connected. set friend to YAHOO_P2PSTATUS_WE_ARE_CLIENT */ - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); - g_free(who); - return; - } - - decoded_group = yahoo_string_decode(gc, group, FALSE); - buf = g_strdup_printf(_("Unable to add buddy %s to group %s to the server list on account %s."), - who, decoded_group, purple_connection_get_display_name(gc)); - if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf)) - purple_notify_error(gc, NULL, _("Unable to add buddy to server list"), buf); - g_free(buf); - g_free(decoded_group); - g_free(who); -} - -/* write pkt to the source */ -static void yahoo_p2p_write_pkt(gint source, struct yahoo_packet *pkt) -{ - size_t pkt_len; - guchar *raw_packet; - - /*build the raw packet and send it to the host*/ - pkt_len = yahoo_packet_build(pkt, 0, 0, 0, &raw_packet); - if(write(source, raw_packet, pkt_len) != pkt_len) - purple_debug_warning("yahoo","p2p: couldn't write to the source\n"); - g_free(raw_packet); -} - -static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_data) -{ - struct yahoo_p2p_data *p2p_data = value; - PurpleConnection *gc = user_data; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - YahooData *yd = gc->proto_data; - - account = purple_connection_get_account(gc); - - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssisi", - 4, purple_normalize(account, purple_account_get_username(account)), - 5, p2p_data->host_username, - 241, 0, /* Protocol identifier */ - 49, "PEERTOPEER", - 13, 7); - yahoo_p2p_write_pkt(p2p_data->source, pkt_to_send); - - yahoo_packet_free(pkt_to_send); -} - -static gboolean yahoo_p2p_keepalive(gpointer data) -{ - PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; - - g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); - - return TRUE; -} - -/* destroy p2p_data associated with a peer and close p2p connection. - * g_hash_table_remove() calls this function to destroy p2p_data associated with the peer, - * call g_hash_table_remove() instead of this fucntion if peer has an entry in the table */ -static void yahoo_p2p_disconnect_destroy_data(gpointer data) -{ - struct yahoo_p2p_data *p2p_data; - YahooFriend *f; - - if(!(p2p_data = data)) - return ; - - /* If friend, set him not connected */ - f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); - if (f) - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); - - if(p2p_data->source >= 0) - close(p2p_data->source); - if (p2p_data->input_event > 0) - purple_input_remove(p2p_data->input_event); - g_free(p2p_data->host_ip); - g_free(p2p_data->host_username); - g_free(p2p_data); -} - -/* exchange of initial p2pfilexfer packets, service type YAHOO_SERVICE_P2PFILEXFER */ -static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yahoo_packet *pkt) -{ - struct yahoo_p2p_data *p2p_data; - char *who = NULL; - GSList *l = pkt->hash; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - int val_13_to_send = 0; - YahooData *yd; - YahooFriend *f; - - if(!(p2p_data = data)) - return ; - - yd = p2p_data->gc->proto_data; - - /* lets see whats in the packet */ - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - if(strncmp(who, p2p_data->host_username, strlen(p2p_data->host_username)) != 0) { - /* from whom are we receiving the packets ?? */ - purple_debug_warning("yahoo","p2p: received data from wrong user\n"); - return; - } - break; - case 13: - p2p_data->val_13 = strtol(pair->value, NULL, 10); /* Value should be 5-7 */ - break; - /* case 5, 49 look laters, no use right now */ - } - l = l->next; - } - - account = purple_connection_get_account(p2p_data->gc); - - /* key_13: sort of a counter. - * WHEN WE ARE CLIENT: yahoo server sends val_13 = 0, we send to peer val_13 = 1, receive back val_13 = 5, - * we send val_13=6, receive val_13=7, we send val_13=7, HALT. Keep sending val_13 = 7 as keep alive. - * WHEN WE ARE SERVER: we send val_13 = 0 to yahoo server, peer sends us val_13 = 1, we send val_13 = 5, - * receive val_13 = 6, send val_13 = 7, receive val_13 = 7. HALT. Keep sending val_13 = 7 as keep alive. */ - - switch(p2p_data->val_13) { - case 1 : val_13_to_send = 5; break; - case 5 : val_13_to_send = 6; break; - case 6 : val_13_to_send = 7; break; - case 7 : if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) - return; - val_13_to_send = 7; break; - default: purple_debug_warning("yahoo","p2p:Unknown value for key 13\n"); - return; - } - - /* Build the yahoo packet */ - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssisi", - 4, purple_normalize(account, purple_account_get_username(account)), - 5, p2p_data->host_username, - 241, 0, /* Protocol identifier */ - 49, "PEERTOPEER", - 13, val_13_to_send); - - /* build the raw packet and send it to the host */ - yahoo_p2p_write_pkt(source, pkt_to_send); - yahoo_packet_free(pkt_to_send); - - if( val_13_to_send == 7 ) - if( !g_hash_table_lookup(yd->peers, p2p_data->host_username) ) { - g_hash_table_insert(yd->peers, g_strdup(p2p_data->host_username), p2p_data); - /* If the peer is a friend, set him connected */ - f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); - if (f) { - if(p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) { - p2p_data->session_id = f->session_id; - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_SERVER); - } - else - yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); - } - } -} - -/* callback function associated with receiving of data, not considering receipt of multiple YMSG packets in a single TCP packet */ -static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - guchar buf[1024]; /* is it safe to assume a fixed array length of 1024 ?? */ - int len; - int pos = 0; - int pktlen; - struct yahoo_packet *pkt; - guchar *start = NULL; - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return ; - yd = p2p_data->gc->proto_data; - - len = read(source, buf, sizeof(buf)); - if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) - return ; /* No Worries*/ - else if (len <= 0) - { - purple_debug_warning("yahoo","p2p: Error in connection, or host disconnected\n"); - /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) - g_hash_table_remove(yd->peers,p2p_data->host_username); - else - yahoo_p2p_disconnect_destroy_data(data); - return; - } - - if(len < YAHOO_PACKET_HDRLEN) - return; - - if(strncmp((char *)buf, "YMSG", MIN(4, len)) != 0) { - /* Not a YMSG packet */ - purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n"); - - start = memchr(buf + 1, 'Y', len - 1); - if (start == NULL) - return; - - g_memmove(buf, start, len - (start - buf)); - len -= start - buf; - } - - pos += 4; /* YMSG */ - pos += 2; - pos += 2; - - pktlen = yahoo_get16(buf + pos); pos += 2; - purple_debug_misc("yahoo", "p2p: %d bytes to read\n", len); - - pkt = yahoo_packet_new(0, 0, 0); - pkt->service = yahoo_get16(buf + pos); pos += 2; - pkt->status = yahoo_get32(buf + pos); pos += 4; - pkt->id = yahoo_get32(buf + pos); pos += 4; - - purple_debug_misc("yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status); - yahoo_packet_read(pkt, buf + pos, pktlen); - - /* packet processing */ - switch(pkt->service) { - case YAHOO_SERVICE_P2PFILEXFER: - yahoo_p2p_process_p2pfilexfer(data, source, pkt); - break; - case YAHOO_SERVICE_MESSAGE: - yahoo_process_message(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); - break; - case YAHOO_SERVICE_NOTIFY: - yahoo_process_notify(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); - break; - default: - purple_debug_warning("yahoo","p2p: p2p service %d Unhandled\n",pkt->service); - } - - yahoo_packet_free(pkt); -} - -static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - int acceptfd; - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return ; - yd = p2p_data->gc->proto_data; - - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) - return; - else if(acceptfd == -1) { - purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); - yahoo_p2p_disconnect_destroy_data(data); - return; - } - - /* remove timeout */ - if (yd->yahoo_p2p_server_timeout_handle) { - purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); - yd->yahoo_p2p_server_timeout_handle = 0; - } - - /* remove watcher and close p2p server */ - if (yd->yahoo_p2p_server_watcher) { - purple_input_remove(yd->yahoo_p2p_server_watcher); - yd->yahoo_p2p_server_watcher = 0; - } - if (yd->yahoo_local_p2p_server_fd >= 0) { - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; - } - - /* Add an Input Read event to the file descriptor */ - p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); - p2p_data->source = acceptfd; -} - -static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) -{ - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return FALSE; - - yd = p2p_data->gc->proto_data; - - purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n"); - yahoo_p2p_disconnect_destroy_data(data); - purple_input_remove(yd->yahoo_p2p_server_watcher); - yd->yahoo_p2p_server_watcher = 0; - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; - yd->yahoo_p2p_server_timeout_handle = 0; - - return FALSE; -} - -static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) -{ - struct yahoo_p2p_data *p2p_data; - YahooData *yd; - - if(!(p2p_data = data)) - return ; - - if(listenfd == -1) { - purple_debug_warning("yahoo","p2p: error starting p2p server\n"); - yahoo_p2p_disconnect_destroy_data(data); - return; - } - - yd = p2p_data->gc->proto_data; - - /* Add an Input Read event to the file descriptor */ - yd->yahoo_local_p2p_server_fd = listenfd; - yd->yahoo_p2p_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_server_send_connected_cb,data); - - /* add timeout */ - yd->yahoo_p2p_server_timeout_handle = purple_timeout_add_seconds(YAHOO_P2P_SERVER_TIMEOUT, yahoo_cancel_p2p_server_listen_cb, data); -} - -/* send p2p pkt containing our encoded ip, asking peer to connect to us */ -void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) -{ - const char *public_ip; - guint32 temp[4]; - guint32 ip; - char temp_str[100]; - gchar *base64_ip = NULL; - YahooFriend *f; - struct yahoo_packet *pkt; - PurpleAccount *account; - YahooData *yd = gc->proto_data; - struct yahoo_p2p_data *p2p_data; - - f = yahoo_friend_find(gc, who); - account = purple_connection_get_account(gc); - - /* Do not send invitation if already listening for other connection */ - if(yd->yahoo_local_p2p_server_fd >= 0) - return; - - /* One shouldn't try to connect to self */ - if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0) - return; - - /* send packet to only those friends who arent p2p connected and to whom we havent already sent. Do not send if this condition doesn't hold good */ - if( !( f && (yahoo_friend_get_p2p_status(f) == YAHOO_P2PSTATUS_NOT_CONNECTED) && (f->p2p_packet_sent == 0)) ) - return; - - /* Dont send p2p packet to buddies of other protocols */ - if(f->fed) - return; - - /* Finally, don't try to connect to buddies not online or on sms */ - if( (f->status == YAHOO_STATUS_OFFLINE) || f->sms ) - return; - - public_ip = purple_network_get_public_ip(); - if( (sscanf(public_ip, "%u.%u.%u.%u", &temp[0], &temp[1], &temp[2], &temp[3])) !=4 ) - return ; - - ip = (temp[3] << 24) | (temp[2] <<16) | (temp[1] << 8) | temp[0]; - sprintf(temp_str, "%d", ip); - base64_ip = purple_base64_encode( (guchar *)temp_str, strlen(temp_str) ); - - pkt = yahoo_packet_new(YAHOO_SERVICE_PEERTOPEER, YAHOO_STATUS_AVAILABLE, 0); - yahoo_packet_hash(pkt, "sssissis", - 1, purple_normalize(account, purple_account_get_username(account)), - 4, purple_normalize(account, purple_account_get_username(account)), - 12, base64_ip, /* base64 encode ip */ - 61, 0, /* To-do : figure out what is 61 for?? */ - 2, "", - 5, who, - 13, val_13, - 49, "PEERTOPEER"); - yahoo_packet_send_and_free(pkt, yd); - - f->p2p_packet_sent = 1; /* set p2p_packet_sent to sent */ - - p2p_data = g_new0(struct yahoo_p2p_data, 1); - - p2p_data->gc = gc; - p2p_data->host_ip = NULL; - p2p_data->host_username = g_strdup(who); - p2p_data->val_13 = val_13; - p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER; - p2p_data->source = -1; - - purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); - - g_free(base64_ip); -} - -/* function called when connection to p2p host is setup */ -static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message) -{ - struct yahoo_p2p_data *p2p_data; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - YahooData *yd; - - p2p_data = data; - yd = p2p_data->gc->proto_data; - - if(error_message != NULL) { - purple_debug_warning("yahoo","p2p: %s\n",error_message); - yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */ - - yahoo_p2p_disconnect_destroy_data(p2p_data); - return; - } - - /* Add an Input Read event to the file descriptor */ - p2p_data->input_event = purple_input_add(source, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); - p2p_data->source = source; - - account = purple_connection_get_account(p2p_data->gc); - - /* Build the yahoo packet */ - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssisi", - 4, purple_normalize(account, purple_account_get_username(account)), - 5, p2p_data->host_username, - 241, 0, /* Protocol identifier */ - 49, "PEERTOPEER", - 13, 1); /* we receive key13= 0 or 2, we send key13=1 */ - - yahoo_p2p_write_pkt(source, pkt_to_send); /* build raw packet and send */ - yahoo_packet_free(pkt_to_send); -} - -static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *who = NULL; - char *base64 = NULL; - guchar *decoded; - gsize len; - gint val_13 = 0; - gint val_11 = 0; - PurpleAccount *account; - YahooFriend *f; - - /* if status is not 1 ie YAHOO_STATUS_BRB, the packet bounced back, so contains our own ip */ - if(!(pkt->status == YAHOO_STATUS_BRB)) - return ; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 5: - /* our identity */ - break; - case 4: - who = pair->value; - break; - case 1: - /* who again, the master identity this time? */ - break; - case 12: - base64 = pair->value; - /* so, this is an ip address. in base64. decoded it's in ascii. - after strtol, it's in reversed byte order. Who thought this up?*/ - break; - case 13: - val_13 = strtol(pair->value, NULL, 10); - break; - case 11: - val_11 = strtol(pair->value, NULL, 10); /* session id of peer */ - if( (f = yahoo_friend_find(gc, who)) ) - f->session_id = val_11; - break; - /* - TODO: figure these out - yahoo: Key: 61 Value: 0 - yahoo: Key: 2 Value: - yahoo: Key: 13 Value: 0 packet count ?? - yahoo: Key: 49 Value: PEERTOPEER - yahoo: Key: 140 Value: 1 - */ - - } - - l = l->next; - } - - if (base64) { - guint32 ip; - YahooFriend *f; - char *host_ip; - struct yahoo_p2p_data *p2p_data; - - decoded = purple_base64_decode(base64, &len); - if (len) { - char *tmp = purple_str_binary_to_ascii(decoded, len); - purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); - g_free(tmp); - } - - ip = strtol((gchar *)decoded, NULL, 10); - g_free(decoded); - host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, - (ip >> 24) & 0xff); - f = yahoo_friend_find(gc, who); - if (f) - yahoo_friend_set_ip(f, host_ip); - purple_debug_info("yahoo", "IP : %s\n", host_ip); - - account = purple_connection_get_account(gc); - - if(val_11==0) { - if(!f) - return; - else - val_11 = f->session_id; - } - - p2p_data = g_new0(struct yahoo_p2p_data, 1); - p2p_data->host_username = g_strdup(who); - p2p_data->val_13 = val_13; - p2p_data->session_id = val_11; - p2p_data->host_ip = host_ip; - p2p_data->gc = gc; - p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT; - p2p_data->source = -1; - - /* connect to host */ - if((purple_proxy_connect(gc, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) { - purple_debug_info("yahoo","p2p: Connection to %s failed\n", host_ip); - g_free(p2p_data->host_ip); - g_free(p2p_data->host_username); - g_free(p2p_data); - } - } -} - -static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - char *who = NULL, *msg = NULL, *id = NULL; - GSList *l = pkt->hash; - - account = purple_connection_get_account(gc); - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - break; - case 5: - /* us */ - break; - case 230: - /* the audible, in foo.locale.bar.baz format - eg: base.tw.smiley.smiley43 */ - id = pair->value; - break; - case 231: - /* the text of the audible */ - msg = pair->value; - break; - case 232: - /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */ - break; - } - - l = l->next; - } - - if (!msg) - msg = id; - if (!who || !msg) - return; - if (!g_utf8_validate(msg, -1, NULL)) { - purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); - return; - } - if (!purple_privacy_check(account, who)) { - purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", - purple_account_get_username(account), who); - return; - } - if (id) { - /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */ - char **audible_locale = g_strsplit(id, ".", 0); - char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg); - g_strfreev(audible_locale); - - serv_got_im(gc, who, buf, 0, time(NULL)); - g_free(buf); - } else - serv_got_im(gc, who, msg, 0, time(NULL)); -} - -static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - switch (pkt->service) { - case YAHOO_SERVICE_LOGON: - case YAHOO_SERVICE_LOGOFF: - case YAHOO_SERVICE_ISAWAY: - case YAHOO_SERVICE_ISBACK: - case YAHOO_SERVICE_GAMELOGON: - case YAHOO_SERVICE_GAMELOGOFF: - case YAHOO_SERVICE_CHATLOGON: - case YAHOO_SERVICE_CHATLOGOFF: - case YAHOO_SERVICE_Y6_STATUS_UPDATE: - case YAHOO_SERVICE_STATUS_15: - yahoo_process_status(gc, pkt); - break; - case YAHOO_SERVICE_NOTIFY: - yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER); - break; - case YAHOO_SERVICE_MESSAGE: - case YAHOO_SERVICE_GAMEMSG: - case YAHOO_SERVICE_CHATMSG: - yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER); - break; - case YAHOO_SERVICE_SYSMESSAGE: - yahoo_process_sysmessage(gc, pkt); - break; - case YAHOO_SERVICE_NEWMAIL: - yahoo_process_mail(gc, pkt); - break; - case YAHOO_SERVICE_NEWCONTACT: - yahoo_process_contact(gc, pkt); - break; - case YAHOO_SERVICE_AUTHRESP: - yahoo_process_authresp(gc, pkt); - break; - case YAHOO_SERVICE_LIST: - yahoo_process_list(gc, pkt); - break; - case YAHOO_SERVICE_LIST_15: - yahoo_process_list_15(gc, pkt); - break; - case YAHOO_SERVICE_AUTH: - yahoo_process_auth(gc, pkt); - break; - case YAHOO_SERVICE_AUTH_REQ_15: - yahoo_buddy_auth_req_15(gc, pkt); - break; - case YAHOO_SERVICE_ADDBUDDY: - yahoo_process_addbuddy(gc, pkt); - break; - case YAHOO_SERVICE_IGNORECONTACT: - yahoo_process_ignore(gc, pkt); - break; - case YAHOO_SERVICE_CONFINVITE: - case YAHOO_SERVICE_CONFADDINVITE: - yahoo_process_conference_invite(gc, pkt); - break; - case YAHOO_SERVICE_CONFDECLINE: - yahoo_process_conference_decline(gc, pkt); - break; - case YAHOO_SERVICE_CONFLOGON: - yahoo_process_conference_logon(gc, pkt); - break; - case YAHOO_SERVICE_CONFLOGOFF: - yahoo_process_conference_logoff(gc, pkt); - break; - case YAHOO_SERVICE_CONFMSG: - yahoo_process_conference_message(gc, pkt); - break; - case YAHOO_SERVICE_CHATONLINE: - yahoo_process_chat_online(gc, pkt); - break; - case YAHOO_SERVICE_CHATLOGOUT: - yahoo_process_chat_logout(gc, pkt); - break; - case YAHOO_SERVICE_CHATGOTO: - yahoo_process_chat_goto(gc, pkt); - break; - case YAHOO_SERVICE_CHATJOIN: - yahoo_process_chat_join(gc, pkt); - break; - case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */ - case YAHOO_SERVICE_CHATEXIT: - yahoo_process_chat_exit(gc, pkt); - break; - case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */ - case YAHOO_SERVICE_CHATADDINVITE: - yahoo_process_chat_addinvite(gc, pkt); - break; - case YAHOO_SERVICE_COMMENT: - yahoo_process_chat_message(gc, pkt); - break; - case YAHOO_SERVICE_PRESENCE_PERM: - case YAHOO_SERVICE_PRESENCE_SESSION: - yahoo_process_presence(gc, pkt); - break; - case YAHOO_SERVICE_P2PFILEXFER: - /* This case had no break and continued; thus keeping it this way.*/ - yahoo_process_p2p(gc, pkt); /* P2PFILEXFER handled the same way as process_p2p */ - yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */ - case YAHOO_SERVICE_FILETRANSFER: - yahoo_process_filetransfer(gc, pkt); - break; - case YAHOO_SERVICE_PEERTOPEER: - yahoo_process_p2p(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE: - yahoo_process_picture(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE_CHECKSUM: - yahoo_process_picture_checksum(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE_UPLOAD: - yahoo_process_picture_upload(gc, pkt); - break; - case YAHOO_SERVICE_PICTURE_UPDATE: - case YAHOO_SERVICE_AVATAR_UPDATE: - yahoo_process_avatar_update(gc, pkt); - break; - case YAHOO_SERVICE_AUDIBLE: - yahoo_process_audible(gc, pkt); - break; - case YAHOO_SERVICE_CONTACT_DETAILS: - yahoo_process_contact_details(gc, pkt); - break; - case YAHOO_SERVICE_FILETRANS_15: - yahoo_process_filetrans_15(gc, pkt); - break; - case YAHOO_SERVICE_FILETRANS_INFO_15: - yahoo_process_filetrans_info_15(gc, pkt); - break; - case YAHOO_SERVICE_FILETRANS_ACC_15: - yahoo_process_filetrans_acc_15(gc, pkt); - break; - case YAHOO_SERVICE_SMS_MSG: - yahoo_process_sms_message(gc, pkt); - break; - - default: - purple_debug_error("yahoo", "Unhandled service 0x%02x\n", pkt->service); - break; - } -} - -static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - YahooData *yd = gc->proto_data; - char buf[1024]; - int len; - - len = read(yd->fd, buf, sizeof(buf)); - - if (len < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - gc->last_received = time(NULL); - yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); - memcpy(yd->rxqueue + yd->rxlen, buf, len); - yd->rxlen += len; - - while (1) { - struct yahoo_packet *pkt; - int pos = 0; - int pktlen; - - if (yd->rxlen < YAHOO_PACKET_HDRLEN) - return; - - if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { - /* HEY! This isn't even a YMSG packet. What - * are you trying to pull? */ - guchar *start; - - purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n"); - - start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); - if (start) { - g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); - yd->rxlen -= start - yd->rxqueue; - continue; - } else { - g_free(yd->rxqueue); - yd->rxqueue = NULL; - yd->rxlen = 0; - return; - } - } - - pos += 4; /* YMSG */ - pos += 2; - pos += 2; - - pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; - purple_debug_misc("yahoo", "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); - - if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) - return; - - yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); - - pkt = yahoo_packet_new(0, 0, 0); - - pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; - pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; - purple_debug_misc("yahoo", "Yahoo Service: 0x%02x Status: %d\n", - pkt->service, pkt->status); - pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; - - yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); - - yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; - if (yd->rxlen) { - guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen); - g_free(yd->rxqueue); - yd->rxqueue = tmp; - } else { - g_free(yd->rxqueue); - yd->rxqueue = NULL; - } - - yahoo_packet_process(gc, pkt); - - yahoo_packet_free(pkt); - } -} - -static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - YahooData *yd; - struct yahoo_packet *pkt; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - yd = gc->proto_data; - yd->fd = source; - - pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); - - yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); - yahoo_packet_send_and_free(pkt, yd); - - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); -} - -#ifdef TRY_WEBMESSENGER_LOGIN -static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - YahooData *yd; - struct yahoo_packet *pkt; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - yd = gc->proto_data; - yd->fd = source; - - pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); - - yahoo_packet_hash(pkt, "sss", 0, - purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), - 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), - 6, yd->auth); - yahoo_packet_send_and_free(pkt, yd); - - g_free(yd->auth); - gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); -} - -static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc = data; - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - char bufread[2048], *i = bufread, *buf = bufread; - int len; - GString *s; - - len = read(source, bufread, sizeof(bufread) - 1); - - if (len < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } else if (len == 0) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Server closed the connection")); - return; - } - - if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) { - yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); - memcpy(yd->rxqueue + yd->rxlen, buf, len); - yd->rxlen += len; - i = buf = (char *)yd->rxqueue; - len = yd->rxlen; - } - buf[len] = '\0'; - - if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && - strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Received unexpected HTTP response from server")); - purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf); - return; - } - - s = g_string_sized_new(len); - - while ((i = strstr(i, "Set-Cookie: "))) { - - i += strlen("Set-Cookie: "); - for (;*i != ';' && *i != '\0'; i++) - g_string_append_c(s, *i); - - g_string_append(s, "; "); - /* Should these cookies be included too when trying for xfer? - * It seems to work without these - */ - } - - yd->auth = g_string_free(s, FALSE); - purple_input_remove(gc->inpa); - close(source); - g_free(yd->rxqueue); - yd->rxqueue = NULL; - yd->rxlen = 0; - /* Now we have our cookies to login with. I'll go get the milk. */ - if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", - purple_account_get_int(account, "port", YAHOO_PAGER_PORT), - yahoo_got_web_connected, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } -} - -static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleConnection *gc; - YahooData *yd; - int written, remaining; - - gc = data; - yd = gc->proto_data; - - remaining = strlen(yd->auth) - yd->auth_written; - written = write(source, yd->auth + yd->auth_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - gchar *tmp; - g_free(yd->auth); - yd->auth = NULL; - if (gc->inpa) - purple_input_remove(gc->inpa); - gc->inpa = 0; - tmp = g_strdup_printf(_("Lost connection with %s: %s"), - "login.yahoo.com:80", g_strerror(errno)); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (written < remaining) { - yd->auth_written += written; - return; - } - - g_free(yd->auth); - yd->auth = NULL; - yd->auth_written = 0; - purple_input_remove(gc->inpa); - gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); -} - -static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) -{ - PurpleConnection *gc = data; - - if (source < 0) { - gchar *tmp; - tmp = g_strdup_printf(_("Unable to establish a connection with %s: %s"), - "login.yahoo.com:80", error_message); - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); - return; - } - - if (gc->inpa == 0) - { - gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_got_cookies_send_cb, gc); - yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) -{ - if (!strcmp(key, "passwd") || !strcmp(key, "login")) - return; - g_string_append_c(url, '&'); - g_string_append(url, key); - g_string_append_c(url, '='); - if (!strcmp(key, ".save") || !strcmp(key, ".js")) - g_string_append_c(url, '1'); - else if (!strcmp(key, ".challenge")) - g_string_append(url, val); - else - g_string_append(url, purple_url_encode(val)); -} - -static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) -{ - GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - const char *c = buf; - char *d; - char name[64], value[64]; - int count; - int input_len = strlen(" ((c - buf) + input_len)) - && (c = strstr(c, " ((c - buf) + 1)) && *c!='"' - && count; c++, d++, count--) - *d = *c; - *d = '\0'; - count = sizeof(value)-1; - if (!(d = g_strstr_len(c, len - (c - buf), "value=\""))) - continue; - d += value_len; - if (strchr(c, '>') < d) - break; - for (c = d, d = value; (len > ((c - buf) + 1)) - && *c!='"' && count; c++, d++, count--) - *d = *c; - *d = '\0'; - g_hash_table_insert(hash, g_strdup(name), g_strdup(value)); - } - return hash; -} - -static void -yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - PurpleConnection *gc = (PurpleConnection *)user_data; - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - const char *sn = purple_account_get_username(account); - const char *pass = purple_connection_get_password(gc); - GHashTable *hash = yahoo_login_page_hash(url_text, len); - GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); - char md5[33], *hashp = md5, *chal; - int i; - PurpleCipher *cipher; - PurpleCipherContext *context; - guchar digest[16]; - - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (error_message != NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - error_message); - return; - } - - url = g_string_append(url, sn); - url = g_string_append(url, "&passwd="); - - cipher = purple_ciphers_find_cipher("md5"); - context = purple_cipher_context_new(cipher, NULL); - - purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - for (i = 0; i < 16; ++i) { - g_snprintf(hashp, 3, "%02x", digest[i]); - hashp += 2; - } - - chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, (const guchar *)chal, strlen(chal)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - hashp = md5; - for (i = 0; i < 16; ++i) { - g_snprintf(hashp, 3, "%02x", digest[i]); - hashp += 2; - } - /* - * I dunno why this is here and commented out.. but in case it's needed - * I updated it.. - - purple_cipher_context_reset(context, NULL); - purple_cipher_context_append(context, md5, strlen(md5)); - purple_cipher_context_digest(context, sizeof(digest), digest, NULL); - hashp = md5; - for (i = 0; i < 16; ++i) { - g_snprintf(hashp, 3, "%02x", digest[i]); - hashp += 2; - } - */ - g_free(chal); - - url = g_string_append(url, md5); - g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url); - - url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" - "Host: login.yahoo.com\r\n\r\n"); - g_hash_table_destroy(hash); - yd->auth = g_string_free(url, FALSE); - if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - - purple_cipher_context_destroy(context); -} -#endif /* TRY_WEBMESSENGER_LOGIN */ - -static void yahoo_server_check(PurpleAccount *account) -{ - const char *server; - - server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST); - - if (*server == '\0' || g_str_equal(server, "scs.yahoo.com") || - g_str_equal(server, "scs.msg.yahoo.com")) - purple_account_set_string(account, "server", YAHOO_PAGER_HOST); -} - -static void yahoo_picture_check(PurpleAccount *account) -{ - PurpleConnection *gc = purple_account_get_connection(account); - PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); - - yahoo_set_buddy_icon(gc, img); - purple_imgstore_unref(img); -} - -static int get_yahoo_status_from_purple_status(PurpleStatus *status) -{ - PurplePresence *presence; - const char *status_id; - const char *msg; - - presence = purple_status_get_presence(status); - status_id = purple_status_get_id(status); - msg = purple_status_get_attr_string(status, "message"); - - if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { - if ((msg != NULL) && (*msg != '\0')) - return YAHOO_STATUS_CUSTOM; - else - return YAHOO_STATUS_AVAILABLE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) { - return YAHOO_STATUS_BRB; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) { - return YAHOO_STATUS_BUSY; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) { - return YAHOO_STATUS_NOTATHOME; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) { - return YAHOO_STATUS_NOTATDESK; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) { - return YAHOO_STATUS_NOTINOFFICE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) { - return YAHOO_STATUS_ONPHONE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) { - return YAHOO_STATUS_ONVACATION; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) { - return YAHOO_STATUS_OUTTOLUNCH; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) { - return YAHOO_STATUS_STEPPEDOUT; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { - return YAHOO_STATUS_INVISIBLE; - } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { - return YAHOO_STATUS_CUSTOM; - } else if (purple_presence_is_idle(presence)) { - return YAHOO_STATUS_IDLE; - } else { - purple_debug_error("yahoo", "Unexpected PurpleStatus!\n"); - return YAHOO_STATUS_AVAILABLE; - } -} - -void yahoo_login(PurpleAccount *account) { - PurpleConnection *gc = purple_account_get_connection(account); - YahooData *yd = gc->proto_data = g_new0(YahooData, 1); - PurpleStatus *status = purple_account_get_active_status(account); - const char *server = NULL; - int pager_port = 0; - - gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; - - purple_connection_update_progress(gc, _("Connecting"), 1, 2); - - purple_connection_set_display_name(gc, purple_account_get_username(account)); - - yd->gc = gc; - yd->yahoo_local_p2p_server_fd = -1; - yd->fd = -1; - yd->txhandler = 0; - /* TODO: Is there a good grow size for the buffer? */ - yd->txbuf = purple_circ_buffer_new(0); - yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); - yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - yahoo_p2p_disconnect_destroy_data); - yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, - yahoo_p2p_keepalive, gc); - yd->confs = NULL; - yd->conf_id = 2; - yd->last_keepalive = yd->last_ping = time(NULL); - - yd->current_status = get_yahoo_status_from_purple_status(status); - yd->jp = yahoo_is_japan(account); - - yahoo_server_check(account); - yahoo_picture_check(account); - - server = purple_account_get_string(account, "server", - yd->jp ? YAHOOJP_PAGER_HOST : YAHOO_PAGER_HOST); - pager_port = purple_account_get_int(account, "port", YAHOO_PAGER_PORT); - - if (purple_proxy_connect(gc, account, server, pager_port, yahoo_got_connected, gc) == NULL) - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - - return; -} - -void yahoo_close(PurpleConnection *gc) { - YahooData *yd = (YahooData *)gc->proto_data; - GSList *l; - - if (gc->inpa) - purple_input_remove(gc->inpa); - - while (yd->url_datas) { - purple_util_fetch_url_cancel(yd->url_datas->data); - yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); - } - - for (l = yd->confs; l; l = l->next) { - PurpleConversation *conv = l->data; - - yahoo_conf_leave(yd, purple_conversation_get_name(conv), - purple_connection_get_display_name(gc), - purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))); - } - g_slist_free(yd->confs); - - for (l = yd->cookies; l; l = l->next) { - g_free(l->data); - l->data=NULL; - } - g_slist_free(yd->cookies); - - yd->chat_online = FALSE; - if (yd->in_chat) - yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ - - purple_timeout_remove(yd->yahoo_p2p_timer); - if(yd->yahoo_p2p_server_timeout_handle != 0) { - purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); - yd->yahoo_p2p_server_timeout_handle = 0; - } - - /* close p2p server if it is waiting for a peer to connect */ - if (yd->yahoo_p2p_server_watcher) { - purple_input_remove(yd->yahoo_p2p_server_watcher); - yd->yahoo_p2p_server_watcher = 0; - } - if (yd->yahoo_local_p2p_server_fd >= 0) { - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; - } - - g_hash_table_destroy(yd->sms_carrier); - g_hash_table_destroy(yd->peers); - g_hash_table_destroy(yd->friends); - g_hash_table_destroy(yd->imvironments); - g_hash_table_destroy(yd->xfer_peer_idstring_map); - g_free(yd->chat_name); - - g_free(yd->cookie_y); - g_free(yd->cookie_t); - - if (yd->txhandler) - purple_input_remove(yd->txhandler); - - purple_circ_buffer_destroy(yd->txbuf); - - if (yd->fd >= 0) - close(yd->fd); - - g_free(yd->rxqueue); - yd->rxlen = 0; - g_free(yd->picture_url); - - if (yd->buddy_icon_connect_data) - purple_proxy_connect_cancel(yd->buddy_icon_connect_data); - if (yd->picture_upload_todo) - yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); - if (yd->ycht) - ycht_connection_close(yd->ycht); - - g_free(yd->pending_chat_room); - g_free(yd->pending_chat_id); - g_free(yd->pending_chat_topic); - g_free(yd->pending_chat_goto); - g_strfreev(yd->profiles); - - yahoo_personal_details_reset(&yd->ypd, TRUE); - - g_free(yd->current_list15_grp); - - g_free(yd); - gc->proto_data = NULL; -} - -const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) -{ - return "yahoo"; -} - -const char *yahoo_list_emblem(PurpleBuddy *b) -{ - PurpleAccount *account; - PurpleConnection *gc; - YahooData *yd; - YahooFriend *f; - PurplePresence *presence; - - if (!b || !(account = purple_buddy_get_account(b)) || - !(gc = purple_account_get_connection(account)) || - !(yd = gc->proto_data)) - return NULL; - - f = yahoo_friend_find(gc, purple_buddy_get_name(b)); - if (!f) { - return "not-authorized"; - } - - presence = purple_buddy_get_presence(b); - - if (purple_presence_is_online(presence)) { - if (yahoo_friend_get_game(f)) - return "game"; - - if (f->fed) - return "external"; - } - return NULL; -} - -static const char *yahoo_get_status_string(enum yahoo_status a) -{ - switch (a) { - case YAHOO_STATUS_BRB: - return _("Be Right Back"); - case YAHOO_STATUS_BUSY: - return _("Busy"); - case YAHOO_STATUS_NOTATHOME: - return _("Not at Home"); - case YAHOO_STATUS_NOTATDESK: - return _("Not at Desk"); - case YAHOO_STATUS_NOTINOFFICE: - return _("Not in Office"); - case YAHOO_STATUS_ONPHONE: - return _("On the Phone"); - case YAHOO_STATUS_ONVACATION: - return _("On Vacation"); - case YAHOO_STATUS_OUTTOLUNCH: - return _("Out to Lunch"); - case YAHOO_STATUS_STEPPEDOUT: - return _("Stepped Out"); - case YAHOO_STATUS_INVISIBLE: - return _("Invisible"); - case YAHOO_STATUS_IDLE: - return _("Idle"); - case YAHOO_STATUS_OFFLINE: - return _("Offline"); - default: - return _("Available"); - } -} - -static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { - - PurpleBuddy *buddy; - PurpleConnection *gc; - - GHashTable *components; - YahooData *yd; - int id; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = gc->proto_data; - id = yd->conf_id; - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(components, g_strdup("room"), - g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id)); - g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); - g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); - yahoo_c_join(gc, components); - g_hash_table_destroy(components); - - yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy)); -} - -static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { - PurpleBuddy *buddy; - PurpleConnection *gc; - int presence_val = GPOINTER_TO_INT(data); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val); -} - -static void yahoo_game(PurpleBlistNode *node, gpointer data) { - - PurpleBuddy *buddy; - PurpleConnection *gc; - - YahooData *yd; - const char *game; - char *game2; - char *t; - char url[256]; - YahooFriend *f; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = (YahooData *) gc->proto_data; - - f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); - if (!f) - return; - - game = yahoo_friend_get_game(f); - if (!game) - return; - - t = game2 = g_strdup(strstr(game, "ante?room=")); - while (*t && *t != '\t') - t++; - *t = 0; - g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); - purple_notify_uri(gc, url); - g_free(game2); -} - -char *yahoo_status_text(PurpleBuddy *b) -{ - YahooFriend *f = NULL; - const char *msg; - char *msg2; - PurpleAccount *account; - PurpleConnection *gc; - - account = purple_buddy_get_account(b); - gc = purple_account_get_connection(account); - if (!gc || !purple_connection_get_protocol_data(gc)) - return NULL; - - f = yahoo_friend_find(gc, purple_buddy_get_name(b)); - if (!f) - return g_strdup(_("Not on server list")); - - switch (f->status) { - case YAHOO_STATUS_AVAILABLE: - return NULL; - case YAHOO_STATUS_IDLE: - if (f->idle == -1) - return g_strdup(yahoo_get_status_string(f->status)); - return NULL; - case YAHOO_STATUS_CUSTOM: - if (!(msg = yahoo_friend_get_status_message(f))) - return NULL; - msg2 = g_markup_escape_text(msg, strlen(msg)); - purple_util_chrreplace(msg2, '\n', ' '); - return msg2; - - default: - return g_strdup(yahoo_get_status_string(f->status)); - } -} - -void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) -{ - YahooFriend *f; - char *escaped; - char *status = NULL; - const char *presence = NULL; - PurpleAccount *account; - - account = purple_buddy_get_account(b); - f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); - if (!f) - status = g_strdup_printf("\n%s", _("Not on server list")); - else { - switch (f->status) { - case YAHOO_STATUS_CUSTOM: - if (!yahoo_friend_get_status_message(f)) - return; - status = g_strdup(yahoo_friend_get_status_message(f)); - break; - case YAHOO_STATUS_OFFLINE: - break; - default: - status = g_strdup(yahoo_get_status_string(f->status)); - break; - } - - switch (f->presence) { - case YAHOO_PRESENCE_ONLINE: - presence = _("Appear Online"); - break; - case YAHOO_PRESENCE_PERM_OFFLINE: - presence = _("Appear Permanently Offline"); - break; - case YAHOO_PRESENCE_DEFAULT: - break; - default: - purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n"); - break; - } - } - - if (status != NULL) { - escaped = g_markup_escape_text(status, strlen(status)); - purple_notify_user_info_add_pair(user_info, _("Status"), escaped); - g_free(status); - g_free(escaped); - } - - if (presence != NULL) - purple_notify_user_info_add_pair(user_info, _("Presence"), presence); - - if (f && full) { - YahooPersonalDetails *ypd = &f->ypd; - int i; - struct { - char *id; - char *text; - char *value; - } yfields[] = { - {"hp", N_("Home Phone Number"), ypd->phone.home}, - {"wp", N_("Work Phone Number"), ypd->phone.work}, - {"mo", N_("Mobile Phone Number"), ypd->phone.mobile}, - {NULL, NULL, NULL} - }; - for (i = 0; yfields[i].id; i++) { - if (!yfields[i].value || !*yfields[i].value) - continue; - purple_notify_user_info_add_pair(user_info, _(yfields[i].text), yfields[i].value); - } - } -} - -static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - yahoo_add_buddy(gc, buddy, NULL); -} - - -static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *buddy; - PurpleConnection *gc; - - g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); - - buddy = (PurpleBuddy *) node; - gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - - yahoo_chat_goto(gc, purple_buddy_get_name(buddy)); -} - -static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { - GList *m = NULL; - PurpleMenuAction *act; - YahooData *yd = (YahooData *) gc->proto_data; - - if (yd->current_status == YAHOO_STATUS_INVISIBLE) { - if (f->presence != YAHOO_PRESENCE_ONLINE) { - act = purple_menu_action_new(_("Appear Online"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), - NULL); - m = g_list_append(m, act); - } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { - act = purple_menu_action_new(_("Appear Offline"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), - NULL); - m = g_list_append(m, act); - } - } - - if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { - act = purple_menu_action_new(_("Don't Appear Permanently Offline"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), - NULL); - m = g_list_append(m, act); - } else { - act = purple_menu_action_new(_("Appear Permanently Offline"), - PURPLE_CALLBACK(yahoo_presence_settings), - GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), - NULL); - m = g_list_append(m, act); - } - - return m; -} - -static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - - yahoo_doodle_initiate(gc, purple_buddy_get_name(b)); -} - -static void -yahoo_userinfo_blist_node(PurpleBlistNode *node, gpointer data) -{ - PurpleBuddy *b = (PurpleBuddy *)node; - PurpleAccount *account = purple_buddy_get_account(b); - PurpleConnection *gc = purple_account_get_connection(account); - - yahoo_set_userinfo_for_buddy(gc, b); -} - -static GList *yahoo_buddy_menu(PurpleBuddy *buddy) -{ - GList *m = NULL; - PurpleMenuAction *act; - - PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - YahooData *yd = gc->proto_data; - static char buf2[1024]; - YahooFriend *f; - - f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); - - if (!f && !yd->wm) { - act = purple_menu_action_new(_("Add Buddy"), - PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb), - NULL, NULL); - m = g_list_append(m, act); - - return m; - - } - - if (f && f->status != YAHOO_STATUS_OFFLINE && f->fed == YAHOO_FEDERATION_NONE) { - if (!yd->wm) { - act = purple_menu_action_new(_("Join in Chat"), - PURPLE_CALLBACK(yahoo_chat_goto_menu), - NULL, NULL); - m = g_list_append(m, act); - } - - act = purple_menu_action_new(_("Initiate Conference"), - PURPLE_CALLBACK(yahoo_initiate_conference), - NULL, NULL); - m = g_list_append(m, act); - - if (yahoo_friend_get_game(f)) { - const char *game = yahoo_friend_get_game(f); - char *room; - char *t; - - if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */ - while (*room && *room != '\t') /* skip to the tab */ - room++; - t = room++; /* room as now at the name */ - while (*t != '\n') - t++; /* replace the \n with a space */ - *t = ' '; - g_snprintf(buf2, sizeof buf2, "%s", room); - - act = purple_menu_action_new(buf2, - PURPLE_CALLBACK(yahoo_game), - NULL, NULL); - m = g_list_append(m, act); - } - } - } - - if (f) { - act = purple_menu_action_new(_("Presence Settings"), NULL, NULL, - build_presence_submenu(f, gc)); - m = g_list_append(m, act); - - if (f->fed == YAHOO_FEDERATION_NONE) { - act = purple_menu_action_new(_("Start Doodling"), - PURPLE_CALLBACK(yahoo_doodle_blist_node), - NULL, NULL); - m = g_list_append(m, act); - } - - act = purple_menu_action_new(_("Set User Info..."), - PURPLE_CALLBACK(yahoo_userinfo_blist_node), - NULL, NULL); - m = g_list_append(m, act); - } - - return m; -} - -GList *yahoo_blist_node_menu(PurpleBlistNode *node) -{ - if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { - return yahoo_buddy_menu((PurpleBuddy *) node); - } else { - return NULL; - } -} - -static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) -{ - YahooData *yd = gc->proto_data; - const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; - - struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 3, name); - yahoo_packet_send_and_free(pkt, yd); - - purple_connection_set_display_name(gc, name); -} - -static void -yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *token, size_t len, const gchar *error_message) -{ - PurpleConnection *gc = user_data; - gboolean set_cookie = FALSE; - gchar *url; - YahooData *yd = gc->proto_data; - - g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); - - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (error_message != NULL) - purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message); - else if (len > 0 && token && *token) { - /* Should we not be hardcoding the rd url? */ - url = g_strdup_printf( - "http://login.yahoo.com/config/reset_cookies_token?" - ".token=%s" - "&.done=http://us.rd.yahoo.com/messenger/client/%%3fhttp://mail.yahoo.com/", - token); - set_cookie = TRUE; - } - - if (!set_cookie) { - purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n"); - url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); - } - - /* Open the mailbox with the parsed url data */ - purple_notify_uri(gc, url); - - g_free(url); -} - - -static void yahoo_show_inbox(PurplePluginAction *action) -{ - /* Setup a cookie that can be used by the browser */ - /* XXX I have no idea how this will work with Yahoo! Japan. */ - - PurpleConnection *gc = action->context; - YahooData *yd = gc->proto_data; - - PurpleUtilFetchUrlData *url_data; - const char* base_url = "http://login.yahoo.com"; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - gchar *request = g_strdup_printf( - "POST %s/config/cookie_token HTTP/1.0\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: login.yahoo.com\r\n" - "Content-Length: 0\r\n\r\n", - use_whole_url ? base_url : "", - yd->cookie_t, yd->cookie_y); - - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), base_url, use_whole_url, - YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, - yahoo_get_inbox_token_cb, gc); - - g_free(request); - - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - else { - const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); - purple_debug_error("yahoo", - "Unable to request mail login token; forwarding to login screen."); - purple_notify_uri(gc, yahoo_mail_url); - } -} - -static void -yahoo_set_userinfo_fn(PurplePluginAction *action) -{ - yahoo_set_userinfo(action->context); -} - -static void yahoo_show_act_id(PurplePluginAction *action) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - PurpleConnection *gc = (PurpleConnection *) action->context; - YahooData *yd = purple_connection_get_protocol_data(gc); - const char *name = purple_connection_get_display_name(gc); - int iter; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - field = purple_request_field_choice_new("id", "Activate which ID?", 0); - purple_request_field_group_add_field(group, field); - - for (iter = 0; yd->profiles[iter]; iter++) { - purple_request_field_choice_add(field, yd->profiles[iter]); - if (purple_strequal(yd->profiles[iter], name)) - purple_request_field_choice_set_default_value(field, iter); - } - - purple_request_fields(gc, NULL, _("Select the ID you want to activate"), NULL, - fields, - _("OK"), G_CALLBACK(yahoo_act_id), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -static void yahoo_show_chat_goto(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - purple_request_input(gc, NULL, _("Join whom in chat?"), NULL, - "", FALSE, FALSE, NULL, - _("OK"), G_CALLBACK(yahoo_chat_goto), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, - gc); -} - -GList *yahoo_actions(PurplePlugin *plugin, gpointer context) { - GList *m = NULL; - PurplePluginAction *act; - - act = purple_plugin_action_new(_("Set User Info..."), - yahoo_set_userinfo_fn); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Activate ID..."), - yahoo_show_act_id); - m = g_list_append(m, act); - - act = purple_plugin_action_new(_("Join User in Chat..."), - yahoo_show_chat_goto); - m = g_list_append(m, act); - - m = g_list_append(m, NULL); - act = purple_plugin_action_new(_("Open Inbox"), - yahoo_show_inbox); - m = g_list_append(m, act); - - return m; -} - -struct yahoo_sms_carrier_cb_data { - PurpleConnection *gc; - char *who; - char *what; -}; - -static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *webdata, size_t len, const gchar *error_message) -{ - struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; - PurpleConnection *gc = sms_cb_data->gc; - YahooData *yd = gc->proto_data; - char *status = NULL; - char *carrier = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); - - if (error_message != NULL) { - purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - - g_free(sms_cb_data->who); - g_free(sms_cb_data->what); - g_free(sms_cb_data); - return ; - } - else if (len > 0 && webdata && *webdata) { - xmlnode *validate_data_root = xmlnode_from_str(webdata, -1); - xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no"); - const char *mobile_no = xmlnode_get_attrib(validate_data_child, "msisdn"); - - validate_data_root = xmlnode_copy(validate_data_child); - validate_data_child = xmlnode_get_child(validate_data_root, "status"); - status = xmlnode_get_data(validate_data_child); - - validate_data_child = xmlnode_get_child(validate_data_root, "carrier"); - carrier = xmlnode_get_data(validate_data_child); - - purple_debug_info("yahoo", "SMS validate data: %s\n", webdata); - - if (status && g_str_equal(status, "Valid") == 0) { - g_hash_table_insert(yd->sms_carrier, - g_strdup_printf("+%s", mobile_no), g_strdup(carrier)); - yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, - sms_cb_data->what, PURPLE_MESSAGE_SEND); - } else { - g_hash_table_insert(yd->sms_carrier, - g_strdup_printf("+%s", mobile_no), g_strdup("Unknown")); - purple_conversation_write(conv, NULL, - _("Can't send SMS. Unknown mobile carrier."), - PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - - xmlnode_free(validate_data_child); - xmlnode_free(validate_data_root); - g_free(sms_cb_data->who); - g_free(sms_cb_data->what); - g_free(sms_cb_data); - g_free(status); - g_free(carrier); - } -} - -static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) -{ - YahooData *yd = gc->proto_data; - PurpleUtilFetchUrlData *url_data; - struct yahoo_sms_carrier_cb_data *sms_cb_data; - char *validate_request_str = NULL; - char *request = NULL; - gboolean use_whole_url = FALSE; - xmlnode *validate_request_root = NULL; - xmlnode *validate_request_child = NULL; - - if(!(sms_cb_data = data)) - return; - - validate_request_root = xmlnode_new("validate"); - xmlnode_set_attrib(validate_request_root, "intl", "us"); - xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION); - xmlnode_set_attrib(validate_request_root, "qos", "0"); - - validate_request_child = xmlnode_new_child(validate_request_root, "mobile_no"); - xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1); - - validate_request_str = xmlnode_to_str(validate_request_root, NULL); - - xmlnode_free(validate_request_child); - xmlnode_free(validate_request_root); - - request = g_strdup_printf( - "POST /mobileno?intl=us&version=%s HTTP/1.1\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: validate.msg.yahoo.com\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "Cache-Control: no-cache\r\n\r\n%s", - YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); - - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; - - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, - YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, - yahoo_get_sms_carrier_cb, data); - - g_free(request); - g_free(validate_request_str); - - if (!url_data) { - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); - purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(sms_cb_data->who); - g_free(sms_cb_data->what); - g_free(sms_cb_data); - } -} - -int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt = NULL; - char *msg = yahoo_html_to_codes(what); - char *msg2; - gboolean utf8 = TRUE; - PurpleWhiteboard *wb; - int ret = 1; - const char *fed_who; - gsize lenb = 0; - glong lenc = 0; - struct yahoo_p2p_data *p2p_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - msg2 = yahoo_string_encode(gc, msg, &utf8); - - if(msg2) { - lenb = strlen(msg2); - lenc = g_utf8_strlen(msg2, -1); - - if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) { - purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT - " bytes, %ld characters. Max is %d bytes, %d chars." - " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES, - YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2); - g_free(msg); - g_free(msg2); - return -E2BIG; - } - } - - fed = yahoo_get_federation_from_name(who); - - if (who[0] == '+') { - /* we have an sms to be sent */ - gchar *carrier = NULL; - const char *alias = NULL; - PurpleAccount *account = purple_connection_get_account(gc); - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); - - carrier = g_hash_table_lookup(yd->sms_carrier, who); - if (!carrier) { - struct yahoo_sms_carrier_cb_data *sms_cb_data; - sms_cb_data = g_malloc(sizeof(struct yahoo_sms_carrier_cb_data)); - sms_cb_data->gc = gc; - sms_cb_data->who = g_strdup(who); - sms_cb_data->what = g_strdup(what); - - purple_conversation_write(conv, NULL, _("Getting mobile carrier to send the SMS."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - - yahoo_get_sms_carrier(gc, sms_cb_data); - - g_free(msg); - g_free(msg2); - return ret; - } - else if( strcmp(carrier,"Unknown") == 0 ) { - purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); - - g_free(msg); - g_free(msg2); - return -1; - } - - alias = purple_account_get_alias(account); - pkt = yahoo_packet_new(YAHOO_SERVICE_SMS_MSG, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sssss", - 1, purple_connection_get_display_name(gc), - 69, alias, - 5, who + 1, - 68, carrier, - 14, msg2); - yahoo_packet_send_and_free(pkt, yd); - - g_free(msg); - g_free(msg2); - - return ret; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, yd->session_id); - fed_who = who; - switch (fed) { - case YAHOO_FEDERATION_MSN: - case YAHOO_FEDERATION_OCS: - case YAHOO_FEDERATION_IBM: - case YAHOO_FEDERATION_PBX: - fed_who += 4; - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, fed_who); - if (fed) - yahoo_packet_hash_int(pkt, 241, fed); - - if (utf8) - yahoo_packet_hash_str(pkt, 97, "1"); - yahoo_packet_hash_str(pkt, 14, msg2); - - /* - * IMVironment. - * - * If this message is to a user who is also Doodling with the local user, - * format the chat packet with the correct IMV information (thanks Yahoo!) - * - * Otherwise attempt to use the same IMVironment as the remote user, - * just so that we don't inadvertantly reset their IMVironment back - * to nothing. - * - * If they have not set an IMVironment, then use the default. - */ - wb = purple_whiteboard_get_session(gc->account, who); - if (wb) - yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); - else - { - const char *imv; - imv = g_hash_table_lookup(yd->imvironments, who); - if (imv != NULL) - yahoo_packet_hash_str(pkt, 63, imv); - else - yahoo_packet_hash_str(pkt, 63, ";0"); - } - - yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ - yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ - if (!yd->picture_url) - yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ - else - yahoo_packet_hash_str(pkt, 206, "2"); - - /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ - if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) { - /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */ - if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) { - yahoo_packet_hash_int(pkt, 11, p2p_data->session_id); - yahoo_p2p_write_pkt(p2p_data->source, pkt); - } - else { - yahoo_packet_send(pkt, yd); - if(!fed) - yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */ - } - } - else - ret = -E2BIG; - - yahoo_packet_free(pkt); - - g_free(msg); - g_free(msg2); - - return ret; -} - -unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) -{ - YahooData *yd = gc->proto_data; - struct yahoo_p2p_data *p2p_data; - YahooFederation fed = YAHOO_FEDERATION_NONE; - struct yahoo_packet *pkt = NULL; - - fed = yahoo_get_federation_from_name(who); - - /* Don't do anything if sms is being typed */ - if( strncmp(who, "+", 1) == 0 ) - return 0; - - pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, yd->session_id); - - /* check to see if p2p link exists, send through it */ - if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) { - yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc), - 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", - 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */ - yahoo_p2p_write_pkt(p2p_data->source, pkt); - yahoo_packet_free(pkt); - } - else { /* send through yahoo server */ - - const char *fed_who = who; - switch (fed) { - case YAHOO_FEDERATION_MSN: - case YAHOO_FEDERATION_OCS: - case YAHOO_FEDERATION_IBM: - case YAHOO_FEDERATION_PBX: - fed_who += 4; - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - - yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), - 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", - 5, fed_who, 1002, "1"); - if (fed) - yahoo_packet_hash_int(pkt, 241, fed); - yahoo_packet_send_and_free(pkt, yd); - } - - return 0; -} - -static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data) -{ - YahooFriend *f = value; - if (f && f->presence == YAHOO_PRESENCE_ONLINE) - f->presence = YAHOO_PRESENCE_DEFAULT; -} - -void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) -{ - PurpleConnection *gc; - PurplePresence *presence; - YahooData *yd; - struct yahoo_packet *pkt; - int old_status; - const char *msg = NULL; - char *tmp = NULL; - char *conv_msg = NULL; - gboolean utf8 = TRUE; - - if (!purple_status_is_active(status)) - return; - - gc = purple_account_get_connection(account); - presence = purple_status_get_presence(status); - yd = (YahooData *)gc->proto_data; - old_status = yd->current_status; - - yd->current_status = get_yahoo_status_from_purple_status(status); - - if (yd->current_status == YAHOO_STATUS_CUSTOM) - { - msg = purple_status_get_attr_string(status, "message"); - - if (purple_status_is_available(status)) { - tmp = yahoo_string_encode(gc, msg, &utf8); - conv_msg = purple_markup_strip_html(tmp); - g_free(tmp); - } else { - if ((msg == NULL) || (*msg == '\0')) - msg = _("Away"); - tmp = yahoo_string_encode(gc, msg, &utf8); - conv_msg = purple_markup_strip_html(tmp); - g_free(tmp); - } - } - - if (yd->current_status == YAHOO_STATUS_INVISIBLE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 13, "2"); - yahoo_packet_send_and_free(pkt, yd); - - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_int(pkt, 10, yd->current_status); - - if (yd->current_status == YAHOO_STATUS_CUSTOM) { - yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); - yahoo_packet_hash_str(pkt, 19, conv_msg); - } else { - yahoo_packet_hash_str(pkt, 19, ""); - } - - g_free(conv_msg); - - if (purple_presence_is_idle(presence)) - yahoo_packet_hash_str(pkt, 47, "2"); - else { - if (!purple_status_is_available(status)) - yahoo_packet_hash_str(pkt, 47, "1"); - else - yahoo_packet_hash_str(pkt, 47, "0"); - } - - yahoo_packet_send_and_free(pkt, yd); - - if (old_status == YAHOO_STATUS_INVISIBLE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 13, "1"); - yahoo_packet_send_and_free(pkt, yd); - - /* Any per-session presence settings are removed */ - g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL); - - } -} - -void yahoo_set_idle(PurpleConnection *gc, int idle) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt = NULL; - char *msg = NULL, *msg2 = NULL; - PurpleStatus *status = NULL; - gboolean invisible = FALSE; - - if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) - yd->current_status = YAHOO_STATUS_IDLE; - else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { - status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); - yd->current_status = get_yahoo_status_from_purple_status(status); - } - - invisible = (yd->current_status == YAHOO_STATUS_INVISIBLE); - - pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); - - if (!idle && invisible) - yahoo_packet_hash_int(pkt, 10, YAHOO_STATUS_AVAILABLE); - else - yahoo_packet_hash_int(pkt, 10, yd->current_status); - - if (yd->current_status == YAHOO_STATUS_CUSTOM) { - const char *tmp; - if (status == NULL) - status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); - tmp = purple_status_get_attr_string(status, "message"); - if (tmp != NULL) { - gboolean utf8 = TRUE; - msg = yahoo_string_encode(gc, tmp, &utf8); - msg2 = purple_markup_strip_html(msg); - yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); - yahoo_packet_hash_str(pkt, 19, msg2); - } else { - /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for - * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ - yahoo_packet_hash_str(pkt, 19, _("Away")); - } - } else { - yahoo_packet_hash_str(pkt, 19, ""); - } - - if (idle) - yahoo_packet_hash_str(pkt, 47, "2"); - - yahoo_packet_send_and_free(pkt, yd); - - g_free(msg); - g_free(msg2); -} - -GList *yahoo_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, type); - - type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY, - NULL, TRUE, TRUE, FALSE, - "message", _("Message"), - purple_value_new(PURPLE_TYPE_STRING), NULL); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE); - types = g_list_append(types, type); - - - type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE); - types = g_list_append(types, type); - - type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); - types = g_list_append(types, type); - - return types; -} - -void yahoo_keepalive(PurpleConnection *gc) -{ - struct yahoo_packet *pkt; - YahooData *yd = gc->proto_data; - time_t now = time(NULL); - - /* We're only allowed to send a ping once an hour or the servers will boot us */ - if ((now - yd->last_ping) >= PING_TIMEOUT) { - yd->last_ping = now; - - /* The native client will only send PING or CHATPING */ - if (yd->chat_online) { - if (yd->wm) { - ycht_chat_send_keepalive(yd->ycht); - } else { - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc)); - yahoo_packet_send_and_free(pkt, yd); - } - } else { - pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_send_and_free(pkt, yd); - } - } - - if ((now - yd->last_keepalive) >= KEEPALIVE_TIMEOUT) { - yd->last_keepalive = now; - pkt = yahoo_packet_new(YAHOO_SERVICE_KEEPALIVE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); - yahoo_packet_send_and_free(pkt, yd); - } - -} - -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) -{ - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - const char *group = NULL; - char *group2; - YahooFriend *f; - const char *bname; - const char *fed_bname; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - if (!yd->logged_in) - return; - - fed_bname = bname = purple_buddy_get_name(buddy); - if (!purple_privacy_check(purple_connection_get_account(gc), bname)) - return; - - f = yahoo_friend_find(gc, bname); - fed = yahoo_get_federation_from_name(bname); - if (fed != YAHOO_FEDERATION_NONE) - fed_bname += 4; - - g = purple_buddy_get_group(buddy); - if (g) - group = purple_group_get_name(g); - else - group = "Buddies"; - - group2 = yahoo_string_encode(gc, group, NULL); - pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); - if (fed) { - yahoo_packet_hash(pkt, "sssssssisss", - 14, "", - 65, group2, - 97, "1", - 1, purple_connection_get_display_name(gc), - 302, "319", - 300, "319", - 7, fed_bname, - 241, fed, - 334, "0", - 301, "319", - 303, "319" - ); - } - else { - yahoo_packet_hash(pkt, "ssssssssss", - 14, "", - 65, group2, - 97, "1", - 1, purple_connection_get_display_name(gc), - 302, "319", - 300, "319", - 7, fed_bname, - 334, "0", - 301, "319", - 303, "319" - ); - } - - yahoo_packet_send_and_free(pkt, yd); - g_free(group2); -} - -void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) -{ - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - GSList *buddies, *l; - PurpleGroup *g; - gboolean remove = TRUE; - char *cg; - const char *bname, *gname; - YahooFriend *f = NULL; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - bname = purple_buddy_get_name(buddy); - f = yahoo_friend_find(gc, bname); - if (!f) - return; - fed = f->fed; - - gname = purple_group_get_name(group); - buddies = purple_find_buddies(purple_connection_get_account(gc), bname); - for (l = buddies; l; l = l->next) { - g = purple_buddy_get_group(l->data); - if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) { - remove = FALSE; - break; - } - } - - g_slist_free(buddies); - - if (remove) { - g_hash_table_remove(yd->friends, bname); - f = NULL; /* f no longer valid - Just making it clear */ - } - - cg = yahoo_string_encode(gc, gname, NULL); - pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); - - switch (fed) { - case YAHOO_FEDERATION_MSN: - case YAHOO_FEDERATION_OCS: - case YAHOO_FEDERATION_IBM: - bname += 4; - break; - case YAHOO_FEDERATION_NONE: - default: - break; - } - - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), - 7, bname, 65, cg); - if (fed) - yahoo_packet_hash_int(pkt, 241, fed); - yahoo_packet_send_and_free(pkt, yd); - g_free(cg); -} - -void yahoo_add_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - if (!yd->logged_in) - return; - - if (!who || who[0] == '\0') - return; - - fed = yahoo_get_federation_from_name(who); - - pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id); - - if(fed) - yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "1"); - else - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "1"); - - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_rem_deny(PurpleConnection *gc, const char *who) { - YahooData *yd = (YahooData *)gc->proto_data; - struct yahoo_packet *pkt; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - if (!yd->logged_in) - return; - - if (!who || who[0] == '\0') - return; - fed = yahoo_get_federation_from_name(who); - - pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id); - - if(fed) - yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "2"); - else - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2"); - - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_set_permit_deny(PurpleConnection *gc) -{ - PurpleAccount *account; - GSList *deny; - - account = purple_connection_get_account(gc); - - switch (account->perm_deny) - { - case PURPLE_PRIVACY_ALLOW_ALL: - for (deny = account->deny; deny; deny = deny->next) - yahoo_rem_deny(gc, deny->data); - break; - - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - case PURPLE_PRIVACY_ALLOW_USERS: - case PURPLE_PRIVACY_DENY_USERS: - case PURPLE_PRIVACY_DENY_ALL: - for (deny = account->deny; deny; deny = deny->next) - yahoo_add_deny(gc, deny->data); - break; - } -} - -void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, - const char *old_group, const char *new_group) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *gpn, *gpo; - YahooFriend *f = yahoo_friend_find(gc, who); - const char *temp = NULL; - - /* Step 0: If they aren't on the server list anyway, - * don't bother letting the server know. - */ - if (!f) - return; - - if(f->fed) { - temp = who+4; - } else - temp = who; - - /* If old and new are the same, we would probably - * end up deleting the buddy, which would be bad. - * This might happen because of the charset conversation. - */ - gpn = yahoo_string_encode(gc, new_group, NULL); - gpo = yahoo_string_encode(gc, old_group, NULL); - if (!strcmp(gpn, gpo)) { - g_free(gpn); - g_free(gpo); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - if(f->fed) - yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc), - 302, "240", 300, "240", 7, temp, 241, f->fed, 224, gpo, 264, gpn, 301, - "240", 303, "240"); - else - yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), - 302, "240", 300, "240", 7, temp, 224, gpo, 264, gpn, 301, - "240", 303, "240"); - yahoo_packet_send_and_free(pkt, yd); - - g_free(gpn); - g_free(gpo); -} - -void yahoo_rename_group(PurpleConnection *gc, const char *old_name, - PurpleGroup *group, GList *moved_buddies) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *gpn, *gpo; - - gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); - gpo = yahoo_string_encode(gc, old_name, NULL); - if (!strcmp(gpn, gpo)) { - g_free(gpn); - g_free(gpo); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), - 65, gpo, 67, gpn); - yahoo_packet_send_and_free(pkt, yd); - g_free(gpn); - g_free(gpo); -} - -/********************************* Commands **********************************/ - -PurpleCmdRet -yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { - PurpleAccount *account = purple_conversation_get_account(c); - - if (*args && args[0]) - return PURPLE_CMD_RET_FAILED; - - purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ); - - return PURPLE_CMD_RET_OK; -} - -PurpleCmdRet -yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, - char **args, char **error, void *data) -{ - GHashTable *comp; - PurpleConnection *gc; - YahooData *yd; - int id; - - if (!args || !args[0]) - return PURPLE_CMD_RET_FAILED; - - gc = purple_conversation_get_gc(conv); - yd = gc->proto_data; - id = yd->conf_id; - purple_debug_info("yahoo", "Trying to join %s \n", args[0]); - - comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1)); - g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); - - yahoo_c_join(gc, comp); - - g_hash_table_destroy(comp); - return PURPLE_CMD_RET_OK; -} - -PurpleCmdRet -yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, - char **args, char **error, void *data) -{ - PurpleAccount *account = purple_conversation_get_account(conv); - if (*args && args[0]) - return PURPLE_CMD_RET_FAILED; - purple_roomlist_show_with_account(account); - return PURPLE_CMD_RET_OK; -} - -gboolean yahoo_offline_message(const PurpleBuddy *buddy) -{ - return TRUE; -} - -gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type) -{ - PurpleConversation *c; - - c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, - username, gc->account); - - g_return_val_if_fail(c != NULL, FALSE); - - purple_debug_info("yahoo", "Sending on account %s to buddy %s.\n", - username, c->name); - purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "", PURPLE_MESSAGE_INVISIBLE); - - return TRUE; -} - -GList *yahoo_attention_types(PurpleAccount *account) -{ - static GList *list = NULL; - - if (!list) { - /* Yahoo only supports one attention command: the 'buzz'. */ - /* This is index number YAHOO_BUZZ. */ - list = g_list_append(list, purple_attention_type_new("Buzz", _("Buzz"), - _("%s has buzzed you!"), _("Buzzing %s..."))); - } - - return list; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/libymsg.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,396 +0,0 @@ -/** - * @file libymsg.h The Yahoo! and Yahoo! JAPAN Protocol Plugins - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _LIBYMSG_H_ -#define _LIBYMSG_H_ - -#include "circbuffer.h" -#include "cmds.h" -#include "prpl.h" - -#define YAHOO_PAGER_HOST "scsa.msg.yahoo.com" -#define YAHOO_PAGER_PORT 5050 -#define YAHOO_PAGER_PORT_P2P 5101 -#define YAHOO_LOGIN_URL "https://login.yahoo.com/config/pwtoken_login?src=ymsgr&ts=&token=%s" -#define YAHOO_TOKEN_URL "https://login.yahoo.com/config/pwtoken_get?src=ymsgr&ts=&login=%s&passwd=%s&chal=%s" -#define YAHOO_P2P_KEEPALIVE_SECS 300 -#define YAHOO_P2P_SERVER_TIMEOUT 10 -#define YAHOO_PROFILE_URL "http://profiles.yahoo.com/" -#define YAHOO_MAIL_URL "http://rd.yahoo.com/messenger/client/?http://mail.yahoo.com/" -#define YAHOO_XFER_HOST "filetransfer.msg.yahoo.com" -#define YAHOO_XFER_PORT 80 -#define YAHOO_XFER_RELAY_HOST "relay.msg.yahoo.com" -#define YAHOO_XFER_RELAY_PORT 80 -#define YAHOO_ROOMLIST_URL "http://insider.msg.yahoo.com/ycontent/" -#define YAHOO_ROOMLIST_LOCALE "us" -/* really we should get the list of servers from - http://update.messenger.yahoo.co.jp/servers.html */ -#define YAHOOJP_PAGER_HOST "cs.yahoo.co.jp" -#define YAHOOJP_TOKEN_URL "https://login.yahoo.co.jp/config/pwtoken_get?src=ymsgr&ts=&login=%s&passwd=%s&chal=%s" -#define YAHOOJP_LOGIN_URL "https://login.yahoo.co.jp/config/pwtoken_login?src=ymsgr&ts=&token=%s" -#define YAHOOJP_PROFILE_URL "http://profiles.yahoo.co.jp/" -#define YAHOOJP_MAIL_URL "http://mail.yahoo.co.jp/" -#define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp" -#define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp" -/* not sure, must test: */ -#define YAHOOJP_XFER_RELAY_HOST "relay.msg.yahoo.co.jp" -#define YAHOOJP_XFER_RELAY_PORT 80 -#define YAHOOJP_ROOMLIST_URL "http://insider.msg.yahoo.co.jp/ycontent/" -#define YAHOOJP_ROOMLIST_LOCALE "ja" - -#define YAHOO_AUDIBLE_URL "http://us.dl1.yimg.com/download.yahoo.com/dl/aud" - -#define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" - -#define YAHOO_SMS_CARRIER_URL "http://lookup.msg.vip.mud.yahoo.com" - -#define YAHOO_USERINFO_URL "http://address.yahoo.com/yab/us?v=XM&sync=1&tags=short&useutf8=1&noclear=1&legenc=codepage-1252" -#define YAHOOJP_USERINFO_URL "http://address.yahoo.co.jp/yab/jp?v=XM&sync=1&tags=short&useutf8=1&noclear=1&legenc=codepage-1252" - -#define YAHOO_PICURL_SETTING "picture_url" -#define YAHOO_PICCKSUM_SETTING "picture_checksum" -#define YAHOO_PICEXPIRE_SETTING "picture_expire" - -#define YAHOO_STATUS_TYPE_OFFLINE "offline" -#define YAHOO_STATUS_TYPE_AVAILABLE "available" -#define YAHOO_STATUS_TYPE_BRB "brb" -#define YAHOO_STATUS_TYPE_BUSY "busy" -#define YAHOO_STATUS_TYPE_NOTATHOME "notathome" -#define YAHOO_STATUS_TYPE_NOTATDESK "notatdesk" -#define YAHOO_STATUS_TYPE_NOTINOFFICE "notinoffice" -#define YAHOO_STATUS_TYPE_ONPHONE "onphone" -#define YAHOO_STATUS_TYPE_ONVACATION "onvacation" -#define YAHOO_STATUS_TYPE_OUTTOLUNCH "outtolunch" -#define YAHOO_STATUS_TYPE_STEPPEDOUT "steppedout" -#define YAHOO_STATUS_TYPE_AWAY "away" -#define YAHOO_STATUS_TYPE_INVISIBLE "invisible" -#define YAHOO_STATUS_TYPE_MOBILE "mobile" - -#define YAHOO_CLIENT_VERSION_ID "4194239" -#define YAHOO_CLIENT_VERSION "9.0.0.2162" - -#define YAHOOJP_CLIENT_VERSION_ID "4194239" -#define YAHOOJP_CLIENT_VERSION "9.0.0.2162" - -#define YAHOO_CLIENT_USERAGENT "Mozilla/5.0" - -/* Index into attention types list. */ -#define YAHOO_BUZZ 0 - -typedef enum { - YAHOO_PKT_TYPE_SERVER = 0, - YAHOO_PKT_TYPE_P2P -} yahoo_pkt_type; - -typedef enum { - YAHOO_P2P_WE_ARE_CLIENT =0, - YAHOO_P2P_WE_ARE_SERVER -} yahoo_p2p_connection_type; - -enum yahoo_status { - YAHOO_STATUS_AVAILABLE = 0, - YAHOO_STATUS_BRB, - YAHOO_STATUS_BUSY, - YAHOO_STATUS_NOTATHOME, - YAHOO_STATUS_NOTATDESK, - YAHOO_STATUS_NOTINOFFICE, - YAHOO_STATUS_ONPHONE, - YAHOO_STATUS_ONVACATION, - YAHOO_STATUS_OUTTOLUNCH, - YAHOO_STATUS_STEPPEDOUT, - YAHOO_STATUS_INVISIBLE = 12, - YAHOO_STATUS_CUSTOM = 99, - YAHOO_STATUS_IDLE = 999, - YAHOO_STATUS_WEBLOGIN = 0x5a55aa55, - YAHOO_STATUS_OFFLINE = 0x5a55aa56, /* don't ask */ - YAHOO_STATUS_TYPING = 0x16, - YAHOO_STATUS_DISCONNECTED = 0xffffffff /* in ymsg 15. doesnt mean the normal sense of 'disconnected' */ -}; - -/* - * Yahoo federated networks. Key 241 in ymsg. - * If it doesn't exist, it is on Yahoo's netowrk. - * It if does exist, send to another IM network. - */ - -typedef enum { - YAHOO_FEDERATION_NONE = 0, /* No federation - Yahoo! network */ - YAHOO_FEDERATION_OCS = 1, /* LCS or OCS private networks */ - YAHOO_FEDERATION_MSN = 2, /* MSN or Windows Live network */ - YAHOO_FEDERATION_IBM = 9, /* IBM/Sametime network */ - YAHOO_FEDERATION_PBX = 100 /* Yahoo! Pingbox service */ -} YahooFederation; - - -struct yahoo_buddy_icon_upload_data { - PurpleConnection *gc; - GString *str; - char *filename; - int pos; - int fd; - guint watcher; -}; - -struct yahoo_p2p_data { - PurpleConnection *gc; - char *host_ip; - char *host_username; - int val_13; - guint input_event; - gint source; - int session_id; - yahoo_p2p_connection_type connection_type; -}; - -struct _YchtConn; - -typedef struct _YahooPersonalDetails { - char *id; - - struct { - char *first; - char *last; - char *middle; - char *nick; - } names; - - struct { - char *work; - char *home; - char *mobile; - } phone; -} YahooPersonalDetails; - -typedef struct { - PurpleConnection *gc; - int fd; - guchar *rxqueue; - int rxlen; - PurpleCircBuffer *txbuf; - guint txhandler; - GHashTable *friends; - - char **profiles; /* Multiple profiles can be associated with an account */ - YahooPersonalDetails ypd; - - /** - * This is used to keep track of the IMVironment chosen - * by people you talk to. We don't do very much with - * this right now... but at least now if the remote user - * selects an IMVironment we won't reset it back to the - * default of nothing. - */ - GHashTable *imvironments; - - int current_status; - gboolean logged_in; - GString *tmp_serv_blist, *tmp_serv_ilist, *tmp_serv_plist; - GSList *confs; - unsigned int conf_id; /* just a counter */ - gboolean chat_online; - gboolean in_chat; - char *chat_name; - char *pending_chat_room; - char *pending_chat_id; - char *pending_chat_topic; - char *pending_chat_goto; - char *auth; - gsize auth_written; - char *cookie_y; - char *cookie_t; - int session_id; - gboolean jp; - gboolean wm; /* connected w/ web messenger method */ - /* picture aka buddy icon stuff */ - char *picture_url; - int picture_checksum; - - /* ew. we have to check the icon before we connect, - * but can't upload it til we're connected. */ - struct yahoo_buddy_icon_upload_data *picture_upload_todo; - PurpleProxyConnectData *buddy_icon_connect_data; - - struct _YchtConn *ycht; - - /** - * This linked list contains PurpleUtilFetchUrlData structs - * for when we lookup people profile or photo information. - */ - GSList *url_datas; - GHashTable *xfer_peer_idstring_map;/* Hey, i dont know, but putting this HashTable next to friends gives a run time fault... */ - GSList *cookies;/* contains all cookies, including _y and _t */ - - /** - * We may receive a list15 in multiple packets with no prior warning as to how many we'll be getting; - * the server expects us to keep track of the group for which it is sending us contact names. - */ - char *current_list15_grp; - time_t last_ping; - time_t last_keepalive; - GHashTable *peers; /* information about p2p data */ - int yahoo_p2p_timer; - int yahoo_local_p2p_server_fd; - int yahoo_p2p_server_watcher; - GHashTable *sms_carrier; /* sms carrier data */ - guint yahoo_p2p_server_timeout_handle; -} YahooData; - -#define YAHOO_MAX_STATUS_MESSAGE_LENGTH (255) - -/* - * Current Maximum Length for Instant Messages - * - * This was found by experiment. - * - * The YMSG protocol allows a message of up to 948 bytes, but the official client - * limits to 800 characters. According to experiments I conducted, it seems that - * the discrepancy is to allow some leeway for messages with mixed single- and - * multi-byte characters, as I was able to send messages of 840 and 932 bytes - * by using some multibyte characters (some random Chinese or Japanese characters, - * to be precise). - rekkanoryo - */ -#define YAHOO_MAX_MESSAGE_LENGTH_BYTES 948 -#define YAHOO_MAX_MESSAGE_LENGTH_CHARS 800 - -/* sometimes i wish prpls could #include things from other prpls. then i could just - * use the routines from libfaim and not have to admit to knowing how they work. */ -#define yahoo_put16(buf, data) ( \ - (*(buf) = (unsigned char)((data)>>8)&0xff), \ - (*((buf)+1) = (unsigned char)(data)&0xff), \ - 2) -#define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) -#define yahoo_put32(buf, data) ( \ - (*((buf)) = (unsigned char)((data)>>24)&0xff), \ - (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ - (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ - (*((buf)+3) = (unsigned char)(data)&0xff), \ - 4) -#define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \ - (((*((buf)+1))<<16)&0x00ff0000) + \ - (((*((buf)+2))<< 8)&0x0000ff00) + \ - (((*((buf)+3) )&0x000000ff))) - -/* util.c */ -void yahoo_init_colorht(void); -void yahoo_dest_colorht(void); -char *yahoo_codes_to_html(const char *x); - -/** - * This function takes a normal HTML message and converts it to the message - * format used by Yahoo, which uses a frankensteinish combination of ANSI - * escape codes and broken HTML. - * - * It results in slightly different output than would be sent by official - * Yahoo clients. The two main differences are: - * - * 1. We always close all tags, whereas official Yahoo clients leave tags - * dangling open at the end of each message (and the client treats them - * as closed). - * 2. We always close inner tags first before closing outter tags. - * - * For example, if you want to send this message: - * bold bolditalic italic - * Official Yahoo clients would send: - * ESC[1m bold ESC[2m bolditalic ESC[x1m italic - * But we will send: - * ESC[1m bold ESC[2m bolditalic ESC[x2mESC[x1mESC[2m italic ESC[x2m - */ -char *yahoo_html_to_codes(const char *src); - -gboolean -yahoo_account_use_http_proxy(PurpleConnection *conn); - -/** - * Encode some text to send to the yahoo server. - * - * @param gc The connection handle. - * @param str The null terminated utf8 string to encode. - * @param utf8 If not @c NULL, whether utf8 is okay or not. - * Even if it is okay, we may not use it. If we - * used it, we set this to @c TRUE, else to - * @c FALSE. If @c NULL, false is assumed, and - * it is not dereferenced. - * @return The g_malloced string in the appropriate encoding. - */ -char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8); - -/** - * Decode some text received from the server. - * - * @param gc The gc handle. - * @param str The null terminated string to decode. - * @param utf8 Did the server tell us it was supposed to be utf8? - * @return The decoded, utf-8 string, which must be g_free()'d. - */ -char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8); - -char *yahoo_convert_to_numeric(const char *str); - -YahooFederation yahoo_get_federation_from_name(const char *who); - -/* yahoo_profile.c */ -void yahoo_get_info(PurpleConnection *gc, const char *name); - -/* libymsg.h - these functions were formerly static but need not to be for the - * new two-prpl model. */ -const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b); -const char *yahoo_list_emblem(PurpleBuddy *b); -char *yahoo_status_text(PurpleBuddy *b); -void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); -GList *yahoo_status_types(PurpleAccount *account); -GList *yahoo_blist_node_menu(PurpleBlistNode *node); -void yahoo_login(PurpleAccount *account); -void yahoo_close(PurpleConnection *gc); -int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags); -unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state); -void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); -void yahoo_set_idle(PurpleConnection *gc, int idle); -void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g); -void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); -void yahoo_add_deny(PurpleConnection *gc, const char *who); -void yahoo_rem_deny(PurpleConnection *gc, const char *who); -void yahoo_set_permit_deny(PurpleConnection *gc); -void yahoo_keepalive(PurpleConnection *gc); -void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group); -void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies); -gboolean yahoo_offline_message(const PurpleBuddy *buddy); -gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type); -GList *yahoo_attention_types(PurpleAccount *account); - -GList *yahoo_actions(PurplePlugin *plugin, gpointer context); -void yahoopurple_register_commands(void); - -PurpleCmdRet yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data); -PurpleCmdRet yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data); -PurpleCmdRet yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data); -/* needed for xfer, thought theyd be useful for other enhancements later on - Returns list of cookies stored in yahoo_data formatted as a single null terminated string - returned value must be g_freed -*/ -gchar* yahoo_get_cookies(PurpleConnection *gc); - -/* send p2p pkt containing our encoded ip, asking peer to connect to us */ -void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13); - -#endif /* _LIBYMSG_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,60 +0,0 @@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -YAHOOSOURCES = \ - libymsg.c \ - libymsg.h \ - util.c \ - yahoochat.h \ - yahoochat.c \ - yahoo_aliases.c \ - yahoo_aliases.h \ - yahoo_doodle.h \ - yahoo_doodle.c \ - yahoo_filexfer.h \ - yahoo_filexfer.c \ - yahoo_friend.h \ - yahoo_friend.c \ - yahoo_packet.h \ - yahoo_packet.c \ - yahoo_picture.c \ - yahoo_picture.h \ - yahoo_profile.c \ - ycht.c \ - ycht.h - -AM_CFLAGS = $(st) - -libyahoo_la_LDFLAGS = -module -avoid-version -libyahoojp_la_LDFLAGS = -module -avoid-version - -if STATIC_YAHOO - -st = -DPURPLE_STATIC_PRPL -noinst_LTLIBRARIES = libymsg.la -libymsg_la_SOURCES = $(YAHOOSOURCES) libyahoo.c libyahoojp.c -libymsg_la_CFLAGS = $(AM_CFLAGS) - -else - -st = -pkg_LTLIBRARIES = libymsg.la libyahoo.la libyahoojp.la - -libymsg_la_SOURCES = $(YAHOOSOURCES) -libymsg_la_LIBADD = $(GLIB_LIBS) - -libyahoo_la_SOURCES = libyahoo.c -libyahoo_la_LIBADD = libymsg.la - -libyahoojp_la_SOURCES = libyahoojp.c -libyahoojp_la_LIBADD = libymsg.la - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,890 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/yahoo -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -@STATIC_YAHOO_FALSE@libyahoo_la_DEPENDENCIES = libymsg.la -am__libyahoo_la_SOURCES_DIST = libyahoo.c -@STATIC_YAHOO_FALSE@am_libyahoo_la_OBJECTS = libyahoo.lo -libyahoo_la_OBJECTS = $(am_libyahoo_la_OBJECTS) -@STATIC_YAHOO_FALSE@am_libyahoo_la_rpath = -rpath $(pkgdir) -@STATIC_YAHOO_FALSE@libyahoojp_la_DEPENDENCIES = libymsg.la -am__libyahoojp_la_SOURCES_DIST = libyahoojp.c -@STATIC_YAHOO_FALSE@am_libyahoojp_la_OBJECTS = libyahoojp.lo -libyahoojp_la_OBJECTS = $(am_libyahoojp_la_OBJECTS) -@STATIC_YAHOO_FALSE@am_libyahoojp_la_rpath = -rpath $(pkgdir) -am__DEPENDENCIES_1 = -@STATIC_YAHOO_FALSE@libymsg_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__libymsg_la_SOURCES_DIST = libymsg.c libymsg.h util.c yahoochat.h \ - yahoochat.c yahoo_aliases.c yahoo_aliases.h yahoo_doodle.h \ - yahoo_doodle.c yahoo_filexfer.h yahoo_filexfer.c \ - yahoo_friend.h yahoo_friend.c yahoo_packet.h yahoo_packet.c \ - yahoo_picture.c yahoo_picture.h yahoo_profile.c ycht.c ycht.h \ - libyahoo.c libyahoojp.c -am__objects_1 = libymsg_la-libymsg.lo libymsg_la-util.lo \ - libymsg_la-yahoochat.lo libymsg_la-yahoo_aliases.lo \ - libymsg_la-yahoo_doodle.lo libymsg_la-yahoo_filexfer.lo \ - libymsg_la-yahoo_friend.lo libymsg_la-yahoo_packet.lo \ - libymsg_la-yahoo_picture.lo libymsg_la-yahoo_profile.lo \ - libymsg_la-ycht.lo -@STATIC_YAHOO_FALSE@am_libymsg_la_OBJECTS = $(am__objects_1) -@STATIC_YAHOO_TRUE@am_libymsg_la_OBJECTS = $(am__objects_1) \ -@STATIC_YAHOO_TRUE@ libymsg_la-libyahoo.lo \ -@STATIC_YAHOO_TRUE@ libymsg_la-libyahoojp.lo -libymsg_la_OBJECTS = $(am_libymsg_la_OBJECTS) -@STATIC_YAHOO_FALSE@am_libymsg_la_rpath = -rpath $(pkgdir) -@STATIC_YAHOO_TRUE@am_libymsg_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libyahoo_la_SOURCES) $(libyahoojp_la_SOURCES) \ - $(libymsg_la_SOURCES) -DIST_SOURCES = $(am__libyahoo_la_SOURCES_DIST) \ - $(am__libyahoojp_la_SOURCES_DIST) \ - $(am__libymsg_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - Makefile.mingw - -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -YAHOOSOURCES = \ - libymsg.c \ - libymsg.h \ - util.c \ - yahoochat.h \ - yahoochat.c \ - yahoo_aliases.c \ - yahoo_aliases.h \ - yahoo_doodle.h \ - yahoo_doodle.c \ - yahoo_filexfer.h \ - yahoo_filexfer.c \ - yahoo_friend.h \ - yahoo_friend.c \ - yahoo_packet.h \ - yahoo_packet.c \ - yahoo_picture.c \ - yahoo_picture.h \ - yahoo_profile.c \ - ycht.c \ - ycht.h - -AM_CFLAGS = $(st) -libyahoo_la_LDFLAGS = -module -avoid-version -libyahoojp_la_LDFLAGS = -module -avoid-version -@STATIC_YAHOO_FALSE@st = -@STATIC_YAHOO_TRUE@st = -DPURPLE_STATIC_PRPL -@STATIC_YAHOO_TRUE@noinst_LTLIBRARIES = libymsg.la -@STATIC_YAHOO_FALSE@libymsg_la_SOURCES = $(YAHOOSOURCES) -@STATIC_YAHOO_TRUE@libymsg_la_SOURCES = $(YAHOOSOURCES) libyahoo.c libyahoojp.c -@STATIC_YAHOO_TRUE@libymsg_la_CFLAGS = $(AM_CFLAGS) -@STATIC_YAHOO_FALSE@pkg_LTLIBRARIES = libymsg.la libyahoo.la libyahoojp.la -@STATIC_YAHOO_FALSE@libymsg_la_LIBADD = $(GLIB_LIBS) -@STATIC_YAHOO_FALSE@libyahoo_la_SOURCES = libyahoo.c -@STATIC_YAHOO_FALSE@libyahoo_la_LIBADD = libymsg.la -@STATIC_YAHOO_FALSE@libyahoojp_la_SOURCES = libyahoojp.c -@STATIC_YAHOO_FALSE@libyahoojp_la_LIBADD = libymsg.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/yahoo/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/yahoo/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libyahoo.la: $(libyahoo_la_OBJECTS) $(libyahoo_la_DEPENDENCIES) - $(LINK) $(am_libyahoo_la_rpath) $(libyahoo_la_LDFLAGS) $(libyahoo_la_OBJECTS) $(libyahoo_la_LIBADD) $(LIBS) -libyahoojp.la: $(libyahoojp_la_OBJECTS) $(libyahoojp_la_DEPENDENCIES) - $(LINK) $(am_libyahoojp_la_rpath) $(libyahoojp_la_LDFLAGS) $(libyahoojp_la_OBJECTS) $(libyahoojp_la_LIBADD) $(LIBS) -libymsg.la: $(libymsg_la_OBJECTS) $(libymsg_la_DEPENDENCIES) - $(LINK) $(am_libymsg_la_rpath) $(libymsg_la_LDFLAGS) $(libymsg_la_OBJECTS) $(libymsg_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libyahoo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libyahoojp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-libyahoo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-libyahoojp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-libymsg.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-util.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_aliases.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_doodle.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_filexfer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_friend.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_packet.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_picture.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoo_profile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-yahoochat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libymsg_la-ycht.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libymsg_la-libymsg.lo: libymsg.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-libymsg.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-libymsg.Tpo" -c -o libymsg_la-libymsg.lo `test -f 'libymsg.c' || echo '$(srcdir)/'`libymsg.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-libymsg.Tpo" "$(DEPDIR)/libymsg_la-libymsg.Plo"; else rm -f "$(DEPDIR)/libymsg_la-libymsg.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libymsg.c' object='libymsg_la-libymsg.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-libymsg.lo `test -f 'libymsg.c' || echo '$(srcdir)/'`libymsg.c - -libymsg_la-util.lo: util.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-util.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-util.Tpo" -c -o libymsg_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-util.Tpo" "$(DEPDIR)/libymsg_la-util.Plo"; else rm -f "$(DEPDIR)/libymsg_la-util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util.c' object='libymsg_la-util.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c - -libymsg_la-yahoochat.lo: yahoochat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoochat.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoochat.Tpo" -c -o libymsg_la-yahoochat.lo `test -f 'yahoochat.c' || echo '$(srcdir)/'`yahoochat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoochat.Tpo" "$(DEPDIR)/libymsg_la-yahoochat.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoochat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoochat.c' object='libymsg_la-yahoochat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoochat.lo `test -f 'yahoochat.c' || echo '$(srcdir)/'`yahoochat.c - -libymsg_la-yahoo_aliases.lo: yahoo_aliases.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_aliases.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_aliases.Tpo" -c -o libymsg_la-yahoo_aliases.lo `test -f 'yahoo_aliases.c' || echo '$(srcdir)/'`yahoo_aliases.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_aliases.Tpo" "$(DEPDIR)/libymsg_la-yahoo_aliases.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_aliases.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_aliases.c' object='libymsg_la-yahoo_aliases.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_aliases.lo `test -f 'yahoo_aliases.c' || echo '$(srcdir)/'`yahoo_aliases.c - -libymsg_la-yahoo_doodle.lo: yahoo_doodle.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_doodle.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_doodle.Tpo" -c -o libymsg_la-yahoo_doodle.lo `test -f 'yahoo_doodle.c' || echo '$(srcdir)/'`yahoo_doodle.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_doodle.Tpo" "$(DEPDIR)/libymsg_la-yahoo_doodle.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_doodle.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_doodle.c' object='libymsg_la-yahoo_doodle.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_doodle.lo `test -f 'yahoo_doodle.c' || echo '$(srcdir)/'`yahoo_doodle.c - -libymsg_la-yahoo_filexfer.lo: yahoo_filexfer.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_filexfer.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_filexfer.Tpo" -c -o libymsg_la-yahoo_filexfer.lo `test -f 'yahoo_filexfer.c' || echo '$(srcdir)/'`yahoo_filexfer.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_filexfer.Tpo" "$(DEPDIR)/libymsg_la-yahoo_filexfer.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_filexfer.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_filexfer.c' object='libymsg_la-yahoo_filexfer.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_filexfer.lo `test -f 'yahoo_filexfer.c' || echo '$(srcdir)/'`yahoo_filexfer.c - -libymsg_la-yahoo_friend.lo: yahoo_friend.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_friend.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_friend.Tpo" -c -o libymsg_la-yahoo_friend.lo `test -f 'yahoo_friend.c' || echo '$(srcdir)/'`yahoo_friend.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_friend.Tpo" "$(DEPDIR)/libymsg_la-yahoo_friend.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_friend.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_friend.c' object='libymsg_la-yahoo_friend.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_friend.lo `test -f 'yahoo_friend.c' || echo '$(srcdir)/'`yahoo_friend.c - -libymsg_la-yahoo_packet.lo: yahoo_packet.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_packet.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_packet.Tpo" -c -o libymsg_la-yahoo_packet.lo `test -f 'yahoo_packet.c' || echo '$(srcdir)/'`yahoo_packet.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_packet.Tpo" "$(DEPDIR)/libymsg_la-yahoo_packet.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_packet.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_packet.c' object='libymsg_la-yahoo_packet.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_packet.lo `test -f 'yahoo_packet.c' || echo '$(srcdir)/'`yahoo_packet.c - -libymsg_la-yahoo_picture.lo: yahoo_picture.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_picture.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_picture.Tpo" -c -o libymsg_la-yahoo_picture.lo `test -f 'yahoo_picture.c' || echo '$(srcdir)/'`yahoo_picture.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_picture.Tpo" "$(DEPDIR)/libymsg_la-yahoo_picture.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_picture.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_picture.c' object='libymsg_la-yahoo_picture.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_picture.lo `test -f 'yahoo_picture.c' || echo '$(srcdir)/'`yahoo_picture.c - -libymsg_la-yahoo_profile.lo: yahoo_profile.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-yahoo_profile.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-yahoo_profile.Tpo" -c -o libymsg_la-yahoo_profile.lo `test -f 'yahoo_profile.c' || echo '$(srcdir)/'`yahoo_profile.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-yahoo_profile.Tpo" "$(DEPDIR)/libymsg_la-yahoo_profile.Plo"; else rm -f "$(DEPDIR)/libymsg_la-yahoo_profile.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='yahoo_profile.c' object='libymsg_la-yahoo_profile.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-yahoo_profile.lo `test -f 'yahoo_profile.c' || echo '$(srcdir)/'`yahoo_profile.c - -libymsg_la-ycht.lo: ycht.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-ycht.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-ycht.Tpo" -c -o libymsg_la-ycht.lo `test -f 'ycht.c' || echo '$(srcdir)/'`ycht.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-ycht.Tpo" "$(DEPDIR)/libymsg_la-ycht.Plo"; else rm -f "$(DEPDIR)/libymsg_la-ycht.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ycht.c' object='libymsg_la-ycht.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-ycht.lo `test -f 'ycht.c' || echo '$(srcdir)/'`ycht.c - -libymsg_la-libyahoo.lo: libyahoo.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-libyahoo.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-libyahoo.Tpo" -c -o libymsg_la-libyahoo.lo `test -f 'libyahoo.c' || echo '$(srcdir)/'`libyahoo.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-libyahoo.Tpo" "$(DEPDIR)/libymsg_la-libyahoo.Plo"; else rm -f "$(DEPDIR)/libymsg_la-libyahoo.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libyahoo.c' object='libymsg_la-libyahoo.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-libyahoo.lo `test -f 'libyahoo.c' || echo '$(srcdir)/'`libyahoo.c - -libymsg_la-libyahoojp.lo: libyahoojp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -MT libymsg_la-libyahoojp.lo -MD -MP -MF "$(DEPDIR)/libymsg_la-libyahoojp.Tpo" -c -o libymsg_la-libyahoojp.lo `test -f 'libyahoojp.c' || echo '$(srcdir)/'`libyahoojp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libymsg_la-libyahoojp.Tpo" "$(DEPDIR)/libymsg_la-libyahoojp.Plo"; else rm -f "$(DEPDIR)/libymsg_la-libyahoojp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libyahoojp.c' object='libymsg_la-libyahoojp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libymsg_la_CFLAGS) $(CFLAGS) -c -o libymsg_la-libyahoojp.lo `test -f 'libyahoojp.c' || echo '$(srcdir)/'`libyahoojp.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.mingw qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.mingw --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.mingw 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/Makefile.mingw 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32 (mingw) version of libyahoo -# - -PIDGIN_TREE_TOP := ../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = libymsg -YAHOO_TARGET = libyahoo -YAHOOJP_TARGET = libyahoojp -TYPE = PLUGIN - -# Static or Plugin... -ifeq ($(TYPE),STATIC) - DEFINES += -DSTATIC - DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) -else -ifeq ($(TYPE),PLUGIN) - DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) -endif -endif - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L. \ - -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = util.c \ - libymsg.c \ - yahoochat.c \ - yahoo_aliases.c \ - yahoo_doodle.c \ - yahoo_filexfer.c \ - yahoo_friend.c \ - yahoo_packet.c \ - yahoo_picture.c \ - yahoo_profile.c \ - ycht.c - -OBJECTS = $(C_SRC:%.c=%.o) - -YAHOO_C_SRC = libyahoo.c -YAHOO_OBJECTS = $(YAHOO_C_SRC:%.c=%.o) - -YAHOOJP_C_SRC = libyahoojp.c -YAHOOJP_OBJECTS = $(YAHOOJP_C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = \ - -lglib-2.0 \ - -lws2_32 \ - -lintl \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## - -.PHONY: all install clean - -all: $(TARGET).dll $(YAHOO_TARGET).dll $(YAHOOJP_TARGET).dll - -install: all $(DLL_INSTALL_DIR) - cp $(YAHOO_TARGET).dll $(YAHOOJP_TARGET).dll $(DLL_INSTALL_DIR) - cp $(TARGET).dll $(PURPLE_INSTALL_DIR) - -$(OBJECTS): $(PURPLE_CONFIG_H) - -$(TARGET).dll.a $(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -Wl,--output-def,$(TARGET).def,--out-implib,$(TARGET).dll.a -o $(TARGET).dll - -$(YAHOO_TARGET).dll: $(TARGET).dll.a $(YAHOO_OBJECTS) - $(CC) -shared $(YAHOO_OBJECTS) $(LIB_PATHS) $(LIBS) -lymsg $(DLL_LD_FLAGS) -o $(YAHOO_TARGET).dll - -$(YAHOOJP_TARGET).dll: $(TARGET).dll.a $(YAHOOJP_OBJECTS) - $(CC) -shared $(YAHOOJP_OBJECTS) $(LIB_PATHS) $(LIBS) -lymsg $(DLL_LD_FLAGS) -o $(YAHOOJP_TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -f $(OBJECTS) $(TARGET).dll $(TARGET).dll.a - rm -f $(YAHOO_OBJECTS) $(YAHOO_TARGET).dll - rm -f $(YAHOOJP_OBJECTS) $(YAHOOJP_TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,940 +0,0 @@ -/* - * purple - * - * Some code copyright 2003 Tim Ringenbach - * (marv on irc.freenode.net) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include "debug.h" -#include "internal.h" -#include "prpl.h" - -#include "libymsg.h" - -#include - -gboolean -yahoo_account_use_http_proxy(PurpleConnection *conn) -{ - PurpleProxyInfo *ppi = purple_proxy_get_setup(conn->account); - return (ppi->type == PURPLE_PROXY_HTTP || ppi->type == PURPLE_PROXY_USE_ENVVAR); -} - -/* - * Returns cookies formatted as a null terminated string for the given connection. - * Must g_free return value. - * - * TODO:will work, but must test for strict correctness - */ -gchar* yahoo_get_cookies(PurpleConnection *gc) -{ - gchar *ans = NULL; - gchar *cur; - char firstflag = 1; - gchar *t1,*t2,*t3; - GSList *tmp; - GSList *cookies; - cookies = ((YahooData*)(gc->proto_data))->cookies; - tmp = cookies; - while(tmp) - { - cur = tmp->data; - t1 = ans; - t2 = g_strrstr(cur, ";expires="); - if(t2 == NULL) - t2 = g_strrstr(cur, "; expires="); - if(t2 == NULL) - { - if(firstflag) - ans = g_strdup_printf("%c=%s", cur[0], cur+2); - else - ans = g_strdup_printf("%s; %c=%s", t1, cur[0], cur+2); - } - else - { - t3 = strstr(t2+1, ";"); - if(t3 != NULL) - { - t2[0] = '\0'; - - if(firstflag) - ans = g_strdup_printf("%c=%s%s", cur[0], cur+2, t3); - else - ans = g_strdup_printf("%s; %c=%s%s", t1, cur[0], cur+2, t3); - - t2[0] = ';'; - } - else - { - t2[0] = '\0'; - - if(firstflag) - ans = g_strdup_printf("%c=%s", cur[0], cur+2); - else - ans = g_strdup_printf("%s; %c=%s", t1, cur[0], cur+2); - - t2[0] = ';'; - } - } - if(firstflag) - firstflag = 0; - else - g_free(t1); - tmp = g_slist_next(tmp); - } - return ans; -} - -/** - * Encode some text to send to the yahoo server. - * - * @param gc The connection handle. - * @param str The null terminated utf8 string to encode. - * @param utf8 If not @c NULL, whether utf8 is okay or not. - * Even if it is okay, we may not use it. If we - * used it, we set this to @c TRUE, else to - * @c FALSE. If @c NULL, false is assumed, and - * it is not dereferenced. - * @return The g_malloced string in the appropriate encoding. - */ -char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8) -{ - YahooData *yd = gc->proto_data; - char *ret; - const char *to_codeset; - - if (yd->jp) - return g_strdup(str); - - if (utf8 && *utf8) /* FIXME: maybe don't use utf8 if it'll fit in latin1 */ - return g_strdup(str); - - to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); - ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL); - - if (ret) - return ret; - else - return g_strdup(""); -} - -/** - * Decode some text received from the server. - * - * @param gc The gc handle. - * @param str The null terminated string to decode. - * @param utf8 Did the server tell us it was supposed to be utf8? - * @return The decoded, utf-8 string, which must be g_free()'d. - */ -char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8) -{ - YahooData *yd = gc->proto_data; - char *ret; - const char *from_codeset; - - if (utf8) { - if (g_utf8_validate(str, -1, NULL)) - return g_strdup(str); - } - - if (yd->jp) - from_codeset = "SHIFT_JIS"; - else - from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); - - ret = g_convert_with_fallback(str, -1, "UTF-8", from_codeset, NULL, NULL, NULL, NULL); - - if (ret) - return ret; - else - return g_strdup(""); -} - -char *yahoo_convert_to_numeric(const char *str) -{ - GString *gstr = NULL; - const unsigned char *p; - - gstr = g_string_sized_new(strlen(str) * 6 + 1); - - for (p = (unsigned char *)str; *p; p++) { - g_string_append_printf(gstr, "&#%u;", *p); - } - - return g_string_free(gstr, FALSE); -} - -/* - * The values in this hash table should probably be lowercase, since that's - * what xhtml expects. Also because yahoo_codes_to_html() does - * case-sensitive comparisons. - * - * I found these on some website but i don't know that they actually - * work (or are supposed to work). I didn't implement them yet. - * - * [0;30m ---black - * [1;37m ---white - * [0;37m ---tan - * [0;38m ---light black - * [1;39m ---dark blue - * [0;32m ---green - * [0;33m ---yellow - * [0;35m ---pink - * [1;35m ---purple - * [1;30m ---light blue - * [0;31m ---red - * [0;34m ---blue - * [0;36m ---aqua - * (shift+comma)lyellow(shift+period) ---light yellow - * (shift+comma)lgreen(shift+period) ---light green - * [2;30m <--white out - */ - -static GHashTable *esc_codes_ht = NULL; -static GHashTable *tags_ht = NULL; - -void yahoo_init_colorht() -{ - if (esc_codes_ht != NULL) - /* Hash table has already been initialized */ - return; - - /* Key is the escape code string. Value is the HTML that should be - * inserted in place of the escape code. */ - esc_codes_ht = g_hash_table_new(g_str_hash, g_str_equal); - - /* Key is the name of the HTML tag, for example "font" or "/font" - * value is the HTML that should be inserted in place of the old tag */ - tags_ht = g_hash_table_new(g_str_hash, g_str_equal); - - /* the numbers in comments are what gyach uses, but i think they're incorrect */ -#ifdef USE_CSS_FORMATTING - g_hash_table_insert(esc_codes_ht, "30", ""); /* black */ - g_hash_table_insert(esc_codes_ht, "31", ""); /* blue */ - g_hash_table_insert(esc_codes_ht, "32", ""); /* cyan */ /* 00b2b2 */ - g_hash_table_insert(esc_codes_ht, "33", ""); /* gray */ /* 808080 */ - g_hash_table_insert(esc_codes_ht, "34", ""); /* green */ /* 00c200 */ - g_hash_table_insert(esc_codes_ht, "35", ""); /* pink */ /* ffafaf */ - g_hash_table_insert(esc_codes_ht, "36", ""); /* purple */ /* b200b2 */ - g_hash_table_insert(esc_codes_ht, "37", ""); /* orange */ /* ffff00 */ - g_hash_table_insert(esc_codes_ht, "38", ""); /* red */ - g_hash_table_insert(esc_codes_ht, "39", ""); /* olive */ /* 546b50 */ -#else - g_hash_table_insert(esc_codes_ht, "30", ""); /* black */ - g_hash_table_insert(esc_codes_ht, "31", ""); /* blue */ - g_hash_table_insert(esc_codes_ht, "32", ""); /* cyan */ /* 00b2b2 */ - g_hash_table_insert(esc_codes_ht, "33", ""); /* gray */ /* 808080 */ - g_hash_table_insert(esc_codes_ht, "34", ""); /* green */ /* 00c200 */ - g_hash_table_insert(esc_codes_ht, "35", ""); /* pink */ /* ffafaf */ - g_hash_table_insert(esc_codes_ht, "36", ""); /* purple */ /* b200b2 */ - g_hash_table_insert(esc_codes_ht, "37", ""); /* orange */ /* ffff00 */ - g_hash_table_insert(esc_codes_ht, "38", ""); /* red */ - g_hash_table_insert(esc_codes_ht, "39", ""); /* olive */ /* 546b50 */ -#endif /* !USE_CSS_FORMATTING */ - - g_hash_table_insert(esc_codes_ht, "1", ""); - g_hash_table_insert(esc_codes_ht, "x1", ""); - g_hash_table_insert(esc_codes_ht, "2", ""); - g_hash_table_insert(esc_codes_ht, "x2", ""); - g_hash_table_insert(esc_codes_ht, "4", ""); - g_hash_table_insert(esc_codes_ht, "x4", ""); - - /* these just tell us the text they surround is supposed - * to be a link. purple figures that out on its own so we - * just ignore it. - */ - g_hash_table_insert(esc_codes_ht, "l", ""); /* link start */ - g_hash_table_insert(esc_codes_ht, "xl", ""); /* link end */ - -#ifdef USE_CSS_FORMATTING - g_hash_table_insert(tags_ht, "black", ""); - g_hash_table_insert(tags_ht, "blue", ""); - g_hash_table_insert(tags_ht, "cyan", ""); - g_hash_table_insert(tags_ht, "gray", ""); - g_hash_table_insert(tags_ht, "green", ""); - g_hash_table_insert(tags_ht, "pink", ""); - g_hash_table_insert(tags_ht, "purple", ""); - g_hash_table_insert(tags_ht, "orange", ""); - g_hash_table_insert(tags_ht, "red", ""); - g_hash_table_insert(tags_ht, "yellow", ""); - - g_hash_table_insert(tags_ht, "/black", ""); - g_hash_table_insert(tags_ht, "/blue", ""); - g_hash_table_insert(tags_ht, "/cyan", ""); - g_hash_table_insert(tags_ht, "/gray", ""); - g_hash_table_insert(tags_ht, "/green", ""); - g_hash_table_insert(tags_ht, "/pink", ""); - g_hash_table_insert(tags_ht, "/purple", ""); - g_hash_table_insert(tags_ht, "/orange", ""); - g_hash_table_insert(tags_ht, "/red", ""); - g_hash_table_insert(tags_ht, "/yellow", ""); -#else - g_hash_table_insert(tags_ht, "black", ""); - g_hash_table_insert(tags_ht, "blue", ""); - g_hash_table_insert(tags_ht, "cyan", ""); - g_hash_table_insert(tags_ht, "gray", ""); - g_hash_table_insert(tags_ht, "green", ""); - g_hash_table_insert(tags_ht, "pink", ""); - g_hash_table_insert(tags_ht, "purple", ""); - g_hash_table_insert(tags_ht, "orange", ""); - g_hash_table_insert(tags_ht, "red", ""); - g_hash_table_insert(tags_ht, "yellow", ""); - - g_hash_table_insert(tags_ht, "/black", ""); - g_hash_table_insert(tags_ht, "/blue", ""); - g_hash_table_insert(tags_ht, "/cyan", ""); - g_hash_table_insert(tags_ht, "/gray", ""); - g_hash_table_insert(tags_ht, "/green", ""); - g_hash_table_insert(tags_ht, "/pink", ""); - g_hash_table_insert(tags_ht, "/purple", ""); - g_hash_table_insert(tags_ht, "/orange", ""); - g_hash_table_insert(tags_ht, "/red", ""); - g_hash_table_insert(tags_ht, "/yellow", ""); -#endif /* !USE_CSS_FORMATTING */ - - /* We don't support these tags, so discard them */ - g_hash_table_insert(tags_ht, "alt", ""); - g_hash_table_insert(tags_ht, "fade", ""); - g_hash_table_insert(tags_ht, "snd", ""); - g_hash_table_insert(tags_ht, "/alt", ""); - g_hash_table_insert(tags_ht, "/fade", ""); - - /* Official clients don't seem to send b, i or u tags. They use - * the escape codes listed above. Official clients definitely send - * font tags, though. I wonder if we can remove the opening and - * closing b, i and u tags from here? */ - g_hash_table_insert(tags_ht, "b", ""); - g_hash_table_insert(tags_ht, "i", ""); - g_hash_table_insert(tags_ht, "u", ""); - g_hash_table_insert(tags_ht, "font", ""); - - g_hash_table_insert(tags_ht, "/b", ""); - g_hash_table_insert(tags_ht, "/i", ""); - g_hash_table_insert(tags_ht, "/u", ""); - g_hash_table_insert(tags_ht, "/font", ""); -} - -void yahoo_dest_colorht() -{ - if (esc_codes_ht == NULL) - /* Hash table has already been destroyed */ - return; - - g_hash_table_destroy(esc_codes_ht); - esc_codes_ht = NULL; - g_hash_table_destroy(tags_ht); - tags_ht = NULL; -} - -#ifndef USE_CSS_FORMATTING -static int point_to_html(int x) -{ - if (x < 9) - return 1; - if (x < 11) - return 2; - if (x < 13) - return 3; - if (x < 17) - return 4; - if (x < 25) - return 5; - if (x < 35) - return 6; - return 7; -} -#endif /* !USE_CSS_FORMATTING */ - -static void append_attrs_datalist_foreach_cb(GQuark key_id, gpointer data, gpointer user_data) -{ - const char *key; - const char *value; - xmlnode *cur; - - key = g_quark_to_string(key_id); - value = data; - cur = user_data; - - xmlnode_set_attrib(cur, key, value); -} - -/** - * @param cur A pointer to the position in the XML tree that we're - * currently building. This will be modified when opening a tag - * or closing an existing tag. - */ -static void yahoo_codes_to_html_add_tag(xmlnode **cur, const char *tag, gboolean is_closing_tag, const gchar *tag_name, gboolean is_font_tag) -{ - if (is_closing_tag) { - xmlnode *tmp; - GSList *dangling_tags = NULL; - - /* Move up the DOM until we find the opening tag */ - for (tmp = *cur; tmp != NULL; tmp = xmlnode_get_parent(tmp)) { - /* Add one to tag_name when doing this comparison because it starts with a / */ - if (g_str_equal(tmp->name, tag_name + 1)) - /* Found */ - break; - dangling_tags = g_slist_prepend(dangling_tags, tmp); - } - if (tmp == NULL) { - /* This is a closing tag with no opening tag. Useless. */ - purple_debug_error("yahoo", "Ignoring unmatched tag %s", tag); - g_slist_free(dangling_tags); - return; - } - - /* Move our current position up, now that we've closed a tag */ - *cur = xmlnode_get_parent(tmp); - - /* Re-open any tags that were nested below the tag we just closed */ - while (dangling_tags != NULL) { - tmp = dangling_tags->data; - dangling_tags = g_slist_delete_link(dangling_tags, dangling_tags); - - /* Create a copy of this tag+attributes (but not child tags or - * data) at our new location */ - *cur = xmlnode_new_child(*cur, tmp->name); - for (tmp = tmp->child; tmp != NULL; tmp = tmp->next) - if (tmp->type == XMLNODE_TYPE_ATTRIB) - xmlnode_set_attrib_full(*cur, tmp->name, - tmp->xmlns, tmp->prefix, tmp->data); - } - } else { - const char *start; - const char *end; - GData *attributes; - char *fontsize = NULL; - - purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - *cur = xmlnode_new_child(*cur, tag_name); - - if (is_font_tag) { - /* Special case for the font size attribute */ - fontsize = g_strdup(g_datalist_get_data(&attributes, "size")); - if (fontsize != NULL) - g_datalist_remove_data(&attributes, "size"); - } - - /* Add all font tag attributes */ - g_datalist_foreach(&attributes, append_attrs_datalist_foreach_cb, *cur); - g_datalist_clear(&attributes); - - if (fontsize != NULL) { -#ifdef USE_CSS_FORMATTING - /* - * The Yahoo font size value is given in pt, even though the HTML - * standard for treats the size as a number on a - * scale between 1 and 7. So we insert the font size as a CSS - * style on a span tag. - */ - gchar *tmp = g_strdup_printf("font-size: %spt", fontsize); - *cur = xmlnode_new_child(*cur, "span"); - xmlnode_set_attrib(*cur, "style", tmp); - g_free(tmp); -#else - /* - * The Yahoo font size value is given in pt, even though the HTML - * standard for treats the size as a number on a - * scale between 1 and 7. So we convert it to an appropriate - * value. This loses precision, which is why CSS formatting is - * preferred. The "absz" attribute remains here for backward - * compatibility with UIs that might use it, but it is totally - * not standard at all. - */ - int size, htmlsize; - gchar tmp[11]; - size = strtol(fontsize, NULL, 10); - htmlsize = point_to_html(size); - sprintf(tmp, "%u", htmlsize); - xmlnode_set_attrib(*cur, "size", tmp); - xmlnode_set_attrib(*cur, "absz", fontsize); -#endif /* !USE_CSS_FORMATTING */ - g_free(fontsize); - } - } -} - -/** - * Similar to purple_markup_get_tag_name(), but works with closing tags. - * - * @return The lowercase name of the tag. If this is a closing tag then - * this value starts with a forward slash. The caller must free - * this string with g_free. - */ -static gchar *yahoo_markup_get_tag_name(const char *tag, gboolean *is_closing_tag) -{ - size_t len; - - *is_closing_tag = (tag[1] == '/'); - if (*is_closing_tag) - len = strcspn(tag + 1, "> "); - else - len = strcspn(tag + 1, "> /"); - - return g_utf8_strdown(tag + 1, len); -} - -/* - * Yahoo! messages generally aren't well-formed. Their markup is - * more of a flow from start to finish rather than a hierarchy from - * outer to inner. They tend to open tags and close them only when - * necessary. - * - * Example: size 8 size 16 size 8 again - * - * But we want to send well-formed HTML to the core, so we step through - * the input string and build an xmlnode tree containing sanitized HTML. - */ -char *yahoo_codes_to_html(const char *x) -{ - size_t x_len; - xmlnode *html, *cur; - GString *cdata = g_string_new(NULL); - int i, j; - gboolean no_more_gt_brackets = FALSE; - const char *match; - gchar *xmlstr1, *xmlstr2, *esc; - - x_len = strlen(x); - html = xmlnode_new("html"); - - cur = html; - for (i = 0; i < x_len; i++) { - if ((x[i] == 0x1b) && (x[i+1] == '[')) { - /* This escape sequence signifies the beginning of some - * text formatting code */ - j = i + 1; - - while (j++ < x_len) { - gchar *code; - - if (x[j] != 'm') - /* Keep looking for the end of this sequence */ - continue; - - /* We've reached the end of the formatting sequence, yay */ - - /* Append any character data that belongs in the current node */ - if (cdata->len > 0) { - xmlnode_insert_data(cur, cdata->str, cdata->len); - g_string_truncate(cdata, 0); - } - - code = g_strndup(x + i + 2, j - i - 2); - if (code[0] == '#') { -#ifdef USE_CSS_FORMATTING - gchar *tmp = g_strdup_printf("color: %s", code); - cur = xmlnode_new_child(cur, "span"); - xmlnode_set_attrib(cur, "style", tmp); - g_free(tmp); -#else - cur = xmlnode_new_child(cur, "font"); - xmlnode_set_attrib(cur, "color", code); -#endif /* !USE_CSS_FORMATTING */ - - } else if ((match = g_hash_table_lookup(esc_codes_ht, code))) { - /* Some tags are in the hash table only because we - * want to ignore them */ - if (match[0] != '\0') { - gboolean is_closing_tag; - gchar *tag_name; - tag_name = yahoo_markup_get_tag_name(match, &is_closing_tag); - yahoo_codes_to_html_add_tag(&cur, match, is_closing_tag, tag_name, FALSE); - g_free(tag_name); - } - - } else { - purple_debug_error("yahoo", - "Ignoring unknown ansi code 'ESC[%sm'.\n", code); - } - - g_free(code); - i = j; - break; - } - - } else if (x[i] == '<' && !no_more_gt_brackets) { - /* The start of an HTML tag */ - j = i; - - while (j++ < x_len) { - gchar *tag; - gboolean is_closing_tag; - gchar *tag_name; - - if (x[j] != '>') { - if (x[j] == '"') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != x_len && x[j] != '"') - j++; - } else if (x[j] == '\'') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != x_len && x[j] != '\'') - j++; - } - if (j != x_len) - /* Keep looking for the end of this tag */ - continue; - - /* This < has no corresponding > */ - g_string_append_c(cdata, x[i]); - no_more_gt_brackets = TRUE; - break; - } - - tag = g_strndup(x + i, j - i + 1); - tag_name = yahoo_markup_get_tag_name(tag, &is_closing_tag); - - match = g_hash_table_lookup(tags_ht, tag_name); - if (match == NULL) { - /* Unknown tag. The user probably typed a less-than sign */ - g_string_append_c(cdata, x[i]); - g_free(tag); - g_free(tag_name); - break; - } - - /* Some tags are in the hash table only because we - * want to ignore them */ - if (match[0] != '\0') { - /* Append any character data that belongs in the current node */ - if (cdata->len > 0) { - xmlnode_insert_data(cur, cdata->str, cdata->len); - g_string_truncate(cdata, 0); - } - if (g_str_equal(tag_name, "font")) - /* Font tags are a special case. We don't - * necessarily want to replace the whole thing-- - * we just want to fix the size attribute. */ - yahoo_codes_to_html_add_tag(&cur, tag, is_closing_tag, tag_name, TRUE); - else - yahoo_codes_to_html_add_tag(&cur, match, is_closing_tag, tag_name, FALSE); - } - - i = j; - g_free(tag); - g_free(tag_name); - break; - } - - } else { - g_string_append_c(cdata, x[i]); - } - } - - /* Append any remaining character data */ - if (cdata->len > 0) - xmlnode_insert_data(cur, cdata->str, cdata->len); - g_string_free(cdata, TRUE); - - /* Serialize our HTML */ - xmlstr1 = xmlnode_to_str(html, NULL); - xmlnode_free(html); - - /* Strip off the outter HTML node */ - /* This probably isn't necessary, especially if we made the outter HTML - * node an empty span. But the HTML is simpler this way. */ - if (!purple_strequal(xmlstr1, "")) - xmlstr2 = g_strndup(xmlstr1 + 6, strlen(xmlstr1) - 13); - else - xmlstr2 = g_strdup(""); - g_free(xmlstr1); - - esc = g_strescape(x, NULL); - purple_debug_misc("yahoo", "yahoo_codes_to_html(%s)=%s\n", esc, xmlstr2); - g_free(esc); - - return xmlstr2; -} - -/* borrowed from gtkimhtml */ -#define MAX_FONT_SIZE 7 -#define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) -static const gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; - -typedef struct -{ - gboolean bold; - gboolean italic; - gboolean underline; - gboolean in_link; - int font_size; - char *font_face; - char *font_color; -} CurrentMsgState; - -static void yahoo_htc_list_cleanup(GSList *l) -{ - while (l != NULL) { - g_free(l->data); - l = g_slist_delete_link(l, l); - } -} - -static void parse_font_tag(GString *dest, const char *tag_name, const char *tag, - GSList **colors, GSList **tags) -{ - const char *start; - const char *end; - GData *attributes; - const char *attribute; - gboolean needendtag; - GString *tmp; - - purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - - needendtag = FALSE; - tmp = g_string_new(NULL); - - attribute = g_datalist_get_data(&attributes, "color"); - if (attribute != NULL) { - g_string_append(tmp, *colors ? (*colors)->data : "\033[#000000m"); - g_string_append_printf(dest, "\033[%sm", attribute); - *colors = g_slist_prepend(*colors, - g_strdup_printf("\033[%sm", attribute)); - } else { - /* We need to add a value to the colors stack even if we're not - * setting a color because we ALWAYS pop exactly 1 element from - * this stack for every tag. If we don't add anything - * then we'll pop something that we shouldn't when we hit this - * corresponding . */ - *colors = g_slist_prepend(*colors, - *colors ? g_strdup((*colors)->data) : g_strdup("\033[#000000m")); - } - - attribute = g_datalist_get_data(&attributes, "face"); - if (attribute != NULL) { - needendtag = TRUE; - g_string_append(dest, "str[dest->len-1] = '>'; - *tags = g_slist_prepend(*tags, g_strdup("")); - g_string_free(tmp, TRUE); - } else { - *tags = g_slist_prepend(*tags, tmp->str); - g_string_free(tmp, FALSE); - } - - g_datalist_clear(&attributes); -} - -char *yahoo_html_to_codes(const char *src) -{ - GSList *colors = NULL; - - /** - * A stack of char*s where each char* is the string that should be - * appended to dest in order to close all the tags that were opened - * by a tag. - */ - GSList *tags = NULL; - - size_t src_len; - int i, j; - GString *dest; - char *esc; - gboolean no_more_gt_brackets = FALSE; - gchar *tag, *tag_name; - gboolean is_closing_tag; - CurrentMsgState current_state; - - memset(¤t_state, 0, sizeof(current_state)); - - src_len = strlen(src); - dest = g_string_sized_new(src_len); - - for (i = 0; i < src_len; i++) { - if (src[i] == '<' && !no_more_gt_brackets) { - /* The start of an HTML tag */ - j = i; - - while (j++ < src_len) { - if (src[j] != '>') { - if (src[j] == '"') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != src_len && src[j] != '"') - j++; - } else if (src[j] == '\'') { - /* We're inside a quoted attribute value. Skip to the end */ - j++; - while (j != src_len && src[j] != '\'') - j++; - } - if (j != src_len) - /* Keep looking for the end of this tag */ - continue; - - /* This < has no corresponding > */ - g_string_append_c(dest, src[i]); - no_more_gt_brackets = TRUE; - break; - } - - tag = g_strndup(src + i, j - i + 1); - tag_name = yahoo_markup_get_tag_name(tag, &is_closing_tag); - - if (g_str_equal(tag_name, "a")) { - const char *start; - const char *end; - GData *attributes; - const char *attribute; - - /* - * TODO: Ideally we would replace this: - * Pidgin - * with this: - * Pidgin (http://pidgin.im/) - * - * Currently we drop the text within the tag and - * just show the URL. Doing it the fancy way is - * complicated when dealing with HTML tags within the - * tag. - */ - - /* Append the URL */ - purple_markup_find_tag(tag_name, tag, &start, &end, &attributes); - attribute = g_datalist_get_data(&attributes, "href"); - if (attribute != NULL) { - if (purple_str_has_prefix(attribute, "mailto:")) - attribute += 7; - g_string_append(dest, attribute); - } - g_datalist_clear(&attributes); - - /* Skip past the closing tag */ - end = purple_strcasestr(src + j, ""); - if (end != NULL) - j = end - src + 3; - - } else if (g_str_equal(tag_name, "font")) { - parse_font_tag(dest, tag_name, tag, &colors, &tags); - } else if (g_str_equal(tag_name, "b")) { - g_string_append(dest, "\033[1m"); - current_state.bold = TRUE; - } else if (g_str_equal(tag_name, "/b")) { - if (current_state.bold) { - g_string_append(dest, "\033[x1m"); - current_state.bold = FALSE; - } - } else if (g_str_equal(tag_name, "i")) { - current_state.italic = TRUE; - g_string_append(dest, "\033[2m"); - } else if (g_str_equal(tag_name, "/i")) { - if (current_state.italic) { - g_string_append(dest, "\033[x2m"); - current_state.italic = FALSE; - } - } else if (g_str_equal(tag_name, "u")) { - current_state.underline = TRUE; - g_string_append(dest, "\033[4m"); - } else if (g_str_equal(tag_name, "/u")) { - if (current_state.underline) { - g_string_append(dest, "\033[x4m"); - current_state.underline = FALSE; - } - } else if (g_str_equal(tag_name, "/a")) { - /* Do nothing */ - } else if (g_str_equal(tag_name, "br")) { - g_string_append_c(dest, '\n'); - } else if (g_str_equal(tag_name, "/font")) { - if (tags != NULL) { - char *etag = tags->data; - tags = g_slist_delete_link(tags, tags); - g_string_append(dest, etag); - if (colors != NULL) { - g_free(colors->data); - colors = g_slist_delete_link(colors, colors); - } - g_free(etag); - } - } else if (g_str_equal(tag_name, "span") || g_str_equal(tag_name, "/span")) { - /* Do nothing */ - } else { - /* We don't know what the tag is. Send it unmodified. */ - g_string_append(dest, tag); - } - - i = j; - g_free(tag); - g_free(tag_name); - break; - } - - } else { - const char *entity; - int length; - - entity = purple_markup_unescape_entity(src + i, &length); - if (entity != NULL) { - /* src[i] is the start of an HTML entity */ - g_string_append(dest, entity); - i += length - 1; - } else - /* src[i] is a normal character */ - g_string_append_c(dest, src[i]); - } - } - - esc = g_strescape(dest->str, NULL); - purple_debug_misc("yahoo", "yahoo_html_to_codes(%s)=%s\n", src, esc); - g_free(esc); - - yahoo_htc_list_cleanup(colors); - yahoo_htc_list_cleanup(tags); - - return g_string_free(dest, FALSE); -} - -YahooFederation yahoo_get_federation_from_name(const char *who) -{ - YahooFederation fed = YAHOO_FEDERATION_NONE; - if (who[3] == '/') { - if (!g_ascii_strncasecmp(who, "msn", 3)) - fed = YAHOO_FEDERATION_MSN; - else if (!g_ascii_strncasecmp(who, "ocs", 3)) - fed = YAHOO_FEDERATION_OCS; - else if (!g_ascii_strncasecmp(who, "ibm", 3)) - fed = YAHOO_FEDERATION_IBM; - else if (!g_ascii_strncasecmp(who, "pbx", 3)) - fed = YAHOO_FEDERATION_PBX; - } - return fed; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,718 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "debug.h" -#include "util.h" -#include "request.h" -#include "version.h" -#include "libymsg.h" -#include "yahoo_aliases.h" -#include "yahoo_friend.h" -#include "yahoo_packet.h" - -/* I hate hardcoding this stuff, but Yahoo never sends us anything to use. Someone in the know may be able to tweak this URL */ -#define YAHOO_ALIAS_FETCH_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&diffs=1&t=0&tags=short&rt=0&prog-ver=" YAHOO_CLIENT_VERSION "&useutf8=1&legenc=codepage-1252" -#define YAHOO_ALIAS_UPDATE_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&sync=1&tags=short&noclear=1&useutf8=1&legenc=codepage-1252" -#define YAHOOJP_ALIAS_FETCH_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&diffs=1&t=0&tags=short&rt=0&prog-ver=" YAHOOJP_CLIENT_VERSION -#define YAHOOJP_ALIAS_UPDATE_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&sync=1&tags=short&noclear=1" - -void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias); - -/** - * Stuff we want passed to the callback function - */ -struct callback_data { - PurpleConnection *gc; - gchar *id; - gchar *who; -}; - -void yahoo_personal_details_reset(YahooPersonalDetails *ypd, gboolean all) -{ - if (all) - g_free(ypd->id); - g_free(ypd->names.first); - g_free(ypd->names.last); - g_free(ypd->names.middle); - g_free(ypd->names.nick); - g_free(ypd->phone.work); - g_free(ypd->phone.home); - g_free(ypd->phone.mobile); -} - -/************************************************************************** - * Alias Fetch Functions - **************************************************************************/ - -static void -yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) -{ - PurpleConnection *gc = user_data; - YahooData *yd = gc->proto_data; - - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (len == 0) { - purple_debug_info("yahoo", "No Aliases to process.%s%s\n", - error_message ? " Error:" : "", error_message ? error_message : ""); - } else { - gchar *full_name, *nick_name; - const char *yid, *id, *fn, *ln, *nn, *alias, *mn; - const char *hp, *wp, *mo; - YahooFriend *f; - PurpleBuddy *b; - xmlnode *item, *contacts; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - /* Put our web response into a xmlnode for easy management */ - contacts = xmlnode_from_str(url_text, -1); - - if (contacts == NULL) { - purple_debug_error("yahoo", "Badly formed Alias XML\n"); - return; - } - purple_debug_info("yahoo", "Fetched %" G_GSIZE_FORMAT - " bytes of alias data\n", len); - - /* Loop around and around and around until we have gone through all the received aliases */ - for(item = xmlnode_get_child(contacts, "ct"); item; item = xmlnode_get_next_twin(item)) { - /* Yahoo replies with two types of contact (ct) record, we are only interested in the alias ones */ - if ((yid = xmlnode_get_attrib(item, "yi"))) { - YahooPersonalDetails *ypd = NULL; - /* Grab all the bits of information we can */ - fn = xmlnode_get_attrib(item, "fn"); - ln = xmlnode_get_attrib(item, "ln"); - nn = xmlnode_get_attrib(item, "nn"); - mn = xmlnode_get_attrib(item, "mn"); - id = xmlnode_get_attrib(item, "id"); - - hp = xmlnode_get_attrib(item, "hp"); - wp = xmlnode_get_attrib(item, "wp"); - mo = xmlnode_get_attrib(item, "mo"); - - full_name = nick_name = NULL; - alias = NULL; - - /* Yahoo stores first and last names separately, lets put them together into a full name */ - if (yd->jp) - full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : ""))); - else - full_name = g_strstrip(g_strdup_printf("%s %s", (fn != NULL ? fn : "") , (ln != NULL ? ln : ""))); - nick_name = (nn != NULL ? g_strstrip(g_strdup(nn)) : NULL); - - if (nick_name != NULL) - alias = nick_name; /* If we have a nickname from Yahoo, let's use it */ - else if (strlen(full_name) != 0) - alias = full_name; /* If no Yahoo nickname, we can use the full_name created above */ - - /* Find the local buddy that matches */ - f = yahoo_friend_find(gc, yid); - b = purple_find_buddy(account, yid); - - /* If we don't find a matching buddy, ignore the alias !! */ - if (f != NULL && b != NULL) { - const char *buddy_alias = purple_buddy_get_alias(b); - yahoo_friend_set_alias_id(f, id); - - /* Finally, if we received an alias, we better update the buddy list */ - if (alias != NULL) { - serv_got_alias(gc, yid, alias); - purple_debug_info("yahoo", "Fetched alias '%s' (%s)\n", alias, id); - } else if (buddy_alias != NULL && strcmp(buddy_alias, "") != 0) { - /* Or if we have an alias that Yahoo doesn't, send it up */ - yahoo_update_alias(gc, yid, buddy_alias); - purple_debug_info("yahoo", "Sent updated alias '%s'\n", buddy_alias); - } - } - - if (f != NULL) - ypd = &f->ypd; - else { - /* May be the alias is for the account? */ - const char *yidn = purple_normalize(account, yid); - if (purple_strequal(yidn, purple_connection_get_display_name(gc))) { - ypd = &yd->ypd; - } - } - - if (ypd) { - yahoo_personal_details_reset(ypd, TRUE); - ypd->id = g_strdup(id); - ypd->names.first = g_strdup(fn); - ypd->names.middle = g_strdup(mn); - ypd->names.last = g_strdup(ln); - ypd->names.nick = g_strdup(nn); - - ypd->phone.work = g_strdup(wp); - ypd->phone.home = g_strdup(hp); - ypd->phone.mobile = g_strdup(mo); - } - - g_free(full_name); - g_free(nick_name); - } - } - xmlnode_free(contacts); - } -} - -void -yahoo_fetch_aliases(PurpleConnection *gc) -{ - YahooData *yd = gc->proto_data; - const char *url; - gchar *request, *webpage, *webaddress; - PurpleUtilFetchUrlData *url_data; - - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - /* Build all the info to make the web request */ - url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL; - purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); - request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; Y=%s\r\n" - "Host: %s\r\n" - "Cache-Control: no-cache\r\n\r\n", - use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, - yd->cookie_t, yd->cookie_y, - webaddress); - - /* We have a URL and some header information, let's connect and get some aliases */ - url_data = purple_util_fetch_url_request_len_with_account(purple_connection_get_account(gc), - url, use_whole_url, NULL, TRUE, request, FALSE, -1, - yahoo_fetch_aliases_cb, gc); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - - g_free(webaddress); - g_free(webpage); - g_free(request); -} - -/************************************************************************** - * Alias Update Functions - **************************************************************************/ - -static void -yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) -{ - xmlnode *node, *result; - struct callback_data *cb = user_data; - PurpleConnection *gc = cb->gc; - YahooData *yd; - - yd = gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (len == 0 || error_message != NULL) { - purple_debug_info("yahoo", "Error updating alias for %s: %s\n", - cb->who, - error_message ? error_message : ""); - g_free(cb->who); - g_free(cb->id); - g_free(cb); - return; - } - - result = xmlnode_from_str(url_text, -1); - - if (result == NULL) { - purple_debug_error("yahoo", "Alias update for %s failed: Badly formed response\n", - cb->who); - g_free(cb->who); - g_free(cb->id); - g_free(cb); - return; - } - - if ((node = xmlnode_get_child(result, "ct"))) { - if (cb->id == NULL) { - const char *new_id = xmlnode_get_attrib(node, "id"); - if (new_id != NULL) { - /* We now have an addressbook id for the friend; we should save it */ - YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); - - purple_debug_info("yahoo", "Alias creation for %s succeeded\n", cb->who); - - if (f) - yahoo_friend_set_alias_id(f, new_id); - else - purple_debug_error("yahoo", "Missing YahooFriend. Unable to store new addressbook id.\n"); - } else - purple_debug_error("yahoo", "Missing new addressbook id in add response for %s (weird).\n", - cb->who); - } else { - if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) - purple_debug_info("yahoo", "Alias update for %s succeeded\n", cb->who); - else - purple_debug_error("yahoo", "Alias update for %s failed (Contact record return mismatch)\n", - cb->who); - } - } else - purple_debug_info("yahoo", "Alias update for %s failed (No contact record returned)\n", cb->who); - - g_free(cb->who); - g_free(cb->id); - g_free(cb); - xmlnode_free(result); -} - -void -yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) -{ - YahooData *yd; - const char *url; - gchar *content, *request, *webpage, *webaddress; - struct callback_data *cb; - PurpleUtilFetchUrlData *url_data; - YahooFriend *f; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - g_return_if_fail(who != NULL); - g_return_if_fail(gc != NULL); - - if (alias == NULL) - alias = ""; - - f = yahoo_friend_find(gc, who); - if (f == NULL) { - purple_debug_error("yahoo", "Missing YahooFriend. Unable to set server alias.\n"); - return; - } - - yd = gc->proto_data; - - /* Using callback_data so I have access to gc in the callback function */ - cb = g_new0(struct callback_data, 1); - cb->who = g_strdup(who); - cb->id = g_strdup(yahoo_friend_get_alias_id(f)); - cb->gc = gc; - - /* Build all the info to make the web request */ - url = yd->jp ? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL; - purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); - - if (cb->id == NULL) { - /* No id for this buddy, so create an address book entry */ - purple_debug_info("yahoo", "Creating '%s' as new alias for user '%s'\n", alias, who); - - if (yd->jp) { - gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); - gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, converted_alias_jp); - g_free(converted_alias_jp); - g_free(alias_jp); - } else { - gchar *escaped_alias = g_markup_escape_text(alias, -1); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, escaped_alias); - g_free(escaped_alias); - } - } else { - purple_debug_info("yahoo", "Updating '%s' as new alias for user '%s'\n", alias, who); - - if (yd->jp) { - gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); - gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, cb->id, converted_alias_jp); - g_free(converted_alias_jp); - g_free(alias_jp); - } else { - gchar *escaped_alias = g_markup_escape_text(alias, -1); - content = g_strdup_printf("\n" - "\n\r\n", - purple_account_get_username(gc->account), - who, cb->id, escaped_alias); - g_free(escaped_alias); - } - } - - request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; Y=%s\r\n" - "Host: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "Cache-Control: no-cache\r\n\r\n" - "%s", - use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, - yd->cookie_t, yd->cookie_y, - webaddress, - strlen(content), - content); - - /* We have a URL and some header information, let's connect and update the alias */ - url_data = purple_util_fetch_url_request_len_with_account( - purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, - request, FALSE, -1, yahoo_update_alias_cb, cb); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - - g_free(webpage); - g_free(webaddress); - g_free(content); - g_free(request); -} - - -/************************************************************************** - * User Info Update Functions - **************************************************************************/ - -#if 0 -/* This block of code can be used to send our contact details to - * everyone in the buddylist. But with the official messenger, - * doing this pops a conversation window at the receiver's end, - * which is stupid, and thus not really surprising. */ - -struct yahoo_userinfo { - YahooData *yd; - char *xml; -}; - -static void -yahoo_send_userinfo_to_user(struct yahoo_userinfo *yui, const char *who) -{ - struct yahoo_packet *pkt; - PurpleConnection *gc; - - gc = yui->yd->gc; - pkt = yahoo_packet_new(YAHOO_SERVICE_CONTACT_DETAILS, 0, 0); - yahoo_packet_hash(pkt, "siisis", - 1, purple_connection_get_display_name(gc), - 13, 1, /* This creates a conversation window in the official client */ - 302, 5, - 5, who, - 303, 5, - 280, yui->xml); - yahoo_packet_send_and_free(pkt, yui->yd); -} - -static void -yahoo_send_userinfo_foreach(gpointer key, gpointer value, gpointer data) -{ - const char *who = key; - YahooFriend *f = value; - - if (f->status != YAHOO_STATUS_OFFLINE) { - yahoo_send_userinfo_to_user(data, who); - } -} - -static void -yahoo_sent_userinfo_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) -{ - struct yahoo_userinfo *yui = user_data; - yahoo_fetch_aliases_cb(url_data, yui->yd->gc, url_text, len, error_message); - g_hash_table_foreach(yui->yd->friends, yahoo_send_userinfo_foreach, yui); - g_free(yui->xml); - g_free(yui); -} -#endif - -static void -yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) -{ - xmlnode *node = xmlnode_new("ab"); - xmlnode *ct = xmlnode_new_child(node, "ct"); - YahooData *yd = purple_connection_get_protocol_data(gc); - PurpleAccount *account; - PurpleUtilFetchUrlData *url_data; - char *webaddress, *webpage; - char *request, *content; - int len; - int i; - char * yfields[] = { "fn", "ln", "nn", "mn", "hp", "wp", "mo", NULL }; - - account = purple_connection_get_account(gc); - - xmlnode_set_attrib(node, "k", purple_connection_get_display_name(gc)); - xmlnode_set_attrib(node, "cc", "1"); /* XXX: ? */ - - xmlnode_set_attrib(ct, "e", "1"); - xmlnode_set_attrib(ct, "yi", purple_request_fields_get_string(fields, "yname")); - xmlnode_set_attrib(ct, "id", purple_request_fields_get_string(fields, "yid")); - xmlnode_set_attrib(ct, "pr", "0"); - - for (i = 0; yfields[i]; i++) { - const char *v = purple_request_fields_get_string(fields, yfields[i]); - xmlnode_set_attrib(ct, yfields[i], v ? v : ""); - } - - content = xmlnode_to_formatted_str(node, &len); - xmlnode_free(node); - purple_url_parse(yd->jp ? YAHOOJP_USERINFO_URL : YAHOO_USERINFO_URL, &webaddress, NULL, &webpage, NULL, NULL); - - request = g_strdup_printf("POST %s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" - "Host: %s\r\n" - "Content-Length: %d\r\n" - "Cache-Control: no-cache\r\n\r\n" - "%s\r\n\r\n", - webpage, - yd->cookie_t, yd->cookie_y, - webaddress, - len + 4, - content); - -#if 0 - { - /* This is if we wanted to send our contact details to everyone - * in the buddylist. But this cannot be done now, because in the - * official messenger, doing this pops a conversation window at - * the receiver's end, which is stupid, and thus not really - * surprising. */ - struct yahoo_userinfo *ui = g_new(struct yahoo_userinfo, 1); - node = xmlnode_new("contact"); - - for (i = 0; yfields[i]; i++) { - const char *v = purple_request_fields_get_string(fields, yfields[i]); - if (v) { - xmlnode *nd = xmlnode_new_child(node, yfields[i]); - xmlnode_insert_data(nd, v, -1); - } - } - - ui->yd = yd; - ui->xml = xmlnode_to_str(node, NULL); - xmlnode_free(node); - } -#endif - - url_data = purple_util_fetch_url_request_len_with_account(account, webaddress, FALSE, - YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, - yahoo_fetch_aliases_cb, gc); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - - g_free(webaddress); - g_free(webpage); - g_free(content); - g_free(request); -} - -static PurpleRequestFields * -request_fields_from_personal_details(YahooPersonalDetails *ypd, const char *id) -{ - PurpleRequestFields *fields; - PurpleRequestFieldGroup *group; - PurpleRequestField *field; - int i; - struct { - char *id; - char *text; - char *value; - } yfields[] = { - {"fn", N_("First Name"), ypd->names.first}, - {"ln", N_("Last Name"), ypd->names.last}, - {"nn", N_("Nickname"), ypd->names.nick}, - {"mn", N_("Middle Name"), ypd->names.middle}, - {"hp", N_("Home Phone Number"), ypd->phone.home}, - {"wp", N_("Work Phone Number"), ypd->phone.work}, - {"mo", N_("Mobile Phone Number"), ypd->phone.mobile}, - {NULL, NULL, NULL} - }; - - fields = purple_request_fields_new(); - group = purple_request_field_group_new(NULL); - purple_request_fields_add_group(fields, group); - - field = purple_request_field_string_new("yname", "", id, FALSE); - purple_request_field_set_visible(field, FALSE); - purple_request_field_group_add_field(group, field); - - field = purple_request_field_string_new("yid", "", ypd->id, FALSE); - purple_request_field_set_visible(field, FALSE); - purple_request_field_group_add_field(group, field); - - for (i = 0; yfields[i].id; i++) { - field = purple_request_field_string_new(yfields[i].id, _(yfields[i].text), - yfields[i].value, FALSE); - purple_request_field_group_add_field(group, field); - } - - return fields; -} - -void yahoo_set_userinfo_for_buddy(PurpleConnection *gc, PurpleBuddy *buddy) -{ - PurpleRequestFields *fields; - YahooFriend *f; - const char *name; - - name = purple_buddy_get_name(buddy); - f = yahoo_friend_find(gc, name); - if (!f) - return; - - fields = request_fields_from_personal_details(&f->ypd, name); - purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, - _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, gc); -} - -void yahoo_set_userinfo(PurpleConnection *gc) -{ - YahooData *yd = purple_connection_get_protocol_data(gc); - PurpleRequestFields *fields = request_fields_from_personal_details(&yd->ypd, - purple_connection_get_display_name(gc)); - purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, - _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), - _("Cancel"), NULL, - purple_connection_get_account(gc), NULL, NULL, gc); -} - -static gboolean -parse_contact_details(YahooData *yd, const char *who, const char *xml) -{ - xmlnode *node, *nd; - YahooFriend *f; - char *yid; - - node = xmlnode_from_str(xml, -1); - if (!node) { - purple_debug_info("yahoo", "Received malformed XML for contact details from '%s':\n%s\n", - who, xml); - return FALSE; - } - - nd = xmlnode_get_child(node, "yi"); - if (!nd || !(yid = xmlnode_get_data(nd))) { - xmlnode_free(node); - return FALSE; - } - - if (!purple_strequal(yid, who)) { - /* The user may not want to set the contact details about folks in the buddylist - to what some random dude might have sent. So it would be good if we popped - up a prompt requiring the user to confirm the details before we set them. - However, someone could send details about hundreds of users at the same time, - which would make things really bad. So for now, until we have a better way of - dealing with this, ignore this details. */ - purple_debug_info("yahoo", "Ignoring contact details sent by %s about %s\n", - who, yid); - g_free(yid); - xmlnode_free(node); - return FALSE; - } - - f = yahoo_friend_find(yd->gc, yid); - if (!f) { - g_free(yid); - xmlnode_free(node); - return FALSE; - } else { - int i; - YahooPersonalDetails *ypd = &f->ypd; - char *alias = NULL; - struct { - char *id; - char **field; - } details[] = { - {"fn", &ypd->names.first}, - {"mn", &ypd->names.middle}, - {"ln", &ypd->names.last}, - {"nn", &ypd->names.nick}, - {"wp", &ypd->phone.work}, - {"hp", &ypd->phone.home}, - {"mo", &ypd->phone.mobile}, - {NULL, NULL} - }; - - yahoo_personal_details_reset(ypd, FALSE); - - for (i = 0; details[i].id; i++) { - nd = xmlnode_get_child(node, details[i].id); - *details[i].field = nd ? xmlnode_get_data(nd) : NULL; - } - - if (ypd->names.nick) - alias = ypd->names.nick; - else if (ypd->names.first || ypd->names.last) { - alias = g_strstrip(g_strdup_printf("%s %s", - ypd->names.first ? ypd->names.first : "", - ypd->names.last ? ypd->names.last : "")); - } - - if (alias) { - serv_got_alias(yd->gc, yid, alias); - if (alias != ypd->names.nick) - g_free(alias); - } - } - - xmlnode_free(node); - g_free(yid); - return TRUE; -} - -/* I don't think this happens for MSN buddies. -- sad */ -void yahoo_process_contact_details(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - const char *who = NULL, *xml = NULL; - YahooData *yd = purple_connection_get_protocol_data(gc); - - for (; l; l = l->next) { - struct yahoo_pair *pair = l->data; - switch (pair->key) { - case 4: - who = pair->value; /* This is the person who sent us the details. - But not necessarily about himself. */ - break; - case 5: - break; - case 13: - /* This is '1' if 'who' is sending the contact details about herself, - '0' if 'who' is sending the contact details she has about buddies - in her list. However, in all cases, the xml in key 280 always seems - to contain the yid of the person, so we may as well ignore this field - and look into the xml instead to see who the information is about. */ - break; - case 280: - xml = pair->value; - parse_contact_details(yd, who, xml); - break; - } - } -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_aliases.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "debug.h" -#include "util.h" -#include "version.h" -#include "libymsg.h" -#include "yahoo_packet.h" - -void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias); -void yahoo_fetch_aliases(PurpleConnection *gc); -void yahoo_set_userinfo(PurpleConnection *gc); -void yahoo_set_userinfo_for_buddy(PurpleConnection *gc, PurpleBuddy *buddy); -void yahoo_personal_details_reset(YahooPersonalDetails *ypd, gboolean all); -void yahoo_process_contact_details(PurpleConnection *gc, struct yahoo_packet *pkt); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1639 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * Some code copyright 2003 Tim Ringenbach - * (marv on irc.freenode.net) - * Some code borrowed from libyahoo2, copyright (C) 2002, Philip - * S Tellis - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#include "debug.h" -#include "privacy.h" -#include "prpl.h" - -#include "conversation.h" -#include "notify.h" -#include "util.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoochat.h" -#include "ycht.h" - -#define YAHOO_CHAT_ID (1) - -/* prototype(s) */ -static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout); - -/* special function to log us on to the yahoo chat service */ -static void yahoo_chat_online(PurpleConnection *gc) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - const char *rll; - - if (yd->wm) { - ycht_connection_open(gc); - return; - } - - rll = purple_account_get_string(purple_connection_get_account(gc), - "room_list_locale", YAHOO_ROOMLIST_LOCALE); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATONLINE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sssss", - 109, purple_connection_get_display_name(gc), - 1, purple_connection_get_display_name(gc), - 6, "abcde", - /* I'm not sure this is the correct way to set this. */ - 98, rll, - 135, yd->jp ? YAHOO_CLIENT_VERSION : YAHOOJP_CLIENT_VERSION); - yahoo_packet_send_and_free(pkt, yd); -} - -/* this is slow, and different from the purple_* version in that it (hopefully) won't add a user twice */ -void yahoo_chat_add_users(PurpleConvChat *chat, GList *newusers) -{ - GList *i; - - for (i = newusers; i; i = i->next) { - if (purple_conv_chat_find_user(chat, i->data)) - continue; - purple_conv_chat_add_user(chat, i->data, NULL, PURPLE_CBFLAGS_NONE, TRUE); - } -} - -void yahoo_chat_add_user(PurpleConvChat *chat, const char *user, const char *reason) -{ - if (purple_conv_chat_find_user(chat, user)) - return; - - purple_conv_chat_add_user(chat, user, reason, PURPLE_CBFLAGS_NONE, TRUE); -} - -static PurpleConversation *yahoo_find_conference(PurpleConnection *gc, const char *name) -{ - YahooData *yd; - GSList *l; - - yd = gc->proto_data; - - for (l = yd->confs; l; l = l->next) { - PurpleConversation *c = l->data; - if (!purple_utf8_strcasecmp(purple_conversation_get_name(c), name)) - return c; - } - return NULL; -} - - -void yahoo_process_conference_invite(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - GSList *l; - char *room = NULL; - char *who = NULL; - char *msg = NULL; - GString *members = NULL; - GHashTable *components; - PurpleConversation *c = NULL; - - if ( (pkt->status == 2) || (pkt->status == 11) ) - return; /* Status is 11 when we are being notified about invitation being sent to someone else */ - - account = purple_connection_get_account(gc); - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - if (pair->key == 57) - { - room = yahoo_string_decode(gc, pair->value, FALSE); - if((c = yahoo_find_conference(gc, room))) - { - /* Looks like we got invited to an already open conference. */ - /* Laters: Should we accept this conference rather than ignoring the invitation ? */ - purple_debug_info("yahoo","Ignoring invitation for an already existing chat, room:%s\n",room); - g_free(room); - return; - } - } - } - - members = g_string_sized_new(512); - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 1: /* us, but we already know who we are */ - break; - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 50: /* inviter */ - who = pair->value; - g_string_append_printf(members, "%s\n", who); - break; - case 51: /* This user is being invited to the conference. Comes with status = 11, so we wont reach here */ - break; - case 52: /* Invited users. Assuming us invited, since we got this packet */ - break; /* break needed, or else we add the users to the conference before they accept the invitation */ - case 53: /* members who have already joined the conference */ - g_string_append_printf(members, "%s\n", pair->value); - break; - case 58: - g_free(msg); - msg = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 13: /* ? */ - break; - } - } - - if (!room) { - g_string_free(members, TRUE); - g_free(msg); - return; - } - - if (!purple_privacy_check(account, who) || - (purple_account_get_bool(account, "ignore_invites", FALSE))) - { - purple_debug_info("yahoo", - "Invite to conference %s from %s has been dropped.\n", room, who); - g_free(room); - g_free(msg); - g_string_free(members, TRUE); - return; - } - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(components, g_strdup("room"), room); - if (msg) - g_hash_table_replace(components, g_strdup("topic"), msg); - g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); - g_hash_table_replace(components, g_strdup("members"), g_string_free(members, FALSE)); - serv_got_chat_invite(gc, room, who, msg, components); - -} - -void yahoo_process_conference_decline(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - char *msg = NULL; - PurpleConversation *c = NULL; - int utf8 = 0; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 54: - who = pair->value; - break; - case 14: - g_free(msg); - msg = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 97: - utf8 = strtol(pair->value, NULL, 10); - break; - } - } - if (!purple_privacy_check(purple_connection_get_account(gc), who)) - { - g_free(room); - g_free(msg); - return; - } - - if (who && room) { - /* make sure we're in the room before we process a decline message for it */ - if((c = yahoo_find_conference(gc, room))) { - char *tmp = NULL, *msg_tmp = NULL; - if(msg) - { - msg_tmp = yahoo_string_decode(gc, msg, utf8); - msg = yahoo_codes_to_html(msg_tmp); - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), who, 0, msg, time(NULL)); - g_free(msg_tmp); - g_free(msg); - } - - tmp = g_strdup_printf(_("%s has declined to join."), who); - purple_conversation_write(c, NULL, tmp, PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, time(NULL)); - - g_free(tmp); - } - - g_free(room); - } -} - -void yahoo_process_conference_logon(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - PurpleConversation *c; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 53: - who = pair->value; - break; - } - } - - if (who && room) { - c = yahoo_find_conference(gc, room); - if (c) - { /* Prevent duplicate users in the chat */ - if( !purple_conv_chat_find_user(PURPLE_CONV_CHAT(c), who) ) - yahoo_chat_add_user(PURPLE_CONV_CHAT(c), who, NULL); - } - g_free(room); - } -} - -void yahoo_process_conference_logoff(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - PurpleConversation *c; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 56: - who = pair->value; - break; - } - } - - if (who && room) { - c = yahoo_find_conference(gc, room); - if (c) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); - g_free(room); - } -} - -void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l; - char *room = NULL; - char *who = NULL; - char *msg = NULL; - int utf8 = 0; - PurpleConversation *c; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 57: - g_free(room); - room = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 3: - who = pair->value; - break; - case 14: - msg = pair->value; - break; - case 97: - utf8 = strtol(pair->value, NULL, 10); - break; - } - } - - if (room && who && msg) { - char *msg2; - - c = yahoo_find_conference(gc, room); - if (!c) { - g_free(room); - return; - } - - msg2 = yahoo_string_decode(gc, msg, utf8); - msg = yahoo_codes_to_html(msg2); - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), who, 0, msg, time(NULL)); - g_free(msg); - g_free(msg2); - } - - g_free(room); -} - -static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *room2; - gboolean utf8 = TRUE; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - ycht_chat_join(yd->ycht, room); - return; - } - - /* apparently room names are always utf8, or else always not utf8, - * so we don't have to actually pass the flag in the packet. Or something. */ - room2 = yahoo_string_encode(gc, room, &utf8); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATJOIN, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssss", - 1, purple_connection_get_display_name(gc), - 104, room2, - 62, "2", - 129, id ? id : "0"); - yahoo_packet_send_and_free(pkt, yd); - g_free(room2); -} - -/* this is a confirmation of yahoo_chat_online(); */ -void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - YahooData *yd = (YahooData *) gc->proto_data; - - if (pkt->status == 1) { - yd->chat_online = TRUE; - - /* We need to goto a user in chat */ - if (yd->pending_chat_goto) { - struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", - 109, yd->pending_chat_goto, - 1, purple_connection_get_display_name(gc), - 62, "2"); - yahoo_packet_send_and_free(pkt, yd); - } else if (yd->pending_chat_room) { - yahoo_chat_join(gc, purple_connection_get_display_name(gc), yd->pending_chat_room, - yd->pending_chat_topic, yd->pending_chat_id); - } - - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - } -} - -/* this is basicly the opposite of chat_online */ -void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - YahooData *yd = (YahooData *) gc->proto_data; - GSList *l; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 1) - if (g_ascii_strcasecmp(pair->value, - purple_connection_get_display_name(gc))) - return; - } - - if (pkt->status == 1) { - yd->chat_online = FALSE; - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - if (yd->in_chat) - yahoo_c_leave(gc, YAHOO_CHAT_ID); - } -} - -void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = (YahooData *) gc->proto_data; - PurpleConversation *c = NULL; - GSList *l; - GList *members = NULL; - GList *roomies = NULL; - char *room = NULL; - char *topic = NULL; - char *someid, *someotherid, *somebase64orhashosomething, *somenegativenumber; - - if (pkt->status == -1) { - /* We can't join */ - struct yahoo_pair *pair = pkt->hash->data; - gchar const *failed_to_join = _("Failed to join chat"); - switch (atoi(pair->value)) { - case 0xFFFFFFFA: /* -6 */ - purple_notify_error(gc, NULL, failed_to_join, _("Unknown room")); - break; - case 0xFFFFFFF1: /* -15 */ - purple_notify_error(gc, NULL, failed_to_join, _("Maybe the room is full")); - break; - case 0xFFFFFFDD: /* -35 */ - purple_notify_error(gc, NULL, failed_to_join, _("Not available")); - break; - default: - purple_notify_error(gc, NULL, failed_to_join, - _("Unknown error. You may need to logout and wait five minutes before being able to rejoin a chatroom")); - } - return; - } - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - - case 104: - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 105: - g_free(topic); - topic = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 128: - someid = pair->value; - break; - case 108: /* number of joiners */ - break; - case 129: - someotherid = pair->value; - break; - case 130: - somebase64orhashosomething = pair->value; - break; - case 126: - somenegativenumber = pair->value; - break; - case 13: /* this is 1. maybe its the type of room? (normal, user created, private, etc?) */ - break; - case 61: /*this looks similar to 130 */ - break; - - /* the previous section was just room info. this next section is - info about individual room members, (including us) */ - - case 109: /* the yahoo id */ - members = g_list_append(members, pair->value); - break; - case 110: /* age */ - break; - case 141: /* nickname */ - break; - case 142: /* location */ - break; - case 113: /* bitmask */ - break; - } - } - - if (room && yd->chat_name && purple_utf8_strcasecmp(room, yd->chat_name)) - yahoo_chat_leave(gc, room, - purple_connection_get_display_name(gc), FALSE); - - c = purple_find_chat(gc, YAHOO_CHAT_ID); - - if (room && (!c || purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) && - members && (members->next || - !g_ascii_strcasecmp(members->data, purple_connection_get_display_name(gc)))) { - GList *l; - GList *flags = NULL; - for (l = members; l; l = l->next) - flags = g_list_prepend(flags, GINT_TO_POINTER(PURPLE_CBFLAGS_NONE)); - if (c && purple_conv_chat_has_left(PURPLE_CONV_CHAT(c))) { - /* this might be a hack, but oh well, it should nicely */ - char *tmpmsg; - - purple_conversation_set_name(c, room); - - c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); - if (topic) { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - /* Also print the topic to the backlog so that the captcha link is clickable */ - purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", topic, PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - yd->in_chat = 1; - yd->chat_name = g_strdup(room); - purple_conv_chat_add_users(PURPLE_CONV_CHAT(c), members, NULL, flags, FALSE); - - tmpmsg = g_strdup_printf(_("You are now chatting in %s."), room); - purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", tmpmsg, PURPLE_MESSAGE_SYSTEM, time(NULL)); - g_free(tmpmsg); - } else { - c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); - if (topic) { - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - /* Also print the topic to the backlog so that the captcha link is clickable */ - purple_conv_chat_write(PURPLE_CONV_CHAT(c), "", topic, PURPLE_MESSAGE_SYSTEM, time(NULL)); - } - yd->in_chat = 1; - yd->chat_name = g_strdup(room); - purple_conv_chat_add_users(PURPLE_CONV_CHAT(c), members, NULL, flags, FALSE); - } - g_list_free(flags); - } else if (c) { - if (topic) { - const char *cur_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(c)); - if (cur_topic == NULL || strcmp(cur_topic, topic) != 0) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - } - yahoo_chat_add_users(PURPLE_CONV_CHAT(c), members); - } - - if (account->deny && c) { - PurpleConversationUiOps *ops = purple_conversation_get_ui_ops(c); - for (l = account->deny; l != NULL; l = l->next) { - for (roomies = members; roomies; roomies = roomies->next) { - if (!purple_utf8_strcasecmp((char *)l->data, roomies->data)) { - purple_debug_info("yahoo", "Ignoring room member %s in room %s\n" , (char *)roomies->data, room ? room : ""); - purple_conv_chat_ignore(PURPLE_CONV_CHAT(c),roomies->data); - ops->chat_update_user(c, roomies->data); - } - } - } - } - g_list_free(roomies); - g_list_free(members); - g_free(room); - g_free(topic); -} - -void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *who = NULL; - char *room = NULL; - GSList *l; - YahooData *yd; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - if (pair->key == 104) { - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - } - if (pair->key == 109) - who = pair->value; - } - - if (who && room) { - PurpleConversation *c = purple_find_chat(gc, YAHOO_CHAT_ID); - if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room)) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); - - } - if (room) - g_free(room); -} - -void yahoo_process_chat_message(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *room = NULL, *who = NULL, *msg = NULL, *msg2; - int msgtype = 1, utf8 = 1; /* default to utf8 */ - PurpleConversation *c = NULL; - GSList *l; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - - case 97: - utf8 = strtol(pair->value, NULL, 10); - break; - case 104: - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 109: - who = pair->value; - break; - case 117: - msg = pair->value; - break; - case 124: - msgtype = strtol(pair->value, NULL, 10); - break; - } - } - - c = purple_find_chat(gc, YAHOO_CHAT_ID); - if (!who || !c) { - if (room) - g_free(room); - /* we still get messages after we part, funny that */ - return; - } - - if (!msg) { - purple_debug_misc("yahoo", "Got a message packet with no message.\nThis probably means something important, but we're ignoring it.\n"); - return; - } - msg2 = yahoo_string_decode(gc, msg, utf8); - msg = yahoo_codes_to_html(msg2); - g_free(msg2); - - if (msgtype == 2 || msgtype == 3) { - char *tmp; - tmp = g_strdup_printf("/me %s", msg); - g_free(msg); - msg = tmp; - } - - serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, msg, time(NULL)); - g_free(msg); - g_free(room); -} - -void yahoo_process_chat_addinvite(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account; - GSList *l; - char *room = NULL; - char *msg = NULL; - char *who = NULL; - - account = purple_connection_get_account(gc); - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 104: - g_free(room); - room = yahoo_string_decode(gc, pair->value, TRUE); - break; - case 129: /* room id? */ - break; - case 126: /* ??? */ - break; - case 117: - g_free(msg); - msg = yahoo_string_decode(gc, pair->value, FALSE); - break; - case 119: - who = pair->value; - break; - case 118: /* us */ - break; - } - } - - if (room && who) { - GHashTable *components; - - if (!purple_privacy_check(account, who) || - (purple_account_get_bool(account, "ignore_invites", FALSE))) - { - purple_debug_info("yahoo", "Invite to room %s from %s has been dropped.\n", room, who); - g_free(room); - g_free(msg); - return; - } - - components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - g_hash_table_replace(components, g_strdup("room"), g_strdup(room)); - serv_got_chat_invite(gc, room, who, msg, components); - } - - g_free(room); - g_free(msg); -} - -void yahoo_process_chat_goto(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - if (pkt->status == -1) - purple_notify_error(gc, NULL, _("Failed to join buddy in chat"), - _("Maybe they're not in a chat?")); -} - -/* - * Functions dealing with conferences - * I think conference names are always ascii. - */ - -void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *who) -{ - struct yahoo_packet *pkt; - GList *w; - - purple_debug_misc("yahoo", "leaving conference %s\n", room); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash_str(pkt, 1, dn); - for (w = who; w; w = w->next) { - const char *name = purple_conv_chat_cb_get_name(w->data); - yahoo_packet_hash_str(pkt, 3, name); - } - - yahoo_packet_hash_str(pkt, 57, room); - yahoo_packet_send_and_free(pkt, yd); -} - -static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room, - GList *members, const char *what) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - GList *who; - char *msg, *msg2; - int utf8 = 1; - - msg = yahoo_html_to_codes(what); - msg2 = yahoo_string_encode(gc, msg, &utf8); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash_str(pkt, 1, dn); - for (who = members; who; who = who->next) { - const char *name = purple_conv_chat_cb_get_name(who->data); - yahoo_packet_hash_str(pkt, 53, name); - } - yahoo_packet_hash(pkt, "ss", 57, room, 14, msg2); - if (utf8) - yahoo_packet_hash_str(pkt, 97, "1"); /* utf-8 */ - - yahoo_packet_send_and_free(pkt, yd); - g_free(msg); - g_free(msg2); - - return 0; -} - -static void yahoo_conf_join(YahooData *yd, PurpleConversation *c, const char *dn, const char *room, - const char *topic, const char *members) -{ - struct yahoo_packet *pkt; - char **memarr = NULL; - int i; - - if (members) - memarr = g_strsplit(members, "\n", 0); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGON, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sss", 1, dn, 3, dn, 57, room); - if (memarr) { - for(i = 0 ; memarr[i]; i++) { - if (!strcmp(memarr[i], "") || !strcmp(memarr[i], dn)) - continue; - yahoo_packet_hash_str(pkt, 3, memarr[i]); - purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), memarr[i], NULL, PURPLE_CBFLAGS_NONE, TRUE); - } - } - yahoo_packet_send_and_free(pkt, yd); - - if (memarr) - g_strfreev(memarr); -} - -static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c, - const char *dn, const char *buddy, const char *room, const char *msg) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - GList *members; - char *msg2 = NULL; - - if (msg) - msg2 = yahoo_string_encode(gc, msg, NULL); - - members = purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sssss", 1, dn, 51, buddy, 57, room, 58, msg?msg2:"", 13, "0"); - for(; members; members = members->next) { - const char *name = purple_conv_chat_cb_get_name(members->data); - if (!strcmp(name, dn)) - continue; - yahoo_packet_hash(pkt, "ss", 52, name, 53, name); - } - - yahoo_packet_send_and_free(pkt, yd); - g_free(msg2); -} - -/* - * Functions dealing with chats - */ - -static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - PurpleConversation *c; - - char *eroom; - gboolean utf8 = 1; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - - ycht_chat_leave(yd->ycht, room, logout); - return; - } - - eroom = yahoo_string_encode(gc, room, &utf8); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATEXIT, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", 104, eroom, 109, dn, 108, "1"); - yahoo_packet_hash_str(pkt, 112, "0"); /* what does this one mean? */ - yahoo_packet_send_and_free(pkt, yd); - - yd->in_chat = 0; - if (yd->chat_name) { - g_free(yd->chat_name); - yd->chat_name = NULL; - } - - if ((c = purple_find_chat(gc, YAHOO_CHAT_ID))) - serv_got_chat_left(gc, YAHOO_CHAT_ID); - - if (!logout) - return; - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATLOGOUT, - YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 1, dn); - yahoo_packet_send_and_free(pkt, yd); - - yd->chat_online = FALSE; - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - g_free(eroom); -} - -static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - int me = 0; - char *msg1, *msg2, *room2; - gboolean utf8 = TRUE; - - if (yd->wm) { - g_return_val_if_fail(yd->ycht != NULL, 1); - - return ycht_chat_send(yd->ycht, room, what); - } - - msg1 = g_strdup(what); - - if (purple_message_meify(msg1, -1)) - me = 1; - - msg2 = yahoo_html_to_codes(msg1); - g_free(msg1); - msg1 = yahoo_string_encode(gc, msg2, &utf8); - g_free(msg2); - room2 = yahoo_string_encode(gc, room, NULL); - - pkt = yahoo_packet_new(YAHOO_SERVICE_COMMENT, YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sss", 1, dn, 104, room2, 117, msg1); - if (me) - yahoo_packet_hash_str(pkt, 124, "2"); - else - yahoo_packet_hash_str(pkt, 124, "1"); - /* fixme: what about /think? (124=3) */ - if (utf8) - yahoo_packet_hash_str(pkt, 97, "1"); - - yahoo_packet_send_and_free(pkt, yd); - g_free(msg1); - g_free(room2); - - return 0; -} - - -static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy, - const char *room, const char *msg) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - char *room2, *msg2 = NULL; - gboolean utf8 = TRUE; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - ycht_chat_send_invite(yd->ycht, room, buddy, msg); - return; - } - - room2 = yahoo_string_encode(gc, room, &utf8); - if (msg) - msg2 = yahoo_string_encode(gc, msg, NULL); - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATADDINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sssss", 1, dn, 118, buddy, 104, room2, 117, (msg2?msg2:""), 129, "0"); - yahoo_packet_send_and_free(pkt, yd); - - g_free(room2); - g_free(msg2); -} - -void yahoo_chat_goto(PurpleConnection *gc, const char *name) -{ - YahooData *yd; - struct yahoo_packet *pkt; - - yd = gc->proto_data; - - if (yd->wm) { - g_return_if_fail(yd->ycht != NULL); - ycht_chat_goto_user(yd->ycht, name); - return; - } - - if (!yd->chat_online) { - yahoo_chat_online(gc); - g_free(yd->pending_chat_room); - yd->pending_chat_room = NULL; - g_free(yd->pending_chat_id); - yd->pending_chat_id = NULL; - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = NULL; - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = g_strdup(name); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "sss", 109, name, 1, purple_connection_get_display_name(gc), 62, "2"); - yahoo_packet_send_and_free(pkt, yd); -} -/* - * These are the functions registered with the core - * which get called for both chats and conferences. - */ - -void yahoo_c_leave(PurpleConnection *gc, int id) -{ - YahooData *yd = (YahooData *) gc->proto_data; - PurpleConversation *c; - - if (!yd) - return; - - c = purple_find_chat(gc, id); - if (!c) - return; - - if (id != YAHOO_CHAT_ID) { - yahoo_conf_leave(yd, purple_conversation_get_name(c), - purple_connection_get_display_name(gc), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c))); - yd->confs = g_slist_remove(yd->confs, c); - } else { - yahoo_chat_leave(gc, purple_conversation_get_name(c), purple_connection_get_display_name(gc), TRUE); - } - - serv_got_chat_left(gc, id); -} - -int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags) -{ - PurpleConversation *c; - int ret; - YahooData *yd; - - yd = (YahooData *) gc->proto_data; - if (!yd) - return -1; - - c = purple_find_chat(gc, id); - if (!c) - return -1; - - if (id != YAHOO_CHAT_ID) { - ret = yahoo_conf_send(gc, purple_connection_get_display_name(gc), - purple_conversation_get_name(c), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)), what); - } else { - ret = yahoo_chat_send(gc, purple_connection_get_display_name(gc), - purple_conversation_get_name(c), what, flags); - if (!ret) - serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)), - purple_connection_get_display_name(gc), flags, what, time(NULL)); - } - return ret; -} - -GList *yahoo_c_info(PurpleConnection *gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - pce->label = _("_Room:"); - pce->identifier = "room"; - pce->required = TRUE; - m = g_list_append(m, pce); - - return m; -} - -GHashTable *yahoo_c_info_defaults(PurpleConnection *gc, const char *chat_name) -{ - GHashTable *defaults; - - defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free); - - if (chat_name != NULL) - g_hash_table_insert(defaults, "room", g_strdup(chat_name)); - - return defaults; -} - -char *yahoo_get_chat_name(GHashTable *data) -{ - return g_strdup(g_hash_table_lookup(data, "room")); -} - -void yahoo_c_join(PurpleConnection *gc, GHashTable *data) -{ - YahooData *yd; - char *room, *topic, *type; - PurpleConversation *c; - - yd = (YahooData *) gc->proto_data; - if (!yd) - return; - - room = g_hash_table_lookup(data, "room"); - if (!room) - return; - - topic = g_hash_table_lookup(data, "topic"); - if (!topic) - topic = ""; - - if ((type = g_hash_table_lookup(data, "type")) && !strcmp(type, "Conference")) { - int id; - const char *members = g_hash_table_lookup(data, "members"); - id = yd->conf_id++; - c = serv_got_joined_chat(gc, id, room); - yd->confs = g_slist_prepend(yd->confs, c); - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), purple_connection_get_display_name(gc), topic); - yahoo_conf_join(yd, c, purple_connection_get_display_name(gc), room, topic, members); - return; - } else { - const char *id; - /*if (yd->in_chat) - yahoo_chat_leave(gc, room, - purple_connection_get_display_name(gc), - FALSE);*/ - - id = g_hash_table_lookup(data, "id"); - - if (!yd->chat_online) { - yahoo_chat_online(gc); - g_free(yd->pending_chat_room); - yd->pending_chat_room = g_strdup(room); - g_free(yd->pending_chat_id); - yd->pending_chat_id = g_strdup(id); - g_free(yd->pending_chat_topic); - yd->pending_chat_topic = g_strdup(topic); - g_free(yd->pending_chat_goto); - yd->pending_chat_goto = NULL; - } else { - yahoo_chat_join(gc, purple_connection_get_display_name(gc), room, topic, id); - } - return; - } -} - -void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *name) -{ - PurpleConversation *c; - - c = purple_find_chat(gc, id); - if (!c || !c->name) - return; - - if (id != YAHOO_CHAT_ID) { - yahoo_conf_invite(gc, c, purple_connection_get_display_name(gc), name, - purple_conversation_get_name(c), msg); - } else { - yahoo_chat_invite(gc, purple_connection_get_display_name(gc), name, - purple_conversation_get_name(c), msg); - } -} - -struct yahoo_roomlist { - int fd; - int inpa; - gchar *txbuf; - gsize tx_written; - guchar *rxqueue; - int rxlen; - gboolean started; - char *path; - char *host; - PurpleRoomlist *list; - PurpleRoomlistRoom *cat; - PurpleRoomlistRoom *ucat; - GMarkupParseContext *parse; -}; - -static void yahoo_roomlist_destroy(struct yahoo_roomlist *yrl) -{ - if (yrl->inpa) - purple_input_remove(yrl->inpa); - g_free(yrl->txbuf); - g_free(yrl->rxqueue); - g_free(yrl->path); - g_free(yrl->host); - if (yrl->parse) - g_markup_parse_context_free(yrl->parse); - g_free(yrl); -} - -enum yahoo_room_type { - yrt_yahoo, - yrt_user -}; - -struct yahoo_chatxml_state { - PurpleRoomlist *list; - struct yahoo_roomlist *yrl; - GQueue *q; - struct { - enum yahoo_room_type type; - char *name; - char *topic; - char *id; - int users, voices, webcams; - } room; -}; - -struct yahoo_lobby { - int count, users, voices, webcams; -}; - -static struct yahoo_chatxml_state *yahoo_chatxml_state_new(PurpleRoomlist *list, struct yahoo_roomlist *yrl) -{ - struct yahoo_chatxml_state *s; - - s = g_new0(struct yahoo_chatxml_state, 1); - s->list = list; - s->yrl = yrl; - s->q = g_queue_new(); - - return s; -} - -static void yahoo_chatxml_state_destroy(struct yahoo_chatxml_state *s) -{ - g_queue_free(s->q); - g_free(s->room.name); - g_free(s->room.topic); - g_free(s->room.id); - g_free(s); -} - -static void yahoo_chatlist_start_element(GMarkupParseContext *context, - const gchar *ename, const gchar **anames, - const gchar **avalues, gpointer user_data, - GError **error) -{ - struct yahoo_chatxml_state *s = user_data; - PurpleRoomlist *list = s->list; - PurpleRoomlistRoom *r; - PurpleRoomlistRoom *parent; - int i; - - if (!strcmp(ename, "category")) { - const gchar *name = NULL, *id = NULL; - - for (i = 0; anames[i]; i++) { - if (!strcmp(anames[i], "id")) - id = avalues[i]; - if (!strcmp(anames[i], "name")) - name = avalues[i]; - } - if (!name || !id) - return; - - parent = g_queue_peek_head(s->q); - r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, name, parent); - purple_roomlist_room_add_field(list, r, (gpointer)name); - purple_roomlist_room_add_field(list, r, (gpointer)id); - purple_roomlist_room_add(list, r); - g_queue_push_head(s->q, r); - } else if (!strcmp(ename, "room")) { - s->room.users = s->room.voices = s->room.webcams = 0; - - for (i = 0; anames[i]; i++) { - if (!strcmp(anames[i], "id")) { - g_free(s->room.id); - s->room.id = g_strdup(avalues[i]); - } else if (!strcmp(anames[i], "name")) { - g_free(s->room.name); - s->room.name = g_strdup(avalues[i]); - } else if (!strcmp(anames[i], "topic")) { - g_free(s->room.topic); - s->room.topic = g_strdup(avalues[i]); - } else if (!strcmp(anames[i], "type")) { - if (!strcmp("yahoo", avalues[i])) - s->room.type = yrt_yahoo; - else - s->room.type = yrt_user; - } - } - - } else if (!strcmp(ename, "lobby")) { - struct yahoo_lobby *lob = g_new0(struct yahoo_lobby, 1); - - for (i = 0; anames[i]; i++) { - if (!strcmp(anames[i], "count")) { - lob->count = strtol(avalues[i], NULL, 10); - } else if (!strcmp(anames[i], "users")) { - s->room.users += lob->users = strtol(avalues[i], NULL, 10); - } else if (!strcmp(anames[i], "voices")) { - s->room.voices += lob->voices = strtol(avalues[i], NULL, 10); - } else if (!strcmp(anames[i], "webcams")) { - s->room.webcams += lob->webcams = strtol(avalues[i], NULL, 10); - } - } - g_queue_push_head(s->q, lob); - } -} - -static void yahoo_chatlist_end_element(GMarkupParseContext *context, const gchar *ename, - gpointer user_data, GError **error) -{ - struct yahoo_chatxml_state *s = user_data; - - if (!strcmp(ename, "category")) { - g_queue_pop_head(s->q); - } else if (!strcmp(ename, "room")) { - struct yahoo_lobby *lob; - PurpleRoomlistRoom *r, *l; - - if (s->room.type == yrt_yahoo) - r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY|PURPLE_ROOMLIST_ROOMTYPE_ROOM, - s->room.name, s->yrl->cat); - else - r = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY|PURPLE_ROOMLIST_ROOMTYPE_ROOM, - s->room.name, s->yrl->ucat); - - purple_roomlist_room_add_field(s->list, r, s->room.name); - purple_roomlist_room_add_field(s->list, r, s->room.id); - purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.users)); - purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.voices)); - purple_roomlist_room_add_field(s->list, r, GINT_TO_POINTER(s->room.webcams)); - purple_roomlist_room_add_field(s->list, r, s->room.topic); - purple_roomlist_room_add(s->list, r); - - while ((lob = g_queue_pop_head(s->q))) { - char *name = g_strdup_printf("%s:%d", s->room.name, lob->count); - l = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, name, r); - - purple_roomlist_room_add_field(s->list, l, name); - purple_roomlist_room_add_field(s->list, l, s->room.id); - purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->users)); - purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->voices)); - purple_roomlist_room_add_field(s->list, l, GINT_TO_POINTER(lob->webcams)); - purple_roomlist_room_add_field(s->list, l, s->room.topic); - purple_roomlist_room_add(s->list, l); - - g_free(name); - g_free(lob); - } - } -} - -static GMarkupParser parser = { - yahoo_chatlist_start_element, - yahoo_chatlist_end_element, - NULL, - NULL, - NULL -}; - -static void yahoo_roomlist_cleanup(PurpleRoomlist *list, struct yahoo_roomlist *yrl) -{ - purple_roomlist_set_in_progress(list, FALSE); - - if (yrl) { - list->proto_data = g_list_remove(list->proto_data, yrl); - yahoo_roomlist_destroy(yrl); - } - - purple_roomlist_unref(list); -} - -static void yahoo_roomlist_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - struct yahoo_roomlist *yrl = data; - PurpleRoomlist *list = yrl->list; - char buf[1024]; - int len; - guchar *start; - struct yahoo_chatxml_state *s; - - len = read(yrl->fd, buf, sizeof(buf)); - - if (len < 0 && errno == EAGAIN) - return; - - if (len <= 0) { - if (yrl->parse) - g_markup_parse_context_end_parse(yrl->parse, NULL); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - yrl->rxqueue = g_realloc(yrl->rxqueue, len + yrl->rxlen); - memcpy(yrl->rxqueue + yrl->rxlen, buf, len); - yrl->rxlen += len; - - if (!yrl->started) { - yrl->started = TRUE; - start = (guchar *)g_strstr_len((char *)yrl->rxqueue, yrl->rxlen, "\r\n\r\n"); - if (!start || (start - yrl->rxqueue + 4) >= yrl->rxlen) - return; - start += 4; - } else { - start = yrl->rxqueue; - } - - if (yrl->parse == NULL) { - s = yahoo_chatxml_state_new(list, yrl); - yrl->parse = g_markup_parse_context_new(&parser, 0, s, - (GDestroyNotify)yahoo_chatxml_state_destroy); - } - - if (!g_markup_parse_context_parse(yrl->parse, (char *)start, (yrl->rxlen - (start - yrl->rxqueue)), NULL)) { - - yahoo_roomlist_cleanup(list, yrl); - return; - } - - yrl->rxlen = 0; -} - -static void yahoo_roomlist_send_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - struct yahoo_roomlist *yrl; - PurpleRoomlist *list; - int written, remaining; - - yrl = data; - list = yrl->list; - - remaining = strlen(yrl->txbuf) - yrl->tx_written; - written = write(yrl->fd, yrl->txbuf + yrl->tx_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_input_remove(yrl->inpa); - yrl->inpa = 0; - g_free(yrl->txbuf); - yrl->txbuf = NULL; - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - if (written < remaining) { - yrl->tx_written += written; - return; - } - - g_free(yrl->txbuf); - yrl->txbuf = NULL; - - purple_input_remove(yrl->inpa); - yrl->inpa = purple_input_add(yrl->fd, PURPLE_INPUT_READ, - yahoo_roomlist_pending, yrl); - -} - -static void yahoo_roomlist_got_connected(gpointer data, gint source, const gchar *error_message) -{ - struct yahoo_roomlist *yrl = data; - PurpleRoomlist *list = yrl->list; - YahooData *yd = purple_account_get_connection(list->account)->proto_data; - - if (source < 0) { - purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed.")); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - yrl->fd = source; - - yrl->txbuf = g_strdup_printf( - "GET http://%s/%s HTTP/1.0\r\n" - "Host: %s\r\n" - "Cookie: Y=%s; T=%s\r\n\r\n", - yrl->host, yrl->path, yrl->host, yd->cookie_y, - yd->cookie_t); - - - yrl->inpa = purple_input_add(yrl->fd, PURPLE_INPUT_WRITE, - yahoo_roomlist_send_cb, yrl); - yahoo_roomlist_send_cb(yrl, yrl->fd, PURPLE_INPUT_WRITE); -} - -PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc) -{ - PurpleAccount *account; - PurpleRoomlist *rl; - PurpleRoomlistField *f; - GList *fields = NULL; - struct yahoo_roomlist *yrl; - const char *rll, *rlurl; - char *url; - - account = purple_connection_get_account(gc); - - /* for Yahoo Japan, it appears there is only one valid URL and locale */ - if(purple_account_get_bool(account, "yahoojp", FALSE)) { - rll = YAHOOJP_ROOMLIST_LOCALE; - rlurl = YAHOOJP_ROOMLIST_URL; - } - else { /* but for the rest of the world that isn't the case */ - rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE); - rlurl = purple_account_get_string(account, "room_list", YAHOO_ROOMLIST_URL); - } - - url = g_strdup_printf("%s?chatcat=0&intl=%s", rlurl, rll); - - yrl = g_new0(struct yahoo_roomlist, 1); - rl = purple_roomlist_new(account); - yrl->list = rl; - - purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); - g_free(url); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "id", TRUE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Voices"), "voices", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Webcams"), "webcams", FALSE); - fields = g_list_append(fields, f); - - f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); - fields = g_list_append(fields, f); - - purple_roomlist_set_fields(rl, fields); - - if (purple_proxy_connect(gc, account, yrl->host, 80, - yahoo_roomlist_got_connected, yrl) == NULL) - { - purple_notify_error(gc, NULL, _("Connection problem"), _("Unable to fetch room list.")); - yahoo_roomlist_cleanup(rl, yrl); - return NULL; - } - - rl->proto_data = g_list_append(rl->proto_data, yrl); - - purple_roomlist_set_in_progress(rl, TRUE); - return rl; -} - -void yahoo_roomlist_cancel(PurpleRoomlist *list) -{ - GList *l, *k; - - k = l = list->proto_data; - list->proto_data = NULL; - - purple_roomlist_set_in_progress(list, FALSE); - - for (; l; l = l->next) { - yahoo_roomlist_destroy(l->data); - purple_roomlist_unref(list); - } - g_list_free(k); -} - -void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) -{ - struct yahoo_roomlist *yrl; - char *url; - char *id; - const char *rll; - - if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) - return; - - if (!(id = g_list_nth_data(category->fields, 1))) { - purple_roomlist_set_in_progress(list, FALSE); - return; - } - - rll = purple_account_get_string(list->account, "room_list_locale", - YAHOO_ROOMLIST_LOCALE); - - if (rll != NULL && *rll != '\0') { - url = g_strdup_printf("%s?chatroom_%s=0&intl=%s", - purple_account_get_string(list->account,"room_list", - YAHOO_ROOMLIST_URL), id, rll); - } else { - url = g_strdup_printf("%s?chatroom_%s=0", - purple_account_get_string(list->account,"room_list", - YAHOO_ROOMLIST_URL), id); - } - - yrl = g_new0(struct yahoo_roomlist, 1); - yrl->list = list; - yrl->cat = category; - list->proto_data = g_list_append(list->proto_data, yrl); - - purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL); - g_free(url); - - yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat); - purple_roomlist_room_add(list, yrl->ucat); - - if (purple_proxy_connect(purple_account_get_connection(list->account), - list->account, yrl->host, 80, - yahoo_roomlist_got_connected, yrl) == NULL) - { - purple_notify_error(purple_account_get_connection(list->account), - NULL, _("Connection problem"), _("Unable to fetch room list.")); - purple_roomlist_ref(list); - yahoo_roomlist_cleanup(list, yrl); - return; - } - - purple_roomlist_set_in_progress(list, TRUE); - purple_roomlist_ref(list); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoochat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/** - * @file yahoochat.h The Yahoo! protocol plugin, chat and conference stuff - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOOCHAT_H_ -#define _YAHOOCHAT_H_ - -#include "roomlist.h" -#include "yahoo_packet.h" - -void yahoo_process_conference_invite(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_decline(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_logon(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_logoff(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_conference_message(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_message(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_addinvite(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_chat_goto(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_c_leave(PurpleConnection *gc, int id); -int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags); -GList *yahoo_c_info(PurpleConnection *gc); -GHashTable *yahoo_c_info_defaults(PurpleConnection *gc, const char *chat_name); -void yahoo_c_join(PurpleConnection *gc, GHashTable *data); -char *yahoo_get_chat_name(GHashTable *data); -void yahoo_c_invite(PurpleConnection *gc, int id, const char *msg, const char *name); - -void yahoo_conf_leave(YahooData *yd, const char *room, const char *dn, GList *who); - -void yahoo_chat_goto(PurpleConnection *gc, const char *name); - -/* room listing functions */ -PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc); -void yahoo_roomlist_cancel(PurpleRoomlist *list); -void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); - -/* util */ -void yahoo_chat_add_users(PurpleConvChat *chat, GList *newusers); -void yahoo_chat_add_user(PurpleConvChat *chat, const char *user, const char *reason); - -#endif /* _YAHOO_CHAT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,611 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/****************************************************************************** - * INCLUDES - *****************************************************************************/ -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "cipher.h" -#include "cmds.h" -#include "debug.h" -#include "notify.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "request.h" -#include "server.h" -#include "util.h" -#include "version.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoo_friend.h" -#include "yahoochat.h" -#include "ycht.h" -#include "yahoo_filexfer.h" -#include "yahoo_picture.h" - -#include "whiteboard.h" -#include "yahoo_doodle.h" - -/****************************************************************************** - * Globals - *****************************************************************************/ -#if 0 -const int DefaultColorRGB24[] = -{ - DOODLE_COLOR_RED, - DOODLE_COLOR_ORANGE, - DOODLE_COLOR_YELLOW, - DOODLE_COLOR_GREEN, - DOODLE_COLOR_CYAN, - DOODLE_COLOR_BLUE, - DOODLE_COLOR_VIOLET, - DOODLE_COLOR_PURPLE, - DOODLE_COLOR_TAN, - DOODLE_COLOR_BROWN, - DOODLE_COLOR_BLACK, - DOODLE_COLOR_GREY, - DOODLE_COLOR_WHITE -}; -#endif - -/****************************************************************************** - * Functions - *****************************************************************************/ -PurpleCmdRet yahoo_doodle_purple_cmd_start(PurpleConversation *conv, const char *cmd, char **args, char **error, void *data) -{ - PurpleAccount *account; - PurpleConnection *gc; - const gchar *name; - - if(*args && args[0]) - return PURPLE_CMD_RET_FAILED; - - account = purple_conversation_get_account(conv); - gc = purple_account_get_connection(account); - name = purple_conversation_get_name(conv); - yahoo_doodle_initiate(gc, name); - - /* Write a local message to this conversation showing that a request for a - * Doodle session has been made - */ - purple_conv_im_write(PURPLE_CONV_IM(conv), "", _("Sent Doodle request."), - PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_RECV, time(NULL)); - - return PURPLE_CMD_RET_OK; -} - -void yahoo_doodle_initiate(PurpleConnection *gc, const char *name) -{ - PurpleAccount *account; - char *to = (char*)name; - PurpleWhiteboard *wb; - - g_return_if_fail(gc); - g_return_if_fail(name); - - account = purple_connection_get_account(gc); - wb = purple_whiteboard_get_session(account, to); - - if(wb == NULL) - { - /* Insert this 'session' in the list. At this point, it's only a - * requested session. - */ - wb = purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); - } - - /* NOTE Perhaps some careful handling of remote assumed established - * sessions - */ - - yahoo_doodle_command_send_ready(gc, to, DOODLE_IMV_KEY); - yahoo_doodle_command_send_request(gc, to, DOODLE_IMV_KEY); - -} - -static void yahoo_doodle_command_got_request(PurpleConnection *gc, const char *from, const char *imv_key) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Request (%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - /* If a session with the remote user doesn't exist */ - if(wb == NULL) - { - doodle_session *ds; - /* Ask user if they wish to accept the request for a doodle session */ - /* TODO Ask local user to start Doodle session with remote user */ - /* NOTE This if/else statement won't work right--must use dialog - * results - */ - - /* char dialog_message[64]; - g_sprintf(dialog_message, "%s is requesting to start a Doodle session with you.", from); - - purple_notify_message(NULL, PURPLE_NOTIFY_MSG_INFO, "Doodle", - dialog_message, NULL, NULL, NULL); - */ - - wb = purple_whiteboard_create(account, from, DOODLE_STATE_REQUESTED); - ds = wb->proto_data; - ds->imv_key = g_strdup(imv_key); - - yahoo_doodle_command_send_ready(gc, from, imv_key); - } - - /* TODO Might be required to clear the canvas of an existing doodle - * session at this point - */ -} - -static void yahoo_doodle_command_got_ready(PurpleConnection *gc, const char *from, const char *imv_key) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Ready(%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - if(wb->state == DOODLE_STATE_REQUESTING) - { - doodle_session *ds = wb->proto_data; - purple_whiteboard_start(wb); - - wb->state = DOODLE_STATE_ESTABLISHED; - - yahoo_doodle_command_send_confirm(gc, from, imv_key); - /* Let's steal the imv_key and reuse it */ - g_free(ds->imv_key); - ds->imv_key = g_strdup(imv_key); - } - else if(wb->state == DOODLE_STATE_ESTABLISHED) - { - /* TODO Ask whether to save picture too */ - purple_whiteboard_clear(wb); - } - - /* NOTE Not sure about this... I am trying to handle if the remote user - * already thinks we're in a session with them (when their chat message - * contains the doodle imv key) - */ - else if(wb->state == DOODLE_STATE_REQUESTED) - { - /* purple_whiteboard_start(wb); */ - yahoo_doodle_command_send_ready(gc, from, imv_key); - } -} - -static void yahoo_doodle_command_got_draw(PurpleConnection *gc, const char *from, const char *message) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - char **tokens; - int i; - GList *d_list = NULL; /* a local list of drawing info */ - - g_return_if_fail(message != NULL); - - purple_debug_info("yahoo", "doodle: Got Draw (%s)\n", from); - purple_debug_info("yahoo", "doodle: Draw message: %s\n", message); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - /* TODO Functionalize - * Convert drawing packet message to an integer list - */ - - /* Check to see if the message begans and ends with quotes */ - if((message[0] != '\"') || (message[strlen(message) - 1] != '\"')) - return; - - /* Ignore the inital quotation mark. */ - message += 1; - - tokens = g_strsplit(message, ",", 0); - - /* Traverse and extract all integers divided by commas */ - for (i = 0; tokens[i] != NULL; i++) - { - int last = strlen(tokens[i]) - 1; - if (tokens[i][last] == '"') - tokens[i][last] = '\0'; - - d_list = g_list_prepend(d_list, GINT_TO_POINTER(atoi(tokens[i]))); - } - d_list = g_list_reverse(d_list); - - g_strfreev(tokens); - - yahoo_doodle_draw_stroke(wb, d_list); - - /* goodle_doodle_session_set_canvas_as_icon(ds); */ - - g_list_free(d_list); -} - - -static void yahoo_doodle_command_got_clear(PurpleConnection *gc, const char *from) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Clear (%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - if(wb->state == DOODLE_STATE_ESTABLISHED) - { - /* TODO Ask user whether to save the image before clearing it */ - - purple_whiteboard_clear(wb); - } -} - - -static void -yahoo_doodle_command_got_extra(PurpleConnection *gc, const char *from, const char *message, const char *imv_key) -{ - purple_debug_info("yahoo", "doodle: Got Extra (%s)\n", from); - - /* I do not like these 'extra' features, so I'll only handle them in one - * way, which is returning them with the command/packet to turn them off - */ - yahoo_doodle_command_send_extra(gc, from, DOODLE_EXTRA_NONE, imv_key); -} - -static void yahoo_doodle_command_got_confirm(PurpleConnection *gc, const char *from) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - purple_debug_info("yahoo", "doodle: Got Confirm (%s)\n", from); - - /* Get the doodle session */ - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - /* TODO Combine the following IF's? */ - - /* Check if we requested a doodle session */ - /*if(wb->state == DOODLE_STATE_REQUESTING) - { - wb->state = DOODLE_STATE_ESTABLISHED; - - purple_whiteboard_start(wb); - - yahoo_doodle_command_send_confirm(gc, from); - }*/ - - /* Check if we accepted a request for a doodle session */ - if(wb->state == DOODLE_STATE_REQUESTED) - { - wb->state = DOODLE_STATE_ESTABLISHED; - - purple_whiteboard_start(wb); - } -} - -void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from) -{ - PurpleAccount *account; - PurpleWhiteboard *wb; - - g_return_if_fail(from != NULL); - - purple_debug_info("yahoo", "doodle: Got Shutdown (%s)\n", from); - - account = purple_connection_get_account(gc); - - /* Only handle this if local client requested Doodle session (else local - * client would have sent one) - */ - wb = purple_whiteboard_get_session(account, from); - - if(wb == NULL) - return; - - /* TODO Ask if user wants to save picture before the session is closed */ - - wb->state = DOODLE_STATE_CANCELED; - purple_whiteboard_destroy(wb); -} - -static void yahoo_doodle_command_send_generic(const char *type, - PurpleConnection *gc, - const char *to, - const char *message, - int command, - const char *imv, - const char *sixtyfour) -{ - YahooData *yd; - struct yahoo_packet *pkt; - - purple_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to); - - yd = gc->proto_data; - - /* Make and send an acknowledge (ready) Doodle packet */ - pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 49, "IMVIRONMENT"); - yahoo_packet_hash_str(pkt, 1, purple_account_get_username(gc->account)); - yahoo_packet_hash_str(pkt, 14, message); - yahoo_packet_hash_int(pkt, 13, command); - yahoo_packet_hash_str(pkt, 5, to); - yahoo_packet_hash_str(pkt, 63, imv ? imv : DOODLE_IMV_KEY); - yahoo_packet_hash_str(pkt, 64, sixtyfour); - yahoo_packet_hash_str(pkt, 1002, "1"); - - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_doodle_command_send_ready(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Ready", gc, to, "1", DOODLE_CMD_READY, imv_key, "1"); -} - -void yahoo_doodle_command_send_request(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Request", gc, to, "", DOODLE_CMD_REQUEST, imv_key, "0"); -} - -void yahoo_doodle_command_send_draw(PurpleConnection *gc, const char *to, const char *message, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Draw", gc, to, message, DOODLE_CMD_DRAW, imv_key, "1"); -} - -void yahoo_doodle_command_send_clear(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Clear", gc, to, " ", DOODLE_CMD_CLEAR, imv_key, "1"); -} - -void yahoo_doodle_command_send_extra(PurpleConnection *gc, const char *to, const char *message, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Extra", gc, to, message, DOODLE_CMD_EXTRA, imv_key, "1"); -} - -void yahoo_doodle_command_send_confirm(PurpleConnection *gc, const char *to, const char *imv_key) -{ - yahoo_doodle_command_send_generic("Confirm", gc, to, "1", DOODLE_CMD_CONFIRM, imv_key, "1"); -} - -void yahoo_doodle_command_send_shutdown(PurpleConnection *gc, const char *to) -{ - yahoo_doodle_command_send_generic("Shutdown", gc, to, "", DOODLE_CMD_SHUTDOWN, ";0", "0"); -} - -void yahoo_doodle_start(PurpleWhiteboard *wb) -{ - doodle_session *ds = g_new0(doodle_session, 1); - - /* purple_debug_debug("yahoo", "doodle: yahoo_doodle_start()\n"); */ - - /* Set default brush size and color */ - ds->brush_size = DOODLE_BRUSH_SMALL; - ds->brush_color = DOODLE_COLOR_RED; - - wb->proto_data = ds; -} - -void yahoo_doodle_end(PurpleWhiteboard *wb) -{ - PurpleConnection *gc = purple_account_get_connection(wb->account); - doodle_session *ds = wb->proto_data; - - /* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */ - - if (gc && wb->state != DOODLE_STATE_CANCELED) - yahoo_doodle_command_send_shutdown(gc, wb->who); - - g_free(ds->imv_key); - g_free(wb->proto_data); -} - -void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height) -{ - /* standard Doodle canvases are of one size: 368x256 */ - *width = DOODLE_CANVAS_WIDTH; - *height = DOODLE_CANVAS_HEIGHT; -} - -static char *yahoo_doodle_build_draw_string(doodle_session *ds, GList *draw_list) -{ - GString *message; - - g_return_val_if_fail(draw_list != NULL, NULL); - - message = g_string_new(""); - g_string_printf(message, "\"%d,%d", ds->brush_color, ds->brush_size); - - for(; draw_list != NULL; draw_list = draw_list->next) - { - g_string_append_printf(message, ",%d", GPOINTER_TO_INT(draw_list->data)); - } - g_string_append_c(message, '"'); - - return g_string_free(message, FALSE); -} - -void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list) -{ - doodle_session *ds = wb->proto_data; - char *message; - - g_return_if_fail(draw_list != NULL); - - message = yahoo_doodle_build_draw_string(ds, draw_list); - yahoo_doodle_command_send_draw(wb->account->gc, wb->who, message, ds->imv_key); - g_free(message); -} - -void yahoo_doodle_clear(PurpleWhiteboard *wb) -{ - doodle_session *ds = wb->proto_data; - yahoo_doodle_command_send_clear(wb->account->gc, wb->who, ds->imv_key); -} - - -/* Traverse through the list and draw the points and lines */ -void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list) -{ - int brush_color; - int brush_size; - int x; - int y; - - g_return_if_fail(draw_list != NULL); - - brush_color = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - brush_size = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - x = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - y = GPOINTER_TO_INT(draw_list->data); - draw_list = draw_list->next; - g_return_if_fail(draw_list != NULL); - - /* - purple_debug_debug("yahoo", "doodle: Drawing: color=%d, size=%d, (%d,%d)\n", brush_color, brush_size, x, y); - */ - - while(draw_list != NULL && draw_list->next != NULL) - { - int dx = GPOINTER_TO_INT(draw_list->data); - int dy = GPOINTER_TO_INT(draw_list->next->data); - - purple_whiteboard_draw_line(wb, - x, y, - x + dx, y + dy, - brush_color, brush_size); - - x += dx; - y += dy; - - draw_list = draw_list->next->next; - } -} - -void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color) -{ - doodle_session *ds = wb->proto_data; - *size = ds->brush_size; - *color = ds->brush_color; -} - -void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color) -{ - doodle_session *ds = wb->proto_data; - ds->brush_size = size; - ds->brush_color = color; - - /* Notify the core about the changes */ - purple_whiteboard_set_brush(wb, size, color); -} - -void yahoo_doodle_process(PurpleConnection *gc, const char *me, const char *from, - const char *command, const char *message, const char *imv_key) -{ - if(!command) - return; - - /* Now check to see what sort of Doodle message it is */ - switch(atoi(command)) - { - case DOODLE_CMD_REQUEST: - yahoo_doodle_command_got_request(gc, from, imv_key); - break; - - case DOODLE_CMD_READY: - yahoo_doodle_command_got_ready(gc, from, imv_key); - break; - - case DOODLE_CMD_CLEAR: - yahoo_doodle_command_got_clear(gc, from); - break; - - case DOODLE_CMD_DRAW: - yahoo_doodle_command_got_draw(gc, from, message); - break; - - case DOODLE_CMD_EXTRA: - yahoo_doodle_command_got_extra(gc, from, message, imv_key); - break; - - case DOODLE_CMD_CONFIRM: - yahoo_doodle_command_got_confirm(gc, from); - break; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_doodle.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/** - * @file yahoo_doodle.h The Yahoo! protocol plugin Doodle IMVironment object - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOO_DOODLE_H_ -#define _YAHOO_DOODLE_H_ - -/****************************************************************************** - * Includes - *****************************************************************************/ -#include "whiteboard.h" -#include "cmds.h" - -#define DOODLE_IMV_KEY "doodle;106" - -/****************************************************************************** - * Defines - *****************************************************************************/ -/* Doodle communication commands */ -/* TODO: Should be an enum. */ -#define DOODLE_CMD_REQUEST 0 -#define DOODLE_CMD_CLEAR 1 -#define DOODLE_CMD_DRAW 2 -#define DOODLE_CMD_EXTRA 3 -#define DOODLE_CMD_READY 4 -#define DOODLE_CMD_CONFIRM 5 -/* Doodle communication command for shutting down (also 0) */ -#define DOODLE_CMD_SHUTDOWN 0 - -#define DOODLE_EXTRA_NONE "\"1\"" -#define DOODLE_EXTRA_TICTACTOE "\"3\"" -#define DOODLE_EXTRA_DOTS "\"2\"" - -/* Doodle session states */ -/* TODO: Should be an enum. */ -#define DOODLE_STATE_REQUESTING 0 -#define DOODLE_STATE_REQUESTED 1 -#define DOODLE_STATE_ESTABLISHED 2 -#define DOODLE_STATE_CANCELED 3 - -/* Doodle canvas dimensions */ -#define DOODLE_CANVAS_WIDTH 368 -#define DOODLE_CANVAS_HEIGHT 256 - -/* Doodle color codes (most likely RGB) */ -/* TODO: Should be an enum and sorted by color name. */ -#define DOODLE_COLOR_RED 13369344 -#define DOODLE_COLOR_ORANGE 16737792 -#define DOODLE_COLOR_YELLOW 15658496 -#define DOODLE_COLOR_GREEN 52224 -#define DOODLE_COLOR_CYAN 52428 -#define DOODLE_COLOR_BLUE 204 -#define DOODLE_COLOR_VIOLET 5381277 -#define DOODLE_COLOR_PURPLE 13369548 -#define DOODLE_COLOR_TAN 12093547 -#define DOODLE_COLOR_BROWN 5256485 -#define DOODLE_COLOR_BLACK 0 -#define DOODLE_COLOR_GREY 11184810 -#define DOODLE_COLOR_WHITE 16777215 - -#define PALETTE_NUM_OF_COLORS 12 - -/* Doodle brush sizes (most likely variable) */ -#define DOODLE_BRUSH_SMALL 2 -#define DOODLE_BRUSH_MEDIUM 5 -#define DOODLE_BRUSH_LARGE 10 - -#define DOODLE_MAX_BRUSH_MOTIONS 100 - -/****************************************************************************** - * Datatypes - *****************************************************************************/ -typedef struct _doodle_session -{ - int brush_size; /* Size of drawing brush */ - int brush_color; /* Color of drawing brush */ - gchar *imv_key; -} doodle_session; - -/****************************************************************************** - * API - *****************************************************************************/ - -PurpleCmdRet yahoo_doodle_purple_cmd_start(PurpleConversation *conv, const char *cmd, char **args, - char **error, void *data); - -void yahoo_doodle_process(PurpleConnection *gc, const char *me, const char *from, - const char *command, const char *message, const char *imv_key); -void yahoo_doodle_initiate(PurpleConnection *gc, const char *to); - -void yahoo_doodle_command_got_shutdown(PurpleConnection *gc, const char *from); - -void yahoo_doodle_command_send_request(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_ready(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_draw(PurpleConnection *gc, const char *to, const char *message, const char *imv_key); -void yahoo_doodle_command_send_clear(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_extra(PurpleConnection *gc, const char *to, const char *message, const char *imv_key); -void yahoo_doodle_command_send_confirm(PurpleConnection *gc, const char *to, const char *imv_key); -void yahoo_doodle_command_send_shutdown(PurpleConnection *gc, const char *to); - -void yahoo_doodle_start(PurpleWhiteboard *wb); -void yahoo_doodle_end(PurpleWhiteboard *wb); -void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height); -void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list); -void yahoo_doodle_clear(PurpleWhiteboard *wb); - -void yahoo_doodle_draw_stroke(PurpleWhiteboard *wb, GList *draw_list); -void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color); -void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color); - -#endif /* _YAHOO_DOODLE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1943 +0,0 @@ -/* - * @file yahoo_filexfer.c Yahoo Filetransfer - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "dnsquery.h" - -#include "prpl.h" -#include "util.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "proxy.h" -#include "ft.h" -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoo_filexfer.h" -#include "yahoo_doodle.h" -#include "yahoo_friend.h" - -struct yahoo_xfer_data { - gchar *host; - gchar *path; - int port; - PurpleConnection *gc; - long expires; - gboolean started; - gchar *txbuf; - gsize txbuflen; - gsize txbuf_written; - guint tx_handler; - gchar *rxqueue; - guint rxlen; - gchar *xfer_peer_idstring; - gchar *xfer_idstring_for_relay; - int version; /* 0 for old, 15 for Y7(YMSG 15) */ - int info_val_249; - - enum { - STARTED = 0, - HEAD_REQUESTED, - HEAD_REPLY_RECEIVED, - TRANSFER_PHASE, - ACCEPTED, - P2P_HEAD_REQUESTED, - P2P_HEAD_REPLIED, - P2P_GET_REQUESTED - } status_15; - - /* contains all filenames, in case of multiple transfers, with the first - * one in the list being the current file's name (ymsg15) */ - GSList *filename_list; - GSList *size_list; /* corresponds to filename_list, with size as **STRING** */ - gboolean firstoflist; - gchar *xfer_url; /* url of the file, used when we are p2p server */ - int yahoo_local_p2p_ft_server_fd; - int yahoo_local_p2p_ft_server_port; - int yahoo_p2p_ft_server_watcher; - int input_event; -}; - -static void yahoo_xfer_data_free(struct yahoo_xfer_data *xd) -{ - PurpleConnection *gc; - YahooData *yd; - PurpleXfer *xfer; - GSList *l; - - gc = xd->gc; - yd = gc->proto_data; - - /* remove entry from map */ - if(xd->xfer_peer_idstring) { - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring); - if(xfer) - g_hash_table_remove(yd->xfer_peer_idstring_map, xd->xfer_peer_idstring); - } - - /* empty file & filesize list */ - for (l = xd->filename_list; l; l = l->next) { - g_free(l->data); - l->data=NULL; - } - for (l = xd->size_list; l; l = l->next) { - g_free(l->data); - l->data=NULL; - } - g_slist_free(xd->filename_list); - g_slist_free(xd->size_list); - - g_free(xd->host); - g_free(xd->path); - g_free(xd->txbuf); - g_free(xd->xfer_peer_idstring); - g_free(xd->xfer_idstring_for_relay); - if (xd->tx_handler) - purple_input_remove(xd->tx_handler); - g_free(xd); -} - -static void yahoo_receivefile_send_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int remaining, written; - - xfer = data; - xd = xfer->data; - - remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - if (written < remaining) { - xd->txbuf_written += written; - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - g_free(xd->txbuf); - xd->txbuf = NULL; - xd->txbuflen = 0; - - purple_xfer_start(xfer, source, NULL, 0); - -} - -static void yahoo_receivefile_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - - purple_debug_info("yahoo", "in yahoo_receivefile_connected\n"); - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { - purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); - purple_xfer_cancel_remote(xfer); - return; - } - - xfer->fd = source; - - /* The first time we get here, assemble the tx buffer */ - if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n", - xd->path, xd->host); - xd->txbuflen = strlen(xd->txbuf); - xd->txbuf_written = 0; - } - - if (!xd->tx_handler) - { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_receivefile_send_cb, xfer); - yahoo_receivefile_send_cb(xfer, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_sendfile_send_cb(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int written, remaining; - - xfer = data; - xd = xfer->data; - - remaining = xd->txbuflen - xd->txbuf_written; - written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - if (written < remaining) { - xd->txbuf_written += written; - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - g_free(xd->txbuf); - xd->txbuf = NULL; - xd->txbuflen = 0; - - purple_xfer_start(xfer, source, NULL, 0); -} - -static void yahoo_sendfile_connected(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - struct yahoo_packet *pkt; - gchar *size, *filename, *encoded_filename, *header; - guchar *pkt_buf; - const char *host; - int port; - size_t content_length, header_len, pkt_buf_len; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - - purple_debug_info("yahoo", "in yahoo_sendfile_connected\n"); - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - - if (source < 0) { - purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); - purple_xfer_cancel_remote(xfer); - return; - } - - xfer->fd = source; - - /* Assemble the tx buffer */ - gc = xd->gc; - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - size = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - encoded_filename = yahoo_string_encode(gc, filename, NULL); - - yahoo_packet_hash(pkt, "sssss", 0, purple_connection_get_display_name(gc), - 5, xfer->who, 14, "", 27, encoded_filename, 28, size); - g_free(size); - g_free(encoded_filename); - g_free(filename); - - content_length = YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt); - - pkt_buf_len = yahoo_packet_build(pkt, 4, FALSE, yd->jp, &pkt_buf); - yahoo_packet_free(pkt); - - host = purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST); - port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); - header = g_strdup_printf( - "POST http://%s:%d/notifyft HTTP/1.0\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n" - "Host: %s:%d\r\n" - "Cookie: Y=%s; T=%s\r\n" - "\r\n", - host, port, content_length + 4 + purple_xfer_get_size(xfer), - host, port, yd->cookie_y, yd->cookie_t); - - header_len = strlen(header); - - xd->txbuflen = header_len + pkt_buf_len + 4; - xd->txbuf = g_malloc(xd->txbuflen); - - memcpy(xd->txbuf, header, header_len); - g_free(header); - memcpy(xd->txbuf + header_len, pkt_buf, pkt_buf_len); - g_free(pkt_buf); - memcpy(xd->txbuf + header_len + pkt_buf_len, "29\xc0\x80", 4); - - xd->txbuf_written = 0; - - if (xd->tx_handler == 0) - { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_sendfile_send_cb, xfer); - yahoo_sendfile_send_cb(xfer, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_xfer_init(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - - xfer_data = xfer->data; - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - if (yd->jp) { - if (purple_proxy_connect(gc, account, purple_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), - purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_sendfile_connected, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } else { - if (purple_proxy_connect(gc, account, purple_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), - purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_sendfile_connected, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } - } else { - xfer->fd = -1; - if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, - yahoo_receivefile_connected, xfer) == NULL) { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } -} - -static void yahoo_xfer_init_15(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - struct yahoo_packet *pkt; - - xfer_data = xfer->data; - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - - if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) { - gchar *filename; - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, - yd->session_id); - yahoo_packet_hash(pkt, "sssiiiisiii", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 1, - 266, 1, - 302, 268, - 300, 268, - 27, filename, - 28, xfer->size, - 301, 268, - 303, 268); - g_free(filename); - } else { - if(xfer_data->firstoflist == TRUE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 3); - } else { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 271, 1); - } - } - yahoo_packet_send_and_free(pkt, yd); -} - -static void yahoo_xfer_start(PurpleXfer *xfer) -{ - /* We don't need to do anything here, do we? */ -} - -static guint calculate_length(const gchar *l, size_t len) -{ - int i; - - for (i = 0; i < len; i++) { - if (!g_ascii_isdigit(l[i])) - continue; - return strtol(l + i, NULL, 10); - } - return 0; -} - -static gssize yahoo_xfer_read(guchar **buffer, PurpleXfer *xfer) -{ - gchar buf[4096]; - gssize len; - gchar *start = NULL; - gchar *length; - gchar *end; - int filelen; - struct yahoo_xfer_data *xd = xfer->data; - - if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) { - return 0; - } - - len = read(xfer->fd, buf, sizeof(buf)); - - if (len <= 0) { - if ((purple_xfer_get_size(xfer) > 0) && - (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer))) { - purple_xfer_set_completed(xfer, TRUE); - return 0; - } else - return -1; - } - - if (!xd->started) { - xd->rxqueue = g_realloc(xd->rxqueue, len + xd->rxlen); - memcpy(xd->rxqueue + xd->rxlen, buf, len); - xd->rxlen += len; - - length = g_strstr_len(xd->rxqueue, len, "Content-length:"); - /* some proxies re-write this header, changing the capitalization :( - * technically that's allowed since headers are case-insensitive - * [RFC 2616, section 4.2] */ - if (length == NULL) - length = g_strstr_len(xd->rxqueue, len, "Content-Length:"); - if (length) { - end = g_strstr_len(length, length - xd->rxqueue, "\r\n"); - if (!end) - return 0; - if ((filelen = calculate_length(length, len - (length - xd->rxqueue)))) - purple_xfer_set_size(xfer, filelen); - } - start = g_strstr_len(xd->rxqueue, len, "\r\n\r\n"); - if (start) - start += 4; - if (!start || start > (xd->rxqueue + len)) - return 0; - xd->started = TRUE; - - len -= (start - xd->rxqueue); - - *buffer = g_malloc(len); - memcpy(*buffer, start, len); - g_free(xd->rxqueue); - xd->rxqueue = NULL; - xd->rxlen = 0; - } else { - *buffer = g_malloc(len); - memcpy(*buffer, buf, len); - } - - return len; -} - -static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xfer) -{ - gssize len; - struct yahoo_xfer_data *xd = xfer->data; - - if (!xd) - return -1; - - if (purple_xfer_get_type(xfer) != PURPLE_XFER_SEND) { - return -1; - } - - len = write(xfer->fd, buffer, size); - - if (len == -1) { - if (purple_xfer_get_bytes_sent(xfer) >= purple_xfer_get_size(xfer)) - purple_xfer_set_completed(xfer, TRUE); - if ((errno != EAGAIN) && (errno != EINTR)) - return -1; - return 0; - } - - if ((purple_xfer_get_bytes_sent(xfer) + len) >= purple_xfer_get_size(xfer)) - purple_xfer_set_completed(xfer, TRUE); - - return len; -} - -static void yahoo_xfer_cancel_send(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - - xfer_data = xfer->data; - - if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) - { - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - struct yahoo_packet *pkt; - - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, - YAHOO_STATUS_DISCONNECTED, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 66, -1); - } - else - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 2); - } - yahoo_packet_send_and_free(pkt, yd); - } - - - if (xfer_data) - yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; -} - -static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xfer_data; - - xfer_data = xfer->data; - - if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) - { - - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - struct yahoo_packet *pkt; - - gc = xfer_data->gc; - yd = gc->proto_data; - account = purple_connection_get_account(gc); - if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */ - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_AVAILABLE, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 222, 4); - } - else - { - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_15, - YAHOO_STATUS_DISCONNECTED, - yd->session_id); - yahoo_packet_hash(pkt, "sssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 66, -1); - } - yahoo_packet_send_and_free(pkt, yd); - } - - if (xfer_data) - yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; -} - -/* Send HTTP OK after receiving file */ -static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer) -{ - char *tx = NULL; - int written; - - tx = g_strdup_printf("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n"); - written = write(xfer->fd, tx, strlen(tx)); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) - purple_debug_info("yahoo", "p2p filetransfer: Unable to write HTTP OK"); - - /* close connection */ - close(xfer->fd); - xfer->fd = -1; - g_free(tx); -} - -static void yahoo_xfer_end(PurpleXfer *xfer_old) -{ - struct yahoo_xfer_data *xfer_data; - PurpleXfer *xfer = NULL; - PurpleConnection *gc; - YahooData *yd; - - xfer_data = xfer_old->data; - if(xfer_data && xfer_data->version == 15 - && purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE - && xfer_data->filename_list) { - - /* Send HTTP OK in case of p2p transfer, when we act as server */ - if((xfer_data->xfer_url != NULL) && (xfer_old->fd >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE)) - yahoo_p2p_ft_server_send_OK(xfer_old); - - /* removing top of filename & size list completely */ - g_free( xfer_data->filename_list->data ); - g_free( xfer_data->size_list->data ); - - xfer_data->filename_list->data = NULL; - xfer_data->size_list->data = NULL; - - xfer_data->filename_list = g_slist_delete_link(xfer_data->filename_list, xfer_data->filename_list); - xfer_data->size_list = g_slist_delete_link(xfer_data->size_list, xfer_data->size_list); - - /* if there are still more files */ - if(xfer_data->filename_list) - { - gchar* filename; - long filesize; - - filename = xfer_data->filename_list->data; - filesize = atol( xfer_data->size_list->data ); - - gc = xfer_data->gc; - yd = gc->proto_data; - - /* setting up xfer_data for next file's tranfer */ - g_free(xfer_data->host); - g_free(xfer_data->path); - g_free(xfer_data->txbuf); - g_free(xfer_data->rxqueue); - g_free(xfer_data->xfer_idstring_for_relay); - if (xfer_data->tx_handler) - purple_input_remove(xfer_data->tx_handler); - xfer_data->host = NULL; - xfer_data->host = NULL; - xfer_data->port = 0; - xfer_data->expires = 0; - xfer_data->started = FALSE; - xfer_data->txbuf = NULL; - xfer_data->txbuflen = 0; - xfer_data->txbuf_written = 0; - xfer_data->tx_handler = 0; - xfer_data->rxqueue = NULL; - xfer_data->rxlen = 0; - xfer_data->xfer_idstring_for_relay = NULL; - xfer_data->info_val_249 = 0; - xfer_data->status_15 = STARTED; - xfer_data->firstoflist = FALSE; - - /* Dereference xfer_data from old xfer */ - xfer_old->data = NULL; - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); - - - if (xfer) { - /* Set the info about the incoming file. */ - char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - purple_xfer_set_size(xfer, filesize); - - xfer->data = xfer_data; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); - - /* update map to current xfer */ - g_hash_table_remove(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring); - g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer); - - /* Now perform the request */ - purple_xfer_request(xfer); - } - return; - } - } - if (xfer_data) - yahoo_xfer_data_free(xfer_data); - xfer_old->data = NULL; - -} - -void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - - char *me = NULL; - char *from = NULL; - char *service = NULL; - char *message = NULL; - char *command = NULL; - char *imv = NULL; - char *unknown = NULL; - - /* Get all the necessary values from this new packet */ - while(l != NULL) - { - struct yahoo_pair *pair = l->data; - - switch(pair->key) { - case 5: /* Get who the packet is for */ - me = pair->value; - break; - case 4: /* Get who the packet is from */ - from = pair->value; - break; - case 49: /* Get the type of service */ - service = pair->value; - break; - case 14: /* Get the 'message' of the packet */ - message = pair->value; - break; - case 13: /* Get the command associated with this packet */ - command = pair->value; - break; - case 63: /* IMVironment name and version */ - imv = pair->value; - break; - case 64: /* Not sure, but it does vary with initialization of Doodle */ - unknown = pair->value; /* So, I'll keep it (for a little while atleast) */ - break; - } - - l = l->next; - } - - /* If this packet is an IMVIRONMENT, handle it accordingly */ - if(service != NULL && imv != NULL && !strcmp(service, "IMVIRONMENT")) - { - /* Check for a Doodle packet and handle it accordingly */ - if(strstr(imv, "doodle;") != NULL) - yahoo_doodle_process(gc, me, from, command, message, imv); - - /* If an IMVIRONMENT packet comes without a specific imviroment name */ - if(!strcmp(imv, ";0")) - { - /* It is unfortunately time to close all IMVironments with the remote client */ - yahoo_doodle_command_got_shutdown(gc, from); - } - } -} - -void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *from = NULL; - char *to = NULL; - char *msg = NULL; - char *url = NULL; - char *imv = NULL; - long expires = 0; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - char *service = NULL; - char *filename = NULL; - unsigned long filesize = 0L; - GSList *l; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - from = pair->value; - break; - case 5: - to = pair->value; - break; - case 14: - msg = pair->value; - break; - case 20: - url = pair->value; - break; - case 38: - expires = strtol(pair->value, NULL, 10); - break; - case 27: - filename = pair->value; - break; - case 28: - filesize = atol(pair->value); - break; - case 49: - service = pair->value; - break; - case 63: - imv = pair->value; - break; - } - } - - /* - * The remote user has changed their IMVironment. We - * record it for later use. - */ - if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { - g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); - return; - } - - if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { - if (service && (strcmp("FILEXFER", service) != 0)) { - purple_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); - return; - } - } - - if (msg) { - char *tmp; - tmp = strchr(msg, '\006'); - if (tmp) - *tmp = '\0'; - } - - if (!url || !from) - return; - - /* Setup the Yahoo-specific file transfer data */ - xfer_data = g_new0(struct yahoo_xfer_data, 1); - xfer_data->gc = gc; - if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) { - g_free(xfer_data); - return; - } - - purple_debug_misc("yahoo_filexfer", "Host is %s, port is %d, path is %s, and the full url was %s.\n", - xfer_data->host, xfer_data->port, xfer_data->path, url); - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); - if (xfer == NULL) { - g_free(xfer_data); - g_return_if_reached(); - } - - xfer->data = xfer_data; - - /* Set the info about the incoming file. */ - if (filename) { - char *utf8_filename = yahoo_string_decode(gc, filename, TRUE); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - } else { - gchar *start, *end; - start = g_strrstr(xfer_data->path, "/"); - if (start) - start++; - end = g_strrstr(xfer_data->path, "?"); - if (start && *start && end) { - char *utf8_filename; - filename = g_strndup(start, end - start); - utf8_filename = yahoo_string_decode(gc, filename, TRUE); - g_free(filename); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - filename = NULL; - } - } - - purple_xfer_set_size(xfer, filesize); - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - - /* Now perform the request */ - purple_xfer_request(xfer); -} - -PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xfer_data; - - g_return_val_if_fail(who != NULL, NULL); - - xfer_data = g_new0(struct yahoo_xfer_data, 1); - xfer_data->gc = gc; - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who); - if (xfer == NULL) - { - g_free(xfer_data); - g_return_val_if_reached(NULL); - } - - xfer->data = xfer_data; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - - return xfer; -} - -static gchar* yahoo_xfer_new_xfer_id(void) -{ - gchar *ans; - int i,j; - ans = g_strnfill(24, ' '); - ans[23] = '$'; - ans[22] = '$'; - for(i = 0; i < 22; i++) - { - j = g_random_int_range (0,61); - if(j < 26) - ans[i] = j + 'a'; - else if(j < 52) - ans[i] = j - 26 + 'A'; - else - ans[i] = j - 52 + '0'; - } - return ans; -} - -static void yahoo_xfer_dns_connected_15(GSList *hosts, gpointer data, const char *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - struct sockaddr_in *addr; - struct yahoo_packet *pkt; - long actaddr; - long a,b,c,d; - PurpleConnection *gc; - PurpleAccount *account; - YahooData *yd; - gchar *url; - gchar *filename; - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - gc = xd->gc; - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - if(!hosts) - { - purple_debug_error("yahoo", "Unable to find an IP address for relay.msg.yahoo.com\n"); - purple_xfer_cancel_remote(xfer); - return; - } - - /* Discard the length... */ - hosts = g_slist_remove(hosts, hosts->data); - if(!hosts) - { - purple_debug_error("yahoo", "Unable to find an IP address for relay.msg.yahoo.com\n"); - purple_xfer_cancel_remote(xfer); - return; - } - - /* TODO:actually, u must try with addr no.1 , if its not working addr no.2 ..... */ - addr = hosts->data; - actaddr = addr->sin_addr.s_addr; - d = actaddr % 256; - actaddr = (actaddr - d) / 256; - c = actaddr % 256; - actaddr = (actaddr - c) / 256; - b = actaddr % 256; - actaddr = (actaddr - b) / 256; - a = actaddr; - if(yd->jp) - xd->port = YAHOOJP_XFER_RELAY_PORT; - else - xd->port = YAHOO_XFER_RELAY_PORT; - - url = g_strdup_printf("%ld.%ld.%ld.%ld", d, c, b, a); - - /* Free the address... */ - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - addr = NULL; - while (hosts != NULL) - { - /* Discard the length... */ - hosts = g_slist_remove(hosts, hosts->data); - /* Free the address... */ - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - if (!purple_url_parse(url, &(xd->host), &(xd->port), &(xd->path), NULL, NULL)) { - purple_xfer_cancel_remote(xfer); - g_free(url); - return; - } - g_free(url); - - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - - yahoo_packet_hash(pkt, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, filename, - 249, 3, - 250, xd->host); - - g_free(filename); - yahoo_packet_send_and_free(pkt, yd); -} - -gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who) -{ - if (!who || yahoo_get_federation_from_name(who) != YAHOO_FEDERATION_NONE) - return FALSE; - return TRUE; -} - -void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - struct yahoo_xfer_data *xfer_data; - YahooData *yd = gc->proto_data; - PurpleXfer *xfer = yahoo_new_xfer(gc, who); - - g_return_if_fail(xfer != NULL); - - /* if we don't have a p2p connection, try establishing it now */ - if( !g_hash_table_lookup(yd->peers, who) ) - yahoo_send_p2p_pkt(gc, who, 0); - - xfer_data = xfer->data; - xfer_data->status_15 = STARTED; - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); - xfer_data->version = 15; - xfer_data->xfer_peer_idstring = yahoo_xfer_new_xfer_id(); - g_hash_table_insert(yd->xfer_peer_idstring_map, xfer_data->xfer_peer_idstring, xfer); - - /* Now perform the request */ - if (file) - purple_xfer_request_accepted(xfer, file); - else - purple_xfer_request(xfer); -} - -static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data); /* using this in yahoo_xfer_send_cb_15 */ -static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message);/* using this in recv_cb */ - -static void yahoo_xfer_recv_cb_15(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int did; - gchar* buf; - gchar* t; - PurpleAccount *account; - PurpleConnection *gc; - - xfer = data; - xd = xfer->data; - account = purple_connection_get_account(xd->gc); - gc = xd->gc; - - buf=g_strnfill(1000, 0); - while((did = read(source, buf, 998)) > 0) - { - xd->txbuflen += did; - buf[did] = '\0'; - t = xd->txbuf; - xd->txbuf = g_strconcat(t,buf,NULL); - g_free(t); - } - g_free(buf); - - if (did < 0 && errno == EAGAIN) - return; - else if (did < 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - xd->txbuflen = 0; - - if(xd->status_15 == HEAD_REQUESTED) { - xd->status_15 = HEAD_REPLY_RECEIVED; - close(source);/* Is this required? */ - g_free(xd->txbuf); - xd->txbuf = NULL; - if (purple_proxy_connect(gc, account, xd->host, xd->port, yahoo_xfer_connected_15, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } else { - purple_debug_error("yahoo","Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", - purple_xfer_get_type(xfer), - xd->status_15); - return; - } -} - -static void yahoo_xfer_send_cb_15(gpointer data, gint source, PurpleInputCondition condition) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - int remaining, written; - - xfer = data; - xd = xfer->data; - remaining = xd->txbuflen - xd->txbuf_written; - written = write(source, xd->txbuf + xd->txbuf_written, remaining); - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - purple_debug_error("yahoo", "Unable to write in order to start ft errno = %d\n", errno); - purple_xfer_cancel_remote(xfer); - return; - } - - if (written < remaining) { - xd->txbuf_written += written; - return; - } - - purple_input_remove(xd->tx_handler); - xd->tx_handler = 0; - g_free(xd->txbuf); - xd->txbuf = NULL; - xd->txbuflen = 0; - xd->txbuf_written = 0; - - if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) - { - xd->status_15 = HEAD_REQUESTED; - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_READ, yahoo_xfer_recv_cb_15, xfer); - yahoo_xfer_recv_cb_15(xfer, source, PURPLE_INPUT_READ); - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) - { - xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; - purple_xfer_start(xfer, source, NULL, 0); - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && (xd->status_15 == ACCEPTED || xd->status_15 == P2P_GET_REQUESTED) ) - { - xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; - /* Remove Read event */ - purple_input_remove(xd->input_event); - xd->input_event = 0; - purple_xfer_start(xfer, source, NULL, 0); - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == P2P_HEAD_REQUESTED) - { - xd->status_15 = P2P_HEAD_REPLIED; - /* Remove Read event and close descriptor */ - purple_input_remove(xd->input_event); - xd->input_event = 0; - close(source); - xfer->fd = -1; - /* start local server, listen for connections */ - purple_network_listen(xd->yahoo_local_p2p_ft_server_port, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer); - } - else - { - purple_debug_error("yahoo", "Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", purple_xfer_get_type(xfer), xd->status_15); - return; - } -} - -static void yahoo_xfer_connected_15(gpointer data, gint source, const gchar *error_message) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - PurpleAccount *account; - YahooData* yd; - - if (!(xfer = data)) - return; - if (!(xd = xfer->data)) - return; - yd = xd->gc->proto_data; - account = purple_connection_get_account(xd->gc); - if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { - purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), - xfer->who, _("Unable to connect.")); - purple_xfer_cancel_remote(xfer); - return; - } - /* The first time we get here, assemble the tx buffer */ - if (xd->txbuflen == 0) - { - gchar* cookies; - cookies = yahoo_get_cookies(xd->gc); - if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == ACCEPTED) - { - if(xd->info_val_249 == 2) - { - /* sending file via p2p, we are connected as client */ - xd->txbuf = g_strdup_printf("POST /%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: %ld\r\n" - "Cache-Control: no-cache\r\n\r\n", - xd->path, - xd->host, - (long int)xfer->size); /* to do, add Referer */ - } - else - { - /* sending file via relaying */ - xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" - "Cookie:%s\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: %ld\r\n" - "Cache-Control: no-cache\r\n\r\n", - purple_url_encode(xd->xfer_idstring_for_relay), - purple_normalize(account, purple_account_get_username(account)), - xfer->who, - cookies, - xd->host, - (long int)xfer->size); - } - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == STARTED) - { - if(xd->info_val_249 == 1) - { - /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("HEAD /%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: 0\r\n" - "Cache-Control: no-cache\r\n\r\n", - xd->path,xd->host); - } - else - { - /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("HEAD /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" - "Accept: */*\r\n" - "Cookie: %s\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Content-Length: 0\r\n" - "Cache-Control: no-cache\r\n\r\n", - purple_url_encode(xd->xfer_idstring_for_relay), - purple_normalize(account, purple_account_get_username(account)), - xfer->who, - cookies, - xd->host); - } - } - else if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE && xd->status_15 == HEAD_REPLY_RECEIVED) - { - if(xd->info_val_249 == 1) - { - /* receiving file via p2p, connected as client */ - xd->txbuf = g_strdup_printf("GET /%s HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Connection: Keep-Alive\r\n\r\n", - xd->path, xd->host); - } - else - { - /* receiving file via relaying */ - xd->txbuf = g_strdup_printf("GET /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\n" - "Cookie: %s\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Host: %s\r\n" - "Connection: Keep-Alive\r\n\r\n", - purple_url_encode(xd->xfer_idstring_for_relay), - purple_normalize(account, purple_account_get_username(account)), - xfer->who, - cookies, - xd->host); - } - } - else - { - purple_debug_error("yahoo", "Unrecognized yahoo file transfer mode and stage (ymsg15):%d,%d\n", purple_xfer_get_type(xfer), xd->status_15); - g_free(cookies); - return; - } - xd->txbuflen = strlen(xd->txbuf); - xd->txbuf_written = 0; - g_free(cookies); - } - - if (!xd->tx_handler) - { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, - yahoo_xfer_send_cb_15, xfer); - yahoo_xfer_send_cb_15(xfer, source, PURPLE_INPUT_WRITE); - } -} - -static void yahoo_p2p_ft_POST_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - - xfer = data; - if (!(xd = xfer->data)) { - purple_xfer_cancel_remote(xfer); - return; - } - - purple_input_remove(xd->input_event); - xd->status_15 = TRANSFER_PHASE; - xfer->fd = source; - purple_xfer_start(xfer, source, NULL, 0); -} - -static void yahoo_p2p_ft_HEAD_GET_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - guchar buf[1024]; - int len; - char *url_head; - char *url_get; - time_t unix_time; - char *time_str; - - xfer = data; - if (!(xd = xfer->data)) { - purple_xfer_cancel_remote(xfer); - return; - } - - len = read(source, buf, sizeof(buf)); - if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) - return ; /* No Worries*/ - else if (len <= 0) { - purple_debug_warning("yahoo","p2p-ft: Error in connection, or host disconnected\n"); - purple_input_remove(xd->input_event); - purple_xfer_cancel_remote(xfer); - return; - } - - url_head = g_strdup_printf("HEAD %s", xd->xfer_url); - url_get = g_strdup_printf("GET %s", xd->xfer_url); - - if( strncmp(url_head, (char *)buf, strlen(url_head)) == 0 ) - xd->status_15 = P2P_HEAD_REQUESTED; - else if( strncmp(url_get, (char *)buf, strlen(url_get)) == 0 ) - xd->status_15 = P2P_GET_REQUESTED; - else { - purple_debug_warning("yahoo","p2p-ft: Wrong HEAD/GET request from peer, disconnecting host\n"); - purple_input_remove(xd->input_event); - purple_xfer_cancel_remote(xfer); - g_free(url_head); - return; - } - - unix_time = time(NULL); - time_str = ctime(&unix_time); - strcpy(time_str + strlen(time_str) - 1, "\0"); - - if (xd->txbuflen == 0) { - xd->txbuf = g_strdup_printf("HTTP/1.0 200 OK\r\n" - "Date: %s GMT\r\n" - "Server: Y!/1.0\r\n" - "MIME-version: 1.0\r\n" - "Last-modified: %s GMT\r\n" - "Content-length: %" G_GSIZE_FORMAT "\r\n\r\n", - time_str, time_str, xfer->size); - xd->txbuflen = strlen(xd->txbuf); - xd->txbuf_written = 0; - } - - if (!xd->tx_handler) { - xd->tx_handler = purple_input_add(source, PURPLE_INPUT_WRITE, yahoo_xfer_send_cb_15, xfer); - yahoo_xfer_send_cb_15(xfer, source, PURPLE_INPUT_WRITE); - } - - g_free(url_head); - g_free(url_get); -} - -static void yahoo_p2p_ft_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - int acceptfd; - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - - xfer = data; - if (!(xd = xfer->data)) { - purple_xfer_cancel_remote(xfer); - return; - } - - acceptfd = accept(source, NULL, 0); - if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) - return; - else if(acceptfd == -1) { - purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); - purple_xfer_cancel_remote(xfer); - /* remove watcher and close p2p ft server */ - purple_input_remove(xd->yahoo_p2p_ft_server_watcher); - close(xd->yahoo_local_p2p_ft_server_fd); - return; - } - - /* remove watcher and close p2p ft server */ - purple_input_remove(xd->yahoo_p2p_ft_server_watcher); - close(xd->yahoo_local_p2p_ft_server_fd); - - /* Add an Input Read event to the file descriptor */ - xfer->fd = acceptfd; - if(xfer->type == PURPLE_XFER_RECEIVE) - xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_POST_cb, data); - else - xd->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_ft_HEAD_GET_cb, data); -} - -static void yahoo_p2p_ft_server_listen_cb(int listenfd, gpointer data) -{ - PurpleXfer *xfer; - struct yahoo_xfer_data *xd; - struct yahoo_packet *pkt; - PurpleAccount *account; - YahooData *yd; - gchar *filename; - const char *local_ip; - gchar *url_to_send = NULL; - char *filename_without_spaces = NULL; - - xfer = data; - if (!(xd = xfer->data) || (listenfd == -1)) { - purple_debug_warning("yahoo","p2p: error starting server for p2p file transfer\n"); - purple_xfer_cancel_remote(xfer); - return; - } - - if( (xfer->type == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) { - yd = xd->gc->proto_data; - account = purple_connection_get_account(xd->gc); - local_ip = purple_network_get_my_ip(listenfd); - xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd); - - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - filename_without_spaces = g_strdup(filename); - purple_util_chrreplace(filename_without_spaces, ' ', '+'); - xd->xfer_url = g_strdup_printf("/Messenger.%s.%d000%s?AppID=Messenger&UserID=%s&K=lc9lu2u89gz1llmplwksajkjx", xfer->who, (int)time(NULL), filename_without_spaces, xfer->who); - url_to_send = g_strdup_printf("http://%s:%d%s", local_ip, xd->yahoo_local_p2p_ft_server_port, xd->xfer_url); - - if(xfer->type == PURPLE_XFER_RECEIVE) { - xd->info_val_249 = 2; /* 249=2: we are p2p server, and receiving file */ - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, xfer->filename, - 249, 2, - 250, url_to_send); - } - else { - xd->info_val_249 = 1; /* 249=1: we are p2p server, and sending file */ - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, filename, - 249, 1, - 250, url_to_send); - } - - yahoo_packet_send_and_free(pkt, yd); - - g_free(filename); - g_free(url_to_send); - g_free(filename_without_spaces); - } - - /* Add an Input Read event to the file descriptor */ - xd->yahoo_local_p2p_ft_server_fd = listenfd; - xd->yahoo_p2p_ft_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_ft_server_send_connected_cb, data); -} - -/* send (p2p) file transfer information */ -static void yahoo_p2p_client_send_ft_info(PurpleConnection *gc, PurpleXfer *xfer) -{ - struct yahoo_xfer_data *xd; - struct yahoo_packet *pkt; - PurpleAccount *account; - YahooData *yd; - gchar *filename; - struct yahoo_p2p_data *p2p_data; - - if (!(xd = xfer->data)) - return; - - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); - if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER ) - if(purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) - return; - - pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_INFO_15, YAHOO_STATUS_AVAILABLE, yd->session_id); - filename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); - - yahoo_packet_hash(pkt, "ssssi", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xd->xfer_peer_idstring, - 27, filename, - 249, 2); /* 249=2: we are p2p client */ - xd->info_val_249 = 2; - yahoo_packet_send_and_free(pkt, yd); - - g_free(filename); -} - -void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *from = NULL; - char *to = NULL; - char *imv = NULL; - long val_222 = 0L; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - char *service = NULL; - char *filename = NULL; - char *xfer_peer_idstring = NULL; - char *utf8_filename; - unsigned long filesize = 0L; - GSList *l; - GSList *filename_list = NULL; - GSList *size_list = NULL; - int nooffiles = 0; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - from = pair->value; - break; - case 5: - to = pair->value; - break; - case 265: - xfer_peer_idstring = pair->value; - break; - case 27: - filename_list = g_slist_prepend(filename_list, g_strdup(pair->value)); - nooffiles++; - break; - case 28: - size_list = g_slist_prepend(size_list, g_strdup(pair->value)); - break; - case 222: - val_222 = atol(pair->value); - /* 1=send, 2=cancel, 3=accept, 4=reject */ - break; - - /* check for p2p and imviron .... not sure it comes by this service packet. Since it was bundled with filexfer in old ymsg version, still keeping it. */ - case 49: - service = pair->value; - break; - case 63: - imv = pair->value; - break; - /* end check */ - - } - } - if(!xfer_peer_idstring) - return; - - if(val_222 == 2 || val_222 == 4) - { - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, - xfer_peer_idstring); - if(!xfer) return; - purple_xfer_cancel_remote(xfer); - return; - } - if(val_222 == 3) - { - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, - xfer_peer_idstring); - if(!xfer) - return; - /* - * In the file trans info packet that we must reply with, we are - * supposed to mention the ip address... - * purple connect does not give me a way of finding the ip address... - * so, purple dnsquery is used... but retries, trying with next ip - * address etc. is not implemented..TODO - */ - - /* To send through p2p */ - if( g_hash_table_lookup(yd->peers, from) ) { - /* send p2p file transfer information */ - yahoo_p2p_client_send_ft_info(gc, xfer); - return; - } - - if (yd->jp) - { - purple_dnsquery_a(YAHOOJP_XFER_RELAY_HOST, YAHOOJP_XFER_RELAY_PORT, - yahoo_xfer_dns_connected_15, xfer); - } - else - { - purple_dnsquery_a(YAHOO_XFER_RELAY_HOST, YAHOO_XFER_RELAY_PORT, - yahoo_xfer_dns_connected_15, xfer); - } - return; - } - - /* processing for p2p and imviron .... not sure it comes by this service packet. Since it was bundled with filexfer in old ymsg version, still keeping it. */ - /* - * The remote user has changed their IMVironment. We - * record it for later use. - */ - if (from && imv && service && (strcmp("IMVIRONMENT", service) == 0)) { - g_hash_table_replace(yd->imvironments, g_strdup(from), g_strdup(imv)); - return; - } - - if (pkt->service == YAHOO_SERVICE_P2PFILEXFER) { - if (service && (strcmp("FILEXFER", service) != 0)) { - purple_debug_misc("yahoo", "unhandled service 0x%02x\n", pkt->service); - return; - } - } - /* end processing */ - - if(!filename_list) - return; - /* have to change list into order in which client at other end sends */ - filename_list = g_slist_reverse(filename_list); - size_list = g_slist_reverse(size_list); - filename = filename_list->data; - filesize = atol(size_list->data); - - if(!from) return; - xfer_data = g_new0(struct yahoo_xfer_data, 1); - xfer_data->version = 15; - xfer_data->firstoflist = TRUE; - xfer_data->gc = gc; - xfer_data->xfer_peer_idstring = g_strdup(xfer_peer_idstring); - xfer_data->filename_list = filename_list; - xfer_data->size_list = size_list; - - /* Build the file transfer handle. */ - xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from); - if (xfer == NULL) - { - g_free(xfer_data); - g_return_if_reached(); - } - - xfer->message = NULL; - - /* Set the info about the incoming file. */ - utf8_filename = yahoo_string_decode(gc, filename, TRUE); - purple_xfer_set_filename(xfer, utf8_filename); - g_free(utf8_filename); - purple_xfer_set_size(xfer, filesize); - - xfer->data = xfer_data; - - /* Setup our I/O op functions */ - purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); - purple_xfer_set_start_fnc(xfer, yahoo_xfer_start); - purple_xfer_set_end_fnc(xfer, yahoo_xfer_end); - purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send); - purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv); - purple_xfer_set_read_fnc(xfer, yahoo_xfer_read); - purple_xfer_set_write_fnc(xfer, yahoo_xfer_write); - purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv); - - g_hash_table_insert(yd->xfer_peer_idstring_map, - xfer_data->xfer_peer_idstring, - xfer); - - if(nooffiles > 1) { - gchar* message; - message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles); - purple_xfer_conversation_write(xfer, message, FALSE); - g_free(message); - } - /* Now perform the request */ - purple_xfer_request(xfer); -} - -void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - char *from = NULL; - char *to = NULL; - char *url = NULL; - long val_249 = 0; - long val_66 = 0; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - char *filename = NULL; - char *xfer_peer_idstring = NULL; - char *xfer_idstring_for_relay = NULL; - GSList *l; - struct yahoo_packet *pkt_to_send; - PurpleAccount *account; - struct yahoo_p2p_data *p2p_data; - - yd = gc->proto_data; - - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - from = pair->value; - break; - case 5: - to = pair->value; - break; - case 265: - xfer_peer_idstring = pair->value; - break; - case 27: - filename = pair->value; - break; - case 66: - val_66 = strtol(pair->value, NULL, 10); - break; - case 249: - val_249 = strtol(pair->value, NULL, 10); - /* 249 has value 1 or 2 when doing p2p transfer and value 3 when relaying through yahoo server */ - break; - case 250: - url = pair->value; - break; - case 251: - xfer_idstring_for_relay = pair->value; - break; - } - } - - if(!xfer_peer_idstring) - return; - - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring); - - if(!xfer) return; - - if(val_66==-1) - { - purple_xfer_cancel_remote(xfer); - return; - } - - xfer_data = xfer->data; - - xfer_data->info_val_249 = val_249; - xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); - if(val_249 == 1 || val_249 == 3) { - if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) { - purple_xfer_cancel_remote(xfer); - return; - } - - account = purple_connection_get_account(xfer_data->gc); - - pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15, - YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt_to_send, "ssssis", - 1, purple_normalize(account, purple_account_get_username(account)), - 5, xfer->who, - 265, xfer_data->xfer_peer_idstring, - 27, xfer->filename, - 249, xfer_data->info_val_249, - 251, xfer_data->xfer_idstring_for_relay); - - yahoo_packet_send_and_free(pkt_to_send, yd); - - if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, - yahoo_xfer_connected_15, xfer) == NULL) { - purple_notify_error(gc, NULL, _("File Transfer Failed"), - _("Unable to establish file descriptor.")); - purple_xfer_cancel_remote(xfer); - } - } - else if(val_249 == 2) { - p2p_data = g_hash_table_lookup(yd->peers, xfer->who); - if( !( p2p_data && (p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) ) ) { - purple_xfer_cancel_remote(xfer); - return; - } - if(!purple_network_listen_range(0, 0, SOCK_STREAM, yahoo_p2p_ft_server_listen_cb, xfer)) { - purple_xfer_cancel_remote(xfer); - return; - } - } -} - -/* TODO: Check filename etc. No probs till some hacker comes in the way */ -void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - gchar *xfer_peer_idstring = NULL; - gchar *xfer_idstring_for_relay = NULL; - PurpleXfer *xfer; - YahooData *yd; - struct yahoo_xfer_data *xfer_data; - GSList *l; - PurpleAccount *account; - long val_66 = 0; - gchar *url = NULL; - int val_249 = 0; - - yd = gc->proto_data; - for (l = pkt->hash; l; l = l->next) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 251: - xfer_idstring_for_relay = pair->value; - break; - case 265: - xfer_peer_idstring = pair->value; - break; - case 66: - val_66 = atol(pair->value); - break; - case 249: - val_249 = atol(pair->value); - break; - case 250: - url = pair->value; /* we get a p2p url here when sending file, connected as client */ - break; - } - } - - xfer = g_hash_table_lookup(yd->xfer_peer_idstring_map, xfer_peer_idstring); - if(!xfer) return; - - if(val_66 == -1 || ( (!(xfer_idstring_for_relay)) && (val_249 != 2) )) - { - purple_xfer_cancel_remote(xfer); - return; - } - - if( (val_249 == 2) && (!(url)) ) - { - purple_xfer_cancel_remote(xfer); - return; - } - - xfer_data = xfer->data; - if(url) - purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL); - - xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); - xfer_data->status_15 = ACCEPTED; - account = purple_connection_get_account(gc); - - if (purple_proxy_connect(gc, account, xfer_data->host, xfer_data->port, - yahoo_xfer_connected_15, xfer) == NULL) - { - purple_notify_error(gc, NULL, _("File Transfer Failed"),_("Unable to connect")); - purple_xfer_cancel_remote(xfer); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_filexfer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _YAHOO_FILEXFER_H_ -#define _YAHOO_FILEXFER_H_ - -#include "ft.h" - -/** - * Process ymsg events, particular IMViroments like Doodle - */ -void yahoo_process_p2pfilexfer( PurpleConnection *gc, struct yahoo_packet *pkt ); - -/** - * Process ymsg file receive invites. - */ -void yahoo_process_filetransfer(PurpleConnection *gc, struct yahoo_packet *pkt); - -/** - * Create a new PurpleXfer - * - * @param gc The PurpleConnection handle. - * @param who Who will we be sending it to? - */ -PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who); - -/** - * Returns TRUE if the buddy can receive file, FALSE otherwise. - * Federated users cannot receive files. So this will return FALSE only - * for them. - * - * @param gc The connection - * @param who The name of the remote user - * - * @return TRUE or FALSE - */ -gboolean yahoo_can_receive_file(PurpleConnection *gc, const char *who); - -/** - * Send a file. - * - * @param gc The PurpleConnection handle. - * @param who Who are we sending it to? - * @param file What file? If NULL, user will choose after this call. - */ -void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file); - -void yahoo_process_filetrans_15(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_filetrans_acc_15(PurpleConnection *gc, struct yahoo_packet *pkt); - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,325 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "prpl.h" -#include "util.h" -#include "debug.h" - -#include "yahoo_friend.h" -#include "yahoo_aliases.h" - -static YahooFriend *yahoo_friend_new(void) -{ - YahooFriend *ret; - - ret = g_new0(YahooFriend, 1); - ret->status = YAHOO_STATUS_OFFLINE; - ret->presence = YAHOO_PRESENCE_DEFAULT; - - return ret; -} - -YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name) -{ - YahooData *yd; - const char *norm; - - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - - yd = gc->proto_data; - norm = purple_normalize(purple_connection_get_account(gc), name); - - return g_hash_table_lookup(yd->friends, norm); -} - -YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name) -{ - YahooFriend *f; - YahooData *yd; - const char *norm; - - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(gc->proto_data != NULL, NULL); - - yd = gc->proto_data; - norm = purple_normalize(purple_connection_get_account(gc), name); - - f = g_hash_table_lookup(yd->friends, norm); - if (!f) { - f = yahoo_friend_new(); - g_hash_table_insert(yd->friends, g_strdup(norm), f); - } - - return f; -} - -void yahoo_friend_set_ip(YahooFriend *f, const char *ip) -{ - g_free(f->ip); - f->ip = g_strdup(ip); -} - -const char *yahoo_friend_get_ip(YahooFriend *f) -{ - return f->ip; -} - -void yahoo_friend_set_game(YahooFriend *f, const char *game) -{ - g_free(f->game); - - if (game) - f->game = g_strdup(game); - else - f->game = NULL; -} - -const char *yahoo_friend_get_game(YahooFriend *f) -{ - return f->game; -} - -void yahoo_friend_set_status_message(YahooFriend *f, char *msg) -{ - g_free(f->msg); - - f->msg = msg; -} - -const char *yahoo_friend_get_status_message(YahooFriend *f) -{ - return f->msg; -} - -void yahoo_friend_set_buddy_icon_need_request(YahooFriend *f, gboolean needs) -{ - f->bicon_sent_request = !needs; -} - -gboolean yahoo_friend_get_buddy_icon_need_request(YahooFriend *f) -{ - return !f->bicon_sent_request; -} - -void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id) -{ - g_free(f->ypd.id); - f->ypd.id = g_strdup(alias_id); -} - -const char *yahoo_friend_get_alias_id(YahooFriend *f) -{ - return f->ypd.id; -} - -void yahoo_friend_free(gpointer p) -{ - YahooFriend *f = p; - g_free(f->msg); - g_free(f->game); - g_free(f->ip); - yahoo_personal_details_reset(&f->ypd, TRUE); - g_free(f); -} - -void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - YahooFriend *f; - char *temp = NULL; - char *who = NULL; - int value = 0; - YahooFederation fed = YAHOO_FEDERATION_NONE; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 7: - temp = pair->value; - break; - case 31: - value = strtol(pair->value, NULL, 10); - break; - case 241: - fed = strtol(pair->value, NULL, 10); - break; - } - - l = l->next; - } - - if (value != 1 && value != 2) { - purple_debug_error("yahoo", "Received unknown value for presence key: %d\n", value); - return; - } - - switch (fed) { - case YAHOO_FEDERATION_MSN: - who = g_strconcat("msn/", temp, NULL); - break; - case YAHOO_FEDERATION_OCS: - who = g_strconcat("ocs/", temp, NULL); - break; - case YAHOO_FEDERATION_IBM: - who = g_strconcat("ibm/", temp, NULL); - break; - case YAHOO_FEDERATION_PBX: - who = g_strconcat("pbx/", temp, NULL); - break; - case YAHOO_FEDERATION_NONE: - who = g_strdup(temp); - break; - } - g_return_if_fail(who != NULL); - - f = yahoo_friend_find(gc, who); - if (!f) { - g_free(who); - return; - } - - if (pkt->service == YAHOO_SERVICE_PRESENCE_PERM) { - purple_debug_info("yahoo", "Setting permanent presence for %s to %d.\n", who, (value == 1)); - /* If setting from perm offline to online when in invisible status, - * this has already been taken care of (when the temp status changed) */ - if (value == 2 && f->presence == YAHOO_PRESENCE_ONLINE) { - } else { - if (value == 1) /* Setting Perm offline */ - f->presence = YAHOO_PRESENCE_PERM_OFFLINE; - else - f->presence = YAHOO_PRESENCE_DEFAULT; - } - } else { - purple_debug_info("yahoo", "Setting session presence for %s to %d.\n", who, (value == 1)); - if (value == 1) - f->presence = YAHOO_PRESENCE_ONLINE; - else - f->presence = YAHOO_PRESENCE_DEFAULT; - } - g_free(who); -} - -void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, - YahooPresenceVisibility presence) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt = NULL; - YahooFriend *f; - const char *thirtyone, *thirteen; - int service = -1; - const char *temp = NULL; - - if (!yd->logged_in) - return; - - f = yahoo_friend_find(gc, name); - if (!f) - return; - - if(f->fed != YAHOO_FEDERATION_NONE) - temp = name+4; - else - temp = name; - - /* No need to change the value if it is already correct */ - if (f->presence == presence) { - purple_debug_info("yahoo", "Not setting presence because there are no changes.\n"); - return; - } - - if (presence == YAHOO_PRESENCE_PERM_OFFLINE) { - service = YAHOO_SERVICE_PRESENCE_PERM; - thirtyone = "1"; - thirteen = "2"; - } else if (presence == YAHOO_PRESENCE_DEFAULT) { - if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { - service = YAHOO_SERVICE_PRESENCE_PERM; - thirtyone = "2"; - thirteen = "2"; - } else if (yd->current_status == YAHOO_STATUS_INVISIBLE) { - service = YAHOO_SERVICE_PRESENCE_SESSION; - thirtyone = "2"; - thirteen = "1"; - } - } else if (presence == YAHOO_PRESENCE_ONLINE) { - if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { - pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM, - YAHOO_STATUS_AVAILABLE, yd->session_id); - if(f->fed) - yahoo_packet_hash(pkt, "ssssssiss", - 1, purple_connection_get_display_name(gc), - 31, "2", 13, "2", - 302, "319", 300, "319", - 7, temp, 241, f->fed, - 301, "319", 303, "319"); - else - yahoo_packet_hash(pkt, "ssssssss", - 1, purple_connection_get_display_name(gc), - 31, "2", 13, "2", - 302, "319", 300, "319", - 7, temp, - 301, "319", 303, "319"); - - yahoo_packet_send_and_free(pkt, yd); - } - - service = YAHOO_SERVICE_PRESENCE_SESSION; - thirtyone = "1"; - thirteen = "1"; - } - - if (service > 0) { - pkt = yahoo_packet_new(service, - YAHOO_STATUS_AVAILABLE, yd->session_id); - - if(f->fed) - yahoo_packet_hash(pkt, "ssssssiss", - 1, purple_connection_get_display_name(gc), - 31, thirtyone, 13, thirteen, - 302, "319", 300, "319", - 7, temp, 241, f->fed, - 301, "319", 303, "319"); - else - yahoo_packet_hash(pkt, "ssssssss", - 1, purple_connection_get_display_name(gc), - 31, thirtyone, 13, thirteen, - 302, "319", 300, "319", - 7, temp, - 301, "319", 303, "319"); - - yahoo_packet_send_and_free(pkt, yd); - } -} - -void yahoo_friend_set_p2p_status(YahooFriend *f, YahooP2PStatus p2p_status) -{ - f->p2p_status = p2p_status; -} - -YahooP2PStatus yahoo_friend_get_p2p_status(YahooFriend *f) -{ - return f->p2p_status; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_friend.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file yahoo_friend.h The Yahoo! protocol plugin YahooFriend object - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOO_FRIEND_H_ -#define _YAHOO_FRIEND_H_ - -#include "libymsg.h" -#include "yahoo_packet.h" - -typedef enum { - YAHOO_PRESENCE_DEFAULT = 0, - YAHOO_PRESENCE_ONLINE, - YAHOO_PRESENCE_PERM_OFFLINE -} YahooPresenceVisibility; - -typedef enum { - YAHOO_P2PSTATUS_NOT_CONNECTED = 0, - YAHOO_P2PSTATUS_DO_NOT_CONNECT, - YAHOO_P2PSTATUS_WE_ARE_SERVER, - YAHOO_P2PSTATUS_WE_ARE_CLIENT -} YahooP2PStatus; - - -/* these are called friends instead of buddies mainly so I can use variables - * named f and not confuse them with variables named b - */ -typedef struct _YahooFriend { - enum yahoo_status status; - gchar *msg; - gchar *game; - int idle; - int away; - gboolean sms; - gchar *ip; - gboolean bicon_sent_request; - YahooPresenceVisibility presence; - YahooFederation fed; - long int version_id; - YahooPersonalDetails ypd; - YahooP2PStatus p2p_status; - gboolean p2p_packet_sent; /* 0:not sent, 1=sent */ - gint session_id; /* session id of friend */ -} YahooFriend; - -YahooFriend *yahoo_friend_find(PurpleConnection *gc, const char *name); -YahooFriend *yahoo_friend_find_or_new(PurpleConnection *gc, const char *name); - -void yahoo_friend_set_ip(YahooFriend *f, const char *ip); -const char *yahoo_friend_get_ip(YahooFriend *f); - -void yahoo_friend_set_game(YahooFriend *f, const char *game); -const char *yahoo_friend_get_game(YahooFriend *f); - -void yahoo_friend_set_status_message(YahooFriend *f, char *msg); -const char *yahoo_friend_get_status_message(YahooFriend *f); - -void yahoo_friend_set_alias_id(YahooFriend *f, const char *alias_id); -const char *yahoo_friend_get_alias_id(YahooFriend *f); - -void yahoo_friend_set_buddy_icon_need_request(YahooFriend *f, gboolean needs); -gboolean yahoo_friend_get_buddy_icon_need_request(YahooFriend *f); - -void yahoo_friend_free(gpointer p); - -void yahoo_process_presence(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_friend_update_presence(PurpleConnection *gc, const char *name, - YahooPresenceVisibility presence); - -void yahoo_friend_set_p2p_status(YahooFriend *f, YahooP2PStatus p2p_status); -YahooP2PStatus yahoo_friend_get_p2p_status(YahooFriend *f); - -#endif /* _YAHOO_FRIEND_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,403 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" -#include "debug.h" - -#include "libymsg.h" -#include "yahoo_packet.h" - -struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id) -{ - struct yahoo_packet *pkt = g_new0(struct yahoo_packet, 1); - - pkt->service = service; - pkt->status = status; - pkt->id = id; - - return pkt; -} - -void yahoo_packet_hash_str(struct yahoo_packet *pkt, int key, const char *value) -{ - struct yahoo_pair *pair; - - g_return_if_fail(value != NULL); - - pair = g_new0(struct yahoo_pair, 1); - pair->key = key; - pair->value = g_strdup(value); - pkt->hash = g_slist_prepend(pkt->hash, pair); -} - -void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value) -{ - struct yahoo_pair *pair; - - pair = g_new0(struct yahoo_pair, 1); - pair->key = key; - pair->value = g_strdup_printf("%d", value); - pkt->hash = g_slist_prepend(pkt->hash, pair); -} - -void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...) -{ - char *strval; - int key, intval; - const char *cur; - va_list ap; - - va_start(ap, fmt); - for (cur = fmt; *cur; cur++) { - key = va_arg(ap, int); - switch (*cur) { - case 'i': - intval = va_arg(ap, int); - yahoo_packet_hash_int(pkt, key, intval); - break; - case 's': - strval = va_arg(ap, char *); - yahoo_packet_hash_str(pkt, key, strval); - break; - default: - purple_debug_error("yahoo", "Invalid format character '%c'\n", *cur); - break; - } - } - va_end(ap); -} - -size_t yahoo_packet_length(struct yahoo_packet *pkt) -{ - GSList *l; - - size_t len = 0; - - l = pkt->hash; - while (l) { - struct yahoo_pair *pair = l->data; - int tmp = pair->key; - do { - tmp /= 10; - len++; - } while (tmp); - len += 2; - len += strlen(pair->value); - len += 2; - l = l->next; - } - - return len; -} - -/* - * 'len' is the value given to us by the server that is supposed to - * be the length of 'data'. But apparently there's a time when this - * length is incorrect. Christopher Layne thinks it might be a bug - * in their server code. - * - * The following information is from Christopher: - * - * It sometimes happens when Yahoo! sends a packet continuation within - * chat. Sometimes when joining a large chatroom the initial - * SERVICE_CHATJOIN packet will be so large that it will need to be - * split into multiple packets. That's fine, except that the length - * of the second packet is wrong. The packet has the same length as - * the first packet, and the length given in the header is the same, - * however the actual data in the packet is shorter than this length. - * So half of the packet contains good, valid data, and then the rest - * of the packet is junk. Luckily there is a null terminator after - * the valid data and before the invalid data. - * - * What does all this mean? It means that we parse through the data - * pulling out key/value pairs until we've parsed 'len' bytes, or until - * we run into a null terminator, whichever comes first. - */ -void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len) -{ - int pos = 0; - char key[64]; - const guchar *delimiter; - gboolean accept; - int x; - struct yahoo_pair *pair; - - while (pos + 1 < len) - { - if (data[pos] == '\0') - break; - - pair = g_new0(struct yahoo_pair, 1); - - x = 0; - while (pos + 1 < len) { - if (data[pos] == 0xc0 && data[pos + 1] == 0x80) - break; - if (x >= sizeof(key)-1) { - x++; - pos++; - continue; - } - key[x++] = data[pos++]; - } - if (x >= sizeof(key)-1) { - x = 0; - } - key[x] = 0; - pos += 2; - pair->key = strtol(key, NULL, 10); - accept = x; /* if x is 0 there was no key, so don't accept it */ - - if (pos + 1 > len) { - /* Malformed packet! (Truncated--garbage or something) */ - accept = FALSE; - } - - if (accept) { - delimiter = (const guchar *)g_strstr_len((const char *)&data[pos], len - pos, "\xc0\x80"); - if (delimiter == NULL) - { - /* Malformed packet! (It doesn't end in 0xc0 0x80) */ - g_free(pair); - pos = len; - continue; - } - x = delimiter - data; - pair->value = g_strndup((const gchar *)&data[pos], x - pos); - pos = x; - pkt->hash = g_slist_prepend(pkt->hash, pair); - - if (purple_debug_is_verbose() || g_getenv("PURPLE_YAHOO_DEBUG")) { - char *esc; - esc = g_strescape(pair->value, NULL); - purple_debug_misc("yahoo", "Key: %d \tValue: %s\n", pair->key, esc); - g_free(esc); - } - } else { - g_free(pair); - } - pos += 2; - - if (pos + 1 > len) break; - - /* Skip over garbage we've noticed in the mail notifications */ - if (data[0] == '9' && data[pos] == 0x01) - pos++; - } - - /* - * Originally this function used g_slist_append(). I changed - * it to use g_slist_prepend() for improved performance. - * Ideally the Yahoo! PRPL code would be indifferent to the - * order of the key/value pairs, but I don't know if this is - * the case for all incoming messages. To be on the safe side - * we reverse the list. - */ - pkt->hash = g_slist_reverse(pkt->hash); -} - -void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data) -{ - GSList *l; - int pos = 0; - - /* This is only called from one place, and the list is - * always backwards */ - - l = pkt->hash = g_slist_reverse(pkt->hash); - - while (l) { - struct yahoo_pair *pair = l->data; - gchar buf[100]; - - g_snprintf(buf, sizeof(buf), "%d", pair->key); - strcpy((char *)&data[pos], buf); - pos += strlen(buf); - data[pos++] = 0xc0; - data[pos++] = 0x80; - - strcpy((char *)&data[pos], pair->value); - pos += strlen(pair->value); - data[pos++] = 0xc0; - data[pos++] = 0x80; - - l = l->next; - } -} - -void yahoo_packet_dump(guchar *data, int len) -{ -#ifdef YAHOO_DEBUG - int i; - - purple_debug_misc("yahoo", ""); - - for (i = 0; i + 1 < len; i += 2) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - purple_debug_misc(NULL, "%02x%02x ", data[i], data[i + 1]); - } - if (i < len) - purple_debug_misc(NULL, "%02x", data[i]); - - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - - for (i = 0; i < len; i++) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - if (g_ascii_isprint(data[i])) - purple_debug_misc(NULL, "%c ", data[i]); - else - purple_debug_misc(NULL, ". "); - } - - purple_debug_misc(NULL, "\n"); -#endif /* YAHOO_DEBUG */ -} - -static void -yahoo_packet_send_can_write(gpointer data, gint source, PurpleInputCondition cond) -{ - YahooData *yd = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(yd->txbuf); - - if (writelen == 0) { - purple_input_remove(yd->txhandler); - yd->txhandler = 0; - return; - } - - ret = write(yd->fd, yd->txbuf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret < 0) { - /* TODO: what to do here - do we really have to disconnect? */ - purple_connection_error_reason(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Write Error")); - return; - } - - purple_circ_buffer_mark_read(yd->txbuf, ret); -} - - -size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, - gboolean jp, guchar **buf) -{ - size_t pktlen = yahoo_packet_length(pkt); - size_t len = YAHOO_PACKET_HDRLEN + pktlen; - guchar *data; - int pos = 0; - - data = g_malloc0(len + 1); - - memcpy(data + pos, "YMSG", 4); pos += 4; - - if (wm) - pos += yahoo_put16(data + pos, YAHOO_WEBMESSENGER_PROTO_VER); - else if (jp) - pos += yahoo_put16(data + pos, YAHOO_PROTO_VER_JAPAN); - else - pos += yahoo_put16(data + pos, YAHOO_PROTO_VER); - pos += yahoo_put16(data + pos, 0x0000); - pos += yahoo_put16(data + pos, pktlen + pad); - pos += yahoo_put16(data + pos, pkt->service); - pos += yahoo_put32(data + pos, pkt->status); - pos += yahoo_put32(data + pos, pkt->id); - - yahoo_packet_write(pkt, data + pos); - - *buf = data; - - return len; -} - -int yahoo_packet_send(struct yahoo_packet *pkt, YahooData *yd) -{ - size_t len; - gssize ret; - guchar *data; - - if (yd->fd < 0) - return -1; - - len = yahoo_packet_build(pkt, 0, yd->wm, yd->jp, &data); - - yahoo_packet_dump(data, len); - if (yd->txhandler == 0) - ret = write(yd->fd, data, len); - else { - ret = -1; - errno = EAGAIN; - } - - if (ret < 0 && errno == EAGAIN) - ret = 0; - else if (ret <= 0) { - purple_debug_warning("yahoo", "Only wrote %" G_GSSIZE_FORMAT - " of %" G_GSIZE_FORMAT " bytes!\n", ret, len); - g_free(data); - return ret; - } - - if (ret < len) { - if (yd->txhandler == 0) - yd->txhandler = purple_input_add(yd->fd, PURPLE_INPUT_WRITE, - yahoo_packet_send_can_write, yd); - purple_circ_buffer_append(yd->txbuf, data + ret, len - ret); - } - - g_free(data); - - return ret; -} - -int yahoo_packet_send_and_free(struct yahoo_packet *pkt, YahooData *yd) -{ - int ret; - - ret = yahoo_packet_send(pkt, yd); - yahoo_packet_free(pkt); - return ret; -} - -void yahoo_packet_free(struct yahoo_packet *pkt) -{ - while (pkt->hash) { - struct yahoo_pair *pair = pkt->hash->data; - g_free(pair->value); - g_free(pair); - pkt->hash = g_slist_delete_link(pkt->hash, pkt->hash); - } - g_free(pkt); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_packet.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,150 +0,0 @@ -/** - * @file yahoo_packet.h The Yahoo! protocol plugin - * - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _YAHOO_PACKET_H_ -#define _YAHOO_PACKET_H_ - -enum yahoo_service { /* these are easier to see in hex */ - YAHOO_SERVICE_LOGON = 1, - YAHOO_SERVICE_LOGOFF, - YAHOO_SERVICE_ISAWAY, - YAHOO_SERVICE_ISBACK, - YAHOO_SERVICE_IDLE, /* 5 (placemarker) */ - YAHOO_SERVICE_MESSAGE, - YAHOO_SERVICE_IDACT, - YAHOO_SERVICE_IDDEACT, - YAHOO_SERVICE_MAILSTAT, - YAHOO_SERVICE_USERSTAT, /* 0xa */ - YAHOO_SERVICE_NEWMAIL, - YAHOO_SERVICE_CHATINVITE, - YAHOO_SERVICE_CALENDAR, - YAHOO_SERVICE_NEWPERSONALMAIL, - YAHOO_SERVICE_NEWCONTACT, - YAHOO_SERVICE_ADDIDENT, /* 0x10 */ - YAHOO_SERVICE_ADDIGNORE, - YAHOO_SERVICE_PING, - YAHOO_SERVICE_GOTGROUPRENAME, - YAHOO_SERVICE_SYSMESSAGE = 0x14, - YAHOO_SERVICE_SKINNAME = 0x15, - YAHOO_SERVICE_PASSTHROUGH2 = 0x16, - YAHOO_SERVICE_CONFINVITE = 0x18, - YAHOO_SERVICE_CONFLOGON, - YAHOO_SERVICE_CONFDECLINE, - YAHOO_SERVICE_CONFLOGOFF, - YAHOO_SERVICE_CONFADDINVITE, - YAHOO_SERVICE_CONFMSG, - YAHOO_SERVICE_CHATLOGON, - YAHOO_SERVICE_CHATLOGOFF, - YAHOO_SERVICE_CHATMSG = 0x20, - YAHOO_SERVICE_GAMELOGON = 0x28, - YAHOO_SERVICE_GAMELOGOFF, - YAHOO_SERVICE_GAMEMSG = 0x2a, - YAHOO_SERVICE_FILETRANSFER = 0x46, - YAHOO_SERVICE_VOICECHAT = 0x4A, - YAHOO_SERVICE_NOTIFY = 0x4B, - YAHOO_SERVICE_VERIFY, - YAHOO_SERVICE_P2PFILEXFER, - YAHOO_SERVICE_PEERTOPEER = 0x4F, - YAHOO_SERVICE_WEBCAM, - YAHOO_SERVICE_AUTHRESP = 0x54, - YAHOO_SERVICE_LIST = 0x55, - YAHOO_SERVICE_AUTH = 0x57, - YAHOO_SERVICE_AUTHBUDDY = 0x6d, - YAHOO_SERVICE_ADDBUDDY = 0x83, - YAHOO_SERVICE_REMBUDDY = 0x84, - YAHOO_SERVICE_IGNORECONTACT, /* > 1, 7, 13 < 1, 66, 13, 0*/ - YAHOO_SERVICE_REJECTCONTACT, - YAHOO_SERVICE_GROUPRENAME = 0x89, /* > 1, 65(new), 66(0), 67(old) */ - YAHOO_SERVICE_KEEPALIVE = 0x8A, - YAHOO_SERVICE_CHATONLINE = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ - YAHOO_SERVICE_CHATGOTO, - YAHOO_SERVICE_CHATJOIN, /* > 1 104-room 129-1600326591 62-2 */ - YAHOO_SERVICE_CHATLEAVE, - YAHOO_SERVICE_CHATEXIT = 0x9b, - YAHOO_SERVICE_CHATADDINVITE = 0x9d, - YAHOO_SERVICE_CHATLOGOUT = 0xa0, - YAHOO_SERVICE_CHATPING, - YAHOO_SERVICE_COMMENT = 0xa8, - YAHOO_SERVICE_PRESENCE_PERM = 0xb9, - YAHOO_SERVICE_PRESENCE_SESSION = 0xba, - YAHOO_SERVICE_AVATAR = 0xbc, - YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd, - YAHOO_SERVICE_PICTURE = 0xbe, - YAHOO_SERVICE_PICTURE_UPDATE = 0xc1, - YAHOO_SERVICE_PICTURE_UPLOAD = 0xc2, - YAHOO_SERVICE_Y6_VISIBLE_TOGGLE = 0xc5, - YAHOO_SERVICE_Y6_STATUS_UPDATE = 0xc6, - YAHOO_SERVICE_AVATAR_UPDATE = 0xc7, - YAHOO_SERVICE_VERIFY_ID_EXISTS = 0xc8, - YAHOO_SERVICE_AUDIBLE = 0xd0, - YAHOO_SERVICE_CONTACT_DETAILS = 0xd3, - /* YAHOO_SERVICE_CHAT_SESSION = 0xd4,?? Reports start of chat session, gets an id from server */ - YAHOO_SERVICE_AUTH_REQ_15 = 0xd6, - YAHOO_SERVICE_FILETRANS_15 = 0xdc, - YAHOO_SERVICE_FILETRANS_INFO_15 = 0xdd, - YAHOO_SERVICE_FILETRANS_ACC_15 = 0xde, - /* photo sharing services ?? - 0xd2, 0xd7, 0xd8, 0xda */ - YAHOO_SERVICE_CHGRP_15 = 0xe7, - YAHOO_SERVICE_STATUS_15 = 0xf0, - YAHOO_SERVICE_LIST_15 = 0xf1, - YAHOO_SERVICE_MESSAGE_ACK = 0xfb, - YAHOO_SERVICE_WEBLOGIN = 0x0226, - YAHOO_SERVICE_SMS_MSG = 0x02ea - /* YAHOO_SERVICE_DISCONNECT = 0x07d1 Server forces us to disconnect. Is sent with TCP FIN flag set */ -}; - -struct yahoo_pair { - int key; - char *value; -}; - -struct yahoo_packet { - guint16 service; - guint32 status; - guint32 id; - GSList *hash; -}; - -#define YAHOO_WEBMESSENGER_PROTO_VER 0x0065 -#define YAHOO_PROTO_VER 0x0010 -#define YAHOO_PROTO_VER_JAPAN 0x0010 - -#define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4) - -struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, - enum yahoo_status status, int id); -void yahoo_packet_hash(struct yahoo_packet *pkt, const char *fmt, ...); -void yahoo_packet_hash_str(struct yahoo_packet *pkt, int key, const char *value); -void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value); -int yahoo_packet_send(struct yahoo_packet *pkt, YahooData *yd); -int yahoo_packet_send_and_free(struct yahoo_packet *pkt, YahooData *yd); -size_t yahoo_packet_build(struct yahoo_packet *pkt, int pad, gboolean wm, gboolean jp, -guchar **buf); -void yahoo_packet_read(struct yahoo_packet *pkt, const guchar *data, int len); -void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data); -void yahoo_packet_dump(guchar *data, int len); -size_t yahoo_packet_length(struct yahoo_packet *pkt); -void yahoo_packet_free(struct yahoo_packet *pkt); - -#endif /* _YAHOO_PACKET_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,597 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include "account.h" -#include "accountopt.h" -#include "blist.h" -#include "debug.h" -#include "privacy.h" -#include "prpl.h" -#include "proxy.h" -#include "util.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "yahoo_friend.h" -#include "yahoo_picture.h" - - -struct yahoo_fetch_picture_data { - PurpleConnection *gc; - char *who; - int checksum; -}; - -static void -yahoo_fetch_picture_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *pic_data, size_t len, const gchar *error_message) -{ - struct yahoo_fetch_picture_data *d; - YahooData *yd; - - d = user_data; - yd = d->gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - if (error_message != NULL) { - purple_debug_error("yahoo", "Fetching buddy icon failed: %s\n", error_message); - } else if (len == 0) { - purple_debug_error("yahoo", "Fetched an icon with length 0. Strange.\n"); - } else { - char *checksum = g_strdup_printf("%i", d->checksum); - purple_buddy_icons_set_for_user(purple_connection_get_account(d->gc), d->who, g_memdup(pic_data, len), len, checksum); - g_free(checksum); - } - - g_free(d->who); - g_free(d); -} - -void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - YahooData *yd; - GSList *l = pkt->hash; - char *who = NULL, *us = NULL; - gboolean got_icon_info = FALSE, send_icon_info = FALSE; - char *url = NULL; - int checksum = 0; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 1: - case 4: - who = pair->value; - break; - case 5: - us = pair->value; - break; - case 13: { - int tmp; - tmp = strtol(pair->value, NULL, 10); - if (tmp == 1) { - send_icon_info = TRUE; - } else if (tmp == 2) { - got_icon_info = TRUE; - } - break; - } - case 20: - url = pair->value; - break; - case 192: - checksum = strtol(pair->value, NULL, 10); - break; - } - - l = l->next; - } - - if (!who) - return; - - if (!purple_privacy_check(purple_connection_get_account(gc), who)) { - purple_debug_info("yahoo", "Picture packet from %s dropped.\n", who); - return; - } - - /* Yahoo IM 6 spits out 0.png as the URL if the buddy icon is not set */ - if (who && got_icon_info && url && !g_ascii_strncasecmp(url, "http://", 7)) { - /* TODO: make this work p2p, try p2p before the url */ - PurpleUtilFetchUrlData *url_data; - struct yahoo_fetch_picture_data *data; - PurpleBuddy *b = purple_find_buddy(gc->account, who); - const char *locksum = NULL; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - /* FIXME: Cleanup this strtol() stuff if possible. */ - if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && - (checksum == strtol(locksum, NULL, 10))) - return; - - data = g_new0(struct yahoo_fetch_picture_data, 1); - data->gc = gc; - data->who = g_strdup(who); - data->checksum = checksum; - /* TODO: Does this need to be MSIE 5.0? */ - url_data = purple_util_fetch_url(url, use_whole_url, - "Mozilla/4.0 (compatible; MSIE 5.5)", FALSE, - yahoo_fetch_picture_cb, data); - if (url_data != NULL) { - yd = gc->proto_data; - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - } else { - g_free(data->who); - g_free(data); - } - } else if (who && send_icon_info) { - yahoo_send_picture_info(gc, who); - } -} - -void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *who = NULL; - int checksum = 0; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - break; - case 5: - /* us */ - break; - case 192: - checksum = strtol(pair->value, NULL, 10); - break; - } - l = l->next; - } - - if (who) { - PurpleBuddy *b = purple_find_buddy(gc->account, who); - const char *locksum = NULL; - - /* FIXME: Cleanup this strtol() stuff if possible. */ - if (b) { - locksum = purple_buddy_icons_get_checksum_for_user(b); - if (!locksum || (checksum != strtol(locksum, NULL, 10))) - yahoo_send_picture_request(gc, who); - } - } -} - -void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - GSList *l = pkt->hash; - char *url = NULL; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 5: - /* us */ - break; - case 27: - /* filename on our computer. */ - break; - case 20: /* url at yahoo */ - url = pair->value; - case 38: /* timestamp */ - break; - } - l = l->next; - } - - if (url) { - g_free(yd->picture_url); - yd->picture_url = g_strdup(url); - purple_account_set_string(account, YAHOO_PICURL_SETTING, url); - purple_account_set_int(account, YAHOO_PICCKSUM_SETTING, yd->picture_checksum); - yahoo_send_picture_checksum(gc); - yahoo_send_picture_update(gc, 2); - } -} - -void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt) -{ - GSList *l = pkt->hash; - char *who = NULL; - int avatar = 0; - - while (l) { - struct yahoo_pair *pair = l->data; - - switch (pair->key) { - case 4: - who = pair->value; - break; - case 5: - /* us */ - break; - case 206: /* Older versions. Still needed? */ - case 213: /* Newer versions */ - /* - * 0 - No icon or avatar - * 1 - Using an avatar - * 2 - Using an icon - */ - avatar = strtol(pair->value, NULL, 10); - break; - } - l = l->next; - } - - if (who) { - if (avatar == 2) - yahoo_send_picture_request(gc, who); - else if ((avatar == 0) || (avatar == 1)) { - YahooFriend *f; - purple_buddy_icons_set_for_user(gc->account, who, NULL, 0, NULL); - if ((f = yahoo_friend_find(gc, who))) - yahoo_friend_set_buddy_icon_need_request(f, TRUE); - purple_debug_misc("yahoo", "Setting user %s's icon to NULL.\n", who); - } - } -} - -void yahoo_send_picture_info(PurpleConnection *gc, const char *who) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - if (!yd->picture_url) { - purple_debug_warning("yahoo", "Attempted to send picture info without a picture\n"); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssssi", 1, purple_connection_get_display_name(gc), - 5, who, - 13, "2", 20, yd->picture_url, 192, yd->picture_checksum); - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_send_picture_request(PurpleConnection *gc, const char *who) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); /* me */ - yahoo_packet_hash_str(pkt, 5, who); /* the other guy */ - yahoo_packet_hash_str(pkt, 13, "1"); /* 1 = request, 2 = reply */ - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_send_picture_checksum(PurpleConnection *gc) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "ssi", 1, purple_connection_get_display_name(gc), - 212, "1", 192, yd->picture_checksum); - yahoo_packet_send_and_free(pkt, yd); -} - -void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type) -{ - YahooData *yd = gc->proto_data; - struct yahoo_packet *pkt; - - pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); - yahoo_packet_hash(pkt, "si", 3, who, 213, type); - yahoo_packet_send_and_free(pkt, yd); -} - -struct yspufe { - PurpleConnection *gc; - int type; -}; - -static void yahoo_send_picture_update_foreach(gpointer key, gpointer value, gpointer data) -{ - const char *who = key; - YahooFriend *f = value; - struct yspufe *d = data; - - if (f->status != YAHOO_STATUS_OFFLINE) - yahoo_send_picture_update_to_user(d->gc, who, d->type); -} - -void yahoo_send_picture_update(PurpleConnection *gc, int type) -{ - YahooData *yd = gc->proto_data; - struct yspufe data; - - data.gc = gc; - data.type = type; - - g_hash_table_foreach(yd->friends, yahoo_send_picture_update_foreach, &data); -} - -void yahoo_buddy_icon_upload_data_free(struct yahoo_buddy_icon_upload_data *d) -{ - purple_debug_misc("yahoo", "In yahoo_buddy_icon_upload_data_free()\n"); - - if (d->str) - g_string_free(d->str, TRUE); - g_free(d->filename); - if (d->watcher) - purple_input_remove(d->watcher); - if (d->fd != -1) - close(d->fd); - g_free(d); -} - -/* we couldn't care less about the server's response, but yahoo gets grumpy if we close before it sends it */ -static void yahoo_buddy_icon_upload_reading(gpointer data, gint source, PurpleInputCondition condition) -{ - struct yahoo_buddy_icon_upload_data *d = data; - PurpleConnection *gc = d->gc; - char buf[1024]; - int ret; - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - yahoo_buddy_icon_upload_data_free(d); - return; - } - - ret = read(d->fd, buf, sizeof(buf)); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - /* There are other problems if d->str->len overflows, so shut up the - * warning on 64-bit. */ - purple_debug_info("yahoo", "Buddy icon upload response (%" G_GSIZE_FORMAT ") bytes (> ~400 indicates failure):\n%.*s\n", - d->str->len, (guint)d->str->len, d->str->str); - - yahoo_buddy_icon_upload_data_free(d); - return; - } - - g_string_append_len(d->str, buf, ret); -} - -static void yahoo_buddy_icon_upload_pending(gpointer data, gint source, PurpleInputCondition condition) -{ - struct yahoo_buddy_icon_upload_data *d = data; - PurpleConnection *gc = d->gc; - gssize wrote; - - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - yahoo_buddy_icon_upload_data_free(d); - return; - } - - wrote = write(d->fd, d->str->str + d->pos, d->str->len - d->pos); - if (wrote < 0 && errno == EAGAIN) - return; - if (wrote <= 0) { - purple_debug_info("yahoo", "Error uploading buddy icon.\n"); - yahoo_buddy_icon_upload_data_free(d); - return; - } - d->pos += wrote; - if (d->pos >= d->str->len) { - purple_debug_misc("yahoo", "Finished uploading buddy icon.\n"); - purple_input_remove(d->watcher); - /* Clean out the sent buffer and reuse it to read the result */ - g_string_free(d->str, TRUE); - d->str = g_string_new(""); - d->watcher = purple_input_add(d->fd, PURPLE_INPUT_READ, yahoo_buddy_icon_upload_reading, d); - } -} - -static void yahoo_buddy_icon_upload_connected(gpointer data, gint source, const gchar *error_message) -{ - struct yahoo_buddy_icon_upload_data *d = data; - struct yahoo_packet *pkt; - gchar *tmp, *header; - guchar *pkt_buf; - const char *host; - int port; - gsize pkt_buf_len; - PurpleConnection *gc = d->gc; - PurpleAccount *account; - YahooData *yd; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(gc); - - account = purple_connection_get_account(gc); - yd = gc->proto_data; - - /* Buddy icon connect is now complete; clear the PurpleProxyConnectData */ - yd->buddy_icon_connect_data = NULL; - - if (source < 0) { - purple_debug_error("yahoo", "Buddy icon upload failed: %s\n", error_message); - yahoo_buddy_icon_upload_data_free(d); - return; - } - - pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPLOAD, YAHOO_STATUS_AVAILABLE, yd->session_id); - - tmp = g_strdup_printf("%" G_GSIZE_FORMAT, d->str->len); - /* 1 = me, 38 = expire time(?), 0 = me, 28 = size, 27 = filename, 14 = NULL, 29 = data */ - yahoo_packet_hash_str(pkt, 1, purple_connection_get_display_name(gc)); - yahoo_packet_hash_str(pkt, 38, "604800"); /* time til expire */ - purple_account_set_int(account, YAHOO_PICEXPIRE_SETTING, time(NULL) + 604800); - yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); - yahoo_packet_hash_str(pkt, 28, tmp); - g_free(tmp); - yahoo_packet_hash_str(pkt, 27, d->filename); - yahoo_packet_hash_str(pkt, 14, ""); - /* 4 padding for the 29 key name */ - pkt_buf_len = yahoo_packet_build(pkt, 4, FALSE, yd->jp, &pkt_buf); - yahoo_packet_free(pkt); - - /* header + packet + "29" + 0xc0 + 0x80) + pictureblob */ - - host = purple_account_get_string(account, "xfer_host", yd->jp? YAHOOJP_XFER_HOST : YAHOO_XFER_HOST); - port = purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT); - tmp = g_strdup_printf("%s:%d", host, port); - header = g_strdup_printf("POST %s%s/notifyft HTTP/1.1\r\n" - "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" - "Cookie: T=%s; Y=%s\r\n" - "Host: %s\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n" - "Cache-Control: no-cache\r\n\r\n", - use_whole_url ? "http://" : "", use_whole_url ? tmp : "", - yd->cookie_t, yd->cookie_y, - tmp, - pkt_buf_len + 4 + d->str->len); - g_free(tmp); - - /* There's no magic here, we just need to prepend in reverse order */ - g_string_prepend(d->str, "29\xc0\x80"); - - g_string_prepend_len(d->str, (char *)pkt_buf, pkt_buf_len); - g_free(pkt_buf); - - g_string_prepend(d->str, header); - g_free(header); - - /* There are other problems if we're uploading over 4GB of data */ - purple_debug_info("yahoo", "Buddy icon upload data:\n%.*s\n", (guint)d->str->len, d->str->str); - - d->fd = source; - d->watcher = purple_input_add(d->fd, PURPLE_INPUT_WRITE, yahoo_buddy_icon_upload_pending, d); - - yahoo_buddy_icon_upload_pending(d, d->fd, PURPLE_INPUT_WRITE); -} - -void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d) -{ - PurpleAccount *account = purple_connection_get_account(gc); - YahooData *yd = gc->proto_data; - - if (yd->buddy_icon_connect_data != NULL) { - /* Cancel any in-progress buddy icon upload */ - purple_proxy_connect_cancel(yd->buddy_icon_connect_data); - yd->buddy_icon_connect_data = NULL; - } - - yd->buddy_icon_connect_data = purple_proxy_connect(NULL, account, - purple_account_get_string(account, "xfer_host", - yd->jp? YAHOOJP_XFER_HOST : YAHOO_XFER_HOST), - purple_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_buddy_icon_upload_connected, d); - - if (yd->buddy_icon_connect_data == NULL) - { - purple_debug_error("yahoo", "Uploading our buddy icon failed to connect.\n"); - yahoo_buddy_icon_upload_data_free(d); - } -} - -static int yahoo_buddy_icon_calculate_checksum(const guchar *data, gsize len) -{ - /* This code is borrowed from Kopete, which seems to be managing to calculate - checksums in such a manner that Yahoo!'s servers are happy */ - - const guchar *p = data; - int checksum = 0, g, i = len; - - while(i--) { - checksum = (checksum << 4) + *p++; - - if((g = (checksum & 0xf0000000)) != 0) - checksum ^= g >> 23; - - checksum &= ~g; - } - - purple_debug_misc("yahoo", "Calculated buddy icon checksum: %d\n", checksum); - - return checksum; -} - -void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) -{ - YahooData *yd = gc->proto_data; - PurpleAccount *account = gc->account; - - if (img == NULL) { - g_free(yd->picture_url); - yd->picture_url = NULL; - - /* TODO: don't we have to clear it on the server too?! */ - - purple_account_set_string(account, YAHOO_PICURL_SETTING, NULL); - purple_account_set_int(account, YAHOO_PICCKSUM_SETTING, 0); - purple_account_set_int(account, YAHOO_PICEXPIRE_SETTING, 0); - if (yd->logged_in) - /* Tell everyone we ain't got one no more */ - yahoo_send_picture_update(gc, 0); - - } else { - gconstpointer data = purple_imgstore_get_data(img); - size_t len = purple_imgstore_get_size(img); - GString *s = g_string_new_len(data, len); - struct yahoo_buddy_icon_upload_data *d; - int oldcksum = purple_account_get_int(account, YAHOO_PICCKSUM_SETTING, 0); - int expire = purple_account_get_int(account, YAHOO_PICEXPIRE_SETTING, 0); - const char *oldurl = purple_account_get_string(account, YAHOO_PICURL_SETTING, NULL); - - yd->picture_checksum = yahoo_buddy_icon_calculate_checksum(data, len); - - if ((yd->picture_checksum == oldcksum) && - (expire > (time(NULL) + 60*60*24)) && oldurl) - { - purple_debug_misc("yahoo", "buddy icon is up to date. Not reuploading.\n"); - g_string_free(s, TRUE); - g_free(yd->picture_url); - yd->picture_url = g_strdup(oldurl); - return; - } - - /* We use this solely for sending a filename to the server */ - d = g_new0(struct yahoo_buddy_icon_upload_data, 1); - d->gc = gc; - d->str = s; - d->fd = -1; - d->filename = g_strdup(purple_imgstore_get_filename(img)); - - if (!yd->logged_in) { - yd->picture_upload_todo = d; - return; - } - - yahoo_buddy_icon_upload(gc, d); - - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_picture.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _YAHOO_PICTURE_H_ -#define _YAHOO_PICTURE_H_ - -void yahoo_send_picture_request(PurpleConnection *gc, const char *who); -void yahoo_send_picture_info(PurpleConnection *gc, const char *who); -void yahoo_send_picture_checksum(PurpleConnection *gc); -void yahoo_send_picture_update(PurpleConnection *gc, int type); -void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type); - -void yahoo_process_picture(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_picture_checksum(PurpleConnection *gc, struct yahoo_packet *pkt); -void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_process_avatar_update(PurpleConnection *gc, struct yahoo_packet *pkt); - -void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img); -void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d); -void yahoo_buddy_icon_upload_data_free(struct yahoo_buddy_icon_upload_data *d); - -#endif /* _YAHOO_PICTURE_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_profile.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_profile.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_profile.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/yahoo_profile.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1288 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#define PHOTO_SUPPORT 1 - -#include "internal.h" -#include "debug.h" -#include "notify.h" -#include "util.h" -#if PHOTO_SUPPORT -#include "imgstore.h" -#endif /* PHOTO_SUPPORT */ - -#include "libymsg.h" -#include "yahoo_friend.h" - -typedef struct { - PurpleConnection *gc; - char *name; -} YahooGetInfoData; - -typedef enum profile_lang_id { - XX, DA, DE, EL, - EN, EN_GB, - ES_AR, ES_ES, ES_MX, ES_US, - FR_CA, FR_FR, - IT, JA, KO, NO, PT, SV, - ZH_CN, ZH_HK, ZH_TW, ZH_US, PT_BR -} profile_lang_id_t; - -typedef struct profile_lang_node { - profile_lang_id_t lang; - char *last_updated_string; - char *det; -} profile_lang_node_t; - -typedef struct profile_strings_node { - profile_lang_id_t lang; - char *lang_string; /* Only to make debugging output saner */ - char *charset; - char *yahoo_id_string; - char *private_string; - char *no_answer_string; - char *my_email_string; - char *realname_string; - char *location_string; - char *age_string; - char *maritalstatus_string; - char *gender_string; - char *occupation_string; - char *hobbies_string; - char *latest_news_string; - char *favorite_quote_string; - char *links_string; - char *no_home_page_specified_string; - char *home_page_string; - char *no_cool_link_specified_string; - char *cool_link_1_string; - char *cool_link_2_string; - char *cool_link_3_string; - char *dummy; -} profile_strings_node_t; - -typedef enum profile_state { - PROFILE_STATE_DEFAULT, - PROFILE_STATE_NOT_FOUND, - PROFILE_STATE_UNKNOWN_LANGUAGE -} profile_state_t; - -typedef struct { - YahooGetInfoData *info_data; - PurpleNotifyUserInfo *user_info; - char *url_buffer; - char *photo_url_text; - char *profile_url_text; - const profile_strings_node_t *strings; - const char *last_updated_string; - const char *title; - profile_state_t profile_state; -} YahooGetInfoStepTwoData; - -/* Strings to determine the profile "language" (more accurately "locale"). - * Strings in this list must be in the original charset in the profile. - * The "Last Updated" string is used, but sometimes is not sufficient to - * distinguish 2 locales with this (e.g., ES_ES from ES_US, or FR_CA from - * FR_FR, or EL from EN_GB), in which case a second string is added and - * such special cases must be placed before the more general case. - */ -static const profile_lang_node_t profile_langs[] = { - { DA, "Opdateret sidste gang ", NULL }, - { DE, "Letzter Update ", NULL }, - { EL, "Last Updated:", "http://gr.profiles.yahoo.com" }, - { EN_GB, "Last Update ", "Favourite Quote" }, - { EN, "Last Update:", NULL }, - { EN, "Last Update ", NULL }, - { ES_AR, "\332ltima actualizaci\363n ", NULL }, - { ES_ES, "Actualizada el ", "http://es.profiles.yahoo.com" }, - { ES_MX, "Actualizada el  ", "http://mx.profiles.yahoo.com" }, - { ES_US, "Actualizada el  ", NULL }, - { FR_CA, "Derni\xe8re mise \xe0 jour", "http://cf.profiles.yahoo.com" }, - { FR_FR, "Derni\xe8re mise \xe0 jour", NULL }, - { IT, "Ultimo aggiornamento:", NULL }, - { JA, "\xba\xc7\xbd\xaa\xb9\xb9\xbf\xb7\xc6\xfc\xa1\xa7", NULL }, - { KO, "\xb0\xbb\xbd\xc5\x20\xb3\xaf\xc2\xa5 ", NULL }, - { NO, "Sist oppdatert ", NULL }, - { PT, "\332ltima atualiza\347\343o ", NULL }, - { PT_BR, "\332ltima atualiza\347\343o:", NULL }, - { SV, "Senast uppdaterad ", NULL }, - { ZH_CN, "\xd7\xee\xba\xf3\xd0\xde\xb8\xc4\xc8\xd5\xc6\xda", NULL }, - { ZH_HK, "\xb3\xcc\xaa\xf1\xa7\xf3\xb7\x73\xae\xc9\xb6\xa1", NULL }, - { ZH_US, "\xb3\xcc\xab\xe1\xad\xd7\xa7\xef\xa4\xe9\xb4\xc1", "http://chinese.profiles.yahoo.com" }, - { ZH_TW, "\xb3\xcc\xab\xe1\xad\xd7\xa7\xef\xa4\xe9\xb4\xc1", NULL }, - { XX, NULL, NULL } -}; - -/* Strings in this list must be in UTF-8;  's should be specified as spaces. */ -static const profile_strings_node_t profile_strings[] = { - { DA, "da", "ISO-8859-1", - "Yahoo! ID:", - "Privat", - "Intet svar", - "Min Email", - "Rigtige navn:", - "Opholdssted:", - "Alder:", - "Ægteskabelig status:", - "Køn:", - "Erhverv:", - "Hobbyer:", - "Sidste nyt:", - "Favoritcitat", - "Links", - "Ingen hjemmeside specificeret", - "Forside:", - "Intet cool link specificeret", - "Cool link 1:", - "Cool link 2:", - "Cool link 3:", - NULL - }, - { DE, "de", "ISO-8859-1", - "Yahoo!-ID:", - "Privat", - "Keine Antwort", - "Meine E-Mail", - "Realer Name:", - "Ort:", - "Alter:", - "Familienstand:", - "Geschlecht:", - "Beruf:", - "Hobbys:", - "Neuste Nachrichten:", - "Mein Lieblingsspruch", - "Links", - "Keine Homepage angegeben", - "Homepage:", - "Keinen coolen Link angegeben", - "Cooler Link 1:", - "Cooler Link 2:", - "Cooler Link 3:", - NULL - }, - { EL, "el", "ISO-8859-7", /* EL is identical to EN, except no_answer_string */ - "Yahoo! ID:", - "Private", - "Καμία απάντηση", - "My Email", - "Real Name:", - "Location:", - "Age:", - "Marital Status:", - "Gender:", - "Occupation:", - "Hobbies:", - "Latest News", - "Favorite Quote", - "Links", - "No home page specified", - "Home Page:", - "No cool link specified", - "Cool Link 1:", - "Cool Link 2:", - "Cool Link 3:", - NULL - }, - { EN, "en", "ISO-8859-1", - "Yahoo! ID:", - "Private", - "No Answer", - "My Email:", - "Real Name:", - "Location:", - "Age:", - "Marital Status:", - "Sex:", - "Occupation:", - "Hobbies", - "Latest News", - "Favorite Quote", - "Links", - "No home page specified", - "Home Page:", - "No cool link specified", - "Cool Link 1", - "Cool Link 2", - "Cool Link 3", - NULL - }, - { EN_GB, "en_GB", "ISO-8859-1", /* Same as EN except spelling of "Favourite" */ - "Yahoo! ID:", - "Private", - "No Answer", - "My Email:", - "Real Name:", - "Location:", - "Age:", - "Marital Status:", - "Sex:", - "Occupation:", - "Hobbies", - "Latest News", - "Favourite Quote", - "Links", - "No home page specified", - "Home Page:", - "No cool link specified", - "Cool Link 1", - "Cool Link 2", - "Cool Link 3", - NULL - }, - { ES_AR, "es_AR", "ISO-8859-1", - "Usuario de Yahoo!:", - "Privado", - "No introdujiste una respuesta", - "Mi dirección de correo electrónico", - "Nombre real:", - "Ubicación:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Pasatiempos:", - "Últimas noticias:", - "Tu cita favorita", - "Enlaces", - "Ninguna página de inicio especificada", - "Página de inicio:", - "Ningún enlace preferido", - "Enlace genial 1:", - "Enlace genial 2:", - "Enlace genial 3:", - NULL - }, - { ES_ES, "es_ES", "ISO-8859-1", - "ID de Yahoo!:", - "Privado", - "Sin respuesta", - "Mi correo-e", - "Nombre verdadero:", - "Lugar:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Aficiones:", - "Ultimas Noticias:", - "Tu cita Favorita", - "Enlace", - "Ninguna página personal especificada", - "Página de Inicio:", - "Ningún enlace preferido", - "Enlaces Preferidos 1:", - "Enlaces Preferidos 2:", - "Enlaces Preferidos 3:", - NULL - }, - { ES_MX, "es_MX", "ISO-8859-1", - "ID de Yahoo!:", - "Privado", - "Sin responder", - "Mi Dirección de correo-e", - "Nombre real:", - "Ubicación:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Pasatiempos:", - "Ultimas Noticias:", - "Su cita favorita", - "Enlaces", - "Ninguna Página predefinida", - "Página web:", - "Ningún Enlace preferido", - "Enlaces Preferidos 1:", - "Enlaces Preferidos 2:", - "Enlaces Preferidos 3:", - NULL - }, - { ES_US, "es_US", "ISO-8859-1", - "ID de Yahoo!:", - "Privado", - "No introdujo una respuesta", - "Mi Dirección de correo-e", - "Nombre real:", - "Localidad:", - "Edad:", - "Estado civil:", - "Sexo:", - "Ocupación:", - "Pasatiempos:", - "Ultimas Noticias:", - "Su cita Favorita", - "Enlaces", - "Ninguna Página de inicio predefinida", - "Página de inicio:", - "Ningún Enlace preferido", - "Enlaces Preferidos 1:", - "Enlaces Preferidos 2:", - "Enlaces Preferidos 3:", - NULL - }, - { FR_CA, "fr_CA", "ISO-8859-1", - "Compte Yahoo!:", - "Privé", - "Sans réponse", - "Mon courriel", - "Nom réel:", - "Lieu:", - "Âge:", - "État civil:", - "Sexe:", - "Profession:", - "Passe-temps:", - "Actualités:", - "Citation préférée", - "Liens", - "Pas de mention d'une page personnelle", - "Page personnelle:", - "Pas de mention d'un lien favori", - "Lien préféré 1:", - "Lien préféré 2:", - "Lien préféré 3:", - NULL - }, - { FR_FR, "fr_FR", "ISO-8859-1", - "Compte Yahoo!:", - "Privé", - "Sans réponse", - "Mon E-mail", - "Nom réel:", - "Lieu:", - "Âge:", - "Situation de famille:", - "Sexe:", - "Profession:", - "Centres d'intérêts:", - "Actualités:", - "Citation préférée", - "Liens", - "Pas de mention d'une page perso", - "Page perso:", - "Pas de mention d'un lien favori", - "Lien préféré 1:", - "Lien préféré 2:", - "Lien préféré 3:", - NULL - }, - { IT, "it", "ISO-8859-1", - "Yahoo! ID:", - "Non pubblica", - "Nessuna risposta", - "La mia e-mail:", - "Nome vero:", - "Località:", - "Età:", - "Stato civile:", - "Sesso:", - "Occupazione:", - "Hobby", - "Ultime notizie", - "Citazione preferita", - "Link", - "Nessuna home page specificata", - "Inizio:", - "Nessun link specificato", - "Cool Link 1", - "Cool Link 2", - "Cool Link 3", - NULL - }, - { JA, "ja", "EUC-JP", - "Yahoo! JAPAN ID:", - "非公開", - "無回答", - "メール:", - "名前:", - "住所:", - "年齢:", - "未婚/既婚:", - "性別:", - "職業:", - "趣味:", - "最近の出来事:", - NULL, -#if 0 - "おすすめサイト", -#else - "自己PR", /* "Self description" comes before "Links" for yahoo.co.jp */ -#endif - NULL, - NULL, - NULL, - "おすすめサイト1:", - "おすすめサイト2:", - "おすすめサイト3:", - NULL - }, - { KO, "ko", "EUC-KR", - "야후! ID:", - "비공개", - "비공개", - "My Email", - "실명:", - "거주지:", - "나이:", - "결혼 여부:", - "성별:", - "직업:", - "취미:", - "자기 소개:", - "좋아하는 명언", - "링크", - "홈페이지를 지정하지 않았습니다.", - "홈페이지:", - "추천 사이트가 없습니다.", - "추천 사이트 1:", - "추천 사이트 2:", - "추천 사이트 3:", - NULL - }, - { NO, "no", "ISO-8859-1", - "Yahoo! ID:", - "Privat", - "Ikke noe svar", - "Min e-post", - "Virkelig navn:", - "Sted:", - "Alder:", - "Sivilstatus:", - "Kjønn:", - "Yrke:", - "Hobbyer:", - "Siste nytt:", - "Yndlingssitat", - "Lenker", - "Ingen hjemmeside angitt", - "Hjemmeside:", - "No cool link specified", - "Bra lenke 1:", - "Bra lenke 2:", - "Bra lenke 3:", - NULL - }, - { PT, "pt", "ISO-8859-1", - "ID Yahoo!:", - "Particular", - "Sem resposta", - "Meu e-mail", - "Nome verdadeiro:", - "Local:", - "Idade:", - "Estado civil:", - "Sexo:", - "Ocupação:", - "Hobbies:", - "Últimas notícias:", - "Frase favorita", - "Links", - "Nenhuma página pessoal especificada", - "Página pessoal:", - "Nenhum site legal especificado", - "Site legal 1:", - "Site legal 2:", - "Site legal 3:", - NULL - }, - { PT_BR, "pt_br", "ISO-8859-1", - "ID Yahoo!:", - "Particular", - "Sem resposta", - "Meu e-mail", - "Nome verdadeiro:", - "Localização:", - "Idade:", - "Estado civil:", - "Sexo:", - "Ocupação:", - "Pasatiempos:", - "Últimas novidades:", - "Frase preferida:", - "Links", - "Nenhuma home page especificada", - "Página Web:", - "Nenhum site legal especificado", - "Link legal 1", - "Link legal 2", - "Link legal 3", - NULL - }, - { SV, "sv", "ISO-8859-1", - "Yahoo!-ID:", - "Privat", - "Inget svar", - "Min mail", - "Riktigt namn:", - "Plats:", - "Ålder:", - "Civilstånd:", - "Kön:", - "Yrke:", - "Hobby:", - "Senaste nytt:", - "Favoritcitat", - "Länkar", - "Ingen hemsida specificerad", - "Hemsida:", - "Ingen cool länk specificerad", - "Coola länkar 1:", - "Coola länkar 2:", - "Coola länkar 3:", - NULL - }, - { ZH_CN, "zh_CN", "GB2312", - "Yahoo! ID:", - "没有提供", - "没有回答", - "个人电邮地址", - "真实姓名:", - "所在地点:", - "年龄:", - "婚姻状况:", - "性别:", - "职业:", - "业余爱好:", - "个人近况:", - "喜欢的引言", - "链接", - "没有个人主页", - "个人主页:", - "没有推荐网站链接", - "推荐网站链接 1:", - "推荐网站链接 2:", - "推荐网站链接 3:", - NULL - }, - { ZH_HK, "zh_HK", "Big5", - "Yahoo! ID:", - "私人的", - "沒有回答", - "電子信箱", - "真實姓名:", - "地點:", - "年齡:", - "婚姻狀況:", - "性別:", - "職業:", - "嗜好:", - "最新消息:", - "最喜愛的股票叫價", /* [sic] Yahoo!'s translators don't check context */ - "連結", - "沒有注明個人網頁", /* [sic] */ - "個人網頁:", - "沒有注明 Cool 連結", /* [sic] */ - "Cool 連結 1:", /* TODO */ - "Cool 連結 2:", /* TODO */ - "Cool 連結 3:", /* TODO */ - NULL - }, - { ZH_TW, "zh_TW", "Big5", - "帳 號:", - "沒有提供", - "沒有回應", - "電子信箱", - "姓名:", - "地點:", - "年齡:", - "婚姻狀態:", - "性別:", - "職業:", - "興趣:", - "個人近況:", - "喜歡的名句", - "連結", - "沒有個人網頁", - "個人網頁:", - "沒有推薦網站連結", - "推薦網站連結 1:", - "推薦網站連結 2:", - "推薦網站連結 3:", - NULL - }, - { ZH_US, "zh_US", "Big5", /* ZH_US is like ZH_TW, but also a bit like ZH_HK */ - "Yahoo! ID:", - "沒有提供", - "沒有回答", - "個人Email地址", - "真實姓名:", - "地點:", - "年齡:", - "婚姻狀態:", - "性別:", - "職業:", - "嗜好:", - "個人近況:", - "喜歡的名句", - "連結", - "沒有個人網頁", - "個人網頁:", - "沒有推薦網站連結", - "推薦網站連結 1:", /* TODO */ - "推薦網站連結 2:", /* TODO */ - "推薦網站連結 3:", /* TODO */ - NULL - }, - { XX, NULL, NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL - }, -}; - -static char *yahoo_info_date_reformat(const char *field, size_t len) -{ - char *tmp = g_strndup(field, len); - time_t t = purple_str_to_time(tmp, FALSE, NULL, NULL, NULL); - - g_free(tmp); - return g_strdup(purple_date_format_short(localtime(&t))); -} - -static char *yahoo_remove_nonbreaking_spaces(char *str) -{ - char *p; - while ((p = strstr(str, " ")) != NULL) { - *p = ' '; /* Turn  's into ordinary blanks */ - p += 1; - memmove(p, p + 5, strlen(p + 5)); - str[strlen(str) - 5] = '\0'; - } - return str; -} - -static void yahoo_extract_user_info_text(PurpleNotifyUserInfo *user_info, YahooGetInfoData *info_data) { - PurpleBuddy *b; - YahooFriend *f; - - b = purple_find_buddy(purple_connection_get_account(info_data->gc), - info_data->name); - - if (b) { - const char *balias = purple_buddy_get_local_buddy_alias(b); - if(balias && balias[0]) { - char *aliastext = g_markup_escape_text(balias, -1); - purple_notify_user_info_add_pair(user_info, _("Alias"), aliastext); - g_free(aliastext); - } - #if 0 - if (b->idle > 0) { - char *idletime = purple_str_seconds_to_string(time(NULL) - b->idle); - purple_notify_user_info_add_pair(user_info, _("Idle"), idletime); - g_free(idletime); - } - #endif - - /* Add the normal tooltip pairs */ - yahoo_tooltip_text(b, user_info, TRUE); - - if ((f = yahoo_friend_find(info_data->gc, purple_buddy_get_name(b)))) { - const char *ip; - if ((ip = yahoo_friend_get_ip(f))) - purple_notify_user_info_add_pair(user_info, _("IP Address"), ip); - } - } -} - -#if PHOTO_SUPPORT - -static char *yahoo_get_photo_url(const char *url_text, const char *name) { - GString *s = g_string_sized_new(strlen(name) + 8); - char *p; - char *it = NULL; - - /*g_string_printf(s, " alt=\"%s\">", name);*/ - /* Y! newformat */ - g_string_printf(s, " alt=%s>", name); - p = strstr(url_text, s->str); - - if (p) { - /* Search backwards for "http://". This is stupid, but it works. */ - for (; !it && p > url_text; p -= 1) { - /*if (strncmp(p, "\"http://", 8) == 0) {*/ - /* Y! newformat*/ - if (strncmp(p, "=http://", 8) == 0) { - char *q; - p += 1; /* skip only the ' ' */ - q = strchr(p, ' '); - if (q) { - g_free(it); - it = g_strndup(p, q - p); - } - } - } - } - - g_string_free(s, TRUE); - return it; -} - -static void -yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message); - -#endif /* PHOTO_SUPPORT */ - -static void yahoo_got_info(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - YahooGetInfoData *info_data = (YahooGetInfoData *)user_data; - PurpleNotifyUserInfo *user_info; - char *p; -#if PHOTO_SUPPORT - YahooGetInfoStepTwoData *info2_data; - char *photo_url_text = NULL; -#else - gboolean found = FALSE; - char *stripped; - int stripped_len; - char *last_updated_utf8_string = NULL; -#endif /* !PHOTO_SUPPORT */ - const char *last_updated_string = NULL; - char *url_buffer; - GString *s; - char *tmp; - char *profile_url_text = NULL; - int lang, strid; - YahooData *yd; - const profile_strings_node_t *strings = NULL; - const char *title; - profile_state_t profile_state = PROFILE_STATE_DEFAULT; - - purple_debug_info("yahoo", "In yahoo_got_info\n"); - - yd = info_data->gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - user_info = purple_notify_user_info_new(); - - title = yd->jp ? _("Yahoo! Japan Profile") : - _("Yahoo! Profile"); - - /* Get the tooltip info string */ - yahoo_extract_user_info_text(user_info, info_data); - - /* We failed to grab the profile URL. This is not expected to actually - * happen except under unusual error conditions, as Yahoo is observed - * to send back HTML, with a 200 status code. - */ - if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) { - purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), NULL); - purple_notify_userinfo(info_data->gc, info_data->name, - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - g_free(profile_url_text); - g_free(info_data->name); - g_free(info_data); - return; - } - - /* Construct the correct profile URL */ - s = g_string_sized_new(80); /* wild guess */ - g_string_printf(s, "%s%s", (yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), - info_data->name); - profile_url_text = g_string_free(s, FALSE); - s = NULL; - - /* We don't yet support the multiple link level of the warning page for - * 'adult' profiles, not to mention the fact that yahoo wants you to be - * logged in (on the website) to be able to view an 'adult' profile. For - * now, just tell them that we can't help them, and provide a link to the - * profile if they want to do the web browser thing. - */ - p = strstr(url_text, "Adult Profiles Warning Message"); - if (!p) { - p = strstr(url_text, "Adult Content Warning"); /* TITLE element */ - } - if (p) { - tmp = g_strdup_printf("%s

" - "%s
%s", - _("Sorry, profiles marked as containing adult content " - "are not supported at this time."), - _("If you wish to view this profile, " - "you will need to visit this link in your web browser:"), - profile_url_text, profile_url_text); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - purple_notify_userinfo(info_data->gc, info_data->name, - user_info, NULL, NULL); - - g_free(profile_url_text); - purple_notify_user_info_destroy(user_info); - g_free(info_data->name); - g_free(info_data); - return; - } - - /* Check whether the profile is written in a supported language */ - for (lang = 0;; lang += 1) { - last_updated_string = profile_langs[lang].last_updated_string; - if (!last_updated_string) - break; - - p = strstr(url_text, last_updated_string); - - if (p) { - if (profile_langs[lang].det && !strstr(url_text, profile_langs[lang].det)) - p = NULL; - else - break; - } - } - - if (p) { - for (strid = 0; profile_strings[strid].lang != XX; strid += 1) { - if (profile_strings[strid].lang == profile_langs[lang].lang) break; - } - strings = profile_strings + strid; - purple_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang); - } - - /* Every user may choose his/her own profile language, and this language - * has nothing to do with the preferences of the user which looks at the - * profile. We try to support all languages, but nothing is guaranteed. - * If we cannot determine the language, it means either (1) the profile - * is written in an unsupported language, (2) our language support is - * out of date, or (3) the user is not found, or (4) Y! have changed their - * webpage layout - */ - if (!p || strings->lang == XX) { - if (!strstr(url_text, "Yahoo! Member Directory - User not found") - && !strstr(url_text, "was not found on this server.") - && !strstr(url_text, "\xb8\xf8\xb3\xab\xa5\xd7\xa5\xed\xa5\xd5\xa5\xa3\xa1\xbc\xa5\xeb\xa4\xac\xb8\xab\xa4\xc4\xa4\xab\xa4\xea\xa4\xde\xa4\xbb\xa4\xf3")) { - profile_state = PROFILE_STATE_UNKNOWN_LANGUAGE; - } else { - profile_state = PROFILE_STATE_NOT_FOUND; - } - } - -#if PHOTO_SUPPORT - photo_url_text = yahoo_get_photo_url(url_text, info_data->name); -#endif /* PHOTO_SUPPORT */ - - url_buffer = g_strdup(url_text); - - /* - * purple_markup_strip_html() doesn't strip out character entities like   - * and · - */ - yahoo_remove_nonbreaking_spaces(url_buffer); -#if 1 - while ((p = strstr(url_buffer, "·")) != NULL) { - memmove(p, p + 6, strlen(p + 6)); - url_buffer[strlen(url_buffer) - 6] = '\0'; - } -#endif - - /* nuke the nasty \r's */ - purple_str_strip_char(url_buffer, '\r'); - -#if PHOTO_SUPPORT - /* Marshall the existing state */ - info2_data = g_malloc(sizeof(YahooGetInfoStepTwoData)); - info2_data->info_data = info_data; - info2_data->url_buffer = url_buffer; - info2_data->photo_url_text = photo_url_text; - info2_data->profile_url_text = profile_url_text; - info2_data->strings = strings; - info2_data->last_updated_string = last_updated_string; - info2_data->title = title; - info2_data->profile_state = profile_state; - info2_data->user_info = user_info; - - /* Try to put the photo in there too, if there's one */ - if (photo_url_text) { - PurpleUtilFetchUrlData *url_data; - /* use whole URL if using HTTP Proxy */ - gboolean use_whole_url = yahoo_account_use_http_proxy(info_data->gc); - - /* User-uploaded photos use a different server that requires the Host - * header, but Yahoo Japan will use the "chunked" content encoding if - * we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url - */ - url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL, - FALSE, yahoo_got_photo, info2_data); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - } else { - /* Emulate a callback */ - yahoo_got_photo(NULL, info2_data, NULL, 0, NULL); - } -} - -static void -yahoo_got_photo(PurpleUtilFetchUrlData *url_data, gpointer data, - const gchar *url_text, size_t len, const gchar *error_message) -{ - YahooGetInfoStepTwoData *info2_data = (YahooGetInfoStepTwoData *)data; - YahooData *yd; - gboolean found = FALSE; - int id = -1; - - /* Temporary variables */ - char *p = NULL; - char *stripped; - int stripped_len; - char *last_updated_utf8_string = NULL; - char *tmp; - - /* Unmarshall the saved state */ - YahooGetInfoData *info_data = info2_data->info_data; - char *url_buffer = info2_data->url_buffer; - PurpleNotifyUserInfo *user_info = info2_data->user_info; - char *photo_url_text = info2_data->photo_url_text; - char *profile_url_text = info2_data->profile_url_text; - const profile_strings_node_t *strings = info2_data->strings; - const char *last_updated_string = info2_data->last_updated_string; - profile_state_t profile_state = info2_data->profile_state; - - /* We continue here from yahoo_got_info, as if nothing has happened */ -#endif /* PHOTO_SUPPORT */ - - /* Jun 29 05 Bleeter: Y! changed their profile pages. Terminators now seem to be */ - /* and not \n. The prpl's need to be audited before it can be moved */ - /* in to purple_markup_strip_html*/ - char *fudged_buffer; - - yd = info_data->gc->proto_data; - yd->url_datas = g_slist_remove(yd->url_datas, url_data); - - fudged_buffer = purple_strcasereplace(url_buffer, "", "
"); - /* nuke the html, it's easier than trying to parse the horrid stuff */ - stripped = purple_markup_strip_html(fudged_buffer); - stripped_len = strlen(stripped); - - purple_debug_misc("yahoo", "stripped = %p\n", stripped); - purple_debug_misc("yahoo", "url_buffer = %p\n", url_buffer); - - /* convert to utf8 */ - if (strings && strings->charset) { - p = g_convert(stripped, -1, "utf-8", strings->charset, - NULL, NULL, NULL); - if (!p) { - p = g_locale_to_utf8(stripped, -1, NULL, NULL, NULL); - if (!p) { - p = g_convert(stripped, -1, "utf-8", "windows-1252", - NULL, NULL, NULL); - } - } - if (p) { - g_free(stripped); - stripped = purple_utf8_ncr_decode(p); - stripped_len = strlen(stripped); - g_free(p); - } - } - p = NULL; - - /* "Last updated" should also be converted to utf8 and with   killed */ - if (strings && strings->charset) { - last_updated_utf8_string = g_convert(last_updated_string, -1, "utf-8", - strings->charset, NULL, NULL, NULL); - yahoo_remove_nonbreaking_spaces(last_updated_utf8_string); - - purple_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped); - } - - if (profile_state == PROFILE_STATE_DEFAULT) { -#if 0 - /* extract their Yahoo! ID and put it in. Don't bother marking has_info as - * true, since the Yahoo! ID will always be there */ - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->yahoo_id_string, (yd->jp ? 2 : 10), "\n", 0, - NULL, _("Yahoo! ID"), 0, NULL, NULL)) - ; -#endif - -#if PHOTO_SUPPORT - /* Try to put the photo in there too, if there's one and is readable */ - if (data && url_text && len != 0) { - if (strstr(url_text, "400 Bad Request") - || strstr(url_text, "403 Forbidden") - || strstr(url_text, "404 Not Found")) { - - purple_debug_info("yahoo", "Error getting %s: %s\n", - photo_url_text, url_text); - } else { - purple_debug_info("yahoo", "%s is %" G_GSIZE_FORMAT - " bytes\n", photo_url_text, len); - id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL); - - tmp = g_strdup_printf("
", id); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - } - } -#endif /* PHOTO_SUPPORT */ - - /* extract their Email address and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->my_email_string, (yd->jp ? 4 : 1), " ", 0, - strings->private_string, _("Email"), 0, NULL, NULL); - - /* extract the Nickname if it exists */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - "Nickname:", 1, "\n", '\n', - NULL, _("Nickname"), 0, NULL, NULL); - - /* extract their RealName and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->realname_string, (yd->jp ? 3 : 1), "\n", '\n', - NULL, _("Real Name"), 0, NULL, NULL); - - /* extract their Location and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->location_string, (yd->jp ? 4 : 2), "\n", '\n', - NULL, _("Location"), 0, NULL, NULL); - - /* extract their Age and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->age_string, (yd->jp ? 2 : 3), "\n", '\n', - NULL, _("Age"), 0, NULL, NULL); - - /* extract their MaritalStatus and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->maritalstatus_string, (yd->jp ? 2 : 3), "\n", '\n', - strings->no_answer_string, _("Marital Status"), 0, NULL, NULL); - - /* extract their Gender and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->gender_string, (yd->jp ? 2 : 3), "\n", '\n', - strings->no_answer_string, _("Gender"), 0, NULL, NULL); - - /* extract their Occupation and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->occupation_string, 2, "\n", '\n', - NULL, _("Occupation"), 0, NULL, NULL); - - /* Hobbies, Latest News, and Favorite Quote are a bit different, since - * the values can contain embedded newlines... but any or all of them - * can also not appear. The way we delimit them is to successively - * look for the next one that _could_ appear, and if all else fails, - * we end the section by looking for the 'Links' heading, which is the - * next thing to follow this bunch. (For Yahoo Japan, we check for - * the "Description" ("Self PR") heading instead of "Links".) - */ - - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->hobbies_string, (yd->jp ? 3 : 1), strings->latest_news_string, - '\n', "\n", _("Hobbies"), 0, NULL, NULL)) - { - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->hobbies_string, 1, strings->favorite_quote_string, - '\n', "\n", _("Hobbies"), 0, NULL, NULL)) - { - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->hobbies_string, 1, strings->links_string, - '\n', "\n", _("Hobbies"), 0, NULL, NULL); - } - else - found = TRUE; - } - else - found = TRUE; - - if (!purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->latest_news_string, 1, strings->favorite_quote_string, - '\n', "\n", _("Latest News"), 0, NULL, NULL)) - { - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->latest_news_string, (yd->jp ? 2 : 1), strings->links_string, - '\n', "\n", _("Latest News"), 0, NULL, NULL); - } - else - found = TRUE; - - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->favorite_quote_string, 1, strings->links_string, - '\n', "\n", _("Favorite Quote"), 0, NULL, NULL); - - /* Home Page will either be "No home page specified", - * or "Home Page: " and a link. - * For Yahoo! Japan, if there is no home page specified, - * neither "No home page specified" nor "Home Page:" is shown. - */ - if (strings->home_page_string) { - p = !strings->no_home_page_specified_string? NULL: - strstr(stripped, strings->no_home_page_specified_string); - if(!p) - { - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->home_page_string, 1, "\n", 0, NULL, - _("Home Page"), 1, NULL, NULL); - } - } - - /* Cool Link {1,2,3} is also different. If "No cool link specified" - * exists, then we have none. If we have one however, we'll need to - * check and see if we have a second one. If we have a second one, - * we have to check to see if we have a third one. - */ - p = !strings->no_cool_link_specified_string? NULL: - strstr(stripped,strings->no_cool_link_specified_string); - if (!p) - { - if (purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->cool_link_1_string, 1, "\n", 0, NULL, - _("Cool Link 1"), 1, NULL, NULL)) - { - found = TRUE; - if (purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->cool_link_2_string, 1, "\n", 0, NULL, - _("Cool Link 2"), 1, NULL, NULL)) - { - purple_markup_extract_info_field(stripped, stripped_len, user_info, - strings->cool_link_3_string, 1, "\n", 0, NULL, - _("Cool Link 3"), 1, NULL, NULL); - } - } - } - - if (last_updated_utf8_string != NULL) { - /* see if Member Since is there, and if so, extract it. */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - "Member Since:", 1, last_updated_utf8_string, - '\n', NULL, _("Member Since"), 0, NULL, yahoo_info_date_reformat); - - /* extract the Last Updated date and put it in */ - found |= purple_markup_extract_info_field(stripped, stripped_len, user_info, - last_updated_utf8_string, (yd->jp ? 2 : 1), (yd->jp ? "\n" : " "), (yd->jp ? 0 : '\n'), NULL, - _("Last Update"), 0, NULL, (yd->jp ? NULL : yahoo_info_date_reformat)); - } - } /* if (profile_state == PROFILE_STATE_DEFAULT) */ - - if(!found) - { - const gchar *str; - - purple_notify_user_info_add_section_break(user_info); - purple_notify_user_info_add_pair(user_info, - _("Error retrieving profile"), NULL); - - if (profile_state == PROFILE_STATE_UNKNOWN_LANGUAGE) { - str = _("This profile is in a language " - "or format that is not supported at this time."); - - } else if (profile_state == PROFILE_STATE_NOT_FOUND) { - PurpleBuddy *b = purple_find_buddy - (purple_connection_get_account(info_data->gc), - info_data->name); - YahooFriend *f = NULL; - if (b) { - /* Someone on the buddy list can be "not on server list", - * in which case the user may or may not actually exist. - * Hence this extra step. - */ - PurpleAccount *account = purple_buddy_get_account(b); - f = yahoo_friend_find(purple_account_get_connection(account), - purple_buddy_get_name(b)); - } - str = f ? _("Could not retrieve the user's profile. " - "This most likely is a temporary server-side problem. " - "Please try again later.") : - _("Could not retrieve the user's profile. " - "This most likely means that the user does not exist; " - "however, Yahoo! sometimes does fail to find a user's " - "profile. If you know that the user exists, " - "please try again later."); - } else { - str = _("The user's profile is empty."); - } - - purple_notify_user_info_add_pair(user_info, NULL, str); - } - - /* put a link to the actual profile URL */ - purple_notify_user_info_add_section_break(user_info); - tmp = g_strdup_printf("%s", - profile_url_text, _("View web profile")); - purple_notify_user_info_add_pair(user_info, NULL, tmp); - g_free(tmp); - - g_free(stripped); - - /* show it to the user */ - purple_notify_userinfo(info_data->gc, info_data->name, - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - - g_free(last_updated_utf8_string); - g_free(url_buffer); - g_free(fudged_buffer); - g_free(profile_url_text); - g_free(info_data->name); - g_free(info_data); - -#if PHOTO_SUPPORT - g_free(photo_url_text); - g_free(info2_data); - if (id != -1) - purple_imgstore_unref_by_id(id); -#endif /* PHOTO_SUPPORT */ -} - -void yahoo_get_info(PurpleConnection *gc, const char *name) -{ - YahooData *yd = gc->proto_data; - YahooGetInfoData *data; - char *url; - PurpleUtilFetchUrlData *url_data; - - data = g_new0(YahooGetInfoData, 1); - data->gc = gc; - data->name = g_strdup(name); - - url = g_strdup_printf("%s%s", - (yd->jp ? YAHOOJP_PROFILE_URL : YAHOO_PROFILE_URL), name); - - url_data = purple_util_fetch_url(url, TRUE, NULL, FALSE, yahoo_got_info, data); - if (url_data != NULL) - yd->url_datas = g_slist_prepend(yd->url_datas, url_data); - else { - g_free(data->name); - g_free(data); - } - - g_free(url); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,658 +0,0 @@ -/** - * @file ycht.c The Yahoo! protocol plugin, YCHT protocol stuff. - * - * purple - * - * Copyright (C) 2004 Timothy Ringenbach - * Liberal amounts of code borrowed from the rest of the Yahoo! prpl. - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "prpl.h" -#include "notify.h" -#include "account.h" -#include "proxy.h" -#include "debug.h" -#include "conversation.h" -#include "util.h" - -#include "libymsg.h" -#include "yahoo_packet.h" -#include "ycht.h" -#include "yahoochat.h" - -/* - * dword: YCHT - * dword: 0x000000AE - * dword: service - * word: status - * word: size - */ -#define YAHOO_CHAT_ID (1) -/************************************************************************************ - * Functions to process various kinds of packets. - ************************************************************************************/ -static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt) -{ - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - - if (ycht->logged_in) - return; - - yd->chat_online = TRUE; - ycht->logged_in = TRUE; - - if (ycht->room) - ycht_chat_join(ycht, ycht->room); -} - -static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt) -{ - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - - yd->chat_online = FALSE; - ycht->logged_in = FALSE; -} - -static void ycht_process_chatjoin(YchtConn *ycht, YchtPkt *pkt) -{ - char *room, *topic; - PurpleConnection *gc = ycht->gc; - PurpleConversation *c = NULL; - gboolean new_room = FALSE; - char **members; - int i; - - room = g_list_nth_data(pkt->data, 0); - topic = g_list_nth_data(pkt->data, 1); - if (!g_list_nth_data(pkt->data, 4)) - return; - if (!room) - return; - - members = g_strsplit(g_list_nth_data(pkt->data, 4), "\001", 0); - for (i = 0; members[i]; i++) { - char *tmp = strchr(members[i], '\002'); - if (tmp) - *tmp = '\0'; - } - - if (g_list_length(pkt->data) > 5) - new_room = TRUE; - - if (new_room && ycht->changing_rooms) { - serv_got_chat_left(gc, YAHOO_CHAT_ID); - ycht->changing_rooms = FALSE; - c = serv_got_joined_chat(gc, YAHOO_CHAT_ID, room); - } else { - c = purple_find_chat(gc, YAHOO_CHAT_ID); - } - - if (topic) - purple_conv_chat_set_topic(PURPLE_CONV_CHAT(c), NULL, topic); - - for (i = 0; members[i]; i++) { - if (new_room) { - /*if (!strcmp(members[i], purple_connection_get_display_name(ycht->gc))) - continue;*/ - purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), members[i], NULL, PURPLE_CBFLAGS_NONE, TRUE); - } else { - yahoo_chat_add_user(PURPLE_CONV_CHAT(c), members[i], NULL); - } - } - - g_strfreev(members); -} - -static void ycht_process_chatpart(YchtConn *ycht, YchtPkt *pkt) -{ - char *room, *who; - - room = g_list_nth_data(pkt->data, 0); - who = g_list_nth_data(pkt->data, 1); - - if (who && room) { - PurpleConversation *c = purple_find_chat(ycht->gc, YAHOO_CHAT_ID); - if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room)) - purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL); - - } -} - -static void ycht_progress_chatmsg(YchtConn *ycht, YchtPkt *pkt) -{ - char *who, *what, *msg; - PurpleConversation *c; - PurpleConnection *gc = ycht->gc; - - who = g_list_nth_data(pkt->data, 1); - what = g_list_nth_data(pkt->data, 2); - - if (!who || !what) - return; - - c = purple_find_chat(gc, YAHOO_CHAT_ID); - if (!c) - return; - - msg = yahoo_string_decode(gc, what, 1); - what = yahoo_codes_to_html(msg); - g_free(msg); - - if (pkt->service == YCHT_SERVICE_CHATMSG_EMOTE) { - char *tmp = g_strdup_printf("/me %s", what); - g_free(what); - what = tmp; - } - - serv_got_chat_in(gc, YAHOO_CHAT_ID, who, 0, what, time(NULL)); - g_free(what); -} - -static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt) -{ -#if 0 - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - - if (ycht->logged_in) - return; - - yd->chat_online = TRUE; - ycht->logged_in = TRUE; - - if (ycht->room) - ycht_chat_join(ycht, ycht->room); -#endif -} - -/***************************************************************************** - * Functions dealing with YCHT packets and their contents directly. - *****************************************************************************/ -static void ycht_packet_dump(const guchar *data, int len) -{ -#ifdef YAHOO_YCHT_DEBUG - int i; - - purple_debug_misc("yahoo", ""); - - for (i = 0; i + 1 < len; i += 2) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - purple_debug_misc(NULL, "%02hhx%02hhx ", data[i], data[i + 1]); - } - if (i < len) - purple_debug_misc(NULL, "%02hhx", data[i]); - - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - - for (i = 0; i < len; i++) { - if ((i % 16 == 0) && i) { - purple_debug_misc(NULL, "\n"); - purple_debug_misc("yahoo", ""); - } - - if (g_ascii_isprint(data[i])) - purple_debug_misc(NULL, "%c ", data[i]); - else - purple_debug_misc(NULL, ". "); - } - - purple_debug_misc(NULL, "\n"); -#endif /* YAHOO_YCHT_DEBUG */ -} - -static YchtPkt *ycht_packet_new(guint version, guint service, int status) -{ - YchtPkt *ret; - - ret = g_new0(YchtPkt, 1); - - ret->version = version; - ret->service = service; - ret->status = status; - - return ret; -} - -static void ycht_packet_append(YchtPkt *pkt, const char *str) -{ - g_return_if_fail(pkt != NULL); - g_return_if_fail(str != NULL); - - pkt->data = g_list_append(pkt->data, g_strdup(str)); -} - -static int ycht_packet_length(YchtPkt *pkt) -{ - int ret; - GList *l; - - ret = YCHT_HEADER_LEN; - - for (l = pkt->data; l; l = l->next) { - ret += strlen(l->data); - if (l->next) - ret += strlen(YCHT_SEP); - } - - return ret; -} - -static void ycht_packet_send_write_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - YchtConn *ycht = data; - int ret, writelen; - - writelen = purple_circ_buffer_get_max_read(ycht->txbuf); - - if (writelen == 0) { - purple_input_remove(ycht->tx_handler); - ycht->tx_handler = 0; - return; - } - - ret = write(ycht->fd, ycht->txbuf->outptr, writelen); - - if (ret < 0 && errno == EAGAIN) - return; - else if (ret <= 0) { - /* TODO: error handling */ -/* - gchar *tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - purple_connection_error_reason(purple_account_get_connection(irc->account), - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); - g_free(tmp); -*/ - return; - } - - purple_circ_buffer_mark_read(ycht->txbuf, ret); - -} - -static void ycht_packet_send(YchtConn *ycht, YchtPkt *pkt) -{ - int len, pos, written; - char *buf; - GList *l; - - g_return_if_fail(ycht != NULL); - g_return_if_fail(pkt != NULL); - g_return_if_fail(ycht->fd != -1); - - pos = 0; - len = ycht_packet_length(pkt); - buf = g_malloc(len); - - memcpy(buf + pos, "YCHT", 4); pos += 4; - pos += yahoo_put32(buf + pos, pkt->version); - pos += yahoo_put32(buf + pos, pkt->service); - pos += yahoo_put16(buf + pos, pkt->status); - pos += yahoo_put16(buf + pos, len - YCHT_HEADER_LEN); - - for (l = pkt->data; l; l = l->next) { - int slen = strlen(l->data); - memcpy(buf + pos, l->data, slen); pos += slen; - - if (l->next) { - memcpy(buf + pos, YCHT_SEP, strlen(YCHT_SEP)); - pos += strlen(YCHT_SEP); - } - } - - if (!ycht->tx_handler) - written = write(ycht->fd, buf, len); - else { - written = -1; - errno = EAGAIN; - } - - if (written < 0 && errno == EAGAIN) - written = 0; - else if (written <= 0) { - /* TODO: Error handling (was none before NBIO changes) */ - written = 0; - } - - if (written < len) { - if (!ycht->tx_handler) - ycht->tx_handler = purple_input_add(ycht->fd, - PURPLE_INPUT_WRITE, ycht_packet_send_write_cb, - ycht); - purple_circ_buffer_append(ycht->txbuf, buf + written, - len - written); - } - - g_free(buf); -} - -static void ycht_packet_read(YchtPkt *pkt, const char *buf, int len) -{ - const char *pos = buf; - const char *needle; - char *tmp, *tmp2; - int i = 0; - - while (len > 0 && (needle = g_strstr_len(pos, len, YCHT_SEP))) { - tmp = g_strndup(pos, needle - pos); - pkt->data = g_list_append(pkt->data, tmp); - len -= needle - pos + strlen(YCHT_SEP); - pos = needle + strlen(YCHT_SEP); - tmp2 = g_strescape(tmp, NULL); - purple_debug_misc("yahoo", "Data[%d]:\t%s\n", i++, tmp2); - g_free(tmp2); - } - - if (len) { - tmp = g_strndup(pos, len); - pkt->data = g_list_append(pkt->data, tmp); - tmp2 = g_strescape(tmp, NULL); - purple_debug_misc("yahoo", "Data[%d]:\t%s\n", i, tmp2); - g_free(tmp2); - }; - - purple_debug_misc("yahoo", "--==End of incoming YCHT packet==--\n"); -} - -static void ycht_packet_process(YchtConn *ycht, YchtPkt *pkt) -{ - if (pkt->data && !strncmp(pkt->data->data, "*** Danger Will Robinson!!!", strlen("*** Danger Will Robinson!!!"))) - return; - - switch (pkt->service) { - case YCHT_SERVICE_LOGIN: - ycht_process_login(ycht, pkt); - break; - case YCHT_SERVICE_LOGOUT: - ycht_process_logout(ycht, pkt); - break; - case YCHT_SERVICE_CHATJOIN: - ycht_process_chatjoin(ycht, pkt); - break; - case YCHT_SERVICE_CHATPART: - ycht_process_chatpart(ycht, pkt); - break; - case YCHT_SERVICE_CHATMSG: - case YCHT_SERVICE_CHATMSG_EMOTE: - ycht_progress_chatmsg(ycht, pkt); - break; - case YCHT_SERVICE_ONLINE_FRIENDS: - ycht_progress_online_friends(ycht, pkt); - break; - default: - purple_debug_warning("yahoo", "YCHT: warning, unhandled service 0x%02x\n", pkt->service); - } -} - -static void ycht_packet_free(YchtPkt *pkt) -{ - GList *l; - - g_return_if_fail(pkt != NULL); - - for (l = pkt->data; l; l = l->next) - g_free(l->data); - g_list_free(pkt->data); - g_free(pkt); -} - -/************************************************************************************ - * Functions dealing with connecting and disconnecting and reading data into YchtPkt - * structs, and all that stuff. - ************************************************************************************/ - -void ycht_connection_close(YchtConn *ycht) -{ - YahooData *yd = ycht->gc->proto_data; - - if (yd) { - yd->ycht = NULL; - yd->chat_online = FALSE; - } - - if (ycht->fd > 0) - close(ycht->fd); - if (ycht->inpa) - purple_input_remove(ycht->inpa); - - if (ycht->tx_handler) - purple_input_remove(ycht->tx_handler); - - purple_circ_buffer_destroy(ycht->txbuf); - - g_free(ycht->rxqueue); - - g_free(ycht); -} - -static void ycht_connection_error(YchtConn *ycht, const gchar *error) -{ - - purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server"), error); - ycht_connection_close(ycht); -} - -static void ycht_pending(gpointer data, gint source, PurpleInputCondition cond) -{ - YchtConn *ycht = data; - char buf[1024]; - int len; - - len = read(ycht->fd, buf, sizeof(buf)); - - if (len < 0) { - gchar *tmp; - - if (errno == EAGAIN) - /* No worries */ - return; - - tmp = g_strdup_printf(_("Lost connection with server: %s"), - g_strerror(errno)); - ycht_connection_error(ycht, tmp); - g_free(tmp); - return; - } else if (len == 0) { - ycht_connection_error(ycht, _("Server closed the connection")); - return; - } - - ycht->rxqueue = g_realloc(ycht->rxqueue, len + ycht->rxlen); - memcpy(ycht->rxqueue + ycht->rxlen, buf, len); - ycht->rxlen += len; - - while (1) { - YchtPkt *pkt; - int pos = 0; - int pktlen; - guint service; - guint version; - gint status; - - if (ycht->rxlen < YCHT_HEADER_LEN) - return; - - if (strncmp("YCHT", (char *)ycht->rxqueue, 4) != 0) - purple_debug_error("yahoo", "YCHT: protocol error.\n"); - - pos += 4; /* YCHT */ - - version = yahoo_get32(ycht->rxqueue + pos); pos += 4; - service = yahoo_get32(ycht->rxqueue + pos); pos += 4; - status = yahoo_get16(ycht->rxqueue + pos); pos += 2; - pktlen = yahoo_get16(ycht->rxqueue + pos); pos += 2; - purple_debug_misc("yahoo", "ycht: %d bytes to read, rxlen is %d\n", - pktlen, ycht->rxlen); - - if (ycht->rxlen < (YCHT_HEADER_LEN + pktlen)) - return; - - purple_debug_misc("yahoo", "--==Incoming YCHT packet==--\n"); - purple_debug_misc("yahoo", "YCHT Service: 0x%02x Version: 0x%02x Status: 0x%02x\n", - service, version, status); - ycht_packet_dump(ycht->rxqueue, YCHT_HEADER_LEN + pktlen); - - pkt = ycht_packet_new(version, service, status); - ycht_packet_read(pkt, (char *)ycht->rxqueue + pos, pktlen); - - ycht->rxlen -= YCHT_HEADER_LEN + pktlen; - if (ycht->rxlen) { - guchar *tmp = g_memdup(ycht->rxqueue + YCHT_HEADER_LEN + pktlen, ycht->rxlen); - g_free(ycht->rxqueue); - ycht->rxqueue = tmp; - } else { - g_free(ycht->rxqueue); - ycht->rxqueue = NULL; - } - - ycht_packet_process(ycht, pkt); - - ycht_packet_free(pkt); - } -} - -static void ycht_got_connected(gpointer data, gint source, const gchar *error_message) -{ - YchtConn *ycht = data; - PurpleConnection *gc = ycht->gc; - YahooData *yd = gc->proto_data; - YchtPkt *pkt; - char *buf; - - if (source < 0) { - ycht_connection_error(ycht, _("Unable to connect")); - return; - } - - ycht->fd = source; - - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_LOGIN, 0); - - buf = g_strdup_printf("%s\001Y=%s; T=%s", purple_connection_get_display_name(gc), yd->cookie_y, yd->cookie_t); - ycht_packet_append(pkt, buf); - g_free(buf); - - ycht_packet_send(ycht, pkt); - - ycht_packet_free(pkt); - - ycht->inpa = purple_input_add(ycht->fd, PURPLE_INPUT_READ, ycht_pending, ycht); -} - -void ycht_connection_open(PurpleConnection *gc) -{ - YchtConn *ycht; - YahooData *yd = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - - ycht = g_new0(YchtConn, 1); - ycht->gc = gc; - ycht->fd = -1; - - yd->ycht = ycht; - - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "ycht-server", YAHOO_YCHT_HOST), - purple_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT), - ycht_got_connected, ycht) == NULL) - { - ycht_connection_error(ycht, _("Unable to connect")); - return; - } -} - -/******************************************************************************************* - * These are functions called because the user did something. - *******************************************************************************************/ - -void ycht_chat_join(YchtConn *ycht, const char *room) -{ - YchtPkt *pkt; - char *tmp; - - tmp = g_strdup(room); - g_free(ycht->room); - ycht->room = tmp; - - if (!ycht->logged_in) - return; - - ycht->changing_rooms = TRUE; - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATJOIN, 0); - ycht_packet_append(pkt, ycht->room); - ycht_packet_send(ycht, pkt); - ycht_packet_free(pkt); -} - -int ycht_chat_send(YchtConn *ycht, const char *room, const char *what) -{ - YchtPkt *pkt; - char *msg1, *msg2, *buf; - - if (strcmp(room, ycht->room)) - purple_debug_warning("yahoo", "uhoh, sending to the wrong room!\n"); - - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATMSG, 0); - - msg1 = yahoo_html_to_codes(what); - msg2 = yahoo_string_encode(ycht->gc, msg1, NULL); - g_free(msg1); - - buf = g_strdup_printf("%s\001%s", ycht->room, msg2); - ycht_packet_append(pkt, buf); - g_free(msg2); - g_free(buf); - - ycht_packet_send(ycht, pkt); - ycht_packet_free(pkt); - return 1; -} - -void ycht_chat_leave(YchtConn *ycht, const char *room, gboolean logout) -{ - if (logout) - ycht_connection_close(ycht); -} - -void ycht_chat_send_invite(YchtConn *ycht, const char *room, const char *buddy, const char *msg) -{ -} - -void ycht_chat_goto_user(YchtConn *ycht, const char *name) -{ -} - -void ycht_chat_send_keepalive(YchtConn *ycht) -{ - YchtPkt *pkt; - - pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_PING, 0); - ycht_packet_send(ycht, pkt); - ycht_packet_free(pkt); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/yahoo/ycht.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -/** - * @file ycht.h The Yahoo! protocol plugin, YCHT protocol stuff. - * - * purple - * - * Copyright (C) 2004 Timothy Ringenbach - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_YCHT_H_ -#define _PURPLE_YCHT_H_ - -/* #define YAHOO_YCHT_DEBUG */ - -#define YAHOO_YCHT_HOST "jcs3.chat.dcn.yahoo.com" -#define YAHOO_YCHT_PORT 8002 - -#define YCHT_VERSION (0xae) -#define YCHT_HEADER_LEN (0x10) - -typedef enum { - YCHT_SERVICE_LOGIN = 0x01, - YCHT_SERVICE_LOGOUT = 0x02, - YCHT_SERVICE_CHATJOIN = 0x11, - YCHT_SERVICE_CHATPART = 0x12, - YCHT_SERVICE_CHATMSG = 0x41, - YCHT_SERVICE_CHATMSG_EMOTE = 0x43, - YCHT_SERVICE_PING = 0x62, - YCHT_SERVICE_ONLINE_FRIENDS = 0x68 -} ycht_service; -/* -yahoo: YCHT Service: 0x11 Version: 0x100 -yahoo: Data[0]: Linux, FreeBSD, Solaris:1 -yahoo: Data[1]: Questions, problems and discussions about all flavors of Unix. -yahoo: Data[2]: -yahoo: Data[3]: 0 -yahoo: Data[4]: sgooki888\0020\002 \0022769036\00258936\002 -yahoo: --==End of incoming YCHT packet==-- - -yahoo: --==Incoming YCHT packet==-- -yahoo: YCHT Service: 0x12 Version: 0x100 -yahoo: Data[0]: Linux, FreeBSD, Solaris:1 -yahoo: Data[1]: cccc4cccc -yahoo: --==End of incoming YCHT packet==-- - -*/ -#define YCHT_SEP "\xc0\x80" - -typedef struct _YchtConn { - PurpleConnection *gc; - gchar *room; - int room_id; - gint fd; - gint inpa; - gboolean logged_in; - gboolean changing_rooms; - guchar *rxqueue; - guint rxlen; - PurpleCircBuffer *txbuf; - guint tx_handler; -} YchtConn; - -typedef struct { - guint version; - guint service; - gint status; - GList *data; -} YchtPkt; - -void ycht_connection_open(PurpleConnection *gc); -void ycht_connection_close(YchtConn *ycht); - -void ycht_chat_join(YchtConn *ycht, const char *room); -int ycht_chat_send(YchtConn *ycht, const char *room, const char *what); -void ycht_chat_leave(YchtConn *ycht, const char *room, gboolean logout); -void ycht_chat_send_invite(YchtConn *ycht, const char *room, const char *buddy, const char *msg); -void ycht_chat_goto_user(YchtConn *ycht, const char *name); -void ycht_chat_send_keepalive(YchtConn *ycht); - -#endif /* _PURPLE_YCHT_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/com_err.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/com_err.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/com_err.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/com_err.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - * Header file for common error description library. - * - * Copyright 1988, Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright and distribution info, see the documentation supplied - * with this package. - */ - -#ifndef __COM_ERR_H -#define __COM_ERR_H - -#define COM_ERR_BUF_LEN 25 - -/* Use __STDC__ to guess whether we can use stdarg, prototypes, and const. - * This is a public header file, so autoconf can't help us here. */ -#ifdef __STDC__ -# include -# define ETP(x) x -# define ETCONST const -#else -# define ETP(x) () -# define ETCONST -#endif - -typedef void (*error_handler_t) ETP((ETCONST char *, long, ETCONST char *, - va_list)); -extern error_handler_t com_err_hook; -void com_err ETP((ETCONST char *, long, ETCONST char *, ...)); -ETCONST char *error_message ETP((long)); -ETCONST char *error_message_r ETP((long, char *)); -error_handler_t set_com_err_hook ETP((error_handler_t)); -error_handler_t reset_com_err_hook ETP((void)); - -#undef ETP - -#endif /* ! defined(__COM_ERR_H) */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_message.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_message.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_message.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_message.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright 1987 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * For copyright info, see "mit-sipb-copyright.h". - */ - -#include "error_table.h" -#include "com_err.h" -#include - -char *error_table_name_r __P((int, char *)); - -struct et_list * _et_list = (struct et_list *) NULL; - -const char * error_message (code) -long code; -{ - static char buf[COM_ERR_BUF_LEN]; - - return(error_message_r(code, buf)); -} - -const char * error_message_r (code, buf) -long code; -char *buf; -{ - int offset; - struct et_list *et; - int table_num; - int started = 0; - char *cp, namebuf[6]; - - offset = code & ((1<next) { - if (et->table->base == table_num) { - /* This is the right table */ - if (et->table->n_msgs <= offset) - break; - return(et->table->msgs[offset]); - } - } - - strcpy (buf, "Unknown code "); - if (table_num) { - strcat (buf, error_table_name_r (table_num, namebuf)); - strcat (buf, " "); - } - for (cp = buf; *cp; cp++) - ; - if (offset >= 100) { - *cp++ = '0' + offset / 100; - offset %= 100; - started++; - } - if (started || offset >= 10) { - *cp++ = '0' + offset / 10; - offset %= 10; - } - *cp++ = '0' + offset; - *cp = '\0'; - return(buf); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_table.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_table.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_table.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/error_table.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright 1988 by the Student Information Processing Board of the - * Massachusetts Institute of Technology. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#ifndef _ET_H -struct error_table { - char const * const * msgs; - long base; - int n_msgs; -}; -struct et_list { - struct et_list *next; - const struct error_table *table; -}; -extern struct et_list * _et_list; - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - -const char *error_table_name(void); -#define _ET_H -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/et_name.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/et_name.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/et_name.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/et_name.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright 1987 by MIT Student Information Processing Board - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include - - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - - -static const char char_set[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; - -/* Prototypes for -Wmissing-prototypes */ -const char * error_table_name(int num); -const char * error_table_name_r(int num, char *buf); - -const char * error_table_name_r(int num, char *buf) -{ - int ch; - int i; - char *p; - - /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ - p = buf; - num >>= ERRCODE_RANGE; - /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */ - num &= 077777777; - /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */ - for (i = 4; i >= 0; i--) { - ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1); - if (ch != 0) - *p++ = char_set[ch-1]; - } - *p = '\0'; - return(buf); -} - -const char * error_table_name(int num) -{ - static char buf[6]; - - return(error_table_name_r(num, buf)); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/init_et.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/init_et.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/init_et.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/init_et.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -/* - * Copyright 1986, 1987, 1988 by MIT Information Systems and - * the MIT Student Information Processing Board. - * - * For copyright info, see mit-sipb-copyright.h. - */ - -#include - -extern struct et_list * _et_list; - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -#ifndef __INTERNAL_H__ -#define __INTERNAL_H__ - -#include - -#ifdef LIBZEPHYR_EXT -#include -#else -#include -#endif - -#ifndef WIN32 -#include -#endif - - - -#ifdef WIN32 - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 512 -#endif - -#define ETIMEDOUT WSAETIMEDOUT -#define EADDRINUSE WSAEADDRINUSE -#else /* !WIN32 */ - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 4096 -#endif - -#endif - -#ifdef ZEPHYR_USES_HESIOD -#include -#endif - -#ifndef ZEPHYR_USES_KERBEROS -#define REALM_SZ MAXHOSTNAMELEN -#define INST_SZ 0 /* no instances w/o Kerberos */ -#define ANAME_SZ 9 /* size of a username + null */ -#define CLOCK_SKEW 300 /* max time to cache packet ids */ -#endif - -#define SERVER_SVC_FALLBACK htons((unsigned short) 2103) -#define HM_SVC_FALLBACK htons((unsigned short) 2104) -#define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105) - -#define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */ -#define ZAUTH_UNSET (-3) /* Internal to client library. */ -#define Z_MAXFRAGS 500 /* Max number of packet fragments */ -#define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */ -#define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */ -#define Z_FRAGFUDGE 13 /* Room to for multinotice field */ -#define Z_NOTICETIMELIMIT 30 /* Time to wait for fragments */ -#define Z_INITFILTERSIZE 30 /* Starting size of uid filter */ - -struct _Z_Hole { - struct _Z_Hole *next; - int first; - int last; -}; - -struct _Z_InputQ { - struct _Z_InputQ *next; - struct _Z_InputQ *prev; - ZNotice_Kind_t kind; - unsigned ZEPHYR_INT32 timep; - int packet_len; - char *packet; - int complete; - struct sockaddr_in from; - struct _Z_Hole *holelist; - ZUnique_Id_t uid; - int auth; - int header_len; - char *header; - int msg_len; - char *msg; -}; - -extern struct _Z_InputQ *__Q_Head, *__Q_Tail; - -extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */ -extern int __HM_set; /* 0 if dest addr set, 1 otherwise */ -extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */ - -extern ZLocations_t *__locate_list; -extern int __locate_num; -extern int __locate_next; - -extern ZSubscription_t *__subscriptions_list; -extern int __subscriptions_num; -extern int __subscriptions_next; - -extern int __Zephyr_port; /* Port number */ -extern struct in_addr __My_addr; - -typedef Code_t (*Z_SendProc) __P((ZNotice_t *, char *, int, int)); - -struct _Z_InputQ *Z_GetFirstComplete __P((void)); -struct _Z_InputQ *Z_GetNextComplete __P((struct _Z_InputQ *)); -Code_t Z_XmitFragment __P((ZNotice_t*, char *,int,int)); -void Z_RemQueue __P((struct _Z_InputQ *)); -Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int)); -Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); -Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); -Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, int, - int*, char **, char **)); -Code_t Z_ReadEnqueue __P((void)); -Code_t Z_ReadWait __P((void)); -Code_t Z_SendLocation __P((char*, char*, Z_AuthProc, char*)); -Code_t Z_SendFragmentedNotice __P((ZNotice_t *notice, int len, - Z_AuthProc cert_func, - Z_SendProc send_func)); -Code_t Z_WaitForComplete __P((void)); -Code_t Z_WaitForNotice __P((ZNotice_t *notice, - int (*pred) __P((ZNotice_t *, void *)), void *arg, - int timeout)); - -#endif /* __INTERNAL_H__ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) - -ZEPHYRSOURCES = \ - ZAsyncLocate.c \ - ZCkAuth.c \ - ZCkIfNot.c \ - ZClosePort.c \ - ZCmpUID.c \ - ZCmpUIDP.c \ - ZFlsLocs.c \ - ZFlsSubs.c \ - ZFmtAuth.c \ - ZFmtList.c \ - ZFmtNotice.c \ - ZFmtRaw.c \ - ZFmtRawLst.c \ - ZFmtSmRLst.c \ - ZFmtSmRaw.c \ - ZFreeNot.c \ - ZGetLocs.c \ - ZGetSender.c \ - ZGetSubs.c \ - ZGetWGPort.c \ - ZIfNotice.c \ - ZInit.c \ - ZLocations.c \ - ZMakeAscii.c \ - ZMkAuth.c \ - ZNewLocU.c \ - ZOpenPort.c \ - ZParseNot.c \ - ZPeekIfNot.c \ - ZPeekNot.c \ - ZPeekPkt.c \ - ZPending.c \ - ZReadAscii.c \ - ZRecvNot.c \ - ZRecvPkt.c \ - ZRetSubs.c \ - ZSendList.c \ - ZSendNot.c \ - ZSendPkt.c \ - ZSendRLst.c \ - ZSendRaw.c \ - ZSetDest.c \ - ZSetFD.c \ - ZSetSrv.c \ - ZSubs.c \ - ZVariables.c \ - ZWait4Not.c \ - ZhmStat.c \ - Zinternal.c \ - com_err.h \ - error_message.c \ - error_table.h \ - et_name.c \ - init_et.c \ - internal.h \ - mit-copyright.h \ - mit-sipb-copyright.h \ - sysdep.h \ - zephyr_err.c \ - zephyr_err.h \ - zephyr_internal.h \ - zephyr.c - -ZEPHYRSOURCESEXT = zephyr.c - -AM_CFLAGS = $(st) - -ZEPHYRLIBS = $(KRB4_LDFLAGS) $(KRB4_LIBS) - -ZEPHYRLIBSEXT = $(ZEPHYR_LDFLAGS) $(ZEPHYR_LIBS) - -libzephyr_la_LDFLAGS = -module -avoid-version - -if STATIC_ZEPHYR - -st = -DPURPLE_STATIC_PRPL -Dlint -noinst_LTLIBRARIES = libzephyr.la -libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -libzephyr_la_CFLAGS = $(AM_CFLAGS) -libzephyr_la_LIBADD = $(ZEPHYRLIBS) - -else - -st = -Dlint -pkg_LTLIBRARIES = libzephyr.la - -if EXTERNAL_LIBZEPHYR -libzephyr_la_SOURCES = $(ZEPHYRSOURCESEXT) -libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBSEXT) -else -libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBS) -endif - - -endif - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/libpurple/protocols \ - -DCONFDIR=\"$(sysconfdir)\" \ - $(GLIB_CFLAGS) \ - $(KRB4_CFLAGS) \ - $(DEBUG_CFLAGS) diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,1276 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libpurple/protocols/zephyr -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(pkgdir)" -pkgLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkg_LTLIBRARIES) -am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@libzephyr_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@ $(am__DEPENDENCIES_2) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@libzephyr_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@ $(am__DEPENDENCIES_2) -@STATIC_ZEPHYR_TRUE@libzephyr_la_DEPENDENCIES = $(am__DEPENDENCIES_2) -am__libzephyr_la_SOURCES_DIST = ZAsyncLocate.c ZCkAuth.c ZCkIfNot.c \ - ZClosePort.c ZCmpUID.c ZCmpUIDP.c ZFlsLocs.c ZFlsSubs.c \ - ZFmtAuth.c ZFmtList.c ZFmtNotice.c ZFmtRaw.c ZFmtRawLst.c \ - ZFmtSmRLst.c ZFmtSmRaw.c ZFreeNot.c ZGetLocs.c ZGetSender.c \ - ZGetSubs.c ZGetWGPort.c ZIfNotice.c ZInit.c ZLocations.c \ - ZMakeAscii.c ZMkAuth.c ZNewLocU.c ZOpenPort.c ZParseNot.c \ - ZPeekIfNot.c ZPeekNot.c ZPeekPkt.c ZPending.c ZReadAscii.c \ - ZRecvNot.c ZRecvPkt.c ZRetSubs.c ZSendList.c ZSendNot.c \ - ZSendPkt.c ZSendRLst.c ZSendRaw.c ZSetDest.c ZSetFD.c \ - ZSetSrv.c ZSubs.c ZVariables.c ZWait4Not.c ZhmStat.c \ - Zinternal.c com_err.h error_message.c error_table.h et_name.c \ - init_et.c internal.h mit-copyright.h mit-sipb-copyright.h \ - sysdep.h zephyr_err.c zephyr_err.h zephyr_internal.h zephyr.c -am__objects_1 = libzephyr_la-ZAsyncLocate.lo libzephyr_la-ZCkAuth.lo \ - libzephyr_la-ZCkIfNot.lo libzephyr_la-ZClosePort.lo \ - libzephyr_la-ZCmpUID.lo libzephyr_la-ZCmpUIDP.lo \ - libzephyr_la-ZFlsLocs.lo libzephyr_la-ZFlsSubs.lo \ - libzephyr_la-ZFmtAuth.lo libzephyr_la-ZFmtList.lo \ - libzephyr_la-ZFmtNotice.lo libzephyr_la-ZFmtRaw.lo \ - libzephyr_la-ZFmtRawLst.lo libzephyr_la-ZFmtSmRLst.lo \ - libzephyr_la-ZFmtSmRaw.lo libzephyr_la-ZFreeNot.lo \ - libzephyr_la-ZGetLocs.lo libzephyr_la-ZGetSender.lo \ - libzephyr_la-ZGetSubs.lo libzephyr_la-ZGetWGPort.lo \ - libzephyr_la-ZIfNotice.lo libzephyr_la-ZInit.lo \ - libzephyr_la-ZLocations.lo libzephyr_la-ZMakeAscii.lo \ - libzephyr_la-ZMkAuth.lo libzephyr_la-ZNewLocU.lo \ - libzephyr_la-ZOpenPort.lo libzephyr_la-ZParseNot.lo \ - libzephyr_la-ZPeekIfNot.lo libzephyr_la-ZPeekNot.lo \ - libzephyr_la-ZPeekPkt.lo libzephyr_la-ZPending.lo \ - libzephyr_la-ZReadAscii.lo libzephyr_la-ZRecvNot.lo \ - libzephyr_la-ZRecvPkt.lo libzephyr_la-ZRetSubs.lo \ - libzephyr_la-ZSendList.lo libzephyr_la-ZSendNot.lo \ - libzephyr_la-ZSendPkt.lo libzephyr_la-ZSendRLst.lo \ - libzephyr_la-ZSendRaw.lo libzephyr_la-ZSetDest.lo \ - libzephyr_la-ZSetFD.lo libzephyr_la-ZSetSrv.lo \ - libzephyr_la-ZSubs.lo libzephyr_la-ZVariables.lo \ - libzephyr_la-ZWait4Not.lo libzephyr_la-ZhmStat.lo \ - libzephyr_la-Zinternal.lo libzephyr_la-error_message.lo \ - libzephyr_la-et_name.lo libzephyr_la-init_et.lo \ - libzephyr_la-zephyr_err.lo libzephyr_la-zephyr.lo -am__objects_2 = libzephyr_la-zephyr.lo -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@am_libzephyr_la_OBJECTS = $(am__objects_1) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@am_libzephyr_la_OBJECTS = $(am__objects_2) -@STATIC_ZEPHYR_TRUE@am_libzephyr_la_OBJECTS = $(am__objects_1) -libzephyr_la_OBJECTS = $(am_libzephyr_la_OBJECTS) -@STATIC_ZEPHYR_FALSE@am_libzephyr_la_rpath = -rpath $(pkgdir) -@STATIC_ZEPHYR_TRUE@am_libzephyr_la_rpath = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libzephyr_la_SOURCES) -DIST_SOURCES = $(am__libzephyr_la_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION) -ZEPHYRSOURCES = \ - ZAsyncLocate.c \ - ZCkAuth.c \ - ZCkIfNot.c \ - ZClosePort.c \ - ZCmpUID.c \ - ZCmpUIDP.c \ - ZFlsLocs.c \ - ZFlsSubs.c \ - ZFmtAuth.c \ - ZFmtList.c \ - ZFmtNotice.c \ - ZFmtRaw.c \ - ZFmtRawLst.c \ - ZFmtSmRLst.c \ - ZFmtSmRaw.c \ - ZFreeNot.c \ - ZGetLocs.c \ - ZGetSender.c \ - ZGetSubs.c \ - ZGetWGPort.c \ - ZIfNotice.c \ - ZInit.c \ - ZLocations.c \ - ZMakeAscii.c \ - ZMkAuth.c \ - ZNewLocU.c \ - ZOpenPort.c \ - ZParseNot.c \ - ZPeekIfNot.c \ - ZPeekNot.c \ - ZPeekPkt.c \ - ZPending.c \ - ZReadAscii.c \ - ZRecvNot.c \ - ZRecvPkt.c \ - ZRetSubs.c \ - ZSendList.c \ - ZSendNot.c \ - ZSendPkt.c \ - ZSendRLst.c \ - ZSendRaw.c \ - ZSetDest.c \ - ZSetFD.c \ - ZSetSrv.c \ - ZSubs.c \ - ZVariables.c \ - ZWait4Not.c \ - ZhmStat.c \ - Zinternal.c \ - com_err.h \ - error_message.c \ - error_table.h \ - et_name.c \ - init_et.c \ - internal.h \ - mit-copyright.h \ - mit-sipb-copyright.h \ - sysdep.h \ - zephyr_err.c \ - zephyr_err.h \ - zephyr_internal.h \ - zephyr.c - -ZEPHYRSOURCESEXT = zephyr.c -AM_CFLAGS = $(st) -ZEPHYRLIBS = $(KRB4_LDFLAGS) $(KRB4_LIBS) -ZEPHYRLIBSEXT = $(ZEPHYR_LDFLAGS) $(ZEPHYR_LIBS) -libzephyr_la_LDFLAGS = -module -avoid-version -@STATIC_ZEPHYR_FALSE@st = -Dlint -@STATIC_ZEPHYR_TRUE@st = -DPURPLE_STATIC_PRPL -Dlint -@STATIC_ZEPHYR_TRUE@noinst_LTLIBRARIES = libzephyr.la -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@libzephyr_la_SOURCES = $(ZEPHYRSOURCESEXT) -@STATIC_ZEPHYR_TRUE@libzephyr_la_SOURCES = $(ZEPHYRSOURCES) -@STATIC_ZEPHYR_TRUE@libzephyr_la_CFLAGS = $(AM_CFLAGS) -@EXTERNAL_LIBZEPHYR_FALSE@@STATIC_ZEPHYR_FALSE@libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBS) -@EXTERNAL_LIBZEPHYR_TRUE@@STATIC_ZEPHYR_FALSE@libzephyr_la_LIBADD = $(GLIB_LIBS) $(ZEPHYRLIBSEXT) -@STATIC_ZEPHYR_TRUE@libzephyr_la_LIBADD = $(ZEPHYRLIBS) -@STATIC_ZEPHYR_FALSE@pkg_LTLIBRARIES = libzephyr.la -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/libpurple \ - -I$(top_builddir)/libpurple \ - -I$(top_srcdir)/libpurple/protocols \ - -DCONFDIR=\"$(sysconfdir)\" \ - $(GLIB_CFLAGS) \ - $(KRB4_CFLAGS) \ - $(DEBUG_CFLAGS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/protocols/zephyr/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/protocols/zephyr/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ - else :; fi; \ - done - -uninstall-pkgLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ - done - -clean-pkgLTLIBRARIES: - -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) - @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libzephyr.la: $(libzephyr_la_OBJECTS) $(libzephyr_la_DEPENDENCIES) - $(LINK) $(am_libzephyr_la_rpath) $(libzephyr_la_LDFLAGS) $(libzephyr_la_OBJECTS) $(libzephyr_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZAsyncLocate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCkAuth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCkIfNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZClosePort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCmpUID.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZCmpUIDP.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFlsLocs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFlsSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtAuth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtList.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtNotice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtRaw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtRawLst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZFreeNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetLocs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetSender.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZGetWGPort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZIfNotice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZInit.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZLocations.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZMakeAscii.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZMkAuth.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZNewLocU.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZOpenPort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZParseNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPeekIfNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPeekNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPeekPkt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZPending.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZReadAscii.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZRecvNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZRecvPkt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZRetSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendList.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendNot.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendPkt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendRLst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSendRaw.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSetDest.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSetFD.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSetSrv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZSubs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZVariables.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZWait4Not.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-ZhmStat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-Zinternal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-error_message.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-et_name.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-init_et.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-zephyr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libzephyr_la-zephyr_err.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libzephyr_la-ZAsyncLocate.lo: ZAsyncLocate.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZAsyncLocate.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Tpo" -c -o libzephyr_la-ZAsyncLocate.lo `test -f 'ZAsyncLocate.c' || echo '$(srcdir)/'`ZAsyncLocate.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Tpo" "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZAsyncLocate.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZAsyncLocate.c' object='libzephyr_la-ZAsyncLocate.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZAsyncLocate.lo `test -f 'ZAsyncLocate.c' || echo '$(srcdir)/'`ZAsyncLocate.c - -libzephyr_la-ZCkAuth.lo: ZCkAuth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCkAuth.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCkAuth.Tpo" -c -o libzephyr_la-ZCkAuth.lo `test -f 'ZCkAuth.c' || echo '$(srcdir)/'`ZCkAuth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCkAuth.Tpo" "$(DEPDIR)/libzephyr_la-ZCkAuth.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCkAuth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCkAuth.c' object='libzephyr_la-ZCkAuth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCkAuth.lo `test -f 'ZCkAuth.c' || echo '$(srcdir)/'`ZCkAuth.c - -libzephyr_la-ZCkIfNot.lo: ZCkIfNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCkIfNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCkIfNot.Tpo" -c -o libzephyr_la-ZCkIfNot.lo `test -f 'ZCkIfNot.c' || echo '$(srcdir)/'`ZCkIfNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCkIfNot.Tpo" "$(DEPDIR)/libzephyr_la-ZCkIfNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCkIfNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCkIfNot.c' object='libzephyr_la-ZCkIfNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCkIfNot.lo `test -f 'ZCkIfNot.c' || echo '$(srcdir)/'`ZCkIfNot.c - -libzephyr_la-ZClosePort.lo: ZClosePort.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZClosePort.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZClosePort.Tpo" -c -o libzephyr_la-ZClosePort.lo `test -f 'ZClosePort.c' || echo '$(srcdir)/'`ZClosePort.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZClosePort.Tpo" "$(DEPDIR)/libzephyr_la-ZClosePort.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZClosePort.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZClosePort.c' object='libzephyr_la-ZClosePort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZClosePort.lo `test -f 'ZClosePort.c' || echo '$(srcdir)/'`ZClosePort.c - -libzephyr_la-ZCmpUID.lo: ZCmpUID.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCmpUID.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCmpUID.Tpo" -c -o libzephyr_la-ZCmpUID.lo `test -f 'ZCmpUID.c' || echo '$(srcdir)/'`ZCmpUID.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCmpUID.Tpo" "$(DEPDIR)/libzephyr_la-ZCmpUID.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCmpUID.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCmpUID.c' object='libzephyr_la-ZCmpUID.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCmpUID.lo `test -f 'ZCmpUID.c' || echo '$(srcdir)/'`ZCmpUID.c - -libzephyr_la-ZCmpUIDP.lo: ZCmpUIDP.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZCmpUIDP.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Tpo" -c -o libzephyr_la-ZCmpUIDP.lo `test -f 'ZCmpUIDP.c' || echo '$(srcdir)/'`ZCmpUIDP.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Tpo" "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZCmpUIDP.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZCmpUIDP.c' object='libzephyr_la-ZCmpUIDP.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZCmpUIDP.lo `test -f 'ZCmpUIDP.c' || echo '$(srcdir)/'`ZCmpUIDP.c - -libzephyr_la-ZFlsLocs.lo: ZFlsLocs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFlsLocs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFlsLocs.Tpo" -c -o libzephyr_la-ZFlsLocs.lo `test -f 'ZFlsLocs.c' || echo '$(srcdir)/'`ZFlsLocs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFlsLocs.Tpo" "$(DEPDIR)/libzephyr_la-ZFlsLocs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFlsLocs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFlsLocs.c' object='libzephyr_la-ZFlsLocs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFlsLocs.lo `test -f 'ZFlsLocs.c' || echo '$(srcdir)/'`ZFlsLocs.c - -libzephyr_la-ZFlsSubs.lo: ZFlsSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFlsSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFlsSubs.Tpo" -c -o libzephyr_la-ZFlsSubs.lo `test -f 'ZFlsSubs.c' || echo '$(srcdir)/'`ZFlsSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFlsSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZFlsSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFlsSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFlsSubs.c' object='libzephyr_la-ZFlsSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFlsSubs.lo `test -f 'ZFlsSubs.c' || echo '$(srcdir)/'`ZFlsSubs.c - -libzephyr_la-ZFmtAuth.lo: ZFmtAuth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtAuth.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtAuth.Tpo" -c -o libzephyr_la-ZFmtAuth.lo `test -f 'ZFmtAuth.c' || echo '$(srcdir)/'`ZFmtAuth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtAuth.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtAuth.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtAuth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtAuth.c' object='libzephyr_la-ZFmtAuth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtAuth.lo `test -f 'ZFmtAuth.c' || echo '$(srcdir)/'`ZFmtAuth.c - -libzephyr_la-ZFmtList.lo: ZFmtList.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtList.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtList.Tpo" -c -o libzephyr_la-ZFmtList.lo `test -f 'ZFmtList.c' || echo '$(srcdir)/'`ZFmtList.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtList.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtList.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtList.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtList.c' object='libzephyr_la-ZFmtList.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtList.lo `test -f 'ZFmtList.c' || echo '$(srcdir)/'`ZFmtList.c - -libzephyr_la-ZFmtNotice.lo: ZFmtNotice.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtNotice.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtNotice.Tpo" -c -o libzephyr_la-ZFmtNotice.lo `test -f 'ZFmtNotice.c' || echo '$(srcdir)/'`ZFmtNotice.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtNotice.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtNotice.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtNotice.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtNotice.c' object='libzephyr_la-ZFmtNotice.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtNotice.lo `test -f 'ZFmtNotice.c' || echo '$(srcdir)/'`ZFmtNotice.c - -libzephyr_la-ZFmtRaw.lo: ZFmtRaw.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtRaw.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtRaw.Tpo" -c -o libzephyr_la-ZFmtRaw.lo `test -f 'ZFmtRaw.c' || echo '$(srcdir)/'`ZFmtRaw.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtRaw.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtRaw.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtRaw.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtRaw.c' object='libzephyr_la-ZFmtRaw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtRaw.lo `test -f 'ZFmtRaw.c' || echo '$(srcdir)/'`ZFmtRaw.c - -libzephyr_la-ZFmtRawLst.lo: ZFmtRawLst.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtRawLst.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Tpo" -c -o libzephyr_la-ZFmtRawLst.lo `test -f 'ZFmtRawLst.c' || echo '$(srcdir)/'`ZFmtRawLst.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtRawLst.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtRawLst.c' object='libzephyr_la-ZFmtRawLst.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtRawLst.lo `test -f 'ZFmtRawLst.c' || echo '$(srcdir)/'`ZFmtRawLst.c - -libzephyr_la-ZFmtSmRLst.lo: ZFmtSmRLst.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtSmRLst.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Tpo" -c -o libzephyr_la-ZFmtSmRLst.lo `test -f 'ZFmtSmRLst.c' || echo '$(srcdir)/'`ZFmtSmRLst.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtSmRLst.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtSmRLst.c' object='libzephyr_la-ZFmtSmRLst.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtSmRLst.lo `test -f 'ZFmtSmRLst.c' || echo '$(srcdir)/'`ZFmtSmRLst.c - -libzephyr_la-ZFmtSmRaw.lo: ZFmtSmRaw.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFmtSmRaw.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Tpo" -c -o libzephyr_la-ZFmtSmRaw.lo `test -f 'ZFmtSmRaw.c' || echo '$(srcdir)/'`ZFmtSmRaw.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Tpo" "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFmtSmRaw.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFmtSmRaw.c' object='libzephyr_la-ZFmtSmRaw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFmtSmRaw.lo `test -f 'ZFmtSmRaw.c' || echo '$(srcdir)/'`ZFmtSmRaw.c - -libzephyr_la-ZFreeNot.lo: ZFreeNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZFreeNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZFreeNot.Tpo" -c -o libzephyr_la-ZFreeNot.lo `test -f 'ZFreeNot.c' || echo '$(srcdir)/'`ZFreeNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZFreeNot.Tpo" "$(DEPDIR)/libzephyr_la-ZFreeNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZFreeNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZFreeNot.c' object='libzephyr_la-ZFreeNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZFreeNot.lo `test -f 'ZFreeNot.c' || echo '$(srcdir)/'`ZFreeNot.c - -libzephyr_la-ZGetLocs.lo: ZGetLocs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetLocs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetLocs.Tpo" -c -o libzephyr_la-ZGetLocs.lo `test -f 'ZGetLocs.c' || echo '$(srcdir)/'`ZGetLocs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetLocs.Tpo" "$(DEPDIR)/libzephyr_la-ZGetLocs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetLocs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetLocs.c' object='libzephyr_la-ZGetLocs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetLocs.lo `test -f 'ZGetLocs.c' || echo '$(srcdir)/'`ZGetLocs.c - -libzephyr_la-ZGetSender.lo: ZGetSender.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetSender.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetSender.Tpo" -c -o libzephyr_la-ZGetSender.lo `test -f 'ZGetSender.c' || echo '$(srcdir)/'`ZGetSender.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetSender.Tpo" "$(DEPDIR)/libzephyr_la-ZGetSender.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetSender.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetSender.c' object='libzephyr_la-ZGetSender.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetSender.lo `test -f 'ZGetSender.c' || echo '$(srcdir)/'`ZGetSender.c - -libzephyr_la-ZGetSubs.lo: ZGetSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetSubs.Tpo" -c -o libzephyr_la-ZGetSubs.lo `test -f 'ZGetSubs.c' || echo '$(srcdir)/'`ZGetSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZGetSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetSubs.c' object='libzephyr_la-ZGetSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetSubs.lo `test -f 'ZGetSubs.c' || echo '$(srcdir)/'`ZGetSubs.c - -libzephyr_la-ZGetWGPort.lo: ZGetWGPort.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZGetWGPort.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZGetWGPort.Tpo" -c -o libzephyr_la-ZGetWGPort.lo `test -f 'ZGetWGPort.c' || echo '$(srcdir)/'`ZGetWGPort.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZGetWGPort.Tpo" "$(DEPDIR)/libzephyr_la-ZGetWGPort.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZGetWGPort.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZGetWGPort.c' object='libzephyr_la-ZGetWGPort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZGetWGPort.lo `test -f 'ZGetWGPort.c' || echo '$(srcdir)/'`ZGetWGPort.c - -libzephyr_la-ZIfNotice.lo: ZIfNotice.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZIfNotice.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZIfNotice.Tpo" -c -o libzephyr_la-ZIfNotice.lo `test -f 'ZIfNotice.c' || echo '$(srcdir)/'`ZIfNotice.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZIfNotice.Tpo" "$(DEPDIR)/libzephyr_la-ZIfNotice.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZIfNotice.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZIfNotice.c' object='libzephyr_la-ZIfNotice.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZIfNotice.lo `test -f 'ZIfNotice.c' || echo '$(srcdir)/'`ZIfNotice.c - -libzephyr_la-ZInit.lo: ZInit.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZInit.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZInit.Tpo" -c -o libzephyr_la-ZInit.lo `test -f 'ZInit.c' || echo '$(srcdir)/'`ZInit.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZInit.Tpo" "$(DEPDIR)/libzephyr_la-ZInit.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZInit.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZInit.c' object='libzephyr_la-ZInit.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZInit.lo `test -f 'ZInit.c' || echo '$(srcdir)/'`ZInit.c - -libzephyr_la-ZLocations.lo: ZLocations.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZLocations.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZLocations.Tpo" -c -o libzephyr_la-ZLocations.lo `test -f 'ZLocations.c' || echo '$(srcdir)/'`ZLocations.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZLocations.Tpo" "$(DEPDIR)/libzephyr_la-ZLocations.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZLocations.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZLocations.c' object='libzephyr_la-ZLocations.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZLocations.lo `test -f 'ZLocations.c' || echo '$(srcdir)/'`ZLocations.c - -libzephyr_la-ZMakeAscii.lo: ZMakeAscii.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZMakeAscii.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZMakeAscii.Tpo" -c -o libzephyr_la-ZMakeAscii.lo `test -f 'ZMakeAscii.c' || echo '$(srcdir)/'`ZMakeAscii.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZMakeAscii.Tpo" "$(DEPDIR)/libzephyr_la-ZMakeAscii.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZMakeAscii.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZMakeAscii.c' object='libzephyr_la-ZMakeAscii.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZMakeAscii.lo `test -f 'ZMakeAscii.c' || echo '$(srcdir)/'`ZMakeAscii.c - -libzephyr_la-ZMkAuth.lo: ZMkAuth.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZMkAuth.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZMkAuth.Tpo" -c -o libzephyr_la-ZMkAuth.lo `test -f 'ZMkAuth.c' || echo '$(srcdir)/'`ZMkAuth.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZMkAuth.Tpo" "$(DEPDIR)/libzephyr_la-ZMkAuth.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZMkAuth.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZMkAuth.c' object='libzephyr_la-ZMkAuth.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZMkAuth.lo `test -f 'ZMkAuth.c' || echo '$(srcdir)/'`ZMkAuth.c - -libzephyr_la-ZNewLocU.lo: ZNewLocU.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZNewLocU.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZNewLocU.Tpo" -c -o libzephyr_la-ZNewLocU.lo `test -f 'ZNewLocU.c' || echo '$(srcdir)/'`ZNewLocU.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZNewLocU.Tpo" "$(DEPDIR)/libzephyr_la-ZNewLocU.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZNewLocU.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZNewLocU.c' object='libzephyr_la-ZNewLocU.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZNewLocU.lo `test -f 'ZNewLocU.c' || echo '$(srcdir)/'`ZNewLocU.c - -libzephyr_la-ZOpenPort.lo: ZOpenPort.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZOpenPort.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZOpenPort.Tpo" -c -o libzephyr_la-ZOpenPort.lo `test -f 'ZOpenPort.c' || echo '$(srcdir)/'`ZOpenPort.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZOpenPort.Tpo" "$(DEPDIR)/libzephyr_la-ZOpenPort.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZOpenPort.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZOpenPort.c' object='libzephyr_la-ZOpenPort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZOpenPort.lo `test -f 'ZOpenPort.c' || echo '$(srcdir)/'`ZOpenPort.c - -libzephyr_la-ZParseNot.lo: ZParseNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZParseNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZParseNot.Tpo" -c -o libzephyr_la-ZParseNot.lo `test -f 'ZParseNot.c' || echo '$(srcdir)/'`ZParseNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZParseNot.Tpo" "$(DEPDIR)/libzephyr_la-ZParseNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZParseNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZParseNot.c' object='libzephyr_la-ZParseNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZParseNot.lo `test -f 'ZParseNot.c' || echo '$(srcdir)/'`ZParseNot.c - -libzephyr_la-ZPeekIfNot.lo: ZPeekIfNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPeekIfNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Tpo" -c -o libzephyr_la-ZPeekIfNot.lo `test -f 'ZPeekIfNot.c' || echo '$(srcdir)/'`ZPeekIfNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Tpo" "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPeekIfNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPeekIfNot.c' object='libzephyr_la-ZPeekIfNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPeekIfNot.lo `test -f 'ZPeekIfNot.c' || echo '$(srcdir)/'`ZPeekIfNot.c - -libzephyr_la-ZPeekNot.lo: ZPeekNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPeekNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPeekNot.Tpo" -c -o libzephyr_la-ZPeekNot.lo `test -f 'ZPeekNot.c' || echo '$(srcdir)/'`ZPeekNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPeekNot.Tpo" "$(DEPDIR)/libzephyr_la-ZPeekNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPeekNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPeekNot.c' object='libzephyr_la-ZPeekNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPeekNot.lo `test -f 'ZPeekNot.c' || echo '$(srcdir)/'`ZPeekNot.c - -libzephyr_la-ZPeekPkt.lo: ZPeekPkt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPeekPkt.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPeekPkt.Tpo" -c -o libzephyr_la-ZPeekPkt.lo `test -f 'ZPeekPkt.c' || echo '$(srcdir)/'`ZPeekPkt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPeekPkt.Tpo" "$(DEPDIR)/libzephyr_la-ZPeekPkt.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPeekPkt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPeekPkt.c' object='libzephyr_la-ZPeekPkt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPeekPkt.lo `test -f 'ZPeekPkt.c' || echo '$(srcdir)/'`ZPeekPkt.c - -libzephyr_la-ZPending.lo: ZPending.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZPending.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZPending.Tpo" -c -o libzephyr_la-ZPending.lo `test -f 'ZPending.c' || echo '$(srcdir)/'`ZPending.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZPending.Tpo" "$(DEPDIR)/libzephyr_la-ZPending.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZPending.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZPending.c' object='libzephyr_la-ZPending.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZPending.lo `test -f 'ZPending.c' || echo '$(srcdir)/'`ZPending.c - -libzephyr_la-ZReadAscii.lo: ZReadAscii.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZReadAscii.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZReadAscii.Tpo" -c -o libzephyr_la-ZReadAscii.lo `test -f 'ZReadAscii.c' || echo '$(srcdir)/'`ZReadAscii.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZReadAscii.Tpo" "$(DEPDIR)/libzephyr_la-ZReadAscii.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZReadAscii.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZReadAscii.c' object='libzephyr_la-ZReadAscii.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZReadAscii.lo `test -f 'ZReadAscii.c' || echo '$(srcdir)/'`ZReadAscii.c - -libzephyr_la-ZRecvNot.lo: ZRecvNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZRecvNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZRecvNot.Tpo" -c -o libzephyr_la-ZRecvNot.lo `test -f 'ZRecvNot.c' || echo '$(srcdir)/'`ZRecvNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZRecvNot.Tpo" "$(DEPDIR)/libzephyr_la-ZRecvNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZRecvNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZRecvNot.c' object='libzephyr_la-ZRecvNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZRecvNot.lo `test -f 'ZRecvNot.c' || echo '$(srcdir)/'`ZRecvNot.c - -libzephyr_la-ZRecvPkt.lo: ZRecvPkt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZRecvPkt.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZRecvPkt.Tpo" -c -o libzephyr_la-ZRecvPkt.lo `test -f 'ZRecvPkt.c' || echo '$(srcdir)/'`ZRecvPkt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZRecvPkt.Tpo" "$(DEPDIR)/libzephyr_la-ZRecvPkt.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZRecvPkt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZRecvPkt.c' object='libzephyr_la-ZRecvPkt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZRecvPkt.lo `test -f 'ZRecvPkt.c' || echo '$(srcdir)/'`ZRecvPkt.c - -libzephyr_la-ZRetSubs.lo: ZRetSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZRetSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZRetSubs.Tpo" -c -o libzephyr_la-ZRetSubs.lo `test -f 'ZRetSubs.c' || echo '$(srcdir)/'`ZRetSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZRetSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZRetSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZRetSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZRetSubs.c' object='libzephyr_la-ZRetSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZRetSubs.lo `test -f 'ZRetSubs.c' || echo '$(srcdir)/'`ZRetSubs.c - -libzephyr_la-ZSendList.lo: ZSendList.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendList.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendList.Tpo" -c -o libzephyr_la-ZSendList.lo `test -f 'ZSendList.c' || echo '$(srcdir)/'`ZSendList.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendList.Tpo" "$(DEPDIR)/libzephyr_la-ZSendList.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendList.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendList.c' object='libzephyr_la-ZSendList.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendList.lo `test -f 'ZSendList.c' || echo '$(srcdir)/'`ZSendList.c - -libzephyr_la-ZSendNot.lo: ZSendNot.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendNot.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendNot.Tpo" -c -o libzephyr_la-ZSendNot.lo `test -f 'ZSendNot.c' || echo '$(srcdir)/'`ZSendNot.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendNot.Tpo" "$(DEPDIR)/libzephyr_la-ZSendNot.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendNot.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendNot.c' object='libzephyr_la-ZSendNot.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendNot.lo `test -f 'ZSendNot.c' || echo '$(srcdir)/'`ZSendNot.c - -libzephyr_la-ZSendPkt.lo: ZSendPkt.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendPkt.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendPkt.Tpo" -c -o libzephyr_la-ZSendPkt.lo `test -f 'ZSendPkt.c' || echo '$(srcdir)/'`ZSendPkt.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendPkt.Tpo" "$(DEPDIR)/libzephyr_la-ZSendPkt.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendPkt.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendPkt.c' object='libzephyr_la-ZSendPkt.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendPkt.lo `test -f 'ZSendPkt.c' || echo '$(srcdir)/'`ZSendPkt.c - -libzephyr_la-ZSendRLst.lo: ZSendRLst.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendRLst.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendRLst.Tpo" -c -o libzephyr_la-ZSendRLst.lo `test -f 'ZSendRLst.c' || echo '$(srcdir)/'`ZSendRLst.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendRLst.Tpo" "$(DEPDIR)/libzephyr_la-ZSendRLst.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendRLst.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendRLst.c' object='libzephyr_la-ZSendRLst.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendRLst.lo `test -f 'ZSendRLst.c' || echo '$(srcdir)/'`ZSendRLst.c - -libzephyr_la-ZSendRaw.lo: ZSendRaw.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSendRaw.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSendRaw.Tpo" -c -o libzephyr_la-ZSendRaw.lo `test -f 'ZSendRaw.c' || echo '$(srcdir)/'`ZSendRaw.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSendRaw.Tpo" "$(DEPDIR)/libzephyr_la-ZSendRaw.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSendRaw.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSendRaw.c' object='libzephyr_la-ZSendRaw.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSendRaw.lo `test -f 'ZSendRaw.c' || echo '$(srcdir)/'`ZSendRaw.c - -libzephyr_la-ZSetDest.lo: ZSetDest.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSetDest.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSetDest.Tpo" -c -o libzephyr_la-ZSetDest.lo `test -f 'ZSetDest.c' || echo '$(srcdir)/'`ZSetDest.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSetDest.Tpo" "$(DEPDIR)/libzephyr_la-ZSetDest.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSetDest.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSetDest.c' object='libzephyr_la-ZSetDest.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSetDest.lo `test -f 'ZSetDest.c' || echo '$(srcdir)/'`ZSetDest.c - -libzephyr_la-ZSetFD.lo: ZSetFD.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSetFD.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSetFD.Tpo" -c -o libzephyr_la-ZSetFD.lo `test -f 'ZSetFD.c' || echo '$(srcdir)/'`ZSetFD.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSetFD.Tpo" "$(DEPDIR)/libzephyr_la-ZSetFD.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSetFD.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSetFD.c' object='libzephyr_la-ZSetFD.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSetFD.lo `test -f 'ZSetFD.c' || echo '$(srcdir)/'`ZSetFD.c - -libzephyr_la-ZSetSrv.lo: ZSetSrv.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSetSrv.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSetSrv.Tpo" -c -o libzephyr_la-ZSetSrv.lo `test -f 'ZSetSrv.c' || echo '$(srcdir)/'`ZSetSrv.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSetSrv.Tpo" "$(DEPDIR)/libzephyr_la-ZSetSrv.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSetSrv.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSetSrv.c' object='libzephyr_la-ZSetSrv.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSetSrv.lo `test -f 'ZSetSrv.c' || echo '$(srcdir)/'`ZSetSrv.c - -libzephyr_la-ZSubs.lo: ZSubs.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZSubs.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZSubs.Tpo" -c -o libzephyr_la-ZSubs.lo `test -f 'ZSubs.c' || echo '$(srcdir)/'`ZSubs.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZSubs.Tpo" "$(DEPDIR)/libzephyr_la-ZSubs.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZSubs.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZSubs.c' object='libzephyr_la-ZSubs.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZSubs.lo `test -f 'ZSubs.c' || echo '$(srcdir)/'`ZSubs.c - -libzephyr_la-ZVariables.lo: ZVariables.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZVariables.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZVariables.Tpo" -c -o libzephyr_la-ZVariables.lo `test -f 'ZVariables.c' || echo '$(srcdir)/'`ZVariables.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZVariables.Tpo" "$(DEPDIR)/libzephyr_la-ZVariables.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZVariables.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZVariables.c' object='libzephyr_la-ZVariables.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZVariables.lo `test -f 'ZVariables.c' || echo '$(srcdir)/'`ZVariables.c - -libzephyr_la-ZWait4Not.lo: ZWait4Not.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZWait4Not.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZWait4Not.Tpo" -c -o libzephyr_la-ZWait4Not.lo `test -f 'ZWait4Not.c' || echo '$(srcdir)/'`ZWait4Not.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZWait4Not.Tpo" "$(DEPDIR)/libzephyr_la-ZWait4Not.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZWait4Not.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZWait4Not.c' object='libzephyr_la-ZWait4Not.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZWait4Not.lo `test -f 'ZWait4Not.c' || echo '$(srcdir)/'`ZWait4Not.c - -libzephyr_la-ZhmStat.lo: ZhmStat.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-ZhmStat.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-ZhmStat.Tpo" -c -o libzephyr_la-ZhmStat.lo `test -f 'ZhmStat.c' || echo '$(srcdir)/'`ZhmStat.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-ZhmStat.Tpo" "$(DEPDIR)/libzephyr_la-ZhmStat.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-ZhmStat.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ZhmStat.c' object='libzephyr_la-ZhmStat.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-ZhmStat.lo `test -f 'ZhmStat.c' || echo '$(srcdir)/'`ZhmStat.c - -libzephyr_la-Zinternal.lo: Zinternal.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-Zinternal.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-Zinternal.Tpo" -c -o libzephyr_la-Zinternal.lo `test -f 'Zinternal.c' || echo '$(srcdir)/'`Zinternal.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-Zinternal.Tpo" "$(DEPDIR)/libzephyr_la-Zinternal.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-Zinternal.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Zinternal.c' object='libzephyr_la-Zinternal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-Zinternal.lo `test -f 'Zinternal.c' || echo '$(srcdir)/'`Zinternal.c - -libzephyr_la-error_message.lo: error_message.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-error_message.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-error_message.Tpo" -c -o libzephyr_la-error_message.lo `test -f 'error_message.c' || echo '$(srcdir)/'`error_message.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-error_message.Tpo" "$(DEPDIR)/libzephyr_la-error_message.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-error_message.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='error_message.c' object='libzephyr_la-error_message.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-error_message.lo `test -f 'error_message.c' || echo '$(srcdir)/'`error_message.c - -libzephyr_la-et_name.lo: et_name.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-et_name.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-et_name.Tpo" -c -o libzephyr_la-et_name.lo `test -f 'et_name.c' || echo '$(srcdir)/'`et_name.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-et_name.Tpo" "$(DEPDIR)/libzephyr_la-et_name.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-et_name.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='et_name.c' object='libzephyr_la-et_name.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-et_name.lo `test -f 'et_name.c' || echo '$(srcdir)/'`et_name.c - -libzephyr_la-init_et.lo: init_et.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-init_et.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-init_et.Tpo" -c -o libzephyr_la-init_et.lo `test -f 'init_et.c' || echo '$(srcdir)/'`init_et.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-init_et.Tpo" "$(DEPDIR)/libzephyr_la-init_et.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-init_et.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='init_et.c' object='libzephyr_la-init_et.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-init_et.lo `test -f 'init_et.c' || echo '$(srcdir)/'`init_et.c - -libzephyr_la-zephyr_err.lo: zephyr_err.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-zephyr_err.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-zephyr_err.Tpo" -c -o libzephyr_la-zephyr_err.lo `test -f 'zephyr_err.c' || echo '$(srcdir)/'`zephyr_err.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-zephyr_err.Tpo" "$(DEPDIR)/libzephyr_la-zephyr_err.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-zephyr_err.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zephyr_err.c' object='libzephyr_la-zephyr_err.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-zephyr_err.lo `test -f 'zephyr_err.c' || echo '$(srcdir)/'`zephyr_err.c - -libzephyr_la-zephyr.lo: zephyr.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -MT libzephyr_la-zephyr.lo -MD -MP -MF "$(DEPDIR)/libzephyr_la-zephyr.Tpo" -c -o libzephyr_la-zephyr.lo `test -f 'zephyr.c' || echo '$(srcdir)/'`zephyr.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libzephyr_la-zephyr.Tpo" "$(DEPDIR)/libzephyr_la-zephyr.Plo"; else rm -f "$(DEPDIR)/libzephyr_la-zephyr.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='zephyr.c' object='libzephyr_la-zephyr.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libzephyr_la_CFLAGS) $(CFLAGS) -c -o libzephyr_la-zephyr.lo `test -f 'zephyr.c' || echo '$(srcdir)/'`zephyr.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: - for dir in "$(DESTDIR)$(pkgdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-pkgLTLIBRARIES mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-pkgLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES clean-pkgLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-pkgLTLIBRARIES \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-info-am uninstall-pkgLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-copyright.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-copyright.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-copyright.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-copyright.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -/* - -Copyright 1987,1988 by the Massachusetts Institute of Technology - -All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the Massachusetts -Institute of Technology (M.I.T.) not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. - -M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-sipb-copyright.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-sipb-copyright.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-sipb-copyright.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/mit-sipb-copyright.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -/* - -Copyright 1987, 1989 by the Student Information Processing Board - of the Massachusetts Institute of Technology - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is -hereby granted, provided that the above copyright notice -appear in all copies and that both that copyright notice and -this permission notice appear in supporting documentation, -and that the names of M.I.T. and the M.I.T. S.I.P.B. not be -used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. -M.I.T. and the M.I.T. S.I.P.B. make no representations about -the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -*/ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/sysdep.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/sysdep.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/sysdep.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/sysdep.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains system-dependent header code. - * - * Created by: Greg Hudson - * - * Copyright (c) 1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#ifndef __SYSDEP_H__ -#define __SYSDEP_H__ - -#include -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#endif - -#include -#include -#include -#include - -#if defined(STDC_HEADERS) || defined(HAVE_STDLIB_H) -# include -#else -# ifdef HAVE_MALLOC_H -# include -# else -char *malloc(), *realloc(void); -# endif -char *getenv(), *strerror(), *ctime(), *strcpy(void); -time_t time(void); -ZEPHYR_INT32 random(void); -#endif - -#ifndef HAVE_RANDOM -#ifdef HAVE_LRAND48 -#define random lrand48 -#define srandom srand48 -#else -#define random rand -#define srandom srand -#endif -#endif - -#ifndef HAVE_STRERROR -extern char *sys_errlist[]; -# define strerror(x) (sys_errlist[(x)]) -#endif - -/* Strings. */ -#if defined(STDC_HEADERS) || defined(HAVE_STRING_H) -# include -#else -# ifndef HAVE_STRCHR -# define strchr index -# define strrchr rindex -# endif -char *strchr(), *strrchr(void); -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# define memcmp bcmp -# endif -# ifndef HAVE_MEMMOVE -# define memmove(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -/* Exit status handling and wait(). */ -#ifdef HAVE_SYS_WAIT_H -# include -#endif -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif - -#ifdef HAVE_SYS_CDEFS_H -#include -#endif - -/* Because we have public header files (and our prototypes need to agree with - * those header files, use __STDC__ to guess whether the compiler can handle - * stdarg, const, and prototypes. */ -#ifdef __STDC__ -# include -# define VA_START(ap, last) va_start(ap, last) -# ifndef __P -# define __P(x) x -# endif -#else -# include -# define VA_START(ap, last) va_start(ap) -# define const -# ifndef __P -# define __P(x) () -# endif -#endif - -/* openlog(). */ -#ifdef LOG_AUTH -/* A decent syslog */ -#define OPENLOG(str, opts, facility) openlog(str, opts, facility) -#else -/* Probably a 4.2-type syslog */ -#define OPENLOG(str, opts, facility) openlog(str, opts) -#endif - -#ifdef HAVE_FCNTL_H -# include -#endif - -#ifdef HAVE_PATHS_H -# include -# define TEMP_DIRECTORY _PATH_VARTMP -#else -# define TEMP_DIRECTORY FOUND_TMP -#endif - -#ifdef HAVE_UNISTD_H -# include -#else -# ifdef HAVE_SYS_FILE_H -# include -# endif -uid_t getuid(void); -char *ttyname(void); -#ifdef HAVE_GETHOSTID -ZEPHYR_INT32 gethostid(void); -#endif -#endif - -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 -#endif - -#ifdef HAVE_TERMIOS_H -# include -#else -# ifdef HAVE_SYS_FILIO_H -# include -# else -# ifdef HAVE_SGTTY_H -# include -# endif -# ifdef HAVE_SYS_IOCTL_H -# include -# endif -# endif -#endif - -/* Kerberos compatibility. */ -#ifdef ZEPHYR_USES_KERBEROS -# include -#ifdef WIN32 - -#else -# include -#endif /* WIN32 */ -# include -#ifndef WIN32 -# ifndef HAVE_KRB_GET_ERR_TEXT -# define krb_get_err_text(n) krb_err_txt[n] -# endif -#endif /* WIN32 */ -# ifndef HAVE_KRB_LOG -# define krb_log log -# endif -#endif /* ZEPHYR_USES_KERBEROS */ - -#ifdef HAVE_SYS_UIO_H -# include -#endif - -#ifdef HAVE_SYS_UTSNAME_H -# include -#endif - -#ifdef HAVE_SYS_SELECT_H -# include -#endif - -#ifdef HAVE_SYS_MSGBUF_H -#include -#endif - -#ifndef MSG_BSIZE -#define MSG_BSIZE BUFSIZ -#endif - -#endif /* __SYSDEP_H__ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZAsyncLocate.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZAsyncLocate.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZAsyncLocate.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZAsyncLocate.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for asynchronous location functions. - * - * Created by: Marc Horowitz - * - * Copyright (c) 1990,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZRequestLocations(user, zald, kind, auth) - const char *user; - ZAsyncLocateData_t *zald; - ZNotice_Kind_t kind; /* UNSAFE, UNACKED, or ACKED */ - Z_AuthProc auth; -{ - int retval; - ZNotice_t notice; - - if (ZGetFD() < 0) - if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) - return (retval); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = kind; - notice.z_port = __Zephyr_port; - notice.z_class = LOCATE_CLASS; - notice.z_class_inst = user; - notice.z_opcode = LOCATE_LOCATE; - notice.z_sender = 0; - notice.z_recipient = ""; - notice.z_default_format = ""; - notice.z_message_len = 0; - - if ((retval = ZSendNotice(¬ice, auth)) != ZERR_NONE) - return(retval); - - if ((zald->user = (char *) malloc(strlen(user)+1)) == NULL) { - return(ENOMEM); - } - if ((zald->version = (char *) malloc(strlen(notice.z_version)+1)) == NULL) { - free(zald->user); - return(ENOMEM); - } - zald->uid = notice.z_multiuid; - strcpy(zald->user,user); - strcpy(zald->version,notice.z_version); - - return(ZERR_NONE); -} - -Code_t ZParseLocations(notice,zald,nlocs,user) - ZNotice_t *notice; - ZAsyncLocateData_t *zald; - int *nlocs; - char **user; -{ - char *ptr, *end; - int i; - - ZFlushLocations(); /* This never fails (this function is part of the - library, so it is allowed to know this). */ - - /* non-matching protocol version numbers means the - server is probably an older version--must punt */ - - if (zald && strcmp(notice->z_version, zald->version)) - return(ZERR_VERS); - - if (notice->z_kind == SERVNAK) - return (ZERR_SERVNAK); - - /* flag ACKs as special */ - if (notice->z_kind == SERVACK && - !strcmp(notice->z_opcode, LOCATE_LOCATE)) { - *nlocs = -1; - return(ZERR_NONE); - } - - if (notice->z_kind != ACKED) - return (ZERR_INTERNAL); - - end = notice->z_message+notice->z_message_len; - - __locate_num = 0; - - for (ptr=notice->z_message;ptrz_message, i=0; i<__locate_num; i++) { - unsigned int len; - - len = strlen (ptr) + 1; - __locate_list[i].host = (char *) malloc(len); - if (!__locate_list[i].host) - return (ENOMEM); - (void) strcpy(__locate_list[i].host, ptr); - ptr += len; - - len = strlen (ptr) + 1; - __locate_list[i].time = (char *) malloc(len); - if (!__locate_list[i].time) - return (ENOMEM); - (void) strcpy(__locate_list[i].time, ptr); - ptr += len; - - len = strlen (ptr) + 1; - __locate_list[i].tty = (char *) malloc(len); - if (!__locate_list[i].tty) - return (ENOMEM); - (void) strcpy(__locate_list[i].tty, ptr); - ptr += len; - } - - __locate_next = 0; - *nlocs = __locate_num; - if (user) { - if (zald) { - if ((*user = (char *) malloc(strlen(zald->user)+1)) == NULL) - return(ENOMEM); - strcpy(*user,zald->user); - } else { - if ((*user = (char *) malloc(strlen(notice->z_class_inst)+1)) == NULL) - return(ENOMEM); - strcpy(*user,notice->z_class_inst); - } - } - return (ZERR_NONE); -} - -int ZCompareALDPred(notice, zald) - ZNotice_t *notice; - void *zald; -{ - return(ZCompareUID(&(notice->z_multiuid), - &(((ZAsyncLocateData_t *) zald)->uid))); -} - -void ZFreeALD(zald) - ZAsyncLocateData_t *zald; -{ - if (!zald) return; - - if (zald->user) free(zald->user); - if (zald->version) free(zald->version); - (void) memset(zald, 0, sizeof(*zald)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkAuth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkAuth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkAuth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkAuth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCheckAuthentication function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -/* Check authentication of the notice. - If it looks authentic but fails the Kerberos check, return -1. - If it looks authentic and passes the Kerberos check, return 1. - If it doesn't look authentic, return 0 - - When not using Kerberos, return true if the notice claims to be authentic. - Only used by clients; the server uses its own routine. - */ -Code_t ZCheckAuthentication(notice, from) - ZNotice_t *notice; - struct sockaddr_in *from; -{ -#ifdef ZEPHYR_USES_KERBEROS - int result; - ZChecksum_t our_checksum; - CREDENTIALS cred; - - /* If the value is already known, return it. */ - if (notice->z_checked_auth != ZAUTH_UNSET) - return (notice->z_checked_auth); - - if (!notice->z_auth) - return (ZAUTH_NO); - - if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, - __Zephyr_realm, &cred)) != 0) - return (ZAUTH_NO); - -#ifdef NOENCRYPTION - our_checksum = 0; -#else - our_checksum = des_quad_cksum(notice->z_packet, NULL, - notice->z_default_format+ - strlen(notice->z_default_format)+1- - notice->z_packet, 0, (C_Block *)cred.session); -#endif - /* if mismatched checksum, then the packet was corrupted */ - return ((our_checksum == notice->z_checksum) ? ZAUTH_YES : ZAUTH_FAILED); - -#else - return (notice->z_auth ? ZAUTH_YES : ZAUTH_NO); -#endif -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkIfNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkIfNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkIfNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCkIfNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCheckIfNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZCheckIfNotice(notice, from, predicate, args) - ZNotice_t *notice; - struct sockaddr_in *from; - register int (*predicate) __P((ZNotice_t *, void *)); - void *args; -{ - ZNotice_t tmpnotice; - Code_t retval; - register char *buffer; - register struct _Z_InputQ *qptr; - - if ((retval = Z_ReadEnqueue()) != ZERR_NONE) - return (retval); - - qptr = Z_GetFirstComplete(); - - while (qptr) { - if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, - &tmpnotice)) != ZERR_NONE) - return (retval); - if ((*predicate)(&tmpnotice, args)) { - if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(buffer, qptr->packet, qptr->packet_len); - if (from) - *from = qptr->from; - if ((retval = ZParseNotice(buffer, qptr->packet_len, - notice)) != ZERR_NONE) { - free(buffer); - return (retval); - } - Z_RemQueue(qptr); - return (ZERR_NONE); - } - qptr = Z_GetNextComplete(qptr); - } - - return (ZERR_NONOTICE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZClosePort.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZClosePort.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZClosePort.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZClosePort.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZClosePort function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZClosePort() -{ - if (__Zephyr_fd >= 0 && __Zephyr_open) - (void) close(__Zephyr_fd); - - __Zephyr_fd = -1; - __Zephyr_open = 0; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUID.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUID.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUID.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUID.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCompareUID function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -int ZCompareUID(uid1, uid2) - ZUnique_Id_t *uid1, *uid2; -{ - return (!memcmp((char *)uid1, (char *)uid2, sizeof (*uid1))); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUIDP.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUIDP.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUIDP.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZCmpUIDP.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZCompareUIDPred function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -int ZCompareUIDPred(notice, uid) - ZNotice_t *notice; - void *uid; -{ - return (ZCompareUID(¬ice->z_uid, (ZUnique_Id_t *) uid)); -} - -int ZCompareMultiUIDPred(notice, uid) - ZNotice_t *notice; - void *uid; -{ - return (ZCompareUID(¬ice->z_multiuid, (ZUnique_Id_t *) uid)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2986 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * purple - * - * Copyright (C) 1998-2001, Mark Spencer - * Some code borrowed from GtkZephyr, by - * Jag/Sean Dilda / - * http://gtkzephyr.linuxpower.org/ - * - * Some code borrowed from kzephyr, by - * Chris Colohan - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - -*/ -#include "libpurple/internal.h" - -#include "accountopt.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "server.h" -#include "util.h" -#include "cmds.h" -#include "privacy.h" -#include "version.h" - -#include "internal.h" - -#include - -#define ZEPHYR_FALLBACK_CHARSET "ISO-8859-1" - -/* these are deliberately high, since most people don't send multiple "PING"s */ -#define ZEPHYR_TYPING_SEND_TIMEOUT 15 -#define ZEPHYR_TYPING_RECV_TIMEOUT 10 -#define ZEPHYR_FD_READ 0 -#define ZEPHYR_FD_WRITE 1 - -extern Code_t ZGetLocations(ZLocations_t *, int *); -extern Code_t ZSetLocation(char *); -extern Code_t ZUnsetLocation(void); -extern Code_t ZGetSubscriptions(ZSubscription_t *, int*); -extern char __Zephyr_realm[]; -typedef struct _zframe zframe; -typedef struct _zephyr_triple zephyr_triple; -typedef struct _zephyr_account zephyr_account; -typedef struct _parse_tree parse_tree; - -typedef enum { - PURPLE_ZEPHYR_NONE, /* Non-kerberized ZEPH0.2 */ - PURPLE_ZEPHYR_KRB4, /* ZEPH0.2 w/ KRB4 support */ - PURPLE_ZEPHYR_TZC, /* tzc executable proxy */ - PURPLE_ZEPHYR_INTERGALACTIC_KRB4 /* Kerberized ZEPH0.3 */ -} zephyr_connection_type; - -struct _zephyr_account { - PurpleAccount* account; - char *username; - char *realm; - char *encoding; - char* galaxy; /* not yet useful */ - char* krbtkfile; /* not yet useful */ - guint32 nottimer; - guint32 loctimer; - GList *pending_zloc_names; - GSList *subscrips; - int last_id; - unsigned short port; - char ourhost[HOST_NAME_MAX + 1]; - char ourhostcanon[HOST_NAME_MAX + 1]; - zephyr_connection_type connection_type; - int totzc[2]; - int fromtzc[2]; - char *exposure; - pid_t tzc_pid; - gchar *away; -}; - -#define MAXCHILDREN 20 - -struct _parse_tree { - gchar* contents; - parse_tree *children[MAXCHILDREN]; - int num_children; -}; - -parse_tree null_parse_tree = { - "", - {NULL}, - 0, -}; - -#define use_none(zephyr) ((zephyr->connection_type == PURPLE_ZEPHYR_NONE)?1:0) -#define use_krb4(zephyr) ((zephyr->connection_type == PURPLE_ZEPHYR_KRB4)?1:0) -#define use_tzc(zephyr) ((zephyr->connection_type == PURPLE_ZEPHYR_TZC)?1:0) - -#define use_zeph02(zephyr) ( (zephyr->connection_type == PURPLE_ZEPHYR_NONE)?1: ((zephyr->connection_type == PURPLE_ZEPHYR_KRB4)?1:0)) - -/* struct I need for zephyr_to_html */ -struct _zframe { - /* true for everything but @color, since inside the parens of that one is - * the color. */ - gboolean has_closer; - /* @i, @b, etc. */ - const char *env; - /* }=1, ]=2, )=4, >=8 */ - int closer_mask; - /* }, ], ), > */ - char *closer; - /*
, , , etc. */ - const char *closing; - /* text including the opening html thingie. */ - GString *text; - /* href for links */ - gboolean is_href; - GString *href; - struct _zframe *enclosing; -}; - -struct _zephyr_triple { - char *class; - char *instance; - char *recipient; - char *name; - gboolean open; - int id; -}; - -#define z_call(func) if (func != ZERR_NONE)\ - return; -#define z_call_r(func) if (func != ZERR_NONE)\ - return TRUE; - -#define z_call_s(func, err) if (func != ZERR_NONE) {\ - purple_connection_error(gc, err);\ - return;\ - } - -#ifdef WIN32 -extern const char *username; -#endif - -static Code_t zephyr_subscribe_to(zephyr_account* zephyr, char* class, char *instance, char *recipient, char* galaxy) { - size_t result; - Code_t ret_val = -1; - - if (use_tzc(zephyr)) { - /* ((tzcfodder . subscribe) ("class" "instance" "recipient")) */ - gchar *zsubstr = g_strdup_printf("((tzcfodder . subscribe) (\"%s\" \"%s\" \"%s\"))\n",class,instance,recipient); - size_t len = strlen(zsubstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zsubstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write a message: %s\n", g_strerror(errno)); - } else { - ret_val = ZERR_NONE; - } - g_free(zsubstr); - } - else { - if (use_zeph02(zephyr)) { - ZSubscription_t sub; - sub.zsub_class = class; - sub.zsub_classinst = instance; - sub.zsub_recipient = recipient; - ret_val = ZSubscribeTo(&sub,1,0); - } - } - return ret_val; -} - -char *local_zephyr_normalize(zephyr_account* zephyr,const char *); -static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *topic); -char* zephyr_tzc_deescape_str(const char *message); - -static char *zephyr_strip_local_realm(zephyr_account* zephyr,const char* user){ - /* - Takes in a username of the form username or username@realm - and returns: - username, if there is no realm, or the realm is the local realm - or: - username@realm if there is a realm and it is foreign - */ - char *tmp = g_strdup(user); - char *at = strchr(tmp,'@'); - if (at && !g_ascii_strcasecmp(at+1,zephyr->realm)) { - /* We're passed in a username of the form user@users-realm */ - char* tmp2; - *at = '\0'; - tmp2 = g_strdup(tmp); - g_free(tmp); - return tmp2; - } - else { - /* We're passed in a username of the form user or user@foreign-realm */ - return tmp; - } -} - -/* this is so bad, and if Zephyr weren't so fucked up to begin with I - * wouldn't do this. but it is so i will. */ - -/* just for debugging */ -static void handle_unknown(ZNotice_t notice) -{ - purple_debug_error("zephyr","z_packet: %s\n", notice.z_packet); - purple_debug_error("zephyr","z_version: %s\n", notice.z_version); - purple_debug_error("zephyr","z_kind: %d\n", (int)(notice.z_kind)); - purple_debug_error("zephyr","z_class: %s\n", notice.z_class); - purple_debug_error("zephyr","z_class_inst: %s\n", notice.z_class_inst); - purple_debug_error("zephyr","z_opcode: %s\n", notice.z_opcode); - purple_debug_error("zephyr","z_sender: %s\n", notice.z_sender); - purple_debug_error("zephyr","z_recipient: %s\n", notice.z_recipient); - purple_debug_error("zephyr","z_message: %s\n", notice.z_message); - purple_debug_error("zephyr","z_message_len: %d\n", notice.z_message_len); -} - - -static zephyr_triple *new_triple(zephyr_account *zephyr,const char *c, const char *i, const char *r) -{ - zephyr_triple *zt; - - zt = g_new0(zephyr_triple, 1); - zt->class = g_strdup(c); - zt->instance = g_strdup(i); - zt->recipient = g_strdup(r); - zt->name = g_strdup_printf("%s,%s,%s", c, i?i:"", r?r:""); - zt->id = ++(zephyr->last_id); - zt->open = FALSE; - return zt; -} - -static void free_triple(zephyr_triple * zt) -{ - g_free(zt->class); - g_free(zt->instance); - g_free(zt->recipient); - g_free(zt->name); - g_free(zt); -} - -/* returns true if zt1 is a subset of zt2. This function is used to - determine whether a zephyr sent to zt1 should be placed in the chat - with triple zt2 - - zt1 is a subset of zt2 - iff. the classnames are identical ignoring case - AND. the instance names are identical (ignoring case), or zt2->instance is *. - AND. the recipient names are identical -*/ - -static gboolean triple_subset(zephyr_triple * zt1, zephyr_triple * zt2) -{ - - if (!zt2) { - purple_debug_error("zephyr","zt2 doesn't exist\n"); - return FALSE; - } - if (!zt1) { - purple_debug_error("zephyr","zt1 doesn't exist\n"); - return FALSE; - } - if (!(zt1->class)) { - purple_debug_error("zephyr","zt1c doesn't exist\n"); - return FALSE; - } - if (!(zt1->instance)) { - purple_debug_error("zephyr","zt1i doesn't exist\n"); - return FALSE; - } - if (!(zt1->recipient)) { - purple_debug_error("zephyr","zt1r doesn't exist\n"); - return FALSE; - } - if (!(zt2->class)) { - purple_debug_error("zephyr","zt2c doesn't exist\n"); - return FALSE; - } - if (!(zt2->recipient)) { - purple_debug_error("zephyr","zt2r doesn't exist\n"); - return FALSE; - } - if (!(zt2->instance)) { - purple_debug_error("zephyr","zt2i doesn't exist\n"); - return FALSE; - } - - if (g_ascii_strcasecmp(zt2->class, zt1->class)) { - return FALSE; - } - if (g_ascii_strcasecmp(zt2->instance, zt1->instance) && g_ascii_strcasecmp(zt2->instance, "*")) { - return FALSE; - } - if (g_ascii_strcasecmp(zt2->recipient, zt1->recipient)) { - return FALSE; - } - purple_debug_info("zephyr","<%s,%s,%s> is in <%s,%s,%s>\n",zt1->class,zt1->instance,zt1->recipient,zt2->class,zt2->instance,zt2->recipient); - return TRUE; -} - -static zephyr_triple *find_sub_by_triple(zephyr_account *zephyr,zephyr_triple * zt) -{ - zephyr_triple *curr_t; - GSList *curr = zephyr->subscrips; - - while (curr) { - curr_t = curr->data; - if (triple_subset(zt, curr_t)) - return curr_t; - curr = curr->next; - } - return NULL; -} - -static zephyr_triple *find_sub_by_id(zephyr_account *zephyr,int id) -{ - zephyr_triple *zt; - GSList *curr = zephyr->subscrips; - - while (curr) { - zt = curr->data; - if (zt->id == id) - return zt; - curr = curr->next; - } - return NULL; -} - -/* - Converts strings to utf-8 if necessary using user specified encoding -*/ - -static gchar *zephyr_recv_convert(PurpleConnection *gc, gchar *string) -{ - gchar *utf8; - GError *err = NULL; - zephyr_account *zephyr = gc->proto_data; - if (g_utf8_validate(string, -1, NULL)) { - return g_strdup(string); - } else { - utf8 = g_convert(string, -1, "UTF-8", zephyr->encoding, NULL, NULL, &err); - if (err) { - purple_debug_error("zephyr", "recv conversion error: %s\n", err->message); - utf8 = g_strdup(_("(There was an error converting this message. Check the 'Encoding' option in the Account Editor)")); - g_error_free(err); - } - - return utf8; - } -} - -/* This parses HTML formatting (put out by one of the gtkimhtml widgets - And converts it to zephyr formatting. - It currently deals properly with ,
, , , , - It ignores - It does - @small - 3 or 4 @medium() - 5,6, or 7 @large() - " or just "description" as appropriate -*/ - -static char *html_to_zephyr(const char *message) -{ - zframe *frames, *new_f; - char *ret; - - if (*message == '\0') - return g_strdup(""); - - frames = g_new(zframe, 1); - frames->text = g_string_new(""); - frames->href = NULL; - frames->is_href = FALSE; - frames->enclosing = NULL; - frames->closing = NULL; - frames->env = ""; - frames->has_closer = FALSE; - frames->closer_mask = 15; - - purple_debug_info("zephyr","html received %s\n",message); - while (*message) { - if (frames->closing && !g_ascii_strncasecmp(message, frames->closing, strlen(frames->closing))) { - zframe *popped; - message += strlen(frames->closing); - popped = frames; - frames = frames->enclosing; - if (popped->is_href) { - frames->href = popped->text; - } else { - g_string_append(frames->text, popped->env); - if (popped->has_closer) { - g_string_append_c(frames->text, - (popped->closer_mask & 1) ? '{' : - (popped->closer_mask & 2) ? '[' : - (popped->closer_mask & 4) ? '(' : - '<'); - } - g_string_append(frames->text, popped->text->str); - if (popped->href) - { - int text_len = strlen(popped->text->str), href_len = strlen(popped->href->str); - if (!((text_len == href_len && !strncmp(popped->href->str, popped->text->str, text_len)) || - (7 + text_len == href_len && !strncmp(popped->href->str, "http://", 7) && - !strncmp(popped->href->str + 7, popped->text->str, text_len)) || - (7 + text_len == href_len && !strncmp(popped->href->str, "mailto:", 7) && - !strncmp(popped->href->str + 7, popped->text->str, text_len)))) { - g_string_append(frames->text, " <"); - g_string_append(frames->text, popped->href->str); - if (popped->closer_mask & ~8) { - g_string_append_c(frames->text, '>'); - popped->closer_mask &= ~8; - } else { - g_string_append(frames->text, "@{>}"); - } - } - g_string_free(popped->href, TRUE); - } - if (popped->has_closer) { - g_string_append_c(frames->text, - (popped->closer_mask & 1) ? '}' : - (popped->closer_mask & 2) ? ']' : - (popped->closer_mask & 4) ? ')' : - '>'); - } - if (!popped->has_closer) - frames->closer_mask = popped->closer_mask; - g_string_free(popped->text, TRUE); - } - g_free(popped); - } else if (*message == '<') { - if (!g_ascii_strncasecmp(message + 1, "i>", 2)) { - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = ""; - new_f->env = "@i"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - frames = new_f; - message += 3; - } else if (!g_ascii_strncasecmp(message + 1, "b>", 2)) { - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = "
"; - new_f->env = "@b"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - frames = new_f; - message += 3; - } else if (!g_ascii_strncasecmp(message + 1, "br>", 3)) { - g_string_append_c(frames->text, '\n'); - message += 4; - } else if (!g_ascii_strncasecmp(message + 1, "a href=\"", 8)) { - message += 9; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = ""; - new_f->env = ""; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - frames = new_f; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = TRUE; - new_f->closing = "\">"; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - frames = new_f; - } else if (!g_ascii_strncasecmp(message + 1, "font", 4)) { - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = ""; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - message += 5; - while (*message == ' ') - message++; - if (!g_ascii_strncasecmp(message, "color=\"", 7)) { - message += 7; - new_f->env = "@"; - frames = new_f; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->env = "@color"; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = "\">"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - } else if (!g_ascii_strncasecmp(message, "face=\"", 6)) { - message += 6; - new_f->env = "@"; - frames = new_f; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->env = "@font"; - new_f->text = g_string_new(""); - new_f->href = NULL; - new_f->is_href = FALSE; - new_f->closing = "\">"; - new_f->has_closer = TRUE; - new_f->closer_mask = 15; - } else if (!g_ascii_strncasecmp(message, "size=\"", 6)) { - message += 6; - if ((*message == '1') || (*message == '2')) { - new_f->env = "@small"; - } else if ((*message == '3') - || (*message == '4')) { - new_f->env = "@medium"; - } else if ((*message == '5') - || (*message == '6') - || (*message == '7')) { - new_f->env = "@large"; - } else { - new_f->env = ""; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - } - message += 3; - } else { - /* Drop all unrecognized/misparsed font tags */ - new_f->env = ""; - new_f->has_closer = FALSE; - new_f->closer_mask = frames->closer_mask; - while (g_ascii_strncasecmp(message, "\">", 2) != 0) { - message++; - } - if (*message != '\0') - message += 2; - } - frames = new_f; - } else { - /* Catch all for all unrecognized/misparsed tage */ - g_string_append_c(frames->text, *message++); - } - } else if (*message == '@') { - g_string_append(frames->text, "@@"); - message++; - } else if (*message == '}') { - if (frames->closer_mask & ~1) { - frames->closer_mask &= ~1; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@[}]"); - message++; - } - } else if (*message == ']') { - if (frames->closer_mask & ~2) { - frames->closer_mask &= ~2; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@{]}"); - message++; - } - } else if (*message == ')') { - if (frames->closer_mask & ~4) { - frames->closer_mask &= ~4; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@{)}"); - message++; - } - } else if (!g_ascii_strncasecmp(message, ">", 4)) { - if (frames->closer_mask & ~8) { - frames->closer_mask &= ~8; - g_string_append_c(frames->text, *message++); - } else { - g_string_append(frames->text, "@{>}"); - message += 4; - } - } else { - g_string_append_c(frames->text, *message++); - } - } - ret = frames->text->str; - g_string_free(frames->text, FALSE); - g_free(frames); - purple_debug_info("zephyr","zephyr outputted %s\n",ret); - return ret; -} - -/* this parses zephyr formatting and converts it to html. For example, if - * you pass in "@{@color(blue)@i(hello)}" you should get out - * "hello". */ -static char *zephyr_to_html(const char *message) -{ - zframe *frames, *curr; - char *ret; - - frames = g_new(zframe, 1); - frames->text = g_string_new(""); - frames->enclosing = NULL; - frames->closing = ""; - frames->has_closer = FALSE; - frames->closer = NULL; - - while (*message) { - if (*message == '@' && message[1] == '@') { - g_string_append(frames->text, "@"); - message += 2; - } else if (*message == '@') { - int end; - for (end = 1; message[end] && (isalnum(message[end]) || message[end] == '_'); end++); - if (message[end] && - (message[end] == '{' || message[end] == '[' || message[end] == '(' || - !g_ascii_strncasecmp(message + end, "<", 4))) { - zframe *new_f; - char *buf; - buf = g_new0(char, end); - g_snprintf(buf, end, "%s", message + 1); - message += end; - new_f = g_new(zframe, 1); - new_f->enclosing = frames; - new_f->has_closer = TRUE; - new_f->closer = (*message == '{' ? "}" : - *message == '[' ? "]" : - *message == '(' ? ")" : - ">"); - message += (*message == '&' ? 4 : 1); - if (!g_ascii_strcasecmp(buf, "italic") || !g_ascii_strcasecmp(buf, "i")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "small")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "medium")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "large")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "bold") - || !g_ascii_strcasecmp(buf, "b")) { - new_f->text = g_string_new(""); - new_f->closing = ""; - } else if (!g_ascii_strcasecmp(buf, "font")) { - zframe *extra_f; - extra_f = g_new(zframe, 1); - extra_f->enclosing = frames; - new_f->enclosing = extra_f; - extra_f->text = g_string_new(""); - extra_f->has_closer = FALSE; - extra_f->closer = frames->closer; - extra_f->closing = ""; - new_f->text = g_string_new("closing = "\">"; - } else if (!g_ascii_strcasecmp(buf, "color")) { - zframe *extra_f; - extra_f = g_new(zframe, 1); - extra_f->enclosing = frames; - new_f->enclosing = extra_f; - extra_f->text = g_string_new(""); - extra_f->has_closer = FALSE; - extra_f->closer = frames->closer; - extra_f->closing = ""; - new_f->text = g_string_new("closing = "\">"; - } else { - new_f->text = g_string_new(""); - new_f->closing = ""; - } - frames = new_f; - } else { - /* Not a formatting tag, add the character as normal. */ - g_string_append_c(frames->text, *message++); - } - } else if (frames->closer && !g_ascii_strncasecmp(message, frames->closer, strlen(frames->closer))) { - zframe *popped; - gboolean last_had_closer; - - message += strlen(frames->closer); - if (frames && frames->enclosing) { - do { - popped = frames; - frames = frames->enclosing; - g_string_append(frames->text, popped->text->str); - g_string_append(frames->text, popped->closing); - g_string_free(popped->text, TRUE); - last_had_closer = popped->has_closer; - g_free(popped); - } while (frames && frames->enclosing && !last_had_closer); - } else { - g_string_append_c(frames->text, *message); - } - } else if (*message == '\n') { - g_string_append(frames->text, "
"); - message++; - } else { - g_string_append_c(frames->text, *message++); - } - } - /* go through all the stuff that they didn't close */ - while (frames->enclosing) { - curr = frames; - g_string_append(frames->enclosing->text, frames->text->str); - g_string_append(frames->enclosing->text, frames->closing); - g_string_free(frames->text, TRUE); - frames = frames->enclosing; - g_free(curr); - } - ret = frames->text->str; - g_string_free(frames->text, FALSE); - g_free(frames); - return ret; -} - -static gboolean pending_zloc(zephyr_account *zephyr, const char *who) -{ - GList *curr; - - for (curr = zephyr->pending_zloc_names; curr != NULL; curr = curr->next) { - char* normalized_who = local_zephyr_normalize(zephyr,who); - if (!g_ascii_strcasecmp(normalized_who, (char *)curr->data)) { - g_free((char *)curr->data); - zephyr->pending_zloc_names = g_list_remove(zephyr->pending_zloc_names, curr->data); - return TRUE; - } - } - return FALSE; -} - -/* Called when the server notifies us a message couldn't get sent */ - -static void message_failed(PurpleConnection *gc, ZNotice_t notice, struct sockaddr_in from) -{ - if (g_ascii_strcasecmp(notice.z_class, "message")) { - gchar* chat_failed = g_strdup_printf(_("Unable to send to chat %s,%s,%s"),notice.z_class,notice.z_class_inst,notice.z_recipient); - purple_notify_error(gc,"",chat_failed,NULL); - g_free(chat_failed); - } else { - purple_notify_error(gc, notice.z_recipient, _("User is offline"), NULL); - } -} - -static void handle_message(PurpleConnection *gc,ZNotice_t notice) -{ - zephyr_account* zephyr = gc->proto_data; - - if (!g_ascii_strcasecmp(notice.z_class, LOGIN_CLASS)) { - /* well, we'll be updating in 20 seconds anyway, might as well ignore this. */ - } else if (!g_ascii_strcasecmp(notice.z_class, LOCATE_CLASS)) { - if (!g_ascii_strcasecmp(notice.z_opcode, LOCATE_LOCATE)) { - int nlocs; - char *user; - PurpleBuddy *b; - const char *bname; - - /* XXX add real error reporting */ - if (ZParseLocations(¬ice, NULL, &nlocs, &user) != ZERR_NONE) - return; - - if ((b = purple_find_buddy(gc->account, user)) == NULL) { - char* stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account,stripped_user); - g_free(stripped_user); - } - - bname = b ? purple_buddy_get_name(b) : NULL; - if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user)) { - ZLocations_t locs; - int one = 1; - PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); - char *tmp; - const char *balias; - - purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); - balias = purple_buddy_get_local_buddy_alias(b); - if (b && balias) - purple_notify_user_info_add_pair(user_info, _("Alias"), balias); - - if (!nlocs) { - purple_notify_user_info_add_pair(user_info, NULL, _("Hidden or not logged-in")); - } - for (; nlocs > 0; nlocs--) { - /* XXX add real error reporting */ - - ZGetLocations(&locs, &one); - tmp = g_strdup_printf(_("
At %s since %s"), locs.host, locs.time); - purple_notify_user_info_add_pair(user_info, _("Location"), tmp); - g_free(tmp); - } - purple_notify_userinfo(gc, (b ? bname : user), - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } else { - if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); - else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); - } - - g_free(user); - } - } else { - char *buf, *buf2, *buf3; - char *send_inst; - PurpleConversation *gconv1; - PurpleConvChat *gcc; - char *ptr = (char *) notice.z_message + (strlen(notice.z_message) + 1); - int len; - char *stripped_sender; - int signature_length = strlen(notice.z_message); - int message_has_no_body = 0; - PurpleMessageFlags flags = 0; - gchar *tmpescape; - - /* Need to deal with 0 length messages to handle typing notification (OPCODE) ping messages */ - /* One field zephyrs would have caused purple to crash */ - if ( (notice.z_message_len == 0) || (signature_length >= notice.z_message_len - 1)) { - message_has_no_body = 1; - len = 0; - purple_debug_info("zephyr","message_size %d %d %d\n",len,notice.z_message_len,signature_length); - buf3 = g_strdup(""); - - } else { - len = notice.z_message_len - ( signature_length +1); - purple_debug_info("zephyr","message_size %d %d %d\n",len,notice.z_message_len,signature_length); - buf = g_malloc(len + 1); - g_snprintf(buf, len + 1, "%s", ptr); - g_strchomp(buf); - tmpescape = g_markup_escape_text(buf, -1); - g_free(buf); - buf2 = zephyr_to_html(tmpescape); - buf3 = zephyr_recv_convert(gc, buf2); - g_free(buf2); - g_free(tmpescape); - } - - stripped_sender = zephyr_strip_local_realm(zephyr,notice.z_sender); - - if (!g_ascii_strcasecmp(notice.z_class, "MESSAGE") && !g_ascii_strcasecmp(notice.z_class_inst, "PERSONAL") - && !g_ascii_strcasecmp(notice.z_recipient,zephyr->username)) { - if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:")) - flags |= PURPLE_MESSAGE_AUTO_RESP; - - if (!g_ascii_strcasecmp(notice.z_opcode,"PING")) - serv_got_typing(gc,stripped_sender,ZEPHYR_TYPING_RECV_TIMEOUT, PURPLE_TYPING); - else - serv_got_im(gc, stripped_sender, buf3, flags, time(NULL)); - - } else { - zephyr_triple *zt1, *zt2; - gchar *send_inst_utf8; - zephyr_account *zephyr = gc->proto_data; - zt1 = new_triple(gc->proto_data,notice.z_class, notice.z_class_inst, notice.z_recipient); - zt2 = find_sub_by_triple(gc->proto_data,zt1); - if (!zt2) { - /* This is a server supplied subscription */ - zephyr->subscrips = g_slist_append(zephyr->subscrips, new_triple(zephyr,zt1->class,zt1->instance,zt1->recipient)); - zt2 = find_sub_by_triple(gc->proto_data,zt1); - } - - if (!zt2->open) { - zt2->open = TRUE; - serv_got_joined_chat(gc, zt2->id, zt2->name); - zephyr_chat_set_topic(gc,zt2->id,notice.z_class_inst); - } - - if (!g_ascii_strcasecmp(notice.z_class_inst,"PERSONAL")) - send_inst_utf8 = g_strdup(stripped_sender); - else { - send_inst = g_strdup_printf("[%s] %s",notice.z_class_inst,stripped_sender); - send_inst_utf8 = zephyr_recv_convert(gc,send_inst); - g_free(send_inst); - if (!send_inst_utf8) { - purple_debug_error("zephyr","Failed to convert instance for sender %s.\n", stripped_sender); - send_inst_utf8 = g_strdup(stripped_sender); - } - } - - gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, - zt2->name, gc->account); - gcc = purple_conversation_get_chat_data(gconv1); -#ifndef INET_ADDRSTRLEN -#define INET_ADDRSTRLEN 16 -#endif - if (!purple_conv_chat_find_user(gcc, stripped_sender)) { - gchar ipaddr[INET_ADDRSTRLEN]; -#ifdef HAVE_INET_NTOP - inet_ntop(AF_INET, ¬ice.z_sender_addr.s_addr, ipaddr, sizeof(ipaddr)); -#else - memcpy(ipaddr,inet_ntoa(notice.z_sender_addr),sizeof(ipaddr)); -#endif - purple_conv_chat_add_user(gcc, stripped_sender, ipaddr, PURPLE_CBFLAGS_NONE, TRUE); - } - serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL)); - g_free(send_inst_utf8); - - free_triple(zt1); - } - g_free(stripped_sender); - g_free(buf3); - } -} - -static int free_parse_tree(parse_tree* tree) { - if (!tree) { - return 0; - } - else { - int i; - if (tree->children) { - for(i=0;inum_children;i++){ - if (tree->children[i]) { - free_parse_tree(tree->children[i]); - g_free(tree->children[i]); - } - } - } - if ((tree != &null_parse_tree) && (tree->contents != NULL)) - g_free(tree->contents); - - } - return 0; -} - -static parse_tree *tree_child(parse_tree* tree,int index) { - if (index < tree->num_children) { - return tree->children[index]; - } else { - return &null_parse_tree; - } -} - -static parse_tree *find_node(parse_tree* ptree,gchar* key) -{ - gchar* tc; - - if (!ptree || ! key) - return &null_parse_tree; - - tc = tree_child(ptree,0)->contents; - - /* g_strcasecmp() is deprecated. What is the encoding here??? */ - if (ptree->num_children > 0 && tc && !g_ascii_strcasecmp(tc, key)) { - return ptree; - } else { - parse_tree *result = &null_parse_tree; - int i; - for(i = 0; i < ptree->num_children; i++) { - result = find_node(ptree->children[i],key); - if(result != &null_parse_tree) { - break; - } - } - return result; - } -} - -static parse_tree *parse_buffer(gchar* source, gboolean do_parse) { - - parse_tree *ptree = g_new0(parse_tree,1); - ptree->contents = NULL; - ptree->num_children=0; - if (do_parse) { - unsigned int p = 0; - while(p < strlen(source)) { - unsigned int end; - gchar *newstr; - - /* Eat white space: */ - if(g_ascii_isspace(source[p]) || source[p] == '\001') { - p++; - continue; - } - - /* Skip comments */ - if(source[p] == ';') { - while(source[p] != '\n' && p < strlen(source)) { - p++; - } - continue; - } - - if(source[p] == '(') { - int nesting = 0; - gboolean in_quote = FALSE; - gboolean escape_next = FALSE; - p++; - end = p; - while(!(source[end] == ')' && nesting == 0 && !in_quote) && end < strlen(source)) { - if(!escape_next) { - if(source[end] == '\\') { - escape_next = TRUE; - } - if(!in_quote) { - if(source[end] == '(') { - nesting++; - } - if(source[end] == ')') { - nesting--; - } - } - if(source[end] == '"') { - in_quote = !in_quote; - } - } else { - escape_next = FALSE; - } - end++; - } - do_parse = TRUE; - - } else { - gchar end_char; - if(source[p] == '"') { - end_char = '"'; - p++; - } else { - end_char = ' '; - } - do_parse = FALSE; - - end = p; - while(source[end] != end_char && end < strlen(source)) { - if(source[end] == '\\') - end++; - end++; - } - } - newstr = g_new0(gchar, end+1-p); - strncpy(newstr,source+p,end-p); - if (ptree->num_children < MAXCHILDREN) { - /* In case we surpass maxchildren, ignore this */ - ptree->children[ptree->num_children++] = parse_buffer( newstr, do_parse); - } else { - purple_debug_error("zephyr","too many children in tzc output. skipping\n"); - } - g_free(newstr); - p = end + 1; - } - return ptree; - } else { - /* XXX does this have to be strdup'd */ - ptree->contents = g_strdup(source); - return ptree; - } -} - -static parse_tree *read_from_tzc(zephyr_account* zephyr){ - struct timeval tv; - fd_set rfds; - int bufsize = 2048; - char *buf = (char *)calloc(bufsize, 1); - char *bufcur = buf; - int selected = 0; - parse_tree *incoming_msg; - - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - incoming_msg=NULL; - - while (select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, &tv)) { - selected = 1; - read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1); - bufcur++; - if ((bufcur - buf) > (bufsize - 1)) { - if ((buf = realloc(buf, bufsize * 2)) == NULL) { - purple_debug_error("zephyr","Ran out of memory\n"); - exit(-1); - } else { - bufcur = buf + bufsize; - bufsize *= 2; - } - } - } - *bufcur = '\0'; - - if (selected) { - incoming_msg = parse_buffer(buf,TRUE); - } - free(buf); - return incoming_msg; -} - -static gint check_notify_tzc(gpointer data) -{ - PurpleConnection *gc = (PurpleConnection *)data; - zephyr_account* zephyr = gc->proto_data; - parse_tree *newparsetree = read_from_tzc(zephyr); - if (newparsetree != NULL) { - gchar *spewtype; - if ( (spewtype = tree_child(find_node(newparsetree,"tzcspew"),2)->contents) ) { - if (!g_ascii_strncasecmp(spewtype,"message",7)) { - ZNotice_t notice; - parse_tree *msgnode = tree_child(find_node(newparsetree,"message"),2); - parse_tree *bodynode = tree_child(msgnode,1); - /* char *zsig = g_strdup(" "); */ /* purple doesn't care about zsigs */ - char *msg = zephyr_tzc_deescape_str(bodynode->contents); - size_t bufsize = strlen(msg) + 3; - char *buf = g_new0(char,bufsize); - g_snprintf(buf,1+strlen(msg)+2," %c%s",'\0',msg); - memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = ACKED; - notice.z_port = 0; - notice.z_opcode = tree_child(find_node(newparsetree,"opcode"),2)->contents; - notice.z_class = zephyr_tzc_deescape_str(tree_child(find_node(newparsetree,"class"),2)->contents); - notice.z_class_inst = tree_child(find_node(newparsetree,"instance"),2)->contents; - notice.z_recipient = local_zephyr_normalize(zephyr,tree_child(find_node(newparsetree,"recipient"),2)->contents); - notice.z_sender = local_zephyr_normalize(zephyr,tree_child(find_node(newparsetree,"sender"),2)->contents); - notice.z_default_format = "Class $class, Instance $instance:\n" "To: @bold($recipient) at $time $date\n" "From: @bold($1) <$sender>\n\n$2"; - notice.z_message_len = strlen(msg) + 3; - notice.z_message = buf; - handle_message(gc, notice); - g_free(msg); - /* g_free(zsig); */ - g_free(buf); - /* free_parse_tree(msgnode); - free_parse_tree(bodynode); - g_free(msg); - g_free(zsig); - g_free(buf); - */ - } - else if (!g_ascii_strncasecmp(spewtype,"zlocation",9)) { - /* check_loc or zephyr_zloc respectively */ - /* XXX fix */ - char *user; - PurpleBuddy *b; - const char *bname; - int nlocs = 0; - parse_tree *locations; - gchar *locval; - user = tree_child(find_node(newparsetree,"user"),2)->contents; - - if ((b = purple_find_buddy(gc->account, user)) == NULL) { - gchar *stripped_user = zephyr_strip_local_realm(zephyr,user); - b = purple_find_buddy(gc->account, stripped_user); - g_free(stripped_user); - } - locations = find_node(newparsetree,"locations"); - locval = tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents; - - if (!locval || !g_ascii_strcasecmp(locval," ") || (strlen(locval) == 0)) { - nlocs = 0; - } else { - nlocs = 1; - } - - bname = b ? purple_buddy_get_name(b) : NULL; - if ((b && pending_zloc(zephyr,bname)) || pending_zloc(zephyr,user) || pending_zloc(zephyr,local_zephyr_normalize(zephyr,user))){ - PurpleNotifyUserInfo *user_info = purple_notify_user_info_new(); - char *tmp; - const char *balias; - - purple_notify_user_info_add_pair(user_info, _("User"), (b ? bname : user)); - - balias = b ? purple_buddy_get_local_buddy_alias(b) : NULL; - if (balias) - purple_notify_user_info_add_pair(user_info, _("Alias"), balias); - - if (!nlocs) { - purple_notify_user_info_add_pair(user_info, NULL, _("Hidden or not logged-in")); - } else { - tmp = g_strdup_printf(_("
At %s since %s"), - tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents, - tree_child(tree_child(tree_child(tree_child(locations,2),0),2),2)->contents); - purple_notify_user_info_add_pair(user_info, _("Location"), tmp); - g_free(tmp); - } - - purple_notify_userinfo(gc, b ? bname : user, - user_info, NULL, NULL); - purple_notify_user_info_destroy(user_info); - } else { - if (nlocs>0) - purple_prpl_got_user_status(gc->account, b ? bname : user, "available", NULL); - else - purple_prpl_got_user_status(gc->account, b ? bname : user, "offline", NULL); - } - } - else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { - } - else if (!g_ascii_strncasecmp(spewtype,"start",5)) { - } - else if (!g_ascii_strncasecmp(spewtype,"error",5)) { - /* XXX handle */ - } - } else { - } - } else { - } - - free_parse_tree(newparsetree); - return TRUE; -} - -static gint check_notify_zeph02(gpointer data) -{ - /* XXX add real error reporting */ - PurpleConnection *gc = (PurpleConnection*) data; - while (ZPending()) { - ZNotice_t notice; - struct sockaddr_in from; - /* XXX add real error reporting */ - - z_call_r(ZReceiveNotice(¬ice, &from)); - - switch (notice.z_kind) { - case UNSAFE: - case UNACKED: - case ACKED: - handle_message(gc,notice); - break; - case SERVACK: - if (!(g_ascii_strcasecmp(notice.z_message, ZSRVACK_NOTSENT))) { - message_failed(gc,notice, from); - } - break; - case CLIENTACK: - purple_debug_error("zephyr", "Client ack received\n"); - default: - /* we'll just ignore things for now */ - handle_unknown(notice); - purple_debug_error("zephyr", "Unhandled notice.\n"); - break; - } - /* XXX add real error reporting */ - ZFreeNotice(¬ice); - } - - return TRUE; -} - -#ifdef WIN32 - -static gint check_loc(gpointer data) -{ - GSList *buddies; - ZLocations_t locations; - PurpleConnection *gc = data; - zephyr_account *zephyr = gc->proto_data; - PurpleAccount *account = purple_connection_get_account(gc); - int numlocs; - int one = 1; - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *b = buddies->data; - char *chk; - const char *bname = purple_buddy_get_name(b); - chk = local_zephyr_normalize(bname); - ZLocateUser(chk,&numlocs, ZAUTH); - if (numlocs) { - int i; - for(i=0;iproto_data; - PurpleAccount *account = purple_connection_get_account(gc); - - if (use_zeph02(zephyr)) { - ald.user = NULL; - memset(&(ald.uid), 0, sizeof(ZUnique_Id_t)); - ald.version = NULL; - } - - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *b = buddies->data; - - const char *chk; - const char *name = purple_buddy_get_name(b); - - chk = local_zephyr_normalize(zephyr,name); - purple_debug_info("zephyr","chk: %s b->name %s\n",chk,name); - /* XXX add real error reporting */ - /* doesn't matter if this fails or not; we'll just move on to the next one */ - if (use_zeph02(zephyr)) { -#ifdef WIN32 - int numlocs; - int one=1; - ZLocateUser(chk,&numlocs,ZAUTH); - if (numlocs) { - int i; - for(i=0;i0) - purple_prpl_got_user_status(account,name,"available",NULL); - else - purple_prpl_got_user_status(account,name,"offline",NULL); - } - } -#else - ZRequestLocations(chk, &ald, UNACKED, ZAUTH); - g_free(ald.user); - g_free(ald.version); -#endif /* WIN32 */ - } else - if (use_tzc(zephyr)) { - gchar *zlocstr = g_strdup_printf("((tzcfodder . zlocate) \"%s\")\n",chk); - size_t len = strlen(zlocstr); - size_t result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zlocstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write a message: %s\n", g_strerror(errno)); - } - g_free(zlocstr); - } - } - - return TRUE; -} - -#endif /* WIN32 */ - -static char *get_exposure_level(void) -{ - /* XXX add real error reporting */ - char *exposure = ZGetVariable("exposure"); - - if (!exposure) - return EXPOSE_REALMVIS; - if (!g_ascii_strcasecmp(exposure, EXPOSE_NONE)) - return EXPOSE_NONE; - if (!g_ascii_strcasecmp(exposure, EXPOSE_OPSTAFF)) - return EXPOSE_OPSTAFF; - if (!g_ascii_strcasecmp(exposure, EXPOSE_REALMANN)) - return EXPOSE_REALMANN; - if (!g_ascii_strcasecmp(exposure, EXPOSE_NETVIS)) - return EXPOSE_NETVIS; - if (!g_ascii_strcasecmp(exposure, EXPOSE_NETANN)) - return EXPOSE_NETANN; - return EXPOSE_REALMVIS; -} - -static void strip_comments(char *str) -{ - char *tmp = strchr(str, '#'); - - if (tmp) - *tmp = '\0'; - g_strchug(str); - g_strchomp(str); -} - -static void zephyr_inithosts(zephyr_account *zephyr) -{ - /* XXX This code may not be Win32 clean */ - struct hostent *hent; - - if (gethostname(zephyr->ourhost, sizeof(zephyr->ourhost)) == -1) { - purple_debug_error("zephyr", "unable to retrieve hostname, %%host%% and %%canon%% will be wrong in subscriptions and have been set to unknown\n"); - g_strlcpy(zephyr->ourhost, "unknown", sizeof(zephyr->ourhost)); - g_strlcpy(zephyr->ourhostcanon, "unknown", sizeof(zephyr->ourhostcanon)); - return; - } - - if (!(hent = gethostbyname(zephyr->ourhost))) { - purple_debug_error("zephyr", "unable to resolve hostname, %%canon%% will be wrong in subscriptions.and has been set to the value of %%host%%, %s\n",zephyr->ourhost); - g_strlcpy(zephyr->ourhostcanon, zephyr->ourhost, sizeof(zephyr->ourhostcanon)); - return; - } - - g_strlcpy(zephyr->ourhostcanon, hent->h_name, sizeof(zephyr->ourhostcanon)); - - return; -} - -static void process_zsubs(zephyr_account *zephyr) -{ - /* Loads zephyr chats "(subscriptions) from ~/.zephyr.subs, and - registers (subscribes to) them on the server */ - - /* XXX deal with unsubscriptions */ - /* XXX deal with punts */ - - FILE *f; - gchar *fname; - gchar buff[BUFSIZ]; - - fname = g_strdup_printf("%s/.zephyr.subs", purple_home_dir()); - f = g_fopen(fname, "r"); - if (f) { - char **triple; - char *recip; - char *z_class; - char *z_instance; - char *z_galaxy = NULL; - - while (fgets(buff, BUFSIZ, f)) { - strip_comments(buff); - if (buff[0]) { - triple = g_strsplit(buff, ",", 3); - if (triple[0] && triple[1]) { - char *tmp = g_strdup_printf("%s", zephyr->username); - char *atptr; - - z_class = triple[0]; - z_instance = triple[1]; - if (triple[2] == NULL) { - recip = g_malloc0(1); - } else if (!g_ascii_strcasecmp(triple[2], "%me%")) { - recip = g_strdup_printf("%s", zephyr->username); - } else if (!g_ascii_strcasecmp(triple[2], "*")) { - /* wildcard - * form of class,instance,* */ - recip = g_malloc0(1); - } else if (!g_ascii_strcasecmp(triple[2], tmp)) { - /* form of class,instance,aatharuv@ATHENA.MIT.EDU */ - recip = g_strdup(triple[2]); - } else if ((atptr = strchr(triple[2], '@')) != NULL) { - /* form of class,instance,*@ANDREW.CMU.EDU - * class,instance,@ANDREW.CMU.EDU - * If realm is local realm, blank recipient, else - * @REALM-NAME - */ - char *realmat = g_strdup_printf("@%s",zephyr->realm); - - if (!g_ascii_strcasecmp(atptr, realmat)) - recip = g_malloc0(1); - else - recip = g_strdup(atptr); - g_free(realmat); - } else { - recip = g_strdup(triple[2]); - } - g_free(tmp); - - if (!g_ascii_strcasecmp(triple[0],"%host%")) { - z_class = g_strdup(zephyr->ourhost); - } else if (!g_ascii_strcasecmp(triple[0],"%canon%")) { - z_class = g_strdup(zephyr->ourhostcanon); - } else { - z_class = g_strdup(triple[0]); - } - - if (!g_ascii_strcasecmp(triple[1],"%host%")) { - z_instance = g_strdup(zephyr->ourhost); - } else if (!g_ascii_strcasecmp(triple[1],"%canon%")) { - z_instance = g_strdup(zephyr->ourhostcanon); - } else { - z_instance = g_strdup(triple[1]); - } - - /* There should be some sort of error report listing classes that couldn't be subbed to. - Not important right now though */ - - if (zephyr_subscribe_to(zephyr,z_class, z_instance, recip,z_galaxy) != ZERR_NONE) { - - purple_debug_error("zephyr", "Couldn't subscribe to %s, %s, %s\n", z_class,z_instance,recip); - } - - zephyr->subscrips = g_slist_append(zephyr->subscrips, new_triple(zephyr,z_class,z_instance,recip)); - /* g_hash_table_destroy(sub_hash_table); */ - g_free(z_instance); - g_free(z_class); - g_free(recip); - } - g_strfreev(triple); - } - } - fclose(f); - } -} - -static void process_anyone(PurpleConnection *gc) -{ - FILE *fd; - gchar buff[BUFSIZ], *filename; - PurpleGroup *g; - PurpleBuddy *b; - - if (!(g = purple_find_group(_("Anyone")))) { - g = purple_group_new(_("Anyone")); - purple_blist_add_group(g, NULL); - } - - filename = g_strconcat(purple_home_dir(), "/.anyone", NULL); - if ((fd = g_fopen(filename, "r")) != NULL) { - while (fgets(buff, BUFSIZ, fd)) { - strip_comments(buff); - if (buff[0]) { - if (!(b = purple_find_buddy(gc->account, buff))) { - char *stripped_user = zephyr_strip_local_realm(gc->proto_data,buff); - purple_debug_info("zephyr","stripped_user %s\n",stripped_user); - if (!(b = purple_find_buddy(gc->account,stripped_user))){ - b = purple_buddy_new(gc->account, stripped_user, NULL); - purple_blist_add_buddy(b, NULL, g, NULL); - } - g_free(stripped_user); - } - } - } - fclose(fd); - } - g_free(filename); -} - -static char* normalize_zephyr_exposure(const char* exposure) { - char *exp2 = g_strstrip(g_ascii_strup(exposure,-1)); - - if (!exp2) - return EXPOSE_REALMVIS; - if (!g_ascii_strcasecmp(exp2, EXPOSE_NONE)) - return EXPOSE_NONE; - if (!g_ascii_strcasecmp(exp2, EXPOSE_OPSTAFF)) - return EXPOSE_OPSTAFF; - if (!g_ascii_strcasecmp(exp2, EXPOSE_REALMANN)) - return EXPOSE_REALMANN; - if (!g_ascii_strcasecmp(exp2, EXPOSE_NETVIS)) - return EXPOSE_NETVIS; - if (!g_ascii_strcasecmp(exp2, EXPOSE_NETANN)) - return EXPOSE_NETANN; - return EXPOSE_REALMVIS; -} - -static void zephyr_login(PurpleAccount * account) -{ - PurpleConnection *gc; - zephyr_account *zephyr; - gboolean read_anyone; - gboolean read_zsubs; - gchar *exposure; - - gc = purple_account_get_connection(account); - read_anyone = purple_account_get_bool(gc->account,"read_anyone",TRUE); - read_zsubs = purple_account_get_bool(gc->account,"read_zsubs",TRUE); - exposure = (gchar *)purple_account_get_string(gc->account, "exposure_level", EXPOSE_REALMVIS); - -#ifdef WIN32 - username = purple_account_get_username(account); -#endif - gc->flags |= PURPLE_CONNECTION_AUTO_RESP | PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; - gc->proto_data = zephyr=g_new0(zephyr_account,1); - - zephyr->account = account; - - /* Make sure that the exposure (visibility) is set to a sane value */ - zephyr->exposure=g_strdup(normalize_zephyr_exposure(exposure)); - - if (purple_account_get_bool(gc->account,"use_tzc",0)) { - zephyr->connection_type = PURPLE_ZEPHYR_TZC; - } else { - zephyr->connection_type = PURPLE_ZEPHYR_KRB4; - } - - zephyr->encoding = (char *)purple_account_get_string(gc->account, "encoding", ZEPHYR_FALLBACK_CHARSET); - purple_connection_update_progress(gc, _("Connecting"), 0, 8); - - /* XXX z_call_s should actually try to report the com_err determined error */ - if (use_tzc(zephyr)) { - pid_t pid; - /* purple_connection_error(gc,"tzc not supported yet"); */ - if ((pipe(zephyr->totzc) != 0) || (pipe(zephyr->fromtzc) != 0)) { - purple_debug_error("zephyr", "pipe creation failed. killing\n"); - exit(-1); - } - - pid = fork(); - - if (pid == -1) { - purple_debug_error("zephyr", "forking failed\n"); - exit(-1); - } - if (pid == 0) { - unsigned int i=0; - gboolean found_ps = FALSE; - gchar ** tzc_cmd_array = g_strsplit(purple_account_get_string(gc->account,"tzc_command","/usr/bin/tzc -e %s")," ",0); - if (close(1) == -1) { - exit(-1); - } - if (dup2(zephyr->fromtzc[1], 1) == -1) { - exit(-1); - } - if (close(zephyr->fromtzc[1]) == -1) { - exit(-1); - } - if (close(0) == -1) { - exit(-1); - } - if (dup2(zephyr->totzc[0], 0) == -1) { - exit(-1); - } - if (close(zephyr->totzc[0]) == -1) { - exit(-1); - } - /* tzc_command should really be of the form - path/to/tzc -e %s - or - ssh username@hostname pathtotzc -e %s - -- this should not require a password, and ideally should be kerberized ssh -- - or - fsh username@hostname pathtotzc -e %s - */ - while(tzc_cmd_array[i] != NULL){ - if (!g_ascii_strncasecmp(tzc_cmd_array[i],"%s",2)) { - /* fprintf(stderr,"replacing %%s with %s\n",zephyr->exposure); */ - tzc_cmd_array[i] = g_strdup(zephyr->exposure); - found_ps = TRUE; - - } else { - /* fprintf(stderr,"keeping %s\n",tzc_cmd_array[i]); */ - } - i++; - } - - if (!found_ps) { - exit(-1); - } - - execvp(tzc_cmd_array[0], tzc_cmd_array); - exit(-1); - } - else { - fd_set rfds; - int bufsize = 2048; - char *buf = (char *)calloc(bufsize, 1); - char *bufcur = buf; - struct timeval tv; - char *ptr; - int parenlevel=0; - char* tempstr; - int tempstridx; - int select_status; - - zephyr->tzc_pid = pid; - /* wait till we have data to read from ssh */ - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - - tv.tv_sec = 10; - tv.tv_usec = 0; - - purple_debug_info("zephyr", "about to read from tzc\n"); - - if (waitpid(pid, NULL, WNOHANG) == 0) { /* Only select if tzc is still running */ - purple_debug_info("zephyr", "about to read from tzc\n"); - select_status = select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, NULL); - } - else { - purple_debug_info("zephyr", "tzc exited early\n"); - select_status = -1; - } - - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - while (select_status > 0 && - select(zephyr->fromtzc[ZEPHYR_FD_READ] + 1, &rfds, NULL, NULL, &tv) > 0) { - read(zephyr->fromtzc[ZEPHYR_FD_READ], bufcur, 1); - bufcur++; - if ((bufcur - buf) > (bufsize - 1)) { - if ((buf = realloc(buf, bufsize * 2)) == NULL) { - exit(-1); - } else { - bufcur = buf + bufsize; - bufsize *= 2; - } - } - FD_ZERO(&rfds); - FD_SET(zephyr->fromtzc[ZEPHYR_FD_READ], &rfds); - tv.tv_sec = 10; - tv.tv_usec = 0; - - } - /* fprintf(stderr, "read from tzc\n"); */ - *bufcur = '\0'; - ptr = buf; - - /* ignore all tzcoutput till we've received the first (*/ - while (ptr < bufcur && (*ptr !='(')) { - ptr++; - } - if (ptr >=bufcur) { - purple_connection_error(gc,"invalid output by tzc (or bad parsing code)"); - free(buf); - return; - } - - while(ptr < bufcur) { - if (*ptr == '(') { - parenlevel++; - } - else if (*ptr == ')') { - parenlevel--; - } - purple_debug_info("zephyr","tzc parenlevel is %d\n",parenlevel); - switch (parenlevel) { - case 0: - break; - case 1: - /* Search for next beginning (, or for the ending */ - ptr++; - while((*ptr != '(') && (*ptr != ')') && (ptr = bufcur) - purple_debug_error("zephyr","tzc parsing error\n"); - break; - case 2: - /* You are probably at - (foo . bar ) or (foo . "bar") or (foo . chars) or (foo . numbers) or (foo . () ) - Parse all the data between the first and last f, and move past ) - */ - tempstr = g_malloc0(20000); - tempstridx=0; - while(parenlevel >1) { - ptr++; - if (*ptr == '(') - parenlevel++; - if (*ptr == ')') - parenlevel--; - if (parenlevel > 1) { - tempstr[tempstridx++]=*ptr; - } else { - ptr++; - } - } - purple_debug_info("zephyr","tempstr parsed\n"); - /* tempstr should now be a tempstridx length string containing all characters - from that after the first ( to the one before the last paren ). */ - /* We should have the following possible lisp strings but we don't care - (tzcspew . start) (version . "something") (pid . number)*/ - /* We care about 'zephyrid . "username@REALM.NAME"' and 'exposure . "SOMETHING"' */ - tempstridx=0; - if (!g_ascii_strncasecmp(tempstr,"zephyrid",8)) { - gchar* username = g_malloc0(100); - int username_idx=0; - char *realm; - purple_debug_info("zephyr","zephyrid found\n"); - tempstridx+=8; - while(tempstr[tempstridx] !='"' && tempstridx < 20000) - tempstridx++; - tempstridx++; - while(tempstr[tempstridx] !='"' && tempstridx < 20000) - username[username_idx++]=tempstr[tempstridx++]; - - zephyr->username = g_strdup_printf("%s",username); - if ((realm = strchr(username,'@'))) - zephyr->realm = g_strdup_printf("%s",realm+1); - else { - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); - if (!*realm) { - realm = "local-realm"; - } - zephyr->realm = g_strdup(realm); - g_strlcpy(__Zephyr_realm, (const char*)zephyr->realm, REALM_SZ-1); - } - /* else { - zephyr->realm = g_strdup("local-realm"); - }*/ - - g_free(username); - } else { - purple_debug_info("zephyr", "something that's not zephyr id found %s\n",tempstr); - } - - /* We don't care about anything else yet */ - g_free(tempstr); - break; - default: - purple_debug_info("zephyr","parenlevel is not 1 or 2\n"); - /* This shouldn't be happening */ - break; - } - if (parenlevel==0) - break; - } /* while (ptr < bufcur) */ - purple_debug_info("zephyr", "tzc startup done\n"); - free(buf); - } - } - else if ( use_zeph02(zephyr)) { - gchar* realm; - z_call_s(ZInitialize(), "Couldn't initialize zephyr"); - z_call_s(ZOpenPort(&(zephyr->port)), "Couldn't open port"); - z_call_s(ZSetLocation((char *)zephyr->exposure), "Couldn't set location"); - - realm = (gchar *)purple_account_get_string(gc->account,"realm",""); - if (!*realm) { - realm = ZGetRealm(); - } - zephyr->realm = g_strdup(realm); - g_strlcpy(__Zephyr_realm, (const char*)zephyr->realm, REALM_SZ-1); - zephyr->username = g_strdup(ZGetSender()); - - /* zephyr->realm = g_strdup(ZGetRealm()); */ - purple_debug_info("zephyr","realm: %s\n",zephyr->realm); - } - else { - purple_connection_error(gc,"Only ZEPH0.2 supported currently"); - return; - } - purple_debug_info("zephyr","does it get here\n"); - purple_debug_info("zephyr"," realm: %s username:%s\n", zephyr->realm, zephyr->username); - - /* For now */ - zephyr->galaxy = NULL; - zephyr->krbtkfile = NULL; - zephyr_inithosts(zephyr); - - if (zephyr_subscribe_to(zephyr,"MESSAGE","PERSONAL",zephyr->username,NULL) != ZERR_NONE) { - /* XXX don't translate this yet. It could be written better */ - /* XXX error messages could be handled with more detail */ - purple_notify_error(account->gc, NULL, - "Unable to subscribe to messages", "Unable to subscribe to initial messages"); - return; - } - - purple_connection_set_state(gc, PURPLE_CONNECTED); - - if (read_anyone) - process_anyone(gc); - if (read_zsubs) - process_zsubs(zephyr); - - if (use_zeph02(zephyr)) { - zephyr->nottimer = purple_timeout_add(100, check_notify_zeph02, gc); - } else if (use_tzc(zephyr)) { - zephyr->nottimer = purple_timeout_add(100, check_notify_tzc, gc); - } - zephyr->loctimer = purple_timeout_add_seconds(20, check_loc, gc); - -} - -static void write_zsubs(zephyr_account *zephyr) -{ - /* Exports subscription (chat) list back to - * .zephyr.subs - * XXX deal with %host%, %canon%, unsubscriptions, and negative subscriptions (punts?) - */ - - GSList *s = zephyr->subscrips; - zephyr_triple *zt; - FILE *fd; - char *fname; - - char **triple; - - fname = g_strdup_printf("%s/.zephyr.subs", purple_home_dir()); - fd = g_fopen(fname, "w"); - - if (!fd) { - g_free(fname); - return; - } - - while (s) { - char *zclass, *zinst, *zrecip; - zt = s->data; - triple = g_strsplit(zt->name, ",", 3); - - /* deal with classes */ - if (!g_ascii_strcasecmp(triple[0],zephyr->ourhost)) { - zclass = g_strdup("%host%"); - } else if (!g_ascii_strcasecmp(triple[0],zephyr->ourhostcanon)) { - zclass = g_strdup("%canon%"); - } else { - zclass = g_strdup(triple[0]); - } - - /* deal with instances */ - - if (!g_ascii_strcasecmp(triple[1],zephyr->ourhost)) { - zinst = g_strdup("%host%"); - } else if (!g_ascii_strcasecmp(triple[1],zephyr->ourhostcanon)) { - zinst = g_strdup("%canon%");; - } else { - zinst = g_strdup(triple[1]); - } - - /* deal with recipients */ - if (triple[2] == NULL) { - zrecip = g_strdup("*"); - } else if (!g_ascii_strcasecmp(triple[2],"")){ - zrecip = g_strdup("*"); - } else if (!g_ascii_strcasecmp(triple[2], zephyr->username)) { - zrecip = g_strdup("%me%"); - } else { - zrecip = g_strdup(triple[2]); - } - - fprintf(fd, "%s,%s,%s\n",zclass,zinst,zrecip); - - g_free(zclass); - g_free(zinst); - g_free(zrecip); - g_free(triple); - s = s->next; - } - g_free(fname); - fclose(fd); -} - -static void write_anyone(PurpleConnection *gc) -{ - GSList *buddies; - char *fname; - FILE *fd; - PurpleAccount *account; - zephyr_account* zephyr = gc->proto_data; - fname = g_strdup_printf("%s/.anyone", purple_home_dir()); - fd = g_fopen(fname, "w"); - if (!fd) { - g_free(fname); - return; - } - - account = purple_connection_get_account(gc); - for (buddies = purple_find_buddies(account, NULL); buddies; - buddies = g_slist_delete_link(buddies, buddies)) { - PurpleBuddy *b = buddies->data; - gchar *stripped_user = zephyr_strip_local_realm(zephyr, purple_buddy_get_name(b)); - fprintf(fd, "%s\n", stripped_user); - g_free(stripped_user); - } - - fclose(fd); - g_free(fname); -} - -static void zephyr_close(PurpleConnection * gc) -{ - GList *l; - GSList *s; - zephyr_account *zephyr = gc->proto_data; - pid_t tzc_pid = zephyr->tzc_pid; - - l = zephyr->pending_zloc_names; - while (l) { - g_free((char *)l->data); - l = l->next; - } - g_list_free(zephyr->pending_zloc_names); - - if (purple_account_get_bool(gc->account, "write_anyone", FALSE)) - write_anyone(gc); - - if (purple_account_get_bool(gc->account, "write_zsubs", FALSE)) - write_zsubs(gc->proto_data); - - s = zephyr->subscrips; - while (s) { - free_triple((zephyr_triple *) s->data); - s = s->next; - } - g_slist_free(zephyr->subscrips); - - if (zephyr->nottimer) - purple_timeout_remove(zephyr->nottimer); - zephyr->nottimer = 0; - if (zephyr->loctimer) - purple_timeout_remove(zephyr->loctimer); - zephyr->loctimer = 0; - gc = NULL; - if (use_zeph02(zephyr)) { - z_call(ZCancelSubscriptions(0)); - z_call(ZUnsetLocation()); - z_call(ZClosePort()); - } else { - /* assume tzc */ - if (kill(tzc_pid,SIGTERM) == -1) { - int err=errno; - if (err==EINVAL) { - purple_debug_error("zephyr","An invalid signal was specified when killing tzc\n"); - } - else if (err==ESRCH) { - purple_debug_error("zephyr","Tzc's pid didn't exist while killing tzc\n"); - } - else if (err==EPERM) { - purple_debug_error("zephyr","purple didn't have permission to kill tzc\n"); - } - else { - purple_debug_error("zephyr","miscellaneous error while attempting to close tzc\n"); - } - } - } -} - -static int zephyr_send_message(zephyr_account *zephyr,char* zclass, char* instance, char* recipient, const char *im, - const char *sig, char *opcode) ; - -static const char * zephyr_get_signature(void) -{ - /* XXX add zephyr error reporting */ - const char * sig =ZGetVariable("zwrite-signature"); - if (!sig) { - sig = g_get_real_name(); - } - return sig; -} - -static int zephyr_chat_send(PurpleConnection * gc, int id, const char *im, PurpleMessageFlags flags) -{ - zephyr_triple *zt; - const char *sig; - PurpleConversation *gconv1; - PurpleConvChat *gcc; - char *inst; - char *recipient; - zephyr_account *zephyr = gc->proto_data; - - zt = find_sub_by_id(gc->proto_data,id); - if (!zt) - /* this should never happen. */ - return -EINVAL; - - sig = zephyr_get_signature(); - - gconv1 = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); - gcc = purple_conversation_get_chat_data(gconv1); - - if (!(inst = (char *)purple_conv_chat_get_topic(gcc))) - inst = g_strdup("PERSONAL"); - - if (!g_ascii_strcasecmp(zt->recipient, "*")) - recipient = local_zephyr_normalize(zephyr,""); - else - recipient = local_zephyr_normalize(zephyr,zt->recipient); - - zephyr_send_message(zephyr,zt->class,inst,recipient,im,sig,""); - return 0; -} - - -static int zephyr_send_im(PurpleConnection * gc, const char *who, const char *im, PurpleMessageFlags flags) -{ - const char *sig; - zephyr_account *zephyr = gc->proto_data; - if (flags & PURPLE_MESSAGE_AUTO_RESP) - sig = "Automated reply:"; - else { - sig = zephyr_get_signature(); - } - zephyr_send_message(zephyr,"MESSAGE","PERSONAL",local_zephyr_normalize(zephyr,who),im,sig,""); - - return 1; -} - -/* Munge the outgoing zephyr so that any quotes or backslashes are - escaped and do not confuse tzc: */ - -static char* zephyr_tzc_escape_msg(const char *message) -{ - int pos = 0; - int pos2 = 0; - char *newmsg; - - if (message && (strlen(message) > 0)) { - newmsg = g_new0(char,1+strlen(message)*2); - while(pos < strlen(message)) { - if (message[pos]=='\\') { - newmsg[pos2]='\\'; - newmsg[pos2+1]='\\'; - pos2+=2; - } - else if (message[pos]=='"') { - newmsg[pos2]='\\'; - newmsg[pos2+1]='"'; - pos2+=2; - } - else { - newmsg[pos2] = message[pos]; - pos2++; - } - pos++; - } - } else { - newmsg = g_strdup(""); - } - /* fprintf(stderr,"newmsg %s message %s\n",newmsg,message); */ - return newmsg; -} - -char* zephyr_tzc_deescape_str(const char *message) -{ - int pos = 0; - int pos2 = 0; - char *newmsg; - - if (message && (strlen(message) > 0)) { - newmsg = g_new0(char,strlen(message)+1); - while(pos < strlen(message)) { - if (message[pos]=='\\') { - pos++; - } - newmsg[pos2] = message[pos]; - pos++;pos2++; - } - newmsg[pos2]='\0'; - } else { - newmsg = g_strdup(""); - } - - return newmsg; -} - -static int zephyr_send_message(zephyr_account *zephyr,char* zclass, char* instance, char* recipient, const char *im, - const char *sig, char *opcode) -{ - - /* (From the tzc source) - * emacs sends something of the form: - * ((class . "MESSAGE") - * (auth . t) - * (recipients ("PERSONAL" . "bovik") ("test" . "")) - * (sender . "bovik") - * (message . ("Harry Bovik" "my zgram")) - * ) - */ - char *html_buf; - char *html_buf2; - html_buf = html_to_zephyr(im); - html_buf2 = purple_unescape_html(html_buf); - - if(use_tzc(zephyr)) { - size_t len; - size_t result; - char* zsendstr; - /* CMU cclub tzc doesn't grok opcodes for now */ - char* tzc_sig = zephyr_tzc_escape_msg(sig); - char *tzc_body = zephyr_tzc_escape_msg(html_buf2); - zsendstr = g_strdup_printf("((tzcfodder . send) (class . \"%s\") (auth . t) (recipients (\"%s\" . \"%s\")) (message . (\"%s\" \"%s\")) ) \n", - zclass, instance, recipient, tzc_sig, tzc_body); - /* fprintf(stderr,"zsendstr = %s\n",zsendstr); */ - len = strlen(zsendstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE], zsendstr, len); - if (result != len) { - g_free(zsendstr); - g_free(html_buf2); - g_free(html_buf); - return errno; - } - g_free(zsendstr); - } else if (use_zeph02(zephyr)) { - ZNotice_t notice; - char *buf = g_strdup_printf("%s%c%s", sig, '\0', html_buf2); - memset((char *)¬ice, 0, sizeof(notice)); - - notice.z_kind = ACKED; - notice.z_port = 0; - notice.z_opcode = ""; - notice.z_class = zclass; - notice.z_class_inst = instance; - notice.z_recipient = recipient; - notice.z_sender = 0; - notice.z_default_format = "Class $class, Instance $instance:\n" "To: @bold($recipient) at $time $date\n" "From: @bold($1) <$sender>\n\n$2"; - notice.z_message_len = strlen(html_buf2) + strlen(sig) + 2; - notice.z_message = buf; - notice.z_opcode = g_strdup(opcode); - purple_debug_info("zephyr","About to send notice\n"); - if (! ZSendNotice(¬ice, ZAUTH) == ZERR_NONE) { - /* XXX handle errors here */ - g_free(buf); - g_free(html_buf2); - g_free(html_buf); - return 0; - } - purple_debug_info("zephyr","notice sent\n"); - g_free(buf); - } - - g_free(html_buf2); - g_free(html_buf); - - return 1; -} - -char *local_zephyr_normalize(zephyr_account *zephyr,const char *orig) -{ - /* - Basically the inverse of zephyr_strip_local_realm - */ - char* buf; - - if (!g_ascii_strcasecmp(orig, "")) { - return g_strdup(""); - } - - if (strchr(orig,'@')) { - buf = g_strdup_printf("%s",orig); - } else { - buf = g_strdup_printf("%s@%s",orig,zephyr->realm); - } - return buf; -} - -static const char *zephyr_normalize(const PurpleAccount *account, const char *who) -{ - static char buf[BUF_LEN]; - PurpleConnection *gc; - char *tmp; - - gc = purple_account_get_connection(account); - if (gc == NULL) - return NULL; - - tmp = local_zephyr_normalize(gc->proto_data, who); - - if (strlen(tmp) >= sizeof(buf)) { - g_free(tmp); - return NULL; - } - - strcpy(buf, tmp); - g_free(tmp); - - return buf; -} - -static void zephyr_zloc(PurpleConnection *gc, const char *who) -{ - ZAsyncLocateData_t ald; - zephyr_account *zephyr = gc->proto_data; - gchar* normalized_who = local_zephyr_normalize(zephyr,who); - - if (use_zeph02(zephyr)) { - if (ZRequestLocations(normalized_who, &ald, UNACKED, ZAUTH) == ZERR_NONE) { - zephyr->pending_zloc_names = g_list_append(zephyr->pending_zloc_names, - g_strdup(normalized_who)); - } else { - /* XXX deal with errors somehow */ - } - } else if (use_tzc(zephyr)) { - size_t len; - size_t result; - char* zlocstr = g_strdup_printf("((tzcfodder . zlocate) \"%s\")\n",normalized_who); - zephyr->pending_zloc_names = g_list_append(zephyr->pending_zloc_names, g_strdup(normalized_who)); - len = strlen(zlocstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zlocstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write a message: %s\n", g_strerror(errno)); - } - g_free(zlocstr); - } -} - -static void zephyr_set_status(PurpleAccount *account, PurpleStatus *status) { - size_t len; - size_t result; - zephyr_account *zephyr = purple_account_get_connection(account)->proto_data; - PurpleStatusPrimitive primitive = purple_status_type_get_primitive(purple_status_get_type(status)); - - if (zephyr->away) { - g_free(zephyr->away); - zephyr->away=NULL; - } - - if (primitive == PURPLE_STATUS_AWAY) { - zephyr->away = g_strdup(purple_status_get_attr_string(status,"message")); - } - else if (primitive == PURPLE_STATUS_AVAILABLE) { - if (use_zeph02(zephyr)) { - ZSetLocation(zephyr->exposure); - } - else { - char *zexpstr = g_strdup_printf("((tzcfodder . set-location) (hostname . \"%s\") (exposure . \"%s\"))\n",zephyr->ourhost,zephyr->exposure); - len = strlen(zexpstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zexpstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write message: %s\n", g_strerror(errno)); - } - g_free(zexpstr); - } - } - else if (primitive == PURPLE_STATUS_INVISIBLE) { - /* XXX handle errors */ - if (use_zeph02(zephyr)) { - ZSetLocation(EXPOSE_OPSTAFF); - } else { - char *zexpstr = g_strdup_printf("((tzcfodder . set-location) (hostname . \"%s\") (exposure . \"%s\"))\n",zephyr->ourhost,EXPOSE_OPSTAFF); - len = strlen(zexpstr); - result = write(zephyr->totzc[ZEPHYR_FD_WRITE],zexpstr,len); - if (result != len) { - purple_debug_error("zephyr", "Unable to write message: %s\n", g_strerror(errno)); - } - g_free(zexpstr); - } - } -} - -static GList *zephyr_status_types(PurpleAccount *account) -{ - PurpleStatusType *type; - GList *types = NULL; - - /* zephyr has several exposures - NONE (where you are hidden, and zephyrs to you are in practice silently dropped -- yes this is wrong) - OPSTAFF "hidden" - REALM-VISIBLE visible to people in local realm - REALM-ANNOUNCED REALM-VISIBLE+ plus your logins/logouts are announced to - NET-VISIBLE REALM-ANNOUNCED, plus visible to people in foreign realm - NET-ANNOUNCED NET-VISIBLE, plus logins/logouts are announced to - - Online will set the user to the exposure they have in their options (defaulting to REALM-VISIBLE), - Hidden, will set the user's exposure to OPSTAFF - - Away won't change their exposure but will set an auto away message (for IMs only) - */ - - type = purple_status_type_new(PURPLE_STATUS_AVAILABLE, NULL, NULL, TRUE); - types = g_list_append(types,type); - - type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, NULL, NULL, TRUE); - types = g_list_append(types,type); - - type = purple_status_type_new_with_attrs( - PURPLE_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, - "message", _("Message"), purple_value_new(PURPLE_TYPE_STRING), - NULL); - types = g_list_append(types, type); - - type = purple_status_type_new(PURPLE_STATUS_OFFLINE, NULL, NULL, TRUE); - types = g_list_append(types,type); - - return types; -} - -static GList *zephyr_chat_info(PurpleConnection * gc) -{ - GList *m = NULL; - struct proto_chat_entry *pce; - - pce = g_new0(struct proto_chat_entry, 1); - - pce->label = _("_Class:"); - pce->identifier = "class"; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - - pce->label = _("_Instance:"); - pce->identifier = "instance"; - m = g_list_append(m, pce); - - pce = g_new0(struct proto_chat_entry, 1); - - pce->label = _("_Recipient:"); - pce->identifier = "recipient"; - m = g_list_append(m, pce); - - return m; -} - -/* Called when the server notifies us a message couldn't get sent */ - -static void zephyr_subscribe_failed(PurpleConnection *gc,char * z_class, char *z_instance, char * z_recipient, char* z_galaxy) -{ - gchar* subscribe_failed = g_strdup_printf(_("Attempt to subscribe to %s,%s,%s failed"), z_class, z_instance,z_recipient); - purple_notify_error(gc,"", subscribe_failed, NULL); - g_free(subscribe_failed); -} - -static char *zephyr_get_chat_name(GHashTable *data) { - gchar* zclass = g_hash_table_lookup(data,"class"); - gchar* inst = g_hash_table_lookup(data,"instance"); - gchar* recipient = g_hash_table_lookup(data, "recipient"); - if (!zclass) /* This should never happen */ - zclass = ""; - if (!inst) - inst = "*"; - if (!recipient) - recipient = ""; - return g_strdup_printf("%s,%s,%s",zclass,inst,recipient); -} - - -static void zephyr_join_chat(PurpleConnection * gc, GHashTable * data) -{ - /* ZSubscription_t sub; */ - zephyr_triple *zt1, *zt2; - const char *classname; - const char *instname; - const char *recip; - zephyr_account *zephyr=gc->proto_data; - classname = g_hash_table_lookup(data, "class"); - instname = g_hash_table_lookup(data, "instance"); - recip = g_hash_table_lookup(data, "recipient"); - - - if (!classname) - return; - - if (!g_ascii_strcasecmp(classname,"%host%")) - classname = g_strdup(zephyr->ourhost); - if (!g_ascii_strcasecmp(classname,"%canon%")) - classname = g_strdup(zephyr->ourhostcanon); - - if (!instname || !strlen(instname)) - instname = "*"; - - if (!g_ascii_strcasecmp(instname,"%host%")) - instname = g_strdup(zephyr->ourhost); - if (!g_ascii_strcasecmp(instname,"%canon%")) - instname = g_strdup(zephyr->ourhostcanon); - - if (!recip || (*recip == '*')) - recip = ""; - if (!g_ascii_strcasecmp(recip, "%me%")) - recip = zephyr->username; - - zt1 = new_triple(gc->proto_data,classname, instname, recip); - zt2 = find_sub_by_triple(gc->proto_data,zt1); - if (zt2) { - free_triple(zt1); - if (!zt2->open) { - if (!g_ascii_strcasecmp(instname,"*")) - instname = "PERSONAL"; - serv_got_joined_chat(gc, zt2->id, zt2->name); - zephyr_chat_set_topic(gc,zt2->id,instname); - zt2->open = TRUE; - } - return; - } - - /* sub.zsub_class = zt1->class; - sub.zsub_classinst = zt1->instance; - sub.zsub_recipient = zt1->recipient; */ - - if (zephyr_subscribe_to(zephyr,zt1->class,zt1->instance,zt1->recipient,NULL) != ZERR_NONE) { - /* XXX output better subscription information */ - zephyr_subscribe_failed(gc,zt1->class,zt1->instance,zt1->recipient,NULL); - free_triple(zt1); - return; - } - - zephyr->subscrips = g_slist_append(zephyr->subscrips, zt1); - zt1->open = TRUE; - serv_got_joined_chat(gc, zt1->id, zt1->name); - if (!g_ascii_strcasecmp(instname,"*")) - instname = "PERSONAL"; - zephyr_chat_set_topic(gc,zt1->id,instname); -} - -static void zephyr_chat_leave(PurpleConnection * gc, int id) -{ - zephyr_triple *zt; - zephyr_account *zephyr = gc->proto_data; - zt = find_sub_by_id(zephyr,id); - - if (zt) { - zt->open = FALSE; - zt->id = ++(zephyr->last_id); - } -} - -static PurpleChat *zephyr_find_blist_chat(PurpleAccount *account, const char *name) -{ - PurpleBlistNode *gnode, *cnode; - - /* XXX needs to be %host%,%canon%, and %me% clean */ - for(gnode = purple_blist_get_root(); gnode; - gnode = purple_blist_node_get_sibling_next(gnode)) { - for(cnode = purple_blist_node_get_first_child(gnode); - cnode; - cnode = purple_blist_node_get_sibling_next(cnode)) { - PurpleChat *chat = (PurpleChat*)cnode; - char *zclass, *inst, *recip; - char** triple; - GHashTable *components; - if(!PURPLE_BLIST_NODE_IS_CHAT(cnode)) - continue; - if(purple_chat_get_account(chat) != account) - continue; - components = purple_chat_get_components(chat); - if(!(zclass = g_hash_table_lookup(components, "class"))) - continue; - if(!(inst = g_hash_table_lookup(components, "instance"))) - inst = g_strdup(""); - if(!(recip = g_hash_table_lookup(components, "recipient"))) - recip = g_strdup(""); - /* purple_debug_info("zephyr","in zephyr_find_blist_chat name: %s\n",name?name:""); */ - triple = g_strsplit(name,",",3); - if (!g_ascii_strcasecmp(triple[0],zclass) && !g_ascii_strcasecmp(triple[1],inst) && !g_ascii_strcasecmp(triple[2],recip)) - return chat; - - } - } - return NULL; -} -static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b) -{ - return "zephyr"; -} - -static unsigned int zephyr_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { - gchar *recipient; - zephyr_account *zephyr = gc->proto_data; - if (use_tzc(zephyr)) - return 0; - - if (state == PURPLE_NOT_TYPING) - return 0; - - /* XXX We probably should care if this fails. Or maybe we don't want to */ - if (!who) { - purple_debug_info("zephyr", "who is null\n"); - recipient = local_zephyr_normalize(zephyr,""); - } else { - char *comma = strrchr(who, ','); - /* Don't ping broadcast (chat) recipients */ - /* The strrchr case finds a realm-stripped broadcast subscription - e.g. comma is the last character in the string */ - if (comma && ( (*(comma+1) == '\0') || (*(comma+1) == '@'))) - return 0; - - recipient = local_zephyr_normalize(zephyr,who); - } - - purple_debug_info("zephyr","about to send typing notification to %s\n",recipient); - zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,"","","PING"); - purple_debug_info("zephyr","sent typing notification\n"); - - /* - * TODO: Is this correct? It means we will call - * serv_send_typing(gc, who, PURPLE_TYPING) once every 15 seconds - * until the Purple user stops typing. - */ - return ZEPHYR_TYPING_SEND_TIMEOUT; -} - - - -static void zephyr_chat_set_topic(PurpleConnection * gc, int id, const char *topic) -{ - zephyr_triple *zt; - PurpleConversation *gconv; - PurpleConvChat *gcc; - gchar *topic_utf8; - zephyr_account* zephyr = gc->proto_data; - char *sender = (char *)zephyr->username; - - zt = find_sub_by_id(gc->proto_data,id); - /* find_sub_by_id can return NULL */ - if (!zt) - return; - gconv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, zt->name, - gc->account); - gcc = purple_conversation_get_chat_data(gconv); - - topic_utf8 = zephyr_recv_convert(gc,(gchar *)topic); - purple_conv_chat_set_topic(gcc,sender,topic_utf8); - g_free(topic_utf8); - return; -} - -/* commands */ - -static PurpleCmdRet zephyr_purple_cmd_msg(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - char *recipient; - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if (!g_ascii_strcasecmp(args[0],"*")) - return PURPLE_CMD_RET_FAILED; /* "*" is not a valid argument */ - else - recipient = local_zephyr_normalize(zephyr,args[0]); - - if (strlen(recipient) < 1) - return PURPLE_CMD_RET_FAILED; /* a null recipient is a chat message, not an IM */ - - if (zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,args[1],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zlocate(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - zephyr_zloc(purple_conversation_get_gc(conv),args[0]); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet zephyr_purple_cmd_instance(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* Currently it sets the instance with leading spaces and - * all. This might not be the best thing to do, though having - * one word isn't ideal either. */ - - PurpleConvChat *gcc = purple_conversation_get_chat_data(conv); - int id = gcc->id; - const char* instance = args[0]; - zephyr_chat_set_topic(purple_conversation_get_gc(conv),id,instance); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet zephyr_purple_cmd_joinchat_cir(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* Join a new zephyr chat */ - GHashTable *triple = g_hash_table_new(NULL,NULL); - g_hash_table_insert(triple,"class",args[0]); - g_hash_table_insert(triple,"instance",args[1]); - g_hash_table_insert(triple,"recipient",args[2]); - zephyr_join_chat(purple_conversation_get_gc(conv),triple); - return PURPLE_CMD_RET_OK; -} - -static PurpleCmdRet zephyr_purple_cmd_zi(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,"message",args[0],"",args[1],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zci(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = class, instance, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,args[0],args[1],"",args[2],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zcir(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = class, instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,args[0],args[1],args[2],args[3],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zir(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = instance, recipient, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,"message",args[0],args[1],args[2],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static PurpleCmdRet zephyr_purple_cmd_zc(PurpleConversation *conv, - const char *cmd, char **args, char **error, void *data) -{ - /* args = class, message */ - zephyr_account *zephyr = purple_conversation_get_gc(conv)->proto_data; - if ( zephyr_send_message(zephyr,args[0],"PERSONAL","",args[1],zephyr_get_signature(),"")) - return PURPLE_CMD_RET_OK; - else - return PURPLE_CMD_RET_FAILED; -} - -static void zephyr_register_slash_commands(void) -{ - - purple_cmd_register("msg","ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_msg, _("msg <nick> <message>: Send a private message to a user"), NULL); - - purple_cmd_register("zlocate","w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zlocate, _("zlocate <nick>: Locate user"), NULL); - - purple_cmd_register("zl","w", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zlocate, _("zl <nick>: Locate user"), NULL); - - purple_cmd_register("instance","s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_instance, _("instance <instance>: Set the instance to be used on this class"), NULL); - - purple_cmd_register("inst","s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_instance, _("inst <instance>: Set the instance to be used on this class"), NULL); - - purple_cmd_register("topic","s", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_instance, _("topic <instance>: Set the instance to be used on this class"), NULL); - - purple_cmd_register("sub", "www", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_joinchat_cir, - _("sub <class> <instance> <recipient>: Join a new chat"), NULL); - - purple_cmd_register("zi","ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zi, _("zi <instance>: Send a message to <message,instance,*>"), NULL); - - purple_cmd_register("zci","wws",PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zci, - _("zci <class> <instance>: Send a message to <class,instance,*>"), NULL); - - purple_cmd_register("zcir","wwws",PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zcir, - _("zcir <class> <instance> <recipient>: Send a message to <class,instance,recipient>"), NULL); - - purple_cmd_register("zir","wws",PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zir, - _("zir <instance> <recipient>: Send a message to <MESSAGE,instance,recipient>"), NULL); - - purple_cmd_register("zc","ws", PURPLE_CMD_P_PRPL, - PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, - "prpl-zephyr", - zephyr_purple_cmd_zc, _("zc <class>: Send a message to <class,PERSONAL,*>"), NULL); - -} - - -static int zephyr_resubscribe(PurpleConnection *gc) -{ - /* Resubscribe to the in-memory list of subscriptions and also - unsubscriptions*/ - zephyr_account *zephyr = gc->proto_data; - GSList *s = zephyr->subscrips; - zephyr_triple *zt; - while (s) { - zt = s->data; - /* XXX We really should care if this fails */ - zephyr_subscribe_to(zephyr,zt->class,zt->instance,zt->recipient,NULL); - s = s->next; - } - /* XXX handle unsubscriptions */ - return 1; -} - - -static void zephyr_action_resubscribe(PurplePluginAction *action) -{ - - PurpleConnection *gc = (PurpleConnection *) action->context; - zephyr_resubscribe(gc); -} - - -static void zephyr_action_get_subs_from_server(PurplePluginAction *action) -{ - PurpleConnection *gc = (PurpleConnection *) action->context; - zephyr_account *zephyr = gc->proto_data; - gchar *title; - int retval, nsubs, one,i; - ZSubscription_t subs; - if (use_zeph02(zephyr)) { - GString* subout = g_string_new("Subscription list
"); - - title = g_strdup_printf("Server subscriptions for %s", zephyr->username); - - if (zephyr->port == 0) { - purple_debug_error("zephyr", "error while retrieving port\n"); - return; - } - if ((retval = ZRetrieveSubscriptions(zephyr->port,&nsubs)) != ZERR_NONE) { - /* XXX better error handling */ - purple_debug_error("zephyr", "error while retrieving subscriptions from server\n"); - return; - } - for(i=0;i", - subs.zsub_class, subs.zsub_classinst, - subs.zsub_recipient); - } - purple_notify_formatted(gc, title, title, NULL, subout->str, NULL, NULL); - } else { - /* XXX fix */ - purple_notify_error(gc,"","tzc doesn't support this action",NULL); - } -} - - -static GList *zephyr_actions(PurplePlugin *plugin, gpointer context) -{ - GList *list = NULL; - PurplePluginAction *act = NULL; - - act = purple_plugin_action_new(_("Resubscribe"), zephyr_action_resubscribe); - list = g_list_append(list, act); - - act = purple_plugin_action_new(_("Retrieve subscriptions from server"), zephyr_action_get_subs_from_server); - list = g_list_append(list,act); - - return list; -} - -static PurplePlugin *my_protocol = NULL; - -static PurplePluginProtocolInfo prpl_info = { - OPT_PROTO_CHAT_TOPIC | OPT_PROTO_NO_PASSWORD, - NULL, /* ??? user_splits */ - NULL, /* ??? protocol_options */ - NO_BUDDY_ICONS, - zephyr_list_icon, - NULL, /* ??? list_emblems */ - NULL, /* ??? status_text */ - NULL, /* ??? tooltip_text */ - zephyr_status_types, /* status_types */ - NULL, /* ??? blist_node_menu - probably all useful actions are already handled*/ - zephyr_chat_info, /* chat_info */ - NULL, /* chat_info_defaults */ - zephyr_login, /* login */ - zephyr_close, /* close */ - zephyr_send_im, /* send_im */ - NULL, /* XXX set info (Location?) */ - zephyr_send_typing, /* send_typing */ - zephyr_zloc, /* get_info */ - zephyr_set_status, /* set_status */ - NULL, /* ??? set idle */ - NULL, /* change password */ - NULL, /* add_buddy */ - NULL, /* add_buddies */ - NULL, /* remove_buddy */ - NULL, /* remove_buddies */ - NULL, /* add_permit */ - NULL, /* add_deny */ - NULL, /* remove_permit */ - NULL, /* remove_deny */ - NULL, /* set_permit_deny */ - zephyr_join_chat, /* join_chat */ - NULL, /* reject_chat -- No chat invites*/ - zephyr_get_chat_name, /* get_chat_name */ - NULL, /* chat_invite -- No chat invites*/ - zephyr_chat_leave, /* chat_leave */ - NULL, /* chat_whisper -- No "whispering"*/ - zephyr_chat_send, /* chat_send */ - NULL, /* keepalive -- Not necessary*/ - NULL, /* register_user -- Not supported*/ - NULL, /* XXX get_cb_info */ - NULL, /* get_cb_away */ - NULL, /* alias_buddy */ - NULL, /* group_buddy */ - NULL, /* rename_group */ - NULL, /* buddy_free */ - NULL, /* convo_closed */ - zephyr_normalize, /* normalize */ - NULL, /* XXX set_buddy_icon */ - NULL, /* remove_group */ - NULL, /* XXX get_cb_real_name */ - zephyr_chat_set_topic, /* set_chat_topic */ - zephyr_find_blist_chat, /* find_blist_chat */ - NULL, /* roomlist_get_list */ - NULL, /* roomlist_cancel */ - NULL, /* roomlist_expand_category */ - NULL, /* can_receive_file */ - NULL, /* send_file */ - NULL, /* new_xfer */ - NULL, /* offline_message */ - NULL, /* whiteboard_prpl_ops */ - NULL, /* send_raw */ - NULL, /* roomlist_room_serialize */ - - NULL, - NULL, - NULL, - sizeof(PurplePluginProtocolInfo), /* struct_size */ - NULL, /* get_account_text_table */ - NULL, /* initate_media */ - NULL /* can_do_media */ -}; - -static PurplePluginInfo info = { - PURPLE_PLUGIN_MAGIC, - PURPLE_MAJOR_VERSION, - PURPLE_MINOR_VERSION, - PURPLE_PLUGIN_PROTOCOL, /**< type */ - NULL, /**< ui_requirement */ - 0, /**< flags */ - NULL, /**< dependencies */ - PURPLE_PRIORITY_DEFAULT, /**< priority */ - - "prpl-zephyr", /**< id */ - "Zephyr", /**< name */ - DISPLAY_VERSION, /**< version */ - /** summary */ - N_("Zephyr Protocol Plugin"), - /** description */ - N_("Zephyr Protocol Plugin"), - NULL, /**< author */ - PURPLE_WEBSITE, /**< homepage */ - - NULL, /**< load */ - NULL, /**< unload */ - NULL, /**< destroy */ - - NULL, /**< ui_info */ - &prpl_info, /**< extra_info */ - NULL, - zephyr_actions, - - /* padding */ - NULL, - NULL, - NULL, - NULL -}; - -static void init_plugin(PurplePlugin * plugin) -{ - PurpleAccountOption *option; - char *tmp = get_exposure_level(); - - option = purple_account_option_bool_new(_("Use tzc"), "use_tzc", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("tzc command"), "tzc_command", "/usr/bin/tzc -e %s"); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Export to .anyone"), "write_anyone", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Export to .zephyr.subs"), "write_zsubs", FALSE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Import from .anyone"), "read_anyone", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_bool_new(_("Import from .zephyr.subs"), "read_zsubs", TRUE); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Realm"), "realm", ""); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Exposure"), "exposure_level", tmp?tmp: EXPOSE_REALMVIS); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - option = purple_account_option_string_new(_("Encoding"), "encoding", ZEPHYR_FALLBACK_CHARSET); - prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - - my_protocol = plugin; - zephyr_register_slash_commands(); -} - -PURPLE_INIT_PLUGIN(zephyr, init_plugin, info); diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -#include "zephyr_err.h" - -#ifdef __STDC__ -#define NOARGS void -#else -#define NOARGS -#define const -#endif - -static const char * const text[] = { - "Packet too long or buffer too small", - "Notice header too large", - "Illegal value in notice", - "Can't get host manager port", - "Can't assign port", - "Bad packet format", - "Incompatible version numbers", - "No port opened", - "No notices match criteria", - "Input queue too long", - "Hostmanager not responding", - "Internal error", - "No previous call to ZLocateUser", - "No more locations available", - "Field too long for buffer", - "Improperly formatted field", - "SERVNAK received", - "Server could not verify authentication", - "Not logged-in", - "No previous call to ZRetrieveSubscriptions", - "No more subscriptions available", - "Too many subscriptions to transmit", - "End of file detected during read", - 0 -}; - -struct error_table { - char const * const * msgs; - long base; - int n_msgs; -}; -struct et_list { - struct et_list *next; - const struct error_table * table; -}; -extern struct et_list *_et_list; - -static const struct error_table et = { text, -772103680L, 23 }; - -static struct et_list link = { 0, 0 }; - -void initialize_zeph_error_table (NOARGS) { - if (!link.table) { - link.next = _et_list; - link.table = &et; - _et_list = &link; - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_err.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* - * zephyr_err.h: - * This file is automatically generated; please do not edit it. - */ -#define ZERR_PKTLEN (-772103680L) -#define ZERR_HEADERLEN (-772103679L) -#define ZERR_ILLVAL (-772103678L) -#define ZERR_HMPORT (-772103677L) -#define ZERR_PORTINUSE (-772103676L) -#define ZERR_BADPKT (-772103675L) -#define ZERR_VERS (-772103674L) -#define ZERR_NOPORT (-772103673L) -#define ZERR_NONOTICE (-772103672L) -#define ZERR_QLEN (-772103671L) -#define ZERR_HMDEAD (-772103670L) -#define ZERR_INTERNAL (-772103669L) -#define ZERR_NOLOCATIONS (-772103668L) -#define ZERR_NOMORELOCS (-772103667L) -#define ZERR_FIELDLEN (-772103666L) -#define ZERR_BADFIELD (-772103665L) -#define ZERR_SERVNAK (-772103664L) -#define ZERR_AUTHFAIL (-772103663L) -#define ZERR_LOGINFAIL (-772103662L) -#define ZERR_NOSUBSCRIPTIONS (-772103661L) -#define ZERR_NOMORESUBSCRIPTIONS (-772103660L) -#define ZERR_TOOMANYSUBS (-772103659L) -#define ZERR_EOF (-772103658L) -void initialize_zeph_error_table (void); -#define ERROR_TABLE_BASE_zeph (-772103680L) - -/* for compatibility with older versions... */ -#define init_zeph_err_tbl initialize_zeph_error_table -#define zeph_err_base ERROR_TABLE_BASE_zeph diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_internal.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_internal.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_internal.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/zephyr_internal.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,339 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains global definitions - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of - * Technology. For copying and distribution information, see the - * file "mit-copyright.h". - */ - -#ifndef __ZEPHYR_H__ -#define __ZEPHYR_H__ - -#include - -#include - -#include -#include - -#include - -#ifndef IPPROTO_MAX /* Make sure not already included */ -#ifndef WIN32 -#include -#endif -#endif - -/* Use __STDC__ to guess whether we can use stdarg, prototypes, and const. - * This is a public header file, so autoconf can't help us here. */ -#ifdef __STDC__ -# include -# define ZP(x) x -# define ZCONST const -#else -# define ZP(x) () -# define ZCONST -#endif - -#ifdef WIN32 -/* this really should be uint32_t */ -/*typedef unsigned int in_addr_t; -struct in_addr -{ - in_addr_t s_addr; -}; */ -#include -#endif - -/* Service names */ -#define HM_SVCNAME "zephyr-hm" -#define HM_SRV_SVCNAME "zephyr-hm-srv" -#define SERVER_SVCNAME "zephyr-clt" -#define SERVER_SERVICE "zephyr" -#define SERVER_INSTANCE "zephyr" - -#define ZVERSIONHDR "ZEPH" -#define ZVERSIONMAJOR 0 -#define ZVERSIONMINOR 2 - -#define Z_MAXPKTLEN 1024 -#define Z_MAXHEADERLEN 800 -#define Z_MAXOTHERFIELDS 10 /* Max unknown fields in ZNotice_t */ -#define Z_NUMFIELDS 17 - -/* Authentication levels returned by ZCheckAuthentication */ -#define ZAUTH_FAILED (-1) -#define ZAUTH_YES 1 -#define ZAUTH_NO 0 - -typedef char ZPacket_t[Z_MAXPKTLEN]; - -/* Packet type */ -typedef enum { - UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT -} ZNotice_Kind_t; -extern ZCONST char *ZNoticeKinds[9]; - -/* Unique ID format */ -typedef struct _ZUnique_Id_t { - struct in_addr zuid_addr; - struct timeval tv; -} ZUnique_Id_t; - -/* Checksum */ -typedef unsigned long ZChecksum_t; - -/* Notice definition */ -typedef struct _ZNotice_t { - char *z_packet; - char *z_version; - ZNotice_Kind_t z_kind; - ZUnique_Id_t z_uid; -#define z_sender_addr z_uid.zuid_addr - struct timeval z_time; - unsigned short z_port; - int z_auth; - int z_checked_auth; - int z_authent_len; - char *z_ascii_authent; - char *z_class; - const char *z_class_inst; - char *z_opcode; - char *z_sender; - const char *z_recipient; - char *z_default_format; - char *z_multinotice; - ZUnique_Id_t z_multiuid; - ZChecksum_t z_checksum; - int z_num_other_fields; - char *z_other_fields[Z_MAXOTHERFIELDS]; - caddr_t z_message; - int z_message_len; -} ZNotice_t; - -/* Subscription structure */ -typedef struct _ZSubscriptions_t { - char *zsub_recipient; - char *zsub_class; - char *zsub_classinst; -} ZSubscription_t; - -/* Function return code */ -typedef int Code_t; - -/* Locations structure */ -typedef struct _ZLocations_t { - char *host; - char *time; - char *tty; -} ZLocations_t; - -typedef struct _ZAsyncLocateData_t { - char *user; - ZUnique_Id_t uid; - char *version; -} ZAsyncLocateData_t; - -/* for ZSetDebug */ -#ifdef Z_DEBUG -void (*__Z_debug_print) ZP((ZCONST char *fmt, va_list args, void *closure)); -void *__Z_debug_print_closure; -#endif - -int ZCompareUIDPred ZP((ZNotice_t *, void *)); -int ZCompareMultiUIDPred ZP((ZNotice_t *, void *)); - -/* Defines for ZFormatNotice, et al. */ -typedef Code_t (*Z_AuthProc) ZP((ZNotice_t*, char *, int, int *)); -Code_t ZMakeAuthentication ZP((ZNotice_t*, char *,int, int*)); - -char *ZGetSender ZP((void)); -char *ZGetVariable ZP((char *)); -Code_t ZSetVariable ZP((char *var, char *value)); -Code_t ZUnsetVariable ZP((char *var)); -int ZGetWGPort ZP((void)); -Code_t ZSetDestAddr ZP((struct sockaddr_in *)); -Code_t ZFormatNoticeList ZP((ZNotice_t*, char**, int, - char **, int*, Z_AuthProc)); -Code_t ZParseNotice ZP((char*, int, ZNotice_t *)); -Code_t ZReadAscii ZP((char*, int, unsigned char*, int)); -Code_t ZReadAscii32 ZP((char *, int, unsigned long *)); -Code_t ZReadAscii16 ZP((char *, int, unsigned short *)); -Code_t ZSendPacket ZP((char*, int, int)); -Code_t ZSendList ZP((ZNotice_t*, char *[], int, Z_AuthProc)); -Code_t ZSrvSendList ZP((ZNotice_t*, char*[], int, Z_AuthProc, Code_t (*)())); -Code_t ZSendNotice ZP((ZNotice_t *, Z_AuthProc)); -Code_t ZSrvSendNotice ZP((ZNotice_t*, Z_AuthProc, Code_t (*)())); -Code_t ZFormatNotice ZP((ZNotice_t*, char**, int*, Z_AuthProc)); -Code_t ZFormatSmallNotice ZP((ZNotice_t*, ZPacket_t, int*, Z_AuthProc)); -Code_t ZFormatRawNoticeList ZP((ZNotice_t *notice, char *list[], int nitems, - char **buffer, int *ret_len)); -Code_t ZLocateUser ZP((char *, int *, Z_AuthProc)); -Code_t ZRequestLocations ZP((const char *, ZAsyncLocateData_t *, - ZNotice_Kind_t, Z_AuthProc)); -Code_t ZhmStat ZP((struct in_addr *, ZNotice_t *)); -Code_t ZInitialize ZP((void)); -Code_t ZSetServerState ZP((int)); -Code_t ZSetFD ZP((int)); -Code_t ZFormatSmallRawNotice ZP((ZNotice_t*, ZPacket_t, int*)); -int ZCompareUID ZP((ZUnique_Id_t*, ZUnique_Id_t*)); -Code_t ZMakeAscii ZP((char*, int, unsigned char*, int)); -Code_t ZMakeAscii32 ZP((char *, int, unsigned long)); -Code_t ZMakeAscii16 ZP((char *, int, unsigned int)); -Code_t ZReceivePacket ZP((ZPacket_t, int*, struct sockaddr_in*)); -Code_t ZCheckAuthentication ZP((ZNotice_t*, struct sockaddr_in*)); -Code_t ZSetLocation ZP((char *exposure)); -Code_t ZUnsetLocation ZP((void)); -Code_t ZFlushMyLocations ZP((void)); -Code_t ZFormatRawNotice ZP((ZNotice_t *, char**, int *)); -Code_t ZRetrieveSubscriptions ZP((unsigned short, int*)); -Code_t ZOpenPort ZP((unsigned short *port)); -Code_t ZClosePort ZP((void)); -Code_t ZFlushLocations ZP((void)); -Code_t ZFlushSubscriptions ZP((void)); -Code_t ZFreeNotice ZP((ZNotice_t *notice)); -Code_t ZParseLocations ZP((register ZNotice_t *notice, - register ZAsyncLocateData_t *zald, int *nlocs, - char **user)); -int ZCompareALDPred ZP((ZNotice_t *notice, void *zald)); -void ZFreeALD ZP((register ZAsyncLocateData_t *zald)); -Code_t ZCheckIfNotice ZP((ZNotice_t *notice, struct sockaddr_in *from, - register int (*predicate) ZP((ZNotice_t *,void *)), - void *args)); -Code_t ZPeekPacket ZP((char **buffer, int *ret_len, - struct sockaddr_in *from)); -Code_t ZPeekNotice ZP((ZNotice_t *notice, struct sockaddr_in *from)); -Code_t ZIfNotice ZP((ZNotice_t *notice, struct sockaddr_in *from, - int (*predicate) ZP((ZNotice_t *, void *)), void *args)); -Code_t ZSubscribeTo ZP((ZSubscription_t *sublist, int nitems, - unsigned int port)); -Code_t ZSubscribeToSansDefaults ZP((ZSubscription_t *sublist, int nitems, - unsigned int port)); -Code_t ZUnsubscribeTo ZP((ZSubscription_t *sublist, int nitems, - unsigned int port)); -Code_t ZCancelSubscriptions ZP((unsigned int port)); -int ZPending ZP((void)); -Code_t ZReceiveNotice ZP((ZNotice_t *notice, struct sockaddr_in *from)); -#ifdef Z_DEBUG -void Z_debug ZP((ZCONST char *, ...)); -#endif - -#undef ZP - -/* Compatibility */ -#define ZNewLocateUser ZLocateUser - -/* Macros to retrieve Zephyr library values. */ -extern int __Zephyr_fd; -extern int __Q_CompleteLength; -extern struct sockaddr_in __HM_addr; -extern char __Zephyr_realm[]; -#define ZGetFD() __Zephyr_fd -#define ZQLength() __Q_CompleteLength -#define ZGetDestAddr() __HM_addr -#define ZGetRealm() __Zephyr_realm - -#ifdef Z_DEBUG -void ZSetDebug ZP((void (*)(ZCONST char *, va_list, void *), void *)); -#define ZSetDebug(proc,closure) (__Z_debug_print=(proc), \ - __Z_debug_print_closure=(closure), \ - (void) 0) -#else -#define ZSetDebug(proc,closure) -#endif - -/* Maximum queue length */ -#define Z_MAXQLEN 30 - -/* Successful function return */ -#define ZERR_NONE 0 - -/* Hostmanager wait time (in secs) */ -#define HM_TIMEOUT 1 - -/* Server wait time (in secs) */ -#define SRV_TIMEOUT 30 - -#define ZAUTH (ZMakeAuthentication) -#define ZNOAUTH ((Z_AuthProc)0) - -/* Packet strings */ -#define ZSRVACK_SENT "SENT" /* SERVACK codes */ -#define ZSRVACK_NOTSENT "LOST" -#define ZSRVACK_FAIL "FAIL" - -/* Server internal class */ -#define ZEPHYR_ADMIN_CLASS "ZEPHYR_ADMIN" /* Class */ - -/* Control codes sent to a server */ -#define ZEPHYR_CTL_CLASS "ZEPHYR_CTL" /* Class */ - -#define ZEPHYR_CTL_CLIENT "CLIENT" /* Inst: From client */ -#define CLIENT_SUBSCRIBE "SUBSCRIBE" /* Opcode: Subscribe */ -#define CLIENT_SUBSCRIBE_NODEFS "SUBSCRIBE_NODEFS" /* Opcode: Subscribe */ -#define CLIENT_UNSUBSCRIBE "UNSUBSCRIBE" /* Opcode: Unsubsubscribe */ -#define CLIENT_CANCELSUB "CLEARSUB" /* Opcode: Clear all subs */ -#define CLIENT_GIMMESUBS "GIMME" /* Opcode: Give me subs */ -#define CLIENT_GIMMEDEFS "GIMMEDEFS" /* Opcode: Give me default - * subscriptions */ - -#define ZEPHYR_CTL_HM "HM" /* Inst: From HM */ -#define HM_BOOT "BOOT" /* Opcode: Boot msg */ -#define HM_FLUSH "FLUSH" /* Opcode: Flush me */ -#define HM_DETACH "DETACH" /* Opcode: Detach me */ -#define HM_ATTACH "ATTACH" /* Opcode: Attach me */ - -/* Control codes send to a HostManager */ -#define HM_CTL_CLASS "HM_CTL" /* Class */ - -#define HM_CTL_SERVER "SERVER" /* Inst: From server */ -#define SERVER_SHUTDOWN "SHUTDOWN" /* Opcode: Server shutdown */ -#define SERVER_PING "PING" /* Opcode: PING */ - -#define HM_CTL_CLIENT "CLIENT" /* Inst: From client */ -#define CLIENT_FLUSH "FLUSH" /* Opcode: Send flush to srv */ -#define CLIENT_NEW_SERVER "NEWSERV" /* Opcode: Find new server */ - -/* HM Statistics */ -#define HM_STAT_CLASS "HM_STAT" /* Class */ - -#define HM_STAT_CLIENT "HMST_CLIENT" /* Inst: From client */ -#define HM_GIMMESTATS "GIMMESTATS" /* Opcode: get stats */ - -/* Login class messages */ -#define LOGIN_CLASS "LOGIN" /* Class */ - -/* Class Instance is principal of user who is logging in or logging out */ - -#define EXPOSE_NONE "NONE" /* Opcode: Not visible */ -#define EXPOSE_OPSTAFF "OPSTAFF" /* Opcode: Opstaff visible */ -#define EXPOSE_REALMVIS "REALM-VISIBLE" /* Opcode: Realm visible */ -#define EXPOSE_REALMANN "REALM-ANNOUNCED"/* Opcode: Realm announced */ -#define EXPOSE_NETVIS "NET-VISIBLE" /* Opcode: Net visible */ -#define EXPOSE_NETANN "NET-ANNOUNCED" /* Opcode: Net announced */ -#define LOGIN_USER_LOGIN "USER_LOGIN" /* Opcode: user login - (from server) */ -#define LOGIN_USER_LOGOUT "USER_LOGOUT" /* Opcode: User logout */ -#define LOGIN_USER_FLUSH "USER_FLUSH" /* Opcode: flush all locs */ - -/* Locate class messages */ -#define LOCATE_CLASS "USER_LOCATE" /* Class */ - -#define LOCATE_HIDE "USER_HIDE" /* Opcode: Hide me */ -#define LOCATE_UNHIDE "USER_UNHIDE" /* Opcode: Unhide me */ - -/* Class Instance is principal of user to locate */ -#define LOCATE_LOCATE "LOCATE" /* Opcode: Locate user */ - -/* WG_CTL class messages */ -#define WG_CTL_CLASS "WG_CTL" /* Class */ - -#define WG_CTL_USER "USER" /* Inst: User request */ -#define USER_REREAD "REREAD" /* Opcode: Reread desc file */ -#define USER_SHUTDOWN "SHUTDOWN" /* Opcode: Go catatonic */ -#define USER_STARTUP "STARTUP" /* Opcode: Come out of it */ -#define USER_EXIT "EXIT" /* Opcode: Exit the client */ - -#endif /* __ZEPHYR_H__ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsLocs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsLocs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsLocs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsLocs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFlushLocations function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFlushLocations() -{ - int i; - - if (!__locate_list) - return (ZERR_NONE); - - for (i=0;i<__locate_num;i++) { - free(__locate_list[i].host); - free(__locate_list[i].time); - free(__locate_list[i].tty); - } - - free((char *)__locate_list); - - __locate_list = 0; - __locate_num = 0; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFlsSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFlushSubscriptions function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFlushSubscriptions() -{ - register int i; - - if (!__subscriptions_list) - return (ZERR_NONE); - - for (i=0;i<__subscriptions_num;i++) { - free(__subscriptions_list[i].zsub_class); - free(__subscriptions_list[i].zsub_classinst); - free(__subscriptions_list[i].zsub_recipient); - } - - free((char *)__subscriptions_list); - - __subscriptions_list = 0; - __subscriptions_num = 0; - - return (ZERR_NONE); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtAuth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtAuth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtAuth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtAuth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatAuthenticNotice function. - * - * Created by: Robert French - - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifdef ZEPHYR_USES_KERBEROS -Code_t ZFormatAuthenticNotice(notice, buffer, buffer_len, len, session) - ZNotice_t *notice; - register char *buffer; - register int buffer_len; - int *len; - C_Block session; -{ - ZNotice_t newnotice; - char *ptr; - int retval, hdrlen; - - newnotice = *notice; - newnotice.z_auth = 1; - newnotice.z_authent_len = 0; - newnotice.z_ascii_authent = ""; - - if ((retval = Z_FormatRawHeader(&newnotice, buffer, buffer_len, - &hdrlen, &ptr, NULL)) != ZERR_NONE) - return (retval); - -#ifdef NOENCRYPTION - newnotice.z_checksum = 0; -#else - newnotice.z_checksum = - (ZChecksum_t)des_quad_cksum(buffer, NULL, ptr - buffer, 0, (C_Block*)session); -#endif - if ((retval = Z_FormatRawHeader(&newnotice, buffer, buffer_len, - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - ptr = buffer+hdrlen; - - if (newnotice.z_message_len+hdrlen > buffer_len) - return (ZERR_PKTLEN); - - (void) memcpy(ptr, newnotice.z_message, newnotice.z_message_len); - - *len = hdrlen+newnotice.z_message_len; - - if (*len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - return (ZERR_NONE); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtList.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtList.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtList.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtList.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatNoticeList function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFormatNoticeList(notice, list, nitems, buffer, ret_len, - cert_routine) - ZNotice_t *notice; - register char **list; - int nitems; - char **buffer; - int *ret_len; - Z_AuthProc cert_routine; -{ - char header[Z_MAXHEADERLEN]; - register int i; - int hdrlen, size; - char *ptr; - Code_t retval; - - if ((retval = Z_FormatHeader(notice, header, sizeof(header), &hdrlen, - cert_routine)) != ZERR_NONE) - return (retval); - - size = 0; - for (i=0;iz_message_len; - - /* Length can never be zero, don't have to worry about malloc(0). */ - if (!(*buffer = (char *) malloc((unsigned)*ret_len))) - return (ENOMEM); - - (void) memcpy(*buffer, header, hdrlen); - (void) memcpy(*buffer+hdrlen, notice->z_message, notice->z_message_len); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRaw.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRaw.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRaw.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRaw.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatRawNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFormatRawNotice(notice, buffer, ret_len) - register ZNotice_t *notice; - char **buffer; - int *ret_len; -{ - char header[Z_MAXHEADERLEN]; - int hdrlen; - Code_t retval; - - if ((retval = Z_FormatRawHeader(notice, header, sizeof(header), - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - *ret_len = hdrlen+notice->z_message_len; - - /* *ret_len is never 0, don't have to worry about malloc(0) */ - if (!(*buffer = (char *) malloc((unsigned) *ret_len))) - return (ENOMEM); - - (void) memcpy(*buffer, header, hdrlen); - (void) memcpy(*buffer+hdrlen, notice->z_message, notice->z_message_len); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRawLst.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRawLst.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRawLst.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtRawLst.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatRawNoticeList function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFormatRawNoticeList(notice, list, nitems, buffer, ret_len) - ZNotice_t *notice; - char *list[]; - int nitems; - char **buffer; - int *ret_len; -{ - char header[Z_MAXHEADERLEN]; - int hdrlen, i, size; - char *ptr; - Code_t retval; - - if ((retval = Z_FormatRawHeader(notice, header, sizeof(header), - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - size = 0; - for (i=0;iz_message_len; - - if (*ret_len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - (void) memcpy(buffer+hdrlen, notice->z_message, notice->z_message_len); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtSmRLst.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtSmRLst.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtSmRLst.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFmtSmRLst.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFormatSmallRawNoticeList function. - * - * Created by: John T. Kohl - * - * Copyright (c) 1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZFormatSmallRawNoticeList(notice, list, nitems, buffer, ret_len) - ZNotice_t *notice; - char *list[]; - int nitems; - ZPacket_t buffer; - int *ret_len; -{ - Code_t retval; - int hdrlen, i, size; - char *ptr; - - if ((retval = Z_FormatRawHeader(notice, buffer, Z_MAXHEADERLEN, - &hdrlen, NULL, NULL)) != ZERR_NONE) - return (retval); - - size = 0; - for (i=0;i Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - ptr = buffer+hdrlen; - - for (;nitems;nitems--, list++) { - i = strlen(*list)+1; - (void) memcpy(ptr, *list, i); - ptr += i; - } - - return (ZERR_NONE); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFreeNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFreeNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFreeNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZFreeNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZFreeNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZFreeNotice(notice) - ZNotice_t *notice; -{ - free(notice->z_packet); - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetLocs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetLocs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetLocs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetLocs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZGetLocations function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#define min(a,b) ((a)<(b)?(a):(b)) - -/* Prototype for -Wmissing-prototypes */ -Code_t ZGetLocations(ZLocations_t *location, int *numlocs); - -Code_t ZGetLocations(ZLocations_t *location, int *numlocs) -{ - int i; - - if (!__locate_list) - return (ZERR_NOLOCATIONS); - - if (__locate_next == __locate_num) - return (ZERR_NOMORELOCS); - - for (i=0;i -#endif - -char *ZGetSender() -{ - struct passwd *pw; -#ifdef ZEPHYR_USES_KERBEROS - char pname[ANAME_SZ]; - char pinst[INST_SZ]; - char prealm[REALM_SZ]; - static char sender[ANAME_SZ+INST_SZ+REALM_SZ+3] = ""; - long int kerror; -#else - static char sender[128] = ""; -#endif - -#ifdef WIN32 - unsigned long sender_size = sizeof(sender) - 1; -#endif - -#ifdef ZEPHYR_USES_KERBEROS - if ((kerror = krb_get_tf_fullname((char *)TKT_FILE, pname, pinst, prealm)) == KSUCCESS) - { - sprintf(sender, "%s%s%s@%s", pname, (pinst[0] ? "." : ""), pinst, prealm); - return sender; - } -#endif - -#ifdef WIN32 - GetUserName(sender, &sender_size); -#else - /* XXX a uid_t is a u_short (now), but getpwuid - * wants an int. AARGH! */ - pw = getpwuid((int) getuid()); - if (!pw) - return ("unknown"); - sprintf(sender, "%s@%s", pw->pw_name, __Zephyr_realm); -#endif - return sender; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZGetSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZGetSubscriptions function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#define min(a,b) ((a)<(b)?(a):(b)) - -/* Prototype for -Wmissing-prototypes */ -Code_t ZGetSubscriptions(ZSubscription_t *subscription, int *numsubs); - -Code_t ZGetSubscriptions(ZSubscription_t *subscription, int *numsubs) -{ - int i; - - if (!__subscriptions_list) - return (ZERR_NOSUBSCRIPTIONS); - - if (__subscriptions_next == __subscriptions_num) - return (ZERR_NOMORESUBSCRIPTIONS); - - for (i=0;i -#else -#include -#endif - -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK 0x7f000001 -#endif - -Code_t ZhmStat(hostaddr, notice) - struct in_addr *hostaddr; - ZNotice_t *notice; -{ - struct servent *sp; - struct sockaddr_in sin; - ZNotice_t req; - Code_t code; - struct timeval tv; - fd_set readers; - - (void) memset((char *)&sin, 0, sizeof(struct sockaddr_in)); - - sp = getservbyname(HM_SVCNAME, "udp"); - - sin.sin_port = (sp) ? sp->s_port : HM_SVC_FALLBACK; - sin.sin_family = AF_INET; - - if (hostaddr) - sin.sin_addr = *hostaddr; - else - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - (void) memset((char *)&req, 0, sizeof(req)); - req.z_kind = STAT; - req.z_port = 0; - req.z_class = HM_STAT_CLASS; - req.z_class_inst = HM_STAT_CLIENT; - req.z_opcode = HM_GIMMESTATS; - req.z_sender = ""; - req.z_recipient = ""; - req.z_default_format = ""; - req.z_message_len = 0; - - if ((code = ZSetDestAddr(&sin)) != ZERR_NONE) - return(code); - - if ((code = ZSendNotice(&req, ZNOAUTH)) != ZERR_NONE) - return(code); - - /* Wait up to ten seconds for a response. */ - FD_ZERO(&readers); - FD_SET(ZGetFD(), &readers); - tv.tv_sec = 10; - tv.tv_usec = 0; - code = select(ZGetFD() + 1, &readers, NULL, NULL, &tv); - if (code < 0 && errno != EINTR) - return(errno); - if (code == 0 || (code < 0 && errno == EINTR) || ZPending() == 0) - return(ZERR_HMDEAD); - - return(ZReceiveNotice(notice, (struct sockaddr_in *) 0)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZIfNotice.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZIfNotice.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZIfNotice.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZIfNotice.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZIfNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZIfNotice(notice, from, predicate, args) - ZNotice_t *notice; - struct sockaddr_in *from; - int (*predicate) __P((ZNotice_t *, void *)); - void *args; -{ - ZNotice_t tmpnotice; - Code_t retval; - char *buffer; - struct _Z_InputQ *qptr; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - qptr = Z_GetFirstComplete(); - - for (;;) { - while (qptr) { - if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, - &tmpnotice)) != ZERR_NONE) - return (retval); - if ((*predicate)(&tmpnotice, args)) { - if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(buffer, qptr->packet, qptr->packet_len); - if (from) - *from = qptr->from; - if ((retval = ZParseNotice(buffer, qptr->packet_len, - notice)) != ZERR_NONE) { - free(buffer); - return (retval); - } - Z_RemQueue(qptr); - return (ZERR_NONE); - } - qptr = Z_GetNextComplete(qptr); - } - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - qptr = Z_GetFirstComplete(); /* need to look over all of - the queued messages, in case - a fragment has been reassembled */ - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZInit.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZInit.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZInit.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZInit.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZInitialize function. - * - * Created by: Robert French - * - * Copyright (c) 1987, 1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#ifdef ZEPHYR_USES_KERBEROS -#ifdef WIN32 - -#else -#include -#endif -#endif - -#include "internal.h" - -#ifdef WIN32 -#include -#else -#include -#endif - - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -Code_t ZInitialize() -{ - struct servent *hmserv; - struct hostent *hostent; - char addr[4], hostname[MAXHOSTNAMELEN]; - struct in_addr servaddr; - struct sockaddr_in sin; - int s; - socklen_t sinsize = sizeof(sin); - Code_t code; - ZNotice_t notice; -#ifdef ZEPHYR_USES_KERBEROS - char *krealm = NULL; - int krbval; - char d1[ANAME_SZ], d2[INST_SZ]; - - /* initialize_krb_error_table(); */ -#endif - - initialize_zeph_error_table(); - - (void) memset((char *)&__HM_addr, 0, sizeof(__HM_addr)); - - __HM_addr.sin_family = AF_INET; - - /* Set up local loopback address for HostManager */ - addr[0] = 127; - addr[1] = 0; - addr[2] = 0; - addr[3] = 1; - - hmserv = (struct servent *)getservbyname(HM_SVCNAME, "udp"); - __HM_addr.sin_port = (hmserv) ? hmserv->s_port : HM_SVC_FALLBACK; - - (void) memcpy((char *)&__HM_addr.sin_addr, addr, 4); - - __HM_set = 0; - - /* Initialize the input queue */ - __Q_Tail = NULL; - __Q_Head = NULL; - - /* if the application is a server, there might not be a zhm. The - code will fall back to something which might not be "right", - but this is is ok, since none of the servers call krb_rd_req. */ - - servaddr.s_addr = INADDR_NONE; - if (! __Zephyr_server) { - if ((code = ZOpenPort(NULL)) != ZERR_NONE) - return(code); - - if ((code = ZhmStat(NULL, ¬ice)) != ZERR_NONE) - return(code); - - ZClosePort(); - - /* the first field, which is NUL-terminated, is the server name. - If this code ever support a multiplexing zhm, this will have to - be made smarter, and probably per-message */ - -#ifdef ZEPHYR_USES_KERBEROS - krealm = krb_realmofhost(notice.z_message); -#endif - hostent = gethostbyname(notice.z_message); - if (hostent && hostent->h_addrtype == AF_INET) - memcpy(&servaddr, hostent->h_addr, sizeof(servaddr)); - - ZFreeNotice(¬ice); - } - -#ifdef ZEPHYR_USES_KERBEROS - if (krealm) { - strcpy(__Zephyr_realm, krealm); - } else if ((krb_get_tf_fullname(TKT_FILE, d1, d2, __Zephyr_realm) - != KSUCCESS) && - ((krbval = krb_get_lrealm(__Zephyr_realm, 1)) != KSUCCESS)) { - return (krbval); - } -#else - strcpy(__Zephyr_realm, "local-realm"); -#endif - - __My_addr.s_addr = INADDR_NONE; - if (servaddr.s_addr != INADDR_NONE) { - /* Try to get the local interface address by connecting a UDP - * socket to the server address and getting the local address. - * Some broken operating systems (e.g. Solaris 2.0-2.5) yield - * INADDR_ANY (zero), so we have to check for that. */ - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s != -1) { - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - memcpy(&sin.sin_addr, &servaddr, sizeof(servaddr)); - sin.sin_port = HM_SRV_SVC_FALLBACK; - if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) == 0 - && getsockname(s, (struct sockaddr *) &sin, &sinsize) == 0 - && sin.sin_addr.s_addr != 0) - memcpy(&__My_addr, &sin.sin_addr, sizeof(__My_addr)); - close(s); - } - } - if (__My_addr.s_addr == INADDR_NONE) { - /* We couldn't figure out the local interface address by the - * above method. Try by resolving the local hostname. (This - * is a pretty broken thing to do, and unfortunately what we - * always do on server machines.) */ - if (gethostname(hostname, sizeof(hostname)) == 0) { - hostent = gethostbyname(hostname); - if (hostent && hostent->h_addrtype == AF_INET) - memcpy(&__My_addr, hostent->h_addr, sizeof(__My_addr)); - } - } - /* If the above methods failed, zero out __My_addr so things will - * sort of kind of work. */ - if (__My_addr.s_addr == INADDR_NONE) - __My_addr.s_addr = 0; - - /* Get the sender so we can cache it */ - (void) ZGetSender(); - - return (ZERR_NONE); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Zinternal.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Zinternal.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Zinternal.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/Zinternal.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,990 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the internal Zephyr routines. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of - * Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" -#ifdef WIN32 -#include - -#ifndef ZEPHYR_USES_KERBEROS - int gettimeofday(struct timeval* p, struct timezone* tz ){ - union { - long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } _now; - - GetSystemTimeAsFileTime( &(_now.ft) ); - p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); - p->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); - return 0; - } -#endif - -#else -#include -#include -#include -#endif - -int __Zephyr_fd = -1; -int __Zephyr_open; -int __Zephyr_port = -1; -struct in_addr __My_addr; -int __Q_CompleteLength; -int __Q_Size; -struct _Z_InputQ *__Q_Head, *__Q_Tail; -struct sockaddr_in __HM_addr; -struct sockaddr_in __HM_addr_real; -int __HM_set; -int __Zephyr_server; -ZLocations_t *__locate_list; -int __locate_num; -int __locate_next; -ZSubscription_t *__subscriptions_list; -int __subscriptions_num; -int __subscriptions_next; -int Z_discarded_packets = 0; - -#ifdef ZEPHYR_USES_KERBEROS -C_Block __Zephyr_session; -#endif -char __Zephyr_realm[REALM_SZ]; - -#ifdef Z_DEBUG -void (*__Z_debug_print) __P((const char *fmt, va_list args, void *closure)); -void *__Z_debug_print_closure; -#endif - -#define min(a,b) ((a)<(b)?(a):(b)) - -static int Z_AddField __P((char **ptr, const char *field, char *end)); -static int find_or_insert_uid __P((ZUnique_Id_t *uid, ZNotice_Kind_t kind)); - -/* Find or insert uid in the old uids buffer. The buffer is a sorted - * circular queue. We make the assumption that most packets arrive in - * order, so we can usually search for a uid or insert it into the buffer - * by looking back just a few entries from the end. Since this code is - * only executed by the client, the implementation isn't microoptimized. */ -static int find_or_insert_uid(uid, kind) - ZUnique_Id_t *uid; - ZNotice_Kind_t kind; -{ - static struct _filter { - ZUnique_Id_t uid; - ZNotice_Kind_t kind; - time_t t; - } *buffer; - static long size; - static long start; - static long num; - - time_t now; - struct _filter *new; - long i, j, new_size; - int result; - - /* Initialize the uid buffer if it hasn't been done already. */ - if (!buffer) { - size = Z_INITFILTERSIZE; - buffer = (struct _filter *) malloc(size * sizeof(*buffer)); - if (!buffer) - return 0; - } - - /* Age the uid buffer, discarding any uids older than the clock skew. */ - time(&now); - while (num && (now - buffer[start % size].t) > CLOCK_SKEW) - start++, num--; - start %= size; - - /* Make room for a new uid, since we'll probably have to insert one. */ - if (num == size) { - new_size = size * 2 + 2; - new = (struct _filter *) malloc(new_size * sizeof(*new)); - if (!new) - return 0; - for (i = 0; i < num; i++) - new[i] = buffer[(start + i) % size]; - free(buffer); - buffer = new; - size = new_size; - start = 0; - } - - /* Search for this uid in the buffer, starting from the end. */ - for (i = start + num - 1; i >= start; i--) { - result = memcmp(uid, &buffer[i % size].uid, sizeof(*uid)); - if (result == 0 && buffer[i % size].kind == kind) - return 1; - if (result > 0) - break; - } - - /* We didn't find it; insert the uid into the buffer after i. */ - i++; - for (j = start + num; j > i; j--) - buffer[j % size] = buffer[(j - 1) % size]; - buffer[i % size].uid = *uid; - buffer[i % size].kind = kind; - buffer[i % size].t = now; - num++; - - return 0; -} - - -/* Return 1 if there is a packet waiting, 0 otherwise */ - -static int Z_PacketWaiting(void) -{ - struct timeval tv; - fd_set read; - - tv.tv_sec = tv.tv_usec = 0; - FD_ZERO(&read); - FD_SET(ZGetFD(), &read); - return (select(ZGetFD() + 1, &read, NULL, NULL, &tv)); -} - - -/* Wait for a complete notice to become available */ - -Code_t Z_WaitForComplete(void) -{ - Code_t retval; - - if (__Q_CompleteLength) - return (Z_ReadEnqueue()); - - while (!__Q_CompleteLength) - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - - return (ZERR_NONE); -} - - -/* Read any available packets and enqueue them */ - -Code_t Z_ReadEnqueue() -{ - Code_t retval; - - if (ZGetFD() < 0) - return (ZERR_NOPORT); - - while (Z_PacketWaiting()) - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - - return (ZERR_NONE); -} - - -/* - * Search the queue for a notice with the proper multiuid - remove any - * notices that haven't been touched in a while - */ - -static struct _Z_InputQ *Z_SearchQueue(ZUnique_Id_t *uid, ZNotice_Kind_t kind) -{ - register struct _Z_InputQ *qptr; - struct _Z_InputQ *next; - struct timeval tv; - - (void) gettimeofday(&tv, (struct timezone *)0); - - qptr = __Q_Head; - - while (qptr) { - if (ZCompareUID(uid, &qptr->uid) && qptr->kind == kind) - return (qptr); - next = qptr->next; - if (qptr->timep && (qptr->timep+Z_NOTICETIMELIMIT < tv.tv_sec)) - Z_RemQueue(qptr); - qptr = next; - } - return (NULL); -} - -/* - * Now we delve into really convoluted queue handling and - * fragmentation reassembly algorithms and other stuff you probably - * don't want to look at... - * - * This routine does NOT guarantee a complete packet will be ready when it - * returns. - */ - -Code_t Z_ReadWait() -{ - register struct _Z_InputQ *qptr; - ZNotice_t notice; - ZPacket_t packet; - struct sockaddr_in olddest, from; - int packet_len, zvlen, part, partof; - socklen_t from_len; - char *slash; - Code_t retval; - fd_set fds; - struct timeval tv; - - if (ZGetFD() < 0) - return (ZERR_NOPORT); - - FD_ZERO(&fds); - FD_SET(ZGetFD(), &fds); - tv.tv_sec = 60; - tv.tv_usec = 0; - - if (select(ZGetFD() + 1, &fds, NULL, NULL, &tv) < 0) - return (errno); - if (!FD_ISSET(ZGetFD(), &fds)) - return ETIMEDOUT; - - from_len = sizeof(struct sockaddr_in); - - packet_len = recvfrom(ZGetFD(), packet, sizeof(packet), 0, - (struct sockaddr *)&from, &from_len); - - if (packet_len < 0) - return (errno); - - if (!packet_len) - return (ZERR_EOF); - - /* Ignore obviously non-Zephyr packets. */ - zvlen = sizeof(ZVERSIONHDR) - 1; - if (packet_len < zvlen || memcmp(packet, ZVERSIONHDR, zvlen) != 0) { - Z_discarded_packets++; - return (ZERR_NONE); - } - - /* Parse the notice */ - if ((retval = ZParseNotice(packet, packet_len, ¬ice)) != ZERR_NONE) - return (retval); - - /* - * If we're not a server and the notice is of an appropriate kind, - * send back a CLIENTACK to whoever sent it to say we got it. - */ - if (!__Zephyr_server) { - if (notice.z_kind != HMACK && notice.z_kind != SERVACK && - notice.z_kind != SERVNAK && notice.z_kind != CLIENTACK) { - ZNotice_t tmpnotice; - ZPacket_t pkt; - int len; - - tmpnotice = notice; - tmpnotice.z_kind = CLIENTACK; - tmpnotice.z_message_len = 0; - olddest = __HM_addr; - __HM_addr = from; - if ((retval = ZFormatSmallRawNotice(&tmpnotice, pkt, &len)) - != ZERR_NONE) - return(retval); - if ((retval = ZSendPacket(pkt, len, 0)) != ZERR_NONE) - return (retval); - __HM_addr = olddest; - } - if (find_or_insert_uid(¬ice.z_uid, notice.z_kind)) - return(ZERR_NONE); - - /* Check authentication on the notice. */ - notice.z_checked_auth = ZCheckAuthentication(¬ice, &from); - } - - - /* - * Parse apart the z_multinotice field - if the field is blank for - * some reason, assume this packet stands by itself. - */ - slash = strchr(notice.z_multinotice, '/'); - if (slash) { - part = atoi(notice.z_multinotice); - partof = atoi(slash+1); - if (part > partof || partof == 0) { - part = 0; - partof = notice.z_message_len; - } - } - else { - part = 0; - partof = notice.z_message_len; - } - - /* Too big a packet...just ignore it! */ - if (partof > Z_MAXNOTICESIZE) - return (ZERR_NONE); - - /* - * If we aren't a server and we can find a notice in the queue - * with the same multiuid field, insert the current fragment as - * appropriate. - */ - switch (notice.z_kind) { - case SERVACK: - case SERVNAK: - /* The SERVACK and SERVNAK replies shouldn't be reassembled - (they have no parts). Instead, we should hold on to the reply - ONLY if it's the first part of a fragmented message, i.e. - multi_uid == uid. This allows programs to wait for the uid - of the first packet, and get a response when that notice - arrives. Acknowledgements of the other fragments are discarded - (XXX we assume here that they all carry the same information - regarding failure/success) - */ - if (!__Zephyr_server && - !ZCompareUID(¬ice.z_multiuid, ¬ice.z_uid)) - /* they're not the same... throw away this packet. */ - return(ZERR_NONE); - /* fall thru & process it */ - default: - /* for HMACK types, we assume no packet loss (local loopback - connections). The other types can be fragmented and MUST - run through this code. */ - if (!__Zephyr_server && (qptr = Z_SearchQueue(¬ice.z_multiuid, - notice.z_kind))) { - /* - * If this is the first fragment, and we haven't already - * gotten a first fragment, grab the header from it. - */ - if (part == 0 && !qptr->header) { - qptr->header_len = packet_len-notice.z_message_len; - qptr->header = (char *) malloc((unsigned) qptr->header_len); - if (!qptr->header) - return (ENOMEM); - (void) memcpy(qptr->header, packet, qptr->header_len); - } - return (Z_AddNoticeToEntry(qptr, ¬ice, part)); - } - } - - /* - * We'll have to create a new entry...make sure the queue isn't - * going to get too big. - */ - if (__Q_Size+(__Zephyr_server ? notice.z_message_len : partof) > Z_MAXQUEUESIZE) - return (ZERR_NONE); - - /* - * This is a notice we haven't heard of, so create a new queue - * entry for it and zero it out. - */ - qptr = (struct _Z_InputQ *)malloc(sizeof(struct _Z_InputQ)); - if (!qptr) - return (ENOMEM); - (void) memset((char *)qptr, 0, sizeof(struct _Z_InputQ)); - - /* Insert the entry at the end of the queue */ - qptr->next = NULL; - qptr->prev = __Q_Tail; - if (__Q_Tail) - __Q_Tail->next = qptr; - __Q_Tail = qptr; - - if (!__Q_Head) - __Q_Head = qptr; - - - /* Copy the from field, multiuid, kind, and checked authentication. */ - qptr->from = from; - qptr->uid = notice.z_multiuid; - qptr->kind = notice.z_kind; - qptr->auth = notice.z_checked_auth; - - /* - * If this is the first part of the notice, we take the header - * from it. We only take it if this is the first fragment so that - * the Unique ID's will be predictable. - * - * If a Zephyr Server, we always take the header. - */ - if (__Zephyr_server || part == 0) { - qptr->header_len = packet_len-notice.z_message_len; - qptr->header = (char *) malloc((unsigned) qptr->header_len); - if (!qptr->header) - return ENOMEM; - (void) memcpy(qptr->header, packet, qptr->header_len); - } - - /* - * If this is not a fragmented notice, then don't bother with a - * hole list. - * If we are a Zephyr server, all notices are treated as complete. - */ - if (__Zephyr_server || (part == 0 && notice.z_message_len == partof)) { - __Q_CompleteLength++; - qptr->holelist = (struct _Z_Hole *) 0; - qptr->complete = 1; - /* allocate a msg buf for this piece */ - if (notice.z_message_len == 0) - qptr->msg = 0; - else if (!(qptr->msg = (char *) malloc((unsigned) notice.z_message_len))) - return(ENOMEM); - else - (void) memcpy(qptr->msg, notice.z_message, notice.z_message_len); - qptr->msg_len = notice.z_message_len; - __Q_Size += notice.z_message_len; - qptr->packet_len = qptr->header_len+qptr->msg_len; - if (!(qptr->packet = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(qptr->packet, qptr->header, qptr->header_len); - if(qptr->msg) - (void) memcpy(qptr->packet+qptr->header_len, qptr->msg, - qptr->msg_len); - return (ZERR_NONE); - } - - /* - * We know how long the message is going to be (this is better - * than IP fragmentation...), so go ahead and allocate it all. - */ - if (!(qptr->msg = (char *) malloc((unsigned) partof)) && partof) - return (ENOMEM); - qptr->msg_len = partof; - __Q_Size += partof; - - /* - * Well, it's a fragmented notice...allocate a hole list and - * initialize it to the full packet size. Then insert the - * current fragment. - */ - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_Hole)))) - return (ENOMEM); - qptr->holelist->next = (struct _Z_Hole *) 0; - qptr->holelist->first = 0; - qptr->holelist->last = partof-1; - return (Z_AddNoticeToEntry(qptr, ¬ice, part)); -} - - -/* Fragment management routines - compliments, more or less, of RFC815 */ - -Code_t Z_AddNoticeToEntry(qptr, notice, part) - struct _Z_InputQ *qptr; - ZNotice_t *notice; - int part; -{ - int last, oldfirst, oldlast; - struct _Z_Hole *hole, *lasthole; - struct timeval tv; - - /* Incorporate this notice's checked authentication. */ - if (notice->z_checked_auth == ZAUTH_FAILED) - qptr->auth = ZAUTH_FAILED; - else if (notice->z_checked_auth == ZAUTH_NO && qptr->auth != ZAUTH_FAILED) - qptr->auth = ZAUTH_NO; - - (void) gettimeofday(&tv, (struct timezone *)0); - qptr->timep = tv.tv_sec; - - last = part+notice->z_message_len-1; - - hole = qptr->holelist; - lasthole = (struct _Z_Hole *) 0; - - /* copy in the message body */ - (void) memcpy(qptr->msg+part, notice->z_message, notice->z_message_len); - - /* Search for a hole that overlaps with the current fragment */ - while (hole) { - if (part <= hole->last && last >= hole->first) - break; - lasthole = hole; - hole = hole->next; - } - - /* If we found one, delete it and reconstruct a new hole */ - if (hole) { - oldfirst = hole->first; - oldlast = hole->last; - if (lasthole) - lasthole->next = hole->next; - else - qptr->holelist = hole->next; - free((char *)hole); - /* - * Now create a new hole that is the original hole without the - * current fragment. - */ - if (part > oldfirst) { - /* Search for the end of the hole list */ - hole = qptr->holelist; - lasthole = (struct _Z_Hole *) 0; - while (hole) { - lasthole = hole; - hole = hole->next; - } - if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = lasthole->next; - } - else { - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = qptr->holelist; - } - hole->next = NULL; - hole->first = oldfirst; - hole->last = part-1; - } - if (last < oldlast) { - /* Search for the end of the hole list */ - hole = qptr->holelist; - lasthole = (struct _Z_Hole *) 0; - while (hole) { - lasthole = hole; - hole = hole->next; - } - if (lasthole) { - if (!(lasthole->next = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = lasthole->next; - } - else { - if (!(qptr->holelist = (struct _Z_Hole *) - malloc(sizeof(struct _Z_InputQ)))) - return (ENOMEM); - hole = qptr->holelist; - } - hole->next = (struct _Z_Hole *) 0; - hole->first = last+1; - hole->last = oldlast; - } - } - - if (!qptr->holelist) { - if (!qptr->complete) - __Q_CompleteLength++; - qptr->complete = 1; - qptr->timep = 0; /* don't time out anymore */ - qptr->packet_len = qptr->header_len+qptr->msg_len; - if (!(qptr->packet = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(qptr->packet, qptr->header, qptr->header_len); - (void) memcpy(qptr->packet+qptr->header_len, qptr->msg, - qptr->msg_len); - } - - return (ZERR_NONE); -} - -Code_t Z_FormatHeader(notice, buffer, buffer_len, len, cert_routine) - ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; - Z_AuthProc cert_routine; -{ - Code_t retval; - static char version[BUFSIZ]; /* default init should be all \0 */ - struct sockaddr_in name; - socklen_t namelen = sizeof(name); - - if (!notice->z_sender) - notice->z_sender = ZGetSender(); - - if (notice->z_port == 0) { - if (ZGetFD() < 0) { - retval = ZOpenPort((unsigned short *)0); - if (retval != ZERR_NONE) - return (retval); - } - retval = getsockname(ZGetFD(), (struct sockaddr *) &name, &namelen); - if (retval != 0) - return (retval); - notice->z_port = name.sin_port; - } - - notice->z_multinotice = ""; - - (void) gettimeofday(¬ice->z_uid.tv, (struct timezone *)0); - notice->z_uid.tv.tv_sec = htonl((unsigned long) notice->z_uid.tv.tv_sec); - notice->z_uid.tv.tv_usec = htonl((unsigned long) notice->z_uid.tv.tv_usec); - - (void) memcpy(¬ice->z_uid.zuid_addr, &__My_addr, sizeof(__My_addr)); - - notice->z_multiuid = notice->z_uid; - - if (!version[0]) - (void) sprintf(version, "%s%d.%d", ZVERSIONHDR, ZVERSIONMAJOR, - ZVERSIONMINOR); - notice->z_version = version; - - return Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine); -} - -Code_t Z_FormatAuthHeader(notice, buffer, buffer_len, len, cert_routine) - ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; - Z_AuthProc cert_routine; -{ - if (!cert_routine) { - notice->z_auth = 0; - notice->z_authent_len = 0; - notice->z_ascii_authent = ""; - notice->z_checksum = 0; - return (Z_FormatRawHeader(notice, buffer, buffer_len, - len, NULL, NULL)); - } - - return ((*cert_routine)(notice, buffer, buffer_len, len)); -} - -Code_t Z_FormatRawHeader(notice, buffer, buffer_len, len, cstart, cend) - ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; - char **cstart, **cend; -{ - char newrecip[BUFSIZ]; - char *ptr, *end; - int i; - - if (!notice->z_class) - notice->z_class = ""; - - if (!notice->z_class_inst) - notice->z_class_inst = ""; - - if (!notice->z_opcode) - notice->z_opcode = ""; - - if (!notice->z_recipient) - notice->z_recipient = ""; - - if (!notice->z_default_format) - notice->z_default_format = ""; - - ptr = buffer; - end = buffer+buffer_len; - - if (buffer_len < strlen(notice->z_version)+1) - return (ZERR_HEADERLEN); - - (void) strcpy(ptr, notice->z_version); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, Z_NUMFIELDS + notice->z_num_other_fields) - == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, notice->z_kind) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii(ptr, end-ptr, (unsigned char *)¬ice->z_uid, - sizeof(ZUnique_Id_t)) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii16(ptr, end-ptr, ntohs(notice->z_port)) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, notice->z_auth) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (ZMakeAscii32(ptr, end-ptr, notice->z_authent_len) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - if (Z_AddField(&ptr, notice->z_ascii_authent, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_class, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_class_inst, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_opcode, end)) - return (ZERR_HEADERLEN); - if (Z_AddField(&ptr, notice->z_sender, end)) - return (ZERR_HEADERLEN); - if (strchr(notice->z_recipient, '@') || !*notice->z_recipient) { - if (Z_AddField(&ptr, notice->z_recipient, end)) - return (ZERR_HEADERLEN); - } - else { - if (strlen(notice->z_recipient) + strlen(__Zephyr_realm) + 2 > - sizeof(newrecip)) - return (ZERR_HEADERLEN); - (void) sprintf(newrecip, "%s@%s", notice->z_recipient, __Zephyr_realm); - if (Z_AddField(&ptr, newrecip, end)) - return (ZERR_HEADERLEN); - } - if (Z_AddField(&ptr, notice->z_default_format, end)) - return (ZERR_HEADERLEN); - - /* copy back the end pointer location for crypto checksum */ - if (cstart) - *cstart = ptr; - if (ZMakeAscii32(ptr, end-ptr, notice->z_checksum) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - if (cend) - *cend = ptr; - - if (Z_AddField(&ptr, notice->z_multinotice, end)) - return (ZERR_HEADERLEN); - - if (ZMakeAscii(ptr, end-ptr, (unsigned char *)¬ice->z_multiuid, - sizeof(ZUnique_Id_t)) == ZERR_FIELDLEN) - return (ZERR_HEADERLEN); - ptr += strlen(ptr)+1; - - for (i=0;iz_num_other_fields;i++) - if (Z_AddField(&ptr, notice->z_other_fields[i], end)) - return (ZERR_HEADERLEN); - - *len = ptr-buffer; - - return (ZERR_NONE); -} - -static int -Z_AddField(char **ptr, const char *field, char *end) -{ - register int len; - - len = field ? strlen (field) + 1 : 1; - - if (*ptr+len > end) - return 1; - if (field) - (void) strcpy(*ptr, field); - else - **ptr = '\0'; - *ptr += len; - - return 0; -} - -struct _Z_InputQ *Z_GetFirstComplete() -{ - struct _Z_InputQ *qptr; - - qptr = __Q_Head; - - while (qptr) { - if (qptr->complete) - return (qptr); - qptr = qptr->next; - } - - return ((struct _Z_InputQ *)0); -} - -struct _Z_InputQ *Z_GetNextComplete(qptr) - struct _Z_InputQ *qptr; -{ - qptr = qptr->next; - while (qptr) { - if (qptr->complete) - return (qptr); - qptr = qptr->next; - } - - return ((struct _Z_InputQ *)0); -} - -void Z_RemQueue(qptr) - struct _Z_InputQ *qptr; -{ - struct _Z_Hole *hole, *nexthole; - - if (qptr->complete) - __Q_CompleteLength--; - - __Q_Size -= qptr->msg_len; - - if (qptr->header) - free(qptr->header); - if (qptr->msg) - free(qptr->msg); - if (qptr->packet) - free(qptr->packet); - - hole = qptr->holelist; - while (hole) { - nexthole = hole->next; - free((char *)hole); - hole = nexthole; - } - - if (qptr == __Q_Head && __Q_Head == __Q_Tail) { - free ((char *)qptr); - __Q_Head = (struct _Z_InputQ *)0; - __Q_Tail = (struct _Z_InputQ *)0; - return; - } - - if (qptr == __Q_Head) { - __Q_Head = qptr->next; - __Q_Head->prev = (struct _Z_InputQ *)0; - free ((char *)qptr); - return; - } - if (qptr == __Q_Tail) { - __Q_Tail = qptr->prev; - __Q_Tail->next = (struct _Z_InputQ *)0; - free ((char *)qptr); - return; - } - qptr->prev->next = qptr->next; - qptr->next->prev = qptr->prev; - free ((char *)qptr); - return; -} - -Code_t Z_SendFragmentedNotice(notice, len, cert_func, send_func) - ZNotice_t *notice; - int len; - Z_AuthProc cert_func; - Z_SendProc send_func; -{ - ZNotice_t partnotice; - ZPacket_t buffer; - char multi[64]; - int offset, hdrsize, fragsize, ret_len, message_len, waitforack; - Code_t retval; - - hdrsize = len-notice->z_message_len; - fragsize = Z_MAXPKTLEN-hdrsize-Z_FRAGFUDGE; - - offset = 0; - - waitforack = ((notice->z_kind == UNACKED || notice->z_kind == ACKED) - && !__Zephyr_server); - - partnotice = *notice; - - while (offset < notice->z_message_len || !notice->z_message_len) { - (void) sprintf(multi, "%d/%d", offset, notice->z_message_len); - partnotice.z_multinotice = multi; - if (offset > 0) { - (void) gettimeofday(&partnotice.z_uid.tv, - (struct timezone *)0); - partnotice.z_uid.tv.tv_sec = - htonl((unsigned long) partnotice.z_uid.tv.tv_sec); - partnotice.z_uid.tv.tv_usec = - htonl((unsigned long) partnotice.z_uid.tv.tv_usec); - (void) memcpy((char *)&partnotice.z_uid.zuid_addr, &__My_addr, - sizeof(__My_addr)); - } - message_len = min(notice->z_message_len-offset, fragsize); - partnotice.z_message = (char*)notice->z_message+offset; - partnotice.z_message_len = message_len; - if ((retval = Z_FormatAuthHeader(&partnotice, buffer, Z_MAXHEADERLEN, - &ret_len, cert_func)) != ZERR_NONE) { - return (retval); - } - memcpy(buffer + ret_len, partnotice.z_message, message_len); - if ((retval = (*send_func)(&partnotice, buffer, ret_len+message_len, - waitforack)) != ZERR_NONE) { - return (retval); - } - offset += fragsize; - if (!notice->z_message_len) - break; - } - - return (ZERR_NONE); -} - -/*ARGSUSED*/ -Code_t Z_XmitFragment(notice, buf, len, wait) -ZNotice_t *notice; -char *buf; -int len; -int wait; -{ - return(ZSendPacket(buf, len, wait)); -} - -#ifdef Z_DEBUG -/* For debugging printing */ -const char *const ZNoticeKinds[] = { - "UNSAFE", "UNACKED", "ACKED", "HMACK", "HMCTL", "SERVACK", "SERVNAK", - "CLIENTACK", "STAT" -}; -#endif - -#ifdef Z_DEBUG - -#undef Z_debug -#ifdef HAVE_STDARG_H -void Z_debug (const char *format, ...) -{ - va_list pvar; - if (!__Z_debug_print) - return; - va_start (pvar, format); - (*__Z_debug_print) (format, pvar, __Z_debug_print_closure); - va_end (pvar); -} -#else /* stdarg */ -void Z_debug (va_alist) va_dcl -{ - va_list pvar; - char *format; - if (!__Z_debug_print) - return; - va_start (pvar); - format = va_arg (pvar, char *); - (*__Z_debug_print) (format, pvar, __Z_debug_print_closure); - va_end (pvar); -} -#endif - -void Z_debug_stderr (format, args, closure) - const char *format; - va_list args; - void *closure; -{ -#ifdef HAVE_VPRINTF - vfprintf (stderr, format, args); -#else - _doprnt (format, args, stderr); -#endif - putc ('\n', stderr); -} - -#undef ZGetFD -int ZGetFD () { return __Zephyr_fd; } - -#undef ZQLength -int ZQLength () { return __Q_CompleteLength; } - -#undef ZGetDestAddr -struct sockaddr_in ZGetDestAddr () { return __HM_addr; } - -#undef ZGetRealm -Zconst char * ZGetRealm () { return __Zephyr_realm; } - -#undef ZSetDebug -void ZSetDebug(proc, arg) - void (*proc) __P((const char *, va_list, void *)); - char *arg; -{ - __Z_debug_print = proc; - __Z_debug_print_closure = arg; -} -#endif /* Z_DEBUG */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZLocations.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZLocations.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZLocations.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZLocations.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetLocation, ZUnsetLocation, and - * ZFlushMyLocations functions. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifndef WIN32 -#include -#endif - -#include -#include - -Code_t ZSetLocation(exposure) - char *exposure; -{ - return (Z_SendLocation(LOGIN_CLASS, exposure, ZAUTH, - "$sender logged in to $1 on $3 at $2")); -} - -Code_t ZUnsetLocation() -{ - return (Z_SendLocation(LOGIN_CLASS, LOGIN_USER_LOGOUT, ZNOAUTH, - "$sender logged out of $1 on $3 at $2")); -} - -Code_t ZFlushMyLocations() -{ - return (Z_SendLocation(LOGIN_CLASS, LOGIN_USER_FLUSH, ZAUTH, "")); -} - -static char host[MAXHOSTNAMELEN]; -static char *mytty = NULL; -static int reenter = 0; - -Code_t Z_SendLocation(class, opcode, auth, format) - char *class; - char *opcode; - Z_AuthProc auth; - char *format; -{ - int retval; - time_t ourtime; - ZNotice_t notice, retnotice; - char *bptr[3]; -#ifndef X_DISPLAY_MISSING - char *display; -#endif -#ifndef WIN32 - char *ttyp; - char *p; -#endif - struct hostent *hent; - short wg_port = ZGetWGPort(); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = ACKED; - notice.z_port = (unsigned short) ((wg_port == -1) ? 0 : wg_port); - notice.z_class = class; - notice.z_class_inst = ZGetSender(); - notice.z_opcode = opcode; - notice.z_sender = 0; - notice.z_recipient = ""; - notice.z_num_other_fields = 0; - notice.z_default_format = format; - - /* - keep track of what we said before so that we can be consistent - when changing location information. - This is done mainly for the sake of the WindowGram client. - */ - - if (!reenter) { - if (gethostname(host, MAXHOSTNAMELEN) < 0) - return (errno); - - hent = gethostbyname(host); - if (hent) { - (void) strncpy(host, hent->h_name, sizeof(host)); - host[sizeof(host) - 1] = '\0'; - } -#ifndef X_DISPLAY_MISSING - if ((display = getenv("DISPLAY")) && *display) { - mytty = g_strdup(display); - } else { -#endif -#ifdef WIN32 - mytty = g_strdup("WinPurple"); -#else - ttyp = ttyname(0); - if (ttyp && *ttyp) { - p = strchr(ttyp + 1, '/'); - mytty = g_strdup((p) ? p + 1 : ttyp); - } else { - mytty = g_strdup("unknown"); - } -#endif -#ifndef X_DISPLAY_MISSING - } -#endif - reenter = 1; - } - - ourtime = time((time_t *)0); - bptr[0] = host; - bptr[1] = ctime(&ourtime); - bptr[1][strlen(bptr[1])-1] = '\0'; - bptr[2] = mytty; - - if ((retval = ZSendList(¬ice, bptr, 3, auth)) != ZERR_NONE) - return (retval); - - retval = Z_WaitForNotice (&retnotice, ZCompareUIDPred, ¬ice.z_uid, - SRV_TIMEOUT); - if (retval != ZERR_NONE) - return retval; - - if (retnotice.z_kind == SERVNAK) { - if (!retnotice.z_message_len) { - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - if (!strcmp(retnotice.z_message, ZSRVACK_NOTSENT)) { - ZFreeNotice(&retnotice); - return (ZERR_AUTHFAIL); - } - if (!strcmp(retnotice.z_message, ZSRVACK_FAIL)) { - ZFreeNotice(&retnotice); - return (ZERR_LOGINFAIL); - } - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - - if (retnotice.z_kind != SERVACK) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - if (!retnotice.z_message_len) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - if (strcmp(retnotice.z_message, ZSRVACK_SENT) && - strcmp(retnotice.z_message, ZSRVACK_NOTSENT)) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - ZFreeNotice(&retnotice); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMakeAscii.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMakeAscii.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMakeAscii.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMakeAscii.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZMakeAscii function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -static char *itox_chars = "0123456789ABCDEF"; - -Code_t ZMakeAscii(ptr, len, field, num) - register char *ptr; - int len; - unsigned char *field; - int num; -{ - int i; - - for (i=0;i> 4)]; - *ptr++ = itox_chars[(int) (field[i] & 0xf)]; - len -= 2; - } - - *ptr = '\0'; - return ZERR_NONE; -} - -Code_t ZMakeAscii32(ptr, len, value) - register char *ptr; - int len; - unsigned long value; -{ - if (len < 11) - return ZERR_FIELDLEN; - *ptr++ = '0'; - *ptr++ = 'x'; - *ptr++ = itox_chars[(value >> 28) & 0xf]; - *ptr++ = itox_chars[(value >> 24) & 0xf]; - *ptr++ = itox_chars[(value >> 20) & 0xf]; - *ptr++ = itox_chars[(value >> 16) & 0xf]; - *ptr++ = itox_chars[(value >> 12) & 0xf]; - *ptr++ = itox_chars[(value >> 8) & 0xf]; - *ptr++ = itox_chars[(value >> 4) & 0xf]; - *ptr++ = itox_chars[(value >> 0) & 0xf]; - *ptr = 0; - return ZERR_NONE; -} - -Code_t ZMakeAscii16(ptr, len, value) - register char *ptr; - int len; - unsigned int value; -{ - if (len < 7) - return ZERR_FIELDLEN; - *ptr++ = '0'; - *ptr++ = 'x'; - *ptr++ = itox_chars[(value >> 12) & 0xf]; - *ptr++ = itox_chars[(value >> 8) & 0xf]; - *ptr++ = itox_chars[(value >> 4) & 0xf]; - *ptr++ = itox_chars[(value >> 0) & 0xf]; - *ptr = 0; - return ZERR_NONE; -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMkAuth.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMkAuth.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMkAuth.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZMkAuth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZMakeAuthentication function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifndef ERROR_TABLE_BASE_krb -#define ERROR_TABLE_BASE_krb (39525376L) -#endif - -#ifdef ZEPHYR_USES_KERBEROS -#ifdef WIN32 - -#else -#include -#endif -static long last_authent_time = 0L; -static KTEXT_ST last_authent; -#endif - -#if 0 -Code_t ZResetAuthentication () { -#ifdef ZEPHYR_USES_KERBEROS - last_authent_time = 0L; -#endif - return ZERR_NONE; -} -#endif - -Code_t ZMakeAuthentication(notice, buffer, buffer_len, len) - register ZNotice_t *notice; - char *buffer; - int buffer_len; - int *len; -{ -#ifdef ZEPHYR_USES_KERBEROS - int result; - time_t now; - KTEXT_ST authent; - char *cstart, *cend; - ZChecksum_t checksum; - CREDENTIALS cred; - extern unsigned long des_quad_cksum(); - - now = time(0); - if (last_authent_time == 0 || (now - last_authent_time > 120)) { - result = krb_mk_req(&authent, SERVER_SERVICE, - SERVER_INSTANCE, __Zephyr_realm, 0); - if (result != MK_AP_OK) { - last_authent_time = 0; - return (result+ERROR_TABLE_BASE_krb); - } - last_authent_time = now; - last_authent = authent; - } - else { - authent = last_authent; - } - notice->z_auth = 1; - notice->z_authent_len = authent.length; - notice->z_ascii_authent = (char *)malloc((unsigned)authent.length*3); - /* zero length authent is an error, so malloc(0) is not a problem */ - if (!notice->z_ascii_authent) - return (ENOMEM); - if ((result = ZMakeAscii(notice->z_ascii_authent, - authent.length*3, - authent.dat, - authent.length)) != ZERR_NONE) { - free(notice->z_ascii_authent); - return (result); - } - result = Z_FormatRawHeader(notice, buffer, buffer_len, len, &cstart, - &cend); - free(notice->z_ascii_authent); - notice->z_authent_len = 0; - if (result) - return(result); - - /* Compute a checksum over the header and message. */ - if ((result = krb_get_cred(SERVER_SERVICE, SERVER_INSTANCE, - __Zephyr_realm, &cred)) != 0) - return result; - checksum = des_quad_cksum(buffer, NULL, cstart - buffer, 0, (C_Block *)cred.session); - checksum ^= des_quad_cksum(cend, NULL, buffer + *len - cend, 0, - (C_Block *)cred.session); - checksum ^= des_quad_cksum(notice->z_message, NULL, notice->z_message_len, - 0, (C_Block *)cred.session); - notice->z_checksum = checksum; - ZMakeAscii32(cstart, buffer + buffer_len - cstart, checksum); - - return (ZERR_NONE); -#else - notice->z_checksum = 0; - notice->z_auth = 1; - notice->z_authent_len = 0; - notice->z_ascii_authent = ""; - return (Z_FormatRawHeader(notice, buffer, buffer_len, len, NULL, NULL)); -#endif -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZNewLocU.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZNewLocU.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZNewLocU.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZNewLocU.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZNewLocateUser function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZLocateUser(user, nlocs, auth) - char *user; - int *nlocs; - Z_AuthProc auth; -{ - Code_t retval; - ZNotice_t notice; - ZAsyncLocateData_t zald; - - (void) ZFlushLocations(); /* ZFlushLocations never fails (the library - is allowed to know this). */ - - if ((retval = ZRequestLocations(user, &zald, UNACKED, auth)) != ZERR_NONE) - return(retval); - - retval = Z_WaitForNotice (¬ice, ZCompareALDPred, &zald, SRV_TIMEOUT); - if (retval == ZERR_NONOTICE) - return ETIMEDOUT; - if (retval != ZERR_NONE) - return retval; - - if ((retval = ZParseLocations(¬ice, &zald, nlocs, NULL)) != ZERR_NONE) { - ZFreeNotice(¬ice); - return(retval); - } - - ZFreeNotice(¬ice); - ZFreeALD(&zald); - return(ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZOpenPort.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZOpenPort.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZOpenPort.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZOpenPort.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZOpenPort function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" -#ifdef WIN32 -#include -#else -#include -#endif - -Code_t ZOpenPort(port) - unsigned short *port; -{ - struct sockaddr_in bindin; - socklen_t len; - - (void) ZClosePort(); - - if ((__Zephyr_fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - __Zephyr_fd = -1; - return (errno); - } - -#ifdef SO_BSDCOMPAT - { - int on = 1; - - setsockopt(__Zephyr_fd, SOL_SOCKET, SO_BSDCOMPAT, (char *)&on, - sizeof(on)); - } -#endif - - bindin.sin_family = AF_INET; - - if (port && *port) - bindin.sin_port = *port; - else - bindin.sin_port = 0; - - bindin.sin_addr.s_addr = INADDR_ANY; - - if (bind(__Zephyr_fd, (struct sockaddr *)&bindin, sizeof(bindin)) < 0) { - if (errno == EADDRINUSE && port && *port) - return (ZERR_PORTINUSE); - else - return (errno); - } - - if (!bindin.sin_port) { - len = sizeof(bindin); - if (getsockname(__Zephyr_fd, (struct sockaddr *)&bindin, &len)) - return (errno); - } - - __Zephyr_port = bindin.sin_port; - __Zephyr_open = 1; - - if (port) - *port = bindin.sin_port; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZParseNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZParseNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZParseNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZParseNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZParseNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -/* Assume that strlen is efficient on this machine... */ -#define next_field(ptr) ptr += strlen (ptr) + 1 - -#if defined (__GNUC__) && defined (__vax__) -#undef next_field -static __inline__ char * Istrend (char *str) { - /* - * This should be faster on VAX models outside the 2 series. Don't - * use it if you are using MicroVAX 2 servers. If you are using a - * VS2 server, use something like - * #define next_field(ptr) while(*ptr++) - * instead of this code. - * - * This requires use of GCC to get the optimized code, but - * everybody uses GCC, don't they? :-) - */ - register char *str2 asm ("r1"); - /* Assumes that no field is longer than 64K.... */ - asm ("locc $0,$65535,(%1)" : "=r" (str2) : "r" (str) : "r0"); - return str2; -} -#define next_field(ptr) ptr = Istrend (ptr) + 1 -#endif - -#ifdef mips -#undef next_field -/* - * The compiler doesn't optimize this macro as well as it does the - * following function. - */ -#define next_fieldXXX(ptr) do{register unsigned c1,c2;c1= *ptr; \ - while((ptr++,c2= *ptr,c1)&&(ptr++,c1= *ptr,c2));}while(0) -static char *next_field_1 (s) char *s; { - /* - * Calling overhead is still present, but this routine is faster - * than strlen, and doesn't bother with some of the other math - * that we'd just have to undo later anyways. - */ - register unsigned c1 = *s, c2; - while (1) { - s++; c2 = *s; if (c1 == 0) break; - s++; c1 = *s; if (c2 == 0) break; - s++; c2 = *s; if (c1 == 0) break; - s++; c1 = *s; if (c2 == 0) break; - } - return s; -} -#define next_field(ptr) ptr=next_field_1(ptr) -#endif - -Code_t ZParseNotice(buffer, len, notice) - char *buffer; - int len; - ZNotice_t *notice; -{ - char *ptr, *end; - unsigned long temp; - int maj, numfields, i; - -#ifdef __LINE__ - int lineno; - /* Note: This definition of BAD eliminates lint and compiler - * complains about the "while (0)", but require that the macro not - * be used as the "then" part of an "if" statement that also has - * an "else" clause. - */ -#define BAD_PACKET {lineno=__LINE__;goto badpkt;} - /* This one gets lint/compiler complaints. */ -/*#define BAD do{lineno=__LINE__;goto badpkt;}while(0)*/ -#else -#define BAD_PACKET goto badpkt -#endif - - (void) memset((char *)notice, 0, sizeof(ZNotice_t)); - - ptr = buffer; - end = buffer+len; - - notice->z_packet = buffer; - - notice->z_version = ptr; - if (strncmp(ptr, ZVERSIONHDR, sizeof(ZVERSIONHDR) - 1)) - return (ZERR_VERS); - ptr += sizeof(ZVERSIONHDR) - 1; - if (!*ptr) { -#ifdef Z_DEBUG - Z_debug ("ZParseNotice: null version string"); -#endif - return ZERR_BADPKT; - } - maj = atoi(ptr); - if (maj != ZVERSIONMAJOR) - return (ZERR_VERS); - next_field (ptr); - - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - numfields = temp; - next_field (ptr); - - /*XXX 3 */ - numfields -= 2; /* numfields, version, and checksum */ - if (numfields < 0) { -#ifdef __LINE__ - lineno = __LINE__; - badpkt: -#ifdef Z_DEBUG - Z_debug ("ZParseNotice: bad packet from %s/%d (line %d)", - inet_ntoa (notice->z_uid.zuid_addr.s_addr), - notice->z_port, lineno); -#endif -#else - badpkt: -#ifdef Z_DEBUG - Z_debug ("ZParseNotice: bad packet from %s/%d", - inet_ntoa (notice->z_uid.zuid_addr.s_addr), - notice->z_port); -#endif -#endif - return ZERR_BADPKT; - } - - if (numfields) { - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_kind = temp; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_uid, - sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_time.tv_sec = ntohl((unsigned long) notice->z_uid.tv.tv_sec); - notice->z_time.tv_usec = ntohl((unsigned long) notice->z_uid.tv.tv_usec); - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - if (ZReadAscii16(ptr, end-ptr, ¬ice->z_port) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_port = htons(notice->z_port); - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_auth = temp; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - notice->z_checked_auth = ZAUTH_UNSET; - - if (numfields) { - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_authent_len = temp; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - notice->z_ascii_authent = ptr; - numfields--; - next_field (ptr); - } - else - BAD_PACKET; - - if (numfields) { - notice->z_class = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_class = ""; - - if (numfields) { - notice->z_class_inst = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_class_inst = ""; - - if (numfields) { - notice->z_opcode = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_opcode = ""; - - if (numfields) { - notice->z_sender = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_sender = ""; - - if (numfields) { - notice->z_recipient = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_recipient = ""; - - if (numfields) { - notice->z_default_format = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_default_format = ""; - -/*XXX*/ - if (ZReadAscii32(ptr, end-ptr, &temp) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_checksum = temp; - numfields--; - next_field (ptr); - - if (numfields) { - notice->z_multinotice = ptr; - numfields--; - next_field (ptr); - } - else - notice->z_multinotice = ""; - - if (numfields) { - if (ZReadAscii(ptr, end-ptr, (unsigned char *)¬ice->z_multiuid, - sizeof(ZUnique_Id_t)) == ZERR_BADFIELD) - BAD_PACKET; - notice->z_time.tv_sec = ntohl((unsigned long) notice->z_multiuid.tv.tv_sec); - notice->z_time.tv_usec = ntohl((unsigned long) notice->z_multiuid.tv.tv_usec); - numfields--; - next_field (ptr); - } - else - notice->z_multiuid = notice->z_uid; - - for (i=0;iz_other_fields[i] = ptr; - next_field (ptr); - } - notice->z_num_other_fields = i; - - for (i=0;iz_message = (void *)ptr; - notice->z_message_len = len-(ptr-buffer); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekIfNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekIfNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekIfNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekIfNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZPeekIfNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZPeekIfNotice(notice, from, predicate, args) - ZNotice_t *notice; - struct sockaddr_in *from; - int (*predicate)(); - char *args; -{ - ZNotice_t tmpnotice; - Code_t retval; - char *buffer; - struct _Z_InputQ *qptr; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - for (;;) { - qptr = Z_GetFirstComplete(); - while (qptr) { - if ((retval = ZParseNotice(qptr->packet, qptr->packet_len, - &tmpnotice)) != ZERR_NONE) - return (retval); - if ((*predicate)(&tmpnotice, args)) { - if (!(buffer = (char *) malloc((unsigned) qptr->packet_len))) - return (ENOMEM); - (void) memcpy(buffer, qptr->packet, qptr->packet_len); - if (from) - *from = qptr->from; - if ((retval = ZParseNotice(buffer, qptr->packet_len, - notice)) != ZERR_NONE) { - free(buffer); - return (retval); - } - return (ZERR_NONE); - } - qptr = Z_GetNextComplete(qptr); - } - if ((retval = Z_ReadWait()) != ZERR_NONE) - return (retval); - } -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekNot.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekNot.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekNot.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekNot.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for ZPeekNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZPeekNotice(notice, from) - ZNotice_t *notice; - struct sockaddr_in *from; -{ - char *buffer; - int len; - Code_t retval; - - if ((retval = ZPeekPacket(&buffer, &len, from)) != ZERR_NONE) - return (retval); - - return (ZParseNotice(buffer, len, notice)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekPkt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekPkt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekPkt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPeekPkt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for ZPeekPacket function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZPeekPacket(buffer, ret_len, from) - char **buffer; - int *ret_len; - struct sockaddr_in *from; -{ - Code_t retval; - struct _Z_InputQ *nextq; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - nextq =Z_GetFirstComplete(); - - *ret_len = nextq->packet_len; - - if (!(*buffer = (char *) malloc((unsigned) *ret_len))) - return (ENOMEM); - - (void) memcpy(*buffer, nextq->packet, *ret_len); - - if (from) - *from = nextq->from; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPending.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPending.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPending.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZPending.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZPending function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -int ZPending() -{ - int retval; - - if (ZGetFD() < 0) { - errno = ZERR_NOPORT; - return (-1); - } - - if ((retval = Z_ReadEnqueue()) != ZERR_NONE) { - errno = retval; - return (-1); - } - - return(ZQLength()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZReadAscii.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZReadAscii.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZReadAscii.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZReadAscii.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZReadAscii function. - * - * Created by: Robert French - * - * Copyright (c) 1987, 1990 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?temp:((temp-='A'-'9'-1),(temp<16)?temp:-1)) - -Code_t ZReadAscii(ptr, len, field, num) - char *ptr; - int len; - unsigned char *field; - int num; -{ - int i; - unsigned int hexbyte; - register int c1, c2; - register unsigned int temp; - - for (i=0;ipacket_len; - - if (!(buffer = (char *) malloc((unsigned) len))) - return (ENOMEM); - - if (from) - *from = nextq->from; - - (void) memcpy(buffer, nextq->packet, len); - - auth = nextq->auth; - Z_RemQueue(nextq); - - if ((retval = ZParseNotice(buffer, len, notice)) != ZERR_NONE) - return (retval); - notice->z_checked_auth = auth; - return ZERR_NONE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRecvPkt.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRecvPkt.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRecvPkt.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRecvPkt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for ZReceivePacket function. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZReceivePacket(buffer, ret_len, from) - ZPacket_t buffer; - int *ret_len; - struct sockaddr_in *from; -{ - Code_t retval; - struct _Z_InputQ *nextq; - - if ((retval = Z_WaitForComplete()) != ZERR_NONE) - return (retval); - - nextq = Z_GetFirstComplete(); - - *ret_len = nextq->packet_len; - if (*ret_len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - (void) memcpy(buffer, nextq->packet, *ret_len); - - if (from) - *from = nextq->from; - - Z_RemQueue(nextq); - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRetSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRetSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRetSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZRetSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZRetrieveSubscriptions and - * ZRetrieveDefaultSubscriptions functions. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -static Code_t Z_RetSubs(ZNotice_t *notice, int *nsubs, Z_AuthProc auth_routine); - -/* Need STDC definition when possible for unsigned short argument. */ -#ifdef __STDC__ -Code_t ZRetrieveSubscriptions(unsigned short port, int *nsubs) -#else -Code_t ZRetrieveSubscriptions(port,nsubs) - unsigned short port; - int *nsubs; -#endif -{ - int retval; - ZNotice_t notice; - char asciiport[50]; - - if (!port) /* use default port */ - port = __Zephyr_port; - - retval = ZMakeAscii16(asciiport, sizeof(asciiport), ntohs(port)); - if (retval != ZERR_NONE) - return (retval); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_message = asciiport; - notice.z_message_len = strlen(asciiport)+1; - notice.z_opcode = CLIENT_GIMMESUBS; - - return(Z_RetSubs(¬ice, nsubs, ZAUTH)); -} - -#if 0 -Code_t ZRetrieveDefaultSubscriptions(nsubs) - int *nsubs; -{ - ZNotice_t notice; - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_message = (char *) 0; - notice.z_message_len = 0; - notice.z_opcode = CLIENT_GIMMEDEFS; - - return(Z_RetSubs(¬ice, nsubs, ZNOAUTH)); - -} -#endif - -static Code_t Z_RetSubs(notice, nsubs, auth_routine) - register ZNotice_t *notice; - int *nsubs; - Z_AuthProc auth_routine; -{ - register int i; - int retval,nrecv,gimmeack; - ZNotice_t retnotice; - char *ptr,*end,*ptr2; - - retval = ZFlushSubscriptions(); - - if (retval != ZERR_NONE && retval != ZERR_NOSUBSCRIPTIONS) - return (retval); - - if (ZGetFD() < 0) - if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) - return (retval); - - notice->z_kind = ACKED; - notice->z_port = __Zephyr_port; - notice->z_class = ZEPHYR_CTL_CLASS; - notice->z_class_inst = ZEPHYR_CTL_CLIENT; - notice->z_sender = 0; - notice->z_recipient = ""; - notice->z_default_format = ""; - - if ((retval = ZSendNotice(notice,auth_routine)) != ZERR_NONE) - return (retval); - - nrecv = 0; - gimmeack = 0; - __subscriptions_list = (ZSubscription_t *) 0; - - while (!nrecv || !gimmeack) { - retval = Z_WaitForNotice (&retnotice, ZCompareMultiUIDPred, - ¬ice->z_multiuid, SRV_TIMEOUT); - if (retval == ZERR_NONOTICE) - return ETIMEDOUT; - else if (retval != ZERR_NONE) - return retval; - - if (retnotice.z_kind == SERVNAK) { - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - /* non-matching protocol version numbers means the - server is probably an older version--must punt */ - if (strcmp(notice->z_version,retnotice.z_version)) { - ZFreeNotice(&retnotice); - return(ZERR_VERS); - } - if (retnotice.z_kind == SERVACK && - !strcmp(retnotice.z_opcode,notice->z_opcode)) { - ZFreeNotice(&retnotice); - gimmeack = 1; - continue; - } - - if (retnotice.z_kind != ACKED) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - - nrecv++; - - end = retnotice.z_message+retnotice.z_message_len; - - __subscriptions_num = 0; - for (ptr=retnotice.z_message;ptr -#else -#include -#endif - -static int wait_for_hmack(ZNotice_t *notice, void *uid); - -Code_t ZSendPacket(packet, len, waitforack) - char *packet; - int len; - int waitforack; -{ - Code_t retval; - struct sockaddr_in dest; - ZNotice_t notice, acknotice; - - if (!packet || len < 0) - return (ZERR_ILLVAL); - - if (len > Z_MAXPKTLEN) - return (ZERR_PKTLEN); - - if (ZGetFD() < 0) - if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) - return (retval); - - dest = ZGetDestAddr(); - - if (sendto(ZGetFD(), packet, len, 0, (struct sockaddr *)&dest, - sizeof(dest)) < 0) - return (errno); - - if (!waitforack) - return (ZERR_NONE); - - if ((retval = ZParseNotice(packet, len, ¬ice)) != ZERR_NONE) - return (retval); - - retval = Z_WaitForNotice (&acknotice, wait_for_hmack, ¬ice.z_uid, - HM_TIMEOUT); - if (retval == ETIMEDOUT) - return ZERR_HMDEAD; - if (retval == ZERR_NONE) - ZFreeNotice (&acknotice); - return retval; -} - -static int wait_for_hmack(ZNotice_t *notice, void *uid) -{ - return (notice->z_kind == HMACK && ZCompareUID(¬ice->z_uid, (ZUnique_Id_t *)uid)); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRaw.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRaw.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRaw.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRaw.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSendRawNotice function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZSendRawNotice(notice) - ZNotice_t *notice; -{ - Code_t retval; - ZNotice_t newnotice; - char *buffer; - int len; - - if ((retval = ZFormatRawNotice(notice, &buffer, &len)) != - ZERR_NONE) - return (retval); - - if ((retval = ZParseNotice(buffer, len, &newnotice)) != ZERR_NONE) - return (retval); - - retval = Z_SendFragmentedNotice(&newnotice, len, NULL, Z_XmitFragment); - - free(buffer); - - return (retval); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRLst.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRLst.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRLst.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSendRLst.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSendRawList function. - * - * Created by: John T. Kohl - * - * Copyright (c) 1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#if 0 -Code_t ZSendRawList(notice, list, nitems) - ZNotice_t *notice; - char *list[]; - int nitems; -{ - return(ZSrvSendRawList(notice, list, nitems, Z_XmitFragment)); -} - -Code_t ZSrvSendRawList(notice, list, nitems, send_routine) - ZNotice_t *notice; - char *list[]; - int nitems; - Code_t (*send_routine)(); -{ - Code_t retval; - ZNotice_t newnotice; - char *buffer; - int len; - - if ((retval = ZFormatRawNoticeList(notice, list, nitems, &buffer, - &len)) != ZERR_NONE) - return (retval); - - if ((retval = ZParseNotice(buffer, len, &newnotice)) != ZERR_NONE) - return (retval); - - retval = Z_SendFragmentedNotice(&newnotice, len, NULL, send_routine); - - free(buffer); - - return (retval); -} -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetDest.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetDest.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetDest.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetDest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetDestAddr function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZSetDestAddr(addr) - struct sockaddr_in *addr; -{ - __HM_addr = *addr; - - __HM_set = 1; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetFD.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetFD.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetFD.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetFD.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetFD function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZSetFD(fd) - int fd; -{ - (void) ZClosePort(); - - __Zephyr_fd = fd; - __Zephyr_open = 0; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetSrv.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetSrv.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetSrv.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSetSrv.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSetServerState function. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -Code_t ZSetServerState(state) - int state; -{ - __Zephyr_server = state; - - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSubs.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSubs.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSubs.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZSubs.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,193 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZSubscribeTo, ZUnsubscribeTo, and - * ZCancelSubscriptions functions. - * - * Created by: Robert French - * - * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -static Code_t Z_Subscriptions __P((register ZSubscription_t *sublist, - int nitems, unsigned int port, - char *opcode, int authit)); -static Code_t subscr_sendoff __P((ZNotice_t *notice, char **lyst, int num, - int authit)); - -Code_t ZSubscribeTo(sublist, nitems, port) - ZSubscription_t *sublist; - int nitems; - unsigned int port; -{ - return (Z_Subscriptions(sublist, nitems, port, CLIENT_SUBSCRIBE, 1)); -} - -Code_t ZSubscribeToSansDefaults(sublist, nitems, port) - ZSubscription_t *sublist; - int nitems; - unsigned int port; -{ - return (Z_Subscriptions(sublist, nitems, port, CLIENT_SUBSCRIBE_NODEFS, - 1)); -} - -Code_t ZUnsubscribeTo(sublist, nitems, port) - ZSubscription_t *sublist; - int nitems; - unsigned int port; -{ - return (Z_Subscriptions(sublist, nitems, port, CLIENT_UNSUBSCRIBE, 1)); -} - -Code_t ZCancelSubscriptions(port) - unsigned int port; -{ - return (Z_Subscriptions((ZSubscription_t *)0, 0, port, - CLIENT_CANCELSUB, 0)); -} - -/* - * This routine must do its own fragmentation. Subscriptions must - * not be broken across packet boundaries, or else the server will - * mis-interpret them. - */ - -static Code_t -Z_Subscriptions(sublist, nitems, port, opcode, authit) - register ZSubscription_t *sublist; - int nitems; - unsigned int port; - char *opcode; - int authit; -{ - register int i, j; - int retval; - ZNotice_t notice; - char header[Z_MAXHEADERLEN]; - char **list; - char *recip; - int hdrlen; - int size_avail = Z_MAXPKTLEN-Z_FRAGFUDGE; /* space avail for data, - adjusted below */ - int size, start, numok; - - /* nitems = 0 means cancel all subscriptions; still need to allocate a */ - /* array for one item so we can cancel, however. */ - - list = (char **)malloc((unsigned)((nitems==0)?1:nitems)*3*sizeof(char *)); - if (!list) - return (ENOMEM); - - (void) memset((char *)¬ice, 0, sizeof(notice)); - notice.z_kind = ACKED; - notice.z_port = port; - notice.z_class = ZEPHYR_CTL_CLASS; - notice.z_class_inst = ZEPHYR_CTL_CLIENT; - notice.z_opcode = opcode; - notice.z_sender = 0; - notice.z_recipient = ""; - notice.z_default_format = ""; - notice.z_message_len = 0; - - /* format the header to figure out how long it is */ - retval = Z_FormatHeader(¬ice, header, sizeof(header), &hdrlen, ZAUTH); - if (retval != ZERR_NONE && !authit) - retval = Z_FormatHeader(¬ice, header, sizeof(header), - &hdrlen, ZNOAUTH); - if (retval != ZERR_NONE) { - free((char *)list); - return(retval); - } - - /* compute amount of room left */ - size_avail -= hdrlen; - size = size_avail; - - /* assemble subs into an array of pointers */ - for (i=0;iz_uid)) != - ZERR_NONE) - return (retval); - if (retnotice.z_kind == SERVNAK) { - ZFreeNotice(&retnotice); - return (ZERR_SERVNAK); - } - if (retnotice.z_kind != SERVACK) { - ZFreeNotice(&retnotice); - return (ZERR_INTERNAL); - } - ZFreeNotice(&retnotice); - return (ZERR_NONE); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZVariables.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZVariables.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZVariables.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZVariables.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,221 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains source for the ZGetVariable, ZSetVariable, and ZUnsetVariable - * functions. - * - * Created by: Robert French - * - * Copyright (c) 1987 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "libpurple/internal.h" -#include "internal.h" -#include "util.h" - -#include -#ifndef WIN32 -#include -#endif - -static char *get_localvarfile __P((void)); -static char *get_varval __P((char *fn, char *val)); -static int varline __P((char *bfr, char *var)); - -char *ZGetVariable(var) - char *var; -{ - char *varfile, *ret; - - if ((varfile = get_localvarfile()) == NULL) - return ((char *)0); - - if ((ret = get_varval(varfile, var)) != ZERR_NONE) { - g_free(varfile); - return ret; - } - -#ifdef WIN32 - varfile = g_strdup("C:\\zephyr\\zephyr.var"); -#else - varfile = g_strdup_printf("%s/zephyr.vars", CONFDIR); -#endif - ret = get_varval(varfile, var); - g_free(varfile); - - return ret; -} - -Code_t ZSetVariable(var, value) - char *var; - char *value; -{ - int written; - FILE *fpin, *fpout; - char *varfile, *varfilebackup, varbfr[512]; - - written = 0; - - if ((varfile = get_localvarfile()) == NULL) - return (ZERR_INTERNAL); - - varfilebackup = g_strconcat(varfile, ".backup", NULL); - - if (!(fpout = fopen(varfilebackup, "w"))) { - g_free(varfile); - g_free(varfilebackup); - return (errno); - } - if ((fpin = fopen(varfile, "r")) != NULL) { - while (fgets(varbfr, sizeof varbfr, fpin) != (char *) 0) { - if (varbfr[strlen(varbfr)-1] < ' ') - varbfr[strlen(varbfr)-1] = '\0'; - if (varline(varbfr, var)) { - fprintf(fpout, "%s = %s\n", var, value); - written = 1; - } - else - fprintf(fpout, "%s\n", varbfr); - } - (void) fclose(fpin); /* don't care about errs on input */ - } - if (!written) - fprintf(fpout, "%s = %s\n", var, value); - if (fclose(fpout) == EOF) { - g_free(varfilebackup); - g_free(varfile); - return(EIO); /* can't rely on errno */ - } - if (rename(varfilebackup, varfile)) { - g_free(varfilebackup); - g_free(varfile); - return (errno); - } - g_free(varfilebackup); - g_free(varfile); - return (ZERR_NONE); -} - -Code_t ZUnsetVariable(var) - char *var; -{ - FILE *fpin, *fpout; - char *varfile, *varfilebackup, varbfr[512]; - - if ((varfile = get_localvarfile()) == NULL) - return (ZERR_INTERNAL); - - varfilebackup = g_strconcat(varfile, ".backup", NULL); - - if (!(fpout = fopen(varfilebackup, "w"))) { - g_free(varfile); - g_free(varfilebackup); - return (errno); - } - if ((fpin = fopen(varfile, "r")) != NULL) { - while (fgets(varbfr, sizeof varbfr, fpin) != (char *) 0) { - if (varbfr[strlen(varbfr)-1] < ' ') - varbfr[strlen(varbfr)-1] = '\0'; - if (!varline(varbfr, var)) - fprintf(fpout, "%s\n", varbfr); - } - (void) fclose(fpin); /* don't care about read close errs */ - } - if (fclose(fpout) == EOF) { - g_free(varfilebackup); - g_free(varfile); - return(EIO); /* errno isn't reliable */ - } - if (rename(varfilebackup, varfile)) { - g_free(varfilebackup); - g_free(varfile); - return (errno); - } - g_free(varfilebackup); - g_free(varfile); - return (ZERR_NONE); -} - -static char *get_localvarfile(void) -{ - const char *base; -#ifndef WIN32 - struct passwd *pwd; - base = purple_home_dir(); -#else - base = getenv("HOME"); - if (!base) - base = getenv("HOMEPATH"); - if (!base) - base = "C:\\"; -#endif - if (!base) { -#ifndef WIN32 - if (!(pwd = getpwuid((int) getuid()))) { - fprintf(stderr, "Zephyr internal failure: Can't find your entry in /etc/passwd\n"); - return NULL; - } - base = pwd->pw_dir; -#endif - } - - return g_strconcat(base, "/.zephyr.vars", NULL); -} - -static char *get_varval(fn, var) - char *fn; - char *var; -{ - FILE *fp; - static char varbfr[512]; - int i; - - fp = fopen(fn, "r"); - if (!fp) - return ((char *)0); - - while (fgets(varbfr, sizeof varbfr, fp) != (char *) 0) { - if (varbfr[strlen(varbfr)-1] < ' ') - varbfr[strlen(varbfr)-1] = '\0'; - if (!(i = varline(varbfr, var))) - continue; - (void) fclose(fp); /* open read-only, don't care */ - return (varbfr+i); - } - (void) fclose(fp); /* open read-only, don't care */ - return ((char *)0); -} - -/* If the variable in the line bfr[] is the same as var, return index to - the variable value, else return 0. */ -static int varline(bfr, var) - char *bfr; - char *var; -{ - register char *cp; - - - if (!bfr[0] || bfr[0] == '#') /* comment or null line */ - return (0); - - cp = bfr; - while (*cp && !isspace(*cp) && (*cp != '=')) - cp++; - -#ifndef WIN32 -#define max(a,b) ((a > b) ? (a) : (b)) -#endif - - if (g_ascii_strncasecmp(bfr, var, max(strlen(var), cp - bfr))) - return(0); /* var is not the var in - bfr ==> no match */ - - cp = strchr(bfr, '='); - if (!cp) - return(0); - cp++; - while (*cp && isspace(*cp)) /* space up to variable value */ - cp++; - - return (cp - bfr); /* return index */ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZWait4Not.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZWait4Not.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZWait4Not.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/protocols/zephyr/ZWait4Not.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/* This file is part of the Project Athena Zephyr Notification System. - * It contains the ZCheckIfNotice/select loop used for waiting for - * a notice, with a timeout. - * - * Copyright (c) 1991 by the Massachusetts Institute of Technology. - * For copying and distribution information, see the file - * "mit-copyright.h". - */ - -#include "internal.h" - -#ifdef WIN32 -#include - -#ifndef ZEPHYR_USES_KERBEROS -static int gettimeofday(struct timeval* tv, struct timezone* tz){ - union { - long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } _now; - - GetSystemTimeAsFileTime( &(_now.ft) ); - tv->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); - tv->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); - return 0; - } -#endif - -#else -#include -#endif - -Code_t Z_WaitForNotice (notice, pred, arg, timeout) - ZNotice_t *notice; - int (*pred) __P((ZNotice_t *, void *)); - void *arg; - int timeout; -{ - Code_t retval; - struct timeval tv, t0; - fd_set fdmask; - int i, fd; - - retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, - (char *) arg); - if (retval == ZERR_NONE) - return ZERR_NONE; - if (retval != ZERR_NONOTICE) - return retval; - - fd = ZGetFD (); - FD_ZERO (&fdmask); - tv.tv_sec = timeout; - tv.tv_usec = 0; - gettimeofday (&t0, (struct timezone *)NULL); - t0.tv_sec += timeout; - while (1) { - FD_SET (fd, &fdmask); - i = select (fd + 1, &fdmask, (fd_set *) 0, (fd_set *) 0, &tv); - if (i == 0) - return ETIMEDOUT; - if (i < 0 && errno != EINTR) - return errno; - if (i > 0) { - retval = ZCheckIfNotice (notice, (struct sockaddr_in *) 0, pred, - (char *) arg); - if (retval != ZERR_NONOTICE) /* includes ZERR_NONE */ - return retval; - } - gettimeofday (&tv, (struct timezone *) NULL); - tv.tv_usec = t0.tv_usec - tv.tv_usec; - if (tv.tv_usec < 0) { - tv.tv_usec += 1000000; - tv.tv_sec = t0.tv_sec - tv.tv_sec - 1; - } - else - tv.tv_sec = t0.tv_sec - tv.tv_sec; - } - /*NOTREACHED*/ -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2543 +0,0 @@ -/** - * @file proxy.c Proxy API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* this is a little piece of code to handle proxy connection */ -/* it is intended to : 1st handle http proxy, using the CONNECT command - , 2nd provide an easy way to add socks support - , 3rd draw women to it like flies to honey */ - -#include "internal.h" -#include "cipher.h" -#include "debug.h" -#include "dnsquery.h" -#include "notify.h" -#include "ntlm.h" -#include "prefs.h" -#include "proxy.h" -#include "util.h" - -struct _PurpleProxyConnectData { - void *handle; - PurpleProxyConnectFunction connect_cb; - gpointer data; - gchar *host; - int port; - int fd; - int socket_type; - guint inpa; - PurpleProxyInfo *gpi; - PurpleDnsQueryData *query_data; - - /** - * This contains alternating length/char* values. The char* - * values need to be freed when removed from the linked list. - */ - GSList *hosts; - - /* - * All of the following variables are used when establishing a - * connection through a proxy. - */ - guchar *write_buffer; - gsize write_buf_len; - gsize written_len; - PurpleInputFunction read_cb; - guchar *read_buffer; - gsize read_buf_len; - gsize read_len; -}; - -static const char * const socks5errors[] = { - "succeeded\n", - "general SOCKS server failure\n", - "connection not allowed by ruleset\n", - "Network unreachable\n", - "Host unreachable\n", - "Connection refused\n", - "TTL expired\n", - "Command not supported\n", - "Address type not supported\n" -}; - -static PurpleProxyInfo *global_proxy_info = NULL; - -static GSList *handles = NULL; - -static void try_connect(PurpleProxyConnectData *connect_data); - -/* - * TODO: Eventually (GObjectification) this bad boy will be removed, because it is - * a gross fix for a crashy problem. - */ -#define PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data) g_slist_find(handles, connect_data) - -/************************************************************************** - * Proxy structure API - **************************************************************************/ -PurpleProxyInfo * -purple_proxy_info_new(void) -{ - return g_new0(PurpleProxyInfo, 1); -} - -void -purple_proxy_info_destroy(PurpleProxyInfo *info) -{ - g_return_if_fail(info != NULL); - - g_free(info->host); - g_free(info->username); - g_free(info->password); - - g_free(info); -} - -void -purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type) -{ - g_return_if_fail(info != NULL); - - info->type = type; -} - -void -purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host) -{ - g_return_if_fail(info != NULL); - - g_free(info->host); - info->host = g_strdup(host); -} - -void -purple_proxy_info_set_port(PurpleProxyInfo *info, int port) -{ - g_return_if_fail(info != NULL); - - info->port = port; -} - -void -purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username) -{ - g_return_if_fail(info != NULL); - - g_free(info->username); - info->username = g_strdup(username); -} - -void -purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password) -{ - g_return_if_fail(info != NULL); - - g_free(info->password); - info->password = g_strdup(password); -} - -PurpleProxyType -purple_proxy_info_get_type(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, PURPLE_PROXY_NONE); - - return info->type; -} - -const char * -purple_proxy_info_get_host(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, NULL); - - return info->host; -} - -int -purple_proxy_info_get_port(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, 0); - - return info->port; -} - -const char * -purple_proxy_info_get_username(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, NULL); - - return info->username; -} - -const char * -purple_proxy_info_get_password(const PurpleProxyInfo *info) -{ - g_return_val_if_fail(info != NULL, NULL); - - return info->password; -} - -/************************************************************************** - * Global Proxy API - **************************************************************************/ -PurpleProxyInfo * -purple_global_proxy_get_info(void) -{ - return global_proxy_info; -} - -void -purple_global_proxy_set_info(PurpleProxyInfo *info) -{ - g_return_if_fail(info != NULL); - - purple_proxy_info_destroy(global_proxy_info); - - global_proxy_info = info; -} - -static PurpleProxyInfo * -purple_gnome_proxy_get_info(void) -{ - static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; - gboolean use_same_proxy = FALSE; - gchar *tmp, *err = NULL; - - tmp = g_find_program_in_path("gconftool-2"); - if (tmp == NULL) - return purple_global_proxy_get_info(); - - g_free(tmp); - tmp = NULL; - - /* Check whether to use a proxy. */ - if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/mode", - &tmp, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - - if (purple_strequal(tmp, "none\n")) { - info.type = PURPLE_PROXY_NONE; - g_free(tmp); - return &info; - } - - if (!purple_strequal(tmp, "manual\n")) { - /* Unknown setting. Fallback to using our global proxy settings. */ - g_free(tmp); - return purple_global_proxy_get_info(); - } - - g_free(tmp); - tmp = NULL; - - /* Free the old fields */ - if (info.host) { - g_free(info.host); - info.host = NULL; - } - if (info.username) { - g_free(info.username); - info.username = NULL; - } - if (info.password) { - g_free(info.password); - info.password = NULL; - } - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/use_same_proxy", - &tmp, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - - if (purple_strequal(tmp, "true\n")) - use_same_proxy = TRUE; - g_free(tmp); - tmp = NULL; - - if (!use_same_proxy) { - if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_host", - &info.host, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - } - - if(info.host != NULL) - g_strchomp(info.host); - - if (!use_same_proxy && (info.host != NULL) && (*info.host != '\0')) { - info.type = PURPLE_PROXY_SOCKS5; - if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_port", - &tmp, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - info.port = atoi(tmp); - g_free(tmp); - } else { - g_free(info.host); - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", - &info.host, &err, NULL, NULL)) - return purple_global_proxy_get_info(); - g_free(err); - err = NULL; - - /* If we get this far then we know we're using an HTTP proxy */ - info.type = PURPLE_PROXY_HTTP; - - g_strchomp(info.host); - if (*info.host == '\0') - { - purple_debug_info("proxy", "Gnome proxy settings are set to " - "'manual' but no suitable proxy server is specified. Using " - "Pidgin's proxy settings instead.\n"); - g_free(info.host); - info.host = NULL; - return purple_global_proxy_get_info(); - } - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", - &info.username, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - err = NULL; - g_strchomp(info.username); - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_password", - &info.password, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - g_free(info.username); - info.username = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - err = NULL; - g_strchomp(info.password); - - if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", - &tmp, &err, NULL, NULL)) - { - g_free(info.host); - info.host = NULL; - g_free(info.username); - info.username = NULL; - g_free(info.password); - info.password = NULL; - return purple_global_proxy_get_info(); - } - g_free(err); - info.port = atoi(tmp); - g_free(tmp); - } - - return &info; -} - -#ifdef _WIN32 - -typedef BOOL (CALLBACK* LPFNWINHTTPGETIEPROXYCONFIG)(/*IN OUT*/ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig); - -/* This modifies "host" in-place evilly */ -static void -_proxy_fill_hostinfo(PurpleProxyInfo *info, char *host, int default_port) -{ - int port = default_port; - char *d; - - d = g_strrstr(host, ":"); - if (d) - *d = '\0'; - d++; - if (*d) - sscanf(d, "%d", &port); - - purple_proxy_info_set_host(info, host); - purple_proxy_info_set_port(info, port); -} - -static PurpleProxyInfo * -purple_win32_proxy_get_info(void) -{ - static LPFNWINHTTPGETIEPROXYCONFIG MyWinHttpGetIEProxyConfig = NULL; - static gboolean loaded = FALSE; - static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL}; - - WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_proxy_config; - - if (!loaded) { - loaded = TRUE; - MyWinHttpGetIEProxyConfig = (LPFNWINHTTPGETIEPROXYCONFIG) - wpurple_find_and_loadproc("winhttp.dll", "WinHttpGetIEProxyConfigForCurrentUser"); - if (!MyWinHttpGetIEProxyConfig) - purple_debug_warning("proxy", "Unable to read Windows Proxy Settings.\n"); - } - - if (!MyWinHttpGetIEProxyConfig) - return NULL; - - ZeroMemory(&ie_proxy_config, sizeof(ie_proxy_config)); - if (!MyWinHttpGetIEProxyConfig(&ie_proxy_config)) { - purple_debug_error("proxy", "Error reading Windows Proxy Settings(%lu).\n", GetLastError()); - return NULL; - } - - /* We can't do much if it is autodetect*/ - if (ie_proxy_config.fAutoDetect) { - purple_debug_error("proxy", "Windows Proxy Settings set to autodetect (not supported).\n"); - - /* TODO: For 3.0.0 we'll revisit this (maybe)*/ - - return NULL; - - } else if (ie_proxy_config.lpszProxy) { - gchar *proxy_list = g_utf16_to_utf8(ie_proxy_config.lpszProxy, -1, - NULL, NULL, NULL); - - /* We can't do anything about the bypass list, as we don't have the url */ - /* TODO: For 3.0.0 we'll revisit this*/ - - /* There are proxy settings for several protocols */ - if (proxy_list && *proxy_list) { - char *specific = NULL, *tmp; - - /* If there is only a global proxy, which means "HTTP" */ - if (!strchr(proxy_list, ';') || (specific = g_strstr_len(proxy_list, -1, "http=")) != NULL) { - - if (specific) { - specific += strlen("http="); - tmp = strchr(specific, ';'); - if (tmp) - *tmp = '\0'; - /* specific now points the proxy server (and port) */ - } else - specific = proxy_list; - - purple_proxy_info_set_type(&info, PURPLE_PROXY_HTTP); - _proxy_fill_hostinfo(&info, specific, 80); - /* TODO: is there a way to set the username/password? */ - purple_proxy_info_set_username(&info, NULL); - purple_proxy_info_set_password(&info, NULL); - - purple_debug_info("proxy", "Windows Proxy Settings: HTTP proxy: '%s:%d'.\n", - purple_proxy_info_get_host(&info), - purple_proxy_info_get_port(&info)); - - } else if ((specific = g_strstr_len(proxy_list, -1, "socks=")) != NULL) { - - specific += strlen("socks="); - tmp = strchr(specific, ';'); - if (tmp) - *tmp = '\0'; - /* specific now points the proxy server (and port) */ - - purple_proxy_info_set_type(&info, PURPLE_PROXY_SOCKS5); - _proxy_fill_hostinfo(&info, specific, 1080); - /* TODO: is there a way to set the username/password? */ - purple_proxy_info_set_username(&info, NULL); - purple_proxy_info_set_password(&info, NULL); - - purple_debug_info("proxy", "Windows Proxy Settings: SOCKS5 proxy: '%s:%d'.\n", - purple_proxy_info_get_host(&info), - purple_proxy_info_get_port(&info)); - - } else { - - purple_debug_info("proxy", "Windows Proxy Settings: No supported proxy specified.\n"); - - purple_proxy_info_set_type(&info, PURPLE_PROXY_NONE); - - } - } - - /* TODO: Fix API to be able look at proxy bypass settings */ - - g_free(proxy_list); - } else { - purple_debug_info("proxy", "No Windows proxy set.\n"); - purple_proxy_info_set_type(&info, PURPLE_PROXY_NONE); - } - - if (ie_proxy_config.lpszAutoConfigUrl) - GlobalFree(ie_proxy_config.lpszAutoConfigUrl); - if (ie_proxy_config.lpszProxy) - GlobalFree(ie_proxy_config.lpszProxy); - if (ie_proxy_config.lpszProxyBypass) - GlobalFree(ie_proxy_config.lpszProxyBypass); - - return &info; -} -#endif - - -/************************************************************************** - * Proxy API - **************************************************************************/ - -/** - * Whoever calls this needs to have called - * purple_proxy_connect_data_disconnect() beforehand. - */ -static void -purple_proxy_connect_data_destroy(PurpleProxyConnectData *connect_data) -{ - handles = g_slist_remove(handles, connect_data); - - if (connect_data->query_data != NULL) - purple_dnsquery_destroy(connect_data->query_data); - - while (connect_data->hosts != NULL) - { - /* Discard the length... */ - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); - /* Free the address... */ - g_free(connect_data->hosts->data); - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); - } - - g_free(connect_data->host); - g_free(connect_data); -} - -/** - * Free all information dealing with a connection attempt and - * reset the connect_data to prepare for it to try to connect - * to another IP address. - * - * If an error message is passed in, then we know the connection - * attempt failed. If the connection attempt failed and - * connect_data->hosts is not empty then we try the next IP address. - * If the connection attempt failed and we have no more hosts - * try try then we call the callback with the given error message, - * then destroy the connect_data. - * - * @param error_message An error message explaining why the connection - * failed. This will be passed to the callback function - * specified in the call to purple_proxy_connect(). If the - * connection was successful then pass in null. - */ -static void -purple_proxy_connect_data_disconnect(PurpleProxyConnectData *connect_data, const gchar *error_message) -{ - if (connect_data->inpa > 0) - { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - if (connect_data->fd >= 0) - { - close(connect_data->fd); - connect_data->fd = -1; - } - - g_free(connect_data->write_buffer); - connect_data->write_buffer = NULL; - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - if (error_message != NULL) - { - purple_debug_error("proxy", "Connection attempt failed: %s\n", - error_message); - if (connect_data->hosts != NULL) - try_connect(connect_data); - else - { - /* Everything failed! Tell the originator of the request. */ - connect_data->connect_cb(connect_data->data, -1, error_message); - purple_proxy_connect_data_destroy(connect_data); - } - } -} - -/** - * This calls purple_proxy_connect_data_disconnect(), but it lets you - * specify the error_message using a printf()-like syntax. - */ -static void -purple_proxy_connect_data_disconnect_formatted(PurpleProxyConnectData *connect_data, const char *format, ...) -{ - va_list args; - gchar *tmp; - - va_start(args, format); - tmp = g_strdup_vprintf(format, args); - va_end(args); - - purple_proxy_connect_data_disconnect(connect_data, tmp); - g_free(tmp); -} - -static void -purple_proxy_connect_data_connected(PurpleProxyConnectData *connect_data) -{ - purple_debug_info("proxy", "Connected to %s:%d.\n", - connect_data->host, connect_data->port); - - connect_data->connect_cb(connect_data->data, connect_data->fd, NULL); - - /* - * We've passed the file descriptor to the protocol, so it's no longer - * our responsibility, and we should be careful not to free it when - * we destroy the connect_data. - */ - connect_data->fd = -1; - - purple_proxy_connect_data_disconnect(connect_data, NULL); - purple_proxy_connect_data_destroy(connect_data); -} - -static void -socket_ready_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int error = 0; - int ret; - - /* If the socket-connected message had already been triggered when connect_data - * was destroyed via purple_proxy_connect_cancel(), we may get here with a freed connect_data. - */ - if (!PURPLE_PROXY_CONNECT_DATA_IS_VALID(connect_data)) - return; - - purple_debug_info("proxy", "Connecting to %s:%d.\n", - connect_data->host, connect_data->port); - - /* - * purple_input_get_error after a non-blocking connect returns -1 if something is - * really messed up (bad descriptor, usually). Otherwise, it returns 0 and - * error holds what connect would have returned if it blocked until now. - * Thus, error == 0 is success, error == EINPROGRESS means "try again", - * and anything else is a real error. - * - * (error == EINPROGRESS can happen after a select because the kernel can - * be overly optimistic sometimes. select is just a hint that you might be - * able to do something.) - */ - ret = purple_input_get_error(connect_data->fd, &error); - - if (ret == 0 && error == EINPROGRESS) { - /* No worries - we'll be called again later */ - /* TODO: Does this ever happen? */ - purple_debug_info("proxy", "(ret == 0 && error == EINPROGRESS)\n"); - return; - } - - if (ret != 0 || error != 0) { - if (ret != 0) - error = errno; - purple_debug_error("proxy", "Error connecting to %s:%d (%s).\n", - connect_data->host, connect_data->port, g_strerror(error)); - - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - purple_proxy_connect_data_connected(connect_data); -} - -static gboolean -clean_connect(gpointer data) -{ - purple_proxy_connect_data_connected(data); - - return FALSE; -} - -static void -proxy_connect_udp_none(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", "UDP Connecting to %s:%d with no proxy\n", - connect_data->host, connect_data->port); - - connect_data->fd = socket(addr->sa_family, SOCK_DGRAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("proxy", "UDP Connection in progress\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, socket_ready_cb, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - /* - * The connection happened IMMEDIATELY... strange, but whatever. - */ - int error = ETIMEDOUT; - int ret; - - purple_debug_info("proxy", "UDP Connected immediately.\n"); - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) - { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - /* - * We want to call the "connected" callback eventually, but we - * don't want to call it before we return, just in case. - */ - purple_timeout_add(10, clean_connect, connect_data); - } -} - -static void -proxy_connect_none(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", "Connecting to %s:%d with no proxy\n", - connect_data->host, connect_data->port); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("proxy", "Connection in progress\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, socket_ready_cb, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - /* - * The connection happened IMMEDIATELY... strange, but whatever. - */ - int error = ETIMEDOUT; - int ret; - - purple_debug_info("proxy", "Connected immediately.\n"); - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) - { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - /* - * We want to call the "connected" callback eventually, but we - * don't want to call it before we return, just in case. - */ - purple_timeout_add(10, clean_connect, connect_data); - } -} - -/** - * This is a utility function used by the HTTP, SOCKS4 and SOCKS5 - * connect functions. It writes data from a buffer to a socket. - * When all the data is written it sets up a watcher to read a - * response and call a specified function. - */ -static void -proxy_do_write(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data; - const guchar *request; - gsize request_len; - int ret; - - connect_data = data; - request = connect_data->write_buffer + connect_data->written_len; - request_len = connect_data->write_buf_len - connect_data->written_len; - - ret = write(connect_data->fd, request, request_len); - if (ret <= 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - return; - } - if (ret < request_len) { - connect_data->written_len += ret; - return; - } - - /* We're done writing data! Wait for a response. */ - g_free(connect_data->write_buffer); - connect_data->write_buffer = NULL; - purple_input_remove(connect_data->inpa); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_READ, connect_data->read_cb, connect_data); -} - -#define HTTP_GOODSTRING "HTTP/1.0 200" -#define HTTP_GOODSTRING2 "HTTP/1.1 200" - -/** - * We're using an HTTP proxy for a non-port 80 tunnel. Read the - * response to the CONNECT request. - */ -static void -http_canread(gpointer data, gint source, PurpleInputCondition cond) -{ - int len, headers_len, status = 0; - gboolean error; - PurpleProxyConnectData *connect_data = data; - char *p; - gsize max_read; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 8192; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - p = (char *)connect_data->read_buffer + connect_data->read_len; - max_read = connect_data->read_buf_len - connect_data->read_len - 1; - - len = read(connect_data->fd, p, max_read); - - if (len == 0) { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - p[len] = '\0'; - - p = g_strstr_len((const gchar *)connect_data->read_buffer, - connect_data->read_len, "\r\n\r\n"); - if (p != NULL) { - *p = '\0'; - headers_len = (p - (char *)connect_data->read_buffer) + 4; - } else if(len == max_read) - headers_len = len; - else - return; - - error = strncmp((const char *)connect_data->read_buffer, "HTTP/", 5) != 0; - if (!error) { - int major; - p = (char *)connect_data->read_buffer + 5; - major = strtol(p, &p, 10); - error = (major == 0) || (*p != '.'); - if(!error) { - int minor; - p++; - minor = strtol(p, &p, 10); - error = (*p != ' '); - if(!error) { - p++; - status = strtol(p, &p, 10); - error = (*p != ' '); - } - } - } - - /* Read the contents */ - p = g_strrstr((const gchar *)connect_data->read_buffer, "Content-Length: "); - if (p != NULL) { - gchar *tmp; - int len = 0; - char tmpc; - p += strlen("Content-Length: "); - tmp = strchr(p, '\r'); - if(tmp) - *tmp = '\0'; - len = atoi(p); - if(tmp) - *tmp = '\r'; - - /* Compensate for what has already been read */ - len -= connect_data->read_len - headers_len; - /* I'm assuming that we're doing this to prevent the server from - complaining / breaking since we don't read the whole page */ - while (len--) { - /* TODO: deal with EAGAIN (and other errors) better */ - if (read(connect_data->fd, &tmpc, 1) < 0 && errno != EAGAIN) - break; - } - } - - if (error) { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to parse response from HTTP proxy: %s"), - connect_data->read_buffer); - return; - } - else if (status != 200) { - purple_debug_error("proxy", - "Proxy server replied with:\n%s\n", - connect_data->read_buffer); - - if (status == 407 /* Proxy Auth */) { - const char *header; - gchar *request; - - header = g_strrstr((const gchar *)connect_data->read_buffer, - "Proxy-Authenticate: NTLM"); - if (header != NULL) { - const char *header_end = header + strlen("Proxy-Authenticate: NTLM"); - const char *domain = purple_proxy_info_get_username(connect_data->gpi); - char *username = NULL, hostname[256]; - gchar *response; - int ret; - - ret = gethostname(hostname, sizeof(hostname)); - hostname[sizeof(hostname) - 1] = '\0'; - if (ret < 0 || hostname[0] == '\0') { - purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?"); - strcpy(hostname, "localhost"); - } - - if (domain != NULL) - username = (char*) strchr(domain, '\\'); - if (username == NULL) { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("HTTP proxy connection error %d"), status); - return; - } - *username = '\0'; - - /* Is there a message? */ - if (*header_end == ' ') { - /* Check for Type-2 */ - char *tmp = (char*) header; - guint8 *nonce; - - header_end++; - username++; - while(*tmp != '\r' && *tmp != '\0') tmp++; - *tmp = '\0'; - nonce = purple_ntlm_parse_type2(header_end, NULL); - response = purple_ntlm_gen_type3(username, - (gchar*) purple_proxy_info_get_password(connect_data->gpi), - hostname, - domain, nonce, NULL); - username--; - } else /* Empty message */ - response = purple_ntlm_gen_type1(hostname, domain); - - *username = '\\'; - - request = g_strdup_printf( - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: %s:%d\r\n" - "Proxy-Authorization: NTLM %s\r\n" - "Proxy-Connection: Keep-Alive\r\n\r\n", - connect_data->host, connect_data->port, - connect_data->host, connect_data->port, - response); - - g_free(response); - - } else if((header = g_strrstr((const char *)connect_data->read_buffer, "Proxy-Authenticate: Basic"))) { - gchar *t1, *t2; - const char *username, *password; - - username = purple_proxy_info_get_username(connect_data->gpi); - password = purple_proxy_info_get_password(connect_data->gpi); - - t1 = g_strdup_printf("%s:%s", - username ? username : "", - password ? password : ""); - t2 = purple_base64_encode((guchar *)t1, strlen(t1)); - g_free(t1); - - request = g_strdup_printf( - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: %s:%d\r\n" - "Proxy-Authorization: Basic %s\r\n", - connect_data->host, connect_data->port, - connect_data->host, connect_data->port, - t2); - - g_free(t2); - - } else { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("HTTP proxy connection error %d"), status); - return; - } - - purple_input_remove(connect_data->inpa); - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->write_buffer = (guchar *)request; - connect_data->write_buf_len = strlen(request); - connect_data->written_len = 0; - - connect_data->read_cb = http_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, cond); - - return; - } - - if (status == 403) { - /* Forbidden */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Access denied: HTTP proxy server forbids port %d tunneling"), - connect_data->port); - } else { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("HTTP proxy connection error %d"), status); - } - } else { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - purple_debug_info("proxy", "HTTP proxy connection established\n"); - purple_proxy_connect_data_connected(connect_data); - return; - } -} - -static void -http_start_connect_tunneling(PurpleProxyConnectData *connect_data) { - GString *request; - int ret; - - purple_debug_info("proxy", "Using CONNECT tunneling for %s:%d\n", - connect_data->host, connect_data->port); - - request = g_string_sized_new(4096); - g_string_append_printf(request, - "CONNECT %s:%d HTTP/1.1\r\nHost: %s:%d\r\n", - connect_data->host, connect_data->port, - connect_data->host, connect_data->port); - - if (purple_proxy_info_get_username(connect_data->gpi) != NULL) - { - char *t1, *t2, *ntlm_type1; - char hostname[256]; - - ret = gethostname(hostname, sizeof(hostname)); - hostname[sizeof(hostname) - 1] = '\0'; - if (ret < 0 || hostname[0] == '\0') { - purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?"); - strcpy(hostname, "localhost"); - } - - t1 = g_strdup_printf("%s:%s", - purple_proxy_info_get_username(connect_data->gpi), - purple_proxy_info_get_password(connect_data->gpi) ? - purple_proxy_info_get_password(connect_data->gpi) : ""); - t2 = purple_base64_encode((const guchar *)t1, strlen(t1)); - g_free(t1); - - ntlm_type1 = purple_ntlm_gen_type1(hostname, ""); - - g_string_append_printf(request, - "Proxy-Authorization: Basic %s\r\n" - "Proxy-Authorization: NTLM %s\r\n" - "Proxy-Connection: Keep-Alive\r\n", - t2, ntlm_type1); - g_free(ntlm_type1); - g_free(t2); - } - - g_string_append(request, "\r\n"); - - connect_data->write_buf_len = request->len; - connect_data->write_buffer = (guchar *)g_string_free(request, FALSE); - connect_data->written_len = 0; - connect_data->read_cb = http_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -http_canwrite(gpointer data, gint source, PurpleInputCondition cond) { - PurpleProxyConnectData *connect_data = data; - int ret, error = ETIMEDOUT; - - purple_debug_info("proxy", "Connected to %s:%d.\n", - connect_data->host, connect_data->port); - - if (connect_data->inpa > 0) { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - ret = purple_input_get_error(connect_data->fd, &error); - if (ret != 0 || error != 0) { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - if (connect_data->port == 80) { - /* - * If we're trying to connect to something running on - * port 80 then we assume the traffic using this - * connection is going to be HTTP traffic. If it's - * not then this will fail (uglily). But it's good - * to avoid using the CONNECT method because it's - * not always allowed. - */ - purple_debug_info("proxy", "HTTP proxy connection established\n"); - purple_proxy_connect_data_connected(connect_data); - } else { - http_start_connect_tunneling(connect_data); - } - -} - -static void -proxy_connect_http(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", - "Connecting to %s:%d via %s:%d using HTTP\n", - connect_data->host, connect_data->port, - (purple_proxy_info_get_host(connect_data->gpi) ? purple_proxy_info_get_host(connect_data->gpi) : "(null)"), - purple_proxy_info_get_port(connect_data->gpi)); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) { - if (errno == EINPROGRESS || errno == EINTR) { - purple_debug_info("proxy", "Connection in progress\n"); - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, http_canwrite, connect_data); - } else - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } else { - purple_debug_info("proxy", "Connected immediately.\n"); - - http_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } -} - -static void -s4_canread(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - guchar *buf; - int len, max_read; - - /* This is really not going to block under normal circumstances, but to - * be correct, we deal with the unlikely scenario */ - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 12; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - buf = connect_data->read_buffer + connect_data->read_len; - max_read = connect_data->read_buf_len - connect_data->read_len; - - len = read(connect_data->fd, buf, max_read); - - if ((len < 0 && errno == EAGAIN) || (len > 0 && len + connect_data->read_len < 4)) - return; - else if (len + connect_data->read_len >= 4) { - if (connect_data->read_buffer[1] == 90) { - purple_proxy_connect_data_connected(connect_data); - return; - } - } - - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); -} - -static void -s4_host_resolved(GSList *hosts, gpointer data, const char *error_message) -{ - PurpleProxyConnectData *connect_data = data; - unsigned char packet[9]; - struct sockaddr *addr; - - connect_data->query_data = NULL; - - if (error_message != NULL) { - purple_proxy_connect_data_disconnect(connect_data, error_message); - return; - } - - if (hosts == NULL) { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Error resolving %s"), connect_data->host); - return; - } - - /* Discard the length... */ - hosts = g_slist_delete_link(hosts, hosts); - addr = hosts->data; - hosts = g_slist_delete_link(hosts, hosts); - - packet[0] = 0x04; - packet[1] = 0x01; - packet[2] = connect_data->port >> 8; - packet[3] = connect_data->port & 0xff; - memcpy(packet + 4, &((struct sockaddr_in *)addr)->sin_addr.s_addr, 4); - packet[8] = 0x00; - - g_free(addr); - - /* We could try the other hosts, but hopefully that shouldn't be necessary */ - while (hosts != NULL) { - /* Discard the length... */ - hosts = g_slist_delete_link(hosts, hosts); - /* Free the address... */ - g_free(hosts->data); - hosts = g_slist_delete_link(hosts, hosts); - } - - connect_data->write_buffer = g_memdup(packet, sizeof(packet)); - connect_data->write_buf_len = sizeof(packet); - connect_data->written_len = 0; - connect_data->read_cb = s4_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -s4_canwrite(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int error = ETIMEDOUT; - int ret; - - purple_debug_info("socks4 proxy", "Connected.\n"); - - if (connect_data->inpa > 0) { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - /* - * The socks4 spec doesn't include support for doing host name lookups by - * the proxy. Many socks4 servers do this via the "socks4a" extension to - * the protocol. There doesn't appear to be a way to detect if a server - * supports this, so we require that the user set a global option. - */ - if (purple_prefs_get_bool("/purple/proxy/socks4_remotedns")) { - unsigned char packet[9]; - int len; - - purple_debug_info("socks4 proxy", "Attempting to use remote DNS.\n"); - - packet[0] = 0x04; - packet[1] = 0x01; - packet[2] = connect_data->port >> 8; - packet[3] = connect_data->port & 0xff; - packet[4] = 0x00; - packet[5] = 0x00; - packet[6] = 0x00; - packet[7] = 0x01; - packet[8] = 0x00; - - len = sizeof(packet) + strlen(connect_data->host) + 1; - - connect_data->write_buffer = g_malloc0(len); - memcpy(connect_data->write_buffer, packet, sizeof(packet)); - memcpy(connect_data->write_buffer + sizeof(packet), connect_data->host, strlen(connect_data->host)); - connect_data->write_buf_len = len; - connect_data->written_len = 0; - connect_data->read_cb = s4_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } else { - connect_data->query_data = purple_dnsquery_a(connect_data->host, - connect_data->port, s4_host_resolved, connect_data); - - if (connect_data->query_data == NULL) { - purple_debug_error("proxy", "dns query failed unexpectedly.\n"); - purple_proxy_connect_data_destroy(connect_data); - } - } -} - -static void -proxy_connect_socks4(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", - "Connecting to %s:%d via %s:%d using SOCKS4\n", - connect_data->host, connect_data->port, - purple_proxy_info_get_host(connect_data->gpi), - purple_proxy_info_get_port(connect_data->gpi)); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("proxy", "Connection in progress.\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, s4_canwrite, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - purple_debug_info("proxy", "Connected immediately.\n"); - - s4_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } -} - -static gboolean -s5_ensure_buffer_length(PurpleProxyConnectData *connect_data, int len) -{ - if(connect_data->read_len < len) { - if(connect_data->read_buf_len < len) { - /* it's not just that we haven't read enough, it's that we haven't tried to read enough yet */ - purple_debug_info("s5", "reallocing from %" G_GSIZE_FORMAT - " to %d\n", connect_data->read_buf_len, len); - connect_data->read_buf_len = len; - connect_data->read_buffer = g_realloc(connect_data->read_buffer, connect_data->read_buf_len); - } - return FALSE; - } - - return TRUE; -} - -static void -s5_canread_again(gpointer data, gint source, PurpleInputCondition cond) -{ - guchar *dest, *buf; - PurpleProxyConnectData *connect_data = data; - int len; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 5; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - dest = connect_data->read_buffer + connect_data->read_len; - buf = connect_data->read_buffer; - - len = read(connect_data->fd, dest, (connect_data->read_buf_len - connect_data->read_len)); - - if (len == 0) - { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - - if(connect_data->read_len < 4) - return; - - if ((buf[0] != 0x05) || (buf[1] != 0x00)) { - if ((buf[0] == 0x05) && (buf[1] < 0x09)) { - purple_debug_error("socks5 proxy", "%s", socks5errors[buf[1]]); - purple_proxy_connect_data_disconnect(connect_data, - socks5errors[buf[1]]); - } else { - purple_debug_error("socks5 proxy", "Bad data.\n"); - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - } - return; - } - - /* Skip past BND.ADDR */ - switch(buf[3]) { - case 0x01: /* the address is a version-4 IP address, with a length of 4 octets */ - if(!s5_ensure_buffer_length(connect_data, 4 + 4)) - return; - buf += 4 + 4; - break; - case 0x03: /* the address field contains a fully-qualified domain name. The first - octet of the address field contains the number of octets of name that - follow, there is no terminating NUL octet. */ - if(!s5_ensure_buffer_length(connect_data, 4 + 1)) - return; - buf += 4; - if(!s5_ensure_buffer_length(connect_data, 4 + 1 + buf[0])) - return; - buf += buf[0] + 1; - break; - case 0x04: /* the address is a version-6 IP address, with a length of 16 octets */ - if(!s5_ensure_buffer_length(connect_data, 4 + 16)) - return; - buf += 4 + 16; - break; - default: - purple_debug_error("socks5 proxy", "Invalid ATYP received (0x%X)\n", buf[3]); - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return; - } - - /* Skip past BND.PORT */ - if(!s5_ensure_buffer_length(connect_data, (buf - connect_data->read_buffer) + 2)) - return; - - purple_proxy_connect_data_connected(connect_data); -} - -static void -s5_sendconnect(gpointer data, int source) -{ - PurpleProxyConnectData *connect_data = data; - size_t hlen = strlen(connect_data->host); - connect_data->write_buf_len = 5 + hlen + 2; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - connect_data->write_buffer[0] = 0x05; - connect_data->write_buffer[1] = 0x01; /* CONNECT */ - connect_data->write_buffer[2] = 0x00; /* reserved */ - connect_data->write_buffer[3] = 0x03; /* address type -- host name */ - connect_data->write_buffer[4] = hlen; - memcpy(connect_data->write_buffer + 5, connect_data->host, hlen); - connect_data->write_buffer[5 + hlen] = connect_data->port >> 8; - connect_data->write_buffer[5 + hlen + 1] = connect_data->port & 0xff; - - connect_data->read_cb = s5_canread_again; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -s5_readauth(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int len; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 2; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - purple_debug_info("socks5 proxy", "Got auth response.\n"); - - len = read(connect_data->fd, connect_data->read_buffer + connect_data->read_len, - connect_data->read_buf_len - connect_data->read_len); - - if (len == 0) - { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - if (connect_data->read_len < 2) - return; - - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - - if ((connect_data->read_buffer[0] != 0x01) || (connect_data->read_buffer[1] != 0x00)) { - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return; - } - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - s5_sendconnect(connect_data, connect_data->fd); -} - -static void -hmacmd5_chap(const unsigned char * challenge, int challen, const char * passwd, unsigned char * response) -{ - PurpleCipher *cipher; - PurpleCipherContext *ctx; - int i; - unsigned char Kxoripad[65]; - unsigned char Kxoropad[65]; - size_t pwlen; - - cipher = purple_ciphers_find_cipher("md5"); - ctx = purple_cipher_context_new(cipher, NULL); - - memset(Kxoripad,0,sizeof(Kxoripad)); - memset(Kxoropad,0,sizeof(Kxoropad)); - - pwlen=strlen(passwd); - if (pwlen>64) { - purple_cipher_context_append(ctx, (const guchar *)passwd, strlen(passwd)); - purple_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); - pwlen=16; - } else { - memcpy(Kxoripad, passwd, pwlen); - } - memcpy(Kxoropad,Kxoripad,pwlen); - - for (i=0;i<64;i++) { - Kxoripad[i]^=0x36; - Kxoropad[i]^=0x5c; - } - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, Kxoripad, 64); - purple_cipher_context_append(ctx, challenge, challen); - purple_cipher_context_digest(ctx, sizeof(Kxoripad), Kxoripad, NULL); - - purple_cipher_context_reset(ctx, NULL); - purple_cipher_context_append(ctx, Kxoropad, 64); - purple_cipher_context_append(ctx, Kxoripad, 16); - purple_cipher_context_digest(ctx, 16, response, NULL); - - purple_cipher_context_destroy(ctx); -} - -static void -s5_readchap(gpointer data, gint source, PurpleInputCondition cond); - -/* - * Return how many bytes we processed - * -1 means we've shouldn't keep reading from the buffer - */ -static gssize -s5_parse_chap_msg(PurpleProxyConnectData *connect_data) -{ - guchar *buf, *cmdbuf = connect_data->read_buffer; - int len, navas, currentav; - - purple_debug_misc("socks5 proxy", "Reading CHAP message: %x\n", *cmdbuf); - - if (*cmdbuf != 0x01) { - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return -1; - } - cmdbuf++; - - navas = *cmdbuf; - - purple_debug_misc("socks5 proxy", "Expecting %d attribute(s).\n", navas); - - cmdbuf++; - - for (currentav = 0; currentav < navas; currentav++) { - - len = connect_data->read_len - (cmdbuf - connect_data->read_buffer); - /* We don't have enough data to even know how long the next attribute is, - * or we don't have the full length of the next attribute. */ - if (len < 2 || len < (cmdbuf[1] + 2)) { - /* Clear out the attributes that have been read - decrease the attribute count */ - connect_data->read_buffer[1] = navas - currentav; - /* Move the unprocessed data into the first attribute position */ - memmove((connect_data->read_buffer + 2), cmdbuf, len); - /* Decrease the read count accordingly */ - connect_data->read_len = len + 2; - - purple_debug_info("socks5 proxy", "Need more data to retrieve attribute %d.\n", currentav); - - return -1; - } - - buf = cmdbuf + 2; - - if (cmdbuf[1] == 0) { - purple_debug_error("socks5 proxy", "Attribute %x Value length of 0; ignoring.\n", cmdbuf[0]); - cmdbuf = buf; - continue; - } - - switch (cmdbuf[0]) { - case 0x00: - purple_debug_info("socks5 proxy", "Received STATUS of %x\n", buf[0]); - /* Did auth work? */ - if (buf[0] == 0x00) { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - /* Success */ - s5_sendconnect(connect_data, connect_data->fd); - } else { - /* Failure */ - purple_debug_warning("proxy", - "socks5 CHAP authentication " - "failed. Disconnecting..."); - purple_proxy_connect_data_disconnect(connect_data, - _("Authentication failed")); - } - return -1; - case 0x01: - /* We've already validated that cmdbuf[1] is sane. */ - purple_debug_info("socks5 proxy", "Received TEXT-MESSAGE of '%.*s'\n", (int) cmdbuf[1], buf); - break; - case 0x03: - purple_debug_info("socks5 proxy", "Received CHALLENGE\n"); - /* Server wants our credentials */ - - connect_data->write_buf_len = 16 + 4; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - hmacmd5_chap(buf, cmdbuf[1], - purple_proxy_info_get_password(connect_data->gpi), - connect_data->write_buffer + 4); - /* TODO: What about USER-IDENTITY? */ - connect_data->write_buffer[0] = 0x01; - connect_data->write_buffer[1] = 0x01; - connect_data->write_buffer[2] = 0x04; - connect_data->write_buffer[3] = 0x10; - - purple_input_remove(connect_data->inpa); - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->read_cb = s5_readchap; - - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - return -1; - case 0x11: - purple_debug_info("socks5 proxy", "Received ALGORIGTHMS of %x\n", buf[0]); - /* Server wants to select an algorithm */ - if (buf[0] != 0x85) { - /* Only currently support HMAC-MD5 */ - purple_debug_warning("proxy", - "Server tried to select an " - "algorithm that we did not advertise " - "as supporting. This is a violation " - "of the socks5 CHAP specification. " - "Disconnecting..."); - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return -1; - } - break; - default: - purple_debug_info("socks5 proxy", "Received unused command %x, length=%d\n", cmdbuf[0], cmdbuf[1]); - } - cmdbuf = buf + cmdbuf[1]; - } - - return (cmdbuf - connect_data->read_buffer); -} - -static void -s5_readchap(gpointer data, gint source, PurpleInputCondition cond) -{ - gssize msg_ret; - PurpleProxyConnectData *connect_data = data; - int len; - - purple_debug(PURPLE_DEBUG_INFO, "socks5 proxy", "Got CHAP response.\n"); - - if (connect_data->read_buffer == NULL) { - /* A big enough butfer to read the message header (2 bytes) and at least one complete attribute and value (1 + 1 + 255). */ - connect_data->read_buf_len = 259; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - if (connect_data->read_buf_len - connect_data->read_len == 0) { - /*If the stuff below is right, this shouldn't be possible. */ - purple_debug_error("socks5 proxy", "This is about to suck because the read buffer is full (shouldn't happen).\n"); - } - - len = read(connect_data->fd, connect_data->read_buffer + connect_data->read_len, - connect_data->read_buf_len - connect_data->read_len); - - if (len == 0) { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - - /* We may have read more than one message into the buffer, we need to make sure to process them all */ - while (1) { - - /* We need more to be able to read this message */ - if (connect_data->read_len < 2) - return; - - msg_ret = s5_parse_chap_msg(connect_data); - - if (msg_ret < 0) - return; - - /* See if we have another message already in the buffer */ - if ((len = connect_data->read_len - msg_ret) > 0) { - - /* Move on to the next message */ - memmove(connect_data->read_buffer, connect_data->read_buffer + msg_ret, len); - /* Decrease the read count accordingly */ - connect_data->read_len = len; - - /* Try to read the message that connect_data->read_buffer now points to */ - continue; - } - - break; - } - - /* Fell through. We ran out of CHAP events to process, but haven't - * succeeded or failed authentication - there may be more to come. - * If this is the case, come straight back here. */ - - purple_debug_info("socks5 proxy", "Waiting for another message from which to read CHAP info.\n"); - - /* We've processed all the available attributes, so get ready for a whole new message */ - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; -} - -static void -s5_canread(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleProxyConnectData *connect_data = data; - int len; - - if (connect_data->read_buffer == NULL) { - connect_data->read_buf_len = 2; - connect_data->read_buffer = g_malloc(connect_data->read_buf_len); - connect_data->read_len = 0; - } - - purple_debug_info("socks5 proxy", "Able to read.\n"); - - len = read(connect_data->fd, connect_data->read_buffer + connect_data->read_len, - connect_data->read_buf_len - connect_data->read_len); - - if (len == 0) - { - purple_proxy_connect_data_disconnect(connect_data, - _("Server closed the connection")); - return; - } - - if (len < 0) - { - if (errno == EAGAIN) - /* No worries */ - return; - - /* Error! */ - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Lost connection with server: %s"), g_strerror(errno)); - return; - } - - connect_data->read_len += len; - if (connect_data->read_len < 2) - return; - - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - - if ((connect_data->read_buffer[0] != 0x05) || (connect_data->read_buffer[1] == 0xff)) { - purple_proxy_connect_data_disconnect(connect_data, - _("Received invalid data on connection with server")); - return; - } - - if (connect_data->read_buffer[1] == 0x02) { - size_t i, j; - const char *u, *p; - - u = purple_proxy_info_get_username(connect_data->gpi); - p = purple_proxy_info_get_password(connect_data->gpi); - - i = (u == NULL) ? 0 : strlen(u); - j = (p == NULL) ? 0 : strlen(p); - - connect_data->write_buf_len = 1 + 1 + i + 1 + j; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - connect_data->write_buffer[0] = 0x01; /* version 1 */ - connect_data->write_buffer[1] = i; - if (u != NULL) - memcpy(connect_data->write_buffer + 2, u, i); - connect_data->write_buffer[2 + i] = j; - if (p != NULL) - memcpy(connect_data->write_buffer + 2 + i + 1, p, j); - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->read_cb = s5_readauth; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, - proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - - return; - } else if (connect_data->read_buffer[1] == 0x03) { - size_t userlen; - userlen = strlen(purple_proxy_info_get_username(connect_data->gpi)); - - connect_data->write_buf_len = 7 + userlen; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - connect_data->written_len = 0; - - connect_data->write_buffer[0] = 0x01; - connect_data->write_buffer[1] = 0x02; - connect_data->write_buffer[2] = 0x11; - connect_data->write_buffer[3] = 0x01; - connect_data->write_buffer[4] = 0x85; - connect_data->write_buffer[5] = 0x02; - connect_data->write_buffer[6] = userlen; - memcpy(connect_data->write_buffer + 7, - purple_proxy_info_get_username(connect_data->gpi), userlen); - - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - connect_data->read_cb = s5_readchap; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, - proxy_do_write, connect_data); - - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - - return; - } else { - g_free(connect_data->read_buffer); - connect_data->read_buffer = NULL; - - s5_sendconnect(connect_data, connect_data->fd); - } -} - -static void -s5_canwrite(gpointer data, gint source, PurpleInputCondition cond) -{ - unsigned char buf[5]; - int i; - PurpleProxyConnectData *connect_data = data; - int error = ETIMEDOUT; - int ret; - - purple_debug_info("socks5 proxy", "Connected.\n"); - - if (connect_data->inpa > 0) - { - purple_input_remove(connect_data->inpa); - connect_data->inpa = 0; - } - - ret = purple_input_get_error(connect_data->fd, &error); - if ((ret != 0) || (error != 0)) - { - if (ret != 0) - error = errno; - purple_proxy_connect_data_disconnect(connect_data, g_strerror(error)); - return; - } - - i = 0; - buf[0] = 0x05; /* SOCKS version 5 */ - - if (purple_proxy_info_get_username(connect_data->gpi) != NULL) { - buf[1] = 0x03; /* three methods */ - buf[2] = 0x00; /* no authentication */ - buf[3] = 0x03; /* CHAP authentication */ - buf[4] = 0x02; /* username/password authentication */ - i = 5; - } - else { - buf[1] = 0x01; - buf[2] = 0x00; - i = 3; - } - - connect_data->write_buf_len = i; - connect_data->write_buffer = g_malloc(connect_data->write_buf_len); - memcpy(connect_data->write_buffer, buf, i); - - connect_data->read_cb = s5_canread; - - connect_data->inpa = purple_input_add(connect_data->fd, PURPLE_INPUT_WRITE, proxy_do_write, connect_data); - proxy_do_write(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); -} - -static void -proxy_connect_socks5(PurpleProxyConnectData *connect_data, struct sockaddr *addr, socklen_t addrlen) -{ - int flags; - - purple_debug_info("proxy", - "Connecting to %s:%d via %s:%d using SOCKS5\n", - connect_data->host, connect_data->port, - purple_proxy_info_get_host(connect_data->gpi), - purple_proxy_info_get_port(connect_data->gpi)); - - connect_data->fd = socket(addr->sa_family, SOCK_STREAM, 0); - if (connect_data->fd < 0) - { - purple_proxy_connect_data_disconnect_formatted(connect_data, - _("Unable to create socket: %s"), g_strerror(errno)); - return; - } - - flags = fcntl(connect_data->fd, F_GETFL); - fcntl(connect_data->fd, F_SETFL, flags | O_NONBLOCK); -#ifndef _WIN32 - fcntl(connect_data->fd, F_SETFD, FD_CLOEXEC); -#endif - - if (connect(connect_data->fd, addr, addrlen) != 0) - { - if ((errno == EINPROGRESS) || (errno == EINTR)) - { - purple_debug_info("socks5 proxy", "Connection in progress\n"); - connect_data->inpa = purple_input_add(connect_data->fd, - PURPLE_INPUT_WRITE, s5_canwrite, connect_data); - } - else - { - purple_proxy_connect_data_disconnect(connect_data, g_strerror(errno)); - } - } - else - { - purple_debug_info("proxy", "Connected immediately.\n"); - - s5_canwrite(connect_data, connect_data->fd, PURPLE_INPUT_WRITE); - } -} - -/** - * This function attempts to connect to the next IP address in the list - * of IP addresses returned to us by purple_dnsquery_a() and attemps - * to connect to each one. This is called after the hostname is - * resolved, and each time a connection attempt fails (assuming there - * is another IP address to try). - */ -#ifndef INET6_ADDRSTRLEN -#define INET6_ADDRSTRLEN 46 -#endif - -static void try_connect(PurpleProxyConnectData *connect_data) -{ - socklen_t addrlen; - struct sockaddr *addr; - char ipaddr[INET6_ADDRSTRLEN]; - - addrlen = GPOINTER_TO_INT(connect_data->hosts->data); - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); - addr = connect_data->hosts->data; - connect_data->hosts = g_slist_remove(connect_data->hosts, connect_data->hosts->data); -#ifdef HAVE_INET_NTOP - if (addr->sa_family == AF_INET) - inet_ntop(addr->sa_family, &((struct sockaddr_in *)addr)->sin_addr, - ipaddr, sizeof(ipaddr)); - else if (addr->sa_family == AF_INET6) - inet_ntop(addr->sa_family, &((struct sockaddr_in6 *)addr)->sin6_addr, - ipaddr, sizeof(ipaddr)); -#else - memcpy(ipaddr, inet_ntoa(((struct sockaddr_in *)addr)->sin_addr), - sizeof(ipaddr)); -#endif - purple_debug_info("proxy", "Attempting connection to %s\n", ipaddr); - - if (connect_data->socket_type == SOCK_DGRAM) { - proxy_connect_udp_none(connect_data, addr, addrlen); - g_free(addr); - return; - } - - switch (purple_proxy_info_get_type(connect_data->gpi)) { - case PURPLE_PROXY_NONE: - proxy_connect_none(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_HTTP: - proxy_connect_http(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_SOCKS4: - proxy_connect_socks4(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_SOCKS5: - proxy_connect_socks5(connect_data, addr, addrlen); - break; - - case PURPLE_PROXY_USE_ENVVAR: - proxy_connect_http(connect_data, addr, addrlen); - break; - - default: - break; - } - - g_free(addr); -} - -static void -connection_host_resolved(GSList *hosts, gpointer data, - const char *error_message) -{ - PurpleProxyConnectData *connect_data; - - connect_data = data; - connect_data->query_data = NULL; - - if (error_message != NULL) - { - purple_proxy_connect_data_disconnect(connect_data, error_message); - return; - } - - if (hosts == NULL) - { - purple_proxy_connect_data_disconnect(connect_data, _("Unable to resolve hostname")); - return; - } - - connect_data->hosts = hosts; - - try_connect(connect_data); -} - -PurpleProxyInfo * -purple_proxy_get_setup(PurpleAccount *account) -{ - PurpleProxyInfo *gpi = NULL; - const gchar *tmp; - - /* This is used as a fallback so we don't overwrite the selected proxy type */ - static PurpleProxyInfo *tmp_none_proxy_info = NULL; - if (!tmp_none_proxy_info) { - tmp_none_proxy_info = purple_proxy_info_new(); - purple_proxy_info_set_type(tmp_none_proxy_info, PURPLE_PROXY_NONE); - } - - if (account && purple_account_get_proxy_info(account) != NULL) { - gpi = purple_account_get_proxy_info(account); - if (purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_GLOBAL) - gpi = NULL; - } - if (gpi == NULL) { - if (purple_running_gnome()) - gpi = purple_gnome_proxy_get_info(); - else - gpi = purple_global_proxy_get_info(); - } - - if (purple_proxy_info_get_type(gpi) == PURPLE_PROXY_USE_ENVVAR) { - if ((tmp = g_getenv("HTTP_PROXY")) != NULL || - (tmp = g_getenv("http_proxy")) != NULL || - (tmp = g_getenv("HTTPPROXY")) != NULL) { - char *proxyhost, *proxyuser, *proxypasswd; - int proxyport; - - /* http_proxy-format: - * export http_proxy="http://user:passwd@your.proxy.server:port/" - */ - if(purple_url_parse(tmp, &proxyhost, &proxyport, NULL, &proxyuser, &proxypasswd)) { - purple_proxy_info_set_host(gpi, proxyhost); - g_free(proxyhost); - - purple_proxy_info_set_username(gpi, proxyuser); - g_free(proxyuser); - - purple_proxy_info_set_password(gpi, proxypasswd); - g_free(proxypasswd); - - /* only for backward compatibility */ - if (proxyport == 80 && - ((tmp = g_getenv("HTTP_PROXY_PORT")) != NULL || - (tmp = g_getenv("http_proxy_port")) != NULL || - (tmp = g_getenv("HTTPPROXYPORT")) != NULL)) - proxyport = atoi(tmp); - - purple_proxy_info_set_port(gpi, proxyport); - - /* XXX: Do we want to skip this step if user/password were part of url? */ - if ((tmp = g_getenv("HTTP_PROXY_USER")) != NULL || - (tmp = g_getenv("http_proxy_user")) != NULL || - (tmp = g_getenv("HTTPPROXYUSER")) != NULL) - purple_proxy_info_set_username(gpi, tmp); - - if ((tmp = g_getenv("HTTP_PROXY_PASS")) != NULL || - (tmp = g_getenv("http_proxy_pass")) != NULL || - (tmp = g_getenv("HTTPPROXYPASS")) != NULL) - purple_proxy_info_set_password(gpi, tmp); - - } - } else { -#ifdef _WIN32 - PurpleProxyInfo *wgpi; - if ((wgpi = purple_win32_proxy_get_info()) != NULL) - return wgpi; -#endif - /* no proxy environment variable found, don't use a proxy */ - purple_debug_info("proxy", "No environment settings found, not using a proxy\n"); - gpi = tmp_none_proxy_info; - } - - } - - return gpi; -} - -PurpleProxyConnectData * -purple_proxy_connect(void *handle, PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data) -{ - const char *connecthost = host; - int connectport = port; - PurpleProxyConnectData *connect_data; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port > 0, NULL); - g_return_val_if_fail(connect_cb != NULL, NULL); - - connect_data = g_new0(PurpleProxyConnectData, 1); - connect_data->fd = -1; - connect_data->socket_type = SOCK_STREAM; - connect_data->handle = handle; - connect_data->connect_cb = connect_cb; - connect_data->data = data; - connect_data->host = g_strdup(host); - connect_data->port = port; - connect_data->gpi = purple_proxy_get_setup(account); - - if ((purple_proxy_info_get_type(connect_data->gpi) != PURPLE_PROXY_NONE) && - (purple_proxy_info_get_host(connect_data->gpi) == NULL || - purple_proxy_info_get_port(connect_data->gpi) <= 0)) { - - purple_notify_error(NULL, NULL, _("Invalid proxy settings"), _("Either the host name or port number specified for your given proxy type is invalid.")); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - switch (purple_proxy_info_get_type(connect_data->gpi)) - { - case PURPLE_PROXY_NONE: - break; - - case PURPLE_PROXY_HTTP: - case PURPLE_PROXY_SOCKS4: - case PURPLE_PROXY_SOCKS5: - case PURPLE_PROXY_USE_ENVVAR: - connecthost = purple_proxy_info_get_host(connect_data->gpi); - connectport = purple_proxy_info_get_port(connect_data->gpi); - break; - - default: - purple_debug_error("proxy", "Invalid Proxy type (%d) specified.\n", - purple_proxy_info_get_type(connect_data->gpi)); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - connect_data->query_data = purple_dnsquery_a(connecthost, - connectport, connection_host_resolved, connect_data); - if (connect_data->query_data == NULL) - { - purple_debug_error("proxy", "dns query failed unexpectedly.\n"); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - handles = g_slist_prepend(handles, connect_data); - - return connect_data; -} - -PurpleProxyConnectData * -purple_proxy_connect_udp(void *handle, PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data) -{ - const char *connecthost = host; - int connectport = port; - PurpleProxyConnectData *connect_data; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port > 0, NULL); - g_return_val_if_fail(connect_cb != NULL, NULL); - - connect_data = g_new0(PurpleProxyConnectData, 1); - connect_data->fd = -1; - connect_data->socket_type = SOCK_DGRAM; - connect_data->handle = handle; - connect_data->connect_cb = connect_cb; - connect_data->data = data; - connect_data->host = g_strdup(host); - connect_data->port = port; - connect_data->gpi = purple_proxy_get_setup(account); - - if ((purple_proxy_info_get_type(connect_data->gpi) != PURPLE_PROXY_NONE) && - (purple_proxy_info_get_host(connect_data->gpi) == NULL || - purple_proxy_info_get_port(connect_data->gpi) <= 0)) { - - purple_notify_error(NULL, NULL, _("Invalid proxy settings"), _("Either the host name or port number specified for your given proxy type is invalid.")); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - switch (purple_proxy_info_get_type(connect_data->gpi)) - { - case PURPLE_PROXY_NONE: - break; - - case PURPLE_PROXY_HTTP: - case PURPLE_PROXY_SOCKS4: - case PURPLE_PROXY_SOCKS5: - case PURPLE_PROXY_USE_ENVVAR: - purple_debug_info("proxy", "Ignoring Proxy type (%d) for UDP.\n", - purple_proxy_info_get_type(connect_data->gpi)); - break; - - default: - purple_debug_error("proxy", "Invalid Proxy type (%d) specified.\n", - purple_proxy_info_get_type(connect_data->gpi)); - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - connect_data->query_data = purple_dnsquery_a(connecthost, - connectport, connection_host_resolved, connect_data); - if (connect_data->query_data == NULL) - { - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - handles = g_slist_prepend(handles, connect_data); - - return connect_data; -} - -/* - * Combine some of this code with purple_proxy_connect() - */ -PurpleProxyConnectData * -purple_proxy_connect_socks5(void *handle, PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, - gpointer data) -{ - PurpleProxyConnectData *connect_data; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port >= 0, NULL); - g_return_val_if_fail(connect_cb != NULL, NULL); - - connect_data = g_new0(PurpleProxyConnectData, 1); - connect_data->fd = -1; - connect_data->socket_type = SOCK_STREAM; - connect_data->handle = handle; - connect_data->connect_cb = connect_cb; - connect_data->data = data; - connect_data->host = g_strdup(host); - connect_data->port = port; - connect_data->gpi = gpi; - - connect_data->query_data = - purple_dnsquery_a(purple_proxy_info_get_host(gpi), - purple_proxy_info_get_port(gpi), - connection_host_resolved, connect_data); - if (connect_data->query_data == NULL) - { - purple_proxy_connect_data_destroy(connect_data); - return NULL; - } - - handles = g_slist_prepend(handles, connect_data); - - return connect_data; -} - -void -purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data) -{ - purple_proxy_connect_data_disconnect(connect_data, NULL); - purple_proxy_connect_data_destroy(connect_data); -} - -void -purple_proxy_connect_cancel_with_handle(void *handle) -{ - GSList *l, *l_next; - - for (l = handles; l != NULL; l = l_next) { - PurpleProxyConnectData *connect_data = l->data; - - l_next = l->next; - - if (connect_data->handle == handle) - purple_proxy_connect_cancel(connect_data); - } -} - -static void -proxy_pref_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - PurpleProxyInfo *info = purple_global_proxy_get_info(); - - if (purple_strequal(name, "/purple/proxy/type")) { - int proxytype; - const char *type = value; - - if (purple_strequal(type, "none")) - proxytype = PURPLE_PROXY_NONE; - else if (purple_strequal(type, "http")) - proxytype = PURPLE_PROXY_HTTP; - else if (purple_strequal(type, "socks4")) - proxytype = PURPLE_PROXY_SOCKS4; - else if (purple_strequal(type, "socks5")) - proxytype = PURPLE_PROXY_SOCKS5; - else if (purple_strequal(type, "envvar")) - proxytype = PURPLE_PROXY_USE_ENVVAR; - else - proxytype = -1; - - purple_proxy_info_set_type(info, proxytype); - } else if (purple_strequal(name, "/purple/proxy/host")) - purple_proxy_info_set_host(info, value); - else if (purple_strequal(name, "/purple/proxy/port")) - purple_proxy_info_set_port(info, GPOINTER_TO_INT(value)); - else if (purple_strequal(name, "/purple/proxy/username")) - purple_proxy_info_set_username(info, value); - else if (purple_strequal(name, "/purple/proxy/password")) - purple_proxy_info_set_password(info, value); -} - -void * -purple_proxy_get_handle() -{ - static int handle; - - return &handle; -} - -void -purple_proxy_init(void) -{ - void *handle; - - /* Initialize a default proxy info struct. */ - global_proxy_info = purple_proxy_info_new(); - - /* Proxy */ - purple_prefs_add_none("/purple/proxy"); - purple_prefs_add_string("/purple/proxy/type", "none"); - purple_prefs_add_string("/purple/proxy/host", ""); - purple_prefs_add_int("/purple/proxy/port", 0); - purple_prefs_add_string("/purple/proxy/username", ""); - purple_prefs_add_string("/purple/proxy/password", ""); - purple_prefs_add_bool("/purple/proxy/socks4_remotedns", FALSE); - - /* Setup callbacks for the preferences. */ - handle = purple_proxy_get_handle(); - purple_prefs_connect_callback(handle, "/purple/proxy/type", proxy_pref_cb, - NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/host", proxy_pref_cb, - NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/port", proxy_pref_cb, - NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/username", - proxy_pref_cb, NULL); - purple_prefs_connect_callback(handle, "/purple/proxy/password", - proxy_pref_cb, NULL); - - /* Load the initial proxy settings */ - purple_prefs_trigger_callback("/purple/proxy/type"); - purple_prefs_trigger_callback("/purple/proxy/host"); - purple_prefs_trigger_callback("/purple/proxy/port"); - purple_prefs_trigger_callback("/purple/proxy/username"); - purple_prefs_trigger_callback("/purple/proxy/password"); -} - -void -purple_proxy_uninit(void) -{ - while (handles != NULL) - { - purple_proxy_connect_data_disconnect(handles->data, NULL); - purple_proxy_connect_data_destroy(handles->data); - } - - purple_prefs_disconnect_by_handle(purple_proxy_get_handle()); - - purple_proxy_info_destroy(global_proxy_info); - global_proxy_info = NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/proxy.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,338 +0,0 @@ -/** - * @file proxy.h Proxy API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_PROXY_H_ -#define _PURPLE_PROXY_H_ - -#include -#include "eventloop.h" - -/** - * A type of proxy connection. - */ -typedef enum -{ - PURPLE_PROXY_USE_GLOBAL = -1, /**< Use the global proxy information. */ - PURPLE_PROXY_NONE = 0, /**< No proxy. */ - PURPLE_PROXY_HTTP, /**< HTTP proxy. */ - PURPLE_PROXY_SOCKS4, /**< SOCKS 4 proxy. */ - PURPLE_PROXY_SOCKS5, /**< SOCKS 5 proxy. */ - PURPLE_PROXY_USE_ENVVAR /**< Use environmental settings. */ - -} PurpleProxyType; - -/** - * Information on proxy settings. - */ -typedef struct -{ - PurpleProxyType type; /**< The proxy type. */ - - char *host; /**< The host. */ - int port; /**< The port number. */ - char *username; /**< The username. */ - char *password; /**< The password. */ - -} PurpleProxyInfo; - -typedef struct _PurpleProxyConnectData PurpleProxyConnectData; - -typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message); - - -#include "account.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Proxy structure API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a proxy information structure. - * - * @return The proxy information structure. - */ -PurpleProxyInfo *purple_proxy_info_new(void); - -/** - * Destroys a proxy information structure. - * - * @param info The proxy information structure to destroy. - */ -void purple_proxy_info_destroy(PurpleProxyInfo *info); - -/** - * Sets the type of proxy. - * - * @param info The proxy information. - * @param type The proxy type. - */ -void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type); - -/** - * Sets the proxy host. - * - * @param info The proxy information. - * @param host The host. - */ -void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host); - -/** - * Sets the proxy port. - * - * @param info The proxy information. - * @param port The port. - */ -void purple_proxy_info_set_port(PurpleProxyInfo *info, int port); - -/** - * Sets the proxy username. - * - * @param info The proxy information. - * @param username The username. - */ -void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username); - -/** - * Sets the proxy password. - * - * @param info The proxy information. - * @param password The password. - */ -void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password); - -/** - * Returns the proxy's type. - * - * @param info The proxy information. - * - * @return The type. - */ -PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info); - -/** - * Returns the proxy's host. - * - * @param info The proxy information. - * - * @return The host. - */ -const char *purple_proxy_info_get_host(const PurpleProxyInfo *info); - -/** - * Returns the proxy's port. - * - * @param info The proxy information. - * - * @return The port. - */ -int purple_proxy_info_get_port(const PurpleProxyInfo *info); - -/** - * Returns the proxy's username. - * - * @param info The proxy information. - * - * @return The username. - */ -const char *purple_proxy_info_get_username(const PurpleProxyInfo *info); - -/** - * Returns the proxy's password. - * - * @param info The proxy information. - * - * @return The password. - */ -const char *purple_proxy_info_get_password(const PurpleProxyInfo *info); - -/*@}*/ - -/**************************************************************************/ -/** @name Global Proxy API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns purple's global proxy information. - * - * @return The global proxy information. - */ -PurpleProxyInfo *purple_global_proxy_get_info(void); - -/** - * Set purple's global proxy information. - * - * @param info The proxy information. - * @since 2.6.0 - */ -void purple_global_proxy_set_info(PurpleProxyInfo *info); - -/*@}*/ - -/**************************************************************************/ -/** @name Proxy API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns the proxy subsystem handle. - * - * @return The proxy subsystem handle. - */ -void *purple_proxy_get_handle(void); - -/** - * Initializes the proxy subsystem. - */ -void purple_proxy_init(void); - -/** - * Uninitializes the proxy subsystem. - */ -void purple_proxy_uninit(void); - -/** - * Returns configuration of a proxy. - * - * @param account The account for which the configuration is needed. - * - * @return The configuration of a proxy. - */ -PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account); - -/** - * Makes a connection to the specified host and port. Note that this - * function name can be misleading--although it is called "proxy - * connect," it is used for establishing any outgoing TCP connection, - * whether through a proxy or not. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - */ -PurpleProxyConnectData *purple_proxy_connect(void *handle, - PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); - -/** - * Makes a connection to the specified host and port. Note that this - * function name can be misleading--although it is called "proxy - * connect," it is used for establishing any outgoing UDP connection, - * whether through a proxy or not. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - */ -PurpleProxyConnectData *purple_proxy_connect_udp(void *handle, - PurpleAccount *account, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); - -/** - * Makes a connection through a SOCKS5 proxy. - * - * @param handle A handle that should be associated with this - * connection attempt. The handle can be used - * to cancel the connection attempt using the - * purple_proxy_connect_cancel_with_handle() - * function. - * @param gpi The PurpleProxyInfo specifying the proxy settings - * @param host The destination host. - * @param port The destination port. - * @param connect_cb The function to call when the connection is - * established. If the connection failed then - * fd will be -1 and error message will be set - * to something descriptive (hopefully). - * @param data User-defined data. - * - * @return NULL if there was an error, or a reference to an - * opaque data structure that can be used to cancel - * the pending connection, if needed. - */ -PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle, - PurpleProxyInfo *gpi, - const char *host, int port, - PurpleProxyConnectFunction connect_cb, gpointer data); - -/** - * Cancel an in-progress connection attempt. This should be called - * by the PRPL if the user disables an account while it is still - * performing the initial sign on. Or when establishing a file - * transfer, if we attempt to connect to a remote user but they - * are behind a firewall then the PRPL can cancel the connection - * attempt early rather than just letting the OS's TCP/IP stack - * time-out the connection. - */ -void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data); - -/* - * Closes all proxy connections registered with the specified handle. - * - * @param handle The handle. - */ -void purple_proxy_connect_cancel_with_handle(void *handle); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_PROXY_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,583 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" -#include "conversation.h" -#include "debug.h" -#include "network.h" -#include "notify.h" -#include "prpl.h" -#include "request.h" -#include "util.h" - -/**************************************************************************/ -/** @name Attention Type API */ -/**************************************************************************/ -PurpleAttentionType * -purple_attention_type_new(const char *ulname, const char *name, - const char *inc_desc, const char *out_desc) -{ - PurpleAttentionType *attn = g_new0(PurpleAttentionType, 1); - - purple_attention_type_set_name(attn, name); - purple_attention_type_set_incoming_desc(attn, inc_desc); - purple_attention_type_set_outgoing_desc(attn, out_desc); - purple_attention_type_set_unlocalized_name(attn, ulname); - - return attn; -} - - -void -purple_attention_type_set_name(PurpleAttentionType *type, const char *name) -{ - g_return_if_fail(type != NULL); - - type->name = name; -} - -void -purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc) -{ - g_return_if_fail(type != NULL); - - type->incoming_description = desc; -} - -void -purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc) -{ - g_return_if_fail(type != NULL); - - type->outgoing_description = desc; -} - -void -purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name) -{ - g_return_if_fail(type != NULL); - - type->icon_name = name; -} - -void -purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname) -{ - g_return_if_fail(type != NULL); - - type->unlocalized_name = ulname; -} - -const char * -purple_attention_type_get_name(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->name; -} - -const char * -purple_attention_type_get_incoming_desc(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->incoming_description; -} - -const char * -purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->outgoing_description; -} - -const char * -purple_attention_type_get_icon_name(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - if(type->icon_name == NULL || *(type->icon_name) == '\0') - return NULL; - - return type->icon_name; -} - -const char * -purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type) -{ - g_return_val_if_fail(type != NULL, NULL); - - return type->unlocalized_name; -} - -/**************************************************************************/ -/** @name Protocol Plugin API */ -/**************************************************************************/ -void -purple_prpl_got_account_idle(PurpleAccount *account, gboolean idle, - time_t idle_time) -{ - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - purple_presence_set_idle(purple_account_get_presence(account), - idle, idle_time); -} - -void -purple_prpl_got_account_login_time(PurpleAccount *account, time_t login_time) -{ - PurplePresence *presence; - - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - if (login_time == 0) - login_time = time(NULL); - - presence = purple_account_get_presence(account); - - purple_presence_set_login_time(presence, login_time); -} - -void -purple_prpl_got_account_status(PurpleAccount *account, const char *status_id, ...) -{ - PurplePresence *presence; - PurpleStatus *status; - va_list args; - - g_return_if_fail(account != NULL); - g_return_if_fail(status_id != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - presence = purple_account_get_presence(account); - status = purple_presence_get_status(presence, status_id); - - g_return_if_fail(status != NULL); - - va_start(args, status_id); - purple_status_set_active_with_attrs(status, TRUE, args); - va_end(args); -} - -void -purple_prpl_got_account_actions(PurpleAccount *account) -{ - - g_return_if_fail(account != NULL); - g_return_if_fail(purple_account_is_connected(account)); - - purple_signal_emit(purple_accounts_get_handle(), "account-actions-changed", - account); -} - -void -purple_prpl_got_user_idle(PurpleAccount *account, const char *name, - gboolean idle, time_t idle_time) -{ - PurplePresence *presence; - GSList *list; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); - - if ((list = purple_find_buddies(account, name)) == NULL) - return; - - while (list) { - presence = purple_buddy_get_presence(list->data); - list = g_slist_delete_link(list, list); - purple_presence_set_idle(presence, idle, idle_time); - } -} - -void -purple_prpl_got_user_login_time(PurpleAccount *account, const char *name, - time_t login_time) -{ - GSList *list; - PurplePresence *presence; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - - if ((list = purple_find_buddies(account, name)) == NULL) - return; - - if (login_time == 0) - login_time = time(NULL); - - while (list) { - PurpleBuddy *buddy = list->data; - presence = purple_buddy_get_presence(buddy); - list = g_slist_delete_link(list, list); - - if (purple_presence_get_login_time(presence) != login_time) - { - purple_presence_set_login_time(presence, login_time); - - purple_signal_emit(purple_blist_get_handle(), "buddy-got-login-time", buddy); - } - } -} - -void -purple_prpl_got_user_status(PurpleAccount *account, const char *name, - const char *status_id, ...) -{ - GSList *list, *l; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - PurpleStatus *old_status; - va_list args; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(status_id != NULL); - g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); - - if((list = purple_find_buddies(account, name)) == NULL) - return; - - for(l = list; l != NULL; l = l->next) { - buddy = l->data; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_status(presence, status_id); - - if(NULL == status) - /* - * TODO: This should never happen, right? We should call - * g_warning() or something. - */ - continue; - - old_status = purple_presence_get_active_status(presence); - - va_start(args, status_id); - purple_status_set_active_with_attrs(status, TRUE, args); - va_end(args); - - purple_blist_update_buddy_status(buddy, old_status); - } - - g_slist_free(list); - - /* The buddy is no longer online, they are therefore by definition not - * still typing to us. */ - if (!purple_status_is_online(status)) - serv_got_typing_stopped(purple_account_get_connection(account), name); -} - -void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name, - const char *status_id) -{ - GSList *list, *l; - PurpleBuddy *buddy; - PurplePresence *presence; - PurpleStatus *status; - - g_return_if_fail(account != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(status_id != NULL); - g_return_if_fail(purple_account_is_connected(account) || purple_account_is_connecting(account)); - - if((list = purple_find_buddies(account, name)) == NULL) - return; - - for(l = list; l != NULL; l = l->next) { - buddy = l->data; - - presence = purple_buddy_get_presence(buddy); - status = purple_presence_get_status(presence, status_id); - - if(NULL == status) - continue; - - if (purple_status_is_active(status)) { - purple_status_set_active(status, FALSE); - purple_blist_update_buddy_status(buddy, status); - } - } - - g_slist_free(list); -} - -static void -do_prpl_change_account_status(PurpleAccount *account, - PurpleStatus *old_status, PurpleStatus *new_status) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (purple_status_is_online(new_status) && - purple_account_is_disconnected(account) && - purple_network_is_available()) - { - purple_account_connect(account); - return; - } - - if (!purple_status_is_online(new_status)) - { - if (!purple_account_is_disconnected(account)) - purple_account_disconnect(account); - /* Clear out the unsaved password if we're already disconnected and we switch to offline status */ - else if (!purple_account_get_remember_password(account)) - purple_account_set_password(account, NULL); - return; - } - - if (purple_account_is_connecting(account)) - /* - * We don't need to call the set_status PRPL function because - * the PRPL will take care of setting its status during the - * connection process. - */ - return; - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - - if (prpl == NULL) - return; - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (!purple_account_is_disconnected(account) && prpl_info->set_status != NULL) - { - prpl_info->set_status(account, new_status); - } -} - -void -purple_prpl_change_account_status(PurpleAccount *account, - PurpleStatus *old_status, PurpleStatus *new_status) -{ - g_return_if_fail(account != NULL); - g_return_if_fail(new_status != NULL); - g_return_if_fail(!purple_status_is_exclusive(new_status) || old_status != NULL); - - do_prpl_change_account_status(account, old_status, new_status); - - purple_signal_emit(purple_accounts_get_handle(), "account-status-changed", - account, old_status, new_status); -} - -GList * -purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence) -{ - GList *statuses = NULL; - GList *l; - PurpleStatus *status; - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(presence != NULL, NULL); - - for (l = purple_account_get_status_types(account); l != NULL; l = l->next) - { - status = purple_status_new((PurpleStatusType *)l->data, presence); - statuses = g_list_prepend(statuses, status); - } - - statuses = g_list_reverse(statuses); - - return statuses; -} - -void -purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - PurpleAttentionType *attn; - PurpleMessageFlags flags; - PurplePlugin *prpl; - PurpleConversation *conv; - gboolean (*send_attention)(PurpleConnection *, const char *, guint); - PurpleBuddy *buddy; - const char *alias; - gchar *description; - time_t mtime; - - g_return_if_fail(gc != NULL); - g_return_if_fail(who != NULL); - - prpl = purple_find_prpl(purple_account_get_protocol_id(gc->account)); - send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention; - g_return_if_fail(send_attention != NULL); - - mtime = time(NULL); - - attn = purple_get_attention_type_from_code(gc->account, type_code); - - if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) - alias = purple_buddy_get_contact_alias(buddy); - else - alias = who; - - if (attn && purple_attention_type_get_outgoing_desc(attn)) { - description = g_strdup_printf(purple_attention_type_get_outgoing_desc(attn), alias); - } else { - description = g_strdup_printf(_("Requesting %s's attention..."), alias); - } - - flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; - - purple_debug_info("server", "serv_send_attention: sending '%s' to %s\n", - description, who); - - if (!send_attention(gc, who, type_code)) - return; - - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, gc->account, who); - purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, description, flags, mtime); - - g_free(description); -} - -static void -got_attention(PurpleConnection *gc, int id, const char *who, guint type_code) -{ - PurpleMessageFlags flags; - PurpleAttentionType *attn; - PurpleBuddy *buddy; - const char *alias; - gchar *description; - time_t mtime; - - mtime = time(NULL); - - attn = purple_get_attention_type_from_code(gc->account, type_code); - - /* PURPLE_MESSAGE_NOTIFY is for attention messages. */ - flags = PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_RECV; - - /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display - * it next to the attention command. And if it is null, display a generic icon. */ - - if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) - alias = purple_buddy_get_contact_alias(buddy); - else - alias = who; - - if (attn && purple_attention_type_get_incoming_desc(attn)) { - description = g_strdup_printf(purple_attention_type_get_incoming_desc(attn), alias); - } else { - description = g_strdup_printf(_("%s has requested your attention!"), alias); - } - - purple_debug_info("server", "got_attention: got '%s' from %s\n", - description, who); - - if (id == -1) - serv_got_im(gc, who, description, flags, mtime); - else - serv_got_chat_in(gc, id, who, flags, description, mtime); - - /* TODO: sounds (depending on PurpleAttentionType), shaking, etc. */ - - g_free(description); -} - -void -purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - got_attention(gc, -1, who, type_code); -} - -void -purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code) -{ - got_attention(gc, id, who, type_code); -} - -gboolean -purple_prpl_initiate_media(PurpleAccount *account, - const char *who, - PurpleMediaSessionType type) -{ -#ifdef USE_VV - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - if (account) - gc = purple_account_get_connection(account); - if (gc) - prpl = purple_connection_get_prpl(gc); - if (prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, initiate_media)) { - /* should check that the protocol supports this media type here? */ - return prpl_info->initiate_media(account, who, type); - } else -#endif - return FALSE; -} - -PurpleMediaCaps -purple_prpl_get_media_caps(PurpleAccount *account, const char *who) -{ -#ifdef USE_VV - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - if (account) - gc = purple_account_get_connection(account); - if (gc) - prpl = purple_connection_get_prpl(gc); - if (prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, - get_media_caps)) { - return prpl_info->get_media_caps(account, who); - } -#endif - return PURPLE_MEDIA_CAPS_NONE; -} - -/************************************************************************** - * Protocol Plugin Subsystem API - **************************************************************************/ - -PurplePlugin * -purple_find_prpl(const char *id) -{ - GList *l; - PurplePlugin *plugin; - - g_return_val_if_fail(id != NULL, NULL); - - for (l = purple_plugins_get_protocols(); l != NULL; l = l->next) { - plugin = (PurplePlugin *)l->data; - - if (purple_strequal(plugin->info->id, id)) - return plugin; - } - - return NULL; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/prpl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,926 +0,0 @@ -/** - * @file prpl.h Protocol Plugin functions - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -/* this file should be all that prpls need to include. therefore, by including - * this file, they should get glib, proxy, purple_connection, prpl, etc. */ - -#ifndef _PURPLE_PRPL_H_ -#define _PURPLE_PRPL_H_ - -typedef struct _PurplePluginProtocolInfo PurplePluginProtocolInfo; -/** @copydoc _PurpleAttentionType */ -typedef struct _PurpleAttentionType PurpleAttentionType; - -/**************************************************************************/ -/** @name Basic Protocol Information */ -/**************************************************************************/ - -typedef enum { - PURPLE_ICON_SCALE_DISPLAY = 0x01, /**< We scale the icon when we display it */ - PURPLE_ICON_SCALE_SEND = 0x02 /**< We scale the icon before we send it to the server */ -} PurpleIconScaleRules; - - -/** - * A description of a Buddy Icon specification. This tells Purple what kind of image file - * it should give this prpl, and what kind of image file it should expect back. - * Dimensions less than 1 should be ignored and the image not scaled. - */ -typedef struct _PurpleBuddyIconSpec PurpleBuddyIconSpec; - -/** - * This \#define exists just to make it easier to fill out the buddy icon - * field in the prpl info struct for protocols that couldn't care less. - */ -#define NO_BUDDY_ICONS {NULL, 0, 0, 0, 0, 0, 0} - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "blist.h" -#include "conversation.h" -#include "ft.h" -#include "imgstore.h" -#include "media.h" -#include "notify.h" -#include "proxy.h" -#include "plugin.h" -#include "roomlist.h" -#include "status.h" -#include "whiteboard.h" - - -/** @copydoc PurpleBuddyIconSpec */ -struct _PurpleBuddyIconSpec { - /** This is a comma-delimited list of image formats or @c NULL if icons - * are not supported. Neither the core nor the prpl will actually - * check to see if the data it's given matches this; it's entirely up - * to the UI to do what it wants - */ - char *format; - - int min_width; /**< Minimum width of this icon */ - int min_height; /**< Minimum height of this icon */ - int max_width; /**< Maximum width of this icon */ - int max_height; /**< Maximum height of this icon */ - size_t max_filesize; /**< Maximum size in bytes */ - PurpleIconScaleRules scale_rules; /**< How to stretch this icon */ -}; - -/** Represents an entry containing information that must be supplied by the - * user when joining a chat. - */ -struct proto_chat_entry { - const char *label; /**< User-friendly name of the entry */ - const char *identifier; /**< Used by the PRPL to identify the option */ - gboolean required; /**< True if it's required */ - gboolean is_int; /**< True if the entry expects an integer */ - int min; /**< Minimum value in case of integer */ - int max; /**< Maximum value in case of integer */ - gboolean secret; /**< True if the entry is secret (password) */ -}; - -/** Represents "nudges" and "buzzes" that you may send to a buddy to attract - * their attention (or vice-versa). - */ -struct _PurpleAttentionType -{ - const char *name; /**< Shown in GUI elements */ - const char *incoming_description; /**< Shown when sent */ - const char *outgoing_description; /**< Shown when receied */ - const char *icon_name; /**< Icon to display (optional) */ - const char *unlocalized_name; /**< Unlocalized name for UIs needing it */ - - /* Reserved fields for future purposes */ - gpointer _reserved2; - gpointer _reserved3; - gpointer _reserved4; -}; - -/** - * Protocol options - * - * These should all be stuff that some plugins can do and others can't. - */ -typedef enum -{ - /** - * User names are unique to a chat and are not shared between rooms. - * - * XMPP lets you choose what name you want in chats, so it shouldn't - * be pulling the aliases from the buddy list for the chat list; - * it gets annoying. - */ - OPT_PROTO_UNIQUE_CHATNAME = 0x00000004, - - /** - * Chat rooms have topics. - * - * IRC and XMPP support this. - */ - OPT_PROTO_CHAT_TOPIC = 0x00000008, - - /** - * Don't require passwords for sign-in. - * - * Zephyr doesn't require passwords, so there's no - * need for a password prompt. - */ - OPT_PROTO_NO_PASSWORD = 0x00000010, - - /** - * Notify on new mail. - * - * MSN and Yahoo notify you when you have new mail. - */ - OPT_PROTO_MAIL_CHECK = 0x00000020, - - /** - * Images in IMs. - * - * Oscar lets you send images in direct IMs. - */ - OPT_PROTO_IM_IMAGE = 0x00000040, - - /** - * Allow passwords to be optional. - * - * Passwords in IRC are optional, and are needed for certain - * functionality. - */ - OPT_PROTO_PASSWORD_OPTIONAL = 0x00000080, - - /** - * Allows font size to be specified in sane point size - * - * Probably just XMPP and Y!M - */ - OPT_PROTO_USE_POINTSIZE = 0x00000100, - - /** - * Set the Register button active even when the username has not - * been specified. - * - * Gadu-Gadu doesn't need a username to register new account (because - * usernames are assigned by the server). - */ - OPT_PROTO_REGISTER_NOSCREENNAME = 0x00000200, - - /** - * Indicates that slash commands are native to this protocol. - * Used as a hint that unknown commands should not be sent as messages. - * @since 2.1.0 - */ - OPT_PROTO_SLASH_COMMANDS_NATIVE = 0x00000400 - -} PurpleProtocolOptions; - -/** - * A protocol plugin information structure. - * - * Every protocol plugin initializes this structure. It is the gateway - * between purple and the protocol plugin. Many of these callbacks can be - * NULL. If a callback must be implemented, it has a comment indicating so. - */ -struct _PurplePluginProtocolInfo -{ - PurpleProtocolOptions options; /**< Protocol options. */ - - GList *user_splits; /**< A GList of PurpleAccountUserSplit */ - GList *protocol_options; /**< A GList of PurpleAccountOption */ - - PurpleBuddyIconSpec icon_spec; /**< The icon spec. */ - - /** - * Returns the base icon name for the given buddy and account. - * If buddy is NULL and the account is non-NULL, it will return the - * name to use for the account's icon. If both are NULL, it will - * return the name to use for the protocol's icon. - * - * This must be implemented. - */ - const char *(*list_icon)(PurpleAccount *account, PurpleBuddy *buddy); - - /** - * Fills the four char**'s with string identifiers for "emblems" - * that the UI will interpret and display as relevant - */ - const char *(*list_emblem)(PurpleBuddy *buddy); - - /** - * Gets a short string representing this buddy's status. This will - * be shown on the buddy list. - */ - char *(*status_text)(PurpleBuddy *buddy); - - /** - * Allows the prpl to add text to a buddy's tooltip. - */ - void (*tooltip_text)(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full); - - /** - * Returns a list of #PurpleStatusType which exist for this account; - * this must be implemented, and must add at least the offline and - * online states. - */ - GList *(*status_types)(PurpleAccount *account); - - /** - * Returns a list of #PurpleMenuAction structs, which represent extra - * actions to be shown in (for example) the right-click menu for @a - * node. - */ - GList *(*blist_node_menu)(PurpleBlistNode *node); - - /** - * Returns a list of #proto_chat_entry structs, which represent - * information required by the PRPL to join a chat. libpurple will - * call join_chat along with the information filled by the user. - * - * @return A list of #proto_chat_entry structs - */ - GList *(*chat_info)(PurpleConnection *); - - /** - * Returns a hashtable which maps #proto_chat_entry struct identifiers - * to default options as strings based on chat_name. The resulting - * hashtable should be created with g_hash_table_new_full(g_str_hash, - * g_str_equal, NULL, g_free);. Use #get_chat_name if you instead need - * to extract a chat name from a hashtable. - * - * @param chat_name The chat name to be turned into components - * @return Hashtable containing the information extracted from chat_name - */ - GHashTable *(*chat_info_defaults)(PurpleConnection *, const char *chat_name); - - /* All the server-related functions */ - - /** This must be implemented. */ - void (*login)(PurpleAccount *); - - /** This must be implemented. */ - void (*close)(PurpleConnection *); - - /** - * This PRPL function should return a positive value on success. - * If the message is too big to be sent, return -E2BIG. If - * the account is not connected, return -ENOTCONN. If the - * PRPL is unable to send the message for another reason, return - * some other negative value. You can use one of the valid - * errno values, or just big something. If the message should - * not be echoed to the conversation window, return 0. - */ - int (*send_im)(PurpleConnection *, const char *who, - const char *message, - PurpleMessageFlags flags); - - void (*set_info)(PurpleConnection *, const char *info); - - /** - * @return If this protocol requires the PURPLE_TYPING message to - * be sent repeatedly to signify that the user is still - * typing, then the PRPL should return the number of - * seconds to wait before sending a subsequent notification. - * Otherwise the PRPL should return 0. - */ - unsigned int (*send_typing)(PurpleConnection *, const char *name, PurpleTypingState state); - - /** - * Should arrange for purple_notify_userinfo() to be called with - * @a who's user info. - */ - void (*get_info)(PurpleConnection *, const char *who); - void (*set_status)(PurpleAccount *account, PurpleStatus *status); - - void (*set_idle)(PurpleConnection *, int idletime); - void (*change_passwd)(PurpleConnection *, const char *old_pass, - const char *new_pass); - /** - * Add a buddy to a group on the server. - * - * This PRPL function may be called in situations in which the buddy is - * already in the specified group. If the protocol supports - * authorization and the user is not already authorized to see the - * status of \a buddy, \a add_buddy should request authorization. - */ - void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); - void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups); - void (*remove_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group); - void (*remove_buddies)(PurpleConnection *, GList *buddies, GList *groups); - void (*add_permit)(PurpleConnection *, const char *name); - void (*add_deny)(PurpleConnection *, const char *name); - void (*rem_permit)(PurpleConnection *, const char *name); - void (*rem_deny)(PurpleConnection *, const char *name); - void (*set_permit_deny)(PurpleConnection *); - - /** - * Called when the user requests joining a chat. Should arrange for - * #serv_got_joined_chat to be called. - * - * @param components A hashtable containing information required to - * join the chat as described by the entries returned - * by #chat_info. It may also be called when accepting - * an invitation, in which case this matches the - * data parameter passed to #serv_got_chat_invite. - */ - void (*join_chat)(PurpleConnection *, GHashTable *components); - - /** - * Called when the user refuses a chat invitation. - * - * @param components A hashtable containing information required to - * join the chat as passed to #serv_got_chat_invite. - */ - void (*reject_chat)(PurpleConnection *, GHashTable *components); - - /** - * Returns a chat name based on the information in components. Use - * #chat_info_defaults if you instead need to generate a hashtable - * from a chat name. - * - * @param components A hashtable containing information about the chat. - */ - char *(*get_chat_name)(GHashTable *components); - - /** - * Invite a user to join a chat. - * - * @param id The id of the chat to invite the user to. - * @param message A message displayed to the user when the invitation - * is received. - * @param who The name of the user to send the invation to. - */ - void (*chat_invite)(PurpleConnection *, int id, - const char *message, const char *who); - /** - * Called when the user requests leaving a chat. - * - * @param id The id of the chat to leave - */ - void (*chat_leave)(PurpleConnection *, int id); - - /** - * Send a whisper to a user in a chat. - * - * @param id The id of the chat. - * @param who The name of the user to send the whisper to. - * @param message The message of the whisper. - */ - void (*chat_whisper)(PurpleConnection *, int id, - const char *who, const char *message); - - /** - * Send a message to a chat. - * This PRPL function should return a positive value on success. - * If the message is too big to be sent, return -E2BIG. If - * the account is not connected, return -ENOTCONN. If the - * PRPL is unable to send the message for another reason, return - * some other negative value. You can use one of the valid - * errno values, or just big something. If the message should - * not be echoed to the conversation window, return 0. - * - * @param id The id of the chat to send the message to. - * @param message The message to send to the chat. - * @param flags A bitwise OR of #PurpleMessageFlags representing - * message flags. - * @return A positive number or 0 in case of succes, - * a negative error number in case of failure. - */ - int (*chat_send)(PurpleConnection *, int id, const char *message, PurpleMessageFlags flags); - - /** If implemented, this will be called regularly for this prpl's - * active connections. You'd want to do this if you need to repeatedly - * send some kind of keepalive packet to the server to avoid being - * disconnected. ("Regularly" is defined by - * KEEPALIVE_INTERVAL in libpurple/connection.c.) - */ - void (*keepalive)(PurpleConnection *); - - /** new user registration */ - void (*register_user)(PurpleAccount *); - - /** - * @deprecated Use #PurplePluginProtocolInfo.get_info instead. - */ - void (*get_cb_info)(PurpleConnection *, int, const char *who); - /** - * @deprecated Use #PurplePluginProtocolInfo.get_cb_real_name and - * #PurplePluginProtocolInfo.status_text instead. - */ - void (*get_cb_away)(PurpleConnection *, int, const char *who); - - /** save/store buddy's alias on server list/roster */ - void (*alias_buddy)(PurpleConnection *, const char *who, - const char *alias); - - /** change a buddy's group on a server list/roster */ - void (*group_buddy)(PurpleConnection *, const char *who, - const char *old_group, const char *new_group); - - /** rename a group on a server list/roster */ - void (*rename_group)(PurpleConnection *, const char *old_name, - PurpleGroup *group, GList *moved_buddies); - - void (*buddy_free)(PurpleBuddy *); - - void (*convo_closed)(PurpleConnection *, const char *who); - - /** - * Convert the username @a who to its canonical form. (For example, - * AIM treats "fOo BaR" and "foobar" as the same user; this function - * should return the same normalized string for both of those.) - */ - const char *(*normalize)(const PurpleAccount *, const char *who); - - /** - * Set the buddy icon for the given connection to @a img. The prpl - * does NOT own a reference to @a img; if it needs one, it must - * #purple_imgstore_ref(@a img) itself. - */ - void (*set_buddy_icon)(PurpleConnection *, PurpleStoredImage *img); - - void (*remove_group)(PurpleConnection *gc, PurpleGroup *group); - - /** Gets the real name of a participant in a chat. For example, on - * XMPP this turns a chat room nick foo into - * room\@server/foo - * @param gc the connection on which the room is. - * @param id the ID of the chat room. - * @param who the nickname of the chat participant. - * @return the real name of the participant. This string must be - * freed by the caller. - */ - char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); - - void (*set_chat_topic)(PurpleConnection *gc, int id, const char *topic); - - PurpleChat *(*find_blist_chat)(PurpleAccount *account, const char *name); - - /* room listing prpl callbacks */ - PurpleRoomlist *(*roomlist_get_list)(PurpleConnection *gc); - void (*roomlist_cancel)(PurpleRoomlist *list); - void (*roomlist_expand_category)(PurpleRoomlist *list, PurpleRoomlistRoom *category); - - /* file transfer callbacks */ - gboolean (*can_receive_file)(PurpleConnection *, const char *who); - void (*send_file)(PurpleConnection *, const char *who, const char *filename); - PurpleXfer *(*new_xfer)(PurpleConnection *, const char *who); - - /** Checks whether offline messages to @a buddy are supported. - * @return @c TRUE if @a buddy can be sent messages while they are - * offline, or @c FALSE if not. - */ - gboolean (*offline_message)(const PurpleBuddy *buddy); - - PurpleWhiteboardPrplOps *whiteboard_prpl_ops; - - /** For use in plugins that may understand the underlying protocol */ - int (*send_raw)(PurpleConnection *gc, const char *buf, int len); - - /* room list serialize */ - char *(*roomlist_room_serialize)(PurpleRoomlistRoom *room); - - /** Remove the user from the server. The account can either be - * connected or disconnected. After the removal is finished, the - * connection will stay open and has to be closed! - */ - /* This is here rather than next to register_user for API compatibility - * reasons. - */ - void (*unregister_user)(PurpleAccount *, PurpleAccountUnregistrationCb cb, void *user_data); - - /* Attention API for sending & receiving zaps/nudges/buzzes etc. */ - gboolean (*send_attention)(PurpleConnection *gc, const char *username, guint type); - GList *(*get_attention_types)(PurpleAccount *acct); - - /** - * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo). - * This allows adding more functions to this struct without requiring a major version bump. - */ - unsigned long struct_size; - - /* NOTE: - * If more functions are added, they should accessed using the following syntax: - * - * if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, new_function)) - * prpl->new_function(...); - * - * instead of - * - * if (prpl->new_function != NULL) - * prpl->new_function(...); - * - * The PURPLE_PROTOCOL_PLUGIN_HAS_FUNC macro can be used for the older member - * functions (e.g. login, send_im etc.) too. - */ - - /** This allows protocols to specify additional strings to be used for - * various purposes. The idea is to stuff a bunch of strings in this hash - * table instead of expanding the struct for every addition. This hash - * table is allocated every call and MUST be unrefed by the caller. - * - * @param account The account to specify. This can be NULL. - * @return The protocol's string hash table. The hash table should be - * destroyed by the caller when it's no longer needed. - */ - GHashTable *(*get_account_text_table)(PurpleAccount *account); - - /** - * Initiate a media session with the given contact. - * - * @param account The account to initiate the media session on. - * @param who The remote user to initiate the session with. - * @param type The type of media session to initiate. - * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media session or stream will be successfully created) - */ - gboolean (*initiate_media)(PurpleAccount *account, const char *who, - PurpleMediaSessionType type); - - /** - * Checks to see if the given contact supports the given type of media session. - * - * @param account The account the contact is on. - * @param who The remote user to check for media capability with. - * @return The media caps the contact supports. - */ - PurpleMediaCaps (*get_media_caps)(PurpleAccount *account, - const char *who); -}; - -#define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \ - (((G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < G_STRUCT_OFFSET(PurplePluginProtocolInfo, struct_size)) \ - || (G_STRUCT_OFFSET(PurplePluginProtocolInfo, member) < prpl->struct_size)) && \ - prpl->member != NULL) - - -#define PURPLE_IS_PROTOCOL_PLUGIN(plugin) \ - ((plugin)->info->type == PURPLE_PLUGIN_PROTOCOL) - -#define PURPLE_PLUGIN_PROTOCOL_INFO(plugin) \ - ((PurplePluginProtocolInfo *)(plugin)->info->extra_info) - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Attention Type API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new #PurpleAttentionType object and sets its mandatory parameters. - * - * @param ulname A non-localized string that can be used by UIs in need of such - * non-localized strings. This should be the same as @a name, - * without localization. - * @param name A localized string that the UI may display for the event. This - * should be the same string as @a ulname, with localization. - * @param inc_desc A localized description shown when the event is received. - * @param out_desc A localized description shown when the event is sent. - * @return A pointer to the new object. - * @since 2.4.0 - */ -PurpleAttentionType *purple_attention_type_new(const char *ulname, const char *name, - const char *inc_desc, const char *out_desc); - -/** - * Sets the displayed name of the attention-demanding event. - * - * @param type The attention type. - * @param name The localized name that will be displayed by UIs. This should be - * the same string given as the unlocalized name, but with - * localization. - * @since 2.4.0 - */ -void purple_attention_type_set_name(PurpleAttentionType *type, const char *name); - -/** - * Sets the description of the attention-demanding event shown in conversations - * when the event is received. - * - * @param type The attention type. - * @param desc The localized description for incoming events. - * @since 2.4.0 - */ -void purple_attention_type_set_incoming_desc(PurpleAttentionType *type, const char *desc); - -/** - * Sets the description of the attention-demanding event shown in conversations - * when the event is sent. - * - * @param type The attention type. - * @param desc The localized description for outgoing events. - * @since 2.4.0 - */ -void purple_attention_type_set_outgoing_desc(PurpleAttentionType *type, const char *desc); - -/** - * Sets the name of the icon to display for the attention event; this is optional. - * - * @param type The attention type. - * @param name The icon's name. - * @note Icons are optional for attention events. - * @since 2.4.0 - */ -void purple_attention_type_set_icon_name(PurpleAttentionType *type, const char *name); - -/** - * Sets the unlocalized name of the attention event; some UIs may need this, - * thus it is required. - * - * @param type The attention type. - * @param ulname The unlocalized name. This should be the same string given as - * the localized name, but without localization. - * @since 2.4.0 - */ -void purple_attention_type_set_unlocalized_name(PurpleAttentionType *type, const char *ulname); - -/** - * Get the attention type's name as displayed by the UI. - * - * @param type The attention type. - * @return The name. - * @since 2.4.0 - */ -const char *purple_attention_type_get_name(const PurpleAttentionType *type); - -/** - * Get the attention type's description shown when the event is received. - * - * @param type The attention type. - * @return The description. - * @since 2.4.0 - */ -const char *purple_attention_type_get_incoming_desc(const PurpleAttentionType *type); - -/** - * Get the attention type's description shown when the event is sent. - * - * @param type The attention type. - * @return The description. - * @since 2.4.0 - */ -const char *purple_attention_type_get_outgoing_desc(const PurpleAttentionType *type); - -/** - * Get the attention type's icon name. - * - * @param type The attention type. - * @return The icon name or @c NULL if unset/empty. - * @note Icons are optional for attention events. - * @since 2.4.0 - */ -const char *purple_attention_type_get_icon_name(const PurpleAttentionType *type); - -/** - * Get the attention type's unlocalized name; this is useful for some UIs. - * - * @param type The attention type - * @return The unlocalized name. - * @since 2.4.0 - */ -const char *purple_attention_type_get_unlocalized_name(const PurpleAttentionType *type); - -/*@}*/ - -/**************************************************************************/ -/** @name Protocol Plugin API */ -/**************************************************************************/ -/*@{*/ - -/** - * Notifies Purple that our account's idle state and time have changed. - * - * This is meant to be called from protocol plugins. - * - * @param account The account. - * @param idle The user's idle state. - * @param idle_time The user's idle time. - */ -void purple_prpl_got_account_idle(PurpleAccount *account, gboolean idle, - time_t idle_time); - -/** - * Notifies Purple of our account's log-in time. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param login_time The user's log-in time. - */ -void purple_prpl_got_account_login_time(PurpleAccount *account, time_t login_time); - -/** - * Notifies Purple that our account's status has changed. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param status_id The status ID. - * @param ... A NULL-terminated list of attribute IDs and values, - * beginning with the value for @a attr_id. - */ -void purple_prpl_got_account_status(PurpleAccount *account, - const char *status_id, ...) G_GNUC_NULL_TERMINATED; - -/** - * Notifies Purple that our account's actions have changed. This is only - * called after the initial connection. Emits the account-actions-changed - * signal. - * - * This is meant to be called from protocol plugins. - * - * @param account The account. - * - * @see account-actions-changed - * @since 2.6.0 - */ -void purple_prpl_got_account_actions(PurpleAccount *account); - -/** - * Notifies Purple that a buddy's idle state and time have changed. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param idle The user's idle state. - * @param idle_time The user's idle time. This is the time at - * which the user became idle, in seconds since - * the epoch. If the PRPL does not know this value - * then it should pass 0. - */ -void purple_prpl_got_user_idle(PurpleAccount *account, const char *name, - gboolean idle, time_t idle_time); - -/** - * Notifies Purple of a buddy's log-in time. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param login_time The user's log-in time. - */ -void purple_prpl_got_user_login_time(PurpleAccount *account, const char *name, - time_t login_time); - -/** - * Notifies Purple that a buddy's status has been activated. - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param status_id The status ID. - * @param ... A NULL-terminated list of attribute IDs and values, - * beginning with the value for @a attr_id. - */ -void purple_prpl_got_user_status(PurpleAccount *account, const char *name, - const char *status_id, ...) G_GNUC_NULL_TERMINATED; - -/** - * Notifies libpurple that a buddy's status has been deactivated - * - * This is meant to be called from protocol plugins. - * - * @param account The account the user is on. - * @param name The name of the buddy. - * @param status_id The status ID. - */ -void purple_prpl_got_user_status_deactive(PurpleAccount *account, const char *name, - const char *status_id); - -/** - * Informs the server that our account's status changed. - * - * @param account The account the user is on. - * @param old_status The previous status. - * @param new_status The status that was activated, or deactivated - * (in the case of independent statuses). - */ -void purple_prpl_change_account_status(PurpleAccount *account, - PurpleStatus *old_status, - PurpleStatus *new_status); - -/** - * Retrieves the list of stock status types from a prpl. - * - * @param account The account the user is on. - * @param presence The presence for which we're going to get statuses - * - * @return List of statuses - */ -GList *purple_prpl_get_statuses(PurpleAccount *account, PurplePresence *presence); - -/** - * Send an attention request message. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - * - * @since 2.5.0 - */ -void purple_prpl_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** - * Process an incoming attention message. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - * - * @since 2.5.0 - */ -void purple_prpl_got_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** - * Process an incoming attention message in a chat. - * - * @param gc The connection that received the attention message. - * @param id The chat id. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - * - * @since 2.5.0 - */ -void purple_prpl_got_attention_in_chat(PurpleConnection *gc, int id, const char *who, guint type_code); - -/** - * Determines if the contact supports the given media session type. - * - * @param account The account the user is on. - * @param who The name of the contact to check capabilities for. - * - * @return The media caps the contact supports. - */ -PurpleMediaCaps purple_prpl_get_media_caps(PurpleAccount *account, - const char *who); - -/** - * Initiates a media session with the given contact. - * - * @param account The account the user is on. - * @param who The name of the contact to start a session with. - * @param type The type of media session to start. - * - * @return TRUE if the call succeeded else FALSE. (Doesn't imply the media session or stream will be successfully created) - */ -gboolean purple_prpl_initiate_media(PurpleAccount *account, - const char *who, - PurpleMediaSessionType type); - -/*@}*/ - -/**************************************************************************/ -/** @name Protocol Plugin Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Finds a protocol plugin structure of the specified type. - * - * @param id The protocol plugin; - */ -PurplePlugin *purple_find_prpl(const char *id); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PRPL_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -#ifndef DBUS_API_SUBJECT_TO_CHANGE -#define DBUS_API_SUBJECT_TO_CHANGE -#endif - -#include -#include -#include - -#include "dbus-purple.h" -#include "purple-client.h" - -static DBusGConnection *bus; -static DBusGProxy *purple_proxy; - -static GList *garray_int_to_glist(GArray *array) -{ - GList *list = NULL; - int i; - - for (i = 0; i < array->len; i++) - list = g_list_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - - g_array_free(array, TRUE); - return list; -} - -static GSList *garray_int_to_gslist(GArray *array) -{ - GSList *list = NULL; - int i; - - for (i = 0; i < array->len; i++) - list = g_slist_append(list, GINT_TO_POINTER(g_array_index(array,gint,i))); - - g_array_free(array, TRUE); - return list; -} - -#include "purple-client-bindings.c" - -static void lose(const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2); -static void lose_gerror(const char *prefix, GError *error) G_GNUC_NORETURN; - -static void -lose(const char *str, ...) -{ - va_list args; - - va_start(args, str); - - vfprintf(stderr, str, args); - fputc('\n', stderr); - - va_end(args); - - exit(1); -} - -static void -lose_gerror(const char *prefix, GError *error) -{ - lose("%s: %s", prefix, error->message); -} - -void purple_init(void) -{ - GError *error = NULL; - - g_type_init (); - - bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); - if (!bus) - lose_gerror ("Couldn't connect to session bus", error); - - purple_proxy = dbus_g_proxy_new_for_name (bus, - DBUS_SERVICE_PURPLE, - DBUS_PATH_PURPLE, - DBUS_INTERFACE_PURPLE); - - if (!purple_proxy) - lose_gerror ("Couldn't connect to the Purple Service", error); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client-example.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client-example.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client-example.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client-example.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -#ifndef DBUS_API_SUBJECT_TO_CHANGE -#define DBUS_API_SUBJECT_TO_CHANGE -#endif - -#include -#include - -#include "purple-client.h" - -/* - This example demonstrates how to use libpurple-client to communicate - with purple. The names and signatures of functions provided by - libpurple-client are the same as those in purple. However, all - structures (such as PurpleAccount) are opaque, that is, you can only - use pointer to them. In fact, these pointers DO NOT actually point - to anything, they are just integer identifiers of assigned to these - structures by purple. So NEVER try to dereference these pointers. - Integer ids as disguised as pointers to provide type checking and - prevent mistakes such as passing an id of PurpleAccount when an id of - PurpleBuddy is expected. According to glib manual, this technique is - portable. -*/ - -int main (int argc, char **argv) -{ - GList *alist, *node; - - purple_init(); - - alist = purple_accounts_get_all(); - for (node = alist; node != NULL; node = node->next) - { - PurpleAccount *account = (PurpleAccount*) node->data; - char *name = purple_account_get_username(account); - g_print("Name: %s\n", name); - g_free(name); - } - g_list_free(alist); - - return 0; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-client.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -#ifndef _PURPLE_CLIENT_H_INCLUDED_ -#define _PURPLE_CLIENT_H_INCLUDED_ - -#include -#include "purple-client-bindings.h" - -G_BEGIN_DECLS - -void purple_init(void); - -G_END_DECLS - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file purple.h Header files and defines - * This file contains all the necessary preprocessor directives to include - * libpurple's headers and other preprocessor directives required for plugins - * or UIs to build. Including this file eliminates the need to directly - * include any other libpurple files. - * - * @ingroup core libpurple - * @since 2.3.0 - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_PURPLE_H_ -#define _PURPLE_PURPLE_H_ - -#include - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -#define PURPLE_PLUGINS 1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.h.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/** - * @file purple.h Header files and defines - * This file contains all the necessary preprocessor directives to include - * libpurple's headers and other preprocessor directives required for plugins - * or UIs to build. Including this file eliminates the need to directly - * include any other libpurple files. - * - * @ingroup core libpurple - * @since 2.3.0 - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_PURPLE_H_ -#define _PURPLE_PURPLE_H_ - -#include - -#ifndef G_GNUC_NULL_TERMINATED -# if __GNUC__ >= 4 -# define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__)) -# else -# define G_GNUC_NULL_TERMINATED -# endif -#endif - -@PLUGINS_DEFINE@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-notifications-example qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-notifications-example --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-notifications-example 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-notifications-example 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -#!/usr/bin/env python - -# This is a simple purple notification server. -# It shows notifications when your buddy signs on or you get an IM message. -# -# This script requires Python 2.4 and PyGTK bindings -# -# Note that all function names are resolved dynamically, no -# purple-specific library is needed. - -import dbus -import dbus.glib -import dbus.decorators -import gobject -import os - -def ensureimconversation(conversation, account, name): - if conversation != 0: - return conversation - else: - # 1 = PURPLE_CONV_IM - return purple.PurpleConversationNew(1, account, name) - -def receivedimmsg(account, name, message, conversation, flags): - buddy = purple.PurpleFindBuddy(account, name) - if buddy != 0: - alias = purple.PurpleBuddyGetAlias(buddy) - else: - alias = name - - text = "%s says %s" % (alias, message) - code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", - "'So what?','Show me',Close,Abuse", text) - - if code == 101: # so what? - pass - else: - conversation = ensureimconversation(conversation, account, name) - - if code == 102: # show me - window = purple.PurpleConversationGetWindow(conversation) - purple.PurpleConvWindowRaise(window) - - if code == 103: # close - purple.PurpleConversationDestroy(conversation) - - if code == 104: # abuse - im = purple.PurpleConversationGetImData(conversation) - purple.PurpleConvImSend(im, "Go away you f...") - - -def buddysignedon(buddyid): - alias = purple.PurpleBuddyGetAlias(buddyid) - text = "%s is online" % alias - - code = os.spawnlp(os.P_WAIT, "xmessage", "xmessage", "-buttons", - "'So what?','Let's talk'", text) - - if code == 101: # so what? - pass - - if code == 102: # talk - name = purple.PurpleBuddyGetName(buddyid) - account = purple.PurpleBuddyGetAccount(buddyid) - purple.PurpleConversationNew(1, account, name) - - -bus = dbus.SessionBus() -obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") -purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - -bus.add_signal_receiver(receivedimmsg, - dbus_interface = "im.pidgin.purple.PurpleInterface", - signal_name = "ReceivedImMsg") - -bus.add_signal_receiver(buddysignedon, - dbus_interface = "im.pidgin.purple.PurpleInterface", - signal_name = "BuddySignedOn") - -print "This is a simple purple notification server." -print "It shows notifications when your buddy signs on or you get an IM message." - -loop = gobject.MainLoop() -loop.run() - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.pc.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.pc.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.pc.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple.pc.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -datarootdir=@datarootdir@ -datadir=@datadir@ -sysconfdir=@sysconfdir@ - -Name: libpurple -Description: libpurple is a GLib-based instant messenger library. -Version: @VERSION@ -Requires: glib-2.0 -Cflags: -I${includedir}/libpurple -Libs: -L${libdir} -lpurple diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-remote qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-remote --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-remote 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-remote 1970-01-01 00:00:00.000000000 +0000 @@ -1,239 +0,0 @@ -#!/usr/bin/env python - -import dbus -import re -import urllib -import sys - -import xml.dom.minidom - -xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName - -obj = None -try: - obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") -except: - pass - -purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") - -class CheckedObject: - def __init__(self, obj): - self.obj = obj - - def __getattr__(self, attr): - return CheckedAttribute(self, attr) - -class CheckedAttribute: - def __init__(self, cobj, attr): - self.cobj = cobj - self.attr = attr - - def __call__(self, *args): - result = self.cobj.obj.__getattr__(self.attr)(*args) - if result == 0: - raise "Error: " + self.attr + " " + str(args) + " returned " + str(result) - return result - -def show_help(requested=False): - print """This program uses D-Bus to communicate with purple. - -Usage: - - %s "command1" "command2" ... - -Each command is of one of the three types: - - [protocol:]commandname?param1=value1¶m2=value2&... - FunctionName?param1=value1¶m2=value2&... - FunctionName(value1,value2,...) - -The second and third form are provided for completeness but their use -is not recommended; use purple-send or purple-send-async instead. The -second form uses introspection to find out the parameter names and -their types, therefore it is rather slow. - -Examples of commands: - - jabber:goim?screenname=testone@localhost&message=hi - jabber:gochat?room=TestRoom&server=conference.localhost - jabber:getinfo?screenname=testone@localhost - jabber:addbuddy?screenname=my friend - - setstatus?status=away&message=don't disturb - getstatus - getstatusmessage - quit - - PurpleAccountsFindConnected?name=&protocol=prpl-jabber - PurpleAccountsFindConnected(,prpl-jabber) -""" % sys.argv[0] - if (requested): - sys.exit(0) - else: - sys.exit(1) - -cpurple = CheckedObject(purple) - -urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" - -def extendlist(list, length, fill): - if len(list) < length: - return list + [fill] * (length - len(list)) - else: - return list - -def convert(value): - try: - return int(value) - except: - return value - -def findaccount(accountname, protocolname): - try: - # prefer connected accounts - account = cpurple.PurpleAccountsFindConnected(accountname, protocolname) - return account - except: - # try to get any account and connect it - account = cpurple.PurpleAccountsFindAny(accountname, protocolname) - purple.PurpleAccountSetStatusVargs(account, "online", 1) - purple.PurpleAccountConnect(account) - return account - - -def execute(uri): - match = re.match(urlregexp, uri) - protocol = match.group(2) - if protocol == "xmpp": - protocol = "jabber" - if protocol is not None: - protocol = "prpl-" + protocol - command = match.group(5) - paramstring = match.group(7) - params = {} - if paramstring is not None: - for param in paramstring.split("&"): - key, value = extendlist(param.split("=",1), 2, "") - params[key] = urllib.unquote(value) - - accountname = params.get("account", "") - - if command == "goim": - account = findaccount(accountname, protocol) - conversation = cpurple.PurpleConversationNew(1, account, params["screenname"]) - if "message" in params: - im = cpurple.PurpleConversationGetImData(conversation) - purple.PurpleConvImSend(im, params["message"]) - return None - - elif command == "gochat": - account = findaccount(accountname, protocol) - connection = cpurple.PurpleAccountGetConnection(account) - return purple.ServJoinChat(connection, params) - - elif command == "addbuddy": - account = findaccount(accountname, protocol) - return cpurple.PurpleBlistRequestAddBuddy(account, params["screenname"], - params.get("group", ""), "") - - elif command == "setstatus": - current = purple.PurpleSavedstatusGetCurrent() - - if "status" in params: - status_id = params["status"] - status_type = purple.PurplePrimitiveGetTypeFromId(status_id) - else: - status_type = purple.PurpleSavedstatusGetType(current) - status_id = purple.PurplePrimitiveGetIdFromType(status_type) - - if "message" in params: - message = params["message"]; - else: - message = purple.PurpleSavedstatusGetMessage(current) - - if "account" in params: - accounts = [cpurple.PurpleAccountsFindAny(accountname, protocol)] - - for account in accounts: - status = purple.PurpleAccountGetStatus(account, status_id) - type = purple.PurpleStatusGetType(status) - purple.PurpleSavedstatusSetSubstatus(current, account, type, message) - purple.PurpleSavedstatusActivateForAccount(current, account) - else: - saved = purple.PurpleSavedstatusNew("", status_type) - purple.PurpleSavedstatusSetMessage(saved, message) - purple.PurpleSavedstatusActivate(saved) - - return None - - elif command == "getstatus": - current = purple.PurpleSavedstatusGetCurrent() - status_type = purple.PurpleSavedstatusGetType(current) - status_id = purple.PurplePrimitiveGetIdFromType(status_type) - return status_id - - elif command == "getstatusmessage": - current = purple.PurpleSavedstatusGetCurrent() - return purple.PurpleSavedstatusGetMessage(current) - - elif command == "getinfo": - account = findaccount(accountname, protocol) - connection = cpurple.PurpleAccountGetConnection(account) - return purple.ServGetInfo(connection, params["screenname"]) - - elif command == "quit": - return purple.PurpleCoreQuit() - - elif command == "uri": - return None - - else: - match = re.match(r"(\w+)\s*\(([^)]*)\)", command) - if match is not None: - name = match.group(1) - argstr = match.group(2) - if argstr == "": - args = [] - else: - args = argstr.split(",") - fargs = [] - for arg in args: - fargs.append(convert(arg.strip())) - return purple.__getattr__(name)(*fargs) - else: - # introspect the object to get parameter names and types - # this is slow because the entire introspection info must be downloaded - data = dbus.Interface(obj, "org.freedesktop.DBus.Introspectable").\ - Introspect() - introspect = xml.dom.minidom.parseString(data).documentElement - for method in introspect.all("method"): - if command == method.getAttribute("name"): - methodparams = [] - for arg in method.all("arg"): - if arg.getAttribute("direction") == "in": - value = params[arg.getAttribute("name")] - type = arg.getAttribute("type") - if type == "s": - methodparams.append(value) - elif type == "i": - methodparams.append(int(value)) - else: - raise "Don't know how to handle type \"%s\"" % type - return purple.__getattr__(command)(*methodparams) - show_help() - -if len(sys.argv) == 1: - show_help() -elif (sys.argv[1] == "--help" or sys.argv[1] == "-h"): - show_help(True) -elif (obj == None): - print "No existing libpurple instance detected." - sys.exit(1); - -for arg in sys.argv[1:]: - output = execute(arg) - - if (output != None): - print output - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-send qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-send --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-send 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/purple-send 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -#!/bin/sh - -METHOD_NAME=$1 - -if test -z "$METHOD_NAME" -then - cat <fields = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - return fields; -} - -void -purple_request_fields_destroy(PurpleRequestFields *fields) -{ - g_return_if_fail(fields != NULL); - - g_list_foreach(fields->groups, (GFunc)purple_request_field_group_destroy, NULL); - g_list_free(fields->groups); - g_list_free(fields->required_fields); - g_hash_table_destroy(fields->fields); - g_free(fields); -} - -void -purple_request_fields_add_group(PurpleRequestFields *fields, - PurpleRequestFieldGroup *group) -{ - GList *l; - PurpleRequestField *field; - - g_return_if_fail(fields != NULL); - g_return_if_fail(group != NULL); - - fields->groups = g_list_append(fields->groups, group); - - group->fields_list = fields; - - for (l = purple_request_field_group_get_fields(group); - l != NULL; - l = l->next) { - - field = l->data; - - g_hash_table_insert(fields->fields, - g_strdup(purple_request_field_get_id(field)), field); - - if (purple_request_field_is_required(field)) { - fields->required_fields = - g_list_append(fields->required_fields, field); - } - - } -} - -GList * -purple_request_fields_get_groups(const PurpleRequestFields *fields) -{ - g_return_val_if_fail(fields != NULL, NULL); - - return fields->groups; -} - -gboolean -purple_request_fields_exists(const PurpleRequestFields *fields, const char *id) -{ - g_return_val_if_fail(fields != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - return (g_hash_table_lookup(fields->fields, id) != NULL); -} - -GList * -purple_request_fields_get_required(const PurpleRequestFields *fields) -{ - g_return_val_if_fail(fields != NULL, NULL); - - return fields->required_fields; -} - -gboolean -purple_request_fields_is_field_required(const PurpleRequestFields *fields, - const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return FALSE; - - return purple_request_field_is_required(field); -} - -gpointer -purple_request_field_get_ui_data(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->ui_data; -} - -void -purple_request_field_set_ui_data(PurpleRequestField *field, - gpointer ui_data) -{ - g_return_if_fail(field != NULL); - - field->ui_data = ui_data; -} - -gboolean -purple_request_fields_all_required_filled(const PurpleRequestFields *fields) -{ - GList *l; - - g_return_val_if_fail(fields != NULL, FALSE); - - for (l = fields->required_fields; l != NULL; l = l->next) - { - PurpleRequestField *field = (PurpleRequestField *)l->data; - - switch (purple_request_field_get_type(field)) - { - case PURPLE_REQUEST_FIELD_STRING: - if (purple_request_field_string_get_value(field) == NULL || - *(purple_request_field_string_get_value(field)) == '\0') - return FALSE; - - break; - - default: - break; - } - } - - return TRUE; -} - -PurpleRequestField * -purple_request_fields_get_field(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - field = g_hash_table_lookup(fields->fields, id); - - g_return_val_if_fail(field != NULL, NULL); - - return field; -} - -const char * -purple_request_fields_get_string(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return NULL; - - return purple_request_field_string_get_value(field); -} - -int -purple_request_fields_get_integer(const PurpleRequestFields *fields, - const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, 0); - g_return_val_if_fail(id != NULL, 0); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return 0; - - return purple_request_field_int_get_value(field); -} - -gboolean -purple_request_fields_get_bool(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return FALSE; - - return purple_request_field_bool_get_value(field); -} - -int -purple_request_fields_get_choice(const PurpleRequestFields *fields, const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, -1); - g_return_val_if_fail(id != NULL, -1); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return -1; - - return purple_request_field_choice_get_value(field); -} - -PurpleAccount * -purple_request_fields_get_account(const PurpleRequestFields *fields, - const char *id) -{ - PurpleRequestField *field; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - if ((field = purple_request_fields_get_field(fields, id)) == NULL) - return NULL; - - return purple_request_field_account_get_value(field); -} - -PurpleRequestFieldGroup * -purple_request_field_group_new(const char *title) -{ - PurpleRequestFieldGroup *group; - - group = g_new0(PurpleRequestFieldGroup, 1); - - group->title = g_strdup(title); - - return group; -} - -void -purple_request_field_group_destroy(PurpleRequestFieldGroup *group) -{ - g_return_if_fail(group != NULL); - - g_free(group->title); - - g_list_foreach(group->fields, (GFunc)purple_request_field_destroy, NULL); - g_list_free(group->fields); - - g_free(group); -} - -void -purple_request_field_group_add_field(PurpleRequestFieldGroup *group, - PurpleRequestField *field) -{ - g_return_if_fail(group != NULL); - g_return_if_fail(field != NULL); - - group->fields = g_list_append(group->fields, field); - - if (group->fields_list != NULL) - { - g_hash_table_insert(group->fields_list->fields, - g_strdup(purple_request_field_get_id(field)), field); - - if (purple_request_field_is_required(field)) - { - group->fields_list->required_fields = - g_list_append(group->fields_list->required_fields, field); - } - } - - field->group = group; - -} - -const char * -purple_request_field_group_get_title(const PurpleRequestFieldGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->title; -} - -GList * -purple_request_field_group_get_fields(const PurpleRequestFieldGroup *group) -{ - g_return_val_if_fail(group != NULL, NULL); - - return group->fields; -} - -PurpleRequestField * -purple_request_field_new(const char *id, const char *text, - PurpleRequestFieldType type) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(type != PURPLE_REQUEST_FIELD_NONE, NULL); - - field = g_new0(PurpleRequestField, 1); - - field->id = g_strdup(id); - field->type = type; - - purple_request_field_set_label(field, text); - purple_request_field_set_visible(field, TRUE); - - return field; -} - -void -purple_request_field_destroy(PurpleRequestField *field) -{ - g_return_if_fail(field != NULL); - - g_free(field->id); - g_free(field->label); - g_free(field->type_hint); - - if (field->type == PURPLE_REQUEST_FIELD_STRING) - { - g_free(field->u.string.default_value); - g_free(field->u.string.value); - } - else if (field->type == PURPLE_REQUEST_FIELD_CHOICE) - { - if (field->u.choice.labels != NULL) - { - g_list_foreach(field->u.choice.labels, (GFunc)g_free, NULL); - g_list_free(field->u.choice.labels); - } - } - else if (field->type == PURPLE_REQUEST_FIELD_LIST) - { - if (field->u.list.items != NULL) - { - g_list_foreach(field->u.list.items, (GFunc)g_free, NULL); - g_list_free(field->u.list.items); - } - - if (field->u.list.selected != NULL) - { - g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL); - g_list_free(field->u.list.selected); - } - - g_hash_table_destroy(field->u.list.item_data); - g_hash_table_destroy(field->u.list.selected_table); - } - - g_free(field); -} - -void -purple_request_field_set_label(PurpleRequestField *field, const char *label) -{ - g_return_if_fail(field != NULL); - - g_free(field->label); - field->label = g_strdup(label); -} - -void -purple_request_field_set_visible(PurpleRequestField *field, gboolean visible) -{ - g_return_if_fail(field != NULL); - - field->visible = visible; -} - -void -purple_request_field_set_type_hint(PurpleRequestField *field, - const char *type_hint) -{ - g_return_if_fail(field != NULL); - - g_free(field->type_hint); - field->type_hint = g_strdup(type_hint); -} - -void -purple_request_field_set_required(PurpleRequestField *field, gboolean required) -{ - g_return_if_fail(field != NULL); - - if (field->required == required) - return; - - field->required = required; - - if (field->group != NULL) - { - if (required) - { - field->group->fields_list->required_fields = - g_list_append(field->group->fields_list->required_fields, - field); - } - else - { - field->group->fields_list->required_fields = - g_list_remove(field->group->fields_list->required_fields, - field); - } - } -} - -PurpleRequestFieldType -purple_request_field_get_type(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, PURPLE_REQUEST_FIELD_NONE); - - return field->type; -} - -PurpleRequestFieldGroup * -purple_request_field_get_group(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->group; -} - -const char * -purple_request_field_get_id(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->id; -} - -const char * -purple_request_field_get_label(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->label; -} - -gboolean -purple_request_field_is_visible(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - - return field->visible; -} - -const char * -purple_request_field_get_type_hint(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - - return field->type_hint; -} - -gboolean -purple_request_field_is_required(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - - return field->required; -} - -PurpleRequestField * -purple_request_field_string_new(const char *id, const char *text, - const char *default_value, gboolean multiline) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_STRING); - - field->u.string.multiline = multiline; - field->u.string.editable = TRUE; - - purple_request_field_string_set_default_value(field, default_value); - purple_request_field_string_set_value(field, default_value); - - return field; -} - -void -purple_request_field_string_set_default_value(PurpleRequestField *field, - const char *default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - g_free(field->u.string.default_value); - field->u.string.default_value = g_strdup(default_value); -} - -void -purple_request_field_string_set_value(PurpleRequestField *field, const char *value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - g_free(field->u.string.value); - field->u.string.value = g_strdup(value); -} - -void -purple_request_field_string_set_masked(PurpleRequestField *field, gboolean masked) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - field->u.string.masked = masked; -} - -void -purple_request_field_string_set_editable(PurpleRequestField *field, - gboolean editable) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING); - - field->u.string.editable = editable; -} - -const char * -purple_request_field_string_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, NULL); - - return field->u.string.default_value; -} - -const char * -purple_request_field_string_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, NULL); - - return field->u.string.value; -} - -gboolean -purple_request_field_string_is_multiline(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE); - - return field->u.string.multiline; -} - -gboolean -purple_request_field_string_is_masked(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE); - - return field->u.string.masked; -} - -gboolean -purple_request_field_string_is_editable(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_STRING, FALSE); - - return field->u.string.editable; -} - -PurpleRequestField * -purple_request_field_int_new(const char *id, const char *text, - int default_value) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_INTEGER); - - purple_request_field_int_set_default_value(field, default_value); - purple_request_field_int_set_value(field, default_value); - - return field; -} - -void -purple_request_field_int_set_default_value(PurpleRequestField *field, - int default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER); - - field->u.integer.default_value = default_value; -} - -void -purple_request_field_int_set_value(PurpleRequestField *field, int value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER); - - field->u.integer.value = value; -} - -int -purple_request_field_int_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER, 0); - - return field->u.integer.default_value; -} - -int -purple_request_field_int_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_INTEGER, 0); - - return field->u.integer.value; -} - -PurpleRequestField * -purple_request_field_bool_new(const char *id, const char *text, - gboolean default_value) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_BOOLEAN); - - purple_request_field_bool_set_default_value(field, default_value); - purple_request_field_bool_set_value(field, default_value); - - return field; -} - -void -purple_request_field_bool_set_default_value(PurpleRequestField *field, - gboolean default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN); - - field->u.boolean.default_value = default_value; -} - -void -purple_request_field_bool_set_value(PurpleRequestField *field, gboolean value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN); - - field->u.boolean.value = value; -} - -gboolean -purple_request_field_bool_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN, FALSE); - - return field->u.boolean.default_value; -} - -gboolean -purple_request_field_bool_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_BOOLEAN, FALSE); - - return field->u.boolean.value; -} - -PurpleRequestField * -purple_request_field_choice_new(const char *id, const char *text, - int default_value) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_CHOICE); - - purple_request_field_choice_set_default_value(field, default_value); - purple_request_field_choice_set_value(field, default_value); - - return field; -} - -void -purple_request_field_choice_add(PurpleRequestField *field, const char *label) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(label != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE); - - field->u.choice.labels = g_list_append(field->u.choice.labels, - g_strdup(label)); -} - -void -purple_request_field_choice_set_default_value(PurpleRequestField *field, - int default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE); - - field->u.choice.default_value = default_value; -} - -void -purple_request_field_choice_set_value(PurpleRequestField *field, - int value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE); - - field->u.choice.value = value; -} - -int -purple_request_field_choice_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, -1); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE, -1); - - return field->u.choice.default_value; -} - -int -purple_request_field_choice_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, -1); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE, -1); - - return field->u.choice.value; -} - -GList * -purple_request_field_choice_get_labels(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_CHOICE, NULL); - - return field->u.choice.labels; -} - -PurpleRequestField * -purple_request_field_list_new(const char *id, const char *text) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_LIST); - - field->u.list.item_data = g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - field->u.list.selected_table = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - return field; -} - -void -purple_request_field_list_set_multi_select(PurpleRequestField *field, - gboolean multi_select) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - field->u.list.multiple_selection = multi_select; -} - -gboolean -purple_request_field_list_get_multi_select(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, FALSE); - - return field->u.list.multiple_selection; -} - -void * -purple_request_field_list_get_data(const PurpleRequestField *field, - const char *text) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, NULL); - - return g_hash_table_lookup(field->u.list.item_data, text); -} - -void -purple_request_field_list_add(PurpleRequestField *field, const char *item, - void *data) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(item != NULL); - g_return_if_fail(data != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - field->u.list.items = g_list_append(field->u.list.items, g_strdup(item)); - - g_hash_table_insert(field->u.list.item_data, g_strdup(item), data); -} - -void -purple_request_field_list_add_selected(PurpleRequestField *field, const char *item) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(item != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - if (!purple_request_field_list_get_multi_select(field) && - field->u.list.selected != NULL) - { - purple_debug_warning("request", - "More than one item added to non-multi-select " - "field %s\n", - purple_request_field_get_id(field)); - return; - } - - field->u.list.selected = g_list_append(field->u.list.selected, - g_strdup(item)); - - g_hash_table_insert(field->u.list.selected_table, g_strdup(item), NULL); -} - -void -purple_request_field_list_clear_selected(PurpleRequestField *field) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - if (field->u.list.selected != NULL) - { - g_list_foreach(field->u.list.selected, (GFunc)g_free, NULL); - g_list_free(field->u.list.selected); - field->u.list.selected = NULL; - } - - g_hash_table_destroy(field->u.list.selected_table); - - field->u.list.selected_table = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); -} - -void -purple_request_field_list_set_selected(PurpleRequestField *field, GList *items) -{ - GList *l; - - g_return_if_fail(field != NULL); - g_return_if_fail(items != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST); - - purple_request_field_list_clear_selected(field); - - if (!purple_request_field_list_get_multi_select(field) && - items && items->next) - { - purple_debug_warning("request", - "More than one item added to non-multi-select " - "field %s\n", - purple_request_field_get_id(field)); - return; - } - - for (l = items; l != NULL; l = l->next) - { - field->u.list.selected = g_list_append(field->u.list.selected, - g_strdup(l->data)); - g_hash_table_insert(field->u.list.selected_table, - g_strdup((char *)l->data), NULL); - } -} - -gboolean -purple_request_field_list_is_selected(const PurpleRequestField *field, - const char *item) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(item != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, FALSE); - - return g_hash_table_lookup_extended(field->u.list.selected_table, - item, NULL, NULL); -} - -GList * -purple_request_field_list_get_selected(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, NULL); - - return field->u.list.selected; -} - -GList * -purple_request_field_list_get_items(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_LIST, NULL); - - return field->u.list.items; -} - -PurpleRequestField * -purple_request_field_label_new(const char *id, const char *text) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_LABEL); - - return field; -} - -PurpleRequestField * -purple_request_field_image_new(const char *id, const char *text, const char *buf, gsize size) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - g_return_val_if_fail(buf != NULL, NULL); - g_return_val_if_fail(size > 0, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_IMAGE); - - field->u.image.buffer = g_memdup(buf, size); - field->u.image.size = size; - field->u.image.scale_x = 1; - field->u.image.scale_y = 1; - - return field; -} - -void -purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE); - - field->u.image.scale_x = x; - field->u.image.scale_y = y; -} - -const char * -purple_request_field_image_get_buffer(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, NULL); - - return field->u.image.buffer; -} - -gsize -purple_request_field_image_get_size(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, 0); - - return field->u.image.size; -} - -unsigned int -purple_request_field_image_get_scale_x(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, 0); - - return field->u.image.scale_x; -} - -unsigned int -purple_request_field_image_get_scale_y(PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, 0); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_IMAGE, 0); - - return field->u.image.scale_y; -} - -PurpleRequestField * -purple_request_field_account_new(const char *id, const char *text, - PurpleAccount *account) -{ - PurpleRequestField *field; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(text != NULL, NULL); - - field = purple_request_field_new(id, text, PURPLE_REQUEST_FIELD_ACCOUNT); - - if (account == NULL && purple_connections_get_all() != NULL) - { - account = purple_connection_get_account( - (PurpleConnection *)purple_connections_get_all()->data); - } - - purple_request_field_account_set_default_value(field, account); - purple_request_field_account_set_value(field, account); - - return field; -} - -void -purple_request_field_account_set_default_value(PurpleRequestField *field, - PurpleAccount *default_value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - field->u.account.default_account = default_value; -} - -void -purple_request_field_account_set_value(PurpleRequestField *field, - PurpleAccount *value) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - field->u.account.account = value; -} - -void -purple_request_field_account_set_show_all(PurpleRequestField *field, - gboolean show_all) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - if (field->u.account.show_all == show_all) - return; - - field->u.account.show_all = show_all; - - if (!show_all) - { - if (purple_account_is_connected(field->u.account.default_account)) - { - purple_request_field_account_set_default_value(field, - (PurpleAccount *)purple_connections_get_all()->data); - } - - if (purple_account_is_connected(field->u.account.account)) - { - purple_request_field_account_set_value(field, - (PurpleAccount *)purple_connections_get_all()->data); - } - } -} - -void -purple_request_field_account_set_filter(PurpleRequestField *field, - PurpleFilterAccountFunc filter_func) -{ - g_return_if_fail(field != NULL); - g_return_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT); - - field->u.account.filter_func = filter_func; -} - -PurpleAccount * -purple_request_field_account_get_default_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, NULL); - - return field->u.account.default_account; -} - -PurpleAccount * -purple_request_field_account_get_value(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, NULL); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, NULL); - - return field->u.account.account; -} - -gboolean -purple_request_field_account_get_show_all(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, FALSE); - - return field->u.account.show_all; -} - -PurpleFilterAccountFunc -purple_request_field_account_get_filter(const PurpleRequestField *field) -{ - g_return_val_if_fail(field != NULL, FALSE); - g_return_val_if_fail(field->type == PURPLE_REQUEST_FIELD_ACCOUNT, FALSE); - - return field->u.account.filter_func; -} - -/* -- */ - -void * -purple_request_input(void *handle, const char *title, const char *primary, - const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_input != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_INPUT; - info->handle = handle; - info->ui_handle = ops->request_input(title, primary, secondary, - default_value, - multiline, masked, hint, - ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, - user_data); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_choice(void *handle, const char *title, const char *primary, - const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, ...) -{ - void *ui_handle; - va_list args; - - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - - va_start(args, user_data); - ui_handle = purple_request_choice_varg(handle, title, primary, secondary, - default_value, ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, user_data, args); - va_end(args); - - return ui_handle; -} - -void * -purple_request_choice_varg(void *handle, const char *title, - const char *primary, const char *secondary, - int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, va_list choices) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - g_return_val_if_fail(cancel_text != NULL, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_choice != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_CHOICE; - info->handle = handle; - info->ui_handle = ops->request_choice(title, primary, secondary, - default_value, - ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, - user_data, choices); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_action(void *handle, const char *title, const char *primary, - const char *secondary, int default_action, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, size_t action_count, ...) -{ - void *ui_handle; - va_list args; - - g_return_val_if_fail(action_count > 0, NULL); - - va_start(args, action_count); - ui_handle = purple_request_action_varg(handle, title, primary, secondary, - default_action, account, who, conv, - user_data, action_count, args); - va_end(args); - - return ui_handle; -} - -void * -purple_request_action_varg(void *handle, const char *title, - const char *primary, const char *secondary, - int default_action, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, size_t action_count, va_list actions) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(action_count > 0, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_action != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_ACTION; - info->handle = handle; - info->ui_handle = ops->request_action(title, primary, secondary, - default_action, account, who, conv, - user_data, action_count, actions); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_fields(void *handle, const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - g_return_val_if_fail(fields != NULL, NULL); - g_return_val_if_fail(ok_text != NULL, NULL); - g_return_val_if_fail(ok_cb != NULL, NULL); - g_return_val_if_fail(cancel_text != NULL, NULL); - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_fields != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_FIELDS; - info->handle = handle; - info->ui_handle = ops->request_fields(title, primary, secondary, - fields, ok_text, ok_cb, - cancel_text, cancel_cb, - account, who, conv, - user_data); - - handles = g_list_append(handles, info); - - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_file(void *handle, const char *title, const char *filename, - gboolean savedialog, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_file != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_FILE; - info->handle = handle; - info->ui_handle = ops->request_file(title, filename, savedialog, - ok_cb, cancel_cb, - account, who, conv, user_data); - handles = g_list_append(handles, info); - return info->ui_handle; - } - - return NULL; -} - -void * -purple_request_folder(void *handle, const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data) -{ - PurpleRequestUiOps *ops; - - ops = purple_request_get_ui_ops(); - - if (ops != NULL && ops->request_file != NULL) { - PurpleRequestInfo *info; - - info = g_new0(PurpleRequestInfo, 1); - info->type = PURPLE_REQUEST_FOLDER; - info->handle = handle; - info->ui_handle = ops->request_folder(title, dirname, - ok_cb, cancel_cb, - account, who, conv, - user_data); - handles = g_list_append(handles, info); - return info->ui_handle; - } - - return NULL; -} - -static void -purple_request_close_info(PurpleRequestInfo *info) -{ - PurpleRequestUiOps *ops; - - ops = purple_request_get_ui_ops(); - - purple_notify_close_with_handle(info->ui_handle); - purple_request_close_with_handle(info->ui_handle); - - if (ops != NULL && ops->close_request != NULL) - ops->close_request(info->type, info->ui_handle); - - g_free(info); -} - -void -purple_request_close(PurpleRequestType type, void *ui_handle) -{ - GList *l; - - g_return_if_fail(ui_handle != NULL); - - for (l = handles; l != NULL; l = l->next) { - PurpleRequestInfo *info = l->data; - - if (info->ui_handle == ui_handle) { - handles = g_list_remove(handles, info); - purple_request_close_info(info); - break; - } - } -} - -void -purple_request_close_with_handle(void *handle) -{ - GList *l, *l_next; - - g_return_if_fail(handle != NULL); - - for (l = handles; l != NULL; l = l_next) { - PurpleRequestInfo *info = l->data; - - l_next = l->next; - - if (info->handle == handle) { - handles = g_list_remove(handles, info); - purple_request_close_info(info); - } - } -} - -void -purple_request_set_ui_ops(PurpleRequestUiOps *ops) -{ - request_ui_ops = ops; -} - -PurpleRequestUiOps * -purple_request_get_ui_ops(void) -{ - return request_ui_ops; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/request.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/request.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/request.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/request.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1538 +0,0 @@ -/** - * @file request.h Request API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_REQUEST_H_ -#define _PURPLE_REQUEST_H_ - -#include -#include -#include - -/** @copydoc _PurpleRequestField */ -typedef struct _PurpleRequestField PurpleRequestField; - -#include "account.h" - -#define PURPLE_DEFAULT_ACTION_NONE -1 - -/** - * Request types. - */ -typedef enum -{ - PURPLE_REQUEST_INPUT = 0, /**< Text input request. */ - PURPLE_REQUEST_CHOICE, /**< Multiple-choice request. */ - PURPLE_REQUEST_ACTION, /**< Action request. */ - PURPLE_REQUEST_FIELDS, /**< Multiple fields request. */ - PURPLE_REQUEST_FILE, /**< File open or save request. */ - PURPLE_REQUEST_FOLDER /**< Folder selection request. */ - -} PurpleRequestType; - -/** - * A type of field. - */ -typedef enum -{ - PURPLE_REQUEST_FIELD_NONE, - PURPLE_REQUEST_FIELD_STRING, - PURPLE_REQUEST_FIELD_INTEGER, - PURPLE_REQUEST_FIELD_BOOLEAN, - PURPLE_REQUEST_FIELD_CHOICE, - PURPLE_REQUEST_FIELD_LIST, - PURPLE_REQUEST_FIELD_LABEL, - PURPLE_REQUEST_FIELD_IMAGE, - PURPLE_REQUEST_FIELD_ACCOUNT - -} PurpleRequestFieldType; - -/** - * Multiple fields request data. - */ -typedef struct -{ - GList *groups; - - GHashTable *fields; - - GList *required_fields; - - void *ui_data; - -} PurpleRequestFields; - -/** - * A group of fields with a title. - */ -typedef struct -{ - PurpleRequestFields *fields_list; - - char *title; - - GList *fields; - -} PurpleRequestFieldGroup; - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_REQUEST_C_) -/** - * A request field. - */ -struct _PurpleRequestField -{ - PurpleRequestFieldType type; - PurpleRequestFieldGroup *group; - - char *id; - char *label; - char *type_hint; - - gboolean visible; - gboolean required; - - union - { - struct - { - gboolean multiline; - gboolean masked; - gboolean editable; - char *default_value; - char *value; - - } string; - - struct - { - int default_value; - int value; - - } integer; - - struct - { - gboolean default_value; - gboolean value; - - } boolean; - - struct - { - int default_value; - int value; - - GList *labels; - - } choice; - - struct - { - GList *items; - GHashTable *item_data; - GList *selected; - GHashTable *selected_table; - - gboolean multiple_selection; - - } list; - - struct - { - PurpleAccount *default_account; - PurpleAccount *account; - gboolean show_all; - - PurpleFilterAccountFunc filter_func; - - } account; - - struct - { - unsigned int scale_x; - unsigned int scale_y; - const char *buffer; - gsize size; - } image; - - } u; - - void *ui_data; - -}; -#endif - -/** - * Request UI operations. - */ -typedef struct -{ - /** @see purple_request_input(). */ - void *(*request_input)(const char *title, const char *primary, - const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data); - - /** @see purple_request_choice_varg(). */ - void *(*request_choice)(const char *title, const char *primary, - const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data, - va_list choices); - - /** @see purple_request_action_varg(). */ - void *(*request_action)(const char *title, const char *primary, - const char *secondary, int default_action, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data, - size_t action_count, va_list actions); - - /** @see purple_request_fields(). */ - void *(*request_fields)(const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data); - - /** @see purple_request_file(). */ - void *(*request_file)(const char *title, const char *filename, - gboolean savedialog, GCallback ok_cb, - GCallback cancel_cb, PurpleAccount *account, - const char *who, PurpleConversation *conv, - void *user_data); - - void (*close_request)(PurpleRequestType type, void *ui_handle); - - /** @see purple_request_folder(). */ - void *(*request_folder)(const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, - PurpleConversation *conv, void *user_data); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleRequestUiOps; - -typedef void (*PurpleRequestInputCb)(void *, const char *); - -/** The type of callbacks passed to purple_request_action(). The first - * argument is the @a user_data parameter; the second is the index in the list - * of actions of the one chosen. - */ -typedef void (*PurpleRequestActionCb)(void *, int); -typedef void (*PurpleRequestChoiceCb)(void *, int); -typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields); -typedef void (*PurpleRequestFileCb)(void *, const char *filename); - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Field List API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a list of fields to pass to purple_request_fields(). - * - * @return A PurpleRequestFields structure. - */ -PurpleRequestFields *purple_request_fields_new(void); - -/** - * Destroys a list of fields. - * - * @param fields The list of fields to destroy. - */ -void purple_request_fields_destroy(PurpleRequestFields *fields); - -/** - * Adds a group of fields to the list. - * - * @param fields The fields list. - * @param group The group to add. - */ -void purple_request_fields_add_group(PurpleRequestFields *fields, - PurpleRequestFieldGroup *group); - -/** - * Returns a list of all groups in a field list. - * - * @param fields The fields list. - * - * @constreturn A list of groups. - */ -GList *purple_request_fields_get_groups(const PurpleRequestFields *fields); - -/** - * Returns whether or not the field with the specified ID exists. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return TRUE if the field exists, or FALSE. - */ -gboolean purple_request_fields_exists(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns a list of all required fields. - * - * @param fields The fields list. - * - * @constreturn The list of required fields. - */ -GList *purple_request_fields_get_required(const PurpleRequestFields *fields); - -/** - * Returns whether or not a field with the specified ID is required. - * - * @param fields The fields list. - * @param id The field ID. - * - * @return TRUE if the specified field is required, or FALSE. - */ -gboolean purple_request_fields_is_field_required(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns whether or not all required fields have values. - * - * @param fields The fields list. - * - * @return TRUE if all required fields have values, or FALSE. - */ -gboolean purple_request_fields_all_required_filled( - const PurpleRequestFields *fields); - -/** - * Return the field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The field, if found. - */ -PurpleRequestField *purple_request_fields_get_field( - const PurpleRequestFields *fields, const char *id); - -/** - * Returns the string value of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The string value, if found, or @c NULL otherwise. - */ -const char *purple_request_fields_get_string(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the integer value of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The integer value, if found, or 0 otherwise. - */ -int purple_request_fields_get_integer(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the boolean value of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The boolean value, if found, or @c FALSE otherwise. - */ -gboolean purple_request_fields_get_bool(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the choice index of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The choice index, if found, or -1 otherwise. - */ -int purple_request_fields_get_choice(const PurpleRequestFields *fields, - const char *id); - -/** - * Returns the account of a field with the specified ID. - * - * @param fields The fields list. - * @param id The ID of the field. - * - * @return The account value, if found, or NULL otherwise. - */ -PurpleAccount *purple_request_fields_get_account(const PurpleRequestFields *fields, - const char *id); - -/*@}*/ - -/**************************************************************************/ -/** @name Fields Group API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a fields group with an optional title. - * - * @param title The optional title to give the group. - * - * @return A new fields group - */ -PurpleRequestFieldGroup *purple_request_field_group_new(const char *title); - -/** - * Destroys a fields group. - * - * @param group The group to destroy. - */ -void purple_request_field_group_destroy(PurpleRequestFieldGroup *group); - -/** - * Adds a field to the group. - * - * @param group The group to add the field to. - * @param field The field to add to the group. - */ -void purple_request_field_group_add_field(PurpleRequestFieldGroup *group, - PurpleRequestField *field); - -/** - * Returns the title of a fields group. - * - * @param group The group. - * - * @return The title, if set. - */ -const char *purple_request_field_group_get_title( - const PurpleRequestFieldGroup *group); - -/** - * Returns a list of all fields in a group. - * - * @param group The group. - * - * @constreturn The list of fields in the group. - */ -GList *purple_request_field_group_get_fields( - const PurpleRequestFieldGroup *group); - -/*@}*/ - -/**************************************************************************/ -/** @name Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a field of the specified type. - * - * @param id The field ID. - * @param text The text label of the field. - * @param type The type of field. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_new(const char *id, const char *text, - PurpleRequestFieldType type); - -/** - * Destroys a field. - * - * @param field The field to destroy. - */ -void purple_request_field_destroy(PurpleRequestField *field); - -/** - * Sets the label text of a field. - * - * @param field The field. - * @param label The text label. - */ -void purple_request_field_set_label(PurpleRequestField *field, const char *label); - -/** - * Sets whether or not a field is visible. - * - * @param field The field. - * @param visible TRUE if visible, or FALSE if not. - */ -void purple_request_field_set_visible(PurpleRequestField *field, gboolean visible); - -/** - * Sets the type hint for the field. - * - * This is optionally used by the UIs to provide such features as - * auto-completion for type hints like "account" and "screenname". - * - * @param field The field. - * @param type_hint The type hint. - */ -void purple_request_field_set_type_hint(PurpleRequestField *field, - const char *type_hint); - -/** - * Sets whether or not a field is required. - * - * @param field The field. - * @param required TRUE if required, or FALSE. - */ -void purple_request_field_set_required(PurpleRequestField *field, - gboolean required); - -/** - * Returns the type of a field. - * - * @param field The field. - * - * @return The field's type. - */ -PurpleRequestFieldType purple_request_field_get_type(const PurpleRequestField *field); - -/** - * Returns the group for the field. - * - * @param field The field. - * - * @return The UI data. - * - * @since 2.6.0 - */ -PurpleRequestFieldGroup *purple_request_field_get_group(const PurpleRequestField *field); - -/** - * Returns the ID of a field. - * - * @param field The field. - * - * @return The ID - */ -const char *purple_request_field_get_id(const PurpleRequestField *field); - -/** - * Returns the label text of a field. - * - * @param field The field. - * - * @return The label text. - */ -const char *purple_request_field_get_label(const PurpleRequestField *field); - -/** - * Returns whether or not a field is visible. - * - * @param field The field. - * - * @return TRUE if the field is visible. FALSE otherwise. - */ -gboolean purple_request_field_is_visible(const PurpleRequestField *field); - -/** - * Returns the field's type hint. - * - * @param field The field. - * - * @return The field's type hint. - */ -const char *purple_request_field_get_type_hint(const PurpleRequestField *field); - -/** - * Returns whether or not a field is required. - * - * @param field The field. - * - * @return TRUE if the field is required, or FALSE. - */ -gboolean purple_request_field_is_required(const PurpleRequestField *field); - -/** - * Returns the ui_data for a field. - * - * @param field The field. - * - * @return The UI data. - * - * @since 2.6.0 - */ -gpointer purple_request_field_get_ui_data(const PurpleRequestField *field); - -/** - * Sets the ui_data for a field. - * - * @param field The field. - * @param ui_data The UI data. - * - * @return The UI data. - * - * @since 2.6.0 - */ -void purple_request_field_set_ui_data(PurpleRequestField *field, - gpointer ui_data); - -/*@}*/ - -/**************************************************************************/ -/** @name String Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a string request field. - * - * @param id The field ID. - * @param text The text label of the field. - * @param default_value The optional default value. - * @param multiline Whether or not this should be a multiline string. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_string_new(const char *id, - const char *text, - const char *default_value, - gboolean multiline); - -/** - * Sets the default value in a string field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_string_set_default_value(PurpleRequestField *field, - const char *default_value); - -/** - * Sets the value in a string field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_string_set_value(PurpleRequestField *field, - const char *value); - -/** - * Sets whether or not a string field is masked - * (commonly used for password fields). - * - * @param field The field. - * @param masked The masked value. - */ -void purple_request_field_string_set_masked(PurpleRequestField *field, - gboolean masked); - -/** - * Sets whether or not a string field is editable. - * - * @param field The field. - * @param editable The editable value. - */ -void purple_request_field_string_set_editable(PurpleRequestField *field, - gboolean editable); - -/** - * Returns the default value in a string field. - * - * @param field The field. - * - * @return The default value. - */ -const char *purple_request_field_string_get_default_value( - const PurpleRequestField *field); - -/** - * Returns the user-entered value in a string field. - * - * @param field The field. - * - * @return The value. - */ -const char *purple_request_field_string_get_value(const PurpleRequestField *field); - -/** - * Returns whether or not a string field is multi-line. - * - * @param field The field. - * - * @return @c TRUE if the field is mulit-line, or @c FALSE otherwise. - */ -gboolean purple_request_field_string_is_multiline(const PurpleRequestField *field); - -/** - * Returns whether or not a string field is masked. - * - * @param field The field. - * - * @return @c TRUE if the field is masked, or @c FALSE otherwise. - */ -gboolean purple_request_field_string_is_masked(const PurpleRequestField *field); - -/** - * Returns whether or not a string field is editable. - * - * @param field The field. - * - * @return @c TRUE if the field is editable, or @c FALSE otherwise. - */ -gboolean purple_request_field_string_is_editable(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Integer Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates an integer field. - * - * @param id The field ID. - * @param text The text label of the field. - * @param default_value The default value. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_int_new(const char *id, - const char *text, - int default_value); - -/** - * Sets the default value in an integer field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_int_set_default_value(PurpleRequestField *field, - int default_value); - -/** - * Sets the value in an integer field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_int_set_value(PurpleRequestField *field, int value); - -/** - * Returns the default value in an integer field. - * - * @param field The field. - * - * @return The default value. - */ -int purple_request_field_int_get_default_value(const PurpleRequestField *field); - -/** - * Returns the user-entered value in an integer field. - * - * @param field The field. - * - * @return The value. - */ -int purple_request_field_int_get_value(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Boolean Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a boolean field. - * - * This is often represented as a checkbox. - * - * @param id The field ID. - * @param text The text label of the field. - * @param default_value The default value. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_bool_new(const char *id, - const char *text, - gboolean default_value); - -/** - * Sets the default value in an boolean field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_bool_set_default_value(PurpleRequestField *field, - gboolean default_value); - -/** - * Sets the value in an boolean field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_bool_set_value(PurpleRequestField *field, - gboolean value); - -/** - * Returns the default value in an boolean field. - * - * @param field The field. - * - * @return The default value. - */ -gboolean purple_request_field_bool_get_default_value( - const PurpleRequestField *field); - -/** - * Returns the user-entered value in an boolean field. - * - * @param field The field. - * - * @return The value. - */ -gboolean purple_request_field_bool_get_value(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Choice Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a multiple choice field. - * - * This is often represented as a group of radio buttons. - * - * @param id The field ID. - * @param text The optional label of the field. - * @param default_value The default choice. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_choice_new(const char *id, - const char *text, - int default_value); - -/** - * Adds a choice to a multiple choice field. - * - * @param field The choice field. - * @param label The choice label. - */ -void purple_request_field_choice_add(PurpleRequestField *field, - const char *label); - -/** - * Sets the default value in an choice field. - * - * @param field The field. - * @param default_value The default value. - */ -void purple_request_field_choice_set_default_value(PurpleRequestField *field, - int default_value); - -/** - * Sets the value in an choice field. - * - * @param field The field. - * @param value The value. - */ -void purple_request_field_choice_set_value(PurpleRequestField *field, int value); - -/** - * Returns the default value in an choice field. - * - * @param field The field. - * - * @return The default value. - */ -int purple_request_field_choice_get_default_value(const PurpleRequestField *field); - -/** - * Returns the user-entered value in an choice field. - * - * @param field The field. - * - * @return The value. - */ -int purple_request_field_choice_get_value(const PurpleRequestField *field); - -/** - * Returns a list of labels in a choice field. - * - * @param field The field. - * - * @constreturn The list of labels. - */ -GList *purple_request_field_choice_get_labels(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name List Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a multiple list item field. - * - * @param id The field ID. - * @param text The optional label of the field. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_list_new(const char *id, const char *text); - -/** - * Sets whether or not a list field allows multiple selection. - * - * @param field The list field. - * @param multi_select TRUE if multiple selection is enabled, - * or FALSE otherwise. - */ -void purple_request_field_list_set_multi_select(PurpleRequestField *field, - gboolean multi_select); - -/** - * Returns whether or not a list field allows multiple selection. - * - * @param field The list field. - * - * @return TRUE if multiple selection is enabled, or FALSE otherwise. - */ -gboolean purple_request_field_list_get_multi_select( - const PurpleRequestField *field); - -/** - * Returns the data for a particular item. - * - * @param field The list field. - * @param text The item text. - * - * @return The data associated with the item. - */ -void *purple_request_field_list_get_data(const PurpleRequestField *field, - const char *text); - -/** - * Adds an item to a list field. - * - * @param field The list field. - * @param item The list item. - * @param data The associated data. - */ -void purple_request_field_list_add(PurpleRequestField *field, - const char *item, void *data); - -/** - * Adds a selected item to the list field. - * - * @param field The field. - * @param item The item to add. - */ -void purple_request_field_list_add_selected(PurpleRequestField *field, - const char *item); - -/** - * Clears the list of selected items in a list field. - * - * @param field The field. - */ -void purple_request_field_list_clear_selected(PurpleRequestField *field); - -/** - * Sets a list of selected items in a list field. - * - * @param field The field. - * @param items The list of selected items, which is not modified or freed. - */ -void purple_request_field_list_set_selected(PurpleRequestField *field, - GList *items); - -/** - * Returns whether or not a particular item is selected in a list field. - * - * @param field The field. - * @param item The item. - * - * @return TRUE if the item is selected. FALSE otherwise. - */ -gboolean purple_request_field_list_is_selected(const PurpleRequestField *field, - const char *item); - -/** - * Returns a list of selected items in a list field. - * - * To retrieve the data for each item, use - * purple_request_field_list_get_data(). - * - * @param field The field. - * - * @constreturn The list of selected items. - */ -GList *purple_request_field_list_get_selected( - const PurpleRequestField *field); - -/** - * Returns a list of items in a list field. - * - * @param field The field. - * - * @constreturn The list of items. - */ -GList *purple_request_field_list_get_items(const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Label Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a label field. - * - * @param id The field ID. - * @param text The label of the field. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_label_new(const char *id, - const char *text); - -/*@}*/ - -/**************************************************************************/ -/** @name Image Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates an image field. - * - * @param id The field ID. - * @param text The label of the field. - * @param buf The image data. - * @param size The size of the data in @a buffer. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_image_new(const char *id, const char *text, - const char *buf, gsize size); - -/** - * Sets the scale factors of an image field. - * - * @param field The image field. - * @param x The x scale factor. - * @param y The y scale factor. - */ -void purple_request_field_image_set_scale(PurpleRequestField *field, unsigned int x, unsigned int y); - -/** - * Returns pointer to the image. - * - * @param field The image field. - * - * @return Pointer to the image. - */ -const char *purple_request_field_image_get_buffer(PurpleRequestField *field); - -/** - * Returns size (in bytes) of the image. - * - * @param field The image field. - * - * @return Size of the image. - */ -gsize purple_request_field_image_get_size(PurpleRequestField *field); - -/** - * Returns X scale coefficient of the image. - * - * @param field The image field. - * - * @return X scale coefficient of the image. - */ -unsigned int purple_request_field_image_get_scale_x(PurpleRequestField *field); - -/** - * Returns Y scale coefficient of the image. - * - * @param field The image field. - * - * @return Y scale coefficient of the image. - */ -unsigned int purple_request_field_image_get_scale_y(PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Account Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates an account field. - * - * By default, this field will not show offline accounts. - * - * @param id The field ID. - * @param text The text label of the field. - * @param account The optional default account. - * - * @return The new field. - */ -PurpleRequestField *purple_request_field_account_new(const char *id, - const char *text, - PurpleAccount *account); - -/** - * Sets the default account on an account field. - * - * @param field The account field. - * @param default_value The default account. - */ -void purple_request_field_account_set_default_value(PurpleRequestField *field, - PurpleAccount *default_value); - -/** - * Sets the account in an account field. - * - * @param field The account field. - * @param value The account. - */ -void purple_request_field_account_set_value(PurpleRequestField *field, - PurpleAccount *value); - -/** - * Sets whether or not to show all accounts in an account field. - * - * If TRUE, all accounts, online or offline, will be shown. If FALSE, - * only online accounts will be shown. - * - * @param field The account field. - * @param show_all Whether or not to show all accounts. - */ -void purple_request_field_account_set_show_all(PurpleRequestField *field, - gboolean show_all); - -/** - * Sets the account filter function in an account field. - * - * This function will determine which accounts get displayed and which - * don't. - * - * @param field The account field. - * @param filter_func The account filter function. - */ -void purple_request_field_account_set_filter(PurpleRequestField *field, - PurpleFilterAccountFunc filter_func); - -/** - * Returns the default account in an account field. - * - * @param field The field. - * - * @return The default account. - */ -PurpleAccount *purple_request_field_account_get_default_value( - const PurpleRequestField *field); - -/** - * Returns the user-entered account in an account field. - * - * @param field The field. - * - * @return The user-entered account. - */ -PurpleAccount *purple_request_field_account_get_value( - const PurpleRequestField *field); - -/** - * Returns whether or not to show all accounts in an account field. - * - * If TRUE, all accounts, online or offline, will be shown. If FALSE, - * only online accounts will be shown. - * - * @param field The account field. - * @return Whether or not to show all accounts. - */ -gboolean purple_request_field_account_get_show_all( - const PurpleRequestField *field); - -/** - * Returns the account filter function in an account field. - * - * This function will determine which accounts get displayed and which - * don't. - * - * @param field The account field. - * - * @return The account filter function. - */ -PurpleFilterAccountFunc purple_request_field_account_get_filter( - const PurpleRequestField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name Request API */ -/**************************************************************************/ -/*@{*/ - -/** - * Prompts the user for text input. - * - * @param handle The plugin or connection handle. For some - * things this is extremely important. The - * handle is used to programmatically close the request - * dialog when it is no longer needed. For PRPLs this - * is often a pointer to the #PurpleConnection - * instance. For plugins this should be a similar, - * unique memory location. This value is important - * because it allows a request to be closed with - * purple_request_close_with_handle() when, for - * example, you sign offline. If the request is - * not closed it is very - * likely to cause a crash whenever the callback - * handler functions are triggered. - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param default_value The default value. - * @param multiline @c TRUE if the inputted text can span multiple lines. - * @param masked @c TRUE if the inputted text should be masked in some - * way (such as by displaying characters as stars). This - * might be because the input is some kind of password. - * @param hint Optionally suggest how the input box should appear. - * Use "html", for example, to allow the user to enter - * HTML. - * @param ok_text The text for the @c OK button, which may not be @c NULL. - * @param ok_cb The callback for the @c OK button, which may not be @c - * NULL. - * @param cancel_text The text for the @c Cancel button, which may not be @c - * NULL. - * @param cancel_cb The callback for the @c Cancel button, which may be - * @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is. - * @param who The username of the buddy associated with this request, - * or @c NULL if none is. - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is. - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_input(void *handle, const char *title, const char *primary, - const char *secondary, const char *default_value, gboolean multiline, - gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/** - * Prompts the user for multiple-choice input. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param default_value The default choice; this should be one of the values - * listed in the varargs. - * @param ok_text The text for the @c OK button, which may not be @c NULL. - * @param ok_cb The callback for the @c OK button, which may not be @c - * NULL. - * @param cancel_text The text for the @c Cancel button, which may not be @c - * NULL. - * @param cancel_cb The callback for the @c Cancel button, or @c NULL to - * do nothing. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is. - * @param who The username of the buddy associated with this request, - * or @c NULL if none is. - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is. - * @param user_data The data to pass to the callback. - * @param ... The choices, which should be pairs of char * - * descriptions and int values, terminated with a - * @c NULL parameter. - * - * @return A UI-specific handle. - */ -void *purple_request_choice(void *handle, const char *title, const char *primary, - const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, ...) G_GNUC_NULL_TERMINATED; - -/** - * va_list version of purple_request_choice(); see its documentation. - */ -void *purple_request_choice_varg(void *handle, const char *title, - const char *primary, const char *secondary, int default_value, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, va_list choices); - -/** - * Prompts the user for an action. - * - * This is often represented as a dialog with a button for each action. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param default_action The default action, zero-indexed; if the third action - * supplied should be the default, supply 2. - * The should be the action that users are most likely - * to select. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is. - * @param who The username of the buddy associated with this request, - * or @c NULL if none is. - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is. - * @param user_data The data to pass to the callback. - * @param action_count The number of actions. - * @param ... A list of actions. These are pairs of - * arguments. The first of each pair is the - * char * label that appears on the button. It - * should have an underscore before the letter you want - * to use as the accelerator key for the button. The - * second of each pair is the #PurpleRequestActionCb - * function to use when the button is clicked. - * - * @return A UI-specific handle. - */ -void *purple_request_action(void *handle, const char *title, const char *primary, - const char *secondary, int default_action, PurpleAccount *account, - const char *who, PurpleConversation *conv, void *user_data, - size_t action_count, ...); - -/** - * va_list version of purple_request_action(); see its documentation. - */ -void *purple_request_action_varg(void *handle, const char *title, - const char *primary, const char *secondary, int default_action, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data, size_t action_count, va_list actions); - -/** - * Displays groups of fields for the user to fill in. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param primary The main point of the message, or @c NULL if you're - * feeling enigmatic. - * @param secondary Secondary information, or @c NULL if there is none. - * @param fields The list of fields. - * @param ok_text The text for the @c OK button, which may not be @c NULL. - * @param ok_cb The callback for the @c OK button, which may not be @c - * NULL. - * @param cancel_text The text for the @c Cancel button, which may not be @c - * NULL. - * @param cancel_cb The callback for the @c Cancel button, which may be - * @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is - * @param who The username of the buddy associated with this request, - * or @c NULL if none is - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_fields(void *handle, const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/** - * Closes a request. - * - * @param type The request type. - * @param uihandle The request UI handle. - */ -void purple_request_close(PurpleRequestType type, void *uihandle); - -/** - * Closes all requests registered with the specified handle. - * - * @param handle The handle, as supplied as the @a handle parameter to one of the - * purple_request_* functions. - * - * @see purple_request_input(). - */ -void purple_request_close_with_handle(void *handle); - -/** - * A wrapper for purple_request_action() that uses @c Yes and @c No buttons. - */ -#define purple_request_yes_no(handle, title, primary, secondary, \ - default_action, account, who, conv, \ - user_data, yes_cb, no_cb) \ - purple_request_action((handle), (title), (primary), (secondary), \ - (default_action), account, who, conv, (user_data), 2, \ - _("_Yes"), (yes_cb), _("_No"), (no_cb)) - -/** - * A wrapper for purple_request_action() that uses @c OK and @c Cancel buttons. - */ -#define purple_request_ok_cancel(handle, title, primary, secondary, \ - default_action, account, who, conv, \ - user_data, ok_cb, cancel_cb) \ - purple_request_action((handle), (title), (primary), (secondary), \ - (default_action), account, who, conv, (user_data), 2, \ - _("_OK"), (ok_cb), _("_Cancel"), (cancel_cb)) - -/** - * A wrapper for purple_request_action() that uses Accept and Cancel buttons. - */ -#define purple_request_accept_cancel(handle, title, primary, secondary, \ - default_action, account, who, conv, \ - user_data, accept_cb, cancel_cb) \ - purple_request_action((handle), (title), (primary), (secondary), \ - (default_action), account, who, conv, (user_data), 2, \ - _("_Accept"), (accept_cb), _("_Cancel"), (cancel_cb)) - -/** - * Displays a file selector request dialog. Returns the selected filename to - * the callback. Can be used for either opening a file or saving a file. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param filename The default filename (may be @c NULL) - * @param savedialog True if this dialog is being used to save a file. - * False if it is being used to open a file. - * @param ok_cb The callback for the @c OK button. - * @param cancel_cb The callback for the @c Cancel button, which may be @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is - * @param who The username of the buddy associated with this request, - * or @c NULL if none is - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_file(void *handle, const char *title, const char *filename, - gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/** - * Displays a folder select dialog. Returns the selected filename to - * the callback. - * - * @param handle The plugin or connection handle. For some things this - * is extremely important. See the comments on - * purple_request_input(). - * @param title The title of the message, or @c NULL if it should have - * no title. - * @param dirname The default directory name (may be @c NULL) - * @param ok_cb The callback for the @c OK button. - * @param cancel_cb The callback for the @c Cancel button, which may be @c NULL. - * @param account The #PurpleAccount associated with this request, or @c - * NULL if none is - * @param who The username of the buddy associated with this request, - * or @c NULL if none is - * @param conv The #PurpleConversation associated with this request, or - * @c NULL if none is - * @param user_data The data to pass to the callback. - * - * @return A UI-specific handle. - */ -void *purple_request_folder(void *handle, const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleAccount *account, const char *who, PurpleConversation *conv, - void *user_data); - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used when displaying a - * request. - * - * @param ops The UI operations structure. - */ -void purple_request_set_ui_ops(PurpleRequestUiOps *ops); - -/** - * Returns the UI operations structure to be used when displaying a - * request. - * - * @return The UI operations structure. - */ -PurpleRequestUiOps *purple_request_get_ui_ops(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_REQUEST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,396 +0,0 @@ -/** - * @file roomlist.c Room List API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" - -#include "account.h" -#include "connection.h" -#include "debug.h" -#include "roomlist.h" -#include "server.h" - - -static PurpleRoomlistUiOps *ops = NULL; - -/**************************************************************************/ -/** @name Room List API */ -/**************************************************************************/ -/*@{*/ - -void purple_roomlist_show_with_account(PurpleAccount *account) -{ - if (ops && ops->show_with_account) - ops->show_with_account(account); -} - -PurpleRoomlist *purple_roomlist_new(PurpleAccount *account) -{ - PurpleRoomlist *list; - - g_return_val_if_fail(account != NULL, NULL); - - list = g_new0(PurpleRoomlist, 1); - list->account = account; - list->rooms = NULL; - list->fields = NULL; - list->ref = 1; - - if (ops && ops->create) - ops->create(list); - - return list; -} - -void purple_roomlist_ref(PurpleRoomlist *list) -{ - g_return_if_fail(list != NULL); - - list->ref++; - purple_debug_misc("roomlist", "reffing list, ref count now %d\n", list->ref); -} - -static void purple_roomlist_room_destroy(PurpleRoomlist *list, PurpleRoomlistRoom *r) -{ - GList *l, *j; - - for (l = list->fields, j = r->fields; l && j; l = l->next, j = j->next) { - PurpleRoomlistField *f = l->data; - if (f->type == PURPLE_ROOMLIST_FIELD_STRING) - g_free(j->data); - } - - g_list_free(r->fields); - g_free(r->name); - g_free(r); -} - -static void purple_roomlist_field_destroy(PurpleRoomlistField *f) -{ - g_free(f->label); - g_free(f->name); - g_free(f); -} - -static void purple_roomlist_destroy(PurpleRoomlist *list) -{ - GList *l; - - purple_debug_misc("roomlist", "destroying list %p\n", list); - - if (ops && ops->destroy) - ops->destroy(list); - - for (l = list->rooms; l; l = l->next) { - PurpleRoomlistRoom *r = l->data; - purple_roomlist_room_destroy(list, r); - } - g_list_free(list->rooms); - - g_list_foreach(list->fields, (GFunc)purple_roomlist_field_destroy, NULL); - g_list_free(list->fields); - - g_free(list); -} - -void purple_roomlist_unref(PurpleRoomlist *list) -{ - g_return_if_fail(list != NULL); - g_return_if_fail(list->ref > 0); - - list->ref--; - - purple_debug_misc("roomlist", "unreffing list, ref count now %d\n", list->ref); - if (list->ref == 0) - purple_roomlist_destroy(list); -} - -void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields) -{ - g_return_if_fail(list != NULL); - - list->fields = fields; - - if (ops && ops->set_fields) - ops->set_fields(list, fields); -} - -void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress) -{ - g_return_if_fail(list != NULL); - - list->in_progress = in_progress; - - if (ops && ops->in_progress) - ops->in_progress(list, in_progress); -} - -gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list) -{ - g_return_val_if_fail(list != NULL, FALSE); - - return list->in_progress; -} - -void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room) -{ - g_return_if_fail(list != NULL); - g_return_if_fail(room != NULL); - - list->rooms = g_list_append(list->rooms, room); - - if (ops && ops->add_room) - ops->add_room(list, room); -} - -PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - g_return_val_if_fail(gc != NULL, NULL); - g_return_val_if_fail(PURPLE_CONNECTION_IS_CONNECTED(gc), NULL); - - prpl = purple_connection_get_prpl(gc); - - if(prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(prpl_info && prpl_info->roomlist_get_list) - return prpl_info->roomlist_get_list(gc); - - return NULL; -} - -void purple_roomlist_cancel_get_list(PurpleRoomlist *list) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - - gc = purple_account_get_connection(list->account); - - g_return_if_fail(gc != NULL); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(prpl_info && prpl_info->roomlist_cancel) - prpl_info->roomlist_cancel(list); -} - -void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - g_return_if_fail(category != NULL); - g_return_if_fail(category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY); - - gc = purple_account_get_connection(list->account); - g_return_if_fail(gc != NULL); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if(prpl_info && prpl_info->roomlist_expand_category) - prpl_info->roomlist_expand_category(list, category); -} - -GList * purple_roomlist_get_fields(PurpleRoomlist *list) -{ - return list->fields; -} - -/*@}*/ - -/**************************************************************************/ -/** @name Room API */ -/**************************************************************************/ -/*@{*/ - -PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, - PurpleRoomlistRoom *parent) -{ - PurpleRoomlistRoom *room; - - g_return_val_if_fail(name != NULL, NULL); - - room = g_new0(PurpleRoomlistRoom, 1); - room->type = type; - room->name = g_strdup(name); - room->parent = parent; - - return room; -} - -void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field) -{ - PurpleRoomlistField *f; - - g_return_if_fail(list != NULL); - g_return_if_fail(room != NULL); - g_return_if_fail(list->fields != NULL); - - /* If this is the first call for this room, grab the first field in - * the Roomlist's fields. Otherwise, grab the field that is one - * more than the number of fields already present for the room. - * (This works because g_list_nth_data() is zero-indexed and - * g_list_length() is one-indexed.) */ - if (!room->fields) - f = list->fields->data; - else - f = g_list_nth_data(list->fields, g_list_length(room->fields)); - - g_return_if_fail(f != NULL); - - switch(f->type) { - case PURPLE_ROOMLIST_FIELD_STRING: - room->fields = g_list_append(room->fields, g_strdup(field)); - break; - case PURPLE_ROOMLIST_FIELD_BOOL: - case PURPLE_ROOMLIST_FIELD_INT: - room->fields = g_list_append(room->fields, GINT_TO_POINTER(field)); - break; - } -} - -void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room) -{ - GHashTable *components; - GList *l, *j; - PurpleConnection *gc; - - g_return_if_fail(list != NULL); - g_return_if_fail(room != NULL); - - gc = purple_account_get_connection(list->account); - if (!gc) - return; - - components = g_hash_table_new(g_str_hash, g_str_equal); - - g_hash_table_replace(components, "name", room->name); - for (l = list->fields, j = room->fields; l && j; l = l->next, j = j->next) { - PurpleRoomlistField *f = l->data; - - g_hash_table_replace(components, f->name, j->data); - } - - serv_join_chat(gc, components); - - g_hash_table_destroy(components); -} - -PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room) -{ - return room->type; -} - -const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room) -{ - return room->name; -} - -PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room) -{ - return room->parent; -} - -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room) -{ - return room->fields; -} - -/*@}*/ - -/**************************************************************************/ -/** @name Room Field API */ -/**************************************************************************/ -/*@{*/ - -PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, - const gchar *label, const gchar *name, - gboolean hidden) -{ - PurpleRoomlistField *f; - - g_return_val_if_fail(label != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - f = g_new0(PurpleRoomlistField, 1); - - f->type = type; - f->label = g_strdup(label); - f->name = g_strdup(name); - f->hidden = hidden; - - return f; -} - -PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field) -{ - return field->type; -} - -const char * purple_roomlist_field_get_label(PurpleRoomlistField *field) -{ - return field->label; -} - -gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field) -{ - return field->hidden; -} - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - - -void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ui_ops) -{ - ops = ui_ops; -} - -PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void) -{ - return ops; -} - -/*@}*/ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/roomlist.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,398 +0,0 @@ -/** - * @file roomlist.h Room List API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_ROOMLIST_H_ -#define _PURPLE_ROOMLIST_H_ - -typedef struct _PurpleRoomlist PurpleRoomlist; -typedef struct _PurpleRoomlistRoom PurpleRoomlistRoom; -typedef struct _PurpleRoomlistField PurpleRoomlistField; -/** @copydoc _PurpleRoomlistUiOps */ -typedef struct _PurpleRoomlistUiOps PurpleRoomlistUiOps; - -/** - * The types of rooms. - * - * These are ORable flags. - */ -typedef enum -{ - PURPLE_ROOMLIST_ROOMTYPE_CATEGORY = 0x01, /**< It's a category, but not a room you can join. */ - PURPLE_ROOMLIST_ROOMTYPE_ROOM = 0x02 /**< It's a room, like the kind you can join. */ - -} PurpleRoomlistRoomType; - -/** - * The types of fields. - */ -typedef enum -{ - PURPLE_ROOMLIST_FIELD_BOOL, - PURPLE_ROOMLIST_FIELD_INT, - PURPLE_ROOMLIST_FIELD_STRING /**< We do a g_strdup on the passed value if it's this type. */ - -} PurpleRoomlistFieldType; - -#include "account.h" -#include "glib.h" - -/**************************************************************************/ -/** Data Structures */ -/**************************************************************************/ - -/** - * Represents a list of rooms for a given connection on a given protocol. - */ -struct _PurpleRoomlist { - PurpleAccount *account; /**< The account this list belongs to. */ - GList *fields; /**< The fields. */ - GList *rooms; /**< The list of rooms. */ - gboolean in_progress; /**< The listing is in progress. */ - gpointer ui_data; /**< UI private data. */ - gpointer proto_data; /** Prpl private data. */ - guint ref; /**< The reference count. */ -}; - -/** - * Represents a room. - */ -struct _PurpleRoomlistRoom { - PurpleRoomlistRoomType type; /**< The type of room. */ - gchar *name; /**< The name of the room. */ - GList *fields; /**< Other fields. */ - PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */ - gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */ -}; - -/** - * A field a room might have. - */ -struct _PurpleRoomlistField { - PurpleRoomlistFieldType type; /**< The type of field. */ - gchar *label; /**< The i18n user displayed name of the field. */ - gchar *name; /**< The internal name of the field. */ - gboolean hidden; /**< Hidden? */ -}; - -/** - * The room list ops to be filled out by the UI. - */ -struct _PurpleRoomlistUiOps { - void (*show_with_account)(PurpleAccount *account); /**< Force the ui to pop up a dialog and get the list */ - void (*create)(PurpleRoomlist *list); /**< A new list was created. */ - void (*set_fields)(PurpleRoomlist *list, GList *fields); /**< Sets the columns. */ - void (*add_room)(PurpleRoomlist *list, PurpleRoomlistRoom *room); /**< Add a room to the list. */ - void (*in_progress)(PurpleRoomlist *list, gboolean flag); /**< Are we fetching stuff still? */ - void (*destroy)(PurpleRoomlist *list); /**< We're destroying list. */ - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Room List API */ -/**************************************************************************/ -/*@{*/ - -/** - * This is used to get the room list on an account, asking the UI - * to pop up a dialog with the specified account already selected, - * and pretend the user clicked the get list button. - * While we're pretending, predend I didn't say anything about dialogs - * or buttons, since this is the core. - * - * @param account The account to get the list on. - */ -void purple_roomlist_show_with_account(PurpleAccount *account); - -/** - * Returns a newly created room list object. - * - * It has an initial reference count of 1. - * - * @param account The account that's listing rooms. - * @return The new room list handle. - */ -PurpleRoomlist *purple_roomlist_new(PurpleAccount *account); - -/** - * Increases the reference count on the room list. - * - * @param list The object to ref. - */ -void purple_roomlist_ref(PurpleRoomlist *list); - -/** - * Decreases the reference count on the room list. - * - * The room list will be destroyed when this reaches 0. - * - * @param list The room list object to unref and possibly - * destroy. - */ -void purple_roomlist_unref(PurpleRoomlist *list); - -/** - * Set the different field types and their names for this protocol. - * - * This must be called before purple_roomlist_room_add(). - * - * @param list The room list. - * @param fields A GList of PurpleRoomlistField's. UI's are encouraged - * to default to displaying them in the order given. - */ -void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields); - -/** - * Set the "in progress" state of the room list. - * - * The UI is encouraged to somehow hint to the user - * whether or not we're busy downloading a room list or not. - * - * @param list The room list. - * @param in_progress We're downloading it, or we're not. - */ -void purple_roomlist_set_in_progress(PurpleRoomlist *list, gboolean in_progress); - -/** - * Gets the "in progress" state of the room list. - * - * The UI is encouraged to somehow hint to the user - * whether or not we're busy downloading a room list or not. - * - * @param list The room list. - * @return True if we're downloading it, or false if we're not. - */ -gboolean purple_roomlist_get_in_progress(PurpleRoomlist *list); - -/** - * Adds a room to the list of them. - * - * @param list The room list. - * @param room The room to add to the list. The GList of fields must be in the same - order as was given in purple_roomlist_set_fields(). -*/ -void purple_roomlist_room_add(PurpleRoomlist *list, PurpleRoomlistRoom *room); - -/** - * Returns a PurpleRoomlist structure from the prpl, and - * instructs the prpl to start fetching the list. - * - * @param gc The PurpleConnection to have get a list. - * - * @return A PurpleRoomlist* or @c NULL if the protocol - * doesn't support that. - */ -PurpleRoomlist *purple_roomlist_get_list(PurpleConnection *gc); - -/** - * Tells the prpl to stop fetching the list. - * If this is possible and done, the prpl will - * call set_in_progress with @c FALSE and possibly - * unref the list if it took a reference. - * - * @param list The room list to cancel a get_list on. - */ -void purple_roomlist_cancel_get_list(PurpleRoomlist *list); - -/** - * Tells the prpl that a category was expanded. - * - * On some protocols, the rooms in the category - * won't be fetched until this is called. - * - * @param list The room list. - * @param category The category that was expanded. The expression - * (category->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) - * must be true. - */ -void purple_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category); - -/** - * Get the list of fields for a roomlist. - * - * @param roomlist The roomlist, which must not be @c NULL. - * @constreturn A list of fields - * @since 2.4.0 - */ -GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist); - -/*@}*/ - -/**************************************************************************/ -/** @name Room API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new room, to be added to the list. - * - * @param type The type of room. - * @param name The name of the room. - * @param parent The room's parent, if any. - * - * @return A new room. - */ -PurpleRoomlistRoom *purple_roomlist_room_new(PurpleRoomlistRoomType type, const gchar *name, - PurpleRoomlistRoom *parent); - -/** - * Adds a field to a room. - * - * @param list The room list the room belongs to. - * @param room The room. - * @param field The field to append. Strings get g_strdup'd internally. - */ -void purple_roomlist_room_add_field(PurpleRoomlist *list, PurpleRoomlistRoom *room, gconstpointer field); - -/** - * Join a room, given a PurpleRoomlistRoom and it's associated PurpleRoomlist. - * - * @param list The room list the room belongs to. - * @param room The room to join. - */ -void purple_roomlist_room_join(PurpleRoomlist *list, PurpleRoomlistRoom *room); - -/** - * Get the type of a room. - * @param room The room, which must not be @c NULL. - * @return The type of the room. - * @since 2.4.0 - */ -PurpleRoomlistRoomType purple_roomlist_room_get_type(PurpleRoomlistRoom *room); - -/** - * Get the name of a room. - * @param room The room, which must not be @c NULL. - * @return The name of the room. - * @since 2.4.0 - */ -const char * purple_roomlist_room_get_name(PurpleRoomlistRoom *room); - -/** - * Get the parent of a room. - * @param room The room, which must not be @c NULL. - * @return The parent of the room, which can be @c NULL. - * @since 2.4.0 - */ -PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room); - -/** - * Get the list of fields for a room. - * - * @param room The room, which must not be @c NULL. - * @constreturn A list of fields - * @since 2.4.0 - */ -GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room); - -/*@}*/ - -/**************************************************************************/ -/** @name Room Field API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new field. - * - * @param type The type of the field. - * @param label The i18n'ed, user displayable name. - * @param name The internal name of the field. - * @param hidden Hide the field. - * - * @return A new PurpleRoomlistField, ready to be added to a GList and passed to - * purple_roomlist_set_fields(). - */ -PurpleRoomlistField *purple_roomlist_field_new(PurpleRoomlistFieldType type, - const gchar *label, const gchar *name, - gboolean hidden); - -/** - * Get the type of a field. - * - * @param field A PurpleRoomlistField, which must not be @c NULL. - * - * @return The type of the field. - * @since 2.4.0 - */ -PurpleRoomlistFieldType purple_roomlist_field_get_type(PurpleRoomlistField *field); - -/** - * Get the label of a field. - * - * @param field A PurpleRoomlistField, which must not be @c NULL. - * - * @return The label of the field. - * @since 2.4.0 - */ -const char * purple_roomlist_field_get_label(PurpleRoomlistField *field); - -/** - * Check whether a roomlist-field is hidden. - * @param field A PurpleRoomlistField, which must not be @c NULL. - * - * @return @c TRUE if the field is hidden, @c FALSE otherwise. - * @since 2.4.0 - */ -gboolean purple_roomlist_field_get_hidden(PurpleRoomlistField *field); - -/*@}*/ - -/**************************************************************************/ -/** @name UI Registration Functions */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the UI operations structure to be used in all purple room lists. - * - * @param ops The UI operations structure. - */ -void purple_roomlist_set_ui_ops(PurpleRoomlistUiOps *ops); - -/** - * Returns the purple window UI operations structure to be used in - * new windows. - * - * @return A filled-out PurpleRoomlistUiOps structure. - */ -PurpleRoomlistUiOps *purple_roomlist_get_ui_ops(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_ROOMLIST_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1261 +0,0 @@ -/** - * @file savedstatuses.c Saved Status API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "debug.h" -#include "idle.h" -#include "notify.h" -#include "savedstatuses.h" -#include "dbus-maybe.h" -#include "request.h" -#include "status.h" -#include "util.h" -#include "xmlnode.h" - -/** - * The maximum number of transient statuses to save. This - * is used during the shutdown process to clean out old - * transient statuses. - */ -#define MAX_TRANSIENTS 5 - -/** - * The default message to use when the user becomes auto-away. - */ -#define DEFAULT_AUTOAWAY_MESSAGE _("I'm not here right now") - -/** - * The information stores a snap-shot of the statuses of all - * your accounts. Basically these are your saved away messages. - * There is an overall status and message that applies to - * all your accounts, and then each individual account can - * optionally have a different custom status and message. - * - * The changes to status.xml caused by the new status API - * are fully backward compatible. The new status API just - * adds the optional sub-statuses to the XML file. - */ -struct _PurpleSavedStatus -{ - char *title; - PurpleStatusPrimitive type; - char *message; - - /** The timestamp when this saved status was created. This must be unique. */ - time_t creation_time; - - time_t lastused; - - unsigned int usage_count; - - GList *substatuses; /**< A list of PurpleSavedStatusSub's. */ -}; - -/* - * TODO: If a PurpleStatusType is deleted, need to also delete any - * associated PurpleSavedStatusSub's? - */ -struct _PurpleSavedStatusSub -{ - PurpleAccount *account; - const PurpleStatusType *type; - char *message; -}; - -static GList *saved_statuses = NULL; -static guint save_timer = 0; -static gboolean statuses_loaded = FALSE; - -/* - * This hash table keeps track of which timestamps we've - * used so that we don't have two saved statuses with the - * same 'creation_time' timestamp. The 'created' timestamp - * is used as a unique identifier. - * - * So the key in this hash table is the creation_time and - * the value is a pointer to the PurpleSavedStatus. - */ -static GHashTable *creation_times; - -static void schedule_save(void); - -/********************************************************************* - * Private utility functions * - *********************************************************************/ - -static void -free_saved_status_sub(PurpleSavedStatusSub *substatus) -{ - g_return_if_fail(substatus != NULL); - - g_free(substatus->message); - purple_request_close_with_handle(substatus); - PURPLE_DBUS_UNREGISTER_POINTER(substatus); - g_free(substatus); -} - -static void -free_saved_status(PurpleSavedStatus *status) -{ - g_return_if_fail(status != NULL); - - g_free(status->title); - g_free(status->message); - - while (status->substatuses != NULL) - { - PurpleSavedStatusSub *substatus = status->substatuses->data; - status->substatuses = g_list_remove(status->substatuses, substatus); - free_saved_status_sub(substatus); - } - purple_request_close_with_handle(status); - PURPLE_DBUS_UNREGISTER_POINTER(status); - g_free(status); -} - -/* - * Set the timestamp for when this saved status was created, and - * make sure it is unique. - */ -static void -set_creation_time(PurpleSavedStatus *status, time_t creation_time) -{ - g_return_if_fail(status != NULL); - - /* Avoid using 0 because it's an invalid hash key */ - status->creation_time = creation_time != 0 ? creation_time : 1; - - while (g_hash_table_lookup(creation_times, (gconstpointer)status->creation_time) != NULL) - status->creation_time++; - - g_hash_table_insert(creation_times, - (gpointer)status->creation_time, - status); -} - -/** - * A magic number is calculated for each status, and then the - * statuses are ordered by the magic number. The magic number - * is the date the status was last used offset by one day for - * each time the status has been used (but only by 10 days at - * the most). - * - * The goal is to have recently used statuses at the top of - * the list, but to also keep frequently used statuses near - * the top. - */ -static gint -saved_statuses_sort_func(gconstpointer a, gconstpointer b) -{ - const PurpleSavedStatus *saved_status_a = a; - const PurpleSavedStatus *saved_status_b = b; - time_t time_a = saved_status_a->lastused + - (MIN(saved_status_a->usage_count, 10) * 86400); - time_t time_b = saved_status_b->lastused + - (MIN(saved_status_b->usage_count, 10) * 86400); - if (time_a > time_b) - return -1; - if (time_a < time_b) - return 1; - return 0; -} - -/** - * Transient statuses are added and removed automatically by - * Purple. If they're not used for a certain length of time then - * they'll expire and be automatically removed. This function - * does the expiration. - */ -static void -remove_old_transient_statuses(void) -{ - GList *l, *next; - PurpleSavedStatus *saved_status, *current_status; - int count; - time_t creation_time; - - current_status = purple_savedstatus_get_current(); - - /* - * Iterate through the list of saved statuses. Delete all - * transient statuses except for the first MAX_TRANSIENTS - * (remember, the saved statuses are already sorted by popularity). - */ - count = 0; - for (l = saved_statuses; l != NULL; l = next) - { - next = l->next; - saved_status = l->data; - if (purple_savedstatus_is_transient(saved_status)) - { - if (count == MAX_TRANSIENTS) - { - if (saved_status != current_status) - { - saved_statuses = g_list_remove(saved_statuses, saved_status); - creation_time = purple_savedstatus_get_creation_time(saved_status); - g_hash_table_remove(creation_times, (gconstpointer)creation_time); - free_saved_status(saved_status); - } - } - else - count++; - } - } - - if (count == MAX_TRANSIENTS) - schedule_save(); -} - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static xmlnode * -substatus_to_xmlnode(PurpleSavedStatusSub *substatus) -{ - xmlnode *node, *child; - - node = xmlnode_new("substatus"); - - child = xmlnode_new_child(node, "account"); - xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(substatus->account)); - xmlnode_insert_data(child, - purple_normalize(substatus->account, - purple_account_get_username(substatus->account)), -1); - - child = xmlnode_new_child(node, "state"); - xmlnode_insert_data(child, purple_status_type_get_id(substatus->type), -1); - - if (substatus->message != NULL) - { - child = xmlnode_new_child(node, "message"); - xmlnode_insert_data(child, substatus->message, -1); - } - - return node; -} - -static xmlnode * -status_to_xmlnode(PurpleSavedStatus *status) -{ - xmlnode *node, *child; - char buf[21]; - GList *cur; - - node = xmlnode_new("status"); - if (status->title != NULL) - { - xmlnode_set_attrib(node, "name", status->title); - } - else - { - /* - * Purple 1.5.0 and earlier require a name to be set, so we - * do this little hack to maintain backward compatability - * in the status.xml file. Eventually this should be removed - * and we should determine if a status is transient by - * whether the "name" attribute is set to something or if - * it does not exist at all. - */ - xmlnode_set_attrib(node, "name", "Auto-Cached"); - xmlnode_set_attrib(node, "transient", "true"); - } - - g_snprintf(buf, sizeof(buf), "%lu", status->creation_time); - xmlnode_set_attrib(node, "created", buf); - - g_snprintf(buf, sizeof(buf), "%lu", status->lastused); - xmlnode_set_attrib(node, "lastused", buf); - - g_snprintf(buf, sizeof(buf), "%u", status->usage_count); - xmlnode_set_attrib(node, "usage_count", buf); - - child = xmlnode_new_child(node, "state"); - xmlnode_insert_data(child, purple_primitive_get_id_from_type(status->type), -1); - - if (status->message != NULL) - { - child = xmlnode_new_child(node, "message"); - xmlnode_insert_data(child, status->message, -1); - } - - for (cur = status->substatuses; cur != NULL; cur = cur->next) - { - child = substatus_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static xmlnode * -statuses_to_xmlnode(void) -{ - xmlnode *node, *child; - GList *cur; - - node = xmlnode_new("statuses"); - xmlnode_set_attrib(node, "version", "1.0"); - - for (cur = saved_statuses; cur != NULL; cur = cur->next) - { - child = status_to_xmlnode(cur->data); - xmlnode_insert_child(node, child); - } - - return node; -} - -static void -sync_statuses(void) -{ - xmlnode *node; - char *data; - - if (!statuses_loaded) - { - purple_debug_error("status", "Attempted to save statuses before they " - "were read!\n"); - return; - } - - node = statuses_to_xmlnode(); - data = xmlnode_to_formatted_str(node, NULL); - purple_util_write_data_to_file("status.xml", data, -1); - g_free(data); - xmlnode_free(node); -} - -static gboolean -save_cb(gpointer data) -{ - sync_statuses(); - save_timer = 0; - return FALSE; -} - -static void -schedule_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static PurpleSavedStatusSub * -parse_substatus(xmlnode *substatus) -{ - PurpleSavedStatusSub *ret; - xmlnode *node; - char *data; - - ret = g_new0(PurpleSavedStatusSub, 1); - - /* Read the account */ - node = xmlnode_get_child(substatus, "account"); - if (node != NULL) - { - char *acct_name; - const char *protocol; - acct_name = xmlnode_get_data(node); - protocol = xmlnode_get_attrib(node, "protocol"); - protocol = _purple_oscar_convert(acct_name, protocol); /* XXX: Remove */ - if ((acct_name != NULL) && (protocol != NULL)) - ret->account = purple_accounts_find(acct_name, protocol); - g_free(acct_name); - } - - if (ret->account == NULL) - { - g_free(ret); - return NULL; - } - - /* Read the state */ - node = xmlnode_get_child(substatus, "state"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->type = purple_status_type_find_with_id( - ret->account->status_types, data); - g_free(data); - } - - if (ret->type == NULL) - { - g_free(ret); - return NULL; - } - - /* Read the message */ - node = xmlnode_get_child(substatus, "message"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->message = data; - } - - PURPLE_DBUS_REGISTER_POINTER(ret, PurpleSavedStatusSub); - return ret; -} - -/** - * Parse a saved status and add it to the saved_statuses linked list. - * - * Here's an example of the XML for a saved status: - * - * away - * I like the way that they walk - * And it's chill to hear them talk - * And I can always make them smile - * From White Castle to the Nile - * - * markdoliner - * available - * The ladies man is here to answer your queries. - * - * - * giantgraypanda - * away - * A.C. ain't in charge no more. - * - * - * - * I know. Moving, huh? - */ -static PurpleSavedStatus * -parse_status(xmlnode *status) -{ - PurpleSavedStatus *ret; - xmlnode *node; - const char *attrib; - char *data; - int i; - - ret = g_new0(PurpleSavedStatus, 1); - - attrib = xmlnode_get_attrib(status, "transient"); - if (!purple_strequal(attrib, "true")) - { - /* Read the title */ - attrib = xmlnode_get_attrib(status, "name"); - ret->title = g_strdup(attrib); - } - - if (ret->title != NULL) - { - /* Ensure the title is unique */ - i = 2; - while (purple_savedstatus_find(ret->title) != NULL) - { - g_free(ret->title); - ret->title = g_strdup_printf("%s %d", attrib, i); - i++; - } - } - - /* Read the creation time */ - attrib = xmlnode_get_attrib(status, "created"); - set_creation_time(ret, (attrib != NULL ? atol(attrib) : 0)); - - /* Read the last used time */ - attrib = xmlnode_get_attrib(status, "lastused"); - ret->lastused = (attrib != NULL ? atol(attrib) : 0); - - /* Read the usage count */ - attrib = xmlnode_get_attrib(status, "usage_count"); - ret->usage_count = (attrib != NULL ? atol(attrib) : 0); - - /* Read the primitive status type */ - node = xmlnode_get_child(status, "state"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->type = purple_primitive_get_type_from_id(data); - g_free(data); - } - - /* Read the message */ - node = xmlnode_get_child(status, "message"); - if ((node != NULL) && ((data = xmlnode_get_data(node)) != NULL)) - { - ret->message = data; - } - - /* Read substatuses */ - for (node = xmlnode_get_child(status, "substatus"); node != NULL; - node = xmlnode_get_next_twin(node)) - { - PurpleSavedStatusSub *new; - new = parse_substatus(node); - if (new != NULL) - ret->substatuses = g_list_prepend(ret->substatuses, new); - } - - PURPLE_DBUS_REGISTER_POINTER(ret, PurpleSavedStatus); - return ret; -} - -/** - * Read the saved statuses from a file in the Purple user dir. - * - * @return TRUE on success, FALSE on failure (if the file can not - * be opened, or if it contains invalid XML). - */ -static void -load_statuses(void) -{ - xmlnode *statuses, *status; - - statuses_loaded = TRUE; - - statuses = purple_util_read_xml_from_file("status.xml", _("saved statuses")); - - if (statuses == NULL) - return; - - for (status = xmlnode_get_child(statuses, "status"); status != NULL; - status = xmlnode_get_next_twin(status)) - { - PurpleSavedStatus *new; - new = parse_status(status); - saved_statuses = g_list_prepend(saved_statuses, new); - } - saved_statuses = g_list_sort(saved_statuses, saved_statuses_sort_func); - - xmlnode_free(statuses); -} - - -/************************************************************************** -* Saved status API -**************************************************************************/ -PurpleSavedStatus * -purple_savedstatus_new(const char *title, PurpleStatusPrimitive type) -{ - PurpleSavedStatus *status; - - /* Make sure we don't already have a saved status with this title. */ - if (title != NULL) - g_return_val_if_fail(purple_savedstatus_find(title) == NULL, NULL); - - status = g_new0(PurpleSavedStatus, 1); - PURPLE_DBUS_REGISTER_POINTER(status, PurpleSavedStatus); - status->title = g_strdup(title); - status->type = type; - set_creation_time(status, time(NULL)); - - saved_statuses = g_list_insert_sorted(saved_statuses, status, saved_statuses_sort_func); - - schedule_save(); - - purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-added", - status); - - return status; -} - -void -purple_savedstatus_set_title(PurpleSavedStatus *status, const char *title) -{ - g_return_if_fail(status != NULL); - - /* Make sure we don't already have a saved status with this title. */ - g_return_if_fail(purple_savedstatus_find(title) == NULL); - - g_free(status->title); - status->title = g_strdup(title); - - schedule_save(); - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", status); -} - -void -purple_savedstatus_set_type(PurpleSavedStatus *status, PurpleStatusPrimitive type) -{ - g_return_if_fail(status != NULL); - - status->type = type; - - schedule_save(); - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", status); -} - -void -purple_savedstatus_set_message(PurpleSavedStatus *status, const char *message) -{ - g_return_if_fail(status != NULL); - - g_free(status->message); - if ((message != NULL) && (*message == '\0')) - status->message = NULL; - else - status->message = g_strdup(message); - - schedule_save(); - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", status); -} - -void -purple_savedstatus_set_substatus(PurpleSavedStatus *saved_status, - const PurpleAccount *account, - const PurpleStatusType *type, - const char *message) -{ - PurpleSavedStatusSub *substatus; - - g_return_if_fail(saved_status != NULL); - g_return_if_fail(account != NULL); - g_return_if_fail(type != NULL); - - /* Find an existing substatus or create a new one */ - substatus = purple_savedstatus_get_substatus(saved_status, account); - if (substatus == NULL) - { - substatus = g_new0(PurpleSavedStatusSub, 1); - PURPLE_DBUS_REGISTER_POINTER(substatus, PurpleSavedStatusSub); - substatus->account = (PurpleAccount *)account; - saved_status->substatuses = g_list_prepend(saved_status->substatuses, substatus); - } - - substatus->type = type; - g_free(substatus->message); - substatus->message = g_strdup(message); - - schedule_save(); - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", saved_status); -} - -void -purple_savedstatus_unset_substatus(PurpleSavedStatus *saved_status, - const PurpleAccount *account) -{ - GList *iter; - PurpleSavedStatusSub *substatus; - - g_return_if_fail(saved_status != NULL); - g_return_if_fail(account != NULL); - - for (iter = saved_status->substatuses; iter != NULL; iter = iter->next) - { - substatus = iter->data; - if (substatus->account == account) - { - saved_status->substatuses = g_list_delete_link(saved_status->substatuses, iter); - g_free(substatus->message); - g_free(substatus); - return; - } - } - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-modified", saved_status); -} - -/* - * This gets called when an account is deleted. We iterate through - * all of our saved statuses and delete any substatuses that may - * exist for this account. - */ -static void -purple_savedstatus_unset_all_substatuses(const PurpleAccount *account, - gpointer user_data) -{ - GList *iter; - PurpleSavedStatus *status; - - g_return_if_fail(account != NULL); - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - purple_savedstatus_unset_substatus(status, account); - } -} - -void -purple_savedstatus_delete_by_status(PurpleSavedStatus *status) -{ - time_t creation_time, current, idleaway; - - g_return_if_fail(status != NULL); - - saved_statuses = g_list_remove(saved_statuses, status); - creation_time = purple_savedstatus_get_creation_time(status); - g_hash_table_remove(creation_times, (gconstpointer)creation_time); - free_saved_status(status); - - schedule_save(); - - /* - * If we just deleted our current status or our idleaway status, - * then set the appropriate pref back to 0. - */ - current = purple_prefs_get_int("/purple/savedstatus/default"); - if (current == creation_time) - purple_prefs_set_int("/purple/savedstatus/default", 0); - - idleaway = purple_prefs_get_int("/purple/savedstatus/idleaway"); - if (idleaway == creation_time) - purple_prefs_set_int("/purple/savedstatus/idleaway", 0); - - purple_signal_emit(purple_savedstatuses_get_handle(), - "savedstatus-deleted", status); -} - -gboolean -purple_savedstatus_delete(const char *title) -{ - PurpleSavedStatus *status; - - status = purple_savedstatus_find(title); - - if (status == NULL) - return FALSE; - - if (purple_savedstatus_get_current() == status) - return FALSE; - - purple_savedstatus_delete_by_status(status); - - return TRUE; -} - -GList * -purple_savedstatuses_get_all(void) -{ - return saved_statuses; -} - -GList * -purple_savedstatuses_get_popular(unsigned int how_many) -{ - GList *popular = NULL; - GList *cur; - unsigned int i; - PurpleSavedStatus *next; - - /* Copy 'how_many' elements to a new list. If 'how_many' is 0, then copy all of 'em. */ - if (how_many == 0) - how_many = (unsigned int) -1; - - i = 0; - cur = saved_statuses; - while ((i < how_many) && (cur != NULL)) - { - next = cur->data; - if ((!purple_savedstatus_is_transient(next) - || purple_savedstatus_get_message(next) != NULL)) - { - popular = g_list_prepend(popular, next); - i++; - } - cur = cur->next; - } - - popular = g_list_reverse(popular); - - return popular; -} - -PurpleSavedStatus * -purple_savedstatus_get_current(void) -{ - if (purple_savedstatus_is_idleaway()) - return purple_savedstatus_get_idleaway(); - else - return purple_savedstatus_get_default(); -} - -PurpleSavedStatus * -purple_savedstatus_get_default() -{ - time_t creation_time; - PurpleSavedStatus *saved_status = NULL; - - creation_time = purple_prefs_get_int("/purple/savedstatus/default"); - - if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); - - if (saved_status == NULL) - { - /* - * We don't have a current saved status! This is either a new - * Purple user or someone upgrading from Purple 1.5.0 or older, or - * possibly someone who deleted the status they were currently - * using? In any case, add a default status. - */ - saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); - purple_prefs_set_int("/purple/savedstatus/default", - purple_savedstatus_get_creation_time(saved_status)); - } - - return saved_status; -} - -PurpleSavedStatus * -purple_savedstatus_get_idleaway() -{ - time_t creation_time; - PurpleSavedStatus *saved_status = NULL; - - creation_time = purple_prefs_get_int("/purple/savedstatus/idleaway"); - - if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); - - if (saved_status == NULL) - { - /* We don't have a specified "idle" status! Weird. */ - saved_status = purple_savedstatus_find_transient_by_type_and_message( - PURPLE_STATUS_AWAY, DEFAULT_AUTOAWAY_MESSAGE); - - if (saved_status == NULL) - { - saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY); - purple_savedstatus_set_message(saved_status, DEFAULT_AUTOAWAY_MESSAGE); - purple_prefs_set_int("/purple/savedstatus/idleaway", - purple_savedstatus_get_creation_time(saved_status)); - } - } - - return saved_status; -} - -gboolean -purple_savedstatus_is_idleaway() -{ - return purple_prefs_get_bool("/purple/savedstatus/isidleaway"); -} - -void -purple_savedstatus_set_idleaway(gboolean idleaway) -{ - GList *accounts, *node; - PurpleSavedStatus *old, *saved_status; - - if (purple_savedstatus_is_idleaway() == idleaway) - /* Don't need to do anything */ - return; - - old = purple_savedstatus_get_current(); - saved_status = idleaway ? purple_savedstatus_get_idleaway() - : purple_savedstatus_get_default(); - purple_prefs_set_bool("/purple/savedstatus/isidleaway", idleaway); - - /* Changing our status makes us un-idle */ - if (!idleaway) - purple_idle_touch(); - - if (idleaway && (purple_savedstatus_get_type(old) != PURPLE_STATUS_AVAILABLE)) - /* Our global status is already "away," so don't change anything */ - return; - - accounts = purple_accounts_get_all_active(); - for (node = accounts; node != NULL; node = node->next) - { - PurpleAccount *account; - PurplePresence *presence; - PurpleStatus *status; - - account = node->data; - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - - if (!idleaway || purple_status_is_available(status)) - purple_savedstatus_activate_for_account(saved_status, account); - } - - g_list_free(accounts); - - purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed", - saved_status, old); -} - -PurpleSavedStatus * -purple_savedstatus_get_startup() -{ - time_t creation_time; - PurpleSavedStatus *saved_status = NULL; - - creation_time = purple_prefs_get_int("/purple/savedstatus/startup"); - - if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); - - if (saved_status == NULL) - { - /* - * We don't have a status to apply. - * This may be the first login, or the user wants to - * restore the "current" status. - */ - saved_status = purple_savedstatus_get_current(); - } - - return saved_status; -} - - -PurpleSavedStatus * -purple_savedstatus_find(const char *title) -{ - GList *iter; - PurpleSavedStatus *status; - - g_return_val_if_fail(title != NULL, NULL); - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - if (purple_strequal(status->title, title)) - return status; - } - - return NULL; -} - -PurpleSavedStatus * -purple_savedstatus_find_by_creation_time(time_t creation_time) -{ - GList *iter; - PurpleSavedStatus *status; - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - if (status->creation_time == creation_time) - return status; - } - - return NULL; -} - -PurpleSavedStatus * -purple_savedstatus_find_transient_by_type_and_message(PurpleStatusPrimitive type, - const char *message) -{ - GList *iter; - PurpleSavedStatus *status; - - for (iter = saved_statuses; iter != NULL; iter = iter->next) - { - status = (PurpleSavedStatus *)iter->data; - if ((status->type == type) && purple_savedstatus_is_transient(status) && - !purple_savedstatus_has_substatuses(status) && - purple_strequal(status->message, message)) - { - return status; - } - } - - return NULL; -} - -gboolean -purple_savedstatus_is_transient(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, TRUE); - - return (saved_status->title == NULL); -} - -const char * -purple_savedstatus_get_title(const PurpleSavedStatus *saved_status) -{ - const char *message; - - g_return_val_if_fail(saved_status != NULL, NULL); - - /* If we have a title then return it */ - if (saved_status->title != NULL) - return saved_status->title; - - /* Otherwise, this is a transient status and we make up a title on the fly */ - message = purple_savedstatus_get_message(saved_status); - - if ((message == NULL) || (*message == '\0')) - { - PurpleStatusPrimitive primitive; - primitive = purple_savedstatus_get_type(saved_status); - return purple_primitive_get_name_from_type(primitive); - } - else - { - char *stripped; - static char buf[64]; - stripped = purple_markup_strip_html(message); - purple_util_chrreplace(stripped, '\n', ' '); - strncpy(buf, stripped, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; - if ((strlen(stripped) + 1) > sizeof(buf)) - { - /* Truncate and ellipsize */ - char *tmp = g_utf8_find_prev_char(buf, &buf[sizeof(buf) - 4]); - strcpy(tmp, "..."); - } - g_free(stripped); - return buf; - } -} - -PurpleStatusPrimitive -purple_savedstatus_get_type(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, PURPLE_STATUS_OFFLINE); - - return saved_status->type; -} - -const char * -purple_savedstatus_get_message(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, NULL); - - return saved_status->message; -} - -time_t -purple_savedstatus_get_creation_time(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, 0); - - return saved_status->creation_time; -} - -gboolean -purple_savedstatus_has_substatuses(const PurpleSavedStatus *saved_status) -{ - g_return_val_if_fail(saved_status != NULL, FALSE); - - return (saved_status->substatuses != NULL); -} - -PurpleSavedStatusSub * -purple_savedstatus_get_substatus(const PurpleSavedStatus *saved_status, - const PurpleAccount *account) -{ - GList *iter; - PurpleSavedStatusSub *substatus; - - g_return_val_if_fail(saved_status != NULL, NULL); - g_return_val_if_fail(account != NULL, NULL); - - for (iter = saved_status->substatuses; iter != NULL; iter = iter->next) - { - substatus = iter->data; - if (substatus->account == account) - return substatus; - } - - return NULL; -} - -const PurpleStatusType * -purple_savedstatus_substatus_get_type(const PurpleSavedStatusSub *substatus) -{ - g_return_val_if_fail(substatus != NULL, NULL); - - return substatus->type; -} - -const char * -purple_savedstatus_substatus_get_message(const PurpleSavedStatusSub *substatus) -{ - g_return_val_if_fail(substatus != NULL, NULL); - - return substatus->message; -} - -void -purple_savedstatus_activate(PurpleSavedStatus *saved_status) -{ - GList *accounts, *node; - PurpleSavedStatus *old = purple_savedstatus_get_current(); - - g_return_if_fail(saved_status != NULL); - - /* Make sure our list of saved statuses remains sorted */ - saved_status->lastused = time(NULL); - saved_status->usage_count++; - saved_statuses = g_list_remove(saved_statuses, saved_status); - saved_statuses = g_list_insert_sorted(saved_statuses, saved_status, saved_statuses_sort_func); - purple_prefs_set_int("/purple/savedstatus/default", - purple_savedstatus_get_creation_time(saved_status)); - - accounts = purple_accounts_get_all_active(); - for (node = accounts; node != NULL; node = node->next) - { - PurpleAccount *account; - - account = node->data; - - purple_savedstatus_activate_for_account(saved_status, account); - } - - g_list_free(accounts); - - if (purple_savedstatus_is_idleaway()) { - purple_savedstatus_set_idleaway(FALSE); - } else { - purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed", - saved_status, old); - } -} - -void -purple_savedstatus_activate_for_account(const PurpleSavedStatus *saved_status, - PurpleAccount *account) -{ - const PurpleStatusType *status_type; - const PurpleSavedStatusSub *substatus; - const char *message = NULL; - - g_return_if_fail(saved_status != NULL); - g_return_if_fail(account != NULL); - - substatus = purple_savedstatus_get_substatus(saved_status, account); - if (substatus != NULL) - { - status_type = substatus->type; - message = substatus->message; - } - else - { - status_type = purple_account_get_status_type_with_primitive(account, saved_status->type); - if (status_type == NULL) - return; - message = saved_status->message; - } - - if ((message != NULL) && - (purple_status_type_get_attr(status_type, "message"))) - { - purple_account_set_status(account, purple_status_type_get_id(status_type), - TRUE, "message", message, NULL); - } - else - { - purple_account_set_status(account, purple_status_type_get_id(status_type), - TRUE, NULL); - } -} - -void * -purple_savedstatuses_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_savedstatuses_init(void) -{ - void *handle = purple_savedstatuses_get_handle(); - - creation_times = g_hash_table_new(g_direct_hash, g_direct_equal); - - /* - * Using 0 as the creation_time is a special case. - * If someone calls purple_savedstatus_get_current() or - * purple_savedstatus_get_idleaway() and either of those functions - * sees a creation_time of 0, then it will create a default - * saved status and return that to the user. - */ - purple_prefs_add_none("/purple/savedstatus"); - purple_prefs_add_int("/purple/savedstatus/default", 0); - purple_prefs_add_int("/purple/savedstatus/startup", 0); - purple_prefs_add_bool("/purple/savedstatus/startup_current_status", TRUE); - purple_prefs_add_int("/purple/savedstatus/idleaway", 0); - purple_prefs_add_bool("/purple/savedstatus/isidleaway", FALSE); - - load_statuses(); - - purple_signal_register(handle, "savedstatus-changed", - purple_marshal_VOID__POINTER_POINTER, NULL, 2, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_register(handle, "savedstatus-added", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_register(handle, "savedstatus-deleted", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_register(handle, "savedstatus-modified", - purple_marshal_VOID__POINTER, NULL, 1, - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_SAVEDSTATUS)); - - purple_signal_connect(purple_accounts_get_handle(), "account-removed", - handle, - PURPLE_CALLBACK(purple_savedstatus_unset_all_substatuses), - NULL); -} - -void -purple_savedstatuses_uninit(void) -{ - gpointer handle = purple_savedstatuses_get_handle(); - - remove_old_transient_statuses(); - - if (save_timer != 0) - { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_statuses(); - } - - while (saved_statuses != NULL) { - PurpleSavedStatus *saved_status = saved_statuses->data; - saved_statuses = g_list_remove(saved_statuses, saved_status); - free_saved_status(saved_status); - } - - g_hash_table_destroy(creation_times); - creation_times = NULL; - - purple_signals_unregister_by_instance(handle); - purple_signals_disconnect_by_handle(handle); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/savedstatuses.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,425 +0,0 @@ -/** - * @file savedstatuses.h Saved Status API - * @ingroup core - * @see @ref savedstatus-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SAVEDSTATUSES_H_ -#define _PURPLE_SAVEDSTATUSES_H_ - -/** - * Saved statuses don't really interact much with the rest of Purple. It - * could really be a plugin. It's just a list of away states. When - * a user chooses one of the saved states, their Purple accounts are set - * to the settings of that state. - * - * In the savedstatus API, there is the concept of a 'transient' - * saved status. A transient saved status is one that is not - * permanent. Purple will removed it automatically if it isn't - * used for a period of time. Transient saved statuses don't - * have titles and they don't show up in the list of saved - * statuses. In fact, if a saved status does not have a title - * then it is transient. If it does have a title, then it is not - * transient. - * - * What good is a transient status, you ask? They can be used to - * keep track of the user's 5 most recently used statuses, for - * example. Basically if they just set a message on the fly, - * we'll cache it for them in case they want to use it again. If - * they don't use it again, we'll just delete it. - */ - -/* - * TODO: Hmm. We should probably just be saving PurplePresences. That's - * something we should look into once the status box gets fleshed - * out more. - */ - -typedef struct _PurpleSavedStatus PurpleSavedStatus; -typedef struct _PurpleSavedStatusSub PurpleSavedStatusSub; - -#include "status.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Saved status subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Create a new saved status. This will add the saved status to the - * list of saved statuses and writes the revised list to status.xml. - * - * @param title The title of the saved status. This must be - * unique. Or, if you want to create a transient - * saved status, then pass in NULL. - * @param type The type of saved status. - * - * @return The newly created saved status, or NULL if the title you - * used was already taken. - */ -PurpleSavedStatus *purple_savedstatus_new(const char *title, - PurpleStatusPrimitive type); - -/** - * Set the title for the given saved status. - * - * @param status The saved status. - * @param title The title of the saved status. - */ -void purple_savedstatus_set_title(PurpleSavedStatus *status, - const char *title); - -/** - * Set the type for the given saved status. - * - * @param status The saved status. - * @param type The type of saved status. - */ -void purple_savedstatus_set_type(PurpleSavedStatus *status, - PurpleStatusPrimitive type); - -/** - * Set the message for the given saved status. - * - * @param status The saved status. - * @param message The message, or NULL if you want to unset the - * message for this status. - */ -void purple_savedstatus_set_message(PurpleSavedStatus *status, - const char *message); - -/** - * Set a substatus for an account in a saved status. - * - * @param status The saved status. - * @param account The account. - * @param type The status type for the account in the staved - * status. - * @param message The message for the account in the substatus. - */ -void purple_savedstatus_set_substatus(PurpleSavedStatus *status, - const PurpleAccount *account, - const PurpleStatusType *type, - const char *message); - -/** - * Unset a substatus for an account in a saved status. This clears - * the previosly set substatus for the PurpleSavedStatus. If this - * saved status is activated then this account will use the default - * status type and message. - * - * @param saved_status The saved status. - * @param account The account. -*/ -void purple_savedstatus_unset_substatus(PurpleSavedStatus *saved_status, - const PurpleAccount *account); - -/** - * Delete a saved status. This removes the saved status from the list - * of saved statuses, and writes the revised list to status.xml. - * - * @param title The title of the saved status. - * - * @return TRUE if the status was successfully deleted. FALSE if the - * status could not be deleted because no saved status exists - * with the given title. - */ -gboolean purple_savedstatus_delete(const char *title); - -/** - * Delete a saved status. This removes the saved status from the list - * of saved statuses, and writes the revised list to status.xml. - * - * @param saved_status the status to delete, the pointer is invalid after - * the call - * - */ -void purple_savedstatus_delete_by_status(PurpleSavedStatus *saved_status); - -/** - * Returns all saved statuses. - * - * @constreturn A list of saved statuses. - */ -GList *purple_savedstatuses_get_all(void); - -/** - * Returns the n most popular saved statuses. "Popularity" is - * determined by when the last time a saved_status was used and - * how many times it has been used. Transient statuses without - * messages are not included in the list. - * - * @param how_many The maximum number of saved statuses - * to return, or '0' to get all saved - * statuses sorted by popularity. - * @return A linked list containing at most how_many - * PurpleSavedStatuses. This list should be - * g_list_free'd by the caller (but the - * PurpleSavedStatuses must not be free'd). - */ -GList *purple_savedstatuses_get_popular(unsigned int how_many); - -/** - * Returns the currently selected saved status. If we are idle - * then this returns purple_savedstatus_get_idleaway(). Otherwise - * it returns purple_savedstatus_get_default(). - * - * @return A pointer to the in-use PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_current(void); - -/** - * Returns the default saved status that is used when our - * accounts are not idle-away. - * - * @return A pointer to the in-use PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_default(void); - -/** - * Returns the saved status that is used when your - * accounts become idle-away. - * - * @return A pointer to the idle-away PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_idleaway(void); - -/** - * Return TRUE if we are currently idle-away. Otherwise - * returns FALSE. - * - * @return TRUE if our accounts have been set to idle-away. - */ -gboolean purple_savedstatus_is_idleaway(void); - -/** - * Set whether accounts in Purple are idle-away or not. - * - * @param idleaway TRUE if accounts should be switched to use the - * idle-away saved status. FALSE if they should - * be switched to use the default status. - */ -void purple_savedstatus_set_idleaway(gboolean idleaway); - -/** - * Returns the status to be used when purple is starting up - * - * @return A pointer to the startup PurpleSavedStatus. - * This function never returns NULL. - */ -PurpleSavedStatus *purple_savedstatus_get_startup(void); - -/** - * Finds a saved status with the specified title. - * - * @param title The name of the saved status. - * - * @return The saved status if found, or NULL. - */ -PurpleSavedStatus *purple_savedstatus_find(const char *title); - -/** - * Finds a saved status with the specified creation time. - * - * @param creation_time The timestamp when the saved - * status was created. - * - * @return The saved status if found, or NULL. - */ -PurpleSavedStatus *purple_savedstatus_find_by_creation_time(time_t creation_time); - -/** - * Finds a saved status with the specified primitive and message. - * - * @param type The PurpleStatusPrimitive for the status you're trying - * to find. - * @param message The message for the status you're trying - * to find. - * - * @return The saved status if found, or NULL. - */ -PurpleSavedStatus *purple_savedstatus_find_transient_by_type_and_message(PurpleStatusPrimitive type, const char *message); - -/** - * Determines if a given saved status is "transient." - * A transient saved status is one that was not - * explicitly added by the user. Transient statuses - * are automatically removed if they are not used - * for a period of time. - * - * A transient saved statuses is automatically - * created by the status box when the user sets himself - * to one of the generic primitive statuses. The reason - * we need to save this status information is so we can - * restore it when Purple restarts. - * - * @param saved_status The saved status. - * - * @return TRUE if the saved status is transient. - */ -gboolean purple_savedstatus_is_transient(const PurpleSavedStatus *saved_status); - -/** - * Return the name of a given saved status. - * - * @param saved_status The saved status. - * - * @return The title. This value may be a static buffer which may - * be overwritten on subsequent calls to this function. If - * you need a reference to the title for prolonged use then - * you should make a copy of it. - */ -const char *purple_savedstatus_get_title(const PurpleSavedStatus *saved_status); - -/** - * Return the type of a given saved status. - * - * @param saved_status The saved status. - * - * @return The name. - */ -PurpleStatusPrimitive purple_savedstatus_get_type(const PurpleSavedStatus *saved_status); - -/** - * Return the default message of a given saved status. - * - * @param saved_status The saved status. - * - * @return The message. This will return NULL if the saved - * status does not have a message. This will - * contain the normal markup that is created by - * Purple's IMHTML (basically HTML markup). - */ -const char *purple_savedstatus_get_message(const PurpleSavedStatus *saved_status); - -/** - * Return the time in seconds-since-the-epoch when this - * saved status was created. Note: For any status created - * by Purple 1.5.0 or older this value will be invalid and - * very small (close to 0). This is because Purple 1.5.0 - * and older did not record the timestamp when the status - * was created. - * - * However, this value is guaranteed to be a unique - * identifier for the given saved status. - * - * @param saved_status The saved status. - * - * @return The timestamp when this saved status was created. - */ -time_t purple_savedstatus_get_creation_time(const PurpleSavedStatus *saved_status); - -/** - * Determine if a given saved status has "substatuses," - * or if it is a simple status (the same for all - * accounts). - * - * @param saved_status The saved status. - * - * @return TRUE if the saved_status has substatuses. - * FALSE otherwise. - */ -gboolean purple_savedstatus_has_substatuses(const PurpleSavedStatus *saved_status); - -/** - * Get the substatus for an account in a saved status. - * - * @param saved_status The saved status. - * @param account The account. - * - * @return The PurpleSavedStatusSub for the account, or NULL if - * the given account does not have a substatus that - * differs from the default status of this PurpleSavedStatus. - */ -PurpleSavedStatusSub *purple_savedstatus_get_substatus( - const PurpleSavedStatus *saved_status, - const PurpleAccount *account); - -/** - * Get the status type of a given substatus. - * - * @param substatus The substatus. - * - * @return The status type. - */ -const PurpleStatusType *purple_savedstatus_substatus_get_type(const PurpleSavedStatusSub *substatus); - -/** - * Get the message of a given substatus. - * - * @param substatus The substatus. - * - * @return The message of the substatus, or NULL if this substatus does - * not have a message. - */ -const char *purple_savedstatus_substatus_get_message(const PurpleSavedStatusSub *substatus); - -/** - * Sets the statuses for all your accounts to those specified - * by the given saved_status. This function calls - * purple_savedstatus_activate_for_account() for all your accounts. - * - * @param saved_status The status you want to set your accounts to. - */ -void purple_savedstatus_activate(PurpleSavedStatus *saved_status); - -/** - * Sets the statuses for a given account to those specified - * by the given saved_status. - * - * @param saved_status The status you want to set your accounts to. - * @param account The account whose statuses you want to change. - */ -void purple_savedstatus_activate_for_account(const PurpleSavedStatus *saved_status, PurpleAccount *account); - -/** - * Get the handle for the status subsystem. - * - * @return the handle to the status subsystem - */ -void *purple_savedstatuses_get_handle(void); - -/** - * Initializes the status subsystem. - */ -void purple_savedstatuses_init(void); - -/** - * Uninitializes the status subsystem. - */ -void purple_savedstatuses_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SAVEDSTATUSES_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,975 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -/* This file is the fullcrap */ - -#include "internal.h" -#include "blist.h" -#include "conversation.h" -#include "debug.h" -#include "log.h" -#include "notify.h" -#include "prefs.h" -#include "privacy.h" -#include "prpl.h" -#include "request.h" -#include "signals.h" -#include "server.h" -#include "status.h" -#include "util.h" - -#define SECS_BEFORE_RESENDING_AUTORESPONSE 600 -#define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" - -unsigned int -serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->send_typing) - return prpl_info->send_typing(gc, name, state); - } - - return 0; -} - -static GSList *last_auto_responses = NULL; -struct last_auto_response { - PurpleConnection *gc; - char name[80]; - time_t sent; -}; - -static gboolean -expire_last_auto_responses(gpointer data) -{ - GSList *tmp, *cur; - struct last_auto_response *lar; - - tmp = last_auto_responses; - - while (tmp) { - cur = tmp; - tmp = tmp->next; - lar = (struct last_auto_response *)cur->data; - - if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) { - last_auto_responses = g_slist_remove(last_auto_responses, lar); - g_free(lar); - } - } - - return FALSE; /* do not run again */ -} - -static struct last_auto_response * -get_last_auto_response(PurpleConnection *gc, const char *name) -{ - GSList *tmp; - struct last_auto_response *lar; - - /* because we're modifying or creating a lar, schedule the - * function to expire them as the pref dictates */ - purple_timeout_add_seconds((SECS_BEFORE_RESENDING_AUTORESPONSE + 1), expire_last_auto_responses, NULL); - - tmp = last_auto_responses; - - while (tmp) { - lar = (struct last_auto_response *)tmp->data; - - if (gc == lar->gc && !strncmp(name, lar->name, sizeof(lar->name))) - return lar; - - tmp = tmp->next; - } - - lar = (struct last_auto_response *)g_new0(struct last_auto_response, 1); - g_snprintf(lar->name, sizeof(lar->name), "%s", name); - lar->gc = gc; - lar->sent = 0; - last_auto_responses = g_slist_prepend(last_auto_responses, lar); - - return lar; -} - -int serv_send_im(PurpleConnection *gc, const char *name, const char *message, - PurpleMessageFlags flags) -{ - PurpleConversation *conv = NULL; - PurpleAccount *account = NULL; - PurplePresence *presence = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - int val = -EINVAL; - const gchar *auto_reply_pref = NULL; - - g_return_val_if_fail(gc != NULL, val); - - prpl = purple_connection_get_prpl(gc); - - g_return_val_if_fail(prpl != NULL, val); - - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - account = purple_connection_get_account(gc); - presence = purple_account_get_presence(account); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); - - if (prpl_info->send_im) - val = prpl_info->send_im(gc, name, message, flags); - - /* - * XXX - If "only auto-reply when away & idle" is set, then shouldn't - * this only reset lar->sent if we're away AND idle? - */ - auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); - if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && - !purple_presence_is_available(presence) && - !purple_strequal(auto_reply_pref, "never")) { - - struct last_auto_response *lar; - lar = get_last_auto_response(gc, name); - lar->sent = time(NULL); - } - - if(conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv))) - purple_conv_im_stop_send_typed_timeout(PURPLE_CONV_IM(conv)); - - return val; -} - -void serv_get_info(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->get_info) - prpl_info->get_info(gc, name); - } -} - -void serv_set_info(PurpleConnection *gc, const char *info) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - PurpleAccount *account; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->set_info) { - account = purple_connection_get_account(gc); - - if (purple_signal_emit_return_1(purple_accounts_get_handle(), - "account-setting-info", account, info)) - return; - - prpl_info->set_info(gc, info); - - purple_signal_emit(purple_accounts_get_handle(), - "account-set-info", account, info); - } - } -} - -/* - * Set buddy's alias on server roster/list - */ -void serv_alias_buddy(PurpleBuddy *b) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (b) { - account = purple_buddy_get_account(b); - - if (account) { - gc = purple_account_get_connection(account); - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->alias_buddy) - prpl_info->alias_buddy(gc, - purple_buddy_get_name(b), - purple_buddy_get_local_buddy_alias(b)); - } - } - } -} - -void -serv_got_alias(PurpleConnection *gc, const char *who, const char *alias) -{ - PurpleAccount *account; - GSList *buddies; - PurpleBuddy *b; - PurpleConversation *conv; - - account = purple_connection_get_account(gc); - buddies = purple_find_buddies(account, who); - - while (buddies != NULL) - { - const char *server_alias; - - b = buddies->data; - buddies = g_slist_delete_link(buddies, buddies); - - server_alias = purple_buddy_get_server_alias(b); - - if (purple_strequal(server_alias, alias)) - continue; - - purple_blist_server_alias_buddy(b, alias); - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, purple_buddy_get_name(b), account); - if (conv != NULL && alias != NULL && !purple_strequal(alias, who)) - { - char *escaped = g_markup_escape_text(who, -1); - char *escaped2 = g_markup_escape_text(alias, -1); - char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), - escaped, escaped2); - - purple_conversation_write(conv, NULL, tmp, - PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LINKIFY, - time(NULL)); - - g_free(tmp); - g_free(escaped2); - g_free(escaped); - } - } -} - -void -purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias) -{ - PurpleAccount *account = NULL; - GSList *buddies = NULL; - PurpleBuddy *b = NULL; - - account = purple_connection_get_account(gc); - buddies = purple_find_buddies(account, who); - - while(buddies != NULL) { - const char *balias; - b = buddies->data; - - buddies = g_slist_delete_link(buddies, buddies); - - balias = purple_buddy_get_local_buddy_alias(b); - if (purple_strequal(balias, alias)) - continue; - - purple_blist_alias_buddy(b, alias); - } -} - - -PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code) -{ - PurplePlugin *prpl; - PurpleAttentionType* attn; - GList *(*get_attention_types)(PurpleAccount *); - - g_return_val_if_fail(account != NULL, NULL); - - prpl = purple_find_prpl(purple_account_get_protocol_id(account)); - - /* Lookup the attention type in the protocol's attention_types list, if any. */ - get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->get_attention_types; - if (get_attention_types) { - GList *attention_types; - - attention_types = get_attention_types(account); - attn = (PurpleAttentionType *)g_list_nth_data(attention_types, type_code); - } else { - attn = NULL; - } - - return attn; -} - -void -serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_send_attention(gc, who, type_code); -} - -void -serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) -{ - purple_prpl_got_attention(gc, who, type_code); -} - - -/* - * Move a buddy from one group to another on server. - * - * Note: For now we'll not deal with changing gc's at the same time, but - * it should be possible. Probably needs to be done, someday. Although, - * the UI for that would be difficult, because groups are Purple-wide. - */ -void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng) -{ - PurpleAccount *account; - PurpleConnection *gc; - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - g_return_if_fail(b != NULL); - g_return_if_fail(og != NULL); - g_return_if_fail(ng != NULL); - - account = purple_buddy_get_account(b); - gc = purple_account_get_connection(account); - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->group_buddy) - prpl_info->group_buddy(gc, purple_buddy_get_name(b), - purple_group_get_name(og), - purple_group_get_name(ng)); - } -} - -void serv_add_permit(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->add_permit) - prpl_info->add_permit(gc, name); - } -} - -void serv_add_deny(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->add_deny) - prpl_info->add_deny(gc, name); - } -} - -void serv_rem_permit(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->rem_permit) - prpl_info->rem_permit(gc, name); - } -} - -void serv_rem_deny(PurpleConnection *gc, const char *name) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->rem_deny) - prpl_info->rem_deny(gc, name); - } -} - -void serv_set_permit_deny(PurpleConnection *gc) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - /* - * this is called when either you import a buddy list, and make lots - * of changes that way, or when the user toggles the permit/deny mode - * in the prefs. In either case you should probably be resetting and - * resending the permit/deny info when you get this. - */ - if (prpl_info->set_permit_deny) - prpl_info->set_permit_deny(gc); - } -} - -void serv_join_chat(PurpleConnection *gc, GHashTable *data) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->join_chat) - prpl_info->join_chat(gc, data); - } -} - - -void serv_reject_chat(PurpleConnection *gc, GHashTable *data) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->reject_chat) - prpl_info->reject_chat(gc, data); - } -} - -void serv_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) -{ - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - PurpleConversation *conv; - char *buffy = message && *message ? g_strdup(message) : NULL; - - conv = purple_find_chat(gc, id); - - if(conv == NULL) - return; - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(prpl) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user", - conv, name, &buffy); - - if (prpl_info && prpl_info->chat_invite) - prpl_info->chat_invite(gc, id, buffy, name); - - purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user", - conv, name, buffy); - - g_free(buffy); -} - -/* Ya know, nothing uses this except purple_conversation_destroy(), - * I think I'll just merge it into that later... - * Then again, something might want to use this, from outside prpl-land - * to leave a chat without destroying the conversation. - */ -void serv_chat_leave(PurpleConnection *gc, int id) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_leave) - prpl_info->chat_leave(gc, id); -} - -void serv_chat_whisper(PurpleConnection *gc, int id, const char *who, const char *message) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_whisper) - prpl_info->chat_whisper(gc, id, who, message); - } -} - -int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->chat_send) - return prpl_info->chat_send(gc, id, message, flags); - - return -EINVAL; -} - -/* - * woo. i'm actually going to comment this function. isn't that fun. make - * sure to follow along, kids - */ -void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags, time_t mtime) -{ - PurpleAccount *account; - PurpleConversation *conv; - char *message, *name; - char *angel, *buffy; - int plugin_return; - - g_return_if_fail(msg != NULL); - - account = purple_connection_get_account(gc); - - /* - * XXX: Should we be setting this here, or relying on prpls to set it? - */ - flags |= PURPLE_MESSAGE_RECV; - - if (!purple_privacy_check(account, who)) { - purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", - account, who, msg, flags, (unsigned int)mtime); - return; - } - - /* - * We should update the conversation window buttons and menu, - * if it exists. - */ - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account); - - /* - * Make copies of the message and the sender in case plugins want - * to free these strings and replace them with a modifed version. - */ - buffy = g_strdup(msg); - angel = g_strdup(who); - - plugin_return = GPOINTER_TO_INT( - purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-im-msg", gc->account, - &angel, &buffy, conv, &flags)); - - if (!buffy || !angel || plugin_return) { - g_free(buffy); - g_free(angel); - return; - } - - name = angel; - message = buffy; - - purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account, - name, message, conv, flags); - - /* search for conversation again in case it was created by received-im-msg handler */ - if (conv == NULL) - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - - if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); - - purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); - g_free(message); - - /* - * Don't autorespond if: - * - * - it's not supported on this connection - * - we are available - * - or it's disabled - * - or we're not idle and the 'only auto respond if idle' pref - * is set - */ - if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) - { - PurplePresence *presence; - PurpleStatus *status; - PurpleStatusType *status_type; - PurpleStatusPrimitive primitive; - const gchar *auto_reply_pref; - const char *away_msg = NULL; - gboolean mobile = FALSE; - - auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); - - presence = purple_account_get_presence(account); - status = purple_presence_get_active_status(presence); - status_type = purple_status_get_type(status); - primitive = purple_status_type_get_primitive(status_type); - mobile = purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOBILE); - if ((primitive == PURPLE_STATUS_AVAILABLE) || - (primitive == PURPLE_STATUS_INVISIBLE) || - mobile || - purple_strequal(auto_reply_pref, "never") || - (!purple_presence_is_idle(presence) && purple_strequal(auto_reply_pref, "awayidle"))) - { - g_free(name); - return; - } - - away_msg = purple_value_get_string( - purple_status_get_attr_value(status, "message")); - - if ((away_msg != NULL) && (*away_msg != '\0')) { - struct last_auto_response *lar; - time_t now = time(NULL); - - /* - * This used to be based on the conversation window. But um, if - * you went away, and someone sent you a message and got your - * auto-response, and then you closed the window, and then they - * sent you another one, they'd get the auto-response back too - * soon. Besides that, we need to keep track of this even if we've - * got a queue. So the rest of this block is just the auto-response, - * if necessary. - */ - lar = get_last_auto_response(gc, name); - if ((now - lar->sent) >= SECS_BEFORE_RESENDING_AUTORESPONSE) - { - /* - * We don't want to send an autoresponse in response to the other user's - * autoresponse. We do, however, not want to then send one in response to the - * _next_ message, so we still set lar->sent to now. - */ - lar->sent = now; - - if (!(flags & PURPLE_MESSAGE_AUTO_RESP)) - { - serv_send_im(gc, name, away_msg, PURPLE_MESSAGE_AUTO_RESP); - - purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, away_msg, - PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP, - mtime); - } - } - } - } - - g_free(name); -} - -void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, - PurpleTypingState state) { - PurpleConversation *conv; - PurpleConvIm *im = NULL; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - if (conv != NULL) { - im = PURPLE_CONV_IM(conv); - - purple_conv_im_set_typing_state(im, state); - } else { - switch (state) - { - case PURPLE_TYPING: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing", gc->account, name); - break; - case PURPLE_TYPED: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typed", gc->account, name); - break; - case PURPLE_NOT_TYPING: - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); - break; - } - } - - if (conv != NULL && timeout > 0) - purple_conv_im_start_typing_timeout(im, timeout); -} - -void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { - - PurpleConversation *conv; - PurpleConvIm *im; - - conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); - if (conv != NULL) - { - im = PURPLE_CONV_IM(conv); - - if (im->typing_state == PURPLE_NOT_TYPING) - return; - - purple_conv_im_stop_typing_timeout(im); - purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); - } - else - { - purple_signal_emit(purple_conversations_get_handle(), - "buddy-typing-stopped", gc->account, name); - } -} - -struct chat_invite_data { - PurpleConnection *gc; - GHashTable *components; -}; - -static void chat_invite_data_free(struct chat_invite_data *cid) -{ - if (cid->components) - g_hash_table_destroy(cid->components); - g_free(cid); -} - - -static void chat_invite_reject(struct chat_invite_data *cid) -{ - serv_reject_chat(cid->gc, cid->components); - chat_invite_data_free(cid); -} - - -static void chat_invite_accept(struct chat_invite_data *cid) -{ - serv_join_chat(cid->gc, cid->components); - chat_invite_data_free(cid); -} - - - -void serv_got_chat_invite(PurpleConnection *gc, const char *name, - const char *who, const char *message, GHashTable *data) -{ - PurpleAccount *account; - char buf2[BUF_LONG]; - struct chat_invite_data *cid; - int plugin_return; - - g_return_if_fail(name != NULL); - g_return_if_fail(who != NULL); - - account = purple_connection_get_account(gc); - if (!purple_privacy_check(account, who)) { - purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked", - account, who, name, message, data); - return; - } - - cid = g_new0(struct chat_invite_data, 1); - - plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( - purple_conversations_get_handle(), - "chat-invited", account, who, name, message, data)); - - cid->gc = gc; - cid->components = data; - - if (plugin_return == 0) - { - if (message != NULL) - { - g_snprintf(buf2, sizeof(buf2), - _("%s has invited %s to the chat room %s:\n%s"), - who, purple_account_get_username(account), name, message); - } - else - g_snprintf(buf2, sizeof(buf2), - _("%s has invited %s to the chat room %s\n"), - who, purple_account_get_username(account), name); - - - purple_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2, - PURPLE_DEFAULT_ACTION_NONE, account, who, NULL, - cid, G_CALLBACK(chat_invite_accept), - G_CALLBACK(chat_invite_reject)); - } - else if (plugin_return > 0) - chat_invite_accept(cid); - else - chat_invite_reject(cid); -} - -PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, - int id, const char *name) -{ - PurpleConversation *conv; - PurpleConvChat *chat; - PurpleAccount *account; - - account = purple_connection_get_account(gc); - - g_return_val_if_fail(account != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - - conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); - g_return_val_if_fail(conv != NULL, NULL); - - chat = PURPLE_CONV_CHAT(conv); - - if (!g_slist_find(gc->buddy_chats, conv)) - gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); - - purple_conv_chat_set_id(chat, id); - - purple_signal_emit(purple_conversations_get_handle(), "chat-joined", conv); - - return conv; -} - -void serv_got_chat_left(PurpleConnection *g, int id) -{ - GSList *bcs; - PurpleConversation *conv = NULL; - PurpleConvChat *chat = NULL; - - for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { - conv = (PurpleConversation *)bcs->data; - - chat = PURPLE_CONV_CHAT(conv); - - if (purple_conv_chat_get_id(chat) == id) - break; - - conv = NULL; - } - - if (!conv) - return; - - purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n", - purple_conversation_get_name(conv)); - - g->buddy_chats = g_slist_remove(g->buddy_chats, conv); - - purple_conv_chat_left(PURPLE_CONV_CHAT(conv)); - - purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv); -} - -void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data) -{ - purple_signal_emit(purple_conversations_get_handle(), "chat-join-failed", - gc, data); -} - -void serv_got_chat_in(PurpleConnection *g, int id, const char *who, - PurpleMessageFlags flags, const char *message, time_t mtime) -{ - GSList *bcs; - PurpleConversation *conv = NULL; - PurpleConvChat *chat = NULL; - char *buffy, *angel; - int plugin_return; - - g_return_if_fail(who != NULL); - g_return_if_fail(message != NULL); - - for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { - conv = (PurpleConversation *)bcs->data; - - chat = PURPLE_CONV_CHAT(conv); - - if (purple_conv_chat_get_id(chat) == id) - break; - - conv = NULL; - } - - if (!conv) - return; - - /* Did I send the message? */ - if (purple_strequal(purple_conv_chat_get_nick(chat), - purple_normalize(purple_conversation_get_account(conv), who))) { - flags |= PURPLE_MESSAGE_SEND; - flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */ - } else { - flags |= PURPLE_MESSAGE_RECV; - } - - /* - * Make copies of the message and the sender in case plugins want - * to free these strings and replace them with a modifed version. - */ - buffy = g_strdup(message); - angel = g_strdup(who); - - plugin_return = GPOINTER_TO_INT( - purple_signal_emit_return_1(purple_conversations_get_handle(), - "receiving-chat-msg", g->account, - &angel, &buffy, conv, &flags)); - - if (!buffy || !angel || plugin_return) { - g_free(buffy); - g_free(angel); - return; - } - - who = angel; - message = buffy; - - purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account, - who, message, conv, flags); - - purple_conv_chat_write(chat, who, message, flags, mtime); - - g_free(angel); - g_free(buffy); -} - -void serv_send_file(PurpleConnection *gc, const char *who, const char *file) -{ - PurplePlugin *prpl; - PurplePluginProtocolInfo *prpl_info; - - if (gc) { - prpl = purple_connection_get_prpl(gc); - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info->send_file && - (!prpl_info->can_receive_file - || prpl_info->can_receive_file(gc, who))) - prpl_info->send_file(gc, who, file); - } -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/server.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -/** - * @file server.h Server API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SERVER_H_ -#define _PURPLE_SERVER_H_ - -#include "account.h" -#include "conversation.h" -#include "prpl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Send a typing message to a given user over a given connection. - * - * TODO: Could probably move this into the conversation API. - * - * @param gc The connection over which to send the typing notification. - * @param name The user to send the typing notification to. - * @param state One of PURPLE_TYPING, PURPLE_TYPED, or PURPLE_NOT_TYPING. - * @return A quiet-period, specified in seconds, where Purple will not - * send any additional typing notification messages. Most - * protocols should return 0, which means that no additional - * PURPLE_TYPING messages need to be sent. If this is 5, for - * example, then Purple will wait five seconds, and if the Purple - * user is still typing then Purple will send another PURPLE_TYPING - * message. - */ -unsigned int serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); - -void serv_move_buddy(PurpleBuddy *, PurpleGroup *, PurpleGroup *); -int serv_send_im(PurpleConnection *, const char *, const char *, PurpleMessageFlags flags); - -/** Get information about an account's attention commands, from the prpl. - * - * @return The attention command numbered 'code' from the prpl's attention_types, or NULL. - */ -PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code); - -/** Send an attention request message. - * - * @deprecated Use purple_prpl_send_attention() instead. - * - * @param gc The connection to send the message on. - * @param who Whose attention to request. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. 0 if prpl only defines one - * (for example, Yahoo and MSN), but some protocols define more (MySpaceIM). - * - * Note that you can't send arbitrary PurpleAttentionType's, because there is - * only a fixed set of attention commands. - */ -void serv_send_attention(PurpleConnection *gc, const char *who, guint type_code); - -/** Process an incoming attention message. - * - * @deprecated Use purple_prpl_got_attention() instead. - * - * @param gc The connection that received the attention message. - * @param who Who requested your attention. - * @param type_code An index into the prpl's attention_types list determining the type - * of the attention request command to send. - */ -void serv_got_attention(PurpleConnection *gc, const char *who, guint type_code); - -void serv_get_info(PurpleConnection *, const char *); -void serv_set_info(PurpleConnection *, const char *); - -void serv_add_permit(PurpleConnection *, const char *); -void serv_add_deny(PurpleConnection *, const char *); -void serv_rem_permit(PurpleConnection *, const char *); -void serv_rem_deny(PurpleConnection *, const char *); -void serv_set_permit_deny(PurpleConnection *); -void serv_chat_invite(PurpleConnection *, int, const char *, const char *); -void serv_chat_leave(PurpleConnection *, int); -void serv_chat_whisper(PurpleConnection *, int, const char *, const char *); -int serv_chat_send(PurpleConnection *, int, const char *, PurpleMessageFlags flags); -void serv_alias_buddy(PurpleBuddy *); -void serv_got_alias(PurpleConnection *gc, const char *who, const char *alias); - -/** - * A protocol plugin should call this when it retrieves a private alias from - * the server. Private aliases are the aliases the user sets, while public - * aliases are the aliases or display names that buddies set for themselves. - * - * @param gc The connection on which the alias was received. - * @param who The name of the buddy whose alias was received. - * @param alias The alias that was received. - */ -void purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias); - - -/** - * Receive a typing message from a remote user. Either PURPLE_TYPING - * or PURPLE_TYPED. If the user has stopped typing then use - * serv_got_typing_stopped instead. - * - * TODO: Could probably move this into the conversation API. - * - * @param gc The connection on which the typing message was received. - * @param name The name of the remote user. - * @param timeout If this is a number greater than 0, then - * Purple will wait this number of seconds and then - * set this buddy to the PURPLE_NOT_TYPING state. This - * is used by protocols that send repeated typing messages - * while the user is composing the message. - * @param state The typing state received - */ -void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, - PurpleTypingState state); - -/** - * TODO: Could probably move this into the conversation API. - */ -void serv_got_typing_stopped(PurpleConnection *gc, const char *name); - -void serv_got_im(PurpleConnection *gc, const char *who, const char *msg, - PurpleMessageFlags flags, time_t mtime); - -/** - * @param data The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void serv_join_chat(PurpleConnection *, GHashTable *data); - -/** - * @param data The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void serv_reject_chat(PurpleConnection *, GHashTable *data); - -/** - * Called by a prpl when an account is invited into a chat. - * - * @param gc The connection on which the invite arrived. - * @param name The name of the chat you're being invited to. - * @param who The username of the person inviting the account. - * @param message The optional invite message. - * @param data The components necessary if you want to call serv_join_chat(). - * The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void serv_got_chat_invite(PurpleConnection *gc, const char *name, - const char *who, const char *message, - GHashTable *data); - -/** - * Called by a prpl when an account has joined a chat. - * - * @param gc The connection on which the chat was joined. - * @param id The id of the chat, assigned by the prpl. - * @param name The name of the chat. - * @return The resulting conversation - */ -PurpleConversation *serv_got_joined_chat(PurpleConnection *gc, - int id, const char *name); -/** - * Called by a prpl when an attempt to join a chat via serv_join_chat() - * fails. - * - * @param gc The connection on which chat joining failed - * @param data The components passed to serv_join_chat() originally. - * The hash function should be g_str_hash() and the equal - * function should be g_str_equal(). - */ -void purple_serv_got_join_chat_failed(PurpleConnection *gc, GHashTable *data); - -/** - * Called by a prpl when an account has left a chat. - * - * @param g The connection on which the chat was left. - * @param id The id of the chat, as assigned by the prpl. - */ -void serv_got_chat_left(PurpleConnection *g, int id); - -/** - * Called by a prpl when a message has been received in a chat. - * - * @param g The connection on which the message was received. - * @param id The id of the chat, as assigned by the prpl. - * @param who The name of the user who sent the message. - * @param flags The flags of the message. - * @param message The message received in the chat. - * @param mtime The time when the message was received. - */ -void serv_got_chat_in(PurpleConnection *g, int id, const char *who, - PurpleMessageFlags flags, const char *message, time_t mtime); -void serv_send_file(PurpleConnection *gc, const char *who, const char *file); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SERVER_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1085 +0,0 @@ -/** - * @file signals.c Signal API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "dbus-maybe.h" -#include "debug.h" -#include "signals.h" -#include "value.h" - -/* must include this to use G_VA_COPY */ -#include - -typedef struct -{ - void *instance; - - GHashTable *signals; - size_t signal_count; - - gulong next_signal_id; - -} PurpleInstanceData; - -typedef struct -{ - gulong id; - - PurpleSignalMarshalFunc marshal; - - int num_values; - PurpleValue **values; - PurpleValue *ret_value; - - GList *handlers; - size_t handler_count; - - gulong next_handler_id; -} PurpleSignalData; - -typedef struct -{ - gulong id; - PurpleCallback cb; - void *handle; - void *data; - gboolean use_vargs; - int priority; - -} PurpleSignalHandlerData; - -static GHashTable *instance_table = NULL; - -static void -destroy_instance_data(PurpleInstanceData *instance_data) -{ - g_hash_table_destroy(instance_data->signals); - - g_free(instance_data); -} - -static void -destroy_signal_data(PurpleSignalData *signal_data) -{ - g_list_foreach(signal_data->handlers, (GFunc)g_free, NULL); - g_list_free(signal_data->handlers); - - if (signal_data->values != NULL) - { - int i; - - for (i = 0; i < signal_data->num_values; i++) - purple_value_destroy((PurpleValue *)signal_data->values[i]); - - g_free(signal_data->values); - } - - if (signal_data->ret_value != NULL) - purple_value_destroy(signal_data->ret_value); - g_free(signal_data); -} - -gulong -purple_signal_register(void *instance, const char *signal, - PurpleSignalMarshalFunc marshal, - PurpleValue *ret_value, int num_values, ...) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - va_list args; - - g_return_val_if_fail(instance != NULL, 0); - g_return_val_if_fail(signal != NULL, 0); - g_return_val_if_fail(marshal != NULL, 0); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - if (instance_data == NULL) - { - instance_data = g_new0(PurpleInstanceData, 1); - - instance_data->instance = instance; - instance_data->next_signal_id = 1; - - instance_data->signals = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, - (GDestroyNotify)destroy_signal_data); - - g_hash_table_insert(instance_table, instance, instance_data); - } - - signal_data = g_new0(PurpleSignalData, 1); - signal_data->id = instance_data->next_signal_id; - signal_data->marshal = marshal; - signal_data->next_handler_id = 1; - signal_data->ret_value = ret_value; - signal_data->num_values = num_values; - - if (num_values > 0) - { - int i; - - signal_data->values = g_new0(PurpleValue *, num_values); - - va_start(args, num_values); - - for (i = 0; i < num_values; i++) - signal_data->values[i] = va_arg(args, PurpleValue *); - - va_end(args); - } - - g_hash_table_insert(instance_data->signals, - g_strdup(signal), signal_data); - - instance_data->next_signal_id++; - instance_data->signal_count++; - - return signal_data->id; -} - -void -purple_signal_unregister(void *instance, const char *signal) -{ - PurpleInstanceData *instance_data; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - g_hash_table_remove(instance_data->signals, signal); - - instance_data->signal_count--; - - if (instance_data->signal_count == 0) - { - /* Unregister the instance. */ - g_hash_table_remove(instance_table, instance); - } -} - -void -purple_signals_unregister_by_instance(void *instance) -{ - gboolean found; - - g_return_if_fail(instance != NULL); - - found = g_hash_table_remove(instance_table, instance); - - /* - * Makes things easier (more annoying?) for developers who don't have - * things registering and unregistering in the right order :) - */ - g_return_if_fail(found); -} - -void -purple_signal_get_values(void *instance, const char *signal, - PurpleValue **ret_value, - int *num_values, PurpleValue ***values) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - g_return_if_fail(num_values != NULL); - g_return_if_fail(values != NULL); - - /* Get the instance data */ - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - /* Get the signal data */ - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - g_return_if_fail(signal_data != NULL); - - *num_values = signal_data->num_values; - *values = signal_data->values; - - if (ret_value != NULL) - *ret_value = signal_data->ret_value; -} - -static gint handler_priority(void * a, void * b) { - PurpleSignalHandlerData *ah = (PurpleSignalHandlerData*)a; - PurpleSignalHandlerData *bh = (PurpleSignalHandlerData*)b; - if (ah->priority > bh->priority) return 1; - if (ah->priority < bh->priority) return -1; - return 0; -} - -static gulong -signal_connect_common(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data, int priority, gboolean use_vargs) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - - g_return_val_if_fail(instance != NULL, 0); - g_return_val_if_fail(signal != NULL, 0); - g_return_val_if_fail(handle != NULL, 0); - g_return_val_if_fail(func != NULL, 0); - - /* Get the instance data */ - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - if (instance_data == NULL) - { - purple_debug_warning("signals", "Something tried to register a callback " - "for the '%s' signal, but we do not have any signals " - "registered with the given handle\n", signal); - g_return_val_if_reached(0); - } - - /* Get the signal data */ - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return 0; - } - - /* Create the signal handler data */ - handler_data = g_new0(PurpleSignalHandlerData, 1); - handler_data->id = signal_data->next_handler_id; - handler_data->cb = func; - handler_data->handle = handle; - handler_data->data = data; - handler_data->use_vargs = use_vargs; - handler_data->priority = priority; - - signal_data->handlers = g_list_insert_sorted(signal_data->handlers, handler_data, (GCompareFunc)handler_priority); - signal_data->handler_count++; - signal_data->next_handler_id++; - - return handler_data->id; -} - -gulong -purple_signal_connect_priority(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data, int priority) -{ - return signal_connect_common(instance, signal, handle, func, data, priority, FALSE); -} - -gulong -purple_signal_connect(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data) -{ - return signal_connect_common(instance, signal, handle, func, data, PURPLE_SIGNAL_PRIORITY_DEFAULT, FALSE); -} - -gulong -purple_signal_connect_priority_vargs(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data, int priority) -{ - return signal_connect_common(instance, signal, handle, func, data, priority, TRUE); -} - -gulong -purple_signal_connect_vargs(void *instance, const char *signal, void *handle, - PurpleCallback func, void *data) -{ - return signal_connect_common(instance, signal, handle, func, data, PURPLE_SIGNAL_PRIORITY_DEFAULT, TRUE); -} - -void -purple_signal_disconnect(void *instance, const char *signal, - void *handle, PurpleCallback func) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - GList *l; - gboolean found = FALSE; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - g_return_if_fail(handle != NULL); - g_return_if_fail(func != NULL); - - /* Get the instance data */ - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - /* Get the signal data */ - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return; - } - - /* Find the handler data. */ - for (l = signal_data->handlers; l != NULL; l = l->next) - { - handler_data = (PurpleSignalHandlerData *)l->data; - - if (handler_data->handle == handle && handler_data->cb == func) - { - g_free(handler_data); - - signal_data->handlers = g_list_delete_link(signal_data->handlers, - l); - signal_data->handler_count--; - - found = TRUE; - - break; - } - } - - /* See note somewhere about this actually helping developers.. */ - g_return_if_fail(found); -} - -/* - * TODO: Make this all more efficient by storing a list of handlers, keyed - * to a handle. - */ -static void -disconnect_handle_from_signals(const char *signal, - PurpleSignalData *signal_data, void *handle) -{ - GList *l, *l_next; - PurpleSignalHandlerData *handler_data; - - for (l = signal_data->handlers; l != NULL; l = l_next) - { - handler_data = (PurpleSignalHandlerData *)l->data; - l_next = l->next; - - if (handler_data->handle == handle) - { - g_free(handler_data); - - signal_data->handler_count--; - signal_data->handlers = g_list_delete_link(signal_data->handlers, - l); - } - } -} - -static void -disconnect_handle_from_instance(void *instance, - PurpleInstanceData *instance_data, - void *handle) -{ - g_hash_table_foreach(instance_data->signals, - (GHFunc)disconnect_handle_from_signals, handle); -} - -void -purple_signals_disconnect_by_handle(void *handle) -{ - g_return_if_fail(handle != NULL); - - g_hash_table_foreach(instance_table, - (GHFunc)disconnect_handle_from_instance, handle); -} - -void -purple_signal_emit(void *instance, const char *signal, ...) -{ - va_list args; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - - va_start(args, signal); - purple_signal_emit_vargs(instance, signal, args); - va_end(args); -} - -void -purple_signal_emit_vargs(void *instance, const char *signal, va_list args) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - GList *l, *l_next; - va_list tmp; - - g_return_if_fail(instance != NULL); - g_return_if_fail(signal != NULL); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_if_fail(instance_data != NULL); - - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return; - } - - for (l = signal_data->handlers; l != NULL; l = l_next) - { - l_next = l->next; - - handler_data = (PurpleSignalHandlerData *)l->data; - - /* This is necessary because a va_list may only be - * evaluated once */ - G_VA_COPY(tmp, args); - - if (handler_data->use_vargs) - { - ((void (*)(va_list, void *))handler_data->cb)(tmp, - handler_data->data); - } - else - { - signal_data->marshal(handler_data->cb, tmp, - handler_data->data, NULL); - } - - va_end(tmp); - } - -#ifdef HAVE_DBUS - purple_dbus_signal_emit_purple(signal, signal_data->num_values, - signal_data->values, args); -#endif /* HAVE_DBUS */ - -} - -void * -purple_signal_emit_return_1(void *instance, const char *signal, ...) -{ - void *ret_val; - va_list args; - - g_return_val_if_fail(instance != NULL, NULL); - g_return_val_if_fail(signal != NULL, NULL); - - va_start(args, signal); - ret_val = purple_signal_emit_vargs_return_1(instance, signal, args); - va_end(args); - - return ret_val; -} - -void * -purple_signal_emit_vargs_return_1(void *instance, const char *signal, - va_list args) -{ - PurpleInstanceData *instance_data; - PurpleSignalData *signal_data; - PurpleSignalHandlerData *handler_data; - GList *l, *l_next; - va_list tmp; - - g_return_val_if_fail(instance != NULL, NULL); - g_return_val_if_fail(signal != NULL, NULL); - - instance_data = - (PurpleInstanceData *)g_hash_table_lookup(instance_table, instance); - - g_return_val_if_fail(instance_data != NULL, NULL); - - signal_data = - (PurpleSignalData *)g_hash_table_lookup(instance_data->signals, signal); - - if (signal_data == NULL) - { - purple_debug(PURPLE_DEBUG_ERROR, "signals", - "Signal data for %s not found!\n", signal); - return 0; - } - -#ifdef HAVE_DBUS - G_VA_COPY(tmp, args); - purple_dbus_signal_emit_purple(signal, signal_data->num_values, - signal_data->values, tmp); - va_end(tmp); -#endif /* HAVE_DBUS */ - - for (l = signal_data->handlers; l != NULL; l = l_next) - { - void *ret_val = NULL; - - l_next = l->next; - - handler_data = (PurpleSignalHandlerData *)l->data; - - G_VA_COPY(tmp, args); - if (handler_data->use_vargs) - { - ret_val = ((void *(*)(va_list, void *))handler_data->cb)( - tmp, handler_data->data); - } - else - { - signal_data->marshal(handler_data->cb, tmp, - handler_data->data, &ret_val); - } - va_end(tmp); - - if (ret_val != NULL) - return ret_val; - } - - return NULL; -} - -void -purple_signals_init() -{ - g_return_if_fail(instance_table == NULL); - - instance_table = - g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify)destroy_instance_data); -} - -void -purple_signals_uninit() -{ - g_return_if_fail(instance_table != NULL); - - g_hash_table_destroy(instance_table); - instance_table = NULL; -} - -/************************************************************************** - * Marshallers - **************************************************************************/ -void -purple_marshal_VOID(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - ((void (*)(void *))cb)(data); -} - -void -purple_marshal_VOID__INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint arg1 = va_arg(args, gint); - - ((void (*)(gint, void *))cb)(arg1, data); -} - -void -purple_marshal_VOID__INT_INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint arg1 = va_arg(args, gint); - gint arg2 = va_arg(args, gint); - - ((void (*)(gint, gint, void *))cb)(arg1, arg2, data); -} - -void -purple_marshal_VOID__POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - - ((void (*)(void *, void *))cb)(arg1, data); -} - -void -purple_marshal_VOID__POINTER_UINT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - guint arg2 = va_arg(args, guint); - - ((void (*)(void *, guint, void *))cb)(arg1, arg2, data); -} - -void purple_marshal_VOID__POINTER_INT_INT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - gint arg3 = va_arg(args, gint); - - ((void (*)(void *, gint, gint, void *))cb)(arg1, arg2, arg3, data); -} - -void purple_marshal_VOID__POINTER_INT_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - void *arg3 = va_arg(args, void *); - - ((void (*)(void *, gint, void *, void *))cb)(arg1, arg2, arg3, data); -} - -void -purple_marshal_VOID__POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ((void (*)(void *, void *, void *))cb)(arg1, arg2, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_UINT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - guint arg3 = va_arg(args, guint); - - ((void (*)(void *, void *, guint, void *))cb)(arg1, arg2, arg3, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_UINT_UINT(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - guint arg3 = va_arg(args, guint); - guint arg4 = va_arg(args, guint); - - ((void (*)(void *, void *, guint, guint, void *))cb)(arg1, arg2, arg3, arg4, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - - ((void (*)(void *, void *, void *, void *))cb)(arg1, arg2, arg3, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - - ((void (*)(void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - - ((void (*)(void *, void *, void *, void *, void *, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - guint arg4 = va_arg(args, guint); - - ((void (*)(void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - guint arg5 = va_arg(args, guint); - - ((void (*)(void *, void *, void *, void *, guint, void *))cb)(arg1, arg2, arg3, arg4, arg5, data); -} - -void -purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - guint arg4 = va_arg(args, guint); - guint arg5 = va_arg(args, guint); - - ((void (*)(void *, void *, void *, guint, guint, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); -} - -void -purple_marshal_INT__INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint ret_val; - gint arg1 = va_arg(args, gint); - - ret_val = ((gint (*)(gint, void *))cb)(arg1, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_INT__INT_INT(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint ret_val; - gint arg1 = va_arg(args, gint); - gint arg2 = va_arg(args, gint); - - ret_val = ((gint (*)(gint, gint, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_INT__POINTER_POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gint ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ret_val = ((gint (*)(void *, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gint ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - - ret_val = - ((gint (*)(void *, void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *))cb)(arg1, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER(PurpleCallback cb, va_list args, - void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *, void *, void *))cb)(arg1, arg2, - arg3, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - guint arg3 = va_arg(args, guint); - - ret_val = ((gboolean (*)(void *, void *, guint, void *))cb)( - arg1, arg2, arg3, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - guint arg4 = va_arg(args, guint); - - ret_val = ((gboolean (*)(void *, void *, void *, guint, void *))cb)( - arg1, arg2, arg3, arg4, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb, - va_list args, - void *data, - void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - - ret_val = ((gboolean (*)(void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - - ret_val = - ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - guint arg5 = va_arg(args, guint); - - ret_val = - ((gboolean (*)(void *, void *, void *, void *, guint, void *))cb)( - arg1, arg2, arg3, arg4, arg5, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val) -{ - gboolean ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - void *arg3 = va_arg(args, void *); - void *arg4 = va_arg(args, void *); - void *arg5 = va_arg(args, void *); - void *arg6 = va_arg(args, void *); - - ret_val = - ((gboolean (*)(void *, void *, void *, void *, void *, void *, void *))cb)( - arg1, arg2, arg3, arg4, arg5, arg6, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_BOOLEAN__INT_POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gboolean ret_val; - gint arg1 = va_arg(args, gint); - void *arg2 = va_arg(args, void *); - - ret_val = ((gboolean (*)(gint, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = GINT_TO_POINTER(ret_val); -} - -void -purple_marshal_POINTER__POINTER_INT( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - - ret_val = ((gpointer(*)(void *, gint, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_INT64( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint64 arg2 = va_arg(args, gint64); - - ret_val = ((gpointer(*)(void *, gint64, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_INT_BOOLEAN( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint arg2 = va_arg(args, gint); - gboolean arg3 = va_arg(args, gboolean); - - ret_val = ((gpointer(*)(void *, gint, gboolean, void *))cb)(arg1, arg2, arg3, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_INT64_BOOLEAN( - PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - gint64 arg2 = va_arg(args, gint64); - gboolean arg3 = va_arg(args, gboolean); - - ret_val = ((gpointer(*)(void *, gint64, gboolean, void *))cb)(arg1, arg2, arg3, data); - - if (return_val != NULL) - *return_val = ret_val; -} - -void -purple_marshal_POINTER__POINTER_POINTER(PurpleCallback cb, va_list args, void *data, - void **return_val) -{ - gpointer ret_val; - void *arg1 = va_arg(args, void *); - void *arg2 = va_arg(args, void *); - - ret_val = ((gpointer (*)(void *, void *, void *))cb)(arg1, arg2, data); - - if (return_val != NULL) - *return_val = ret_val; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/signals.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,374 +0,0 @@ -/** - * @file signals.h Signal API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SIGNALS_H_ -#define _PURPLE_SIGNALS_H_ - -#include -#include "value.h" - -#define PURPLE_CALLBACK(func) ((PurpleCallback)func) - -typedef void (*PurpleCallback)(void); -typedef void (*PurpleSignalMarshalFunc)(PurpleCallback cb, va_list args, - void *data, void **return_val); - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Signal API */ -/**************************************************************************/ -/*@{*/ - -/** The priority of a signal connected using purple_signal_connect(). - * - * @see purple_signal_connect_priority() - */ -#define PURPLE_SIGNAL_PRIORITY_DEFAULT 0 -/** The largest signal priority; signals with this priority will be called - * last. (This is highest as in numerical value, not as in order of - * importance.) - * - * @see purple_signal_connect_priority(). - */ -#define PURPLE_SIGNAL_PRIORITY_HIGHEST 9999 -/** The smallest signal priority; signals with this priority will be called - * first. (This is lowest as in numerical value, not as in order of - * importance.) - * - * @see purple_signal_connect_priority(). - */ -#define PURPLE_SIGNAL_PRIORITY_LOWEST -9999 - -/** - * Registers a signal in an instance. - * - * @param instance The instance to register the signal for. - * @param signal The signal name. - * @param marshal The marshal function. - * @param ret_value The return value type, or NULL for no return value. - * @param num_values The number of values to be passed to the callbacks. - * @param ... The values to pass to the callbacks. - * - * @return The signal ID local to that instance, or 0 if the signal - * couldn't be registered. - * - * @see PurpleValue - */ -gulong purple_signal_register(void *instance, const char *signal, - PurpleSignalMarshalFunc marshal, - PurpleValue *ret_value, int num_values, ...); - -/** - * Unregisters a signal in an instance. - * - * @param instance The instance to unregister the signal for. - * @param signal The signal name. - */ -void purple_signal_unregister(void *instance, const char *signal); - -/** - * Unregisters all signals in an instance. - * - * @param instance The instance to unregister the signal for. - */ -void purple_signals_unregister_by_instance(void *instance); - -/** - * Returns a list of value types used for a signal. - * - * @param instance The instance the signal is registered to. - * @param signal The signal. - * @param ret_value The return value from the last signal handler. - * @param num_values The returned number of values. - * @param values The returned list of values. - */ -void purple_signal_get_values(void *instance, const char *signal, - PurpleValue **ret_value, - int *num_values, PurpleValue ***values); - -/** - * Connects a signal handler to a signal for a particular object. - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * @param priority The priority with which the handler should be called. Signal - * handlers are called in ascending numerical order of @a - * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to - * #PURPLE_SIGNAL_PRIORITY_HIGHEST. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect_priority(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data, int priority); - -/** - * Connects a signal handler to a signal for a particular object. - * (Its priority defaults to 0, aka #PURPLE_SIGNAL_PRIORITY_DEFAULT.) - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data); - -/** - * Connects a signal handler to a signal for a particular object. - * - * The signal handler will take a va_args of arguments, instead of - * individual arguments. - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * @param priority The priority with which the handler should be called. Signal - * handlers are called in ascending numerical order of @a - * priority from #PURPLE_SIGNAL_PRIORITY_LOWEST to - * #PURPLE_SIGNAL_PRIORITY_HIGHEST. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect_priority_vargs(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data, int priority); - -/** - * Connects a signal handler to a signal for a particular object. - * (Its priority defaults to 0, aka #PURPLE_SIGNAL_PRIORITY_DEFAULT.) - * - * The signal handler will take a va_args of arguments, instead of - * individual arguments. - * - * Take care not to register a handler function twice. Purple will - * not correct any mistakes for you in this area. - * - * @param instance The instance to connect to. - * @param signal The name of the signal to connect. - * @param handle The handle of the receiver. - * @param func The callback function. - * @param data The data to pass to the callback function. - * - * @return The signal handler ID. - * - * @see purple_signal_disconnect() - */ -gulong purple_signal_connect_vargs(void *instance, const char *signal, - void *handle, PurpleCallback func, void *data); - -/** - * Disconnects a signal handler from a signal on an object. - * - * @param instance The instance to disconnect from. - * @param signal The name of the signal to disconnect. - * @param handle The handle of the receiver. - * @param func The registered function to disconnect. - * - * @see purple_signal_connect() - */ -void purple_signal_disconnect(void *instance, const char *signal, - void *handle, PurpleCallback func); - -/** - * Removes all callbacks associated with a receiver handle. - * - * @param handle The receiver handle. - */ -void purple_signals_disconnect_by_handle(void *handle); - -/** - * Emits a signal. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * - * @see purple_signal_connect() - * @see purple_signal_disconnect() - */ -void purple_signal_emit(void *instance, const char *signal, ...); - -/** - * Emits a signal, using a va_list of arguments. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * @param args The arguments list. - * - * @see purple_signal_connect() - * @see purple_signal_disconnect() - */ -void purple_signal_emit_vargs(void *instance, const char *signal, va_list args); - -/** - * Emits a signal and returns the first non-NULL return value. - * - * Further signal handlers are NOT called after a handler returns - * something other than NULL. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * - * @return The first non-NULL return value - */ -void *purple_signal_emit_return_1(void *instance, const char *signal, ...); - -/** - * Emits a signal and returns the first non-NULL return value. - * - * Further signal handlers are NOT called after a handler returns - * something other than NULL. - * - * @param instance The instance emitting the signal. - * @param signal The signal being emitted. - * @param args The arguments list. - * - * @return The first non-NULL return value - */ -void *purple_signal_emit_vargs_return_1(void *instance, const char *signal, - va_list args); - -/** - * Initializes the signals subsystem. - */ -void purple_signals_init(void); - -/** - * Uninitializes the signals subsystem. - */ -void purple_signals_uninit(void); - -/*@}*/ - -/**************************************************************************/ -/** @name Marshal Functions */ -/**************************************************************************/ -/*@{*/ - -void purple_marshal_VOID( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__INT_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_INT_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_INT_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_UINT_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_INT__INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_INT__INT_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_INT__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_BOOLEAN__POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_BOOLEAN__INT_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); - -void purple_marshal_POINTER__POINTER_INT( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_INT64( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_INT_BOOLEAN( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_INT64_BOOLEAN( - PurpleCallback cb, va_list args, void *data, void **return_val); -void purple_marshal_POINTER__POINTER_POINTER( - PurpleCallback cb, va_list args, void *data, void **return_val); -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SIGNALS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,902 +0,0 @@ -/** - * @file smiley.c Simley API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "imgstore.h" -#include "smiley.h" -#include "util.h" -#include "xmlnode.h" - -/**************************************************************************/ -/* Main structures, members and constants */ -/**************************************************************************/ - -struct _PurpleSmiley -{ - GObject parent; - PurpleStoredImage *img; /**< The id of the stored image with the - the smiley data. */ - char *shortcut; /**< Shortcut associated with the custom - smiley. This field will work as a - unique key by this API. */ - char *checksum; /**< The smiley checksum. */ -}; - -struct _PurpleSmileyClass -{ - GObjectClass parent_class; -}; - -static GHashTable *smiley_shortcut_index = NULL; /* shortcut (char *) => smiley (PurpleSmiley*) */ -static GHashTable *smiley_checksum_index = NULL; /* checksum (char *) => smiley (PurpleSmiley*) */ - -static guint save_timer = 0; -static gboolean smileys_loaded = FALSE; -static char *smileys_dir = NULL; - -#define SMILEYS_DEFAULT_FOLDER "custom_smiley" -#define SMILEYS_LOG_ID "smileys" - -#define XML_FILE_NAME "smileys.xml" - -#define XML_ROOT_TAG "smileys" -#define XML_PROFILE_TAG "profile" -#define XML_PROFILE_NAME_ATTRIB_TAG "name" -#define XML_ACCOUNT_TAG "account" -#define XML_ACCOUNT_USERID_ATTRIB_TAG "userid" -#define XML_SMILEY_SET_TAG "smiley_set" -#define XML_SMILEY_TAG "smiley" -#define XML_SHORTCUT_ATTRIB_TAG "shortcut" -#define XML_CHECKSUM_ATRIB_TAG "checksum" -#define XML_FILENAME_ATRIB_TAG "filename" - - -/****************************************************************************** - * XML descriptor file layout * - ****************************************************************************** - * - * Although we are creating the profile XML structure here, now we - * won't handle it. - * So, we just add one profile named "default" that has no associated - * account elements, and have only the smiley_set that will contain - * all existent custom smiley. - * - * It's our "Highlander Profile" :-) - * - ****************************************************************************** - * - * - * - * - * - * - * - * - * - * - * - * - *****************************************************************************/ - - -/********************************************************************* - * Forward declarations * - *********************************************************************/ - -static gboolean read_smiley_file(const char *path, guchar **data, size_t *len); - -static char *get_file_full_path(const char *filename); - -static PurpleSmiley *purple_smiley_create(const char *shortcut); - -static PurpleSmiley *purple_smiley_load_file(const char *shortcut, const char *checksum, - const char *filename); - -static void -purple_smiley_set_data_impl(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len); - -static void -purple_smiley_data_store(PurpleStoredImage *stored_img); - -static void -purple_smiley_data_unstore(const char *filename); - -/********************************************************************* - * Writing to disk * - *********************************************************************/ - -static xmlnode * -smiley_to_xmlnode(PurpleSmiley *smiley) -{ - xmlnode *smiley_node = NULL; - - smiley_node = xmlnode_new(XML_SMILEY_TAG); - - if (!smiley_node) - return NULL; - - xmlnode_set_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG, - smiley->shortcut); - - xmlnode_set_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG, - smiley->checksum); - - xmlnode_set_attrib(smiley_node, XML_FILENAME_ATRIB_TAG, - purple_imgstore_get_filename(smiley->img)); - - return smiley_node; -} - -static void -add_smiley_to_main_node(gpointer key, gpointer value, gpointer user_data) -{ - xmlnode *child_node; - - child_node = smiley_to_xmlnode(value); - xmlnode_insert_child((xmlnode*)user_data, child_node); -} - -static xmlnode * -smileys_to_xmlnode(void) -{ - xmlnode *root_node, *profile_node, *smileyset_node; - - root_node = xmlnode_new(XML_ROOT_TAG); - xmlnode_set_attrib(root_node, "version", "1.0"); - - /* See the top comments above to understand why initial tag elements - * are not being considered by now. */ - profile_node = xmlnode_new(XML_PROFILE_TAG); - if (profile_node) { - xmlnode_set_attrib(profile_node, XML_PROFILE_NAME_ATTRIB_TAG, "Default"); - xmlnode_insert_child(root_node, profile_node); - - smileyset_node = xmlnode_new(XML_SMILEY_SET_TAG); - if (smileyset_node) { - xmlnode_insert_child(profile_node, smileyset_node); - g_hash_table_foreach(smiley_shortcut_index, add_smiley_to_main_node, smileyset_node); - } - } - - return root_node; -} - -static void -sync_smileys(void) -{ - xmlnode *root_node; - char *data; - - if (!smileys_loaded) { - purple_debug_error(SMILEYS_LOG_ID, "Attempted to save smileys before it " - "was read!\n"); - return; - } - - root_node = smileys_to_xmlnode(); - data = xmlnode_to_formatted_str(root_node, NULL); - purple_util_write_data_to_file(XML_FILE_NAME, data, -1); - - g_free(data); - xmlnode_free(root_node); -} - -static gboolean -save_smileys_cb(gpointer data) -{ - sync_smileys(); - save_timer = 0; - return FALSE; -} - -static void -purple_smileys_save(void) -{ - if (save_timer == 0) - save_timer = purple_timeout_add_seconds(5, save_smileys_cb, NULL); -} - - -/********************************************************************* - * Reading from disk * - *********************************************************************/ - -static PurpleSmiley * -parse_smiley(xmlnode *smiley_node) -{ - PurpleSmiley *smiley; - const char *shortcut = NULL; - const char *checksum = NULL; - const char *filename = NULL; - - shortcut = xmlnode_get_attrib(smiley_node, XML_SHORTCUT_ATTRIB_TAG); - checksum = xmlnode_get_attrib(smiley_node, XML_CHECKSUM_ATRIB_TAG); - filename = xmlnode_get_attrib(smiley_node, XML_FILENAME_ATRIB_TAG); - - if ((shortcut == NULL) || (checksum == NULL) || (filename == NULL)) - return NULL; - - smiley = purple_smiley_load_file(shortcut, checksum, filename); - - return smiley; -} - -static void -purple_smileys_load(void) -{ - xmlnode *root_node, *profile_node; - xmlnode *smileyset_node = NULL; - xmlnode *smiley_node; - - smileys_loaded = TRUE; - - root_node = purple_util_read_xml_from_file(XML_FILE_NAME, - _(SMILEYS_LOG_ID)); - - if (root_node == NULL) - return; - - /* See the top comments above to understand why initial tag elements - * are not being considered by now. */ - profile_node = xmlnode_get_child(root_node, XML_PROFILE_TAG); - if (profile_node) - smileyset_node = xmlnode_get_child(profile_node, XML_SMILEY_SET_TAG); - - if (smileyset_node) { - smiley_node = xmlnode_get_child(smileyset_node, XML_SMILEY_TAG); - for (; smiley_node != NULL; - smiley_node = xmlnode_get_next_twin(smiley_node)) { - PurpleSmiley *smiley; - - smiley = parse_smiley(smiley_node); - } - } - - xmlnode_free(root_node); -} - -/********************************************************************* - * GObject Stuff * - *********************************************************************/ -enum -{ - PROP_0, - PROP_SHORTCUT, - PROP_IMGSTORE -}; - -#define PROP_SHORTCUT_S "shortcut" -#define PROP_IMGSTORE_S "image" - -enum -{ - SIG_DESTROY, - SIG_LAST -}; - -static guint signals[SIG_LAST]; -static GObjectClass *parent_class; - -static void -purple_smiley_init(GTypeInstance *instance, gpointer klass) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(instance); - PURPLE_DBUS_REGISTER_POINTER(smiley, PurpleSmiley); -} - -static void -purple_smiley_get_property(GObject *object, guint param_id, GValue *value, - GParamSpec *spec) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(object); - switch (param_id) { - case PROP_SHORTCUT: - g_value_set_string(value, smiley->shortcut); - break; - case PROP_IMGSTORE: - g_value_set_pointer(value, smiley->img); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, spec); - break; - } -} - -static void -purple_smiley_set_property(GObject *object, guint param_id, const GValue *value, - GParamSpec *spec) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(object); - switch (param_id) { - case PROP_SHORTCUT: - { - const char *shortcut = g_value_get_string(value); - purple_smiley_set_shortcut(smiley, shortcut); - } - break; - case PROP_IMGSTORE: - { - PurpleStoredImage *img = g_value_get_pointer(value); - - purple_imgstore_unref(smiley->img); - g_free(smiley->checksum); - - smiley->img = img; - if (img) { - smiley->checksum = purple_util_get_image_checksum( - purple_imgstore_get_data(img), - purple_imgstore_get_size(img)); - purple_smiley_data_store(img); - } else { - smiley->checksum = NULL; - } - - g_object_notify(object, PROP_IMGSTORE_S); - } - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, spec); - break; - } -} - -static void -purple_smiley_finalize(GObject *obj) -{ - PurpleSmiley *smiley = PURPLE_SMILEY(obj); - - if (g_hash_table_lookup(smiley_shortcut_index, smiley->shortcut)) { - g_hash_table_remove(smiley_shortcut_index, smiley->shortcut); - g_hash_table_remove(smiley_checksum_index, smiley->checksum); - } - - g_free(smiley->shortcut); - g_free(smiley->checksum); - if (smiley->img) - purple_smiley_data_unstore(purple_imgstore_get_filename(smiley->img)); - purple_imgstore_unref(smiley->img); - - PURPLE_DBUS_UNREGISTER_POINTER(smiley); - - purple_smileys_save(); -} - -static void -purple_smiley_dispose(GObject *gobj) -{ - g_signal_emit(gobj, signals[SIG_DESTROY], 0); - parent_class->dispose(gobj); -} - -static void -purple_smiley_class_init(PurpleSmileyClass *klass) -{ - GObjectClass *gobj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - gobj_class->get_property = purple_smiley_get_property; - gobj_class->set_property = purple_smiley_set_property; - gobj_class->finalize = purple_smiley_finalize; - gobj_class->dispose = purple_smiley_dispose; - - /* Shortcut */ - pspec = g_param_spec_string(PROP_SHORTCUT_S, _("Shortcut"), - _("The text-shortcut for the smiley"), - NULL, - G_PARAM_READWRITE); - g_object_class_install_property(gobj_class, PROP_SHORTCUT, pspec); - - /* Stored Image */ - pspec = g_param_spec_pointer(PROP_IMGSTORE_S, _("Stored Image"), - _("Stored Image. (that'll have to do for now)"), - G_PARAM_READWRITE); - g_object_class_install_property(gobj_class, PROP_IMGSTORE, pspec); - - signals[SIG_DESTROY] = g_signal_new("destroy", - G_OBJECT_CLASS_TYPE(klass), - G_SIGNAL_RUN_LAST, - 0, NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); -} - -GType -purple_smiley_get_type(void) -{ - static GType type = 0; - - if(type == 0) { - static const GTypeInfo info = { - sizeof(PurpleSmileyClass), - NULL, - NULL, - (GClassInitFunc)purple_smiley_class_init, - NULL, - NULL, - sizeof(PurpleSmiley), - 0, - purple_smiley_init, - NULL, - }; - - type = g_type_register_static(G_TYPE_OBJECT, - "PurpleSmiley", - &info, 0); - } - - return type; -} - -/********************************************************************* - * Other Stuff * - *********************************************************************/ - -static char *get_file_full_path(const char *filename) -{ - char *path; - - path = g_build_filename(purple_smileys_get_storing_dir(), filename, NULL); - - if (!g_file_test(path, G_FILE_TEST_EXISTS)) { - g_free(path); - return NULL; - } - - return path; -} - -static PurpleSmiley * -purple_smiley_load_file(const char *shortcut, const char *checksum, const char *filename) -{ - PurpleSmiley *smiley = NULL; - guchar *smiley_data; - size_t smiley_data_len; - char *fullpath = NULL; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(checksum != NULL, NULL); - g_return_val_if_fail(filename != NULL, NULL); - - fullpath = get_file_full_path(filename); - if (!fullpath) - return NULL; - - smiley = purple_smiley_create(shortcut); - if (!smiley) { - g_free(fullpath); - return NULL; - } - - smiley->checksum = g_strdup(checksum); - - if (read_smiley_file(fullpath, &smiley_data, &smiley_data_len)) - purple_smiley_set_data_impl(smiley, smiley_data, - smiley_data_len); - else - purple_smiley_delete(smiley); - - g_free(fullpath); - - return smiley; -} - -static void -purple_smiley_data_store(PurpleStoredImage *stored_img) -{ - const char *dirname; - char *path; - FILE *file = NULL; - - g_return_if_fail(stored_img != NULL); - - if (!smileys_loaded) - return; - - dirname = purple_smileys_get_storing_dir(); - path = g_build_filename(dirname, purple_imgstore_get_filename(stored_img), NULL); - - if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { - purple_debug_info(SMILEYS_LOG_ID, "Creating smileys directory.\n"); - - if (g_mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) { - purple_debug_error(SMILEYS_LOG_ID, - "Unable to create directory %s: %s\n", - dirname, g_strerror(errno)); - } - } - - if ((file = g_fopen(path, "wb")) != NULL) { - if (!fwrite(purple_imgstore_get_data(stored_img), - purple_imgstore_get_size(stored_img), 1, file)) { - purple_debug_error(SMILEYS_LOG_ID, "Error writing %s: %s\n", - path, g_strerror(errno)); - } else { - purple_debug_info(SMILEYS_LOG_ID, "Wrote cache file: %s\n", path); - } - - fclose(file); - } else { - purple_debug_error(SMILEYS_LOG_ID, "Unable to create file %s: %s\n", - path, g_strerror(errno)); - g_free(path); - - return; - } - - g_free(path); -} - -static void -purple_smiley_data_unstore(const char *filename) -{ - const char *dirname; - char *path; - - g_return_if_fail(filename != NULL); - - dirname = purple_smileys_get_storing_dir(); - path = g_build_filename(dirname, filename, NULL); - - if (g_file_test(path, G_FILE_TEST_EXISTS)) { - if (g_unlink(path)) - purple_debug_error(SMILEYS_LOG_ID, "Failed to delete %s: %s\n", - path, g_strerror(errno)); - else - purple_debug_info(SMILEYS_LOG_ID, "Deleted cache file: %s\n", path); - } - - g_free(path); -} - -static gboolean -read_smiley_file(const char *path, guchar **data, size_t *len) -{ - GError *err = NULL; - - if (!g_file_get_contents(path, (gchar **)data, len, &err)) { - purple_debug_error(SMILEYS_LOG_ID, "Error reading %s: %s\n", - path, err->message); - g_error_free(err); - - return FALSE; - } - - return TRUE; -} - -static PurpleStoredImage * -purple_smiley_data_new(guchar *smiley_data, size_t smiley_data_len) -{ - char *filename; - PurpleStoredImage *stored_img; - - g_return_val_if_fail(smiley_data != NULL, NULL); - g_return_val_if_fail(smiley_data_len > 0, NULL); - - filename = purple_util_get_image_filename(smiley_data, smiley_data_len); - - if (filename == NULL) { - g_free(smiley_data); - return NULL; - } - - stored_img = purple_imgstore_add(smiley_data, smiley_data_len, filename); - - g_free(filename); - - return stored_img; -} - -static void -purple_smiley_set_data_impl(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len) -{ - PurpleStoredImage *old_img, *new_img; - const char *old_filename = NULL; - const char *new_filename = NULL; - - g_return_if_fail(smiley != NULL); - g_return_if_fail(smiley_data != NULL); - g_return_if_fail(smiley_data_len > 0); - - old_img = smiley->img; - - new_img = purple_smiley_data_new(smiley_data, smiley_data_len); - - g_object_set(G_OBJECT(smiley), PROP_IMGSTORE_S, new_img, NULL); - - /* If the old and new image files have different names we need - * to unstore old image file. */ - if (!old_img) - return; - - old_filename = purple_imgstore_get_filename(old_img); - new_filename = purple_imgstore_get_filename(smiley->img); - - if (g_ascii_strcasecmp(old_filename, new_filename)) - purple_smiley_data_unstore(old_filename); - purple_imgstore_unref(old_img); -} - - -/***************************************************************************** - * Public API functions * - *****************************************************************************/ - -static PurpleSmiley * -purple_smiley_create(const char *shortcut) -{ - PurpleSmiley *smiley; - - smiley = PURPLE_SMILEY(g_object_new(PURPLE_TYPE_SMILEY, PROP_SHORTCUT_S, shortcut, NULL)); - - return smiley; -} - -PurpleSmiley * -purple_smiley_new(PurpleStoredImage *img, const char *shortcut) -{ - PurpleSmiley *smiley = NULL; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(img != NULL, NULL); - - smiley = purple_smileys_find_by_shortcut(shortcut); - if (smiley) - return smiley; - - smiley = purple_smiley_create(shortcut); - if (!smiley) - return NULL; - - g_object_set(G_OBJECT(smiley), PROP_IMGSTORE_S, img, NULL); - - return smiley; -} - -static PurpleSmiley * -purple_smiley_new_from_stream(const char *shortcut, guchar *smiley_data, - size_t smiley_data_len) -{ - PurpleSmiley *smiley; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(smiley_data != NULL, NULL); - g_return_val_if_fail(smiley_data_len > 0, NULL); - - smiley = purple_smileys_find_by_shortcut(shortcut); - if (smiley) - return smiley; - - /* purple_smiley_create() sets shortcut */ - smiley = purple_smiley_create(shortcut); - if (!smiley) - return NULL; - - purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len); - - purple_smiley_data_store(smiley->img); - - return smiley; -} - -PurpleSmiley * -purple_smiley_new_from_file(const char *shortcut, const char *filepath) -{ - PurpleSmiley *smiley = NULL; - guchar *smiley_data; - size_t smiley_data_len; - - g_return_val_if_fail(shortcut != NULL, NULL); - g_return_val_if_fail(filepath != NULL, NULL); - - if (read_smiley_file(filepath, &smiley_data, &smiley_data_len)) { - smiley = purple_smiley_new_from_stream(shortcut, smiley_data, - smiley_data_len); - } - - return smiley; -} - -void -purple_smiley_delete(PurpleSmiley *smiley) -{ - g_return_if_fail(smiley != NULL); - - g_object_unref(smiley); -} - -gboolean -purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut) -{ - g_return_val_if_fail(smiley != NULL, FALSE); - g_return_val_if_fail(shortcut != NULL, FALSE); - - /* Check out whether the new shortcut is already being used. */ - if (g_hash_table_lookup(smiley_shortcut_index, shortcut)) - return FALSE; - - /* Remove the old shortcut. */ - if (smiley->shortcut) - g_hash_table_remove(smiley_shortcut_index, smiley->shortcut); - - /* Insert the new shortcut. */ - g_hash_table_insert(smiley_shortcut_index, g_strdup(shortcut), smiley); - - g_free(smiley->shortcut); - smiley->shortcut = g_strdup(shortcut); - - g_object_notify(G_OBJECT(smiley), PROP_SHORTCUT_S); - - purple_smileys_save(); - - return TRUE; -} - -void -purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len) -{ - g_return_if_fail(smiley != NULL); - g_return_if_fail(smiley_data != NULL); - g_return_if_fail(smiley_data_len > 0); - - /* Remove the previous entry */ - g_hash_table_remove(smiley_checksum_index, smiley->checksum); - - /* Update the file data. This also updates the checksum. */ - purple_smiley_set_data_impl(smiley, smiley_data, smiley_data_len); - - /* Reinsert the index item. */ - g_hash_table_insert(smiley_checksum_index, g_strdup(smiley->checksum), smiley); - - purple_smileys_save(); -} - -PurpleStoredImage * -purple_smiley_get_stored_image(const PurpleSmiley *smiley) -{ - return purple_imgstore_ref(smiley->img); -} - -const char *purple_smiley_get_shortcut(const PurpleSmiley *smiley) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - return smiley->shortcut; -} - -const char * -purple_smiley_get_checksum(const PurpleSmiley *smiley) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - return smiley->checksum; -} - -gconstpointer -purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - if (smiley->img) { - if (len != NULL) - *len = purple_imgstore_get_size(smiley->img); - - return purple_imgstore_get_data(smiley->img); - } - - return NULL; -} - -const char * -purple_smiley_get_extension(const PurpleSmiley *smiley) -{ - if (smiley->img != NULL) - return purple_imgstore_get_extension(smiley->img); - - return NULL; -} - -char *purple_smiley_get_full_path(PurpleSmiley *smiley) -{ - g_return_val_if_fail(smiley != NULL, NULL); - - if (smiley->img == NULL) - return NULL; - - return get_file_full_path(purple_imgstore_get_filename(smiley->img)); -} - -static void add_smiley_to_list(gpointer key, gpointer value, gpointer user_data) -{ - GList** returninglist = (GList**)user_data; - - *returninglist = g_list_append(*returninglist, value); -} - -GList * -purple_smileys_get_all(void) -{ - GList *returninglist = NULL; - - g_hash_table_foreach(smiley_shortcut_index, add_smiley_to_list, &returninglist); - - return returninglist; -} - -PurpleSmiley * -purple_smileys_find_by_shortcut(const char *shortcut) -{ - g_return_val_if_fail(shortcut != NULL, NULL); - - return g_hash_table_lookup(smiley_shortcut_index, shortcut); -} - -PurpleSmiley * -purple_smileys_find_by_checksum(const char *checksum) -{ - g_return_val_if_fail(checksum != NULL, NULL); - - return g_hash_table_lookup(smiley_checksum_index, checksum); -} - -const char * -purple_smileys_get_storing_dir(void) -{ - return smileys_dir; -} - -void -purple_smileys_init(void) -{ - smiley_shortcut_index = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - smiley_checksum_index = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); - - smileys_dir = g_build_filename(purple_user_dir(), SMILEYS_DEFAULT_FOLDER, NULL); - - purple_smileys_load(); -} - -void -purple_smileys_uninit(void) -{ - if (save_timer != 0) { - purple_timeout_remove(save_timer); - save_timer = 0; - sync_smileys(); - } - - g_hash_table_destroy(smiley_shortcut_index); - g_hash_table_destroy(smiley_checksum_index); - g_free(smileys_dir); -} - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/smiley.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,262 +0,0 @@ -/** - * @file smiley.h Smiley API - * @ingroup core - * @since 2.5.0 - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#ifndef _PURPLE_SMILEY_H_ -#define _PURPLE_SMILEY_H_ - -#include - -#include "imgstore.h" -#include "util.h" - -/** - * A custom smiley. - * This contains everything Purple will ever need to know about a custom smiley. - * Everything. - * - * PurpleSmiley is a GObject. - */ -typedef struct _PurpleSmiley PurpleSmiley; -typedef struct _PurpleSmileyClass PurpleSmileyClass; - -#define PURPLE_TYPE_SMILEY (purple_smiley_get_type ()) -#define PURPLE_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_CAST ((smiley), PURPLE_TYPE_SMILEY, PurpleSmiley)) -#define PURPLE_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_SMILEY, PurpleSmileyClass)) -#define PURPLE_IS_SMILEY(smiley) (G_TYPE_CHECK_INSTANCE_TYPE ((smiley), PURPLE_TYPE_SMILEY)) -#define PURPLE_IS_SMILEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_SMILEY)) -#define PURPLE_SMILEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_SMILEY, PurpleSmileyClass)) - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Custom Smiley API */ -/**************************************************************************/ -/*@{*/ - -/** - * GObject-fu. - * @internal. - */ -GType purple_smiley_get_type(void); - -/** - * Creates a new custom smiley from a PurpleStoredImage. - * - * If a custom smiley with the given shortcut already exists, it - * will be automaticaly returned. - * - * @param img The image associated with the smiley. - * @param shortcut The associated shortcut (e.g. "(homer)"). - * - * @return The custom smiley. - */ -PurpleSmiley * -purple_smiley_new(PurpleStoredImage *img, const char *shortcut); - -/** - * Creates a new custom smiley, reading the image data from a file. - * - * If a custom smiley with the given shortcut already exists, it - * will be automaticaly returned. - * - * @param shortcut The associated shortcut (e.g. "(homer)"). - * @param filepath The image file. - * - * @return The custom smiley. - */ -PurpleSmiley * -purple_smiley_new_from_file(const char *shortcut, const char *filepath); - -/** - * Destroys the custom smiley and releases the associated resources. - * - * @param smiley The custom smiley. - */ -void -purple_smiley_delete(PurpleSmiley *smiley); - -/** - * Changes the custom smiley's shortcut. - * - * @param smiley The custom smiley. - * @param shortcut The new shortcut. A custom smiley with this shortcut - * cannot already be in use. - * - * @return TRUE if the shortcut was changed. FALSE otherwise. - */ -gboolean -purple_smiley_set_shortcut(PurpleSmiley *smiley, const char *shortcut); - -/** - * Changes the custom smiley's image data. - * - * @param smiley The custom smiley. - * @param smiley_data The custom smiley data, which the smiley code - * takes ownership of and will free. - * @param smiley_data_len The length of the data in @a smiley_data. - */ -void -purple_smiley_set_data(PurpleSmiley *smiley, guchar *smiley_data, - size_t smiley_data_len); - -/** - * Returns the custom smiley's associated shortcut (e.g. "(homer)"). - * - * @param smiley The custom smiley. - * - * @return The shortcut. - */ -const char *purple_smiley_get_shortcut(const PurpleSmiley *smiley); - -/** - * Returns the custom smiley data's checksum. - * - * @param smiley The custom smiley. - * - * @return The checksum. - */ -const char *purple_smiley_get_checksum(const PurpleSmiley *smiley); - -/** - * Returns the PurpleStoredImage with the reference counter incremented. - * - * The returned PurpleStoredImage reference counter must be decremented - * when the caller is done using it. - * - * @param smiley The custom smiley. - * - * @return A PurpleStoredImage. - */ -PurpleStoredImage *purple_smiley_get_stored_image(const PurpleSmiley *smiley); - -/** - * Returns the custom smiley's data. - * - * @param smiley The custom smiley. - * @param len If not @c NULL, the length of the image data returned - * will be set in the location pointed to by this. - * - * @return A pointer to the custom smiley data. - */ -gconstpointer purple_smiley_get_data(const PurpleSmiley *smiley, size_t *len); - -/** - * Returns an extension corresponding to the custom smiley's file type. - * - * @param smiley The custom smiley. - * - * @return The custom smiley's extension, "icon" if unknown, or @c NULL if - * the image data has disappeared. - */ -const char *purple_smiley_get_extension(const PurpleSmiley *smiley); - -/** - * Returns a full path to an custom smiley. - * - * If the custom smiley has data and the file exists in the cache, this - * will return a full path to the cached file. - * - * In general, it is not appropriate to be poking in the file cache - * directly. If you find yourself wanting to use this function, think - * very long and hard about it, and then don't. - * - * Think some more. - * - * @param smiley The custom smiley. - * - * @return A full path to the file, or @c NULL under various conditions. - * The caller should use g_free to free the returned string. - */ -char *purple_smiley_get_full_path(PurpleSmiley *smiley); - -/*@}*/ - - -/**************************************************************************/ -/** @name Custom Smiley Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns a list of all custom smileys. The caller is responsible for freeing - * the list. - * - * @return A list of all custom smileys. - */ -GList * -purple_smileys_get_all(void); - -/** - * Returns a custom smiley given its shortcut. - * - * @param shortcut The custom smiley's shortcut. - * - * @return The custom smiley if found, or @c NULL if not found. - */ -PurpleSmiley * -purple_smileys_find_by_shortcut(const char *shortcut); - -/** - * Returns a custom smiley given its checksum. - * - * @param checksum The custom smiley's checksum. - * - * @return The custom smiley if found, or @c NULL if not found. - */ -PurpleSmiley * -purple_smileys_find_by_checksum(const char *checksum); - -/** - * Returns the directory used to store custom smiley cached files. - * - * The default directory is PURPLEDIR/custom_smiley. - * - * @return The directory in which to store custom smileys cached files. - */ -const char *purple_smileys_get_storing_dir(void); - -/** - * Initializes the custom smiley subsystem. - */ -void purple_smileys_init(void); - -/** - * Uninitializes the custom smiley subsystem. - */ -void purple_smileys_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SMILEY_H_ */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#include "internal.h" - -#include "blist.h" -#include "prefs.h" -#include "sound.h" -#include "sound-theme-loader.h" -#include "theme-manager.h" - -static PurpleSoundUiOps *sound_ui_ops = NULL; - -#define STATUS_AVAILABLE 1 -#define STATUS_AWAY 2 - -static time_t last_played[PURPLE_NUM_SOUNDS]; - -static gboolean -purple_sound_play_required(const PurpleAccount *account) -{ - gint pref_status = purple_prefs_get_int("/purple/sound/while_status"); - - if (pref_status == 3) - { - /* Play sounds: Always */ - return TRUE; - } - - if (account != NULL) - { - PurpleStatus *status = purple_account_get_active_status(account); - - if (purple_status_is_online(status)) - { - gboolean available = purple_status_is_available(status); - return (( available && pref_status == STATUS_AVAILABLE) || - (!available && pref_status == STATUS_AWAY)); - } - } - - /* We get here a couple of ways. Either the request has been OK'ed - * by purple_sound_play_event() and we're here because the UI has - * called purple_sound_play_file(), or we're here for something - * not related to an account (like testing a sound). */ - return TRUE; -} - -void -purple_sound_play_file(const char *filename, const PurpleAccount *account) -{ - if (!purple_sound_play_required(account)) - return; - - if(sound_ui_ops && sound_ui_ops->play_file) - sound_ui_ops->play_file(filename); -} - -void -purple_sound_play_event(PurpleSoundEventID event, const PurpleAccount *account) -{ - if (!purple_sound_play_required(account)) - return; - - if (time(NULL) - last_played[event] < 2) - return; - last_played[event] = time(NULL); - - if(sound_ui_ops && sound_ui_ops->play_event) { - int plugin_return; - - plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( - purple_sounds_get_handle(), "playing-sound-event", - event, account)); - - if (plugin_return) - return; - else - sound_ui_ops->play_event(event); - } -} - -void -purple_sound_set_ui_ops(PurpleSoundUiOps *ops) -{ - if(sound_ui_ops && sound_ui_ops->uninit) - sound_ui_ops->uninit(); - - sound_ui_ops = ops; - - if(sound_ui_ops && sound_ui_ops->init) - sound_ui_ops->init(); -} - -PurpleSoundUiOps * -purple_sound_get_ui_ops(void) -{ - return sound_ui_ops; -} - -void -purple_sound_init() -{ - void *handle = purple_sounds_get_handle(); - - /********************************************************************** - * Register signals - **********************************************************************/ - - purple_signal_register(handle, "playing-sound-event", - purple_marshal_BOOLEAN__INT_POINTER, - purple_value_new(PURPLE_TYPE_BOOLEAN), 2, - purple_value_new(PURPLE_TYPE_INT), - purple_value_new(PURPLE_TYPE_SUBTYPE, - PURPLE_SUBTYPE_ACCOUNT)); - - purple_prefs_add_none("/purple/sound"); - purple_prefs_add_int("/purple/sound/while_status", STATUS_AVAILABLE); - memset(last_played, 0, sizeof(last_played)); - - purple_theme_manager_register_type(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL)); -} - -void -purple_sound_uninit() -{ - if(sound_ui_ops && sound_ui_ops->uninit) - sound_ui_ops->uninit(); - - purple_signals_unregister_by_instance(purple_sounds_get_handle()); -} - -void * -purple_sounds_get_handle() -{ - static int handle; - - return &handle; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -/** - * @file sound.h Sound API - * @ingroup core - * @see @ref sound-signals - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SOUND_H_ -#define _PURPLE_SOUND_H_ - -#include "account.h" - -/**************************************************************************/ -/** Data Structures */ -/**************************************************************************/ - - -/** - * A type of sound. - */ - -typedef enum _PurpleSoundEventID -{ - PURPLE_SOUND_BUDDY_ARRIVE = 0, /**< Buddy signs on. */ - PURPLE_SOUND_BUDDY_LEAVE, /**< Buddy signs off. */ - PURPLE_SOUND_RECEIVE, /**< Receive an IM. */ - PURPLE_SOUND_FIRST_RECEIVE, /**< Receive an IM that starts a conv. */ - PURPLE_SOUND_SEND, /**< Send an IM. */ - PURPLE_SOUND_CHAT_JOIN, /**< Someone joins a chat. */ - PURPLE_SOUND_CHAT_LEAVE, /**< Someone leaves a chat. */ - PURPLE_SOUND_CHAT_YOU_SAY, /**< You say something in a chat. */ - PURPLE_SOUND_CHAT_SAY, /**< Someone else says somthing in a chat. */ - PURPLE_SOUND_POUNCE_DEFAULT, /**< Default sound for a buddy pounce. */ - PURPLE_SOUND_CHAT_NICK, /**< Someone says your name in a chat. */ - PURPLE_NUM_SOUNDS /**< Total number of sounds. */ - -} PurpleSoundEventID; - -/** Operations used by the core to request that particular sound files, or the - * sound associated with a particular event, should be played. - */ -typedef struct _PurpleSoundUiOps -{ - void (*init)(void); - void (*uninit)(void); - void (*play_file)(const char *filename); - void (*play_event)(PurpleSoundEventID event); - - void (*_purple_reserved1)(void); - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleSoundUiOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name Sound API */ -/**************************************************************************/ -/*@{*/ - -/** - * Plays the specified sound file. - * - * @param filename The file to play. - * @param account The account that this sound is associated with, or - * NULL if the sound is not associated with any specific - * account. This is needed for the "sounds while away?" - * preference to work correctly. - */ -void purple_sound_play_file(const char *filename, const PurpleAccount *account); - -/** - * Plays the sound associated with the specified event. - * - * @param event The event. - * @param account The account that this sound is associated with, or - * NULL if the sound is not associated with any specific - * account. This is needed for the "sounds while away?" - * preference to work correctly. - */ -void purple_sound_play_event(PurpleSoundEventID event, const PurpleAccount *account); - -/** - * Sets the UI sound operations - * - * @param ops The UI sound operations structure. - */ -void purple_sound_set_ui_ops(PurpleSoundUiOps *ops); - -/** - * Gets the UI sound operations - * - * @return The UI sound operations structure. - */ -PurpleSoundUiOps *purple_sound_get_ui_ops(void); - -/** - * Initializes the sound subsystem - */ -void purple_sound_init(void); - -/** - * Shuts down the sound subsystem - */ -void purple_sound_uninit(void); - -/** - * Returns the sound subsystem handle. - * - * @return The sound subsystem handle. - */ -void *purple_sounds_get_handle(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SOUND_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* - * Sound Themes for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "sound-theme.h" - -#define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \ - ((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv)) - -/****************************************************************************** - * Structs - *****************************************************************************/ - -typedef struct { - /* used to store filenames of diffrent sounds */ - GHashTable *sound_files; -} PurpleSoundThemePrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * Enums - *****************************************************************************/ - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -purple_sound_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleSoundThemePrivate *priv; - - (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1); - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance); - - priv->sound_files = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_free); -} - -static void -purple_sound_theme_finalize(GObject *obj) -{ - PurpleSoundThemePrivate *priv; - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(obj); - - g_hash_table_destroy(priv->sound_files); - - parent_class->finalize(obj); -} - -static void -purple_sound_theme_class_init(PurpleSoundThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - - parent_class = g_type_class_peek_parent(klass); - - obj_class->finalize = purple_sound_theme_finalize; -} - -GType -purple_sound_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleSoundThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_sound_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleSoundTheme), - 0, /* n_preallocs */ - purple_sound_theme_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(PURPLE_TYPE_THEME, - "PurpleSoundTheme", &info, 0); - } - return type; -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -const gchar * -purple_sound_theme_get_file(PurpleSoundTheme *theme, - const gchar *event) -{ - PurpleSoundThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL); - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme); - - return g_hash_table_lookup(priv->sound_files, event); -} - -gchar * -purple_sound_theme_get_file_full(PurpleSoundTheme *theme, - const gchar *event) -{ - const gchar *filename; - - g_return_val_if_fail(PURPLE_IS_SOUND_THEME(theme), NULL); - - filename = purple_sound_theme_get_file(theme, event); - - g_return_val_if_fail(filename, NULL); - - return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL); -} - -void -purple_sound_theme_set_file(PurpleSoundTheme *theme, - const gchar *event, - const gchar *filename) -{ - PurpleSoundThemePrivate *priv; - g_return_if_fail(PURPLE_IS_SOUND_THEME(theme)); - - priv = PURPLE_SOUND_THEME_GET_PRIVATE(theme); - - if (filename != NULL) - g_hash_table_replace(priv->sound_files, - g_strdup(event), g_strdup(filename)); - else - g_hash_table_remove(priv->sound_files, event); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/** - * @file sound-theme.h Purple Sound Theme Abstact Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_SOUND_THEME_H -#define PURPLE_SOUND_THEME_H - -#include -#include -#include "theme.h" -#include "sound.h" - -/** - * extends PurpleTheme (theme.h) - * A purple sound theme. - * This is an object for Purple to represent a sound theme. - * - * PurpleSoundTheme is a PurpleTheme Object. - */ -typedef struct _PurpleSoundTheme PurpleSoundTheme; -typedef struct _PurpleSoundThemeClass PurpleSoundThemeClass; - -#define PURPLE_TYPE_SOUND_THEME (purple_sound_theme_get_type()) -#define PURPLE_SOUND_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundTheme)) -#define PURPLE_SOUND_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemeClass)) -#define PURPLE_IS_SOUND_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_SOUND_THEME)) -#define PURPLE_IS_SOUND_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_SOUND_THEME)) -#define PURPLE_SOUND_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemeClass)) - -struct _PurpleSoundTheme -{ - PurpleTheme parent; - gpointer priv; -}; - -struct _PurpleSoundThemeClass -{ - PurpleThemeClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Sound Theme API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_sound_theme_get_type(void); - -/** - * Returns a copy of the filename for the sound event. - * - * @param theme The theme. - * @param event The purple sound event to look up. - * - * @returns The filename of the sound event. - */ -const gchar *purple_sound_theme_get_file(PurpleSoundTheme *theme, - const gchar *event); - -/** - * Returns a copy of the directory and filename for the sound event - * - * @param theme The theme. - * @param event The purple sound event to look up - * - * @returns The directory + '/' + filename of the sound event. This is - * a newly allocated string that should be freed with g_free. - */ -gchar *purple_sound_theme_get_file_full(PurpleSoundTheme *theme, - const gchar *event); - -/** - * Sets the filename for a given sound event - * - * @param theme The theme. - * @param event the purple sound event to look up - * @param filename the name of the file to be used for the event - */ -void purple_sound_theme_set_file(PurpleSoundTheme *theme, - const gchar *event, - const gchar *filename); - -G_END_DECLS -#endif /* PURPLE_SOUND_THEME_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * SoundThemeLoader for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "sound-theme-loader.h" -#include "sound-theme.h" -#include "util.h" -#include "xmlnode.h" -#include "debug.h" - -/***************************************************************************** - * Sound Theme Builder - *****************************************************************************/ - -static PurpleTheme * -purple_sound_loader_build(const gchar *dir) -{ - xmlnode *root_node = NULL, *sub_node; - gchar *filename_full, *data = NULL; - PurpleSoundTheme *theme = NULL; - const gchar *name; - - /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); - filename_full = g_build_filename(dir, "theme.xml", NULL); - - if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader"); - - g_free(filename_full); - if (root_node == NULL) - return NULL; - - name = xmlnode_get_attrib(root_node, "name"); - - if (name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "sound")) { - /* Parse the tree */ - sub_node = xmlnode_get_child(root_node, "description"); - data = xmlnode_get_data(sub_node); - - if (xmlnode_get_attrib(root_node, "name") != NULL) { - theme = g_object_new(PURPLE_TYPE_SOUND_THEME, - "type", "sound", - "name", name, - "author", xmlnode_get_attrib(root_node, "author"), - "image", xmlnode_get_attrib(root_node, "image"), - "directory", dir, - "description", data, NULL); - - sub_node = xmlnode_get_child(root_node, "event"); - - while (sub_node) { - purple_sound_theme_set_file(theme, - xmlnode_get_attrib(sub_node, "name"), - xmlnode_get_attrib(sub_node, "file")); - sub_node = xmlnode_get_next_twin(sub_node); - } - } - } else purple_debug_warning("sound-theme-loader", "Missing attribute or problem with the root element\n"); - - xmlnode_free(root_node); - g_free(data); - return PURPLE_THEME(theme); -} - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -purple_sound_theme_loader_class_init(PurpleSoundThemeLoaderClass *klass) -{ - PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); - - loader_klass->purple_theme_loader_build = purple_sound_loader_build; -} - -GType -purple_sound_theme_loader_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleSoundThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_sound_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleSoundThemeLoader), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(PURPLE_TYPE_THEME_LOADER, - "PurpleSoundThemeLoader", &info, 0); - } - return type; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sound-theme-loader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/** - * @file sound-theme-loader.h Purple Sound Theme Loader Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_SOUND_THEME_LOADER_H -#define PURPLE_SOUND_THEME_LOADER_H - -#include -#include -#include "theme-loader.h" - -/** - * A purple sound theme loader. extends PurpleThemeLoader (theme-loader.h) - * This is a class designed to build sound themes - * - * PurpleSoundThemeLoader is a GObject. - */ -typedef struct _PurpleSoundThemeLoader PurpleSoundThemeLoader; -typedef struct _PurpleSoundThemeLoaderClass PurpleSoundThemeLoaderClass; - -#define PURPLE_TYPE_SOUND_THEME_LOADER (purple_sound_theme_loader_get_type()) -#define PURPLE_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoader)) -#define PURPLE_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass)) -#define PURPLE_IS_SOUND_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_SOUND_THEME_LOADER)) -#define PURPLE_IS_SOUND_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_SOUND_THEME_LOADER)) -#define PURPLE_SOUND_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SOUND_THEME_LOADER, PurpleSoundThemeLoaderClass)) - -struct _PurpleSoundThemeLoader -{ - PurpleThemeLoader parent; -}; - -struct _PurpleSoundThemeLoaderClass -{ - PurpleThemeLoaderClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_sound_theme_loader_get_type(void); - -G_END_DECLS -#endif /* PURPLE_SOUND_THEME_LOADER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,333 +0,0 @@ -/** - * @file sslconn.c SSL API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_SSLCONN_C_ - -#include "internal.h" - -#include "certificate.h" -#include "debug.h" -#include "request.h" -#include "sslconn.h" - -static gboolean _ssl_initialized = FALSE; -static PurpleSslOps *_ssl_ops = NULL; - -static gboolean -ssl_init(void) -{ - PurplePlugin *plugin; - PurpleSslOps *ops; - - if (_ssl_initialized) - return FALSE; - - plugin = purple_plugins_find_with_id("core-ssl"); - - if (plugin != NULL && !purple_plugin_is_loaded(plugin)) - purple_plugin_load(plugin); - - ops = purple_ssl_get_ops(); - if ((ops == NULL) || (ops->init == NULL) || (ops->uninit == NULL) || - (ops->connectfunc == NULL) || (ops->close == NULL) || - (ops->read == NULL) || (ops->write == NULL)) - { - return FALSE; - } - - return (_ssl_initialized = ops->init()); -} - -gboolean -purple_ssl_is_supported(void) -{ -#ifdef HAVE_SSL - ssl_init(); - return (purple_ssl_get_ops() != NULL); -#else - return FALSE; -#endif -} - -static void -purple_ssl_connect_cb(gpointer data, gint source, const gchar *error_message) -{ - PurpleSslConnection *gsc; - PurpleSslOps *ops; - - gsc = data; - gsc->connect_data = NULL; - - if (source < 0) - { - if (gsc->error_cb != NULL) - gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); - - purple_ssl_close(gsc); - return; - } - - gsc->fd = source; - - ops = purple_ssl_get_ops(); - ops->connectfunc(gsc); -} - -PurpleSslConnection * -purple_ssl_connect(PurpleAccount *account, const char *host, int port, - PurpleSslInputFunction func, PurpleSslErrorFunction error_func, - void *data) -{ - return purple_ssl_connect_with_ssl_cn(account, host, port, func, error_func, - NULL, data); -} - -PurpleSslConnection * -purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int port, - PurpleSslInputFunction func, PurpleSslErrorFunction error_func, - const char *ssl_cn, void *data) -{ - PurpleSslConnection *gsc; - - g_return_val_if_fail(host != NULL, NULL); - g_return_val_if_fail(port != 0 && port != -1, NULL); - g_return_val_if_fail(func != NULL, NULL); - g_return_val_if_fail(purple_ssl_is_supported(), NULL); - - if (!_ssl_initialized) - { - if (!ssl_init()) - return NULL; - } - - gsc = g_new0(PurpleSslConnection, 1); - - gsc->fd = -1; - gsc->host = ssl_cn ? g_strdup(ssl_cn) : g_strdup(host); - gsc->port = port; - gsc->connect_cb_data = data; - gsc->connect_cb = func; - gsc->error_cb = error_func; - - /* TODO: Move this elsewhere */ - gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); - - gsc->connect_data = purple_proxy_connect(NULL, account, host, port, purple_ssl_connect_cb, gsc); - - if (gsc->connect_data == NULL) - { - g_free(gsc->host); - g_free(gsc); - - return NULL; - } - - return (PurpleSslConnection *)gsc; -} - -static void -recv_cb(gpointer data, gint source, PurpleInputCondition cond) -{ - PurpleSslConnection *gsc = data; - - gsc->recv_cb(gsc->recv_cb_data, gsc, cond); -} - -void -purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, - void *data) -{ - g_return_if_fail(func != NULL); - g_return_if_fail(purple_ssl_is_supported()); - - gsc->recv_cb_data = data; - gsc->recv_cb = func; - - gsc->inpa = purple_input_add(gsc->fd, PURPLE_INPUT_READ, recv_cb, gsc); -} - -const gchar * -purple_ssl_strerror(PurpleSslErrorType error) -{ - switch(error) { - case PURPLE_SSL_CONNECT_FAILED: - return _("SSL Connection Failed"); - case PURPLE_SSL_HANDSHAKE_FAILED: - return _("SSL Handshake Failed"); - case PURPLE_SSL_CERTIFICATE_INVALID: - return _("SSL peer presented an invalid certificate"); - default: - purple_debug_warning("sslconn", "Unknown SSL error code %d\n", error); - return _("Unknown SSL error"); - } -} - -PurpleSslConnection * -purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data) -{ - return purple_ssl_connect_with_host_fd(account, fd, func, error_func, NULL, data); -} - -PurpleSslConnection * -purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - const char *host, - void *data) -{ - PurpleSslConnection *gsc; - PurpleSslOps *ops; - - g_return_val_if_fail(fd != -1, NULL); - g_return_val_if_fail(func != NULL, NULL); - g_return_val_if_fail(purple_ssl_is_supported(), NULL); - - if (!_ssl_initialized) - { - if (!ssl_init()) - return NULL; - } - - gsc = g_new0(PurpleSslConnection, 1); - - gsc->connect_cb_data = data; - gsc->connect_cb = func; - gsc->error_cb = error_func; - gsc->fd = fd; - if(host) - gsc->host = g_strdup(host); - - /* TODO: Move this elsewhere */ - gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); - - - ops = purple_ssl_get_ops(); - ops->connectfunc(gsc); - - return (PurpleSslConnection *)gsc; -} - -void -purple_ssl_close(PurpleSslConnection *gsc) -{ - PurpleSslOps *ops; - - g_return_if_fail(gsc != NULL); - - purple_request_close_with_handle(gsc); - purple_notify_close_with_handle(gsc); - - ops = purple_ssl_get_ops(); - (ops->close)(gsc); - - if (gsc->connect_data != NULL) - purple_proxy_connect_cancel(gsc->connect_data); - - if (gsc->inpa > 0) - purple_input_remove(gsc->inpa); - - if (gsc->fd >= 0) - close(gsc->fd); - - g_free(gsc->host); - g_free(gsc); -} - -size_t -purple_ssl_read(PurpleSslConnection *gsc, void *data, size_t len) -{ - PurpleSslOps *ops; - - g_return_val_if_fail(gsc != NULL, 0); - g_return_val_if_fail(data != NULL, 0); - g_return_val_if_fail(len > 0, 0); - - ops = purple_ssl_get_ops(); - return (ops->read)(gsc, data, len); -} - -size_t -purple_ssl_write(PurpleSslConnection *gsc, const void *data, size_t len) -{ - PurpleSslOps *ops; - - g_return_val_if_fail(gsc != NULL, 0); - g_return_val_if_fail(data != NULL, 0); - g_return_val_if_fail(len > 0, 0); - - ops = purple_ssl_get_ops(); - return (ops->write)(gsc, data, len); -} - -GList * -purple_ssl_get_peer_certificates(PurpleSslConnection *gsc) -{ - PurpleSslOps *ops; - - g_return_val_if_fail(gsc != NULL, NULL); - - ops = purple_ssl_get_ops(); - return (ops->get_peer_certificates)(gsc); -} - -void -purple_ssl_set_ops(PurpleSslOps *ops) -{ - _ssl_ops = ops; -} - -PurpleSslOps * -purple_ssl_get_ops(void) -{ - return _ssl_ops; -} - -void -purple_ssl_init(void) -{ - /* Although purple_ssl_is_supported will do the initialization on - command, SSL plugins tend to register CertificateSchemes as well - as providing SSL ops. */ - if (!ssl_init()) { - purple_debug_error("sslconn", "Unable to initialize SSL.\n"); - } -} - -void -purple_ssl_uninit(void) -{ - PurpleSslOps *ops; - - if (!_ssl_initialized) - return; - - ops = purple_ssl_get_ops(); - ops->uninit(); - - _ssl_initialized = FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/sslconn.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,343 +0,0 @@ -/** - * @file sslconn.h SSL API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_SSLCONN_H_ -#define _PURPLE_SSLCONN_H_ - -/** Possible SSL errors. */ -typedef enum -{ - PURPLE_SSL_HANDSHAKE_FAILED = 1, - PURPLE_SSL_CONNECT_FAILED = 2, - PURPLE_SSL_CERTIFICATE_INVALID = 3 -} PurpleSslErrorType; - -#include "certificate.h" -#include "proxy.h" - -#define PURPLE_SSL_DEFAULT_PORT 443 - -/** @copydoc _PurpleSslConnection */ -typedef struct _PurpleSslConnection PurpleSslConnection; - -typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, - PurpleInputCondition); -typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, - gpointer); - -struct _PurpleSslConnection -{ - /** Hostname to which the SSL connection will be made */ - char *host; - /** Port to connect to */ - int port; - /** Data to pass to PurpleSslConnection::connect_cb() */ - void *connect_cb_data; - /** Callback triggered once the SSL handshake is complete */ - PurpleSslInputFunction connect_cb; - /** Callback triggered if there is an error during connection */ - PurpleSslErrorFunction error_cb; - /** Data passed to PurpleSslConnection::recv_cb() */ - void *recv_cb_data; - /** User-defined callback executed when the SSL connection receives data */ - PurpleSslInputFunction recv_cb; - - /** File descriptor used to refer to the socket */ - int fd; - /** Glib event source ID; used to refer to the received data callback - * in the glib eventloop */ - guint inpa; - /** Data related to the underlying TCP connection */ - PurpleProxyConnectData *connect_data; - - /** Internal connection data managed by the SSL backend (GnuTLS/LibNSS/whatever) */ - void *private_data; - - /** Verifier to use in authenticating the peer */ - PurpleCertificateVerifier *verifier; -}; - -/** - * SSL implementation operations structure. - * - * Every SSL implementation must provide all of these and register it via purple_ssl_set_ops() - * These should not be called directly! Instead, use the purple_ssl_* functions. - */ -typedef struct -{ - /** Initializes the SSL system provided. - * @return @a TRUE if initialization succeeded - * @see purple_ssl_init - */ - gboolean (*init)(void); - /** Unloads the SSL system. Inverse of PurpleSslOps::init. - * @see purple_ssl_uninit - */ - void (*uninit)(void); - /** Sets up the SSL connection for a #PurpleSslConnection once - * the TCP connection has been established - * @see purple_ssl_connect - */ - void (*connectfunc)(PurpleSslConnection *gsc); - /** Destroys the internal data of the SSL connection provided. - * Freeing gsc itself is left to purple_ssl_close() - * @see purple_ssl_close - */ - void (*close)(PurpleSslConnection *gsc); - /** Reads data from a connection (like POSIX read()) - * @param gsc Connection context - * @param data Pointer to buffer to drop data into - * @param len Maximum number of bytes to read - * @return Number of bytes actually written into @a data (which may be - * less than @a len), or <0 on error - * @see purple_ssl_read - */ - size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len); - /** Writes data to a connection (like POSIX send()) - * @param gsc Connection context - * @param data Data buffer to send data from - * @param len Number of bytes to send from buffer - * @return The number of bytes written to @a data (may be less than - * @a len) or <0 on error - * @see purple_ssl_write - */ - size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); - /** Obtains the certificate chain provided by the peer - * - * @param gsc Connection context - * @return A newly allocated list containing the certificates - * the peer provided. - * @see PurpleCertificate - * @todo Decide whether the ordering of certificates in this - * list can be guaranteed. - */ - GList * (* get_peer_certificates)(PurpleSslConnection * gsc); - - void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); - void (*_purple_reserved4)(void); -} PurpleSslOps; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name SSL API */ -/**************************************************************************/ -/*@{*/ - -/** - * Returns whether or not SSL is currently supported. - * - * @return @a TRUE if SSL is supported, or @a FALSE otherwise. - */ -gboolean purple_ssl_is_supported(void); - -/** - * Returns a human-readable string for an SSL error. - * - * @param error Error code - * @return Human-readable error explanation - */ -const gchar * purple_ssl_strerror(PurpleSslErrorType error); - -/** - * Makes a SSL connection to the specified host and port. The caller - * should keep track of the returned value and use it to cancel the - * connection, if needed. - * - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. This function - * should NOT call purple_ssl_close(). In - * the event of an error the #PurpleSslConnection will be - * destroyed for you. - * @param data User-defined data. - * - * @return The SSL connection handle. - */ -PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host, - int port, PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data); - -/** - * Makes a SSL connection to the specified host and port, using the separate - * name to verify with the certificate. The caller should keep track of the - * returned value and use it to cancel the connection, if needed. - * - * @param account The account making the connection. - * @param host The destination host. - * @param port The destination port. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. This function - * should NOT call purple_ssl_close(). In - * the event of an error the #PurpleSslConnection will be - * destroyed for you. - * @param ssl_host The hostname of the other peer (to verify the CN) - * @param data User-defined data. - * - * @return The SSL connection handle. - * @since 2.6.0 - */ -PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, - int port, PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - const char *ssl_host, - void *data); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_SSLCONN_C_) -/** - * Makes a SSL connection using an already open file descriptor. - * - * @deprecated Use purple_ssl_connect_with_host_fd() instead. - * - * @param account The account making the connection. - * @param fd The file descriptor. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. - * @param data User-defined data. - * - * @return The SSL connection handle. - */ -PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - void *data); -#endif - -/** - * Makes a SSL connection using an already open file descriptor. - * - * @param account The account making the connection. - * @param fd The file descriptor. - * @param func The SSL input handler function. - * @param error_func The SSL error handler function. - * @param host The hostname of the other peer (to verify the CN) - * @param data User-defined data. - * - * @return The SSL connection handle. - * - * @since 2.2.0 - */ -PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, - PurpleSslInputFunction func, - PurpleSslErrorFunction error_func, - const char *host, - void *data); - -/** - * Adds an input watcher for the specified SSL connection. - * Once the SSL handshake is complete, use this to watch for actual data across it. - * - * @param gsc The SSL connection handle. - * @param func The callback function. - * @param data User-defined data. - */ -void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, - void *data); - -/** - * Closes a SSL connection. - * - * @param gsc The SSL connection to close. - */ -void purple_ssl_close(PurpleSslConnection *gsc); - -/** - * Reads data from an SSL connection. - * - * @param gsc The SSL connection handle. - * @param buffer The destination buffer. - * @param len The maximum number of bytes to read. - * - * @return The number of bytes read. - */ -size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len); - -/** - * Writes data to an SSL connection. - * - * @param gsc The SSL connection handle. - * @param buffer The buffer to write. - * @param len The length of the data to write. - * - * @return The number of bytes written. - */ -size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len); - -/** - * Obtains the peer's presented certificates - * - * @param gsc The SSL connection handle - * - * @return The peer certificate chain, in the order of certificate, issuer, - * issuer's issuer, etc. @a NULL if no certificates have been provided, - * - * @since 2.2.0 - */ -GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); - -/*@}*/ - -/**************************************************************************/ -/** @name Subsystem API */ -/**************************************************************************/ -/*@{*/ - -/** - * Sets the current SSL operations structure. - * - * @param ops The SSL operations structure to assign. - */ -void purple_ssl_set_ops(PurpleSslOps *ops); - -/** - * Returns the current SSL operations structure. - * - * @return The SSL operations structure. - */ -PurpleSslOps *purple_ssl_get_ops(void); - -/** - * Initializes the SSL subsystem. - */ -void purple_ssl_init(void); - -/** - * Uninitializes the SSL subsystem. - */ -void purple_ssl_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_SSLCONN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1718 +0,0 @@ -/** - * @file status.c Status API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#define _PURPLE_STATUS_C_ - -#include "internal.h" - -#include "blist.h" -#include "core.h" -#include "dbus-maybe.h" -#include "debug.h" -#include "notify.h" -#include "prefs.h" -#include "status.h" - -/** - * A type of status. - */ -struct _PurpleStatusType -{ - PurpleStatusPrimitive primitive; - - char *id; - char *name; - char *primary_attr_id; - - gboolean saveable; - gboolean user_settable; - gboolean independent; - - GList *attrs; -}; - -/** - * A status attribute. - */ -struct _PurpleStatusAttr -{ - char *id; - char *name; - PurpleValue *value_type; -}; - -/** - * A list of statuses. - */ -struct _PurplePresence -{ - PurplePresenceContext context; - - gboolean idle; - time_t idle_time; - time_t login_time; - - GList *statuses; - GHashTable *status_table; - - PurpleStatus *active_status; - - union - { - PurpleAccount *account; - - struct - { - PurpleConversation *conv; - char *user; - - } chat; - - struct - { - PurpleAccount *account; - char *name; - PurpleBuddy *buddy; - - } buddy; - - } u; -}; - -/** - * An active status. - */ -struct _PurpleStatus -{ - PurpleStatusType *type; - PurplePresence *presence; - - gboolean active; - - /* - * The current values of the attributes for this status. The - * key is a string containing the name of the attribute. It is - * a borrowed reference from the list of attrs in the - * PurpleStatusType. The value is a PurpleValue. - */ - GHashTable *attr_values; -}; - -typedef struct -{ - PurpleAccount *account; - char *name; -} PurpleStatusBuddyKey; - -static int primitive_scores[] = -{ - 0, /* unset */ - -500, /* offline */ - 100, /* available */ - -75, /* unavailable */ - -50, /* invisible */ - -100, /* away */ - -200, /* extended away */ - -400, /* mobile */ - 0, /* tune */ - -10, /* idle, special case. */ - -5, /* idle time, special case. */ - 10 /* Offline messageable */ -}; - -#define SCORE_IDLE 9 -#define SCORE_IDLE_TIME 10 -#define SCORE_OFFLINE_MESSAGE 11 - -/************************************************************************** - * PurpleStatusPrimitive API - **************************************************************************/ -static struct PurpleStatusPrimitiveMap -{ - PurpleStatusPrimitive type; - const char *id; - const char *name; - -} const status_primitive_map[] = -{ - { PURPLE_STATUS_UNSET, "unset", N_("Unset") }, - { PURPLE_STATUS_OFFLINE, "offline", N_("Offline") }, - { PURPLE_STATUS_AVAILABLE, "available", N_("Available") }, - { PURPLE_STATUS_UNAVAILABLE, "unavailable", N_("Do not disturb") }, - { PURPLE_STATUS_INVISIBLE, "invisible", N_("Invisible") }, - { PURPLE_STATUS_AWAY, "away", N_("Away") }, - { PURPLE_STATUS_EXTENDED_AWAY, "extended_away", N_("Extended away") }, - { PURPLE_STATUS_MOBILE, "mobile", N_("Mobile") }, - { PURPLE_STATUS_TUNE, "tune", N_("Listening to music") } -}; - -const char * -purple_primitive_get_id_from_type(PurpleStatusPrimitive type) -{ - int i; - - for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) - { - if (type == status_primitive_map[i].type) - return status_primitive_map[i].id; - } - - return status_primitive_map[0].id; -} - -const char * -purple_primitive_get_name_from_type(PurpleStatusPrimitive type) -{ - int i; - - for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) - { - if (type == status_primitive_map[i].type) - return _(status_primitive_map[i].name); - } - - return _(status_primitive_map[0].name); -} - -PurpleStatusPrimitive -purple_primitive_get_type_from_id(const char *id) -{ - int i; - - g_return_val_if_fail(id != NULL, PURPLE_STATUS_UNSET); - - for (i = 0; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) - { - if (purple_strequal(id, status_primitive_map[i].id)) - return status_primitive_map[i].type; - } - - return status_primitive_map[0].type; -} - - -/************************************************************************** - * PurpleStatusType API - **************************************************************************/ -PurpleStatusType * -purple_status_type_new_full(PurpleStatusPrimitive primitive, const char *id, - const char *name, gboolean saveable, - gboolean user_settable, gboolean independent) -{ - PurpleStatusType *status_type; - - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); - - status_type = g_new0(PurpleStatusType, 1); - PURPLE_DBUS_REGISTER_POINTER(status_type, PurpleStatusType); - - status_type->primitive = primitive; - status_type->saveable = saveable; - status_type->user_settable = user_settable; - status_type->independent = independent; - - if (id != NULL) - status_type->id = g_strdup(id); - else - status_type->id = g_strdup(purple_primitive_get_id_from_type(primitive)); - - if (name != NULL) - status_type->name = g_strdup(name); - else - status_type->name = g_strdup(purple_primitive_get_name_from_type(primitive)); - - return status_type; -} - -PurpleStatusType * -purple_status_type_new(PurpleStatusPrimitive primitive, const char *id, - const char *name, gboolean user_settable) -{ - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); - - return purple_status_type_new_full(primitive, id, name, TRUE, - user_settable, FALSE); -} - -PurpleStatusType * -purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, - const char *id, const char *name, - gboolean saveable, gboolean user_settable, - gboolean independent, const char *attr_id, - const char *attr_name, PurpleValue *attr_value, - ...) -{ - PurpleStatusType *status_type; - va_list args; - - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, NULL); - g_return_val_if_fail(attr_id != NULL, NULL); - g_return_val_if_fail(attr_name != NULL, NULL); - g_return_val_if_fail(attr_value != NULL, NULL); - - status_type = purple_status_type_new_full(primitive, id, name, saveable, - user_settable, independent); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, attr_id, attr_name, attr_value); - - va_start(args, attr_value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); - - return status_type; -} - -void -purple_status_type_destroy(PurpleStatusType *status_type) -{ - g_return_if_fail(status_type != NULL); - - g_free(status_type->id); - g_free(status_type->name); - g_free(status_type->primary_attr_id); - - g_list_foreach(status_type->attrs, (GFunc)purple_status_attr_destroy, NULL); - g_list_free(status_type->attrs); - - PURPLE_DBUS_UNREGISTER_POINTER(status_type); - g_free(status_type); -} - -void -purple_status_type_set_primary_attr(PurpleStatusType *status_type, const char *id) -{ - g_return_if_fail(status_type != NULL); - - g_free(status_type->primary_attr_id); - status_type->primary_attr_id = g_strdup(id); -} - -void -purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value) -{ - PurpleStatusAttr *attr; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - attr = purple_status_attr_new(id, name, value); - - status_type->attrs = g_list_append(status_type->attrs, attr); -} - -void -purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args) -{ - const char *id, *name; - PurpleValue *value; - - g_return_if_fail(status_type != NULL); - - while ((id = va_arg(args, const char *)) != NULL) - { - name = va_arg(args, const char *); - g_return_if_fail(name != NULL); - - value = va_arg(args, PurpleValue *); - g_return_if_fail(value != NULL); - - purple_status_type_add_attr(status_type, id, name, value); - } -} - -void -purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) -{ - va_list args; - - g_return_if_fail(status_type != NULL); - g_return_if_fail(id != NULL); - g_return_if_fail(name != NULL); - g_return_if_fail(value != NULL); - - /* Add the first attribute */ - purple_status_type_add_attr(status_type, id, name, value); - - va_start(args, value); - purple_status_type_add_attrs_vargs(status_type, args); - va_end(args); -} - -PurpleStatusPrimitive -purple_status_type_get_primitive(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, PURPLE_STATUS_UNSET); - - return status_type->primitive; -} - -const char * -purple_status_type_get_id(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->id; -} - -const char * -purple_status_type_get_name(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->name; -} - -gboolean -purple_status_type_is_saveable(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return status_type->saveable; -} - -gboolean -purple_status_type_is_user_settable(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return status_type->user_settable; -} - -gboolean -purple_status_type_is_independent(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return status_type->independent; -} - -gboolean -purple_status_type_is_exclusive(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, FALSE); - - return !status_type->independent; -} - -gboolean -purple_status_type_is_available(const PurpleStatusType *status_type) -{ - PurpleStatusPrimitive primitive; - - g_return_val_if_fail(status_type != NULL, FALSE); - - primitive = purple_status_type_get_primitive(status_type); - - return (primitive == PURPLE_STATUS_AVAILABLE); -} - -const char * -purple_status_type_get_primary_attr(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->primary_attr_id; -} - -PurpleStatusAttr * -purple_status_type_get_attr(const PurpleStatusType *status_type, const char *id) -{ - GList *l; - - g_return_val_if_fail(status_type != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - for (l = status_type->attrs; l != NULL; l = l->next) - { - PurpleStatusAttr *attr = (PurpleStatusAttr *)l->data; - - if (purple_strequal(purple_status_attr_get_id(attr), id)) - return attr; - } - - return NULL; -} - -GList * -purple_status_type_get_attrs(const PurpleStatusType *status_type) -{ - g_return_val_if_fail(status_type != NULL, NULL); - - return status_type->attrs; -} - -const PurpleStatusType * -purple_status_type_find_with_id(GList *status_types, const char *id) -{ - PurpleStatusType *status_type; - - g_return_val_if_fail(id != NULL, NULL); - - while (status_types != NULL) - { - status_type = status_types->data; - - if (purple_strequal(id, status_type->id)) - return status_type; - - status_types = status_types->next; - } - - return NULL; -} - - -/************************************************************************** -* PurpleStatusAttr API -**************************************************************************/ -PurpleStatusAttr * -purple_status_attr_new(const char *id, const char *name, PurpleValue *value_type) -{ - PurpleStatusAttr *attr; - - g_return_val_if_fail(id != NULL, NULL); - g_return_val_if_fail(name != NULL, NULL); - g_return_val_if_fail(value_type != NULL, NULL); - - attr = g_new0(PurpleStatusAttr, 1); - PURPLE_DBUS_REGISTER_POINTER(attr, PurpleStatusAttr); - - attr->id = g_strdup(id); - attr->name = g_strdup(name); - attr->value_type = value_type; - - return attr; -} - -void -purple_status_attr_destroy(PurpleStatusAttr *attr) -{ - g_return_if_fail(attr != NULL); - - g_free(attr->id); - g_free(attr->name); - - purple_value_destroy(attr->value_type); - - PURPLE_DBUS_UNREGISTER_POINTER(attr); - g_free(attr); -} - -const char * -purple_status_attr_get_id(const PurpleStatusAttr *attr) -{ - g_return_val_if_fail(attr != NULL, NULL); - - return attr->id; -} - -const char * -purple_status_attr_get_name(const PurpleStatusAttr *attr) -{ - g_return_val_if_fail(attr != NULL, NULL); - - return attr->name; -} - -PurpleValue * -purple_status_attr_get_value(const PurpleStatusAttr *attr) -{ - g_return_val_if_fail(attr != NULL, NULL); - - return attr->value_type; -} - - -/************************************************************************** -* PurpleStatus API -**************************************************************************/ -PurpleStatus * -purple_status_new(PurpleStatusType *status_type, PurplePresence *presence) -{ - PurpleStatus *status; - GList *l; - - g_return_val_if_fail(status_type != NULL, NULL); - g_return_val_if_fail(presence != NULL, NULL); - - status = g_new0(PurpleStatus, 1); - PURPLE_DBUS_REGISTER_POINTER(status, PurpleStatus); - - status->type = status_type; - status->presence = presence; - - status->attr_values = - g_hash_table_new_full(g_str_hash, g_str_equal, NULL, - (GDestroyNotify)purple_value_destroy); - - for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) - { - PurpleStatusAttr *attr = (PurpleStatusAttr *)l->data; - PurpleValue *value = purple_status_attr_get_value(attr); - PurpleValue *new_value = purple_value_dup(value); - - g_hash_table_insert(status->attr_values, - (char *)purple_status_attr_get_id(attr), - new_value); - } - - return status; -} - -/* - * TODO: If the PurpleStatus is in a PurplePresence, then - * remove it from the PurplePresence? - */ -void -purple_status_destroy(PurpleStatus *status) -{ - g_return_if_fail(status != NULL); - - g_hash_table_destroy(status->attr_values); - - PURPLE_DBUS_UNREGISTER_POINTER(status); - g_free(status); -} - -static void -notify_buddy_status_update(PurpleBuddy *buddy, PurplePresence *presence, - PurpleStatus *old_status, PurpleStatus *new_status) -{ - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - time_t current_time = time(NULL); - const char *buddy_alias = purple_buddy_get_alias(buddy); - char *tmp, *logtmp; - PurpleLog *log; - - if (old_status != NULL) - { - tmp = g_strdup_printf(_("%s (%s) changed status from %s to %s"), buddy_alias, - purple_buddy_get_name(buddy), - purple_status_get_name(old_status), - purple_status_get_name(new_status)); - logtmp = g_markup_escape_text(tmp, -1); - } - else - { - /* old_status == NULL when an independent status is toggled. */ - - if (purple_status_is_active(new_status)) - { - tmp = g_strdup_printf(_("%s (%s) is now %s"), buddy_alias, - purple_buddy_get_name(buddy), - purple_status_get_name(new_status)); - logtmp = g_markup_escape_text(tmp, -1); - } - else - { - tmp = g_strdup_printf(_("%s (%s) is no longer %s"), buddy_alias, - purple_buddy_get_name(buddy), - purple_status_get_name(new_status)); - logtmp = g_markup_escape_text(tmp, -1); - } - } - - log = purple_account_get_log(purple_buddy_get_account(buddy), FALSE); - if (log != NULL) - { - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, buddy_alias, - current_time, logtmp); - } - - g_free(tmp); - g_free(logtmp); - } -} - -static void -notify_status_update(PurplePresence *presence, PurpleStatus *old_status, - PurpleStatus *new_status) -{ - PurplePresenceContext context = purple_presence_get_context(presence); - - if (context == PURPLE_PRESENCE_CONTEXT_ACCOUNT) - { - PurpleAccount *account = purple_presence_get_account(presence); - PurpleAccountUiOps *ops = purple_accounts_get_ui_ops(); - - if (purple_account_get_enabled(account, purple_core_get_ui())) - purple_prpl_change_account_status(account, old_status, new_status); - - if (ops != NULL && ops->status_changed != NULL) - { - ops->status_changed(account, new_status); - } - } - else if (context == PURPLE_PRESENCE_CONTEXT_BUDDY) - { - notify_buddy_status_update(purple_presence_get_buddy(presence), presence, - old_status, new_status); - } -} - -static void -status_has_changed(PurpleStatus *status) -{ - PurplePresence *presence; - PurpleStatus *old_status; - - presence = purple_status_get_presence(status); - - /* - * If this status is exclusive, then we must be setting it to "active." - * Since we are setting it to active, we want to set the currently - * active status to "inactive." - */ - if (purple_status_is_exclusive(status)) - { - old_status = purple_presence_get_active_status(presence); - if (old_status != NULL && (old_status != status)) - old_status->active = FALSE; - presence->active_status = status; - } - else - old_status = NULL; - - notify_status_update(presence, old_status, status); -} - -void -purple_status_set_active(PurpleStatus *status, gboolean active) -{ - purple_status_set_active_with_attrs_list(status, active, NULL); -} - -/* - * This used to parse the va_list directly, but now it creates a GList - * and passes it to purple_status_set_active_with_attrs_list(). That - * function was created because accounts.c needs to pass a GList of - * attributes to the status API. - */ -void -purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, va_list args) -{ - GList *attrs = NULL; - const gchar *id; - gpointer data; - - while ((id = va_arg(args, const char *)) != NULL) - { - attrs = g_list_append(attrs, (char *)id); - data = va_arg(args, void *); - attrs = g_list_append(attrs, data); - } - purple_status_set_active_with_attrs_list(status, active, attrs); - g_list_free(attrs); -} - -void -purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, - GList *attrs) -{ - gboolean changed = FALSE; - GList *l; - GList *specified_attr_ids = NULL; - PurpleStatusType *status_type; - - g_return_if_fail(status != NULL); - - if (!active && purple_status_is_exclusive(status)) - { - purple_debug_error("status", - "Cannot deactivate an exclusive status (%s).\n", - purple_status_get_id(status)); - return; - } - - if (status->active != active) - { - changed = TRUE; - } - - status->active = active; - - /* Set any attributes */ - l = attrs; - while (l != NULL) - { - const gchar *id; - PurpleValue *value; - - id = l->data; - l = l->next; - value = purple_status_get_attr_value(status, id); - if (value == NULL) - { - purple_debug_warning("status", "The attribute \"%s\" on the status \"%s\" is " - "not supported.\n", id, status->type->name); - /* Skip over the data and move on to the next attribute */ - l = l->next; - continue; - } - - specified_attr_ids = g_list_prepend(specified_attr_ids, (gpointer)id); - - if (value->type == PURPLE_TYPE_STRING) - { - const gchar *string_data = l->data; - l = l->next; - if (purple_strequal(string_data, value->data.string_data)) - continue; - purple_status_set_attr_string(status, id, string_data); - changed = TRUE; - } - else if (value->type == PURPLE_TYPE_INT) - { - int int_data = GPOINTER_TO_INT(l->data); - l = l->next; - if (int_data == value->data.int_data) - continue; - purple_status_set_attr_int(status, id, int_data); - changed = TRUE; - } - else if (value->type == PURPLE_TYPE_BOOLEAN) - { - gboolean boolean_data = GPOINTER_TO_INT(l->data); - l = l->next; - if (boolean_data == value->data.boolean_data) - continue; - purple_status_set_attr_boolean(status, id, boolean_data); - changed = TRUE; - } - else - { - /* We don't know what the data is--skip over it */ - l = l->next; - } - } - - /* Reset any unspecified attributes to their default value */ - status_type = purple_status_get_type(status); - l = purple_status_type_get_attrs(status_type); - while (l != NULL) { - PurpleStatusAttr *attr; - - attr = l->data; - l = l->next; - - if (!g_list_find_custom(specified_attr_ids, attr->id, (GCompareFunc)strcmp)) { - PurpleValue *default_value; - default_value = purple_status_attr_get_value(attr); - if (default_value->type == PURPLE_TYPE_STRING) { - const char *cur = purple_status_get_attr_string(status, attr->id); - const char *def = purple_value_get_string(default_value); - if ((cur == NULL && def == NULL) - || (cur != NULL && def != NULL - && !strcmp(cur, def))) { - continue; - } - - purple_status_set_attr_string(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_INT) { - int cur = purple_status_get_attr_int(status, attr->id); - int def = purple_value_get_int(default_value); - if (cur == def) - continue; - - purple_status_set_attr_int(status, attr->id, def); - } else if (default_value->type == PURPLE_TYPE_BOOLEAN) { - gboolean cur = purple_status_get_attr_boolean(status, attr->id); - gboolean def = purple_value_get_boolean(default_value); - if (cur == def) - continue; - - purple_status_set_attr_boolean(status, attr->id, def); - } - changed = TRUE; - } - } - g_list_free(specified_attr_ids); - - if (!changed) - return; - status_has_changed(status); -} - -void -purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_BOOLEAN); - - purple_value_set_boolean(attr_value, value); -} - -void -purple_status_set_attr_int(PurpleStatus *status, const char *id, int value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - g_return_if_fail(attr_value != NULL); - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_INT); - - purple_value_set_int(attr_value, value); -} - -void -purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value) -{ - PurpleValue *attr_value; - - g_return_if_fail(status != NULL); - g_return_if_fail(id != NULL); - - /* Make sure this attribute exists and is the correct type. */ - attr_value = purple_status_get_attr_value(status, id); - /* This used to be g_return_if_fail, but it's failing a LOT, so - * let's generate a log error for now. */ - /* g_return_if_fail(attr_value != NULL); */ - if (attr_value == NULL) { - purple_debug_error("status", - "Attempted to set status attribute '%s' for " - "status '%s', which is not legal. Fix " - "this!\n", id, - purple_status_type_get_name(purple_status_get_type(status))); - return; - } - g_return_if_fail(purple_value_get_type(attr_value) == PURPLE_TYPE_STRING); - - /* XXX: Check if the value has actually changed. If it has, and the status - * is active, should this trigger 'status_has_changed'? */ - purple_value_set_string(attr_value, value); -} - -PurpleStatusType * -purple_status_get_type(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return status->type; -} - -PurplePresence * -purple_status_get_presence(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return status->presence; -} - -const char * -purple_status_get_id(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return purple_status_type_get_id(purple_status_get_type(status)); -} - -const char * -purple_status_get_name(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, NULL); - - return purple_status_type_get_name(purple_status_get_type(status)); -} - -gboolean -purple_status_is_independent(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return purple_status_type_is_independent(purple_status_get_type(status)); -} - -gboolean -purple_status_is_exclusive(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return purple_status_type_is_exclusive(purple_status_get_type(status)); -} - -gboolean -purple_status_is_available(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return purple_status_type_is_available(purple_status_get_type(status)); -} - -gboolean -purple_status_is_active(const PurpleStatus *status) -{ - g_return_val_if_fail(status != NULL, FALSE); - - return status->active; -} - -gboolean -purple_status_is_online(const PurpleStatus *status) -{ - PurpleStatusPrimitive primitive; - - g_return_val_if_fail( status != NULL, FALSE); - - primitive = purple_status_type_get_primitive(purple_status_get_type(status)); - - return (primitive != PURPLE_STATUS_UNSET && - primitive != PURPLE_STATUS_OFFLINE); -} - -PurpleValue * -purple_status_get_attr_value(const PurpleStatus *status, const char *id) -{ - g_return_val_if_fail(status != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - return (PurpleValue *)g_hash_table_lookup(status->attr_values, id); -} - -gboolean -purple_status_get_attr_boolean(const PurpleStatus *status, const char *id) -{ - const PurpleValue *value; - - g_return_val_if_fail(status != NULL, FALSE); - g_return_val_if_fail(id != NULL, FALSE); - - if ((value = purple_status_get_attr_value(status, id)) == NULL) - return FALSE; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN, FALSE); - - return purple_value_get_boolean(value); -} - -int -purple_status_get_attr_int(const PurpleStatus *status, const char *id) -{ - const PurpleValue *value; - - g_return_val_if_fail(status != NULL, 0); - g_return_val_if_fail(id != NULL, 0); - - if ((value = purple_status_get_attr_value(status, id)) == NULL) - return 0; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_INT, 0); - - return purple_value_get_int(value); -} - -const char * -purple_status_get_attr_string(const PurpleStatus *status, const char *id) -{ - const PurpleValue *value; - - g_return_val_if_fail(status != NULL, NULL); - g_return_val_if_fail(id != NULL, NULL); - - if ((value = purple_status_get_attr_value(status, id)) == NULL) - return NULL; - - g_return_val_if_fail(purple_value_get_type(value) == PURPLE_TYPE_STRING, NULL); - - return purple_value_get_string(value); -} - -gint -purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2) -{ - PurpleStatusType *type1, *type2; - int score1 = 0, score2 = 0; - - if ((status1 == NULL && status2 == NULL) || - (status1 == status2)) - { - return 0; - } - else if (status1 == NULL) - return 1; - else if (status2 == NULL) - return -1; - - type1 = purple_status_get_type(status1); - type2 = purple_status_get_type(status2); - - if (purple_status_is_active(status1)) - score1 = primitive_scores[purple_status_type_get_primitive(type1)]; - - if (purple_status_is_active(status2)) - score2 = primitive_scores[purple_status_type_get_primitive(type2)]; - - if (score1 > score2) - return -1; - else if (score1 < score2) - return 1; - - return 0; -} - - -/************************************************************************** -* PurplePresence API -**************************************************************************/ -PurplePresence * -purple_presence_new(PurplePresenceContext context) -{ - PurplePresence *presence; - - g_return_val_if_fail(context != PURPLE_PRESENCE_CONTEXT_UNSET, NULL); - - presence = g_new0(PurplePresence, 1); - PURPLE_DBUS_REGISTER_POINTER(presence, PurplePresence); - - presence->context = context; - - presence->status_table = - g_hash_table_new_full(g_str_hash, g_str_equal, - g_free, NULL); - - return presence; -} - -PurplePresence * -purple_presence_new_for_account(PurpleAccount *account) -{ - PurplePresence *presence = NULL; - g_return_val_if_fail(account != NULL, NULL); - - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_ACCOUNT); - presence->u.account = account; - presence->statuses = purple_prpl_get_statuses(account, presence); - - return presence; -} - -PurplePresence * -purple_presence_new_for_conv(PurpleConversation *conv) -{ - PurplePresence *presence; - - g_return_val_if_fail(conv != NULL, NULL); - - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_CONV); - presence->u.chat.conv = conv; - /* presence->statuses = purple_prpl_get_statuses(conv->account, presence); ? */ - - return presence; -} - -PurplePresence * -purple_presence_new_for_buddy(PurpleBuddy *buddy) -{ - PurplePresence *presence; - PurpleAccount *account; - - g_return_val_if_fail(buddy != NULL, NULL); - account = purple_buddy_get_account(buddy); - - presence = purple_presence_new(PURPLE_PRESENCE_CONTEXT_BUDDY); - - presence->u.buddy.name = g_strdup(purple_buddy_get_name(buddy)); - presence->u.buddy.account = account; - presence->statuses = purple_prpl_get_statuses(account, presence); - - presence->u.buddy.buddy = buddy; - - return presence; -} - -void -purple_presence_destroy(PurplePresence *presence) -{ - g_return_if_fail(presence != NULL); - - if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY) - { - g_free(presence->u.buddy.name); - } - else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_CONV) - { - g_free(presence->u.chat.user); - } - - g_list_foreach(presence->statuses, (GFunc)purple_status_destroy, NULL); - g_list_free(presence->statuses); - - g_hash_table_destroy(presence->status_table); - - PURPLE_DBUS_UNREGISTER_POINTER(presence); - g_free(presence); -} - -void -purple_presence_add_status(PurplePresence *presence, PurpleStatus *status) -{ - g_return_if_fail(presence != NULL); - g_return_if_fail(status != NULL); - - presence->statuses = g_list_append(presence->statuses, status); - - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); -} - -void -purple_presence_add_list(PurplePresence *presence, GList *source_list) -{ - GList *l; - - g_return_if_fail(presence != NULL); - g_return_if_fail(source_list != NULL); - - for (l = source_list; l != NULL; l = l->next) - purple_presence_add_status(presence, (PurpleStatus *)l->data); -} - -void -purple_presence_set_status_active(PurplePresence *presence, const char *status_id, - gboolean active) -{ - PurpleStatus *status; - - g_return_if_fail(presence != NULL); - g_return_if_fail(status_id != NULL); - - status = purple_presence_get_status(presence, status_id); - - g_return_if_fail(status != NULL); - /* TODO: Should we do the following? */ - /* g_return_if_fail(active == status->active); */ - - if (purple_status_is_exclusive(status)) - { - if (!active) - { - purple_debug_warning("status", - "Attempted to set a non-independent status " - "(%s) inactive. Only independent statuses " - "can be specifically marked inactive.", - status_id); - return; - } - } - - purple_status_set_active(status, active); -} - -void -purple_presence_switch_status(PurplePresence *presence, const char *status_id) -{ - purple_presence_set_status_active(presence, status_id, TRUE); -} - -static void -update_buddy_idle(PurpleBuddy *buddy, PurplePresence *presence, - time_t current_time, gboolean old_idle, gboolean idle) -{ - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - PurpleAccount *account = purple_buddy_get_account(buddy); - - if (!old_idle && idle) - { - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *tmp, *tmp2; - tmp = g_strdup_printf(_("%s became idle"), - purple_buddy_get_alias(buddy)); - tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_buddy_get_alias(buddy), current_time, tmp2); - g_free(tmp2); - } - } - } - else if (old_idle && !idle) - { - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *tmp, *tmp2; - tmp = g_strdup_printf(_("%s became unidle"), - purple_buddy_get_alias(buddy)); - tmp2 = g_markup_escape_text(tmp, -1); - g_free(tmp); - - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_buddy_get_alias(buddy), current_time, tmp2); - g_free(tmp2); - } - } - } - - if (old_idle != idle) - purple_signal_emit(purple_blist_get_handle(), "buddy-idle-changed", buddy, - old_idle, idle); - - purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy)); - - /* Should this be done here? It'd perhaps make more sense to - * connect to buddy-[un]idle signals and update from there - */ - - if (ops != NULL && ops->update != NULL) - ops->update(purple_get_blist(), (PurpleBlistNode *)buddy); -} - -void -purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_time) -{ - gboolean old_idle; - time_t current_time; - - g_return_if_fail(presence != NULL); - - if (presence->idle == idle && presence->idle_time == idle_time) - return; - - old_idle = presence->idle; - presence->idle = idle; - presence->idle_time = (idle ? idle_time : 0); - - current_time = time(NULL); - - if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_BUDDY) - { - update_buddy_idle(purple_presence_get_buddy(presence), presence, current_time, - old_idle, idle); - } - else if (purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT) - { - PurpleAccount *account; - PurpleConnection *gc = NULL; - PurplePlugin *prpl = NULL; - PurplePluginProtocolInfo *prpl_info = NULL; - - account = purple_presence_get_account(presence); - - if (purple_prefs_get_bool("/purple/logging/log_system")) - { - PurpleLog *log = purple_account_get_log(account, FALSE); - - if (log != NULL) - { - char *msg, *tmp; - - if (idle) - tmp = g_strdup_printf(_("+++ %s became idle"), purple_account_get_username(account)); - else - tmp = g_strdup_printf(_("+++ %s became unidle"), purple_account_get_username(account)); - - msg = g_markup_escape_text(tmp, -1); - g_free(tmp); - purple_log_write(log, PURPLE_MESSAGE_SYSTEM, - purple_account_get_username(account), - (idle ? idle_time : current_time), msg); - g_free(msg); - } - } - - gc = purple_account_get_connection(account); - - if(gc) - prpl = purple_connection_get_prpl(gc); - - if(PURPLE_CONNECTION_IS_CONNECTED(gc) && prpl != NULL) - prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - - if (prpl_info && prpl_info->set_idle) - prpl_info->set_idle(gc, (idle ? (current_time - idle_time) : 0)); - } -} - -void -purple_presence_set_login_time(PurplePresence *presence, time_t login_time) -{ - g_return_if_fail(presence != NULL); - - if (presence->login_time == login_time) - return; - - presence->login_time = login_time; -} - -PurplePresenceContext -purple_presence_get_context(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, PURPLE_PRESENCE_CONTEXT_UNSET); - - return presence->context; -} - -PurpleAccount * -purple_presence_get_account(const PurplePresence *presence) -{ - PurplePresenceContext context; - - g_return_val_if_fail(presence != NULL, NULL); - - context = purple_presence_get_context(presence); - - g_return_val_if_fail(context == PURPLE_PRESENCE_CONTEXT_ACCOUNT || - context == PURPLE_PRESENCE_CONTEXT_BUDDY, NULL); - - return presence->u.account; -} - -PurpleConversation * -purple_presence_get_conversation(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(purple_presence_get_context(presence) == - PURPLE_PRESENCE_CONTEXT_CONV, NULL); - - return presence->u.chat.conv; -} - -const char * -purple_presence_get_chat_user(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(purple_presence_get_context(presence) == - PURPLE_PRESENCE_CONTEXT_CONV, NULL); - - return presence->u.chat.user; -} - -PurpleBuddy * -purple_presence_get_buddy(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(purple_presence_get_context(presence) == - PURPLE_PRESENCE_CONTEXT_BUDDY, NULL); - - return presence->u.buddy.buddy; -} - -GList * -purple_presence_get_statuses(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - - return presence->statuses; -} - -PurpleStatus * -purple_presence_get_status(const PurplePresence *presence, const char *status_id) -{ - PurpleStatus *status; - GList *l = NULL; - - g_return_val_if_fail(presence != NULL, NULL); - g_return_val_if_fail(status_id != NULL, NULL); - - /* What's the purpose of this hash table? */ - status = (PurpleStatus *)g_hash_table_lookup(presence->status_table, - status_id); - - if (status == NULL) { - for (l = purple_presence_get_statuses(presence); - l != NULL && status == NULL; l = l->next) - { - PurpleStatus *temp_status = l->data; - - if (purple_strequal(status_id, purple_status_get_id(temp_status))) - status = temp_status; - } - - if (status != NULL) - g_hash_table_insert(presence->status_table, - g_strdup(purple_status_get_id(status)), status); - } - - return status; -} - -PurpleStatus * -purple_presence_get_active_status(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, NULL); - - return presence->active_status; -} - -gboolean -purple_presence_is_available(const PurplePresence *presence) -{ - PurpleStatus *status; - - g_return_val_if_fail(presence != NULL, FALSE); - - status = purple_presence_get_active_status(presence); - - return ((status != NULL && purple_status_is_available(status)) && - !purple_presence_is_idle(presence)); -} - -gboolean -purple_presence_is_online(const PurplePresence *presence) -{ - PurpleStatus *status; - - g_return_val_if_fail(presence != NULL, FALSE); - - if ((status = purple_presence_get_active_status(presence)) == NULL) - return FALSE; - - return purple_status_is_online(status); -} - -gboolean -purple_presence_is_status_active(const PurplePresence *presence, - const char *status_id) -{ - PurpleStatus *status; - - g_return_val_if_fail(presence != NULL, FALSE); - g_return_val_if_fail(status_id != NULL, FALSE); - - status = purple_presence_get_status(presence, status_id); - - return (status != NULL && purple_status_is_active(status)); -} - -gboolean -purple_presence_is_status_primitive_active(const PurplePresence *presence, - PurpleStatusPrimitive primitive) -{ - GList *l; - - g_return_val_if_fail(presence != NULL, FALSE); - g_return_val_if_fail(primitive != PURPLE_STATUS_UNSET, FALSE); - - for (l = purple_presence_get_statuses(presence); - l != NULL; l = l->next) - { - PurpleStatus *temp_status = l->data; - PurpleStatusType *type = purple_status_get_type(temp_status); - - if (purple_status_type_get_primitive(type) == primitive && - purple_status_is_active(temp_status)) - return TRUE; - } - return FALSE; -} - -gboolean -purple_presence_is_idle(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, FALSE); - - return purple_presence_is_online(presence) && presence->idle; -} - -time_t -purple_presence_get_idle_time(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, 0); - - return presence->idle_time; -} - -time_t -purple_presence_get_login_time(const PurplePresence *presence) -{ - g_return_val_if_fail(presence != NULL, 0); - - return purple_presence_is_online(presence) ? presence->login_time : 0; -} - -static int -purple_presence_compute_score(const PurplePresence *presence) -{ - GList *l; - int score = 0; - - for (l = purple_presence_get_statuses(presence); l != NULL; l = l->next) { - PurpleStatus *status = (PurpleStatus *)l->data; - PurpleStatusType *type = purple_status_get_type(status); - - if (purple_status_is_active(status)) { - score += primitive_scores[purple_status_type_get_primitive(type)]; - if (!purple_status_is_online(status)) { - PurpleBuddy *b = purple_presence_get_buddy(presence); - if (b && purple_account_supports_offline_message(purple_buddy_get_account(b), b)) - score += primitive_scores[SCORE_OFFLINE_MESSAGE]; - } - } - } - score += purple_account_get_int(purple_presence_get_account(presence), "score", 0); - if (purple_presence_is_idle(presence)) - score += primitive_scores[SCORE_IDLE]; - return score; -} - -gint -purple_presence_compare(const PurplePresence *presence1, - const PurplePresence *presence2) -{ - time_t idle_time_1, idle_time_2; - int score1 = 0, score2 = 0; - - if (presence1 == presence2) - return 0; - else if (presence1 == NULL) - return 1; - else if (presence2 == NULL) - return -1; - - if (purple_presence_is_online(presence1) && - !purple_presence_is_online(presence2)) - return -1; - else if (purple_presence_is_online(presence2) && - !purple_presence_is_online(presence1)) - return 1; - - /* Compute the score of the first set of statuses. */ - score1 = purple_presence_compute_score(presence1); - - /* Compute the score of the second set of statuses. */ - score2 = purple_presence_compute_score(presence2); - - idle_time_1 = time(NULL) - purple_presence_get_idle_time(presence1); - idle_time_2 = time(NULL) - purple_presence_get_idle_time(presence2); - - if (idle_time_1 > idle_time_2) - score1 += primitive_scores[SCORE_IDLE_TIME]; - else if (idle_time_1 < idle_time_2) - score2 += primitive_scores[SCORE_IDLE_TIME]; - - if (score1 < score2) - return 1; - else if (score1 > score2) - return -1; - - return 0; -} - - -/************************************************************************** -* Status subsystem -**************************************************************************/ -static void -score_pref_changed_cb(const char *name, PurplePrefType type, - gconstpointer value, gpointer data) -{ - int index = GPOINTER_TO_INT(data); - - primitive_scores[index] = GPOINTER_TO_INT(value); -} - -void * -purple_status_get_handle(void) { - static int handle; - - return &handle; -} - -void -purple_status_init(void) -{ - void *handle = purple_status_get_handle(); - - purple_prefs_add_none("/purple/status"); - purple_prefs_add_none("/purple/status/scores"); - - purple_prefs_add_int("/purple/status/scores/offline", - primitive_scores[PURPLE_STATUS_OFFLINE]); - purple_prefs_add_int("/purple/status/scores/available", - primitive_scores[PURPLE_STATUS_AVAILABLE]); - purple_prefs_add_int("/purple/status/scores/invisible", - primitive_scores[PURPLE_STATUS_INVISIBLE]); - purple_prefs_add_int("/purple/status/scores/away", - primitive_scores[PURPLE_STATUS_AWAY]); - purple_prefs_add_int("/purple/status/scores/extended_away", - primitive_scores[PURPLE_STATUS_EXTENDED_AWAY]); - purple_prefs_add_int("/purple/status/scores/idle", - primitive_scores[SCORE_IDLE]); - purple_prefs_add_int("/purple/status/scores/offline_msg", - primitive_scores[SCORE_OFFLINE_MESSAGE]); - - purple_prefs_connect_callback(handle, "/purple/status/scores/offline", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_OFFLINE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/available", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/invisible", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/away", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_AWAY)); - purple_prefs_connect_callback(handle, "/purple/status/scores/extended_away", - score_pref_changed_cb, - GINT_TO_POINTER(PURPLE_STATUS_EXTENDED_AWAY)); - purple_prefs_connect_callback(handle, "/purple/status/scores/idle", - score_pref_changed_cb, - GINT_TO_POINTER(SCORE_IDLE)); - purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg", - score_pref_changed_cb, - GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE)); - - purple_prefs_trigger_callback("/purple/status/scores/offline"); - purple_prefs_trigger_callback("/purple/status/scores/available"); - purple_prefs_trigger_callback("/purple/status/scores/invisible"); - purple_prefs_trigger_callback("/purple/status/scores/away"); - purple_prefs_trigger_callback("/purple/status/scores/extended_away"); - purple_prefs_trigger_callback("/purple/status/scores/idle"); - purple_prefs_trigger_callback("/purple/status/scores/offline_msg"); -} - -void -purple_status_uninit(void) -{ - purple_prefs_disconnect_by_handle(purple_prefs_get_handle()); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/status.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1094 +0,0 @@ -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_STATUS_H_ -#define _PURPLE_STATUS_H_ - -/** - * @file status.h Status API - * @ingroup core - * - * A brief explanation of the status API: - * - * PurpleStatusType's are created by each PRPL. They outline the - * available statuses of the protocol. AIM, for example, supports - * an available state with an optional available message, an away - * state with a mandatory message, and an invisible state (which is - * technically "independent" of the other two, but we'll get into - * that later). PurpleStatusTypes are very permanent. They are - * hardcoded in each PRPL and will not change often. And because - * they are hardcoded, they do not need to be saved to any XML file. - * - * A PurpleStatus can be thought of as an "instance" of a PurpleStatusType. - * If you're familiar with object-oriented programming languages - * then this should be immediately clear. Say, for example, that - * one of your AIM buddies has set himself as "away." You have a - * PurpleBuddy node for this person in your buddy list. Purple wants - * to mark this buddy as "away," so it creates a new PurpleStatus. - * The PurpleStatus has its PurpleStatusType set to the "away" state - * for the oscar PRPL. The PurpleStatus also contains the buddy's - * away message. PurpleStatuses are sometimes saved, depending on - * the context. The current PurpleStatuses associated with each of - * your accounts are saved so that the next time you start Purple, - * your accounts will be set to their last known statuses. There - * is also a list of saved statuses that are written to the - * status.xml file. Also, each PurpleStatus has a "saveable" boolean. - * If "saveable" is set to FALSE then the status is NEVER saved. - * All PurpleStatuses should be inside a PurplePresence. - * - * - * A PurpleStatus is either "independent" or "exclusive." - * Independent statuses can be active or inactive and they don't - * affect anything else. However, you can only have one exclusive - * status per PurplePresence. If you activate one exclusive status, - * then the previous exclusive status is automatically deactivated. - * - * A PurplePresence is like a collection of PurpleStatuses (plus some - * other random info). For any buddy, or for any one of your accounts, - * or for any person with which you're chatting, you may know various - * amounts of information. This information is all contained in - * one PurplePresence. If one of your buddies is away and idle, - * then the presence contains the PurpleStatus for their awayness, - * and it contains their current idle time. PurplePresences are - * never saved to disk. The information they contain is only relevant - * for the current PurpleSession. - */ - -/** - * PurpleStatusType's are created by each PRPL. They outline the - * available statuses of the protocol. AIM, for example, supports - * an available state with an optional available message, an away - * state with a mandatory message, and an invisible state (which is - * technically "independent" of the other two, but we'll get into - * that later). PurpleStatusTypes are very permanent. They are - * hardcoded in each PRPL and will not change often. And because - * they are hardcoded, they do not need to be saved to any XML file. - */ -typedef struct _PurpleStatusType PurpleStatusType; -typedef struct _PurpleStatusAttr PurpleStatusAttr; -typedef struct _PurplePresence PurplePresence; -typedef struct _PurpleStatus PurpleStatus; - -/** - * A context for a presence. - * - * The context indicates to what the presence applies. - */ -typedef enum -{ - PURPLE_PRESENCE_CONTEXT_UNSET = 0, - PURPLE_PRESENCE_CONTEXT_ACCOUNT, - PURPLE_PRESENCE_CONTEXT_CONV, - PURPLE_PRESENCE_CONTEXT_BUDDY - -} PurplePresenceContext; - -/** - * A primitive defining the basic structure of a status type. - */ -/* - * If you add a value to this enum, make sure you update - * the status_primitive_map array in status.c and the special-cases for idle - * and offline-messagable just below it. - */ -typedef enum -{ - PURPLE_STATUS_UNSET = 0, - PURPLE_STATUS_OFFLINE, - PURPLE_STATUS_AVAILABLE, - PURPLE_STATUS_UNAVAILABLE, - PURPLE_STATUS_INVISIBLE, - PURPLE_STATUS_AWAY, - PURPLE_STATUS_EXTENDED_AWAY, - PURPLE_STATUS_MOBILE, - PURPLE_STATUS_TUNE, - PURPLE_STATUS_NUM_PRIMITIVES -} PurpleStatusPrimitive; - -#include "account.h" -#include "blist.h" -#include "conversation.h" -#include "value.h" - -#define PURPLE_TUNE_ARTIST "tune_artist" -#define PURPLE_TUNE_TITLE "tune_title" -#define PURPLE_TUNE_ALBUM "tune_album" -#define PURPLE_TUNE_GENRE "tune_genre" -#define PURPLE_TUNE_COMMENT "tune_comment" -#define PURPLE_TUNE_TRACK "tune_track" -#define PURPLE_TUNE_TIME "tune_time" -#define PURPLE_TUNE_YEAR "tune_year" -#define PURPLE_TUNE_URL "tune_url" -#define PURPLE_TUNE_FULL "tune_full" - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name PurpleStatusPrimitive API */ -/**************************************************************************/ -/*@{*/ - -/** - * Lookup the id of a primitive status type based on the type. This - * ID is a unique plain-text name of the status, without spaces. - * - * @param type A primitive status type. - * - * @return The unique ID for this type. - */ -const char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type); - -/** - * Lookup the name of a primitive status type based on the type. This - * name is the plain-English name of the status type. It is usually one - * or two words. - * - * @param type A primitive status type. - * - * @return The name of this type, suitable for users to see. - */ -const char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type); - -/** - * Lookup the value of a primitive status type based on the id. The - * ID is a unique plain-text name of the status, without spaces. - * - * @param id The unique ID of a primitive status type. - * - * @return The PurpleStatusPrimitive value. - */ -PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id); - -/*@}*/ - -/**************************************************************************/ -/** @name PurpleStatusType API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new status type. - * - * @param primitive The primitive status type. - * @param id The ID of the status type, or @c NULL to use the id of - * the primitive status type. - * @param name The name presented to the user, or @c NULL to use the - * name of the primitive status type. - * @param saveable TRUE if the information set for this status by the - * user can be saved for future sessions. - * @param user_settable TRUE if this is a status the user can manually set. - * @param independent TRUE if this is an independent (non-exclusive) - * status type. - * - * @return A new status type. - */ -PurpleStatusType *purple_status_type_new_full(PurpleStatusPrimitive primitive, - const char *id, const char *name, - gboolean saveable, - gboolean user_settable, - gboolean independent); - -/** - * Creates a new status type with some default values ( - * saveable and not independent). - * - * @param primitive The primitive status type. - * @param id The ID of the status type, or @c NULL to use the id of - * the primitive status type. - * @param name The name presented to the user, or @c NULL to use the - * name of the primitive status type. - * @param user_settable TRUE if this is a status the user can manually set. - * - * @return A new status type. - */ -PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive, - const char *id, const char *name, - gboolean user_settable); - -/** - * Creates a new status type with attributes. - * - * @param primitive The primitive status type. - * @param id The ID of the status type, or @c NULL to use the id of - * the primitive status type. - * @param name The name presented to the user, or @c NULL to use the - * name of the primitive status type. - * @param saveable TRUE if the information set for this status by the - * user can be saved for future sessions. - * @param user_settable TRUE if this is a status the user can manually set. - * @param independent TRUE if this is an independent (non-exclusive) - * status type. - * @param attr_id The ID of the first attribute. - * @param attr_name The name of the first attribute. - * @param attr_value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @return A new status type. - */ -PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive, - const char *id, - const char *name, - gboolean saveable, - gboolean user_settable, - gboolean independent, - const char *attr_id, - const char *attr_name, - PurpleValue *attr_value, ...) G_GNUC_NULL_TERMINATED; - -/** - * Destroys a status type. - * - * @param status_type The status type to destroy. - */ -void purple_status_type_destroy(PurpleStatusType *status_type); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets a status type's primary attribute. - * - * The value for the primary attribute is used as the description for - * the particular status type. An example is an away message. The message - * would be the primary attribute. - * - * @param status_type The status type. - * @param attr_id The ID of the primary attribute. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_status_type_set_primary_attr(PurpleStatusType *status_type, - const char *attr_id); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds an attribute to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value The value type of this attribute. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type. - * - * @param status_type The status type to add the attribute to. - * @param id The ID of the first attribute. - * @param name The description of the first attribute. - * @param value The value type of the first attribute attribute. - * @param ... Additional attribute information. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id, - const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED; -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds multiple attributes to a status type using a va_list. - * - * @param status_type The status type to add the attribute to. - * @param args The va_list of attributes. - * - * @deprecated This function isn't needed and should be removed in 3.0.0. - * Status type attributes should be set when the status type - * is created, in the call to purple_status_type_new_with_attrs. - */ -void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, - va_list args); -#endif - -/** - * Returns the primitive type of a status type. - * - * @param status_type The status type. - * - * @return The primitive type of the status type. - */ -PurpleStatusPrimitive purple_status_type_get_primitive( - const PurpleStatusType *status_type); - -/** - * Returns the ID of a status type. - * - * @param status_type The status type. - * - * @return The ID of the status type. - */ -const char *purple_status_type_get_id(const PurpleStatusType *status_type); - -/** - * Returns the name of a status type. - * - * @param status_type The status type. - * - * @return The name of the status type. - */ -const char *purple_status_type_get_name(const PurpleStatusType *status_type); - -/** - * Returns whether or not the status type is saveable. - * - * @param status_type The status type. - * - * @return TRUE if user-defined statuses based off this type are saveable. - * FALSE otherwise. - */ -gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type); - -/** - * Returns whether or not the status type can be set or modified by the - * user. - * - * @param status_type The status type. - * - * @return TRUE if the status type can be set or modified by the user. - * FALSE if it's a protocol-set setting. - */ -gboolean purple_status_type_is_user_settable(const PurpleStatusType *status_type); - -/** - * Returns whether or not the status type is independent. - * - * Independent status types are non-exclusive. If other status types on - * the same hierarchy level are set, this one will not be affected. - * - * @param status_type The status type. - * - * @return TRUE if the status type is independent, or FALSE otherwise. - */ -gboolean purple_status_type_is_independent(const PurpleStatusType *status_type); - -/** - * Returns whether the status type is exclusive. - * - * @param status_type The status type. - * - * @return TRUE if the status type is exclusive, FALSE otherwise. - */ -gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type); - -/** - * Returns whether or not a status type is available. - * - * Available status types are online and possibly invisible, but not away. - * - * @param status_type The status type. - * - * @return TRUE if the status is available, or FALSE otherwise. - */ -gboolean purple_status_type_is_available(const PurpleStatusType *status_type); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Returns a status type's primary attribute ID. - * - * @param type The status type. - * - * @return The primary attribute's ID. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -const char *purple_status_type_get_primary_attr(const PurpleStatusType *type); -#endif - -/** - * Returns the attribute with the specified ID. - * - * @param status_type The status type containing the attribute. - * @param id The ID of the desired attribute. - * - * @return The attribute, if found. NULL otherwise. - */ -PurpleStatusAttr *purple_status_type_get_attr(const PurpleStatusType *status_type, - const char *id); - -/** - * Returns a list of all attributes in a status type. - * - * @param status_type The status type. - * - * @constreturn The list of attributes. - */ -GList *purple_status_type_get_attrs(const PurpleStatusType *status_type); - -/** - * Find the PurpleStatusType with the given id. - * - * @param status_types A list of status types. Often account->status_types. - * @param id The unique ID of the status type you wish to find. - * - * @return The status type with the given ID, or NULL if one could - * not be found. - */ -const PurpleStatusType *purple_status_type_find_with_id(GList *status_types, - const char *id); - -/*@}*/ - -/**************************************************************************/ -/** @name PurpleStatusAttr API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new status attribute. - * - * @param id The ID of the attribute. - * @param name The name presented to the user. - * @param value_type The type of data contained in the attribute. - * - * @return A new status attribute. - */ -PurpleStatusAttr *purple_status_attr_new(const char *id, const char *name, - PurpleValue *value_type); - -/** - * Destroys a status attribute. - * - * @param attr The status attribute to destroy. - */ -void purple_status_attr_destroy(PurpleStatusAttr *attr); - -/** - * Returns the ID of a status attribute. - * - * @param attr The status attribute. - * - * @return The status attribute's ID. - */ -const char *purple_status_attr_get_id(const PurpleStatusAttr *attr); - -/** - * Returns the name of a status attribute. - * - * @param attr The status attribute. - * - * @return The status attribute's name. - */ -const char *purple_status_attr_get_name(const PurpleStatusAttr *attr); - -/** - * Returns the value of a status attribute. - * - * @param attr The status attribute. - * - * @return The status attribute's value. - */ -PurpleValue *purple_status_attr_get_value(const PurpleStatusAttr *attr); - -/*@}*/ - -/**************************************************************************/ -/** @name PurpleStatus API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new status. - * - * @param status_type The type of status. - * @param presence The parent presence. - * - * @return The new status. - */ -PurpleStatus *purple_status_new(PurpleStatusType *status_type, - PurplePresence *presence); - -/** - * Destroys a status. - * - * @param status The status to destroy. - */ -void purple_status_destroy(PurpleStatus *status); - -/** - * Sets whether or not a status is active. - * - * This should only be called by the account, conversation, and buddy APIs. - * - * @param status The status. - * @param active The active state. - */ -void purple_status_set_active(PurpleStatus *status, gboolean active); - -/** - * Sets whether or not a status is active. - * - * This should only be called by the account, conversation, and buddy APIs. - * - * @param status The status. - * @param active The active state. - * @param args A list of attributes to set on the status. This list is - * composed of key/value pairs, where each key is a valid - * attribute name for this PurpleStatusType. The list should - * be NULL terminated. - */ -void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active, - va_list args); - -/** - * Sets whether or not a status is active. - * - * This should only be called by the account, conversation, and buddy APIs. - * - * @param status The status. - * @param active The active state. - * @param attrs A list of attributes to set on the status. This list is - * composed of key/value pairs, where each key is a valid - * attribute name for this PurpleStatusType. The list is - * not modified or freed by this function. - */ -void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active, - GList *attrs); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The boolean value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_boolean(PurpleStatus *status, const char *id, - gboolean value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The integer value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_int(PurpleStatus *status, const char *id, - int value); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Sets the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * @param value The string value. - * - * @deprecated This function is only used by status.c and should be made - * static in 3.0.0. - */ -void purple_status_set_attr_string(PurpleStatus *status, const char *id, - const char *value); -#endif - -/** - * Returns the status's type. - * - * @param status The status. - * - * @return The status's type. - */ -PurpleStatusType *purple_status_get_type(const PurpleStatus *status); - -/** - * Returns the status's presence. - * - * @param status The status. - * - * @return The status's presence. - */ -PurplePresence *purple_status_get_presence(const PurpleStatus *status); - -/** - * Returns the status's type ID. - * - * This is a convenience method for - * purple_status_type_get_id(purple_status_get_type(status)). - * - * @param status The status. - * - * @return The status's ID. - */ -const char *purple_status_get_id(const PurpleStatus *status); - -/** - * Returns the status's name. - * - * This is a convenience method for - * purple_status_type_get_name(purple_status_get_type(status)). - * - * @param status The status. - * - * @return The status's name. - */ -const char *purple_status_get_name(const PurpleStatus *status); - -/** - * Returns whether or not a status is independent. - * - * This is a convenience method for - * purple_status_type_is_independent(purple_status_get_type(status)). - * - * @param status The status. - * - * @return TRUE if the status is independent, or FALSE otherwise. - */ -gboolean purple_status_is_independent(const PurpleStatus *status); - -/** - * Returns whether or not a status is exclusive. - * - * This is a convenience method for - * purple_status_type_is_exclusive(purple_status_get_type(status)). - * - * @param status The status. - * - * @return TRUE if the status is exclusive, FALSE otherwise. - */ -gboolean purple_status_is_exclusive(const PurpleStatus *status); - -/** - * Returns whether or not a status is available. - * - * Available statuses are online and possibly invisible, but not away or idle. - * - * This is a convenience method for - * purple_status_type_is_available(purple_status_get_type(status)). - * - * @param status The status. - * - * @return TRUE if the status is available, or FALSE otherwise. - */ -gboolean purple_status_is_available(const PurpleStatus *status); - -/** - * Returns the active state of a status. - * - * @param status The status. - * - * @return The active state of the status. - */ -gboolean purple_status_is_active(const PurpleStatus *status); - -/** - * Returns whether or not a status is considered 'online' - * - * @param status The status. - * - * @return TRUE if the status is considered online, FALSE otherwise - */ -gboolean purple_status_is_online(const PurpleStatus *status); - -/** - * Returns the value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The value of the attribute. - */ -PurpleValue *purple_status_get_attr_value(const PurpleStatus *status, - const char *id); - -/** - * Returns the boolean value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The boolean value of the attribute. - */ -gboolean purple_status_get_attr_boolean(const PurpleStatus *status, - const char *id); - -/** - * Returns the integer value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The integer value of the attribute. - */ -int purple_status_get_attr_int(const PurpleStatus *status, const char *id); - -/** - * Returns the string value of an attribute in a status with the specified ID. - * - * @param status The status. - * @param id The attribute ID. - * - * @return The string value of the attribute. - */ -const char *purple_status_get_attr_string(const PurpleStatus *status, - const char *id); - -/** - * Compares two statuses for availability. - * - * @param status1 The first status. - * @param status2 The second status. - * - * @return -1 if @a status1 is more available than @a status2. - * 0 if @a status1 is equal to @a status2. - * 1 if @a status2 is more available than @a status1. - */ -gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2); - -/*@}*/ - -/**************************************************************************/ -/** @name PurplePresence API */ -/**************************************************************************/ -/*@{*/ - -/** - * Creates a new presence. - * - * @param context The presence context. - * - * @return A new presence. - */ -PurplePresence *purple_presence_new(PurplePresenceContext context); - -/** - * Creates a presence for an account. - * - * @param account The account. - * - * @return The new presence. - */ -PurplePresence *purple_presence_new_for_account(PurpleAccount *account); - -/** - * Creates a presence for a conversation. - * - * @param conv The conversation. - * - * @return The new presence. - */ -PurplePresence *purple_presence_new_for_conv(PurpleConversation *conv); - -/** - * Creates a presence for a buddy. - * - * @param buddy The buddy. - * - * @return The new presence. - */ -PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy); - -/** - * Destroys a presence. - * - * All statuses added to this list will be destroyed along with - * the presence. - * - * @param presence The presence to destroy. - */ -void purple_presence_destroy(PurplePresence *presence); - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a status to a presence. - * - * @param presence The presence. - * @param status The status to add. - * - * @deprecated This function is only used by purple_presence_add_list, - * and both should be removed in 3.0.0. - */ -void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status); -#endif - -#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_) -/** - * Adds a list of statuses to the presence. - * - * @param presence The presence. - * @param source_list The source list of statuses to add, which is not - * modified or freed by this function. - * - * @deprecated This function isn't used and should be removed in 3.0.0. - */ -void purple_presence_add_list(PurplePresence *presence, GList *source_list); -#endif - -/** - * Sets the active state of a status in a presence. - * - * Only independent statuses can be set unactive. Normal statuses can only - * be set active, so if you wish to disable a status, set another - * non-independent status to active, or use purple_presence_switch_status(). - * - * @param presence The presence. - * @param status_id The ID of the status. - * @param active The active state. - */ -void purple_presence_set_status_active(PurplePresence *presence, - const char *status_id, gboolean active); - -/** - * Switches the active status in a presence. - * - * This is similar to purple_presence_set_status_active(), except it won't - * activate independent statuses. - * - * @param presence The presence. - * @param status_id The status ID to switch to. - */ -void purple_presence_switch_status(PurplePresence *presence, - const char *status_id); - -/** - * Sets the idle state and time on a presence. - * - * @param presence The presence. - * @param idle The idle state. - * @param idle_time The idle time, if @a idle is TRUE. This - * is the time at which the user became idle, - * in seconds since the epoch. If this value is - * unknown then 0 should be used. - */ -void purple_presence_set_idle(PurplePresence *presence, gboolean idle, - time_t idle_time); - -/** - * Sets the login time on a presence. - * - * @param presence The presence. - * @param login_time The login time. - */ -void purple_presence_set_login_time(PurplePresence *presence, time_t login_time); - - -/** - * Returns the presence's context. - * - * @param presence The presence. - * - * @return The presence's context. - */ -PurplePresenceContext purple_presence_get_context(const PurplePresence *presence); - -/** - * Returns a presence's account. - * - * @param presence The presence. - * - * @return The presence's account. - */ -PurpleAccount *purple_presence_get_account(const PurplePresence *presence); - -/** - * Returns a presence's conversation. - * - * @param presence The presence. - * - * @return The presence's conversation. - */ -PurpleConversation *purple_presence_get_conversation(const PurplePresence *presence); - -/** - * Returns a presence's chat user. - * - * @param presence The presence. - * - * @return The chat's user. - */ -const char *purple_presence_get_chat_user(const PurplePresence *presence); - -/** - * Returns the presence's buddy. - * - * @param presence The presence. - * - * @return The presence's buddy. - */ -PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence); - -/** - * Returns all the statuses in a presence. - * - * @param presence The presence. - * - * @constreturn The statuses. - */ -GList *purple_presence_get_statuses(const PurplePresence *presence); - -/** - * Returns the status with the specified ID from a presence. - * - * @param presence The presence. - * @param status_id The ID of the status. - * - * @return The status if found, or NULL. - */ -PurpleStatus *purple_presence_get_status(const PurplePresence *presence, - const char *status_id); - -/** - * Returns the active exclusive status from a presence. - * - * @param presence The presence. - * - * @return The active exclusive status. - */ -PurpleStatus *purple_presence_get_active_status(const PurplePresence *presence); - -/** - * Returns whether or not a presence is available. - * - * Available presences are online and possibly invisible, but not away or idle. - * - * @param presence The presence. - * - * @return TRUE if the presence is available, or FALSE otherwise. - */ -gboolean purple_presence_is_available(const PurplePresence *presence); - -/** - * Returns whether or not a presence is online. - * - * @param presence The presence. - * - * @return TRUE if the presence is online, or FALSE otherwise. - */ -gboolean purple_presence_is_online(const PurplePresence *presence); - -/** - * Returns whether or not a status in a presence is active. - * - * A status is active if itself or any of its sub-statuses are active. - * - * @param presence The presence. - * @param status_id The ID of the status. - * - * @return TRUE if the status is active, or FALSE. - */ -gboolean purple_presence_is_status_active(const PurplePresence *presence, - const char *status_id); - -/** - * Returns whether or not a status with the specified primitive type - * in a presence is active. - * - * A status is active if itself or any of its sub-statuses are active. - * - * @param presence The presence. - * @param primitive The status primitive. - * - * @return TRUE if the status is active, or FALSE. - */ -gboolean purple_presence_is_status_primitive_active( - const PurplePresence *presence, PurpleStatusPrimitive primitive); - -/** - * Returns whether or not a presence is idle. - * - * @param presence The presence. - * - * @return TRUE if the presence is idle, or FALSE otherwise. - * If the presence is offline (purple_presence_is_online() - * returns FALSE) then FALSE is returned. - */ -gboolean purple_presence_is_idle(const PurplePresence *presence); - -/** - * Returns the presence's idle time. - * - * @param presence The presence. - * - * @return The presence's idle time. - */ -time_t purple_presence_get_idle_time(const PurplePresence *presence); - -/** - * Returns the presence's login time. - * - * @param presence The presence. - * - * @return The presence's login time. - */ -time_t purple_presence_get_login_time(const PurplePresence *presence); - -/** - * Compares two presences for availability. - * - * @param presence1 The first presence. - * @param presence2 The second presence. - * - * @return -1 if @a presence1 is more available than @a presence2. - * 0 if @a presence1 is equal to @a presence2. - * 1 if @a presence1 is less available than @a presence2. - */ -gint purple_presence_compare(const PurplePresence *presence1, - const PurplePresence *presence2); - -/*@}*/ - -/**************************************************************************/ -/** @name Status subsystem */ -/**************************************************************************/ -/*@{*/ - -/** - * Get the handle for the status subsystem. - * - * @return the handle to the status subsystem - */ -void *purple_status_get_handle(void); - -/** - * Initializes the status subsystem. - */ -void purple_status_init(void); - -/** - * Uninitializes the status subsystem. - */ -void purple_status_uninit(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_STATUS_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -/** - * @file stringref.c Reference-counted immutable strings - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#include -#include - -#include "debug.h" -#include "eventloop.h" -#include "stringref.h" - -/** - * The internal representation of a stringref. - * - * @note For this structure to be useful, the string contained within - * it must be immutable -- for this reason, do _not_ access it - * directly! - */ -struct _PurpleStringref { - guint32 ref; /**< The reference count of this string. - * Note that reference counts are only - * 31 bits, and the high-order bit - * indicates whether this string is up - * for GC at the next idle handler... - * But you aren't going to touch this - * anyway, right? */ - char value[1]; /**< The string contained in this ref. - * Notice that it is simply "hanging - * off the end" of the ref ... this - * is to save an allocation. */ -}; - -#define REFCOUNT(x) ((x) & 0x7fffffff) - -static GList *gclist = NULL; - -static void stringref_free(PurpleStringref *stringref); -static gboolean gs_idle_cb(gpointer data); - -PurpleStringref *purple_stringref_new(const char *value) -{ - PurpleStringref *newref; - - if (value == NULL) - return NULL; - - newref = g_malloc(sizeof(PurpleStringref) + strlen(value)); - strcpy(newref->value, value); - newref->ref = 1; - - return newref; -} - -PurpleStringref *purple_stringref_new_noref(const char *value) -{ - PurpleStringref *newref; - - if (value == NULL) - return NULL; - - newref = g_malloc(sizeof(PurpleStringref) + strlen(value)); - strcpy(newref->value, value); - newref->ref = 0x80000000; - - if (gclist == NULL) - purple_timeout_add(0, gs_idle_cb, NULL); - gclist = g_list_prepend(gclist, newref); - - return newref; -} - -PurpleStringref *purple_stringref_printf(const char *format, ...) -{ - PurpleStringref *newref; - va_list ap; - - if (format == NULL) - return NULL; - - va_start(ap, format); - newref = g_malloc(sizeof(PurpleStringref) + g_printf_string_upper_bound(format, ap)); - vsprintf(newref->value, format, ap); - va_end(ap); - newref->ref = 1; - - return newref; -} - -PurpleStringref *purple_stringref_ref(PurpleStringref *stringref) -{ - if (stringref == NULL) - return NULL; - stringref->ref++; - return stringref; -} - -void purple_stringref_unref(PurpleStringref *stringref) -{ - if (stringref == NULL) - return; - if (REFCOUNT(--(stringref->ref)) == 0) { - if (stringref->ref & 0x80000000) - gclist = g_list_remove(gclist, stringref); - stringref_free(stringref); - } -} - -const char *purple_stringref_value(const PurpleStringref *stringref) -{ - return (stringref == NULL ? NULL : stringref->value); -} - -int purple_stringref_cmp(const PurpleStringref *s1, const PurpleStringref *s2) -{ - return (s1 == s2 ? 0 : strcmp(purple_stringref_value(s1), purple_stringref_value(s2))); -} - -size_t purple_stringref_len(const PurpleStringref *stringref) -{ - return strlen(purple_stringref_value(stringref)); -} - -static void stringref_free(PurpleStringref *stringref) -{ -#ifdef DEBUG - if (REFCOUNT(stringref->ref) != 0) { - purple_debug(PURPLE_DEBUG_ERROR, "stringref", "Free of nonzero (%d) ref stringref!\n", REFCOUNT(stringref->ref)); - return; - } -#endif /* DEBUG */ - g_free(stringref); -} - -static gboolean gs_idle_cb(gpointer data) -{ - PurpleStringref *ref; - GList *del; - - while (gclist != NULL) { - ref = gclist->data; - if (REFCOUNT(ref->ref) == 0) { - stringref_free(ref); - } - del = gclist; - gclist = gclist->next; - g_list_free_1(del); - } - - return FALSE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stringref.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/* TODO: Can we just replace this whole thing with a GCache */ - -/** - * @file stringref.h Reference-counted immutable strings - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ -#ifndef _PURPLE_STRINGREF_H_ -#define _PURPLE_STRINGREF_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _PurpleStringref PurpleStringref; - -/** - * Creates an immutable reference-counted string object. The newly - * created object will have a reference count of 1. - * - * @param value This will be the value of the string; it will be - * duplicated. - * - * @return A newly allocated string reference object with a refcount - * of 1. - */ -PurpleStringref *purple_stringref_new(const char *value); - -/** - * Creates an immutable reference-counted string object. The newly - * created object will have a reference count of zero, and if it is - * not referenced before the next iteration of the mainloop it will - * be freed at that time. - * - * @param value This will be the value of the string; it will be - * duplicated. - * - * @return A newly allocated string reference object with a refcount - * of zero. - */ -PurpleStringref *purple_stringref_new_noref(const char *value); - -/** - * Creates an immutable reference-counted string object from a printf - * format specification and arguments. The created object will have a - * reference count of 1. - * - * @param format A printf-style format specification. - * - * @return A newly allocated string reference object with a refcount - * of 1. - */ -PurpleStringref *purple_stringref_printf(const char *format, ...); - -/** - * Increase the reference count of the given stringref. - * - * @param stringref String to be referenced. - * - * @return A pointer to the referenced string. - */ -PurpleStringref *purple_stringref_ref(PurpleStringref *stringref); - -/** - * Decrease the reference count of the given stringref. If this - * reference count reaches zero, the stringref will be freed; thus - * you MUST NOT use this string after dereferencing it. - * - * @param stringref String to be dereferenced. - */ -void purple_stringref_unref(PurpleStringref *stringref); - -/** - * Retrieve the value of a stringref. - * - * @note This value should not be cached or stored in a local variable. - * While there is nothing inherently incorrect about doing so, it - * is easy to forget that the cached value is in fact a - * reference-counted object and accidentally use it after - * dereferencing. This is more problematic for a reference- - * counted object than a heap-allocated object, as it may seem to - * be valid or invalid nondeterministically based on how many - * other references to it exist. - * - * @param stringref String reference from which to retrieve the value. - * - * @return The contents of the string reference. - */ -const char *purple_stringref_value(const PurpleStringref *stringref); - -/** - * Compare two stringrefs for string equality. This returns the same - * value as strcmp would, where <0 indicates that s1 is "less than" s2 - * in the ASCII lexicography, 0 indicates equality, etc. - * - * @param s1 The reference string. - * - * @param s2 The string to compare against the reference. - * - * @return An ordering indication on s1 and s2. - */ -int purple_stringref_cmp(const PurpleStringref *s1, const PurpleStringref *s2); - -/** - * Find the length of the string inside a stringref. - * - * @param stringref The string in whose length we are interested. - * - * @return The length of the string in stringref - */ -size_t purple_stringref_len(const PurpleStringref *stringref); - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_STRINGREF_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,437 +0,0 @@ -/** - * @file stun.c STUN (RFC3489) Implementation - * @ingroup core - */ - -/* purple - * - * STUN implementation inspired by jstun [http://jstun.javawi.de/] - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * - */ - -#include "internal.h" - -#ifndef _WIN32 -#include -#include -#endif - -/* Solaris */ -#if defined (__SVR4) && defined (__sun) -#include -#endif - -#include "debug.h" -#include "account.h" -#include "dnsquery.h" -#include "dnssrv.h" -#include "network.h" -#include "proxy.h" -#include "stun.h" -#include "prefs.h" - -#define MSGTYPE_BINDINGREQUEST 0x0001 -#define MSGTYPE_BINDINGRESPONSE 0x0101 - -#define ATTRIB_MAPPEDADDRESS 0x0001 - -struct stun_header { - guint16 type; - guint16 len; - guint32 transid[4]; -}; - -struct stun_attrib { - guint16 type; - guint16 len; -}; - -#ifdef NOTYET -struct stun_change { - struct stun_header hdr; - struct stun_attrib attrib; - char value[4]; -}; -#endif - -struct stun_conn { - int fd; - struct sockaddr_in addr; - int test; - int retry; - guint incb; - guint timeout; - struct stun_header *packet; - size_t packetsize; -}; - -static PurpleStunNatDiscovery nattype = { - PURPLE_STUN_STATUS_UNDISCOVERED, - PURPLE_STUN_NAT_TYPE_PUBLIC_IP, - "\0", NULL, 0}; - -static GSList *callbacks = NULL; - -static void close_stun_conn(struct stun_conn *sc) { - - if (sc->incb) - purple_input_remove(sc->incb); - - if (sc->timeout) - purple_timeout_remove(sc->timeout); - - if (sc->fd) - close(sc->fd); - - g_free(sc); -} - -static void do_callbacks(void) { - while(callbacks) { - StunCallback cb = callbacks->data; - if(cb) - cb(&nattype); - callbacks = g_slist_remove(callbacks, cb); - } -} - -static gboolean timeoutfunc(gpointer data) { - struct stun_conn *sc = data; - if(sc->retry >= 2) { - purple_debug_warning("stun", "request timed out, giving up.\n"); - if(sc->test == 2) - nattype.type = PURPLE_STUN_NAT_TYPE_SYMMETRIC; - - /* set unknown */ - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - - nattype.lookup_time = time(NULL); - - /* callbacks */ - do_callbacks(); - - /* we don't need to remove the timeout (returning FALSE) */ - sc->timeout = 0; - close_stun_conn(sc); - - return FALSE; - } - purple_debug_info("stun", "request timed out, retrying.\n"); - sc->retry++; - sendto(sc->fd, sc->packet, sc->packetsize, 0, - (struct sockaddr *)&(sc->addr), sizeof(struct sockaddr_in)); - return TRUE; -} - -#ifdef NOTYET -static void do_test2(struct stun_conn *sc) { - struct stun_change data; - data.hdr.type = htons(0x0001); - data.hdr.len = 0; - data.hdr.transid[0] = rand(); - data.hdr.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m'); - data.hdr.transid[2] = rand(); - data.hdr.transid[3] = rand(); - data.attrib.type = htons(0x003); - data.attrib.len = htons(4); - data.value[3] = 6; - sc->packet = (struct stun_header*)&data; - sc->packetsize = sizeof(struct stun_change); - sc->retry = 0; - sc->test = 2; - sendto(sc->fd, sc->packet, sc->packetsize, 0, (struct sockaddr *)&(sc->addr), sizeof(struct sockaddr_in)); - sc->timeout = purple_timeout_add(500, (GSourceFunc) timeoutfunc, sc); -} -#endif - -static void reply_cb(gpointer data, gint source, PurpleInputCondition cond) { - struct stun_conn *sc = data; - char buffer[65536]; - char *tmp; - int len; - struct in_addr in; - struct stun_attrib *attrib; - struct stun_header *hdr; - struct ifconf ifc; - struct ifreq *ifr; - struct sockaddr_in *sinptr; - - len = recv(source, buffer, sizeof(buffer) - 1, 0); - if (!len) { - purple_debug_warning("stun", "unable to read stun response\n"); - return; - } - buffer[len] = '\0'; - - if (len < sizeof(struct stun_header)) { - purple_debug_warning("stun", "got invalid response\n"); - return; - } - - hdr = (struct stun_header*) buffer; - if (len != (ntohs(hdr->len) + sizeof(struct stun_header))) { - purple_debug_warning("stun", "got incomplete response\n"); - return; - } - - /* wrong transaction */ - if(hdr->transid[0] != sc->packet->transid[0] - || hdr->transid[1] != sc->packet->transid[1] - || hdr->transid[2] != sc->packet->transid[2] - || hdr->transid[3] != sc->packet->transid[3]) { - purple_debug_warning("stun", "got wrong transid\n"); - return; - } - - if(sc->test==1) { - if (hdr->type != MSGTYPE_BINDINGRESPONSE) { - purple_debug_warning("stun", - "Expected Binding Response, got %d\n", - hdr->type); - return; - } - - tmp = buffer + sizeof(struct stun_header); - while((buffer + len) > (tmp + sizeof(struct stun_attrib))) { - attrib = (struct stun_attrib*) tmp; - tmp += sizeof(struct stun_attrib); - - if (!((buffer + len) > (tmp + ntohs(attrib->len)))) - break; - - if(attrib->type == htons(ATTRIB_MAPPEDADDRESS) - && ntohs(attrib->len) == 8) { - char *ip; - /* Skip the first unused byte, - * the family(1 byte), and the port(2 bytes); - * then read the 4 byte IPv4 address */ - memcpy(&in.s_addr, tmp + 4, 4); - ip = inet_ntoa(in); - if(ip) - strcpy(nattype.publicip, ip); - } - - tmp += ntohs(attrib->len); - } - purple_debug_info("stun", "got public ip %s\n", nattype.publicip); - nattype.status = PURPLE_STUN_STATUS_DISCOVERED; - nattype.type = PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT; - nattype.lookup_time = time(NULL); - - /* is it a NAT? */ - - ifc.ifc_len = sizeof(buffer); - ifc.ifc_req = (struct ifreq *) buffer; - ioctl(source, SIOCGIFCONF, &ifc); - - tmp = buffer; - while(tmp < buffer + ifc.ifc_len) { - ifr = (struct ifreq *) tmp; - - tmp += sizeof(struct ifreq); - - if(ifr->ifr_addr.sa_family == AF_INET) { - /* we only care about ipv4 interfaces */ - sinptr = (struct sockaddr_in *) &ifr->ifr_addr; - if(sinptr->sin_addr.s_addr == in.s_addr) { - /* no NAT */ - purple_debug_info("stun", "no nat\n"); - nattype.type = PURPLE_STUN_NAT_TYPE_PUBLIC_IP; - } - } - } - -#ifndef NOTYET - close_stun_conn(sc); - do_callbacks(); -#else - purple_timeout_remove(sc->timeout); - sc->timeout = 0; - - do_test2(sc); - } else if(sc->test == 2) { - close_stun_conn(sc); - nattype.type = PURPLE_STUN_NAT_TYPE_FULL_CONE; - do_callbacks(); -#endif - } -} - - -static void hbn_listen_cb(int fd, gpointer data) { - GSList *hosts = data; - struct stun_conn *sc; - static struct stun_header hdr_data; - int ret; - - if(fd < 0) { - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - do_callbacks(); - return; - } - - sc = g_new0(struct stun_conn, 1); - sc->fd = fd; - - sc->addr.sin_family = AF_INET; - sc->addr.sin_port = htons(purple_network_get_port_from_fd(fd)); - sc->addr.sin_addr.s_addr = INADDR_ANY; - - sc->incb = purple_input_add(fd, PURPLE_INPUT_READ, reply_cb, sc); - - ret = GPOINTER_TO_INT(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - memcpy(&(sc->addr), hosts->data, sizeof(struct sockaddr_in)); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - hdr_data.type = htons(MSGTYPE_BINDINGREQUEST); - hdr_data.len = 0; - hdr_data.transid[0] = rand(); - hdr_data.transid[1] = ntohl(((int)'g' << 24) + ((int)'a' << 16) + ((int)'i' << 8) + (int)'m'); - hdr_data.transid[2] = rand(); - hdr_data.transid[3] = rand(); - - if(sendto(sc->fd, &hdr_data, sizeof(struct stun_header), 0, - (struct sockaddr *)&(sc->addr), - sizeof(struct sockaddr_in)) < sizeof(struct stun_header)) { - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - do_callbacks(); - close_stun_conn(sc); - return; - } - sc->test = 1; - sc->packet = &hdr_data; - sc->packetsize = sizeof(struct stun_header); - sc->timeout = purple_timeout_add(500, (GSourceFunc) timeoutfunc, sc); -} - -static void hbn_cb(GSList *hosts, gpointer data, const char *error_message) { - - if(!hosts || !hosts->data) { - nattype.status = PURPLE_STUN_STATUS_UNDISCOVERED; - nattype.lookup_time = time(NULL); - do_callbacks(); - return; - } - - if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { - while(hosts) { - hosts = g_slist_remove(hosts, hosts->data); - g_free(hosts->data); - hosts = g_slist_remove(hosts, hosts->data); - } - - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - do_callbacks(); - return; - } - - -} - -static void do_test1(PurpleSrvResponse *resp, int results, gpointer sdata) { - const char *servername = sdata; - int port = 3478; - - if(results) { - servername = resp[0].hostname; - port = resp[0].port; - } - purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", - results, servername, port); - - purple_dnsquery_a(servername, port, hbn_cb, NULL); - g_free(resp); -} - -static gboolean call_callback(gpointer data) { - StunCallback cb = data; - cb(&nattype); - return FALSE; -} - -PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb) { - const char *servername = purple_prefs_get_string("/purple/network/stun_server"); - - purple_debug_info("stun", "using server %s\n", servername); - - if(nattype.status == PURPLE_STUN_STATUS_DISCOVERING) { - if(cb) - callbacks = g_slist_append(callbacks, cb); - return &nattype; - } - - if(nattype.status != PURPLE_STUN_STATUS_UNDISCOVERED) { - gboolean use_cached_result = TRUE; - - /** Deal with the server name having changed since we did the - lookup */ - if (servername && strlen(servername) > 1 - && !purple_strequal(servername, nattype.servername)) { - use_cached_result = FALSE; - } - - /* If we don't have a successful status and it has been 5 - minutes since we last did a lookup, redo the lookup */ - if (nattype.status != PURPLE_STUN_STATUS_DISCOVERED - && (time(NULL) - nattype.lookup_time) > 300) { - use_cached_result = FALSE; - } - - if (use_cached_result) { - if(cb) - purple_timeout_add(10, call_callback, cb); - return &nattype; - } - } - - if(!servername || (strlen(servername) < 2)) { - nattype.status = PURPLE_STUN_STATUS_UNKNOWN; - nattype.lookup_time = time(NULL); - if(cb) - purple_timeout_add(10, call_callback, cb); - return &nattype; - } - - nattype.status = PURPLE_STUN_STATUS_DISCOVERING; - nattype.publicip[0] = '\0'; - g_free(nattype.servername); - nattype.servername = g_strdup(servername); - - callbacks = g_slist_append(callbacks, cb); - purple_srv_resolve("stun", "udp", servername, do_test1, - (gpointer) servername); - - return &nattype; -} - -void purple_stun_init() { - purple_prefs_add_string("/purple/network/stun_server", ""); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/stun.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/** - * @file stun.h STUN API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#ifndef _PURPLE_STUN_H_ -#define _PURPLE_STUN_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name STUN API */ -/**************************************************************************/ -/*@{*/ - -typedef struct _PurpleStunNatDiscovery PurpleStunNatDiscovery; - -typedef enum { - PURPLE_STUN_STATUS_UNDISCOVERED = -1, - PURPLE_STUN_STATUS_UNKNOWN, /* no STUN server reachable */ - PURPLE_STUN_STATUS_DISCOVERING, - PURPLE_STUN_STATUS_DISCOVERED -} PurpleStunStatus; - -typedef enum { - PURPLE_STUN_NAT_TYPE_PUBLIC_IP, - PURPLE_STUN_NAT_TYPE_UNKNOWN_NAT, - PURPLE_STUN_NAT_TYPE_FULL_CONE, - PURPLE_STUN_NAT_TYPE_RESTRICTED_CONE, - PURPLE_STUN_NAT_TYPE_PORT_RESTRICTED_CONE, - PURPLE_STUN_NAT_TYPE_SYMMETRIC -} PurpleStunNatType; - -struct _PurpleStunNatDiscovery { - PurpleStunStatus status; - PurpleStunNatType type; - char publicip[16]; - char *servername; - time_t lookup_time; -}; - -typedef void (*StunCallback) (PurpleStunNatDiscovery *); - -/** - * Starts a NAT discovery. It returns a PurpleStunNatDiscovery if the discovery - * is already done. Otherwise the callback is called when the discovery is over - * and NULL is returned. - * - * @param cb The callback to call when the STUN discovery is finished if the - * discovery would block. If the discovery is done, this is NOT - * called. - * - * @return a PurpleStunNatDiscovery which includes the public IP and the type - * of NAT or NULL is discovery would block - */ -PurpleStunNatDiscovery *purple_stun_discover(StunCallback cb); - -void purple_stun_init(void); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_STUN_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/check_libpurple.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/check_libpurple.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/check_libpurple.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/check_libpurple.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,97 +0,0 @@ -#include -#include - -#include "tests.h" - -#include "../core.h" -#include "../eventloop.h" -#include "../util.h" - - -/****************************************************************************** - * libpurple goodies - *****************************************************************************/ -static guint -purple_check_input_add(gint fd, PurpleInputCondition condition, - PurpleInputFunction function, gpointer data) -{ - /* this is a no-op for now, feel free to implement it */ - return 0; -} - -static PurpleEventLoopUiOps eventloop_ui_ops = { - g_timeout_add, - g_source_remove, - purple_check_input_add, - g_source_remove, - NULL, /* input_get_error */ -#if GLIB_CHECK_VERSION(2,14,0) - g_timeout_add_seconds, -#else - NULL, -#endif - NULL, - NULL, - NULL -}; - -static void -purple_check_init(void) { - gchar *home_dir; - - g_type_init(); - - purple_eventloop_set_ui_ops(&eventloop_ui_ops); - - /* build our fake home directory */ - home_dir = g_build_path(G_DIR_SEPARATOR_S, BUILDDIR, "libpurple", "tests", "home", NULL); - purple_util_set_user_dir(home_dir); - g_free(home_dir); - - purple_core_init("check"); -} - -/****************************************************************************** - * Check meat and potatoes - *****************************************************************************/ -Suite* -master_suite(void) -{ - Suite *s = suite_create("Master Suite"); - - return s; -} - -int main(void) -{ - int number_failed; - SRunner *sr; - - if (g_getenv("PURPLE_CHECK_DEBUG")) - purple_debug_set_enabled(TRUE); - - /* Make g_return_... functions fatal, ALWAYS. - * As this is the test code, this is NOT controlled - * by PURPLE_FATAL_ASSERTS. */ - g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); - - sr = srunner_create (master_suite()); - - srunner_add_suite(sr, cipher_suite()); - srunner_add_suite(sr, jabber_jutil_suite()); - srunner_add_suite(sr, jabber_scram_suite()); - srunner_add_suite(sr, qq_suite()); - srunner_add_suite(sr, yahoo_util_suite()); - srunner_add_suite(sr, util_suite()); - - /* make this a libpurple "ui" */ - purple_check_init(); - - srunner_run_all (sr, CK_NORMAL); - number_failed = srunner_ntests_failed (sr); - srunner_free (sr); - - purple_core_quit(); - - return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.am qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.am --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.am 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.am 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -if HAVE_CHECK -TESTS=check_libpurple - -clean-local: - -rm -rf libpurple.. - -check_PROGRAMS=check_libpurple - -check_libpurple_SOURCES=\ - check_libpurple.c \ - tests.h \ - test_cipher.c \ - test_jabber_jutil.c \ - test_jabber_scram.c \ - test_qq.c \ - test_yahoo_util.c \ - test_util.c \ - $(top_builddir)/libpurple/util.h - -check_libpurple_CFLAGS=\ - @CHECK_CFLAGS@ \ - $(GLIB_CFLAGS) \ - $(DEBUG_CFLAGS) \ - $(LIBXML_CFLAGS) \ - -I.. \ - -I$(top_srcdir)/libpurple \ - -DBUILDDIR=\"$(top_builddir)\" - -check_libpurple_LDADD=\ - $(top_builddir)/libpurple/protocols/jabber/libjabber.la \ - $(top_builddir)/libpurple/protocols/qq/libqq_tmp.la \ - $(top_builddir)/libpurple/protocols/yahoo/libymsg.la \ - $(top_builddir)/libpurple/libpurple.la \ - @CHECK_LIBS@ \ - $(GLIB_LIBS) - -endif diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.in qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.in --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.in 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,890 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@HAVE_CHECK_TRUE@check_PROGRAMS = check_libpurple$(EXEEXT) -subdir = libpurple/tests -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__check_libpurple_SOURCES_DIST = check_libpurple.c tests.h \ - test_cipher.c test_jabber_jutil.c test_jabber_scram.c \ - test_qq.c test_yahoo_util.c test_util.c \ - $(top_builddir)/libpurple/util.h -@HAVE_CHECK_TRUE@am_check_libpurple_OBJECTS = \ -@HAVE_CHECK_TRUE@ check_libpurple-check_libpurple.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_cipher.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_jabber_jutil.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_jabber_scram.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_qq.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_yahoo_util.$(OBJEXT) \ -@HAVE_CHECK_TRUE@ check_libpurple-test_util.$(OBJEXT) -check_libpurple_OBJECTS = $(am_check_libpurple_OBJECTS) -am__DEPENDENCIES_1 = -@HAVE_CHECK_TRUE@check_libpurple_DEPENDENCIES = $(top_builddir)/libpurple/protocols/jabber/libjabber.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/qq/libqq_tmp.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/yahoo/libymsg.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/libpurple.la \ -@HAVE_CHECK_TRUE@ $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(check_libpurple_SOURCES) -DIST_SOURCES = $(am__check_libpurple_SOURCES_DIST) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AVAHI_CFLAGS = @AVAHI_CFLAGS@ -AVAHI_LIBS = @AVAHI_LIBS@ -AWK = @AWK@ -BUILD_GEVOLUTION_FALSE = @BUILD_GEVOLUTION_FALSE@ -BUILD_GEVOLUTION_TRUE = @BUILD_GEVOLUTION_TRUE@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CHECK_CFLAGS = @CHECK_CFLAGS@ -CHECK_LIBS = @CHECK_LIBS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ -DEBUG_CFLAGS = @DEBUG_CFLAGS@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DISTRIB_FALSE = @DISTRIB_FALSE@ -DISTRIB_TRUE = @DISTRIB_TRUE@ -DOT = @DOT@ -DOXYGEN = @DOXYGEN@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -DYNALOADER_A = @DYNALOADER_A@ -DYNAMIC_PRPLS = @DYNAMIC_PRPLS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_CAP_FALSE = @ENABLE_CAP_FALSE@ -ENABLE_CAP_TRUE = @ENABLE_CAP_TRUE@ -ENABLE_DBUS_FALSE = @ENABLE_DBUS_FALSE@ -ENABLE_DBUS_TRUE = @ENABLE_DBUS_TRUE@ -ENABLE_GESTURES_FALSE = @ENABLE_GESTURES_FALSE@ -ENABLE_GESTURES_TRUE = @ENABLE_GESTURES_TRUE@ -ENABLE_GNT_FALSE = @ENABLE_GNT_FALSE@ -ENABLE_GNT_TRUE = @ENABLE_GNT_TRUE@ -ENABLE_GTK_FALSE = @ENABLE_GTK_FALSE@ -ENABLE_GTK_TRUE = @ENABLE_GTK_TRUE@ -EVOLUTION_ADDRESSBOOK_CFLAGS = @EVOLUTION_ADDRESSBOOK_CFLAGS@ -EVOLUTION_ADDRESSBOOK_LIBS = @EVOLUTION_ADDRESSBOOK_LIBS@ -EXEEXT = @EXEEXT@ -EXTERNAL_LIBZEPHYR_FALSE = @EXTERNAL_LIBZEPHYR_FALSE@ -EXTERNAL_LIBZEPHYR_TRUE = @EXTERNAL_LIBZEPHYR_TRUE@ -FARSIGHT_CFLAGS = @FARSIGHT_CFLAGS@ -FARSIGHT_LIBS = @FARSIGHT_LIBS@ -FGREP = @FGREP@ -GADU_CFLAGS = @GADU_CFLAGS@ -GADU_LIBS = @GADU_LIBS@ -GCONFTOOL = @GCONFTOOL@ -GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ -GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ -GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ -GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GNT_CFLAGS = @GNT_CFLAGS@ -GNT_LIBS = @GNT_LIBS@ -GNT_LT_VERSION_INFO = @GNT_LT_VERSION_INFO@ -GNT_MAJOR_VERSION = @GNT_MAJOR_VERSION@ -GNT_MICRO_VERSION = @GNT_MICRO_VERSION@ -GNT_MINOR_VERSION = @GNT_MINOR_VERSION@ -GNT_VERSION = @GNT_VERSION@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GSTINTERFACES_CFLAGS = @GSTINTERFACES_CFLAGS@ -GSTINTERFACES_LIBS = @GSTINTERFACES_LIBS@ -GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@ -GSTREAMER_LIBS = @GSTREAMER_LIBS@ -GTKSPELL_CFLAGS = @GTKSPELL_CFLAGS@ -GTKSPELL_LIBS = @GTKSPELL_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ -HAVE_CHECK_FALSE = @HAVE_CHECK_FALSE@ -HAVE_CHECK_TRUE = @HAVE_CHECK_TRUE@ -HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ -HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ -HAVE_XSLTPROC_FALSE = @HAVE_XSLTPROC_FALSE@ -HAVE_XSLTPROC_TRUE = @HAVE_XSLTPROC_TRUE@ -IDN_CFLAGS = @IDN_CFLAGS@ -IDN_LIBS = @IDN_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_I18N_FALSE = @INSTALL_I18N_FALSE@ -INSTALL_I18N_TRUE = @INSTALL_I18N_TRUE@ -INSTALL_PIXMAPS_FALSE = @INSTALL_PIXMAPS_FALSE@ -INSTALL_PIXMAPS_TRUE = @INSTALL_PIXMAPS_TRUE@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SSL_CERTIFICATES_FALSE = @INSTALL_SSL_CERTIFICATES_FALSE@ -INSTALL_SSL_CERTIFICATES_TRUE = @INSTALL_SSL_CERTIFICATES_TRUE@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ -INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ -INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ -INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_POLICY_RULE = @INTLTOOL_POLICY_RULE@ -INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ -INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ -INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ -INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ -INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ -INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ -INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ -INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ -INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ -INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ -INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ -KRB4_CFLAGS = @KRB4_CFLAGS@ -KRB4_LDFLAGS = @KRB4_LDFLAGS@ -KRB4_LIBS = @KRB4_LIBS@ -LD = @LD@ -LDADD = @LDADD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBPERL_A = @LIBPERL_A@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIBXML_CFLAGS = @LIBXML_CFLAGS@ -LIBXML_LIBS = @LIBXML_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MEANWHILE_CFLAGS = @MEANWHILE_CFLAGS@ -MEANWHILE_LIBS = @MEANWHILE_LIBS@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MONO_CFLAGS = @MONO_CFLAGS@ -MONO_LIBS = @MONO_LIBS@ -MSGFMT = @MSGFMT@ -MSGFMT_OPTS = @MSGFMT_OPTS@ -MSGMERGE = @MSGMERGE@ -NETWORKMANAGER_CFLAGS = @NETWORKMANAGER_CFLAGS@ -NETWORKMANAGER_LIBS = @NETWORKMANAGER_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PANGO_CFLAGS = @PANGO_CFLAGS@ -PANGO_LIBS = @PANGO_LIBS@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PERL_CFLAGS = @PERL_CFLAGS@ -PERL_LIBS = @PERL_LIBS@ -PKG_CONFIG = @PKG_CONFIG@ -PLUGINS_DEFINE = @PLUGINS_DEFINE@ -PLUGINS_FALSE = @PLUGINS_FALSE@ -PLUGINS_TRUE = @PLUGINS_TRUE@ -POFILES = @POFILES@ -POSUB = @POSUB@ -PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ -PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ -PURPLE_AVAILABLE_FALSE = @PURPLE_AVAILABLE_FALSE@ -PURPLE_AVAILABLE_TRUE = @PURPLE_AVAILABLE_TRUE@ -PURPLE_LT_VERSION_INFO = @PURPLE_LT_VERSION_INFO@ -PURPLE_MAJOR_VERSION = @PURPLE_MAJOR_VERSION@ -PURPLE_MICRO_VERSION = @PURPLE_MICRO_VERSION@ -PURPLE_MINOR_VERSION = @PURPLE_MINOR_VERSION@ -PURPLE_VERSION = @PURPLE_VERSION@ -PYTHON = @PYTHON@ -PY_CFLAGS = @PY_CFLAGS@ -PY_LIBS = @PY_LIBS@ -RANLIB = @RANLIB@ -SASL_LIBS = @SASL_LIBS@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SILC_CFLAGS = @SILC_CFLAGS@ -SILC_LIBS = @SILC_LIBS@ -SM_LIBS = @SM_LIBS@ -SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ -SQLITE3_LIBS = @SQLITE3_LIBS@ -SSL_CERTIFICATES_DIR = @SSL_CERTIFICATES_DIR@ -STARTUP_NOTIFICATION_CFLAGS = @STARTUP_NOTIFICATION_CFLAGS@ -STARTUP_NOTIFICATION_LIBS = @STARTUP_NOTIFICATION_LIBS@ -STATIC_BONJOUR_FALSE = @STATIC_BONJOUR_FALSE@ -STATIC_BONJOUR_TRUE = @STATIC_BONJOUR_TRUE@ -STATIC_GG_FALSE = @STATIC_GG_FALSE@ -STATIC_GG_TRUE = @STATIC_GG_TRUE@ -STATIC_IRC_FALSE = @STATIC_IRC_FALSE@ -STATIC_IRC_TRUE = @STATIC_IRC_TRUE@ -STATIC_JABBER_FALSE = @STATIC_JABBER_FALSE@ -STATIC_JABBER_TRUE = @STATIC_JABBER_TRUE@ -STATIC_LINK_LIBS = @STATIC_LINK_LIBS@ -STATIC_MSN_FALSE = @STATIC_MSN_FALSE@ -STATIC_MSN_TRUE = @STATIC_MSN_TRUE@ -STATIC_MXIT_FALSE = @STATIC_MXIT_FALSE@ -STATIC_MXIT_TRUE = @STATIC_MXIT_TRUE@ -STATIC_MYSPACE_FALSE = @STATIC_MYSPACE_FALSE@ -STATIC_MYSPACE_TRUE = @STATIC_MYSPACE_TRUE@ -STATIC_NOVELL_FALSE = @STATIC_NOVELL_FALSE@ -STATIC_NOVELL_TRUE = @STATIC_NOVELL_TRUE@ -STATIC_OSCAR_FALSE = @STATIC_OSCAR_FALSE@ -STATIC_OSCAR_TRUE = @STATIC_OSCAR_TRUE@ -STATIC_PRPLS = @STATIC_PRPLS@ -STATIC_QQ_FALSE = @STATIC_QQ_FALSE@ -STATIC_QQ_TRUE = @STATIC_QQ_TRUE@ -STATIC_SAMETIME_FALSE = @STATIC_SAMETIME_FALSE@ -STATIC_SAMETIME_TRUE = @STATIC_SAMETIME_TRUE@ -STATIC_SILC_FALSE = @STATIC_SILC_FALSE@ -STATIC_SILC_TRUE = @STATIC_SILC_TRUE@ -STATIC_SIMPLE_FALSE = @STATIC_SIMPLE_FALSE@ -STATIC_SIMPLE_TRUE = @STATIC_SIMPLE_TRUE@ -STATIC_YAHOO_FALSE = @STATIC_YAHOO_FALSE@ -STATIC_YAHOO_TRUE = @STATIC_YAHOO_TRUE@ -STATIC_ZEPHYR_FALSE = @STATIC_ZEPHYR_FALSE@ -STATIC_ZEPHYR_TRUE = @STATIC_ZEPHYR_TRUE@ -STRIP = @STRIP@ -TCL_CFLAGS = @TCL_CFLAGS@ -TCL_LIBS = @TCL_LIBS@ -TK_LIBS = @TK_LIBS@ -USE_CYRUS_SASL_FALSE = @USE_CYRUS_SASL_FALSE@ -USE_CYRUS_SASL_TRUE = @USE_CYRUS_SASL_TRUE@ -USE_GCONFTOOL_FALSE = @USE_GCONFTOOL_FALSE@ -USE_GCONFTOOL_TRUE = @USE_GCONFTOOL_TRUE@ -USE_GNUTLS_FALSE = @USE_GNUTLS_FALSE@ -USE_GNUTLS_TRUE = @USE_GNUTLS_TRUE@ -USE_INTERNAL_LIBGADU_FALSE = @USE_INTERNAL_LIBGADU_FALSE@ -USE_INTERNAL_LIBGADU_TRUE = @USE_INTERNAL_LIBGADU_TRUE@ -USE_MONO_FALSE = @USE_MONO_FALSE@ -USE_MONO_TRUE = @USE_MONO_TRUE@ -USE_NLS = @USE_NLS@ -USE_NSS_FALSE = @USE_NSS_FALSE@ -USE_NSS_TRUE = @USE_NSS_TRUE@ -USE_PERL_FALSE = @USE_PERL_FALSE@ -USE_PERL_TRUE = @USE_PERL_TRUE@ -USE_TCL_FALSE = @USE_TCL_FALSE@ -USE_TCL_TRUE = @USE_TCL_TRUE@ -USE_TK_FALSE = @USE_TK_FALSE@ -USE_TK_TRUE = @USE_TK_TRUE@ -USE_VV_FALSE = @USE_VV_FALSE@ -USE_VV_TRUE = @USE_VV_TRUE@ -VERSION = @VERSION@ -X11_CFLAGS = @X11_CFLAGS@ -X11_LIBS = @X11_LIBS@ -XGETTEXT = @XGETTEXT@ -XMKMF = @XMKMF@ -XSLTPROC = @XSLTPROC@ -XSS_LIBS = @XSS_LIBS@ -X_CFLAGS = @X_CFLAGS@ -X_EXTRA_LIBS = @X_EXTRA_LIBS@ -X_LIBS = @X_LIBS@ -X_PRE_LIBS = @X_PRE_LIBS@ -ZEPHYR_CFLAGS = @ZEPHYR_CFLAGS@ -ZEPHYR_LDFLAGS = @ZEPHYR_LDFLAGS@ -ZEPHYR_LIBS = @ZEPHYR_LIBS@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_dbus = @enable_dbus@ -enable_devhelp = @enable_devhelp@ -enable_dot = @enable_dot@ -enable_doxygen = @enable_doxygen@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -perlpath = @perlpath@ -pidginpath = @pidginpath@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -pythonpath = @pythonpath@ -sbindir = @sbindir@ -sedpath = @sedpath@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -@HAVE_CHECK_TRUE@TESTS = check_libpurple -@HAVE_CHECK_TRUE@check_libpurple_SOURCES = \ -@HAVE_CHECK_TRUE@ check_libpurple.c \ -@HAVE_CHECK_TRUE@ tests.h \ -@HAVE_CHECK_TRUE@ test_cipher.c \ -@HAVE_CHECK_TRUE@ test_jabber_jutil.c \ -@HAVE_CHECK_TRUE@ test_jabber_scram.c \ -@HAVE_CHECK_TRUE@ test_qq.c \ -@HAVE_CHECK_TRUE@ test_yahoo_util.c \ -@HAVE_CHECK_TRUE@ test_util.c \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/util.h - -@HAVE_CHECK_TRUE@check_libpurple_CFLAGS = \ -@HAVE_CHECK_TRUE@ @CHECK_CFLAGS@ \ -@HAVE_CHECK_TRUE@ $(GLIB_CFLAGS) \ -@HAVE_CHECK_TRUE@ $(DEBUG_CFLAGS) \ -@HAVE_CHECK_TRUE@ $(LIBXML_CFLAGS) \ -@HAVE_CHECK_TRUE@ -I.. \ -@HAVE_CHECK_TRUE@ -I$(top_srcdir)/libpurple \ -@HAVE_CHECK_TRUE@ -DBUILDDIR=\"$(top_builddir)\" - -@HAVE_CHECK_TRUE@check_libpurple_LDADD = \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/jabber/libjabber.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/qq/libqq_tmp.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/protocols/yahoo/libymsg.la \ -@HAVE_CHECK_TRUE@ $(top_builddir)/libpurple/libpurple.la \ -@HAVE_CHECK_TRUE@ @CHECK_LIBS@ \ -@HAVE_CHECK_TRUE@ $(GLIB_LIBS) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libpurple/tests/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libpurple/tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -check_libpurple$(EXEEXT): $(check_libpurple_OBJECTS) $(check_libpurple_DEPENDENCIES) - @rm -f check_libpurple$(EXEEXT) - $(LINK) $(check_libpurple_LDFLAGS) $(check_libpurple_OBJECTS) $(check_libpurple_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-check_libpurple.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_cipher.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_jabber_jutil.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_jabber_scram.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_qq.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_util.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libpurple-test_yahoo_util.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -check_libpurple-check_libpurple.o: check_libpurple.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-check_libpurple.o -MD -MP -MF "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" -c -o check_libpurple-check_libpurple.o `test -f 'check_libpurple.c' || echo '$(srcdir)/'`check_libpurple.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" "$(DEPDIR)/check_libpurple-check_libpurple.Po"; else rm -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check_libpurple.c' object='check_libpurple-check_libpurple.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-check_libpurple.o `test -f 'check_libpurple.c' || echo '$(srcdir)/'`check_libpurple.c - -check_libpurple-check_libpurple.obj: check_libpurple.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-check_libpurple.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" -c -o check_libpurple-check_libpurple.obj `if test -f 'check_libpurple.c'; then $(CYGPATH_W) 'check_libpurple.c'; else $(CYGPATH_W) '$(srcdir)/check_libpurple.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo" "$(DEPDIR)/check_libpurple-check_libpurple.Po"; else rm -f "$(DEPDIR)/check_libpurple-check_libpurple.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='check_libpurple.c' object='check_libpurple-check_libpurple.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-check_libpurple.obj `if test -f 'check_libpurple.c'; then $(CYGPATH_W) 'check_libpurple.c'; else $(CYGPATH_W) '$(srcdir)/check_libpurple.c'; fi` - -check_libpurple-test_cipher.o: test_cipher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_cipher.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_cipher.Tpo" -c -o check_libpurple-test_cipher.o `test -f 'test_cipher.c' || echo '$(srcdir)/'`test_cipher.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo" "$(DEPDIR)/check_libpurple-test_cipher.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cipher.c' object='check_libpurple-test_cipher.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_cipher.o `test -f 'test_cipher.c' || echo '$(srcdir)/'`test_cipher.c - -check_libpurple-test_cipher.obj: test_cipher.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_cipher.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_cipher.Tpo" -c -o check_libpurple-test_cipher.obj `if test -f 'test_cipher.c'; then $(CYGPATH_W) 'test_cipher.c'; else $(CYGPATH_W) '$(srcdir)/test_cipher.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo" "$(DEPDIR)/check_libpurple-test_cipher.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_cipher.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_cipher.c' object='check_libpurple-test_cipher.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_cipher.obj `if test -f 'test_cipher.c'; then $(CYGPATH_W) 'test_cipher.c'; else $(CYGPATH_W) '$(srcdir)/test_cipher.c'; fi` - -check_libpurple-test_jabber_jutil.o: test_jabber_jutil.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_jabber_jutil.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" -c -o check_libpurple-test_jabber_jutil.o `test -f 'test_jabber_jutil.c' || echo '$(srcdir)/'`test_jabber_jutil.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" "$(DEPDIR)/check_libpurple-test_jabber_jutil.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_jabber_jutil.c' object='check_libpurple-test_jabber_jutil.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_jabber_jutil.o `test -f 'test_jabber_jutil.c' || echo '$(srcdir)/'`test_jabber_jutil.c - -check_libpurple-test_jabber_jutil.obj: test_jabber_jutil.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_jabber_jutil.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" -c -o check_libpurple-test_jabber_jutil.obj `if test -f 'test_jabber_jutil.c'; then $(CYGPATH_W) 'test_jabber_jutil.c'; else $(CYGPATH_W) '$(srcdir)/test_jabber_jutil.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo" "$(DEPDIR)/check_libpurple-test_jabber_jutil.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_jabber_jutil.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_jabber_jutil.c' object='check_libpurple-test_jabber_jutil.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_jabber_jutil.obj `if test -f 'test_jabber_jutil.c'; then $(CYGPATH_W) 'test_jabber_jutil.c'; else $(CYGPATH_W) '$(srcdir)/test_jabber_jutil.c'; fi` - -check_libpurple-test_jabber_scram.o: test_jabber_scram.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_jabber_scram.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_jabber_scram.Tpo" -c -o check_libpurple-test_jabber_scram.o `test -f 'test_jabber_scram.c' || echo '$(srcdir)/'`test_jabber_scram.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_jabber_scram.Tpo" "$(DEPDIR)/check_libpurple-test_jabber_scram.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_jabber_scram.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_jabber_scram.c' object='check_libpurple-test_jabber_scram.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_jabber_scram.o `test -f 'test_jabber_scram.c' || echo '$(srcdir)/'`test_jabber_scram.c - -check_libpurple-test_jabber_scram.obj: test_jabber_scram.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_jabber_scram.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_jabber_scram.Tpo" -c -o check_libpurple-test_jabber_scram.obj `if test -f 'test_jabber_scram.c'; then $(CYGPATH_W) 'test_jabber_scram.c'; else $(CYGPATH_W) '$(srcdir)/test_jabber_scram.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_jabber_scram.Tpo" "$(DEPDIR)/check_libpurple-test_jabber_scram.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_jabber_scram.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_jabber_scram.c' object='check_libpurple-test_jabber_scram.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_jabber_scram.obj `if test -f 'test_jabber_scram.c'; then $(CYGPATH_W) 'test_jabber_scram.c'; else $(CYGPATH_W) '$(srcdir)/test_jabber_scram.c'; fi` - -check_libpurple-test_qq.o: test_qq.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_qq.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_qq.Tpo" -c -o check_libpurple-test_qq.o `test -f 'test_qq.c' || echo '$(srcdir)/'`test_qq.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_qq.Tpo" "$(DEPDIR)/check_libpurple-test_qq.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_qq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_qq.c' object='check_libpurple-test_qq.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_qq.o `test -f 'test_qq.c' || echo '$(srcdir)/'`test_qq.c - -check_libpurple-test_qq.obj: test_qq.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_qq.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_qq.Tpo" -c -o check_libpurple-test_qq.obj `if test -f 'test_qq.c'; then $(CYGPATH_W) 'test_qq.c'; else $(CYGPATH_W) '$(srcdir)/test_qq.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_qq.Tpo" "$(DEPDIR)/check_libpurple-test_qq.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_qq.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_qq.c' object='check_libpurple-test_qq.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_qq.obj `if test -f 'test_qq.c'; then $(CYGPATH_W) 'test_qq.c'; else $(CYGPATH_W) '$(srcdir)/test_qq.c'; fi` - -check_libpurple-test_yahoo_util.o: test_yahoo_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_yahoo_util.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" -c -o check_libpurple-test_yahoo_util.o `test -f 'test_yahoo_util.c' || echo '$(srcdir)/'`test_yahoo_util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" "$(DEPDIR)/check_libpurple-test_yahoo_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_yahoo_util.c' object='check_libpurple-test_yahoo_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_yahoo_util.o `test -f 'test_yahoo_util.c' || echo '$(srcdir)/'`test_yahoo_util.c - -check_libpurple-test_yahoo_util.obj: test_yahoo_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_yahoo_util.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" -c -o check_libpurple-test_yahoo_util.obj `if test -f 'test_yahoo_util.c'; then $(CYGPATH_W) 'test_yahoo_util.c'; else $(CYGPATH_W) '$(srcdir)/test_yahoo_util.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo" "$(DEPDIR)/check_libpurple-test_yahoo_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_yahoo_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_yahoo_util.c' object='check_libpurple-test_yahoo_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_yahoo_util.obj `if test -f 'test_yahoo_util.c'; then $(CYGPATH_W) 'test_yahoo_util.c'; else $(CYGPATH_W) '$(srcdir)/test_yahoo_util.c'; fi` - -check_libpurple-test_util.o: test_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_util.o -MD -MP -MF "$(DEPDIR)/check_libpurple-test_util.Tpo" -c -o check_libpurple-test_util.o `test -f 'test_util.c' || echo '$(srcdir)/'`test_util.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_util.Tpo" "$(DEPDIR)/check_libpurple-test_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_util.c' object='check_libpurple-test_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_util.o `test -f 'test_util.c' || echo '$(srcdir)/'`test_util.c - -check_libpurple-test_util.obj: test_util.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -MT check_libpurple-test_util.obj -MD -MP -MF "$(DEPDIR)/check_libpurple-test_util.Tpo" -c -o check_libpurple-test_util.obj `if test -f 'test_util.c'; then $(CYGPATH_W) 'test_util.c'; else $(CYGPATH_W) '$(srcdir)/test_util.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/check_libpurple-test_util.Tpo" "$(DEPDIR)/check_libpurple-test_util.Po"; else rm -f "$(DEPDIR)/check_libpurple-test_util.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_util.c' object='check_libpurple-test_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(check_libpurple_CFLAGS) $(CFLAGS) -c -o check_libpurple-test_util.obj `if test -f 'test_util.c'; then $(CYGPATH_W) 'test_util.c'; else $(CYGPATH_W) '$(srcdir)/test_util.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list='$(TESTS)'; \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ - ;; \ - *) \ - echo "PASS: $$tst"; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ - xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ - else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -@HAVE_CHECK_FALSE@clean-local: -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool clean-local \ - ctags distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am - - -@HAVE_CHECK_TRUE@clean-local: -@HAVE_CHECK_TRUE@ -rm -rf libpurple.. -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_cipher.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_cipher.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_cipher.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_cipher.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,862 +0,0 @@ -#include -#include -#include -#include - -#undef HAVE_DBUS - -#include "tests.h" - -#include "../cipher.h" - -/****************************************************************************** - * MD4 Tests - *****************************************************************************/ -#define MD4_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[33]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("md4"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_md4_empty_string) { - MD4_TEST("", "31d6cfe0d16ae931b73c59d7e0c089c0"); -} -END_TEST - -START_TEST(test_md4_a) { - MD4_TEST("a", "bde52cb31de33e46245e05fbdbd6fb24"); -} -END_TEST - -START_TEST(test_md4_abc) { - MD4_TEST("abc", "a448017aaf21d8525fc10ae87aa6729d"); -} -END_TEST - -START_TEST(test_md4_message_digest) { - MD4_TEST("message digest", "d9130a8164549fe818874806e1c7014b"); -} -END_TEST - -START_TEST(test_md4_a_to_z) { - MD4_TEST("abcdefghijklmnopqrstuvwxyz", - "d79e1c308aa5bbcdeea8ed63df412da9"); -} -END_TEST - -START_TEST(test_md4_A_to_Z_a_to_z_0_to_9) { - MD4_TEST("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "043f8582f241db351ce627e153e7f0e4"); -} -END_TEST - -START_TEST(test_md4_1_to_0_8_times) { - MD4_TEST("123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890", - "e33b4ddc9c38f2199c3e7b164fcc0536"); -} -END_TEST - - -/****************************************************************************** - * MD5 Tests - *****************************************************************************/ -#define MD5_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[33]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("md5"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_append(context, (guchar *)(data), strlen((data))); \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_md5_empty_string) { - MD5_TEST("", "d41d8cd98f00b204e9800998ecf8427e"); -} -END_TEST - -START_TEST(test_md5_a) { - MD5_TEST("a", "0cc175b9c0f1b6a831c399e269772661"); -} -END_TEST - -START_TEST(test_md5_abc) { - MD5_TEST("abc", "900150983cd24fb0d6963f7d28e17f72"); -} -END_TEST - -START_TEST(test_md5_message_digest) { - MD5_TEST("message digest", "f96b697d7cb7938d525a2f31aaf161d0"); -} -END_TEST - -START_TEST(test_md5_a_to_z) { - MD5_TEST("abcdefghijklmnopqrstuvwxyz", - "c3fcd3d76192e4007dfb496cca67e13b"); -} -END_TEST - -START_TEST(test_md5_A_to_Z_a_to_z_0_to_9) { - MD5_TEST("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "d174ab98d277d9f5a5611c2c9f419d9f"); -} -END_TEST - -START_TEST(test_md5_1_to_0_8_times) { - MD5_TEST("123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890", - "57edf4a22be3c955ac49da2e2107b67a"); -} -END_TEST - -/****************************************************************************** - * SHA-1 Tests - *****************************************************************************/ -#define SHA1_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[41]; \ - gboolean ret = FALSE; \ - gchar *input = data; \ - \ - cipher = purple_ciphers_find_cipher("sha1"); \ - context = purple_cipher_context_new(cipher, NULL); \ - \ - if (input) { \ - purple_cipher_context_append(context, (guchar *)input, strlen(input)); \ - } else { \ - gint j; \ - guchar buff[1000]; \ - \ - memset(buff, 'a', 1000); \ - \ - for(j = 0; j < 1000; j++) \ - purple_cipher_context_append(context, buff, 1000); \ - } \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_sha1_empty_string) { - SHA1_TEST("", "da39a3ee5e6b4b0d3255bfef95601890afd80709"); -} -END_TEST - -START_TEST(test_sha1_a) { - SHA1_TEST("a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"); -} -END_TEST - -START_TEST(test_sha1_abc) { - SHA1_TEST("abc", "a9993e364706816aba3e25717850c26c9cd0d89d"); -} -END_TEST - -START_TEST(test_sha1_abcd_gibberish) { - SHA1_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); -} -END_TEST - -START_TEST(test_sha1_1000_as_1000_times) { - SHA1_TEST(NULL, "34aa973cd4c4daa4f61eeb2bdbad27316534016f"); -} -END_TEST - -/****************************************************************************** - * SHA-256 Tests - *****************************************************************************/ -#define SHA256_TEST(data, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[65]; \ - gboolean ret = FALSE; \ - gchar *input = data; \ - \ - cipher = purple_ciphers_find_cipher("sha256"); \ - context = purple_cipher_context_new(cipher, NULL); \ - \ - if (input) { \ - purple_cipher_context_append(context, (guchar *)input, strlen(input)); \ - } else { \ - gint j; \ - guchar buff[1000]; \ - \ - memset(buff, 'a', 1000); \ - \ - for(j = 0; j < 1000; j++) \ - purple_cipher_context_append(context, buff, 1000); \ - } \ - \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_sha256_empty_string) { - SHA256_TEST("", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); -} -END_TEST - -START_TEST(test_sha256_a) { - SHA256_TEST("a", "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb"); -} -END_TEST - -START_TEST(test_sha256_abc) { - SHA256_TEST("abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); -} -END_TEST - -START_TEST(test_sha256_abcd_gibberish) { - SHA256_TEST("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"); -} -END_TEST - -START_TEST(test_sha256_1000_as_1000_times) { - SHA256_TEST(NULL, "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0"); -} -END_TEST - -/****************************************************************************** - * DES Tests - *****************************************************************************/ -#define DES_TEST(in, keyz, out, len) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - guchar answer[len+1]; \ - gint ret = 0; \ - guchar decrypt[len+1] = in; \ - guchar key[8+1] = keyz;\ - guchar encrypt[len+1] = out;\ - size_t outlen; \ - \ - cipher = purple_ciphers_find_cipher("des"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_set_key(context, key); \ - \ - ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \ - \ - ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_des_12345678) { - DES_TEST("12345678", - "\x3b\x38\x98\x37\x15\x20\xf7\x5e", - "\x06\x22\x05\xac\x6a\x0d\x55\xdd", - 8); -} -END_TEST - -START_TEST(test_des_abcdefgh) { - DES_TEST("abcdefgh", - "\x3b\x38\x98\x37\x15\x20\xf7\x5e", - "\x62\xe0\xc6\x8c\x48\xe4\x75\xed", - 8); -} -END_TEST - -/****************************************************************************** - * DES3 Tests - * See http://csrc.nist.gov/groups/ST/toolkit/examples.html - * and some NULL things I made up - *****************************************************************************/ - -#define DES3_TEST(in, key, iv, out, len, mode) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - guchar answer[len+1]; \ - guchar decrypt[len+1] = in; \ - guchar encrypt[len+1] = out; \ - size_t outlen; \ - gint ret = 0; \ - \ - cipher = purple_ciphers_find_cipher("des3"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_set_key(context, (guchar *)key); \ - purple_cipher_context_set_batch_mode(context, (mode)); \ - purple_cipher_context_set_iv(context, (guchar *)iv, 8); \ - \ - ret = purple_cipher_context_encrypt(context, decrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(encrypt, answer, len) == 0, NULL); \ - \ - ret = purple_cipher_context_decrypt(context, encrypt, len, answer, &outlen); \ - fail_unless(ret == 0, NULL); \ - fail_unless(outlen == (len), NULL); \ - fail_unless(memcmp(decrypt, answer, len) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -START_TEST(test_des3_ecb_nist1) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x45\x67\x89\xAB\xCD\xEF\x01\x23", - "00000000", /* ignored */ - "\x71\x47\x72\xF3\x39\x84\x1D\x34\x26\x7F\xCC\x4B\xD2\x94\x9C\xC3" - "\xEE\x11\xC2\x2A\x57\x6A\x30\x38\x76\x18\x3F\x99\xC0\xB6\xDE\x87", - 32, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_nist2) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x01\x23\x45\x67\x89\xAB\xCD\xEF", - "00000000", /* ignored */ - "\x06\xED\xE3\xD8\x28\x84\x09\x0A\xFF\x32\x2C\x19\xF0\x51\x84\x86" - "\x73\x05\x76\x97\x2A\x66\x6E\x58\xB6\xC8\x8C\xF1\x07\x34\x0D\x3D", - 32, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_null_key) { - DES3_TEST( - "\x16\xf4\xb3\x77\xfd\x4b\x9e\xca", - "\x38\x00\x88\x6a\xef\xcb\x00\xad" - "\x5d\xe5\x29\x00\x7d\x98\x64\x4c" - "\x86\x00\x7b\xd3\xc7\x00\x7b\x32", - "00000000", /* ignored */ - "\xc0\x60\x30\xa1\xb7\x25\x42\x44", - 8, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_null_text) { - DES3_TEST( - "\x65\x73\x34\xc1\x19\x00\x79\x65", - "\x32\x64\xda\x10\x13\x6a\xfe\x1e" - "\x37\x54\xd1\x2c\x41\x04\x10\x40" - "\xaf\x1c\x75\x2b\x51\x3a\x03\xf5", - "00000000", /* ignored */ - "\xe5\x80\xf6\x12\xf8\x4e\xd9\x6c", - 8, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_ecb_null_key_and_text) { - DES3_TEST( - "\xdf\x7f\x00\x92\xe7\xc1\x49\xd2", - "\x0e\x41\x00\xc4\x8b\xf0\x6e\xa1" - "\x66\x49\x42\x63\x22\x00\xf0\x99" - "\x6b\x22\xc1\x37\x9c\x00\xe4\x8f", - "00000000", /* ignored */ - "\x73\xd8\x1f\x1f\x50\x01\xe4\x79", - 8, - PURPLE_CIPHER_BATCH_MODE_ECB); -} -END_TEST - -START_TEST(test_des3_cbc_nist1) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x45\x67\x89\xAB\xCD\xEF\x01\x23", - "\xF6\x9F\x24\x45\xDF\x4F\x9B\x17", - "\x20\x79\xC3\xD5\x3A\xA7\x63\xE1\x93\xB7\x9E\x25\x69\xAB\x52\x62" - "\x51\x65\x70\x48\x1F\x25\xB5\x0F\x73\xC0\xBD\xA8\x5C\x8E\x0D\xA7", - 32, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_nist2) { - DES3_TEST( - "\x6B\xC1\xBE\xE2\x2E\x40\x9F\x96\xE9\x3D\x7E\x11\x73\x93\x17\x2A" - "\xAE\x2D\x8A\x57\x1E\x03\xAC\x9C\x9E\xB7\x6F\xAC\x45\xAF\x8E\x51", - "\x01\x23\x45\x67\x89\xAB\xCD\xEF" - "\x23\x45\x67\x89\xAB\xCD\xEF\x01" - "\x01\x23\x45\x67\x89\xAB\xCD\xEF", - "\xF6\x9F\x24\x45\xDF\x4F\x9B\x17", - "\x74\x01\xCE\x1E\xAB\x6D\x00\x3C\xAF\xF8\x4B\xF4\x7B\x36\xCC\x21" - "\x54\xF0\x23\x8F\x9F\xFE\xCD\x8F\x6A\xCF\x11\x83\x92\xB4\x55\x81", - 32, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_null_key) { - DES3_TEST( - "\x16\xf4\xb3\x77\xfd\x4b\x9e\xca", - "\x38\x00\x88\x6a\xef\xcb\x00\xad" - "\x5d\xe5\x29\x00\x7d\x98\x64\x4c" - "\x86\x00\x7b\xd3\xc7\x00\x7b\x32", - "\x31\x32\x33\x34\x35\x36\x37\x38", - "\x52\xe7\xde\x96\x39\x87\x87\xdb", - 8, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_null_text) { - DES3_TEST( - "\x65\x73\x34\xc1\x19\x00\x79\x65", - "\x32\x64\xda\x10\x13\x6a\xfe\x1e" - "\x37\x54\xd1\x2c\x41\x04\x10\x40" - "\xaf\x1c\x75\x2b\x51\x3a\x03\xf5", - "\x7C\xAF\x0D\x57\x1E\x57\x10\xDA", - "\x40\x12\x0e\x00\x85\xff\x6c\xc2", - 8, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -START_TEST(test_des3_cbc_null_key_and_text) { - DES3_TEST( - "\xdf\x7f\x00\x92\xe7\xc1\x49\xd2", - "\x0e\x41\x00\xc4\x8b\xf0\x6e\xa1" - "\x66\x49\x42\x63\x22\x00\xf0\x99" - "\x6b\x22\xc1\x37\x9c\x00\xe4\x8f", - "\x01\x19\x0D\x2c\x40\x67\x89\x67", - "\xa7\xc1\x10\xbe\x9b\xd5\x8a\x67", - 8, - PURPLE_CIPHER_BATCH_MODE_CBC); -} -END_TEST - -/****************************************************************************** - * HMAC Tests - * See RFC2202 and some other NULL tests I made up - *****************************************************************************/ - -#define HMAC_TEST(data, data_len, key, key_len, type, digest) { \ - PurpleCipher *cipher = NULL; \ - PurpleCipherContext *context = NULL; \ - gchar cdigest[41]; \ - gboolean ret = FALSE; \ - \ - cipher = purple_ciphers_find_cipher("hmac"); \ - context = purple_cipher_context_new(cipher, NULL); \ - purple_cipher_context_set_option(context, "hash", type); \ - purple_cipher_context_set_key_with_len(context, (guchar *)key, (key_len)); \ - \ - purple_cipher_context_append(context, (guchar *)(data), (data_len)); \ - ret = purple_cipher_context_digest_to_str(context, sizeof(cdigest), cdigest, \ - NULL); \ - \ - fail_unless(ret == TRUE, NULL); \ - fail_unless(strcmp((digest), cdigest) == 0, NULL); \ - \ - purple_cipher_context_destroy(context); \ -} - -/* HMAC MD5 */ - -START_TEST(test_hmac_md5_Hi) { - HMAC_TEST("Hi There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 16, - "md5", - "9294727a3638bb1c13f48ef8158bfc9d"); -} -END_TEST - -START_TEST(test_hmac_md5_what) { - HMAC_TEST("what do ya want for nothing?", - 28, - "Jefe", - 4, - "md5", - "750c783e6ab0b503eaa86e310a5db738"); -} -END_TEST - -START_TEST(test_hmac_md5_dd) { - HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", - 50, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 16, - "md5", - "56be34521d144c88dbb8c733f0e8b3f6"); -} -END_TEST - -START_TEST(test_hmac_md5_cd) { - HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", - 50, - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a" - "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" - "\x15\x16\x17\x18\x19", - 25, - "md5", - "697eaf0aca3a3aea3a75164746ffaa79"); -} -END_TEST - -START_TEST(test_hmac_md5_truncation) { - HMAC_TEST("Test With Truncation", - 20, - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", - 16, - "md5", - "56461ef2342edc00f9bab995690efd4c"); -} -END_TEST - -START_TEST(test_hmac_md5_large_key) { - HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First", - 54, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "md5", - "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd"); -} -END_TEST - -START_TEST(test_hmac_md5_large_key_and_data) { - HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", - 73, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "md5", - "6f630fad67cda0ee1fb1f562db3aa53e"); -} -END_TEST - -START_TEST(test_hmac_md5_null_key) { - HMAC_TEST("Hi There", - 8, - "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "md5", - "597bfd644b797a985561eeb03a169e59"); -} -END_TEST - -START_TEST(test_hmac_md5_null_text) { - HMAC_TEST("Hi\x00There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 20, - "md5", - "70be8e1b7b50dfcc335d6cd7992c564f"); -} -END_TEST - -START_TEST(test_hmac_md5_null_key_and_text) { - HMAC_TEST("Hi\x00Th\x00re", - 8, - "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "md5", - "b31bcbba35a33a067cbba9131cba4889"); -} -END_TEST - -/* HMAC SHA1 */ - -START_TEST(test_hmac_sha1_Hi) { - HMAC_TEST("Hi There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 20, - "sha1", - "b617318655057264e28bc0b6fb378c8ef146be00"); -} -END_TEST - -START_TEST(test_hmac_sha1_what) { - HMAC_TEST("what do ya want for nothing?", - 28, - "Jefe", - 4, - "sha1", - "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79"); -} -END_TEST - -START_TEST(test_hmac_sha1_dd) { - HMAC_TEST("\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd" - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", - 50, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 20, - "sha1", - "125d7342b9ac11cd91a39af48aa17b4f63f175d3"); -} -END_TEST - -START_TEST(test_hmac_sha1_cd) { - HMAC_TEST("\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd" - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", - 50, - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a" - "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14" - "\x15\x16\x17\x18\x19", - 25, - "sha1", - "4c9007f4026250c6bc8414f9bf50c86c2d7235da"); -} -END_TEST - -START_TEST(test_hmac_sha1_truncation) { - HMAC_TEST("Test With Truncation", - 20, - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c" - "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c", - 20, - "sha1", - "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04"); -} -END_TEST - -START_TEST(test_hmac_sha1_large_key) { - HMAC_TEST("Test Using Larger Than Block-Size Key - Hash Key First", - 54, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "sha1", - "aa4ae5e15272d00e95705637ce8a3b55ed402112"); -} -END_TEST - -START_TEST(test_hmac_sha1_large_key_and_data) { - HMAC_TEST("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data", - 73, - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - 80, - "sha1", - "e8e99d0f45237d786d6bbaa7965c7808bbff1a91"); -} -END_TEST - -START_TEST(test_hmac_sha1_null_key) { - HMAC_TEST("Hi There", - 8, - "\x0a\x0b\x00\x0d\x0e\x0f\x1a\x2f\x0b\x0b" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "sha1", - "eb62a2e0e33d300be669c52aab3f591bc960aac5"); -} -END_TEST - -START_TEST(test_hmac_sha1_null_text) { - HMAC_TEST("Hi\x00There", - 8, - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b" - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - 20, - "sha1", - "31ca58d849e971e418e3439de2c6f83144b6abb7"); -} -END_TEST - -START_TEST(test_hmac_sha1_null_key_and_text) { - HMAC_TEST("Hi\x00Th\x00re", - 8, - "\x0c\x0d\x00\x0f\x10\x1a\x3a\x3a\xe6\x34" - "\x0b\x00\x00\x0b\x0b\x49\x5f\x6e\x0b\x0b", - 20, - "sha1", - "e6b8e2fede87aa09dcb13e554df1435e056eae36"); -} -END_TEST - -/****************************************************************************** - * Suite - *****************************************************************************/ -Suite * -cipher_suite(void) { - Suite *s = suite_create("Cipher Suite"); - TCase *tc = NULL; - - /* md4 tests */ - tc = tcase_create("MD4"); - tcase_add_test(tc, test_md4_empty_string); - tcase_add_test(tc, test_md4_a); - tcase_add_test(tc, test_md4_abc); - tcase_add_test(tc, test_md4_message_digest); - tcase_add_test(tc, test_md4_a_to_z); - tcase_add_test(tc, test_md4_A_to_Z_a_to_z_0_to_9); - tcase_add_test(tc, test_md4_1_to_0_8_times); - suite_add_tcase(s, tc); - - /* md5 tests */ - tc = tcase_create("MD5"); - tcase_add_test(tc, test_md5_empty_string); - tcase_add_test(tc, test_md5_a); - tcase_add_test(tc, test_md5_abc); - tcase_add_test(tc, test_md5_message_digest); - tcase_add_test(tc, test_md5_a_to_z); - tcase_add_test(tc, test_md5_A_to_Z_a_to_z_0_to_9); - tcase_add_test(tc, test_md5_1_to_0_8_times); - suite_add_tcase(s, tc); - - /* sha1 tests */ - tc = tcase_create("SHA1"); - tcase_add_test(tc, test_sha1_empty_string); - tcase_add_test(tc, test_sha1_a); - tcase_add_test(tc, test_sha1_abc); - tcase_add_test(tc, test_sha1_abcd_gibberish); - tcase_add_test(tc, test_sha1_1000_as_1000_times); - suite_add_tcase(s, tc); - - /* sha256 tests */ - tc = tcase_create("SHA256"); - tcase_add_test(tc, test_sha256_empty_string); - tcase_add_test(tc, test_sha256_a); - tcase_add_test(tc, test_sha256_abc); - tcase_add_test(tc, test_sha256_abcd_gibberish); - tcase_add_test(tc, test_sha256_1000_as_1000_times); - suite_add_tcase(s, tc); - - /* des tests */ - tc = tcase_create("DES"); - tcase_add_test(tc, test_des_12345678); - tcase_add_test(tc, test_des_abcdefgh); - suite_add_tcase(s, tc); - - /* des3 ecb tests */ - tc = tcase_create("DES3 ECB"); - tcase_add_test(tc, test_des3_ecb_nist1); - tcase_add_test(tc, test_des3_ecb_nist2); - tcase_add_test(tc, test_des3_ecb_null_key); - tcase_add_test(tc, test_des3_ecb_null_text); - tcase_add_test(tc, test_des3_ecb_null_key_and_text); - suite_add_tcase(s, tc); - /* des3 cbc tests */ - tc = tcase_create("DES3 CBC"); - tcase_add_test(tc, test_des3_cbc_nist1); - tcase_add_test(tc, test_des3_cbc_nist2); - tcase_add_test(tc, test_des3_cbc_null_key); - tcase_add_test(tc, test_des3_cbc_null_text); - tcase_add_test(tc, test_des3_cbc_null_key_and_text); - suite_add_tcase(s, tc); - - /* hmac tests */ - tc = tcase_create("HMAC"); - tcase_add_test(tc, test_hmac_md5_Hi); - tcase_add_test(tc, test_hmac_md5_what); - tcase_add_test(tc, test_hmac_md5_dd); - tcase_add_test(tc, test_hmac_md5_cd); - tcase_add_test(tc, test_hmac_md5_truncation); - tcase_add_test(tc, test_hmac_md5_large_key); - tcase_add_test(tc, test_hmac_md5_large_key_and_data); - tcase_add_test(tc, test_hmac_md5_null_key); - tcase_add_test(tc, test_hmac_md5_null_text); - tcase_add_test(tc, test_hmac_md5_null_key_and_text); - tcase_add_test(tc, test_hmac_sha1_Hi); - tcase_add_test(tc, test_hmac_sha1_what); - tcase_add_test(tc, test_hmac_sha1_dd); - tcase_add_test(tc, test_hmac_sha1_cd); - tcase_add_test(tc, test_hmac_sha1_truncation); - tcase_add_test(tc, test_hmac_sha1_large_key); - tcase_add_test(tc, test_hmac_sha1_large_key_and_data); - tcase_add_test(tc, test_hmac_sha1_null_key); - tcase_add_test(tc, test_hmac_sha1_null_text); - tcase_add_test(tc, test_hmac_sha1_null_key_and_text); - suite_add_tcase(s, tc); - - return s; -} - - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_jutil.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_jutil.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_jutil.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_jutil.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,207 +0,0 @@ -#include - -#include "tests.h" -#include "../account.h" -#include "../conversation.h" -#include "../xmlnode.h" -#include "../protocols/jabber/jutil.h" - -START_TEST(test_get_resource) -{ - assert_string_equal_free("baz", jabber_get_resource("foo@bar/baz")); - assert_string_equal_free("baz", jabber_get_resource("bar/baz")); - assert_string_equal_free("baz/bat", jabber_get_resource("foo@bar/baz/bat")); - assert_string_equal_free("baz/bat", jabber_get_resource("bar/baz/bat")); -} -END_TEST - -START_TEST(test_get_resource_no_resource) -{ - - fail_unless(NULL == jabber_get_resource("foo@bar")); - fail_unless(NULL == jabber_get_resource("bar")); -} -END_TEST - -START_TEST(test_get_bare_jid) -{ - assert_string_equal_free("foo@bar", jabber_get_bare_jid("foo@bar")); - assert_string_equal_free("foo@bar", jabber_get_bare_jid("foo@bar/baz")); - assert_string_equal_free("bar", jabber_get_bare_jid("bar")); - assert_string_equal_free("bar", jabber_get_bare_jid("bar/baz")); -} -END_TEST - -START_TEST(test_nodeprep_validate) -{ - char *longnode; - - fail_unless(jabber_nodeprep_validate(NULL)); - fail_unless(jabber_nodeprep_validate("foo")); - fail_unless(jabber_nodeprep_validate("%d")); - fail_unless(jabber_nodeprep_validate("y\\z")); - fail_unless(jabber_nodeprep_validate("a=")); - fail_unless(jabber_nodeprep_validate("a,")); - - longnode = g_strnfill(1023, 'a'); - fail_unless(jabber_nodeprep_validate(longnode)); - g_free(longnode); - - longnode = g_strnfill(1024, 'a'); - fail_if(jabber_nodeprep_validate(longnode)); - g_free(longnode); -} -END_TEST - -START_TEST(test_nodeprep_validate_illegal_chars) -{ - fail_if(jabber_nodeprep_validate("don't")); - fail_if(jabber_nodeprep_validate("m@ke")); - fail_if(jabber_nodeprep_validate("\"me\"")); - fail_if(jabber_nodeprep_validate("&ngry")); - fail_if(jabber_nodeprep_validate("c:")); - fail_if(jabber_nodeprep_validate("a/b")); - fail_if(jabber_nodeprep_validate("4>2")); - fail_if(jabber_nodeprep_validate("4<7")); -} -END_TEST - -START_TEST(test_nodeprep_validate_too_long) -{ - char *longnode = g_strnfill(1024, 'a'); - fail_if(jabber_nodeprep_validate(longnode)); - g_free(longnode); -} -END_TEST - -#define assert_valid_jid(str) { \ - JabberID *jid = jabber_id_new(str); \ - fail_if(jid == NULL, "JID '%s' is valid but jabber_id_new() rejected it", str); \ - jabber_id_free(jid); \ -} - -#define assert_invalid_jid(str) { \ - JabberID *jid = jabber_id_new(str); \ - fail_if(jid != NULL, "JID '%s' is invalid but jabber_id_new() allowed it", str); \ - jabber_id_free(jid); \ -} - -#define assert_jid_parts(expect_node, expect_domain, str) { \ - JabberID *jid = jabber_id_new(str); \ - fail_if(jid == NULL, "JID '%s' is valid but jabber_id_new() rejected it", str); \ - fail_if(jid->node == NULL, "JID '%s' is valid but jabber_id_new() didn't return a node", str); \ - fail_if(jid->domain == NULL, "JID '%s' is valid but jabber_id_new() didn't return a domain", str); \ - fail_if(jid->resource != NULL, "JID '%s' doesn't contain a resource", str); \ - assert_string_equal(expect_node, jid->node); \ - assert_string_equal(expect_domain, jid->domain); \ - jabber_id_free(jid); \ -} - -START_TEST(test_jabber_id_new) -{ - assert_valid_jid("gmail.com"); - assert_valid_jid("gmail.com/Test"); - assert_valid_jid("gmail.com/Test@"); - assert_valid_jid("gmail.com/@"); - assert_valid_jid("gmail.com/Test@alkjaweflkj"); - assert_valid_jid("mark.doliner@gmail.com"); - assert_valid_jid("mark.doliner@gmail.com/Test12345"); - assert_valid_jid("mark.doliner@gmail.com/Test@12345"); - assert_valid_jid("mark.doliner@gmail.com/Te/st@12@//345"); - assert_valid_jid("わいど@conference.jabber.org"); - assert_valid_jid("まりるーむ@conference.jabber.org"); - assert_valid_jid("mark.doliner@gmail.com/まりるーむ"); - assert_valid_jid("mark.doliner@gmail/stuff.org"); - assert_valid_jid("stuart@nödåtXäYZ.se"); - assert_valid_jid("stuart@nödåtXäYZ.se/まりるーむ"); - assert_valid_jid("mark.doliner@わいど.org"); - assert_valid_jid("nick@まつ.おおかみ.net"); - assert_valid_jid("paul@10.0.42.230/s"); - assert_valid_jid("paul@[::1]"); /* IPv6 */ - assert_valid_jid("paul@[2001:470:1f05:d58::2]"); - assert_valid_jid("paul@[2001:470:1f05:d58::2]/foo"); - assert_valid_jid("pa=ul@10.0.42.230"); - assert_valid_jid("pa,ul@10.0.42.230"); - - assert_invalid_jid("@gmail.com"); - assert_invalid_jid("@@gmail.com"); - assert_invalid_jid("mark.doliner@@gmail.com/Test12345"); - assert_invalid_jid("mark@doliner@gmail.com/Test12345"); - assert_invalid_jid("@gmail.com/Test@12345"); - assert_invalid_jid("/Test@12345"); - assert_invalid_jid("mark.doliner@"); - assert_invalid_jid("mark.doliner/"); - assert_invalid_jid("mark.doliner@gmail_stuff.org"); - assert_invalid_jid("mark.doliner@gmail[stuff.org"); - assert_invalid_jid("mark.doliner@gmail\\stuff.org"); - assert_invalid_jid("paul@[::1]124"); - assert_invalid_jid("paul@2[::1]124/as"); - assert_invalid_jid("paul@まつ.おおかみ/\x01"); - - /* - * RFC 3454 Section 6 reads, in part, - * "If a string contains any RandALCat character, the - * string MUST NOT contain any LCat character." - * The character is U+066D (ARABIC FIVE POINTED STAR). - */ - assert_invalid_jid("foo@example.com/٭simplexe٭"); - - /* Ensure that jabber_id_new is properly lowercasing node and domains */ - assert_jid_parts("paul", "darkrain42.org", "PaUL@darkrain42.org"); - assert_jid_parts("paul", "darkrain42.org", "paul@DaRkRaIn42.org"); - - /* These case-mapping tests culled from examining RFC3454 B.2 */ - - /* Cyrillic capital EF (U+0424) maps to lowercase EF (U+0444) */ - assert_jid_parts("ф", "darkrain42.org", "Ф@darkrain42.org"); - -#ifdef USE_IDN - /* - * These character (U+A664 and U+A665) are not mapped to anything in - * RFC3454 B.2. This first test *fails* when not using IDN because glib's - * case-folding/utf8_strdown improperly (for XMPP) lowercases the character. - * - * This is known, but not (very?) likely to actually cause a problem, so - * this test is commented out when using glib's functions. - */ - assert_jid_parts("Ꙥ", "darkrain42.org", "Ꙥ@darkrain42.org"); - assert_jid_parts("ꙥ", "darkrain42.org", "ꙥ@darkrain42.org"); -#endif - - /* U+04E9 to U+04E9 */ - assert_jid_parts("paul", "өarkrain42.org", "paul@Өarkrain42.org"); -} -END_TEST - -START_TEST(test_jabber_normalize) -{ - assert_string_equal("paul@darkrain42.org", jabber_normalize(NULL, "PaUL@DaRkRain42.org")); - assert_string_equal("paul@darkrain42.org", jabber_normalize(NULL, "PaUL@DaRkRain42.org/")); - assert_string_equal("paul@darkrain42.org", jabber_normalize(NULL, "PaUL@DaRkRain42.org/resource")); -} -END_TEST - -Suite * -jabber_jutil_suite(void) -{ - Suite *s = suite_create("Jabber Utility Functions"); - - TCase *tc = tcase_create("Get Resource"); - tcase_add_test(tc, test_get_resource); - tcase_add_test(tc, test_get_resource_no_resource); - suite_add_tcase(s, tc); - - tc = tcase_create("Get Bare JID"); - tcase_add_test(tc, test_get_bare_jid); - suite_add_tcase(s, tc); - - tc = tcase_create("JID validate"); - tcase_add_test(tc, test_nodeprep_validate); - tcase_add_test(tc, test_nodeprep_validate_illegal_chars); - tcase_add_test(tc, test_nodeprep_validate_too_long); - tcase_add_test(tc, test_jabber_id_new); - tcase_add_test(tc, test_jabber_normalize); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_scram.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_scram.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_scram.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_jabber_scram.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -#include - -#include "tests.h" -#include "../util.h" -#include "../protocols/jabber/auth_scram.h" -#include "../protocols/jabber/jutil.h" - -static JabberScramHash sha1_mech = { "-SHA-1", "sha1", 20 }; - -#define assert_pbkdf2_equal(password, salt, count, expected) { \ - GString *p = g_string_new(password); \ - GString *s = g_string_new(salt); \ - guchar *result = jabber_scram_hi(&sha1_mech, p, s, count); \ - fail_if(result == NULL, "Hi() returned NULL"); \ - fail_if(0 != memcmp(result, expected, 20), "Hi() returned invalid result"); \ - g_string_free(s, TRUE); \ - g_string_free(p, TRUE); \ -} - -START_TEST(test_pbkdf2) -{ - assert_pbkdf2_equal("password", "salt", 1, "\x0c\x60\xc8\x0f\x96\x1f\x0e\x71\xf3\xa9\xb5\x24\xaf\x60\x12\x06\x2f\xe0\x37\xa6"); - assert_pbkdf2_equal("password", "salt", 2, "\xea\x6c\x01\x4d\xc7\x2d\x6f\x8c\xcd\x1e\xd9\x2a\xce\x1d\x41\xf0\xd8\xde\x89\x57"); - assert_pbkdf2_equal("password", "salt", 4096, "\x4b\x00\x79\x01\xb7\x65\x48\x9a\xbe\xad\x49\xd9\x26\xf7\x21\xd0\x65\xa4\x29\xc1"); - -#if 0 - /* This causes libcheck to time out :-D */ - assert_pbkdf2_equal("password", "salt", 16777216, "\xee\xfe\x3d\x61\xcd\x4d\xa4\xe4\xe9\x94\x5b\x3d\x6b\xa2\x15\x8c\x26\x34\xe9\x84"); -#endif -} -END_TEST - -START_TEST(test_proofs) -{ - JabberScramData *data = g_new0(JabberScramData, 1); - gboolean ret; - GString *salt; - const char *client_proof; -/* const char *server_signature; */ - - data->hash = &sha1_mech; - data->password = g_strdup("password"); - data->auth_message = g_string_new("n=username@jabber.org,r=8jLxB5515dhFxBil5A0xSXMH," - "r=8jLxB5515dhFxBil5A0xSXMHabc,s=c2FsdA==,i=1," - "c=biws,r=8jLxB5515dhFxBil5A0xSXMHabc"); - client_proof = "\x48\x61\x30\xa5\x61\x0b\xae\xb9\xe4\x11\xa8\xfd\xa5\xcd\x34\x1d\x8a\x3c\x28\x17"; - - salt = g_string_new("salt"); - ret = jabber_scram_calc_proofs(data, salt, 1); - fail_if(ret == FALSE, "Failed to calculate SCRAM proofs!"); - - fail_unless(0 == memcmp(client_proof, data->client_proof->str, 20)); - g_string_free(salt, TRUE); - - jabber_scram_data_destroy(data); -} -END_TEST - -#define assert_successful_exchange(pw, nonce, start_data, challenge1, response1, success) { \ - JabberScramData *data = g_new0(JabberScramData, 1); \ - gboolean ret; \ - gchar *out; \ - \ - data->step = 1; \ - data->hash = &sha1_mech; \ - data->password = jabber_saslprep(pw); \ - fail_if(data->password == NULL); \ - data->cnonce = g_strdup(nonce); \ - data->auth_message = g_string_new(start_data); \ - \ - ret = jabber_scram_feed_parser(data, challenge1, &out); \ - fail_unless(ret == TRUE); \ - fail_unless(g_str_equal(out, response1), "Got unexpected response to challenge. Expected %s, got %s", response1, out); \ - g_free(out); \ - \ - data->step = 2; \ - ret = jabber_scram_feed_parser(data, success, &out); \ - fail_unless(ret == TRUE); \ - fail_unless(out == NULL); \ - \ - jabber_scram_data_destroy(data); \ -} - -START_TEST(test_mech) -{ - assert_successful_exchange("password", "H7yDYKAWBCrM2Fa5SxGa4iez", - "n=paul,r=H7yDYKAWBCrM2Fa5SxGa4iez", - "r=H7yDYKAWBCrM2Fa5SxGa4iezFPVDPpDUcGxPkH3RzP,s=3rXeErP/os7jUNqU,i=4096", - "c=biws,r=H7yDYKAWBCrM2Fa5SxGa4iezFPVDPpDUcGxPkH3RzP,p=pXkak78EuwwOEwk2/h/OzD7NkEI=", - "v=ldX4EBNnOgDnNTOCmbSfBHAUCOs="); - - assert_successful_exchange("pass½word", "GNb2HsNI7VnTv8ABsE5AnY8W", - "n=paul,r=GNb2HsNI7VnTv8ABsE5AnY8W", - "r=GNb2HsNI7VnTv8ABsE5AnY8W/w/I3eRKM0I7jxFWOH,s=ysAriUjPzFqOXnMQ,i=4096", - "c=biws,r=GNb2HsNI7VnTv8ABsE5AnY8W/w/I3eRKM0I7jxFWOH,p=n/CtgdWjOYnLQ4m9Na+wPn9D2uY=", - "v=4TkZwKWy6JHNmrUbU2+IdAaXtos="); -} -END_TEST - -Suite * -jabber_scram_suite(void) -{ - Suite *s = suite_create("Jabber SASL SCRAM functions"); - - TCase *tc = tcase_create("PBKDF2 Functionality"); - tcase_add_test(tc, test_pbkdf2); - suite_add_tcase(s, tc); - - tc = tcase_create("SCRAM Proofs"); - tcase_add_test(tc, test_proofs); - suite_add_tcase(s, tc); - - tc = tcase_create("SCRAM exchange"); - tcase_add_test(tc, test_mech); - suite_add_tcase(s, tc); - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_qq.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_qq.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_qq.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_qq.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -#include - -#include "tests.h" -#include "../protocols/qq/qq_crypt.h" - -START_TEST(test_qq_encrypt) -{ - const guint8 * const key = (guint8 *)"hamburger"; - guint8 crypted[80]; - gint ret; - - ret = qq_encrypt(crypted, (const guint8 * const)"a", 1, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aa", 2, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaa", 3, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaa", 4, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaa", 5, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaa", 6, key); - assert_int_equal(16, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaa", 7, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaa", 8, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaaa", 9, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, (const guint8 * const)"aaaaaaaaaa", 10, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaa", 11, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaa", 12, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaa", 13, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaa", 14, key); - assert_int_equal(24, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaa", 15, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaa", 16, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaaa", 17, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaaaa", 18, key); - assert_int_equal(32, ret); - - ret = qq_encrypt(crypted, - (const guint8 * const)"aaaaaaaaaaaaaaaaaaa", 19, key); - assert_int_equal(32, ret); - - /* - fprintf(stderr, "crypted=%s\n", crypted); - assert_string_equal_free("plain", - yahoo_codes_to_html("plain")); - */ -} -END_TEST - -START_TEST(test_qq_decrypt) -{ -} -END_TEST - -Suite * -qq_suite(void) -{ - Suite *s; - TCase *tc; - - s = suite_create("QQ"); - - tc = tcase_create("QQ Crypt Functions"); - tcase_add_test(tc, test_qq_encrypt); - tcase_add_test(tc, test_qq_decrypt); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/tests.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/tests.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/tests.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/tests.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -#ifndef TESTS_H -# define TESTS_H - -#include "../purple.h" - -#include - -/* define the test suites here */ -/* remember to add the suite to the runner in check_libpurple.c */ -Suite * master_suite(void); -Suite * cipher_suite(void); -Suite * jabber_jutil_suite(void); -Suite * jabber_scram_suite(void); -Suite * qq_suite(void); -Suite * yahoo_util_suite(void); -Suite * util_suite(void); - -/* helper macros */ -#define assert_int_equal(expected, actual) { \ - fail_if(expected != actual, "Expected '%d' but got '%d'", expected, actual); \ -} - -#define assert_string_equal(expected, actual) { \ - const gchar *a = actual; \ - fail_unless(strcmp(expected, a) == 0, "Expected '%s' but got '%s'", expected, a); \ -} - -#define assert_string_equal_free(expected, actual) { \ - gchar *b = actual; \ - assert_string_equal(expected, b); \ - g_free(b); \ -} - - -#endif /* ifndef TESTS_H */ - diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -#include - -#include "tests.h" -#include "../util.h" - -START_TEST(test_util_base16_encode) -{ - assert_string_equal_free("68656c6c6f2c20776f726c642100", purple_base16_encode((const unsigned char *)"hello, world!", 14)); -} -END_TEST - -START_TEST(test_util_base16_decode) -{ - gsize sz = 0; - guchar *out = purple_base16_decode("21646c726f77202c6f6c6c656800", &sz); - fail_unless(sz == 14, NULL); - assert_string_equal_free("!dlrow ,olleh", (char *)out); -} -END_TEST - -START_TEST(test_util_base64_encode) -{ - assert_string_equal_free("Zm9ydHktdHdvAA==", purple_base64_encode((const unsigned char *)"forty-two", 10)); -} -END_TEST - -START_TEST(test_util_base64_decode) -{ - gsize sz; - guchar *out = purple_base64_decode("b3d0LXl0cm9mAA==", &sz); - fail_unless(sz == 10, NULL); - assert_string_equal_free("owt-ytrof", (char *)out); -} -END_TEST - -START_TEST(test_util_escape_filename) -{ - assert_string_equal("foo", purple_escape_filename("foo")); - assert_string_equal("@oo", purple_escape_filename("@oo")); - assert_string_equal("#oo", purple_escape_filename("#oo")); - assert_string_equal("-oo", purple_escape_filename("-oo")); - assert_string_equal("_oo", purple_escape_filename("_oo")); - assert_string_equal(".oo", purple_escape_filename(".oo")); - assert_string_equal("%25oo", purple_escape_filename("%oo")); - assert_string_equal("%21oo", purple_escape_filename("!oo")); -} -END_TEST - -START_TEST(test_util_unescape_filename) -{ - assert_string_equal("bar", purple_unescape_filename("bar")); - assert_string_equal("@ar", purple_unescape_filename("@ar")); - assert_string_equal("!ar", purple_unescape_filename("!ar")); - assert_string_equal("!ar", purple_unescape_filename("%21ar")); - assert_string_equal("%ar", purple_unescape_filename("%25ar")); -} -END_TEST - - -START_TEST(test_util_text_strip_mnemonic) -{ - assert_string_equal_free("", purple_text_strip_mnemonic("")); - assert_string_equal_free("foo", purple_text_strip_mnemonic("foo")); - assert_string_equal_free("foo", purple_text_strip_mnemonic("_foo")); - -} -END_TEST - -START_TEST(test_util_email_is_valid) -{ - fail_unless(purple_email_is_valid("purple-devel@lists.sf.net")); - fail_if(purple_email_is_valid("purple-devel@@lists.sf.net")); - fail_if(purple_email_is_valid("purple@devel@lists.sf.net")); - fail_if(purple_email_is_valid("purple-devel@list..sf.net")); - fail_if(purple_email_is_valid("purple-devel")); - fail_if(purple_email_is_valid("purple-devel@")); - fail_if(purple_email_is_valid("@lists.sf.net")); - fail_if(purple_email_is_valid("")); - fail_if(purple_email_is_valid("totally bogus")); -} -END_TEST - -START_TEST(test_util_ipv6_is_valid) -{ - fail_unless(purple_ipv6_address_is_valid("2001:0db8:85a3:0000:0000:8a2e:0370:7334")); - fail_unless(purple_ipv6_address_is_valid("2001:db8:85a3:0:0:8a2e:370:7334")); - fail_unless(purple_ipv6_address_is_valid("2001:db8:85a3::8a2e:370:7334")); - fail_unless(purple_ipv6_address_is_valid("2001:0db8:0:0::1428:57ab")); - fail_unless(purple_ipv6_address_is_valid("::1")); - fail_unless(purple_ipv6_address_is_valid("1::")); - fail_unless(purple_ipv6_address_is_valid("1::1")); - fail_unless(purple_ipv6_address_is_valid("::")); - fail_if(purple_ipv6_address_is_valid("")); - fail_if(purple_ipv6_address_is_valid(":")); - fail_if(purple_ipv6_address_is_valid("1.2.3.4")); - fail_if(purple_ipv6_address_is_valid("2001::FFD3::57ab")); - fail_if(purple_ipv6_address_is_valid("200000000::1")); - fail_if(purple_ipv6_address_is_valid("QWERTY::1")); -} -END_TEST - -START_TEST(test_util_str_to_time) -{ - fail_unless(377182200 == purple_str_to_time("19811214T12:50:00", TRUE, NULL, NULL, NULL)); - fail_unless(1175919261 == purple_str_to_time("20070407T04:14:21", TRUE, NULL, NULL, NULL)); -} -END_TEST - -START_TEST(test_markup_html_to_xhtml) -{ - gchar *xhtml = NULL; - gchar *plaintext = NULL; - purple_markup_html_to_xhtml("", &xhtml, &plaintext); - assert_string_equal_free("", xhtml); - assert_string_equal_free("", plaintext); - - - purple_markup_html_to_xhtml("x", &xhtml, &plaintext); - assert_string_equal_free("x", xhtml); - assert_string_equal_free("x", plaintext); -} -END_TEST - -START_TEST(test_mime_decode_field) -{ - gchar *result = purple_mime_decode_field("=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?="); - assert_string_equal_free("Keld Jørn Simonsen", result); -} -END_TEST - -Suite * -util_suite(void) -{ - Suite *s = suite_create("Utility Functions"); - - TCase *tc = tcase_create("Base16"); - tcase_add_test(tc, test_util_base16_encode); - tcase_add_test(tc, test_util_base16_decode); - suite_add_tcase(s, tc); - - tc = tcase_create("Base64"); - tcase_add_test(tc, test_util_base64_encode); - tcase_add_test(tc, test_util_base64_decode); - suite_add_tcase(s, tc); - - tc = tcase_create("Filenames"); - tcase_add_test(tc, test_util_escape_filename); - tcase_add_test(tc, test_util_unescape_filename); - suite_add_tcase(s, tc); - - tc = tcase_create("Strip Mnemonic"); - tcase_add_test(tc, test_util_text_strip_mnemonic); - suite_add_tcase(s, tc); - - tc = tcase_create("Email"); - tcase_add_test(tc, test_util_email_is_valid); - suite_add_tcase(s, tc); - - tc = tcase_create("IPv6"); - tcase_add_test(tc, test_util_ipv6_is_valid); - suite_add_tcase(s, tc); - - tc = tcase_create("Time"); - tcase_add_test(tc, test_util_str_to_time); - suite_add_tcase(s, tc); - - tc = tcase_create("Markup"); - tcase_add_test(tc, test_markup_html_to_xhtml); - suite_add_tcase(s, tc); - - tc = tcase_create("MIME"); - tcase_add_test(tc, test_mime_decode_field); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_yahoo_util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_yahoo_util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_yahoo_util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/tests/test_yahoo_util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -#include - -#include "tests.h" -#include "../protocols/yahoo/libymsg.h" - -static void setup_codes_to_html(void) -{ - yahoo_init_colorht(); -} - -static void teardown_codes_to_html(void) -{ - yahoo_dest_colorht(); -} - -START_TEST(test_codes_to_html) -{ - assert_string_equal_free("", - yahoo_codes_to_html("")); - assert_string_equal_free("", - yahoo_codes_to_html("\x1B[12345m")); - assert_string_equal_free("plain", - yahoo_codes_to_html("plain")); - assert_string_equal_free("unknown ansi code", - yahoo_codes_to_html("unknown \x1B[12345m ansi code")); - assert_string_equal_free("plain <peanut>", - yahoo_codes_to_html("plain ")); - assert_string_equal_free("plain <peanut", - yahoo_codes_to_html("plain peanut")); - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("<font face='inva>lid", - yahoo_codes_to_html("blue
", - yahoo_codes_to_html("\x1B[31mblue")); - assert_string_equal_free("custom color", - yahoo_codes_to_html("\x1B[#70ea15mcustom color")); - - /* font face */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - - /* font size */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("size 32", - yahoo_codes_to_html("size 32")); - - /* combinations */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("test", - yahoo_codes_to_html("\x1B[35mtest")); -#else - /* font color */ - assert_string_equal_free("blue", - yahoo_codes_to_html("\x1B[31mblue")); - assert_string_equal_free("custom color", - yahoo_codes_to_html("\x1B[#70ea15mcustom color")); - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - - /* font face */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - - /* font size */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("size 32", - yahoo_codes_to_html("size 32")); - - /* combinations */ - assert_string_equal_free("test", - yahoo_codes_to_html("test")); - assert_string_equal_free("test", - yahoo_codes_to_html("\x1B[35mtest")); - assert_string_equal_free(":<", - yahoo_codes_to_html(":<")); -#endif /* !USE_CSS_FORMATTING */ -} -END_TEST - -START_TEST(test_html_to_codes) -{ - assert_string_equal_free("plain", - yahoo_html_to_codes("plain")); - assert_string_equal_free("plain ", - yahoo_html_to_codes("plain <peanut>")); - assert_string_equal_free("plain peanut", - yahoo_html_to_codes("plain> peanut")); - assert_string_equal_free("plain >", - yahoo_html_to_codes("plain >")); - assert_string_equal_free("plain > ", - yahoo_html_to_codes("plain > ")); - assert_string_equal_free("plain <", - yahoo_html_to_codes("plain <")); - assert_string_equal_free("plain < ", - yahoo_html_to_codes("plain < ")); - assert_string_equal_free("plain <", - yahoo_html_to_codes("plain <")); - assert_string_equal_free("plain &", - yahoo_html_to_codes("plain &")); - - /* bold/italic/underline */ - assert_string_equal_free("\x1B[1mbold\x1B[x1m", - yahoo_html_to_codes("bold")); - assert_string_equal_free("\x1B[2mitalic\x1B[x2m", - yahoo_html_to_codes("italic")); - assert_string_equal_free("\x1B[4munderline\x1B[x4m", - yahoo_html_to_codes("underline")); - assert_string_equal_free("no markup", - yahoo_html_to_codes("no markup")); - assert_string_equal_free("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline\x1B[x4m", - yahoo_html_to_codes("bold italic underline")); - assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m italic\x1B[x2m", - yahoo_html_to_codes("bold bolditalic italic")); - assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x2m\x1B[x1m\x1B[2m \x1B[4mitalicunderline\x1B[x4m\x1B[x2m", - yahoo_html_to_codes("bold bolditalic italicunderline")); - - /* link */ - assert_string_equal_free("http://pidgin.im/", - yahoo_html_to_codes("http://pidgin.im/")); - assert_string_equal_free("mark@example.com", - yahoo_html_to_codes("mark@example.com")); -#if 0 - assert_string_equal_free("Pidgin (http://pidgin.im/)", - yahoo_html_to_codes("Pidgin")); -#endif - - /* font nothing */ - assert_string_equal_free("nothing", - yahoo_html_to_codes("nothing")); - - /* font color */ - assert_string_equal_free("\x1B[#E71414mred\x1B[#000000m", - yahoo_html_to_codes("red")); - assert_string_equal_free("\x1B[#FF0000mred\x1B[#000000m \x1B[#0000FFmblue\x1B[#000000m black", - yahoo_html_to_codes("red blue black")); - - /* font size */ - assert_string_equal_free("test", - yahoo_html_to_codes("test")); - assert_string_equal_free("test", - yahoo_html_to_codes("test")); - - /* combinations */ - assert_string_equal_free("\x1B[#FF0000mredsmall rednormal\x1B[#000000m", - yahoo_html_to_codes("redsmall rednormal")); - - assert_string_equal_free("\x1B[#FF0000mredsmall \x1B[#00FF00mgreennormal\x1B[#FF0000m rednormal\x1B[#000000m", - yahoo_html_to_codes("redsmall greennormal rednormal")); - - assert_string_equal_free("\x1B[1mbold \x1B[#FF0000mred larger \x1B[#000000mbacktoblack normalsize\x1B[#FF0000m\x1B[#000000m\x1B[x1m", - yahoo_html_to_codes("bold red larger backtoblack normalsize")); - - /* buzz/unknown tags */ - assert_string_equal_free("", - yahoo_html_to_codes("")); - assert_string_equal_free("Unknown ", - yahoo_html_to_codes("Unknown ")); -} -END_TEST - -Suite * -yahoo_util_suite(void) -{ - Suite *s; - TCase *tc; - - s = suite_create("Yahoo Utility Functions"); - - tc = tcase_create("Convert IM from network format to HTML"); - tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html); - tcase_add_test(tc, test_codes_to_html); - suite_add_tcase(s, tc); - - tc = tcase_create("Convert IM from HTML to network format"); - tcase_add_test(tc, test_html_to_codes); - suite_add_tcase(s, tc); - - return s; -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,409 +0,0 @@ -/* - * Themes for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "theme.h" -#include "util.h" - -#define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \ - ((PurpleThemePrivate *) ((PurpleTheme)->priv)) - -void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type); - -/****************************************************************************** - * Structs - *****************************************************************************/ - -typedef struct { - gchar *name; - gchar *description; - gchar *author; - gchar *type; - gchar *dir; - gchar *img; -} PurpleThemePrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * Enums - *****************************************************************************/ - -enum { - PROP_ZERO = 0, - PROP_NAME, - PROP_DESCRIPTION, - PROP_AUTHOR, - PROP_TYPE, - PROP_DIR, - PROP_IMAGE -}; - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -purple_theme_get_property(GObject *obj, guint param_id, GValue *value, - GParamSpec *psec) -{ - PurpleTheme *theme = PURPLE_THEME(obj); - - switch (param_id) { - case PROP_NAME: - g_value_set_string(value, purple_theme_get_name(theme)); - break; - case PROP_DESCRIPTION: - g_value_set_string(value, purple_theme_get_description(theme)); - break; - case PROP_AUTHOR: - g_value_set_string(value, purple_theme_get_author(theme)); - break; - case PROP_TYPE: - g_value_set_string(value, purple_theme_get_type_string(theme)); - break; - case PROP_DIR: - g_value_set_string(value, purple_theme_get_dir(theme)); - break; - case PROP_IMAGE: - g_value_set_string(value, purple_theme_get_image(theme)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_set_property(GObject *obj, guint param_id, const GValue *value, - GParamSpec *psec) -{ - PurpleTheme *theme = PURPLE_THEME(obj); - - switch (param_id) { - case PROP_NAME: - purple_theme_set_name(theme, g_value_get_string(value)); - break; - case PROP_DESCRIPTION: - purple_theme_set_description(theme, g_value_get_string(value)); - break; - case PROP_AUTHOR: - purple_theme_set_author(theme, g_value_get_string(value)); - break; - case PROP_TYPE: - purple_theme_set_type_string(theme, g_value_get_string(value)); - break; - case PROP_DIR: - purple_theme_set_dir(theme, g_value_get_string(value)); - break; - case PROP_IMAGE: - purple_theme_set_image(theme, g_value_get_string(value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleTheme *theme = PURPLE_THEME(instance); - theme->priv = g_new0(PurpleThemePrivate, 1); -} - -static void -purple_theme_finalize(GObject *obj) -{ - PurpleTheme *theme = PURPLE_THEME(obj); - PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->name); - g_free(priv->description); - g_free(priv->author); - g_free(priv->type); - g_free(priv->dir); - g_free(priv->img); - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -purple_theme_class_init(PurpleThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - obj_class->get_property = purple_theme_get_property; - obj_class->set_property = purple_theme_set_property; - obj_class->finalize = purple_theme_finalize; - - /* NAME */ - pspec = g_param_spec_string("name", "Name", - "The name of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_NAME, pspec); - - /* DESCRIPTION */ - pspec = g_param_spec_string("description", "Description", - "The description of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_DESCRIPTION, pspec); - - /* AUTHOR */ - pspec = g_param_spec_string("author", "Author", - "The author of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_AUTHOR, pspec); - - /* TYPE STRING (read only) */ - pspec = g_param_spec_string("type", "Type", - "The string representing the type of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property(obj_class, PROP_TYPE, pspec); - - /* DIRECTORY */ - pspec = g_param_spec_string("directory", "Directory", - "The directory that contains the theme and all its files", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); - g_object_class_install_property(obj_class, PROP_DIR, pspec); - - /* PREVIEW IMAGE */ - pspec = g_param_spec_string("image", "Image", - "A preview image of the theme", - NULL, - G_PARAM_READWRITE); - g_object_class_install_property(obj_class, PROP_IMAGE, pspec); -} - - -GType -purple_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleTheme), - 0, /* n_preallocs */ - purple_theme_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static (G_TYPE_OBJECT, - "PurpleTheme", &info, G_TYPE_FLAG_ABSTRACT); - } - return type; -} - -/****************************************************************************** - * Helper Functions - *****************************************************************************/ - -static gchar * -theme_clean_text(const gchar *text) -{ - gchar *clean_text = NULL; - if (text != NULL) { - clean_text = g_markup_escape_text(text, -1); - g_strdelimit(clean_text, "\n", ' '); - purple_str_strip_char(clean_text, '\r'); - } - return clean_text; -} - -/***************************************************************************** - * Public API function - *****************************************************************************/ - -const gchar * -purple_theme_get_name(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->name; -} - -void -purple_theme_set_name(PurpleTheme *theme, const gchar *name) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->name); - priv->name = theme_clean_text(name); -} - -const gchar * -purple_theme_get_description(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->description; -} - -void -purple_theme_set_description(PurpleTheme *theme, const gchar *description) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->description); - priv->description = theme_clean_text(description); -} - -const gchar * -purple_theme_get_author(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->author; -} - -void -purple_theme_set_author(PurpleTheme *theme, const gchar *author) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->author); - priv->author = theme_clean_text(author); -} - -const gchar * -purple_theme_get_type_string(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->type; -} - -/* < private > */ -void -purple_theme_set_type_string(PurpleTheme *theme, const gchar *type) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->type); - priv->type = g_strdup(type); -} - -const gchar * -purple_theme_get_dir(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - return priv->dir; -} - -void -purple_theme_set_dir(PurpleTheme *theme, const gchar *dir) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->dir); - priv->dir = g_strdup(dir); -} - -const gchar * -purple_theme_get_image(PurpleTheme *theme) -{ - PurpleThemePrivate *priv; - - g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - return priv->img; -} - -gchar * -purple_theme_get_image_full(PurpleTheme *theme) -{ - const gchar *filename = purple_theme_get_image(theme); - - if (filename) - return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL); - else - return NULL; -} - -void -purple_theme_set_image(PurpleTheme *theme, const gchar *img) -{ - PurpleThemePrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - priv = PURPLE_THEME_GET_PRIVATE(theme); - - g_free(priv->img); - priv->img = g_strdup(img); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,175 +0,0 @@ -/** - * @file theme.h Purple Theme Abstact Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_THEME_H -#define PURPLE_THEME_H - -#include -#include -#include "imgstore.h" - -/** - * A purple theme. - * This is an abstract class for Purple to use with the Purple theme manager. - * - * PurpleTheme is a GObject. - */ -typedef struct _PurpleTheme PurpleTheme; -typedef struct _PurpleThemeClass PurpleThemeClass; - -#define PURPLE_TYPE_THEME (purple_theme_get_type ()) -#define PURPLE_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PURPLE_TYPE_THEME, PurpleTheme)) -#define PURPLE_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_TYPE_THEME, PurpleThemeClass)) -#define PURPLE_IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PURPLE_TYPE_THEME)) -#define PURPLE_IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_TYPE_THEME)) -#define PURPLE_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_TYPE_THEME, PurpleThemeClass)) - -struct _PurpleTheme -{ - GObject parent; - gpointer priv; -}; - -struct _PurpleThemeClass -{ - GObjectClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Theme API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_theme_get_type(void); - -/** - * Returns the name of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The string representing the name of the theme. - */ -const gchar *purple_theme_get_name(PurpleTheme *theme); - -/** - * Sets the name of the PurpleTheme object. - * - * @param theme The purple theme. - * @param name The name of the PurpleTheme object. - */ -void purple_theme_set_name(PurpleTheme *theme, const gchar *name); - -/** - * Returns the description of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return A short description of the theme. - */ -const gchar *purple_theme_get_description(PurpleTheme *theme); - -/** - * Sets the description of the PurpleTheme object. - * - * @param theme The purple theme. - * @param description The description of the PurpleTheme object. - */ -void purple_theme_set_description(PurpleTheme *theme, const gchar *description); - -/** - * Returns the author of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The author of the theme. - */ -const gchar *purple_theme_get_author(PurpleTheme *theme); - -/** - * Sets the author of the PurpleTheme object. - * - * @param theme The purple theme. - * @param author The author of the PurpleTheme object. - */ -void purple_theme_set_author(PurpleTheme *theme, const gchar *author); - -/** - * Returns the type (string) of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The string representing the type. - */ -const gchar *purple_theme_get_type_string(PurpleTheme *theme); - -/** - * Returns the directory of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The string representing the theme directory. - */ -const gchar *purple_theme_get_dir(PurpleTheme *theme); - -/** - * Sets the directory of the PurpleTheme object. - * - * @param theme The purple theme. - * @param dir The directory of the PurpleTheme object. - */ -void purple_theme_set_dir(PurpleTheme *theme, const gchar *dir); - -/** - * Returns the image preview of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The image preview of the PurpleTheme object. - */ -const gchar *purple_theme_get_image(PurpleTheme *theme); - -/** - * Returns the image preview and directory of the PurpleTheme object. - * - * @param theme The purple theme. - * - * @return The image preview of the PurpleTheme object. - */ -gchar *purple_theme_get_image_full(PurpleTheme *theme); - -/** - * Sets the directory of the PurpleTheme object. - * - * @param theme The purple theme. - * @param img The image preview of the PurpleTheme object. - */ -void purple_theme_set_image(PurpleTheme *theme, const gchar *img); - -G_END_DECLS -#endif /* PURPLE_THEME_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* - * ThemeLoaders for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "theme-loader.h" - -#define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \ - ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv)) - -void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type); - -/****************************************************************************** - * Structs - *****************************************************************************/ -typedef struct { - gchar *type; -} PurpleThemeLoaderPrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * Enums - *****************************************************************************/ - -enum { - PROP_ZERO = 0, - PROP_TYPE, -}; - -/****************************************************************************** - * GObject Stuff * - *****************************************************************************/ - -static void -purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value, - GParamSpec *psec) -{ - PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj); - - switch (param_id) { - case PROP_TYPE: - g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader)); - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value, - GParamSpec *psec) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); - - switch (param_id) { - case PROP_TYPE: - purple_theme_loader_set_type_string(loader, g_value_get_string(value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); - break; - } -} - -static void -purple_theme_loader_init(GTypeInstance *instance, - gpointer klass) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance); - loader->priv = g_new0(PurpleThemeLoaderPrivate, 1); -} - -static void -purple_theme_loader_finalize(GObject *obj) -{ - PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); - PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); - - g_free(priv->type); - g_free(priv); - - parent_class->finalize(obj); -} - -static void -purple_theme_loader_class_init(PurpleThemeLoaderClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - GParamSpec *pspec; - - parent_class = g_type_class_peek_parent(klass); - - obj_class->get_property = purple_theme_loader_get_property; - obj_class->set_property = purple_theme_loader_set_property; - obj_class->finalize = purple_theme_loader_finalize; - - /* TYPE STRING (read only) */ - pspec = g_param_spec_string("type", "Type", - "The string representing the type of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property(obj_class, PROP_TYPE, pspec); -} - -GType -purple_theme_loader_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleThemeLoader), - 0, /* n_preallocs */ - purple_theme_loader_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(G_TYPE_OBJECT, - "PurpleThemeLoader", &info, G_TYPE_FLAG_ABSTRACT); - } - return type; -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -const gchar * -purple_theme_loader_get_type_string(PurpleThemeLoader *theme_loader) -{ - PurpleThemeLoaderPrivate *priv = NULL; - - g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL); - - priv = PURPLE_THEME_LOADER_GET_PRIVATE(theme_loader); - return priv->type; -} - -/* < private > */ -void -purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type) -{ - PurpleThemeLoaderPrivate *priv; - - g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); - - priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); - - g_free(priv->type); - priv->type = g_strdup(type); -} - -PurpleTheme * -purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir) -{ - return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-loader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/** - * @file theme-loader.h Purple Theme Loader Abstact Class API - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_THEME_LOADER_H -#define PURPLE_THEME_LOADER_H - -#include -#include -#include "theme.h" - -/** - * A purple theme loader. - * This is an abstract class for Purple to use with the Purple theme manager. - * The loader is responsible for building each type of theme - * - * PurpleThemeLoader is a GObject. - */ -typedef struct _PurpleThemeLoader PurpleThemeLoader; -typedef struct _PurpleThemeLoaderClass PurpleThemeLoaderClass; - -#define PURPLE_TYPE_THEME_LOADER (purple_theme_loader_get_type()) -#define PURPLE_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoader)) -#define PURPLE_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderClass)) -#define PURPLE_IS_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_THEME_LOADER)) -#define PURPLE_IS_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_THEME_LOADER)) -#define PURPLE_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderClass)) - -struct _PurpleThemeLoader -{ - GObject parent; - gpointer priv; -}; - -struct _PurpleThemeLoaderClass -{ - GObjectClass parent_class; - PurpleTheme *((*purple_theme_loader_build)(const gchar*)); -}; - -/**************************************************************************/ -/** @name Purple Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType purple_theme_loader_get_type(void); - -/** - * Returns the string representing the type of the theme loader - * - * @param self The theme loader - * - * @returns The string representing this type - */ -const gchar *purple_theme_loader_get_type_string(PurpleThemeLoader *self); - -/** - * Creates a new PurpleTheme - * - * @param loader The theme loader - * @param dir The directory containing the theme - * - * @returns A PurpleTheme containing the information from the directory - */ -PurpleTheme *purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir); - -G_END_DECLS -#endif /* PURPLE_THEME_LOADER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,306 +0,0 @@ -/* - * Themes for libpurple - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "internal.h" -#include "theme-manager.h" -#include "util.h" - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GHashTable *theme_table = NULL; - -/***************************************************************************** - * GObject Stuff - ****************************************************************************/ - -GType -purple_theme_manager_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PurpleThemeManagerClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(PurpleThemeManager), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* Value Table */ - }; - type = g_type_register_static(G_TYPE_OBJECT, - "PurpleThemeManager", &info, 0); - } - return type; -} - -/****************************************************************************** - * Helpers - *****************************************************************************/ - -/* makes a key of + '/' + */ -static gchar * -purple_theme_manager_make_key(const gchar *name, const gchar *type) -{ - g_return_val_if_fail(name && *name, NULL); - g_return_val_if_fail(type && *type, NULL); - return g_strconcat(type, "/", name, NULL); -} - -/* returns TRUE if theme is of type "user_data" */ -static gboolean -purple_theme_manager_is_theme_type(gchar *key, - gpointer value, - gchar *user_data) -{ - return g_str_has_prefix(key, g_strconcat(user_data, "/", NULL)); -} - -static gboolean -purple_theme_manager_is_theme(gchar *key, - gpointer value, - gchar *user_data) -{ - return PURPLE_IS_THEME(value); -} - -static void -purple_theme_manager_function_wrapper(gchar *key, - gpointer value, - PTFunc user_data) -{ - if (PURPLE_IS_THEME(value)) - (* user_data)(value); -} - -static void -purple_theme_manager_build_dir(const gchar *root) -{ - gchar *purple_dir, *theme_dir; - const gchar *name = NULL, *type = NULL; - GDir *rdir, *tdir; - PurpleThemeLoader *loader; - - rdir = g_dir_open(root, 0, NULL); - - if (!rdir) - return; - - /* Parses directory by root/name/purple/type */ - while ((name = g_dir_read_name(rdir))) { - purple_dir = g_build_filename(root, name, "purple", NULL); - tdir = g_dir_open(purple_dir, 0, NULL); - - if (!tdir) { - g_free(purple_dir); - - continue; - } - - while ((type = g_dir_read_name(tdir))) { - if ((loader = g_hash_table_lookup(theme_table, type))) { - PurpleTheme *theme = NULL; - - theme_dir = g_build_filename(purple_dir, type, NULL); - - theme = purple_theme_loader_build(loader, theme_dir); - g_free(theme_dir); - - if (PURPLE_IS_THEME(theme)) - purple_theme_manager_add_theme(theme); - } - } - - g_dir_close(tdir); - g_free(purple_dir); - } - - g_dir_close(rdir); -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -void -purple_theme_manager_init(void) -{ - theme_table = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_object_unref); -} - -void -purple_theme_manager_refresh(void) -{ - gchar *path = NULL; - const gchar *xdg = NULL; - gint i = 0; - - g_hash_table_foreach_remove(theme_table, - (GHRFunc) purple_theme_manager_is_theme, NULL); - - /* Add themes from ~/.purple */ - path = g_build_filename(purple_user_dir(), "themes", NULL); - purple_theme_manager_build_dir(path); - g_free(path); - - /* look for XDG_DATA_HOME. If we don't have it use ~/.local, and add it */ - if ((xdg = g_getenv("XDG_DATA_HOME")) != NULL) - path = g_build_filename(xdg, "themes", NULL); - else - path = g_build_filename(purple_home_dir(), ".local", "themes", NULL); - - purple_theme_manager_build_dir(path); - g_free(path); - - /* now dig through XDG_DATA_DIRS and add those too */ - xdg = g_getenv("XDG_DATA_DIRS"); - if (xdg) { - gchar **xdg_dirs = g_strsplit(xdg, G_SEARCHPATH_SEPARATOR_S, 0); - - for (i = 0; xdg_dirs[i]; i++) { - path = g_build_filename(xdg_dirs[i], "themes", NULL); - purple_theme_manager_build_dir(path); - g_free(path); - } - - g_strfreev(xdg_dirs); - } -} - -void -purple_theme_manager_uninit(void) -{ - g_hash_table_destroy(theme_table); -} - -void -purple_theme_manager_register_type(PurpleThemeLoader *loader) -{ - gchar *type; - - g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); - - type = g_strdup(purple_theme_loader_get_type_string(loader)); - g_return_if_fail(type); - - /* if something is already there do nothing */ - if (!g_hash_table_lookup(theme_table, type)) - g_hash_table_insert(theme_table, type, loader); -} - -void -purple_theme_manager_unregister_type(PurpleThemeLoader *loader) -{ - const gchar *type; - - g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); - - type = purple_theme_loader_get_type_string(loader); - g_return_if_fail(type); - - if (g_hash_table_lookup(theme_table, type) == loader) - { - g_hash_table_remove(theme_table, type); - - g_hash_table_foreach_remove(theme_table, - (GHRFunc)purple_theme_manager_is_theme_type, (gpointer)type); - } /* only free if given registered loader */ -} - -PurpleTheme * -purple_theme_manager_find_theme(const gchar *name, - const gchar *type) -{ - gchar *key; - PurpleTheme *theme; - - key = purple_theme_manager_make_key(name, type); - - g_return_val_if_fail(key, NULL); - - theme = g_hash_table_lookup(theme_table, key); - - g_free(key); - - return theme; -} - -void -purple_theme_manager_add_theme(PurpleTheme *theme) -{ - gchar *key; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - key = purple_theme_manager_make_key(purple_theme_get_name(theme), - purple_theme_get_type_string(theme)); - - g_return_if_fail(key); - - /* if something is already there do nothing */ - if (g_hash_table_lookup(theme_table, key) == NULL) - g_hash_table_insert(theme_table, key, theme); -} - -void -purple_theme_manager_remove_theme(PurpleTheme *theme) -{ - gchar *key; - - g_return_if_fail(PURPLE_IS_THEME(theme)); - - key = purple_theme_manager_make_key(purple_theme_get_name(theme), - purple_theme_get_type_string(theme)); - - g_return_if_fail(key); - - g_hash_table_remove(theme_table, key); - - g_free(key); -} - -void -purple_theme_manager_for_each_theme(PTFunc func) -{ - g_return_if_fail(func); - - g_hash_table_foreach(theme_table, - (GHFunc) purple_theme_manager_function_wrapper, func); -} - -PurpleTheme * -purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type) -{ - PurpleThemeLoader *loader; - - g_return_val_if_fail(theme_dir != NULL && type != NULL, NULL); - - loader = g_hash_table_lookup(theme_table, type); - g_return_val_if_fail(PURPLE_IS_THEME_LOADER(loader), NULL); - - return purple_theme_loader_build(loader, theme_dir); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/theme-manager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/** - * @file theme-manager.h Theme Manager API - */ - -/* - * purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef PURPLE_THEME_MANAGER_H -#define PURPLE_THEME_MANAGER_H - -#include -#include -#include "theme.h" -#include "theme-loader.h" - -typedef void (*PTFunc) (PurpleTheme *); - -typedef struct _PurpleThemeManager PurpleThemeManager; -typedef struct _PurpleThemeManagerClass PurpleThemeManagerClass; - -#define PURPLE_TYPE_THEME_MANAGER (purple_theme_manager_get_type()) -#define PURPLE_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManager)) -#define PURPLE_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass)) -#define PURPLE_IS_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_THEME_MANAGER)) -#define PURPLE_IS_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_THEME_MANAGER)) -#define PURPLE_GET_THEME_MANAGER_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass)) - -struct _PurpleThemeManager { - GObject parent; -}; - -struct _PurpleThemeManagerClass { - GObjectClass parent_class; -}; - -/**************************************************************************/ -/** @name Purple Theme Manager API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * - * @internal. - */ -GType purple_theme_manager_get_type(void); - -/** - * Initalizes the theme manager. - */ -void purple_theme_manager_init(void); - -/** - * Uninitalizes the manager then frees all the themes and loaders it is - * responsible for. - */ -void purple_theme_manager_uninit(void); - -/** - * Rebuilds all the themes in the theme manager. - * (Removes all current themes but keeps the added loaders.) - */ -void purple_theme_manager_refresh(void); - -/** - * Finds the PurpleTheme object stored by the theme manager. - * - * @param name The name of the PurpleTheme. - * @param type The type of the PurpleTheme. - * - * @returns The PurpleTheme, or NULL if it wasn't found. - */ -PurpleTheme *purple_theme_manager_find_theme(const gchar *name, const gchar *type); - -/** - * Adds a PurpleTheme to the theme manager. If the theme already exists - * then this function does nothing. - * - * @param theme The PurpleTheme to add to the manager. - */ -void purple_theme_manager_add_theme(PurpleTheme *theme); - -/** - * Removes a PurpleTheme from the theme manager and frees the theme. - * - * @param theme The PurpleTheme to remove from the manager. - */ -void purple_theme_manager_remove_theme(PurpleTheme *theme); - -/** - * Adds a loader to the theme manager so it knows how to build themes. - * - * @param loader The PurpleThemeLoader to add. - */ -void purple_theme_manager_register_type(PurpleThemeLoader *loader); - -/** - * Removes the loader and all themes of the same type from the loader. - * - * @param loader The PurpleThemeLoader to be removed. - */ -void purple_theme_manager_unregister_type(PurpleThemeLoader *loader); - -/** - * Calls the given function on each purple theme. - * - * @param func The PTFunc to be applied to each theme. - */ -void purple_theme_manager_for_each_theme(PTFunc func); - -/** - * Loads a theme of the given type without adding it to the manager - * - * @param theme_dir the directory of the theme to load - * @param type the type of theme to load - */ -PurpleTheme *purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type); - -G_END_DECLS -#endif /* PURPLE_THEME_MANAGER_H */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1062 +0,0 @@ -/** - * @file upnp.c UPnP Implementation - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "upnp.h" - -#include "debug.h" -#include "eventloop.h" -#include "network.h" -#include "proxy.h" -#include "signals.h" -#include "util.h" -#include "xmlnode.h" - -/*************************************************************** -** General Defines * -****************************************************************/ -#define HTTP_OK "200 OK" -#define DEFAULT_HTTP_PORT 80 -#define DISCOVERY_TIMEOUT 1000 -/* limit UPnP-triggered http downloads to 128k */ -#define MAX_UPNP_DOWNLOAD (128 * 1024) - -/*************************************************************** -** Discovery/Description Defines * -****************************************************************/ -#define NUM_UDP_ATTEMPTS 2 - -/* Address and port of an SSDP request used for discovery */ -#define HTTPMU_HOST_ADDRESS "239.255.255.250" -#define HTTPMU_HOST_PORT 1900 - -#define SEARCH_REQUEST_DEVICE "urn:schemas-upnp-org:service:%s" - -#define SEARCH_REQUEST_STRING \ - "M-SEARCH * HTTP/1.1\r\n" \ - "MX: 2\r\n" \ - "HOST: 239.255.255.250:1900\r\n" \ - "MAN: \"ssdp:discover\"\r\n" \ - "ST: urn:schemas-upnp-org:service:%s\r\n" \ - "\r\n" - -#define WAN_IP_CONN_SERVICE "WANIPConnection:1" -#define WAN_PPP_CONN_SERVICE "WANPPPConnection:1" - -/****************************************************************** -** Action Defines * -*******************************************************************/ -#define HTTP_HEADER_ACTION \ - "POST /%s HTTP/1.1\r\n" \ - "HOST: %s:%d\r\n" \ - "SOAPACTION: \"urn:schemas-upnp-org:service:%s#%s\"\r\n" \ - "CONTENT-TYPE: text/xml ; charset=\"utf-8\"\r\n" \ - "CONTENT-LENGTH: %" G_GSIZE_FORMAT "\r\n\r\n" - -#define SOAP_ACTION \ - "\r\n" \ - "\r\n" \ - "\r\n" \ - "\r\n" \ - "%s" \ - "\r\n" \ - "\r\n" \ - "" - -#define PORT_MAPPING_LEASE_TIME "0" -#define PORT_MAPPING_DESCRIPTION "PURPLE_UPNP_PORT_FORWARD" - -#define ADD_PORT_MAPPING_PARAMS \ - "\r\n" \ - "%i\r\n" \ - "%s\r\n" \ - "%i\r\n" \ - "%s\r\n" \ - "1\r\n" \ - "" \ - PORT_MAPPING_DESCRIPTION \ - "\r\n" \ - "" \ - PORT_MAPPING_LEASE_TIME \ - "\r\n" - -#define DELETE_PORT_MAPPING_PARAMS \ - "\r\n" \ - "%i\r\n" \ - "%s\r\n" - -typedef enum { - PURPLE_UPNP_STATUS_UNDISCOVERED = -1, - PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER, - PURPLE_UPNP_STATUS_DISCOVERING, - PURPLE_UPNP_STATUS_DISCOVERED -} PurpleUPnPStatus; - -typedef struct { - PurpleUPnPStatus status; - gchar* control_url; - gchar service_type[20]; - char publicip[16]; - char internalip[16]; - time_t lookup_time; -} PurpleUPnPControlInfo; - -typedef struct { - guint inpa; /* purple_input_add handle */ - guint tima; /* purple_timeout_add handle */ - int fd; - struct sockaddr_in server; - gchar service_type[20]; - int retry_count; - gchar *full_url; -} UPnPDiscoveryData; - -struct _UPnPMappingAddRemove -{ - unsigned short portmap; - gchar protocol[4]; - gboolean add; - PurpleUPnPCallback cb; - gpointer cb_data; - guint tima; /* purple_timeout_add handle */ - PurpleUtilFetchUrlData *gfud; -}; - -static PurpleUPnPControlInfo control_info = { - PURPLE_UPNP_STATUS_UNDISCOVERED, - NULL, "\0", "\0", "\0", 0}; - -static GSList *discovery_callbacks = NULL; - -static void purple_upnp_discover_send_broadcast(UPnPDiscoveryData *dd); -static void lookup_public_ip(void); -static void lookup_internal_ip(void); - -static void -fire_discovery_callbacks(gboolean success) -{ - while(discovery_callbacks) { - gpointer data; - PurpleUPnPCallback cb = discovery_callbacks->data; - discovery_callbacks = g_slist_remove(discovery_callbacks, cb); - data = discovery_callbacks->data; - discovery_callbacks = g_slist_remove(discovery_callbacks, data); - cb(success, data); - } -} - -static gboolean -purple_upnp_compare_device(const xmlnode* device, const gchar* deviceType) -{ - xmlnode* deviceTypeNode = xmlnode_get_child(device, "deviceType"); - char *tmp; - gboolean ret; - - if(deviceTypeNode == NULL) { - return FALSE; - } - - tmp = xmlnode_get_data(deviceTypeNode); - ret = !g_ascii_strcasecmp(tmp, deviceType); - g_free(tmp); - - return ret; -} - -static gboolean -purple_upnp_compare_service(const xmlnode* service, const gchar* serviceType) -{ - xmlnode* serviceTypeNode; - char *tmp; - gboolean ret; - - if(service == NULL) { - return FALSE; - } - - serviceTypeNode = xmlnode_get_child(service, "serviceType"); - - if(serviceTypeNode == NULL) { - return FALSE; - } - - tmp = xmlnode_get_data(serviceTypeNode); - ret = !g_ascii_strcasecmp(tmp, serviceType); - g_free(tmp); - - return ret; -} - -static gchar* -purple_upnp_parse_description_response(const gchar* httpResponse, gsize len, - const gchar* httpURL, const gchar* serviceType) -{ - gchar *xmlRoot, *baseURL, *controlURL, *service; - xmlnode *xmlRootNode, *serviceTypeNode, *controlURLNode, *baseURLNode; - char *tmp; - - /* make sure we have a valid http response */ - if(g_strstr_len(httpResponse, len, HTTP_OK) == NULL) { - purple_debug_error("upnp", - "parse_description_response(): Failed In HTTP_OK\n"); - return NULL; - } - - /* find the root of the xml document */ - if((xmlRoot = g_strstr_len(httpResponse, len, " 0) - control_url = purple_upnp_parse_description_response( - httpResponse, len, dd->full_url, dd->service_type); - - g_free(dd->full_url); - - if(control_url == NULL) { - purple_debug_error("upnp", - "purple_upnp_parse_description(): control URL is NULL\n"); - } - - control_info.status = control_url ? PURPLE_UPNP_STATUS_DISCOVERED - : PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER; - control_info.lookup_time = time(NULL); - control_info.control_url = control_url; - strncpy(control_info.service_type, dd->service_type, - sizeof(control_info.service_type)); - - fire_discovery_callbacks(control_url != NULL); - - /* Look up the public and internal IPs */ - if(control_url != NULL) { - lookup_public_ip(); - lookup_internal_ip(); - } - - g_free(dd); -} - -static void -purple_upnp_parse_description(const gchar* descriptionURL, UPnPDiscoveryData *dd) -{ - gchar* httpRequest; - gchar* descriptionXMLAddress; - gchar* descriptionAddress; - int port = 0; - - /* parse the 4 above variables out of the descriptionURL - example description URL: http://192.168.1.1:5678/rootDesc.xml */ - - /* parse the url into address, port, path variables */ - if(!purple_url_parse(descriptionURL, &descriptionAddress, - &port, &descriptionXMLAddress, NULL, NULL)) { - return; - } - if(port == 0 || port == -1) { - port = DEFAULT_HTTP_PORT; - } - - /* for example... - GET /rootDesc.xml HTTP/1.1\r\nHost: 192.168.1.1:5678\r\n\r\n */ - httpRequest = g_strdup_printf( - "GET /%s HTTP/1.1\r\n" - "Connection: close\r\n" - "Host: %s:%d\r\n\r\n", - descriptionXMLAddress, descriptionAddress, port); - - g_free(descriptionXMLAddress); - - dd->full_url = g_strdup_printf("http://%s:%d", - descriptionAddress, port); - g_free(descriptionAddress); - - /* Remove the timeout because everything it is waiting for has - * successfully completed */ - purple_timeout_remove(dd->tima); - dd->tima = 0; - - purple_util_fetch_url_request_len(descriptionURL, TRUE, NULL, TRUE, httpRequest, - TRUE, MAX_UPNP_DOWNLOAD, upnp_parse_description_cb, dd); - - g_free(httpRequest); - -} - -static void -purple_upnp_parse_discover_response(const gchar* buf, unsigned int buf_len, - UPnPDiscoveryData *dd) -{ - gchar* startDescURL; - gchar* endDescURL; - gchar* descURL; - - if(g_strstr_len(buf, buf_len, HTTP_OK) == NULL) { - purple_debug_error("upnp", - "parse_discover_response(): Failed In HTTP_OK\n"); - return; - } - - if((startDescURL = g_strstr_len(buf, buf_len, "http://")) == NULL) { - purple_debug_error("upnp", - "parse_discover_response(): Failed In finding http://\n"); - return; - } - - endDescURL = g_strstr_len(startDescURL, buf_len - (startDescURL - buf), - "\r"); - if(endDescURL == NULL) { - endDescURL = g_strstr_len(startDescURL, - buf_len - (startDescURL - buf), "\n"); - if(endDescURL == NULL) { - purple_debug_error("upnp", - "parse_discover_response(): Failed In endDescURL\n"); - return; - } - } - - /* XXX: I'm not sure how this could ever happen */ - if(endDescURL == startDescURL) { - purple_debug_error("upnp", - "parse_discover_response(): endDescURL == startDescURL\n"); - return; - } - - descURL = g_strndup(startDescURL, endDescURL - startDescURL); - - purple_upnp_parse_description(descURL, dd); - - g_free(descURL); - -} - -static gboolean -purple_upnp_discover_timeout(gpointer data) -{ - UPnPDiscoveryData* dd = data; - - if (dd->inpa) - purple_input_remove(dd->inpa); - dd->inpa = 0; - dd->tima = 0; - - if (dd->retry_count < NUM_UDP_ATTEMPTS) { - /* TODO: We probably shouldn't be incrementing retry_count in two places */ - dd->retry_count++; - purple_upnp_discover_send_broadcast(dd); - } else { - if (dd->fd) - close(dd->fd); - - control_info.status = PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER; - control_info.lookup_time = time(NULL); - control_info.service_type[0] = '\0'; - g_free(control_info.control_url); - control_info.control_url = NULL; - - fire_discovery_callbacks(FALSE); - - g_free(dd); - } - - return FALSE; -} - -static void -purple_upnp_discover_udp_read(gpointer data, gint sock, PurpleInputCondition cond) -{ - int len; - UPnPDiscoveryData *dd = data; - gchar buf[65536]; - - do { - len = recv(dd->fd, buf, - sizeof(buf) - 1, 0); - - if(len > 0) { - buf[len] = '\0'; - break; - } else if(errno != EINTR) { - /* We'll either get called again, or time out */ - return; - } - } while (errno == EINTR); - - purple_input_remove(dd->inpa); - dd->inpa = 0; - - close(dd->fd); - dd->fd = -1; - - /* parse the response, and see if it was a success */ - purple_upnp_parse_discover_response(buf, len, dd); - - /* We'll either time out or continue successfully */ -} - -static void -purple_upnp_discover_send_broadcast(UPnPDiscoveryData *dd) -{ - gchar *sendMessage = NULL; - size_t totalSize; - gboolean sentSuccess; - - /* because we are sending over UDP, if there is a failure - we should retry the send NUM_UDP_ATTEMPTS times. Also, - try different requests for WANIPConnection and WANPPPConnection*/ - for(; dd->retry_count < NUM_UDP_ATTEMPTS; dd->retry_count++) { - sentSuccess = FALSE; - - if((dd->retry_count % 2) == 0) { - strncpy(dd->service_type, WAN_IP_CONN_SERVICE, sizeof(dd->service_type)); - } else { - strncpy(dd->service_type, WAN_PPP_CONN_SERVICE, sizeof(dd->service_type)); - } - - sendMessage = g_strdup_printf(SEARCH_REQUEST_STRING, dd->service_type); - - totalSize = strlen(sendMessage); - - do { - if(sendto(dd->fd, sendMessage, totalSize, 0, - (struct sockaddr*) &(dd->server), - sizeof(struct sockaddr_in) - ) == totalSize) { - sentSuccess = TRUE; - break; - } - } while (errno == EINTR || errno == EAGAIN); - - g_free(sendMessage); - - if(sentSuccess) { - dd->tima = purple_timeout_add(DISCOVERY_TIMEOUT, - purple_upnp_discover_timeout, dd); - dd->inpa = purple_input_add(dd->fd, PURPLE_INPUT_READ, - purple_upnp_discover_udp_read, dd); - - return; - } - } - - /* We have already done all our retries. Make sure that the callback - * doesn't get called before the original function returns */ - purple_timeout_add(10, purple_upnp_discover_timeout, dd); -} - -void -purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data) -{ - /* Socket Setup Variables */ - int sock; - struct hostent* hp; - - /* UDP RECEIVE VARIABLES */ - UPnPDiscoveryData *dd; - - if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) { - if (cb) { - discovery_callbacks = g_slist_append( - discovery_callbacks, cb); - discovery_callbacks = g_slist_append( - discovery_callbacks, cb_data); - } - return; - } - - dd = g_new0(UPnPDiscoveryData, 1); - if (cb) { - discovery_callbacks = g_slist_append(discovery_callbacks, cb); - discovery_callbacks = g_slist_append(discovery_callbacks, - cb_data); - } - - /* Set up the sockets */ - sock = socket(AF_INET, SOCK_DGRAM, 0); - if(sock == -1) { - purple_debug_error("upnp", - "purple_upnp_discover(): Failed In sock creation\n"); - /* Short circuit the retry attempts */ - dd->retry_count = NUM_UDP_ATTEMPTS; - purple_timeout_add(10, purple_upnp_discover_timeout, dd); - return; - } - - dd->fd = sock; - - /* TODO: Non-blocking! */ - if((hp = gethostbyname(HTTPMU_HOST_ADDRESS)) == NULL) { - purple_debug_error("upnp", - "purple_upnp_discover(): Failed In gethostbyname\n"); - /* Short circuit the retry attempts */ - dd->retry_count = NUM_UDP_ATTEMPTS; - purple_timeout_add(10, purple_upnp_discover_timeout, dd); - return; - } - - memset(&(dd->server), 0, sizeof(struct sockaddr)); - dd->server.sin_family = AF_INET; - memcpy(&(dd->server.sin_addr), hp->h_addr_list[0], hp->h_length); - dd->server.sin_port = htons(HTTPMU_HOST_PORT); - - control_info.status = PURPLE_UPNP_STATUS_DISCOVERING; - - purple_upnp_discover_send_broadcast(dd); -} - -static PurpleUtilFetchUrlData* -purple_upnp_generate_action_message_and_send(const gchar* actionName, - const gchar* actionParams, PurpleUtilFetchUrlCallback cb, - gpointer cb_data) -{ - PurpleUtilFetchUrlData* gfud; - gchar* soapMessage; - gchar* totalSendMessage; - gchar* pathOfControl; - gchar* addressOfControl; - int port = 0; - - /* parse the url into address, port, path variables */ - if(!purple_url_parse(control_info.control_url, &addressOfControl, - &port, &pathOfControl, NULL, NULL)) { - purple_debug_error("upnp", - "generate_action_message_and_send(): Failed In Parse URL\n"); - /* XXX: This should probably be async */ - if(cb) - cb(NULL, cb_data, NULL, 0, NULL); - return NULL; - } - if(port == 0 || port == -1) { - port = DEFAULT_HTTP_PORT; - } - - /* set the soap message */ - soapMessage = g_strdup_printf(SOAP_ACTION, actionName, - control_info.service_type, actionParams, actionName); - - /* set the HTTP Header, and append the body to it */ - totalSendMessage = g_strdup_printf(HTTP_HEADER_ACTION "%s", - pathOfControl, addressOfControl, port, - control_info.service_type, actionName, - strlen(soapMessage), soapMessage); - g_free(pathOfControl); - g_free(soapMessage); - - gfud = purple_util_fetch_url_request_len(control_info.control_url, FALSE, NULL, TRUE, - totalSendMessage, TRUE, MAX_UPNP_DOWNLOAD, cb, cb_data); - - g_free(totalSendMessage); - g_free(addressOfControl); - - return gfud; -} - -const gchar * -purple_upnp_get_public_ip() -{ - if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED - && control_info.publicip - && strlen(control_info.publicip) > 0) - return control_info.publicip; - - /* Trigger another UPnP discovery if 5 minutes have elapsed since the - * last one, and it wasn't successful */ - if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING - && (time(NULL) - control_info.lookup_time) > 300) - purple_upnp_discover(NULL, NULL); - - return NULL; -} - -static void -looked_up_public_ip_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *httpResponse, gsize len, const gchar *error_message) -{ - gchar* temp, *temp2; - - if ((error_message != NULL) || (httpResponse == NULL)) - return; - - /* extract the ip, or see if there is an error */ - if((temp = g_strstr_len(httpResponse, len, - ""))) { - purple_debug_error("upnp", - "looked_up_public_ip_cb(): Failed In Finding >\n"); - return; - } - if(!(temp2 = g_strstr_len(temp, len - (temp - httpResponse), "<"))) { - purple_debug_error("upnp", - "looked_up_public_ip_cb(): Failed In Finding <\n"); - return; - } - *temp2 = '\0'; - - strncpy(control_info.publicip, temp + 1, - sizeof(control_info.publicip)); - - purple_debug_info("upnp", "NAT Returned IP: %s\n", control_info.publicip); -} - -static void -lookup_public_ip() -{ - purple_upnp_generate_action_message_and_send("GetExternalIPAddress", "", - looked_up_public_ip_cb, NULL); -} - -/* TODO: This could be exported */ -static const gchar * -purple_upnp_get_internal_ip(void) -{ - if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED - && control_info.internalip - && strlen(control_info.internalip) > 0) - return control_info.internalip; - - /* Trigger another UPnP discovery if 5 minutes have elapsed since the - * last one, and it wasn't successful */ - if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING - && (time(NULL) - control_info.lookup_time) > 300) - purple_upnp_discover(NULL, NULL); - - return NULL; -} - -static void -looked_up_internal_ip_cb(gpointer data, gint source, const gchar *error_message) -{ - if (source) { - strncpy(control_info.internalip, - purple_network_get_local_system_ip(source), - sizeof(control_info.internalip)); - purple_debug_info("upnp", "Local IP: %s\n", - control_info.internalip); - close(source); - } else - purple_debug_error("upnp", "Unable to look up local IP\n"); - -} - -static void -lookup_internal_ip() -{ - gchar* addressOfControl; - int port = 0; - - if(!purple_url_parse(control_info.control_url, &addressOfControl, &port, - NULL, NULL, NULL)) { - purple_debug_error("upnp", - "lookup_internal_ip(): Failed In Parse URL\n"); - return; - } - if(port == 0 || port == -1) { - port = DEFAULT_HTTP_PORT; - } - - if(purple_proxy_connect(NULL, NULL, addressOfControl, port, - looked_up_internal_ip_cb, NULL) == NULL) - { - purple_debug_error("upnp", "Get Local IP Connect Failed: Address: %s @@@ Port %d\n", - addressOfControl, port); - } - - g_free(addressOfControl); -} - -static void -done_port_mapping_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, - const gchar *httpResponse, gsize len, const gchar *error_message) -{ - UPnPMappingAddRemove *ar = user_data; - - gboolean success = TRUE; - - /* determine if port mapping was a success */ - if ((error_message != NULL) || (httpResponse == NULL) || - (g_strstr_len(httpResponse, len, HTTP_OK) == NULL)) - { - purple_debug_error("upnp", - "purple_upnp_set_port_mapping(): Failed HTTP_OK\n%s\n", - httpResponse ? httpResponse : "(null)"); - success = FALSE; - } else - purple_debug_info("upnp", "Successfully completed port mapping operation\n"); - - if (ar->cb) - ar->cb(success, ar->cb_data); - g_free(ar); -} - -static void -do_port_mapping_cb(gboolean has_control_mapping, gpointer data) -{ - UPnPMappingAddRemove *ar = data; - - if (has_control_mapping) { - gchar action_name[25]; - gchar *action_params; - if(ar->add) { - const gchar *internal_ip; - /* get the internal IP */ - if(!(internal_ip = purple_upnp_get_internal_ip())) { - purple_debug_error("upnp", - "purple_upnp_set_port_mapping(): couldn't get local ip\n"); - /* UGLY */ - if (ar->cb) - ar->cb(FALSE, ar->cb_data); - g_free(ar); - return; - } - strncpy(action_name, "AddPortMapping", - sizeof(action_name)); - action_params = g_strdup_printf( - ADD_PORT_MAPPING_PARAMS, - ar->portmap, ar->protocol, ar->portmap, - internal_ip); - } else { - strncpy(action_name, "DeletePortMapping", sizeof(action_name)); - action_params = g_strdup_printf( - DELETE_PORT_MAPPING_PARAMS, - ar->portmap, ar->protocol); - } - - ar->gfud = purple_upnp_generate_action_message_and_send(action_name, - action_params, done_port_mapping_cb, ar); - - g_free(action_params); - return; - } - - - if (ar->cb) - ar->cb(FALSE, ar->cb_data); - g_free(ar); -} - -static gboolean -fire_port_mapping_failure_cb(gpointer data) -{ - do_port_mapping_cb(FALSE, data); - return FALSE; -} - -void purple_upnp_cancel_port_mapping(UPnPMappingAddRemove *ar) -{ - GSList *l; - - /* Remove ar from discovery_callbacks if present; it was inserted after a cb. - * The same cb may be in the list multple times, so be careful to remove the one assocaited with ar. */ - l = discovery_callbacks; - while (l) - { - if (l->next && (l->next->data == ar)) { - discovery_callbacks = g_slist_delete_link(discovery_callbacks, l->next); - discovery_callbacks = g_slist_delete_link(discovery_callbacks, l); - } - - l = l->next; - } - - if (ar->tima > 0) - purple_timeout_remove(ar->tima); - - if (ar->gfud) - purple_util_fetch_url_cancel(ar->gfud); - - g_free(ar); -} - -UPnPMappingAddRemove * -purple_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, - PurpleUPnPCallback cb, gpointer cb_data) -{ - UPnPMappingAddRemove *ar; - - ar = g_new0(UPnPMappingAddRemove, 1); - ar->cb = cb; - ar->cb_data = cb_data; - ar->add = TRUE; - ar->portmap = portmap; - strncpy(ar->protocol, protocol, sizeof(ar->protocol)); - - /* If we're waiting for a discovery, add to the callbacks list */ - if(control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) { - /* TODO: This will fail because when this cb is triggered, - * the internal IP lookup won't be complete */ - discovery_callbacks = g_slist_append( - discovery_callbacks, do_port_mapping_cb); - discovery_callbacks = g_slist_append( - discovery_callbacks, ar); - return ar; - } - - /* If we haven't had a successful UPnP discovery, check if 5 minutes has - * elapsed since the last try, try again */ - if(control_info.status == PURPLE_UPNP_STATUS_UNDISCOVERED || - (control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER - && (time(NULL) - control_info.lookup_time) > 300)) { - purple_upnp_discover(do_port_mapping_cb, ar); - return ar; - } else if(control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER) { - if (cb) { - /* Asynchronously trigger a failed response */ - ar->tima = purple_timeout_add(10, fire_port_mapping_failure_cb, ar); - } else { - /* No need to do anything if nobody expects a response*/ - g_free(ar); - ar = NULL; - } - return ar; - } - - do_port_mapping_cb(TRUE, ar); - return ar; -} - -UPnPMappingAddRemove * -purple_upnp_remove_port_mapping(unsigned short portmap, const char* protocol, - PurpleUPnPCallback cb, gpointer cb_data) -{ - UPnPMappingAddRemove *ar; - - ar = g_new0(UPnPMappingAddRemove, 1); - ar->cb = cb; - ar->cb_data = cb_data; - ar->add = FALSE; - ar->portmap = portmap; - strncpy(ar->protocol, protocol, sizeof(ar->protocol)); - - /* If we're waiting for a discovery, add to the callbacks list */ - if(control_info.status == PURPLE_UPNP_STATUS_DISCOVERING) { - discovery_callbacks = g_slist_append( - discovery_callbacks, do_port_mapping_cb); - discovery_callbacks = g_slist_append( - discovery_callbacks, ar); - return ar; - } - - /* If we haven't had a successful UPnP discovery, check if 5 minutes has - * elapsed since the last try, try again */ - if(control_info.status == PURPLE_UPNP_STATUS_UNDISCOVERED || - (control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER - && (time(NULL) - control_info.lookup_time) > 300)) { - purple_upnp_discover(do_port_mapping_cb, ar); - return ar; - } else if(control_info.status == PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER) { - if (cb) { - /* Asynchronously trigger a failed response */ - ar->tima = purple_timeout_add(10, fire_port_mapping_failure_cb, ar); - } else { - /* No need to do anything if nobody expects a response*/ - g_free(ar); - ar = NULL; - } - return ar; - } - - do_port_mapping_cb(TRUE, ar); - return ar; -} - -static void -purple_upnp_network_config_changed_cb(void *data) -{ - /* Reset the control_info to default values */ - control_info.status = PURPLE_UPNP_STATUS_UNDISCOVERED; - g_free(control_info.control_url); - control_info.control_url = NULL; - control_info.service_type[0] = '\0'; - control_info.publicip[0] = '\0'; - control_info.internalip[0] = '\0'; - control_info.lookup_time = 0; -} - -static void* -purple_upnp_get_handle(void) -{ - static int handle; - - return &handle; -} - -void -purple_upnp_init() -{ - purple_signal_connect(purple_network_get_handle(), "network-configuration-changed", - purple_upnp_get_handle(), PURPLE_CALLBACK(purple_upnp_network_config_changed_cb), - NULL); -} diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.h qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.h --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.h 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/upnp.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,132 +0,0 @@ -/** - * @file upnp.h Universal Plug N Play API - * @ingroup core - */ - -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#ifndef _PURPLE_UPNP_H_ -#define _PURPLE_UPNP_H_ - -typedef struct _UPnPMappingAddRemove UPnPMappingAddRemove; - -#ifdef __cplusplus -extern "C" { -#endif - -/**************************************************************************/ -/** @name UPnP API */ -/**************************************************************************/ -/*@{*/ - -/* typedef struct _PurpleUPnPRequestData PurpleUPnPRequestData; */ - -typedef void (*PurpleUPnPCallback) (gboolean success, gpointer data); - - -/** - * Initialize UPnP - */ -void purple_upnp_init(void); - - -/** - * Sends a discovery request to search for a UPnP enabled IGD that - * contains the WANIPConnection service that will allow us to recieve the - * public IP address of the IGD, and control it for forwarding ports. - * The result will be cached for further use. - * - * @param cb an optional callback function to be notified when the UPnP - * discovery is complete - * @param cb_data Extra data to be passed to the callback - */ -void purple_upnp_discover(PurpleUPnPCallback cb, gpointer cb_data); - -#if 0 -/** - * Retrieve the current UPnP control info, if there is any available. - * This will only be filled in if purple_upnp_discover() had been called, - * and finished discovering. - * - * @return The control URL for the IGD we'll use to use the IGD services - */ -const PurpleUPnPControlInfo* purple_upnp_get_control_info(void); -#endif - -/** - * Gets the IP address from a UPnP enabled IGD that sits on the local - * network, so when getting the network IP, instead of returning the - * local network IP, the public IP is retrieved. This is a cached value from - * the time of the UPnP discovery. - * - * @return The IP address of the network, or NULL if something went wrong - */ -const gchar* purple_upnp_get_public_ip(void); - -/** - * Cancel a pending port mapping request initiated with either - * purple_upnp_set_port_mapping() or purple_upnp_remove_port_mapping(). - * - * @param mapping_data The data returned when you initiated the UPnP mapping request. - */ -void purple_upnp_cancel_port_mapping(UPnPMappingAddRemove *mapping_data); - -/** - * Maps Ports in a UPnP enabled IGD that sits on the local network to - * this purple client. Essentially, this function takes care of the port - * forwarding so things like file transfers can work behind NAT firewalls - * - * @param portmap The port to map to this client - * @param protocol The protocol to map, either "TCP" or "UDP" - * @param cb an optional callback function to be notified when the mapping - * addition is complete - * @param cb_data Extra data to be passed to the callback - * - * @return Data which can be passed to purple_upnp_port_mapping_cancel() to cancel - */ -UPnPMappingAddRemove *purple_upnp_set_port_mapping(unsigned short portmap, const gchar* protocol, - PurpleUPnPCallback cb, gpointer cb_data); - -/** - * Deletes a port mapping in a UPnP enabled IGD that sits on the local network - * to this purple client. Essentially, this function takes care of deleting the - * port forwarding after they have completed a connection so another client on - * the local network can take advantage of the port forwarding - * - * @param portmap The port to delete the mapping for - * @param protocol The protocol to map to. Either "TCP" or "UDP" - * @param cb an optional callback function to be notified when the mapping - * removal is complete - * @param cb_data Extra data to be passed to the callback - * - * @return Data which can be passed to purple_upnp_port_mapping_cancel() to cancel - */ -UPnPMappingAddRemove *purple_upnp_remove_port_mapping(unsigned short portmap, - const gchar* protocol, PurpleUPnPCallback cb, gpointer cb_data); - -/*@}*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _PURPLE_UPNP_H_ */ diff -Nru qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/util.c qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/util.c --- qutecom-2.2+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/util.c 2010-10-18 12:50:12.000000000 +0000 +++ qutecom-2.2.1+dfsg1/libs/3rdparty/libpurple/pidgin-2.6.6/libpurple/util.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5155 +0,0 @@ -/* - * @file util.h Utility Functions - * @ingroup core - */ - -/* Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ -#include "internal.h" - -#include "cipher.h" -#include "conversation.h" -#include "core.h" -#include "debug.h" -#include "notify.h" -#include "prpl.h" -#include "prefs.h" -#include "util.h" - -struct _PurpleUtilFetchUrlData -{ - PurpleUtilFetchUrlCallback callback; - void *user_data; - - struct - { - char *user; - char *passwd; - char *address; - int port; - char *page; - - } website; - - char *url; - int num_times_redirected; - gboolean full; - char *user_agent; - gboolean http11; - char *request; - gsize request_written; - gboolean include_headers; - - gboolean is_ssl; - PurpleSslConnection *ssl_connection; - PurpleProxyConnectData *connect_data; - int fd; - guint inpa; - - gboolean got_headers; - gboolean has_explicit_data_len; - char *webdata; - gsize len; - unsigned long data_len; - gssize max_len; - gboolean chunked; -}; - -static char *custom_user_dir = NULL; -static char *user_dir = NULL; - - -PurpleMenuAction * -purple_menu_action_new(const char *label, PurpleCallback callback, gpointer data, - GList *children) -{ - PurpleMenuAction *act = g_new0(PurpleMenuAction, 1); - act->label = g_strdup(label); - act->callback = callback; - act->data = data; - act->children = children; - return act; -} - -void -purple_menu_action_free(PurpleMenuAction *act) -{ - g_return_if_fail(act != NULL); - - g_free(act->label); - g_free(act); -} - -void -purple_util_init(void) -{ - /* This does nothing right now. It exists for symmetry with - * purple_util_uninit() and forwards compatibility. */ -} - -void -purple_util_uninit(void) -{ - /* Free these so we don't have leaks at shutdown. */ - - g_free(custom_user_dir); - custom_user_dir = NULL; - - g_free(user_dir); - user_dir = NULL; -} - -/************************************************************************** - * Base16 Functions - **************************************************************************/ -gchar * -purple_base16_encode(const guchar *data, gsize len) -{ - int i; - gchar *ascii = NULL; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(len > 0, NULL); - - ascii = g_malloc(len * 2 + 1); - - for (i = 0; i < len; i++) - g_snprintf(&ascii[i * 2], 3, "%02hhx", data[i]); - - return ascii; -} - -guchar * -purple_base16_decode(const char *str, gsize *ret_len) -{ - int len, i, accumulator = 0; - guchar *data; - - g_return_val_if_fail(str != NULL, NULL); - - len = strlen(str); - - g_return_val_if_fail(strlen(str) > 0, 0); - g_return_val_if_fail(len % 2 == 0, 0); - - data = g_malloc(len / 2); - - for (i = 0; i < len; i++) - { - if ((i % 2) == 0) - accumulator = 0; - else - accumulator <<= 4; - - if (isdigit(str[i])) - accumulator |= str[i] - 48; - else - { - switch(tolower(str[i])) - { - case 'a': accumulator |= 10; break; - case 'b': accumulator |= 11; break; - case 'c': accumulator |= 12; break; - case 'd': accumulator |= 13; break; - case 'e': accumulator |= 14; break; - case 'f': accumulator |= 15; break; - } - } - - if (i % 2) - data[(i - 1) / 2] = accumulator; - } - - if (ret_len != NULL) - *ret_len = len / 2; - - return data; -} - -gchar * -purple_base16_encode_chunked(const guchar *data, gsize len) -{ - int i; - gchar *ascii = NULL; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(len > 0, NULL); - - /* For each byte of input, we need 2 bytes for the hex representation - * and 1 for the colon. - * The final colon will be replaced by a terminating NULL - */ - ascii = g_malloc(len * 3 + 1); - - for (i = 0; i < len; i++) - g_snprintf(&ascii[i * 3], 4, "%02hhx:", data[i]); - - /* Replace the final colon with NULL */ - ascii[len * 3 - 1] = 0; - - return ascii; -} - - -/************************************************************************** - * Base64 Functions - **************************************************************************/ -static const char alphabet[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - -static const char xdigits[] = - "0123456789abcdef"; - -gchar * -purple_base64_encode(const guchar *data, gsize len) -{ -#if GLIB_CHECK_VERSION(2,12,0) - return g_base64_encode(data, len); -#else - char *out, *rv; - - g_return_val_if_fail(data != NULL, NULL); - g_return_val_if_fail(len > 0, NULL); - - rv = out = g_malloc(((len/3)+1)*4 + 1); - - for (; len >= 3; len -= 3) - { - *out++ = alphabet[data[0] >> 2]; - *out++ = alphabet[((data[0] << 4) & 0x30) | (data[1] >> 4)]; - *out++ = alphabet[((data[1] << 2) & 0x3c) | (data[2] >> 6)]; - *out++ = alphabet[data[2] & 0x3f]; - data += 3; - } - - if (len > 0) - { - unsigned char fragment; - - *out++ = alphabet[data[0] >> 2]; - fragment = (data[0] << 4) & 0x30; - - if (len > 1) - fragment |= data[1] >> 4; - - *out++ = alphabet[fragment]; - *out++ = (len < 2) ? '=' : alphabet[(data[1] << 2) & 0x3c]; - *out++ = '='; - } - - *out = '\0'; - - return rv; -#endif /* GLIB < 2.12.0 */ -} - -guchar * -purple_base64_decode(const char *str, gsize *ret_len) -{ -#if GLIB_CHECK_VERSION(2,12,0) - /* - * We want to allow ret_len to be NULL for backward compatibility, - * but g_base64_decode() requires a valid length variable. So if - * ret_len is NULL then pass in a dummy variable. - */ - gsize unused; - return g_base64_decode(str, ret_len != NULL ? ret_len : &unused); -#else - guchar *out = NULL; - char tmp = 0; - const char *c; - gint32 tmp2 = 0; - int len = 0, n = 0; - - g_return_val_if_fail(str != NULL, NULL); - - c = str; - - while (*c) { - if (*c >= 'A' && *c <= 'Z') { - tmp = *c - 'A'; - } else if (*c >= 'a' && *c <= 'z') { - tmp = 26 + (*c - 'a'); - } else if (*c >= '0' && *c <= 57) { - tmp = 52 + (*c - '0'); - } else if (*c == '+') { - tmp = 62; - } else if (*c == '/') { - tmp = 63; - } else if (*c == '\r' || *c == '\n') { - c++; - continue; - } else if (*c == '=') { - if (n == 3) { - out = g_realloc(out, len + 2); - out[len] = (guchar)(tmp2 >> 10) & 0xff; - len++; - out[len] = (guchar)(tmp2 >> 2) & 0xff; - len++; - } else if (n == 2) { - out = g_realloc(out, len + 1); - out[len] = (guchar)(tmp2 >> 4) & 0xff; - len++; - } - break; - } - tmp2 = ((tmp2 << 6) | (tmp & 0xff)); - n++; - if (n == 4) { - out = g_realloc(out, len + 3); - out[len] = (guchar)((tmp2 >> 16) & 0xff); - len++; - out[len] = (guchar)((tmp2 >> 8) & 0xff); - len++; - out[len] = (guchar)(tmp2 & 0xff); - len++; - tmp2 = 0; - n = 0; - } - c++; - } - - out = g_realloc(out, len + 1); - out[len] = 0; - - if (ret_len != NULL) - *ret_len = len; - - return out; -#endif /* GLIB < 2.12.0 */ -} - -/************************************************************************** - * Quoted Printable Functions (see RFC 2045). - **************************************************************************/ -guchar * -purple_quotedp_decode(const char *str, gsize *ret_len) -{ - char *n, *new; - const char *end, *p; - - n = new = g_malloc(strlen (str) + 1); - end = str + strlen(str); - - for (p = str; p < end; p++, n++) { - if (*p == '=') { - if (p[1] == '\r' && p[2] == '\n') { /* 5.1 #5 */ - n -= 1; - p += 2; - } else if (p[1] == '\n') { /* fuzzy case for 5.1 #5 */ - n -= 1; - p += 1; - } else if (p[1] && p[2]) { - char *nibble1 = strchr(xdigits, tolower(p[1])); - char *nibble2 = strchr(xdigits, tolower(p[2])); - if (nibble1 && nibble2) { /* 5.1 #1 */ - *n = ((nibble1 - xdigits) << 4) | (nibble2 - xdigits); - p += 2; - } else { /* This should never happen */ - *n = *p; - } - } else { /* This should never happen */ - *n = *p; - } - } - else if (*p == '_') - *n = ' '; - else - *n = *p; - } - - *n = '\0'; - - if (ret_len != NULL) - *ret_len = n - new; - - /* Resize to take less space */ - /* new = realloc(new, n - new); */ - - return (guchar *)new; -} - -/************************************************************************** - * MIME Functions - **************************************************************************/ -char * -purple_mime_decode_field(const char *str) -{ - /* - * This is wing's version, partially based on revo/shx's version - * See RFC2047 [which apparently obsoletes RFC1342] - */ - typedef enum { - state_start, state_equal1, state_question1, - state_charset, state_question2, - state_encoding, state_question3, - state_encoded_text, state_question4, state_equal2 = state_start - } encoded_word_state_t; - encoded_word_state_t state = state_start; - const char *cur, *mark; - const char *charset0 = NULL, *encoding0 = NULL, *encoded_text0 = NULL; - GString *new; - - /* token can be any CHAR (supposedly ISO8859-1/ISO2022), not just ASCII */ - #define token_char_p(c) \ - (c != ' ' && !iscntrl(c) && !strchr("()<>@,;:\"/[]?.=", c)) - - /* But encoded-text must be ASCII; alas, isascii() may not exist */ - #define encoded_text_char_p(c) \ - ((c & 0x80) == 0 && c != '?' && c != ' ' && isgraph(c)) - - g_return_val_if_fail(str != NULL, NULL); - - new = g_string_new(NULL); - - /* Here we will be looking for encoded words and if they seem to be - * valid then decode them. - * They are of this form: =?charset?encoding?text?= - */ - - for (cur = str, mark = NULL; *cur; cur += 1) { - switch (state) { - case state_equal1: - if (*cur == '?') { - state = state_question1; - } else { - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question1: - if (token_char_p(*cur)) { - charset0 = cur; - state = state_charset; - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_charset: - if (*cur == '?') { - state = state_question2; - } else if (!token_char_p(*cur)) { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question2: - if (token_char_p(*cur)) { - encoding0 = cur; - state = state_encoding; - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_encoding: - if (*cur == '?') { - state = state_question3; - } else if (!token_char_p(*cur)) { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question3: - if (encoded_text_char_p(*cur)) { - encoded_text0 = cur; - state = state_encoded_text; - } else if (*cur == '?') { /* empty string */ - encoded_text0 = cur; - state = state_question4; - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_encoded_text: - if (*cur == '?') { - state = state_question4; - } else if (!encoded_text_char_p(*cur)) { - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - case state_question4: - if (*cur == '=') { /* Got the whole encoded-word */ - char *charset = g_strndup(charset0, encoding0 - charset0 - 1); - char *encoding = g_strndup(encoding0, encoded_text0 - encoding0 - 1); - char *encoded_text = g_strndup(encoded_text0, cur - encoded_text0 - 1); - guchar *decoded = NULL; - gsize dec_len; - if (g_ascii_strcasecmp(encoding, "Q") == 0) - decoded = purple_quotedp_decode(encoded_text, &dec_len); - else if (g_ascii_strcasecmp(encoding, "B") == 0) - decoded = purple_base64_decode(encoded_text, &dec_len); - else - decoded = NULL; - if (decoded) { - gsize len; - char *converted = g_convert((const gchar *)decoded, dec_len, "utf-8", charset, NULL, &len, NULL); - - if (converted) { - g_string_append_len(new, converted, len); - g_free(converted); - } - g_free(decoded); - } - g_free(charset); - g_free(encoding); - g_free(encoded_text); - state = state_equal2; /* Restart the FSM */ - } else { /* This should never happen */ - g_string_append_len(new, mark, cur - mark + 1); - state = state_start; - } - break; - default: - if (*cur == '=') { - mark = cur; - state = state_equal1; - } else { - /* Some unencoded text. */ - g_string_append_c(new, *cur); - } - break; - } /* switch */ - } /* for */ - - if (state != state_start) - g_string_append_len(new, mark, cur - mark + 1); - - return g_string_free(new, FALSE);; -} - - -/************************************************************************** - * Date/Time Functions - **************************************************************************/ - -const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso) -{ - static char buf[7]; - long off; - gint8 min; - gint8 hrs; - struct tm new_tm = *tm; - - mktime(&new_tm); - - if (new_tm.tm_isdst < 0) - g_return_val_if_reached(""); - -#ifdef _WIN32 - if ((off = wpurple_get_tz_offset()) == -1) - return ""; -#else -# ifdef HAVE_TM_GMTOFF - off = new_tm.tm_gmtoff; -# else -# ifdef HAVE_TIMEZONE - tzset(); - off = -1 * timezone; -# endif /* HAVE_TIMEZONE */ -# endif /* !HAVE_TM_GMTOFF */ -#endif /* _WIN32 */ - - min = (off / 60) % 60; - hrs = ((off / 60) - min) / 60; - - if(iso) { - if (0 == off) { - strcpy(buf, "Z"); - } else { - /* please leave the colons...they're optional for iso, but jabber - * wants them */ - if(g_snprintf(buf, sizeof(buf), "%+03d:%02d", hrs, ABS(min)) > 6) - g_return_val_if_reached(""); - } - } else { - if (g_snprintf(buf, sizeof(buf), "%+03d%02d", hrs, ABS(min)) > 5) - g_return_val_if_reached(""); - } - - return buf; -} - -/* Windows doesn't HAVE_STRFTIME_Z_FORMAT, but this seems clearer. -- rlaager */ -#if !defined(HAVE_STRFTIME_Z_FORMAT) || defined(_WIN32) -static size_t purple_internal_strftime(char *s, size_t max, const char *format, const struct tm *tm) -{ - const char *start; - const char *c; - char *fmt = NULL; - - /* Yes, this is checked in purple_utf8_strftime(), - * but better safe than sorry. -- rlaager */ - g_return_val_if_fail(format != NULL, 0); - - /* This is fairly efficient, and it only gets - * executed on Windows or if the underlying - * system doesn't support the %z format string, - * for strftime() so I think it's good enough. - * -- rlaager */ - for (c = start = format; *c ; c++) - { - if (*c != '%') - continue; - - c++; - -#ifndef HAVE_STRFTIME_Z_FORMAT - if (*c == 'z') - { - char *tmp = g_strdup_printf("%s%.*s%s", - fmt ? fmt : "", - c - start - 1, - start, - purple_get_tzoff_str(tm, FALSE)); - g_free(fmt); - fmt = tmp; - start = c + 1; - } -#endif -#ifdef _WIN32 - if (*c == 'Z') - { - char *tmp = g_strdup_printf("%s%.*s%s", - fmt ? fmt : "", - c - start - 1, - start, - wpurple_get_timezone_abbreviation(tm)); - g_free(fmt); - fmt = tmp; - start = c + 1; - } -#endif - } - - if (fmt != NULL) - { - size_t ret; - - if (*start) - { - char *tmp = g_strconcat(fmt, start, NULL); - g_free(fmt); - fmt = tmp; - } - - ret = strftime(s, max, fmt, tm); - g_free(fmt); - - return ret; - } - - return strftime(s, max, format, tm); -} -#else /* HAVE_STRFTIME_Z_FORMAT && !_WIN32 */ -#define purple_internal_strftime strftime -#endif - -const char * -purple_utf8_strftime(const char *format, const struct tm *tm) -{ - static char buf[128]; - char *locale; - GError *err = NULL; - int len; - char *utf8; - - g_return_val_if_fail(format != NULL, NULL); - - if (tm == NULL) - { - time_t now = time(NULL); - tm = localtime(&now); - } - - locale = g_locale_from_utf8(format, -1, NULL, NULL, &err); - if (err != NULL) - { - purple_debug_error("util", "Format conversion failed in purple_utf8_strftime(): %s\n", err->message); - g_error_free(err); - locale = g_strdup(format); - } - - /* A return value of 0 is either an error (in - * which case, the contents of the buffer are - * undefined) or the empty string (in which - * case, no harm is done here). */ - if ((len = purple_internal_strftime(buf, sizeof(buf), locale, tm)) == 0) - { - g_free(locale); - return ""; - } - - g_free(locale); - - utf8 = g_locale_to_utf8(buf, len, NULL, NULL, &err); - if (err != NULL) - { - purple_debug_error("util", "Result conversion failed in purple_utf8_strftime(): %s\n", err->message); - g_error_free(err); - } - else - { - purple_strlcpy(buf, utf8); - g_free(utf8); - } - - return buf; -} - -const char * -purple_date_format_short(const struct tm *tm) -{ - return purple_utf8_strftime("%x", tm); -} - -const char * -purple_date_format_long(const struct tm *tm) -{ - /* - * This string determines how some dates are displayed. The default - * string "%x %X" shows the date then the time. Translators can - * change this to "%X %x" if they want the time to be shown first, - * followed by the date. - */ - return purple_utf8_strftime(_("%x %X"), tm); -} - -const char * -purple_date_format_full(const struct tm *tm) -{ - return purple_utf8_strftime("%c", tm); -} - -const char * -purple_time_format(const struct tm *tm) -{ - return purple_utf8_strftime("%X", tm); -} - -time_t -purple_time_build(int year, int month, int day, int hour, int min, int sec) -{ - struct tm tm; - - tm.tm_year = year - 1900; - tm.tm_mon = month - 1; - tm.tm_mday = day; - tm.tm_hour = hour; - tm.tm_min = min; - tm.tm_sec = sec >= 0 ? sec : time(NULL) % 60; - - return mktime(&tm); -} - -time_t -purple_str_to_time(const char *timestamp, gboolean utc, - struct tm *tm, long *tz_off, const char **rest) -{ - time_t retval = 0; - static struct tm t; - const char *c = timestamp; - int year = 0; - long tzoff = PURPLE_NO_TZ_OFF; - - time(&retval); - localtime_r(&retval, &t); - - if (rest != NULL) - *rest = NULL; - - /* 4 digit year */ - if (sscanf(c, "%04d", &year) && year > 1900) - { - c += 4; - if (*c == '-') - c++; - t.tm_year = year - 1900; - } - - /* 2 digit month */ - if (!sscanf(c, "%02d", &t.tm_mon)) - { - if (rest != NULL && *c != '\0') - *rest = c; - return 0; - } - c += 2; - if (*c == '-' || *c == '/') - c++; - t.tm_mon -= 1; - - /* 2 digit day */ - if (!sscanf(c, "%02d", &t.tm_mday)) - { - if (rest != NULL && *c != '\0') - *rest = c; - return 0; - } - c += 2; - if (*c == '/') - { - c++; - - if (!sscanf(c, "%04d", &t.tm_year)) - { - if (rest != NULL && *c != '\0') - *rest = c; - return 0; - } - t.tm_year -= 1900; - } - else if (*c == 'T' || *c == '.') - { - c++; - /* we have more than a date, keep going */ - - /* 2 digit hour */ - if ((sscanf(c, "%02d:%02d:%02d", &t.tm_hour, &t.tm_min, &t.tm_sec) == 3 && (c = c + 8)) || - (sscanf(c, "%02d%02d%02d", &t.tm_hour, &t.tm_min, &t.tm_sec) == 3 && (c = c + 6))) - { - gboolean offset_positive = FALSE; - int tzhrs; - int tzmins; - - t.tm_isdst = -1; - - if (*c == '.') { - do { - c++; - } while (*c >= '0' && *c <= '9'); /* dealing with precision we don't care about */ - } - if (*c == '+') - offset_positive = TRUE; - if (((*c == '+' || *c == '-') && (c = c + 1)) && - ((sscanf(c, "%02d:%02d", &tzhrs, &tzmins) == 2 && (c = c + 5)) || - (sscanf(c, "%02d%02d", &tzhrs, &tzmins) == 2 && (c = c + 4)))) - { - tzoff = tzhrs*60*60 + tzmins*60; - if (offset_positive) - tzoff *= -1; - } - else if ((*c == 'Z') && (c = c + 1)) - { - /* 'Z' = Zulu = UTC */ - tzoff = 0; - } - else if (utc) - { - static struct tm tmptm; - time_t tmp; - tmp = mktime(&t); - /* we care about whether it *was* dst, and the offset, here on this - * date, not whether we are currently observing dst locally *now*. - * This isn't perfect, because we would need to know in advance the - * offset we are trying to work out in advance to be sure this - * works for times around dst transitions but it'll have to do. */ - localtime_r(&tmp, &tmptm); - t.tm_isdst = tmptm.tm_isdst; -#ifdef HAVE_TM_GMTOFF - t.tm_gmtoff = tmptm.tm_gmtoff; -#endif - } - - if (rest != NULL && *c != '\0') - { - if (*c == ' ') - c++; - if (*c != '\0') - *rest = c; - } - - if (tzoff != PURPLE_NO_TZ_OFF || utc) - { -#if defined(_WIN32) - long sys_tzoff; -#endif - -#if defined(_WIN32) || defined(HAVE_TM_GMTOFF) || defined (HAVE_TIMEZONE) - if (tzoff == PURPLE_NO_TZ_OFF) - tzoff = 0; -#endif - -#ifdef _WIN32 - if ((sys_tzoff = wpurple_get_tz_offset()) == -1) - tzoff = PURPLE_NO_TZ_OFF; - else - tzoff += sys_tzoff; -#else -#ifdef HAVE_TM_GMTOFF - tzoff += t.tm_gmtoff; -#else -# ifdef HAVE_TIMEZONE - tzset(); /* making sure */ - tzoff -= timezone; -# endif -#endif -#endif /* _WIN32 */ - } - } - else - { - if (rest != NULL && *c != '\0') - *rest = c; - } - } - - retval = mktime(&t); - - if (tm != NULL) - *tm = t; - - if (tzoff != PURPLE_NO_TZ_OFF) - retval += tzoff; - - if (tz_off != NULL) - *tz_off = tzoff; - - return retval; -} - -/************************************************************************** - * Markup Functions - **************************************************************************/ - -/* - * This function is stolen from glib's gmarkup.c and modified to not - * replace ' with ' - */ -static void append_escaped_text(GString *str, - const gchar *text, gssize length) -{ - const gchar *p; - const gchar *end; - gunichar c; - - p = text; - end = text + length; - - while (p != end) - { - const gchar *next; - next = g_utf8_next_char (p); - - switch (*p) - { - case '&': - g_string_append (str, "&"); - break; - - case '<': - g_string_append (str, "<"); - break; - - case '>': - g_string_append (str, ">"); - break; - - case '"': - g_string_append (str, """); - break; - - default: - c = g_utf8_get_char (p); - if ((0x1 <= c && c <= 0x8) || - (0xb <= c && c <= 0xc) || - (0xe <= c && c <= 0x1f) || - (0x7f <= c && c <= 0x84) || - (0x86 <= c && c <= 0x9f)) - g_string_append_printf (str, "&#x%x;", c); - else - g_string_append_len (str, p, next - p); - break; - } - - p = next; - } -} - -/* This function is stolen from glib's gmarkup.c */ -gchar *purple_markup_escape_text(const gchar *text, gssize length) -{ - GString *str; - - g_return_val_if_fail(text != NULL, NULL); - - if (length < 0) - length = strlen(text); - - /* prealloc at least as long as original text */ - str = g_string_sized_new(length); - append_escaped_text(str, text, length); - - return g_string_free(str, FALSE); -} - -const char * -purple_markup_unescape_entity(const char *text, int *length) -{ - const char *pln; - int len, pound; - char temp[2]; - - if (!text || *text != '&') - return NULL; - -#define IS_ENTITY(s) (!g_ascii_strncasecmp(text, s, (len = sizeof(s) - 1))) - - if(IS_ENTITY("&")) - pln = "&"; - else if(IS_ENTITY("<")) - pln = "<"; - else if(IS_ENTITY(">")) - pln = ">"; - else if(IS_ENTITY(" ")) - pln = " "; - else if(IS_ENTITY("©")) - pln = "\302\251"; /* or use g_unichar_to_utf8(0xa9); */ - else if(IS_ENTITY(""")) - pln = "\""; - else if(IS_ENTITY("®")) - pln = "\302\256"; /* or use g_unichar_to_utf8(0xae); */ - else if(IS_ENTITY("'")) - pln = "\'"; - else if(*(text+1) == '#' && - (sscanf(text, "&#%u%1[;]", £, temp) == 2 || - sscanf(text, "&#x%x%1[;]", £, temp) == 2) && - pound != 0) { - static char buf[7]; - int buflen = g_unichar_to_utf8((gunichar)pound, buf); - buf[buflen] = '\0'; - pln = buf; - - len = (*(text+2) == 'x' ? 3 : 2); - while(isxdigit((gint) text[len])) len++; - if(text[len] == ';') len++; - } - else - return NULL; - - if (length) - *length = len; - return pln; -} - -char * -purple_markup_get_css_property(const gchar *style, - const gchar *opt) -{ - const gchar *css_str = style; - const gchar *css_value_start; - const gchar *css_value_end; - gchar *tmp; - gchar *ret; - - g_return_val_if_fail(opt != NULL, NULL); - - if (!css_str) - return NULL; - - /* find the CSS property */ - while (1) - { - /* skip whitespace characters */ - while (*css_str && g_ascii_isspace(*css_str)) - css_str++; - if (!g_ascii_isalpha(*css_str)) - return NULL; - if (g_ascii_strncasecmp(css_str, opt, strlen(opt))) - { - /* go to next css property positioned after the next ';' */ - while (*css_str && *css_str != '"' && *css_str != ';') - css_str++; - if(*css_str != ';') - return NULL; - css_str++; - } - else - break; - } - - /* find the CSS value position in the string */ - css_str += strlen(opt); - while (*css_str && g_ascii_isspace(*css_str)) - css_str++; - if (*css_str != ':') - return NULL; - css_str++; - while (*css_str && g_ascii_isspace(*css_str)) - css_str++; - if (*css_str == '\0' || *css_str == '"' || *css_str == ';') - return NULL; - - /* mark the CSS value */ - css_value_start = css_str; - while (*css_str && *css_str != '"' && *css_str != ';') - css_str++; - css_value_end = css_str - 1; - - /* Removes trailing whitespace */ - while (css_value_end > css_value_start && g_ascii_isspace(*css_value_end)) - css_value_end--; - - tmp = g_strndup(css_value_start, css_value_end - css_value_start + 1); - ret = purple_unescape_html(tmp); - g_free(tmp); - - return ret; -} - -gboolean purple_markup_is_rtl(const char *html) -{ - GData *attributes; - const gchar *start, *end; - gboolean res = FALSE; - - if (purple_markup_find_tag("span", html, &start, &end, &attributes)) - { - /* tmp is a member of attributes and is free with g_datalist_clear call */ - const char *tmp = g_datalist_get_data(&attributes, "dir"); - if (tmp && !g_ascii_strcasecmp(tmp, "RTL")) - res = TRUE; - if (!res) - { - tmp = g_datalist_get_data(&attributes, "style"); - if (tmp) - { - char *tmp2 = purple_markup_get_css_property(tmp, "direction"); - if (tmp2 && !g_ascii_strcasecmp(tmp2, "RTL")) - res = TRUE; - g_free(tmp2); - } - - } - g_datalist_clear(&attributes); - } - return res; -} - -gboolean -purple_markup_find_tag(const char *needle, const char *haystack, - const char **start, const char **end, GData **attributes) -{ - GData *attribs; - const char *cur = haystack; - char *name = NULL; - gboolean found = FALSE; - gboolean in_tag = FALSE; - gboolean in_attr = FALSE; - const char *in_quotes = NULL; - size_t needlelen; - - g_return_val_if_fail( needle != NULL, FALSE); - g_return_val_if_fail( *needle != '\0', FALSE); - g_return_val_if_fail( haystack != NULL, FALSE); - g_return_val_if_fail( start != NULL, FALSE); - g_return_val_if_fail( end != NULL, FALSE); - g_return_val_if_fail(attributes != NULL, FALSE); - - needlelen = strlen(needle); - g_datalist_init(&attribs); - - while (*cur && !found) { - if (in_tag) { - if (in_quotes) { - const char *close = cur; - - while (*close && *close != *in_quotes) - close++; - - /* if we got the close quote, store the value and carry on from * - * after it. if we ran to the end of the string, point to the NULL * - * and we're outta here */ - if (*close) { - /* only store a value if we have an attribute name */ - if (name) { - size_t len = close - cur; - char *val = g_strndup(cur, len); - - g_datalist_set_data_full(&attribs, name, val, g_free); - g_free(name); - name = NULL; - } - - in_quotes = NULL; - cur = close + 1; - } else { - cur = close; - } - } else if (in_attr) { - const char *close = cur; - - while (*close && *close != '>' && *close != '"' && - *close != '\'' && *close != ' ' && *close != '=') - close++; - - /* if we got the equals, store the name of the attribute. if we got - * the quote, save the attribute and go straight to quote mode. - * otherwise the tag closed or we reached the end of the string, - * so we can get outta here */ - switch (*close) { - case '"': - case '\'': - in_quotes = close; - case '=': - { - size_t len = close - cur; - - /* don't store a blank attribute name */ - if (len) { - g_free(name); - name = g_ascii_strdown(cur, len); - } - - in_attr = FALSE; - cur = close + 1; - break; - } - case ' ': - case '>': - in_attr = FALSE; - default: - cur = close; - break; - } - } else { - switch (*cur) { - case ' ': - /* swallow extra spaces inside tag */ - while (*cur && *cur == ' ') cur++; - in_attr = TRUE; - break; - case '>': - found = TRUE; - *end = cur; - break; - case '"': - case '\'': - in_quotes = cur; - default: - cur++; - break; - } - } - } else { - /* if we hit a < followed by the name of our tag... */ - if (*cur == '<' && !g_ascii_strncasecmp(cur + 1, needle, needlelen)) { - *start = cur; - cur = cur + needlelen + 1; - - /* if we're pointing at a space or a >, we found the right tag. if * - * we're not, we've found a longer tag, so we need to skip to the * - * >, but not being distracted by >s inside quotes. */ - if (*cur == ' ' || *cur == '>') { - in_tag = TRUE; - } else { - while (*cur && *cur != '"' && *cur != '\'' && *cur != '>') { - if (*cur == '"') { - cur++; - while (*cur && *cur != '"') - cur++; - } else if (*cur == '\'') { - cur++; - while (*cur && *cur != '\'') - cur++; - } else { - cur++; - } - } - } - } else { - cur++; - } - } - } - - /* clean up any attribute name from a premature termination */ - g_free(name); - - if (found) { - *attributes = attribs; - } else { - *start = NULL; - *end = NULL; - *attributes = NULL; - } - - return found; -} - -gboolean -purple_markup_extract_info_field(const char *str, int len, PurpleNotifyUserInfo *user_info, - const char *start_token, int skip, - const char *end_token, char check_value, - const char *no_value_token, - const char *display_name, gboolean is_link, - const char *link_prefix, - PurpleInfoFieldFormatCallback format_cb) -{ - const char *p, *q; - - g_return_val_if_fail(str != NULL, FALSE); - g_return_val_if_fail(user_info != NULL, FALSE); - g_return_val_if_fail(start_token != NULL, FALSE); - g_return_val_if_fail(end_token != NULL, FALSE); - g_return_val_if_fail(display_name != NULL, FALSE); - - p = strstr(str, start_token); - - if (p == NULL) - return FALSE; - - p += strlen(start_token) + skip; - - if (p >= str + len) - return FALSE; - - if (check_value != '\0' && *p == check_value) - return FALSE; - - q = strstr(p, end_token); - - /* Trim leading blanks */ - while (*p != '\n' && g_ascii_isspace(*p)) { - p += 1; - } - - /* Trim trailing blanks */ - while (q > p && g_ascii_isspace(*(q - 1))) { - q -= 1; - } - - /* Don't bother with null strings */ - if (p == q) - return FALSE; - - if (q != NULL && (!no_value_token || - (no_value_token && strncmp(p, no_value_token, - strlen(no_value_token))))) - { - GString *dest = g_string_new(""); - - if (is_link) - { - g_string_append(dest, ""); - - if (link_prefix) - g_string_append(dest, link_prefix); - - g_string_append_len(dest, p, q - p); - g_string_append(dest, ""); - } - else - { - if (format_cb != NULL) - { - char *reformatted = format_cb(p, q - p); - g_string_append(dest, reformatted); - g_free(reformatted); - } - else - g_string_append_len(dest, p, q - p); - } - - purple_notify_user_info_add_pair(user_info, display_name, dest->str); - g_string_free(dest, TRUE); - - return TRUE; - } - - return FALSE; -} - -struct purple_parse_tag { - char *src_tag; - char *dest_tag; - gboolean ignore; -}; - -/* NOTE: Do not put `do {} while(0)` around this macro (as this is the method - recommended in the GCC docs). It contains 'continue's that should - affect the while-loop in purple_markup_html_to_xhtml and doing the - above would break that. - Also, remember to put braces in constructs that require them for - multiple statements when using this macro. */ -#define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ - const char *o = c + strlen("<" x); \ - const char *p = NULL, *q = NULL, *r = NULL; \ - GString *innards = g_string_new(""); \ - while(o && *o) { \ - if(!q && (*o == '\"' || *o == '\'') ) { \ - q = o; \ - } else if(q) { \ - if(*o == *q) { \ - char *unescaped = g_strndup(q+1, o-q-1); \ - char *escaped = g_markup_escape_text(unescaped, -1); \ - g_string_append_printf(innards, "%c%s%c", *q, escaped, *q); \ - g_free(unescaped); \ - g_free(escaped); \ - q = NULL; \ - } else if(*c == '\\') { \ - o++; \ - } \ - } else if(*o == '<') { \ - r = o; \ - } else if(*o == '>') { \ - p = o; \ - break; \ - } else { \ - innards = g_string_append_c(innards, *o); \ - } \ - o++; \ - } \ - if(p && !r) { \ - if(*(p-1) != '/') { \ - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ - pt->src_tag = x; \ - pt->dest_tag = y; \ - tags = g_list_prepend(tags, pt); \ - } \ - if(xhtml) { \ - xhtml = g_string_append(xhtml, "<" y); \ - xhtml = g_string_append(xhtml, innards->str); \ - xhtml = g_string_append_c(xhtml, '>'); \ - } \ - c = p + 1; \ - } else { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "<"); \ - if(plain) \ - plain = g_string_append_c(plain, '<'); \ - c++; \ - } \ - g_string_free(innards, TRUE); \ - continue; \ - } \ - if(!g_ascii_strncasecmp(c, "<" x, strlen("<" x)) && \ - (*(c+strlen("<" x)) == '>' || \ - !g_ascii_strncasecmp(c+strlen("<" x), "/>", 2))) { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "<" y); \ - c += strlen("<" x); \ - if(*c != '/') { \ - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); \ - pt->src_tag = x; \ - pt->dest_tag = y; \ - tags = g_list_prepend(tags, pt); \ - if(xhtml) \ - xhtml = g_string_append_c(xhtml, '>'); \ - } else { \ - if(xhtml) \ - xhtml = g_string_append(xhtml, "/>");\ - } \ - c = strchr(c, '>') + 1; \ - continue; \ - } -/* Don't forget to check the note above for ALLOW_TAG_ALT. */ -#define ALLOW_TAG(x) ALLOW_TAG_ALT(x, x) -void -purple_markup_html_to_xhtml(const char *html, char **xhtml_out, - char **plain_out) -{ - GString *xhtml = NULL; - GString *plain = NULL; - GString *url = NULL; - GString *cdata = NULL; - GList *tags = NULL, *tag; - const char *c = html; - char quote = '\0'; - -#define CHECK_QUOTE(ptr) if (*(ptr) == '\'' || *(ptr) == '\"') \ - quote = *(ptr++); \ - else \ - quote = '\0'; - -#define VALID_CHAR(ptr) (*(ptr) && *(ptr) != quote && (quote || (*(ptr) != ' ' && *(ptr) != '>'))) - - g_return_if_fail(xhtml_out != NULL || plain_out != NULL); - - if(xhtml_out) - xhtml = g_string_new(""); - if(plain_out) - plain = g_string_new(""); - - while(c && *c) { - if(*c == '<') { - if(*(c+1) == '/') { /* closing tag */ - tag = tags; - while(tag) { - struct purple_parse_tag *pt = tag->data; - if(!g_ascii_strncasecmp((c+2), pt->src_tag, strlen(pt->src_tag)) && *(c+strlen(pt->src_tag)+2) == '>') { - c += strlen(pt->src_tag) + 3; - break; - } - tag = tag->next; - } - if(tag) { - while(tags) { - struct purple_parse_tag *pt = tags->data; - if(xhtml && !pt->ignore) - g_string_append_printf(xhtml, "", pt->dest_tag); - if(plain && purple_strequal(pt->src_tag, "a")) { - /* if this is a link, we have to add the url to the plaintext, too */ - if (cdata && url && - (!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 || - g_utf8_collate(url->str + 7, cdata->str) != 0))) - g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); - if (cdata) { - g_string_free(cdata, TRUE); - cdata = NULL; - } - - } - if(tags == tag) - break; - tags = g_list_remove(tags, pt); - g_free(pt); - } - g_free(tag->data); - tags = g_list_remove(tags, tag->data); - } else { - /* a closing tag we weren't expecting... - * we'll let it slide, if it's really a tag...if it's - * just a ') { - c = end+1; - } else { - if(xhtml) - xhtml = g_string_append(xhtml, "<"); - if(plain) - plain = g_string_append_c(plain, '<'); - c++; - } - } - } else { /* opening tag */ - ALLOW_TAG("blockquote"); - ALLOW_TAG("cite"); - ALLOW_TAG("div"); - ALLOW_TAG("em"); - ALLOW_TAG("h1"); - ALLOW_TAG("h2"); - ALLOW_TAG("h3"); - ALLOW_TAG("h4"); - ALLOW_TAG("h5"); - ALLOW_TAG("h6"); - /* we only allow html to start the message */ - if(c == html) { - ALLOW_TAG("html"); - } - ALLOW_TAG_ALT("i", "em"); - ALLOW_TAG_ALT("italic", "em"); - ALLOW_TAG("li"); - ALLOW_TAG("ol"); - ALLOW_TAG("p"); - ALLOW_TAG("pre"); - ALLOW_TAG("q"); - ALLOW_TAG("span"); - ALLOW_TAG("ul"); - - - /* we skip
because it's not legal in XHTML-IM. However, - * we still want to send something sensible, so we put a - * linebreak in its place.
also needs special handling - * because putting a
to close it would just be dumb. */ - if((!g_ascii_strncasecmp(c, "' || - !g_ascii_strncasecmp(c+3, "/>", 2) || - !g_ascii_strncasecmp(c+3, " />", 3))) { - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, "
"); - if(plain && *c != '\n') - plain = g_string_append_c(plain, '\n'); - continue; - } - if(!g_ascii_strncasecmp(c, "", 3) || !g_ascii_strncasecmp(c, "", strlen("")) || !g_ascii_strncasecmp(c, "", strlen(""))) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - if (*(c+2) == '>') - pt->src_tag = "b"; - else if (*(c+2) == 'o') - pt->src_tag = "bold"; - else - pt->src_tag = "strong"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 3) || !g_ascii_strncasecmp(c, "", strlen(""))) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = *(c+2) == '>' ? "u" : "underline"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if (xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 3) || !g_ascii_strncasecmp(c, "", strlen(""))) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = *(c+2) == '>' ? "s" : "strike"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 5)) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "sub"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if(!g_ascii_strncasecmp(c, "", 5)) { - struct purple_parse_tag *pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "sup"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - c = strchr(c, '>') + 1; - if(xhtml) - xhtml = g_string_append(xhtml, ""); - continue; - } - if (!g_ascii_strncasecmp(c, "' || *(c+4) == ' ')) { - const char *p = c + 4; - GString *src = NULL, *alt = NULL; - while (*p && *p != '>') { - if (!g_ascii_strncasecmp(p, "src=", 4)) { - const char *q = p + 4; - if (src) - g_string_free(src, TRUE); - src = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - src = g_string_append_c(src, *q); - q++; - } - p = q; - } else if (!g_ascii_strncasecmp(p, "alt=", 4)) { - const char *q = p + 4; - if (alt) - g_string_free(alt, TRUE); - alt = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - alt = g_string_append_c(alt, *q); - q++; - } - p = q; - } else { - p++; - } - } - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - /* src and alt are required! */ - if(src && xhtml) - g_string_append_printf(xhtml, "%s", g_strstrip(src->str), alt ? alt->str : ""); - if(alt) { - if(plain) - plain = g_string_append(plain, alt->str); - if(!src && xhtml) - xhtml = g_string_append(xhtml, alt->str); - g_string_free(alt, TRUE); - } - g_string_free(src, TRUE); - continue; - } - if (!g_ascii_strncasecmp(c, "' || *(c+2) == ' ')) { - const char *p = c + 2; - struct purple_parse_tag *pt; - while (*p && *p != '>') { - if (!g_ascii_strncasecmp(p, "href=", 5)) { - const char *q = p + 5; - if (url) - g_string_free(url, TRUE); - url = g_string_new(""); - if (cdata) - g_string_free(cdata, TRUE); - cdata = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - int len; - if ((*q == '&') && (purple_markup_unescape_entity(q, &len) == NULL)) - url = g_string_append(url, "&"); - else - url = g_string_append_c(url, *q); - q++; - } - p = q; - } else { - p++; - } - } - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "a"; - pt->dest_tag = "a"; - tags = g_list_prepend(tags, pt); - if(xhtml) - g_string_append_printf(xhtml, "", url ? g_strstrip(url->str) : ""); - continue; - } - if(!g_ascii_strncasecmp(c, "' || *(c+5) == ' ')) { - const char *p = c + 5; - GString *style = g_string_new(""); - struct purple_parse_tag *pt; - while (*p && *p != '>') { - if (!g_ascii_strncasecmp(p, "back=", 5)) { - const char *q = p + 5; - GString *color = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - color = g_string_append_c(color, *q); - q++; - } - g_string_append_printf(style, "background: %s; ", color->str); - g_string_free(color, TRUE); - p = q; - } else if (!g_ascii_strncasecmp(p, "color=", 6)) { - const char *q = p + 6; - GString *color = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - color = g_string_append_c(color, *q); - q++; - } - g_string_append_printf(style, "color: %s; ", color->str); - g_string_free(color, TRUE); - p = q; - } else if (!g_ascii_strncasecmp(p, "face=", 5)) { - const char *q = p + 5; - GString *face = g_string_new(""); - CHECK_QUOTE(q); - while (VALID_CHAR(q)) { - face = g_string_append_c(face, *q); - q++; - } - g_string_append_printf(style, "font-family: %s; ", g_strstrip(face->str)); - g_string_free(face, TRUE); - p = q; - } else if (!g_ascii_strncasecmp(p, "size=", 5)) { - const char *q = p + 5; - int sz; - const char *size = "medium"; - CHECK_QUOTE(q); - sz = atoi(q); - switch (sz) - { - case 1: - size = "xx-small"; - break; - case 2: - size = "small"; - break; - case 3: - size = "medium"; - break; - case 4: - size = "large"; - break; - case 5: - size = "x-large"; - break; - case 6: - case 7: - size = "xx-large"; - break; - default: - break; - } - g_string_append_printf(style, "font-size: %s; ", size); - p = q; - } else { - p++; - } - } - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - pt = g_new0(struct purple_parse_tag, 1); - pt->src_tag = "font"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - if(style->len && xhtml) - g_string_append_printf(xhtml, "", g_strstrip(style->str)); - else - pt->ignore = TRUE; - g_string_free(style, TRUE); - continue; - } - if (!g_ascii_strncasecmp(c, "", g_strstrip(color->str)); - g_string_free(color, TRUE); - if ((c = strchr(p, '>')) != NULL) - c++; - else - c = p; - pt->src_tag = "body"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); - did_something = TRUE; - break; - } - p++; - } - if (did_something) continue; - } - /* this has to come after the special case for bgcolor */ - ALLOW_TAG("body"); - if(!g_ascii_strncasecmp(c, ""); - if(p) { - if(xhtml) - xhtml = g_string_append(xhtml, "